From: support Date: Mon, 3 Oct 2022 08:03:58 +0000 (+0000) Subject: Built motion from commit 013e4bb4.|2.6.18 X-Git-Url: http://repos.xcallymotion.com/base/%22https:/wiki.xcallymotion.com/display/XMV//%22%7B%7Blicense.openchannel?a=commitdiff_plain;h=3ac3297427c1165fef87a9aa75b07037bfa00ec8;p=motion2.git Built motion from commit 013e4bb4.|2.6.18 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index a49100c..fbfdefc 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-10-03T07:29:09.565Z", + "time": "2022-10-03T07:56:23.469Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index 78f7aea..6d10868 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2022-10-03T07:29:09.565Z", + "time": "2022-10-03T07:56:23.469Z", "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 f9206bd..e1d335c 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 _0x2f02=['TEXT','sequelize','exports','getDataValue','STRING','contactManager','integration','motionbar','jscripty','urlForward','browser','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]','contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x2f02,0x11e));var _0x22f0=function(_0x4610f6,_0x5fe8c3){_0x4610f6=_0x4610f6-0x0;var _0x422a4d=_0x2f02[_0x4610f6];return _0x422a4d;};'use strict';var Sequelize=require(_0x22f0('0x0'));module[_0x22f0('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x16cda5){return this[_0x22f0('0x2')]('action');}},'action':{'type':Sequelize[_0x22f0('0x3')],'allowNull':![],'validate':{'isIn':{'args':[[_0x22f0('0x4'),_0x22f0('0x5'),_0x22f0('0x6'),_0x22f0('0x7'),_0x22f0('0x8'),_0x22f0('0x9'),_0x22f0('0xa'),_0x22f0('0xb')]],'msg':_0x22f0('0xc')}},'comment':_0x22f0('0xc')},'data1':{'type':Sequelize['STRING'](0x1000),'comment':_0x22f0('0xd')},'data2':{'type':Sequelize['STRING'](0x1000),'comment':_0x22f0('0xe')},'data3':{'type':Sequelize[_0x22f0('0x3')](0x1000),'comment':_0x22f0('0xf')},'data4':{'type':Sequelize['STRING'](0x1000),'comments':_0x22f0('0x10')},'data5':{'type':Sequelize[_0x22f0('0x3')](0x1000),'comments':_0x22f0('0x11')},'data6':{'type':Sequelize['STRING'],'comments':'urlForward[headers],\x20browser[wsindowHeight]'},'data7':{'type':Sequelize[_0x22f0('0x12')],'comments':'urlForward[body]'}}; \ No newline at end of file +var _0x07a3=['integration','motionbar','jscripty','urlForward','browser','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','urlForward[headers],\x20browser[wsindowHeight]','TEXT','urlForward[body]','exports','VIRTUAL','action','STRING','contactManager'];(function(_0x1909f9,_0x1795ef){var _0x4fc488=function(_0x4fb79a){while(--_0x4fb79a){_0x1909f9['push'](_0x1909f9['shift']());}};_0x4fc488(++_0x1795ef);}(_0x07a3,0xeb));var _0x307a=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0x07a3[_0xea8947];return _0x2455e9;};'use strict';var Sequelize=require('sequelize');module[_0x307a('0x0')]={'name':{'type':Sequelize[_0x307a('0x1')],'get':function(_0x4723bc){return this['getDataValue'](_0x307a('0x2'));}},'action':{'type':Sequelize[_0x307a('0x3')],'allowNull':![],'validate':{'isIn':{'args':[[_0x307a('0x4'),_0x307a('0x5'),_0x307a('0x6'),_0x307a('0x7'),_0x307a('0x8'),_0x307a('0x9'),_0x307a('0xa'),_0x307a('0xb')]],'msg':_0x307a('0xc')}},'comment':_0x307a('0xc')},'data1':{'type':Sequelize[_0x307a('0x3')](0x1000),'comment':_0x307a('0xd')},'data2':{'type':Sequelize['STRING'](0x1000),'comment':'contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]'},'data3':{'type':Sequelize[_0x307a('0x3')](0x1000),'comment':_0x307a('0xe')},'data4':{'type':Sequelize[_0x307a('0x3')](0x1000),'comments':_0x307a('0xf')},'data5':{'type':Sequelize[_0x307a('0x3')](0x1000),'comments':_0x307a('0x10')},'data6':{'type':Sequelize[_0x307a('0x3')],'comments':_0x307a('0x11')},'data7':{'type':Sequelize[_0x307a('0x12')],'comments':_0x307a('0x13')}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index 1b10030..16a2864 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 _0x16fa=['sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','then','destroy','error','stack','name','send','body','Action','find','params','catch','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util'];(function(_0x9328ec,_0x3485a4){var _0x416f55=function(_0x21e63f){while(--_0x21e63f){_0x9328ec['push'](_0x9328ec['shift']());}};_0x416f55(++_0x3485a4);}(_0x16fa,0xa8));var _0xa16f=function(_0x2c18a8,_0x24eaa5){_0x2c18a8=_0x2c18a8-0x0;var _0x1e009a=_0x16fa[_0x2c18a8];return _0x1e009a;};'use strict';var emlformat=require(_0xa16f('0x0'));var rimraf=require(_0xa16f('0x1'));var zipdir=require(_0xa16f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa16f('0x3'));var moment=require(_0xa16f('0x4'));var BPromise=require(_0xa16f('0x5'));var Mustache=require(_0xa16f('0x6'));var util=require('util');var path=require(_0xa16f('0x7'));var sox=require('sox');var csv=require(_0xa16f('0x8'));var ejs=require(_0xa16f('0x9'));var fs=require('fs');var fs_extra=require(_0xa16f('0xa'));var _=require(_0xa16f('0xb'));var squel=require('squel');var crypto=require(_0xa16f('0xc'));var jsforce=require(_0xa16f('0xd'));var deskjs=require(_0xa16f('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xa16f('0xf'));var Redis=require(_0xa16f('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xa16f('0x11'));var as=require(_0xa16f('0x12'));var hardwareService=require(_0xa16f('0x13'));var logger=require(_0xa16f('0x14'))(_0xa16f('0x15'));var utils=require(_0xa16f('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xa16f('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x155c46,_0x23209d){_0x23209d=_0x23209d||0xcc;return function(_0x1cc85f){if(_0x1cc85f){return _0x155c46[_0xa16f('0x18')](_0x23209d);}return _0x155c46[_0xa16f('0x19')](_0x23209d)[_0xa16f('0x1a')]();};}function respondWithResult(_0x1cbd0b,_0x3c731b){_0x3c731b=_0x3c731b||0xc8;return function(_0x22638b){if(_0x22638b){return _0x1cbd0b['status'](_0x3c731b)['json'](_0x22638b);}};}function respondWithFilteredResult(_0x27ba78,_0x40d811){return function(_0x3615be){if(_0x3615be){var _0x17b383=typeof _0x40d811['offset']===_0xa16f('0x1b')&&typeof _0x40d811[_0xa16f('0x1c')]===_0xa16f('0x1b');var _0x185f3d=_0x3615be[_0xa16f('0x1d')];var _0x1f3383=_0x17b383?0x0:_0x40d811['offset'];var _0x24732a=_0x17b383?_0x3615be[_0xa16f('0x1d')]:_0x40d811[_0xa16f('0x1e')]+_0x40d811['limit'];var _0x476736;if(_0x24732a>=_0x185f3d){_0x24732a=_0x185f3d;_0x476736=0xc8;}else{_0x476736=0xce;}_0x27ba78[_0xa16f('0x19')](_0x476736);return _0x27ba78[_0xa16f('0x1f')](_0xa16f('0x20'),_0x1f3383+'-'+_0x24732a+'/'+_0x185f3d)[_0xa16f('0x21')](_0x3615be);}return null;};}function patchUpdates(_0x1d4fc8){return function(_0x2baff8){try{jsonpatch[_0xa16f('0x22')](_0x2baff8,_0x1d4fc8,!![]);}catch(_0x3c029d){return BPromise[_0xa16f('0x23')](_0x3c029d);}return _0x2baff8[_0xa16f('0x24')]();};}function saveUpdates(_0x46bb0a,_0x5cd81d){return function(_0x143d95){if(_0x143d95){return _0x143d95['update'](_0x46bb0a)[_0xa16f('0x25')](function(_0x233ce7){return _0x233ce7;});}return null;};}function removeEntity(_0x1df484,_0x3a9850){return function(_0x5c47fc){if(_0x5c47fc){return _0x5c47fc[_0xa16f('0x26')]()[_0xa16f('0x25')](function(){_0x1df484[_0xa16f('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x42aaf9,_0x2975dd){return function(_0x39bc63){if(!_0x39bc63){_0x42aaf9['sendStatus'](0x194);}return _0x39bc63;};}function handleError(_0x3771f0,_0x501165){_0x501165=_0x501165||0x1f4;return function(_0x4b562d){logger[_0xa16f('0x27')](_0x4b562d[_0xa16f('0x28')]);if(_0x4b562d[_0xa16f('0x29')]){delete _0x4b562d[_0xa16f('0x29')];}_0x3771f0['status'](_0x501165)[_0xa16f('0x2a')](_0x4b562d);};}exports['update']=function(_0x47829d,_0x3ae97){if(_0x47829d['body']['id']){delete _0x47829d[_0xa16f('0x2b')]['id'];}return db[_0xa16f('0x2c')][_0xa16f('0x2d')]({'where':{'id':_0x47829d[_0xa16f('0x2e')]['id']}})[_0xa16f('0x25')](handleEntityNotFound(_0x3ae97,null))[_0xa16f('0x25')](saveUpdates(_0x47829d[_0xa16f('0x2b')],null))['then'](respondWithResult(_0x3ae97,null))[_0xa16f('0x2f')](handleError(_0x3ae97,null));};exports[_0xa16f('0x26')]=function(_0x4d2456,_0x9be1b6){return db['Action'][_0xa16f('0x2d')]({'where':{'id':_0x4d2456[_0xa16f('0x2e')]['id']}})[_0xa16f('0x25')](handleEntityNotFound(_0x9be1b6,null))[_0xa16f('0x25')](removeEntity(_0x9be1b6,null))[_0xa16f('0x2f')](handleError(_0x9be1b6,null));}; \ No newline at end of file +var _0x27e3=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','Content-Range','apply','update','then','destroy','end','error','name','body','find','params','catch','Action','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis'];(function(_0x3d34e7,_0x551608){var _0xdb83aa=function(_0x38f26c){while(--_0x38f26c){_0x3d34e7['push'](_0x3d34e7['shift']());}};_0xdb83aa(++_0x551608);}(_0x27e3,0x13c));var _0x327e=function(_0x1cf687,_0x551ff1){_0x1cf687=_0x1cf687-0x0;var _0x5e9758=_0x27e3[_0x1cf687];return _0x5e9758;};'use strict';var emlformat=require(_0x327e('0x0'));var rimraf=require(_0x327e('0x1'));var zipdir=require(_0x327e('0x2'));var jsonpatch=require(_0x327e('0x3'));var rp=require(_0x327e('0x4'));var moment=require(_0x327e('0x5'));var BPromise=require(_0x327e('0x6'));var Mustache=require(_0x327e('0x7'));var util=require(_0x327e('0x8'));var path=require(_0x327e('0x9'));var sox=require('sox');var csv=require(_0x327e('0xa'));var ejs=require(_0x327e('0xb'));var fs=require('fs');var fs_extra=require(_0x327e('0xc'));var _=require(_0x327e('0xd'));var squel=require(_0x327e('0xe'));var crypto=require(_0x327e('0xf'));var jsforce=require(_0x327e('0x10'));var deskjs=require(_0x327e('0x11'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x327e('0x12'));var Redis=require(_0x327e('0x13'));var authService=require(_0x327e('0x14'));var qs=require(_0x327e('0x15'));var as=require(_0x327e('0x16'));var hardwareService=require(_0x327e('0x17'));var logger=require(_0x327e('0x18'))(_0x327e('0x19'));var utils=require(_0x327e('0x1a'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x327e('0x1b'))['db'];function respondWithStatusCode(_0x544feb,_0x1a526f){_0x1a526f=_0x1a526f||0xcc;return function(_0x50bd04){if(_0x50bd04){return _0x544feb[_0x327e('0x1c')](_0x1a526f);}return _0x544feb[_0x327e('0x1d')](_0x1a526f)['end']();};}function respondWithResult(_0x314fda,_0x313f26){_0x313f26=_0x313f26||0xc8;return function(_0x34b083){if(_0x34b083){return _0x314fda[_0x327e('0x1d')](_0x313f26)[_0x327e('0x1e')](_0x34b083);}};}function respondWithFilteredResult(_0x1ca62d,_0x5749b5){return function(_0x3939b7){if(_0x3939b7){var _0x25d944=typeof _0x5749b5['offset']===_0x327e('0x1f')&&typeof _0x5749b5[_0x327e('0x20')]===_0x327e('0x1f');var _0x18ff02=_0x3939b7[_0x327e('0x21')];var _0x48da36=_0x25d944?0x0:_0x5749b5[_0x327e('0x22')];var _0x56709f=_0x25d944?_0x3939b7[_0x327e('0x21')]:_0x5749b5[_0x327e('0x22')]+_0x5749b5['limit'];var _0x5d65bb;if(_0x56709f>=_0x18ff02){_0x56709f=_0x18ff02;_0x5d65bb=0xc8;}else{_0x5d65bb=0xce;}_0x1ca62d[_0x327e('0x1d')](_0x5d65bb);return _0x1ca62d['set'](_0x327e('0x23'),_0x48da36+'-'+_0x56709f+'/'+_0x18ff02)[_0x327e('0x1e')](_0x3939b7);}return null;};}function patchUpdates(_0xb65671){return function(_0xd2298f){try{jsonpatch[_0x327e('0x24')](_0xd2298f,_0xb65671,!![]);}catch(_0x4a166f){return BPromise['reject'](_0x4a166f);}return _0xd2298f['save']();};}function saveUpdates(_0x203f9e,_0x8241f9){return function(_0x43f650){if(_0x43f650){return _0x43f650[_0x327e('0x25')](_0x203f9e)[_0x327e('0x26')](function(_0x24064b){return _0x24064b;});}return null;};}function removeEntity(_0x5bbcd0,_0x3e1bd3){return function(_0x53a2fc){if(_0x53a2fc){return _0x53a2fc[_0x327e('0x27')]()[_0x327e('0x26')](function(){_0x5bbcd0[_0x327e('0x1d')](0xcc)[_0x327e('0x28')]();});}};}function handleEntityNotFound(_0x12e9bb,_0x225211){return function(_0x456278){if(!_0x456278){_0x12e9bb['sendStatus'](0x194);}return _0x456278;};}function handleError(_0x31470c,_0x214b4b){_0x214b4b=_0x214b4b||0x1f4;return function(_0x4f79eb){logger[_0x327e('0x29')](_0x4f79eb['stack']);if(_0x4f79eb[_0x327e('0x2a')]){delete _0x4f79eb[_0x327e('0x2a')];}_0x31470c[_0x327e('0x1d')](_0x214b4b)['send'](_0x4f79eb);};}exports['update']=function(_0x30e97a,_0x14fd9b){if(_0x30e97a[_0x327e('0x2b')]['id']){delete _0x30e97a[_0x327e('0x2b')]['id'];}return db['Action'][_0x327e('0x2c')]({'where':{'id':_0x30e97a[_0x327e('0x2d')]['id']}})['then'](handleEntityNotFound(_0x14fd9b,null))[_0x327e('0x26')](saveUpdates(_0x30e97a[_0x327e('0x2b')],null))['then'](respondWithResult(_0x14fd9b,null))[_0x327e('0x2e')](handleError(_0x14fd9b,null));};exports[_0x327e('0x27')]=function(_0x23fe42,_0x2c557b){return db[_0x327e('0x2f')][_0x327e('0x2c')]({'where':{'id':_0x23fe42['params']['id']}})[_0x327e('0x26')](handleEntityNotFound(_0x2c557b,null))[_0x327e('0x26')](removeEntity(_0x2c557b,null))['catch'](handleError(_0x2c557b,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index edbe393..57f2242 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 _0x872d=['path','rimraf','../../config/environment','define','tools_actions','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x14de7c,_0x27ea3c){var _0xc51624=function(_0xbabd26){while(--_0xbabd26){_0x14de7c['push'](_0x14de7c['shift']());}};_0xc51624(++_0x27ea3c);}(_0x872d,0x144));var _0xd872=function(_0x4b196d,_0x4c2f71){_0x4b196d=_0x4b196d-0x0;var _0x41e302=_0x872d[_0x4b196d];return _0x41e302;};'use strict';var _=require(_0xd872('0x0'));var util=require(_0xd872('0x1'));var logger=require(_0xd872('0x2'))(_0xd872('0x3'));var moment=require(_0xd872('0x4'));var BPromise=require(_0xd872('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd872('0x6'));var rimraf=require(_0xd872('0x7'));var config=require(_0xd872('0x8'));var attributes=require('./action.attributes');module['exports']=function(_0x121f7b,_0x2a737f){return _0x121f7b[_0xd872('0x9')]('Action',attributes,{'tableName':_0xd872('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1cc5=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./action.attributes','define','lodash','util'];(function(_0x3ffb6c,_0x2b728b){var _0x34b737=function(_0x569621){while(--_0x569621){_0x3ffb6c['push'](_0x3ffb6c['shift']());}};_0x34b737(++_0x2b728b);}(_0x1cc5,0x132));var _0x51cc=function(_0xfdec06,_0x9fa2f4){_0xfdec06=_0xfdec06-0x0;var _0x58a539=_0x1cc5[_0xfdec06];return _0x58a539;};'use strict';var _=require(_0x51cc('0x0'));var util=require(_0x51cc('0x1'));var logger=require(_0x51cc('0x2'))(_0x51cc('0x3'));var moment=require(_0x51cc('0x4'));var BPromise=require(_0x51cc('0x5'));var rp=require(_0x51cc('0x6'));var fs=require('fs');var path=require(_0x51cc('0x7'));var rimraf=require(_0x51cc('0x8'));var config=require('../../config/environment');var attributes=require(_0x51cc('0x9'));module['exports']=function(_0x334bca,_0x1b59ee){return _0x334bca[_0x51cc('0xa')]('Action',attributes,{'tableName':'tools_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/action/action.rpc.js b/server/api/action/action.rpc.js index 057a8aa..a8f2a9b 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 _0x53ec=['error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','request','then','info','Action,\x20%s,\x20%s','request\x20sent','debug','stringify','code'];(function(_0x2faddb,_0xc18b78){var _0x273c05=function(_0x1a3785){while(--_0x1a3785){_0x2faddb['push'](_0x2faddb['shift']());}};_0x273c05(++_0xc18b78);}(_0x53ec,0x192));var _0xc53e=function(_0x367a44,_0x121a26){_0x367a44=_0x367a44-0x0;var _0x14c9d1=_0x53ec[_0x367a44];return _0x14c9d1;};'use strict';var _=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var moment=require(_0xc53e('0x2'));var BPromise=require(_0xc53e('0x3'));var rs=require(_0xc53e('0x4'));var fs=require('fs');var Redis=require(_0xc53e('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xc53e('0x6'));var logger=require('../../config/logger')(_0xc53e('0x7'));var config=require(_0xc53e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xc53e('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x41a9e8,_0x2de88b,_0x5d3b28){return new BPromise(function(_0x1616ac,_0x1ac6c0){return client[_0xc53e('0xa')](_0x41a9e8,_0x5d3b28)[_0xc53e('0xb')](function(_0xd9612){logger[_0xc53e('0xc')](_0xc53e('0xd'),_0x2de88b,_0xc53e('0xe'));logger[_0xc53e('0xf')]('Action,\x20%s,\x20%s,\x20%s',_0x2de88b,'request\x20sent',JSON[_0xc53e('0x10')](_0xd9612));if(_0xd9612['error']){if(_0xd9612['error'][_0xc53e('0x11')]===0x1f4){logger[_0xc53e('0x12')](_0xc53e('0xd'),_0x2de88b,_0xd9612[_0xc53e('0x12')]['message']);return _0x1ac6c0(_0xd9612['error'][_0xc53e('0x13')]);}logger[_0xc53e('0x12')](_0xc53e('0xd'),_0x2de88b,_0xd9612[_0xc53e('0x12')][_0xc53e('0x13')]);return _0x1616ac(_0xd9612[_0xc53e('0x12')][_0xc53e('0x13')]);}else{logger[_0xc53e('0xc')](_0xc53e('0xd'),_0x2de88b,_0xc53e('0xe'));_0x1616ac(_0xd9612['result'][_0xc53e('0x13')]);}})[_0xc53e('0x14')](function(_0x535cd4){logger[_0xc53e('0x12')](_0xc53e('0xd'),_0x2de88b,_0x535cd4);_0x1ac6c0(_0x535cd4);});});} \ No newline at end of file +var _0xabce=['util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','client','then','info','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash'];(function(_0x1727ff,_0x4dd238){var _0x2e1947=function(_0x3a9a18){while(--_0x3a9a18){_0x1727ff['push'](_0x1727ff['shift']());}};_0x2e1947(++_0x4dd238);}(_0xabce,0x103));var _0xeabc=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xabce[_0x5ddb1c];return _0x354adc;};'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')]('Action,\x20%s,\x20%s',_0x52ede8,_0xeabc('0xc'));_0x9417af(_0x341f16[_0xeabc('0x13')]['message']);}})['catch'](function(_0x10fa8e){logger['error'](_0xeabc('0xb'),_0x52ede8,_0x10fa8e);_0x8434c5(_0x10fa8e);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index be6e8be..c7e0e41 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 _0xdb50=['put','/:id','update','delete','isAuthenticated','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./action.controller'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0xdb50,0x124));var _0x0db5=function(_0x222264,_0x239734){_0x222264=_0x222264-0x0;var _0x59bd6c=_0xdb50[_0x222264];return _0x59bd6c;};'use strict';var multer=require(_0x0db5('0x0'));var util=require('util');var path=require(_0x0db5('0x1'));var timeout=require(_0x0db5('0x2'));var express=require(_0x0db5('0x3'));var router=express[_0x0db5('0x4')]();var fs_extra=require(_0x0db5('0x5'));var auth=require(_0x0db5('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x0db5('0x7'));router[_0x0db5('0x8')](_0x0db5('0x9'),auth['isAuthenticated'](),controller[_0x0db5('0xa')]);router[_0x0db5('0xb')](_0x0db5('0x9'),auth[_0x0db5('0xc')](),controller[_0x0db5('0xd')]);module[_0x0db5('0xe')]=router; \ No newline at end of file +var _0xfbe6=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./action.controller','put','/:id','update','delete','isAuthenticated','exports','util','path','connect-timeout','express'];(function(_0x2a0cd4,_0x6b7b9a){var _0xe8e32c=function(_0x51bf29){while(--_0x51bf29){_0x2a0cd4['push'](_0x2a0cd4['shift']());}};_0xe8e32c(++_0x6b7b9a);}(_0xfbe6,0x182));var _0x6fbe=function(_0x387862,_0x5366b0){_0x387862=_0x387862-0x0;var _0x629b49=_0xfbe6[_0x387862];return _0x629b49;};'use strict';var multer=require('multer');var util=require(_0x6fbe('0x0'));var path=require(_0x6fbe('0x1'));var timeout=require(_0x6fbe('0x2'));var express=require(_0x6fbe('0x3'));var router=express['Router']();var fs_extra=require(_0x6fbe('0x4'));var auth=require(_0x6fbe('0x5'));var interaction=require(_0x6fbe('0x6'));var config=require(_0x6fbe('0x7'));var controller=require(_0x6fbe('0x8'));router[_0x6fbe('0x9')](_0x6fbe('0xa'),auth['isAuthenticated'](),controller[_0x6fbe('0xb')]);router[_0x6fbe('0xc')](_0x6fbe('0xa'),auth[_0x6fbe('0xd')](),controller['destroy']);module[_0x6fbe('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 49bed78..1894546 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 _0x9957=['exports','STRING','TEXT','sequelize'];(function(_0x228057,_0x4e126d){var _0x5bc25b=function(_0x59a59d){while(--_0x59a59d){_0x228057['push'](_0x228057['shift']());}};_0x5bc25b(++_0x4e126d);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'name':{'type':Sequelize[_0x7995('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x7995('0x2')]},'parent':{'type':Sequelize['STRING']},'table':{'type':Sequelize[_0x7995('0x2')]},'conditions':{'type':Sequelize[_0x7995('0x3')]},'joins':{'type':Sequelize[_0x7995('0x3')]}}; \ No newline at end of file +var _0x4819=['TEXT','exports','STRING'];(function(_0x280ae7,_0x456fb1){var _0x418b9e=function(_0x4d730d){while(--_0x4d730d){_0x280ae7['push'](_0x280ae7['shift']());}};_0x418b9e(++_0x456fb1);}(_0x4819,0xcd));var _0x9481=function(_0x4ca7c7,_0x5d16ee){_0x4ca7c7=_0x4ca7c7-0x0;var _0x456a87=_0x4819[_0x4ca7c7];return _0x456a87;};'use strict';var Sequelize=require('sequelize');module[_0x9481('0x0')]={'name':{'type':Sequelize[_0x9481('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x9481('0x1')]},'parent':{'type':Sequelize[_0x9481('0x1')]},'table':{'type':Sequelize[_0x9481('0x1')]},'conditions':{'type':Sequelize[_0x9481('0x2')]},'joins':{'type':Sequelize[_0x9481('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index 5ac9a33..9d9a666 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 _0x15e9=['format','groupBy','orderBy','order','DESC','alias','joins','parse','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','clone','debug','toString','sequelize','QueryTypes','SELECT','COUNT(DISTINCT\x20%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','Please\x20insert\x20at\x20least\x20one\x20field','select','table','output','fullPath','%s-%s.%s','randomstring','generate','csv','custom','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','startDate','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','savename','countTable','left_join','AVG(%s)','metric','Limited\x20Query:','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','status','undefined','limit','count','offset','set','Content-Range','json','reject','update','destroy','CustomReports','UserProfileResource','then','stack','name','send','index','map','AnalyticCustomReport','fieldName','type','key','query','keys','intersection','attributes','model','fields','length','hasOwnProperty','sort','filters','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','catch','rawAttributes','options','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','Reports','UserProfileSection','find','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','join','right_join','cross_join','SUM(%s)','COUNT(%s)','MAX(%s)','MIN(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','getFields','Sequelize','ValidationErrorItem','AnalyticMetric','keyBy','from','MetricId','function','replace'];(function(_0x1233a9,_0x11cbfe){var _0x8023d2=function(_0x11122a){while(--_0x11122a){_0x1233a9['push'](_0x1233a9['shift']());}};_0x8023d2(++_0x11cbfe);}(_0x15e9,0xd6));var _0x915e=function(_0x51edc2,_0x24206b){_0x51edc2=_0x51edc2-0x0;var _0x268dee=_0x15e9[_0x51edc2];return _0x268dee;};'use strict';var emlformat=require(_0x915e('0x0'));var rimraf=require(_0x915e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x915e('0x2'));var rp=require(_0x915e('0x3'));var moment=require(_0x915e('0x4'));var BPromise=require(_0x915e('0x5'));var Mustache=require(_0x915e('0x6'));var util=require(_0x915e('0x7'));var path=require('path');var sox=require(_0x915e('0x8'));var csv=require(_0x915e('0x9'));var ejs=require(_0x915e('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x915e('0xb'));var squel=require(_0x915e('0xc'));var crypto=require(_0x915e('0xd'));var jsforce=require(_0x915e('0xe'));var deskjs=require(_0x915e('0xf'));var toCsv=require(_0x915e('0x9'));var querystring=require(_0x915e('0x10'));var Papa=require('papaparse');var Redis=require(_0x915e('0x11'));var authService=require(_0x915e('0x12'));var qs=require(_0x915e('0x13'));var as=require(_0x915e('0x14'));var hardwareService=require(_0x915e('0x15'));var logger=require('../../config/logger')(_0x915e('0x16'));var utils=require(_0x915e('0x17'));var config=require(_0x915e('0x18'));var licenseUtil=require(_0x915e('0x19'));var db=require(_0x915e('0x1a'))['db'];var dbH=require(_0x915e('0x1a'))[_0x915e('0x1b')];function respondWithStatusCode(_0x20abac,_0x50805b){_0x50805b=_0x50805b||0xcc;return function(_0x33c230){if(_0x33c230){return _0x20abac[_0x915e('0x1c')](_0x50805b);}return _0x20abac[_0x915e('0x1d')](_0x50805b)['end']();};}function respondWithResult(_0x1f8611,_0xe3cdff){_0xe3cdff=_0xe3cdff||0xc8;return function(_0x1258a3){if(_0x1258a3){return _0x1f8611[_0x915e('0x1d')](_0xe3cdff)['json'](_0x1258a3);}};}function respondWithFilteredResult(_0x137ad4,_0x59a803){return function(_0xdaad8a){if(_0xdaad8a){var _0x333767=typeof _0x59a803['offset']===_0x915e('0x1e')&&typeof _0x59a803[_0x915e('0x1f')]===_0x915e('0x1e');var _0x34dc1e=_0xdaad8a[_0x915e('0x20')];var _0xdc9a7d=_0x333767?0x0:_0x59a803['offset'];var _0x50fd1c=_0x333767?_0xdaad8a[_0x915e('0x20')]:_0x59a803[_0x915e('0x21')]+_0x59a803[_0x915e('0x1f')];var _0x3a597f;if(_0x50fd1c>=_0x34dc1e){_0x50fd1c=_0x34dc1e;_0x3a597f=0xc8;}else{_0x3a597f=0xce;}_0x137ad4[_0x915e('0x1d')](_0x3a597f);return _0x137ad4[_0x915e('0x22')](_0x915e('0x23'),_0xdc9a7d+'-'+_0x50fd1c+'/'+_0x34dc1e)[_0x915e('0x24')](_0xdaad8a);}return null;};}function patchUpdates(_0x17c0bd){return function(_0xebe891){try{jsonpatch['apply'](_0xebe891,_0x17c0bd,!![]);}catch(_0x11f0d9){return BPromise[_0x915e('0x25')](_0x11f0d9);}return _0xebe891['save']();};}function saveUpdates(_0x1139f4,_0x5c93f1){return function(_0x3b8ce2){if(_0x3b8ce2){return _0x3b8ce2[_0x915e('0x26')](_0x1139f4)['then'](function(_0x56edc5){return _0x56edc5;});}return null;};}function removeEntity(_0x94eba7,_0x403299){return function(_0x3e5b2b){if(_0x3e5b2b){return _0x3e5b2b[_0x915e('0x27')]()['then'](function(){var _0x524660=_0x3e5b2b['get']({'plain':!![]});var _0x4dc6ec=_0x915e('0x28');return db[_0x915e('0x29')]['destroy']({'where':{'type':_0x4dc6ec,'resourceId':_0x524660['id']}})['then'](function(){return _0x3e5b2b;});})[_0x915e('0x2a')](function(){_0x94eba7[_0x915e('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x32e4f1,_0x5e7557){return function(_0x3fe5ff){if(!_0x3fe5ff){_0x32e4f1['sendStatus'](0x194);}return _0x3fe5ff;};}function handleError(_0x28a549,_0x1d6c71){_0x1d6c71=_0x1d6c71||0x1f4;return function(_0x3a6dc5){logger['error'](_0x3a6dc5[_0x915e('0x2b')]);if(_0x3a6dc5[_0x915e('0x2c')]){delete _0x3a6dc5[_0x915e('0x2c')];}_0x28a549[_0x915e('0x1d')](_0x1d6c71)[_0x915e('0x2d')](_0x3a6dc5);};}exports[_0x915e('0x2e')]=function(_0x177f40,_0x6f730c){var _0x49b064={},_0x235968={},_0x4e3710={'count':0x0,'rows':[]};var _0x30a4a1=_[_0x915e('0x2f')](db[_0x915e('0x30')]['rawAttributes'],function(_0x40e17b){return{'name':_0x40e17b[_0x915e('0x31')],'type':_0x40e17b[_0x915e('0x32')][_0x915e('0x33')]};});_0x235968['model']=_[_0x915e('0x2f')](_0x30a4a1,_0x915e('0x2c'));_0x235968[_0x915e('0x34')]=_[_0x915e('0x35')](_0x177f40[_0x915e('0x34')]);_0x235968['filters']=_[_0x915e('0x36')](_0x235968['model'],_0x235968[_0x915e('0x34')]);_0x49b064[_0x915e('0x37')]=_[_0x915e('0x36')](_0x235968[_0x915e('0x38')],qs[_0x915e('0x39')](_0x177f40['query'][_0x915e('0x39')]));_0x49b064[_0x915e('0x37')]=_0x49b064[_0x915e('0x37')][_0x915e('0x3a')]?_0x49b064[_0x915e('0x37')]:_0x235968['model'];if(!_0x177f40[_0x915e('0x34')][_0x915e('0x3b')]('nolimit')){_0x49b064[_0x915e('0x1f')]=qs[_0x915e('0x1f')](_0x177f40[_0x915e('0x34')][_0x915e('0x1f')]);_0x49b064[_0x915e('0x21')]=qs[_0x915e('0x21')](_0x177f40['query'][_0x915e('0x21')]);}_0x49b064['order']=qs[_0x915e('0x3c')](_0x177f40['query'][_0x915e('0x3c')]);_0x49b064['where']=qs[_0x915e('0x3d')](_['pick'](_0x177f40[_0x915e('0x34')],_0x235968[_0x915e('0x3d')]),_0x30a4a1);if(_0x177f40[_0x915e('0x34')][_0x915e('0x3e')]){_0x49b064[_0x915e('0x3f')]=_[_0x915e('0x40')](_0x49b064[_0x915e('0x3f')],{'$or':_[_0x915e('0x2f')](_0x30a4a1,function(_0x2ea03f){if(_0x2ea03f['type']!==_0x915e('0x41')){var _0x4106ff={};_0x4106ff[_0x2ea03f[_0x915e('0x2c')]]={'$like':'%'+_0x177f40[_0x915e('0x34')]['filter']+'%'};return _0x4106ff;}})});}_0x49b064=_[_0x915e('0x40')]({},_0x49b064,_0x177f40['options']);var _0x1e2bf5={'where':_0x49b064[_0x915e('0x3f')]};return db[_0x915e('0x30')]['count'](_0x1e2bf5)['then'](function(_0x544c32){_0x4e3710[_0x915e('0x20')]=_0x544c32;if(_0x177f40[_0x915e('0x34')][_0x915e('0x42')]){_0x49b064[_0x915e('0x43')]=[{'all':!![]}];}return db[_0x915e('0x30')][_0x915e('0x44')](_0x49b064);})[_0x915e('0x2a')](function(_0x1d8047){_0x4e3710[_0x915e('0x45')]=_0x1d8047;return _0x4e3710;})[_0x915e('0x2a')](respondWithFilteredResult(_0x6f730c,_0x49b064))[_0x915e('0x46')](handleError(_0x6f730c,null));};exports['show']=function(_0xf2cfcf,_0x247240){var _0x5e6107={'raw':![],'where':{'id':_0xf2cfcf['params']['id']}},_0x4dc629={};_0x4dc629[_0x915e('0x38')]=_[_0x915e('0x35')](db[_0x915e('0x30')][_0x915e('0x47')]);_0x4dc629[_0x915e('0x34')]=_[_0x915e('0x35')](_0xf2cfcf['query']);_0x4dc629['filters']=_['intersection'](_0x4dc629[_0x915e('0x38')],_0x4dc629[_0x915e('0x34')]);_0x5e6107[_0x915e('0x37')]=_['intersection'](_0x4dc629[_0x915e('0x38')],qs[_0x915e('0x39')](_0xf2cfcf[_0x915e('0x34')]['fields']));_0x5e6107[_0x915e('0x37')]=_0x5e6107['attributes'][_0x915e('0x3a')]?_0x5e6107[_0x915e('0x37')]:_0x4dc629[_0x915e('0x38')];if(_0xf2cfcf[_0x915e('0x34')][_0x915e('0x42')]){_0x5e6107[_0x915e('0x43')]=[{'all':!![]}];}_0x5e6107=_['merge']({},_0x5e6107,_0xf2cfcf[_0x915e('0x48')]);return db[_0x915e('0x30')]['find'](_0x5e6107)[_0x915e('0x2a')](handleEntityNotFound(_0x247240,null))[_0x915e('0x2a')](respondWithResult(_0x247240,null))[_0x915e('0x46')](handleError(_0x247240,null));};exports[_0x915e('0x49')]=function(_0x2ab0ed,_0x2fb5ac){return db[_0x915e('0x30')][_0x915e('0x49')](_0x2ab0ed['body'],{})[_0x915e('0x2a')](function(_0x353f70){var _0x45a7ac=_0x2ab0ed[_0x915e('0x4a')][_0x915e('0x4b')]({'plain':!![]});if(!_0x45a7ac)throw new Error(_0x915e('0x4c'));if(_0x45a7ac['role']===_0x915e('0x4a')){var _0x249af7=_0x353f70[_0x915e('0x4b')]({'plain':!![]});var _0x1148b1=_0x915e('0x4d');return db[_0x915e('0x4e')][_0x915e('0x4f')]({'where':{'name':_0x1148b1,'userProfileId':_0x45a7ac[_0x915e('0x50')]},'raw':!![]})[_0x915e('0x2a')](function(_0x5b6cfd){if(_0x5b6cfd&&_0x5b6cfd['autoAssociation']===0x0){return db[_0x915e('0x29')][_0x915e('0x49')]({'name':_0x249af7[_0x915e('0x2c')],'resourceId':_0x249af7['id'],'type':_0x915e('0x28'),'sectionId':_0x5b6cfd['id']},{})[_0x915e('0x2a')](function(){return _0x353f70;});}else{return _0x353f70;}})[_0x915e('0x46')](function(_0x27cc60){logger[_0x915e('0x51')](_0x915e('0x52'),_0x27cc60);throw _0x27cc60;});}return _0x353f70;})[_0x915e('0x2a')](respondWithResult(_0x2fb5ac,0xc9))['catch'](handleError(_0x2fb5ac,null));};exports[_0x915e('0x26')]=function(_0x1658d1,_0xacac19){if(_0x1658d1[_0x915e('0x53')]['id']){delete _0x1658d1['body']['id'];}return db[_0x915e('0x30')][_0x915e('0x4f')]({'where':{'id':_0x1658d1[_0x915e('0x54')]['id']}})[_0x915e('0x2a')](handleEntityNotFound(_0xacac19,null))['then'](saveUpdates(_0x1658d1[_0x915e('0x53')],null))[_0x915e('0x2a')](respondWithResult(_0xacac19,null))[_0x915e('0x46')](handleError(_0xacac19,null));};exports['destroy']=function(_0x16f7d1,_0x2eeb77){return db['AnalyticCustomReport'][_0x915e('0x4f')]({'where':{'id':_0x16f7d1[_0x915e('0x54')]['id']}})[_0x915e('0x2a')](handleEntityNotFound(_0x2eeb77,null))[_0x915e('0x2a')](removeEntity(_0x2eeb77,null))[_0x915e('0x46')](handleError(_0x2eeb77,null));};exports['preview']=function(_0x50a6cb,_0x4f54b9){var _0x4f7bf4=0xa;var _0x1c8a91=[_0x915e('0x55'),'left_join',_0x915e('0x56'),_0x915e('0x57')];var _0x4340fd={'SUM':_0x915e('0x58'),'COUNT':_0x915e('0x59'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x915e('0x5a'),'MIN':_0x915e('0x5b'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x915e('0x5c'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x915e('0x5d')};var _0x39397d={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x915e('0x5e'),'HOUR':_0x915e('0x5f'),'ROUND':_0x915e('0x60'),'UNIX_TIMESTAMP':_0x915e('0x61')};var _0x4d9563=function(_0x546524){return!_[_0x915e('0x62')]([_0x915e('0x63'),_0x915e('0x64'),_0x915e('0x65'),_0x915e('0x66')],_0x546524);};var _0x2e6ce2=function(_0x36d56b){if(!_0x36d56b||!_0x36d56b[_0x915e('0x67')][_0x915e('0x3a')]){return'';}for(var _0x25f118='(',_0x199b9f=0x0;_0x199b9f<_0x36d56b['rules'][_0x915e('0x3a')];_0x199b9f+=0x1){_0x199b9f>0x0&&(_0x25f118+='\x20'+_0x36d56b[_0x915e('0x68')]+'\x20');_0x25f118+=_0x36d56b[_0x915e('0x67')][_0x199b9f]['group']?_0x2e6ce2(_0x36d56b['rules'][_0x199b9f][_0x915e('0x69')]):_0x36d56b[_0x915e('0x67')][_0x199b9f][_0x915e('0x6a')]+'\x20'+_0x36d56b[_0x915e('0x67')][_0x199b9f]['condition']+(_0x4d9563(_0x36d56b[_0x915e('0x67')][_0x199b9f][_0x915e('0x6b')])?'\x20'+_0x36d56b[_0x915e('0x67')][_0x199b9f][_0x915e('0x6c')]:'');}return _0x25f118+')';};var _0x48d4f0={'where':{'id':_0x50a6cb[_0x915e('0x54')]['id']}},_0x4a9efc,_0x4e3dc4,_0x421f36,_0x139589,_0x11678b;_0x48d4f0=_['merge']({},_0x48d4f0,_0x50a6cb[_0x915e('0x48')]);return db[_0x915e('0x30')][_0x915e('0x4f')](_0x48d4f0)[_0x915e('0x2a')](function(_0x1762fe){if(_0x1762fe){_0x4a9efc=_0x1762fe;return _0x1762fe[_0x915e('0x6d')]();}return null;})[_0x915e('0x2a')](function(_0x244297){if(_0x244297){if(!_0x244297[_0x915e('0x3a')]){throw new db[(_0x915e('0x6e'))][(_0x915e('0x6f'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x4e3dc4=_0x244297;return db[_0x915e('0x70')][_0x915e('0x44')]({'raw':!![]});}return null;})[_0x915e('0x2a')](function(_0x1ff4db){if(_0x1ff4db){_0x421f36=_[_0x915e('0x71')](_0x1ff4db,'id');var _0x4c2cad;var _0x4a171f=squel['select']();_0x4a171f[_0x915e('0x72')](_0x4a9efc['table']);for(var _0x4bafe9=0x0;_0x4bafe9<_0x4e3dc4[_0x915e('0x3a')];_0x4bafe9+=0x1){_0x4c2cad=_0x4e3dc4[_0x4bafe9]['MetricId']?_0x421f36[_0x4e3dc4[_0x4bafe9][_0x915e('0x73')]]['metric']:_0x4e3dc4[_0x4bafe9]['field'];_0x4c2cad=_0x4e3dc4[_0x4bafe9][_0x915e('0x74')]?_[_0x915e('0x75')](_0x4340fd[_0x4e3dc4[_0x4bafe9][_0x915e('0x74')]],'%s',_0x4c2cad):_0x4c2cad;_0x4c2cad=_0x4e3dc4[_0x4bafe9]['format']?_['replace'](_0x39397d[_0x4e3dc4[_0x4bafe9][_0x915e('0x76')]],'%s',_0x4c2cad):_0x4c2cad;if(_0x4e3dc4[_0x4bafe9][_0x915e('0x77')]){_0x4a171f['group'](_0x4c2cad);}_0x4e3dc4[_0x4bafe9][_0x915e('0x78')]&&_0x4a171f[_0x915e('0x79')](_0x4c2cad,_0x4e3dc4[_0x4bafe9]['orderBy']===_0x915e('0x7a')?![]:!![]);_0x4a171f[_0x915e('0x6a')](_0x4c2cad,_0x4e3dc4[_0x4bafe9][_0x915e('0x7b')]||_0x4c2cad);}if(_0x4a9efc[_0x915e('0x7c')]){_0x4a9efc[_0x915e('0x7c')]=JSON[_0x915e('0x7d')](_0x4a9efc[_0x915e('0x7c')]);for(var _0x325d79=0x0;_0x325d79<_0x4a9efc[_0x915e('0x7c')][_0x915e('0x3a')];_0x325d79+=0x1){if(_0x4a9efc[_0x915e('0x7c')][_0x325d79][_0x915e('0x32')]&&_['includes'](_0x1c8a91,_0x4a9efc[_0x915e('0x7c')][_0x325d79][_0x915e('0x32')])&&_0x4a9efc['joins'][_0x325d79][_0x915e('0x7e')]&&_0x4a9efc[_0x915e('0x7c')][_0x325d79][_0x915e('0x7f')]&&_0x4a9efc[_0x915e('0x7c')][_0x325d79][_0x915e('0x80')]){_0x4a171f[_0x4a9efc[_0x915e('0x7c')][_0x325d79][_0x915e('0x32')]](_0x4a9efc['joins'][_0x325d79][_0x915e('0x7f')],null,util[_0x915e('0x76')](_0x915e('0x81'),_0x4a9efc['table'],_0x4a9efc['joins'][_0x325d79][_0x915e('0x7e')],_0x4a9efc[_0x915e('0x7c')][_0x325d79][_0x915e('0x7f')],_0x4a9efc[_0x915e('0x7c')][_0x325d79][_0x915e('0x80')]));}}}if(_0x4a9efc['conditions']){_0x4a9efc[_0x915e('0x82')]=JSON[_0x915e('0x7d')](_0x4a9efc[_0x915e('0x82')]);_0x4a171f[_0x915e('0x3f')](_0x2e6ce2(_0x4a9efc['conditions'][_0x915e('0x69')]));}_0x11678b=_0x4a171f[_0x915e('0x83')]();_0x4a171f['limit'](_0x4f7bf4);_0x4a171f[_0x915e('0x21')](0x0);logger[_0x915e('0x84')]('Limited\x20Query:',_0x4a171f[_0x915e('0x85')]());return dbH[_0x915e('0x86')][_0x915e('0x34')](_0x4a171f[_0x915e('0x85')](),{'type':dbH['sequelize'][_0x915e('0x87')][_0x915e('0x88')]});}})[_0x915e('0x2a')](respondWithResult(_0x4f54b9,null))[_0x915e('0x46')](handleError(_0x4f54b9,null));};function runReport(_0x29e21c,_0x253659,_0x53266f){var _0x15db22=_0x253659['name'];var _0x47ebc5=0xa;var _0x96dc37=[_0x915e('0x55'),'left_join','right_join',_0x915e('0x57')];var _0x40c314={'SUM':_0x915e('0x58'),'COUNT':_0x915e('0x59'),'COUNT DISTINCT':_0x915e('0x89'),'MAX':_0x915e('0x5a'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0x915e('0x5c'),'GROUP_CONCAT ASC':_0x915e('0x8a'),'GROUP_CONCAT DESC':_0x915e('0x5d')};var _0x3883ad={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x915e('0x5e'),'HOUR':_0x915e('0x5f'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x3fc9ad=function(_0x40b89a){return!_['includes'](['IS\x20NULL','IS\x20NOT\x20NULL',_0x915e('0x65'),_0x915e('0x66')],_0x40b89a);};var _0x15e3d8=function(_0x21f012){if(!_0x21f012||!_0x21f012[_0x915e('0x67')][_0x915e('0x3a')]){return'';}for(var _0x365e3d='(',_0x19dc61=0x0;_0x19dc61<_0x21f012[_0x915e('0x67')][_0x915e('0x3a')];_0x19dc61+=0x1){_0x19dc61>0x0&&(_0x365e3d+='\x20'+_0x21f012[_0x915e('0x68')]+'\x20');_0x365e3d+=_0x21f012[_0x915e('0x67')][_0x19dc61][_0x915e('0x69')]?_0x15e3d8(_0x21f012['rules'][_0x19dc61][_0x915e('0x69')]):_0x21f012[_0x915e('0x67')][_0x19dc61]['field']+'\x20'+_0x21f012['rules'][_0x19dc61][_0x915e('0x6b')]+(_0x3fc9ad(_0x21f012[_0x915e('0x67')][_0x19dc61][_0x915e('0x6b')])?'\x20'+_0x21f012[_0x915e('0x67')][_0x19dc61][_0x915e('0x6c')]:'');}return _0x365e3d+')';};var _0x2d7ca8={'where':{'id':_0x29e21c['id']}},_0x2e85e7,_0x4df524,_0x4c495f,_0x57cdac,_0x5f4a5c;_0x2d7ca8=_[_0x915e('0x40')]({},_0x2d7ca8,_0x53266f);return db[_0x915e('0x30')]['find'](_0x2d7ca8)[_0x915e('0x2a')](function(_0x3066f9){if(_0x3066f9){_0x2e85e7=_0x3066f9;return _0x3066f9[_0x915e('0x6d')]();}return null;})['then'](function(_0x4b3be3){if(_0x4b3be3){if(!_0x4b3be3['length']){throw new db[(_0x915e('0x6e'))][(_0x915e('0x6f'))](_0x915e('0x8b'),0x193);}_0x4df524=_0x4b3be3;return db[_0x915e('0x70')][_0x915e('0x44')]({'raw':!![]});}return null;})[_0x915e('0x2a')](function(_0x581904){if(_0x581904){_0x4c495f=_[_0x915e('0x71')](_0x581904,'id');var _0x482711;var _0x21a285=squel[_0x915e('0x8c')]();_0x21a285[_0x915e('0x72')](_0x2e85e7['table']);for(var _0x51ff56=0x0;_0x51ff56<_0x4df524[_0x915e('0x3a')];_0x51ff56+=0x1){_0x482711=_0x4df524[_0x51ff56][_0x915e('0x73')]?_0x4c495f[_0x4df524[_0x51ff56][_0x915e('0x73')]]['metric']:_0x4df524[_0x51ff56][_0x915e('0x6a')];_0x482711=_0x4df524[_0x51ff56]['function']?_['replace'](_0x40c314[_0x4df524[_0x51ff56][_0x915e('0x74')]],'%s',_0x482711):_0x482711;_0x482711=_0x4df524[_0x51ff56][_0x915e('0x76')]?_[_0x915e('0x75')](_0x3883ad[_0x4df524[_0x51ff56][_0x915e('0x76')]],'%s',_0x482711):_0x482711;if(_0x4df524[_0x51ff56][_0x915e('0x77')]){_0x21a285[_0x915e('0x69')](_0x482711);}_0x4df524[_0x51ff56][_0x915e('0x78')]&&_0x21a285['order'](_0x482711,_0x4df524[_0x51ff56][_0x915e('0x78')]==='DESC'?![]:!![]);_0x21a285[_0x915e('0x6a')](_0x482711,_0x4df524[_0x51ff56][_0x915e('0x7b')]||_0x482711);}if(_0x2e85e7[_0x915e('0x7c')]){_0x2e85e7['joins']=JSON['parse'](_0x2e85e7[_0x915e('0x7c')]);for(var _0x48a5e3=0x0;_0x48a5e3<_0x2e85e7[_0x915e('0x7c')][_0x915e('0x3a')];_0x48a5e3+=0x1){if(_0x2e85e7['joins'][_0x48a5e3][_0x915e('0x32')]&&_['includes'](_0x96dc37,_0x2e85e7[_0x915e('0x7c')][_0x48a5e3][_0x915e('0x32')])&&_0x2e85e7[_0x915e('0x7c')][_0x48a5e3][_0x915e('0x7e')]&&_0x2e85e7[_0x915e('0x7c')][_0x48a5e3][_0x915e('0x7f')]&&_0x2e85e7[_0x915e('0x7c')][_0x48a5e3]['foreignKey']){_0x21a285[_0x2e85e7['joins'][_0x48a5e3][_0x915e('0x32')]](_0x2e85e7['joins'][_0x48a5e3]['foreignTable'],null,util[_0x915e('0x76')](_0x915e('0x81'),_0x2e85e7[_0x915e('0x8d')],_0x2e85e7[_0x915e('0x7c')][_0x48a5e3][_0x915e('0x7e')],_0x2e85e7[_0x915e('0x7c')][_0x48a5e3][_0x915e('0x7f')],_0x2e85e7[_0x915e('0x7c')][_0x48a5e3][_0x915e('0x80')]));}}}if(_0x2e85e7[_0x915e('0x82')]){_0x2e85e7[_0x915e('0x82')]=JSON[_0x915e('0x7d')](_0x2e85e7[_0x915e('0x82')]);_0x21a285[_0x915e('0x3f')](_0x15e3d8(_0x2e85e7[_0x915e('0x82')][_0x915e('0x69')]));}_0x5f4a5c=_0x21a285[_0x915e('0x83')]();_0x21a285['limit'](_0x47ebc5);_0x21a285[_0x915e('0x21')](0x0);return;}})[_0x915e('0x2a')](function(){if(_0x253659[_0x915e('0x8e')]==='web'){return null;}var _0x3ba66b=_['merge'](_0x253659,{'name':_0x253659[_0x915e('0x8f')]||_0x253659['name']||_0x2e85e7[_0x915e('0x2c')],'basename':_0x15db22,'savename':util[_0x915e('0x76')](_0x915e('0x90'),_0x253659['name']||_0x2e85e7[_0x915e('0x2c')],require(_0x915e('0x91'))[_0x915e('0x92')](0x4),_0x253659['output']||_0x915e('0x93')),'reportId':_0x2e85e7['id'],'reportType':_0x915e('0x94')});return db[_0x915e('0x95')][_0x915e('0x49')](_0x3ba66b,{'raw':!![]});})[_0x915e('0x2a')](function(_0x1333d0){if(_0x2e85e7[_0x915e('0x8d')]===_0x915e('0x96')){_0x5f4a5c['where'](_0x2e85e7[_0x915e('0x8d')]+_0x915e('0x97'),_0x253659['startDate'],_0x253659[_0x915e('0x98')]);}else{_0x5f4a5c['where'](_0x2e85e7['table']+_0x915e('0x99'),_0x253659[_0x915e('0x9a')],_0x253659[_0x915e('0x98')]);}if(_0x1333d0){logger['info'](_0x915e('0x9b'),_0x5f4a5c[_0x915e('0x85')]());require(_0x915e('0x9c'))[_0x915e('0x9d')](path[_0x915e('0x55')](__dirname,_0x915e('0x9e'),_0x1333d0['output']),[_0x1333d0['id'],_0x5f4a5c['toString'](),path['join'](__dirname,_0x915e('0x9f'),_0x1333d0[_0x915e('0xa0')]),_0x15db22]);return _0x1333d0;}else{var _0x4d8c5e=squel[_0x915e('0x8c')]();_0x4d8c5e[_0x915e('0x72')]('('+_0x5f4a5c[_0x915e('0x85')]()+')',_0x915e('0xa1'));_0x4d8c5e[_0x915e('0x6a')]('COUNT(*)',_0x915e('0x20'));_0x5f4a5c[_0x915e('0x1f')](_0x253659[_0x915e('0x1f')]||_0x47ebc5);_0x5f4a5c[_0x915e('0x21')](_0x253659[_0x915e('0x21')]||0x0);return dbH[_0x915e('0x86')][_0x915e('0x34')](_0x4d8c5e[_0x915e('0x85')](),{'type':dbH[_0x915e('0x86')]['QueryTypes'][_0x915e('0x88')]})[_0x915e('0x2a')](function(_0x947561){if(!_0x947561['length']){_0x57cdac=0x0;}else{_0x57cdac=_0x947561[0x0][_0x915e('0x20')]||0x0;}return dbH[_0x915e('0x86')]['query'](_0x5f4a5c[_0x915e('0x85')](),{'type':dbH[_0x915e('0x86')][_0x915e('0x87')][_0x915e('0x88')]});})[_0x915e('0x2a')](function(_0x5522dd){return{'rows':_0x5522dd||[],'count':_0x57cdac};});}});}exports['run']=function(_0x1023a3,_0x38f63d){return runReport(_0x1023a3[_0x915e('0x54')],_0x1023a3[_0x915e('0x34')],_0x1023a3[_0x915e('0x48')])[_0x915e('0x2a')](respondWithResult(_0x38f63d,null))[_0x915e('0x46')](handleError(_0x38f63d,null));};exports['runReport']=runReport;exports['query']=function(_0x134415,_0x493ec3){var _0x180117=0xa;var _0x4aa2a0=['join',_0x915e('0xa2'),_0x915e('0x56'),_0x915e('0x57')];var _0x3d54db={'SUM':'SUM(%s)','COUNT':_0x915e('0x59'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x915e('0x5a'),'MIN':_0x915e('0x5b'),'AVG':_0x915e('0xa3'),'GROUP_CONCAT':_0x915e('0x5c'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0xdb1a78={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x915e('0x5e'),'HOUR':_0x915e('0x5f'),'ROUND':_0x915e('0x60'),'UNIX_TIMESTAMP':_0x915e('0x61')};var _0x4aacde=function(_0x480268){return!_[_0x915e('0x62')](['IS\x20NULL',_0x915e('0x64'),_0x915e('0x65'),_0x915e('0x66')],_0x480268);};var _0x2c9c18=function(_0x176c72){if(!_0x176c72||!_0x176c72[_0x915e('0x67')]['length']){return'';}for(var _0x24a75a='(',_0x159b2f=0x0;_0x159b2f<_0x176c72['rules'][_0x915e('0x3a')];_0x159b2f+=0x1){_0x159b2f>0x0&&(_0x24a75a+='\x20'+_0x176c72[_0x915e('0x68')]+'\x20');_0x24a75a+=_0x176c72[_0x915e('0x67')][_0x159b2f][_0x915e('0x69')]?_0x2c9c18(_0x176c72['rules'][_0x159b2f][_0x915e('0x69')]):_0x176c72[_0x915e('0x67')][_0x159b2f][_0x915e('0x6a')]+'\x20'+_0x176c72['rules'][_0x159b2f][_0x915e('0x6b')]+(_0x4aacde(_0x176c72['rules'][_0x159b2f]['condition'])?'\x20'+_0x176c72['rules'][_0x159b2f][_0x915e('0x6c')]:'');}return _0x24a75a+')';};var _0x4bffcf={'where':{'id':_0x134415[_0x915e('0x54')]['id']}},_0xdf86fc,_0x5250e5,_0x358012,_0x25aeab,_0x3a2711;_0x4bffcf=_[_0x915e('0x40')]({},_0x4bffcf,_0x134415[_0x915e('0x48')]);return db[_0x915e('0x30')][_0x915e('0x4f')](_0x4bffcf)[_0x915e('0x2a')](function(_0x1b378a){if(_0x1b378a){_0xdf86fc=_0x1b378a;return _0x1b378a[_0x915e('0x6d')]();}return null;})[_0x915e('0x2a')](function(_0x3091ed){if(_0x3091ed){if(!_0x3091ed[_0x915e('0x3a')]){throw new db['Sequelize']['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x5250e5=_0x3091ed;return db['AnalyticMetric'][_0x915e('0x44')]({'raw':!![]});}return null;})[_0x915e('0x2a')](function(_0x4743a6){if(_0x4743a6){_0x358012=_[_0x915e('0x71')](_0x4743a6,'id');var _0x505036;var _0x28ad43=squel[_0x915e('0x8c')]();_0x28ad43[_0x915e('0x72')](_0xdf86fc[_0x915e('0x8d')]);for(var _0x5f51df=0x0;_0x5f51df<_0x5250e5[_0x915e('0x3a')];_0x5f51df+=0x1){_0x505036=_0x5250e5[_0x5f51df][_0x915e('0x73')]?_0x358012[_0x5250e5[_0x5f51df][_0x915e('0x73')]][_0x915e('0xa4')]:_0x5250e5[_0x5f51df][_0x915e('0x6a')];_0x505036=_0x5250e5[_0x5f51df][_0x915e('0x74')]?_['replace'](_0x3d54db[_0x5250e5[_0x5f51df]['function']],'%s',_0x505036):_0x505036;_0x505036=_0x5250e5[_0x5f51df][_0x915e('0x76')]?_[_0x915e('0x75')](_0xdb1a78[_0x5250e5[_0x5f51df]['format']],'%s',_0x505036):_0x505036;if(_0x5250e5[_0x5f51df][_0x915e('0x77')]){_0x28ad43[_0x915e('0x69')](_0x505036);}_0x5250e5[_0x5f51df][_0x915e('0x78')]&&_0x28ad43[_0x915e('0x79')](_0x505036,_0x5250e5[_0x5f51df][_0x915e('0x78')]===_0x915e('0x7a')?![]:!![]);_0x28ad43[_0x915e('0x6a')](_0x505036,_0x5250e5[_0x5f51df][_0x915e('0x7b')]||_0x505036);}if(_0xdf86fc[_0x915e('0x7c')]){_0xdf86fc[_0x915e('0x7c')]=JSON[_0x915e('0x7d')](_0xdf86fc['joins']);for(var _0x2534b5=0x0;_0x2534b5<_0xdf86fc[_0x915e('0x7c')]['length'];_0x2534b5+=0x1){if(_0xdf86fc[_0x915e('0x7c')][_0x2534b5][_0x915e('0x32')]&&_[_0x915e('0x62')](_0x4aa2a0,_0xdf86fc[_0x915e('0x7c')][_0x2534b5]['type'])&&_0xdf86fc['joins'][_0x2534b5][_0x915e('0x7e')]&&_0xdf86fc[_0x915e('0x7c')][_0x2534b5]['foreignTable']&&_0xdf86fc[_0x915e('0x7c')][_0x2534b5][_0x915e('0x80')]){_0x28ad43[_0xdf86fc['joins'][_0x2534b5]['type']](_0xdf86fc[_0x915e('0x7c')][_0x2534b5]['foreignTable'],null,util[_0x915e('0x76')](_0x915e('0x81'),_0xdf86fc['table'],_0xdf86fc['joins'][_0x2534b5][_0x915e('0x7e')],_0xdf86fc[_0x915e('0x7c')][_0x2534b5][_0x915e('0x7f')],_0xdf86fc[_0x915e('0x7c')][_0x2534b5][_0x915e('0x80')]));}}}if(_0xdf86fc[_0x915e('0x82')]){_0xdf86fc[_0x915e('0x82')]=JSON[_0x915e('0x7d')](_0xdf86fc[_0x915e('0x82')]);_0x28ad43['where'](_0x2c9c18(_0xdf86fc['conditions']['group']));}_0x3a2711=_0x28ad43[_0x915e('0x83')]();_0x28ad43[_0x915e('0x1f')](_0x180117);_0x28ad43[_0x915e('0x21')](0x0);logger[_0x915e('0x84')](_0x915e('0xa5'),_0x28ad43['toString']());return dbH[_0x915e('0x86')][_0x915e('0x34')](_0x28ad43[_0x915e('0x85')](),{'type':dbH[_0x915e('0x86')][_0x915e('0x87')][_0x915e('0x88')]});}})[_0x915e('0x2a')](function(){return{'sql':_0x3a2711[_0x915e('0x85')]()};})[_0x915e('0x2a')](respondWithResult(_0x493ec3,null))[_0x915e('0x46')](handleError(_0x493ec3,null));}; \ No newline at end of file +var _0xd96d=['table','conditions','clone','Limited\x20Query:','toString','sequelize','right_join','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','value','metric','output','web','fullPath','%s-%s.%s','randomstring','csv','custom','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','endDate','Run\x20Query:','child_process','../../components/export/','savename','countTable','COUNT(*)','QueryTypes','SELECT','run','runReport','COUNT(DISTINCT\x20%s)','SEC_TO_TIME(%s)','DESC','debug','eml-format','rimraf','request-promise','moment','bluebird','mustache','to-csv','ejs','fs-extra','lodash','squel','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','status','undefined','limit','count','offset','set','apply','reject','update','destroy','CustomReports','UserProfileResource','then','error','name','index','map','AnalyticCustomReport','rawAttributes','fieldName','model','query','keys','attributes','intersection','fields','length','nolimit','order','sort','where','filters','filter','merge','type','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','create','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','find','preview','join','left_join','cross_join','SUM(%s)','COUNT(%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','getFields','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','MetricId','function','replace','format','groupBy','orderBy','alias','joins','parse','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s'];(function(_0x2472a2,_0x4e3eb5){var _0x861dd7=function(_0x43010e){while(--_0x43010e){_0x2472a2['push'](_0x2472a2['shift']());}};_0x861dd7(++_0x4e3eb5);}(_0xd96d,0x160));var _0xdd96=function(_0x4e1d03,_0x786f3a){_0x4e1d03=_0x4e1d03-0x0;var _0x362d4b=_0xd96d[_0x4e1d03];return _0x362d4b;};'use strict';var emlformat=require(_0xdd96('0x0'));var rimraf=require(_0xdd96('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xdd96('0x2'));var moment=require(_0xdd96('0x3'));var BPromise=require(_0xdd96('0x4'));var Mustache=require(_0xdd96('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xdd96('0x6'));var ejs=require(_0xdd96('0x7'));var fs=require('fs');var fs_extra=require(_0xdd96('0x8'));var _=require(_0xdd96('0x9'));var squel=require(_0xdd96('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xdd96('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xdd96('0xb'));var qs=require('../../components/parsers/qs');var as=require(_0xdd96('0xc'));var hardwareService=require(_0xdd96('0xd'));var logger=require('../../config/logger')(_0xdd96('0xe'));var utils=require(_0xdd96('0xf'));var config=require(_0xdd96('0x10'));var licenseUtil=require(_0xdd96('0x11'));var db=require(_0xdd96('0x12'))['db'];var dbH=require(_0xdd96('0x12'))[_0xdd96('0x13')];function respondWithStatusCode(_0x53cc12,_0x2a8615){_0x2a8615=_0x2a8615||0xcc;return function(_0x18d76d){if(_0x18d76d){return _0x53cc12[_0xdd96('0x14')](_0x2a8615);}return _0x53cc12[_0xdd96('0x15')](_0x2a8615)['end']();};}function respondWithResult(_0x36d688,_0x19d3b6){_0x19d3b6=_0x19d3b6||0xc8;return function(_0x302d8c){if(_0x302d8c){return _0x36d688[_0xdd96('0x15')](_0x19d3b6)['json'](_0x302d8c);}};}function respondWithFilteredResult(_0x34d43a,_0x2138b5){return function(_0x1a477b){if(_0x1a477b){var _0x457fca=typeof _0x2138b5['offset']===_0xdd96('0x16')&&typeof _0x2138b5[_0xdd96('0x17')]===_0xdd96('0x16');var _0x971031=_0x1a477b[_0xdd96('0x18')];var _0x399329=_0x457fca?0x0:_0x2138b5['offset'];var _0x2a14e5=_0x457fca?_0x1a477b[_0xdd96('0x18')]:_0x2138b5[_0xdd96('0x19')]+_0x2138b5['limit'];var _0x1a38ae;if(_0x2a14e5>=_0x971031){_0x2a14e5=_0x971031;_0x1a38ae=0xc8;}else{_0x1a38ae=0xce;}_0x34d43a[_0xdd96('0x15')](_0x1a38ae);return _0x34d43a[_0xdd96('0x1a')]('Content-Range',_0x399329+'-'+_0x2a14e5+'/'+_0x971031)['json'](_0x1a477b);}return null;};}function patchUpdates(_0x2b03b9){return function(_0x7e0d2f){try{jsonpatch[_0xdd96('0x1b')](_0x7e0d2f,_0x2b03b9,!![]);}catch(_0x1a853f){return BPromise[_0xdd96('0x1c')](_0x1a853f);}return _0x7e0d2f['save']();};}function saveUpdates(_0x266f2d,_0x8bb7f9){return function(_0x1287b5){if(_0x1287b5){return _0x1287b5[_0xdd96('0x1d')](_0x266f2d)['then'](function(_0x15dc40){return _0x15dc40;});}return null;};}function removeEntity(_0x441fba,_0x390c5c){return function(_0x3ef795){if(_0x3ef795){return _0x3ef795[_0xdd96('0x1e')]()['then'](function(){var _0x319844=_0x3ef795['get']({'plain':!![]});var _0x5f04d=_0xdd96('0x1f');return db[_0xdd96('0x20')][_0xdd96('0x1e')]({'where':{'type':_0x5f04d,'resourceId':_0x319844['id']}})[_0xdd96('0x21')](function(){return _0x3ef795;});})[_0xdd96('0x21')](function(){_0x441fba['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5c2cbd,_0x23b1aa){return function(_0x557688){if(!_0x557688){_0x5c2cbd[_0xdd96('0x14')](0x194);}return _0x557688;};}function handleError(_0x29d684,_0x29aac0){_0x29aac0=_0x29aac0||0x1f4;return function(_0x39f129){logger[_0xdd96('0x22')](_0x39f129['stack']);if(_0x39f129[_0xdd96('0x23')]){delete _0x39f129[_0xdd96('0x23')];}_0x29d684['status'](_0x29aac0)['send'](_0x39f129);};}exports[_0xdd96('0x24')]=function(_0xf34ef9,_0x4d4995){var _0x5549bb={},_0x37b92a={},_0xc6c85c={'count':0x0,'rows':[]};var _0x5e8f18=_[_0xdd96('0x25')](db[_0xdd96('0x26')][_0xdd96('0x27')],function(_0x564edd){return{'name':_0x564edd[_0xdd96('0x28')],'type':_0x564edd['type']['key']};});_0x37b92a[_0xdd96('0x29')]=_['map'](_0x5e8f18,'name');_0x37b92a[_0xdd96('0x2a')]=_[_0xdd96('0x2b')](_0xf34ef9[_0xdd96('0x2a')]);_0x37b92a['filters']=_['intersection'](_0x37b92a[_0xdd96('0x29')],_0x37b92a[_0xdd96('0x2a')]);_0x5549bb[_0xdd96('0x2c')]=_[_0xdd96('0x2d')](_0x37b92a[_0xdd96('0x29')],qs[_0xdd96('0x2e')](_0xf34ef9[_0xdd96('0x2a')][_0xdd96('0x2e')]));_0x5549bb['attributes']=_0x5549bb['attributes'][_0xdd96('0x2f')]?_0x5549bb[_0xdd96('0x2c')]:_0x37b92a[_0xdd96('0x29')];if(!_0xf34ef9['query']['hasOwnProperty'](_0xdd96('0x30'))){_0x5549bb['limit']=qs[_0xdd96('0x17')](_0xf34ef9[_0xdd96('0x2a')][_0xdd96('0x17')]);_0x5549bb['offset']=qs[_0xdd96('0x19')](_0xf34ef9[_0xdd96('0x2a')][_0xdd96('0x19')]);}_0x5549bb[_0xdd96('0x31')]=qs[_0xdd96('0x32')](_0xf34ef9[_0xdd96('0x2a')][_0xdd96('0x32')]);_0x5549bb[_0xdd96('0x33')]=qs[_0xdd96('0x34')](_['pick'](_0xf34ef9['query'],_0x37b92a[_0xdd96('0x34')]),_0x5e8f18);if(_0xf34ef9['query'][_0xdd96('0x35')]){_0x5549bb[_0xdd96('0x33')]=_[_0xdd96('0x36')](_0x5549bb['where'],{'$or':_['map'](_0x5e8f18,function(_0x2c6fb6){if(_0x2c6fb6[_0xdd96('0x37')]!==_0xdd96('0x38')){var _0x1236df={};_0x1236df[_0x2c6fb6[_0xdd96('0x23')]]={'$like':'%'+_0xf34ef9[_0xdd96('0x2a')][_0xdd96('0x35')]+'%'};return _0x1236df;}})});}_0x5549bb=_['merge']({},_0x5549bb,_0xf34ef9[_0xdd96('0x39')]);var _0x3914e7={'where':_0x5549bb['where']};return db[_0xdd96('0x26')]['count'](_0x3914e7)['then'](function(_0x16297d){_0xc6c85c['count']=_0x16297d;if(_0xf34ef9[_0xdd96('0x2a')]['includeAll']){_0x5549bb[_0xdd96('0x3a')]=[{'all':!![]}];}return db['AnalyticCustomReport'][_0xdd96('0x3b')](_0x5549bb);})[_0xdd96('0x21')](function(_0x27390a){_0xc6c85c[_0xdd96('0x3c')]=_0x27390a;return _0xc6c85c;})[_0xdd96('0x21')](respondWithFilteredResult(_0x4d4995,_0x5549bb))[_0xdd96('0x3d')](handleError(_0x4d4995,null));};exports[_0xdd96('0x3e')]=function(_0x3ac035,_0x2e964f){var _0x333c74={'raw':![],'where':{'id':_0x3ac035[_0xdd96('0x3f')]['id']}},_0x4890c3={};_0x4890c3[_0xdd96('0x29')]=_['keys'](db[_0xdd96('0x26')][_0xdd96('0x27')]);_0x4890c3[_0xdd96('0x2a')]=_[_0xdd96('0x2b')](_0x3ac035[_0xdd96('0x2a')]);_0x4890c3[_0xdd96('0x34')]=_[_0xdd96('0x2d')](_0x4890c3['model'],_0x4890c3[_0xdd96('0x2a')]);_0x333c74[_0xdd96('0x2c')]=_[_0xdd96('0x2d')](_0x4890c3[_0xdd96('0x29')],qs[_0xdd96('0x2e')](_0x3ac035[_0xdd96('0x2a')][_0xdd96('0x2e')]));_0x333c74[_0xdd96('0x2c')]=_0x333c74[_0xdd96('0x2c')][_0xdd96('0x2f')]?_0x333c74['attributes']:_0x4890c3[_0xdd96('0x29')];if(_0x3ac035[_0xdd96('0x2a')][_0xdd96('0x40')]){_0x333c74[_0xdd96('0x3a')]=[{'all':!![]}];}_0x333c74=_[_0xdd96('0x36')]({},_0x333c74,_0x3ac035[_0xdd96('0x39')]);return db[_0xdd96('0x26')]['find'](_0x333c74)[_0xdd96('0x21')](handleEntityNotFound(_0x2e964f,null))[_0xdd96('0x21')](respondWithResult(_0x2e964f,null))['catch'](handleError(_0x2e964f,null));};exports[_0xdd96('0x41')]=function(_0x119284,_0x34cc36){return db[_0xdd96('0x26')]['create'](_0x119284['body'],{})[_0xdd96('0x21')](function(_0xf67e7){var _0x131f41=_0x119284['user'][_0xdd96('0x42')]({'plain':!![]});if(!_0x131f41)throw new Error(_0xdd96('0x43'));if(_0x131f41[_0xdd96('0x44')]===_0xdd96('0x45')){var _0x27bb60=_0xf67e7[_0xdd96('0x42')]({'plain':!![]});var _0x323907='Reports';return db['UserProfileSection']['find']({'where':{'name':_0x323907,'userProfileId':_0x131f41[_0xdd96('0x46')]},'raw':!![]})[_0xdd96('0x21')](function(_0x3cec05){if(_0x3cec05&&_0x3cec05[_0xdd96('0x47')]===0x0){return db[_0xdd96('0x20')][_0xdd96('0x41')]({'name':_0x27bb60[_0xdd96('0x23')],'resourceId':_0x27bb60['id'],'type':_0xdd96('0x1f'),'sectionId':_0x3cec05['id']},{})[_0xdd96('0x21')](function(){return _0xf67e7;});}else{return _0xf67e7;}})[_0xdd96('0x3d')](function(_0x4b65ee){logger[_0xdd96('0x22')](_0xdd96('0x48'),_0x4b65ee);throw _0x4b65ee;});}return _0xf67e7;})[_0xdd96('0x21')](respondWithResult(_0x34cc36,0xc9))[_0xdd96('0x3d')](handleError(_0x34cc36,null));};exports['update']=function(_0x143f69,_0x111696){if(_0x143f69[_0xdd96('0x49')]['id']){delete _0x143f69[_0xdd96('0x49')]['id'];}return db['AnalyticCustomReport'][_0xdd96('0x4a')]({'where':{'id':_0x143f69['params']['id']}})[_0xdd96('0x21')](handleEntityNotFound(_0x111696,null))[_0xdd96('0x21')](saveUpdates(_0x143f69['body'],null))[_0xdd96('0x21')](respondWithResult(_0x111696,null))[_0xdd96('0x3d')](handleError(_0x111696,null));};exports[_0xdd96('0x1e')]=function(_0x587443,_0x13572e){return db[_0xdd96('0x26')][_0xdd96('0x4a')]({'where':{'id':_0x587443['params']['id']}})[_0xdd96('0x21')](handleEntityNotFound(_0x13572e,null))['then'](removeEntity(_0x13572e,null))[_0xdd96('0x3d')](handleError(_0x13572e,null));};exports[_0xdd96('0x4b')]=function(_0x242f3d,_0x8d20b5){var _0x124d7c=0xa;var _0x24e17f=[_0xdd96('0x4c'),_0xdd96('0x4d'),'right_join',_0xdd96('0x4e')];var _0x5582f0={'SUM':_0xdd96('0x4f'),'COUNT':_0xdd96('0x50'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xdd96('0x51'),'MIN':_0xdd96('0x52'),'AVG':_0xdd96('0x53'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xdd96('0x54'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x4ecdb2={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xdd96('0x55'),'HOUR':_0xdd96('0x56'),'ROUND':_0xdd96('0x57'),'UNIX_TIMESTAMP':_0xdd96('0x58')};var _0x2e75b1=function(_0x46c90e){return!_[_0xdd96('0x59')]([_0xdd96('0x5a'),_0xdd96('0x5b'),_0xdd96('0x5c'),_0xdd96('0x5d')],_0x46c90e);};var _0x5f406f=function(_0x4cba84){if(!_0x4cba84||!_0x4cba84[_0xdd96('0x5e')][_0xdd96('0x2f')]){return'';}for(var _0x503767='(',_0x212610=0x0;_0x212610<_0x4cba84[_0xdd96('0x5e')][_0xdd96('0x2f')];_0x212610+=0x1){_0x212610>0x0&&(_0x503767+='\x20'+_0x4cba84[_0xdd96('0x5f')]+'\x20');_0x503767+=_0x4cba84['rules'][_0x212610][_0xdd96('0x60')]?_0x5f406f(_0x4cba84[_0xdd96('0x5e')][_0x212610][_0xdd96('0x60')]):_0x4cba84['rules'][_0x212610][_0xdd96('0x61')]+'\x20'+_0x4cba84[_0xdd96('0x5e')][_0x212610][_0xdd96('0x62')]+(_0x2e75b1(_0x4cba84[_0xdd96('0x5e')][_0x212610][_0xdd96('0x62')])?'\x20'+_0x4cba84[_0xdd96('0x5e')][_0x212610]['value']:'');}return _0x503767+')';};var _0x230699={'where':{'id':_0x242f3d['params']['id']}},_0x2c8f2d,_0x480c88,_0x1b962e,_0x1cf66a,_0x1878a2;_0x230699=_[_0xdd96('0x36')]({},_0x230699,_0x242f3d[_0xdd96('0x39')]);return db['AnalyticCustomReport']['find'](_0x230699)[_0xdd96('0x21')](function(_0x67fe02){if(_0x67fe02){_0x2c8f2d=_0x67fe02;return _0x67fe02[_0xdd96('0x63')]();}return null;})[_0xdd96('0x21')](function(_0xda3cde){if(_0xda3cde){if(!_0xda3cde['length']){throw new db['Sequelize'][(_0xdd96('0x64'))](_0xdd96('0x65'),0x193);}_0x480c88=_0xda3cde;return db[_0xdd96('0x66')][_0xdd96('0x3b')]({'raw':!![]});}return null;})[_0xdd96('0x21')](function(_0x572e61){if(_0x572e61){_0x1b962e=_[_0xdd96('0x67')](_0x572e61,'id');var _0x1864a6;var _0x2d6455=squel[_0xdd96('0x68')]();_0x2d6455[_0xdd96('0x69')](_0x2c8f2d['table']);for(var _0x1bc17e=0x0;_0x1bc17e<_0x480c88[_0xdd96('0x2f')];_0x1bc17e+=0x1){_0x1864a6=_0x480c88[_0x1bc17e][_0xdd96('0x6a')]?_0x1b962e[_0x480c88[_0x1bc17e][_0xdd96('0x6a')]]['metric']:_0x480c88[_0x1bc17e][_0xdd96('0x61')];_0x1864a6=_0x480c88[_0x1bc17e][_0xdd96('0x6b')]?_[_0xdd96('0x6c')](_0x5582f0[_0x480c88[_0x1bc17e][_0xdd96('0x6b')]],'%s',_0x1864a6):_0x1864a6;_0x1864a6=_0x480c88[_0x1bc17e]['format']?_[_0xdd96('0x6c')](_0x4ecdb2[_0x480c88[_0x1bc17e][_0xdd96('0x6d')]],'%s',_0x1864a6):_0x1864a6;if(_0x480c88[_0x1bc17e][_0xdd96('0x6e')]){_0x2d6455['group'](_0x1864a6);}_0x480c88[_0x1bc17e][_0xdd96('0x6f')]&&_0x2d6455['order'](_0x1864a6,_0x480c88[_0x1bc17e][_0xdd96('0x6f')]==='DESC'?![]:!![]);_0x2d6455['field'](_0x1864a6,_0x480c88[_0x1bc17e][_0xdd96('0x70')]||_0x1864a6);}if(_0x2c8f2d[_0xdd96('0x71')]){_0x2c8f2d[_0xdd96('0x71')]=JSON[_0xdd96('0x72')](_0x2c8f2d[_0xdd96('0x71')]);for(var _0x4f619d=0x0;_0x4f619d<_0x2c8f2d[_0xdd96('0x71')][_0xdd96('0x2f')];_0x4f619d+=0x1){if(_0x2c8f2d[_0xdd96('0x71')][_0x4f619d][_0xdd96('0x37')]&&_[_0xdd96('0x59')](_0x24e17f,_0x2c8f2d[_0xdd96('0x71')][_0x4f619d][_0xdd96('0x37')])&&_0x2c8f2d['joins'][_0x4f619d][_0xdd96('0x73')]&&_0x2c8f2d[_0xdd96('0x71')][_0x4f619d][_0xdd96('0x74')]&&_0x2c8f2d[_0xdd96('0x71')][_0x4f619d][_0xdd96('0x75')]){_0x2d6455[_0x2c8f2d[_0xdd96('0x71')][_0x4f619d][_0xdd96('0x37')]](_0x2c8f2d[_0xdd96('0x71')][_0x4f619d]['foreignTable'],null,util[_0xdd96('0x6d')](_0xdd96('0x76'),_0x2c8f2d[_0xdd96('0x77')],_0x2c8f2d[_0xdd96('0x71')][_0x4f619d][_0xdd96('0x73')],_0x2c8f2d['joins'][_0x4f619d]['foreignTable'],_0x2c8f2d[_0xdd96('0x71')][_0x4f619d][_0xdd96('0x75')]));}}}if(_0x2c8f2d['conditions']){_0x2c8f2d[_0xdd96('0x78')]=JSON[_0xdd96('0x72')](_0x2c8f2d[_0xdd96('0x78')]);_0x2d6455[_0xdd96('0x33')](_0x5f406f(_0x2c8f2d['conditions'][_0xdd96('0x60')]));}_0x1878a2=_0x2d6455[_0xdd96('0x79')]();_0x2d6455[_0xdd96('0x17')](_0x124d7c);_0x2d6455[_0xdd96('0x19')](0x0);logger['debug'](_0xdd96('0x7a'),_0x2d6455[_0xdd96('0x7b')]());return dbH['sequelize']['query'](_0x2d6455[_0xdd96('0x7b')](),{'type':dbH[_0xdd96('0x7c')]['QueryTypes']['SELECT']});}})[_0xdd96('0x21')](respondWithResult(_0x8d20b5,null))[_0xdd96('0x3d')](handleError(_0x8d20b5,null));};function runReport(_0x15b36b,_0x15abba,_0x11bd7c){var _0x510a0f=_0x15abba[_0xdd96('0x23')];var _0x185fcc=0xa;var _0x47b8ad=[_0xdd96('0x4c'),_0xdd96('0x4d'),_0xdd96('0x7d'),_0xdd96('0x4e')];var _0x5927b4={'SUM':_0xdd96('0x4f'),'COUNT':_0xdd96('0x50'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0xdd96('0x52'),'AVG':_0xdd96('0x53'),'GROUP_CONCAT':_0xdd96('0x7e'),'GROUP_CONCAT ASC':_0xdd96('0x54'),'GROUP_CONCAT DESC':_0xdd96('0x7f')};var _0x1201ad={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xdd96('0x55'),'HOUR':'HOUR(%s)','ROUND':_0xdd96('0x57'),'UNIX_TIMESTAMP':_0xdd96('0x58')};var _0x4d8d67=function(_0x354f39){return!_[_0xdd96('0x59')]([_0xdd96('0x5a'),'IS\x20NOT\x20NULL','IS\x20EMPTY',_0xdd96('0x5d')],_0x354f39);};var _0x5001f9=function(_0x578786){if(!_0x578786||!_0x578786[_0xdd96('0x5e')][_0xdd96('0x2f')]){return'';}for(var _0x2b8f43='(',_0x2692f2=0x0;_0x2692f2<_0x578786[_0xdd96('0x5e')][_0xdd96('0x2f')];_0x2692f2+=0x1){_0x2692f2>0x0&&(_0x2b8f43+='\x20'+_0x578786['operator']+'\x20');_0x2b8f43+=_0x578786[_0xdd96('0x5e')][_0x2692f2]['group']?_0x5001f9(_0x578786[_0xdd96('0x5e')][_0x2692f2][_0xdd96('0x60')]):_0x578786[_0xdd96('0x5e')][_0x2692f2][_0xdd96('0x61')]+'\x20'+_0x578786[_0xdd96('0x5e')][_0x2692f2]['condition']+(_0x4d8d67(_0x578786[_0xdd96('0x5e')][_0x2692f2][_0xdd96('0x62')])?'\x20'+_0x578786[_0xdd96('0x5e')][_0x2692f2][_0xdd96('0x80')]:'');}return _0x2b8f43+')';};var _0x143272={'where':{'id':_0x15b36b['id']}},_0x54dafa,_0x511c67,_0x10959f,_0x35a0e0,_0x44c92f;_0x143272=_[_0xdd96('0x36')]({},_0x143272,_0x11bd7c);return db[_0xdd96('0x26')][_0xdd96('0x4a')](_0x143272)[_0xdd96('0x21')](function(_0x39640f){if(_0x39640f){_0x54dafa=_0x39640f;return _0x39640f[_0xdd96('0x63')]();}return null;})['then'](function(_0x2ae8f4){if(_0x2ae8f4){if(!_0x2ae8f4[_0xdd96('0x2f')]){throw new db['Sequelize']['ValidationErrorItem'](_0xdd96('0x65'),0x193);}_0x511c67=_0x2ae8f4;return db['AnalyticMetric'][_0xdd96('0x3b')]({'raw':!![]});}return null;})['then'](function(_0xb81bfd){if(_0xb81bfd){_0x10959f=_['keyBy'](_0xb81bfd,'id');var _0x35b5f0;var _0x4a3df4=squel[_0xdd96('0x68')]();_0x4a3df4[_0xdd96('0x69')](_0x54dafa[_0xdd96('0x77')]);for(var _0x38649c=0x0;_0x38649c<_0x511c67[_0xdd96('0x2f')];_0x38649c+=0x1){_0x35b5f0=_0x511c67[_0x38649c]['MetricId']?_0x10959f[_0x511c67[_0x38649c][_0xdd96('0x6a')]][_0xdd96('0x81')]:_0x511c67[_0x38649c][_0xdd96('0x61')];_0x35b5f0=_0x511c67[_0x38649c][_0xdd96('0x6b')]?_[_0xdd96('0x6c')](_0x5927b4[_0x511c67[_0x38649c][_0xdd96('0x6b')]],'%s',_0x35b5f0):_0x35b5f0;_0x35b5f0=_0x511c67[_0x38649c][_0xdd96('0x6d')]?_['replace'](_0x1201ad[_0x511c67[_0x38649c][_0xdd96('0x6d')]],'%s',_0x35b5f0):_0x35b5f0;if(_0x511c67[_0x38649c][_0xdd96('0x6e')]){_0x4a3df4[_0xdd96('0x60')](_0x35b5f0);}_0x511c67[_0x38649c][_0xdd96('0x6f')]&&_0x4a3df4[_0xdd96('0x31')](_0x35b5f0,_0x511c67[_0x38649c]['orderBy']==='DESC'?![]:!![]);_0x4a3df4[_0xdd96('0x61')](_0x35b5f0,_0x511c67[_0x38649c][_0xdd96('0x70')]||_0x35b5f0);}if(_0x54dafa[_0xdd96('0x71')]){_0x54dafa[_0xdd96('0x71')]=JSON[_0xdd96('0x72')](_0x54dafa[_0xdd96('0x71')]);for(var _0xbd2ccd=0x0;_0xbd2ccd<_0x54dafa[_0xdd96('0x71')]['length'];_0xbd2ccd+=0x1){if(_0x54dafa[_0xdd96('0x71')][_0xbd2ccd][_0xdd96('0x37')]&&_[_0xdd96('0x59')](_0x47b8ad,_0x54dafa[_0xdd96('0x71')][_0xbd2ccd]['type'])&&_0x54dafa[_0xdd96('0x71')][_0xbd2ccd][_0xdd96('0x73')]&&_0x54dafa[_0xdd96('0x71')][_0xbd2ccd][_0xdd96('0x74')]&&_0x54dafa[_0xdd96('0x71')][_0xbd2ccd][_0xdd96('0x75')]){_0x4a3df4[_0x54dafa['joins'][_0xbd2ccd][_0xdd96('0x37')]](_0x54dafa['joins'][_0xbd2ccd][_0xdd96('0x74')],null,util[_0xdd96('0x6d')](_0xdd96('0x76'),_0x54dafa[_0xdd96('0x77')],_0x54dafa[_0xdd96('0x71')][_0xbd2ccd]['parentKey'],_0x54dafa[_0xdd96('0x71')][_0xbd2ccd][_0xdd96('0x74')],_0x54dafa[_0xdd96('0x71')][_0xbd2ccd][_0xdd96('0x75')]));}}}if(_0x54dafa[_0xdd96('0x78')]){_0x54dafa['conditions']=JSON[_0xdd96('0x72')](_0x54dafa['conditions']);_0x4a3df4[_0xdd96('0x33')](_0x5001f9(_0x54dafa[_0xdd96('0x78')][_0xdd96('0x60')]));}_0x44c92f=_0x4a3df4['clone']();_0x4a3df4[_0xdd96('0x17')](_0x185fcc);_0x4a3df4[_0xdd96('0x19')](0x0);return;}})[_0xdd96('0x21')](function(){if(_0x15abba[_0xdd96('0x82')]===_0xdd96('0x83')){return null;}var _0x1cceac=_[_0xdd96('0x36')](_0x15abba,{'name':_0x15abba[_0xdd96('0x84')]||_0x15abba[_0xdd96('0x23')]||_0x54dafa[_0xdd96('0x23')],'basename':_0x510a0f,'savename':util[_0xdd96('0x6d')](_0xdd96('0x85'),_0x15abba['name']||_0x54dafa[_0xdd96('0x23')],require(_0xdd96('0x86'))['generate'](0x4),_0x15abba['output']||_0xdd96('0x87')),'reportId':_0x54dafa['id'],'reportType':_0xdd96('0x88')});return db[_0xdd96('0x89')][_0xdd96('0x41')](_0x1cceac,{'raw':!![]});})[_0xdd96('0x21')](function(_0x24b5ee){if(_0x54dafa['table']===_0xdd96('0x8a')){_0x44c92f[_0xdd96('0x33')](_0x54dafa[_0xdd96('0x77')]+_0xdd96('0x8b'),_0x15abba[_0xdd96('0x8c')],_0x15abba['endDate']);}else{_0x44c92f['where'](_0x54dafa['table']+_0xdd96('0x8d'),_0x15abba[_0xdd96('0x8c')],_0x15abba[_0xdd96('0x8e')]);}if(_0x24b5ee){logger['info'](_0xdd96('0x8f'),_0x44c92f[_0xdd96('0x7b')]());require(_0xdd96('0x90'))['fork'](path['join'](__dirname,_0xdd96('0x91'),_0x24b5ee['output']),[_0x24b5ee['id'],_0x44c92f[_0xdd96('0x7b')](),path[_0xdd96('0x4c')](__dirname,'../../files/reports',_0x24b5ee[_0xdd96('0x92')]),_0x510a0f]);return _0x24b5ee;}else{var _0x262d09=squel[_0xdd96('0x68')]();_0x262d09[_0xdd96('0x69')]('('+_0x44c92f[_0xdd96('0x7b')]()+')',_0xdd96('0x93'));_0x262d09[_0xdd96('0x61')](_0xdd96('0x94'),_0xdd96('0x18'));_0x44c92f['limit'](_0x15abba[_0xdd96('0x17')]||_0x185fcc);_0x44c92f['offset'](_0x15abba['offset']||0x0);return dbH['sequelize'][_0xdd96('0x2a')](_0x262d09[_0xdd96('0x7b')](),{'type':dbH[_0xdd96('0x7c')][_0xdd96('0x95')][_0xdd96('0x96')]})['then'](function(_0x41dcd3){if(!_0x41dcd3['length']){_0x35a0e0=0x0;}else{_0x35a0e0=_0x41dcd3[0x0][_0xdd96('0x18')]||0x0;}return dbH[_0xdd96('0x7c')][_0xdd96('0x2a')](_0x44c92f[_0xdd96('0x7b')](),{'type':dbH['sequelize'][_0xdd96('0x95')][_0xdd96('0x96')]});})[_0xdd96('0x21')](function(_0x2da27f){return{'rows':_0x2da27f||[],'count':_0x35a0e0};});}});}exports[_0xdd96('0x97')]=function(_0x3b9a63,_0x307170){return runReport(_0x3b9a63[_0xdd96('0x3f')],_0x3b9a63[_0xdd96('0x2a')],_0x3b9a63['options'])[_0xdd96('0x21')](respondWithResult(_0x307170,null))[_0xdd96('0x3d')](handleError(_0x307170,null));};exports[_0xdd96('0x98')]=runReport;exports[_0xdd96('0x2a')]=function(_0x261798,_0x28bd56){var _0x4f8845=0xa;var _0x5dde42=['join','left_join',_0xdd96('0x7d'),_0xdd96('0x4e')];var _0x3b565e={'SUM':_0xdd96('0x4f'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xdd96('0x99'),'MAX':_0xdd96('0x51'),'MIN':_0xdd96('0x52'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xdd96('0x7e'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xdd96('0x7f')};var _0x17e08d={'SEC_TO_TIME':_0xdd96('0x9a'),'DATE':_0xdd96('0x55'),'HOUR':_0xdd96('0x56'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xdd96('0x58')};var _0x591cca=function(_0x55bf72){return!_[_0xdd96('0x59')](['IS\x20NULL',_0xdd96('0x5b'),_0xdd96('0x5c'),'IS\x20NOT\x20EMPTY'],_0x55bf72);};var _0x1b3e4d=function(_0xfa42bd){if(!_0xfa42bd||!_0xfa42bd[_0xdd96('0x5e')][_0xdd96('0x2f')]){return'';}for(var _0x230723='(',_0x16898b=0x0;_0x16898b<_0xfa42bd['rules'][_0xdd96('0x2f')];_0x16898b+=0x1){_0x16898b>0x0&&(_0x230723+='\x20'+_0xfa42bd[_0xdd96('0x5f')]+'\x20');_0x230723+=_0xfa42bd[_0xdd96('0x5e')][_0x16898b]['group']?_0x1b3e4d(_0xfa42bd[_0xdd96('0x5e')][_0x16898b][_0xdd96('0x60')]):_0xfa42bd[_0xdd96('0x5e')][_0x16898b][_0xdd96('0x61')]+'\x20'+_0xfa42bd[_0xdd96('0x5e')][_0x16898b]['condition']+(_0x591cca(_0xfa42bd['rules'][_0x16898b][_0xdd96('0x62')])?'\x20'+_0xfa42bd['rules'][_0x16898b][_0xdd96('0x80')]:'');}return _0x230723+')';};var _0xafea50={'where':{'id':_0x261798[_0xdd96('0x3f')]['id']}},_0x2ec064,_0x491f6c,_0x2024ab,_0x28abe2,_0xe7697f;_0xafea50=_[_0xdd96('0x36')]({},_0xafea50,_0x261798[_0xdd96('0x39')]);return db[_0xdd96('0x26')][_0xdd96('0x4a')](_0xafea50)[_0xdd96('0x21')](function(_0x42821f){if(_0x42821f){_0x2ec064=_0x42821f;return _0x42821f['getFields']();}return null;})[_0xdd96('0x21')](function(_0x400abb){if(_0x400abb){if(!_0x400abb[_0xdd96('0x2f')]){throw new db['Sequelize'][(_0xdd96('0x64'))](_0xdd96('0x65'),0x193);}_0x491f6c=_0x400abb;return db[_0xdd96('0x66')]['findAll']({'raw':!![]});}return null;})[_0xdd96('0x21')](function(_0x92e9a7){if(_0x92e9a7){_0x2024ab=_[_0xdd96('0x67')](_0x92e9a7,'id');var _0x27c1dd;var _0x3c7311=squel['select']();_0x3c7311[_0xdd96('0x69')](_0x2ec064[_0xdd96('0x77')]);for(var _0x2798a7=0x0;_0x2798a7<_0x491f6c[_0xdd96('0x2f')];_0x2798a7+=0x1){_0x27c1dd=_0x491f6c[_0x2798a7][_0xdd96('0x6a')]?_0x2024ab[_0x491f6c[_0x2798a7][_0xdd96('0x6a')]]['metric']:_0x491f6c[_0x2798a7][_0xdd96('0x61')];_0x27c1dd=_0x491f6c[_0x2798a7][_0xdd96('0x6b')]?_[_0xdd96('0x6c')](_0x3b565e[_0x491f6c[_0x2798a7]['function']],'%s',_0x27c1dd):_0x27c1dd;_0x27c1dd=_0x491f6c[_0x2798a7][_0xdd96('0x6d')]?_[_0xdd96('0x6c')](_0x17e08d[_0x491f6c[_0x2798a7][_0xdd96('0x6d')]],'%s',_0x27c1dd):_0x27c1dd;if(_0x491f6c[_0x2798a7][_0xdd96('0x6e')]){_0x3c7311[_0xdd96('0x60')](_0x27c1dd);}_0x491f6c[_0x2798a7][_0xdd96('0x6f')]&&_0x3c7311[_0xdd96('0x31')](_0x27c1dd,_0x491f6c[_0x2798a7][_0xdd96('0x6f')]===_0xdd96('0x9b')?![]:!![]);_0x3c7311['field'](_0x27c1dd,_0x491f6c[_0x2798a7][_0xdd96('0x70')]||_0x27c1dd);}if(_0x2ec064[_0xdd96('0x71')]){_0x2ec064['joins']=JSON['parse'](_0x2ec064['joins']);for(var _0x2b982e=0x0;_0x2b982e<_0x2ec064[_0xdd96('0x71')][_0xdd96('0x2f')];_0x2b982e+=0x1){if(_0x2ec064[_0xdd96('0x71')][_0x2b982e][_0xdd96('0x37')]&&_['includes'](_0x5dde42,_0x2ec064[_0xdd96('0x71')][_0x2b982e][_0xdd96('0x37')])&&_0x2ec064[_0xdd96('0x71')][_0x2b982e]['parentKey']&&_0x2ec064[_0xdd96('0x71')][_0x2b982e]['foreignTable']&&_0x2ec064[_0xdd96('0x71')][_0x2b982e][_0xdd96('0x75')]){_0x3c7311[_0x2ec064[_0xdd96('0x71')][_0x2b982e]['type']](_0x2ec064['joins'][_0x2b982e][_0xdd96('0x74')],null,util[_0xdd96('0x6d')]('%s.%s\x20=\x20%s.%s',_0x2ec064[_0xdd96('0x77')],_0x2ec064[_0xdd96('0x71')][_0x2b982e][_0xdd96('0x73')],_0x2ec064['joins'][_0x2b982e][_0xdd96('0x74')],_0x2ec064[_0xdd96('0x71')][_0x2b982e][_0xdd96('0x75')]));}}}if(_0x2ec064[_0xdd96('0x78')]){_0x2ec064['conditions']=JSON[_0xdd96('0x72')](_0x2ec064[_0xdd96('0x78')]);_0x3c7311[_0xdd96('0x33')](_0x1b3e4d(_0x2ec064[_0xdd96('0x78')][_0xdd96('0x60')]));}_0xe7697f=_0x3c7311['clone']();_0x3c7311[_0xdd96('0x17')](_0x4f8845);_0x3c7311[_0xdd96('0x19')](0x0);logger[_0xdd96('0x9c')](_0xdd96('0x7a'),_0x3c7311[_0xdd96('0x7b')]());return dbH[_0xdd96('0x7c')][_0xdd96('0x2a')](_0x3c7311[_0xdd96('0x7b')](),{'type':dbH[_0xdd96('0x7c')][_0xdd96('0x95')][_0xdd96('0x96')]});}})['then'](function(){return{'sql':_0xe7697f[_0xdd96('0x7b')]()};})[_0xdd96('0x21')](respondWithResult(_0x28bd56,null))[_0xdd96('0x3d')](handleError(_0x28bd56,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index 5dd3cec..37bbe93 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 _0x175d=['define','analytics_custom_reports','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./analyticCustomReport.attributes','exports'];(function(_0x480744,_0x1f1e4c){var _0x41475a=function(_0x5d825a){while(--_0x5d825a){_0x480744['push'](_0x480744['shift']());}};_0x41475a(++_0x1f1e4c);}(_0x175d,0x195));var _0xd175=function(_0x48c93d,_0x2c34f0){_0x48c93d=_0x48c93d-0x0;var _0x43abbe=_0x175d[_0x48c93d];return _0x43abbe;};'use strict';var _=require(_0xd175('0x0'));var util=require(_0xd175('0x1'));var logger=require(_0xd175('0x2'))(_0xd175('0x3'));var moment=require(_0xd175('0x4'));var BPromise=require('bluebird');var rp=require(_0xd175('0x5'));var fs=require('fs');var path=require(_0xd175('0x6'));var rimraf=require(_0xd175('0x7'));var config=require(_0xd175('0x8'));var attributes=require(_0xd175('0x9'));module[_0xd175('0xa')]=function(_0x1088c3,_0xaef86b){return _0x1088c3[_0xd175('0xb')]('AnalyticCustomReport',attributes,{'tableName':_0xd175('0xc'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfbc7=['request-promise','path','rimraf','../../config/environment','./analyticCustomReport.attributes','exports','define','AnalyticCustomReport','analytics_custom_reports','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x5d5977,_0x79210a){var _0x1015cf=function(_0x5113f9){while(--_0x5113f9){_0x5d5977['push'](_0x5d5977['shift']());}};_0x1015cf(++_0x79210a);}(_0xfbc7,0x126));var _0x7fbc=function(_0x3f8606,_0x3b9fdc){_0x3f8606=_0x3f8606-0x0;var _0x2ec8e0=_0xfbc7[_0x3f8606];return _0x2ec8e0;};'use strict';var _=require(_0x7fbc('0x0'));var util=require(_0x7fbc('0x1'));var logger=require(_0x7fbc('0x2'))(_0x7fbc('0x3'));var moment=require(_0x7fbc('0x4'));var BPromise=require(_0x7fbc('0x5'));var rp=require(_0x7fbc('0x6'));var fs=require('fs');var path=require(_0x7fbc('0x7'));var rimraf=require(_0x7fbc('0x8'));var config=require(_0x7fbc('0x9'));var attributes=require(_0x7fbc('0xa'));module[_0x7fbc('0xb')]=function(_0x10e986,_0x12ff89){return _0x10e986[_0x7fbc('0xc')](_0x7fbc('0xd'),attributes,{'tableName':_0x7fbc('0xe'),'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 cab9568..17a1a5d 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 _0x0616=['ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','bluebird'];(function(_0x3e7804,_0x121853){var _0x56efda=function(_0x1996f3){while(--_0x1996f3){_0x3e7804['push'](_0x3e7804['shift']());}};_0x56efda(++_0x121853);}(_0x0616,0xfd));var _0x6061=function(_0x58e32c,_0x309781){_0x58e32c=_0x58e32c-0x0;var _0x481e60=_0x0616[_0x58e32c];return _0x481e60;};'use strict';var _=require(_0x6061('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x6061('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6061('0x2'));var db=require(_0x6061('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x6061('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0x6061('0x5'));var client=jayson[_0x6061('0x6')][_0x6061('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1cf92f,_0x647228,_0x18648d){return new BPromise(function(_0x5f3e1e,_0x3694c1){return client['request'](_0x1cf92f,_0x18648d)['then'](function(_0x1fa1e4){logger['info'](_0x6061('0x8'),_0x647228,_0x6061('0x9'));logger[_0x6061('0xa')](_0x6061('0xb'),_0x647228,_0x6061('0x9'),JSON[_0x6061('0xc')](_0x1fa1e4));if(_0x1fa1e4[_0x6061('0xd')]){if(_0x1fa1e4['error'][_0x6061('0xe')]===0x1f4){logger[_0x6061('0xd')](_0x6061('0x8'),_0x647228,_0x1fa1e4[_0x6061('0xd')][_0x6061('0xf')]);return _0x3694c1(_0x1fa1e4[_0x6061('0xd')][_0x6061('0xf')]);}logger['error']('AnalyticCustomReport,\x20%s,\x20%s',_0x647228,_0x1fa1e4[_0x6061('0xd')][_0x6061('0xf')]);return _0x5f3e1e(_0x1fa1e4['error'][_0x6061('0xf')]);}else{logger['info'](_0x6061('0x8'),_0x647228,_0x6061('0x9'));_0x5f3e1e(_0x1fa1e4[_0x6061('0x10')][_0x6061('0xf')]);}})['catch'](function(_0x30a359){logger[_0x6061('0xd')](_0x6061('0x8'),_0x647228,_0x30a359);_0x3694c1(_0x30a359);});});} \ No newline at end of file +var _0x6e68=['rpc','../../config/environment','jayson/promise','http','then','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x4d2f00,_0x4e94d5){var _0x2d7b7f=function(_0x18fa08){while(--_0x18fa08){_0x4d2f00['push'](_0x4d2f00['shift']());}};_0x2d7b7f(++_0x4e94d5);}(_0x6e68,0xa1));var _0x86e6=function(_0x55fba8,_0xe39bed){_0x55fba8=_0x55fba8-0x0;var _0x442e49=_0x6e68[_0x55fba8];return _0x442e49;};'use strict';var _=require('lodash');var util=require(_0x86e6('0x0'));var moment=require(_0x86e6('0x1'));var BPromise=require(_0x86e6('0x2'));var rs=require(_0x86e6('0x3'));var fs=require('fs');var Redis=require(_0x86e6('0x4'));var db=require(_0x86e6('0x5'))['db'];var utils=require(_0x86e6('0x6'));var logger=require('../../config/logger')(_0x86e6('0x7'));var config=require(_0x86e6('0x8'));var jayson=require(_0x86e6('0x9'));var client=jayson['client'][_0x86e6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4b5780,_0x698838,_0x2aa0e4){return new BPromise(function(_0x1c7bd4,_0x41c71f){return client['request'](_0x4b5780,_0x2aa0e4)[_0x86e6('0xb')](function(_0x3eff82){logger['info'](_0x86e6('0xc'),_0x698838,_0x86e6('0xd'));logger['debug']('AnalyticCustomReport,\x20%s,\x20%s,\x20%s',_0x698838,_0x86e6('0xd'),JSON[_0x86e6('0xe')](_0x3eff82));if(_0x3eff82[_0x86e6('0xf')]){if(_0x3eff82[_0x86e6('0xf')][_0x86e6('0x10')]===0x1f4){logger[_0x86e6('0xf')](_0x86e6('0xc'),_0x698838,_0x3eff82[_0x86e6('0xf')][_0x86e6('0x11')]);return _0x41c71f(_0x3eff82[_0x86e6('0xf')][_0x86e6('0x11')]);}logger['error'](_0x86e6('0xc'),_0x698838,_0x3eff82[_0x86e6('0xf')][_0x86e6('0x11')]);return _0x1c7bd4(_0x3eff82['error']['message']);}else{logger[_0x86e6('0x12')](_0x86e6('0xc'),_0x698838,_0x86e6('0xd'));_0x1c7bd4(_0x3eff82[_0x86e6('0x13')][_0x86e6('0x11')]);}})[_0x86e6('0x14')](function(_0x391c33){logger[_0x86e6('0xf')](_0x86e6('0xc'),_0x698838,_0x391c33);_0x41c71f(_0x391c33);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index 6a53174..13f978a 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 _0x973b=['./analyticCustomReport.controller','isAuthenticated','index','/:id','get','/:id/preview','/:id/run','run','query','create','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x114b09,_0x8265b8){var _0xa96d79=function(_0x18a6de){while(--_0x18a6de){_0x114b09['push'](_0x114b09['shift']());}};_0xa96d79(++_0x8265b8);}(_0x973b,0x6e));var _0xb973=function(_0x3bca20,_0x12a98d){_0x3bca20=_0x3bca20-0x0;var _0x5767d9=_0x973b[_0x3bca20];return _0x5767d9;};'use strict';var multer=require(_0xb973('0x0'));var util=require(_0xb973('0x1'));var path=require(_0xb973('0x2'));var timeout=require(_0xb973('0x3'));var express=require(_0xb973('0x4'));var router=express[_0xb973('0x5')]();var fs_extra=require(_0xb973('0x6'));var auth=require(_0xb973('0x7'));var interaction=require(_0xb973('0x8'));var config=require(_0xb973('0x9'));var controller=require(_0xb973('0xa'));router['get']('/',auth[_0xb973('0xb')](),controller[_0xb973('0xc')]);router['get'](_0xb973('0xd'),auth['isAuthenticated'](),controller['show']);router[_0xb973('0xe')](_0xb973('0xf'),auth['isAuthenticated'](),controller['preview']);router[_0xb973('0xe')](_0xb973('0x10'),auth[_0xb973('0xb')](),controller[_0xb973('0x11')]);router['get']('/:id/query',auth[_0xb973('0xb')](),controller[_0xb973('0x12')]);router['post']('/',auth['isAuthenticated'](),controller[_0xb973('0x13')]);router[_0xb973('0x14')](_0xb973('0xd'),auth[_0xb973('0xb')](),controller[_0xb973('0x15')]);router[_0xb973('0x16')](_0xb973('0xd'),auth[_0xb973('0xb')](),controller['destroy']);module[_0xb973('0x17')]=router; \ No newline at end of file +var _0x8c9a=['put','delete','destroy','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','get','isAuthenticated','index','/:id','show','/:id/preview','preview','run','/:id/query','post'];(function(_0x2eb7db,_0xce0d60){var _0x198543=function(_0x5974be){while(--_0x5974be){_0x2eb7db['push'](_0x2eb7db['shift']());}};_0x198543(++_0xce0d60);}(_0x8c9a,0x1bb));var _0xa8c9=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x8c9a[_0x2641f9];return _0x585741;};'use strict';var multer=require(_0xa8c9('0x0'));var util=require(_0xa8c9('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xa8c9('0x2'));var router=express[_0xa8c9('0x3')]();var fs_extra=require(_0xa8c9('0x4'));var auth=require(_0xa8c9('0x5'));var interaction=require(_0xa8c9('0x6'));var config=require(_0xa8c9('0x7'));var controller=require(_0xa8c9('0x8'));router[_0xa8c9('0x9')]('/',auth[_0xa8c9('0xa')](),controller[_0xa8c9('0xb')]);router[_0xa8c9('0x9')](_0xa8c9('0xc'),auth[_0xa8c9('0xa')](),controller[_0xa8c9('0xd')]);router[_0xa8c9('0x9')](_0xa8c9('0xe'),auth[_0xa8c9('0xa')](),controller[_0xa8c9('0xf')]);router[_0xa8c9('0x9')]('/:id/run',auth[_0xa8c9('0xa')](),controller[_0xa8c9('0x10')]);router[_0xa8c9('0x9')](_0xa8c9('0x11'),auth[_0xa8c9('0xa')](),controller['query']);router[_0xa8c9('0x12')]('/',auth[_0xa8c9('0xa')](),controller['create']);router[_0xa8c9('0x13')](_0xa8c9('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xa8c9('0x14')](_0xa8c9('0xc'),auth[_0xa8c9('0xa')](),controller[_0xa8c9('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index b1e81b5..f05440d 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 _0xb4c7=['STRING','TEXT','sequelize','exports'];(function(_0x4b0290,_0x188c34){var _0x4bd9f4=function(_0x357f3f){while(--_0x357f3f){_0x4b0290['push'](_0x4b0290['shift']());}};_0x4bd9f4(++_0x188c34);}(_0xb4c7,0x1ea));var _0x7b4c=function(_0x3c3dfb,_0x2d27a4){_0x3c3dfb=_0x3c3dfb-0x0;var _0x3b0ede=_0xb4c7[_0x3c3dfb];return _0x3b0ede;};'use strict';var Sequelize=require(_0x7b4c('0x0'));module[_0x7b4c('0x1')]={'name':{'type':Sequelize[_0x7b4c('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x7b4c('0x2')]},'parent':{'type':Sequelize[_0x7b4c('0x2')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize[_0x7b4c('0x3')]},'joins':{'type':Sequelize[_0x7b4c('0x3')]}}; \ No newline at end of file +var _0x6f47=['TEXT','exports','STRING'];(function(_0x4d64f6,_0x5d7944){var _0x347719=function(_0x3c8eb9){while(--_0x3c8eb9){_0x4d64f6['push'](_0x4d64f6['shift']());}};_0x347719(++_0x5d7944);}(_0x6f47,0xc7));var _0x76f4=function(_0xe66cf2,_0x32ba5f){_0xe66cf2=_0xe66cf2-0x0;var _0x2d84e7=_0x6f47[_0xe66cf2];return _0x2d84e7;};'use strict';var Sequelize=require('sequelize');module[_0x76f4('0x0')]={'name':{'type':Sequelize[_0x76f4('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x76f4('0x1')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize[_0x76f4('0x2')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index 7a24c6f..1e83340 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 _0x2ef3=['Sequelize','from','foreignKey','output','web','fullPath','generate','csv','cdr','startDate','endDate','info','child_process','fork','../../components/export/','savename','countTable','COUNT(*)','runReport','IS\x20NULL','IS\x20NOT\x20EMPTY','metric','Limited\x20Query:','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','../../mysqldb','status','offset','undefined','count','limit','set','Content-Range','apply','save','then','destroy','get','DefaultReports','UserProfileResource','end','error','stack','name','send','index','map','rawAttributes','type','key','model','query','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','AnalyticDefaultReport','includeAll','include','findAll','rows','catch','show','params','keys','fields','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','autoAssociation','update','preview','left_join','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','HOUR(%s)','ROUND(%s)','includes','IS\x20EMPTY','operator','rules','group','condition','value','getFields','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','MetricId','field','function','replace','format','groupBy','orderBy','DESC','alias','joins','parentKey','foreignTable','%s.%s\x20=\x20%s.%s','table','conditions','parse','clone','debug','toString','sequelize','QueryTypes','SELECT','join','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','SEC_TO_TIME(%s)','UNIX_TIMESTAMP(%s)','IS\x20NOT\x20NULL'];(function(_0x2e4aa2,_0x11956a){var _0x5e6092=function(_0x4c12c2){while(--_0x4c12c2){_0x2e4aa2['push'](_0x2e4aa2['shift']());}};_0x5e6092(++_0x11956a);}(_0x2ef3,0xba));var _0x32ef=function(_0x120112,_0x2c1264){_0x120112=_0x120112-0x0;var _0x4c3c38=_0x2ef3[_0x120112];return _0x4c3c38;};'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'];var dbH=require(_0x32ef('0x18'))['dbH'];function respondWithStatusCode(_0x3e98df,_0x1ef1ae){_0x1ef1ae=_0x1ef1ae||0xcc;return function(_0x5c3eb9){if(_0x5c3eb9){return _0x3e98df['sendStatus'](_0x1ef1ae);}return _0x3e98df[_0x32ef('0x19')](_0x1ef1ae)['end']();};}function respondWithResult(_0x326fce,_0x40a6e6){_0x40a6e6=_0x40a6e6||0xc8;return function(_0x93d492){if(_0x93d492){return _0x326fce[_0x32ef('0x19')](_0x40a6e6)['json'](_0x93d492);}};}function respondWithFilteredResult(_0x55bf0b,_0x531e30){return function(_0x13db1a){if(_0x13db1a){var _0x3950e6=typeof _0x531e30[_0x32ef('0x1a')]==='undefined'&&typeof _0x531e30['limit']===_0x32ef('0x1b');var _0x1a9476=_0x13db1a[_0x32ef('0x1c')];var _0x57863c=_0x3950e6?0x0:_0x531e30[_0x32ef('0x1a')];var _0x33e230=_0x3950e6?_0x13db1a['count']:_0x531e30[_0x32ef('0x1a')]+_0x531e30[_0x32ef('0x1d')];var _0x26aff3;if(_0x33e230>=_0x1a9476){_0x33e230=_0x1a9476;_0x26aff3=0xc8;}else{_0x26aff3=0xce;}_0x55bf0b[_0x32ef('0x19')](_0x26aff3);return _0x55bf0b[_0x32ef('0x1e')](_0x32ef('0x1f'),_0x57863c+'-'+_0x33e230+'/'+_0x1a9476)['json'](_0x13db1a);}return null;};}function patchUpdates(_0x3c5b78){return function(_0x5cc3ef){try{jsonpatch[_0x32ef('0x20')](_0x5cc3ef,_0x3c5b78,!![]);}catch(_0x3a20ca){return BPromise['reject'](_0x3a20ca);}return _0x5cc3ef[_0x32ef('0x21')]();};}function saveUpdates(_0x97780,_0x5e8898){return function(_0x55f7f2){if(_0x55f7f2){return _0x55f7f2['update'](_0x97780)[_0x32ef('0x22')](function(_0xb30fab){return _0xb30fab;});}return null;};}function removeEntity(_0x225feb,_0x478bef){return function(_0x59585f){if(_0x59585f){return _0x59585f[_0x32ef('0x23')]()['then'](function(){var _0x51a412=_0x59585f[_0x32ef('0x24')]({'plain':!![]});var _0x14d4b3=_0x32ef('0x25');return db[_0x32ef('0x26')][_0x32ef('0x23')]({'where':{'type':_0x14d4b3,'resourceId':_0x51a412['id']}})[_0x32ef('0x22')](function(){return _0x59585f;});})[_0x32ef('0x22')](function(){_0x225feb[_0x32ef('0x19')](0xcc)[_0x32ef('0x27')]();});}};}function handleEntityNotFound(_0x2f52d7,_0x1335e2){return function(_0xba4b3f){if(!_0xba4b3f){_0x2f52d7['sendStatus'](0x194);}return _0xba4b3f;};}function handleError(_0xd65fde,_0x2f5d06){_0x2f5d06=_0x2f5d06||0x1f4;return function(_0x5a04cd){logger[_0x32ef('0x28')](_0x5a04cd[_0x32ef('0x29')]);if(_0x5a04cd[_0x32ef('0x2a')]){delete _0x5a04cd[_0x32ef('0x2a')];}_0xd65fde['status'](_0x2f5d06)[_0x32ef('0x2b')](_0x5a04cd);};}exports[_0x32ef('0x2c')]=function(_0x31dbc3,_0x2ac686){var _0x1b668a={},_0x1a6ed2={},_0x1a122d={'count':0x0,'rows':[]};var _0x575f3e=_[_0x32ef('0x2d')](db['AnalyticDefaultReport'][_0x32ef('0x2e')],function(_0x2b6c6a){return{'name':_0x2b6c6a['fieldName'],'type':_0x2b6c6a[_0x32ef('0x2f')][_0x32ef('0x30')]};});_0x1a6ed2[_0x32ef('0x31')]=_[_0x32ef('0x2d')](_0x575f3e,_0x32ef('0x2a'));_0x1a6ed2['query']=_['keys'](_0x31dbc3[_0x32ef('0x32')]);_0x1a6ed2['filters']=_[_0x32ef('0x33')](_0x1a6ed2[_0x32ef('0x31')],_0x1a6ed2[_0x32ef('0x32')]);_0x1b668a[_0x32ef('0x34')]=_[_0x32ef('0x33')](_0x1a6ed2[_0x32ef('0x31')],qs['fields'](_0x31dbc3['query']['fields']));_0x1b668a[_0x32ef('0x34')]=_0x1b668a[_0x32ef('0x34')][_0x32ef('0x35')]?_0x1b668a['attributes']:_0x1a6ed2['model'];if(!_0x31dbc3[_0x32ef('0x32')][_0x32ef('0x36')](_0x32ef('0x37'))){_0x1b668a['limit']=qs['limit'](_0x31dbc3[_0x32ef('0x32')][_0x32ef('0x1d')]);_0x1b668a[_0x32ef('0x1a')]=qs[_0x32ef('0x1a')](_0x31dbc3[_0x32ef('0x32')][_0x32ef('0x1a')]);}_0x1b668a[_0x32ef('0x38')]=qs[_0x32ef('0x39')](_0x31dbc3[_0x32ef('0x32')]['sort']);_0x1b668a[_0x32ef('0x3a')]=qs[_0x32ef('0x3b')](_[_0x32ef('0x3c')](_0x31dbc3['query'],_0x1a6ed2[_0x32ef('0x3b')]),_0x575f3e);if(_0x31dbc3[_0x32ef('0x32')][_0x32ef('0x3d')]){_0x1b668a[_0x32ef('0x3a')]=_[_0x32ef('0x3e')](_0x1b668a[_0x32ef('0x3a')],{'$or':_[_0x32ef('0x2d')](_0x575f3e,function(_0x1cebed){if(_0x1cebed[_0x32ef('0x2f')]!==_0x32ef('0x3f')){var _0xb4db74={};_0xb4db74[_0x1cebed[_0x32ef('0x2a')]]={'$like':'%'+_0x31dbc3['query'][_0x32ef('0x3d')]+'%'};return _0xb4db74;}})});}_0x1b668a=_[_0x32ef('0x3e')]({},_0x1b668a,_0x31dbc3[_0x32ef('0x40')]);var _0x1733e3={'where':_0x1b668a[_0x32ef('0x3a')]};return db[_0x32ef('0x41')][_0x32ef('0x1c')](_0x1733e3)['then'](function(_0x538758){_0x1a122d[_0x32ef('0x1c')]=_0x538758;if(_0x31dbc3[_0x32ef('0x32')][_0x32ef('0x42')]){_0x1b668a[_0x32ef('0x43')]=[{'all':!![]}];}return db['AnalyticDefaultReport'][_0x32ef('0x44')](_0x1b668a);})[_0x32ef('0x22')](function(_0x5d2f06){_0x1a122d[_0x32ef('0x45')]=_0x5d2f06;return _0x1a122d;})['then'](respondWithFilteredResult(_0x2ac686,_0x1b668a))[_0x32ef('0x46')](handleError(_0x2ac686,null));};exports[_0x32ef('0x47')]=function(_0x37a497,_0x3be46d){var _0x2c2b62={'raw':!![],'where':{'id':_0x37a497[_0x32ef('0x48')]['id']}},_0x2310ae={};_0x2310ae[_0x32ef('0x31')]=_[_0x32ef('0x49')](db[_0x32ef('0x41')]['rawAttributes']);_0x2310ae[_0x32ef('0x32')]=_['keys'](_0x37a497[_0x32ef('0x32')]);_0x2310ae[_0x32ef('0x3b')]=_[_0x32ef('0x33')](_0x2310ae['model'],_0x2310ae[_0x32ef('0x32')]);_0x2c2b62[_0x32ef('0x34')]=_[_0x32ef('0x33')](_0x2310ae[_0x32ef('0x31')],qs[_0x32ef('0x4a')](_0x37a497[_0x32ef('0x32')][_0x32ef('0x4a')]));_0x2c2b62['attributes']=_0x2c2b62['attributes'][_0x32ef('0x35')]?_0x2c2b62[_0x32ef('0x34')]:_0x2310ae[_0x32ef('0x31')];if(_0x37a497[_0x32ef('0x32')][_0x32ef('0x42')]){_0x2c2b62[_0x32ef('0x43')]=[{'all':!![]}];}_0x2c2b62=_[_0x32ef('0x3e')]({},_0x2c2b62,_0x37a497[_0x32ef('0x40')]);return db[_0x32ef('0x41')][_0x32ef('0x4b')](_0x2c2b62)[_0x32ef('0x22')](handleEntityNotFound(_0x3be46d,null))[_0x32ef('0x22')](respondWithResult(_0x3be46d,null))[_0x32ef('0x46')](handleError(_0x3be46d,null));};exports['create']=function(_0x420f00,_0x12fbd7){return db[_0x32ef('0x41')][_0x32ef('0x4c')](_0x420f00[_0x32ef('0x4d')],{})[_0x32ef('0x22')](function(_0x278696){var _0x1acded=_0x420f00[_0x32ef('0x4e')][_0x32ef('0x24')]({'plain':!![]});if(!_0x1acded)throw new Error(_0x32ef('0x4f'));if(_0x1acded[_0x32ef('0x50')]===_0x32ef('0x4e')){var _0x326445=_0x278696[_0x32ef('0x24')]({'plain':!![]});var _0x3fb4d8=_0x32ef('0x51');return db[_0x32ef('0x52')]['find']({'where':{'name':_0x3fb4d8,'userProfileId':_0x1acded['userProfileId']},'raw':!![]})[_0x32ef('0x22')](function(_0x259c32){if(_0x259c32&&_0x259c32[_0x32ef('0x53')]===0x0){return db[_0x32ef('0x26')][_0x32ef('0x4c')]({'name':_0x326445[_0x32ef('0x2a')],'resourceId':_0x326445['id'],'type':_0x32ef('0x25'),'sectionId':_0x259c32['id']},{})[_0x32ef('0x22')](function(){return _0x278696;});}else{return _0x278696;}})[_0x32ef('0x46')](function(_0x368bf1){logger[_0x32ef('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x368bf1);throw _0x368bf1;});}return _0x278696;})[_0x32ef('0x22')](respondWithResult(_0x12fbd7,0xc9))[_0x32ef('0x46')](handleError(_0x12fbd7,null));};exports[_0x32ef('0x54')]=function(_0x3fe01f,_0x38314a){if(_0x3fe01f[_0x32ef('0x4d')]['id']){delete _0x3fe01f['body']['id'];}return db[_0x32ef('0x41')][_0x32ef('0x4b')]({'where':{'id':_0x3fe01f[_0x32ef('0x48')]['id']}})['then'](handleEntityNotFound(_0x38314a,null))[_0x32ef('0x22')](saveUpdates(_0x3fe01f['body'],null))[_0x32ef('0x22')](respondWithResult(_0x38314a,null))[_0x32ef('0x46')](handleError(_0x38314a,null));};exports['destroy']=function(_0x206ad5,_0x59e5f9){return db[_0x32ef('0x41')][_0x32ef('0x4b')]({'where':{'id':_0x206ad5[_0x32ef('0x48')]['id']}})[_0x32ef('0x22')](handleEntityNotFound(_0x59e5f9,null))[_0x32ef('0x22')](removeEntity(_0x59e5f9,null))[_0x32ef('0x46')](handleError(_0x59e5f9,null));};exports[_0x32ef('0x55')]=function(_0x56260f,_0x56cc75){var _0xdfa103=0xa;var _0x52232a=['join',_0x32ef('0x56'),_0x32ef('0x57'),_0x32ef('0x58')];var _0x6aae59={'SUM':_0x32ef('0x59'),'COUNT':_0x32ef('0x5a'),'COUNT DISTINCT':_0x32ef('0x5b'),'MAX':_0x32ef('0x5c'),'MIN':_0x32ef('0x5d'),'AVG':_0x32ef('0x5e'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x32ef('0x5f')};var _0xbd059e={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x32ef('0x60'),'HOUR':_0x32ef('0x61'),'ROUND':_0x32ef('0x62'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x2ac877=function(_0x3c31d0){return!_[_0x32ef('0x63')](['IS\x20NULL','IS\x20NOT\x20NULL',_0x32ef('0x64'),'IS\x20NOT\x20EMPTY'],_0x3c31d0);};var _0x17f447=function(_0x5bb114){if(!_0x5bb114||!_0x5bb114['rules'][_0x32ef('0x35')]){return'';}for(var _0x208989='(',_0x10cb37=0x0;_0x10cb37<_0x5bb114['rules'][_0x32ef('0x35')];_0x10cb37+=0x1){_0x10cb37>0x0&&(_0x208989+='\x20'+_0x5bb114[_0x32ef('0x65')]+'\x20');_0x208989+=_0x5bb114[_0x32ef('0x66')][_0x10cb37]['group']?_0x17f447(_0x5bb114[_0x32ef('0x66')][_0x10cb37][_0x32ef('0x67')]):_0x5bb114['rules'][_0x10cb37]['field']+'\x20'+_0x5bb114[_0x32ef('0x66')][_0x10cb37][_0x32ef('0x68')]+(_0x2ac877(_0x5bb114[_0x32ef('0x66')][_0x10cb37][_0x32ef('0x68')])?'\x20'+_0x5bb114[_0x32ef('0x66')][_0x10cb37][_0x32ef('0x69')]:'');}return _0x208989+')';};var _0x4c89e8={'where':{'id':_0x56260f[_0x32ef('0x48')]['id']}},_0x285330,_0x63b65,_0x25b6d6,_0x36ed97,_0x21e930;_0x4c89e8=_[_0x32ef('0x3e')]({},_0x4c89e8,_0x56260f[_0x32ef('0x40')]);return db[_0x32ef('0x41')]['find'](_0x4c89e8)[_0x32ef('0x22')](function(_0x29ff58){if(_0x29ff58){_0x285330=_0x29ff58;return _0x29ff58[_0x32ef('0x6a')]();}return null;})[_0x32ef('0x22')](function(_0x79ae28){if(_0x79ae28){if(!_0x79ae28['length']){throw new db['Sequelize'][(_0x32ef('0x6b'))](_0x32ef('0x6c'),0x193);}_0x63b65=_0x79ae28;return db[_0x32ef('0x6d')][_0x32ef('0x44')]({'raw':!![]});}return null;})[_0x32ef('0x22')](function(_0x526fb1){if(_0x526fb1){_0x25b6d6=_[_0x32ef('0x6e')](_0x526fb1,'id');var _0x544045;var _0x216e2f=squel[_0x32ef('0x6f')]();_0x216e2f['from'](_0x285330['table']);for(var _0x2c9f7a=0x0;_0x2c9f7a<_0x63b65[_0x32ef('0x35')];_0x2c9f7a+=0x1){_0x544045=_0x63b65[_0x2c9f7a][_0x32ef('0x70')]?_0x25b6d6[_0x63b65[_0x2c9f7a]['MetricId']]['metric']:_0x63b65[_0x2c9f7a][_0x32ef('0x71')];_0x544045=_0x63b65[_0x2c9f7a][_0x32ef('0x72')]?_[_0x32ef('0x73')](_0x6aae59[_0x63b65[_0x2c9f7a][_0x32ef('0x72')]],'%s',_0x544045):_0x544045;_0x544045=_0x63b65[_0x2c9f7a]['format']?_[_0x32ef('0x73')](_0xbd059e[_0x63b65[_0x2c9f7a][_0x32ef('0x74')]],'%s',_0x544045):_0x544045;if(_0x63b65[_0x2c9f7a][_0x32ef('0x75')]){_0x216e2f[_0x32ef('0x67')](_0x544045);}_0x63b65[_0x2c9f7a][_0x32ef('0x76')]&&_0x216e2f[_0x32ef('0x38')](_0x544045,_0x63b65[_0x2c9f7a][_0x32ef('0x76')]===_0x32ef('0x77')?![]:!![]);_0x216e2f[_0x32ef('0x71')](_0x544045,_0x63b65[_0x2c9f7a][_0x32ef('0x78')]||_0x544045);}if(_0x285330[_0x32ef('0x79')]){_0x285330[_0x32ef('0x79')]=JSON['parse'](_0x285330['joins']);for(var _0x3a9c97=0x0;_0x3a9c97<_0x285330[_0x32ef('0x79')]['length'];_0x3a9c97+=0x1){if(_0x285330[_0x32ef('0x79')][_0x3a9c97]['type']&&_[_0x32ef('0x63')](_0x52232a,_0x285330[_0x32ef('0x79')][_0x3a9c97][_0x32ef('0x2f')])&&_0x285330['joins'][_0x3a9c97][_0x32ef('0x7a')]&&_0x285330['joins'][_0x3a9c97][_0x32ef('0x7b')]&&_0x285330[_0x32ef('0x79')][_0x3a9c97]['foreignKey']){_0x216e2f[_0x285330['joins'][_0x3a9c97][_0x32ef('0x2f')]](_0x285330['joins'][_0x3a9c97][_0x32ef('0x7b')],null,util['format'](_0x32ef('0x7c'),_0x285330[_0x32ef('0x7d')],_0x285330[_0x32ef('0x79')][_0x3a9c97]['parentKey'],_0x285330['joins'][_0x3a9c97]['foreignTable'],_0x285330[_0x32ef('0x79')][_0x3a9c97]['foreignKey']));}}}if(_0x285330[_0x32ef('0x7e')]){_0x285330[_0x32ef('0x7e')]=JSON[_0x32ef('0x7f')](_0x285330[_0x32ef('0x7e')]);_0x216e2f[_0x32ef('0x3a')](_0x17f447(_0x285330[_0x32ef('0x7e')]['group']));}_0x21e930=_0x216e2f[_0x32ef('0x80')]();_0x216e2f['limit'](_0xdfa103);_0x216e2f['offset'](0x0);logger[_0x32ef('0x81')]('Limited\x20Query:',_0x216e2f[_0x32ef('0x82')]());return dbH[_0x32ef('0x83')]['query'](_0x216e2f[_0x32ef('0x82')](),{'type':dbH[_0x32ef('0x83')][_0x32ef('0x84')][_0x32ef('0x85')]});}})[_0x32ef('0x22')](respondWithResult(_0x56cc75,null))[_0x32ef('0x46')](handleError(_0x56cc75,null));};function runReport(_0x4b5506,_0x51736f,_0x35b10d){var _0x5e0b55=_0x51736f[_0x32ef('0x2a')];var _0x266688=0xa;var _0x114d8e=[_0x32ef('0x86'),_0x32ef('0x56'),_0x32ef('0x57'),'cross_join'];var _0x3232ca={'SUM':_0x32ef('0x59'),'COUNT':_0x32ef('0x5a'),'COUNT DISTINCT':_0x32ef('0x5b'),'MAX':_0x32ef('0x5c'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0x32ef('0x87'),'GROUP_CONCAT ASC':_0x32ef('0x88'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x211fb1={'SEC_TO_TIME':_0x32ef('0x89'),'DATE':_0x32ef('0x60'),'HOUR':_0x32ef('0x61'),'ROUND':_0x32ef('0x62'),'UNIX_TIMESTAMP':_0x32ef('0x8a')};var _0xfb4845=function(_0x21067e){return!_[_0x32ef('0x63')](['IS\x20NULL',_0x32ef('0x8b'),_0x32ef('0x64'),'IS\x20NOT\x20EMPTY'],_0x21067e);};var _0x35653b=function(_0x5ea727){if(!_0x5ea727||!_0x5ea727[_0x32ef('0x66')]['length']){return'';}for(var _0x43f36e='(',_0x39300f=0x0;_0x39300f<_0x5ea727[_0x32ef('0x66')][_0x32ef('0x35')];_0x39300f+=0x1){_0x39300f>0x0&&(_0x43f36e+='\x20'+_0x5ea727['operator']+'\x20');_0x43f36e+=_0x5ea727[_0x32ef('0x66')][_0x39300f][_0x32ef('0x67')]?_0x35653b(_0x5ea727[_0x32ef('0x66')][_0x39300f]['group']):_0x5ea727['rules'][_0x39300f]['field']+'\x20'+_0x5ea727[_0x32ef('0x66')][_0x39300f][_0x32ef('0x68')]+(_0xfb4845(_0x5ea727[_0x32ef('0x66')][_0x39300f][_0x32ef('0x68')])?'\x20'+_0x5ea727[_0x32ef('0x66')][_0x39300f]['value']:'');}return _0x43f36e+')';};var _0x2678e3={'where':{'id':_0x4b5506['id']}},_0x5b3deb,_0x471de6,_0x7b0ea5,_0xc43e1,_0x4baa7a;_0x2678e3=_[_0x32ef('0x3e')]({},_0x2678e3,_0x35b10d);return db[_0x32ef('0x41')][_0x32ef('0x4b')](_0x2678e3)[_0x32ef('0x22')](function(_0x28bebb){if(_0x28bebb){_0x5b3deb=_0x28bebb;return _0x28bebb['getFields']();}return null;})[_0x32ef('0x22')](function(_0x484df0){if(_0x484df0){if(!_0x484df0[_0x32ef('0x35')]){throw new db[(_0x32ef('0x8c'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x471de6=_0x484df0;return db[_0x32ef('0x6d')][_0x32ef('0x44')]({'raw':!![]});}return null;})[_0x32ef('0x22')](function(_0x3b9896){if(_0x3b9896){_0x7b0ea5=_['keyBy'](_0x3b9896,'id');var _0x356fd4;var _0x51ca6e=squel['select']();_0x51ca6e[_0x32ef('0x8d')](_0x5b3deb['table']);for(var _0x2237cf=0x0;_0x2237cf<_0x471de6[_0x32ef('0x35')];_0x2237cf+=0x1){_0x356fd4=_0x471de6[_0x2237cf][_0x32ef('0x70')]?_0x7b0ea5[_0x471de6[_0x2237cf]['MetricId']]['metric']:_0x471de6[_0x2237cf][_0x32ef('0x71')];_0x356fd4=_0x471de6[_0x2237cf][_0x32ef('0x72')]?_[_0x32ef('0x73')](_0x3232ca[_0x471de6[_0x2237cf][_0x32ef('0x72')]],'%s',_0x356fd4):_0x356fd4;_0x356fd4=_0x471de6[_0x2237cf][_0x32ef('0x74')]?_[_0x32ef('0x73')](_0x211fb1[_0x471de6[_0x2237cf][_0x32ef('0x74')]],'%s',_0x356fd4):_0x356fd4;if(_0x471de6[_0x2237cf]['groupBy']){_0x51ca6e[_0x32ef('0x67')](_0x356fd4);}_0x471de6[_0x2237cf][_0x32ef('0x76')]&&_0x51ca6e[_0x32ef('0x38')](_0x356fd4,_0x471de6[_0x2237cf][_0x32ef('0x76')]==='DESC'?![]:!![]);_0x51ca6e['field'](_0x356fd4,_0x471de6[_0x2237cf][_0x32ef('0x78')]||_0x356fd4);}if(_0x5b3deb['joins']){_0x5b3deb[_0x32ef('0x79')]=JSON[_0x32ef('0x7f')](_0x5b3deb['joins']);for(var _0x5c7594=0x0;_0x5c7594<_0x5b3deb['joins'][_0x32ef('0x35')];_0x5c7594+=0x1){if(_0x5b3deb[_0x32ef('0x79')][_0x5c7594][_0x32ef('0x2f')]&&_[_0x32ef('0x63')](_0x114d8e,_0x5b3deb['joins'][_0x5c7594][_0x32ef('0x2f')])&&_0x5b3deb[_0x32ef('0x79')][_0x5c7594][_0x32ef('0x7a')]&&_0x5b3deb['joins'][_0x5c7594][_0x32ef('0x7b')]&&_0x5b3deb['joins'][_0x5c7594][_0x32ef('0x8e')]){_0x51ca6e[_0x5b3deb[_0x32ef('0x79')][_0x5c7594]['type']](_0x5b3deb['joins'][_0x5c7594][_0x32ef('0x7b')],null,util[_0x32ef('0x74')](_0x32ef('0x7c'),_0x5b3deb[_0x32ef('0x7d')],_0x5b3deb[_0x32ef('0x79')][_0x5c7594][_0x32ef('0x7a')],_0x5b3deb[_0x32ef('0x79')][_0x5c7594][_0x32ef('0x7b')],_0x5b3deb[_0x32ef('0x79')][_0x5c7594]['foreignKey']));}}}if(_0x5b3deb[_0x32ef('0x7e')]){_0x5b3deb['conditions']=JSON[_0x32ef('0x7f')](_0x5b3deb[_0x32ef('0x7e')]);_0x51ca6e[_0x32ef('0x3a')](_0x35653b(_0x5b3deb[_0x32ef('0x7e')][_0x32ef('0x67')]));}_0x4baa7a=_0x51ca6e['clone']();_0x51ca6e[_0x32ef('0x1d')](_0x266688);_0x51ca6e[_0x32ef('0x1a')](0x0);return;}})[_0x32ef('0x22')](function(){if(_0x51736f[_0x32ef('0x8f')]===_0x32ef('0x90')){return null;}var _0x1cfdd8=_[_0x32ef('0x3e')](_0x51736f,{'name':_0x51736f[_0x32ef('0x91')]||_0x51736f[_0x32ef('0x2a')]||_0x5b3deb['name'],'basename':_0x5e0b55,'savename':util['format']('%s-%s.%s',_0x51736f[_0x32ef('0x2a')]||_0x5b3deb[_0x32ef('0x2a')],require('randomstring')[_0x32ef('0x92')](0x4),_0x51736f['output']||_0x32ef('0x93')),'reportId':_0x5b3deb['id'],'reportType':'default'});return db['AnalyticExtractedReport'][_0x32ef('0x4c')](_0x1cfdd8,{'raw':!![]});})[_0x32ef('0x22')](function(_0x118d2e){if(_0x5b3deb[_0x32ef('0x7d')]===_0x32ef('0x94')){_0x4baa7a['where'](_0x5b3deb[_0x32ef('0x7d')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x51736f[_0x32ef('0x95')],_0x51736f['endDate']);}else{_0x4baa7a['where'](_0x5b3deb['table']+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x51736f['startDate'],_0x51736f[_0x32ef('0x96')]);}if(_0x118d2e){logger[_0x32ef('0x97')]('Run\x20Query:',_0x4baa7a[_0x32ef('0x82')]());require(_0x32ef('0x98'))[_0x32ef('0x99')](path[_0x32ef('0x86')](__dirname,_0x32ef('0x9a'),_0x118d2e[_0x32ef('0x8f')]),[_0x118d2e['id'],_0x4baa7a['toString'](),path[_0x32ef('0x86')](__dirname,'../../files/reports',_0x118d2e[_0x32ef('0x9b')]),_0x5e0b55]);return _0x118d2e;}else{var _0x1be713=squel['select']();_0x1be713[_0x32ef('0x8d')]('('+_0x4baa7a['toString']()+')',_0x32ef('0x9c'));_0x1be713[_0x32ef('0x71')](_0x32ef('0x9d'),_0x32ef('0x1c'));_0x4baa7a['limit'](_0x51736f[_0x32ef('0x1d')]||_0x266688);_0x4baa7a[_0x32ef('0x1a')](_0x51736f[_0x32ef('0x1a')]||0x0);return dbH[_0x32ef('0x83')]['query'](_0x1be713[_0x32ef('0x82')](),{'type':dbH['sequelize'][_0x32ef('0x84')][_0x32ef('0x85')]})[_0x32ef('0x22')](function(_0x28ef17){if(!_0x28ef17[_0x32ef('0x35')]){_0xc43e1=0x0;}else{_0xc43e1=_0x28ef17[0x0][_0x32ef('0x1c')]||0x0;}return dbH['sequelize'][_0x32ef('0x32')](_0x4baa7a['toString'](),{'type':dbH['sequelize'][_0x32ef('0x84')][_0x32ef('0x85')]});})[_0x32ef('0x22')](function(_0x3956e7){return{'rows':_0x3956e7||[],'count':_0xc43e1};});}});}exports['run']=function(_0x8d3b24,_0x642716){return runReport(_0x8d3b24[_0x32ef('0x48')],_0x8d3b24[_0x32ef('0x32')],_0x8d3b24['options'])['then'](respondWithResult(_0x642716,null))['catch'](handleError(_0x642716,null));};exports[_0x32ef('0x9e')]=runReport;exports[_0x32ef('0x32')]=function(_0x4454f3,_0xc92dcc){var _0x3d18b9=0xa;var _0x9233cb=[_0x32ef('0x86'),_0x32ef('0x56'),_0x32ef('0x57'),_0x32ef('0x58')];var _0xa76912={'SUM':'SUM(%s)','COUNT':_0x32ef('0x5a'),'COUNT DISTINCT':_0x32ef('0x5b'),'MAX':_0x32ef('0x5c'),'MIN':_0x32ef('0x5d'),'AVG':_0x32ef('0x5e'),'GROUP_CONCAT':_0x32ef('0x87'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x32ef('0x5f')};var _0x1526a1={'SEC_TO_TIME':_0x32ef('0x89'),'DATE':_0x32ef('0x60'),'HOUR':_0x32ef('0x61'),'ROUND':_0x32ef('0x62'),'UNIX_TIMESTAMP':_0x32ef('0x8a')};var _0x2d4d2f=function(_0x292488){return!_[_0x32ef('0x63')]([_0x32ef('0x9f'),_0x32ef('0x8b'),_0x32ef('0x64'),_0x32ef('0xa0')],_0x292488);};var _0x50b674=function(_0x379d40){if(!_0x379d40||!_0x379d40[_0x32ef('0x66')][_0x32ef('0x35')]){return'';}for(var _0x4b7a4d='(',_0x16525b=0x0;_0x16525b<_0x379d40['rules'][_0x32ef('0x35')];_0x16525b+=0x1){_0x16525b>0x0&&(_0x4b7a4d+='\x20'+_0x379d40[_0x32ef('0x65')]+'\x20');_0x4b7a4d+=_0x379d40[_0x32ef('0x66')][_0x16525b]['group']?_0x50b674(_0x379d40[_0x32ef('0x66')][_0x16525b]['group']):_0x379d40[_0x32ef('0x66')][_0x16525b][_0x32ef('0x71')]+'\x20'+_0x379d40['rules'][_0x16525b][_0x32ef('0x68')]+(_0x2d4d2f(_0x379d40[_0x32ef('0x66')][_0x16525b][_0x32ef('0x68')])?'\x20'+_0x379d40[_0x32ef('0x66')][_0x16525b][_0x32ef('0x69')]:'');}return _0x4b7a4d+')';};var _0x264075={'where':{'id':_0x4454f3[_0x32ef('0x48')]['id']}},_0x3798d1,_0x4befa9,_0x493ae9,_0x143d39,_0x497948;_0x264075=_[_0x32ef('0x3e')]({},_0x264075,_0x4454f3['options']);return db[_0x32ef('0x41')][_0x32ef('0x4b')](_0x264075)['then'](function(_0x1200c9){if(_0x1200c9){_0x3798d1=_0x1200c9;return _0x1200c9[_0x32ef('0x6a')]();}return null;})[_0x32ef('0x22')](function(_0xa5f787){if(_0xa5f787){if(!_0xa5f787[_0x32ef('0x35')]){throw new db['Sequelize'][(_0x32ef('0x6b'))](_0x32ef('0x6c'),0x193);}_0x4befa9=_0xa5f787;return db['AnalyticMetric'][_0x32ef('0x44')]({'raw':!![]});}return null;})[_0x32ef('0x22')](function(_0x55ad11){if(_0x55ad11){_0x493ae9=_[_0x32ef('0x6e')](_0x55ad11,'id');var _0x2971a8;var _0x522c22=squel[_0x32ef('0x6f')]();_0x522c22[_0x32ef('0x8d')](_0x3798d1['table']);for(var _0xb41a01=0x0;_0xb41a01<_0x4befa9[_0x32ef('0x35')];_0xb41a01+=0x1){_0x2971a8=_0x4befa9[_0xb41a01][_0x32ef('0x70')]?_0x493ae9[_0x4befa9[_0xb41a01][_0x32ef('0x70')]][_0x32ef('0xa1')]:_0x4befa9[_0xb41a01][_0x32ef('0x71')];_0x2971a8=_0x4befa9[_0xb41a01][_0x32ef('0x72')]?_['replace'](_0xa76912[_0x4befa9[_0xb41a01]['function']],'%s',_0x2971a8):_0x2971a8;_0x2971a8=_0x4befa9[_0xb41a01][_0x32ef('0x74')]?_[_0x32ef('0x73')](_0x1526a1[_0x4befa9[_0xb41a01][_0x32ef('0x74')]],'%s',_0x2971a8):_0x2971a8;if(_0x4befa9[_0xb41a01]['groupBy']){_0x522c22[_0x32ef('0x67')](_0x2971a8);}_0x4befa9[_0xb41a01][_0x32ef('0x76')]&&_0x522c22['order'](_0x2971a8,_0x4befa9[_0xb41a01][_0x32ef('0x76')]===_0x32ef('0x77')?![]:!![]);_0x522c22['field'](_0x2971a8,_0x4befa9[_0xb41a01]['alias']||_0x2971a8);}if(_0x3798d1[_0x32ef('0x79')]){_0x3798d1[_0x32ef('0x79')]=JSON[_0x32ef('0x7f')](_0x3798d1['joins']);for(var _0x5f4eab=0x0;_0x5f4eab<_0x3798d1['joins'][_0x32ef('0x35')];_0x5f4eab+=0x1){if(_0x3798d1[_0x32ef('0x79')][_0x5f4eab][_0x32ef('0x2f')]&&_['includes'](_0x9233cb,_0x3798d1[_0x32ef('0x79')][_0x5f4eab][_0x32ef('0x2f')])&&_0x3798d1[_0x32ef('0x79')][_0x5f4eab]['parentKey']&&_0x3798d1[_0x32ef('0x79')][_0x5f4eab][_0x32ef('0x7b')]&&_0x3798d1['joins'][_0x5f4eab]['foreignKey']){_0x522c22[_0x3798d1[_0x32ef('0x79')][_0x5f4eab]['type']](_0x3798d1[_0x32ef('0x79')][_0x5f4eab][_0x32ef('0x7b')],null,util['format']('%s.%s\x20=\x20%s.%s',_0x3798d1[_0x32ef('0x7d')],_0x3798d1['joins'][_0x5f4eab][_0x32ef('0x7a')],_0x3798d1[_0x32ef('0x79')][_0x5f4eab][_0x32ef('0x7b')],_0x3798d1[_0x32ef('0x79')][_0x5f4eab][_0x32ef('0x8e')]));}}}if(_0x3798d1[_0x32ef('0x7e')]){_0x3798d1[_0x32ef('0x7e')]=JSON[_0x32ef('0x7f')](_0x3798d1[_0x32ef('0x7e')]);_0x522c22[_0x32ef('0x3a')](_0x50b674(_0x3798d1['conditions']['group']));}_0x497948=_0x522c22[_0x32ef('0x80')]();_0x522c22[_0x32ef('0x1d')](_0x3d18b9);_0x522c22[_0x32ef('0x1a')](0x0);logger[_0x32ef('0x81')](_0x32ef('0xa2'),_0x522c22[_0x32ef('0x82')]());return dbH[_0x32ef('0x83')][_0x32ef('0x32')](_0x522c22[_0x32ef('0x82')](),{'type':dbH[_0x32ef('0x83')]['QueryTypes'][_0x32ef('0x85')]});}})[_0x32ef('0x22')](function(){return{'sql':_0x497948[_0x32ef('0x82')]()};})[_0x32ef('0x22')](respondWithResult(_0xc92dcc,null))[_0x32ef('0x46')](handleError(_0xc92dcc,null));}; \ No newline at end of file +var _0xba34=['save','then','destroy','get','DefaultReports','UserProfileResource','error','name','send','index','map','AnalyticDefaultReport','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','VIRTUAL','merge','options','includeAll','include','findAll','show','params','find','create','body','user','role','UserProfileSection','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','preview','join','left_join','right_join','cross_join','SUM(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','getFields','Sequelize','ValidationErrorItem','keyBy','select','from','table','MetricId','metric','function','replace','format','groupBy','orderBy','DESC','alias','joins','parse','parentKey','foreignKey','foreignTable','%s.%s\x20=\x20%s.%s','conditions','clone','debug','Limited\x20Query:','toString','sequelize','SELECT','COUNT(%s)','AVG(%s)','IS\x20NOT\x20NULL','value','order','output','%s-%s.%s','randomstring','generate','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','endDate','startDate','info','Run\x20Query:','fork','countTable','QueryTypes','runReport','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','ROUND(%s)','Please\x20insert\x20at\x20least\x20one\x20field','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','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','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject'];(function(_0x3b9973,_0xb2a8f8){var _0x4d2343=function(_0x15d676){while(--_0x15d676){_0x3b9973['push'](_0x3b9973['shift']());}};_0x4d2343(++_0xb2a8f8);}(_0xba34,0x119));var _0x4ba3=function(_0x14640d,_0xd5e7c9){_0x14640d=_0x14640d-0x0;var _0x404950=_0xba34[_0x14640d];return _0x404950;};'use strict';var emlformat=require(_0x4ba3('0x0'));var rimraf=require(_0x4ba3('0x1'));var zipdir=require(_0x4ba3('0x2'));var jsonpatch=require(_0x4ba3('0x3'));var rp=require(_0x4ba3('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x4ba3('0x5'));var path=require(_0x4ba3('0x6'));var sox=require(_0x4ba3('0x7'));var csv=require(_0x4ba3('0x8'));var ejs=require(_0x4ba3('0x9'));var fs=require('fs');var fs_extra=require(_0x4ba3('0xa'));var _=require(_0x4ba3('0xb'));var squel=require('squel');var crypto=require(_0x4ba3('0xc'));var jsforce=require(_0x4ba3('0xd'));var deskjs=require(_0x4ba3('0xe'));var toCsv=require(_0x4ba3('0x8'));var querystring=require(_0x4ba3('0xf'));var Papa=require(_0x4ba3('0x10'));var Redis=require(_0x4ba3('0x11'));var authService=require(_0x4ba3('0x12'));var qs=require(_0x4ba3('0x13'));var as=require(_0x4ba3('0x14'));var hardwareService=require(_0x4ba3('0x15'));var logger=require('../../config/logger')(_0x4ba3('0x16'));var utils=require(_0x4ba3('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x4ba3('0x18'));var db=require('../../mysqldb')['db'];var dbH=require(_0x4ba3('0x19'))['dbH'];function respondWithStatusCode(_0x256f02,_0x4419b4){_0x4419b4=_0x4419b4||0xcc;return function(_0x29e498){if(_0x29e498){return _0x256f02[_0x4ba3('0x1a')](_0x4419b4);}return _0x256f02[_0x4ba3('0x1b')](_0x4419b4)[_0x4ba3('0x1c')]();};}function respondWithResult(_0x3a74f7,_0x12ac90){_0x12ac90=_0x12ac90||0xc8;return function(_0x1dec48){if(_0x1dec48){return _0x3a74f7[_0x4ba3('0x1b')](_0x12ac90)[_0x4ba3('0x1d')](_0x1dec48);}};}function respondWithFilteredResult(_0x301359,_0x29a9d1){return function(_0x25f584){if(_0x25f584){var _0x40e75b=typeof _0x29a9d1[_0x4ba3('0x1e')]==='undefined'&&typeof _0x29a9d1[_0x4ba3('0x1f')]===_0x4ba3('0x20');var _0x5ff7ce=_0x25f584[_0x4ba3('0x21')];var _0x556290=_0x40e75b?0x0:_0x29a9d1[_0x4ba3('0x1e')];var _0xe4eff9=_0x40e75b?_0x25f584[_0x4ba3('0x21')]:_0x29a9d1[_0x4ba3('0x1e')]+_0x29a9d1[_0x4ba3('0x1f')];var _0x125944;if(_0xe4eff9>=_0x5ff7ce){_0xe4eff9=_0x5ff7ce;_0x125944=0xc8;}else{_0x125944=0xce;}_0x301359['status'](_0x125944);return _0x301359['set'](_0x4ba3('0x22'),_0x556290+'-'+_0xe4eff9+'/'+_0x5ff7ce)['json'](_0x25f584);}return null;};}function patchUpdates(_0x18dff5){return function(_0x163967){try{jsonpatch[_0x4ba3('0x23')](_0x163967,_0x18dff5,!![]);}catch(_0xbc7023){return BPromise[_0x4ba3('0x24')](_0xbc7023);}return _0x163967[_0x4ba3('0x25')]();};}function saveUpdates(_0x4a0823,_0x143c78){return function(_0x1f87e1){if(_0x1f87e1){return _0x1f87e1['update'](_0x4a0823)[_0x4ba3('0x26')](function(_0x4ffe39){return _0x4ffe39;});}return null;};}function removeEntity(_0x1ae4de,_0x18abb3){return function(_0x11a917){if(_0x11a917){return _0x11a917[_0x4ba3('0x27')]()[_0x4ba3('0x26')](function(){var _0xe29a49=_0x11a917[_0x4ba3('0x28')]({'plain':!![]});var _0xe1f7d2=_0x4ba3('0x29');return db[_0x4ba3('0x2a')]['destroy']({'where':{'type':_0xe1f7d2,'resourceId':_0xe29a49['id']}})[_0x4ba3('0x26')](function(){return _0x11a917;});})[_0x4ba3('0x26')](function(){_0x1ae4de[_0x4ba3('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x10537e,_0x1fe5e2){return function(_0x44d78c){if(!_0x44d78c){_0x10537e['sendStatus'](0x194);}return _0x44d78c;};}function handleError(_0x10cae6,_0x843276){_0x843276=_0x843276||0x1f4;return function(_0x34ecb4){logger[_0x4ba3('0x2b')](_0x34ecb4['stack']);if(_0x34ecb4['name']){delete _0x34ecb4[_0x4ba3('0x2c')];}_0x10cae6[_0x4ba3('0x1b')](_0x843276)[_0x4ba3('0x2d')](_0x34ecb4);};}exports[_0x4ba3('0x2e')]=function(_0x2cb5d5,_0x11f88f){var _0x48b3b7={},_0x27444b={},_0x28f36c={'count':0x0,'rows':[]};var _0x24d8fc=_[_0x4ba3('0x2f')](db[_0x4ba3('0x30')][_0x4ba3('0x31')],function(_0x457236){return{'name':_0x457236[_0x4ba3('0x32')],'type':_0x457236[_0x4ba3('0x33')][_0x4ba3('0x34')]};});_0x27444b['model']=_['map'](_0x24d8fc,'name');_0x27444b[_0x4ba3('0x35')]=_[_0x4ba3('0x36')](_0x2cb5d5[_0x4ba3('0x35')]);_0x27444b[_0x4ba3('0x37')]=_[_0x4ba3('0x38')](_0x27444b[_0x4ba3('0x39')],_0x27444b[_0x4ba3('0x35')]);_0x48b3b7[_0x4ba3('0x3a')]=_[_0x4ba3('0x38')](_0x27444b[_0x4ba3('0x39')],qs[_0x4ba3('0x3b')](_0x2cb5d5[_0x4ba3('0x35')]['fields']));_0x48b3b7[_0x4ba3('0x3a')]=_0x48b3b7[_0x4ba3('0x3a')][_0x4ba3('0x3c')]?_0x48b3b7['attributes']:_0x27444b[_0x4ba3('0x39')];if(!_0x2cb5d5['query'][_0x4ba3('0x3d')](_0x4ba3('0x3e'))){_0x48b3b7[_0x4ba3('0x1f')]=qs[_0x4ba3('0x1f')](_0x2cb5d5[_0x4ba3('0x35')][_0x4ba3('0x1f')]);_0x48b3b7['offset']=qs[_0x4ba3('0x1e')](_0x2cb5d5[_0x4ba3('0x35')][_0x4ba3('0x1e')]);}_0x48b3b7['order']=qs[_0x4ba3('0x3f')](_0x2cb5d5[_0x4ba3('0x35')]['sort']);_0x48b3b7[_0x4ba3('0x40')]=qs['filters'](_['pick'](_0x2cb5d5[_0x4ba3('0x35')],_0x27444b[_0x4ba3('0x37')]),_0x24d8fc);if(_0x2cb5d5[_0x4ba3('0x35')][_0x4ba3('0x41')]){_0x48b3b7[_0x4ba3('0x40')]=_['merge'](_0x48b3b7[_0x4ba3('0x40')],{'$or':_[_0x4ba3('0x2f')](_0x24d8fc,function(_0x46d2ca){if(_0x46d2ca[_0x4ba3('0x33')]!==_0x4ba3('0x42')){var _0x2acc92={};_0x2acc92[_0x46d2ca[_0x4ba3('0x2c')]]={'$like':'%'+_0x2cb5d5[_0x4ba3('0x35')]['filter']+'%'};return _0x2acc92;}})});}_0x48b3b7=_[_0x4ba3('0x43')]({},_0x48b3b7,_0x2cb5d5[_0x4ba3('0x44')]);var _0x3cb07f={'where':_0x48b3b7[_0x4ba3('0x40')]};return db[_0x4ba3('0x30')][_0x4ba3('0x21')](_0x3cb07f)[_0x4ba3('0x26')](function(_0xdcc2a2){_0x28f36c[_0x4ba3('0x21')]=_0xdcc2a2;if(_0x2cb5d5[_0x4ba3('0x35')][_0x4ba3('0x45')]){_0x48b3b7[_0x4ba3('0x46')]=[{'all':!![]}];}return db[_0x4ba3('0x30')][_0x4ba3('0x47')](_0x48b3b7);})['then'](function(_0x5af671){_0x28f36c['rows']=_0x5af671;return _0x28f36c;})['then'](respondWithFilteredResult(_0x11f88f,_0x48b3b7))['catch'](handleError(_0x11f88f,null));};exports[_0x4ba3('0x48')]=function(_0x5c4659,_0x29e74d){var _0x5567c7={'raw':!![],'where':{'id':_0x5c4659[_0x4ba3('0x49')]['id']}},_0x53d6eb={};_0x53d6eb[_0x4ba3('0x39')]=_[_0x4ba3('0x36')](db[_0x4ba3('0x30')]['rawAttributes']);_0x53d6eb[_0x4ba3('0x35')]=_['keys'](_0x5c4659[_0x4ba3('0x35')]);_0x53d6eb['filters']=_[_0x4ba3('0x38')](_0x53d6eb[_0x4ba3('0x39')],_0x53d6eb[_0x4ba3('0x35')]);_0x5567c7[_0x4ba3('0x3a')]=_[_0x4ba3('0x38')](_0x53d6eb[_0x4ba3('0x39')],qs[_0x4ba3('0x3b')](_0x5c4659['query'][_0x4ba3('0x3b')]));_0x5567c7[_0x4ba3('0x3a')]=_0x5567c7[_0x4ba3('0x3a')][_0x4ba3('0x3c')]?_0x5567c7[_0x4ba3('0x3a')]:_0x53d6eb['model'];if(_0x5c4659['query'][_0x4ba3('0x45')]){_0x5567c7[_0x4ba3('0x46')]=[{'all':!![]}];}_0x5567c7=_[_0x4ba3('0x43')]({},_0x5567c7,_0x5c4659['options']);return db[_0x4ba3('0x30')][_0x4ba3('0x4a')](_0x5567c7)[_0x4ba3('0x26')](handleEntityNotFound(_0x29e74d,null))['then'](respondWithResult(_0x29e74d,null))['catch'](handleError(_0x29e74d,null));};exports[_0x4ba3('0x4b')]=function(_0x482a83,_0x439acf){return db[_0x4ba3('0x30')][_0x4ba3('0x4b')](_0x482a83[_0x4ba3('0x4c')],{})[_0x4ba3('0x26')](function(_0x213eb0){var _0x590739=_0x482a83[_0x4ba3('0x4d')][_0x4ba3('0x28')]({'plain':!![]});if(!_0x590739)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x590739[_0x4ba3('0x4e')]===_0x4ba3('0x4d')){var _0x156c2d=_0x213eb0[_0x4ba3('0x28')]({'plain':!![]});var _0x360472='Reports';return db[_0x4ba3('0x4f')][_0x4ba3('0x4a')]({'where':{'name':_0x360472,'userProfileId':_0x590739['userProfileId']},'raw':!![]})[_0x4ba3('0x26')](function(_0x19d70f){if(_0x19d70f&&_0x19d70f[_0x4ba3('0x50')]===0x0){return db[_0x4ba3('0x2a')][_0x4ba3('0x4b')]({'name':_0x156c2d[_0x4ba3('0x2c')],'resourceId':_0x156c2d['id'],'type':_0x4ba3('0x29'),'sectionId':_0x19d70f['id']},{})[_0x4ba3('0x26')](function(){return _0x213eb0;});}else{return _0x213eb0;}})[_0x4ba3('0x51')](function(_0x428a27){logger[_0x4ba3('0x2b')](_0x4ba3('0x52'),_0x428a27);throw _0x428a27;});}return _0x213eb0;})[_0x4ba3('0x26')](respondWithResult(_0x439acf,0xc9))[_0x4ba3('0x51')](handleError(_0x439acf,null));};exports[_0x4ba3('0x53')]=function(_0x48a3d4,_0x5e7ed5){if(_0x48a3d4['body']['id']){delete _0x48a3d4[_0x4ba3('0x4c')]['id'];}return db[_0x4ba3('0x30')][_0x4ba3('0x4a')]({'where':{'id':_0x48a3d4[_0x4ba3('0x49')]['id']}})[_0x4ba3('0x26')](handleEntityNotFound(_0x5e7ed5,null))['then'](saveUpdates(_0x48a3d4[_0x4ba3('0x4c')],null))[_0x4ba3('0x26')](respondWithResult(_0x5e7ed5,null))[_0x4ba3('0x51')](handleError(_0x5e7ed5,null));};exports[_0x4ba3('0x27')]=function(_0x5359d1,_0x1e83fb){return db[_0x4ba3('0x30')][_0x4ba3('0x4a')]({'where':{'id':_0x5359d1[_0x4ba3('0x49')]['id']}})[_0x4ba3('0x26')](handleEntityNotFound(_0x1e83fb,null))[_0x4ba3('0x26')](removeEntity(_0x1e83fb,null))[_0x4ba3('0x51')](handleError(_0x1e83fb,null));};exports[_0x4ba3('0x54')]=function(_0x328314,_0x4fa64d){var _0x20c849=0xa;var _0x42bb4b=[_0x4ba3('0x55'),_0x4ba3('0x56'),_0x4ba3('0x57'),_0x4ba3('0x58')];var _0x40827a={'SUM':_0x4ba3('0x59'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x4ba3('0x5a'),'MAX':_0x4ba3('0x5b'),'MIN':_0x4ba3('0x5c'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x4ba3('0x5d'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x4ba3('0x5e')};var _0x4cc10a={'SEC_TO_TIME':_0x4ba3('0x5f'),'DATE':_0x4ba3('0x60'),'HOUR':_0x4ba3('0x61'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x4ba3('0x62')};var _0xaef1b=function(_0x2a48fe){return!_[_0x4ba3('0x63')]([_0x4ba3('0x64'),'IS\x20NOT\x20NULL',_0x4ba3('0x65'),_0x4ba3('0x66')],_0x2a48fe);};var _0x34cc21=function(_0x469ef0){if(!_0x469ef0||!_0x469ef0[_0x4ba3('0x67')][_0x4ba3('0x3c')]){return'';}for(var _0x3fdf7f='(',_0x38699e=0x0;_0x38699e<_0x469ef0[_0x4ba3('0x67')][_0x4ba3('0x3c')];_0x38699e+=0x1){_0x38699e>0x0&&(_0x3fdf7f+='\x20'+_0x469ef0[_0x4ba3('0x68')]+'\x20');_0x3fdf7f+=_0x469ef0['rules'][_0x38699e][_0x4ba3('0x69')]?_0x34cc21(_0x469ef0[_0x4ba3('0x67')][_0x38699e]['group']):_0x469ef0['rules'][_0x38699e][_0x4ba3('0x6a')]+'\x20'+_0x469ef0[_0x4ba3('0x67')][_0x38699e]['condition']+(_0xaef1b(_0x469ef0[_0x4ba3('0x67')][_0x38699e][_0x4ba3('0x6b')])?'\x20'+_0x469ef0[_0x4ba3('0x67')][_0x38699e]['value']:'');}return _0x3fdf7f+')';};var _0x1f5815={'where':{'id':_0x328314['params']['id']}},_0x46224,_0x1af489,_0x11209b,_0x24a75a,_0x3a4838;_0x1f5815=_[_0x4ba3('0x43')]({},_0x1f5815,_0x328314[_0x4ba3('0x44')]);return db[_0x4ba3('0x30')]['find'](_0x1f5815)[_0x4ba3('0x26')](function(_0x2f8bcc){if(_0x2f8bcc){_0x46224=_0x2f8bcc;return _0x2f8bcc[_0x4ba3('0x6c')]();}return null;})[_0x4ba3('0x26')](function(_0x21c8b1){if(_0x21c8b1){if(!_0x21c8b1[_0x4ba3('0x3c')]){throw new db[(_0x4ba3('0x6d'))][(_0x4ba3('0x6e'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x1af489=_0x21c8b1;return db['AnalyticMetric'][_0x4ba3('0x47')]({'raw':!![]});}return null;})['then'](function(_0x13ee2c){if(_0x13ee2c){_0x11209b=_[_0x4ba3('0x6f')](_0x13ee2c,'id');var _0x442d66;var _0x5c7fc2=squel[_0x4ba3('0x70')]();_0x5c7fc2[_0x4ba3('0x71')](_0x46224[_0x4ba3('0x72')]);for(var _0x5baf26=0x0;_0x5baf26<_0x1af489[_0x4ba3('0x3c')];_0x5baf26+=0x1){_0x442d66=_0x1af489[_0x5baf26]['MetricId']?_0x11209b[_0x1af489[_0x5baf26][_0x4ba3('0x73')]][_0x4ba3('0x74')]:_0x1af489[_0x5baf26]['field'];_0x442d66=_0x1af489[_0x5baf26][_0x4ba3('0x75')]?_[_0x4ba3('0x76')](_0x40827a[_0x1af489[_0x5baf26][_0x4ba3('0x75')]],'%s',_0x442d66):_0x442d66;_0x442d66=_0x1af489[_0x5baf26][_0x4ba3('0x77')]?_[_0x4ba3('0x76')](_0x4cc10a[_0x1af489[_0x5baf26][_0x4ba3('0x77')]],'%s',_0x442d66):_0x442d66;if(_0x1af489[_0x5baf26][_0x4ba3('0x78')]){_0x5c7fc2[_0x4ba3('0x69')](_0x442d66);}_0x1af489[_0x5baf26][_0x4ba3('0x79')]&&_0x5c7fc2['order'](_0x442d66,_0x1af489[_0x5baf26][_0x4ba3('0x79')]===_0x4ba3('0x7a')?![]:!![]);_0x5c7fc2[_0x4ba3('0x6a')](_0x442d66,_0x1af489[_0x5baf26][_0x4ba3('0x7b')]||_0x442d66);}if(_0x46224[_0x4ba3('0x7c')]){_0x46224[_0x4ba3('0x7c')]=JSON[_0x4ba3('0x7d')](_0x46224[_0x4ba3('0x7c')]);for(var _0x365d94=0x0;_0x365d94<_0x46224[_0x4ba3('0x7c')][_0x4ba3('0x3c')];_0x365d94+=0x1){if(_0x46224[_0x4ba3('0x7c')][_0x365d94]['type']&&_[_0x4ba3('0x63')](_0x42bb4b,_0x46224[_0x4ba3('0x7c')][_0x365d94]['type'])&&_0x46224[_0x4ba3('0x7c')][_0x365d94][_0x4ba3('0x7e')]&&_0x46224['joins'][_0x365d94]['foreignTable']&&_0x46224[_0x4ba3('0x7c')][_0x365d94][_0x4ba3('0x7f')]){_0x5c7fc2[_0x46224[_0x4ba3('0x7c')][_0x365d94][_0x4ba3('0x33')]](_0x46224[_0x4ba3('0x7c')][_0x365d94][_0x4ba3('0x80')],null,util[_0x4ba3('0x77')](_0x4ba3('0x81'),_0x46224['table'],_0x46224[_0x4ba3('0x7c')][_0x365d94]['parentKey'],_0x46224[_0x4ba3('0x7c')][_0x365d94][_0x4ba3('0x80')],_0x46224[_0x4ba3('0x7c')][_0x365d94][_0x4ba3('0x7f')]));}}}if(_0x46224[_0x4ba3('0x82')]){_0x46224[_0x4ba3('0x82')]=JSON[_0x4ba3('0x7d')](_0x46224[_0x4ba3('0x82')]);_0x5c7fc2['where'](_0x34cc21(_0x46224[_0x4ba3('0x82')][_0x4ba3('0x69')]));}_0x3a4838=_0x5c7fc2[_0x4ba3('0x83')]();_0x5c7fc2['limit'](_0x20c849);_0x5c7fc2[_0x4ba3('0x1e')](0x0);logger[_0x4ba3('0x84')](_0x4ba3('0x85'),_0x5c7fc2[_0x4ba3('0x86')]());return dbH[_0x4ba3('0x87')][_0x4ba3('0x35')](_0x5c7fc2[_0x4ba3('0x86')](),{'type':dbH['sequelize']['QueryTypes'][_0x4ba3('0x88')]});}})['then'](respondWithResult(_0x4fa64d,null))[_0x4ba3('0x51')](handleError(_0x4fa64d,null));};function runReport(_0x15508f,_0x108679,_0x20f7db){var _0x5a3c63=_0x108679['name'];var _0x2d16e5=0xa;var _0x2b2132=['join',_0x4ba3('0x56'),_0x4ba3('0x57'),_0x4ba3('0x58')];var _0x1e8232={'SUM':_0x4ba3('0x59'),'COUNT':_0x4ba3('0x89'),'COUNT DISTINCT':_0x4ba3('0x5a'),'MAX':'MAX(%s)','MIN':_0x4ba3('0x5c'),'AVG':_0x4ba3('0x8a'),'GROUP_CONCAT':_0x4ba3('0x5d'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x4ba3('0x5e')};var _0x13dbc4={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x4ba3('0x60'),'HOUR':_0x4ba3('0x61'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x5aa412=function(_0x4ec70e){return!_[_0x4ba3('0x63')]([_0x4ba3('0x64'),_0x4ba3('0x8b'),_0x4ba3('0x65'),_0x4ba3('0x66')],_0x4ec70e);};var _0x333a97=function(_0x30d7a9){if(!_0x30d7a9||!_0x30d7a9['rules'][_0x4ba3('0x3c')]){return'';}for(var _0x4cd4a2='(',_0x31a725=0x0;_0x31a725<_0x30d7a9['rules'][_0x4ba3('0x3c')];_0x31a725+=0x1){_0x31a725>0x0&&(_0x4cd4a2+='\x20'+_0x30d7a9[_0x4ba3('0x68')]+'\x20');_0x4cd4a2+=_0x30d7a9[_0x4ba3('0x67')][_0x31a725][_0x4ba3('0x69')]?_0x333a97(_0x30d7a9[_0x4ba3('0x67')][_0x31a725]['group']):_0x30d7a9['rules'][_0x31a725][_0x4ba3('0x6a')]+'\x20'+_0x30d7a9[_0x4ba3('0x67')][_0x31a725][_0x4ba3('0x6b')]+(_0x5aa412(_0x30d7a9[_0x4ba3('0x67')][_0x31a725][_0x4ba3('0x6b')])?'\x20'+_0x30d7a9[_0x4ba3('0x67')][_0x31a725][_0x4ba3('0x8c')]:'');}return _0x4cd4a2+')';};var _0x3d8606={'where':{'id':_0x15508f['id']}},_0x2d00e3,_0x35441e,_0x217ea4,_0x40dcee,_0x5ea9d0;_0x3d8606=_[_0x4ba3('0x43')]({},_0x3d8606,_0x20f7db);return db['AnalyticDefaultReport'][_0x4ba3('0x4a')](_0x3d8606)[_0x4ba3('0x26')](function(_0x17b970){if(_0x17b970){_0x2d00e3=_0x17b970;return _0x17b970[_0x4ba3('0x6c')]();}return null;})['then'](function(_0x2a2dc2){if(_0x2a2dc2){if(!_0x2a2dc2[_0x4ba3('0x3c')]){throw new db[(_0x4ba3('0x6d'))][(_0x4ba3('0x6e'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x35441e=_0x2a2dc2;return db['AnalyticMetric'][_0x4ba3('0x47')]({'raw':!![]});}return null;})[_0x4ba3('0x26')](function(_0x3188c8){if(_0x3188c8){_0x217ea4=_['keyBy'](_0x3188c8,'id');var _0x2f793a;var _0x1194a5=squel[_0x4ba3('0x70')]();_0x1194a5[_0x4ba3('0x71')](_0x2d00e3[_0x4ba3('0x72')]);for(var _0x1e2134=0x0;_0x1e2134<_0x35441e['length'];_0x1e2134+=0x1){_0x2f793a=_0x35441e[_0x1e2134][_0x4ba3('0x73')]?_0x217ea4[_0x35441e[_0x1e2134]['MetricId']][_0x4ba3('0x74')]:_0x35441e[_0x1e2134][_0x4ba3('0x6a')];_0x2f793a=_0x35441e[_0x1e2134][_0x4ba3('0x75')]?_[_0x4ba3('0x76')](_0x1e8232[_0x35441e[_0x1e2134]['function']],'%s',_0x2f793a):_0x2f793a;_0x2f793a=_0x35441e[_0x1e2134][_0x4ba3('0x77')]?_[_0x4ba3('0x76')](_0x13dbc4[_0x35441e[_0x1e2134]['format']],'%s',_0x2f793a):_0x2f793a;if(_0x35441e[_0x1e2134][_0x4ba3('0x78')]){_0x1194a5['group'](_0x2f793a);}_0x35441e[_0x1e2134][_0x4ba3('0x79')]&&_0x1194a5[_0x4ba3('0x8d')](_0x2f793a,_0x35441e[_0x1e2134][_0x4ba3('0x79')]===_0x4ba3('0x7a')?![]:!![]);_0x1194a5[_0x4ba3('0x6a')](_0x2f793a,_0x35441e[_0x1e2134]['alias']||_0x2f793a);}if(_0x2d00e3['joins']){_0x2d00e3[_0x4ba3('0x7c')]=JSON[_0x4ba3('0x7d')](_0x2d00e3[_0x4ba3('0x7c')]);for(var _0x56244e=0x0;_0x56244e<_0x2d00e3[_0x4ba3('0x7c')][_0x4ba3('0x3c')];_0x56244e+=0x1){if(_0x2d00e3['joins'][_0x56244e][_0x4ba3('0x33')]&&_[_0x4ba3('0x63')](_0x2b2132,_0x2d00e3[_0x4ba3('0x7c')][_0x56244e][_0x4ba3('0x33')])&&_0x2d00e3[_0x4ba3('0x7c')][_0x56244e][_0x4ba3('0x7e')]&&_0x2d00e3[_0x4ba3('0x7c')][_0x56244e][_0x4ba3('0x80')]&&_0x2d00e3['joins'][_0x56244e][_0x4ba3('0x7f')]){_0x1194a5[_0x2d00e3[_0x4ba3('0x7c')][_0x56244e][_0x4ba3('0x33')]](_0x2d00e3[_0x4ba3('0x7c')][_0x56244e][_0x4ba3('0x80')],null,util[_0x4ba3('0x77')](_0x4ba3('0x81'),_0x2d00e3[_0x4ba3('0x72')],_0x2d00e3[_0x4ba3('0x7c')][_0x56244e][_0x4ba3('0x7e')],_0x2d00e3[_0x4ba3('0x7c')][_0x56244e][_0x4ba3('0x80')],_0x2d00e3[_0x4ba3('0x7c')][_0x56244e]['foreignKey']));}}}if(_0x2d00e3['conditions']){_0x2d00e3[_0x4ba3('0x82')]=JSON[_0x4ba3('0x7d')](_0x2d00e3[_0x4ba3('0x82')]);_0x1194a5[_0x4ba3('0x40')](_0x333a97(_0x2d00e3[_0x4ba3('0x82')][_0x4ba3('0x69')]));}_0x5ea9d0=_0x1194a5[_0x4ba3('0x83')]();_0x1194a5['limit'](_0x2d16e5);_0x1194a5['offset'](0x0);return;}})[_0x4ba3('0x26')](function(){if(_0x108679[_0x4ba3('0x8e')]==='web'){return null;}var _0x4fb6b5=_['merge'](_0x108679,{'name':_0x108679['fullPath']||_0x108679[_0x4ba3('0x2c')]||_0x2d00e3[_0x4ba3('0x2c')],'basename':_0x5a3c63,'savename':util[_0x4ba3('0x77')](_0x4ba3('0x8f'),_0x108679[_0x4ba3('0x2c')]||_0x2d00e3['name'],require(_0x4ba3('0x90'))[_0x4ba3('0x91')](0x4),_0x108679[_0x4ba3('0x8e')]||'csv'),'reportId':_0x2d00e3['id'],'reportType':'default'});return db['AnalyticExtractedReport']['create'](_0x4fb6b5,{'raw':!![]});})[_0x4ba3('0x26')](function(_0x17d501){if(_0x2d00e3[_0x4ba3('0x72')]===_0x4ba3('0x92')){_0x5ea9d0[_0x4ba3('0x40')](_0x2d00e3['table']+_0x4ba3('0x93'),_0x108679['startDate'],_0x108679[_0x4ba3('0x94')]);}else{_0x5ea9d0[_0x4ba3('0x40')](_0x2d00e3[_0x4ba3('0x72')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x108679[_0x4ba3('0x95')],_0x108679[_0x4ba3('0x94')]);}if(_0x17d501){logger[_0x4ba3('0x96')](_0x4ba3('0x97'),_0x5ea9d0['toString']());require('child_process')[_0x4ba3('0x98')](path[_0x4ba3('0x55')](__dirname,'../../components/export/',_0x17d501[_0x4ba3('0x8e')]),[_0x17d501['id'],_0x5ea9d0['toString'](),path['join'](__dirname,'../../files/reports',_0x17d501['savename']),_0x5a3c63]);return _0x17d501;}else{var _0x2d2ca3=squel[_0x4ba3('0x70')]();_0x2d2ca3[_0x4ba3('0x71')]('('+_0x5ea9d0[_0x4ba3('0x86')]()+')',_0x4ba3('0x99'));_0x2d2ca3['field']('COUNT(*)',_0x4ba3('0x21'));_0x5ea9d0['limit'](_0x108679[_0x4ba3('0x1f')]||_0x2d16e5);_0x5ea9d0[_0x4ba3('0x1e')](_0x108679[_0x4ba3('0x1e')]||0x0);return dbH['sequelize'][_0x4ba3('0x35')](_0x2d2ca3[_0x4ba3('0x86')](),{'type':dbH[_0x4ba3('0x87')][_0x4ba3('0x9a')][_0x4ba3('0x88')]})[_0x4ba3('0x26')](function(_0xc938c){if(!_0xc938c[_0x4ba3('0x3c')]){_0x40dcee=0x0;}else{_0x40dcee=_0xc938c[0x0][_0x4ba3('0x21')]||0x0;}return dbH['sequelize']['query'](_0x5ea9d0[_0x4ba3('0x86')](),{'type':dbH[_0x4ba3('0x87')][_0x4ba3('0x9a')][_0x4ba3('0x88')]});})[_0x4ba3('0x26')](function(_0xd97c26){return{'rows':_0xd97c26||[],'count':_0x40dcee};});}});}exports['run']=function(_0x1fbdc7,_0x9e45ec){return runReport(_0x1fbdc7['params'],_0x1fbdc7[_0x4ba3('0x35')],_0x1fbdc7[_0x4ba3('0x44')])[_0x4ba3('0x26')](respondWithResult(_0x9e45ec,null))[_0x4ba3('0x51')](handleError(_0x9e45ec,null));};exports[_0x4ba3('0x9b')]=runReport;exports[_0x4ba3('0x35')]=function(_0xddfb0c,_0x41c531){var _0x25bf75=0xa;var _0x18bd77=[_0x4ba3('0x55'),_0x4ba3('0x56'),_0x4ba3('0x57'),_0x4ba3('0x58')];var _0x2e812b={'SUM':'SUM(%s)','COUNT':_0x4ba3('0x89'),'COUNT DISTINCT':_0x4ba3('0x5a'),'MAX':'MAX(%s)','MIN':_0x4ba3('0x5c'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x4ba3('0x5d'),'GROUP_CONCAT ASC':_0x4ba3('0x9c'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x5dc74f={'SEC_TO_TIME':_0x4ba3('0x5f'),'DATE':'DATE(%s)','HOUR':_0x4ba3('0x61'),'ROUND':_0x4ba3('0x9d'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x1590f0=function(_0x5efab9){return!_[_0x4ba3('0x63')]([_0x4ba3('0x64'),_0x4ba3('0x8b'),'IS\x20EMPTY',_0x4ba3('0x66')],_0x5efab9);};var _0x4d3262=function(_0x4ad4d3){if(!_0x4ad4d3||!_0x4ad4d3[_0x4ba3('0x67')]['length']){return'';}for(var _0x4529a3='(',_0x9b9c64=0x0;_0x9b9c64<_0x4ad4d3[_0x4ba3('0x67')]['length'];_0x9b9c64+=0x1){_0x9b9c64>0x0&&(_0x4529a3+='\x20'+_0x4ad4d3['operator']+'\x20');_0x4529a3+=_0x4ad4d3[_0x4ba3('0x67')][_0x9b9c64][_0x4ba3('0x69')]?_0x4d3262(_0x4ad4d3[_0x4ba3('0x67')][_0x9b9c64][_0x4ba3('0x69')]):_0x4ad4d3[_0x4ba3('0x67')][_0x9b9c64]['field']+'\x20'+_0x4ad4d3[_0x4ba3('0x67')][_0x9b9c64][_0x4ba3('0x6b')]+(_0x1590f0(_0x4ad4d3[_0x4ba3('0x67')][_0x9b9c64][_0x4ba3('0x6b')])?'\x20'+_0x4ad4d3['rules'][_0x9b9c64][_0x4ba3('0x8c')]:'');}return _0x4529a3+')';};var _0x3073c5={'where':{'id':_0xddfb0c[_0x4ba3('0x49')]['id']}},_0x3d1c11,_0xa41747,_0x25c92c,_0x422a8d,_0x225746;_0x3073c5=_[_0x4ba3('0x43')]({},_0x3073c5,_0xddfb0c[_0x4ba3('0x44')]);return db[_0x4ba3('0x30')]['find'](_0x3073c5)[_0x4ba3('0x26')](function(_0x3db4c2){if(_0x3db4c2){_0x3d1c11=_0x3db4c2;return _0x3db4c2['getFields']();}return null;})[_0x4ba3('0x26')](function(_0x4a8449){if(_0x4a8449){if(!_0x4a8449[_0x4ba3('0x3c')]){throw new db[(_0x4ba3('0x6d'))][(_0x4ba3('0x6e'))](_0x4ba3('0x9e'),0x193);}_0xa41747=_0x4a8449;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})[_0x4ba3('0x26')](function(_0xfaf98a){if(_0xfaf98a){_0x25c92c=_['keyBy'](_0xfaf98a,'id');var _0x30c904;var _0x267801=squel[_0x4ba3('0x70')]();_0x267801[_0x4ba3('0x71')](_0x3d1c11['table']);for(var _0x1bae1b=0x0;_0x1bae1b<_0xa41747[_0x4ba3('0x3c')];_0x1bae1b+=0x1){_0x30c904=_0xa41747[_0x1bae1b][_0x4ba3('0x73')]?_0x25c92c[_0xa41747[_0x1bae1b][_0x4ba3('0x73')]]['metric']:_0xa41747[_0x1bae1b][_0x4ba3('0x6a')];_0x30c904=_0xa41747[_0x1bae1b]['function']?_[_0x4ba3('0x76')](_0x2e812b[_0xa41747[_0x1bae1b][_0x4ba3('0x75')]],'%s',_0x30c904):_0x30c904;_0x30c904=_0xa41747[_0x1bae1b][_0x4ba3('0x77')]?_[_0x4ba3('0x76')](_0x5dc74f[_0xa41747[_0x1bae1b]['format']],'%s',_0x30c904):_0x30c904;if(_0xa41747[_0x1bae1b]['groupBy']){_0x267801[_0x4ba3('0x69')](_0x30c904);}_0xa41747[_0x1bae1b][_0x4ba3('0x79')]&&_0x267801[_0x4ba3('0x8d')](_0x30c904,_0xa41747[_0x1bae1b]['orderBy']==='DESC'?![]:!![]);_0x267801[_0x4ba3('0x6a')](_0x30c904,_0xa41747[_0x1bae1b][_0x4ba3('0x7b')]||_0x30c904);}if(_0x3d1c11[_0x4ba3('0x7c')]){_0x3d1c11[_0x4ba3('0x7c')]=JSON['parse'](_0x3d1c11[_0x4ba3('0x7c')]);for(var _0x2f4966=0x0;_0x2f4966<_0x3d1c11[_0x4ba3('0x7c')][_0x4ba3('0x3c')];_0x2f4966+=0x1){if(_0x3d1c11[_0x4ba3('0x7c')][_0x2f4966][_0x4ba3('0x33')]&&_[_0x4ba3('0x63')](_0x18bd77,_0x3d1c11[_0x4ba3('0x7c')][_0x2f4966][_0x4ba3('0x33')])&&_0x3d1c11[_0x4ba3('0x7c')][_0x2f4966][_0x4ba3('0x7e')]&&_0x3d1c11[_0x4ba3('0x7c')][_0x2f4966][_0x4ba3('0x80')]&&_0x3d1c11[_0x4ba3('0x7c')][_0x2f4966][_0x4ba3('0x7f')]){_0x267801[_0x3d1c11[_0x4ba3('0x7c')][_0x2f4966][_0x4ba3('0x33')]](_0x3d1c11[_0x4ba3('0x7c')][_0x2f4966]['foreignTable'],null,util[_0x4ba3('0x77')](_0x4ba3('0x81'),_0x3d1c11[_0x4ba3('0x72')],_0x3d1c11[_0x4ba3('0x7c')][_0x2f4966][_0x4ba3('0x7e')],_0x3d1c11[_0x4ba3('0x7c')][_0x2f4966]['foreignTable'],_0x3d1c11['joins'][_0x2f4966][_0x4ba3('0x7f')]));}}}if(_0x3d1c11[_0x4ba3('0x82')]){_0x3d1c11[_0x4ba3('0x82')]=JSON['parse'](_0x3d1c11[_0x4ba3('0x82')]);_0x267801[_0x4ba3('0x40')](_0x4d3262(_0x3d1c11[_0x4ba3('0x82')][_0x4ba3('0x69')]));}_0x225746=_0x267801[_0x4ba3('0x83')]();_0x267801[_0x4ba3('0x1f')](_0x25bf75);_0x267801[_0x4ba3('0x1e')](0x0);logger[_0x4ba3('0x84')](_0x4ba3('0x85'),_0x267801['toString']());return dbH[_0x4ba3('0x87')]['query'](_0x267801['toString'](),{'type':dbH[_0x4ba3('0x87')][_0x4ba3('0x9a')]['SELECT']});}})[_0x4ba3('0x26')](function(){return{'sql':_0x225746[_0x4ba3('0x86')]()};})[_0x4ba3('0x26')](respondWithResult(_0x41c531,null))[_0x4ba3('0x51')](handleError(_0x41c531,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index bb450f0..e8422d4 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 _0x879e=['../../config/environment','./analyticDefaultReport.attributes','define','AnalyticDefaultReport','analytics_default_reports','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x19a4f1,_0x4b88d4){var _0x407ddb=function(_0x417999){while(--_0x417999){_0x19a4f1['push'](_0x19a4f1['shift']());}};_0x407ddb(++_0x4b88d4);}(_0x879e,0x101));var _0xe879=function(_0x260e4b,_0x54668d){_0x260e4b=_0x260e4b-0x0;var _0x18dfba=_0x879e[_0x260e4b];return _0x18dfba;};'use strict';var _=require(_0xe879('0x0'));var util=require(_0xe879('0x1'));var logger=require(_0xe879('0x2'))(_0xe879('0x3'));var moment=require(_0xe879('0x4'));var BPromise=require(_0xe879('0x5'));var rp=require(_0xe879('0x6'));var fs=require('fs');var path=require(_0xe879('0x7'));var rimraf=require(_0xe879('0x8'));var config=require(_0xe879('0x9'));var attributes=require(_0xe879('0xa'));module['exports']=function(_0x50321a,_0x3f1362){return _0x50321a[_0xe879('0xb')](_0xe879('0xc'),attributes,{'tableName':_0xe879('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x835d=['../../config/environment','./analyticDefaultReport.attributes','AnalyticDefaultReport','analytics_default_reports','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf'];(function(_0x2a7205,_0x239d9f){var _0x481647=function(_0x254e1c){while(--_0x254e1c){_0x2a7205['push'](_0x2a7205['shift']());}};_0x481647(++_0x239d9f);}(_0x835d,0x122));var _0xd835=function(_0x56ff70,_0x23df34){_0x56ff70=_0x56ff70-0x0;var _0x1b5bc7=_0x835d[_0x56ff70];return _0x1b5bc7;};'use strict';var _=require(_0xd835('0x0'));var util=require(_0xd835('0x1'));var logger=require(_0xd835('0x2'))('api');var moment=require(_0xd835('0x3'));var BPromise=require(_0xd835('0x4'));var rp=require(_0xd835('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd835('0x6'));var config=require(_0xd835('0x7'));var attributes=require(_0xd835('0x8'));module['exports']=function(_0x2c2fbb,_0x263dd6){return _0x2c2fbb['define'](_0xd835('0x9'),attributes,{'tableName':_0xd835('0xa'),'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 6db932d..09337dd 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 _0x2450=['debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x2450,0x1aa));var _0x0245=function(_0x21ce8f,_0x532a31){_0x21ce8f=_0x21ce8f-0x0;var _0x388457=_0x2450[_0x21ce8f];return _0x388457;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x0245('0x0'));var BPromise=require(_0x0245('0x1'));var rs=require(_0x0245('0x2'));var fs=require('fs');var Redis=require(_0x0245('0x3'));var db=require(_0x0245('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x0245('0x5'))(_0x0245('0x6'));var config=require(_0x0245('0x7'));var jayson=require(_0x0245('0x8'));var client=jayson['client'][_0x0245('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xea9908,_0x3d4130,_0x41fd5d){return new BPromise(function(_0x386422,_0x58ca65){return client[_0x0245('0xa')](_0xea9908,_0x41fd5d)[_0x0245('0xb')](function(_0x33f4a3){logger[_0x0245('0xc')](_0x0245('0xd'),_0x3d4130,_0x0245('0xe'));logger[_0x0245('0xf')](_0x0245('0x10'),_0x3d4130,_0x0245('0xe'),JSON[_0x0245('0x11')](_0x33f4a3));if(_0x33f4a3[_0x0245('0x12')]){if(_0x33f4a3[_0x0245('0x12')]['code']===0x1f4){logger[_0x0245('0x12')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x3d4130,_0x33f4a3[_0x0245('0x12')][_0x0245('0x13')]);return _0x58ca65(_0x33f4a3['error'][_0x0245('0x13')]);}logger['error']('AnalyticDefaultReport,\x20%s,\x20%s',_0x3d4130,_0x33f4a3['error'][_0x0245('0x13')]);return _0x386422(_0x33f4a3['error'][_0x0245('0x13')]);}else{logger[_0x0245('0xc')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x3d4130,_0x0245('0xe'));_0x386422(_0x33f4a3['result'][_0x0245('0x13')]);}})[_0x0245('0x14')](function(_0x32dd01){logger['error'](_0x0245('0xd'),_0x3d4130,_0x32dd01);_0x58ca65(_0x32dd01);});});} \ No newline at end of file +var _0xf44f=['then','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request'];(function(_0x3e4d9a,_0x449a9f){var _0x4124d3=function(_0x3dd192){while(--_0x3dd192){_0x3e4d9a['push'](_0x3e4d9a['shift']());}};_0x4124d3(++_0x449a9f);}(_0xf44f,0x79));var _0xff44=function(_0xf2630a,_0x5dc787){_0xf2630a=_0xf2630a-0x0;var _0x22d19a=_0xf44f[_0xf2630a];return _0x22d19a;};'use strict';var _=require(_0xff44('0x0'));var util=require('util');var moment=require(_0xff44('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xff44('0x2'));var db=require(_0xff44('0x3'))['db'];var utils=require(_0xff44('0x4'));var logger=require(_0xff44('0x5'))(_0xff44('0x6'));var config=require('../../config/environment');var jayson=require(_0xff44('0x7'));var client=jayson[_0xff44('0x8')][_0xff44('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xff0341,_0x4d54c9,_0x4ace80){return new BPromise(function(_0x89afff,_0x28b991){return client[_0xff44('0xa')](_0xff0341,_0x4ace80)[_0xff44('0xb')](function(_0x35439f){logger['info'](_0xff44('0xc'),_0x4d54c9,_0xff44('0xd'));logger[_0xff44('0xe')](_0xff44('0xf'),_0x4d54c9,'request\x20sent',JSON[_0xff44('0x10')](_0x35439f));if(_0x35439f[_0xff44('0x11')]){if(_0x35439f[_0xff44('0x11')][_0xff44('0x12')]===0x1f4){logger[_0xff44('0x11')](_0xff44('0xc'),_0x4d54c9,_0x35439f['error'][_0xff44('0x13')]);return _0x28b991(_0x35439f[_0xff44('0x11')][_0xff44('0x13')]);}logger[_0xff44('0x11')](_0xff44('0xc'),_0x4d54c9,_0x35439f['error']['message']);return _0x89afff(_0x35439f[_0xff44('0x11')][_0xff44('0x13')]);}else{logger['info']('AnalyticDefaultReport,\x20%s,\x20%s',_0x4d54c9,'request\x20sent');_0x89afff(_0x35439f[_0xff44('0x14')][_0xff44('0x13')]);}})[_0xff44('0x15')](function(_0x3b1730){logger[_0xff44('0x11')](_0xff44('0xc'),_0x4d54c9,_0x3b1730);_0x28b991(_0x3b1730);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index e270b44..2e3a7c4 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 _0x600f=['put','update','delete','destroy','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','get','isAuthenticated','index','/:id','show','/:id/preview','preview','run','/:id/query','query','create'];(function(_0x41a073,_0x3ea9e2){var _0x4b2c53=function(_0xa609ae){while(--_0xa609ae){_0x41a073['push'](_0x41a073['shift']());}};_0x4b2c53(++_0x3ea9e2);}(_0x600f,0xb4));var _0xf600=function(_0x4e7c2,_0x3b3347){_0x4e7c2=_0x4e7c2-0x0;var _0x84bb35=_0x600f[_0x4e7c2];return _0x84bb35;};'use strict';var multer=require(_0xf600('0x0'));var util=require(_0xf600('0x1'));var path=require(_0xf600('0x2'));var timeout=require('connect-timeout');var express=require(_0xf600('0x3'));var router=express['Router']();var fs_extra=require(_0xf600('0x4'));var auth=require(_0xf600('0x5'));var interaction=require(_0xf600('0x6'));var config=require(_0xf600('0x7'));var controller=require(_0xf600('0x8'));router[_0xf600('0x9')]('/',auth[_0xf600('0xa')](),controller[_0xf600('0xb')]);router['get'](_0xf600('0xc'),auth['isAuthenticated'](),controller[_0xf600('0xd')]);router['get'](_0xf600('0xe'),auth[_0xf600('0xa')](),controller[_0xf600('0xf')]);router[_0xf600('0x9')]('/:id/run',auth[_0xf600('0xa')](),controller[_0xf600('0x10')]);router[_0xf600('0x9')](_0xf600('0x11'),auth['isAuthenticated'](),controller[_0xf600('0x12')]);router['post']('/',auth[_0xf600('0xa')](),controller[_0xf600('0x13')]);router[_0xf600('0x14')](_0xf600('0xc'),auth[_0xf600('0xa')](),controller[_0xf600('0x15')]);router[_0xf600('0x16')](_0xf600('0xc'),auth['isAuthenticated'](),controller[_0xf600('0x17')]);module[_0xf600('0x18')]=router; \ No newline at end of file +var _0xb435=['get','isAuthenticated','/:id','show','/:id/preview','preview','/:id/run','/:id/query','query','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xb435,0x19f));var _0x5b43=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xb435[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x5b43('0x0'));var util=require(_0x5b43('0x1'));var path=require(_0x5b43('0x2'));var timeout=require(_0x5b43('0x3'));var express=require(_0x5b43('0x4'));var router=express[_0x5b43('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x5b43('0x6'));var interaction=require(_0x5b43('0x7'));var config=require(_0x5b43('0x8'));var controller=require(_0x5b43('0x9'));router[_0x5b43('0xa')]('/',auth[_0x5b43('0xb')](),controller['index']);router[_0x5b43('0xa')](_0x5b43('0xc'),auth[_0x5b43('0xb')](),controller[_0x5b43('0xd')]);router[_0x5b43('0xa')](_0x5b43('0xe'),auth[_0x5b43('0xb')](),controller[_0x5b43('0xf')]);router[_0x5b43('0xa')](_0x5b43('0x10'),auth['isAuthenticated'](),controller['run']);router['get'](_0x5b43('0x11'),auth[_0x5b43('0xb')](),controller[_0x5b43('0x12')]);router['post']('/',auth[_0x5b43('0xb')](),controller[_0x5b43('0x13')]);router[_0x5b43('0x14')](_0x5b43('0xc'),auth[_0x5b43('0xb')](),controller[_0x5b43('0x15')]);router[_0x5b43('0x16')](_0x5b43('0xc'),auth[_0x5b43('0xb')](),controller[_0x5b43('0x17')]);module[_0x5b43('0x18')]=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index 2c39769..00242cb 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 _0xaba2=['xlsx','csv','DATE','Loading','manual','INTEGER','sequelize','moment','STRING','ENUM','pdf'];(function(_0x159201,_0x2c30dc){var _0x22ec65=function(_0x3299dc){while(--_0x3299dc){_0x159201['push'](_0x159201['shift']());}};_0x22ec65(++_0x2c30dc);}(_0xaba2,0x171));var _0x2aba=function(_0x5ec961,_0x4d2dbd){_0x5ec961=_0x5ec961-0x0;var _0x321535=_0xaba2[_0x5ec961];return _0x321535;};'use strict';var Sequelize=require(_0x2aba('0x0'));var moment=require(_0x2aba('0x1'));module['exports']={'name':{'type':Sequelize[_0x2aba('0x2')],'allowNull':![]},'basename':{'type':Sequelize['STRING'],'allowNull':![]},'output':{'type':Sequelize[_0x2aba('0x3')]('csv',_0x2aba('0x4'),_0x2aba('0x5')),'allowNull':![],'defaultValue':_0x2aba('0x6')},'savename':{'type':Sequelize[_0x2aba('0x2')],'allowNull':![]},'startDate':{'type':Sequelize[_0x2aba('0x7')]},'endDate':{'type':Sequelize[_0x2aba('0x7')]},'status':{'type':Sequelize[_0x2aba('0x2')],'defaultValue':_0x2aba('0x8')},'type':{'type':Sequelize[_0x2aba('0x3')](_0x2aba('0x9'),'scheduled'),'allowNull':![],'defaultValue':'manual'},'reportId':{'type':Sequelize[_0x2aba('0xa')](0xb)['UNSIGNED']},'reportType':{'type':Sequelize[_0x2aba('0x2')]}}; \ No newline at end of file +var _0xba9e=['STRING','ENUM','csv','xlsx','Loading','manual','scheduled','UNSIGNED','moment','exports'];(function(_0x1deb03,_0xd05ad8){var _0x189fe7=function(_0x321225){while(--_0x321225){_0x1deb03['push'](_0x1deb03['shift']());}};_0x189fe7(++_0xd05ad8);}(_0xba9e,0x152));var _0xeba9=function(_0x385289,_0x34c332){_0x385289=_0x385289-0x0;var _0x105204=_0xba9e[_0x385289];return _0x105204;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xeba9('0x0'));module[_0xeba9('0x1')]={'name':{'type':Sequelize[_0xeba9('0x2')],'allowNull':![]},'basename':{'type':Sequelize['STRING'],'allowNull':![]},'output':{'type':Sequelize[_0xeba9('0x3')](_0xeba9('0x4'),'pdf',_0xeba9('0x5')),'allowNull':![],'defaultValue':'csv'},'savename':{'type':Sequelize[_0xeba9('0x2')],'allowNull':![]},'startDate':{'type':Sequelize['DATE']},'endDate':{'type':Sequelize['DATE']},'status':{'type':Sequelize['STRING'],'defaultValue':_0xeba9('0x6')},'type':{'type':Sequelize['ENUM'](_0xeba9('0x7'),_0xeba9('0x8')),'allowNull':![],'defaultValue':_0xeba9('0x7')},'reportId':{'type':Sequelize['INTEGER'](0xb)[_0xeba9('0x9')]},'reportType':{'type':Sequelize[_0xeba9('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index 9c6fc74..d220672 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 _0xf489=['exists','format','output','toLowerCase','eml-format','rimraf','zip-dir','request-promise','mustache','util','path','sox','ejs','squel','crypto','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','end','stack','name','index','map','AnalyticExtractedReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','include','catch','create','body','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','basename','existsSync','join','root','server/files/reports','savename','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty'];(function(_0x21b359,_0x4dc80e){var _0x57b8e7=function(_0x135adb){while(--_0x135adb){_0x21b359['push'](_0x21b359['shift']());}};_0x57b8e7(++_0x4dc80e);}(_0xf489,0x11b));var _0x9f48=function(_0x3a6620,_0x33706f){_0x3a6620=_0x3a6620-0x0;var _0x4f3254=_0xf489[_0x3a6620];return _0x4f3254;};'use strict';var emlformat=require(_0x9f48('0x0'));var rimraf=require(_0x9f48('0x1'));var zipdir=require(_0x9f48('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9f48('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x9f48('0x4'));var util=require(_0x9f48('0x5'));var path=require(_0x9f48('0x6'));var sox=require(_0x9f48('0x7'));var csv=require('to-csv');var ejs=require(_0x9f48('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x9f48('0x9'));var crypto=require(_0x9f48('0xa'));var jsforce=require(_0x9f48('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x9f48('0xc'));var querystring=require(_0x9f48('0xd'));var Papa=require('papaparse');var Redis=require(_0x9f48('0xe'));var authService=require(_0x9f48('0xf'));var qs=require(_0x9f48('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9f48('0x11'));var logger=require(_0x9f48('0x12'))(_0x9f48('0x13'));var utils=require(_0x9f48('0x14'));var config=require(_0x9f48('0x15'));var licenseUtil=require(_0x9f48('0x16'));var db=require(_0x9f48('0x17'))['db'];function respondWithStatusCode(_0x5cd84b,_0x1038cc){_0x1038cc=_0x1038cc||0xcc;return function(_0x3d8662){if(_0x3d8662){return _0x5cd84b[_0x9f48('0x18')](_0x1038cc);}return _0x5cd84b[_0x9f48('0x19')](_0x1038cc)['end']();};}function respondWithResult(_0x3b7e7b,_0x2952c1){_0x2952c1=_0x2952c1||0xc8;return function(_0xa298e3){if(_0xa298e3){return _0x3b7e7b[_0x9f48('0x19')](_0x2952c1)[_0x9f48('0x1a')](_0xa298e3);}};}function respondWithFilteredResult(_0x45437b,_0x58bb1f){return function(_0x5c589e){if(_0x5c589e){var _0x59695e=typeof _0x58bb1f[_0x9f48('0x1b')]===_0x9f48('0x1c')&&typeof _0x58bb1f['limit']==='undefined';var _0x29a6fb=_0x5c589e[_0x9f48('0x1d')];var _0x106093=_0x59695e?0x0:_0x58bb1f[_0x9f48('0x1b')];var _0x58beee=_0x59695e?_0x5c589e[_0x9f48('0x1d')]:_0x58bb1f[_0x9f48('0x1b')]+_0x58bb1f[_0x9f48('0x1e')];var _0x5816e0;if(_0x58beee>=_0x29a6fb){_0x58beee=_0x29a6fb;_0x5816e0=0xc8;}else{_0x5816e0=0xce;}_0x45437b[_0x9f48('0x19')](_0x5816e0);return _0x45437b[_0x9f48('0x1f')](_0x9f48('0x20'),_0x106093+'-'+_0x58beee+'/'+_0x29a6fb)[_0x9f48('0x1a')](_0x5c589e);}return null;};}function patchUpdates(_0x51983b){return function(_0x34f778){try{jsonpatch[_0x9f48('0x21')](_0x34f778,_0x51983b,!![]);}catch(_0x8bb082){return BPromise[_0x9f48('0x22')](_0x8bb082);}return _0x34f778[_0x9f48('0x23')]();};}function saveUpdates(_0x51756e,_0x16e22c){return function(_0x19c344){if(_0x19c344){return _0x19c344[_0x9f48('0x24')](_0x51756e)[_0x9f48('0x25')](function(_0x3e09bc){return _0x3e09bc;});}return null;};}function removeEntity(_0x41fd05,_0x26a187){return function(_0x301fce){if(_0x301fce){return _0x301fce[_0x9f48('0x26')]()[_0x9f48('0x25')](function(){var _0x52f6c1=_0x301fce[_0x9f48('0x27')]({'plain':!![]});var _0x346fe5='ExtractedReports';return db['UserProfileResource'][_0x9f48('0x26')]({'where':{'type':_0x346fe5,'resourceId':_0x52f6c1['id']}})[_0x9f48('0x25')](function(){return _0x301fce;});})[_0x9f48('0x25')](function(){_0x41fd05[_0x9f48('0x19')](0xcc)[_0x9f48('0x28')]();});}};}function handleEntityNotFound(_0x3d8add,_0x497c29){return function(_0x16c9c1){if(!_0x16c9c1){_0x3d8add[_0x9f48('0x18')](0x194);}return _0x16c9c1;};}function handleError(_0x4bcb7c,_0x3599f6){_0x3599f6=_0x3599f6||0x1f4;return function(_0x29070b){logger['error'](_0x29070b[_0x9f48('0x29')]);if(_0x29070b[_0x9f48('0x2a')]){delete _0x29070b[_0x9f48('0x2a')];}_0x4bcb7c[_0x9f48('0x19')](_0x3599f6)['send'](_0x29070b);};}exports[_0x9f48('0x2b')]=function(_0x363c39,_0x2a6066){var _0x44bdc6={},_0x3b75ef={},_0x57b8b6={'count':0x0,'rows':[]};var _0x7c2160=_[_0x9f48('0x2c')](db[_0x9f48('0x2d')][_0x9f48('0x2e')],function(_0x4a7043){return{'name':_0x4a7043[_0x9f48('0x2f')],'type':_0x4a7043[_0x9f48('0x30')]['key']};});_0x3b75ef[_0x9f48('0x31')]=_[_0x9f48('0x2c')](_0x7c2160,'name');_0x3b75ef[_0x9f48('0x32')]=_[_0x9f48('0x33')](_0x363c39[_0x9f48('0x32')]);_0x3b75ef[_0x9f48('0x34')]=_[_0x9f48('0x35')](_0x3b75ef['model'],_0x3b75ef[_0x9f48('0x32')]);_0x44bdc6['attributes']=_['intersection'](_0x3b75ef[_0x9f48('0x31')],qs[_0x9f48('0x36')](_0x363c39[_0x9f48('0x32')][_0x9f48('0x36')]));_0x44bdc6[_0x9f48('0x37')]=_0x44bdc6['attributes']['length']?_0x44bdc6[_0x9f48('0x37')]:_0x3b75ef[_0x9f48('0x31')];if(!_0x363c39[_0x9f48('0x32')][_0x9f48('0x38')]('nolimit')){_0x44bdc6[_0x9f48('0x1e')]=qs['limit'](_0x363c39[_0x9f48('0x32')][_0x9f48('0x1e')]);_0x44bdc6[_0x9f48('0x1b')]=qs[_0x9f48('0x1b')](_0x363c39[_0x9f48('0x32')]['offset']);}_0x44bdc6[_0x9f48('0x39')]=qs[_0x9f48('0x3a')](_0x363c39['query']['sort']);_0x44bdc6[_0x9f48('0x3b')]=qs['filters'](_[_0x9f48('0x3c')](_0x363c39[_0x9f48('0x32')],_0x3b75ef[_0x9f48('0x34')]),_0x7c2160);if(_0x363c39[_0x9f48('0x32')][_0x9f48('0x3d')]){_0x44bdc6[_0x9f48('0x3b')]=_[_0x9f48('0x3e')](_0x44bdc6[_0x9f48('0x3b')],{'$or':_['map'](_0x7c2160,function(_0x231d33){if(_0x231d33[_0x9f48('0x30')]!==_0x9f48('0x3f')){var _0x29c47d={};_0x29c47d[_0x231d33[_0x9f48('0x2a')]]={'$like':'%'+_0x363c39[_0x9f48('0x32')][_0x9f48('0x3d')]+'%'};return _0x29c47d;}})});}_0x44bdc6=_[_0x9f48('0x3e')]({},_0x44bdc6,_0x363c39[_0x9f48('0x40')]);var _0x5f43a7={'where':_0x44bdc6[_0x9f48('0x3b')]};return db['AnalyticExtractedReport']['count'](_0x5f43a7)[_0x9f48('0x25')](function(_0xb32659){_0x57b8b6[_0x9f48('0x1d')]=_0xb32659;if(_0x363c39['query'][_0x9f48('0x41')]){_0x44bdc6['include']=[{'all':!![]}];}return db[_0x9f48('0x2d')][_0x9f48('0x42')](_0x44bdc6);})[_0x9f48('0x25')](function(_0x44887c){_0x57b8b6[_0x9f48('0x43')]=_0x44887c;return _0x57b8b6;})[_0x9f48('0x25')](respondWithFilteredResult(_0x2a6066,_0x44bdc6))['catch'](handleError(_0x2a6066,null));};exports[_0x9f48('0x44')]=function(_0x230e57,_0x1af1c9){var _0x1b3c98={'raw':!![],'where':{'id':_0x230e57[_0x9f48('0x45')]['id']}},_0x1404c3={};_0x1404c3[_0x9f48('0x31')]=_['keys'](db[_0x9f48('0x2d')][_0x9f48('0x2e')]);_0x1404c3['query']=_[_0x9f48('0x33')](_0x230e57['query']);_0x1404c3['filters']=_[_0x9f48('0x35')](_0x1404c3[_0x9f48('0x31')],_0x1404c3[_0x9f48('0x32')]);_0x1b3c98[_0x9f48('0x37')]=_[_0x9f48('0x35')](_0x1404c3[_0x9f48('0x31')],qs['fields'](_0x230e57['query'][_0x9f48('0x36')]));_0x1b3c98['attributes']=_0x1b3c98['attributes']['length']?_0x1b3c98[_0x9f48('0x37')]:_0x1404c3[_0x9f48('0x31')];if(_0x230e57[_0x9f48('0x32')]['includeAll']){_0x1b3c98[_0x9f48('0x46')]=[{'all':!![]}];}_0x1b3c98=_['merge']({},_0x1b3c98,_0x230e57[_0x9f48('0x40')]);return db['AnalyticExtractedReport']['find'](_0x1b3c98)[_0x9f48('0x25')](handleEntityNotFound(_0x1af1c9,null))[_0x9f48('0x25')](respondWithResult(_0x1af1c9,null))[_0x9f48('0x47')](handleError(_0x1af1c9,null));};exports[_0x9f48('0x48')]=function(_0x451e0e,_0x190e29){return db[_0x9f48('0x2d')][_0x9f48('0x48')](_0x451e0e[_0x9f48('0x49')],{})[_0x9f48('0x25')](function(_0x1a527d){var _0x3597bc=_0x451e0e[_0x9f48('0x4a')][_0x9f48('0x27')]({'plain':!![]});if(!_0x3597bc)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3597bc['role']===_0x9f48('0x4a')){var _0x4f48c9=_0x1a527d[_0x9f48('0x27')]({'plain':!![]});var _0x20cedd='ExtractedReports';return db[_0x9f48('0x4b')]['find']({'where':{'name':_0x20cedd,'userProfileId':_0x3597bc[_0x9f48('0x4c')]},'raw':!![]})[_0x9f48('0x25')](function(_0x5819b6){if(_0x5819b6&&_0x5819b6[_0x9f48('0x4d')]===0x0){return db['UserProfileResource'][_0x9f48('0x48')]({'name':_0x4f48c9['name'],'resourceId':_0x4f48c9['id'],'type':_0x5819b6['name'],'sectionId':_0x5819b6['id']},{})[_0x9f48('0x25')](function(){return _0x1a527d;});}else{return _0x1a527d;}})[_0x9f48('0x47')](function(_0x23d428){logger['error'](_0x9f48('0x4e'),_0x23d428);throw _0x23d428;});}return _0x1a527d;})[_0x9f48('0x25')](respondWithResult(_0x190e29,0xc9))[_0x9f48('0x47')](handleError(_0x190e29,null));};exports['update']=function(_0x47aff9,_0x1ccff0){if(_0x47aff9[_0x9f48('0x49')]['id']){delete _0x47aff9['body']['id'];}return db[_0x9f48('0x2d')][_0x9f48('0x4f')]({'where':{'id':_0x47aff9[_0x9f48('0x45')]['id']}})[_0x9f48('0x25')](handleEntityNotFound(_0x1ccff0,null))[_0x9f48('0x25')](saveUpdates(_0x47aff9[_0x9f48('0x49')],null))[_0x9f48('0x25')](respondWithResult(_0x1ccff0,null))[_0x9f48('0x47')](handleError(_0x1ccff0,null));};exports[_0x9f48('0x26')]=function(_0x2995fb,_0x273466){return db[_0x9f48('0x2d')][_0x9f48('0x4f')]({'where':{'id':_0x2995fb[_0x9f48('0x45')]['id']}})['then'](handleEntityNotFound(_0x273466,null))[_0x9f48('0x25')](removeEntity(_0x273466,null))['catch'](handleError(_0x273466,null));};exports['download']=function(_0x481807,_0x8d86ed,_0x563798){return db[_0x9f48('0x2d')]['find']({'where':{'id':_0x481807[_0x9f48('0x45')]['id']},'attributes':[_0x9f48('0x2a'),_0x9f48('0x50'),'savename','output'],'raw':!![]})[_0x9f48('0x25')](handleEntityNotFound(_0x8d86ed,null))[_0x9f48('0x25')](function(_0x4633c7){if(_0x4633c7){if(!fs[_0x9f48('0x51')](path[_0x9f48('0x52')](config[_0x9f48('0x53')],_0x9f48('0x54'),_0x4633c7[_0x9f48('0x55')]))){throw new db[(_0x9f48('0x56'))][(_0x9f48('0x57'))](_0x9f48('0x58'));}if(_0x481807[_0x9f48('0x32')][_0x9f48('0x59')]){return _0x8d86ed[_0x9f48('0x18')](0xc8);}return _0x8d86ed['download'](path[_0x9f48('0x52')](config[_0x9f48('0x53')],_0x9f48('0x54'),_0x4633c7[_0x9f48('0x55')]),util[_0x9f48('0x5a')]('%s.%s',_0x4633c7['basename']||_0x4633c7['name'],_0x4633c7[_0x9f48('0x5b')][_0x9f48('0x5c')]()));}})[_0x9f48('0x47')](handleError(_0x8d86ed,null));}; \ No newline at end of file +var _0x06f2=['autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','download','basename','savename','existsSync','join','root','server/files/reports','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','%s.%s','output','toLowerCase','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','destroy','get','ExtractedReports','UserProfileResource','then','error','send','map','AnalyticExtractedReport','fieldName','key','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','pick','filter','where','type','VIRTUAL','merge','include','findAll','rows','catch','show','params','rawAttributes','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId'];(function(_0x3bd52b,_0xbbc735){var _0x1e5b89=function(_0x29ccc3){while(--_0x29ccc3){_0x3bd52b['push'](_0x3bd52b['shift']());}};_0x1e5b89(++_0xbbc735);}(_0x06f2,0x190));var _0x206f=function(_0xfeb962,_0x4ec79f){_0xfeb962=_0xfeb962-0x0;var _0x56c680=_0x06f2[_0xfeb962];return _0x56c680;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x206f('0x0'));var rp=require(_0x206f('0x1'));var moment=require('moment');var BPromise=require(_0x206f('0x2'));var Mustache=require('mustache');var util=require(_0x206f('0x3'));var path=require(_0x206f('0x4'));var sox=require(_0x206f('0x5'));var csv=require(_0x206f('0x6'));var ejs=require(_0x206f('0x7'));var fs=require('fs');var fs_extra=require(_0x206f('0x8'));var _=require(_0x206f('0x9'));var squel=require(_0x206f('0xa'));var crypto=require(_0x206f('0xb'));var jsforce=require(_0x206f('0xc'));var deskjs=require(_0x206f('0xd'));var toCsv=require(_0x206f('0x6'));var querystring=require(_0x206f('0xe'));var Papa=require(_0x206f('0xf'));var Redis=require('ioredis');var authService=require(_0x206f('0x10'));var qs=require(_0x206f('0x11'));var as=require(_0x206f('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x206f('0x13'))(_0x206f('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x206f('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1db71f,_0x3d1056){_0x3d1056=_0x3d1056||0xcc;return function(_0x3a3628){if(_0x3a3628){return _0x1db71f[_0x206f('0x16')](_0x3d1056);}return _0x1db71f[_0x206f('0x17')](_0x3d1056)[_0x206f('0x18')]();};}function respondWithResult(_0x40e19e,_0x10a5d7){_0x10a5d7=_0x10a5d7||0xc8;return function(_0x2a5d39){if(_0x2a5d39){return _0x40e19e['status'](_0x10a5d7)[_0x206f('0x19')](_0x2a5d39);}};}function respondWithFilteredResult(_0xba05a7,_0x3b968b){return function(_0x101c15){if(_0x101c15){var _0x1adfc6=typeof _0x3b968b['offset']===_0x206f('0x1a')&&typeof _0x3b968b[_0x206f('0x1b')]===_0x206f('0x1a');var _0x2d4177=_0x101c15[_0x206f('0x1c')];var _0x54372a=_0x1adfc6?0x0:_0x3b968b[_0x206f('0x1d')];var _0x25ea2f=_0x1adfc6?_0x101c15[_0x206f('0x1c')]:_0x3b968b['offset']+_0x3b968b[_0x206f('0x1b')];var _0x510fa2;if(_0x25ea2f>=_0x2d4177){_0x25ea2f=_0x2d4177;_0x510fa2=0xc8;}else{_0x510fa2=0xce;}_0xba05a7[_0x206f('0x17')](_0x510fa2);return _0xba05a7[_0x206f('0x1e')](_0x206f('0x1f'),_0x54372a+'-'+_0x25ea2f+'/'+_0x2d4177)[_0x206f('0x19')](_0x101c15);}return null;};}function patchUpdates(_0x3ea25f){return function(_0x1b363e){try{jsonpatch[_0x206f('0x20')](_0x1b363e,_0x3ea25f,!![]);}catch(_0x3aa62a){return BPromise[_0x206f('0x21')](_0x3aa62a);}return _0x1b363e[_0x206f('0x22')]();};}function saveUpdates(_0x46af3d,_0x18655d){return function(_0x462197){if(_0x462197){return _0x462197[_0x206f('0x23')](_0x46af3d)['then'](function(_0x47d1b2){return _0x47d1b2;});}return null;};}function removeEntity(_0x32c29a,_0x2c68d8){return function(_0x15e20a){if(_0x15e20a){return _0x15e20a[_0x206f('0x24')]()['then'](function(){var _0x1b9c3d=_0x15e20a[_0x206f('0x25')]({'plain':!![]});var _0x589cc5=_0x206f('0x26');return db[_0x206f('0x27')][_0x206f('0x24')]({'where':{'type':_0x589cc5,'resourceId':_0x1b9c3d['id']}})[_0x206f('0x28')](function(){return _0x15e20a;});})[_0x206f('0x28')](function(){_0x32c29a[_0x206f('0x17')](0xcc)[_0x206f('0x18')]();});}};}function handleEntityNotFound(_0x1b9bf8,_0xc63f86){return function(_0x186288){if(!_0x186288){_0x1b9bf8[_0x206f('0x16')](0x194);}return _0x186288;};}function handleError(_0x46a06a,_0xd1b704){_0xd1b704=_0xd1b704||0x1f4;return function(_0x3ca575){logger[_0x206f('0x29')](_0x3ca575['stack']);if(_0x3ca575['name']){delete _0x3ca575['name'];}_0x46a06a[_0x206f('0x17')](_0xd1b704)[_0x206f('0x2a')](_0x3ca575);};}exports['index']=function(_0x1004f1,_0x15b3f5){var _0x4a26c8={},_0x5a119d={},_0x30ce5c={'count':0x0,'rows':[]};var _0x7c0e35=_[_0x206f('0x2b')](db[_0x206f('0x2c')]['rawAttributes'],function(_0x151787){return{'name':_0x151787[_0x206f('0x2d')],'type':_0x151787['type'][_0x206f('0x2e')]};});_0x5a119d[_0x206f('0x2f')]=_[_0x206f('0x2b')](_0x7c0e35,_0x206f('0x30'));_0x5a119d[_0x206f('0x31')]=_[_0x206f('0x32')](_0x1004f1[_0x206f('0x31')]);_0x5a119d[_0x206f('0x33')]=_[_0x206f('0x34')](_0x5a119d['model'],_0x5a119d[_0x206f('0x31')]);_0x4a26c8[_0x206f('0x35')]=_[_0x206f('0x34')](_0x5a119d['model'],qs[_0x206f('0x36')](_0x1004f1[_0x206f('0x31')][_0x206f('0x36')]));_0x4a26c8[_0x206f('0x35')]=_0x4a26c8[_0x206f('0x35')][_0x206f('0x37')]?_0x4a26c8['attributes']:_0x5a119d[_0x206f('0x2f')];if(!_0x1004f1[_0x206f('0x31')][_0x206f('0x38')]('nolimit')){_0x4a26c8['limit']=qs[_0x206f('0x1b')](_0x1004f1['query'][_0x206f('0x1b')]);_0x4a26c8[_0x206f('0x1d')]=qs['offset'](_0x1004f1[_0x206f('0x31')][_0x206f('0x1d')]);}_0x4a26c8['order']=qs['sort'](_0x1004f1[_0x206f('0x31')][_0x206f('0x39')]);_0x4a26c8['where']=qs[_0x206f('0x33')](_[_0x206f('0x3a')](_0x1004f1[_0x206f('0x31')],_0x5a119d[_0x206f('0x33')]),_0x7c0e35);if(_0x1004f1[_0x206f('0x31')][_0x206f('0x3b')]){_0x4a26c8[_0x206f('0x3c')]=_['merge'](_0x4a26c8[_0x206f('0x3c')],{'$or':_[_0x206f('0x2b')](_0x7c0e35,function(_0x4d2932){if(_0x4d2932[_0x206f('0x3d')]!==_0x206f('0x3e')){var _0x4dd889={};_0x4dd889[_0x4d2932[_0x206f('0x30')]]={'$like':'%'+_0x1004f1['query'][_0x206f('0x3b')]+'%'};return _0x4dd889;}})});}_0x4a26c8=_[_0x206f('0x3f')]({},_0x4a26c8,_0x1004f1['options']);var _0x508e44={'where':_0x4a26c8[_0x206f('0x3c')]};return db[_0x206f('0x2c')][_0x206f('0x1c')](_0x508e44)[_0x206f('0x28')](function(_0x264be1){_0x30ce5c[_0x206f('0x1c')]=_0x264be1;if(_0x1004f1['query']['includeAll']){_0x4a26c8[_0x206f('0x40')]=[{'all':!![]}];}return db['AnalyticExtractedReport'][_0x206f('0x41')](_0x4a26c8);})[_0x206f('0x28')](function(_0x51afd5){_0x30ce5c[_0x206f('0x42')]=_0x51afd5;return _0x30ce5c;})[_0x206f('0x28')](respondWithFilteredResult(_0x15b3f5,_0x4a26c8))[_0x206f('0x43')](handleError(_0x15b3f5,null));};exports[_0x206f('0x44')]=function(_0x5551fe,_0x3a94c7){var _0x365d87={'raw':!![],'where':{'id':_0x5551fe[_0x206f('0x45')]['id']}},_0x46ce96={};_0x46ce96[_0x206f('0x2f')]=_[_0x206f('0x32')](db['AnalyticExtractedReport'][_0x206f('0x46')]);_0x46ce96['query']=_[_0x206f('0x32')](_0x5551fe[_0x206f('0x31')]);_0x46ce96['filters']=_[_0x206f('0x34')](_0x46ce96[_0x206f('0x2f')],_0x46ce96[_0x206f('0x31')]);_0x365d87[_0x206f('0x35')]=_[_0x206f('0x34')](_0x46ce96['model'],qs[_0x206f('0x36')](_0x5551fe[_0x206f('0x31')][_0x206f('0x36')]));_0x365d87[_0x206f('0x35')]=_0x365d87[_0x206f('0x35')][_0x206f('0x37')]?_0x365d87[_0x206f('0x35')]:_0x46ce96[_0x206f('0x2f')];if(_0x5551fe['query'][_0x206f('0x47')]){_0x365d87[_0x206f('0x40')]=[{'all':!![]}];}_0x365d87=_[_0x206f('0x3f')]({},_0x365d87,_0x5551fe['options']);return db['AnalyticExtractedReport'][_0x206f('0x48')](_0x365d87)[_0x206f('0x28')](handleEntityNotFound(_0x3a94c7,null))[_0x206f('0x28')](respondWithResult(_0x3a94c7,null))[_0x206f('0x43')](handleError(_0x3a94c7,null));};exports[_0x206f('0x49')]=function(_0x1f5e83,_0x4d8e48){return db[_0x206f('0x2c')][_0x206f('0x49')](_0x1f5e83[_0x206f('0x4a')],{})[_0x206f('0x28')](function(_0xe5214){var _0x197831=_0x1f5e83[_0x206f('0x4b')][_0x206f('0x25')]({'plain':!![]});if(!_0x197831)throw new Error(_0x206f('0x4c'));if(_0x197831[_0x206f('0x4d')]===_0x206f('0x4b')){var _0x4957c5=_0xe5214[_0x206f('0x25')]({'plain':!![]});var _0x34a0b8=_0x206f('0x26');return db[_0x206f('0x4e')][_0x206f('0x48')]({'where':{'name':_0x34a0b8,'userProfileId':_0x197831[_0x206f('0x4f')]},'raw':!![]})[_0x206f('0x28')](function(_0x370712){if(_0x370712&&_0x370712[_0x206f('0x50')]===0x0){return db['UserProfileResource']['create']({'name':_0x4957c5['name'],'resourceId':_0x4957c5['id'],'type':_0x370712[_0x206f('0x30')],'sectionId':_0x370712['id']},{})[_0x206f('0x28')](function(){return _0xe5214;});}else{return _0xe5214;}})[_0x206f('0x43')](function(_0x5d89d5){logger[_0x206f('0x29')](_0x206f('0x51'),_0x5d89d5);throw _0x5d89d5;});}return _0xe5214;})[_0x206f('0x28')](respondWithResult(_0x4d8e48,0xc9))['catch'](handleError(_0x4d8e48,null));};exports[_0x206f('0x23')]=function(_0x4a8b5b,_0xf21b99){if(_0x4a8b5b['body']['id']){delete _0x4a8b5b[_0x206f('0x4a')]['id'];}return db[_0x206f('0x2c')][_0x206f('0x48')]({'where':{'id':_0x4a8b5b[_0x206f('0x45')]['id']}})[_0x206f('0x28')](handleEntityNotFound(_0xf21b99,null))[_0x206f('0x28')](saveUpdates(_0x4a8b5b[_0x206f('0x4a')],null))[_0x206f('0x28')](respondWithResult(_0xf21b99,null))[_0x206f('0x43')](handleError(_0xf21b99,null));};exports['destroy']=function(_0x370770,_0x1433f8){return db[_0x206f('0x2c')]['find']({'where':{'id':_0x370770[_0x206f('0x45')]['id']}})[_0x206f('0x28')](handleEntityNotFound(_0x1433f8,null))[_0x206f('0x28')](removeEntity(_0x1433f8,null))['catch'](handleError(_0x1433f8,null));};exports[_0x206f('0x52')]=function(_0xbe6bc1,_0x42777d,_0x1d5a2a){return db[_0x206f('0x2c')][_0x206f('0x48')]({'where':{'id':_0xbe6bc1[_0x206f('0x45')]['id']},'attributes':[_0x206f('0x30'),_0x206f('0x53'),_0x206f('0x54'),'output'],'raw':!![]})['then'](handleEntityNotFound(_0x42777d,null))[_0x206f('0x28')](function(_0x2911ec){if(_0x2911ec){if(!fs[_0x206f('0x55')](path[_0x206f('0x56')](config[_0x206f('0x57')],_0x206f('0x58'),_0x2911ec[_0x206f('0x54')]))){throw new db[(_0x206f('0x59'))][(_0x206f('0x5a'))](_0x206f('0x5b'));}if(_0xbe6bc1[_0x206f('0x31')][_0x206f('0x5c')]){return _0x42777d[_0x206f('0x16')](0xc8);}return _0x42777d['download'](path['join'](config[_0x206f('0x57')],_0x206f('0x58'),_0x2911ec[_0x206f('0x54')]),util['format'](_0x206f('0x5d'),_0x2911ec[_0x206f('0x53')]||_0x2911ec[_0x206f('0x30')],_0x2911ec[_0x206f('0x5e')][_0x206f('0x5f')]()));}})['catch'](handleError(_0x42777d,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index 823adab..756da26 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 _0x166a=['rimraf','../../config/environment','./analyticExtractedReport.attributes','define','AnalyticExtractedReport','analytics_extracted_reports','lodash','util','../../config/logger','api','bluebird','path'];(function(_0xba457,_0x562878){var _0x2b96a1=function(_0x1884a5){while(--_0x1884a5){_0xba457['push'](_0xba457['shift']());}};_0x2b96a1(++_0x562878);}(_0x166a,0x1aa));var _0xa166=function(_0xc0b764,_0x400420){_0xc0b764=_0xc0b764-0x0;var _0x4212f7=_0x166a[_0xc0b764];return _0x4212f7;};'use strict';var _=require(_0xa166('0x0'));var util=require(_0xa166('0x1'));var logger=require(_0xa166('0x2'))(_0xa166('0x3'));var moment=require('moment');var BPromise=require(_0xa166('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa166('0x5'));var rimraf=require(_0xa166('0x6'));var config=require(_0xa166('0x7'));var attributes=require(_0xa166('0x8'));module['exports']=function(_0x7ff9bb,_0x12b0cf){return _0x7ff9bb[_0xa166('0x9')](_0xa166('0xa'),attributes,{'tableName':_0xa166('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2651=['api','moment','bluebird','path','rimraf','../../config/environment','exports','AnalyticExtractedReport','lodash','../../config/logger'];(function(_0x3d24d3,_0x4e9740){var _0x34e941=function(_0x48abdf){while(--_0x48abdf){_0x3d24d3['push'](_0x3d24d3['shift']());}};_0x34e941(++_0x4e9740);}(_0x2651,0x12a));var _0x1265=function(_0x576170,_0x1712ae){_0x576170=_0x576170-0x0;var _0x397c70=_0x2651[_0x576170];return _0x397c70;};'use strict';var _=require(_0x1265('0x0'));var util=require('util');var logger=require(_0x1265('0x1'))(_0x1265('0x2'));var moment=require(_0x1265('0x3'));var BPromise=require(_0x1265('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1265('0x5'));var rimraf=require(_0x1265('0x6'));var config=require(_0x1265('0x7'));var attributes=require('./analyticExtractedReport.attributes');module[_0x1265('0x8')]=function(_0x12ec5e,_0x206dee){return _0x12ec5e['define'](_0x1265('0x9'),attributes,{'tableName':'analytics_extracted_reports','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 e183b73..43d4871 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 _0x0cf5=['stringify','error','code','message','result','lodash','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','AnalyticExtractedReport,\x20%s,\x20%s','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0xa34763,_0x2648cc){var _0x7cffe3=function(_0x1e4a5c){while(--_0x1e4a5c){_0xa34763['push'](_0xa34763['shift']());}};_0x7cffe3(++_0x2648cc);}(_0x0cf5,0x109));var _0x50cf=function(_0x33643a,_0x4b4f3b){_0x33643a=_0x33643a-0x0;var _0x29b9af=_0x0cf5[_0x33643a];return _0x29b9af;};'use strict';var _=require(_0x50cf('0x0'));var util=require('util');var moment=require(_0x50cf('0x1'));var BPromise=require('bluebird');var rs=require(_0x50cf('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x50cf('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x50cf('0x4'))(_0x50cf('0x5'));var config=require(_0x50cf('0x6'));var jayson=require(_0x50cf('0x7'));var client=jayson[_0x50cf('0x8')][_0x50cf('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x111439,_0x12e472,_0x7e37ba){return new BPromise(function(_0x54c144,_0x494633){return client[_0x50cf('0xa')](_0x111439,_0x7e37ba)['then'](function(_0x216e99){logger[_0x50cf('0xb')](_0x50cf('0xc'),_0x12e472,'request\x20sent');logger['debug'](_0x50cf('0xd'),_0x12e472,_0x50cf('0xe'),JSON[_0x50cf('0xf')](_0x216e99));if(_0x216e99['error']){if(_0x216e99[_0x50cf('0x10')][_0x50cf('0x11')]===0x1f4){logger[_0x50cf('0x10')](_0x50cf('0xc'),_0x12e472,_0x216e99[_0x50cf('0x10')][_0x50cf('0x12')]);return _0x494633(_0x216e99[_0x50cf('0x10')][_0x50cf('0x12')]);}logger[_0x50cf('0x10')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x12e472,_0x216e99[_0x50cf('0x10')]['message']);return _0x54c144(_0x216e99[_0x50cf('0x10')]['message']);}else{logger[_0x50cf('0xb')](_0x50cf('0xc'),_0x12e472,_0x50cf('0xe'));_0x54c144(_0x216e99[_0x50cf('0x13')][_0x50cf('0x12')]);}})['catch'](function(_0x54940a){logger[_0x50cf('0x10')](_0x50cf('0xc'),_0x12e472,_0x54940a);_0x494633(_0x54940a);});});} \ No newline at end of file +var _0x54f3=['http','request','then','info','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','AnalyticExtractedReport,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x27e5f6,_0x30dbc3){var _0x4f086b=function(_0x34e01a){while(--_0x34e01a){_0x27e5f6['push'](_0x27e5f6['shift']());}};_0x4f086b(++_0x30dbc3);}(_0x54f3,0xdb));var _0x354f=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x54f3[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0x354f('0x0'));var util=require(_0x354f('0x1'));var moment=require(_0x354f('0x2'));var BPromise=require(_0x354f('0x3'));var rs=require(_0x354f('0x4'));var fs=require('fs');var Redis=require(_0x354f('0x5'));var db=require(_0x354f('0x6'))['db'];var utils=require(_0x354f('0x7'));var logger=require('../../config/logger')(_0x354f('0x8'));var config=require(_0x354f('0x9'));var jayson=require(_0x354f('0xa'));var client=jayson['client'][_0x354f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x82da95,_0x4a3f15,_0x41d160){return new BPromise(function(_0x30d805,_0x1651f5){return client[_0x354f('0xc')](_0x82da95,_0x41d160)[_0x354f('0xd')](function(_0x1d6420){logger[_0x354f('0xe')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x4a3f15,_0x354f('0xf'));logger[_0x354f('0x10')](_0x354f('0x11'),_0x4a3f15,_0x354f('0xf'),JSON[_0x354f('0x12')](_0x1d6420));if(_0x1d6420[_0x354f('0x13')]){if(_0x1d6420[_0x354f('0x13')]['code']===0x1f4){logger[_0x354f('0x13')](_0x354f('0x14'),_0x4a3f15,_0x1d6420[_0x354f('0x13')][_0x354f('0x15')]);return _0x1651f5(_0x1d6420['error'][_0x354f('0x15')]);}logger[_0x354f('0x13')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x4a3f15,_0x1d6420[_0x354f('0x13')][_0x354f('0x15')]);return _0x30d805(_0x1d6420[_0x354f('0x13')][_0x354f('0x15')]);}else{logger[_0x354f('0xe')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x4a3f15,_0x354f('0xf'));_0x30d805(_0x1d6420[_0x354f('0x16')][_0x354f('0x15')]);}})['catch'](function(_0x6d955d){logger[_0x354f('0x13')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x4a3f15,_0x6d955d);_0x1651f5(_0x6d955d);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index 31dacfa..bfd8c70 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 _0x2f4f=['../../components/interaction/service','get','/:id','isAuthenticated','show','/:id/download','download','post','create','put','update','delete','exports','multer','util','path','express','fs-extra','../../components/auth/service'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x2f4f,0x12a));var _0xf2f4=function(_0x37db2c,_0x483136){_0x37db2c=_0x37db2c-0x0;var _0x3b62fd=_0x2f4f[_0x37db2c];return _0x3b62fd;};'use strict';var multer=require(_0xf2f4('0x0'));var util=require(_0xf2f4('0x1'));var path=require(_0xf2f4('0x2'));var timeout=require('connect-timeout');var express=require(_0xf2f4('0x3'));var router=express['Router']();var fs_extra=require(_0xf2f4('0x4'));var auth=require(_0xf2f4('0x5'));var interaction=require(_0xf2f4('0x6'));var config=require('../../config/environment');var controller=require('./analyticExtractedReport.controller');router[_0xf2f4('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0xf2f4('0x7')](_0xf2f4('0x8'),auth[_0xf2f4('0x9')](),controller[_0xf2f4('0xa')]);router[_0xf2f4('0x7')](_0xf2f4('0xb'),auth['isAuthenticated'](),controller[_0xf2f4('0xc')]);router[_0xf2f4('0xd')]('/',auth[_0xf2f4('0x9')](),controller[_0xf2f4('0xe')]);router[_0xf2f4('0xf')](_0xf2f4('0x8'),auth[_0xf2f4('0x9')](),controller[_0xf2f4('0x10')]);router[_0xf2f4('0x11')](_0xf2f4('0x8'),auth['isAuthenticated'](),controller['destroy']);module[_0xf2f4('0x12')]=router; \ No newline at end of file +var _0xae54=['/:id','delete','destroy','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','get','isAuthenticated','index','show','/:id/download','download','create'];(function(_0x260c60,_0x1a6e8a){var _0x47b842=function(_0x5b6e37){while(--_0x5b6e37){_0x260c60['push'](_0x260c60['shift']());}};_0x47b842(++_0x1a6e8a);}(_0xae54,0x16d));var _0x4ae5=function(_0x326e79,_0x33dc91){_0x326e79=_0x326e79-0x0;var _0x37eb89=_0xae54[_0x326e79];return _0x37eb89;};'use strict';var multer=require(_0x4ae5('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x4ae5('0x1'));var express=require(_0x4ae5('0x2'));var router=express[_0x4ae5('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x4ae5('0x4'));var interaction=require(_0x4ae5('0x5'));var config=require(_0x4ae5('0x6'));var controller=require(_0x4ae5('0x7'));router[_0x4ae5('0x8')]('/',auth[_0x4ae5('0x9')](),controller[_0x4ae5('0xa')]);router['get']('/:id',auth[_0x4ae5('0x9')](),controller[_0x4ae5('0xb')]);router['get'](_0x4ae5('0xc'),auth[_0x4ae5('0x9')](),controller[_0x4ae5('0xd')]);router['post']('/',auth[_0x4ae5('0x9')](),controller[_0x4ae5('0xe')]);router['put'](_0x4ae5('0xf'),auth[_0x4ae5('0x9')](),controller['update']);router[_0x4ae5('0x10')](_0x4ae5('0xf'),auth[_0x4ae5('0x9')](),controller[_0x4ae5('0x11')]);module[_0x4ae5('0x12')]=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index 02c535c..e14fcb8 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 _0xdadd=['STRING','BOOLEAN','sequelize','exports'];(function(_0x59162a,_0x10e547){var _0x35e50d=function(_0x578425){while(--_0x578425){_0x59162a['push'](_0x59162a['shift']());}};_0x35e50d(++_0x10e547);}(_0xdadd,0x122));var _0xddad=function(_0x1428d9,_0xded63c){_0x1428d9=_0x1428d9-0x0;var _0x438019=_0xdadd[_0x1428d9];return _0x438019;};'use strict';var Sequelize=require(_0xddad('0x0'));module[_0xddad('0x1')]={'field':{'type':Sequelize['TEXT']},'alias':{'type':Sequelize[_0xddad('0x2')]},'function':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0xddad('0x2')]},'groupBy':{'type':Sequelize[_0xddad('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0xddad('0x2')]},'custom':{'type':Sequelize[_0xddad('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xd6e6=['TEXT','STRING','sequelize','exports'];(function(_0x1dde0c,_0x2f6274){var _0x27b2e7=function(_0x1999ed){while(--_0x1999ed){_0x1dde0c['push'](_0x1dde0c['shift']());}};_0x27b2e7(++_0x2f6274);}(_0xd6e6,0xba));var _0x6d6e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd6e6[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x6d6e('0x0'));module[_0x6d6e('0x1')]={'field':{'type':Sequelize[_0x6d6e('0x2')]},'alias':{'type':Sequelize[_0x6d6e('0x3')]},'function':{'type':Sequelize[_0x6d6e('0x3')]},'format':{'type':Sequelize[_0x6d6e('0x3')]},'groupBy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'orderBy':{'type':Sequelize['STRING']},'custom':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index a5c0f7b..a21967d 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 _0xa740=['mustache','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','undefined','limit','count','offset','status','Content-Range','save','then','destroy','error','stack','name','send','map','AnalyticFieldReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','keys','length','create','bulkCreate','body','update','find','bulkDestroy','ids','addFields','AnalyticCustomReport','findOne','sequelize','transaction','CustomReportId','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0x2e19ab,_0x4d527f){var _0x510981=function(_0x808e9){while(--_0x808e9){_0x2e19ab['push'](_0x2e19ab['shift']());}};_0x510981(++_0x4d527f);}(_0xa740,0xf8));var _0x0a74=function(_0x31b19e,_0x2338bb){_0x31b19e=_0x31b19e-0x0;var _0x33dc9a=_0xa740[_0x31b19e];return _0x33dc9a;};'use strict';var emlformat=require(_0x0a74('0x0'));var rimraf=require(_0x0a74('0x1'));var zipdir=require(_0x0a74('0x2'));var jsonpatch=require(_0x0a74('0x3'));var rp=require(_0x0a74('0x4'));var moment=require(_0x0a74('0x5'));var BPromise=require(_0x0a74('0x6'));var Mustache=require(_0x0a74('0x7'));var util=require('util');var path=require('path');var sox=require(_0x0a74('0x8'));var csv=require('to-csv');var ejs=require(_0x0a74('0x9'));var fs=require('fs');var fs_extra=require(_0x0a74('0xa'));var _=require(_0x0a74('0xb'));var squel=require(_0x0a74('0xc'));var crypto=require(_0x0a74('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x0a74('0xe'));var toCsv=require(_0x0a74('0xf'));var querystring=require(_0x0a74('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x0a74('0x11'));var qs=require(_0x0a74('0x12'));var as=require(_0x0a74('0x13'));var hardwareService=require(_0x0a74('0x14'));var logger=require('../../config/logger')(_0x0a74('0x15'));var utils=require('../../config/utils');var config=require(_0x0a74('0x16'));var licenseUtil=require(_0x0a74('0x17'));var db=require(_0x0a74('0x18'))['db'];function respondWithStatusCode(_0x5d3445,_0x1a6f7a){_0x1a6f7a=_0x1a6f7a||0xcc;return function(_0xe8b567){if(_0xe8b567){return _0x5d3445[_0x0a74('0x19')](_0x1a6f7a);}return _0x5d3445['status'](_0x1a6f7a)[_0x0a74('0x1a')]();};}function respondWithResult(_0x46428d,_0x218e45){_0x218e45=_0x218e45||0xc8;return function(_0x41bb09){if(_0x41bb09){return _0x46428d['status'](_0x218e45)[_0x0a74('0x1b')](_0x41bb09);}};}function respondWithFilteredResult(_0x36e5b7,_0x58147e){return function(_0x250d08){if(_0x250d08){var _0x35866e=typeof _0x58147e['offset']===_0x0a74('0x1c')&&typeof _0x58147e[_0x0a74('0x1d')]===_0x0a74('0x1c');var _0x30bfce=_0x250d08[_0x0a74('0x1e')];var _0x3d89fa=_0x35866e?0x0:_0x58147e[_0x0a74('0x1f')];var _0x4212b0=_0x35866e?_0x250d08['count']:_0x58147e[_0x0a74('0x1f')]+_0x58147e['limit'];var _0xb1e8cf;if(_0x4212b0>=_0x30bfce){_0x4212b0=_0x30bfce;_0xb1e8cf=0xc8;}else{_0xb1e8cf=0xce;}_0x36e5b7[_0x0a74('0x20')](_0xb1e8cf);return _0x36e5b7['set'](_0x0a74('0x21'),_0x3d89fa+'-'+_0x4212b0+'/'+_0x30bfce)['json'](_0x250d08);}return null;};}function patchUpdates(_0xe7e0f8){return function(_0x137f9f){try{jsonpatch['apply'](_0x137f9f,_0xe7e0f8,!![]);}catch(_0x25be99){return BPromise['reject'](_0x25be99);}return _0x137f9f[_0x0a74('0x22')]();};}function saveUpdates(_0x3ca3ac,_0x561e87){return function(_0x401860){if(_0x401860){return _0x401860['update'](_0x3ca3ac)[_0x0a74('0x23')](function(_0x5dc4b8){return _0x5dc4b8;});}return null;};}function removeEntity(_0x50ae42,_0x44804a){return function(_0x27579d){if(_0x27579d){return _0x27579d[_0x0a74('0x24')]()['then'](function(){_0x50ae42[_0x0a74('0x20')](0xcc)[_0x0a74('0x1a')]();});}};}function handleEntityNotFound(_0x18e06e,_0x1dc7e4){return function(_0x2ff424){if(!_0x2ff424){_0x18e06e[_0x0a74('0x19')](0x194);}return _0x2ff424;};}function handleError(_0x2130a1,_0x293883){_0x293883=_0x293883||0x1f4;return function(_0x12a320){logger[_0x0a74('0x25')](_0x12a320[_0x0a74('0x26')]);if(_0x12a320[_0x0a74('0x27')]){delete _0x12a320['name'];}_0x2130a1[_0x0a74('0x20')](_0x293883)[_0x0a74('0x28')](_0x12a320);};}exports['index']=function(_0x5d9722,_0x3a652c){var _0x4222b2={},_0x2ccf7e={},_0x3d2e7f={'count':0x0,'rows':[]};var _0x36ae0c=_[_0x0a74('0x29')](db[_0x0a74('0x2a')][_0x0a74('0x2b')],function(_0x3d1d2f){return{'name':_0x3d1d2f[_0x0a74('0x2c')],'type':_0x3d1d2f[_0x0a74('0x2d')][_0x0a74('0x2e')]};});_0x2ccf7e[_0x0a74('0x2f')]=_[_0x0a74('0x29')](_0x36ae0c,_0x0a74('0x27'));_0x2ccf7e[_0x0a74('0x30')]=_['keys'](_0x5d9722[_0x0a74('0x30')]);_0x2ccf7e[_0x0a74('0x31')]=_[_0x0a74('0x32')](_0x2ccf7e[_0x0a74('0x2f')],_0x2ccf7e['query']);_0x4222b2[_0x0a74('0x33')]=_[_0x0a74('0x32')](_0x2ccf7e[_0x0a74('0x2f')],qs['fields'](_0x5d9722[_0x0a74('0x30')][_0x0a74('0x34')]));_0x4222b2['attributes']=_0x4222b2['attributes']['length']?_0x4222b2[_0x0a74('0x33')]:_0x2ccf7e[_0x0a74('0x2f')];if(!_0x5d9722['query'][_0x0a74('0x35')](_0x0a74('0x36'))){_0x4222b2[_0x0a74('0x1d')]=qs['limit'](_0x5d9722['query'][_0x0a74('0x1d')]);_0x4222b2[_0x0a74('0x1f')]=qs[_0x0a74('0x1f')](_0x5d9722[_0x0a74('0x30')][_0x0a74('0x1f')]);}_0x4222b2[_0x0a74('0x37')]=qs['sort'](_0x5d9722['query'][_0x0a74('0x38')]);_0x4222b2['where']=qs['filters'](_[_0x0a74('0x39')](_0x5d9722[_0x0a74('0x30')],_0x2ccf7e['filters']),_0x36ae0c);if(_0x5d9722[_0x0a74('0x30')]['filter']){_0x4222b2[_0x0a74('0x3a')]=_[_0x0a74('0x3b')](_0x4222b2[_0x0a74('0x3a')],{'$or':_['map'](_0x36ae0c,function(_0x4bc980){if(_0x4bc980[_0x0a74('0x2d')]!==_0x0a74('0x3c')){var _0x50a1ff={};_0x50a1ff[_0x4bc980['name']]={'$like':'%'+_0x5d9722['query'][_0x0a74('0x3d')]+'%'};return _0x50a1ff;}})});}_0x4222b2=_[_0x0a74('0x3b')]({},_0x4222b2,_0x5d9722[_0x0a74('0x3e')]);var _0x2ca7a5={'where':_0x4222b2[_0x0a74('0x3a')]};return db[_0x0a74('0x2a')][_0x0a74('0x1e')](_0x2ca7a5)[_0x0a74('0x23')](function(_0x4d38dd){_0x3d2e7f[_0x0a74('0x1e')]=_0x4d38dd;if(_0x5d9722[_0x0a74('0x30')][_0x0a74('0x3f')]){_0x4222b2[_0x0a74('0x40')]=[{'all':!![]}];}return db[_0x0a74('0x2a')][_0x0a74('0x41')](_0x4222b2);})[_0x0a74('0x23')](function(_0x1f1cf7){_0x3d2e7f[_0x0a74('0x42')]=_0x1f1cf7;return _0x3d2e7f;})[_0x0a74('0x23')](respondWithFilteredResult(_0x3a652c,_0x4222b2))[_0x0a74('0x43')](handleError(_0x3a652c,null));};exports[_0x0a74('0x44')]=function(_0x1d03e1,_0x1a04d2){var _0x3226e3={'raw':![],'where':{'id':_0x1d03e1[_0x0a74('0x45')]['id']}},_0x3acd25={};_0x3acd25[_0x0a74('0x2f')]=_[_0x0a74('0x46')](db[_0x0a74('0x2a')][_0x0a74('0x2b')]);_0x3acd25[_0x0a74('0x30')]=_[_0x0a74('0x46')](_0x1d03e1[_0x0a74('0x30')]);_0x3acd25[_0x0a74('0x31')]=_[_0x0a74('0x32')](_0x3acd25[_0x0a74('0x2f')],_0x3acd25[_0x0a74('0x30')]);_0x3226e3[_0x0a74('0x33')]=_[_0x0a74('0x32')](_0x3acd25[_0x0a74('0x2f')],qs['fields'](_0x1d03e1['query'][_0x0a74('0x34')]));_0x3226e3[_0x0a74('0x33')]=_0x3226e3['attributes'][_0x0a74('0x47')]?_0x3226e3['attributes']:_0x3acd25['model'];if(_0x1d03e1[_0x0a74('0x30')][_0x0a74('0x3f')]){_0x3226e3['include']=[{'all':!![]}];}_0x3226e3=_[_0x0a74('0x3b')]({},_0x3226e3,_0x1d03e1[_0x0a74('0x3e')]);return db[_0x0a74('0x2a')]['find'](_0x3226e3)['then'](handleEntityNotFound(_0x1a04d2,null))[_0x0a74('0x23')](respondWithResult(_0x1a04d2,null))[_0x0a74('0x43')](handleError(_0x1a04d2,null));};exports[_0x0a74('0x48')]=function(_0x3fc1b4,_0x5c8e18){return db[_0x0a74('0x2a')][_0x0a74('0x48')](_0x3fc1b4['body'],{})[_0x0a74('0x23')](respondWithResult(_0x5c8e18,0xc9))[_0x0a74('0x43')](handleError(_0x5c8e18,null));};exports[_0x0a74('0x49')]=function(_0x4e2c50,_0x34e874){return db['AnalyticFieldReport']['bulkCreate'](_0x4e2c50[_0x0a74('0x4a')],{'raw':![],'individualHooks':!![]})[_0x0a74('0x23')](respondWithResult(_0x34e874,0xc9))['catch'](handleError(_0x34e874,null));};exports[_0x0a74('0x4b')]=function(_0x59995a,_0x5de4f1){if(_0x59995a[_0x0a74('0x4a')]['id']){delete _0x59995a[_0x0a74('0x4a')]['id'];}return db[_0x0a74('0x2a')][_0x0a74('0x4c')]({'where':{'id':_0x59995a[_0x0a74('0x45')]['id']}})[_0x0a74('0x23')](handleEntityNotFound(_0x5de4f1,null))['then'](saveUpdates(_0x59995a[_0x0a74('0x4a')],null))[_0x0a74('0x23')](respondWithResult(_0x5de4f1,null))[_0x0a74('0x43')](handleError(_0x5de4f1,null));};exports[_0x0a74('0x24')]=function(_0x2754ef,_0x26c64a){return db[_0x0a74('0x2a')][_0x0a74('0x4c')]({'where':{'id':_0x2754ef['params']['id']}})[_0x0a74('0x23')](handleEntityNotFound(_0x26c64a,null))['then'](removeEntity(_0x26c64a,null))[_0x0a74('0x43')](handleError(_0x26c64a,null));};exports[_0x0a74('0x4d')]=function(_0x3132af,_0x55cd41){return db['AnalyticFieldReport'][_0x0a74('0x24')]({'where':{'id':_0x3132af[_0x0a74('0x30')][_0x0a74('0x4e')]||[]},'raw':![],'individualHooks':!![]})[_0x0a74('0x23')](respondWithResult(_0x55cd41,0xcc))[_0x0a74('0x43')](handleError(_0x55cd41,null));};exports[_0x0a74('0x4f')]=function(_0x521ab7,_0x2f1882,_0x363924){return db[_0x0a74('0x50')][_0x0a74('0x51')]({'where':{'id':_0x521ab7[_0x0a74('0x45')]['id']}})[_0x0a74('0x23')](handleEntityNotFound(_0x2f1882,null))[_0x0a74('0x23')](function(_0x2f4f08){if(_0x2f4f08){return db[_0x0a74('0x52')][_0x0a74('0x53')](function(_0x20c4fc){return db[_0x0a74('0x2a')][_0x0a74('0x24')]({'where':{'CustomReportId':_0x521ab7[_0x0a74('0x45')]['id']},'transaction':_0x20c4fc})[_0x0a74('0x23')](function(_0x30fff6){var _0x3ca307=_['map'](_0x521ab7[_0x0a74('0x4a')],function(_0xeee323){delete _0xeee323['id'];_0xeee323[_0x0a74('0x54')]=_0x521ab7[_0x0a74('0x45')]['id'];return _0xeee323;});return db['AnalyticFieldReport'][_0x0a74('0x49')](_0x3ca307,{'transaction':_0x20c4fc});});})['then'](function(){return db[_0x0a74('0x2a')][_0x0a74('0x41')]({'where':{'CustomReportId':_0x521ab7['params']['id']}});});}})[_0x0a74('0x23')](respondWithResult(_0x2f1882,null))[_0x0a74('0x43')](handleError(_0x2f1882,null));}; \ No newline at end of file +var _0xe3ce=['nolimit','order','sort','filters','pick','filter','where','merge','map','VIRTUAL','options','includeAll','include','AnalyticFieldReport','findAll','rows','show','params','catch','create','bulkCreate','update','body','find','ids','AnalyticCustomReport','findOne','transaction','CustomReportId','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','then','destroy','name','send','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty'];(function(_0x426f3a,_0x3ad8bb){var _0x1f01b3=function(_0x2b96e4){while(--_0x2b96e4){_0x426f3a['push'](_0x426f3a['shift']());}};_0x1f01b3(++_0x3ad8bb);}(_0xe3ce,0x6e));var _0xee3c=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xe3ce[_0x167cc1];return _0x10bc4b;};'use strict';var emlformat=require(_0xee3c('0x0'));var rimraf=require(_0xee3c('0x1'));var zipdir=require(_0xee3c('0x2'));var jsonpatch=require(_0xee3c('0x3'));var rp=require(_0xee3c('0x4'));var moment=require(_0xee3c('0x5'));var BPromise=require(_0xee3c('0x6'));var Mustache=require(_0xee3c('0x7'));var util=require('util');var path=require(_0xee3c('0x8'));var sox=require('sox');var csv=require(_0xee3c('0x9'));var ejs=require(_0xee3c('0xa'));var fs=require('fs');var fs_extra=require(_0xee3c('0xb'));var _=require(_0xee3c('0xc'));var squel=require('squel');var crypto=require(_0xee3c('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xee3c('0xe'));var toCsv=require(_0xee3c('0x9'));var querystring=require(_0xee3c('0xf'));var Papa=require('papaparse');var Redis=require(_0xee3c('0x10'));var authService=require(_0xee3c('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xee3c('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xee3c('0x13'))(_0xee3c('0x14'));var utils=require('../../config/utils');var config=require(_0xee3c('0x15'));var licenseUtil=require(_0xee3c('0x16'));var db=require(_0xee3c('0x17'))['db'];function respondWithStatusCode(_0xcd8073,_0x4a34b0){_0x4a34b0=_0x4a34b0||0xcc;return function(_0x4a3034){if(_0x4a3034){return _0xcd8073[_0xee3c('0x18')](_0x4a34b0);}return _0xcd8073[_0xee3c('0x19')](_0x4a34b0)[_0xee3c('0x1a')]();};}function respondWithResult(_0x48373a,_0x47c55e){_0x47c55e=_0x47c55e||0xc8;return function(_0x3a3f67){if(_0x3a3f67){return _0x48373a['status'](_0x47c55e)[_0xee3c('0x1b')](_0x3a3f67);}};}function respondWithFilteredResult(_0x14c74c,_0x324353){return function(_0x5d26b9){if(_0x5d26b9){var _0x1d478e=typeof _0x324353[_0xee3c('0x1c')]===_0xee3c('0x1d')&&typeof _0x324353[_0xee3c('0x1e')]===_0xee3c('0x1d');var _0x1b81d9=_0x5d26b9[_0xee3c('0x1f')];var _0x154bbc=_0x1d478e?0x0:_0x324353[_0xee3c('0x1c')];var _0x587350=_0x1d478e?_0x5d26b9[_0xee3c('0x1f')]:_0x324353[_0xee3c('0x1c')]+_0x324353[_0xee3c('0x1e')];var _0x5e6795;if(_0x587350>=_0x1b81d9){_0x587350=_0x1b81d9;_0x5e6795=0xc8;}else{_0x5e6795=0xce;}_0x14c74c[_0xee3c('0x19')](_0x5e6795);return _0x14c74c[_0xee3c('0x20')](_0xee3c('0x21'),_0x154bbc+'-'+_0x587350+'/'+_0x1b81d9)[_0xee3c('0x1b')](_0x5d26b9);}return null;};}function patchUpdates(_0x4d1919){return function(_0x40d821){try{jsonpatch[_0xee3c('0x22')](_0x40d821,_0x4d1919,!![]);}catch(_0x332b03){return BPromise[_0xee3c('0x23')](_0x332b03);}return _0x40d821['save']();};}function saveUpdates(_0x559140,_0x3c708b){return function(_0x145836){if(_0x145836){return _0x145836['update'](_0x559140)[_0xee3c('0x24')](function(_0x35c9c8){return _0x35c9c8;});}return null;};}function removeEntity(_0x32a415,_0x289632){return function(_0x54db1b){if(_0x54db1b){return _0x54db1b[_0xee3c('0x25')]()[_0xee3c('0x24')](function(){_0x32a415['status'](0xcc)[_0xee3c('0x1a')]();});}};}function handleEntityNotFound(_0x4a822e,_0x2a4349){return function(_0x49ddfa){if(!_0x49ddfa){_0x4a822e[_0xee3c('0x18')](0x194);}return _0x49ddfa;};}function handleError(_0x153d31,_0x17a6a9){_0x17a6a9=_0x17a6a9||0x1f4;return function(_0x41e5f2){logger['error'](_0x41e5f2['stack']);if(_0x41e5f2[_0xee3c('0x26')]){delete _0x41e5f2['name'];}_0x153d31[_0xee3c('0x19')](_0x17a6a9)[_0xee3c('0x27')](_0x41e5f2);};}exports['index']=function(_0x18ec7f,_0x30a2af){var _0xaa26a2={},_0x3992f3={},_0x454013={'count':0x0,'rows':[]};var _0x59c3bf=_['map'](db['AnalyticFieldReport'][_0xee3c('0x28')],function(_0x37960a){return{'name':_0x37960a[_0xee3c('0x29')],'type':_0x37960a[_0xee3c('0x2a')][_0xee3c('0x2b')]};});_0x3992f3[_0xee3c('0x2c')]=_['map'](_0x59c3bf,_0xee3c('0x26'));_0x3992f3[_0xee3c('0x2d')]=_[_0xee3c('0x2e')](_0x18ec7f['query']);_0x3992f3['filters']=_[_0xee3c('0x2f')](_0x3992f3[_0xee3c('0x2c')],_0x3992f3[_0xee3c('0x2d')]);_0xaa26a2['attributes']=_['intersection'](_0x3992f3[_0xee3c('0x2c')],qs[_0xee3c('0x30')](_0x18ec7f[_0xee3c('0x2d')]['fields']));_0xaa26a2[_0xee3c('0x31')]=_0xaa26a2[_0xee3c('0x31')][_0xee3c('0x32')]?_0xaa26a2[_0xee3c('0x31')]:_0x3992f3[_0xee3c('0x2c')];if(!_0x18ec7f[_0xee3c('0x2d')][_0xee3c('0x33')](_0xee3c('0x34'))){_0xaa26a2[_0xee3c('0x1e')]=qs[_0xee3c('0x1e')](_0x18ec7f[_0xee3c('0x2d')][_0xee3c('0x1e')]);_0xaa26a2['offset']=qs[_0xee3c('0x1c')](_0x18ec7f[_0xee3c('0x2d')][_0xee3c('0x1c')]);}_0xaa26a2[_0xee3c('0x35')]=qs[_0xee3c('0x36')](_0x18ec7f[_0xee3c('0x2d')]['sort']);_0xaa26a2['where']=qs[_0xee3c('0x37')](_[_0xee3c('0x38')](_0x18ec7f[_0xee3c('0x2d')],_0x3992f3['filters']),_0x59c3bf);if(_0x18ec7f[_0xee3c('0x2d')][_0xee3c('0x39')]){_0xaa26a2[_0xee3c('0x3a')]=_[_0xee3c('0x3b')](_0xaa26a2['where'],{'$or':_[_0xee3c('0x3c')](_0x59c3bf,function(_0xf0b6ee){if(_0xf0b6ee[_0xee3c('0x2a')]!==_0xee3c('0x3d')){var _0x17aa55={};_0x17aa55[_0xf0b6ee['name']]={'$like':'%'+_0x18ec7f[_0xee3c('0x2d')]['filter']+'%'};return _0x17aa55;}})});}_0xaa26a2=_[_0xee3c('0x3b')]({},_0xaa26a2,_0x18ec7f[_0xee3c('0x3e')]);var _0x308b63={'where':_0xaa26a2[_0xee3c('0x3a')]};return db['AnalyticFieldReport'][_0xee3c('0x1f')](_0x308b63)[_0xee3c('0x24')](function(_0x3384a3){_0x454013[_0xee3c('0x1f')]=_0x3384a3;if(_0x18ec7f[_0xee3c('0x2d')][_0xee3c('0x3f')]){_0xaa26a2[_0xee3c('0x40')]=[{'all':!![]}];}return db[_0xee3c('0x41')][_0xee3c('0x42')](_0xaa26a2);})[_0xee3c('0x24')](function(_0x56f521){_0x454013[_0xee3c('0x43')]=_0x56f521;return _0x454013;})['then'](respondWithFilteredResult(_0x30a2af,_0xaa26a2))['catch'](handleError(_0x30a2af,null));};exports[_0xee3c('0x44')]=function(_0x2f7b08,_0x5a1876){var _0x14a54f={'raw':![],'where':{'id':_0x2f7b08[_0xee3c('0x45')]['id']}},_0x30861f={};_0x30861f['model']=_[_0xee3c('0x2e')](db['AnalyticFieldReport'][_0xee3c('0x28')]);_0x30861f[_0xee3c('0x2d')]=_['keys'](_0x2f7b08[_0xee3c('0x2d')]);_0x30861f[_0xee3c('0x37')]=_[_0xee3c('0x2f')](_0x30861f[_0xee3c('0x2c')],_0x30861f['query']);_0x14a54f[_0xee3c('0x31')]=_[_0xee3c('0x2f')](_0x30861f[_0xee3c('0x2c')],qs[_0xee3c('0x30')](_0x2f7b08[_0xee3c('0x2d')][_0xee3c('0x30')]));_0x14a54f[_0xee3c('0x31')]=_0x14a54f[_0xee3c('0x31')][_0xee3c('0x32')]?_0x14a54f[_0xee3c('0x31')]:_0x30861f[_0xee3c('0x2c')];if(_0x2f7b08[_0xee3c('0x2d')]['includeAll']){_0x14a54f[_0xee3c('0x40')]=[{'all':!![]}];}_0x14a54f=_[_0xee3c('0x3b')]({},_0x14a54f,_0x2f7b08[_0xee3c('0x3e')]);return db[_0xee3c('0x41')]['find'](_0x14a54f)[_0xee3c('0x24')](handleEntityNotFound(_0x5a1876,null))[_0xee3c('0x24')](respondWithResult(_0x5a1876,null))[_0xee3c('0x46')](handleError(_0x5a1876,null));};exports[_0xee3c('0x47')]=function(_0x5ed6cb,_0x5aa7ad){return db[_0xee3c('0x41')][_0xee3c('0x47')](_0x5ed6cb['body'],{})['then'](respondWithResult(_0x5aa7ad,0xc9))[_0xee3c('0x46')](handleError(_0x5aa7ad,null));};exports['bulkCreate']=function(_0x1e1693,_0x1a952a){return db[_0xee3c('0x41')][_0xee3c('0x48')](_0x1e1693['body'],{'raw':![],'individualHooks':!![]})[_0xee3c('0x24')](respondWithResult(_0x1a952a,0xc9))[_0xee3c('0x46')](handleError(_0x1a952a,null));};exports[_0xee3c('0x49')]=function(_0x52405e,_0x483abe){if(_0x52405e[_0xee3c('0x4a')]['id']){delete _0x52405e[_0xee3c('0x4a')]['id'];}return db[_0xee3c('0x41')][_0xee3c('0x4b')]({'where':{'id':_0x52405e['params']['id']}})[_0xee3c('0x24')](handleEntityNotFound(_0x483abe,null))[_0xee3c('0x24')](saveUpdates(_0x52405e[_0xee3c('0x4a')],null))[_0xee3c('0x24')](respondWithResult(_0x483abe,null))['catch'](handleError(_0x483abe,null));};exports[_0xee3c('0x25')]=function(_0x2679f7,_0x46b6a6){return db[_0xee3c('0x41')]['find']({'where':{'id':_0x2679f7[_0xee3c('0x45')]['id']}})['then'](handleEntityNotFound(_0x46b6a6,null))['then'](removeEntity(_0x46b6a6,null))[_0xee3c('0x46')](handleError(_0x46b6a6,null));};exports['bulkDestroy']=function(_0xd7196c,_0x2b882a){return db[_0xee3c('0x41')]['destroy']({'where':{'id':_0xd7196c[_0xee3c('0x2d')][_0xee3c('0x4c')]||[]},'raw':![],'individualHooks':!![]})[_0xee3c('0x24')](respondWithResult(_0x2b882a,0xcc))[_0xee3c('0x46')](handleError(_0x2b882a,null));};exports['addFields']=function(_0x56bebb,_0x5ba7e5,_0x172216){return db[_0xee3c('0x4d')][_0xee3c('0x4e')]({'where':{'id':_0x56bebb[_0xee3c('0x45')]['id']}})[_0xee3c('0x24')](handleEntityNotFound(_0x5ba7e5,null))['then'](function(_0x90be47){if(_0x90be47){return db['sequelize'][_0xee3c('0x4f')](function(_0x14394b){return db[_0xee3c('0x41')]['destroy']({'where':{'CustomReportId':_0x56bebb['params']['id']},'transaction':_0x14394b})[_0xee3c('0x24')](function(_0x46fec0){var _0x1e2f8a=_[_0xee3c('0x3c')](_0x56bebb[_0xee3c('0x4a')],function(_0xc0857){delete _0xc0857['id'];_0xc0857[_0xee3c('0x50')]=_0x56bebb['params']['id'];return _0xc0857;});return db[_0xee3c('0x41')]['bulkCreate'](_0x1e2f8a,{'transaction':_0x14394b});});})['then'](function(){return db['AnalyticFieldReport'][_0xee3c('0x42')]({'where':{'CustomReportId':_0x56bebb[_0xee3c('0x45')]['id']}});});}})['then'](respondWithResult(_0x5ba7e5,null))[_0xee3c('0x46')](handleError(_0x5ba7e5,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index 37b932f..88f7d70 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 _0xc081=['exports','analytics_report_fields','util','../../config/logger','moment','request-promise','path','rimraf'];(function(_0x44fabe,_0x116070){var _0x5ebf9d=function(_0x4948ed){while(--_0x4948ed){_0x44fabe['push'](_0x44fabe['shift']());}};_0x5ebf9d(++_0x116070);}(_0xc081,0x72));var _0x1c08=function(_0x30faec,_0x18940b){_0x30faec=_0x30faec-0x0;var _0x29484f=_0xc081[_0x30faec];return _0x29484f;};'use strict';var _=require('lodash');var util=require(_0x1c08('0x0'));var logger=require(_0x1c08('0x1'))('api');var moment=require(_0x1c08('0x2'));var BPromise=require('bluebird');var rp=require(_0x1c08('0x3'));var fs=require('fs');var path=require(_0x1c08('0x4'));var rimraf=require(_0x1c08('0x5'));var config=require('../../config/environment');var attributes=require('./analyticFieldReport.attributes');module[_0x1c08('0x6')]=function(_0x10e53b,_0x537242){return _0x10e53b['define']('AnalyticFieldReport',attributes,{'tableName':_0x1c08('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd83d=['api','bluebird','request-promise','path','./analyticFieldReport.attributes','AnalyticFieldReport','analytics_report_fields','lodash','../../config/logger'];(function(_0x26fd34,_0x555634){var _0x62a186=function(_0x5607c3){while(--_0x5607c3){_0x26fd34['push'](_0x26fd34['shift']());}};_0x62a186(++_0x555634);}(_0xd83d,0x1c9));var _0xdd83=function(_0xcbf328,_0x3c7a07){_0xcbf328=_0xcbf328-0x0;var _0x5b3369=_0xd83d[_0xcbf328];return _0x5b3369;};'use strict';var _=require(_0xdd83('0x0'));var util=require('util');var logger=require(_0xdd83('0x1'))(_0xdd83('0x2'));var moment=require('moment');var BPromise=require(_0xdd83('0x3'));var rp=require(_0xdd83('0x4'));var fs=require('fs');var path=require(_0xdd83('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xdd83('0x6'));module['exports']=function(_0x4a97ff,_0x9a5b37){return _0x4a97ff['define'](_0xdd83('0x7'),attributes,{'tableName':_0xdd83('0x8'),'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 ec8e3e5..cd17b34 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 _0x1505=['../../mysqldb','../../config/logger','rpc','jayson/promise','client','request','then','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','bluebird','ioredis'];(function(_0x42bc91,_0x41f40a){var _0x3f5507=function(_0x20cfaf){while(--_0x20cfaf){_0x42bc91['push'](_0x42bc91['shift']());}};_0x3f5507(++_0x41f40a);}(_0x1505,0x1cb));var _0x5150=function(_0x52d46d,_0x4cb611){_0x52d46d=_0x52d46d-0x0;var _0xdfbdff=_0x1505[_0x52d46d];return _0xdfbdff;};'use strict';var _=require(_0x5150('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x5150('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5150('0x2'));var db=require(_0x5150('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x5150('0x4'))(_0x5150('0x5'));var config=require('../../config/environment');var jayson=require(_0x5150('0x6'));var client=jayson[_0x5150('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3052fd,_0x3e9abb,_0x3943b4){return new BPromise(function(_0x2ef50f,_0x51be28){return client[_0x5150('0x8')](_0x3052fd,_0x3943b4)[_0x5150('0x9')](function(_0x191871){logger[_0x5150('0xa')](_0x5150('0xb'),_0x3e9abb,_0x5150('0xc'));logger[_0x5150('0xd')](_0x5150('0xe'),_0x3e9abb,_0x5150('0xc'),JSON[_0x5150('0xf')](_0x191871));if(_0x191871[_0x5150('0x10')]){if(_0x191871[_0x5150('0x10')][_0x5150('0x11')]===0x1f4){logger[_0x5150('0x10')]('AnalyticFieldReport,\x20%s,\x20%s',_0x3e9abb,_0x191871[_0x5150('0x10')][_0x5150('0x12')]);return _0x51be28(_0x191871['error'][_0x5150('0x12')]);}logger['error'](_0x5150('0xb'),_0x3e9abb,_0x191871[_0x5150('0x10')][_0x5150('0x12')]);return _0x2ef50f(_0x191871[_0x5150('0x10')][_0x5150('0x12')]);}else{logger[_0x5150('0xa')](_0x5150('0xb'),_0x3e9abb,'request\x20sent');_0x2ef50f(_0x191871[_0x5150('0x13')]['message']);}})[_0x5150('0x14')](function(_0x6fc002){logger['error'](_0x5150('0xb'),_0x3e9abb,_0x6fc002);_0x51be28(_0x6fc002);});});} \ No newline at end of file +var _0x55af=['info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','bluebird','randomstring','ioredis','../../config/environment','jayson/promise','client','http','then'];(function(_0x1d16c1,_0x7133cb){var _0x3bd0c7=function(_0x36a1c8){while(--_0x36a1c8){_0x1d16c1['push'](_0x1d16c1['shift']());}};_0x3bd0c7(++_0x7133cb);}(_0x55af,0xed));var _0xf55a=function(_0x383e41,_0x14dbad){_0x383e41=_0x383e41-0x0;var _0x5ae625=_0x55af[_0x383e41];return _0x5ae625;};'use strict';var _=require(_0xf55a('0x0'));var util=require(_0xf55a('0x1'));var moment=require('moment');var BPromise=require(_0xf55a('0x2'));var rs=require(_0xf55a('0x3'));var fs=require('fs');var Redis=require(_0xf55a('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xf55a('0x5'));var jayson=require(_0xf55a('0x6'));var client=jayson[_0xf55a('0x7')][_0xf55a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xe1c2c5,_0x22d3d3,_0x4e090a){return new BPromise(function(_0x528511,_0x46c3a2){return client['request'](_0xe1c2c5,_0x4e090a)[_0xf55a('0x9')](function(_0x52983a){logger[_0xf55a('0xa')](_0xf55a('0xb'),_0x22d3d3,_0xf55a('0xc'));logger[_0xf55a('0xd')](_0xf55a('0xe'),_0x22d3d3,_0xf55a('0xc'),JSON[_0xf55a('0xf')](_0x52983a));if(_0x52983a[_0xf55a('0x10')]){if(_0x52983a[_0xf55a('0x10')]['code']===0x1f4){logger[_0xf55a('0x10')](_0xf55a('0xb'),_0x22d3d3,_0x52983a['error'][_0xf55a('0x11')]);return _0x46c3a2(_0x52983a[_0xf55a('0x10')][_0xf55a('0x11')]);}logger[_0xf55a('0x10')]('AnalyticFieldReport,\x20%s,\x20%s',_0x22d3d3,_0x52983a[_0xf55a('0x10')]['message']);return _0x528511(_0x52983a['error'][_0xf55a('0x11')]);}else{logger[_0xf55a('0xa')](_0xf55a('0xb'),_0x22d3d3,'request\x20sent');_0x528511(_0x52983a['result'][_0xf55a('0x11')]);}})[_0xf55a('0x12')](function(_0x369366){logger['error'](_0xf55a('0xb'),_0x22d3d3,_0x369366);_0x46c3a2(_0x369366);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index 2bebdb6..195d919 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(_0x135087,_0x1ebcfc){var _0x4fe7ce=function(_0x10b674){while(--_0x10b674){_0x135087['push'](_0x135087['shift']());}};_0x4fe7ce(++_0x1ebcfc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3a6efd,_0x2a5102){_0x3a6efd=_0x3a6efd-0x0;var _0x487b9a=_0xa9e0[_0x3a6efd];return _0x487b9a;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('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(_0x41c0e9,_0x1dff64){var _0x2644f4=function(_0x580b19){while(--_0x580b19){_0x41c0e9['push'](_0x41c0e9['shift']());}};_0x2644f4(++_0x1dff64);}(_0xa9e0,0x123));var _0x0a9e=function(_0x102e37,_0x14a181){_0x102e37=_0x102e37-0x0;var _0x35a07c=_0xa9e0[_0x102e37];return _0x35a07c;};'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 363238f..b2667fd 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 _0x0abf=['name','sequelize','STRING'];(function(_0x101e7b,_0x4ef05b){var _0x4995c0=function(_0x1a6488){while(--_0x1a6488){_0x101e7b['push'](_0x101e7b['shift']());}};_0x4995c0(++_0x4ef05b);}(_0x0abf,0xe8));var _0xf0ab=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x0abf[_0x432682];return _0x463d05;};'use strict';var Sequelize=require(_0xf0ab('0x0'));module['exports']={'name':{'type':Sequelize[_0xf0ab('0x1')],'allowNull':![],'unique':_0xf0ab('0x2')},'table':{'type':Sequelize['STRING']},'metric':{'type':Sequelize['TEXT']},'description':{'type':Sequelize[_0xf0ab('0x1')]}}; \ No newline at end of file +var _0x5b02=['name','sequelize','exports','STRING'];(function(_0x321aca,_0x5d7c72){var _0x566cf1=function(_0x5412a7){while(--_0x5412a7){_0x321aca['push'](_0x321aca['shift']());}};_0x566cf1(++_0x5d7c72);}(_0x5b02,0xe9));var _0x25b0=function(_0x1d9341,_0x41629c){_0x1d9341=_0x1d9341-0x0;var _0x466e1c=_0x5b02[_0x1d9341];return _0x466e1c;};'use strict';var Sequelize=require(_0x25b0('0x0'));module[_0x25b0('0x1')]={'name':{'type':Sequelize[_0x25b0('0x2')],'allowNull':![],'unique':_0x25b0('0x3')},'table':{'type':Sequelize['STRING']},'metric':{'type':Sequelize['TEXT']},'description':{'type':Sequelize[_0x25b0('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index 63fbced..00104c3 100644 --- a/server/api/analyticMetric/analyticMetric.controller.js +++ b/server/api/analyticMetric/analyticMetric.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf2ca=['filter','merge','map','type','VIRTUAL','options','AnalyticMetric','count','includeAll','findAll','rows','catch','keys','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','params','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','then','get','Metrics','UserProfileResource','destroy','stack','name','send','index','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where'];(function(_0x43289b,_0x1a9d62){var _0x1b329b=function(_0x27db18){while(--_0x27db18){_0x43289b['push'](_0x43289b['shift']());}};_0x1b329b(++_0x1a9d62);}(_0xf2ca,0x16a));var _0xaf2c=function(_0x359d3e,_0x9d9e5b){_0x359d3e=_0x359d3e-0x0;var _0x533931=_0xf2ca[_0x359d3e];return _0x533931;};'use strict';var emlformat=require(_0xaf2c('0x0'));var rimraf=require(_0xaf2c('0x1'));var zipdir=require(_0xaf2c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xaf2c('0x3'));var moment=require(_0xaf2c('0x4'));var BPromise=require(_0xaf2c('0x5'));var Mustache=require(_0xaf2c('0x6'));var util=require(_0xaf2c('0x7'));var path=require(_0xaf2c('0x8'));var sox=require('sox');var csv=require(_0xaf2c('0x9'));var ejs=require(_0xaf2c('0xa'));var fs=require('fs');var fs_extra=require(_0xaf2c('0xb'));var _=require(_0xaf2c('0xc'));var squel=require('squel');var crypto=require(_0xaf2c('0xd'));var jsforce=require(_0xaf2c('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xaf2c('0x9'));var querystring=require('querystring');var Papa=require(_0xaf2c('0xf'));var Redis=require('ioredis');var authService=require(_0xaf2c('0x10'));var qs=require(_0xaf2c('0x11'));var as=require(_0xaf2c('0x12'));var hardwareService=require(_0xaf2c('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xaf2c('0x14'));var config=require(_0xaf2c('0x15'));var licenseUtil=require(_0xaf2c('0x16'));var db=require(_0xaf2c('0x17'))['db'];function respondWithStatusCode(_0x285dac,_0x59a59b){_0x59a59b=_0x59a59b||0xcc;return function(_0x590126){if(_0x590126){return _0x285dac[_0xaf2c('0x18')](_0x59a59b);}return _0x285dac[_0xaf2c('0x19')](_0x59a59b)[_0xaf2c('0x1a')]();};}function respondWithResult(_0x18a8a5,_0x293ca6){_0x293ca6=_0x293ca6||0xc8;return function(_0x152c73){if(_0x152c73){return _0x18a8a5[_0xaf2c('0x19')](_0x293ca6)[_0xaf2c('0x1b')](_0x152c73);}};}function respondWithFilteredResult(_0x2119c8,_0x1d0633){return function(_0x6ac8e){if(_0x6ac8e){var _0x2b4d13=typeof _0x1d0633[_0xaf2c('0x1c')]===_0xaf2c('0x1d')&&typeof _0x1d0633[_0xaf2c('0x1e')]==='undefined';var _0x3ca650=_0x6ac8e['count'];var _0x278a28=_0x2b4d13?0x0:_0x1d0633[_0xaf2c('0x1c')];var _0x1d544a=_0x2b4d13?_0x6ac8e['count']:_0x1d0633[_0xaf2c('0x1c')]+_0x1d0633[_0xaf2c('0x1e')];var _0x1fec4c;if(_0x1d544a>=_0x3ca650){_0x1d544a=_0x3ca650;_0x1fec4c=0xc8;}else{_0x1fec4c=0xce;}_0x2119c8[_0xaf2c('0x19')](_0x1fec4c);return _0x2119c8[_0xaf2c('0x1f')](_0xaf2c('0x20'),_0x278a28+'-'+_0x1d544a+'/'+_0x3ca650)['json'](_0x6ac8e);}return null;};}function patchUpdates(_0x35e712){return function(_0x164bcb){try{jsonpatch[_0xaf2c('0x21')](_0x164bcb,_0x35e712,!![]);}catch(_0x3bfd3f){return BPromise[_0xaf2c('0x22')](_0x3bfd3f);}return _0x164bcb['save']();};}function saveUpdates(_0x396646,_0xbf6f62){return function(_0x18153c){if(_0x18153c){return _0x18153c['update'](_0x396646)['then'](function(_0x29cbdf){return _0x29cbdf;});}return null;};}function removeEntity(_0x303546,_0x1cafad){return function(_0x99f78d){if(_0x99f78d){return _0x99f78d['destroy']()[_0xaf2c('0x23')](function(){var _0xf1a7cf=_0x99f78d[_0xaf2c('0x24')]({'plain':!![]});var _0x3c1ae6=_0xaf2c('0x25');return db[_0xaf2c('0x26')][_0xaf2c('0x27')]({'where':{'type':_0x3c1ae6,'resourceId':_0xf1a7cf['id']}})['then'](function(){return _0x99f78d;});})[_0xaf2c('0x23')](function(){_0x303546[_0xaf2c('0x19')](0xcc)[_0xaf2c('0x1a')]();});}};}function handleEntityNotFound(_0x410536,_0x4b7cf2){return function(_0x3fb190){if(!_0x3fb190){_0x410536['sendStatus'](0x194);}return _0x3fb190;};}function handleError(_0x38db1b,_0x42f980){_0x42f980=_0x42f980||0x1f4;return function(_0x15466b){logger['error'](_0x15466b[_0xaf2c('0x28')]);if(_0x15466b[_0xaf2c('0x29')]){delete _0x15466b[_0xaf2c('0x29')];}_0x38db1b['status'](_0x42f980)[_0xaf2c('0x2a')](_0x15466b);};}exports[_0xaf2c('0x2b')]=function(_0x42e2a5,_0x19364e){var _0x59d858={},_0x3da072={},_0x4072ff={'count':0x0,'rows':[]};var _0x1be1ef=_['map'](db['AnalyticMetric'][_0xaf2c('0x2c')],function(_0x4c9b4f){return{'name':_0x4c9b4f[_0xaf2c('0x2d')],'type':_0x4c9b4f['type'][_0xaf2c('0x2e')]};});_0x3da072[_0xaf2c('0x2f')]=_['map'](_0x1be1ef,_0xaf2c('0x29'));_0x3da072[_0xaf2c('0x30')]=_['keys'](_0x42e2a5[_0xaf2c('0x30')]);_0x3da072[_0xaf2c('0x31')]=_[_0xaf2c('0x32')](_0x3da072[_0xaf2c('0x2f')],_0x3da072[_0xaf2c('0x30')]);_0x59d858[_0xaf2c('0x33')]=_['intersection'](_0x3da072[_0xaf2c('0x2f')],qs['fields'](_0x42e2a5[_0xaf2c('0x30')]['fields']));_0x59d858[_0xaf2c('0x33')]=_0x59d858['attributes'][_0xaf2c('0x34')]?_0x59d858['attributes']:_0x3da072[_0xaf2c('0x2f')];if(!_0x42e2a5['query'][_0xaf2c('0x35')](_0xaf2c('0x36'))){_0x59d858[_0xaf2c('0x1e')]=qs[_0xaf2c('0x1e')](_0x42e2a5[_0xaf2c('0x30')]['limit']);_0x59d858['offset']=qs[_0xaf2c('0x1c')](_0x42e2a5[_0xaf2c('0x30')][_0xaf2c('0x1c')]);}_0x59d858[_0xaf2c('0x37')]=qs[_0xaf2c('0x38')](_0x42e2a5[_0xaf2c('0x30')]['sort']);_0x59d858[_0xaf2c('0x39')]=qs[_0xaf2c('0x31')](_['pick'](_0x42e2a5[_0xaf2c('0x30')],_0x3da072[_0xaf2c('0x31')]),_0x1be1ef);if(_0x42e2a5[_0xaf2c('0x30')][_0xaf2c('0x3a')]){_0x59d858[_0xaf2c('0x39')]=_[_0xaf2c('0x3b')](_0x59d858[_0xaf2c('0x39')],{'$or':_[_0xaf2c('0x3c')](_0x1be1ef,function(_0x296ca8){if(_0x296ca8[_0xaf2c('0x3d')]!==_0xaf2c('0x3e')){var _0x43f606={};_0x43f606[_0x296ca8[_0xaf2c('0x29')]]={'$like':'%'+_0x42e2a5['query']['filter']+'%'};return _0x43f606;}})});}_0x59d858=_['merge']({},_0x59d858,_0x42e2a5[_0xaf2c('0x3f')]);var _0x3cb075={'where':_0x59d858[_0xaf2c('0x39')]};return db[_0xaf2c('0x40')][_0xaf2c('0x41')](_0x3cb075)[_0xaf2c('0x23')](function(_0x51c441){_0x4072ff[_0xaf2c('0x41')]=_0x51c441;if(_0x42e2a5[_0xaf2c('0x30')][_0xaf2c('0x42')]){_0x59d858['include']=[{'all':!![]}];}return db['AnalyticMetric'][_0xaf2c('0x43')](_0x59d858);})['then'](function(_0x181787){_0x4072ff[_0xaf2c('0x44')]=_0x181787;return _0x4072ff;})[_0xaf2c('0x23')](respondWithFilteredResult(_0x19364e,_0x59d858))[_0xaf2c('0x45')](handleError(_0x19364e,null));};exports['show']=function(_0x2091eb,_0x532d5f){var _0x2056b8={'raw':!![],'where':{'id':_0x2091eb['params']['id']}},_0x8ebb65={};_0x8ebb65[_0xaf2c('0x2f')]=_['keys'](db[_0xaf2c('0x40')][_0xaf2c('0x2c')]);_0x8ebb65[_0xaf2c('0x30')]=_[_0xaf2c('0x46')](_0x2091eb[_0xaf2c('0x30')]);_0x8ebb65[_0xaf2c('0x31')]=_[_0xaf2c('0x32')](_0x8ebb65[_0xaf2c('0x2f')],_0x8ebb65[_0xaf2c('0x30')]);_0x2056b8['attributes']=_['intersection'](_0x8ebb65[_0xaf2c('0x2f')],qs['fields'](_0x2091eb['query']['fields']));_0x2056b8[_0xaf2c('0x33')]=_0x2056b8[_0xaf2c('0x33')][_0xaf2c('0x34')]?_0x2056b8[_0xaf2c('0x33')]:_0x8ebb65['model'];if(_0x2091eb[_0xaf2c('0x30')]['includeAll']){_0x2056b8[_0xaf2c('0x47')]=[{'all':!![]}];}_0x2056b8=_['merge']({},_0x2056b8,_0x2091eb[_0xaf2c('0x3f')]);return db[_0xaf2c('0x40')][_0xaf2c('0x48')](_0x2056b8)[_0xaf2c('0x23')](handleEntityNotFound(_0x532d5f,null))[_0xaf2c('0x23')](respondWithResult(_0x532d5f,null))['catch'](handleError(_0x532d5f,null));};exports[_0xaf2c('0x49')]=function(_0x26afee,_0x4b3ca4){return db['AnalyticMetric'][_0xaf2c('0x49')](_0x26afee['body'],{})[_0xaf2c('0x23')](function(_0x23642b){var _0x17b9ec=_0x26afee[_0xaf2c('0x4a')][_0xaf2c('0x24')]({'plain':!![]});if(!_0x17b9ec)throw new Error(_0xaf2c('0x4b'));if(_0x17b9ec[_0xaf2c('0x4c')]===_0xaf2c('0x4a')){var _0x31ccfe=_0x23642b[_0xaf2c('0x24')]({'plain':!![]});var _0x371486='Metrics';return db[_0xaf2c('0x4d')][_0xaf2c('0x48')]({'where':{'name':_0x371486,'userProfileId':_0x17b9ec['userProfileId']},'raw':!![]})['then'](function(_0x56d7ce){if(_0x56d7ce&&_0x56d7ce[_0xaf2c('0x4e')]===0x0){return db[_0xaf2c('0x26')]['create']({'name':_0x31ccfe[_0xaf2c('0x29')],'resourceId':_0x31ccfe['id'],'type':_0x56d7ce[_0xaf2c('0x29')],'sectionId':_0x56d7ce['id']},{})[_0xaf2c('0x23')](function(){return _0x23642b;});}else{return _0x23642b;}})[_0xaf2c('0x45')](function(_0x265748){logger[_0xaf2c('0x4f')](_0xaf2c('0x50'),_0x265748);throw _0x265748;});}return _0x23642b;})['then'](respondWithResult(_0x4b3ca4,0xc9))[_0xaf2c('0x45')](handleError(_0x4b3ca4,null));};exports[_0xaf2c('0x51')]=function(_0x5771e5,_0x245797){if(_0x5771e5[_0xaf2c('0x52')]['id']){delete _0x5771e5[_0xaf2c('0x52')]['id'];}return db[_0xaf2c('0x40')][_0xaf2c('0x48')]({'where':{'id':_0x5771e5[_0xaf2c('0x53')]['id']}})[_0xaf2c('0x23')](handleEntityNotFound(_0x245797,null))[_0xaf2c('0x23')](saveUpdates(_0x5771e5[_0xaf2c('0x52')],null))[_0xaf2c('0x23')](respondWithResult(_0x245797,null))[_0xaf2c('0x45')](handleError(_0x245797,null));};exports[_0xaf2c('0x27')]=function(_0x411e84,_0x2356a0){return db[_0xaf2c('0x40')][_0xaf2c('0x48')]({'where':{'id':_0x411e84[_0xaf2c('0x53')]['id']}})[_0xaf2c('0x23')](handleEntityNotFound(_0x2356a0,null))[_0xaf2c('0x23')](removeEntity(_0x2356a0,null))[_0xaf2c('0x45')](handleError(_0x2356a0,null));}; \ No newline at end of file +var _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(_0x4662ac,_0x9f4a17){var _0x5c34be=function(_0x135b23){while(--_0x135b23){_0x4662ac['push'](_0x4662ac['shift']());}};_0x5c34be(++_0x9f4a17);}(_0x9a19,0x114));var _0x99a1=function(_0x609988,_0x507944){_0x609988=_0x609988-0x0;var _0x159984=_0x9a19[_0x609988];return _0x159984;};'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 diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index 081d858..4793267 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 _0x78e0=['request-promise','path','./analyticMetric.attributes','exports','define','analytics_metrics','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x8ec947,_0x444fa2){var _0x115d2b=function(_0x4cbd1a){while(--_0x4cbd1a){_0x8ec947['push'](_0x8ec947['shift']());}};_0x115d2b(++_0x444fa2);}(_0x78e0,0x13e));var _0x078e=function(_0x584291,_0x24b5b3){_0x584291=_0x584291-0x0;var _0x4e7d08=_0x78e0[_0x584291];return _0x4e7d08;};'use strict';var _=require(_0x078e('0x0'));var util=require(_0x078e('0x1'));var logger=require(_0x078e('0x2'))(_0x078e('0x3'));var moment=require(_0x078e('0x4'));var BPromise=require(_0x078e('0x5'));var rp=require(_0x078e('0x6'));var fs=require('fs');var path=require(_0x078e('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x078e('0x8'));module[_0x078e('0x9')]=function(_0x8e71c,_0x35578b){return _0x8e71c[_0x078e('0xa')]('AnalyticMetric',attributes,{'tableName':_0x078e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xab9f=['../../config/environment','exports','define','AnalyticMetric','analytics_metrics','lodash','../../config/logger','api','moment','request-promise','path'];(function(_0x58d9d8,_0x448c53){var _0x5e8cb0=function(_0xb262e1){while(--_0xb262e1){_0x58d9d8['push'](_0x58d9d8['shift']());}};_0x5e8cb0(++_0x448c53);}(_0xab9f,0x1bd));var _0xfab9=function(_0x3d4768,_0x5a378f){_0x3d4768=_0x3d4768-0x0;var _0x4984d4=_0xab9f[_0x3d4768];return _0x4984d4;};'use strict';var _=require(_0xfab9('0x0'));var util=require('util');var logger=require(_0xfab9('0x1'))(_0xfab9('0x2'));var moment=require(_0xfab9('0x3'));var BPromise=require('bluebird');var rp=require(_0xfab9('0x4'));var fs=require('fs');var path=require(_0xfab9('0x5'));var rimraf=require('rimraf');var config=require(_0xfab9('0x6'));var attributes=require('./analyticMetric.attributes');module[_0xfab9('0x7')]=function(_0x54ae20,_0x1bfe77){return _0x54ae20[_0xfab9('0x8')](_0xfab9('0x9'),attributes,{'tableName':_0xfab9('0xa'),'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 8986ee4..380d3e1 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 _0x0f3f=['util','bluebird','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','then','info','request\x20sent','AnalyticMetric,\x20%s,\x20%s,\x20%s','error','code','AnalyticMetric,\x20%s,\x20%s','message','catch'];(function(_0x321ccf,_0x2e780d){var _0x3a9a2a=function(_0x3291c2){while(--_0x3291c2){_0x321ccf['push'](_0x321ccf['shift']());}};_0x3a9a2a(++_0x2e780d);}(_0x0f3f,0xaa));var _0xf0f3=function(_0xdb5808,_0x58c067){_0xdb5808=_0xdb5808-0x0;var _0x111072=_0x0f3f[_0xdb5808];return _0x111072;};'use strict';var _=require('lodash');var util=require(_0xf0f3('0x0'));var moment=require('moment');var BPromise=require(_0xf0f3('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf0f3('0x2'))['db'];var utils=require(_0xf0f3('0x3'));var logger=require('../../config/logger')(_0xf0f3('0x4'));var config=require('../../config/environment');var jayson=require(_0xf0f3('0x5'));var client=jayson[_0xf0f3('0x6')][_0xf0f3('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x21b15a,_0x3bb7a3,_0x4a63b1){return new BPromise(function(_0x1b8576,_0x192b5b){return client['request'](_0x21b15a,_0x4a63b1)[_0xf0f3('0x8')](function(_0x1666ab){logger[_0xf0f3('0x9')]('AnalyticMetric,\x20%s,\x20%s',_0x3bb7a3,_0xf0f3('0xa'));logger['debug'](_0xf0f3('0xb'),_0x3bb7a3,_0xf0f3('0xa'),JSON['stringify'](_0x1666ab));if(_0x1666ab[_0xf0f3('0xc')]){if(_0x1666ab[_0xf0f3('0xc')][_0xf0f3('0xd')]===0x1f4){logger[_0xf0f3('0xc')](_0xf0f3('0xe'),_0x3bb7a3,_0x1666ab[_0xf0f3('0xc')][_0xf0f3('0xf')]);return _0x192b5b(_0x1666ab['error'][_0xf0f3('0xf')]);}logger[_0xf0f3('0xc')](_0xf0f3('0xe'),_0x3bb7a3,_0x1666ab['error']['message']);return _0x1b8576(_0x1666ab[_0xf0f3('0xc')][_0xf0f3('0xf')]);}else{logger[_0xf0f3('0x9')](_0xf0f3('0xe'),_0x3bb7a3,_0xf0f3('0xa'));_0x1b8576(_0x1666ab['result'][_0xf0f3('0xf')]);}})[_0xf0f3('0x10')](function(_0xcde8b3){logger[_0xf0f3('0xc')]('AnalyticMetric,\x20%s,\x20%s',_0x3bb7a3,_0xcde8b3);_0x192b5b(_0xcde8b3);});});} \ No newline at end of file +var _0xd290=['code','message','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x29e3b6,_0x40b0b4){var _0x55d4b0=function(_0x55c58e){while(--_0x55c58e){_0x29e3b6['push'](_0x29e3b6['shift']());}};_0x55d4b0(++_0x40b0b4);}(_0xd290,0x1a5));var _0x0d29=function(_0xfc455c,_0x46f310){_0xfc455c=_0xfc455c-0x0;var _0x1b26e8=_0xd290[_0xfc455c];return _0x1b26e8;};'use strict';var _=require(_0x0d29('0x0'));var util=require(_0x0d29('0x1'));var moment=require(_0x0d29('0x2'));var BPromise=require('bluebird');var rs=require(_0x0d29('0x3'));var fs=require('fs');var Redis=require(_0x0d29('0x4'));var db=require(_0x0d29('0x5'))['db'];var utils=require(_0x0d29('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x0d29('0x7'));var jayson=require(_0x0d29('0x8'));var client=jayson[_0x0d29('0x9')][_0x0d29('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1a6d0e,_0x1402fe,_0x50a2db){return new BPromise(function(_0x57c5cd,_0x3244c6){return client[_0x0d29('0xb')](_0x1a6d0e,_0x50a2db)[_0x0d29('0xc')](function(_0x582481){logger[_0x0d29('0xd')](_0x0d29('0xe'),_0x1402fe,_0x0d29('0xf'));logger['debug'](_0x0d29('0x10'),_0x1402fe,'request\x20sent',JSON[_0x0d29('0x11')](_0x582481));if(_0x582481[_0x0d29('0x12')]){if(_0x582481['error'][_0x0d29('0x13')]===0x1f4){logger['error'](_0x0d29('0xe'),_0x1402fe,_0x582481[_0x0d29('0x12')]['message']);return _0x3244c6(_0x582481[_0x0d29('0x12')][_0x0d29('0x14')]);}logger[_0x0d29('0x12')](_0x0d29('0xe'),_0x1402fe,_0x582481[_0x0d29('0x12')][_0x0d29('0x14')]);return _0x57c5cd(_0x582481[_0x0d29('0x12')][_0x0d29('0x14')]);}else{logger[_0x0d29('0xd')]('AnalyticMetric,\x20%s,\x20%s',_0x1402fe,_0x0d29('0xf'));_0x57c5cd(_0x582481[_0x0d29('0x15')][_0x0d29('0x14')]);}})['catch'](function(_0x1b4509){logger[_0x0d29('0x12')](_0x0d29('0xe'),_0x1402fe,_0x1b4509);_0x3244c6(_0x1b4509);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index 29e5c85..70bb1d1 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 _0xdf70=['exports','multer','util','path','express','Router','../../components/auth/service','../../config/environment','./analyticMetric.controller','isAuthenticated','index','get','show','post','create','put','update','delete','destroy'];(function(_0x2737ea,_0x1477af){var _0x21a61f=function(_0x2deb03){while(--_0x2deb03){_0x2737ea['push'](_0x2737ea['shift']());}};_0x21a61f(++_0x1477af);}(_0xdf70,0x86));var _0x0df7=function(_0x424bd7,_0x70a909){_0x424bd7=_0x424bd7-0x0;var _0x4f5672=_0xdf70[_0x424bd7];return _0x4f5672;};'use strict';var multer=require(_0x0df7('0x0'));var util=require(_0x0df7('0x1'));var path=require(_0x0df7('0x2'));var timeout=require('connect-timeout');var express=require(_0x0df7('0x3'));var router=express[_0x0df7('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x0df7('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0df7('0x6'));var controller=require(_0x0df7('0x7'));router['get']('/',auth[_0x0df7('0x8')](),controller[_0x0df7('0x9')]);router[_0x0df7('0xa')]('/:id',auth[_0x0df7('0x8')](),controller[_0x0df7('0xb')]);router[_0x0df7('0xc')]('/',auth[_0x0df7('0x8')](),controller[_0x0df7('0xd')]);router[_0x0df7('0xe')]('/:id',auth[_0x0df7('0x8')](),controller[_0x0df7('0xf')]);router[_0x0df7('0x10')]('/:id',auth[_0x0df7('0x8')](),controller[_0x0df7('0x11')]);module[_0x0df7('0x12')]=router; \ No newline at end of file +var _0x3248=['Router','fs-extra','../../config/environment','./analyticMetric.controller','isAuthenticated','index','get','/:id','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x5a035f,_0x411b09){var _0x40ca6d=function(_0x3335af){while(--_0x3335af){_0x5a035f['push'](_0x5a035f['shift']());}};_0x40ca6d(++_0x411b09);}(_0x3248,0x1b0));var _0x8324=function(_0x33e6fb,_0xb69a1b){_0x33e6fb=_0x33e6fb-0x0;var _0x4ab89c=_0x3248[_0x33e6fb];return _0x4ab89c;};'use strict';var multer=require(_0x8324('0x0'));var util=require(_0x8324('0x1'));var path=require(_0x8324('0x2'));var timeout=require(_0x8324('0x3'));var express=require(_0x8324('0x4'));var router=express[_0x8324('0x5')]();var fs_extra=require(_0x8324('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x8324('0x7'));var controller=require(_0x8324('0x8'));router['get']('/',auth[_0x8324('0x9')](),controller[_0x8324('0xa')]);router[_0x8324('0xb')](_0x8324('0xc'),auth[_0x8324('0x9')](),controller['show']);router[_0x8324('0xd')]('/',auth[_0x8324('0x9')](),controller[_0x8324('0xe')]);router['put']('/:id',auth[_0x8324('0x9')](),controller[_0x8324('0xf')]);router[_0x8324('0x10')]('/:id',auth[_0x8324('0x9')](),controller[_0x8324('0x11')]);module[_0x8324('0x12')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index dd331bc..efd2b8c 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 _0xc4a4=['TEXT','sequelize','exports'];(function(_0x506081,_0x2399e2){var _0xb6802b=function(_0x15f3bc){while(--_0x15f3bc){_0x506081['push'](_0x506081['shift']());}};_0xb6802b(++_0x2399e2);}(_0xc4a4,0x1e7));var _0x4c4a=function(_0x21aec3,_0x5c97e9){_0x21aec3=_0x21aec3-0x0;var _0x288bbc=_0xc4a4[_0x21aec3];return _0x288bbc;};'use strict';var Sequelize=require(_0x4c4a('0x0'));module[_0x4c4a('0x1')]={'tree':{'type':Sequelize[_0x4c4a('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x4bb1=['exports','TEXT','sequelize'];(function(_0x52dfa5,_0x3908fd){var _0x1eaf0b=function(_0x1d01c7){while(--_0x1d01c7){_0x52dfa5['push'](_0x52dfa5['shift']());}};_0x1eaf0b(++_0x3908fd);}(_0x4bb1,0x1d9));var _0x14bb=function(_0x22b68a,_0x2bffc3){_0x22b68a=_0x22b68a-0x0;var _0x1ac67a=_0x4bb1[_0x22b68a];return _0x1ac67a;};'use strict';var Sequelize=require(_0x14bb('0x0'));module[_0x14bb('0x1')]={'tree':{'type':Sequelize[_0x14bb('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index 67acd4d..cbff465 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 _0x935c=['json','reject','save','update','then','destroy','error','stack','name','send','index','map','AnalyticTreeReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','limit','undefined','count','offset','set'];(function(_0x35d775,_0x25431e){var _0x59384d=function(_0x1a0c15){while(--_0x1a0c15){_0x35d775['push'](_0x35d775['shift']());}};_0x59384d(++_0x25431e);}(_0x935c,0x119));var _0xc935=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x935c[_0x413feb];return _0x40ee88;};'use strict';var emlformat=require(_0xc935('0x0'));var rimraf=require(_0xc935('0x1'));var zipdir=require(_0xc935('0x2'));var jsonpatch=require(_0xc935('0x3'));var rp=require(_0xc935('0x4'));var moment=require(_0xc935('0x5'));var BPromise=require(_0xc935('0x6'));var Mustache=require('mustache');var util=require(_0xc935('0x7'));var path=require(_0xc935('0x8'));var sox=require(_0xc935('0x9'));var csv=require(_0xc935('0xa'));var ejs=require(_0xc935('0xb'));var fs=require('fs');var fs_extra=require(_0xc935('0xc'));var _=require(_0xc935('0xd'));var squel=require(_0xc935('0xe'));var crypto=require('crypto');var jsforce=require(_0xc935('0xf'));var deskjs=require(_0xc935('0x10'));var toCsv=require(_0xc935('0xa'));var querystring=require('querystring');var Papa=require(_0xc935('0x11'));var Redis=require('ioredis');var authService=require(_0xc935('0x12'));var qs=require(_0xc935('0x13'));var as=require(_0xc935('0x14'));var hardwareService=require(_0xc935('0x15'));var logger=require(_0xc935('0x16'))(_0xc935('0x17'));var utils=require(_0xc935('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xc935('0x19'));var db=require(_0xc935('0x1a'))['db'];function respondWithStatusCode(_0x44811c,_0x23c41e){_0x23c41e=_0x23c41e||0xcc;return function(_0x574278){if(_0x574278){return _0x44811c[_0xc935('0x1b')](_0x23c41e);}return _0x44811c[_0xc935('0x1c')](_0x23c41e)[_0xc935('0x1d')]();};}function respondWithResult(_0x57eeba,_0x4faf2e){_0x4faf2e=_0x4faf2e||0xc8;return function(_0x39a7f2){if(_0x39a7f2){return _0x57eeba['status'](_0x4faf2e)['json'](_0x39a7f2);}};}function respondWithFilteredResult(_0x5431db,_0xa498f9){return function(_0x5e6326){if(_0x5e6326){var _0x22414e=typeof _0xa498f9['offset']==='undefined'&&typeof _0xa498f9[_0xc935('0x1e')]===_0xc935('0x1f');var _0x39b302=_0x5e6326[_0xc935('0x20')];var _0x5557d0=_0x22414e?0x0:_0xa498f9[_0xc935('0x21')];var _0x3bdd94=_0x22414e?_0x5e6326[_0xc935('0x20')]:_0xa498f9['offset']+_0xa498f9[_0xc935('0x1e')];var _0x26dbe7;if(_0x3bdd94>=_0x39b302){_0x3bdd94=_0x39b302;_0x26dbe7=0xc8;}else{_0x26dbe7=0xce;}_0x5431db[_0xc935('0x1c')](_0x26dbe7);return _0x5431db[_0xc935('0x22')]('Content-Range',_0x5557d0+'-'+_0x3bdd94+'/'+_0x39b302)[_0xc935('0x23')](_0x5e6326);}return null;};}function patchUpdates(_0x13f3ca){return function(_0xf49eeb){try{jsonpatch['apply'](_0xf49eeb,_0x13f3ca,!![]);}catch(_0x3f4f87){return BPromise[_0xc935('0x24')](_0x3f4f87);}return _0xf49eeb[_0xc935('0x25')]();};}function saveUpdates(_0x25038a,_0x1b3423){return function(_0x3ce2d7){if(_0x3ce2d7){return _0x3ce2d7[_0xc935('0x26')](_0x25038a)[_0xc935('0x27')](function(_0x5eb07f){return _0x5eb07f;});}return null;};}function removeEntity(_0x16ad11,_0x60d7b4){return function(_0x2b9c17){if(_0x2b9c17){return _0x2b9c17[_0xc935('0x28')]()[_0xc935('0x27')](function(){_0x16ad11[_0xc935('0x1c')](0xcc)[_0xc935('0x1d')]();});}};}function handleEntityNotFound(_0x4b66f2,_0x166939){return function(_0x240b12){if(!_0x240b12){_0x4b66f2[_0xc935('0x1b')](0x194);}return _0x240b12;};}function handleError(_0x4cb515,_0x4dd241){_0x4dd241=_0x4dd241||0x1f4;return function(_0x45d0cc){logger[_0xc935('0x29')](_0x45d0cc[_0xc935('0x2a')]);if(_0x45d0cc[_0xc935('0x2b')]){delete _0x45d0cc[_0xc935('0x2b')];}_0x4cb515[_0xc935('0x1c')](_0x4dd241)[_0xc935('0x2c')](_0x45d0cc);};}exports[_0xc935('0x2d')]=function(_0x5252ee,_0x35f813){var _0x2631b0={},_0x21e31e={},_0x36883d={'count':0x0,'rows':[]};var _0xbb385e=_[_0xc935('0x2e')](db[_0xc935('0x2f')][_0xc935('0x30')],function(_0x394fc1){return{'name':_0x394fc1[_0xc935('0x31')],'type':_0x394fc1[_0xc935('0x32')][_0xc935('0x33')]};});_0x21e31e[_0xc935('0x34')]=_[_0xc935('0x2e')](_0xbb385e,_0xc935('0x2b'));_0x21e31e[_0xc935('0x35')]=_[_0xc935('0x36')](_0x5252ee[_0xc935('0x35')]);_0x21e31e[_0xc935('0x37')]=_[_0xc935('0x38')](_0x21e31e['model'],_0x21e31e[_0xc935('0x35')]);_0x2631b0[_0xc935('0x39')]=_[_0xc935('0x38')](_0x21e31e['model'],qs['fields'](_0x5252ee['query'][_0xc935('0x3a')]));_0x2631b0['attributes']=_0x2631b0[_0xc935('0x39')][_0xc935('0x3b')]?_0x2631b0['attributes']:_0x21e31e['model'];if(!_0x5252ee[_0xc935('0x35')][_0xc935('0x3c')](_0xc935('0x3d'))){_0x2631b0['limit']=qs[_0xc935('0x1e')](_0x5252ee[_0xc935('0x35')][_0xc935('0x1e')]);_0x2631b0[_0xc935('0x21')]=qs[_0xc935('0x21')](_0x5252ee[_0xc935('0x35')][_0xc935('0x21')]);}_0x2631b0[_0xc935('0x3e')]=qs[_0xc935('0x3f')](_0x5252ee['query'][_0xc935('0x3f')]);_0x2631b0[_0xc935('0x40')]=qs['filters'](_[_0xc935('0x41')](_0x5252ee[_0xc935('0x35')],_0x21e31e[_0xc935('0x37')]),_0xbb385e);if(_0x5252ee[_0xc935('0x35')]['filter']){_0x2631b0['where']=_[_0xc935('0x42')](_0x2631b0['where'],{'$or':_['map'](_0xbb385e,function(_0x4eb167){if(_0x4eb167[_0xc935('0x32')]!=='VIRTUAL'){var _0x6f4ff2={};_0x6f4ff2[_0x4eb167['name']]={'$like':'%'+_0x5252ee[_0xc935('0x35')][_0xc935('0x43')]+'%'};return _0x6f4ff2;}})});}_0x2631b0=_[_0xc935('0x42')]({},_0x2631b0,_0x5252ee[_0xc935('0x44')]);var _0x20866f={'where':_0x2631b0[_0xc935('0x40')]};return db[_0xc935('0x2f')][_0xc935('0x20')](_0x20866f)[_0xc935('0x27')](function(_0x5b3154){_0x36883d[_0xc935('0x20')]=_0x5b3154;if(_0x5252ee[_0xc935('0x35')][_0xc935('0x45')]){_0x2631b0[_0xc935('0x46')]=[{'all':!![]}];}return db[_0xc935('0x2f')][_0xc935('0x47')](_0x2631b0);})[_0xc935('0x27')](function(_0x349fcb){_0x36883d[_0xc935('0x48')]=_0x349fcb;return _0x36883d;})[_0xc935('0x27')](respondWithFilteredResult(_0x35f813,_0x2631b0))[_0xc935('0x49')](handleError(_0x35f813,null));};exports[_0xc935('0x4a')]=function(_0x190eb8,_0x24fdbe){var _0x2b744b={'raw':!![],'where':{'id':_0x190eb8[_0xc935('0x4b')]['id']}},_0x500af8={};_0x500af8[_0xc935('0x34')]=_[_0xc935('0x36')](db['AnalyticTreeReport'][_0xc935('0x30')]);_0x500af8[_0xc935('0x35')]=_[_0xc935('0x36')](_0x190eb8[_0xc935('0x35')]);_0x500af8[_0xc935('0x37')]=_[_0xc935('0x38')](_0x500af8[_0xc935('0x34')],_0x500af8[_0xc935('0x35')]);_0x2b744b[_0xc935('0x39')]=_['intersection'](_0x500af8[_0xc935('0x34')],qs[_0xc935('0x3a')](_0x190eb8[_0xc935('0x35')]['fields']));_0x2b744b[_0xc935('0x39')]=_0x2b744b[_0xc935('0x39')]['length']?_0x2b744b[_0xc935('0x39')]:_0x500af8['model'];if(_0x190eb8[_0xc935('0x35')]['includeAll']){_0x2b744b['include']=[{'all':!![]}];}_0x2b744b=_[_0xc935('0x42')]({},_0x2b744b,_0x190eb8['options']);return db[_0xc935('0x2f')][_0xc935('0x4c')](_0x2b744b)[_0xc935('0x27')](handleEntityNotFound(_0x24fdbe,null))[_0xc935('0x27')](respondWithResult(_0x24fdbe,null))['catch'](handleError(_0x24fdbe,null));};exports[_0xc935('0x4d')]=function(_0xe6a1f9,_0x463fcc){return db['AnalyticTreeReport']['create'](_0xe6a1f9[_0xc935('0x4e')],{})[_0xc935('0x27')](respondWithResult(_0x463fcc,0xc9))[_0xc935('0x49')](handleError(_0x463fcc,null));};exports[_0xc935('0x26')]=function(_0x5b47f7,_0x2228ed){if(_0x5b47f7['body']['id']){delete _0x5b47f7[_0xc935('0x4e')]['id'];}return db[_0xc935('0x2f')]['find']({'where':{'id':_0x5b47f7[_0xc935('0x4b')]['id']}})[_0xc935('0x27')](handleEntityNotFound(_0x2228ed,null))[_0xc935('0x27')](saveUpdates(_0x5b47f7[_0xc935('0x4e')],null))[_0xc935('0x27')](respondWithResult(_0x2228ed,null))['catch'](handleError(_0x2228ed,null));};exports[_0xc935('0x28')]=function(_0x516211,_0x1a64cc){return db[_0xc935('0x2f')][_0xc935('0x4c')]({'where':{'id':_0x516211[_0xc935('0x4b')]['id']}})[_0xc935('0x27')](handleEntityNotFound(_0x1a64cc,null))[_0xc935('0x27')](removeEntity(_0x1a64cc,null))['catch'](handleError(_0x1a64cc,null));}; \ No newline at end of file +var _0x144a=['ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','fieldName','key','query','keys','filters','model','attributes','intersection','length','hasOwnProperty','where','pick','filter','merge','type','VIRTUAL','options','AnalyticTreeReport','includeAll','include','findAll','rows','catch','show','params','rawAttributes','fields','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv'];(function(_0x257642,_0x270a80){var _0x3d813b=function(_0x2a1c8a){while(--_0x2a1c8a){_0x257642['push'](_0x257642['shift']());}};_0x3d813b(++_0x270a80);}(_0x144a,0x12e));var _0xa144=function(_0x2cbc3d,_0x22dc87){_0x2cbc3d=_0x2cbc3d-0x0;var _0x38ed63=_0x144a[_0x2cbc3d];return _0x38ed63;};'use strict';var emlformat=require(_0xa144('0x0'));var rimraf=require(_0xa144('0x1'));var zipdir=require(_0xa144('0x2'));var jsonpatch=require(_0xa144('0x3'));var rp=require(_0xa144('0x4'));var moment=require(_0xa144('0x5'));var BPromise=require(_0xa144('0x6'));var Mustache=require(_0xa144('0x7'));var util=require('util');var path=require('path');var sox=require(_0xa144('0x8'));var csv=require(_0xa144('0x9'));var ejs=require(_0xa144('0xa'));var fs=require('fs');var fs_extra=require(_0xa144('0xb'));var _=require(_0xa144('0xc'));var squel=require(_0xa144('0xd'));var crypto=require(_0xa144('0xe'));var jsforce=require(_0xa144('0xf'));var deskjs=require(_0xa144('0x10'));var toCsv=require('to-csv');var querystring=require(_0xa144('0x11'));var Papa=require(_0xa144('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xa144('0x13'));var as=require(_0xa144('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa144('0x15'))(_0xa144('0x16'));var utils=require(_0xa144('0x17'));var config=require(_0xa144('0x18'));var licenseUtil=require(_0xa144('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x324f76,_0x495399){_0x495399=_0x495399||0xcc;return function(_0x588930){if(_0x588930){return _0x324f76[_0xa144('0x1a')](_0x495399);}return _0x324f76[_0xa144('0x1b')](_0x495399)[_0xa144('0x1c')]();};}function respondWithResult(_0x13a17c,_0x40fa67){_0x40fa67=_0x40fa67||0xc8;return function(_0x280900){if(_0x280900){return _0x13a17c['status'](_0x40fa67)[_0xa144('0x1d')](_0x280900);}};}function respondWithFilteredResult(_0x556805,_0x5b15fd){return function(_0x5e0087){if(_0x5e0087){var _0x35cc3d=typeof _0x5b15fd['offset']===_0xa144('0x1e')&&typeof _0x5b15fd['limit']===_0xa144('0x1e');var _0xd7b1cb=_0x5e0087[_0xa144('0x1f')];var _0xb524c5=_0x35cc3d?0x0:_0x5b15fd[_0xa144('0x20')];var _0x8e61c4=_0x35cc3d?_0x5e0087[_0xa144('0x1f')]:_0x5b15fd['offset']+_0x5b15fd[_0xa144('0x21')];var _0x256172;if(_0x8e61c4>=_0xd7b1cb){_0x8e61c4=_0xd7b1cb;_0x256172=0xc8;}else{_0x256172=0xce;}_0x556805['status'](_0x256172);return _0x556805[_0xa144('0x22')](_0xa144('0x23'),_0xb524c5+'-'+_0x8e61c4+'/'+_0xd7b1cb)[_0xa144('0x1d')](_0x5e0087);}return null;};}function patchUpdates(_0x1b2a8b){return function(_0x2285aa){try{jsonpatch[_0xa144('0x24')](_0x2285aa,_0x1b2a8b,!![]);}catch(_0x33899c){return BPromise[_0xa144('0x25')](_0x33899c);}return _0x2285aa[_0xa144('0x26')]();};}function saveUpdates(_0x1105c6,_0x11e4f7){return function(_0x520e76){if(_0x520e76){return _0x520e76[_0xa144('0x27')](_0x1105c6)[_0xa144('0x28')](function(_0x26fb19){return _0x26fb19;});}return null;};}function removeEntity(_0x57c33f,_0x1a829c){return function(_0x4e321b){if(_0x4e321b){return _0x4e321b[_0xa144('0x29')]()[_0xa144('0x28')](function(){_0x57c33f[_0xa144('0x1b')](0xcc)[_0xa144('0x1c')]();});}};}function handleEntityNotFound(_0xd6390,_0x33ee8d){return function(_0x472228){if(!_0x472228){_0xd6390['sendStatus'](0x194);}return _0x472228;};}function handleError(_0x44b7e6,_0x3045a3){_0x3045a3=_0x3045a3||0x1f4;return function(_0x3aa575){logger[_0xa144('0x2a')](_0x3aa575[_0xa144('0x2b')]);if(_0x3aa575[_0xa144('0x2c')]){delete _0x3aa575[_0xa144('0x2c')];}_0x44b7e6[_0xa144('0x1b')](_0x3045a3)[_0xa144('0x2d')](_0x3aa575);};}exports[_0xa144('0x2e')]=function(_0x3c17d9,_0x3b5f02){var _0x868078={},_0x2d15ab={},_0x5d1382={'count':0x0,'rows':[]};var _0x3f4379=_[_0xa144('0x2f')](db['AnalyticTreeReport']['rawAttributes'],function(_0x1f8683){return{'name':_0x1f8683[_0xa144('0x30')],'type':_0x1f8683['type'][_0xa144('0x31')]};});_0x2d15ab['model']=_['map'](_0x3f4379,'name');_0x2d15ab[_0xa144('0x32')]=_[_0xa144('0x33')](_0x3c17d9['query']);_0x2d15ab[_0xa144('0x34')]=_['intersection'](_0x2d15ab[_0xa144('0x35')],_0x2d15ab[_0xa144('0x32')]);_0x868078[_0xa144('0x36')]=_[_0xa144('0x37')](_0x2d15ab['model'],qs['fields'](_0x3c17d9[_0xa144('0x32')]['fields']));_0x868078[_0xa144('0x36')]=_0x868078[_0xa144('0x36')][_0xa144('0x38')]?_0x868078[_0xa144('0x36')]:_0x2d15ab['model'];if(!_0x3c17d9[_0xa144('0x32')][_0xa144('0x39')]('nolimit')){_0x868078['limit']=qs[_0xa144('0x21')](_0x3c17d9[_0xa144('0x32')][_0xa144('0x21')]);_0x868078['offset']=qs[_0xa144('0x20')](_0x3c17d9['query']['offset']);}_0x868078['order']=qs['sort'](_0x3c17d9[_0xa144('0x32')]['sort']);_0x868078[_0xa144('0x3a')]=qs['filters'](_[_0xa144('0x3b')](_0x3c17d9[_0xa144('0x32')],_0x2d15ab[_0xa144('0x34')]),_0x3f4379);if(_0x3c17d9['query'][_0xa144('0x3c')]){_0x868078['where']=_[_0xa144('0x3d')](_0x868078[_0xa144('0x3a')],{'$or':_[_0xa144('0x2f')](_0x3f4379,function(_0x15c97a){if(_0x15c97a[_0xa144('0x3e')]!==_0xa144('0x3f')){var _0x58796b={};_0x58796b[_0x15c97a[_0xa144('0x2c')]]={'$like':'%'+_0x3c17d9['query']['filter']+'%'};return _0x58796b;}})});}_0x868078=_[_0xa144('0x3d')]({},_0x868078,_0x3c17d9[_0xa144('0x40')]);var _0x2bfde8={'where':_0x868078['where']};return db[_0xa144('0x41')]['count'](_0x2bfde8)[_0xa144('0x28')](function(_0x1355bd){_0x5d1382[_0xa144('0x1f')]=_0x1355bd;if(_0x3c17d9[_0xa144('0x32')][_0xa144('0x42')]){_0x868078[_0xa144('0x43')]=[{'all':!![]}];}return db[_0xa144('0x41')][_0xa144('0x44')](_0x868078);})[_0xa144('0x28')](function(_0x47525e){_0x5d1382[_0xa144('0x45')]=_0x47525e;return _0x5d1382;})['then'](respondWithFilteredResult(_0x3b5f02,_0x868078))[_0xa144('0x46')](handleError(_0x3b5f02,null));};exports[_0xa144('0x47')]=function(_0x157fc5,_0xea816){var _0x3170bb={'raw':!![],'where':{'id':_0x157fc5[_0xa144('0x48')]['id']}},_0x28b948={};_0x28b948['model']=_[_0xa144('0x33')](db[_0xa144('0x41')][_0xa144('0x49')]);_0x28b948[_0xa144('0x32')]=_[_0xa144('0x33')](_0x157fc5[_0xa144('0x32')]);_0x28b948[_0xa144('0x34')]=_['intersection'](_0x28b948['model'],_0x28b948[_0xa144('0x32')]);_0x3170bb[_0xa144('0x36')]=_[_0xa144('0x37')](_0x28b948[_0xa144('0x35')],qs['fields'](_0x157fc5[_0xa144('0x32')][_0xa144('0x4a')]));_0x3170bb['attributes']=_0x3170bb[_0xa144('0x36')][_0xa144('0x38')]?_0x3170bb[_0xa144('0x36')]:_0x28b948[_0xa144('0x35')];if(_0x157fc5[_0xa144('0x32')][_0xa144('0x42')]){_0x3170bb[_0xa144('0x43')]=[{'all':!![]}];}_0x3170bb=_[_0xa144('0x3d')]({},_0x3170bb,_0x157fc5[_0xa144('0x40')]);return db['AnalyticTreeReport'][_0xa144('0x4b')](_0x3170bb)['then'](handleEntityNotFound(_0xea816,null))[_0xa144('0x28')](respondWithResult(_0xea816,null))[_0xa144('0x46')](handleError(_0xea816,null));};exports[_0xa144('0x4c')]=function(_0x3cc43c,_0x327ce1){return db[_0xa144('0x41')]['create'](_0x3cc43c['body'],{})[_0xa144('0x28')](respondWithResult(_0x327ce1,0xc9))['catch'](handleError(_0x327ce1,null));};exports['update']=function(_0x1b24ef,_0x48260e){if(_0x1b24ef[_0xa144('0x4d')]['id']){delete _0x1b24ef['body']['id'];}return db[_0xa144('0x41')][_0xa144('0x4b')]({'where':{'id':_0x1b24ef['params']['id']}})[_0xa144('0x28')](handleEntityNotFound(_0x48260e,null))[_0xa144('0x28')](saveUpdates(_0x1b24ef[_0xa144('0x4d')],null))['then'](respondWithResult(_0x48260e,null))[_0xa144('0x46')](handleError(_0x48260e,null));};exports['destroy']=function(_0x19a4fa,_0x191290){return db[_0xa144('0x41')][_0xa144('0x4b')]({'where':{'id':_0x19a4fa[_0xa144('0x48')]['id']}})[_0xa144('0x28')](handleEntityNotFound(_0x191290,null))['then'](removeEntity(_0x191290,null))[_0xa144('0x46')](handleError(_0x191290,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index beecadc..02c118c 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 _0x797f=['../../config/environment','AnalyticTreeReport','analytics_report_trees','lodash','util','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x592c4f,_0xe8a4f0){var _0x57ad00=function(_0x38a436){while(--_0x38a436){_0x592c4f['push'](_0x592c4f['shift']());}};_0x57ad00(++_0xe8a4f0);}(_0x797f,0x116));var _0xf797=function(_0x3d356a,_0x2bddd6){_0x3d356a=_0x3d356a-0x0;var _0x2968c3=_0x797f[_0x3d356a];return _0x2968c3;};'use strict';var _=require(_0xf797('0x0'));var util=require(_0xf797('0x1'));var logger=require('../../config/logger')(_0xf797('0x2'));var moment=require(_0xf797('0x3'));var BPromise=require(_0xf797('0x4'));var rp=require(_0xf797('0x5'));var fs=require('fs');var path=require(_0xf797('0x6'));var rimraf=require(_0xf797('0x7'));var config=require(_0xf797('0x8'));var attributes=require('./analyticTreeReport.attributes');module['exports']=function(_0x539edb,_0x831cce){return _0x539edb['define'](_0xf797('0x9'),attributes,{'tableName':_0xf797('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4b3e=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./analyticTreeReport.attributes','exports','AnalyticTreeReport','analytics_report_trees'];(function(_0x537afd,_0x54272d){var _0x52434b=function(_0x521439){while(--_0x521439){_0x537afd['push'](_0x537afd['shift']());}};_0x52434b(++_0x54272d);}(_0x4b3e,0x1d9));var _0xe4b3=function(_0xbd08b4,_0x4790ed){_0xbd08b4=_0xbd08b4-0x0;var _0x314f1e=_0x4b3e[_0xbd08b4];return _0x314f1e;};'use strict';var _=require('lodash');var util=require(_0xe4b3('0x0'));var logger=require(_0xe4b3('0x1'))('api');var moment=require(_0xe4b3('0x2'));var BPromise=require(_0xe4b3('0x3'));var rp=require(_0xe4b3('0x4'));var fs=require('fs');var path=require(_0xe4b3('0x5'));var rimraf=require(_0xe4b3('0x6'));var config=require('../../config/environment');var attributes=require(_0xe4b3('0x7'));module[_0xe4b3('0x8')]=function(_0x32a3b1,_0x5ca25a){return _0x32a3b1['define'](_0xe4b3('0x9'),attributes,{'tableName':_0xe4b3('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.rpc.js b/server/api/analyticTreeReport/analyticTreeReport.rpc.js index 4ee7771..a01cf03 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 _0xadb5=['error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x17968b,_0xd64399){var _0x4eabd9=function(_0x33d186){while(--_0x33d186){_0x17968b['push'](_0x17968b['shift']());}};_0x4eabd9(++_0xd64399);}(_0xadb5,0xad));var _0x5adb=function(_0x231771,_0x11c1ed){_0x231771=_0x231771-0x0;var _0x461384=_0xadb5[_0x231771];return _0x461384;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var moment=require('moment');var BPromise=require(_0x5adb('0x1'));var rs=require(_0x5adb('0x2'));var fs=require('fs');var Redis=require(_0x5adb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));var config=require('../../config/environment');var jayson=require(_0x5adb('0x7'));var client=jayson[_0x5adb('0x8')][_0x5adb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3213e8,_0xdf3776,_0x353885){return new BPromise(function(_0x47228a,_0x6d1b45){return client[_0x5adb('0xa')](_0x3213e8,_0x353885)[_0x5adb('0xb')](function(_0x34f59d){logger[_0x5adb('0xc')](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));logger['debug']('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0xdf3776,_0x5adb('0xe'),JSON[_0x5adb('0xf')](_0x34f59d));if(_0x34f59d[_0x5adb('0x10')]){if(_0x34f59d['error'][_0x5adb('0x11')]===0x1f4){logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d['error'][_0x5adb('0x12')]);return _0x6d1b45(_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);}logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);return _0x47228a(_0x34f59d['error'][_0x5adb('0x12')]);}else{logger['info'](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));_0x47228a(_0x34f59d[_0x5adb('0x13')][_0x5adb('0x12')]);}})[_0x5adb('0x14')](function(_0x39d24d){logger[_0x5adb('0x10')](_0x5adb('0xd'),_0xdf3776,_0x39d24d);_0x6d1b45(_0x39d24d);});});} \ No newline at end of file +var _0x2ef3=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','AnalyticTreeReport,\x20%s,\x20%s','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment'];(function(_0x5b8cf2,_0x244949){var _0x1cb461=function(_0x4ed542){while(--_0x4ed542){_0x5b8cf2['push'](_0x5b8cf2['shift']());}};_0x1cb461(++_0x244949);}(_0x2ef3,0xba));var _0x32ef=function(_0x67047c,_0x258a69){_0x67047c=_0x67047c-0x0;var _0x234da7=_0x2ef3[_0x67047c];return _0x234da7;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var moment=require(_0x32ef('0x2'));var BPromise=require(_0x32ef('0x3'));var rs=require(_0x32ef('0x4'));var fs=require('fs');var Redis=require(_0x32ef('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x32ef('0x6'));var logger=require(_0x32ef('0x7'))('rpc');var config=require(_0x32ef('0x8'));var jayson=require(_0x32ef('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2c0089,_0x4bfcf8,_0x367c39){return new BPromise(function(_0x2fb8eb,_0x234863){return client[_0x32ef('0xa')](_0x2c0089,_0x367c39)[_0x32ef('0xb')](function(_0x2bbb50){logger[_0x32ef('0xc')](_0x32ef('0xd'),_0x4bfcf8,'request\x20sent');logger['debug'](_0x32ef('0xe'),_0x4bfcf8,_0x32ef('0xf'),JSON[_0x32ef('0x10')](_0x2bbb50));if(_0x2bbb50[_0x32ef('0x11')]){if(_0x2bbb50['error'][_0x32ef('0x12')]===0x1f4){logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x234863(_0x2bbb50[_0x32ef('0x11')]['message']);}logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x2fb8eb(_0x2bbb50[_0x32ef('0x11')][_0x32ef('0x13')]);}else{logger[_0x32ef('0xc')]('AnalyticTreeReport,\x20%s,\x20%s',_0x4bfcf8,'request\x20sent');_0x2fb8eb(_0x2bbb50['result'][_0x32ef('0x13')]);}})[_0x32ef('0x14')](function(_0xb5aed2){logger['error']('AnalyticTreeReport,\x20%s,\x20%s',_0x4bfcf8,_0xb5aed2);_0x234863(_0xb5aed2);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index bca47f4..a688022 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 _0xab3d=['/:id','show','post','create','update','delete','exports','multer','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index'];(function(_0x3f97fd,_0x3474c7){var _0x5a2aa1=function(_0xe407b3){while(--_0xe407b3){_0x3f97fd['push'](_0x3f97fd['shift']());}};_0x5a2aa1(++_0x3474c7);}(_0xab3d,0x8e));var _0xdab3=function(_0x1dd167,_0x54b2cf){_0x1dd167=_0x1dd167-0x0;var _0x4bb1c3=_0xab3d[_0x1dd167];return _0x4bb1c3;};'use strict';var multer=require(_0xdab3('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xdab3('0x1')]();var fs_extra=require(_0xdab3('0x2'));var auth=require(_0xdab3('0x3'));var interaction=require(_0xdab3('0x4'));var config=require('../../config/environment');var controller=require('./analyticTreeReport.controller');router[_0xdab3('0x5')]('/',auth[_0xdab3('0x6')](),controller[_0xdab3('0x7')]);router[_0xdab3('0x5')](_0xdab3('0x8'),auth[_0xdab3('0x6')](),controller[_0xdab3('0x9')]);router[_0xdab3('0xa')]('/',auth['isAuthenticated'](),controller[_0xdab3('0xb')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xdab3('0xc')]);router[_0xdab3('0xd')](_0xdab3('0x8'),auth['isAuthenticated'](),controller['destroy']);module[_0xdab3('0xe')]=router; \ No newline at end of file +var _0xd897=['/:id','destroy','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','get','isAuthenticated','index','update','delete'];(function(_0x4c12ec,_0x2e9103){var _0x3ae42c=function(_0x5a728f){while(--_0x5a728f){_0x4c12ec['push'](_0x4c12ec['shift']());}};_0x3ae42c(++_0x2e9103);}(_0xd897,0xe0));var _0x7d89=function(_0x162ae9,_0x1142e){_0x162ae9=_0x162ae9-0x0;var _0x1a01cd=_0xd897[_0x162ae9];return _0x1a01cd;};'use strict';var multer=require('multer');var util=require(_0x7d89('0x0'));var path=require(_0x7d89('0x1'));var timeout=require('connect-timeout');var express=require(_0x7d89('0x2'));var router=express[_0x7d89('0x3')]();var fs_extra=require(_0x7d89('0x4'));var auth=require(_0x7d89('0x5'));var interaction=require(_0x7d89('0x6'));var config=require(_0x7d89('0x7'));var controller=require(_0x7d89('0x8'));router[_0x7d89('0x9')]('/',auth[_0x7d89('0xa')](),controller[_0x7d89('0xb')]);router[_0x7d89('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x7d89('0xa')](),controller['create']);router['put']('/:id',auth[_0x7d89('0xa')](),controller[_0x7d89('0xc')]);router[_0x7d89('0xd')](_0x7d89('0xe'),auth[_0x7d89('0xa')](),controller[_0x7d89('0xf')]);module[_0x7d89('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 c22a2ba..93f8c55 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 _0x3402=['sequelize','STRING'];(function(_0x15f347,_0x547ffe){var _0x3045a6=function(_0x3f8f3a){while(--_0x3f8f3a){_0x15f347['push'](_0x15f347['shift']());}};_0x3045a6(++_0x547ffe);}(_0x3402,0x1f0));var _0x2340=function(_0x4ac571,_0x2fcc14){_0x4ac571=_0x4ac571-0x0;var _0x468a70=_0x3402[_0x4ac571];return _0x468a70;};'use strict';var Sequelize=require(_0x2340('0x0'));module['exports']={'name':{'type':Sequelize[_0x2340('0x1')]},'basename':{'type':Sequelize[_0x2340('0x1')]},'type':{'type':Sequelize[_0x2340('0x1')]}}; \ No newline at end of file +var _0x6726=['STRING','exports'];(function(_0x34c2e7,_0x400617){var _0x4fbaf0=function(_0x9df4f7){while(--_0x9df4f7){_0x34c2e7['push'](_0x34c2e7['shift']());}};_0x4fbaf0(++_0x400617);}(_0x6726,0xdb));var _0x6672=function(_0x2f6541,_0x363cba){_0x2f6541=_0x2f6541-0x0;var _0x4d76d8=_0x6726[_0x2f6541];return _0x4d76d8;};'use strict';var Sequelize=require('sequelize');module[_0x6672('0x0')]={'name':{'type':Sequelize[_0x6672('0x1')]},'basename':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x6672('0x1')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index 3ad54bf..a3e1b30 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 _0x7ac0=['filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','options','include','findAll','catch','params','find','includeAll','get','omit','createdAt','body','updatedAt','create','file','basename','filename','mimetype','findOne','join','root','server/files/attachments/','rimraf','fast-json-patch','request-promise','moment','bluebird','path','sox','fs-extra','lodash','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/environment','../../config/license/util','../../mysqldb','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','Attachment','fieldName','key','model','query','keys'];(function(_0x32cec0,_0x2e0061){var _0x350cc3=function(_0x564091){while(--_0x564091){_0x32cec0['push'](_0x32cec0['shift']());}};_0x350cc3(++_0x2e0061);}(_0x7ac0,0x17f));var _0x07ac=function(_0x5c54de,_0x1e09b1){_0x5c54de=_0x5c54de-0x0;var _0x466304=_0x7ac0[_0x5c54de];return _0x466304;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x07ac('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x07ac('0x1'));var rp=require(_0x07ac('0x2'));var moment=require(_0x07ac('0x3'));var BPromise=require(_0x07ac('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x07ac('0x5'));var sox=require(_0x07ac('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x07ac('0x7'));var _=require(_0x07ac('0x8'));var squel=require('squel');var crypto=require(_0x07ac('0x9'));var jsforce=require(_0x07ac('0xa'));var deskjs=require(_0x07ac('0xb'));var toCsv=require(_0x07ac('0xc'));var querystring=require(_0x07ac('0xd'));var Papa=require('papaparse');var Redis=require(_0x07ac('0xe'));var authService=require(_0x07ac('0xf'));var qs=require(_0x07ac('0x10'));var as=require(_0x07ac('0x11'));var hardwareService=require(_0x07ac('0x12'));var logger=require(_0x07ac('0x13'))('api');var utils=require(_0x07ac('0x14'));var config=require(_0x07ac('0x15'));var licenseUtil=require(_0x07ac('0x16'));var db=require(_0x07ac('0x17'))['db'];function respondWithStatusCode(_0x4663e2,_0x392b8c){_0x392b8c=_0x392b8c||0xcc;return function(_0x4f314a){if(_0x4f314a){return _0x4663e2['sendStatus'](_0x392b8c);}return _0x4663e2[_0x07ac('0x18')](_0x392b8c)[_0x07ac('0x19')]();};}function respondWithResult(_0x3cc594,_0x444dec){_0x444dec=_0x444dec||0xc8;return function(_0x454429){if(_0x454429){return _0x3cc594[_0x07ac('0x18')](_0x444dec)['json'](_0x454429);}};}function respondWithFilteredResult(_0x33a6c9,_0x5666f8){return function(_0x185eb2){if(_0x185eb2){var _0x48d2a1=typeof _0x5666f8['offset']===_0x07ac('0x1a')&&typeof _0x5666f8[_0x07ac('0x1b')]===_0x07ac('0x1a');var _0x2cf5a1=_0x185eb2[_0x07ac('0x1c')];var _0x1accf8=_0x48d2a1?0x0:_0x5666f8[_0x07ac('0x1d')];var _0x14203c=_0x48d2a1?_0x185eb2[_0x07ac('0x1c')]:_0x5666f8[_0x07ac('0x1d')]+_0x5666f8[_0x07ac('0x1b')];var _0x21391c;if(_0x14203c>=_0x2cf5a1){_0x14203c=_0x2cf5a1;_0x21391c=0xc8;}else{_0x21391c=0xce;}_0x33a6c9[_0x07ac('0x18')](_0x21391c);return _0x33a6c9[_0x07ac('0x1e')](_0x07ac('0x1f'),_0x1accf8+'-'+_0x14203c+'/'+_0x2cf5a1)[_0x07ac('0x20')](_0x185eb2);}return null;};}function patchUpdates(_0x1e0580){return function(_0x763708){try{jsonpatch[_0x07ac('0x21')](_0x763708,_0x1e0580,!![]);}catch(_0x405e0a){return BPromise[_0x07ac('0x22')](_0x405e0a);}return _0x763708[_0x07ac('0x23')]();};}function saveUpdates(_0x4d6dc1,_0x1f2f27){return function(_0x52e29c){if(_0x52e29c){return _0x52e29c[_0x07ac('0x24')](_0x4d6dc1)[_0x07ac('0x25')](function(_0x2ed2a6){return _0x2ed2a6;});}return null;};}function removeEntity(_0x44c855,_0x5d3e05){return function(_0x20c77b){if(_0x20c77b){return _0x20c77b[_0x07ac('0x26')]()[_0x07ac('0x25')](function(){_0x44c855[_0x07ac('0x18')](0xcc)[_0x07ac('0x19')]();});}};}function handleEntityNotFound(_0x5effb1,_0x4f7e37){return function(_0x5219f1){if(!_0x5219f1){_0x5effb1[_0x07ac('0x27')](0x194);}return _0x5219f1;};}function handleError(_0x3d2065,_0x32638b){_0x32638b=_0x32638b||0x1f4;return function(_0x189b79){logger[_0x07ac('0x28')](_0x189b79[_0x07ac('0x29')]);if(_0x189b79['name']){delete _0x189b79[_0x07ac('0x2a')];}_0x3d2065[_0x07ac('0x18')](_0x32638b)[_0x07ac('0x2b')](_0x189b79);};}exports[_0x07ac('0x2c')]=function(_0x2b4482,_0x22f9d8){var _0x395212={},_0x11c820={},_0x12bde0={'count':0x0,'rows':[]};var _0x4bddfb=_[_0x07ac('0x2d')](db[_0x07ac('0x2e')]['rawAttributes'],function(_0x2a9378){return{'name':_0x2a9378[_0x07ac('0x2f')],'type':_0x2a9378['type'][_0x07ac('0x30')]};});_0x11c820[_0x07ac('0x31')]=_['map'](_0x4bddfb,_0x07ac('0x2a'));_0x11c820[_0x07ac('0x32')]=_[_0x07ac('0x33')](_0x2b4482['query']);_0x11c820[_0x07ac('0x34')]=_[_0x07ac('0x35')](_0x11c820[_0x07ac('0x31')],_0x11c820['query']);_0x395212[_0x07ac('0x36')]=_['intersection'](_0x11c820[_0x07ac('0x31')],qs[_0x07ac('0x37')](_0x2b4482['query']['fields']));_0x395212[_0x07ac('0x36')]=_0x395212[_0x07ac('0x36')][_0x07ac('0x38')]?_0x395212[_0x07ac('0x36')]:_0x11c820[_0x07ac('0x31')];if(!_0x2b4482['query'][_0x07ac('0x39')](_0x07ac('0x3a'))){_0x395212[_0x07ac('0x1b')]=qs[_0x07ac('0x1b')](_0x2b4482['query'][_0x07ac('0x1b')]);_0x395212[_0x07ac('0x1d')]=qs[_0x07ac('0x1d')](_0x2b4482['query']['offset']);}_0x395212[_0x07ac('0x3b')]=qs[_0x07ac('0x3c')](_0x2b4482[_0x07ac('0x32')][_0x07ac('0x3c')]);_0x395212[_0x07ac('0x3d')]=qs[_0x07ac('0x34')](_[_0x07ac('0x3e')](_0x2b4482[_0x07ac('0x32')],_0x11c820['filters']),_0x4bddfb);if(_0x2b4482[_0x07ac('0x32')][_0x07ac('0x3f')]){_0x395212[_0x07ac('0x3d')]=_[_0x07ac('0x40')](_0x395212[_0x07ac('0x3d')],{'$or':_[_0x07ac('0x2d')](_0x4bddfb,function(_0x35c7fb){if(_0x35c7fb[_0x07ac('0x41')]!=='VIRTUAL'){var _0x221372={};_0x221372[_0x35c7fb[_0x07ac('0x2a')]]={'$like':'%'+_0x2b4482['query']['filter']+'%'};return _0x221372;}})});}_0x395212=_[_0x07ac('0x40')]({},_0x395212,_0x2b4482[_0x07ac('0x42')]);var _0x490e5c={'where':_0x395212[_0x07ac('0x3d')]};return db[_0x07ac('0x2e')][_0x07ac('0x1c')](_0x490e5c)[_0x07ac('0x25')](function(_0x1e9e18){_0x12bde0[_0x07ac('0x1c')]=_0x1e9e18;if(_0x2b4482[_0x07ac('0x32')]['includeAll']){_0x395212[_0x07ac('0x43')]=[{'all':!![]}];}return db['Attachment'][_0x07ac('0x44')](_0x395212);})[_0x07ac('0x25')](function(_0x3b7f93){_0x12bde0['rows']=_0x3b7f93;return _0x12bde0;})[_0x07ac('0x25')](respondWithFilteredResult(_0x22f9d8,_0x395212))[_0x07ac('0x45')](handleError(_0x22f9d8,null));};exports['show']=function(_0x24894c,_0xd4d114){var _0xf08f4a={'raw':!![],'where':{'id':_0x24894c[_0x07ac('0x46')]['id']}},_0x16a50f={};_0x16a50f[_0x07ac('0x31')]=_[_0x07ac('0x33')](db[_0x07ac('0x2e')]['rawAttributes']);_0x16a50f[_0x07ac('0x32')]=_[_0x07ac('0x33')](_0x24894c[_0x07ac('0x32')]);_0x16a50f[_0x07ac('0x34')]=_[_0x07ac('0x35')](_0x16a50f['model'],_0x16a50f[_0x07ac('0x32')]);_0xf08f4a['attributes']=_[_0x07ac('0x35')](_0x16a50f[_0x07ac('0x31')],qs[_0x07ac('0x37')](_0x24894c[_0x07ac('0x32')][_0x07ac('0x37')]));_0xf08f4a[_0x07ac('0x36')]=_0xf08f4a[_0x07ac('0x36')][_0x07ac('0x38')]?_0xf08f4a[_0x07ac('0x36')]:_0x16a50f[_0x07ac('0x31')];if(_0x24894c[_0x07ac('0x32')]['includeAll']){_0xf08f4a['include']=[{'all':!![]}];}_0xf08f4a=_['merge']({},_0xf08f4a,_0x24894c[_0x07ac('0x42')]);return db[_0x07ac('0x2e')][_0x07ac('0x47')](_0xf08f4a)[_0x07ac('0x25')](handleEntityNotFound(_0xd4d114,null))[_0x07ac('0x25')](respondWithResult(_0xd4d114,null))['catch'](handleError(_0xd4d114,null));};exports['clone']=function(_0x36f241,_0x41b078){var _0x188387={'where':{'id':_0x36f241[_0x07ac('0x46')]['id']}},_0x3b517b={};_0x3b517b['model']=_[_0x07ac('0x33')](db['Attachment']['rawAttributes']);_0x188387['attributes']=_[_0x07ac('0x35')](_0x3b517b['model'],qs[_0x07ac('0x37')](_0x36f241[_0x07ac('0x32')][_0x07ac('0x37')]));_0x188387[_0x07ac('0x36')]=_0x188387['attributes'][_0x07ac('0x38')]?_0x188387['attributes']:_0x3b517b[_0x07ac('0x31')];if(_0x36f241[_0x07ac('0x32')][_0x07ac('0x48')]){_0x188387['include']=[{'all':!![]}];}_0x188387=_[_0x07ac('0x40')]({},_0x188387,_0x36f241[_0x07ac('0x42')]);return db['Attachment']['find'](_0x188387)['then'](handleEntityNotFound(_0x41b078,null))[_0x07ac('0x25')](function(_0x86b1fd){if(_0x86b1fd){var _0x4024ae=_0x86b1fd[_0x07ac('0x49')]({'plain':!![]});_0x4024ae=qs[_0x07ac('0x4a')](_0x4024ae,['id',_0x07ac('0x4b'),'updatedAt']);_0x36f241[_0x07ac('0x4c')]=_[_0x07ac('0x4a')](_0x36f241[_0x07ac('0x4c')],['id',_0x07ac('0x4b'),_0x07ac('0x4d')]);return db['Attachment'][_0x07ac('0x4e')](_[_0x07ac('0x40')](_0x4024ae,_0x36f241[_0x07ac('0x4c')]),{'include':_0x36f241[_0x07ac('0x32')][_0x07ac('0x48')]?[{'all':!![]}]:undefined});}})[_0x07ac('0x25')](respondWithResult(_0x41b078,0xc9))[_0x07ac('0x45')](handleError(_0x41b078,null));};exports[_0x07ac('0x24')]=function(_0x3f300e,_0x249313){if(_0x3f300e[_0x07ac('0x4c')]['id']){delete _0x3f300e['body']['id'];}return db[_0x07ac('0x2e')][_0x07ac('0x47')]({'where':{'id':_0x3f300e[_0x07ac('0x46')]['id']}})[_0x07ac('0x25')](handleEntityNotFound(_0x249313,null))[_0x07ac('0x25')](saveUpdates(_0x3f300e[_0x07ac('0x4c')],null))[_0x07ac('0x25')](respondWithResult(_0x249313,null))['catch'](handleError(_0x249313,null));};exports[_0x07ac('0x26')]=function(_0x11b542,_0x1b31b4){return db[_0x07ac('0x2e')][_0x07ac('0x47')]({'where':{'id':_0x11b542[_0x07ac('0x46')]['id']}})['then'](handleEntityNotFound(_0x1b31b4,null))[_0x07ac('0x25')](removeEntity(_0x1b31b4,null))[_0x07ac('0x45')](handleError(_0x1b31b4,null));};exports[_0x07ac('0x4e')]=function(_0x59f2ca,_0xc3ef09,_0x1911d9){_0x59f2ca[_0x07ac('0x4c')]['name']=_0x59f2ca[_0x07ac('0x4f')]['originalname'];_0x59f2ca[_0x07ac('0x4c')][_0x07ac('0x50')]=_0x59f2ca['file'][_0x07ac('0x51')];_0x59f2ca[_0x07ac('0x4c')]['type']=_0x59f2ca['file'][_0x07ac('0x52')];return db[_0x07ac('0x2e')][_0x07ac('0x4e')](_0x59f2ca[_0x07ac('0x4c')])[_0x07ac('0x25')](respondWithResult(_0xc3ef09,0xc9))['catch'](handleError(_0xc3ef09,null));};exports['download']=function(_0x19950f,_0x2e94e1,_0x88b03c){return db[_0x07ac('0x2e')][_0x07ac('0x53')]({'where':{'id':_0x19950f['params']['id']},'raw':!![]})[_0x07ac('0x25')](handleEntityNotFound(_0x2e94e1,null))[_0x07ac('0x25')](function(_0x4553d5){if(_0x4553d5){var _0x54dea7=_0x4553d5['ChatOfflineMessageId']!==null;var _0x20e77e=path[_0x07ac('0x54')](config[_0x07ac('0x55')],_0x07ac('0x56'));if(_0x54dea7){_0x20e77e=path[_0x07ac('0x54')](_0x20e77e,'offline-chat/');}var _0x51bd2f=path[_0x07ac('0x54')](_0x20e77e,_0x4553d5[_0x07ac('0x50')]);return _0x2e94e1['download'](_0x51bd2f);}})[_0x07ac('0x45')](handleError(_0x2e94e1,null));}; \ No newline at end of file +var _0x7756=['download','findOne','join','server/files/attachments/','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','undefined','count','offset','limit','set','Content-Range','save','then','destroy','error','stack','name','index','rawAttributes','fieldName','type','key','model','query','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','map','VIRTUAL','options','Attachment','includeAll','findAll','rows','catch','show','include','find','clone','params','keys','createdAt','omit','body','updatedAt','create','update','file','originalname','basename','filename','mimetype'];(function(_0x59b5ca,_0x16875f){var _0x426a26=function(_0x46ebd7){while(--_0x46ebd7){_0x59b5ca['push'](_0x59b5ca['shift']());}};_0x426a26(++_0x16875f);}(_0x7756,0xb4));var _0x6775=function(_0x50dc29,_0x18b6fe){_0x50dc29=_0x50dc29-0x0;var _0x1e06d2=_0x7756[_0x50dc29];return _0x1e06d2;};'use strict';var emlformat=require(_0x6775('0x0'));var rimraf=require(_0x6775('0x1'));var zipdir=require(_0x6775('0x2'));var jsonpatch=require(_0x6775('0x3'));var rp=require(_0x6775('0x4'));var moment=require(_0x6775('0x5'));var BPromise=require(_0x6775('0x6'));var Mustache=require('mustache');var util=require(_0x6775('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x6775('0x8'));var ejs=require(_0x6775('0x9'));var fs=require('fs');var fs_extra=require(_0x6775('0xa'));var _=require(_0x6775('0xb'));var squel=require('squel');var crypto=require(_0x6775('0xc'));var jsforce=require(_0x6775('0xd'));var deskjs=require(_0x6775('0xe'));var toCsv=require(_0x6775('0x8'));var querystring=require('querystring');var Papa=require(_0x6775('0xf'));var Redis=require('ioredis');var authService=require(_0x6775('0x10'));var qs=require(_0x6775('0x11'));var as=require(_0x6775('0x12'));var hardwareService=require(_0x6775('0x13'));var logger=require(_0x6775('0x14'))(_0x6775('0x15'));var utils=require(_0x6775('0x16'));var config=require(_0x6775('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x6775('0x18'))['db'];function respondWithStatusCode(_0x4f34e3,_0x2f23aa){_0x2f23aa=_0x2f23aa||0xcc;return function(_0x167c2a){if(_0x167c2a){return _0x4f34e3[_0x6775('0x19')](_0x2f23aa);}return _0x4f34e3['status'](_0x2f23aa)[_0x6775('0x1a')]();};}function respondWithResult(_0x37e9b,_0x1db649){_0x1db649=_0x1db649||0xc8;return function(_0x252bd6){if(_0x252bd6){return _0x37e9b[_0x6775('0x1b')](_0x1db649)[_0x6775('0x1c')](_0x252bd6);}};}function respondWithFilteredResult(_0x2a7b19,_0x4e60e0){return function(_0x1ec27c){if(_0x1ec27c){var _0x162c71=typeof _0x4e60e0['offset']===_0x6775('0x1d')&&typeof _0x4e60e0['limit']===_0x6775('0x1d');var _0x3fc836=_0x1ec27c[_0x6775('0x1e')];var _0x213442=_0x162c71?0x0:_0x4e60e0[_0x6775('0x1f')];var _0x5ee1e6=_0x162c71?_0x1ec27c[_0x6775('0x1e')]:_0x4e60e0[_0x6775('0x1f')]+_0x4e60e0[_0x6775('0x20')];var _0x9bfff6;if(_0x5ee1e6>=_0x3fc836){_0x5ee1e6=_0x3fc836;_0x9bfff6=0xc8;}else{_0x9bfff6=0xce;}_0x2a7b19['status'](_0x9bfff6);return _0x2a7b19[_0x6775('0x21')](_0x6775('0x22'),_0x213442+'-'+_0x5ee1e6+'/'+_0x3fc836)[_0x6775('0x1c')](_0x1ec27c);}return null;};}function patchUpdates(_0x18934b){return function(_0x43bac1){try{jsonpatch['apply'](_0x43bac1,_0x18934b,!![]);}catch(_0xedd3e5){return BPromise['reject'](_0xedd3e5);}return _0x43bac1[_0x6775('0x23')]();};}function saveUpdates(_0x3e23e3,_0x1b3c93){return function(_0x4dc3a5){if(_0x4dc3a5){return _0x4dc3a5['update'](_0x3e23e3)[_0x6775('0x24')](function(_0xa9acc9){return _0xa9acc9;});}return null;};}function removeEntity(_0x1fee0f,_0x5f510){return function(_0x1011d1){if(_0x1011d1){return _0x1011d1[_0x6775('0x25')]()['then'](function(){_0x1fee0f[_0x6775('0x1b')](0xcc)[_0x6775('0x1a')]();});}};}function handleEntityNotFound(_0x44c07d,_0x5a19ba){return function(_0x4b578e){if(!_0x4b578e){_0x44c07d[_0x6775('0x19')](0x194);}return _0x4b578e;};}function handleError(_0x509054,_0x270171){_0x270171=_0x270171||0x1f4;return function(_0x3f111b){logger[_0x6775('0x26')](_0x3f111b[_0x6775('0x27')]);if(_0x3f111b['name']){delete _0x3f111b[_0x6775('0x28')];}_0x509054[_0x6775('0x1b')](_0x270171)['send'](_0x3f111b);};}exports[_0x6775('0x29')]=function(_0x164a81,_0x3f1c92){var _0xe509e9={},_0xc885a3={},_0x286d14={'count':0x0,'rows':[]};var _0x6a141b=_['map'](db['Attachment'][_0x6775('0x2a')],function(_0x56e1a5){return{'name':_0x56e1a5[_0x6775('0x2b')],'type':_0x56e1a5[_0x6775('0x2c')][_0x6775('0x2d')]};});_0xc885a3[_0x6775('0x2e')]=_['map'](_0x6a141b,'name');_0xc885a3[_0x6775('0x2f')]=_['keys'](_0x164a81[_0x6775('0x2f')]);_0xc885a3['filters']=_[_0x6775('0x30')](_0xc885a3[_0x6775('0x2e')],_0xc885a3[_0x6775('0x2f')]);_0xe509e9['attributes']=_[_0x6775('0x30')](_0xc885a3[_0x6775('0x2e')],qs[_0x6775('0x31')](_0x164a81[_0x6775('0x2f')]['fields']));_0xe509e9['attributes']=_0xe509e9[_0x6775('0x32')]['length']?_0xe509e9['attributes']:_0xc885a3[_0x6775('0x2e')];if(!_0x164a81[_0x6775('0x2f')][_0x6775('0x33')](_0x6775('0x34'))){_0xe509e9['limit']=qs['limit'](_0x164a81[_0x6775('0x2f')][_0x6775('0x20')]);_0xe509e9['offset']=qs[_0x6775('0x1f')](_0x164a81[_0x6775('0x2f')][_0x6775('0x1f')]);}_0xe509e9[_0x6775('0x35')]=qs[_0x6775('0x36')](_0x164a81['query']['sort']);_0xe509e9[_0x6775('0x37')]=qs[_0x6775('0x38')](_['pick'](_0x164a81[_0x6775('0x2f')],_0xc885a3[_0x6775('0x38')]),_0x6a141b);if(_0x164a81['query'][_0x6775('0x39')]){_0xe509e9['where']=_[_0x6775('0x3a')](_0xe509e9[_0x6775('0x37')],{'$or':_[_0x6775('0x3b')](_0x6a141b,function(_0x35ef45){if(_0x35ef45[_0x6775('0x2c')]!==_0x6775('0x3c')){var _0x5b8394={};_0x5b8394[_0x35ef45[_0x6775('0x28')]]={'$like':'%'+_0x164a81['query'][_0x6775('0x39')]+'%'};return _0x5b8394;}})});}_0xe509e9=_[_0x6775('0x3a')]({},_0xe509e9,_0x164a81[_0x6775('0x3d')]);var _0x57022e={'where':_0xe509e9[_0x6775('0x37')]};return db[_0x6775('0x3e')][_0x6775('0x1e')](_0x57022e)[_0x6775('0x24')](function(_0x138c4d){_0x286d14[_0x6775('0x1e')]=_0x138c4d;if(_0x164a81[_0x6775('0x2f')][_0x6775('0x3f')]){_0xe509e9['include']=[{'all':!![]}];}return db[_0x6775('0x3e')][_0x6775('0x40')](_0xe509e9);})[_0x6775('0x24')](function(_0x486d22){_0x286d14[_0x6775('0x41')]=_0x486d22;return _0x286d14;})['then'](respondWithFilteredResult(_0x3f1c92,_0xe509e9))[_0x6775('0x42')](handleError(_0x3f1c92,null));};exports[_0x6775('0x43')]=function(_0x28579d,_0x11a8ef){var _0x10a071={'raw':!![],'where':{'id':_0x28579d['params']['id']}},_0x3312e2={};_0x3312e2[_0x6775('0x2e')]=_['keys'](db[_0x6775('0x3e')][_0x6775('0x2a')]);_0x3312e2[_0x6775('0x2f')]=_['keys'](_0x28579d[_0x6775('0x2f')]);_0x3312e2[_0x6775('0x38')]=_[_0x6775('0x30')](_0x3312e2[_0x6775('0x2e')],_0x3312e2[_0x6775('0x2f')]);_0x10a071[_0x6775('0x32')]=_[_0x6775('0x30')](_0x3312e2[_0x6775('0x2e')],qs['fields'](_0x28579d[_0x6775('0x2f')][_0x6775('0x31')]));_0x10a071['attributes']=_0x10a071['attributes']['length']?_0x10a071['attributes']:_0x3312e2[_0x6775('0x2e')];if(_0x28579d[_0x6775('0x2f')][_0x6775('0x3f')]){_0x10a071[_0x6775('0x44')]=[{'all':!![]}];}_0x10a071=_[_0x6775('0x3a')]({},_0x10a071,_0x28579d[_0x6775('0x3d')]);return db[_0x6775('0x3e')][_0x6775('0x45')](_0x10a071)[_0x6775('0x24')](handleEntityNotFound(_0x11a8ef,null))[_0x6775('0x24')](respondWithResult(_0x11a8ef,null))[_0x6775('0x42')](handleError(_0x11a8ef,null));};exports[_0x6775('0x46')]=function(_0x439a63,_0x13353f){var _0x4cbe20={'where':{'id':_0x439a63[_0x6775('0x47')]['id']}},_0x491bcd={};_0x491bcd[_0x6775('0x2e')]=_[_0x6775('0x48')](db[_0x6775('0x3e')][_0x6775('0x2a')]);_0x4cbe20[_0x6775('0x32')]=_[_0x6775('0x30')](_0x491bcd[_0x6775('0x2e')],qs[_0x6775('0x31')](_0x439a63[_0x6775('0x2f')][_0x6775('0x31')]));_0x4cbe20[_0x6775('0x32')]=_0x4cbe20['attributes']['length']?_0x4cbe20[_0x6775('0x32')]:_0x491bcd[_0x6775('0x2e')];if(_0x439a63[_0x6775('0x2f')][_0x6775('0x3f')]){_0x4cbe20[_0x6775('0x44')]=[{'all':!![]}];}_0x4cbe20=_[_0x6775('0x3a')]({},_0x4cbe20,_0x439a63[_0x6775('0x3d')]);return db[_0x6775('0x3e')][_0x6775('0x45')](_0x4cbe20)[_0x6775('0x24')](handleEntityNotFound(_0x13353f,null))[_0x6775('0x24')](function(_0x428bfe){if(_0x428bfe){var _0x143d4f=_0x428bfe['get']({'plain':!![]});_0x143d4f=qs['omit'](_0x143d4f,['id',_0x6775('0x49'),'updatedAt']);_0x439a63['body']=_[_0x6775('0x4a')](_0x439a63[_0x6775('0x4b')],['id',_0x6775('0x49'),_0x6775('0x4c')]);return db[_0x6775('0x3e')][_0x6775('0x4d')](_[_0x6775('0x3a')](_0x143d4f,_0x439a63['body']),{'include':_0x439a63['query']['includeAll']?[{'all':!![]}]:undefined});}})[_0x6775('0x24')](respondWithResult(_0x13353f,0xc9))[_0x6775('0x42')](handleError(_0x13353f,null));};exports[_0x6775('0x4e')]=function(_0x4adddc,_0x24c60f){if(_0x4adddc['body']['id']){delete _0x4adddc[_0x6775('0x4b')]['id'];}return db[_0x6775('0x3e')]['find']({'where':{'id':_0x4adddc[_0x6775('0x47')]['id']}})[_0x6775('0x24')](handleEntityNotFound(_0x24c60f,null))['then'](saveUpdates(_0x4adddc[_0x6775('0x4b')],null))['then'](respondWithResult(_0x24c60f,null))[_0x6775('0x42')](handleError(_0x24c60f,null));};exports[_0x6775('0x25')]=function(_0x399c1e,_0x2ef3d3){return db[_0x6775('0x3e')][_0x6775('0x45')]({'where':{'id':_0x399c1e[_0x6775('0x47')]['id']}})[_0x6775('0x24')](handleEntityNotFound(_0x2ef3d3,null))[_0x6775('0x24')](removeEntity(_0x2ef3d3,null))[_0x6775('0x42')](handleError(_0x2ef3d3,null));};exports[_0x6775('0x4d')]=function(_0x5f762b,_0x2273d0,_0x107ad7){_0x5f762b[_0x6775('0x4b')][_0x6775('0x28')]=_0x5f762b[_0x6775('0x4f')][_0x6775('0x50')];_0x5f762b['body'][_0x6775('0x51')]=_0x5f762b['file'][_0x6775('0x52')];_0x5f762b[_0x6775('0x4b')]['type']=_0x5f762b[_0x6775('0x4f')][_0x6775('0x53')];return db[_0x6775('0x3e')][_0x6775('0x4d')](_0x5f762b[_0x6775('0x4b')])[_0x6775('0x24')](respondWithResult(_0x2273d0,0xc9))[_0x6775('0x42')](handleError(_0x2273d0,null));};exports[_0x6775('0x54')]=function(_0x3bc1ed,_0x26201e,_0x55eefd){return db[_0x6775('0x3e')][_0x6775('0x55')]({'where':{'id':_0x3bc1ed['params']['id']},'raw':!![]})[_0x6775('0x24')](handleEntityNotFound(_0x26201e,null))[_0x6775('0x24')](function(_0x1ff3fd){if(_0x1ff3fd){var _0x28544f=_0x1ff3fd['ChatOfflineMessageId']!==null;var _0x214a58=path[_0x6775('0x56')](config['root'],_0x6775('0x57'));if(_0x28544f){_0x214a58=path['join'](_0x214a58,'offline-chat/');}var _0x57e6d7=path[_0x6775('0x56')](_0x214a58,_0x1ff3fd['basename']);return _0x26201e[_0x6775('0x54')](_0x57e6d7);}})[_0x6775('0x42')](handleError(_0x26201e,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index b577f86..336f0ca 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 _0x2694=['attachments','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x295cf4,_0x5823c6){var _0x2cf621=function(_0x2003a1){while(--_0x2003a1){_0x295cf4['push'](_0x295cf4['shift']());}};_0x2cf621(++_0x5823c6);}(_0x2694,0x181));var _0x4269=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x2694[_0x4b369d];return _0x571a98;};'use strict';var _=require('lodash');var util=require(_0x4269('0x0'));var logger=require(_0x4269('0x1'))(_0x4269('0x2'));var moment=require(_0x4269('0x3'));var BPromise=require(_0x4269('0x4'));var rp=require(_0x4269('0x5'));var fs=require('fs');var path=require(_0x4269('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./attachment.attributes');module['exports']=function(_0x4f594d,_0x11508b){return _0x4f594d['define']('Attachment',attributes,{'tableName':_0x4269('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4c27=['Attachment','attachments','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./attachment.attributes','exports','define'];(function(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0x4c27,0x16e));var _0x74c2=function(_0x4831a4,_0x3bc069){_0x4831a4=_0x4831a4-0x0;var _0x46815e=_0x4c27[_0x4831a4];return _0x46815e;};'use strict';var _=require(_0x74c2('0x0'));var util=require(_0x74c2('0x1'));var logger=require(_0x74c2('0x2'))(_0x74c2('0x3'));var moment=require('moment');var BPromise=require(_0x74c2('0x4'));var rp=require(_0x74c2('0x5'));var fs=require('fs');var path=require(_0x74c2('0x6'));var rimraf=require(_0x74c2('0x7'));var config=require('../../config/environment');var attributes=require(_0x74c2('0x8'));module[_0x74c2('0x9')]=function(_0x1ce3cd,_0x5f0349){return _0x1ce3cd[_0x74c2('0xa')](_0x74c2('0xb'),attributes,{'tableName':_0x74c2('0xc'),'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 727342c..32acebe 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 _0x97a2=['Attachment,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','CreateAttachment','Attachment','body','options','raw','debug','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info'];(function(_0x518a8b,_0x2dd99c){var _0x38b09f=function(_0x3e73b2){while(--_0x3e73b2){_0x518a8b['push'](_0x518a8b['shift']());}};_0x38b09f(++_0x2dd99c);}(_0x97a2,0x1b1));var _0x297a=function(_0x2b6755,_0x403797){_0x2b6755=_0x2b6755-0x0;var _0x198c6c=_0x97a2[_0x2b6755];return _0x198c6c;};'use strict';var _=require(_0x297a('0x0'));var util=require('util');var moment=require(_0x297a('0x1'));var BPromise=require(_0x297a('0x2'));var rs=require(_0x297a('0x3'));var fs=require('fs');var Redis=require(_0x297a('0x4'));var db=require(_0x297a('0x5'))['db'];var utils=require(_0x297a('0x6'));var logger=require(_0x297a('0x7'))(_0x297a('0x8'));var config=require('../../config/environment');var jayson=require(_0x297a('0x9'));var client=jayson[_0x297a('0xa')][_0x297a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x8cbc92,_0x43a7d7,_0x3d9c6a){return new BPromise(function(_0x5ab57b,_0x38b066){return client[_0x297a('0xc')](_0x8cbc92,_0x3d9c6a)[_0x297a('0xd')](function(_0xbf6378){logger[_0x297a('0xe')](_0x297a('0xf'),_0x43a7d7,'request\x20sent');logger['debug']('Attachment,\x20%s,\x20%s,\x20%s',_0x43a7d7,_0x297a('0x10'),JSON[_0x297a('0x11')](_0xbf6378));if(_0xbf6378[_0x297a('0x12')]){if(_0xbf6378[_0x297a('0x12')]['code']===0x1f4){logger[_0x297a('0x12')](_0x297a('0xf'),_0x43a7d7,_0xbf6378[_0x297a('0x12')][_0x297a('0x13')]);return _0x38b066(_0xbf6378[_0x297a('0x12')][_0x297a('0x13')]);}logger[_0x297a('0x12')]('Attachment,\x20%s,\x20%s',_0x43a7d7,_0xbf6378['error'][_0x297a('0x13')]);return _0x5ab57b(_0xbf6378['error'][_0x297a('0x13')]);}else{logger[_0x297a('0xe')]('Attachment,\x20%s,\x20%s',_0x43a7d7,_0x297a('0x10'));_0x5ab57b(_0xbf6378[_0x297a('0x14')]['message']);}})[_0x297a('0x15')](function(_0x333868){logger[_0x297a('0x12')]('Attachment,\x20%s,\x20%s',_0x43a7d7,_0x333868);_0x38b066(_0x333868);});});}exports[_0x297a('0x16')]=function(_0x3af847){var _0x29c6d6=this;return new Promise(function(_0x4d6194,_0xba3b73){return db[_0x297a('0x17')]['create'](_0x3af847[_0x297a('0x18')],{'raw':_0x3af847[_0x297a('0x19')]?_0x3af847[_0x297a('0x19')][_0x297a('0x1a')]===undefined?!![]:![]:!![]})[_0x297a('0xd')](function(_0xde6d1c){logger[_0x297a('0xe')](_0x297a('0x16'),_0x3af847);logger[_0x297a('0x1b')](_0x297a('0x16'),_0x3af847,JSON[_0x297a('0x11')](_0xde6d1c));_0x4d6194(_0xde6d1c);})[_0x297a('0x15')](function(_0x481f59){logger['error']('CreateAttachment',_0x481f59[_0x297a('0x13')],_0x3af847);_0xba3b73(_0x29c6d6[_0x297a('0x12')](0x1f4,_0x481f59['message']));});});}; \ No newline at end of file +var _0xaf93=['options','lodash','util','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','Attachment,\x20%s,\x20%s','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreateAttachment','Attachment','create','body'];(function(_0x29989b,_0x225d82){var _0x3231a8=function(_0x31a6e8){while(--_0x31a6e8){_0x29989b['push'](_0x29989b['shift']());}};_0x3231a8(++_0x225d82);}(_0xaf93,0x151));var _0x3af9=function(_0x45d866,_0x19e07a){_0x45d866=_0x45d866-0x0;var _0x5a33bd=_0xaf93[_0x45d866];return _0x5a33bd;};'use strict';var _=require(_0x3af9('0x0'));var util=require(_0x3af9('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x3af9('0x2'));var fs=require('fs');var Redis=require(_0x3af9('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x3af9('0x4'));var logger=require(_0x3af9('0x5'))(_0x3af9('0x6'));var config=require(_0x3af9('0x7'));var jayson=require(_0x3af9('0x8'));var client=jayson[_0x3af9('0x9')][_0x3af9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x535583,_0x2ac1a2,_0x56e4c2){return new BPromise(function(_0x133672,_0x53b5ba){return client['request'](_0x535583,_0x56e4c2)[_0x3af9('0xb')](function(_0x5d655f){logger['info'](_0x3af9('0xc'),_0x2ac1a2,_0x3af9('0xd'));logger[_0x3af9('0xe')](_0x3af9('0xf'),_0x2ac1a2,'request\x20sent',JSON[_0x3af9('0x10')](_0x5d655f));if(_0x5d655f[_0x3af9('0x11')]){if(_0x5d655f[_0x3af9('0x11')][_0x3af9('0x12')]===0x1f4){logger[_0x3af9('0x11')](_0x3af9('0xc'),_0x2ac1a2,_0x5d655f[_0x3af9('0x11')][_0x3af9('0x13')]);return _0x53b5ba(_0x5d655f['error'][_0x3af9('0x13')]);}logger['error'](_0x3af9('0xc'),_0x2ac1a2,_0x5d655f[_0x3af9('0x11')][_0x3af9('0x13')]);return _0x133672(_0x5d655f['error'][_0x3af9('0x13')]);}else{logger[_0x3af9('0x14')](_0x3af9('0xc'),_0x2ac1a2,'request\x20sent');_0x133672(_0x5d655f[_0x3af9('0x15')][_0x3af9('0x13')]);}})[_0x3af9('0x16')](function(_0x29dc4b){logger['error'](_0x3af9('0xc'),_0x2ac1a2,_0x29dc4b);_0x53b5ba(_0x29dc4b);});});}exports[_0x3af9('0x17')]=function(_0x298135){var _0x1b8cab=this;return new Promise(function(_0x314df2,_0x4e665b){return db[_0x3af9('0x18')][_0x3af9('0x19')](_0x298135[_0x3af9('0x1a')],{'raw':_0x298135[_0x3af9('0x1b')]?_0x298135[_0x3af9('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0x3af9('0xb')](function(_0x34eb91){logger[_0x3af9('0x14')](_0x3af9('0x17'),_0x298135);logger[_0x3af9('0xe')](_0x3af9('0x17'),_0x298135,JSON['stringify'](_0x34eb91));_0x314df2(_0x34eb91);})['catch'](function(_0x505e25){logger['error']('CreateAttachment',_0x505e25[_0x3af9('0x13')],_0x298135);_0x4e665b(_0x1b8cab['error'](0x1f4,_0x505e25[_0x3af9('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index 7ac56b0..b3c644e 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 _0xb10b=['originalname','replace','single','file','create','put','/:id','update','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./attachment.controller','get','index','isAuthenticated','show','/:id/download','download','post','/:id/clone','diskStorage','join','server/files/attachments/','format','%s-%s'];(function(_0x1f0b4e,_0x30321c){var _0x1bbbdc=function(_0x562897){while(--_0x562897){_0x1f0b4e['push'](_0x1f0b4e['shift']());}};_0x1bbbdc(++_0x30321c);}(_0xb10b,0x12a));var _0xbb10=function(_0x534a4b,_0x44c67a){_0x534a4b=_0x534a4b-0x0;var _0x311ed6=_0xb10b[_0x534a4b];return _0x311ed6;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/:id',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0xf')](_0xbb10('0x10'),auth['isAuthenticated'](),controller['clone']);var upload=multer({'storage':multer[_0xbb10('0x11')]({'destination':function(_0x118a74,_0xce64f3,_0x5e136d){_0x5e136d(null,path[_0xbb10('0x12')](config['root'],_0xbb10('0x13')));},'filename':function(_0x916a32,_0x285009,_0x193a27){_0x193a27(null,util[_0xbb10('0x14')](_0xbb10('0x15'),Date['now'](),_0x285009[_0xbb10('0x16')][_0xbb10('0x17')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xbb10('0xf')]('/',upload[_0xbb10('0x18')](_0xbb10('0x19')),controller[_0xbb10('0x1a')]);router[_0xbb10('0x1b')](_0xbb10('0x1c'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1d')]);router['delete'](_0xbb10('0x1c'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1e')]);module[_0xbb10('0x1f')]=router; \ No newline at end of file +var _0x0b0e=['/:id/clone','clone','diskStorage','join','server/files/attachments/','format','now','originalname','replace','single','create','/:id','delete','destroy','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./attachment.controller','get','isAuthenticated','index','show','/:id/download','post'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x0b0e,0x187));var _0xe0b0=function(_0x22ee1e,_0x3eff80){_0x22ee1e=_0x22ee1e-0x0;var _0x49a5c9=_0x0b0e[_0x22ee1e];return _0x49a5c9;};'use strict';var multer=require(_0xe0b0('0x0'));var util=require('util');var path=require(_0xe0b0('0x1'));var timeout=require('connect-timeout');var express=require(_0xe0b0('0x2'));var router=express[_0xe0b0('0x3')]();var fs_extra=require(_0xe0b0('0x4'));var auth=require(_0xe0b0('0x5'));var interaction=require(_0xe0b0('0x6'));var config=require(_0xe0b0('0x7'));var controller=require(_0xe0b0('0x8'));router[_0xe0b0('0x9')]('/',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0xb')]);router[_0xe0b0('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xe0b0('0xc')]);router[_0xe0b0('0x9')](_0xe0b0('0xd'),auth[_0xe0b0('0xa')](),controller['download']);router[_0xe0b0('0xe')](_0xe0b0('0xf'),auth['isAuthenticated'](),controller[_0xe0b0('0x10')]);var upload=multer({'storage':multer[_0xe0b0('0x11')]({'destination':function(_0x574d96,_0x399320,_0x2cdad2){_0x2cdad2(null,path[_0xe0b0('0x12')](config['root'],_0xe0b0('0x13')));},'filename':function(_0x1c358a,_0x3cc19a,_0x45f914){_0x45f914(null,util[_0xe0b0('0x14')]('%s-%s',Date[_0xe0b0('0x15')](),_0x3cc19a[_0xe0b0('0x16')][_0xe0b0('0x17')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xe0b0('0xe')]('/',upload[_0xe0b0('0x18')]('file'),controller[_0xe0b0('0x19')]);router['put'](_0xe0b0('0x1a'),auth[_0xe0b0('0xa')](),controller['update']);router[_0xe0b0('0x1b')]('/:id',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x1c')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/authActiveDirectory/authActiveDirectory.controller.js b/server/api/authActiveDirectory/authActiveDirectory.controller.js index 9d0cfc1..c92812c 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 _0xeab8=['passport-local','Strategy','moment','activedirectory2','util','../../components/auth/service','../../config/utils','api','activedirectory','undefined','baseDN','domain','authenticate','error','Error\x20authenticate\x20%s:\x20%s','inspect','Error\x20authenticate\x20%s:\x20Wrong\x20credentials','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Setting','adSsoEnabled','then','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','findOne','name','password','salt','role','disabled','blockedAt','online','admin','agent','blocked','add','blockDuration','clearBlockUser','getLicense','status','send','message','login','ad-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','use','User','passport'];(function(_0xa545d2,_0x10e851){var _0x2b3fb3=function(_0x341fe7){while(--_0x341fe7){_0xa545d2['push'](_0xa545d2['shift']());}};_0x2b3fb3(++_0x10e851);}(_0xeab8,0x156));var _0x8eab=function(_0x197544,_0x3dd522){_0x197544=_0x197544-0x0;var _0x2d60cd=_0xeab8[_0x197544];return _0x2d60cd;};'use strict';var passport=require(_0x8eab('0x0'));var LocalStrategy=require(_0x8eab('0x1'))[_0x8eab('0x2')];var moment=require(_0x8eab('0x3'));var ActiveDirectory=require(_0x8eab('0x4'));var BPromise=require('bluebird');var util=require(_0x8eab('0x5'));var db=require('../../mysqldb')['db'];var authService=require(_0x8eab('0x6'));var utils=require(_0x8eab('0x7'));var config=require('../../config/environment');var logger=require('../../config/logger')(_0x8eab('0x8'));function isActiveDirectoryConfigured(_0x47da6f){var _0x5824f4=![];if(typeof _0x47da6f[_0x8eab('0x9')]!==_0x8eab('0xa')){_0x5824f4=_0x47da6f['activedirectory'][_0x8eab('0xb')]&&_0x47da6f[_0x8eab('0x9')]['url']&&_0x47da6f[_0x8eab('0x9')][_0x8eab('0xc')];}return _0x5824f4;}function adAuthenticate(_0x45aa5b,_0x106541,_0x4e19d0){return new BPromise(function(_0xab18ae,_0x1db042){try{var _0x183872=new ActiveDirectory(_0x45aa5b);_0x183872[_0x8eab('0xd')](_0x106541,_0x4e19d0,function(_0x22511c,_0x21de66){if(_0x22511c){logger[_0x8eab('0xe')](_0x8eab('0xf'),_0x106541,util[_0x8eab('0x10')](_0x22511c,{'showHidden':![],'depth':null}));_0x1db042('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else if(!_0x21de66){logger[_0x8eab('0xe')](_0x8eab('0x11'),_0x106541);_0x1db042('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0xab18ae(_0x21de66);}});}catch(_0x18dceb){_0x1db042(_0x18dceb);}});}function ActiveDirectoryAuthenticate(_0x1ea329,_0x2d5ca0,_0x1da447,_0x226bd0){var _0x30eed5,_0x68d60;if(!isActiveDirectoryConfigured(config)){logger[_0x8eab('0xe')](_0x8eab('0x12'),_0x2d5ca0);return _0x226bd0(null,![],{'message':_0x8eab('0x13')});}return db[_0x8eab('0x14')]['findOne']({'where':{'id':0x1},'attributes':[_0x8eab('0x15'),'blockDuration'],'raw':!![]})[_0x8eab('0x16')](function(_0x309647){_0x30eed5=_0x309647;if(!_0x30eed5['adSsoEnabled']){logger[_0x8eab('0xe')](_0x8eab('0x17'),_0x2d5ca0);throw new Error(_0x8eab('0x13'));}return _0x1ea329[_0x8eab('0x18')]({'attributes':['id',_0x8eab('0x19'),_0x8eab('0x1a'),_0x8eab('0x1b'),_0x8eab('0x1c'),_0x8eab('0x1d'),'blocked',_0x8eab('0x1e'),_0x8eab('0x1f')],'where':{'name':_0x2d5ca0,'role':{'$or':[_0x8eab('0x20'),'user',_0x8eab('0x21')]},'adSsoEnabled':!![]}});})[_0x8eab('0x16')](function(_0x21c701){if(!_0x21c701||_0x21c701&&_0x21c701[_0x8eab('0x19')]!==_0x2d5ca0){throw new Error(_0x8eab('0x13'));}_0x68d60=_0x21c701;var _0x1623d4=_0x68d60[_0x8eab('0x19')]+'@'+config[_0x8eab('0x9')][_0x8eab('0xc')];return adAuthenticate(config[_0x8eab('0x9')],_0x1623d4,_0x1da447);})['then'](function(_0x24f7a3){if(_0x68d60['disabled']){throw new Error(_0x8eab('0x13'));}if(_0x30eed5['blockDuration']>0x0){if(_0x68d60[_0x8eab('0x22')]){if(moment(_0x68d60[_0x8eab('0x1e')])[_0x8eab('0x23')](_0x30eed5[_0x8eab('0x24')],'minutes')>moment()){throw new Error(_0x8eab('0x13'));}return utils[_0x8eab('0x25')](_0x68d60,0x0,![],null)[_0x8eab('0x16')](function(){return utils[_0x8eab('0x26')](_0x68d60);})[_0x8eab('0x16')](function(){return _0x226bd0(null,_0x68d60);});}else{return utils[_0x8eab('0x26')](_0x68d60)['then'](function(){return _0x226bd0(null,_0x68d60);});}}else{return utils['getLicense'](_0x68d60)[_0x8eab('0x16')](function(){return _0x226bd0(null,_0x68d60);});}})['catch'](function(_0x1ba4f9){return _0x226bd0(null,![],_0x1ba4f9);});}function handleError(_0x25742f,_0x2bdca4,_0x1f8671){return _0x25742f[_0x8eab('0x27')](_0x2bdca4||0x1f4)[_0x8eab('0x28')]({'message':_0x1f8671?_0x1f8671[_0x8eab('0x29')]||_0x1f8671:''});}exports[_0x8eab('0x2a')]=function(_0x289508,_0xa6339e,_0x3732ac){passport[_0x8eab('0xd')](_0x8eab('0x2b'),function(_0x16f37c,_0x429bc9,_0x216712){var _0x169dc4=_0x16f37c||_0x216712;if(_0x169dc4){return handleError(_0xa6339e,0x191,_0x169dc4);}if(!_0x429bc9){return handleError(_0xa6339e,0x194,{'message':_0x8eab('0x2c')});}else{var _0x5dc219={'payload':{'id':_0x429bc9['id'],'role':_0x429bc9[_0x8eab('0x1c')]},'options':{'expiresIn':0x15180}};return authService[_0x8eab('0x2d')](_0x5dc219)[_0x8eab('0x16')](function(_0x4a3e51){_0xa6339e[_0x8eab('0x2e')]({'id':_0x429bc9['id'],'token':_0x4a3e51,'statusCall':'','isAlreadyLogged':_0x429bc9[_0x8eab('0x1f')]});});}})(_0x289508,_0xa6339e,_0x3732ac);};passport[_0x8eab('0x2f')](_0x8eab('0x2b'),new LocalStrategy({'usernameField':_0x8eab('0x19'),'passwordField':'password'},function(_0x39bbe2,_0x5a297c,_0x1740df){return ActiveDirectoryAuthenticate(db[_0x8eab('0x30')],_0x39bbe2,_0x5a297c,_0x1740df);})); \ No newline at end of file +var _0xa0e8=['add','minutes','clearBlockUser','getLicense','catch','status','send','message','login','ad-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','password','passport','passport-local','Strategy','moment','activedirectory2','bluebird','../../mysqldb','../../components/auth/service','../../config/environment','../../config/logger','api','activedirectory','url','authenticate','error','inspect','Error\x20authenticate\x20%s:\x20Wrong\x20credentials','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Setting','findOne','adSsoEnabled','blockDuration','then','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','salt','role','disabled','blocked','online','user','name','domain','blockedAt'];(function(_0x234379,_0x26f2f){var _0x3b58a0=function(_0x4ee4dc){while(--_0x4ee4dc){_0x234379['push'](_0x234379['shift']());}};_0x3b58a0(++_0x26f2f);}(_0xa0e8,0x1e4));var _0x8a0e=function(_0x2ec29b,_0x33ef39){_0x2ec29b=_0x2ec29b-0x0;var _0x43f637=_0xa0e8[_0x2ec29b];return _0x43f637;};'use strict';var passport=require(_0x8a0e('0x0'));var LocalStrategy=require(_0x8a0e('0x1'))[_0x8a0e('0x2')];var moment=require(_0x8a0e('0x3'));var ActiveDirectory=require(_0x8a0e('0x4'));var BPromise=require(_0x8a0e('0x5'));var util=require('util');var db=require(_0x8a0e('0x6'))['db'];var authService=require(_0x8a0e('0x7'));var utils=require('../../config/utils');var config=require(_0x8a0e('0x8'));var logger=require(_0x8a0e('0x9'))(_0x8a0e('0xa'));function isActiveDirectoryConfigured(_0x1e76fc){var _0x50e540=![];if(typeof _0x1e76fc[_0x8a0e('0xb')]!=='undefined'){_0x50e540=_0x1e76fc[_0x8a0e('0xb')]['baseDN']&&_0x1e76fc[_0x8a0e('0xb')][_0x8a0e('0xc')]&&_0x1e76fc['activedirectory']['domain'];}return _0x50e540;}function adAuthenticate(_0x5e3fd7,_0x16259d,_0x439ea4){return new BPromise(function(_0x2c782d,_0x445b9c){try{var _0x2c5e84=new ActiveDirectory(_0x5e3fd7);_0x2c5e84[_0x8a0e('0xd')](_0x16259d,_0x439ea4,function(_0x69c406,_0x3dcb66){if(_0x69c406){logger[_0x8a0e('0xe')]('Error\x20authenticate\x20%s:\x20%s',_0x16259d,util[_0x8a0e('0xf')](_0x69c406,{'showHidden':![],'depth':null}));_0x445b9c('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else if(!_0x3dcb66){logger[_0x8a0e('0xe')](_0x8a0e('0x10'),_0x16259d);_0x445b9c(_0x8a0e('0x11'));}else{_0x2c782d(_0x3dcb66);}});}catch(_0x26bd42){_0x445b9c(_0x26bd42);}});}function ActiveDirectoryAuthenticate(_0x309265,_0x44071b,_0x3fcb37,_0x47645c){var _0x307455,_0x2f42a4;if(!isActiveDirectoryConfigured(config)){logger['error']('Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured',_0x44071b);return _0x47645c(null,![],{'message':_0x8a0e('0x11')});}return db[_0x8a0e('0x12')][_0x8a0e('0x13')]({'where':{'id':0x1},'attributes':[_0x8a0e('0x14'),_0x8a0e('0x15')],'raw':!![]})[_0x8a0e('0x16')](function(_0x427fa6){_0x307455=_0x427fa6;if(!_0x307455[_0x8a0e('0x14')]){logger[_0x8a0e('0xe')](_0x8a0e('0x17'),_0x44071b);throw new Error(_0x8a0e('0x11'));}return _0x309265[_0x8a0e('0x13')]({'attributes':['id','name','password',_0x8a0e('0x18'),_0x8a0e('0x19'),_0x8a0e('0x1a'),_0x8a0e('0x1b'),'blockedAt',_0x8a0e('0x1c')],'where':{'name':_0x44071b,'role':{'$or':['admin',_0x8a0e('0x1d'),'agent']},'adSsoEnabled':!![]}});})[_0x8a0e('0x16')](function(_0x227f13){if(!_0x227f13||_0x227f13&&_0x227f13['name']!==_0x44071b){throw new Error(_0x8a0e('0x11'));}_0x2f42a4=_0x227f13;var _0x43ad91=_0x2f42a4[_0x8a0e('0x1e')]+'@'+config[_0x8a0e('0xb')][_0x8a0e('0x1f')];return adAuthenticate(config[_0x8a0e('0xb')],_0x43ad91,_0x3fcb37);})[_0x8a0e('0x16')](function(_0x1249cc){if(_0x2f42a4[_0x8a0e('0x1a')]){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}if(_0x307455['blockDuration']>0x0){if(_0x2f42a4[_0x8a0e('0x1b')]){if(moment(_0x2f42a4[_0x8a0e('0x20')])[_0x8a0e('0x21')](_0x307455[_0x8a0e('0x15')],_0x8a0e('0x22'))>moment()){throw new Error(_0x8a0e('0x11'));}return utils[_0x8a0e('0x23')](_0x2f42a4,0x0,![],null)[_0x8a0e('0x16')](function(){return utils['getLicense'](_0x2f42a4);})[_0x8a0e('0x16')](function(){return _0x47645c(null,_0x2f42a4);});}else{return utils['getLicense'](_0x2f42a4)['then'](function(){return _0x47645c(null,_0x2f42a4);});}}else{return utils[_0x8a0e('0x24')](_0x2f42a4)['then'](function(){return _0x47645c(null,_0x2f42a4);});}})[_0x8a0e('0x25')](function(_0x4a7a49){return _0x47645c(null,![],_0x4a7a49);});}function handleError(_0x471ef7,_0x4c568a,_0x2b9192){return _0x471ef7[_0x8a0e('0x26')](_0x4c568a||0x1f4)[_0x8a0e('0x27')]({'message':_0x2b9192?_0x2b9192[_0x8a0e('0x28')]||_0x2b9192:''});}exports[_0x8a0e('0x29')]=function(_0x239f0c,_0x582e14,_0x2c59bf){passport[_0x8a0e('0xd')](_0x8a0e('0x2a'),function(_0x104dea,_0x35dc9a,_0x383417){var _0x5762cf=_0x104dea||_0x383417;if(_0x5762cf){return handleError(_0x582e14,0x191,_0x5762cf);}if(!_0x35dc9a){return handleError(_0x582e14,0x194,{'message':_0x8a0e('0x2b')});}else{var _0x19426c={'payload':{'id':_0x35dc9a['id'],'role':_0x35dc9a[_0x8a0e('0x19')]},'options':{'expiresIn':0x15180}};return authService[_0x8a0e('0x2c')](_0x19426c)[_0x8a0e('0x16')](function(_0x278c0f){_0x582e14[_0x8a0e('0x2d')]({'id':_0x35dc9a['id'],'token':_0x278c0f,'statusCall':'','isAlreadyLogged':_0x35dc9a[_0x8a0e('0x1c')]});});}})(_0x239f0c,_0x582e14,_0x2c59bf);};passport['use'](_0x8a0e('0x2a'),new LocalStrategy({'usernameField':_0x8a0e('0x1e'),'passwordField':_0x8a0e('0x2e')},function(_0x83cbcc,_0x120828,_0x241f68){return ActiveDirectoryAuthenticate(db['User'],_0x83cbcc,_0x120828,_0x241f68);})); \ No newline at end of file diff --git a/server/api/authActiveDirectory/index.js b/server/api/authActiveDirectory/index.js index c804af4..30574b1 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 _0x3eb7=['post','login','express','Router','./authActiveDirectory.controller'];(function(_0x470197,_0x133ca1){var _0x8ffdf8=function(_0x20fe26){while(--_0x20fe26){_0x470197['push'](_0x470197['shift']());}};_0x8ffdf8(++_0x133ca1);}(_0x3eb7,0x188));var _0x73eb=function(_0x541b8f,_0x527029){_0x541b8f=_0x541b8f-0x0;var _0x1bd5a6=_0x3eb7[_0x541b8f];return _0x1bd5a6;};'use strict';var express=require(_0x73eb('0x0'));var router=express[_0x73eb('0x1')]();var controller=require(_0x73eb('0x2'));router[_0x73eb('0x3')]('/',controller[_0x73eb('0x4')]);module['exports']=router; \ No newline at end of file +var _0x0bb0=['login','exports','express','Router','post'];(function(_0x5c3d87,_0x11faec){var _0xd87709=function(_0x21330e){while(--_0x21330e){_0x5c3d87['push'](_0x5c3d87['shift']());}};_0xd87709(++_0x11faec);}(_0x0bb0,0x15b));var _0x00bb=function(_0x55377f,_0x41d5a9){_0x55377f=_0x55377f-0x0;var _0x2ca0bd=_0x0bb0[_0x55377f];return _0x2ca0bd;};'use strict';var express=require(_0x00bb('0x0'));var router=express[_0x00bb('0x1')]();var controller=require('./authActiveDirectory.controller');router[_0x00bb('0x2')]('/',controller[_0x00bb('0x3')]);module[_0x00bb('0x4')]=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index d3865b7..d99f69f 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(_0x263154,_0x4aa8d4){var _0x58c958=function(_0x2abbb6){while(--_0x2abbb6){_0x263154['push'](_0x263154['shift']());}};_0x58c958(++_0x4aa8d4);}(_0x9957,0x93));var _0x7995=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x9957[_0x19e35c];return _0x3e1fe8;};'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(_0x44ddd4,_0x49f6d4){var _0x258882=function(_0x363573){while(--_0x363573){_0x44ddd4['push'](_0x44ddd4['shift']());}};_0x258882(++_0x49f6d4);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'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 286b739..b4c1f69 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 _0xb807=['exports','express','passport','./authGoogle.controller','../user/user.controller.js','../../components/auth/service','/callback','callback','login'];(function(_0x313906,_0x563320){var _0x34c7cd=function(_0x3d830d){while(--_0x3d830d){_0x313906['push'](_0x313906['shift']());}};_0x34c7cd(++_0x563320);}(_0xb807,0x1b1));var _0x7b80=function(_0x17f716,_0x4a06c7){_0x17f716=_0x17f716-0x0;var _0x31f0de=_0xb807[_0x17f716];return _0x31f0de;};'use strict';var express=require(_0x7b80('0x0'));var passport=require(_0x7b80('0x1'));var router=express['Router']();var controller=require(_0x7b80('0x2'));var userController=require(_0x7b80('0x3'));var authService=require(_0x7b80('0x4'));router['get']('/',controller['login']);router['get'](_0x7b80('0x5'),controller[_0x7b80('0x6')],authService['isMiddleware'],userController[_0x7b80('0x7')],authService['setTokenCookie']);module[_0x7b80('0x8')]=router; \ No newline at end of file +var _0x42c7=['exports','express','Router','./authGoogle.controller','../user/user.controller.js','../../components/auth/service','get','/callback','callback','isMiddleware'];(function(_0x30a549,_0x3f99f1){var _0x23c1a7=function(_0x5c28cc){while(--_0x5c28cc){_0x30a549['push'](_0x30a549['shift']());}};_0x23c1a7(++_0x3f99f1);}(_0x42c7,0xb5));var _0x742c=function(_0x2658cb,_0x13ad6a){_0x2658cb=_0x2658cb-0x0;var _0x202264=_0x42c7[_0x2658cb];return _0x202264;};'use strict';var express=require(_0x742c('0x0'));var passport=require('passport');var router=express[_0x742c('0x1')]();var controller=require(_0x742c('0x2'));var userController=require(_0x742c('0x3'));var authService=require(_0x742c('0x4'));router[_0x742c('0x5')]('/',controller['login']);router[_0x742c('0x5')](_0x742c('0x6'),controller[_0x742c('0x7')],authService[_0x742c('0x8')],userController['login'],authService['setTokenCookie']);module[_0x742c('0x9')]=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index 7d7c932..53188de 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 _0xe0af=['blockedAt','loginAttempts','admin','user','agent','authenticate','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','add','minutes','clearBlockUser','getLicense','catch','MailAccount','find','email','Smtp','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','getSmtpOptions','merge','\x22%s\x22\x20<%s>','request','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','error','message','status','send','login','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','online','body','Email\x20parameter\x20is\x20missing','trim','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','now','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','host','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','reset','User','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','validatePasswordPattern','password','validatePasswordHistory','save','Password\x20reset!','use','util','Strategy','lodash','randomstring','../../mysqldb','../../components/auth/service','../../config/utils','client','http','Setting','findOne','allowedLoginAttempts','blockDuration','then','name','salt','role','disabled','blocked'];(function(_0x4da8bf,_0x166c11){var _0x13c514=function(_0x521e1e){while(--_0x521e1e){_0x4da8bf['push'](_0x4da8bf['shift']());}};_0x13c514(++_0x166c11);}(_0xe0af,0xda));var _0xfe0a=function(_0x19cb1a,_0x4ce1b2){_0x19cb1a=_0x19cb1a-0x0;var _0x399650=_0xe0af[_0x19cb1a];return _0x399650;};'use strict';var util=require(_0xfe0a('0x0'));var passport=require('passport');var LocalStrategy=require('passport-local')[_0xfe0a('0x1')];var jayson=require('jayson/promise');var _=require(_0xfe0a('0x2'));var rs=require(_0xfe0a('0x3'));var moment=require('moment');var db=require(_0xfe0a('0x4'))['db'];var authService=require(_0xfe0a('0x5'));var utils=require(_0xfe0a('0x6'));var client=jayson[_0xfe0a('0x7')][_0xfe0a('0x8')]({'port':0x232b});function localAuthenticate(_0x168527,_0x421e55,_0x1ce022,_0x30952b){var _0x154ec9,_0x43a159;return db[_0xfe0a('0x9')][_0xfe0a('0xa')]({'where':{'id':0x1},'attributes':[_0xfe0a('0xb'),_0xfe0a('0xc')],'raw':!![]})[_0xfe0a('0xd')](function(_0x2069c2){_0x154ec9=_0x2069c2;return _0x168527['findOne']({'attributes':['id',_0xfe0a('0xe'),'password',_0xfe0a('0xf'),_0xfe0a('0x10'),_0xfe0a('0x11'),_0xfe0a('0x12'),_0xfe0a('0x13'),_0xfe0a('0x14')],'where':{'name':_0x421e55,'role':{'$or':[_0xfe0a('0x15'),_0xfe0a('0x16'),_0xfe0a('0x17')]}}});})[_0xfe0a('0xd')](function(_0x3ca9dd){if(!_0x3ca9dd||_0x3ca9dd&&_0x3ca9dd[_0xfe0a('0xe')]!==_0x421e55){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x43a159=_0x3ca9dd;return _0x43a159;}})['then'](function(){_0x43a159[_0xfe0a('0x18')](_0x1ce022,function(_0x2f5b6d,_0x5f08bd){var _0xaecaf4=_0x43a159[_0xfe0a('0x14')]+0x1;if(_0x2f5b6d){return _0x30952b(_0x2f5b6d);}else if(!_0x5f08bd){if(_0x43a159[_0xfe0a('0x11')]){return _0x30952b(null,![],{'message':_0xfe0a('0x19')});}else if(_0x154ec9['allowedLoginAttempts']>0x0){if(_0x43a159[_0xfe0a('0x12')]){if(_0x154ec9[_0xfe0a('0xc')]>0x0){if(moment(_0x43a159[_0xfe0a('0x13')])[_0xfe0a('0x1a')](_0x154ec9[_0xfe0a('0xc')],_0xfe0a('0x1b'))>moment()){return _0x30952b(null,![],{'message':_0xfe0a('0x19')});}else{return utils[_0xfe0a('0x1c')](_0x43a159,_0xaecaf4,![],null)[_0xfe0a('0xd')](function(){return _0x30952b(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}else{return _0x30952b(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0xaecaf4>=_0x154ec9[_0xfe0a('0xb')]){return utils[_0xfe0a('0x1c')](_0x43a159,0x0,!![],moment())[_0xfe0a('0xd')](function(){return _0x30952b(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}else{return utils[_0xfe0a('0x1c')](_0x43a159,_0xaecaf4,![],null)[_0xfe0a('0xd')](function(){return _0x30952b(null,![],{'message':_0xfe0a('0x19')});});}}}else{return _0x30952b(null,![],{'message':_0xfe0a('0x19')});}}else{if(_0x43a159[_0xfe0a('0x11')]){return _0x30952b(null,![],{'message':_0xfe0a('0x19')});}else if(_0x154ec9['allowedLoginAttempts']>0x0){if(_0x43a159['blocked']){if(_0x154ec9['blockDuration']>0x0){if(moment(_0x43a159['blockedAt'])['add'](_0x154ec9[_0xfe0a('0xc')],_0xfe0a('0x1b'))>moment()){return _0x30952b(null,![],{'message':_0xfe0a('0x19')});}else{return utils[_0xfe0a('0x1c')](_0x43a159,0x0,![],null)[_0xfe0a('0xd')](function(){return utils[_0xfe0a('0x1d')](_0x43a159);})[_0xfe0a('0xd')](function(){return _0x30952b(null,_0x43a159);});}}else{return _0x30952b(null,![],{'message':_0xfe0a('0x19')});}}else{return utils[_0xfe0a('0x1c')](_0x43a159,0x0,![],null)['then'](function(){return utils['getLicense'](_0x43a159);})[_0xfe0a('0xd')](function(){return _0x30952b(null,_0x43a159);})[_0xfe0a('0x1e')](function(_0x5d8dce){return _0x30952b(null,![],_0x5d8dce);});}}else{if(_0x43a159[_0xfe0a('0x12')]){return _0x30952b(null,![],{'message':_0xfe0a('0x19')});}else{return utils[_0xfe0a('0x1d')](_0x43a159)['then'](function(){return _0x30952b(null,_0x43a159);});}}}});})[_0xfe0a('0x1e')](function(_0x50d298){return _0x30952b(null,![],_0x50d298);});}function sendServiceMail(_0x4f54e2){return db[_0xfe0a('0x1f')][_0xfe0a('0x20')]({'where':{'service':!![]},'attributes':['id',_0xfe0a('0xe'),_0xfe0a('0x21')],'include':[{'model':db['MailServerOut'],'as':_0xfe0a('0x22'),'include':[{'model':db[_0xfe0a('0x23')],'as':_0xfe0a('0x23')}]}]})[_0xfe0a('0xd')](function(_0x117f84){if(!_0x117f84){throw new Error(_0xfe0a('0x24'));}var _0x10bb3e=_0x117f84[_0xfe0a('0x25')]();var _0x164dbb={'account':_0x10bb3e,'message':_[_0xfe0a('0x26')]({'from':util['format'](_0xfe0a('0x27'),_0x117f84[_0xfe0a('0xe')],_0x117f84[_0xfe0a('0x21')]||_0x117f84[_0xfe0a('0x22')]['user'])},_0x4f54e2)};return client[_0xfe0a('0x28')]('SendMail',_0x164dbb);})[_0xfe0a('0xd')](function(_0x2e07f6){if(_0x2e07f6['error']){throw new Error(util['format'](_0xfe0a('0x29'),_0x2e07f6[_0xfe0a('0x2a')][_0xfe0a('0x2b')]||JSON['stringify'](_0x2e07f6['error'])));}return!![];});}function handleError(_0x116814,_0x434520,_0x5d2990){return _0x116814[_0xfe0a('0x2c')](_0x434520||0x1f4)[_0xfe0a('0x2d')]({'message':_0x5d2990?_0x5d2990[_0xfe0a('0x2b')]||_0x5d2990:''});}exports[_0xfe0a('0x2e')]=function(_0x3fdd7a,_0x31f074,_0x41e0f6){passport[_0xfe0a('0x18')](_0xfe0a('0x2f'),function(_0xe6b41f,_0x57d5b1,_0x39ab18){var _0x5322f2=_0xe6b41f||_0x39ab18;if(_0x5322f2){return handleError(_0x31f074,0x191,_0x5322f2);}if(!_0x57d5b1){return handleError(_0x31f074,0x194,{'message':_0xfe0a('0x30')});}else{var _0x1a40ac={'payload':{'id':_0x57d5b1['id'],'role':_0x57d5b1[_0xfe0a('0x10')]},'options':{'expiresIn':0x15180}};return authService[_0xfe0a('0x31')](_0x1a40ac)['then'](function(_0x5bbeea){_0x31f074[_0xfe0a('0x32')]({'id':_0x57d5b1['id'],'token':_0x5bbeea,'statusCall':'','isAlreadyLogged':_0x57d5b1[_0xfe0a('0x33')]});});}})(_0x3fdd7a,_0x31f074,_0x41e0f6);};exports['forgot']=function(_0x4f3c23,_0xfcb89e){if(!_0x4f3c23[_0xfe0a('0x34')][_0xfe0a('0x21')]){return handleError(_0xfcb89e,0x1f4,{'message':_0xfe0a('0x35')});}var _0x44c0c0=rs['generate']();_0x4f3c23[_0xfe0a('0x34')][_0xfe0a('0x21')]=_0x4f3c23[_0xfe0a('0x34')]['email'][_0xfe0a('0x36')]()['toLowerCase']();var _0x4692bb;return db[_0xfe0a('0x9')]['findOne']({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0xfe0a('0xc')],'raw':!![]})[_0xfe0a('0xd')](function(_0x1870e8){_0x4692bb=_0x1870e8;return db['User'][_0xfe0a('0x20')]({'where':{'email':_0x4f3c23['body'][_0xfe0a('0x21')]}});})[_0xfe0a('0xd')](function(_0x2cbbe2){if(!_0x2cbbe2){throw new Error(_0xfe0a('0x37'));}if(_0x2cbbe2['disabled']){throw new Error(_0xfe0a('0x38'));}if(_0x2cbbe2['blocked']){if(moment(_0x2cbbe2[_0xfe0a('0x13')])[_0xfe0a('0x1a')](_0x4692bb[_0xfe0a('0xc')],_0xfe0a('0x1b'))>moment()){throw new Error(_0xfe0a('0x39'));}else{_0x2cbbe2[_0xfe0a('0x12')]=![];_0x2cbbe2[_0xfe0a('0x13')]=null;}}_0x2cbbe2[_0xfe0a('0x3a')]=_0x44c0c0;_0x2cbbe2[_0xfe0a('0x3b')]=Date[_0xfe0a('0x3c')]()+0x36ee80;return _0x2cbbe2['save']();})[_0xfe0a('0xd')](function(){return sendServiceMail({'to':_0x4f3c23['body']['email'],'subject':'xCally\x20Motion\x20Password\x20Reset','text':_0xfe0a('0x3d')+_0xfe0a('0x3e')+_0xfe0a('0x3f')+_0x4f3c23['headers'][_0xfe0a('0x40')]+_0xfe0a('0x41')+_0x44c0c0+'\x0a\x0a'+_0xfe0a('0x42')});})['then'](function(){_0xfcb89e[_0xfe0a('0x2c')](0xc8)[_0xfe0a('0x2d')]({'message':'Reset\x20Email\x20sent!'});})[_0xfe0a('0x1e')](function(_0x26caad){return handleError(_0xfcb89e,0x1f4,_0x26caad);});};exports[_0xfe0a('0x43')]=function(_0x263a2c,_0x4d93ee){return db[_0xfe0a('0x44')]['find']({'where':{'resetPasswordToken':_0x263a2c['params'][_0xfe0a('0x45')],'resetPasswordExpires':{'$gt':Date[_0xfe0a('0x3c')]()}}})[_0xfe0a('0xd')](function(_0x3a2b79){if(!_0x3a2b79){throw new Error(_0xfe0a('0x46'));}return db[_0xfe0a('0x9')][_0xfe0a('0xa')]({'attributes':['id',_0xfe0a('0x47'),_0xfe0a('0x48'),'passwordHistoryLimit']})['then'](function(_0xcf0012){if(_0xcf0012[_0xfe0a('0x47')])authService[_0xfe0a('0x49')](_0x263a2c[_0xfe0a('0x34')][_0xfe0a('0x4a')]);if(!_0xcf0012['enforcePasswordHistory']||!_0x3a2b79['previousPasswords'])return _0x3a2b79;authService[_0xfe0a('0x4b')](_0x263a2c['body'][_0xfe0a('0x4a')],_0x3a2b79['previousPasswords'],_0xcf0012['passwordHistoryLimit']);return _0x3a2b79;})['then'](function(){_0x3a2b79['password']=_0x263a2c[_0xfe0a('0x34')]['password'];_0x3a2b79[_0xfe0a('0x3a')]=null;_0x3a2b79[_0xfe0a('0x3b')]=null;return _0x3a2b79[_0xfe0a('0x4c')]();});})['then'](function(){_0x4d93ee[_0xfe0a('0x2c')](0xc8)[_0xfe0a('0x2d')]({'message':_0xfe0a('0x4d')});})[_0xfe0a('0x1e')](function(_0x85aad5){return handleError(_0x4d93ee,0x1f4,_0x85aad5);});};passport[_0xfe0a('0x4e')](_0xfe0a('0x2f'),new LocalStrategy({'usernameField':'name','passwordField':_0xfe0a('0x4a')},function(_0x2bad59,_0x215904,_0x549441){return localAuthenticate(db['User'],_0x2bad59,_0x215904,_0x549441);})); \ No newline at end of file +var _0xd011=['status','send','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','online','forgot','body','Email\x20parameter\x20is\x20missing','generate','trim','toLowerCase','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','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://','/reset/','User','params','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','validatePasswordPattern','password','validatePasswordHistory','previousPasswords','passwordHistoryLimit','save','Password\x20reset!','use','util','passport','passport-local','Strategy','jayson/promise','lodash','randomstring','moment','../../components/auth/service','../../config/utils','client','http','Setting','findOne','blockDuration','name','salt','role','disabled','blocked','blockedAt','loginAttempts','admin','user','agent','then','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','allowedLoginAttempts','minutes','clearBlockUser','add','getLicense','catch','MailAccount','find','email','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','format','\x22%s\x22\x20<%s>','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xd011,0x15e));var _0x1d01=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd011[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0x1d01('0x0'));var passport=require(_0x1d01('0x1'));var LocalStrategy=require(_0x1d01('0x2'))[_0x1d01('0x3')];var jayson=require(_0x1d01('0x4'));var _=require(_0x1d01('0x5'));var rs=require(_0x1d01('0x6'));var moment=require(_0x1d01('0x7'));var db=require('../../mysqldb')['db'];var authService=require(_0x1d01('0x8'));var utils=require(_0x1d01('0x9'));var client=jayson[_0x1d01('0xa')][_0x1d01('0xb')]({'port':0x232b});function localAuthenticate(_0x36da31,_0x3b8084,_0x328521,_0x40dd41){var _0x341240,_0x243c22;return db[_0x1d01('0xc')][_0x1d01('0xd')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0x1d01('0xe')],'raw':!![]})['then'](function(_0x2bc210){_0x341240=_0x2bc210;return _0x36da31['findOne']({'attributes':['id',_0x1d01('0xf'),'password',_0x1d01('0x10'),_0x1d01('0x11'),_0x1d01('0x12'),_0x1d01('0x13'),_0x1d01('0x14'),_0x1d01('0x15')],'where':{'name':_0x3b8084,'role':{'$or':[_0x1d01('0x16'),_0x1d01('0x17'),_0x1d01('0x18')]}}});})[_0x1d01('0x19')](function(_0x105fcd){if(!_0x105fcd||_0x105fcd&&_0x105fcd[_0x1d01('0xf')]!==_0x3b8084){throw new Error(_0x1d01('0x1a'));}else{_0x243c22=_0x105fcd;return _0x243c22;}})['then'](function(){_0x243c22[_0x1d01('0x1b')](_0x328521,function(_0x23a5a1,_0x4ffbb9){var _0x1e929c=_0x243c22['loginAttempts']+0x1;if(_0x23a5a1){return _0x40dd41(_0x23a5a1);}else if(!_0x4ffbb9){if(_0x243c22[_0x1d01('0x12')]){return _0x40dd41(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x341240[_0x1d01('0x1c')]>0x0){if(_0x243c22['blocked']){if(_0x341240['blockDuration']>0x0){if(moment(_0x243c22[_0x1d01('0x14')])['add'](_0x341240[_0x1d01('0xe')],_0x1d01('0x1d'))>moment()){return _0x40dd41(null,![],{'message':_0x1d01('0x1a')});}else{return utils[_0x1d01('0x1e')](_0x243c22,_0x1e929c,![],null)['then'](function(){return _0x40dd41(null,![],{'message':_0x1d01('0x1a')});});}}else{return _0x40dd41(null,![],{'message':_0x1d01('0x1a')});}}else{if(_0x1e929c>=_0x341240['allowedLoginAttempts']){return utils[_0x1d01('0x1e')](_0x243c22,0x0,!![],moment())['then'](function(){return _0x40dd41(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}else{return utils['clearBlockUser'](_0x243c22,_0x1e929c,![],null)[_0x1d01('0x19')](function(){return _0x40dd41(null,![],{'message':_0x1d01('0x1a')});});}}}else{return _0x40dd41(null,![],{'message':_0x1d01('0x1a')});}}else{if(_0x243c22['disabled']){return _0x40dd41(null,![],{'message':_0x1d01('0x1a')});}else if(_0x341240['allowedLoginAttempts']>0x0){if(_0x243c22[_0x1d01('0x13')]){if(_0x341240[_0x1d01('0xe')]>0x0){if(moment(_0x243c22[_0x1d01('0x14')])[_0x1d01('0x1f')](_0x341240[_0x1d01('0xe')],_0x1d01('0x1d'))>moment()){return _0x40dd41(null,![],{'message':_0x1d01('0x1a')});}else{return utils[_0x1d01('0x1e')](_0x243c22,0x0,![],null)[_0x1d01('0x19')](function(){return utils['getLicense'](_0x243c22);})[_0x1d01('0x19')](function(){return _0x40dd41(null,_0x243c22);});}}else{return _0x40dd41(null,![],{'message':_0x1d01('0x1a')});}}else{return utils[_0x1d01('0x1e')](_0x243c22,0x0,![],null)['then'](function(){return utils[_0x1d01('0x20')](_0x243c22);})['then'](function(){return _0x40dd41(null,_0x243c22);})[_0x1d01('0x21')](function(_0x199afb){return _0x40dd41(null,![],_0x199afb);});}}else{if(_0x243c22[_0x1d01('0x13')]){return _0x40dd41(null,![],{'message':_0x1d01('0x1a')});}else{return utils[_0x1d01('0x20')](_0x243c22)[_0x1d01('0x19')](function(){return _0x40dd41(null,_0x243c22);});}}}});})[_0x1d01('0x21')](function(_0x3c0072){return _0x40dd41(null,![],_0x3c0072);});}function sendServiceMail(_0x3aa0e5){return db[_0x1d01('0x22')][_0x1d01('0x23')]({'where':{'service':!![]},'attributes':['id',_0x1d01('0xf'),_0x1d01('0x24')],'include':[{'model':db['MailServerOut'],'as':'Smtp','include':[{'model':db['CloudProvider'],'as':'CloudProvider'}]}]})[_0x1d01('0x19')](function(_0x59613b){if(!_0x59613b){throw new Error(_0x1d01('0x25'));}var _0x4c9c19=_0x59613b['getSmtpOptions']();var _0x11226c={'account':_0x4c9c19,'message':_['merge']({'from':util[_0x1d01('0x26')](_0x1d01('0x27'),_0x59613b[_0x1d01('0xf')],_0x59613b[_0x1d01('0x24')]||_0x59613b['Smtp']['user'])},_0x3aa0e5)};return client['request'](_0x1d01('0x28'),_0x11226c);})[_0x1d01('0x19')](function(_0x2456b9){if(_0x2456b9[_0x1d01('0x29')]){throw new Error(util['format'](_0x1d01('0x2a'),_0x2456b9[_0x1d01('0x29')][_0x1d01('0x2b')]||JSON[_0x1d01('0x2c')](_0x2456b9[_0x1d01('0x29')])));}return!![];});}function handleError(_0x43c419,_0x523976,_0x1d83c5){return _0x43c419[_0x1d01('0x2d')](_0x523976||0x1f4)[_0x1d01('0x2e')]({'message':_0x1d83c5?_0x1d83c5[_0x1d01('0x2b')]||_0x1d83c5:''});}exports['login']=function(_0x3899c1,_0x4c4902,_0x3d4f31){passport[_0x1d01('0x1b')](_0x1d01('0x2f'),function(_0x5bd596,_0x55f207,_0x3a2c69){var _0x161e83=_0x5bd596||_0x3a2c69;if(_0x161e83){return handleError(_0x4c4902,0x191,_0x161e83);}if(!_0x55f207){return handleError(_0x4c4902,0x194,{'message':_0x1d01('0x30')});}else{var _0x773d5e={'payload':{'id':_0x55f207['id'],'role':_0x55f207[_0x1d01('0x11')]},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x773d5e)[_0x1d01('0x19')](function(_0x5efcca){_0x4c4902['json']({'id':_0x55f207['id'],'token':_0x5efcca,'statusCall':'','isAlreadyLogged':_0x55f207[_0x1d01('0x31')]});});}})(_0x3899c1,_0x4c4902,_0x3d4f31);};exports[_0x1d01('0x32')]=function(_0x4ff332,_0x22860a){if(!_0x4ff332[_0x1d01('0x33')][_0x1d01('0x24')]){return handleError(_0x22860a,0x1f4,{'message':_0x1d01('0x34')});}var _0x5a6d5d=rs[_0x1d01('0x35')]();_0x4ff332['body'][_0x1d01('0x24')]=_0x4ff332['body'][_0x1d01('0x24')][_0x1d01('0x36')]()[_0x1d01('0x37')]();var _0x2c6536;return db[_0x1d01('0xc')][_0x1d01('0xd')]({'where':{'id':0x1},'attributes':[_0x1d01('0x1c'),_0x1d01('0xe')],'raw':!![]})['then'](function(_0x3d42fb){_0x2c6536=_0x3d42fb;return db['User']['find']({'where':{'email':_0x4ff332['body'][_0x1d01('0x24')]}});})['then'](function(_0x167dc0){if(!_0x167dc0){throw new Error('This\x20email\x20is\x20not\x20registered.');}if(_0x167dc0['disabled']){throw new Error(_0x1d01('0x38'));}if(_0x167dc0[_0x1d01('0x13')]){if(moment(_0x167dc0[_0x1d01('0x14')])[_0x1d01('0x1f')](_0x2c6536[_0x1d01('0xe')],'minutes')>moment()){throw new Error(_0x1d01('0x39'));}else{_0x167dc0['blocked']=![];_0x167dc0[_0x1d01('0x14')]=null;}}_0x167dc0[_0x1d01('0x3a')]=_0x5a6d5d;_0x167dc0[_0x1d01('0x3b')]=Date[_0x1d01('0x3c')]()+0x36ee80;return _0x167dc0['save']();})[_0x1d01('0x19')](function(){return sendServiceMail({'to':_0x4ff332[_0x1d01('0x33')][_0x1d01('0x24')],'subject':_0x1d01('0x3d'),'text':_0x1d01('0x3e')+_0x1d01('0x3f')+_0x1d01('0x40')+_0x4ff332['headers']['host']+_0x1d01('0x41')+_0x5a6d5d+'\x0a\x0a'+'If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a'});})[_0x1d01('0x19')](function(){_0x22860a[_0x1d01('0x2d')](0xc8)[_0x1d01('0x2e')]({'message':'Reset\x20Email\x20sent!'});})[_0x1d01('0x21')](function(_0x230ca2){return handleError(_0x22860a,0x1f4,_0x230ca2);});};exports['reset']=function(_0x4b16b9,_0x361c6c){return db[_0x1d01('0x42')][_0x1d01('0x23')]({'where':{'resetPasswordToken':_0x4b16b9[_0x1d01('0x43')][_0x1d01('0x44')],'resetPasswordExpires':{'$gt':Date['now']()}}})[_0x1d01('0x19')](function(_0x3e4416){if(!_0x3e4416){throw new Error(_0x1d01('0x45'));}return db[_0x1d01('0xc')][_0x1d01('0xd')]({'attributes':['id',_0x1d01('0x46'),'enforcePasswordHistory','passwordHistoryLimit']})[_0x1d01('0x19')](function(_0x1f0ce6){if(_0x1f0ce6[_0x1d01('0x46')])authService[_0x1d01('0x47')](_0x4b16b9['body'][_0x1d01('0x48')]);if(!_0x1f0ce6['enforcePasswordHistory']||!_0x3e4416['previousPasswords'])return _0x3e4416;authService[_0x1d01('0x49')](_0x4b16b9[_0x1d01('0x33')][_0x1d01('0x48')],_0x3e4416[_0x1d01('0x4a')],_0x1f0ce6[_0x1d01('0x4b')]);return _0x3e4416;})[_0x1d01('0x19')](function(){_0x3e4416['password']=_0x4b16b9['body'][_0x1d01('0x48')];_0x3e4416[_0x1d01('0x3a')]=null;_0x3e4416['resetPasswordExpires']=null;return _0x3e4416[_0x1d01('0x4c')]();});})['then'](function(){_0x361c6c[_0x1d01('0x2d')](0xc8)[_0x1d01('0x2e')]({'message':_0x1d01('0x4d')});})[_0x1d01('0x21')](function(_0x18e0e6){return handleError(_0x361c6c,0x1f4,_0x18e0e6);});};passport[_0x1d01('0x4e')](_0x1d01('0x2f'),new LocalStrategy({'usernameField':_0x1d01('0xf'),'passwordField':_0x1d01('0x48')},function(_0x1237b6,_0x181bdc,_0x36b365){return localAuthenticate(db[_0x1d01('0x42')],_0x1237b6,_0x181bdc,_0x36b365);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index 2ae572c..56e3f59 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 _0x5330=['./authLocal.controller','post','login','/reset/:token','reset','express','Router'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x5330,0xd7));var _0x0533=function(_0xfa7d9b,_0x52d96b){_0xfa7d9b=_0xfa7d9b-0x0;var _0x27dfc7=_0x5330[_0xfa7d9b];return _0x27dfc7;};'use strict';var express=require(_0x0533('0x0'));var router=express[_0x0533('0x1')]();var controller=require(_0x0533('0x2'));router[_0x0533('0x3')]('/',controller[_0x0533('0x4')]);router[_0x0533('0x3')]('/forgot',controller['forgot']);router[_0x0533('0x3')](_0x0533('0x5'),controller[_0x0533('0x6')]);module['exports']=router; \ No newline at end of file +var _0x4df6=['forgot','/reset/:token','reset','exports','./authLocal.controller','login','post'];(function(_0x2ebbfc,_0x4dd780){var _0x4dd205=function(_0xbb6191){while(--_0xbb6191){_0x2ebbfc['push'](_0x2ebbfc['shift']());}};_0x4dd205(++_0x4dd780);}(_0x4df6,0x1e0));var _0x64df=function(_0x1863c9,_0x248940){_0x1863c9=_0x1863c9-0x0;var _0x4c4d5a=_0x4df6[_0x1863c9];return _0x4c4d5a;};'use strict';var express=require('express');var router=express['Router']();var controller=require(_0x64df('0x0'));router['post']('/',controller[_0x64df('0x1')]);router[_0x64df('0x2')]('/forgot',controller[_0x64df('0x3')]);router['post'](_0x64df('0x4'),controller[_0x64df('0x5')]);module[_0x64df('0x6')]=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index a92e79f..97c163f 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 _0xf106=['STRING','BOOLEAN','INTEGER','sequelize','exports'];(function(_0x1ae78f,_0x122ed2){var _0x5baf80=function(_0x28a303){while(--_0x28a303){_0x1ae78f['push'](_0x1ae78f['shift']());}};_0x5baf80(++_0x122ed2);}(_0xf106,0x1ac));var _0x6f10=function(_0x418549,_0x11b13d){_0x418549=_0x418549-0x0;var _0x288826=_0xf106[_0x418549];return _0x288826;};'use strict';var Sequelize=require(_0x6f10('0x0'));module[_0x6f10('0x1')]={'name':{'type':Sequelize[_0x6f10('0x2')],'allowNull':![]},'channel':{'type':Sequelize[_0x6f10('0x2')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0x6f10('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x6f10('0x4')],'defaultValue':0xa}}; \ No newline at end of file +var _0x27a7=['BOOLEAN','INTEGER','exports','STRING'];(function(_0x389b43,_0x337adb){var _0x3b14e2=function(_0x4f781a){while(--_0x4f781a){_0x389b43['push'](_0x389b43['shift']());}};_0x3b14e2(++_0x337adb);}(_0x27a7,0x1b6));var _0x727a=function(_0x1fcaf1,_0x21c3c2){_0x1fcaf1=_0x1fcaf1-0x0;var _0x55f464=_0x27a7[_0x1fcaf1];return _0x55f464;};'use strict';var Sequelize=require('sequelize');module[_0x727a('0x0')]={'name':{'type':Sequelize[_0x727a('0x1')],'allowNull':![]},'channel':{'type':Sequelize[_0x727a('0x1')]},'description':{'type':Sequelize[_0x727a('0x1')]},'status':{'type':Sequelize[_0x727a('0x2')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x727a('0x3')],'defaultValue':0xa}}; \ No newline at end of file diff --git a/server/api/automation/automation.controller.js b/server/api/automation/automation.controller.js index 4de52a5..09da51b 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 _0xb761=['addActions','Action','getActions','eml-format','rimraf','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','squel','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','map','Automation','fieldName','type','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','update','addConditions','Condition','ids','omit','getConditions','findOne','rawAttributes','order','sort','filters'];(function(_0x5c80b7,_0x5c6250){var _0x4a20a7=function(_0x22dd64){while(--_0x22dd64){_0x5c80b7['push'](_0x5c80b7['shift']());}};_0x4a20a7(++_0x5c6250);}(_0xb761,0x14f));var _0x1b76=function(_0x4697fa,_0x21c841){_0x4697fa=_0x4697fa-0x0;var _0x390950=_0xb761[_0x4697fa];return _0x390950;};'use strict';var emlformat=require(_0x1b76('0x0'));var rimraf=require(_0x1b76('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x1b76('0x2'));var moment=require(_0x1b76('0x3'));var BPromise=require(_0x1b76('0x4'));var Mustache=require(_0x1b76('0x5'));var util=require('util');var path=require(_0x1b76('0x6'));var sox=require('sox');var csv=require(_0x1b76('0x7'));var ejs=require(_0x1b76('0x8'));var fs=require('fs');var fs_extra=require(_0x1b76('0x9'));var _=require('lodash');var squel=require(_0x1b76('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x1b76('0xb'));var Papa=require(_0x1b76('0xc'));var Redis=require(_0x1b76('0xd'));var authService=require(_0x1b76('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x1b76('0xf'));var hardwareService=require(_0x1b76('0x10'));var logger=require('../../config/logger')('api');var utils=require(_0x1b76('0x11'));var config=require(_0x1b76('0x12'));var licenseUtil=require(_0x1b76('0x13'));var db=require(_0x1b76('0x14'))['db'];function respondWithStatusCode(_0x4675be,_0x168858){_0x168858=_0x168858||0xcc;return function(_0x32932b){if(_0x32932b){return _0x4675be[_0x1b76('0x15')](_0x168858);}return _0x4675be[_0x1b76('0x16')](_0x168858)[_0x1b76('0x17')]();};}function respondWithResult(_0x242320,_0x169881){_0x169881=_0x169881||0xc8;return function(_0x3ce074){if(_0x3ce074){return _0x242320[_0x1b76('0x16')](_0x169881)[_0x1b76('0x18')](_0x3ce074);}};}function respondWithFilteredResult(_0x539985,_0x4756dd){return function(_0x30dd8a){if(_0x30dd8a){var _0x18da55=typeof _0x4756dd[_0x1b76('0x19')]===_0x1b76('0x1a')&&typeof _0x4756dd['limit']===_0x1b76('0x1a');var _0x455c9a=_0x30dd8a['count'];var _0x3af231=_0x18da55?0x0:_0x4756dd[_0x1b76('0x19')];var _0x46d43f=_0x18da55?_0x30dd8a[_0x1b76('0x1b')]:_0x4756dd[_0x1b76('0x19')]+_0x4756dd['limit'];var _0x5b2415;if(_0x46d43f>=_0x455c9a){_0x46d43f=_0x455c9a;_0x5b2415=0xc8;}else{_0x5b2415=0xce;}_0x539985[_0x1b76('0x16')](_0x5b2415);return _0x539985[_0x1b76('0x1c')](_0x1b76('0x1d'),_0x3af231+'-'+_0x46d43f+'/'+_0x455c9a)[_0x1b76('0x18')](_0x30dd8a);}return null;};}function patchUpdates(_0x2a9ab2){return function(_0x2601ea){try{jsonpatch[_0x1b76('0x1e')](_0x2601ea,_0x2a9ab2,!![]);}catch(_0x9794c0){return BPromise[_0x1b76('0x1f')](_0x9794c0);}return _0x2601ea[_0x1b76('0x20')]();};}function saveUpdates(_0x2ba32a,_0x279878){return function(_0x286339){if(_0x286339){return _0x286339['update'](_0x2ba32a)[_0x1b76('0x21')](function(_0x16037d){return _0x16037d;});}return null;};}function removeEntity(_0x23c509,_0x3f3a1a){return function(_0x21ca1a){if(_0x21ca1a){return _0x21ca1a[_0x1b76('0x22')]()[_0x1b76('0x21')](function(){_0x23c509['status'](0xcc)[_0x1b76('0x17')]();});}};}function handleEntityNotFound(_0xc441a4,_0x42f5b3){return function(_0x8a8261){if(!_0x8a8261){_0xc441a4['sendStatus'](0x194);}return _0x8a8261;};}function handleError(_0x2c0fcd,_0x1d848a){_0x1d848a=_0x1d848a||0x1f4;return function(_0x46e760){logger[_0x1b76('0x23')](_0x46e760[_0x1b76('0x24')]);if(_0x46e760['name']){delete _0x46e760[_0x1b76('0x25')];}_0x2c0fcd[_0x1b76('0x16')](_0x1d848a)[_0x1b76('0x26')](_0x46e760);};}exports['index']=function(_0x582ea3,_0x49c32e){var _0x5b1a1c={},_0x19dbf6={},_0x573b03={'count':0x0,'rows':[]};var _0x76d8b0=_[_0x1b76('0x27')](db[_0x1b76('0x28')]['rawAttributes'],function(_0x5d04ae){return{'name':_0x5d04ae[_0x1b76('0x29')],'type':_0x5d04ae[_0x1b76('0x2a')]['key']};});_0x19dbf6[_0x1b76('0x2b')]=_['map'](_0x76d8b0,_0x1b76('0x25'));_0x19dbf6[_0x1b76('0x2c')]=_[_0x1b76('0x2d')](_0x582ea3[_0x1b76('0x2c')]);_0x19dbf6['filters']=_['intersection'](_0x19dbf6[_0x1b76('0x2b')],_0x19dbf6[_0x1b76('0x2c')]);_0x5b1a1c[_0x1b76('0x2e')]=_[_0x1b76('0x2f')](_0x19dbf6[_0x1b76('0x2b')],qs[_0x1b76('0x30')](_0x582ea3[_0x1b76('0x2c')]['fields']));_0x5b1a1c[_0x1b76('0x2e')]=_0x5b1a1c['attributes'][_0x1b76('0x31')]?_0x5b1a1c[_0x1b76('0x2e')]:_0x19dbf6[_0x1b76('0x2b')];if(!_0x582ea3[_0x1b76('0x2c')][_0x1b76('0x32')](_0x1b76('0x33'))){_0x5b1a1c[_0x1b76('0x34')]=qs[_0x1b76('0x34')](_0x582ea3[_0x1b76('0x2c')]['limit']);_0x5b1a1c['offset']=qs[_0x1b76('0x19')](_0x582ea3[_0x1b76('0x2c')][_0x1b76('0x19')]);}_0x5b1a1c['order']=qs['sort'](_0x582ea3[_0x1b76('0x2c')]['sort']);_0x5b1a1c[_0x1b76('0x35')]=qs['filters'](_[_0x1b76('0x36')](_0x582ea3['query'],_0x19dbf6['filters']),_0x76d8b0);if(_0x582ea3[_0x1b76('0x2c')]['filter']){_0x5b1a1c[_0x1b76('0x35')]=_[_0x1b76('0x37')](_0x5b1a1c[_0x1b76('0x35')],{'$or':_['map'](_0x76d8b0,function(_0x3f0909){if(_0x3f0909[_0x1b76('0x2a')]!==_0x1b76('0x38')){var _0x438536={};_0x438536[_0x3f0909[_0x1b76('0x25')]]={'$like':'%'+_0x582ea3[_0x1b76('0x2c')][_0x1b76('0x39')]+'%'};return _0x438536;}})});}_0x5b1a1c=_['merge']({},_0x5b1a1c,_0x582ea3[_0x1b76('0x3a')]);var _0x2a2094={'where':_0x5b1a1c[_0x1b76('0x35')]};return db[_0x1b76('0x28')][_0x1b76('0x1b')](_0x2a2094)[_0x1b76('0x21')](function(_0x1e3df0){_0x573b03['count']=_0x1e3df0;if(_0x582ea3['query'][_0x1b76('0x3b')]){_0x5b1a1c[_0x1b76('0x3c')]=[{'all':!![]}];}return db['Automation'][_0x1b76('0x3d')](_0x5b1a1c);})[_0x1b76('0x21')](function(_0x1178e9){_0x573b03[_0x1b76('0x3e')]=_0x1178e9;return _0x573b03;})['then'](respondWithFilteredResult(_0x49c32e,_0x5b1a1c))[_0x1b76('0x3f')](handleError(_0x49c32e,null));};exports[_0x1b76('0x40')]=function(_0x6094d1,_0x5eeb22){var _0x64a603={'raw':![],'where':{'id':_0x6094d1[_0x1b76('0x41')]['id']}},_0x4429a2={};_0x4429a2[_0x1b76('0x2b')]=_[_0x1b76('0x2d')](db[_0x1b76('0x28')]['rawAttributes']);_0x4429a2[_0x1b76('0x2c')]=_[_0x1b76('0x2d')](_0x6094d1[_0x1b76('0x2c')]);_0x4429a2['filters']=_[_0x1b76('0x2f')](_0x4429a2['model'],_0x4429a2['query']);_0x64a603['attributes']=_[_0x1b76('0x2f')](_0x4429a2['model'],qs[_0x1b76('0x30')](_0x6094d1[_0x1b76('0x2c')][_0x1b76('0x30')]));_0x64a603[_0x1b76('0x2e')]=_0x64a603['attributes'][_0x1b76('0x31')]?_0x64a603['attributes']:_0x4429a2['model'];if(_0x6094d1['query'][_0x1b76('0x3b')]){_0x64a603[_0x1b76('0x3c')]=[{'all':!![]}];}_0x64a603=_[_0x1b76('0x37')]({},_0x64a603,_0x6094d1[_0x1b76('0x3a')]);return db['Automation'][_0x1b76('0x42')](_0x64a603)[_0x1b76('0x21')](handleEntityNotFound(_0x5eeb22,null))[_0x1b76('0x21')](respondWithResult(_0x5eeb22,null))['catch'](handleError(_0x5eeb22,null));};exports[_0x1b76('0x43')]=function(_0x114e8d,_0x50e39d){return db[_0x1b76('0x28')]['create'](_0x114e8d[_0x1b76('0x44')],{})[_0x1b76('0x21')](respondWithResult(_0x50e39d,0xc9))[_0x1b76('0x3f')](handleError(_0x50e39d,null));};exports[_0x1b76('0x45')]=function(_0x2a853e,_0x5bbd73){if(_0x2a853e[_0x1b76('0x44')]['id']){delete _0x2a853e[_0x1b76('0x44')]['id'];}return db[_0x1b76('0x28')]['find']({'where':{'id':_0x2a853e[_0x1b76('0x41')]['id']}})[_0x1b76('0x21')](handleEntityNotFound(_0x5bbd73,null))[_0x1b76('0x21')](saveUpdates(_0x2a853e[_0x1b76('0x44')],null))['then'](respondWithResult(_0x5bbd73,null))[_0x1b76('0x3f')](handleError(_0x5bbd73,null));};exports[_0x1b76('0x22')]=function(_0x419f9b,_0x48f45e){return db[_0x1b76('0x28')]['find']({'where':{'id':_0x419f9b[_0x1b76('0x41')]['id']}})['then'](handleEntityNotFound(_0x48f45e,null))['then'](removeEntity(_0x48f45e,null))[_0x1b76('0x3f')](handleError(_0x48f45e,null));};exports[_0x1b76('0x46')]=function(_0x2fc41b,_0x5f3e68,_0x4e57ae){return db[_0x1b76('0x47')][_0x1b76('0x42')]({'where':{'id':_0x2fc41b[_0x1b76('0x41')]['id']}})[_0x1b76('0x21')](handleEntityNotFound(_0x5f3e68,null))[_0x1b76('0x21')](function(_0x202a3e){if(_0x202a3e){return _0x202a3e[_0x1b76('0x46')](_0x2fc41b[_0x1b76('0x44')][_0x1b76('0x48')],_[_0x1b76('0x49')](_0x2fc41b[_0x1b76('0x44')],[_0x1b76('0x48'),'id'])||{});}})[_0x1b76('0x21')](respondWithResult(_0x5f3e68,null))[_0x1b76('0x3f')](handleError(_0x5f3e68,null));};exports[_0x1b76('0x4a')]=function(_0x27ad7c,_0x54fd49,_0x276fe0){var _0x508cd0={};var _0x2296da={};var _0x366e19;var _0xf84cc;return db[_0x1b76('0x28')][_0x1b76('0x4b')]({'where':{'id':_0x27ad7c[_0x1b76('0x41')]['id']}})[_0x1b76('0x21')](handleEntityNotFound(_0x54fd49,null))[_0x1b76('0x21')](function(_0x1b6d68){if(_0x1b6d68){_0x366e19=_0x1b6d68;_0x2296da['model']=_[_0x1b76('0x2d')](db[_0x1b76('0x47')][_0x1b76('0x4c')]);_0x2296da[_0x1b76('0x2c')]=_[_0x1b76('0x2d')](_0x27ad7c[_0x1b76('0x2c')]);_0x2296da['filters']=_[_0x1b76('0x2f')](_0x2296da[_0x1b76('0x2b')],_0x2296da[_0x1b76('0x2c')]);_0x508cd0[_0x1b76('0x2e')]=_['intersection'](_0x2296da[_0x1b76('0x2b')],qs[_0x1b76('0x30')](_0x27ad7c['query'][_0x1b76('0x30')]));_0x508cd0['attributes']=_0x508cd0['attributes']['length']?_0x508cd0['attributes']:_0x2296da[_0x1b76('0x2b')];_0x508cd0[_0x1b76('0x4d')]=qs[_0x1b76('0x4e')](_0x27ad7c[_0x1b76('0x2c')][_0x1b76('0x4e')]);_0x508cd0[_0x1b76('0x35')]=qs[_0x1b76('0x4f')](_[_0x1b76('0x36')](_0x27ad7c[_0x1b76('0x2c')],_0x2296da[_0x1b76('0x4f')]));if(_0x27ad7c[_0x1b76('0x2c')][_0x1b76('0x39')]){_0x508cd0[_0x1b76('0x35')]=_[_0x1b76('0x37')](_0x508cd0['where'],{'$or':_[_0x1b76('0x27')](_0x508cd0[_0x1b76('0x2e')],function(_0x245e5e){var _0x500836={};_0x500836[_0x245e5e]={'$like':'%'+_0x27ad7c[_0x1b76('0x2c')]['filter']+'%'};return _0x500836;})});}_0x508cd0=_[_0x1b76('0x37')]({},_0x508cd0,_0x27ad7c[_0x1b76('0x3a')]);return _0x366e19[_0x1b76('0x4a')](_0x508cd0);}})['then'](function(_0x2ec36c){if(_0x2ec36c){_0xf84cc=_0x2ec36c[_0x1b76('0x31')];if(!_0x27ad7c['query'][_0x1b76('0x32')](_0x1b76('0x33'))){_0x508cd0[_0x1b76('0x34')]=qs[_0x1b76('0x34')](_0x27ad7c[_0x1b76('0x2c')]['limit']);_0x508cd0[_0x1b76('0x19')]=qs[_0x1b76('0x19')](_0x27ad7c[_0x1b76('0x2c')][_0x1b76('0x19')]);}return _0x366e19[_0x1b76('0x4a')](_0x508cd0);}})[_0x1b76('0x21')](function(_0x40b011){if(_0x40b011){return _0x40b011?{'count':_0xf84cc,'rows':_0x40b011}:null;}})['then'](respondWithResult(_0x54fd49,null))[_0x1b76('0x3f')](handleError(_0x54fd49,null));};exports[_0x1b76('0x50')]=function(_0x278474,_0x3648e5,_0xed2864){return db[_0x1b76('0x51')][_0x1b76('0x42')]({'where':{'id':_0x278474[_0x1b76('0x41')]['id']}})[_0x1b76('0x21')](handleEntityNotFound(_0x3648e5,null))['then'](function(_0x27bda4){if(_0x27bda4){return _0x27bda4['addActions'](_0x278474[_0x1b76('0x44')][_0x1b76('0x48')],_[_0x1b76('0x49')](_0x278474[_0x1b76('0x44')],[_0x1b76('0x48'),'id'])||{});}})[_0x1b76('0x21')](respondWithResult(_0x3648e5,null))[_0x1b76('0x3f')](handleError(_0x3648e5,null));};exports['getActions']=function(_0x4a4118,_0x179172,_0x12f96f){var _0x4acfea={};var _0x34f015={};var _0x5729a2;var _0x40e005;return db['Automation'][_0x1b76('0x4b')]({'where':{'id':_0x4a4118[_0x1b76('0x41')]['id']}})[_0x1b76('0x21')](handleEntityNotFound(_0x179172,null))[_0x1b76('0x21')](function(_0x1512f0){if(_0x1512f0){_0x5729a2=_0x1512f0;_0x34f015['model']=_[_0x1b76('0x2d')](db['Action'][_0x1b76('0x4c')]);_0x34f015[_0x1b76('0x2c')]=_['keys'](_0x4a4118[_0x1b76('0x2c')]);_0x34f015[_0x1b76('0x4f')]=_[_0x1b76('0x2f')](_0x34f015[_0x1b76('0x2b')],_0x34f015[_0x1b76('0x2c')]);_0x4acfea[_0x1b76('0x2e')]=_[_0x1b76('0x2f')](_0x34f015['model'],qs[_0x1b76('0x30')](_0x4a4118[_0x1b76('0x2c')]['fields']));_0x4acfea[_0x1b76('0x2e')]=_0x4acfea[_0x1b76('0x2e')][_0x1b76('0x31')]?_0x4acfea['attributes']:_0x34f015[_0x1b76('0x2b')];_0x4acfea['order']=qs[_0x1b76('0x4e')](_0x4a4118['query'][_0x1b76('0x4e')]);_0x4acfea['where']=qs[_0x1b76('0x4f')](_['pick'](_0x4a4118[_0x1b76('0x2c')],_0x34f015[_0x1b76('0x4f')]));if(_0x4a4118[_0x1b76('0x2c')][_0x1b76('0x39')]){_0x4acfea[_0x1b76('0x35')]=_[_0x1b76('0x37')](_0x4acfea[_0x1b76('0x35')],{'$or':_[_0x1b76('0x27')](_0x4acfea[_0x1b76('0x2e')],function(_0x27a739){var _0x260ebe={};_0x260ebe[_0x27a739]={'$like':'%'+_0x4a4118[_0x1b76('0x2c')][_0x1b76('0x39')]+'%'};return _0x260ebe;})});}_0x4acfea=_[_0x1b76('0x37')]({},_0x4acfea,_0x4a4118[_0x1b76('0x3a')]);return _0x5729a2[_0x1b76('0x52')](_0x4acfea);}})['then'](function(_0x399723){if(_0x399723){_0x40e005=_0x399723[_0x1b76('0x31')];if(!_0x4a4118['query']['hasOwnProperty'](_0x1b76('0x33'))){_0x4acfea[_0x1b76('0x34')]=qs[_0x1b76('0x34')](_0x4a4118['query'][_0x1b76('0x34')]);_0x4acfea[_0x1b76('0x19')]=qs[_0x1b76('0x19')](_0x4a4118[_0x1b76('0x2c')]['offset']);}return _0x5729a2['getActions'](_0x4acfea);}})[_0x1b76('0x21')](function(_0x482383){if(_0x482383){return _0x482383?{'count':_0x40e005,'rows':_0x482383}:null;}})[_0x1b76('0x21')](respondWithResult(_0x179172,null))[_0x1b76('0x3f')](handleError(_0x179172,null));}; \ No newline at end of file +var _0x57df=['mustache','util','path','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','Automation','rawAttributes','fieldName','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','type','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','length','include','merge','find','create','body','addConditions','Condition','ids','omit','getConditions','order','addActions','getActions','findOne','eml-format','request-promise','moment'];(function(_0x267d8d,_0xe90f65){var _0x11a98f=function(_0x5703c9){while(--_0x5703c9){_0x267d8d['push'](_0x267d8d['shift']());}};_0x11a98f(++_0xe90f65);}(_0x57df,0x145));var _0xf57d=function(_0x2fc565,_0x3e1d33){_0x2fc565=_0x2fc565-0x0;var _0x230f9a=_0x57df[_0x2fc565];return _0x230f9a;};'use strict';var emlformat=require(_0xf57d('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xf57d('0x1'));var moment=require(_0xf57d('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xf57d('0x3'));var util=require(_0xf57d('0x4'));var path=require(_0xf57d('0x5'));var sox=require('sox');var csv=require(_0xf57d('0x6'));var ejs=require(_0xf57d('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf57d('0x8'));var squel=require(_0xf57d('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xf57d('0xa'));var toCsv=require(_0xf57d('0x6'));var querystring=require(_0xf57d('0xb'));var Papa=require(_0xf57d('0xc'));var Redis=require(_0xf57d('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xf57d('0xe'));var as=require(_0xf57d('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf57d('0x10'))(_0xf57d('0x11'));var utils=require(_0xf57d('0x12'));var config=require(_0xf57d('0x13'));var licenseUtil=require(_0xf57d('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x193504,_0x502f0e){_0x502f0e=_0x502f0e||0xcc;return function(_0x2c8a63){if(_0x2c8a63){return _0x193504[_0xf57d('0x15')](_0x502f0e);}return _0x193504['status'](_0x502f0e)[_0xf57d('0x16')]();};}function respondWithResult(_0x4bab64,_0x1f0178){_0x1f0178=_0x1f0178||0xc8;return function(_0x5be7dd){if(_0x5be7dd){return _0x4bab64[_0xf57d('0x17')](_0x1f0178)[_0xf57d('0x18')](_0x5be7dd);}};}function respondWithFilteredResult(_0x45977c,_0x38b653){return function(_0x60a5f9){if(_0x60a5f9){var _0xcdd44f=typeof _0x38b653[_0xf57d('0x19')]===_0xf57d('0x1a')&&typeof _0x38b653[_0xf57d('0x1b')]===_0xf57d('0x1a');var _0x424eab=_0x60a5f9[_0xf57d('0x1c')];var _0x3fc60a=_0xcdd44f?0x0:_0x38b653[_0xf57d('0x19')];var _0x4b3948=_0xcdd44f?_0x60a5f9['count']:_0x38b653[_0xf57d('0x19')]+_0x38b653[_0xf57d('0x1b')];var _0x3cb172;if(_0x4b3948>=_0x424eab){_0x4b3948=_0x424eab;_0x3cb172=0xc8;}else{_0x3cb172=0xce;}_0x45977c[_0xf57d('0x17')](_0x3cb172);return _0x45977c[_0xf57d('0x1d')]('Content-Range',_0x3fc60a+'-'+_0x4b3948+'/'+_0x424eab)['json'](_0x60a5f9);}return null;};}function patchUpdates(_0x3c6190){return function(_0x1a4551){try{jsonpatch[_0xf57d('0x1e')](_0x1a4551,_0x3c6190,!![]);}catch(_0x1715c2){return BPromise[_0xf57d('0x1f')](_0x1715c2);}return _0x1a4551[_0xf57d('0x20')]();};}function saveUpdates(_0x6fe56d,_0x4a0cd1){return function(_0x2945c0){if(_0x2945c0){return _0x2945c0[_0xf57d('0x21')](_0x6fe56d)['then'](function(_0x516401){return _0x516401;});}return null;};}function removeEntity(_0x41d133,_0x34d559){return function(_0x4cf350){if(_0x4cf350){return _0x4cf350[_0xf57d('0x22')]()[_0xf57d('0x23')](function(){_0x41d133[_0xf57d('0x17')](0xcc)[_0xf57d('0x16')]();});}};}function handleEntityNotFound(_0xdaea83,_0x1f1e14){return function(_0x2c4fd3){if(!_0x2c4fd3){_0xdaea83[_0xf57d('0x15')](0x194);}return _0x2c4fd3;};}function handleError(_0x22507c,_0x33cb10){_0x33cb10=_0x33cb10||0x1f4;return function(_0x41091b){logger[_0xf57d('0x24')](_0x41091b[_0xf57d('0x25')]);if(_0x41091b[_0xf57d('0x26')]){delete _0x41091b[_0xf57d('0x26')];}_0x22507c[_0xf57d('0x17')](_0x33cb10)[_0xf57d('0x27')](_0x41091b);};}exports[_0xf57d('0x28')]=function(_0x668d17,_0x4caa65){var _0x29cfa2={},_0x40f14b={},_0x2ed8ac={'count':0x0,'rows':[]};var _0x46d938=_[_0xf57d('0x29')](db[_0xf57d('0x2a')][_0xf57d('0x2b')],function(_0x5205d6){return{'name':_0x5205d6[_0xf57d('0x2c')],'type':_0x5205d6['type']['key']};});_0x40f14b['model']=_[_0xf57d('0x29')](_0x46d938,_0xf57d('0x26'));_0x40f14b[_0xf57d('0x2d')]=_[_0xf57d('0x2e')](_0x668d17[_0xf57d('0x2d')]);_0x40f14b[_0xf57d('0x2f')]=_[_0xf57d('0x30')](_0x40f14b[_0xf57d('0x31')],_0x40f14b[_0xf57d('0x2d')]);_0x29cfa2[_0xf57d('0x32')]=_[_0xf57d('0x30')](_0x40f14b[_0xf57d('0x31')],qs[_0xf57d('0x33')](_0x668d17[_0xf57d('0x2d')][_0xf57d('0x33')]));_0x29cfa2[_0xf57d('0x32')]=_0x29cfa2[_0xf57d('0x32')]['length']?_0x29cfa2[_0xf57d('0x32')]:_0x40f14b[_0xf57d('0x31')];if(!_0x668d17['query'][_0xf57d('0x34')](_0xf57d('0x35'))){_0x29cfa2['limit']=qs[_0xf57d('0x1b')](_0x668d17[_0xf57d('0x2d')]['limit']);_0x29cfa2[_0xf57d('0x19')]=qs[_0xf57d('0x19')](_0x668d17[_0xf57d('0x2d')][_0xf57d('0x19')]);}_0x29cfa2['order']=qs[_0xf57d('0x36')](_0x668d17['query'][_0xf57d('0x36')]);_0x29cfa2[_0xf57d('0x37')]=qs[_0xf57d('0x2f')](_[_0xf57d('0x38')](_0x668d17['query'],_0x40f14b['filters']),_0x46d938);if(_0x668d17[_0xf57d('0x2d')][_0xf57d('0x39')]){_0x29cfa2[_0xf57d('0x37')]=_['merge'](_0x29cfa2[_0xf57d('0x37')],{'$or':_['map'](_0x46d938,function(_0x5219e4){if(_0x5219e4[_0xf57d('0x3a')]!==_0xf57d('0x3b')){var _0x25f089={};_0x25f089[_0x5219e4[_0xf57d('0x26')]]={'$like':'%'+_0x668d17['query'][_0xf57d('0x39')]+'%'};return _0x25f089;}})});}_0x29cfa2=_['merge']({},_0x29cfa2,_0x668d17[_0xf57d('0x3c')]);var _0x5301cb={'where':_0x29cfa2[_0xf57d('0x37')]};return db[_0xf57d('0x2a')][_0xf57d('0x1c')](_0x5301cb)[_0xf57d('0x23')](function(_0x4d0b8){_0x2ed8ac[_0xf57d('0x1c')]=_0x4d0b8;if(_0x668d17['query'][_0xf57d('0x3d')]){_0x29cfa2['include']=[{'all':!![]}];}return db[_0xf57d('0x2a')][_0xf57d('0x3e')](_0x29cfa2);})[_0xf57d('0x23')](function(_0x44c200){_0x2ed8ac[_0xf57d('0x3f')]=_0x44c200;return _0x2ed8ac;})[_0xf57d('0x23')](respondWithFilteredResult(_0x4caa65,_0x29cfa2))[_0xf57d('0x40')](handleError(_0x4caa65,null));};exports[_0xf57d('0x41')]=function(_0x2fc16f,_0x1e7ac4){var _0x5c05c5={'raw':![],'where':{'id':_0x2fc16f[_0xf57d('0x42')]['id']}},_0x1f56fb={};_0x1f56fb[_0xf57d('0x31')]=_[_0xf57d('0x2e')](db[_0xf57d('0x2a')][_0xf57d('0x2b')]);_0x1f56fb['query']=_[_0xf57d('0x2e')](_0x2fc16f[_0xf57d('0x2d')]);_0x1f56fb[_0xf57d('0x2f')]=_['intersection'](_0x1f56fb[_0xf57d('0x31')],_0x1f56fb[_0xf57d('0x2d')]);_0x5c05c5[_0xf57d('0x32')]=_[_0xf57d('0x30')](_0x1f56fb[_0xf57d('0x31')],qs[_0xf57d('0x33')](_0x2fc16f['query'][_0xf57d('0x33')]));_0x5c05c5[_0xf57d('0x32')]=_0x5c05c5[_0xf57d('0x32')][_0xf57d('0x43')]?_0x5c05c5[_0xf57d('0x32')]:_0x1f56fb['model'];if(_0x2fc16f['query'][_0xf57d('0x3d')]){_0x5c05c5[_0xf57d('0x44')]=[{'all':!![]}];}_0x5c05c5=_[_0xf57d('0x45')]({},_0x5c05c5,_0x2fc16f[_0xf57d('0x3c')]);return db[_0xf57d('0x2a')][_0xf57d('0x46')](_0x5c05c5)['then'](handleEntityNotFound(_0x1e7ac4,null))[_0xf57d('0x23')](respondWithResult(_0x1e7ac4,null))[_0xf57d('0x40')](handleError(_0x1e7ac4,null));};exports[_0xf57d('0x47')]=function(_0x4b2143,_0x4ad8cf){return db[_0xf57d('0x2a')][_0xf57d('0x47')](_0x4b2143[_0xf57d('0x48')],{})[_0xf57d('0x23')](respondWithResult(_0x4ad8cf,0xc9))[_0xf57d('0x40')](handleError(_0x4ad8cf,null));};exports[_0xf57d('0x21')]=function(_0xce5ac9,_0xe132ab){if(_0xce5ac9[_0xf57d('0x48')]['id']){delete _0xce5ac9[_0xf57d('0x48')]['id'];}return db[_0xf57d('0x2a')][_0xf57d('0x46')]({'where':{'id':_0xce5ac9[_0xf57d('0x42')]['id']}})[_0xf57d('0x23')](handleEntityNotFound(_0xe132ab,null))['then'](saveUpdates(_0xce5ac9['body'],null))['then'](respondWithResult(_0xe132ab,null))[_0xf57d('0x40')](handleError(_0xe132ab,null));};exports[_0xf57d('0x22')]=function(_0x5e66bb,_0x447180){return db[_0xf57d('0x2a')]['find']({'where':{'id':_0x5e66bb[_0xf57d('0x42')]['id']}})['then'](handleEntityNotFound(_0x447180,null))[_0xf57d('0x23')](removeEntity(_0x447180,null))[_0xf57d('0x40')](handleError(_0x447180,null));};exports[_0xf57d('0x49')]=function(_0xcf6a01,_0x14a559,_0x18c0be){return db[_0xf57d('0x4a')][_0xf57d('0x46')]({'where':{'id':_0xcf6a01[_0xf57d('0x42')]['id']}})[_0xf57d('0x23')](handleEntityNotFound(_0x14a559,null))[_0xf57d('0x23')](function(_0x2640b1){if(_0x2640b1){return _0x2640b1[_0xf57d('0x49')](_0xcf6a01[_0xf57d('0x48')][_0xf57d('0x4b')],_[_0xf57d('0x4c')](_0xcf6a01['body'],[_0xf57d('0x4b'),'id'])||{});}})[_0xf57d('0x23')](respondWithResult(_0x14a559,null))['catch'](handleError(_0x14a559,null));};exports[_0xf57d('0x4d')]=function(_0x11cc82,_0x517a1d,_0x53ae81){var _0x72eb0a={};var _0x13add6={};var _0x5e5930;var _0x10601b;return db[_0xf57d('0x2a')]['findOne']({'where':{'id':_0x11cc82['params']['id']}})[_0xf57d('0x23')](handleEntityNotFound(_0x517a1d,null))[_0xf57d('0x23')](function(_0x1b6a4e){if(_0x1b6a4e){_0x5e5930=_0x1b6a4e;_0x13add6[_0xf57d('0x31')]=_['keys'](db[_0xf57d('0x4a')][_0xf57d('0x2b')]);_0x13add6[_0xf57d('0x2d')]=_['keys'](_0x11cc82[_0xf57d('0x2d')]);_0x13add6['filters']=_[_0xf57d('0x30')](_0x13add6[_0xf57d('0x31')],_0x13add6[_0xf57d('0x2d')]);_0x72eb0a[_0xf57d('0x32')]=_[_0xf57d('0x30')](_0x13add6['model'],qs['fields'](_0x11cc82[_0xf57d('0x2d')][_0xf57d('0x33')]));_0x72eb0a[_0xf57d('0x32')]=_0x72eb0a[_0xf57d('0x32')]['length']?_0x72eb0a['attributes']:_0x13add6[_0xf57d('0x31')];_0x72eb0a[_0xf57d('0x4e')]=qs[_0xf57d('0x36')](_0x11cc82[_0xf57d('0x2d')][_0xf57d('0x36')]);_0x72eb0a['where']=qs[_0xf57d('0x2f')](_[_0xf57d('0x38')](_0x11cc82[_0xf57d('0x2d')],_0x13add6['filters']));if(_0x11cc82['query'][_0xf57d('0x39')]){_0x72eb0a[_0xf57d('0x37')]=_[_0xf57d('0x45')](_0x72eb0a[_0xf57d('0x37')],{'$or':_[_0xf57d('0x29')](_0x72eb0a[_0xf57d('0x32')],function(_0x29abfd){var _0x410459={};_0x410459[_0x29abfd]={'$like':'%'+_0x11cc82[_0xf57d('0x2d')][_0xf57d('0x39')]+'%'};return _0x410459;})});}_0x72eb0a=_['merge']({},_0x72eb0a,_0x11cc82[_0xf57d('0x3c')]);return _0x5e5930[_0xf57d('0x4d')](_0x72eb0a);}})[_0xf57d('0x23')](function(_0x1ca3c1){if(_0x1ca3c1){_0x10601b=_0x1ca3c1[_0xf57d('0x43')];if(!_0x11cc82[_0xf57d('0x2d')][_0xf57d('0x34')](_0xf57d('0x35'))){_0x72eb0a[_0xf57d('0x1b')]=qs[_0xf57d('0x1b')](_0x11cc82[_0xf57d('0x2d')][_0xf57d('0x1b')]);_0x72eb0a['offset']=qs[_0xf57d('0x19')](_0x11cc82[_0xf57d('0x2d')][_0xf57d('0x19')]);}return _0x5e5930[_0xf57d('0x4d')](_0x72eb0a);}})['then'](function(_0xb5cb88){if(_0xb5cb88){return _0xb5cb88?{'count':_0x10601b,'rows':_0xb5cb88}:null;}})[_0xf57d('0x23')](respondWithResult(_0x517a1d,null))[_0xf57d('0x40')](handleError(_0x517a1d,null));};exports['addActions']=function(_0x494279,_0x4a651a,_0x493191){return db['Action'][_0xf57d('0x46')]({'where':{'id':_0x494279['params']['id']}})['then'](handleEntityNotFound(_0x4a651a,null))[_0xf57d('0x23')](function(_0x306a74){if(_0x306a74){return _0x306a74[_0xf57d('0x4f')](_0x494279[_0xf57d('0x48')][_0xf57d('0x4b')],_[_0xf57d('0x4c')](_0x494279[_0xf57d('0x48')],[_0xf57d('0x4b'),'id'])||{});}})[_0xf57d('0x23')](respondWithResult(_0x4a651a,null))[_0xf57d('0x40')](handleError(_0x4a651a,null));};exports[_0xf57d('0x50')]=function(_0x1703aa,_0x10fe1f,_0x1c9ba9){var _0x1970a9={};var _0x1affea={};var _0xe599b7;var _0x238ced;return db[_0xf57d('0x2a')][_0xf57d('0x51')]({'where':{'id':_0x1703aa[_0xf57d('0x42')]['id']}})[_0xf57d('0x23')](handleEntityNotFound(_0x10fe1f,null))[_0xf57d('0x23')](function(_0x10c956){if(_0x10c956){_0xe599b7=_0x10c956;_0x1affea[_0xf57d('0x31')]=_[_0xf57d('0x2e')](db['Action'][_0xf57d('0x2b')]);_0x1affea[_0xf57d('0x2d')]=_[_0xf57d('0x2e')](_0x1703aa[_0xf57d('0x2d')]);_0x1affea[_0xf57d('0x2f')]=_['intersection'](_0x1affea[_0xf57d('0x31')],_0x1affea[_0xf57d('0x2d')]);_0x1970a9[_0xf57d('0x32')]=_[_0xf57d('0x30')](_0x1affea[_0xf57d('0x31')],qs[_0xf57d('0x33')](_0x1703aa[_0xf57d('0x2d')]['fields']));_0x1970a9[_0xf57d('0x32')]=_0x1970a9[_0xf57d('0x32')][_0xf57d('0x43')]?_0x1970a9['attributes']:_0x1affea['model'];_0x1970a9[_0xf57d('0x4e')]=qs[_0xf57d('0x36')](_0x1703aa[_0xf57d('0x2d')][_0xf57d('0x36')]);_0x1970a9[_0xf57d('0x37')]=qs[_0xf57d('0x2f')](_[_0xf57d('0x38')](_0x1703aa[_0xf57d('0x2d')],_0x1affea[_0xf57d('0x2f')]));if(_0x1703aa[_0xf57d('0x2d')][_0xf57d('0x39')]){_0x1970a9['where']=_[_0xf57d('0x45')](_0x1970a9[_0xf57d('0x37')],{'$or':_[_0xf57d('0x29')](_0x1970a9['attributes'],function(_0xe0c640){var _0x48dc21={};_0x48dc21[_0xe0c640]={'$like':'%'+_0x1703aa[_0xf57d('0x2d')]['filter']+'%'};return _0x48dc21;})});}_0x1970a9=_['merge']({},_0x1970a9,_0x1703aa[_0xf57d('0x3c')]);return _0xe599b7[_0xf57d('0x50')](_0x1970a9);}})[_0xf57d('0x23')](function(_0xdcfb97){if(_0xdcfb97){_0x238ced=_0xdcfb97[_0xf57d('0x43')];if(!_0x1703aa['query']['hasOwnProperty']('nolimit')){_0x1970a9['limit']=qs['limit'](_0x1703aa[_0xf57d('0x2d')]['limit']);_0x1970a9[_0xf57d('0x19')]=qs[_0xf57d('0x19')](_0x1703aa[_0xf57d('0x2d')][_0xf57d('0x19')]);}return _0xe599b7[_0xf57d('0x50')](_0x1970a9);}})['then'](function(_0x4dd7ab){if(_0x4dd7ab){return _0x4dd7ab?{'count':_0x238ced,'rows':_0x4dd7ab}:null;}})['then'](respondWithResult(_0x10fe1f,null))[_0xf57d('0x40')](handleError(_0x10fe1f,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index b788657..c3d12de 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 _0x436f=['lodash','util','api','bluebird','rimraf','../../config/environment','exports'];(function(_0x5c47dd,_0x4042cc){var _0x352cc5=function(_0x5e10dd){while(--_0x5e10dd){_0x5c47dd['push'](_0x5c47dd['shift']());}};_0x352cc5(++_0x4042cc);}(_0x436f,0xaf));var _0xf436=function(_0x5ecf03,_0x276c07){_0x5ecf03=_0x5ecf03-0x0;var _0x4bdb32=_0x436f[_0x5ecf03];return _0x4bdb32;};'use strict';var _=require(_0xf436('0x0'));var util=require(_0xf436('0x1'));var logger=require('../../config/logger')(_0xf436('0x2'));var moment=require('moment');var BPromise=require(_0xf436('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xf436('0x4'));var config=require(_0xf436('0x5'));var attributes=require('./automation.attributes');module[_0xf436('0x6')]=function(_0x5a074d,_0x2bdcef){return _0x5a074d['define']('Automation',attributes,{'tableName':'tools_automations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0622=['path','rimraf','../../config/environment','./automation.attributes','exports','define','lodash','moment','bluebird','request-promise'];(function(_0x1203ca,_0x159f33){var _0x1cd81f=function(_0xdd22f){while(--_0xdd22f){_0x1203ca['push'](_0x1203ca['shift']());}};_0x1cd81f(++_0x159f33);}(_0x0622,0x6a));var _0x2062=function(_0x1c06d1,_0x21b507){_0x1c06d1=_0x1c06d1-0x0;var _0xd88999=_0x0622[_0x1c06d1];return _0xd88999;};'use strict';var _=require(_0x2062('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x2062('0x1'));var BPromise=require(_0x2062('0x2'));var rp=require(_0x2062('0x3'));var fs=require('fs');var path=require(_0x2062('0x4'));var rimraf=require(_0x2062('0x5'));var config=require(_0x2062('0x6'));var attributes=require(_0x2062('0x7'));module[_0x2062('0x8')]=function(_0x5b6735,_0x53972d){return _0x5b6735[_0x2062('0x9')]('Automation',attributes,{'tableName':'tools_automations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/automation/automation.rpc.js b/server/api/automation/automation.rpc.js index 0b0ac1c..c661acc 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 _0x8322=['../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','Automation,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x472cfc,_0x4ec9f3){var _0x3ba7cb=function(_0x49eb43){while(--_0x49eb43){_0x472cfc['push'](_0x472cfc['shift']());}};_0x3ba7cb(++_0x4ec9f3);}(_0x8322,0x186));var _0x2832=function(_0x4c321c,_0x3e9da0){_0x4c321c=_0x4c321c-0x0;var _0x25accb=_0x8322[_0x4c321c];return _0x25accb;};'use strict';var _=require(_0x2832('0x0'));var util=require(_0x2832('0x1'));var moment=require(_0x2832('0x2'));var BPromise=require(_0x2832('0x3'));var rs=require(_0x2832('0x4'));var fs=require('fs');var Redis=require(_0x2832('0x5'));var db=require(_0x2832('0x6'))['db'];var utils=require(_0x2832('0x7'));var logger=require(_0x2832('0x8'))(_0x2832('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x2832('0xa')][_0x2832('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xab2c39,_0x29a788,_0x1488df){return new BPromise(function(_0x4b0ca8,_0xb57a3c){return client[_0x2832('0xc')](_0xab2c39,_0x1488df)[_0x2832('0xd')](function(_0xb1f005){logger['info'](_0x2832('0xe'),_0x29a788,_0x2832('0xf'));logger['debug']('Automation,\x20%s,\x20%s,\x20%s',_0x29a788,_0x2832('0xf'),JSON['stringify'](_0xb1f005));if(_0xb1f005['error']){if(_0xb1f005[_0x2832('0x10')][_0x2832('0x11')]===0x1f4){logger[_0x2832('0x10')](_0x2832('0xe'),_0x29a788,_0xb1f005['error'][_0x2832('0x12')]);return _0xb57a3c(_0xb1f005[_0x2832('0x10')]['message']);}logger[_0x2832('0x10')](_0x2832('0xe'),_0x29a788,_0xb1f005[_0x2832('0x10')][_0x2832('0x12')]);return _0x4b0ca8(_0xb1f005[_0x2832('0x10')][_0x2832('0x12')]);}else{logger[_0x2832('0x13')]('Automation,\x20%s,\x20%s',_0x29a788,_0x2832('0xf'));_0x4b0ca8(_0xb1f005[_0x2832('0x14')]['message']);}})[_0x2832('0x15')](function(_0x56d1e6){logger[_0x2832('0x10')]('Automation,\x20%s,\x20%s',_0x29a788,_0x56d1e6);_0xb57a3c(_0x56d1e6);});});} \ No newline at end of file +var _0x5360=['catch','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','http','request','then','info','request\x20sent','stringify','error','code','Automation,\x20%s,\x20%s','message','result'];(function(_0x3f4394,_0x111458){var _0x113c3d=function(_0x2b3171){while(--_0x2b3171){_0x3f4394['push'](_0x3f4394['shift']());}};_0x113c3d(++_0x111458);}(_0x5360,0x157));var _0x0536=function(_0x4e1dcf,_0x18051a){_0x4e1dcf=_0x4e1dcf-0x0;var _0x1527d1=_0x5360[_0x4e1dcf];return _0x1527d1;};'use strict';var _=require(_0x0536('0x0'));var util=require(_0x0536('0x1'));var moment=require(_0x0536('0x2'));var BPromise=require(_0x0536('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0536('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x0536('0x5'))(_0x0536('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x0536('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x19c89e,_0x1122a2,_0x27cac6){return new BPromise(function(_0x4974ad,_0x180b94){return client[_0x0536('0x8')](_0x19c89e,_0x27cac6)[_0x0536('0x9')](function(_0x5b78e2){logger[_0x0536('0xa')]('Automation,\x20%s,\x20%s',_0x1122a2,'request\x20sent');logger['debug']('Automation,\x20%s,\x20%s,\x20%s',_0x1122a2,_0x0536('0xb'),JSON[_0x0536('0xc')](_0x5b78e2));if(_0x5b78e2[_0x0536('0xd')]){if(_0x5b78e2[_0x0536('0xd')][_0x0536('0xe')]===0x1f4){logger[_0x0536('0xd')](_0x0536('0xf'),_0x1122a2,_0x5b78e2[_0x0536('0xd')][_0x0536('0x10')]);return _0x180b94(_0x5b78e2[_0x0536('0xd')][_0x0536('0x10')]);}logger[_0x0536('0xd')](_0x0536('0xf'),_0x1122a2,_0x5b78e2['error'][_0x0536('0x10')]);return _0x4974ad(_0x5b78e2[_0x0536('0xd')][_0x0536('0x10')]);}else{logger[_0x0536('0xa')](_0x0536('0xf'),_0x1122a2,'request\x20sent');_0x4974ad(_0x5b78e2[_0x0536('0x11')][_0x0536('0x10')]);}})[_0x0536('0x12')](function(_0x1ff4f9){logger['error']('Automation,\x20%s,\x20%s',_0x1122a2,_0x1ff4f9);_0x180b94(_0x1ff4f9);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index d3a81bb..d38dff9 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 _0x1ef3=['post','put','update','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./automation.controller','get','isAuthenticated','index','/:id','show','/:id/conditions','create'];(function(_0x30eade,_0x5eb7dd){var _0x1b3a91=function(_0x5a6b44){while(--_0x5a6b44){_0x30eade['push'](_0x30eade['shift']());}};_0x1b3a91(++_0x5eb7dd);}(_0x1ef3,0x69));var _0x31ef=function(_0x13f93d,_0x40f289){_0x13f93d=_0x13f93d-0x0;var _0x26e77c=_0x1ef3[_0x13f93d];return _0x26e77c;};'use strict';var multer=require(_0x31ef('0x0'));var util=require(_0x31ef('0x1'));var path=require('path');var timeout=require(_0x31ef('0x2'));var express=require(_0x31ef('0x3'));var router=express[_0x31ef('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x31ef('0x5'));var interaction=require(_0x31ef('0x6'));var config=require('../../config/environment');var controller=require(_0x31ef('0x7'));router[_0x31ef('0x8')]('/',auth[_0x31ef('0x9')](),controller[_0x31ef('0xa')]);router[_0x31ef('0x8')](_0x31ef('0xb'),auth['isAuthenticated'](),controller[_0x31ef('0xc')]);router[_0x31ef('0x8')](_0x31ef('0xd'),auth[_0x31ef('0x9')](),controller['getConditions']);router[_0x31ef('0x8')]('/:id/actions',auth[_0x31ef('0x9')](),controller['getActions']);router['post']('/',auth['isAuthenticated'](),controller[_0x31ef('0xe')]);router[_0x31ef('0xf')](_0x31ef('0xd'),auth[_0x31ef('0x9')](),controller['addConditions']);router['post']('/:id/actions',auth['isAuthenticated'](),controller['addActions']);router[_0x31ef('0x10')]('/:id',auth[_0x31ef('0x9')](),controller[_0x31ef('0x11')]);router['delete'](_0x31ef('0xb'),auth[_0x31ef('0x9')](),controller[_0x31ef('0x12')]);module[_0x31ef('0x13')]=router; \ No newline at end of file +var _0x5f90=['post','/:id/actions','addActions','put','delete','exports','multer','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./automation.controller','isAuthenticated','index','get','/:id','show','getConditions','create'];(function(_0x4b8236,_0x1a07ba){var _0xaf7094=function(_0x16e932){while(--_0x16e932){_0x4b8236['push'](_0x4b8236['shift']());}};_0xaf7094(++_0x1a07ba);}(_0x5f90,0xae));var _0x05f9=function(_0x11d9db,_0xf7ca79){_0x11d9db=_0x11d9db-0x0;var _0x2687d9=_0x5f90[_0x11d9db];return _0x2687d9;};'use strict';var multer=require(_0x05f9('0x0'));var util=require('util');var path=require(_0x05f9('0x1'));var timeout=require('connect-timeout');var express=require(_0x05f9('0x2'));var router=express['Router']();var fs_extra=require(_0x05f9('0x3'));var auth=require(_0x05f9('0x4'));var interaction=require(_0x05f9('0x5'));var config=require(_0x05f9('0x6'));var controller=require(_0x05f9('0x7'));router['get']('/',auth[_0x05f9('0x8')](),controller[_0x05f9('0x9')]);router[_0x05f9('0xa')](_0x05f9('0xb'),auth[_0x05f9('0x8')](),controller[_0x05f9('0xc')]);router['get']('/:id/conditions',auth[_0x05f9('0x8')](),controller[_0x05f9('0xd')]);router['get']('/:id/actions',auth['isAuthenticated'](),controller['getActions']);router['post']('/',auth[_0x05f9('0x8')](),controller[_0x05f9('0xe')]);router['post']('/:id/conditions',auth[_0x05f9('0x8')](),controller['addConditions']);router[_0x05f9('0xf')](_0x05f9('0x10'),auth[_0x05f9('0x8')](),controller[_0x05f9('0x11')]);router[_0x05f9('0x12')](_0x05f9('0xb'),auth[_0x05f9('0x8')](),controller['update']);router[_0x05f9('0x13')]('/:id',auth[_0x05f9('0x8')](),controller['destroy']);module[_0x05f9('0x14')]=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index 5ac177c..1cf0dad 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 _0x464d=['name','ENUM','ivr','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','07:00-22:00,*,*,*','always','never','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\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\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)','exports','STRING'];(function(_0x2719d7,_0x260f2d){var _0x79b6e=function(_0x5e6fc8){while(--_0x5e6fc8){_0x2719d7['push'](_0x2719d7['shift']());}};_0x79b6e(++_0x260f2d);}(_0x464d,0x70));var _0xd464=function(_0x31d0ae,_0x5099ea){_0x31d0ae=_0x31d0ae-0x0;var _0x3039c2=_0x464d[_0x31d0ae];return _0x3039c2;};'use strict';var Sequelize=require('sequelize');module[_0xd464('0x0')]={'name':{'type':Sequelize[_0xd464('0x1')],'unique':_0xd464('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0xd464('0x3')](_0xd464('0x4')),'allowNull':![],'defaultValue':_0xd464('0x4')},'description':{'type':Sequelize[_0xd464('0x1')]},'active':{'type':Sequelize[_0xd464('0x5')],'defaultValue':0x0,'comment':_0xd464('0x6')},'limitCalls':{'type':Sequelize[_0xd464('0x7')](0x4)[_0xd464('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':'Max\x20200\x20calls.'},'dialOriginateCallerIdName':{'type':Sequelize[_0xd464('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xd464('0x1')]},'dialOriginateTimeout':{'type':Sequelize[_0xd464('0x7')](0x3)[_0xd464('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd464('0x9')},'dialCongestionMaxRetry':{'type':Sequelize[_0xd464('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xd464('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd464('0xa')},'dialBusyMaxRetry':{'type':Sequelize[_0xd464('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd464('0xb')},'dialBusyRetryFrequency':{'type':Sequelize[_0xd464('0x7')](0x5)[_0xd464('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd464('0xc')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xd464('0x7')](0x3)[_0xd464('0x8')],'defaultValue':0x3,'comment':_0xd464('0xd')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xd464('0x7')](0x5)[_0xd464('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd464('0xe')},'dialGlobalMaxRetry':{'type':Sequelize[_0xd464('0x7')](0x3)[_0xd464('0x8')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0xd464('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xd464('0x1')],'defaultValue':_0xd464('0xf')},'dialCheckDuplicateType':{'type':Sequelize[_0xd464('0x3')](_0xd464('0x10'),_0xd464('0x11'),'onlyIfOpen'),'defaultValue':_0xd464('0x10')},'dialAMDActive':{'type':Sequelize[_0xd464('0x5')],'defaultValue':0x0,'comment':_0xd464('0x12')},'dialAMDInitialSilence':{'type':Sequelize[_0xd464('0x7')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xd464('0x13')},'dialAMDGreeting':{'type':Sequelize[_0xd464('0x7')](0x9)[_0xd464('0x8')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xd464('0x14')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xd464('0x7')](0x9)[_0xd464('0x8')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xd464('0x15')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0xd464('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xd464('0x16')},'dialAMDMinWordLength':{'type':Sequelize[_0xd464('0x7')](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xd464('0x7')](0x9)[_0xd464('0x8')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xd464('0x17')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xd464('0x7')](0x9)[_0xd464('0x8')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xd464('0x18')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xd464('0x7')](0x5)[_0xd464('0x8')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xd464('0x19')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xd464('0x7')](0x9)[_0xd464('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xd464('0x1a')},'dialOrderByScheduledAt':{'type':Sequelize[_0xd464('0x3')](_0xd464('0x1b'),_0xd464('0x1c')),'defaultValue':_0xd464('0x1b')},'dialPrefix':{'type':Sequelize[_0xd464('0x1')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xd464('0x7')](0x3)[_0xd464('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xd464('0x1d')},'dialCutDigit':{'type':Sequelize[_0xd464('0x7')](0x3)[_0xd464('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xd464('0x1e')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xd464('0x7')](0x3)[_0xd464('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd464('0x1f')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xd464('0x7')](0x5)[_0xd464('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize[_0xd464('0x7')](0x3)[_0xd464('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xd464('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize[_0xd464('0x7')](0x3)[_0xd464('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd464('0x20')},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd464('0x21')},'dialMachineMaxRetry':{'type':Sequelize[_0xd464('0x7')](0x3)[_0xd464('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd464('0x22')},'dialMachineRetryFrequency':{'type':Sequelize[_0xd464('0x7')](0x5)[_0xd464('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd464('0x23')},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd464('0x24')},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xd464('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd464('0x25')}}; \ No newline at end of file +var _0xe11a=['DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','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','ivr','STRING','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','UNSIGNED','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','never','onlyIfOpen','#AMD\x20Initial\x20Silence','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','ENUM'];(function(_0x4b2ed7,_0x5b3100){var _0x55a953=function(_0x4b7abd){while(--_0x4b7abd){_0x4b2ed7['push'](_0x4b2ed7['shift']());}};_0x55a953(++_0x5b3100);}(_0xe11a,0xa1));var _0xae11=function(_0x135cf8,_0x13e343){_0x135cf8=_0x135cf8-0x0;var _0x1cedb4=_0xe11a[_0x135cf8];return _0x1cedb4;};'use strict';var Sequelize=require(_0xae11('0x0'));module[_0xae11('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize['ENUM']('ivr'),'allowNull':![],'defaultValue':_0xae11('0x2')},'description':{'type':Sequelize[_0xae11('0x3')]},'active':{'type':Sequelize[_0xae11('0x4')],'defaultValue':0x0,'comment':_0xae11('0x5')},'limitCalls':{'type':Sequelize[_0xae11('0x6')](0x4)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':'Max\x20200\x20calls.'},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0xae11('0x6')](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xae11('0x7')},'dialCongestionMaxRetry':{'type':Sequelize[_0xae11('0x6')](0x3)[_0xae11('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xae11('0x9')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xae11('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xae11('0xa')},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xae11('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0xae11('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xae11('0xb')},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xae11('0x8')],'defaultValue':0x3,'comment':_0xae11('0xc')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xae11('0x6')](0x5)[_0xae11('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0xae11('0x6')](0x3)[_0xae11('0x8')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xae11('0xd')},'dialTimezone':{'type':Sequelize[_0xae11('0x3')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xae11('0x3')],'defaultValue':_0xae11('0xe')},'dialCheckDuplicateType':{'type':Sequelize['ENUM']('always',_0xae11('0xf'),_0xae11('0x10')),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0xae11('0x6')](0x9)[_0xae11('0x8')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xae11('0x11')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)[_0xae11('0x8')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)[_0xae11('0x8')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xae11('0x6')](0x9)[_0xae11('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)[_0xae11('0x8')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xae11('0x12')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xae11('0x6')](0x9)[_0xae11('0x8')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xae11('0x13')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0xae11('0x8')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xae11('0x14')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xae11('0x6')](0x5)[_0xae11('0x8')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xae11('0x15')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xae11('0x6')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xae11('0x16')},'dialOrderByScheduledAt':{'type':Sequelize[_0xae11('0x17')](_0xae11('0x18'),_0xae11('0x19')),'defaultValue':_0xae11('0x18')},'dialPrefix':{'type':Sequelize[_0xae11('0x3')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xae11('0x6')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xae11('0x1a')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0xae11('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xae11('0x6')](0x3)[_0xae11('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xae11('0x1b')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xae11('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xae11('0x1c')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xae11('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xae11('0x1d')},'dialDropRetryFrequency':{'type':Sequelize[_0xae11('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xae11('0x1e')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xae11('0x6')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xae11('0x1f')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xae11('0x6')](0x5)[_0xae11('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xae11('0x20')},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xae11('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xae11('0x21')},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xae11('0x22')},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xae11('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xae11('0x23')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xae11('0x6')](0x5)[_0xae11('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xae11('0x24')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index 1ca2da3..95440a7 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 _0x7be1=['clone','createdAt','updatedAt','update','getHoppers','findOne','CampaignId','CmHopper','getHopperHistories','CmHopperHistory','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','format','ids','omit','dialCheckDuplicateType','always','into','fromQuery','phone','scheduledAt','ContactId','ListId','select','field','NOW()','CmListId','toString','from','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','cm_hopper_final','COALESCE(phone,\x27\x27)','CampaignId\x20=\x20?','cm_hopper','cm_contacts','insert','cm_hopper_additional_phones','cmHopperId','OrderBy','h.id','ci.item','ci.OrderBY','cm_contact_has_items','join','h.ContactId\x20=\x20ci.CmContactId','h.CampaignId=?','h.createdAt\x20=\x20?','sequelize','push','all','removeLists','getBlackLists','YYYY-MM-DD\x20HH:mm:ss','addBlackLists','spread','cm_hopper_black','removeBlackLists','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','save','then','destroy','get','IvrCampaigns','error','name','send','index','map','Campaign','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s'];(function(_0x110e5f,_0x2f70b4){var _0x233b3f=function(_0x576f12){while(--_0x576f12){_0x110e5f['push'](_0x110e5f['shift']());}};_0x233b3f(++_0x2f70b4);}(_0x7be1,0x165));var _0x17be=function(_0x451d04,_0x999e7d){_0x451d04=_0x451d04-0x0;var _0x32c6fe=_0x7be1[_0x451d04];return _0x32c6fe;};'use strict';var emlformat=require(_0x17be('0x0'));var rimraf=require(_0x17be('0x1'));var zipdir=require(_0x17be('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x17be('0x3'));var moment=require(_0x17be('0x4'));var BPromise=require(_0x17be('0x5'));var Mustache=require(_0x17be('0x6'));var util=require(_0x17be('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x17be('0x8'));var fs=require('fs');var fs_extra=require(_0x17be('0x9'));var _=require('lodash');var squel=require(_0x17be('0xa'));var crypto=require(_0x17be('0xb'));var jsforce=require(_0x17be('0xc'));var deskjs=require(_0x17be('0xd'));var toCsv=require(_0x17be('0xe'));var querystring=require(_0x17be('0xf'));var Papa=require('papaparse');var Redis=require(_0x17be('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x17be('0x11'));var as=require(_0x17be('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x17be('0x13'))(_0x17be('0x14'));var utils=require(_0x17be('0x15'));var config=require(_0x17be('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x17be('0x17'))['db'];function respondWithStatusCode(_0x52a62c,_0x40e3d5){_0x40e3d5=_0x40e3d5||0xcc;return function(_0x4f4ad6){if(_0x4f4ad6){return _0x52a62c[_0x17be('0x18')](_0x40e3d5);}return _0x52a62c[_0x17be('0x19')](_0x40e3d5)[_0x17be('0x1a')]();};}function respondWithResult(_0xf99f77,_0xfbfeeb){_0xfbfeeb=_0xfbfeeb||0xc8;return function(_0x4cbd7e){if(_0x4cbd7e){return _0xf99f77[_0x17be('0x19')](_0xfbfeeb)['json'](_0x4cbd7e);}};}function respondWithFilteredResult(_0x53c86d,_0x123909){return function(_0x514c45){if(_0x514c45){var _0x2a37ec=typeof _0x123909['offset']===_0x17be('0x1b')&&typeof _0x123909[_0x17be('0x1c')]==='undefined';var _0x179a31=_0x514c45['count'];var _0x222009=_0x2a37ec?0x0:_0x123909['offset'];var _0x328e3=_0x2a37ec?_0x514c45[_0x17be('0x1d')]:_0x123909[_0x17be('0x1e')]+_0x123909[_0x17be('0x1c')];var _0x445e9b;if(_0x328e3>=_0x179a31){_0x328e3=_0x179a31;_0x445e9b=0xc8;}else{_0x445e9b=0xce;}_0x53c86d['status'](_0x445e9b);return _0x53c86d[_0x17be('0x1f')](_0x17be('0x20'),_0x222009+'-'+_0x328e3+'/'+_0x179a31)[_0x17be('0x21')](_0x514c45);}return null;};}function patchUpdates(_0x19678b){return function(_0x537bee){try{jsonpatch[_0x17be('0x22')](_0x537bee,_0x19678b,!![]);}catch(_0x5310a3){return BPromise['reject'](_0x5310a3);}return _0x537bee[_0x17be('0x23')]();};}function saveUpdates(_0x3ffd1e,_0x19fbdb){return function(_0x285afc){if(_0x285afc){return _0x285afc['update'](_0x3ffd1e)[_0x17be('0x24')](function(_0x1aa54f){return _0x1aa54f;});}return null;};}function removeEntity(_0x4d0c6e,_0x151b8a){return function(_0x484d71){if(_0x484d71){return _0x484d71[_0x17be('0x25')]()[_0x17be('0x24')](function(){var _0x47f00d=_0x484d71[_0x17be('0x26')]({'plain':!![]});var _0x53320b=_0x17be('0x27');return db['UserProfileResource']['destroy']({'where':{'type':_0x53320b,'resourceId':_0x47f00d['id']}})[_0x17be('0x24')](function(){return _0x484d71;});})['then'](function(){_0x4d0c6e[_0x17be('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x16a3ad,_0x1efef0){return function(_0x165046){if(!_0x165046){_0x16a3ad[_0x17be('0x18')](0x194);}return _0x165046;};}function handleError(_0x339d11,_0x1f8908){_0x1f8908=_0x1f8908||0x1f4;return function(_0x266b84){logger[_0x17be('0x28')](_0x266b84['stack']);if(_0x266b84[_0x17be('0x29')]){delete _0x266b84[_0x17be('0x29')];}_0x339d11[_0x17be('0x19')](_0x1f8908)[_0x17be('0x2a')](_0x266b84);};}exports[_0x17be('0x2b')]=function(_0x564897,_0x233c28){var _0x294f46={},_0x456978={},_0x50e0c2={'count':0x0,'rows':[]};var _0x4fad3a=_[_0x17be('0x2c')](db[_0x17be('0x2d')]['rawAttributes'],function(_0x24c39a){return{'name':_0x24c39a['fieldName'],'type':_0x24c39a[_0x17be('0x2e')][_0x17be('0x2f')]};});_0x456978[_0x17be('0x30')]=_[_0x17be('0x2c')](_0x4fad3a,_0x17be('0x29'));_0x456978[_0x17be('0x31')]=_[_0x17be('0x32')](_0x564897[_0x17be('0x31')]);_0x456978['filters']=_[_0x17be('0x33')](_0x456978[_0x17be('0x30')],_0x456978['query']);_0x294f46[_0x17be('0x34')]=_[_0x17be('0x33')](_0x456978['model'],qs[_0x17be('0x35')](_0x564897['query'][_0x17be('0x35')]));_0x294f46[_0x17be('0x34')]=_0x294f46['attributes'][_0x17be('0x36')]?_0x294f46[_0x17be('0x34')]:_0x456978[_0x17be('0x30')];if(!_0x564897[_0x17be('0x31')][_0x17be('0x37')](_0x17be('0x38'))){_0x294f46['limit']=qs[_0x17be('0x1c')](_0x564897[_0x17be('0x31')]['limit']);_0x294f46[_0x17be('0x1e')]=qs['offset'](_0x564897[_0x17be('0x31')][_0x17be('0x1e')]);}_0x294f46[_0x17be('0x39')]=qs['sort'](_0x564897[_0x17be('0x31')][_0x17be('0x3a')]);_0x294f46[_0x17be('0x3b')]=qs[_0x17be('0x3c')](_[_0x17be('0x3d')](_0x564897[_0x17be('0x31')],_0x456978[_0x17be('0x3c')]),_0x4fad3a);if(_0x564897[_0x17be('0x31')][_0x17be('0x3e')]){_0x294f46['where']=_['merge'](_0x294f46[_0x17be('0x3b')],{'$or':_[_0x17be('0x2c')](_0x4fad3a,function(_0x42990e){if(_0x42990e['type']!==_0x17be('0x3f')){var _0x389960={};_0x389960[_0x42990e[_0x17be('0x29')]]={'$like':'%'+_0x564897['query'][_0x17be('0x3e')]+'%'};return _0x389960;}})});}_0x294f46=_[_0x17be('0x40')]({},_0x294f46,_0x564897[_0x17be('0x41')]);var _0x39d5a7={'where':_0x294f46['where']};return db[_0x17be('0x2d')]['count'](_0x39d5a7)[_0x17be('0x24')](function(_0x2f79f8){_0x50e0c2[_0x17be('0x1d')]=_0x2f79f8;if(_0x564897[_0x17be('0x31')][_0x17be('0x42')]){_0x294f46[_0x17be('0x43')]=[{'all':!![]}];}return db['Campaign'][_0x17be('0x44')](_0x294f46);})[_0x17be('0x24')](function(_0x26bb98){_0x50e0c2[_0x17be('0x45')]=_0x26bb98;return _0x50e0c2;})[_0x17be('0x24')](respondWithFilteredResult(_0x233c28,_0x294f46))[_0x17be('0x46')](handleError(_0x233c28,null));};exports[_0x17be('0x47')]=function(_0x382932,_0x38a9c1){var _0xd07a72={'raw':![],'where':{'id':_0x382932[_0x17be('0x48')]['id']}},_0x2c0c37={};_0x2c0c37['model']=_[_0x17be('0x32')](db[_0x17be('0x2d')][_0x17be('0x49')]);_0x2c0c37[_0x17be('0x31')]=_[_0x17be('0x32')](_0x382932[_0x17be('0x31')]);_0x2c0c37['filters']=_[_0x17be('0x33')](_0x2c0c37[_0x17be('0x30')],_0x2c0c37[_0x17be('0x31')]);_0xd07a72[_0x17be('0x34')]=_[_0x17be('0x33')](_0x2c0c37[_0x17be('0x30')],qs[_0x17be('0x35')](_0x382932[_0x17be('0x31')][_0x17be('0x35')]));_0xd07a72['attributes']=_0xd07a72['attributes'][_0x17be('0x36')]?_0xd07a72[_0x17be('0x34')]:_0x2c0c37[_0x17be('0x30')];if(_0x382932[_0x17be('0x31')][_0x17be('0x42')]){_0xd07a72[_0x17be('0x43')]=[{'all':!![]}];}_0xd07a72=_[_0x17be('0x40')]({},_0xd07a72,_0x382932[_0x17be('0x41')]);return db['Campaign'][_0x17be('0x4a')](_0xd07a72)[_0x17be('0x24')](handleEntityNotFound(_0x38a9c1,null))[_0x17be('0x24')](respondWithResult(_0x38a9c1,null))[_0x17be('0x46')](handleError(_0x38a9c1,null));};exports[_0x17be('0x4b')]=function(_0x1619d3,_0x4cad37){return db['Campaign'][_0x17be('0x4b')](_0x1619d3[_0x17be('0x4c')],{})[_0x17be('0x24')](function(_0x503ba5){var _0x3f576d=_0x1619d3['user']['get']({'plain':!![]});if(!_0x3f576d)throw new Error(_0x17be('0x4d'));if(_0x3f576d[_0x17be('0x4e')]===_0x17be('0x4f')){var _0x427cee=_0x503ba5[_0x17be('0x26')]({'plain':!![]});var _0x22a054=_0x17be('0x27');return db[_0x17be('0x50')][_0x17be('0x4a')]({'where':{'name':_0x22a054,'userProfileId':_0x3f576d[_0x17be('0x51')]},'raw':!![]})[_0x17be('0x24')](function(_0x5bac4a){if(_0x5bac4a&&_0x5bac4a[_0x17be('0x52')]===0x0){return db['UserProfileResource']['create']({'name':_0x427cee[_0x17be('0x29')],'resourceId':_0x427cee['id'],'type':_0x5bac4a[_0x17be('0x29')],'sectionId':_0x5bac4a['id']},{})[_0x17be('0x24')](function(){return _0x503ba5;});}else{return _0x503ba5;}})['catch'](function(_0x32b4f8){logger[_0x17be('0x28')](_0x17be('0x53'),_0x32b4f8);throw _0x32b4f8;});}return _0x503ba5;})[_0x17be('0x24')](respondWithResult(_0x4cad37,0xc9))[_0x17be('0x46')](handleError(_0x4cad37,null));};exports[_0x17be('0x54')]=function(_0x3a7f1b,_0x46862a){var _0x13ee25={'where':{'id':_0x3a7f1b[_0x17be('0x48')]['id']}},_0x15a5e5={};_0x15a5e5[_0x17be('0x30')]=_[_0x17be('0x32')](db[_0x17be('0x2d')]['rawAttributes']);_0x13ee25[_0x17be('0x34')]=_[_0x17be('0x33')](_0x15a5e5[_0x17be('0x30')],qs[_0x17be('0x35')](_0x3a7f1b[_0x17be('0x31')]['fields']));_0x13ee25[_0x17be('0x34')]=_0x13ee25[_0x17be('0x34')]['length']?_0x13ee25[_0x17be('0x34')]:_0x15a5e5[_0x17be('0x30')];if(_0x3a7f1b['query'][_0x17be('0x42')]){_0x13ee25[_0x17be('0x43')]=[{'all':!![]}];}_0x13ee25=_[_0x17be('0x40')]({},_0x13ee25,_0x3a7f1b[_0x17be('0x41')]);return db[_0x17be('0x2d')][_0x17be('0x4a')](_0x13ee25)[_0x17be('0x24')](handleEntityNotFound(_0x46862a,null))[_0x17be('0x24')](function(_0x2cb5be){if(_0x2cb5be){var _0x51e4ec=_0x2cb5be['get']({'plain':!![]});_0x51e4ec=qs['omit'](_0x51e4ec,['id',_0x17be('0x55'),_0x17be('0x56')]);_0x3a7f1b[_0x17be('0x4c')]=_['omit'](_0x3a7f1b[_0x17be('0x4c')],['id',_0x17be('0x55'),_0x17be('0x56')]);return db[_0x17be('0x2d')][_0x17be('0x4b')](_[_0x17be('0x40')](_0x51e4ec,_0x3a7f1b['body']),{'include':_0x3a7f1b['query'][_0x17be('0x42')]?[{'all':!![]}]:undefined})[_0x17be('0x24')](function(_0xf9a880){var _0x1061ae=_0x3a7f1b[_0x17be('0x4f')][_0x17be('0x26')]({'plain':!![]});if(!_0x1061ae)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1061ae[_0x17be('0x4e')]===_0x17be('0x4f')){var _0x4e37dc=_0xf9a880[_0x17be('0x26')]({'plain':!![]});var _0x4c39be=_0x17be('0x27');return db['UserProfileSection'][_0x17be('0x4a')]({'where':{'name':_0x4c39be,'userProfileId':_0x1061ae[_0x17be('0x51')]},'raw':!![]})[_0x17be('0x24')](function(_0x460b51){if(_0x460b51&&_0x460b51['autoAssociation']===0x0){return db['UserProfileResource'][_0x17be('0x4b')]({'name':_0x4e37dc[_0x17be('0x29')],'resourceId':_0x4e37dc['id'],'type':_0x460b51[_0x17be('0x29')],'sectionId':_0x460b51['id']},{})[_0x17be('0x24')](function(){return _0xf9a880;});}else{return _0xf9a880;}})[_0x17be('0x46')](function(_0x521b62){logger[_0x17be('0x28')](_0x17be('0x53'),_0x521b62);throw _0x521b62;});}return _0xf9a880;});}})['then'](respondWithResult(_0x46862a,0xc9))[_0x17be('0x46')](handleError(_0x46862a,null));};exports[_0x17be('0x57')]=function(_0x54ab02,_0x5401a7){if(_0x54ab02[_0x17be('0x4c')]['id']){delete _0x54ab02[_0x17be('0x4c')]['id'];}return db['Campaign'][_0x17be('0x4a')]({'where':{'id':_0x54ab02[_0x17be('0x48')]['id']}})[_0x17be('0x24')](handleEntityNotFound(_0x5401a7,null))[_0x17be('0x24')](saveUpdates(_0x54ab02[_0x17be('0x4c')],null))[_0x17be('0x24')](respondWithResult(_0x5401a7,null))[_0x17be('0x46')](handleError(_0x5401a7,null));};exports[_0x17be('0x25')]=function(_0x305439,_0x39452f){return db[_0x17be('0x2d')][_0x17be('0x4a')]({'where':{'id':_0x305439[_0x17be('0x48')]['id']}})[_0x17be('0x24')](handleEntityNotFound(_0x39452f,null))['then'](removeEntity(_0x39452f,null))['catch'](handleError(_0x39452f,null));};exports[_0x17be('0x58')]=function(_0x18ad61,_0x620b68,_0x22acc0){var _0x24f76d={'raw':!![],'where':{}};var _0xe22988={};var _0xfec90f={'count':0x0,'rows':[]};return db['Campaign'][_0x17be('0x59')]({'where':{'id':_0x18ad61[_0x17be('0x48')]['id']}})[_0x17be('0x24')](handleEntityNotFound(_0x620b68,null))[_0x17be('0x24')](function(_0x56a4db){if(_0x56a4db){_0xe22988[_0x17be('0x30')]=_[_0x17be('0x32')](db['CmHopper'][_0x17be('0x49')]);_0xe22988['query']=_['keys'](_0x18ad61[_0x17be('0x31')]);_0xe22988['filters']=_['intersection'](_0xe22988['model'],_0xe22988[_0x17be('0x31')]);_0x24f76d[_0x17be('0x34')]=_['intersection'](_0xe22988[_0x17be('0x30')],qs['fields'](_0x18ad61[_0x17be('0x31')][_0x17be('0x35')]));_0x24f76d[_0x17be('0x34')]=_0x24f76d[_0x17be('0x34')][_0x17be('0x36')]?_0x24f76d[_0x17be('0x34')]:_0xe22988['model'];if(!_0x18ad61['query']['hasOwnProperty'](_0x17be('0x38'))){_0x24f76d[_0x17be('0x1c')]=qs[_0x17be('0x1c')](_0x18ad61[_0x17be('0x31')][_0x17be('0x1c')]);_0x24f76d['offset']=qs[_0x17be('0x1e')](_0x18ad61[_0x17be('0x31')][_0x17be('0x1e')]);}_0x24f76d[_0x17be('0x39')]=qs[_0x17be('0x3a')](_0x18ad61['query'][_0x17be('0x3a')]);_0x24f76d[_0x17be('0x3b')]=qs[_0x17be('0x3c')](_['pick'](_0x18ad61[_0x17be('0x31')],_0xe22988[_0x17be('0x3c')]));_0x24f76d[_0x17be('0x3b')][_0x17be('0x5a')]=_0x56a4db['id'];if(_0x18ad61[_0x17be('0x31')][_0x17be('0x3e')]){_0x24f76d[_0x17be('0x3b')]=_[_0x17be('0x40')](_0x24f76d[_0x17be('0x3b')],{'$or':_[_0x17be('0x2c')](_0x24f76d[_0x17be('0x34')],function(_0x2d1171){var _0x51320e={};_0x51320e[_0x2d1171]={'$like':'%'+_0x18ad61[_0x17be('0x31')][_0x17be('0x3e')]+'%'};return _0x51320e;})});}_0x24f76d=_['merge']({},_0x24f76d,_0x18ad61[_0x17be('0x41')]);return db[_0x17be('0x5b')]['count']({'where':_0x24f76d[_0x17be('0x3b')]})[_0x17be('0x24')](function(_0x53c754){_0xfec90f['count']=_0x53c754;if(_0x18ad61[_0x17be('0x31')]['includeAll']){_0x24f76d['include']=[{'all':!![]}];}return db[_0x17be('0x5b')][_0x17be('0x44')](_0x24f76d);})[_0x17be('0x24')](function(_0x36b91e){_0xfec90f[_0x17be('0x45')]=_0x36b91e;return _0xfec90f;});}})[_0x17be('0x24')](respondWithFilteredResult(_0x620b68,_0x24f76d))[_0x17be('0x46')](handleError(_0x620b68,null));};exports[_0x17be('0x5c')]=function(_0x283a29,_0x11beff,_0x367bde){var _0x9f8be8={'raw':!![],'where':{}};var _0x2f6d7c={};var _0x5bda0c={'count':0x0,'rows':[]};return db[_0x17be('0x2d')]['findOne']({'where':{'id':_0x283a29[_0x17be('0x48')]['id']}})[_0x17be('0x24')](handleEntityNotFound(_0x11beff,null))['then'](function(_0xede2dc){if(_0xede2dc){_0x2f6d7c[_0x17be('0x30')]=_[_0x17be('0x32')](db[_0x17be('0x5d')][_0x17be('0x49')]);_0x2f6d7c[_0x17be('0x31')]=_[_0x17be('0x32')](_0x283a29[_0x17be('0x31')]);_0x2f6d7c[_0x17be('0x3c')]=_[_0x17be('0x33')](_0x2f6d7c[_0x17be('0x30')],_0x2f6d7c[_0x17be('0x31')]);_0x9f8be8[_0x17be('0x34')]=_[_0x17be('0x33')](_0x2f6d7c['model'],qs['fields'](_0x283a29['query'][_0x17be('0x35')]));_0x9f8be8[_0x17be('0x34')]=_0x9f8be8[_0x17be('0x34')][_0x17be('0x36')]?_0x9f8be8[_0x17be('0x34')]:_0x2f6d7c['model'];if(!_0x283a29[_0x17be('0x31')][_0x17be('0x37')](_0x17be('0x38'))){_0x9f8be8['limit']=qs[_0x17be('0x1c')](_0x283a29[_0x17be('0x31')]['limit']);_0x9f8be8[_0x17be('0x1e')]=qs[_0x17be('0x1e')](_0x283a29[_0x17be('0x31')]['offset']);}_0x9f8be8[_0x17be('0x39')]=qs[_0x17be('0x3a')](_0x283a29[_0x17be('0x31')][_0x17be('0x3a')]);_0x9f8be8[_0x17be('0x3b')]=qs[_0x17be('0x3c')](_[_0x17be('0x3d')](_0x283a29[_0x17be('0x31')],_0x2f6d7c[_0x17be('0x3c')]));_0x9f8be8[_0x17be('0x3b')]['CampaignId']=_0xede2dc['id'];if(_0x283a29['query'][_0x17be('0x3e')]){_0x9f8be8[_0x17be('0x3b')]=_[_0x17be('0x40')](_0x9f8be8[_0x17be('0x3b')],{'$or':_[_0x17be('0x2c')](_0x9f8be8[_0x17be('0x34')],function(_0x413047){var _0x2989c5={};_0x2989c5[_0x413047]={'$like':'%'+_0x283a29[_0x17be('0x31')][_0x17be('0x3e')]+'%'};return _0x2989c5;})});}_0x9f8be8=_[_0x17be('0x40')]({},_0x9f8be8,_0x283a29[_0x17be('0x41')]);return db[_0x17be('0x5d')][_0x17be('0x1d')]({'where':_0x9f8be8[_0x17be('0x3b')]})['then'](function(_0x15b412){_0x5bda0c[_0x17be('0x1d')]=_0x15b412;if(_0x283a29[_0x17be('0x31')][_0x17be('0x42')]){_0x9f8be8[_0x17be('0x43')]=[{'all':!![]}];}return db[_0x17be('0x5d')]['findAll'](_0x9f8be8);})[_0x17be('0x24')](function(_0x3c0fd2){_0x5bda0c[_0x17be('0x45')]=_0x3c0fd2;return _0x5bda0c;});}})[_0x17be('0x24')](respondWithFilteredResult(_0x11beff,_0x9f8be8))['catch'](handleError(_0x11beff,null));};exports['getHopperFinals']=function(_0x12975a,_0x43f2fb,_0x53a973){var _0x3fc231={'raw':!![],'where':{}};var _0x38e4bd={};var _0x1f3a64={'count':0x0,'rows':[]};return db[_0x17be('0x2d')][_0x17be('0x59')]({'where':{'id':_0x12975a[_0x17be('0x48')]['id']}})[_0x17be('0x24')](handleEntityNotFound(_0x43f2fb,null))['then'](function(_0x5aed54){if(_0x5aed54){_0x38e4bd[_0x17be('0x30')]=_[_0x17be('0x32')](db[_0x17be('0x5e')][_0x17be('0x49')]);_0x38e4bd[_0x17be('0x31')]=_[_0x17be('0x32')](_0x12975a[_0x17be('0x31')]);_0x38e4bd[_0x17be('0x3c')]=_['intersection'](_0x38e4bd[_0x17be('0x30')],_0x38e4bd['query']);_0x3fc231[_0x17be('0x34')]=_[_0x17be('0x33')](_0x38e4bd[_0x17be('0x30')],qs[_0x17be('0x35')](_0x12975a['query'][_0x17be('0x35')]));_0x3fc231[_0x17be('0x34')]=_0x3fc231['attributes'][_0x17be('0x36')]?_0x3fc231[_0x17be('0x34')]:_0x38e4bd[_0x17be('0x30')];if(!_0x12975a['query']['hasOwnProperty']('nolimit')){_0x3fc231[_0x17be('0x1c')]=qs[_0x17be('0x1c')](_0x12975a[_0x17be('0x31')][_0x17be('0x1c')]);_0x3fc231[_0x17be('0x1e')]=qs[_0x17be('0x1e')](_0x12975a[_0x17be('0x31')]['offset']);}_0x3fc231[_0x17be('0x39')]=qs['sort'](_0x12975a['query'][_0x17be('0x3a')]);_0x3fc231[_0x17be('0x3b')]=qs['filters'](_[_0x17be('0x3d')](_0x12975a['query'],_0x38e4bd['filters']));_0x3fc231[_0x17be('0x3b')][_0x17be('0x5a')]=_0x5aed54['id'];if(_0x12975a['query'][_0x17be('0x3e')]){_0x3fc231[_0x17be('0x3b')]=_[_0x17be('0x40')](_0x3fc231[_0x17be('0x3b')],{'$or':_['map'](_0x3fc231[_0x17be('0x34')],function(_0xf36458){var _0x42f195={};_0x42f195[_0xf36458]={'$like':'%'+_0x12975a['query'][_0x17be('0x3e')]+'%'};return _0x42f195;})});}_0x3fc231=_['merge']({},_0x3fc231,_0x12975a[_0x17be('0x41')]);return db[_0x17be('0x5e')][_0x17be('0x1d')]({'where':_0x3fc231[_0x17be('0x3b')]})[_0x17be('0x24')](function(_0x56cb39){_0x1f3a64['count']=_0x56cb39;if(_0x12975a['query']['includeAll']){_0x3fc231[_0x17be('0x43')]=[{'all':!![]}];}return db[_0x17be('0x5e')][_0x17be('0x44')](_0x3fc231);})[_0x17be('0x24')](function(_0x270bd1){_0x1f3a64[_0x17be('0x45')]=_0x270bd1;return _0x1f3a64;});}})[_0x17be('0x24')](respondWithFilteredResult(_0x43f2fb,_0x3fc231))['catch'](handleError(_0x43f2fb,null));};exports[_0x17be('0x5f')]=function(_0x4cf03a,_0x1ec636,_0x57b0c6){var _0x3e8772={'raw':!![],'where':{}};var _0x21bcc3={};var _0x4a0ab6={'count':0x0,'rows':[]};return db[_0x17be('0x2d')][_0x17be('0x59')]({'where':{'id':_0x4cf03a[_0x17be('0x48')]['id']}})[_0x17be('0x24')](handleEntityNotFound(_0x1ec636,null))[_0x17be('0x24')](function(_0x18877e){if(_0x18877e){_0x21bcc3[_0x17be('0x30')]=_[_0x17be('0x32')](db[_0x17be('0x60')][_0x17be('0x49')]);_0x21bcc3[_0x17be('0x31')]=_[_0x17be('0x32')](_0x4cf03a[_0x17be('0x31')]);_0x21bcc3[_0x17be('0x3c')]=_[_0x17be('0x33')](_0x21bcc3[_0x17be('0x30')],_0x21bcc3[_0x17be('0x31')]);_0x3e8772[_0x17be('0x34')]=_['intersection'](_0x21bcc3[_0x17be('0x30')],qs['fields'](_0x4cf03a[_0x17be('0x31')][_0x17be('0x35')]));_0x3e8772[_0x17be('0x34')]=_0x3e8772[_0x17be('0x34')][_0x17be('0x36')]?_0x3e8772[_0x17be('0x34')]:_0x21bcc3[_0x17be('0x30')];if(!_0x4cf03a[_0x17be('0x31')][_0x17be('0x37')](_0x17be('0x38'))){_0x3e8772['limit']=qs[_0x17be('0x1c')](_0x4cf03a[_0x17be('0x31')]['limit']);_0x3e8772[_0x17be('0x1e')]=qs['offset'](_0x4cf03a['query'][_0x17be('0x1e')]);}_0x3e8772[_0x17be('0x39')]=qs['sort'](_0x4cf03a[_0x17be('0x31')][_0x17be('0x3a')]);_0x3e8772['where']=qs[_0x17be('0x3c')](_[_0x17be('0x3d')](_0x4cf03a[_0x17be('0x31')],_0x21bcc3[_0x17be('0x3c')]));_0x3e8772['where'][_0x17be('0x5a')]=_0x18877e['id'];if(_0x4cf03a[_0x17be('0x31')][_0x17be('0x3e')]){_0x3e8772[_0x17be('0x3b')]=_['merge'](_0x3e8772[_0x17be('0x3b')],{'$or':_['map'](_0x3e8772[_0x17be('0x34')],function(_0x54d324){var _0x1bfc14={};_0x1bfc14[_0x54d324]={'$like':'%'+_0x4cf03a[_0x17be('0x31')][_0x17be('0x3e')]+'%'};return _0x1bfc14;})});}_0x3e8772=_[_0x17be('0x40')]({},_0x3e8772,_0x4cf03a[_0x17be('0x41')]);return db[_0x17be('0x60')][_0x17be('0x1d')]({'where':_0x3e8772[_0x17be('0x3b')]})[_0x17be('0x24')](function(_0xee72d7){_0x4a0ab6[_0x17be('0x1d')]=_0xee72d7;if(_0x4cf03a[_0x17be('0x31')]['includeAll']){_0x3e8772[_0x17be('0x43')]=[{'all':!![]}];}return db[_0x17be('0x60')][_0x17be('0x44')](_0x3e8772);})[_0x17be('0x24')](function(_0x589866){_0x4a0ab6[_0x17be('0x45')]=_0x589866;return _0x4a0ab6;});}})[_0x17be('0x24')](respondWithFilteredResult(_0x1ec636,_0x3e8772))[_0x17be('0x46')](handleError(_0x1ec636,null));};exports[_0x17be('0x61')]=function(_0x430b23,_0x5a2e9a,_0x40cdac){var _0xd78302={};var _0x5124c3={};var _0x25b7a5;var _0x2363e8;return db['Campaign']['findOne']({'where':{'id':_0x430b23[_0x17be('0x48')]['id']}})[_0x17be('0x24')](handleEntityNotFound(_0x5a2e9a,null))[_0x17be('0x24')](function(_0x27e496){if(_0x27e496){_0x25b7a5=_0x27e496;_0x5124c3[_0x17be('0x30')]=_[_0x17be('0x32')](db[_0x17be('0x62')][_0x17be('0x49')]);_0x5124c3['query']=_['keys'](_0x430b23[_0x17be('0x31')]);_0x5124c3[_0x17be('0x3c')]=_['intersection'](_0x5124c3[_0x17be('0x30')],_0x5124c3[_0x17be('0x31')]);_0xd78302[_0x17be('0x34')]=_[_0x17be('0x33')](_0x5124c3['model'],qs[_0x17be('0x35')](_0x430b23[_0x17be('0x31')][_0x17be('0x35')]));_0xd78302['attributes']=_0xd78302[_0x17be('0x34')][_0x17be('0x36')]?_0xd78302[_0x17be('0x34')]:_0x5124c3[_0x17be('0x30')];_0xd78302['order']=qs[_0x17be('0x3a')](_0x430b23[_0x17be('0x31')][_0x17be('0x3a')]);_0xd78302[_0x17be('0x3b')]=qs['filters'](_[_0x17be('0x3d')](_0x430b23[_0x17be('0x31')],_0x5124c3[_0x17be('0x3c')]));if(_0x430b23[_0x17be('0x31')][_0x17be('0x3e')]){_0xd78302[_0x17be('0x3b')]=_[_0x17be('0x40')](_0xd78302[_0x17be('0x3b')],{'$or':_['map'](_0xd78302[_0x17be('0x34')],function(_0x2ec46d){var _0xee5fe4={};_0xee5fe4[_0x2ec46d]={'$like':'%'+_0x430b23['query'][_0x17be('0x3e')]+'%'};return _0xee5fe4;})});}_0xd78302=_[_0x17be('0x40')]({},_0xd78302,_0x430b23[_0x17be('0x41')]);return _0x25b7a5['getLists'](_0xd78302);}})['then'](function(_0x573003){if(_0x573003){_0x2363e8=_0x573003[_0x17be('0x36')];if(!_0x430b23['query'][_0x17be('0x37')]('nolimit')){_0xd78302[_0x17be('0x1c')]=qs['limit'](_0x430b23[_0x17be('0x31')][_0x17be('0x1c')]);_0xd78302['offset']=qs[_0x17be('0x1e')](_0x430b23[_0x17be('0x31')][_0x17be('0x1e')]);}return _0x25b7a5[_0x17be('0x61')](_0xd78302);}})[_0x17be('0x24')](function(_0x4c92d4){if(_0x4c92d4){return _0x4c92d4?{'count':_0x2363e8,'rows':_0x4c92d4}:null;}})[_0x17be('0x24')](respondWithResult(_0x5a2e9a,null))['catch'](handleError(_0x5a2e9a,null));};exports['addLists']=function(_0x397539,_0x5d8409,_0x569664){var _0x5363f1,_0x5e8bc9;var _0x4e302a=[];var _0x4ae102=moment()[_0x17be('0x63')]('YYYY-MM-DD\x20HH:mm:ss');return db[_0x17be('0x2d')][_0x17be('0x4a')]({'where':{'id':_0x397539['params']['id']}})[_0x17be('0x24')](handleEntityNotFound(_0x5d8409,null))['then'](function(_0x3ac5fa){if(_0x3ac5fa){_0x5e8bc9=_0x3ac5fa;return _0x3ac5fa['addLists'](_0x397539[_0x17be('0x4c')][_0x17be('0x64')],_[_0x17be('0x65')](_0x397539['body'],[_0x17be('0x64'),'id'])||{});}return null;})['spread'](function(_0x28c0dd){var _0x14a06b;var _0x24c1b9;_0x5363f1=_0x28c0dd||[];var _0x14c51f=[];if(_0x28c0dd){for(var _0x5606f5=0x0;_0x5606f5<_0x28c0dd[_0x17be('0x36')];_0x5606f5+=0x1){var _0x24a040=_0x28c0dd[_0x5606f5][_0x17be('0x26')]({'plain':!![]});_0x5e8bc9[_0x17be('0x66')]=_0x397539[_0x17be('0x4c')][_0x17be('0x66')]?_0x397539[_0x17be('0x4c')][_0x17be('0x66')]:_0x5e8bc9[_0x17be('0x66')];switch(_0x5e8bc9[_0x17be('0x66')]){case _0x17be('0x67'):_0x14a06b=squel['insert']()[_0x17be('0x68')]('cm_hopper')[_0x17be('0x69')]([_0x17be('0x6a'),_0x17be('0x6b'),_0x17be('0x6c'),_0x17be('0x6d'),_0x17be('0x5a'),'createdAt',_0x17be('0x56')],squel[_0x17be('0x6e')]()[_0x17be('0x6f')]('phone',_0x17be('0x6a'))['field'](_0x17be('0x70'),_0x17be('0x6b'))['field']('id',_0x17be('0x6c'))['field'](_0x24a040[_0x17be('0x71')][_0x17be('0x72')](),_0x17be('0x6d'))[_0x17be('0x6f')](_0x397539[_0x17be('0x48')]['id'][_0x17be('0x72')](),'CampaignId')[_0x17be('0x6f')]('\x27'+_0x4ae102+'\x27','createdAt')[_0x17be('0x6f')]('\x27'+_0x4ae102+'\x27',_0x17be('0x56'))[_0x17be('0x73')]('cm_contacts')[_0x17be('0x3b')](_0x17be('0x74'))[_0x17be('0x3b')](_0x17be('0x75'),_0x24a040[_0x17be('0x71')]['toString']())[_0x17be('0x3b')](_0x17be('0x76'))['where'](_0x17be('0x77'),squel['select']()[_0x17be('0x6f')]('COALESCE(calleridnum,\x27\x27)')['from'](_0x17be('0x78'))['where']('CampaignId\x20=\x20?',_0x397539[_0x17be('0x48')]['id'][_0x17be('0x72')]()))[_0x17be('0x3b')](_0x17be('0x77'),squel[_0x17be('0x6e')]()['field'](_0x17be('0x79'))[_0x17be('0x73')]('cm_hopper')[_0x17be('0x3b')](_0x17be('0x7a'),_0x397539[_0x17be('0x48')]['id'][_0x17be('0x72')]())))[_0x17be('0x72')]();break;case'onlyIfOpen':_0x14a06b=squel['insert']()['into'](_0x17be('0x7b'))[_0x17be('0x69')](['phone',_0x17be('0x6b'),'ContactId',_0x17be('0x6d'),_0x17be('0x5a'),'createdAt','updatedAt'],squel[_0x17be('0x6e')]()[_0x17be('0x6f')](_0x17be('0x6a'),_0x17be('0x6a'))[_0x17be('0x6f')]('NOW()',_0x17be('0x6b'))[_0x17be('0x6f')]('id','ContactId')['field'](_0x24a040[_0x17be('0x71')][_0x17be('0x72')](),_0x17be('0x6d'))['field'](_0x397539[_0x17be('0x48')]['id'][_0x17be('0x72')](),_0x17be('0x5a'))[_0x17be('0x6f')]('\x27'+_0x4ae102+'\x27','createdAt')[_0x17be('0x6f')]('\x27'+_0x4ae102+'\x27','updatedAt')[_0x17be('0x73')](_0x17be('0x7c'))[_0x17be('0x3b')](_0x17be('0x74'))[_0x17be('0x3b')]('ListId\x20=\x20?',_0x24a040[_0x17be('0x71')][_0x17be('0x72')]())['where'](_0x17be('0x76'))[_0x17be('0x3b')](_0x17be('0x77'),squel[_0x17be('0x6e')]()[_0x17be('0x6f')](_0x17be('0x79'))[_0x17be('0x73')](_0x17be('0x7b'))[_0x17be('0x3b')](_0x17be('0x7a'),_0x397539[_0x17be('0x48')]['id'][_0x17be('0x72')]())))['toString']();break;default:_0x14a06b=squel[_0x17be('0x7d')]()['into'](_0x17be('0x7b'))[_0x17be('0x69')]([_0x17be('0x6a'),_0x17be('0x6b'),_0x17be('0x6c'),'ListId','CampaignId','createdAt','updatedAt'],squel[_0x17be('0x6e')]()['field'](_0x17be('0x6a'),_0x17be('0x6a'))[_0x17be('0x6f')](_0x17be('0x70'),_0x17be('0x6b'))['field']('id',_0x17be('0x6c'))['field'](_0x24a040[_0x17be('0x71')][_0x17be('0x72')](),_0x17be('0x6d'))[_0x17be('0x6f')](_0x397539[_0x17be('0x48')]['id'][_0x17be('0x72')](),_0x17be('0x5a'))[_0x17be('0x6f')]('\x27'+_0x4ae102+'\x27',_0x17be('0x55'))['field']('\x27'+_0x4ae102+'\x27',_0x17be('0x56'))[_0x17be('0x73')](_0x17be('0x7c'))[_0x17be('0x3b')](_0x17be('0x74'))[_0x17be('0x3b')](_0x17be('0x75'),_0x24a040['CmListId'][_0x17be('0x72')]())[_0x17be('0x3b')]('phone\x20IS\x20NOT\x20NULL'))[_0x17be('0x72')]();}_0x24c1b9=squel['insert']()[_0x17be('0x68')](_0x17be('0x7e'))['fromQuery']([_0x17be('0x7f'),_0x17be('0x6b'),_0x17be('0x6a'),_0x17be('0x80'),_0x17be('0x55'),_0x17be('0x56')],squel[_0x17be('0x6e')]()[_0x17be('0x6f')](_0x17be('0x81'),'id')[_0x17be('0x6f')]('NOW()',_0x17be('0x6b'))[_0x17be('0x6f')](_0x17be('0x82'),'phone')[_0x17be('0x6f')](_0x17be('0x83'),_0x17be('0x80'))[_0x17be('0x6f')]('\x27'+_0x4ae102+'\x27','createdAt')[_0x17be('0x6f')]('\x27'+_0x4ae102+'\x27',_0x17be('0x56'))[_0x17be('0x73')](_0x17be('0x84'),'ci')[_0x17be('0x85')](_0x17be('0x7b'),'h',_0x17be('0x86'))[_0x17be('0x3b')]('h.ListId\x20=\x20?',_0x24a040[_0x17be('0x71')][_0x17be('0x72')]())[_0x17be('0x3b')](_0x17be('0x87'),_0x397539['params']['id'][_0x17be('0x72')]())[_0x17be('0x3b')](_0x17be('0x88'),_0x4ae102))[_0x17be('0x72')]();_0x14c51f['push'](db[_0x17be('0x89')]['query'](_0x14a06b));_0x4e302a[_0x17be('0x8a')](db[_0x17be('0x89')][_0x17be('0x31')](_0x24c1b9));}return BPromise[_0x17be('0x8b')](_0x14c51f);}})['then'](function(){return BPromise[_0x17be('0x8b')](_0x4e302a);})[_0x17be('0x24')](function(){return _0x5363f1;})[_0x17be('0x24')](respondWithResult(_0x5d8409,null))[_0x17be('0x46')](handleError(_0x5d8409,null));};exports[_0x17be('0x8c')]=function(_0x51f8ca,_0x2547b5,_0x335ca8){return db[_0x17be('0x2d')][_0x17be('0x4a')]({'where':{'id':_0x51f8ca['params']['id']}})['then'](handleEntityNotFound(_0x2547b5,null))[_0x17be('0x24')](function(_0x923da9){if(_0x923da9){return _0x923da9['removeLists'](_0x51f8ca[_0x17be('0x31')][_0x17be('0x64')]);}})['then'](function(_0x591e5a){if(_0x591e5a){return db['CmHopper']['destroy']({'where':{'ListId':_0x51f8ca['query']['ids'],'CampaignId':_0x51f8ca[_0x17be('0x48')]['id']}})[_0x17be('0x24')](function(){return _0x591e5a;});}})[_0x17be('0x24')](respondWithStatusCode(_0x2547b5,null))['catch'](handleError(_0x2547b5,null));};exports[_0x17be('0x8d')]=function(_0x11a192,_0xf1017e,_0x133097){var _0x3c4d5a={};var _0x51324f={};var _0x266114;var _0x481a3a;return db['Campaign']['findOne']({'where':{'id':_0x11a192[_0x17be('0x48')]['id']}})[_0x17be('0x24')](handleEntityNotFound(_0xf1017e,null))['then'](function(_0x165ddd){if(_0x165ddd){_0x266114=_0x165ddd;_0x51324f[_0x17be('0x30')]=_[_0x17be('0x32')](db[_0x17be('0x62')]['rawAttributes']);_0x51324f[_0x17be('0x31')]=_[_0x17be('0x32')](_0x11a192[_0x17be('0x31')]);_0x51324f[_0x17be('0x3c')]=_['intersection'](_0x51324f[_0x17be('0x30')],_0x51324f[_0x17be('0x31')]);_0x3c4d5a[_0x17be('0x34')]=_[_0x17be('0x33')](_0x51324f[_0x17be('0x30')],qs['fields'](_0x11a192['query']['fields']));_0x3c4d5a[_0x17be('0x34')]=_0x3c4d5a[_0x17be('0x34')][_0x17be('0x36')]?_0x3c4d5a[_0x17be('0x34')]:_0x51324f[_0x17be('0x30')];_0x3c4d5a['order']=qs[_0x17be('0x3a')](_0x11a192[_0x17be('0x31')][_0x17be('0x3a')]);_0x3c4d5a[_0x17be('0x3b')]=qs['filters'](_[_0x17be('0x3d')](_0x11a192[_0x17be('0x31')],_0x51324f['filters']));if(_0x11a192[_0x17be('0x31')][_0x17be('0x3e')]){_0x3c4d5a['where']=_[_0x17be('0x40')](_0x3c4d5a['where'],{'$or':_[_0x17be('0x2c')](_0x3c4d5a[_0x17be('0x34')],function(_0x3cd438){var _0x13c78b={};_0x13c78b[_0x3cd438]={'$like':'%'+_0x11a192[_0x17be('0x31')][_0x17be('0x3e')]+'%'};return _0x13c78b;})});}_0x3c4d5a=_[_0x17be('0x40')]({},_0x3c4d5a,_0x11a192['options']);return _0x266114[_0x17be('0x8d')](_0x3c4d5a);}})['then'](function(_0x2b1578){if(_0x2b1578){_0x481a3a=_0x2b1578['length'];if(!_0x11a192[_0x17be('0x31')][_0x17be('0x37')](_0x17be('0x38'))){_0x3c4d5a[_0x17be('0x1c')]=qs[_0x17be('0x1c')](_0x11a192[_0x17be('0x31')]['limit']);_0x3c4d5a[_0x17be('0x1e')]=qs[_0x17be('0x1e')](_0x11a192[_0x17be('0x31')][_0x17be('0x1e')]);}return _0x266114[_0x17be('0x8d')](_0x3c4d5a);}})[_0x17be('0x24')](function(_0xad9ceb){if(_0xad9ceb){return _0xad9ceb?{'count':_0x481a3a,'rows':_0xad9ceb}:null;}})[_0x17be('0x24')](respondWithResult(_0xf1017e,null))[_0x17be('0x46')](handleError(_0xf1017e,null));};exports['addBlackLists']=function(_0x163133,_0x804dbb,_0x4807a3){var _0x339036,_0x1b8df4;var _0x1f1235=[];var _0x5320c6=moment()[_0x17be('0x63')](_0x17be('0x8e'));return db[_0x17be('0x2d')]['find']({'where':{'id':_0x163133[_0x17be('0x48')]['id']}})[_0x17be('0x24')](handleEntityNotFound(_0x804dbb,null))[_0x17be('0x24')](function(_0x152214){if(_0x152214){_0x1b8df4=_0x152214;return _0x152214[_0x17be('0x8f')](_0x163133['body'][_0x17be('0x64')],_[_0x17be('0x65')](_0x163133[_0x17be('0x4c')],[_0x17be('0x64'),'id'])||{});}return null;})[_0x17be('0x90')](function(_0x48c63c){var _0x12e083;var _0x12bcfd;_0x339036=_0x48c63c||[];var _0x430dc7=[];if(_0x48c63c){for(var _0x439977=0x0;_0x439977<_0x48c63c[_0x17be('0x36')];_0x439977+=0x1){var _0x2734ee=_0x48c63c[_0x439977][_0x17be('0x26')]({'plain':!![]});_0x12e083=squel['insert']()[_0x17be('0x68')](_0x17be('0x91'))[_0x17be('0x69')]([_0x17be('0x6a'),_0x17be('0x6c'),_0x17be('0x6d'),'CampaignId',_0x17be('0x55'),'updatedAt'],squel[_0x17be('0x6e')]()[_0x17be('0x6f')](_0x17be('0x6a'),'phone')['field']('id','ContactId')['field'](_0x2734ee['CmListId'][_0x17be('0x72')](),_0x17be('0x6d'))[_0x17be('0x6f')](_0x163133[_0x17be('0x48')]['id'][_0x17be('0x72')](),_0x17be('0x5a'))[_0x17be('0x6f')](_0x17be('0x70'),_0x17be('0x55'))['field'](_0x17be('0x70'),_0x17be('0x56'))[_0x17be('0x73')](_0x17be('0x7c'))[_0x17be('0x3b')](_0x17be('0x74'))['where']('ListId\x20=\x20?',_0x2734ee[_0x17be('0x71')][_0x17be('0x72')]())[_0x17be('0x3b')](_0x17be('0x76')))[_0x17be('0x72')]();_0x430dc7[_0x17be('0x8a')](db[_0x17be('0x89')][_0x17be('0x31')](_0x12e083));}return BPromise[_0x17be('0x8b')](_0x430dc7);}})['then'](function(){return _0x339036;})[_0x17be('0x24')](respondWithResult(_0x804dbb,null))['catch'](handleError(_0x804dbb,null));};exports[_0x17be('0x92')]=function(_0x238689,_0x3dfe8f,_0x3188cf){return db['Campaign'][_0x17be('0x4a')]({'where':{'id':_0x238689['params']['id']}})['then'](handleEntityNotFound(_0x3dfe8f,null))[_0x17be('0x24')](function(_0x3fa8a3){if(_0x3fa8a3){return _0x3fa8a3[_0x17be('0x92')](_0x238689[_0x17be('0x31')][_0x17be('0x64')]);}})['then'](function(_0xe6ef8a){if(_0xe6ef8a){return db[_0x17be('0x60')][_0x17be('0x25')]({'where':{'ListId':_0x238689['query'][_0x17be('0x64')],'CampaignId':_0x238689['params']['id']}})[_0x17be('0x24')](function(){return _0xe6ef8a;});}})['then'](respondWithStatusCode(_0x3dfe8f,null))[_0x17be('0x46')](handleError(_0x3dfe8f,null));}; \ No newline at end of file +var _0x9348=['end','json','offset','limit','undefined','set','apply','reject','save','update','then','destroy','UserProfileResource','error','stack','name','send','map','rawAttributes','fieldName','type','key','keys','query','filters','intersection','attributes','model','fields','nolimit','order','sort','where','pick','filter','merge','Campaign','count','include','findAll','rows','catch','params','length','includeAll','options','find','create','body','user','get','IvrCampaigns','userProfileId','autoAssociation','clone','omit','createdAt','updatedAt','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getHoppers','findOne','CmHopper','hasOwnProperty','CampaignId','getHopperHistories','CmHopperHistory','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','addLists','format','YYYY-MM-DD\x20HH:mm:ss','ids','spread','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','ListId','select','field','NOW()','scheduledAt','toString','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','from','cm_hopper_final','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','ContactId','CmListId','cm_hopper_additional_phones','cmHopperId','OrderBy','h.id','ci.item','ci.OrderBY','cm_contact_has_items','join','h.ContactId\x20=\x20ci.CmContactId','h.CampaignId=?','h.createdAt\x20=\x20?','sequelize','all','removeLists','getBlackLists','CmList','addBlackLists','cm_hopper_black','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0x3f2334,_0x55ce69){var _0x8b70cf=function(_0x54217b){while(--_0x54217b){_0x3f2334['push'](_0x3f2334['shift']());}};_0x8b70cf(++_0x55ce69);}(_0x9348,0x10d));var _0x8934=function(_0x2ec46c,_0x483b03){_0x2ec46c=_0x2ec46c-0x0;var _0x43ff06=_0x9348[_0x2ec46c];return _0x43ff06;};'use strict';var emlformat=require(_0x8934('0x0'));var rimraf=require(_0x8934('0x1'));var zipdir=require(_0x8934('0x2'));var jsonpatch=require(_0x8934('0x3'));var rp=require(_0x8934('0x4'));var moment=require('moment');var BPromise=require(_0x8934('0x5'));var Mustache=require(_0x8934('0x6'));var util=require('util');var path=require(_0x8934('0x7'));var sox=require(_0x8934('0x8'));var csv=require(_0x8934('0x9'));var ejs=require(_0x8934('0xa'));var fs=require('fs');var fs_extra=require(_0x8934('0xb'));var _=require(_0x8934('0xc'));var squel=require('squel');var crypto=require(_0x8934('0xd'));var jsforce=require(_0x8934('0xe'));var deskjs=require(_0x8934('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x8934('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x8934('0x11'));var hardwareService=require(_0x8934('0x12'));var logger=require(_0x8934('0x13'))(_0x8934('0x14'));var utils=require(_0x8934('0x15'));var config=require(_0x8934('0x16'));var licenseUtil=require(_0x8934('0x17'));var db=require(_0x8934('0x18'))['db'];function respondWithStatusCode(_0x4a999c,_0x68427d){_0x68427d=_0x68427d||0xcc;return function(_0x108eab){if(_0x108eab){return _0x4a999c[_0x8934('0x19')](_0x68427d);}return _0x4a999c[_0x8934('0x1a')](_0x68427d)[_0x8934('0x1b')]();};}function respondWithResult(_0xdf59f4,_0x5b560f){_0x5b560f=_0x5b560f||0xc8;return function(_0x254720){if(_0x254720){return _0xdf59f4[_0x8934('0x1a')](_0x5b560f)[_0x8934('0x1c')](_0x254720);}};}function respondWithFilteredResult(_0x94b948,_0x34d4dc){return function(_0x41e6a9){if(_0x41e6a9){var _0x2a5b04=typeof _0x34d4dc[_0x8934('0x1d')]==='undefined'&&typeof _0x34d4dc[_0x8934('0x1e')]===_0x8934('0x1f');var _0x261c78=_0x41e6a9['count'];var _0x47f25e=_0x2a5b04?0x0:_0x34d4dc['offset'];var _0x2ff9ce=_0x2a5b04?_0x41e6a9['count']:_0x34d4dc[_0x8934('0x1d')]+_0x34d4dc[_0x8934('0x1e')];var _0x14b4e4;if(_0x2ff9ce>=_0x261c78){_0x2ff9ce=_0x261c78;_0x14b4e4=0xc8;}else{_0x14b4e4=0xce;}_0x94b948[_0x8934('0x1a')](_0x14b4e4);return _0x94b948[_0x8934('0x20')]('Content-Range',_0x47f25e+'-'+_0x2ff9ce+'/'+_0x261c78)[_0x8934('0x1c')](_0x41e6a9);}return null;};}function patchUpdates(_0x5ae49f){return function(_0x476c6c){try{jsonpatch[_0x8934('0x21')](_0x476c6c,_0x5ae49f,!![]);}catch(_0x1ccbe5){return BPromise[_0x8934('0x22')](_0x1ccbe5);}return _0x476c6c[_0x8934('0x23')]();};}function saveUpdates(_0x331e18,_0x36fe20){return function(_0x4f4a9b){if(_0x4f4a9b){return _0x4f4a9b[_0x8934('0x24')](_0x331e18)[_0x8934('0x25')](function(_0x32020a){return _0x32020a;});}return null;};}function removeEntity(_0x343e09,_0x43b89a){return function(_0x5e593b){if(_0x5e593b){return _0x5e593b[_0x8934('0x26')]()[_0x8934('0x25')](function(){var _0x1b5775=_0x5e593b['get']({'plain':!![]});var _0x16cfc2='IvrCampaigns';return db[_0x8934('0x27')][_0x8934('0x26')]({'where':{'type':_0x16cfc2,'resourceId':_0x1b5775['id']}})[_0x8934('0x25')](function(){return _0x5e593b;});})['then'](function(){_0x343e09[_0x8934('0x1a')](0xcc)[_0x8934('0x1b')]();});}};}function handleEntityNotFound(_0x310454,_0x50b89e){return function(_0x4b5780){if(!_0x4b5780){_0x310454[_0x8934('0x19')](0x194);}return _0x4b5780;};}function handleError(_0x249031,_0x358445){_0x358445=_0x358445||0x1f4;return function(_0x3d93c7){logger[_0x8934('0x28')](_0x3d93c7[_0x8934('0x29')]);if(_0x3d93c7[_0x8934('0x2a')]){delete _0x3d93c7[_0x8934('0x2a')];}_0x249031[_0x8934('0x1a')](_0x358445)[_0x8934('0x2b')](_0x3d93c7);};}exports['index']=function(_0x1d068c,_0x3e973e){var _0x54d28d={},_0x2aa18e={},_0x3d60f9={'count':0x0,'rows':[]};var _0x1a17b5=_[_0x8934('0x2c')](db['Campaign'][_0x8934('0x2d')],function(_0x18e881){return{'name':_0x18e881[_0x8934('0x2e')],'type':_0x18e881[_0x8934('0x2f')][_0x8934('0x30')]};});_0x2aa18e['model']=_[_0x8934('0x2c')](_0x1a17b5,'name');_0x2aa18e['query']=_[_0x8934('0x31')](_0x1d068c[_0x8934('0x32')]);_0x2aa18e[_0x8934('0x33')]=_[_0x8934('0x34')](_0x2aa18e['model'],_0x2aa18e[_0x8934('0x32')]);_0x54d28d[_0x8934('0x35')]=_[_0x8934('0x34')](_0x2aa18e[_0x8934('0x36')],qs[_0x8934('0x37')](_0x1d068c['query'][_0x8934('0x37')]));_0x54d28d[_0x8934('0x35')]=_0x54d28d['attributes']['length']?_0x54d28d[_0x8934('0x35')]:_0x2aa18e[_0x8934('0x36')];if(!_0x1d068c['query']['hasOwnProperty'](_0x8934('0x38'))){_0x54d28d[_0x8934('0x1e')]=qs[_0x8934('0x1e')](_0x1d068c[_0x8934('0x32')][_0x8934('0x1e')]);_0x54d28d[_0x8934('0x1d')]=qs[_0x8934('0x1d')](_0x1d068c[_0x8934('0x32')][_0x8934('0x1d')]);}_0x54d28d[_0x8934('0x39')]=qs[_0x8934('0x3a')](_0x1d068c['query'][_0x8934('0x3a')]);_0x54d28d[_0x8934('0x3b')]=qs['filters'](_[_0x8934('0x3c')](_0x1d068c[_0x8934('0x32')],_0x2aa18e[_0x8934('0x33')]),_0x1a17b5);if(_0x1d068c[_0x8934('0x32')][_0x8934('0x3d')]){_0x54d28d['where']=_['merge'](_0x54d28d['where'],{'$or':_[_0x8934('0x2c')](_0x1a17b5,function(_0x107d0e){if(_0x107d0e[_0x8934('0x2f')]!=='VIRTUAL'){var _0x298e3d={};_0x298e3d[_0x107d0e['name']]={'$like':'%'+_0x1d068c['query'][_0x8934('0x3d')]+'%'};return _0x298e3d;}})});}_0x54d28d=_[_0x8934('0x3e')]({},_0x54d28d,_0x1d068c['options']);var _0x52b95f={'where':_0x54d28d[_0x8934('0x3b')]};return db[_0x8934('0x3f')][_0x8934('0x40')](_0x52b95f)['then'](function(_0x46bfe7){_0x3d60f9['count']=_0x46bfe7;if(_0x1d068c[_0x8934('0x32')]['includeAll']){_0x54d28d[_0x8934('0x41')]=[{'all':!![]}];}return db[_0x8934('0x3f')][_0x8934('0x42')](_0x54d28d);})['then'](function(_0xefdfab){_0x3d60f9[_0x8934('0x43')]=_0xefdfab;return _0x3d60f9;})[_0x8934('0x25')](respondWithFilteredResult(_0x3e973e,_0x54d28d))[_0x8934('0x44')](handleError(_0x3e973e,null));};exports['show']=function(_0x2182db,_0x2ec412){var _0x3aa062={'raw':![],'where':{'id':_0x2182db[_0x8934('0x45')]['id']}},_0x3feecb={};_0x3feecb[_0x8934('0x36')]=_[_0x8934('0x31')](db[_0x8934('0x3f')]['rawAttributes']);_0x3feecb['query']=_['keys'](_0x2182db[_0x8934('0x32')]);_0x3feecb[_0x8934('0x33')]=_['intersection'](_0x3feecb[_0x8934('0x36')],_0x3feecb['query']);_0x3aa062[_0x8934('0x35')]=_[_0x8934('0x34')](_0x3feecb['model'],qs[_0x8934('0x37')](_0x2182db[_0x8934('0x32')][_0x8934('0x37')]));_0x3aa062[_0x8934('0x35')]=_0x3aa062['attributes'][_0x8934('0x46')]?_0x3aa062[_0x8934('0x35')]:_0x3feecb['model'];if(_0x2182db[_0x8934('0x32')][_0x8934('0x47')]){_0x3aa062[_0x8934('0x41')]=[{'all':!![]}];}_0x3aa062=_[_0x8934('0x3e')]({},_0x3aa062,_0x2182db[_0x8934('0x48')]);return db[_0x8934('0x3f')][_0x8934('0x49')](_0x3aa062)[_0x8934('0x25')](handleEntityNotFound(_0x2ec412,null))[_0x8934('0x25')](respondWithResult(_0x2ec412,null))[_0x8934('0x44')](handleError(_0x2ec412,null));};exports[_0x8934('0x4a')]=function(_0xe212bc,_0x2c322d){return db[_0x8934('0x3f')][_0x8934('0x4a')](_0xe212bc[_0x8934('0x4b')],{})[_0x8934('0x25')](function(_0x248d88){var _0x53d058=_0xe212bc[_0x8934('0x4c')][_0x8934('0x4d')]({'plain':!![]});if(!_0x53d058)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x53d058['role']==='user'){var _0x4bc431=_0x248d88[_0x8934('0x4d')]({'plain':!![]});var _0x15310a=_0x8934('0x4e');return db['UserProfileSection']['find']({'where':{'name':_0x15310a,'userProfileId':_0x53d058[_0x8934('0x4f')]},'raw':!![]})['then'](function(_0x4d9a43){if(_0x4d9a43&&_0x4d9a43[_0x8934('0x50')]===0x0){return db[_0x8934('0x27')][_0x8934('0x4a')]({'name':_0x4bc431[_0x8934('0x2a')],'resourceId':_0x4bc431['id'],'type':_0x4d9a43[_0x8934('0x2a')],'sectionId':_0x4d9a43['id']},{})[_0x8934('0x25')](function(){return _0x248d88;});}else{return _0x248d88;}})[_0x8934('0x44')](function(_0x575bd7){logger[_0x8934('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x575bd7);throw _0x575bd7;});}return _0x248d88;})[_0x8934('0x25')](respondWithResult(_0x2c322d,0xc9))[_0x8934('0x44')](handleError(_0x2c322d,null));};exports[_0x8934('0x51')]=function(_0x3df31e,_0x40be23){var _0x265b0a={'where':{'id':_0x3df31e[_0x8934('0x45')]['id']}},_0x1f6c5f={};_0x1f6c5f['model']=_[_0x8934('0x31')](db[_0x8934('0x3f')][_0x8934('0x2d')]);_0x265b0a[_0x8934('0x35')]=_[_0x8934('0x34')](_0x1f6c5f['model'],qs[_0x8934('0x37')](_0x3df31e[_0x8934('0x32')][_0x8934('0x37')]));_0x265b0a['attributes']=_0x265b0a[_0x8934('0x35')][_0x8934('0x46')]?_0x265b0a[_0x8934('0x35')]:_0x1f6c5f['model'];if(_0x3df31e['query']['includeAll']){_0x265b0a[_0x8934('0x41')]=[{'all':!![]}];}_0x265b0a=_[_0x8934('0x3e')]({},_0x265b0a,_0x3df31e[_0x8934('0x48')]);return db['Campaign'][_0x8934('0x49')](_0x265b0a)[_0x8934('0x25')](handleEntityNotFound(_0x40be23,null))['then'](function(_0x5157d7){if(_0x5157d7){var _0xf993d2=_0x5157d7[_0x8934('0x4d')]({'plain':!![]});_0xf993d2=qs[_0x8934('0x52')](_0xf993d2,['id',_0x8934('0x53'),'updatedAt']);_0x3df31e['body']=_['omit'](_0x3df31e['body'],['id',_0x8934('0x53'),_0x8934('0x54')]);return db[_0x8934('0x3f')][_0x8934('0x4a')](_[_0x8934('0x3e')](_0xf993d2,_0x3df31e[_0x8934('0x4b')]),{'include':_0x3df31e['query'][_0x8934('0x47')]?[{'all':!![]}]:undefined})[_0x8934('0x25')](function(_0x4991bd){var _0x41e6b4=_0x3df31e['user'][_0x8934('0x4d')]({'plain':!![]});if(!_0x41e6b4)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x41e6b4[_0x8934('0x55')]===_0x8934('0x4c')){var _0x59e63c=_0x4991bd[_0x8934('0x4d')]({'plain':!![]});var _0x458895=_0x8934('0x4e');return db[_0x8934('0x56')]['find']({'where':{'name':_0x458895,'userProfileId':_0x41e6b4['userProfileId']},'raw':!![]})[_0x8934('0x25')](function(_0x3a0378){if(_0x3a0378&&_0x3a0378[_0x8934('0x50')]===0x0){return db[_0x8934('0x27')][_0x8934('0x4a')]({'name':_0x59e63c[_0x8934('0x2a')],'resourceId':_0x59e63c['id'],'type':_0x3a0378[_0x8934('0x2a')],'sectionId':_0x3a0378['id']},{})[_0x8934('0x25')](function(){return _0x4991bd;});}else{return _0x4991bd;}})[_0x8934('0x44')](function(_0x2b1888){logger[_0x8934('0x28')](_0x8934('0x57'),_0x2b1888);throw _0x2b1888;});}return _0x4991bd;});}})[_0x8934('0x25')](respondWithResult(_0x40be23,0xc9))[_0x8934('0x44')](handleError(_0x40be23,null));};exports['update']=function(_0x5c2819,_0x1a52be){if(_0x5c2819[_0x8934('0x4b')]['id']){delete _0x5c2819[_0x8934('0x4b')]['id'];}return db[_0x8934('0x3f')][_0x8934('0x49')]({'where':{'id':_0x5c2819[_0x8934('0x45')]['id']}})[_0x8934('0x25')](handleEntityNotFound(_0x1a52be,null))['then'](saveUpdates(_0x5c2819[_0x8934('0x4b')],null))[_0x8934('0x25')](respondWithResult(_0x1a52be,null))['catch'](handleError(_0x1a52be,null));};exports[_0x8934('0x26')]=function(_0x4912a5,_0x2dac01){return db[_0x8934('0x3f')][_0x8934('0x49')]({'where':{'id':_0x4912a5['params']['id']}})[_0x8934('0x25')](handleEntityNotFound(_0x2dac01,null))[_0x8934('0x25')](removeEntity(_0x2dac01,null))['catch'](handleError(_0x2dac01,null));};exports[_0x8934('0x58')]=function(_0x558f93,_0x1311e6,_0x583448){var _0x2a68b3={'raw':!![],'where':{}};var _0x6b3376={};var _0x24b0ce={'count':0x0,'rows':[]};return db['Campaign'][_0x8934('0x59')]({'where':{'id':_0x558f93[_0x8934('0x45')]['id']}})[_0x8934('0x25')](handleEntityNotFound(_0x1311e6,null))[_0x8934('0x25')](function(_0x526a00){if(_0x526a00){_0x6b3376[_0x8934('0x36')]=_['keys'](db[_0x8934('0x5a')][_0x8934('0x2d')]);_0x6b3376[_0x8934('0x32')]=_[_0x8934('0x31')](_0x558f93['query']);_0x6b3376[_0x8934('0x33')]=_[_0x8934('0x34')](_0x6b3376[_0x8934('0x36')],_0x6b3376['query']);_0x2a68b3[_0x8934('0x35')]=_[_0x8934('0x34')](_0x6b3376[_0x8934('0x36')],qs['fields'](_0x558f93['query'][_0x8934('0x37')]));_0x2a68b3[_0x8934('0x35')]=_0x2a68b3[_0x8934('0x35')][_0x8934('0x46')]?_0x2a68b3[_0x8934('0x35')]:_0x6b3376[_0x8934('0x36')];if(!_0x558f93[_0x8934('0x32')][_0x8934('0x5b')](_0x8934('0x38'))){_0x2a68b3['limit']=qs[_0x8934('0x1e')](_0x558f93[_0x8934('0x32')][_0x8934('0x1e')]);_0x2a68b3[_0x8934('0x1d')]=qs[_0x8934('0x1d')](_0x558f93['query'][_0x8934('0x1d')]);}_0x2a68b3[_0x8934('0x39')]=qs['sort'](_0x558f93[_0x8934('0x32')]['sort']);_0x2a68b3['where']=qs['filters'](_[_0x8934('0x3c')](_0x558f93[_0x8934('0x32')],_0x6b3376[_0x8934('0x33')]));_0x2a68b3['where'][_0x8934('0x5c')]=_0x526a00['id'];if(_0x558f93[_0x8934('0x32')]['filter']){_0x2a68b3[_0x8934('0x3b')]=_[_0x8934('0x3e')](_0x2a68b3[_0x8934('0x3b')],{'$or':_[_0x8934('0x2c')](_0x2a68b3[_0x8934('0x35')],function(_0x324722){var _0x293bb8={};_0x293bb8[_0x324722]={'$like':'%'+_0x558f93[_0x8934('0x32')][_0x8934('0x3d')]+'%'};return _0x293bb8;})});}_0x2a68b3=_[_0x8934('0x3e')]({},_0x2a68b3,_0x558f93['options']);return db[_0x8934('0x5a')][_0x8934('0x40')]({'where':_0x2a68b3[_0x8934('0x3b')]})[_0x8934('0x25')](function(_0x4045f9){_0x24b0ce[_0x8934('0x40')]=_0x4045f9;if(_0x558f93[_0x8934('0x32')]['includeAll']){_0x2a68b3[_0x8934('0x41')]=[{'all':!![]}];}return db[_0x8934('0x5a')][_0x8934('0x42')](_0x2a68b3);})[_0x8934('0x25')](function(_0x9de459){_0x24b0ce[_0x8934('0x43')]=_0x9de459;return _0x24b0ce;});}})[_0x8934('0x25')](respondWithFilteredResult(_0x1311e6,_0x2a68b3))[_0x8934('0x44')](handleError(_0x1311e6,null));};exports[_0x8934('0x5d')]=function(_0x52b25e,_0x4ef5eb,_0x1d1590){var _0x9df49d={'raw':!![],'where':{}};var _0x4faab2={};var _0x2becdf={'count':0x0,'rows':[]};return db[_0x8934('0x3f')][_0x8934('0x59')]({'where':{'id':_0x52b25e[_0x8934('0x45')]['id']}})[_0x8934('0x25')](handleEntityNotFound(_0x4ef5eb,null))[_0x8934('0x25')](function(_0x2d8db7){if(_0x2d8db7){_0x4faab2[_0x8934('0x36')]=_[_0x8934('0x31')](db[_0x8934('0x5e')][_0x8934('0x2d')]);_0x4faab2['query']=_[_0x8934('0x31')](_0x52b25e[_0x8934('0x32')]);_0x4faab2[_0x8934('0x33')]=_['intersection'](_0x4faab2[_0x8934('0x36')],_0x4faab2['query']);_0x9df49d[_0x8934('0x35')]=_[_0x8934('0x34')](_0x4faab2[_0x8934('0x36')],qs[_0x8934('0x37')](_0x52b25e['query']['fields']));_0x9df49d[_0x8934('0x35')]=_0x9df49d['attributes'][_0x8934('0x46')]?_0x9df49d[_0x8934('0x35')]:_0x4faab2[_0x8934('0x36')];if(!_0x52b25e[_0x8934('0x32')]['hasOwnProperty'](_0x8934('0x38'))){_0x9df49d['limit']=qs['limit'](_0x52b25e['query']['limit']);_0x9df49d[_0x8934('0x1d')]=qs[_0x8934('0x1d')](_0x52b25e[_0x8934('0x32')][_0x8934('0x1d')]);}_0x9df49d[_0x8934('0x39')]=qs['sort'](_0x52b25e['query'][_0x8934('0x3a')]);_0x9df49d[_0x8934('0x3b')]=qs[_0x8934('0x33')](_[_0x8934('0x3c')](_0x52b25e[_0x8934('0x32')],_0x4faab2[_0x8934('0x33')]));_0x9df49d[_0x8934('0x3b')][_0x8934('0x5c')]=_0x2d8db7['id'];if(_0x52b25e[_0x8934('0x32')][_0x8934('0x3d')]){_0x9df49d[_0x8934('0x3b')]=_[_0x8934('0x3e')](_0x9df49d[_0x8934('0x3b')],{'$or':_[_0x8934('0x2c')](_0x9df49d[_0x8934('0x35')],function(_0x40a47a){var _0x5f29d4={};_0x5f29d4[_0x40a47a]={'$like':'%'+_0x52b25e['query'][_0x8934('0x3d')]+'%'};return _0x5f29d4;})});}_0x9df49d=_[_0x8934('0x3e')]({},_0x9df49d,_0x52b25e['options']);return db[_0x8934('0x5e')][_0x8934('0x40')]({'where':_0x9df49d[_0x8934('0x3b')]})[_0x8934('0x25')](function(_0x338111){_0x2becdf[_0x8934('0x40')]=_0x338111;if(_0x52b25e[_0x8934('0x32')]['includeAll']){_0x9df49d[_0x8934('0x41')]=[{'all':!![]}];}return db['CmHopperHistory'][_0x8934('0x42')](_0x9df49d);})[_0x8934('0x25')](function(_0xdd9bb3){_0x2becdf[_0x8934('0x43')]=_0xdd9bb3;return _0x2becdf;});}})['then'](respondWithFilteredResult(_0x4ef5eb,_0x9df49d))[_0x8934('0x44')](handleError(_0x4ef5eb,null));};exports['getHopperFinals']=function(_0x591eb7,_0x383431,_0x4038ff){var _0x596dbc={'raw':!![],'where':{}};var _0x48f719={};var _0x35bb13={'count':0x0,'rows':[]};return db['Campaign'][_0x8934('0x59')]({'where':{'id':_0x591eb7[_0x8934('0x45')]['id']}})[_0x8934('0x25')](handleEntityNotFound(_0x383431,null))[_0x8934('0x25')](function(_0x236e4a){if(_0x236e4a){_0x48f719[_0x8934('0x36')]=_['keys'](db[_0x8934('0x5f')][_0x8934('0x2d')]);_0x48f719['query']=_['keys'](_0x591eb7[_0x8934('0x32')]);_0x48f719[_0x8934('0x33')]=_[_0x8934('0x34')](_0x48f719['model'],_0x48f719['query']);_0x596dbc[_0x8934('0x35')]=_['intersection'](_0x48f719[_0x8934('0x36')],qs[_0x8934('0x37')](_0x591eb7[_0x8934('0x32')][_0x8934('0x37')]));_0x596dbc[_0x8934('0x35')]=_0x596dbc[_0x8934('0x35')][_0x8934('0x46')]?_0x596dbc[_0x8934('0x35')]:_0x48f719['model'];if(!_0x591eb7[_0x8934('0x32')][_0x8934('0x5b')]('nolimit')){_0x596dbc['limit']=qs[_0x8934('0x1e')](_0x591eb7['query'][_0x8934('0x1e')]);_0x596dbc[_0x8934('0x1d')]=qs['offset'](_0x591eb7[_0x8934('0x32')][_0x8934('0x1d')]);}_0x596dbc[_0x8934('0x39')]=qs[_0x8934('0x3a')](_0x591eb7['query'][_0x8934('0x3a')]);_0x596dbc[_0x8934('0x3b')]=qs[_0x8934('0x33')](_[_0x8934('0x3c')](_0x591eb7['query'],_0x48f719[_0x8934('0x33')]));_0x596dbc[_0x8934('0x3b')][_0x8934('0x5c')]=_0x236e4a['id'];if(_0x591eb7[_0x8934('0x32')][_0x8934('0x3d')]){_0x596dbc[_0x8934('0x3b')]=_['merge'](_0x596dbc[_0x8934('0x3b')],{'$or':_['map'](_0x596dbc[_0x8934('0x35')],function(_0x3b4a19){var _0x15dc51={};_0x15dc51[_0x3b4a19]={'$like':'%'+_0x591eb7['query'][_0x8934('0x3d')]+'%'};return _0x15dc51;})});}_0x596dbc=_[_0x8934('0x3e')]({},_0x596dbc,_0x591eb7[_0x8934('0x48')]);return db[_0x8934('0x5f')]['count']({'where':_0x596dbc[_0x8934('0x3b')]})[_0x8934('0x25')](function(_0x353822){_0x35bb13['count']=_0x353822;if(_0x591eb7['query']['includeAll']){_0x596dbc['include']=[{'all':!![]}];}return db[_0x8934('0x5f')][_0x8934('0x42')](_0x596dbc);})['then'](function(_0x5ac735){_0x35bb13['rows']=_0x5ac735;return _0x35bb13;});}})[_0x8934('0x25')](respondWithFilteredResult(_0x383431,_0x596dbc))[_0x8934('0x44')](handleError(_0x383431,null));};exports[_0x8934('0x60')]=function(_0x9d85d7,_0x35e7db,_0x31ef43){var _0x3cd86b={'raw':!![],'where':{}};var _0x41a3d5={};var _0x4c331d={'count':0x0,'rows':[]};return db[_0x8934('0x3f')]['findOne']({'where':{'id':_0x9d85d7[_0x8934('0x45')]['id']}})[_0x8934('0x25')](handleEntityNotFound(_0x35e7db,null))[_0x8934('0x25')](function(_0x39bbd7){if(_0x39bbd7){_0x41a3d5['model']=_[_0x8934('0x31')](db[_0x8934('0x61')][_0x8934('0x2d')]);_0x41a3d5[_0x8934('0x32')]=_[_0x8934('0x31')](_0x9d85d7['query']);_0x41a3d5[_0x8934('0x33')]=_[_0x8934('0x34')](_0x41a3d5[_0x8934('0x36')],_0x41a3d5[_0x8934('0x32')]);_0x3cd86b[_0x8934('0x35')]=_[_0x8934('0x34')](_0x41a3d5[_0x8934('0x36')],qs[_0x8934('0x37')](_0x9d85d7[_0x8934('0x32')]['fields']));_0x3cd86b[_0x8934('0x35')]=_0x3cd86b[_0x8934('0x35')][_0x8934('0x46')]?_0x3cd86b['attributes']:_0x41a3d5[_0x8934('0x36')];if(!_0x9d85d7[_0x8934('0x32')][_0x8934('0x5b')](_0x8934('0x38'))){_0x3cd86b[_0x8934('0x1e')]=qs[_0x8934('0x1e')](_0x9d85d7[_0x8934('0x32')][_0x8934('0x1e')]);_0x3cd86b['offset']=qs['offset'](_0x9d85d7[_0x8934('0x32')][_0x8934('0x1d')]);}_0x3cd86b['order']=qs['sort'](_0x9d85d7[_0x8934('0x32')][_0x8934('0x3a')]);_0x3cd86b[_0x8934('0x3b')]=qs[_0x8934('0x33')](_[_0x8934('0x3c')](_0x9d85d7[_0x8934('0x32')],_0x41a3d5['filters']));_0x3cd86b[_0x8934('0x3b')]['CampaignId']=_0x39bbd7['id'];if(_0x9d85d7[_0x8934('0x32')][_0x8934('0x3d')]){_0x3cd86b[_0x8934('0x3b')]=_[_0x8934('0x3e')](_0x3cd86b['where'],{'$or':_[_0x8934('0x2c')](_0x3cd86b[_0x8934('0x35')],function(_0xf6a0e9){var _0x233112={};_0x233112[_0xf6a0e9]={'$like':'%'+_0x9d85d7[_0x8934('0x32')][_0x8934('0x3d')]+'%'};return _0x233112;})});}_0x3cd86b=_['merge']({},_0x3cd86b,_0x9d85d7['options']);return db[_0x8934('0x61')]['count']({'where':_0x3cd86b['where']})[_0x8934('0x25')](function(_0x2617d1){_0x4c331d[_0x8934('0x40')]=_0x2617d1;if(_0x9d85d7[_0x8934('0x32')][_0x8934('0x47')]){_0x3cd86b['include']=[{'all':!![]}];}return db[_0x8934('0x61')][_0x8934('0x42')](_0x3cd86b);})['then'](function(_0x1e98b2){_0x4c331d[_0x8934('0x43')]=_0x1e98b2;return _0x4c331d;});}})[_0x8934('0x25')](respondWithFilteredResult(_0x35e7db,_0x3cd86b))[_0x8934('0x44')](handleError(_0x35e7db,null));};exports['getLists']=function(_0xdff48f,_0x522250,_0x47fb1b){var _0x72c2e5={};var _0x5749f3={};var _0x184a93;var _0xbcccb4;return db[_0x8934('0x3f')][_0x8934('0x59')]({'where':{'id':_0xdff48f[_0x8934('0x45')]['id']}})[_0x8934('0x25')](handleEntityNotFound(_0x522250,null))[_0x8934('0x25')](function(_0xa01149){if(_0xa01149){_0x184a93=_0xa01149;_0x5749f3[_0x8934('0x36')]=_[_0x8934('0x31')](db['CmList']['rawAttributes']);_0x5749f3[_0x8934('0x32')]=_[_0x8934('0x31')](_0xdff48f[_0x8934('0x32')]);_0x5749f3['filters']=_[_0x8934('0x34')](_0x5749f3['model'],_0x5749f3[_0x8934('0x32')]);_0x72c2e5['attributes']=_[_0x8934('0x34')](_0x5749f3['model'],qs['fields'](_0xdff48f['query'][_0x8934('0x37')]));_0x72c2e5[_0x8934('0x35')]=_0x72c2e5[_0x8934('0x35')]['length']?_0x72c2e5['attributes']:_0x5749f3[_0x8934('0x36')];_0x72c2e5[_0x8934('0x39')]=qs[_0x8934('0x3a')](_0xdff48f[_0x8934('0x32')]['sort']);_0x72c2e5[_0x8934('0x3b')]=qs[_0x8934('0x33')](_['pick'](_0xdff48f[_0x8934('0x32')],_0x5749f3[_0x8934('0x33')]));if(_0xdff48f['query'][_0x8934('0x3d')]){_0x72c2e5[_0x8934('0x3b')]=_['merge'](_0x72c2e5[_0x8934('0x3b')],{'$or':_['map'](_0x72c2e5[_0x8934('0x35')],function(_0x3c0a77){var _0x4e3f66={};_0x4e3f66[_0x3c0a77]={'$like':'%'+_0xdff48f[_0x8934('0x32')]['filter']+'%'};return _0x4e3f66;})});}_0x72c2e5=_['merge']({},_0x72c2e5,_0xdff48f[_0x8934('0x48')]);return _0x184a93[_0x8934('0x62')](_0x72c2e5);}})[_0x8934('0x25')](function(_0xa34882){if(_0xa34882){_0xbcccb4=_0xa34882[_0x8934('0x46')];if(!_0xdff48f[_0x8934('0x32')][_0x8934('0x5b')]('nolimit')){_0x72c2e5[_0x8934('0x1e')]=qs[_0x8934('0x1e')](_0xdff48f[_0x8934('0x32')]['limit']);_0x72c2e5[_0x8934('0x1d')]=qs[_0x8934('0x1d')](_0xdff48f['query'][_0x8934('0x1d')]);}return _0x184a93[_0x8934('0x62')](_0x72c2e5);}})[_0x8934('0x25')](function(_0x431f76){if(_0x431f76){return _0x431f76?{'count':_0xbcccb4,'rows':_0x431f76}:null;}})[_0x8934('0x25')](respondWithResult(_0x522250,null))['catch'](handleError(_0x522250,null));};exports[_0x8934('0x63')]=function(_0x448f95,_0x1f7557,_0x50e5cc){var _0x40d000,_0x1e0d72;var _0x3a71ac=[];var _0x23b88b=moment()[_0x8934('0x64')](_0x8934('0x65'));return db[_0x8934('0x3f')][_0x8934('0x49')]({'where':{'id':_0x448f95[_0x8934('0x45')]['id']}})[_0x8934('0x25')](handleEntityNotFound(_0x1f7557,null))[_0x8934('0x25')](function(_0x10fbe9){if(_0x10fbe9){_0x1e0d72=_0x10fbe9;return _0x10fbe9['addLists'](_0x448f95['body'][_0x8934('0x66')],_[_0x8934('0x52')](_0x448f95['body'],['ids','id'])||{});}return null;})[_0x8934('0x67')](function(_0x4a273b){var _0x3c25d7;var _0x3ab723;_0x40d000=_0x4a273b||[];var _0x232692=[];if(_0x4a273b){for(var _0x4ec685=0x0;_0x4ec685<_0x4a273b[_0x8934('0x46')];_0x4ec685+=0x1){var _0x31c9be=_0x4a273b[_0x4ec685][_0x8934('0x4d')]({'plain':!![]});_0x1e0d72['dialCheckDuplicateType']=_0x448f95['body'][_0x8934('0x68')]?_0x448f95[_0x8934('0x4b')][_0x8934('0x68')]:_0x1e0d72[_0x8934('0x68')];switch(_0x1e0d72[_0x8934('0x68')]){case _0x8934('0x69'):_0x3c25d7=squel[_0x8934('0x6a')]()[_0x8934('0x6b')](_0x8934('0x6c'))[_0x8934('0x6d')]([_0x8934('0x6e'),'scheduledAt','ContactId',_0x8934('0x6f'),_0x8934('0x5c'),'createdAt',_0x8934('0x54')],squel[_0x8934('0x70')]()[_0x8934('0x71')]('phone',_0x8934('0x6e'))[_0x8934('0x71')](_0x8934('0x72'),_0x8934('0x73'))[_0x8934('0x71')]('id','ContactId')['field'](_0x31c9be['CmListId'][_0x8934('0x74')](),'ListId')[_0x8934('0x71')](_0x448f95[_0x8934('0x45')]['id'][_0x8934('0x74')](),'CampaignId')[_0x8934('0x71')]('\x27'+_0x23b88b+'\x27','createdAt')[_0x8934('0x71')]('\x27'+_0x23b88b+'\x27',_0x8934('0x54'))['from'](_0x8934('0x75'))[_0x8934('0x3b')](_0x8934('0x76'))[_0x8934('0x3b')](_0x8934('0x77'),_0x31c9be['CmListId'][_0x8934('0x74')]())[_0x8934('0x3b')](_0x8934('0x78'))[_0x8934('0x3b')](_0x8934('0x79'),squel[_0x8934('0x70')]()[_0x8934('0x71')](_0x8934('0x7a'))[_0x8934('0x7b')](_0x8934('0x7c'))[_0x8934('0x3b')](_0x8934('0x7d'),_0x448f95[_0x8934('0x45')]['id'][_0x8934('0x74')]()))[_0x8934('0x3b')](_0x8934('0x79'),squel[_0x8934('0x70')]()[_0x8934('0x71')](_0x8934('0x7e'))[_0x8934('0x7b')](_0x8934('0x6c'))[_0x8934('0x3b')](_0x8934('0x7d'),_0x448f95[_0x8934('0x45')]['id']['toString']())))[_0x8934('0x74')]();break;case'onlyIfOpen':_0x3c25d7=squel[_0x8934('0x6a')]()['into'](_0x8934('0x6c'))[_0x8934('0x6d')](['phone',_0x8934('0x73'),_0x8934('0x7f'),'ListId',_0x8934('0x5c'),'createdAt',_0x8934('0x54')],squel[_0x8934('0x70')]()[_0x8934('0x71')](_0x8934('0x6e'),_0x8934('0x6e'))['field'](_0x8934('0x72'),'scheduledAt')[_0x8934('0x71')]('id','ContactId')[_0x8934('0x71')](_0x31c9be[_0x8934('0x80')][_0x8934('0x74')](),_0x8934('0x6f'))[_0x8934('0x71')](_0x448f95[_0x8934('0x45')]['id'][_0x8934('0x74')](),'CampaignId')[_0x8934('0x71')]('\x27'+_0x23b88b+'\x27',_0x8934('0x53'))['field']('\x27'+_0x23b88b+'\x27',_0x8934('0x54'))[_0x8934('0x7b')](_0x8934('0x75'))['where'](_0x8934('0x76'))[_0x8934('0x3b')]('ListId\x20=\x20?',_0x31c9be[_0x8934('0x80')][_0x8934('0x74')]())[_0x8934('0x3b')](_0x8934('0x78'))[_0x8934('0x3b')](_0x8934('0x79'),squel[_0x8934('0x70')]()['field']('COALESCE(phone,\x27\x27)')[_0x8934('0x7b')](_0x8934('0x6c'))[_0x8934('0x3b')](_0x8934('0x7d'),_0x448f95[_0x8934('0x45')]['id'][_0x8934('0x74')]())))[_0x8934('0x74')]();break;default:_0x3c25d7=squel[_0x8934('0x6a')]()[_0x8934('0x6b')](_0x8934('0x6c'))[_0x8934('0x6d')](['phone','scheduledAt','ContactId','ListId',_0x8934('0x5c'),'createdAt',_0x8934('0x54')],squel[_0x8934('0x70')]()[_0x8934('0x71')]('phone','phone')['field'](_0x8934('0x72'),'scheduledAt')[_0x8934('0x71')]('id','ContactId')[_0x8934('0x71')](_0x31c9be[_0x8934('0x80')][_0x8934('0x74')](),'ListId')['field'](_0x448f95[_0x8934('0x45')]['id'][_0x8934('0x74')](),_0x8934('0x5c'))['field']('\x27'+_0x23b88b+'\x27',_0x8934('0x53'))[_0x8934('0x71')]('\x27'+_0x23b88b+'\x27',_0x8934('0x54'))[_0x8934('0x7b')](_0x8934('0x75'))[_0x8934('0x3b')]('deletedAt\x20IS\x20NULL')['where'](_0x8934('0x77'),_0x31c9be[_0x8934('0x80')][_0x8934('0x74')]())[_0x8934('0x3b')](_0x8934('0x78')))[_0x8934('0x74')]();}_0x3ab723=squel['insert']()['into'](_0x8934('0x81'))[_0x8934('0x6d')]([_0x8934('0x82'),_0x8934('0x73'),'phone',_0x8934('0x83'),_0x8934('0x53'),_0x8934('0x54')],squel[_0x8934('0x70')]()[_0x8934('0x71')](_0x8934('0x84'),'id')[_0x8934('0x71')]('NOW()','scheduledAt')['field'](_0x8934('0x85'),_0x8934('0x6e'))[_0x8934('0x71')](_0x8934('0x86'),_0x8934('0x83'))[_0x8934('0x71')]('\x27'+_0x23b88b+'\x27',_0x8934('0x53'))[_0x8934('0x71')]('\x27'+_0x23b88b+'\x27',_0x8934('0x54'))[_0x8934('0x7b')](_0x8934('0x87'),'ci')[_0x8934('0x88')](_0x8934('0x6c'),'h',_0x8934('0x89'))[_0x8934('0x3b')]('h.ListId\x20=\x20?',_0x31c9be[_0x8934('0x80')][_0x8934('0x74')]())['where'](_0x8934('0x8a'),_0x448f95[_0x8934('0x45')]['id'][_0x8934('0x74')]())[_0x8934('0x3b')](_0x8934('0x8b'),_0x23b88b))['toString']();_0x232692['push'](db[_0x8934('0x8c')][_0x8934('0x32')](_0x3c25d7));_0x3a71ac['push'](db[_0x8934('0x8c')][_0x8934('0x32')](_0x3ab723));}return BPromise[_0x8934('0x8d')](_0x232692);}})[_0x8934('0x25')](function(){return BPromise['all'](_0x3a71ac);})[_0x8934('0x25')](function(){return _0x40d000;})['then'](respondWithResult(_0x1f7557,null))[_0x8934('0x44')](handleError(_0x1f7557,null));};exports['removeLists']=function(_0xa2a42c,_0x12130c,_0x29a326){return db[_0x8934('0x3f')][_0x8934('0x49')]({'where':{'id':_0xa2a42c[_0x8934('0x45')]['id']}})['then'](handleEntityNotFound(_0x12130c,null))[_0x8934('0x25')](function(_0x4a6685){if(_0x4a6685){return _0x4a6685[_0x8934('0x8e')](_0xa2a42c['query'][_0x8934('0x66')]);}})[_0x8934('0x25')](function(_0x5990b7){if(_0x5990b7){return db[_0x8934('0x5a')][_0x8934('0x26')]({'where':{'ListId':_0xa2a42c[_0x8934('0x32')][_0x8934('0x66')],'CampaignId':_0xa2a42c['params']['id']}})[_0x8934('0x25')](function(){return _0x5990b7;});}})[_0x8934('0x25')](respondWithStatusCode(_0x12130c,null))[_0x8934('0x44')](handleError(_0x12130c,null));};exports[_0x8934('0x8f')]=function(_0x51fbff,_0x186728,_0xfc3936){var _0x39a190={};var _0x440f69={};var _0x1da779;var _0x143d48;return db[_0x8934('0x3f')][_0x8934('0x59')]({'where':{'id':_0x51fbff[_0x8934('0x45')]['id']}})[_0x8934('0x25')](handleEntityNotFound(_0x186728,null))[_0x8934('0x25')](function(_0x3062b7){if(_0x3062b7){_0x1da779=_0x3062b7;_0x440f69[_0x8934('0x36')]=_[_0x8934('0x31')](db[_0x8934('0x90')]['rawAttributes']);_0x440f69[_0x8934('0x32')]=_[_0x8934('0x31')](_0x51fbff[_0x8934('0x32')]);_0x440f69[_0x8934('0x33')]=_[_0x8934('0x34')](_0x440f69[_0x8934('0x36')],_0x440f69[_0x8934('0x32')]);_0x39a190['attributes']=_[_0x8934('0x34')](_0x440f69['model'],qs[_0x8934('0x37')](_0x51fbff['query'][_0x8934('0x37')]));_0x39a190[_0x8934('0x35')]=_0x39a190[_0x8934('0x35')][_0x8934('0x46')]?_0x39a190[_0x8934('0x35')]:_0x440f69[_0x8934('0x36')];_0x39a190[_0x8934('0x39')]=qs[_0x8934('0x3a')](_0x51fbff['query'][_0x8934('0x3a')]);_0x39a190[_0x8934('0x3b')]=qs[_0x8934('0x33')](_['pick'](_0x51fbff[_0x8934('0x32')],_0x440f69[_0x8934('0x33')]));if(_0x51fbff[_0x8934('0x32')][_0x8934('0x3d')]){_0x39a190['where']=_[_0x8934('0x3e')](_0x39a190[_0x8934('0x3b')],{'$or':_[_0x8934('0x2c')](_0x39a190[_0x8934('0x35')],function(_0x37612d){var _0x30dc4f={};_0x30dc4f[_0x37612d]={'$like':'%'+_0x51fbff[_0x8934('0x32')][_0x8934('0x3d')]+'%'};return _0x30dc4f;})});}_0x39a190=_[_0x8934('0x3e')]({},_0x39a190,_0x51fbff[_0x8934('0x48')]);return _0x1da779['getBlackLists'](_0x39a190);}})['then'](function(_0x2cfe32){if(_0x2cfe32){_0x143d48=_0x2cfe32[_0x8934('0x46')];if(!_0x51fbff[_0x8934('0x32')][_0x8934('0x5b')](_0x8934('0x38'))){_0x39a190[_0x8934('0x1e')]=qs[_0x8934('0x1e')](_0x51fbff[_0x8934('0x32')][_0x8934('0x1e')]);_0x39a190['offset']=qs['offset'](_0x51fbff[_0x8934('0x32')][_0x8934('0x1d')]);}return _0x1da779['getBlackLists'](_0x39a190);}})['then'](function(_0x1a3864){if(_0x1a3864){return _0x1a3864?{'count':_0x143d48,'rows':_0x1a3864}:null;}})[_0x8934('0x25')](respondWithResult(_0x186728,null))[_0x8934('0x44')](handleError(_0x186728,null));};exports[_0x8934('0x91')]=function(_0x1b64a5,_0x12dc2d,_0x5ef6a2){var _0x31d550,_0x3e493f;var _0xaaaf57=[];var _0x581ab5=moment()[_0x8934('0x64')](_0x8934('0x65'));return db[_0x8934('0x3f')][_0x8934('0x49')]({'where':{'id':_0x1b64a5[_0x8934('0x45')]['id']}})[_0x8934('0x25')](handleEntityNotFound(_0x12dc2d,null))[_0x8934('0x25')](function(_0x4927ab){if(_0x4927ab){_0x3e493f=_0x4927ab;return _0x4927ab[_0x8934('0x91')](_0x1b64a5[_0x8934('0x4b')][_0x8934('0x66')],_['omit'](_0x1b64a5['body'],[_0x8934('0x66'),'id'])||{});}return null;})['spread'](function(_0x4ec8a1){var _0x34511b;var _0x597864;_0x31d550=_0x4ec8a1||[];var _0x19af38=[];if(_0x4ec8a1){for(var _0x3bb2c4=0x0;_0x3bb2c4<_0x4ec8a1[_0x8934('0x46')];_0x3bb2c4+=0x1){var _0x4195f1=_0x4ec8a1[_0x3bb2c4][_0x8934('0x4d')]({'plain':!![]});_0x34511b=squel[_0x8934('0x6a')]()[_0x8934('0x6b')](_0x8934('0x92'))[_0x8934('0x6d')]([_0x8934('0x6e'),_0x8934('0x7f'),_0x8934('0x6f'),_0x8934('0x5c'),_0x8934('0x53'),_0x8934('0x54')],squel[_0x8934('0x70')]()[_0x8934('0x71')]('phone','phone')[_0x8934('0x71')]('id',_0x8934('0x7f'))[_0x8934('0x71')](_0x4195f1[_0x8934('0x80')]['toString'](),_0x8934('0x6f'))[_0x8934('0x71')](_0x1b64a5['params']['id'][_0x8934('0x74')](),_0x8934('0x5c'))[_0x8934('0x71')](_0x8934('0x72'),_0x8934('0x53'))[_0x8934('0x71')](_0x8934('0x72'),_0x8934('0x54'))[_0x8934('0x7b')](_0x8934('0x75'))['where'](_0x8934('0x76'))['where'](_0x8934('0x77'),_0x4195f1[_0x8934('0x80')][_0x8934('0x74')]())[_0x8934('0x3b')](_0x8934('0x78')))[_0x8934('0x74')]();_0x19af38['push'](db[_0x8934('0x8c')][_0x8934('0x32')](_0x34511b));}return BPromise[_0x8934('0x8d')](_0x19af38);}})['then'](function(){return _0x31d550;})[_0x8934('0x25')](respondWithResult(_0x12dc2d,null))[_0x8934('0x44')](handleError(_0x12dc2d,null));};exports['removeBlackLists']=function(_0x2b235b,_0x2d4161,_0xb26e6a){return db[_0x8934('0x3f')]['find']({'where':{'id':_0x2b235b[_0x8934('0x45')]['id']}})[_0x8934('0x25')](handleEntityNotFound(_0x2d4161,null))[_0x8934('0x25')](function(_0x1410cf){if(_0x1410cf){return _0x1410cf[_0x8934('0x93')](_0x2b235b[_0x8934('0x32')][_0x8934('0x66')]);}})[_0x8934('0x25')](function(_0x58b327){if(_0x58b327){return db['CmHopperBlack'][_0x8934('0x26')]({'where':{'ListId':_0x2b235b[_0x8934('0x32')][_0x8934('0x66')],'CampaignId':_0x2b235b[_0x8934('0x45')]['id']}})[_0x8934('0x25')](function(){return _0x58b327;});}})['then'](respondWithStatusCode(_0x2d4161,null))['catch'](handleError(_0x2d4161,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index a069247..1ece324 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(_0x3daf63,_0x25528a){var _0x558174=function(_0x40756c){while(--_0x40756c){_0x3daf63['push'](_0x3daf63['shift']());}};_0x558174(++_0x25528a);}(_0x7a54,0x106));var _0x47a5=function(_0x334f2b,_0x44676d){_0x334f2b=_0x334f2b-0x0;var _0x42fe28=_0x7a54[_0x334f2b];return _0x42fe28;};'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(_0x55ed76,_0x55d575){var _0x212c9b=function(_0x305179){while(--_0x305179){_0x55ed76['push'](_0x55ed76['shift']());}};_0x212c9b(++_0x55d575);}(_0x7a54,0x106));var _0x47a5=function(_0x3a9eea,_0x5d6e1a){_0x3a9eea=_0x3a9eea-0x0;var _0x232f2c=_0x7a54[_0x3a9eea];return _0x232f2c;};'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 ee79c7b..48eba04 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 _0xe79f=['attributes','limit','map','include','model','stringify','lodash','moment','randomstring','../../config/logger','rpc','../../config/environment','http','request','then','Campaign,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','GetCampaign','Campaign','findAll','options','raw'];(function(_0x59c5e8,_0x482de4){var _0x220a95=function(_0x52c439){while(--_0x52c439){_0x59c5e8['push'](_0x59c5e8['shift']());}};_0x220a95(++_0x482de4);}(_0xe79f,0x13a));var _0xfe79=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe79f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xfe79('0x0'));var util=require('util');var moment=require(_0xfe79('0x1'));var BPromise=require('bluebird');var rs=require(_0xfe79('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xfe79('0x3'))(_0xfe79('0x4'));var config=require(_0xfe79('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0xfe79('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x3c06b8,_0x4f38e4,_0x417a59){return new BPromise(function(_0x2411bd,_0x5ee81d){return client[_0xfe79('0x7')](_0x3c06b8,_0x417a59)[_0xfe79('0x8')](function(_0x548509){logger['info'](_0xfe79('0x9'),_0x4f38e4,_0xfe79('0xa'));logger[_0xfe79('0xb')]('Campaign,\x20%s,\x20%s,\x20%s',_0x4f38e4,'request\x20sent',JSON['stringify'](_0x548509));if(_0x548509[_0xfe79('0xc')]){if(_0x548509['error'][_0xfe79('0xd')]===0x1f4){logger[_0xfe79('0xc')](_0xfe79('0x9'),_0x4f38e4,_0x548509[_0xfe79('0xc')]['message']);return _0x5ee81d(_0x548509[_0xfe79('0xc')][_0xfe79('0xe')]);}logger[_0xfe79('0xc')](_0xfe79('0x9'),_0x4f38e4,_0x548509[_0xfe79('0xc')]['message']);return _0x2411bd(_0x548509[_0xfe79('0xc')][_0xfe79('0xe')]);}else{logger[_0xfe79('0xf')](_0xfe79('0x9'),_0x4f38e4,_0xfe79('0xa'));_0x2411bd(_0x548509[_0xfe79('0x10')]['message']);}})['catch'](function(_0x43c1cb){logger['error']('Campaign,\x20%s,\x20%s',_0x4f38e4,_0x43c1cb);_0x5ee81d(_0x43c1cb);});});}exports[_0xfe79('0x11')]=function(_0x16ae70){var _0x517250=this;return new Promise(function(_0x5bd2d5,_0x193230){return db[_0xfe79('0x12')][_0xfe79('0x13')]({'raw':_0x16ae70[_0xfe79('0x14')]?_0x16ae70[_0xfe79('0x14')][_0xfe79('0x15')]===undefined?!![]:![]:!![],'where':_0x16ae70[_0xfe79('0x14')]?_0x16ae70[_0xfe79('0x14')]['where']||null:null,'attributes':_0x16ae70[_0xfe79('0x14')]?_0x16ae70[_0xfe79('0x14')][_0xfe79('0x16')]||null:null,'limit':_0x16ae70[_0xfe79('0x14')]?_0x16ae70[_0xfe79('0x14')][_0xfe79('0x17')]||null:null,'include':_0x16ae70[_0xfe79('0x14')]?_0x16ae70[_0xfe79('0x14')]['include']?_[_0xfe79('0x18')](_0x16ae70[_0xfe79('0x14')][_0xfe79('0x19')],function(_0x1e8731){return{'model':db[_0x1e8731[_0xfe79('0x1a')]],'as':_0x1e8731['as'],'attributes':_0x1e8731['attributes'],'include':_0x1e8731['include']?_['map'](_0x1e8731[_0xfe79('0x19')],function(_0x10138a){return{'model':db[_0x10138a[_0xfe79('0x1a')]],'as':_0x10138a['as'],'attributes':_0x10138a[_0xfe79('0x16')],'include':_0x10138a[_0xfe79('0x19')]?_['map'](_0x10138a[_0xfe79('0x19')],function(_0x265f8d){return{'model':db[_0x265f8d['model']],'as':_0x265f8d['as'],'attributes':_0x265f8d[_0xfe79('0x16')]};}):[]};}):[]};}):[]:[]})[_0xfe79('0x8')](function(_0x5cbfa6){logger[_0xfe79('0xf')](_0xfe79('0x11'),_0x16ae70);logger[_0xfe79('0xb')](_0xfe79('0x11'),_0x16ae70,JSON[_0xfe79('0x1b')](_0x5cbfa6));_0x5bd2d5(_0x5cbfa6);})['catch'](function(_0x221564){logger[_0xfe79('0xc')](_0xfe79('0x11'),_0x221564[_0xfe79('0xe')],_0x16ae70);_0x193230(_0x517250[_0xfe79('0xc')](0x1f4,_0x221564[_0xfe79('0xe')]));});});}; \ No newline at end of file +var _0xbb53=['options','raw','where','attributes','limit','include','map','model','debug','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','then','info','request\x20sent','stringify','error','message','Campaign,\x20%s,\x20%s','result','GetCampaign'];(function(_0x1a7846,_0x59723e){var _0x48049=function(_0x203ff6){while(--_0x203ff6){_0x1a7846['push'](_0x1a7846['shift']());}};_0x48049(++_0x59723e);}(_0xbb53,0x121));var _0x3bb5=function(_0x47a14b,_0x4c0796){_0x47a14b=_0x47a14b-0x0;var _0x3bc536=_0xbb53[_0x47a14b];return _0x3bc536;};'use strict';var _=require(_0x3bb5('0x0'));var util=require(_0x3bb5('0x1'));var moment=require(_0x3bb5('0x2'));var BPromise=require(_0x3bb5('0x3'));var rs=require(_0x3bb5('0x4'));var fs=require('fs');var Redis=require(_0x3bb5('0x5'));var db=require(_0x3bb5('0x6'))['db'];var utils=require(_0x3bb5('0x7'));var logger=require(_0x3bb5('0x8'))(_0x3bb5('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3bb5('0xa')][_0x3bb5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x28aa7d,_0x157e04,_0x22f92f){return new BPromise(function(_0x480f9c,_0x5a4ae3){return client['request'](_0x28aa7d,_0x22f92f)[_0x3bb5('0xc')](function(_0x2e0cfa){logger[_0x3bb5('0xd')]('Campaign,\x20%s,\x20%s',_0x157e04,_0x3bb5('0xe'));logger['debug']('Campaign,\x20%s,\x20%s,\x20%s',_0x157e04,_0x3bb5('0xe'),JSON[_0x3bb5('0xf')](_0x2e0cfa));if(_0x2e0cfa['error']){if(_0x2e0cfa[_0x3bb5('0x10')]['code']===0x1f4){logger[_0x3bb5('0x10')]('Campaign,\x20%s,\x20%s',_0x157e04,_0x2e0cfa['error'][_0x3bb5('0x11')]);return _0x5a4ae3(_0x2e0cfa[_0x3bb5('0x10')][_0x3bb5('0x11')]);}logger['error'](_0x3bb5('0x12'),_0x157e04,_0x2e0cfa[_0x3bb5('0x10')]['message']);return _0x480f9c(_0x2e0cfa[_0x3bb5('0x10')][_0x3bb5('0x11')]);}else{logger['info']('Campaign,\x20%s,\x20%s',_0x157e04,'request\x20sent');_0x480f9c(_0x2e0cfa[_0x3bb5('0x13')][_0x3bb5('0x11')]);}})['catch'](function(_0x25d774){logger[_0x3bb5('0x10')](_0x3bb5('0x12'),_0x157e04,_0x25d774);_0x5a4ae3(_0x25d774);});});}exports[_0x3bb5('0x14')]=function(_0x48bc25){var _0x13cb3a=this;return new Promise(function(_0x1109d0,_0x289177){return db['Campaign']['findAll']({'raw':_0x48bc25[_0x3bb5('0x15')]?_0x48bc25[_0x3bb5('0x15')][_0x3bb5('0x16')]===undefined?!![]:![]:!![],'where':_0x48bc25['options']?_0x48bc25[_0x3bb5('0x15')][_0x3bb5('0x17')]||null:null,'attributes':_0x48bc25[_0x3bb5('0x15')]?_0x48bc25[_0x3bb5('0x15')][_0x3bb5('0x18')]||null:null,'limit':_0x48bc25[_0x3bb5('0x15')]?_0x48bc25['options'][_0x3bb5('0x19')]||null:null,'include':_0x48bc25[_0x3bb5('0x15')]?_0x48bc25[_0x3bb5('0x15')][_0x3bb5('0x1a')]?_[_0x3bb5('0x1b')](_0x48bc25[_0x3bb5('0x15')][_0x3bb5('0x1a')],function(_0x58c10f){return{'model':db[_0x58c10f[_0x3bb5('0x1c')]],'as':_0x58c10f['as'],'attributes':_0x58c10f[_0x3bb5('0x18')],'include':_0x58c10f['include']?_['map'](_0x58c10f[_0x3bb5('0x1a')],function(_0x36cfda){return{'model':db[_0x36cfda['model']],'as':_0x36cfda['as'],'attributes':_0x36cfda['attributes'],'include':_0x36cfda[_0x3bb5('0x1a')]?_[_0x3bb5('0x1b')](_0x36cfda[_0x3bb5('0x1a')],function(_0xc1c149){return{'model':db[_0xc1c149['model']],'as':_0xc1c149['as'],'attributes':_0xc1c149['attributes']};}):[]};}):[]};}):[]:[]})[_0x3bb5('0xc')](function(_0x4e8c65){logger[_0x3bb5('0xd')](_0x3bb5('0x14'),_0x48bc25);logger[_0x3bb5('0x1d')]('GetCampaign',_0x48bc25,JSON['stringify'](_0x4e8c65));_0x1109d0(_0x4e8c65);})[_0x3bb5('0x1e')](function(_0x39f1ad){logger[_0x3bb5('0x10')](_0x3bb5('0x14'),_0x39f1ad[_0x3bb5('0x11')],_0x48bc25);_0x289177(_0x13cb3a[_0x3bb5('0x10')](0x1f4,_0x39f1ad[_0x3bb5('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index 7cac288..10b825e 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 _0x4ce6=['getHopperBlacks','getLists','/:id/blacklists','getBlackLists','post','clone','/:id/lists','addLists','addBlackLists','put','/:id','update','delete','destroy','removeLists','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./campaign.controller','get','isAuthenticated','show','/:id/hoppers','/:id/hopper_histories','getHopperHistories','getHopperFinals','/:id/hopper_black'];(function(_0x2d4a41,_0x14e299){var _0x5029d0=function(_0x4d0c4d){while(--_0x4d0c4d){_0x2d4a41['push'](_0x2d4a41['shift']());}};_0x5029d0(++_0x14e299);}(_0x4ce6,0x15a));var _0x64ce=function(_0x2ec2bf,_0x64e983){_0x2ec2bf=_0x2ec2bf-0x0;var _0x2c279c=_0x4ce6[_0x2ec2bf];return _0x2c279c;};'use strict';var multer=require(_0x64ce('0x0'));var util=require(_0x64ce('0x1'));var path=require(_0x64ce('0x2'));var timeout=require(_0x64ce('0x3'));var express=require(_0x64ce('0x4'));var router=express['Router']();var fs_extra=require(_0x64ce('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x64ce('0x6'));var config=require(_0x64ce('0x7'));var controller=require(_0x64ce('0x8'));router[_0x64ce('0x9')]('/',auth[_0x64ce('0xa')](),controller['index']);router[_0x64ce('0x9')]('/:id',auth[_0x64ce('0xa')](),controller[_0x64ce('0xb')]);router[_0x64ce('0x9')](_0x64ce('0xc'),auth['isAuthenticated'](),controller['getHoppers']);router[_0x64ce('0x9')](_0x64ce('0xd'),auth['isAuthenticated'](),controller[_0x64ce('0xe')]);router[_0x64ce('0x9')]('/:id/hopper_finals',auth[_0x64ce('0xa')](),controller[_0x64ce('0xf')]);router['get'](_0x64ce('0x10'),auth[_0x64ce('0xa')](),controller[_0x64ce('0x11')]);router['get']('/:id/lists',auth[_0x64ce('0xa')](),controller[_0x64ce('0x12')]);router[_0x64ce('0x9')](_0x64ce('0x13'),auth[_0x64ce('0xa')](),controller[_0x64ce('0x14')]);router['post']('/',auth[_0x64ce('0xa')](),controller['create']);router[_0x64ce('0x15')]('/:id/clone',auth[_0x64ce('0xa')](),controller[_0x64ce('0x16')]);router[_0x64ce('0x15')](_0x64ce('0x17'),auth[_0x64ce('0xa')](),controller[_0x64ce('0x18')]);router['post'](_0x64ce('0x13'),auth[_0x64ce('0xa')](),controller[_0x64ce('0x19')]);router[_0x64ce('0x1a')](_0x64ce('0x1b'),auth[_0x64ce('0xa')](),controller[_0x64ce('0x1c')]);router[_0x64ce('0x1d')](_0x64ce('0x1b'),auth[_0x64ce('0xa')](),controller[_0x64ce('0x1e')]);router['delete']('/:id/lists',auth[_0x64ce('0xa')](),controller[_0x64ce('0x1f')]);router['delete']('/:id/blacklists',auth[_0x64ce('0xa')](),controller['removeBlackLists']);module[_0x64ce('0x20')]=router; \ No newline at end of file +var _0xa19c=['/:id/lists','getLists','/:id/blacklists','getBlackLists','post','create','/:id/clone','clone','addBlackLists','put','update','delete','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./campaign.controller','get','isAuthenticated','index','/:id','show','/:id/hoppers','getHoppers','getHopperHistories','/:id/hopper_finals','/:id/hopper_black','getHopperBlacks'];(function(_0x6892b7,_0x3426ca){var _0x1fe6d3=function(_0x45c564){while(--_0x45c564){_0x6892b7['push'](_0x6892b7['shift']());}};_0x1fe6d3(++_0x3426ca);}(_0xa19c,0x114));var _0xca19=function(_0x2a8161,_0x1779b1){_0x2a8161=_0x2a8161-0x0;var _0x20de3f=_0xa19c[_0x2a8161];return _0x20de3f;};'use strict';var multer=require(_0xca19('0x0'));var util=require(_0xca19('0x1'));var path=require('path');var timeout=require(_0xca19('0x2'));var express=require(_0xca19('0x3'));var router=express[_0xca19('0x4')]();var fs_extra=require(_0xca19('0x5'));var auth=require(_0xca19('0x6'));var interaction=require(_0xca19('0x7'));var config=require(_0xca19('0x8'));var controller=require(_0xca19('0x9'));router[_0xca19('0xa')]('/',auth[_0xca19('0xb')](),controller[_0xca19('0xc')]);router[_0xca19('0xa')](_0xca19('0xd'),auth[_0xca19('0xb')](),controller[_0xca19('0xe')]);router['get'](_0xca19('0xf'),auth[_0xca19('0xb')](),controller[_0xca19('0x10')]);router[_0xca19('0xa')]('/:id/hopper_histories',auth['isAuthenticated'](),controller[_0xca19('0x11')]);router['get'](_0xca19('0x12'),auth[_0xca19('0xb')](),controller['getHopperFinals']);router[_0xca19('0xa')](_0xca19('0x13'),auth[_0xca19('0xb')](),controller[_0xca19('0x14')]);router[_0xca19('0xa')](_0xca19('0x15'),auth[_0xca19('0xb')](),controller[_0xca19('0x16')]);router[_0xca19('0xa')](_0xca19('0x17'),auth[_0xca19('0xb')](),controller[_0xca19('0x18')]);router[_0xca19('0x19')]('/',auth[_0xca19('0xb')](),controller[_0xca19('0x1a')]);router[_0xca19('0x19')](_0xca19('0x1b'),auth[_0xca19('0xb')](),controller[_0xca19('0x1c')]);router[_0xca19('0x19')](_0xca19('0x15'),auth[_0xca19('0xb')](),controller['addLists']);router[_0xca19('0x19')]('/:id/blacklists',auth[_0xca19('0xb')](),controller[_0xca19('0x1d')]);router[_0xca19('0x1e')](_0xca19('0xd'),auth[_0xca19('0xb')](),controller[_0xca19('0x1f')]);router[_0xca19('0x20')]('/:id',auth[_0xca19('0xb')](),controller['destroy']);router[_0xca19('0x20')](_0xca19('0x15'),auth['isAuthenticated'](),controller['removeLists']);router[_0xca19('0x20')](_0xca19('0x17'),auth[_0xca19('0xb')](),controller['removeBlackLists']);module['exports']=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index 1291cb0..434609e 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 _0x5c0e=['STRING','VIRTUAL','getDataValue','key','sequelize','exports','TEXT'];(function(_0x5d23be,_0x3b4f3c){var _0x4d60a9=function(_0x57dce7){while(--_0x57dce7){_0x5d23be['push'](_0x5d23be['shift']());}};_0x4d60a9(++_0x3b4f3c);}(_0x5c0e,0xba));var _0xe5c0=function(_0x1d2bc8,_0x2860bc){_0x1d2bc8=_0x1d2bc8-0x0;var _0x1857e1=_0x5c0e[_0x1d2bc8];return _0x1857e1;};'use strict';var Sequelize=require(_0xe5c0('0x0'));module[_0xe5c0('0x1')]={'key':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize[_0xe5c0('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xe5c0('0x3')]},'name':{'type':Sequelize[_0xe5c0('0x4')],'get':function(){return this[_0xe5c0('0x5')](_0xe5c0('0x6'));}}}; \ No newline at end of file +var _0xd1a8=['VIRTUAL','TEXT','STRING'];(function(_0x56c2d5,_0x3908fe){var _0x2e2133=function(_0x5d94e9){while(--_0x5d94e9){_0x56c2d5['push'](_0x56c2d5['shift']());}};_0x2e2133(++_0x3908fe);}(_0xd1a8,0x130));var _0x8d1a=function(_0x3bf637,_0x25bde8){_0x3bf637=_0x3bf637-0x0;var _0x52d8cb=_0xd1a8[_0x3bf637];return _0x52d8cb;};'use strict';var Sequelize=require('sequelize');module['exports']={'key':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize[_0x8d1a('0x0')],'allowNull':![]},'description':{'type':Sequelize[_0x8d1a('0x1')]},'name':{'type':Sequelize[_0x8d1a('0x2')],'get':function(){return this['getDataValue']('key');}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index d1237dd..f21048b 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 _0xddd2=['create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','request-promise','moment','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','offset','undefined','limit','count','status','set','Content-Range','json','apply','save','update','then','destroy','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','CannedAnswer','include','findAll','rows','catch','show','params','keys','find','body'];(function(_0x49f920,_0x558dec){var _0xd3a373=function(_0xd04057){while(--_0xd04057){_0x49f920['push'](_0x49f920['shift']());}};_0xd3a373(++_0x558dec);}(_0xddd2,0x1cd));var _0x2ddd=function(_0x4dda8e,_0xe91ab7){_0x4dda8e=_0x4dda8e-0x0;var _0x1563c7=_0xddd2[_0x4dda8e];return _0x1563c7;};'use strict';var emlformat=require(_0x2ddd('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x2ddd('0x1'));var moment=require(_0x2ddd('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x2ddd('0x3'));var util=require(_0x2ddd('0x4'));var path=require(_0x2ddd('0x5'));var sox=require(_0x2ddd('0x6'));var csv=require(_0x2ddd('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2ddd('0x8'));var squel=require(_0x2ddd('0x9'));var crypto=require(_0x2ddd('0xa'));var jsforce=require(_0x2ddd('0xb'));var deskjs=require(_0x2ddd('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2ddd('0xd'));var Redis=require(_0x2ddd('0xe'));var authService=require(_0x2ddd('0xf'));var qs=require(_0x2ddd('0x10'));var as=require(_0x2ddd('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2ddd('0x12'))(_0x2ddd('0x13'));var utils=require(_0x2ddd('0x14'));var config=require(_0x2ddd('0x15'));var licenseUtil=require(_0x2ddd('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x476007,_0x371820){_0x371820=_0x371820||0xcc;return function(_0x1a16dc){if(_0x1a16dc){return _0x476007[_0x2ddd('0x17')](_0x371820);}return _0x476007['status'](_0x371820)[_0x2ddd('0x18')]();};}function respondWithResult(_0x1cf62d,_0x26a09f){_0x26a09f=_0x26a09f||0xc8;return function(_0x49b10e){if(_0x49b10e){return _0x1cf62d['status'](_0x26a09f)['json'](_0x49b10e);}};}function respondWithFilteredResult(_0x56898e,_0x5aab8c){return function(_0xdceaac){if(_0xdceaac){var _0x387be8=typeof _0x5aab8c[_0x2ddd('0x19')]===_0x2ddd('0x1a')&&typeof _0x5aab8c[_0x2ddd('0x1b')]===_0x2ddd('0x1a');var _0x5136f1=_0xdceaac['count'];var _0x4d5137=_0x387be8?0x0:_0x5aab8c[_0x2ddd('0x19')];var _0x2b5753=_0x387be8?_0xdceaac[_0x2ddd('0x1c')]:_0x5aab8c[_0x2ddd('0x19')]+_0x5aab8c[_0x2ddd('0x1b')];var _0x161f8f;if(_0x2b5753>=_0x5136f1){_0x2b5753=_0x5136f1;_0x161f8f=0xc8;}else{_0x161f8f=0xce;}_0x56898e[_0x2ddd('0x1d')](_0x161f8f);return _0x56898e[_0x2ddd('0x1e')](_0x2ddd('0x1f'),_0x4d5137+'-'+_0x2b5753+'/'+_0x5136f1)[_0x2ddd('0x20')](_0xdceaac);}return null;};}function patchUpdates(_0x3c599f){return function(_0x451563){try{jsonpatch[_0x2ddd('0x21')](_0x451563,_0x3c599f,!![]);}catch(_0x54d066){return BPromise['reject'](_0x54d066);}return _0x451563[_0x2ddd('0x22')]();};}function saveUpdates(_0x41b359,_0x33f905){return function(_0x3dbfef){if(_0x3dbfef){return _0x3dbfef[_0x2ddd('0x23')](_0x41b359)[_0x2ddd('0x24')](function(_0x3ae4c4){return _0x3ae4c4;});}return null;};}function removeEntity(_0x2536c8,_0x26db78){return function(_0x392882){if(_0x392882){return _0x392882[_0x2ddd('0x25')]()[_0x2ddd('0x24')](function(){var _0x303f35=_0x392882['get']({'plain':!![]});var _0x12cdd8='CannedAnswers';return db['UserProfileResource'][_0x2ddd('0x25')]({'where':{'type':_0x12cdd8,'resourceId':_0x303f35['id']}})[_0x2ddd('0x24')](function(){return _0x392882;});})[_0x2ddd('0x24')](function(){_0x2536c8['status'](0xcc)[_0x2ddd('0x18')]();});}};}function handleEntityNotFound(_0x1d639e,_0x25084b){return function(_0x491fd1){if(!_0x491fd1){_0x1d639e['sendStatus'](0x194);}return _0x491fd1;};}function handleError(_0x4609be,_0x2e2cb9){_0x2e2cb9=_0x2e2cb9||0x1f4;return function(_0x8c57d){logger[_0x2ddd('0x26')](_0x8c57d[_0x2ddd('0x27')]);if(_0x8c57d[_0x2ddd('0x28')]){delete _0x8c57d[_0x2ddd('0x28')];}_0x4609be[_0x2ddd('0x1d')](_0x2e2cb9)[_0x2ddd('0x29')](_0x8c57d);};}exports['index']=function(_0xd51ffa,_0x292bf7){var _0x14aace={},_0x18a1da={},_0x59c04d={'count':0x0,'rows':[]};var _0x25d471=_[_0x2ddd('0x2a')](db['CannedAnswer'][_0x2ddd('0x2b')],function(_0x2debbb){return{'name':_0x2debbb[_0x2ddd('0x2c')],'type':_0x2debbb[_0x2ddd('0x2d')][_0x2ddd('0x2e')]};});_0x18a1da[_0x2ddd('0x2f')]=_['map'](_0x25d471,_0x2ddd('0x28'));_0x18a1da[_0x2ddd('0x30')]=_['keys'](_0xd51ffa[_0x2ddd('0x30')]);_0x18a1da[_0x2ddd('0x31')]=_[_0x2ddd('0x32')](_0x18a1da[_0x2ddd('0x2f')],_0x18a1da[_0x2ddd('0x30')]);_0x14aace[_0x2ddd('0x33')]=_['intersection'](_0x18a1da[_0x2ddd('0x2f')],qs['fields'](_0xd51ffa['query'][_0x2ddd('0x34')]));_0x14aace[_0x2ddd('0x33')]=_0x14aace[_0x2ddd('0x33')][_0x2ddd('0x35')]?_0x14aace[_0x2ddd('0x33')]:_0x18a1da[_0x2ddd('0x2f')];if(!_0xd51ffa[_0x2ddd('0x30')][_0x2ddd('0x36')](_0x2ddd('0x37'))){_0x14aace[_0x2ddd('0x1b')]=qs[_0x2ddd('0x1b')](_0xd51ffa[_0x2ddd('0x30')][_0x2ddd('0x1b')]);_0x14aace[_0x2ddd('0x19')]=qs[_0x2ddd('0x19')](_0xd51ffa['query']['offset']);}_0x14aace[_0x2ddd('0x38')]=qs['sort'](_0xd51ffa['query'][_0x2ddd('0x39')]);_0x14aace[_0x2ddd('0x3a')]=qs[_0x2ddd('0x31')](_[_0x2ddd('0x3b')](_0xd51ffa[_0x2ddd('0x30')],_0x18a1da[_0x2ddd('0x31')]),_0x25d471);if(_0xd51ffa['query'][_0x2ddd('0x3c')]){_0x14aace[_0x2ddd('0x3a')]=_[_0x2ddd('0x3d')](_0x14aace[_0x2ddd('0x3a')],{'$or':[{'key':{'$like':'%'+_0xd51ffa[_0x2ddd('0x30')][_0x2ddd('0x3c')]+'%'}},{'value':{'$like':'%'+_0xd51ffa[_0x2ddd('0x30')]['filter']+'%'}}]});}_0x14aace=_[_0x2ddd('0x3d')]({},_0x14aace,_0xd51ffa[_0x2ddd('0x3e')]);var _0x5a9352={'where':_0x14aace['where']};return db[_0x2ddd('0x3f')][_0x2ddd('0x1c')](_0x5a9352)[_0x2ddd('0x24')](function(_0x2b4e8e){_0x59c04d['count']=_0x2b4e8e;if(_0xd51ffa[_0x2ddd('0x30')]['includeAll']){_0x14aace[_0x2ddd('0x40')]=[{'all':!![]}];}return db[_0x2ddd('0x3f')][_0x2ddd('0x41')](_0x14aace);})['then'](function(_0x1efb9a){_0x59c04d[_0x2ddd('0x42')]=_0x1efb9a;return _0x59c04d;})['then'](respondWithFilteredResult(_0x292bf7,_0x14aace))[_0x2ddd('0x43')](handleError(_0x292bf7,null));};exports[_0x2ddd('0x44')]=function(_0x4af3cc,_0x58b25a){var _0x141596={'raw':!![],'where':{'id':_0x4af3cc[_0x2ddd('0x45')]['id']}},_0x5b66af={};_0x5b66af['model']=_[_0x2ddd('0x46')](db[_0x2ddd('0x3f')]['rawAttributes']);_0x5b66af[_0x2ddd('0x30')]=_['keys'](_0x4af3cc[_0x2ddd('0x30')]);_0x5b66af['filters']=_['intersection'](_0x5b66af[_0x2ddd('0x2f')],_0x5b66af[_0x2ddd('0x30')]);_0x141596[_0x2ddd('0x33')]=_[_0x2ddd('0x32')](_0x5b66af[_0x2ddd('0x2f')],qs[_0x2ddd('0x34')](_0x4af3cc[_0x2ddd('0x30')]['fields']));_0x141596[_0x2ddd('0x33')]=_0x141596[_0x2ddd('0x33')][_0x2ddd('0x35')]?_0x141596[_0x2ddd('0x33')]:_0x5b66af[_0x2ddd('0x2f')];if(_0x4af3cc[_0x2ddd('0x30')]['includeAll']){_0x141596[_0x2ddd('0x40')]=[{'all':!![]}];}_0x141596=_['merge']({},_0x141596,_0x4af3cc[_0x2ddd('0x3e')]);return db[_0x2ddd('0x3f')][_0x2ddd('0x47')](_0x141596)[_0x2ddd('0x24')](handleEntityNotFound(_0x58b25a,null))[_0x2ddd('0x24')](respondWithResult(_0x58b25a,null))['catch'](handleError(_0x58b25a,null));};exports['update']=function(_0x2fa4e9,_0x11551d){if(_0x2fa4e9[_0x2ddd('0x48')]['id']){delete _0x2fa4e9['body']['id'];}return db[_0x2ddd('0x3f')][_0x2ddd('0x47')]({'where':{'id':_0x2fa4e9[_0x2ddd('0x45')]['id']}})['then'](handleEntityNotFound(_0x11551d,null))[_0x2ddd('0x24')](saveUpdates(_0x2fa4e9[_0x2ddd('0x48')],null))[_0x2ddd('0x24')](respondWithResult(_0x11551d,null))[_0x2ddd('0x43')](handleError(_0x11551d,null));};exports[_0x2ddd('0x25')]=function(_0x149215,_0x5cbc62){return db[_0x2ddd('0x3f')][_0x2ddd('0x47')]({'where':{'id':_0x149215[_0x2ddd('0x45')]['id']}})[_0x2ddd('0x24')](handleEntityNotFound(_0x5cbc62,null))[_0x2ddd('0x24')](removeEntity(_0x5cbc62,null))[_0x2ddd('0x43')](handleError(_0x5cbc62,null));};exports[_0x2ddd('0x49')]=function(_0x27856e,_0x5bee06){var _0x54818e={'key':_0x27856e[_0x2ddd('0x48')][_0x2ddd('0x2e')]};if(_0x27856e['body'][_0x2ddd('0x4a')]){_0x54818e['MailAccountId']=_0x27856e['body'][_0x2ddd('0x4a')];}else if(_0x27856e[_0x2ddd('0x48')][_0x2ddd('0x4b')]){_0x54818e[_0x2ddd('0x4b')]=_0x27856e[_0x2ddd('0x48')][_0x2ddd('0x4b')];}else if(_0x27856e[_0x2ddd('0x48')]['OpenchannelAccountId']){_0x54818e[_0x2ddd('0x4c')]=_0x27856e['body'][_0x2ddd('0x4c')];}else if(_0x27856e[_0x2ddd('0x48')]['ChatWebsiteId']){_0x54818e[_0x2ddd('0x4d')]=_0x27856e[_0x2ddd('0x48')]['ChatWebsiteId'];}return db[_0x2ddd('0x3f')][_0x2ddd('0x47')]({'where':_0x54818e})[_0x2ddd('0x24')](function(_0x482950){if(_0x482950){throw new db[(_0x2ddd('0x4e'))][(_0x2ddd('0x4f'))]('The\x20inserted\x20key\x20already\x20exists.');}return db[_0x2ddd('0x3f')][_0x2ddd('0x49')](_0x27856e[_0x2ddd('0x48')]);})[_0x2ddd('0x24')](function(_0x419329){var _0x230dbe=_0x27856e[_0x2ddd('0x50')]['get']({'plain':!![]});if(!_0x230dbe)throw new Error(_0x2ddd('0x51'));if(_0x230dbe[_0x2ddd('0x52')]==='user'){var _0x3e262c=_0x419329[_0x2ddd('0x53')]({'plain':!![]});return db[_0x2ddd('0x54')]['find']({'where':{'name':'CannedAnswers','userProfileId':_0x230dbe[_0x2ddd('0x55')]},'raw':!![]})[_0x2ddd('0x24')](function(_0x5a016c){if(_0x5a016c&&_0x5a016c[_0x2ddd('0x56')]===0x0){return db[_0x2ddd('0x57')][_0x2ddd('0x49')]({'name':_0x3e262c['name'],'resourceId':_0x3e262c['id'],'type':_0x5a016c[_0x2ddd('0x28')],'sectionId':_0x5a016c['id']},{})[_0x2ddd('0x24')](function(){return _0x419329;});}else{return _0x419329;}})[_0x2ddd('0x43')](function(_0x2f4b89){logger[_0x2ddd('0x26')](_0x2ddd('0x58'),_0x2f4b89);throw _0x2f4b89;});}return _0x419329;})[_0x2ddd('0x24')](respondWithResult(_0x5bee06,0xc9))[_0x2ddd('0x43')](handleError(_0x5bee06,null));}; \ No newline at end of file +var _0x7ac6=['OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','save','update','then','destroy','get','CannedAnswers','error','stack','name','send','CannedAnswer','rawAttributes','fieldName','key','model','map','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','filters','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','body','find','create','MailAccountId','SmsAccountId'];(function(_0x3050ca,_0x3e36b0){var _0x1eed1d=function(_0x195e8f){while(--_0x195e8f){_0x3050ca['push'](_0x3050ca['shift']());}};_0x1eed1d(++_0x3e36b0);}(_0x7ac6,0x1b7));var _0x67ac=function(_0x46274e,_0x1afc60){_0x46274e=_0x46274e-0x0;var _0x304495=_0x7ac6[_0x46274e];return _0x304495;};'use strict';var emlformat=require(_0x67ac('0x0'));var rimraf=require(_0x67ac('0x1'));var zipdir=require(_0x67ac('0x2'));var jsonpatch=require(_0x67ac('0x3'));var rp=require(_0x67ac('0x4'));var moment=require(_0x67ac('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x67ac('0x6'));var util=require(_0x67ac('0x7'));var path=require(_0x67ac('0x8'));var sox=require(_0x67ac('0x9'));var csv=require(_0x67ac('0xa'));var ejs=require(_0x67ac('0xb'));var fs=require('fs');var fs_extra=require(_0x67ac('0xc'));var _=require(_0x67ac('0xd'));var squel=require('squel');var crypto=require(_0x67ac('0xe'));var jsforce=require(_0x67ac('0xf'));var deskjs=require(_0x67ac('0x10'));var toCsv=require('to-csv');var querystring=require(_0x67ac('0x11'));var Papa=require('papaparse');var Redis=require(_0x67ac('0x12'));var authService=require(_0x67ac('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x67ac('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x67ac('0x15'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x67ac('0x16'));var db=require(_0x67ac('0x17'))['db'];function respondWithStatusCode(_0x1823e8,_0x485307){_0x485307=_0x485307||0xcc;return function(_0x106f2d){if(_0x106f2d){return _0x1823e8[_0x67ac('0x18')](_0x485307);}return _0x1823e8[_0x67ac('0x19')](_0x485307)[_0x67ac('0x1a')]();};}function respondWithResult(_0x431233,_0xc6ce7c){_0xc6ce7c=_0xc6ce7c||0xc8;return function(_0x3eed32){if(_0x3eed32){return _0x431233[_0x67ac('0x19')](_0xc6ce7c)[_0x67ac('0x1b')](_0x3eed32);}};}function respondWithFilteredResult(_0x5d8a8e,_0x3f197e){return function(_0x5d561a){if(_0x5d561a){var _0x24d6fe=typeof _0x3f197e[_0x67ac('0x1c')]==='undefined'&&typeof _0x3f197e[_0x67ac('0x1d')]===_0x67ac('0x1e');var _0xf36e17=_0x5d561a[_0x67ac('0x1f')];var _0x4049a2=_0x24d6fe?0x0:_0x3f197e[_0x67ac('0x1c')];var _0x2f88f2=_0x24d6fe?_0x5d561a[_0x67ac('0x1f')]:_0x3f197e[_0x67ac('0x1c')]+_0x3f197e['limit'];var _0xf5e7d4;if(_0x2f88f2>=_0xf36e17){_0x2f88f2=_0xf36e17;_0xf5e7d4=0xc8;}else{_0xf5e7d4=0xce;}_0x5d8a8e[_0x67ac('0x19')](_0xf5e7d4);return _0x5d8a8e[_0x67ac('0x20')](_0x67ac('0x21'),_0x4049a2+'-'+_0x2f88f2+'/'+_0xf36e17)[_0x67ac('0x1b')](_0x5d561a);}return null;};}function patchUpdates(_0x34c47b){return function(_0x411778){try{jsonpatch[_0x67ac('0x22')](_0x411778,_0x34c47b,!![]);}catch(_0x72433f){return BPromise['reject'](_0x72433f);}return _0x411778[_0x67ac('0x23')]();};}function saveUpdates(_0x44bf22,_0x5a8bd2){return function(_0x17520f){if(_0x17520f){return _0x17520f[_0x67ac('0x24')](_0x44bf22)[_0x67ac('0x25')](function(_0x1c61ce){return _0x1c61ce;});}return null;};}function removeEntity(_0x3ce859,_0x22a782){return function(_0xdec0b){if(_0xdec0b){return _0xdec0b[_0x67ac('0x26')]()[_0x67ac('0x25')](function(){var _0x286a12=_0xdec0b[_0x67ac('0x27')]({'plain':!![]});var _0x323539=_0x67ac('0x28');return db['UserProfileResource']['destroy']({'where':{'type':_0x323539,'resourceId':_0x286a12['id']}})[_0x67ac('0x25')](function(){return _0xdec0b;});})[_0x67ac('0x25')](function(){_0x3ce859[_0x67ac('0x19')](0xcc)[_0x67ac('0x1a')]();});}};}function handleEntityNotFound(_0x895859,_0x2ed80e){return function(_0x41ce1c){if(!_0x41ce1c){_0x895859[_0x67ac('0x18')](0x194);}return _0x41ce1c;};}function handleError(_0x3c60a6,_0x78d5a3){_0x78d5a3=_0x78d5a3||0x1f4;return function(_0x3df62d){logger[_0x67ac('0x29')](_0x3df62d[_0x67ac('0x2a')]);if(_0x3df62d[_0x67ac('0x2b')]){delete _0x3df62d[_0x67ac('0x2b')];}_0x3c60a6[_0x67ac('0x19')](_0x78d5a3)[_0x67ac('0x2c')](_0x3df62d);};}exports['index']=function(_0x52d4d2,_0x25e3c8){var _0x56edb1={},_0x31fd51={},_0x76ad73={'count':0x0,'rows':[]};var _0xdcb551=_['map'](db[_0x67ac('0x2d')][_0x67ac('0x2e')],function(_0x42722e){return{'name':_0x42722e[_0x67ac('0x2f')],'type':_0x42722e['type'][_0x67ac('0x30')]};});_0x31fd51[_0x67ac('0x31')]=_[_0x67ac('0x32')](_0xdcb551,_0x67ac('0x2b'));_0x31fd51[_0x67ac('0x33')]=_[_0x67ac('0x34')](_0x52d4d2[_0x67ac('0x33')]);_0x31fd51['filters']=_[_0x67ac('0x35')](_0x31fd51[_0x67ac('0x31')],_0x31fd51['query']);_0x56edb1[_0x67ac('0x36')]=_[_0x67ac('0x35')](_0x31fd51['model'],qs[_0x67ac('0x37')](_0x52d4d2[_0x67ac('0x33')]['fields']));_0x56edb1[_0x67ac('0x36')]=_0x56edb1[_0x67ac('0x36')][_0x67ac('0x38')]?_0x56edb1[_0x67ac('0x36')]:_0x31fd51[_0x67ac('0x31')];if(!_0x52d4d2[_0x67ac('0x33')]['hasOwnProperty'](_0x67ac('0x39'))){_0x56edb1['limit']=qs[_0x67ac('0x1d')](_0x52d4d2[_0x67ac('0x33')][_0x67ac('0x1d')]);_0x56edb1[_0x67ac('0x1c')]=qs[_0x67ac('0x1c')](_0x52d4d2[_0x67ac('0x33')]['offset']);}_0x56edb1[_0x67ac('0x3a')]=qs[_0x67ac('0x3b')](_0x52d4d2[_0x67ac('0x33')][_0x67ac('0x3b')]);_0x56edb1[_0x67ac('0x3c')]=qs[_0x67ac('0x3d')](_['pick'](_0x52d4d2['query'],_0x31fd51[_0x67ac('0x3d')]),_0xdcb551);if(_0x52d4d2[_0x67ac('0x33')][_0x67ac('0x3e')]){_0x56edb1[_0x67ac('0x3c')]=_['merge'](_0x56edb1[_0x67ac('0x3c')],{'$or':[{'key':{'$like':'%'+_0x52d4d2['query'][_0x67ac('0x3e')]+'%'}},{'value':{'$like':'%'+_0x52d4d2[_0x67ac('0x33')][_0x67ac('0x3e')]+'%'}}]});}_0x56edb1=_[_0x67ac('0x3f')]({},_0x56edb1,_0x52d4d2[_0x67ac('0x40')]);var _0x49766f={'where':_0x56edb1['where']};return db[_0x67ac('0x2d')][_0x67ac('0x1f')](_0x49766f)[_0x67ac('0x25')](function(_0x20ad5b){_0x76ad73[_0x67ac('0x1f')]=_0x20ad5b;if(_0x52d4d2['query'][_0x67ac('0x41')]){_0x56edb1[_0x67ac('0x42')]=[{'all':!![]}];}return db[_0x67ac('0x2d')][_0x67ac('0x43')](_0x56edb1);})[_0x67ac('0x25')](function(_0x1bfad8){_0x76ad73[_0x67ac('0x44')]=_0x1bfad8;return _0x76ad73;})['then'](respondWithFilteredResult(_0x25e3c8,_0x56edb1))[_0x67ac('0x45')](handleError(_0x25e3c8,null));};exports[_0x67ac('0x46')]=function(_0x19ecc2,_0x992826){var _0x3ac360={'raw':!![],'where':{'id':_0x19ecc2[_0x67ac('0x47')]['id']}},_0x49e9bd={};_0x49e9bd['model']=_[_0x67ac('0x34')](db[_0x67ac('0x2d')]['rawAttributes']);_0x49e9bd[_0x67ac('0x33')]=_[_0x67ac('0x34')](_0x19ecc2[_0x67ac('0x33')]);_0x49e9bd[_0x67ac('0x3d')]=_['intersection'](_0x49e9bd['model'],_0x49e9bd['query']);_0x3ac360[_0x67ac('0x36')]=_[_0x67ac('0x35')](_0x49e9bd[_0x67ac('0x31')],qs['fields'](_0x19ecc2[_0x67ac('0x33')]['fields']));_0x3ac360[_0x67ac('0x36')]=_0x3ac360['attributes']['length']?_0x3ac360[_0x67ac('0x36')]:_0x49e9bd[_0x67ac('0x31')];if(_0x19ecc2[_0x67ac('0x33')][_0x67ac('0x41')]){_0x3ac360[_0x67ac('0x42')]=[{'all':!![]}];}_0x3ac360=_[_0x67ac('0x3f')]({},_0x3ac360,_0x19ecc2[_0x67ac('0x40')]);return db['CannedAnswer']['find'](_0x3ac360)[_0x67ac('0x25')](handleEntityNotFound(_0x992826,null))['then'](respondWithResult(_0x992826,null))[_0x67ac('0x45')](handleError(_0x992826,null));};exports['update']=function(_0x544499,_0x20c5f8){if(_0x544499['body']['id']){delete _0x544499[_0x67ac('0x48')]['id'];}return db[_0x67ac('0x2d')]['find']({'where':{'id':_0x544499['params']['id']}})['then'](handleEntityNotFound(_0x20c5f8,null))['then'](saveUpdates(_0x544499[_0x67ac('0x48')],null))[_0x67ac('0x25')](respondWithResult(_0x20c5f8,null))['catch'](handleError(_0x20c5f8,null));};exports[_0x67ac('0x26')]=function(_0x3a63e6,_0x2a26b9){return db['CannedAnswer'][_0x67ac('0x49')]({'where':{'id':_0x3a63e6[_0x67ac('0x47')]['id']}})[_0x67ac('0x25')](handleEntityNotFound(_0x2a26b9,null))[_0x67ac('0x25')](removeEntity(_0x2a26b9,null))['catch'](handleError(_0x2a26b9,null));};exports[_0x67ac('0x4a')]=function(_0x367b55,_0x569c1d){var _0x9c073={'key':_0x367b55[_0x67ac('0x48')][_0x67ac('0x30')]};if(_0x367b55[_0x67ac('0x48')][_0x67ac('0x4b')]){_0x9c073['MailAccountId']=_0x367b55[_0x67ac('0x48')][_0x67ac('0x4b')];}else if(_0x367b55[_0x67ac('0x48')][_0x67ac('0x4c')]){_0x9c073[_0x67ac('0x4c')]=_0x367b55[_0x67ac('0x48')][_0x67ac('0x4c')];}else if(_0x367b55['body']['OpenchannelAccountId']){_0x9c073[_0x67ac('0x4d')]=_0x367b55[_0x67ac('0x48')]['OpenchannelAccountId'];}else if(_0x367b55[_0x67ac('0x48')]['ChatWebsiteId']){_0x9c073[_0x67ac('0x4e')]=_0x367b55[_0x67ac('0x48')]['ChatWebsiteId'];}return db[_0x67ac('0x2d')][_0x67ac('0x49')]({'where':_0x9c073})[_0x67ac('0x25')](function(_0x26ba82){if(_0x26ba82){throw new db[(_0x67ac('0x4f'))][(_0x67ac('0x50'))]('The\x20inserted\x20key\x20already\x20exists.');}return db[_0x67ac('0x2d')]['create'](_0x367b55[_0x67ac('0x48')]);})[_0x67ac('0x25')](function(_0xc1f071){var _0x159aee=_0x367b55['user'][_0x67ac('0x27')]({'plain':!![]});if(!_0x159aee)throw new Error(_0x67ac('0x51'));if(_0x159aee[_0x67ac('0x52')]===_0x67ac('0x53')){var _0x2fb3ca=_0xc1f071['get']({'plain':!![]});return db['UserProfileSection']['find']({'where':{'name':_0x67ac('0x28'),'userProfileId':_0x159aee[_0x67ac('0x54')]},'raw':!![]})[_0x67ac('0x25')](function(_0x333ed1){if(_0x333ed1&&_0x333ed1['autoAssociation']===0x0){return db['UserProfileResource'][_0x67ac('0x4a')]({'name':_0x2fb3ca[_0x67ac('0x2b')],'resourceId':_0x2fb3ca['id'],'type':_0x333ed1[_0x67ac('0x2b')],'sectionId':_0x333ed1['id']},{})[_0x67ac('0x25')](function(){return _0xc1f071;});}else{return _0xc1f071;}})[_0x67ac('0x45')](function(_0x59db7c){logger['error'](_0x67ac('0x55'),_0x59db7c);throw _0x59db7c;});}return _0xc1f071;})['then'](respondWithResult(_0x569c1d,0xc9))['catch'](handleError(_0x569c1d,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index afb88ed..029424b 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 _0xc386=['exports','define','CannedAnswer','tools_canned_answers','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','rimraf','../../config/environment','./cannedAnswer.attributes'];(function(_0x27c25f,_0x4ff5fe){var _0x2da4c4=function(_0x1f3c9a){while(--_0x1f3c9a){_0x27c25f['push'](_0x27c25f['shift']());}};_0x2da4c4(++_0x4ff5fe);}(_0xc386,0x157));var _0x6c38=function(_0x50f572,_0x465d59){_0x50f572=_0x50f572-0x0;var _0x3dbd7a=_0xc386[_0x50f572];return _0x3dbd7a;};'use strict';var _=require(_0x6c38('0x0'));var util=require(_0x6c38('0x1'));var logger=require(_0x6c38('0x2'))(_0x6c38('0x3'));var moment=require('moment');var BPromise=require(_0x6c38('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x6c38('0x5'));var config=require(_0x6c38('0x6'));var attributes=require(_0x6c38('0x7'));module[_0x6c38('0x8')]=function(_0x3eb755,_0x22fb74){return _0x3eb755[_0x6c38('0x9')](_0x6c38('0xa'),attributes,{'tableName':_0x6c38('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x6c38('0xc')});}; \ No newline at end of file +var _0x4a47=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','tools_canned_answers','utf8mb4_unicode_ci'];(function(_0xee813,_0x4206a7){var _0x3a65b0=function(_0x485acf){while(--_0x485acf){_0xee813['push'](_0xee813['shift']());}};_0x3a65b0(++_0x4206a7);}(_0x4a47,0x15e));var _0x74a4=function(_0x42efa7,_0x2d5d92){_0x42efa7=_0x42efa7-0x0;var _0x5d1b50=_0x4a47[_0x42efa7];return _0x5d1b50;};'use strict';var _=require(_0x74a4('0x0'));var util=require(_0x74a4('0x1'));var logger=require(_0x74a4('0x2'))(_0x74a4('0x3'));var moment=require(_0x74a4('0x4'));var BPromise=require(_0x74a4('0x5'));var rp=require(_0x74a4('0x6'));var fs=require('fs');var path=require(_0x74a4('0x7'));var rimraf=require(_0x74a4('0x8'));var config=require(_0x74a4('0x9'));var attributes=require('./cannedAnswer.attributes');module[_0x74a4('0xa')]=function(_0x2827a7,_0x28d072){return _0x2827a7[_0x74a4('0xb')]('CannedAnswer',attributes,{'tableName':_0x74a4('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x74a4('0xd')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index 871cf9f..773f057 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(_0x1c34f8,_0x41aad9){var _0x55da1c=function(_0x2fa5be){while(--_0x2fa5be){_0x1c34f8['push'](_0x1c34f8['shift']());}};_0x55da1c(++_0x41aad9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0xa9e0[_0x34bc30];return _0x5706de;};'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(_0x2dbff6,_0x56c7e4){var _0x509a43=function(_0x138698){while(--_0x138698){_0x2dbff6['push'](_0x2dbff6['shift']());}};_0x509a43(++_0x56c7e4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b78e8,_0x55096b){_0x5b78e8=_0x5b78e8-0x0;var _0xf2c321=_0xa9e0[_0x5b78e8];return _0xf2c321;};'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 f89cfe0..f87756e 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 _0x214e=['./cannedAnswer.controller','get','isAuthenticated','index','/:id','show','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment'];(function(_0x3a6b4e,_0x19ef1a){var _0x1a162e=function(_0x5c2994){while(--_0x5c2994){_0x3a6b4e['push'](_0x3a6b4e['shift']());}};_0x1a162e(++_0x19ef1a);}(_0x214e,0x1f0));var _0xe214=function(_0x3be5ef,_0x5b3b94){_0x3be5ef=_0x3be5ef-0x0;var _0x30d92=_0x214e[_0x3be5ef];return _0x30d92;};'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('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xe214('0x6'));var config=require(_0xe214('0x7'));var controller=require(_0xe214('0x8'));router[_0xe214('0x9')]('/',auth[_0xe214('0xa')](),controller[_0xe214('0xb')]);router['get'](_0xe214('0xc'),auth[_0xe214('0xa')](),controller[_0xe214('0xd')]);router['post']('/',auth[_0xe214('0xa')](),controller['create']);router[_0xe214('0xe')](_0xe214('0xc'),auth[_0xe214('0xa')](),controller[_0xe214('0xf')]);router[_0xe214('0x10')](_0xe214('0xc'),auth[_0xe214('0xa')](),controller[_0xe214('0x11')]);module['exports']=router; \ No newline at end of file +var _0xc24e=['../../components/interaction/service','../../config/environment','./cannedAnswer.controller','get','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x42ee98,_0x5e0555){var _0x546da8=function(_0x55b964){while(--_0x55b964){_0x42ee98['push'](_0x42ee98['shift']());}};_0x546da8(++_0x5e0555);}(_0xc24e,0x19c));var _0xec24=function(_0x4de0c0,_0x5959e7){_0x4de0c0=_0x4de0c0-0x0;var _0x2ba838=_0xc24e[_0x4de0c0];return _0x2ba838;};'use strict';var multer=require(_0xec24('0x0'));var util=require(_0xec24('0x1'));var path=require(_0xec24('0x2'));var timeout=require(_0xec24('0x3'));var express=require(_0xec24('0x4'));var router=express[_0xec24('0x5')]();var fs_extra=require(_0xec24('0x6'));var auth=require(_0xec24('0x7'));var interaction=require(_0xec24('0x8'));var config=require(_0xec24('0x9'));var controller=require(_0xec24('0xa'));router[_0xec24('0xb')]('/',auth[_0xec24('0xc')](),controller['index']);router[_0xec24('0xb')](_0xec24('0xd'),auth['isAuthenticated'](),controller[_0xec24('0xe')]);router[_0xec24('0xf')]('/',auth[_0xec24('0xc')](),controller[_0xec24('0x10')]);router[_0xec24('0x11')](_0xec24('0xd'),auth['isAuthenticated'](),controller[_0xec24('0x12')]);router[_0xec24('0x13')](_0xec24('0xd'),auth['isAuthenticated'](),controller[_0xec24('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index 9445df0..f7b54ef 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 _0x85d3=['sequelize','exports','STRING','INTEGER'];(function(_0x442541,_0x15048b){var _0x1ef30f=function(_0x993334){while(--_0x993334){_0x442541['push'](_0x442541['shift']());}};_0x1ef30f(++_0x15048b);}(_0x85d3,0xc8));var _0x385d=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x85d3[_0x501510];return _0x1e6ee5;};'use strict';var Sequelize=require(_0x385d('0x0'));module[_0x385d('0x1')]={'calldate':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':'1970-01-01\x2000:00:01'},'clid':{'type':Sequelize[_0x385d('0x2')]},'src':{'type':Sequelize[_0x385d('0x2')]},'dst':{'type':Sequelize[_0x385d('0x2')]},'dcontext':{'type':Sequelize[_0x385d('0x2')]},'channel':{'type':Sequelize[_0x385d('0x2')]},'dstchannel':{'type':Sequelize[_0x385d('0x2')]},'lastapp':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0x385d('0x2')]},'duration':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x385d('0x3')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x385d('0x2')]},'amaflags':{'type':Sequelize[_0x385d('0x3')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x385d('0x2')]},'userfield':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x385d('0x2')]},'linkedid':{'type':Sequelize[_0x385d('0x2')]},'sequence':{'type':Sequelize[_0x385d('0x2')]},'peeraccount':{'type':Sequelize[_0x385d('0x2')]},'type':{'type':Sequelize[_0x385d('0x2')]},'tag':{'type':Sequelize[_0x385d('0x2')]}}; \ No newline at end of file +var _0x8801=['STRING','INTEGER','sequelize','exports','DATE','1970-01-01\x2000:00:01'];(function(_0x2edd08,_0x19eb8d){var _0x4c5c56=function(_0x24a1f5){while(--_0x24a1f5){_0x2edd08['push'](_0x2edd08['shift']());}};_0x4c5c56(++_0x19eb8d);}(_0x8801,0x116));var _0x1880=function(_0xd0a066,_0x2e40db){_0xd0a066=_0xd0a066-0x0;var _0x805de1=_0x8801[_0xd0a066];return _0x805de1;};'use strict';var Sequelize=require(_0x1880('0x0'));module[_0x1880('0x1')]={'calldate':{'type':Sequelize[_0x1880('0x2')],'allowNull':![],'defaultValue':_0x1880('0x3')},'clid':{'type':Sequelize[_0x1880('0x4')]},'src':{'type':Sequelize[_0x1880('0x4')]},'dst':{'type':Sequelize[_0x1880('0x4')]},'dcontext':{'type':Sequelize[_0x1880('0x4')]},'channel':{'type':Sequelize[_0x1880('0x4')]},'dstchannel':{'type':Sequelize[_0x1880('0x4')]},'lastapp':{'type':Sequelize[_0x1880('0x4')]},'lastdata':{'type':Sequelize[_0x1880('0x4')]},'duration':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x1880('0x5')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0x1880('0x5')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x1880('0x4')]},'userfield':{'type':Sequelize[_0x1880('0x4')]},'uniqueid':{'type':Sequelize[_0x1880('0x4')]},'linkedid':{'type':Sequelize[_0x1880('0x4')]},'sequence':{'type':Sequelize[_0x1880('0x4')]},'peeraccount':{'type':Sequelize[_0x1880('0x4')]},'type':{'type':Sequelize[_0x1880('0x4')]},'tag':{'type':Sequelize[_0x1880('0x4')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index 9c5698d..b959472 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 _0x6c32=['name','send','index','map','Cdr','rawAttributes','fieldName','type','key','query','keys','filters','model','fields','attributes','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','intersection','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','Content-Range','apply','save','update','destroy','then','error'];(function(_0x102ff9,_0x907658){var _0x24fa97=function(_0x3622ff){while(--_0x3622ff){_0x102ff9['push'](_0x102ff9['shift']());}};_0x24fa97(++_0x907658);}(_0x6c32,0x6e));var _0x26c3=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x6c32[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x26c3('0x0'));var rimraf=require(_0x26c3('0x1'));var zipdir=require(_0x26c3('0x2'));var jsonpatch=require(_0x26c3('0x3'));var rp=require(_0x26c3('0x4'));var moment=require(_0x26c3('0x5'));var BPromise=require(_0x26c3('0x6'));var Mustache=require(_0x26c3('0x7'));var util=require(_0x26c3('0x8'));var path=require('path');var sox=require(_0x26c3('0x9'));var csv=require(_0x26c3('0xa'));var ejs=require(_0x26c3('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x26c3('0xc'));var squel=require('squel');var crypto=require(_0x26c3('0xd'));var jsforce=require(_0x26c3('0xe'));var deskjs=require(_0x26c3('0xf'));var toCsv=require(_0x26c3('0xa'));var querystring=require(_0x26c3('0x10'));var Papa=require(_0x26c3('0x11'));var Redis=require(_0x26c3('0x12'));var authService=require(_0x26c3('0x13'));var qs=require(_0x26c3('0x14'));var as=require(_0x26c3('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x26c3('0x16'));var licenseUtil=require(_0x26c3('0x17'));var db=require(_0x26c3('0x18'))['db'];function respondWithStatusCode(_0x457fc9,_0x4b8d92){_0x4b8d92=_0x4b8d92||0xcc;return function(_0x4c7b94){if(_0x4c7b94){return _0x457fc9[_0x26c3('0x19')](_0x4b8d92);}return _0x457fc9[_0x26c3('0x1a')](_0x4b8d92)[_0x26c3('0x1b')]();};}function respondWithResult(_0x3cd3c7,_0x17c399){_0x17c399=_0x17c399||0xc8;return function(_0x568d0b){if(_0x568d0b){return _0x3cd3c7['status'](_0x17c399)[_0x26c3('0x1c')](_0x568d0b);}};}function respondWithFilteredResult(_0xc14c69,_0x4f4256){return function(_0x4ed7c1){if(_0x4ed7c1){var _0x124cb3=typeof _0x4f4256['offset']===_0x26c3('0x1d')&&typeof _0x4f4256['limit']==='undefined';var _0x3931d5=_0x4ed7c1['count'];var _0x38fe17=_0x124cb3?0x0:_0x4f4256['offset'];var _0x170039=_0x124cb3?_0x4ed7c1[_0x26c3('0x1e')]:_0x4f4256[_0x26c3('0x1f')]+_0x4f4256[_0x26c3('0x20')];var _0x20317d;if(_0x170039>=_0x3931d5){_0x170039=_0x3931d5;_0x20317d=0xc8;}else{_0x20317d=0xce;}_0xc14c69['status'](_0x20317d);return _0xc14c69['set'](_0x26c3('0x21'),_0x38fe17+'-'+_0x170039+'/'+_0x3931d5)[_0x26c3('0x1c')](_0x4ed7c1);}return null;};}function patchUpdates(_0x480b76){return function(_0x5344e7){try{jsonpatch[_0x26c3('0x22')](_0x5344e7,_0x480b76,!![]);}catch(_0x5c2f7d){return BPromise['reject'](_0x5c2f7d);}return _0x5344e7[_0x26c3('0x23')]();};}function saveUpdates(_0x4eb863,_0x21034d){return function(_0x4a76b5){if(_0x4a76b5){return _0x4a76b5[_0x26c3('0x24')](_0x4eb863)['then'](function(_0x449548){return _0x449548;});}return null;};}function removeEntity(_0x146b69,_0x2f1648){return function(_0xdc0f2c){if(_0xdc0f2c){return _0xdc0f2c[_0x26c3('0x25')]()[_0x26c3('0x26')](function(){_0x146b69[_0x26c3('0x1a')](0xcc)[_0x26c3('0x1b')]();});}};}function handleEntityNotFound(_0x85a057,_0x3f6a18){return function(_0x52dae1){if(!_0x52dae1){_0x85a057[_0x26c3('0x19')](0x194);}return _0x52dae1;};}function handleError(_0x4c7696,_0x50d85e){_0x50d85e=_0x50d85e||0x1f4;return function(_0x44b4f8){logger[_0x26c3('0x27')](_0x44b4f8['stack']);if(_0x44b4f8[_0x26c3('0x28')]){delete _0x44b4f8['name'];}_0x4c7696[_0x26c3('0x1a')](_0x50d85e)[_0x26c3('0x29')](_0x44b4f8);};}exports[_0x26c3('0x2a')]=function(_0x130fcc,_0x3dbda5){var _0x50cd11={},_0x1d3331={},_0x27f556={'count':0x0,'rows':[]};var _0xebb766=_[_0x26c3('0x2b')](db[_0x26c3('0x2c')][_0x26c3('0x2d')],function(_0x5557b8){return{'name':_0x5557b8[_0x26c3('0x2e')],'type':_0x5557b8[_0x26c3('0x2f')][_0x26c3('0x30')]};});_0x1d3331['model']=_[_0x26c3('0x2b')](_0xebb766,_0x26c3('0x28'));_0x1d3331[_0x26c3('0x31')]=_[_0x26c3('0x32')](_0x130fcc[_0x26c3('0x31')]);_0x1d3331[_0x26c3('0x33')]=_['intersection'](_0x1d3331[_0x26c3('0x34')],_0x1d3331[_0x26c3('0x31')]);_0x50cd11['attributes']=_['intersection'](_0x1d3331['model'],qs['fields'](_0x130fcc['query'][_0x26c3('0x35')]));_0x50cd11[_0x26c3('0x36')]=_0x50cd11['attributes'][_0x26c3('0x37')]?_0x50cd11[_0x26c3('0x36')]:_0x1d3331['model'];if(!_0x130fcc['query'][_0x26c3('0x38')]('nolimit')){_0x50cd11[_0x26c3('0x20')]=qs['limit'](_0x130fcc[_0x26c3('0x31')][_0x26c3('0x20')]);_0x50cd11[_0x26c3('0x1f')]=qs[_0x26c3('0x1f')](_0x130fcc[_0x26c3('0x31')]['offset']);}_0x50cd11[_0x26c3('0x39')]=qs[_0x26c3('0x3a')](_0x130fcc[_0x26c3('0x31')][_0x26c3('0x3a')]);_0x50cd11[_0x26c3('0x3b')]=qs[_0x26c3('0x33')](_['pick'](_0x130fcc['query'],_0x1d3331[_0x26c3('0x33')]),_0xebb766);if(_0x130fcc[_0x26c3('0x31')][_0x26c3('0x3c')]){_0x50cd11[_0x26c3('0x3b')]=_[_0x26c3('0x3d')](_0x50cd11['where'],{'$or':_['map'](_0xebb766,function(_0x4c2df1){if(_0x4c2df1[_0x26c3('0x2f')]!==_0x26c3('0x3e')){var _0x832ef2={};_0x832ef2[_0x4c2df1[_0x26c3('0x28')]]={'$like':'%'+_0x130fcc[_0x26c3('0x31')]['filter']+'%'};return _0x832ef2;}})});}_0x50cd11=_['merge']({},_0x50cd11,_0x130fcc[_0x26c3('0x3f')]);var _0x16e680={'where':_0x50cd11[_0x26c3('0x3b')]};return db[_0x26c3('0x2c')]['count'](_0x16e680)[_0x26c3('0x26')](function(_0x2b4bdf){_0x27f556[_0x26c3('0x1e')]=_0x2b4bdf;if(_0x130fcc[_0x26c3('0x31')][_0x26c3('0x40')]){_0x50cd11[_0x26c3('0x41')]=[{'all':!![]}];}return db[_0x26c3('0x2c')][_0x26c3('0x42')](_0x50cd11);})[_0x26c3('0x26')](function(_0x1c0d6c){_0x27f556[_0x26c3('0x43')]=_0x1c0d6c;return _0x27f556;})[_0x26c3('0x26')](respondWithFilteredResult(_0x3dbda5,_0x50cd11))[_0x26c3('0x44')](handleError(_0x3dbda5,null));};exports['show']=function(_0x2f775b,_0x2ecb43){var _0xfb596a={'raw':!![],'where':{'id':_0x2f775b[_0x26c3('0x45')]['id']}},_0x46ebfb={};_0x46ebfb[_0x26c3('0x34')]=_['keys'](db[_0x26c3('0x2c')]['rawAttributes']);_0x46ebfb[_0x26c3('0x31')]=_['keys'](_0x2f775b[_0x26c3('0x31')]);_0x46ebfb[_0x26c3('0x33')]=_['intersection'](_0x46ebfb[_0x26c3('0x34')],_0x46ebfb[_0x26c3('0x31')]);_0xfb596a[_0x26c3('0x36')]=_[_0x26c3('0x46')](_0x46ebfb[_0x26c3('0x34')],qs['fields'](_0x2f775b[_0x26c3('0x31')]['fields']));_0xfb596a[_0x26c3('0x36')]=_0xfb596a['attributes']['length']?_0xfb596a[_0x26c3('0x36')]:_0x46ebfb[_0x26c3('0x34')];if(_0x2f775b[_0x26c3('0x31')]['includeAll']){_0xfb596a[_0x26c3('0x41')]=[{'all':!![]}];}_0xfb596a=_[_0x26c3('0x3d')]({},_0xfb596a,_0x2f775b[_0x26c3('0x3f')]);return db[_0x26c3('0x2c')][_0x26c3('0x47')](_0xfb596a)[_0x26c3('0x26')](handleEntityNotFound(_0x2ecb43,null))['then'](respondWithResult(_0x2ecb43,null))[_0x26c3('0x44')](handleError(_0x2ecb43,null));};exports[_0x26c3('0x48')]=function(_0x378982,_0x133cf7){return db['Cdr'][_0x26c3('0x48')](_0x378982[_0x26c3('0x49')],{})['then'](respondWithResult(_0x133cf7,0xc9))[_0x26c3('0x44')](handleError(_0x133cf7,null));};exports[_0x26c3('0x24')]=function(_0x522fe2,_0x4566ab){if(_0x522fe2['body']['id']){delete _0x522fe2[_0x26c3('0x49')]['id'];}return db[_0x26c3('0x2c')][_0x26c3('0x47')]({'where':{'id':_0x522fe2[_0x26c3('0x45')]['id']}})[_0x26c3('0x26')](handleEntityNotFound(_0x4566ab,null))[_0x26c3('0x26')](saveUpdates(_0x522fe2[_0x26c3('0x49')],null))['then'](respondWithResult(_0x4566ab,null))[_0x26c3('0x44')](handleError(_0x4566ab,null));};exports['destroy']=function(_0x4ada42,_0x3b3e31){return db[_0x26c3('0x2c')][_0x26c3('0x47')]({'where':{'id':_0x4ada42['params']['id']}})['then'](handleEntityNotFound(_0x3b3e31,null))[_0x26c3('0x26')](removeEntity(_0x3b3e31,null))[_0x26c3('0x44')](handleError(_0x3b3e31,null));};exports[_0x26c3('0x4a')]=function(_0x4d1ec7,_0x446453){return db[_0x26c3('0x2c')][_0x26c3('0x4a')]()['then'](respondWithResult(_0x446453,null))[_0x26c3('0x44')](handleError(_0x446453,null));}; \ No newline at end of file +var _0x31af=['fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','Cdr','includeAll','include','findAll','rows','catch','params','create','body','describe','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','ejs'];(function(_0x43392e,_0x37ad8d){var _0x1324f9=function(_0x4fd17c){while(--_0x4fd17c){_0x43392e['push'](_0x43392e['shift']());}};_0x1324f9(++_0x37ad8d);}(_0x31af,0xde));var _0xf31a=function(_0xaf9497,_0x1c2483){_0xaf9497=_0xaf9497-0x0;var _0x4a426e=_0x31af[_0xaf9497];return _0x4a426e;};'use strict';var emlformat=require(_0xf31a('0x0'));var rimraf=require(_0xf31a('0x1'));var zipdir=require(_0xf31a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xf31a('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xf31a('0x4'));var util=require(_0xf31a('0x5'));var path=require(_0xf31a('0x6'));var sox=require(_0xf31a('0x7'));var csv=require('to-csv');var ejs=require(_0xf31a('0x8'));var fs=require('fs');var fs_extra=require(_0xf31a('0x9'));var _=require(_0xf31a('0xa'));var squel=require(_0xf31a('0xb'));var crypto=require('crypto');var jsforce=require(_0xf31a('0xc'));var deskjs=require(_0xf31a('0xd'));var toCsv=require(_0xf31a('0xe'));var querystring=require(_0xf31a('0xf'));var Papa=require('papaparse');var Redis=require(_0xf31a('0x10'));var authService=require(_0xf31a('0x11'));var qs=require(_0xf31a('0x12'));var as=require(_0xf31a('0x13'));var hardwareService=require(_0xf31a('0x14'));var logger=require('../../config/logger')(_0xf31a('0x15'));var utils=require(_0xf31a('0x16'));var config=require(_0xf31a('0x17'));var licenseUtil=require(_0xf31a('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4b662,_0x26b85e){_0x26b85e=_0x26b85e||0xcc;return function(_0x57ed2f){if(_0x57ed2f){return _0x4b662[_0xf31a('0x19')](_0x26b85e);}return _0x4b662[_0xf31a('0x1a')](_0x26b85e)[_0xf31a('0x1b')]();};}function respondWithResult(_0x18d266,_0x451107){_0x451107=_0x451107||0xc8;return function(_0x203031){if(_0x203031){return _0x18d266[_0xf31a('0x1a')](_0x451107)[_0xf31a('0x1c')](_0x203031);}};}function respondWithFilteredResult(_0x3f7c35,_0x22522c){return function(_0x6ea6f1){if(_0x6ea6f1){var _0x1da226=typeof _0x22522c[_0xf31a('0x1d')]===_0xf31a('0x1e')&&typeof _0x22522c[_0xf31a('0x1f')]==='undefined';var _0x454836=_0x6ea6f1[_0xf31a('0x20')];var _0x251ca7=_0x1da226?0x0:_0x22522c[_0xf31a('0x1d')];var _0x4c3589=_0x1da226?_0x6ea6f1[_0xf31a('0x20')]:_0x22522c[_0xf31a('0x1d')]+_0x22522c[_0xf31a('0x1f')];var _0x208da3;if(_0x4c3589>=_0x454836){_0x4c3589=_0x454836;_0x208da3=0xc8;}else{_0x208da3=0xce;}_0x3f7c35[_0xf31a('0x1a')](_0x208da3);return _0x3f7c35['set'](_0xf31a('0x21'),_0x251ca7+'-'+_0x4c3589+'/'+_0x454836)[_0xf31a('0x1c')](_0x6ea6f1);}return null;};}function patchUpdates(_0x5861df){return function(_0x22c9c3){try{jsonpatch[_0xf31a('0x22')](_0x22c9c3,_0x5861df,!![]);}catch(_0x55da11){return BPromise[_0xf31a('0x23')](_0x55da11);}return _0x22c9c3[_0xf31a('0x24')]();};}function saveUpdates(_0x54f9b5,_0x5724b3){return function(_0x534317){if(_0x534317){return _0x534317[_0xf31a('0x25')](_0x54f9b5)[_0xf31a('0x26')](function(_0x5c23db){return _0x5c23db;});}return null;};}function removeEntity(_0x41d359,_0x2a8a22){return function(_0x5d08ee){if(_0x5d08ee){return _0x5d08ee[_0xf31a('0x27')]()['then'](function(){_0x41d359['status'](0xcc)[_0xf31a('0x1b')]();});}};}function handleEntityNotFound(_0x714292,_0x54ad77){return function(_0x4e115c){if(!_0x4e115c){_0x714292['sendStatus'](0x194);}return _0x4e115c;};}function handleError(_0x531179,_0x14c82e){_0x14c82e=_0x14c82e||0x1f4;return function(_0x45df36){logger[_0xf31a('0x28')](_0x45df36['stack']);if(_0x45df36[_0xf31a('0x29')]){delete _0x45df36[_0xf31a('0x29')];}_0x531179[_0xf31a('0x1a')](_0x14c82e)[_0xf31a('0x2a')](_0x45df36);};}exports[_0xf31a('0x2b')]=function(_0x5a55c6,_0xed9bfd){var _0x2ebc27={},_0x52f8aa={},_0x52da7d={'count':0x0,'rows':[]};var _0x203f28=_[_0xf31a('0x2c')](db['Cdr'][_0xf31a('0x2d')],function(_0x221048){return{'name':_0x221048[_0xf31a('0x2e')],'type':_0x221048['type'][_0xf31a('0x2f')]};});_0x52f8aa[_0xf31a('0x30')]=_[_0xf31a('0x2c')](_0x203f28,_0xf31a('0x29'));_0x52f8aa[_0xf31a('0x31')]=_[_0xf31a('0x32')](_0x5a55c6['query']);_0x52f8aa[_0xf31a('0x33')]=_[_0xf31a('0x34')](_0x52f8aa[_0xf31a('0x30')],_0x52f8aa[_0xf31a('0x31')]);_0x2ebc27[_0xf31a('0x35')]=_[_0xf31a('0x34')](_0x52f8aa[_0xf31a('0x30')],qs[_0xf31a('0x36')](_0x5a55c6[_0xf31a('0x31')][_0xf31a('0x36')]));_0x2ebc27[_0xf31a('0x35')]=_0x2ebc27[_0xf31a('0x35')][_0xf31a('0x37')]?_0x2ebc27[_0xf31a('0x35')]:_0x52f8aa[_0xf31a('0x30')];if(!_0x5a55c6[_0xf31a('0x31')][_0xf31a('0x38')](_0xf31a('0x39'))){_0x2ebc27[_0xf31a('0x1f')]=qs['limit'](_0x5a55c6[_0xf31a('0x31')][_0xf31a('0x1f')]);_0x2ebc27[_0xf31a('0x1d')]=qs[_0xf31a('0x1d')](_0x5a55c6[_0xf31a('0x31')]['offset']);}_0x2ebc27[_0xf31a('0x3a')]=qs[_0xf31a('0x3b')](_0x5a55c6[_0xf31a('0x31')]['sort']);_0x2ebc27[_0xf31a('0x3c')]=qs[_0xf31a('0x33')](_[_0xf31a('0x3d')](_0x5a55c6[_0xf31a('0x31')],_0x52f8aa[_0xf31a('0x33')]),_0x203f28);if(_0x5a55c6['query'][_0xf31a('0x3e')]){_0x2ebc27['where']=_[_0xf31a('0x3f')](_0x2ebc27[_0xf31a('0x3c')],{'$or':_['map'](_0x203f28,function(_0x35d5b6){if(_0x35d5b6[_0xf31a('0x40')]!==_0xf31a('0x41')){var _0x481d92={};_0x481d92[_0x35d5b6[_0xf31a('0x29')]]={'$like':'%'+_0x5a55c6[_0xf31a('0x31')][_0xf31a('0x3e')]+'%'};return _0x481d92;}})});}_0x2ebc27=_[_0xf31a('0x3f')]({},_0x2ebc27,_0x5a55c6[_0xf31a('0x42')]);var _0x2a240d={'where':_0x2ebc27[_0xf31a('0x3c')]};return db[_0xf31a('0x43')][_0xf31a('0x20')](_0x2a240d)['then'](function(_0x3b4aef){_0x52da7d[_0xf31a('0x20')]=_0x3b4aef;if(_0x5a55c6['query'][_0xf31a('0x44')]){_0x2ebc27[_0xf31a('0x45')]=[{'all':!![]}];}return db[_0xf31a('0x43')][_0xf31a('0x46')](_0x2ebc27);})['then'](function(_0x21b871){_0x52da7d[_0xf31a('0x47')]=_0x21b871;return _0x52da7d;})[_0xf31a('0x26')](respondWithFilteredResult(_0xed9bfd,_0x2ebc27))[_0xf31a('0x48')](handleError(_0xed9bfd,null));};exports['show']=function(_0x234e1a,_0x58163c){var _0x303066={'raw':!![],'where':{'id':_0x234e1a[_0xf31a('0x49')]['id']}},_0x172e1c={};_0x172e1c['model']=_[_0xf31a('0x32')](db['Cdr'][_0xf31a('0x2d')]);_0x172e1c[_0xf31a('0x31')]=_[_0xf31a('0x32')](_0x234e1a[_0xf31a('0x31')]);_0x172e1c[_0xf31a('0x33')]=_[_0xf31a('0x34')](_0x172e1c[_0xf31a('0x30')],_0x172e1c[_0xf31a('0x31')]);_0x303066[_0xf31a('0x35')]=_['intersection'](_0x172e1c[_0xf31a('0x30')],qs[_0xf31a('0x36')](_0x234e1a[_0xf31a('0x31')][_0xf31a('0x36')]));_0x303066[_0xf31a('0x35')]=_0x303066[_0xf31a('0x35')][_0xf31a('0x37')]?_0x303066['attributes']:_0x172e1c['model'];if(_0x234e1a[_0xf31a('0x31')][_0xf31a('0x44')]){_0x303066[_0xf31a('0x45')]=[{'all':!![]}];}_0x303066=_[_0xf31a('0x3f')]({},_0x303066,_0x234e1a[_0xf31a('0x42')]);return db[_0xf31a('0x43')]['find'](_0x303066)[_0xf31a('0x26')](handleEntityNotFound(_0x58163c,null))[_0xf31a('0x26')](respondWithResult(_0x58163c,null))[_0xf31a('0x48')](handleError(_0x58163c,null));};exports[_0xf31a('0x4a')]=function(_0x45b8ed,_0x287bc1){return db['Cdr'][_0xf31a('0x4a')](_0x45b8ed[_0xf31a('0x4b')],{})[_0xf31a('0x26')](respondWithResult(_0x287bc1,0xc9))[_0xf31a('0x48')](handleError(_0x287bc1,null));};exports[_0xf31a('0x25')]=function(_0x111f08,_0x20bd0c){if(_0x111f08[_0xf31a('0x4b')]['id']){delete _0x111f08[_0xf31a('0x4b')]['id'];}return db[_0xf31a('0x43')]['find']({'where':{'id':_0x111f08[_0xf31a('0x49')]['id']}})['then'](handleEntityNotFound(_0x20bd0c,null))[_0xf31a('0x26')](saveUpdates(_0x111f08[_0xf31a('0x4b')],null))[_0xf31a('0x26')](respondWithResult(_0x20bd0c,null))[_0xf31a('0x48')](handleError(_0x20bd0c,null));};exports[_0xf31a('0x27')]=function(_0x3a1a26,_0x25ad3d){return db[_0xf31a('0x43')]['find']({'where':{'id':_0x3a1a26[_0xf31a('0x49')]['id']}})[_0xf31a('0x26')](handleEntityNotFound(_0x25ad3d,null))[_0xf31a('0x26')](removeEntity(_0x25ad3d,null))[_0xf31a('0x48')](handleError(_0x25ad3d,null));};exports[_0xf31a('0x4c')]=function(_0x8c6795,_0x4d21ed){return db[_0xf31a('0x43')][_0xf31a('0x4c')]()[_0xf31a('0x26')](respondWithResult(_0x4d21ed,null))[_0xf31a('0x48')](handleError(_0x4d21ed,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index 2795710..a680f8c 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(_0x848c62,_0x388f6d){var _0x60e6a6=function(_0x50bce9){while(--_0x50bce9){_0x848c62['push'](_0x848c62['shift']());}};_0x60e6a6(++_0x388f6d);}(_0x7a54,0x106));var _0x47a5=function(_0x59c3b3,_0x1cfb32){_0x59c3b3=_0x59c3b3-0x0;var _0x176368=_0x7a54[_0x59c3b3];return _0x176368;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'accountcode','fields':[_0x47a5('0xc')]},{'name':'calldate','fields':['calldate']},{'name':'disposition','fields':[_0x47a5('0xd')]},{'name':_0x47a5('0xe'),'fields':['dst']},{'name':_0x47a5('0xf'),'fields':['src']},{'name':'uniqueid','fields':[_0x47a5('0x10')]}],'timestamps':![]});}; \ No newline at end of file +var _0x9957=['dst','src','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./cdr.attributes','exports','define','Cdr','accountcode','calldate','disposition'];(function(_0x4c2eaf,_0x218156){var _0x3db339=function(_0x5292e3){while(--_0x5292e3){_0x4c2eaf['push'](_0x4c2eaf['shift']());}};_0x3db339(++_0x218156);}(_0x9957,0x93));var _0x7995=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x9957[_0x618414];return _0x21c19a;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'cdr','paranoid':![],'indexes':[{'name':_0x7995('0xc'),'fields':[_0x7995('0xc')]},{'name':'calldate','fields':[_0x7995('0xd')]},{'name':_0x7995('0xe'),'fields':[_0x7995('0xe')]},{'name':_0x7995('0xf'),'fields':[_0x7995('0xf')]},{'name':_0x7995('0x10'),'fields':[_0x7995('0x10')]},{'name':'uniqueid','fields':[_0x7995('0x11')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/cdr/cdr.rpc.js b/server/api/cdr/cdr.rpc.js index 911a033..574db42 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 _0x8421=['rpc','jayson/promise','client','http','request','then','Cdr,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x1a9434,_0x5b710f){var _0xd10702=function(_0x4568db){while(--_0x4568db){_0x1a9434['push'](_0x1a9434['shift']());}};_0xd10702(++_0x5b710f);}(_0x8421,0xd6));var _0x1842=function(_0x49546a,_0x195a3f){_0x49546a=_0x49546a-0x0;var _0xca8c10=_0x8421[_0x49546a];return _0xca8c10;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x1842('0x0'));var rs=require(_0x1842('0x1'));var fs=require('fs');var Redis=require(_0x1842('0x2'));var db=require(_0x1842('0x3'))['db'];var utils=require(_0x1842('0x4'));var logger=require(_0x1842('0x5'))(_0x1842('0x6'));var config=require('../../config/environment');var jayson=require(_0x1842('0x7'));var client=jayson[_0x1842('0x8')][_0x1842('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x15e53f,_0x4d8431,_0x1a0f99){return new BPromise(function(_0x215398,_0x412a73){return client[_0x1842('0xa')](_0x15e53f,_0x1a0f99)[_0x1842('0xb')](function(_0x477ae1){logger['info'](_0x1842('0xc'),_0x4d8431,_0x1842('0xd'));logger[_0x1842('0xe')]('Cdr,\x20%s,\x20%s,\x20%s',_0x4d8431,'request\x20sent',JSON[_0x1842('0xf')](_0x477ae1));if(_0x477ae1[_0x1842('0x10')]){if(_0x477ae1[_0x1842('0x10')][_0x1842('0x11')]===0x1f4){logger[_0x1842('0x10')](_0x1842('0xc'),_0x4d8431,_0x477ae1[_0x1842('0x10')][_0x1842('0x12')]);return _0x412a73(_0x477ae1[_0x1842('0x10')][_0x1842('0x12')]);}logger[_0x1842('0x10')]('Cdr,\x20%s,\x20%s',_0x4d8431,_0x477ae1[_0x1842('0x10')][_0x1842('0x12')]);return _0x215398(_0x477ae1[_0x1842('0x10')][_0x1842('0x12')]);}else{logger[_0x1842('0x13')]('Cdr,\x20%s,\x20%s',_0x4d8431,_0x1842('0xd'));_0x215398(_0x477ae1[_0x1842('0x14')][_0x1842('0x12')]);}})[_0x1842('0x15')](function(_0x2bc176){logger[_0x1842('0x10')](_0x1842('0xc'),_0x4d8431,_0x2bc176);_0x412a73(_0x2bc176);});});} \ No newline at end of file +var _0x696f=['Cdr,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','info','Cdr,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x37fa13,_0x415be6){var _0x14a521=function(_0x4bb91c){while(--_0x4bb91c){_0x37fa13['push'](_0x37fa13['shift']());}};_0x14a521(++_0x415be6);}(_0x696f,0x160));var _0xf696=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x696f[_0x1facfa];return _0x9ec701;};'use strict';var _=require('lodash');var util=require(_0xf696('0x0'));var moment=require(_0xf696('0x1'));var BPromise=require(_0xf696('0x2'));var rs=require(_0xf696('0x3'));var fs=require('fs');var Redis=require(_0xf696('0x4'));var db=require(_0xf696('0x5'))['db'];var utils=require(_0xf696('0x6'));var logger=require('../../config/logger')(_0xf696('0x7'));var config=require('../../config/environment');var jayson=require(_0xf696('0x8'));var client=jayson[_0xf696('0x9')][_0xf696('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x46d69f,_0x280813,_0x15da4c){return new BPromise(function(_0x551c31,_0x3dcea7){return client[_0xf696('0xb')](_0x46d69f,_0x15da4c)['then'](function(_0x16ba91){logger[_0xf696('0xc')](_0xf696('0xd'),_0x280813,_0xf696('0xe'));logger[_0xf696('0xf')](_0xf696('0x10'),_0x280813,_0xf696('0xe'),JSON[_0xf696('0x11')](_0x16ba91));if(_0x16ba91[_0xf696('0x12')]){if(_0x16ba91[_0xf696('0x12')][_0xf696('0x13')]===0x1f4){logger[_0xf696('0x12')](_0xf696('0xd'),_0x280813,_0x16ba91['error'][_0xf696('0x14')]);return _0x3dcea7(_0x16ba91[_0xf696('0x12')][_0xf696('0x14')]);}logger[_0xf696('0x12')](_0xf696('0xd'),_0x280813,_0x16ba91[_0xf696('0x12')][_0xf696('0x14')]);return _0x551c31(_0x16ba91[_0xf696('0x12')][_0xf696('0x14')]);}else{logger[_0xf696('0xc')](_0xf696('0xd'),_0x280813,_0xf696('0xe'));_0x551c31(_0x16ba91[_0xf696('0x15')][_0xf696('0x14')]);}})[_0xf696('0x16')](function(_0x5caae7){logger[_0xf696('0x12')]('Cdr,\x20%s,\x20%s',_0x280813,_0x5caae7);_0x3dcea7(_0x5caae7);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index 360e76e..284b4e2 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(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_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(_0x14ec1d,_0x4d7cc3){var _0x3f5215=function(_0x5803ea){while(--_0x5803ea){_0x14ec1d['push'](_0x14ec1d['shift']());}};_0x3f5215(++_0x4d7cc3);}(_0xb10b,0x12a));var _0xbb10=function(_0x599318,_0x319486){_0x599318=_0x599318-0x0;var _0x7b06fa=_0xb10b[_0x599318];return _0x7b06fa;};'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 0bb3689..d908b99 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 _0x4121=['exports','INTEGER','STRING','noop','TEXT','*,*,*,*','sequelize'];(function(_0x5effcf,_0x47af59){var _0x4d123c=function(_0x24aaef){while(--_0x24aaef){_0x5effcf['push'](_0x5effcf['shift']());}};_0x4d123c(++_0x47af59);}(_0x4121,0x6f));var _0x1412=function(_0x207f7e,_0x12510d){_0x207f7e=_0x207f7e-0x0;var _0x48a3b8=_0x4121[_0x207f7e];return _0x48a3b8;};'use strict';var Sequelize=require(_0x1412('0x0'));module[_0x1412('0x1')]={'priority':{'type':Sequelize[_0x1412('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x1412('0x3')],'allowNull':![],'defaultValue':_0x1412('0x4')},'appdata':{'type':Sequelize[_0x1412('0x5')]()},'description':{'type':Sequelize[_0x1412('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x1412('0x6')}}; \ No newline at end of file +var _0xc7eb=['noop','TEXT','STRING','exports'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xc7eb,0x6f));var _0xbc7e=function(_0x231dda,_0x5b04cc){_0x231dda=_0x231dda-0x0;var _0x3f88cb=_0xc7eb[_0x231dda];return _0x3f88cb;};'use strict';var Sequelize=require('sequelize');module[_0xbc7e('0x0')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xbc7e('0x1')},'appdata':{'type':Sequelize[_0xbc7e('0x2')]()},'description':{'type':Sequelize[_0xbc7e('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index 6f1120c..eace936 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 _0x2917=['params','model','ChatApplication','keys','query','filters','intersection','attributes','fields','length','includeAll','include','merge','options','body','find','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','destroy','stack','name','send'];(function(_0x191917,_0x552ff4){var _0x52a7ec=function(_0x27ef7f){while(--_0x27ef7f){_0x191917['push'](_0x191917['shift']());}};_0x52a7ec(++_0x552ff4);}(_0x2917,0x142));var _0x7291=function(_0x38fb0d,_0x52b5db){_0x38fb0d=_0x38fb0d-0x0;var _0x30a5d6=_0x2917[_0x38fb0d];return _0x30a5d6;};'use strict';var emlformat=require(_0x7291('0x0'));var rimraf=require(_0x7291('0x1'));var zipdir=require(_0x7291('0x2'));var jsonpatch=require(_0x7291('0x3'));var rp=require(_0x7291('0x4'));var moment=require(_0x7291('0x5'));var BPromise=require(_0x7291('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x7291('0x7'));var sox=require(_0x7291('0x8'));var csv=require(_0x7291('0x9'));var ejs=require(_0x7291('0xa'));var fs=require('fs');var fs_extra=require(_0x7291('0xb'));var _=require(_0x7291('0xc'));var squel=require(_0x7291('0xd'));var crypto=require(_0x7291('0xe'));var jsforce=require(_0x7291('0xf'));var deskjs=require(_0x7291('0x10'));var toCsv=require(_0x7291('0x9'));var querystring=require(_0x7291('0x11'));var Papa=require(_0x7291('0x12'));var Redis=require(_0x7291('0x13'));var authService=require(_0x7291('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x7291('0x15'));var hardwareService=require(_0x7291('0x16'));var logger=require(_0x7291('0x17'))(_0x7291('0x18'));var utils=require(_0x7291('0x19'));var config=require(_0x7291('0x1a'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1834fa,_0x371a4d){_0x371a4d=_0x371a4d||0xcc;return function(_0x1ebbeb){if(_0x1ebbeb){return _0x1834fa[_0x7291('0x1b')](_0x371a4d);}return _0x1834fa[_0x7291('0x1c')](_0x371a4d)[_0x7291('0x1d')]();};}function respondWithResult(_0xc3166b,_0x54e3e6){_0x54e3e6=_0x54e3e6||0xc8;return function(_0xa667c8){if(_0xa667c8){return _0xc3166b[_0x7291('0x1c')](_0x54e3e6)[_0x7291('0x1e')](_0xa667c8);}};}function respondWithFilteredResult(_0x51d353,_0x55cca6){return function(_0x34808c){if(_0x34808c){var _0x304a33=typeof _0x55cca6[_0x7291('0x1f')]===_0x7291('0x20')&&typeof _0x55cca6[_0x7291('0x21')]===_0x7291('0x20');var _0x5517a1=_0x34808c[_0x7291('0x22')];var _0x1680d2=_0x304a33?0x0:_0x55cca6[_0x7291('0x1f')];var _0x4264ed=_0x304a33?_0x34808c[_0x7291('0x22')]:_0x55cca6['offset']+_0x55cca6[_0x7291('0x21')];var _0x52d5a7;if(_0x4264ed>=_0x5517a1){_0x4264ed=_0x5517a1;_0x52d5a7=0xc8;}else{_0x52d5a7=0xce;}_0x51d353[_0x7291('0x1c')](_0x52d5a7);return _0x51d353[_0x7291('0x23')](_0x7291('0x24'),_0x1680d2+'-'+_0x4264ed+'/'+_0x5517a1)['json'](_0x34808c);}return null;};}function patchUpdates(_0x53ba59){return function(_0x50c6db){try{jsonpatch[_0x7291('0x25')](_0x50c6db,_0x53ba59,!![]);}catch(_0x1aa349){return BPromise['reject'](_0x1aa349);}return _0x50c6db['save']();};}function saveUpdates(_0x56bf5f,_0x76a0c3){return function(_0x4cb42c){if(_0x4cb42c){return _0x4cb42c[_0x7291('0x26')](_0x56bf5f)[_0x7291('0x27')](function(_0x5d7fd8){return _0x5d7fd8;});}return null;};}function removeEntity(_0x3fa414,_0x5c5970){return function(_0x2a2c7c){if(_0x2a2c7c){return _0x2a2c7c[_0x7291('0x28')]()['then'](function(){_0x3fa414[_0x7291('0x1c')](0xcc)[_0x7291('0x1d')]();});}};}function handleEntityNotFound(_0x32169c,_0xa6f1eb){return function(_0x1dfa36){if(!_0x1dfa36){_0x32169c[_0x7291('0x1b')](0x194);}return _0x1dfa36;};}function handleError(_0x3b099f,_0x110d11){_0x110d11=_0x110d11||0x1f4;return function(_0x3fd1d2){logger['error'](_0x3fd1d2[_0x7291('0x29')]);if(_0x3fd1d2[_0x7291('0x2a')]){delete _0x3fd1d2['name'];}_0x3b099f[_0x7291('0x1c')](_0x110d11)[_0x7291('0x2b')](_0x3fd1d2);};}exports['show']=function(_0x386667,_0x45762f){var _0x522ef7={'raw':!![],'where':{'id':_0x386667[_0x7291('0x2c')]['id']}},_0x31207c={};_0x31207c[_0x7291('0x2d')]=_['keys'](db[_0x7291('0x2e')]['rawAttributes']);_0x31207c['query']=_[_0x7291('0x2f')](_0x386667[_0x7291('0x30')]);_0x31207c[_0x7291('0x31')]=_[_0x7291('0x32')](_0x31207c[_0x7291('0x2d')],_0x31207c[_0x7291('0x30')]);_0x522ef7[_0x7291('0x33')]=_[_0x7291('0x32')](_0x31207c[_0x7291('0x2d')],qs[_0x7291('0x34')](_0x386667[_0x7291('0x30')][_0x7291('0x34')]));_0x522ef7[_0x7291('0x33')]=_0x522ef7['attributes'][_0x7291('0x35')]?_0x522ef7['attributes']:_0x31207c['model'];if(_0x386667['query'][_0x7291('0x36')]){_0x522ef7[_0x7291('0x37')]=[{'all':!![]}];}_0x522ef7=_[_0x7291('0x38')]({},_0x522ef7,_0x386667[_0x7291('0x39')]);return db[_0x7291('0x2e')]['find'](_0x522ef7)[_0x7291('0x27')](handleEntityNotFound(_0x45762f,null))[_0x7291('0x27')](respondWithResult(_0x45762f,null))['catch'](handleError(_0x45762f,null));};exports[_0x7291('0x26')]=function(_0x193b6b,_0x1000bc){if(_0x193b6b[_0x7291('0x3a')]['id']){delete _0x193b6b['body']['id'];}return db['ChatApplication'][_0x7291('0x3b')]({'where':{'id':_0x193b6b[_0x7291('0x2c')]['id']}})['then'](handleEntityNotFound(_0x1000bc,null))['then'](saveUpdates(_0x193b6b[_0x7291('0x3a')],null))[_0x7291('0x27')](respondWithResult(_0x1000bc,null))[_0x7291('0x3c')](handleError(_0x1000bc,null));};exports[_0x7291('0x28')]=function(_0x255484,_0x51cc38){return db['ChatApplication'][_0x7291('0x3b')]({'where':{'id':_0x255484[_0x7291('0x2c')]['id']}})[_0x7291('0x27')](handleEntityNotFound(_0x51cc38,null))[_0x7291('0x27')](removeEntity(_0x51cc38,null))[_0x7291('0x3c')](handleError(_0x51cc38,null));}; \ No newline at end of file +var _0x65f4=['find','catch','body','params','zip-dir','fast-json-patch','request-promise','mustache','util','path','to-csv','ejs','fs-extra','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','status','error','stack','name','send','show','model','ChatApplication','query','keys','filters','attributes','fields','length','include','merge','options'];(function(_0x3a372f,_0x1514f2){var _0x5230a0=function(_0x2f64fb){while(--_0x2f64fb){_0x3a372f['push'](_0x3a372f['shift']());}};_0x5230a0(++_0x1514f2);}(_0x65f4,0x19a));var _0x465f=function(_0x18b493,_0x2cec15){_0x18b493=_0x18b493-0x0;var _0x204ab0=_0x65f4[_0x18b493];return _0x204ab0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x465f('0x0'));var jsonpatch=require(_0x465f('0x1'));var rp=require(_0x465f('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x465f('0x3'));var util=require(_0x465f('0x4'));var path=require(_0x465f('0x5'));var sox=require('sox');var csv=require(_0x465f('0x6'));var ejs=require(_0x465f('0x7'));var fs=require('fs');var fs_extra=require(_0x465f('0x8'));var _=require('lodash');var squel=require(_0x465f('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x465f('0xa'));var toCsv=require(_0x465f('0x6'));var querystring=require(_0x465f('0xb'));var Papa=require(_0x465f('0xc'));var Redis=require(_0x465f('0xd'));var authService=require(_0x465f('0xe'));var qs=require(_0x465f('0xf'));var as=require(_0x465f('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x465f('0x11'))(_0x465f('0x12'));var utils=require(_0x465f('0x13'));var config=require(_0x465f('0x14'));var licenseUtil=require(_0x465f('0x15'));var db=require(_0x465f('0x16'))['db'];function respondWithStatusCode(_0xa52fdb,_0x2fce97){_0x2fce97=_0x2fce97||0xcc;return function(_0x30e5ba){if(_0x30e5ba){return _0xa52fdb['sendStatus'](_0x2fce97);}return _0xa52fdb['status'](_0x2fce97)[_0x465f('0x17')]();};}function respondWithResult(_0x2558a0,_0x2cb09c){_0x2cb09c=_0x2cb09c||0xc8;return function(_0x3a6c49){if(_0x3a6c49){return _0x2558a0['status'](_0x2cb09c)[_0x465f('0x18')](_0x3a6c49);}};}function respondWithFilteredResult(_0xaffeac,_0x52f29d){return function(_0x5f25d0){if(_0x5f25d0){var _0x20beae=typeof _0x52f29d[_0x465f('0x19')]===_0x465f('0x1a')&&typeof _0x52f29d[_0x465f('0x1b')]===_0x465f('0x1a');var _0x5e9726=_0x5f25d0[_0x465f('0x1c')];var _0x99845e=_0x20beae?0x0:_0x52f29d[_0x465f('0x19')];var _0x5d469c=_0x20beae?_0x5f25d0[_0x465f('0x1c')]:_0x52f29d[_0x465f('0x19')]+_0x52f29d['limit'];var _0x3d9ec1;if(_0x5d469c>=_0x5e9726){_0x5d469c=_0x5e9726;_0x3d9ec1=0xc8;}else{_0x3d9ec1=0xce;}_0xaffeac['status'](_0x3d9ec1);return _0xaffeac[_0x465f('0x1d')](_0x465f('0x1e'),_0x99845e+'-'+_0x5d469c+'/'+_0x5e9726)[_0x465f('0x18')](_0x5f25d0);}return null;};}function patchUpdates(_0xc90d88){return function(_0x3c5ad0){try{jsonpatch[_0x465f('0x1f')](_0x3c5ad0,_0xc90d88,!![]);}catch(_0x2cd76d){return BPromise[_0x465f('0x20')](_0x2cd76d);}return _0x3c5ad0[_0x465f('0x21')]();};}function saveUpdates(_0x3d4dea,_0x36f8eb){return function(_0x4aa4a8){if(_0x4aa4a8){return _0x4aa4a8[_0x465f('0x22')](_0x3d4dea)[_0x465f('0x23')](function(_0x371b16){return _0x371b16;});}return null;};}function removeEntity(_0x317aed,_0x1d6677){return function(_0x2566e3){if(_0x2566e3){return _0x2566e3[_0x465f('0x24')]()[_0x465f('0x23')](function(){_0x317aed[_0x465f('0x25')](0xcc)[_0x465f('0x17')]();});}};}function handleEntityNotFound(_0x59ace5,_0x186fff){return function(_0x329007){if(!_0x329007){_0x59ace5['sendStatus'](0x194);}return _0x329007;};}function handleError(_0x5a9fc3,_0xc45dc){_0xc45dc=_0xc45dc||0x1f4;return function(_0x3cd248){logger[_0x465f('0x26')](_0x3cd248[_0x465f('0x27')]);if(_0x3cd248[_0x465f('0x28')]){delete _0x3cd248[_0x465f('0x28')];}_0x5a9fc3[_0x465f('0x25')](_0xc45dc)[_0x465f('0x29')](_0x3cd248);};}exports[_0x465f('0x2a')]=function(_0x190506,_0x5299c4){var _0x222240={'raw':!![],'where':{'id':_0x190506['params']['id']}},_0x3ad80e={};_0x3ad80e[_0x465f('0x2b')]=_['keys'](db[_0x465f('0x2c')]['rawAttributes']);_0x3ad80e[_0x465f('0x2d')]=_[_0x465f('0x2e')](_0x190506[_0x465f('0x2d')]);_0x3ad80e[_0x465f('0x2f')]=_['intersection'](_0x3ad80e[_0x465f('0x2b')],_0x3ad80e[_0x465f('0x2d')]);_0x222240[_0x465f('0x30')]=_['intersection'](_0x3ad80e[_0x465f('0x2b')],qs[_0x465f('0x31')](_0x190506[_0x465f('0x2d')]['fields']));_0x222240[_0x465f('0x30')]=_0x222240[_0x465f('0x30')][_0x465f('0x32')]?_0x222240[_0x465f('0x30')]:_0x3ad80e[_0x465f('0x2b')];if(_0x190506['query']['includeAll']){_0x222240[_0x465f('0x33')]=[{'all':!![]}];}_0x222240=_[_0x465f('0x34')]({},_0x222240,_0x190506[_0x465f('0x35')]);return db['ChatApplication'][_0x465f('0x36')](_0x222240)['then'](handleEntityNotFound(_0x5299c4,null))[_0x465f('0x23')](respondWithResult(_0x5299c4,null))[_0x465f('0x37')](handleError(_0x5299c4,null));};exports[_0x465f('0x22')]=function(_0x42bf29,_0xa6ad18){if(_0x42bf29[_0x465f('0x38')]['id']){delete _0x42bf29['body']['id'];}return db['ChatApplication'][_0x465f('0x36')]({'where':{'id':_0x42bf29[_0x465f('0x39')]['id']}})[_0x465f('0x23')](handleEntityNotFound(_0xa6ad18,null))[_0x465f('0x23')](saveUpdates(_0x42bf29[_0x465f('0x38')],null))['then'](respondWithResult(_0xa6ad18,null))[_0x465f('0x37')](handleError(_0xa6ad18,null));};exports[_0x465f('0x24')]=function(_0x3b388e,_0xe7d78d){return db['ChatApplication']['find']({'where':{'id':_0x3b388e[_0x465f('0x39')]['id']}})['then'](handleEntityNotFound(_0xe7d78d,null))[_0x465f('0x23')](removeEntity(_0xe7d78d,null))[_0x465f('0x37')](handleError(_0xe7d78d,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index 35acce9..951f328 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 _0xb845=['define','ChatApplication','chat_applications','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./chatApplication.attributes','exports'];(function(_0x320766,_0x24d128){var _0x90d850=function(_0x39cb90){while(--_0x39cb90){_0x320766['push'](_0x320766['shift']());}};_0x90d850(++_0x24d128);}(_0xb845,0x18b));var _0x5b84=function(_0x3d2c06,_0x3cc8f3){_0x3d2c06=_0x3d2c06-0x0;var _0x36c85f=_0xb845[_0x3d2c06];return _0x36c85f;};'use strict';var _=require('lodash');var util=require(_0x5b84('0x0'));var logger=require(_0x5b84('0x1'))(_0x5b84('0x2'));var moment=require('moment');var BPromise=require(_0x5b84('0x3'));var rp=require(_0x5b84('0x4'));var fs=require('fs');var path=require(_0x5b84('0x5'));var rimraf=require(_0x5b84('0x6'));var config=require(_0x5b84('0x7'));var attributes=require(_0x5b84('0x8'));module[_0x5b84('0x9')]=function(_0x427221,_0x15bf6b){return _0x427221[_0x5b84('0xa')](_0x5b84('0xb'),attributes,{'tableName':_0x5b84('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x5b84('0xd'),'collate':_0x5b84('0xe')});}; \ No newline at end of file +var _0x087a=['define','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','path','exports'];(function(_0x41382c,_0xc3ffd1){var _0x4da35b=function(_0x5d56b8){while(--_0x5d56b8){_0x41382c['push'](_0x41382c['shift']());}};_0x4da35b(++_0xc3ffd1);}(_0x087a,0xde));var _0xa087=function(_0x42ed30,_0x1ff963){_0x42ed30=_0x42ed30-0x0;var _0x21374b=_0x087a[_0x42ed30];return _0x21374b;};'use strict';var _=require(_0xa087('0x0'));var util=require(_0xa087('0x1'));var logger=require(_0xa087('0x2'))(_0xa087('0x3'));var moment=require(_0xa087('0x4'));var BPromise=require(_0xa087('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa087('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./chatApplication.attributes');module[_0xa087('0x7')]=function(_0xc05115,_0xc8eecc){return _0xc05115[_0xa087('0x8')]('ChatApplication',attributes,{'tableName':'chat_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xa087('0x9')});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index aecfb4e..196ad50 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 _0xd585=['code','message','result','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','then','ChatApplication,\x20%s,\x20%s','debug','ChatApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x23445d,_0x371efe){var _0x928037=function(_0x373920){while(--_0x373920){_0x23445d['push'](_0x23445d['shift']());}};_0x928037(++_0x371efe);}(_0xd585,0x146));var _0x5d58=function(_0x223245,_0x492f16){_0x223245=_0x223245-0x0;var _0x3d93ec=_0xd585[_0x223245];return _0x3d93ec;};'use strict';var _=require(_0x5d58('0x0'));var util=require(_0x5d58('0x1'));var moment=require('moment');var BPromise=require(_0x5d58('0x2'));var rs=require(_0x5d58('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5d58('0x4'))['db'];var utils=require(_0x5d58('0x5'));var logger=require('../../config/logger')(_0x5d58('0x6'));var config=require(_0x5d58('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x5d58('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0xdcae69,_0x3b9dca,_0x6bc015){return new BPromise(function(_0x186b42,_0x1166bb){return client['request'](_0xdcae69,_0x6bc015)[_0x5d58('0x9')](function(_0x5e9a2a){logger['info'](_0x5d58('0xa'),_0x3b9dca,'request\x20sent');logger[_0x5d58('0xb')](_0x5d58('0xc'),_0x3b9dca,_0x5d58('0xd'),JSON[_0x5d58('0xe')](_0x5e9a2a));if(_0x5e9a2a[_0x5d58('0xf')]){if(_0x5e9a2a[_0x5d58('0xf')][_0x5d58('0x10')]===0x1f4){logger[_0x5d58('0xf')](_0x5d58('0xa'),_0x3b9dca,_0x5e9a2a['error'][_0x5d58('0x11')]);return _0x1166bb(_0x5e9a2a['error']['message']);}logger[_0x5d58('0xf')](_0x5d58('0xa'),_0x3b9dca,_0x5e9a2a['error']['message']);return _0x186b42(_0x5e9a2a[_0x5d58('0xf')][_0x5d58('0x11')]);}else{logger['info'](_0x5d58('0xa'),_0x3b9dca,_0x5d58('0xd'));_0x186b42(_0x5e9a2a[_0x5d58('0x12')][_0x5d58('0x11')]);}})['catch'](function(_0x1897e9){logger['error'](_0x5d58('0xa'),_0x3b9dca,_0x1897e9);_0x1166bb(_0x1897e9);});});} \ No newline at end of file +var _0xc5ea=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment'];(function(_0x397cfb,_0xb8f317){var _0x15fed9=function(_0x3eba43){while(--_0x3eba43){_0x397cfb['push'](_0x397cfb['shift']());}};_0x15fed9(++_0xb8f317);}(_0xc5ea,0xed));var _0xac5e=function(_0x289f63,_0xaf65fa){_0x289f63=_0x289f63-0x0;var _0x2cc09f=_0xc5ea[_0x289f63];return _0x2cc09f;};'use strict';var _=require(_0xac5e('0x0'));var util=require(_0xac5e('0x1'));var moment=require(_0xac5e('0x2'));var BPromise=require(_0xac5e('0x3'));var rs=require(_0xac5e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xac5e('0x5'))['db'];var utils=require(_0xac5e('0x6'));var logger=require(_0xac5e('0x7'))(_0xac5e('0x8'));var config=require(_0xac5e('0x9'));var jayson=require(_0xac5e('0xa'));var client=jayson[_0xac5e('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x456924,_0x548ac0,_0x2f188b){return new BPromise(function(_0x29d6af,_0x2877e0){return client[_0xac5e('0xc')](_0x456924,_0x2f188b)['then'](function(_0x21fbe2){logger[_0xac5e('0xd')](_0xac5e('0xe'),_0x548ac0,_0xac5e('0xf'));logger[_0xac5e('0x10')](_0xac5e('0x11'),_0x548ac0,'request\x20sent',JSON[_0xac5e('0x12')](_0x21fbe2));if(_0x21fbe2[_0xac5e('0x13')]){if(_0x21fbe2[_0xac5e('0x13')][_0xac5e('0x14')]===0x1f4){logger['error'](_0xac5e('0xe'),_0x548ac0,_0x21fbe2[_0xac5e('0x13')][_0xac5e('0x15')]);return _0x2877e0(_0x21fbe2['error']['message']);}logger['error'](_0xac5e('0xe'),_0x548ac0,_0x21fbe2[_0xac5e('0x13')][_0xac5e('0x15')]);return _0x29d6af(_0x21fbe2[_0xac5e('0x13')][_0xac5e('0x15')]);}else{logger[_0xac5e('0xd')]('ChatApplication,\x20%s,\x20%s',_0x548ac0,'request\x20sent');_0x29d6af(_0x21fbe2[_0xac5e('0x16')]['message']);}})[_0xac5e('0x17')](function(_0x3522ed){logger[_0xac5e('0x13')](_0xac5e('0xe'),_0x548ac0,_0x3522ed);_0x2877e0(_0x3522ed);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index 7c66790..7cf63e8 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 _0xb99f=['update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatApplication.controller','get','isAuthenticated','put','/:id'];(function(_0x2153c9,_0x49dad4){var _0x1bbb2a=function(_0x5e240e){while(--_0x5e240e){_0x2153c9['push'](_0x2153c9['shift']());}};_0x1bbb2a(++_0x49dad4);}(_0xb99f,0x1df));var _0xfb99=function(_0x35007a,_0x58a0d4){_0x35007a=_0x35007a-0x0;var _0x574f68=_0xb99f[_0x35007a];return _0x574f68;};'use strict';var multer=require('multer');var util=require(_0xfb99('0x0'));var path=require(_0xfb99('0x1'));var timeout=require(_0xfb99('0x2'));var express=require(_0xfb99('0x3'));var router=express[_0xfb99('0x4')]();var fs_extra=require(_0xfb99('0x5'));var auth=require(_0xfb99('0x6'));var interaction=require(_0xfb99('0x7'));var config=require(_0xfb99('0x8'));var controller=require(_0xfb99('0x9'));router[_0xfb99('0xa')]('/:id',auth[_0xfb99('0xb')](),controller['show']);router[_0xfb99('0xc')](_0xfb99('0xd'),auth[_0xfb99('0xb')](),controller[_0xfb99('0xe')]);router[_0xfb99('0xf')](_0xfb99('0xd'),auth[_0xfb99('0xb')](),controller['destroy']);module[_0xfb99('0x10')]=router; \ No newline at end of file +var _0x5d15=['multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./chatApplication.controller','get','/:id','isAuthenticated','update','delete','destroy','exports'];(function(_0x51aa00,_0x4f72ba){var _0x20194d=function(_0x3aedf6){while(--_0x3aedf6){_0x51aa00['push'](_0x51aa00['shift']());}};_0x20194d(++_0x4f72ba);}(_0x5d15,0xff));var _0x55d1=function(_0xd21fe7,_0x225a39){_0xd21fe7=_0xd21fe7-0x0;var _0x14d570=_0x5d15[_0xd21fe7];return _0x14d570;};'use strict';var multer=require(_0x55d1('0x0'));var util=require(_0x55d1('0x1'));var path=require('path');var timeout=require(_0x55d1('0x2'));var express=require(_0x55d1('0x3'));var router=express[_0x55d1('0x4')]();var fs_extra=require(_0x55d1('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x55d1('0x6'));var config=require('../../config/environment');var controller=require(_0x55d1('0x7'));router[_0x55d1('0x8')](_0x55d1('0x9'),auth[_0x55d1('0xa')](),controller['show']);router['put'](_0x55d1('0x9'),auth[_0x55d1('0xa')](),controller[_0x55d1('0xb')]);router[_0x55d1('0xc')](_0x55d1('0x9'),auth[_0x55d1('0xa')](),controller[_0x55d1('0xd')]);module[_0x55d1('0xe')]=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index 724c8a9..a25f4f1 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 _0xd664=['exports','sequelize'];(function(_0x1299be,_0x3413eb){var _0x4d4845=function(_0x10f602){while(--_0x10f602){_0x1299be['push'](_0x1299be['shift']());}};_0x4d4845(++_0x3413eb);}(_0xd664,0xa5));var _0x4d66=function(_0x2c415d,_0x128945){_0x2c415d=_0x2c415d-0x0;var _0x40763b=_0xd664[_0x2c415d];return _0x40763b;};'use strict';var Sequelize=require(_0x4d66('0x0'));module[_0x4d66('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'write':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0x68a9=['STRING','sequelize','exports'];(function(_0x4f6091,_0x5bcd42){var _0x599ff1=function(_0x3954bd){while(--_0x3954bd){_0x4f6091['push'](_0x4f6091['shift']());}};_0x599ff1(++_0x5bcd42);}(_0x68a9,0x106));var _0x968a=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0x68a9[_0x311c35];return _0x5cc50c;};'use strict';var Sequelize=require(_0x968a('0x0'));module[_0x968a('0x1')]={'name':{'type':Sequelize[_0x968a('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x968a('0x2')]},'write':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index e3a54ef..00833d1 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 _0x6da7=['bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','socket.io-emitter','./chatGroup.socket','end','status','json','offset','undefined','apply','reject','update','then','sendStatus','error','stack','name','ChatGroup','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','VIRTUAL','filter','options','count','findAll','catch','show','params','includeAll','include','find','body','describe','getUnread','user','toInteger','addMembers','ids','omit','findOne','User','getMembers','removeMembers','ChatGroupId','ChatInternalMessage','create','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','getMessages','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x36625c,_0x127de4){var _0x1272a6=function(_0x2c3c61){while(--_0x2c3c61){_0x36625c['push'](_0x36625c['shift']());}};_0x1272a6(++_0x127de4);}(_0x6da7,0xb6));var _0x76da=function(_0x358459,_0x5b114c){_0x358459=_0x358459-0x0;var _0x4a138e=_0x6da7[_0x358459];return _0x4a138e;};'use strict';var emlformat=require(_0x76da('0x0'));var rimraf=require(_0x76da('0x1'));var zipdir=require(_0x76da('0x2'));var jsonpatch=require(_0x76da('0x3'));var rp=require(_0x76da('0x4'));var moment=require(_0x76da('0x5'));var BPromise=require(_0x76da('0x6'));var Mustache=require(_0x76da('0x7'));var util=require(_0x76da('0x8'));var path=require(_0x76da('0x9'));var sox=require('sox');var csv=require(_0x76da('0xa'));var ejs=require(_0x76da('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x76da('0xc'));var squel=require(_0x76da('0xd'));var crypto=require(_0x76da('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x76da('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x76da('0x10'));var authService=require(_0x76da('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x76da('0x12'));var hardwareService=require(_0x76da('0x13'));var logger=require(_0x76da('0x14'))('api');var utils=require(_0x76da('0x15'));var config=require(_0x76da('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x76da('0x17'))['db'];config['redis']=_[_0x76da('0x18')](config[_0x76da('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x76da('0x1a'))(new Redis(config['redis']));require(_0x76da('0x1b'))['register'](socket);function respondWithStatusCode(_0xb523c3,_0x2bc0e6){_0x2bc0e6=_0x2bc0e6||0xcc;return function(_0x10b330){if(_0x10b330){return _0xb523c3['sendStatus'](_0x2bc0e6);}return _0xb523c3['status'](_0x2bc0e6)[_0x76da('0x1c')]();};}function respondWithResult(_0xe984e,_0xb100e8){_0xb100e8=_0xb100e8||0xc8;return function(_0x4f919a){if(_0x4f919a){return _0xe984e[_0x76da('0x1d')](_0xb100e8)[_0x76da('0x1e')](_0x4f919a);}};}function respondWithFilteredResult(_0x3e7795,_0x4c3960){return function(_0x2f2bdb){if(_0x2f2bdb){var _0x2465a4=typeof _0x4c3960[_0x76da('0x1f')]===_0x76da('0x20')&&typeof _0x4c3960['limit']===_0x76da('0x20');var _0x2bb244=_0x2f2bdb['count'];var _0x3f6f37=_0x2465a4?0x0:_0x4c3960[_0x76da('0x1f')];var _0x16ae3f=_0x2465a4?_0x2f2bdb['count']:_0x4c3960[_0x76da('0x1f')]+_0x4c3960['limit'];var _0x5c983b;if(_0x16ae3f>=_0x2bb244){_0x16ae3f=_0x2bb244;_0x5c983b=0xc8;}else{_0x5c983b=0xce;}_0x3e7795[_0x76da('0x1d')](_0x5c983b);return _0x3e7795['set']('Content-Range',_0x3f6f37+'-'+_0x16ae3f+'/'+_0x2bb244)[_0x76da('0x1e')](_0x2f2bdb);}return null;};}function patchUpdates(_0x302a51){return function(_0x26a9bd){try{jsonpatch[_0x76da('0x21')](_0x26a9bd,_0x302a51,!![]);}catch(_0x11d98b){return BPromise[_0x76da('0x22')](_0x11d98b);}return _0x26a9bd['save']();};}function saveUpdates(_0x52598a,_0x5e17d0){return function(_0x52c8cf){if(_0x52c8cf){return _0x52c8cf[_0x76da('0x23')](_0x52598a)[_0x76da('0x24')](function(_0x14c00c){return _0x14c00c;});}return null;};}function removeEntity(_0x1efa9c,_0x41717b){return function(_0x20b212){if(_0x20b212){return _0x20b212['destroy']()[_0x76da('0x24')](function(){_0x1efa9c[_0x76da('0x1d')](0xcc)[_0x76da('0x1c')]();});}};}function handleEntityNotFound(_0x2a2aa5,_0x2d0695){return function(_0x31ee58){if(!_0x31ee58){_0x2a2aa5[_0x76da('0x25')](0x194);}return _0x31ee58;};}function handleError(_0x2cfa9c,_0x81e958){_0x81e958=_0x81e958||0x1f4;return function(_0x531abb){logger[_0x76da('0x26')](_0x531abb[_0x76da('0x27')]);if(_0x531abb[_0x76da('0x28')]){delete _0x531abb[_0x76da('0x28')];}_0x2cfa9c[_0x76da('0x1d')](_0x81e958)['send'](_0x531abb);};}exports['index']=function(_0x368bde,_0x251197){var _0x28f7fd={},_0x193bb1={},_0x3ead98={'count':0x0,'rows':[]};var _0x3cf56b=_['map'](db[_0x76da('0x29')][_0x76da('0x2a')],function(_0x5e3457){return{'name':_0x5e3457[_0x76da('0x2b')],'type':_0x5e3457[_0x76da('0x2c')][_0x76da('0x2d')]};});_0x193bb1[_0x76da('0x2e')]=_[_0x76da('0x2f')](_0x3cf56b,_0x76da('0x28'));_0x193bb1[_0x76da('0x30')]=_[_0x76da('0x31')](_0x368bde[_0x76da('0x30')]);_0x193bb1[_0x76da('0x32')]=_[_0x76da('0x33')](_0x193bb1[_0x76da('0x2e')],_0x193bb1['query']);_0x28f7fd[_0x76da('0x34')]=_[_0x76da('0x33')](_0x193bb1[_0x76da('0x2e')],qs['fields'](_0x368bde['query'][_0x76da('0x35')]));_0x28f7fd[_0x76da('0x34')]=_0x28f7fd[_0x76da('0x34')][_0x76da('0x36')]?_0x28f7fd[_0x76da('0x34')]:_0x193bb1[_0x76da('0x2e')];if(!_0x368bde['query'][_0x76da('0x37')](_0x76da('0x38'))){_0x28f7fd[_0x76da('0x39')]=qs['limit'](_0x368bde[_0x76da('0x30')][_0x76da('0x39')]);_0x28f7fd['offset']=qs[_0x76da('0x1f')](_0x368bde[_0x76da('0x30')][_0x76da('0x1f')]);}_0x28f7fd[_0x76da('0x3a')]=qs[_0x76da('0x3b')](_0x368bde[_0x76da('0x30')][_0x76da('0x3b')]);_0x28f7fd[_0x76da('0x3c')]=qs[_0x76da('0x32')](_[_0x76da('0x3d')](_0x368bde['query'],_0x193bb1['filters']),_0x3cf56b);if(_0x368bde[_0x76da('0x30')]['filter']){_0x28f7fd[_0x76da('0x3c')]=_[_0x76da('0x3e')](_0x28f7fd[_0x76da('0x3c')],{'$or':_[_0x76da('0x2f')](_0x3cf56b,function(_0x387085){if(_0x387085['type']!==_0x76da('0x3f')){var _0xf2638a={};_0xf2638a[_0x387085['name']]={'$like':'%'+_0x368bde['query'][_0x76da('0x40')]+'%'};return _0xf2638a;}})});}_0x28f7fd=_[_0x76da('0x3e')]({},_0x28f7fd,_0x368bde[_0x76da('0x41')]);var _0x3a71b6={'where':_0x28f7fd[_0x76da('0x3c')]};return db[_0x76da('0x29')][_0x76da('0x42')](_0x3a71b6)[_0x76da('0x24')](function(_0x103c1c){_0x3ead98[_0x76da('0x42')]=_0x103c1c;if(_0x368bde['query']['includeAll']){_0x28f7fd['include']=[{'all':!![]}];}return db[_0x76da('0x29')][_0x76da('0x43')](_0x28f7fd);})[_0x76da('0x24')](function(_0x4e4044){_0x3ead98['rows']=_0x4e4044;return _0x3ead98;})['then'](respondWithFilteredResult(_0x251197,_0x28f7fd))[_0x76da('0x44')](handleError(_0x251197,null));};exports[_0x76da('0x45')]=function(_0x5505fc,_0x2d30a1){var _0x447d53={'raw':!![],'where':{'id':_0x5505fc[_0x76da('0x46')]['id']}},_0x3e4c5b={};_0x3e4c5b[_0x76da('0x2e')]=_[_0x76da('0x31')](db[_0x76da('0x29')][_0x76da('0x2a')]);_0x3e4c5b[_0x76da('0x30')]=_[_0x76da('0x31')](_0x5505fc['query']);_0x3e4c5b[_0x76da('0x32')]=_['intersection'](_0x3e4c5b[_0x76da('0x2e')],_0x3e4c5b[_0x76da('0x30')]);_0x447d53['attributes']=_[_0x76da('0x33')](_0x3e4c5b[_0x76da('0x2e')],qs[_0x76da('0x35')](_0x5505fc[_0x76da('0x30')][_0x76da('0x35')]));_0x447d53['attributes']=_0x447d53[_0x76da('0x34')][_0x76da('0x36')]?_0x447d53[_0x76da('0x34')]:_0x3e4c5b['model'];if(_0x5505fc['query'][_0x76da('0x47')]){_0x447d53[_0x76da('0x48')]=[{'all':!![]}];}_0x447d53=_[_0x76da('0x3e')]({},_0x447d53,_0x5505fc[_0x76da('0x41')]);return db[_0x76da('0x29')][_0x76da('0x49')](_0x447d53)['then'](handleEntityNotFound(_0x2d30a1,null))[_0x76da('0x24')](respondWithResult(_0x2d30a1,null))[_0x76da('0x44')](handleError(_0x2d30a1,null));};exports['create']=function(_0x4decb1,_0x4c63f6){return db[_0x76da('0x29')]['create'](_0x4decb1['body'],{})['then'](respondWithResult(_0x4c63f6,0xc9))[_0x76da('0x44')](handleError(_0x4c63f6,null));};exports[_0x76da('0x23')]=function(_0x334f29,_0x1db1b7){if(_0x334f29[_0x76da('0x4a')]['id']){delete _0x334f29['body']['id'];}return db['ChatGroup'][_0x76da('0x49')]({'where':{'id':_0x334f29[_0x76da('0x46')]['id']}})['then'](handleEntityNotFound(_0x1db1b7,null))[_0x76da('0x24')](saveUpdates(_0x334f29[_0x76da('0x4a')],null))[_0x76da('0x24')](respondWithResult(_0x1db1b7,null))[_0x76da('0x44')](handleError(_0x1db1b7,null));};exports['destroy']=function(_0x388079,_0x2e9d00){return db[_0x76da('0x29')][_0x76da('0x49')]({'where':{'id':_0x388079['params']['id']}})['then'](handleEntityNotFound(_0x2e9d00,null))[_0x76da('0x24')](removeEntity(_0x2e9d00,null))[_0x76da('0x44')](handleError(_0x2e9d00,null));};exports[_0x76da('0x4b')]=function(_0x31ce34,_0x1ae03f){return db[_0x76da('0x29')][_0x76da('0x4b')]()[_0x76da('0x24')](respondWithResult(_0x1ae03f,null))[_0x76da('0x44')](handleError(_0x1ae03f,null));};exports[_0x76da('0x4c')]=function(_0x2578fa,_0x41e41d,_0x24e06f){return db['ChatInternalMessage']['count']({'where':{'ChatGroupId':_0x2578fa[_0x76da('0x46')]['id'],'ToId':_0x2578fa[_0x76da('0x4d')]['id'],'read':![]}})['then'](function(_0x515916){return{'id':_[_0x76da('0x4e')](_0x2578fa[_0x76da('0x46')]['id']),'count':_0x515916};})[_0x76da('0x24')](respondWithResult(_0x41e41d,null))[_0x76da('0x44')](handleError(_0x41e41d,null));};exports['addMembers']=function(_0x266988,_0x579cea,_0x27ddec){return db[_0x76da('0x29')][_0x76da('0x49')]({'where':{'id':_0x266988[_0x76da('0x46')]['id']}})[_0x76da('0x24')](handleEntityNotFound(_0x579cea,null))[_0x76da('0x24')](function(_0x2987ba){if(_0x2987ba){return _0x2987ba[_0x76da('0x4f')](_0x266988[_0x76da('0x4a')][_0x76da('0x50')],_[_0x76da('0x51')](_0x266988['body'],[_0x76da('0x50'),'id'])||{});}})[_0x76da('0x24')](respondWithResult(_0x579cea,null))['catch'](handleError(_0x579cea,null));};exports['getMembers']=function(_0x2ceb3b,_0x15d148,_0x9870fa){var _0x477c34={};var _0x462e6d={};var _0x4a4cec;var _0x329762;return db[_0x76da('0x29')][_0x76da('0x52')]({'where':{'id':_0x2ceb3b[_0x76da('0x46')]['id']}})[_0x76da('0x24')](handleEntityNotFound(_0x15d148,null))[_0x76da('0x24')](function(_0x1632c1){if(_0x1632c1){_0x4a4cec=_0x1632c1;_0x462e6d['model']=_[_0x76da('0x31')](db[_0x76da('0x53')][_0x76da('0x2a')]);_0x462e6d[_0x76da('0x30')]=_[_0x76da('0x31')](_0x2ceb3b[_0x76da('0x30')]);_0x462e6d[_0x76da('0x32')]=_[_0x76da('0x33')](_0x462e6d[_0x76da('0x2e')],_0x462e6d[_0x76da('0x30')]);_0x477c34[_0x76da('0x34')]=_[_0x76da('0x33')](_0x462e6d[_0x76da('0x2e')],qs[_0x76da('0x35')](_0x2ceb3b[_0x76da('0x30')]['fields']));_0x477c34[_0x76da('0x34')]=_0x477c34[_0x76da('0x34')][_0x76da('0x36')]?_0x477c34['attributes']:_0x462e6d[_0x76da('0x2e')];_0x477c34[_0x76da('0x3a')]=qs['sort'](_0x2ceb3b[_0x76da('0x30')][_0x76da('0x3b')]);_0x477c34[_0x76da('0x3c')]=qs[_0x76da('0x32')](_[_0x76da('0x3d')](_0x2ceb3b[_0x76da('0x30')],_0x462e6d[_0x76da('0x32')]));if(_0x2ceb3b[_0x76da('0x30')]['filter']){_0x477c34[_0x76da('0x3c')]=_['merge'](_0x477c34['where'],{'$or':_[_0x76da('0x2f')](_0x477c34[_0x76da('0x34')],function(_0x169266){var _0x4ac3ff={};_0x4ac3ff[_0x169266]={'$like':'%'+_0x2ceb3b['query'][_0x76da('0x40')]+'%'};return _0x4ac3ff;})});}_0x477c34=_['merge']({},_0x477c34,_0x2ceb3b[_0x76da('0x41')]);return _0x4a4cec[_0x76da('0x54')](_0x477c34);}})[_0x76da('0x24')](function(_0xda01af){if(_0xda01af){_0x329762=_0xda01af[_0x76da('0x36')];if(!_0x2ceb3b[_0x76da('0x30')]['hasOwnProperty'](_0x76da('0x38'))){_0x477c34[_0x76da('0x39')]=qs[_0x76da('0x39')](_0x2ceb3b['query'][_0x76da('0x39')]);_0x477c34[_0x76da('0x1f')]=qs['offset'](_0x2ceb3b[_0x76da('0x30')]['offset']);}return _0x4a4cec[_0x76da('0x54')](_0x477c34);}})[_0x76da('0x24')](function(_0xee262a){if(_0xee262a){return _0xee262a?{'count':_0x329762,'rows':_0xee262a}:null;}})['then'](respondWithResult(_0x15d148,null))[_0x76da('0x44')](handleError(_0x15d148,null));};exports[_0x76da('0x55')]=function(_0x586345,_0x4d79e8,_0x124bd9){return db['ChatGroup'][_0x76da('0x49')]({'where':{'id':_0x586345['params']['id']}})[_0x76da('0x24')](handleEntityNotFound(_0x4d79e8,null))[_0x76da('0x24')](function(_0x8d0171){if(_0x8d0171){return _0x8d0171[_0x76da('0x55')](_0x586345[_0x76da('0x30')][_0x76da('0x50')]);}})['then'](respondWithStatusCode(_0x4d79e8,null))[_0x76da('0x44')](handleError(_0x4d79e8,null));};exports['addMessage']=function(_0x20e616,_0x4f5148,_0x27c70a){if(_0x20e616[_0x76da('0x4a')]['id']){delete _0x20e616[_0x76da('0x4a')]['id'];}return db['ChatGroup']['find']({'where':{'id':_0x20e616[_0x76da('0x46')]['id']}})[_0x76da('0x24')](handleEntityNotFound(_0x4f5148,null))[_0x76da('0x24')](function(_0x336d6f){if(_0x336d6f){_0x20e616['body'][_0x76da('0x56')]=_0x336d6f['id'];return db[_0x76da('0x57')][_0x76da('0x58')](_0x20e616['body']);}})[_0x76da('0x24')](respondWithResult(_0x4f5148,null))[_0x76da('0x44')](handleError(_0x4f5148,null));};exports['getMessages']=function(_0xb07c93,_0x40df75,_0x34191a){var _0x599dda={};var _0x446a1c={};var _0x4c91c9;var _0x2c756b;return db['ChatGroup'][_0x76da('0x52')]({'where':{'id':_0xb07c93['params']['id']}})['then'](handleEntityNotFound(_0x40df75,null))['then'](function(_0x569988){if(_0x569988){_0x4c91c9=_0x569988;_0x446a1c['model']=_[_0x76da('0x31')](db[_0x76da('0x57')][_0x76da('0x2a')]);_0x446a1c['query']=_['keys'](_0xb07c93[_0x76da('0x30')]);_0x446a1c[_0x76da('0x32')]=_[_0x76da('0x33')](_0x446a1c[_0x76da('0x2e')],_0x446a1c['query']);_0x599dda[_0x76da('0x34')]=_[_0x76da('0x33')](_0x446a1c[_0x76da('0x2e')],qs[_0x76da('0x35')](_0xb07c93[_0x76da('0x30')][_0x76da('0x35')]));_0x599dda[_0x76da('0x34')]=_0x599dda[_0x76da('0x34')]['length']?_0x599dda['attributes']:_0x446a1c[_0x76da('0x2e')];_0x599dda[_0x76da('0x3a')]=qs['sort'](_0xb07c93[_0x76da('0x30')]['sort']);_0x599dda[_0x76da('0x3c')]=qs[_0x76da('0x32')](_[_0x76da('0x3d')](_0xb07c93['query'],_0x446a1c[_0x76da('0x32')]));if(_0xb07c93['query'][_0x76da('0x40')]){_0x599dda['where']=_[_0x76da('0x3e')](_0x599dda[_0x76da('0x3c')],{'$or':_[_0x76da('0x2f')](_0x599dda[_0x76da('0x34')],function(_0x1729be){var _0x2f6a83={};_0x2f6a83[_0x1729be]={'$like':'%'+_0xb07c93[_0x76da('0x30')][_0x76da('0x40')]+'%'};return _0x2f6a83;})});}if(_0xb07c93[_0x76da('0x30')]['$gte']){var _0x3a924c=_0xb07c93[_0x76da('0x30')][_0x76da('0x59')][_0x76da('0x5a')](',');var _0x33b799={};_0x33b799[_0x3a924c[0x0]]={'$gte':moment(_0x3a924c[0x1])[_0x76da('0x5b')](_0x76da('0x5c'))};_0x599dda[_0x76da('0x3c')]=_[_0x76da('0x3e')](_0x599dda[_0x76da('0x3c')],_0x33b799);}_0x599dda=_['merge']({},_0x599dda,_0xb07c93[_0x76da('0x41')]);return _0x4c91c9[_0x76da('0x5d')](_0x599dda);}})['then'](function(_0x533f20){if(_0x533f20){_0x2c756b=_0x533f20[_0x76da('0x36')];if(!_0xb07c93[_0x76da('0x30')][_0x76da('0x37')]('nolimit')){_0x599dda[_0x76da('0x39')]=qs['limit'](_0xb07c93['query'][_0x76da('0x39')]);_0x599dda[_0x76da('0x1f')]=qs[_0x76da('0x1f')](_0xb07c93[_0x76da('0x30')][_0x76da('0x1f')]);}return _0x4c91c9['getMessages'](_0x599dda);}})[_0x76da('0x24')](function(_0x274372){if(_0x274372){return _0x274372?{'count':_0x2c756b,'rows':_0x274372}:null;}})[_0x76da('0x24')](respondWithResult(_0x40df75,null))[_0x76da('0x44')](handleError(_0x40df75,null));}; \ No newline at end of file +var _0xc3ac=['key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','describe','getUnread','ChatInternalMessage','user','toInteger','addMembers','ids','findOne','order','getMembers','removeMembers','addMessage','ChatGroupId','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','path','sox','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./chatGroup.socket','register','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','reject','save','update','then','destroy','stack','name','send','index','map','ChatGroup','rawAttributes','fieldName','type'];(function(_0x3a237e,_0x1a40ee){var _0x2af3fc=function(_0x2a38bf){while(--_0x2a38bf){_0x3a237e['push'](_0x3a237e['shift']());}};_0x2af3fc(++_0x1a40ee);}(_0xc3ac,0xf1));var _0xcc3a=function(_0x3e6ee3,_0x497ba4){_0x3e6ee3=_0x3e6ee3-0x0;var _0x44a25a=_0xc3ac[_0x3e6ee3];return _0x44a25a;};'use strict';var emlformat=require(_0xcc3a('0x0'));var rimraf=require(_0xcc3a('0x1'));var zipdir=require(_0xcc3a('0x2'));var jsonpatch=require(_0xcc3a('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xcc3a('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xcc3a('0x5'));var sox=require(_0xcc3a('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xcc3a('0x7'));var _=require(_0xcc3a('0x8'));var squel=require('squel');var crypto=require(_0xcc3a('0x9'));var jsforce=require(_0xcc3a('0xa'));var deskjs=require(_0xcc3a('0xb'));var toCsv=require(_0xcc3a('0xc'));var querystring=require(_0xcc3a('0xd'));var Papa=require(_0xcc3a('0xe'));var Redis=require('ioredis');var authService=require(_0xcc3a('0xf'));var qs=require(_0xcc3a('0x10'));var as=require(_0xcc3a('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xcc3a('0x12'))(_0xcc3a('0x13'));var utils=require(_0xcc3a('0x14'));var config=require(_0xcc3a('0x15'));var licenseUtil=require(_0xcc3a('0x16'));var db=require(_0xcc3a('0x17'))['db'];config[_0xcc3a('0x18')]=_['defaults'](config[_0xcc3a('0x18')],{'host':_0xcc3a('0x19'),'port':0x18eb});var socket=require(_0xcc3a('0x1a'))(new Redis(config[_0xcc3a('0x18')]));require(_0xcc3a('0x1b'))[_0xcc3a('0x1c')](socket);function respondWithStatusCode(_0x57b410,_0x114717){_0x114717=_0x114717||0xcc;return function(_0x4ee383){if(_0x4ee383){return _0x57b410[_0xcc3a('0x1d')](_0x114717);}return _0x57b410[_0xcc3a('0x1e')](_0x114717)[_0xcc3a('0x1f')]();};}function respondWithResult(_0x5dbb21,_0x37f0d4){_0x37f0d4=_0x37f0d4||0xc8;return function(_0x209d79){if(_0x209d79){return _0x5dbb21[_0xcc3a('0x1e')](_0x37f0d4)['json'](_0x209d79);}};}function respondWithFilteredResult(_0x2e9d67,_0x165fc6){return function(_0x13772e){if(_0x13772e){var _0x6743d2=typeof _0x165fc6[_0xcc3a('0x20')]==='undefined'&&typeof _0x165fc6['limit']===_0xcc3a('0x21');var _0x210ff1=_0x13772e[_0xcc3a('0x22')];var _0x25feef=_0x6743d2?0x0:_0x165fc6[_0xcc3a('0x20')];var _0x206b13=_0x6743d2?_0x13772e['count']:_0x165fc6[_0xcc3a('0x20')]+_0x165fc6[_0xcc3a('0x23')];var _0x4a3e72;if(_0x206b13>=_0x210ff1){_0x206b13=_0x210ff1;_0x4a3e72=0xc8;}else{_0x4a3e72=0xce;}_0x2e9d67[_0xcc3a('0x1e')](_0x4a3e72);return _0x2e9d67[_0xcc3a('0x24')](_0xcc3a('0x25'),_0x25feef+'-'+_0x206b13+'/'+_0x210ff1)[_0xcc3a('0x26')](_0x13772e);}return null;};}function patchUpdates(_0x201d2e){return function(_0x1c77d2){try{jsonpatch['apply'](_0x1c77d2,_0x201d2e,!![]);}catch(_0x1180a9){return BPromise[_0xcc3a('0x27')](_0x1180a9);}return _0x1c77d2[_0xcc3a('0x28')]();};}function saveUpdates(_0x35a031,_0x13e099){return function(_0x3abf82){if(_0x3abf82){return _0x3abf82[_0xcc3a('0x29')](_0x35a031)[_0xcc3a('0x2a')](function(_0x5864ca){return _0x5864ca;});}return null;};}function removeEntity(_0x3029a8,_0x319e13){return function(_0xe527e2){if(_0xe527e2){return _0xe527e2[_0xcc3a('0x2b')]()[_0xcc3a('0x2a')](function(){_0x3029a8[_0xcc3a('0x1e')](0xcc)[_0xcc3a('0x1f')]();});}};}function handleEntityNotFound(_0x105da2,_0x42aa18){return function(_0x14d1c8){if(!_0x14d1c8){_0x105da2[_0xcc3a('0x1d')](0x194);}return _0x14d1c8;};}function handleError(_0x3bc16e,_0x283b69){_0x283b69=_0x283b69||0x1f4;return function(_0x3145fb){logger['error'](_0x3145fb[_0xcc3a('0x2c')]);if(_0x3145fb[_0xcc3a('0x2d')]){delete _0x3145fb['name'];}_0x3bc16e[_0xcc3a('0x1e')](_0x283b69)[_0xcc3a('0x2e')](_0x3145fb);};}exports[_0xcc3a('0x2f')]=function(_0x14d988,_0x4d6e42){var _0x338d3b={},_0x57b54c={},_0x425663={'count':0x0,'rows':[]};var _0x7803e9=_[_0xcc3a('0x30')](db[_0xcc3a('0x31')][_0xcc3a('0x32')],function(_0x5a37d0){return{'name':_0x5a37d0[_0xcc3a('0x33')],'type':_0x5a37d0[_0xcc3a('0x34')][_0xcc3a('0x35')]};});_0x57b54c[_0xcc3a('0x36')]=_[_0xcc3a('0x30')](_0x7803e9,_0xcc3a('0x2d'));_0x57b54c['query']=_[_0xcc3a('0x37')](_0x14d988[_0xcc3a('0x38')]);_0x57b54c['filters']=_[_0xcc3a('0x39')](_0x57b54c[_0xcc3a('0x36')],_0x57b54c[_0xcc3a('0x38')]);_0x338d3b[_0xcc3a('0x3a')]=_[_0xcc3a('0x39')](_0x57b54c[_0xcc3a('0x36')],qs[_0xcc3a('0x3b')](_0x14d988['query']['fields']));_0x338d3b[_0xcc3a('0x3a')]=_0x338d3b[_0xcc3a('0x3a')][_0xcc3a('0x3c')]?_0x338d3b['attributes']:_0x57b54c['model'];if(!_0x14d988[_0xcc3a('0x38')][_0xcc3a('0x3d')](_0xcc3a('0x3e'))){_0x338d3b['limit']=qs['limit'](_0x14d988[_0xcc3a('0x38')][_0xcc3a('0x23')]);_0x338d3b['offset']=qs[_0xcc3a('0x20')](_0x14d988[_0xcc3a('0x38')][_0xcc3a('0x20')]);}_0x338d3b['order']=qs[_0xcc3a('0x3f')](_0x14d988[_0xcc3a('0x38')][_0xcc3a('0x3f')]);_0x338d3b[_0xcc3a('0x40')]=qs[_0xcc3a('0x41')](_[_0xcc3a('0x42')](_0x14d988[_0xcc3a('0x38')],_0x57b54c[_0xcc3a('0x41')]),_0x7803e9);if(_0x14d988[_0xcc3a('0x38')][_0xcc3a('0x43')]){_0x338d3b[_0xcc3a('0x40')]=_[_0xcc3a('0x44')](_0x338d3b[_0xcc3a('0x40')],{'$or':_[_0xcc3a('0x30')](_0x7803e9,function(_0x21b2f0){if(_0x21b2f0['type']!=='VIRTUAL'){var _0x42d4fb={};_0x42d4fb[_0x21b2f0[_0xcc3a('0x2d')]]={'$like':'%'+_0x14d988[_0xcc3a('0x38')][_0xcc3a('0x43')]+'%'};return _0x42d4fb;}})});}_0x338d3b=_[_0xcc3a('0x44')]({},_0x338d3b,_0x14d988[_0xcc3a('0x45')]);var _0x4be22b={'where':_0x338d3b[_0xcc3a('0x40')]};return db[_0xcc3a('0x31')][_0xcc3a('0x22')](_0x4be22b)[_0xcc3a('0x2a')](function(_0x32a260){_0x425663[_0xcc3a('0x22')]=_0x32a260;if(_0x14d988[_0xcc3a('0x38')]['includeAll']){_0x338d3b[_0xcc3a('0x46')]=[{'all':!![]}];}return db[_0xcc3a('0x31')][_0xcc3a('0x47')](_0x338d3b);})['then'](function(_0x44fe32){_0x425663[_0xcc3a('0x48')]=_0x44fe32;return _0x425663;})[_0xcc3a('0x2a')](respondWithFilteredResult(_0x4d6e42,_0x338d3b))[_0xcc3a('0x49')](handleError(_0x4d6e42,null));};exports[_0xcc3a('0x4a')]=function(_0x3aad16,_0x1d418f){var _0x5c5ad1={'raw':!![],'where':{'id':_0x3aad16[_0xcc3a('0x4b')]['id']}},_0xa87490={};_0xa87490[_0xcc3a('0x36')]=_[_0xcc3a('0x37')](db[_0xcc3a('0x31')][_0xcc3a('0x32')]);_0xa87490[_0xcc3a('0x38')]=_[_0xcc3a('0x37')](_0x3aad16[_0xcc3a('0x38')]);_0xa87490[_0xcc3a('0x41')]=_[_0xcc3a('0x39')](_0xa87490['model'],_0xa87490[_0xcc3a('0x38')]);_0x5c5ad1[_0xcc3a('0x3a')]=_[_0xcc3a('0x39')](_0xa87490['model'],qs['fields'](_0x3aad16[_0xcc3a('0x38')][_0xcc3a('0x3b')]));_0x5c5ad1[_0xcc3a('0x3a')]=_0x5c5ad1[_0xcc3a('0x3a')][_0xcc3a('0x3c')]?_0x5c5ad1['attributes']:_0xa87490[_0xcc3a('0x36')];if(_0x3aad16[_0xcc3a('0x38')][_0xcc3a('0x4c')]){_0x5c5ad1[_0xcc3a('0x46')]=[{'all':!![]}];}_0x5c5ad1=_[_0xcc3a('0x44')]({},_0x5c5ad1,_0x3aad16[_0xcc3a('0x45')]);return db[_0xcc3a('0x31')][_0xcc3a('0x4d')](_0x5c5ad1)[_0xcc3a('0x2a')](handleEntityNotFound(_0x1d418f,null))[_0xcc3a('0x2a')](respondWithResult(_0x1d418f,null))[_0xcc3a('0x49')](handleError(_0x1d418f,null));};exports[_0xcc3a('0x4e')]=function(_0xa34526,_0x204d88){return db[_0xcc3a('0x31')][_0xcc3a('0x4e')](_0xa34526['body'],{})[_0xcc3a('0x2a')](respondWithResult(_0x204d88,0xc9))[_0xcc3a('0x49')](handleError(_0x204d88,null));};exports[_0xcc3a('0x29')]=function(_0x18355f,_0x639f56){if(_0x18355f[_0xcc3a('0x4f')]['id']){delete _0x18355f[_0xcc3a('0x4f')]['id'];}return db[_0xcc3a('0x31')][_0xcc3a('0x4d')]({'where':{'id':_0x18355f[_0xcc3a('0x4b')]['id']}})[_0xcc3a('0x2a')](handleEntityNotFound(_0x639f56,null))[_0xcc3a('0x2a')](saveUpdates(_0x18355f[_0xcc3a('0x4f')],null))[_0xcc3a('0x2a')](respondWithResult(_0x639f56,null))[_0xcc3a('0x49')](handleError(_0x639f56,null));};exports['destroy']=function(_0xe32e8d,_0x53c5bb){return db[_0xcc3a('0x31')][_0xcc3a('0x4d')]({'where':{'id':_0xe32e8d[_0xcc3a('0x4b')]['id']}})[_0xcc3a('0x2a')](handleEntityNotFound(_0x53c5bb,null))['then'](removeEntity(_0x53c5bb,null))['catch'](handleError(_0x53c5bb,null));};exports[_0xcc3a('0x50')]=function(_0x4a770b,_0x3d1fea){return db['ChatGroup'][_0xcc3a('0x50')]()[_0xcc3a('0x2a')](respondWithResult(_0x3d1fea,null))['catch'](handleError(_0x3d1fea,null));};exports[_0xcc3a('0x51')]=function(_0x15d8e3,_0x5ae820,_0x11d77a){return db[_0xcc3a('0x52')][_0xcc3a('0x22')]({'where':{'ChatGroupId':_0x15d8e3[_0xcc3a('0x4b')]['id'],'ToId':_0x15d8e3[_0xcc3a('0x53')]['id'],'read':![]}})[_0xcc3a('0x2a')](function(_0x3ede94){return{'id':_[_0xcc3a('0x54')](_0x15d8e3[_0xcc3a('0x4b')]['id']),'count':_0x3ede94};})[_0xcc3a('0x2a')](respondWithResult(_0x5ae820,null))[_0xcc3a('0x49')](handleError(_0x5ae820,null));};exports[_0xcc3a('0x55')]=function(_0x4a0324,_0x38d9fc,_0x4ca4b2){return db[_0xcc3a('0x31')][_0xcc3a('0x4d')]({'where':{'id':_0x4a0324['params']['id']}})[_0xcc3a('0x2a')](handleEntityNotFound(_0x38d9fc,null))[_0xcc3a('0x2a')](function(_0x32456e){if(_0x32456e){return _0x32456e[_0xcc3a('0x55')](_0x4a0324[_0xcc3a('0x4f')][_0xcc3a('0x56')],_['omit'](_0x4a0324[_0xcc3a('0x4f')],[_0xcc3a('0x56'),'id'])||{});}})['then'](respondWithResult(_0x38d9fc,null))[_0xcc3a('0x49')](handleError(_0x38d9fc,null));};exports['getMembers']=function(_0x278190,_0x53ec15,_0x168770){var _0x5fca12={};var _0x36b1de={};var _0x562e69;var _0x5727de;return db[_0xcc3a('0x31')][_0xcc3a('0x57')]({'where':{'id':_0x278190['params']['id']}})['then'](handleEntityNotFound(_0x53ec15,null))[_0xcc3a('0x2a')](function(_0x555b23){if(_0x555b23){_0x562e69=_0x555b23;_0x36b1de[_0xcc3a('0x36')]=_[_0xcc3a('0x37')](db['User'][_0xcc3a('0x32')]);_0x36b1de['query']=_[_0xcc3a('0x37')](_0x278190[_0xcc3a('0x38')]);_0x36b1de[_0xcc3a('0x41')]=_[_0xcc3a('0x39')](_0x36b1de[_0xcc3a('0x36')],_0x36b1de[_0xcc3a('0x38')]);_0x5fca12[_0xcc3a('0x3a')]=_[_0xcc3a('0x39')](_0x36b1de[_0xcc3a('0x36')],qs[_0xcc3a('0x3b')](_0x278190[_0xcc3a('0x38')][_0xcc3a('0x3b')]));_0x5fca12['attributes']=_0x5fca12[_0xcc3a('0x3a')][_0xcc3a('0x3c')]?_0x5fca12['attributes']:_0x36b1de[_0xcc3a('0x36')];_0x5fca12[_0xcc3a('0x58')]=qs['sort'](_0x278190[_0xcc3a('0x38')][_0xcc3a('0x3f')]);_0x5fca12['where']=qs[_0xcc3a('0x41')](_['pick'](_0x278190[_0xcc3a('0x38')],_0x36b1de['filters']));if(_0x278190[_0xcc3a('0x38')]['filter']){_0x5fca12[_0xcc3a('0x40')]=_[_0xcc3a('0x44')](_0x5fca12[_0xcc3a('0x40')],{'$or':_[_0xcc3a('0x30')](_0x5fca12[_0xcc3a('0x3a')],function(_0x5bb538){var _0x28fa94={};_0x28fa94[_0x5bb538]={'$like':'%'+_0x278190[_0xcc3a('0x38')]['filter']+'%'};return _0x28fa94;})});}_0x5fca12=_['merge']({},_0x5fca12,_0x278190['options']);return _0x562e69[_0xcc3a('0x59')](_0x5fca12);}})[_0xcc3a('0x2a')](function(_0x1f5058){if(_0x1f5058){_0x5727de=_0x1f5058[_0xcc3a('0x3c')];if(!_0x278190[_0xcc3a('0x38')][_0xcc3a('0x3d')](_0xcc3a('0x3e'))){_0x5fca12[_0xcc3a('0x23')]=qs[_0xcc3a('0x23')](_0x278190[_0xcc3a('0x38')][_0xcc3a('0x23')]);_0x5fca12[_0xcc3a('0x20')]=qs['offset'](_0x278190[_0xcc3a('0x38')][_0xcc3a('0x20')]);}return _0x562e69['getMembers'](_0x5fca12);}})[_0xcc3a('0x2a')](function(_0x20599){if(_0x20599){return _0x20599?{'count':_0x5727de,'rows':_0x20599}:null;}})['then'](respondWithResult(_0x53ec15,null))['catch'](handleError(_0x53ec15,null));};exports[_0xcc3a('0x5a')]=function(_0x12d121,_0x42d2b7,_0x56299a){return db[_0xcc3a('0x31')][_0xcc3a('0x4d')]({'where':{'id':_0x12d121[_0xcc3a('0x4b')]['id']}})[_0xcc3a('0x2a')](handleEntityNotFound(_0x42d2b7,null))[_0xcc3a('0x2a')](function(_0x4e4b76){if(_0x4e4b76){return _0x4e4b76['removeMembers'](_0x12d121[_0xcc3a('0x38')][_0xcc3a('0x56')]);}})[_0xcc3a('0x2a')](respondWithStatusCode(_0x42d2b7,null))['catch'](handleError(_0x42d2b7,null));};exports[_0xcc3a('0x5b')]=function(_0x30a8ae,_0x2b45ff,_0x18359b){if(_0x30a8ae[_0xcc3a('0x4f')]['id']){delete _0x30a8ae[_0xcc3a('0x4f')]['id'];}return db[_0xcc3a('0x31')]['find']({'where':{'id':_0x30a8ae[_0xcc3a('0x4b')]['id']}})[_0xcc3a('0x2a')](handleEntityNotFound(_0x2b45ff,null))['then'](function(_0x21936b){if(_0x21936b){_0x30a8ae[_0xcc3a('0x4f')][_0xcc3a('0x5c')]=_0x21936b['id'];return db[_0xcc3a('0x52')][_0xcc3a('0x4e')](_0x30a8ae['body']);}})[_0xcc3a('0x2a')](respondWithResult(_0x2b45ff,null))[_0xcc3a('0x49')](handleError(_0x2b45ff,null));};exports[_0xcc3a('0x5d')]=function(_0x18b5eb,_0x4e48ba,_0x54299c){var _0x40ba4e={};var _0x45f092={};var _0x3ee5af;var _0x287011;return db[_0xcc3a('0x31')][_0xcc3a('0x57')]({'where':{'id':_0x18b5eb[_0xcc3a('0x4b')]['id']}})[_0xcc3a('0x2a')](handleEntityNotFound(_0x4e48ba,null))['then'](function(_0x5c560a){if(_0x5c560a){_0x3ee5af=_0x5c560a;_0x45f092[_0xcc3a('0x36')]=_[_0xcc3a('0x37')](db[_0xcc3a('0x52')][_0xcc3a('0x32')]);_0x45f092['query']=_[_0xcc3a('0x37')](_0x18b5eb['query']);_0x45f092['filters']=_[_0xcc3a('0x39')](_0x45f092[_0xcc3a('0x36')],_0x45f092[_0xcc3a('0x38')]);_0x40ba4e[_0xcc3a('0x3a')]=_[_0xcc3a('0x39')](_0x45f092[_0xcc3a('0x36')],qs[_0xcc3a('0x3b')](_0x18b5eb[_0xcc3a('0x38')][_0xcc3a('0x3b')]));_0x40ba4e[_0xcc3a('0x3a')]=_0x40ba4e[_0xcc3a('0x3a')][_0xcc3a('0x3c')]?_0x40ba4e['attributes']:_0x45f092['model'];_0x40ba4e[_0xcc3a('0x58')]=qs['sort'](_0x18b5eb[_0xcc3a('0x38')][_0xcc3a('0x3f')]);_0x40ba4e[_0xcc3a('0x40')]=qs[_0xcc3a('0x41')](_[_0xcc3a('0x42')](_0x18b5eb['query'],_0x45f092[_0xcc3a('0x41')]));if(_0x18b5eb[_0xcc3a('0x38')][_0xcc3a('0x43')]){_0x40ba4e['where']=_['merge'](_0x40ba4e['where'],{'$or':_['map'](_0x40ba4e['attributes'],function(_0x12b853){var _0x2b2e73={};_0x2b2e73[_0x12b853]={'$like':'%'+_0x18b5eb[_0xcc3a('0x38')][_0xcc3a('0x43')]+'%'};return _0x2b2e73;})});}if(_0x18b5eb[_0xcc3a('0x38')][_0xcc3a('0x5e')]){var _0x41199c=_0x18b5eb[_0xcc3a('0x38')][_0xcc3a('0x5e')][_0xcc3a('0x5f')](',');var _0x18b0da={};_0x18b0da[_0x41199c[0x0]]={'$gte':moment(_0x41199c[0x1])[_0xcc3a('0x60')](_0xcc3a('0x61'))};_0x40ba4e[_0xcc3a('0x40')]=_['merge'](_0x40ba4e[_0xcc3a('0x40')],_0x18b0da);}_0x40ba4e=_[_0xcc3a('0x44')]({},_0x40ba4e,_0x18b5eb[_0xcc3a('0x45')]);return _0x3ee5af['getMessages'](_0x40ba4e);}})[_0xcc3a('0x2a')](function(_0x59fd2d){if(_0x59fd2d){_0x287011=_0x59fd2d[_0xcc3a('0x3c')];if(!_0x18b5eb[_0xcc3a('0x38')][_0xcc3a('0x3d')]('nolimit')){_0x40ba4e['limit']=qs[_0xcc3a('0x23')](_0x18b5eb[_0xcc3a('0x38')][_0xcc3a('0x23')]);_0x40ba4e['offset']=qs[_0xcc3a('0x20')](_0x18b5eb[_0xcc3a('0x38')][_0xcc3a('0x20')]);}return _0x3ee5af[_0xcc3a('0x5d')](_0x40ba4e);}})['then'](function(_0x272f31){if(_0x272f31){return _0x272f31?{'count':_0x287011,'rows':_0x272f31}:null;}})[_0xcc3a('0x2a')](respondWithResult(_0x4e48ba,null))[_0xcc3a('0x49')](handleError(_0x4e48ba,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index da66b85..725433c 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 _0x9cae=['remove','emit','exports','../../mysqldb','ChatGroup','setMaxListeners','save','update'];(function(_0x336535,_0x1179e5){var _0x1b2de1=function(_0x226733){while(--_0x226733){_0x336535['push'](_0x336535['shift']());}};_0x1b2de1(++_0x1179e5);}(_0x9cae,0xeb));var _0xe9ca=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x9cae[_0x20a584];return _0x4b41a8;};'use strict';var EventEmitter=require('events');var ChatGroup=require(_0xe9ca('0x0'))['db'][_0xe9ca('0x1')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0xe9ca('0x2')](0x0);var events={'afterCreate':_0xe9ca('0x3'),'afterUpdate':_0xe9ca('0x4'),'afterDestroy':_0xe9ca('0x5')};function emitEvent(_0x565734){return function(_0x517e40,_0x43712f,_0x4d28f8){ChatGroupEvents[_0xe9ca('0x6')](_0x565734+':'+_0x517e40['id'],_0x517e40);ChatGroupEvents[_0xe9ca('0x6')](_0x565734,_0x517e40);_0x4d28f8(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatGroup['hook'](e,emitEvent(event));}}module[_0xe9ca('0x7')]=ChatGroupEvents; \ No newline at end of file +var _0xd566=['events','../../mysqldb','ChatGroup','setMaxListeners','save','update','hasOwnProperty','hook'];(function(_0x45bf86,_0x75586e){var _0x1f02b7=function(_0x1ea8a3){while(--_0x1ea8a3){_0x45bf86['push'](_0x45bf86['shift']());}};_0x1f02b7(++_0x75586e);}(_0xd566,0x100));var _0x6d56=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xd566[_0x321bb2];return _0x9c12ed;};'use strict';var EventEmitter=require(_0x6d56('0x0'));var ChatGroup=require(_0x6d56('0x1'))['db'][_0x6d56('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x6d56('0x3')](0x0);var events={'afterCreate':_0x6d56('0x4'),'afterUpdate':_0x6d56('0x5'),'afterDestroy':'remove'};function emitEvent(_0x39e876){return function(_0x175291,_0x1a23de,_0xf4fe43){ChatGroupEvents['emit'](_0x39e876+':'+_0x175291['id'],_0x175291);ChatGroupEvents['emit'](_0x39e876,_0x175291);_0xf4fe43(null);};}for(var e in events){if(events[_0x6d56('0x6')](e)){var event=events[e];ChatGroup[_0x6d56('0x7')](e,emitEvent(event));}}module['exports']=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index 9b4fa46..e156b52 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 _0x5951=['api','moment','request-promise','path','rimraf','../../config/environment','./chatGroup.attributes','exports','define','ChatGroup','chat_groups','lodash','util','../../config/logger'];(function(_0x3be084,_0x46b086){var _0x47060c=function(_0x4d4725){while(--_0x4d4725){_0x3be084['push'](_0x3be084['shift']());}};_0x47060c(++_0x46b086);}(_0x5951,0x131));var _0x1595=function(_0x531e57,_0x17b65c){_0x531e57=_0x531e57-0x0;var _0x287f63=_0x5951[_0x531e57];return _0x287f63;};'use strict';var _=require(_0x1595('0x0'));var util=require(_0x1595('0x1'));var logger=require(_0x1595('0x2'))(_0x1595('0x3'));var moment=require(_0x1595('0x4'));var BPromise=require('bluebird');var rp=require(_0x1595('0x5'));var fs=require('fs');var path=require(_0x1595('0x6'));var rimraf=require(_0x1595('0x7'));var config=require(_0x1595('0x8'));var attributes=require(_0x1595('0x9'));module[_0x1595('0xa')]=function(_0x253359,_0x12e20c){return _0x253359[_0x1595('0xb')](_0x1595('0xc'),attributes,{'tableName':_0x1595('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x00c0=['./chatGroup.attributes','exports','define','ChatGroup','chat_groups','util','../../config/logger','api','bluebird','rimraf'];(function(_0xbd77c1,_0x50b969){var _0x47fa83=function(_0x38dac1){while(--_0x38dac1){_0xbd77c1['push'](_0xbd77c1['shift']());}};_0x47fa83(++_0x50b969);}(_0x00c0,0x73));var _0x000c=function(_0x3b4178,_0x37118e){_0x3b4178=_0x3b4178-0x0;var _0x3d748d=_0x00c0[_0x3b4178];return _0x3d748d;};'use strict';var _=require('lodash');var util=require(_0x000c('0x0'));var logger=require(_0x000c('0x1'))(_0x000c('0x2'));var moment=require('moment');var BPromise=require(_0x000c('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x000c('0x4'));var config=require('../../config/environment');var attributes=require(_0x000c('0x5'));module[_0x000c('0x6')]=function(_0x5aaeeb,_0x85537c){return _0x5aaeeb[_0x000c('0x7')](_0x000c('0x8'),attributes,{'tableName':_0x000c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.rpc.js b/server/api/chatGroup/chatGroup.rpc.js index fd5f1a0..8c25481 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 _0xf725=['rpc','jayson/promise','client','http','redis','defaults','localhost','./chatGroup.socket','register','request','then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0xb1582a,_0x3c943b){var _0x3ecd32=function(_0x22d865){while(--_0x22d865){_0xb1582a['push'](_0xb1582a['shift']());}};_0x3ecd32(++_0x3c943b);}(_0xf725,0x7e));var _0x5f72=function(_0x4b53c7,_0x43b823){_0x4b53c7=_0x4b53c7-0x0;var _0x3bc703=_0xf725[_0x4b53c7];return _0x3bc703;};'use strict';var _=require(_0x5f72('0x0'));var util=require(_0x5f72('0x1'));var moment=require(_0x5f72('0x2'));var BPromise=require(_0x5f72('0x3'));var rs=require(_0x5f72('0x4'));var fs=require('fs');var Redis=require(_0x5f72('0x5'));var db=require(_0x5f72('0x6'))['db'];var utils=require(_0x5f72('0x7'));var logger=require(_0x5f72('0x8'))(_0x5f72('0x9'));var config=require('../../config/environment');var jayson=require(_0x5f72('0xa'));var client=jayson[_0x5f72('0xb')][_0x5f72('0xc')]({'port':0x232a});config[_0x5f72('0xd')]=_[_0x5f72('0xe')](config[_0x5f72('0xd')],{'host':_0x5f72('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x5f72('0x10'))[_0x5f72('0x11')](socket);function respondWithRpcPromise(_0x5b74cf,_0x994d2e,_0x4735f6){return new BPromise(function(_0x547a1a,_0x3a3b76){return client[_0x5f72('0x12')](_0x5b74cf,_0x4735f6)[_0x5f72('0x13')](function(_0x351a83){logger[_0x5f72('0x14')](_0x5f72('0x15'),_0x994d2e,_0x5f72('0x16'));logger['debug'](_0x5f72('0x17'),_0x994d2e,_0x5f72('0x16'),JSON[_0x5f72('0x18')](_0x351a83));if(_0x351a83[_0x5f72('0x19')]){if(_0x351a83[_0x5f72('0x19')]['code']===0x1f4){logger[_0x5f72('0x19')]('ChatGroup,\x20%s,\x20%s',_0x994d2e,_0x351a83['error'][_0x5f72('0x1a')]);return _0x3a3b76(_0x351a83['error'][_0x5f72('0x1a')]);}logger['error'](_0x5f72('0x15'),_0x994d2e,_0x351a83['error'][_0x5f72('0x1a')]);return _0x547a1a(_0x351a83[_0x5f72('0x19')]['message']);}else{logger[_0x5f72('0x14')](_0x5f72('0x15'),_0x994d2e,_0x5f72('0x16'));_0x547a1a(_0x351a83['result']['message']);}})['catch'](function(_0x29c8b8){logger[_0x5f72('0x19')](_0x5f72('0x15'),_0x994d2e,_0x29c8b8);_0x3a3b76(_0x29c8b8);});});} \ No newline at end of file +var _0xf569=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','defaults','redis','socket.io-emitter','./chatGroup.socket','request','then','ChatGroup,\x20%s,\x20%s','debug','stringify','error','code','message','info','request\x20sent','result'];(function(_0x2c778e,_0x48c763){var _0x5abea8=function(_0x1edd06){while(--_0x1edd06){_0x2c778e['push'](_0x2c778e['shift']());}};_0x5abea8(++_0x48c763);}(_0xf569,0xd0));var _0x9f56=function(_0x4d613c,_0x55f220){_0x4d613c=_0x4d613c-0x0;var _0x301fe3=_0xf569[_0x4d613c];return _0x301fe3;};'use strict';var _=require('lodash');var util=require(_0x9f56('0x0'));var moment=require(_0x9f56('0x1'));var BPromise=require(_0x9f56('0x2'));var rs=require(_0x9f56('0x3'));var fs=require('fs');var Redis=require(_0x9f56('0x4'));var db=require(_0x9f56('0x5'))['db'];var utils=require(_0x9f56('0x6'));var logger=require(_0x9f56('0x7'))('rpc');var config=require(_0x9f56('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x9f56('0x9')][_0x9f56('0xa')]({'port':0x232a});config['redis']=_[_0x9f56('0xb')](config[_0x9f56('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x9f56('0xd'))(new Redis(config[_0x9f56('0xc')]));require(_0x9f56('0xe'))['register'](socket);function respondWithRpcPromise(_0x4a4569,_0x3172a3,_0x1fb07e){return new BPromise(function(_0x4bfa64,_0x1ae262){return client[_0x9f56('0xf')](_0x4a4569,_0x1fb07e)[_0x9f56('0x10')](function(_0x4baac9){logger['info'](_0x9f56('0x11'),_0x3172a3,'request\x20sent');logger[_0x9f56('0x12')]('ChatGroup,\x20%s,\x20%s,\x20%s',_0x3172a3,'request\x20sent',JSON[_0x9f56('0x13')](_0x4baac9));if(_0x4baac9[_0x9f56('0x14')]){if(_0x4baac9['error'][_0x9f56('0x15')]===0x1f4){logger[_0x9f56('0x14')](_0x9f56('0x11'),_0x3172a3,_0x4baac9[_0x9f56('0x14')][_0x9f56('0x16')]);return _0x1ae262(_0x4baac9[_0x9f56('0x14')][_0x9f56('0x16')]);}logger[_0x9f56('0x14')](_0x9f56('0x11'),_0x3172a3,_0x4baac9[_0x9f56('0x14')][_0x9f56('0x16')]);return _0x4bfa64(_0x4baac9[_0x9f56('0x14')][_0x9f56('0x16')]);}else{logger[_0x9f56('0x17')](_0x9f56('0x11'),_0x3172a3,_0x9f56('0x18'));_0x4bfa64(_0x4baac9[_0x9f56('0x19')][_0x9f56('0x16')]);}})['catch'](function(_0x540108){logger[_0x9f56('0x14')](_0x9f56('0x11'),_0x3172a3,_0x540108);_0x1ae262(_0x540108);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index d481fef..50ba27d 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 _0xbbbb=['removeListener','register','length','chatGroup:','save','remove','update'];(function(_0x2213d2,_0x3587f0){var _0x429375=function(_0x54eb25){while(--_0x54eb25){_0x2213d2['push'](_0x2213d2['shift']());}};_0x429375(++_0x3587f0);}(_0xbbbb,0x154));var _0xbbbb=function(_0x4f28d8,_0x4d6303){_0x4f28d8=_0x4f28d8-0x0;var _0x4e866b=_0xbbbb[_0x4f28d8];return _0x4e866b;};'use strict';var ChatGroupEvents=require('./chatGroup.events');var events=[_0xbbbb('0x0'),_0xbbbb('0x1'),_0xbbbb('0x2')];function createListener(_0x3f6476,_0x47e582){return function(_0x21ebc3){_0x47e582['emit'](_0x3f6476,_0x21ebc3);};}function removeListener(_0x38c510,_0x5becda){return function(){ChatGroupEvents[_0xbbbb('0x3')](_0x38c510,_0x5becda);};}exports[_0xbbbb('0x4')]=function(_0x326b2b){for(var _0x2134a5=0x0,_0x3525b6=events[_0xbbbb('0x5')];_0x2134a5<_0x3525b6;_0x2134a5++){var _0x429067=events[_0x2134a5];var _0x2d2401=createListener(_0xbbbb('0x6')+_0x429067,_0x326b2b);ChatGroupEvents['on'](_0x429067,_0x2d2401);}}; \ No newline at end of file +var _0x03ac=['emit','removeListener','register','length','save','update'];(function(_0x16771d,_0x224c60){var _0x386f11=function(_0x3d7a87){while(--_0x3d7a87){_0x16771d['push'](_0x16771d['shift']());}};_0x386f11(++_0x224c60);}(_0x03ac,0xee));var _0xc03a=function(_0x452fca,_0x2ee91c){_0x452fca=_0x452fca-0x0;var _0x1729c0=_0x03ac[_0x452fca];return _0x1729c0;};'use strict';var ChatGroupEvents=require('./chatGroup.events');var events=[_0xc03a('0x0'),'remove',_0xc03a('0x1')];function createListener(_0x107e19,_0x4f9e62){return function(_0x25df2d){_0x4f9e62[_0xc03a('0x2')](_0x107e19,_0x25df2d);};}function removeListener(_0x356b56,_0x1b0814){return function(){ChatGroupEvents[_0xc03a('0x3')](_0x356b56,_0x1b0814);};}exports[_0xc03a('0x4')]=function(_0x12b972){for(var _0x4122b2=0x0,_0x3b4685=events[_0xc03a('0x5')];_0x4122b2<_0x3b4685;_0x4122b2++){var _0x2ec56a=events[_0x4122b2];var _0x3f0396=createListener('chatGroup:'+_0x2ec56a,_0x12b972);ChatGroupEvents['on'](_0x2ec56a,_0x3f0396);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index 4b5739b..662fe62 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 _0xf485=['isAuthenticated','/:id/unread','/:id/members','getMembers','/:id/messages','getMessages','post','create','addMembers','put','update','destroy','delete','removeMembers','exports','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatGroup.controller','get','index','/describe','describe','/:id'];(function(_0x2b2108,_0x4f134c){var _0x3cf845=function(_0x58cb04){while(--_0x58cb04){_0x2b2108['push'](_0x2b2108['shift']());}};_0x3cf845(++_0x4f134c);}(_0xf485,0xd3));var _0x5f48=function(_0x58f4d1,_0x370178){_0x58f4d1=_0x58f4d1-0x0;var _0x45a984=_0xf485[_0x58f4d1];return _0x45a984;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x5f48('0x0'));var timeout=require('connect-timeout');var express=require(_0x5f48('0x1'));var router=express[_0x5f48('0x2')]();var fs_extra=require(_0x5f48('0x3'));var auth=require(_0x5f48('0x4'));var interaction=require(_0x5f48('0x5'));var config=require(_0x5f48('0x6'));var controller=require(_0x5f48('0x7'));router[_0x5f48('0x8')]('/',auth['isAuthenticated'](),controller[_0x5f48('0x9')]);router[_0x5f48('0x8')](_0x5f48('0xa'),auth['isAuthenticated'](),controller[_0x5f48('0xb')]);router[_0x5f48('0x8')](_0x5f48('0xc'),auth[_0x5f48('0xd')](),controller['show']);router[_0x5f48('0x8')](_0x5f48('0xe'),auth[_0x5f48('0xd')](),controller['getUnread']);router['get'](_0x5f48('0xf'),auth[_0x5f48('0xd')](),controller[_0x5f48('0x10')]);router[_0x5f48('0x8')](_0x5f48('0x11'),auth[_0x5f48('0xd')](),controller[_0x5f48('0x12')]);router[_0x5f48('0x13')]('/',auth[_0x5f48('0xd')](),controller[_0x5f48('0x14')]);router[_0x5f48('0x13')](_0x5f48('0xf'),auth[_0x5f48('0xd')](),controller[_0x5f48('0x15')]);router[_0x5f48('0x13')](_0x5f48('0x11'),auth[_0x5f48('0xd')](),controller['addMessage']);router[_0x5f48('0x16')](_0x5f48('0xc'),auth[_0x5f48('0xd')](),controller[_0x5f48('0x17')]);router['delete'](_0x5f48('0xc'),auth['isAuthenticated'](),controller[_0x5f48('0x18')]);router[_0x5f48('0x19')](_0x5f48('0xf'),auth[_0x5f48('0xd')](),controller[_0x5f48('0x1a')]);module[_0x5f48('0x1b')]=router; \ No newline at end of file +var _0x42a8=['/:id/members','/:id/messages','getMessages','create','post','addMessage','put','update','delete','exports','multer','util','path','express','Router','../../components/auth/service','../../config/environment','./chatGroup.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/unread','getUnread'];(function(_0x47f0f8,_0x5f0deb){var _0x4f1cdb=function(_0x433b62){while(--_0x433b62){_0x47f0f8['push'](_0x47f0f8['shift']());}};_0x4f1cdb(++_0x5f0deb);}(_0x42a8,0x1d5));var _0x842a=function(_0x5921e4,_0x1b7bd2){_0x5921e4=_0x5921e4-0x0;var _0x4100c5=_0x42a8[_0x5921e4];return _0x4100c5;};'use strict';var multer=require(_0x842a('0x0'));var util=require(_0x842a('0x1'));var path=require(_0x842a('0x2'));var timeout=require('connect-timeout');var express=require(_0x842a('0x3'));var router=express[_0x842a('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x842a('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x842a('0x6'));var controller=require(_0x842a('0x7'));router[_0x842a('0x8')]('/',auth[_0x842a('0x9')](),controller[_0x842a('0xa')]);router[_0x842a('0x8')](_0x842a('0xb'),auth['isAuthenticated'](),controller[_0x842a('0xc')]);router[_0x842a('0x8')](_0x842a('0xd'),auth[_0x842a('0x9')](),controller[_0x842a('0xe')]);router[_0x842a('0x8')](_0x842a('0xf'),auth['isAuthenticated'](),controller[_0x842a('0x10')]);router[_0x842a('0x8')](_0x842a('0x11'),auth[_0x842a('0x9')](),controller['getMembers']);router[_0x842a('0x8')](_0x842a('0x12'),auth[_0x842a('0x9')](),controller[_0x842a('0x13')]);router['post']('/',auth['isAuthenticated'](),controller[_0x842a('0x14')]);router[_0x842a('0x15')](_0x842a('0x11'),auth[_0x842a('0x9')](),controller['addMembers']);router['post'](_0x842a('0x12'),auth[_0x842a('0x9')](),controller[_0x842a('0x16')]);router[_0x842a('0x17')](_0x842a('0xd'),auth['isAuthenticated'](),controller[_0x842a('0x18')]);router['delete'](_0x842a('0xd'),auth[_0x842a('0x9')](),controller['destroy']);router[_0x842a('0x19')](_0x842a('0x11'),auth['isAuthenticated'](),controller['removeMembers']);module[_0x842a('0x1a')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index 4afb3cc..c471ca3 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 _0x651e=['star','TEXT','DATE','STRING','long','BOOLEAN','INTEGER','ENUM','thumb'];(function(_0x5e6cb8,_0x16cf56){var _0x3faeb3=function(_0x1a7355){while(--_0x1a7355){_0x5e6cb8['push'](_0x5e6cb8['shift']());}};_0x3faeb3(++_0x16cf56);}(_0x651e,0x68));var _0xe651=function(_0x26649e,_0x3e5931){_0x26649e=_0x26649e-0x0;var _0xf359d=_0x651e[_0x26649e];return _0xf359d;};'use strict';var Sequelize=require('sequelize');module['exports']={'closed':{'type':Sequelize[_0xe651('0x0')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0xe651('0x1')]},'ratingType':{'type':Sequelize[_0xe651('0x2')]('star',_0xe651('0x3')),'defaultValue':_0xe651('0x4')},'ratingMessage':{'type':Sequelize[_0xe651('0x5')]},'pathTranscript':{'type':Sequelize[_0xe651('0x5')]},'mailTranscript':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0xe651('0x6')]},'disposition':{'type':Sequelize[_0xe651('0x7')]},'secondDisposition':{'type':Sequelize[_0xe651('0x7')]},'thirdDisposition':{'type':Sequelize[_0xe651('0x7')]},'note':{'type':Sequelize[_0xe651('0x7')]},'browserName':{'type':Sequelize[_0xe651('0x7')]},'browserVersion':{'type':Sequelize[_0xe651('0x7')]},'osName':{'type':Sequelize[_0xe651('0x7')]},'osVersion':{'type':Sequelize[_0xe651('0x7')]},'deviceModel':{'type':Sequelize['STRING']},'deviceVendor':{'type':Sequelize[_0xe651('0x7')]},'deviceType':{'type':Sequelize[_0xe651('0x7')]},'referer':{'type':Sequelize[_0xe651('0x5')]},'customerIp':{'type':Sequelize[_0xe651('0x7')]},'formData':{'type':Sequelize[_0xe651('0x5')](_0xe651('0x8'))},'read1stAt':{'type':Sequelize[_0xe651('0x6')]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xe651('0x2')]('in','out'),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0xe651('0x7')]},'customerPort':{'type':Sequelize['STRING']},'vidaooSessionId':{'type':Sequelize['TEXT']},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueId':{'type':Sequelize[_0xe651('0x1')]}}; \ No newline at end of file +var _0xd724=['out','sequelize','exports','BOOLEAN','INTEGER','star','thumb','TEXT','STRING','long','DATE','ENUM'];(function(_0x336030,_0x4086ea){var _0x2b203b=function(_0x10b0ad){while(--_0x10b0ad){_0x336030['push'](_0x336030['shift']());}};_0x2b203b(++_0x4086ea);}(_0xd724,0xfd));var _0x4d72=function(_0x43a65f,_0x492960){_0x43a65f=_0x43a65f-0x0;var _0x51a36c=_0xd724[_0x43a65f];return _0x51a36c;};'use strict';var Sequelize=require(_0x4d72('0x0'));module[_0x4d72('0x1')]={'closed':{'type':Sequelize[_0x4d72('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x4d72('0x3')]},'ratingType':{'type':Sequelize['ENUM'](_0x4d72('0x4'),_0x4d72('0x5')),'defaultValue':_0x4d72('0x4')},'ratingMessage':{'type':Sequelize[_0x4d72('0x6')]},'pathTranscript':{'type':Sequelize[_0x4d72('0x6')]},'mailTranscript':{'type':Sequelize[_0x4d72('0x7')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x4d72('0x7')]},'secondDisposition':{'type':Sequelize[_0x4d72('0x7')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x4d72('0x7')]},'browserName':{'type':Sequelize[_0x4d72('0x7')]},'browserVersion':{'type':Sequelize['STRING']},'osName':{'type':Sequelize['STRING']},'osVersion':{'type':Sequelize['STRING']},'deviceModel':{'type':Sequelize[_0x4d72('0x7')]},'deviceVendor':{'type':Sequelize['STRING']},'deviceType':{'type':Sequelize[_0x4d72('0x7')]},'referer':{'type':Sequelize['TEXT']},'customerIp':{'type':Sequelize[_0x4d72('0x7')]},'formData':{'type':Sequelize['TEXT'](_0x4d72('0x8'))},'read1stAt':{'type':Sequelize[_0x4d72('0x9')]},'lastMsgAt':{'type':Sequelize[_0x4d72('0x9')]},'lastMsgDirection':{'type':Sequelize[_0x4d72('0xa')]('in',_0x4d72('0xb')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x4d72('0x7')]},'customerPort':{'type':Sequelize[_0x4d72('0x7')]},'vidaooSessionId':{'type':Sequelize[_0x4d72('0x6')]},'autoreplyExecuted':{'type':Sequelize[_0x4d72('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x4d72('0x3')]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index 6014531..7872ee2 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 _0x66a4=['agent','interaction','account','index','map','rawAttributes','type','key','getOptions','findAll','chat','query','user','show','model','ChatInteraction','filters','intersection','attributes','fields','length','includeAll','include','find','create','params','describe','createVidaooSession','ChatWebsite','findOne','ChatWebsiteId','vidaooApiKey','vidaooEscalation','vidaooTopic','vidaooNote','fullname','email','POST','isNull','follow','vidaooMetadata','parse','metadata','ValidationError','out','Sequelize','updateAttributes','customUpdate','CmContact','Contact','abandon','UserId','closed','disposition','AbandonInteraction','originalname','file','filename','mimetype','Unauthorized','Attachment','attachId','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','basename','download','close','mailTranscript','now','pathTranscript','Messages','User','ContactId','%s%d','agentAlias','format','Visitor','agentIdentifier','website_alias','System','agent_alias','alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','createdAt','MM/DD/YYYY\x20HH:mm:ss','direction','secret','appendFileSync','MailAccount','MailServerOut','CloudProvider','Smtp','SendMail','sendMail','\x22%s\x22\x20<%s>','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ChatMessage','ids','getMessages','keys','hasOwnProperty','nolimit','order','sort','where','pick','ChatInteractionId','filter','$gte','options','getMyMessages','push','addTags','setTags','spread','Tag','color','chatInteractionTags:save','removeTags','unix','toString','server','files','tmp','attachments','firstName','read','Account','Owner','get','mkdirSync','Chat','YYYY-MM-DD\x20HH:mm:ss','closedAt','browserName','osName','referer','customerIp','customerPort','N.A.','existsSync','createReadStream','pipe','lastName','views','downloadInteraction.ejs','transcript-','createPdfFromHTML','err','unlinkSync','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','ejs','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','register','jayson/promise','client','http','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','update','end','stack','name','send','render','merge','body','contact'];(function(_0x3910f4,_0x9131d0){var _0x209b59=function(_0x2d0e31){while(--_0x2d0e31){_0x3910f4['push'](_0x3910f4['shift']());}};_0x209b59(++_0x9131d0);}(_0x66a4,0x16b));var _0x466a=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x66a4[_0x321bb2];return _0x9c12ed;};'use strict';var rimraf=require(_0x466a('0x0'));var zipdir=require(_0x466a('0x1'));var rp=require(_0x466a('0x2'));var moment=require(_0x466a('0x3'));var BPromise=require(_0x466a('0x4'));var Mustache=require(_0x466a('0x5'));var util=require(_0x466a('0x6'));var path=require('path');var ejs=require(_0x466a('0x7'));var fs=require('fs');var _=require('lodash');var Redis=require('ioredis');var interaction=require(_0x466a('0x8'));var qs=require(_0x466a('0x9'));var pdf=require(_0x466a('0xa'));var logger=require(_0x466a('0xb'))(_0x466a('0xc'));var config=require(_0x466a('0xd'));var db=require(_0x466a('0xe'))['db'];config[_0x466a('0xf')]=_[_0x466a('0x10')](config[_0x466a('0xf')],{'host':_0x466a('0x11'),'port':0x18eb});var socket=require(_0x466a('0x12'))(new Redis(config['redis']));require(_0x466a('0x13'))[_0x466a('0x14')](socket);var jayson=require(_0x466a('0x15'));var client=jayson[_0x466a('0x16')][_0x466a('0x17')]({'port':0x232b});var client9004=jayson[_0x466a('0x16')][_0x466a('0x17')]({'port':0x232c});function respondWithRpcPromise(_0x6bd5be,_0x5052dd,_0x1e0e10,_0x49f952){return new BPromise(function(_0x1539d0,_0x4d5ba7){var _0x2d07f2=_0x49f952||client;return _0x2d07f2[_0x466a('0x18')](_0x6bd5be,_0x1e0e10)[_0x466a('0x19')](function(_0x2f81fb){logger[_0x466a('0x1a')](_0x466a('0x1b'),_0x5052dd,_0x466a('0x1c'));logger['debug'](_0x466a('0x1d'),_0x5052dd,_0x466a('0x1c'),JSON[_0x466a('0x1e')](_0x2f81fb));if(_0x2f81fb[_0x466a('0x1f')]){if(_0x2f81fb[_0x466a('0x1f')][_0x466a('0x20')]===0x1f4){logger[_0x466a('0x1f')](_0x466a('0x1b'),_0x5052dd,_0x2f81fb[_0x466a('0x1f')][_0x466a('0x21')]);return _0x4d5ba7(_0x2f81fb['error'][_0x466a('0x21')]);}logger[_0x466a('0x1f')](_0x466a('0x1b'),_0x5052dd,_0x2f81fb[_0x466a('0x1f')][_0x466a('0x21')]);return _0x1539d0(_0x2f81fb[_0x466a('0x1f')][_0x466a('0x21')]);}else{logger[_0x466a('0x1a')]('ChatInteraction,\x20%s,\x20%s',_0x5052dd,'request\x20sent');_0x1539d0(_0x2f81fb['result'][_0x466a('0x21')]);}})[_0x466a('0x22')](function(_0xaf749c){logger[_0x466a('0x1f')](_0x466a('0x1b'),_0x5052dd,_0xaf749c);_0x4d5ba7(_0xaf749c);});});}function respondWithStatusCode(_0x39764a,_0x204298){_0x204298=_0x204298||0xcc;return function(_0x106885){if(_0x106885){return _0x39764a[_0x466a('0x23')](_0x204298);}return _0x39764a[_0x466a('0x24')](_0x204298)['end']();};}function respondWithResult(_0x445752,_0x4f2b39){_0x4f2b39=_0x4f2b39||0xc8;return function(_0x17e788){if(_0x17e788){return _0x445752[_0x466a('0x24')](_0x4f2b39)[_0x466a('0x25')](_0x17e788);}};}function respondWithFilteredResult(_0x57c1ec,_0x3c0e64){return function(_0x4597eb){if(_0x4597eb){var _0x35d6c3=typeof _0x3c0e64['offset']===_0x466a('0x26')&&typeof _0x3c0e64['limit']===_0x466a('0x26');var _0x425f28=_0x4597eb[_0x466a('0x27')];var _0xb5b999=_0x35d6c3?0x0:_0x3c0e64[_0x466a('0x28')];var _0x13c397=_0x35d6c3?_0x4597eb['count']:_0x3c0e64[_0x466a('0x28')]+_0x3c0e64[_0x466a('0x29')];var _0x5c6eb7;if(_0x13c397>=_0x425f28){_0x13c397=_0x425f28;_0x5c6eb7=0xc8;}else{_0x5c6eb7=0xce;}_0x57c1ec[_0x466a('0x24')](_0x5c6eb7);return _0x57c1ec[_0x466a('0x2a')](_0x466a('0x2b'),_0xb5b999+'-'+_0x13c397+'/'+_0x425f28)[_0x466a('0x25')](_0x4597eb);}return null;};}function saveUpdates(_0x3ea1b7){return function(_0x33363d){if(_0x33363d){return _0x33363d[_0x466a('0x2c')](_0x3ea1b7)['then'](function(_0x293126){return _0x293126;});}return null;};}function removeEntity(_0x28783c){return function(_0x99465b){if(_0x99465b){return _0x99465b['destroy']()[_0x466a('0x19')](function(){_0x28783c[_0x466a('0x24')](0xcc)[_0x466a('0x2d')]();});}};}function handleEntityNotFound(_0x5de479){return function(_0x256004){if(!_0x256004){_0x5de479[_0x466a('0x23')](0x194);}return _0x256004;};}function handleError(_0x2e85e5,_0x2db178){_0x2db178=_0x2db178||0x1f4;return function(_0x189b82){logger[_0x466a('0x1f')](_0x189b82[_0x466a('0x2e')]);if(_0x189b82[_0x466a('0x2f')]){delete _0x189b82[_0x466a('0x2f')];}_0x2e85e5[_0x466a('0x24')](_0x2db178)[_0x466a('0x30')](_0x189b82);};}function getMustacheRender(_0x18e738,_0x2101b9){return Mustache[_0x466a('0x31')](_0x18e738,_[_0x466a('0x32')](_0x2101b9[_0x466a('0x33')],{'contact':_0x2101b9[_0x466a('0x34')],'message':_0x2101b9['message'],'agent':_0x2101b9[_0x466a('0x35')],'interaction':_0x2101b9[_0x466a('0x36')],'account':_0x2101b9[_0x466a('0x37')]}))||'';}exports[_0x466a('0x38')]=function(_0x5b946b,_0x165f65){var _0xda55ab={};var _0x3d2451=_[_0x466a('0x39')](db['ChatInteraction'][_0x466a('0x3a')],function(_0xb02bf1){return{'name':_0xb02bf1['fieldName'],'type':_0xb02bf1[_0x466a('0x3b')][_0x466a('0x3c')]};});_0xda55ab=qs[_0x466a('0x3d')](_0x3d2451,_0x5b946b);return interaction[_0x466a('0x3e')](_0x466a('0x3f'),_0x5b946b[_0x466a('0x40')],_0x5b946b[_0x466a('0x41')],_0xda55ab,_0x3d2451)[_0x466a('0x19')](respondWithFilteredResult(_0x165f65,_0xda55ab))['catch'](handleError(_0x165f65,null));};exports[_0x466a('0x42')]=function(_0x311875,_0x3ddead){var _0x3fa716={'raw':![],'where':{'id':_0x311875['params']['id']}},_0x306856={};_0x306856[_0x466a('0x43')]=_['keys'](db[_0x466a('0x44')][_0x466a('0x3a')]);_0x306856['query']=_['keys'](_0x311875[_0x466a('0x40')]);_0x306856[_0x466a('0x45')]=_[_0x466a('0x46')](_0x306856['model'],_0x306856[_0x466a('0x40')]);_0x3fa716[_0x466a('0x47')]=_[_0x466a('0x46')](_0x306856[_0x466a('0x43')],qs[_0x466a('0x48')](_0x311875[_0x466a('0x40')]['fields']));_0x3fa716[_0x466a('0x47')]=_0x3fa716['attributes'][_0x466a('0x49')]?_0x3fa716[_0x466a('0x47')]:_0x306856['model'];if(_0x311875[_0x466a('0x40')][_0x466a('0x4a')]){_0x3fa716[_0x466a('0x4b')]=[{'all':!![]}];}_0x3fa716=_[_0x466a('0x32')]({},_0x3fa716,_0x311875['options']);return db[_0x466a('0x44')][_0x466a('0x4c')](_0x3fa716)['then'](handleEntityNotFound(_0x3ddead,null))[_0x466a('0x19')](respondWithResult(_0x3ddead,null))[_0x466a('0x22')](handleError(_0x3ddead,null));};exports['create']=function(_0x240808,_0x574d53){return db[_0x466a('0x44')][_0x466a('0x4d')](_0x240808[_0x466a('0x33')],{})[_0x466a('0x19')](respondWithResult(_0x574d53,0xc9))[_0x466a('0x22')](handleError(_0x574d53,null));};exports[_0x466a('0x2c')]=function(_0x2d918f,_0x222cb1){if(_0x2d918f[_0x466a('0x33')]['id']){delete _0x2d918f[_0x466a('0x33')]['id'];}return db[_0x466a('0x44')]['find']({'where':{'id':_0x2d918f[_0x466a('0x4e')]['id']}})['then'](handleEntityNotFound(_0x222cb1,null))[_0x466a('0x19')](saveUpdates(_0x2d918f[_0x466a('0x33')],null))['then'](respondWithResult(_0x222cb1,null))[_0x466a('0x22')](handleError(_0x222cb1,null));};exports['destroy']=function(_0x2fcb12,_0x4dd2f3){return db[_0x466a('0x44')][_0x466a('0x4c')]({'where':{'id':_0x2fcb12['params']['id']}})[_0x466a('0x19')](handleEntityNotFound(_0x4dd2f3,null))[_0x466a('0x19')](removeEntity(_0x4dd2f3,null))[_0x466a('0x22')](handleError(_0x4dd2f3,null));};exports[_0x466a('0x4f')]=function(_0x40d2e1,_0x4fb89e){return db['ChatInteraction']['describe']()[_0x466a('0x19')](respondWithResult(_0x4fb89e,null))[_0x466a('0x22')](handleError(_0x4fb89e,null));};exports[_0x466a('0x50')]=function(_0x16aab6,_0x5e7998){var _0x34ba73=_0x16aab6[_0x466a('0x4e')]['id'];var _0x22998b;var _0x28360b;var _0x2edec4;return db['ChatInteraction']['findOne']({'where':{'id':_0x34ba73}})[_0x466a('0x19')](function(_0x4965b5){_0x22998b=_0x4965b5;return db[_0x466a('0x51')][_0x466a('0x52')]({'where':{'id':_0x4965b5[_0x466a('0x53')]},'attributes':['id',_0x466a('0x54'),_0x466a('0x55'),_0x466a('0x56'),_0x466a('0x57'),'vidaooMetadata'],'raw':!![]});})[_0x466a('0x19')](function(_0x12b583){if(_0x12b583&&_0x12b583[_0x466a('0x54')]&&_0x12b583[_0x466a('0x55')]){_0x28360b=_0x12b583;var _0x11273c={'interaction':{'id':_0x34ba73},'agent':{'id':_0x16aab6[_0x466a('0x41')]['id'],'name':_0x16aab6['user']['name'],'fullname':_0x16aab6['user'][_0x466a('0x58')],'email':_0x16aab6['user'][_0x466a('0x59')]},'contact':_0x16aab6[_0x466a('0x33')][_0x466a('0x34')],'account':_0x16aab6[_0x466a('0x33')]['account']};var _0x3f4326={'rejectUnauthorized':![],'method':_0x466a('0x5a'),'url':'https://api-vidaoo.xcally.com/api/v1/meetings','headers':{'X-APIKEY':_0x12b583[_0x466a('0x54')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x16aab6[_0x466a('0x41')][_0x466a('0x59')]],'buttons':null,'topic':_0x28360b[_0x466a('0x56')],'note':_[_0x466a('0x5b')](_0x28360b['vidaooNote'])?null:getMustacheRender(_0x28360b[_0x466a('0x57')],_0x11273c),'metadata':null},'redirect':_0x466a('0x5c'),'json':!![]};try{if(!_['isNull'](_0x28360b[_0x466a('0x5d')])){var _0x4409b1=getMustacheRender(_0x28360b['vidaooMetadata'],_0x11273c);var _0x4d5fb0=JSON[_0x466a('0x5e')](_0x4409b1);_0x3f4326[_0x466a('0x33')][_0x466a('0x5f')]=_0x4d5fb0;}}catch(_0x461237){throw new db['Sequelize'][(_0x466a('0x60'))]('Error\x20in\x20conversion\x20vidaooMetadata');}return rp(_0x3f4326);}else{throw new db['Sequelize']['ValidationError']('Error\x20in\x20Vidaoo\x20configuration');}})[_0x466a('0x19')](function(_0x341beb){_0x2edec4=_0x341beb;if(_0x2edec4['id']){var _0xba2739={'body':_0x2edec4['join_url'],'ChatWebsiteId':_0x28360b['id'],'ChatInteractionId':_0x22998b['id'],'direction':_0x466a('0x61'),'UserId':_0x16aab6[_0x466a('0x41')]['id']};return db['ChatMessage']['create'](_0xba2739,{});}else{throw new db[(_0x466a('0x62'))][(_0x466a('0x60'))]('Unable\x20to\x20create\x20Vidaoo\x20session');}})[_0x466a('0x19')](function(){return _0x22998b[_0x466a('0x63')]({'vidaooSessionId':_0x2edec4['id']});})[_0x466a('0x19')](respondWithResult(_0x5e7998,null))['catch'](handleError(_0x5e7998,null));};exports[_0x466a('0x64')]=function(_0x16a423,_0x3ab9d4){if(_0x16a423['body']['id']){delete _0x16a423[_0x466a('0x33')]['id'];}return db[_0x466a('0x44')]['find']({'where':{'id':_0x16a423[_0x466a('0x4e')]['id']},'include':[{'model':db[_0x466a('0x65')],'as':_0x466a('0x66')}]})[_0x466a('0x19')](handleEntityNotFound(_0x3ab9d4,null))[_0x466a('0x19')](saveUpdates(_0x16a423[_0x466a('0x33')],null))['then'](respondWithResult(_0x3ab9d4,null))[_0x466a('0x22')](handleError(_0x3ab9d4,null));};exports[_0x466a('0x67')]=function(_0x4955dc,_0x5eece0){if(_0x4955dc[_0x466a('0x33')]['id']){delete _0x4955dc['body']['id'];}return db[_0x466a('0x44')][_0x466a('0x4c')]({'where':{'id':_0x4955dc[_0x466a('0x4e')]['id']}})[_0x466a('0x19')](function(_0x4a7534){if(!_0x4a7534){logger[_0x466a('0x1f')]('abandonInteraction,\x20%s,\x20%s,\x20%s','abandon',0x194,'entity\x20not\x20found');_0x5eece0[_0x466a('0x23')](0x194);}else{if(_0x4a7534[_0x466a('0x68')]){throw new db['Sequelize'][(_0x466a('0x60'))]('Interaction\x20already\x20assigned');}}return _0x4a7534;})[_0x466a('0x19')](function(_0xb85a34){if(_0xb85a34){return _0xb85a34[_0x466a('0x2c')]({'closed':_0x4955dc['body'][_0x466a('0x69')],'disposition':_0x4955dc[_0x466a('0x33')][_0x466a('0x6a')]})['then'](function(_0x5d84fb){return _0x5d84fb;});}})[_0x466a('0x19')](function(){return respondWithRpcPromise(_0x466a('0x6b'),'abandon',_0x4955dc[_0x466a('0x33')],client9004);})[_0x466a('0x19')](respondWithResult(_0x5eece0,null))[_0x466a('0x22')](handleError(_0x5eece0,null));};exports['attachmentUpload']=function(_0x3b775b,_0x2ed145){_0x3b775b[_0x466a('0x33')][_0x466a('0x2f')]=_0x3b775b['file'][_0x466a('0x6c')];_0x3b775b[_0x466a('0x33')]['basename']=_0x3b775b[_0x466a('0x6d')][_0x466a('0x6e')];_0x3b775b[_0x466a('0x33')][_0x466a('0x3b')]=_0x3b775b[_0x466a('0x6d')][_0x466a('0x6f')];return db['Attachment']['create'](_0x3b775b['body'])['then'](respondWithResult(_0x2ed145,0xc9))[_0x466a('0x22')](handleError(_0x2ed145,null));};exports['attachmentDownload']=function(_0x31fe52,_0x32a57f){return db[_0x466a('0x44')][_0x466a('0x52')]({'where':{'id':_0x31fe52['params']['id']},'raw':!![]})[_0x466a('0x19')](handleEntityNotFound(_0x32a57f,null))[_0x466a('0x19')](function(_0x43305d){if(_0x43305d){if(_0x43305d[_0x466a('0x69')]){return _0x32a57f[_0x466a('0x24')](0x193)['json']({'status':0x193,'message':_0x466a('0x70')});}return db[_0x466a('0x71')][_0x466a('0x52')]({'where':{'id':_0x31fe52[_0x466a('0x40')][_0x466a('0x72')]},'raw':!![]})[_0x466a('0x19')](handleEntityNotFound(_0x32a57f,null));}})[_0x466a('0x19')](function(_0x2d2ae5){if(_0x2d2ae5){var _0xb0f97b=_0x2d2ae5[_0x466a('0x73')]!==null;var _0x38b687=path[_0x466a('0x74')](config[_0x466a('0x75')],_0x466a('0x76'));if(_0xb0f97b){_0x38b687=path[_0x466a('0x74')](_0x38b687,_0x466a('0x77'));}var _0x230aa2=path[_0x466a('0x74')](_0x38b687,_0x2d2ae5[_0x466a('0x78')]);return _0x32a57f[_0x466a('0x79')](_0x230aa2);}})[_0x466a('0x22')](handleError(_0x32a57f,null));};exports[_0x466a('0x7a')]=function(_0x1d57e5,_0x811ef4){var _0x4a36a5=null;var _0x510304=null;var _0x1e9096=null;if(_0x1d57e5[_0x466a('0x33')]['id']){delete _0x1d57e5[_0x466a('0x33')]['id'];}if(_0x1d57e5['body'][_0x466a('0x7b')]){_0x1e9096=path[_0x466a('0x74')](config[_0x466a('0x75')],'server/files/chat/upload/',util['format']('transcript-%s.txt',Date[_0x466a('0x7c')]()));_0x1d57e5[_0x466a('0x33')][_0x466a('0x7d')]=_0x1e9096;}return db[_0x466a('0x44')][_0x466a('0x4c')]({'where':{'id':_0x1d57e5['params']['id']},'include':[{'model':db['ChatMessage'],'as':_0x466a('0x7e'),'include':[{'model':db[_0x466a('0x7f')],'as':_0x466a('0x7f')}]}]})[_0x466a('0x19')](handleEntityNotFound(_0x811ef4,null))[_0x466a('0x19')](saveUpdates(_0x1d57e5[_0x466a('0x33')],null))[_0x466a('0x19')](function(_0x239473){if(_0x239473){_0x4a36a5=_0x239473;return db[_0x466a('0x51')][_0x466a('0x4c')]({'where':{'id':_0x4a36a5[_0x466a('0x53')]}});}})[_0x466a('0x19')](function(_0x4b4149){if(_0x4b4149){_0x510304=_0x4b4149;return db['CmContact']['find']({'where':{'id':_0x4a36a5[_0x466a('0x80')]}});}})[_0x466a('0x19')](function(_0x5e07e9){if(_0x5e07e9){if(_0x1e9096){var _0x52e9cf=null;for(var _0x51e0d2=0x1;_0x51e0d2<_0x4a36a5[_0x466a('0x7e')][_0x466a('0x49')];++_0x51e0d2){_0x52e9cf=_0x4a36a5[_0x466a('0x7e')][_0x51e0d2];var _0x4743e2=_0x52e9cf[_0x466a('0x68')]?util['format'](_0x466a('0x81'),_0x510304[_0x466a('0x82')],_0x52e9cf[_0x466a('0x68')]):'System';var _0x3f54ad=_0x1d57e5[_0x466a('0x33')]['customer']||util[_0x466a('0x83')](_0x466a('0x81'),_0x466a('0x84'),_0x52e9cf['ContactId']);switch(_0x510304[_0x466a('0x85')]){case _0x466a('0x86'):_0x4743e2=_0x52e9cf[_0x466a('0x68')]?util[_0x466a('0x83')](_0x466a('0x81'),_0x510304[_0x466a('0x82')],_0x52e9cf[_0x466a('0x68')]):_0x466a('0x87');break;case _0x466a('0x88'):_0x4743e2=_0x52e9cf[_0x466a('0x68')]?_0x52e9cf[_0x466a('0x7f')][_0x466a('0x89')]||_0x52e9cf['User'][_0x466a('0x58')]:_0x466a('0x87');break;case _0x466a('0x8a'):_0x4743e2=_0x52e9cf[_0x466a('0x68')]?_0x52e9cf['User'][_0x466a('0x58')]:'System';break;default:_0x4743e2=_0x52e9cf['UserId']?util[_0x466a('0x83')]('%s%d',_0x510304[_0x466a('0x82')],_0x52e9cf[_0x466a('0x68')]):_0x466a('0x87');}var _0x495d76=util['format'](_0x466a('0x8b'),moment(_0x52e9cf[_0x466a('0x8c')])[_0x466a('0x83')](_0x466a('0x8d')),_0x52e9cf[_0x466a('0x8e')]==='in'?_0x3f54ad:_0x4743e2,_0x52e9cf['body']);if(!_0x52e9cf[_0x466a('0x8f')]){fs[_0x466a('0x90')](_0x1e9096,_0x495d76);}}return db[_0x466a('0x91')][_0x466a('0x52')]({'where':{'service':!![]},'include':[{'model':db[_0x466a('0x92')],'as':'Smtp','raw':!![],'include':[{'model':db[_0x466a('0x93')],'as':_0x466a('0x93'),'raw':!![]}]}]});}}})[_0x466a('0x19')](function(_0x2d3d8e){if(!_0x2d3d8e||!_0x2d3d8e[_0x466a('0x94')]||!_0x1d57e5[_0x466a('0x33')])return _0x4a36a5;var _0x4f6a26=_0x2d3d8e['getSmtpOptions']();return respondWithRpcPromise(_0x466a('0x95'),_0x466a('0x96'),{'account':_0x4f6a26,'message':{'from':util[_0x466a('0x83')](_0x466a('0x97'),_0x2d3d8e[_0x466a('0x2f')],_0x2d3d8e[_0x466a('0x59')]||_0x2d3d8e['Smtp'][_0x466a('0x41')]),'to':_0x1d57e5[_0x466a('0x33')][_0x466a('0x7b')],'subject':'Mail\x20Transcript','text':util[_0x466a('0x83')](_0x466a('0x98'),_0x1d57e5[_0x466a('0x33')]['mailTranscript']),'attachments':[{'path':_0x1e9096}]}})[_0x466a('0x19')](function(){return _0x4a36a5;})[_0x466a('0x22')](function(_0x51dc1f){logger[_0x466a('0x1f')](_0x51dc1f);});})[_0x466a('0x19')](respondWithStatusCode(_0x811ef4,0xc8))[_0x466a('0x22')](handleError(_0x811ef4,null));};exports[_0x466a('0x99')]=function(_0x31c971,_0xb04ed4){return db[_0x466a('0x9a')][_0x466a('0x4c')]({'where':{'id':_0x31c971[_0x466a('0x4e')]['id']}})[_0x466a('0x19')](handleEntityNotFound(_0xb04ed4,null))[_0x466a('0x19')](function(_0x40c95){if(_0x40c95){return _0x40c95[_0x466a('0x99')](_0x31c971[_0x466a('0x33')][_0x466a('0x9b')],_['omit'](_0x31c971[_0x466a('0x33')],[_0x466a('0x9b'),'id'])||{});}})[_0x466a('0x19')](respondWithResult(_0xb04ed4,null))[_0x466a('0x22')](handleError(_0xb04ed4,null));};exports[_0x466a('0x9c')]=function(_0x2f1e61,_0x4bd570){var _0x20b621={'raw':![],'where':{}};var _0x35445e={};var _0x3a68ca={'count':0x0,'rows':[]};return db['ChatInteraction'][_0x466a('0x52')]({'where':{'id':_0x2f1e61['params']['id']}})[_0x466a('0x19')](handleEntityNotFound(_0x4bd570,null))[_0x466a('0x19')](function(_0x2ad6ce){if(_0x2ad6ce){_0x35445e['model']=_['keys'](db[_0x466a('0x9a')][_0x466a('0x3a')]);_0x35445e[_0x466a('0x40')]=_[_0x466a('0x9d')](_0x2f1e61[_0x466a('0x40')]);_0x35445e[_0x466a('0x45')]=_[_0x466a('0x46')](_0x35445e['model'],_0x35445e[_0x466a('0x40')]);_0x20b621[_0x466a('0x47')]=_[_0x466a('0x46')](_0x35445e[_0x466a('0x43')],qs['fields'](_0x2f1e61[_0x466a('0x40')][_0x466a('0x48')]));_0x20b621[_0x466a('0x47')]=_0x20b621[_0x466a('0x47')]['length']?_0x20b621[_0x466a('0x47')]:_0x35445e[_0x466a('0x43')];if(!_0x2f1e61[_0x466a('0x40')][_0x466a('0x9e')](_0x466a('0x9f'))){_0x20b621[_0x466a('0x29')]=qs[_0x466a('0x29')](_0x2f1e61[_0x466a('0x40')][_0x466a('0x29')]);_0x20b621['offset']=qs['offset'](_0x2f1e61[_0x466a('0x40')][_0x466a('0x28')]);}_0x20b621[_0x466a('0xa0')]=qs[_0x466a('0xa1')](_0x2f1e61[_0x466a('0x40')][_0x466a('0xa1')]);_0x20b621[_0x466a('0xa2')]=qs['filters'](_[_0x466a('0xa3')](_0x2f1e61[_0x466a('0x40')],_0x35445e[_0x466a('0x45')]));_0x20b621[_0x466a('0xa2')][_0x466a('0xa4')]=_0x2ad6ce['id'];if(_0x2f1e61['query'][_0x466a('0xa5')]){_0x20b621[_0x466a('0xa2')]=_[_0x466a('0x32')](_0x20b621[_0x466a('0xa2')],{'$or':_[_0x466a('0x39')](_0x20b621[_0x466a('0x47')],function(_0x349fe2){var _0xa628bf={};_0xa628bf[_0x349fe2]={'$like':'%'+_0x2f1e61['query'][_0x466a('0xa5')]+'%'};return _0xa628bf;})});}if(_0x2f1e61['query'][_0x466a('0xa6')]){var _0x615ee5=_0x2f1e61[_0x466a('0x40')][_0x466a('0xa6')]['split'](',');var _0x5e139c={};_0x5e139c[_0x615ee5[0x0]]={'$gte':moment(_0x615ee5[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x20b621[_0x466a('0xa2')]=_[_0x466a('0x32')](_0x20b621['where'],_0x5e139c);}_0x20b621=_[_0x466a('0x32')]({},_0x20b621,_0x2f1e61[_0x466a('0xa7')]);return db['ChatMessage']['count']({'where':_0x20b621[_0x466a('0xa2')]})[_0x466a('0x19')](function(_0x385229){_0x3a68ca['count']=_0x385229;if(_0x2f1e61[_0x466a('0x40')][_0x466a('0x4a')]){_0x20b621[_0x466a('0x4b')]=[{'all':!![]}];}return db[_0x466a('0x9a')][_0x466a('0x3e')](_0x20b621);})[_0x466a('0x19')](function(_0x5389e1){_0x3a68ca['rows']=_0x5389e1;return _0x3a68ca;});}})['then'](respondWithFilteredResult(_0x4bd570,_0x20b621))[_0x466a('0x22')](handleError(_0x4bd570,null));};exports[_0x466a('0xa8')]=function(_0x22921b,_0x4f209c){var _0x32eeea={'where':{}},_0x22d1ec={},_0x22f583={'count':0x0,'rows':[]};return db[_0x466a('0x44')][_0x466a('0x52')]({'where':{'id':_0x22921b[_0x466a('0x4e')]['id']}})[_0x466a('0x19')](handleEntityNotFound(_0x4f209c,null))[_0x466a('0x19')](function(_0x1396e8){if(_0x1396e8){_0x22d1ec[_0x466a('0x43')]=_[_0x466a('0x9d')](db[_0x466a('0x9a')][_0x466a('0x3a')]);_0x22d1ec[_0x466a('0x40')]=_[_0x466a('0x9d')](_0x22921b[_0x466a('0x40')]);_0x22d1ec['filters']=_['intersection'](_0x22d1ec[_0x466a('0x43')],_0x22d1ec[_0x466a('0x40')]);_0x32eeea[_0x466a('0x47')]=_['intersection'](_0x22d1ec[_0x466a('0x43')],qs[_0x466a('0x48')](_0x22921b[_0x466a('0x40')][_0x466a('0x48')]));_0x32eeea['attributes']=_0x32eeea['attributes'][_0x466a('0x49')]?_0x32eeea[_0x466a('0x47')]:_0x22d1ec[_0x466a('0x43')];if(!_0x22921b[_0x466a('0x40')][_0x466a('0x9e')](_0x466a('0x9f'))){_0x32eeea['limit']=qs[_0x466a('0x29')](_0x22921b[_0x466a('0x40')][_0x466a('0x29')]);_0x32eeea[_0x466a('0x28')]=qs[_0x466a('0x28')](_0x22921b[_0x466a('0x40')][_0x466a('0x28')]);}_0x32eeea[_0x466a('0xa0')]=qs[_0x466a('0xa1')](_0x22921b[_0x466a('0x40')][_0x466a('0xa1')]);_0x32eeea[_0x466a('0xa2')]=qs['filters'](_[_0x466a('0xa3')](_0x22921b[_0x466a('0x40')],_0x22d1ec[_0x466a('0x45')]));_0x32eeea[_0x466a('0xa2')][_0x466a('0xa4')]=_0x1396e8['id'];if(_0x22921b[_0x466a('0x40')]['filter']){_0x32eeea[_0x466a('0xa2')]=_[_0x466a('0x32')](_0x32eeea[_0x466a('0xa2')],{'$or':_[_0x466a('0x39')](_0x32eeea[_0x466a('0x47')],function(_0x5dc290){var _0x214a10={};_0x214a10[_0x5dc290]={'$like':'%'+_0x22921b['query'][_0x466a('0xa5')]+'%'};return _0x214a10;})});}_0x32eeea[_0x466a('0xa2')][_0x466a('0x8f')]=![];if(_0x22921b[_0x466a('0x40')]['id']){_0x32eeea['where']['id']={'$gt':_0x22921b[_0x466a('0x40')]['id']};}_0x32eeea=_['merge']({},_0x32eeea,_0x22921b[_0x466a('0xa7')]);return db[_0x466a('0x9a')][_0x466a('0x27')]({'where':_0x32eeea[_0x466a('0xa2')]})[_0x466a('0x19')](function(_0x2630fe){_0x22f583[_0x466a('0x27')]=_0x2630fe;_0x32eeea['include']=[];if(_0x22921b[_0x466a('0x40')]['includeAgent']){_0x32eeea[_0x466a('0x4b')][_0x466a('0xa9')]({'model':db[_0x466a('0x7f')],'as':_0x466a('0x7f'),'attributes':['id',_0x466a('0x58'),_0x466a('0x89')]});}if(_0x22921b[_0x466a('0x40')][_0x466a('0x4a')]){_0x32eeea['include']=[{'all':!![]}];}return db['ChatMessage']['findAll'](_0x32eeea);})[_0x466a('0x19')](function(_0x2f2b9c){_0x22f583['rows']=_0x2f2b9c;return _0x22f583;});}})[_0x466a('0x19')](respondWithFilteredResult(_0x4f209c,_0x32eeea))[_0x466a('0x22')](handleError(_0x4f209c,null));};exports[_0x466a('0xaa')]=function(_0x2fa17f,_0x4bf931){return db['ChatInteraction']['find']({'where':{'id':_0x2fa17f[_0x466a('0x4e')]['id']}})[_0x466a('0x19')](handleEntityNotFound(_0x4bf931,null))[_0x466a('0x19')](function(_0x3aa0a9){if(_0x3aa0a9){return _0x3aa0a9[_0x466a('0xab')](_0x2fa17f[_0x466a('0x33')][_0x466a('0x9b')],_['omit'](_0x2fa17f[_0x466a('0x33')],['ids','id'])||{})[_0x466a('0xac')](function(){return db[_0x466a('0xad')]['findAll']({'attributes':['id','name',_0x466a('0xae')],'where':{'id':_0x2fa17f[_0x466a('0x33')][_0x466a('0x9b')]}});})['then'](function(_0x1ed1f3){socket['emit'](_0x466a('0xaf'),{'id':Number(_0x2fa17f[_0x466a('0x4e')]['id']),'tags':_0x1ed1f3||[]});return{'id':Number(_0x2fa17f[_0x466a('0x4e')]['id']),'tags':_0x1ed1f3||[]};});}})[_0x466a('0x19')](respondWithResult(_0x4bf931,null))[_0x466a('0x22')](handleError(_0x4bf931,null));};exports[_0x466a('0xb0')]=function(_0x566029,_0x35b907){return db[_0x466a('0x44')][_0x466a('0x4c')]({'where':{'id':_0x566029[_0x466a('0x4e')]['id']}})[_0x466a('0x19')](handleEntityNotFound(_0x35b907,null))[_0x466a('0x19')](function(_0x1c9b4c){if(_0x1c9b4c){return _0x1c9b4c[_0x466a('0xb0')](_0x566029['query'][_0x466a('0x9b')]);}})[_0x466a('0x19')](respondWithStatusCode(_0x35b907,null))[_0x466a('0x22')](handleError(_0x35b907,null));};exports[_0x466a('0x79')]=function(_0x38ddf9,_0x42a10d){var _0x1d42f0=moment()[_0x466a('0xb1')]()[_0x466a('0xb2')]();var _0x4992ff=path[_0x466a('0x74')](config['root'],_0x466a('0xb3'),_0x466a('0xb4'),_0x466a('0xb5'));var _0x3651b1=path[_0x466a('0x74')](config['root'],_0x466a('0xb3'),_0x466a('0xb4'),_0x466a('0xb6'));var _0x5a9a3c=path[_0x466a('0x74')](_0x4992ff,_0x1d42f0);var _0x5c13d2=util[_0x466a('0x83')]('transcript-%d-%s.zip',_0x38ddf9['params']['id'],_0x1d42f0);var _0x2f0211=path[_0x466a('0x74')](_0x4992ff,_0x5c13d2);var _0x51fbec=[];_0x51fbec[_0x466a('0xa9')]({'model':db['User'],'as':'User','attributes':['id','fullname'],'raw':!![]});_0x51fbec['push']({'model':db[_0x466a('0x65')],'as':_0x466a('0x66'),'attributes':['id',_0x466a('0xb7'),'lastName'],'raw':!![]});if(_0x38ddf9['query'][_0x466a('0xb6')]){_0x51fbec['push']({'model':db['Attachment'],'as':'Attachment','raw':!![]});}var _0x2a0b6b=[{'model':db['ChatMessage'],'as':_0x466a('0x7e'),'attributes':['id',_0x466a('0x33'),'createdAt',_0x466a('0x8e'),_0x466a('0x8f'),_0x466a('0xb8')],'include':_0x51fbec}];_0x2a0b6b[_0x466a('0xa9')]({'model':db['ChatWebsite'],'as':_0x466a('0xb9'),'attributes':['id','name']});_0x2a0b6b[_0x466a('0xa9')]({'model':db[_0x466a('0x7f')],'as':_0x466a('0xba'),'attributes':['id',_0x466a('0x58')]});return db[_0x466a('0x44')]['find']({'where':{'id':_0x38ddf9[_0x466a('0x4e')]['id']},'include':_0x2a0b6b})[_0x466a('0x19')](handleEntityNotFound(_0x42a10d,null))['then'](function(_0x301a8a){if(_0x301a8a){var _0x3a512e=_0x301a8a[_0x466a('0xbb')]({'plain':!![]});fs[_0x466a('0xbc')](_0x5a9a3c);var _0x461c12={'channel':_0x466a('0xbd'),'account':_0x3a512e[_0x466a('0xb9')][_0x466a('0x2f')],'agent':_0x3a512e[_0x466a('0xba')]?_0x3a512e['Owner'][_0x466a('0x58')]:'N.A.','createdAt':moment(_0x3a512e[_0x466a('0x8c')])[_0x466a('0x83')](_0x466a('0xbe'))[_0x466a('0xb2')](),'closedAt':_0x3a512e[_0x466a('0x69')]?moment(_0x3a512e[_0x466a('0xbf')])['format'](_0x466a('0xbe'))[_0x466a('0xb2')]():'','disposition':_0x3a512e[_0x466a('0x6a')],'chatInfo':{'browser':_0x3a512e[_0x466a('0xc0')],'os':_0x3a512e[_0x466a('0xc1')],'referer':_0x3a512e[_0x466a('0xc2')],'customerIp':_0x3a512e[_0x466a('0xc3')],'customerPort':_0x3a512e[_0x466a('0xc4')]?_0x3a512e[_0x466a('0xc4')]:_0x466a('0xc5')},'messages':_(_0x3a512e[_0x466a('0x7e')])['tail']()[_0x466a('0xa5')]({'secret':![]})[_0x466a('0x39')](function(_0x26fb56){if(_0x26fb56[_0x466a('0x71')]){var _0x183141=path['join'](_0x3651b1,_0x26fb56['Attachment'][_0x466a('0x78')]);if(fs[_0x466a('0xc6')](_0x183141)){fs[_0x466a('0xc7')](_0x183141)[_0x466a('0xc8')](fs['createWriteStream'](path['join'](_0x5a9a3c,_0x26fb56[_0x466a('0x71')][_0x466a('0x78')])));}}return{'date':moment(_0x26fb56['createdAt'])[_0x466a('0x83')](_0x466a('0xbe'))['toString'](),'sender':_0x26fb56[_0x466a('0x8e')]===_0x466a('0x61')?_0x26fb56['User']?_0x26fb56[_0x466a('0x7f')][_0x466a('0x58')]:_0x466a('0x87'):_0x26fb56[_0x466a('0x66')][_0x466a('0xb7')]+(_0x26fb56[_0x466a('0x66')][_0x466a('0xc9')]?'\x20'+_0x26fb56[_0x466a('0x66')][_0x466a('0xc9')]:''),'body':_0x26fb56['Attachment']?_0x26fb56['Attachment']['basename']:_0x26fb56[_0x466a('0x33')],'direction':_0x26fb56['direction']===_0x466a('0x61')?'A':'C','secret':_0x26fb56['secret'],'read':_0x26fb56['read'],'attachment':_0x26fb56[_0x466a('0x71')]};})['value']()};return ejs['renderFile'](path[_0x466a('0x74')](config['root'],_0x466a('0xb3'),_0x466a('0xca'),_0x466a('0xcb')),{'interaction':_0x461c12})[_0x466a('0x19')](function(_0x26221c){var _0x17d0a0=path[_0x466a('0x74')](_0x5a9a3c,_0x466a('0xcc')+_0x3a512e['id']+'-'+_0x1d42f0+'.pdf');var _0x577268={'path':_0x17d0a0,'channel':_0x466a('0xbd'),'interactionId':_0x3a512e['id']};return pdf[_0x466a('0xcd')](_0x26221c,_0x577268);})['then'](function(){return new Promise(function(_0x1d5d27,_0x1272d0){zipdir(_0x5a9a3c,{'saveTo':_0x2f0211},function(_0x56a11e,_0x39389b){if(_0x56a11e)return _0x1272d0(_0x56a11e);return _0x1d5d27(_0x39389b);});})[_0x466a('0x19')](function(){return new BPromise(function(_0x20a7ea,_0x5197a0){rimraf(_0x5a9a3c,function(_0x3174b8){if(_0x3174b8)_0x5197a0(_0x3174b8);return _0x20a7ea();});});})[_0x466a('0x19')](function(){return _0x42a10d[_0x466a('0x79')](_0x2f0211,_0x5c13d2,function(_0x750fb6){if(_0x750fb6){logger['error'](_0x466a('0xce'),_0x750fb6);}else{fs[_0x466a('0xcf')](_0x2f0211);}});});});}else{return _0x42a10d['sendStatus'](0xc8);}})[_0x466a('0x22')](handleError(_0x42a10d,null));}; \ No newline at end of file +var _0x2634=['renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','err','rimraf','zip-dir','request-promise','bluebird','mustache','path','lodash','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./chatInteraction.socket','register','http','client','request','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','destroy','then','name','send','render','body','contact','agent','interaction','account','index','map','rawAttributes','fieldName','type','getOptions','findAll','query','user','show','params','model','keys','attributes','fields','length','includeAll','include','options','find','catch','create','update','ChatInteraction','describe','createVidaooSession','findOne','ChatWebsite','vidaooEscalation','vidaooTopic','vidaooMetadata','vidaooApiKey','fullname','email','POST','isNull','vidaooNote','follow','parse','metadata','Sequelize','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','Error\x20in\x20Vidaoo\x20configuration','join_url','out','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','CmContact','Contact','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','Interaction\x20already\x20assigned','closed','AbandonInteraction','abandon','attachmentUpload','file','originalname','basename','filename','mimetype','attachmentDownload','Unauthorized','attachId','join','server/files/attachments/','download','mailTranscript','root','format','transcript-%s.txt','now','pathTranscript','Messages','User','ChatWebsiteId','ContactId','UserId','agentAlias','%s%d','Visitor','agentIdentifier','website_alias','agent_alias','alias','System','agent_fullname','[%s]\x20%s:\x20%s\x0a','createdAt','MM/DD/YYYY\x20HH:mm:ss','secret','appendFileSync','MailAccount','MailServerOut','CloudProvider','Smtp','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','filters','intersection','hasOwnProperty','nolimit','sort','where','ChatInteractionId','filter','merge','$gte','split','YYYY-MM-DD\x20HH:mm:ss','rows','getMyMessages','order','push','addTags','setTags','omit','spread','Tag','color','emit','chatInteractionTags:save','removeTags','unix','toString','files','tmp','firstName','lastName','attachments','Attachment','direction','read','Account','Owner','get','mkdirSync','Chat','N.A.','closedAt','disposition','browserName','osName','customerIp','customerPort','tail','existsSync','createReadStream','createWriteStream','value'];(function(_0xe1b4c6,_0x369e1c){var _0x362bd7=function(_0x23cbcb){while(--_0x23cbcb){_0xe1b4c6['push'](_0xe1b4c6['shift']());}};_0x362bd7(++_0x369e1c);}(_0x2634,0x1b1));var _0x4263=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x2634[_0x20a584];return _0x4b41a8;};'use strict';var rimraf=require(_0x4263('0x0'));var zipdir=require(_0x4263('0x1'));var rp=require(_0x4263('0x2'));var moment=require('moment');var BPromise=require(_0x4263('0x3'));var Mustache=require(_0x4263('0x4'));var util=require('util');var path=require(_0x4263('0x5'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x4263('0x6'));var Redis=require('ioredis');var interaction=require(_0x4263('0x7'));var qs=require(_0x4263('0x8'));var pdf=require(_0x4263('0x9'));var logger=require(_0x4263('0xa'))(_0x4263('0xb'));var config=require('../../config/environment');var db=require(_0x4263('0xc'))['db'];config['redis']=_[_0x4263('0xd')](config[_0x4263('0xe')],{'host':_0x4263('0xf'),'port':0x18eb});var socket=require(_0x4263('0x10'))(new Redis(config[_0x4263('0xe')]));require(_0x4263('0x11'))[_0x4263('0x12')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x4263('0x13')]({'port':0x232b});var client9004=jayson[_0x4263('0x14')][_0x4263('0x13')]({'port':0x232c});function respondWithRpcPromise(_0x30b664,_0x5ab572,_0x46f659,_0x2d64df){return new BPromise(function(_0x2d3290,_0x2f832f){var _0x23ba26=_0x2d64df||client;return _0x23ba26[_0x4263('0x15')](_0x30b664,_0x46f659)['then'](function(_0x598a48){logger[_0x4263('0x16')](_0x4263('0x17'),_0x5ab572,_0x4263('0x18'));logger[_0x4263('0x19')](_0x4263('0x1a'),_0x5ab572,_0x4263('0x18'),JSON[_0x4263('0x1b')](_0x598a48));if(_0x598a48['error']){if(_0x598a48[_0x4263('0x1c')]['code']===0x1f4){logger['error'](_0x4263('0x17'),_0x5ab572,_0x598a48[_0x4263('0x1c')][_0x4263('0x1d')]);return _0x2f832f(_0x598a48['error'][_0x4263('0x1d')]);}logger[_0x4263('0x1c')](_0x4263('0x17'),_0x5ab572,_0x598a48[_0x4263('0x1c')]['message']);return _0x2d3290(_0x598a48[_0x4263('0x1c')][_0x4263('0x1d')]);}else{logger[_0x4263('0x16')](_0x4263('0x17'),_0x5ab572,_0x4263('0x18'));_0x2d3290(_0x598a48['result'][_0x4263('0x1d')]);}})['catch'](function(_0x1c5163){logger[_0x4263('0x1c')]('ChatInteraction,\x20%s,\x20%s',_0x5ab572,_0x1c5163);_0x2f832f(_0x1c5163);});});}function respondWithStatusCode(_0x8370d4,_0x1ca4ef){_0x1ca4ef=_0x1ca4ef||0xcc;return function(_0x3a26a1){if(_0x3a26a1){return _0x8370d4[_0x4263('0x1e')](_0x1ca4ef);}return _0x8370d4[_0x4263('0x1f')](_0x1ca4ef)[_0x4263('0x20')]();};}function respondWithResult(_0x2ed783,_0x28a169){_0x28a169=_0x28a169||0xc8;return function(_0x37fccb){if(_0x37fccb){return _0x2ed783[_0x4263('0x1f')](_0x28a169)[_0x4263('0x21')](_0x37fccb);}};}function respondWithFilteredResult(_0x5b22f3,_0x31260f){return function(_0x44da8d){if(_0x44da8d){var _0x2b2cdf=typeof _0x31260f[_0x4263('0x22')]===_0x4263('0x23')&&typeof _0x31260f[_0x4263('0x24')]===_0x4263('0x23');var _0x1f2f76=_0x44da8d[_0x4263('0x25')];var _0x5adde0=_0x2b2cdf?0x0:_0x31260f[_0x4263('0x22')];var _0x5d5b1e=_0x2b2cdf?_0x44da8d['count']:_0x31260f[_0x4263('0x22')]+_0x31260f[_0x4263('0x24')];var _0x238bdc;if(_0x5d5b1e>=_0x1f2f76){_0x5d5b1e=_0x1f2f76;_0x238bdc=0xc8;}else{_0x238bdc=0xce;}_0x5b22f3[_0x4263('0x1f')](_0x238bdc);return _0x5b22f3['set'](_0x4263('0x26'),_0x5adde0+'-'+_0x5d5b1e+'/'+_0x1f2f76)[_0x4263('0x21')](_0x44da8d);}return null;};}function saveUpdates(_0x9dad2){return function(_0x3c76aa){if(_0x3c76aa){return _0x3c76aa['update'](_0x9dad2)['then'](function(_0x4ca84b){return _0x4ca84b;});}return null;};}function removeEntity(_0x14084f){return function(_0x58b69e){if(_0x58b69e){return _0x58b69e[_0x4263('0x27')]()[_0x4263('0x28')](function(){_0x14084f[_0x4263('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4877c5){return function(_0x3f2280){if(!_0x3f2280){_0x4877c5[_0x4263('0x1e')](0x194);}return _0x3f2280;};}function handleError(_0x5595f7,_0xddbf36){_0xddbf36=_0xddbf36||0x1f4;return function(_0x52a0c6){logger['error'](_0x52a0c6['stack']);if(_0x52a0c6[_0x4263('0x29')]){delete _0x52a0c6[_0x4263('0x29')];}_0x5595f7['status'](_0xddbf36)[_0x4263('0x2a')](_0x52a0c6);};}function getMustacheRender(_0x323265,_0xf8a6f2){return Mustache[_0x4263('0x2b')](_0x323265,_['merge'](_0xf8a6f2[_0x4263('0x2c')],{'contact':_0xf8a6f2[_0x4263('0x2d')],'message':_0xf8a6f2[_0x4263('0x1d')],'agent':_0xf8a6f2[_0x4263('0x2e')],'interaction':_0xf8a6f2[_0x4263('0x2f')],'account':_0xf8a6f2[_0x4263('0x30')]}))||'';}exports[_0x4263('0x31')]=function(_0x252d3e,_0x40351f){var _0x12b08a={};var _0x132235=_[_0x4263('0x32')](db['ChatInteraction'][_0x4263('0x33')],function(_0x3c348d){return{'name':_0x3c348d[_0x4263('0x34')],'type':_0x3c348d[_0x4263('0x35')]['key']};});_0x12b08a=qs[_0x4263('0x36')](_0x132235,_0x252d3e);return interaction[_0x4263('0x37')]('chat',_0x252d3e[_0x4263('0x38')],_0x252d3e[_0x4263('0x39')],_0x12b08a,_0x132235)[_0x4263('0x28')](respondWithFilteredResult(_0x40351f,_0x12b08a))['catch'](handleError(_0x40351f,null));};exports[_0x4263('0x3a')]=function(_0x5cf4b2,_0x256bf4){var _0x4fc5d6={'raw':![],'where':{'id':_0x5cf4b2[_0x4263('0x3b')]['id']}},_0x10a331={};_0x10a331[_0x4263('0x3c')]=_[_0x4263('0x3d')](db['ChatInteraction'][_0x4263('0x33')]);_0x10a331['query']=_[_0x4263('0x3d')](_0x5cf4b2[_0x4263('0x38')]);_0x10a331['filters']=_['intersection'](_0x10a331[_0x4263('0x3c')],_0x10a331[_0x4263('0x38')]);_0x4fc5d6[_0x4263('0x3e')]=_['intersection'](_0x10a331[_0x4263('0x3c')],qs[_0x4263('0x3f')](_0x5cf4b2[_0x4263('0x38')][_0x4263('0x3f')]));_0x4fc5d6['attributes']=_0x4fc5d6['attributes'][_0x4263('0x40')]?_0x4fc5d6[_0x4263('0x3e')]:_0x10a331[_0x4263('0x3c')];if(_0x5cf4b2[_0x4263('0x38')][_0x4263('0x41')]){_0x4fc5d6[_0x4263('0x42')]=[{'all':!![]}];}_0x4fc5d6=_['merge']({},_0x4fc5d6,_0x5cf4b2[_0x4263('0x43')]);return db['ChatInteraction'][_0x4263('0x44')](_0x4fc5d6)['then'](handleEntityNotFound(_0x256bf4,null))['then'](respondWithResult(_0x256bf4,null))[_0x4263('0x45')](handleError(_0x256bf4,null));};exports[_0x4263('0x46')]=function(_0x3acf65,_0xe07a63){return db['ChatInteraction'][_0x4263('0x46')](_0x3acf65[_0x4263('0x2c')],{})[_0x4263('0x28')](respondWithResult(_0xe07a63,0xc9))[_0x4263('0x45')](handleError(_0xe07a63,null));};exports[_0x4263('0x47')]=function(_0xb20bbb,_0x5cdfea){if(_0xb20bbb[_0x4263('0x2c')]['id']){delete _0xb20bbb[_0x4263('0x2c')]['id'];}return db['ChatInteraction'][_0x4263('0x44')]({'where':{'id':_0xb20bbb[_0x4263('0x3b')]['id']}})[_0x4263('0x28')](handleEntityNotFound(_0x5cdfea,null))['then'](saveUpdates(_0xb20bbb['body'],null))[_0x4263('0x28')](respondWithResult(_0x5cdfea,null))[_0x4263('0x45')](handleError(_0x5cdfea,null));};exports[_0x4263('0x27')]=function(_0x542b0e,_0x3e6912){return db[_0x4263('0x48')][_0x4263('0x44')]({'where':{'id':_0x542b0e[_0x4263('0x3b')]['id']}})[_0x4263('0x28')](handleEntityNotFound(_0x3e6912,null))[_0x4263('0x28')](removeEntity(_0x3e6912,null))['catch'](handleError(_0x3e6912,null));};exports[_0x4263('0x49')]=function(_0x54e6e1,_0x3c657b){return db[_0x4263('0x48')][_0x4263('0x49')]()[_0x4263('0x28')](respondWithResult(_0x3c657b,null))[_0x4263('0x45')](handleError(_0x3c657b,null));};exports[_0x4263('0x4a')]=function(_0x2134d0,_0x4e2964){var _0x53c95d=_0x2134d0[_0x4263('0x3b')]['id'];var _0x4c0904;var _0x4e2f6c;var _0x32f33a;return db[_0x4263('0x48')][_0x4263('0x4b')]({'where':{'id':_0x53c95d}})[_0x4263('0x28')](function(_0x18601d){_0x4c0904=_0x18601d;return db[_0x4263('0x4c')]['findOne']({'where':{'id':_0x18601d['ChatWebsiteId']},'attributes':['id','vidaooApiKey',_0x4263('0x4d'),_0x4263('0x4e'),'vidaooNote',_0x4263('0x4f')],'raw':!![]});})[_0x4263('0x28')](function(_0x3351a1){if(_0x3351a1&&_0x3351a1[_0x4263('0x50')]&&_0x3351a1[_0x4263('0x4d')]){_0x4e2f6c=_0x3351a1;var _0x4244d6={'interaction':{'id':_0x53c95d},'agent':{'id':_0x2134d0[_0x4263('0x39')]['id'],'name':_0x2134d0['user'][_0x4263('0x29')],'fullname':_0x2134d0[_0x4263('0x39')][_0x4263('0x51')],'email':_0x2134d0[_0x4263('0x39')][_0x4263('0x52')]},'contact':_0x2134d0[_0x4263('0x2c')][_0x4263('0x2d')],'account':_0x2134d0['body'][_0x4263('0x30')]};var _0x53e314={'rejectUnauthorized':![],'method':_0x4263('0x53'),'url':'https://api-vidaoo.xcally.com/api/v1/meetings','headers':{'X-APIKEY':_0x3351a1['vidaooApiKey']},'body':{'duration':null,'scheduledAt':null,'participants':[_0x2134d0['user'][_0x4263('0x52')]],'buttons':null,'topic':_0x4e2f6c['vidaooTopic'],'note':_[_0x4263('0x54')](_0x4e2f6c[_0x4263('0x55')])?null:getMustacheRender(_0x4e2f6c[_0x4263('0x55')],_0x4244d6),'metadata':null},'redirect':_0x4263('0x56'),'json':!![]};try{if(!_[_0x4263('0x54')](_0x4e2f6c[_0x4263('0x4f')])){var _0x55a5b3=getMustacheRender(_0x4e2f6c[_0x4263('0x4f')],_0x4244d6);var _0xccf180=JSON[_0x4263('0x57')](_0x55a5b3);_0x53e314[_0x4263('0x2c')][_0x4263('0x58')]=_0xccf180;}}catch(_0x5179c8){throw new db[(_0x4263('0x59'))][(_0x4263('0x5a'))](_0x4263('0x5b'));}return rp(_0x53e314);}else{throw new db['Sequelize']['ValidationError'](_0x4263('0x5c'));}})['then'](function(_0xe8a03b){_0x32f33a=_0xe8a03b;if(_0x32f33a['id']){var _0x4677d6={'body':_0x32f33a[_0x4263('0x5d')],'ChatWebsiteId':_0x4e2f6c['id'],'ChatInteractionId':_0x4c0904['id'],'direction':_0x4263('0x5e'),'UserId':_0x2134d0[_0x4263('0x39')]['id']};return db[_0x4263('0x5f')]['create'](_0x4677d6,{});}else{throw new db['Sequelize']['ValidationError'](_0x4263('0x60'));}})[_0x4263('0x28')](function(){return _0x4c0904[_0x4263('0x61')]({'vidaooSessionId':_0x32f33a['id']});})[_0x4263('0x28')](respondWithResult(_0x4e2964,null))['catch'](handleError(_0x4e2964,null));};exports[_0x4263('0x62')]=function(_0x208d27,_0xa26f0b){if(_0x208d27[_0x4263('0x2c')]['id']){delete _0x208d27[_0x4263('0x2c')]['id'];}return db[_0x4263('0x48')][_0x4263('0x44')]({'where':{'id':_0x208d27[_0x4263('0x3b')]['id']},'include':[{'model':db[_0x4263('0x63')],'as':_0x4263('0x64')}]})[_0x4263('0x28')](handleEntityNotFound(_0xa26f0b,null))[_0x4263('0x28')](saveUpdates(_0x208d27['body'],null))[_0x4263('0x28')](respondWithResult(_0xa26f0b,null))['catch'](handleError(_0xa26f0b,null));};exports['abandon']=function(_0x450c95,_0x13a53e){if(_0x450c95[_0x4263('0x2c')]['id']){delete _0x450c95[_0x4263('0x2c')]['id'];}return db[_0x4263('0x48')][_0x4263('0x44')]({'where':{'id':_0x450c95[_0x4263('0x3b')]['id']}})[_0x4263('0x28')](function(_0x59ed0a){if(!_0x59ed0a){logger['error'](_0x4263('0x65'),'abandon',0x194,_0x4263('0x66'));_0x13a53e[_0x4263('0x1e')](0x194);}else{if(_0x59ed0a['UserId']){throw new db[(_0x4263('0x59'))][(_0x4263('0x5a'))](_0x4263('0x67'));}}return _0x59ed0a;})[_0x4263('0x28')](function(_0x1844c6){if(_0x1844c6){return _0x1844c6[_0x4263('0x47')]({'closed':_0x450c95['body'][_0x4263('0x68')],'disposition':_0x450c95[_0x4263('0x2c')]['disposition']})['then'](function(_0x224c06){return _0x224c06;});}})[_0x4263('0x28')](function(){return respondWithRpcPromise(_0x4263('0x69'),_0x4263('0x6a'),_0x450c95[_0x4263('0x2c')],client9004);})['then'](respondWithResult(_0x13a53e,null))['catch'](handleError(_0x13a53e,null));};exports[_0x4263('0x6b')]=function(_0x3973f6,_0x3fc248){_0x3973f6[_0x4263('0x2c')][_0x4263('0x29')]=_0x3973f6[_0x4263('0x6c')][_0x4263('0x6d')];_0x3973f6[_0x4263('0x2c')][_0x4263('0x6e')]=_0x3973f6[_0x4263('0x6c')][_0x4263('0x6f')];_0x3973f6[_0x4263('0x2c')]['type']=_0x3973f6['file'][_0x4263('0x70')];return db['Attachment'][_0x4263('0x46')](_0x3973f6[_0x4263('0x2c')])[_0x4263('0x28')](respondWithResult(_0x3fc248,0xc9))['catch'](handleError(_0x3fc248,null));};exports[_0x4263('0x71')]=function(_0x44b8c3,_0x27b917){return db[_0x4263('0x48')][_0x4263('0x4b')]({'where':{'id':_0x44b8c3[_0x4263('0x3b')]['id']},'raw':!![]})[_0x4263('0x28')](handleEntityNotFound(_0x27b917,null))['then'](function(_0x43de8d){if(_0x43de8d){if(_0x43de8d[_0x4263('0x68')]){return _0x27b917[_0x4263('0x1f')](0x193)[_0x4263('0x21')]({'status':0x193,'message':_0x4263('0x72')});}return db['Attachment'][_0x4263('0x4b')]({'where':{'id':_0x44b8c3[_0x4263('0x38')][_0x4263('0x73')]},'raw':!![]})[_0x4263('0x28')](handleEntityNotFound(_0x27b917,null));}})[_0x4263('0x28')](function(_0x1df283){if(_0x1df283){var _0xd493fb=_0x1df283['ChatOfflineMessageId']!==null;var _0x430846=path[_0x4263('0x74')](config['root'],_0x4263('0x75'));if(_0xd493fb){_0x430846=path[_0x4263('0x74')](_0x430846,'offline-chat/');}var _0x1db282=path[_0x4263('0x74')](_0x430846,_0x1df283[_0x4263('0x6e')]);return _0x27b917[_0x4263('0x76')](_0x1db282);}})[_0x4263('0x45')](handleError(_0x27b917,null));};exports['close']=function(_0x4f0227,_0x60b9b8){var _0x15d67f=null;var _0x4e8e9e=null;var _0x582204=null;if(_0x4f0227[_0x4263('0x2c')]['id']){delete _0x4f0227[_0x4263('0x2c')]['id'];}if(_0x4f0227['body'][_0x4263('0x77')]){_0x582204=path['join'](config[_0x4263('0x78')],'server/files/chat/upload/',util[_0x4263('0x79')](_0x4263('0x7a'),Date[_0x4263('0x7b')]()));_0x4f0227[_0x4263('0x2c')][_0x4263('0x7c')]=_0x582204;}return db['ChatInteraction'][_0x4263('0x44')]({'where':{'id':_0x4f0227[_0x4263('0x3b')]['id']},'include':[{'model':db[_0x4263('0x5f')],'as':_0x4263('0x7d'),'include':[{'model':db[_0x4263('0x7e')],'as':_0x4263('0x7e')}]}]})[_0x4263('0x28')](handleEntityNotFound(_0x60b9b8,null))['then'](saveUpdates(_0x4f0227[_0x4263('0x2c')],null))[_0x4263('0x28')](function(_0x1c3c9c){if(_0x1c3c9c){_0x15d67f=_0x1c3c9c;return db[_0x4263('0x4c')][_0x4263('0x44')]({'where':{'id':_0x15d67f[_0x4263('0x7f')]}});}})[_0x4263('0x28')](function(_0x1ad566){if(_0x1ad566){_0x4e8e9e=_0x1ad566;return db['CmContact'][_0x4263('0x44')]({'where':{'id':_0x15d67f[_0x4263('0x80')]}});}})[_0x4263('0x28')](function(_0x2c0195){if(_0x2c0195){if(_0x582204){var _0x47fc3f=null;for(var _0x2e18da=0x1;_0x2e18da<_0x15d67f[_0x4263('0x7d')]['length'];++_0x2e18da){_0x47fc3f=_0x15d67f['Messages'][_0x2e18da];var _0x349135=_0x47fc3f[_0x4263('0x81')]?util[_0x4263('0x79')]('%s%d',_0x4e8e9e[_0x4263('0x82')],_0x47fc3f[_0x4263('0x81')]):'System';var _0x1e8883=_0x4f0227[_0x4263('0x2c')]['customer']||util[_0x4263('0x79')](_0x4263('0x83'),_0x4263('0x84'),_0x47fc3f['ContactId']);switch(_0x4e8e9e[_0x4263('0x85')]){case _0x4263('0x86'):_0x349135=_0x47fc3f['UserId']?util['format'](_0x4263('0x83'),_0x4e8e9e[_0x4263('0x82')],_0x47fc3f[_0x4263('0x81')]):'System';break;case _0x4263('0x87'):_0x349135=_0x47fc3f[_0x4263('0x81')]?_0x47fc3f[_0x4263('0x7e')][_0x4263('0x88')]||_0x47fc3f[_0x4263('0x7e')]['fullname']:_0x4263('0x89');break;case _0x4263('0x8a'):_0x349135=_0x47fc3f[_0x4263('0x81')]?_0x47fc3f['User']['fullname']:_0x4263('0x89');break;default:_0x349135=_0x47fc3f['UserId']?util[_0x4263('0x79')](_0x4263('0x83'),_0x4e8e9e['agentAlias'],_0x47fc3f[_0x4263('0x81')]):'System';}var _0x293011=util['format'](_0x4263('0x8b'),moment(_0x47fc3f[_0x4263('0x8c')])['format'](_0x4263('0x8d')),_0x47fc3f['direction']==='in'?_0x1e8883:_0x349135,_0x47fc3f['body']);if(!_0x47fc3f[_0x4263('0x8e')]){fs[_0x4263('0x8f')](_0x582204,_0x293011);}}return db[_0x4263('0x90')][_0x4263('0x4b')]({'where':{'service':!![]},'include':[{'model':db[_0x4263('0x91')],'as':'Smtp','raw':!![],'include':[{'model':db[_0x4263('0x92')],'as':_0x4263('0x92'),'raw':!![]}]}]});}}})[_0x4263('0x28')](function(_0x500539){if(!_0x500539||!_0x500539[_0x4263('0x93')]||!_0x4f0227[_0x4263('0x2c')])return _0x15d67f;var _0x4bea0b=_0x500539[_0x4263('0x94')]();return respondWithRpcPromise('SendMail',_0x4263('0x95'),{'account':_0x4bea0b,'message':{'from':util[_0x4263('0x79')](_0x4263('0x96'),_0x500539[_0x4263('0x29')],_0x500539[_0x4263('0x52')]||_0x500539[_0x4263('0x93')][_0x4263('0x39')]),'to':_0x4f0227[_0x4263('0x2c')]['mailTranscript'],'subject':'Mail\x20Transcript','text':util[_0x4263('0x79')](_0x4263('0x97'),_0x4f0227[_0x4263('0x2c')][_0x4263('0x77')]),'attachments':[{'path':_0x582204}]}})[_0x4263('0x28')](function(){return _0x15d67f;})[_0x4263('0x45')](function(_0x2cea05){logger[_0x4263('0x1c')](_0x2cea05);});})[_0x4263('0x28')](respondWithStatusCode(_0x60b9b8,0xc8))[_0x4263('0x45')](handleError(_0x60b9b8,null));};exports[_0x4263('0x98')]=function(_0x544a57,_0x13f08b){return db[_0x4263('0x5f')][_0x4263('0x44')]({'where':{'id':_0x544a57[_0x4263('0x3b')]['id']}})[_0x4263('0x28')](handleEntityNotFound(_0x13f08b,null))[_0x4263('0x28')](function(_0x18effb){if(_0x18effb){return _0x18effb['addMessage'](_0x544a57[_0x4263('0x2c')]['ids'],_['omit'](_0x544a57['body'],[_0x4263('0x99'),'id'])||{});}})[_0x4263('0x28')](respondWithResult(_0x13f08b,null))[_0x4263('0x45')](handleError(_0x13f08b,null));};exports['getMessages']=function(_0x4f157c,_0x4c6b5c){var _0x58cb56={'raw':![],'where':{}};var _0x1c30c1={};var _0x1daa5c={'count':0x0,'rows':[]};return db[_0x4263('0x48')][_0x4263('0x4b')]({'where':{'id':_0x4f157c[_0x4263('0x3b')]['id']}})['then'](handleEntityNotFound(_0x4c6b5c,null))[_0x4263('0x28')](function(_0x1252aa){if(_0x1252aa){_0x1c30c1['model']=_[_0x4263('0x3d')](db['ChatMessage'][_0x4263('0x33')]);_0x1c30c1[_0x4263('0x38')]=_['keys'](_0x4f157c[_0x4263('0x38')]);_0x1c30c1[_0x4263('0x9a')]=_[_0x4263('0x9b')](_0x1c30c1[_0x4263('0x3c')],_0x1c30c1['query']);_0x58cb56[_0x4263('0x3e')]=_[_0x4263('0x9b')](_0x1c30c1[_0x4263('0x3c')],qs[_0x4263('0x3f')](_0x4f157c[_0x4263('0x38')]['fields']));_0x58cb56[_0x4263('0x3e')]=_0x58cb56[_0x4263('0x3e')][_0x4263('0x40')]?_0x58cb56[_0x4263('0x3e')]:_0x1c30c1[_0x4263('0x3c')];if(!_0x4f157c[_0x4263('0x38')][_0x4263('0x9c')](_0x4263('0x9d'))){_0x58cb56['limit']=qs['limit'](_0x4f157c[_0x4263('0x38')][_0x4263('0x24')]);_0x58cb56['offset']=qs[_0x4263('0x22')](_0x4f157c[_0x4263('0x38')][_0x4263('0x22')]);}_0x58cb56['order']=qs[_0x4263('0x9e')](_0x4f157c['query'][_0x4263('0x9e')]);_0x58cb56[_0x4263('0x9f')]=qs['filters'](_['pick'](_0x4f157c[_0x4263('0x38')],_0x1c30c1[_0x4263('0x9a')]));_0x58cb56['where'][_0x4263('0xa0')]=_0x1252aa['id'];if(_0x4f157c[_0x4263('0x38')][_0x4263('0xa1')]){_0x58cb56['where']=_[_0x4263('0xa2')](_0x58cb56[_0x4263('0x9f')],{'$or':_['map'](_0x58cb56[_0x4263('0x3e')],function(_0x3ec1ca){var _0x2da62c={};_0x2da62c[_0x3ec1ca]={'$like':'%'+_0x4f157c[_0x4263('0x38')][_0x4263('0xa1')]+'%'};return _0x2da62c;})});}if(_0x4f157c[_0x4263('0x38')]['$gte']){var _0x4e5941=_0x4f157c[_0x4263('0x38')][_0x4263('0xa3')][_0x4263('0xa4')](',');var _0x514b92={};_0x514b92[_0x4e5941[0x0]]={'$gte':moment(_0x4e5941[0x1])[_0x4263('0x79')](_0x4263('0xa5'))};_0x58cb56[_0x4263('0x9f')]=_['merge'](_0x58cb56['where'],_0x514b92);}_0x58cb56=_['merge']({},_0x58cb56,_0x4f157c[_0x4263('0x43')]);return db[_0x4263('0x5f')][_0x4263('0x25')]({'where':_0x58cb56[_0x4263('0x9f')]})[_0x4263('0x28')](function(_0x59f187){_0x1daa5c[_0x4263('0x25')]=_0x59f187;if(_0x4f157c['query'][_0x4263('0x41')]){_0x58cb56['include']=[{'all':!![]}];}return db[_0x4263('0x5f')][_0x4263('0x37')](_0x58cb56);})[_0x4263('0x28')](function(_0x21d422){_0x1daa5c[_0x4263('0xa6')]=_0x21d422;return _0x1daa5c;});}})['then'](respondWithFilteredResult(_0x4c6b5c,_0x58cb56))[_0x4263('0x45')](handleError(_0x4c6b5c,null));};exports[_0x4263('0xa7')]=function(_0x51e8b5,_0x25e3b6){var _0x5cf5dd={'where':{}},_0x2f67a0={},_0x47d3de={'count':0x0,'rows':[]};return db[_0x4263('0x48')][_0x4263('0x4b')]({'where':{'id':_0x51e8b5['params']['id']}})[_0x4263('0x28')](handleEntityNotFound(_0x25e3b6,null))[_0x4263('0x28')](function(_0x4e6adb){if(_0x4e6adb){_0x2f67a0[_0x4263('0x3c')]=_[_0x4263('0x3d')](db[_0x4263('0x5f')][_0x4263('0x33')]);_0x2f67a0[_0x4263('0x38')]=_[_0x4263('0x3d')](_0x51e8b5['query']);_0x2f67a0[_0x4263('0x9a')]=_[_0x4263('0x9b')](_0x2f67a0[_0x4263('0x3c')],_0x2f67a0[_0x4263('0x38')]);_0x5cf5dd[_0x4263('0x3e')]=_[_0x4263('0x9b')](_0x2f67a0[_0x4263('0x3c')],qs[_0x4263('0x3f')](_0x51e8b5['query'][_0x4263('0x3f')]));_0x5cf5dd[_0x4263('0x3e')]=_0x5cf5dd['attributes'][_0x4263('0x40')]?_0x5cf5dd['attributes']:_0x2f67a0[_0x4263('0x3c')];if(!_0x51e8b5[_0x4263('0x38')][_0x4263('0x9c')](_0x4263('0x9d'))){_0x5cf5dd[_0x4263('0x24')]=qs[_0x4263('0x24')](_0x51e8b5[_0x4263('0x38')]['limit']);_0x5cf5dd[_0x4263('0x22')]=qs[_0x4263('0x22')](_0x51e8b5[_0x4263('0x38')][_0x4263('0x22')]);}_0x5cf5dd[_0x4263('0xa8')]=qs['sort'](_0x51e8b5['query'][_0x4263('0x9e')]);_0x5cf5dd['where']=qs[_0x4263('0x9a')](_['pick'](_0x51e8b5[_0x4263('0x38')],_0x2f67a0['filters']));_0x5cf5dd[_0x4263('0x9f')]['ChatInteractionId']=_0x4e6adb['id'];if(_0x51e8b5[_0x4263('0x38')]['filter']){_0x5cf5dd['where']=_[_0x4263('0xa2')](_0x5cf5dd[_0x4263('0x9f')],{'$or':_['map'](_0x5cf5dd[_0x4263('0x3e')],function(_0x4a3200){var _0x1e0276={};_0x1e0276[_0x4a3200]={'$like':'%'+_0x51e8b5[_0x4263('0x38')][_0x4263('0xa1')]+'%'};return _0x1e0276;})});}_0x5cf5dd[_0x4263('0x9f')][_0x4263('0x8e')]=![];if(_0x51e8b5[_0x4263('0x38')]['id']){_0x5cf5dd[_0x4263('0x9f')]['id']={'$gt':_0x51e8b5[_0x4263('0x38')]['id']};}_0x5cf5dd=_[_0x4263('0xa2')]({},_0x5cf5dd,_0x51e8b5['options']);return db[_0x4263('0x5f')][_0x4263('0x25')]({'where':_0x5cf5dd[_0x4263('0x9f')]})['then'](function(_0xe7ece5){_0x47d3de[_0x4263('0x25')]=_0xe7ece5;_0x5cf5dd[_0x4263('0x42')]=[];if(_0x51e8b5[_0x4263('0x38')]['includeAgent']){_0x5cf5dd['include'][_0x4263('0xa9')]({'model':db[_0x4263('0x7e')],'as':_0x4263('0x7e'),'attributes':['id',_0x4263('0x51'),_0x4263('0x88')]});}if(_0x51e8b5[_0x4263('0x38')][_0x4263('0x41')]){_0x5cf5dd[_0x4263('0x42')]=[{'all':!![]}];}return db[_0x4263('0x5f')]['findAll'](_0x5cf5dd);})[_0x4263('0x28')](function(_0x50f73d){_0x47d3de[_0x4263('0xa6')]=_0x50f73d;return _0x47d3de;});}})[_0x4263('0x28')](respondWithFilteredResult(_0x25e3b6,_0x5cf5dd))[_0x4263('0x45')](handleError(_0x25e3b6,null));};exports[_0x4263('0xaa')]=function(_0x473c59,_0x5dc1a2){return db[_0x4263('0x48')][_0x4263('0x44')]({'where':{'id':_0x473c59[_0x4263('0x3b')]['id']}})['then'](handleEntityNotFound(_0x5dc1a2,null))[_0x4263('0x28')](function(_0x3f27af){if(_0x3f27af){return _0x3f27af[_0x4263('0xab')](_0x473c59['body'][_0x4263('0x99')],_[_0x4263('0xac')](_0x473c59[_0x4263('0x2c')],['ids','id'])||{})[_0x4263('0xad')](function(){return db[_0x4263('0xae')][_0x4263('0x37')]({'attributes':['id',_0x4263('0x29'),_0x4263('0xaf')],'where':{'id':_0x473c59[_0x4263('0x2c')]['ids']}});})[_0x4263('0x28')](function(_0x325370){socket[_0x4263('0xb0')](_0x4263('0xb1'),{'id':Number(_0x473c59[_0x4263('0x3b')]['id']),'tags':_0x325370||[]});return{'id':Number(_0x473c59[_0x4263('0x3b')]['id']),'tags':_0x325370||[]};});}})['then'](respondWithResult(_0x5dc1a2,null))['catch'](handleError(_0x5dc1a2,null));};exports[_0x4263('0xb2')]=function(_0x3e59b6,_0x1d84cf){return db[_0x4263('0x48')][_0x4263('0x44')]({'where':{'id':_0x3e59b6['params']['id']}})[_0x4263('0x28')](handleEntityNotFound(_0x1d84cf,null))[_0x4263('0x28')](function(_0x574da3){if(_0x574da3){return _0x574da3[_0x4263('0xb2')](_0x3e59b6[_0x4263('0x38')]['ids']);}})['then'](respondWithStatusCode(_0x1d84cf,null))[_0x4263('0x45')](handleError(_0x1d84cf,null));};exports[_0x4263('0x76')]=function(_0x40a19b,_0x50d2ee){var _0x1a4abf=moment()[_0x4263('0xb3')]()[_0x4263('0xb4')]();var _0x2a96c7=path['join'](config[_0x4263('0x78')],'server',_0x4263('0xb5'),_0x4263('0xb6'));var _0xa7ee30=path[_0x4263('0x74')](config['root'],'server',_0x4263('0xb5'),'attachments');var _0x34c703=path[_0x4263('0x74')](_0x2a96c7,_0x1a4abf);var _0x186817=util[_0x4263('0x79')]('transcript-%d-%s.zip',_0x40a19b['params']['id'],_0x1a4abf);var _0x401c72=path['join'](_0x2a96c7,_0x186817);var _0x1a2998=[];_0x1a2998['push']({'model':db[_0x4263('0x7e')],'as':_0x4263('0x7e'),'attributes':['id',_0x4263('0x51')],'raw':!![]});_0x1a2998[_0x4263('0xa9')]({'model':db['CmContact'],'as':'Contact','attributes':['id',_0x4263('0xb7'),_0x4263('0xb8')],'raw':!![]});if(_0x40a19b['query'][_0x4263('0xb9')]){_0x1a2998[_0x4263('0xa9')]({'model':db[_0x4263('0xba')],'as':_0x4263('0xba'),'raw':!![]});}var _0x3f23bf=[{'model':db[_0x4263('0x5f')],'as':_0x4263('0x7d'),'attributes':['id',_0x4263('0x2c'),_0x4263('0x8c'),_0x4263('0xbb'),_0x4263('0x8e'),_0x4263('0xbc')],'include':_0x1a2998}];_0x3f23bf[_0x4263('0xa9')]({'model':db[_0x4263('0x4c')],'as':_0x4263('0xbd'),'attributes':['id',_0x4263('0x29')]});_0x3f23bf[_0x4263('0xa9')]({'model':db[_0x4263('0x7e')],'as':_0x4263('0xbe'),'attributes':['id',_0x4263('0x51')]});return db[_0x4263('0x48')][_0x4263('0x44')]({'where':{'id':_0x40a19b[_0x4263('0x3b')]['id']},'include':_0x3f23bf})['then'](handleEntityNotFound(_0x50d2ee,null))[_0x4263('0x28')](function(_0x25a851){if(_0x25a851){var _0x2d1007=_0x25a851[_0x4263('0xbf')]({'plain':!![]});fs[_0x4263('0xc0')](_0x34c703);var _0x15e8a4={'channel':_0x4263('0xc1'),'account':_0x2d1007['Account'][_0x4263('0x29')],'agent':_0x2d1007['Owner']?_0x2d1007[_0x4263('0xbe')][_0x4263('0x51')]:_0x4263('0xc2'),'createdAt':moment(_0x2d1007[_0x4263('0x8c')])[_0x4263('0x79')](_0x4263('0xa5'))['toString'](),'closedAt':_0x2d1007[_0x4263('0x68')]?moment(_0x2d1007[_0x4263('0xc3')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0x4263('0xb4')]():'','disposition':_0x2d1007[_0x4263('0xc4')],'chatInfo':{'browser':_0x2d1007[_0x4263('0xc5')],'os':_0x2d1007[_0x4263('0xc6')],'referer':_0x2d1007['referer'],'customerIp':_0x2d1007[_0x4263('0xc7')],'customerPort':_0x2d1007[_0x4263('0xc8')]?_0x2d1007[_0x4263('0xc8')]:_0x4263('0xc2')},'messages':_(_0x2d1007[_0x4263('0x7d')])[_0x4263('0xc9')]()[_0x4263('0xa1')]({'secret':![]})[_0x4263('0x32')](function(_0xabdbe0){if(_0xabdbe0[_0x4263('0xba')]){var _0xbe1d15=path['join'](_0xa7ee30,_0xabdbe0[_0x4263('0xba')][_0x4263('0x6e')]);if(fs[_0x4263('0xca')](_0xbe1d15)){fs[_0x4263('0xcb')](_0xbe1d15)['pipe'](fs[_0x4263('0xcc')](path[_0x4263('0x74')](_0x34c703,_0xabdbe0[_0x4263('0xba')][_0x4263('0x6e')])));}}return{'date':moment(_0xabdbe0['createdAt'])['format'](_0x4263('0xa5'))[_0x4263('0xb4')](),'sender':_0xabdbe0['direction']===_0x4263('0x5e')?_0xabdbe0[_0x4263('0x7e')]?_0xabdbe0[_0x4263('0x7e')][_0x4263('0x51')]:_0x4263('0x89'):_0xabdbe0['Contact'][_0x4263('0xb7')]+(_0xabdbe0['Contact'][_0x4263('0xb8')]?'\x20'+_0xabdbe0['Contact'][_0x4263('0xb8')]:''),'body':_0xabdbe0[_0x4263('0xba')]?_0xabdbe0[_0x4263('0xba')]['basename']:_0xabdbe0[_0x4263('0x2c')],'direction':_0xabdbe0['direction']===_0x4263('0x5e')?'A':'C','secret':_0xabdbe0[_0x4263('0x8e')],'read':_0xabdbe0['read'],'attachment':_0xabdbe0[_0x4263('0xba')]};})[_0x4263('0xcd')]()};return ejs[_0x4263('0xce')](path[_0x4263('0x74')](config[_0x4263('0x78')],'server',_0x4263('0xcf'),_0x4263('0xd0')),{'interaction':_0x15e8a4})[_0x4263('0x28')](function(_0x5491a6){var _0x223fd5=path[_0x4263('0x74')](_0x34c703,_0x4263('0xd1')+_0x2d1007['id']+'-'+_0x1a4abf+_0x4263('0xd2'));var _0x4ad0da={'path':_0x223fd5,'channel':_0x4263('0xc1'),'interactionId':_0x2d1007['id']};return pdf[_0x4263('0xd3')](_0x5491a6,_0x4ad0da);})[_0x4263('0x28')](function(){return new Promise(function(_0x30bf98,_0x1814a4){zipdir(_0x34c703,{'saveTo':_0x401c72},function(_0x2bff2d,_0x451487){if(_0x2bff2d)return _0x1814a4(_0x2bff2d);return _0x30bf98(_0x451487);});})['then'](function(){return new BPromise(function(_0x3ebc1e,_0x22e5b8){rimraf(_0x34c703,function(_0x595fd0){if(_0x595fd0)_0x22e5b8(_0x595fd0);return _0x3ebc1e();});});})['then'](function(){return _0x50d2ee[_0x4263('0x76')](_0x401c72,_0x186817,function(_0x285647){if(_0x285647){logger[_0x4263('0x1c')](_0x4263('0xd4'),_0x285647);}else{fs['unlinkSync'](_0x401c72);}});});});}else{return _0x50d2ee['sendStatus'](0xc8);}})[_0x4263('0x45')](handleError(_0x50d2ee,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index 733dfb4..a4ad2e3 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 _0xbf8e=['Users','map','then','emit','catch','hook','exports','ChatInteraction','../../mysqldb','save','remove','getUsers','setDataValue'];(function(_0xbf8ebe,_0x3b69a5){var _0x1e25e8=function(_0x40c390){while(--_0x40c390){_0xbf8ebe['push'](_0xbf8ebe['shift']());}};_0x1e25e8(++_0x3b69a5);}(_0xbf8e,0x1a7));var _0xebf8=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xbf8e[_0x59ee6f];return _0x4c0979;};'use strict';var EventEmitter=require('events');var ChatInteraction=require('../../mysqldb')['db'][_0xebf8('0x0')];var ChatMessage=require(_0xebf8('0x1'))['db']['ChatMessage'];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xebf8('0x2'),'afterUpdate':'update','afterDestroy':_0xebf8('0x3')};function emitEvent(_0x58256c){return function(_0x44b301,_0x1d405f,_0x4f624d){_0x44b301[_0xebf8('0x4')]({'attributes':['id'],'raw':!![]})['then'](function(_0x2a0445){_0x44b301[_0xebf8('0x5')](_0xebf8('0x6'),_0x2a0445[_0xebf8('0x7')](function(_0x80f5f7){return{'id':_0x80f5f7['id']};}));return ChatMessage['findAll']({'where':{'ChatInteractionId':_0x44b301['id'],'direction':'in','read':![]},'raw':!![]});})[_0xebf8('0x8')](function(_0x5d2c37){_0x44b301['setDataValue']('unreadMessages',_0x5d2c37['length']);ChatInteractionEvents[_0xebf8('0x9')](_0x58256c+':'+_0x44b301['id'],_0x44b301);ChatInteractionEvents[_0xebf8('0x9')](_0x58256c,_0x44b301);_0x4f624d(null);})[_0xebf8('0xa')](_0x4f624d(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInteraction[_0xebf8('0xb')](e,emitEvent(event));}}module[_0xebf8('0xc')]=ChatInteractionEvents; \ No newline at end of file +var _0x117a=['getUsers','then','Users','setDataValue','unreadMessages','length','emit','catch','hasOwnProperty','exports','events','../../mysqldb','ChatMessage','setMaxListeners','save','update','remove'];(function(_0x5de582,_0x2b90bc){var _0x4e4aea=function(_0x4f0356){while(--_0x4f0356){_0x5de582['push'](_0x5de582['shift']());}};_0x4e4aea(++_0x2b90bc);}(_0x117a,0x12b));var _0xa117=function(_0x1e3c16,_0x372caa){_0x1e3c16=_0x1e3c16-0x0;var _0x47a0c9=_0x117a[_0x1e3c16];return _0x47a0c9;};'use strict';var EventEmitter=require(_0xa117('0x0'));var ChatInteraction=require(_0xa117('0x1'))['db']['ChatInteraction'];var ChatMessage=require('../../mysqldb')['db'][_0xa117('0x2')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0xa117('0x3')](0x0);var events={'afterCreate':_0xa117('0x4'),'afterUpdate':_0xa117('0x5'),'afterDestroy':_0xa117('0x6')};function emitEvent(_0x3e80cb){return function(_0x1cae4c,_0x4d7c82,_0x5b4c44){_0x1cae4c[_0xa117('0x7')]({'attributes':['id'],'raw':!![]})[_0xa117('0x8')](function(_0x335362){_0x1cae4c['setDataValue'](_0xa117('0x9'),_0x335362['map'](function(_0x1bae3a){return{'id':_0x1bae3a['id']};}));return ChatMessage['findAll']({'where':{'ChatInteractionId':_0x1cae4c['id'],'direction':'in','read':![]},'raw':!![]});})[_0xa117('0x8')](function(_0x1a42fb){_0x1cae4c[_0xa117('0xa')](_0xa117('0xb'),_0x1a42fb[_0xa117('0xc')]);ChatInteractionEvents[_0xa117('0xd')](_0x3e80cb+':'+_0x1cae4c['id'],_0x1cae4c);ChatInteractionEvents[_0xa117('0xd')](_0x3e80cb,_0x1cae4c);_0x5b4c44(null);})[_0xa117('0xe')](_0x5b4c44(null));};}for(var e in events){if(events[_0xa117('0xf')](e)){var event=events[e];ChatInteraction['hook'](e,emitEvent(event));}}module[_0xa117('0x10')]=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index ad94c63..36e61bc 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 _0x55bd=['../../config/environment','exports','ChatInteraction','changed','closed','closedAt','format','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x198446,_0x119c8f){var _0x38d7b7=function(_0x293752){while(--_0x293752){_0x198446['push'](_0x198446['shift']());}};_0x38d7b7(++_0x119c8f);}(_0x55bd,0x19e));var _0xd55b=function(_0x532b8b,_0x4d0cb0){_0x532b8b=_0x532b8b-0x0;var _0x3e2607=_0x55bd[_0x532b8b];return _0x3e2607;};'use strict';var _=require(_0xd55b('0x0'));var util=require(_0xd55b('0x1'));var logger=require(_0xd55b('0x2'))(_0xd55b('0x3'));var moment=require('moment');var BPromise=require(_0xd55b('0x4'));var rp=require(_0xd55b('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xd55b('0x6'));var attributes=require('./chatInteraction.attributes');module[_0xd55b('0x7')]=function(_0x430f38,_0x1e1a76){return _0x430f38['define'](_0xd55b('0x8'),attributes,{'tableName':'chat_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x468d97,_0x5862ca,_0x3f906b){if(_0x468d97[_0xd55b('0x9')](_0xd55b('0xa'))){_0x468d97[_0xd55b('0xb')]=moment()[_0xd55b('0xc')]('YYYY-MM-DD\x20HH:mm:ss');}_0x3f906b(null,_0x468d97);}},'charset':_0xd55b('0xd'),'collate':_0xd55b('0xe')});}; \ No newline at end of file +var _0xf70b=['util','api','moment','bluebird','request-promise','path','../../config/environment','./chatInteraction.attributes','exports','define','ChatInteraction','chat_interactions','closedAt','format','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x2afbb0,_0x44f16d){var _0x411ff2=function(_0x5edd7e){while(--_0x5edd7e){_0x2afbb0['push'](_0x2afbb0['shift']());}};_0x411ff2(++_0x44f16d);}(_0xf70b,0xdc));var _0xbf70=function(_0x3ae051,_0x2748e3){_0x3ae051=_0x3ae051-0x0;var _0x3d74cc=_0xf70b[_0x3ae051];return _0x3d74cc;};'use strict';var _=require(_0xbf70('0x0'));var util=require(_0xbf70('0x1'));var logger=require('../../config/logger')(_0xbf70('0x2'));var moment=require(_0xbf70('0x3'));var BPromise=require(_0xbf70('0x4'));var rp=require(_0xbf70('0x5'));var fs=require('fs');var path=require(_0xbf70('0x6'));var rimraf=require('rimraf');var config=require(_0xbf70('0x7'));var attributes=require(_0xbf70('0x8'));module[_0xbf70('0x9')]=function(_0x1d2922,_0x383afa){return _0x1d2922[_0xbf70('0xa')](_0xbf70('0xb'),attributes,{'tableName':_0xbf70('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x54350c,_0x4f15c1,_0x253198){if(_0x54350c['changed']('closed')){_0x54350c[_0xbf70('0xd')]=moment()[_0xbf70('0xe')]('YYYY-MM-DD\x20HH:mm:ss');}_0x253198(null,_0x54350c);}},'charset':_0xbf70('0xf'),'collate':_0xbf70('0x10')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index e99b4ca..e4b9052 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 _0xdd14=['register','request','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','ChatInteraction','update','options','raw','where','limit','then','UpdateChatInteraction','find','addTags','ids','omit','body','spread','AddTags','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client','localhost','./chatInteraction.socket'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xdd14,0xb3));var _0x4dd1=function(_0x26aaab,_0x3c6b2d){_0x26aaab=_0x26aaab-0x0;var _0x41ed59=_0xdd14[_0x26aaab];return _0x41ed59;};'use strict';var _=require('lodash');var util=require(_0x4dd1('0x0'));var moment=require(_0x4dd1('0x1'));var BPromise=require(_0x4dd1('0x2'));var rs=require(_0x4dd1('0x3'));var fs=require('fs');var Redis=require(_0x4dd1('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x4dd1('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x4dd1('0x6'));var jayson=require(_0x4dd1('0x7'));var client=jayson[_0x4dd1('0x8')]['http']({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0x4dd1('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x4dd1('0xa'))[_0x4dd1('0xb')](socket);function respondWithRpcPromise(_0x29301e,_0x2cf29e,_0x1c7a21){return new BPromise(function(_0x3c4976,_0x505715){return client[_0x4dd1('0xc')](_0x29301e,_0x1c7a21)['then'](function(_0x4627a6){logger['info'](_0x4dd1('0xd'),_0x2cf29e,_0x4dd1('0xe'));logger[_0x4dd1('0xf')]('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x2cf29e,_0x4dd1('0xe'),JSON[_0x4dd1('0x10')](_0x4627a6));if(_0x4627a6[_0x4dd1('0x11')]){if(_0x4627a6['error'][_0x4dd1('0x12')]===0x1f4){logger[_0x4dd1('0x11')](_0x4dd1('0xd'),_0x2cf29e,_0x4627a6[_0x4dd1('0x11')][_0x4dd1('0x13')]);return _0x505715(_0x4627a6[_0x4dd1('0x11')][_0x4dd1('0x13')]);}logger[_0x4dd1('0x11')](_0x4dd1('0xd'),_0x2cf29e,_0x4627a6[_0x4dd1('0x11')][_0x4dd1('0x13')]);return _0x3c4976(_0x4627a6[_0x4dd1('0x11')]['message']);}else{logger[_0x4dd1('0x14')](_0x4dd1('0xd'),_0x2cf29e,_0x4dd1('0xe'));_0x3c4976(_0x4627a6[_0x4dd1('0x15')][_0x4dd1('0x13')]);}})[_0x4dd1('0x16')](function(_0x2a2e3c){logger[_0x4dd1('0x11')](_0x4dd1('0xd'),_0x2cf29e,_0x2a2e3c);_0x505715(_0x2a2e3c);});});}exports['UpdateChatInteraction']=function(_0x13b805){var _0x423b47=this;return new Promise(function(_0x38282b,_0x5dbb78){return db[_0x4dd1('0x17')][_0x4dd1('0x18')](_0x13b805['body'],{'raw':_0x13b805[_0x4dd1('0x19')]?_0x13b805[_0x4dd1('0x19')][_0x4dd1('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x13b805[_0x4dd1('0x19')]?_0x13b805[_0x4dd1('0x19')][_0x4dd1('0x1b')]||null:null,'attributes':_0x13b805[_0x4dd1('0x19')]?_0x13b805[_0x4dd1('0x19')]['attributes']||null:null,'limit':_0x13b805['options']?_0x13b805[_0x4dd1('0x19')][_0x4dd1('0x1c')]||null:null})[_0x4dd1('0x1d')](function(_0x2bef23){logger[_0x4dd1('0x14')](_0x4dd1('0x1e'),_0x13b805);logger[_0x4dd1('0xf')](_0x4dd1('0x1e'),_0x13b805,JSON[_0x4dd1('0x10')](_0x2bef23));_0x38282b(_0x2bef23);})['catch'](function(_0x437a8b){logger[_0x4dd1('0x11')](_0x4dd1('0x1e'),_0x437a8b[_0x4dd1('0x13')],_0x13b805);_0x5dbb78(_0x423b47[_0x4dd1('0x11')](0x1f4,_0x437a8b[_0x4dd1('0x13')]));});});};exports['AddTagsToChatInteraction']=function(_0x6893d3){return new Promise(function(_0x172136,_0x46da62){return db[_0x4dd1('0x17')][_0x4dd1('0x1f')]({'where':_0x6893d3[_0x4dd1('0x19')]?_0x6893d3[_0x4dd1('0x19')]['where']||null:null})[_0x4dd1('0x1d')](function(_0x2e307e){if(_0x2e307e){return _0x2e307e[_0x4dd1('0x20')](_0x6893d3['body'][_0x4dd1('0x21')],_[_0x4dd1('0x22')](_0x6893d3[_0x4dd1('0x23')],[_0x4dd1('0x21'),'id'])||{});}})[_0x4dd1('0x24')](function(_0x4737e0){logger['info'](_0x4dd1('0x25'),_0x6893d3);logger[_0x4dd1('0xf')]('AddTags',_0x6893d3,JSON[_0x4dd1('0x10')](_0x4737e0));_0x172136(_0x4737e0);})[_0x4dd1('0x16')](function(_0xe1af2f){logger[_0x4dd1('0x11')]('AddTags',_0xe1af2f[_0x4dd1('0x13')],_0x6893d3);_0x46da62(_this[_0x4dd1('0x11')](0x1f4,_0xe1af2f[_0x4dd1('0x13')]));});});}; \ No newline at end of file +var _0xcbfd=['redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','register','request','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','message','error','info','result','catch','UpdateChatInteraction','ChatInteraction','body','options','raw','attributes','limit','then','AddTagsToChatInteraction','find','where','addTags','omit','ids','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xcbfd,0x70));var _0xdcbf=function(_0x45b0ad,_0xd22c0c){_0x45b0ad=_0x45b0ad-0x0;var _0x2af781=_0xcbfd[_0x45b0ad];return _0x2af781;};'use strict';var _=require(_0xdcbf('0x0'));var util=require(_0xdcbf('0x1'));var moment=require(_0xdcbf('0x2'));var BPromise=require(_0xdcbf('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdcbf('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xdcbf('0x5'));var logger=require(_0xdcbf('0x6'))(_0xdcbf('0x7'));var config=require(_0xdcbf('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xdcbf('0x9')][_0xdcbf('0xa')]({'port':0x232a});config[_0xdcbf('0xb')]=_[_0xdcbf('0xc')](config['redis'],{'host':_0xdcbf('0xd'),'port':0x18eb});var socket=require(_0xdcbf('0xe'))(new Redis(config[_0xdcbf('0xb')]));require(_0xdcbf('0xf'))[_0xdcbf('0x10')](socket);function respondWithRpcPromise(_0x4757dd,_0x5736f7,_0x5c9c9b){return new BPromise(function(_0x584e0d,_0x18f8c9){return client[_0xdcbf('0x11')](_0x4757dd,_0x5c9c9b)['then'](function(_0x20eca5){logger['info'](_0xdcbf('0x12'),_0x5736f7,_0xdcbf('0x13'));logger[_0xdcbf('0x14')]('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x5736f7,_0xdcbf('0x13'),JSON[_0xdcbf('0x15')](_0x20eca5));if(_0x20eca5['error']){if(_0x20eca5['error']['code']===0x1f4){logger['error']('ChatInteraction,\x20%s,\x20%s',_0x5736f7,_0x20eca5['error'][_0xdcbf('0x16')]);return _0x18f8c9(_0x20eca5[_0xdcbf('0x17')][_0xdcbf('0x16')]);}logger['error'](_0xdcbf('0x12'),_0x5736f7,_0x20eca5[_0xdcbf('0x17')][_0xdcbf('0x16')]);return _0x584e0d(_0x20eca5[_0xdcbf('0x17')][_0xdcbf('0x16')]);}else{logger[_0xdcbf('0x18')]('ChatInteraction,\x20%s,\x20%s',_0x5736f7,_0xdcbf('0x13'));_0x584e0d(_0x20eca5[_0xdcbf('0x19')]['message']);}})[_0xdcbf('0x1a')](function(_0x167fb0){logger[_0xdcbf('0x17')](_0xdcbf('0x12'),_0x5736f7,_0x167fb0);_0x18f8c9(_0x167fb0);});});}exports[_0xdcbf('0x1b')]=function(_0x693e15){var _0x6e2a48=this;return new Promise(function(_0x423c0e,_0x5e2c60){return db[_0xdcbf('0x1c')]['update'](_0x693e15[_0xdcbf('0x1d')],{'raw':_0x693e15[_0xdcbf('0x1e')]?_0x693e15[_0xdcbf('0x1e')][_0xdcbf('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x693e15[_0xdcbf('0x1e')]?_0x693e15['options']['where']||null:null,'attributes':_0x693e15['options']?_0x693e15[_0xdcbf('0x1e')][_0xdcbf('0x20')]||null:null,'limit':_0x693e15['options']?_0x693e15['options'][_0xdcbf('0x21')]||null:null})[_0xdcbf('0x22')](function(_0x6fa036){logger[_0xdcbf('0x18')]('UpdateChatInteraction',_0x693e15);logger[_0xdcbf('0x14')]('UpdateChatInteraction',_0x693e15,JSON[_0xdcbf('0x15')](_0x6fa036));_0x423c0e(_0x6fa036);})[_0xdcbf('0x1a')](function(_0x1c3ae0){logger['error'](_0xdcbf('0x1b'),_0x1c3ae0[_0xdcbf('0x16')],_0x693e15);_0x5e2c60(_0x6e2a48['error'](0x1f4,_0x1c3ae0[_0xdcbf('0x16')]));});});};exports[_0xdcbf('0x23')]=function(_0x6b29f5){return new Promise(function(_0x361b11,_0x304fd6){return db[_0xdcbf('0x1c')][_0xdcbf('0x24')]({'where':_0x6b29f5['options']?_0x6b29f5[_0xdcbf('0x1e')][_0xdcbf('0x25')]||null:null})[_0xdcbf('0x22')](function(_0x37281f){if(_0x37281f){return _0x37281f[_0xdcbf('0x26')](_0x6b29f5[_0xdcbf('0x1d')]['ids'],_[_0xdcbf('0x27')](_0x6b29f5[_0xdcbf('0x1d')],[_0xdcbf('0x28'),'id'])||{});}})['spread'](function(_0x7dc692){logger[_0xdcbf('0x18')]('AddTags',_0x6b29f5);logger[_0xdcbf('0x14')]('AddTags',_0x6b29f5,JSON[_0xdcbf('0x15')](_0x7dc692));_0x361b11(_0x7dc692);})[_0xdcbf('0x1a')](function(_0x389c91){logger[_0xdcbf('0x17')]('AddTags',_0x389c91[_0xdcbf('0x16')],_0x6b29f5);_0x304fd6(_this[_0xdcbf('0x17')](0x1f4,_0x389c91['message']));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index f7bd0f0..6b21f49 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 _0x72a2=['update','emit','length','save','remove'];(function(_0x19f55d,_0x11c7e8){var _0x59eb66=function(_0x52d204){while(--_0x52d204){_0x19f55d['push'](_0x19f55d['shift']());}};_0x59eb66(++_0x11c7e8);}(_0x72a2,0x161));var _0x272a=function(_0x423d14,_0x2a1fb7){_0x423d14=_0x423d14-0x0;var _0x27cc79=_0x72a2[_0x423d14];return _0x27cc79;};'use strict';var ChatInteractionEvents=require('./chatInteraction.events');var events=[_0x272a('0x0'),_0x272a('0x1'),_0x272a('0x2')];function createListener(_0x3fcb66,_0xdd3cbb){return function(_0x4c36b2){_0xdd3cbb[_0x272a('0x3')](_0x3fcb66,_0x4c36b2);};}function removeListener(_0x52287e,_0x1d154d){return function(){ChatInteractionEvents['removeListener'](_0x52287e,_0x1d154d);};}exports['register']=function(_0x4f628a){for(var _0x2ba5db=0x0,_0x43d188=events[_0x272a('0x4')];_0x2ba5db<_0x43d188;_0x2ba5db++){var _0x283070=events[_0x2ba5db];var _0x54dbfb=createListener('chatInteraction:'+_0x283070,_0x4f628a);ChatInteractionEvents['on'](_0x283070,_0x54dbfb);}}; \ No newline at end of file +var _0xc11f=['remove','update','removeListener','length','chatInteraction:','./chatInteraction.events'];(function(_0x348c87,_0x34f925){var _0x196d52=function(_0x2deaf5){while(--_0x2deaf5){_0x348c87['push'](_0x348c87['shift']());}};_0x196d52(++_0x34f925);}(_0xc11f,0x1b5));var _0xfc11=function(_0x5229e3,_0x15102e){_0x5229e3=_0x5229e3-0x0;var _0xab7f20=_0xc11f[_0x5229e3];return _0xab7f20;};'use strict';var ChatInteractionEvents=require(_0xfc11('0x0'));var events=['save',_0xfc11('0x1'),_0xfc11('0x2')];function createListener(_0x4089d6,_0x50ebd1){return function(_0x210ae1){_0x50ebd1['emit'](_0x4089d6,_0x210ae1);};}function removeListener(_0x1050d7,_0x1258ee){return function(){ChatInteractionEvents[_0xfc11('0x3')](_0x1050d7,_0x1258ee);};}exports['register']=function(_0x1a8c6f){for(var _0x302b8b=0x0,_0xcabf9f=events[_0xfc11('0x4')];_0x302b8b<_0xcabf9f;_0x302b8b++){var _0x2d7f15=events[_0x302b8b];var _0x57a481=createListener(_0xfc11('0x5')+_0x2d7f15,_0x1a8c6f);ChatInteractionEvents['on'](_0x2d7f15,_0x57a481);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index 6a0e3a8..e6c1bc4 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 _0x661c=['post','diskStorage','join','server/files/attachments/','replace','/:id/attachment_upload','file','chat','chatinteraction:addtags','addTags','put','chatinteraction:update','/:id/abandon','/:id/close','close','delete','tracked','chatinteraction:destroy','destroy','/:id/tags','removeTags','exports','multer','path','connect-timeout','express','Router','fs-extra','../../config/environment','./chatInteraction.controller','isAuthenticated','index','get','describe','/:id','isChatInteractionAuthorized','show','/:id/attachment_download','attachmentDownload','/:id/messages','getMessages','/:id/my_messages','download','create'];(function(_0x32f1a3,_0x402dba){var _0x5233fa=function(_0x1e97d1){while(--_0x1e97d1){_0x32f1a3['push'](_0x32f1a3['shift']());}};_0x5233fa(++_0x402dba);}(_0x661c,0xc6));var _0xc661=function(_0x3e44fa,_0x75ed2a){_0x3e44fa=_0x3e44fa-0x0;var _0x2a0aba=_0x661c[_0x3e44fa];return _0x2a0aba;};'use strict';var multer=require(_0xc661('0x0'));var util=require('util');var path=require(_0xc661('0x1'));var timeout=require(_0xc661('0x2'));var express=require(_0xc661('0x3'));var router=express[_0xc661('0x4')]();var fs_extra=require(_0xc661('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xc661('0x6'));var controller=require(_0xc661('0x7'));router['get']('/',auth[_0xc661('0x8')](),controller[_0xc661('0x9')]);router[_0xc661('0xa')]('/describe',auth['isAuthenticated'](),controller[_0xc661('0xb')]);router['get'](_0xc661('0xc'),auth[_0xc661('0xd')](),controller[_0xc661('0xe')]);router[_0xc661('0xa')](_0xc661('0xf'),auth['isChatInteractionAuthorized'](),controller[_0xc661('0x10')]);router[_0xc661('0xa')](_0xc661('0x11'),auth[_0xc661('0x8')](),controller[_0xc661('0x12')]);router['get'](_0xc661('0x13'),auth[_0xc661('0xd')](),controller['getMyMessages']);router[_0xc661('0xa')]('/:id/download',auth[_0xc661('0x8')](),controller[_0xc661('0x14')]);router['post']('/',auth[_0xc661('0x8')](),controller[_0xc661('0x15')]);router[_0xc661('0x16')]('/:id/vidaoo',auth[_0xc661('0x8')](),controller['createVidaooSession']);var upload=multer({'storage':multer[_0xc661('0x17')]({'destination':function(_0x2b34bc,_0x15cc92,_0x314971){_0x314971(null,path[_0xc661('0x18')](config['root'],_0xc661('0x19')));},'filename':function(_0x49975c,_0x4a6afa,_0x2f480b){_0x2f480b(null,util['format']('%s-%s',Date['now'](),_0x4a6afa['originalname'][_0xc661('0x1a')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xc661('0x16')](_0xc661('0x1b'),upload['single'](_0xc661('0x1c')),controller['attachmentUpload']);router[_0xc661('0x16')]('/:id/messages',auth[_0xc661('0xd')](),controller['addMessage']);router[_0xc661('0x16')]('/:id/tags',auth['isAuthenticated'](),interaction['tracked'](_0xc661('0x1d'),_0xc661('0x1e')),controller[_0xc661('0x1f')]);router[_0xc661('0x20')](_0xc661('0xc'),auth[_0xc661('0x8')](),interaction['tracked'](_0xc661('0x1d'),_0xc661('0x21')),controller['update']);router[_0xc661('0x20')]('/:id/custom_update',controller['customUpdate']);router['put'](_0xc661('0x22'),auth[_0xc661('0xd')](),controller['abandon']);router[_0xc661('0x20')](_0xc661('0x23'),controller[_0xc661('0x24')]);router[_0xc661('0x25')](_0xc661('0xc'),auth[_0xc661('0x8')](),interaction[_0xc661('0x26')](_0xc661('0x1d'),_0xc661('0x27')),controller[_0xc661('0x28')]);router[_0xc661('0x25')](_0xc661('0x29'),auth[_0xc661('0x8')](),controller[_0xc661('0x2a')]);module[_0xc661('0x2b')]=router; \ No newline at end of file +var _0x339e=['addTags','put','tracked','update','/:id/custom_update','customUpdate','/:id/abandon','abandon','close','delete','chatinteraction:destroy','destroy','removeTags','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./chatInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/attachment_download','attachmentDownload','/:id/messages','getMessages','/:id/my_messages','isChatInteractionAuthorized','/:id/download','download','post','/:id/vidaoo','createVidaooSession','diskStorage','join','root','format','%s-%s','replace','/:id/attachment_upload','single','file','attachmentUpload','addMessage','/:id/tags','chat','chatinteraction:addtags'];(function(_0x36eaaa,_0x326732){var _0x461349=function(_0x4e4180){while(--_0x4e4180){_0x36eaaa['push'](_0x36eaaa['shift']());}};_0x461349(++_0x326732);}(_0x339e,0x1be));var _0xe339=function(_0x32b122,_0x1ad490){_0x32b122=_0x32b122-0x0;var _0x4ad25a=_0x339e[_0x32b122];return _0x4ad25a;};'use strict';var multer=require(_0xe339('0x0'));var util=require(_0xe339('0x1'));var path=require(_0xe339('0x2'));var timeout=require(_0xe339('0x3'));var express=require('express');var router=express[_0xe339('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xe339('0x5'));var interaction=require(_0xe339('0x6'));var config=require('../../config/environment');var controller=require(_0xe339('0x7'));router[_0xe339('0x8')]('/',auth[_0xe339('0x9')](),controller[_0xe339('0xa')]);router[_0xe339('0x8')](_0xe339('0xb'),auth['isAuthenticated'](),controller[_0xe339('0xc')]);router[_0xe339('0x8')](_0xe339('0xd'),auth['isChatInteractionAuthorized'](),controller[_0xe339('0xe')]);router[_0xe339('0x8')](_0xe339('0xf'),auth['isChatInteractionAuthorized'](),controller[_0xe339('0x10')]);router[_0xe339('0x8')](_0xe339('0x11'),auth['isAuthenticated'](),controller[_0xe339('0x12')]);router['get'](_0xe339('0x13'),auth[_0xe339('0x14')](),controller['getMyMessages']);router['get'](_0xe339('0x15'),auth['isAuthenticated'](),controller[_0xe339('0x16')]);router[_0xe339('0x17')]('/',auth[_0xe339('0x9')](),controller['create']);router[_0xe339('0x17')](_0xe339('0x18'),auth[_0xe339('0x9')](),controller[_0xe339('0x19')]);var upload=multer({'storage':multer[_0xe339('0x1a')]({'destination':function(_0x4b4638,_0x22c72a,_0x8f3865){_0x8f3865(null,path[_0xe339('0x1b')](config[_0xe339('0x1c')],'server/files/attachments/'));},'filename':function(_0x1e9180,_0xf50971,_0x301c07){_0x301c07(null,util[_0xe339('0x1d')](_0xe339('0x1e'),Date['now'](),_0xf50971['originalname'][_0xe339('0x1f')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xe339('0x17')](_0xe339('0x20'),upload[_0xe339('0x21')](_0xe339('0x22')),controller[_0xe339('0x23')]);router[_0xe339('0x17')](_0xe339('0x11'),auth['isChatInteractionAuthorized'](),controller[_0xe339('0x24')]);router[_0xe339('0x17')](_0xe339('0x25'),auth[_0xe339('0x9')](),interaction['tracked'](_0xe339('0x26'),_0xe339('0x27')),controller[_0xe339('0x28')]);router[_0xe339('0x29')](_0xe339('0xd'),auth[_0xe339('0x9')](),interaction[_0xe339('0x2a')](_0xe339('0x26'),'chatinteraction:update'),controller[_0xe339('0x2b')]);router[_0xe339('0x29')](_0xe339('0x2c'),controller[_0xe339('0x2d')]);router['put'](_0xe339('0x2e'),auth[_0xe339('0x14')](),controller[_0xe339('0x2f')]);router[_0xe339('0x29')]('/:id/close',controller[_0xe339('0x30')]);router[_0xe339('0x31')]('/:id',auth[_0xe339('0x9')](),interaction['tracked'](_0xe339('0x26'),_0xe339('0x32')),controller[_0xe339('0x33')]);router[_0xe339('0x31')]('/:id/tags',auth['isAuthenticated'](),controller[_0xe339('0x34')]);module[_0xe339('0x35')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index a9d3a29..f1b48b3 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 _0x7113=['INTEGER','exports','TEXT','medium','BOOLEAN'];(function(_0x521e8f,_0x3c5c86){var _0x44cbe6=function(_0x279805){while(--_0x279805){_0x521e8f['push'](_0x521e8f['shift']());}};_0x44cbe6(++_0x3c5c86);}(_0x7113,0x18c));var _0x3711=function(_0x7081b,_0x3e418b){_0x7081b=_0x7081b-0x0;var _0x3d3f38=_0x7113[_0x7081b];return _0x3d3f38;};'use strict';var Sequelize=require('sequelize');module[_0x3711('0x0')]={'body':{'type':Sequelize[_0x3711('0x1')](_0x3711('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x3711('0x3')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x3711('0x4')]}}; \ No newline at end of file +var _0x8470=['BOOLEAN','exports','medium'];(function(_0x462a04,_0xde2795){var _0x1afe03=function(_0x269c20){while(--_0x269c20){_0x462a04['push'](_0x462a04['shift']());}};_0x1afe03(++_0xde2795);}(_0x8470,0x154));var _0x0847=function(_0xe76de1,_0x728102){_0xe76de1=_0xe76de1-0x0;var _0x3a7962=_0x8470[_0xe76de1];return _0x3a7962;};'use strict';var Sequelize=require('sequelize');module[_0x0847('0x0')]={'body':{'type':Sequelize['TEXT'](_0x0847('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0x0847('0x2')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index 8c8c312..32cabc0 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 _0x24a0=['reject','save','update','then','destroy','error','stack','name','send','map','ChatInternalMessage','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','rows','catch','show','keys','includeAll','find','create','body','params','describe','get','messages','lastMessageAt','createdAt','lastMessage','format','YYYY-MM-DD\x20HH:mm:ss','agent','admin','user','role','userpic','internal','online','lastLoginAt','allowmessenger','showWebBar','-online','VoiceQueue','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','Agents','autoAssociation','UserProfileResource','isEmpty','resourceId','push','ToId','read','-createdAt','all','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','socket.io-emitter','sendStatus','end','status','json','offset','limit','undefined','count','set','apply'];(function(_0x1636a1,_0x32a6f0){var _0x40f698=function(_0x548987){while(--_0x548987){_0x1636a1['push'](_0x1636a1['shift']());}};_0x40f698(++_0x32a6f0);}(_0x24a0,0xba));var _0x024a=function(_0x495447,_0x3cd7ad){_0x495447=_0x495447-0x0;var _0x4b5f84=_0x24a0[_0x495447];return _0x4b5f84;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x024a('0x0'));var zipdir=require(_0x024a('0x1'));var jsonpatch=require(_0x024a('0x2'));var rp=require(_0x024a('0x3'));var moment=require(_0x024a('0x4'));var BPromise=require(_0x024a('0x5'));var Mustache=require(_0x024a('0x6'));var util=require(_0x024a('0x7'));var path=require(_0x024a('0x8'));var sox=require('sox');var csv=require(_0x024a('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x024a('0xa'));var squel=require(_0x024a('0xb'));var crypto=require(_0x024a('0xc'));var jsforce=require(_0x024a('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x024a('0x9'));var querystring=require('querystring');var Papa=require(_0x024a('0xe'));var Redis=require(_0x024a('0xf'));var authService=require(_0x024a('0x10'));var qs=require(_0x024a('0x11'));var as=require(_0x024a('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x024a('0x13'))(_0x024a('0x14'));var utils=require(_0x024a('0x15'));var config=require(_0x024a('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x024a('0x17')]=_[_0x024a('0x18')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x024a('0x19'))(new Redis(config[_0x024a('0x17')]));require('./chatInternalMessage.socket')['register'](socket);function respondWithStatusCode(_0x1bc1ac,_0x380115){_0x380115=_0x380115||0xcc;return function(_0x5b6f21){if(_0x5b6f21){return _0x1bc1ac[_0x024a('0x1a')](_0x380115);}return _0x1bc1ac['status'](_0x380115)[_0x024a('0x1b')]();};}function respondWithResult(_0x2afa8c,_0x34cfe0){_0x34cfe0=_0x34cfe0||0xc8;return function(_0x25b91e){if(_0x25b91e){return _0x2afa8c[_0x024a('0x1c')](_0x34cfe0)[_0x024a('0x1d')](_0x25b91e);}};}function respondWithFilteredResult(_0x4bfef3,_0xb6cf9e){return function(_0x811707){if(_0x811707){var _0x4b9674=typeof _0xb6cf9e[_0x024a('0x1e')]==='undefined'&&typeof _0xb6cf9e[_0x024a('0x1f')]===_0x024a('0x20');var _0x2a16e2=_0x811707[_0x024a('0x21')];var _0x4ce4ed=_0x4b9674?0x0:_0xb6cf9e['offset'];var _0xb85b65=_0x4b9674?_0x811707['count']:_0xb6cf9e[_0x024a('0x1e')]+_0xb6cf9e[_0x024a('0x1f')];var _0x88ff1b;if(_0xb85b65>=_0x2a16e2){_0xb85b65=_0x2a16e2;_0x88ff1b=0xc8;}else{_0x88ff1b=0xce;}_0x4bfef3['status'](_0x88ff1b);return _0x4bfef3[_0x024a('0x22')]('Content-Range',_0x4ce4ed+'-'+_0xb85b65+'/'+_0x2a16e2)[_0x024a('0x1d')](_0x811707);}return null;};}function patchUpdates(_0x13f0e7){return function(_0x49c5c7){try{jsonpatch[_0x024a('0x23')](_0x49c5c7,_0x13f0e7,!![]);}catch(_0x27f12a){return BPromise[_0x024a('0x24')](_0x27f12a);}return _0x49c5c7[_0x024a('0x25')]();};}function saveUpdates(_0x58072d,_0x6cd9e2){return function(_0x164e82){if(_0x164e82){return _0x164e82[_0x024a('0x26')](_0x58072d)[_0x024a('0x27')](function(_0x15fb5f){return _0x15fb5f;});}return null;};}function removeEntity(_0xc758c0,_0x5153b3){return function(_0x7f51d0){if(_0x7f51d0){return _0x7f51d0[_0x024a('0x28')]()[_0x024a('0x27')](function(){_0xc758c0[_0x024a('0x1c')](0xcc)[_0x024a('0x1b')]();});}};}function handleEntityNotFound(_0x5df025,_0x5d596b){return function(_0x544c20){if(!_0x544c20){_0x5df025[_0x024a('0x1a')](0x194);}return _0x544c20;};}function handleError(_0x14d920,_0x5b07e5){_0x5b07e5=_0x5b07e5||0x1f4;return function(_0x438230){logger[_0x024a('0x29')](_0x438230[_0x024a('0x2a')]);if(_0x438230[_0x024a('0x2b')]){delete _0x438230[_0x024a('0x2b')];}_0x14d920[_0x024a('0x1c')](_0x5b07e5)[_0x024a('0x2c')](_0x438230);};}exports['index']=function(_0x19b324,_0x4ea4b6){var _0x30db48={},_0x4b30ba={},_0x2e3097={'count':0x0,'rows':[]};var _0x551d0e=_[_0x024a('0x2d')](db[_0x024a('0x2e')][_0x024a('0x2f')],function(_0x35987a){return{'name':_0x35987a[_0x024a('0x30')],'type':_0x35987a[_0x024a('0x31')][_0x024a('0x32')]};});_0x4b30ba[_0x024a('0x33')]=_['map'](_0x551d0e,'name');_0x4b30ba[_0x024a('0x34')]=_['keys'](_0x19b324[_0x024a('0x34')]);_0x4b30ba[_0x024a('0x35')]=_[_0x024a('0x36')](_0x4b30ba[_0x024a('0x33')],_0x4b30ba[_0x024a('0x34')]);_0x30db48['attributes']=_[_0x024a('0x36')](_0x4b30ba[_0x024a('0x33')],qs[_0x024a('0x37')](_0x19b324[_0x024a('0x34')][_0x024a('0x37')]));_0x30db48[_0x024a('0x38')]=_0x30db48['attributes'][_0x024a('0x39')]?_0x30db48[_0x024a('0x38')]:_0x4b30ba[_0x024a('0x33')];if(!_0x19b324[_0x024a('0x34')][_0x024a('0x3a')](_0x024a('0x3b'))){_0x30db48[_0x024a('0x1f')]=qs[_0x024a('0x1f')](_0x19b324['query'][_0x024a('0x1f')]);_0x30db48[_0x024a('0x1e')]=qs[_0x024a('0x1e')](_0x19b324[_0x024a('0x34')][_0x024a('0x1e')]);}_0x30db48[_0x024a('0x3c')]=qs[_0x024a('0x3d')](_0x19b324[_0x024a('0x34')]['sort']);_0x30db48[_0x024a('0x3e')]=qs[_0x024a('0x35')](_[_0x024a('0x3f')](_0x19b324[_0x024a('0x34')],_0x4b30ba[_0x024a('0x35')]),_0x551d0e);if(_0x19b324['query'][_0x024a('0x40')]){_0x30db48[_0x024a('0x3e')]=_['merge'](_0x30db48[_0x024a('0x3e')],{'$or':_[_0x024a('0x2d')](_0x551d0e,function(_0x34e367){if(_0x34e367[_0x024a('0x31')]!==_0x024a('0x41')){var _0x506a21={};_0x506a21[_0x34e367['name']]={'$like':'%'+_0x19b324[_0x024a('0x34')]['filter']+'%'};return _0x506a21;}})});}_0x30db48=_[_0x024a('0x42')]({},_0x30db48,_0x19b324[_0x024a('0x43')]);var _0x1c4deb={'where':_0x30db48[_0x024a('0x3e')]};return db['ChatInternalMessage'][_0x024a('0x21')](_0x1c4deb)[_0x024a('0x27')](function(_0x139a88){_0x2e3097[_0x024a('0x21')]=_0x139a88;if(_0x19b324[_0x024a('0x34')]['includeAll']){_0x30db48[_0x024a('0x44')]=[{'all':!![]}];}return db[_0x024a('0x2e')][_0x024a('0x45')](_0x30db48);})['then'](function(_0x7cedc9){_0x2e3097[_0x024a('0x46')]=_0x7cedc9;return _0x2e3097;})[_0x024a('0x27')](respondWithFilteredResult(_0x4ea4b6,_0x30db48))[_0x024a('0x47')](handleError(_0x4ea4b6,null));};exports[_0x024a('0x48')]=function(_0x27bf4c,_0x3091e4){var _0x13e074={'raw':!![],'where':{'id':_0x27bf4c['params']['id']}},_0x27c533={};_0x27c533['model']=_[_0x024a('0x49')](db[_0x024a('0x2e')][_0x024a('0x2f')]);_0x27c533[_0x024a('0x34')]=_[_0x024a('0x49')](_0x27bf4c['query']);_0x27c533[_0x024a('0x35')]=_[_0x024a('0x36')](_0x27c533[_0x024a('0x33')],_0x27c533['query']);_0x13e074[_0x024a('0x38')]=_[_0x024a('0x36')](_0x27c533[_0x024a('0x33')],qs['fields'](_0x27bf4c[_0x024a('0x34')][_0x024a('0x37')]));_0x13e074[_0x024a('0x38')]=_0x13e074[_0x024a('0x38')][_0x024a('0x39')]?_0x13e074[_0x024a('0x38')]:_0x27c533[_0x024a('0x33')];if(_0x27bf4c[_0x024a('0x34')][_0x024a('0x4a')]){_0x13e074[_0x024a('0x44')]=[{'all':!![]}];}_0x13e074=_[_0x024a('0x42')]({},_0x13e074,_0x27bf4c[_0x024a('0x43')]);return db[_0x024a('0x2e')][_0x024a('0x4b')](_0x13e074)['then'](handleEntityNotFound(_0x3091e4,null))[_0x024a('0x27')](respondWithResult(_0x3091e4,null))['catch'](handleError(_0x3091e4,null));};exports[_0x024a('0x4c')]=function(_0x1025af,_0x3dd39b){return db[_0x024a('0x2e')][_0x024a('0x4c')](_0x1025af[_0x024a('0x4d')],{})[_0x024a('0x27')](respondWithResult(_0x3dd39b,0xc9))[_0x024a('0x47')](handleError(_0x3dd39b,null));};exports[_0x024a('0x26')]=function(_0x41a0a8,_0x86502d){if(_0x41a0a8['body']['id']){delete _0x41a0a8['body']['id'];}return db[_0x024a('0x2e')][_0x024a('0x4b')]({'where':{'id':_0x41a0a8[_0x024a('0x4e')]['id']}})[_0x024a('0x27')](handleEntityNotFound(_0x86502d,null))[_0x024a('0x27')](saveUpdates(_0x41a0a8[_0x024a('0x4d')],null))[_0x024a('0x27')](respondWithResult(_0x86502d,null))[_0x024a('0x47')](handleError(_0x86502d,null));};exports['destroy']=function(_0x3658f9,_0x569bd1){return db[_0x024a('0x2e')][_0x024a('0x4b')]({'where':{'id':_0x3658f9['params']['id']}})['then'](handleEntityNotFound(_0x569bd1,null))['then'](removeEntity(_0x569bd1,null))[_0x024a('0x47')](handleError(_0x569bd1,null));};exports[_0x024a('0x4f')]=function(_0x177299,_0xd576d8){return db[_0x024a('0x2e')][_0x024a('0x4f')]()['then'](respondWithResult(_0xd576d8,null))['catch'](handleError(_0xd576d8,null));};function wrapUser(_0x5062df){return function(_0x20502d){var _0x5bf7df=_0x5062df[_0x024a('0x50')]({'plain':!![]});_0x5bf7df[_0x024a('0x51')]=[];if(_0x20502d){_0x5bf7df[_0x024a('0x52')]=_0x20502d[_0x024a('0x53')];_0x5bf7df[_0x024a('0x54')]=_0x20502d;}else{_0x5bf7df['lastMessageAt']=moment(0x0)[_0x024a('0x55')](_0x024a('0x56'));_0x5bf7df[_0x024a('0x54')]={};}return _0x5bf7df;};}exports['getUsers']=function(_0x191cfa,_0x353cfc,_0x400ce8){var _0xdfcf06=[];return db['User']['findAll']({'where':{'role':[_0x024a('0x57'),_0x024a('0x58'),_0x024a('0x59')]},'attributes':['id','fullname',_0x024a('0x2b'),_0x024a('0x5a'),_0x024a('0x5b'),_0x024a('0x5c'),_0x024a('0x5d'),_0x024a('0x5e'),_0x024a('0x5f'),_0x024a('0x60')],'order':qs['sort'](_0x024a('0x61')),'include':[{'model':db[_0x024a('0x62')],'as':_0x024a('0x63'),'attributes':['id',_0x024a('0x2b'),_0x024a('0x31')],'through':{'attributes':[]}}]})[_0x024a('0x27')](function(_0x3a9f57){if(_0x3a9f57){var _0xb2a1c8=_0x191cfa[_0x024a('0x59')][_0x024a('0x50')]({'plain':!![]});if(!_0xb2a1c8)throw new Error(_0x024a('0x64'));if(_0xb2a1c8[_0x024a('0x5a')]==='user'){return db['UserProfileSection']['find']({'where':{'name':_0x024a('0x65'),'userProfileId':_0xb2a1c8['userProfileId']},'raw':!![]})[_0x024a('0x27')](function(_0x4f04e3){if(_0x4f04e3){if(_0x4f04e3[_0x024a('0x66')]===0x0){return db[_0x024a('0x67')][_0x024a('0x45')]({'where':{'sectionId':_0x4f04e3['id']},'raw':!![]})[_0x024a('0x27')](function(_0x192572){var _0x3e0ff4=[];if(_[_0x024a('0x68')](_0x192572)){_0x3e0ff4=_[_0x024a('0x40')](_0x3a9f57,function(_0x5eebc9){if(_0x5eebc9[_0x024a('0x5a')]!==_0x024a('0x57')){return _0x5eebc9;}});return _0x3e0ff4;}else{for(var _0x8cb17b=0x0;_0x8cb17b<_0x3a9f57[_0x024a('0x39')];_0x8cb17b++){var _0x664297=_0x3a9f57[_0x8cb17b];if(_0x664297[_0x024a('0x5a')]===_0x024a('0x57')){var _0x570800=_['find'](_0x192572,function(_0x1672cd){return _0x1672cd[_0x024a('0x69')]===_0x664297['id'];});if(_0x570800)_0x3e0ff4[_0x024a('0x6a')](_0x664297);}else{_0x3e0ff4[_0x024a('0x6a')](_0x664297);}}return _0x3e0ff4;}});}else{return _0x3a9f57;}}else{var _0x53cc10=_[_0x024a('0x40')](_0x3a9f57,function(_0x133238){if(_0x133238['role']!==_0x024a('0x57')){return _0x133238;}});return _0x53cc10;}});}else{return _0x3a9f57;}}})[_0x024a('0x27')](function(_0x2ff36d){var _0x566e86=[];if(_0x2ff36d){_0xdfcf06=_0x2ff36d;for(var _0x26849c=0x0;_0x26849c<_0x2ff36d[_0x024a('0x39')];_0x26849c+=0x1){_0xdfcf06[_0x26849c][_0x024a('0x51')]=[];_0x566e86[_0x024a('0x6a')](db[_0x024a('0x2e')][_0x024a('0x4b')]({'where':{'FromId':[_0x191cfa[_0x024a('0x59')]['id'],_0x2ff36d[_0x26849c]['id']],'ToId':[_0x191cfa[_0x024a('0x59')]['id'],_0x2ff36d[_0x26849c]['id']],'ChatGroupId':null},'attributes':['id','createdAt','FromId',_0x024a('0x6b'),_0x024a('0x6c'),_0x024a('0x4d')],'order':qs[_0x024a('0x3d')](_0x024a('0x6d')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x024a('0x27')](wrapUser(_0x2ff36d[_0x26849c])));}return BPromise[_0x024a('0x6e')](_0x566e86);}return[];})[_0x024a('0x27')](function(_0x2fab05){return{'rows':_0x2fab05,'count':_0x2fab05[_0x024a('0x39')]};})['then'](respondWithResult(_0x353cfc,null))[_0x024a('0x47')](handleError(_0x353cfc,null));}; \ No newline at end of file +var _0x254a=['to-csv','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./chatInternalMessage.socket','register','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply','save','then','destroy','error','stack','name','send','index','ChatInternalMessage','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','create','body','update','find','describe','messages','lastMessageAt','createdAt','lastMessage','format','User','agent','admin','fullname','role','userpic','internal','lastLoginAt','allowmessenger','showWebBar','VoiceQueue','VoiceQueues','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','Agents','userProfileId','autoAssociation','UserProfileResource','isEmpty','resourceId','push','FromId','ToId','read','-createdAt','all','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x254a,0xd9));var _0xa254=function(_0x3a2a33,_0x29372a){_0x3a2a33=_0x3a2a33-0x0;var _0x10d6d2=_0x254a[_0x3a2a33];return _0x10d6d2;};'use strict';var emlformat=require(_0xa254('0x0'));var rimraf=require(_0xa254('0x1'));var zipdir=require(_0xa254('0x2'));var jsonpatch=require(_0xa254('0x3'));var rp=require(_0xa254('0x4'));var moment=require(_0xa254('0x5'));var BPromise=require(_0xa254('0x6'));var Mustache=require(_0xa254('0x7'));var util=require(_0xa254('0x8'));var path=require(_0xa254('0x9'));var sox=require(_0xa254('0xa'));var csv=require(_0xa254('0xb'));var ejs=require(_0xa254('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa254('0xd'));var squel=require(_0xa254('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xa254('0xf'));var toCsv=require(_0xa254('0xb'));var querystring=require('querystring');var Papa=require(_0xa254('0x10'));var Redis=require(_0xa254('0x11'));var authService=require(_0xa254('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xa254('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xa254('0x14'));var utils=require(_0xa254('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xa254('0x16'));var db=require(_0xa254('0x17'))['db'];config[_0xa254('0x18')]=_['defaults'](config['redis'],{'host':_0xa254('0x19'),'port':0x18eb});var socket=require(_0xa254('0x1a'))(new Redis(config[_0xa254('0x18')]));require(_0xa254('0x1b'))[_0xa254('0x1c')](socket);function respondWithStatusCode(_0x3e46d7,_0x638b17){_0x638b17=_0x638b17||0xcc;return function(_0x54b894){if(_0x54b894){return _0x3e46d7[_0xa254('0x1d')](_0x638b17);}return _0x3e46d7['status'](_0x638b17)[_0xa254('0x1e')]();};}function respondWithResult(_0x1d142d,_0x5b1320){_0x5b1320=_0x5b1320||0xc8;return function(_0x58d245){if(_0x58d245){return _0x1d142d[_0xa254('0x1f')](_0x5b1320)[_0xa254('0x20')](_0x58d245);}};}function respondWithFilteredResult(_0x181de2,_0x230590){return function(_0x5d4ffc){if(_0x5d4ffc){var _0x5d8372=typeof _0x230590[_0xa254('0x21')]===_0xa254('0x22')&&typeof _0x230590[_0xa254('0x23')]==='undefined';var _0x13ab03=_0x5d4ffc[_0xa254('0x24')];var _0x464ed1=_0x5d8372?0x0:_0x230590[_0xa254('0x21')];var _0x2774a7=_0x5d8372?_0x5d4ffc[_0xa254('0x24')]:_0x230590[_0xa254('0x21')]+_0x230590[_0xa254('0x23')];var _0x258ae5;if(_0x2774a7>=_0x13ab03){_0x2774a7=_0x13ab03;_0x258ae5=0xc8;}else{_0x258ae5=0xce;}_0x181de2[_0xa254('0x1f')](_0x258ae5);return _0x181de2['set'](_0xa254('0x25'),_0x464ed1+'-'+_0x2774a7+'/'+_0x13ab03)['json'](_0x5d4ffc);}return null;};}function patchUpdates(_0x460f89){return function(_0x37610c){try{jsonpatch[_0xa254('0x26')](_0x37610c,_0x460f89,!![]);}catch(_0x1e7e53){return BPromise['reject'](_0x1e7e53);}return _0x37610c[_0xa254('0x27')]();};}function saveUpdates(_0x4df5a6,_0x2a61b5){return function(_0x119c96){if(_0x119c96){return _0x119c96['update'](_0x4df5a6)[_0xa254('0x28')](function(_0x8f9937){return _0x8f9937;});}return null;};}function removeEntity(_0x1a7784,_0x4a2f57){return function(_0x512bbd){if(_0x512bbd){return _0x512bbd[_0xa254('0x29')]()[_0xa254('0x28')](function(){_0x1a7784['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x22e697,_0x7ea393){return function(_0x3e7f7c){if(!_0x3e7f7c){_0x22e697[_0xa254('0x1d')](0x194);}return _0x3e7f7c;};}function handleError(_0x20d588,_0x41ddd9){_0x41ddd9=_0x41ddd9||0x1f4;return function(_0xf0dcfa){logger[_0xa254('0x2a')](_0xf0dcfa[_0xa254('0x2b')]);if(_0xf0dcfa[_0xa254('0x2c')]){delete _0xf0dcfa[_0xa254('0x2c')];}_0x20d588[_0xa254('0x1f')](_0x41ddd9)[_0xa254('0x2d')](_0xf0dcfa);};}exports[_0xa254('0x2e')]=function(_0x59f778,_0x3fb582){var _0x57fdb8={},_0x224bef={},_0x53eb88={'count':0x0,'rows':[]};var _0x14533d=_['map'](db[_0xa254('0x2f')][_0xa254('0x30')],function(_0x416200){return{'name':_0x416200[_0xa254('0x31')],'type':_0x416200[_0xa254('0x32')][_0xa254('0x33')]};});_0x224bef[_0xa254('0x34')]=_[_0xa254('0x35')](_0x14533d,_0xa254('0x2c'));_0x224bef[_0xa254('0x36')]=_[_0xa254('0x37')](_0x59f778[_0xa254('0x36')]);_0x224bef['filters']=_[_0xa254('0x38')](_0x224bef['model'],_0x224bef[_0xa254('0x36')]);_0x57fdb8[_0xa254('0x39')]=_[_0xa254('0x38')](_0x224bef[_0xa254('0x34')],qs[_0xa254('0x3a')](_0x59f778[_0xa254('0x36')][_0xa254('0x3a')]));_0x57fdb8[_0xa254('0x39')]=_0x57fdb8[_0xa254('0x39')][_0xa254('0x3b')]?_0x57fdb8[_0xa254('0x39')]:_0x224bef[_0xa254('0x34')];if(!_0x59f778[_0xa254('0x36')][_0xa254('0x3c')]('nolimit')){_0x57fdb8['limit']=qs[_0xa254('0x23')](_0x59f778[_0xa254('0x36')]['limit']);_0x57fdb8[_0xa254('0x21')]=qs['offset'](_0x59f778[_0xa254('0x36')][_0xa254('0x21')]);}_0x57fdb8[_0xa254('0x3d')]=qs[_0xa254('0x3e')](_0x59f778[_0xa254('0x36')]['sort']);_0x57fdb8[_0xa254('0x3f')]=qs['filters'](_[_0xa254('0x40')](_0x59f778[_0xa254('0x36')],_0x224bef[_0xa254('0x41')]),_0x14533d);if(_0x59f778['query'][_0xa254('0x42')]){_0x57fdb8['where']=_[_0xa254('0x43')](_0x57fdb8['where'],{'$or':_[_0xa254('0x35')](_0x14533d,function(_0x3ba0ad){if(_0x3ba0ad[_0xa254('0x32')]!==_0xa254('0x44')){var _0x2ac416={};_0x2ac416[_0x3ba0ad[_0xa254('0x2c')]]={'$like':'%'+_0x59f778[_0xa254('0x36')]['filter']+'%'};return _0x2ac416;}})});}_0x57fdb8=_[_0xa254('0x43')]({},_0x57fdb8,_0x59f778[_0xa254('0x45')]);var _0x2360b7={'where':_0x57fdb8['where']};return db[_0xa254('0x2f')][_0xa254('0x24')](_0x2360b7)[_0xa254('0x28')](function(_0xa9ac62){_0x53eb88['count']=_0xa9ac62;if(_0x59f778[_0xa254('0x36')][_0xa254('0x46')]){_0x57fdb8[_0xa254('0x47')]=[{'all':!![]}];}return db['ChatInternalMessage'][_0xa254('0x48')](_0x57fdb8);})['then'](function(_0x4953ee){_0x53eb88[_0xa254('0x49')]=_0x4953ee;return _0x53eb88;})[_0xa254('0x28')](respondWithFilteredResult(_0x3fb582,_0x57fdb8))[_0xa254('0x4a')](handleError(_0x3fb582,null));};exports[_0xa254('0x4b')]=function(_0x3196dd,_0x27133c){var _0x4852f={'raw':!![],'where':{'id':_0x3196dd[_0xa254('0x4c')]['id']}},_0x40c4e4={};_0x40c4e4[_0xa254('0x34')]=_[_0xa254('0x37')](db[_0xa254('0x2f')][_0xa254('0x30')]);_0x40c4e4[_0xa254('0x36')]=_[_0xa254('0x37')](_0x3196dd[_0xa254('0x36')]);_0x40c4e4[_0xa254('0x41')]=_[_0xa254('0x38')](_0x40c4e4[_0xa254('0x34')],_0x40c4e4[_0xa254('0x36')]);_0x4852f[_0xa254('0x39')]=_[_0xa254('0x38')](_0x40c4e4[_0xa254('0x34')],qs[_0xa254('0x3a')](_0x3196dd[_0xa254('0x36')][_0xa254('0x3a')]));_0x4852f[_0xa254('0x39')]=_0x4852f[_0xa254('0x39')][_0xa254('0x3b')]?_0x4852f[_0xa254('0x39')]:_0x40c4e4[_0xa254('0x34')];if(_0x3196dd['query'][_0xa254('0x46')]){_0x4852f[_0xa254('0x47')]=[{'all':!![]}];}_0x4852f=_[_0xa254('0x43')]({},_0x4852f,_0x3196dd['options']);return db['ChatInternalMessage']['find'](_0x4852f)['then'](handleEntityNotFound(_0x27133c,null))['then'](respondWithResult(_0x27133c,null))[_0xa254('0x4a')](handleError(_0x27133c,null));};exports[_0xa254('0x4d')]=function(_0x4687a8,_0x55f987){return db['ChatInternalMessage']['create'](_0x4687a8[_0xa254('0x4e')],{})[_0xa254('0x28')](respondWithResult(_0x55f987,0xc9))[_0xa254('0x4a')](handleError(_0x55f987,null));};exports[_0xa254('0x4f')]=function(_0x121f28,_0x1c5fe8){if(_0x121f28[_0xa254('0x4e')]['id']){delete _0x121f28['body']['id'];}return db[_0xa254('0x2f')][_0xa254('0x50')]({'where':{'id':_0x121f28[_0xa254('0x4c')]['id']}})[_0xa254('0x28')](handleEntityNotFound(_0x1c5fe8,null))[_0xa254('0x28')](saveUpdates(_0x121f28['body'],null))[_0xa254('0x28')](respondWithResult(_0x1c5fe8,null))[_0xa254('0x4a')](handleError(_0x1c5fe8,null));};exports['destroy']=function(_0x1f44a8,_0x3846eb){return db['ChatInternalMessage'][_0xa254('0x50')]({'where':{'id':_0x1f44a8[_0xa254('0x4c')]['id']}})[_0xa254('0x28')](handleEntityNotFound(_0x3846eb,null))[_0xa254('0x28')](removeEntity(_0x3846eb,null))[_0xa254('0x4a')](handleError(_0x3846eb,null));};exports[_0xa254('0x51')]=function(_0x189e19,_0x4ea2ee){return db[_0xa254('0x2f')][_0xa254('0x51')]()[_0xa254('0x28')](respondWithResult(_0x4ea2ee,null))[_0xa254('0x4a')](handleError(_0x4ea2ee,null));};function wrapUser(_0x364fb3){return function(_0x3a4dcf){var _0x17db5a=_0x364fb3['get']({'plain':!![]});_0x17db5a[_0xa254('0x52')]=[];if(_0x3a4dcf){_0x17db5a[_0xa254('0x53')]=_0x3a4dcf[_0xa254('0x54')];_0x17db5a[_0xa254('0x55')]=_0x3a4dcf;}else{_0x17db5a[_0xa254('0x53')]=moment(0x0)[_0xa254('0x56')]('YYYY-MM-DD\x20HH:mm:ss');_0x17db5a[_0xa254('0x55')]={};}return _0x17db5a;};}exports['getUsers']=function(_0x86a0b9,_0x186c8e,_0x5721f7){var _0x5e0246=[];return db[_0xa254('0x57')][_0xa254('0x48')]({'where':{'role':[_0xa254('0x58'),_0xa254('0x59'),'user']},'attributes':['id',_0xa254('0x5a'),'name',_0xa254('0x5b'),_0xa254('0x5c'),_0xa254('0x5d'),'online',_0xa254('0x5e'),_0xa254('0x5f'),_0xa254('0x60')],'order':qs['sort']('-online'),'include':[{'model':db[_0xa254('0x61')],'as':_0xa254('0x62'),'attributes':['id','name','type'],'through':{'attributes':[]}}]})[_0xa254('0x28')](function(_0x4fdabf){if(_0x4fdabf){var _0x38bcb3=_0x86a0b9[_0xa254('0x63')][_0xa254('0x64')]({'plain':!![]});if(!_0x38bcb3)throw new Error(_0xa254('0x65'));if(_0x38bcb3[_0xa254('0x5b')]===_0xa254('0x63')){return db['UserProfileSection'][_0xa254('0x50')]({'where':{'name':_0xa254('0x66'),'userProfileId':_0x38bcb3[_0xa254('0x67')]},'raw':!![]})[_0xa254('0x28')](function(_0x4aba04){if(_0x4aba04){if(_0x4aba04[_0xa254('0x68')]===0x0){return db[_0xa254('0x69')]['findAll']({'where':{'sectionId':_0x4aba04['id']},'raw':!![]})[_0xa254('0x28')](function(_0x233013){var _0x43d03f=[];if(_[_0xa254('0x6a')](_0x233013)){_0x43d03f=_[_0xa254('0x42')](_0x4fdabf,function(_0x482e9a){if(_0x482e9a[_0xa254('0x5b')]!=='agent'){return _0x482e9a;}});return _0x43d03f;}else{for(var _0x4c7ab1=0x0;_0x4c7ab1<_0x4fdabf[_0xa254('0x3b')];_0x4c7ab1++){var _0x1dbbe5=_0x4fdabf[_0x4c7ab1];if(_0x1dbbe5['role']===_0xa254('0x58')){var _0x1d71c6=_[_0xa254('0x50')](_0x233013,function(_0x40cde7){return _0x40cde7[_0xa254('0x6b')]===_0x1dbbe5['id'];});if(_0x1d71c6)_0x43d03f[_0xa254('0x6c')](_0x1dbbe5);}else{_0x43d03f[_0xa254('0x6c')](_0x1dbbe5);}}return _0x43d03f;}});}else{return _0x4fdabf;}}else{var _0x516f1=_['filter'](_0x4fdabf,function(_0x3cf740){if(_0x3cf740['role']!==_0xa254('0x58')){return _0x3cf740;}});return _0x516f1;}});}else{return _0x4fdabf;}}})[_0xa254('0x28')](function(_0x5f5ccf){var _0x190280=[];if(_0x5f5ccf){_0x5e0246=_0x5f5ccf;for(var _0x25bfc4=0x0;_0x25bfc4<_0x5f5ccf['length'];_0x25bfc4+=0x1){_0x5e0246[_0x25bfc4]['messages']=[];_0x190280['push'](db['ChatInternalMessage']['find']({'where':{'FromId':[_0x86a0b9['user']['id'],_0x5f5ccf[_0x25bfc4]['id']],'ToId':[_0x86a0b9[_0xa254('0x63')]['id'],_0x5f5ccf[_0x25bfc4]['id']],'ChatGroupId':null},'attributes':['id','createdAt',_0xa254('0x6d'),_0xa254('0x6e'),_0xa254('0x6f'),_0xa254('0x4e')],'order':qs[_0xa254('0x3e')](_0xa254('0x70')),'limit':0x1,'offset':0x0,'raw':!![]})[_0xa254('0x28')](wrapUser(_0x5f5ccf[_0x25bfc4])));}return BPromise[_0xa254('0x71')](_0x190280);}return[];})[_0xa254('0x28')](function(_0x63277d){return{'rows':_0x63277d,'count':_0x63277d['length']};})[_0xa254('0x28')](respondWithResult(_0x186c8e,null))['catch'](handleError(_0x186c8e,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index 5ae2815..a0ce41a 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 _0x57e9=['hasOwnProperty','hook','exports','../../mysqldb','ChatInternalMessage','save','update','remove','emit'];(function(_0x26dd3b,_0x46bad7){var _0x3c275=function(_0x396be8){while(--_0x396be8){_0x26dd3b['push'](_0x26dd3b['shift']());}};_0x3c275(++_0x46bad7);}(_0x57e9,0x150));var _0x957e=function(_0x3b951c,_0x599015){_0x3b951c=_0x3b951c-0x0;var _0x54f915=_0x57e9[_0x3b951c];return _0x54f915;};'use strict';var EventEmitter=require('events');var ChatInternalMessage=require(_0x957e('0x0'))['db'][_0x957e('0x1')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x957e('0x2'),'afterUpdate':_0x957e('0x3'),'afterDestroy':_0x957e('0x4')};function emitEvent(_0x226009){return function(_0x5212b8,_0x42c686,_0x4fac11){ChatInternalMessageEvents[_0x957e('0x5')](_0x226009+':'+_0x5212b8['id'],_0x5212b8);ChatInternalMessageEvents['emit'](_0x226009,_0x5212b8);_0x4fac11(null);};}for(var e in events){if(events[_0x957e('0x6')](e)){var event=events[e];ChatInternalMessage[_0x957e('0x7')](e,emitEvent(event));}}module[_0x957e('0x8')]=ChatInternalMessageEvents; \ No newline at end of file +var _0xeb54=['save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatInternalMessage','setMaxListeners'];(function(_0x50857e,_0x5dd6b8){var _0x5f0967=function(_0x19d9e9){while(--_0x19d9e9){_0x50857e['push'](_0x50857e['shift']());}};_0x5f0967(++_0x5dd6b8);}(_0xeb54,0xb7));var _0x4eb5=function(_0x1af64a,_0x5d578b){_0x1af64a=_0x1af64a-0x0;var _0x3deb48=_0xeb54[_0x1af64a];return _0x3deb48;};'use strict';var EventEmitter=require(_0x4eb5('0x0'));var ChatInternalMessage=require(_0x4eb5('0x1'))['db'][_0x4eb5('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x4eb5('0x3')](0x0);var events={'afterCreate':_0x4eb5('0x4'),'afterUpdate':_0x4eb5('0x5'),'afterDestroy':_0x4eb5('0x6')};function emitEvent(_0x4b1538){return function(_0x4eb456,_0x2b8c34,_0xb9897){ChatInternalMessageEvents['emit'](_0x4b1538+':'+_0x4eb456['id'],_0x4eb456);ChatInternalMessageEvents[_0x4eb5('0x7')](_0x4b1538,_0x4eb456);_0xb9897(null);};}for(var e in events){if(events[_0x4eb5('0x8')](e)){var event=events[e];ChatInternalMessage[_0x4eb5('0x9')](e,emitEvent(event));}}module[_0x4eb5('0xa')]=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index ab79466..6fed603 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 _0x273f=['path','rimraf','./chatInternalMessage.attributes','exports','ChatInternalMessage','chat_internal_messages','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','request-promise'];(function(_0x144c33,_0x4f7860){var _0x5e6f01=function(_0x482e8e){while(--_0x482e8e){_0x144c33['push'](_0x144c33['shift']());}};_0x5e6f01(++_0x4f7860);}(_0x273f,0x134));var _0xf273=function(_0x499234,_0x1ed2c4){_0x499234=_0x499234-0x0;var _0x397197=_0x273f[_0x499234];return _0x397197;};'use strict';var _=require('lodash');var util=require(_0xf273('0x0'));var logger=require(_0xf273('0x1'))(_0xf273('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xf273('0x3'));var fs=require('fs');var path=require(_0xf273('0x4'));var rimraf=require(_0xf273('0x5'));var config=require('../../config/environment');var attributes=require(_0xf273('0x6'));module[_0xf273('0x7')]=function(_0x5ad388,_0x34d232){return _0x5ad388['define'](_0xf273('0x8'),attributes,{'tableName':_0xf273('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xf273('0xa'),'collate':_0xf273('0xb')});}; \ No newline at end of file +var _0x609f=['./chatInternalMessage.attributes','exports','define','utf8mb4_unicode_ci','lodash','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x10af60,_0x4ad3c3){var _0x2f73d8=function(_0x324c35){while(--_0x324c35){_0x10af60['push'](_0x10af60['shift']());}};_0x2f73d8(++_0x4ad3c3);}(_0x609f,0x1d2));var _0xf609=function(_0x2838e7,_0x58d4fb){_0x2838e7=_0x2838e7-0x0;var _0x53b163=_0x609f[_0x2838e7];return _0x53b163;};'use strict';var _=require(_0xf609('0x0'));var util=require('util');var logger=require(_0xf609('0x1'))('api');var moment=require(_0xf609('0x2'));var BPromise=require(_0xf609('0x3'));var rp=require(_0xf609('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf609('0x5'));var config=require(_0xf609('0x6'));var attributes=require(_0xf609('0x7'));module[_0xf609('0x8')]=function(_0x40202f,_0x49c3f1){return _0x40202f[_0xf609('0x9')]('ChatInternalMessage',attributes,{'tableName':'chat_internal_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xf609('0xa')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index 66488e9..45801da 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 _0x7d28=['localhost','socket.io-emitter','./chatInternalMessage.socket','request','then','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','client','http','redis','defaults'];(function(_0x590eb7,_0xfdf202){var _0x14a179=function(_0x104958){while(--_0x104958){_0x590eb7['push'](_0x590eb7['shift']());}};_0x14a179(++_0xfdf202);}(_0x7d28,0x112));var _0x87d2=function(_0x486c1a,_0x417281){_0x486c1a=_0x486c1a-0x0;var _0x61caca=_0x7d28[_0x486c1a];return _0x61caca;};'use strict';var _=require(_0x87d2('0x0'));var util=require(_0x87d2('0x1'));var moment=require(_0x87d2('0x2'));var BPromise=require(_0x87d2('0x3'));var rs=require(_0x87d2('0x4'));var fs=require('fs');var Redis=require(_0x87d2('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x87d2('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x87d2('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x87d2('0x8')][_0x87d2('0x9')]({'port':0x232a});config[_0x87d2('0xa')]=_[_0x87d2('0xb')](config[_0x87d2('0xa')],{'host':_0x87d2('0xc'),'port':0x18eb});var socket=require(_0x87d2('0xd'))(new Redis(config[_0x87d2('0xa')]));require(_0x87d2('0xe'))['register'](socket);function respondWithRpcPromise(_0x36db13,_0x3d4491,_0x18b53b){return new BPromise(function(_0x27be52,_0x2ab3b0){return client[_0x87d2('0xf')](_0x36db13,_0x18b53b)[_0x87d2('0x10')](function(_0x255d1c){logger['info'](_0x87d2('0x11'),_0x3d4491,_0x87d2('0x12'));logger[_0x87d2('0x13')](_0x87d2('0x14'),_0x3d4491,_0x87d2('0x12'),JSON[_0x87d2('0x15')](_0x255d1c));if(_0x255d1c[_0x87d2('0x16')]){if(_0x255d1c[_0x87d2('0x16')]['code']===0x1f4){logger[_0x87d2('0x16')](_0x87d2('0x11'),_0x3d4491,_0x255d1c[_0x87d2('0x16')]['message']);return _0x2ab3b0(_0x255d1c[_0x87d2('0x16')]['message']);}logger[_0x87d2('0x16')]('ChatInternalMessage,\x20%s,\x20%s',_0x3d4491,_0x255d1c[_0x87d2('0x16')][_0x87d2('0x17')]);return _0x27be52(_0x255d1c['error'][_0x87d2('0x17')]);}else{logger[_0x87d2('0x18')]('ChatInternalMessage,\x20%s,\x20%s',_0x3d4491,_0x87d2('0x12'));_0x27be52(_0x255d1c[_0x87d2('0x19')][_0x87d2('0x17')]);}})['catch'](function(_0x4c9a2f){logger[_0x87d2('0x16')](_0x87d2('0x11'),_0x3d4491,_0x4c9a2f);_0x2ab3b0(_0x4c9a2f);});});} \ No newline at end of file +var _0x2d57=['localhost','./chatInternalMessage.socket','register','request','then','info','request\x20sent','ChatInternalMessage,\x20%s,\x20%s,\x20%s','code','error','ChatInternalMessage,\x20%s,\x20%s','message','result','catch','util','moment','../../mysqldb','../../config/utils','rpc','jayson/promise','client','defaults','redis'];(function(_0x19758d,_0x46f627){var _0x340a6d=function(_0x10dfd7){while(--_0x10dfd7){_0x19758d['push'](_0x19758d['shift']());}};_0x340a6d(++_0x46f627);}(_0x2d57,0xaf));var _0x72d5=function(_0x398294,_0x5ceb9d){_0x398294=_0x398294-0x0;var _0x2a872d=_0x2d57[_0x398294];return _0x2a872d;};'use strict';var _=require('lodash');var util=require(_0x72d5('0x0'));var moment=require(_0x72d5('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x72d5('0x2'))['db'];var utils=require(_0x72d5('0x3'));var logger=require('../../config/logger')(_0x72d5('0x4'));var config=require('../../config/environment');var jayson=require(_0x72d5('0x5'));var client=jayson[_0x72d5('0x6')]['http']({'port':0x232a});config['redis']=_[_0x72d5('0x7')](config[_0x72d5('0x8')],{'host':_0x72d5('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x72d5('0x8')]));require(_0x72d5('0xa'))[_0x72d5('0xb')](socket);function respondWithRpcPromise(_0x50327b,_0x2b10d6,_0x3fa33f){return new BPromise(function(_0x8d2df9,_0x255856){return client[_0x72d5('0xc')](_0x50327b,_0x3fa33f)[_0x72d5('0xd')](function(_0x40937c){logger[_0x72d5('0xe')]('ChatInternalMessage,\x20%s,\x20%s',_0x2b10d6,_0x72d5('0xf'));logger['debug'](_0x72d5('0x10'),_0x2b10d6,_0x72d5('0xf'),JSON['stringify'](_0x40937c));if(_0x40937c['error']){if(_0x40937c['error'][_0x72d5('0x11')]===0x1f4){logger[_0x72d5('0x12')](_0x72d5('0x13'),_0x2b10d6,_0x40937c[_0x72d5('0x12')][_0x72d5('0x14')]);return _0x255856(_0x40937c[_0x72d5('0x12')][_0x72d5('0x14')]);}logger[_0x72d5('0x12')](_0x72d5('0x13'),_0x2b10d6,_0x40937c[_0x72d5('0x12')][_0x72d5('0x14')]);return _0x8d2df9(_0x40937c[_0x72d5('0x12')]['message']);}else{logger[_0x72d5('0xe')](_0x72d5('0x13'),_0x2b10d6,'request\x20sent');_0x8d2df9(_0x40937c[_0x72d5('0x15')]['message']);}})[_0x72d5('0x16')](function(_0x5c5b4b){logger[_0x72d5('0x12')](_0x72d5('0x13'),_0x2b10d6,_0x5c5b4b);_0x255856(_0x5c5b4b);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index 414c7fb..e1a8c95 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 _0x24f5=['removeListener','register','length','chatInternalMessage:','save','remove','emit'];(function(_0x404093,_0x4fd27c){var _0x1e56fc=function(_0x1cc6de){while(--_0x1cc6de){_0x404093['push'](_0x404093['shift']());}};_0x1e56fc(++_0x4fd27c);}(_0x24f5,0x123));var _0x524f=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x24f5[_0x19e35c];return _0x3e1fe8;};'use strict';var ChatInternalMessageEvents=require('./chatInternalMessage.events');var events=[_0x524f('0x0'),_0x524f('0x1'),'update'];function createListener(_0x58c6aa,_0x4a5891){return function(_0x1e290e){_0x4a5891[_0x524f('0x2')](_0x58c6aa,_0x1e290e);};}function removeListener(_0xb6675e,_0x4e25af){return function(){ChatInternalMessageEvents[_0x524f('0x3')](_0xb6675e,_0x4e25af);};}exports[_0x524f('0x4')]=function(_0x1196ea){for(var _0x4bf6be=0x0,_0x393f9f=events[_0x524f('0x5')];_0x4bf6be<_0x393f9f;_0x4bf6be++){var _0xf30550=events[_0x4bf6be];var _0x52e778=createListener(_0x524f('0x6')+_0xf30550,_0x1196ea);ChatInternalMessageEvents['on'](_0xf30550,_0x52e778);}}; \ No newline at end of file +var _0xf507=['register','length','chatInternalMessage:','./chatInternalMessage.events','save','remove','update','emit','removeListener'];(function(_0x3cd038,_0x181ade){var _0x53e95a=function(_0x1ba42f){while(--_0x1ba42f){_0x3cd038['push'](_0x3cd038['shift']());}};_0x53e95a(++_0x181ade);}(_0xf507,0x78));var _0x7f50=function(_0x137fdc,_0x350ef5){_0x137fdc=_0x137fdc-0x0;var _0x4594b8=_0xf507[_0x137fdc];return _0x4594b8;};'use strict';var ChatInternalMessageEvents=require(_0x7f50('0x0'));var events=[_0x7f50('0x1'),_0x7f50('0x2'),_0x7f50('0x3')];function createListener(_0x5a3352,_0x11d2eb){return function(_0x1289fe){_0x11d2eb[_0x7f50('0x4')](_0x5a3352,_0x1289fe);};}function removeListener(_0x5b8e63,_0x5275f9){return function(){ChatInternalMessageEvents[_0x7f50('0x5')](_0x5b8e63,_0x5275f9);};}exports[_0x7f50('0x6')]=function(_0x57f535){for(var _0x23331f=0x0,_0x4addb6=events[_0x7f50('0x7')];_0x23331f<_0x4addb6;_0x23331f++){var _0x402c8e=events[_0x23331f];var _0x4da1e5=createListener(_0x7f50('0x8')+_0x402c8e,_0x57f535);ChatInternalMessageEvents['on'](_0x402c8e,_0x4da1e5);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index f330373..f9d9ef3 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 _0x2c58=['getUsers','/:id','show','post','create','put','update','delete','exports','util','path','connect-timeout','Router','fs-extra','../../config/environment','./chatInternalMessage.controller','get','isAuthenticated','index','/describe','describe','/users'];(function(_0x28cb82,_0x48e79e){var _0x2bee30=function(_0x33ad63){while(--_0x33ad63){_0x28cb82['push'](_0x28cb82['shift']());}};_0x2bee30(++_0x48e79e);}(_0x2c58,0x1ab));var _0x82c5=function(_0x398004,_0x3d569d){_0x398004=_0x398004-0x0;var _0xcf28ae=_0x2c58[_0x398004];return _0xcf28ae;};'use strict';var multer=require('multer');var util=require(_0x82c5('0x0'));var path=require(_0x82c5('0x1'));var timeout=require(_0x82c5('0x2'));var express=require('express');var router=express[_0x82c5('0x3')]();var fs_extra=require(_0x82c5('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x82c5('0x5'));var controller=require(_0x82c5('0x6'));router[_0x82c5('0x7')]('/',auth[_0x82c5('0x8')](),controller[_0x82c5('0x9')]);router[_0x82c5('0x7')](_0x82c5('0xa'),auth[_0x82c5('0x8')](),controller[_0x82c5('0xb')]);router['get'](_0x82c5('0xc'),auth['isAuthenticated'](),controller[_0x82c5('0xd')]);router[_0x82c5('0x7')](_0x82c5('0xe'),auth[_0x82c5('0x8')](),controller[_0x82c5('0xf')]);router[_0x82c5('0x10')]('/',auth[_0x82c5('0x8')](),controller[_0x82c5('0x11')]);router[_0x82c5('0x12')](_0x82c5('0xe'),controller[_0x82c5('0x13')]);router[_0x82c5('0x14')](_0x82c5('0xe'),auth[_0x82c5('0x8')](),controller['destroy']);module[_0x82c5('0x15')]=router; \ No newline at end of file +var _0x1d53=['../../config/environment','./chatInternalMessage.controller','isAuthenticated','index','get','describe','/users','getUsers','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','Router','../../components/auth/service'];(function(_0x3fe95d,_0x463b02){var _0x5d96dc=function(_0x575662){while(--_0x575662){_0x3fe95d['push'](_0x3fe95d['shift']());}};_0x5d96dc(++_0x463b02);}(_0x1d53,0xa4));var _0x31d5=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x1d53[_0x3e5086];return _0xfeb102;};'use strict';var multer=require(_0x31d5('0x0'));var util=require(_0x31d5('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x31d5('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x31d5('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x31d5('0x4'));var controller=require(_0x31d5('0x5'));router['get']('/',auth[_0x31d5('0x6')](),controller[_0x31d5('0x7')]);router[_0x31d5('0x8')]('/describe',auth[_0x31d5('0x6')](),controller[_0x31d5('0x9')]);router[_0x31d5('0x8')](_0x31d5('0xa'),auth['isAuthenticated'](),controller[_0x31d5('0xb')]);router[_0x31d5('0x8')](_0x31d5('0xc'),auth[_0x31d5('0x6')](),controller[_0x31d5('0xd')]);router[_0x31d5('0xe')]('/',auth[_0x31d5('0x6')](),controller[_0x31d5('0xf')]);router[_0x31d5('0x10')]('/:id',controller[_0x31d5('0x11')]);router[_0x31d5('0x12')](_0x31d5('0xc'),auth['isAuthenticated'](),controller[_0x31d5('0x13')]);module[_0x31d5('0x14')]=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index e428541..8ee1bcc 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 _0x6f59=['BOOLEAN','ENUM','out','DATE','STRING','sequelize','exports','TEXT','medium'];(function(_0x2e985e,_0x3c085e){var _0x2ff6c7=function(_0x372aa7){while(--_0x372aa7){_0x2e985e['push'](_0x2e985e['shift']());}};_0x2ff6c7(++_0x3c085e);}(_0x6f59,0x1be));var _0x96f5=function(_0x20132e,_0x38d23d){_0x20132e=_0x20132e-0x0;var _0x94710b=_0x6f59[_0x20132e];return _0x94710b;};'use strict';var Sequelize=require(_0x96f5('0x0'));module[_0x96f5('0x1')]={'body':{'type':Sequelize[_0x96f5('0x2')](_0x96f5('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x96f5('0x4')],'defaultValue':![]},'secret':{'type':Sequelize[_0x96f5('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x96f5('0x5')]('in',_0x96f5('0x6')),'defaultValue':_0x96f5('0x6'),'allowNull':![]},'readAt':{'type':Sequelize[_0x96f5('0x7')]},'providerName':{'type':Sequelize[_0x96f5('0x8')]},'providerResponse':{'type':Sequelize[_0x96f5('0x2')]}}; \ No newline at end of file +var _0x4213=['exports','TEXT','medium','BOOLEAN','ENUM','out','STRING','sequelize'];(function(_0x53ecde,_0x2c9a37){var _0x2cbe0f=function(_0xd20fd0){while(--_0xd20fd0){_0x53ecde['push'](_0x53ecde['shift']());}};_0x2cbe0f(++_0x2c9a37);}(_0x4213,0x77));var _0x3421=function(_0x1b6f54,_0x17109a){_0x1b6f54=_0x1b6f54-0x0;var _0x5ae1c9=_0x4213[_0x1b6f54];return _0x5ae1c9;};'use strict';var Sequelize=require(_0x3421('0x0'));module[_0x3421('0x1')]={'body':{'type':Sequelize[_0x3421('0x2')](_0x3421('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x3421('0x4')],'defaultValue':![]},'secret':{'type':Sequelize[_0x3421('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x3421('0x5')]('in','out'),'defaultValue':_0x3421('0x6'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize[_0x3421('0x7')]},'providerResponse':{'type':Sequelize[_0x3421('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index 508aff9..aaa8219 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 _0x68bf=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost','./chatMessage.socket','jayson/promise','client','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','error','message','sendStatus','status','end','json','undefined','limit','count','offset','set','apply','reject','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','include','ChatMessage','rows','params','includeAll','find','catch','create','body','update','describe','chat-interactions','accept','read','readAt','format','UserId','user','agent','get','ChatInteractionId','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','stringify','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','interface','SIP/%s','channel','event','EventManager','parse','formData','RejectMessage','rejectMessage','rejectmessage','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x68bf,0x71));var _0xf68b=function(_0x3f23f7,_0x2d9817){_0x3f23f7=_0x3f23f7-0x0;var _0x36d7e1=_0x68bf[_0x3f23f7];return _0x36d7e1;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xf68b('0x0'));var moment=require('moment');var BPromise=require(_0xf68b('0x1'));var Mustache=require(_0xf68b('0x2'));var util=require(_0xf68b('0x3'));var path=require(_0xf68b('0x4'));var sox=require(_0xf68b('0x5'));var csv=require(_0xf68b('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf68b('0x7'));var _=require(_0xf68b('0x8'));var squel=require(_0xf68b('0x9'));var crypto=require(_0xf68b('0xa'));var jsforce=require(_0xf68b('0xb'));var deskjs=require(_0xf68b('0xc'));var toCsv=require(_0xf68b('0x6'));var querystring=require(_0xf68b('0xd'));var Papa=require(_0xf68b('0xe'));var Redis=require(_0xf68b('0xf'));var authService=require(_0xf68b('0x10'));var qs=require(_0xf68b('0x11'));var as=require(_0xf68b('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf68b('0x13'))(_0xf68b('0x14'));var utils=require(_0xf68b('0x15'));var config=require(_0xf68b('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xf68b('0x17')]=_[_0xf68b('0x18')](config[_0xf68b('0x17')],{'host':_0xf68b('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf68b('0x17')]));require(_0xf68b('0x1a'))['register'](socket);var jayson=require(_0xf68b('0x1b'));var client=jayson[_0xf68b('0x1c')]['http']({'port':0x232c});var client9002=jayson[_0xf68b('0x1c')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ad70f,_0xd987eb,_0x5d4e5e,_0x2c3263){return new BPromise(function(_0x4fcd0b,_0x5b8847){var _0x2925db=_0x2c3263||client;return _0x2925db[_0xf68b('0x1d')](_0x4ad70f,_0x5d4e5e)[_0xf68b('0x1e')](function(_0x2a6015){logger[_0xf68b('0x1f')](_0xf68b('0x20'),_0xd987eb,_0xf68b('0x21'));logger[_0xf68b('0x22')](_0xf68b('0x23'),_0xd987eb,_0xf68b('0x21'),JSON['stringify'](_0x2a6015));if(_0x2a6015['error']){if(_0x2a6015[_0xf68b('0x24')]['code']===0x1f4){logger[_0xf68b('0x24')]('ChatMessage,\x20%s,\x20%s',_0xd987eb,_0x2a6015[_0xf68b('0x24')]['message']);return _0x5b8847(_0x2a6015[_0xf68b('0x24')][_0xf68b('0x25')]);}logger[_0xf68b('0x24')]('ChatMessage,\x20%s,\x20%s',_0xd987eb,_0x2a6015[_0xf68b('0x24')][_0xf68b('0x25')]);return _0x4fcd0b(_0x2a6015[_0xf68b('0x24')][_0xf68b('0x25')]);}else{logger[_0xf68b('0x1f')](_0xf68b('0x20'),_0xd987eb,_0xf68b('0x21'));_0x4fcd0b(_0x2a6015['result'][_0xf68b('0x25')]);}})['catch'](function(_0x3be624){logger['error'](_0xf68b('0x20'),_0xd987eb,_0x3be624);_0x5b8847(_0x3be624);});});}function respondWithStatusCode(_0x486877,_0x4bd5de){_0x4bd5de=_0x4bd5de||0xcc;return function(_0x560c59){if(_0x560c59){return _0x486877[_0xf68b('0x26')](_0x4bd5de);}return _0x486877[_0xf68b('0x27')](_0x4bd5de)[_0xf68b('0x28')]();};}function respondWithResult(_0x47ae50,_0x28dd86){_0x28dd86=_0x28dd86||0xc8;return function(_0x1b2370){if(_0x1b2370){return _0x47ae50[_0xf68b('0x27')](_0x28dd86)[_0xf68b('0x29')](_0x1b2370);}};}function respondWithFilteredResult(_0x22986c,_0x63db87){return function(_0x458e0f){if(_0x458e0f){var _0x5ca057=typeof _0x63db87['offset']===_0xf68b('0x2a')&&typeof _0x63db87[_0xf68b('0x2b')]===_0xf68b('0x2a');var _0x5eabea=_0x458e0f[_0xf68b('0x2c')];var _0x16f0c3=_0x5ca057?0x0:_0x63db87[_0xf68b('0x2d')];var _0x455d4b=_0x5ca057?_0x458e0f['count']:_0x63db87['offset']+_0x63db87['limit'];var _0x3b59b1;if(_0x455d4b>=_0x5eabea){_0x455d4b=_0x5eabea;_0x3b59b1=0xc8;}else{_0x3b59b1=0xce;}_0x22986c[_0xf68b('0x27')](_0x3b59b1);return _0x22986c[_0xf68b('0x2e')]('Content-Range',_0x16f0c3+'-'+_0x455d4b+'/'+_0x5eabea)[_0xf68b('0x29')](_0x458e0f);}return null;};}function patchUpdates(_0x263da1){return function(_0x48d330){try{jsonpatch[_0xf68b('0x2f')](_0x48d330,_0x263da1,!![]);}catch(_0xed2286){return BPromise[_0xf68b('0x30')](_0xed2286);}return _0x48d330['save']();};}function saveUpdates(_0x5d5f22,_0x20d494){return function(_0x404383){if(_0x404383){return _0x404383['update'](_0x5d5f22)['then'](function(_0x1e06d2){return _0x1e06d2;});}return null;};}function removeEntity(_0x51f137,_0x234719){return function(_0x9ec94d){if(_0x9ec94d){return _0x9ec94d[_0xf68b('0x31')]()[_0xf68b('0x1e')](function(){_0x51f137[_0xf68b('0x27')](0xcc)[_0xf68b('0x28')]();});}};}function handleEntityNotFound(_0x560192,_0x2bdaba){return function(_0x3c96c8){if(!_0x3c96c8){_0x560192[_0xf68b('0x26')](0x194);}return _0x3c96c8;};}function handleError(_0x51b983,_0x49c44b){_0x49c44b=_0x49c44b||0x1f4;return function(_0x11fbcf){logger[_0xf68b('0x24')](_0x11fbcf[_0xf68b('0x32')]);if(_0x11fbcf[_0xf68b('0x33')]){delete _0x11fbcf[_0xf68b('0x33')];}_0x51b983[_0xf68b('0x27')](_0x49c44b)[_0xf68b('0x34')](_0x11fbcf);};}exports[_0xf68b('0x35')]=function(_0x2f0112,_0x18d695){var _0x2cbade={},_0x2ded87={},_0x2be195={'count':0x0,'rows':[]};var _0xa6c137=_[_0xf68b('0x36')](db['ChatMessage'][_0xf68b('0x37')],function(_0x246bd6){return{'name':_0x246bd6[_0xf68b('0x38')],'type':_0x246bd6[_0xf68b('0x39')][_0xf68b('0x3a')]};});_0x2ded87[_0xf68b('0x3b')]=_[_0xf68b('0x36')](_0xa6c137,_0xf68b('0x33'));_0x2ded87[_0xf68b('0x3c')]=_[_0xf68b('0x3d')](_0x2f0112[_0xf68b('0x3c')]);_0x2ded87[_0xf68b('0x3e')]=_[_0xf68b('0x3f')](_0x2ded87[_0xf68b('0x3b')],_0x2ded87['query']);_0x2cbade[_0xf68b('0x40')]=_[_0xf68b('0x3f')](_0x2ded87[_0xf68b('0x3b')],qs[_0xf68b('0x41')](_0x2f0112['query'][_0xf68b('0x41')]));_0x2cbade[_0xf68b('0x40')]=_0x2cbade[_0xf68b('0x40')][_0xf68b('0x42')]?_0x2cbade['attributes']:_0x2ded87[_0xf68b('0x3b')];if(!_0x2f0112[_0xf68b('0x3c')]['hasOwnProperty'](_0xf68b('0x43'))){_0x2cbade[_0xf68b('0x2b')]=qs[_0xf68b('0x2b')](_0x2f0112['query'][_0xf68b('0x2b')]);_0x2cbade[_0xf68b('0x2d')]=qs[_0xf68b('0x2d')](_0x2f0112[_0xf68b('0x3c')][_0xf68b('0x2d')]);}_0x2cbade['order']=qs['sort'](_0x2f0112[_0xf68b('0x3c')][_0xf68b('0x44')]);_0x2cbade[_0xf68b('0x45')]=qs[_0xf68b('0x3e')](_[_0xf68b('0x46')](_0x2f0112[_0xf68b('0x3c')],_0x2ded87[_0xf68b('0x3e')]),_0xa6c137);if(_0x2f0112[_0xf68b('0x3c')][_0xf68b('0x47')]){_0x2cbade[_0xf68b('0x45')]=_[_0xf68b('0x48')](_0x2cbade[_0xf68b('0x45')],{'$or':_[_0xf68b('0x36')](_0xa6c137,function(_0xec5cec){if(_0xec5cec['type']!==_0xf68b('0x49')){var _0xe71ec1={};_0xe71ec1[_0xec5cec[_0xf68b('0x33')]]={'$like':'%'+_0x2f0112['query'][_0xf68b('0x47')]+'%'};return _0xe71ec1;}})});}_0x2cbade=_[_0xf68b('0x48')]({},_0x2cbade,_0x2f0112[_0xf68b('0x4a')]);var _0x431dc5={'where':_0x2cbade['where']};return db['ChatMessage'][_0xf68b('0x2c')](_0x431dc5)[_0xf68b('0x1e')](function(_0x17bc64){_0x2be195[_0xf68b('0x2c')]=_0x17bc64;if(_0x2f0112['query']['includeAll']){_0x2cbade[_0xf68b('0x4b')]=[{'all':!![]}];}return db[_0xf68b('0x4c')]['findAll'](_0x2cbade);})[_0xf68b('0x1e')](function(_0xbb812c){_0x2be195[_0xf68b('0x4d')]=_0xbb812c;return _0x2be195;})[_0xf68b('0x1e')](respondWithFilteredResult(_0x18d695,_0x2cbade))['catch'](handleError(_0x18d695,null));};exports['show']=function(_0x2a466e,_0x10cfda){var _0x2ec886={'raw':!![],'where':{'id':_0x2a466e[_0xf68b('0x4e')]['id']}},_0x345358={};_0x345358['model']=_[_0xf68b('0x3d')](db[_0xf68b('0x4c')][_0xf68b('0x37')]);_0x345358[_0xf68b('0x3c')]=_[_0xf68b('0x3d')](_0x2a466e[_0xf68b('0x3c')]);_0x345358[_0xf68b('0x3e')]=_['intersection'](_0x345358['model'],_0x345358[_0xf68b('0x3c')]);_0x2ec886[_0xf68b('0x40')]=_[_0xf68b('0x3f')](_0x345358[_0xf68b('0x3b')],qs[_0xf68b('0x41')](_0x2a466e[_0xf68b('0x3c')][_0xf68b('0x41')]));_0x2ec886[_0xf68b('0x40')]=_0x2ec886[_0xf68b('0x40')][_0xf68b('0x42')]?_0x2ec886['attributes']:_0x345358[_0xf68b('0x3b')];if(_0x2a466e[_0xf68b('0x3c')][_0xf68b('0x4f')]){_0x2ec886['include']=[{'all':!![]}];}_0x2ec886=_[_0xf68b('0x48')]({},_0x2ec886,_0x2a466e[_0xf68b('0x4a')]);return db['ChatMessage'][_0xf68b('0x50')](_0x2ec886)['then'](handleEntityNotFound(_0x10cfda,null))['then'](respondWithResult(_0x10cfda,null))[_0xf68b('0x51')](handleError(_0x10cfda,null));};exports[_0xf68b('0x52')]=function(_0xbd50bc,_0x1ddb40){return db['ChatMessage']['create'](_0xbd50bc[_0xf68b('0x53')],{})[_0xf68b('0x1e')](respondWithResult(_0x1ddb40,0xc9))['catch'](handleError(_0x1ddb40,null));};exports[_0xf68b('0x54')]=function(_0x5c5a1d,_0x134cf9){if(_0x5c5a1d['body']['id']){delete _0x5c5a1d[_0xf68b('0x53')]['id'];}return db[_0xf68b('0x4c')]['find']({'where':{'id':_0x5c5a1d[_0xf68b('0x4e')]['id']}})[_0xf68b('0x1e')](handleEntityNotFound(_0x134cf9,null))[_0xf68b('0x1e')](saveUpdates(_0x5c5a1d[_0xf68b('0x53')],null))['then'](respondWithResult(_0x134cf9,null))['catch'](handleError(_0x134cf9,null));};exports[_0xf68b('0x31')]=function(_0x57496e,_0x4475c7){return db[_0xf68b('0x4c')][_0xf68b('0x50')]({'where':{'id':_0x57496e['params']['id']}})[_0xf68b('0x1e')](handleEntityNotFound(_0x4475c7,null))[_0xf68b('0x1e')](removeEntity(_0x4475c7,null))['catch'](handleError(_0x4475c7,null));};exports[_0xf68b('0x55')]=function(_0x383b10,_0x27f913){return db[_0xf68b('0x4c')][_0xf68b('0x55')]()[_0xf68b('0x1e')](respondWithResult(_0x27f913,null))[_0xf68b('0x51')](handleError(_0x27f913,null));};var interaction_log=require(_0xf68b('0x13'))(_0xf68b('0x56'));exports[_0xf68b('0x57')]=function(_0x59352b,_0x2294c0,_0xadb2fe){var _0xb2e497={'agent':{},'channel':'chat'};if(_0x59352b['body']['id']){delete _0x59352b[_0xf68b('0x53')]['id'];}_0x59352b[_0xf68b('0x53')][_0xf68b('0x58')]=!![];_0x59352b[_0xf68b('0x53')][_0xf68b('0x59')]=moment()[_0xf68b('0x5a')]('YYYY-MM-DD\x20HH:mm:ss');_0x59352b[_0xf68b('0x53')]['UserId']=_0x59352b['body'][_0xf68b('0x5b')]||_0x59352b[_0xf68b('0x5c')]['id'];_0xb2e497[_0xf68b('0x5d')]['id']=_0x59352b[_0xf68b('0x53')]['UserId'];return db[_0xf68b('0x4c')]['find']({'where':{'id':_0x59352b[_0xf68b('0x4e')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x2294c0,null))[_0xf68b('0x1e')](saveUpdates(_0x59352b[_0xf68b('0x53')],null))[_0xf68b('0x1e')](function(_0x3a0944){if(_0x3a0944){_0xb2e497['message']=_0x3a0944[_0xf68b('0x5e')]({'plain':!![]});return db['ChatInteraction']['find']({'where':{'id':_0x3a0944[_0xf68b('0x5f')]}});}return null;})['then'](handleEntityNotFound(_0x2294c0,null))[_0xf68b('0x1e')](function(_0x2cf0be){if(_0x2cf0be){return _0x2cf0be['update']({'UserId':_0x59352b[_0xf68b('0x53')]['UserId'],'read1stAt':_[_0xf68b('0x60')](_0x2cf0be[_0xf68b('0x61')])?moment()['format'](_0xf68b('0x62')):undefined});}return null;})[_0xf68b('0x1e')](function(_0x285a5c){if(_0x285a5c){_0xb2e497['interaction']=_0x285a5c['get']({'plain':!![]});interaction_log[_0xf68b('0x1f')](_0xf68b('0x63'),_0x59352b['user']['id'],_0x59352b[_0xf68b('0x5c')][_0xf68b('0x33')],_0x59352b[_0xf68b('0x5c')][_0xf68b('0x64')],_0xb2e497[_0xf68b('0x65')]['id'],_0x59352b['body']?JSON[_0xf68b('0x66')](_0x59352b[_0xf68b('0x53')]):_0xf68b('0x67'));return respondWithRpcPromise(_0xf68b('0x68'),_0xf68b('0x69'),_0xb2e497);}return null;})['then'](function(_0x58358c){var _0x1ebead=_0xf68b('0x6a')+_0x58358c[_0xf68b('0x25')][_0xf68b('0x6b')];return db[_0xf68b('0x6c')][_0xf68b('0x3c')](_0x1ebead,{'type':db[_0xf68b('0x6d')][_0xf68b('0x6e')][_0xf68b('0x6f')],'raw':!![]})[_0xf68b('0x1e')](function(_0x104db3){return _0x104db3;});})[_0xf68b('0x1e')](function(_0x1c269a){if(_0x1c269a){_0xb2e497[_0xf68b('0x25')][_0xf68b('0x70')]=_0x1c269a[0x0];if(!_0x59352b[_0xf68b('0x53')]['UserId'])return;return db[_0xf68b('0x71')][_0xf68b('0x50')]({'where':{'id':_0x59352b[_0xf68b('0x53')][_0xf68b('0x5b')],'role':_0xf68b('0x5d')},'attributes':['id',_0xf68b('0x33'),_0xf68b('0x72'),_0xf68b('0x73'),_0xf68b('0x74')],'raw':!![]});}return null;})[_0xf68b('0x1e')](function(_0x36b436){if(!_0x36b436)return null;_0xb2e497[_0xf68b('0x25')][_0xf68b('0x5d')]=_0x36b436;return _0xb2e497;})[_0xf68b('0x1e')](function(_0x489f17){if(_0x489f17){if(_0x59352b[_0xf68b('0x53')]['manual']){_0xb2e497['message'][_0xf68b('0x75')]=util['format'](_0xf68b('0x76'),_0x59352b[_0xf68b('0x5c')]['name']);_0xb2e497[_0xf68b('0x25')][_0xf68b('0x77')]=_0xb2e497[_0xf68b('0x77')];_0xb2e497[_0xf68b('0x25')]['motionChannel']=_0xb2e497['channel'];_0xb2e497[_0xf68b('0x25')][_0xf68b('0x78')]='accept';return respondWithRpcPromise(_0xf68b('0x79'),_0xf68b('0x79'),{'event':'acceptmessage','message':_[_0xf68b('0x48')](_0xb2e497['message'],JSON[_0xf68b('0x7a')](_0xb2e497[_0xf68b('0x65')][_0xf68b('0x7b')]))},client9002)[_0xf68b('0x1e')](function(){return _0xb2e497;});}return _0xb2e497;}return null;})['then'](respondWithResult(_0x2294c0,null))[_0xf68b('0x51')](handleError(_0x2294c0,null));};var interaction_log=require(_0xf68b('0x13'))(_0xf68b('0x56'));exports[_0xf68b('0x30')]=function(_0x1b91e1,_0x1f9a66,_0x49ba24){var _0x2c3382={'agent':{},'channel':'chat'};if(_0x1b91e1[_0xf68b('0x53')]['id']){delete _0x1b91e1[_0xf68b('0x53')]['id'];}_0x1b91e1[_0xf68b('0x53')][_0xf68b('0x5b')]=_0x1b91e1[_0xf68b('0x53')][_0xf68b('0x5b')]||_0x1b91e1[_0xf68b('0x5c')]['id'];_0x2c3382[_0xf68b('0x5d')]['id']=_0x1b91e1[_0xf68b('0x53')]['UserId'];return db[_0xf68b('0x4c')]['find']({'where':{'id':_0x1b91e1[_0xf68b('0x4e')]['id'],'UserId':null}})[_0xf68b('0x1e')](handleEntityNotFound(_0x1f9a66,null))['then'](function(_0x1f7943){if(_0x1f7943){_0x2c3382[_0xf68b('0x25')]=_0x1f7943[_0xf68b('0x5e')]({'plain':!![]});return db['ChatInteraction']['find']({'where':{'id':_0x1f7943[_0xf68b('0x5f')]}});}return null;})[_0xf68b('0x1e')](handleEntityNotFound(_0x1f9a66,null))[_0xf68b('0x1e')](function(_0x1808ce){if(_0x1808ce){_0x2c3382['interaction']=_0x1808ce[_0xf68b('0x5e')]({'plain':!![]});interaction_log[_0xf68b('0x1f')]('[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x1b91e1[_0xf68b('0x5c')]['id'],_0x1b91e1[_0xf68b('0x5c')]['name'],_0x1b91e1[_0xf68b('0x5c')][_0xf68b('0x64')],_0x2c3382['interaction']['id'],_0x1b91e1[_0xf68b('0x53')]?JSON[_0xf68b('0x66')](_0x1b91e1[_0xf68b('0x53')]):'null');return respondWithRpcPromise(_0xf68b('0x7c'),_0xf68b('0x7d'),_0x2c3382);}return null;})[_0xf68b('0x1e')](function(_0x43c277){var _0x48a2bf=_0xf68b('0x6a')+_0x43c277[_0xf68b('0x25')]['ContactId'];return db['sequelize'][_0xf68b('0x3c')](_0x48a2bf,{'type':db[_0xf68b('0x6d')]['QueryTypes'][_0xf68b('0x6f')],'raw':!![]})[_0xf68b('0x1e')](function(_0x1884e5){return _0x1884e5;});})['then'](function(_0x31c08b){if(_0x31c08b){_0x2c3382['message'][_0xf68b('0x70')]=_0x31c08b[0x0];if(!_0x1b91e1[_0xf68b('0x53')]['UserId'])return;return db[_0xf68b('0x71')][_0xf68b('0x50')]({'where':{'id':_0x1b91e1['body'][_0xf68b('0x5b')],'role':_0xf68b('0x5d')},'attributes':['id',_0xf68b('0x33'),_0xf68b('0x72'),_0xf68b('0x73'),'internal'],'raw':!![]});}return null;})[_0xf68b('0x1e')](function(_0x4a5964){if(!_0x4a5964)return null;_0x2c3382[_0xf68b('0x25')][_0xf68b('0x5d')]=_0x4a5964;return _0x2c3382;})[_0xf68b('0x1e')](function(_0x23dea4){if(_0x23dea4){_0x23dea4[_0xf68b('0x25')]['interface']=util[_0xf68b('0x5a')](_0xf68b('0x76'),_0x1b91e1[_0xf68b('0x5c')]['name']);_0x23dea4[_0xf68b('0x25')]['channel']=_0x2c3382[_0xf68b('0x77')];_0x23dea4['message']['motionChannel']=_0x2c3382['channel'];_0x23dea4['message'][_0xf68b('0x78')]=_0xf68b('0x30');respondWithRpcPromise('EventManager',_0xf68b('0x79'),{'event':_0xf68b('0x7e'),'message':_[_0xf68b('0x48')](_0x2c3382[_0xf68b('0x25')],JSON[_0xf68b('0x7a')](_0x2c3382['interaction'][_0xf68b('0x7b')]))},client9002);return _0x2c3382;}return null;})[_0xf68b('0x1e')](respondWithResult(_0x1f9a66,null))[_0xf68b('0x51')](handleError(_0x1f9a66,null));}; \ No newline at end of file +var _0x004d=['key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','type','options','includeAll','include','findAll','rows','show','length','merge','find','create','body','describe','chat-interactions','accept','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','ChatInteraction','ChatInteractionId','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','stringify','AcceptMessage','sequelize','Sequelize','QueryTypes','SELECT','User','fullname','email','internal','agent','manual','channel','acceptmessage','parse','formData','chat','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','rejectMessage','ContactId','interface','SIP/%s','EventManager','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','./chatMessage.socket','register','jayson/promise','client','http','request','then','info','ChatMessage,\x20%s,\x20%s','ChatMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','sendStatus','end','status','json','undefined','limit','count','offset','Content-Range','reject','save','update','destroy','name','send','index','map','ChatMessage','rawAttributes','fieldName'];(function(_0x543735,_0x236c16){var _0x35eaa7=function(_0x296c6d){while(--_0x296c6d){_0x543735['push'](_0x543735['shift']());}};_0x35eaa7(++_0x236c16);}(_0x004d,0xc1));var _0xd004=function(_0x3c440b,_0x1e6828){_0x3c440b=_0x3c440b-0x0;var _0x1bded3=_0x004d[_0x3c440b];return _0x1bded3;};'use strict';var emlformat=require(_0xd004('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd004('0x1'));var jsonpatch=require(_0xd004('0x2'));var rp=require(_0xd004('0x3'));var moment=require(_0xd004('0x4'));var BPromise=require(_0xd004('0x5'));var Mustache=require('mustache');var util=require(_0xd004('0x6'));var path=require(_0xd004('0x7'));var sox=require(_0xd004('0x8'));var csv=require('to-csv');var ejs=require(_0xd004('0x9'));var fs=require('fs');var fs_extra=require(_0xd004('0xa'));var _=require(_0xd004('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xd004('0xc'));var deskjs=require(_0xd004('0xd'));var toCsv=require(_0xd004('0xe'));var querystring=require(_0xd004('0xf'));var Papa=require(_0xd004('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xd004('0x11'));var as=require(_0xd004('0x12'));var hardwareService=require(_0xd004('0x13'));var logger=require(_0xd004('0x14'))(_0xd004('0x15'));var utils=require('../../config/utils');var config=require(_0xd004('0x16'));var licenseUtil=require(_0xd004('0x17'));var db=require('../../mysqldb')['db'];config[_0xd004('0x18')]=_[_0xd004('0x19')](config[_0xd004('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0xd004('0x1a'))(new Redis(config[_0xd004('0x18')]));require(_0xd004('0x1b'))[_0xd004('0x1c')](socket);var jayson=require(_0xd004('0x1d'));var client=jayson[_0xd004('0x1e')][_0xd004('0x1f')]({'port':0x232c});var client9002=jayson['client'][_0xd004('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0xa744a6,_0x4e045a,_0x542ab5,_0x236f4e){return new BPromise(function(_0x53267c,_0x2e6a0b){var _0x152cff=_0x236f4e||client;return _0x152cff[_0xd004('0x20')](_0xa744a6,_0x542ab5)[_0xd004('0x21')](function(_0x4e02e4){logger[_0xd004('0x22')](_0xd004('0x23'),_0x4e045a,'request\x20sent');logger['debug'](_0xd004('0x24'),_0x4e045a,_0xd004('0x25'),JSON['stringify'](_0x4e02e4));if(_0x4e02e4[_0xd004('0x26')]){if(_0x4e02e4[_0xd004('0x26')][_0xd004('0x27')]===0x1f4){logger['error'](_0xd004('0x23'),_0x4e045a,_0x4e02e4[_0xd004('0x26')]['message']);return _0x2e6a0b(_0x4e02e4[_0xd004('0x26')][_0xd004('0x28')]);}logger[_0xd004('0x26')](_0xd004('0x23'),_0x4e045a,_0x4e02e4[_0xd004('0x26')][_0xd004('0x28')]);return _0x53267c(_0x4e02e4[_0xd004('0x26')][_0xd004('0x28')]);}else{logger[_0xd004('0x22')](_0xd004('0x23'),_0x4e045a,_0xd004('0x25'));_0x53267c(_0x4e02e4[_0xd004('0x29')][_0xd004('0x28')]);}})[_0xd004('0x2a')](function(_0x21ca46){logger['error'](_0xd004('0x23'),_0x4e045a,_0x21ca46);_0x2e6a0b(_0x21ca46);});});}function respondWithStatusCode(_0x4e3a8f,_0x29f1e3){_0x29f1e3=_0x29f1e3||0xcc;return function(_0x43593f){if(_0x43593f){return _0x4e3a8f[_0xd004('0x2b')](_0x29f1e3);}return _0x4e3a8f['status'](_0x29f1e3)[_0xd004('0x2c')]();};}function respondWithResult(_0x504079,_0x4c9ead){_0x4c9ead=_0x4c9ead||0xc8;return function(_0x3f9879){if(_0x3f9879){return _0x504079[_0xd004('0x2d')](_0x4c9ead)[_0xd004('0x2e')](_0x3f9879);}};}function respondWithFilteredResult(_0x35ea0c,_0x329023){return function(_0x31d5c9){if(_0x31d5c9){var _0x386d30=typeof _0x329023['offset']===_0xd004('0x2f')&&typeof _0x329023[_0xd004('0x30')]===_0xd004('0x2f');var _0x16766b=_0x31d5c9[_0xd004('0x31')];var _0x53077d=_0x386d30?0x0:_0x329023['offset'];var _0x42e118=_0x386d30?_0x31d5c9[_0xd004('0x31')]:_0x329023[_0xd004('0x32')]+_0x329023[_0xd004('0x30')];var _0x1e0bab;if(_0x42e118>=_0x16766b){_0x42e118=_0x16766b;_0x1e0bab=0xc8;}else{_0x1e0bab=0xce;}_0x35ea0c[_0xd004('0x2d')](_0x1e0bab);return _0x35ea0c['set'](_0xd004('0x33'),_0x53077d+'-'+_0x42e118+'/'+_0x16766b)[_0xd004('0x2e')](_0x31d5c9);}return null;};}function patchUpdates(_0x3d9947){return function(_0x978601){try{jsonpatch['apply'](_0x978601,_0x3d9947,!![]);}catch(_0x5c79e1){return BPromise[_0xd004('0x34')](_0x5c79e1);}return _0x978601[_0xd004('0x35')]();};}function saveUpdates(_0x447b40,_0x422de){return function(_0x2d58be){if(_0x2d58be){return _0x2d58be[_0xd004('0x36')](_0x447b40)[_0xd004('0x21')](function(_0x32aaa7){return _0x32aaa7;});}return null;};}function removeEntity(_0x27a267,_0x5241e9){return function(_0x5c7f5f){if(_0x5c7f5f){return _0x5c7f5f[_0xd004('0x37')]()[_0xd004('0x21')](function(){_0x27a267[_0xd004('0x2d')](0xcc)[_0xd004('0x2c')]();});}};}function handleEntityNotFound(_0x51e2ba,_0x4f246c){return function(_0x2e90cf){if(!_0x2e90cf){_0x51e2ba[_0xd004('0x2b')](0x194);}return _0x2e90cf;};}function handleError(_0x213d65,_0x15f15d){_0x15f15d=_0x15f15d||0x1f4;return function(_0xc5503a){logger[_0xd004('0x26')](_0xc5503a['stack']);if(_0xc5503a[_0xd004('0x38')]){delete _0xc5503a[_0xd004('0x38')];}_0x213d65[_0xd004('0x2d')](_0x15f15d)[_0xd004('0x39')](_0xc5503a);};}exports[_0xd004('0x3a')]=function(_0x184c0e,_0x2c1ef6){var _0x2ca3a2={},_0x87725f={},_0xc8f3b2={'count':0x0,'rows':[]};var _0x2da273=_[_0xd004('0x3b')](db[_0xd004('0x3c')][_0xd004('0x3d')],function(_0x2a914e){return{'name':_0x2a914e[_0xd004('0x3e')],'type':_0x2a914e['type'][_0xd004('0x3f')]};});_0x87725f[_0xd004('0x40')]=_[_0xd004('0x3b')](_0x2da273,_0xd004('0x38'));_0x87725f[_0xd004('0x41')]=_[_0xd004('0x42')](_0x184c0e[_0xd004('0x41')]);_0x87725f[_0xd004('0x43')]=_['intersection'](_0x87725f[_0xd004('0x40')],_0x87725f[_0xd004('0x41')]);_0x2ca3a2[_0xd004('0x44')]=_[_0xd004('0x45')](_0x87725f[_0xd004('0x40')],qs[_0xd004('0x46')](_0x184c0e['query'][_0xd004('0x46')]));_0x2ca3a2[_0xd004('0x44')]=_0x2ca3a2[_0xd004('0x44')]['length']?_0x2ca3a2[_0xd004('0x44')]:_0x87725f[_0xd004('0x40')];if(!_0x184c0e[_0xd004('0x41')][_0xd004('0x47')](_0xd004('0x48'))){_0x2ca3a2[_0xd004('0x30')]=qs[_0xd004('0x30')](_0x184c0e[_0xd004('0x41')][_0xd004('0x30')]);_0x2ca3a2[_0xd004('0x32')]=qs[_0xd004('0x32')](_0x184c0e[_0xd004('0x41')]['offset']);}_0x2ca3a2[_0xd004('0x49')]=qs['sort'](_0x184c0e[_0xd004('0x41')][_0xd004('0x4a')]);_0x2ca3a2[_0xd004('0x4b')]=qs[_0xd004('0x43')](_[_0xd004('0x4c')](_0x184c0e[_0xd004('0x41')],_0x87725f['filters']),_0x2da273);if(_0x184c0e[_0xd004('0x41')]['filter']){_0x2ca3a2['where']=_['merge'](_0x2ca3a2[_0xd004('0x4b')],{'$or':_['map'](_0x2da273,function(_0x3724eb){if(_0x3724eb[_0xd004('0x4d')]!=='VIRTUAL'){var _0x52a25b={};_0x52a25b[_0x3724eb[_0xd004('0x38')]]={'$like':'%'+_0x184c0e[_0xd004('0x41')]['filter']+'%'};return _0x52a25b;}})});}_0x2ca3a2=_['merge']({},_0x2ca3a2,_0x184c0e[_0xd004('0x4e')]);var _0x333db1={'where':_0x2ca3a2['where']};return db[_0xd004('0x3c')][_0xd004('0x31')](_0x333db1)[_0xd004('0x21')](function(_0x33684c){_0xc8f3b2[_0xd004('0x31')]=_0x33684c;if(_0x184c0e['query'][_0xd004('0x4f')]){_0x2ca3a2[_0xd004('0x50')]=[{'all':!![]}];}return db[_0xd004('0x3c')][_0xd004('0x51')](_0x2ca3a2);})[_0xd004('0x21')](function(_0x2cb12d){_0xc8f3b2[_0xd004('0x52')]=_0x2cb12d;return _0xc8f3b2;})[_0xd004('0x21')](respondWithFilteredResult(_0x2c1ef6,_0x2ca3a2))[_0xd004('0x2a')](handleError(_0x2c1ef6,null));};exports[_0xd004('0x53')]=function(_0x5a2410,_0xad4b49){var _0x2d07a9={'raw':!![],'where':{'id':_0x5a2410['params']['id']}},_0x12b3d1={};_0x12b3d1[_0xd004('0x40')]=_['keys'](db[_0xd004('0x3c')][_0xd004('0x3d')]);_0x12b3d1[_0xd004('0x41')]=_[_0xd004('0x42')](_0x5a2410[_0xd004('0x41')]);_0x12b3d1[_0xd004('0x43')]=_[_0xd004('0x45')](_0x12b3d1['model'],_0x12b3d1[_0xd004('0x41')]);_0x2d07a9[_0xd004('0x44')]=_[_0xd004('0x45')](_0x12b3d1[_0xd004('0x40')],qs[_0xd004('0x46')](_0x5a2410[_0xd004('0x41')]['fields']));_0x2d07a9[_0xd004('0x44')]=_0x2d07a9[_0xd004('0x44')][_0xd004('0x54')]?_0x2d07a9['attributes']:_0x12b3d1['model'];if(_0x5a2410['query'][_0xd004('0x4f')]){_0x2d07a9['include']=[{'all':!![]}];}_0x2d07a9=_[_0xd004('0x55')]({},_0x2d07a9,_0x5a2410[_0xd004('0x4e')]);return db['ChatMessage'][_0xd004('0x56')](_0x2d07a9)['then'](handleEntityNotFound(_0xad4b49,null))[_0xd004('0x21')](respondWithResult(_0xad4b49,null))[_0xd004('0x2a')](handleError(_0xad4b49,null));};exports[_0xd004('0x57')]=function(_0x2da5dc,_0x2933fa){return db[_0xd004('0x3c')][_0xd004('0x57')](_0x2da5dc[_0xd004('0x58')],{})[_0xd004('0x21')](respondWithResult(_0x2933fa,0xc9))[_0xd004('0x2a')](handleError(_0x2933fa,null));};exports[_0xd004('0x36')]=function(_0x526f82,_0x4ea0f3){if(_0x526f82[_0xd004('0x58')]['id']){delete _0x526f82[_0xd004('0x58')]['id'];}return db['ChatMessage'][_0xd004('0x56')]({'where':{'id':_0x526f82['params']['id']}})[_0xd004('0x21')](handleEntityNotFound(_0x4ea0f3,null))[_0xd004('0x21')](saveUpdates(_0x526f82[_0xd004('0x58')],null))[_0xd004('0x21')](respondWithResult(_0x4ea0f3,null))['catch'](handleError(_0x4ea0f3,null));};exports[_0xd004('0x37')]=function(_0x44c497,_0x410944){return db[_0xd004('0x3c')][_0xd004('0x56')]({'where':{'id':_0x44c497['params']['id']}})[_0xd004('0x21')](handleEntityNotFound(_0x410944,null))[_0xd004('0x21')](removeEntity(_0x410944,null))['catch'](handleError(_0x410944,null));};exports['describe']=function(_0x2d3092,_0x415597){return db[_0xd004('0x3c')][_0xd004('0x59')]()[_0xd004('0x21')](respondWithResult(_0x415597,null))[_0xd004('0x2a')](handleError(_0x415597,null));};var interaction_log=require(_0xd004('0x14'))(_0xd004('0x5a'));exports[_0xd004('0x5b')]=function(_0x379876,_0x336a56,_0x35921f){var _0xfb01b2={'agent':{},'channel':'chat'};if(_0x379876[_0xd004('0x58')]['id']){delete _0x379876[_0xd004('0x58')]['id'];}_0x379876[_0xd004('0x58')][_0xd004('0x5c')]=!![];_0x379876[_0xd004('0x58')][_0xd004('0x5d')]=moment()[_0xd004('0x5e')](_0xd004('0x5f'));_0x379876[_0xd004('0x58')][_0xd004('0x60')]=_0x379876[_0xd004('0x58')][_0xd004('0x60')]||_0x379876[_0xd004('0x61')]['id'];_0xfb01b2['agent']['id']=_0x379876[_0xd004('0x58')][_0xd004('0x60')];return db[_0xd004('0x3c')][_0xd004('0x56')]({'where':{'id':_0x379876['params']['id'],'UserId':null}})[_0xd004('0x21')](handleEntityNotFound(_0x336a56,null))['then'](saveUpdates(_0x379876[_0xd004('0x58')],null))[_0xd004('0x21')](function(_0xb71515){if(_0xb71515){_0xfb01b2['message']=_0xb71515[_0xd004('0x62')]({'plain':!![]});return db[_0xd004('0x63')][_0xd004('0x56')]({'where':{'id':_0xb71515[_0xd004('0x64')]}});}return null;})[_0xd004('0x21')](handleEntityNotFound(_0x336a56,null))[_0xd004('0x21')](function(_0x48e522){if(_0x48e522){return _0x48e522[_0xd004('0x36')]({'UserId':_0x379876[_0xd004('0x58')][_0xd004('0x60')],'read1stAt':_['isNil'](_0x48e522['read1stAt'])?moment()[_0xd004('0x5e')](_0xd004('0x5f')):undefined});}return null;})[_0xd004('0x21')](function(_0x2f24f0){if(_0x2f24f0){_0xfb01b2[_0xd004('0x65')]=_0x2f24f0['get']({'plain':!![]});interaction_log[_0xd004('0x22')](_0xd004('0x66'),_0x379876['user']['id'],_0x379876[_0xd004('0x61')][_0xd004('0x38')],_0x379876[_0xd004('0x61')]['role'],_0xfb01b2[_0xd004('0x65')]['id'],_0x379876[_0xd004('0x58')]?JSON[_0xd004('0x67')](_0x379876['body']):'null');return respondWithRpcPromise(_0xd004('0x68'),'acceptMessage',_0xfb01b2);}return null;})[_0xd004('0x21')](function(_0x307b3d){var _0x3351c7='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x307b3d[_0xd004('0x28')]['ContactId'];return db[_0xd004('0x69')][_0xd004('0x41')](_0x3351c7,{'type':db[_0xd004('0x6a')][_0xd004('0x6b')][_0xd004('0x6c')],'raw':!![]})[_0xd004('0x21')](function(_0x24dde4){return _0x24dde4;});})['then'](function(_0x5f34e1){if(_0x5f34e1){_0xfb01b2[_0xd004('0x28')]['contact']=_0x5f34e1[0x0];if(!_0x379876[_0xd004('0x58')][_0xd004('0x60')])return;return db[_0xd004('0x6d')][_0xd004('0x56')]({'where':{'id':_0x379876[_0xd004('0x58')][_0xd004('0x60')],'role':'agent'},'attributes':['id','name',_0xd004('0x6e'),_0xd004('0x6f'),_0xd004('0x70')],'raw':!![]});}return null;})[_0xd004('0x21')](function(_0x16e97f){if(!_0x16e97f)return null;_0xfb01b2[_0xd004('0x28')][_0xd004('0x71')]=_0x16e97f;return _0xfb01b2;})[_0xd004('0x21')](function(_0x104075){if(_0x104075){if(_0x379876[_0xd004('0x58')][_0xd004('0x72')]){_0xfb01b2['message']['interface']=util[_0xd004('0x5e')]('SIP/%s',_0x379876[_0xd004('0x61')][_0xd004('0x38')]);_0xfb01b2[_0xd004('0x28')]['channel']=_0xfb01b2[_0xd004('0x73')];_0xfb01b2['message']['motionChannel']=_0xfb01b2['channel'];_0xfb01b2['message']['event']=_0xd004('0x5b');return respondWithRpcPromise('EventManager','EventManager',{'event':_0xd004('0x74'),'message':_[_0xd004('0x55')](_0xfb01b2[_0xd004('0x28')],JSON[_0xd004('0x75')](_0xfb01b2[_0xd004('0x65')][_0xd004('0x76')]))},client9002)[_0xd004('0x21')](function(){return _0xfb01b2;});}return _0xfb01b2;}return null;})['then'](respondWithResult(_0x336a56,null))[_0xd004('0x2a')](handleError(_0x336a56,null));};var interaction_log=require('../../config/logger')(_0xd004('0x5a'));exports[_0xd004('0x34')]=function(_0xde8911,_0x4be64,_0x4e456f){var _0xb107a1={'agent':{},'channel':_0xd004('0x77')};if(_0xde8911[_0xd004('0x58')]['id']){delete _0xde8911['body']['id'];}_0xde8911[_0xd004('0x58')][_0xd004('0x60')]=_0xde8911[_0xd004('0x58')][_0xd004('0x60')]||_0xde8911['user']['id'];_0xb107a1[_0xd004('0x71')]['id']=_0xde8911[_0xd004('0x58')][_0xd004('0x60')];return db[_0xd004('0x3c')][_0xd004('0x56')]({'where':{'id':_0xde8911['params']['id'],'UserId':null}})[_0xd004('0x21')](handleEntityNotFound(_0x4be64,null))[_0xd004('0x21')](function(_0x5d2ade){if(_0x5d2ade){_0xb107a1[_0xd004('0x28')]=_0x5d2ade[_0xd004('0x62')]({'plain':!![]});return db[_0xd004('0x63')][_0xd004('0x56')]({'where':{'id':_0x5d2ade['ChatInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x4be64,null))['then'](function(_0x2c7c9f){if(_0x2c7c9f){_0xb107a1[_0xd004('0x65')]=_0x2c7c9f[_0xd004('0x62')]({'plain':!![]});interaction_log[_0xd004('0x22')](_0xd004('0x78'),_0xde8911[_0xd004('0x61')]['id'],_0xde8911[_0xd004('0x61')]['name'],_0xde8911[_0xd004('0x61')][_0xd004('0x79')],_0xb107a1[_0xd004('0x65')]['id'],_0xde8911[_0xd004('0x58')]?JSON['stringify'](_0xde8911[_0xd004('0x58')]):_0xd004('0x7a'));return respondWithRpcPromise('RejectMessage',_0xd004('0x7b'),_0xb107a1);}return null;})[_0xd004('0x21')](function(_0x5bb1f1){var _0x1173aa='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x5bb1f1[_0xd004('0x28')][_0xd004('0x7c')];return db['sequelize'][_0xd004('0x41')](_0x1173aa,{'type':db[_0xd004('0x6a')][_0xd004('0x6b')][_0xd004('0x6c')],'raw':!![]})[_0xd004('0x21')](function(_0xc9c8c9){return _0xc9c8c9;});})[_0xd004('0x21')](function(_0x3f8053){if(_0x3f8053){_0xb107a1[_0xd004('0x28')]['contact']=_0x3f8053[0x0];if(!_0xde8911[_0xd004('0x58')][_0xd004('0x60')])return;return db[_0xd004('0x6d')]['find']({'where':{'id':_0xde8911[_0xd004('0x58')][_0xd004('0x60')],'role':_0xd004('0x71')},'attributes':['id',_0xd004('0x38'),_0xd004('0x6e'),_0xd004('0x6f'),'internal'],'raw':!![]});}return null;})['then'](function(_0x372739){if(!_0x372739)return null;_0xb107a1[_0xd004('0x28')]['agent']=_0x372739;return _0xb107a1;})[_0xd004('0x21')](function(_0x35c142){if(_0x35c142){_0x35c142[_0xd004('0x28')][_0xd004('0x7d')]=util['format'](_0xd004('0x7e'),_0xde8911[_0xd004('0x61')][_0xd004('0x38')]);_0x35c142[_0xd004('0x28')][_0xd004('0x73')]=_0xb107a1[_0xd004('0x73')];_0x35c142[_0xd004('0x28')]['motionChannel']=_0xb107a1['channel'];_0x35c142['message']['event']=_0xd004('0x34');respondWithRpcPromise(_0xd004('0x7f'),_0xd004('0x7f'),{'event':'rejectmessage','message':_[_0xd004('0x55')](_0xb107a1['message'],JSON[_0xd004('0x75')](_0xb107a1[_0xd004('0x65')][_0xd004('0x76')]))},client9002);return _0xb107a1;}return null;})[_0xd004('0x21')](respondWithResult(_0x4be64,null))[_0xd004('0x2a')](handleError(_0x4be64,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index 3dc0f5e..40d279d 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 _0x0675=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatMessage','remove'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x0675,0xac));var _0x5067=function(_0x3250c5,_0x35961e){_0x3250c5=_0x3250c5-0x0;var _0x2ff8c1=_0x0675[_0x3250c5];return _0x2ff8c1;};'use strict';var EventEmitter=require(_0x5067('0x0'));var ChatMessage=require(_0x5067('0x1'))['db'][_0x5067('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x5067('0x3')};function emitEvent(_0x38e35d){return function(_0x41128e,_0x49cfbc,_0x2d9b3b){ChatMessageEvents[_0x5067('0x4')](_0x38e35d+':'+_0x41128e['id'],_0x41128e);ChatMessageEvents[_0x5067('0x4')](_0x38e35d,_0x41128e);_0x2d9b3b(null);};}for(var e in events){if(events[_0x5067('0x5')](e)){var event=events[e];ChatMessage[_0x5067('0x6')](e,emitEvent(event));}}module[_0x5067('0x7')]=ChatMessageEvents; \ No newline at end of file +var _0x9ce4=['emit','hook','exports','events','ChatMessage','save','remove'];(function(_0xa70312,_0xce98f0){var _0x23ed2d=function(_0x3b44d6){while(--_0x3b44d6){_0xa70312['push'](_0xa70312['shift']());}};_0x23ed2d(++_0xce98f0);}(_0x9ce4,0x73));var _0x49ce=function(_0x4eab11,_0x420bfb){_0x4eab11=_0x4eab11-0x0;var _0x417a63=_0x9ce4[_0x4eab11];return _0x417a63;};'use strict';var EventEmitter=require(_0x49ce('0x0'));var ChatMessage=require('../../mysqldb')['db'][_0x49ce('0x1')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x49ce('0x2'),'afterUpdate':'update','afterDestroy':_0x49ce('0x3')};function emitEvent(_0xba8683){return function(_0x389be6,_0x40f067,_0x4f92ab){ChatMessageEvents[_0x49ce('0x4')](_0xba8683+':'+_0x389be6['id'],_0x389be6);ChatMessageEvents[_0x49ce('0x4')](_0xba8683,_0x389be6);_0x4f92ab(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatMessage[_0x49ce('0x5')](e,emitEvent(event));}}module[_0x49ce('0x6')]=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index 4617df5..5f57b6e 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 _0x3733=['models','get','direction','toLowerCase','out','UserId','ChatInteraction','findOne','createdAt','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','./chatMessage.attributes','exports','define','ChatMessage','chat_messages','body','FULLTEXT'];(function(_0x46aff0,_0x122890){var _0x9d78cf=function(_0x3f14cb){while(--_0x3f14cb){_0x46aff0['push'](_0x46aff0['shift']());}};_0x9d78cf(++_0x122890);}(_0x3733,0x93));var _0x3373=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3733[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x3373('0x0'));var util=require(_0x3373('0x1'));var logger=require(_0x3373('0x2'))(_0x3373('0x3'));var moment=require(_0x3373('0x4'));var BPromise=require('bluebird');var rp=require(_0x3373('0x5'));var fs=require('fs');var path=require(_0x3373('0x6'));var rimraf=require(_0x3373('0x7'));var config=require('../../config/environment');var attributes=require(_0x3373('0x8'));module[_0x3373('0x9')]=function(_0x37f17e,_0x1d49ae){return _0x37f17e[_0x3373('0xa')](_0x3373('0xb'),attributes,{'tableName':_0x3373('0xc'),'paranoid':![],'indexes':[{'name':'fti_chat_messages','fields':[_0x3373('0xd')],'type':_0x3373('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1038d9,_0x56b99e,_0x362d1e){var _0x3daadf=_0x37f17e[_0x3373('0xf')];var _0x2693d4=_0x1038d9[_0x3373('0x10')]({'plain':!![]});if(_0x2693d4[_0x3373('0x11')][_0x3373('0x12')]()==='in'||_0x2693d4[_0x3373('0x11')][_0x3373('0x12')]()===_0x3373('0x13')&&!_0x2693d4['secret']&&!_['isNil'](_0x2693d4[_0x3373('0x14')])){_0x3daadf[_0x3373('0x15')][_0x3373('0x16')]({'where':{'id':_0x2693d4['ChatInteractionId']}})['then'](function(_0x23972c){if(_0x23972c){_0x23972c['update']({'lastMsgAt':_0x2693d4[_0x3373('0x17')],'lastMsgDirection':_0x2693d4[_0x3373('0x11')]['toLowerCase']()});}})['catch'](function(_0xf7fabf){console[_0x3373('0x18')](_0xf7fabf);});}_0x362d1e();}},'charset':_0x3373('0x19'),'collate':_0x3373('0x1a')});}; \ No newline at end of file +var _0x383a=['isNil','UserId','ChatInteraction','ChatInteractionId','then','update','createdAt','toLowerCase','catch','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','bluebird','path','rimraf','../../config/environment','define','FULLTEXT','get','direction','secret'];(function(_0x5f49bc,_0x548555){var _0x44bbb9=function(_0x5e2caf){while(--_0x5e2caf){_0x5f49bc['push'](_0x5f49bc['shift']());}};_0x44bbb9(++_0x548555);}(_0x383a,0x1ad));var _0xa383=function(_0x9d53fb,_0x4b898b){_0x9d53fb=_0x9d53fb-0x0;var _0x12f955=_0x383a[_0x9d53fb];return _0x12f955;};'use strict';var _=require('lodash');var util=require(_0xa383('0x0'));var logger=require(_0xa383('0x1'))('api');var moment=require('moment');var BPromise=require(_0xa383('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa383('0x3'));var rimraf=require(_0xa383('0x4'));var config=require(_0xa383('0x5'));var attributes=require('./chatMessage.attributes');module['exports']=function(_0xc72371,_0x160e4f){return _0xc72371[_0xa383('0x6')]('ChatMessage',attributes,{'tableName':'chat_messages','paranoid':![],'indexes':[{'name':'fti_chat_messages','fields':['body'],'type':_0xa383('0x7')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5f1851,_0x4940cb,_0x1b676b){var _0x3d63e4=_0xc72371['models'];var _0x3c0b0b=_0x5f1851[_0xa383('0x8')]({'plain':!![]});if(_0x3c0b0b[_0xa383('0x9')]['toLowerCase']()==='in'||_0x3c0b0b[_0xa383('0x9')]['toLowerCase']()==='out'&&!_0x3c0b0b[_0xa383('0xa')]&&!_[_0xa383('0xb')](_0x3c0b0b[_0xa383('0xc')])){_0x3d63e4[_0xa383('0xd')]['findOne']({'where':{'id':_0x3c0b0b[_0xa383('0xe')]}})[_0xa383('0xf')](function(_0x2567c8){if(_0x2567c8){_0x2567c8[_0xa383('0x10')]({'lastMsgAt':_0x3c0b0b[_0xa383('0x11')],'lastMsgDirection':_0x3c0b0b[_0xa383('0x9')][_0xa383('0x12')]()});}})[_0xa383('0x13')](function(_0x514394){console['error'](_0x514394);});}_0x1b676b();}},'charset':_0xa383('0x14'),'collate':_0xa383('0x15')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index f3dfece..fa915f4 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 _0xe888=['jayson/promise','http','redis','socket.io-emitter','./chatMessage.socket','register','request','info','ChatMessage,\x20%s,\x20%s','debug','ChatMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','CreateChatMessage','ChatMessage','create','options','lodash','randomstring','ioredis','../../config/utils','rpc','../../config/environment'];(function(_0x2992cb,_0x102ca6){var _0x499699=function(_0x25d001){while(--_0x25d001){_0x2992cb['push'](_0x2992cb['shift']());}};_0x499699(++_0x102ca6);}(_0xe888,0x1c5));var _0x8e88=function(_0x1d7037,_0x57dd95){_0x1d7037=_0x1d7037-0x0;var _0x4d6568=_0xe888[_0x1d7037];return _0x4d6568;};'use strict';var _=require(_0x8e88('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x8e88('0x1'));var fs=require('fs');var Redis=require(_0x8e88('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x8e88('0x3'));var logger=require('../../config/logger')(_0x8e88('0x4'));var config=require(_0x8e88('0x5'));var jayson=require(_0x8e88('0x6'));var client=jayson['client'][_0x8e88('0x7')]({'port':0x232a});config[_0x8e88('0x8')]=_['defaults'](config[_0x8e88('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0x8e88('0x9'))(new Redis(config[_0x8e88('0x8')]));require(_0x8e88('0xa'))[_0x8e88('0xb')](socket);function respondWithRpcPromise(_0x41a011,_0x2806ef,_0x57954c){return new BPromise(function(_0x3bd911,_0x31428f){return client[_0x8e88('0xc')](_0x41a011,_0x57954c)['then'](function(_0x13f11a){logger[_0x8e88('0xd')](_0x8e88('0xe'),_0x2806ef,'request\x20sent');logger[_0x8e88('0xf')](_0x8e88('0x10'),_0x2806ef,_0x8e88('0x11'),JSON[_0x8e88('0x12')](_0x13f11a));if(_0x13f11a[_0x8e88('0x13')]){if(_0x13f11a[_0x8e88('0x13')]['code']===0x1f4){logger[_0x8e88('0x13')](_0x8e88('0xe'),_0x2806ef,_0x13f11a[_0x8e88('0x13')][_0x8e88('0x14')]);return _0x31428f(_0x13f11a[_0x8e88('0x13')][_0x8e88('0x14')]);}logger['error'](_0x8e88('0xe'),_0x2806ef,_0x13f11a[_0x8e88('0x13')][_0x8e88('0x14')]);return _0x3bd911(_0x13f11a[_0x8e88('0x13')][_0x8e88('0x14')]);}else{logger[_0x8e88('0xd')](_0x8e88('0xe'),_0x2806ef,'request\x20sent');_0x3bd911(_0x13f11a[_0x8e88('0x15')][_0x8e88('0x14')]);}})[_0x8e88('0x16')](function(_0x48241a){logger[_0x8e88('0x13')]('ChatMessage,\x20%s,\x20%s',_0x2806ef,_0x48241a);_0x31428f(_0x48241a);});});}exports[_0x8e88('0x17')]=function(_0x138278){var _0x1a37ef=this;return new Promise(function(_0x83d6ce,_0x512012){return db[_0x8e88('0x18')][_0x8e88('0x19')](_0x138278['body'],{'raw':_0x138278[_0x8e88('0x1a')]?_0x138278[_0x8e88('0x1a')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x141c4d){logger[_0x8e88('0xd')]('CreateChatMessage',_0x138278);logger[_0x8e88('0xf')]('CreateChatMessage',_0x138278,JSON['stringify'](_0x141c4d));_0x83d6ce(_0x141c4d);})[_0x8e88('0x16')](function(_0x12c7b7){logger[_0x8e88('0x13')](_0x8e88('0x17'),_0x12c7b7['message'],_0x138278);_0x512012(_0x1a37ef[_0x8e88('0x13')](0x1f4,_0x12c7b7[_0x8e88('0x14')]));});});}; \ No newline at end of file +var _0xd608=['socket.io-emitter','./chatMessage.socket','register','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','ChatMessage','create','body','options','raw','CreateChatMessage','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost'];(function(_0x1fb7d1,_0x108781){var _0x2480d8=function(_0x9bc3d9){while(--_0x9bc3d9){_0x1fb7d1['push'](_0x1fb7d1['shift']());}};_0x2480d8(++_0x108781);}(_0xd608,0x1b8));var _0x8d60=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd608[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x8d60('0x0'));var util=require(_0x8d60('0x1'));var moment=require(_0x8d60('0x2'));var BPromise=require(_0x8d60('0x3'));var rs=require(_0x8d60('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8d60('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x8d60('0x6'))(_0x8d60('0x7'));var config=require(_0x8d60('0x8'));var jayson=require(_0x8d60('0x9'));var client=jayson[_0x8d60('0xa')][_0x8d60('0xb')]({'port':0x232a});config[_0x8d60('0xc')]=_[_0x8d60('0xd')](config[_0x8d60('0xc')],{'host':_0x8d60('0xe'),'port':0x18eb});var socket=require(_0x8d60('0xf'))(new Redis(config[_0x8d60('0xc')]));require(_0x8d60('0x10'))[_0x8d60('0x11')](socket);function respondWithRpcPromise(_0x394d3c,_0x1b0293,_0x2647d3){return new BPromise(function(_0x2298a6,_0x35b92b){return client['request'](_0x394d3c,_0x2647d3)[_0x8d60('0x12')](function(_0x3d0716){logger[_0x8d60('0x13')](_0x8d60('0x14'),_0x1b0293,_0x8d60('0x15'));logger[_0x8d60('0x16')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0x1b0293,_0x8d60('0x15'),JSON[_0x8d60('0x17')](_0x3d0716));if(_0x3d0716[_0x8d60('0x18')]){if(_0x3d0716[_0x8d60('0x18')][_0x8d60('0x19')]===0x1f4){logger[_0x8d60('0x18')](_0x8d60('0x14'),_0x1b0293,_0x3d0716[_0x8d60('0x18')][_0x8d60('0x1a')]);return _0x35b92b(_0x3d0716[_0x8d60('0x18')][_0x8d60('0x1a')]);}logger['error'](_0x8d60('0x14'),_0x1b0293,_0x3d0716['error'][_0x8d60('0x1a')]);return _0x2298a6(_0x3d0716['error'][_0x8d60('0x1a')]);}else{logger[_0x8d60('0x13')]('ChatMessage,\x20%s,\x20%s',_0x1b0293,_0x8d60('0x15'));_0x2298a6(_0x3d0716[_0x8d60('0x1b')][_0x8d60('0x1a')]);}})['catch'](function(_0x5a00c6){logger[_0x8d60('0x18')](_0x8d60('0x14'),_0x1b0293,_0x5a00c6);_0x35b92b(_0x5a00c6);});});}exports['CreateChatMessage']=function(_0xc34381){var _0x1b2522=this;return new Promise(function(_0x4e9f3a,_0x32e821){return db[_0x8d60('0x1c')][_0x8d60('0x1d')](_0xc34381[_0x8d60('0x1e')],{'raw':_0xc34381[_0x8d60('0x1f')]?_0xc34381['options'][_0x8d60('0x20')]===undefined?!![]:![]:!![]})[_0x8d60('0x12')](function(_0x1f4486){logger['info']('CreateChatMessage',_0xc34381);logger[_0x8d60('0x16')](_0x8d60('0x21'),_0xc34381,JSON['stringify'](_0x1f4486));_0x4e9f3a(_0x1f4486);})[_0x8d60('0x22')](function(_0x4a6fc7){logger[_0x8d60('0x18')](_0x8d60('0x21'),_0x4a6fc7[_0x8d60('0x1a')],_0xc34381);_0x32e821(_0x1b2522['error'](0x1f4,_0x4a6fc7['message']));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index c0467ab..56321c3 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 _0x9c5a=['chatMessage:','./chatMessage.events','save','update','register'];(function(_0x415f0e,_0x3234e3){var _0x29af4c=function(_0x2f10d3){while(--_0x2f10d3){_0x415f0e['push'](_0x415f0e['shift']());}};_0x29af4c(++_0x3234e3);}(_0x9c5a,0x1c3));var _0xa9c5=function(_0x25e930,_0x58d2cc){_0x25e930=_0x25e930-0x0;var _0x2feb3a=_0x9c5a[_0x25e930];return _0x2feb3a;};'use strict';var ChatMessageEvents=require(_0xa9c5('0x0'));var events=[_0xa9c5('0x1'),'remove',_0xa9c5('0x2')];function createListener(_0x1cd14d,_0x1d0ee9){return function(_0x32e75a){_0x1d0ee9['emit'](_0x1cd14d,_0x32e75a);};}function removeListener(_0x2acfaf,_0x3051b1){return function(){ChatMessageEvents['removeListener'](_0x2acfaf,_0x3051b1);};}exports[_0xa9c5('0x3')]=function(_0x4d9c7a){for(var _0x394d84=0x0,_0x3df556=events['length'];_0x394d84<_0x3df556;_0x394d84++){var _0x4b6db6=events[_0x394d84];var _0x3d6b50=createListener(_0xa9c5('0x4')+_0x4b6db6,_0x4d9c7a);ChatMessageEvents['on'](_0x4b6db6,_0x3d6b50);}}; \ No newline at end of file +var _0x72b1=['register','length','./chatMessage.events','remove','update','emit','removeListener'];(function(_0x433a86,_0x175b5c){var _0x23000c=function(_0x4b1fa0){while(--_0x4b1fa0){_0x433a86['push'](_0x433a86['shift']());}};_0x23000c(++_0x175b5c);}(_0x72b1,0x16e));var _0x172b=function(_0x5ad20f,_0x4955c2){_0x5ad20f=_0x5ad20f-0x0;var _0x5d8b36=_0x72b1[_0x5ad20f];return _0x5d8b36;};'use strict';var ChatMessageEvents=require(_0x172b('0x0'));var events=['save',_0x172b('0x1'),_0x172b('0x2')];function createListener(_0x42b795,_0x18fd16){return function(_0x23bc7a){_0x18fd16[_0x172b('0x3')](_0x42b795,_0x23bc7a);};}function removeListener(_0x2c1d6e,_0x558038){return function(){ChatMessageEvents[_0x172b('0x4')](_0x2c1d6e,_0x558038);};}exports[_0x172b('0x5')]=function(_0x475fd6){for(var _0x222624=0x0,_0x571994=events[_0x172b('0x6')];_0x222624<_0x571994;_0x222624++){var _0x517363=events[_0x222624];var _0x1f98e9=createListener('chatMessage:'+_0x517363,_0x475fd6);ChatMessageEvents['on'](_0x517363,_0x1f98e9);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index 843a95c..f18a2de 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 _0x1b58=['accept','/:id/reject','reject','delete','multer','util','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatMessage.controller','get','isAuthenticated','/:id','show','post','tracked','chatmessage:create','create','update','put','/:id/accept'];(function(_0x361d3f,_0x3be2aa){var _0x320229=function(_0x138319){while(--_0x138319){_0x361d3f['push'](_0x361d3f['shift']());}};_0x320229(++_0x3be2aa);}(_0x1b58,0xea));var _0x81b5=function(_0x39e6cf,_0xd521a2){_0x39e6cf=_0x39e6cf-0x0;var _0x4bd03f=_0x1b58[_0x39e6cf];return _0x4bd03f;};'use strict';var multer=require(_0x81b5('0x0'));var util=require(_0x81b5('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x81b5('0x2'));var router=express[_0x81b5('0x3')]();var fs_extra=require(_0x81b5('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x81b5('0x5'));var config=require(_0x81b5('0x6'));var controller=require(_0x81b5('0x7'));router[_0x81b5('0x8')]('/',auth[_0x81b5('0x9')](),controller['index']);router[_0x81b5('0x8')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x81b5('0x8')](_0x81b5('0xa'),auth['isAuthenticated'](),controller[_0x81b5('0xb')]);router[_0x81b5('0xc')]('/',auth[_0x81b5('0x9')](),interaction[_0x81b5('0xd')]('chat',_0x81b5('0xe')),controller[_0x81b5('0xf')]);router['put'](_0x81b5('0xa'),controller[_0x81b5('0x10')]);router[_0x81b5('0x11')](_0x81b5('0x12'),auth['isAuthenticated'](),controller[_0x81b5('0x13')]);router[_0x81b5('0x11')](_0x81b5('0x14'),auth[_0x81b5('0x9')](),controller[_0x81b5('0x15')]);router[_0x81b5('0x16')](_0x81b5('0xa'),auth[_0x81b5('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xf903=['isAuthenticated','index','describe','/:id','show','tracked','chat','create','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./chatMessage.controller','get'];(function(_0x19a2dc,_0x39eaf4){var _0x5405ef=function(_0x4ced77){while(--_0x4ced77){_0x19a2dc['push'](_0x19a2dc['shift']());}};_0x5405ef(++_0x39eaf4);}(_0xf903,0x1b1));var _0x3f90=function(_0x24ba87,_0x243064){_0x24ba87=_0x24ba87-0x0;var _0x3988ed=_0xf903[_0x24ba87];return _0x3988ed;};'use strict';var multer=require(_0x3f90('0x0'));var util=require(_0x3f90('0x1'));var path=require(_0x3f90('0x2'));var timeout=require(_0x3f90('0x3'));var express=require(_0x3f90('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x3f90('0x5'));var config=require(_0x3f90('0x6'));var controller=require(_0x3f90('0x7'));router[_0x3f90('0x8')]('/',auth[_0x3f90('0x9')](),controller[_0x3f90('0xa')]);router['get']('/describe',auth[_0x3f90('0x9')](),controller[_0x3f90('0xb')]);router[_0x3f90('0x8')](_0x3f90('0xc'),auth[_0x3f90('0x9')](),controller[_0x3f90('0xd')]);router['post']('/',auth[_0x3f90('0x9')](),interaction[_0x3f90('0xe')](_0x3f90('0xf'),'chatmessage:create'),controller[_0x3f90('0x10')]);router[_0x3f90('0x11')](_0x3f90('0xc'),controller[_0x3f90('0x12')]);router[_0x3f90('0x11')](_0x3f90('0x13'),auth[_0x3f90('0x9')](),controller[_0x3f90('0x14')]);router[_0x3f90('0x11')](_0x3f90('0x15'),auth['isAuthenticated'](),controller[_0x3f90('0x16')]);router[_0x3f90('0x17')]('/:id',auth[_0x3f90('0x9')](),controller[_0x3f90('0x18')]);module[_0x3f90('0x19')]=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index 29e8102..2205e4b 100644 --- a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js +++ b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2032=['medium','exports','TEXT'];(function(_0x41cff5,_0x1ca091){var _0x3704ce=function(_0x5422ed){while(--_0x5422ed){_0x41cff5['push'](_0x41cff5['shift']());}};_0x3704ce(++_0x1ca091);}(_0x2032,0xd9));var _0x2203=function(_0x1e3af4,_0x525d10){_0x1e3af4=_0x1e3af4-0x0;var _0x1b74f2=_0x2032[_0x1e3af4];return _0x1b74f2;};'use strict';var Sequelize=require('sequelize');module[_0x2203('0x0')]={'body':{'type':Sequelize[_0x2203('0x1')](_0x2203('0x2')),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT'](_0x2203('0x2')),'allowNull':![]}}; \ No newline at end of file +var _0x2032=['medium','exports','TEXT'];(function(_0x557c91,_0x331603){var _0x1f7191=function(_0x52e7d3){while(--_0x52e7d3){_0x557c91['push'](_0x557c91['shift']());}};_0x1f7191(++_0x331603);}(_0x2032,0xd9));var _0x2203=function(_0x171356,_0x40f11c){_0x171356=_0x171356-0x0;var _0x29d5ac=_0x2032[_0x171356];return _0x29d5ac;};'use strict';var Sequelize=require('sequelize');module[_0x2203('0x0')]={'body':{'type':Sequelize[_0x2203('0x1')](_0x2203('0x2')),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT'](_0x2203('0x2')),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index 3dc6b82..3534756 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(_0x513aa5,_0x1fba79){var _0x1a1a7c=function(_0x240e3f){while(--_0x240e3f){_0x513aa5['push'](_0x513aa5['shift']());}};_0x1a1a7c(++_0x1fba79);}(_0x7a54,0x106));var _0x47a5=function(_0x3efc81,_0xb5534e){_0x3efc81=_0x3efc81-0x0;var _0x3e78bc=_0x7a54[_0x3efc81];return _0x3e78bc;};'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(_0x4bb214,_0x18736a){var _0x4ab52c=function(_0x193122){while(--_0x193122){_0x4bb214['push'](_0x4bb214['shift']());}};_0x4ab52c(++_0x18736a);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'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 86cddd4..400b52a 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 _0x99b9=['update','remove','emit','hasOwnProperty','hook','exports','events','ChatOfflineMessage','setMaxListeners','save'];(function(_0x1198ac,_0x5d1695){var _0x3f2b70=function(_0x53eb2a){while(--_0x53eb2a){_0x1198ac['push'](_0x1198ac['shift']());}};_0x3f2b70(++_0x5d1695);}(_0x99b9,0x18c));var _0x999b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x99b9[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x999b('0x0'));var ChatOfflineMessage=require('../../mysqldb')['db'][_0x999b('0x1')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0x999b('0x2')](0x0);var events={'afterCreate':_0x999b('0x3'),'afterUpdate':_0x999b('0x4'),'afterDestroy':_0x999b('0x5')};function emitEvent(_0x4af858){return function(_0x18b85d,_0x19c557,_0x125f8d){ChatOfflineMessageEvents[_0x999b('0x6')](_0x4af858+':'+_0x18b85d['id'],_0x18b85d);ChatOfflineMessageEvents[_0x999b('0x6')](_0x4af858,_0x18b85d);_0x125f8d(null);};}for(var e in events){if(events[_0x999b('0x7')](e)){var event=events[e];ChatOfflineMessage[_0x999b('0x8')](e,emitEvent(event));}}module[_0x999b('0x9')]=ChatOfflineMessageEvents; \ No newline at end of file +var _0xb1b2=['events','../../mysqldb','ChatOfflineMessage','setMaxListeners','save','remove','emit'];(function(_0x46e523,_0xe6fccb){var _0x5da0ee=function(_0x396682){while(--_0x396682){_0x46e523['push'](_0x46e523['shift']());}};_0x5da0ee(++_0xe6fccb);}(_0xb1b2,0x12d));var _0x2b1b=function(_0x18c5ed,_0x11ab7e){_0x18c5ed=_0x18c5ed-0x0;var _0x5c797a=_0xb1b2[_0x18c5ed];return _0x5c797a;};'use strict';var EventEmitter=require(_0x2b1b('0x0'));var ChatOfflineMessage=require(_0x2b1b('0x1'))['db'][_0x2b1b('0x2')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0x2b1b('0x3')](0x0);var events={'afterCreate':_0x2b1b('0x4'),'afterUpdate':'update','afterDestroy':_0x2b1b('0x5')};function emitEvent(_0xa1387b){return function(_0x32baad,_0x1ec5d3,_0x33072e){ChatOfflineMessageEvents[_0x2b1b('0x6')](_0xa1387b+':'+_0x32baad['id'],_0x32baad);ChatOfflineMessageEvents[_0x2b1b('0x6')](_0xa1387b,_0x32baad);_0x33072e(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatOfflineMessage['hook'](e,emitEvent(event));}}module['exports']=ChatOfflineMessageEvents; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index a85f500..af32554 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 _0x9a31=['define','chat_offline_messages','utf8mb4_unicode_ci','exports'];(function(_0x4ad2f9,_0x51909b){var _0x2584bd=function(_0x22d7a3){while(--_0x22d7a3){_0x4ad2f9['push'](_0x4ad2f9['shift']());}};_0x2584bd(++_0x51909b);}(_0x9a31,0x1eb));var _0x19a3=function(_0x1c9c24,_0x2a517b){_0x1c9c24=_0x1c9c24-0x0;var _0x349c69=_0x9a31[_0x1c9c24];return _0x349c69;};'use strict';var attributes=require('./chatOfflineMessage.attributes');module[_0x19a3('0x0')]=function(_0xab409a){return _0xab409a[_0x19a3('0x1')]('ChatOfflineMessage',attributes,{'tableName':_0x19a3('0x2'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x19a3('0x3')});}; \ No newline at end of file +var _0x15c5=['define','ChatOfflineMessage','chat_offline_messages','utf8mb4_unicode_ci','./chatOfflineMessage.attributes','exports'];(function(_0x4e9628,_0x250573){var _0x27bc8c=function(_0xb3b7ae){while(--_0xb3b7ae){_0x4e9628['push'](_0x4e9628['shift']());}};_0x27bc8c(++_0x250573);}(_0x15c5,0x118));var _0x515c=function(_0x1c208e,_0x2a0a5b){_0x1c208e=_0x1c208e-0x0;var _0x5104ff=_0x15c5[_0x1c208e];return _0x5104ff;};'use strict';var attributes=require(_0x515c('0x0'));module[_0x515c('0x1')]=function(_0x14d7f9){return _0x14d7f9[_0x515c('0x2')](_0x515c('0x3'),attributes,{'tableName':_0x515c('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x515c('0x5')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index b4ebc5a..865b87a 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 _0x6f7b=['debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent'];(function(_0x4d36b3,_0x512bc1){var _0xa3ddec=function(_0x3d075e){while(--_0x3d075e){_0x4d36b3['push'](_0x4d36b3['shift']());}};_0xa3ddec(++_0x512bc1);}(_0x6f7b,0x168));var _0xb6f7=function(_0x55e943,_0x5d95d){_0x55e943=_0x55e943-0x0;var _0x5459ae=_0x6f7b[_0x55e943];return _0x5459ae;};'use strict';var _=require('lodash');var util=require(_0xb6f7('0x0'));var moment=require(_0xb6f7('0x1'));var BPromise=require(_0xb6f7('0x2'));var rs=require(_0xb6f7('0x3'));var fs=require('fs');var Redis=require(_0xb6f7('0x4'));var db=require(_0xb6f7('0x5'))['db'];var utils=require(_0xb6f7('0x6'));var logger=require('../../config/logger')(_0xb6f7('0x7'));var config=require('../../config/environment');var jayson=require(_0xb6f7('0x8'));var client=jayson[_0xb6f7('0x9')][_0xb6f7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x11eefa,_0x53868c,_0x26b4cb){return new BPromise(function(_0x10cbc1,_0x167f2d){return client['request'](_0x11eefa,_0x26b4cb)['then'](function(_0x5d1c1e){logger[_0xb6f7('0xb')](_0xb6f7('0xc'),_0x53868c,_0xb6f7('0xd'));logger[_0xb6f7('0xe')](_0xb6f7('0xf'),_0x53868c,_0xb6f7('0xd'),JSON[_0xb6f7('0x10')](_0x5d1c1e));if(_0x5d1c1e[_0xb6f7('0x11')]){if(_0x5d1c1e[_0xb6f7('0x11')][_0xb6f7('0x12')]===0x1f4){logger[_0xb6f7('0x11')](_0xb6f7('0xc'),_0x53868c,_0x5d1c1e[_0xb6f7('0x11')][_0xb6f7('0x13')]);return _0x167f2d(_0x5d1c1e[_0xb6f7('0x11')][_0xb6f7('0x13')]);}logger[_0xb6f7('0x11')](_0xb6f7('0xc'),_0x53868c,_0x5d1c1e[_0xb6f7('0x11')][_0xb6f7('0x13')]);return _0x10cbc1(_0x5d1c1e[_0xb6f7('0x11')][_0xb6f7('0x13')]);}else{logger[_0xb6f7('0xb')](_0xb6f7('0xc'),_0x53868c,'request\x20sent');_0x10cbc1(_0x5d1c1e[_0xb6f7('0x14')][_0xb6f7('0x13')]);}})[_0xb6f7('0x15')](function(_0x2bb47a){logger['error'](_0xb6f7('0xc'),_0x53868c,_0x2bb47a);_0x167f2d(_0x2bb47a);});});} \ No newline at end of file +var _0xcf70=['error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','code'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xcf70,0x94));var _0x0cf7=function(_0x4cfa93,_0x105f7a){_0x4cfa93=_0x4cfa93-0x0;var _0x3f707e=_0xcf70[_0x4cfa93];return _0x3f707e;};'use strict';var _=require(_0x0cf7('0x0'));var util=require(_0x0cf7('0x1'));var moment=require(_0x0cf7('0x2'));var BPromise=require(_0x0cf7('0x3'));var rs=require(_0x0cf7('0x4'));var fs=require('fs');var Redis=require(_0x0cf7('0x5'));var db=require(_0x0cf7('0x6'))['db'];var utils=require(_0x0cf7('0x7'));var logger=require(_0x0cf7('0x8'))(_0x0cf7('0x9'));var config=require('../../config/environment');var jayson=require(_0x0cf7('0xa'));var client=jayson['client'][_0x0cf7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x28aac7,_0x59758a,_0x6f757f){return new BPromise(function(_0x352126,_0x39e5c8){return client[_0x0cf7('0xc')](_0x28aac7,_0x6f757f)[_0x0cf7('0xd')](function(_0x5192f8){logger[_0x0cf7('0xe')](_0x0cf7('0xf'),_0x59758a,_0x0cf7('0x10'));logger[_0x0cf7('0x11')](_0x0cf7('0x12'),_0x59758a,_0x0cf7('0x10'),JSON['stringify'](_0x5192f8));if(_0x5192f8['error']){if(_0x5192f8['error'][_0x0cf7('0x13')]===0x1f4){logger[_0x0cf7('0x14')](_0x0cf7('0xf'),_0x59758a,_0x5192f8[_0x0cf7('0x14')][_0x0cf7('0x15')]);return _0x39e5c8(_0x5192f8[_0x0cf7('0x14')]['message']);}logger['error'](_0x0cf7('0xf'),_0x59758a,_0x5192f8[_0x0cf7('0x14')]['message']);return _0x352126(_0x5192f8[_0x0cf7('0x14')][_0x0cf7('0x15')]);}else{logger['info'](_0x0cf7('0xf'),_0x59758a,'request\x20sent');_0x352126(_0x5192f8[_0x0cf7('0x16')][_0x0cf7('0x15')]);}})[_0x0cf7('0x17')](function(_0x4c5bca){logger[_0x0cf7('0x14')](_0x0cf7('0xf'),_0x59758a,_0x4c5bca);_0x39e5c8(_0x4c5bca);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index e73f0a1..ebd085f 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 _0xc846=['/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','get','isAuthenticated','/describe'];(function(_0xa6cb09,_0x39410f){var _0x12b437=function(_0x1813cc){while(--_0x1813cc){_0xa6cb09['push'](_0xa6cb09['shift']());}};_0x12b437(++_0x39410f);}(_0xc846,0x195));var _0x6c84=function(_0x31a78b,_0x52766e){_0x31a78b=_0x31a78b-0x0;var _0x362371=_0xc846[_0x31a78b];return _0x362371;};'use strict';var multer=require(_0x6c84('0x0'));var util=require(_0x6c84('0x1'));var path=require(_0x6c84('0x2'));var timeout=require(_0x6c84('0x3'));var express=require(_0x6c84('0x4'));var router=express[_0x6c84('0x5')]();var fs_extra=require(_0x6c84('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x6c84('0x7'));var config=require(_0x6c84('0x8'));var controller=require(_0x6c84('0x9'));router[_0x6c84('0xa')]('/',auth[_0x6c84('0xb')](),controller['index']);router[_0x6c84('0xa')](_0x6c84('0xc'),auth[_0x6c84('0xb')](),controller['describe']);router[_0x6c84('0xa')](_0x6c84('0xd'),auth['isAuthenticated'](),controller[_0x6c84('0xe')]);router[_0x6c84('0xf')]('/',auth[_0x6c84('0xb')](),controller[_0x6c84('0x10')]);router[_0x6c84('0x11')]('/:id',auth[_0x6c84('0xb')](),controller[_0x6c84('0x12')]);router[_0x6c84('0x13')](_0x6c84('0xd'),auth[_0x6c84('0xb')](),controller[_0x6c84('0x14')]);module[_0x6c84('0x15')]=router; \ No newline at end of file +var _0x7270=['./chatOfflineMessage.controller','get','index','/describe','isAuthenticated','describe','/:id','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x5c3a55,_0x52a103){var _0x5814c4=function(_0x3625ec){while(--_0x3625ec){_0x5c3a55['push'](_0x5c3a55['shift']());}};_0x5814c4(++_0x52a103);}(_0x7270,0x12b));var _0x0727=function(_0x21d532,_0x4552a4){_0x21d532=_0x21d532-0x0;var _0x37bda1=_0x7270[_0x21d532];return _0x37bda1;};'use strict';var multer=require('multer');var util=require(_0x0727('0x0'));var path=require(_0x0727('0x1'));var timeout=require(_0x0727('0x2'));var express=require(_0x0727('0x3'));var router=express[_0x0727('0x4')]();var fs_extra=require(_0x0727('0x5'));var auth=require(_0x0727('0x6'));var interaction=require(_0x0727('0x7'));var config=require(_0x0727('0x8'));var controller=require(_0x0727('0x9'));router[_0x0727('0xa')]('/',auth['isAuthenticated'](),controller[_0x0727('0xb')]);router[_0x0727('0xa')](_0x0727('0xc'),auth[_0x0727('0xd')](),controller[_0x0727('0xe')]);router[_0x0727('0xa')](_0x0727('0xf'),auth[_0x0727('0xd')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x0727('0x10')]);router[_0x0727('0x11')](_0x0727('0xf'),auth['isAuthenticated'](),controller[_0x0727('0x12')]);router[_0x0727('0x13')]('/:id',auth[_0x0727('0xd')](),controller[_0x0727('0x14')]);module[_0x0727('0x15')]=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index 22e4dbe..5dd34e5 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 _0xfcc3=['mouseOver','timeout','INTEGER','sequelize','exports','STRING','ENUM'];(function(_0x164eca,_0x555e28){var _0x2ce562=function(_0x148ca6){while(--_0x148ca6){_0x164eca['push'](_0x164eca['shift']());}};_0x2ce562(++_0x555e28);}(_0xfcc3,0x73));var _0x3fcc=function(_0x4e43b6,_0x2ba8e7){_0x4e43b6=_0x4e43b6-0x0;var _0x3a1685=_0xfcc3[_0x4e43b6];return _0x3a1685;};'use strict';var Sequelize=require(_0x3fcc('0x0'));module[_0x3fcc('0x1')]={'name':{'type':Sequelize[_0x3fcc('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x3fcc('0x3')](_0x3fcc('0x4'),_0x3fcc('0x5')),'defaultValue':_0x3fcc('0x4')},'selector':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x3fcc('0x6')]}}; \ No newline at end of file +var _0x7e92=['INTEGER','exports','ENUM','mouseOver','timeout','STRING'];(function(_0x361d3f,_0x3be2aa){var _0x320229=function(_0x138319){while(--_0x138319){_0x361d3f['push'](_0x361d3f['shift']());}};_0x320229(++_0x3be2aa);}(_0x7e92,0x6d));var _0x27e9=function(_0x54cc03,_0x4053e2){_0x54cc03=_0x54cc03-0x0;var _0x32c796=_0x7e92[_0x54cc03];return _0x32c796;};'use strict';var Sequelize=require('sequelize');module[_0x27e9('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x27e9('0x1')](_0x27e9('0x2'),_0x27e9('0x3')),'defaultValue':_0x27e9('0x2')},'selector':{'type':Sequelize[_0x27e9('0x4')]},'timeout':{'type':Sequelize[_0x27e9('0x5')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index cc12a37..b805bb3 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 _0x2171=['querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','offset','limit','undefined','count','set','json','apply','reject','save','then','destroy','stack','name','send','show','params','model','rawAttributes','query','keys','intersection','fields','attributes','includeAll','merge','options','ChatProactiveAction','find','catch','create','body','rimraf','zip-dir','fast-json-patch','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js'];(function(_0x6fbed6,_0x5ca171){var _0x43529c=function(_0x2697ea){while(--_0x2697ea){_0x6fbed6['push'](_0x6fbed6['shift']());}};_0x43529c(++_0x5ca171);}(_0x2171,0x143));var _0x1217=function(_0x36d8c3,_0x20438f){_0x36d8c3=_0x36d8c3-0x0;var _0x31dc68=_0x2171[_0x36d8c3];return _0x31dc68;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1217('0x0'));var zipdir=require(_0x1217('0x1'));var jsonpatch=require(_0x1217('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x1217('0x3'));var Mustache=require('mustache');var util=require(_0x1217('0x4'));var path=require(_0x1217('0x5'));var sox=require(_0x1217('0x6'));var csv=require(_0x1217('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1217('0x8'));var _=require(_0x1217('0x9'));var squel=require(_0x1217('0xa'));var crypto=require('crypto');var jsforce=require(_0x1217('0xb'));var deskjs=require(_0x1217('0xc'));var toCsv=require(_0x1217('0x7'));var querystring=require(_0x1217('0xd'));var Papa=require(_0x1217('0xe'));var Redis=require(_0x1217('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x1217('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1217('0x11'));var logger=require(_0x1217('0x12'))(_0x1217('0x13'));var utils=require(_0x1217('0x14'));var config=require(_0x1217('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x1217('0x16'))['db'];function respondWithStatusCode(_0x358007,_0x1e34e9){_0x1e34e9=_0x1e34e9||0xcc;return function(_0x107d99){if(_0x107d99){return _0x358007[_0x1217('0x17')](_0x1e34e9);}return _0x358007['status'](_0x1e34e9)['end']();};}function respondWithResult(_0xb06ed5,_0x5d8f22){_0x5d8f22=_0x5d8f22||0xc8;return function(_0x4aa848){if(_0x4aa848){return _0xb06ed5[_0x1217('0x18')](_0x5d8f22)['json'](_0x4aa848);}};}function respondWithFilteredResult(_0x4ef9be,_0x2300f0){return function(_0x24a3f3){if(_0x24a3f3){var _0x417cfe=typeof _0x2300f0[_0x1217('0x19')]==='undefined'&&typeof _0x2300f0[_0x1217('0x1a')]===_0x1217('0x1b');var _0x41c34f=_0x24a3f3[_0x1217('0x1c')];var _0x512159=_0x417cfe?0x0:_0x2300f0[_0x1217('0x19')];var _0x24033f=_0x417cfe?_0x24a3f3[_0x1217('0x1c')]:_0x2300f0[_0x1217('0x19')]+_0x2300f0[_0x1217('0x1a')];var _0x20ccb9;if(_0x24033f>=_0x41c34f){_0x24033f=_0x41c34f;_0x20ccb9=0xc8;}else{_0x20ccb9=0xce;}_0x4ef9be[_0x1217('0x18')](_0x20ccb9);return _0x4ef9be[_0x1217('0x1d')]('Content-Range',_0x512159+'-'+_0x24033f+'/'+_0x41c34f)[_0x1217('0x1e')](_0x24a3f3);}return null;};}function patchUpdates(_0x49382b){return function(_0x3bb618){try{jsonpatch[_0x1217('0x1f')](_0x3bb618,_0x49382b,!![]);}catch(_0x5f018c){return BPromise[_0x1217('0x20')](_0x5f018c);}return _0x3bb618[_0x1217('0x21')]();};}function saveUpdates(_0x4ea5e6,_0xb4e4ea){return function(_0x2c625b){if(_0x2c625b){return _0x2c625b['update'](_0x4ea5e6)[_0x1217('0x22')](function(_0x11f512){return _0x11f512;});}return null;};}function removeEntity(_0x1516e8,_0x5b9b7a){return function(_0x4a9c32){if(_0x4a9c32){return _0x4a9c32[_0x1217('0x23')]()[_0x1217('0x22')](function(){_0x1516e8[_0x1217('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x463c66,_0x8bd9d9){return function(_0x1bde0b){if(!_0x1bde0b){_0x463c66[_0x1217('0x17')](0x194);}return _0x1bde0b;};}function handleError(_0x465209,_0x446dc3){_0x446dc3=_0x446dc3||0x1f4;return function(_0x518a0a){logger['error'](_0x518a0a[_0x1217('0x24')]);if(_0x518a0a[_0x1217('0x25')]){delete _0x518a0a['name'];}_0x465209[_0x1217('0x18')](_0x446dc3)[_0x1217('0x26')](_0x518a0a);};}exports[_0x1217('0x27')]=function(_0x21392c,_0x2f5387){var _0x5eb398={'raw':!![],'where':{'id':_0x21392c[_0x1217('0x28')]['id']}},_0xdb98d5={};_0xdb98d5[_0x1217('0x29')]=_['keys'](db['ChatProactiveAction'][_0x1217('0x2a')]);_0xdb98d5[_0x1217('0x2b')]=_[_0x1217('0x2c')](_0x21392c['query']);_0xdb98d5['filters']=_[_0x1217('0x2d')](_0xdb98d5[_0x1217('0x29')],_0xdb98d5[_0x1217('0x2b')]);_0x5eb398['attributes']=_['intersection'](_0xdb98d5[_0x1217('0x29')],qs[_0x1217('0x2e')](_0x21392c[_0x1217('0x2b')][_0x1217('0x2e')]));_0x5eb398[_0x1217('0x2f')]=_0x5eb398['attributes']['length']?_0x5eb398['attributes']:_0xdb98d5['model'];if(_0x21392c[_0x1217('0x2b')][_0x1217('0x30')]){_0x5eb398['include']=[{'all':!![]}];}_0x5eb398=_[_0x1217('0x31')]({},_0x5eb398,_0x21392c[_0x1217('0x32')]);return db[_0x1217('0x33')][_0x1217('0x34')](_0x5eb398)[_0x1217('0x22')](handleEntityNotFound(_0x2f5387,null))[_0x1217('0x22')](respondWithResult(_0x2f5387,null))[_0x1217('0x35')](handleError(_0x2f5387,null));};exports[_0x1217('0x36')]=function(_0x2d6653,_0x445bd2){return db[_0x1217('0x33')][_0x1217('0x36')](_0x2d6653[_0x1217('0x37')],{})[_0x1217('0x22')](respondWithResult(_0x445bd2,0xc9))[_0x1217('0x35')](handleError(_0x445bd2,null));};exports['update']=function(_0xc189a6,_0x3ac293){if(_0xc189a6[_0x1217('0x37')]['id']){delete _0xc189a6['body']['id'];}return db[_0x1217('0x33')]['find']({'where':{'id':_0xc189a6[_0x1217('0x28')]['id']}})['then'](handleEntityNotFound(_0x3ac293,null))[_0x1217('0x22')](saveUpdates(_0xc189a6[_0x1217('0x37')],null))[_0x1217('0x22')](respondWithResult(_0x3ac293,null))[_0x1217('0x35')](handleError(_0x3ac293,null));};exports['destroy']=function(_0xc699b3,_0x437f54){return db[_0x1217('0x33')]['find']({'where':{'id':_0xc699b3[_0x1217('0x28')]['id']}})['then'](handleEntityNotFound(_0x437f54,null))[_0x1217('0x22')](removeEntity(_0x437f54,null))[_0x1217('0x35')](handleError(_0x437f54,null));}; \ No newline at end of file +var _0x9589=['rimraf','zip-dir','fast-json-patch','request-promise','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','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','count','offset','limit','set','apply','reject','save','update','then','destroy','error','name','show','model','keys','ChatProactiveAction','rawAttributes','query','intersection','attributes','fields','length','includeAll','include','merge','find','catch','create','body','eml-format'];(function(_0x452ef4,_0x156975){var _0xaa07b2=function(_0x53a764){while(--_0x53a764){_0x452ef4['push'](_0x452ef4['shift']());}};_0xaa07b2(++_0x156975);}(_0x9589,0xbc));var _0x9958=function(_0x323a4d,_0x24111f){_0x323a4d=_0x323a4d-0x0;var _0x451ab7=_0x9589[_0x323a4d];return _0x451ab7;};'use strict';var emlformat=require(_0x9958('0x0'));var rimraf=require(_0x9958('0x1'));var zipdir=require(_0x9958('0x2'));var jsonpatch=require(_0x9958('0x3'));var rp=require(_0x9958('0x4'));var moment=require('moment');var BPromise=require(_0x9958('0x5'));var Mustache=require(_0x9958('0x6'));var util=require(_0x9958('0x7'));var path=require('path');var sox=require(_0x9958('0x8'));var csv=require(_0x9958('0x9'));var ejs=require(_0x9958('0xa'));var fs=require('fs');var fs_extra=require(_0x9958('0xb'));var _=require(_0x9958('0xc'));var squel=require(_0x9958('0xd'));var crypto=require('crypto');var jsforce=require(_0x9958('0xe'));var deskjs=require(_0x9958('0xf'));var toCsv=require(_0x9958('0x9'));var querystring=require(_0x9958('0x10'));var Papa=require(_0x9958('0x11'));var Redis=require(_0x9958('0x12'));var authService=require(_0x9958('0x13'));var qs=require(_0x9958('0x14'));var as=require(_0x9958('0x15'));var hardwareService=require(_0x9958('0x16'));var logger=require(_0x9958('0x17'))(_0x9958('0x18'));var utils=require(_0x9958('0x19'));var config=require(_0x9958('0x1a'));var licenseUtil=require(_0x9958('0x1b'));var db=require(_0x9958('0x1c'))['db'];function respondWithStatusCode(_0x3649c0,_0x344d42){_0x344d42=_0x344d42||0xcc;return function(_0x5b650f){if(_0x5b650f){return _0x3649c0[_0x9958('0x1d')](_0x344d42);}return _0x3649c0['status'](_0x344d42)[_0x9958('0x1e')]();};}function respondWithResult(_0x5c903e,_0xe749a1){_0xe749a1=_0xe749a1||0xc8;return function(_0x3d34bc){if(_0x3d34bc){return _0x5c903e[_0x9958('0x1f')](_0xe749a1)[_0x9958('0x20')](_0x3d34bc);}};}function respondWithFilteredResult(_0x48c079,_0xe3e42d){return function(_0x234b39){if(_0x234b39){var _0x5caedb=typeof _0xe3e42d['offset']===_0x9958('0x21')&&typeof _0xe3e42d['limit']===_0x9958('0x21');var _0x124929=_0x234b39[_0x9958('0x22')];var _0x33b903=_0x5caedb?0x0:_0xe3e42d[_0x9958('0x23')];var _0x3d6cb2=_0x5caedb?_0x234b39['count']:_0xe3e42d['offset']+_0xe3e42d[_0x9958('0x24')];var _0x4b7404;if(_0x3d6cb2>=_0x124929){_0x3d6cb2=_0x124929;_0x4b7404=0xc8;}else{_0x4b7404=0xce;}_0x48c079['status'](_0x4b7404);return _0x48c079[_0x9958('0x25')]('Content-Range',_0x33b903+'-'+_0x3d6cb2+'/'+_0x124929)['json'](_0x234b39);}return null;};}function patchUpdates(_0x4278da){return function(_0x36affc){try{jsonpatch[_0x9958('0x26')](_0x36affc,_0x4278da,!![]);}catch(_0x4c8fd2){return BPromise[_0x9958('0x27')](_0x4c8fd2);}return _0x36affc[_0x9958('0x28')]();};}function saveUpdates(_0xb6be59,_0x31130c){return function(_0x65d7e1){if(_0x65d7e1){return _0x65d7e1[_0x9958('0x29')](_0xb6be59)[_0x9958('0x2a')](function(_0x9b6fc2){return _0x9b6fc2;});}return null;};}function removeEntity(_0x1a5dde,_0x2aabad){return function(_0x3bb58a){if(_0x3bb58a){return _0x3bb58a[_0x9958('0x2b')]()[_0x9958('0x2a')](function(){_0x1a5dde['status'](0xcc)[_0x9958('0x1e')]();});}};}function handleEntityNotFound(_0x25993b,_0x3257f5){return function(_0x4a3f5f){if(!_0x4a3f5f){_0x25993b[_0x9958('0x1d')](0x194);}return _0x4a3f5f;};}function handleError(_0x18f7bd,_0x1194ce){_0x1194ce=_0x1194ce||0x1f4;return function(_0x22bdfc){logger[_0x9958('0x2c')](_0x22bdfc['stack']);if(_0x22bdfc[_0x9958('0x2d')]){delete _0x22bdfc[_0x9958('0x2d')];}_0x18f7bd[_0x9958('0x1f')](_0x1194ce)['send'](_0x22bdfc);};}exports[_0x9958('0x2e')]=function(_0x6c701a,_0x398097){var _0x386535={'raw':!![],'where':{'id':_0x6c701a['params']['id']}},_0x8f4016={};_0x8f4016[_0x9958('0x2f')]=_[_0x9958('0x30')](db[_0x9958('0x31')][_0x9958('0x32')]);_0x8f4016[_0x9958('0x33')]=_['keys'](_0x6c701a[_0x9958('0x33')]);_0x8f4016['filters']=_[_0x9958('0x34')](_0x8f4016[_0x9958('0x2f')],_0x8f4016['query']);_0x386535[_0x9958('0x35')]=_[_0x9958('0x34')](_0x8f4016[_0x9958('0x2f')],qs[_0x9958('0x36')](_0x6c701a[_0x9958('0x33')][_0x9958('0x36')]));_0x386535[_0x9958('0x35')]=_0x386535[_0x9958('0x35')][_0x9958('0x37')]?_0x386535['attributes']:_0x8f4016[_0x9958('0x2f')];if(_0x6c701a['query'][_0x9958('0x38')]){_0x386535[_0x9958('0x39')]=[{'all':!![]}];}_0x386535=_[_0x9958('0x3a')]({},_0x386535,_0x6c701a['options']);return db[_0x9958('0x31')][_0x9958('0x3b')](_0x386535)['then'](handleEntityNotFound(_0x398097,null))['then'](respondWithResult(_0x398097,null))[_0x9958('0x3c')](handleError(_0x398097,null));};exports[_0x9958('0x3d')]=function(_0x505466,_0x3e3d7a){return db[_0x9958('0x31')][_0x9958('0x3d')](_0x505466[_0x9958('0x3e')],{})[_0x9958('0x2a')](respondWithResult(_0x3e3d7a,0xc9))[_0x9958('0x3c')](handleError(_0x3e3d7a,null));};exports['update']=function(_0x239270,_0xcd392){if(_0x239270[_0x9958('0x3e')]['id']){delete _0x239270[_0x9958('0x3e')]['id'];}return db[_0x9958('0x31')]['find']({'where':{'id':_0x239270['params']['id']}})['then'](handleEntityNotFound(_0xcd392,null))['then'](saveUpdates(_0x239270['body'],null))[_0x9958('0x2a')](respondWithResult(_0xcd392,null))[_0x9958('0x3c')](handleError(_0xcd392,null));};exports[_0x9958('0x2b')]=function(_0x3967b2,_0x3b0b39){return db[_0x9958('0x31')][_0x9958('0x3b')]({'where':{'id':_0x3967b2['params']['id']}})[_0x9958('0x2a')](handleEntityNotFound(_0x3b0b39,null))[_0x9958('0x2a')](removeEntity(_0x3b0b39,null))[_0x9958('0x3c')](handleError(_0x3b0b39,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index 8e2f5a8..2011863 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 _0xbb5c=['./chatProactiveAction.attributes','exports','define','ChatProactiveAction','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x598a96,_0x70ff4c){var _0x72872f=function(_0x4efda3){while(--_0x4efda3){_0x598a96['push'](_0x598a96['shift']());}};_0x72872f(++_0x70ff4c);}(_0xbb5c,0x1a8));var _0xcbb5=function(_0x4af59b,_0x107ee8){_0x4af59b=_0x4af59b-0x0;var _0x16da66=_0xbb5c[_0x4af59b];return _0x16da66;};'use strict';var _=require(_0xcbb5('0x0'));var util=require(_0xcbb5('0x1'));var logger=require(_0xcbb5('0x2'))('api');var moment=require('moment');var BPromise=require(_0xcbb5('0x3'));var rp=require(_0xcbb5('0x4'));var fs=require('fs');var path=require(_0xcbb5('0x5'));var rimraf=require(_0xcbb5('0x6'));var config=require(_0xcbb5('0x7'));var attributes=require(_0xcbb5('0x8'));module[_0xcbb5('0x9')]=function(_0xeacf69,_0x1300b1){return _0xeacf69[_0xcbb5('0xa')](_0xcbb5('0xb'),attributes,{'tableName':'chat_proactive_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x71e2=['api','moment','bluebird','path','rimraf','../../config/environment','./chatProactiveAction.attributes','exports','define','ChatProactiveAction','chat_proactive_actions','lodash','util'];(function(_0x510c1b,_0x178e2d){var _0x183aa9=function(_0x162678){while(--_0x162678){_0x510c1b['push'](_0x510c1b['shift']());}};_0x183aa9(++_0x178e2d);}(_0x71e2,0x66));var _0x271e=function(_0x430e58,_0x63cbae){_0x430e58=_0x430e58-0x0;var _0x435f44=_0x71e2[_0x430e58];return _0x435f44;};'use strict';var _=require(_0x271e('0x0'));var util=require(_0x271e('0x1'));var logger=require('../../config/logger')(_0x271e('0x2'));var moment=require(_0x271e('0x3'));var BPromise=require(_0x271e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x271e('0x5'));var rimraf=require(_0x271e('0x6'));var config=require(_0x271e('0x7'));var attributes=require(_0x271e('0x8'));module[_0x271e('0x9')]=function(_0x28c21f,_0x3decff){return _0x28c21f[_0x271e('0xa')](_0x271e('0xb'),attributes,{'tableName':_0x271e('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 bc05298..eec5588 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 _0x360c=['then','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','util','moment','randomstring','ioredis','../../config/logger','jayson/promise','http','request'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x360c,0x129));var _0xc360=function(_0x2bfda8,_0x133154){_0x2bfda8=_0x2bfda8-0x0;var _0x2ab9c6=_0x360c[_0x2bfda8];return _0x2ab9c6;};'use strict';var _=require(_0xc360('0x0'));var util=require(_0xc360('0x1'));var moment=require(_0xc360('0x2'));var BPromise=require('bluebird');var rs=require(_0xc360('0x3'));var fs=require('fs');var Redis=require(_0xc360('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xc360('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xc360('0x6'));var client=jayson['client'][_0xc360('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x333c67,_0x5a5595,_0x2ebff3){return new BPromise(function(_0x113e89,_0x444cdd){return client[_0xc360('0x8')](_0x333c67,_0x2ebff3)[_0xc360('0x9')](function(_0x23185b){logger['info'](_0xc360('0xa'),_0x5a5595,_0xc360('0xb'));logger[_0xc360('0xc')]('ChatProactiveAction,\x20%s,\x20%s,\x20%s',_0x5a5595,_0xc360('0xb'),JSON[_0xc360('0xd')](_0x23185b));if(_0x23185b[_0xc360('0xe')]){if(_0x23185b[_0xc360('0xe')][_0xc360('0xf')]===0x1f4){logger[_0xc360('0xe')]('ChatProactiveAction,\x20%s,\x20%s',_0x5a5595,_0x23185b[_0xc360('0xe')][_0xc360('0x10')]);return _0x444cdd(_0x23185b[_0xc360('0xe')][_0xc360('0x10')]);}logger[_0xc360('0xe')](_0xc360('0xa'),_0x5a5595,_0x23185b[_0xc360('0xe')][_0xc360('0x10')]);return _0x113e89(_0x23185b['error']['message']);}else{logger['info']('ChatProactiveAction,\x20%s,\x20%s',_0x5a5595,_0xc360('0xb'));_0x113e89(_0x23185b['result']['message']);}})[_0xc360('0x11')](function(_0x5bf545){logger[_0xc360('0xe')]('ChatProactiveAction,\x20%s,\x20%s',_0x5a5595,_0x5bf545);_0x444cdd(_0x5bf545);});});} \ No newline at end of file +var _0x8751=['client','http','request','then','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x15d324,_0x19ef88){var _0x1083b9=function(_0x1a9ed2){while(--_0x1a9ed2){_0x15d324['push'](_0x15d324['shift']());}};_0x1083b9(++_0x19ef88);}(_0x8751,0xea));var _0x1875=function(_0x466203,_0x3751fa){_0x466203=_0x466203-0x0;var _0x1ce543=_0x8751[_0x466203];return _0x1ce543;};'use strict';var _=require(_0x1875('0x0'));var util=require('util');var moment=require(_0x1875('0x1'));var BPromise=require(_0x1875('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1875('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1875('0x4'));var logger=require(_0x1875('0x5'))(_0x1875('0x6'));var config=require('../../config/environment');var jayson=require(_0x1875('0x7'));var client=jayson[_0x1875('0x8')][_0x1875('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x449d7a,_0x15c629,_0x3976e3){return new BPromise(function(_0x2659ab,_0x2a8e44){return client[_0x1875('0xa')](_0x449d7a,_0x3976e3)[_0x1875('0xb')](function(_0xeb33ab){logger[_0x1875('0xc')](_0x1875('0xd'),_0x15c629,_0x1875('0xe'));logger[_0x1875('0xf')](_0x1875('0x10'),_0x15c629,_0x1875('0xe'),JSON[_0x1875('0x11')](_0xeb33ab));if(_0xeb33ab[_0x1875('0x12')]){if(_0xeb33ab[_0x1875('0x12')][_0x1875('0x13')]===0x1f4){logger[_0x1875('0x12')]('ChatProactiveAction,\x20%s,\x20%s',_0x15c629,_0xeb33ab[_0x1875('0x12')][_0x1875('0x14')]);return _0x2a8e44(_0xeb33ab[_0x1875('0x12')][_0x1875('0x14')]);}logger['error'](_0x1875('0xd'),_0x15c629,_0xeb33ab[_0x1875('0x12')][_0x1875('0x14')]);return _0x2659ab(_0xeb33ab['error'][_0x1875('0x14')]);}else{logger[_0x1875('0xc')](_0x1875('0xd'),_0x15c629,_0x1875('0xe'));_0x2659ab(_0xeb33ab[_0x1875('0x15')][_0x1875('0x14')]);}})['catch'](function(_0x1a37db){logger[_0x1875('0x12')](_0x1875('0xd'),_0x15c629,_0x1a37db);_0x2a8e44(_0x1a37db);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index 8ea97bf..c6151c6 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 _0xf2ca=['show','create','update','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated'];(function(_0x55e476,_0x5c8a6e){var _0x416fb5=function(_0x50b49e){while(--_0x50b49e){_0x55e476['push'](_0x55e476['shift']());}};_0x416fb5(++_0x5c8a6e);}(_0xf2ca,0x16a));var _0xaf2c=function(_0x2b9b7f,_0x4d47df){_0x2b9b7f=_0x2b9b7f-0x0;var _0x4ed19a=_0xf2ca[_0x2b9b7f];return _0x4ed19a;};'use strict';var multer=require(_0xaf2c('0x0'));var util=require(_0xaf2c('0x1'));var path=require(_0xaf2c('0x2'));var timeout=require('connect-timeout');var express=require(_0xaf2c('0x3'));var router=express[_0xaf2c('0x4')]();var fs_extra=require(_0xaf2c('0x5'));var auth=require(_0xaf2c('0x6'));var interaction=require(_0xaf2c('0x7'));var config=require(_0xaf2c('0x8'));var controller=require('./chatProactiveAction.controller');router[_0xaf2c('0x9')](_0xaf2c('0xa'),auth[_0xaf2c('0xb')](),controller[_0xaf2c('0xc')]);router['post']('/',auth[_0xaf2c('0xb')](),controller[_0xaf2c('0xd')]);router['put'](_0xaf2c('0xa'),auth['isAuthenticated'](),controller[_0xaf2c('0xe')]);router['delete'](_0xaf2c('0xa'),auth[_0xaf2c('0xb')](),controller[_0xaf2c('0xf')]);module[_0xaf2c('0x10')]=router; \ No newline at end of file +var _0x7c09=['delete','/:id','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','show','post','isAuthenticated','create','put'];(function(_0x219d87,_0x1cb6f7){var _0x22823d=function(_0x5357bf){while(--_0x5357bf){_0x219d87['push'](_0x219d87['shift']());}};_0x22823d(++_0x1cb6f7);}(_0x7c09,0x102));var _0x97c0=function(_0x588e12,_0x477f7e){_0x588e12=_0x588e12-0x0;var _0x3a553e=_0x7c09[_0x588e12];return _0x3a553e;};'use strict';var multer=require('multer');var util=require(_0x97c0('0x0'));var path=require(_0x97c0('0x1'));var timeout=require('connect-timeout');var express=require(_0x97c0('0x2'));var router=express[_0x97c0('0x3')]();var fs_extra=require(_0x97c0('0x4'));var auth=require(_0x97c0('0x5'));var interaction=require(_0x97c0('0x6'));var config=require(_0x97c0('0x7'));var controller=require(_0x97c0('0x8'));router['get']('/:id',auth['isAuthenticated'](),controller[_0x97c0('0x9')]);router[_0x97c0('0xa')]('/',auth[_0x97c0('0xb')](),controller[_0x97c0('0xc')]);router[_0x97c0('0xd')]('/:id',auth[_0x97c0('0xb')](),controller['update']);router[_0x97c0('0xe')](_0x97c0('0xf'),auth['isAuthenticated'](),controller['destroy']);module[_0x97c0('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 6e4aa64..688805b 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 _0xa337=['roundrobin','sequelize','exports','STRING','name','INTEGER','ENUM','rrmemory','beepall'];(function(_0x1f058e,_0x53d9a4){var _0x5f3ba9=function(_0x22180){while(--_0x22180){_0x1f058e['push'](_0x1f058e['shift']());}};_0x5f3ba9(++_0x53d9a4);}(_0xa337,0xac));var _0x7a33=function(_0x4d794e,_0x240779){_0x4d794e=_0x4d794e-0x0;var _0x43b625=_0xa337[_0x4d794e];return _0x43b625;};'use strict';var Sequelize=require(_0x7a33('0x0'));module[_0x7a33('0x1')]={'name':{'type':Sequelize[_0x7a33('0x2')],'unique':_0x7a33('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x7a33('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x7a33('0x5')](_0x7a33('0x6'),_0x7a33('0x7'),_0x7a33('0x8'))}}; \ No newline at end of file +var _0x35b6=['rrmemory','beepall','roundrobin','sequelize','exports','name','INTEGER','ENUM'];(function(_0x80d530,_0x5675f6){var _0x1efb5f=function(_0x37b4b1){while(--_0x37b4b1){_0x80d530['push'](_0x80d530['shift']());}};_0x1efb5f(++_0x5675f6);}(_0x35b6,0x113));var _0x635b=function(_0x1bd8db,_0x11755d){_0x1bd8db=_0x1bd8db-0x0;var _0x2a7fda=_0x35b6[_0x1bd8db];return _0x2a7fda;};'use strict';var Sequelize=require(_0x635b('0x0'));module[_0x635b('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x635b('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x635b('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x635b('0x4')](_0x635b('0x5'),_0x635b('0x6'),_0x635b('0x7'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index 7cd26b6..cc58038 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 _0x75f4=['../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./chatQueue.socket','register','jayson/promise','http','request','then','info','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','error','ChatQueue,\x20%s,\x20%s','message','result','catch','status','end','json','undefined','limit','count','offset','set','apply','reject','save','update','destroy','get','UserProfileResource','sendStatus','name','send','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','ChatQueue','includeAll','findAll','rows','show','params','keys','include','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ChatQueues','UserProfileSection','userProfileId','autoAssociation','body','describe','getMembers','findOne','UserChatQueue','fields','ChatQueueId','agent','chatPause','updatedAt','format','%s/%s','createdAt','Team','getTeams','ids','User','Agents','online','voicePause','interface','flatMap','sequelize','transaction','addTeams','each','findOrCreate','userChatQueue:save','removeTeams','field','team_has_chat_queues','join','user_has_teams','ChatQueueId\x20=\x20?','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','includes','all','union','compact','value','removeAgents','forEach','userChatQueue:remove','addAgents','omit','spread','emit','isArray','getAgents','eml-format','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x2fb932,_0x2b0044){var _0x438dd4=function(_0x2c7ec2){while(--_0x2c7ec2){_0x2fb932['push'](_0x2fb932['shift']());}};_0x438dd4(++_0x2b0044);}(_0x75f4,0x81));var _0x475f=function(_0x4f35f4,_0x51a8c3){_0x4f35f4=_0x4f35f4-0x0;var _0x2e9a70=_0x75f4[_0x4f35f4];return _0x2e9a70;};'use strict';var emlformat=require(_0x475f('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x475f('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x475f('0x2'));var Mustache=require(_0x475f('0x3'));var util=require(_0x475f('0x4'));var path=require(_0x475f('0x5'));var sox=require(_0x475f('0x6'));var csv=require(_0x475f('0x7'));var ejs=require(_0x475f('0x8'));var fs=require('fs');var fs_extra=require(_0x475f('0x9'));var _=require(_0x475f('0xa'));var squel=require(_0x475f('0xb'));var crypto=require(_0x475f('0xc'));var jsforce=require(_0x475f('0xd'));var deskjs=require(_0x475f('0xe'));var toCsv=require(_0x475f('0x7'));var querystring=require(_0x475f('0xf'));var Papa=require(_0x475f('0x10'));var Redis=require('ioredis');var authService=require(_0x475f('0x11'));var qs=require(_0x475f('0x12'));var as=require(_0x475f('0x13'));var hardwareService=require(_0x475f('0x14'));var logger=require(_0x475f('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x475f('0x16'));var licenseUtil=require(_0x475f('0x17'));var db=require(_0x475f('0x18'))['db'];config[_0x475f('0x19')]=_[_0x475f('0x1a')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x475f('0x1b'))(new Redis(config[_0x475f('0x19')]));require(_0x475f('0x1c'))[_0x475f('0x1d')](socket);var jayson=require(_0x475f('0x1e'));var client=jayson['client'][_0x475f('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x48570f,_0x1f32cb,_0x138261,_0xf5ac48){return new BPromise(function(_0x1289a5,_0x18b82f){var _0x535abb=_0xf5ac48||client;return _0x535abb[_0x475f('0x20')](_0x48570f,_0x138261)[_0x475f('0x21')](function(_0x37c20c){logger[_0x475f('0x22')]('ChatQueue,\x20%s,\x20%s',_0x1f32cb,_0x475f('0x23'));logger[_0x475f('0x24')](_0x475f('0x25'),_0x1f32cb,'request\x20sent',JSON['stringify'](_0x37c20c));if(_0x37c20c[_0x475f('0x26')]){if(_0x37c20c[_0x475f('0x26')]['code']===0x1f4){logger[_0x475f('0x26')](_0x475f('0x27'),_0x1f32cb,_0x37c20c[_0x475f('0x26')][_0x475f('0x28')]);return _0x18b82f(_0x37c20c[_0x475f('0x26')][_0x475f('0x28')]);}logger['error'](_0x475f('0x27'),_0x1f32cb,_0x37c20c[_0x475f('0x26')]['message']);return _0x1289a5(_0x37c20c['error'][_0x475f('0x28')]);}else{logger[_0x475f('0x22')](_0x475f('0x27'),_0x1f32cb,_0x475f('0x23'));_0x1289a5(_0x37c20c[_0x475f('0x29')][_0x475f('0x28')]);}})[_0x475f('0x2a')](function(_0x263e01){logger['error'](_0x475f('0x27'),_0x1f32cb,_0x263e01);_0x18b82f(_0x263e01);});});}function respondWithStatusCode(_0x167d6b,_0x276fe0){_0x276fe0=_0x276fe0||0xcc;return function(_0xdcd462){if(_0xdcd462){return _0x167d6b['sendStatus'](_0x276fe0);}return _0x167d6b[_0x475f('0x2b')](_0x276fe0)[_0x475f('0x2c')]();};}function respondWithResult(_0x43a534,_0x205d90){_0x205d90=_0x205d90||0xc8;return function(_0x232626){if(_0x232626){return _0x43a534[_0x475f('0x2b')](_0x205d90)[_0x475f('0x2d')](_0x232626);}};}function respondWithFilteredResult(_0x48ffc9,_0x2cde0e){return function(_0x48bf4f){if(_0x48bf4f){var _0x5d7ad0=typeof _0x2cde0e['offset']===_0x475f('0x2e')&&typeof _0x2cde0e[_0x475f('0x2f')]===_0x475f('0x2e');var _0x12779d=_0x48bf4f[_0x475f('0x30')];var _0x22a567=_0x5d7ad0?0x0:_0x2cde0e[_0x475f('0x31')];var _0x9230b=_0x5d7ad0?_0x48bf4f['count']:_0x2cde0e[_0x475f('0x31')]+_0x2cde0e[_0x475f('0x2f')];var _0x45ff57;if(_0x9230b>=_0x12779d){_0x9230b=_0x12779d;_0x45ff57=0xc8;}else{_0x45ff57=0xce;}_0x48ffc9['status'](_0x45ff57);return _0x48ffc9[_0x475f('0x32')]('Content-Range',_0x22a567+'-'+_0x9230b+'/'+_0x12779d)['json'](_0x48bf4f);}return null;};}function patchUpdates(_0x28a1e2){return function(_0x7366b6){try{jsonpatch[_0x475f('0x33')](_0x7366b6,_0x28a1e2,!![]);}catch(_0x1ac80b){return BPromise[_0x475f('0x34')](_0x1ac80b);}return _0x7366b6[_0x475f('0x35')]();};}function saveUpdates(_0x408279,_0x526e31){return function(_0x1cbc03){if(_0x1cbc03){return _0x1cbc03[_0x475f('0x36')](_0x408279)[_0x475f('0x21')](function(_0x22ce05){return _0x22ce05;});}return null;};}function removeEntity(_0x112a75,_0x756aaa){return function(_0x1ea052){if(_0x1ea052){return _0x1ea052[_0x475f('0x37')]()[_0x475f('0x21')](function(){var _0x1bfeaf=_0x1ea052[_0x475f('0x38')]({'plain':!![]});var _0x3a8554='ChatQueues';return db[_0x475f('0x39')][_0x475f('0x37')]({'where':{'type':_0x3a8554,'resourceId':_0x1bfeaf['id']}})[_0x475f('0x21')](function(){return _0x1ea052;});})[_0x475f('0x21')](function(){_0x112a75[_0x475f('0x2b')](0xcc)[_0x475f('0x2c')]();});}};}function handleEntityNotFound(_0x1f2d23,_0x179615){return function(_0x533c88){if(!_0x533c88){_0x1f2d23[_0x475f('0x3a')](0x194);}return _0x533c88;};}function handleError(_0x2e14f6,_0x2c44bd){_0x2c44bd=_0x2c44bd||0x1f4;return function(_0x58f2f1){logger[_0x475f('0x26')](_0x58f2f1['stack']);if(_0x58f2f1[_0x475f('0x3b')]){delete _0x58f2f1[_0x475f('0x3b')];}_0x2e14f6['status'](_0x2c44bd)[_0x475f('0x3c')](_0x58f2f1);};}exports['index']=function(_0x314825,_0x3ca500){var _0x1585d9={},_0x3acf99={},_0x4040f1={'count':0x0,'rows':[]};var _0x5100b4=_[_0x475f('0x3d')](db['ChatQueue'][_0x475f('0x3e')],function(_0x1bb18e){return{'name':_0x1bb18e[_0x475f('0x3f')],'type':_0x1bb18e[_0x475f('0x40')][_0x475f('0x41')]};});_0x3acf99[_0x475f('0x42')]=_['map'](_0x5100b4,'name');_0x3acf99[_0x475f('0x43')]=_['keys'](_0x314825[_0x475f('0x43')]);_0x3acf99[_0x475f('0x44')]=_[_0x475f('0x45')](_0x3acf99[_0x475f('0x42')],_0x3acf99[_0x475f('0x43')]);_0x1585d9[_0x475f('0x46')]=_[_0x475f('0x45')](_0x3acf99[_0x475f('0x42')],qs['fields'](_0x314825['query']['fields']));_0x1585d9[_0x475f('0x46')]=_0x1585d9[_0x475f('0x46')][_0x475f('0x47')]?_0x1585d9['attributes']:_0x3acf99[_0x475f('0x42')];if(!_0x314825['query'][_0x475f('0x48')](_0x475f('0x49'))){_0x1585d9['limit']=qs[_0x475f('0x2f')](_0x314825[_0x475f('0x43')][_0x475f('0x2f')]);_0x1585d9[_0x475f('0x31')]=qs[_0x475f('0x31')](_0x314825[_0x475f('0x43')]['offset']);}_0x1585d9[_0x475f('0x4a')]=qs[_0x475f('0x4b')](_0x314825['query'][_0x475f('0x4b')]);_0x1585d9[_0x475f('0x4c')]=qs[_0x475f('0x44')](_[_0x475f('0x4d')](_0x314825[_0x475f('0x43')],_0x3acf99[_0x475f('0x44')]),_0x5100b4);if(_0x314825[_0x475f('0x43')]['filter']){_0x1585d9[_0x475f('0x4c')]=_[_0x475f('0x4e')](_0x1585d9[_0x475f('0x4c')],{'$or':_['map'](_0x5100b4,function(_0x439e85){if(_0x439e85[_0x475f('0x40')]!=='VIRTUAL'){var _0x16ca72={};_0x16ca72[_0x439e85[_0x475f('0x3b')]]={'$like':'%'+_0x314825[_0x475f('0x43')][_0x475f('0x4f')]+'%'};return _0x16ca72;}})});}_0x1585d9=_[_0x475f('0x4e')]({},_0x1585d9,_0x314825['options']);var _0x51c62a={'where':_0x1585d9['where']};return db[_0x475f('0x50')][_0x475f('0x30')](_0x51c62a)[_0x475f('0x21')](function(_0x59894b){_0x4040f1['count']=_0x59894b;if(_0x314825[_0x475f('0x43')][_0x475f('0x51')]){_0x1585d9['include']=[{'all':!![]}];}return db[_0x475f('0x50')][_0x475f('0x52')](_0x1585d9);})[_0x475f('0x21')](function(_0x2b0ad0){_0x4040f1[_0x475f('0x53')]=_0x2b0ad0;return _0x4040f1;})['then'](respondWithFilteredResult(_0x3ca500,_0x1585d9))['catch'](handleError(_0x3ca500,null));};exports[_0x475f('0x54')]=function(_0x59c4ef,_0x13f72d){var _0x34a1a0={'raw':!![],'where':{'id':_0x59c4ef[_0x475f('0x55')]['id']}},_0x33902b={};_0x33902b['model']=_[_0x475f('0x56')](db[_0x475f('0x50')][_0x475f('0x3e')]);_0x33902b[_0x475f('0x43')]=_[_0x475f('0x56')](_0x59c4ef['query']);_0x33902b[_0x475f('0x44')]=_[_0x475f('0x45')](_0x33902b[_0x475f('0x42')],_0x33902b[_0x475f('0x43')]);_0x34a1a0['attributes']=_[_0x475f('0x45')](_0x33902b[_0x475f('0x42')],qs['fields'](_0x59c4ef['query']['fields']));_0x34a1a0[_0x475f('0x46')]=_0x34a1a0[_0x475f('0x46')]['length']?_0x34a1a0['attributes']:_0x33902b['model'];if(_0x59c4ef['query'][_0x475f('0x51')]){_0x34a1a0[_0x475f('0x57')]=[{'all':!![]}];}_0x34a1a0=_[_0x475f('0x4e')]({},_0x34a1a0,_0x59c4ef[_0x475f('0x58')]);return db['ChatQueue'][_0x475f('0x59')](_0x34a1a0)['then'](handleEntityNotFound(_0x13f72d,null))[_0x475f('0x21')](respondWithResult(_0x13f72d,null))['catch'](handleError(_0x13f72d,null));};exports['create']=function(_0x4d0afe,_0x48dd9e){return db[_0x475f('0x50')][_0x475f('0x5a')](_0x4d0afe['body'],{})[_0x475f('0x21')](function(_0x49b71f){var _0x1df8a9=_0x4d0afe[_0x475f('0x5b')][_0x475f('0x38')]({'plain':!![]});if(!_0x1df8a9)throw new Error(_0x475f('0x5c'));if(_0x1df8a9[_0x475f('0x5d')]===_0x475f('0x5b')){var _0x163fa3=_0x49b71f[_0x475f('0x38')]({'plain':!![]});var _0x260305=_0x475f('0x5e');return db[_0x475f('0x5f')][_0x475f('0x59')]({'where':{'name':_0x260305,'userProfileId':_0x1df8a9[_0x475f('0x60')]},'raw':!![]})[_0x475f('0x21')](function(_0x29099e){if(_0x29099e&&_0x29099e[_0x475f('0x61')]===0x0){return db[_0x475f('0x39')]['create']({'name':_0x163fa3[_0x475f('0x3b')],'resourceId':_0x163fa3['id'],'type':_0x29099e[_0x475f('0x3b')],'sectionId':_0x29099e['id']},{})['then'](function(){return _0x49b71f;});}else{return _0x49b71f;}})[_0x475f('0x2a')](function(_0x17d348){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x17d348);throw _0x17d348;});}return _0x49b71f;})['then'](respondWithResult(_0x48dd9e,0xc9))[_0x475f('0x2a')](handleError(_0x48dd9e,null));};exports[_0x475f('0x36')]=function(_0x1386c2,_0x4c19d5){if(_0x1386c2[_0x475f('0x62')]['id']){delete _0x1386c2[_0x475f('0x62')]['id'];}return db['ChatQueue'][_0x475f('0x59')]({'where':{'id':_0x1386c2[_0x475f('0x55')]['id']}})[_0x475f('0x21')](handleEntityNotFound(_0x4c19d5,null))[_0x475f('0x21')](saveUpdates(_0x1386c2[_0x475f('0x62')],null))['then'](respondWithResult(_0x4c19d5,null))['catch'](handleError(_0x4c19d5,null));};exports['destroy']=function(_0x4652a5,_0x556ef6){return db[_0x475f('0x50')][_0x475f('0x59')]({'where':{'id':_0x4652a5[_0x475f('0x55')]['id']}})['then'](handleEntityNotFound(_0x556ef6,null))[_0x475f('0x21')](removeEntity(_0x556ef6,null))['catch'](handleError(_0x556ef6,null));};exports[_0x475f('0x63')]=function(_0x3d0da8,_0x145d41){return db[_0x475f('0x50')][_0x475f('0x63')]()['then'](respondWithResult(_0x145d41,null))[_0x475f('0x2a')](handleError(_0x145d41,null));};exports[_0x475f('0x64')]=function(_0xeff7e9,_0x1d5a57,_0x313558){var _0x3a2d3e={'raw':!![],'where':{}},_0x18bc0d={},_0x143243;return db['ChatQueue'][_0x475f('0x65')]({'where':{'id':_0xeff7e9['params']['id']}})[_0x475f('0x21')](handleEntityNotFound(_0x1d5a57,null))[_0x475f('0x21')](function(_0x2b998c){if(_0x2b998c){_0x143243=_0x2b998c[_0x475f('0x38')]({'plain':!![]});_0x18bc0d[_0x475f('0x42')]=_[_0x475f('0x56')](db[_0x475f('0x66')][_0x475f('0x3e')]);_0x18bc0d[_0x475f('0x43')]=_[_0x475f('0x56')](_0xeff7e9['query']);_0x18bc0d[_0x475f('0x44')]=_[_0x475f('0x45')](_0x18bc0d[_0x475f('0x42')],_0x18bc0d[_0x475f('0x43')]);_0x3a2d3e[_0x475f('0x46')]=_[_0x475f('0x45')](_0x18bc0d[_0x475f('0x42')],qs[_0x475f('0x67')](_0xeff7e9[_0x475f('0x43')][_0x475f('0x67')]));_0x3a2d3e[_0x475f('0x46')]=_0x3a2d3e[_0x475f('0x46')][_0x475f('0x47')]?_0x3a2d3e['attributes']:_0x18bc0d['model'];if(!_0xeff7e9[_0x475f('0x43')]['hasOwnProperty'](_0x475f('0x49'))){_0x3a2d3e[_0x475f('0x2f')]=qs[_0x475f('0x2f')](_0xeff7e9[_0x475f('0x43')][_0x475f('0x2f')]);_0x3a2d3e['offset']=qs[_0x475f('0x31')](_0xeff7e9['query'][_0x475f('0x31')]);}_0x3a2d3e[_0x475f('0x4a')]=qs['sort'](_0xeff7e9[_0x475f('0x43')]['sort']);_0x3a2d3e[_0x475f('0x4c')]=qs['filters'](_[_0x475f('0x4d')](_0xeff7e9['query'],_0x18bc0d['filters']));_0x3a2d3e[_0x475f('0x4c')][_0x475f('0x68')]=_0x2b998c['id'];if(_0xeff7e9['query']['filter']){_0x3a2d3e['where']=_[_0x475f('0x4e')](_0x3a2d3e['where'],{'$or':_[_0x475f('0x3d')](_0x3a2d3e[_0x475f('0x46')],function(_0x44718b){var _0x496e60={};_0x496e60[_0x44718b]={'$like':'%'+_0xeff7e9['query'][_0x475f('0x4f')]+'%'};return _0x496e60;})});}_0x3a2d3e=_[_0x475f('0x4e')]({},_0x3a2d3e,_0xeff7e9[_0x475f('0x58')]);return db['UserChatQueue'][_0x475f('0x52')](_0x3a2d3e);}})[_0x475f('0x21')](function(_0x279831){if(_0x279831){return db['User']['findAndCountAll']({'where':{'id':_[_0x475f('0x3d')](_0x279831,'UserId'),'role':_0x475f('0x69')},'attributes':['id',_0x475f('0x3b'),_0x475f('0x6a'),_0x475f('0x6b'),'createdAt']});}})[_0x475f('0x21')](function(_0x5964c1){if(_0x5964c1){return{'count':_0x5964c1['count'],'rows':_[_0x475f('0x3d')](_0x5964c1[_0x475f('0x53')],function(_0x498d87){return{'membername':_0x498d87[_0x475f('0x3b')],'UserId':_0x498d87['id'],'queue_name':_0x143243[_0x475f('0x3b')],'ChatQueueId':_0x143243['id'],'interface':util[_0x475f('0x6c')](_0x475f('0x6d'),'SIP',_0x498d87['name']),'penalty':0x0,'paused':_0x498d87['chatPause'],'createdAt':_0x498d87[_0x475f('0x6e')],'updatedAt':_0x498d87[_0x475f('0x6b')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x475f('0x21')](respondWithFilteredResult(_0x1d5a57,_0x3a2d3e))[_0x475f('0x2a')](handleError(_0x1d5a57,null));};exports['getTeams']=function(_0x32847e,_0x426ac,_0x26abf2){var _0x5b678d={};var _0x1aa78f={};var _0x4702b3;var _0x324cab;return db['ChatQueue'][_0x475f('0x65')]({'where':{'id':_0x32847e['params']['id']}})[_0x475f('0x21')](handleEntityNotFound(_0x426ac,null))[_0x475f('0x21')](function(_0x3ae5a8){if(_0x3ae5a8){_0x4702b3=_0x3ae5a8;_0x1aa78f[_0x475f('0x42')]=_[_0x475f('0x56')](db[_0x475f('0x6f')][_0x475f('0x3e')]);_0x1aa78f[_0x475f('0x43')]=_[_0x475f('0x56')](_0x32847e[_0x475f('0x43')]);_0x1aa78f[_0x475f('0x44')]=_[_0x475f('0x45')](_0x1aa78f[_0x475f('0x42')],_0x1aa78f[_0x475f('0x43')]);_0x5b678d[_0x475f('0x46')]=_[_0x475f('0x45')](_0x1aa78f[_0x475f('0x42')],qs[_0x475f('0x67')](_0x32847e[_0x475f('0x43')][_0x475f('0x67')]));_0x5b678d['attributes']=_0x5b678d['attributes'][_0x475f('0x47')]?_0x5b678d[_0x475f('0x46')]:_0x1aa78f[_0x475f('0x42')];_0x5b678d[_0x475f('0x4a')]=qs[_0x475f('0x4b')](_0x32847e['query'][_0x475f('0x4b')]);_0x5b678d[_0x475f('0x4c')]=qs[_0x475f('0x44')](_[_0x475f('0x4d')](_0x32847e['query'],_0x1aa78f[_0x475f('0x44')]));if(_0x32847e[_0x475f('0x43')]['filter']){_0x5b678d[_0x475f('0x4c')]=_['merge'](_0x5b678d[_0x475f('0x4c')],{'$or':_[_0x475f('0x3d')](_0x5b678d[_0x475f('0x46')],function(_0x2414f7){var _0x5147e1={};_0x5147e1[_0x2414f7]={'$like':'%'+_0x32847e[_0x475f('0x43')][_0x475f('0x4f')]+'%'};return _0x5147e1;})});}_0x5b678d=_['merge']({},_0x5b678d,_0x32847e[_0x475f('0x58')]);return _0x4702b3['getTeams'](_0x5b678d);}})[_0x475f('0x21')](function(_0x12af9e){if(_0x12af9e){_0x324cab=_0x12af9e[_0x475f('0x47')];if(!_0x32847e[_0x475f('0x43')][_0x475f('0x48')](_0x475f('0x49'))){_0x5b678d[_0x475f('0x2f')]=qs[_0x475f('0x2f')](_0x32847e['query'][_0x475f('0x2f')]);_0x5b678d[_0x475f('0x31')]=qs[_0x475f('0x31')](_0x32847e[_0x475f('0x43')]['offset']);}return _0x4702b3[_0x475f('0x70')](_0x5b678d);}})[_0x475f('0x21')](function(_0x59cbdb){if(_0x59cbdb){return _0x59cbdb?{'count':_0x324cab,'rows':_0x59cbdb}:null;}})[_0x475f('0x21')](respondWithResult(_0x426ac,null))[_0x475f('0x2a')](handleError(_0x426ac,null));};exports['addTeams']=function(_0x546aeb,_0x369228,_0x2934a0){var _0x1d36fb=_0x546aeb[_0x475f('0x62')][_0x475f('0x71')];return db[_0x475f('0x6f')][_0x475f('0x52')]({'where':{'id':_0x1d36fb},'attributes':['id'],'include':[{'model':db[_0x475f('0x72')],'as':_0x475f('0x73'),'attributes':['id','name',_0x475f('0x74'),_0x475f('0x75'),_0x475f('0x76')],'raw':!![]}]})[_0x475f('0x21')](function(_0x495d4b){if(_0x495d4b){var _0x3ec06f=_[_0x475f('0x77')](_0x495d4b,function(_0x2b15c5){var _0x22474d=_0x2b15c5['get']({'plain':!![]});return _0x22474d[_0x475f('0x73')];});return db['ChatQueue'][_0x475f('0x59')]({'where':{'id':_0x546aeb[_0x475f('0x55')]['id']}})['then'](function(_0x1c9005){return db[_0x475f('0x78')][_0x475f('0x79')](function(_0x39d785){return _0x1c9005[_0x475f('0x7a')](_0x1d36fb,{'transaction':_0x39d785})['then'](function(){return BPromise[_0x475f('0x7b')](_0x3ec06f,function(_0x24401b){return db[_0x475f('0x66')][_0x475f('0x7c')]({'where':{'UserId':_0x24401b['id'],'ChatQueueId':_0x546aeb[_0x475f('0x55')]['id']},'transaction':_0x39d785});});})[_0x475f('0x21')](function(){_0x3ec06f['forEach'](function(_0x51140a){socket['emit'](_0x475f('0x7d'),{'UserId':_0x51140a['id'],'ChatQueueId':_0x1c9005['id']});});});});});}})[_0x475f('0x21')](respondWithStatusCode(_0x369228,null))[_0x475f('0x2a')](handleError(_0x369228,null));};exports[_0x475f('0x7e')]=function(_0x213477,_0x459c70,_0x5b45d0){return db['Team'][_0x475f('0x52')]({'where':{'id':_0x213477['query']['ids']},'attributes':['id'],'include':[{'model':db[_0x475f('0x72')],'as':_0x475f('0x73'),'attributes':['id'],'raw':!![]}]})[_0x475f('0x21')](handleEntityNotFound(_0x459c70,null))[_0x475f('0x21')](function(_0x11b20a){var _0x3666ae=_[_0x475f('0x3d')](_0x11b20a,'id');var _0x3bda6f=[];var _0xaa607a=[];var _0x36674a=squel['select']();_0x36674a[_0x475f('0x7f')]('tq.TeamId')['from'](_0x475f('0x80'),'tq')[_0x475f('0x81')](_0x475f('0x82'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0x475f('0x83'),_0x213477[_0x475f('0x55')]['id']);for(var _0x25d974=0x0;_0x25d974<_0x11b20a[_0x475f('0x47')];_0x25d974+=0x1){let _0x583e41=_0x11b20a[_0x25d974];for(var _0x4d00fa=0x0;_0x4d00fa<_0x583e41[_0x475f('0x73')][_0x475f('0x47')];_0x4d00fa+=0x1){let _0x6791aa=_0x583e41[_0x475f('0x73')][_0x4d00fa];var _0x51b760=_0x36674a['clone']();_0x51b760[_0x475f('0x4c')](_0x475f('0x84'),_0x6791aa['id']);_0xaa607a['push'](db['sequelize'][_0x475f('0x43')](_0x51b760[_0x475f('0x85')](),{'type':db['sequelize'][_0x475f('0x86')][_0x475f('0x87')]})[_0x475f('0x21')](function(_0x4965da){if(_0x4965da[_0x475f('0x47')]===0x1){return _0x6791aa['id'];}else{var _0xc30176=_['every'](_[_0x475f('0x3d')](_0x4965da,'TeamId'),function(_0x495ceb){return _[_0x475f('0x88')](_0x3666ae,_0x495ceb);});if(_0xc30176){return _0x6791aa['id'];}}}));}}return BPromise[_0x475f('0x89')](_0xaa607a)[_0x475f('0x21')](function(_0x4f7ff2){_0x3bda6f=_(_0x3bda6f)[_0x475f('0x8a')](_0x4f7ff2)[_0x475f('0x8b')]()[_0x475f('0x8c')]();return db[_0x475f('0x50')][_0x475f('0x59')]({'where':{'id':_0x213477[_0x475f('0x55')]['id']}})['then'](function(_0x4f7cd6){return db[_0x475f('0x78')][_0x475f('0x79')](function(_0x18bf06){return _0x4f7cd6['removeTeams'](_0x213477[_0x475f('0x43')][_0x475f('0x71')],{'transaction':_0x18bf06})['then'](function(){if(!_['isEmpty'](_0x3bda6f)){return _0x4f7cd6[_0x475f('0x8d')](_0x3bda6f,{'transaction':_0x18bf06});}})[_0x475f('0x21')](function(){_0x3bda6f[_0x475f('0x8e')](function(_0x298ea3){socket['emit'](_0x475f('0x8f'),{'UserId':_0x298ea3,'ChatQueueId':_0x4f7cd6['id']});});});});});});})[_0x475f('0x21')](respondWithStatusCode(_0x459c70,null))['catch'](handleError(_0x459c70,null));};exports[_0x475f('0x90')]=function(_0xef6d23,_0x1542dc,_0x176f25){return db[_0x475f('0x50')][_0x475f('0x59')]({'where':{'id':_0xef6d23[_0x475f('0x55')]['id']}})[_0x475f('0x21')](handleEntityNotFound(_0x1542dc,null))['then'](function(_0x526a2f){if(_0x526a2f){return _0x526a2f['addAgents'](_0xef6d23[_0x475f('0x62')]['ids'],_[_0x475f('0x91')](_0xef6d23[_0x475f('0x62')],[_0x475f('0x71'),'id'])||{})[_0x475f('0x92')](function(_0x4c6f63){for(var _0x104be9=0x0;_0x104be9<_0xef6d23[_0x475f('0x62')][_0x475f('0x71')][_0x475f('0x47')];_0x104be9+=0x1){socket[_0x475f('0x93')]('userChatQueue:save',{'UserId':Number(_0xef6d23[_0x475f('0x62')][_0x475f('0x71')][_0x104be9]),'ChatQueueId':Number(_0xef6d23[_0x475f('0x55')]['id'])});}return _0x4c6f63;});}})[_0x475f('0x21')](respondWithResult(_0x1542dc,null))['catch'](handleError(_0x1542dc,null));};exports[_0x475f('0x8d')]=function(_0x492955,_0x22a687,_0x418b38){return db['ChatQueue']['find']({'where':{'id':_0x492955['params']['id']}})[_0x475f('0x21')](handleEntityNotFound(_0x22a687,null))['then'](function(_0x1377b2){if(_0x1377b2){return _0x1377b2[_0x475f('0x8d')](_0x492955[_0x475f('0x43')]['ids'])[_0x475f('0x21')](function(){if(_[_0x475f('0x94')](_0x492955[_0x475f('0x43')][_0x475f('0x71')])){for(var _0x1bdc82=0x0;_0x1bdc82<_0x492955['query'][_0x475f('0x71')][_0x475f('0x47')];_0x1bdc82+=0x1){socket[_0x475f('0x93')]('userChatQueue:remove',{'UserId':Number(_0x492955[_0x475f('0x43')][_0x475f('0x71')][_0x1bdc82]),'ChatQueueId':Number(_0x492955['params']['id'])});}}else{socket['emit'](_0x475f('0x8f'),{'UserId':Number(_0x492955['query']['ids']),'ChatQueueId':Number(_0x492955[_0x475f('0x55')]['id'])});}});}})[_0x475f('0x21')](respondWithStatusCode(_0x22a687,null))[_0x475f('0x2a')](handleError(_0x22a687,null));};exports[_0x475f('0x95')]=function(_0x3aa405,_0x45a8ea,_0x954258){var _0x4d335c={};var _0x105ed9={};var _0x4085c7;var _0x5a11de;return db[_0x475f('0x50')][_0x475f('0x65')]({'where':{'id':_0x3aa405[_0x475f('0x55')]['id']}})[_0x475f('0x21')](handleEntityNotFound(_0x45a8ea,null))[_0x475f('0x21')](function(_0x5dbe1c){if(_0x5dbe1c){_0x4085c7=_0x5dbe1c;_0x105ed9[_0x475f('0x42')]=_[_0x475f('0x56')](db['User'][_0x475f('0x3e')]);_0x105ed9[_0x475f('0x43')]=_[_0x475f('0x56')](_0x3aa405[_0x475f('0x43')]);_0x105ed9[_0x475f('0x44')]=_[_0x475f('0x45')](_0x105ed9[_0x475f('0x42')],_0x105ed9[_0x475f('0x43')]);_0x4d335c['attributes']=_[_0x475f('0x45')](_0x105ed9['model'],qs[_0x475f('0x67')](_0x3aa405[_0x475f('0x43')]['fields']));_0x4d335c[_0x475f('0x46')]=_0x4d335c[_0x475f('0x46')]['length']?_0x4d335c['attributes']:_0x105ed9[_0x475f('0x42')];_0x4d335c[_0x475f('0x4a')]=qs['sort'](_0x3aa405[_0x475f('0x43')][_0x475f('0x4b')]);_0x4d335c[_0x475f('0x4c')]=qs[_0x475f('0x44')](_[_0x475f('0x4d')](_0x3aa405[_0x475f('0x43')],_0x105ed9['filters']));if(_0x3aa405['query'][_0x475f('0x4f')]){_0x4d335c[_0x475f('0x4c')]=_[_0x475f('0x4e')](_0x4d335c['where'],{'$or':_['map'](_0x4d335c[_0x475f('0x46')],function(_0x338f0b){var _0x3edd2e={};_0x3edd2e[_0x338f0b]={'$like':'%'+_0x3aa405[_0x475f('0x43')][_0x475f('0x4f')]+'%'};return _0x3edd2e;})});}_0x4d335c=_[_0x475f('0x4e')]({},_0x4d335c,_0x3aa405['options']);return _0x4085c7[_0x475f('0x95')](_0x4d335c);}})['then'](function(_0x29ff2c){if(_0x29ff2c){_0x5a11de=_0x29ff2c[_0x475f('0x47')];if(!_0x3aa405[_0x475f('0x43')]['hasOwnProperty']('nolimit')){_0x4d335c[_0x475f('0x2f')]=qs[_0x475f('0x2f')](_0x3aa405[_0x475f('0x43')]['limit']);_0x4d335c[_0x475f('0x31')]=qs[_0x475f('0x31')](_0x3aa405[_0x475f('0x43')][_0x475f('0x31')]);}return _0x4085c7[_0x475f('0x95')](_0x4d335c);}})[_0x475f('0x21')](function(_0x29ed64){if(_0x29ed64){return _0x29ed64?{'count':_0x5a11de,'rows':_0x29ed64}:null;}})['then'](respondWithResult(_0x45a8ea,null))[_0x475f('0x2a')](handleError(_0x45a8ea,null));}; \ No newline at end of file +var _0xe3aa=['describe','getMembers','findOne','UserChatQueue','hasOwnProperty','ChatQueueId','User','findAndCountAll','UserId','agent','createdAt','rows','%s/%s','SIP','chatPause','updatedAt','getTeams','addTeams','Team','Agents','online','interface','flatMap','sequelize','transaction','findOrCreate','forEach','emit','userChatQueue:save','removeTeams','ids','field','team_has_chat_queues','user_has_teams','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','QueryTypes','every','TeamId','includes','all','union','compact','value','isEmpty','removeAgents','addAgents','omit','isArray','userChatQueue:remove','getAgents','eml-format','rimraf','zip-dir','moment','mustache','util','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','jayson/promise','client','http','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','status','json','offset','limit','count','set','apply','reject','save','update','destroy','get','UserProfileResource','sendStatus','stack','name','send','map','ChatQueue','type','model','keys','query','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','ChatQueues','UserProfileSection','userProfileId','autoAssociation','params','catch'];(function(_0x318d42,_0x519dc8){var _0x4b48c0=function(_0x4d5d99){while(--_0x4d5d99){_0x318d42['push'](_0x318d42['shift']());}};_0x4b48c0(++_0x519dc8);}(_0xe3aa,0x156));var _0xae3a=function(_0x8d5b85,_0x1f788c){_0x8d5b85=_0x8d5b85-0x0;var _0x2e648f=_0xe3aa[_0x8d5b85];return _0x2e648f;};'use strict';var emlformat=require(_0xae3a('0x0'));var rimraf=require(_0xae3a('0x1'));var zipdir=require(_0xae3a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xae3a('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xae3a('0x4'));var util=require(_0xae3a('0x5'));var path=require('path');var sox=require(_0xae3a('0x6'));var csv=require('to-csv');var ejs=require(_0xae3a('0x7'));var fs=require('fs');var fs_extra=require(_0xae3a('0x8'));var _=require(_0xae3a('0x9'));var squel=require('squel');var crypto=require(_0xae3a('0xa'));var jsforce=require(_0xae3a('0xb'));var deskjs=require(_0xae3a('0xc'));var toCsv=require(_0xae3a('0xd'));var querystring=require(_0xae3a('0xe'));var Papa=require(_0xae3a('0xf'));var Redis=require(_0xae3a('0x10'));var authService=require(_0xae3a('0x11'));var qs=require(_0xae3a('0x12'));var as=require(_0xae3a('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xae3a('0x14'));var config=require(_0xae3a('0x15'));var licenseUtil=require(_0xae3a('0x16'));var db=require('../../mysqldb')['db'];config[_0xae3a('0x17')]=_[_0xae3a('0x18')](config[_0xae3a('0x17')],{'host':_0xae3a('0x19'),'port':0x18eb});var socket=require(_0xae3a('0x1a'))(new Redis(config['redis']));require(_0xae3a('0x1b'))['register'](socket);var jayson=require(_0xae3a('0x1c'));var client=jayson[_0xae3a('0x1d')][_0xae3a('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x557920,_0x370af5,_0x3897c1,_0x4d7ccd){return new BPromise(function(_0x11307e,_0x24607a){var _0x483361=_0x4d7ccd||client;return _0x483361['request'](_0x557920,_0x3897c1)[_0xae3a('0x1f')](function(_0x482742){logger[_0xae3a('0x20')](_0xae3a('0x21'),_0x370af5,_0xae3a('0x22'));logger[_0xae3a('0x23')](_0xae3a('0x24'),_0x370af5,_0xae3a('0x22'),JSON[_0xae3a('0x25')](_0x482742));if(_0x482742[_0xae3a('0x26')]){if(_0x482742[_0xae3a('0x26')][_0xae3a('0x27')]===0x1f4){logger[_0xae3a('0x26')](_0xae3a('0x21'),_0x370af5,_0x482742[_0xae3a('0x26')][_0xae3a('0x28')]);return _0x24607a(_0x482742[_0xae3a('0x26')][_0xae3a('0x28')]);}logger[_0xae3a('0x26')](_0xae3a('0x21'),_0x370af5,_0x482742[_0xae3a('0x26')][_0xae3a('0x28')]);return _0x11307e(_0x482742[_0xae3a('0x26')][_0xae3a('0x28')]);}else{logger[_0xae3a('0x20')](_0xae3a('0x21'),_0x370af5,'request\x20sent');_0x11307e(_0x482742[_0xae3a('0x29')]['message']);}})['catch'](function(_0xbb0ede){logger[_0xae3a('0x26')]('ChatQueue,\x20%s,\x20%s',_0x370af5,_0xbb0ede);_0x24607a(_0xbb0ede);});});}function respondWithStatusCode(_0x581752,_0xdeee05){_0xdeee05=_0xdeee05||0xcc;return function(_0x23a582){if(_0x23a582){return _0x581752['sendStatus'](_0xdeee05);}return _0x581752[_0xae3a('0x2a')](_0xdeee05)['end']();};}function respondWithResult(_0x545d73,_0x575ee0){_0x575ee0=_0x575ee0||0xc8;return function(_0x8a6e12){if(_0x8a6e12){return _0x545d73['status'](_0x575ee0)[_0xae3a('0x2b')](_0x8a6e12);}};}function respondWithFilteredResult(_0x45d08f,_0x1a9145){return function(_0x1a3ecf){if(_0x1a3ecf){var _0x30e7d2=typeof _0x1a9145[_0xae3a('0x2c')]==='undefined'&&typeof _0x1a9145[_0xae3a('0x2d')]==='undefined';var _0x11f932=_0x1a3ecf['count'];var _0x57add6=_0x30e7d2?0x0:_0x1a9145[_0xae3a('0x2c')];var _0x44765=_0x30e7d2?_0x1a3ecf[_0xae3a('0x2e')]:_0x1a9145[_0xae3a('0x2c')]+_0x1a9145['limit'];var _0x1cb42c;if(_0x44765>=_0x11f932){_0x44765=_0x11f932;_0x1cb42c=0xc8;}else{_0x1cb42c=0xce;}_0x45d08f[_0xae3a('0x2a')](_0x1cb42c);return _0x45d08f[_0xae3a('0x2f')]('Content-Range',_0x57add6+'-'+_0x44765+'/'+_0x11f932)[_0xae3a('0x2b')](_0x1a3ecf);}return null;};}function patchUpdates(_0x2489bb){return function(_0x218de9){try{jsonpatch[_0xae3a('0x30')](_0x218de9,_0x2489bb,!![]);}catch(_0x41cc25){return BPromise[_0xae3a('0x31')](_0x41cc25);}return _0x218de9[_0xae3a('0x32')]();};}function saveUpdates(_0x93d5d6,_0x90cbd7){return function(_0x5d52d9){if(_0x5d52d9){return _0x5d52d9[_0xae3a('0x33')](_0x93d5d6)['then'](function(_0x2300b7){return _0x2300b7;});}return null;};}function removeEntity(_0x540a95,_0x4070f3){return function(_0x282ee2){if(_0x282ee2){return _0x282ee2[_0xae3a('0x34')]()[_0xae3a('0x1f')](function(){var _0x4bf651=_0x282ee2[_0xae3a('0x35')]({'plain':!![]});var _0x1340f0='ChatQueues';return db[_0xae3a('0x36')][_0xae3a('0x34')]({'where':{'type':_0x1340f0,'resourceId':_0x4bf651['id']}})[_0xae3a('0x1f')](function(){return _0x282ee2;});})[_0xae3a('0x1f')](function(){_0x540a95[_0xae3a('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x507994,_0x156873){return function(_0x23af36){if(!_0x23af36){_0x507994[_0xae3a('0x37')](0x194);}return _0x23af36;};}function handleError(_0x2998be,_0x1ad221){_0x1ad221=_0x1ad221||0x1f4;return function(_0xf1cb0){logger['error'](_0xf1cb0[_0xae3a('0x38')]);if(_0xf1cb0[_0xae3a('0x39')]){delete _0xf1cb0[_0xae3a('0x39')];}_0x2998be['status'](_0x1ad221)[_0xae3a('0x3a')](_0xf1cb0);};}exports['index']=function(_0x3a959d,_0x429550){var _0x44aeee={},_0x450207={},_0x738b12={'count':0x0,'rows':[]};var _0x6a11b9=_[_0xae3a('0x3b')](db[_0xae3a('0x3c')]['rawAttributes'],function(_0x22bc5b){return{'name':_0x22bc5b['fieldName'],'type':_0x22bc5b[_0xae3a('0x3d')]['key']};});_0x450207[_0xae3a('0x3e')]=_[_0xae3a('0x3b')](_0x6a11b9,_0xae3a('0x39'));_0x450207['query']=_[_0xae3a('0x3f')](_0x3a959d[_0xae3a('0x40')]);_0x450207[_0xae3a('0x41')]=_[_0xae3a('0x42')](_0x450207[_0xae3a('0x3e')],_0x450207[_0xae3a('0x40')]);_0x44aeee['attributes']=_[_0xae3a('0x42')](_0x450207[_0xae3a('0x3e')],qs['fields'](_0x3a959d[_0xae3a('0x40')][_0xae3a('0x43')]));_0x44aeee[_0xae3a('0x44')]=_0x44aeee[_0xae3a('0x44')][_0xae3a('0x45')]?_0x44aeee[_0xae3a('0x44')]:_0x450207[_0xae3a('0x3e')];if(!_0x3a959d[_0xae3a('0x40')]['hasOwnProperty'](_0xae3a('0x46'))){_0x44aeee['limit']=qs[_0xae3a('0x2d')](_0x3a959d[_0xae3a('0x40')]['limit']);_0x44aeee['offset']=qs['offset'](_0x3a959d['query'][_0xae3a('0x2c')]);}_0x44aeee[_0xae3a('0x47')]=qs[_0xae3a('0x48')](_0x3a959d[_0xae3a('0x40')][_0xae3a('0x48')]);_0x44aeee[_0xae3a('0x49')]=qs[_0xae3a('0x41')](_[_0xae3a('0x4a')](_0x3a959d[_0xae3a('0x40')],_0x450207[_0xae3a('0x41')]),_0x6a11b9);if(_0x3a959d[_0xae3a('0x40')][_0xae3a('0x4b')]){_0x44aeee[_0xae3a('0x49')]=_[_0xae3a('0x4c')](_0x44aeee[_0xae3a('0x49')],{'$or':_['map'](_0x6a11b9,function(_0x2bd19c){if(_0x2bd19c[_0xae3a('0x3d')]!==_0xae3a('0x4d')){var _0x224b97={};_0x224b97[_0x2bd19c[_0xae3a('0x39')]]={'$like':'%'+_0x3a959d['query']['filter']+'%'};return _0x224b97;}})});}_0x44aeee=_[_0xae3a('0x4c')]({},_0x44aeee,_0x3a959d[_0xae3a('0x4e')]);var _0x383b2d={'where':_0x44aeee[_0xae3a('0x49')]};return db[_0xae3a('0x3c')]['count'](_0x383b2d)['then'](function(_0x45dc4d){_0x738b12[_0xae3a('0x2e')]=_0x45dc4d;if(_0x3a959d[_0xae3a('0x40')]['includeAll']){_0x44aeee[_0xae3a('0x4f')]=[{'all':!![]}];}return db[_0xae3a('0x3c')][_0xae3a('0x50')](_0x44aeee);})['then'](function(_0x4e4909){_0x738b12['rows']=_0x4e4909;return _0x738b12;})[_0xae3a('0x1f')](respondWithFilteredResult(_0x429550,_0x44aeee))['catch'](handleError(_0x429550,null));};exports['show']=function(_0x3e3496,_0x4920cc){var _0x1a35b9={'raw':!![],'where':{'id':_0x3e3496['params']['id']}},_0x499521={};_0x499521['model']=_[_0xae3a('0x3f')](db[_0xae3a('0x3c')][_0xae3a('0x51')]);_0x499521[_0xae3a('0x40')]=_[_0xae3a('0x3f')](_0x3e3496[_0xae3a('0x40')]);_0x499521[_0xae3a('0x41')]=_[_0xae3a('0x42')](_0x499521[_0xae3a('0x3e')],_0x499521['query']);_0x1a35b9[_0xae3a('0x44')]=_[_0xae3a('0x42')](_0x499521[_0xae3a('0x3e')],qs[_0xae3a('0x43')](_0x3e3496[_0xae3a('0x40')][_0xae3a('0x43')]));_0x1a35b9[_0xae3a('0x44')]=_0x1a35b9[_0xae3a('0x44')][_0xae3a('0x45')]?_0x1a35b9[_0xae3a('0x44')]:_0x499521['model'];if(_0x3e3496[_0xae3a('0x40')]['includeAll']){_0x1a35b9[_0xae3a('0x4f')]=[{'all':!![]}];}_0x1a35b9=_[_0xae3a('0x4c')]({},_0x1a35b9,_0x3e3496[_0xae3a('0x4e')]);return db[_0xae3a('0x3c')][_0xae3a('0x52')](_0x1a35b9)[_0xae3a('0x1f')](handleEntityNotFound(_0x4920cc,null))[_0xae3a('0x1f')](respondWithResult(_0x4920cc,null))['catch'](handleError(_0x4920cc,null));};exports['create']=function(_0x49319f,_0x18e443){return db[_0xae3a('0x3c')][_0xae3a('0x53')](_0x49319f[_0xae3a('0x54')],{})['then'](function(_0x2be33b){var _0x2d8926=_0x49319f[_0xae3a('0x55')][_0xae3a('0x35')]({'plain':!![]});if(!_0x2d8926)throw new Error(_0xae3a('0x56'));if(_0x2d8926['role']===_0xae3a('0x55')){var _0x14b0f9=_0x2be33b[_0xae3a('0x35')]({'plain':!![]});var _0x135172=_0xae3a('0x57');return db[_0xae3a('0x58')][_0xae3a('0x52')]({'where':{'name':_0x135172,'userProfileId':_0x2d8926[_0xae3a('0x59')]},'raw':!![]})[_0xae3a('0x1f')](function(_0x4bf416){if(_0x4bf416&&_0x4bf416[_0xae3a('0x5a')]===0x0){return db[_0xae3a('0x36')]['create']({'name':_0x14b0f9[_0xae3a('0x39')],'resourceId':_0x14b0f9['id'],'type':_0x4bf416[_0xae3a('0x39')],'sectionId':_0x4bf416['id']},{})['then'](function(){return _0x2be33b;});}else{return _0x2be33b;}})['catch'](function(_0x1b1c55){logger[_0xae3a('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1b1c55);throw _0x1b1c55;});}return _0x2be33b;})[_0xae3a('0x1f')](respondWithResult(_0x18e443,0xc9))['catch'](handleError(_0x18e443,null));};exports['update']=function(_0x24a63c,_0xaf507b){if(_0x24a63c[_0xae3a('0x54')]['id']){delete _0x24a63c[_0xae3a('0x54')]['id'];}return db[_0xae3a('0x3c')]['find']({'where':{'id':_0x24a63c[_0xae3a('0x5b')]['id']}})[_0xae3a('0x1f')](handleEntityNotFound(_0xaf507b,null))[_0xae3a('0x1f')](saveUpdates(_0x24a63c[_0xae3a('0x54')],null))[_0xae3a('0x1f')](respondWithResult(_0xaf507b,null))[_0xae3a('0x5c')](handleError(_0xaf507b,null));};exports[_0xae3a('0x34')]=function(_0x4946ce,_0x4d1b14){return db[_0xae3a('0x3c')][_0xae3a('0x52')]({'where':{'id':_0x4946ce[_0xae3a('0x5b')]['id']}})['then'](handleEntityNotFound(_0x4d1b14,null))[_0xae3a('0x1f')](removeEntity(_0x4d1b14,null))['catch'](handleError(_0x4d1b14,null));};exports[_0xae3a('0x5d')]=function(_0x2ede61,_0x595c04){return db[_0xae3a('0x3c')]['describe']()[_0xae3a('0x1f')](respondWithResult(_0x595c04,null))['catch'](handleError(_0x595c04,null));};exports[_0xae3a('0x5e')]=function(_0x5be6dd,_0x11fca5,_0x560f5a){var _0x38ef1f={'raw':!![],'where':{}},_0x355f9f={},_0x3cf6e7;return db[_0xae3a('0x3c')][_0xae3a('0x5f')]({'where':{'id':_0x5be6dd[_0xae3a('0x5b')]['id']}})[_0xae3a('0x1f')](handleEntityNotFound(_0x11fca5,null))['then'](function(_0x1b530a){if(_0x1b530a){_0x3cf6e7=_0x1b530a[_0xae3a('0x35')]({'plain':!![]});_0x355f9f[_0xae3a('0x3e')]=_[_0xae3a('0x3f')](db[_0xae3a('0x60')]['rawAttributes']);_0x355f9f[_0xae3a('0x40')]=_['keys'](_0x5be6dd[_0xae3a('0x40')]);_0x355f9f[_0xae3a('0x41')]=_[_0xae3a('0x42')](_0x355f9f[_0xae3a('0x3e')],_0x355f9f[_0xae3a('0x40')]);_0x38ef1f[_0xae3a('0x44')]=_['intersection'](_0x355f9f[_0xae3a('0x3e')],qs[_0xae3a('0x43')](_0x5be6dd['query']['fields']));_0x38ef1f[_0xae3a('0x44')]=_0x38ef1f['attributes'][_0xae3a('0x45')]?_0x38ef1f['attributes']:_0x355f9f['model'];if(!_0x5be6dd['query'][_0xae3a('0x61')](_0xae3a('0x46'))){_0x38ef1f[_0xae3a('0x2d')]=qs[_0xae3a('0x2d')](_0x5be6dd[_0xae3a('0x40')][_0xae3a('0x2d')]);_0x38ef1f[_0xae3a('0x2c')]=qs['offset'](_0x5be6dd['query'][_0xae3a('0x2c')]);}_0x38ef1f[_0xae3a('0x47')]=qs[_0xae3a('0x48')](_0x5be6dd[_0xae3a('0x40')][_0xae3a('0x48')]);_0x38ef1f['where']=qs[_0xae3a('0x41')](_[_0xae3a('0x4a')](_0x5be6dd['query'],_0x355f9f[_0xae3a('0x41')]));_0x38ef1f[_0xae3a('0x49')][_0xae3a('0x62')]=_0x1b530a['id'];if(_0x5be6dd['query']['filter']){_0x38ef1f[_0xae3a('0x49')]=_[_0xae3a('0x4c')](_0x38ef1f[_0xae3a('0x49')],{'$or':_[_0xae3a('0x3b')](_0x38ef1f[_0xae3a('0x44')],function(_0xd1230d){var _0x1612e7={};_0x1612e7[_0xd1230d]={'$like':'%'+_0x5be6dd[_0xae3a('0x40')][_0xae3a('0x4b')]+'%'};return _0x1612e7;})});}_0x38ef1f=_[_0xae3a('0x4c')]({},_0x38ef1f,_0x5be6dd[_0xae3a('0x4e')]);return db['UserChatQueue'][_0xae3a('0x50')](_0x38ef1f);}})['then'](function(_0x3b3c2b){if(_0x3b3c2b){return db[_0xae3a('0x63')][_0xae3a('0x64')]({'where':{'id':_['map'](_0x3b3c2b,_0xae3a('0x65')),'role':_0xae3a('0x66')},'attributes':['id',_0xae3a('0x39'),'chatPause','updatedAt',_0xae3a('0x67')]});}})[_0xae3a('0x1f')](function(_0xf04f6f){if(_0xf04f6f){return{'count':_0xf04f6f[_0xae3a('0x2e')],'rows':_[_0xae3a('0x3b')](_0xf04f6f[_0xae3a('0x68')],function(_0x37bee2){return{'membername':_0x37bee2['name'],'UserId':_0x37bee2['id'],'queue_name':_0x3cf6e7['name'],'ChatQueueId':_0x3cf6e7['id'],'interface':util['format'](_0xae3a('0x69'),_0xae3a('0x6a'),_0x37bee2['name']),'penalty':0x0,'paused':_0x37bee2[_0xae3a('0x6b')],'createdAt':_0x37bee2[_0xae3a('0x67')],'updatedAt':_0x37bee2[_0xae3a('0x6c')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xae3a('0x1f')](respondWithFilteredResult(_0x11fca5,_0x38ef1f))[_0xae3a('0x5c')](handleError(_0x11fca5,null));};exports[_0xae3a('0x6d')]=function(_0x256f03,_0x24d636,_0x38edb6){var _0x277629={};var _0x1fa77f={};var _0xa8bfbb;var _0x7f745;return db[_0xae3a('0x3c')][_0xae3a('0x5f')]({'where':{'id':_0x256f03[_0xae3a('0x5b')]['id']}})[_0xae3a('0x1f')](handleEntityNotFound(_0x24d636,null))[_0xae3a('0x1f')](function(_0x1e7c0d){if(_0x1e7c0d){_0xa8bfbb=_0x1e7c0d;_0x1fa77f['model']=_[_0xae3a('0x3f')](db['Team'][_0xae3a('0x51')]);_0x1fa77f[_0xae3a('0x40')]=_[_0xae3a('0x3f')](_0x256f03['query']);_0x1fa77f['filters']=_['intersection'](_0x1fa77f[_0xae3a('0x3e')],_0x1fa77f[_0xae3a('0x40')]);_0x277629[_0xae3a('0x44')]=_[_0xae3a('0x42')](_0x1fa77f['model'],qs[_0xae3a('0x43')](_0x256f03[_0xae3a('0x40')][_0xae3a('0x43')]));_0x277629['attributes']=_0x277629[_0xae3a('0x44')][_0xae3a('0x45')]?_0x277629[_0xae3a('0x44')]:_0x1fa77f[_0xae3a('0x3e')];_0x277629['order']=qs['sort'](_0x256f03[_0xae3a('0x40')][_0xae3a('0x48')]);_0x277629[_0xae3a('0x49')]=qs[_0xae3a('0x41')](_['pick'](_0x256f03[_0xae3a('0x40')],_0x1fa77f['filters']));if(_0x256f03[_0xae3a('0x40')][_0xae3a('0x4b')]){_0x277629[_0xae3a('0x49')]=_[_0xae3a('0x4c')](_0x277629['where'],{'$or':_['map'](_0x277629['attributes'],function(_0x3b71cf){var _0x4548f2={};_0x4548f2[_0x3b71cf]={'$like':'%'+_0x256f03[_0xae3a('0x40')][_0xae3a('0x4b')]+'%'};return _0x4548f2;})});}_0x277629=_['merge']({},_0x277629,_0x256f03[_0xae3a('0x4e')]);return _0xa8bfbb[_0xae3a('0x6d')](_0x277629);}})[_0xae3a('0x1f')](function(_0x23b674){if(_0x23b674){_0x7f745=_0x23b674[_0xae3a('0x45')];if(!_0x256f03[_0xae3a('0x40')][_0xae3a('0x61')](_0xae3a('0x46'))){_0x277629['limit']=qs['limit'](_0x256f03[_0xae3a('0x40')][_0xae3a('0x2d')]);_0x277629[_0xae3a('0x2c')]=qs[_0xae3a('0x2c')](_0x256f03['query'][_0xae3a('0x2c')]);}return _0xa8bfbb[_0xae3a('0x6d')](_0x277629);}})[_0xae3a('0x1f')](function(_0x604eaa){if(_0x604eaa){return _0x604eaa?{'count':_0x7f745,'rows':_0x604eaa}:null;}})[_0xae3a('0x1f')](respondWithResult(_0x24d636,null))[_0xae3a('0x5c')](handleError(_0x24d636,null));};exports[_0xae3a('0x6e')]=function(_0x1f0b59,_0x412771,_0x2f9493){var _0x3ac471=_0x1f0b59[_0xae3a('0x54')]['ids'];return db[_0xae3a('0x6f')][_0xae3a('0x50')]({'where':{'id':_0x3ac471},'attributes':['id'],'include':[{'model':db[_0xae3a('0x63')],'as':_0xae3a('0x70'),'attributes':['id',_0xae3a('0x39'),_0xae3a('0x71'),'voicePause',_0xae3a('0x72')],'raw':!![]}]})[_0xae3a('0x1f')](function(_0x21eb06){if(_0x21eb06){var _0x2d53d8=_[_0xae3a('0x73')](_0x21eb06,function(_0x40c80a){var _0x56fb0c=_0x40c80a[_0xae3a('0x35')]({'plain':!![]});return _0x56fb0c[_0xae3a('0x70')];});return db[_0xae3a('0x3c')]['find']({'where':{'id':_0x1f0b59['params']['id']}})[_0xae3a('0x1f')](function(_0x4eb10a){return db[_0xae3a('0x74')][_0xae3a('0x75')](function(_0xb86c44){return _0x4eb10a[_0xae3a('0x6e')](_0x3ac471,{'transaction':_0xb86c44})[_0xae3a('0x1f')](function(){return BPromise['each'](_0x2d53d8,function(_0x5f47b2){return db[_0xae3a('0x60')][_0xae3a('0x76')]({'where':{'UserId':_0x5f47b2['id'],'ChatQueueId':_0x1f0b59[_0xae3a('0x5b')]['id']},'transaction':_0xb86c44});});})[_0xae3a('0x1f')](function(){_0x2d53d8[_0xae3a('0x77')](function(_0x18c965){socket[_0xae3a('0x78')](_0xae3a('0x79'),{'UserId':_0x18c965['id'],'ChatQueueId':_0x4eb10a['id']});});});});});}})[_0xae3a('0x1f')](respondWithStatusCode(_0x412771,null))[_0xae3a('0x5c')](handleError(_0x412771,null));};exports[_0xae3a('0x7a')]=function(_0x3fa04b,_0x3566a4,_0x210872){return db[_0xae3a('0x6f')][_0xae3a('0x50')]({'where':{'id':_0x3fa04b[_0xae3a('0x40')][_0xae3a('0x7b')]},'attributes':['id'],'include':[{'model':db[_0xae3a('0x63')],'as':_0xae3a('0x70'),'attributes':['id'],'raw':!![]}]})[_0xae3a('0x1f')](handleEntityNotFound(_0x3566a4,null))[_0xae3a('0x1f')](function(_0x34f356){var _0x1ba6bf=_[_0xae3a('0x3b')](_0x34f356,'id');var _0x421860=[];var _0x46c288=[];var _0x36a157=squel['select']();_0x36a157[_0xae3a('0x7c')]('tq.TeamId')['from'](_0xae3a('0x7d'),'tq')['join'](_0xae3a('0x7e'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xae3a('0x49')](_0xae3a('0x7f'),_0x3fa04b['params']['id']);for(var _0x15f7da=0x0;_0x15f7da<_0x34f356[_0xae3a('0x45')];_0x15f7da+=0x1){let _0x40105d=_0x34f356[_0x15f7da];for(var _0xeea406=0x0;_0xeea406<_0x40105d[_0xae3a('0x70')][_0xae3a('0x45')];_0xeea406+=0x1){let _0x2f3b63=_0x40105d[_0xae3a('0x70')][_0xeea406];var _0x4a307f=_0x36a157[_0xae3a('0x80')]();_0x4a307f[_0xae3a('0x49')](_0xae3a('0x81'),_0x2f3b63['id']);_0x46c288['push'](db[_0xae3a('0x74')][_0xae3a('0x40')](_0x4a307f['toString'](),{'type':db['sequelize'][_0xae3a('0x82')]['SELECT']})[_0xae3a('0x1f')](function(_0x5d2b8a){if(_0x5d2b8a[_0xae3a('0x45')]===0x1){return _0x2f3b63['id'];}else{var _0x53dbc3=_[_0xae3a('0x83')](_[_0xae3a('0x3b')](_0x5d2b8a,_0xae3a('0x84')),function(_0x120de9){return _[_0xae3a('0x85')](_0x1ba6bf,_0x120de9);});if(_0x53dbc3){return _0x2f3b63['id'];}}}));}}return BPromise[_0xae3a('0x86')](_0x46c288)[_0xae3a('0x1f')](function(_0x409a4e){_0x421860=_(_0x421860)[_0xae3a('0x87')](_0x409a4e)[_0xae3a('0x88')]()[_0xae3a('0x89')]();return db[_0xae3a('0x3c')]['find']({'where':{'id':_0x3fa04b['params']['id']}})[_0xae3a('0x1f')](function(_0x6879f8){return db[_0xae3a('0x74')][_0xae3a('0x75')](function(_0x68ff6c){return _0x6879f8[_0xae3a('0x7a')](_0x3fa04b[_0xae3a('0x40')][_0xae3a('0x7b')],{'transaction':_0x68ff6c})[_0xae3a('0x1f')](function(){if(!_[_0xae3a('0x8a')](_0x421860)){return _0x6879f8[_0xae3a('0x8b')](_0x421860,{'transaction':_0x68ff6c});}})['then'](function(){_0x421860[_0xae3a('0x77')](function(_0x348b1d){socket[_0xae3a('0x78')]('userChatQueue:remove',{'UserId':_0x348b1d,'ChatQueueId':_0x6879f8['id']});});});});});});})[_0xae3a('0x1f')](respondWithStatusCode(_0x3566a4,null))[_0xae3a('0x5c')](handleError(_0x3566a4,null));};exports['addAgents']=function(_0x93826a,_0x452692,_0x305283){return db[_0xae3a('0x3c')][_0xae3a('0x52')]({'where':{'id':_0x93826a['params']['id']}})['then'](handleEntityNotFound(_0x452692,null))[_0xae3a('0x1f')](function(_0x22013e){if(_0x22013e){return _0x22013e[_0xae3a('0x8c')](_0x93826a['body'][_0xae3a('0x7b')],_[_0xae3a('0x8d')](_0x93826a[_0xae3a('0x54')],[_0xae3a('0x7b'),'id'])||{})['spread'](function(_0x1d0791){for(var _0x242cec=0x0;_0x242cec<_0x93826a[_0xae3a('0x54')][_0xae3a('0x7b')][_0xae3a('0x45')];_0x242cec+=0x1){socket[_0xae3a('0x78')]('userChatQueue:save',{'UserId':Number(_0x93826a[_0xae3a('0x54')]['ids'][_0x242cec]),'ChatQueueId':Number(_0x93826a[_0xae3a('0x5b')]['id'])});}return _0x1d0791;});}})['then'](respondWithResult(_0x452692,null))[_0xae3a('0x5c')](handleError(_0x452692,null));};exports[_0xae3a('0x8b')]=function(_0x4ab3db,_0x11d160,_0x354621){return db['ChatQueue'][_0xae3a('0x52')]({'where':{'id':_0x4ab3db[_0xae3a('0x5b')]['id']}})['then'](handleEntityNotFound(_0x11d160,null))[_0xae3a('0x1f')](function(_0x3ed1a7){if(_0x3ed1a7){return _0x3ed1a7[_0xae3a('0x8b')](_0x4ab3db[_0xae3a('0x40')]['ids'])['then'](function(){if(_[_0xae3a('0x8e')](_0x4ab3db[_0xae3a('0x40')][_0xae3a('0x7b')])){for(var _0x4ef910=0x0;_0x4ef910<_0x4ab3db[_0xae3a('0x40')]['ids'][_0xae3a('0x45')];_0x4ef910+=0x1){socket['emit']('userChatQueue:remove',{'UserId':Number(_0x4ab3db[_0xae3a('0x40')]['ids'][_0x4ef910]),'ChatQueueId':Number(_0x4ab3db[_0xae3a('0x5b')]['id'])});}}else{socket[_0xae3a('0x78')](_0xae3a('0x8f'),{'UserId':Number(_0x4ab3db['query']['ids']),'ChatQueueId':Number(_0x4ab3db[_0xae3a('0x5b')]['id'])});}});}})['then'](respondWithStatusCode(_0x11d160,null))['catch'](handleError(_0x11d160,null));};exports[_0xae3a('0x90')]=function(_0x11d795,_0x8a2bd4,_0x4e6562){var _0x5beeca={};var _0x3c2638={};var _0x5e0451;var _0x38e388;return db[_0xae3a('0x3c')][_0xae3a('0x5f')]({'where':{'id':_0x11d795[_0xae3a('0x5b')]['id']}})[_0xae3a('0x1f')](handleEntityNotFound(_0x8a2bd4,null))[_0xae3a('0x1f')](function(_0x6a153e){if(_0x6a153e){_0x5e0451=_0x6a153e;_0x3c2638[_0xae3a('0x3e')]=_[_0xae3a('0x3f')](db[_0xae3a('0x63')][_0xae3a('0x51')]);_0x3c2638[_0xae3a('0x40')]=_[_0xae3a('0x3f')](_0x11d795[_0xae3a('0x40')]);_0x3c2638['filters']=_['intersection'](_0x3c2638[_0xae3a('0x3e')],_0x3c2638[_0xae3a('0x40')]);_0x5beeca[_0xae3a('0x44')]=_['intersection'](_0x3c2638[_0xae3a('0x3e')],qs[_0xae3a('0x43')](_0x11d795['query'][_0xae3a('0x43')]));_0x5beeca['attributes']=_0x5beeca[_0xae3a('0x44')][_0xae3a('0x45')]?_0x5beeca[_0xae3a('0x44')]:_0x3c2638[_0xae3a('0x3e')];_0x5beeca[_0xae3a('0x47')]=qs[_0xae3a('0x48')](_0x11d795['query'][_0xae3a('0x48')]);_0x5beeca[_0xae3a('0x49')]=qs[_0xae3a('0x41')](_[_0xae3a('0x4a')](_0x11d795[_0xae3a('0x40')],_0x3c2638[_0xae3a('0x41')]));if(_0x11d795[_0xae3a('0x40')][_0xae3a('0x4b')]){_0x5beeca['where']=_[_0xae3a('0x4c')](_0x5beeca['where'],{'$or':_[_0xae3a('0x3b')](_0x5beeca[_0xae3a('0x44')],function(_0x391c2c){var _0x49eb82={};_0x49eb82[_0x391c2c]={'$like':'%'+_0x11d795[_0xae3a('0x40')][_0xae3a('0x4b')]+'%'};return _0x49eb82;})});}_0x5beeca=_[_0xae3a('0x4c')]({},_0x5beeca,_0x11d795['options']);return _0x5e0451[_0xae3a('0x90')](_0x5beeca);}})[_0xae3a('0x1f')](function(_0x3a63b6){if(_0x3a63b6){_0x38e388=_0x3a63b6['length'];if(!_0x11d795[_0xae3a('0x40')]['hasOwnProperty'](_0xae3a('0x46'))){_0x5beeca[_0xae3a('0x2d')]=qs['limit'](_0x11d795[_0xae3a('0x40')][_0xae3a('0x2d')]);_0x5beeca[_0xae3a('0x2c')]=qs['offset'](_0x11d795[_0xae3a('0x40')][_0xae3a('0x2c')]);}return _0x5e0451[_0xae3a('0x90')](_0x5beeca);}})['then'](function(_0xb6d828){if(_0xb6d828){return _0xb6d828?{'count':_0x38e388,'rows':_0xb6d828}:null;}})[_0xae3a('0x1f')](respondWithResult(_0x8a2bd4,null))['catch'](handleError(_0x8a2bd4,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index f79efa3..23d47cf 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 _0x8207=['save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatQueue','setMaxListeners'];(function(_0x325c1d,_0xaac33){var _0x41620d=function(_0x44e13c){while(--_0x44e13c){_0x325c1d['push'](_0x325c1d['shift']());}};_0x41620d(++_0xaac33);}(_0x8207,0x96));var _0x7820=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x8207[_0xa464c9];return _0x3d73c4;};'use strict';var EventEmitter=require(_0x7820('0x0'));var ChatQueue=require(_0x7820('0x1'))['db'][_0x7820('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x7820('0x3')](0x0);var events={'afterCreate':_0x7820('0x4'),'afterUpdate':_0x7820('0x5'),'afterDestroy':_0x7820('0x6')};function emitEvent(_0x37e17e){return function(_0x32a33a,_0x3dc533,_0x195567){ChatQueueEvents['emit'](_0x37e17e+':'+_0x32a33a['id'],_0x32a33a);ChatQueueEvents[_0x7820('0x7')](_0x37e17e,_0x32a33a);_0x195567(null);};}for(var e in events){if(events[_0x7820('0x8')](e)){var event=events[e];ChatQueue[_0x7820('0x9')](e,emitEvent(event));}}module[_0x7820('0xa')]=ChatQueueEvents; \ No newline at end of file +var _0x0936=['remove','emit','hook','exports','events','../../mysqldb','setMaxListeners','update'];(function(_0xfb0281,_0x3ff38b){var _0x408dd3=function(_0x5d8017){while(--_0x5d8017){_0xfb0281['push'](_0xfb0281['shift']());}};_0x408dd3(++_0x3ff38b);}(_0x0936,0xb4));var _0x6093=function(_0x524bb9,_0x2b28b3){_0x524bb9=_0x524bb9-0x0;var _0x3d20ed=_0x0936[_0x524bb9];return _0x3d20ed;};'use strict';var EventEmitter=require(_0x6093('0x0'));var ChatQueue=require(_0x6093('0x1'))['db']['ChatQueue'];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x6093('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x6093('0x3'),'afterDestroy':_0x6093('0x4')};function emitEvent(_0x2c1764){return function(_0x3412e9,_0x4fe7a1,_0x41935f){ChatQueueEvents[_0x6093('0x5')](_0x2c1764+':'+_0x3412e9['id'],_0x3412e9);ChatQueueEvents[_0x6093('0x5')](_0x2c1764,_0x3412e9);_0x41935f(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatQueue[_0x6093('0x6')](e,emitEvent(event));}}module[_0x6093('0x7')]=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index ecf7dde..c5e0506 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 _0x1a53=['ChatQueue','chat_queues','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatQueue.attributes','exports','define'];(function(_0x59adcc,_0x2f6165){var _0x128139=function(_0x122c41){while(--_0x122c41){_0x59adcc['push'](_0x59adcc['shift']());}};_0x128139(++_0x2f6165);}(_0x1a53,0x1af));var _0x31a5=function(_0x208364,_0x3f0e8d){_0x208364=_0x208364-0x0;var _0x5e9454=_0x1a53[_0x208364];return _0x5e9454;};'use strict';var _=require('lodash');var util=require(_0x31a5('0x0'));var logger=require(_0x31a5('0x1'))(_0x31a5('0x2'));var moment=require(_0x31a5('0x3'));var BPromise=require(_0x31a5('0x4'));var rp=require(_0x31a5('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x31a5('0x6'));var config=require(_0x31a5('0x7'));var attributes=require(_0x31a5('0x8'));module[_0x31a5('0x9')]=function(_0x5aff85,_0x46b12a){return _0x5aff85[_0x31a5('0xa')](_0x31a5('0xb'),attributes,{'tableName':_0x31a5('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcac5=['define','chat_queues','lodash','util','api','moment','bluebird','request-promise','path','rimraf','./chatQueue.attributes','exports'];(function(_0x486fff,_0x246d0e){var _0x29a53a=function(_0xe52796){while(--_0xe52796){_0x486fff['push'](_0x486fff['shift']());}};_0x29a53a(++_0x246d0e);}(_0xcac5,0xce));var _0x5cac=function(_0x315346,_0x763a31){_0x315346=_0x315346-0x0;var _0x4538cd=_0xcac5[_0x315346];return _0x4538cd;};'use strict';var _=require(_0x5cac('0x0'));var util=require(_0x5cac('0x1'));var logger=require('../../config/logger')(_0x5cac('0x2'));var moment=require(_0x5cac('0x3'));var BPromise=require(_0x5cac('0x4'));var rp=require(_0x5cac('0x5'));var fs=require('fs');var path=require(_0x5cac('0x6'));var rimraf=require(_0x5cac('0x7'));var config=require('../../config/environment');var attributes=require(_0x5cac('0x8'));module[_0x5cac('0x9')]=function(_0x50f205,_0x46466c){return _0x50f205[_0x5cac('0xa')]('ChatQueue',attributes,{'tableName':_0x5cac('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.rpc.js b/server/api/chatQueue/chatQueue.rpc.js index 25fa2a3..e31f378 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 _0x93e9=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./chatQueue.socket','register','request','info','request\x20sent','stringify','error','code','ChatQueue,\x20%s,\x20%s','message','result','catch','GetChatQueue','ChatQueue','findAll','options','where','attributes','limit','include','map','model','find','then','debug','ShowChatQueue','lodash'];(function(_0x813d0a,_0x4fd3d7){var _0x241352=function(_0x3ca375){while(--_0x3ca375){_0x813d0a['push'](_0x813d0a['shift']());}};_0x241352(++_0x4fd3d7);}(_0x93e9,0xcc));var _0x993e=function(_0x3942e2,_0x341872){_0x3942e2=_0x3942e2-0x0;var _0x47bdc4=_0x93e9[_0x3942e2];return _0x47bdc4;};'use strict';var _=require(_0x993e('0x0'));var util=require(_0x993e('0x1'));var moment=require(_0x993e('0x2'));var BPromise=require(_0x993e('0x3'));var rs=require(_0x993e('0x4'));var fs=require('fs');var Redis=require(_0x993e('0x5'));var db=require(_0x993e('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x993e('0x7'));var config=require(_0x993e('0x8'));var jayson=require(_0x993e('0x9'));var client=jayson[_0x993e('0xa')][_0x993e('0xb')]({'port':0x232a});config[_0x993e('0xc')]=_[_0x993e('0xd')](config[_0x993e('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x993e('0xe'))(new Redis(config[_0x993e('0xc')]));require(_0x993e('0xf'))[_0x993e('0x10')](socket);function respondWithRpcPromise(_0x2cd389,_0x27a28f,_0x1c2324){return new BPromise(function(_0x48291a,_0x196f6d){return client[_0x993e('0x11')](_0x2cd389,_0x1c2324)['then'](function(_0x5ebc8c){logger[_0x993e('0x12')]('ChatQueue,\x20%s,\x20%s',_0x27a28f,_0x993e('0x13'));logger['debug']('ChatQueue,\x20%s,\x20%s,\x20%s',_0x27a28f,_0x993e('0x13'),JSON[_0x993e('0x14')](_0x5ebc8c));if(_0x5ebc8c[_0x993e('0x15')]){if(_0x5ebc8c[_0x993e('0x15')][_0x993e('0x16')]===0x1f4){logger[_0x993e('0x15')](_0x993e('0x17'),_0x27a28f,_0x5ebc8c[_0x993e('0x15')][_0x993e('0x18')]);return _0x196f6d(_0x5ebc8c[_0x993e('0x15')][_0x993e('0x18')]);}logger[_0x993e('0x15')](_0x993e('0x17'),_0x27a28f,_0x5ebc8c[_0x993e('0x15')][_0x993e('0x18')]);return _0x48291a(_0x5ebc8c[_0x993e('0x15')][_0x993e('0x18')]);}else{logger['info'](_0x993e('0x17'),_0x27a28f,_0x993e('0x13'));_0x48291a(_0x5ebc8c[_0x993e('0x19')][_0x993e('0x18')]);}})[_0x993e('0x1a')](function(_0x3eda77){logger['error'](_0x993e('0x17'),_0x27a28f,_0x3eda77);_0x196f6d(_0x3eda77);});});}exports[_0x993e('0x1b')]=function(_0x1eaf57){var _0x22390e=this;return new Promise(function(_0x130a8a,_0x425ab4){return db[_0x993e('0x1c')][_0x993e('0x1d')]({'raw':_0x1eaf57['options']?_0x1eaf57[_0x993e('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x1eaf57[_0x993e('0x1e')]?_0x1eaf57[_0x993e('0x1e')][_0x993e('0x1f')]||null:null,'attributes':_0x1eaf57['options']?_0x1eaf57[_0x993e('0x1e')][_0x993e('0x20')]||null:null,'limit':_0x1eaf57[_0x993e('0x1e')]?_0x1eaf57[_0x993e('0x1e')][_0x993e('0x21')]||null:null,'include':_0x1eaf57[_0x993e('0x1e')]?_0x1eaf57[_0x993e('0x1e')][_0x993e('0x22')]?_[_0x993e('0x23')](_0x1eaf57[_0x993e('0x1e')][_0x993e('0x22')],function(_0x3603fa){return{'model':db[_0x3603fa['model']],'as':_0x3603fa['as'],'attributes':_0x3603fa[_0x993e('0x20')],'include':_0x3603fa[_0x993e('0x22')]?_['map'](_0x3603fa[_0x993e('0x22')],function(_0x4f5cc1){return{'model':db[_0x4f5cc1[_0x993e('0x24')]],'as':_0x4f5cc1['as'],'attributes':_0x4f5cc1[_0x993e('0x20')],'include':_0x4f5cc1[_0x993e('0x22')]?_[_0x993e('0x23')](_0x4f5cc1['include'],function(_0x48d457){return{'model':db[_0x48d457[_0x993e('0x24')]],'as':_0x48d457['as'],'attributes':_0x48d457[_0x993e('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x223af0){logger[_0x993e('0x12')](_0x993e('0x1b'),_0x1eaf57);logger['debug'](_0x993e('0x1b'),_0x1eaf57,JSON[_0x993e('0x14')](_0x223af0));_0x130a8a(_0x223af0);})[_0x993e('0x1a')](function(_0x1fa8a5){logger[_0x993e('0x15')]('GetChatQueue',_0x1fa8a5[_0x993e('0x18')],_0x1eaf57);_0x425ab4(_0x22390e['error'](0x1f4,_0x1fa8a5[_0x993e('0x18')]));});});};exports['ShowChatQueue']=function(_0x1da357){var _0x567ed4=this;return new Promise(function(_0x3b9c3c,_0x2ce5d5){return db[_0x993e('0x1c')][_0x993e('0x25')]({'raw':_0x1da357[_0x993e('0x1e')]?_0x1da357[_0x993e('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x1da357[_0x993e('0x1e')]?_0x1da357['options']['where']||null:null,'attributes':_0x1da357[_0x993e('0x1e')]?_0x1da357['options'][_0x993e('0x20')]||null:null,'include':_0x1da357[_0x993e('0x1e')]?_0x1da357[_0x993e('0x1e')][_0x993e('0x22')]?_[_0x993e('0x23')](_0x1da357[_0x993e('0x1e')][_0x993e('0x22')],function(_0x14424a){return{'model':db[_0x14424a[_0x993e('0x24')]],'as':_0x14424a['as'],'attributes':_0x14424a[_0x993e('0x20')],'include':_0x14424a[_0x993e('0x22')]?_[_0x993e('0x23')](_0x14424a[_0x993e('0x22')],function(_0x28a481){return{'model':db[_0x28a481[_0x993e('0x24')]],'as':_0x28a481['as'],'attributes':_0x28a481['attributes'],'include':_0x28a481[_0x993e('0x22')]?_[_0x993e('0x23')](_0x28a481[_0x993e('0x22')],function(_0x9a9f42){return{'model':db[_0x9a9f42[_0x993e('0x24')]],'as':_0x9a9f42['as'],'attributes':_0x9a9f42[_0x993e('0x20')]};}):[]};}):[]};}):[]:[]})[_0x993e('0x26')](function(_0x416afd){logger[_0x993e('0x12')]('ShowChatQueue',_0x1da357);logger[_0x993e('0x27')]('ShowChatQueue',_0x1da357,JSON[_0x993e('0x14')](_0x416afd));_0x3b9c3c(_0x416afd);})[_0x993e('0x1a')](function(_0x3f5e2b){logger[_0x993e('0x15')](_0x993e('0x28'),_0x3f5e2b[_0x993e('0x18')],_0x1da357);_0x2ce5d5(_0x567ed4[_0x993e('0x15')](0x1f4,_0x3f5e2b[_0x993e('0x18')]));});});}; \ No newline at end of file +var _0x7cfa=['http','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','request','info','ChatQueue,\x20%s,\x20%s','request\x20sent','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','message','error','result','catch','GetChatQueue','ChatQueue','findAll','options','where','attributes','limit','include','map','debug','find','raw','model','then','ShowChatQueue','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x2df260,_0x5bbf21){var _0x21eb9d=function(_0xe6f250){while(--_0xe6f250){_0x2df260['push'](_0x2df260['shift']());}};_0x21eb9d(++_0x5bbf21);}(_0x7cfa,0x137));var _0xa7cf=function(_0x5cc11d,_0x30e324){_0x5cc11d=_0x5cc11d-0x0;var _0x50ff99=_0x7cfa[_0x5cc11d];return _0x50ff99;};'use strict';var _=require(_0xa7cf('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xa7cf('0x1'));var rs=require(_0xa7cf('0x2'));var fs=require('fs');var Redis=require(_0xa7cf('0x3'));var db=require(_0xa7cf('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xa7cf('0x5'))('rpc');var config=require(_0xa7cf('0x6'));var jayson=require(_0xa7cf('0x7'));var client=jayson[_0xa7cf('0x8')][_0xa7cf('0x9')]({'port':0x232a});config[_0xa7cf('0xa')]=_[_0xa7cf('0xb')](config[_0xa7cf('0xa')],{'host':_0xa7cf('0xc'),'port':0x18eb});var socket=require(_0xa7cf('0xd'))(new Redis(config[_0xa7cf('0xa')]));require(_0xa7cf('0xe'))['register'](socket);function respondWithRpcPromise(_0x3ba932,_0x3bbfdf,_0x588c65){return new BPromise(function(_0x2c21ed,_0x333973){return client[_0xa7cf('0xf')](_0x3ba932,_0x588c65)['then'](function(_0x4d85ca){logger[_0xa7cf('0x10')](_0xa7cf('0x11'),_0x3bbfdf,_0xa7cf('0x12'));logger['debug'](_0xa7cf('0x13'),_0x3bbfdf,'request\x20sent',JSON[_0xa7cf('0x14')](_0x4d85ca));if(_0x4d85ca['error']){if(_0x4d85ca['error']['code']===0x1f4){logger['error'](_0xa7cf('0x11'),_0x3bbfdf,_0x4d85ca['error']['message']);return _0x333973(_0x4d85ca['error'][_0xa7cf('0x15')]);}logger['error']('ChatQueue,\x20%s,\x20%s',_0x3bbfdf,_0x4d85ca[_0xa7cf('0x16')][_0xa7cf('0x15')]);return _0x2c21ed(_0x4d85ca[_0xa7cf('0x16')][_0xa7cf('0x15')]);}else{logger[_0xa7cf('0x10')]('ChatQueue,\x20%s,\x20%s',_0x3bbfdf,'request\x20sent');_0x2c21ed(_0x4d85ca[_0xa7cf('0x17')]['message']);}})[_0xa7cf('0x18')](function(_0x229abe){logger[_0xa7cf('0x16')](_0xa7cf('0x11'),_0x3bbfdf,_0x229abe);_0x333973(_0x229abe);});});}exports[_0xa7cf('0x19')]=function(_0x22035d){var _0x44a464=this;return new Promise(function(_0x44a02b,_0x2a475a){return db[_0xa7cf('0x1a')][_0xa7cf('0x1b')]({'raw':_0x22035d[_0xa7cf('0x1c')]?_0x22035d[_0xa7cf('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x22035d[_0xa7cf('0x1c')]?_0x22035d[_0xa7cf('0x1c')][_0xa7cf('0x1d')]||null:null,'attributes':_0x22035d[_0xa7cf('0x1c')]?_0x22035d[_0xa7cf('0x1c')][_0xa7cf('0x1e')]||null:null,'limit':_0x22035d['options']?_0x22035d[_0xa7cf('0x1c')][_0xa7cf('0x1f')]||null:null,'include':_0x22035d[_0xa7cf('0x1c')]?_0x22035d[_0xa7cf('0x1c')][_0xa7cf('0x20')]?_['map'](_0x22035d[_0xa7cf('0x1c')][_0xa7cf('0x20')],function(_0x14b714){return{'model':db[_0x14b714['model']],'as':_0x14b714['as'],'attributes':_0x14b714[_0xa7cf('0x1e')],'include':_0x14b714[_0xa7cf('0x20')]?_[_0xa7cf('0x21')](_0x14b714[_0xa7cf('0x20')],function(_0x5a4178){return{'model':db[_0x5a4178['model']],'as':_0x5a4178['as'],'attributes':_0x5a4178['attributes'],'include':_0x5a4178[_0xa7cf('0x20')]?_[_0xa7cf('0x21')](_0x5a4178['include'],function(_0x14bc4c){return{'model':db[_0x14bc4c['model']],'as':_0x14bc4c['as'],'attributes':_0x14bc4c[_0xa7cf('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x32d607){logger[_0xa7cf('0x10')](_0xa7cf('0x19'),_0x22035d);logger[_0xa7cf('0x22')]('GetChatQueue',_0x22035d,JSON[_0xa7cf('0x14')](_0x32d607));_0x44a02b(_0x32d607);})[_0xa7cf('0x18')](function(_0xf0af15){logger[_0xa7cf('0x16')]('GetChatQueue',_0xf0af15[_0xa7cf('0x15')],_0x22035d);_0x2a475a(_0x44a464['error'](0x1f4,_0xf0af15[_0xa7cf('0x15')]));});});};exports['ShowChatQueue']=function(_0x34c0e3){var _0x6e59f9=this;return new Promise(function(_0x26d32a,_0x296f33){return db[_0xa7cf('0x1a')][_0xa7cf('0x23')]({'raw':_0x34c0e3[_0xa7cf('0x1c')]?_0x34c0e3[_0xa7cf('0x1c')][_0xa7cf('0x24')]===undefined?!![]:![]:!![],'where':_0x34c0e3[_0xa7cf('0x1c')]?_0x34c0e3[_0xa7cf('0x1c')][_0xa7cf('0x1d')]||null:null,'attributes':_0x34c0e3[_0xa7cf('0x1c')]?_0x34c0e3['options'][_0xa7cf('0x1e')]||null:null,'include':_0x34c0e3['options']?_0x34c0e3[_0xa7cf('0x1c')][_0xa7cf('0x20')]?_[_0xa7cf('0x21')](_0x34c0e3[_0xa7cf('0x1c')][_0xa7cf('0x20')],function(_0x55362a){return{'model':db[_0x55362a[_0xa7cf('0x25')]],'as':_0x55362a['as'],'attributes':_0x55362a[_0xa7cf('0x1e')],'include':_0x55362a[_0xa7cf('0x20')]?_[_0xa7cf('0x21')](_0x55362a[_0xa7cf('0x20')],function(_0x5eb3ff){return{'model':db[_0x5eb3ff['model']],'as':_0x5eb3ff['as'],'attributes':_0x5eb3ff[_0xa7cf('0x1e')],'include':_0x5eb3ff[_0xa7cf('0x20')]?_[_0xa7cf('0x21')](_0x5eb3ff[_0xa7cf('0x20')],function(_0x22bd8f){return{'model':db[_0x22bd8f[_0xa7cf('0x25')]],'as':_0x22bd8f['as'],'attributes':_0x22bd8f[_0xa7cf('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xa7cf('0x26')](function(_0x3448a4){logger[_0xa7cf('0x10')](_0xa7cf('0x27'),_0x34c0e3);logger[_0xa7cf('0x22')]('ShowChatQueue',_0x34c0e3,JSON[_0xa7cf('0x14')](_0x3448a4));_0x26d32a(_0x3448a4);})[_0xa7cf('0x18')](function(_0xb9b5fe){logger[_0xa7cf('0x16')](_0xa7cf('0x27'),_0xb9b5fe['message'],_0x34c0e3);_0x296f33(_0x6e59f9[_0xa7cf('0x16')](0x1f4,_0xb9b5fe[_0xa7cf('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index d432ffe..3a71b8b 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 _0x00bb=['removeListener','length','chatQueue:','./chatQueue.events','save','remove','emit'];(function(_0x2b2b33,_0x56606f){var _0x229157=function(_0x52b63e){while(--_0x52b63e){_0x2b2b33['push'](_0x2b2b33['shift']());}};_0x229157(++_0x56606f);}(_0x00bb,0x1d8));var _0xb00b=function(_0xb0f7c3,_0x4eae95){_0xb0f7c3=_0xb0f7c3-0x0;var _0x28ea68=_0x00bb[_0xb0f7c3];return _0x28ea68;};'use strict';var ChatQueueEvents=require(_0xb00b('0x0'));var events=[_0xb00b('0x1'),_0xb00b('0x2'),'update'];function createListener(_0x170f94,_0x47a3bf){return function(_0x278c5e){_0x47a3bf[_0xb00b('0x3')](_0x170f94,_0x278c5e);};}function removeListener(_0x582ef9,_0x14b5d0){return function(){ChatQueueEvents[_0xb00b('0x4')](_0x582ef9,_0x14b5d0);};}exports['register']=function(_0x574cf8){for(var _0x532ffb=0x0,_0x36e363=events[_0xb00b('0x5')];_0x532ffb<_0x36e363;_0x532ffb++){var _0x41dfc9=events[_0x532ffb];var _0x37f07d=createListener(_0xb00b('0x6')+_0x41dfc9,_0x574cf8);ChatQueueEvents['on'](_0x41dfc9,_0x37f07d);}}; \ No newline at end of file +var _0x579c=['chatQueue:','./chatQueue.events','save','remove','update','removeListener','register'];(function(_0x3f915a,_0x195659){var _0x32fa3a=function(_0x190519){while(--_0x190519){_0x3f915a['push'](_0x3f915a['shift']());}};_0x32fa3a(++_0x195659);}(_0x579c,0xda));var _0xc579=function(_0x12a657,_0x464430){_0x12a657=_0x12a657-0x0;var _0x499be4=_0x579c[_0x12a657];return _0x499be4;};'use strict';var ChatQueueEvents=require(_0xc579('0x0'));var events=[_0xc579('0x1'),_0xc579('0x2'),_0xc579('0x3')];function createListener(_0x397136,_0x586948){return function(_0x1e2808){_0x586948['emit'](_0x397136,_0x1e2808);};}function removeListener(_0x21a0a2,_0x3b913c){return function(){ChatQueueEvents[_0xc579('0x4')](_0x21a0a2,_0x3b913c);};}exports[_0xc579('0x5')]=function(_0x124ee5){for(var _0x1bd276=0x0,_0x2e451b=events['length'];_0x1bd276<_0x2e451b;_0x1bd276++){var _0x1c6d9c=events[_0x1bd276];var _0x293c4a=createListener(_0xc579('0x6')+_0x1c6d9c,_0x124ee5);ChatQueueEvents['on'](_0x1c6d9c,_0x293c4a);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index 8c09863..2a06027 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 _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(_0x4209a1,_0x5f5b36){var _0x99e3ac=function(_0x216c6c){while(--_0x216c6c){_0x4209a1['push'](_0x4209a1['shift']());}};_0x99e3ac(++_0x5f5b36);}(_0x55ca,0x126));var _0xa55c=function(_0x33593e,_0x22ddd3){_0x33593e=_0x33593e-0x0;var _0x53db1a=_0x55ca[_0x33593e];return _0x53db1a;};'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 +var _0x3e74=['../../config/environment','./chatQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getMembers','/:id/teams','getTeams','getAgents','post','addTeams','addAgents','put','delete','removeTeams','/:id/users','removeAgents','exports','multer','path','connect-timeout','express','../../components/auth/service'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x3e74,0x175));var _0x43e7=function(_0x1fd352,_0x2f87dc){_0x1fd352=_0x1fd352-0x0;var _0x201ca0=_0x3e74[_0x1fd352];return _0x201ca0;};'use strict';var multer=require(_0x43e7('0x0'));var util=require('util');var path=require(_0x43e7('0x1'));var timeout=require(_0x43e7('0x2'));var express=require(_0x43e7('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x43e7('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x43e7('0x5'));var controller=require(_0x43e7('0x6'));router[_0x43e7('0x7')]('/',auth[_0x43e7('0x8')](),controller[_0x43e7('0x9')]);router['get'](_0x43e7('0xa'),auth[_0x43e7('0x8')](),controller[_0x43e7('0xb')]);router[_0x43e7('0x7')](_0x43e7('0xc'),auth['isAuthenticated'](),controller[_0x43e7('0xd')]);router['get']('/:id/members',auth[_0x43e7('0x8')](),controller[_0x43e7('0xe')]);router['get'](_0x43e7('0xf'),auth['isAuthenticated'](),controller[_0x43e7('0x10')]);router[_0x43e7('0x7')]('/:id/users',auth[_0x43e7('0x8')](),controller[_0x43e7('0x11')]);router[_0x43e7('0x12')]('/',auth[_0x43e7('0x8')](),controller['create']);router['post'](_0x43e7('0xf'),auth[_0x43e7('0x8')](),controller[_0x43e7('0x13')]);router['post']('/:id/users',auth[_0x43e7('0x8')](),controller[_0x43e7('0x14')]);router[_0x43e7('0x15')](_0x43e7('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x43e7('0x16')](_0x43e7('0xc'),auth[_0x43e7('0x8')](),controller['destroy']);router['delete'](_0x43e7('0xf'),auth[_0x43e7('0x8')](),controller[_0x43e7('0x17')]);router[_0x43e7('0x16')](_0x43e7('0x18'),auth[_0x43e7('0x8')](),controller[_0x43e7('0x19')]);module[_0x43e7('0x1a')]=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index 2d9f044..bf5655a 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 _0x53c1=['STRING','DATE','moment','sequelize','exports'];(function(_0x5af81e,_0x3a0d0b){var _0x198f7c=function(_0x39269c){while(--_0x39269c){_0x5af81e['push'](_0x5af81e['shift']());}};_0x198f7c(++_0x3a0d0b);}(_0x53c1,0xb6));var _0x153c=function(_0x1e7e76,_0x10a2b6){_0x1e7e76=_0x1e7e76-0x0;var _0x12447e=_0x53c1[_0x1e7e76];return _0x12447e;};'use strict';var moment=require(_0x153c('0x0'));var Sequelize=require(_0x153c('0x1'));module[_0x153c('0x2')]={'uniqueid':{'type':Sequelize[_0x153c('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x153c('0x3')]},'joinAt':{'type':Sequelize[_0x153c('0x4')]},'leaveAt':{'type':Sequelize[_0x153c('0x4')]},'acceptAt':{'type':Sequelize[_0x153c('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x153c('0x3')]}}; \ No newline at end of file +var _0x7969=['exports','STRING','DATE','sequelize'];(function(_0x2e0da3,_0x3492f3){var _0x1ec9f1=function(_0x5cd088){while(--_0x5cd088){_0x2e0da3['push'](_0x2e0da3['shift']());}};_0x1ec9f1(++_0x3492f3);}(_0x7969,0x83));var _0x9796=function(_0x3568f5,_0x5df9f0){_0x3568f5=_0x3568f5-0x0;var _0x19242=_0x7969[_0x3568f5];return _0x19242;};'use strict';var moment=require('moment');var Sequelize=require(_0x9796('0x0'));module[_0x9796('0x1')]={'uniqueid':{'type':Sequelize[_0x9796('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x9796('0x2')]},'joinAt':{'type':Sequelize[_0x9796('0x3')]},'leaveAt':{'type':Sequelize[_0x9796('0x3')]},'acceptAt':{'type':Sequelize[_0x9796('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x9796('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index 37a5cb2..a5c8af0 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 _0xf8af=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','offset','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','ChatQueueReport','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','filter','merge','type','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','fs-extra','squel','crypto','jsforce','desk.js','to-csv'];(function(_0x57b025,_0x4451bb){var _0x334a21=function(_0x28f502){while(--_0x28f502){_0x57b025['push'](_0x57b025['shift']());}};_0x334a21(++_0x4451bb);}(_0xf8af,0x8b));var _0xff8a=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xf8af[_0x17d9e3];return _0x14192d;};'use strict';var emlformat=require(_0xff8a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xff8a('0x1'));var jsonpatch=require(_0xff8a('0x2'));var rp=require(_0xff8a('0x3'));var moment=require(_0xff8a('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xff8a('0x5'));var util=require(_0xff8a('0x6'));var path=require(_0xff8a('0x7'));var sox=require(_0xff8a('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xff8a('0x9'));var _=require('lodash');var squel=require(_0xff8a('0xa'));var crypto=require(_0xff8a('0xb'));var jsforce=require(_0xff8a('0xc'));var deskjs=require(_0xff8a('0xd'));var toCsv=require(_0xff8a('0xe'));var querystring=require(_0xff8a('0xf'));var Papa=require(_0xff8a('0x10'));var Redis=require(_0xff8a('0x11'));var authService=require(_0xff8a('0x12'));var qs=require(_0xff8a('0x13'));var as=require(_0xff8a('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xff8a('0x15'))(_0xff8a('0x16'));var utils=require(_0xff8a('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xff8a('0x18'));var db=require(_0xff8a('0x19'))['db'];function respondWithStatusCode(_0x252271,_0x40bf06){_0x40bf06=_0x40bf06||0xcc;return function(_0x244e69){if(_0x244e69){return _0x252271['sendStatus'](_0x40bf06);}return _0x252271[_0xff8a('0x1a')](_0x40bf06)[_0xff8a('0x1b')]();};}function respondWithResult(_0xf81533,_0x1cd47d){_0x1cd47d=_0x1cd47d||0xc8;return function(_0x5d793b){if(_0x5d793b){return _0xf81533['status'](_0x1cd47d)['json'](_0x5d793b);}};}function respondWithFilteredResult(_0x4a5e6e,_0x2f83df){return function(_0x569b15){if(_0x569b15){var _0x279441=typeof _0x2f83df[_0xff8a('0x1c')]==='undefined'&&typeof _0x2f83df[_0xff8a('0x1d')]==='undefined';var _0x5ed382=_0x569b15[_0xff8a('0x1e')];var _0x68524a=_0x279441?0x0:_0x2f83df[_0xff8a('0x1c')];var _0x55a187=_0x279441?_0x569b15[_0xff8a('0x1e')]:_0x2f83df['offset']+_0x2f83df[_0xff8a('0x1d')];var _0x4bb5ec;if(_0x55a187>=_0x5ed382){_0x55a187=_0x5ed382;_0x4bb5ec=0xc8;}else{_0x4bb5ec=0xce;}_0x4a5e6e[_0xff8a('0x1a')](_0x4bb5ec);return _0x4a5e6e[_0xff8a('0x1f')](_0xff8a('0x20'),_0x68524a+'-'+_0x55a187+'/'+_0x5ed382)[_0xff8a('0x21')](_0x569b15);}return null;};}function patchUpdates(_0x145d95){return function(_0x33ee52){try{jsonpatch[_0xff8a('0x22')](_0x33ee52,_0x145d95,!![]);}catch(_0x1ba1f1){return BPromise[_0xff8a('0x23')](_0x1ba1f1);}return _0x33ee52[_0xff8a('0x24')]();};}function saveUpdates(_0x1fc147,_0x2d0fc2){return function(_0x3bb4ac){if(_0x3bb4ac){return _0x3bb4ac[_0xff8a('0x25')](_0x1fc147)[_0xff8a('0x26')](function(_0x5e7897){return _0x5e7897;});}return null;};}function removeEntity(_0x10e205,_0x491322){return function(_0x2d6d8f){if(_0x2d6d8f){return _0x2d6d8f[_0xff8a('0x27')]()['then'](function(){_0x10e205[_0xff8a('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1c9ecc,_0x3f03ce){return function(_0x2c67c2){if(!_0x2c67c2){_0x1c9ecc[_0xff8a('0x28')](0x194);}return _0x2c67c2;};}function handleError(_0x375285,_0x55b267){_0x55b267=_0x55b267||0x1f4;return function(_0x2c57c9){logger[_0xff8a('0x29')](_0x2c57c9[_0xff8a('0x2a')]);if(_0x2c57c9['name']){delete _0x2c57c9[_0xff8a('0x2b')];}_0x375285[_0xff8a('0x1a')](_0x55b267)[_0xff8a('0x2c')](_0x2c57c9);};}exports[_0xff8a('0x2d')]=function(_0x38188f,_0xba33b6){var _0x20ac09={},_0x59b6d4={},_0x4ca17e={'count':0x0,'rows':[]};var _0x1fc2a8=_[_0xff8a('0x2e')](db[_0xff8a('0x2f')][_0xff8a('0x30')],function(_0x430cbd){return{'name':_0x430cbd[_0xff8a('0x31')],'type':_0x430cbd['type'][_0xff8a('0x32')]};});_0x59b6d4[_0xff8a('0x33')]=_['map'](_0x1fc2a8,_0xff8a('0x2b'));_0x59b6d4[_0xff8a('0x34')]=_[_0xff8a('0x35')](_0x38188f['query']);_0x59b6d4[_0xff8a('0x36')]=_[_0xff8a('0x37')](_0x59b6d4['model'],_0x59b6d4[_0xff8a('0x34')]);_0x20ac09[_0xff8a('0x38')]=_[_0xff8a('0x37')](_0x59b6d4[_0xff8a('0x33')],qs[_0xff8a('0x39')](_0x38188f[_0xff8a('0x34')][_0xff8a('0x39')]));_0x20ac09[_0xff8a('0x38')]=_0x20ac09[_0xff8a('0x38')]['length']?_0x20ac09[_0xff8a('0x38')]:_0x59b6d4[_0xff8a('0x33')];if(!_0x38188f['query'][_0xff8a('0x3a')](_0xff8a('0x3b'))){_0x20ac09[_0xff8a('0x1d')]=qs[_0xff8a('0x1d')](_0x38188f[_0xff8a('0x34')][_0xff8a('0x1d')]);_0x20ac09[_0xff8a('0x1c')]=qs[_0xff8a('0x1c')](_0x38188f[_0xff8a('0x34')]['offset']);}_0x20ac09['order']=qs[_0xff8a('0x3c')](_0x38188f[_0xff8a('0x34')]['sort']);_0x20ac09[_0xff8a('0x3d')]=qs[_0xff8a('0x36')](_['pick'](_0x38188f['query'],_0x59b6d4['filters']),_0x1fc2a8);if(_0x38188f[_0xff8a('0x34')][_0xff8a('0x3e')]){_0x20ac09['where']=_[_0xff8a('0x3f')](_0x20ac09[_0xff8a('0x3d')],{'$or':_[_0xff8a('0x2e')](_0x1fc2a8,function(_0x552710){if(_0x552710[_0xff8a('0x40')]!=='VIRTUAL'){var _0x2e7ac7={};_0x2e7ac7[_0x552710[_0xff8a('0x2b')]]={'$like':'%'+_0x38188f['query'][_0xff8a('0x3e')]+'%'};return _0x2e7ac7;}})});}_0x20ac09=_['merge']({},_0x20ac09,_0x38188f['options']);var _0x1ef830={'where':_0x20ac09[_0xff8a('0x3d')]};return db[_0xff8a('0x2f')][_0xff8a('0x1e')](_0x1ef830)[_0xff8a('0x26')](function(_0x4a28d0){_0x4ca17e[_0xff8a('0x1e')]=_0x4a28d0;if(_0x38188f['query'][_0xff8a('0x41')]){_0x20ac09[_0xff8a('0x42')]=[{'all':!![]}];}return db[_0xff8a('0x2f')][_0xff8a('0x43')](_0x20ac09);})[_0xff8a('0x26')](function(_0x2ab2e6){_0x4ca17e[_0xff8a('0x44')]=_0x2ab2e6;return _0x4ca17e;})['then'](respondWithFilteredResult(_0xba33b6,_0x20ac09))[_0xff8a('0x45')](handleError(_0xba33b6,null));};exports[_0xff8a('0x46')]=function(_0x2ba136,_0x273f26){var _0x2705e8={'raw':!![],'where':{'id':_0x2ba136[_0xff8a('0x47')]['id']}},_0x3a3152={};_0x3a3152[_0xff8a('0x33')]=_[_0xff8a('0x35')](db['ChatQueueReport'][_0xff8a('0x30')]);_0x3a3152['query']=_[_0xff8a('0x35')](_0x2ba136[_0xff8a('0x34')]);_0x3a3152[_0xff8a('0x36')]=_[_0xff8a('0x37')](_0x3a3152[_0xff8a('0x33')],_0x3a3152[_0xff8a('0x34')]);_0x2705e8[_0xff8a('0x38')]=_[_0xff8a('0x37')](_0x3a3152[_0xff8a('0x33')],qs[_0xff8a('0x39')](_0x2ba136[_0xff8a('0x34')]['fields']));_0x2705e8[_0xff8a('0x38')]=_0x2705e8[_0xff8a('0x38')][_0xff8a('0x48')]?_0x2705e8[_0xff8a('0x38')]:_0x3a3152[_0xff8a('0x33')];if(_0x2ba136['query'][_0xff8a('0x41')]){_0x2705e8[_0xff8a('0x42')]=[{'all':!![]}];}_0x2705e8=_[_0xff8a('0x3f')]({},_0x2705e8,_0x2ba136['options']);return db['ChatQueueReport'][_0xff8a('0x49')](_0x2705e8)[_0xff8a('0x26')](handleEntityNotFound(_0x273f26,null))[_0xff8a('0x26')](respondWithResult(_0x273f26,null))[_0xff8a('0x45')](handleError(_0x273f26,null));};exports['create']=function(_0x9873eb,_0x14c189){return db[_0xff8a('0x2f')][_0xff8a('0x4a')](_0x9873eb[_0xff8a('0x4b')],{})[_0xff8a('0x26')](respondWithResult(_0x14c189,0xc9))[_0xff8a('0x45')](handleError(_0x14c189,null));};exports[_0xff8a('0x25')]=function(_0x349573,_0x17fd91){if(_0x349573[_0xff8a('0x4b')]['id']){delete _0x349573['body']['id'];}return db[_0xff8a('0x2f')][_0xff8a('0x49')]({'where':{'id':_0x349573['params']['id']}})[_0xff8a('0x26')](handleEntityNotFound(_0x17fd91,null))[_0xff8a('0x26')](saveUpdates(_0x349573['body'],null))[_0xff8a('0x26')](respondWithResult(_0x17fd91,null))[_0xff8a('0x45')](handleError(_0x17fd91,null));};exports[_0xff8a('0x27')]=function(_0x90ea1f,_0x29cc35){return db[_0xff8a('0x2f')][_0xff8a('0x49')]({'where':{'id':_0x90ea1f[_0xff8a('0x47')]['id']}})[_0xff8a('0x26')](handleEntityNotFound(_0x29cc35,null))[_0xff8a('0x26')](removeEntity(_0x29cc35,null))[_0xff8a('0x45')](handleError(_0x29cc35,null));};exports[_0xff8a('0x4c')]=function(_0x3d415,_0x2e47ca){return db['ChatQueueReport'][_0xff8a('0x4c')]()[_0xff8a('0x26')](respondWithResult(_0x2e47ca,null))[_0xff8a('0x45')](handleError(_0x2e47ca,null));}; \ No newline at end of file +var _0xbd9e=['undefined','limit','count','set','apply','save','update','then','error','name','send','index','map','ChatQueueReport','rawAttributes','fieldName','type','key','model','keys','filters','intersection','attributes','fields','query','hasOwnProperty','nolimit','order','sort','where','VIRTUAL','merge','options','findAll','rows','catch','length','includeAll','include','find','create','body','params','destroy','describe','zip-dir','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset'];(function(_0x16ac8f,_0x52964d){var _0x39d3f5=function(_0x325766){while(--_0x325766){_0x16ac8f['push'](_0x16ac8f['shift']());}};_0x39d3f5(++_0x52964d);}(_0xbd9e,0x108));var _0xebd9=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0xbd9e[_0x373dee];return _0x46798f;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xebd9('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xebd9('0x1'));var moment=require(_0xebd9('0x2'));var BPromise=require(_0xebd9('0x3'));var Mustache=require(_0xebd9('0x4'));var util=require(_0xebd9('0x5'));var path=require('path');var sox=require(_0xebd9('0x6'));var csv=require('to-csv');var ejs=require(_0xebd9('0x7'));var fs=require('fs');var fs_extra=require(_0xebd9('0x8'));var _=require(_0xebd9('0x9'));var squel=require(_0xebd9('0xa'));var crypto=require(_0xebd9('0xb'));var jsforce=require(_0xebd9('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xebd9('0xd'));var querystring=require(_0xebd9('0xe'));var Papa=require(_0xebd9('0xf'));var Redis=require(_0xebd9('0x10'));var authService=require(_0xebd9('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xebd9('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xebd9('0x13'))('api');var utils=require(_0xebd9('0x14'));var config=require(_0xebd9('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xebd9('0x16'))['db'];function respondWithStatusCode(_0x11b8ed,_0x4b1c92){_0x4b1c92=_0x4b1c92||0xcc;return function(_0xd5a048){if(_0xd5a048){return _0x11b8ed[_0xebd9('0x17')](_0x4b1c92);}return _0x11b8ed[_0xebd9('0x18')](_0x4b1c92)[_0xebd9('0x19')]();};}function respondWithResult(_0x5cf3f7,_0x324363){_0x324363=_0x324363||0xc8;return function(_0xdfe08e){if(_0xdfe08e){return _0x5cf3f7[_0xebd9('0x18')](_0x324363)[_0xebd9('0x1a')](_0xdfe08e);}};}function respondWithFilteredResult(_0x1f5dd1,_0x237d00){return function(_0x29fde8){if(_0x29fde8){var _0x35095e=typeof _0x237d00[_0xebd9('0x1b')]===_0xebd9('0x1c')&&typeof _0x237d00[_0xebd9('0x1d')]===_0xebd9('0x1c');var _0x296341=_0x29fde8[_0xebd9('0x1e')];var _0x4d04cb=_0x35095e?0x0:_0x237d00[_0xebd9('0x1b')];var _0x8310f2=_0x35095e?_0x29fde8[_0xebd9('0x1e')]:_0x237d00['offset']+_0x237d00[_0xebd9('0x1d')];var _0x58086a;if(_0x8310f2>=_0x296341){_0x8310f2=_0x296341;_0x58086a=0xc8;}else{_0x58086a=0xce;}_0x1f5dd1[_0xebd9('0x18')](_0x58086a);return _0x1f5dd1[_0xebd9('0x1f')]('Content-Range',_0x4d04cb+'-'+_0x8310f2+'/'+_0x296341)['json'](_0x29fde8);}return null;};}function patchUpdates(_0x5701cd){return function(_0x23b478){try{jsonpatch[_0xebd9('0x20')](_0x23b478,_0x5701cd,!![]);}catch(_0x36bc37){return BPromise['reject'](_0x36bc37);}return _0x23b478[_0xebd9('0x21')]();};}function saveUpdates(_0x44fa41,_0x3fb488){return function(_0x2c17c8){if(_0x2c17c8){return _0x2c17c8[_0xebd9('0x22')](_0x44fa41)[_0xebd9('0x23')](function(_0x5ec121){return _0x5ec121;});}return null;};}function removeEntity(_0x1a3895,_0x259d17){return function(_0x588091){if(_0x588091){return _0x588091['destroy']()[_0xebd9('0x23')](function(){_0x1a3895[_0xebd9('0x18')](0xcc)[_0xebd9('0x19')]();});}};}function handleEntityNotFound(_0x1f2bbb,_0x4b54d7){return function(_0x1ac789){if(!_0x1ac789){_0x1f2bbb[_0xebd9('0x17')](0x194);}return _0x1ac789;};}function handleError(_0x2ef023,_0x1d2330){_0x1d2330=_0x1d2330||0x1f4;return function(_0x5548ae){logger[_0xebd9('0x24')](_0x5548ae['stack']);if(_0x5548ae['name']){delete _0x5548ae[_0xebd9('0x25')];}_0x2ef023[_0xebd9('0x18')](_0x1d2330)[_0xebd9('0x26')](_0x5548ae);};}exports[_0xebd9('0x27')]=function(_0x472601,_0x576834){var _0x5310a8={},_0x4e12bf={},_0x222d94={'count':0x0,'rows':[]};var _0x278edb=_[_0xebd9('0x28')](db[_0xebd9('0x29')][_0xebd9('0x2a')],function(_0xf17a69){return{'name':_0xf17a69[_0xebd9('0x2b')],'type':_0xf17a69[_0xebd9('0x2c')][_0xebd9('0x2d')]};});_0x4e12bf[_0xebd9('0x2e')]=_[_0xebd9('0x28')](_0x278edb,_0xebd9('0x25'));_0x4e12bf['query']=_[_0xebd9('0x2f')](_0x472601['query']);_0x4e12bf[_0xebd9('0x30')]=_[_0xebd9('0x31')](_0x4e12bf['model'],_0x4e12bf['query']);_0x5310a8[_0xebd9('0x32')]=_[_0xebd9('0x31')](_0x4e12bf[_0xebd9('0x2e')],qs[_0xebd9('0x33')](_0x472601[_0xebd9('0x34')][_0xebd9('0x33')]));_0x5310a8[_0xebd9('0x32')]=_0x5310a8[_0xebd9('0x32')]['length']?_0x5310a8[_0xebd9('0x32')]:_0x4e12bf[_0xebd9('0x2e')];if(!_0x472601[_0xebd9('0x34')][_0xebd9('0x35')](_0xebd9('0x36'))){_0x5310a8[_0xebd9('0x1d')]=qs[_0xebd9('0x1d')](_0x472601[_0xebd9('0x34')][_0xebd9('0x1d')]);_0x5310a8['offset']=qs[_0xebd9('0x1b')](_0x472601['query'][_0xebd9('0x1b')]);}_0x5310a8[_0xebd9('0x37')]=qs[_0xebd9('0x38')](_0x472601[_0xebd9('0x34')]['sort']);_0x5310a8[_0xebd9('0x39')]=qs[_0xebd9('0x30')](_['pick'](_0x472601[_0xebd9('0x34')],_0x4e12bf[_0xebd9('0x30')]),_0x278edb);if(_0x472601[_0xebd9('0x34')]['filter']){_0x5310a8[_0xebd9('0x39')]=_['merge'](_0x5310a8[_0xebd9('0x39')],{'$or':_[_0xebd9('0x28')](_0x278edb,function(_0x4f0eb0){if(_0x4f0eb0[_0xebd9('0x2c')]!==_0xebd9('0x3a')){var _0x115e7c={};_0x115e7c[_0x4f0eb0['name']]={'$like':'%'+_0x472601[_0xebd9('0x34')]['filter']+'%'};return _0x115e7c;}})});}_0x5310a8=_[_0xebd9('0x3b')]({},_0x5310a8,_0x472601[_0xebd9('0x3c')]);var _0x2c4f60={'where':_0x5310a8[_0xebd9('0x39')]};return db[_0xebd9('0x29')][_0xebd9('0x1e')](_0x2c4f60)[_0xebd9('0x23')](function(_0x57d0a0){_0x222d94[_0xebd9('0x1e')]=_0x57d0a0;if(_0x472601[_0xebd9('0x34')]['includeAll']){_0x5310a8['include']=[{'all':!![]}];}return db['ChatQueueReport'][_0xebd9('0x3d')](_0x5310a8);})[_0xebd9('0x23')](function(_0x1be720){_0x222d94[_0xebd9('0x3e')]=_0x1be720;return _0x222d94;})[_0xebd9('0x23')](respondWithFilteredResult(_0x576834,_0x5310a8))[_0xebd9('0x3f')](handleError(_0x576834,null));};exports['show']=function(_0x3f9f3d,_0x56ba3b){var _0x33ef42={'raw':!![],'where':{'id':_0x3f9f3d['params']['id']}},_0x1f0fcc={};_0x1f0fcc['model']=_['keys'](db[_0xebd9('0x29')][_0xebd9('0x2a')]);_0x1f0fcc[_0xebd9('0x34')]=_[_0xebd9('0x2f')](_0x3f9f3d[_0xebd9('0x34')]);_0x1f0fcc[_0xebd9('0x30')]=_[_0xebd9('0x31')](_0x1f0fcc[_0xebd9('0x2e')],_0x1f0fcc['query']);_0x33ef42[_0xebd9('0x32')]=_['intersection'](_0x1f0fcc[_0xebd9('0x2e')],qs[_0xebd9('0x33')](_0x3f9f3d[_0xebd9('0x34')]['fields']));_0x33ef42[_0xebd9('0x32')]=_0x33ef42[_0xebd9('0x32')][_0xebd9('0x40')]?_0x33ef42['attributes']:_0x1f0fcc[_0xebd9('0x2e')];if(_0x3f9f3d[_0xebd9('0x34')][_0xebd9('0x41')]){_0x33ef42[_0xebd9('0x42')]=[{'all':!![]}];}_0x33ef42=_[_0xebd9('0x3b')]({},_0x33ef42,_0x3f9f3d[_0xebd9('0x3c')]);return db[_0xebd9('0x29')][_0xebd9('0x43')](_0x33ef42)['then'](handleEntityNotFound(_0x56ba3b,null))[_0xebd9('0x23')](respondWithResult(_0x56ba3b,null))['catch'](handleError(_0x56ba3b,null));};exports[_0xebd9('0x44')]=function(_0x4bcc0d,_0xdcae7c){return db[_0xebd9('0x29')][_0xebd9('0x44')](_0x4bcc0d[_0xebd9('0x45')],{})[_0xebd9('0x23')](respondWithResult(_0xdcae7c,0xc9))[_0xebd9('0x3f')](handleError(_0xdcae7c,null));};exports['update']=function(_0x1d2fed,_0x59df76){if(_0x1d2fed[_0xebd9('0x45')]['id']){delete _0x1d2fed[_0xebd9('0x45')]['id'];}return db[_0xebd9('0x29')][_0xebd9('0x43')]({'where':{'id':_0x1d2fed[_0xebd9('0x46')]['id']}})[_0xebd9('0x23')](handleEntityNotFound(_0x59df76,null))[_0xebd9('0x23')](saveUpdates(_0x1d2fed[_0xebd9('0x45')],null))[_0xebd9('0x23')](respondWithResult(_0x59df76,null))[_0xebd9('0x3f')](handleError(_0x59df76,null));};exports[_0xebd9('0x47')]=function(_0x13ade2,_0xe6821f){return db[_0xebd9('0x29')]['find']({'where':{'id':_0x13ade2['params']['id']}})[_0xebd9('0x23')](handleEntityNotFound(_0xe6821f,null))['then'](removeEntity(_0xe6821f,null))[_0xebd9('0x3f')](handleError(_0xe6821f,null));};exports[_0xebd9('0x48')]=function(_0x3fd2ce,_0x104085){return db[_0xebd9('0x29')][_0xebd9('0x48')]()[_0xebd9('0x23')](respondWithResult(_0x104085,null))['catch'](handleError(_0x104085,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index c7bcf32..ef3cf57 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 _0x0713=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define','ChatQueueReport','report_chat_queue','uniqueid'];(function(_0x2c6120,_0x1f3e60){var _0x5fb114=function(_0x45a72d){while(--_0x45a72d){_0x2c6120['push'](_0x2c6120['shift']());}};_0x5fb114(++_0x1f3e60);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3071('0x0'))(_0x3071('0x1'));var moment=require(_0x3071('0x2'));var BPromise=require(_0x3071('0x3'));var rp=require(_0x3071('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var attributes=require(_0x3071('0x7'));module[_0x3071('0x8')]=function(_0xabd7b6,_0x41cf76){return _0xabd7b6[_0x3071('0x9')](_0x3071('0xa'),attributes,{'tableName':_0x3071('0xb'),'paranoid':![],'indexes':[{'name':_0x3071('0xc'),'fields':[_0x3071('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0713=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define','ChatQueueReport','report_chat_queue','uniqueid'];(function(_0x143a91,_0x235332){var _0x1906f5=function(_0xd27eeb){while(--_0xd27eeb){_0x143a91['push'](_0x143a91['shift']());}};_0x1906f5(++_0x235332);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3071('0x0'))(_0x3071('0x1'));var moment=require(_0x3071('0x2'));var BPromise=require(_0x3071('0x3'));var rp=require(_0x3071('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var attributes=require(_0x3071('0x7'));module[_0x3071('0x8')]=function(_0xabd7b6,_0x41cf76){return _0xabd7b6[_0x3071('0x9')](_0x3071('0xa'),attributes,{'tableName':_0x3071('0xb'),'paranoid':![],'indexes':[{'name':_0x3071('0xc'),'fields':[_0x3071('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index fd42c40..b471080 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 _0x46af=['raw','stringify','UpdateChatQueueReport','update','body','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','request','then','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','CreateChatQueueReport','ChatQueueReport','create','options'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x46af,0x18b));var _0xf46a=function(_0x3deb71,_0x4589a1){_0x3deb71=_0x3deb71-0x0;var _0xaf607=_0x46af[_0x3deb71];return _0xaf607;};'use strict';var _=require(_0xf46a('0x0'));var util=require('util');var moment=require(_0xf46a('0x1'));var BPromise=require(_0xf46a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf46a('0x3'));var db=require(_0xf46a('0x4'))['db'];var utils=require(_0xf46a('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4de2a7,_0x5d66cb,_0x23fac2){return new BPromise(function(_0x5bf546,_0x396f1c){return client[_0xf46a('0x6')](_0x4de2a7,_0x23fac2)[_0xf46a('0x7')](function(_0x33234e){logger[_0xf46a('0x8')](_0xf46a('0x9'),_0x5d66cb,_0xf46a('0xa'));logger[_0xf46a('0xb')](_0xf46a('0xc'),_0x5d66cb,_0xf46a('0xa'),JSON['stringify'](_0x33234e));if(_0x33234e[_0xf46a('0xd')]){if(_0x33234e[_0xf46a('0xd')][_0xf46a('0xe')]===0x1f4){logger['error']('ChatQueueReport,\x20%s,\x20%s',_0x5d66cb,_0x33234e[_0xf46a('0xd')][_0xf46a('0xf')]);return _0x396f1c(_0x33234e[_0xf46a('0xd')]['message']);}logger[_0xf46a('0xd')](_0xf46a('0x9'),_0x5d66cb,_0x33234e['error'][_0xf46a('0xf')]);return _0x5bf546(_0x33234e[_0xf46a('0xd')]['message']);}else{logger[_0xf46a('0x8')](_0xf46a('0x9'),_0x5d66cb,_0xf46a('0xa'));_0x5bf546(_0x33234e['result']['message']);}})[_0xf46a('0x10')](function(_0x249a95){logger[_0xf46a('0xd')](_0xf46a('0x9'),_0x5d66cb,_0x249a95);_0x396f1c(_0x249a95);});});}exports[_0xf46a('0x11')]=function(_0x5a09ff){var _0x5acf65=this;return new Promise(function(_0x187fb6,_0x47be53){return db[_0xf46a('0x12')][_0xf46a('0x13')](_0x5a09ff['body'],{'raw':_0x5a09ff[_0xf46a('0x14')]?_0x5a09ff[_0xf46a('0x14')][_0xf46a('0x15')]===undefined?!![]:![]:!![]})['then'](function(_0x3a7fa9){logger[_0xf46a('0x8')](_0xf46a('0x11'),_0x5a09ff);logger[_0xf46a('0xb')](_0xf46a('0x11'),_0x5a09ff,JSON[_0xf46a('0x16')](_0x3a7fa9));_0x187fb6(_0x3a7fa9);})[_0xf46a('0x10')](function(_0x2b9212){logger[_0xf46a('0xd')]('CreateChatQueueReport',_0x2b9212[_0xf46a('0xf')],_0x5a09ff);_0x47be53(_0x5acf65[_0xf46a('0xd')](0x1f4,_0x2b9212[_0xf46a('0xf')]));});});};exports[_0xf46a('0x17')]=function(_0x3c7228){var _0x2a40e9=this;return new Promise(function(_0x5c9d11,_0x39dba6){return db[_0xf46a('0x12')][_0xf46a('0x18')](_0x3c7228[_0xf46a('0x19')],{'raw':_0x3c7228[_0xf46a('0x14')]?_0x3c7228[_0xf46a('0x14')][_0xf46a('0x15')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3c7228[_0xf46a('0x14')]?_0x3c7228[_0xf46a('0x14')]['where']||null:null,'attributes':_0x3c7228[_0xf46a('0x14')]?_0x3c7228['options']['attributes']||null:null,'limit':_0x3c7228['options']?_0x3c7228[_0xf46a('0x14')]['limit']||null:null})['then'](function(_0x196a26){logger['info']('UpdateChatQueueReport',_0x3c7228);logger[_0xf46a('0xb')](_0xf46a('0x17'),_0x3c7228,JSON[_0xf46a('0x16')](_0x196a26));_0x5c9d11(_0x196a26);})[_0xf46a('0x10')](function(_0x4dc68d){logger['error']('UpdateChatQueueReport',_0x4dc68d[_0xf46a('0xf')],_0x3c7228);_0x39dba6(_0x2a40e9[_0xf46a('0xd')](0x1f4,_0x4dc68d[_0xf46a('0xf')]));});});}; \ No newline at end of file +var _0x13e3=['jayson/promise','client','http','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','code','error','message','CreateChatQueueReport','ChatQueueReport','create','options','then','catch','UpdateChatQueueReport','body','where','attributes','limit','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment'];(function(_0x3d2872,_0x1ceb0b){var _0x1b0eac=function(_0x419819){while(--_0x419819){_0x3d2872['push'](_0x3d2872['shift']());}};_0x1b0eac(++_0x1ceb0b);}(_0x13e3,0x6e));var _0x313e=function(_0x8abd64,_0x539570){_0x8abd64=_0x8abd64-0x0;var _0xd2511e=_0x13e3[_0x8abd64];return _0xd2511e;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x313e('0x0'));var BPromise=require(_0x313e('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x313e('0x2'));var db=require(_0x313e('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x313e('0x4'))('rpc');var config=require(_0x313e('0x5'));var jayson=require(_0x313e('0x6'));var client=jayson[_0x313e('0x7')][_0x313e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x113baf,_0x488c20,_0x29519d){return new BPromise(function(_0x159eaf,_0x52e29b){return client['request'](_0x113baf,_0x29519d)['then'](function(_0x1d2da5){logger[_0x313e('0x9')](_0x313e('0xa'),_0x488c20,_0x313e('0xb'));logger[_0x313e('0xc')](_0x313e('0xd'),_0x488c20,_0x313e('0xb'),JSON[_0x313e('0xe')](_0x1d2da5));if(_0x1d2da5['error']){if(_0x1d2da5['error'][_0x313e('0xf')]===0x1f4){logger[_0x313e('0x10')]('ChatQueueReport,\x20%s,\x20%s',_0x488c20,_0x1d2da5[_0x313e('0x10')]['message']);return _0x52e29b(_0x1d2da5[_0x313e('0x10')][_0x313e('0x11')]);}logger[_0x313e('0x10')](_0x313e('0xa'),_0x488c20,_0x1d2da5[_0x313e('0x10')][_0x313e('0x11')]);return _0x159eaf(_0x1d2da5[_0x313e('0x10')][_0x313e('0x11')]);}else{logger[_0x313e('0x9')]('ChatQueueReport,\x20%s,\x20%s',_0x488c20,_0x313e('0xb'));_0x159eaf(_0x1d2da5['result'][_0x313e('0x11')]);}})['catch'](function(_0x28ac07){logger['error'](_0x313e('0xa'),_0x488c20,_0x28ac07);_0x52e29b(_0x28ac07);});});}exports[_0x313e('0x12')]=function(_0x133177){var _0xbbc81a=this;return new Promise(function(_0x541583,_0x23248f){return db[_0x313e('0x13')][_0x313e('0x14')](_0x133177['body'],{'raw':_0x133177[_0x313e('0x15')]?_0x133177[_0x313e('0x15')]['raw']===undefined?!![]:![]:!![]})[_0x313e('0x16')](function(_0x4e5673){logger[_0x313e('0x9')](_0x313e('0x12'),_0x133177);logger[_0x313e('0xc')](_0x313e('0x12'),_0x133177,JSON[_0x313e('0xe')](_0x4e5673));_0x541583(_0x4e5673);})[_0x313e('0x17')](function(_0x1929d4){logger[_0x313e('0x10')]('CreateChatQueueReport',_0x1929d4['message'],_0x133177);_0x23248f(_0xbbc81a[_0x313e('0x10')](0x1f4,_0x1929d4[_0x313e('0x11')]));});});};exports[_0x313e('0x18')]=function(_0x8375a2){var _0x5accf8=this;return new Promise(function(_0x478b3e,_0x325551){return db[_0x313e('0x13')]['update'](_0x8375a2[_0x313e('0x19')],{'raw':_0x8375a2[_0x313e('0x15')]?_0x8375a2[_0x313e('0x15')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x8375a2[_0x313e('0x15')]?_0x8375a2[_0x313e('0x15')][_0x313e('0x1a')]||null:null,'attributes':_0x8375a2[_0x313e('0x15')]?_0x8375a2[_0x313e('0x15')][_0x313e('0x1b')]||null:null,'limit':_0x8375a2[_0x313e('0x15')]?_0x8375a2[_0x313e('0x15')][_0x313e('0x1c')]||null:null})[_0x313e('0x16')](function(_0x293caa){logger[_0x313e('0x9')](_0x313e('0x18'),_0x8375a2);logger['debug'](_0x313e('0x18'),_0x8375a2,JSON['stringify'](_0x293caa));_0x478b3e(_0x293caa);})[_0x313e('0x17')](function(_0x1a023c){logger[_0x313e('0x10')]('UpdateChatQueueReport',_0x1a023c['message'],_0x8375a2);_0x325551(_0x5accf8[_0x313e('0x10')](0x1f4,_0x1a023c[_0x313e('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index c306961..f80e82c 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 _0x2656=['post','create','delete','destroy','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueueReport.controller','index','get','/describe','isAuthenticated','describe','/:id'];(function(_0x5fbb7b,_0x492570){var _0xd9ad13=function(_0x355f8a){while(--_0x355f8a){_0x5fbb7b['push'](_0x5fbb7b['shift']());}};_0xd9ad13(++_0x492570);}(_0x2656,0x77));var _0x6265=function(_0x1bc013,_0x7771c6){_0x1bc013=_0x1bc013-0x0;var _0x55df36=_0x2656[_0x1bc013];return _0x55df36;};'use strict';var multer=require(_0x6265('0x0'));var util=require(_0x6265('0x1'));var path=require(_0x6265('0x2'));var timeout=require('connect-timeout');var express=require(_0x6265('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x6265('0x4'));var interaction=require(_0x6265('0x5'));var config=require(_0x6265('0x6'));var controller=require(_0x6265('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x6265('0x8')]);router[_0x6265('0x9')](_0x6265('0xa'),auth[_0x6265('0xb')](),controller[_0x6265('0xc')]);router[_0x6265('0x9')](_0x6265('0xd'),auth[_0x6265('0xb')](),controller['show']);router[_0x6265('0xe')]('/',auth[_0x6265('0xb')](),controller[_0x6265('0xf')]);router['put']('/:id',auth[_0x6265('0xb')](),controller['update']);router[_0x6265('0x10')](_0x6265('0xd'),auth[_0x6265('0xb')](),controller[_0x6265('0x11')]);module[_0x6265('0x12')]=router; \ No newline at end of file +var _0x37e7=['multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueueReport.controller','get','index','/describe','isAuthenticated','/:id','show','put','update','exports'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x37e7,0x110));var _0x737e=function(_0x3f4a1e,_0x297d58){_0x3f4a1e=_0x3f4a1e-0x0;var _0x2a0620=_0x37e7[_0x3f4a1e];return _0x2a0620;};'use strict';var multer=require(_0x737e('0x0'));var util=require(_0x737e('0x1'));var path=require(_0x737e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x737e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x737e('0x4'));var interaction=require(_0x737e('0x5'));var config=require(_0x737e('0x6'));var controller=require(_0x737e('0x7'));router[_0x737e('0x8')]('/',auth['isAuthenticated'](),controller[_0x737e('0x9')]);router[_0x737e('0x8')](_0x737e('0xa'),auth[_0x737e('0xb')](),controller['describe']);router['get'](_0x737e('0xc'),auth[_0x737e('0xb')](),controller[_0x737e('0xd')]);router['post']('/',auth[_0x737e('0xb')](),controller['create']);router[_0x737e('0xe')](_0x737e('0xc'),auth['isAuthenticated'](),controller[_0x737e('0xf')]);router['delete'](_0x737e('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x737e('0x10')]=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index 5a8af18..0d62d23 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 _0x54ef=['agent','queue','DATE','NOW','moment','sequelize','exports','ENUM','account'];(function(_0x9be3f0,_0x628568){var _0x96930b=function(_0x58855e){while(--_0x58855e){_0x9be3f0['push'](_0x9be3f0['shift']());}};_0x96930b(++_0x628568);}(_0x54ef,0x112));var _0xf54e=function(_0x12fee9,_0xe08a7a){_0x12fee9=_0x12fee9-0x0;var _0x2b3b05=_0x54ef[_0x12fee9];return _0x2b3b05;};'use strict';var moment=require(_0xf54e('0x0'));var Sequelize=require(_0xf54e('0x1'));module[_0xf54e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xf54e('0x3')](_0xf54e('0x4'),_0xf54e('0x5'),_0xf54e('0x6')),'allowNull':![],'defaultValue':_0xf54e('0x6')},'transferredAt':{'type':Sequelize[_0xf54e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xf54e('0x8')]}}; \ No newline at end of file +var _0xb43b=['DATE','NOW','moment','sequelize','STRING','ENUM','account','queue'];(function(_0x2906e6,_0x5ccd59){var _0x12517a=function(_0x36d576){while(--_0x36d576){_0x2906e6['push'](_0x2906e6['shift']());}};_0x12517a(++_0x5ccd59);}(_0xb43b,0x1b2));var _0xbb43=function(_0x263f14,_0x27a071){_0x263f14=_0x263f14-0x0;var _0x4125ca=_0xb43b[_0x263f14];return _0x4125ca;};'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/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index 18d69b1..f4e5ec9 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 _0xd7f5=['intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','includeAll','catch','show','params','keys','include','options','create','body','find','describe','rimraf','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','reject','save','update','then','destroy','error','stack','name','send','index','map','ChatTransferReport','rawAttributes','fieldName','key','model','query','filters'];(function(_0x258d6f,_0x94f80a){var _0x3dcc7b=function(_0xe5a63a){while(--_0xe5a63a){_0x258d6f['push'](_0x258d6f['shift']());}};_0x3dcc7b(++_0x94f80a);}(_0xd7f5,0xaa));var _0x5d7f=function(_0xd60031,_0x5efb93){_0xd60031=_0xd60031-0x0;var _0x43d00a=_0xd7f5[_0xd60031];return _0x43d00a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5d7f('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x5d7f('0x1'));var moment=require(_0x5d7f('0x2'));var BPromise=require(_0x5d7f('0x3'));var Mustache=require(_0x5d7f('0x4'));var util=require('util');var path=require(_0x5d7f('0x5'));var sox=require(_0x5d7f('0x6'));var csv=require(_0x5d7f('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5d7f('0x8'));var _=require(_0x5d7f('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x5d7f('0xa'));var deskjs=require(_0x5d7f('0xb'));var toCsv=require(_0x5d7f('0x7'));var querystring=require(_0x5d7f('0xc'));var Papa=require(_0x5d7f('0xd'));var Redis=require('ioredis');var authService=require(_0x5d7f('0xe'));var qs=require(_0x5d7f('0xf'));var as=require(_0x5d7f('0x10'));var hardwareService=require(_0x5d7f('0x11'));var logger=require(_0x5d7f('0x12'))(_0x5d7f('0x13'));var utils=require(_0x5d7f('0x14'));var config=require(_0x5d7f('0x15'));var licenseUtil=require(_0x5d7f('0x16'));var db=require(_0x5d7f('0x17'))['db'];function respondWithStatusCode(_0x427fb3,_0x1d0438){_0x1d0438=_0x1d0438||0xcc;return function(_0x2742d4){if(_0x2742d4){return _0x427fb3[_0x5d7f('0x18')](_0x1d0438);}return _0x427fb3[_0x5d7f('0x19')](_0x1d0438)[_0x5d7f('0x1a')]();};}function respondWithResult(_0x2b5412,_0x4b7402){_0x4b7402=_0x4b7402||0xc8;return function(_0x3a225d){if(_0x3a225d){return _0x2b5412[_0x5d7f('0x19')](_0x4b7402)['json'](_0x3a225d);}};}function respondWithFilteredResult(_0x24484b,_0x1897e7){return function(_0x286b6d){if(_0x286b6d){var _0x2d100b=typeof _0x1897e7['offset']===_0x5d7f('0x1b')&&typeof _0x1897e7[_0x5d7f('0x1c')]===_0x5d7f('0x1b');var _0x282dba=_0x286b6d[_0x5d7f('0x1d')];var _0x2c81e6=_0x2d100b?0x0:_0x1897e7[_0x5d7f('0x1e')];var _0x215cc5=_0x2d100b?_0x286b6d['count']:_0x1897e7['offset']+_0x1897e7[_0x5d7f('0x1c')];var _0x57c064;if(_0x215cc5>=_0x282dba){_0x215cc5=_0x282dba;_0x57c064=0xc8;}else{_0x57c064=0xce;}_0x24484b[_0x5d7f('0x19')](_0x57c064);return _0x24484b[_0x5d7f('0x1f')](_0x5d7f('0x20'),_0x2c81e6+'-'+_0x215cc5+'/'+_0x282dba)[_0x5d7f('0x21')](_0x286b6d);}return null;};}function patchUpdates(_0x99e74a){return function(_0x1fc3b1){try{jsonpatch['apply'](_0x1fc3b1,_0x99e74a,!![]);}catch(_0x28b998){return BPromise[_0x5d7f('0x22')](_0x28b998);}return _0x1fc3b1[_0x5d7f('0x23')]();};}function saveUpdates(_0x5713a9,_0x161bec){return function(_0x1b9856){if(_0x1b9856){return _0x1b9856[_0x5d7f('0x24')](_0x5713a9)[_0x5d7f('0x25')](function(_0x3297d3){return _0x3297d3;});}return null;};}function removeEntity(_0x411aef,_0x490d44){return function(_0x940f89){if(_0x940f89){return _0x940f89[_0x5d7f('0x26')]()[_0x5d7f('0x25')](function(){_0x411aef['status'](0xcc)[_0x5d7f('0x1a')]();});}};}function handleEntityNotFound(_0x472d2e,_0x46818e){return function(_0x3152c7){if(!_0x3152c7){_0x472d2e[_0x5d7f('0x18')](0x194);}return _0x3152c7;};}function handleError(_0x5119c1,_0x3075ab){_0x3075ab=_0x3075ab||0x1f4;return function(_0x47c487){logger[_0x5d7f('0x27')](_0x47c487[_0x5d7f('0x28')]);if(_0x47c487[_0x5d7f('0x29')]){delete _0x47c487[_0x5d7f('0x29')];}_0x5119c1['status'](_0x3075ab)[_0x5d7f('0x2a')](_0x47c487);};}exports[_0x5d7f('0x2b')]=function(_0x26285f,_0x53207f){var _0x444da6={},_0xf813e6={},_0x4072e0={'count':0x0,'rows':[]};var _0x242b87=_[_0x5d7f('0x2c')](db[_0x5d7f('0x2d')][_0x5d7f('0x2e')],function(_0x5f53b6){return{'name':_0x5f53b6[_0x5d7f('0x2f')],'type':_0x5f53b6['type'][_0x5d7f('0x30')]};});_0xf813e6[_0x5d7f('0x31')]=_[_0x5d7f('0x2c')](_0x242b87,'name');_0xf813e6[_0x5d7f('0x32')]=_['keys'](_0x26285f['query']);_0xf813e6[_0x5d7f('0x33')]=_[_0x5d7f('0x34')](_0xf813e6[_0x5d7f('0x31')],_0xf813e6[_0x5d7f('0x32')]);_0x444da6[_0x5d7f('0x35')]=_[_0x5d7f('0x34')](_0xf813e6['model'],qs[_0x5d7f('0x36')](_0x26285f[_0x5d7f('0x32')][_0x5d7f('0x36')]));_0x444da6[_0x5d7f('0x35')]=_0x444da6[_0x5d7f('0x35')][_0x5d7f('0x37')]?_0x444da6[_0x5d7f('0x35')]:_0xf813e6[_0x5d7f('0x31')];if(!_0x26285f[_0x5d7f('0x32')][_0x5d7f('0x38')](_0x5d7f('0x39'))){_0x444da6['limit']=qs[_0x5d7f('0x1c')](_0x26285f[_0x5d7f('0x32')][_0x5d7f('0x1c')]);_0x444da6['offset']=qs[_0x5d7f('0x1e')](_0x26285f[_0x5d7f('0x32')][_0x5d7f('0x1e')]);}_0x444da6['order']=qs[_0x5d7f('0x3a')](_0x26285f[_0x5d7f('0x32')][_0x5d7f('0x3a')]);_0x444da6[_0x5d7f('0x3b')]=qs[_0x5d7f('0x33')](_['pick'](_0x26285f[_0x5d7f('0x32')],_0xf813e6['filters']),_0x242b87);if(_0x26285f[_0x5d7f('0x32')][_0x5d7f('0x3c')]){_0x444da6[_0x5d7f('0x3b')]=_[_0x5d7f('0x3d')](_0x444da6[_0x5d7f('0x3b')],{'$or':_[_0x5d7f('0x2c')](_0x242b87,function(_0x2df802){if(_0x2df802['type']!==_0x5d7f('0x3e')){var _0x5dbcfa={};_0x5dbcfa[_0x2df802[_0x5d7f('0x29')]]={'$like':'%'+_0x26285f[_0x5d7f('0x32')][_0x5d7f('0x3c')]+'%'};return _0x5dbcfa;}})});}_0x444da6=_[_0x5d7f('0x3d')]({},_0x444da6,_0x26285f['options']);var _0x244819={'where':_0x444da6['where']};return db['ChatTransferReport'][_0x5d7f('0x1d')](_0x244819)[_0x5d7f('0x25')](function(_0x252b91){_0x4072e0['count']=_0x252b91;if(_0x26285f[_0x5d7f('0x32')][_0x5d7f('0x3f')]){_0x444da6['include']=[{'all':!![]}];}return db[_0x5d7f('0x2d')]['findAll'](_0x444da6);})[_0x5d7f('0x25')](function(_0x5ef6d7){_0x4072e0['rows']=_0x5ef6d7;return _0x4072e0;})[_0x5d7f('0x25')](respondWithFilteredResult(_0x53207f,_0x444da6))[_0x5d7f('0x40')](handleError(_0x53207f,null));};exports[_0x5d7f('0x41')]=function(_0x4ed6cf,_0x1e3afc){var _0x2bf15f={'raw':!![],'where':{'id':_0x4ed6cf[_0x5d7f('0x42')]['id']}},_0xadf84d={};_0xadf84d[_0x5d7f('0x31')]=_[_0x5d7f('0x43')](db['ChatTransferReport']['rawAttributes']);_0xadf84d[_0x5d7f('0x32')]=_['keys'](_0x4ed6cf['query']);_0xadf84d[_0x5d7f('0x33')]=_[_0x5d7f('0x34')](_0xadf84d[_0x5d7f('0x31')],_0xadf84d[_0x5d7f('0x32')]);_0x2bf15f[_0x5d7f('0x35')]=_['intersection'](_0xadf84d[_0x5d7f('0x31')],qs[_0x5d7f('0x36')](_0x4ed6cf['query'][_0x5d7f('0x36')]));_0x2bf15f[_0x5d7f('0x35')]=_0x2bf15f[_0x5d7f('0x35')][_0x5d7f('0x37')]?_0x2bf15f[_0x5d7f('0x35')]:_0xadf84d['model'];if(_0x4ed6cf[_0x5d7f('0x32')]['includeAll']){_0x2bf15f[_0x5d7f('0x44')]=[{'all':!![]}];}_0x2bf15f=_[_0x5d7f('0x3d')]({},_0x2bf15f,_0x4ed6cf[_0x5d7f('0x45')]);return db['ChatTransferReport']['find'](_0x2bf15f)[_0x5d7f('0x25')](handleEntityNotFound(_0x1e3afc,null))['then'](respondWithResult(_0x1e3afc,null))[_0x5d7f('0x40')](handleError(_0x1e3afc,null));};exports['create']=function(_0x28b910,_0x1fd397){return db[_0x5d7f('0x2d')][_0x5d7f('0x46')](_0x28b910['body'],{})[_0x5d7f('0x25')](respondWithResult(_0x1fd397,0xc9))[_0x5d7f('0x40')](handleError(_0x1fd397,null));};exports[_0x5d7f('0x24')]=function(_0xafbdfc,_0x1066d0){if(_0xafbdfc[_0x5d7f('0x47')]['id']){delete _0xafbdfc[_0x5d7f('0x47')]['id'];}return db[_0x5d7f('0x2d')]['find']({'where':{'id':_0xafbdfc[_0x5d7f('0x42')]['id']}})[_0x5d7f('0x25')](handleEntityNotFound(_0x1066d0,null))[_0x5d7f('0x25')](saveUpdates(_0xafbdfc[_0x5d7f('0x47')],null))[_0x5d7f('0x25')](respondWithResult(_0x1066d0,null))[_0x5d7f('0x40')](handleError(_0x1066d0,null));};exports['destroy']=function(_0x4d3c1a,_0x439e3f){return db[_0x5d7f('0x2d')][_0x5d7f('0x48')]({'where':{'id':_0x4d3c1a[_0x5d7f('0x42')]['id']}})[_0x5d7f('0x25')](handleEntityNotFound(_0x439e3f,null))['then'](removeEntity(_0x439e3f,null))[_0x5d7f('0x40')](handleError(_0x439e3f,null));};exports[_0x5d7f('0x49')]=function(_0x4e85c8,_0x3f67c9){return db[_0x5d7f('0x2d')][_0x5d7f('0x49')]()[_0x5d7f('0x25')](respondWithResult(_0x3f67c9,null))[_0x5d7f('0x40')](handleError(_0x3f67c9,null));}; \ No newline at end of file +var _0x4aad=['../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','type','key','keys','query','filters','intersection','attributes','model','fields','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','ChatTransferReport','includeAll','findAll','rows','catch','params','length','include','find','create','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x8678bf,_0x4265a5){var _0x115686=function(_0x5a20e0){while(--_0x5a20e0){_0x8678bf['push'](_0x8678bf['shift']());}};_0x115686(++_0x4265a5);}(_0x4aad,0x116));var _0xd4aa=function(_0xd09668,_0x1435b2){_0xd09668=_0xd09668-0x0;var _0x68726=_0x4aad[_0xd09668];return _0x68726;};'use strict';var emlformat=require(_0xd4aa('0x0'));var rimraf=require(_0xd4aa('0x1'));var zipdir=require(_0xd4aa('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd4aa('0x3'));var moment=require(_0xd4aa('0x4'));var BPromise=require(_0xd4aa('0x5'));var Mustache=require('mustache');var util=require(_0xd4aa('0x6'));var path=require(_0xd4aa('0x7'));var sox=require(_0xd4aa('0x8'));var csv=require('to-csv');var ejs=require(_0xd4aa('0x9'));var fs=require('fs');var fs_extra=require(_0xd4aa('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xd4aa('0xb'));var jsforce=require(_0xd4aa('0xc'));var deskjs=require(_0xd4aa('0xd'));var toCsv=require('to-csv');var querystring=require(_0xd4aa('0xe'));var Papa=require('papaparse');var Redis=require(_0xd4aa('0xf'));var authService=require(_0xd4aa('0x10'));var qs=require(_0xd4aa('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd4aa('0x12'));var logger=require(_0xd4aa('0x13'))('api');var utils=require('../../config/utils');var config=require(_0xd4aa('0x14'));var licenseUtil=require(_0xd4aa('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x48975d,_0x12008d){_0x12008d=_0x12008d||0xcc;return function(_0x41fd8c){if(_0x41fd8c){return _0x48975d['sendStatus'](_0x12008d);}return _0x48975d[_0xd4aa('0x16')](_0x12008d)[_0xd4aa('0x17')]();};}function respondWithResult(_0xfbf46b,_0x70b8b6){_0x70b8b6=_0x70b8b6||0xc8;return function(_0x20124b){if(_0x20124b){return _0xfbf46b[_0xd4aa('0x16')](_0x70b8b6)[_0xd4aa('0x18')](_0x20124b);}};}function respondWithFilteredResult(_0x38719c,_0x5e61f5){return function(_0x1e595f){if(_0x1e595f){var _0x10d37c=typeof _0x5e61f5[_0xd4aa('0x19')]===_0xd4aa('0x1a')&&typeof _0x5e61f5[_0xd4aa('0x1b')]===_0xd4aa('0x1a');var _0x4ddfca=_0x1e595f['count'];var _0x49f9f8=_0x10d37c?0x0:_0x5e61f5[_0xd4aa('0x19')];var _0x5123c6=_0x10d37c?_0x1e595f[_0xd4aa('0x1c')]:_0x5e61f5[_0xd4aa('0x19')]+_0x5e61f5[_0xd4aa('0x1b')];var _0x2a228d;if(_0x5123c6>=_0x4ddfca){_0x5123c6=_0x4ddfca;_0x2a228d=0xc8;}else{_0x2a228d=0xce;}_0x38719c[_0xd4aa('0x16')](_0x2a228d);return _0x38719c['set'](_0xd4aa('0x1d'),_0x49f9f8+'-'+_0x5123c6+'/'+_0x4ddfca)['json'](_0x1e595f);}return null;};}function patchUpdates(_0x1c05ac){return function(_0x1e23e7){try{jsonpatch[_0xd4aa('0x1e')](_0x1e23e7,_0x1c05ac,!![]);}catch(_0x46749b){return BPromise[_0xd4aa('0x1f')](_0x46749b);}return _0x1e23e7[_0xd4aa('0x20')]();};}function saveUpdates(_0x366750,_0xd734be){return function(_0x14a8f9){if(_0x14a8f9){return _0x14a8f9[_0xd4aa('0x21')](_0x366750)[_0xd4aa('0x22')](function(_0x3da136){return _0x3da136;});}return null;};}function removeEntity(_0x342465,_0x18b27a){return function(_0x568b72){if(_0x568b72){return _0x568b72[_0xd4aa('0x23')]()['then'](function(){_0x342465[_0xd4aa('0x16')](0xcc)[_0xd4aa('0x17')]();});}};}function handleEntityNotFound(_0x2af9ff,_0x2d21b7){return function(_0x32e74a){if(!_0x32e74a){_0x2af9ff[_0xd4aa('0x24')](0x194);}return _0x32e74a;};}function handleError(_0x3b1c65,_0x2eb036){_0x2eb036=_0x2eb036||0x1f4;return function(_0x485030){logger['error'](_0x485030[_0xd4aa('0x25')]);if(_0x485030[_0xd4aa('0x26')]){delete _0x485030['name'];}_0x3b1c65['status'](_0x2eb036)[_0xd4aa('0x27')](_0x485030);};}exports[_0xd4aa('0x28')]=function(_0x546ee0,_0x239de0){var _0x7ef0b0={},_0x11d414={},_0x43a5e9={'count':0x0,'rows':[]};var _0x104810=_[_0xd4aa('0x29')](db['ChatTransferReport'][_0xd4aa('0x2a')],function(_0x2dcafa){return{'name':_0x2dcafa[_0xd4aa('0x2b')],'type':_0x2dcafa[_0xd4aa('0x2c')][_0xd4aa('0x2d')]};});_0x11d414['model']=_[_0xd4aa('0x29')](_0x104810,_0xd4aa('0x26'));_0x11d414['query']=_[_0xd4aa('0x2e')](_0x546ee0[_0xd4aa('0x2f')]);_0x11d414[_0xd4aa('0x30')]=_[_0xd4aa('0x31')](_0x11d414['model'],_0x11d414[_0xd4aa('0x2f')]);_0x7ef0b0[_0xd4aa('0x32')]=_[_0xd4aa('0x31')](_0x11d414[_0xd4aa('0x33')],qs[_0xd4aa('0x34')](_0x546ee0['query'][_0xd4aa('0x34')]));_0x7ef0b0[_0xd4aa('0x32')]=_0x7ef0b0[_0xd4aa('0x32')]['length']?_0x7ef0b0['attributes']:_0x11d414['model'];if(!_0x546ee0[_0xd4aa('0x2f')][_0xd4aa('0x35')]('nolimit')){_0x7ef0b0[_0xd4aa('0x1b')]=qs['limit'](_0x546ee0[_0xd4aa('0x2f')][_0xd4aa('0x1b')]);_0x7ef0b0[_0xd4aa('0x19')]=qs[_0xd4aa('0x19')](_0x546ee0['query']['offset']);}_0x7ef0b0[_0xd4aa('0x36')]=qs[_0xd4aa('0x37')](_0x546ee0[_0xd4aa('0x2f')][_0xd4aa('0x37')]);_0x7ef0b0['where']=qs[_0xd4aa('0x30')](_[_0xd4aa('0x38')](_0x546ee0['query'],_0x11d414[_0xd4aa('0x30')]),_0x104810);if(_0x546ee0[_0xd4aa('0x2f')][_0xd4aa('0x39')]){_0x7ef0b0[_0xd4aa('0x3a')]=_[_0xd4aa('0x3b')](_0x7ef0b0['where'],{'$or':_[_0xd4aa('0x29')](_0x104810,function(_0x106ab5){if(_0x106ab5[_0xd4aa('0x2c')]!==_0xd4aa('0x3c')){var _0x415e08={};_0x415e08[_0x106ab5[_0xd4aa('0x26')]]={'$like':'%'+_0x546ee0['query'][_0xd4aa('0x39')]+'%'};return _0x415e08;}})});}_0x7ef0b0=_[_0xd4aa('0x3b')]({},_0x7ef0b0,_0x546ee0[_0xd4aa('0x3d')]);var _0x23eb2d={'where':_0x7ef0b0['where']};return db[_0xd4aa('0x3e')][_0xd4aa('0x1c')](_0x23eb2d)[_0xd4aa('0x22')](function(_0x17eabb){_0x43a5e9[_0xd4aa('0x1c')]=_0x17eabb;if(_0x546ee0[_0xd4aa('0x2f')][_0xd4aa('0x3f')]){_0x7ef0b0['include']=[{'all':!![]}];}return db[_0xd4aa('0x3e')][_0xd4aa('0x40')](_0x7ef0b0);})['then'](function(_0x412f7c){_0x43a5e9[_0xd4aa('0x41')]=_0x412f7c;return _0x43a5e9;})[_0xd4aa('0x22')](respondWithFilteredResult(_0x239de0,_0x7ef0b0))[_0xd4aa('0x42')](handleError(_0x239de0,null));};exports['show']=function(_0xd2727d,_0x265a76){var _0x30c60b={'raw':!![],'where':{'id':_0xd2727d[_0xd4aa('0x43')]['id']}},_0x1be6ac={};_0x1be6ac['model']=_[_0xd4aa('0x2e')](db['ChatTransferReport'][_0xd4aa('0x2a')]);_0x1be6ac['query']=_['keys'](_0xd2727d['query']);_0x1be6ac[_0xd4aa('0x30')]=_[_0xd4aa('0x31')](_0x1be6ac[_0xd4aa('0x33')],_0x1be6ac[_0xd4aa('0x2f')]);_0x30c60b[_0xd4aa('0x32')]=_[_0xd4aa('0x31')](_0x1be6ac[_0xd4aa('0x33')],qs[_0xd4aa('0x34')](_0xd2727d['query']['fields']));_0x30c60b[_0xd4aa('0x32')]=_0x30c60b[_0xd4aa('0x32')][_0xd4aa('0x44')]?_0x30c60b[_0xd4aa('0x32')]:_0x1be6ac[_0xd4aa('0x33')];if(_0xd2727d[_0xd4aa('0x2f')]['includeAll']){_0x30c60b[_0xd4aa('0x45')]=[{'all':!![]}];}_0x30c60b=_[_0xd4aa('0x3b')]({},_0x30c60b,_0xd2727d[_0xd4aa('0x3d')]);return db[_0xd4aa('0x3e')][_0xd4aa('0x46')](_0x30c60b)[_0xd4aa('0x22')](handleEntityNotFound(_0x265a76,null))[_0xd4aa('0x22')](respondWithResult(_0x265a76,null))[_0xd4aa('0x42')](handleError(_0x265a76,null));};exports[_0xd4aa('0x47')]=function(_0x10c96d,_0xe39fd7){return db[_0xd4aa('0x3e')][_0xd4aa('0x47')](_0x10c96d[_0xd4aa('0x48')],{})[_0xd4aa('0x22')](respondWithResult(_0xe39fd7,0xc9))[_0xd4aa('0x42')](handleError(_0xe39fd7,null));};exports['update']=function(_0x3561c4,_0x109a79){if(_0x3561c4[_0xd4aa('0x48')]['id']){delete _0x3561c4['body']['id'];}return db[_0xd4aa('0x3e')][_0xd4aa('0x46')]({'where':{'id':_0x3561c4[_0xd4aa('0x43')]['id']}})[_0xd4aa('0x22')](handleEntityNotFound(_0x109a79,null))[_0xd4aa('0x22')](saveUpdates(_0x3561c4[_0xd4aa('0x48')],null))[_0xd4aa('0x22')](respondWithResult(_0x109a79,null))[_0xd4aa('0x42')](handleError(_0x109a79,null));};exports['destroy']=function(_0x3e145a,_0x257f58){return db['ChatTransferReport'][_0xd4aa('0x46')]({'where':{'id':_0x3e145a[_0xd4aa('0x43')]['id']}})[_0xd4aa('0x22')](handleEntityNotFound(_0x257f58,null))['then'](removeEntity(_0x257f58,null))[_0xd4aa('0x42')](handleError(_0x257f58,null));};exports[_0xd4aa('0x49')]=function(_0x1f0348,_0x167d8a){return db[_0xd4aa('0x3e')][_0xd4aa('0x49')]()[_0xd4aa('0x22')](respondWithResult(_0x167d8a,null))[_0xd4aa('0x42')](handleError(_0x167d8a,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index d776410..26dcf54 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 _0x88b6=['request-promise','path','rimraf','../../config/environment','./chatTransferReport.attributes','exports','define','ChatTransferReport','report_chat_transfer','uniqueid','lodash','util','../../config/logger','bluebird'];(function(_0x2b826a,_0x219ef6){var _0x3c4313=function(_0x8bd5f){while(--_0x8bd5f){_0x2b826a['push'](_0x2b826a['shift']());}};_0x3c4313(++_0x219ef6);}(_0x88b6,0xf8));var _0x688b=function(_0x45411b,_0x4921e7){_0x45411b=_0x45411b-0x0;var _0x1b9a67=_0x88b6[_0x45411b];return _0x1b9a67;};'use strict';var _=require(_0x688b('0x0'));var util=require(_0x688b('0x1'));var logger=require(_0x688b('0x2'))('api');var moment=require('moment');var BPromise=require(_0x688b('0x3'));var rp=require(_0x688b('0x4'));var fs=require('fs');var path=require(_0x688b('0x5'));var rimraf=require(_0x688b('0x6'));var config=require(_0x688b('0x7'));var attributes=require(_0x688b('0x8'));module[_0x688b('0x9')]=function(_0x43b50b,_0x39d87c){return _0x43b50b[_0x688b('0xa')](_0x688b('0xb'),attributes,{'tableName':_0x688b('0xc'),'paranoid':![],'indexes':[{'name':_0x688b('0xd'),'fields':[_0x688b('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8bce=['request-promise','path','rimraf','../../config/environment','./chatTransferReport.attributes','ChatTransferReport','uniqueid','lodash','util','moment'];(function(_0x5dfd07,_0x11f42e){var _0x10cd46=function(_0x16b929){while(--_0x16b929){_0x5dfd07['push'](_0x5dfd07['shift']());}};_0x10cd46(++_0x11f42e);}(_0x8bce,0x197));var _0xe8bc=function(_0x4a0873,_0x20d853){_0x4a0873=_0x4a0873-0x0;var _0x44e7b6=_0x8bce[_0x4a0873];return _0x44e7b6;};'use strict';var _=require(_0xe8bc('0x0'));var util=require(_0xe8bc('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xe8bc('0x2'));var BPromise=require('bluebird');var rp=require(_0xe8bc('0x3'));var fs=require('fs');var path=require(_0xe8bc('0x4'));var rimraf=require(_0xe8bc('0x5'));var config=require(_0xe8bc('0x6'));var attributes=require(_0xe8bc('0x7'));module['exports']=function(_0x39bab4,_0x3b1e2b){return _0x39bab4['define'](_0xe8bc('0x8'),attributes,{'tableName':'report_chat_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xe8bc('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index 92f8f83..991cebe 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 _0xec2d=['../../config/environment','then','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x8069ee,_0xe39175){var _0xbc950d=function(_0x3844d4){while(--_0x3844d4){_0x8069ee['push'](_0x8069ee['shift']());}};_0xbc950d(++_0xe39175);}(_0xec2d,0x14d));var _0xdec2=function(_0x139db3,_0x22a5bf){_0x139db3=_0x139db3-0x0;var _0xde6ed7=_0xec2d[_0x139db3];return _0xde6ed7;};'use strict';var _=require(_0xdec2('0x0'));var util=require(_0xdec2('0x1'));var moment=require(_0xdec2('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdec2('0x3'));var db=require(_0xdec2('0x4'))['db'];var utils=require(_0xdec2('0x5'));var logger=require('../../config/logger')(_0xdec2('0x6'));var config=require(_0xdec2('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x35101e,_0x3dc4af,_0x7a17bf){return new BPromise(function(_0x1b2212,_0x5ab23b){return client['request'](_0x35101e,_0x7a17bf)[_0xdec2('0x8')](function(_0x189c4a){logger[_0xdec2('0x9')](_0xdec2('0xa'),_0x3dc4af,_0xdec2('0xb'));logger[_0xdec2('0xc')](_0xdec2('0xd'),_0x3dc4af,_0xdec2('0xb'),JSON[_0xdec2('0xe')](_0x189c4a));if(_0x189c4a['error']){if(_0x189c4a[_0xdec2('0xf')][_0xdec2('0x10')]===0x1f4){logger[_0xdec2('0xf')]('ChatTransferReport,\x20%s,\x20%s',_0x3dc4af,_0x189c4a[_0xdec2('0xf')][_0xdec2('0x11')]);return _0x5ab23b(_0x189c4a[_0xdec2('0xf')][_0xdec2('0x11')]);}logger[_0xdec2('0xf')](_0xdec2('0xa'),_0x3dc4af,_0x189c4a[_0xdec2('0xf')][_0xdec2('0x11')]);return _0x1b2212(_0x189c4a['error']['message']);}else{logger['info']('ChatTransferReport,\x20%s,\x20%s',_0x3dc4af,_0xdec2('0xb'));_0x1b2212(_0x189c4a[_0xdec2('0x12')][_0xdec2('0x11')]);}})[_0xdec2('0x13')](function(_0x344955){logger['error'](_0xdec2('0xa'),_0x3dc4af,_0x344955);_0x5ab23b(_0x344955);});});} \ No newline at end of file +var _0x4119=['request','then','info','ChatTransferReport,\x20%s,\x20%s','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http'];(function(_0x57f9b2,_0x15bed0){var _0x372745=function(_0x59ecf1){while(--_0x59ecf1){_0x57f9b2['push'](_0x57f9b2['shift']());}};_0x372745(++_0x15bed0);}(_0x4119,0x11f));var _0x9411=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0x4119[_0x47e7cb];return _0x2a8874;};'use strict';var _=require('lodash');var util=require(_0x9411('0x0'));var moment=require(_0x9411('0x1'));var BPromise=require(_0x9411('0x2'));var rs=require(_0x9411('0x3'));var fs=require('fs');var Redis=require(_0x9411('0x4'));var db=require(_0x9411('0x5'))['db'];var utils=require(_0x9411('0x6'));var logger=require(_0x9411('0x7'))(_0x9411('0x8'));var config=require('../../config/environment');var jayson=require(_0x9411('0x9'));var client=jayson[_0x9411('0xa')][_0x9411('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x570ec3,_0x1ed017,_0x1a5df6){return new BPromise(function(_0x11546a,_0xb8254d){return client[_0x9411('0xc')](_0x570ec3,_0x1a5df6)[_0x9411('0xd')](function(_0x3b0076){logger[_0x9411('0xe')](_0x9411('0xf'),_0x1ed017,'request\x20sent');logger[_0x9411('0x10')](_0x9411('0x11'),_0x1ed017,'request\x20sent',JSON[_0x9411('0x12')](_0x3b0076));if(_0x3b0076['error']){if(_0x3b0076[_0x9411('0x13')][_0x9411('0x14')]===0x1f4){logger['error']('ChatTransferReport,\x20%s,\x20%s',_0x1ed017,_0x3b0076['error'][_0x9411('0x15')]);return _0xb8254d(_0x3b0076[_0x9411('0x13')][_0x9411('0x15')]);}logger[_0x9411('0x13')](_0x9411('0xf'),_0x1ed017,_0x3b0076[_0x9411('0x13')][_0x9411('0x15')]);return _0x11546a(_0x3b0076[_0x9411('0x13')][_0x9411('0x15')]);}else{logger[_0x9411('0xe')](_0x9411('0xf'),_0x1ed017,_0x9411('0x16'));_0x11546a(_0x3b0076['result'][_0x9411('0x15')]);}})['catch'](function(_0x12c648){logger[_0x9411('0x13')](_0x9411('0xf'),_0x1ed017,_0x12c648);_0xb8254d(_0x12c648);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index fd59352..648a8ff 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 _0x9f38=['get','/describe','describe','/:id','post','create','put','update','destroy','exports','multer','util','express','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated','index'];(function(_0x117994,_0x46bbbb){var _0x40814a=function(_0x5e88ca){while(--_0x5e88ca){_0x117994['push'](_0x117994['shift']());}};_0x40814a(++_0x46bbbb);}(_0x9f38,0x9a));var _0x89f3=function(_0x5dd40a,_0x266133){_0x5dd40a=_0x5dd40a-0x0;var _0x2ea22e=_0x9f38[_0x5dd40a];return _0x2ea22e;};'use strict';var multer=require(_0x89f3('0x0'));var util=require(_0x89f3('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x89f3('0x2'));var router=express['Router']();var fs_extra=require(_0x89f3('0x3'));var auth=require(_0x89f3('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x89f3('0x5'));var controller=require('./chatTransferReport.controller');router['get']('/',auth[_0x89f3('0x6')](),controller[_0x89f3('0x7')]);router[_0x89f3('0x8')](_0x89f3('0x9'),auth[_0x89f3('0x6')](),controller[_0x89f3('0xa')]);router[_0x89f3('0x8')](_0x89f3('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x89f3('0xc')]('/',auth[_0x89f3('0x6')](),controller[_0x89f3('0xd')]);router[_0x89f3('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x89f3('0xf')]);router['delete']('/:id',auth[_0x89f3('0x6')](),controller[_0x89f3('0x10')]);module[_0x89f3('0x11')]=router; \ No newline at end of file +var _0x5d09=['update','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','post','create','put'];(function(_0x226e90,_0x3e93d4){var _0x4462ff=function(_0xa7c80f){while(--_0xa7c80f){_0x226e90['push'](_0x226e90['shift']());}};_0x4462ff(++_0x3e93d4);}(_0x5d09,0x17b));var _0x95d0=function(_0x40c043,_0x1d064e){_0x40c043=_0x40c043-0x0;var _0x5c2c8d=_0x5d09[_0x40c043];return _0x5c2c8d;};'use strict';var multer=require(_0x95d0('0x0'));var util=require(_0x95d0('0x1'));var path=require(_0x95d0('0x2'));var timeout=require(_0x95d0('0x3'));var express=require(_0x95d0('0x4'));var router=express[_0x95d0('0x5')]();var fs_extra=require(_0x95d0('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x95d0('0x7'));var config=require(_0x95d0('0x8'));var controller=require('./chatTransferReport.controller');router['get']('/',auth[_0x95d0('0x9')](),controller[_0x95d0('0xa')]);router['get']('/describe',auth[_0x95d0('0x9')](),controller['describe']);router[_0x95d0('0xb')](_0x95d0('0xc'),auth[_0x95d0('0x9')](),controller[_0x95d0('0xd')]);router[_0x95d0('0xe')]('/',auth[_0x95d0('0x9')](),controller[_0x95d0('0xf')]);router[_0x95d0('0x10')](_0x95d0('0xc'),auth[_0x95d0('0x9')](),controller[_0x95d0('0x11')]);router['delete'](_0x95d0('0xc'),auth[_0x95d0('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index 42e1236..7a6a936 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 _0x4126=['Comments','offlineForm','setDataValue','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','CHAT','alternate','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','randomstring','exports','STRING','email','Agent','#011F6A','#ffffff','BOOLEAN','ENUM','rounded','squared','We\x20are\x20here!','Chat','Send','Contact\x20us','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20submission\x20error','Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Skip','Feedback','star','INTEGER','stringify','input','text','name','onlineForm','parse','getDataValue'];(function(_0x53cf8e,_0x3d290f){var _0x459197=function(_0x67073c){while(--_0x67073c){_0x53cf8e['push'](_0x53cf8e['shift']());}};_0x459197(++_0x3d290f);}(_0x4126,0x1aa));var _0x6412=function(_0x29771f,_0x1189ae){_0x29771f=_0x29771f-0x0;var _0x279baf=_0x4126[_0x29771f];return _0x279baf;};'use strict';var Sequelize=require(_0x6412('0x0'));var rs=require(_0x6412('0x1'));module[_0x6412('0x2')]={'name':{'type':Sequelize[_0x6412('0x3')],'allowNull':![]},'address':{'type':Sequelize[_0x6412('0x3')],'allowNull':![],'unique':'address'},'description':{'type':Sequelize[_0x6412('0x3')]},'mapKey':{'type':Sequelize[_0x6412('0x3')],'defaultValue':_0x6412('0x4')},'mapKeyOffline':{'type':Sequelize[_0x6412('0x3')],'defaultValue':_0x6412('0x4')},'key':{'type':Sequelize[_0x6412('0x3')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x6412('0x3')],'defaultValue':_0x6412('0x5')},'customerAlias':{'type':Sequelize[_0x6412('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x6412('0x3')],'allowNull':![],'defaultValue':_0x6412('0x6'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x6412('0x6'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x6412('0x3')],'allowNull':![],'defaultValue':_0x6412('0x7'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x6412('0x7'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xf},'remote':{'type':Sequelize['STRING']},'animation':{'type':Sequelize[_0x6412('0x8')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x6412('0x9')](_0x6412('0xa'),_0x6412('0xb')),'defaultValue':_0x6412('0xa')},'header_online':{'type':Sequelize[_0x6412('0x3')],'defaultValue':_0x6412('0xc')},'start_chat_button':{'type':Sequelize[_0x6412('0x3')],'defaultValue':_0x6412('0xd')},'offline_chat_button':{'type':Sequelize[_0x6412('0x3')],'defaultValue':_0x6412('0xe')},'header_offline':{'type':Sequelize[_0x6412('0x3')],'defaultValue':_0x6412('0xf')},'download_transcript':{'type':Sequelize[_0x6412('0x8')],'defaultValue':!![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whiteLabel':{'type':Sequelize['STRING'],'defaultValue':'Powered\x20by\x20xCALLY'},'defaultWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x6412('0x10')]},'closingQuestion':{'type':Sequelize[_0x6412('0x3')],'defaultValue':_0x6412('0x11')},'formSubmitSuccessMessage':{'type':Sequelize[_0x6412('0x3')],'defaultValue':'Form\x20properly\x20submitted'},'formSubmitFailureMessage':{'type':Sequelize['STRING'],'defaultValue':_0x6412('0x12')},'noteTitle':{'type':Sequelize[_0x6412('0x3')],'defaultValue':_0x6412('0x13')},'placeholderMessage':{'type':Sequelize['STRING'],'defaultValue':_0x6412('0x14')},'closingMessage':{'type':Sequelize[_0x6412('0x3')],'defaultValue':_0x6412('0x15')},'closingMessageButton':{'type':Sequelize[_0x6412('0x3')],'defaultValue':_0x6412('0xe')},'skipMessageButton':{'type':Sequelize[_0x6412('0x3')],'defaultValue':_0x6412('0x16')},'conditionAgreement':{'type':Sequelize[_0x6412('0x8')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x6412('0x8')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x6412('0x8')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x6412('0x8')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x6412('0x3')],'defaultValue':_0x6412('0x17')},'ratingType':{'type':Sequelize[_0x6412('0x9')](_0x6412('0x18'),'thumb'),'defaultValue':_0x6412('0x18')},'ratingStarsNumber':{'type':Sequelize[_0x6412('0x19')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x6412('0x10')],'defaultValue':function(){return JSON[_0x6412('0x1a')]({'items':[{'type':_0x6412('0x1b'),'variable':null,'config':{'placeholder':'name','type':_0x6412('0x1c'),'required':!![]},'props':{'title':_0x6412('0x1d'),'helpText':''}},{'type':_0x6412('0x1b'),'props':{'title':_0x6412('0x4'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':_0x6412('0x4')},'variable':null}],'fromKey':0x1});},'get':function(){return this['getDataValue'](_0x6412('0x1e'))?JSON[_0x6412('0x1f')](this[_0x6412('0x20')](_0x6412('0x1e'))):{};},'set':function(_0x26e834){return this['setDataValue']('onlineForm',JSON[_0x6412('0x1a')](_0x26e834));}},'offlineForm':{'type':Sequelize[_0x6412('0x10')],'defaultValue':function(){return JSON[_0x6412('0x1a')]({'items':[{'type':_0x6412('0x1b'),'props':{'title':_0x6412('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0x6412('0x4'),'type':_0x6412('0x4')},'variable':null},{'type':'textarea','config':{'placeholder':_0x6412('0x21')},'props':{'title':_0x6412('0x21'),'helpText':'Leave\x20your\x20comments'}}],'fromKey':0x0});},'get':function(){return this[_0x6412('0x20')](_0x6412('0x22'))?JSON[_0x6412('0x1f')](this[_0x6412('0x20')]('offlineForm')):{};},'set':function(_0x4beb44){return this[_0x6412('0x23')](_0x6412('0x22'),JSON[_0x6412('0x1a')](_0x4beb44));}},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs['generate']();}},'autoclose':{'type':Sequelize[_0x6412('0x8')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x6412('0x8')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x6412('0x8')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x6412('0x3')]},'forwardOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x6412('0x3')]},'waitingTitle':{'type':Sequelize[_0x6412('0x3')],'defaultValue':_0x6412('0x24')},'waitingMessage':{'type':Sequelize[_0x6412('0x3')],'defaultValue':'Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.'},'offlineMessageSubject':{'type':Sequelize['STRING'],'defaultValue':_0x6412('0x25')},'offlineMessageBody':{'type':Sequelize[_0x6412('0x3')],'defaultValue':_0x6412('0x26')},'enableUnmanagedNote':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x6412('0x3')],'defaultValue':'Your\x20request\x20has\x20not\x20been\x20processed.'},'skipUnmanaged':{'type':Sequelize[_0x6412('0x3')],'defaultValue':_0x6412('0x16')},'sendUnmanaged':{'type':Sequelize[_0x6412('0x3')],'defaultValue':'Send'},'enableCustomerAttachment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x6412('0x10')]},'showAgentAvatar':{'type':Sequelize[_0x6412('0x8')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x6412('0x3')]},'notificationTemplate':{'type':Sequelize[_0x6412('0x10')],'defaultValue':function(){return _0x6412('0x27');}},'notificationSound':{'type':Sequelize[_0x6412('0x8')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x6412('0x8')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x6412('0x8')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize['STRING'],'defaultValue':_0x6412('0x28')},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x6412('0x19')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x6412('0x3')],'defaultValue':_0x6412('0x29')},'verticalAlignment':{'type':Sequelize[_0x6412('0x19')],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0x6412('0x3')],'defaultValue':_0x6412('0x2a')},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':_0x6412('0x2b')},'defaultTitle':{'type':Sequelize['STRING']},'customerAvatar':{'type':Sequelize[_0x6412('0x10')]},'showCustomerAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x6412('0x19')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x6412('0x2c'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x6412('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x6412('0x19')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x6412('0x19')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x6412('0x3')],'defaultValue':_0x6412('0x2d')},'systemAvatar':{'type':Sequelize[_0x6412('0x10')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x6412('0x2e')},'mandatoryDisposition':{'type':Sequelize[_0x6412('0x8')],'defaultValue':![],'comment':_0x6412('0x2f'),'set':function(_0x21a277){if(!_0x21a277)this['setDataValue']('mandatoryDispositionPauseId',null);this[_0x6412('0x23')](_0x6412('0x30'),_0x21a277);}},'vidaooEscalation':{'type':Sequelize[_0x6412('0x8')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x6412('0x3')]},'vidaooTopic':{'type':Sequelize[_0x6412('0x3')],'allowNull':![],'defaultValue':_0x6412('0x31')},'vidaooNote':{'type':Sequelize['STRING'],'defaultValue':function(){return _0x6412('0x32');}},'vidaooMetadata':{'type':Sequelize[_0x6412('0x10')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x6412('0x8')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x6412('0x10')]}}; \ No newline at end of file +var _0xb260=['stringify','input','text','name','getDataValue','parse','onlineForm','setDataValue','textarea','Comments','Leave\x20your\x20comments','offlineForm','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','CHAT','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','randomstring','exports','STRING','address','email','Agent','#011F6A','#ffffff','INTEGER','ENUM','rounded','We\x20are\x20here!','Chat','Send','Contact\x20us','BOOLEAN','Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Type\x20a\x20message','Feedback','thumb'];(function(_0x229bb2,_0x5e7183){var _0x3343ec=function(_0x47444d){while(--_0x47444d){_0x229bb2['push'](_0x229bb2['shift']());}};_0x3343ec(++_0x5e7183);}(_0xb260,0xb7));var _0x0b26=function(_0x28d90a,_0x518da0){_0x28d90a=_0x28d90a-0x0;var _0x27c430=_0xb260[_0x28d90a];return _0x27c430;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x0b26('0x0'));module[_0x0b26('0x1')]={'name':{'type':Sequelize[_0x0b26('0x2')],'allowNull':![]},'address':{'type':Sequelize[_0x0b26('0x2')],'allowNull':![],'unique':_0x0b26('0x3')},'description':{'type':Sequelize[_0x0b26('0x2')]},'mapKey':{'type':Sequelize['STRING'],'defaultValue':'email'},'mapKeyOffline':{'type':Sequelize['STRING'],'defaultValue':_0x0b26('0x4')},'key':{'type':Sequelize[_0x0b26('0x2')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x0b26('0x2')],'defaultValue':_0x0b26('0x5')},'customerAlias':{'type':Sequelize[_0x0b26('0x2')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x0b26('0x2')],'allowNull':![],'defaultValue':_0x0b26('0x6'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x0b26('0x2')],'allowNull':![],'defaultValue':_0x0b26('0x6'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0x0b26('0x2')],'allowNull':![],'defaultValue':_0x0b26('0x7'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x0b26('0x8')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x0b26('0x2')]},'animation':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x0b26('0x9')](_0x0b26('0xa'),'squared'),'defaultValue':_0x0b26('0xa')},'header_online':{'type':Sequelize['STRING'],'defaultValue':_0x0b26('0xb')},'start_chat_button':{'type':Sequelize[_0x0b26('0x2')],'defaultValue':_0x0b26('0xc')},'offline_chat_button':{'type':Sequelize[_0x0b26('0x2')],'defaultValue':_0x0b26('0xd')},'header_offline':{'type':Sequelize[_0x0b26('0x2')],'defaultValue':_0x0b26('0xe')},'download_transcript':{'type':Sequelize[_0x0b26('0xf')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x0b26('0x8')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize['STRING'],'defaultValue':_0x0b26('0x10')},'defaultWhiteLabel':{'type':Sequelize[_0x0b26('0xf')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x0b26('0x11')]},'closingQuestion':{'type':Sequelize['STRING'],'defaultValue':_0x0b26('0x12')},'formSubmitSuccessMessage':{'type':Sequelize[_0x0b26('0x2')],'defaultValue':_0x0b26('0x13')},'formSubmitFailureMessage':{'type':Sequelize['STRING'],'defaultValue':_0x0b26('0x14')},'noteTitle':{'type':Sequelize[_0x0b26('0x2')],'defaultValue':_0x0b26('0x15')},'placeholderMessage':{'type':Sequelize[_0x0b26('0x2')],'defaultValue':_0x0b26('0x16')},'closingMessage':{'type':Sequelize[_0x0b26('0x2')],'defaultValue':'Thanks\x20you\x20for\x20your\x20time!'},'closingMessageButton':{'type':Sequelize[_0x0b26('0x2')],'defaultValue':_0x0b26('0xd')},'skipMessageButton':{'type':Sequelize['STRING'],'defaultValue':'Skip'},'conditionAgreement':{'type':Sequelize[_0x0b26('0xf')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x0b26('0xf')],'defaultValue':![]},'enableFeedback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x0b26('0xf')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x0b26('0x2')],'defaultValue':_0x0b26('0x17')},'ratingType':{'type':Sequelize[_0x0b26('0x9')]('star',_0x0b26('0x18')),'defaultValue':'star'},'ratingStarsNumber':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x0b26('0x11')],'defaultValue':function(){return JSON[_0x0b26('0x19')]({'items':[{'type':_0x0b26('0x1a'),'variable':null,'config':{'placeholder':'name','type':_0x0b26('0x1b'),'required':!![]},'props':{'title':_0x0b26('0x1c'),'helpText':''}},{'type':'input','props':{'title':_0x0b26('0x4'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':_0x0b26('0x4')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x0b26('0x1d')]('onlineForm')?JSON[_0x0b26('0x1e')](this[_0x0b26('0x1d')](_0x0b26('0x1f'))):{};},'set':function(_0x5e18b2){return this[_0x0b26('0x20')]('onlineForm',JSON[_0x0b26('0x19')](_0x5e18b2));}},'offlineForm':{'type':Sequelize[_0x0b26('0x11')],'defaultValue':function(){return JSON[_0x0b26('0x19')]({'items':[{'type':'input','props':{'title':_0x0b26('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0x0b26('0x4'),'type':_0x0b26('0x4')},'variable':null},{'type':_0x0b26('0x21'),'config':{'placeholder':_0x0b26('0x22')},'props':{'title':_0x0b26('0x22'),'helpText':_0x0b26('0x23')}}],'fromKey':0x0});},'get':function(){return this['getDataValue'](_0x0b26('0x24'))?JSON[_0x0b26('0x1e')](this[_0x0b26('0x1d')](_0x0b26('0x24'))):{};},'set':function(_0x1ad999){return this['setDataValue'](_0x0b26('0x24'),JSON[_0x0b26('0x19')](_0x1ad999));}},'token':{'type':Sequelize[_0x0b26('0x2')],'defaultValue':function(){return rs[_0x0b26('0x25')]();}},'autoclose':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x0b26('0xf')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x0b26('0xf')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x0b26('0x2')]},'forwardOffline':{'type':Sequelize[_0x0b26('0xf')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x0b26('0x2')]},'waitingTitle':{'type':Sequelize['STRING'],'defaultValue':_0x0b26('0x26')},'waitingMessage':{'type':Sequelize[_0x0b26('0x2')],'defaultValue':_0x0b26('0x27')},'offlineMessageSubject':{'type':Sequelize[_0x0b26('0x2')],'defaultValue':_0x0b26('0x28')},'offlineMessageBody':{'type':Sequelize[_0x0b26('0x2')],'defaultValue':_0x0b26('0x29')},'enableUnmanagedNote':{'type':Sequelize[_0x0b26('0xf')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize['STRING'],'defaultValue':_0x0b26('0x2a')},'skipUnmanaged':{'type':Sequelize[_0x0b26('0x2')],'defaultValue':'Skip'},'sendUnmanaged':{'type':Sequelize[_0x0b26('0x2')],'defaultValue':_0x0b26('0xd')},'enableCustomerAttachment':{'type':Sequelize[_0x0b26('0xf')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x0b26('0xf')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x0b26('0x11')]},'showAgentAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timezone':{'type':Sequelize[_0x0b26('0x2')]},'notificationTemplate':{'type':Sequelize[_0x0b26('0x11')],'defaultValue':function(){return _0x0b26('0x2b');}},'notificationSound':{'type':Sequelize[_0x0b26('0xf')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x0b26('0xf')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x0b26('0x2')],'defaultValue':_0x0b26('0x2c')},'waitForTheAssignedAgent':{'type':Sequelize[_0x0b26('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x0b26('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x0b26('0x2')],'defaultValue':'bottom_right'},'verticalAlignment':{'type':Sequelize[_0x0b26('0x8')],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0x0b26('0x2')],'defaultValue':_0x0b26('0x2d')},'messagesAlignment':{'type':Sequelize[_0x0b26('0x2')],'defaultValue':'alternate'},'defaultTitle':{'type':Sequelize['STRING']},'customerAvatar':{'type':Sequelize['TEXT']},'showCustomerAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x0b26('0x8')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x0b26('0x2')],'allowNull':![],'defaultValue':_0x0b26('0x2e'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x0b26('0xf')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x0b26('0xf')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x0b26('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x0b26('0x2')],'defaultValue':_0x0b26('0x2f')},'systemAvatar':{'type':Sequelize[_0x0b26('0x11')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x0b26('0x8')],'comment':_0x0b26('0x30')},'mandatoryDisposition':{'type':Sequelize[_0x0b26('0xf')],'defaultValue':![],'comment':_0x0b26('0x31'),'set':function(_0x2f439b){if(!_0x2f439b)this[_0x0b26('0x20')](_0x0b26('0x32'),null);this[_0x0b26('0x20')]('mandatoryDisposition',_0x2f439b);}},'vidaooEscalation':{'type':Sequelize[_0x0b26('0xf')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x0b26('0x2')]},'vidaooTopic':{'type':Sequelize[_0x0b26('0x2')],'allowNull':![],'defaultValue':'Generated\x20by\x20XCALLY\x20Motion'},'vidaooNote':{'type':Sequelize[_0x0b26('0x2')],'defaultValue':function(){return _0x0b26('0x33');}},'vidaooMetadata':{'type':Sequelize[_0x0b26('0x11')],'defaultValue':null},'openNewInteraction':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x0b26('0x11')]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index 2145bd3..e02d361 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 _0xf253=['URL','address','origin','3.2.0','x-real-ip','remoteAddress','replace','render','alignment','verticalAlignment','textColor','textButtonColor','hideWhenOffline','IntervalId','addApplications','Transaction','READ_COMMITTED','priority','json','getApplications','chatProactiveAction','addProactiveActions','omit','getProactiveActions','ChatProactiveAction','getFields','online','false','offlineForm','onlineForm','items','fromKey','getOfflineMessages','Attachments','addAgents','userChatWebsite:save','removeAgents','emit','userChatWebsite:remove','getAgents','bluebird','mustache','util','path','ejs','lodash','querystring','../../config/logger','api','../../config/environment','url','defaults','localhost','redis','./chatWebsite.socket','register','html-to-text','jayson/promise','client','http','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','message','result','sendStatus','status','end','undefined','count','offset','set','Content-Range','update','destroy','get','ChatWebsites','UserProfileResource','stack','name','index','Pause','mandatoryDispositionPause','map','rawAttributes','fieldName','type','key','keys','filters','intersection','model','query','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','where','merge','options','includeAll','include','ChatWebsite','findAll','rows','catch','params','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','ChatWebsiteId','Disposition','getDispositions','filter','removeDispositions','addAnswer','CannedAnswer','getAnswers','findOne','removeAnswers','ids','addLogo','sitepic','file','filename','addAvatar','agentAvatar','addCustomerAvatar','customerAvatar','addSystemAvatar','getLogo','join','root','server/files/images/logos/default_logo.svg','../../config/license/util','custom','isNil','existsSync','server/files/images/logos/','download','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','server/files/images/avatars/system_avatar.png','systemAvatar','notify','user-agent-parser','setUA','headers','getResult','chat','CmContact','no\x20available\x20attributes','difference','updatedAt','createdAt','from','Sequelize','ValidationError','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','List','Contacts','DESC','ChatApplication','Applications','account','list','applications','orderBy','contact','customerIp','cf-connecting-ip','first','x-forwarded-for','firstName','lastName','x-real-port','referer','browser','version','%s\x20%s','unknown','device','vendor','format','%s\x20%s\x20%s','threadId','ChatInteraction','externalUrl','interaction','spread','messageId','created','autoclose','push','close','ChatMessage','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','*,*,*,*','forcedOwnership','queueId','queue','waitForTheAssignedQueue','Start','startRouting','EventManager','offline','files','ListId','send','from\x20is\x20mandatory','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKeyOffline','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','MailAccount','findOrCreate','readFileSync','server/files/templates/chatOfflineMessage.ejs','offlineMessageBody','ChatOfflineMessage','fromString','originalname','mimetype','server','offline-chat','basename','openNewInteraction','sequelize','transaction','Attachment','bulkCreate','MailServerOut','Smtp','CloudProvider','forwardOfflineAddress','getSmtpOptions','\x22%s\x22\x20<%s>','email','subjectOffline','toPairsIn','mapValues','Chat','MailAccountId','NotifyMailAccount','notifyMail','attachments','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','getInteractions','Contact','Owner','fullname','Tag','Tags','color','tag','Command','getSnippet','timezone','interval','iftime\x20%s','true','ONLINE','OFFLINE','No\x20timezone','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','inspect','Interval','getLicense','virtual','License','increment','chatLicenseExceeded','Intervals','all','some','server/files/chat/iframe.ejs','utf8'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0xf253,0x15b));var _0x3f25=function(_0x444d90,_0x11c679){_0x444d90=_0x444d90-0x0;var _0x3a8344=_0xf253[_0x444d90];return _0x3a8344;};'use strict';var BPromise=require(_0x3f25('0x0'));var Mustache=require(_0x3f25('0x1'));var util=require(_0x3f25('0x2'));var path=require(_0x3f25('0x3'));var ejs=require(_0x3f25('0x4'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3f25('0x5'));var querystring=require(_0x3f25('0x6'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require(_0x3f25('0x7'))(_0x3f25('0x8'));var config=require(_0x3f25('0x9'));var url=require(_0x3f25('0xa'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x3f25('0xb')](config['redis'],{'host':_0x3f25('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3f25('0xd')]));require(_0x3f25('0xe'))[_0x3f25('0xf')](socket);var htmlToText=require(_0x3f25('0x10'));var jayson=require(_0x3f25('0x11'));var client=jayson[_0x3f25('0x12')][_0x3f25('0x13')]({'port':0x232c});var client9002=jayson[_0x3f25('0x12')][_0x3f25('0x13')]({'port':0x232a});var client9003=jayson[_0x3f25('0x12')]['http']({'port':0x232b});var client9001=jayson['client'][_0x3f25('0x13')]({'port':0x2329});function respondWithRpcPromise(_0x598919,_0x4cb480,_0x504a1a,_0x15f07f){return new BPromise(function(_0x101254,_0x34b81d){var _0x3f1df5=_0x15f07f||client;return _0x3f1df5['request'](_0x598919,_0x504a1a)[_0x3f25('0x14')](function(_0x336656){logger[_0x3f25('0x15')](_0x3f25('0x16'),_0x4cb480,_0x3f25('0x17'));logger['debug'](_0x3f25('0x18'),_0x4cb480,'request\x20sent',JSON[_0x3f25('0x19')](_0x336656));if(_0x336656[_0x3f25('0x1a')]){if(_0x336656[_0x3f25('0x1a')]['code']===0x1f4){logger[_0x3f25('0x1a')](_0x3f25('0x16'),_0x4cb480,_0x336656[_0x3f25('0x1a')][_0x3f25('0x1b')]);return _0x34b81d(_0x336656[_0x3f25('0x1a')][_0x3f25('0x1b')]);}logger[_0x3f25('0x1a')](_0x3f25('0x16'),_0x4cb480,_0x336656[_0x3f25('0x1a')][_0x3f25('0x1b')]);return _0x101254(_0x336656['error'][_0x3f25('0x1b')]);}else{logger[_0x3f25('0x15')](_0x3f25('0x16'),_0x4cb480,_0x3f25('0x17'));_0x101254(_0x336656[_0x3f25('0x1c')]['message']);}})['catch'](function(_0x1acc07){logger[_0x3f25('0x1a')](_0x3f25('0x16'),_0x4cb480,_0x1acc07);_0x34b81d(_0x1acc07);});});}function respondWithStatusCode(_0x32aacf,_0x37b16a){_0x37b16a=_0x37b16a||0xcc;return function(_0x531993){if(_0x531993){return _0x32aacf[_0x3f25('0x1d')](_0x37b16a);}return _0x32aacf[_0x3f25('0x1e')](_0x37b16a)[_0x3f25('0x1f')]();};}function respondWithResult(_0x50d5b2,_0x15a9b2){_0x15a9b2=_0x15a9b2||0xc8;return function(_0x2a79e4){if(_0x2a79e4){return _0x50d5b2['status'](_0x15a9b2)['json'](_0x2a79e4);}};}function respondWithFilteredResult(_0x413bf5,_0x4ce2a9){return function(_0xa438ea){if(_0xa438ea){var _0x58736c=typeof _0x4ce2a9['offset']==='undefined'&&typeof _0x4ce2a9['limit']===_0x3f25('0x20');var _0x1c02a5=_0xa438ea[_0x3f25('0x21')];var _0x557649=_0x58736c?0x0:_0x4ce2a9['offset'];var _0x2cc070=_0x58736c?_0xa438ea['count']:_0x4ce2a9[_0x3f25('0x22')]+_0x4ce2a9['limit'];var _0x2f2de9;if(_0x2cc070>=_0x1c02a5){_0x2cc070=_0x1c02a5;_0x2f2de9=0xc8;}else{_0x2f2de9=0xce;}_0x413bf5['status'](_0x2f2de9);return _0x413bf5[_0x3f25('0x23')](_0x3f25('0x24'),_0x557649+'-'+_0x2cc070+'/'+_0x1c02a5)['json'](_0xa438ea);}return null;};}function saveUpdates(_0x10f007){return function(_0x53a17a){if(_0x53a17a){return _0x53a17a[_0x3f25('0x25')](_0x10f007)[_0x3f25('0x14')](function(_0x262d8a){return _0x262d8a;});}return null;};}function removeEntity(_0x4f9998){return function(_0x51bfc6){if(_0x51bfc6){return _0x51bfc6[_0x3f25('0x26')]()[_0x3f25('0x14')](function(){var _0xe8bcd7=_0x51bfc6[_0x3f25('0x27')]({'plain':!![]});var _0x55d2d4=_0x3f25('0x28');return db[_0x3f25('0x29')][_0x3f25('0x26')]({'where':{'type':_0x55d2d4,'resourceId':_0xe8bcd7['id']}})[_0x3f25('0x14')](function(){return _0x51bfc6;});})['then'](function(){_0x4f9998[_0x3f25('0x1e')](0xcc)[_0x3f25('0x1f')]();});}};}function handleEntityNotFound(_0x489ff3){return function(_0x49efe9){if(!_0x49efe9){_0x489ff3[_0x3f25('0x1d')](0x194);}return _0x49efe9;};}function handleError(_0x2964c7,_0x2cf438){_0x2cf438=_0x2cf438||0x1f4;return function(_0x4e33d4){logger[_0x3f25('0x1a')](_0x4e33d4[_0x3f25('0x2a')]);if(_0x4e33d4[_0x3f25('0x2b')]){delete _0x4e33d4['name'];}_0x2964c7[_0x3f25('0x1e')](_0x2cf438)['send'](_0x4e33d4);};}exports[_0x3f25('0x2c')]=function(_0x164352,_0x1208b1){var _0x20b89e={'include':[{'model':db[_0x3f25('0x2d')],'as':_0x3f25('0x2e')}]},_0x300696={},_0xe6e3dc={'count':0x0,'rows':[]};var _0x13e961=_[_0x3f25('0x2f')](db['ChatWebsite'][_0x3f25('0x30')],function(_0x47e098){return{'name':_0x47e098[_0x3f25('0x31')],'type':_0x47e098[_0x3f25('0x32')][_0x3f25('0x33')]};});_0x300696['model']=_[_0x3f25('0x2f')](_0x13e961,_0x3f25('0x2b'));_0x300696['query']=_[_0x3f25('0x34')](_0x164352['query']);_0x300696[_0x3f25('0x35')]=_[_0x3f25('0x36')](_0x300696[_0x3f25('0x37')],_0x300696[_0x3f25('0x38')]);_0x20b89e[_0x3f25('0x39')]=_[_0x3f25('0x36')](_0x300696[_0x3f25('0x37')],qs[_0x3f25('0x3a')](_0x164352[_0x3f25('0x38')]['fields']));_0x20b89e[_0x3f25('0x39')]=_0x20b89e[_0x3f25('0x39')][_0x3f25('0x3b')]?_0x20b89e['attributes']:_0x300696['model'];if(!_0x164352[_0x3f25('0x38')][_0x3f25('0x3c')](_0x3f25('0x3d'))){_0x20b89e[_0x3f25('0x3e')]=qs[_0x3f25('0x3e')](_0x164352['query'][_0x3f25('0x3e')]);_0x20b89e[_0x3f25('0x22')]=qs[_0x3f25('0x22')](_0x164352['query']['offset']);}_0x20b89e[_0x3f25('0x3f')]=qs[_0x3f25('0x40')](_0x164352[_0x3f25('0x38')][_0x3f25('0x40')]);_0x20b89e['where']=qs[_0x3f25('0x35')](_[_0x3f25('0x41')](_0x164352['query'],_0x300696['filters']),_0x13e961);if(_0x164352['query']['filter']){_0x20b89e[_0x3f25('0x42')]=_[_0x3f25('0x43')](_0x20b89e[_0x3f25('0x42')],{'$or':_['map'](_0x13e961,function(_0x1f3a29){if(_0x1f3a29[_0x3f25('0x32')]!=='VIRTUAL'){var _0xe3577b={};_0xe3577b[_0x1f3a29[_0x3f25('0x2b')]]={'$like':'%'+_0x164352[_0x3f25('0x38')]['filter']+'%'};return _0xe3577b;}})});}_0x20b89e=_[_0x3f25('0x43')]({},_0x20b89e,_0x164352[_0x3f25('0x44')]);var _0xd60f0b={'where':_0x20b89e[_0x3f25('0x42')]};return db['ChatWebsite'][_0x3f25('0x21')](_0xd60f0b)[_0x3f25('0x14')](function(_0xf6567d){_0xe6e3dc[_0x3f25('0x21')]=_0xf6567d;if(_0x164352[_0x3f25('0x38')][_0x3f25('0x45')]){_0x20b89e[_0x3f25('0x46')]=[{'all':!![]}];}return db[_0x3f25('0x47')][_0x3f25('0x48')](_0x20b89e);})[_0x3f25('0x14')](function(_0x237b43){_0xe6e3dc[_0x3f25('0x49')]=_0x237b43;return _0xe6e3dc;})[_0x3f25('0x14')](respondWithFilteredResult(_0x1208b1,_0x20b89e))[_0x3f25('0x4a')](handleError(_0x1208b1,null));};exports['show']=function(_0x277b4b,_0x2c3dbd){var _0x4d5d0a={'raw':![],'where':{'id':_0x277b4b[_0x3f25('0x4b')]['id']},'include':[{'model':db[_0x3f25('0x2d')],'as':_0x3f25('0x2e')}]},_0x49b9c9={};_0x49b9c9['model']=_[_0x3f25('0x34')](db[_0x3f25('0x47')][_0x3f25('0x30')]);_0x49b9c9['query']=_[_0x3f25('0x34')](_0x277b4b[_0x3f25('0x38')]);_0x49b9c9[_0x3f25('0x35')]=_[_0x3f25('0x36')](_0x49b9c9[_0x3f25('0x37')],_0x49b9c9[_0x3f25('0x38')]);_0x4d5d0a[_0x3f25('0x39')]=_[_0x3f25('0x36')](_0x49b9c9[_0x3f25('0x37')],qs[_0x3f25('0x3a')](_0x277b4b[_0x3f25('0x38')]['fields']));_0x4d5d0a[_0x3f25('0x39')]=_0x4d5d0a[_0x3f25('0x39')]['length']?_0x4d5d0a[_0x3f25('0x39')]:_0x49b9c9[_0x3f25('0x37')];if(_0x277b4b['query']['includeAll']){_0x4d5d0a[_0x3f25('0x46')]=[{'all':!![]}];}_0x4d5d0a=_[_0x3f25('0x43')]({},_0x4d5d0a,_0x277b4b[_0x3f25('0x44')]);return db[_0x3f25('0x47')][_0x3f25('0x4c')](_0x4d5d0a)[_0x3f25('0x14')](handleEntityNotFound(_0x2c3dbd,null))[_0x3f25('0x14')](respondWithResult(_0x2c3dbd,null))['catch'](handleError(_0x2c3dbd,null));};exports['create']=function(_0x5d5bd1,_0x3f545d){return db[_0x3f25('0x47')][_0x3f25('0x4d')](_0x5d5bd1['body'],{})['then'](function(_0x5400a0){var _0x55130e=_0x5d5bd1[_0x3f25('0x4e')][_0x3f25('0x27')]({'plain':!![]});if(!_0x55130e)throw new Error(_0x3f25('0x4f'));if(_0x55130e[_0x3f25('0x50')]===_0x3f25('0x4e')){var _0x3265d0=_0x5400a0[_0x3f25('0x27')]({'plain':!![]});var _0x4626cf='ChatWebsites';return db['UserProfileSection'][_0x3f25('0x4c')]({'where':{'name':_0x4626cf,'userProfileId':_0x55130e[_0x3f25('0x51')]},'raw':!![]})[_0x3f25('0x14')](function(_0x16c4d3){if(_0x16c4d3&&_0x16c4d3[_0x3f25('0x52')]===0x0){return db['UserProfileResource']['create']({'name':_0x3265d0[_0x3f25('0x2b')],'resourceId':_0x3265d0['id'],'type':_0x16c4d3['name'],'sectionId':_0x16c4d3['id']},{})[_0x3f25('0x14')](function(){return _0x5400a0;});}else{return _0x5400a0;}})['catch'](function(_0x34b262){logger[_0x3f25('0x1a')](_0x3f25('0x53'),_0x34b262);throw _0x34b262;});}return _0x5400a0;})['then'](respondWithResult(_0x3f545d,0xc9))[_0x3f25('0x4a')](handleError(_0x3f545d,null));};exports['update']=function(_0x202ce6,_0x2727ab){if(_0x202ce6[_0x3f25('0x54')]['id']){delete _0x202ce6[_0x3f25('0x54')]['id'];}return db[_0x3f25('0x47')][_0x3f25('0x4c')]({'where':{'id':_0x202ce6[_0x3f25('0x4b')]['id']},'include':[{'model':db[_0x3f25('0x2d')],'as':_0x3f25('0x2e')}]})['then'](handleEntityNotFound(_0x2727ab,null))[_0x3f25('0x14')](saveUpdates(_0x202ce6[_0x3f25('0x54')],null))[_0x3f25('0x14')](respondWithResult(_0x2727ab,null))[_0x3f25('0x4a')](handleError(_0x2727ab,null));};exports['destroy']=function(_0x3b3ea2,_0x3bfdb4){return db[_0x3f25('0x47')][_0x3f25('0x4c')]({'where':{'id':_0x3b3ea2[_0x3f25('0x4b')]['id']}})[_0x3f25('0x14')](handleEntityNotFound(_0x3bfdb4,null))['then'](removeEntity(_0x3bfdb4,null))[_0x3f25('0x4a')](handleError(_0x3bfdb4,null));};exports[_0x3f25('0x55')]=function(_0x1bc628,_0x3fc968){return db['ChatWebsite'][_0x3f25('0x55')]()[_0x3f25('0x14')](respondWithResult(_0x3fc968,null))[_0x3f25('0x4a')](handleError(_0x3fc968,null));};exports['addDisposition']=function(_0x179246,_0x5779c0){if(_0x179246['body']['id']){delete _0x179246[_0x3f25('0x54')]['id'];}return db['ChatWebsite'][_0x3f25('0x4c')]({'where':{'id':_0x179246['params']['id']}})[_0x3f25('0x14')](handleEntityNotFound(_0x5779c0,null))[_0x3f25('0x14')](function(_0x4c8fdd){if(_0x4c8fdd){_0x179246[_0x3f25('0x54')][_0x3f25('0x56')]=_0x4c8fdd['id'];return db[_0x3f25('0x57')][_0x3f25('0x4d')](_0x179246[_0x3f25('0x54')]);}})['then'](respondWithResult(_0x5779c0,null))[_0x3f25('0x4a')](handleError(_0x5779c0,null));};exports[_0x3f25('0x58')]=function(_0xd12714,_0x1cfe10){var _0x269fb1={'raw':![],'where':{}};var _0x22a127={};var _0x531986={'count':0x0,'rows':[]};return db[_0x3f25('0x47')]['findOne']({'where':{'id':_0xd12714[_0x3f25('0x4b')]['id']}})[_0x3f25('0x14')](handleEntityNotFound(_0x1cfe10,null))['then'](function(_0x37f3f1){if(_0x37f3f1){_0x22a127['model']=_[_0x3f25('0x34')](db[_0x3f25('0x57')][_0x3f25('0x30')]);_0x22a127[_0x3f25('0x38')]=_[_0x3f25('0x34')](_0xd12714[_0x3f25('0x38')]);_0x22a127[_0x3f25('0x35')]=_[_0x3f25('0x36')](_0x22a127[_0x3f25('0x37')],_0x22a127[_0x3f25('0x38')]);_0x269fb1[_0x3f25('0x39')]=_[_0x3f25('0x36')](_0x22a127[_0x3f25('0x37')],qs['fields'](_0xd12714[_0x3f25('0x38')]['fields']));_0x269fb1[_0x3f25('0x39')]=_0x269fb1['attributes'][_0x3f25('0x3b')]?_0x269fb1[_0x3f25('0x39')]:_0x22a127[_0x3f25('0x37')];if(!_0xd12714[_0x3f25('0x38')][_0x3f25('0x3c')](_0x3f25('0x3d'))){_0x269fb1[_0x3f25('0x3e')]=qs['limit'](_0xd12714['query'][_0x3f25('0x3e')]);_0x269fb1[_0x3f25('0x22')]=qs['offset'](_0xd12714[_0x3f25('0x38')]['offset']);}_0x269fb1[_0x3f25('0x3f')]=qs[_0x3f25('0x40')](_0xd12714[_0x3f25('0x38')][_0x3f25('0x40')]);_0x269fb1[_0x3f25('0x42')]=qs[_0x3f25('0x35')](_[_0x3f25('0x41')](_0xd12714[_0x3f25('0x38')],_0x22a127[_0x3f25('0x35')]));_0x269fb1[_0x3f25('0x42')][_0x3f25('0x56')]=_0x37f3f1['id'];if(_0xd12714[_0x3f25('0x38')][_0x3f25('0x59')]){_0x269fb1[_0x3f25('0x42')]=_[_0x3f25('0x43')](_0x269fb1[_0x3f25('0x42')],{'$or':_[_0x3f25('0x2f')](_0x269fb1[_0x3f25('0x39')],function(_0x5ec5cf){var _0x4467a6={};_0x4467a6[_0x5ec5cf]={'$like':'%'+_0xd12714[_0x3f25('0x38')][_0x3f25('0x59')]+'%'};return _0x4467a6;})});}_0x269fb1=_[_0x3f25('0x43')]({},_0x269fb1,_0xd12714[_0x3f25('0x44')]);return db[_0x3f25('0x57')]['count']({'where':_0x269fb1[_0x3f25('0x42')]})[_0x3f25('0x14')](function(_0x2c20b0){_0x531986['count']=_0x2c20b0;if(_0xd12714[_0x3f25('0x38')][_0x3f25('0x45')]){_0x269fb1['include']=[{'all':!![]}];}return db[_0x3f25('0x57')][_0x3f25('0x48')](_0x269fb1);})[_0x3f25('0x14')](function(_0x407d8b){_0x531986[_0x3f25('0x49')]=_0x407d8b;return _0x531986;});}})[_0x3f25('0x14')](respondWithFilteredResult(_0x1cfe10,_0x269fb1))[_0x3f25('0x4a')](handleError(_0x1cfe10,null));};exports['removeDispositions']=function(_0x4e8bcf,_0xb5b9de){return db[_0x3f25('0x47')]['find']({'where':{'id':_0x4e8bcf[_0x3f25('0x4b')]['id']}})[_0x3f25('0x14')](handleEntityNotFound(_0xb5b9de,null))['then'](function(_0x144947){if(_0x144947){return _0x144947[_0x3f25('0x5a')](_0x4e8bcf[_0x3f25('0x38')]['ids']);}})[_0x3f25('0x14')](respondWithStatusCode(_0xb5b9de,null))[_0x3f25('0x4a')](handleError(_0xb5b9de,null));};exports[_0x3f25('0x5b')]=function(_0x4f1f13,_0x33003f){if(_0x4f1f13['body']['id']){delete _0x4f1f13[_0x3f25('0x54')]['id'];}return db['ChatWebsite'][_0x3f25('0x4c')]({'where':{'id':_0x4f1f13['params']['id']}})[_0x3f25('0x14')](handleEntityNotFound(_0x33003f,null))[_0x3f25('0x14')](function(_0x225e5b){if(_0x225e5b){_0x4f1f13[_0x3f25('0x54')]['ChatWebsiteId']=_0x225e5b['id'];return db[_0x3f25('0x5c')][_0x3f25('0x4d')](_0x4f1f13['body']);}})['then'](respondWithResult(_0x33003f,null))['catch'](handleError(_0x33003f,null));};exports[_0x3f25('0x5d')]=function(_0x29a5ec,_0x9f8aed){var _0x4a1950={'raw':![],'where':{}};var _0x3520e8={};var _0x323297={'count':0x0,'rows':[]};return db[_0x3f25('0x47')][_0x3f25('0x5e')]({'where':{'id':_0x29a5ec[_0x3f25('0x4b')]['id']}})[_0x3f25('0x14')](handleEntityNotFound(_0x9f8aed,null))['then'](function(_0x3d9c7d){if(_0x3d9c7d){_0x3520e8['model']=_[_0x3f25('0x34')](db[_0x3f25('0x5c')][_0x3f25('0x30')]);_0x3520e8[_0x3f25('0x38')]=_['keys'](_0x29a5ec['query']);_0x3520e8[_0x3f25('0x35')]=_[_0x3f25('0x36')](_0x3520e8[_0x3f25('0x37')],_0x3520e8[_0x3f25('0x38')]);_0x4a1950['attributes']=_[_0x3f25('0x36')](_0x3520e8['model'],qs[_0x3f25('0x3a')](_0x29a5ec[_0x3f25('0x38')]['fields']));_0x4a1950[_0x3f25('0x39')]=_0x4a1950['attributes'][_0x3f25('0x3b')]?_0x4a1950[_0x3f25('0x39')]:_0x3520e8[_0x3f25('0x37')];if(!_0x29a5ec[_0x3f25('0x38')][_0x3f25('0x3c')](_0x3f25('0x3d'))){_0x4a1950[_0x3f25('0x3e')]=qs[_0x3f25('0x3e')](_0x29a5ec[_0x3f25('0x38')][_0x3f25('0x3e')]);_0x4a1950[_0x3f25('0x22')]=qs[_0x3f25('0x22')](_0x29a5ec[_0x3f25('0x38')][_0x3f25('0x22')]);}_0x4a1950[_0x3f25('0x3f')]=qs[_0x3f25('0x40')](_0x29a5ec[_0x3f25('0x38')][_0x3f25('0x40')]);_0x4a1950[_0x3f25('0x42')]=qs['filters'](_[_0x3f25('0x41')](_0x29a5ec[_0x3f25('0x38')],_0x3520e8[_0x3f25('0x35')]));_0x4a1950[_0x3f25('0x42')][_0x3f25('0x56')]=_0x3d9c7d['id'];if(_0x29a5ec['query']['filter']){_0x4a1950[_0x3f25('0x42')]=_[_0x3f25('0x43')](_0x4a1950[_0x3f25('0x42')],{'$or':_['map'](_0x4a1950['attributes'],function(_0x2b6b91){var _0x4ba370={};_0x4ba370[_0x2b6b91]={'$like':'%'+_0x29a5ec['query'][_0x3f25('0x59')]+'%'};return _0x4ba370;})});}_0x4a1950=_['merge']({},_0x4a1950,_0x29a5ec['options']);return db['CannedAnswer'][_0x3f25('0x21')]({'where':_0x4a1950[_0x3f25('0x42')]})[_0x3f25('0x14')](function(_0x56ebf2){_0x323297[_0x3f25('0x21')]=_0x56ebf2;if(_0x29a5ec[_0x3f25('0x38')][_0x3f25('0x45')]){_0x4a1950['include']=[{'all':!![]}];}return db[_0x3f25('0x5c')]['findAll'](_0x4a1950);})[_0x3f25('0x14')](function(_0x5013a1){_0x323297[_0x3f25('0x49')]=_0x5013a1;return _0x323297;});}})[_0x3f25('0x14')](respondWithFilteredResult(_0x9f8aed,_0x4a1950))[_0x3f25('0x4a')](handleError(_0x9f8aed,null));};exports[_0x3f25('0x5f')]=function(_0x2c8d37,_0x168d77){return db[_0x3f25('0x47')][_0x3f25('0x4c')]({'where':{'id':_0x2c8d37['params']['id']}})[_0x3f25('0x14')](handleEntityNotFound(_0x168d77,null))[_0x3f25('0x14')](function(_0x16c23b){if(_0x16c23b){return _0x16c23b[_0x3f25('0x5f')](_0x2c8d37[_0x3f25('0x38')][_0x3f25('0x60')]);}})[_0x3f25('0x14')](respondWithStatusCode(_0x168d77,null))[_0x3f25('0x4a')](handleError(_0x168d77,null));};exports[_0x3f25('0x61')]=function(_0x5ad855,_0x10ce20){_0x5ad855[_0x3f25('0x54')][_0x3f25('0x62')]=_0x5ad855[_0x3f25('0x63')][_0x3f25('0x64')];return db[_0x3f25('0x47')]['find']({'where':{'id':_0x5ad855[_0x3f25('0x4b')]['id']}})['then'](handleEntityNotFound(_0x10ce20,null))[_0x3f25('0x14')](saveUpdates(_0x5ad855[_0x3f25('0x54')],null))[_0x3f25('0x14')](respondWithResult(_0x10ce20,null))[_0x3f25('0x4a')](handleError(_0x10ce20,null));};exports[_0x3f25('0x65')]=function(_0x3b40d9,_0x577abb){_0x3b40d9['body'][_0x3f25('0x66')]=_0x3b40d9[_0x3f25('0x63')]['filename'];return db[_0x3f25('0x47')][_0x3f25('0x4c')]({'where':{'id':_0x3b40d9[_0x3f25('0x4b')]['id']}})[_0x3f25('0x14')](handleEntityNotFound(_0x577abb,null))[_0x3f25('0x14')](saveUpdates(_0x3b40d9[_0x3f25('0x54')],null))[_0x3f25('0x14')](respondWithResult(_0x577abb,null))[_0x3f25('0x4a')](handleError(_0x577abb,null));};exports[_0x3f25('0x67')]=function(_0x2ac9e6,_0x4fe45d){_0x2ac9e6['body'][_0x3f25('0x68')]=_0x2ac9e6['file'][_0x3f25('0x64')];return db[_0x3f25('0x47')][_0x3f25('0x4c')]({'where':{'id':_0x2ac9e6['params']['id']}})[_0x3f25('0x14')](handleEntityNotFound(_0x4fe45d,null))['then'](saveUpdates(_0x2ac9e6['body'],null))['then'](respondWithResult(_0x4fe45d,null))[_0x3f25('0x4a')](handleError(_0x4fe45d,null));};exports[_0x3f25('0x69')]=function(_0x13f18b,_0x315555){_0x13f18b[_0x3f25('0x54')]['systemAvatar']=_0x13f18b[_0x3f25('0x63')]['filename'];return db[_0x3f25('0x47')][_0x3f25('0x4c')]({'where':{'id':_0x13f18b[_0x3f25('0x4b')]['id']}})[_0x3f25('0x14')](handleEntityNotFound(_0x315555,null))[_0x3f25('0x14')](saveUpdates(_0x13f18b[_0x3f25('0x54')],null))[_0x3f25('0x14')](respondWithResult(_0x315555,null))[_0x3f25('0x4a')](handleError(_0x315555,null));};exports[_0x3f25('0x6a')]=function(_0x58b35e,_0x4e4944){var _0x8e341f=path[_0x3f25('0x6b')](config[_0x3f25('0x6c')],_0x3f25('0x6d'));var _0x253c9f={'where':{'id':_0x58b35e['params']['id']},'attributes':['id',_0x3f25('0x62')],'raw':!![]};var _0x3fb4de=![];return require(_0x3f25('0x6e'))['getLicense']()[_0x3f25('0x14')](function(_0x4aaa1e){if(_0x4aaa1e){_0x3fb4de=_0x4aaa1e[_0x3f25('0x6f')];}})[_0x3f25('0x14')](function(){return db[_0x3f25('0x47')][_0x3f25('0x4c')](_0x253c9f);})[_0x3f25('0x14')](handleEntityNotFound(_0x4e4944,null))[_0x3f25('0x14')](function(_0x135256){if(_0x135256){if(!_[_0x3f25('0x70')](_0x135256['sitepic'])){if(fs[_0x3f25('0x71')](path[_0x3f25('0x6b')](config['root'],_0x3f25('0x72'),_0x135256['sitepic']))&&_0x3fb4de){_0x8e341f=path['join'](config[_0x3f25('0x6c')],_0x3f25('0x72'),_0x135256[_0x3f25('0x62')]);}}return _0x4e4944[_0x3f25('0x73')](_0x8e341f);}})[_0x3f25('0x4a')](handleError(_0x4e4944,null));};exports['getAvatar']=function(_0x111452,_0x27277d){var _0x414aec=path['join'](config[_0x3f25('0x6c')],_0x3f25('0x74'));var _0x49d289={'where':{'id':_0x111452[_0x3f25('0x4b')]['id']},'attributes':['id',_0x3f25('0x66')],'raw':!![]};return db[_0x3f25('0x47')][_0x3f25('0x4c')](_0x49d289)[_0x3f25('0x14')](handleEntityNotFound(_0x27277d,null))[_0x3f25('0x14')](function(_0x17d7ac){if(_0x17d7ac){if(!_['isNil'](_0x17d7ac[_0x3f25('0x66')])){if(fs[_0x3f25('0x71')](path[_0x3f25('0x6b')](config[_0x3f25('0x6c')],_0x3f25('0x75'),_0x17d7ac[_0x3f25('0x66')]))){_0x414aec=path[_0x3f25('0x6b')](config[_0x3f25('0x6c')],'server/files/images/avatars/',_0x17d7ac[_0x3f25('0x66')]);}}return _0x27277d[_0x3f25('0x73')](_0x414aec);}})[_0x3f25('0x4a')](handleError(_0x27277d,null));};exports[_0x3f25('0x76')]=function(_0x3cc74f,_0x27fc30){var _0x3b2b8c=path['join'](config[_0x3f25('0x6c')],_0x3f25('0x77'));var _0x4d5903={'where':{'id':_0x3cc74f[_0x3f25('0x4b')]['id']},'attributes':['id',_0x3f25('0x68'),_0x3f25('0x78')],'raw':!![]};return db[_0x3f25('0x47')][_0x3f25('0x4c')](_0x4d5903)[_0x3f25('0x14')](handleEntityNotFound(_0x27fc30,null))[_0x3f25('0x14')](function(_0x16669f){if(_0x16669f){if(!_['isNil'](_0x16669f[_0x3f25('0x68')])){if(fs[_0x3f25('0x71')](path[_0x3f25('0x6b')](config[_0x3f25('0x6c')],_0x3f25('0x75'),_0x16669f[_0x3f25('0x68')]))&&_0x16669f['showCustomerAvatar']){_0x3b2b8c=path['join'](config[_0x3f25('0x6c')],_0x3f25('0x75'),_0x16669f[_0x3f25('0x68')]);}}return _0x27fc30[_0x3f25('0x73')](_0x3b2b8c);}})[_0x3f25('0x4a')](handleError(_0x27fc30,null));};exports['getSystemAvatar']=function(_0x37bc67,_0x4dd414){var _0x9e3ed=path[_0x3f25('0x6b')](config[_0x3f25('0x6c')],_0x3f25('0x79'));var _0x40552b={'where':{'id':_0x37bc67[_0x3f25('0x4b')]['id']},'attributes':['id',_0x3f25('0x7a')],'raw':!![]};return db[_0x3f25('0x47')][_0x3f25('0x4c')](_0x40552b)['then'](handleEntityNotFound(_0x4dd414,null))[_0x3f25('0x14')](function(_0xf2b3ae){if(_0xf2b3ae){if(!_[_0x3f25('0x70')](_0xf2b3ae['systemAvatar'])){if(fs[_0x3f25('0x71')](path[_0x3f25('0x6b')](config['root'],_0x3f25('0x75'),_0xf2b3ae[_0x3f25('0x7a')]))){_0x9e3ed=path[_0x3f25('0x6b')](config['root'],'server/files/images/avatars/',_0xf2b3ae[_0x3f25('0x7a')]);}}return _0x4dd414[_0x3f25('0x73')](_0x9e3ed);}})[_0x3f25('0x4a')](handleError(_0x4dd414,null));};exports[_0x3f25('0x7b')]=function(_0x2d6487,_0x5f74d6){var _0x5513aa=require(_0x3f25('0x7c'));var _0x4c3c54=new _0x5513aa();var _0x5dea99=_0x4c3c54[_0x3f25('0x7d')](_0x2d6487[_0x3f25('0x7e')]['user-agent'])[_0x3f25('0x7f')]();var _0x59ffba={'body':_0x2d6487['body'],'channel':_0x3f25('0x80')};var _0x1d6170=[];var _0x2634da=[];var _0x42925d={};var _0x33a650=![];return db[_0x3f25('0x81')][_0x3f25('0x55')]()['then'](function(_0x2d1ec3){if(!_0x2d1ec3){throw new db['Sequelize']['ValidationError'](_0x3f25('0x82'));}_0x1d6170=_[_0x3f25('0x83')](_['keys'](_0x2d1ec3),['createdAt',_0x3f25('0x84')]);_0x2634da=_[_0x3f25('0x83')](_['keys'](_0x2d1ec3),[_0x3f25('0x85'),_0x3f25('0x84'),'CompanyId','ListId']);if(_0x2d6487[_0x3f25('0x54')]['id']){delete _0x2d6487[_0x3f25('0x54')]['id'];}if(_[_0x3f25('0x70')](_0x2d6487[_0x3f25('0x54')][_0x3f25('0x86')])){throw new db[(_0x3f25('0x87'))][(_0x3f25('0x88'))]('from\x20is\x20mandatory');}if(_['isNil'](_0x2d6487[_0x3f25('0x54')][_0x3f25('0x54')])||_0x2d6487[_0x3f25('0x54')][_0x3f25('0x54')]===''){throw new db[(_0x3f25('0x87'))][(_0x3f25('0x88'))](_0x3f25('0x89'));}if(_['isNil'](_0x2d6487['body'][_0x3f25('0x8a')])){throw new db[(_0x3f25('0x87'))][(_0x3f25('0x88'))](_0x3f25('0x8b')+_0x2634da);}if(!_['includes'](_0x2634da,_0x2d6487[_0x3f25('0x54')][_0x3f25('0x8a')])){throw new db['Sequelize'][(_0x3f25('0x88'))](_0x3f25('0x8c')+_0x2634da);}_0x42925d[_0x2d6487[_0x3f25('0x54')][_0x3f25('0x8a')]]=_0x2d6487[_0x3f25('0x54')][_0x3f25('0x86')];})[_0x3f25('0x14')](function(){return db[_0x3f25('0x47')][_0x3f25('0x4c')]({'where':{'id':_0x2d6487[_0x3f25('0x4b')]['id']},'include':[{'model':db['CmList'],'as':_0x3f25('0x8d'),'include':[{'model':db['CmContact'],'as':_0x3f25('0x8e'),'where':_0x42925d,'limit':0x1,'order':[[_0x3f25('0x84'),_0x3f25('0x8f')]]}]},{'model':db[_0x3f25('0x90')],'as':_0x3f25('0x91')}]});})[_0x3f25('0x14')](handleEntityNotFound(_0x5f74d6,null))[_0x3f25('0x14')](function(_0x1e3dd0){if(_0x1e3dd0&&_0x1e3dd0[_0x3f25('0x8d')]){_0x59ffba[_0x3f25('0x92')]=_0x1e3dd0;_0x59ffba['applications']=_0x1e3dd0['Applications'];_0x59ffba[_0x3f25('0x93')]=_0x1e3dd0[_0x3f25('0x8d')];_0x59ffba[_0x3f25('0x94')]=_[_0x3f25('0x95')](_0x59ffba[_0x3f25('0x94')],['priority'],['asc']);if(_0x59ffba[_0x3f25('0x92')][_0x3f25('0x91')]){delete _0x59ffba[_0x3f25('0x92')][_0x3f25('0x91')];}if(_0x59ffba[_0x3f25('0x92')][_0x3f25('0x8d')]&&_0x59ffba[_0x3f25('0x92')][_0x3f25('0x8d')][_0x3f25('0x8e')][_0x3f25('0x3b')]){return _0x59ffba['account'][_0x3f25('0x8d')][_0x3f25('0x8e')][0x0];}var _0x3944da=_['defaults'](_0x2d6487[_0x3f25('0x54')],{'firstName':_0x2d6487[_0x3f25('0x54')][_0x3f25('0x86')],'ListId':_0x1e3dd0['ListId']});_0x3944da[_0x2d6487['body'][_0x3f25('0x8a')]]=_0x2d6487[_0x3f25('0x54')]['from'];return db[_0x3f25('0x81')]['create'](_0x3944da,{'fields':_0x1d6170,'raw':!![]});}})[_0x3f25('0x14')](handleEntityNotFound(_0x5f74d6,null))[_0x3f25('0x14')](function(_0xd01b55){_0x59ffba[_0x3f25('0x96')]=_0xd01b55;var _0x1f9e38=_0x2d6487[_0x3f25('0x54')][_0x3f25('0x97')];if(_0x2d6487[_0x3f25('0x7e')][_0x3f25('0x98')]){_0x1f9e38=_0x2d6487[_0x3f25('0x7e')]['cf-connecting-ip'];}else if(_0x2d6487['headers']['x-forwarded-for']){_0x1f9e38=_[_0x3f25('0x99')](_0x2d6487[_0x3f25('0x7e')][_0x3f25('0x9a')]['split'](','));}if(_0xd01b55){var _0x35587f={'ContactId':_0xd01b55['id'],'ChatWebsiteId':_0x2d6487[_0x3f25('0x4b')]['id'],'from':(_0xd01b55[_0x3f25('0x9b')]||'')+'\x20'+(_0xd01b55[_0x3f25('0x9c')]||''),'customerIp':_0x1f9e38,'customerPort':_0x2d6487['headers']['x-real-port']?_0x2d6487[_0x3f25('0x7e')][_0x3f25('0x9d')]:null,'referer':_0x2d6487[_0x3f25('0x54')][_0x3f25('0x9e')],'browserName':_0x5dea99[_0x3f25('0x9f')][_0x3f25('0x2b')]&&_0x5dea99[_0x3f25('0x9f')][_0x3f25('0xa0')]?util['format'](_0x3f25('0xa1'),_0x5dea99[_0x3f25('0x9f')]['name'],_0x5dea99['browser'][_0x3f25('0xa0')]):_0x3f25('0xa2'),'browserVersion':_0x5dea99[_0x3f25('0x9f')][_0x3f25('0xa0')]||'unknown','osName':util['format'](_0x3f25('0xa1'),_0x5dea99['os'][_0x3f25('0x2b')],_0x5dea99['os'][_0x3f25('0xa0')]),'osVersion':_0x5dea99['os'][_0x3f25('0xa0')],'deviceModel':_0x5dea99[_0x3f25('0xa3')]['model']&&_0x5dea99['device'][_0x3f25('0xa4')]?util[_0x3f25('0xa5')](_0x3f25('0xa6'),_0x5dea99[_0x3f25('0xa3')][_0x3f25('0x37')],_0x5dea99['device']['vendor'],_0x5dea99[_0x3f25('0xa3')][_0x3f25('0x32')]):null,'deviceVendor':_0x5dea99[_0x3f25('0xa3')]['vendor'],'deviceType':_0x5dea99['device'][_0x3f25('0x32')],'formData':JSON[_0x3f25('0x19')](_0x2d6487['body'])};var _0x40891a={'ChatWebsiteId':_0x2d6487[_0x3f25('0x4b')]['id'],'closed':![]};if(_0x2d6487[_0x3f25('0x54')][_0x3f25('0xa7')]){_0x40891a[_0x3f25('0xa7')]=_0x2d6487['body'][_0x3f25('0xa7')];return db[_0x3f25('0xa8')][_0x3f25('0x4c')]({'where':_0x40891a})['then'](function(_0x5b091f){if(_0x5b091f){return[_0x5b091f,![]];}_0x35587f[_0x3f25('0xa7')]=_0x2d6487['body']['threadId'];_0x35587f[_0x3f25('0xa9')]=_0x2d6487[_0x3f25('0x54')][_0x3f25('0xa9')];return db[_0x3f25('0xa8')][_0x3f25('0x4d')](_0x35587f)[_0x3f25('0x14')](function(_0x85651d){return[_0x85651d,!![]];});});}_0x40891a['ContactId']=_0xd01b55['id'];if(_0x2d6487[_0x3f25('0x54')][_0x3f25('0xaa')]&&_0x2d6487['body'][_0x3f25('0xaa')]['id']){_0x40891a['id']=_0x2d6487[_0x3f25('0x54')][_0x3f25('0xaa')]['id'];return db[_0x3f25('0xa8')][_0x3f25('0x4c')]({'where':_0x40891a})[_0x3f25('0x14')](function(_0x267d6c){if(_0x267d6c){return[_0x267d6c,![]];}return db[_0x3f25('0xa8')]['create'](_0x35587f)['then'](function(_0x3ccc60){return[_0x3ccc60,!![]];});});}return db[_0x3f25('0xa8')][_0x3f25('0x4d')](_0x35587f)[_0x3f25('0x14')](function(_0x360e40){return[_0x360e40,!![]];});}})[_0x3f25('0xab')](function(_0x2bb646,_0x4af055){if(_0x2bb646){_0x33a650=_0x4af055;if(!_0x4af055){var _0x329494={'from':(_0x59ffba[_0x3f25('0x96')][_0x3f25('0x9b')]||'')+'\x20'+(_0x59ffba[_0x3f25('0x96')][_0x3f25('0x9c')]||'')};if(_0x2d6487['body']['threadId']&&_0x2d6487[_0x3f25('0x54')][_0x3f25('0xac')]&&_0x2d6487[_0x3f25('0x54')][_0x3f25('0xa7')]!=_0x2d6487[_0x3f25('0x54')]['messageId']){_0x329494[_0x3f25('0xa7')]=_0x2d6487[_0x3f25('0x54')][_0x3f25('0xac')];}return _0x2bb646[_0x3f25('0x25')](_0x329494);}else{return _0x2bb646;}}})[_0x3f25('0x14')](function(_0x3dfecb){_0x59ffba['interaction']=_0x3dfecb[_0x3f25('0x27')]({'plain':!![]});_0x59ffba[_0x3f25('0xaa')][_0x3f25('0xad')]=_0x33a650;if(_0x59ffba[_0x3f25('0xaa')][_0x3f25('0xad')]){if(_0x59ffba[_0x3f25('0x92')][_0x3f25('0xae')]){_0x59ffba[_0x3f25('0x94')][_0x3f25('0xaf')]({'id':0x0,'priority':_0x59ffba[_0x3f25('0x94')][_0x3f25('0x3b')]+0x1,'app':_0x3f25('0xb0'),'appdata':'unmanaged','interval':'*,*,*,*'});}}return db[_0x3f25('0xb1')]['create']({'body':_0x2d6487[_0x3f25('0x54')][_0x3f25('0x54')],'ChatWebsiteId':_0x2d6487[_0x3f25('0x4b')]['id'],'ChatInteractionId':_0x3dfecb['id'],'direction':'in','ContactId':_0x59ffba['contact']['id'],'AttachmentId':_0x2d6487[_0x3f25('0x54')][_0x3f25('0xb2')]});})[_0x3f25('0x14')](function(_0x3c33a7){_0x59ffba[_0x3f25('0x1b')]=_0x3c33a7;if(!_0x59ffba[_0x3f25('0xaa')][_0x3f25('0xb3')]){return;}return db[_0x3f25('0xb4')][_0x3f25('0x4c')]({'attributes':['id',_0x3f25('0x2b')],'where':{'id':_0x59ffba['interaction'][_0x3f25('0xb3')]}});})[_0x3f25('0x14')](function(_0x28f4b4){if(_0x28f4b4){_0x59ffba['applications'][_0x3f25('0xb5')]({'id':0x0,'priority':0x0,'app':_0x3f25('0xb6'),'appdata':_0x28f4b4[_0x3f25('0x2b')]+','+(_0x59ffba[_0x3f25('0x92')][_0x3f25('0xb7')]||0xa),'interval':_0x3f25('0xb8')});_0x59ffba[_0x3f25('0xb9')]=!![];}if(!_0x59ffba[_0x3f25('0xaa')][_0x3f25('0xba')]){return;}return db['ChatQueue'][_0x3f25('0x4c')]({'attributes':['id','name'],'where':{'id':_0x59ffba[_0x3f25('0xaa')][_0x3f25('0xba')]}});})['then'](function(_0x17d06c){if(_0x17d06c){_0x59ffba[_0x3f25('0x94')][_0x3f25('0xb5')]({'id':0x0,'priority':0x1,'app':_0x3f25('0xbb'),'appdata':_0x17d06c[_0x3f25('0x2b')]+','+(_0x59ffba[_0x3f25('0x92')][_0x3f25('0xbc')]||0x12c),'interval':_0x3f25('0xb8')});}return respondWithRpcPromise(_0x3f25('0xbd'),_0x3f25('0xbe'),_0x59ffba);})[_0x3f25('0x14')](function(_0x5cec24){respondWithRpcPromise(_0x3f25('0xbf'),_0x3f25('0xbf'),{'event':_0x3f25('0x7b'),'message':_0x5cec24},client9002);return _0x5cec24;})[_0x3f25('0x14')](respondWithResult(_0x5f74d6,null))[_0x3f25('0x4a')](handleError(_0x5f74d6,null));};exports[_0x3f25('0xc0')]=function(_0x62ca03,_0x1cce70){var _0x46b443,_0x33d0c1,_0x607ab6;var _0x35206a=[];var _0x514e86={};var _0x29b648=_0x62ca03[_0x3f25('0xc1')]||[];var _0x2d16a6=[];var _0x45c078;return db[_0x3f25('0x81')][_0x3f25('0x55')]()[_0x3f25('0x14')](function(_0x5d12fb){if(!_0x5d12fb){throw new db[(_0x3f25('0x87'))][(_0x3f25('0x88'))](_0x3f25('0x82'));}_0x35206a=_[_0x3f25('0x83')](_['keys'](_0x5d12fb),['createdAt',_0x3f25('0x84'),'CompanyId',_0x3f25('0xc2')]);if(_0x62ca03[_0x3f25('0x54')]['id']){delete _0x62ca03[_0x3f25('0x54')]['id'];}if(_[_0x3f25('0x70')](_0x62ca03[_0x3f25('0x54')]['from'])){throw _0x1cce70[_0x3f25('0x1e')](0x1f4)[_0x3f25('0xc3')](new db['Sequelize'][(_0x3f25('0x88'))](_0x3f25('0xc4')));}if(_['isNil'](_0x62ca03[_0x3f25('0x54')][_0x3f25('0x54')])||_0x62ca03['body']['body']===''){throw _0x1cce70[_0x3f25('0x1e')](0x1f4)[_0x3f25('0xc3')](new db[(_0x3f25('0x87'))][(_0x3f25('0x88'))](_0x3f25('0x89')));}if(_[_0x3f25('0x70')](_0x62ca03[_0x3f25('0x54')]['mapKeyOffline'])){throw _0x1cce70[_0x3f25('0x1e')](0x1f4)[_0x3f25('0xc3')](new db['Sequelize'][(_0x3f25('0x88'))](_0x3f25('0xc5')+_0x35206a));}if(!_[_0x3f25('0xc6')](_0x35206a,_0x62ca03['body'][_0x3f25('0xc7')])){throw _0x1cce70[_0x3f25('0x1e')](0x1f4)[_0x3f25('0xc3')](new db[(_0x3f25('0x87'))][(_0x3f25('0x88'))](_0x3f25('0xc8')+_0x35206a));}_0x514e86[_0x62ca03['body'][_0x3f25('0xc7')]]=_0x62ca03['body']['from'];})[_0x3f25('0x14')](function(){return db['ChatWebsite'][_0x3f25('0x4c')]({'where':{'id':_0x62ca03[_0x3f25('0x4b')]['id']},'include':[{'model':db[_0x3f25('0xc9')],'as':'List'},{'model':db[_0x3f25('0xca')],'as':_0x3f25('0xca')}]});})[_0x3f25('0x14')](handleEntityNotFound(_0x1cce70,null))[_0x3f25('0x14')](function(_0x18ba10){if(_0x18ba10&&_0x18ba10[_0x3f25('0x8d')]){_0x33d0c1=_0x18ba10;var _0x5ed5f9=_[_0x3f25('0xb')](_0x62ca03[_0x3f25('0x54')],{'firstName':_0x62ca03[_0x3f25('0x54')]['from'],'phone':_0x62ca03[_0x3f25('0x54')][_0x3f25('0x86')],'ListId':_0x18ba10[_0x3f25('0xc2')]});_0x5ed5f9[_0x62ca03[_0x3f25('0x54')][_0x3f25('0xc7')]]=_0x62ca03[_0x3f25('0x54')][_0x3f25('0x86')];return db['CmContact'][_0x3f25('0xcb')]({'where':_0x514e86,'defaults':_0x5ed5f9});}})[_0x3f25('0xab')](function(_0x5c6c84){if(_0x5c6c84){_0x607ab6=_0x5c6c84;var _0x169940=fs[_0x3f25('0xcc')](path['join'](config[_0x3f25('0x6c')],_0x3f25('0xcd')),'utf8');var _0x58a68a=ejs['render'](_0x169940,{'body':_['toPairs'](_0x62ca03['body'][_0x3f25('0x54')]),'bodyTitle':_0x33d0c1[_0x3f25('0xce')]});return db[_0x3f25('0xcf')][_0x3f25('0x4d')]({'body':_0x58a68a,'plainBody':htmlToText[_0x3f25('0xd0')](_0x58a68a),'ContactId':_0x5c6c84['id'],'ChatWebsiteId':_0x33d0c1['id']});}})[_0x3f25('0x14')](function(_0x51a170){_0x45c078=_0x51a170;if(_0x29b648['length']){var _0x342056=_0x29b648[_0x3f25('0x2f')](function(_0x121450){return{'name':_0x121450[_0x3f25('0xd1')],'basename':_0x121450[_0x3f25('0x64')],'type':_0x121450[_0x3f25('0xd2')],'ChatOfflineMessageId':_0x51a170['id']};});_0x2d16a6=_0x342056['map'](_0x2fda1d=>{var _0x50c32f={'filename':_0x2fda1d[_0x3f25('0x2b')],'path':path[_0x3f25('0x6b')](config[_0x3f25('0x6c')],_0x3f25('0xd3'),_0x3f25('0xc1'),'attachments',_0x3f25('0xd4'),_0x2fda1d[_0x3f25('0xd5')])};return _0x50c32f;});if(!_0x33d0c1[_0x3f25('0xd6')]){return db[_0x3f25('0xd7')][_0x3f25('0xd8')](function(_0x3cbe4b){return db[_0x3f25('0xd9')][_0x3f25('0xda')](_0x342056,{'transaction':_0x3cbe4b});});}}})['then'](function(){if(_0x45c078){_0x46b443=_0x45c078;return db[_0x3f25('0xca')]['findOne']({'where':{'service':!![]},'include':[{'model':db[_0x3f25('0xdb')],'as':_0x3f25('0xdc'),'raw':!![],'include':[{'model':db[_0x3f25('0xdd')],'as':'CloudProvider','raw':!![]}]}]});}})[_0x3f25('0x14')](function(_0x36a0c3){if(_0x36a0c3&&_0x36a0c3[_0x3f25('0xdc')]&&_0x33d0c1['forwardOffline']&&_0x33d0c1[_0x3f25('0xde')]){var _0x11ae9d=_0x36a0c3[_0x3f25('0xdf')]();return respondWithRpcPromise('SendMail','sendMail',{'account':_0x11ae9d,'message':{'from':util['format'](_0x3f25('0xe0'),_0x36a0c3['name'],_0x36a0c3[_0x3f25('0xe1')]||_0x36a0c3[_0x3f25('0xdc')][_0x3f25('0x4e')]),'to':_0x33d0c1['forwardOfflineAddress'],'subject':_0x33d0c1['offlineMessageSubject'],'html':_0x46b443['body'],'attachments':_0x2d16a6}},client9003)[_0x3f25('0x14')](function(){return _0x46b443;})[_0x3f25('0x4a')](function(_0x1a1a93){logger[_0x3f25('0x1a')](_0x1a1a93);});}})[_0x3f25('0x14')](function(){if(_0x33d0c1&&_0x33d0c1[_0x3f25('0xd6')]&&_0x33d0c1['MailAccountId']){var _0x5be56e=[];if(_0x29b648[_0x3f25('0x3b')]){_0x5be56e=_0x29b648[_0x3f25('0x2f')](function(_0x9df1fd){return{'name':_0x9df1fd['originalname'],'basename':_0x9df1fd[_0x3f25('0x64')],'type':_0x9df1fd[_0x3f25('0xd2')],'ChatOfflineMessageId':_0x45c078['id']};});}var _0x11d755;if(!_[_0x3f25('0x70')](_0x33d0c1[_0x3f25('0xe2')])){var _0x3fe752=_[_0x3f25('0x2f')](_0x62ca03['body'],function(_0x41bebe){return _0x41bebe;});var _0x50b482=_[_0x3f25('0xe3')](_0x3fe752)[0x0];var _0x4d2827=_[_0x3f25('0xe4')](_0x50b482,function(_0x7cdbca){return _0x7cdbca;});_0x11d755=_0x4d2827[0x1][_0x33d0c1[_0x3f25('0xe2')]];}var _0x55004a={'from':_0x607ab6[_0x3f25('0xe1')],'firstName':_0x607ab6[_0x3f25('0x9b')],'lastName':_0x607ab6['lastName'],'mapKey':'email','message':{'from':_0x607ab6['email'],'to':_0x33d0c1[_0x3f25('0xca')][_0x3f25('0xe1')],'cc':'','subject':_[_0x3f25('0x70')](_0x11d755)?_0x33d0c1['offlineMessageSubject']:_0x11d755,'messageId':'','sentAt':new Date(),'attach':_0x5be56e[_0x3f25('0x3b')],'attachments':_0x5be56e,'originChannel':_0x3f25('0xe5'),'ChatWebsiteId':_0x33d0c1['id'],'ChatOfflineMessageId':_0x46b443['id'],'originTo':_0x33d0c1['MailAccount']['email']},'body':_0x46b443[_0x3f25('0x54')]};var _0x3f0d06={'account':{'id':_0x33d0c1[_0x3f25('0xe6')]},'body':_0x55004a,'log':'NotifyMailAccount'};return respondWithRpcPromise(_0x3f25('0xe7'),_0x3f25('0xe8'),_0x3f0d06,client9001)['then'](function(){return _0x46b443;})[_0x3f25('0x4a')](function(_0x4ac4ed){logger['error'](_0x4ac4ed);});}return;})[_0x3f25('0x14')](function(){if(_0x46b443){return _0x46b443;}})[_0x3f25('0x14')](respondWithResult(_0x1cce70,null))[_0x3f25('0x4a')](function(_0x7b6b91){logger[_0x3f25('0x1a')](_0x3f25('0x4a'),_0x7b6b91);for(var _0x2c4e7c of _0x29b648){var _0x3be906=path[_0x3f25('0x6b')](config[_0x3f25('0x6c')],'server',_0x3f25('0xc1'),_0x3f25('0xe9'),_0x3f25('0xd4'),_0x2c4e7c[_0x3f25('0x64')]);fs_extra[_0x3f25('0xea')](_0x3be906)[_0x3f25('0x4a')](function(_0x1e7654){logger[_0x3f25('0x1a')](_0x3f25('0xeb'),_0x3be906,_0x1e7654);});}});};exports[_0x3f25('0xec')]=function(_0x2fb0c1,_0x299c7b){return db[_0x3f25('0xa8')]['find']({'where':{'id':_0x2fb0c1['params']['id']}})[_0x3f25('0x14')](handleEntityNotFound(_0x299c7b,null))[_0x3f25('0x14')](function(_0x2a7793){if(_0x2a7793){return _0x2a7793[_0x3f25('0xec')](_0x2fb0c1[_0x3f25('0x54')][_0x3f25('0x60')],_['omit'](_0x2fb0c1['body'],['ids','id'])||{});}})['then'](respondWithResult(_0x299c7b,null))[_0x3f25('0x4a')](handleError(_0x299c7b,null));};exports[_0x3f25('0xed')]=function(_0x481170,_0x4d9c45){var _0x3e7e4d={'raw':![],'where':{}};var _0x33f4e2={};var _0x5b926c={'count':0x0,'rows':[]};return db[_0x3f25('0x47')]['findOne']({'where':{'id':_0x481170[_0x3f25('0x4b')]['id']}})[_0x3f25('0x14')](handleEntityNotFound(_0x4d9c45,null))[_0x3f25('0x14')](function(_0x28ae57){if(_0x28ae57){_0x33f4e2['model']=_[_0x3f25('0x34')](db[_0x3f25('0xa8')][_0x3f25('0x30')]);_0x33f4e2['query']=_['keys'](_0x481170['query']);_0x33f4e2['filters']=_['intersection'](_0x33f4e2[_0x3f25('0x37')],_0x33f4e2[_0x3f25('0x38')]);_0x3e7e4d[_0x3f25('0x39')]=_['intersection'](_0x33f4e2[_0x3f25('0x37')],qs[_0x3f25('0x3a')](_0x481170[_0x3f25('0x38')][_0x3f25('0x3a')]));_0x3e7e4d[_0x3f25('0x39')]=_0x3e7e4d['attributes']['length']?_0x3e7e4d[_0x3f25('0x39')]:_0x33f4e2['model'];if(!_0x481170[_0x3f25('0x38')][_0x3f25('0x3c')](_0x3f25('0x3d'))){_0x3e7e4d[_0x3f25('0x3e')]=qs['limit'](_0x481170[_0x3f25('0x38')][_0x3f25('0x3e')]);_0x3e7e4d['offset']=qs[_0x3f25('0x22')](_0x481170[_0x3f25('0x38')][_0x3f25('0x22')]);}_0x3e7e4d[_0x3f25('0x3f')]=qs[_0x3f25('0x40')](_0x481170[_0x3f25('0x38')][_0x3f25('0x40')]);_0x3e7e4d[_0x3f25('0x42')]=qs['filters'](_['pick'](_0x481170[_0x3f25('0x38')],_0x33f4e2[_0x3f25('0x35')]));_0x3e7e4d[_0x3f25('0x42')][_0x3f25('0x56')]=_0x28ae57['id'];if(_0x481170['query']['filter']){_0x3e7e4d['where']=_['merge'](_0x3e7e4d['where'],{'$or':_[_0x3f25('0x2f')](_0x3e7e4d['attributes'],function(_0x356d74){var _0x5a0702={};_0x5a0702[_0x356d74]={'$like':'%'+_0x481170[_0x3f25('0x38')][_0x3f25('0x59')]+'%'};return _0x5a0702;})});}_0x3e7e4d=_['merge']({},_0x3e7e4d,_0x481170['options']);return db[_0x3f25('0xa8')][_0x3f25('0x21')]({'where':_0x3e7e4d['where']})['then'](function(_0x1af5be){_0x5b926c['count']=_0x1af5be;if(_0x481170[_0x3f25('0x38')]['includeAll']){_0x3e7e4d[_0x3f25('0x46')]=[{'model':db[_0x3f25('0x81')],'as':_0x3f25('0xee'),'required':![]},{'model':db[_0x3f25('0xb4')],'as':_0x3f25('0xef'),'attributes':[_0x3f25('0x2b'),_0x3f25('0xf0'),'internal'],'required':![]},{'model':db[_0x3f25('0xf1')],'as':_0x3f25('0xf2'),'attributes':['id',_0x3f25('0x2b'),_0x3f25('0xf3')],'where':_0x481170[_0x3f25('0x38')]['tag']?{'id':_0x481170[_0x3f25('0x38')][_0x3f25('0xf4')]}:undefined,'required':_0x481170[_0x3f25('0x38')]['tag']?!![]:![]}];}return db[_0x3f25('0xa8')]['findAll'](_0x3e7e4d);})[_0x3f25('0x14')](function(_0x23a402){_0x5b926c[_0x3f25('0x49')]=_0x23a402;return _0x5b926c;});}})[_0x3f25('0x14')](respondWithFilteredResult(_0x4d9c45,_0x3e7e4d))['catch'](handleError(_0x4d9c45,null));};function iftimePromise(_0x4e0daf,_0x56c12a){return respondWithRpcPromise(_0x3f25('0xf5'),_0x3f25('0xf6'),{'command':_0x56c12a[_0x3f25('0xf7')]?util[_0x3f25('0xa5')]('iftime\x20%s,%s',_0x4e0daf[_0x3f25('0xf8')],_0x56c12a[_0x3f25('0xf7')]):util[_0x3f25('0xa5')](_0x3f25('0xf9'),_0x4e0daf[_0x3f25('0xf8')])},client9002)[_0x3f25('0x14')](function(_0x49b83e){var _0x130094=_0x49b83e&&_0x49b83e['indexOf'](_0x3f25('0xfa'))>=0x0?!![]:![];logger['info']('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x56c12a['id'],_0x4e0daf['id'],_0x4e0daf[_0x3f25('0xf8')],_0x130094?_0x3f25('0xfb'):_0x3f25('0xfc'),_0x56c12a[_0x3f25('0xf7')]?_0x56c12a[_0x3f25('0xf7')]:_0x3f25('0xfd'));return _0x130094;})[_0x3f25('0x4a')](function(_0x1a7e4b){logger[_0x3f25('0x1a')](_0x3f25('0xfe'),_0x56c12a['id'],_0x4e0daf['id'],_0x4e0daf[_0x3f25('0xf8')],util[_0x3f25('0xff')](_0x1a7e4b,{'showHidden':![],'depth':null}),_0x56c12a[_0x3f25('0xf7')]?_0x56c12a[_0x3f25('0xf7')]:'No\x20timezone');return![];});}exports[_0x3f25('0xf6')]=function(_0x165f02,_0x5e6d98){var _0x54fa58=0x0;var _0xc915e2=0x0;var _0x29aa20=![];var _0x23a8a1;var _0x5d059f;return db[_0x3f25('0x47')][_0x3f25('0x4c')]({'where':{'id':_0x165f02['params']['id']},'include':[{'model':db['Interval'],'as':_0x3f25('0x100'),'include':[{'model':db[_0x3f25('0x100')],'as':'Intervals','attributes':['id',_0x3f25('0xf8')],'raw':!![]}]}]})[_0x3f25('0x14')](handleEntityNotFound(_0x5e6d98,null))['then'](function(_0x1b843c){if(_0x1b843c){_0x23a8a1=_0x1b843c;return _0x1b843c['getProactiveActions']({'raw':!![]});}})['then'](function(_0x12c5b5){if(_0x23a8a1){if(_0x12c5b5){_0x5d059f=_0x12c5b5;}}return require(_0x3f25('0x6e'))[_0x3f25('0x101')]();})[_0x3f25('0x14')](function(_0x3156c1){if(_0x3156c1){_0xc915e2=_0x3156c1[_0x3f25('0x102')];_0x29aa20=_0x3156c1[_0x3f25('0x6f')];}})[_0x3f25('0x14')](function(){return db[_0x3f25('0xa8')][_0x3f25('0x21')]({'where':{'closed':![]}});})[_0x3f25('0x14')](function(_0x5ed0b9){_0x54fa58=_0x5ed0b9;if(_0xc915e2&&_0x5ed0b9>_0xc915e2){return db[_0x3f25('0x103')]['findOne']({'where':{'id':0x1}})[_0x3f25('0x14')](function(_0x4a9a60){if(_0x4a9a60){_0x4a9a60[_0x3f25('0x104')](_0x3f25('0x105'));}});}})[_0x3f25('0x14')](function(){if(_0x23a8a1[_0x3f25('0x100')]&&_0x23a8a1['Interval'][_0x3f25('0x106')]){var _0xc21c8c=[];for(var _0x3bb559=0x0;_0x3bb559<_0x23a8a1['Interval']['Intervals']['length'];_0x3bb559++){var _0x4ca346=_0x23a8a1[_0x3f25('0x100')]['Intervals'][_0x3bb559][_0x3f25('0x27')]({'plain':!![]});_0xc21c8c[_0x3f25('0xaf')](iftimePromise(_0x4ca346,_0x23a8a1));}return BPromise[_0x3f25('0x107')](_0xc21c8c)['then'](function(_0x4116bc){return _[_0x3f25('0x108')](_0x4116bc);});}else{return!![];}})[_0x3f25('0x14')](function(_0xde1d0e){var _0x51b183=fs[_0x3f25('0xcc')](path[_0x3f25('0x6b')](config['root'],_0x3f25('0x109')),_0x3f25('0x10a'));var _0x921b51=new url[(_0x3f25('0x10b'))](_0x23a8a1[_0x3f25('0x10c')])[_0x3f25('0x10d')];var _0x1ea33f=_0x3f25('0x10e');var _0x2c646f=![];var _0x4e95df={'chatVersion':_0x1ea33f,'chatWebsiteAddressOrigin':_0x921b51,'remote':_0x23a8a1['remote'],'query':querystring['stringify'](_[_0x3f25('0x43')](_0x23a8a1[_0x3f25('0x27')]({'plain':!![]}),{'customerIp':_0x165f02[_0x3f25('0x7e')][_0x3f25('0x9a')]||_0x165f02[_0x3f25('0x7e')][_0x3f25('0x10f')]||_0x165f02['connection'][_0x3f25('0x110')]||_0x165f02['ip'],'referer':_0x165f02[_0x3f25('0x7e')][_0x3f25('0x9e')],'openedInteractions':_0x54fa58,'maxInteractions':_0xc915e2,'virtual':_0x29aa20[_0x3f25('0x102')],'online':_0xde1d0e,'custom':_0x29aa20}))[_0x3f25('0x111')](/'/g,'\x5c\x27')};_0x5e6d98[_0x3f25('0xc3')](ejs[_0x3f25('0x112')](Mustache['render'](_0x51b183,_0x4e95df),{'proactiveActions':_0x5d059f,'alignment':_0x23a8a1[_0x3f25('0x113')],'verticalAlignment':_0x23a8a1[_0x3f25('0x114')],'div_color':_0x23a8a1[_0x3f25('0xf3')],'labelText':_0x23a8a1['labelText'],'text_color':_0x23a8a1[_0x3f25('0x115')],'text_button_color':_0x23a8a1[_0x3f25('0x116')],'button_color':_0x23a8a1['color_button'],'background_color':_0x23a8a1['backgroundColor'],'hideWhenOffline':_0x23a8a1[_0x3f25('0x117')],'intervalId':_0x23a8a1[_0x3f25('0x118')],'isDevelopment':_0x2c646f,'chatVersion':_0x1ea33f}));})[_0x3f25('0x4a')](handleError(_0x5e6d98,null));};exports[_0x3f25('0x119')]=function(_0x45c049,_0x30ae50){var _0x35ef2b=_0x45c049['params']['id'];var _0x1e08ec=_0x45c049[_0x3f25('0x54')];var _0x591107=0xc8;var _0x1f4111=null;return db[_0x3f25('0xd7')][_0x3f25('0xd8')]({'isolationLevel':db[_0x3f25('0xd7')][_0x3f25('0x11a')]['ISOLATION_LEVELS'][_0x3f25('0x11b')]},function(_0x16a5a3){return db[_0x3f25('0x47')][_0x3f25('0x5e')]({'where':{'id':_0x35ef2b},'transaction':_0x16a5a3})[_0x3f25('0x14')](function(_0x4c939a){if(_0x4c939a){return db[_0x3f25('0x90')][_0x3f25('0x26')]({'where':{'ChatWebsiteId':_0x35ef2b},'transaction':_0x16a5a3})[_0x3f25('0x14')](function(){var _0xf196f3=_[_0x3f25('0x2f')](_0x1e08ec,function(_0xc7b2eb){_0xc7b2eb[_0x3f25('0x56')]=_0x35ef2b;return _0xc7b2eb;});return db[_0x3f25('0x90')][_0x3f25('0xda')](_0xf196f3,{'transaction':_0x16a5a3});});}else{_0x591107=0x194;_0x1f4111=[];}});})[_0x3f25('0x14')](function(){if(_0x591107!==0x194){return db['ChatApplication']['findAndCountAll']({'where':{'ChatWebsiteId':_0x35ef2b},'order':_0x3f25('0x11c')})[_0x3f25('0x14')](function(_0x24ad33){_0x1f4111=_0x24ad33;});}})[_0x3f25('0x4a')](function(_0x2b1ea2){_0x591107=0x1f4;logger[_0x3f25('0x1a')](_0x2b1ea2[_0x3f25('0x2a')]);if(_0x2b1ea2[_0x3f25('0x2b')]){delete _0x2b1ea2[_0x3f25('0x2b')];}_0x1f4111=_0x2b1ea2;})['finally'](function(){if(_0x1f4111===null){_0x30ae50[_0x3f25('0x1d')](_0x591107);}else{if(_0x591107===0x1f4){_0x30ae50[_0x3f25('0x1e')](_0x591107)['send'](_0x1f4111);}else{_0x30ae50[_0x3f25('0x1e')](_0x591107)[_0x3f25('0x11d')](_0x1f4111);}}});};exports['getApplications']=function(_0x363185,_0x5a7016){var _0x42db4e={};var _0x5cf55c={};var _0x4047c4;var _0x203c40;return db[_0x3f25('0x47')][_0x3f25('0x5e')]({'where':{'id':_0x363185[_0x3f25('0x4b')]['id']}})[_0x3f25('0x14')](handleEntityNotFound(_0x5a7016,null))[_0x3f25('0x14')](function(_0x3d3b7a){if(_0x3d3b7a){_0x4047c4=_0x3d3b7a;_0x5cf55c['model']=_[_0x3f25('0x34')](db['ChatApplication'][_0x3f25('0x30')]);_0x5cf55c[_0x3f25('0x38')]=_['keys'](_0x363185[_0x3f25('0x38')]);_0x5cf55c[_0x3f25('0x35')]=_['intersection'](_0x5cf55c[_0x3f25('0x37')],_0x5cf55c[_0x3f25('0x38')]);_0x42db4e[_0x3f25('0x39')]=_[_0x3f25('0x36')](_0x5cf55c['model'],qs[_0x3f25('0x3a')](_0x363185[_0x3f25('0x38')][_0x3f25('0x3a')]));_0x42db4e[_0x3f25('0x39')]=_0x42db4e[_0x3f25('0x39')][_0x3f25('0x3b')]?_0x42db4e['attributes']:_0x5cf55c[_0x3f25('0x37')];_0x42db4e[_0x3f25('0x3f')]=qs[_0x3f25('0x40')](_0x363185[_0x3f25('0x38')][_0x3f25('0x40')]);_0x42db4e[_0x3f25('0x42')]=qs[_0x3f25('0x35')](_['pick'](_0x363185['query'],_0x5cf55c[_0x3f25('0x35')]));if(_0x363185['query'][_0x3f25('0x59')]){_0x42db4e[_0x3f25('0x42')]=_['merge'](_0x42db4e[_0x3f25('0x42')],{'$or':_[_0x3f25('0x2f')](_0x42db4e[_0x3f25('0x39')],function(_0x24391d){var _0x58db66={};_0x58db66[_0x24391d]={'$like':'%'+_0x363185[_0x3f25('0x38')][_0x3f25('0x59')]+'%'};return _0x58db66;})});}_0x42db4e=_['merge']({},_0x42db4e,_0x363185['options']);return _0x4047c4[_0x3f25('0x11e')](_0x42db4e);}})[_0x3f25('0x14')](function(_0x5f1e31){if(_0x5f1e31){_0x203c40=_0x5f1e31['length'];if(!_0x363185[_0x3f25('0x38')][_0x3f25('0x3c')](_0x3f25('0x3d'))){_0x42db4e[_0x3f25('0x3e')]=qs[_0x3f25('0x3e')](_0x363185['query']['limit']);_0x42db4e[_0x3f25('0x22')]=qs[_0x3f25('0x22')](_0x363185['query']['offset']);}return _0x4047c4[_0x3f25('0x11e')](_0x42db4e);}})[_0x3f25('0x14')](function(_0x34f644){if(_0x34f644){return _0x34f644?{'count':_0x203c40,'rows':_0x34f644}:null;}})[_0x3f25('0x14')](respondWithResult(_0x5a7016,null))[_0x3f25('0x4a')](handleError(_0x5a7016,null));};exports['addProactiveActions']=function(_0x2374e0,_0x3eb0ac){return db[_0x3f25('0x11f')][_0x3f25('0x4c')]({'where':{'id':_0x2374e0[_0x3f25('0x4b')]['id']}})[_0x3f25('0x14')](handleEntityNotFound(_0x3eb0ac,null))[_0x3f25('0x14')](function(_0x51fb83){if(_0x51fb83){return _0x51fb83[_0x3f25('0x120')](_0x2374e0[_0x3f25('0x54')]['ids'],_[_0x3f25('0x121')](_0x2374e0[_0x3f25('0x54')],[_0x3f25('0x60'),'id'])||{});}})[_0x3f25('0x14')](respondWithResult(_0x3eb0ac,null))[_0x3f25('0x4a')](handleError(_0x3eb0ac,null));};exports[_0x3f25('0x122')]=function(_0x3cd658,_0x5de1b3){var _0x16347d={};var _0x5eb34b={};var _0x326274;var _0x20a541;return db['ChatWebsite'][_0x3f25('0x5e')]({'where':{'id':_0x3cd658['params']['id']}})['then'](handleEntityNotFound(_0x5de1b3,null))[_0x3f25('0x14')](function(_0x16d944){if(_0x16d944){_0x326274=_0x16d944;_0x5eb34b[_0x3f25('0x37')]=_[_0x3f25('0x34')](db[_0x3f25('0x123')][_0x3f25('0x30')]);_0x5eb34b[_0x3f25('0x38')]=_['keys'](_0x3cd658[_0x3f25('0x38')]);_0x5eb34b[_0x3f25('0x35')]=_[_0x3f25('0x36')](_0x5eb34b[_0x3f25('0x37')],_0x5eb34b[_0x3f25('0x38')]);_0x16347d[_0x3f25('0x39')]=_[_0x3f25('0x36')](_0x5eb34b[_0x3f25('0x37')],qs[_0x3f25('0x3a')](_0x3cd658[_0x3f25('0x38')][_0x3f25('0x3a')]));_0x16347d[_0x3f25('0x39')]=_0x16347d[_0x3f25('0x39')][_0x3f25('0x3b')]?_0x16347d['attributes']:_0x5eb34b['model'];_0x16347d[_0x3f25('0x3f')]=qs[_0x3f25('0x40')](_0x3cd658[_0x3f25('0x38')]['sort']);_0x16347d[_0x3f25('0x42')]=qs['filters'](_[_0x3f25('0x41')](_0x3cd658['query'],_0x5eb34b[_0x3f25('0x35')]));if(_0x3cd658[_0x3f25('0x38')][_0x3f25('0x59')]){_0x16347d[_0x3f25('0x42')]=_[_0x3f25('0x43')](_0x16347d[_0x3f25('0x42')],{'$or':_[_0x3f25('0x2f')](_0x16347d[_0x3f25('0x39')],function(_0x4958f5){var _0x2f2a21={};_0x2f2a21[_0x4958f5]={'$like':'%'+_0x3cd658[_0x3f25('0x38')][_0x3f25('0x59')]+'%'};return _0x2f2a21;})});}_0x16347d=_['merge']({},_0x16347d,_0x3cd658[_0x3f25('0x44')]);return _0x326274[_0x3f25('0x122')](_0x16347d);}})['then'](function(_0x47a089){if(_0x47a089){_0x20a541=_0x47a089[_0x3f25('0x3b')];if(!_0x3cd658[_0x3f25('0x38')]['hasOwnProperty'](_0x3f25('0x3d'))){_0x16347d[_0x3f25('0x3e')]=qs[_0x3f25('0x3e')](_0x3cd658['query'][_0x3f25('0x3e')]);_0x16347d[_0x3f25('0x22')]=qs['offset'](_0x3cd658['query'][_0x3f25('0x22')]);}return _0x326274[_0x3f25('0x122')](_0x16347d);}})['then'](function(_0xfc09bc){if(_0xfc09bc){return _0xfc09bc?{'count':_0x20a541,'rows':_0xfc09bc}:null;}})[_0x3f25('0x14')](respondWithResult(_0x5de1b3,null))['catch'](handleError(_0x5de1b3,null));};exports[_0x3f25('0x124')]=function(_0x59fbbf,_0x50bfd7){var _0x537fa9=_0x59fbbf[_0x3f25('0x38')][_0x3f25('0x125')]===_0x3f25('0x126')?_0x3f25('0x127'):_0x3f25('0x128');return db[_0x3f25('0x47')]['find']({'attributes':['id',_0x537fa9],'where':{'id':_0x59fbbf[_0x3f25('0x4b')]['id']}})[_0x3f25('0x14')](handleEntityNotFound(_0x50bfd7,null))[_0x3f25('0x14')](function(_0x9d6869){if(_0x9d6869){var _0x593019=_0x9d6869[_0x537fa9];var _0x8b47c6=_0x593019&&_0x593019['items']?_0x593019[_0x3f25('0x129')]:[];_0x50bfd7['send']({'fromKey':_[_0x3f25('0x70')](_0x593019[_0x3f25('0x12a')])?undefined:_0x593019[_0x3f25('0x12a')],'count':_0x8b47c6[_0x3f25('0x3b')],'rows':_0x8b47c6});}})[_0x3f25('0x4a')](handleError(_0x50bfd7,null));};exports[_0x3f25('0x12b')]=function(_0x2da555,_0x23ce3d){var _0xa3f56d={'raw':![],'where':{}};var _0x5111d4={};var _0x38658f={'count':0x0,'rows':[]};return db[_0x3f25('0x47')][_0x3f25('0x5e')]({'where':{'id':_0x2da555[_0x3f25('0x4b')]['id']}})[_0x3f25('0x14')](handleEntityNotFound(_0x23ce3d,null))[_0x3f25('0x14')](function(_0x2281d0){if(_0x2281d0){_0x5111d4[_0x3f25('0x37')]=_[_0x3f25('0x34')](db[_0x3f25('0xcf')][_0x3f25('0x30')]);_0x5111d4[_0x3f25('0x38')]=_['keys'](_0x2da555[_0x3f25('0x38')]);_0x5111d4[_0x3f25('0x35')]=_['intersection'](_0x5111d4[_0x3f25('0x37')],_0x5111d4[_0x3f25('0x38')]);_0xa3f56d[_0x3f25('0x39')]=_[_0x3f25('0x36')](_0x5111d4['model'],qs[_0x3f25('0x3a')](_0x2da555[_0x3f25('0x38')][_0x3f25('0x3a')]));_0xa3f56d[_0x3f25('0x39')]=_0xa3f56d[_0x3f25('0x39')][_0x3f25('0x3b')]?_0xa3f56d[_0x3f25('0x39')]:_0x5111d4['model'];if(!_0x2da555[_0x3f25('0x38')]['hasOwnProperty'](_0x3f25('0x3d'))){_0xa3f56d[_0x3f25('0x3e')]=qs[_0x3f25('0x3e')](_0x2da555['query'][_0x3f25('0x3e')]);_0xa3f56d[_0x3f25('0x22')]=qs[_0x3f25('0x22')](_0x2da555[_0x3f25('0x38')][_0x3f25('0x22')]);}_0xa3f56d[_0x3f25('0x3f')]=qs[_0x3f25('0x40')](_0x2da555['query'][_0x3f25('0x40')]);_0xa3f56d[_0x3f25('0x42')]=qs[_0x3f25('0x35')](_[_0x3f25('0x41')](_0x2da555['query'],_0x5111d4[_0x3f25('0x35')]));_0xa3f56d[_0x3f25('0x42')][_0x3f25('0x56')]=_0x2281d0['id'];if(_0x2da555[_0x3f25('0x38')][_0x3f25('0x59')]){_0xa3f56d[_0x3f25('0x42')]=_['merge'](_0xa3f56d[_0x3f25('0x42')],{'$or':_[_0x3f25('0x2f')](_0xa3f56d[_0x3f25('0x39')],function(_0x4481ca){var _0x358343={};_0x358343[_0x4481ca]={'$like':'%'+_0x2da555[_0x3f25('0x38')]['filter']+'%'};return _0x358343;})});}_0xa3f56d=_['merge']({},_0xa3f56d,_0x2da555[_0x3f25('0x44')]);return db[_0x3f25('0xcf')][_0x3f25('0x21')]({'where':_0xa3f56d[_0x3f25('0x42')]})[_0x3f25('0x14')](function(_0x520511){_0x38658f['count']=_0x520511;if(_0x2da555['query'][_0x3f25('0x45')]){_0xa3f56d[_0x3f25('0x46')]=[{'all':!![]}];}else{_0xa3f56d['include']=[{'model':db[_0x3f25('0x81')],'as':_0x3f25('0xee'),'required':![]},{'model':db[_0x3f25('0xd9')],'as':_0x3f25('0x12c'),'required':![]}];}return db['ChatOfflineMessage']['findAll'](_0xa3f56d);})[_0x3f25('0x14')](function(_0x4e8ea6){_0x38658f['rows']=_0x4e8ea6;return _0x38658f;});}})[_0x3f25('0x14')](respondWithFilteredResult(_0x23ce3d,_0xa3f56d))[_0x3f25('0x4a')](handleError(_0x23ce3d,null));};exports[_0x3f25('0x12d')]=function(_0x3f3b9b,_0x6cc9cd){return db[_0x3f25('0x47')][_0x3f25('0x4c')]({'where':{'id':_0x3f3b9b[_0x3f25('0x4b')]['id']}})[_0x3f25('0x14')](handleEntityNotFound(_0x6cc9cd,null))[_0x3f25('0x14')](function(_0x491856){if(_0x491856){return _0x491856[_0x3f25('0x12d')](_0x3f3b9b[_0x3f25('0x54')][_0x3f25('0x60')],_['omit'](_0x3f3b9b[_0x3f25('0x54')],[_0x3f25('0x60'),'id'])||{})['spread'](function(_0x3647c2){for(var _0x2eacca=0x0;_0x2eacca<_0x3f3b9b[_0x3f25('0x54')][_0x3f25('0x60')][_0x3f25('0x3b')];_0x2eacca+=0x1){socket['emit'](_0x3f25('0x12e'),{'UserId':Number(_0x3f3b9b[_0x3f25('0x54')][_0x3f25('0x60')][_0x2eacca]),'ChatWebsiteId':Number(_0x3f3b9b[_0x3f25('0x4b')]['id'])});}return _0x3647c2;});}})['then'](respondWithResult(_0x6cc9cd,null))[_0x3f25('0x4a')](handleError(_0x6cc9cd,null));};exports[_0x3f25('0x12f')]=function(_0x5f2493,_0x2a3b09){return db[_0x3f25('0x47')]['find']({'where':{'id':_0x5f2493[_0x3f25('0x4b')]['id']}})['then'](handleEntityNotFound(_0x2a3b09,null))['then'](function(_0x5453b4){if(_0x5453b4){return _0x5453b4['removeAgents'](_0x5f2493['query'][_0x3f25('0x60')])['then'](function(){if(_['isArray'](_0x5f2493[_0x3f25('0x38')][_0x3f25('0x60')])){for(var _0x1601b7=0x0;_0x1601b7<_0x5f2493[_0x3f25('0x38')][_0x3f25('0x60')]['length'];_0x1601b7+=0x1){socket[_0x3f25('0x130')](_0x3f25('0x131'),{'UserId':Number(_0x5f2493['query'][_0x3f25('0x60')][_0x1601b7]),'ChatWebsiteId':Number(_0x5f2493['params']['id'])});}}else{socket['emit']('userChatWebsite:remove',{'UserId':Number(_0x5f2493[_0x3f25('0x38')][_0x3f25('0x60')]),'ChatWebsiteId':Number(_0x5f2493[_0x3f25('0x4b')]['id'])});}});}})[_0x3f25('0x14')](respondWithStatusCode(_0x2a3b09,null))['catch'](handleError(_0x2a3b09,null));};exports[_0x3f25('0x132')]=function(_0x18d77e,_0x42a94f){var _0x529a2f={};var _0x22a38f={};var _0x1b6a32;var _0x5e00fb;return db[_0x3f25('0x47')][_0x3f25('0x5e')]({'where':{'id':_0x18d77e[_0x3f25('0x4b')]['id']}})[_0x3f25('0x14')](handleEntityNotFound(_0x42a94f,null))[_0x3f25('0x14')](function(_0x32dc4e){if(_0x32dc4e){_0x1b6a32=_0x32dc4e;_0x22a38f[_0x3f25('0x37')]=_['keys'](db['User']['rawAttributes']);_0x22a38f[_0x3f25('0x38')]=_[_0x3f25('0x34')](_0x18d77e[_0x3f25('0x38')]);_0x22a38f[_0x3f25('0x35')]=_[_0x3f25('0x36')](_0x22a38f[_0x3f25('0x37')],_0x22a38f[_0x3f25('0x38')]);_0x529a2f[_0x3f25('0x39')]=_[_0x3f25('0x36')](_0x22a38f['model'],qs[_0x3f25('0x3a')](_0x18d77e[_0x3f25('0x38')][_0x3f25('0x3a')]));_0x529a2f[_0x3f25('0x39')]=_0x529a2f[_0x3f25('0x39')]['length']?_0x529a2f['attributes']:_0x22a38f[_0x3f25('0x37')];_0x529a2f[_0x3f25('0x3f')]=qs[_0x3f25('0x40')](_0x18d77e[_0x3f25('0x38')]['sort']);_0x529a2f[_0x3f25('0x42')]=qs[_0x3f25('0x35')](_[_0x3f25('0x41')](_0x18d77e[_0x3f25('0x38')],_0x22a38f['filters']));if(_0x18d77e[_0x3f25('0x38')][_0x3f25('0x59')]){_0x529a2f[_0x3f25('0x42')]=_[_0x3f25('0x43')](_0x529a2f[_0x3f25('0x42')],{'$or':_[_0x3f25('0x2f')](_0x529a2f[_0x3f25('0x39')],function(_0x3b5cb0){var _0x5a18f0={};_0x5a18f0[_0x3b5cb0]={'$like':'%'+_0x18d77e[_0x3f25('0x38')]['filter']+'%'};return _0x5a18f0;})});}_0x529a2f=_[_0x3f25('0x43')]({},_0x529a2f,_0x18d77e['options']);return _0x1b6a32['getAgents'](_0x529a2f);}})[_0x3f25('0x14')](function(_0x173382){if(_0x173382){_0x5e00fb=_0x173382[_0x3f25('0x3b')];if(!_0x18d77e['query']['hasOwnProperty'](_0x3f25('0x3d'))){_0x529a2f[_0x3f25('0x3e')]=qs[_0x3f25('0x3e')](_0x18d77e['query'][_0x3f25('0x3e')]);_0x529a2f[_0x3f25('0x22')]=qs[_0x3f25('0x22')](_0x18d77e[_0x3f25('0x38')][_0x3f25('0x22')]);}return _0x1b6a32[_0x3f25('0x132')](_0x529a2f);}})[_0x3f25('0x14')](function(_0x207c88){if(_0x207c88){return _0x207c88?{'count':_0x5e00fb,'rows':_0x207c88}:null;}})[_0x3f25('0x14')](respondWithResult(_0x42a94f,null))['catch'](handleError(_0x42a94f,null));}; \ No newline at end of file +var _0xf77f=['sequelize','transaction','Attachment','MailServerOut','Smtp','CloudProvider','forwardOffline','getSmtpOptions','sendMail','\x22%s\x22\x20<%s>','email','user','offlineMessageSubject','MailAccountId','originalname','subjectOffline','toPairsIn','mapValues','Chat','NotifyMailAccount','server','attachments','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','getInteractions','Contact','Owner','fullname','internal','Tag','Tags','color','tag','Command','getSnippet','iftime\x20%s,%s','timezone','iftime\x20%s','interval','indexOf','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','OFFLINE','No\x20timezone','inspect','Interval','getProactiveActions','virtual','License','increment','chatLicenseExceeded','Intervals','all','some','readFileSync','server/files/chat/iframe.ejs','URL','address','origin','3.2.0','remote','replace','alignment','verticalAlignment','labelText','textColor','color_button','hideWhenOffline','addApplications','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','stack','finally','getApplications','addProactiveActions','ChatProactiveAction','getFields','false','offlineForm','onlineForm','items','fromKey','getOfflineMessages','Attachments','addAgents','emit','userChatWebsite:save','removeAgents','isArray','getAgents','mustache','path','ejs','fs-extra','lodash','../../config/logger','api','../../config/environment','defaults','redis','localhost','socket.io-emitter','html-to-text','jayson/promise','client','http','request','then','info','ChatWebsite,\x20%s,\x20%s','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','sendStatus','status','end','json','undefined','limit','count','offset','set','update','destroy','ChatWebsites','UserProfileResource','name','index','Pause','mandatoryDispositionPause','map','ChatWebsite','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','includeAll','include','findAll','rows','show','params','options','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','ChatWebsiteId','getDispositions','findOne','order','filter','Disposition','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','addLogo','sitepic','file','agentAvatar','filename','addCustomerAvatar','addSystemAvatar','getLogo','join','root','server/files/images/logos/default_logo.svg','../../config/license/util','getLicense','custom','isNil','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','server/files/images/avatars/customer_avatar.png','customerAvatar','showCustomerAvatar','existsSync','getSystemAvatar','server/files/images/avatars/system_avatar.png','systemAvatar','notify','user-agent-parser','headers','user-agent','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','updatedAt','CompanyId','ListId','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','CmList','List','Contacts','DESC','ChatApplication','Applications','applications','list','orderBy','priority','asc','account','contact','customerIp','cf-connecting-ip','x-forwarded-for','first','firstName','lastName','x-real-port','browser','version','format','%s\x20%s','unknown','device','vendor','%s\x20%s\x20%s','threadId','ChatInteraction','externalUrl','ContactId','interaction','spread','messageId','created','autoclose','push','unmanaged','ChatMessage','UserId','User','waitForTheAssignedAgent','*,*,*,*','forcedOwnership','ChatQueue','queueId','queue','Start','startRouting','EventManager','offline','files','createdAt','send','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','findOrCreate','server/files/templates/chatOfflineMessage.ejs','utf8','render','offlineMessageBody','ChatOfflineMessage','mimetype','offline-chat','openNewInteraction'];(function(_0x1e0851,_0x48cd08){var _0xa18b7e=function(_0x423dee){while(--_0x423dee){_0x1e0851['push'](_0x1e0851['shift']());}};_0xa18b7e(++_0x48cd08);}(_0xf77f,0x18b));var _0xff77=function(_0x1abb09,_0x18ee91){_0x1abb09=_0x1abb09-0x0;var _0xea1c07=_0xf77f[_0x1abb09];return _0xea1c07;};'use strict';var BPromise=require('bluebird');var Mustache=require(_0xff77('0x0'));var util=require('util');var path=require(_0xff77('0x1'));var ejs=require(_0xff77('0x2'));var fs=require('fs');var fs_extra=require(_0xff77('0x3'));var _=require(_0xff77('0x4'));var querystring=require('querystring');var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require(_0xff77('0x5'))(_0xff77('0x6'));var config=require(_0xff77('0x7'));var url=require('url');var db=require('../../mysqldb')['db'];config['redis']=_[_0xff77('0x8')](config[_0xff77('0x9')],{'host':_0xff77('0xa'),'port':0x18eb});var socket=require(_0xff77('0xb'))(new Redis(config[_0xff77('0x9')]));require('./chatWebsite.socket')['register'](socket);var htmlToText=require(_0xff77('0xc'));var jayson=require(_0xff77('0xd'));var client=jayson[_0xff77('0xe')][_0xff77('0xf')]({'port':0x232c});var client9002=jayson[_0xff77('0xe')][_0xff77('0xf')]({'port':0x232a});var client9003=jayson[_0xff77('0xe')][_0xff77('0xf')]({'port':0x232b});var client9001=jayson['client']['http']({'port':0x2329});function respondWithRpcPromise(_0x373a6a,_0x23688d,_0x20e5ed,_0x46ab69){return new BPromise(function(_0x36b7f1,_0x398662){var _0x2c618d=_0x46ab69||client;return _0x2c618d[_0xff77('0x10')](_0x373a6a,_0x20e5ed)[_0xff77('0x11')](function(_0x476abd){logger[_0xff77('0x12')](_0xff77('0x13'),_0x23688d,'request\x20sent');logger[_0xff77('0x14')](_0xff77('0x15'),_0x23688d,_0xff77('0x16'),JSON[_0xff77('0x17')](_0x476abd));if(_0x476abd['error']){if(_0x476abd['error']['code']===0x1f4){logger[_0xff77('0x18')]('ChatWebsite,\x20%s,\x20%s',_0x23688d,_0x476abd['error']['message']);return _0x398662(_0x476abd[_0xff77('0x18')][_0xff77('0x19')]);}logger[_0xff77('0x18')](_0xff77('0x13'),_0x23688d,_0x476abd[_0xff77('0x18')][_0xff77('0x19')]);return _0x36b7f1(_0x476abd['error'][_0xff77('0x19')]);}else{logger[_0xff77('0x12')](_0xff77('0x13'),_0x23688d,_0xff77('0x16'));_0x36b7f1(_0x476abd[_0xff77('0x1a')]['message']);}})[_0xff77('0x1b')](function(_0x25a83a){logger[_0xff77('0x18')](_0xff77('0x13'),_0x23688d,_0x25a83a);_0x398662(_0x25a83a);});});}function respondWithStatusCode(_0x1a9760,_0x14c24e){_0x14c24e=_0x14c24e||0xcc;return function(_0x3bf2af){if(_0x3bf2af){return _0x1a9760[_0xff77('0x1c')](_0x14c24e);}return _0x1a9760[_0xff77('0x1d')](_0x14c24e)[_0xff77('0x1e')]();};}function respondWithResult(_0x5290d0,_0x30a187){_0x30a187=_0x30a187||0xc8;return function(_0xbeacf4){if(_0xbeacf4){return _0x5290d0[_0xff77('0x1d')](_0x30a187)[_0xff77('0x1f')](_0xbeacf4);}};}function respondWithFilteredResult(_0x2f6342,_0x2ee518){return function(_0x1658f2){if(_0x1658f2){var _0x11bb64=typeof _0x2ee518['offset']===_0xff77('0x20')&&typeof _0x2ee518[_0xff77('0x21')]===_0xff77('0x20');var _0x39bafc=_0x1658f2[_0xff77('0x22')];var _0x485a26=_0x11bb64?0x0:_0x2ee518[_0xff77('0x23')];var _0x45d03e=_0x11bb64?_0x1658f2[_0xff77('0x22')]:_0x2ee518['offset']+_0x2ee518[_0xff77('0x21')];var _0x178413;if(_0x45d03e>=_0x39bafc){_0x45d03e=_0x39bafc;_0x178413=0xc8;}else{_0x178413=0xce;}_0x2f6342['status'](_0x178413);return _0x2f6342[_0xff77('0x24')]('Content-Range',_0x485a26+'-'+_0x45d03e+'/'+_0x39bafc)[_0xff77('0x1f')](_0x1658f2);}return null;};}function saveUpdates(_0x574827){return function(_0x54bd39){if(_0x54bd39){return _0x54bd39[_0xff77('0x25')](_0x574827)[_0xff77('0x11')](function(_0x5b3720){return _0x5b3720;});}return null;};}function removeEntity(_0xbe4603){return function(_0x1e59e5){if(_0x1e59e5){return _0x1e59e5[_0xff77('0x26')]()[_0xff77('0x11')](function(){var _0x5bfb03=_0x1e59e5['get']({'plain':!![]});var _0x28454b=_0xff77('0x27');return db[_0xff77('0x28')][_0xff77('0x26')]({'where':{'type':_0x28454b,'resourceId':_0x5bfb03['id']}})['then'](function(){return _0x1e59e5;});})[_0xff77('0x11')](function(){_0xbe4603['status'](0xcc)[_0xff77('0x1e')]();});}};}function handleEntityNotFound(_0x91f974){return function(_0x2639f5){if(!_0x2639f5){_0x91f974['sendStatus'](0x194);}return _0x2639f5;};}function handleError(_0x3e6eb5,_0x4416d9){_0x4416d9=_0x4416d9||0x1f4;return function(_0xf9c228){logger[_0xff77('0x18')](_0xf9c228['stack']);if(_0xf9c228[_0xff77('0x29')]){delete _0xf9c228['name'];}_0x3e6eb5[_0xff77('0x1d')](_0x4416d9)['send'](_0xf9c228);};}exports[_0xff77('0x2a')]=function(_0xdd4bed,_0xcf4ba3){var _0x2d01ee={'include':[{'model':db[_0xff77('0x2b')],'as':_0xff77('0x2c')}]},_0x15f2d4={},_0x936f26={'count':0x0,'rows':[]};var _0x540566=_[_0xff77('0x2d')](db[_0xff77('0x2e')][_0xff77('0x2f')],function(_0x2a8ada){return{'name':_0x2a8ada[_0xff77('0x30')],'type':_0x2a8ada[_0xff77('0x31')]['key']};});_0x15f2d4[_0xff77('0x32')]=_[_0xff77('0x2d')](_0x540566,'name');_0x15f2d4[_0xff77('0x33')]=_[_0xff77('0x34')](_0xdd4bed[_0xff77('0x33')]);_0x15f2d4[_0xff77('0x35')]=_[_0xff77('0x36')](_0x15f2d4[_0xff77('0x32')],_0x15f2d4['query']);_0x2d01ee[_0xff77('0x37')]=_['intersection'](_0x15f2d4[_0xff77('0x32')],qs[_0xff77('0x38')](_0xdd4bed['query'][_0xff77('0x38')]));_0x2d01ee[_0xff77('0x37')]=_0x2d01ee['attributes'][_0xff77('0x39')]?_0x2d01ee['attributes']:_0x15f2d4[_0xff77('0x32')];if(!_0xdd4bed['query'][_0xff77('0x3a')](_0xff77('0x3b'))){_0x2d01ee['limit']=qs['limit'](_0xdd4bed['query']['limit']);_0x2d01ee[_0xff77('0x23')]=qs[_0xff77('0x23')](_0xdd4bed['query'][_0xff77('0x23')]);}_0x2d01ee['order']=qs[_0xff77('0x3c')](_0xdd4bed[_0xff77('0x33')][_0xff77('0x3c')]);_0x2d01ee[_0xff77('0x3d')]=qs['filters'](_[_0xff77('0x3e')](_0xdd4bed[_0xff77('0x33')],_0x15f2d4[_0xff77('0x35')]),_0x540566);if(_0xdd4bed[_0xff77('0x33')]['filter']){_0x2d01ee[_0xff77('0x3d')]=_[_0xff77('0x3f')](_0x2d01ee['where'],{'$or':_[_0xff77('0x2d')](_0x540566,function(_0x46411c){if(_0x46411c[_0xff77('0x31')]!=='VIRTUAL'){var _0x298431={};_0x298431[_0x46411c[_0xff77('0x29')]]={'$like':'%'+_0xdd4bed[_0xff77('0x33')]['filter']+'%'};return _0x298431;}})});}_0x2d01ee=_[_0xff77('0x3f')]({},_0x2d01ee,_0xdd4bed['options']);var _0x30e17c={'where':_0x2d01ee[_0xff77('0x3d')]};return db[_0xff77('0x2e')][_0xff77('0x22')](_0x30e17c)[_0xff77('0x11')](function(_0x37802e){_0x936f26[_0xff77('0x22')]=_0x37802e;if(_0xdd4bed[_0xff77('0x33')][_0xff77('0x40')]){_0x2d01ee[_0xff77('0x41')]=[{'all':!![]}];}return db[_0xff77('0x2e')][_0xff77('0x42')](_0x2d01ee);})[_0xff77('0x11')](function(_0x288a65){_0x936f26[_0xff77('0x43')]=_0x288a65;return _0x936f26;})[_0xff77('0x11')](respondWithFilteredResult(_0xcf4ba3,_0x2d01ee))[_0xff77('0x1b')](handleError(_0xcf4ba3,null));};exports[_0xff77('0x44')]=function(_0x5b9a8b,_0x7c7644){var _0x331c72={'raw':![],'where':{'id':_0x5b9a8b[_0xff77('0x45')]['id']},'include':[{'model':db[_0xff77('0x2b')],'as':_0xff77('0x2c')}]},_0x243e07={};_0x243e07['model']=_['keys'](db[_0xff77('0x2e')]['rawAttributes']);_0x243e07[_0xff77('0x33')]=_[_0xff77('0x34')](_0x5b9a8b['query']);_0x243e07[_0xff77('0x35')]=_[_0xff77('0x36')](_0x243e07[_0xff77('0x32')],_0x243e07[_0xff77('0x33')]);_0x331c72[_0xff77('0x37')]=_[_0xff77('0x36')](_0x243e07[_0xff77('0x32')],qs['fields'](_0x5b9a8b[_0xff77('0x33')][_0xff77('0x38')]));_0x331c72[_0xff77('0x37')]=_0x331c72[_0xff77('0x37')][_0xff77('0x39')]?_0x331c72[_0xff77('0x37')]:_0x243e07[_0xff77('0x32')];if(_0x5b9a8b[_0xff77('0x33')][_0xff77('0x40')]){_0x331c72[_0xff77('0x41')]=[{'all':!![]}];}_0x331c72=_['merge']({},_0x331c72,_0x5b9a8b[_0xff77('0x46')]);return db[_0xff77('0x2e')][_0xff77('0x47')](_0x331c72)[_0xff77('0x11')](handleEntityNotFound(_0x7c7644,null))[_0xff77('0x11')](respondWithResult(_0x7c7644,null))['catch'](handleError(_0x7c7644,null));};exports[_0xff77('0x48')]=function(_0x321634,_0x583cf9){return db['ChatWebsite'][_0xff77('0x48')](_0x321634[_0xff77('0x49')],{})[_0xff77('0x11')](function(_0x3f0820){var _0x57ff42=_0x321634['user'][_0xff77('0x4a')]({'plain':!![]});if(!_0x57ff42)throw new Error(_0xff77('0x4b'));if(_0x57ff42['role']==='user'){var _0x571d30=_0x3f0820['get']({'plain':!![]});var _0xbc7500='ChatWebsites';return db[_0xff77('0x4c')][_0xff77('0x47')]({'where':{'name':_0xbc7500,'userProfileId':_0x57ff42[_0xff77('0x4d')]},'raw':!![]})['then'](function(_0x6403e3){if(_0x6403e3&&_0x6403e3[_0xff77('0x4e')]===0x0){return db[_0xff77('0x28')][_0xff77('0x48')]({'name':_0x571d30[_0xff77('0x29')],'resourceId':_0x571d30['id'],'type':_0x6403e3[_0xff77('0x29')],'sectionId':_0x6403e3['id']},{})[_0xff77('0x11')](function(){return _0x3f0820;});}else{return _0x3f0820;}})['catch'](function(_0x2410af){logger[_0xff77('0x18')](_0xff77('0x4f'),_0x2410af);throw _0x2410af;});}return _0x3f0820;})['then'](respondWithResult(_0x583cf9,0xc9))[_0xff77('0x1b')](handleError(_0x583cf9,null));};exports['update']=function(_0x404b60,_0x2d476e){if(_0x404b60['body']['id']){delete _0x404b60[_0xff77('0x49')]['id'];}return db[_0xff77('0x2e')][_0xff77('0x47')]({'where':{'id':_0x404b60[_0xff77('0x45')]['id']},'include':[{'model':db[_0xff77('0x2b')],'as':_0xff77('0x2c')}]})[_0xff77('0x11')](handleEntityNotFound(_0x2d476e,null))[_0xff77('0x11')](saveUpdates(_0x404b60['body'],null))['then'](respondWithResult(_0x2d476e,null))['catch'](handleError(_0x2d476e,null));};exports[_0xff77('0x26')]=function(_0x403a11,_0x4b5e39){return db[_0xff77('0x2e')]['find']({'where':{'id':_0x403a11['params']['id']}})[_0xff77('0x11')](handleEntityNotFound(_0x4b5e39,null))[_0xff77('0x11')](removeEntity(_0x4b5e39,null))[_0xff77('0x1b')](handleError(_0x4b5e39,null));};exports['describe']=function(_0x59a5e9,_0x446cff){return db['ChatWebsite'][_0xff77('0x50')]()['then'](respondWithResult(_0x446cff,null))[_0xff77('0x1b')](handleError(_0x446cff,null));};exports[_0xff77('0x51')]=function(_0x422f3d,_0x19e23d){if(_0x422f3d['body']['id']){delete _0x422f3d[_0xff77('0x49')]['id'];}return db[_0xff77('0x2e')][_0xff77('0x47')]({'where':{'id':_0x422f3d[_0xff77('0x45')]['id']}})['then'](handleEntityNotFound(_0x19e23d,null))[_0xff77('0x11')](function(_0x2eb9b4){if(_0x2eb9b4){_0x422f3d['body'][_0xff77('0x52')]=_0x2eb9b4['id'];return db['Disposition'][_0xff77('0x48')](_0x422f3d[_0xff77('0x49')]);}})[_0xff77('0x11')](respondWithResult(_0x19e23d,null))[_0xff77('0x1b')](handleError(_0x19e23d,null));};exports[_0xff77('0x53')]=function(_0x4462c3,_0x5bea82){var _0x1af146={'raw':![],'where':{}};var _0xa089e7={};var _0x3af217={'count':0x0,'rows':[]};return db['ChatWebsite'][_0xff77('0x54')]({'where':{'id':_0x4462c3[_0xff77('0x45')]['id']}})[_0xff77('0x11')](handleEntityNotFound(_0x5bea82,null))[_0xff77('0x11')](function(_0x3b8c2d){if(_0x3b8c2d){_0xa089e7['model']=_[_0xff77('0x34')](db['Disposition']['rawAttributes']);_0xa089e7[_0xff77('0x33')]=_[_0xff77('0x34')](_0x4462c3[_0xff77('0x33')]);_0xa089e7[_0xff77('0x35')]=_[_0xff77('0x36')](_0xa089e7[_0xff77('0x32')],_0xa089e7[_0xff77('0x33')]);_0x1af146['attributes']=_[_0xff77('0x36')](_0xa089e7[_0xff77('0x32')],qs[_0xff77('0x38')](_0x4462c3[_0xff77('0x33')][_0xff77('0x38')]));_0x1af146[_0xff77('0x37')]=_0x1af146[_0xff77('0x37')]['length']?_0x1af146[_0xff77('0x37')]:_0xa089e7[_0xff77('0x32')];if(!_0x4462c3[_0xff77('0x33')][_0xff77('0x3a')](_0xff77('0x3b'))){_0x1af146['limit']=qs[_0xff77('0x21')](_0x4462c3['query'][_0xff77('0x21')]);_0x1af146[_0xff77('0x23')]=qs[_0xff77('0x23')](_0x4462c3[_0xff77('0x33')][_0xff77('0x23')]);}_0x1af146[_0xff77('0x55')]=qs['sort'](_0x4462c3['query'][_0xff77('0x3c')]);_0x1af146['where']=qs[_0xff77('0x35')](_[_0xff77('0x3e')](_0x4462c3[_0xff77('0x33')],_0xa089e7[_0xff77('0x35')]));_0x1af146[_0xff77('0x3d')][_0xff77('0x52')]=_0x3b8c2d['id'];if(_0x4462c3['query'][_0xff77('0x56')]){_0x1af146[_0xff77('0x3d')]=_[_0xff77('0x3f')](_0x1af146[_0xff77('0x3d')],{'$or':_[_0xff77('0x2d')](_0x1af146[_0xff77('0x37')],function(_0x524491){var _0x49543f={};_0x49543f[_0x524491]={'$like':'%'+_0x4462c3[_0xff77('0x33')]['filter']+'%'};return _0x49543f;})});}_0x1af146=_['merge']({},_0x1af146,_0x4462c3['options']);return db[_0xff77('0x57')]['count']({'where':_0x1af146[_0xff77('0x3d')]})['then'](function(_0x57cb13){_0x3af217['count']=_0x57cb13;if(_0x4462c3['query'][_0xff77('0x40')]){_0x1af146[_0xff77('0x41')]=[{'all':!![]}];}return db[_0xff77('0x57')]['findAll'](_0x1af146);})['then'](function(_0x122ca4){_0x3af217['rows']=_0x122ca4;return _0x3af217;});}})[_0xff77('0x11')](respondWithFilteredResult(_0x5bea82,_0x1af146))['catch'](handleError(_0x5bea82,null));};exports[_0xff77('0x58')]=function(_0x1fdfe4,_0x56ccdc){return db[_0xff77('0x2e')][_0xff77('0x47')]({'where':{'id':_0x1fdfe4[_0xff77('0x45')]['id']}})['then'](handleEntityNotFound(_0x56ccdc,null))['then'](function(_0xeb12f){if(_0xeb12f){return _0xeb12f['removeDispositions'](_0x1fdfe4[_0xff77('0x33')][_0xff77('0x59')]);}})['then'](respondWithStatusCode(_0x56ccdc,null))[_0xff77('0x1b')](handleError(_0x56ccdc,null));};exports[_0xff77('0x5a')]=function(_0x305db6,_0x37d19f){if(_0x305db6[_0xff77('0x49')]['id']){delete _0x305db6[_0xff77('0x49')]['id'];}return db[_0xff77('0x2e')][_0xff77('0x47')]({'where':{'id':_0x305db6['params']['id']}})[_0xff77('0x11')](handleEntityNotFound(_0x37d19f,null))['then'](function(_0x242772){if(_0x242772){_0x305db6[_0xff77('0x49')][_0xff77('0x52')]=_0x242772['id'];return db[_0xff77('0x5b')][_0xff77('0x48')](_0x305db6[_0xff77('0x49')]);}})['then'](respondWithResult(_0x37d19f,null))[_0xff77('0x1b')](handleError(_0x37d19f,null));};exports[_0xff77('0x5c')]=function(_0x386f32,_0x12fcef){var _0x50bb07={'raw':![],'where':{}};var _0x5d947c={};var _0x53ab3d={'count':0x0,'rows':[]};return db[_0xff77('0x2e')]['findOne']({'where':{'id':_0x386f32[_0xff77('0x45')]['id']}})['then'](handleEntityNotFound(_0x12fcef,null))[_0xff77('0x11')](function(_0x178285){if(_0x178285){_0x5d947c[_0xff77('0x32')]=_['keys'](db['CannedAnswer']['rawAttributes']);_0x5d947c[_0xff77('0x33')]=_[_0xff77('0x34')](_0x386f32[_0xff77('0x33')]);_0x5d947c[_0xff77('0x35')]=_[_0xff77('0x36')](_0x5d947c[_0xff77('0x32')],_0x5d947c[_0xff77('0x33')]);_0x50bb07[_0xff77('0x37')]=_[_0xff77('0x36')](_0x5d947c[_0xff77('0x32')],qs['fields'](_0x386f32[_0xff77('0x33')]['fields']));_0x50bb07[_0xff77('0x37')]=_0x50bb07['attributes'][_0xff77('0x39')]?_0x50bb07[_0xff77('0x37')]:_0x5d947c[_0xff77('0x32')];if(!_0x386f32[_0xff77('0x33')][_0xff77('0x3a')](_0xff77('0x3b'))){_0x50bb07[_0xff77('0x21')]=qs[_0xff77('0x21')](_0x386f32[_0xff77('0x33')][_0xff77('0x21')]);_0x50bb07[_0xff77('0x23')]=qs['offset'](_0x386f32[_0xff77('0x33')][_0xff77('0x23')]);}_0x50bb07[_0xff77('0x55')]=qs[_0xff77('0x3c')](_0x386f32[_0xff77('0x33')][_0xff77('0x3c')]);_0x50bb07['where']=qs[_0xff77('0x35')](_[_0xff77('0x3e')](_0x386f32['query'],_0x5d947c['filters']));_0x50bb07[_0xff77('0x3d')][_0xff77('0x52')]=_0x178285['id'];if(_0x386f32[_0xff77('0x33')][_0xff77('0x56')]){_0x50bb07[_0xff77('0x3d')]=_[_0xff77('0x3f')](_0x50bb07['where'],{'$or':_[_0xff77('0x2d')](_0x50bb07[_0xff77('0x37')],function(_0x2270ab){var _0xc3582d={};_0xc3582d[_0x2270ab]={'$like':'%'+_0x386f32[_0xff77('0x33')][_0xff77('0x56')]+'%'};return _0xc3582d;})});}_0x50bb07=_['merge']({},_0x50bb07,_0x386f32['options']);return db[_0xff77('0x5b')]['count']({'where':_0x50bb07['where']})[_0xff77('0x11')](function(_0x190c2a){_0x53ab3d[_0xff77('0x22')]=_0x190c2a;if(_0x386f32[_0xff77('0x33')][_0xff77('0x40')]){_0x50bb07[_0xff77('0x41')]=[{'all':!![]}];}return db[_0xff77('0x5b')][_0xff77('0x42')](_0x50bb07);})['then'](function(_0x1b8582){_0x53ab3d['rows']=_0x1b8582;return _0x53ab3d;});}})[_0xff77('0x11')](respondWithFilteredResult(_0x12fcef,_0x50bb07))[_0xff77('0x1b')](handleError(_0x12fcef,null));};exports['removeAnswers']=function(_0xfccd8e,_0x193988){return db[_0xff77('0x2e')][_0xff77('0x47')]({'where':{'id':_0xfccd8e[_0xff77('0x45')]['id']}})[_0xff77('0x11')](handleEntityNotFound(_0x193988,null))['then'](function(_0x82a603){if(_0x82a603){return _0x82a603['removeAnswers'](_0xfccd8e[_0xff77('0x33')]['ids']);}})[_0xff77('0x11')](respondWithStatusCode(_0x193988,null))['catch'](handleError(_0x193988,null));};exports[_0xff77('0x5d')]=function(_0x17a8fb,_0x435d5a){_0x17a8fb['body'][_0xff77('0x5e')]=_0x17a8fb[_0xff77('0x5f')]['filename'];return db['ChatWebsite']['find']({'where':{'id':_0x17a8fb[_0xff77('0x45')]['id']}})['then'](handleEntityNotFound(_0x435d5a,null))[_0xff77('0x11')](saveUpdates(_0x17a8fb[_0xff77('0x49')],null))['then'](respondWithResult(_0x435d5a,null))[_0xff77('0x1b')](handleError(_0x435d5a,null));};exports['addAvatar']=function(_0x5d2989,_0x55393b){_0x5d2989[_0xff77('0x49')][_0xff77('0x60')]=_0x5d2989[_0xff77('0x5f')][_0xff77('0x61')];return db['ChatWebsite']['find']({'where':{'id':_0x5d2989[_0xff77('0x45')]['id']}})[_0xff77('0x11')](handleEntityNotFound(_0x55393b,null))['then'](saveUpdates(_0x5d2989[_0xff77('0x49')],null))['then'](respondWithResult(_0x55393b,null))['catch'](handleError(_0x55393b,null));};exports[_0xff77('0x62')]=function(_0x26a9b0,_0x1f8204){_0x26a9b0[_0xff77('0x49')]['customerAvatar']=_0x26a9b0[_0xff77('0x5f')][_0xff77('0x61')];return db['ChatWebsite']['find']({'where':{'id':_0x26a9b0['params']['id']}})[_0xff77('0x11')](handleEntityNotFound(_0x1f8204,null))[_0xff77('0x11')](saveUpdates(_0x26a9b0[_0xff77('0x49')],null))[_0xff77('0x11')](respondWithResult(_0x1f8204,null))[_0xff77('0x1b')](handleError(_0x1f8204,null));};exports[_0xff77('0x63')]=function(_0x2fb167,_0x6743af){_0x2fb167[_0xff77('0x49')]['systemAvatar']=_0x2fb167[_0xff77('0x5f')]['filename'];return db[_0xff77('0x2e')][_0xff77('0x47')]({'where':{'id':_0x2fb167[_0xff77('0x45')]['id']}})['then'](handleEntityNotFound(_0x6743af,null))[_0xff77('0x11')](saveUpdates(_0x2fb167[_0xff77('0x49')],null))['then'](respondWithResult(_0x6743af,null))[_0xff77('0x1b')](handleError(_0x6743af,null));};exports[_0xff77('0x64')]=function(_0x5ac2e4,_0x404257){var _0x2a6371=path[_0xff77('0x65')](config[_0xff77('0x66')],_0xff77('0x67'));var _0x3ee80a={'where':{'id':_0x5ac2e4[_0xff77('0x45')]['id']},'attributes':['id','sitepic'],'raw':!![]};var _0x444b44=![];return require(_0xff77('0x68'))[_0xff77('0x69')]()['then'](function(_0x528b1e){if(_0x528b1e){_0x444b44=_0x528b1e[_0xff77('0x6a')];}})['then'](function(){return db[_0xff77('0x2e')][_0xff77('0x47')](_0x3ee80a);})[_0xff77('0x11')](handleEntityNotFound(_0x404257,null))['then'](function(_0x133684){if(_0x133684){if(!_[_0xff77('0x6b')](_0x133684[_0xff77('0x5e')])){if(fs['existsSync'](path[_0xff77('0x65')](config[_0xff77('0x66')],_0xff77('0x6c'),_0x133684['sitepic']))&&_0x444b44){_0x2a6371=path[_0xff77('0x65')](config['root'],_0xff77('0x6c'),_0x133684['sitepic']);}}return _0x404257[_0xff77('0x6d')](_0x2a6371);}})[_0xff77('0x1b')](handleError(_0x404257,null));};exports[_0xff77('0x6e')]=function(_0xd61a5e,_0x47fa86){var _0x3e5497=path[_0xff77('0x65')](config[_0xff77('0x66')],_0xff77('0x6f'));var _0x348bbc={'where':{'id':_0xd61a5e[_0xff77('0x45')]['id']},'attributes':['id','agentAvatar'],'raw':!![]};return db[_0xff77('0x2e')][_0xff77('0x47')](_0x348bbc)['then'](handleEntityNotFound(_0x47fa86,null))['then'](function(_0x48f134){if(_0x48f134){if(!_[_0xff77('0x6b')](_0x48f134['agentAvatar'])){if(fs['existsSync'](path[_0xff77('0x65')](config[_0xff77('0x66')],_0xff77('0x70'),_0x48f134[_0xff77('0x60')]))){_0x3e5497=path[_0xff77('0x65')](config[_0xff77('0x66')],_0xff77('0x70'),_0x48f134['agentAvatar']);}}return _0x47fa86[_0xff77('0x6d')](_0x3e5497);}})[_0xff77('0x1b')](handleError(_0x47fa86,null));};exports['getCustomerAvatar']=function(_0x1b2a68,_0x521274){var _0x4e5270=path['join'](config[_0xff77('0x66')],_0xff77('0x71'));var _0x53bd51={'where':{'id':_0x1b2a68[_0xff77('0x45')]['id']},'attributes':['id',_0xff77('0x72'),_0xff77('0x73')],'raw':!![]};return db['ChatWebsite'][_0xff77('0x47')](_0x53bd51)['then'](handleEntityNotFound(_0x521274,null))['then'](function(_0x197aa8){if(_0x197aa8){if(!_[_0xff77('0x6b')](_0x197aa8['customerAvatar'])){if(fs[_0xff77('0x74')](path[_0xff77('0x65')](config['root'],_0xff77('0x70'),_0x197aa8[_0xff77('0x72')]))&&_0x197aa8['showCustomerAvatar']){_0x4e5270=path[_0xff77('0x65')](config[_0xff77('0x66')],_0xff77('0x70'),_0x197aa8[_0xff77('0x72')]);}}return _0x521274['download'](_0x4e5270);}})[_0xff77('0x1b')](handleError(_0x521274,null));};exports[_0xff77('0x75')]=function(_0x49f271,_0x2b361b){var _0x5ba667=path[_0xff77('0x65')](config[_0xff77('0x66')],_0xff77('0x76'));var _0xddee80={'where':{'id':_0x49f271[_0xff77('0x45')]['id']},'attributes':['id',_0xff77('0x77')],'raw':!![]};return db['ChatWebsite'][_0xff77('0x47')](_0xddee80)['then'](handleEntityNotFound(_0x2b361b,null))['then'](function(_0x254648){if(_0x254648){if(!_['isNil'](_0x254648[_0xff77('0x77')])){if(fs[_0xff77('0x74')](path[_0xff77('0x65')](config[_0xff77('0x66')],_0xff77('0x70'),_0x254648[_0xff77('0x77')]))){_0x5ba667=path['join'](config[_0xff77('0x66')],_0xff77('0x70'),_0x254648['systemAvatar']);}}return _0x2b361b['download'](_0x5ba667);}})[_0xff77('0x1b')](handleError(_0x2b361b,null));};exports[_0xff77('0x78')]=function(_0x4d3063,_0x278b86){var _0x181b4c=require(_0xff77('0x79'));var _0x111ee4=new _0x181b4c();var _0x42f3bb=_0x111ee4['setUA'](_0x4d3063[_0xff77('0x7a')][_0xff77('0x7b')])['getResult']();var _0x55fc81={'body':_0x4d3063[_0xff77('0x49')],'channel':'chat'};var _0x237bc5=[];var _0x5b3108=[];var _0x1bf482={};var _0x5d9ef0=![];return db[_0xff77('0x7c')]['describe']()['then'](function(_0x3807c9){if(!_0x3807c9){throw new db[(_0xff77('0x7d'))][(_0xff77('0x7e'))](_0xff77('0x7f'));}_0x237bc5=_[_0xff77('0x80')](_[_0xff77('0x34')](_0x3807c9),['createdAt',_0xff77('0x81')]);_0x5b3108=_[_0xff77('0x80')](_[_0xff77('0x34')](_0x3807c9),['createdAt',_0xff77('0x81'),_0xff77('0x82'),_0xff77('0x83')]);if(_0x4d3063[_0xff77('0x49')]['id']){delete _0x4d3063[_0xff77('0x49')]['id'];}if(_[_0xff77('0x6b')](_0x4d3063[_0xff77('0x49')][_0xff77('0x84')])){throw new db[(_0xff77('0x7d'))]['ValidationError'](_0xff77('0x85'));}if(_['isNil'](_0x4d3063[_0xff77('0x49')][_0xff77('0x49')])||_0x4d3063['body'][_0xff77('0x49')]===''){throw new db['Sequelize'][(_0xff77('0x7e'))](_0xff77('0x86'));}if(_[_0xff77('0x6b')](_0x4d3063[_0xff77('0x49')]['mapKey'])){throw new db['Sequelize'][(_0xff77('0x7e'))](_0xff77('0x87')+_0x5b3108);}if(!_[_0xff77('0x88')](_0x5b3108,_0x4d3063['body'][_0xff77('0x89')])){throw new db[(_0xff77('0x7d'))][(_0xff77('0x7e'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x5b3108);}_0x1bf482[_0x4d3063[_0xff77('0x49')][_0xff77('0x89')]]=_0x4d3063[_0xff77('0x49')]['from'];})[_0xff77('0x11')](function(){return db[_0xff77('0x2e')][_0xff77('0x47')]({'where':{'id':_0x4d3063[_0xff77('0x45')]['id']},'include':[{'model':db[_0xff77('0x8a')],'as':_0xff77('0x8b'),'include':[{'model':db[_0xff77('0x7c')],'as':_0xff77('0x8c'),'where':_0x1bf482,'limit':0x1,'order':[['updatedAt',_0xff77('0x8d')]]}]},{'model':db[_0xff77('0x8e')],'as':_0xff77('0x8f')}]});})[_0xff77('0x11')](handleEntityNotFound(_0x278b86,null))[_0xff77('0x11')](function(_0x23869f){if(_0x23869f&&_0x23869f[_0xff77('0x8b')]){_0x55fc81['account']=_0x23869f;_0x55fc81[_0xff77('0x90')]=_0x23869f['Applications'];_0x55fc81[_0xff77('0x91')]=_0x23869f[_0xff77('0x8b')];_0x55fc81[_0xff77('0x90')]=_[_0xff77('0x92')](_0x55fc81['applications'],[_0xff77('0x93')],[_0xff77('0x94')]);if(_0x55fc81[_0xff77('0x95')]['Applications']){delete _0x55fc81[_0xff77('0x95')][_0xff77('0x8f')];}if(_0x55fc81[_0xff77('0x95')][_0xff77('0x8b')]&&_0x55fc81['account'][_0xff77('0x8b')]['Contacts']['length']){return _0x55fc81['account']['List'][_0xff77('0x8c')][0x0];}var _0x33968b=_[_0xff77('0x8')](_0x4d3063[_0xff77('0x49')],{'firstName':_0x4d3063[_0xff77('0x49')][_0xff77('0x84')],'ListId':_0x23869f['ListId']});_0x33968b[_0x4d3063[_0xff77('0x49')][_0xff77('0x89')]]=_0x4d3063[_0xff77('0x49')][_0xff77('0x84')];return db[_0xff77('0x7c')][_0xff77('0x48')](_0x33968b,{'fields':_0x237bc5,'raw':!![]});}})[_0xff77('0x11')](handleEntityNotFound(_0x278b86,null))[_0xff77('0x11')](function(_0x52f74d){_0x55fc81[_0xff77('0x96')]=_0x52f74d;var _0x1f1744=_0x4d3063[_0xff77('0x49')][_0xff77('0x97')];if(_0x4d3063[_0xff77('0x7a')][_0xff77('0x98')]){_0x1f1744=_0x4d3063[_0xff77('0x7a')]['cf-connecting-ip'];}else if(_0x4d3063[_0xff77('0x7a')][_0xff77('0x99')]){_0x1f1744=_[_0xff77('0x9a')](_0x4d3063[_0xff77('0x7a')]['x-forwarded-for']['split'](','));}if(_0x52f74d){var _0x4d2c78={'ContactId':_0x52f74d['id'],'ChatWebsiteId':_0x4d3063[_0xff77('0x45')]['id'],'from':(_0x52f74d[_0xff77('0x9b')]||'')+'\x20'+(_0x52f74d[_0xff77('0x9c')]||''),'customerIp':_0x1f1744,'customerPort':_0x4d3063[_0xff77('0x7a')][_0xff77('0x9d')]?_0x4d3063[_0xff77('0x7a')][_0xff77('0x9d')]:null,'referer':_0x4d3063[_0xff77('0x49')]['referer'],'browserName':_0x42f3bb['browser'][_0xff77('0x29')]&&_0x42f3bb[_0xff77('0x9e')][_0xff77('0x9f')]?util[_0xff77('0xa0')](_0xff77('0xa1'),_0x42f3bb[_0xff77('0x9e')][_0xff77('0x29')],_0x42f3bb[_0xff77('0x9e')][_0xff77('0x9f')]):_0xff77('0xa2'),'browserVersion':_0x42f3bb[_0xff77('0x9e')][_0xff77('0x9f')]||_0xff77('0xa2'),'osName':util[_0xff77('0xa0')](_0xff77('0xa1'),_0x42f3bb['os'][_0xff77('0x29')],_0x42f3bb['os'][_0xff77('0x9f')]),'osVersion':_0x42f3bb['os'][_0xff77('0x9f')],'deviceModel':_0x42f3bb['device']['model']&&_0x42f3bb[_0xff77('0xa3')][_0xff77('0xa4')]?util[_0xff77('0xa0')](_0xff77('0xa5'),_0x42f3bb[_0xff77('0xa3')][_0xff77('0x32')],_0x42f3bb['device']['vendor'],_0x42f3bb[_0xff77('0xa3')][_0xff77('0x31')]):null,'deviceVendor':_0x42f3bb[_0xff77('0xa3')][_0xff77('0xa4')],'deviceType':_0x42f3bb[_0xff77('0xa3')][_0xff77('0x31')],'formData':JSON[_0xff77('0x17')](_0x4d3063['body'])};var _0x845228={'ChatWebsiteId':_0x4d3063['params']['id'],'closed':![]};if(_0x4d3063[_0xff77('0x49')][_0xff77('0xa6')]){_0x845228['threadId']=_0x4d3063[_0xff77('0x49')]['threadId'];return db[_0xff77('0xa7')][_0xff77('0x47')]({'where':_0x845228})['then'](function(_0x5a19ec){if(_0x5a19ec){return[_0x5a19ec,![]];}_0x4d2c78[_0xff77('0xa6')]=_0x4d3063[_0xff77('0x49')][_0xff77('0xa6')];_0x4d2c78['externalUrl']=_0x4d3063[_0xff77('0x49')][_0xff77('0xa8')];return db[_0xff77('0xa7')][_0xff77('0x48')](_0x4d2c78)[_0xff77('0x11')](function(_0x2982fe){return[_0x2982fe,!![]];});});}_0x845228[_0xff77('0xa9')]=_0x52f74d['id'];if(_0x4d3063[_0xff77('0x49')][_0xff77('0xaa')]&&_0x4d3063['body'][_0xff77('0xaa')]['id']){_0x845228['id']=_0x4d3063[_0xff77('0x49')][_0xff77('0xaa')]['id'];return db[_0xff77('0xa7')][_0xff77('0x47')]({'where':_0x845228})[_0xff77('0x11')](function(_0x55aa7d){if(_0x55aa7d){return[_0x55aa7d,![]];}return db[_0xff77('0xa7')][_0xff77('0x48')](_0x4d2c78)[_0xff77('0x11')](function(_0x49e8e6){return[_0x49e8e6,!![]];});});}return db[_0xff77('0xa7')][_0xff77('0x48')](_0x4d2c78)['then'](function(_0x42fdbc){return[_0x42fdbc,!![]];});}})[_0xff77('0xab')](function(_0x91d8d2,_0x16394c){if(_0x91d8d2){_0x5d9ef0=_0x16394c;if(!_0x16394c){var _0x42b41a={'from':(_0x55fc81[_0xff77('0x96')][_0xff77('0x9b')]||'')+'\x20'+(_0x55fc81[_0xff77('0x96')][_0xff77('0x9c')]||'')};if(_0x4d3063[_0xff77('0x49')]['threadId']&&_0x4d3063[_0xff77('0x49')][_0xff77('0xac')]&&_0x4d3063[_0xff77('0x49')][_0xff77('0xa6')]!=_0x4d3063[_0xff77('0x49')][_0xff77('0xac')]){_0x42b41a['threadId']=_0x4d3063['body'][_0xff77('0xac')];}return _0x91d8d2['update'](_0x42b41a);}else{return _0x91d8d2;}}})[_0xff77('0x11')](function(_0x3ffd63){_0x55fc81['interaction']=_0x3ffd63[_0xff77('0x4a')]({'plain':!![]});_0x55fc81[_0xff77('0xaa')][_0xff77('0xad')]=_0x5d9ef0;if(_0x55fc81[_0xff77('0xaa')]['created']){if(_0x55fc81[_0xff77('0x95')][_0xff77('0xae')]){_0x55fc81[_0xff77('0x90')][_0xff77('0xaf')]({'id':0x0,'priority':_0x55fc81[_0xff77('0x90')]['length']+0x1,'app':'close','appdata':_0xff77('0xb0'),'interval':'*,*,*,*'});}}return db[_0xff77('0xb1')]['create']({'body':_0x4d3063[_0xff77('0x49')][_0xff77('0x49')],'ChatWebsiteId':_0x4d3063[_0xff77('0x45')]['id'],'ChatInteractionId':_0x3ffd63['id'],'direction':'in','ContactId':_0x55fc81[_0xff77('0x96')]['id'],'AttachmentId':_0x4d3063[_0xff77('0x49')]['AttachmentId']});})['then'](function(_0x57c79c){_0x55fc81[_0xff77('0x19')]=_0x57c79c;if(!_0x55fc81[_0xff77('0xaa')][_0xff77('0xb2')]){return;}return db[_0xff77('0xb3')][_0xff77('0x47')]({'attributes':['id','name'],'where':{'id':_0x55fc81['interaction'][_0xff77('0xb2')]}});})[_0xff77('0x11')](function(_0xfc2d18){if(_0xfc2d18){_0x55fc81[_0xff77('0x90')]['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0xfc2d18[_0xff77('0x29')]+','+(_0x55fc81['account'][_0xff77('0xb4')]||0xa),'interval':_0xff77('0xb5')});_0x55fc81[_0xff77('0xb6')]=!![];}if(!_0x55fc81[_0xff77('0xaa')]['queueId']){return;}return db[_0xff77('0xb7')][_0xff77('0x47')]({'attributes':['id',_0xff77('0x29')],'where':{'id':_0x55fc81[_0xff77('0xaa')][_0xff77('0xb8')]}});})['then'](function(_0x5bcc85){if(_0x5bcc85){_0x55fc81['applications']['unshift']({'id':0x0,'priority':0x1,'app':_0xff77('0xb9'),'appdata':_0x5bcc85['name']+','+(_0x55fc81[_0xff77('0x95')]['waitForTheAssignedQueue']||0x12c),'interval':_0xff77('0xb5')});}return respondWithRpcPromise(_0xff77('0xba'),_0xff77('0xbb'),_0x55fc81);})[_0xff77('0x11')](function(_0x35a1a7){respondWithRpcPromise(_0xff77('0xbc'),_0xff77('0xbc'),{'event':_0xff77('0x78'),'message':_0x35a1a7},client9002);return _0x35a1a7;})[_0xff77('0x11')](respondWithResult(_0x278b86,null))['catch'](handleError(_0x278b86,null));};exports[_0xff77('0xbd')]=function(_0x1d1a93,_0x3bef10){var _0x5b75f6,_0x291790,_0x570238;var _0x1c77ec=[];var _0x2251cf={};var _0x2b79d0=_0x1d1a93[_0xff77('0xbe')]||[];var _0x200072=[];var _0x2997b4;return db[_0xff77('0x7c')][_0xff77('0x50')]()[_0xff77('0x11')](function(_0x148efc){if(!_0x148efc){throw new db[(_0xff77('0x7d'))][(_0xff77('0x7e'))](_0xff77('0x7f'));}_0x1c77ec=_[_0xff77('0x80')](_[_0xff77('0x34')](_0x148efc),[_0xff77('0xbf'),_0xff77('0x81'),'CompanyId','ListId']);if(_0x1d1a93[_0xff77('0x49')]['id']){delete _0x1d1a93[_0xff77('0x49')]['id'];}if(_['isNil'](_0x1d1a93[_0xff77('0x49')][_0xff77('0x84')])){throw _0x3bef10[_0xff77('0x1d')](0x1f4)[_0xff77('0xc0')](new db['Sequelize'][(_0xff77('0x7e'))](_0xff77('0x85')));}if(_['isNil'](_0x1d1a93[_0xff77('0x49')][_0xff77('0x49')])||_0x1d1a93[_0xff77('0x49')][_0xff77('0x49')]===''){throw _0x3bef10[_0xff77('0x1d')](0x1f4)[_0xff77('0xc0')](new db[(_0xff77('0x7d'))][(_0xff77('0x7e'))](_0xff77('0x86')));}if(_['isNil'](_0x1d1a93['body'][_0xff77('0xc1')])){throw _0x3bef10[_0xff77('0x1d')](0x1f4)['send'](new db[(_0xff77('0x7d'))][(_0xff77('0x7e'))](_0xff77('0xc2')+_0x1c77ec));}if(!_[_0xff77('0x88')](_0x1c77ec,_0x1d1a93[_0xff77('0x49')]['mapKeyOffline'])){throw _0x3bef10[_0xff77('0x1d')](0x1f4)[_0xff77('0xc0')](new db[(_0xff77('0x7d'))][(_0xff77('0x7e'))]('mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x1c77ec));}_0x2251cf[_0x1d1a93[_0xff77('0x49')][_0xff77('0xc1')]]=_0x1d1a93['body'][_0xff77('0x84')];})[_0xff77('0x11')](function(){return db['ChatWebsite']['find']({'where':{'id':_0x1d1a93['params']['id']},'include':[{'model':db[_0xff77('0x8a')],'as':'List'},{'model':db[_0xff77('0xc3')],'as':_0xff77('0xc3')}]});})[_0xff77('0x11')](handleEntityNotFound(_0x3bef10,null))['then'](function(_0x3898fe){if(_0x3898fe&&_0x3898fe[_0xff77('0x8b')]){_0x291790=_0x3898fe;var _0x17e141=_[_0xff77('0x8')](_0x1d1a93['body'],{'firstName':_0x1d1a93[_0xff77('0x49')]['from'],'phone':_0x1d1a93['body']['from'],'ListId':_0x3898fe['ListId']});_0x17e141[_0x1d1a93[_0xff77('0x49')][_0xff77('0xc1')]]=_0x1d1a93[_0xff77('0x49')]['from'];return db[_0xff77('0x7c')][_0xff77('0xc4')]({'where':_0x2251cf,'defaults':_0x17e141});}})['spread'](function(_0x4b7e1f){if(_0x4b7e1f){_0x570238=_0x4b7e1f;var _0x2ed7f=fs['readFileSync'](path[_0xff77('0x65')](config[_0xff77('0x66')],_0xff77('0xc5')),_0xff77('0xc6'));var _0x108419=ejs[_0xff77('0xc7')](_0x2ed7f,{'body':_['toPairs'](_0x1d1a93[_0xff77('0x49')][_0xff77('0x49')]),'bodyTitle':_0x291790[_0xff77('0xc8')]});return db[_0xff77('0xc9')][_0xff77('0x48')]({'body':_0x108419,'plainBody':htmlToText['fromString'](_0x108419),'ContactId':_0x4b7e1f['id'],'ChatWebsiteId':_0x291790['id']});}})[_0xff77('0x11')](function(_0x5f3804){_0x2997b4=_0x5f3804;if(_0x2b79d0['length']){var _0x12d5b9=_0x2b79d0[_0xff77('0x2d')](function(_0x5efea5){return{'name':_0x5efea5['originalname'],'basename':_0x5efea5[_0xff77('0x61')],'type':_0x5efea5[_0xff77('0xca')],'ChatOfflineMessageId':_0x5f3804['id']};});_0x200072=_0x12d5b9[_0xff77('0x2d')](_0x1ef6b=>{var _0x28b275={'filename':_0x1ef6b[_0xff77('0x29')],'path':path[_0xff77('0x65')](config[_0xff77('0x66')],'server',_0xff77('0xbe'),'attachments',_0xff77('0xcb'),_0x1ef6b['basename'])};return _0x28b275;});if(!_0x291790[_0xff77('0xcc')]){return db[_0xff77('0xcd')][_0xff77('0xce')](function(_0xca8c6d){return db[_0xff77('0xcf')]['bulkCreate'](_0x12d5b9,{'transaction':_0xca8c6d});});}}})[_0xff77('0x11')](function(){if(_0x2997b4){_0x5b75f6=_0x2997b4;return db[_0xff77('0xc3')][_0xff77('0x54')]({'where':{'service':!![]},'include':[{'model':db[_0xff77('0xd0')],'as':_0xff77('0xd1'),'raw':!![],'include':[{'model':db[_0xff77('0xd2')],'as':_0xff77('0xd2'),'raw':!![]}]}]});}})[_0xff77('0x11')](function(_0x3e3bc9){if(_0x3e3bc9&&_0x3e3bc9['Smtp']&&_0x291790[_0xff77('0xd3')]&&_0x291790['forwardOfflineAddress']){var _0x4150ad=_0x3e3bc9[_0xff77('0xd4')]();return respondWithRpcPromise('SendMail',_0xff77('0xd5'),{'account':_0x4150ad,'message':{'from':util[_0xff77('0xa0')](_0xff77('0xd6'),_0x3e3bc9[_0xff77('0x29')],_0x3e3bc9[_0xff77('0xd7')]||_0x3e3bc9['Smtp'][_0xff77('0xd8')]),'to':_0x291790['forwardOfflineAddress'],'subject':_0x291790[_0xff77('0xd9')],'html':_0x5b75f6[_0xff77('0x49')],'attachments':_0x200072}},client9003)[_0xff77('0x11')](function(){return _0x5b75f6;})[_0xff77('0x1b')](function(_0x5ddb3d){logger[_0xff77('0x18')](_0x5ddb3d);});}})['then'](function(){if(_0x291790&&_0x291790[_0xff77('0xcc')]&&_0x291790[_0xff77('0xda')]){var _0x8f9346=[];if(_0x2b79d0[_0xff77('0x39')]){_0x8f9346=_0x2b79d0['map'](function(_0x9de70a){return{'name':_0x9de70a[_0xff77('0xdb')],'basename':_0x9de70a[_0xff77('0x61')],'type':_0x9de70a[_0xff77('0xca')],'ChatOfflineMessageId':_0x2997b4['id']};});}var _0x3ded7c;if(!_['isNil'](_0x291790[_0xff77('0xdc')])){var _0x3dc758=_[_0xff77('0x2d')](_0x1d1a93[_0xff77('0x49')],function(_0x33d56a){return _0x33d56a;});var _0x39037a=_[_0xff77('0xdd')](_0x3dc758)[0x0];var _0xb1b9bc=_[_0xff77('0xde')](_0x39037a,function(_0xf4e298){return _0xf4e298;});_0x3ded7c=_0xb1b9bc[0x1][_0x291790[_0xff77('0xdc')]];}var _0x24348c={'from':_0x570238[_0xff77('0xd7')],'firstName':_0x570238[_0xff77('0x9b')],'lastName':_0x570238[_0xff77('0x9c')],'mapKey':'email','message':{'from':_0x570238['email'],'to':_0x291790['MailAccount'][_0xff77('0xd7')],'cc':'','subject':_['isNil'](_0x3ded7c)?_0x291790[_0xff77('0xd9')]:_0x3ded7c,'messageId':'','sentAt':new Date(),'attach':_0x8f9346['length'],'attachments':_0x8f9346,'originChannel':_0xff77('0xdf'),'ChatWebsiteId':_0x291790['id'],'ChatOfflineMessageId':_0x5b75f6['id'],'originTo':_0x291790['MailAccount'][_0xff77('0xd7')]},'body':_0x5b75f6[_0xff77('0x49')]};var _0x2ab09d={'account':{'id':_0x291790[_0xff77('0xda')]},'body':_0x24348c,'log':_0xff77('0xe0')};return respondWithRpcPromise(_0xff77('0xe0'),'notifyMail',_0x2ab09d,client9001)[_0xff77('0x11')](function(){return _0x5b75f6;})['catch'](function(_0x60bcbe){logger['error'](_0x60bcbe);});}return;})[_0xff77('0x11')](function(){if(_0x5b75f6){return _0x5b75f6;}})[_0xff77('0x11')](respondWithResult(_0x3bef10,null))[_0xff77('0x1b')](function(_0x4706a8){logger['error'](_0xff77('0x1b'),_0x4706a8);for(var _0xafedb3 of _0x2b79d0){var _0x13a4d5=path['join'](config[_0xff77('0x66')],_0xff77('0xe1'),_0xff77('0xbe'),_0xff77('0xe2'),'offline-chat',_0xafedb3[_0xff77('0x61')]);fs_extra[_0xff77('0xe3')](_0x13a4d5)[_0xff77('0x1b')](function(_0x4a79b1){logger[_0xff77('0x18')](_0xff77('0xe4'),_0x13a4d5,_0x4a79b1);});}});};exports[_0xff77('0xe5')]=function(_0x109e6f,_0x1b2ab5){return db['ChatInteraction'][_0xff77('0x47')]({'where':{'id':_0x109e6f[_0xff77('0x45')]['id']}})[_0xff77('0x11')](handleEntityNotFound(_0x1b2ab5,null))[_0xff77('0x11')](function(_0x3ae8af){if(_0x3ae8af){return _0x3ae8af[_0xff77('0xe5')](_0x109e6f['body'][_0xff77('0x59')],_[_0xff77('0xe6')](_0x109e6f[_0xff77('0x49')],['ids','id'])||{});}})[_0xff77('0x11')](respondWithResult(_0x1b2ab5,null))[_0xff77('0x1b')](handleError(_0x1b2ab5,null));};exports[_0xff77('0xe7')]=function(_0x406503,_0x3d90c7){var _0x2c8441={'raw':![],'where':{}};var _0x1b742c={};var _0x2bdafb={'count':0x0,'rows':[]};return db[_0xff77('0x2e')][_0xff77('0x54')]({'where':{'id':_0x406503[_0xff77('0x45')]['id']}})[_0xff77('0x11')](handleEntityNotFound(_0x3d90c7,null))['then'](function(_0x220392){if(_0x220392){_0x1b742c['model']=_[_0xff77('0x34')](db['ChatInteraction'][_0xff77('0x2f')]);_0x1b742c[_0xff77('0x33')]=_[_0xff77('0x34')](_0x406503[_0xff77('0x33')]);_0x1b742c[_0xff77('0x35')]=_[_0xff77('0x36')](_0x1b742c[_0xff77('0x32')],_0x1b742c['query']);_0x2c8441['attributes']=_[_0xff77('0x36')](_0x1b742c['model'],qs[_0xff77('0x38')](_0x406503[_0xff77('0x33')][_0xff77('0x38')]));_0x2c8441[_0xff77('0x37')]=_0x2c8441[_0xff77('0x37')]['length']?_0x2c8441[_0xff77('0x37')]:_0x1b742c[_0xff77('0x32')];if(!_0x406503['query'][_0xff77('0x3a')](_0xff77('0x3b'))){_0x2c8441[_0xff77('0x21')]=qs[_0xff77('0x21')](_0x406503[_0xff77('0x33')][_0xff77('0x21')]);_0x2c8441[_0xff77('0x23')]=qs[_0xff77('0x23')](_0x406503[_0xff77('0x33')]['offset']);}_0x2c8441['order']=qs[_0xff77('0x3c')](_0x406503[_0xff77('0x33')][_0xff77('0x3c')]);_0x2c8441[_0xff77('0x3d')]=qs[_0xff77('0x35')](_[_0xff77('0x3e')](_0x406503['query'],_0x1b742c[_0xff77('0x35')]));_0x2c8441[_0xff77('0x3d')][_0xff77('0x52')]=_0x220392['id'];if(_0x406503[_0xff77('0x33')]['filter']){_0x2c8441[_0xff77('0x3d')]=_[_0xff77('0x3f')](_0x2c8441[_0xff77('0x3d')],{'$or':_[_0xff77('0x2d')](_0x2c8441['attributes'],function(_0x481f81){var _0x390017={};_0x390017[_0x481f81]={'$like':'%'+_0x406503[_0xff77('0x33')][_0xff77('0x56')]+'%'};return _0x390017;})});}_0x2c8441=_[_0xff77('0x3f')]({},_0x2c8441,_0x406503['options']);return db[_0xff77('0xa7')][_0xff77('0x22')]({'where':_0x2c8441[_0xff77('0x3d')]})[_0xff77('0x11')](function(_0x3e65e6){_0x2bdafb['count']=_0x3e65e6;if(_0x406503[_0xff77('0x33')][_0xff77('0x40')]){_0x2c8441[_0xff77('0x41')]=[{'model':db['CmContact'],'as':_0xff77('0xe8'),'required':![]},{'model':db['User'],'as':_0xff77('0xe9'),'attributes':[_0xff77('0x29'),_0xff77('0xea'),_0xff77('0xeb')],'required':![]},{'model':db[_0xff77('0xec')],'as':_0xff77('0xed'),'attributes':['id',_0xff77('0x29'),_0xff77('0xee')],'where':_0x406503[_0xff77('0x33')][_0xff77('0xef')]?{'id':_0x406503[_0xff77('0x33')]['tag']}:undefined,'required':_0x406503[_0xff77('0x33')][_0xff77('0xef')]?!![]:![]}];}return db[_0xff77('0xa7')]['findAll'](_0x2c8441);})[_0xff77('0x11')](function(_0x4135d5){_0x2bdafb['rows']=_0x4135d5;return _0x2bdafb;});}})['then'](respondWithFilteredResult(_0x3d90c7,_0x2c8441))[_0xff77('0x1b')](handleError(_0x3d90c7,null));};function iftimePromise(_0x234b05,_0x13c09a){return respondWithRpcPromise(_0xff77('0xf0'),_0xff77('0xf1'),{'command':_0x13c09a['timezone']?util[_0xff77('0xa0')](_0xff77('0xf2'),_0x234b05['interval'],_0x13c09a[_0xff77('0xf3')]):util[_0xff77('0xa0')](_0xff77('0xf4'),_0x234b05[_0xff77('0xf5')])},client9002)[_0xff77('0x11')](function(_0xf58756){var _0x2460aa=_0xf58756&&_0xf58756[_0xff77('0xf6')](_0xff77('0xf7'))>=0x0?!![]:![];logger[_0xff77('0x12')](_0xff77('0xf8'),_0x13c09a['id'],_0x234b05['id'],_0x234b05[_0xff77('0xf5')],_0x2460aa?_0xff77('0xf9'):_0xff77('0xfa'),_0x13c09a['timezone']?_0x13c09a['timezone']:_0xff77('0xfb'));return _0x2460aa;})['catch'](function(_0x2e2771){logger[_0xff77('0x18')](_0xff77('0xf8'),_0x13c09a['id'],_0x234b05['id'],_0x234b05[_0xff77('0xf5')],util[_0xff77('0xfc')](_0x2e2771,{'showHidden':![],'depth':null}),_0x13c09a[_0xff77('0xf3')]?_0x13c09a[_0xff77('0xf3')]:_0xff77('0xfb'));return![];});}exports[_0xff77('0xf1')]=function(_0x4e45a9,_0x8a8d4e){var _0x176b12=0x0;var _0x1d057c=0x0;var _0x26aa76=![];var _0x38b50f;var _0x5d2b0e;return db[_0xff77('0x2e')][_0xff77('0x47')]({'where':{'id':_0x4e45a9[_0xff77('0x45')]['id']},'include':[{'model':db[_0xff77('0xfd')],'as':'Interval','include':[{'model':db[_0xff77('0xfd')],'as':'Intervals','attributes':['id',_0xff77('0xf5')],'raw':!![]}]}]})[_0xff77('0x11')](handleEntityNotFound(_0x8a8d4e,null))['then'](function(_0x5b5910){if(_0x5b5910){_0x38b50f=_0x5b5910;return _0x5b5910[_0xff77('0xfe')]({'raw':!![]});}})['then'](function(_0x14ad95){if(_0x38b50f){if(_0x14ad95){_0x5d2b0e=_0x14ad95;}}return require('../../config/license/util')['getLicense']();})[_0xff77('0x11')](function(_0x512110){if(_0x512110){_0x1d057c=_0x512110[_0xff77('0xff')];_0x26aa76=_0x512110[_0xff77('0x6a')];}})['then'](function(){return db[_0xff77('0xa7')]['count']({'where':{'closed':![]}});})[_0xff77('0x11')](function(_0x35233c){_0x176b12=_0x35233c;if(_0x1d057c&&_0x35233c>_0x1d057c){return db[_0xff77('0x100')][_0xff77('0x54')]({'where':{'id':0x1}})['then'](function(_0x5cb3ce){if(_0x5cb3ce){_0x5cb3ce[_0xff77('0x101')](_0xff77('0x102'));}});}})[_0xff77('0x11')](function(){if(_0x38b50f['Interval']&&_0x38b50f[_0xff77('0xfd')]['Intervals']){var _0xffb5d3=[];for(var _0x3735be=0x0;_0x3735be<_0x38b50f['Interval'][_0xff77('0x103')]['length'];_0x3735be++){var _0x5400ed=_0x38b50f[_0xff77('0xfd')][_0xff77('0x103')][_0x3735be][_0xff77('0x4a')]({'plain':!![]});_0xffb5d3[_0xff77('0xaf')](iftimePromise(_0x5400ed,_0x38b50f));}return BPromise[_0xff77('0x104')](_0xffb5d3)['then'](function(_0x112d3e){return _[_0xff77('0x105')](_0x112d3e);});}else{return!![];}})[_0xff77('0x11')](function(_0x3f4b8a){var _0x174806=fs[_0xff77('0x106')](path[_0xff77('0x65')](config[_0xff77('0x66')],_0xff77('0x107')),_0xff77('0xc6'));var _0x450b71=new url[(_0xff77('0x108'))](_0x38b50f[_0xff77('0x109')])[_0xff77('0x10a')];var _0x46344f=_0xff77('0x10b');var _0x1993f6=![];var _0x498756={'chatVersion':_0x46344f,'chatWebsiteAddressOrigin':_0x450b71,'remote':_0x38b50f[_0xff77('0x10c')],'query':querystring[_0xff77('0x17')](_[_0xff77('0x3f')](_0x38b50f['get']({'plain':!![]}),{'customerIp':_0x4e45a9['headers'][_0xff77('0x99')]||_0x4e45a9['headers']['x-real-ip']||_0x4e45a9['connection']['remoteAddress']||_0x4e45a9['ip'],'referer':_0x4e45a9['headers']['referer'],'openedInteractions':_0x176b12,'maxInteractions':_0x1d057c,'virtual':_0x26aa76[_0xff77('0xff')],'online':_0x3f4b8a,'custom':_0x26aa76}))[_0xff77('0x10d')](/'/g,'\x5c\x27')};_0x8a8d4e[_0xff77('0xc0')](ejs[_0xff77('0xc7')](Mustache[_0xff77('0xc7')](_0x174806,_0x498756),{'proactiveActions':_0x5d2b0e,'alignment':_0x38b50f[_0xff77('0x10e')],'verticalAlignment':_0x38b50f[_0xff77('0x10f')],'div_color':_0x38b50f[_0xff77('0xee')],'labelText':_0x38b50f[_0xff77('0x110')],'text_color':_0x38b50f[_0xff77('0x111')],'text_button_color':_0x38b50f['textButtonColor'],'button_color':_0x38b50f[_0xff77('0x112')],'background_color':_0x38b50f['backgroundColor'],'hideWhenOffline':_0x38b50f[_0xff77('0x113')],'intervalId':_0x38b50f['IntervalId'],'isDevelopment':_0x1993f6,'chatVersion':_0x46344f}));})[_0xff77('0x1b')](handleError(_0x8a8d4e,null));};exports[_0xff77('0x114')]=function(_0x38a8ce,_0x5d933a){var _0x5b205c=_0x38a8ce[_0xff77('0x45')]['id'];var _0x176353=_0x38a8ce[_0xff77('0x49')];var _0x356b85=0xc8;var _0x38099b=null;return db[_0xff77('0xcd')]['transaction']({'isolationLevel':db[_0xff77('0xcd')][_0xff77('0x115')][_0xff77('0x116')][_0xff77('0x117')]},function(_0x13843e){return db[_0xff77('0x2e')][_0xff77('0x54')]({'where':{'id':_0x5b205c},'transaction':_0x13843e})[_0xff77('0x11')](function(_0x3ca300){if(_0x3ca300){return db[_0xff77('0x8e')][_0xff77('0x26')]({'where':{'ChatWebsiteId':_0x5b205c},'transaction':_0x13843e})[_0xff77('0x11')](function(){var _0x55c12b=_[_0xff77('0x2d')](_0x176353,function(_0x257848){_0x257848['ChatWebsiteId']=_0x5b205c;return _0x257848;});return db[_0xff77('0x8e')][_0xff77('0x118')](_0x55c12b,{'transaction':_0x13843e});});}else{_0x356b85=0x194;_0x38099b=[];}});})[_0xff77('0x11')](function(){if(_0x356b85!==0x194){return db['ChatApplication']['findAndCountAll']({'where':{'ChatWebsiteId':_0x5b205c},'order':_0xff77('0x93')})['then'](function(_0xfd0aab){_0x38099b=_0xfd0aab;});}})['catch'](function(_0x36ddbe){_0x356b85=0x1f4;logger[_0xff77('0x18')](_0x36ddbe[_0xff77('0x119')]);if(_0x36ddbe[_0xff77('0x29')]){delete _0x36ddbe['name'];}_0x38099b=_0x36ddbe;})[_0xff77('0x11a')](function(){if(_0x38099b===null){_0x5d933a['sendStatus'](_0x356b85);}else{if(_0x356b85===0x1f4){_0x5d933a['status'](_0x356b85)[_0xff77('0xc0')](_0x38099b);}else{_0x5d933a[_0xff77('0x1d')](_0x356b85)[_0xff77('0x1f')](_0x38099b);}}});};exports[_0xff77('0x11b')]=function(_0x44df34,_0x3eed62){var _0x40e3da={};var _0x43f431={};var _0x379a46;var _0x5c1050;return db[_0xff77('0x2e')]['findOne']({'where':{'id':_0x44df34['params']['id']}})[_0xff77('0x11')](handleEntityNotFound(_0x3eed62,null))['then'](function(_0x2fbe86){if(_0x2fbe86){_0x379a46=_0x2fbe86;_0x43f431[_0xff77('0x32')]=_[_0xff77('0x34')](db[_0xff77('0x8e')][_0xff77('0x2f')]);_0x43f431[_0xff77('0x33')]=_[_0xff77('0x34')](_0x44df34[_0xff77('0x33')]);_0x43f431['filters']=_['intersection'](_0x43f431[_0xff77('0x32')],_0x43f431[_0xff77('0x33')]);_0x40e3da[_0xff77('0x37')]=_[_0xff77('0x36')](_0x43f431[_0xff77('0x32')],qs[_0xff77('0x38')](_0x44df34['query'][_0xff77('0x38')]));_0x40e3da[_0xff77('0x37')]=_0x40e3da[_0xff77('0x37')]['length']?_0x40e3da[_0xff77('0x37')]:_0x43f431['model'];_0x40e3da[_0xff77('0x55')]=qs[_0xff77('0x3c')](_0x44df34[_0xff77('0x33')][_0xff77('0x3c')]);_0x40e3da['where']=qs['filters'](_[_0xff77('0x3e')](_0x44df34['query'],_0x43f431['filters']));if(_0x44df34['query'][_0xff77('0x56')]){_0x40e3da[_0xff77('0x3d')]=_['merge'](_0x40e3da[_0xff77('0x3d')],{'$or':_[_0xff77('0x2d')](_0x40e3da['attributes'],function(_0x4b5f4c){var _0x2c4e81={};_0x2c4e81[_0x4b5f4c]={'$like':'%'+_0x44df34[_0xff77('0x33')][_0xff77('0x56')]+'%'};return _0x2c4e81;})});}_0x40e3da=_[_0xff77('0x3f')]({},_0x40e3da,_0x44df34[_0xff77('0x46')]);return _0x379a46['getApplications'](_0x40e3da);}})[_0xff77('0x11')](function(_0x5a2ce1){if(_0x5a2ce1){_0x5c1050=_0x5a2ce1[_0xff77('0x39')];if(!_0x44df34['query'][_0xff77('0x3a')](_0xff77('0x3b'))){_0x40e3da[_0xff77('0x21')]=qs[_0xff77('0x21')](_0x44df34[_0xff77('0x33')]['limit']);_0x40e3da['offset']=qs[_0xff77('0x23')](_0x44df34['query'][_0xff77('0x23')]);}return _0x379a46['getApplications'](_0x40e3da);}})['then'](function(_0x19abd1){if(_0x19abd1){return _0x19abd1?{'count':_0x5c1050,'rows':_0x19abd1}:null;}})['then'](respondWithResult(_0x3eed62,null))[_0xff77('0x1b')](handleError(_0x3eed62,null));};exports['addProactiveActions']=function(_0x316159,_0x732181){return db['chatProactiveAction'][_0xff77('0x47')]({'where':{'id':_0x316159['params']['id']}})[_0xff77('0x11')](handleEntityNotFound(_0x732181,null))[_0xff77('0x11')](function(_0x1cd6d7){if(_0x1cd6d7){return _0x1cd6d7[_0xff77('0x11c')](_0x316159[_0xff77('0x49')][_0xff77('0x59')],_[_0xff77('0xe6')](_0x316159[_0xff77('0x49')],['ids','id'])||{});}})[_0xff77('0x11')](respondWithResult(_0x732181,null))[_0xff77('0x1b')](handleError(_0x732181,null));};exports[_0xff77('0xfe')]=function(_0x3644c2,_0x9c42c7){var _0x31352b={};var _0x1bd79e={};var _0x11411b;var _0xe029fc;return db[_0xff77('0x2e')][_0xff77('0x54')]({'where':{'id':_0x3644c2[_0xff77('0x45')]['id']}})[_0xff77('0x11')](handleEntityNotFound(_0x9c42c7,null))['then'](function(_0x100b8c){if(_0x100b8c){_0x11411b=_0x100b8c;_0x1bd79e['model']=_['keys'](db[_0xff77('0x11d')][_0xff77('0x2f')]);_0x1bd79e['query']=_[_0xff77('0x34')](_0x3644c2[_0xff77('0x33')]);_0x1bd79e[_0xff77('0x35')]=_[_0xff77('0x36')](_0x1bd79e[_0xff77('0x32')],_0x1bd79e[_0xff77('0x33')]);_0x31352b[_0xff77('0x37')]=_[_0xff77('0x36')](_0x1bd79e[_0xff77('0x32')],qs[_0xff77('0x38')](_0x3644c2[_0xff77('0x33')][_0xff77('0x38')]));_0x31352b['attributes']=_0x31352b['attributes'][_0xff77('0x39')]?_0x31352b[_0xff77('0x37')]:_0x1bd79e['model'];_0x31352b['order']=qs['sort'](_0x3644c2['query'][_0xff77('0x3c')]);_0x31352b[_0xff77('0x3d')]=qs[_0xff77('0x35')](_[_0xff77('0x3e')](_0x3644c2[_0xff77('0x33')],_0x1bd79e['filters']));if(_0x3644c2['query']['filter']){_0x31352b[_0xff77('0x3d')]=_[_0xff77('0x3f')](_0x31352b[_0xff77('0x3d')],{'$or':_[_0xff77('0x2d')](_0x31352b[_0xff77('0x37')],function(_0x3f3ce9){var _0x5e0d14={};_0x5e0d14[_0x3f3ce9]={'$like':'%'+_0x3644c2['query']['filter']+'%'};return _0x5e0d14;})});}_0x31352b=_['merge']({},_0x31352b,_0x3644c2[_0xff77('0x46')]);return _0x11411b['getProactiveActions'](_0x31352b);}})[_0xff77('0x11')](function(_0xc97636){if(_0xc97636){_0xe029fc=_0xc97636[_0xff77('0x39')];if(!_0x3644c2['query']['hasOwnProperty']('nolimit')){_0x31352b[_0xff77('0x21')]=qs['limit'](_0x3644c2[_0xff77('0x33')][_0xff77('0x21')]);_0x31352b['offset']=qs['offset'](_0x3644c2[_0xff77('0x33')][_0xff77('0x23')]);}return _0x11411b[_0xff77('0xfe')](_0x31352b);}})[_0xff77('0x11')](function(_0x4032fa){if(_0x4032fa){return _0x4032fa?{'count':_0xe029fc,'rows':_0x4032fa}:null;}})[_0xff77('0x11')](respondWithResult(_0x9c42c7,null))[_0xff77('0x1b')](handleError(_0x9c42c7,null));};exports[_0xff77('0x11e')]=function(_0x437ff1,_0x23b381){var _0x45e784=_0x437ff1[_0xff77('0x33')]['online']===_0xff77('0x11f')?_0xff77('0x120'):_0xff77('0x121');return db['ChatWebsite']['find']({'attributes':['id',_0x45e784],'where':{'id':_0x437ff1[_0xff77('0x45')]['id']}})[_0xff77('0x11')](handleEntityNotFound(_0x23b381,null))[_0xff77('0x11')](function(_0x523502){if(_0x523502){var _0x35fdff=_0x523502[_0x45e784];var _0x18cf54=_0x35fdff&&_0x35fdff[_0xff77('0x122')]?_0x35fdff[_0xff77('0x122')]:[];_0x23b381[_0xff77('0xc0')]({'fromKey':_[_0xff77('0x6b')](_0x35fdff['fromKey'])?undefined:_0x35fdff[_0xff77('0x123')],'count':_0x18cf54['length'],'rows':_0x18cf54});}})['catch'](handleError(_0x23b381,null));};exports[_0xff77('0x124')]=function(_0x32088c,_0x4af801){var _0x33a211={'raw':![],'where':{}};var _0x46d8fc={};var _0x28c45e={'count':0x0,'rows':[]};return db[_0xff77('0x2e')]['findOne']({'where':{'id':_0x32088c['params']['id']}})[_0xff77('0x11')](handleEntityNotFound(_0x4af801,null))['then'](function(_0x522005){if(_0x522005){_0x46d8fc['model']=_[_0xff77('0x34')](db[_0xff77('0xc9')][_0xff77('0x2f')]);_0x46d8fc[_0xff77('0x33')]=_['keys'](_0x32088c[_0xff77('0x33')]);_0x46d8fc[_0xff77('0x35')]=_['intersection'](_0x46d8fc[_0xff77('0x32')],_0x46d8fc[_0xff77('0x33')]);_0x33a211[_0xff77('0x37')]=_[_0xff77('0x36')](_0x46d8fc[_0xff77('0x32')],qs['fields'](_0x32088c[_0xff77('0x33')]['fields']));_0x33a211['attributes']=_0x33a211['attributes'][_0xff77('0x39')]?_0x33a211[_0xff77('0x37')]:_0x46d8fc['model'];if(!_0x32088c[_0xff77('0x33')]['hasOwnProperty'](_0xff77('0x3b'))){_0x33a211[_0xff77('0x21')]=qs[_0xff77('0x21')](_0x32088c[_0xff77('0x33')]['limit']);_0x33a211['offset']=qs[_0xff77('0x23')](_0x32088c[_0xff77('0x33')]['offset']);}_0x33a211[_0xff77('0x55')]=qs['sort'](_0x32088c[_0xff77('0x33')][_0xff77('0x3c')]);_0x33a211[_0xff77('0x3d')]=qs[_0xff77('0x35')](_[_0xff77('0x3e')](_0x32088c[_0xff77('0x33')],_0x46d8fc[_0xff77('0x35')]));_0x33a211['where'][_0xff77('0x52')]=_0x522005['id'];if(_0x32088c[_0xff77('0x33')][_0xff77('0x56')]){_0x33a211[_0xff77('0x3d')]=_['merge'](_0x33a211[_0xff77('0x3d')],{'$or':_[_0xff77('0x2d')](_0x33a211['attributes'],function(_0x8529c1){var _0x12d751={};_0x12d751[_0x8529c1]={'$like':'%'+_0x32088c[_0xff77('0x33')][_0xff77('0x56')]+'%'};return _0x12d751;})});}_0x33a211=_['merge']({},_0x33a211,_0x32088c[_0xff77('0x46')]);return db[_0xff77('0xc9')][_0xff77('0x22')]({'where':_0x33a211[_0xff77('0x3d')]})[_0xff77('0x11')](function(_0x27395d){_0x28c45e[_0xff77('0x22')]=_0x27395d;if(_0x32088c[_0xff77('0x33')][_0xff77('0x40')]){_0x33a211[_0xff77('0x41')]=[{'all':!![]}];}else{_0x33a211[_0xff77('0x41')]=[{'model':db[_0xff77('0x7c')],'as':_0xff77('0xe8'),'required':![]},{'model':db[_0xff77('0xcf')],'as':_0xff77('0x125'),'required':![]}];}return db['ChatOfflineMessage']['findAll'](_0x33a211);})[_0xff77('0x11')](function(_0x2688c4){_0x28c45e[_0xff77('0x43')]=_0x2688c4;return _0x28c45e;});}})[_0xff77('0x11')](respondWithFilteredResult(_0x4af801,_0x33a211))[_0xff77('0x1b')](handleError(_0x4af801,null));};exports[_0xff77('0x126')]=function(_0x34e6ef,_0x1ea40f){return db[_0xff77('0x2e')][_0xff77('0x47')]({'where':{'id':_0x34e6ef['params']['id']}})[_0xff77('0x11')](handleEntityNotFound(_0x1ea40f,null))['then'](function(_0x200595){if(_0x200595){return _0x200595[_0xff77('0x126')](_0x34e6ef['body'][_0xff77('0x59')],_['omit'](_0x34e6ef[_0xff77('0x49')],[_0xff77('0x59'),'id'])||{})[_0xff77('0xab')](function(_0x4037c4){for(var _0x4b4762=0x0;_0x4b4762<_0x34e6ef[_0xff77('0x49')][_0xff77('0x59')][_0xff77('0x39')];_0x4b4762+=0x1){socket[_0xff77('0x127')](_0xff77('0x128'),{'UserId':Number(_0x34e6ef[_0xff77('0x49')][_0xff77('0x59')][_0x4b4762]),'ChatWebsiteId':Number(_0x34e6ef[_0xff77('0x45')]['id'])});}return _0x4037c4;});}})[_0xff77('0x11')](respondWithResult(_0x1ea40f,null))[_0xff77('0x1b')](handleError(_0x1ea40f,null));};exports['removeAgents']=function(_0x2b5765,_0x46a307){return db['ChatWebsite'][_0xff77('0x47')]({'where':{'id':_0x2b5765['params']['id']}})[_0xff77('0x11')](handleEntityNotFound(_0x46a307,null))[_0xff77('0x11')](function(_0x2d937e){if(_0x2d937e){return _0x2d937e[_0xff77('0x129')](_0x2b5765[_0xff77('0x33')]['ids'])[_0xff77('0x11')](function(){if(_[_0xff77('0x12a')](_0x2b5765[_0xff77('0x33')][_0xff77('0x59')])){for(var _0x30b315=0x0;_0x30b315<_0x2b5765['query'][_0xff77('0x59')][_0xff77('0x39')];_0x30b315+=0x1){socket[_0xff77('0x127')]('userChatWebsite:remove',{'UserId':Number(_0x2b5765[_0xff77('0x33')][_0xff77('0x59')][_0x30b315]),'ChatWebsiteId':Number(_0x2b5765[_0xff77('0x45')]['id'])});}}else{socket['emit']('userChatWebsite:remove',{'UserId':Number(_0x2b5765[_0xff77('0x33')][_0xff77('0x59')]),'ChatWebsiteId':Number(_0x2b5765[_0xff77('0x45')]['id'])});}});}})[_0xff77('0x11')](respondWithStatusCode(_0x46a307,null))[_0xff77('0x1b')](handleError(_0x46a307,null));};exports['getAgents']=function(_0x3b75af,_0x331648){var _0xfd533c={};var _0x3293e5={};var _0x13ade5;var _0x5ed9e0;return db[_0xff77('0x2e')][_0xff77('0x54')]({'where':{'id':_0x3b75af[_0xff77('0x45')]['id']}})[_0xff77('0x11')](handleEntityNotFound(_0x331648,null))['then'](function(_0x3576c5){if(_0x3576c5){_0x13ade5=_0x3576c5;_0x3293e5['model']=_[_0xff77('0x34')](db[_0xff77('0xb3')]['rawAttributes']);_0x3293e5['query']=_['keys'](_0x3b75af[_0xff77('0x33')]);_0x3293e5[_0xff77('0x35')]=_[_0xff77('0x36')](_0x3293e5[_0xff77('0x32')],_0x3293e5[_0xff77('0x33')]);_0xfd533c[_0xff77('0x37')]=_[_0xff77('0x36')](_0x3293e5[_0xff77('0x32')],qs['fields'](_0x3b75af[_0xff77('0x33')][_0xff77('0x38')]));_0xfd533c[_0xff77('0x37')]=_0xfd533c[_0xff77('0x37')][_0xff77('0x39')]?_0xfd533c['attributes']:_0x3293e5[_0xff77('0x32')];_0xfd533c[_0xff77('0x55')]=qs['sort'](_0x3b75af['query']['sort']);_0xfd533c['where']=qs[_0xff77('0x35')](_['pick'](_0x3b75af[_0xff77('0x33')],_0x3293e5[_0xff77('0x35')]));if(_0x3b75af[_0xff77('0x33')][_0xff77('0x56')]){_0xfd533c[_0xff77('0x3d')]=_[_0xff77('0x3f')](_0xfd533c[_0xff77('0x3d')],{'$or':_['map'](_0xfd533c['attributes'],function(_0x3ab3ee){var _0xace79f={};_0xace79f[_0x3ab3ee]={'$like':'%'+_0x3b75af[_0xff77('0x33')][_0xff77('0x56')]+'%'};return _0xace79f;})});}_0xfd533c=_[_0xff77('0x3f')]({},_0xfd533c,_0x3b75af['options']);return _0x13ade5['getAgents'](_0xfd533c);}})[_0xff77('0x11')](function(_0x82ba42){if(_0x82ba42){_0x5ed9e0=_0x82ba42['length'];if(!_0x3b75af[_0xff77('0x33')]['hasOwnProperty']('nolimit')){_0xfd533c[_0xff77('0x21')]=qs[_0xff77('0x21')](_0x3b75af[_0xff77('0x33')]['limit']);_0xfd533c['offset']=qs[_0xff77('0x23')](_0x3b75af['query'][_0xff77('0x23')]);}return _0x13ade5[_0xff77('0x12b')](_0xfd533c);}})[_0xff77('0x11')](function(_0x3c1105){if(_0x3c1105){return _0x3c1105?{'count':_0x5ed9e0,'rows':_0x3c1105}:null;}})[_0xff77('0x11')](respondWithResult(_0x331648,null))[_0xff77('0x1b')](handleError(_0x331648,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index faac36b..1770d99 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 _0x192f=['save','emit','hook','exports','events','ChatWebsite'];(function(_0x311261,_0x582655){var _0x2945c8=function(_0x4b9462){while(--_0x4b9462){_0x311261['push'](_0x311261['shift']());}};_0x2945c8(++_0x582655);}(_0x192f,0xd6));var _0xf192=function(_0x46bee1,_0x25d4d4){_0x46bee1=_0x46bee1-0x0;var _0x279156=_0x192f[_0x46bee1];return _0x279156;};'use strict';var EventEmitter=require(_0xf192('0x0'));var ChatWebsite=require('../../mysqldb')['db'][_0xf192('0x1')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xf192('0x2'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x3ed9c1){return function(_0x3b704f,_0x1a2945,_0x22d0b0){ChatWebsiteEvents[_0xf192('0x3')](_0x3ed9c1+':'+_0x3b704f['id'],_0x3b704f);ChatWebsiteEvents[_0xf192('0x3')](_0x3ed9c1,_0x3b704f);_0x22d0b0(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatWebsite[_0xf192('0x4')](e,emitEvent(event));}}module[_0xf192('0x5')]=ChatWebsiteEvents; \ No newline at end of file +var _0x00b3=['emit','hasOwnProperty','hook','exports','events','setMaxListeners','save'];(function(_0x3e79a2,_0xf487b3){var _0x48c87b=function(_0x3d59d2){while(--_0x3d59d2){_0x3e79a2['push'](_0x3e79a2['shift']());}};_0x48c87b(++_0xf487b3);}(_0x00b3,0x97));var _0x300b=function(_0xe18a54,_0x26196a){_0xe18a54=_0xe18a54-0x0;var _0x573d74=_0x00b3[_0xe18a54];return _0x573d74;};'use strict';var EventEmitter=require(_0x300b('0x0'));var ChatWebsite=require('../../mysqldb')['db']['ChatWebsite'];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x300b('0x1')](0x0);var events={'afterCreate':_0x300b('0x2'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x103196){return function(_0x29e653,_0x2feba7,_0x544cbf){ChatWebsiteEvents[_0x300b('0x3')](_0x103196+':'+_0x29e653['id'],_0x29e653);ChatWebsiteEvents[_0x300b('0x3')](_0x103196,_0x29e653);_0x544cbf(null);};}for(var e in events){if(events[_0x300b('0x4')](e)){var event=events[e];ChatWebsite[_0x300b('0x5')](e,emitEvent(event));}}module[_0x300b('0x6')]=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index 0f71255..b5cd309 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 _0xf137=['request-promise','path','rimraf','../../config/environment','./chatWebsite.attributes','exports','define','ChatWebsite','chat_websites','lodash','util','api','moment'];(function(_0x56f641,_0x20ee28){var _0x402f59=function(_0x327587){while(--_0x327587){_0x56f641['push'](_0x56f641['shift']());}};_0x402f59(++_0x20ee28);}(_0xf137,0xb2));var _0x7f13=function(_0x46d544,_0x3dba29){_0x46d544=_0x46d544-0x0;var _0x54f08a=_0xf137[_0x46d544];return _0x54f08a;};'use strict';var _=require(_0x7f13('0x0'));var util=require(_0x7f13('0x1'));var logger=require('../../config/logger')(_0x7f13('0x2'));var moment=require(_0x7f13('0x3'));var BPromise=require('bluebird');var rp=require(_0x7f13('0x4'));var fs=require('fs');var path=require(_0x7f13('0x5'));var rimraf=require(_0x7f13('0x6'));var config=require(_0x7f13('0x7'));var attributes=require(_0x7f13('0x8'));module[_0x7f13('0x9')]=function(_0x2f3b21,_0x1acc31){return _0x2f3b21[_0x7f13('0xa')](_0x7f13('0xb'),attributes,{'tableName':_0x7f13('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1974=['api','moment','bluebird','path','../../config/environment','./chatWebsite.attributes','exports','ChatWebsite','chat_websites','../../config/logger'];(function(_0x587fb5,_0x59cb3b){var _0x551105=function(_0x5bbef4){while(--_0x5bbef4){_0x587fb5['push'](_0x587fb5['shift']());}};_0x551105(++_0x59cb3b);}(_0x1974,0x1df));var _0x4197=function(_0x51b18c,_0x593892){_0x51b18c=_0x51b18c-0x0;var _0x3c590c=_0x1974[_0x51b18c];return _0x3c590c;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4197('0x0'))(_0x4197('0x1'));var moment=require(_0x4197('0x2'));var BPromise=require(_0x4197('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4197('0x4'));var rimraf=require('rimraf');var config=require(_0x4197('0x5'));var attributes=require(_0x4197('0x6'));module[_0x4197('0x7')]=function(_0x71609a,_0x386af6){return _0x71609a['define'](_0x4197('0x8'),attributes,{'tableName':_0x4197('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.rpc.js b/server/api/chatWebsite/chatWebsite.rpc.js index 39bd7f8..542fb10 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 _0xa4ab=['jayson/promise','client','http','redis','localhost','socket.io-emitter','./chatWebsite.socket','register','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x31e07c,_0x1c3895){var _0x9f67cf=function(_0x5ef3c8){while(--_0x5ef3c8){_0x31e07c['push'](_0x31e07c['shift']());}};_0x9f67cf(++_0x1c3895);}(_0xa4ab,0x102));var _0xba4a=function(_0x794207,_0x54a989){_0x794207=_0x794207-0x0;var _0x4ee1c9=_0xa4ab[_0x794207];return _0x4ee1c9;};'use strict';var _=require(_0xba4a('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xba4a('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xba4a('0x2'))['db'];var utils=require(_0xba4a('0x3'));var logger=require('../../config/logger')(_0xba4a('0x4'));var config=require(_0xba4a('0x5'));var jayson=require(_0xba4a('0x6'));var client=jayson[_0xba4a('0x7')][_0xba4a('0x8')]({'port':0x232a});config['redis']=_['defaults'](config[_0xba4a('0x9')],{'host':_0xba4a('0xa'),'port':0x18eb});var socket=require(_0xba4a('0xb'))(new Redis(config[_0xba4a('0x9')]));require(_0xba4a('0xc'))[_0xba4a('0xd')](socket);function respondWithRpcPromise(_0x16e8ad,_0x1a3b18,_0x2b4652){return new BPromise(function(_0x14b16e,_0x9602bd){return client['request'](_0x16e8ad,_0x2b4652)[_0xba4a('0xe')](function(_0x225366){logger[_0xba4a('0xf')](_0xba4a('0x10'),_0x1a3b18,_0xba4a('0x11'));logger['debug']('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x1a3b18,_0xba4a('0x11'),JSON[_0xba4a('0x12')](_0x225366));if(_0x225366[_0xba4a('0x13')]){if(_0x225366[_0xba4a('0x13')][_0xba4a('0x14')]===0x1f4){logger['error'](_0xba4a('0x10'),_0x1a3b18,_0x225366[_0xba4a('0x13')]['message']);return _0x9602bd(_0x225366[_0xba4a('0x13')][_0xba4a('0x15')]);}logger[_0xba4a('0x13')]('ChatWebsite,\x20%s,\x20%s',_0x1a3b18,_0x225366['error'][_0xba4a('0x15')]);return _0x14b16e(_0x225366[_0xba4a('0x13')][_0xba4a('0x15')]);}else{logger[_0xba4a('0xf')](_0xba4a('0x10'),_0x1a3b18,_0xba4a('0x11'));_0x14b16e(_0x225366[_0xba4a('0x16')]['message']);}})[_0xba4a('0x17')](function(_0x33f456){logger[_0xba4a('0x13')](_0xba4a('0x10'),_0x1a3b18,_0x33f456);_0x9602bd(_0x33f456);});});} \ No newline at end of file +var _0x727c=['lodash','util','randomstring','ioredis','../../config/logger','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','register','request','ChatWebsite,\x20%s,\x20%s','request\x20sent','error','message','info','result'];(function(_0xc1263e,_0x56d738){var _0x471f07=function(_0x2e6c55){while(--_0x2e6c55){_0xc1263e['push'](_0xc1263e['shift']());}};_0x471f07(++_0x56d738);}(_0x727c,0xb4));var _0xc727=function(_0x476705,_0x34fe4c){_0x476705=_0x476705-0x0;var _0x520734=_0x727c[_0x476705];return _0x520734;};'use strict';var _=require(_0xc727('0x0'));var util=require(_0xc727('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xc727('0x2'));var fs=require('fs');var Redis=require(_0xc727('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xc727('0x4'))('rpc');var config=require(_0xc727('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xc727('0x6')][_0xc727('0x7')]({'port':0x232a});config[_0xc727('0x8')]=_[_0xc727('0x9')](config['redis'],{'host':_0xc727('0xa'),'port':0x18eb});var socket=require(_0xc727('0xb'))(new Redis(config['redis']));require('./chatWebsite.socket')[_0xc727('0xc')](socket);function respondWithRpcPromise(_0x4e0d96,_0x46b4c9,_0x50abe5){return new BPromise(function(_0x568e34,_0x329334){return client[_0xc727('0xd')](_0x4e0d96,_0x50abe5)['then'](function(_0x51264a){logger['info'](_0xc727('0xe'),_0x46b4c9,_0xc727('0xf'));logger['debug']('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x46b4c9,_0xc727('0xf'),JSON['stringify'](_0x51264a));if(_0x51264a[_0xc727('0x10')]){if(_0x51264a[_0xc727('0x10')]['code']===0x1f4){logger[_0xc727('0x10')](_0xc727('0xe'),_0x46b4c9,_0x51264a[_0xc727('0x10')]['message']);return _0x329334(_0x51264a[_0xc727('0x10')][_0xc727('0x11')]);}logger[_0xc727('0x10')](_0xc727('0xe'),_0x46b4c9,_0x51264a[_0xc727('0x10')][_0xc727('0x11')]);return _0x568e34(_0x51264a[_0xc727('0x10')]['message']);}else{logger[_0xc727('0x12')](_0xc727('0xe'),_0x46b4c9,_0xc727('0xf'));_0x568e34(_0x51264a[_0xc727('0x13')][_0xc727('0x11')]);}})['catch'](function(_0x20faa9){logger[_0xc727('0x10')]('ChatWebsite,\x20%s,\x20%s',_0x46b4c9,_0x20faa9);_0x329334(_0x20faa9);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index 24ce5c8..5fb3051 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 _0xc45a=['./chatWebsite.events','save','remove','update','emit','removeListener','register','length','chatWebsite:'];(function(_0x591f5b,_0x3d9a97){var _0x131b79=function(_0xa96fc3){while(--_0xa96fc3){_0x591f5b['push'](_0x591f5b['shift']());}};_0x131b79(++_0x3d9a97);}(_0xc45a,0x168));var _0xac45=function(_0x543692,_0x4553d2){_0x543692=_0x543692-0x0;var _0x5543a1=_0xc45a[_0x543692];return _0x5543a1;};'use strict';var ChatWebsiteEvents=require(_0xac45('0x0'));var events=[_0xac45('0x1'),_0xac45('0x2'),_0xac45('0x3')];function createListener(_0x463c2c,_0x558532){return function(_0x26f293){_0x558532[_0xac45('0x4')](_0x463c2c,_0x26f293);};}function removeListener(_0x330356,_0xa2303d){return function(){ChatWebsiteEvents[_0xac45('0x5')](_0x330356,_0xa2303d);};}exports[_0xac45('0x6')]=function(_0x412991){for(var _0x5a6f4b=0x0,_0x13f1e7=events[_0xac45('0x7')];_0x5a6f4b<_0x13f1e7;_0x5a6f4b++){var _0x61a366=events[_0x5a6f4b];var _0x5d68eb=createListener(_0xac45('0x8')+_0x61a366,_0x412991);ChatWebsiteEvents['on'](_0x61a366,_0x5d68eb);}}; \ No newline at end of file +var _0xc72a=['emit','removeListener','register','chatWebsite:','./chatWebsite.events','update'];(function(_0x2d37a0,_0x3f0fed){var _0x5eb8d8=function(_0x3e3fae){while(--_0x3e3fae){_0x2d37a0['push'](_0x2d37a0['shift']());}};_0x5eb8d8(++_0x3f0fed);}(_0xc72a,0xa0));var _0xac72=function(_0x5ebf44,_0x4e543e){_0x5ebf44=_0x5ebf44-0x0;var _0x2fef12=_0xc72a[_0x5ebf44];return _0x2fef12;};'use strict';var ChatWebsiteEvents=require(_0xac72('0x0'));var events=['save','remove',_0xac72('0x1')];function createListener(_0x70d861,_0x40880c){return function(_0x420d14){_0x40880c[_0xac72('0x2')](_0x70d861,_0x420d14);};}function removeListener(_0x4c6d46,_0x39f57e){return function(){ChatWebsiteEvents[_0xac72('0x3')](_0x4c6d46,_0x39f57e);};}exports[_0xac72('0x4')]=function(_0x554f90){for(var _0x586b26=0x0,_0x439b6c=events['length'];_0x586b26<_0x439b6c;_0x586b26++){var _0x5c503d=events[_0x586b26];var _0x35eda8=createListener(_0xac72('0x5')+_0x5c503d,_0x554f90);ChatWebsiteEvents['on'](_0x5c503d,_0x35eda8);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index c5a4f87..7513834 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 _0x99cb=['getFields','getOfflineMessages','/:id/users','getAgents','post','create','addDisposition','diskStorage','join','root','server/files/images/logos/','format','%s-%s','now','originalname','file','addLogo','server/files/images/avatars/','addAvatar','single','addCustomerAvatar','addSystemAvatar','/:id/notify','notify','server/files','attachments','replace','/:id/offline','offline','addInteraction','addProactiveActions','put','update','delete','destroy','removeAnswers','removeAgents','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','index','get','/describe','describe','/:id','isAuthenticated','show','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/logo','/:id/avatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','/:id/interactions','getInteractions','getSnippet','/:id/applications','/:id/proactive_actions','getProactiveActions'];(function(_0x2acbb3,_0x29e1b4){var _0x5c0cc7=function(_0x48c6a5){while(--_0x48c6a5){_0x2acbb3['push'](_0x2acbb3['shift']());}};_0x5c0cc7(++_0x29e1b4);}(_0x99cb,0x136));var _0xb99c=function(_0x130c6b,_0x132646){_0x130c6b=_0x130c6b-0x0;var _0x479a38=_0x99cb[_0x130c6b];return _0x479a38;};'use strict';var multer=require(_0xb99c('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xb99c('0x1'));var express=require(_0xb99c('0x2'));var router=express[_0xb99c('0x3')]();var fs_extra=require(_0xb99c('0x4'));var auth=require(_0xb99c('0x5'));var interaction=require(_0xb99c('0x6'));var config=require(_0xb99c('0x7'));var controller=require(_0xb99c('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xb99c('0x9')]);router[_0xb99c('0xa')](_0xb99c('0xb'),auth['isAuthenticated'](),controller[_0xb99c('0xc')]);router[_0xb99c('0xa')](_0xb99c('0xd'),auth[_0xb99c('0xe')](),controller[_0xb99c('0xf')]);router[_0xb99c('0xa')](_0xb99c('0x10'),auth[_0xb99c('0xe')](),controller['getDispositions']);router['get'](_0xb99c('0x11'),auth['isAuthenticated'](),controller[_0xb99c('0x12')]);router[_0xb99c('0xa')](_0xb99c('0x13'),controller['getLogo']);router[_0xb99c('0xa')](_0xb99c('0x14'),controller['getAvatar']);router[_0xb99c('0xa')](_0xb99c('0x15'),controller[_0xb99c('0x16')]);router[_0xb99c('0xa')](_0xb99c('0x17'),controller['getSystemAvatar']);router[_0xb99c('0xa')](_0xb99c('0x18'),auth[_0xb99c('0xe')](),controller[_0xb99c('0x19')]);router[_0xb99c('0xa')]('/:id/snippet',controller[_0xb99c('0x1a')]);router[_0xb99c('0xa')](_0xb99c('0x1b'),auth[_0xb99c('0xe')](),controller['getApplications']);router[_0xb99c('0xa')](_0xb99c('0x1c'),auth[_0xb99c('0xe')](),controller[_0xb99c('0x1d')]);router['get']('/:id/fields',controller[_0xb99c('0x1e')]);router[_0xb99c('0xa')]('/:id/offline_messages',auth[_0xb99c('0xe')](),controller[_0xb99c('0x1f')]);router[_0xb99c('0xa')](_0xb99c('0x20'),auth[_0xb99c('0xe')](),controller[_0xb99c('0x21')]);router[_0xb99c('0x22')]('/',auth['isAuthenticated'](),controller[_0xb99c('0x23')]);router[_0xb99c('0x22')](_0xb99c('0x10'),auth[_0xb99c('0xe')](),controller[_0xb99c('0x24')]);router[_0xb99c('0x22')](_0xb99c('0x11'),auth[_0xb99c('0xe')](),controller['addAnswer']);var upload=multer({'storage':multer[_0xb99c('0x25')]({'destination':function(_0x53cf2a,_0x417090,_0x3bf385){_0x3bf385(null,path[_0xb99c('0x26')](config[_0xb99c('0x27')],_0xb99c('0x28')));},'filename':function(_0x4bad68,_0x2a8087,_0x51412b){_0x51412b(null,util[_0xb99c('0x29')](_0xb99c('0x2a'),Date[_0xb99c('0x2b')](),_0x2a8087[_0xb99c('0x2c')]));}})});router['post'](_0xb99c('0x13'),upload['single'](_0xb99c('0x2d')),controller[_0xb99c('0x2e')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x4fb3c0,_0x3dd487,_0x1a2009){_0x1a2009(null,path['join'](config[_0xb99c('0x27')],_0xb99c('0x2f')));},'filename':function(_0x4d916f,_0x4ef2a6,_0x240209){_0x240209(null,util['format'](_0xb99c('0x2a'),Date[_0xb99c('0x2b')](),_0x4ef2a6[_0xb99c('0x2c')]));}})});router[_0xb99c('0x22')]('/:id/avatar',upload['single'](_0xb99c('0x2d')),controller[_0xb99c('0x30')]);var upload=multer({'storage':multer[_0xb99c('0x25')]({'destination':function(_0x382532,_0x58840b,_0x25a7b4){_0x25a7b4(null,path[_0xb99c('0x26')](config['root'],_0xb99c('0x2f')));},'filename':function(_0x4364d8,_0x3d7ebc,_0x209e99){_0x209e99(null,util['format']('%s-%s',Date[_0xb99c('0x2b')](),_0x3d7ebc[_0xb99c('0x2c')]));}})});router[_0xb99c('0x22')](_0xb99c('0x15'),upload[_0xb99c('0x31')]('file'),controller[_0xb99c('0x32')]);var upload=multer({'storage':multer[_0xb99c('0x25')]({'destination':function(_0x24eaf8,_0x15ceea,_0xa2bcd2){_0xa2bcd2(null,path[_0xb99c('0x26')](config[_0xb99c('0x27')],_0xb99c('0x2f')));},'filename':function(_0x261843,_0x3b827b,_0x4bdedc){_0x4bdedc(null,util['format'](_0xb99c('0x2a'),Date[_0xb99c('0x2b')](),_0x3b827b[_0xb99c('0x2c')]));}})});router['post'](_0xb99c('0x17'),upload[_0xb99c('0x31')](_0xb99c('0x2d')),controller[_0xb99c('0x33')]);router['post'](_0xb99c('0x34'),controller[_0xb99c('0x35')]);const offlineUploadMulter=multer({'storage':multer[_0xb99c('0x25')]({'destination':function(_0x3413f4,_0x449b3b,_0x3371fe){const _0x3dd60c=path[_0xb99c('0x26')](config[_0xb99c('0x27')],_0xb99c('0x36'),_0xb99c('0x37'),'offline-chat');fs_extra['ensureDir'](_0x3dd60c,function(){_0x3371fe(null,_0x3dd60c);});},'filename':function(_0x131369,_0x488eda,_0xc01194){const _0xa5ba93=_0x488eda['originalname'][_0xb99c('0x38')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x12c818=path['extname'](_0xa5ba93);const _0x7f4082=Date['now']()+'-'+_0xa5ba93[_0xb99c('0x38')](_0x12c818,'')+_0x12c818;_0xc01194(null,_0x7f4082);}})});router[_0xb99c('0x22')](_0xb99c('0x39'),offlineUploadMulter['any'](),controller[_0xb99c('0x3a')]);router[_0xb99c('0x22')]('/:id/interactions',auth[_0xb99c('0xe')](),controller[_0xb99c('0x3b')]);router[_0xb99c('0x22')](_0xb99c('0x1b'),auth[_0xb99c('0xe')](),controller['addApplications']);router['post'](_0xb99c('0x1c'),auth['isAuthenticated'](),controller[_0xb99c('0x3c')]);router['post'](_0xb99c('0x20'),auth[_0xb99c('0xe')](),controller['addAgents']);router[_0xb99c('0x3d')](_0xb99c('0xd'),auth['isAuthenticated'](),controller[_0xb99c('0x3e')]);router[_0xb99c('0x3f')](_0xb99c('0xd'),auth['isAuthenticated'](),controller[_0xb99c('0x40')]);router['delete'](_0xb99c('0x10'),auth[_0xb99c('0xe')](),controller['removeDispositions']);router['delete'](_0xb99c('0x11'),auth[_0xb99c('0xe')](),controller[_0xb99c('0x41')]);router[_0xb99c('0x3f')]('/:id/users',auth[_0xb99c('0xe')](),controller[_0xb99c('0x42')]);module[_0xb99c('0x43')]=router; \ No newline at end of file +var _0x92cf=['addDisposition','diskStorage','join','server/files/images/logos/','format','now','single','root','server/files/images/avatars/','originalname','file','addAvatar','%s-%s','addSystemAvatar','/:id/notify','server/files','attachments','offline-chat','ensureDir','extname','/:id/offline','addInteraction','/:id/proactive_actions','addAgents','put','/:id','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','get','isAuthenticated','/describe','describe','show','/:id/canned_answers','getAnswers','/:id/logo','/:id/avatar','getAvatar','/:id/customer_avatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/snippet','/:id/applications','/:id/fields','getFields','getOfflineMessages','/:id/users','getAgents','post','create','/:id/dispositions'];(function(_0x64c0c6,_0x325d8a){var _0x44c6fa=function(_0x50a0c6){while(--_0x50a0c6){_0x64c0c6['push'](_0x64c0c6['shift']());}};_0x44c6fa(++_0x325d8a);}(_0x92cf,0x1a7));var _0xf92c=function(_0x324189,_0x202ac1){_0x324189=_0x324189-0x0;var _0x495eee=_0x92cf[_0x324189];return _0x495eee;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xf92c('0x0'));var express=require('express');var router=express[_0xf92c('0x1')]();var fs_extra=require(_0xf92c('0x2'));var auth=require(_0xf92c('0x3'));var interaction=require(_0xf92c('0x4'));var config=require(_0xf92c('0x5'));var controller=require(_0xf92c('0x6'));router[_0xf92c('0x7')]('/',auth[_0xf92c('0x8')](),controller['index']);router['get'](_0xf92c('0x9'),auth[_0xf92c('0x8')](),controller[_0xf92c('0xa')]);router[_0xf92c('0x7')]('/:id',auth[_0xf92c('0x8')](),controller[_0xf92c('0xb')]);router[_0xf92c('0x7')]('/:id/dispositions',auth['isAuthenticated'](),controller['getDispositions']);router['get'](_0xf92c('0xc'),auth[_0xf92c('0x8')](),controller[_0xf92c('0xd')]);router[_0xf92c('0x7')](_0xf92c('0xe'),controller['getLogo']);router[_0xf92c('0x7')](_0xf92c('0xf'),controller[_0xf92c('0x10')]);router[_0xf92c('0x7')](_0xf92c('0x11'),controller['getCustomerAvatar']);router['get'](_0xf92c('0x12'),controller[_0xf92c('0x13')]);router[_0xf92c('0x7')](_0xf92c('0x14'),auth[_0xf92c('0x8')](),controller[_0xf92c('0x15')]);router[_0xf92c('0x7')](_0xf92c('0x16'),controller['getSnippet']);router[_0xf92c('0x7')](_0xf92c('0x17'),auth[_0xf92c('0x8')](),controller['getApplications']);router[_0xf92c('0x7')]('/:id/proactive_actions',auth[_0xf92c('0x8')](),controller['getProactiveActions']);router['get'](_0xf92c('0x18'),controller[_0xf92c('0x19')]);router[_0xf92c('0x7')]('/:id/offline_messages',auth['isAuthenticated'](),controller[_0xf92c('0x1a')]);router[_0xf92c('0x7')](_0xf92c('0x1b'),auth[_0xf92c('0x8')](),controller[_0xf92c('0x1c')]);router[_0xf92c('0x1d')]('/',auth[_0xf92c('0x8')](),controller[_0xf92c('0x1e')]);router[_0xf92c('0x1d')](_0xf92c('0x1f'),auth[_0xf92c('0x8')](),controller[_0xf92c('0x20')]);router['post'](_0xf92c('0xc'),auth[_0xf92c('0x8')](),controller['addAnswer']);var upload=multer({'storage':multer[_0xf92c('0x21')]({'destination':function(_0x474d2a,_0x58c770,_0x5abeeb){_0x5abeeb(null,path[_0xf92c('0x22')](config['root'],_0xf92c('0x23')));},'filename':function(_0x1b8b1f,_0x387704,_0xff3513){_0xff3513(null,util[_0xf92c('0x24')]('%s-%s',Date[_0xf92c('0x25')](),_0x387704['originalname']));}})});router[_0xf92c('0x1d')]('/:id/logo',upload[_0xf92c('0x26')]('file'),controller['addLogo']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x41b20a,_0x27662a,_0x6e6037){_0x6e6037(null,path[_0xf92c('0x22')](config[_0xf92c('0x27')],_0xf92c('0x28')));},'filename':function(_0xa29500,_0xd47339,_0x1f1c5f){_0x1f1c5f(null,util[_0xf92c('0x24')]('%s-%s',Date[_0xf92c('0x25')](),_0xd47339[_0xf92c('0x29')]));}})});router[_0xf92c('0x1d')](_0xf92c('0xf'),upload[_0xf92c('0x26')](_0xf92c('0x2a')),controller[_0xf92c('0x2b')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x37687b,_0x5cc16c,_0x5c5990){_0x5c5990(null,path[_0xf92c('0x22')](config[_0xf92c('0x27')],_0xf92c('0x28')));},'filename':function(_0x12f321,_0x45c597,_0x2b790f){_0x2b790f(null,util['format'](_0xf92c('0x2c'),Date[_0xf92c('0x25')](),_0x45c597[_0xf92c('0x29')]));}})});router[_0xf92c('0x1d')]('/:id/customer_avatar',upload[_0xf92c('0x26')]('file'),controller['addCustomerAvatar']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x22319e,_0x2d0e25,_0x1e7d78){_0x1e7d78(null,path[_0xf92c('0x22')](config[_0xf92c('0x27')],_0xf92c('0x28')));},'filename':function(_0x1b9137,_0x1d870c,_0x3c80c7){_0x3c80c7(null,util['format'](_0xf92c('0x2c'),Date[_0xf92c('0x25')](),_0x1d870c[_0xf92c('0x29')]));}})});router[_0xf92c('0x1d')](_0xf92c('0x12'),upload['single'](_0xf92c('0x2a')),controller[_0xf92c('0x2d')]);router[_0xf92c('0x1d')](_0xf92c('0x2e'),controller['notify']);const offlineUploadMulter=multer({'storage':multer[_0xf92c('0x21')]({'destination':function(_0x30f527,_0x33aef1,_0x5d54dc){const _0x40a8b0=path[_0xf92c('0x22')](config[_0xf92c('0x27')],_0xf92c('0x2f'),_0xf92c('0x30'),_0xf92c('0x31'));fs_extra[_0xf92c('0x32')](_0x40a8b0,function(){_0x5d54dc(null,_0x40a8b0);});},'filename':function(_0x107cf1,_0x426bc1,_0x217794){const _0x1361ed=_0x426bc1[_0xf92c('0x29')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x527655=path[_0xf92c('0x33')](_0x1361ed);const _0x1218dc=Date[_0xf92c('0x25')]()+'-'+_0x1361ed['replace'](_0x527655,'')+_0x527655;_0x217794(null,_0x1218dc);}})});router[_0xf92c('0x1d')](_0xf92c('0x34'),offlineUploadMulter['any'](),controller['offline']);router[_0xf92c('0x1d')](_0xf92c('0x14'),auth[_0xf92c('0x8')](),controller[_0xf92c('0x35')]);router[_0xf92c('0x1d')](_0xf92c('0x17'),auth[_0xf92c('0x8')](),controller['addApplications']);router[_0xf92c('0x1d')](_0xf92c('0x36'),auth[_0xf92c('0x8')](),controller['addProactiveActions']);router['post'](_0xf92c('0x1b'),auth['isAuthenticated'](),controller[_0xf92c('0x37')]);router[_0xf92c('0x38')](_0xf92c('0x39'),auth[_0xf92c('0x8')](),controller[_0xf92c('0x3a')]);router['delete']('/:id',auth[_0xf92c('0x8')](),controller[_0xf92c('0x3b')]);router[_0xf92c('0x3c')](_0xf92c('0x1f'),auth[_0xf92c('0x8')](),controller[_0xf92c('0x3d')]);router[_0xf92c('0x3c')](_0xf92c('0xc'),auth['isAuthenticated'](),controller[_0xf92c('0x3e')]);router[_0xf92c('0x3c')](_0xf92c('0x1b'),auth['isAuthenticated'](),controller[_0xf92c('0x3f')]);module[_0xf92c('0x40')]=router; \ No newline at end of file diff --git a/server/api/client-side-logs.js b/server/api/client-side-logs.js index 7aadfc7..2cfb850 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 _0x97ae=['Router','env','production','get','client-side-logger','Client-Side\x20logger\x20not\x20found!','expressEndpoint','use','isAuthenticated','exports','beaver-logger/server','../components/auth/service','../config/environment'];(function(_0x1f6840,_0x19accf){var _0x4b1dc0=function(_0x2f2db1){while(--_0x2f2db1){_0x1f6840['push'](_0x1f6840['shift']());}};_0x4b1dc0(++_0x19accf);}(_0x97ae,0x142));var _0xe97a=function(_0x3140b8,_0x2eb12c){_0x3140b8=_0x3140b8-0x0;var _0x322299=_0x97ae[_0x3140b8];return _0x322299;};var beaverLogger=require(_0xe97a('0x0'));var express=require('express');var auth=require(_0xe97a('0x1'));var config=require(_0xe97a('0x2'));var router=express[_0xe97a('0x3')]();var isProduction=config[_0xe97a('0x4')]===_0xe97a('0x5')||![];function clientSideLogs(_0x56967f,_0x2b47e0,_0x50f283){var _0x4ae3e5=_0x56967f['app'][_0xe97a('0x6')](_0xe97a('0x7'));if(!_0x4ae3e5){throw new Error(_0xe97a('0x8'));}return beaverLogger[_0xe97a('0x9')]({'uri':'/client-logs','logger':_0x4ae3e5,'enableCors':!isProduction})(_0x56967f,_0x2b47e0,_0x50f283);}router[_0xe97a('0xa')](auth[_0xe97a('0xb')](),clientSideLogs);module[_0xe97a('0xc')]=router; \ No newline at end of file +var _0x01da=['expressEndpoint','/client-logs','exports','beaver-logger/server','../components/auth/service','../config/environment','Router','app','get','client-side-logger','Client-Side\x20logger\x20not\x20found!'];(function(_0x84ed63,_0x2c32a8){var _0xd81c5e=function(_0x4d13cb){while(--_0x4d13cb){_0x84ed63['push'](_0x84ed63['shift']());}};_0xd81c5e(++_0x2c32a8);}(_0x01da,0x100));var _0xa01d=function(_0x2098d1,_0x2da932){_0x2098d1=_0x2098d1-0x0;var _0x3d3d8c=_0x01da[_0x2098d1];return _0x3d3d8c;};var beaverLogger=require(_0xa01d('0x0'));var express=require('express');var auth=require(_0xa01d('0x1'));var config=require(_0xa01d('0x2'));var router=express[_0xa01d('0x3')]();var isProduction=config['env']==='production'||![];function clientSideLogs(_0x19d52e,_0x7b98a,_0x3a0ac8){var _0x5c2371=_0x19d52e[_0xa01d('0x4')][_0xa01d('0x5')](_0xa01d('0x6'));if(!_0x5c2371){throw new Error(_0xa01d('0x7'));}return beaverLogger[_0xa01d('0x8')]({'uri':_0xa01d('0x9'),'logger':_0x5c2371,'enableCors':!isProduction})(_0x19d52e,_0x7b98a,_0x3a0ac8);}router['use'](auth['isAuthenticated'](),clientSideLogs);module[_0xa01d('0xa')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index dd2d661..549d822 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 _0xed17=['MicrosoftAzure\x20=>\x20client_secret','TEXT','MicrosoftAzure\x20=>\x20access_token','MicrosoftAzure\x20=>\x20refresh_token','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','sequelize','exports','AmazonAWS','Google','MicrosoftAzure','ENUM','MicrosoftAzure\x20=>\x20client_id','STRING','MicrosoftAzure\x20=>\x20tenant'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0xed17,0xc9));var _0x7ed1=function(_0x44b7d6,_0x4a3f3f){_0x44b7d6=_0x44b7d6-0x0;var _0x5346f0=_0xed17[_0x44b7d6];return _0x5346f0;};'use strict';var Sequelize=require(_0x7ed1('0x0'));module[_0x7ed1('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize['ENUM'](_0x7ed1('0x2'),_0x7ed1('0x3'),_0x7ed1('0x4')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0x7ed1('0x5')]('Outlook365','Dynamics365')},'data1':{'type':Sequelize['STRING'],'comment':_0x7ed1('0x6')},'data2':{'type':Sequelize[_0x7ed1('0x7')],'comment':_0x7ed1('0x8')},'data3':{'type':Sequelize[_0x7ed1('0x7')],'comment':_0x7ed1('0x9')},'data4':{'type':Sequelize[_0x7ed1('0x7')],'comment':'MicrosoftAzure\x20=>\x20redirect_uri'},'data5':{'type':Sequelize[_0x7ed1('0xa')],'comment':_0x7ed1('0xb')},'data6':{'type':Sequelize[_0x7ed1('0xa')],'comment':_0x7ed1('0xc')},'data7':{'type':Sequelize[_0x7ed1('0xa')],'comment':_0x7ed1('0xd')}}; \ No newline at end of file +var _0x4627=['MicrosoftAzure','Outlook365','Dynamics365','MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20client_secret','MicrosoftAzure\x20=>\x20redirect_uri','TEXT','MicrosoftAzure\x20=>\x20access_token','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','sequelize','exports','STRING','ENUM','Google'];(function(_0x327f3f,_0x461d88){var _0x39eb5e=function(_0x5851c1){while(--_0x5851c1){_0x327f3f['push'](_0x327f3f['shift']());}};_0x39eb5e(++_0x461d88);}(_0x4627,0xaf));var _0x7462=function(_0x49d41c,_0x2bdc35){_0x49d41c=_0x49d41c-0x0;var _0xb64c5f=_0x4627[_0x49d41c];return _0xb64c5f;};'use strict';var Sequelize=require(_0x7462('0x0'));module[_0x7462('0x1')]={'name':{'type':Sequelize[_0x7462('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x7462('0x3')]('AmazonAWS',_0x7462('0x4'),_0x7462('0x5')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0x7462('0x6'),_0x7462('0x7'))},'data1':{'type':Sequelize[_0x7462('0x2')],'comment':_0x7462('0x8')},'data2':{'type':Sequelize[_0x7462('0x2')],'comment':_0x7462('0x9')},'data3':{'type':Sequelize[_0x7462('0x2')],'comment':_0x7462('0xa')},'data4':{'type':Sequelize[_0x7462('0x2')],'comment':_0x7462('0xb')},'data5':{'type':Sequelize[_0x7462('0xc')],'comment':_0x7462('0xd')},'data6':{'type':Sequelize[_0x7462('0xc')],'comment':'MicrosoftAzure\x20=>\x20refresh_token'},'data7':{'type':Sequelize[_0x7462('0xc')],'comment':_0x7462('0xe')}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index 2a05b57..161b4eb 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 _0xb5c1=['fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','findAll','rows','MicrosoftAzure','data3','catch','show','params','options','find','service','create','Name\x20parameter\x20not\x20specified','body','Service\x20parameter\x20not\x20specified','includes','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','join','encryptString','oauth2MicrosoftAuthorize','findOne','user','oauth2MicrosoftCallback','get','state','Invalid\x20state\x20parameter','from','base64','toString','ascii','parse','id_token','oauth2Claims','Unable\x20to\x20validate\x20id_token','del','getOauth2MicrosoftAccessToken','code','data5','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','../../components/encryptor','../../config/environment','../../config/logger','api','../../mysqldb','./cloudProvider.oauth','redis','defaults','localhost','socket.io-emitter','status','end','undefined','limit','count','offset','set','Content-Range','json','update','then','destroy','sendStatus','error','stack','name','send','index','map','CloudProvider','rawAttributes'];(function(_0x58dc25,_0x49b9d5){var _0x21b0a7=function(_0x38a186){while(--_0x38a186){_0x58dc25['push'](_0x58dc25['shift']());}};_0x21b0a7(++_0x49b9d5);}(_0xb5c1,0x174));var _0x1b5c=function(_0x1875fb,_0x193300){_0x1875fb=_0x1875fb-0x0;var _0x354d71=_0xb5c1[_0x1875fb];return _0x354d71;};'use strict';var _=require(_0x1b5c('0x0'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var encryptor=require(_0x1b5c('0x1'));var config=require(_0x1b5c('0x2'));var logger=require(_0x1b5c('0x3'))(_0x1b5c('0x4'));var db=require(_0x1b5c('0x5'))['db'];var oauth=require(_0x1b5c('0x6'));config[_0x1b5c('0x7')]=_[_0x1b5c('0x8')](config['redis'],{'host':_0x1b5c('0x9'),'port':0x18eb});var socket=require(_0x1b5c('0xa'))(new Redis(config[_0x1b5c('0x7')]));var redis=new Redis(config['redis']);function respondWithStatusCode(_0x55f34a,_0x45a6db){_0x45a6db=_0x45a6db||0xcc;return function(_0x1d40f8){if(_0x1d40f8){return _0x55f34a['sendStatus'](_0x45a6db);}return _0x55f34a[_0x1b5c('0xb')](_0x45a6db)[_0x1b5c('0xc')]();};}function respondWithResult(_0x4bc2d1,_0x3574f8){_0x3574f8=_0x3574f8||0xc8;return function(_0x4ab273){if(_0x4ab273){return _0x4bc2d1[_0x1b5c('0xb')](_0x3574f8)['json'](_0x4ab273);}};}function respondWithFilteredResult(_0x23894d,_0x29e78f){return function(_0x35e781){if(_0x35e781){var _0x19dc3c=typeof _0x29e78f['offset']===_0x1b5c('0xd')&&typeof _0x29e78f[_0x1b5c('0xe')]===_0x1b5c('0xd');var _0x59aefe=_0x35e781[_0x1b5c('0xf')];var _0xc34f6a=_0x19dc3c?0x0:_0x29e78f[_0x1b5c('0x10')];var _0x10ccbb=_0x19dc3c?_0x35e781['count']:_0x29e78f[_0x1b5c('0x10')]+_0x29e78f[_0x1b5c('0xe')];var _0x35c641;if(_0x10ccbb>=_0x59aefe){_0x10ccbb=_0x59aefe;_0x35c641=0xc8;}else{_0x35c641=0xce;}_0x23894d[_0x1b5c('0xb')](_0x35c641);return _0x23894d[_0x1b5c('0x11')](_0x1b5c('0x12'),_0xc34f6a+'-'+_0x10ccbb+'/'+_0x59aefe)[_0x1b5c('0x13')](_0x35e781);}return null;};}function saveUpdates(_0x4f36fc){return function(_0x5945a5){if(_0x5945a5){return _0x5945a5[_0x1b5c('0x14')](_0x4f36fc)[_0x1b5c('0x15')](function(_0x485d7a){return _0x485d7a;});}return null;};}function removeEntity(_0x2bab90){return function(_0x222824){if(_0x222824){return _0x222824[_0x1b5c('0x16')]()[_0x1b5c('0x15')](function(){_0x2bab90[_0x1b5c('0xb')](0xcc)[_0x1b5c('0xc')]();});}};}function handleEntityNotFound(_0x3777d6){return function(_0x4edb80){if(!_0x4edb80){_0x3777d6[_0x1b5c('0x17')](0x194);}return _0x4edb80;};}function handleError(_0xf458a8,_0x39038e){_0x39038e=_0x39038e||0x1f4;return function(_0x5a1a1e){logger[_0x1b5c('0x18')](_0x5a1a1e[_0x1b5c('0x19')]);if(_0x5a1a1e[_0x1b5c('0x1a')]){delete _0x5a1a1e['name'];}_0xf458a8[_0x1b5c('0xb')](_0x39038e)[_0x1b5c('0x1b')](_0x5a1a1e);};}function maskClientSecret(_0x2c09df){return _['padEnd'](_0x2c09df['slice'](0x0,0x3),0x14,'*');}exports[_0x1b5c('0x1c')]=function(_0x48aefe,_0x132d0b){var _0x2f8ab0={},_0x425d3b={},_0x36d622={'count':0x0,'rows':[]};var _0xa14e3=_[_0x1b5c('0x1d')](db[_0x1b5c('0x1e')][_0x1b5c('0x1f')],function(_0x45c44b){return{'name':_0x45c44b[_0x1b5c('0x20')],'type':_0x45c44b[_0x1b5c('0x21')][_0x1b5c('0x22')]};});_0x425d3b[_0x1b5c('0x23')]=_[_0x1b5c('0x1d')](_0xa14e3,'name');_0x425d3b[_0x1b5c('0x24')]=_[_0x1b5c('0x25')](_0x48aefe[_0x1b5c('0x24')]);_0x425d3b[_0x1b5c('0x26')]=_[_0x1b5c('0x27')](_0x425d3b[_0x1b5c('0x23')],_0x425d3b[_0x1b5c('0x24')]);_0x2f8ab0[_0x1b5c('0x28')]=_['intersection'](_0x425d3b[_0x1b5c('0x23')],qs[_0x1b5c('0x29')](_0x48aefe[_0x1b5c('0x24')][_0x1b5c('0x29')]));_0x2f8ab0['attributes']=_0x2f8ab0[_0x1b5c('0x28')][_0x1b5c('0x2a')]?_0x2f8ab0[_0x1b5c('0x28')]:_0x425d3b[_0x1b5c('0x23')];if(!_0x48aefe['query'][_0x1b5c('0x2b')](_0x1b5c('0x2c'))){_0x2f8ab0[_0x1b5c('0xe')]=qs[_0x1b5c('0xe')](_0x48aefe['query'][_0x1b5c('0xe')]);_0x2f8ab0[_0x1b5c('0x10')]=qs['offset'](_0x48aefe[_0x1b5c('0x24')][_0x1b5c('0x10')]);}_0x2f8ab0[_0x1b5c('0x2d')]=qs[_0x1b5c('0x2e')](_0x48aefe['query']['sort']);_0x2f8ab0[_0x1b5c('0x2f')]=qs[_0x1b5c('0x26')](_[_0x1b5c('0x30')](_0x48aefe[_0x1b5c('0x24')],_0x425d3b['filters']),_0xa14e3);if(_0x48aefe[_0x1b5c('0x24')]['filter']){_0x2f8ab0['where']=_[_0x1b5c('0x31')](_0x2f8ab0[_0x1b5c('0x2f')],{'$or':_[_0x1b5c('0x1d')](_0xa14e3,function(_0x58e0dd){if(_0x58e0dd[_0x1b5c('0x21')]!==_0x1b5c('0x32')){var _0x55763d={};_0x55763d[_0x58e0dd[_0x1b5c('0x1a')]]={'$like':'%'+_0x48aefe[_0x1b5c('0x24')][_0x1b5c('0x33')]+'%'};return _0x55763d;}})});}_0x2f8ab0=_[_0x1b5c('0x31')]({},_0x2f8ab0,_0x48aefe['options']);var _0x26ba8e={'where':_0x2f8ab0['where']};return db[_0x1b5c('0x1e')][_0x1b5c('0xf')](_0x26ba8e)[_0x1b5c('0x15')](function(_0x16a5cb){_0x36d622[_0x1b5c('0xf')]=_0x16a5cb;if(_0x48aefe['query'][_0x1b5c('0x34')]){_0x2f8ab0[_0x1b5c('0x35')]=[{'all':!![]}];}return db[_0x1b5c('0x1e')][_0x1b5c('0x36')](_0x2f8ab0);})['then'](function(_0x3a1d21){_0x36d622[_0x1b5c('0x37')]=_[_0x1b5c('0x1d')](_0x3a1d21,function(_0x51c286){if(_0x51c286['service']===_0x1b5c('0x38')){var _0x3cd1a8=encryptor['decryptString'](_0x51c286['data3']);_0x51c286[_0x1b5c('0x39')]=maskClientSecret(_0x3cd1a8);}return _0x51c286;});return _0x36d622;})[_0x1b5c('0x15')](respondWithFilteredResult(_0x132d0b,_0x2f8ab0))[_0x1b5c('0x3a')](handleError(_0x132d0b,null));};exports[_0x1b5c('0x3b')]=function(_0x4a9033,_0xed8195){var _0x5656b3={'raw':!![],'where':{'id':_0x4a9033[_0x1b5c('0x3c')]['id']}},_0x3cd6bc={};_0x3cd6bc[_0x1b5c('0x23')]=_[_0x1b5c('0x25')](db['CloudProvider']['rawAttributes']);_0x3cd6bc[_0x1b5c('0x24')]=_['keys'](_0x4a9033[_0x1b5c('0x24')]);_0x3cd6bc[_0x1b5c('0x26')]=_[_0x1b5c('0x27')](_0x3cd6bc[_0x1b5c('0x23')],_0x3cd6bc[_0x1b5c('0x24')]);_0x5656b3['attributes']=_[_0x1b5c('0x27')](_0x3cd6bc[_0x1b5c('0x23')],qs[_0x1b5c('0x29')](_0x4a9033[_0x1b5c('0x24')][_0x1b5c('0x29')]));_0x5656b3['attributes']=_0x5656b3[_0x1b5c('0x28')]['length']?_0x5656b3[_0x1b5c('0x28')]:_0x3cd6bc[_0x1b5c('0x23')];if(_0x4a9033[_0x1b5c('0x24')][_0x1b5c('0x34')]){_0x5656b3['include']=[{'all':!![]}];}_0x5656b3=_[_0x1b5c('0x31')]({},_0x5656b3,_0x4a9033[_0x1b5c('0x3d')]);return db[_0x1b5c('0x1e')][_0x1b5c('0x3e')](_0x5656b3)['then'](handleEntityNotFound(_0xed8195,null))[_0x1b5c('0x15')](function(_0xdce4fa){if(_0xdce4fa[_0x1b5c('0x3f')]===_0x1b5c('0x38')){var _0x265d56=encryptor['decryptString'](_0xdce4fa['data3']);_0xdce4fa[_0x1b5c('0x39')]=maskClientSecret(_0x265d56);}return _0xdce4fa;})[_0x1b5c('0x15')](respondWithResult(_0xed8195,null))[_0x1b5c('0x3a')](handleError(_0xed8195,null));};exports[_0x1b5c('0x40')]=function(_0x201858,_0x10a0e){if(!_0x201858['body'][_0x1b5c('0x1a')])throw new Error(_0x1b5c('0x41'));if(!_0x201858[_0x1b5c('0x42')][_0x1b5c('0x3f')])throw new Error(_0x1b5c('0x43'));var _0x5ef690=db[_0x1b5c('0x1e')]['rawAttributes'][_0x1b5c('0x3f')]['values'];if(!_0x5ef690[_0x1b5c('0x44')](_0x201858['body'][_0x1b5c('0x3f')]))throw new Error(_0x1b5c('0x45')+_0x5ef690[_0x1b5c('0x46')](',\x20'));if(_0x201858['body']['service']===_0x1b5c('0x38')&&_0x201858['body'][_0x1b5c('0x39')]){_0x201858[_0x1b5c('0x42')]['data3']=encryptor[_0x1b5c('0x47')](_0x201858[_0x1b5c('0x42')][_0x1b5c('0x39')]);}return db['CloudProvider'][_0x1b5c('0x40')](_0x201858[_0x1b5c('0x42')],{})[_0x1b5c('0x15')](respondWithResult(_0x10a0e,0xc9))['catch'](handleError(_0x10a0e,null));};exports[_0x1b5c('0x14')]=function(_0x49d876,_0x1c818a){if(_0x49d876[_0x1b5c('0x42')]['id']){delete _0x49d876[_0x1b5c('0x42')]['id'];}return db[_0x1b5c('0x1e')][_0x1b5c('0x3e')]({'where':{'id':_0x49d876[_0x1b5c('0x3c')]['id']}})[_0x1b5c('0x15')](handleEntityNotFound(_0x1c818a,null))[_0x1b5c('0x15')](function(_0x58f4d6){if(_0x58f4d6[_0x1b5c('0x3f')]===_0x1b5c('0x38')&&_0x49d876['body']['data3']){_0x49d876[_0x1b5c('0x42')]['data3']=encryptor['encryptString'](_0x49d876[_0x1b5c('0x42')][_0x1b5c('0x39')]);}return _0x58f4d6;})[_0x1b5c('0x15')](saveUpdates(_0x49d876[_0x1b5c('0x42')],null))[_0x1b5c('0x15')](respondWithResult(_0x1c818a,null))['catch'](handleError(_0x1c818a,null));};exports[_0x1b5c('0x16')]=function(_0x42371a,_0x23f090){return db['CloudProvider']['find']({'where':{'id':_0x42371a[_0x1b5c('0x3c')]['id']}})[_0x1b5c('0x15')](handleEntityNotFound(_0x23f090,null))[_0x1b5c('0x15')](removeEntity(_0x23f090,null))[_0x1b5c('0x3a')](handleError(_0x23f090,null));};exports[_0x1b5c('0x48')]=function(_0x229886,_0x476e2a){return db[_0x1b5c('0x1e')][_0x1b5c('0x49')]({'where':{'id':_0x229886[_0x1b5c('0x3c')]['id']},'raw':!![]})['then'](function(_0x239875){if(!_0x239875)return _0x476e2a[_0x1b5c('0x17')](0x194);return{'url':oauth['generateMicrosoftAuthorizationUrl'](_0x239875,_0x229886[_0x1b5c('0x4a')]['id'])};})[_0x1b5c('0x15')](respondWithResult(_0x476e2a,null))[_0x1b5c('0x3a')](handleError(_0x476e2a,null));};exports[_0x1b5c('0x4b')]=function(_0x2960b7,_0x241f84){var _0x50280c=_0x2960b7[_0x1b5c('0x42')];var _0xc2268c;var _0x37a4f8;if(_0x50280c[_0x1b5c('0x18')])throw _0x50280c;redis[_0x1b5c('0x4c')](_0x50280c[_0x1b5c('0x4d')])['then'](function(_0xb00052){if(!_0xb00052)throw new Error(_0x1b5c('0x4e'));_0xc2268c=JSON['parse'](_0xb00052);var _0x1f568a=Buffer[_0x1b5c('0x4f')](_0x50280c[_0x1b5c('0x4d')],_0x1b5c('0x50'))[_0x1b5c('0x51')](_0x1b5c('0x52'));_0x37a4f8=JSON[_0x1b5c('0x53')](_0x1f568a);if(!oauth['isValidIdToken'](_0x50280c[_0x1b5c('0x54')],_0xc2268c[_0x1b5c('0x55')]))throw new Error(_0x1b5c('0x56'));redis[_0x1b5c('0x57')](_0x50280c[_0x1b5c('0x4d')]);return oauth[_0x1b5c('0x58')](_0x50280c[_0x1b5c('0x59')],_0xc2268c);})[_0x1b5c('0x15')](function(_0x28f9bc){_0xc2268c[_0x1b5c('0x5a')]=_0x28f9bc['access_token'];_0xc2268c[_0x1b5c('0x5b')]=_0x28f9bc[_0x1b5c('0x5c')];return db[_0x1b5c('0x1e')][_0x1b5c('0x14')]({'data5':_0xc2268c['data5'],'data6':_0xc2268c['data6']},{'where':{'id':_0xc2268c['id']}});})[_0x1b5c('0x15')](function(){oauth[_0x1b5c('0x5d')](_0xc2268c);socket[_0x1b5c('0x5e')](_0x1b5c('0x5f'),{'id':_0x37a4f8['id']});return;})[_0x1b5c('0x15')](respondWithStatusCode(_0x241f84,null))[_0x1b5c('0x3a')](function(_0x46b11b){if(_0x37a4f8){socket[_0x1b5c('0x5e')](_0x1b5c('0x60'),{'id':_0x37a4f8['id']});}if(!_0xc2268c){logger[_0x1b5c('0x18')](_0x1b5c('0x61'),_0x46b11b);return _0x241f84[_0x1b5c('0xb')](0x1f4)[_0x1b5c('0x1b')](_0x46b11b[_0x1b5c('0x62')]);}logger[_0x1b5c('0x18')](_0x1b5c('0x63'),_0xc2268c['id'],JSON[_0x1b5c('0x64')](_0x46b11b));});}; \ No newline at end of file +var _0x02ad=['count','limit','set','update','then','stack','name','send','padEnd','slice','index','map','rawAttributes','fieldName','type','model','keys','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','options','CloudProvider','includeAll','findAll','rows','service','decryptString','data3','catch','show','params','include','find','create','Name\x20parameter\x20not\x20specified','Service\x20parameter\x20not\x20specified','includes','body','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','join','encryptString','destroy','generateMicrosoftAuthorizationUrl','error','get','state','Invalid\x20state\x20parameter','parse','base64','toString','ascii','isValidIdToken','oauth2Claims','Unable\x20to\x20validate\x20id_token','getOauth2MicrosoftAccessToken','code','data5','access_token','data6','emit','microsoftAuthorization:error','Invalid\x20authentication\x20state\x20parameter','message','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','stringify','lodash','ioredis','../../components/encryptor','../../config/environment','../../config/logger','api','../../mysqldb','./cloudProvider.oauth','redis','defaults','localhost','socket.io-emitter','sendStatus','status','end','json','offset','undefined'];(function(_0x551c40,_0x1b5366){var _0x2fa10a=function(_0x3074ab){while(--_0x3074ab){_0x551c40['push'](_0x551c40['shift']());}};_0x2fa10a(++_0x1b5366);}(_0x02ad,0x162));var _0xd02a=function(_0xaa1b3e,_0x47d976){_0xaa1b3e=_0xaa1b3e-0x0;var _0x454d7d=_0x02ad[_0xaa1b3e];return _0x454d7d;};'use strict';var _=require(_0xd02a('0x0'));var Redis=require(_0xd02a('0x1'));var qs=require('../../components/parsers/qs');var encryptor=require(_0xd02a('0x2'));var config=require(_0xd02a('0x3'));var logger=require(_0xd02a('0x4'))(_0xd02a('0x5'));var db=require(_0xd02a('0x6'))['db'];var oauth=require(_0xd02a('0x7'));config[_0xd02a('0x8')]=_[_0xd02a('0x9')](config[_0xd02a('0x8')],{'host':_0xd02a('0xa'),'port':0x18eb});var socket=require(_0xd02a('0xb'))(new Redis(config[_0xd02a('0x8')]));var redis=new Redis(config['redis']);function respondWithStatusCode(_0x54e4a8,_0x283165){_0x283165=_0x283165||0xcc;return function(_0x1611e5){if(_0x1611e5){return _0x54e4a8[_0xd02a('0xc')](_0x283165);}return _0x54e4a8[_0xd02a('0xd')](_0x283165)[_0xd02a('0xe')]();};}function respondWithResult(_0x118d89,_0x391cc7){_0x391cc7=_0x391cc7||0xc8;return function(_0xc0f64){if(_0xc0f64){return _0x118d89[_0xd02a('0xd')](_0x391cc7)[_0xd02a('0xf')](_0xc0f64);}};}function respondWithFilteredResult(_0x406a4d,_0x4866cb){return function(_0x248aff){if(_0x248aff){var _0x4e4b90=typeof _0x4866cb[_0xd02a('0x10')]==='undefined'&&typeof _0x4866cb['limit']===_0xd02a('0x11');var _0x4cc2ee=_0x248aff[_0xd02a('0x12')];var _0x584cde=_0x4e4b90?0x0:_0x4866cb['offset'];var _0x32ec3b=_0x4e4b90?_0x248aff['count']:_0x4866cb[_0xd02a('0x10')]+_0x4866cb[_0xd02a('0x13')];var _0x508126;if(_0x32ec3b>=_0x4cc2ee){_0x32ec3b=_0x4cc2ee;_0x508126=0xc8;}else{_0x508126=0xce;}_0x406a4d[_0xd02a('0xd')](_0x508126);return _0x406a4d[_0xd02a('0x14')]('Content-Range',_0x584cde+'-'+_0x32ec3b+'/'+_0x4cc2ee)[_0xd02a('0xf')](_0x248aff);}return null;};}function saveUpdates(_0x1927aa){return function(_0x23d72){if(_0x23d72){return _0x23d72[_0xd02a('0x15')](_0x1927aa)['then'](function(_0x3fac1b){return _0x3fac1b;});}return null;};}function removeEntity(_0x30f0c0){return function(_0x57a081){if(_0x57a081){return _0x57a081['destroy']()[_0xd02a('0x16')](function(){_0x30f0c0['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x44a2de){return function(_0x229f09){if(!_0x229f09){_0x44a2de[_0xd02a('0xc')](0x194);}return _0x229f09;};}function handleError(_0x1f2b30,_0x295c1f){_0x295c1f=_0x295c1f||0x1f4;return function(_0x463260){logger['error'](_0x463260[_0xd02a('0x17')]);if(_0x463260['name']){delete _0x463260[_0xd02a('0x18')];}_0x1f2b30['status'](_0x295c1f)[_0xd02a('0x19')](_0x463260);};}function maskClientSecret(_0x5795c1){return _[_0xd02a('0x1a')](_0x5795c1[_0xd02a('0x1b')](0x0,0x3),0x14,'*');}exports[_0xd02a('0x1c')]=function(_0x2f2103,_0x314cdf){var _0x1acd66={},_0x2171c4={},_0x53c365={'count':0x0,'rows':[]};var _0x3b740f=_[_0xd02a('0x1d')](db['CloudProvider'][_0xd02a('0x1e')],function(_0x11d2e2){return{'name':_0x11d2e2[_0xd02a('0x1f')],'type':_0x11d2e2[_0xd02a('0x20')]['key']};});_0x2171c4[_0xd02a('0x21')]=_[_0xd02a('0x1d')](_0x3b740f,_0xd02a('0x18'));_0x2171c4['query']=_[_0xd02a('0x22')](_0x2f2103['query']);_0x2171c4['filters']=_[_0xd02a('0x23')](_0x2171c4['model'],_0x2171c4[_0xd02a('0x24')]);_0x1acd66[_0xd02a('0x25')]=_[_0xd02a('0x23')](_0x2171c4[_0xd02a('0x21')],qs[_0xd02a('0x26')](_0x2f2103[_0xd02a('0x24')]['fields']));_0x1acd66['attributes']=_0x1acd66['attributes'][_0xd02a('0x27')]?_0x1acd66['attributes']:_0x2171c4['model'];if(!_0x2f2103[_0xd02a('0x24')][_0xd02a('0x28')](_0xd02a('0x29'))){_0x1acd66[_0xd02a('0x13')]=qs[_0xd02a('0x13')](_0x2f2103[_0xd02a('0x24')][_0xd02a('0x13')]);_0x1acd66['offset']=qs['offset'](_0x2f2103[_0xd02a('0x24')]['offset']);}_0x1acd66['order']=qs[_0xd02a('0x2a')](_0x2f2103[_0xd02a('0x24')][_0xd02a('0x2a')]);_0x1acd66[_0xd02a('0x2b')]=qs[_0xd02a('0x2c')](_[_0xd02a('0x2d')](_0x2f2103[_0xd02a('0x24')],_0x2171c4[_0xd02a('0x2c')]),_0x3b740f);if(_0x2f2103[_0xd02a('0x24')][_0xd02a('0x2e')]){_0x1acd66[_0xd02a('0x2b')]=_[_0xd02a('0x2f')](_0x1acd66[_0xd02a('0x2b')],{'$or':_[_0xd02a('0x1d')](_0x3b740f,function(_0x2fb49d){if(_0x2fb49d[_0xd02a('0x20')]!=='VIRTUAL'){var _0x230cf8={};_0x230cf8[_0x2fb49d[_0xd02a('0x18')]]={'$like':'%'+_0x2f2103['query'][_0xd02a('0x2e')]+'%'};return _0x230cf8;}})});}_0x1acd66=_['merge']({},_0x1acd66,_0x2f2103[_0xd02a('0x30')]);var _0x4c0cea={'where':_0x1acd66[_0xd02a('0x2b')]};return db[_0xd02a('0x31')][_0xd02a('0x12')](_0x4c0cea)[_0xd02a('0x16')](function(_0x1b56da){_0x53c365[_0xd02a('0x12')]=_0x1b56da;if(_0x2f2103[_0xd02a('0x24')][_0xd02a('0x32')]){_0x1acd66['include']=[{'all':!![]}];}return db['CloudProvider'][_0xd02a('0x33')](_0x1acd66);})['then'](function(_0x518bee){_0x53c365[_0xd02a('0x34')]=_['map'](_0x518bee,function(_0x1194cd){if(_0x1194cd[_0xd02a('0x35')]==='MicrosoftAzure'){var _0x315079=encryptor[_0xd02a('0x36')](_0x1194cd[_0xd02a('0x37')]);_0x1194cd[_0xd02a('0x37')]=maskClientSecret(_0x315079);}return _0x1194cd;});return _0x53c365;})[_0xd02a('0x16')](respondWithFilteredResult(_0x314cdf,_0x1acd66))[_0xd02a('0x38')](handleError(_0x314cdf,null));};exports[_0xd02a('0x39')]=function(_0x4f2158,_0x41779d){var _0x3da6e3={'raw':!![],'where':{'id':_0x4f2158[_0xd02a('0x3a')]['id']}},_0x3a311d={};_0x3a311d[_0xd02a('0x21')]=_[_0xd02a('0x22')](db[_0xd02a('0x31')]['rawAttributes']);_0x3a311d[_0xd02a('0x24')]=_['keys'](_0x4f2158['query']);_0x3a311d[_0xd02a('0x2c')]=_['intersection'](_0x3a311d[_0xd02a('0x21')],_0x3a311d[_0xd02a('0x24')]);_0x3da6e3['attributes']=_[_0xd02a('0x23')](_0x3a311d['model'],qs['fields'](_0x4f2158['query'][_0xd02a('0x26')]));_0x3da6e3['attributes']=_0x3da6e3[_0xd02a('0x25')][_0xd02a('0x27')]?_0x3da6e3['attributes']:_0x3a311d[_0xd02a('0x21')];if(_0x4f2158[_0xd02a('0x24')][_0xd02a('0x32')]){_0x3da6e3[_0xd02a('0x3b')]=[{'all':!![]}];}_0x3da6e3=_[_0xd02a('0x2f')]({},_0x3da6e3,_0x4f2158['options']);return db['CloudProvider'][_0xd02a('0x3c')](_0x3da6e3)[_0xd02a('0x16')](handleEntityNotFound(_0x41779d,null))['then'](function(_0x39af85){if(_0x39af85[_0xd02a('0x35')]==='MicrosoftAzure'){var _0x18c837=encryptor[_0xd02a('0x36')](_0x39af85[_0xd02a('0x37')]);_0x39af85[_0xd02a('0x37')]=maskClientSecret(_0x18c837);}return _0x39af85;})[_0xd02a('0x16')](respondWithResult(_0x41779d,null))[_0xd02a('0x38')](handleError(_0x41779d,null));};exports[_0xd02a('0x3d')]=function(_0x131db2,_0x121c25){if(!_0x131db2['body']['name'])throw new Error(_0xd02a('0x3e'));if(!_0x131db2['body'][_0xd02a('0x35')])throw new Error(_0xd02a('0x3f'));var _0x139cc2=db[_0xd02a('0x31')][_0xd02a('0x1e')][_0xd02a('0x35')]['values'];if(!_0x139cc2[_0xd02a('0x40')](_0x131db2[_0xd02a('0x41')][_0xd02a('0x35')]))throw new Error(_0xd02a('0x42')+_0x139cc2[_0xd02a('0x43')](',\x20'));if(_0x131db2['body'][_0xd02a('0x35')]==='MicrosoftAzure'&&_0x131db2['body'][_0xd02a('0x37')]){_0x131db2[_0xd02a('0x41')]['data3']=encryptor[_0xd02a('0x44')](_0x131db2[_0xd02a('0x41')][_0xd02a('0x37')]);}return db['CloudProvider'][_0xd02a('0x3d')](_0x131db2['body'],{})[_0xd02a('0x16')](respondWithResult(_0x121c25,0xc9))[_0xd02a('0x38')](handleError(_0x121c25,null));};exports['update']=function(_0x43ffbf,_0x3a09fe){if(_0x43ffbf[_0xd02a('0x41')]['id']){delete _0x43ffbf[_0xd02a('0x41')]['id'];}return db[_0xd02a('0x31')]['find']({'where':{'id':_0x43ffbf['params']['id']}})['then'](handleEntityNotFound(_0x3a09fe,null))[_0xd02a('0x16')](function(_0x135b2b){if(_0x135b2b[_0xd02a('0x35')]==='MicrosoftAzure'&&_0x43ffbf['body'][_0xd02a('0x37')]){_0x43ffbf[_0xd02a('0x41')]['data3']=encryptor[_0xd02a('0x44')](_0x43ffbf[_0xd02a('0x41')][_0xd02a('0x37')]);}return _0x135b2b;})[_0xd02a('0x16')](saveUpdates(_0x43ffbf[_0xd02a('0x41')],null))['then'](respondWithResult(_0x3a09fe,null))['catch'](handleError(_0x3a09fe,null));};exports[_0xd02a('0x45')]=function(_0x670d5e,_0x4b3bfe){return db[_0xd02a('0x31')][_0xd02a('0x3c')]({'where':{'id':_0x670d5e['params']['id']}})[_0xd02a('0x16')](handleEntityNotFound(_0x4b3bfe,null))[_0xd02a('0x16')](removeEntity(_0x4b3bfe,null))[_0xd02a('0x38')](handleError(_0x4b3bfe,null));};exports['oauth2MicrosoftAuthorize']=function(_0x534d9c,_0x2181cb){return db[_0xd02a('0x31')]['findOne']({'where':{'id':_0x534d9c['params']['id']},'raw':!![]})['then'](function(_0x1c7db2){if(!_0x1c7db2)return _0x2181cb[_0xd02a('0xc')](0x194);return{'url':oauth[_0xd02a('0x46')](_0x1c7db2,_0x534d9c['user']['id'])};})[_0xd02a('0x16')](respondWithResult(_0x2181cb,null))[_0xd02a('0x38')](handleError(_0x2181cb,null));};exports['oauth2MicrosoftCallback']=function(_0xe9f963,_0x481446){var _0xa0d47f=_0xe9f963[_0xd02a('0x41')];var _0x4d334c;var _0x5e6fdd;if(_0xa0d47f[_0xd02a('0x47')])throw _0xa0d47f;redis[_0xd02a('0x48')](_0xa0d47f[_0xd02a('0x49')])[_0xd02a('0x16')](function(_0x38f180){if(!_0x38f180)throw new Error(_0xd02a('0x4a'));_0x4d334c=JSON[_0xd02a('0x4b')](_0x38f180);var _0x3a2b7c=Buffer['from'](_0xa0d47f[_0xd02a('0x49')],_0xd02a('0x4c'))[_0xd02a('0x4d')](_0xd02a('0x4e'));_0x5e6fdd=JSON[_0xd02a('0x4b')](_0x3a2b7c);if(!oauth[_0xd02a('0x4f')](_0xa0d47f['id_token'],_0x4d334c[_0xd02a('0x50')]))throw new Error(_0xd02a('0x51'));redis['del'](_0xa0d47f[_0xd02a('0x49')]);return oauth[_0xd02a('0x52')](_0xa0d47f[_0xd02a('0x53')],_0x4d334c);})['then'](function(_0x129790){_0x4d334c[_0xd02a('0x54')]=_0x129790[_0xd02a('0x55')];_0x4d334c[_0xd02a('0x56')]=_0x129790['refresh_token'];return db[_0xd02a('0x31')][_0xd02a('0x15')]({'data5':_0x4d334c[_0xd02a('0x54')],'data6':_0x4d334c['data6']},{'where':{'id':_0x4d334c['id']}});})[_0xd02a('0x16')](function(){oauth['startRefreshInterval'](_0x4d334c);socket[_0xd02a('0x57')]('microsoftAuthorization:success',{'id':_0x5e6fdd['id']});return;})[_0xd02a('0x16')](respondWithStatusCode(_0x481446,null))['catch'](function(_0x4a8a0c){if(_0x5e6fdd){socket['emit'](_0xd02a('0x58'),{'id':_0x5e6fdd['id']});}if(!_0x4d334c){logger['error'](_0xd02a('0x59'),_0x4a8a0c);return _0x481446[_0xd02a('0xd')](0x1f4)[_0xd02a('0x19')](_0x4a8a0c[_0xd02a('0x5a')]);}logger[_0xd02a('0x47')](_0xd02a('0x5b'),_0x4d334c['id'],JSON[_0xd02a('0x5c')](_0x4a8a0c));});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index d023ed4..54af5f3 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 _0xb3bf=['rimraf','../../config/environment','exports','CloudProvider','cloud_providers','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x158345,_0x4a28bb){var _0x154786=function(_0x21f803){while(--_0x21f803){_0x158345['push'](_0x158345['shift']());}};_0x154786(++_0x4a28bb);}(_0xb3bf,0x95));var _0xfb3b=function(_0x18f1db,_0x5f545b){_0x18f1db=_0x18f1db-0x0;var _0x481861=_0xb3bf[_0x18f1db];return _0x481861;};'use strict';var _=require('lodash');var util=require(_0xfb3b('0x0'));var logger=require(_0xfb3b('0x1'))(_0xfb3b('0x2'));var moment=require(_0xfb3b('0x3'));var BPromise=require(_0xfb3b('0x4'));var rp=require(_0xfb3b('0x5'));var fs=require('fs');var path=require(_0xfb3b('0x6'));var rimraf=require(_0xfb3b('0x7'));var config=require(_0xfb3b('0x8'));var attributes=require('./cloudProvider.attributes');module[_0xfb3b('0x9')]=function(_0x22335,_0x598803){return _0x22335['define'](_0xfb3b('0xa'),attributes,{'tableName':_0xfb3b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x31ad=['lodash','bluebird','request-promise','path','rimraf','../../config/environment','./cloudProvider.attributes','define'];(function(_0x307fc6,_0x54e619){var _0x99737b=function(_0x2abd20){while(--_0x2abd20){_0x307fc6['push'](_0x307fc6['shift']());}};_0x99737b(++_0x54e619);}(_0x31ad,0x138));var _0xd31a=function(_0x39a7a3,_0x511535){_0x39a7a3=_0x39a7a3-0x0;var _0x357ece=_0x31ad[_0x39a7a3];return _0x357ece;};'use strict';var _=require(_0xd31a('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xd31a('0x1'));var rp=require(_0xd31a('0x2'));var fs=require('fs');var path=require(_0xd31a('0x3'));var rimraf=require(_0xd31a('0x4'));var config=require(_0xd31a('0x5'));var attributes=require(_0xd31a('0x6'));module['exports']=function(_0x2a102e,_0x5408fb){return _0x2a102e[_0xd31a('0x7')]('CloudProvider',attributes,{'tableName':'cloud_providers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.oauth.js b/server/api/cloudProvider/cloudProvider.oauth.js index f03a407..e27c269 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 _0xe24e=['ioredis','request-promise','util','../../components/encryptor','../../config/environment','../../config/logger','api','../../mysqldb','redis','localhost','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','openid','profile','email','https://outlook.office365.com/IMAP.AccessAsUser.All','/authorize','map','type','Dynamics365','/.default','join','replace','{TENANT_ID}','data2','code','id_token','from','stringify','toString','base64','randomBytes','hex','response_type','redirect_uri','data4','response_mode','form_post','scope','state','prompt','login','key','value','oauth2Claims','data1','decode','payload','iss','aud','audience','nonce','isAfter','unix','exp','resolve','then','data3','CloudProvider','findOne','refresh_token','data6','decryptString','data5','access_token','catch','error','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','authorization_code','POST','intervals','bind','all','inspect','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','lodash','crypto','jsonwebtoken','moment'];(function(_0x3c64d5,_0x574d28){var _0x33ace2=function(_0x221bea){while(--_0x221bea){_0x3c64d5['push'](_0x3c64d5['shift']());}};_0x33ace2(++_0x574d28);}(_0xe24e,0x134));var _0xee24=function(_0x2b9b7f,_0x4d47df){_0x2b9b7f=_0x2b9b7f-0x0;var _0x4ed19a=_0xe24e[_0x2b9b7f];return _0x4ed19a;};'use strict';var _=require(_0xee24('0x0'));var crypto=require(_0xee24('0x1'));var jwt=require(_0xee24('0x2'));var moment=require(_0xee24('0x3'));var Redis=require(_0xee24('0x4'));var rp=require(_0xee24('0x5'));var util=require(_0xee24('0x6'));var encryptor=require(_0xee24('0x7'));var config=require(_0xee24('0x8'));var logger=require(_0xee24('0x9'))(_0xee24('0xa'));var schedule=require('../../config/schedule/cloud-provider');var db=require(_0xee24('0xb'))['db'];config['redis']=_['defaults'](config[_0xee24('0xc')],{'host':_0xee24('0xd'),'port':0x18eb});var redis=new Redis(config[_0xee24('0xc')]);var MICROSOFT_AUTH_URL=_0xee24('0xe');var AZURE_AUTH_SCOPES={'Outlook365':[_0xee24('0xf'),_0xee24('0x10'),_0xee24('0x11'),'offline_access',_0xee24('0x12'),'https://outlook.office.com/POP.AccessAsUser.All','https://outlook.office.com/SMTP.Send'],'Dynamics365':[_0xee24('0xf'),'offline_access']};var MICROSOFT_AUTH_ENDPOINT=_0xee24('0x13');var MICROSOFT_TOKEN_ENDPOINT='/token';var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x57e617){var _0x5e1206=_[_0xee24('0x14')](AZURE_AUTH_SCOPES[_0x57e617[_0xee24('0x15')]]);if(_0x57e617[_0xee24('0x15')]===_0xee24('0x16'))_0x5e1206['push'](_0x57e617['data7']+_0xee24('0x17'));return _0x5e1206[_0xee24('0x18')]('\x20');}function getAccessTokenScope(_0x490409){if(_0x490409[_0xee24('0x15')]==='Outlook365')return'https://outlook.office365.com/IMAP.AccessAsUser.All';if(_0x490409[_0xee24('0x15')]==='Dynamics365')return _0x490409['data7']+_0xee24('0x17');}function generateMicrosoftAuthorizationUrl(_0x145440,_0x21c69d){var _0x9fbe03=MICROSOFT_AUTH_URL[_0xee24('0x19')](_0xee24('0x1a'),_0x145440[_0xee24('0x1b')]);var _0x48aded=[_0xee24('0x1c'),_0xee24('0x1d')];var _0x372e8d=Buffer[_0xee24('0x1e')](JSON[_0xee24('0x1f')]({'id':_0x21c69d}))[_0xee24('0x20')](_0xee24('0x21'));var _0x47e141=crypto[_0xee24('0x22')](0x10)[_0xee24('0x20')](_0xee24('0x23'));var _0x59d611=getAuthorizationScopes(_0x145440);var _0x3daeea=[{'key':'client_id','value':_0x145440['data1']},{'key':_0xee24('0x24'),'value':encodeURIComponent(_0x48aded[_0xee24('0x18')]('\x20'))},{'key':_0xee24('0x25'),'value':_0x145440[_0xee24('0x26')]},{'key':_0xee24('0x27'),'value':_0xee24('0x28')},{'key':_0xee24('0x29'),'value':encodeURIComponent(_0x59d611)},{'key':_0xee24('0x2a'),'value':_0x372e8d},{'key':'nonce','value':_0x47e141},{'key':_0xee24('0x2b'),'value':_0xee24('0x2c')}];var _0x5a06cb=_0x9fbe03+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0xee24('0x14')](_0x3daeea,function(_0x456ace){return _0x456ace[_0xee24('0x2d')]+'='+_0x456ace[_0xee24('0x2e')];})[_0xee24('0x18')]('&');_0x145440[_0xee24('0x2f')]={'issuer':_0x9fbe03['replace']('oauth2/',''),'audience':_0x145440[_0xee24('0x30')],'state':_0x372e8d,'nonce':_0x47e141};redis['set'](_0x372e8d,JSON[_0xee24('0x1f')](_0x145440));return _0x5a06cb;}function isValidIdToken(_0x3b644f,_0x105748){try{var _0x4f5fb0=jwt[_0xee24('0x31')](_0x3b644f,{'complete':!![]});var _0x1506ba=_0x4f5fb0[_0xee24('0x32')];if(_0x1506ba[_0xee24('0x33')]!==_0x105748['issuer'])return![];if(_0x1506ba[_0xee24('0x34')]!==_0x105748[_0xee24('0x35')])return![];if(_0x1506ba[_0xee24('0x36')]!==_0x105748['nonce'])return![];if(moment()[_0xee24('0x37')](moment[_0xee24('0x38')](_0x1506ba[_0xee24('0x39')])))return![];return!![];}catch(_0x58fb27){throw _0x58fb27;}}function refreshOauth2MicrosoftAccessToken(_0x33e563){return Promise[_0xee24('0x3a')]()[_0xee24('0x3b')](function(){if(_0x33e563[_0xee24('0x3c')])return _0x33e563;return db[_0xee24('0x3d')][_0xee24('0x3e')]({'where':{'id':_0x33e563['id']},'raw':!![]});})[_0xee24('0x3b')](function(_0x39af2e){var _0x664f20={'grant_type':_0xee24('0x3f'),'refresh_token':_0x39af2e[_0xee24('0x40')],'scope':getAccessTokenScope(_0x39af2e),'redirect_uri':_0x39af2e[_0xee24('0x26')],'client_id':_0x39af2e['data1'],'client_secret':encryptor[_0xee24('0x41')](_0x39af2e['data3'])};var _0x2605c3={'method':'POST','uri':MICROSOFT_AUTH_URL[_0xee24('0x19')]('{TENANT_ID}',_0x39af2e[_0xee24('0x1b')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x664f20,'json':!![]};return rp(_0x2605c3);})[_0xee24('0x3b')](function(_0x3d0ca3){_0x33e563[_0xee24('0x42')]=_0x3d0ca3[_0xee24('0x43')];_0x33e563[_0xee24('0x40')]=_0x3d0ca3[_0xee24('0x3f')];return db[_0xee24('0x3d')]['update']({'data5':_0x33e563[_0xee24('0x42')],'data6':_0x33e563[_0xee24('0x40')]},{'where':{'id':_0x33e563['id']}});})[_0xee24('0x3b')](function(){return _0x33e563;})[_0xee24('0x44')](function(_0x1c8b61){logger[_0xee24('0x45')](_0xee24('0x46'),_0x33e563['id'],_0x1c8b61);});}function getOauth2MicrosoftAccessToken(_0x16eff1,_0x1ee13f){var _0x14b89f={'grant_type':_0xee24('0x47'),'code':_0x16eff1,'scope':getAccessTokenScope(_0x1ee13f),'redirect_uri':_0x1ee13f['data4'],'client_id':_0x1ee13f[_0xee24('0x30')],'client_secret':encryptor[_0xee24('0x41')](_0x1ee13f[_0xee24('0x3c')])};var _0x4a5735={'method':_0xee24('0x48'),'uri':MICROSOFT_AUTH_URL[_0xee24('0x19')](_0xee24('0x1a'),_0x1ee13f[_0xee24('0x1b')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x14b89f,'json':!![]};return rp(_0x4a5735);}function startRefreshInterval(_0x154a9b){var _0x457d92=schedule[_0xee24('0x49')];if(_0x457d92[_0x154a9b['id']])clearInterval(_0x457d92[_0x154a9b['id']]);_0x457d92[_0x154a9b['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0xee24('0x4a')](this,{'id':_0x154a9b['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule['intervals']=_0x457d92;}function startAllRefreshIntervals(){return db[_0xee24('0x3d')]['findAll']({'where':{'data6':{'$ne':null}},'raw':!![]})[_0xee24('0x3b')](function(_0x34ee24){var _0x20d021=_0x34ee24[_0xee24('0x14')](function(_0x114455){return refreshOauth2MicrosoftAccessToken(_0x114455)[_0xee24('0x3b')](function(_0xb1559c){startRefreshInterval(_0xb1559c);});});return Promise[_0xee24('0x4b')](_0x20d021);})[_0xee24('0x44')](function(_0x351f34){var _0x18f841=_0x351f34?util[_0xee24('0x4c')](_0x351f34,{'showHidden':![],'depth':null}):'';logger[_0xee24('0x45')](_0xee24('0x4d'),_0x18f841);});}module['exports']={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file +var _0x65f5=['base64','randomBytes','hex','client_id','response_type','redirect_uri','data4','response_mode','form_post','scope','prompt','login','map','value','oauth2Claims','oauth2/','data1','stringify','decode','iss','issuer','aud','audience','nonce','isAfter','exp','resolve','then','data3','refresh_token','data6','decryptString','POST','CloudProvider','update','catch','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','authorization_code','intervals','findAll','inspect','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','moment','ioredis','util','../../components/encryptor','../../config/environment','../../config/logger','api','../../mysqldb','defaults','redis','localhost','openid','profile','offline_access','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/POP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','/authorize','/token','type','Dynamics365','/.default','join','Outlook365','data7','replace','{TENANT_ID}','data2','code','id_token','from','toString'];(function(_0x3c572a,_0x44a2bd){var _0x530b62=function(_0x436b0a){while(--_0x436b0a){_0x3c572a['push'](_0x3c572a['shift']());}};_0x530b62(++_0x44a2bd);}(_0x65f5,0x152));var _0x565f=function(_0x36214b,_0x590e81){_0x36214b=_0x36214b-0x0;var _0x4228f2=_0x65f5[_0x36214b];return _0x4228f2;};'use strict';var _=require('lodash');var crypto=require('crypto');var jwt=require('jsonwebtoken');var moment=require(_0x565f('0x0'));var Redis=require(_0x565f('0x1'));var rp=require('request-promise');var util=require(_0x565f('0x2'));var encryptor=require(_0x565f('0x3'));var config=require(_0x565f('0x4'));var logger=require(_0x565f('0x5'))(_0x565f('0x6'));var schedule=require('../../config/schedule/cloud-provider');var db=require(_0x565f('0x7'))['db'];config['redis']=_[_0x565f('0x8')](config[_0x565f('0x9')],{'host':_0x565f('0xa'),'port':0x18eb});var redis=new Redis(config[_0x565f('0x9')]);var MICROSOFT_AUTH_URL='https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0';var AZURE_AUTH_SCOPES={'Outlook365':[_0x565f('0xb'),_0x565f('0xc'),'email',_0x565f('0xd'),_0x565f('0xe'),_0x565f('0xf'),_0x565f('0x10')],'Dynamics365':[_0x565f('0xb'),_0x565f('0xd')]};var MICROSOFT_AUTH_ENDPOINT=_0x565f('0x11');var MICROSOFT_TOKEN_ENDPOINT=_0x565f('0x12');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x5d3d27){var _0xf44360=_['map'](AZURE_AUTH_SCOPES[_0x5d3d27[_0x565f('0x13')]]);if(_0x5d3d27[_0x565f('0x13')]===_0x565f('0x14'))_0xf44360['push'](_0x5d3d27['data7']+_0x565f('0x15'));return _0xf44360[_0x565f('0x16')]('\x20');}function getAccessTokenScope(_0x6805be){if(_0x6805be[_0x565f('0x13')]===_0x565f('0x17'))return _0x565f('0xe');if(_0x6805be['type']===_0x565f('0x14'))return _0x6805be[_0x565f('0x18')]+'/.default';}function generateMicrosoftAuthorizationUrl(_0x24ee6b,_0x49c84b){var _0x527ac2=MICROSOFT_AUTH_URL[_0x565f('0x19')](_0x565f('0x1a'),_0x24ee6b[_0x565f('0x1b')]);var _0x19b0c1=[_0x565f('0x1c'),_0x565f('0x1d')];var _0xba75d8=Buffer[_0x565f('0x1e')](JSON['stringify']({'id':_0x49c84b}))[_0x565f('0x1f')](_0x565f('0x20'));var _0x341801=crypto[_0x565f('0x21')](0x10)['toString'](_0x565f('0x22'));var _0x31d9f3=getAuthorizationScopes(_0x24ee6b);var _0x12eda0=[{'key':_0x565f('0x23'),'value':_0x24ee6b['data1']},{'key':_0x565f('0x24'),'value':encodeURIComponent(_0x19b0c1[_0x565f('0x16')]('\x20'))},{'key':_0x565f('0x25'),'value':_0x24ee6b[_0x565f('0x26')]},{'key':_0x565f('0x27'),'value':_0x565f('0x28')},{'key':_0x565f('0x29'),'value':encodeURIComponent(_0x31d9f3)},{'key':'state','value':_0xba75d8},{'key':'nonce','value':_0x341801},{'key':_0x565f('0x2a'),'value':_0x565f('0x2b')}];var _0x5eb09b=_0x527ac2+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0x565f('0x2c')](_0x12eda0,function(_0x439cbd){return _0x439cbd['key']+'='+_0x439cbd[_0x565f('0x2d')];})[_0x565f('0x16')]('&');_0x24ee6b[_0x565f('0x2e')]={'issuer':_0x527ac2[_0x565f('0x19')](_0x565f('0x2f'),''),'audience':_0x24ee6b[_0x565f('0x30')],'state':_0xba75d8,'nonce':_0x341801};redis['set'](_0xba75d8,JSON[_0x565f('0x31')](_0x24ee6b));return _0x5eb09b;}function isValidIdToken(_0x384ba1,_0x2800ad){try{var _0x5d1b8e=jwt[_0x565f('0x32')](_0x384ba1,{'complete':!![]});var _0x58c70c=_0x5d1b8e['payload'];if(_0x58c70c[_0x565f('0x33')]!==_0x2800ad[_0x565f('0x34')])return![];if(_0x58c70c[_0x565f('0x35')]!==_0x2800ad[_0x565f('0x36')])return![];if(_0x58c70c[_0x565f('0x37')]!==_0x2800ad[_0x565f('0x37')])return![];if(moment()[_0x565f('0x38')](moment['unix'](_0x58c70c[_0x565f('0x39')])))return![];return!![];}catch(_0x21086d){throw _0x21086d;}}function refreshOauth2MicrosoftAccessToken(_0x4af7dd){return Promise[_0x565f('0x3a')]()[_0x565f('0x3b')](function(){if(_0x4af7dd[_0x565f('0x3c')])return _0x4af7dd;return db['CloudProvider']['findOne']({'where':{'id':_0x4af7dd['id']},'raw':!![]});})[_0x565f('0x3b')](function(_0x117805){var _0x4e5207={'grant_type':_0x565f('0x3d'),'refresh_token':_0x117805[_0x565f('0x3e')],'scope':getAccessTokenScope(_0x117805),'redirect_uri':_0x117805[_0x565f('0x26')],'client_id':_0x117805[_0x565f('0x30')],'client_secret':encryptor[_0x565f('0x3f')](_0x117805[_0x565f('0x3c')])};var _0xe27f15={'method':_0x565f('0x40'),'uri':MICROSOFT_AUTH_URL[_0x565f('0x19')](_0x565f('0x1a'),_0x117805['data2'])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x4e5207,'json':!![]};return rp(_0xe27f15);})[_0x565f('0x3b')](function(_0x3701b4){_0x4af7dd['data5']=_0x3701b4['access_token'];_0x4af7dd[_0x565f('0x3e')]=_0x3701b4[_0x565f('0x3d')];return db[_0x565f('0x41')][_0x565f('0x42')]({'data5':_0x4af7dd['data5'],'data6':_0x4af7dd[_0x565f('0x3e')]},{'where':{'id':_0x4af7dd['id']}});})[_0x565f('0x3b')](function(){return _0x4af7dd;})[_0x565f('0x43')](function(_0x21ac54){logger['error'](_0x565f('0x44'),_0x4af7dd['id'],_0x21ac54);});}function getOauth2MicrosoftAccessToken(_0x524ff5,_0x410510){var _0x253f2c={'grant_type':_0x565f('0x45'),'code':_0x524ff5,'scope':getAccessTokenScope(_0x410510),'redirect_uri':_0x410510[_0x565f('0x26')],'client_id':_0x410510[_0x565f('0x30')],'client_secret':encryptor['decryptString'](_0x410510[_0x565f('0x3c')])};var _0x5b15a4={'method':_0x565f('0x40'),'uri':MICROSOFT_AUTH_URL[_0x565f('0x19')](_0x565f('0x1a'),_0x410510[_0x565f('0x1b')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x253f2c,'json':!![]};return rp(_0x5b15a4);}function startRefreshInterval(_0x576127){var _0x3db7b6=schedule[_0x565f('0x46')];if(_0x3db7b6[_0x576127['id']])clearInterval(_0x3db7b6[_0x576127['id']]);_0x3db7b6[_0x576127['id']]=setInterval(refreshOauth2MicrosoftAccessToken['bind'](this,{'id':_0x576127['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule['intervals']=_0x3db7b6;}function startAllRefreshIntervals(){return db[_0x565f('0x41')][_0x565f('0x47')]({'where':{'data6':{'$ne':null}},'raw':!![]})[_0x565f('0x3b')](function(_0xe95852){var _0x4c8b4a=_0xe95852[_0x565f('0x2c')](function(_0xdf9586){return refreshOauth2MicrosoftAccessToken(_0xdf9586)[_0x565f('0x3b')](function(_0x5c5028){startRefreshInterval(_0x5c5028);});});return Promise['all'](_0x4c8b4a);})[_0x565f('0x43')](function(_0x51b5f5){var _0x263289=_0x51b5f5?util[_0x565f('0x48')](_0x51b5f5,{'showHidden':![],'depth':null}):'';logger['error'](_0x565f('0x49'),_0x263289);});}module['exports']={'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 20a2e01..429cea3 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 _0x4808=['stringify','error','code','message','info','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','CloudProvider,\x20%s,\x20%s','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s'];(function(_0xc6be3a,_0x540e05){var _0x56a310=function(_0x50a144){while(--_0x50a144){_0xc6be3a['push'](_0xc6be3a['shift']());}};_0x56a310(++_0x540e05);}(_0x4808,0x160));var _0x8480=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4808[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x8480('0x0'));var util=require(_0x8480('0x1'));var moment=require(_0x8480('0x2'));var BPromise=require('bluebird');var rs=require(_0x8480('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8480('0x4'))['db'];var utils=require(_0x8480('0x5'));var logger=require(_0x8480('0x6'))('rpc');var config=require(_0x8480('0x7'));var jayson=require(_0x8480('0x8'));var client=jayson['client'][_0x8480('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5060aa,_0x364f22,_0x4b9f45){return new BPromise(function(_0x3480e7,_0x2b1ffb){return client[_0x8480('0xa')](_0x5060aa,_0x4b9f45)[_0x8480('0xb')](function(_0x337d1e){logger['info'](_0x8480('0xc'),_0x364f22,_0x8480('0xd'));logger[_0x8480('0xe')](_0x8480('0xf'),_0x364f22,_0x8480('0xd'),JSON[_0x8480('0x10')](_0x337d1e));if(_0x337d1e[_0x8480('0x11')]){if(_0x337d1e[_0x8480('0x11')][_0x8480('0x12')]===0x1f4){logger[_0x8480('0x11')](_0x8480('0xc'),_0x364f22,_0x337d1e[_0x8480('0x11')][_0x8480('0x13')]);return _0x2b1ffb(_0x337d1e[_0x8480('0x11')][_0x8480('0x13')]);}logger[_0x8480('0x11')](_0x8480('0xc'),_0x364f22,_0x337d1e[_0x8480('0x11')][_0x8480('0x13')]);return _0x3480e7(_0x337d1e['error'][_0x8480('0x13')]);}else{logger[_0x8480('0x14')](_0x8480('0xc'),_0x364f22,'request\x20sent');_0x3480e7(_0x337d1e[_0x8480('0x15')][_0x8480('0x13')]);}})[_0x8480('0x16')](function(_0x35dd6a){logger[_0x8480('0x11')](_0x8480('0xc'),_0x364f22,_0x35dd6a);_0x2b1ffb(_0x35dd6a);});});} \ No newline at end of file +var _0x79d7=['ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','info','CloudProvider,\x20%s,\x20%s','request\x20sent','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x79d7,0x9c));var _0x779d=function(_0x565ed7,_0x398228){_0x565ed7=_0x565ed7-0x0;var _0x183ad7=_0x79d7[_0x565ed7];return _0x183ad7;};'use strict';var _=require(_0x779d('0x0'));var util=require('util');var moment=require(_0x779d('0x1'));var BPromise=require(_0x779d('0x2'));var rs=require(_0x779d('0x3'));var fs=require('fs');var Redis=require(_0x779d('0x4'));var db=require(_0x779d('0x5'))['db'];var utils=require(_0x779d('0x6'));var logger=require('../../config/logger')(_0x779d('0x7'));var config=require(_0x779d('0x8'));var jayson=require(_0x779d('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x227c87,_0x4c7fb4,_0xc067dd){return new BPromise(function(_0x2f83f6,_0x4c7c92){return client['request'](_0x227c87,_0xc067dd)['then'](function(_0x5b4ef2){logger[_0x779d('0xa')](_0x779d('0xb'),_0x4c7fb4,_0x779d('0xc'));logger['debug'](_0x779d('0xd'),_0x4c7fb4,'request\x20sent',JSON[_0x779d('0xe')](_0x5b4ef2));if(_0x5b4ef2['error']){if(_0x5b4ef2[_0x779d('0xf')][_0x779d('0x10')]===0x1f4){logger[_0x779d('0xf')]('CloudProvider,\x20%s,\x20%s',_0x4c7fb4,_0x5b4ef2[_0x779d('0xf')][_0x779d('0x11')]);return _0x4c7c92(_0x5b4ef2[_0x779d('0xf')][_0x779d('0x11')]);}logger[_0x779d('0xf')](_0x779d('0xb'),_0x4c7fb4,_0x5b4ef2['error'][_0x779d('0x11')]);return _0x2f83f6(_0x5b4ef2[_0x779d('0xf')][_0x779d('0x11')]);}else{logger[_0x779d('0xa')](_0x779d('0xb'),_0x4c7fb4,'request\x20sent');_0x2f83f6(_0x5b4ef2[_0x779d('0x12')][_0x779d('0x11')]);}})[_0x779d('0x13')](function(_0x4cc248){logger[_0x779d('0xf')](_0x779d('0xb'),_0x4c7fb4,_0x4cc248);_0x4c7c92(_0x4cc248);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index 4490d39..e6253f6 100644 --- a/server/api/cloudProvider/index.js +++ b/server/api/cloudProvider/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['isAuthenticated','/:id','show','post','create','delete','/:id/oauth2/microsoft/authorize/','oauth2MicrosoftAuthorize','oauth2MicrosoftCallback','exports','express','Router','../../components/auth/service','get'];(function(_0x2b10c6,_0x185590){var _0x3789d2=function(_0x272987){while(--_0x272987){_0x2b10c6['push'](_0x2b10c6['shift']());}};_0x3789d2(++_0x185590);}(_0x7a54,0x106));var _0x47a5=function(_0xae4949,_0x634d04){_0xae4949=_0xae4949-0x0;var _0x59b9f1=_0x7a54[_0xae4949];return _0x59b9f1;};'use strict';var express=require(_0x47a5('0x0'));var router=express[_0x47a5('0x1')]();var auth=require(_0x47a5('0x2'));var controller=require('./cloudProvider.controller');router[_0x47a5('0x3')]('/',auth[_0x47a5('0x4')](),controller['index']);router[_0x47a5('0x3')](_0x47a5('0x5'),auth[_0x47a5('0x4')](),controller[_0x47a5('0x6')]);router[_0x47a5('0x7')]('/',auth['isAuthenticated'](),controller[_0x47a5('0x8')]);router['put'](_0x47a5('0x5'),auth[_0x47a5('0x4')](),controller['update']);router[_0x47a5('0x9')]('/:id',auth['isAuthenticated'](),controller['destroy']);router[_0x47a5('0x3')](_0x47a5('0xa'),auth['isAuthenticated'](),controller[_0x47a5('0xb')]);router['post']('/oauth2/microsoft/callback',controller[_0x47a5('0xc')]);module[_0x47a5('0xd')]=router; \ No newline at end of file +var _0x7a54=['isAuthenticated','/:id','show','post','create','delete','/:id/oauth2/microsoft/authorize/','oauth2MicrosoftAuthorize','oauth2MicrosoftCallback','exports','express','Router','../../components/auth/service','get'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x7a54,0x106));var _0x47a5=function(_0x3f1e56,_0x3b4a5b){_0x3f1e56=_0x3f1e56-0x0;var _0x3b98c4=_0x7a54[_0x3f1e56];return _0x3b98c4;};'use strict';var express=require(_0x47a5('0x0'));var router=express[_0x47a5('0x1')]();var auth=require(_0x47a5('0x2'));var controller=require('./cloudProvider.controller');router[_0x47a5('0x3')]('/',auth[_0x47a5('0x4')](),controller['index']);router[_0x47a5('0x3')](_0x47a5('0x5'),auth[_0x47a5('0x4')](),controller[_0x47a5('0x6')]);router[_0x47a5('0x7')]('/',auth['isAuthenticated'](),controller[_0x47a5('0x8')]);router['put'](_0x47a5('0x5'),auth[_0x47a5('0x4')](),controller['update']);router[_0x47a5('0x9')]('/:id',auth['isAuthenticated'](),controller['destroy']);router[_0x47a5('0x3')](_0x47a5('0xa'),auth['isAuthenticated'](),controller[_0x47a5('0xb')]);router['post']('/oauth2/microsoft/callback',controller[_0x47a5('0xc')]);module[_0x47a5('0xd')]=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index 67d4564..f38d419 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 _0x5b41=['STRING','name','sequelize'];(function(_0x11e891,_0x48aecf){var _0x49b5a2=function(_0x5dc3f5){while(--_0x5dc3f5){_0x11e891['push'](_0x11e891['shift']());}};_0x49b5a2(++_0x48aecf);}(_0x5b41,0x1e2));var _0x15b4=function(_0x3435eb,_0x1afb3c){_0x3435eb=_0x3435eb-0x0;var _0x5626dd=_0x5b41[_0x3435eb];return _0x5626dd;};'use strict';var Sequelize=require(_0x15b4('0x0'));module['exports']={'name':{'type':Sequelize[_0x15b4('0x1')],'unique':_0x15b4('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x15b4('0x1')]},'companyId':{'type':Sequelize[_0x15b4('0x1')]},'website':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x15b4('0x1')]},'fax':{'type':Sequelize[_0x15b4('0x1')]},'type':{'type':Sequelize[_0x15b4('0x1')]},'street':{'type':Sequelize[_0x15b4('0x1')]},'postalCode':{'type':Sequelize[_0x15b4('0x1')]},'city':{'type':Sequelize[_0x15b4('0x1')]},'country':{'type':Sequelize[_0x15b4('0x1')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x15b4('0x1')]},'sStreet':{'type':Sequelize[_0x15b4('0x1')]},'sPostalCode':{'type':Sequelize[_0x15b4('0x1')]},'sCity':{'type':Sequelize[_0x15b4('0x1')]},'sCountry':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x15b4('0x1')]}}; \ No newline at end of file +var _0x6edf=['sequelize','STRING','name'];(function(_0x52f567,_0x3728a3){var _0x57f36f=function(_0x5b0f76){while(--_0x5b0f76){_0x52f567['push'](_0x52f567['shift']());}};_0x57f36f(++_0x3728a3);}(_0x6edf,0xd8));var _0xf6ed=function(_0x593614,_0x2a9105){_0x593614=_0x593614-0x0;var _0x2f0f39=_0x6edf[_0x593614];return _0x2f0f39;};'use strict';var Sequelize=require(_0xf6ed('0x0'));module['exports']={'name':{'type':Sequelize[_0xf6ed('0x1')],'unique':_0xf6ed('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize['STRING']},'companyId':{'type':Sequelize['STRING']},'website':{'type':Sequelize[_0xf6ed('0x1')]},'phone':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0xf6ed('0x1')]},'type':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0xf6ed('0x1')]},'postalCode':{'type':Sequelize[_0xf6ed('0x1')]},'city':{'type':Sequelize[_0xf6ed('0x1')]},'country':{'type':Sequelize[_0xf6ed('0x1')]},'email':{'type':Sequelize[_0xf6ed('0x1')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0xf6ed('0x1')]},'sStreet':{'type':Sequelize[_0xf6ed('0x1')]},'sPostalCode':{'type':Sequelize[_0xf6ed('0x1')]},'sCity':{'type':Sequelize[_0xf6ed('0x1')]},'sCountry':{'type':Sequelize[_0xf6ed('0x1')]},'description':{'type':Sequelize[_0xf6ed('0x1')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index 6e8adfa..734683f 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 _0x4eb3=['intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','rawAttributes','length','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','addContacts','CmContact','ids','getContacts','findOne','order','map','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy','then','get','Companies','UserProfileResource','stack','name','send','index','CmCompany','describe','model','keys','query','filters'];(function(_0x9cee6c,_0x1eef7f){var _0x28cfbc=function(_0x395457){while(--_0x395457){_0x9cee6c['push'](_0x9cee6c['shift']());}};_0x28cfbc(++_0x1eef7f);}(_0x4eb3,0x123));var _0x34eb=function(_0x46c30c,_0x1ac896){_0x46c30c=_0x46c30c-0x0;var _0x45c5c1=_0x4eb3[_0x46c30c];return _0x45c5c1;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x34eb('0x0'));var jsonpatch=require(_0x34eb('0x1'));var rp=require(_0x34eb('0x2'));var moment=require('moment');var BPromise=require(_0x34eb('0x3'));var Mustache=require(_0x34eb('0x4'));var util=require('util');var path=require(_0x34eb('0x5'));var sox=require('sox');var csv=require(_0x34eb('0x6'));var ejs=require(_0x34eb('0x7'));var fs=require('fs');var fs_extra=require(_0x34eb('0x8'));var _=require('lodash');var squel=require(_0x34eb('0x9'));var crypto=require(_0x34eb('0xa'));var jsforce=require(_0x34eb('0xb'));var deskjs=require(_0x34eb('0xc'));var toCsv=require(_0x34eb('0x6'));var querystring=require(_0x34eb('0xd'));var Papa=require(_0x34eb('0xe'));var Redis=require(_0x34eb('0xf'));var authService=require(_0x34eb('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x34eb('0x11'));var logger=require(_0x34eb('0x12'))('api');var utils=require('../../config/utils');var config=require(_0x34eb('0x13'));var licenseUtil=require(_0x34eb('0x14'));var db=require(_0x34eb('0x15'))['db'];function respondWithStatusCode(_0x5606f9,_0x290e6c){_0x290e6c=_0x290e6c||0xcc;return function(_0x42f937){if(_0x42f937){return _0x5606f9[_0x34eb('0x16')](_0x290e6c);}return _0x5606f9['status'](_0x290e6c)[_0x34eb('0x17')]();};}function respondWithResult(_0x2ff186,_0x506408){_0x506408=_0x506408||0xc8;return function(_0x2312d9){if(_0x2312d9){return _0x2ff186[_0x34eb('0x18')](_0x506408)['json'](_0x2312d9);}};}function respondWithFilteredResult(_0x1a3e33,_0x2d105a){return function(_0x250c20){if(_0x250c20){var _0x4d1634=typeof _0x2d105a[_0x34eb('0x19')]===_0x34eb('0x1a')&&typeof _0x2d105a[_0x34eb('0x1b')]===_0x34eb('0x1a');var _0x35f5c=_0x250c20[_0x34eb('0x1c')];var _0x4930dd=_0x4d1634?0x0:_0x2d105a[_0x34eb('0x19')];var _0x17ce22=_0x4d1634?_0x250c20['count']:_0x2d105a[_0x34eb('0x19')]+_0x2d105a[_0x34eb('0x1b')];var _0x5f2963;if(_0x17ce22>=_0x35f5c){_0x17ce22=_0x35f5c;_0x5f2963=0xc8;}else{_0x5f2963=0xce;}_0x1a3e33['status'](_0x5f2963);return _0x1a3e33[_0x34eb('0x1d')](_0x34eb('0x1e'),_0x4930dd+'-'+_0x17ce22+'/'+_0x35f5c)['json'](_0x250c20);}return null;};}function patchUpdates(_0x4d605f){return function(_0x34b1d2){try{jsonpatch[_0x34eb('0x1f')](_0x34b1d2,_0x4d605f,!![]);}catch(_0x2549de){return BPromise['reject'](_0x2549de);}return _0x34b1d2[_0x34eb('0x20')]();};}function saveUpdates(_0x411bae,_0x5579dc){return function(_0x25839a){if(_0x25839a){return _0x25839a[_0x34eb('0x21')](_0x411bae)['then'](function(_0x5262f8){return _0x5262f8;});}return null;};}function removeEntity(_0x1c3962,_0x2219e1){return function(_0x2b5b6a){if(_0x2b5b6a){return _0x2b5b6a[_0x34eb('0x22')]()[_0x34eb('0x23')](function(){var _0x2b366b=_0x2b5b6a[_0x34eb('0x24')]({'plain':!![]});var _0x307bdf=_0x34eb('0x25');return db[_0x34eb('0x26')]['destroy']({'where':{'type':_0x307bdf,'resourceId':_0x2b366b['id']}})[_0x34eb('0x23')](function(){return _0x2b5b6a;});})[_0x34eb('0x23')](function(){_0x1c3962[_0x34eb('0x18')](0xcc)[_0x34eb('0x17')]();});}};}function handleEntityNotFound(_0x183e5f,_0x132859){return function(_0x1805a3){if(!_0x1805a3){_0x183e5f[_0x34eb('0x16')](0x194);}return _0x1805a3;};}function handleError(_0x34e700,_0x38a994){_0x38a994=_0x38a994||0x1f4;return function(_0x344287){logger['error'](_0x344287[_0x34eb('0x27')]);if(_0x344287[_0x34eb('0x28')]){delete _0x344287[_0x34eb('0x28')];}_0x34e700['status'](_0x38a994)[_0x34eb('0x29')](_0x344287);};}exports[_0x34eb('0x2a')]=function(_0x13f06d,_0x2ad528){var _0x1499cb={},_0x1f54af={},_0x47b65e={'count':0x0,'rows':[]};return db[_0x34eb('0x2b')][_0x34eb('0x2c')]()['then'](function(_0x4e8c24){_0x1f54af[_0x34eb('0x2d')]=_[_0x34eb('0x2e')](_0x4e8c24);_0x1f54af[_0x34eb('0x2f')]=_[_0x34eb('0x2e')](_0x13f06d[_0x34eb('0x2f')]);_0x1f54af[_0x34eb('0x30')]=_[_0x34eb('0x31')](_0x1f54af[_0x34eb('0x2d')],_0x1f54af[_0x34eb('0x2f')]);_0x1499cb['attributes']=_['intersection'](_0x1f54af['model'],qs['fields'](_0x13f06d['query'][_0x34eb('0x32')]));_0x1499cb[_0x34eb('0x33')]=_0x1499cb[_0x34eb('0x33')]['length']?_0x1499cb[_0x34eb('0x33')]:_0x1f54af[_0x34eb('0x2d')];if(!_0x13f06d[_0x34eb('0x2f')][_0x34eb('0x34')](_0x34eb('0x35'))){_0x1499cb[_0x34eb('0x1b')]=qs[_0x34eb('0x1b')](_0x13f06d[_0x34eb('0x2f')][_0x34eb('0x1b')]);_0x1499cb[_0x34eb('0x19')]=qs['offset'](_0x13f06d[_0x34eb('0x2f')][_0x34eb('0x19')]);}_0x1499cb['order']=qs[_0x34eb('0x36')](_0x13f06d['query'][_0x34eb('0x36')]);_0x1499cb[_0x34eb('0x37')]=qs[_0x34eb('0x30')](_[_0x34eb('0x38')](_0x13f06d['query'],_0x1f54af[_0x34eb('0x30')]),_0x4e8c24);if(_0x13f06d[_0x34eb('0x2f')][_0x34eb('0x39')]){_0x1499cb[_0x34eb('0x37')]=_[_0x34eb('0x3a')](_0x1499cb[_0x34eb('0x37')],{'$or':_['map'](_0x1499cb[_0x34eb('0x33')],function(_0x57ea79){var _0x67a5e4={};_0x67a5e4[_0x57ea79]={'$like':'%'+_0x13f06d['query'][_0x34eb('0x39')]+'%'};return _0x67a5e4;})});}_0x1499cb=_['merge']({},_0x1499cb,_0x13f06d[_0x34eb('0x3b')]);var _0x59f236={'where':_0x1499cb[_0x34eb('0x37')]};return db[_0x34eb('0x2b')][_0x34eb('0x1c')](_0x59f236)[_0x34eb('0x23')](function(_0x26b29c){_0x47b65e[_0x34eb('0x1c')]=_0x26b29c;if(_0x13f06d[_0x34eb('0x2f')][_0x34eb('0x3c')]){_0x1499cb[_0x34eb('0x3d')]=[{'all':!![]}];}return db['CmCompany'][_0x34eb('0x3e')](_0x1499cb);})[_0x34eb('0x23')](function(_0x1e1031){_0x47b65e[_0x34eb('0x3f')]=_0x1e1031;return _0x47b65e;})[_0x34eb('0x23')](respondWithFilteredResult(_0x2ad528,_0x1499cb))[_0x34eb('0x40')](handleError(_0x2ad528,null));})[_0x34eb('0x40')](handleError(_0x2ad528,null));};exports[_0x34eb('0x41')]=function(_0x40adf9,_0x481544){var _0x226076={'raw':![],'where':{'id':_0x40adf9['params']['id']}},_0x341113={};_0x341113[_0x34eb('0x2d')]=_[_0x34eb('0x2e')](db[_0x34eb('0x2b')][_0x34eb('0x42')]);_0x341113['query']=_['keys'](_0x40adf9['query']);_0x341113[_0x34eb('0x30')]=_[_0x34eb('0x31')](_0x341113[_0x34eb('0x2d')],_0x341113['query']);_0x226076[_0x34eb('0x33')]=_['intersection'](_0x341113[_0x34eb('0x2d')],qs[_0x34eb('0x32')](_0x40adf9[_0x34eb('0x2f')]['fields']));_0x226076[_0x34eb('0x33')]=_0x226076['attributes'][_0x34eb('0x43')]?_0x226076['attributes']:_0x341113['model'];if(_0x40adf9[_0x34eb('0x2f')][_0x34eb('0x3c')]){_0x226076[_0x34eb('0x3d')]=[{'all':!![]}];}_0x226076=_[_0x34eb('0x3a')]({},_0x226076,_0x40adf9[_0x34eb('0x3b')]);return db['CmCompany'][_0x34eb('0x44')](_0x226076)[_0x34eb('0x23')](handleEntityNotFound(_0x481544,null))[_0x34eb('0x23')](respondWithResult(_0x481544,null))[_0x34eb('0x40')](handleError(_0x481544,null));};exports[_0x34eb('0x45')]=function(_0x38c5f9,_0x466f37){return db[_0x34eb('0x2b')][_0x34eb('0x45')](_0x38c5f9['body'],{})[_0x34eb('0x23')](function(_0x19858e){var _0x32dcf9=_0x38c5f9[_0x34eb('0x46')][_0x34eb('0x24')]({'plain':!![]});if(!_0x32dcf9)throw new Error(_0x34eb('0x47'));if(_0x32dcf9[_0x34eb('0x48')]===_0x34eb('0x46')){var _0x34357b=_0x19858e[_0x34eb('0x24')]({'plain':!![]});var _0x17afbb=_0x34eb('0x25');return db['UserProfileSection'][_0x34eb('0x44')]({'where':{'name':_0x17afbb,'userProfileId':_0x32dcf9[_0x34eb('0x49')]},'raw':!![]})[_0x34eb('0x23')](function(_0x1da4dc){if(_0x1da4dc&&_0x1da4dc['autoAssociation']===0x0){return db[_0x34eb('0x26')][_0x34eb('0x45')]({'name':_0x34357b[_0x34eb('0x28')],'resourceId':_0x34357b['id'],'type':_0x1da4dc[_0x34eb('0x28')],'sectionId':_0x1da4dc['id']},{})[_0x34eb('0x23')](function(){return _0x19858e;});}else{return _0x19858e;}})[_0x34eb('0x40')](function(_0x3bd07a){logger[_0x34eb('0x4a')](_0x34eb('0x4b'),_0x3bd07a);throw _0x3bd07a;});}return _0x19858e;})['then'](respondWithResult(_0x466f37,0xc9))['catch'](handleError(_0x466f37,null));};exports[_0x34eb('0x21')]=function(_0x36a1e3,_0x534278){if(_0x36a1e3[_0x34eb('0x4c')]['id']){delete _0x36a1e3['body']['id'];}return db[_0x34eb('0x2b')][_0x34eb('0x44')]({'where':{'id':_0x36a1e3[_0x34eb('0x4d')]['id']}})[_0x34eb('0x23')](handleEntityNotFound(_0x534278,null))[_0x34eb('0x23')](saveUpdates(_0x36a1e3['body'],null))[_0x34eb('0x23')](respondWithResult(_0x534278,null))[_0x34eb('0x40')](handleError(_0x534278,null));};exports[_0x34eb('0x22')]=function(_0x53d0d7,_0x1c9db2){return db[_0x34eb('0x2b')][_0x34eb('0x44')]({'where':{'id':_0x53d0d7[_0x34eb('0x4d')]['id']}})[_0x34eb('0x23')](handleEntityNotFound(_0x1c9db2,null))[_0x34eb('0x23')](removeEntity(_0x1c9db2,null))[_0x34eb('0x40')](handleError(_0x1c9db2,null));};exports[_0x34eb('0x2c')]=function(_0x37388e,_0x31f9cf){return db[_0x34eb('0x2b')]['describe']()[_0x34eb('0x23')](respondWithResult(_0x31f9cf,null))[_0x34eb('0x40')](handleError(_0x31f9cf,null));};exports[_0x34eb('0x4e')]=function(_0x2032e5,_0x134f91,_0x1fb007){return db[_0x34eb('0x4f')]['find']({'where':{'id':_0x2032e5[_0x34eb('0x4d')]['id']}})[_0x34eb('0x23')](handleEntityNotFound(_0x134f91,null))['then'](function(_0x1a63c8){if(_0x1a63c8){return _0x1a63c8['addContacts'](_0x2032e5[_0x34eb('0x4c')][_0x34eb('0x50')],_['omit'](_0x2032e5['body'],[_0x34eb('0x50'),'id'])||{});}})[_0x34eb('0x23')](respondWithResult(_0x134f91,null))[_0x34eb('0x40')](handleError(_0x134f91,null));};exports[_0x34eb('0x51')]=function(_0x5c77f9,_0x436717,_0xdd8f64){var _0x428d2a={};var _0x500b8c={};var _0x24415e;var _0x326f64;return db[_0x34eb('0x2b')][_0x34eb('0x52')]({'where':{'id':_0x5c77f9[_0x34eb('0x4d')]['id']}})[_0x34eb('0x23')](handleEntityNotFound(_0x436717,null))[_0x34eb('0x23')](function(_0x335b63){if(_0x335b63){_0x24415e=_0x335b63;_0x500b8c['model']=_[_0x34eb('0x2e')](db[_0x34eb('0x4f')][_0x34eb('0x42')]);_0x500b8c[_0x34eb('0x2f')]=_[_0x34eb('0x2e')](_0x5c77f9[_0x34eb('0x2f')]);_0x500b8c['filters']=_[_0x34eb('0x31')](_0x500b8c[_0x34eb('0x2d')],_0x500b8c['query']);_0x428d2a['attributes']=_['intersection'](_0x500b8c[_0x34eb('0x2d')],qs[_0x34eb('0x32')](_0x5c77f9[_0x34eb('0x2f')][_0x34eb('0x32')]));_0x428d2a[_0x34eb('0x33')]=_0x428d2a[_0x34eb('0x33')][_0x34eb('0x43')]?_0x428d2a[_0x34eb('0x33')]:_0x500b8c['model'];_0x428d2a[_0x34eb('0x53')]=qs[_0x34eb('0x36')](_0x5c77f9[_0x34eb('0x2f')]['sort']);_0x428d2a[_0x34eb('0x37')]=qs[_0x34eb('0x30')](_[_0x34eb('0x38')](_0x5c77f9[_0x34eb('0x2f')],_0x500b8c['filters']));if(_0x5c77f9[_0x34eb('0x2f')][_0x34eb('0x39')]){_0x428d2a[_0x34eb('0x37')]=_['merge'](_0x428d2a[_0x34eb('0x37')],{'$or':_[_0x34eb('0x54')](_0x428d2a['attributes'],function(_0x3c8f16){var _0x390893={};_0x390893[_0x3c8f16]={'$like':'%'+_0x5c77f9[_0x34eb('0x2f')][_0x34eb('0x39')]+'%'};return _0x390893;})});}_0x428d2a=_[_0x34eb('0x3a')]({},_0x428d2a,_0x5c77f9[_0x34eb('0x3b')]);return _0x24415e[_0x34eb('0x51')](_0x428d2a);}})['then'](function(_0x50e02d){if(_0x50e02d){_0x326f64=_0x50e02d['length'];if(!_0x5c77f9['query'][_0x34eb('0x34')]('nolimit')){_0x428d2a[_0x34eb('0x1b')]=qs[_0x34eb('0x1b')](_0x5c77f9[_0x34eb('0x2f')][_0x34eb('0x1b')]);_0x428d2a[_0x34eb('0x19')]=qs[_0x34eb('0x19')](_0x5c77f9[_0x34eb('0x2f')][_0x34eb('0x19')]);}return _0x24415e[_0x34eb('0x51')](_0x428d2a);}})['then'](function(_0x20a598){if(_0x20a598){return _0x20a598?{'count':_0x326f64,'rows':_0x20a598}:null;}})[_0x34eb('0x23')](respondWithResult(_0x436717,null))[_0x34eb('0x40')](handleError(_0x436717,null));}; \ No newline at end of file +var _0x50d1=['mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','then','get','Companies','destroy','error','stack','name','index','CmCompany','describe','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','options','findAll','catch','show','includeAll','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','addContacts','CmContact','omit','ids','getContacts','findOne','map','rimraf','zip-dir','fast-json-patch','request-promise','bluebird'];(function(_0x5d80de,_0x2cf15d){var _0x1c7556=function(_0x5bd806){while(--_0x5bd806){_0x5d80de['push'](_0x5d80de['shift']());}};_0x1c7556(++_0x2cf15d);}(_0x50d1,0x103));var _0x150d=function(_0x16a47a,_0x2422f2){_0x16a47a=_0x16a47a-0x0;var _0x332f41=_0x50d1[_0x16a47a];return _0x332f41;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x150d('0x0'));var zipdir=require(_0x150d('0x1'));var jsonpatch=require(_0x150d('0x2'));var rp=require(_0x150d('0x3'));var moment=require('moment');var BPromise=require(_0x150d('0x4'));var Mustache=require(_0x150d('0x5'));var util=require(_0x150d('0x6'));var path=require(_0x150d('0x7'));var sox=require(_0x150d('0x8'));var csv=require(_0x150d('0x9'));var ejs=require(_0x150d('0xa'));var fs=require('fs');var fs_extra=require(_0x150d('0xb'));var _=require(_0x150d('0xc'));var squel=require('squel');var crypto=require(_0x150d('0xd'));var jsforce=require(_0x150d('0xe'));var deskjs=require(_0x150d('0xf'));var toCsv=require('to-csv');var querystring=require(_0x150d('0x10'));var Papa=require(_0x150d('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x150d('0x12'));var as=require(_0x150d('0x13'));var hardwareService=require(_0x150d('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x150d('0x15'));var config=require(_0x150d('0x16'));var licenseUtil=require(_0x150d('0x17'));var db=require(_0x150d('0x18'))['db'];function respondWithStatusCode(_0x49e7cd,_0x33aa59){_0x33aa59=_0x33aa59||0xcc;return function(_0x49c0ab){if(_0x49c0ab){return _0x49e7cd[_0x150d('0x19')](_0x33aa59);}return _0x49e7cd[_0x150d('0x1a')](_0x33aa59)[_0x150d('0x1b')]();};}function respondWithResult(_0x56c3bf,_0x2efb41){_0x2efb41=_0x2efb41||0xc8;return function(_0x511ad1){if(_0x511ad1){return _0x56c3bf[_0x150d('0x1a')](_0x2efb41)['json'](_0x511ad1);}};}function respondWithFilteredResult(_0xd53e10,_0x166f55){return function(_0x3d86a1){if(_0x3d86a1){var _0x112ba5=typeof _0x166f55[_0x150d('0x1c')]===_0x150d('0x1d')&&typeof _0x166f55[_0x150d('0x1e')]===_0x150d('0x1d');var _0x1ee12f=_0x3d86a1[_0x150d('0x1f')];var _0x196a74=_0x112ba5?0x0:_0x166f55['offset'];var _0x42b50c=_0x112ba5?_0x3d86a1[_0x150d('0x1f')]:_0x166f55[_0x150d('0x1c')]+_0x166f55['limit'];var _0x15bb24;if(_0x42b50c>=_0x1ee12f){_0x42b50c=_0x1ee12f;_0x15bb24=0xc8;}else{_0x15bb24=0xce;}_0xd53e10[_0x150d('0x1a')](_0x15bb24);return _0xd53e10[_0x150d('0x20')](_0x150d('0x21'),_0x196a74+'-'+_0x42b50c+'/'+_0x1ee12f)[_0x150d('0x22')](_0x3d86a1);}return null;};}function patchUpdates(_0x4f7f51){return function(_0x1993a2){try{jsonpatch['apply'](_0x1993a2,_0x4f7f51,!![]);}catch(_0x200967){return BPromise[_0x150d('0x23')](_0x200967);}return _0x1993a2[_0x150d('0x24')]();};}function saveUpdates(_0x29e1ff,_0x36ff17){return function(_0x53ac7c){if(_0x53ac7c){return _0x53ac7c[_0x150d('0x25')](_0x29e1ff)[_0x150d('0x26')](function(_0x1fa9d4){return _0x1fa9d4;});}return null;};}function removeEntity(_0x5f07e4,_0x580a56){return function(_0x4f1999){if(_0x4f1999){return _0x4f1999['destroy']()[_0x150d('0x26')](function(){var _0x102872=_0x4f1999[_0x150d('0x27')]({'plain':!![]});var _0x4c3e2a=_0x150d('0x28');return db['UserProfileResource'][_0x150d('0x29')]({'where':{'type':_0x4c3e2a,'resourceId':_0x102872['id']}})[_0x150d('0x26')](function(){return _0x4f1999;});})[_0x150d('0x26')](function(){_0x5f07e4[_0x150d('0x1a')](0xcc)[_0x150d('0x1b')]();});}};}function handleEntityNotFound(_0x3da230,_0xf77710){return function(_0x3a92a0){if(!_0x3a92a0){_0x3da230[_0x150d('0x19')](0x194);}return _0x3a92a0;};}function handleError(_0x2ef85b,_0x1ec53f){_0x1ec53f=_0x1ec53f||0x1f4;return function(_0x441224){logger[_0x150d('0x2a')](_0x441224[_0x150d('0x2b')]);if(_0x441224[_0x150d('0x2c')]){delete _0x441224['name'];}_0x2ef85b[_0x150d('0x1a')](_0x1ec53f)['send'](_0x441224);};}exports[_0x150d('0x2d')]=function(_0x4aa812,_0x42ded7){var _0x4f7c3d={},_0x1897f7={},_0x193b30={'count':0x0,'rows':[]};return db[_0x150d('0x2e')][_0x150d('0x2f')]()[_0x150d('0x26')](function(_0x2e05c3){_0x1897f7[_0x150d('0x30')]=_[_0x150d('0x31')](_0x2e05c3);_0x1897f7[_0x150d('0x32')]=_[_0x150d('0x31')](_0x4aa812[_0x150d('0x32')]);_0x1897f7['filters']=_[_0x150d('0x33')](_0x1897f7[_0x150d('0x30')],_0x1897f7[_0x150d('0x32')]);_0x4f7c3d[_0x150d('0x34')]=_[_0x150d('0x33')](_0x1897f7['model'],qs['fields'](_0x4aa812['query'][_0x150d('0x35')]));_0x4f7c3d[_0x150d('0x34')]=_0x4f7c3d[_0x150d('0x34')][_0x150d('0x36')]?_0x4f7c3d[_0x150d('0x34')]:_0x1897f7[_0x150d('0x30')];if(!_0x4aa812[_0x150d('0x32')][_0x150d('0x37')](_0x150d('0x38'))){_0x4f7c3d[_0x150d('0x1e')]=qs['limit'](_0x4aa812[_0x150d('0x32')]['limit']);_0x4f7c3d['offset']=qs['offset'](_0x4aa812[_0x150d('0x32')]['offset']);}_0x4f7c3d[_0x150d('0x39')]=qs[_0x150d('0x3a')](_0x4aa812[_0x150d('0x32')][_0x150d('0x3a')]);_0x4f7c3d[_0x150d('0x3b')]=qs['filters'](_[_0x150d('0x3c')](_0x4aa812[_0x150d('0x32')],_0x1897f7[_0x150d('0x3d')]),_0x2e05c3);if(_0x4aa812['query'][_0x150d('0x3e')]){_0x4f7c3d['where']=_[_0x150d('0x3f')](_0x4f7c3d[_0x150d('0x3b')],{'$or':_['map'](_0x4f7c3d['attributes'],function(_0x38c24b){var _0x11d0ed={};_0x11d0ed[_0x38c24b]={'$like':'%'+_0x4aa812[_0x150d('0x32')][_0x150d('0x3e')]+'%'};return _0x11d0ed;})});}_0x4f7c3d=_[_0x150d('0x3f')]({},_0x4f7c3d,_0x4aa812[_0x150d('0x40')]);var _0x49a466={'where':_0x4f7c3d[_0x150d('0x3b')]};return db[_0x150d('0x2e')][_0x150d('0x1f')](_0x49a466)['then'](function(_0x517240){_0x193b30[_0x150d('0x1f')]=_0x517240;if(_0x4aa812['query']['includeAll']){_0x4f7c3d['include']=[{'all':!![]}];}return db[_0x150d('0x2e')][_0x150d('0x41')](_0x4f7c3d);})['then'](function(_0x3d688c){_0x193b30['rows']=_0x3d688c;return _0x193b30;})[_0x150d('0x26')](respondWithFilteredResult(_0x42ded7,_0x4f7c3d))[_0x150d('0x42')](handleError(_0x42ded7,null));})[_0x150d('0x42')](handleError(_0x42ded7,null));};exports[_0x150d('0x43')]=function(_0xd2b20f,_0x1da4a4){var _0x575c17={'raw':![],'where':{'id':_0xd2b20f['params']['id']}},_0x2a5754={};_0x2a5754[_0x150d('0x30')]=_[_0x150d('0x31')](db[_0x150d('0x2e')]['rawAttributes']);_0x2a5754[_0x150d('0x32')]=_[_0x150d('0x31')](_0xd2b20f[_0x150d('0x32')]);_0x2a5754[_0x150d('0x3d')]=_[_0x150d('0x33')](_0x2a5754['model'],_0x2a5754[_0x150d('0x32')]);_0x575c17[_0x150d('0x34')]=_[_0x150d('0x33')](_0x2a5754[_0x150d('0x30')],qs[_0x150d('0x35')](_0xd2b20f[_0x150d('0x32')][_0x150d('0x35')]));_0x575c17['attributes']=_0x575c17[_0x150d('0x34')]['length']?_0x575c17[_0x150d('0x34')]:_0x2a5754[_0x150d('0x30')];if(_0xd2b20f[_0x150d('0x32')][_0x150d('0x44')]){_0x575c17[_0x150d('0x45')]=[{'all':!![]}];}_0x575c17=_[_0x150d('0x3f')]({},_0x575c17,_0xd2b20f[_0x150d('0x40')]);return db[_0x150d('0x2e')][_0x150d('0x46')](_0x575c17)[_0x150d('0x26')](handleEntityNotFound(_0x1da4a4,null))[_0x150d('0x26')](respondWithResult(_0x1da4a4,null))[_0x150d('0x42')](handleError(_0x1da4a4,null));};exports[_0x150d('0x47')]=function(_0x28ae20,_0x482534){return db[_0x150d('0x2e')][_0x150d('0x47')](_0x28ae20[_0x150d('0x48')],{})[_0x150d('0x26')](function(_0x1dda10){var _0x5d7c99=_0x28ae20[_0x150d('0x49')][_0x150d('0x27')]({'plain':!![]});if(!_0x5d7c99)throw new Error(_0x150d('0x4a'));if(_0x5d7c99[_0x150d('0x4b')]===_0x150d('0x49')){var _0x8fc6be=_0x1dda10[_0x150d('0x27')]({'plain':!![]});var _0x80886='Companies';return db['UserProfileSection'][_0x150d('0x46')]({'where':{'name':_0x80886,'userProfileId':_0x5d7c99[_0x150d('0x4c')]},'raw':!![]})[_0x150d('0x26')](function(_0x444ef7){if(_0x444ef7&&_0x444ef7[_0x150d('0x4d')]===0x0){return db[_0x150d('0x4e')][_0x150d('0x47')]({'name':_0x8fc6be[_0x150d('0x2c')],'resourceId':_0x8fc6be['id'],'type':_0x444ef7[_0x150d('0x2c')],'sectionId':_0x444ef7['id']},{})['then'](function(){return _0x1dda10;});}else{return _0x1dda10;}})[_0x150d('0x42')](function(_0x475b70){logger[_0x150d('0x2a')](_0x150d('0x4f'),_0x475b70);throw _0x475b70;});}return _0x1dda10;})['then'](respondWithResult(_0x482534,0xc9))['catch'](handleError(_0x482534,null));};exports[_0x150d('0x25')]=function(_0x16d426,_0x2b8611){if(_0x16d426[_0x150d('0x48')]['id']){delete _0x16d426[_0x150d('0x48')]['id'];}return db[_0x150d('0x2e')][_0x150d('0x46')]({'where':{'id':_0x16d426['params']['id']}})['then'](handleEntityNotFound(_0x2b8611,null))['then'](saveUpdates(_0x16d426[_0x150d('0x48')],null))['then'](respondWithResult(_0x2b8611,null))['catch'](handleError(_0x2b8611,null));};exports[_0x150d('0x29')]=function(_0x23f420,_0x12270f){return db[_0x150d('0x2e')][_0x150d('0x46')]({'where':{'id':_0x23f420[_0x150d('0x50')]['id']}})[_0x150d('0x26')](handleEntityNotFound(_0x12270f,null))[_0x150d('0x26')](removeEntity(_0x12270f,null))[_0x150d('0x42')](handleError(_0x12270f,null));};exports[_0x150d('0x2f')]=function(_0x2e636e,_0x26f18b){return db[_0x150d('0x2e')][_0x150d('0x2f')]()[_0x150d('0x26')](respondWithResult(_0x26f18b,null))[_0x150d('0x42')](handleError(_0x26f18b,null));};exports[_0x150d('0x51')]=function(_0x29296b,_0x538489,_0x3b2551){return db[_0x150d('0x52')][_0x150d('0x46')]({'where':{'id':_0x29296b[_0x150d('0x50')]['id']}})[_0x150d('0x26')](handleEntityNotFound(_0x538489,null))[_0x150d('0x26')](function(_0x9d42d8){if(_0x9d42d8){return _0x9d42d8[_0x150d('0x51')](_0x29296b['body']['ids'],_[_0x150d('0x53')](_0x29296b[_0x150d('0x48')],[_0x150d('0x54'),'id'])||{});}})[_0x150d('0x26')](respondWithResult(_0x538489,null))[_0x150d('0x42')](handleError(_0x538489,null));};exports[_0x150d('0x55')]=function(_0x40c218,_0x533b5c,_0x27d22e){var _0x130cf1={};var _0x5c2cdb={};var _0x5f4679;var _0x758c49;return db[_0x150d('0x2e')][_0x150d('0x56')]({'where':{'id':_0x40c218['params']['id']}})[_0x150d('0x26')](handleEntityNotFound(_0x533b5c,null))[_0x150d('0x26')](function(_0x132787){if(_0x132787){_0x5f4679=_0x132787;_0x5c2cdb[_0x150d('0x30')]=_[_0x150d('0x31')](db[_0x150d('0x52')]['rawAttributes']);_0x5c2cdb['query']=_['keys'](_0x40c218[_0x150d('0x32')]);_0x5c2cdb['filters']=_[_0x150d('0x33')](_0x5c2cdb[_0x150d('0x30')],_0x5c2cdb[_0x150d('0x32')]);_0x130cf1[_0x150d('0x34')]=_[_0x150d('0x33')](_0x5c2cdb['model'],qs['fields'](_0x40c218['query'][_0x150d('0x35')]));_0x130cf1[_0x150d('0x34')]=_0x130cf1['attributes']['length']?_0x130cf1['attributes']:_0x5c2cdb[_0x150d('0x30')];_0x130cf1[_0x150d('0x39')]=qs['sort'](_0x40c218[_0x150d('0x32')][_0x150d('0x3a')]);_0x130cf1['where']=qs[_0x150d('0x3d')](_[_0x150d('0x3c')](_0x40c218[_0x150d('0x32')],_0x5c2cdb[_0x150d('0x3d')]));if(_0x40c218['query'][_0x150d('0x3e')]){_0x130cf1[_0x150d('0x3b')]=_['merge'](_0x130cf1[_0x150d('0x3b')],{'$or':_[_0x150d('0x57')](_0x130cf1[_0x150d('0x34')],function(_0x5098ce){var _0x196cc3={};_0x196cc3[_0x5098ce]={'$like':'%'+_0x40c218[_0x150d('0x32')]['filter']+'%'};return _0x196cc3;})});}_0x130cf1=_[_0x150d('0x3f')]({},_0x130cf1,_0x40c218[_0x150d('0x40')]);return _0x5f4679[_0x150d('0x55')](_0x130cf1);}})[_0x150d('0x26')](function(_0x184590){if(_0x184590){_0x758c49=_0x184590[_0x150d('0x36')];if(!_0x40c218[_0x150d('0x32')]['hasOwnProperty'](_0x150d('0x38'))){_0x130cf1[_0x150d('0x1e')]=qs[_0x150d('0x1e')](_0x40c218[_0x150d('0x32')][_0x150d('0x1e')]);_0x130cf1['offset']=qs[_0x150d('0x1c')](_0x40c218['query'][_0x150d('0x1c')]);}return _0x5f4679[_0x150d('0x55')](_0x130cf1);}})[_0x150d('0x26')](function(_0x278359){if(_0x278359){return _0x278359?{'count':_0x758c49,'rows':_0x278359}:null;}})[_0x150d('0x26')](respondWithResult(_0x533b5c,null))[_0x150d('0x42')](handleError(_0x533b5c,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index 3200785..f45e2ef 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 _0xc470=['moment','bluebird','path','rimraf','../../config/environment','./cmCompany.attributes','exports','define','CmCompany','cm_companies','lodash','../../config/logger','api'];(function(_0x3bd982,_0x111b09){var _0x2f15ca=function(_0x434fb6){while(--_0x434fb6){_0x3bd982['push'](_0x3bd982['shift']());}};_0x2f15ca(++_0x111b09);}(_0xc470,0x7f));var _0x0c47=function(_0x2d1f6f,_0x239dec){_0x2d1f6f=_0x2d1f6f-0x0;var _0x2b8c80=_0xc470[_0x2d1f6f];return _0x2b8c80;};'use strict';var _=require(_0x0c47('0x0'));var util=require('util');var logger=require(_0x0c47('0x1'))(_0x0c47('0x2'));var moment=require(_0x0c47('0x3'));var BPromise=require(_0x0c47('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0c47('0x5'));var rimraf=require(_0x0c47('0x6'));var config=require(_0x0c47('0x7'));var attributes=require(_0x0c47('0x8'));module[_0x0c47('0x9')]=function(_0x52b1ca,_0x5f0674){return _0x52b1ca[_0x0c47('0xa')](_0x0c47('0xb'),attributes,{'tableName':_0x0c47('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x507a=['./cmCompany.attributes','exports','CmCompany','lodash','util','api','request-promise','path','rimraf','../../config/environment'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x507a,0xd5));var _0xa507=function(_0x554356,_0x475a85){_0x554356=_0x554356-0x0;var _0x29b1db=_0x507a[_0x554356];return _0x29b1db;};'use strict';var _=require(_0xa507('0x0'));var util=require(_0xa507('0x1'));var logger=require('../../config/logger')(_0xa507('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa507('0x3'));var fs=require('fs');var path=require(_0xa507('0x4'));var rimraf=require(_0xa507('0x5'));var config=require(_0xa507('0x6'));var attributes=require(_0xa507('0x7'));module[_0xa507('0x8')]=function(_0x420cd1,_0x21e238){return _0x420cd1['define'](_0xa507('0x9'),attributes,{'tableName':'cm_companies','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.rpc.js b/server/api/cmCompany/cmCompany.rpc.js index e12fca7..639fbf6 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 _0xec5f=['then','request\x20sent','CmCompany,\x20%s,\x20%s,\x20%s','stringify','code','error','message','CmCompany,\x20%s,\x20%s','info','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0xec5f,0xfd));var _0xfec5=function(_0xfec2bc,_0x18e5b4){_0xfec2bc=_0xfec2bc-0x0;var _0x5114c9=_0xec5f[_0xfec2bc];return _0x5114c9;};'use strict';var _=require(_0xfec5('0x0'));var util=require(_0xfec5('0x1'));var moment=require(_0xfec5('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfec5('0x3'));var db=require(_0xfec5('0x4'))['db'];var utils=require(_0xfec5('0x5'));var logger=require(_0xfec5('0x6'))(_0xfec5('0x7'));var config=require(_0xfec5('0x8'));var jayson=require(_0xfec5('0x9'));var client=jayson['client'][_0xfec5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4bad43,_0x1c7fc7,_0x352640){return new BPromise(function(_0x128d02,_0x22260d){return client['request'](_0x4bad43,_0x352640)[_0xfec5('0xb')](function(_0x1bd404){logger['info']('CmCompany,\x20%s,\x20%s',_0x1c7fc7,_0xfec5('0xc'));logger['debug'](_0xfec5('0xd'),_0x1c7fc7,_0xfec5('0xc'),JSON[_0xfec5('0xe')](_0x1bd404));if(_0x1bd404['error']){if(_0x1bd404['error'][_0xfec5('0xf')]===0x1f4){logger['error']('CmCompany,\x20%s,\x20%s',_0x1c7fc7,_0x1bd404[_0xfec5('0x10')][_0xfec5('0x11')]);return _0x22260d(_0x1bd404[_0xfec5('0x10')]['message']);}logger[_0xfec5('0x10')](_0xfec5('0x12'),_0x1c7fc7,_0x1bd404[_0xfec5('0x10')][_0xfec5('0x11')]);return _0x128d02(_0x1bd404[_0xfec5('0x10')]['message']);}else{logger[_0xfec5('0x13')](_0xfec5('0x12'),_0x1c7fc7,_0xfec5('0xc'));_0x128d02(_0x1bd404[_0xfec5('0x14')][_0xfec5('0x11')]);}})[_0xfec5('0x15')](function(_0x18043b){logger[_0xfec5('0x10')](_0xfec5('0x12'),_0x1c7fc7,_0x18043b);_0x22260d(_0x18043b);});});} \ No newline at end of file +var _0x1939=['stringify','error','code','message','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','CmCompany,\x20%s,\x20%s','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s'];(function(_0x2d1c84,_0x392bfb){var _0xcd966f=function(_0x3d8d6f){while(--_0x3d8d6f){_0x2d1c84['push'](_0x2d1c84['shift']());}};_0xcd966f(++_0x392bfb);}(_0x1939,0x1bd));var _0x9193=function(_0x5f5495,_0x30d087){_0x5f5495=_0x5f5495-0x0;var _0x14d8a3=_0x1939[_0x5f5495];return _0x14d8a3;};'use strict';var _=require(_0x9193('0x0'));var util=require(_0x9193('0x1'));var moment=require('moment');var BPromise=require(_0x9193('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9193('0x3'));var db=require(_0x9193('0x4'))['db'];var utils=require(_0x9193('0x5'));var logger=require('../../config/logger')(_0x9193('0x6'));var config=require(_0x9193('0x7'));var jayson=require(_0x9193('0x8'));var client=jayson[_0x9193('0x9')][_0x9193('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x21215e,_0x14466b,_0x305d33){return new BPromise(function(_0xb3fbb3,_0x4377c5){return client[_0x9193('0xb')](_0x21215e,_0x305d33)['then'](function(_0x4ea985){logger[_0x9193('0xc')](_0x9193('0xd'),_0x14466b,_0x9193('0xe'));logger[_0x9193('0xf')](_0x9193('0x10'),_0x14466b,'request\x20sent',JSON[_0x9193('0x11')](_0x4ea985));if(_0x4ea985[_0x9193('0x12')]){if(_0x4ea985['error'][_0x9193('0x13')]===0x1f4){logger[_0x9193('0x12')](_0x9193('0xd'),_0x14466b,_0x4ea985[_0x9193('0x12')]['message']);return _0x4377c5(_0x4ea985[_0x9193('0x12')][_0x9193('0x14')]);}logger['error'](_0x9193('0xd'),_0x14466b,_0x4ea985[_0x9193('0x12')][_0x9193('0x14')]);return _0xb3fbb3(_0x4ea985['error']['message']);}else{logger[_0x9193('0xc')](_0x9193('0xd'),_0x14466b,_0x9193('0xe'));_0xb3fbb3(_0x4ea985['result'][_0x9193('0x14')]);}})[_0x9193('0x15')](function(_0x326656){logger['error'](_0x9193('0xd'),_0x14466b,_0x326656);_0x4377c5(_0x326656);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index de5fda2..326bcbe 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 _0x82ee=['destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','index','/describe','describe','/:id','isAuthenticated','show','getContacts','post','/:id/contacts','addContacts','put'];(function(_0x1c7afe,_0x449cd2){var _0x12dbd3=function(_0x10839f){while(--_0x10839f){_0x1c7afe['push'](_0x1c7afe['shift']());}};_0x12dbd3(++_0x449cd2);}(_0x82ee,0x18d));var _0xe82e=function(_0x21db2d,_0x355678){_0x21db2d=_0x21db2d-0x0;var _0x3f0c31=_0x82ee[_0x21db2d];return _0x3f0c31;};'use strict';var multer=require(_0xe82e('0x0'));var util=require(_0xe82e('0x1'));var path=require(_0xe82e('0x2'));var timeout=require(_0xe82e('0x3'));var express=require(_0xe82e('0x4'));var router=express[_0xe82e('0x5')]();var fs_extra=require(_0xe82e('0x6'));var auth=require(_0xe82e('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xe82e('0x8'));var controller=require('./cmCompany.controller');router[_0xe82e('0x9')]('/',auth['isAuthenticated'](),controller[_0xe82e('0xa')]);router[_0xe82e('0x9')](_0xe82e('0xb'),auth['isAuthenticated'](),controller[_0xe82e('0xc')]);router['get'](_0xe82e('0xd'),auth[_0xe82e('0xe')](),controller[_0xe82e('0xf')]);router[_0xe82e('0x9')]('/:id/contacts',auth[_0xe82e('0xe')](),controller[_0xe82e('0x10')]);router[_0xe82e('0x11')]('/',auth['isAuthenticated'](),controller['create']);router[_0xe82e('0x11')](_0xe82e('0x12'),auth[_0xe82e('0xe')](),controller[_0xe82e('0x13')]);router[_0xe82e('0x14')](_0xe82e('0xd'),auth[_0xe82e('0xe')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xe82e('0x15')]);module['exports']=router; \ No newline at end of file +var _0xdb6b=['put','update','delete','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCompany.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/contacts','getContacts','post','create','addContacts'];(function(_0x1cc7db,_0x476c8a){var _0x3c8e41=function(_0x56c776){while(--_0x56c776){_0x1cc7db['push'](_0x1cc7db['shift']());}};_0x3c8e41(++_0x476c8a);}(_0xdb6b,0xfd));var _0xbdb6=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xdb6b[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0xbdb6('0x0'));var util=require(_0xbdb6('0x1'));var path=require('path');var timeout=require(_0xbdb6('0x2'));var express=require(_0xbdb6('0x3'));var router=express[_0xbdb6('0x4')]();var fs_extra=require(_0xbdb6('0x5'));var auth=require(_0xbdb6('0x6'));var interaction=require(_0xbdb6('0x7'));var config=require(_0xbdb6('0x8'));var controller=require(_0xbdb6('0x9'));router[_0xbdb6('0xa')]('/',auth[_0xbdb6('0xb')](),controller[_0xbdb6('0xc')]);router[_0xbdb6('0xa')](_0xbdb6('0xd'),auth[_0xbdb6('0xb')](),controller[_0xbdb6('0xe')]);router['get'](_0xbdb6('0xf'),auth['isAuthenticated'](),controller[_0xbdb6('0x10')]);router['get'](_0xbdb6('0x11'),auth['isAuthenticated'](),controller[_0xbdb6('0x12')]);router[_0xbdb6('0x13')]('/',auth[_0xbdb6('0xb')](),controller[_0xbdb6('0x14')]);router['post']('/:id/contacts',auth[_0xbdb6('0xb')](),controller[_0xbdb6('0x15')]);router[_0xbdb6('0x16')]('/:id',auth['isAuthenticated'](),controller[_0xbdb6('0x17')]);router[_0xbdb6('0x18')]('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index 7be0cd6..4e42362 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 _0xbcfb=['sequelize','exports','STRING','INTEGER','UNSIGNED','DATE'];(function(_0x296809,_0x1c9665){var _0x18c0d3=function(_0x249156){while(--_0x249156){_0x296809['push'](_0x296809['shift']());}};_0x18c0d3(++_0x1c9665);}(_0xbcfb,0xfc));var _0xbbcf=function(_0x2daef6,_0xcac228){_0x2daef6=_0x2daef6-0x0;var _0x62d030=_0xbcfb[_0x2daef6];return _0x62d030;};'use strict';var _=require('lodash');var Sequelize=require(_0xbbcf('0x0'));module[_0xbbcf('0x1')]={'firstName':{'type':Sequelize[_0xbbcf('0x2')],'allowNull':![]},'lastName':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0xbbcf('0x2')]},'postalCode':{'type':Sequelize[_0xbbcf('0x2')]},'city':{'type':Sequelize[_0xbbcf('0x2')]},'country':{'type':Sequelize[_0xbbcf('0x2')]},'dateOfBirth':{'type':Sequelize[_0xbbcf('0x2')]},'description':{'type':Sequelize['TEXT']},'phone':{'type':Sequelize[_0xbbcf('0x2')]},'mobile':{'type':Sequelize[_0xbbcf('0x2')]},'fax':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0xbbcf('0x2')]},'url':{'type':Sequelize['STRING']},'facebook':{'type':Sequelize[_0xbbcf('0x2')]},'fb_data':{'type':Sequelize[_0xbbcf('0x2')]},'twitter':{'type':Sequelize['STRING']},'skype':{'type':Sequelize['STRING']},'teams':{'type':Sequelize[_0xbbcf('0x2')]},'viber':{'type':Sequelize['STRING']},'line':{'type':Sequelize[_0xbbcf('0x2')]},'wechat':{'type':Sequelize[_0xbbcf('0x2')]},'telegram':{'type':Sequelize[_0xbbcf('0x2')]},'UserId':{'type':Sequelize['INTEGER']},'AdditionalPhones':{'type':Sequelize[_0xbbcf('0x2')]},'priority':{'type':Sequelize[_0xbbcf('0x3')](0x2)[_0xbbcf('0x4')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0xbbcf('0x5')],'defaultValue':Sequelize['NOW']},'dialTimezone':{'type':Sequelize[_0xbbcf('0x2')]},'utcOffset':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x027b=['exports','STRING','TEXT','DATE','NOW','INTEGER'];(function(_0x5ab348,_0x5ea1a5){var _0x580f2f=function(_0x3ed1c5){while(--_0x3ed1c5){_0x5ab348['push'](_0x5ab348['shift']());}};_0x580f2f(++_0x5ea1a5);}(_0x027b,0x198));var _0xb027=function(_0x3a0503,_0x112bc1){_0x3a0503=_0x3a0503-0x0;var _0x5d2d4b=_0x027b[_0x3a0503];return _0x5d2d4b;};'use strict';var _=require('lodash');var Sequelize=require('sequelize');module[_0xb027('0x0')]={'firstName':{'type':Sequelize[_0xb027('0x1')],'allowNull':![]},'lastName':{'type':Sequelize[_0xb027('0x1')]},'street':{'type':Sequelize[_0xb027('0x1')]},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0xb027('0x1')]},'country':{'type':Sequelize[_0xb027('0x1')]},'dateOfBirth':{'type':Sequelize[_0xb027('0x1')]},'description':{'type':Sequelize[_0xb027('0x2')]},'phone':{'type':Sequelize[_0xb027('0x1')]},'mobile':{'type':Sequelize[_0xb027('0x1')]},'fax':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0xb027('0x1')]},'url':{'type':Sequelize[_0xb027('0x1')]},'facebook':{'type':Sequelize['STRING']},'fb_data':{'type':Sequelize['STRING']},'twitter':{'type':Sequelize[_0xb027('0x1')]},'skype':{'type':Sequelize[_0xb027('0x1')]},'teams':{'type':Sequelize[_0xb027('0x1')]},'viber':{'type':Sequelize[_0xb027('0x1')]},'line':{'type':Sequelize['STRING']},'wechat':{'type':Sequelize[_0xb027('0x1')]},'telegram':{'type':Sequelize[_0xb027('0x1')]},'UserId':{'type':Sequelize['INTEGER']},'AdditionalPhones':{'type':Sequelize[_0xb027('0x1')]},'priority':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0xb027('0x3')],'defaultValue':Sequelize[_0xb027('0x4')]},'dialTimezone':{'type':Sequelize[_0xb027('0x1')]},'utcOffset':{'type':Sequelize[_0xb027('0x5')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index bc06aff..acb14ff 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 _0xe2d1=['join','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatMessage','ChatOfflineMessage','MailMessage','MailInteraction','FaxInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmContactHasItem','CmHopperFinal','CmHopperHistory','VoiceCallReport','FaxQueueReport','MailQueueReport','SmsQueueReport','JscriptySessionReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','isNil','dialTimezone','timezones','additionalPhones','bulkCreate','each','duplicates','where','$or','push','ListId','findOrCreate','spread','contact','show','Tag','color','tag','Phones','ContactItemType','ItemType','sequelize','Phones.OrderBy','$and','omit','format','cf_%d','utcOffset','startsWith','map','cm_contacts','setFields','id\x20=\x20?','toParam','text','phone','getTags','findOne','rawAttributes','intersection','model','attributes','fields','order','sort','pick','filters','merge','filter','options','nolimit','setTags','ids','setAdditionalPhones','all','item_types','items','ItemTypeId','description','CmHopperAdditionalPhone','OrderBy','`ItemType`.OrderBy','getAdditionalPhones','PHONE','literal','duplicateAdditionalPhones','fromContactId','toContactId','hopperId','getHoppers','ContactId','include','getHopperHistories','includeAll','rows','getHopperFinals','getJscriptySessions','uploadCsv','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','binding_values','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','split','Incorrect\x20binding\x20parameters\x20passed!','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','root','server/files/tmp','filename','fork','../../components/import/cm/csv','socket_timestamp','pid','send','createReadStream','parse','file','meta','import','agent','binding','../../components/import/cm/csv2','stringify','message','start\x20child\x20process\x20correctly!','exit','error\x20child\x20process','importUpdates','User','child_process','../../components/import/cm/csvUpdates','getJourney','mail','sms','whatsapp','voice','-createdAt','resolve','channel','includes','toLowerCase','Invalid\x20channel','range','isValid','Invalid\x20date\x20for\x20range\x20from\x20filter','Invalid\x20date\x20for\x20range\x20to\x20filter','uniqueid','source','callerid','starttime','endtime','duration','createdAt','userDisposition','userThirdDisposition','UserId','fullname','DESC','findAndCountAll','startCase','chat','Account','closedAt','disposition','secondDisposition','thirdDisposition','Tags','browserName','customerPort','deviceModel','osName','ratingMessage','ratingType','referer','subject','openchannel','externalUrl','Interaction','Owner','sortBy','reverse','value','moment','util','path','lodash','squel','papaparse','ioredis','../../components/contacts','../../config/logger','api','../../config/environment','../../config/environment/shared','../../mysqldb','redis','localhost','register','status','json','undefined','limit','count','offset','set','update','then','destroy','end','sendStatus','error','stack','name','describe','getOptions','findAll','CmContact','find','params','catch','keys','cf_','columnName','displayName','query','analytics','CmCustomField','length','alias','custom','type','values','info','Custom\x20field\x20%s\x20not\x20found\x20on\x20cm_contacts\x20table','forEach','hasOwnProperty','body','from','get','mergeWith','isArray','tags'];(function(_0x2fd209,_0x4e480c){var _0x37742e=function(_0x546663){while(--_0x546663){_0x2fd209['push'](_0x2fd209['shift']());}};_0x37742e(++_0x4e480c);}(_0xe2d1,0xbd));var _0x1e2d=function(_0x418d71,_0x144047){_0x418d71=_0x418d71-0x0;var _0x469ed3=_0xe2d1[_0x418d71];return _0x469ed3;};'use strict';var moment=require(_0x1e2d('0x0'));var BPromise=require('bluebird');var util=require(_0x1e2d('0x1'));var path=require(_0x1e2d('0x2'));var fs=require('fs');var _=require(_0x1e2d('0x3'));var squel=require(_0x1e2d('0x4'));var Papa=require(_0x1e2d('0x5'));var Redis=require(_0x1e2d('0x6'));var contacts=require(_0x1e2d('0x7'));var qs=require('../../components/parsers/qs');var logger=require(_0x1e2d('0x8'))(_0x1e2d('0x9'));var config=require(_0x1e2d('0xa'));var shared=require(_0x1e2d('0xb'));var db=require(_0x1e2d('0xc'))['db'];config['redis']=_['defaults'](config[_0x1e2d('0xd')],{'host':_0x1e2d('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1e2d('0xd')]));require('./cmContact.socket')[_0x1e2d('0xf')](socket);function respondWithResult(_0x4c9a42,_0x538230){_0x538230=_0x538230||0xc8;return function(_0x116dec){if(_0x116dec){return _0x4c9a42[_0x1e2d('0x10')](_0x538230)[_0x1e2d('0x11')](_0x116dec);}};}function respondWithFilteredResult(_0x12f0fa,_0x595887){return function(_0x5af967){if(_0x5af967){var _0x4a2a8d=typeof _0x595887['offset']===_0x1e2d('0x12')&&typeof _0x595887[_0x1e2d('0x13')]===_0x1e2d('0x12');var _0x2d48c8=_0x5af967[_0x1e2d('0x14')];var _0x3be34e=_0x4a2a8d?0x0:_0x595887[_0x1e2d('0x15')];var _0x9f8a32=_0x4a2a8d?_0x5af967[_0x1e2d('0x14')]:_0x595887[_0x1e2d('0x15')]+_0x595887[_0x1e2d('0x13')];var _0x35e293;if(_0x9f8a32>=_0x2d48c8){_0x9f8a32=_0x2d48c8;_0x35e293=0xc8;}else{_0x35e293=0xce;}_0x12f0fa['status'](_0x35e293);return _0x12f0fa[_0x1e2d('0x16')]('Content-Range',_0x3be34e+'-'+_0x9f8a32+'/'+_0x2d48c8)[_0x1e2d('0x11')](_0x5af967);}return null;};}function saveUpdates(_0x498d22){return function(_0x5b695e){if(_0x5b695e){return _0x5b695e[_0x1e2d('0x17')](_0x498d22)[_0x1e2d('0x18')](function(_0x40ff85){return _0x40ff85;});}return null;};}function removeEntity(_0x3c0133){return function(_0x20f8fa){if(_0x20f8fa){return _0x20f8fa[_0x1e2d('0x19')]()[_0x1e2d('0x18')](function(){_0x3c0133[_0x1e2d('0x10')](0xcc)[_0x1e2d('0x1a')]();});}};}function handleEntityNotFound(_0x42385f){return function(_0x1a4fbd){if(!_0x1a4fbd){_0x42385f[_0x1e2d('0x1b')](0x194);}return _0x1a4fbd;};}function handleError(_0x47aa6c,_0x4771e8){_0x4771e8=_0x4771e8||0x1f4;return function(_0x1209b9){logger[_0x1e2d('0x1c')](_0x1209b9[_0x1e2d('0x1d')]);if(_0x1209b9[_0x1e2d('0x1e')]){delete _0x1209b9[_0x1e2d('0x1e')];}_0x47aa6c[_0x1e2d('0x10')](_0x4771e8)['send'](_0x1209b9);};}exports['index']=function(_0x3e240e,_0xe2e9be){var _0x1434fd={};return contacts[_0x1e2d('0x1f')]()[_0x1e2d('0x18')](function(_0x12a011){_0x1434fd=qs[_0x1e2d('0x20')](_0x12a011,_0x3e240e);return contacts[_0x1e2d('0x21')](_0x3e240e['query'],_0x3e240e['user'],_0x1434fd,_0x12a011);})[_0x1e2d('0x18')](respondWithFilteredResult(_0xe2e9be,_0x1434fd))['catch'](handleError(_0xe2e9be,null));};exports[_0x1e2d('0x19')]=function(_0x4ebcb9,_0x5589ac){return db[_0x1e2d('0x22')][_0x1e2d('0x23')]({'where':{'id':_0x4ebcb9[_0x1e2d('0x24')]['id']}})[_0x1e2d('0x18')](handleEntityNotFound(_0x5589ac,null))[_0x1e2d('0x18')](removeEntity(_0x5589ac,null))[_0x1e2d('0x25')](handleError(_0x5589ac,null));};exports[_0x1e2d('0x1f')]=function(_0x4788e8,_0x229449){return db[_0x1e2d('0x22')]['describe']()[_0x1e2d('0x18')](function(_0x4b67ba){delete _0x4b67ba['tags'];for(var _0x2acaf5=0x0;_0x2acaf50x0){return new Promise(function(_0x17907e){var _0x378bec=[];for(var _0x339c3f=0x0;_0x339c3f<_0x2b3a0a[_0x1e2d('0x2d')];_0x339c3f++){_0x378bec[_0x1e2d('0x5e')](insertAdditionalPhones(_0x2b3a0a[_0x339c3f][_0x1e2d('0x62')],_0x2b3a0a[_0x339c3f][_0x1e2d('0x58')]));}Promise['all'](_0x378bec)[_0x1e2d('0x18')](function(){_0x17907e(0x1);});})['then'](function(){return{'success':_0x5a4dc9,'failure':_0x4dad94,'duplicates':_0x175ef8};});}else{return{'success':_0x5a4dc9,'failure':_0x4dad94,'duplicates':_0x175ef8};}}})[_0x1e2d('0x18')](respondWithResult(_0x349064,0xc9))['catch'](handleError(_0x349064,null));};exports[_0x1e2d('0x63')]=function(_0x3ae0ed,_0x201e79){var _0x2818bd;return db['CmContact'][_0x1e2d('0x1f')]()[_0x1e2d('0x18')](function(_0x24704d){return db[_0x1e2d('0x22')][_0x1e2d('0x23')]({'where':{'id':_0x3ae0ed[_0x1e2d('0x24')]['id']},'include':[{'model':db[_0x1e2d('0x64')],'as':'Tags','attributes':['id',_0x1e2d('0x1e'),_0x1e2d('0x65')],'required':_0x3ae0ed[_0x1e2d('0x2a')][_0x1e2d('0x66')]?!![]:![]},{'model':db[_0x1e2d('0x4a')],'as':_0x1e2d('0x67'),'where':{'CmContactId':_0x3ae0ed[_0x1e2d('0x24')]['id']},'required':![],'include':[{'model':db[_0x1e2d('0x68')],'as':_0x1e2d('0x69')}]}],'order':[db[_0x1e2d('0x6a')]['literal'](_0x1e2d('0x6b'))],'attributes':_['keys'](_0x24704d)});})['then'](function(_0x614c0){if(!_['isNil'](_0x614c0)){_0x2818bd=_0x614c0[_0x1e2d('0x38')]({'plain':!![]});var _0xc91c21={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x614c0&&_0x614c0[_0x1e2d('0x5f')]){if(_0x614c0[_0x1e2d('0x5f')]){_0xc91c21['where'][_0x1e2d('0x6c')][_0x1e2d('0x5e')]({'ListId':{'$ne':_0x614c0[_0x1e2d('0x5f')]}});}}return db[_0x1e2d('0x2c')][_0x1e2d('0x21')](_0xc91c21);}})[_0x1e2d('0x18')](function(_0x3e7eab){if(!_['isNil'](_0x3e7eab)){return _[_0x1e2d('0x6d')](_0x2818bd,_['map'](_0x3e7eab,function(_0x277fdf){return util[_0x1e2d('0x6e')](_0x1e2d('0x6f'),_0x277fdf['id']);}));}})[_0x1e2d('0x18')](handleEntityNotFound(_0x201e79,null))[_0x1e2d('0x18')](respondWithResult(_0x201e79,null))[_0x1e2d('0x25')](handleError(_0x201e79,null));};exports['update']=function(_0x196d78,_0x5c1ba9){var _0x764e55;if(_0x196d78[_0x1e2d('0x36')]['id']){delete _0x196d78['body']['id'];}if(!_[_0x1e2d('0x55')](_0x196d78[_0x1e2d('0x36')][_0x1e2d('0x56')])){var _0x4bc199=_0x196d78[_0x1e2d('0x36')][_0x1e2d('0x56')];if(!_[_0x1e2d('0x55')](shared[_0x1e2d('0x57')][_0x4bc199]))_0x196d78[_0x1e2d('0x36')][_0x1e2d('0x70')]=shared['timezones'][_0x4bc199][_0x1e2d('0x70')];}return db['CmContact'][_0x1e2d('0x23')]({'where':{'id':_0x196d78['params']['id']}})[_0x1e2d('0x18')](handleEntityNotFound(_0x5c1ba9,null))['then'](saveUpdates(_0x196d78[_0x1e2d('0x36')],null))[_0x1e2d('0x18')](function(_0x1f1223){_0x764e55=_0x1f1223;var _0x2a69cf={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x1f1223&&_0x1f1223[_0x1e2d('0x5f')]){if(_0x1f1223['ListId']){_0x2a69cf[_0x1e2d('0x5c')]['$and']['push']({'ListId':{'$ne':_0x1f1223['ListId']}});}}return db[_0x1e2d('0x2c')][_0x1e2d('0x21')](_0x2a69cf);})['then'](function(_0x2ab75f){if(_0x2ab75f){return _[_0x1e2d('0x6d')](_['pickBy'](_0x196d78[_0x1e2d('0x36')],function(_0x487277,_0x249958){return _[_0x1e2d('0x71')](_0x249958,_0x1e2d('0x27'));}),_[_0x1e2d('0x72')](_0x2ab75f,function(_0x4ed022){return util['format']('cf_%d',_0x4ed022['id']);}));}})[_0x1e2d('0x18')](function(_0x1c7509){if(_0x1c7509&&!_['isEmpty'](_0x1c7509)){var _0x309a58=squel[_0x1e2d('0x17')]()['table'](_0x1e2d('0x73'))[_0x1e2d('0x74')](_0x1c7509)[_0x1e2d('0x5c')](_0x1e2d('0x75'),_0x196d78[_0x1e2d('0x24')]['id'])[_0x1e2d('0x76')]();return db[_0x1e2d('0x6a')][_0x1e2d('0x2a')](_0x309a58[_0x1e2d('0x77')],{'replacements':_0x309a58[_0x1e2d('0x31')]});}})[_0x1e2d('0x18')](function(){if(_0x196d78[_0x1e2d('0x36')][_0x1e2d('0x78')]&&_0x764e55){return db['CmHopper'][_0x1e2d('0x17')]({'phone':_0x196d78[_0x1e2d('0x36')]['phone'],'OrderBy':0x0},{'where':{'ContactId':_0x764e55['id']}});}})[_0x1e2d('0x18')](function(){return _0x764e55;})['then'](respondWithResult(_0x5c1ba9,null))['catch'](handleError(_0x5c1ba9,null));};exports[_0x1e2d('0x79')]=function(_0x11f40a,_0x5abd4f){var _0x24454b={};var _0x3ffca9={};var _0x5d9cef;var _0x2b276b;return db[_0x1e2d('0x22')][_0x1e2d('0x7a')]({'where':{'id':_0x11f40a['params']['id']}})[_0x1e2d('0x18')](handleEntityNotFound(_0x5abd4f,null))[_0x1e2d('0x18')](function(_0x1f6b2c){if(_0x1f6b2c){_0x5d9cef=_0x1f6b2c;_0x3ffca9['model']=_[_0x1e2d('0x26')](db['Tag'][_0x1e2d('0x7b')]);_0x3ffca9[_0x1e2d('0x2a')]=_[_0x1e2d('0x26')](_0x11f40a[_0x1e2d('0x2a')]);_0x3ffca9['filters']=_[_0x1e2d('0x7c')](_0x3ffca9[_0x1e2d('0x7d')],_0x3ffca9[_0x1e2d('0x2a')]);_0x24454b[_0x1e2d('0x7e')]=_[_0x1e2d('0x7c')](_0x3ffca9['model'],qs[_0x1e2d('0x7f')](_0x11f40a['query'][_0x1e2d('0x7f')]));_0x24454b[_0x1e2d('0x7e')]=_0x24454b['attributes'][_0x1e2d('0x2d')]?_0x24454b[_0x1e2d('0x7e')]:_0x3ffca9[_0x1e2d('0x7d')];_0x24454b[_0x1e2d('0x80')]=qs[_0x1e2d('0x81')](_0x11f40a[_0x1e2d('0x2a')][_0x1e2d('0x81')]);_0x24454b['where']=qs['filters'](_[_0x1e2d('0x82')](_0x11f40a[_0x1e2d('0x2a')],_0x3ffca9[_0x1e2d('0x83')]));if(_0x11f40a[_0x1e2d('0x2a')]['filter']){_0x24454b[_0x1e2d('0x5c')]=_[_0x1e2d('0x84')](_0x24454b[_0x1e2d('0x5c')],{'$or':_[_0x1e2d('0x72')](_0x24454b[_0x1e2d('0x7e')],function(_0x20dfb6){var _0x200f27={};_0x200f27[_0x20dfb6]={'$like':'%'+_0x11f40a[_0x1e2d('0x2a')][_0x1e2d('0x85')]+'%'};return _0x200f27;})});}_0x24454b=_[_0x1e2d('0x84')]({},_0x24454b,_0x11f40a[_0x1e2d('0x86')]);return _0x5d9cef['getTags'](_0x24454b);}})[_0x1e2d('0x18')](function(_0x346566){if(_0x346566){_0x2b276b=_0x346566['length'];if(!_0x11f40a[_0x1e2d('0x2a')][_0x1e2d('0x35')](_0x1e2d('0x87'))){_0x24454b[_0x1e2d('0x13')]=qs[_0x1e2d('0x13')](_0x11f40a[_0x1e2d('0x2a')][_0x1e2d('0x13')]);_0x24454b[_0x1e2d('0x15')]=qs[_0x1e2d('0x15')](_0x11f40a[_0x1e2d('0x2a')][_0x1e2d('0x15')]);}return _0x5d9cef[_0x1e2d('0x79')](_0x24454b);}})['then'](function(_0x2897f2){if(_0x2897f2){return _0x2897f2?{'count':_0x2b276b,'rows':_0x2897f2}:null;}})[_0x1e2d('0x18')](respondWithResult(_0x5abd4f,null))[_0x1e2d('0x25')](handleError(_0x5abd4f,null));};exports[_0x1e2d('0x88')]=function(_0x513bae,_0x55ac7b){if(_0x513bae[_0x1e2d('0x36')]['id']){delete _0x513bae[_0x1e2d('0x36')]['id'];}return db[_0x1e2d('0x22')]['findOne']({'where':{'id':_0x513bae[_0x1e2d('0x24')]['id']}})['then'](handleEntityNotFound(_0x55ac7b,null))['then'](function(_0x3ea50d){if(_0x3ea50d){return _0x3ea50d[_0x1e2d('0x88')](_0x513bae[_0x1e2d('0x36')][_0x1e2d('0x89')]||[]);}return null;})[_0x1e2d('0x18')](respondWithResult(_0x55ac7b,null))[_0x1e2d('0x25')](handleError(_0x55ac7b,null));};exports[_0x1e2d('0x8a')]=function(_0x13b239,_0x18e13c){var _0x10f30f=[];_0x10f30f[_0x1e2d('0x5e')](addAdditionalPhones(_0x13b239[_0x1e2d('0x36')]));Promise[_0x1e2d('0x8b')](_0x10f30f)[_0x1e2d('0x18')](function(){_0x10f30f=[];_0x10f30f[_0x1e2d('0x5e')](deleteCmHopperPhones(_0x13b239[_0x1e2d('0x36')]['id']));_0x10f30f['push'](addCmHopperPhones(_0x13b239[_0x1e2d('0x36')]['id']));Promise[_0x1e2d('0x8b')](_0x10f30f)[_0x1e2d('0x18')](function(){return[0x1];})[_0x1e2d('0x18')](respondWithResult(_0x18e13c,null));});};function addAdditionalPhones(_0x5e00f7){var _0x1da346;return new Promise(function(_0x2c95b5){return db[_0x1e2d('0x4a')][_0x1e2d('0x19')]({'where':{'CmContactId':_0x5e00f7['id']}})['then'](function(){db[_0x1e2d('0x68')][_0x1e2d('0x21')]({'raw':!![],'attributes':['id','OrderBy']})[_0x1e2d('0x18')](function(_0x2933f2){var _0x5df1d3=[];for(var _0x4049b8=0x0;_0x4049b8<_0x5e00f7['items'][_0x1e2d('0x2d')];_0x4049b8++){var _0x351d80=_0x5e00f7[_0x1e2d('0x8c')]?_[_0x1e2d('0x55')](_0x5e00f7[_0x1e2d('0x8c')][_0x4049b8])?'':_0x5e00f7[_0x1e2d('0x8c')][_0x4049b8]:_0x5e00f7[_0x1e2d('0x8d')][_0x4049b8][_0x1e2d('0x8e')]?_0x5e00f7[_0x1e2d('0x8d')][_0x4049b8]['ItemTypeId']:'';var _0x2223e0=_['isNil'](_0x5e00f7[_0x1e2d('0x8d')][_0x4049b8]['description'])?'':_0x5e00f7['items'][_0x4049b8][_0x1e2d('0x8f')];var _0x27f7bd=_0x351d80+':'+_0x5e00f7[_0x1e2d('0x8d')][_0x4049b8][_0x1e2d('0x78')]+'§'+_0x2223e0;if(_['isNil'](_0x1da346))_0x1da346=_0x27f7bd;else _0x1da346+=';'+_0x27f7bd;var _0x47f245=null;var _0x1a5c59=null;if(_0x5e00f7[_0x1e2d('0x8c')]){if(!_[_0x1e2d('0x55')](_0x5e00f7['item_types'][_0x4049b8])){_0x1a5c59=_[_0x1e2d('0x23')](_0x2933f2,function(_0x3a8da4){return _0x3a8da4['id']===_0x5e00f7[_0x1e2d('0x8c')][_0x4049b8];});if(!_[_0x1e2d('0x55')](_0x1a5c59)){_0x47f245=_0x1a5c59['OrderBy'];}}}else{if(!_['isNil'](_0x5e00f7['items'][_0x4049b8])){_0x1a5c59=_[_0x1e2d('0x23')](_0x2933f2,function(_0x29af22){return _0x29af22['id']===_0x5e00f7[_0x1e2d('0x8d')][_0x4049b8][_0x1e2d('0x8e')];});if(!_['isNil'](_0x1a5c59)){_0x47f245=_0x4049b8;}}}if(_[_0x1e2d('0x55')](_0x47f245)){_0x47f245=0x64;}_0x5df1d3[_0x1e2d('0x5e')](addAdditionalPhone(_0x5e00f7['id'],_0x5e00f7['items'][_0x4049b8][_0x1e2d('0x78')],_0x5e00f7['item_types']?_[_0x1e2d('0x55')](_0x5e00f7['item_types'][_0x4049b8])?null:_0x5e00f7[_0x1e2d('0x8c')][_0x4049b8]:_0x5e00f7[_0x1e2d('0x8d')][_0x4049b8][_0x1e2d('0x8e')]?_0x5e00f7[_0x1e2d('0x8d')][_0x4049b8]['ItemTypeId']:null,_0x47f245,_0x2223e0));}Promise[_0x1e2d('0x8b')](_0x5df1d3)[_0x1e2d('0x18')](function(){db[_0x1e2d('0x22')][_0x1e2d('0x17')]({'AdditionalPhones':_0x1da346},{'where':{'id':_0x5e00f7['id']}})[_0x1e2d('0x18')](function(){_0x2c95b5(0x1);});});});});});}function addAdditionalPhone(_0x13327a,_0x139225,_0x19292e,_0x38afb2,_0x449138){return db[_0x1e2d('0x4a')][_0x1e2d('0x23')]({'where':{'CmContactId':_0x13327a,'item':_0x139225}})[_0x1e2d('0x18')](function(_0xb04c8c){if(_0xb04c8c)logger[_0x1e2d('0x32')]('contact\x20phone\x20exists',_0xb04c8c);else{db[_0x1e2d('0x4a')][_0x1e2d('0x41')]({'CmContactId':_0x13327a,'item':_0x139225,'ItemTypeId':_0x19292e,'OrderBy':_0x38afb2,'ItemClass':'PHONE','description':_0x449138});}});}function deleteCmHopperPhones(_0x8d0862){return new Promise(function(_0x36c5ae){return db[_0x1e2d('0x3e')][_0x1e2d('0x21')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x8d0862}})['then'](function(_0x1ae775){db[_0x1e2d('0x90')][_0x1e2d('0x19')]({'where':{'CmHopperId':{'$in':_[_0x1e2d('0x72')](_0x1ae775,'id')}}});})[_0x1e2d('0x18')](function(){_0x36c5ae(0x1);});});}function addCmHopperPhones(_0x3b74c2){return new Promise(function(_0x460ae1){return db[_0x1e2d('0x3e')]['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x3b74c2}})[_0x1e2d('0x18')](function(_0x2eef27){var _0x1c3cf6=[];_[_0x1e2d('0x72')](_0x2eef27,function(_0x934544){_0x1c3cf6[_0x1e2d('0x5e')](createCmHopperPhone(_0x3b74c2,_0x934544['id']));});Promise['all'](_0x1c3cf6)[_0x1e2d('0x18')](function(){_0x460ae1(0x1);});});});}function createCmHopperPhone(_0x3e1458,_0x30e9ce){return new Promise(function(_0x23bb10){db[_0x1e2d('0x4a')][_0x1e2d('0x21')]({'raw':!![],'attributes':['item','OrderBy'],'where':{'CmContactId':_0x3e1458,'ItemClass':'PHONE'},'include':[{'model':db['ContactItemType'],'attributes':[_0x1e2d('0x91')],'as':_0x1e2d('0x69')}],'order':[_0x1e2d('0x91'),db[_0x1e2d('0x6a')]['literal'](_0x1e2d('0x92'))]})[_0x1e2d('0x18')](function(_0xcc6945){var _0x232f8b=0x1;var _0x5c7c79=_[_0x1e2d('0x72')](_0xcc6945,function(_0x68b58c){_0x68b58c['CmHopperId']=_0x30e9ce;_0x68b58c[_0x1e2d('0x78')]=_0x68b58c['item'];_0x68b58c['OrderBy']=_0x232f8b;delete _0x68b58c['ItemType.OrderBy'];_0x232f8b=_0x232f8b+0x1;return _0x68b58c;});return db[_0x1e2d('0x90')][_0x1e2d('0x59')](_0x5c7c79,{});})[_0x1e2d('0x18')](function(){_0x23bb10(0x1);});});}function insertAdditionalPhones(_0x552557,_0x10ef26){return new Promise(function(_0x45e08b){var _0x5a0f0e=[];for(var _0x30fdf4=0x0;_0x30fdf4<_0x10ef26[_0x1e2d('0x2d')];_0x30fdf4++){var _0x25b75c=_0x10ef26[_0x30fdf4];_0x5a0f0e['push'](parseContactItemType(_0x25b75c));}Promise[_0x1e2d('0x8b')](_0x5a0f0e)[_0x1e2d('0x18')](function(){var _0x4dde35={'id':_0x552557['id'],'items':_0x10ef26};return addAdditionalPhones(_0x4dde35)[_0x1e2d('0x18')](function(){return addCmHopperPhones(_0x552557['id']);});})[_0x1e2d('0x18')](function(){_0x45e08b(_0x552557);});});}function parseContactItemType(_0x3f80b6){return new Promise(function(_0x188460){if(_0x3f80b6['hasOwnProperty']('ItemTypeId')){_0x188460(_0x3f80b6);}else{return db[_0x1e2d('0x68')]['find']({'where':{'name':_0x3f80b6[_0x1e2d('0x69')]}})[_0x1e2d('0x18')](function(_0x3b1e1d){if(_[_0x1e2d('0x55')](_0x3b1e1d))_0x3f80b6[_0x1e2d('0x8e')]=null;else _0x3f80b6[_0x1e2d('0x8e')]=_0x3b1e1d['id'];_0x188460(_0x3f80b6);});}});}exports[_0x1e2d('0x93')]=function(_0x29ba5e,_0xd5e35b){return db[_0x1e2d('0x4a')][_0x1e2d('0x21')]({'raw':!![],'where':{'CmContactId':_0x29ba5e['params']['id'],'ItemClass':_0x1e2d('0x94')},'include':[{'model':db[_0x1e2d('0x68')],'as':_0x1e2d('0x69')}],'order':[[_0x1e2d('0x91')],[db['sequelize'][_0x1e2d('0x95')](_0x1e2d('0x92'))]]})[_0x1e2d('0x18')](function(_0x272def){return _0x272def;})[_0x1e2d('0x18')](respondWithResult(_0xd5e35b,null))[_0x1e2d('0x25')](handleError(_0xd5e35b,null));};exports[_0x1e2d('0x96')]=function(_0x479e56,_0x45ddc3){return db[_0x1e2d('0x4a')][_0x1e2d('0x21')]({'raw':!![],'where':{'CmContactId':_0x479e56[_0x1e2d('0x36')][_0x1e2d('0x97')]}})[_0x1e2d('0x18')](function(_0x2dce5c){var _0x4ae407=_[_0x1e2d('0x72')](_0x2dce5c,function(_0x9afde1){_0x9afde1['CmContactId']=_0x479e56['body'][_0x1e2d('0x98')];return _0x9afde1;});return db['CmContactHasItem']['bulkCreate'](_0x4ae407,{});})[_0x1e2d('0x18')](function(){return addCmHopperPhones(_0x479e56[_0x1e2d('0x36')][_0x1e2d('0x98')]);})[_0x1e2d('0x18')](function(){return['ok'];})['then'](respondWithResult(_0x45ddc3,null))[_0x1e2d('0x25')](handleError(_0x45ddc3,null));};exports['rescheduleAdditionalPhones']=function(_0x3dbb1b,_0x16c48e){var _0x49898d=[];_0x49898d['push'](createCmHopperPhone(_0x3dbb1b[_0x1e2d('0x36')]['id'],_0x3dbb1b[_0x1e2d('0x36')][_0x1e2d('0x99')]));Promise['all'](_0x49898d)[_0x1e2d('0x18')](function(){return[0x1];})[_0x1e2d('0x18')](respondWithResult(_0x16c48e,null));};exports[_0x1e2d('0x9a')]=function(_0x3edb29,_0x503a5f){var _0x12fb8f={'raw':![],'where':{}};var _0x106ce9={};var _0x9d00c5={'count':0x0,'rows':[]};return db[_0x1e2d('0x22')][_0x1e2d('0x7a')]({'where':{'id':_0x3edb29[_0x1e2d('0x24')]['id']}})[_0x1e2d('0x18')](handleEntityNotFound(_0x503a5f,null))[_0x1e2d('0x18')](function(_0x129791){if(_0x129791){_0x106ce9['model']=_[_0x1e2d('0x26')](db[_0x1e2d('0x3e')][_0x1e2d('0x7b')]);_0x106ce9[_0x1e2d('0x2a')]=_[_0x1e2d('0x26')](_0x3edb29[_0x1e2d('0x2a')]);_0x106ce9['filters']=_[_0x1e2d('0x7c')](_0x106ce9[_0x1e2d('0x7d')],_0x106ce9['query']);_0x12fb8f['attributes']=_[_0x1e2d('0x7c')](_0x106ce9[_0x1e2d('0x7d')],qs[_0x1e2d('0x7f')](_0x3edb29[_0x1e2d('0x2a')]['fields']));_0x12fb8f[_0x1e2d('0x7e')]=_0x12fb8f[_0x1e2d('0x7e')][_0x1e2d('0x2d')]?_0x12fb8f[_0x1e2d('0x7e')]:_0x106ce9[_0x1e2d('0x7d')];if(!_0x3edb29[_0x1e2d('0x2a')][_0x1e2d('0x35')](_0x1e2d('0x87'))){_0x12fb8f['limit']=qs['limit'](_0x3edb29['query'][_0x1e2d('0x13')]);_0x12fb8f[_0x1e2d('0x15')]=qs['offset'](_0x3edb29[_0x1e2d('0x2a')][_0x1e2d('0x15')]);}_0x12fb8f[_0x1e2d('0x80')]=qs[_0x1e2d('0x81')](_0x3edb29[_0x1e2d('0x2a')][_0x1e2d('0x81')]);_0x12fb8f[_0x1e2d('0x5c')]=qs['filters'](_[_0x1e2d('0x82')](_0x3edb29[_0x1e2d('0x2a')],_0x106ce9[_0x1e2d('0x83')]));_0x12fb8f['where'][_0x1e2d('0x9b')]=_0x129791['id'];if(_0x3edb29[_0x1e2d('0x2a')][_0x1e2d('0x85')]){_0x12fb8f[_0x1e2d('0x5c')]=_['merge'](_0x12fb8f[_0x1e2d('0x5c')],{'$or':_[_0x1e2d('0x72')](_0x12fb8f['attributes'],function(_0x571718){var _0x412e39={};_0x412e39[_0x571718]={'$like':'%'+_0x3edb29['query'][_0x1e2d('0x85')]+'%'};return _0x412e39;})});}_0x12fb8f=_['merge']({},_0x12fb8f,_0x3edb29[_0x1e2d('0x86')]);return db[_0x1e2d('0x3e')]['count']({'where':_0x12fb8f[_0x1e2d('0x5c')]})['then'](function(_0x277c2e){_0x9d00c5['count']=_0x277c2e;if(_0x3edb29['query']['includeAll']){_0x12fb8f[_0x1e2d('0x9c')]=[{'all':!![]}];}return db[_0x1e2d('0x3e')]['findAll'](_0x12fb8f);})[_0x1e2d('0x18')](function(_0x4d8f02){_0x9d00c5['rows']=_0x4d8f02;return _0x9d00c5;});}})['then'](respondWithFilteredResult(_0x503a5f,_0x12fb8f))['catch'](handleError(_0x503a5f,null));};exports[_0x1e2d('0x9d')]=function(_0x532b97,_0x2ffe32){var _0x3ca509={'raw':!![],'where':{}};var _0xbe4ac8={};var _0x33c9c8={'count':0x0,'rows':[]};return db['CmContact'][_0x1e2d('0x7a')]({'where':{'id':_0x532b97['params']['id']}})['then'](handleEntityNotFound(_0x2ffe32,null))[_0x1e2d('0x18')](function(_0x11109e){if(_0x11109e){_0xbe4ac8[_0x1e2d('0x7d')]=_[_0x1e2d('0x26')](db[_0x1e2d('0x4c')][_0x1e2d('0x7b')]);_0xbe4ac8[_0x1e2d('0x2a')]=_[_0x1e2d('0x26')](_0x532b97[_0x1e2d('0x2a')]);_0xbe4ac8[_0x1e2d('0x83')]=_[_0x1e2d('0x7c')](_0xbe4ac8[_0x1e2d('0x7d')],_0xbe4ac8['query']);_0x3ca509[_0x1e2d('0x7e')]=_[_0x1e2d('0x7c')](_0xbe4ac8[_0x1e2d('0x7d')],qs[_0x1e2d('0x7f')](_0x532b97[_0x1e2d('0x2a')][_0x1e2d('0x7f')]));_0x3ca509['attributes']=_0x3ca509[_0x1e2d('0x7e')][_0x1e2d('0x2d')]?_0x3ca509['attributes']:_0xbe4ac8[_0x1e2d('0x7d')];if(!_0x532b97[_0x1e2d('0x2a')][_0x1e2d('0x35')](_0x1e2d('0x87'))){_0x3ca509['limit']=qs[_0x1e2d('0x13')](_0x532b97['query'][_0x1e2d('0x13')]);_0x3ca509[_0x1e2d('0x15')]=qs[_0x1e2d('0x15')](_0x532b97['query']['offset']);}_0x3ca509[_0x1e2d('0x80')]=qs[_0x1e2d('0x81')](_0x532b97[_0x1e2d('0x2a')][_0x1e2d('0x81')]);_0x3ca509['where']=qs[_0x1e2d('0x83')](_[_0x1e2d('0x82')](_0x532b97[_0x1e2d('0x2a')],_0xbe4ac8[_0x1e2d('0x83')]));_0x3ca509[_0x1e2d('0x5c')][_0x1e2d('0x9b')]=_0x11109e['id'];if(_0x532b97[_0x1e2d('0x2a')]['filter']){_0x3ca509[_0x1e2d('0x5c')]=_[_0x1e2d('0x84')](_0x3ca509['where'],{'$or':_[_0x1e2d('0x72')](_0x3ca509['attributes'],function(_0x4ba129){var _0x8ace97={};_0x8ace97[_0x4ba129]={'$like':'%'+_0x532b97[_0x1e2d('0x2a')][_0x1e2d('0x85')]+'%'};return _0x8ace97;})});}_0x3ca509=_[_0x1e2d('0x84')]({},_0x3ca509,_0x532b97[_0x1e2d('0x86')]);return db[_0x1e2d('0x4c')]['count']({'where':_0x3ca509[_0x1e2d('0x5c')]})[_0x1e2d('0x18')](function(_0x5675c3){_0x33c9c8[_0x1e2d('0x14')]=_0x5675c3;if(_0x532b97[_0x1e2d('0x2a')][_0x1e2d('0x9e')]){_0x3ca509['include']=[{'all':!![]}];}return db[_0x1e2d('0x4c')][_0x1e2d('0x21')](_0x3ca509);})[_0x1e2d('0x18')](function(_0x1b73f6){_0x33c9c8[_0x1e2d('0x9f')]=_0x1b73f6;return _0x33c9c8;});}})[_0x1e2d('0x18')](respondWithFilteredResult(_0x2ffe32,_0x3ca509))['catch'](handleError(_0x2ffe32,null));};exports[_0x1e2d('0xa0')]=function(_0xd88b98,_0x32d4aa){var _0x257153={'raw':!![],'where':{}};var _0x8327fb={};var _0x245e6e={'count':0x0,'rows':[]};return db[_0x1e2d('0x22')][_0x1e2d('0x7a')]({'where':{'id':_0xd88b98[_0x1e2d('0x24')]['id']}})[_0x1e2d('0x18')](handleEntityNotFound(_0x32d4aa,null))[_0x1e2d('0x18')](function(_0x30f086){if(_0x30f086){_0x8327fb['model']=_[_0x1e2d('0x26')](db[_0x1e2d('0x4b')][_0x1e2d('0x7b')]);_0x8327fb[_0x1e2d('0x2a')]=_[_0x1e2d('0x26')](_0xd88b98[_0x1e2d('0x2a')]);_0x8327fb[_0x1e2d('0x83')]=_[_0x1e2d('0x7c')](_0x8327fb['model'],_0x8327fb['query']);_0x257153[_0x1e2d('0x7e')]=_[_0x1e2d('0x7c')](_0x8327fb['model'],qs[_0x1e2d('0x7f')](_0xd88b98[_0x1e2d('0x2a')]['fields']));_0x257153[_0x1e2d('0x7e')]=_0x257153[_0x1e2d('0x7e')][_0x1e2d('0x2d')]?_0x257153[_0x1e2d('0x7e')]:_0x8327fb[_0x1e2d('0x7d')];if(!_0xd88b98['query'][_0x1e2d('0x35')](_0x1e2d('0x87'))){_0x257153[_0x1e2d('0x13')]=qs[_0x1e2d('0x13')](_0xd88b98[_0x1e2d('0x2a')][_0x1e2d('0x13')]);_0x257153[_0x1e2d('0x15')]=qs[_0x1e2d('0x15')](_0xd88b98['query']['offset']);}_0x257153['order']=qs[_0x1e2d('0x81')](_0xd88b98[_0x1e2d('0x2a')]['sort']);_0x257153['where']=qs['filters'](_['pick'](_0xd88b98[_0x1e2d('0x2a')],_0x8327fb[_0x1e2d('0x83')]));_0x257153[_0x1e2d('0x5c')][_0x1e2d('0x9b')]=_0x30f086['id'];if(_0xd88b98[_0x1e2d('0x2a')][_0x1e2d('0x85')]){_0x257153[_0x1e2d('0x5c')]=_[_0x1e2d('0x84')](_0x257153[_0x1e2d('0x5c')],{'$or':_[_0x1e2d('0x72')](_0x257153[_0x1e2d('0x7e')],function(_0x2240b5){var _0x5eaceb={};_0x5eaceb[_0x2240b5]={'$like':'%'+_0xd88b98[_0x1e2d('0x2a')]['filter']+'%'};return _0x5eaceb;})});}_0x257153=_[_0x1e2d('0x84')]({},_0x257153,_0xd88b98[_0x1e2d('0x86')]);return db[_0x1e2d('0x4b')]['count']({'where':_0x257153[_0x1e2d('0x5c')]})[_0x1e2d('0x18')](function(_0x1a094d){_0x245e6e[_0x1e2d('0x14')]=_0x1a094d;if(_0xd88b98[_0x1e2d('0x2a')][_0x1e2d('0x9e')]){_0x257153['include']=[{'all':!![]}];}return db[_0x1e2d('0x4b')][_0x1e2d('0x21')](_0x257153);})['then'](function(_0x442468){_0x245e6e[_0x1e2d('0x9f')]=_0x442468;return _0x245e6e;});}})[_0x1e2d('0x18')](respondWithFilteredResult(_0x32d4aa,_0x257153))[_0x1e2d('0x25')](handleError(_0x32d4aa,null));};exports[_0x1e2d('0xa1')]=function(_0x1ade89,_0x43a62b){var _0x4b46fe={'raw':!![],'where':{}};var _0x4e4b6d={};var _0x4a5b4b={'count':0x0,'rows':[]};return db[_0x1e2d('0x22')][_0x1e2d('0x7a')]({'where':{'id':_0x1ade89[_0x1e2d('0x24')]['id']}})['then'](handleEntityNotFound(_0x43a62b,null))['then'](function(_0x24692f){if(_0x24692f){_0x4e4b6d[_0x1e2d('0x7d')]=_[_0x1e2d('0x26')](db['JscriptySessionReport'][_0x1e2d('0x7b')]);_0x4e4b6d['query']=_[_0x1e2d('0x26')](_0x1ade89[_0x1e2d('0x2a')]);_0x4e4b6d[_0x1e2d('0x83')]=_[_0x1e2d('0x7c')](_0x4e4b6d['model'],_0x4e4b6d[_0x1e2d('0x2a')]);_0x4b46fe[_0x1e2d('0x7e')]=_[_0x1e2d('0x7c')](_0x4e4b6d['model'],qs[_0x1e2d('0x7f')](_0x1ade89['query'][_0x1e2d('0x7f')]));_0x4b46fe[_0x1e2d('0x7e')]=_0x4b46fe[_0x1e2d('0x7e')][_0x1e2d('0x2d')]?_0x4b46fe[_0x1e2d('0x7e')]:_0x4e4b6d[_0x1e2d('0x7d')];if(!_0x1ade89[_0x1e2d('0x2a')][_0x1e2d('0x35')]('nolimit')){_0x4b46fe[_0x1e2d('0x13')]=qs[_0x1e2d('0x13')](_0x1ade89[_0x1e2d('0x2a')][_0x1e2d('0x13')]);_0x4b46fe['offset']=qs[_0x1e2d('0x15')](_0x1ade89[_0x1e2d('0x2a')]['offset']);}_0x4b46fe['order']=qs[_0x1e2d('0x81')](_0x1ade89['query'][_0x1e2d('0x81')]);_0x4b46fe[_0x1e2d('0x5c')]=qs[_0x1e2d('0x83')](_[_0x1e2d('0x82')](_0x1ade89[_0x1e2d('0x2a')],_0x4e4b6d[_0x1e2d('0x83')]));_0x4b46fe[_0x1e2d('0x5c')]['ContactId']=_0x24692f['id'];if(_0x1ade89['query'][_0x1e2d('0x85')]){_0x4b46fe[_0x1e2d('0x5c')]=_['merge'](_0x4b46fe[_0x1e2d('0x5c')],{'$or':_['map'](_0x4b46fe[_0x1e2d('0x7e')],function(_0xcb03ae){var _0x3c8648={};_0x3c8648[_0xcb03ae]={'$like':'%'+_0x1ade89[_0x1e2d('0x2a')][_0x1e2d('0x85')]+'%'};return _0x3c8648;})});}_0x4b46fe=_[_0x1e2d('0x84')]({},_0x4b46fe,_0x1ade89['options']);return db['JscriptySessionReport'][_0x1e2d('0x14')]({'where':_0x4b46fe[_0x1e2d('0x5c')]})[_0x1e2d('0x18')](function(_0x1b8d31){_0x4a5b4b['count']=_0x1b8d31;if(_0x1ade89['query']['includeAll']){_0x4b46fe[_0x1e2d('0x9c')]=[{'all':!![]}];}return db[_0x1e2d('0x51')][_0x1e2d('0x21')](_0x4b46fe);})[_0x1e2d('0x18')](function(_0x326578){_0x4a5b4b[_0x1e2d('0x9f')]=_0x326578;return _0x4a5b4b;});}})[_0x1e2d('0x18')](respondWithFilteredResult(_0x43a62b,_0x4b46fe))['catch'](handleError(_0x43a62b,null));};exports[_0x1e2d('0xa2')]=function(_0x1260e4,_0xe394bf){try{if(!_0x1260e4[_0x1e2d('0x36')][_0x1e2d('0x5f')]){throw new Error(_0x1e2d('0xa3'));}if(!_0x1260e4['body'][_0x1e2d('0xa4')]){throw new Error(_0x1e2d('0xa5'));}if(!_0x1260e4[_0x1e2d('0x36')][_0x1e2d('0xa6')]){throw new Error('No\x20association\x20values\x20specified!');}if(!_0x1260e4[_0x1e2d('0x36')]['socket_timestamp']){throw new Error(_0x1e2d('0xa7'));}var _0x47a1a5=_0x1260e4['body']['binding_keys'][_0x1e2d('0xa8')](',');var _0x50e51f=_0x1260e4[_0x1e2d('0x36')][_0x1e2d('0xa6')][_0x1e2d('0xa8')](',');if(!_0x47a1a5[_0x1e2d('0x2d')]||!_0x50e51f['length']||_0x47a1a5[_0x1e2d('0x2d')]!==_0x50e51f['length']){throw new Error(_0x1e2d('0xa9'));}_0x1260e4[_0x1e2d('0x36')][_0x1e2d('0x7f')]=_['zipObject'](_0x47a1a5,_0x50e51f);if(!_0x1260e4['body']['fields'][_0x1e2d('0x78')]){throw new Error(_0x1e2d('0xaa'));}if(!_0x1260e4[_0x1e2d('0x36')]['fields'][_0x1e2d('0xab')]){throw new Error(_0x1e2d('0xac'));}var _0x802b7d=path[_0x1e2d('0x3c')](config[_0x1e2d('0xad')],_0x1e2d('0xae'),_0x1260e4['file'][_0x1e2d('0xaf')]);fs['chmodSync'](_0x802b7d,parseInt('0777',0x8));var _0x1e4962=require('child_process')[_0x1e2d('0xb0')](path['join'](__dirname,_0x1e2d('0xb1')),[_0x802b7d,_0x1260e4['body'][_0x1e2d('0xa4')],_0x1260e4[_0x1e2d('0x36')]['binding_values'],_0x1260e4[_0x1e2d('0x36')][_0x1e2d('0x5f')],_0x1260e4['body']['CompanyId'],_0x1260e4[_0x1e2d('0x36')][_0x1e2d('0x5b')],_0x1260e4['body'][_0x1e2d('0xb2')]]);return _0xe394bf[_0x1e2d('0x10')](0xc8)['json']({'message':'File\x20uploaded\x20correctly!','pid':_0x1e4962[_0x1e2d('0xb3')]});}catch(_0x11b4a4){return _0xe394bf['status'](0x1f4)[_0x1e2d('0xb4')](_0x11b4a4);}};exports['upload']=function(_0x52698f,_0x137a09){var _0x563cff=fs[_0x1e2d('0xb5')](_0x52698f['file'][_0x1e2d('0x2')]);Papa[_0x1e2d('0xb6')](_0x563cff,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x3c8aa5){return _0x137a09[_0x1e2d('0x10')](0xc8)[_0x1e2d('0x11')]({'file':_0x52698f[_0x1e2d('0xb7')],'fields':_0x3c8aa5[_0x1e2d('0xb8')][_0x1e2d('0x7f')]});}});};exports[_0x1e2d('0xb9')]=function(_0x198c1c,_0x3234e9){return db['User'][_0x1e2d('0x21')]({'raw':!![],'attributes':['id'],'where':{'role':_0x1e2d('0xba')}})[_0x1e2d('0x18')](function(_0x293748){var _0x3bf4d9=![];if(!_0x198c1c['body'][_0x1e2d('0x5f')]){throw new Error(_0x1e2d('0xa3'));}if(!_0x198c1c[_0x1e2d('0x36')]['binding'][_0x1e2d('0x78')]){throw new Error(_0x1e2d('0xaa'));}if(!_0x198c1c[_0x1e2d('0x36')][_0x1e2d('0xbb')][_0x1e2d('0xab')]){throw new Error(_0x1e2d('0xac'));}if(!_0x198c1c[_0x1e2d('0x36')][_0x1e2d('0xb2')]){throw new Error(_0x1e2d('0xa7'));}var _0x4ff9d3=require('child_process')[_0x1e2d('0xb0')](path[_0x1e2d('0x3c')](__dirname,_0x1e2d('0xbc')),[_0x198c1c['params']['id'],JSON[_0x1e2d('0xbd')](_0x198c1c[_0x1e2d('0x36')]),JSON[_0x1e2d('0xbd')](_0x293748)]);_0x4ff9d3['on'](_0x1e2d('0xbe'),function(){_0x3bf4d9=!![];return _0x3234e9[_0x1e2d('0x10')](0xc8)['json']({'message':_0x1e2d('0xbf'),'pid':_0x4ff9d3['pid']});});_0x4ff9d3['on'](_0x1e2d('0xc0'),function(_0x573e82){if(_0x573e82&&!_0x3bf4d9){return _0x3234e9[_0x1e2d('0x10')](0x1f4)[_0x1e2d('0x11')]({'message':_0x1e2d('0xc1'),'pid':_0x4ff9d3[_0x1e2d('0xb3')]});}});})[_0x1e2d('0x25')](handleError(_0x3234e9,null));};exports[_0x1e2d('0xc2')]=function(_0x36c5b1,_0x479094){return db[_0x1e2d('0xc3')][_0x1e2d('0x21')]({'raw':!![],'attributes':['id'],'where':{'role':'agent'}})[_0x1e2d('0x18')](function(_0xc5acff){var _0x4056e5=![];if(!_0x36c5b1[_0x1e2d('0x36')][_0x1e2d('0x5f')]){throw new Error('No\x20ListId\x20specified');}if(!_0x36c5b1[_0x1e2d('0x36')][_0x1e2d('0xbb')]['phone']){throw new Error(_0x1e2d('0xaa'));}if(!_0x36c5b1[_0x1e2d('0x36')][_0x1e2d('0xbb')][_0x1e2d('0xab')]){throw new Error(_0x1e2d('0xac'));}if(!_0x36c5b1['body'][_0x1e2d('0xb2')]){throw new Error(_0x1e2d('0xa7'));}var _0x21dd49=require(_0x1e2d('0xc4'))[_0x1e2d('0xb0')](path['join'](__dirname,_0x1e2d('0xc5')),[_0x36c5b1[_0x1e2d('0x24')]['id'],JSON[_0x1e2d('0xbd')](_0x36c5b1[_0x1e2d('0x36')]),JSON['stringify'](_0xc5acff)]);_0x21dd49['on'](_0x1e2d('0xbe'),function(){_0x4056e5=!![];return _0x479094[_0x1e2d('0x10')](0xc8)[_0x1e2d('0x11')]({'message':_0x1e2d('0xbf'),'pid':_0x21dd49[_0x1e2d('0xb3')]});});_0x21dd49['on'](_0x1e2d('0xc0'),function(_0x2228f0){if(_0x2228f0&&!_0x4056e5){return _0x479094[_0x1e2d('0x10')](0x1f4)[_0x1e2d('0x11')]({'message':_0x1e2d('0xc1'),'pid':_0x21dd49[_0x1e2d('0xb3')]});}});})['catch'](handleError(_0x479094,null));};exports[_0x1e2d('0xc6')]=function(_0x144356,_0x44505c){var _0x21b70c=[_0x1e2d('0xc7'),'chat',_0x1e2d('0xc8'),'openchannel','fax',_0x1e2d('0xc9'),_0x1e2d('0xca')];var _0x53bc01={'offset':0x0,'order':qs[_0x1e2d('0x81')](_0x1e2d('0xcb'))},_0x4f7679={'count':0x0,'rows':[]};Promise[_0x1e2d('0xcc')]()[_0x1e2d('0x18')](function(){if(_0x144356[_0x1e2d('0x2a')][_0x1e2d('0xcd')]){if(!_[_0x1e2d('0xce')](_0x21b70c,_0x144356[_0x1e2d('0x2a')][_0x1e2d('0xcd')][_0x1e2d('0xcf')]())){throw new Error(_0x1e2d('0xd0'));}_0x21b70c=[_0x144356['query'][_0x1e2d('0xcd')][_0x1e2d('0xcf')]()];}if(_0x144356['query'][_0x1e2d('0xd1')]){try{var _0x23514e=JSON[_0x1e2d('0xb6')](_0x144356[_0x1e2d('0x2a')][_0x1e2d('0xd1')]);if(!moment(_0x23514e[_0x1e2d('0x37')])[_0x1e2d('0xd2')]()){throw new Error(_0x1e2d('0xd3'));}if(!moment(_0x23514e['to'])[_0x1e2d('0xd2')]()){throw new Error(_0x1e2d('0xd4'));}}catch(_0x41322f){throw new Error('Invalid\x20createdAt\x20filter');}}if(!_0x144356[_0x1e2d('0x2a')][_0x1e2d('0x35')](_0x1e2d('0x87'))){_0x53bc01[_0x1e2d('0x13')]=qs[_0x1e2d('0x13')](_0x144356[_0x1e2d('0x2a')]['limit']||0xa);_0x53bc01['offset']=qs[_0x1e2d('0x15')](_0x144356['query'][_0x1e2d('0x15')]);}var _0x47202b=_0x21b70c[_0x1e2d('0x72')](function(_0x57ad90){if(_0x57ad90===_0x1e2d('0xca')){var _0x272710={'attributes':['id',_0x1e2d('0xd5'),_0x1e2d('0x30'),_0x1e2d('0xd6'),'destination',_0x1e2d('0xd7'),_0x1e2d('0xd8'),_0x1e2d('0xd9'),_0x1e2d('0xda'),'note',_0x1e2d('0xdb'),_0x1e2d('0xdc'),'userSecondDisposition',_0x1e2d('0xdd'),_0x1e2d('0xde')],'where':{'ContactId':_0x144356[_0x1e2d('0x24')]['id']},'include':[{'model':db[_0x1e2d('0xc3')],'as':'User','attributes':['id',_0x1e2d('0x1e'),_0x1e2d('0xdf'),_0x1e2d('0x2e')]}],'order':[[_0x1e2d('0xdb'),_0x1e2d('0xe0')]]};if(_0x144356[_0x1e2d('0x2a')][_0x1e2d('0xd1')]){_0x272710[_0x1e2d('0x5c')]['createdAt']={'$gte':_0x23514e[_0x1e2d('0x37')],'$lte':_0x23514e['to']};}return db['VoiceCallReport'][_0x1e2d('0xe1')](_0x272710)['then'](function(_0x3b22ed){_0x4f7679[_0x1e2d('0x14')]+=_0x3b22ed[_0x1e2d('0x14')];return _[_0x1e2d('0x72')](_0x3b22ed['rows'],function(_0x33d47b){var _0x195e19=_0x33d47b[_0x1e2d('0x38')]({'plain':!![]});_0x195e19[_0x1e2d('0xcd')]=_0x57ad90;if(_0x195e19[_0x1e2d('0xc3')]){_0x195e19[_0x1e2d('0xc3')]={'id':_0x195e19['User']['id'],'name':_0x195e19[_0x1e2d('0xc3')][_0x1e2d('0x1e')],'fullname':_0x195e19[_0x1e2d('0xc3')][_0x1e2d('0xdf')],'alias':_0x195e19['User'][_0x1e2d('0x2e')]};}return _0x195e19;});});}else{var _0x3c63ed=_[_0x1e2d('0xe2')](_0x57ad90)+(_0x57ad90===_0x1e2d('0xe3')?'Website':_0x1e2d('0xe4'));var _0x4ab520={'attributes':['id','closed',_0x1e2d('0xe5'),_0x1e2d('0xdb'),'note',_0x1e2d('0xe6'),_0x1e2d('0xe7'),_0x1e2d('0xe8'),_0x1e2d('0xde'),_0x3c63ed+'Id'],'where':{'ContactId':_0x144356[_0x1e2d('0x24')]['id']},'include':[{'model':db[_0x3c63ed],'as':_0x1e2d('0xe4'),'attributes':['id','name','key']},{'model':db[_0x1e2d('0xc3')],'as':'Owner','attributes':['id',_0x1e2d('0x1e'),_0x1e2d('0xdf')]},{'model':db['Tag'],'as':_0x1e2d('0xe9'),'attributes':['id','name',_0x1e2d('0x65')],'through':{'attributes':[]}}],'order':[[_0x1e2d('0xdb'),_0x1e2d('0xe0')]]};if(_0x144356['query'][_0x1e2d('0xd1')]){_0x4ab520[_0x1e2d('0x5c')][_0x1e2d('0xdb')]={'$gte':_0x23514e['from'],'$lte':_0x23514e['to']};}switch(_0x57ad90){case'chat':_0x4ab520[_0x1e2d('0x7e')][_0x1e2d('0x5e')](_0x1e2d('0xea'),'customerIp',_0x1e2d('0xeb'),_0x1e2d('0xec'),_0x1e2d('0xed'),_0x1e2d('0xee'),_0x1e2d('0xef'),'ratingValue',_0x1e2d('0xf0'));break;case'mail':_0x4ab520[_0x1e2d('0x7e')][_0x1e2d('0x5e')](_0x1e2d('0xf1'),'substatus');break;case _0x1e2d('0xf2'):_0x4ab520[_0x1e2d('0x7e')][_0x1e2d('0x5e')](_0x1e2d('0xf3'),'threadId');break;}return db[_['startCase'](_0x57ad90)+_0x1e2d('0xf4')][_0x1e2d('0xe1')](_0x4ab520)[_0x1e2d('0x18')](function(_0x33ad1a){_0x4f7679[_0x1e2d('0x14')]+=_0x33ad1a[_0x1e2d('0x14')];return _[_0x1e2d('0x72')](_0x33ad1a[_0x1e2d('0x9f')],function(_0x3f7422){var _0x515e0f=_0x3f7422['get']({'plain':!![]});_0x515e0f['channel']=_0x57ad90;if(_0x515e0f[_0x1e2d('0xf5')]){_0x515e0f['Owner']={'id':_0x515e0f[_0x1e2d('0xf5')]['id'],'name':_0x515e0f[_0x1e2d('0xf5')][_0x1e2d('0x1e')],'fullname':_0x515e0f['Owner']['fullname']};}return _0x515e0f;});});}});return Promise[_0x1e2d('0x8b')](_0x47202b);})['then'](function(_0x514e19){return _(_0x514e19)['flatten']()[_0x1e2d('0xf6')](_0x1e2d('0xdb'))[_0x1e2d('0xf7')]()[_0x1e2d('0xf8')]();})[_0x1e2d('0x18')](function(_0x5b0f57){_0x4f7679['rows']=_0x53bc01['limit']?_0x5b0f57['slice'](_0x53bc01[_0x1e2d('0x15')],_0x53bc01[_0x1e2d('0x15')]+_0x53bc01[_0x1e2d('0x13')]):_0x5b0f57;return _0x4f7679;})[_0x1e2d('0x18')](respondWithFilteredResult(_0x44505c,_0x53bc01))[_0x1e2d('0x25')](handleError(_0x44505c,null));}; \ No newline at end of file +var _0x50e8=['start\x20child\x20process\x20correctly!','pid','exit','error\x20child\x20process','importUpdates','agent','../../components/import/cm/csvUpdates','mail','chat','sms','fax','whatsapp','-createdAt','resolve','channel','toLowerCase','Invalid\x20channel','range','isValid','Invalid\x20date\x20for\x20range\x20from\x20filter','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter','voice','uniqueid','type','source','destination','callerid','starttime','note','userDisposition','userSecondDisposition','userThirdDisposition','UserId','fullname','createdAt','DESC','findAndCountAll','startCase','Website','Account','closed','disposition','thirdDisposition','key','Owner','color','customerIp','deviceModel','osName','ratingMessage','ratingType','ratingValue','referer','subject','substatus','openchannel','externalUrl','threadId','Interaction','reverse','value','bluebird','util','path','lodash','squel','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/environment/shared','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./cmContact.socket','register','status','json','offset','limit','undefined','count','set','Content-Range','then','destroy','end','error','name','send','index','describe','getOptions','findAll','query','user','catch','CmContact','find','params','tags','keys','length','startsWith','cf_','displayName','analytics','alias','custom','values','info','Custom\x20field\x20%s\x20not\x20found\x20on\x20cm_contacts\x20table','forEach','hasOwnProperty','merge','body','get','mergeWith','isArray','join','[CmContact][merge]\x20to\x20%s\x20from\x20%s','from','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','update','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxMessage','OpenchannelMessage','CmContactHasItem','CmHopperFinal','CmHopperHistory','ReportAgentPreview','VoiceCallReport','MailQueueReport','OpenchannelQueueReport','JscriptySessionReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','isNil','dialTimezone','timezones','utcOffset','additionalPhones','bulkCreate','each','duplicates','$or','push','where','ListId','findOrCreate','spread','contact','all','show','Tags','tag','Phones','ContactItemType','ItemType','sequelize','Phones.OrderBy','$and','CmCustomField','map','format','isEmpty','table','cm_contacts','setFields','toParam','phone','getTags','findOne','model','Tag','filters','intersection','attributes','fields','order','sort','pick','filter','setTags','ids','setAdditionalPhones','item_types','items','ItemTypeId','description','contact\x20phone\x20exists','PHONE','CmHopperAdditionalPhone','item','OrderBy','literal','`ItemType`.OrderBy','CmHopperId','ItemType.OrderBy','getAdditionalPhones','duplicateAdditionalPhones','CmContactId','toContactId','rescheduleAdditionalPhones','rawAttributes','nolimit','ContactId','options','includeAll','include','rows','getHopperHistories','getJscriptySessions','uploadCsv','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','binding_values','split','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','root','file','chmodSync','child_process','fork','../../components/import/cm/csv','File\x20uploaded\x20correctly!','createReadStream','parse','User','binding','../../components/import/cm/csv2','stringify','message'];(function(_0x40600c,_0x3969a8){var _0x2f89e1=function(_0x19a575){while(--_0x19a575){_0x40600c['push'](_0x40600c['shift']());}};_0x2f89e1(++_0x3969a8);}(_0x50e8,0x13c));var _0x850e=function(_0xea343d,_0x311197){_0xea343d=_0xea343d-0x0;var _0x2c6e9c=_0x50e8[_0xea343d];return _0x2c6e9c;};'use strict';var moment=require('moment');var BPromise=require(_0x850e('0x0'));var util=require(_0x850e('0x1'));var path=require(_0x850e('0x2'));var fs=require('fs');var _=require(_0x850e('0x3'));var squel=require(_0x850e('0x4'));var Papa=require(_0x850e('0x5'));var Redis=require(_0x850e('0x6'));var contacts=require('../../components/contacts');var qs=require(_0x850e('0x7'));var logger=require(_0x850e('0x8'))(_0x850e('0x9'));var config=require(_0x850e('0xa'));var shared=require(_0x850e('0xb'));var db=require(_0x850e('0xc'))['db'];config['redis']=_[_0x850e('0xd')](config[_0x850e('0xe')],{'host':_0x850e('0xf'),'port':0x18eb});var socket=require(_0x850e('0x10'))(new Redis(config[_0x850e('0xe')]));require(_0x850e('0x11'))[_0x850e('0x12')](socket);function respondWithResult(_0x1efd3f,_0x476082){_0x476082=_0x476082||0xc8;return function(_0x3a6857){if(_0x3a6857){return _0x1efd3f[_0x850e('0x13')](_0x476082)[_0x850e('0x14')](_0x3a6857);}};}function respondWithFilteredResult(_0x42215f,_0x2a15a8){return function(_0x2dfc8d){if(_0x2dfc8d){var _0x350f32=typeof _0x2a15a8[_0x850e('0x15')]==='undefined'&&typeof _0x2a15a8[_0x850e('0x16')]===_0x850e('0x17');var _0x911f3d=_0x2dfc8d[_0x850e('0x18')];var _0x3833e2=_0x350f32?0x0:_0x2a15a8[_0x850e('0x15')];var _0x198d84=_0x350f32?_0x2dfc8d[_0x850e('0x18')]:_0x2a15a8[_0x850e('0x15')]+_0x2a15a8[_0x850e('0x16')];var _0x16cbae;if(_0x198d84>=_0x911f3d){_0x198d84=_0x911f3d;_0x16cbae=0xc8;}else{_0x16cbae=0xce;}_0x42215f[_0x850e('0x13')](_0x16cbae);return _0x42215f[_0x850e('0x19')](_0x850e('0x1a'),_0x3833e2+'-'+_0x198d84+'/'+_0x911f3d)[_0x850e('0x14')](_0x2dfc8d);}return null;};}function saveUpdates(_0x36b0f0){return function(_0xbd5744){if(_0xbd5744){return _0xbd5744['update'](_0x36b0f0)[_0x850e('0x1b')](function(_0x345390){return _0x345390;});}return null;};}function removeEntity(_0xf1af66){return function(_0x475288){if(_0x475288){return _0x475288[_0x850e('0x1c')]()[_0x850e('0x1b')](function(){_0xf1af66[_0x850e('0x13')](0xcc)[_0x850e('0x1d')]();});}};}function handleEntityNotFound(_0xa13a95){return function(_0x11dacf){if(!_0x11dacf){_0xa13a95['sendStatus'](0x194);}return _0x11dacf;};}function handleError(_0x290197,_0x4f1b3c){_0x4f1b3c=_0x4f1b3c||0x1f4;return function(_0x14b22e){logger[_0x850e('0x1e')](_0x14b22e['stack']);if(_0x14b22e[_0x850e('0x1f')]){delete _0x14b22e['name'];}_0x290197[_0x850e('0x13')](_0x4f1b3c)[_0x850e('0x20')](_0x14b22e);};}exports[_0x850e('0x21')]=function(_0x407085,_0x38a961){var _0x534fde={};return contacts[_0x850e('0x22')]()[_0x850e('0x1b')](function(_0x31be61){_0x534fde=qs[_0x850e('0x23')](_0x31be61,_0x407085);return contacts[_0x850e('0x24')](_0x407085[_0x850e('0x25')],_0x407085[_0x850e('0x26')],_0x534fde,_0x31be61);})[_0x850e('0x1b')](respondWithFilteredResult(_0x38a961,_0x534fde))[_0x850e('0x27')](handleError(_0x38a961,null));};exports['destroy']=function(_0x2b4b3f,_0x469d1d){return db[_0x850e('0x28')][_0x850e('0x29')]({'where':{'id':_0x2b4b3f[_0x850e('0x2a')]['id']}})[_0x850e('0x1b')](handleEntityNotFound(_0x469d1d,null))[_0x850e('0x1b')](removeEntity(_0x469d1d,null))['catch'](handleError(_0x469d1d,null));};exports['describe']=function(_0x5270ef,_0x30c15d){return db[_0x850e('0x28')][_0x850e('0x22')]()[_0x850e('0x1b')](function(_0x1f8c2c){delete _0x1f8c2c[_0x850e('0x2b')];for(var _0x3a1dbd=0x0;_0x3a1dbd0x0){return new Promise(function(_0x27b6cf){var _0x2b14d6=[];for(var _0x15544c=0x0;_0x15544c<_0x265449[_0x850e('0x2d')];_0x15544c++){_0x2b14d6[_0x850e('0x62')](insertAdditionalPhones(_0x265449[_0x15544c][_0x850e('0x67')],_0x265449[_0x15544c][_0x850e('0x5d')]));}Promise[_0x850e('0x68')](_0x2b14d6)[_0x850e('0x1b')](function(){_0x27b6cf(0x1);});})['then'](function(){return{'success':_0x3f84d4,'failure':_0x35a82e,'duplicates':_0x1cc33a};});}else{return{'success':_0x3f84d4,'failure':_0x35a82e,'duplicates':_0x1cc33a};}}})['then'](respondWithResult(_0x1a376e,0xc9))[_0x850e('0x27')](handleError(_0x1a376e,null));};exports[_0x850e('0x69')]=function(_0x2bed8d,_0x57f62c){var _0x2c8bf8;return db['CmContact']['describe']()['then'](function(_0x459dd9){return db['CmContact'][_0x850e('0x29')]({'where':{'id':_0x2bed8d['params']['id']},'include':[{'model':db['Tag'],'as':_0x850e('0x6a'),'attributes':['id',_0x850e('0x1f'),'color'],'required':_0x2bed8d[_0x850e('0x25')][_0x850e('0x6b')]?!![]:![]},{'model':db[_0x850e('0x4e')],'as':_0x850e('0x6c'),'where':{'CmContactId':_0x2bed8d[_0x850e('0x2a')]['id']},'required':![],'include':[{'model':db[_0x850e('0x6d')],'as':_0x850e('0x6e')}]}],'order':[db[_0x850e('0x6f')]['literal'](_0x850e('0x70'))],'attributes':_[_0x850e('0x2c')](_0x459dd9)});})[_0x850e('0x1b')](function(_0x209b36){if(!_['isNil'](_0x209b36)){_0x2c8bf8=_0x209b36[_0x850e('0x3b')]({'plain':!![]});var _0x5baa4c={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x209b36&&_0x209b36[_0x850e('0x64')]){if(_0x209b36[_0x850e('0x64')]){_0x5baa4c['where'][_0x850e('0x71')]['push']({'ListId':{'$ne':_0x209b36['ListId']}});}}return db[_0x850e('0x72')]['findAll'](_0x5baa4c);}})[_0x850e('0x1b')](function(_0x4ea538){if(!_['isNil'](_0x4ea538)){return _['omit'](_0x2c8bf8,_[_0x850e('0x73')](_0x4ea538,function(_0x1d1e31){return util['format']('cf_%d',_0x1d1e31['id']);}));}})[_0x850e('0x1b')](handleEntityNotFound(_0x57f62c,null))[_0x850e('0x1b')](respondWithResult(_0x57f62c,null))[_0x850e('0x27')](handleError(_0x57f62c,null));};exports[_0x850e('0x47')]=function(_0x50ccd3,_0x372385){var _0x342ee7;if(_0x50ccd3[_0x850e('0x3a')]['id']){delete _0x50ccd3[_0x850e('0x3a')]['id'];}if(!_['isNil'](_0x50ccd3[_0x850e('0x3a')][_0x850e('0x5a')])){var _0x48b598=_0x50ccd3['body'][_0x850e('0x5a')];if(!_[_0x850e('0x59')](shared['timezones'][_0x48b598]))_0x50ccd3[_0x850e('0x3a')][_0x850e('0x5c')]=shared[_0x850e('0x5b')][_0x48b598][_0x850e('0x5c')];}return db[_0x850e('0x28')][_0x850e('0x29')]({'where':{'id':_0x50ccd3[_0x850e('0x2a')]['id']}})[_0x850e('0x1b')](handleEntityNotFound(_0x372385,null))[_0x850e('0x1b')](saveUpdates(_0x50ccd3[_0x850e('0x3a')],null))[_0x850e('0x1b')](function(_0x2c3b59){_0x342ee7=_0x2c3b59;var _0x1a7a8d={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x2c3b59&&_0x2c3b59[_0x850e('0x64')]){if(_0x2c3b59[_0x850e('0x64')]){_0x1a7a8d[_0x850e('0x63')][_0x850e('0x71')][_0x850e('0x62')]({'ListId':{'$ne':_0x2c3b59[_0x850e('0x64')]}});}}return db['CmCustomField']['findAll'](_0x1a7a8d);})[_0x850e('0x1b')](function(_0x135e14){if(_0x135e14){return _['omit'](_['pickBy'](_0x50ccd3['body'],function(_0x31be65,_0x8b1c3f){return _[_0x850e('0x2e')](_0x8b1c3f,_0x850e('0x2f'));}),_[_0x850e('0x73')](_0x135e14,function(_0x1fdee1){return util[_0x850e('0x74')]('cf_%d',_0x1fdee1['id']);}));}})[_0x850e('0x1b')](function(_0x3e87f9){if(_0x3e87f9&&!_[_0x850e('0x75')](_0x3e87f9)){var _0x42f93e=squel[_0x850e('0x47')]()[_0x850e('0x76')](_0x850e('0x77'))[_0x850e('0x78')](_0x3e87f9)[_0x850e('0x63')]('id\x20=\x20?',_0x50ccd3[_0x850e('0x2a')]['id'])[_0x850e('0x79')]();return db[_0x850e('0x6f')][_0x850e('0x25')](_0x42f93e['text'],{'replacements':_0x42f93e[_0x850e('0x34')]});}})[_0x850e('0x1b')](function(){if(_0x50ccd3[_0x850e('0x3a')]['phone']&&_0x342ee7){return db['CmHopper'][_0x850e('0x47')]({'phone':_0x50ccd3[_0x850e('0x3a')][_0x850e('0x7a')],'OrderBy':0x0},{'where':{'ContactId':_0x342ee7['id']}});}})[_0x850e('0x1b')](function(){return _0x342ee7;})[_0x850e('0x1b')](respondWithResult(_0x372385,null))[_0x850e('0x27')](handleError(_0x372385,null));};exports[_0x850e('0x7b')]=function(_0x23b945,_0x15d648){var _0x5931a0={};var _0x37b265={};var _0x1316df;var _0x482f26;return db[_0x850e('0x28')][_0x850e('0x7c')]({'where':{'id':_0x23b945[_0x850e('0x2a')]['id']}})[_0x850e('0x1b')](handleEntityNotFound(_0x15d648,null))[_0x850e('0x1b')](function(_0x6f514b){if(_0x6f514b){_0x1316df=_0x6f514b;_0x37b265[_0x850e('0x7d')]=_['keys'](db[_0x850e('0x7e')]['rawAttributes']);_0x37b265[_0x850e('0x25')]=_['keys'](_0x23b945[_0x850e('0x25')]);_0x37b265[_0x850e('0x7f')]=_[_0x850e('0x80')](_0x37b265['model'],_0x37b265['query']);_0x5931a0[_0x850e('0x81')]=_[_0x850e('0x80')](_0x37b265[_0x850e('0x7d')],qs[_0x850e('0x82')](_0x23b945['query'][_0x850e('0x82')]));_0x5931a0['attributes']=_0x5931a0[_0x850e('0x81')][_0x850e('0x2d')]?_0x5931a0[_0x850e('0x81')]:_0x37b265[_0x850e('0x7d')];_0x5931a0[_0x850e('0x83')]=qs['sort'](_0x23b945[_0x850e('0x25')][_0x850e('0x84')]);_0x5931a0[_0x850e('0x63')]=qs[_0x850e('0x7f')](_[_0x850e('0x85')](_0x23b945[_0x850e('0x25')],_0x37b265[_0x850e('0x7f')]));if(_0x23b945[_0x850e('0x25')][_0x850e('0x86')]){_0x5931a0[_0x850e('0x63')]=_['merge'](_0x5931a0[_0x850e('0x63')],{'$or':_[_0x850e('0x73')](_0x5931a0[_0x850e('0x81')],function(_0x49e453){var _0x58a85f={};_0x58a85f[_0x49e453]={'$like':'%'+_0x23b945[_0x850e('0x25')][_0x850e('0x86')]+'%'};return _0x58a85f;})});}_0x5931a0=_['merge']({},_0x5931a0,_0x23b945['options']);return _0x1316df['getTags'](_0x5931a0);}})[_0x850e('0x1b')](function(_0x5b374b){if(_0x5b374b){_0x482f26=_0x5b374b[_0x850e('0x2d')];if(!_0x23b945[_0x850e('0x25')][_0x850e('0x38')]('nolimit')){_0x5931a0[_0x850e('0x16')]=qs[_0x850e('0x16')](_0x23b945[_0x850e('0x25')][_0x850e('0x16')]);_0x5931a0[_0x850e('0x15')]=qs[_0x850e('0x15')](_0x23b945[_0x850e('0x25')][_0x850e('0x15')]);}return _0x1316df[_0x850e('0x7b')](_0x5931a0);}})[_0x850e('0x1b')](function(_0x1f80e5){if(_0x1f80e5){return _0x1f80e5?{'count':_0x482f26,'rows':_0x1f80e5}:null;}})['then'](respondWithResult(_0x15d648,null))['catch'](handleError(_0x15d648,null));};exports[_0x850e('0x87')]=function(_0x2fec68,_0x336249){if(_0x2fec68[_0x850e('0x3a')]['id']){delete _0x2fec68['body']['id'];}return db[_0x850e('0x28')]['findOne']({'where':{'id':_0x2fec68[_0x850e('0x2a')]['id']}})[_0x850e('0x1b')](handleEntityNotFound(_0x336249,null))['then'](function(_0x1e385e){if(_0x1e385e){return _0x1e385e['setTags'](_0x2fec68[_0x850e('0x3a')][_0x850e('0x88')]||[]);}return null;})['then'](respondWithResult(_0x336249,null))[_0x850e('0x27')](handleError(_0x336249,null));};exports[_0x850e('0x89')]=function(_0x502c2d,_0x4ff961){var _0x57203a=[];_0x57203a['push'](addAdditionalPhones(_0x502c2d[_0x850e('0x3a')]));Promise[_0x850e('0x68')](_0x57203a)['then'](function(){_0x57203a=[];_0x57203a['push'](deleteCmHopperPhones(_0x502c2d[_0x850e('0x3a')]['id']));_0x57203a['push'](addCmHopperPhones(_0x502c2d[_0x850e('0x3a')]['id']));Promise[_0x850e('0x68')](_0x57203a)[_0x850e('0x1b')](function(){return[0x1];})[_0x850e('0x1b')](respondWithResult(_0x4ff961,null));});};function addAdditionalPhones(_0x4bd7ac){var _0x75af92;return new Promise(function(_0x5810a8){return db[_0x850e('0x4e')][_0x850e('0x1c')]({'where':{'CmContactId':_0x4bd7ac['id']}})['then'](function(){db[_0x850e('0x6d')][_0x850e('0x24')]({'raw':!![],'attributes':['id','OrderBy']})[_0x850e('0x1b')](function(_0x1cdb9c){var _0x594ede=[];for(var _0x24bd17=0x0;_0x24bd17<_0x4bd7ac['items'][_0x850e('0x2d')];_0x24bd17++){var _0x1aa82b=_0x4bd7ac[_0x850e('0x8a')]?_[_0x850e('0x59')](_0x4bd7ac[_0x850e('0x8a')][_0x24bd17])?'':_0x4bd7ac[_0x850e('0x8a')][_0x24bd17]:_0x4bd7ac[_0x850e('0x8b')][_0x24bd17][_0x850e('0x8c')]?_0x4bd7ac[_0x850e('0x8b')][_0x24bd17][_0x850e('0x8c')]:'';var _0x5d7bfd=_[_0x850e('0x59')](_0x4bd7ac[_0x850e('0x8b')][_0x24bd17][_0x850e('0x8d')])?'':_0x4bd7ac[_0x850e('0x8b')][_0x24bd17][_0x850e('0x8d')];var _0x52d34a=_0x1aa82b+':'+_0x4bd7ac[_0x850e('0x8b')][_0x24bd17][_0x850e('0x7a')]+'§'+_0x5d7bfd;if(_[_0x850e('0x59')](_0x75af92))_0x75af92=_0x52d34a;else _0x75af92+=';'+_0x52d34a;var _0x241955=null;var _0x23b145=null;if(_0x4bd7ac[_0x850e('0x8a')]){if(!_[_0x850e('0x59')](_0x4bd7ac[_0x850e('0x8a')][_0x24bd17])){_0x23b145=_[_0x850e('0x29')](_0x1cdb9c,function(_0x337767){return _0x337767['id']===_0x4bd7ac['item_types'][_0x24bd17];});if(!_[_0x850e('0x59')](_0x23b145)){_0x241955=_0x23b145['OrderBy'];}}}else{if(!_[_0x850e('0x59')](_0x4bd7ac['items'][_0x24bd17])){_0x23b145=_[_0x850e('0x29')](_0x1cdb9c,function(_0x28c0c0){return _0x28c0c0['id']===_0x4bd7ac['items'][_0x24bd17][_0x850e('0x8c')];});if(!_[_0x850e('0x59')](_0x23b145)){_0x241955=_0x24bd17;}}}if(_[_0x850e('0x59')](_0x241955)){_0x241955=0x64;}_0x594ede['push'](addAdditionalPhone(_0x4bd7ac['id'],_0x4bd7ac[_0x850e('0x8b')][_0x24bd17][_0x850e('0x7a')],_0x4bd7ac[_0x850e('0x8a')]?_[_0x850e('0x59')](_0x4bd7ac[_0x850e('0x8a')][_0x24bd17])?null:_0x4bd7ac[_0x850e('0x8a')][_0x24bd17]:_0x4bd7ac['items'][_0x24bd17][_0x850e('0x8c')]?_0x4bd7ac[_0x850e('0x8b')][_0x24bd17][_0x850e('0x8c')]:null,_0x241955,_0x5d7bfd));}Promise[_0x850e('0x68')](_0x594ede)['then'](function(){db['CmContact'][_0x850e('0x47')]({'AdditionalPhones':_0x75af92},{'where':{'id':_0x4bd7ac['id']}})[_0x850e('0x1b')](function(){_0x5810a8(0x1);});});});});});}function addAdditionalPhone(_0x19ec5d,_0x18f33d,_0x28250f,_0x1a9080,_0x186fc8){return db['CmContactHasItem'][_0x850e('0x29')]({'where':{'CmContactId':_0x19ec5d,'item':_0x18f33d}})[_0x850e('0x1b')](function(_0x344f68){if(_0x344f68)logger['info'](_0x850e('0x8e'),_0x344f68);else{db[_0x850e('0x4e')][_0x850e('0x45')]({'CmContactId':_0x19ec5d,'item':_0x18f33d,'ItemTypeId':_0x28250f,'OrderBy':_0x1a9080,'ItemClass':_0x850e('0x8f'),'description':_0x186fc8});}});}function deleteCmHopperPhones(_0x788062){return new Promise(function(_0x3cda83){return db[_0x850e('0x41')][_0x850e('0x24')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x788062}})[_0x850e('0x1b')](function(_0x144f71){db[_0x850e('0x90')]['destroy']({'where':{'CmHopperId':{'$in':_[_0x850e('0x73')](_0x144f71,'id')}}});})[_0x850e('0x1b')](function(){_0x3cda83(0x1);});});}function addCmHopperPhones(_0x4d6d98){return new Promise(function(_0x107b64){return db[_0x850e('0x41')]['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x4d6d98}})[_0x850e('0x1b')](function(_0x216fd6){var _0x13a305=[];_[_0x850e('0x73')](_0x216fd6,function(_0x41fef6){_0x13a305[_0x850e('0x62')](createCmHopperPhone(_0x4d6d98,_0x41fef6['id']));});Promise[_0x850e('0x68')](_0x13a305)[_0x850e('0x1b')](function(){_0x107b64(0x1);});});});}function createCmHopperPhone(_0x2e5c08,_0x538b4b){return new Promise(function(_0x55b23b){db[_0x850e('0x4e')][_0x850e('0x24')]({'raw':!![],'attributes':[_0x850e('0x91'),_0x850e('0x92')],'where':{'CmContactId':_0x2e5c08,'ItemClass':_0x850e('0x8f')},'include':[{'model':db[_0x850e('0x6d')],'attributes':['OrderBy'],'as':_0x850e('0x6e')}],'order':[_0x850e('0x92'),db[_0x850e('0x6f')][_0x850e('0x93')](_0x850e('0x94'))]})[_0x850e('0x1b')](function(_0x5b02f0){var _0x3e8de4=0x1;var _0x3ddca6=_[_0x850e('0x73')](_0x5b02f0,function(_0xc231f9){_0xc231f9[_0x850e('0x95')]=_0x538b4b;_0xc231f9[_0x850e('0x7a')]=_0xc231f9[_0x850e('0x91')];_0xc231f9[_0x850e('0x92')]=_0x3e8de4;delete _0xc231f9[_0x850e('0x96')];_0x3e8de4=_0x3e8de4+0x1;return _0xc231f9;});return db[_0x850e('0x90')]['bulkCreate'](_0x3ddca6,{});})[_0x850e('0x1b')](function(){_0x55b23b(0x1);});});}function insertAdditionalPhones(_0x3d05c9,_0x152646){return new Promise(function(_0x20f66b){var _0x4601e3=[];for(var _0xcfe375=0x0;_0xcfe375<_0x152646[_0x850e('0x2d')];_0xcfe375++){var _0x14ca9d=_0x152646[_0xcfe375];_0x4601e3[_0x850e('0x62')](parseContactItemType(_0x14ca9d));}Promise[_0x850e('0x68')](_0x4601e3)[_0x850e('0x1b')](function(){var _0x564fc0={'id':_0x3d05c9['id'],'items':_0x152646};return addAdditionalPhones(_0x564fc0)[_0x850e('0x1b')](function(){return addCmHopperPhones(_0x3d05c9['id']);});})[_0x850e('0x1b')](function(){_0x20f66b(_0x3d05c9);});});}function parseContactItemType(_0x62f424){return new Promise(function(_0x17f694){if(_0x62f424[_0x850e('0x38')]('ItemTypeId')){_0x17f694(_0x62f424);}else{return db['ContactItemType'][_0x850e('0x29')]({'where':{'name':_0x62f424[_0x850e('0x6e')]}})[_0x850e('0x1b')](function(_0x106ec1){if(_['isNil'](_0x106ec1))_0x62f424[_0x850e('0x8c')]=null;else _0x62f424[_0x850e('0x8c')]=_0x106ec1['id'];_0x17f694(_0x62f424);});}});}exports[_0x850e('0x97')]=function(_0x54eba1,_0x32f117){return db[_0x850e('0x4e')][_0x850e('0x24')]({'raw':!![],'where':{'CmContactId':_0x54eba1[_0x850e('0x2a')]['id'],'ItemClass':_0x850e('0x8f')},'include':[{'model':db[_0x850e('0x6d')],'as':_0x850e('0x6e')}],'order':[[_0x850e('0x92')],[db[_0x850e('0x6f')][_0x850e('0x93')](_0x850e('0x94'))]]})[_0x850e('0x1b')](function(_0x2c8df1){return _0x2c8df1;})['then'](respondWithResult(_0x32f117,null))[_0x850e('0x27')](handleError(_0x32f117,null));};exports[_0x850e('0x98')]=function(_0x43c5d6,_0x475c75){return db[_0x850e('0x4e')][_0x850e('0x24')]({'raw':!![],'where':{'CmContactId':_0x43c5d6[_0x850e('0x3a')]['fromContactId']}})['then'](function(_0x47022c){var _0x534b72=_[_0x850e('0x73')](_0x47022c,function(_0x133ea6){_0x133ea6[_0x850e('0x99')]=_0x43c5d6[_0x850e('0x3a')][_0x850e('0x9a')];return _0x133ea6;});return db['CmContactHasItem'][_0x850e('0x5e')](_0x534b72,{});})['then'](function(){return addCmHopperPhones(_0x43c5d6[_0x850e('0x3a')][_0x850e('0x9a')]);})['then'](function(){return['ok'];})[_0x850e('0x1b')](respondWithResult(_0x475c75,null))[_0x850e('0x27')](handleError(_0x475c75,null));};exports[_0x850e('0x9b')]=function(_0x375881,_0x20e935){var _0x2fdcd5=[];_0x2fdcd5[_0x850e('0x62')](createCmHopperPhone(_0x375881[_0x850e('0x3a')]['id'],_0x375881[_0x850e('0x3a')]['hopperId']));Promise['all'](_0x2fdcd5)[_0x850e('0x1b')](function(){return[0x1];})[_0x850e('0x1b')](respondWithResult(_0x20e935,null));};exports['getHoppers']=function(_0x38a7e7,_0x3e696c){var _0x240a10={'raw':![],'where':{}};var _0x2f99c9={};var _0x7df076={'count':0x0,'rows':[]};return db[_0x850e('0x28')][_0x850e('0x7c')]({'where':{'id':_0x38a7e7['params']['id']}})[_0x850e('0x1b')](handleEntityNotFound(_0x3e696c,null))[_0x850e('0x1b')](function(_0x4f0edf){if(_0x4f0edf){_0x2f99c9[_0x850e('0x7d')]=_[_0x850e('0x2c')](db[_0x850e('0x41')][_0x850e('0x9c')]);_0x2f99c9['query']=_[_0x850e('0x2c')](_0x38a7e7[_0x850e('0x25')]);_0x2f99c9[_0x850e('0x7f')]=_[_0x850e('0x80')](_0x2f99c9[_0x850e('0x7d')],_0x2f99c9[_0x850e('0x25')]);_0x240a10[_0x850e('0x81')]=_[_0x850e('0x80')](_0x2f99c9[_0x850e('0x7d')],qs[_0x850e('0x82')](_0x38a7e7['query'][_0x850e('0x82')]));_0x240a10[_0x850e('0x81')]=_0x240a10[_0x850e('0x81')][_0x850e('0x2d')]?_0x240a10[_0x850e('0x81')]:_0x2f99c9[_0x850e('0x7d')];if(!_0x38a7e7[_0x850e('0x25')]['hasOwnProperty'](_0x850e('0x9d'))){_0x240a10[_0x850e('0x16')]=qs[_0x850e('0x16')](_0x38a7e7[_0x850e('0x25')][_0x850e('0x16')]);_0x240a10['offset']=qs[_0x850e('0x15')](_0x38a7e7[_0x850e('0x25')]['offset']);}_0x240a10[_0x850e('0x83')]=qs[_0x850e('0x84')](_0x38a7e7[_0x850e('0x25')][_0x850e('0x84')]);_0x240a10['where']=qs[_0x850e('0x7f')](_[_0x850e('0x85')](_0x38a7e7[_0x850e('0x25')],_0x2f99c9[_0x850e('0x7f')]));_0x240a10[_0x850e('0x63')][_0x850e('0x9e')]=_0x4f0edf['id'];if(_0x38a7e7['query'][_0x850e('0x86')]){_0x240a10[_0x850e('0x63')]=_[_0x850e('0x39')](_0x240a10['where'],{'$or':_[_0x850e('0x73')](_0x240a10[_0x850e('0x81')],function(_0x5dd49f){var _0x2b50ec={};_0x2b50ec[_0x5dd49f]={'$like':'%'+_0x38a7e7[_0x850e('0x25')][_0x850e('0x86')]+'%'};return _0x2b50ec;})});}_0x240a10=_[_0x850e('0x39')]({},_0x240a10,_0x38a7e7[_0x850e('0x9f')]);return db[_0x850e('0x41')]['count']({'where':_0x240a10[_0x850e('0x63')]})['then'](function(_0xb24430){_0x7df076['count']=_0xb24430;if(_0x38a7e7['query'][_0x850e('0xa0')]){_0x240a10[_0x850e('0xa1')]=[{'all':!![]}];}return db[_0x850e('0x41')]['findAll'](_0x240a10);})[_0x850e('0x1b')](function(_0x38790e){_0x7df076[_0x850e('0xa2')]=_0x38790e;return _0x7df076;});}})[_0x850e('0x1b')](respondWithFilteredResult(_0x3e696c,_0x240a10))[_0x850e('0x27')](handleError(_0x3e696c,null));};exports[_0x850e('0xa3')]=function(_0x5a0e7f,_0x5318e6){var _0x465672={'raw':!![],'where':{}};var _0x1d1c9d={};var _0x3e79df={'count':0x0,'rows':[]};return db['CmContact'][_0x850e('0x7c')]({'where':{'id':_0x5a0e7f[_0x850e('0x2a')]['id']}})[_0x850e('0x1b')](handleEntityNotFound(_0x5318e6,null))[_0x850e('0x1b')](function(_0x24821a){if(_0x24821a){_0x1d1c9d[_0x850e('0x7d')]=_[_0x850e('0x2c')](db[_0x850e('0x50')][_0x850e('0x9c')]);_0x1d1c9d[_0x850e('0x25')]=_['keys'](_0x5a0e7f[_0x850e('0x25')]);_0x1d1c9d[_0x850e('0x7f')]=_['intersection'](_0x1d1c9d[_0x850e('0x7d')],_0x1d1c9d[_0x850e('0x25')]);_0x465672[_0x850e('0x81')]=_[_0x850e('0x80')](_0x1d1c9d[_0x850e('0x7d')],qs[_0x850e('0x82')](_0x5a0e7f['query'][_0x850e('0x82')]));_0x465672[_0x850e('0x81')]=_0x465672['attributes'][_0x850e('0x2d')]?_0x465672['attributes']:_0x1d1c9d[_0x850e('0x7d')];if(!_0x5a0e7f[_0x850e('0x25')]['hasOwnProperty'](_0x850e('0x9d'))){_0x465672[_0x850e('0x16')]=qs[_0x850e('0x16')](_0x5a0e7f[_0x850e('0x25')]['limit']);_0x465672['offset']=qs[_0x850e('0x15')](_0x5a0e7f[_0x850e('0x25')][_0x850e('0x15')]);}_0x465672[_0x850e('0x83')]=qs[_0x850e('0x84')](_0x5a0e7f[_0x850e('0x25')]['sort']);_0x465672['where']=qs[_0x850e('0x7f')](_[_0x850e('0x85')](_0x5a0e7f['query'],_0x1d1c9d[_0x850e('0x7f')]));_0x465672[_0x850e('0x63')][_0x850e('0x9e')]=_0x24821a['id'];if(_0x5a0e7f[_0x850e('0x25')]['filter']){_0x465672[_0x850e('0x63')]=_[_0x850e('0x39')](_0x465672['where'],{'$or':_[_0x850e('0x73')](_0x465672[_0x850e('0x81')],function(_0x178ed9){var _0x447a4e={};_0x447a4e[_0x178ed9]={'$like':'%'+_0x5a0e7f[_0x850e('0x25')][_0x850e('0x86')]+'%'};return _0x447a4e;})});}_0x465672=_[_0x850e('0x39')]({},_0x465672,_0x5a0e7f['options']);return db[_0x850e('0x50')][_0x850e('0x18')]({'where':_0x465672[_0x850e('0x63')]})['then'](function(_0x9c937){_0x3e79df[_0x850e('0x18')]=_0x9c937;if(_0x5a0e7f[_0x850e('0x25')]['includeAll']){_0x465672[_0x850e('0xa1')]=[{'all':!![]}];}return db[_0x850e('0x50')][_0x850e('0x24')](_0x465672);})[_0x850e('0x1b')](function(_0x288d55){_0x3e79df[_0x850e('0xa2')]=_0x288d55;return _0x3e79df;});}})[_0x850e('0x1b')](respondWithFilteredResult(_0x5318e6,_0x465672))[_0x850e('0x27')](handleError(_0x5318e6,null));};exports['getHopperFinals']=function(_0x58a1ca,_0x2d6ed2){var _0x12d1eb={'raw':!![],'where':{}};var _0x1cf2f9={};var _0x433db0={'count':0x0,'rows':[]};return db[_0x850e('0x28')][_0x850e('0x7c')]({'where':{'id':_0x58a1ca[_0x850e('0x2a')]['id']}})['then'](handleEntityNotFound(_0x2d6ed2,null))[_0x850e('0x1b')](function(_0x42866e){if(_0x42866e){_0x1cf2f9[_0x850e('0x7d')]=_[_0x850e('0x2c')](db['CmHopperFinal']['rawAttributes']);_0x1cf2f9[_0x850e('0x25')]=_[_0x850e('0x2c')](_0x58a1ca[_0x850e('0x25')]);_0x1cf2f9[_0x850e('0x7f')]=_[_0x850e('0x80')](_0x1cf2f9[_0x850e('0x7d')],_0x1cf2f9['query']);_0x12d1eb[_0x850e('0x81')]=_['intersection'](_0x1cf2f9[_0x850e('0x7d')],qs[_0x850e('0x82')](_0x58a1ca[_0x850e('0x25')][_0x850e('0x82')]));_0x12d1eb[_0x850e('0x81')]=_0x12d1eb[_0x850e('0x81')][_0x850e('0x2d')]?_0x12d1eb[_0x850e('0x81')]:_0x1cf2f9['model'];if(!_0x58a1ca[_0x850e('0x25')][_0x850e('0x38')](_0x850e('0x9d'))){_0x12d1eb[_0x850e('0x16')]=qs[_0x850e('0x16')](_0x58a1ca[_0x850e('0x25')][_0x850e('0x16')]);_0x12d1eb[_0x850e('0x15')]=qs[_0x850e('0x15')](_0x58a1ca[_0x850e('0x25')][_0x850e('0x15')]);}_0x12d1eb[_0x850e('0x83')]=qs[_0x850e('0x84')](_0x58a1ca['query'][_0x850e('0x84')]);_0x12d1eb[_0x850e('0x63')]=qs[_0x850e('0x7f')](_[_0x850e('0x85')](_0x58a1ca[_0x850e('0x25')],_0x1cf2f9[_0x850e('0x7f')]));_0x12d1eb[_0x850e('0x63')]['ContactId']=_0x42866e['id'];if(_0x58a1ca['query'][_0x850e('0x86')]){_0x12d1eb[_0x850e('0x63')]=_[_0x850e('0x39')](_0x12d1eb[_0x850e('0x63')],{'$or':_['map'](_0x12d1eb[_0x850e('0x81')],function(_0x5c38b0){var _0x358d22={};_0x358d22[_0x5c38b0]={'$like':'%'+_0x58a1ca[_0x850e('0x25')][_0x850e('0x86')]+'%'};return _0x358d22;})});}_0x12d1eb=_[_0x850e('0x39')]({},_0x12d1eb,_0x58a1ca[_0x850e('0x9f')]);return db['CmHopperFinal'][_0x850e('0x18')]({'where':_0x12d1eb['where']})[_0x850e('0x1b')](function(_0x336dec){_0x433db0[_0x850e('0x18')]=_0x336dec;if(_0x58a1ca['query']['includeAll']){_0x12d1eb[_0x850e('0xa1')]=[{'all':!![]}];}return db[_0x850e('0x4f')][_0x850e('0x24')](_0x12d1eb);})['then'](function(_0x371ba0){_0x433db0[_0x850e('0xa2')]=_0x371ba0;return _0x433db0;});}})[_0x850e('0x1b')](respondWithFilteredResult(_0x2d6ed2,_0x12d1eb))[_0x850e('0x27')](handleError(_0x2d6ed2,null));};exports[_0x850e('0xa4')]=function(_0x1a2c03,_0x368d12){var _0x53c5cf={'raw':!![],'where':{}};var _0x265fed={};var _0x54308b={'count':0x0,'rows':[]};return db[_0x850e('0x28')][_0x850e('0x7c')]({'where':{'id':_0x1a2c03[_0x850e('0x2a')]['id']}})[_0x850e('0x1b')](handleEntityNotFound(_0x368d12,null))[_0x850e('0x1b')](function(_0x5de4a1){if(_0x5de4a1){_0x265fed['model']=_['keys'](db[_0x850e('0x55')][_0x850e('0x9c')]);_0x265fed[_0x850e('0x25')]=_[_0x850e('0x2c')](_0x1a2c03[_0x850e('0x25')]);_0x265fed['filters']=_['intersection'](_0x265fed[_0x850e('0x7d')],_0x265fed[_0x850e('0x25')]);_0x53c5cf[_0x850e('0x81')]=_[_0x850e('0x80')](_0x265fed[_0x850e('0x7d')],qs[_0x850e('0x82')](_0x1a2c03['query']['fields']));_0x53c5cf[_0x850e('0x81')]=_0x53c5cf[_0x850e('0x81')][_0x850e('0x2d')]?_0x53c5cf[_0x850e('0x81')]:_0x265fed[_0x850e('0x7d')];if(!_0x1a2c03[_0x850e('0x25')][_0x850e('0x38')](_0x850e('0x9d'))){_0x53c5cf['limit']=qs['limit'](_0x1a2c03[_0x850e('0x25')]['limit']);_0x53c5cf[_0x850e('0x15')]=qs['offset'](_0x1a2c03[_0x850e('0x25')][_0x850e('0x15')]);}_0x53c5cf[_0x850e('0x83')]=qs[_0x850e('0x84')](_0x1a2c03['query'][_0x850e('0x84')]);_0x53c5cf[_0x850e('0x63')]=qs[_0x850e('0x7f')](_[_0x850e('0x85')](_0x1a2c03[_0x850e('0x25')],_0x265fed['filters']));_0x53c5cf['where'][_0x850e('0x9e')]=_0x5de4a1['id'];if(_0x1a2c03[_0x850e('0x25')][_0x850e('0x86')]){_0x53c5cf[_0x850e('0x63')]=_['merge'](_0x53c5cf['where'],{'$or':_[_0x850e('0x73')](_0x53c5cf[_0x850e('0x81')],function(_0xc3ae5c){var _0x423b87={};_0x423b87[_0xc3ae5c]={'$like':'%'+_0x1a2c03[_0x850e('0x25')][_0x850e('0x86')]+'%'};return _0x423b87;})});}_0x53c5cf=_[_0x850e('0x39')]({},_0x53c5cf,_0x1a2c03[_0x850e('0x9f')]);return db[_0x850e('0x55')][_0x850e('0x18')]({'where':_0x53c5cf[_0x850e('0x63')]})['then'](function(_0x1c6052){_0x54308b[_0x850e('0x18')]=_0x1c6052;if(_0x1a2c03['query'][_0x850e('0xa0')]){_0x53c5cf[_0x850e('0xa1')]=[{'all':!![]}];}return db[_0x850e('0x55')][_0x850e('0x24')](_0x53c5cf);})[_0x850e('0x1b')](function(_0x224170){_0x54308b[_0x850e('0xa2')]=_0x224170;return _0x54308b;});}})[_0x850e('0x1b')](respondWithFilteredResult(_0x368d12,_0x53c5cf))[_0x850e('0x27')](handleError(_0x368d12,null));};exports[_0x850e('0xa5')]=function(_0x164857,_0x3af09d){try{if(!_0x164857[_0x850e('0x3a')]['ListId']){throw new Error(_0x850e('0xa6'));}if(!_0x164857[_0x850e('0x3a')][_0x850e('0xa7')]){throw new Error(_0x850e('0xa8'));}if(!_0x164857[_0x850e('0x3a')]['binding_values']){throw new Error('No\x20association\x20values\x20specified!');}if(!_0x164857[_0x850e('0x3a')][_0x850e('0xa9')]){throw new Error(_0x850e('0xaa'));}var _0x2d73ad=_0x164857[_0x850e('0x3a')][_0x850e('0xa7')]['split'](',');var _0xc49acc=_0x164857[_0x850e('0x3a')][_0x850e('0xab')][_0x850e('0xac')](',');if(!_0x2d73ad['length']||!_0xc49acc[_0x850e('0x2d')]||_0x2d73ad['length']!==_0xc49acc[_0x850e('0x2d')]){throw new Error(_0x850e('0xad'));}_0x164857['body'][_0x850e('0x82')]=_[_0x850e('0xae')](_0x2d73ad,_0xc49acc);if(!_0x164857[_0x850e('0x3a')][_0x850e('0x82')][_0x850e('0x7a')]){throw new Error(_0x850e('0xaf'));}if(!_0x164857[_0x850e('0x3a')]['fields'][_0x850e('0xb0')]){throw new Error(_0x850e('0xb1'));}var _0x2a9bf5=path[_0x850e('0x3e')](config[_0x850e('0xb2')],'server/files/tmp',_0x164857[_0x850e('0xb3')]['filename']);fs[_0x850e('0xb4')](_0x2a9bf5,parseInt('0777',0x8));var _0x1ca9b9=require(_0x850e('0xb5'))[_0x850e('0xb6')](path[_0x850e('0x3e')](__dirname,_0x850e('0xb7')),[_0x2a9bf5,_0x164857[_0x850e('0x3a')][_0x850e('0xa7')],_0x164857[_0x850e('0x3a')][_0x850e('0xab')],_0x164857[_0x850e('0x3a')][_0x850e('0x64')],_0x164857[_0x850e('0x3a')]['CompanyId'],_0x164857[_0x850e('0x3a')]['duplicates'],_0x164857[_0x850e('0x3a')][_0x850e('0xa9')]]);return _0x3af09d[_0x850e('0x13')](0xc8)[_0x850e('0x14')]({'message':_0x850e('0xb8'),'pid':_0x1ca9b9['pid']});}catch(_0x193a1c){return _0x3af09d[_0x850e('0x13')](0x1f4)['send'](_0x193a1c);}};exports['upload']=function(_0x125840,_0x51dd45){var _0x11e8fd=fs[_0x850e('0xb9')](_0x125840['file']['path']);Papa[_0x850e('0xba')](_0x11e8fd,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x54b4b1){return _0x51dd45[_0x850e('0x13')](0xc8)['json']({'file':_0x125840[_0x850e('0xb3')],'fields':_0x54b4b1['meta'][_0x850e('0x82')]});}});};exports['import']=function(_0x342a98,_0x364dcf){return db[_0x850e('0xbb')]['findAll']({'raw':!![],'attributes':['id'],'where':{'role':'agent'}})[_0x850e('0x1b')](function(_0x1c7845){var _0x5f3f51=![];if(!_0x342a98[_0x850e('0x3a')][_0x850e('0x64')]){throw new Error('No\x20ListId\x20specified');}if(!_0x342a98[_0x850e('0x3a')][_0x850e('0xbc')]['phone']){throw new Error(_0x850e('0xaf'));}if(!_0x342a98[_0x850e('0x3a')][_0x850e('0xbc')][_0x850e('0xb0')]){throw new Error(_0x850e('0xb1'));}if(!_0x342a98[_0x850e('0x3a')][_0x850e('0xa9')]){throw new Error(_0x850e('0xaa'));}var _0xfd5862=require(_0x850e('0xb5'))[_0x850e('0xb6')](path[_0x850e('0x3e')](__dirname,_0x850e('0xbd')),[_0x342a98[_0x850e('0x2a')]['id'],JSON[_0x850e('0xbe')](_0x342a98[_0x850e('0x3a')]),JSON[_0x850e('0xbe')](_0x1c7845)]);_0xfd5862['on'](_0x850e('0xbf'),function(){_0x5f3f51=!![];return _0x364dcf[_0x850e('0x13')](0xc8)[_0x850e('0x14')]({'message':_0x850e('0xc0'),'pid':_0xfd5862[_0x850e('0xc1')]});});_0xfd5862['on'](_0x850e('0xc2'),function(_0x4afe74){if(_0x4afe74&&!_0x5f3f51){return _0x364dcf[_0x850e('0x13')](0x1f4)[_0x850e('0x14')]({'message':_0x850e('0xc3'),'pid':_0xfd5862[_0x850e('0xc1')]});}});})[_0x850e('0x27')](handleError(_0x364dcf,null));};exports[_0x850e('0xc4')]=function(_0x37596d,_0x552974){return db['User']['findAll']({'raw':!![],'attributes':['id'],'where':{'role':_0x850e('0xc5')}})[_0x850e('0x1b')](function(_0xbc8361){var _0x3d7837=![];if(!_0x37596d[_0x850e('0x3a')][_0x850e('0x64')]){throw new Error(_0x850e('0xa6'));}if(!_0x37596d[_0x850e('0x3a')][_0x850e('0xbc')][_0x850e('0x7a')]){throw new Error(_0x850e('0xaf'));}if(!_0x37596d['body'][_0x850e('0xbc')][_0x850e('0xb0')]){throw new Error(_0x850e('0xb1'));}if(!_0x37596d[_0x850e('0x3a')][_0x850e('0xa9')]){throw new Error(_0x850e('0xaa'));}var _0x226e2c=require('child_process')[_0x850e('0xb6')](path[_0x850e('0x3e')](__dirname,_0x850e('0xc6')),[_0x37596d['params']['id'],JSON['stringify'](_0x37596d[_0x850e('0x3a')]),JSON[_0x850e('0xbe')](_0xbc8361)]);_0x226e2c['on'](_0x850e('0xbf'),function(){_0x3d7837=!![];return _0x552974['status'](0xc8)[_0x850e('0x14')]({'message':_0x850e('0xc0'),'pid':_0x226e2c[_0x850e('0xc1')]});});_0x226e2c['on'](_0x850e('0xc2'),function(_0x5c445d){if(_0x5c445d&&!_0x3d7837){return _0x552974[_0x850e('0x13')](0x1f4)['json']({'message':_0x850e('0xc3'),'pid':_0x226e2c[_0x850e('0xc1')]});}});})['catch'](handleError(_0x552974,null));};exports['getJourney']=function(_0x32531c,_0x3bec43){var _0x44176f=[_0x850e('0xc7'),_0x850e('0xc8'),_0x850e('0xc9'),'openchannel',_0x850e('0xca'),_0x850e('0xcb'),'voice'];var _0x4965ea={'offset':0x0,'order':qs[_0x850e('0x84')](_0x850e('0xcc'))},_0x1bbf80={'count':0x0,'rows':[]};Promise[_0x850e('0xcd')]()[_0x850e('0x1b')](function(){if(_0x32531c[_0x850e('0x25')][_0x850e('0xce')]){if(!_['includes'](_0x44176f,_0x32531c['query'][_0x850e('0xce')][_0x850e('0xcf')]())){throw new Error(_0x850e('0xd0'));}_0x44176f=[_0x32531c[_0x850e('0x25')]['channel']['toLowerCase']()];}if(_0x32531c[_0x850e('0x25')]['range']){try{var _0x3d12c6=JSON[_0x850e('0xba')](_0x32531c[_0x850e('0x25')][_0x850e('0xd1')]);if(!moment(_0x3d12c6[_0x850e('0x40')])[_0x850e('0xd2')]()){throw new Error(_0x850e('0xd3'));}if(!moment(_0x3d12c6['to'])[_0x850e('0xd2')]()){throw new Error(_0x850e('0xd4'));}}catch(_0x3fc57a){throw new Error(_0x850e('0xd5'));}}if(!_0x32531c['query'][_0x850e('0x38')]('nolimit')){_0x4965ea[_0x850e('0x16')]=qs[_0x850e('0x16')](_0x32531c[_0x850e('0x25')]['limit']||0xa);_0x4965ea['offset']=qs[_0x850e('0x15')](_0x32531c['query'][_0x850e('0x15')]);}var _0x1ac854=_0x44176f[_0x850e('0x73')](function(_0x1f068f){if(_0x1f068f===_0x850e('0xd6')){var _0x2c2369={'attributes':['id',_0x850e('0xd7'),_0x850e('0xd8'),_0x850e('0xd9'),_0x850e('0xda'),_0x850e('0xdb'),_0x850e('0xdc'),'endtime','duration',_0x850e('0xdd'),'createdAt',_0x850e('0xde'),_0x850e('0xdf'),_0x850e('0xe0'),_0x850e('0xe1')],'where':{'ContactId':_0x32531c[_0x850e('0x2a')]['id']},'include':[{'model':db['User'],'as':_0x850e('0xbb'),'attributes':['id','name',_0x850e('0xe2'),_0x850e('0x32')]}],'order':[[_0x850e('0xe3'),_0x850e('0xe4')]]};if(_0x32531c['query'][_0x850e('0xd1')]){_0x2c2369['where']['createdAt']={'$gte':_0x3d12c6[_0x850e('0x40')],'$lte':_0x3d12c6['to']};}return db[_0x850e('0x52')][_0x850e('0xe5')](_0x2c2369)[_0x850e('0x1b')](function(_0x292169){_0x1bbf80['count']+=_0x292169['count'];return _[_0x850e('0x73')](_0x292169[_0x850e('0xa2')],function(_0x3c43e5){var _0x41813d=_0x3c43e5[_0x850e('0x3b')]({'plain':!![]});_0x41813d['channel']=_0x1f068f;if(_0x41813d[_0x850e('0xbb')]){_0x41813d[_0x850e('0xbb')]={'id':_0x41813d[_0x850e('0xbb')]['id'],'name':_0x41813d[_0x850e('0xbb')]['name'],'fullname':_0x41813d['User'][_0x850e('0xe2')],'alias':_0x41813d[_0x850e('0xbb')][_0x850e('0x32')]};}return _0x41813d;});});}else{var _0x1cd6a1=_[_0x850e('0xe6')](_0x1f068f)+(_0x1f068f===_0x850e('0xc8')?_0x850e('0xe7'):_0x850e('0xe8'));var _0x363a05={'attributes':['id',_0x850e('0xe9'),'closedAt',_0x850e('0xe3'),_0x850e('0xdd'),_0x850e('0xea'),'secondDisposition',_0x850e('0xeb'),_0x850e('0xe1'),_0x1cd6a1+'Id'],'where':{'ContactId':_0x32531c['params']['id']},'include':[{'model':db[_0x1cd6a1],'as':'Account','attributes':['id','name',_0x850e('0xec')]},{'model':db[_0x850e('0xbb')],'as':_0x850e('0xed'),'attributes':['id',_0x850e('0x1f'),_0x850e('0xe2')]},{'model':db['Tag'],'as':_0x850e('0x6a'),'attributes':['id',_0x850e('0x1f'),_0x850e('0xee')],'through':{'attributes':[]}}],'order':[[_0x850e('0xe3'),_0x850e('0xe4')]]};if(_0x32531c[_0x850e('0x25')][_0x850e('0xd1')]){_0x363a05[_0x850e('0x63')]['createdAt']={'$gte':_0x3d12c6[_0x850e('0x40')],'$lte':_0x3d12c6['to']};}switch(_0x1f068f){case _0x850e('0xc8'):_0x363a05[_0x850e('0x81')][_0x850e('0x62')]('browserName',_0x850e('0xef'),'customerPort',_0x850e('0xf0'),_0x850e('0xf1'),_0x850e('0xf2'),_0x850e('0xf3'),_0x850e('0xf4'),_0x850e('0xf5'));break;case _0x850e('0xc7'):_0x363a05[_0x850e('0x81')][_0x850e('0x62')](_0x850e('0xf6'),_0x850e('0xf7'));break;case _0x850e('0xf8'):_0x363a05[_0x850e('0x81')][_0x850e('0x62')](_0x850e('0xf9'),_0x850e('0xfa'));break;}return db[_['startCase'](_0x1f068f)+_0x850e('0xfb')][_0x850e('0xe5')](_0x363a05)['then'](function(_0x5cb06d){_0x1bbf80[_0x850e('0x18')]+=_0x5cb06d['count'];return _[_0x850e('0x73')](_0x5cb06d[_0x850e('0xa2')],function(_0x5b7da3){var _0x16f4b6=_0x5b7da3[_0x850e('0x3b')]({'plain':!![]});_0x16f4b6[_0x850e('0xce')]=_0x1f068f;if(_0x16f4b6[_0x850e('0xed')]){_0x16f4b6['Owner']={'id':_0x16f4b6[_0x850e('0xed')]['id'],'name':_0x16f4b6[_0x850e('0xed')][_0x850e('0x1f')],'fullname':_0x16f4b6['Owner'][_0x850e('0xe2')]};}return _0x16f4b6;});});}});return Promise[_0x850e('0x68')](_0x1ac854);})[_0x850e('0x1b')](function(_0x2267b1){return _(_0x2267b1)['flatten']()['sortBy']('createdAt')[_0x850e('0xfc')]()[_0x850e('0xfd')]();})['then'](function(_0x1fc1a7){_0x1bbf80[_0x850e('0xa2')]=_0x4965ea['limit']?_0x1fc1a7['slice'](_0x4965ea['offset'],_0x4965ea[_0x850e('0x15')]+_0x4965ea[_0x850e('0x16')]):_0x1fc1a7;return _0x1bbf80;})[_0x850e('0x1b')](respondWithFilteredResult(_0x3bec43,_0x4965ea))['catch'](handleError(_0x3bec43,null));}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.events.js b/server/api/cmContact/cmContact.events.js index fcf7b09..97bc04b 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 _0xb67d=['hook','exports','../../mysqldb','CmContact','setMaxListeners','save','remove','emit','hasOwnProperty'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb67d,0xc8));var _0xdb67=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xb67d[_0x3b380d];return _0x54502b;};'use strict';var EventEmitter=require('events');var CmContact=require(_0xdb67('0x0'))['db'][_0xdb67('0x1')];var CmContactEvents=new EventEmitter();CmContactEvents[_0xdb67('0x2')](0x0);var events={'afterCreate':_0xdb67('0x3'),'afterUpdate':'update','afterDestroy':_0xdb67('0x4')};function emitEvent(_0x5a4751){return function(_0x1f6d22,_0x5e49b3,_0x321a38){CmContactEvents['emit'](_0x5a4751+':'+_0x1f6d22['id'],_0x1f6d22);CmContactEvents[_0xdb67('0x5')](_0x5a4751,_0x1f6d22);_0x321a38(null);};}for(var e in events){if(events[_0xdb67('0x6')](e)){var event=events[e];CmContact[_0xdb67('0x7')](e,emitEvent(event));}}module[_0xdb67('0x8')]=CmContactEvents; \ No newline at end of file +var _0xf01d=['setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','CmContact'];(function(_0x617e23,_0x40c35d){var _0xaf23c5=function(_0x79d10b){while(--_0x79d10b){_0x617e23['push'](_0x617e23['shift']());}};_0xaf23c5(++_0x40c35d);}(_0xf01d,0x133));var _0xdf01=function(_0x270323,_0x3ccd6c){_0x270323=_0x270323-0x0;var _0x579d82=_0xf01d[_0x270323];return _0x579d82;};'use strict';var EventEmitter=require(_0xdf01('0x0'));var CmContact=require(_0xdf01('0x1'))['db'][_0xdf01('0x2')];var CmContactEvents=new EventEmitter();CmContactEvents[_0xdf01('0x3')](0x0);var events={'afterCreate':_0xdf01('0x4'),'afterUpdate':'update','afterDestroy':_0xdf01('0x5')};function emitEvent(_0x3e2597){return function(_0x208ceb,_0x5a872b,_0x151b1a){CmContactEvents[_0xdf01('0x6')](_0x3e2597+':'+_0x208ceb['id'],_0x208ceb);CmContactEvents[_0xdf01('0x6')](_0x3e2597,_0x208ceb);_0x151b1a(null);};}for(var e in events){if(events[_0xdf01('0x7')](e)){var event=events[e];CmContact[_0xdf01('0x8')](e,emitEvent(event));}}module[_0xdf01('0x9')]=CmContactEvents; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.model.js b/server/api/cmContact/cmContact.model.js index 20c9176..6e26850 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 _0x1fd0=['CmHopperFinal','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20','outbound','dialCheckDuplicateType','Lists','length','get','always','findAll','CmList','BlackLists','CmHopperBlack','cmContact,\x20%s,\x20%s','message','onlyIfOpen','List\x20not\x20found','models','isEmpty','ContactId','VoiceQueueId','CampaignId','all','info','[CmContact][afterDestroy][Succesfull]','[CmContact][afterDestroy][Error]','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment/shared','exports','CmContact','phone','fti_cm_contacts','lastName','mobile','fax','email','FULLTEXT','utf8mb4','cmContact','afterCreate','inspect','scheduledat','format','YYYY-MM-DD\x20HH:mm:ss','isNil','VoiceQueue','findOne','then','dialTimezone','utcOffset','add','minutes','ret','CmHopper','cmContact,\x20afterCreate\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','create','ListId','priority','callbackUniqueid','catch','cmContact,\x20afterCreate,\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20','error','Campaign','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20Campaign\x20'];(function(_0x271210,_0xbdfe6b){var _0x54ff1f=function(_0x1990f2){while(--_0x1990f2){_0x271210['push'](_0x271210['shift']());}};_0x54ff1f(++_0xbdfe6b);}(_0x1fd0,0xf1));var _0x01fd=function(_0x3811b4,_0xd87ac4){_0x3811b4=_0x3811b4-0x0;var _0x1a86a2=_0x1fd0[_0x3811b4];return _0x1a86a2;};'use strict';var _=require(_0x01fd('0x0'));var util=require(_0x01fd('0x1'));var logger=require(_0x01fd('0x2'))(_0x01fd('0x3'));var moment=require(_0x01fd('0x4'));var BPromise=require('bluebird');var rp=require(_0x01fd('0x5'));var fs=require('fs');var path=require(_0x01fd('0x6'));var rimraf=require(_0x01fd('0x7'));var config=require('../../config/environment');var shared=require(_0x01fd('0x8'));var attributes=require('./cmContact.attributes');module[_0x01fd('0x9')]=function(_0x2c6aea,_0x111425){return _0x2c6aea['define'](_0x01fd('0xa'),attributes,{'tableName':'cm_contacts','paranoid':!![],'indexes':[{'name':'phone','fields':[_0x01fd('0xb')]},{'name':_0x01fd('0xc'),'fields':['firstName',_0x01fd('0xd'),'phone',_0x01fd('0xe'),_0x01fd('0xf'),_0x01fd('0x10')],'type':_0x01fd('0x11')}],'timestamps':!![],'charset':_0x01fd('0x12'),'collate':'utf8mb4_unicode_ci','hooks':{'afterCreate':function(_0x11ba8a,_0x197ba8,_0x1b28cd){var _0x594d2c=_0x2c6aea['models'];var _0x21c004=_0x11ba8a['get']({'plain':!![]});function _0x3372d3(){return function(_0x43527f){logger['error'](_0x01fd('0x13'),_0x01fd('0x14'),util[_0x01fd('0x15')](_0x43527f,{'showHidden':![],'depth':null}));};}function _0x2a23a0(_0x1e768b,_0x27919c){var _0x1b9a94=_0x27919c[_0x01fd('0x16')]?_0x27919c[_0x01fd('0x16')]:moment()[_0x01fd('0x17')](_0x01fd('0x18'));return new BPromise(function(_0x4f4a9d,_0x496c77){if(_[_0x01fd('0x19')](_0x27919c['dialTimezone'])){_0x4f4a9d({'ret':_0x1b9a94});}else{_0x594d2c[_0x01fd('0x1a')][_0x01fd('0x1b')]({'where':{'id':_0x1e768b['id']}})[_0x01fd('0x1c')](function(_0x2db8af){if(!_[_0x01fd('0x19')](_0x2db8af)){var _0x449277=_0x2db8af[_0x01fd('0x1d')];if(!_[_0x01fd('0x19')](_0x449277)){var _0x3800a2=shared['timezones'];var _0x588e73=_0x3800a2[_0x449277];var _0x53334a=_0x3800a2[_0x27919c[_0x01fd('0x1d')]];if(!_['isNil'](_0x588e73)&&!_['isNil'](_0x53334a)){var _0xe0a05c=_0x588e73[_0x01fd('0x1e')]-_0x53334a[_0x01fd('0x1e')];_0x1b9a94=_0x27919c[_0x01fd('0x16')]?_0x27919c[_0x01fd('0x16')]:moment();var _0x3ffadf=moment(_0x1b9a94)[_0x01fd('0x1f')](_0xe0a05c,_0x01fd('0x20'));_0x4f4a9d({'ret':_0x3ffadf['format'](_0x01fd('0x18'))});}else _0x4f4a9d({'ret':_0x1b9a94});}else _0x4f4a9d({'ret':_0x1b9a94});}else{_0x4f4a9d({'ret':_0x1b9a94});}});}});return 0xa;}var _0x438a07=function(_0x5bf07f){return new BPromise(function(_0xe03cab,_0x5a4266){_0x2a23a0(_0x5bf07f,_0x21c004)[_0x01fd('0x1c')](function(_0x5dcbbb){_0x21c004[_0x01fd('0x16')]=_0x5dcbbb[_0x01fd('0x21')];_0x594d2c[_0x01fd('0x22')][_0x01fd('0x1b')]({'where':{'phone':_0x21c004['phone'],'VoiceQueueId':_0x5bf07f['id']}})[_0x01fd('0x1c')](function(_0x31cc54){if(!_[_0x01fd('0x19')](_0x31cc54)){throw new Error(_0x01fd('0x23')+_0x21c004[_0x01fd('0xb')]+_0x01fd('0x24')+_0x5bf07f['id']);}return _0x594d2c[_0x01fd('0x22')][_0x01fd('0x25')]({'phone':_0x21c004[_0x01fd('0xb')],'ContactId':_0x21c004['id'],'ListId':_0x21c004[_0x01fd('0x26')],'priority':_0x21c004['priority']?_0x21c004[_0x01fd('0x27')]:0x2,'scheduledat':_0x21c004[_0x01fd('0x16')]?_0x21c004['scheduledat']:moment()[_0x01fd('0x17')](_0x01fd('0x18')),'callback':_0x21c004[_0x01fd('0x28')]?!![]:![],'callbackuniqueid':_0x21c004['callbackUniqueid']?_0x21c004['callbackUniqueid']:undefined,'callbackat':_0x21c004[_0x01fd('0x28')]?moment()[_0x01fd('0x17')](_0x01fd('0x18')):undefined,'VoiceQueueId':_0x5bf07f['id']});})[_0x01fd('0x29')](function(_0x1b428c){_0x5a4266(_0x1b428c);});});});};var _0x137eac=function(_0x2f82c3){return new BPromise(function(_0x4cd34c,_0x19ddeb){_0x2a23a0(_0x2f82c3,_0x21c004)[_0x01fd('0x1c')](function(_0x5ae392){_0x21c004['scheduledat']=_0x5ae392['ret'];_0x594d2c[_0x01fd('0x22')]['findOne']({'where':{'phone':_0x21c004['phone'],'VoiceQueueId':_0x2f82c3['id']}})[_0x01fd('0x1c')](function(_0x445af9){if(!_[_0x01fd('0x19')](_0x445af9)){throw new Error(_0x01fd('0x23')+_0x21c004[_0x01fd('0xb')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20'+_0x2f82c3['id']);}return _0x594d2c['CmHopperFinal'][_0x01fd('0x1b')]({'where':{'calleridnum':_0x21c004[_0x01fd('0xb')],'VoiceQueueId':_0x2f82c3['id']}});})['then'](function(_0x35ad83){if(!_[_0x01fd('0x19')](_0x35ad83)){throw new Error(_0x01fd('0x2a')+_0x21c004[_0x01fd('0xb')]+_0x01fd('0x2b')+_0x2f82c3['id']);}return _0x594d2c[_0x01fd('0x22')][_0x01fd('0x25')]({'phone':_0x21c004[_0x01fd('0xb')],'ContactId':_0x21c004['id'],'ListId':_0x21c004[_0x01fd('0x26')],'priority':_0x21c004[_0x01fd('0x27')]?_0x21c004[_0x01fd('0x27')]:0x2,'scheduledat':_0x21c004[_0x01fd('0x16')]?_0x21c004[_0x01fd('0x16')]:moment()[_0x01fd('0x17')]('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x21c004[_0x01fd('0x28')]?!![]:![],'callbackuniqueid':_0x21c004[_0x01fd('0x28')]?_0x21c004[_0x01fd('0x28')]:undefined,'callbackat':_0x21c004[_0x01fd('0x28')]?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined,'VoiceQueueId':_0x2f82c3['id']});})[_0x01fd('0x29')](function(_0xffdae9){_0x19ddeb(_0xffdae9);});});});};function _0x21ebf8(){return function(_0x4e4c90){logger[_0x01fd('0x2c')]('cmContact',_0x01fd('0x14'),util[_0x01fd('0x15')](_0x4e4c90,{'showHidden':![],'depth':null}));};}function _0x32409f(_0x381c37,_0x4e2469){var _0x39191e=_0x4e2469[_0x01fd('0x16')]?_0x4e2469[_0x01fd('0x16')]:moment()[_0x01fd('0x17')](_0x01fd('0x18'));return new BPromise(function(_0x5e2fae,_0x1e73cc){if(_[_0x01fd('0x19')](_0x4e2469[_0x01fd('0x1d')])){_0x5e2fae({'ret':_0x39191e});}else{_0x594d2c[_0x01fd('0x2d')][_0x01fd('0x1b')]({'where':{'id':_0x381c37['id']}})[_0x01fd('0x1c')](function(_0x209379){if(!_[_0x01fd('0x19')](_0x209379)){var _0x47f9f0=_0x209379['dialTimezone'];if(!_[_0x01fd('0x19')](_0x47f9f0)){var _0x2458bb=shared['timezones'];var _0x17f982=_0x2458bb[_0x47f9f0];var _0x1fbaf3=_0x2458bb[_0x4e2469[_0x01fd('0x1d')]];if(!_['isNil'](_0x17f982)&&!_[_0x01fd('0x19')](_0x1fbaf3)){var _0x1b4729=_0x17f982['utcOffset']-_0x1fbaf3['utcOffset'];_0x39191e=_0x4e2469['scheduledat']?_0x4e2469[_0x01fd('0x16')]:moment();var _0x426b13=moment(_0x39191e)['add'](_0x1b4729,_0x01fd('0x20'));_0x5e2fae({'ret':_0x426b13[_0x01fd('0x17')](_0x01fd('0x18'))});}else _0x5e2fae({'ret':_0x39191e});}else _0x5e2fae({'ret':_0x39191e});}else{_0x5e2fae({'ret':_0x39191e});}});}});return 0xa;}var _0x1daa44=function(_0x35eed5){return new BPromise(function(_0x4407d1,_0x4514c3){_0x32409f(_0x35eed5,_0x21c004)['then'](function(_0x41d4b6){_0x21c004['scheduledat']=_0x41d4b6[_0x01fd('0x21')];_0x594d2c[_0x01fd('0x22')][_0x01fd('0x1b')]({'where':{'phone':_0x21c004[_0x01fd('0xb')],'CampaignId':_0x35eed5['id']}})['then'](function(_0x253e7a){if(!_[_0x01fd('0x19')](_0x253e7a)){throw new Error(_0x01fd('0x23')+_0x21c004[_0x01fd('0xb')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20'+_0x35eed5['id']);}return _0x594d2c[_0x01fd('0x22')][_0x01fd('0x25')]({'phone':_0x21c004[_0x01fd('0xb')],'ContactId':_0x21c004['id'],'ListId':_0x21c004['ListId'],'priority':_0x21c004[_0x01fd('0x27')]?_0x21c004[_0x01fd('0x27')]:0x2,'scheduledat':_0x21c004[_0x01fd('0x16')]?_0x21c004[_0x01fd('0x16')]:moment()[_0x01fd('0x17')](_0x01fd('0x18')),'callback':_0x21c004[_0x01fd('0x28')]?!![]:![],'callbackuniqueid':_0x21c004[_0x01fd('0x28')]?_0x21c004[_0x01fd('0x28')]:undefined,'callbackat':_0x21c004[_0x01fd('0x28')]?moment()[_0x01fd('0x17')](_0x01fd('0x18')):undefined,'CampaignId':_0x35eed5['id']});})['catch'](function(_0x35b025){_0x4514c3(_0x35b025);});});});};var _0x3ed284=function(_0x5a83a5){return new BPromise(function(_0x1e2189,_0x17893f){_0x32409f(_0x5a83a5,_0x21c004)[_0x01fd('0x1c')](function(_0x1730bd){_0x21c004[_0x01fd('0x16')]=_0x1730bd['ret'];_0x594d2c[_0x01fd('0x22')]['findOne']({'where':{'phone':_0x21c004[_0x01fd('0xb')],'CampaignId':_0x5a83a5['id']}})[_0x01fd('0x1c')](function(_0x1cc94b){if(!_['isNil'](_0x1cc94b)){throw new Error(_0x01fd('0x23')+_0x21c004[_0x01fd('0xb')]+_0x01fd('0x2e')+_0x5a83a5['id']);}return _0x594d2c[_0x01fd('0x2f')][_0x01fd('0x1b')]({'where':{'calleridnum':_0x21c004[_0x01fd('0xb')],'CampaignId':_0x5a83a5['id']}});})['then'](function(_0x51f47a){if(!_[_0x01fd('0x19')](_0x51f47a)){throw new Error('cmContact,\x20afterCreate,\x20'+_0x21c004['phone']+_0x01fd('0x30')+_0x5a83a5['id']);}return _0x594d2c[_0x01fd('0x22')]['create']({'phone':_0x21c004[_0x01fd('0xb')],'ContactId':_0x21c004['id'],'ListId':_0x21c004[_0x01fd('0x26')],'priority':_0x21c004[_0x01fd('0x27')]?_0x21c004[_0x01fd('0x27')]:0x2,'scheduledat':_0x21c004[_0x01fd('0x16')]?_0x21c004['scheduledat']:moment()['format'](_0x01fd('0x18')),'callback':_0x21c004[_0x01fd('0x28')]?!![]:![],'callbackuniqueid':_0x21c004['callbackUniqueid']?_0x21c004['callbackUniqueid']:undefined,'callbackat':_0x21c004[_0x01fd('0x28')]?moment()[_0x01fd('0x17')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'CampaignId':_0x5a83a5['id']});})[_0x01fd('0x29')](function(_0x2ab732){_0x17893f(_0x2ab732);});});});};if(_0x21c004['ListId']){_0x594d2c['VoiceQueue']['findAll']({'where':{'type':_0x01fd('0x31')},'attributes':['id',_0x01fd('0x32'),'dialTimezone'],'include':[{'model':_0x594d2c['CmList'],'as':_0x01fd('0x33'),'where':{'id':_0x21c004[_0x01fd('0x26')]}}]})[_0x01fd('0x1c')](function(_0x2aaa02){if(_0x2aaa02){var _0x52df4e=[];for(var _0x382eaa=0x0,_0x114069;_0x382eaa<_0x2aaa02[_0x01fd('0x34')];_0x382eaa+=0x1){_0x114069=_0x2aaa02[_0x382eaa][_0x01fd('0x35')]({'plain':!![]});switch(_0x114069[_0x01fd('0x32')]){case _0x01fd('0x36'):_0x137eac(_0x114069)[_0x01fd('0x29')](_0x3372d3());break;case'onlyIfOpen':_0x438a07(_0x114069)[_0x01fd('0x29')](_0x3372d3());break;default:_0x32409f(_0x114069,_0x21c004)[_0x01fd('0x1c')](function(_0x46e2aa){_0x21c004[_0x01fd('0x16')]=_0x46e2aa[_0x01fd('0x21')];_0x594d2c['CmHopper'][_0x01fd('0x25')]({'phone':_0x21c004[_0x01fd('0xb')],'ContactId':_0x21c004['id'],'ListId':_0x21c004['ListId'],'scheduledat':_0x21c004[_0x01fd('0x16')]?_0x21c004[_0x01fd('0x16')]:moment()[_0x01fd('0x17')]('YYYY-MM-DD\x20HH:mm:ss'),'priority':_0x21c004[_0x01fd('0x27')]?_0x21c004[_0x01fd('0x27')]:0x2,'callback':_0x21c004['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x21c004[_0x01fd('0x28')]?_0x21c004[_0x01fd('0x28')]:undefined,'callbackat':_0x21c004[_0x01fd('0x28')]?moment()[_0x01fd('0x17')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'VoiceQueueId':_0x114069['id']})['catch'](_0x3372d3());});}}}})[_0x01fd('0x1c')](function(){return _0x594d2c[_0x01fd('0x1a')][_0x01fd('0x37')]({'where':{'type':_0x01fd('0x31')},'attributes':['id'],'include':[{'model':_0x594d2c[_0x01fd('0x38')],'as':_0x01fd('0x39'),'where':{'id':_0x21c004[_0x01fd('0x26')]}}]})[_0x01fd('0x1c')](function(_0x37916e){if(_0x37916e){var _0x5933d4=[];for(var _0x3d86b5=0x0,_0x2398c3;_0x3d86b5<_0x37916e[_0x01fd('0x34')];_0x3d86b5+=0x1){_0x2398c3=_0x37916e[_0x3d86b5]['get']({'plain':!![]});_0x594d2c[_0x01fd('0x3a')][_0x01fd('0x25')]({'phone':_0x21c004[_0x01fd('0xb')],'ContactId':_0x21c004['id'],'ListId':_0x21c004[_0x01fd('0x26')],'VoiceQueueId':_0x2398c3['id']})['catch'](function(_0x4e855e){logger[_0x01fd('0x2c')](_0x01fd('0x3b'),_0x01fd('0x14'),_0x4e855e[_0x01fd('0x3c')]);});}}});})[_0x01fd('0x1c')](function(){return _0x594d2c[_0x01fd('0x2d')][_0x01fd('0x37')]({'attributes':['id',_0x01fd('0x32'),'dialTimezone'],'include':[{'model':_0x594d2c[_0x01fd('0x38')],'as':_0x01fd('0x33'),'where':{'id':_0x21c004[_0x01fd('0x26')]}}]})[_0x01fd('0x1c')](function(_0x3e60a4){if(_0x3e60a4){var _0x25b241=[];for(var _0x14a200=0x0,_0x5b3cf4;_0x14a200<_0x3e60a4[_0x01fd('0x34')];_0x14a200+=0x1){_0x5b3cf4=_0x3e60a4[_0x14a200][_0x01fd('0x35')]({'plain':!![]});switch(_0x5b3cf4[_0x01fd('0x32')]){case _0x01fd('0x36'):_0x3ed284(_0x5b3cf4)[_0x01fd('0x29')](_0x21ebf8());break;case _0x01fd('0x3d'):_0x1daa44(_0x5b3cf4)[_0x01fd('0x29')](_0x21ebf8());break;default:_0x594d2c['CmHopper'][_0x01fd('0x25')]({'phone':_0x21c004[_0x01fd('0xb')],'ContactId':_0x21c004['id'],'ListId':_0x21c004[_0x01fd('0x26')],'scheduledat':_0x21c004[_0x01fd('0x16')]?_0x21c004[_0x01fd('0x16')]:moment()['format'](_0x01fd('0x18')),'priority':_0x21c004[_0x01fd('0x27')]?_0x21c004[_0x01fd('0x27')]:0x2,'callback':_0x21c004[_0x01fd('0x28')]?!![]:![],'callbackuniqueid':_0x21c004[_0x01fd('0x28')]?_0x21c004[_0x01fd('0x28')]:undefined,'callbackat':_0x21c004[_0x01fd('0x28')]?moment()[_0x01fd('0x17')](_0x01fd('0x18')):undefined,'CampaignId':_0x5b3cf4['id']})['catch'](_0x21ebf8());}}}});})['then'](function(){return _0x594d2c[_0x01fd('0x2d')][_0x01fd('0x37')]({'attributes':['id'],'include':[{'model':_0x594d2c[_0x01fd('0x38')],'as':_0x01fd('0x39'),'where':{'id':_0x21c004['ListId']}}]})['then'](function(_0x213bc7){if(_0x213bc7){var _0x52286e=[];for(var _0x1d7884=0x0,_0x28176f;_0x1d7884<_0x213bc7[_0x01fd('0x34')];_0x1d7884+=0x1){_0x28176f=_0x213bc7[_0x1d7884][_0x01fd('0x35')]({'plain':!![]});_0x594d2c['CmHopperBlack']['create']({'phone':_0x21c004[_0x01fd('0xb')],'ContactId':_0x21c004['id'],'ListId':_0x21c004[_0x01fd('0x26')],'CampaignId':_0x28176f['id']})[_0x01fd('0x29')](function(_0x2e8948){logger[_0x01fd('0x2c')](_0x01fd('0x3b'),_0x01fd('0x14'),_0x2e8948[_0x01fd('0x3c')]);});}}});})[_0x01fd('0x1c')](function(){_0x1b28cd();})[_0x01fd('0x29')](function(_0x518c62){logger['error'](_0x01fd('0x3b'),_0x01fd('0x14'),_0x518c62[_0x01fd('0x3c')]);_0x1b28cd(_0x518c62);});}else{_0x1b28cd(new Error(_0x01fd('0x3e')));}},'afterDestroy':function(_0x2e048e,_0x15635d,_0xcc6913){var _0x10732a=_0x2c6aea[_0x01fd('0x3f')];var _0xcb4379=_0x2e048e['get']({'plain':!![]});return _0x10732a[_0x01fd('0x22')][_0x01fd('0x37')]({'raw':!![],'where':{'ListId':_0xcb4379['ListId'],'ContactId':_0xcb4379['id']}})[_0x01fd('0x1c')](function(_0x55efb4){if(!_[_0x01fd('0x40')](_0x55efb4)){var _0x102e04=[];for(var _0x1fbfe5=0x0;_0x1fbfe5<_0x55efb4[_0x01fd('0x34')];_0x1fbfe5+=0x1){var _0x92beff=_0x10732a[_0x01fd('0x22')]['destroy']({'where':{'ListId':_0x55efb4[_0x1fbfe5]['ListId'],'ContactId':_0x55efb4[_0x1fbfe5][_0x01fd('0x41')],'VoiceQueueId':_0x55efb4[_0x1fbfe5][_0x01fd('0x42')],'CampaignId':_0x55efb4[_0x1fbfe5][_0x01fd('0x43')]}});_0x102e04['push'](_0x92beff);}return BPromise[_0x01fd('0x44')](_0x102e04);}})[_0x01fd('0x1c')](function(_0x4898bf){logger[_0x01fd('0x45')](_0x01fd('0x46'),util[_0x01fd('0x15')](_0x4898bf,{'showHidden':![],'depth':null}));_0xcc6913();})[_0x01fd('0x29')](function(_0xb35de1){logger[_0x01fd('0x2c')](_0x01fd('0x47'),util['inspect'](_0xb35de1,{'showHidden':![],'depth':null}));_0xcc6913(_0xb35de1);});}}});}; \ No newline at end of file +var _0x5fec=['\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20Campaign\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20','findAll','outbound','CmList','length','dialCheckDuplicateType','CmHopperBlack','cmContact,\x20%s,\x20%s','message','Campaign','Lists','always','onlyIfOpen','BlackLists','List\x20not\x20found','isEmpty','destroy','ContactId','VoiceQueueId','CampaignId','push','all','info','[CmContact][afterDestroy][Error]','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmContact.attributes','exports','CmContact','cm_contacts','phone','fti_cm_contacts','lastName','mobile','fax','email','FULLTEXT','utf8mb4','utf8mb4_unicode_ci','models','get','error','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','priority','callbackUniqueid','catch','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','CmHopperFinal','cmContact,\x20afterCreate,\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20','ListId','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20'];(function(_0x4d354b,_0x477ce0){var _0x14b797=function(_0x15e87b){while(--_0x15e87b){_0x4d354b['push'](_0x4d354b['shift']());}};_0x14b797(++_0x477ce0);}(_0x5fec,0x106));var _0xc5fe=function(_0x1e9bcb,_0x34f275){_0x1e9bcb=_0x1e9bcb-0x0;var _0x1d9a2e=_0x5fec[_0x1e9bcb];return _0x1d9a2e;};'use strict';var _=require(_0xc5fe('0x0'));var util=require(_0xc5fe('0x1'));var logger=require('../../config/logger')(_0xc5fe('0x2'));var moment=require(_0xc5fe('0x3'));var BPromise=require(_0xc5fe('0x4'));var rp=require(_0xc5fe('0x5'));var fs=require('fs');var path=require(_0xc5fe('0x6'));var rimraf=require(_0xc5fe('0x7'));var config=require(_0xc5fe('0x8'));var shared=require('../../config/environment/shared');var attributes=require(_0xc5fe('0x9'));module[_0xc5fe('0xa')]=function(_0x1cded1,_0x17a6e2){return _0x1cded1['define'](_0xc5fe('0xb'),attributes,{'tableName':_0xc5fe('0xc'),'paranoid':!![],'indexes':[{'name':_0xc5fe('0xd'),'fields':['phone']},{'name':_0xc5fe('0xe'),'fields':['firstName',_0xc5fe('0xf'),_0xc5fe('0xd'),_0xc5fe('0x10'),_0xc5fe('0x11'),_0xc5fe('0x12')],'type':_0xc5fe('0x13')}],'timestamps':!![],'charset':_0xc5fe('0x14'),'collate':_0xc5fe('0x15'),'hooks':{'afterCreate':function(_0x2ea497,_0x170218,_0x53438c){var _0x479cb7=_0x1cded1[_0xc5fe('0x16')];var _0x4a3154=_0x2ea497[_0xc5fe('0x17')]({'plain':!![]});function _0x97ac00(){return function(_0x15a784){logger[_0xc5fe('0x18')](_0xc5fe('0x19'),_0xc5fe('0x1a'),util[_0xc5fe('0x1b')](_0x15a784,{'showHidden':![],'depth':null}));};}function _0x261b55(_0x1a209c,_0x65dfdd){var _0x1f3778=_0x65dfdd[_0xc5fe('0x1c')]?_0x65dfdd['scheduledat']:moment()[_0xc5fe('0x1d')]('YYYY-MM-DD\x20HH:mm:ss');return new BPromise(function(_0x522b89,_0x339ebc){if(_['isNil'](_0x65dfdd[_0xc5fe('0x1e')])){_0x522b89({'ret':_0x1f3778});}else{_0x479cb7[_0xc5fe('0x1f')][_0xc5fe('0x20')]({'where':{'id':_0x1a209c['id']}})[_0xc5fe('0x21')](function(_0x2e5610){if(!_[_0xc5fe('0x22')](_0x2e5610)){var _0x399461=_0x2e5610['dialTimezone'];if(!_[_0xc5fe('0x22')](_0x399461)){var _0xedaf6e=shared[_0xc5fe('0x23')];var _0x32e250=_0xedaf6e[_0x399461];var _0x26499f=_0xedaf6e[_0x65dfdd['dialTimezone']];if(!_[_0xc5fe('0x22')](_0x32e250)&&!_[_0xc5fe('0x22')](_0x26499f)){var _0x50421b=_0x32e250[_0xc5fe('0x24')]-_0x26499f[_0xc5fe('0x24')];_0x1f3778=_0x65dfdd[_0xc5fe('0x1c')]?_0x65dfdd[_0xc5fe('0x1c')]:moment();var _0x416da4=moment(_0x1f3778)[_0xc5fe('0x25')](_0x50421b,_0xc5fe('0x26'));_0x522b89({'ret':_0x416da4[_0xc5fe('0x1d')](_0xc5fe('0x27'))});}else _0x522b89({'ret':_0x1f3778});}else _0x522b89({'ret':_0x1f3778});}else{_0x522b89({'ret':_0x1f3778});}});}});return 0xa;}var _0x1184f6=function(_0x2dbb36){return new BPromise(function(_0x3c90f0,_0x5bf992){_0x261b55(_0x2dbb36,_0x4a3154)[_0xc5fe('0x21')](function(_0x2545d1){_0x4a3154[_0xc5fe('0x1c')]=_0x2545d1[_0xc5fe('0x28')];_0x479cb7[_0xc5fe('0x29')][_0xc5fe('0x20')]({'where':{'phone':_0x4a3154['phone'],'VoiceQueueId':_0x2dbb36['id']}})[_0xc5fe('0x21')](function(_0x1795d6){if(!_[_0xc5fe('0x22')](_0x1795d6)){throw new Error(_0xc5fe('0x2a')+_0x4a3154[_0xc5fe('0xd')]+_0xc5fe('0x2b')+_0x2dbb36['id']);}return _0x479cb7[_0xc5fe('0x29')][_0xc5fe('0x2c')]({'phone':_0x4a3154[_0xc5fe('0xd')],'ContactId':_0x4a3154['id'],'ListId':_0x4a3154['ListId'],'priority':_0x4a3154[_0xc5fe('0x2d')]?_0x4a3154['priority']:0x2,'scheduledat':_0x4a3154[_0xc5fe('0x1c')]?_0x4a3154['scheduledat']:moment()['format'](_0xc5fe('0x27')),'callback':_0x4a3154['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x4a3154['callbackUniqueid']?_0x4a3154[_0xc5fe('0x2e')]:undefined,'callbackat':_0x4a3154[_0xc5fe('0x2e')]?moment()[_0xc5fe('0x1d')](_0xc5fe('0x27')):undefined,'VoiceQueueId':_0x2dbb36['id']});})[_0xc5fe('0x2f')](function(_0x1e5a7c){_0x5bf992(_0x1e5a7c);});});});};var _0x33e459=function(_0x21e3c8){return new BPromise(function(_0x175239,_0x5f3a72){_0x261b55(_0x21e3c8,_0x4a3154)['then'](function(_0x2fc737){_0x4a3154[_0xc5fe('0x1c')]=_0x2fc737[_0xc5fe('0x28')];_0x479cb7[_0xc5fe('0x29')]['findOne']({'where':{'phone':_0x4a3154[_0xc5fe('0xd')],'VoiceQueueId':_0x21e3c8['id']}})[_0xc5fe('0x21')](function(_0x5c224e){if(!_[_0xc5fe('0x22')](_0x5c224e)){throw new Error('cmContact,\x20afterCreate\x20'+_0x4a3154['phone']+_0xc5fe('0x30')+_0x21e3c8['id']);}return _0x479cb7[_0xc5fe('0x31')]['findOne']({'where':{'calleridnum':_0x4a3154[_0xc5fe('0xd')],'VoiceQueueId':_0x21e3c8['id']}});})[_0xc5fe('0x21')](function(_0x3ce398){if(!_[_0xc5fe('0x22')](_0x3ce398)){throw new Error(_0xc5fe('0x32')+_0x4a3154[_0xc5fe('0xd')]+_0xc5fe('0x33')+_0x21e3c8['id']);}return _0x479cb7[_0xc5fe('0x29')][_0xc5fe('0x2c')]({'phone':_0x4a3154[_0xc5fe('0xd')],'ContactId':_0x4a3154['id'],'ListId':_0x4a3154[_0xc5fe('0x34')],'priority':_0x4a3154['priority']?_0x4a3154[_0xc5fe('0x2d')]:0x2,'scheduledat':_0x4a3154[_0xc5fe('0x1c')]?_0x4a3154['scheduledat']:moment()['format'](_0xc5fe('0x27')),'callback':_0x4a3154[_0xc5fe('0x2e')]?!![]:![],'callbackuniqueid':_0x4a3154[_0xc5fe('0x2e')]?_0x4a3154[_0xc5fe('0x2e')]:undefined,'callbackat':_0x4a3154['callbackUniqueid']?moment()[_0xc5fe('0x1d')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'VoiceQueueId':_0x21e3c8['id']});})[_0xc5fe('0x2f')](function(_0x5df00a){_0x5f3a72(_0x5df00a);});});});};function _0x27e61a(){return function(_0x4d87d8){logger[_0xc5fe('0x18')](_0xc5fe('0x19'),_0xc5fe('0x1a'),util[_0xc5fe('0x1b')](_0x4d87d8,{'showHidden':![],'depth':null}));};}function _0x2634b0(_0x3f2024,_0x49a7e3){var _0x354715=_0x49a7e3[_0xc5fe('0x1c')]?_0x49a7e3[_0xc5fe('0x1c')]:moment()['format'](_0xc5fe('0x27'));return new BPromise(function(_0x12948e,_0x16b3ba){if(_[_0xc5fe('0x22')](_0x49a7e3[_0xc5fe('0x1e')])){_0x12948e({'ret':_0x354715});}else{_0x479cb7['Campaign'][_0xc5fe('0x20')]({'where':{'id':_0x3f2024['id']}})[_0xc5fe('0x21')](function(_0x52a8c6){if(!_[_0xc5fe('0x22')](_0x52a8c6)){var _0x376b23=_0x52a8c6[_0xc5fe('0x1e')];if(!_['isNil'](_0x376b23)){var _0x10ac72=shared['timezones'];var _0x5ea170=_0x10ac72[_0x376b23];var _0x1d9cf2=_0x10ac72[_0x49a7e3['dialTimezone']];if(!_[_0xc5fe('0x22')](_0x5ea170)&&!_[_0xc5fe('0x22')](_0x1d9cf2)){var _0x4b053d=_0x5ea170[_0xc5fe('0x24')]-_0x1d9cf2['utcOffset'];_0x354715=_0x49a7e3[_0xc5fe('0x1c')]?_0x49a7e3[_0xc5fe('0x1c')]:moment();var _0x21903e=moment(_0x354715)[_0xc5fe('0x25')](_0x4b053d,_0xc5fe('0x26'));_0x12948e({'ret':_0x21903e[_0xc5fe('0x1d')](_0xc5fe('0x27'))});}else _0x12948e({'ret':_0x354715});}else _0x12948e({'ret':_0x354715});}else{_0x12948e({'ret':_0x354715});}});}});return 0xa;}var _0x4ee47d=function(_0x60566b){return new BPromise(function(_0x1a170f,_0x4b244b){_0x2634b0(_0x60566b,_0x4a3154)[_0xc5fe('0x21')](function(_0x5e33d8){_0x4a3154['scheduledat']=_0x5e33d8['ret'];_0x479cb7[_0xc5fe('0x29')][_0xc5fe('0x20')]({'where':{'phone':_0x4a3154['phone'],'CampaignId':_0x60566b['id']}})[_0xc5fe('0x21')](function(_0xced804){if(!_['isNil'](_0xced804)){throw new Error('cmContact,\x20afterCreate\x20'+_0x4a3154[_0xc5fe('0xd')]+_0xc5fe('0x35')+_0x60566b['id']);}return _0x479cb7[_0xc5fe('0x29')]['create']({'phone':_0x4a3154[_0xc5fe('0xd')],'ContactId':_0x4a3154['id'],'ListId':_0x4a3154['ListId'],'priority':_0x4a3154[_0xc5fe('0x2d')]?_0x4a3154[_0xc5fe('0x2d')]:0x2,'scheduledat':_0x4a3154[_0xc5fe('0x1c')]?_0x4a3154['scheduledat']:moment()[_0xc5fe('0x1d')](_0xc5fe('0x27')),'callback':_0x4a3154[_0xc5fe('0x2e')]?!![]:![],'callbackuniqueid':_0x4a3154['callbackUniqueid']?_0x4a3154[_0xc5fe('0x2e')]:undefined,'callbackat':_0x4a3154[_0xc5fe('0x2e')]?moment()[_0xc5fe('0x1d')](_0xc5fe('0x27')):undefined,'CampaignId':_0x60566b['id']});})[_0xc5fe('0x2f')](function(_0x3d7109){_0x4b244b(_0x3d7109);});});});};var _0x7e4e3=function(_0x17934c){return new BPromise(function(_0x48aa9d,_0x18a147){_0x2634b0(_0x17934c,_0x4a3154)[_0xc5fe('0x21')](function(_0x8b2f76){_0x4a3154[_0xc5fe('0x1c')]=_0x8b2f76[_0xc5fe('0x28')];_0x479cb7[_0xc5fe('0x29')]['findOne']({'where':{'phone':_0x4a3154['phone'],'CampaignId':_0x17934c['id']}})[_0xc5fe('0x21')](function(_0x98c651){if(!_[_0xc5fe('0x22')](_0x98c651)){throw new Error(_0xc5fe('0x2a')+_0x4a3154['phone']+_0xc5fe('0x36')+_0x17934c['id']);}return _0x479cb7[_0xc5fe('0x31')]['findOne']({'where':{'calleridnum':_0x4a3154['phone'],'CampaignId':_0x17934c['id']}});})[_0xc5fe('0x21')](function(_0x3f05ef){if(!_[_0xc5fe('0x22')](_0x3f05ef)){throw new Error(_0xc5fe('0x32')+_0x4a3154[_0xc5fe('0xd')]+_0xc5fe('0x37')+_0x17934c['id']);}return _0x479cb7[_0xc5fe('0x29')][_0xc5fe('0x2c')]({'phone':_0x4a3154[_0xc5fe('0xd')],'ContactId':_0x4a3154['id'],'ListId':_0x4a3154[_0xc5fe('0x34')],'priority':_0x4a3154[_0xc5fe('0x2d')]?_0x4a3154['priority']:0x2,'scheduledat':_0x4a3154[_0xc5fe('0x1c')]?_0x4a3154[_0xc5fe('0x1c')]:moment()['format'](_0xc5fe('0x27')),'callback':_0x4a3154['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x4a3154[_0xc5fe('0x2e')]?_0x4a3154[_0xc5fe('0x2e')]:undefined,'callbackat':_0x4a3154['callbackUniqueid']?moment()[_0xc5fe('0x1d')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'CampaignId':_0x17934c['id']});})[_0xc5fe('0x2f')](function(_0x5dfa82){_0x18a147(_0x5dfa82);});});});};if(_0x4a3154[_0xc5fe('0x34')]){_0x479cb7[_0xc5fe('0x1f')][_0xc5fe('0x38')]({'where':{'type':_0xc5fe('0x39')},'attributes':['id','dialCheckDuplicateType',_0xc5fe('0x1e')],'include':[{'model':_0x479cb7[_0xc5fe('0x3a')],'as':'Lists','where':{'id':_0x4a3154[_0xc5fe('0x34')]}}]})[_0xc5fe('0x21')](function(_0x2b6f87){if(_0x2b6f87){var _0x2aaefb=[];for(var _0x4737f7=0x0,_0x44177d;_0x4737f7<_0x2b6f87[_0xc5fe('0x3b')];_0x4737f7+=0x1){_0x44177d=_0x2b6f87[_0x4737f7][_0xc5fe('0x17')]({'plain':!![]});switch(_0x44177d[_0xc5fe('0x3c')]){case'always':_0x33e459(_0x44177d)[_0xc5fe('0x2f')](_0x97ac00());break;case'onlyIfOpen':_0x1184f6(_0x44177d)['catch'](_0x97ac00());break;default:_0x2634b0(_0x44177d,_0x4a3154)[_0xc5fe('0x21')](function(_0x34560c){_0x4a3154['scheduledat']=_0x34560c['ret'];_0x479cb7[_0xc5fe('0x29')][_0xc5fe('0x2c')]({'phone':_0x4a3154[_0xc5fe('0xd')],'ContactId':_0x4a3154['id'],'ListId':_0x4a3154[_0xc5fe('0x34')],'scheduledat':_0x4a3154[_0xc5fe('0x1c')]?_0x4a3154[_0xc5fe('0x1c')]:moment()[_0xc5fe('0x1d')]('YYYY-MM-DD\x20HH:mm:ss'),'priority':_0x4a3154[_0xc5fe('0x2d')]?_0x4a3154[_0xc5fe('0x2d')]:0x2,'callback':_0x4a3154[_0xc5fe('0x2e')]?!![]:![],'callbackuniqueid':_0x4a3154[_0xc5fe('0x2e')]?_0x4a3154[_0xc5fe('0x2e')]:undefined,'callbackat':_0x4a3154[_0xc5fe('0x2e')]?moment()[_0xc5fe('0x1d')](_0xc5fe('0x27')):undefined,'VoiceQueueId':_0x44177d['id']})['catch'](_0x97ac00());});}}}})['then'](function(){return _0x479cb7[_0xc5fe('0x1f')]['findAll']({'where':{'type':'outbound'},'attributes':['id'],'include':[{'model':_0x479cb7['CmList'],'as':'BlackLists','where':{'id':_0x4a3154[_0xc5fe('0x34')]}}]})['then'](function(_0x40976b){if(_0x40976b){var _0x4b5ae9=[];for(var _0x277926=0x0,_0xb780;_0x277926<_0x40976b[_0xc5fe('0x3b')];_0x277926+=0x1){_0xb780=_0x40976b[_0x277926][_0xc5fe('0x17')]({'plain':!![]});_0x479cb7[_0xc5fe('0x3d')]['create']({'phone':_0x4a3154[_0xc5fe('0xd')],'ContactId':_0x4a3154['id'],'ListId':_0x4a3154['ListId'],'VoiceQueueId':_0xb780['id']})[_0xc5fe('0x2f')](function(_0x51477d){logger['error'](_0xc5fe('0x3e'),'afterCreate',_0x51477d[_0xc5fe('0x3f')]);});}}});})[_0xc5fe('0x21')](function(){return _0x479cb7[_0xc5fe('0x40')][_0xc5fe('0x38')]({'attributes':['id',_0xc5fe('0x3c'),_0xc5fe('0x1e')],'include':[{'model':_0x479cb7[_0xc5fe('0x3a')],'as':_0xc5fe('0x41'),'where':{'id':_0x4a3154[_0xc5fe('0x34')]}}]})[_0xc5fe('0x21')](function(_0x27a2f3){if(_0x27a2f3){var _0x2a2a0f=[];for(var _0x1727e7=0x0,_0x5cfd12;_0x1727e7<_0x27a2f3[_0xc5fe('0x3b')];_0x1727e7+=0x1){_0x5cfd12=_0x27a2f3[_0x1727e7]['get']({'plain':!![]});switch(_0x5cfd12[_0xc5fe('0x3c')]){case _0xc5fe('0x42'):_0x7e4e3(_0x5cfd12)[_0xc5fe('0x2f')](_0x27e61a());break;case _0xc5fe('0x43'):_0x4ee47d(_0x5cfd12)[_0xc5fe('0x2f')](_0x27e61a());break;default:_0x479cb7['CmHopper'][_0xc5fe('0x2c')]({'phone':_0x4a3154[_0xc5fe('0xd')],'ContactId':_0x4a3154['id'],'ListId':_0x4a3154['ListId'],'scheduledat':_0x4a3154[_0xc5fe('0x1c')]?_0x4a3154[_0xc5fe('0x1c')]:moment()['format'](_0xc5fe('0x27')),'priority':_0x4a3154[_0xc5fe('0x2d')]?_0x4a3154[_0xc5fe('0x2d')]:0x2,'callback':_0x4a3154['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x4a3154[_0xc5fe('0x2e')]?_0x4a3154[_0xc5fe('0x2e')]:undefined,'callbackat':_0x4a3154[_0xc5fe('0x2e')]?moment()[_0xc5fe('0x1d')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'CampaignId':_0x5cfd12['id']})[_0xc5fe('0x2f')](_0x27e61a());}}}});})[_0xc5fe('0x21')](function(){return _0x479cb7[_0xc5fe('0x40')][_0xc5fe('0x38')]({'attributes':['id'],'include':[{'model':_0x479cb7[_0xc5fe('0x3a')],'as':_0xc5fe('0x44'),'where':{'id':_0x4a3154['ListId']}}]})[_0xc5fe('0x21')](function(_0x13bafc){if(_0x13bafc){var _0x5c62d1=[];for(var _0x805b13=0x0,_0x1ce6e9;_0x805b13<_0x13bafc[_0xc5fe('0x3b')];_0x805b13+=0x1){_0x1ce6e9=_0x13bafc[_0x805b13][_0xc5fe('0x17')]({'plain':!![]});_0x479cb7[_0xc5fe('0x3d')][_0xc5fe('0x2c')]({'phone':_0x4a3154[_0xc5fe('0xd')],'ContactId':_0x4a3154['id'],'ListId':_0x4a3154['ListId'],'CampaignId':_0x1ce6e9['id']})[_0xc5fe('0x2f')](function(_0x2b2764){logger[_0xc5fe('0x18')](_0xc5fe('0x3e'),_0xc5fe('0x1a'),_0x2b2764[_0xc5fe('0x3f')]);});}}});})[_0xc5fe('0x21')](function(){_0x53438c();})[_0xc5fe('0x2f')](function(_0x5abce9){logger[_0xc5fe('0x18')]('cmContact,\x20%s,\x20%s',_0xc5fe('0x1a'),_0x5abce9['message']);_0x53438c(_0x5abce9);});}else{_0x53438c(new Error(_0xc5fe('0x45')));}},'afterDestroy':function(_0x4a2530,_0x1b51b7,_0x108e3d){var _0x55e099=_0x1cded1[_0xc5fe('0x16')];var _0x39ad52=_0x4a2530[_0xc5fe('0x17')]({'plain':!![]});return _0x55e099[_0xc5fe('0x29')][_0xc5fe('0x38')]({'raw':!![],'where':{'ListId':_0x39ad52[_0xc5fe('0x34')],'ContactId':_0x39ad52['id']}})[_0xc5fe('0x21')](function(_0x3687dc){if(!_[_0xc5fe('0x46')](_0x3687dc)){var _0x575363=[];for(var _0x3d4c95=0x0;_0x3d4c95<_0x3687dc[_0xc5fe('0x3b')];_0x3d4c95+=0x1){var _0x4ded07=_0x55e099['CmHopper'][_0xc5fe('0x47')]({'where':{'ListId':_0x3687dc[_0x3d4c95]['ListId'],'ContactId':_0x3687dc[_0x3d4c95][_0xc5fe('0x48')],'VoiceQueueId':_0x3687dc[_0x3d4c95][_0xc5fe('0x49')],'CampaignId':_0x3687dc[_0x3d4c95][_0xc5fe('0x4a')]}});_0x575363[_0xc5fe('0x4b')](_0x4ded07);}return BPromise[_0xc5fe('0x4c')](_0x575363);}})[_0xc5fe('0x21')](function(_0x4b30e5){logger[_0xc5fe('0x4d')]('[CmContact][afterDestroy][Succesfull]',util['inspect'](_0x4b30e5,{'showHidden':![],'depth':null}));_0x108e3d();})['catch'](function(_0x89b60a){logger[_0xc5fe('0x18')](_0xc5fe('0x4e'),util[_0xc5fe('0x1b')](_0x89b60a,{'showHidden':![],'depth':null}));_0x108e3d(_0x89b60a);});}}});}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.rpc.js b/server/api/cmContact/cmContact.rpc.js index ff70ab3..499a791 100644 --- a/server/api/cmContact/cmContact.rpc.js +++ b/server/api/cmContact/cmContact.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['include','model','length','CmContactHasItem','find','ListId','Contact','isNil','CmContactId','CmContact','catch','CreateCmContact','create','body','keys','startsWith','cf_','table','cm_contacts','set','where','id\x20=\x20?','toString','sequelize','query','lodash','util','moment','bluebird','ioredis','squel','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','./cmContact.socket','register','request','then','info','CmContact,\x20%s,\x20%s','request\x20sent','debug','CmContact,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','GetCmContact','findAll','options','raw','attributes','limit','map'];(function(_0x3f5493,_0x8931d3){var _0x4bb07b=function(_0x1b8dc4){while(--_0x1b8dc4){_0x3f5493['push'](_0x3f5493['shift']());}};_0x4bb07b(++_0x8931d3);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var squel=require(_0x7995('0x5'));var db=require(_0x7995('0x6'))['db'];var utils=require(_0x7995('0x7'));var logger=require('../../config/logger')(_0x7995('0x8'));var config=require(_0x7995('0x9'));var jayson=require(_0x7995('0xa'));var client=jayson[_0x7995('0xb')][_0x7995('0xc')]({'port':0x232a});config[_0x7995('0xd')]=_['defaults'](config[_0x7995('0xd')],{'host':_0x7995('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7995('0xd')]));require(_0x7995('0xf'))[_0x7995('0x10')](socket);function respondWithRpcPromise(_0x35b5fe,_0x3c1d19,_0x1e400a){return new BPromise(function(_0x341672,_0x524f7b){return client[_0x7995('0x11')](_0x35b5fe,_0x1e400a)[_0x7995('0x12')](function(_0x581f22){logger[_0x7995('0x13')](_0x7995('0x14'),_0x3c1d19,_0x7995('0x15'));logger[_0x7995('0x16')](_0x7995('0x17'),_0x3c1d19,_0x7995('0x15'),JSON[_0x7995('0x18')](_0x581f22));if(_0x581f22['error']){if(_0x581f22['error'][_0x7995('0x19')]===0x1f4){logger[_0x7995('0x1a')](_0x7995('0x14'),_0x3c1d19,_0x581f22[_0x7995('0x1a')][_0x7995('0x1b')]);return _0x524f7b(_0x581f22[_0x7995('0x1a')][_0x7995('0x1b')]);}logger[_0x7995('0x1a')]('CmContact,\x20%s,\x20%s',_0x3c1d19,_0x581f22[_0x7995('0x1a')]['message']);return _0x341672(_0x581f22[_0x7995('0x1a')][_0x7995('0x1b')]);}else{logger[_0x7995('0x13')](_0x7995('0x14'),_0x3c1d19,_0x7995('0x15'));_0x341672(_0x581f22[_0x7995('0x1c')]['message']);}})['catch'](function(_0x2536c8){logger['error']('CmContact,\x20%s,\x20%s',_0x3c1d19,_0x2536c8);_0x524f7b(_0x2536c8);});});}exports[_0x7995('0x1d')]=function(_0x3d463e){var _0x4cbe10=this;return new Promise(function(_0x3a9b54,_0x51f276){return db['CmContact'][_0x7995('0x1e')]({'raw':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')][_0x7995('0x20')]===undefined?!![]:![]:!![],'where':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')]['where']||null:null,'attributes':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')][_0x7995('0x21')]||null:null,'limit':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')][_0x7995('0x22')]||null:null,'include':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')]['include']?_[_0x7995('0x23')](_0x3d463e[_0x7995('0x1f')][_0x7995('0x24')],function(_0x268ce7){return{'model':db[_0x268ce7[_0x7995('0x25')]],'as':_0x268ce7['as'],'attributes':_0x268ce7[_0x7995('0x21')],'include':_0x268ce7['include']?_[_0x7995('0x23')](_0x268ce7['include'],function(_0x229742){return{'model':db[_0x229742[_0x7995('0x25')]],'as':_0x229742['as'],'attributes':_0x229742[_0x7995('0x21')],'include':_0x229742[_0x7995('0x24')]?_[_0x7995('0x23')](_0x229742['include'],function(_0x9b2a15){return{'model':db[_0x9b2a15['model']],'as':_0x9b2a15['as'],'attributes':_0x9b2a15[_0x7995('0x21')]};}):[]};}):[]};}):[]:[]})[_0x7995('0x12')](function(_0x4253e5){logger['info']('GetCmContact',_0x3d463e);logger['debug'](_0x7995('0x1d'),_0x3d463e,JSON[_0x7995('0x18')](_0x4253e5));if(_0x4253e5[_0x7995('0x26')]==0x0){return db[_0x7995('0x27')][_0x7995('0x28')]({'raw':!![],'where':{'item':_0x3d463e[_0x7995('0x1f')]['phone']},'include':[{'model':db['CmContact'],'where':{'ListId':_0x3d463e[_0x7995('0x1f')]['where'][_0x7995('0x29')],'deletedAt':{'$eq':null}},'as':_0x7995('0x2a')}]})[_0x7995('0x12')](function(_0x1e9fa4){if(_[_0x7995('0x2b')](_0x1e9fa4)){_0x3a9b54(_0x4253e5);}else{var _0x510841=_0x1e9fa4[_0x7995('0x2c')];return db[_0x7995('0x2d')]['findAll']({'raw':!![],'where':{'id':_0x510841},'attributes':_0x3d463e['options']?_0x3d463e['options'][_0x7995('0x21')]||null:null})[_0x7995('0x12')](function(_0x4a176f){_0x3a9b54(_0x4a176f);});}});}else{_0x3a9b54(_0x4253e5);}})[_0x7995('0x2e')](function(_0x51b95d){logger[_0x7995('0x1a')](_0x7995('0x1d'),_0x51b95d[_0x7995('0x1b')],_0x3d463e);_0x51f276(_0x4cbe10['error'](0x1f4,_0x51b95d['message']));});});};exports[_0x7995('0x2f')]=function(_0x5e67fe){var _0x5d2428=this;return new Promise(function(_0x3e99cd,_0xe328b1){return db['CmContact'][_0x7995('0x30')](_0x5e67fe[_0x7995('0x31')],{'raw':_0x5e67fe[_0x7995('0x1f')]?_0x5e67fe[_0x7995('0x1f')][_0x7995('0x20')]===undefined?!![]:![]:!![]})['then'](function(_0x2d4285){var _0x242713;for(var _0xf612e6=0x0;_0xf612e6{}\s\\|]/g,'-');_0x59181e(null,util[_0x0a9e('0x26')]('%s-%s%s',path[_0x0a9e('0x27')](_0x5ea472['originalname'],path[_0x0a9e('0x28')](_0x5ea472['originalname'])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x5ea472[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')](_0x0a9e('0x2a'),upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3652a7,_0x468813,_0x2b1f27){_0x2b1f27(null,path[_0x0a9e('0x21')](config['root'],_0x0a9e('0x23')));},'filename':function(_0x40e7a3,_0x1843b2,_0x824a4f){_0x1843b2[_0x0a9e('0x24')]=_0x1843b2[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x824a4f(null,util[_0x0a9e('0x26')](_0x0a9e('0x2e'),path['basename'](_0x1843b2[_0x0a9e('0x24')],path['extname'](_0x1843b2[_0x0a9e('0x24')])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x1843b2[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')]('/upload',upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2f')]);router[_0x0a9e('0x18')](_0x0a9e('0x30'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x31')]);router[_0x0a9e('0x18')]('/uploadUpdates/:id',auth[_0x0a9e('0xd')](),controller['importUpdates']);router[_0x0a9e('0x32')](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x34')]);router['delete'](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x35')]);module[_0x0a9e('0x36')]=router; \ No newline at end of file +var _0xa9e0=['basename','extname','now','/csv','single','file','uploadCsv','%s-%s%s','upload','/upload/:id','import','put','/:id','update','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContact.controller','get','index','/describe','show','/:id/tags','isAuthenticated','getTags','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperFinals','/:id/jscripty_sessions','getJscriptySessions','/:id/journey','getJourney','post','create','/create_many','bulkCreate','setTags','setAdditionalPhones','/:id/duplicateAdditionalPhones','/:id/rescheduleAdditionalPhones','rescheduleAdditionalPhones','join','root','server/files/tmp','originalname','replace','format'];(function(_0x5a45d6,_0x178b5b){var _0x344f36=function(_0x670c8a){while(--_0x670c8a){_0x5a45d6['push'](_0x5a45d6['shift']());}};_0x344f36(++_0x178b5b);}(_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['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 57277f1..57823f6 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 _0x98e1=['exports','INTEGER','STRING','PHONE'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x98e1,0x160));var _0x198e=function(_0x3f4edb,_0x4f2fd5){_0x3f4edb=_0x3f4edb-0x0;var _0x3f22ef=_0x98e1[_0x3f4edb];return _0x3f22ef;};'use strict';var Sequelize=require('sequelize');module[_0x198e('0x0')]={'CmContactId':{'type':Sequelize[_0x198e('0x1')],'primaryKey':!![]},'item':{'type':Sequelize[_0x198e('0x2')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0x198e('0x1')],'defaultValue':null},'ItemClass':{'type':Sequelize['STRING'],'defaultValue':_0x198e('0x3')},'OrderBy':{'type':Sequelize['INTEGER'],'defaultValue':null},'description':{'type':Sequelize['STRING'],'defaultValue':null}}; \ No newline at end of file +var _0xa74d=['INTEGER','STRING','PHONE','exports'];(function(_0x38cf75,_0x2aa799){var _0x222b18=function(_0x3a11b9){while(--_0x3a11b9){_0x38cf75['push'](_0x38cf75['shift']());}};_0x222b18(++_0x2aa799);}(_0xa74d,0x1cf));var _0xda74=function(_0x3566d0,_0x34a49f){_0x3566d0=_0x3566d0-0x0;var _0x3fd4da=_0xa74d[_0x3566d0];return _0x3fd4da;};'use strict';var Sequelize=require('sequelize');module[_0xda74('0x0')]={'CmContactId':{'type':Sequelize[_0xda74('0x1')],'primaryKey':!![]},'item':{'type':Sequelize[_0xda74('0x2')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0xda74('0x1')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0xda74('0x2')],'defaultValue':_0xda74('0x3')},'OrderBy':{'type':Sequelize['INTEGER'],'defaultValue':null},'description':{'type':Sequelize[_0xda74('0x2')],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.controller.js b/server/api/cmContactHasItem/cmContactHasItem.controller.js index 0e89fee..a438530 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 _0xca80=['filters','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','options','find','catch','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','zip-dir','moment','bluebird','mustache','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','destroy','then','get','CmContactHasItems','UserProfileResource','sendStatus','error','stack','name','map','CmContactHasItem','type','key','model','query','keys','intersection','attributes','fields','length','order','sort','where'];(function(_0xc915d3,_0xe3247){var _0x257aef=function(_0x5d70bd){while(--_0x5d70bd){_0xc915d3['push'](_0xc915d3['shift']());}};_0x257aef(++_0xe3247);}(_0xca80,0x103));var _0x0ca8=function(_0x407792,_0x3d70d5){_0x407792=_0x407792-0x0;var _0x101383=_0xca80[_0x407792];return _0x101383;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0ca8('0x0'));var zipdir=require(_0x0ca8('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0ca8('0x2'));var BPromise=require(_0x0ca8('0x3'));var Mustache=require(_0x0ca8('0x4'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x0ca8('0x5'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0ca8('0x6'));var squel=require(_0x0ca8('0x7'));var crypto=require('crypto');var jsforce=require(_0x0ca8('0x8'));var deskjs=require(_0x0ca8('0x9'));var toCsv=require(_0x0ca8('0xa'));var querystring=require(_0x0ca8('0xb'));var Papa=require(_0x0ca8('0xc'));var Redis=require(_0x0ca8('0xd'));var authService=require(_0x0ca8('0xe'));var qs=require(_0x0ca8('0xf'));var as=require(_0x0ca8('0x10'));var hardwareService=require(_0x0ca8('0x11'));var logger=require(_0x0ca8('0x12'))('api');var utils=require(_0x0ca8('0x13'));var config=require(_0x0ca8('0x14'));var licenseUtil=require(_0x0ca8('0x15'));var db=require(_0x0ca8('0x16'))['db'];function respondWithStatusCode(_0x3b035d,_0xf56ac3){_0xf56ac3=_0xf56ac3||0xcc;return function(_0x2e875b){if(_0x2e875b){return _0x3b035d['sendStatus'](_0xf56ac3);}return _0x3b035d['status'](_0xf56ac3)[_0x0ca8('0x17')]();};}function respondWithResult(_0xb3a454,_0x1b5379){_0x1b5379=_0x1b5379||0xc8;return function(_0x2d02b5){if(_0x2d02b5){return _0xb3a454[_0x0ca8('0x18')](_0x1b5379)['json'](_0x2d02b5);}};}function respondWithFilteredResult(_0x1a9dc1,_0xbb71ce){return function(_0x5dd7fb){if(_0x5dd7fb){var _0x2e32b0=typeof _0xbb71ce[_0x0ca8('0x19')]===_0x0ca8('0x1a')&&typeof _0xbb71ce[_0x0ca8('0x1b')]===_0x0ca8('0x1a');var _0x1efd55=_0x5dd7fb['count'];var _0x458c5c=_0x2e32b0?0x0:_0xbb71ce[_0x0ca8('0x19')];var _0x193070=_0x2e32b0?_0x5dd7fb[_0x0ca8('0x1c')]:_0xbb71ce[_0x0ca8('0x19')]+_0xbb71ce[_0x0ca8('0x1b')];var _0x2eb950;if(_0x193070>=_0x1efd55){_0x193070=_0x1efd55;_0x2eb950=0xc8;}else{_0x2eb950=0xce;}_0x1a9dc1['status'](_0x2eb950);return _0x1a9dc1[_0x0ca8('0x1d')](_0x0ca8('0x1e'),_0x458c5c+'-'+_0x193070+'/'+_0x1efd55)[_0x0ca8('0x1f')](_0x5dd7fb);}return null;};}function patchUpdates(_0x75862e){return function(_0x18d5db){try{jsonpatch[_0x0ca8('0x20')](_0x18d5db,_0x75862e,!![]);}catch(_0x43c732){return BPromise[_0x0ca8('0x21')](_0x43c732);}return _0x18d5db['save']();};}function saveUpdates(_0x3e515b,_0x1d9939){return function(_0x4ed5d3){if(_0x4ed5d3){return _0x4ed5d3['update'](_0x3e515b)['then'](function(_0x253f14){return _0x253f14;});}return null;};}function removeEntity(_0x2ee075,_0x7654d0){return function(_0x4cc997){if(_0x4cc997){return _0x4cc997[_0x0ca8('0x22')]()[_0x0ca8('0x23')](function(){var _0x59db12=_0x4cc997[_0x0ca8('0x24')]({'plain':!![]});var _0x19f7e0=_0x0ca8('0x25');return db[_0x0ca8('0x26')]['destroy']({'where':{'type':_0x19f7e0,'resourceId':_0x59db12['id']}})[_0x0ca8('0x23')](function(){return _0x4cc997;});})['then'](function(){_0x2ee075['status'](0xcc)[_0x0ca8('0x17')]();});}};}function handleEntityNotFound(_0x4ffd56,_0x1ef55a){return function(_0x67768f){if(!_0x67768f){_0x4ffd56[_0x0ca8('0x27')](0x194);}return _0x67768f;};}function handleError(_0x2210db,_0x4d78a0){_0x4d78a0=_0x4d78a0||0x1f4;return function(_0x3124cd){logger[_0x0ca8('0x28')](_0x3124cd[_0x0ca8('0x29')]);if(_0x3124cd[_0x0ca8('0x2a')]){delete _0x3124cd[_0x0ca8('0x2a')];}_0x2210db[_0x0ca8('0x18')](_0x4d78a0)['send'](_0x3124cd);};}exports['index']=function(_0x1bdf9b,_0x4c1fdf){var _0x5668b7={},_0x1570f5={},_0x1c7568={'count':0x0,'rows':[]};var _0x3b9a76=_[_0x0ca8('0x2b')](db[_0x0ca8('0x2c')]['rawAttributes'],function(_0x10f234){return{'name':_0x10f234['fieldName'],'type':_0x10f234[_0x0ca8('0x2d')][_0x0ca8('0x2e')]};});_0x1570f5[_0x0ca8('0x2f')]=_[_0x0ca8('0x2b')](_0x3b9a76,_0x0ca8('0x2a'));_0x1570f5[_0x0ca8('0x30')]=_[_0x0ca8('0x31')](_0x1bdf9b[_0x0ca8('0x30')]);_0x1570f5['filters']=_[_0x0ca8('0x32')](_0x1570f5[_0x0ca8('0x2f')],_0x1570f5['query']);_0x5668b7[_0x0ca8('0x33')]=_[_0x0ca8('0x32')](_0x1570f5[_0x0ca8('0x2f')],qs[_0x0ca8('0x34')](_0x1bdf9b[_0x0ca8('0x30')][_0x0ca8('0x34')]));_0x5668b7['attributes']=_0x5668b7[_0x0ca8('0x33')][_0x0ca8('0x35')]?_0x5668b7[_0x0ca8('0x33')]:_0x1570f5[_0x0ca8('0x2f')];if(!_0x1bdf9b['query']['hasOwnProperty']('nolimit')){_0x5668b7[_0x0ca8('0x1b')]=qs[_0x0ca8('0x1b')](_0x1bdf9b[_0x0ca8('0x30')]['limit']);_0x5668b7['offset']=qs[_0x0ca8('0x19')](_0x1bdf9b[_0x0ca8('0x30')][_0x0ca8('0x19')]);}_0x5668b7[_0x0ca8('0x36')]=qs[_0x0ca8('0x37')](_0x1bdf9b[_0x0ca8('0x30')][_0x0ca8('0x37')]);_0x5668b7[_0x0ca8('0x38')]=qs[_0x0ca8('0x39')](_[_0x0ca8('0x3a')](_0x1bdf9b[_0x0ca8('0x30')],_0x1570f5[_0x0ca8('0x39')]),_0x3b9a76);if(_0x1bdf9b[_0x0ca8('0x30')][_0x0ca8('0x3b')]){_0x5668b7[_0x0ca8('0x38')]=_[_0x0ca8('0x3c')](_0x5668b7[_0x0ca8('0x38')],{'$or':_[_0x0ca8('0x2b')](_0x3b9a76,function(_0x38a02c){if(_0x38a02c[_0x0ca8('0x2d')]!==_0x0ca8('0x3d')){var _0x123834={};_0x123834[_0x38a02c[_0x0ca8('0x2a')]]={'$like':'%'+_0x1bdf9b['query'][_0x0ca8('0x3b')]+'%'};return _0x123834;}})});}_0x5668b7=_[_0x0ca8('0x3c')]({},_0x5668b7,_0x1bdf9b['options']);var _0x2cdb42={'where':_0x5668b7['where']};return db['CmContactHasItem'][_0x0ca8('0x1c')](_0x2cdb42)['then'](function(_0xdb202d){_0x1c7568['count']=_0xdb202d;if(_0x1bdf9b[_0x0ca8('0x30')][_0x0ca8('0x3e')]){_0x5668b7[_0x0ca8('0x3f')]=[{'all':!![]}];}return db['CmContactHasItem'][_0x0ca8('0x40')](_0x5668b7);})[_0x0ca8('0x23')](function(_0x5eeda1){_0x1c7568[_0x0ca8('0x41')]=_0x5eeda1;return _0x1c7568;})[_0x0ca8('0x23')](respondWithFilteredResult(_0x4c1fdf,_0x5668b7))['catch'](handleError(_0x4c1fdf,null));};exports[_0x0ca8('0x42')]=function(_0x14e1d7,_0x358c94){var _0x4463ee={'raw':!![],'where':{'id':_0x14e1d7[_0x0ca8('0x43')]['id']}},_0x5e113e={};_0x5e113e['model']=_[_0x0ca8('0x31')](db[_0x0ca8('0x2c')]['rawAttributes']);_0x5e113e['query']=_['keys'](_0x14e1d7[_0x0ca8('0x30')]);_0x5e113e[_0x0ca8('0x39')]=_['intersection'](_0x5e113e[_0x0ca8('0x2f')],_0x5e113e['query']);_0x4463ee[_0x0ca8('0x33')]=_[_0x0ca8('0x32')](_0x5e113e[_0x0ca8('0x2f')],qs['fields'](_0x14e1d7[_0x0ca8('0x30')]['fields']));_0x4463ee[_0x0ca8('0x33')]=_0x4463ee['attributes'][_0x0ca8('0x35')]?_0x4463ee[_0x0ca8('0x33')]:_0x5e113e[_0x0ca8('0x2f')];if(_0x14e1d7[_0x0ca8('0x30')][_0x0ca8('0x3e')]){_0x4463ee[_0x0ca8('0x3f')]=[{'all':!![]}];}_0x4463ee=_[_0x0ca8('0x3c')]({},_0x4463ee,_0x14e1d7[_0x0ca8('0x44')]);return db[_0x0ca8('0x2c')][_0x0ca8('0x45')](_0x4463ee)[_0x0ca8('0x23')](handleEntityNotFound(_0x358c94,null))['then'](respondWithResult(_0x358c94,null))[_0x0ca8('0x46')](handleError(_0x358c94,null));};exports[_0x0ca8('0x47')]=function(_0x361600,_0x529910){return db[_0x0ca8('0x2c')][_0x0ca8('0x47')](_0x361600[_0x0ca8('0x48')],{})[_0x0ca8('0x23')](function(_0x56aaa3){var _0x10033c=_0x361600[_0x0ca8('0x49')][_0x0ca8('0x24')]({'plain':!![]});if(!_0x10033c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x10033c[_0x0ca8('0x4a')]==='user'){var _0x9f6ead=_0x56aaa3[_0x0ca8('0x24')]({'plain':!![]});var _0x4ceb8d='CmContactHasItems';return db[_0x0ca8('0x4b')][_0x0ca8('0x45')]({'where':{'name':_0x4ceb8d,'userProfileId':_0x10033c[_0x0ca8('0x4c')]},'raw':!![]})[_0x0ca8('0x23')](function(_0x207133){if(_0x207133&&_0x207133[_0x0ca8('0x4d')]===0x0){return db[_0x0ca8('0x26')][_0x0ca8('0x47')]({'name':_0x9f6ead['name'],'resourceId':_0x9f6ead['id'],'type':_0x207133['name'],'sectionId':_0x207133['id']},{})[_0x0ca8('0x23')](function(){return _0x56aaa3;});}else{return _0x56aaa3;}})[_0x0ca8('0x46')](function(_0x2399ae){logger[_0x0ca8('0x28')](_0x0ca8('0x4e'),_0x2399ae);throw _0x2399ae;});}return _0x56aaa3;})[_0x0ca8('0x23')](respondWithResult(_0x529910,0xc9))[_0x0ca8('0x46')](handleError(_0x529910,null));};exports['update']=function(_0x3d632b,_0x3cdda6){if(_0x3d632b[_0x0ca8('0x48')]['id']){delete _0x3d632b[_0x0ca8('0x48')]['id'];}return db[_0x0ca8('0x2c')][_0x0ca8('0x45')]({'where':{'id':_0x3d632b[_0x0ca8('0x43')]['id']}})[_0x0ca8('0x23')](handleEntityNotFound(_0x3cdda6,null))[_0x0ca8('0x23')](saveUpdates(_0x3d632b['body'],null))[_0x0ca8('0x23')](respondWithResult(_0x3cdda6,null))[_0x0ca8('0x46')](handleError(_0x3cdda6,null));};exports[_0x0ca8('0x22')]=function(_0x48056d,_0x427bb2){return db[_0x0ca8('0x2c')]['find']({'where':{'id':_0x48056d[_0x0ca8('0x43')]['id']}})['then'](handleEntityNotFound(_0x427bb2,null))[_0x0ca8('0x23')](removeEntity(_0x427bb2,null))['catch'](handleError(_0x427bb2,null));}; \ No newline at end of file +var _0xbb80=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','offset','limit','count','set','Content-Range','apply','update','then','get','CmContactHasItems','UserProfileResource','destroy','end','error','stack','name','send','index','map','CmContactHasItem','rawAttributes','fieldName','type','key','model','query','keys','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','intersection','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','squel','crypto','desk.js','querystring','ioredis','../../components/parsers/advancedSearch'];(function(_0x8006c3,_0x275c9c){var _0x1f713b=function(_0x11a18c){while(--_0x11a18c){_0x8006c3['push'](_0x8006c3['shift']());}};_0x1f713b(++_0x275c9c);}(_0xbb80,0x18e));var _0x0bb8=function(_0x4764a4,_0x1d8ad9){_0x4764a4=_0x4764a4-0x0;var _0x1ba708=_0xbb80[_0x4764a4];return _0x1ba708;};'use strict';var emlformat=require(_0x0bb8('0x0'));var rimraf=require(_0x0bb8('0x1'));var zipdir=require(_0x0bb8('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0bb8('0x3'));var moment=require(_0x0bb8('0x4'));var BPromise=require(_0x0bb8('0x5'));var Mustache=require('mustache');var util=require(_0x0bb8('0x6'));var path=require(_0x0bb8('0x7'));var sox=require(_0x0bb8('0x8'));var csv=require(_0x0bb8('0x9'));var ejs=require(_0x0bb8('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x0bb8('0xb'));var crypto=require(_0x0bb8('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x0bb8('0xd'));var toCsv=require(_0x0bb8('0x9'));var querystring=require(_0x0bb8('0xe'));var Papa=require('papaparse');var Redis=require(_0x0bb8('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x0bb8('0x10'));var hardwareService=require(_0x0bb8('0x11'));var logger=require(_0x0bb8('0x12'))(_0x0bb8('0x13'));var utils=require(_0x0bb8('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x0bb8('0x15'))['db'];function respondWithStatusCode(_0xb900ef,_0x4e822a){_0x4e822a=_0x4e822a||0xcc;return function(_0x429ca0){if(_0x429ca0){return _0xb900ef[_0x0bb8('0x16')](_0x4e822a);}return _0xb900ef[_0x0bb8('0x17')](_0x4e822a)['end']();};}function respondWithResult(_0x46a38c,_0xefa0f8){_0xefa0f8=_0xefa0f8||0xc8;return function(_0x4e58e6){if(_0x4e58e6){return _0x46a38c[_0x0bb8('0x17')](_0xefa0f8)[_0x0bb8('0x18')](_0x4e58e6);}};}function respondWithFilteredResult(_0x269049,_0x2c12eb){return function(_0x4c5bdb){if(_0x4c5bdb){var _0x394269=typeof _0x2c12eb[_0x0bb8('0x19')]==='undefined'&&typeof _0x2c12eb[_0x0bb8('0x1a')]==='undefined';var _0x5d6c1d=_0x4c5bdb[_0x0bb8('0x1b')];var _0x418cd6=_0x394269?0x0:_0x2c12eb[_0x0bb8('0x19')];var _0x3b71aa=_0x394269?_0x4c5bdb['count']:_0x2c12eb[_0x0bb8('0x19')]+_0x2c12eb[_0x0bb8('0x1a')];var _0x191fc7;if(_0x3b71aa>=_0x5d6c1d){_0x3b71aa=_0x5d6c1d;_0x191fc7=0xc8;}else{_0x191fc7=0xce;}_0x269049[_0x0bb8('0x17')](_0x191fc7);return _0x269049[_0x0bb8('0x1c')](_0x0bb8('0x1d'),_0x418cd6+'-'+_0x3b71aa+'/'+_0x5d6c1d)[_0x0bb8('0x18')](_0x4c5bdb);}return null;};}function patchUpdates(_0x8bb5f2){return function(_0x19fb6d){try{jsonpatch[_0x0bb8('0x1e')](_0x19fb6d,_0x8bb5f2,!![]);}catch(_0x20dd9f){return BPromise['reject'](_0x20dd9f);}return _0x19fb6d['save']();};}function saveUpdates(_0x3e5b9d,_0x531af8){return function(_0x448e69){if(_0x448e69){return _0x448e69[_0x0bb8('0x1f')](_0x3e5b9d)[_0x0bb8('0x20')](function(_0x4ceeee){return _0x4ceeee;});}return null;};}function removeEntity(_0x5c74ac,_0x27086a){return function(_0x4609a4){if(_0x4609a4){return _0x4609a4['destroy']()[_0x0bb8('0x20')](function(){var _0x16fac8=_0x4609a4[_0x0bb8('0x21')]({'plain':!![]});var _0x6d0902=_0x0bb8('0x22');return db[_0x0bb8('0x23')][_0x0bb8('0x24')]({'where':{'type':_0x6d0902,'resourceId':_0x16fac8['id']}})[_0x0bb8('0x20')](function(){return _0x4609a4;});})[_0x0bb8('0x20')](function(){_0x5c74ac[_0x0bb8('0x17')](0xcc)[_0x0bb8('0x25')]();});}};}function handleEntityNotFound(_0x24a7f0,_0x9953ee){return function(_0xf76cff){if(!_0xf76cff){_0x24a7f0[_0x0bb8('0x16')](0x194);}return _0xf76cff;};}function handleError(_0x3848f0,_0x64f2f5){_0x64f2f5=_0x64f2f5||0x1f4;return function(_0x48dd41){logger[_0x0bb8('0x26')](_0x48dd41[_0x0bb8('0x27')]);if(_0x48dd41[_0x0bb8('0x28')]){delete _0x48dd41[_0x0bb8('0x28')];}_0x3848f0[_0x0bb8('0x17')](_0x64f2f5)[_0x0bb8('0x29')](_0x48dd41);};}exports[_0x0bb8('0x2a')]=function(_0x5e71e9,_0x4b34e2){var _0xaa612b={},_0x9acd15={},_0x621824={'count':0x0,'rows':[]};var _0x19a0fc=_[_0x0bb8('0x2b')](db[_0x0bb8('0x2c')][_0x0bb8('0x2d')],function(_0x13cc80){return{'name':_0x13cc80[_0x0bb8('0x2e')],'type':_0x13cc80[_0x0bb8('0x2f')][_0x0bb8('0x30')]};});_0x9acd15[_0x0bb8('0x31')]=_[_0x0bb8('0x2b')](_0x19a0fc,'name');_0x9acd15[_0x0bb8('0x32')]=_[_0x0bb8('0x33')](_0x5e71e9[_0x0bb8('0x32')]);_0x9acd15['filters']=_['intersection'](_0x9acd15[_0x0bb8('0x31')],_0x9acd15[_0x0bb8('0x32')]);_0xaa612b[_0x0bb8('0x34')]=_['intersection'](_0x9acd15['model'],qs[_0x0bb8('0x35')](_0x5e71e9['query'][_0x0bb8('0x35')]));_0xaa612b['attributes']=_0xaa612b['attributes'][_0x0bb8('0x36')]?_0xaa612b[_0x0bb8('0x34')]:_0x9acd15[_0x0bb8('0x31')];if(!_0x5e71e9[_0x0bb8('0x32')][_0x0bb8('0x37')](_0x0bb8('0x38'))){_0xaa612b['limit']=qs[_0x0bb8('0x1a')](_0x5e71e9['query'][_0x0bb8('0x1a')]);_0xaa612b[_0x0bb8('0x19')]=qs['offset'](_0x5e71e9['query'][_0x0bb8('0x19')]);}_0xaa612b[_0x0bb8('0x39')]=qs[_0x0bb8('0x3a')](_0x5e71e9[_0x0bb8('0x32')][_0x0bb8('0x3a')]);_0xaa612b[_0x0bb8('0x3b')]=qs['filters'](_['pick'](_0x5e71e9[_0x0bb8('0x32')],_0x9acd15[_0x0bb8('0x3c')]),_0x19a0fc);if(_0x5e71e9[_0x0bb8('0x32')]['filter']){_0xaa612b['where']=_[_0x0bb8('0x3d')](_0xaa612b['where'],{'$or':_[_0x0bb8('0x2b')](_0x19a0fc,function(_0x1225b8){if(_0x1225b8[_0x0bb8('0x2f')]!==_0x0bb8('0x3e')){var _0x163c98={};_0x163c98[_0x1225b8['name']]={'$like':'%'+_0x5e71e9['query'][_0x0bb8('0x3f')]+'%'};return _0x163c98;}})});}_0xaa612b=_[_0x0bb8('0x3d')]({},_0xaa612b,_0x5e71e9[_0x0bb8('0x40')]);var _0x164709={'where':_0xaa612b['where']};return db[_0x0bb8('0x2c')][_0x0bb8('0x1b')](_0x164709)['then'](function(_0x4cc223){_0x621824[_0x0bb8('0x1b')]=_0x4cc223;if(_0x5e71e9[_0x0bb8('0x32')][_0x0bb8('0x41')]){_0xaa612b[_0x0bb8('0x42')]=[{'all':!![]}];}return db[_0x0bb8('0x2c')][_0x0bb8('0x43')](_0xaa612b);})[_0x0bb8('0x20')](function(_0x2aa3fe){_0x621824[_0x0bb8('0x44')]=_0x2aa3fe;return _0x621824;})[_0x0bb8('0x20')](respondWithFilteredResult(_0x4b34e2,_0xaa612b))['catch'](handleError(_0x4b34e2,null));};exports[_0x0bb8('0x45')]=function(_0x598ec9,_0x463344){var _0x29ac1d={'raw':!![],'where':{'id':_0x598ec9[_0x0bb8('0x46')]['id']}},_0x3e6450={};_0x3e6450[_0x0bb8('0x31')]=_[_0x0bb8('0x33')](db[_0x0bb8('0x2c')][_0x0bb8('0x2d')]);_0x3e6450[_0x0bb8('0x32')]=_['keys'](_0x598ec9[_0x0bb8('0x32')]);_0x3e6450[_0x0bb8('0x3c')]=_['intersection'](_0x3e6450[_0x0bb8('0x31')],_0x3e6450['query']);_0x29ac1d[_0x0bb8('0x34')]=_[_0x0bb8('0x47')](_0x3e6450['model'],qs[_0x0bb8('0x35')](_0x598ec9[_0x0bb8('0x32')]['fields']));_0x29ac1d[_0x0bb8('0x34')]=_0x29ac1d[_0x0bb8('0x34')][_0x0bb8('0x36')]?_0x29ac1d[_0x0bb8('0x34')]:_0x3e6450[_0x0bb8('0x31')];if(_0x598ec9[_0x0bb8('0x32')][_0x0bb8('0x41')]){_0x29ac1d[_0x0bb8('0x42')]=[{'all':!![]}];}_0x29ac1d=_[_0x0bb8('0x3d')]({},_0x29ac1d,_0x598ec9[_0x0bb8('0x40')]);return db[_0x0bb8('0x2c')][_0x0bb8('0x48')](_0x29ac1d)[_0x0bb8('0x20')](handleEntityNotFound(_0x463344,null))[_0x0bb8('0x20')](respondWithResult(_0x463344,null))[_0x0bb8('0x49')](handleError(_0x463344,null));};exports['create']=function(_0x27762b,_0x30de6e){return db['CmContactHasItem'][_0x0bb8('0x4a')](_0x27762b[_0x0bb8('0x4b')],{})[_0x0bb8('0x20')](function(_0x31601d){var _0x1a03a8=_0x27762b[_0x0bb8('0x4c')][_0x0bb8('0x21')]({'plain':!![]});if(!_0x1a03a8)throw new Error(_0x0bb8('0x4d'));if(_0x1a03a8[_0x0bb8('0x4e')]===_0x0bb8('0x4c')){var _0x360f8e=_0x31601d[_0x0bb8('0x21')]({'plain':!![]});var _0x1ae1bc=_0x0bb8('0x22');return db[_0x0bb8('0x4f')][_0x0bb8('0x48')]({'where':{'name':_0x1ae1bc,'userProfileId':_0x1a03a8[_0x0bb8('0x50')]},'raw':!![]})[_0x0bb8('0x20')](function(_0x309463){if(_0x309463&&_0x309463[_0x0bb8('0x51')]===0x0){return db[_0x0bb8('0x23')][_0x0bb8('0x4a')]({'name':_0x360f8e[_0x0bb8('0x28')],'resourceId':_0x360f8e['id'],'type':_0x309463[_0x0bb8('0x28')],'sectionId':_0x309463['id']},{})[_0x0bb8('0x20')](function(){return _0x31601d;});}else{return _0x31601d;}})['catch'](function(_0x5bef2d){logger['error'](_0x0bb8('0x52'),_0x5bef2d);throw _0x5bef2d;});}return _0x31601d;})[_0x0bb8('0x20')](respondWithResult(_0x30de6e,0xc9))[_0x0bb8('0x49')](handleError(_0x30de6e,null));};exports[_0x0bb8('0x1f')]=function(_0x5b316a,_0x2452a2){if(_0x5b316a['body']['id']){delete _0x5b316a['body']['id'];}return db[_0x0bb8('0x2c')][_0x0bb8('0x48')]({'where':{'id':_0x5b316a[_0x0bb8('0x46')]['id']}})['then'](handleEntityNotFound(_0x2452a2,null))['then'](saveUpdates(_0x5b316a['body'],null))['then'](respondWithResult(_0x2452a2,null))['catch'](handleError(_0x2452a2,null));};exports[_0x0bb8('0x24')]=function(_0x14631a,_0x2a7953){return db['CmContactHasItem'][_0x0bb8('0x48')]({'where':{'id':_0x14631a[_0x0bb8('0x46')]['id']}})[_0x0bb8('0x20')](handleEntityNotFound(_0x2a7953,null))['then'](removeEntity(_0x2a7953,null))[_0x0bb8('0x49')](handleError(_0x2a7953,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.model.js b/server/api/cmContactHasItem/cmContactHasItem.model.js index 0a7d5a4..c897bf4 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 _0xed1a=['exports','define','CmContactHasItem','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./cmContactHasItem.attributes'];(function(_0x10dc64,_0x11bb29){var _0x9cf98d=function(_0x558d71){while(--_0x558d71){_0x10dc64['push'](_0x10dc64['shift']());}};_0x9cf98d(++_0x11bb29);}(_0xed1a,0x1a3));var _0xaed1=function(_0x4f90af,_0x14b70c){_0x4f90af=_0x4f90af-0x0;var _0x5e62c0=_0xed1a[_0x4f90af];return _0x5e62c0;};'use strict';var _=require(_0xaed1('0x0'));var util=require(_0xaed1('0x1'));var logger=require(_0xaed1('0x2'))(_0xaed1('0x3'));var moment=require(_0xaed1('0x4'));var BPromise=require(_0xaed1('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xaed1('0x6'));var rimraf=require(_0xaed1('0x7'));var config=require(_0xaed1('0x8'));var attributes=require(_0xaed1('0x9'));module[_0xaed1('0xa')]=function(_0x293a60,_0x21b78a){return _0x293a60[_0xaed1('0xb')](_0xaed1('0xc'),attributes,{'tableName':'cm_contact_has_items','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x53d1=['lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./cmContactHasItem.attributes','exports','define','CmContactHasItem'];(function(_0x3ace41,_0x5708c9){var _0x79fb97=function(_0x3a2f3e){while(--_0x3a2f3e){_0x3ace41['push'](_0x3ace41['shift']());}};_0x79fb97(++_0x5708c9);}(_0x53d1,0x174));var _0x153d=function(_0x53dafe,_0x55da3a){_0x53dafe=_0x53dafe-0x0;var _0x2be1d4=_0x53d1[_0x53dafe];return _0x2be1d4;};'use strict';var _=require(_0x153d('0x0'));var util=require(_0x153d('0x1'));var logger=require('../../config/logger')(_0x153d('0x2'));var moment=require(_0x153d('0x3'));var BPromise=require(_0x153d('0x4'));var rp=require(_0x153d('0x5'));var fs=require('fs');var path=require(_0x153d('0x6'));var rimraf=require('rimraf');var config=require(_0x153d('0x7'));var attributes=require(_0x153d('0x8'));module[_0x153d('0x9')]=function(_0x557bed,_0x417850){return _0x557bed[_0x153d('0xa')](_0x153d('0xb'),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 f70ace5..3bfa19a 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 _0x7d1a=['lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','CmContactHasItem,\x20%s,\x20%s','request\x20sent','CmContactHasItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch'];(function(_0x241854,_0x3c7037){var _0x50b869=function(_0x218e8f){while(--_0x218e8f){_0x241854['push'](_0x241854['shift']());}};_0x50b869(++_0x3c7037);}(_0x7d1a,0x14a));var _0xa7d1=function(_0x4313d1,_0x1825a3){_0x4313d1=_0x4313d1-0x0;var _0x1c3d68=_0x7d1a[_0x4313d1];return _0x1c3d68;};'use strict';var _=require(_0xa7d1('0x0'));var util=require('util');var moment=require(_0xa7d1('0x1'));var BPromise=require('bluebird');var rs=require(_0xa7d1('0x2'));var fs=require('fs');var Redis=require(_0xa7d1('0x3'));var db=require(_0xa7d1('0x4'))['db'];var utils=require(_0xa7d1('0x5'));var logger=require(_0xa7d1('0x6'))(_0xa7d1('0x7'));var config=require(_0xa7d1('0x8'));var jayson=require(_0xa7d1('0x9'));var client=jayson[_0xa7d1('0xa')][_0xa7d1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x31acd2,_0x2e5088,_0x40785c){return new BPromise(function(_0x419e8a,_0x3c50d9){return client[_0xa7d1('0xc')](_0x31acd2,_0x40785c)['then'](function(_0x49dbc2){logger[_0xa7d1('0xd')](_0xa7d1('0xe'),_0x2e5088,_0xa7d1('0xf'));logger['debug'](_0xa7d1('0x10'),_0x2e5088,_0xa7d1('0xf'),JSON[_0xa7d1('0x11')](_0x49dbc2));if(_0x49dbc2[_0xa7d1('0x12')]){if(_0x49dbc2[_0xa7d1('0x12')][_0xa7d1('0x13')]===0x1f4){logger[_0xa7d1('0x12')](_0xa7d1('0xe'),_0x2e5088,_0x49dbc2[_0xa7d1('0x12')][_0xa7d1('0x14')]);return _0x3c50d9(_0x49dbc2[_0xa7d1('0x12')][_0xa7d1('0x14')]);}logger[_0xa7d1('0x12')](_0xa7d1('0xe'),_0x2e5088,_0x49dbc2[_0xa7d1('0x12')][_0xa7d1('0x14')]);return _0x419e8a(_0x49dbc2[_0xa7d1('0x12')][_0xa7d1('0x14')]);}else{logger[_0xa7d1('0xd')](_0xa7d1('0xe'),_0x2e5088,_0xa7d1('0xf'));_0x419e8a(_0x49dbc2['result'][_0xa7d1('0x14')]);}})[_0xa7d1('0x15')](function(_0x4eb951){logger[_0xa7d1('0x12')](_0xa7d1('0xe'),_0x2e5088,_0x4eb951);_0x3c50d9(_0x4eb951);});});} \ No newline at end of file +var _0x1708=['stringify','error','code','CmContactHasItem,\x20%s,\x20%s','message','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/environment','client','http','then','info','request\x20sent','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s'];(function(_0x9df060,_0x253d33){var _0x338dfe=function(_0x17d9a5){while(--_0x17d9a5){_0x9df060['push'](_0x9df060['shift']());}};_0x338dfe(++_0x253d33);}(_0x1708,0x1a8));var _0x8170=function(_0x4a3898,_0x4c9853){_0x4a3898=_0x4a3898-0x0;var _0x25ceb0=_0x1708[_0x4a3898];return _0x25ceb0;};'use strict';var _=require('lodash');var util=require(_0x8170('0x0'));var moment=require(_0x8170('0x1'));var BPromise=require(_0x8170('0x2'));var rs=require(_0x8170('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8170('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x8170('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x8170('0x6')][_0x8170('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4fae0f,_0xc33887,_0x5677fe){return new BPromise(function(_0x281cb8,_0x33f4d1){return client['request'](_0x4fae0f,_0x5677fe)[_0x8170('0x8')](function(_0x78854){logger[_0x8170('0x9')]('CmContactHasItem,\x20%s,\x20%s',_0xc33887,_0x8170('0xa'));logger[_0x8170('0xb')](_0x8170('0xc'),_0xc33887,_0x8170('0xa'),JSON[_0x8170('0xd')](_0x78854));if(_0x78854['error']){if(_0x78854[_0x8170('0xe')][_0x8170('0xf')]===0x1f4){logger[_0x8170('0xe')](_0x8170('0x10'),_0xc33887,_0x78854['error'][_0x8170('0x11')]);return _0x33f4d1(_0x78854[_0x8170('0xe')][_0x8170('0x11')]);}logger['error'](_0x8170('0x10'),_0xc33887,_0x78854[_0x8170('0xe')][_0x8170('0x11')]);return _0x281cb8(_0x78854[_0x8170('0xe')][_0x8170('0x11')]);}else{logger[_0x8170('0x9')]('CmContactHasItem,\x20%s,\x20%s',_0xc33887,_0x8170('0xa'));_0x281cb8(_0x78854['result'][_0x8170('0x11')]);}})[_0x8170('0x12')](function(_0x1956ef){logger[_0x8170('0xe')](_0x8170('0x10'),_0xc33887,_0x1956ef);_0x33f4d1(_0x1956ef);});});} \ No newline at end of file diff --git a/server/api/cmContactHasItem/index.js b/server/api/cmContactHasItem/index.js index 9e6cc93..4ff665b 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 _0x90d0=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContactHasItem.controller','get','isAuthenticated','index','/:id','post','create','put','update','destroy','path'];(function(_0x41c94e,_0x562f0c){var _0x5a842d=function(_0x5efdc2){while(--_0x5efdc2){_0x41c94e['push'](_0x41c94e['shift']());}};_0x5a842d(++_0x562f0c);}(_0x90d0,0x10f));var _0x090d=function(_0x3c3a03,_0x3c0da1){_0x3c3a03=_0x3c3a03-0x0;var _0x57ff53=_0x90d0[_0x3c3a03];return _0x57ff53;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x090d('0x0'));var timeout=require(_0x090d('0x1'));var express=require('express');var router=express[_0x090d('0x2')]();var fs_extra=require(_0x090d('0x3'));var auth=require(_0x090d('0x4'));var interaction=require(_0x090d('0x5'));var config=require(_0x090d('0x6'));var controller=require(_0x090d('0x7'));router[_0x090d('0x8')]('/',auth[_0x090d('0x9')](),controller[_0x090d('0xa')]);router[_0x090d('0x8')](_0x090d('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x090d('0xc')]('/',auth[_0x090d('0x9')](),controller[_0x090d('0xd')]);router[_0x090d('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x090d('0xf')]);router['delete']('/:id',auth[_0x090d('0x9')](),controller[_0x090d('0x10')]);module['exports']=router; \ No newline at end of file +var _0x9847=['../../components/interaction/service','../../config/environment','./cmContactHasItem.controller','isAuthenticated','get','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x2dac1a,_0x104e21){var _0xdc1f4b=function(_0x50ce23){while(--_0x50ce23){_0x2dac1a['push'](_0x2dac1a['shift']());}};_0xdc1f4b(++_0x104e21);}(_0x9847,0xa1));var _0x7984=function(_0x23c2ae,_0x2c9ca5){_0x23c2ae=_0x23c2ae-0x0;var _0xb5c94e=_0x9847[_0x23c2ae];return _0xb5c94e;};'use strict';var multer=require(_0x7984('0x0'));var util=require(_0x7984('0x1'));var path=require(_0x7984('0x2'));var timeout=require(_0x7984('0x3'));var express=require(_0x7984('0x4'));var router=express[_0x7984('0x5')]();var fs_extra=require(_0x7984('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x7984('0x7'));var config=require(_0x7984('0x8'));var controller=require(_0x7984('0x9'));router['get']('/',auth[_0x7984('0xa')](),controller['index']);router[_0x7984('0xb')](_0x7984('0xc'),auth['isAuthenticated'](),controller[_0x7984('0xd')]);router[_0x7984('0xe')]('/',auth[_0x7984('0xa')](),controller[_0x7984('0xf')]);router[_0x7984('0x10')](_0x7984('0xc'),auth[_0x7984('0xa')](),controller[_0x7984('0x11')]);router[_0x7984('0x12')]('/:id',auth[_0x7984('0xa')](),controller[_0x7984('0x13')]);module[_0x7984('0x14')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index 2e722ef..edff628 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 _0x926f=['ENUM','voice','sequelize','exports','VIRTUAL','getDataValue','alias','STRING','setDataValue','name','TEXT','type','select','parse','values','isArray','stringify','BOOLEAN'];(function(_0x3f6924,_0x43d3b1){var _0x802dd5=function(_0x5c47cf){while(--_0x5c47cf){_0x3f6924['push'](_0x3f6924['shift']());}};_0x802dd5(++_0x43d3b1);}(_0x926f,0xda));var _0xf926=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x926f[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0xf926('0x0'));var _=require('lodash');module[_0xf926('0x1')]={'name':{'type':Sequelize[_0xf926('0x2')],'get':function(_0x34ce0b){return this[_0xf926('0x3')](_0xf926('0x4'));}},'alias':{'type':Sequelize[_0xf926('0x5')],'allowNull':![],'set':function(_0x36c2c5){this[_0xf926('0x6')](_0xf926('0x4'),_0x36c2c5?_0x36c2c5:this[_0xf926('0x3')](_0xf926('0x7')));}},'type':{'type':Sequelize[_0xf926('0x5')],'allowNull':![]},'values':{'type':Sequelize[_0xf926('0x8')]('long'),'get':function(){if(this[_0xf926('0x3')](_0xf926('0x9'))===_0xf926('0xa')){return JSON[_0xf926('0xb')](this[_0xf926('0x3')](_0xf926('0xc')));}else{return this[_0xf926('0x3')]('values');}},'set':function(_0xaf4e96){if(Array[_0xf926('0xd')](_0xaf4e96)){this['setDataValue'](_0xf926('0xc'),JSON[_0xf926('0xe')](_0xaf4e96));}else{this[_0xf926('0x6')]('values',_0xaf4e96);}}},'required':{'type':Sequelize[_0xf926('0xf')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0xf926('0xf')],'defaultValue':![]},'actionType':{'type':Sequelize[_0xf926('0x10')](_0xf926('0x11'))}}; \ No newline at end of file +var _0x942f=['sequelize','exports','VIRTUAL','getDataValue','alias','STRING','setDataValue','name','TEXT','type','select','values','stringify','BOOLEAN','ENUM','voice'];(function(_0x2d3d0d,_0x67ac82){var _0xca35b6=function(_0x483979){while(--_0x483979){_0x2d3d0d['push'](_0x2d3d0d['shift']());}};_0xca35b6(++_0x67ac82);}(_0x942f,0xf0));var _0xf942=function(_0x148a19,_0x54b80f){_0x148a19=_0x148a19-0x0;var _0x40727e=_0x942f[_0x148a19];return _0x40727e;};'use strict';var Sequelize=require(_0xf942('0x0'));var _=require('lodash');module[_0xf942('0x1')]={'name':{'type':Sequelize[_0xf942('0x2')],'get':function(_0x3aa977){return this[_0xf942('0x3')](_0xf942('0x4'));}},'alias':{'type':Sequelize[_0xf942('0x5')],'allowNull':![],'set':function(_0x7d58f4){this[_0xf942('0x6')](_0xf942('0x4'),_0x7d58f4?_0x7d58f4:this[_0xf942('0x3')](_0xf942('0x7')));}},'type':{'type':Sequelize[_0xf942('0x5')],'allowNull':![]},'values':{'type':Sequelize[_0xf942('0x8')]('long'),'get':function(){if(this[_0xf942('0x3')](_0xf942('0x9'))===_0xf942('0xa')){return JSON['parse'](this['getDataValue'](_0xf942('0xb')));}else{return this[_0xf942('0x3')](_0xf942('0xb'));}},'set':function(_0x108167){if(Array['isArray'](_0x108167)){this[_0xf942('0x6')]('values',JSON[_0xf942('0xc')](_0x108167));}else{this[_0xf942('0x6')](_0xf942('0xb'),_0x108167);}}},'required':{'type':Sequelize[_0xf942('0xd')],'defaultValue':![]},'clickToAction':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'actionType':{'type':Sequelize[_0xf942('0xe')](_0xf942('0xf'))}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index cb40a4d..e33d51e 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 _0xe302=['switch','BOOLEAN','queryInterface','addColumn','format','cf_%d','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','json','limit','undefined','offset','Content-Range','reject','update','destroy','then','end','stack','name','send','index','CmCustomField','fieldName','type','key','differenceBy','keys','query','filters','intersection','attributes','model','fields','length','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','options','count','includeAll','catch','show','params','rawAttributes','include','find','body','create','sequelize','transaction','Sequelize','text','TEXT','number','INTEGER'];(function(_0x1a37ee,_0x4d2883){var _0x1a9efb=function(_0x1acc8f){while(--_0x1acc8f){_0x1a37ee['push'](_0x1a37ee['shift']());}};_0x1a9efb(++_0x4d2883);}(_0xe302,0x108));var _0x2e30=function(_0x457ac2,_0x2ec066){_0x457ac2=_0x457ac2-0x0;var _0x273925=_0xe302[_0x457ac2];return _0x273925;};'use strict';var emlformat=require(_0x2e30('0x0'));var rimraf=require(_0x2e30('0x1'));var zipdir=require(_0x2e30('0x2'));var jsonpatch=require(_0x2e30('0x3'));var rp=require(_0x2e30('0x4'));var moment=require('moment');var BPromise=require(_0x2e30('0x5'));var Mustache=require(_0x2e30('0x6'));var util=require(_0x2e30('0x7'));var path=require(_0x2e30('0x8'));var sox=require('sox');var csv=require(_0x2e30('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2e30('0xa'));var _=require(_0x2e30('0xb'));var squel=require(_0x2e30('0xc'));var crypto=require(_0x2e30('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x2e30('0x9'));var querystring=require(_0x2e30('0xe'));var Papa=require(_0x2e30('0xf'));var Redis=require(_0x2e30('0x10'));var authService=require(_0x2e30('0x11'));var qs=require(_0x2e30('0x12'));var as=require(_0x2e30('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2e30('0x14'))(_0x2e30('0x15'));var utils=require('../../config/utils');var config=require(_0x2e30('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x2e30('0x17'))['db'];function respondWithStatusCode(_0x45d2fb,_0x13d224){_0x13d224=_0x13d224||0xcc;return function(_0x408d12){if(_0x408d12){return _0x45d2fb[_0x2e30('0x18')](_0x13d224);}return _0x45d2fb['status'](_0x13d224)['end']();};}function respondWithResult(_0x497fdd,_0x274da0){_0x274da0=_0x274da0||0xc8;return function(_0x24319e){if(_0x24319e){return _0x497fdd[_0x2e30('0x19')](_0x274da0)[_0x2e30('0x1a')](_0x24319e);}};}function respondWithFilteredResult(_0x18a84b,_0x3898c2){return function(_0x42dc90){if(_0x42dc90){var _0x5cb1fb=typeof _0x3898c2['offset']==='undefined'&&typeof _0x3898c2[_0x2e30('0x1b')]===_0x2e30('0x1c');var _0x2e7255=_0x42dc90['count'];var _0x13287c=_0x5cb1fb?0x0:_0x3898c2[_0x2e30('0x1d')];var _0x40c3c6=_0x5cb1fb?_0x42dc90['count']:_0x3898c2['offset']+_0x3898c2[_0x2e30('0x1b')];var _0x1bc5c8;if(_0x40c3c6>=_0x2e7255){_0x40c3c6=_0x2e7255;_0x1bc5c8=0xc8;}else{_0x1bc5c8=0xce;}_0x18a84b[_0x2e30('0x19')](_0x1bc5c8);return _0x18a84b['set'](_0x2e30('0x1e'),_0x13287c+'-'+_0x40c3c6+'/'+_0x2e7255)[_0x2e30('0x1a')](_0x42dc90);}return null;};}function patchUpdates(_0x3eea83){return function(_0x364795){try{jsonpatch['apply'](_0x364795,_0x3eea83,!![]);}catch(_0x271620){return BPromise[_0x2e30('0x1f')](_0x271620);}return _0x364795['save']();};}function saveUpdates(_0x6d070b,_0x360cae){return function(_0x48162e){if(_0x48162e){return _0x48162e[_0x2e30('0x20')](_0x6d070b)['then'](function(_0x26ee48){return _0x26ee48;});}return null;};}function removeEntity(_0x2bdc8e,_0x425322){return function(_0x60ec58){if(_0x60ec58){return _0x60ec58[_0x2e30('0x21')]()[_0x2e30('0x22')](function(){_0x2bdc8e[_0x2e30('0x19')](0xcc)[_0x2e30('0x23')]();});}};}function handleEntityNotFound(_0x40f532,_0xcc2b37){return function(_0x35f901){if(!_0x35f901){_0x40f532[_0x2e30('0x18')](0x194);}return _0x35f901;};}function handleError(_0x167544,_0xeafaf6){_0xeafaf6=_0xeafaf6||0x1f4;return function(_0x559d3d){logger['error'](_0x559d3d[_0x2e30('0x24')]);if(_0x559d3d[_0x2e30('0x25')]){delete _0x559d3d[_0x2e30('0x25')];}_0x167544['status'](_0xeafaf6)[_0x2e30('0x26')](_0x559d3d);};}exports[_0x2e30('0x27')]=function(_0x23bc39,_0x4a555a){var _0x50a7c6={},_0x47dee0={},_0x2d9a5a={'count':0x0,'rows':[]};var _0x291c23=_['map'](db[_0x2e30('0x28')]['rawAttributes'],function(_0x440905){return{'name':_0x440905[_0x2e30('0x29')],'type':_0x440905[_0x2e30('0x2a')][_0x2e30('0x2b')]};});_0x47dee0['model']=_[_0x2e30('0x2c')](_['map'](_0x291c23,'name'),[_0x2e30('0x25')]);_0x47dee0['query']=_[_0x2e30('0x2d')](_0x23bc39[_0x2e30('0x2e')]);_0x47dee0[_0x2e30('0x2f')]=_[_0x2e30('0x30')](_0x47dee0['model'],_0x47dee0['query']);_0x50a7c6[_0x2e30('0x31')]=_[_0x2e30('0x30')](_0x47dee0[_0x2e30('0x32')],qs[_0x2e30('0x33')](_0x23bc39[_0x2e30('0x2e')]['fields']));_0x50a7c6[_0x2e30('0x31')]=_0x50a7c6[_0x2e30('0x31')][_0x2e30('0x34')]?_0x50a7c6['attributes']:_0x47dee0['model'];if(!_0x23bc39[_0x2e30('0x2e')]['hasOwnProperty'](_0x2e30('0x35'))){_0x50a7c6[_0x2e30('0x1b')]=qs[_0x2e30('0x1b')](_0x23bc39[_0x2e30('0x2e')][_0x2e30('0x1b')]);_0x50a7c6[_0x2e30('0x1d')]=qs[_0x2e30('0x1d')](_0x23bc39[_0x2e30('0x2e')][_0x2e30('0x1d')]);}_0x50a7c6[_0x2e30('0x36')]=qs[_0x2e30('0x37')](_0x23bc39[_0x2e30('0x2e')][_0x2e30('0x37')]);_0x50a7c6[_0x2e30('0x38')]=qs[_0x2e30('0x2f')](_[_0x2e30('0x39')](_0x23bc39[_0x2e30('0x2e')],_0x47dee0['filters']),_0x291c23);if(_0x23bc39[_0x2e30('0x2e')][_0x2e30('0x3a')]){_0x50a7c6[_0x2e30('0x38')]=_[_0x2e30('0x3b')](_0x50a7c6[_0x2e30('0x38')],{'$or':_[_0x2e30('0x3c')](_0x291c23,function(_0x36c575){if(_0x36c575['type']!==_0x2e30('0x3d')){var _0x38e4e0={};_0x38e4e0[_0x36c575[_0x2e30('0x25')]]={'$like':'%'+_0x23bc39[_0x2e30('0x2e')][_0x2e30('0x3a')]+'%'};return _0x38e4e0;}})});}_0x50a7c6=_[_0x2e30('0x3b')]({},_0x50a7c6,_0x23bc39[_0x2e30('0x3e')]);var _0x1b183a={'where':_0x50a7c6[_0x2e30('0x38')]};return db[_0x2e30('0x28')][_0x2e30('0x3f')](_0x1b183a)[_0x2e30('0x22')](function(_0x5a5067){_0x2d9a5a[_0x2e30('0x3f')]=_0x5a5067;if(_0x23bc39['query'][_0x2e30('0x40')]){_0x50a7c6['include']=[{'all':!![]}];}return db['CmCustomField']['findAll'](_0x50a7c6);})['then'](function(_0x4c75f6){_0x2d9a5a['rows']=_0x4c75f6;return _0x2d9a5a;})[_0x2e30('0x22')](respondWithFilteredResult(_0x4a555a,_0x50a7c6))[_0x2e30('0x41')](handleError(_0x4a555a,null));};exports[_0x2e30('0x42')]=function(_0x813cf6,_0x49001c){var _0xdc56be={'raw':!![],'where':{'id':_0x813cf6[_0x2e30('0x43')]['id']}},_0x5b11f9={};_0x5b11f9[_0x2e30('0x32')]=_['keys'](db[_0x2e30('0x28')][_0x2e30('0x44')]);_0x5b11f9[_0x2e30('0x2e')]=_['keys'](_0x813cf6[_0x2e30('0x2e')]);_0x5b11f9[_0x2e30('0x2f')]=_[_0x2e30('0x30')](_0x5b11f9['model'],_0x5b11f9[_0x2e30('0x2e')]);_0xdc56be[_0x2e30('0x31')]=_['intersection'](_0x5b11f9[_0x2e30('0x32')],qs[_0x2e30('0x33')](_0x813cf6[_0x2e30('0x2e')]['fields']));_0xdc56be['attributes']=_0xdc56be[_0x2e30('0x31')]['length']?_0xdc56be[_0x2e30('0x31')]:_0x5b11f9['model'];if(_0x813cf6[_0x2e30('0x2e')]['includeAll']){_0xdc56be[_0x2e30('0x45')]=[{'all':!![]}];}_0xdc56be=_[_0x2e30('0x3b')]({},_0xdc56be,_0x813cf6[_0x2e30('0x3e')]);return db[_0x2e30('0x28')][_0x2e30('0x46')](_0xdc56be)['then'](handleEntityNotFound(_0x49001c,null))[_0x2e30('0x22')](respondWithResult(_0x49001c,null))[_0x2e30('0x41')](handleError(_0x49001c,null));};exports['update']=function(_0x2b0ae2,_0x4274f8){if(_0x2b0ae2[_0x2e30('0x47')]['id']){delete _0x2b0ae2[_0x2e30('0x47')]['id'];}return db[_0x2e30('0x28')][_0x2e30('0x46')]({'where':{'id':_0x2b0ae2['params']['id']}})[_0x2e30('0x22')](handleEntityNotFound(_0x4274f8,null))['then'](saveUpdates(_0x2b0ae2[_0x2e30('0x47')],null))['then'](respondWithResult(_0x4274f8,null))[_0x2e30('0x41')](handleError(_0x4274f8,null));};exports[_0x2e30('0x21')]=function(_0x59bef9,_0x1bf0ac){return db[_0x2e30('0x28')][_0x2e30('0x46')]({'where':{'id':_0x59bef9['params']['id']}})['then'](handleEntityNotFound(_0x1bf0ac,null))[_0x2e30('0x22')](removeEntity(_0x1bf0ac,null))[_0x2e30('0x41')](handleError(_0x1bf0ac,null));};exports[_0x2e30('0x48')]=function(_0x3efdbf,_0x5309eb){var _0x5337c7;return db[_0x2e30('0x49')][_0x2e30('0x4a')](function(_0x23ebc9){return db['CmCustomField']['create'](_0x3efdbf[_0x2e30('0x47')],{'transaction':_0x23ebc9})['then'](function(_0x53fc3b){_0x5337c7=_0x53fc3b;var _0xcedc73={'type':db[_0x2e30('0x4b')]['TEXT'],'transaction':_0x23ebc9};switch(_0x3efdbf['body'][_0x2e30('0x2a')]){case _0x2e30('0x4c'):_0xcedc73[_0x2e30('0x2a')]=db[_0x2e30('0x4b')][_0x2e30('0x4d')];break;case _0x2e30('0x4e'):_0xcedc73['type']=db['Sequelize'][_0x2e30('0x4f')];break;case _0x2e30('0x50'):_0xcedc73['type']=db[_0x2e30('0x4b')][_0x2e30('0x51')];_0xcedc73['defaultValue']=![];break;default:}return db[_0x2e30('0x49')][_0x2e30('0x52')][_0x2e30('0x53')]('cm_contacts',util[_0x2e30('0x54')](_0x2e30('0x55'),_0x5337c7['id']),_0xcedc73);})[_0x2e30('0x22')](function(){return _0x5337c7;});})['then'](respondWithResult(_0x5309eb,0xc9))[_0x2e30('0x41')](handleError(_0x5309eb,null));}; \ No newline at end of file +var _0xd51c=['rows','catch','show','params','find','body','create','sequelize','transaction','Sequelize','TEXT','text','INTEGER','switch','BOOLEAN','queryInterface','cf_%d','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','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','index','map','CmCustomField','rawAttributes','type','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','merge','VIRTUAL','filter','options','includeAll','include'];(function(_0x419550,_0x15cdf1){var _0x55f9ef=function(_0x44f707){while(--_0x44f707){_0x419550['push'](_0x419550['shift']());}};_0x55f9ef(++_0x15cdf1);}(_0xd51c,0xb9));var _0xcd51=function(_0x8221b1,_0x912159){_0x8221b1=_0x8221b1-0x0;var _0xd4d1ac=_0xd51c[_0x8221b1];return _0xd4d1ac;};'use strict';var emlformat=require(_0xcd51('0x0'));var rimraf=require(_0xcd51('0x1'));var zipdir=require(_0xcd51('0x2'));var jsonpatch=require(_0xcd51('0x3'));var rp=require(_0xcd51('0x4'));var moment=require(_0xcd51('0x5'));var BPromise=require(_0xcd51('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xcd51('0x7'));var sox=require(_0xcd51('0x8'));var csv=require('to-csv');var ejs=require(_0xcd51('0x9'));var fs=require('fs');var fs_extra=require(_0xcd51('0xa'));var _=require(_0xcd51('0xb'));var squel=require(_0xcd51('0xc'));var crypto=require(_0xcd51('0xd'));var jsforce=require(_0xcd51('0xe'));var deskjs=require(_0xcd51('0xf'));var toCsv=require(_0xcd51('0x10'));var querystring=require(_0xcd51('0x11'));var Papa=require(_0xcd51('0x12'));var Redis=require(_0xcd51('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcd51('0x14'));var logger=require(_0xcd51('0x15'))(_0xcd51('0x16'));var utils=require(_0xcd51('0x17'));var config=require(_0xcd51('0x18'));var licenseUtil=require(_0xcd51('0x19'));var db=require(_0xcd51('0x1a'))['db'];function respondWithStatusCode(_0x570cc2,_0x41c9cf){_0x41c9cf=_0x41c9cf||0xcc;return function(_0x314dc0){if(_0x314dc0){return _0x570cc2[_0xcd51('0x1b')](_0x41c9cf);}return _0x570cc2[_0xcd51('0x1c')](_0x41c9cf)[_0xcd51('0x1d')]();};}function respondWithResult(_0x421f35,_0x58eb34){_0x58eb34=_0x58eb34||0xc8;return function(_0x3056d3){if(_0x3056d3){return _0x421f35['status'](_0x58eb34)[_0xcd51('0x1e')](_0x3056d3);}};}function respondWithFilteredResult(_0x59755f,_0x4acca5){return function(_0x3ee3c9){if(_0x3ee3c9){var _0x137b48=typeof _0x4acca5[_0xcd51('0x1f')]===_0xcd51('0x20')&&typeof _0x4acca5[_0xcd51('0x21')]===_0xcd51('0x20');var _0x4e2d88=_0x3ee3c9[_0xcd51('0x22')];var _0x1765f1=_0x137b48?0x0:_0x4acca5['offset'];var _0x45ed20=_0x137b48?_0x3ee3c9['count']:_0x4acca5[_0xcd51('0x1f')]+_0x4acca5['limit'];var _0xf20cb1;if(_0x45ed20>=_0x4e2d88){_0x45ed20=_0x4e2d88;_0xf20cb1=0xc8;}else{_0xf20cb1=0xce;}_0x59755f[_0xcd51('0x1c')](_0xf20cb1);return _0x59755f[_0xcd51('0x23')](_0xcd51('0x24'),_0x1765f1+'-'+_0x45ed20+'/'+_0x4e2d88)['json'](_0x3ee3c9);}return null;};}function patchUpdates(_0x3aa57e){return function(_0x24ccea){try{jsonpatch[_0xcd51('0x25')](_0x24ccea,_0x3aa57e,!![]);}catch(_0x161cbb){return BPromise['reject'](_0x161cbb);}return _0x24ccea[_0xcd51('0x26')]();};}function saveUpdates(_0x30780d,_0x56c0e7){return function(_0x7588ab){if(_0x7588ab){return _0x7588ab[_0xcd51('0x27')](_0x30780d)[_0xcd51('0x28')](function(_0x290373){return _0x290373;});}return null;};}function removeEntity(_0x45dc7a,_0x34d764){return function(_0x57911e){if(_0x57911e){return _0x57911e[_0xcd51('0x29')]()[_0xcd51('0x28')](function(){_0x45dc7a[_0xcd51('0x1c')](0xcc)[_0xcd51('0x1d')]();});}};}function handleEntityNotFound(_0x17d083,_0x10d876){return function(_0x2e2b31){if(!_0x2e2b31){_0x17d083[_0xcd51('0x1b')](0x194);}return _0x2e2b31;};}function handleError(_0x36d2dc,_0x53262f){_0x53262f=_0x53262f||0x1f4;return function(_0xbf86cf){logger[_0xcd51('0x2a')](_0xbf86cf['stack']);if(_0xbf86cf['name']){delete _0xbf86cf['name'];}_0x36d2dc[_0xcd51('0x1c')](_0x53262f)['send'](_0xbf86cf);};}exports[_0xcd51('0x2b')]=function(_0x11d6b1,_0xfffbc1){var _0x966c96={},_0x163f28={},_0x175ce4={'count':0x0,'rows':[]};var _0x7f65b=_[_0xcd51('0x2c')](db[_0xcd51('0x2d')][_0xcd51('0x2e')],function(_0x1236c1){return{'name':_0x1236c1['fieldName'],'type':_0x1236c1[_0xcd51('0x2f')]['key']};});_0x163f28[_0xcd51('0x30')]=_['differenceBy'](_[_0xcd51('0x2c')](_0x7f65b,_0xcd51('0x31')),[_0xcd51('0x31')]);_0x163f28[_0xcd51('0x32')]=_[_0xcd51('0x33')](_0x11d6b1['query']);_0x163f28[_0xcd51('0x34')]=_[_0xcd51('0x35')](_0x163f28['model'],_0x163f28[_0xcd51('0x32')]);_0x966c96[_0xcd51('0x36')]=_[_0xcd51('0x35')](_0x163f28[_0xcd51('0x30')],qs[_0xcd51('0x37')](_0x11d6b1[_0xcd51('0x32')][_0xcd51('0x37')]));_0x966c96['attributes']=_0x966c96['attributes'][_0xcd51('0x38')]?_0x966c96[_0xcd51('0x36')]:_0x163f28[_0xcd51('0x30')];if(!_0x11d6b1[_0xcd51('0x32')][_0xcd51('0x39')](_0xcd51('0x3a'))){_0x966c96['limit']=qs['limit'](_0x11d6b1[_0xcd51('0x32')]['limit']);_0x966c96[_0xcd51('0x1f')]=qs[_0xcd51('0x1f')](_0x11d6b1[_0xcd51('0x32')][_0xcd51('0x1f')]);}_0x966c96['order']=qs['sort'](_0x11d6b1[_0xcd51('0x32')][_0xcd51('0x3b')]);_0x966c96[_0xcd51('0x3c')]=qs[_0xcd51('0x34')](_['pick'](_0x11d6b1[_0xcd51('0x32')],_0x163f28[_0xcd51('0x34')]),_0x7f65b);if(_0x11d6b1['query']['filter']){_0x966c96[_0xcd51('0x3c')]=_[_0xcd51('0x3d')](_0x966c96[_0xcd51('0x3c')],{'$or':_[_0xcd51('0x2c')](_0x7f65b,function(_0x1df74f){if(_0x1df74f[_0xcd51('0x2f')]!==_0xcd51('0x3e')){var _0x3b2669={};_0x3b2669[_0x1df74f[_0xcd51('0x31')]]={'$like':'%'+_0x11d6b1[_0xcd51('0x32')][_0xcd51('0x3f')]+'%'};return _0x3b2669;}})});}_0x966c96=_[_0xcd51('0x3d')]({},_0x966c96,_0x11d6b1[_0xcd51('0x40')]);var _0x19e251={'where':_0x966c96[_0xcd51('0x3c')]};return db['CmCustomField'][_0xcd51('0x22')](_0x19e251)[_0xcd51('0x28')](function(_0x5d5359){_0x175ce4[_0xcd51('0x22')]=_0x5d5359;if(_0x11d6b1[_0xcd51('0x32')][_0xcd51('0x41')]){_0x966c96[_0xcd51('0x42')]=[{'all':!![]}];}return db[_0xcd51('0x2d')]['findAll'](_0x966c96);})[_0xcd51('0x28')](function(_0x243066){_0x175ce4[_0xcd51('0x43')]=_0x243066;return _0x175ce4;})['then'](respondWithFilteredResult(_0xfffbc1,_0x966c96))[_0xcd51('0x44')](handleError(_0xfffbc1,null));};exports[_0xcd51('0x45')]=function(_0x318553,_0x411476){var _0x42b9e9={'raw':!![],'where':{'id':_0x318553[_0xcd51('0x46')]['id']}},_0x18598c={};_0x18598c['model']=_[_0xcd51('0x33')](db[_0xcd51('0x2d')][_0xcd51('0x2e')]);_0x18598c['query']=_['keys'](_0x318553[_0xcd51('0x32')]);_0x18598c[_0xcd51('0x34')]=_[_0xcd51('0x35')](_0x18598c[_0xcd51('0x30')],_0x18598c['query']);_0x42b9e9[_0xcd51('0x36')]=_[_0xcd51('0x35')](_0x18598c[_0xcd51('0x30')],qs[_0xcd51('0x37')](_0x318553[_0xcd51('0x32')][_0xcd51('0x37')]));_0x42b9e9[_0xcd51('0x36')]=_0x42b9e9[_0xcd51('0x36')]['length']?_0x42b9e9[_0xcd51('0x36')]:_0x18598c[_0xcd51('0x30')];if(_0x318553[_0xcd51('0x32')]['includeAll']){_0x42b9e9[_0xcd51('0x42')]=[{'all':!![]}];}_0x42b9e9=_[_0xcd51('0x3d')]({},_0x42b9e9,_0x318553[_0xcd51('0x40')]);return db[_0xcd51('0x2d')][_0xcd51('0x47')](_0x42b9e9)['then'](handleEntityNotFound(_0x411476,null))['then'](respondWithResult(_0x411476,null))[_0xcd51('0x44')](handleError(_0x411476,null));};exports[_0xcd51('0x27')]=function(_0x5b7bfe,_0x404879){if(_0x5b7bfe['body']['id']){delete _0x5b7bfe[_0xcd51('0x48')]['id'];}return db[_0xcd51('0x2d')][_0xcd51('0x47')]({'where':{'id':_0x5b7bfe[_0xcd51('0x46')]['id']}})['then'](handleEntityNotFound(_0x404879,null))[_0xcd51('0x28')](saveUpdates(_0x5b7bfe[_0xcd51('0x48')],null))[_0xcd51('0x28')](respondWithResult(_0x404879,null))[_0xcd51('0x44')](handleError(_0x404879,null));};exports['destroy']=function(_0x10490b,_0x49f45c){return db['CmCustomField'][_0xcd51('0x47')]({'where':{'id':_0x10490b['params']['id']}})[_0xcd51('0x28')](handleEntityNotFound(_0x49f45c,null))[_0xcd51('0x28')](removeEntity(_0x49f45c,null))[_0xcd51('0x44')](handleError(_0x49f45c,null));};exports[_0xcd51('0x49')]=function(_0x372adf,_0x2556fa){var _0x3ad89f;return db[_0xcd51('0x4a')][_0xcd51('0x4b')](function(_0x176aae){return db[_0xcd51('0x2d')]['create'](_0x372adf[_0xcd51('0x48')],{'transaction':_0x176aae})[_0xcd51('0x28')](function(_0x2fc9c1){_0x3ad89f=_0x2fc9c1;var _0x307a26={'type':db[_0xcd51('0x4c')][_0xcd51('0x4d')],'transaction':_0x176aae};switch(_0x372adf[_0xcd51('0x48')]['type']){case _0xcd51('0x4e'):_0x307a26['type']=db[_0xcd51('0x4c')][_0xcd51('0x4d')];break;case'number':_0x307a26[_0xcd51('0x2f')]=db[_0xcd51('0x4c')][_0xcd51('0x4f')];break;case _0xcd51('0x50'):_0x307a26['type']=db[_0xcd51('0x4c')][_0xcd51('0x51')];_0x307a26['defaultValue']=![];break;default:}return db['sequelize'][_0xcd51('0x52')]['addColumn']('cm_contacts',util['format'](_0xcd51('0x53'),_0x3ad89f['id']),_0x307a26);})[_0xcd51('0x28')](function(){return _0x3ad89f;});})[_0xcd51('0x28')](respondWithResult(_0x2556fa,0xc9))[_0xcd51('0x44')](handleError(_0x2556fa,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index 9f1fdab..c3e8c6d 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 _0xf6e9=['CmCustomField','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmCustomField.attributes','exports','define'];(function(_0x31c81b,_0x4a2b1c){var _0x52ab34=function(_0x2e6c48){while(--_0x2e6c48){_0x31c81b['push'](_0x31c81b['shift']());}};_0x52ab34(++_0x4a2b1c);}(_0xf6e9,0x16d));var _0x9f6e=function(_0x2f0f9a,_0x5d6454){_0x2f0f9a=_0x2f0f9a-0x0;var _0x3261e3=_0xf6e9[_0x2f0f9a];return _0x3261e3;};'use strict';var _=require(_0x9f6e('0x0'));var util=require(_0x9f6e('0x1'));var logger=require(_0x9f6e('0x2'))(_0x9f6e('0x3'));var moment=require(_0x9f6e('0x4'));var BPromise=require(_0x9f6e('0x5'));var rp=require(_0x9f6e('0x6'));var fs=require('fs');var path=require(_0x9f6e('0x7'));var rimraf=require(_0x9f6e('0x8'));var config=require(_0x9f6e('0x9'));var attributes=require(_0x9f6e('0xa'));module[_0x9f6e('0xb')]=function(_0x1629cc,_0x5a40d1){return _0x1629cc[_0x9f6e('0xc')](_0x9f6e('0xd'),attributes,{'tableName':'cm_custom_fields','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2722=['CmCustomField','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','./cmCustomField.attributes','exports'];(function(_0x44c583,_0xdc4d48){var _0x396a41=function(_0x1f3e0d){while(--_0x1f3e0d){_0x44c583['push'](_0x44c583['shift']());}};_0x396a41(++_0xdc4d48);}(_0x2722,0xfe));var _0x2272=function(_0x2d72a5,_0x46845a){_0x2d72a5=_0x2d72a5-0x0;var _0x2e7d1a=_0x2722[_0x2d72a5];return _0x2e7d1a;};'use strict';var _=require(_0x2272('0x0'));var util=require(_0x2272('0x1'));var logger=require(_0x2272('0x2'))(_0x2272('0x3'));var moment=require(_0x2272('0x4'));var BPromise=require('bluebird');var rp=require(_0x2272('0x5'));var fs=require('fs');var path=require(_0x2272('0x6'));var rimraf=require(_0x2272('0x7'));var config=require('../../config/environment');var attributes=require(_0x2272('0x8'));module[_0x2272('0x9')]=function(_0x554e4b,_0x5a6348){return _0x554e4b['define'](_0x2272('0xa'),attributes,{'tableName':'cm_custom_fields','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 33da43a..5d31155 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 _0x0b09=['error','code','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','CmCustomField,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x6641d7,_0x124638){var _0x5a287a=function(_0x210f62){while(--_0x210f62){_0x6641d7['push'](_0x6641d7['shift']());}};_0x5a287a(++_0x124638);}(_0x0b09,0x1cc));var _0x90b0=function(_0x224c19,_0x5b35b8){_0x224c19=_0x224c19-0x0;var _0x379914=_0x0b09[_0x224c19];return _0x379914;};'use strict';var _=require(_0x90b0('0x0'));var util=require('util');var moment=require(_0x90b0('0x1'));var BPromise=require(_0x90b0('0x2'));var rs=require(_0x90b0('0x3'));var fs=require('fs');var Redis=require(_0x90b0('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x90b0('0x5'));var logger=require(_0x90b0('0x6'))('rpc');var config=require(_0x90b0('0x7'));var jayson=require(_0x90b0('0x8'));var client=jayson['client'][_0x90b0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x507c46,_0xace59b,_0x3ad0d3){return new BPromise(function(_0xecad52,_0x243a4a){return client[_0x90b0('0xa')](_0x507c46,_0x3ad0d3)['then'](function(_0x4f812a){logger[_0x90b0('0xb')](_0x90b0('0xc'),_0xace59b,_0x90b0('0xd'));logger[_0x90b0('0xe')]('CmCustomField,\x20%s,\x20%s,\x20%s',_0xace59b,_0x90b0('0xd'),JSON['stringify'](_0x4f812a));if(_0x4f812a[_0x90b0('0xf')]){if(_0x4f812a[_0x90b0('0xf')][_0x90b0('0x10')]===0x1f4){logger[_0x90b0('0xf')]('CmCustomField,\x20%s,\x20%s',_0xace59b,_0x4f812a[_0x90b0('0xf')]['message']);return _0x243a4a(_0x4f812a[_0x90b0('0xf')][_0x90b0('0x11')]);}logger[_0x90b0('0xf')]('CmCustomField,\x20%s,\x20%s',_0xace59b,_0x4f812a['error'][_0x90b0('0x11')]);return _0xecad52(_0x4f812a['error']['message']);}else{logger[_0x90b0('0xb')](_0x90b0('0xc'),_0xace59b,_0x90b0('0xd'));_0xecad52(_0x4f812a['result'][_0x90b0('0x11')]);}})[_0x90b0('0x12')](function(_0x54bd2d){logger['error'](_0x90b0('0xc'),_0xace59b,_0x54bd2d);_0x243a4a(_0x54bd2d);});});} \ No newline at end of file +var _0xb4be=['message','catch','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','CmCustomField,\x20%s,\x20%s','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x59d89e,_0x55edf5){var _0x554e93=function(_0x3d40bc){while(--_0x3d40bc){_0x59d89e['push'](_0x59d89e['shift']());}};_0x554e93(++_0x55edf5);}(_0xb4be,0x167));var _0xeb4b=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0xb4be[_0x5d6456];return _0x4d66c1;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xeb4b('0x0'));var rs=require(_0xeb4b('0x1'));var fs=require('fs');var Redis=require(_0xeb4b('0x2'));var db=require(_0xeb4b('0x3'))['db'];var utils=require(_0xeb4b('0x4'));var logger=require(_0xeb4b('0x5'))('rpc');var config=require(_0xeb4b('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xeb4b('0x7')][_0xeb4b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4be58a,_0x2f85c3,_0x566147){return new BPromise(function(_0x2b5e4f,_0x2cf1ca){return client[_0xeb4b('0x9')](_0x4be58a,_0x566147)[_0xeb4b('0xa')](function(_0x3460e2){logger[_0xeb4b('0xb')](_0xeb4b('0xc'),_0x2f85c3,_0xeb4b('0xd'));logger[_0xeb4b('0xe')](_0xeb4b('0xf'),_0x2f85c3,_0xeb4b('0xd'),JSON[_0xeb4b('0x10')](_0x3460e2));if(_0x3460e2[_0xeb4b('0x11')]){if(_0x3460e2['error'][_0xeb4b('0x12')]===0x1f4){logger['error'](_0xeb4b('0xc'),_0x2f85c3,_0x3460e2[_0xeb4b('0x11')][_0xeb4b('0x13')]);return _0x2cf1ca(_0x3460e2[_0xeb4b('0x11')][_0xeb4b('0x13')]);}logger[_0xeb4b('0x11')](_0xeb4b('0xc'),_0x2f85c3,_0x3460e2[_0xeb4b('0x11')][_0xeb4b('0x13')]);return _0x2b5e4f(_0x3460e2[_0xeb4b('0x11')]['message']);}else{logger[_0xeb4b('0xb')]('CmCustomField,\x20%s,\x20%s',_0x2f85c3,_0xeb4b('0xd'));_0x2b5e4f(_0x3460e2['result']['message']);}})[_0xeb4b('0x14')](function(_0x2ee030){logger['error'](_0xeb4b('0xc'),_0x2f85c3,_0x2ee030);_0x2cf1ca(_0x2ee030);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index fe37587..3e1d275 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 _0x5d66=['multer','util','path','connect-timeout','Router','fs-extra','../../config/environment','./cmCustomField.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy'];(function(_0x46a047,_0x1a392b){var _0x49f4a7=function(_0xac9d90){while(--_0xac9d90){_0x46a047['push'](_0x46a047['shift']());}};_0x49f4a7(++_0x1a392b);}(_0x5d66,0x130));var _0x65d6=function(_0x4c5411,_0xe9eea1){_0x4c5411=_0x4c5411-0x0;var _0x5d5de0=_0x5d66[_0x4c5411];return _0x5d5de0;};'use strict';var multer=require(_0x65d6('0x0'));var util=require(_0x65d6('0x1'));var path=require(_0x65d6('0x2'));var timeout=require(_0x65d6('0x3'));var express=require('express');var router=express[_0x65d6('0x4')]();var fs_extra=require(_0x65d6('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x65d6('0x6'));var controller=require(_0x65d6('0x7'));router[_0x65d6('0x8')]('/',auth[_0x65d6('0x9')](),controller[_0x65d6('0xa')]);router[_0x65d6('0x8')](_0x65d6('0xb'),auth['isAuthenticated'](),controller[_0x65d6('0xc')]);router[_0x65d6('0xd')]('/',auth[_0x65d6('0x9')](),controller[_0x65d6('0xe')]);router[_0x65d6('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x65d6('0x10')]);router[_0x65d6('0x11')]('/:id',auth[_0x65d6('0x9')](),controller[_0x65d6('0x12')]);module['exports']=router; \ No newline at end of file +var _0x9dc0=['/:id','update','destroy','exports','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','create'];(function(_0x487b0c,_0x1b43d0){var _0x4d5417=function(_0x10bfbf){while(--_0x10bfbf){_0x487b0c['push'](_0x487b0c['shift']());}};_0x4d5417(++_0x1b43d0);}(_0x9dc0,0xd6));var _0x09dc=function(_0xea35d1,_0x302471){_0xea35d1=_0xea35d1-0x0;var _0x1d7a7c=_0x9dc0[_0xea35d1];return _0x1d7a7c;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x09dc('0x0'));var timeout=require('connect-timeout');var express=require(_0x09dc('0x1'));var router=express[_0x09dc('0x2')]();var fs_extra=require(_0x09dc('0x3'));var auth=require(_0x09dc('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x09dc('0x5'));var controller=require('./cmCustomField.controller');router[_0x09dc('0x6')]('/',auth[_0x09dc('0x7')](),controller[_0x09dc('0x8')]);router[_0x09dc('0x6')]('/:id',auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x09dc('0x7')](),controller[_0x09dc('0x9')]);router['put'](_0x09dc('0xa'),auth[_0x09dc('0x7')](),controller[_0x09dc('0xb')]);router['delete'](_0x09dc('0xa'),auth[_0x09dc('0x7')](),controller[_0x09dc('0xc')]);module[_0x09dc('0xd')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index 6f3ac1d..10aac8b 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 _0x6746=['BOOLEAN','DATE','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','UNSIGNED','contactListQueue','exports','STRING'];(function(_0x8de54f,_0x271987){var _0x14cba4=function(_0x58ed41){while(--_0x58ed41){_0x8de54f['push'](_0x8de54f['shift']());}};_0x14cba4(++_0x271987);}(_0x6746,0x127));var _0x6674=function(_0x257017,_0x330627){_0x257017=_0x257017-0x0;var _0x38536d=_0x6746[_0x257017];return _0x38536d;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x6674('0x0')]={'phone':{'type':Sequelize[_0x6674('0x1')],'allowNull':![]},'active':{'type':Sequelize[_0x6674('0x2')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x6674('0x3')],'defaultValue':moment()[_0x6674('0x4')](_0x6674('0x5'))},'countbusyretry':{'type':Sequelize[_0x6674('0x6')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x6674('0x6')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x6674('0x6')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x6674('0x2')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'priority':{'type':Sequelize[_0x6674('0x6')](0x2)[_0x6674('0x7')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x6674('0x6')],'unique':_0x6674('0x8')},'ListId':{'type':Sequelize[_0x6674('0x6')],'unique':_0x6674('0x8')},'UserId':{'type':Sequelize[_0x6674('0x6')]},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0x6674('0x8')},'CampaignId':{'type':Sequelize['INTEGER']},'countnosuchnumberretry':{'type':Sequelize[_0x6674('0x6')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x6674('0x6')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x6674('0x6')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x6674('0x6')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x6674('0x6')],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0x6674('0x6')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize['STRING']},'recallmeNotifiedDate':{'type':Sequelize[_0x6674('0x3')],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file +var _0xa22e=['contactListQueue','moment','sequelize','exports','STRING','BOOLEAN','DATE','INTEGER','UNSIGNED'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xa22e,0x157));var _0xea22=function(_0x5e36ec,_0x4f8297){_0x5e36ec=_0x5e36ec-0x0;var _0x33828b=_0xa22e[_0x5e36ec];return _0x33828b;};'use strict';var moment=require(_0xea22('0x0'));var Sequelize=require(_0xea22('0x1'));module[_0xea22('0x2')]={'phone':{'type':Sequelize[_0xea22('0x3')],'allowNull':![]},'active':{'type':Sequelize[_0xea22('0x4')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0xea22('0x5')],'defaultValue':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize[_0xea22('0x6')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xea22('0x6')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xea22('0x6')],'defaultValue':0x0},'callback':{'type':Sequelize[_0xea22('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xea22('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xea22('0x5')]},'priority':{'type':Sequelize[_0xea22('0x6')](0x2)[_0xea22('0x7')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':_0xea22('0x8')},'ListId':{'type':Sequelize[_0xea22('0x6')],'unique':_0xea22('0x8')},'UserId':{'type':Sequelize[_0xea22('0x6')]},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'},'CampaignId':{'type':Sequelize[_0xea22('0x6')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xea22('0x6')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xea22('0x6')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xea22('0x6')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xea22('0x6')],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0xea22('0x6')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xea22('0x3')]},'recallmeNotifiedDate':{'type':Sequelize[_0xea22('0x5')],'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 df07f74..751292d 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 _0x0309=['destroy','params','VoiceQueueId','CampaignId','Campaign','merge','omit','dataValues','createdAt','updatedAt','state','statedesc','deleted','campaign','membername','UserId','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','campaigntype','ivr','CmContact','ContactId','lastName','isNil','firstName','calleridname','finally','CmHopperFinal','end','getPreview','user','getVoiceQueues','dialPreviewAutoRecallMe','sequelize','transaction','value','direction','prev','hopperIds','priority','scheduledAt','dialOrderByScheduledAt','ASC','isEmpty','DESC','COALESCE(CmHopper.UserId,\x200)\x20DESC','scheduledat','LOCK','UPDATE','CmCompany','CmList','List','VoiceQueue','Queue','findOne','recallme','Company','dialActive','getOpenContacts','outbound','preview','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','timezones','push','utcOffset','getTimezone','moment','../../components/parsers/qs','api','../../config/environment','../../mysqldb','status','offset','limit','undefined','set','Content-Range','json','update','then','sendStatus','error','stack','name','send','index','map','CmHopper','rawAttributes','fieldName','type','key','query','filters','intersection','model','$and','$or','$gt','$lt','$lte','$ne','$eq','$not','$notBetween','$in','$notIn','$like','$notLike','$iLike','$notILike','$overlap','$contains','$contained','$any','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','options','count','include','findAll','rows','catch','show','keys','includeAll','find','create','body','describe'];(function(_0x7327c4,_0x374e31){var _0x2050a3=function(_0x5d5019){while(--_0x5d5019){_0x7327c4['push'](_0x7327c4['shift']());}};_0x2050a3(++_0x374e31);}(_0x0309,0x165));var _0x9030=function(_0xa5eecc,_0x44400e){_0xa5eecc=_0xa5eecc-0x0;var _0x35fc55=_0x0309[_0xa5eecc];return _0x35fc55;};'use strict';var moment=require(_0x9030('0x0'));var _=require('lodash');var qs=require(_0x9030('0x1'));var logger=require('../../config/logger')(_0x9030('0x2'));var shared=require(_0x9030('0x3'));var db=require(_0x9030('0x4'))['db'];function respondWithResult(_0x4236be,_0x29e331){_0x29e331=_0x29e331||0xc8;return function(_0x2e6276){if(_0x2e6276){return _0x4236be[_0x9030('0x5')](_0x29e331)['json'](_0x2e6276);}};}function respondWithFilteredResult(_0x5a3334,_0x1c9c7b){return function(_0x105c15){if(_0x105c15){var _0x4f2d84=typeof _0x1c9c7b[_0x9030('0x6')]==='undefined'&&typeof _0x1c9c7b[_0x9030('0x7')]===_0x9030('0x8');var _0x289add=_0x105c15['count'];var _0xe2c28b=_0x4f2d84?0x0:_0x1c9c7b[_0x9030('0x6')];var _0x337b86=_0x4f2d84?_0x105c15['count']:_0x1c9c7b[_0x9030('0x6')]+_0x1c9c7b[_0x9030('0x7')];var _0x24d0f4;if(_0x337b86>=_0x289add){_0x337b86=_0x289add;_0x24d0f4=0xc8;}else{_0x24d0f4=0xce;}_0x5a3334[_0x9030('0x5')](_0x24d0f4);return _0x5a3334[_0x9030('0x9')](_0x9030('0xa'),_0xe2c28b+'-'+_0x337b86+'/'+_0x289add)[_0x9030('0xb')](_0x105c15);}return null;};}function saveUpdates(_0x5ee60f,_0x45e28a){return function(_0x3274c9){if(_0x3274c9){return _0x3274c9[_0x9030('0xc')](_0x5ee60f)[_0x9030('0xd')](function(_0x4e1858){return _0x4e1858;});}return null;};}function handleEntityNotFound(_0x28a505,_0x2dc875){return function(_0x4a7465){if(!_0x4a7465){_0x28a505[_0x9030('0xe')](0x194);}return _0x4a7465;};}function handleError(_0x4d697a,_0x1615ab){_0x1615ab=_0x1615ab||0x1f4;return function(_0x111f3b){logger[_0x9030('0xf')](_0x111f3b[_0x9030('0x10')]);if(_0x111f3b['name']){delete _0x111f3b[_0x9030('0x11')];}_0x4d697a[_0x9030('0x5')](_0x1615ab)[_0x9030('0x12')](_0x111f3b);};}exports[_0x9030('0x13')]=function(_0x319db3,_0x1327ec){var _0x229dcd={},_0x28c035={},_0x1f5474={'count':0x0,'rows':[]};var _0x31e196=_[_0x9030('0x14')](db[_0x9030('0x15')][_0x9030('0x16')],function(_0x243e7d){return{'name':_0x243e7d[_0x9030('0x17')],'type':_0x243e7d[_0x9030('0x18')][_0x9030('0x19')]};});_0x28c035['model']=_['map'](_0x31e196,_0x9030('0x11'));_0x28c035[_0x9030('0x1a')]=_['keys'](_0x319db3[_0x9030('0x1a')]);_0x28c035[_0x9030('0x1b')]=_[_0x9030('0x1c')](_0x28c035[_0x9030('0x1d')],_0x28c035['query']);_0x28c035[_0x9030('0x1b')]=_['concat'](_0x28c035['filters'],[_0x9030('0x1e'),_0x9030('0x1f'),_0x9030('0x20'),'$gte',_0x9030('0x21'),_0x9030('0x22'),_0x9030('0x23'),_0x9030('0x24'),_0x9030('0x25'),'$between',_0x9030('0x26'),_0x9030('0x27'),_0x9030('0x28'),_0x9030('0x29'),_0x9030('0x2a'),_0x9030('0x2b'),_0x9030('0x2c'),_0x9030('0x29'),_0x9030('0x2d'),_0x9030('0x2e'),_0x9030('0x2f'),_0x9030('0x30')]);_0x229dcd[_0x9030('0x31')]=_[_0x9030('0x1c')](_0x28c035['model'],qs[_0x9030('0x32')](_0x319db3['query'][_0x9030('0x32')]));_0x229dcd['attributes']=_0x229dcd[_0x9030('0x31')][_0x9030('0x33')]?_0x229dcd[_0x9030('0x31')]:_0x28c035['model'];if(!_0x319db3[_0x9030('0x1a')][_0x9030('0x34')](_0x9030('0x35'))){_0x229dcd[_0x9030('0x7')]=qs[_0x9030('0x7')](_0x319db3[_0x9030('0x1a')][_0x9030('0x7')]);_0x229dcd[_0x9030('0x6')]=qs[_0x9030('0x6')](_0x319db3[_0x9030('0x1a')][_0x9030('0x6')]);}_0x229dcd[_0x9030('0x36')]=qs[_0x9030('0x37')](_0x319db3[_0x9030('0x1a')][_0x9030('0x37')]);_0x229dcd[_0x9030('0x38')]=qs[_0x9030('0x1b')](_[_0x9030('0x39')](_0x319db3['query'],_0x28c035['filters']),_0x31e196);if(_0x319db3[_0x9030('0x1a')][_0x9030('0x3a')]){_0x229dcd['where']=_['merge'](_0x229dcd[_0x9030('0x38')],{'$or':_[_0x9030('0x14')](_0x31e196,function(_0x411077){if(_0x411077[_0x9030('0x18')]!=='VIRTUAL'){var _0xc8123e={};_0xc8123e[_0x411077['name']]={'$like':'%'+_0x319db3[_0x9030('0x1a')][_0x9030('0x3a')]+'%'};return _0xc8123e;}})});}_0x229dcd=_['merge']({},_0x229dcd,_0x319db3[_0x9030('0x3b')]);var _0x19c515={'where':_0x229dcd[_0x9030('0x38')]};return db['CmHopper'][_0x9030('0x3c')](_0x19c515)['then'](function(_0x438828){_0x1f5474['count']=_0x438828;if(_0x319db3[_0x9030('0x1a')]['includeAll']){_0x229dcd[_0x9030('0x3d')]=[{'all':!![]}];}return db[_0x9030('0x15')][_0x9030('0x3e')](_0x229dcd);})[_0x9030('0xd')](function(_0x214f66){_0x1f5474[_0x9030('0x3f')]=_0x214f66;return _0x1f5474;})[_0x9030('0xd')](respondWithFilteredResult(_0x1327ec,_0x229dcd))[_0x9030('0x40')](handleError(_0x1327ec,null));};exports[_0x9030('0x41')]=function(_0x5bd1fb,_0x200ec1){var _0x209aca={'raw':!![],'where':{'id':_0x5bd1fb['params']['id']}},_0x1c8e83={};_0x1c8e83[_0x9030('0x1d')]=_[_0x9030('0x42')](db[_0x9030('0x15')][_0x9030('0x16')]);_0x1c8e83['query']=_[_0x9030('0x42')](_0x5bd1fb[_0x9030('0x1a')]);_0x1c8e83[_0x9030('0x1b')]=_['intersection'](_0x1c8e83[_0x9030('0x1d')],_0x1c8e83[_0x9030('0x1a')]);_0x209aca[_0x9030('0x31')]=_[_0x9030('0x1c')](_0x1c8e83[_0x9030('0x1d')],qs['fields'](_0x5bd1fb[_0x9030('0x1a')]['fields']));_0x209aca[_0x9030('0x31')]=_0x209aca[_0x9030('0x31')][_0x9030('0x33')]?_0x209aca[_0x9030('0x31')]:_0x1c8e83[_0x9030('0x1d')];if(_0x5bd1fb[_0x9030('0x1a')][_0x9030('0x43')]){_0x209aca[_0x9030('0x3d')]=[{'all':!![]}];}_0x209aca=_['merge']({},_0x209aca,_0x5bd1fb[_0x9030('0x3b')]);return db[_0x9030('0x15')][_0x9030('0x44')](_0x209aca)[_0x9030('0xd')](handleEntityNotFound(_0x200ec1,null))[_0x9030('0xd')](respondWithResult(_0x200ec1,null))[_0x9030('0x40')](handleError(_0x200ec1,null));};exports[_0x9030('0x45')]=function(_0x1dc8e6,_0x141f97){return db[_0x9030('0x15')][_0x9030('0x45')](_0x1dc8e6[_0x9030('0x46')],{})[_0x9030('0xd')](respondWithResult(_0x141f97,0xc9))[_0x9030('0x40')](handleError(_0x141f97,null));};exports['update']=function(_0x4725e5,_0x2e0283){if(_0x4725e5['body']['id']){delete _0x4725e5[_0x9030('0x46')]['id'];}return db[_0x9030('0x15')][_0x9030('0x44')]({'where':{'id':_0x4725e5['params']['id']}})['then'](handleEntityNotFound(_0x2e0283,null))[_0x9030('0xd')](saveUpdates(_0x4725e5['body'],null))['then'](respondWithResult(_0x2e0283,null))[_0x9030('0x40')](handleError(_0x2e0283,null));};exports[_0x9030('0x47')]=function(_0x2b3e41,_0x1d9b7e){return db['CmHopper'][_0x9030('0x47')]()['then'](respondWithResult(_0x1d9b7e,null))[_0x9030('0x40')](handleError(_0x1d9b7e,null));};exports[_0x9030('0x48')]=function(_0x42c414,_0x513ee4){var _0x119c2d;var _0xf54697=_0x42c414[_0x9030('0x49')]['id'];return db['CmHopper'][_0x9030('0x44')]({'where':{'id':_0x42c414[_0x9030('0x49')]['id']}})['then'](handleEntityNotFound(_0x513ee4,null))[_0x9030('0xd')](function(_0x4efbfc){if(_0x4efbfc){return _0x4efbfc[_0x9030('0x48')]()['then'](function(_0x2a39ad){return _0x2a39ad;});}})[_0x9030('0xd')](function(_0xce1911){_0x119c2d=_0xce1911;if(_0xce1911){if(_0xce1911[_0x9030('0x4a')]||_0xce1911[_0x9030('0x4b')]){return db[_0xce1911[_0x9030('0x4a')]?'VoiceQueue':_0x9030('0x4c')][_0x9030('0x44')]({'where':{'id':_0xce1911[_0x9030('0x4a')]?_0xce1911[_0x9030('0x4a')]:_0xce1911[_0x9030('0x4b')]},'attributes':['id','name'],'raw':!![]});}}})['then'](function(_0xefbcf4){var _0x16c8f6={};if(_0xefbcf4){_[_0x9030('0x4d')](_0x16c8f6,_[_0x9030('0x4e')](_0x119c2d[_0x9030('0x4f')],[_0x9030('0x50'),_0x9030('0x51'),'id']));_0x16c8f6[_0x9030('0x52')]=0x15;_0x16c8f6[_0x9030('0x53')]=_0x9030('0x54');_0x16c8f6[_0x9030('0x55')]=_0xefbcf4[_0x9030('0x11')];_0x16c8f6[_0x9030('0x56')]=_0x42c414['user'][_0x9030('0x11')];_0x16c8f6[_0x9030('0x57')]=_0x42c414['user']['id'];_0x16c8f6['deleted']=!![];_0x16c8f6[_0x9030('0x58')]=moment()[_0x9030('0x59')](_0x9030('0x5a'));_0x16c8f6[_0x9030('0x5b')]=_0x119c2d[_0x9030('0x5c')];_0x16c8f6[_0x9030('0x5d')]=_0x119c2d['VoiceQueueId']?'queue':_0x9030('0x5e');return db[_0x9030('0x5f')][_0x9030('0x44')]({'where':{'id':_0x16c8f6[_0x9030('0x60')]},'attributes':['firstName',_0x9030('0x61')]})[_0x9030('0xd')](function(_0x1ca30b){if(!_[_0x9030('0x62')](_0x513ee4)&&!_[_0x9030('0x62')](_0x1ca30b['firstName'])){_0x16c8f6['calleridname']=_0x1ca30b[_0x9030('0x63')];if(!_[_0x9030('0x62')](_0x1ca30b[_0x9030('0x61')])){_0x16c8f6[_0x9030('0x64')]+='\x20'+_0x1ca30b[_0x9030('0x61')];}}})[_0x9030('0x65')](function(){return db[_0x9030('0x66')][_0x9030('0x45')](_0x16c8f6);});}})[_0x9030('0xd')](function(_0x11f117){return db['CmHopperAdditionalPhone'][_0x9030('0x48')]({'where':{'CmHopperId':_0xf54697}});})[_0x9030('0xd')](function(){return _0x513ee4[_0x9030('0x5')](0xcc)[_0x9030('0x67')]();})[_0x9030('0x40')](handleError(_0x513ee4,null));};exports[_0x9030('0x68')]=function(_0x3012b9,_0x481e34){var _0x498f7c=[];return db[_0x9030('0x5f')][_0x9030('0x47')]()[_0x9030('0xd')](function(_0x44442f){_0x498f7c=_[_0x9030('0x42')](_0x44442f);return _0x3012b9[_0x9030('0x69')][_0x9030('0x6a')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':'preview'},'attributes':['id','dialOrderByScheduledAt',_0x9030('0x6b')],'raw':!![]});})['then'](function(_0x1cd8f5){if(_0x1cd8f5&&_0x1cd8f5['length']){return db[_0x9030('0x6c')][_0x9030('0x6d')](function(_0x303de3){var _0xb4b84e={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x9030('0x59')](_0x9030('0x5a'))},'VoiceQueueId':{'$in':_[_0x9030('0x14')](_0x1cd8f5,'id')},'$or':[{'UserId':null},{'UserId':_0x3012b9[_0x9030('0x69')]['id']}]};var _0x1a6b62={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x1cd8f5)[_0x9030('0x3a')]([_0x9030('0x6b'),0x0])[_0x9030('0x14')]('id')[_0x9030('0x6e')]()},'$or':[{'UserId':null},{'UserId':_0x3012b9[_0x9030('0x69')]['id']}]};var _0x49bad8={'$or':[_0xb4b84e,_0x1a6b62]};var _0x119835=[];if(_0x3012b9[_0x9030('0x46')][_0x9030('0x6f')]&&_0x3012b9[_0x9030('0x46')][_0x9030('0x6f')]===_0x9030('0x70')){if(!_['isEmpty'](_0x3012b9[_0x9030('0x46')][_0x9030('0x71')])){_0x49bad8['id']={'$in':_0x3012b9[_0x9030('0x46')][_0x9030('0x71')]};}_0x119835=[[_0x9030('0x72'),'ASC'],[_0x9030('0x73'),_0x1cd8f5[0x0][_0x9030('0x74')]===_0x9030('0x75')?'DESC':_0x9030('0x75')],db[_0x9030('0x6c')]['literal']('COALESCE(CmHopper.UserId,\x200)\x20ASC'),['id','DESC']];}else{if(!_[_0x9030('0x76')](_0x3012b9[_0x9030('0x46')][_0x9030('0x71')])){_0x49bad8['id']={'$notIn':_0x3012b9[_0x9030('0x46')][_0x9030('0x71')]};}_0x119835=[['priority',_0x9030('0x77')],[_0x9030('0x73'),_0x1cd8f5[0x0][_0x9030('0x74')]],db[_0x9030('0x6c')]['literal'](_0x9030('0x78')),['id',_0x9030('0x75')]];}return db[_0x9030('0x15')]['findOne']({'attributes':['id',_0x9030('0x79'),_0x9030('0x5c'),'recallme'],'where':_0x49bad8,'order':_0x119835,'transaction':_0x303de3,'lock':_0x303de3[_0x9030('0x7a')][_0x9030('0x7b')],'include':[{'model':db[_0x9030('0x5f')],'as':'Contact','attributes':_0x498f7c,'include':[{'model':db[_0x9030('0x7c')],'as':'Company','attributes':['id',_0x9030('0x11')]}]},{'model':db[_0x9030('0x7d')],'as':_0x9030('0x7e'),'attributes':['id',_0x9030('0x11')]},{'model':db[_0x9030('0x7f')],'as':_0x9030('0x80'),'attributes':['id',_0x9030('0x11'),'dialActive']}]})[_0x9030('0xd')](function(_0x51b73f){if(_0x51b73f){return _0x51b73f[_0x9030('0xc')]({'UserId':_0x3012b9[_0x9030('0x69')]['id']},{'transaction':_0x303de3});}});});}})[_0x9030('0xd')](handleEntityNotFound(_0x481e34,null))[_0x9030('0xd')](respondWithResult(_0x481e34,null))[_0x9030('0x40')](handleError(_0x481e34,null));};exports['getPreviewRecall']=function(_0x53e328,_0x563ead,_0x2148e5){var _0x1c7080=[];var _0x3c0b37=_0x53e328['params']['id'];var _0x1d4058=_0x53e328[_0x9030('0x69')]['id'];return db[_0x9030('0x5f')]['describe']()[_0x9030('0xd')](function(_0x3245ee){_0x1c7080=_[_0x9030('0x42')](_0x3245ee);return db[_0x9030('0x6c')][_0x9030('0x6d')](function(_0x588042){const _0x2f30b3={'id':_0x3c0b37};return db[_0x9030('0x15')][_0x9030('0x81')]({'attributes':['id','scheduledat',_0x9030('0x82')],'where':_0x2f30b3,'transaction':_0x588042,'lock':_0x588042[_0x9030('0x7a')][_0x9030('0x7b')],'include':[{'model':db[_0x9030('0x5f')],'as':'Contact','attributes':_0x1c7080,'include':[{'model':db['CmCompany'],'as':_0x9030('0x83'),'attributes':['id',_0x9030('0x11')]}]},{'model':db[_0x9030('0x7d')],'as':_0x9030('0x7e'),'attributes':['id',_0x9030('0x11')]},{'model':db['VoiceQueue'],'as':_0x9030('0x80'),'attributes':['id',_0x9030('0x11'),_0x9030('0x84')]}]})[_0x9030('0xd')](function(_0x2d3aaf){if(_0x2d3aaf){return _0x2d3aaf['update']({'UserId':_0x1d4058},{'transaction':_0x588042});}});});})[_0x9030('0xd')](handleEntityNotFound(_0x563ead,null))['then'](respondWithResult(_0x563ead,null))[_0x9030('0x40')](handleError(_0x563ead,null));};exports[_0x9030('0x85')]=function(_0x351265,_0x5b4d17){return _0x351265['user'][_0x9030('0x6a')]({'where':{'type':_0x9030('0x86'),'dialActive':!![],'dialMethod':_0x9030('0x87')},'attributes':['id'],'raw':!![]})[_0x9030('0xd')](function(_0x43c2d8){if(_0x43c2d8&&_0x43c2d8[_0x9030('0x33')]){return db[_0x9030('0x15')]['count']({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x9030('0x59')](_0x9030('0x5a'))},'VoiceQueueId':{'$in':_['map'](_0x43c2d8,'id')},'$or':[{'UserId':null},{'UserId':_0x351265[_0x9030('0x69')]['id']}]}});}return 0x0;})[_0x9030('0xd')](function(_0x1a3fa3){if(!_[_0x9030('0x62')](_0x1a3fa3)&&_[_0x9030('0x88')](_0x1a3fa3)){return _0x5b4d17[_0x9030('0x5')](0xc8)[_0x9030('0xb')]({'contacts':_0x1a3fa3});}else{logger[_0x9030('0xf')](_0x9030('0x89'),'getOpenContacts',0x194,_0x9030('0x8a'));_0x5b4d17['sendStatus'](0x194);}})['catch'](handleError(_0x5b4d17,null));};exports['getTimezones']=function(_0x39414f,_0x1f9479){var _0x405e24=shared[_0x9030('0x8b')];var _0x958bf3=[];_[_0x9030('0x14')](_0x405e24,function(_0x55d575){_0x958bf3[_0x9030('0x8c')]({'id':_0x55d575[_0x9030('0x11')],'name':_0x55d575[_0x9030('0x11')],'utcOffset':_0x55d575[_0x9030('0x8d')]});});return _0x1f9479[_0x9030('0x5')](0xc8)[_0x9030('0xb')]({'tz':_0x958bf3});};exports[_0x9030('0x8e')]=function(_0x39e215,_0x208a8d){var _0x14528a=shared[_0x9030('0x8b')];var _0x1fad1b={};if(!_[_0x9030('0x62')](_0x14528a[_0x39e215['body']['id']]))_0x1fad1b=_0x14528a[_0x39e215['body']['id']];return _0x208a8d[_0x9030('0x5')](0xc8)[_0x9030('0xb')](_0x1fad1b);}; \ No newline at end of file +var _0xa7e6=['fieldName','type','key','model','map','query','keys','filters','intersection','concat','$and','$gt','$gte','$lte','$ne','$eq','$not','$between','$notBetween','$notIn','$like','$notLike','$iLike','$notILike','$contains','$contained','$any','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','includeAll','findAll','rows','catch','show','params','merge','options','find','create','body','describe','destroy','VoiceQueueId','VoiceQueue','Campaign','name','dataValues','createdAt','state','statedesc','deleted','campaign','membername','user','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','phone','campaigntype','queue','ivr','ContactId','firstName','lastName','isNil','calleridname','finally','CmHopperFinal','CmHopperAdditionalPhone','CmContact','getVoiceQueues','outbound','preview','dialOrderByScheduledAt','dialPreviewAutoRecallMe','value','hopperIds','priority','ASC','scheduledAt','DESC','literal','sequelize','COALESCE(CmHopper.UserId,\x200)\x20DESC','scheduledat','recallme','LOCK','UPDATE','Contact','CmCompany','Company','Queue','dialActive','getPreviewRecall','transaction','findOne','CmList','getOpenContacts','isNumber','error','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','getTimezones','push','utcOffset','getTimezone','timezones','moment','lodash','../../components/parsers/qs','../../config/logger','api','../../config/environment','status','json','offset','undefined','limit','count','set','update','then','sendStatus','stack','index','CmHopper','rawAttributes'];(function(_0x6ae58a,_0x5a2f34){var _0x2c757c=function(_0x34cb41){while(--_0x34cb41){_0x6ae58a['push'](_0x6ae58a['shift']());}};_0x2c757c(++_0x5a2f34);}(_0xa7e6,0x74));var _0x6a7e=function(_0x4e324f,_0x4f0cfc){_0x4e324f=_0x4e324f-0x0;var _0x4e6076=_0xa7e6[_0x4e324f];return _0x4e6076;};'use strict';var moment=require(_0x6a7e('0x0'));var _=require(_0x6a7e('0x1'));var qs=require(_0x6a7e('0x2'));var logger=require(_0x6a7e('0x3'))(_0x6a7e('0x4'));var shared=require(_0x6a7e('0x5'));var db=require('../../mysqldb')['db'];function respondWithResult(_0x3ccca2,_0x8787b5){_0x8787b5=_0x8787b5||0xc8;return function(_0x1ea310){if(_0x1ea310){return _0x3ccca2[_0x6a7e('0x6')](_0x8787b5)[_0x6a7e('0x7')](_0x1ea310);}};}function respondWithFilteredResult(_0x599006,_0x79df6f){return function(_0x16249d){if(_0x16249d){var _0x37165d=typeof _0x79df6f[_0x6a7e('0x8')]===_0x6a7e('0x9')&&typeof _0x79df6f[_0x6a7e('0xa')]===_0x6a7e('0x9');var _0x403962=_0x16249d[_0x6a7e('0xb')];var _0x5f4ff2=_0x37165d?0x0:_0x79df6f['offset'];var _0x557627=_0x37165d?_0x16249d['count']:_0x79df6f[_0x6a7e('0x8')]+_0x79df6f[_0x6a7e('0xa')];var _0x292822;if(_0x557627>=_0x403962){_0x557627=_0x403962;_0x292822=0xc8;}else{_0x292822=0xce;}_0x599006[_0x6a7e('0x6')](_0x292822);return _0x599006[_0x6a7e('0xc')]('Content-Range',_0x5f4ff2+'-'+_0x557627+'/'+_0x403962)[_0x6a7e('0x7')](_0x16249d);}return null;};}function saveUpdates(_0x4754ef,_0x5c0c74){return function(_0x50dcc1){if(_0x50dcc1){return _0x50dcc1[_0x6a7e('0xd')](_0x4754ef)[_0x6a7e('0xe')](function(_0x1ac6da){return _0x1ac6da;});}return null;};}function handleEntityNotFound(_0x374763,_0x4faca9){return function(_0x3137bc){if(!_0x3137bc){_0x374763[_0x6a7e('0xf')](0x194);}return _0x3137bc;};}function handleError(_0x306b83,_0x4576fe){_0x4576fe=_0x4576fe||0x1f4;return function(_0x465566){logger['error'](_0x465566[_0x6a7e('0x10')]);if(_0x465566['name']){delete _0x465566['name'];}_0x306b83[_0x6a7e('0x6')](_0x4576fe)['send'](_0x465566);};}exports[_0x6a7e('0x11')]=function(_0x195761,_0x470197){var _0x470d49={},_0x20e90a={},_0x53abe9={'count':0x0,'rows':[]};var _0x4c3763=_['map'](db[_0x6a7e('0x12')][_0x6a7e('0x13')],function(_0x327565){return{'name':_0x327565[_0x6a7e('0x14')],'type':_0x327565[_0x6a7e('0x15')][_0x6a7e('0x16')]};});_0x20e90a[_0x6a7e('0x17')]=_[_0x6a7e('0x18')](_0x4c3763,'name');_0x20e90a[_0x6a7e('0x19')]=_[_0x6a7e('0x1a')](_0x195761['query']);_0x20e90a[_0x6a7e('0x1b')]=_[_0x6a7e('0x1c')](_0x20e90a[_0x6a7e('0x17')],_0x20e90a['query']);_0x20e90a[_0x6a7e('0x1b')]=_[_0x6a7e('0x1d')](_0x20e90a['filters'],[_0x6a7e('0x1e'),'$or',_0x6a7e('0x1f'),_0x6a7e('0x20'),'$lt',_0x6a7e('0x21'),_0x6a7e('0x22'),_0x6a7e('0x23'),_0x6a7e('0x24'),_0x6a7e('0x25'),_0x6a7e('0x26'),'$in',_0x6a7e('0x27'),_0x6a7e('0x28'),_0x6a7e('0x29'),_0x6a7e('0x2a'),_0x6a7e('0x2b'),'$like','$overlap',_0x6a7e('0x2c'),_0x6a7e('0x2d'),_0x6a7e('0x2e')]);_0x470d49['attributes']=_[_0x6a7e('0x1c')](_0x20e90a['model'],qs[_0x6a7e('0x2f')](_0x195761['query']['fields']));_0x470d49[_0x6a7e('0x30')]=_0x470d49['attributes'][_0x6a7e('0x31')]?_0x470d49['attributes']:_0x20e90a['model'];if(!_0x195761[_0x6a7e('0x19')][_0x6a7e('0x32')](_0x6a7e('0x33'))){_0x470d49[_0x6a7e('0xa')]=qs[_0x6a7e('0xa')](_0x195761[_0x6a7e('0x19')][_0x6a7e('0xa')]);_0x470d49[_0x6a7e('0x8')]=qs[_0x6a7e('0x8')](_0x195761[_0x6a7e('0x19')][_0x6a7e('0x8')]);}_0x470d49[_0x6a7e('0x34')]=qs['sort'](_0x195761[_0x6a7e('0x19')][_0x6a7e('0x35')]);_0x470d49[_0x6a7e('0x36')]=qs['filters'](_[_0x6a7e('0x37')](_0x195761[_0x6a7e('0x19')],_0x20e90a[_0x6a7e('0x1b')]),_0x4c3763);if(_0x195761[_0x6a7e('0x19')][_0x6a7e('0x38')]){_0x470d49[_0x6a7e('0x36')]=_['merge'](_0x470d49['where'],{'$or':_[_0x6a7e('0x18')](_0x4c3763,function(_0x5d3789){if(_0x5d3789[_0x6a7e('0x15')]!==_0x6a7e('0x39')){var _0x5e30cd={};_0x5e30cd[_0x5d3789['name']]={'$like':'%'+_0x195761['query'][_0x6a7e('0x38')]+'%'};return _0x5e30cd;}})});}_0x470d49=_['merge']({},_0x470d49,_0x195761['options']);var _0x512430={'where':_0x470d49['where']};return db[_0x6a7e('0x12')]['count'](_0x512430)[_0x6a7e('0xe')](function(_0x39d544){_0x53abe9[_0x6a7e('0xb')]=_0x39d544;if(_0x195761[_0x6a7e('0x19')][_0x6a7e('0x3a')]){_0x470d49['include']=[{'all':!![]}];}return db[_0x6a7e('0x12')][_0x6a7e('0x3b')](_0x470d49);})['then'](function(_0x3d146f){_0x53abe9[_0x6a7e('0x3c')]=_0x3d146f;return _0x53abe9;})['then'](respondWithFilteredResult(_0x470197,_0x470d49))[_0x6a7e('0x3d')](handleError(_0x470197,null));};exports[_0x6a7e('0x3e')]=function(_0x34b0ef,_0x920c54){var _0x2827f7={'raw':!![],'where':{'id':_0x34b0ef[_0x6a7e('0x3f')]['id']}},_0x28a62e={};_0x28a62e[_0x6a7e('0x17')]=_[_0x6a7e('0x1a')](db[_0x6a7e('0x12')][_0x6a7e('0x13')]);_0x28a62e['query']=_['keys'](_0x34b0ef[_0x6a7e('0x19')]);_0x28a62e[_0x6a7e('0x1b')]=_['intersection'](_0x28a62e[_0x6a7e('0x17')],_0x28a62e[_0x6a7e('0x19')]);_0x2827f7[_0x6a7e('0x30')]=_[_0x6a7e('0x1c')](_0x28a62e[_0x6a7e('0x17')],qs[_0x6a7e('0x2f')](_0x34b0ef[_0x6a7e('0x19')][_0x6a7e('0x2f')]));_0x2827f7[_0x6a7e('0x30')]=_0x2827f7[_0x6a7e('0x30')][_0x6a7e('0x31')]?_0x2827f7[_0x6a7e('0x30')]:_0x28a62e[_0x6a7e('0x17')];if(_0x34b0ef[_0x6a7e('0x19')]['includeAll']){_0x2827f7['include']=[{'all':!![]}];}_0x2827f7=_[_0x6a7e('0x40')]({},_0x2827f7,_0x34b0ef[_0x6a7e('0x41')]);return db[_0x6a7e('0x12')][_0x6a7e('0x42')](_0x2827f7)[_0x6a7e('0xe')](handleEntityNotFound(_0x920c54,null))[_0x6a7e('0xe')](respondWithResult(_0x920c54,null))[_0x6a7e('0x3d')](handleError(_0x920c54,null));};exports[_0x6a7e('0x43')]=function(_0x5cdd48,_0x380e24){return db['CmHopper'][_0x6a7e('0x43')](_0x5cdd48[_0x6a7e('0x44')],{})[_0x6a7e('0xe')](respondWithResult(_0x380e24,0xc9))[_0x6a7e('0x3d')](handleError(_0x380e24,null));};exports['update']=function(_0x248189,_0xc7f6b9){if(_0x248189[_0x6a7e('0x44')]['id']){delete _0x248189['body']['id'];}return db[_0x6a7e('0x12')]['find']({'where':{'id':_0x248189[_0x6a7e('0x3f')]['id']}})[_0x6a7e('0xe')](handleEntityNotFound(_0xc7f6b9,null))[_0x6a7e('0xe')](saveUpdates(_0x248189[_0x6a7e('0x44')],null))['then'](respondWithResult(_0xc7f6b9,null))[_0x6a7e('0x3d')](handleError(_0xc7f6b9,null));};exports[_0x6a7e('0x45')]=function(_0x188ab5,_0x3991bc){return db['CmHopper'][_0x6a7e('0x45')]()['then'](respondWithResult(_0x3991bc,null))[_0x6a7e('0x3d')](handleError(_0x3991bc,null));};exports[_0x6a7e('0x46')]=function(_0x25c2bb,_0x4a7465){var _0xd3252d;var _0x58f58b=_0x25c2bb[_0x6a7e('0x3f')]['id'];return db['CmHopper'][_0x6a7e('0x42')]({'where':{'id':_0x25c2bb[_0x6a7e('0x3f')]['id']}})[_0x6a7e('0xe')](handleEntityNotFound(_0x4a7465,null))[_0x6a7e('0xe')](function(_0x2f2874){if(_0x2f2874){return _0x2f2874[_0x6a7e('0x46')]()['then'](function(_0x3d4395){return _0x3d4395;});}})[_0x6a7e('0xe')](function(_0x27c1e9){_0xd3252d=_0x27c1e9;if(_0x27c1e9){if(_0x27c1e9[_0x6a7e('0x47')]||_0x27c1e9['CampaignId']){return db[_0x27c1e9['VoiceQueueId']?_0x6a7e('0x48'):_0x6a7e('0x49')][_0x6a7e('0x42')]({'where':{'id':_0x27c1e9[_0x6a7e('0x47')]?_0x27c1e9[_0x6a7e('0x47')]:_0x27c1e9['CampaignId']},'attributes':['id',_0x6a7e('0x4a')],'raw':!![]});}}})[_0x6a7e('0xe')](function(_0xe1b38e){var _0x367b8b={};if(_0xe1b38e){_['merge'](_0x367b8b,_['omit'](_0xd3252d[_0x6a7e('0x4b')],[_0x6a7e('0x4c'),'updatedAt','id']));_0x367b8b[_0x6a7e('0x4d')]=0x15;_0x367b8b[_0x6a7e('0x4e')]=_0x6a7e('0x4f');_0x367b8b[_0x6a7e('0x50')]=_0xe1b38e[_0x6a7e('0x4a')];_0x367b8b[_0x6a7e('0x51')]=_0x25c2bb[_0x6a7e('0x52')][_0x6a7e('0x4a')];_0x367b8b['UserId']=_0x25c2bb[_0x6a7e('0x52')]['id'];_0x367b8b[_0x6a7e('0x4f')]=!![];_0x367b8b[_0x6a7e('0x53')]=moment()[_0x6a7e('0x54')](_0x6a7e('0x55'));_0x367b8b['calleridnum']=_0xd3252d[_0x6a7e('0x56')];_0x367b8b[_0x6a7e('0x57')]=_0xd3252d[_0x6a7e('0x47')]?_0x6a7e('0x58'):_0x6a7e('0x59');return db['CmContact'][_0x6a7e('0x42')]({'where':{'id':_0x367b8b[_0x6a7e('0x5a')]},'attributes':[_0x6a7e('0x5b'),_0x6a7e('0x5c')]})['then'](function(_0x2a0592){if(!_[_0x6a7e('0x5d')](_0x4a7465)&&!_[_0x6a7e('0x5d')](_0x2a0592[_0x6a7e('0x5b')])){_0x367b8b[_0x6a7e('0x5e')]=_0x2a0592[_0x6a7e('0x5b')];if(!_['isNil'](_0x2a0592[_0x6a7e('0x5c')])){_0x367b8b[_0x6a7e('0x5e')]+='\x20'+_0x2a0592[_0x6a7e('0x5c')];}}})[_0x6a7e('0x5f')](function(){return db[_0x6a7e('0x60')]['create'](_0x367b8b);});}})[_0x6a7e('0xe')](function(_0x61a72){return db[_0x6a7e('0x61')][_0x6a7e('0x46')]({'where':{'CmHopperId':_0x58f58b}});})['then'](function(){return _0x4a7465[_0x6a7e('0x6')](0xcc)['end']();})['catch'](handleError(_0x4a7465,null));};exports['getPreview']=function(_0x368ffb,_0x3374c7){var _0x5dc96c=[];return db[_0x6a7e('0x62')][_0x6a7e('0x45')]()[_0x6a7e('0xe')](function(_0x512d15){_0x5dc96c=_[_0x6a7e('0x1a')](_0x512d15);return _0x368ffb[_0x6a7e('0x52')][_0x6a7e('0x63')]({'where':{'type':_0x6a7e('0x64'),'dialActive':!![],'dialMethod':_0x6a7e('0x65')},'attributes':['id',_0x6a7e('0x66'),'dialPreviewAutoRecallMe'],'raw':!![]});})[_0x6a7e('0xe')](function(_0x1f76ea){if(_0x1f76ea&&_0x1f76ea[_0x6a7e('0x31')]){return db['sequelize']['transaction'](function(_0x13e653){var _0x231dd1={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x6a7e('0x54')]('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_['map'](_0x1f76ea,'id')},'$or':[{'UserId':null},{'UserId':_0x368ffb[_0x6a7e('0x52')]['id']}]};var _0x2ea436={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x1f76ea)[_0x6a7e('0x38')]([_0x6a7e('0x67'),0x0])[_0x6a7e('0x18')]('id')[_0x6a7e('0x68')]()},'$or':[{'UserId':null},{'UserId':_0x368ffb[_0x6a7e('0x52')]['id']}]};var _0x450dd7={'$or':[_0x231dd1,_0x2ea436]};var _0x4cee5f=[];if(_0x368ffb[_0x6a7e('0x44')]['direction']&&_0x368ffb[_0x6a7e('0x44')]['direction']==='prev'){if(!_['isEmpty'](_0x368ffb[_0x6a7e('0x44')]['hopperIds'])){_0x450dd7['id']={'$in':_0x368ffb[_0x6a7e('0x44')][_0x6a7e('0x69')]};}_0x4cee5f=[[_0x6a7e('0x6a'),_0x6a7e('0x6b')],[_0x6a7e('0x6c'),_0x1f76ea[0x0][_0x6a7e('0x66')]===_0x6a7e('0x6b')?_0x6a7e('0x6d'):_0x6a7e('0x6b')],db['sequelize'][_0x6a7e('0x6e')]('COALESCE(CmHopper.UserId,\x200)\x20ASC'),['id',_0x6a7e('0x6d')]];}else{if(!_['isEmpty'](_0x368ffb['body'][_0x6a7e('0x69')])){_0x450dd7['id']={'$notIn':_0x368ffb[_0x6a7e('0x44')][_0x6a7e('0x69')]};}_0x4cee5f=[[_0x6a7e('0x6a'),_0x6a7e('0x6d')],[_0x6a7e('0x6c'),_0x1f76ea[0x0][_0x6a7e('0x66')]],db[_0x6a7e('0x6f')]['literal'](_0x6a7e('0x70')),['id','ASC']];}return db[_0x6a7e('0x12')]['findOne']({'attributes':['id',_0x6a7e('0x71'),_0x6a7e('0x56'),_0x6a7e('0x72')],'where':_0x450dd7,'order':_0x4cee5f,'transaction':_0x13e653,'lock':_0x13e653[_0x6a7e('0x73')][_0x6a7e('0x74')],'include':[{'model':db[_0x6a7e('0x62')],'as':_0x6a7e('0x75'),'attributes':_0x5dc96c,'include':[{'model':db[_0x6a7e('0x76')],'as':_0x6a7e('0x77'),'attributes':['id','name']}]},{'model':db['CmList'],'as':'List','attributes':['id',_0x6a7e('0x4a')]},{'model':db[_0x6a7e('0x48')],'as':_0x6a7e('0x78'),'attributes':['id',_0x6a7e('0x4a'),_0x6a7e('0x79')]}]})[_0x6a7e('0xe')](function(_0x272095){if(_0x272095){return _0x272095[_0x6a7e('0xd')]({'UserId':_0x368ffb[_0x6a7e('0x52')]['id']},{'transaction':_0x13e653});}});});}})[_0x6a7e('0xe')](handleEntityNotFound(_0x3374c7,null))['then'](respondWithResult(_0x3374c7,null))[_0x6a7e('0x3d')](handleError(_0x3374c7,null));};exports[_0x6a7e('0x7a')]=function(_0x209e33,_0x441118,_0x1e278b){var _0x51bc53=[];var _0x1d4a2d=_0x209e33[_0x6a7e('0x3f')]['id'];var _0x5bf64a=_0x209e33[_0x6a7e('0x52')]['id'];return db[_0x6a7e('0x62')][_0x6a7e('0x45')]()['then'](function(_0x42f01c){_0x51bc53=_[_0x6a7e('0x1a')](_0x42f01c);return db[_0x6a7e('0x6f')][_0x6a7e('0x7b')](function(_0x2e8c01){const _0x4ee7e5={'id':_0x1d4a2d};return db['CmHopper'][_0x6a7e('0x7c')]({'attributes':['id',_0x6a7e('0x71'),_0x6a7e('0x72')],'where':_0x4ee7e5,'transaction':_0x2e8c01,'lock':_0x2e8c01[_0x6a7e('0x73')]['UPDATE'],'include':[{'model':db['CmContact'],'as':_0x6a7e('0x75'),'attributes':_0x51bc53,'include':[{'model':db['CmCompany'],'as':_0x6a7e('0x77'),'attributes':['id',_0x6a7e('0x4a')]}]},{'model':db[_0x6a7e('0x7d')],'as':'List','attributes':['id',_0x6a7e('0x4a')]},{'model':db[_0x6a7e('0x48')],'as':_0x6a7e('0x78'),'attributes':['id',_0x6a7e('0x4a'),_0x6a7e('0x79')]}]})['then'](function(_0x3cc9d9){if(_0x3cc9d9){return _0x3cc9d9['update']({'UserId':_0x5bf64a},{'transaction':_0x2e8c01});}});});})[_0x6a7e('0xe')](handleEntityNotFound(_0x441118,null))[_0x6a7e('0xe')](respondWithResult(_0x441118,null))[_0x6a7e('0x3d')](handleError(_0x441118,null));};exports[_0x6a7e('0x7e')]=function(_0x4ece6e,_0xd1b6ed){return _0x4ece6e[_0x6a7e('0x52')][_0x6a7e('0x63')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':'preview'},'attributes':['id'],'raw':!![]})[_0x6a7e('0xe')](function(_0xcf4ba4){if(_0xcf4ba4&&_0xcf4ba4[_0x6a7e('0x31')]){return db['CmHopper']['count']({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0x6a7e('0x55'))},'VoiceQueueId':{'$in':_[_0x6a7e('0x18')](_0xcf4ba4,'id')},'$or':[{'UserId':null},{'UserId':_0x4ece6e[_0x6a7e('0x52')]['id']}]}});}return 0x0;})[_0x6a7e('0xe')](function(_0x412db8){if(!_[_0x6a7e('0x5d')](_0x412db8)&&_[_0x6a7e('0x7f')](_0x412db8)){return _0xd1b6ed[_0x6a7e('0x6')](0xc8)[_0x6a7e('0x7')]({'contacts':_0x412db8});}else{logger[_0x6a7e('0x80')](_0x6a7e('0x81'),'getOpenContacts',0x194,_0x6a7e('0x82'));_0xd1b6ed[_0x6a7e('0xf')](0x194);}})[_0x6a7e('0x3d')](handleError(_0xd1b6ed,null));};exports[_0x6a7e('0x83')]=function(_0x33c930,_0x540998){var _0x340e63=shared['timezones'];var _0x42aac=[];_['map'](_0x340e63,function(_0x2f7e23){_0x42aac[_0x6a7e('0x84')]({'id':_0x2f7e23[_0x6a7e('0x4a')],'name':_0x2f7e23[_0x6a7e('0x4a')],'utcOffset':_0x2f7e23[_0x6a7e('0x85')]});});return _0x540998[_0x6a7e('0x6')](0xc8)['json']({'tz':_0x42aac});};exports[_0x6a7e('0x86')]=function(_0x2ac6f,_0x4ee0de){var _0x481c8b=shared[_0x6a7e('0x87')];var _0x37fd3e={};if(!_[_0x6a7e('0x5d')](_0x481c8b[_0x2ac6f[_0x6a7e('0x44')]['id']]))_0x37fd3e=_0x481c8b[_0x2ac6f['body']['id']];return _0x4ee0de[_0x6a7e('0x6')](0xc8)['json'](_0x37fd3e);}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index 452c231..af5a9f3 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 _0x3f8a=['rimraf','../../config/environment','./cmHopper.attributes','exports','define','CmHopper','cm_hopper','scheduledat','phone','priority','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x436f9e,_0x138d0c){var _0x2f9b98=function(_0x397880){while(--_0x397880){_0x436f9e['push'](_0x436f9e['shift']());}};_0x2f9b98(++_0x138d0c);}(_0x3f8a,0x1d5));var _0xa3f8=function(_0x4299db,_0x4171a6){_0x4299db=_0x4299db-0x0;var _0x381067=_0x3f8a[_0x4299db];return _0x381067;};'use strict';var _=require(_0xa3f8('0x0'));var util=require(_0xa3f8('0x1'));var logger=require(_0xa3f8('0x2'))(_0xa3f8('0x3'));var moment=require('moment');var BPromise=require(_0xa3f8('0x4'));var rp=require(_0xa3f8('0x5'));var fs=require('fs');var path=require(_0xa3f8('0x6'));var rimraf=require(_0xa3f8('0x7'));var config=require(_0xa3f8('0x8'));var attributes=require(_0xa3f8('0x9'));module[_0xa3f8('0xa')]=function(_0x471464,_0x1f160a){return _0x471464[_0xa3f8('0xb')](_0xa3f8('0xc'),attributes,{'tableName':_0xa3f8('0xd'),'paranoid':![],'indexes':[{'name':_0xa3f8('0xe'),'fields':[_0xa3f8('0xe')]},{'name':_0xa3f8('0xf'),'fields':[_0xa3f8('0xf')]},{'name':_0xa3f8('0x10'),'fields':['priority']}],'timestamps':!![]});}; \ No newline at end of file +var _0xc1c6=['lodash','util','../../config/logger','moment','request-promise','path','rimraf','exports','CmHopper','cm_hopper','scheduledat','phone','priority'];(function(_0x555883,_0x315b61){var _0x3332da=function(_0x2692bf){while(--_0x2692bf){_0x555883['push'](_0x555883['shift']());}};_0x3332da(++_0x315b61);}(_0xc1c6,0xf7));var _0x6c1c=function(_0x21c7a6,_0xa77fbf){_0x21c7a6=_0x21c7a6-0x0;var _0x40669b=_0xc1c6[_0x21c7a6];return _0x40669b;};'use strict';var _=require(_0x6c1c('0x0'));var util=require(_0x6c1c('0x1'));var logger=require(_0x6c1c('0x2'))('api');var moment=require(_0x6c1c('0x3'));var BPromise=require('bluebird');var rp=require(_0x6c1c('0x4'));var fs=require('fs');var path=require(_0x6c1c('0x5'));var rimraf=require(_0x6c1c('0x6'));var config=require('../../config/environment');var attributes=require('./cmHopper.attributes');module[_0x6c1c('0x7')]=function(_0x524a6b,_0x50c1bb){return _0x524a6b['define'](_0x6c1c('0x8'),attributes,{'tableName':_0x6c1c('0x9'),'paranoid':![],'indexes':[{'name':_0x6c1c('0xa'),'fields':[_0x6c1c('0xa')]},{'name':'phone','fields':[_0x6c1c('0xb')]},{'name':_0x6c1c('0xc'),'fields':['priority']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index d861e46..f54aaca 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 _0x7b96=['include','model','map','then','stringify','catch','error','message','ShowCmHopper','find','raw','info','CreateCmHopper','create','body','debug','update','active','UpdateCmHopper','DestroyCmHopper','GetContactDialer','CmContact','describe','sequelize','transaction','LOCK','UPDATE','Contact','Agent','name','length','UserId','push','all','dataValues','CmHopperFinal','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','order','GetContactRecallMe','GetCmHopperPreview','keys','GetContactByPhone','findOne','phone','dialTimezone','DESC','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','interval','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE','voicePause','CmList','List','NOW()','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','GetCmHopper','CmHopper','findAll','options','where','attributes','limit'];(function(_0x23db2a,_0x35ec51){var _0x3d13fb=function(_0x3539df){while(--_0x3539df){_0x23db2a['push'](_0x23db2a['shift']());}};_0x3d13fb(++_0x35ec51);}(_0x7b96,0x92));var _0x67b9=function(_0x2473c9,_0x4eaada){_0x2473c9=_0x2473c9-0x0;var _0x51f946=_0x7b96[_0x2473c9];return _0x51f946;};'use strict';var _=require(_0x67b9('0x0'));var util=require(_0x67b9('0x1'));var moment=require(_0x67b9('0x2'));var BPromise=require(_0x67b9('0x3'));var db=require(_0x67b9('0x4'))['db'];var logger=require(_0x67b9('0x5'))(_0x67b9('0x6'));exports[_0x67b9('0x7')]=function(_0x1a2105){var _0x315282=this;return new Promise(function(_0x199cb7,_0x190411){return db[_0x67b9('0x8')][_0x67b9('0x9')]({'raw':_0x1a2105[_0x67b9('0xa')]?_0x1a2105['options']['raw']===undefined?!![]:![]:!![],'where':_0x1a2105['options']?_0x1a2105[_0x67b9('0xa')][_0x67b9('0xb')]||null:null,'attributes':_0x1a2105[_0x67b9('0xa')]?_0x1a2105[_0x67b9('0xa')][_0x67b9('0xc')]||null:null,'limit':_0x1a2105[_0x67b9('0xa')]?_0x1a2105[_0x67b9('0xa')][_0x67b9('0xd')]||null:null,'include':_0x1a2105[_0x67b9('0xa')]?_0x1a2105['options'][_0x67b9('0xe')]?_['map'](_0x1a2105[_0x67b9('0xa')][_0x67b9('0xe')],function(_0x56d6bb){return{'model':db[_0x56d6bb[_0x67b9('0xf')]],'as':_0x56d6bb['as'],'attributes':_0x56d6bb[_0x67b9('0xc')],'include':_0x56d6bb[_0x67b9('0xe')]?_[_0x67b9('0x10')](_0x56d6bb[_0x67b9('0xe')],function(_0x5ca663){return{'model':db[_0x5ca663[_0x67b9('0xf')]],'as':_0x5ca663['as'],'attributes':_0x5ca663[_0x67b9('0xc')],'include':_0x5ca663[_0x67b9('0xe')]?_[_0x67b9('0x10')](_0x5ca663[_0x67b9('0xe')],function(_0x5ee059){return{'model':db[_0x5ee059['model']],'as':_0x5ee059['as'],'attributes':_0x5ee059[_0x67b9('0xc')]};}):[]};}):[]};}):[]:[]})[_0x67b9('0x11')](function(_0x45e281){logger['info']('GetCmHopper',_0x1a2105);logger['debug'](_0x67b9('0x7'),_0x1a2105,JSON[_0x67b9('0x12')](_0x45e281));_0x199cb7(_0x45e281);})[_0x67b9('0x13')](function(_0x1884fb){logger[_0x67b9('0x14')](_0x67b9('0x7'),_0x1884fb[_0x67b9('0x15')],_0x1a2105);_0x190411(_0x315282[_0x67b9('0x14')](0x1f4,_0x1884fb[_0x67b9('0x15')]));});});};exports[_0x67b9('0x16')]=function(_0x3701c7){var _0x4b110a=this;return new Promise(function(_0x594ec8,_0x241b37){return db[_0x67b9('0x8')][_0x67b9('0x17')]({'raw':_0x3701c7[_0x67b9('0xa')]?_0x3701c7[_0x67b9('0xa')][_0x67b9('0x18')]===undefined?!![]:![]:!![],'where':_0x3701c7[_0x67b9('0xa')]?_0x3701c7['options'][_0x67b9('0xb')]||null:null,'attributes':_0x3701c7[_0x67b9('0xa')]?_0x3701c7['options'][_0x67b9('0xc')]||null:null,'include':_0x3701c7[_0x67b9('0xa')]?_0x3701c7[_0x67b9('0xa')][_0x67b9('0xe')]?_[_0x67b9('0x10')](_0x3701c7[_0x67b9('0xa')]['include'],function(_0x1675dd){return{'model':db[_0x1675dd[_0x67b9('0xf')]],'as':_0x1675dd['as'],'attributes':_0x1675dd[_0x67b9('0xc')],'include':_0x1675dd['include']?_[_0x67b9('0x10')](_0x1675dd[_0x67b9('0xe')],function(_0x5bb3bf){return{'model':db[_0x5bb3bf[_0x67b9('0xf')]],'as':_0x5bb3bf['as'],'attributes':_0x5bb3bf[_0x67b9('0xc')],'include':_0x5bb3bf[_0x67b9('0xe')]?_[_0x67b9('0x10')](_0x5bb3bf[_0x67b9('0xe')],function(_0x1145c8){return{'model':db[_0x1145c8[_0x67b9('0xf')]],'as':_0x1145c8['as'],'attributes':_0x1145c8[_0x67b9('0xc')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3fa5a8){logger[_0x67b9('0x19')](_0x67b9('0x16'),_0x3701c7);logger['debug'](_0x67b9('0x16'),_0x3701c7,JSON[_0x67b9('0x12')](_0x3fa5a8));_0x594ec8(_0x3fa5a8);})[_0x67b9('0x13')](function(_0x2c9693){logger[_0x67b9('0x14')](_0x67b9('0x16'),_0x2c9693[_0x67b9('0x15')],_0x3701c7);_0x241b37(_0x4b110a[_0x67b9('0x14')](0x1f4,_0x2c9693['message']));});});};exports[_0x67b9('0x1a')]=function(_0x34104e){var _0x51319b=this;return new Promise(function(_0x2db5fb,_0x42ad09){return db[_0x67b9('0x8')][_0x67b9('0x1b')](_0x34104e[_0x67b9('0x1c')],{'raw':_0x34104e[_0x67b9('0xa')]?_0x34104e[_0x67b9('0xa')][_0x67b9('0x18')]===undefined?!![]:![]:!![]})[_0x67b9('0x11')](function(_0x2b64ad){logger['info'](_0x67b9('0x1a'),_0x34104e);logger[_0x67b9('0x1d')](_0x67b9('0x1a'),_0x34104e,JSON[_0x67b9('0x12')](_0x2b64ad));_0x2db5fb(_0x2b64ad);})[_0x67b9('0x13')](function(_0x21ce31){logger[_0x67b9('0x14')](_0x67b9('0x1a'),_0x21ce31[_0x67b9('0x15')],_0x34104e);_0x42ad09(_0x51319b['error'](0x1f4,_0x21ce31[_0x67b9('0x15')]));});});};exports['UpdateCmHopper']=function(_0x434e76){var _0x3d346b=this;return new Promise(function(_0x1e75cd,_0x2ceb62){return db[_0x67b9('0x8')][_0x67b9('0x1e')](_0x434e76[_0x67b9('0x1c')],{'raw':_0x434e76['options']?_0x434e76['options'][_0x67b9('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x434e76['options']?_0x434e76[_0x67b9('0xa')][_0x67b9('0xb')]||null:null,'attributes':_0x434e76[_0x67b9('0xa')]?_0x434e76['options'][_0x67b9('0xc')]||null:null,'limit':_0x434e76[_0x67b9('0xa')]?_0x434e76[_0x67b9('0xa')]['limit']||null:null})['then'](function(_0x27d78f){logger[_0x67b9('0x19')]('UpdateCmHopper',_0x434e76);logger[_0x67b9('0x19')]('UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON[_0x67b9('0x12')](_0x434e76[_0x67b9('0xa')][_0x67b9('0xb')]),_0x434e76[_0x67b9('0x1c')][_0x67b9('0x1f')]);logger[_0x67b9('0x1d')](_0x67b9('0x20'),_0x434e76,JSON['stringify'](_0x27d78f));_0x1e75cd(_0x27d78f);})[_0x67b9('0x13')](function(_0xea7c2c){logger[_0x67b9('0x14')]('UpdateCmHopper',_0xea7c2c[_0x67b9('0x15')],_0x434e76);_0x2ceb62(_0x3d346b[_0x67b9('0x14')](0x1f4,_0xea7c2c['message']));});});};exports[_0x67b9('0x21')]=function(_0x505a80){var _0x53234c=this;return new Promise(function(_0x46958b,_0x224ddf){return db[_0x67b9('0x8')]['destroy']({'where':_0x505a80[_0x67b9('0xa')]?_0x505a80[_0x67b9('0xa')][_0x67b9('0xb')]||null:null})[_0x67b9('0x11')](function(_0x2ac00f){logger[_0x67b9('0x19')](_0x67b9('0x21'),_0x505a80);logger['debug'](_0x67b9('0x21'),_0x505a80,JSON[_0x67b9('0x12')](_0x2ac00f));_0x46958b(_0x2ac00f);})[_0x67b9('0x13')](function(_0x55da49){logger[_0x67b9('0x14')](_0x67b9('0x21'),_0x55da49[_0x67b9('0x15')],_0x505a80);_0x224ddf(_0x53234c[_0x67b9('0x14')](0x1f4,_0x55da49[_0x67b9('0x15')]));});});};exports[_0x67b9('0x22')]=function(_0xa4f279){var _0x21984b=this;return new Promise(function(_0x21261d,_0x1f545a){return db[_0x67b9('0x23')][_0x67b9('0x24')]()['then'](function(_0x3de1e8){return db[_0x67b9('0x25')][_0x67b9('0x26')](function(_0x29a18b){return db['CmHopper'][_0x67b9('0x9')]({'where':_0xa4f279[_0x67b9('0xa')]?_0xa4f279[_0x67b9('0xa')][_0x67b9('0xb')]||null:null,'attributes':_0xa4f279[_0x67b9('0xa')]?_0xa4f279[_0x67b9('0xa')][_0x67b9('0xc')]||null:null,'limit':_0xa4f279[_0x67b9('0xa')]?_0xa4f279['options'][_0x67b9('0xd')]||null:null,'order':_0xa4f279[_0x67b9('0xa')]?_0xa4f279['options']['order']||null:null,'transaction':_0x29a18b,'lock':_0x29a18b[_0x67b9('0x27')][_0x67b9('0x28')],'include':[{'model':db['CmContact'],'as':_0x67b9('0x29'),'attributes':_['keys'](_0x3de1e8)},{'model':db['User'],'as':_0x67b9('0x2a'),'attributes':['id',_0x67b9('0x2b'),'voicePause']}]})[_0x67b9('0x11')](function(_0x33e720){var _0x549ef4=[];var _0x4da444=[];for(var _0x5193e8=0x0;_0x5193e8<_0x33e720[_0x67b9('0x2c')];_0x5193e8+=0x1){var _0x1b1ff1=_0x33e720[_0x5193e8][_0x67b9('0x2d')];if(_0x1b1ff1===null){_0x549ef4['push'](_0x33e720[_0x5193e8][_0x67b9('0x1e')](_0xa4f279['body'],{'transaction':_0x29a18b}));}else if(!_0x4da444['includes'](_0x1b1ff1)){_0x4da444[_0x67b9('0x2e')](_0x1b1ff1);_0x549ef4[_0x67b9('0x2e')](_0x33e720[_0x5193e8][_0x67b9('0x1e')](_0xa4f279[_0x67b9('0x1c')],{'transaction':_0x29a18b}));}}return BPromise[_0x67b9('0x2f')](_0x549ef4);});})['then'](function(_0x3143aa){logger['info'](_0x67b9('0x22'),_0xa4f279);if(_0x3143aa[_0x67b9('0x2c')]>0x0){logger[_0x67b9('0x19')]('GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]',_0x3143aa[0x0][_0x67b9('0x30')]['id'],_0x3143aa[0x0][_0x67b9('0x30')]['ContactId'],_0x3143aa[0x0][_0x67b9('0x30')][_0x67b9('0x1f')]);}logger['debug'](_0x67b9('0x22'),_0xa4f279,JSON[_0x67b9('0x12')](_0x3143aa));_0x21261d(_0x3143aa);})[_0x67b9('0x13')](function(_0x5df9fa){logger[_0x67b9('0x14')](_0x67b9('0x22'),_0x5df9fa[_0x67b9('0x15')],_0xa4f279);_0x1f545a(_0x21984b[_0x67b9('0x14')](0x1f4,_0x5df9fa[_0x67b9('0x15')]));});});});};exports['MoveContactManagedDialer']=function(_0xc03b7){var _0x337fbd=this;return new Promise(function(_0x44a225,_0x1b03b6){return db[_0x67b9('0x25')][_0x67b9('0x26')](function(_0x4e61ff){return db[_0x67b9('0x31')][_0x67b9('0x1b')](_0xc03b7[_0x67b9('0x1c')],{'raw':_0xc03b7['options']?_0xc03b7[_0x67b9('0xa')][_0x67b9('0x18')]===undefined?!![]:![]:!![],'transaction':_0x4e61ff})[_0x67b9('0x11')](function(){logger[_0x67b9('0x19')](_0x67b9('0x32'),JSON[_0x67b9('0x12')](_0xc03b7[_0x67b9('0xa')]['where']),_0xc03b7[_0x67b9('0xa')][_0x67b9('0xb')]['active']);return db[_0x67b9('0x8')]['destroy']({'where':_0xc03b7['options']?_0xc03b7[_0x67b9('0xa')][_0x67b9('0xb')]||null:null,'transaction':_0x4e61ff});});})[_0x67b9('0x11')](function(_0xbc0730){logger[_0x67b9('0x19')](_0x67b9('0x33'),_0xc03b7);logger[_0x67b9('0x1d')](_0x67b9('0x33'),_0xc03b7,JSON[_0x67b9('0x12')](_0xbc0730));_0x44a225(_0xbc0730);})[_0x67b9('0x13')](function(_0x1116a4){logger[_0x67b9('0x14')](_0x67b9('0x33'),_0x1116a4[_0x67b9('0x15')],_0xc03b7);_0x1b03b6(_0x337fbd[_0x67b9('0x14')](0x1f4,_0x1116a4[_0x67b9('0x15')]));});});};exports[_0x67b9('0x34')]=function(_0x477463){var _0x35f262=this;return new Promise(function(_0x1651c4,_0x76d006){return db[_0x67b9('0x8')][_0x67b9('0x9')]({'raw':_0x477463[_0x67b9('0xa')]?_0x477463[_0x67b9('0xa')][_0x67b9('0x18')]===undefined?!![]:![]:!![],'where':_0x477463[_0x67b9('0xa')]?_0x477463[_0x67b9('0xa')]['where']||null:null,'attributes':[[db['sequelize']['fn'](_0x67b9('0x35'),db['sequelize']['fn']('IF',db[_0x67b9('0x25')][_0x67b9('0x36')](_0x67b9('0x37')+util['format'](_0x67b9('0x38'),moment()[_0x67b9('0x39')](_0x67b9('0x3a')))+_0x67b9('0x3b')))),_0x67b9('0x3c')]]})['then'](function(_0x23c65e){logger[_0x67b9('0x19')](_0x67b9('0x34'),_0x477463);logger[_0x67b9('0x1d')](_0x67b9('0x34'),_0x477463,JSON[_0x67b9('0x12')](_0x23c65e));_0x1651c4(_0x23c65e);})['catch'](function(_0x5b4d9f){logger[_0x67b9('0x14')](_0x67b9('0x34'),_0x5b4d9f[_0x67b9('0x15')],_0x477463);_0x76d006(_0x35f262[_0x67b9('0x14')](0x1f4,_0x5b4d9f[_0x67b9('0x15')]));});});};exports['GetContactRecallMe']=function(_0x407fae){var _0x32652f=this;return new Promise(function(_0x2df7b2,_0x223ea6){return db[_0x67b9('0x23')][_0x67b9('0x24')]()[_0x67b9('0x11')](function(){return db['sequelize']['transaction'](function(_0x18e425){return db[_0x67b9('0x8')]['findAll']({'where':_0x407fae[_0x67b9('0xa')]?_0x407fae[_0x67b9('0xa')][_0x67b9('0xb')]||null:null,'attributes':_0x407fae['options']?_0x407fae[_0x67b9('0xa')][_0x67b9('0xc')]||null:null,'limit':0x1,'order':_0x407fae[_0x67b9('0xa')]?_0x407fae['options'][_0x67b9('0x3d')]||null:null,'group':db[_0x67b9('0x8')]['UserId'],'transaction':_0x18e425,'lock':_0x18e425[_0x67b9('0x27')][_0x67b9('0x28')],'include':_0x407fae[_0x67b9('0xa')]?_0x407fae[_0x67b9('0xa')][_0x67b9('0xe')]?_[_0x67b9('0x10')](_0x407fae['options']['include'],function(_0x2ab339){return{'model':db[_0x2ab339[_0x67b9('0xf')]],'as':_0x2ab339['as'],'attributes':_0x2ab339[_0x67b9('0xc')],'include':_0x2ab339[_0x67b9('0xe')]?_['map'](_0x2ab339['include'],function(_0x22c51e){return{'model':db[_0x22c51e[_0x67b9('0xf')]],'as':_0x22c51e['as'],'attributes':_0x22c51e[_0x67b9('0xc')],'include':_0x22c51e[_0x67b9('0xe')]?_[_0x67b9('0x10')](_0x22c51e[_0x67b9('0xe')],function(_0x25a342){return{'model':db[_0x25a342[_0x67b9('0xf')]],'as':_0x25a342['as'],'attributes':_0x25a342[_0x67b9('0xc')]};}):[]};}):[]};}):[]:[]})[_0x67b9('0x11')](function(_0x1fa011){var _0x45d8d0=[];for(var _0x28cc27=0x0;_0x28cc27<_0x1fa011[_0x67b9('0x2c')];_0x28cc27+=0x1){_0x45d8d0[_0x67b9('0x2e')](_0x1fa011[_0x28cc27][_0x67b9('0x1e')](_0x407fae[_0x67b9('0x1c')],{'transaction':_0x18e425}));}return BPromise[_0x67b9('0x2f')](_0x45d8d0);});})[_0x67b9('0x11')](function(_0x25b089){logger[_0x67b9('0x19')](_0x67b9('0x3e'),_0x407fae);logger[_0x67b9('0x1d')](_0x67b9('0x3e'),_0x407fae,JSON[_0x67b9('0x12')](_0x25b089));_0x2df7b2(_0x25b089);})['catch'](function(_0x57a254){logger[_0x67b9('0x14')]('GetContactRecallMe',_0x57a254[_0x67b9('0x15')],_0x407fae);_0x223ea6(_0x32652f[_0x67b9('0x14')](0x1f4,_0x57a254[_0x67b9('0x15')]));});});});};exports[_0x67b9('0x3f')]=function(_0x1cc313){var _0x5cb741=this;return new Promise(function(_0x143b93,_0x189fca){db['CmContact']['describe']()[_0x67b9('0x11')](function(_0x271913){return db[_0x67b9('0x8')][_0x67b9('0x9')]({'raw':_0x1cc313[_0x67b9('0xa')]?_0x1cc313[_0x67b9('0xa')][_0x67b9('0x18')]===undefined?!![]:![]:!![],'where':_0x1cc313[_0x67b9('0xa')]?_0x1cc313[_0x67b9('0xa')][_0x67b9('0xb')]||null:null,'attributes':_0x1cc313['options']?_0x1cc313['options'][_0x67b9('0xc')]||null:null,'limit':_0x1cc313[_0x67b9('0xa')]?_0x1cc313['options'][_0x67b9('0xd')]||null:null,'include':_0x1cc313[_0x67b9('0xa')]?_0x1cc313[_0x67b9('0xa')]['include']?_[_0x67b9('0x10')](_0x1cc313[_0x67b9('0xa')][_0x67b9('0xe')],function(_0x4b12c1){return{'model':db[_0x4b12c1['model']],'as':_0x4b12c1['as'],'attributes':_0x4b12c1['as']==='Contact'?_[_0x67b9('0x40')](_0x271913):_0x4b12c1['attributes'],'include':_0x4b12c1[_0x67b9('0xe')]?_[_0x67b9('0x10')](_0x4b12c1['include'],function(_0x5ce951){return{'model':db[_0x5ce951[_0x67b9('0xf')]],'as':_0x5ce951['as'],'attributes':_0x5ce951[_0x67b9('0xc')],'include':_0x5ce951['include']?_[_0x67b9('0x10')](_0x5ce951[_0x67b9('0xe')],function(_0x499608){return{'model':db[_0x499608[_0x67b9('0xf')]],'as':_0x499608['as'],'attributes':_0x499608[_0x67b9('0xc')]};}):[]};}):[]};}):[]:[]})[_0x67b9('0x11')](function(_0xe2c29a){logger['info'](_0x67b9('0x7'),_0x1cc313);logger[_0x67b9('0x1d')](_0x67b9('0x7'),_0x1cc313,JSON[_0x67b9('0x12')](_0xe2c29a));_0x143b93(_0xe2c29a);})[_0x67b9('0x13')](function(_0x139ba8){logger[_0x67b9('0x14')](_0x67b9('0x7'),_0x139ba8[_0x67b9('0x15')],_0x1cc313);_0x189fca(_0x5cb741['error'](0x1f4,_0x139ba8[_0x67b9('0x15')]));});});});};exports[_0x67b9('0x41')]=function(_0x475642){var _0x1c5b62=this;return new Promise(function(_0x2e835f,_0x43eb76){return db[_0x67b9('0x23')][_0x67b9('0x42')]({'raw':!![],'where':{'phone':_0x475642[_0x67b9('0xa')][_0x67b9('0xb')][_0x67b9('0x43')]},'attributes':['id',_0x67b9('0x44')],'order':[['id',_0x67b9('0x45')]]})[_0x67b9('0x11')](function(_0x30a3ff){logger['info'](_0x67b9('0x46'),_0x475642);logger[_0x67b9('0x1d')](_0x67b9('0x46'),_0x475642,JSON[_0x67b9('0x12')](_0x30a3ff));_0x2e835f(_0x30a3ff);})[_0x67b9('0x13')](function(_0x157403){logger[_0x67b9('0x14')](_0x67b9('0x46'),_0x157403[_0x67b9('0x15')],_0x475642);_0x43eb76(_0x1c5b62['error'](0x1f4,_0x157403[_0x67b9('0x15')]));});});};exports[_0x67b9('0x47')]=function(_0x21ffcf){var _0x52fc08=this;return new Promise(function(_0x460892,_0x508b81){return db[_0x67b9('0x25')][_0x67b9('0x26')](function(_0x484e6f){var _0x43505a=_0x21ffcf[_0x67b9('0xa')]&&_0x21ffcf['options'][_0x67b9('0xb')]?_0x21ffcf['options'][_0x67b9('0xb')]:{};return db[_0x67b9('0x8')][_0x67b9('0x1e')](_0x21ffcf[_0x67b9('0x1c')],{'where':_0x43505a,'transaction':_0x484e6f})[_0x67b9('0x11')](function(_0x20f6e0){logger['info'](_0x67b9('0x47'),_0x21ffcf);logger[_0x67b9('0x1d')](_0x67b9('0x47'),_0x21ffcf,JSON[_0x67b9('0x12')](_0x20f6e0));_0x460892(_0x20f6e0);})[_0x67b9('0x13')](function(_0x30b2b5){logger[_0x67b9('0x14')](_0x67b9('0x47'),_0x30b2b5['message'],_0x21ffcf);_0x508b81(_0x52fc08['error'](0x1f4,_0x30b2b5[_0x67b9('0x15')]));});});});};exports[_0x67b9('0x48')]=function(_0x3b99b1){var _0x4f3aaa=this;var _0x248a94=_0x3b99b1['body']['where']['voiceQueueIds'];var _0x2e0c82=_0x3b99b1[_0x67b9('0x1c')]['where'][_0x67b9('0x49')];var _0x44acf2=_0x3b99b1[_0x67b9('0x1c')][_0x67b9('0xb')]['availableAgentsIds'];return new Promise(function(_0x4a93ab,_0x3537d9){return db[_0x67b9('0x8')]['findAll']({'where':{'voiceQueueId':{'$in':_0x248a94},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db['sequelize']['literal'](_0x67b9('0x4a')+_0x2e0c82+_0x67b9('0x4b')),'$gt':db[_0x67b9('0x25')][_0x67b9('0x36')]('NOW()')}},'UserId':{'$in':_0x44acf2}},'include':[{'model':db[_0x67b9('0x23')],'as':_0x67b9('0x29')},{'model':db['User'],'as':_0x67b9('0x2a'),'attributes':['id',_0x67b9('0x2b'),_0x67b9('0x4c')]},{'model':db[_0x67b9('0x4d')],'as':_0x67b9('0x4e')}]})['then'](function(_0x1465d4){if(_0x1465d4[_0x67b9('0x2c')]>0x0){return db[_0x67b9('0x25')][_0x67b9('0x26')](function(_0x286afb){return db[_0x67b9('0x8')]['update']({'recallmeNotifiedDate':db[_0x67b9('0x25')][_0x67b9('0x36')](_0x67b9('0x4f'))},{'where':{'id':{'$in':_[_0x67b9('0x10')](_0x1465d4,'id')}},'transaction':_0x286afb})[_0x67b9('0x11')](function(){_0x4a93ab(_0x1465d4);})[_0x67b9('0x13')](function(_0x4cd5a3){logger[_0x67b9('0x14')](_0x67b9('0x48'),_0x4cd5a3[_0x67b9('0x15')],_0x3b99b1);_0x3537d9(_0x4f3aaa['error'](0x1f4,_0x4cd5a3[_0x67b9('0x15')]));});})['catch'](function(_0x972d4d){logger[_0x67b9('0x14')](_0x67b9('0x48'),_0x972d4d[_0x67b9('0x15')],_0x3b99b1);_0x3537d9(_0x4f3aaa[_0x67b9('0x14')](0x1f4,_0x972d4d['message']));});}else{_0x4a93ab(_0x1465d4);}});});}; \ No newline at end of file +var _0x05bf=['find','raw','info','catch','CreateCmHopper','CmHopper','create','body','stringify','UpdateCmHopper','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','DestroyCmHopper','destroy','GetContactDialer','CmContact','describe','sequelize','transaction','findAll','order','Contact','keys','Agent','name','voicePause','length','UserId','push','update','all','dataValues','MoveContactManagedDialer','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','CountReScheduled','COUNT','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','LOCK','UPDATE','GetCmHopperPreview','findOne','phone','dialTimezone','DESC','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','voiceQueueIds','interval','availableAgentsIds','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE','NOW()','User','CmList','List','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','GetCmHopper','options','where','attributes','limit','include','map','model','then','debug','error','message','ShowCmHopper'];(function(_0x5f0089,_0x227e2c){var _0x193892=function(_0x24051f){while(--_0x24051f){_0x5f0089['push'](_0x5f0089['shift']());}};_0x193892(++_0x227e2c);}(_0x05bf,0xe5));var _0xf05b=function(_0x12ca50,_0x28ecef){_0x12ca50=_0x12ca50-0x0;var _0x19a89b=_0x05bf[_0x12ca50];return _0x19a89b;};'use strict';var _=require(_0xf05b('0x0'));var util=require(_0xf05b('0x1'));var moment=require(_0xf05b('0x2'));var BPromise=require(_0xf05b('0x3'));var db=require(_0xf05b('0x4'))['db'];var logger=require(_0xf05b('0x5'))(_0xf05b('0x6'));exports[_0xf05b('0x7')]=function(_0x2693f8){var _0x236984=this;return new Promise(function(_0x58ad59,_0x3456d6){return db['CmHopper']['findAll']({'raw':_0x2693f8[_0xf05b('0x8')]?_0x2693f8['options']['raw']===undefined?!![]:![]:!![],'where':_0x2693f8[_0xf05b('0x8')]?_0x2693f8[_0xf05b('0x8')][_0xf05b('0x9')]||null:null,'attributes':_0x2693f8[_0xf05b('0x8')]?_0x2693f8['options'][_0xf05b('0xa')]||null:null,'limit':_0x2693f8[_0xf05b('0x8')]?_0x2693f8['options'][_0xf05b('0xb')]||null:null,'include':_0x2693f8[_0xf05b('0x8')]?_0x2693f8[_0xf05b('0x8')][_0xf05b('0xc')]?_[_0xf05b('0xd')](_0x2693f8[_0xf05b('0x8')][_0xf05b('0xc')],function(_0xf28f2f){return{'model':db[_0xf28f2f[_0xf05b('0xe')]],'as':_0xf28f2f['as'],'attributes':_0xf28f2f[_0xf05b('0xa')],'include':_0xf28f2f[_0xf05b('0xc')]?_[_0xf05b('0xd')](_0xf28f2f[_0xf05b('0xc')],function(_0x969c5){return{'model':db[_0x969c5[_0xf05b('0xe')]],'as':_0x969c5['as'],'attributes':_0x969c5['attributes'],'include':_0x969c5[_0xf05b('0xc')]?_['map'](_0x969c5[_0xf05b('0xc')],function(_0x53ac4f){return{'model':db[_0x53ac4f[_0xf05b('0xe')]],'as':_0x53ac4f['as'],'attributes':_0x53ac4f[_0xf05b('0xa')]};}):[]};}):[]};}):[]:[]})[_0xf05b('0xf')](function(_0x30b6ee){logger['info'](_0xf05b('0x7'),_0x2693f8);logger[_0xf05b('0x10')](_0xf05b('0x7'),_0x2693f8,JSON['stringify'](_0x30b6ee));_0x58ad59(_0x30b6ee);})['catch'](function(_0x120b79){logger[_0xf05b('0x11')]('GetCmHopper',_0x120b79['message'],_0x2693f8);_0x3456d6(_0x236984[_0xf05b('0x11')](0x1f4,_0x120b79[_0xf05b('0x12')]));});});};exports[_0xf05b('0x13')]=function(_0x2348e2){var _0x3694f7=this;return new Promise(function(_0x4c3d61,_0x158da7){return db['CmHopper'][_0xf05b('0x14')]({'raw':_0x2348e2[_0xf05b('0x8')]?_0x2348e2['options'][_0xf05b('0x15')]===undefined?!![]:![]:!![],'where':_0x2348e2[_0xf05b('0x8')]?_0x2348e2[_0xf05b('0x8')][_0xf05b('0x9')]||null:null,'attributes':_0x2348e2['options']?_0x2348e2[_0xf05b('0x8')][_0xf05b('0xa')]||null:null,'include':_0x2348e2['options']?_0x2348e2[_0xf05b('0x8')][_0xf05b('0xc')]?_[_0xf05b('0xd')](_0x2348e2[_0xf05b('0x8')]['include'],function(_0x598f4a){return{'model':db[_0x598f4a['model']],'as':_0x598f4a['as'],'attributes':_0x598f4a[_0xf05b('0xa')],'include':_0x598f4a[_0xf05b('0xc')]?_[_0xf05b('0xd')](_0x598f4a[_0xf05b('0xc')],function(_0x1aa155){return{'model':db[_0x1aa155[_0xf05b('0xe')]],'as':_0x1aa155['as'],'attributes':_0x1aa155[_0xf05b('0xa')],'include':_0x1aa155[_0xf05b('0xc')]?_['map'](_0x1aa155[_0xf05b('0xc')],function(_0x192a25){return{'model':db[_0x192a25[_0xf05b('0xe')]],'as':_0x192a25['as'],'attributes':_0x192a25[_0xf05b('0xa')]};}):[]};}):[]};}):[]:[]})[_0xf05b('0xf')](function(_0x1d907d){logger[_0xf05b('0x16')](_0xf05b('0x13'),_0x2348e2);logger[_0xf05b('0x10')](_0xf05b('0x13'),_0x2348e2,JSON['stringify'](_0x1d907d));_0x4c3d61(_0x1d907d);})[_0xf05b('0x17')](function(_0x21d500){logger[_0xf05b('0x11')](_0xf05b('0x13'),_0x21d500[_0xf05b('0x12')],_0x2348e2);_0x158da7(_0x3694f7[_0xf05b('0x11')](0x1f4,_0x21d500[_0xf05b('0x12')]));});});};exports[_0xf05b('0x18')]=function(_0x441a92){var _0x5195a5=this;return new Promise(function(_0x3c9942,_0x2e27d2){return db[_0xf05b('0x19')][_0xf05b('0x1a')](_0x441a92[_0xf05b('0x1b')],{'raw':_0x441a92[_0xf05b('0x8')]?_0x441a92['options'][_0xf05b('0x15')]===undefined?!![]:![]:!![]})['then'](function(_0x12ea39){logger[_0xf05b('0x16')](_0xf05b('0x18'),_0x441a92);logger[_0xf05b('0x10')]('CreateCmHopper',_0x441a92,JSON[_0xf05b('0x1c')](_0x12ea39));_0x3c9942(_0x12ea39);})[_0xf05b('0x17')](function(_0x21225d){logger[_0xf05b('0x11')](_0xf05b('0x18'),_0x21225d['message'],_0x441a92);_0x2e27d2(_0x5195a5[_0xf05b('0x11')](0x1f4,_0x21225d['message']));});});};exports['UpdateCmHopper']=function(_0x2d72a2){var _0x1fecdf=this;return new Promise(function(_0xc3eb39,_0x44d183){return db['CmHopper']['update'](_0x2d72a2[_0xf05b('0x1b')],{'raw':_0x2d72a2['options']?_0x2d72a2[_0xf05b('0x8')][_0xf05b('0x15')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2d72a2[_0xf05b('0x8')]?_0x2d72a2[_0xf05b('0x8')]['where']||null:null,'attributes':_0x2d72a2[_0xf05b('0x8')]?_0x2d72a2[_0xf05b('0x8')][_0xf05b('0xa')]||null:null,'limit':_0x2d72a2['options']?_0x2d72a2[_0xf05b('0x8')][_0xf05b('0xb')]||null:null})[_0xf05b('0xf')](function(_0x44dd57){logger[_0xf05b('0x16')](_0xf05b('0x1d'),_0x2d72a2);logger[_0xf05b('0x16')](_0xf05b('0x1e'),JSON['stringify'](_0x2d72a2[_0xf05b('0x8')][_0xf05b('0x9')]),_0x2d72a2[_0xf05b('0x1b')][_0xf05b('0x1f')]);logger['debug'](_0xf05b('0x1d'),_0x2d72a2,JSON[_0xf05b('0x1c')](_0x44dd57));_0xc3eb39(_0x44dd57);})[_0xf05b('0x17')](function(_0x5bde58){logger[_0xf05b('0x11')]('UpdateCmHopper',_0x5bde58[_0xf05b('0x12')],_0x2d72a2);_0x44d183(_0x1fecdf['error'](0x1f4,_0x5bde58['message']));});});};exports[_0xf05b('0x20')]=function(_0x408d33){var _0x5e3ae4=this;return new Promise(function(_0x52ed2b,_0x20748f){return db[_0xf05b('0x19')][_0xf05b('0x21')]({'where':_0x408d33[_0xf05b('0x8')]?_0x408d33[_0xf05b('0x8')][_0xf05b('0x9')]||null:null})[_0xf05b('0xf')](function(_0x57766c){logger[_0xf05b('0x16')](_0xf05b('0x20'),_0x408d33);logger[_0xf05b('0x10')](_0xf05b('0x20'),_0x408d33,JSON['stringify'](_0x57766c));_0x52ed2b(_0x57766c);})[_0xf05b('0x17')](function(_0x1441cc){logger[_0xf05b('0x11')](_0xf05b('0x20'),_0x1441cc[_0xf05b('0x12')],_0x408d33);_0x20748f(_0x5e3ae4['error'](0x1f4,_0x1441cc[_0xf05b('0x12')]));});});};exports[_0xf05b('0x22')]=function(_0x1300aa){var _0x222edc=this;return new Promise(function(_0x1267ac,_0x388211){return db[_0xf05b('0x23')][_0xf05b('0x24')]()[_0xf05b('0xf')](function(_0x260e71){return db[_0xf05b('0x25')][_0xf05b('0x26')](function(_0x4d9ad3){return db[_0xf05b('0x19')][_0xf05b('0x27')]({'where':_0x1300aa[_0xf05b('0x8')]?_0x1300aa['options'][_0xf05b('0x9')]||null:null,'attributes':_0x1300aa['options']?_0x1300aa['options']['attributes']||null:null,'limit':_0x1300aa['options']?_0x1300aa[_0xf05b('0x8')][_0xf05b('0xb')]||null:null,'order':_0x1300aa[_0xf05b('0x8')]?_0x1300aa[_0xf05b('0x8')][_0xf05b('0x28')]||null:null,'transaction':_0x4d9ad3,'lock':_0x4d9ad3['LOCK']['UPDATE'],'include':[{'model':db[_0xf05b('0x23')],'as':_0xf05b('0x29'),'attributes':_[_0xf05b('0x2a')](_0x260e71)},{'model':db['User'],'as':_0xf05b('0x2b'),'attributes':['id',_0xf05b('0x2c'),_0xf05b('0x2d')]}]})[_0xf05b('0xf')](function(_0x14e119){var _0x33760f=[];var _0x476599=[];for(var _0xb96a14=0x0;_0xb96a14<_0x14e119[_0xf05b('0x2e')];_0xb96a14+=0x1){var _0x44050a=_0x14e119[_0xb96a14][_0xf05b('0x2f')];if(_0x44050a===null){_0x33760f[_0xf05b('0x30')](_0x14e119[_0xb96a14][_0xf05b('0x31')](_0x1300aa[_0xf05b('0x1b')],{'transaction':_0x4d9ad3}));}else if(!_0x476599['includes'](_0x44050a)){_0x476599[_0xf05b('0x30')](_0x44050a);_0x33760f[_0xf05b('0x30')](_0x14e119[_0xb96a14][_0xf05b('0x31')](_0x1300aa[_0xf05b('0x1b')],{'transaction':_0x4d9ad3}));}}return BPromise[_0xf05b('0x32')](_0x33760f);});})[_0xf05b('0xf')](function(_0xbff09b){logger[_0xf05b('0x16')](_0xf05b('0x22'),_0x1300aa);if(_0xbff09b[_0xf05b('0x2e')]>0x0){logger[_0xf05b('0x16')]('GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]',_0xbff09b[0x0][_0xf05b('0x33')]['id'],_0xbff09b[0x0][_0xf05b('0x33')]['ContactId'],_0xbff09b[0x0][_0xf05b('0x33')][_0xf05b('0x1f')]);}logger[_0xf05b('0x10')](_0xf05b('0x22'),_0x1300aa,JSON[_0xf05b('0x1c')](_0xbff09b));_0x1267ac(_0xbff09b);})['catch'](function(_0x537ef5){logger[_0xf05b('0x11')](_0xf05b('0x22'),_0x537ef5[_0xf05b('0x12')],_0x1300aa);_0x388211(_0x222edc[_0xf05b('0x11')](0x1f4,_0x537ef5['message']));});});});};exports[_0xf05b('0x34')]=function(_0x3bddc7){var _0x5ae820=this;return new Promise(function(_0x4a85d0,_0x1f343f){return db[_0xf05b('0x25')][_0xf05b('0x26')](function(_0x3193c0){return db['CmHopperFinal'][_0xf05b('0x1a')](_0x3bddc7['body'],{'raw':_0x3bddc7[_0xf05b('0x8')]?_0x3bddc7[_0xf05b('0x8')][_0xf05b('0x15')]===undefined?!![]:![]:!![],'transaction':_0x3193c0})[_0xf05b('0xf')](function(){logger[_0xf05b('0x16')](_0xf05b('0x35'),JSON[_0xf05b('0x1c')](_0x3bddc7[_0xf05b('0x8')]['where']),_0x3bddc7[_0xf05b('0x8')][_0xf05b('0x9')][_0xf05b('0x1f')]);return db[_0xf05b('0x19')]['destroy']({'where':_0x3bddc7[_0xf05b('0x8')]?_0x3bddc7[_0xf05b('0x8')][_0xf05b('0x9')]||null:null,'transaction':_0x3193c0});});})[_0xf05b('0xf')](function(_0x13a234){logger[_0xf05b('0x16')](_0xf05b('0x34'),_0x3bddc7);logger[_0xf05b('0x10')](_0xf05b('0x34'),_0x3bddc7,JSON[_0xf05b('0x1c')](_0x13a234));_0x4a85d0(_0x13a234);})['catch'](function(_0x44aedd){logger[_0xf05b('0x11')](_0xf05b('0x34'),_0x44aedd['message'],_0x3bddc7);_0x1f343f(_0x5ae820[_0xf05b('0x11')](0x1f4,_0x44aedd[_0xf05b('0x12')]));});});};exports[_0xf05b('0x36')]=function(_0x4cdf23){var _0x2523c8=this;return new Promise(function(_0x388595,_0x13161c){return db[_0xf05b('0x19')][_0xf05b('0x27')]({'raw':_0x4cdf23[_0xf05b('0x8')]?_0x4cdf23['options']['raw']===undefined?!![]:![]:!![],'where':_0x4cdf23[_0xf05b('0x8')]?_0x4cdf23['options']['where']||null:null,'attributes':[[db['sequelize']['fn'](_0xf05b('0x37'),db[_0xf05b('0x25')]['fn']('IF',db[_0xf05b('0x25')][_0xf05b('0x38')](_0xf05b('0x39')+util[_0xf05b('0x3a')](_0xf05b('0x3b'),moment()[_0xf05b('0x3a')](_0xf05b('0x3c')))+_0xf05b('0x3d')))),_0xf05b('0x3e')]]})[_0xf05b('0xf')](function(_0x3956b4){logger[_0xf05b('0x16')](_0xf05b('0x36'),_0x4cdf23);logger[_0xf05b('0x10')](_0xf05b('0x36'),_0x4cdf23,JSON['stringify'](_0x3956b4));_0x388595(_0x3956b4);})[_0xf05b('0x17')](function(_0x5ee529){logger['error'](_0xf05b('0x36'),_0x5ee529[_0xf05b('0x12')],_0x4cdf23);_0x13161c(_0x2523c8['error'](0x1f4,_0x5ee529['message']));});});};exports[_0xf05b('0x3f')]=function(_0x4cab9f){var _0x227029=this;return new Promise(function(_0x1c4859,_0x16e459){return db[_0xf05b('0x23')][_0xf05b('0x24')]()['then'](function(){return db[_0xf05b('0x25')][_0xf05b('0x26')](function(_0x5e6669){return db['CmHopper'][_0xf05b('0x27')]({'where':_0x4cab9f['options']?_0x4cab9f['options']['where']||null:null,'attributes':_0x4cab9f[_0xf05b('0x8')]?_0x4cab9f[_0xf05b('0x8')]['attributes']||null:null,'limit':0x1,'order':_0x4cab9f[_0xf05b('0x8')]?_0x4cab9f['options'][_0xf05b('0x28')]||null:null,'group':db[_0xf05b('0x19')][_0xf05b('0x2f')],'transaction':_0x5e6669,'lock':_0x5e6669[_0xf05b('0x40')][_0xf05b('0x41')],'include':_0x4cab9f[_0xf05b('0x8')]?_0x4cab9f['options']['include']?_[_0xf05b('0xd')](_0x4cab9f[_0xf05b('0x8')][_0xf05b('0xc')],function(_0x2ce175){return{'model':db[_0x2ce175['model']],'as':_0x2ce175['as'],'attributes':_0x2ce175['attributes'],'include':_0x2ce175[_0xf05b('0xc')]?_[_0xf05b('0xd')](_0x2ce175['include'],function(_0x30e85b){return{'model':db[_0x30e85b[_0xf05b('0xe')]],'as':_0x30e85b['as'],'attributes':_0x30e85b[_0xf05b('0xa')],'include':_0x30e85b[_0xf05b('0xc')]?_[_0xf05b('0xd')](_0x30e85b[_0xf05b('0xc')],function(_0x2c40c7){return{'model':db[_0x2c40c7[_0xf05b('0xe')]],'as':_0x2c40c7['as'],'attributes':_0x2c40c7['attributes']};}):[]};}):[]};}):[]:[]})[_0xf05b('0xf')](function(_0x136c20){var _0x53e477=[];for(var _0x2f4ca2=0x0;_0x2f4ca2<_0x136c20[_0xf05b('0x2e')];_0x2f4ca2+=0x1){_0x53e477[_0xf05b('0x30')](_0x136c20[_0x2f4ca2][_0xf05b('0x31')](_0x4cab9f[_0xf05b('0x1b')],{'transaction':_0x5e6669}));}return BPromise['all'](_0x53e477);});})[_0xf05b('0xf')](function(_0x3e7da7){logger[_0xf05b('0x16')](_0xf05b('0x3f'),_0x4cab9f);logger[_0xf05b('0x10')](_0xf05b('0x3f'),_0x4cab9f,JSON[_0xf05b('0x1c')](_0x3e7da7));_0x1c4859(_0x3e7da7);})[_0xf05b('0x17')](function(_0x4e44ed){logger['error'](_0xf05b('0x3f'),_0x4e44ed[_0xf05b('0x12')],_0x4cab9f);_0x16e459(_0x227029[_0xf05b('0x11')](0x1f4,_0x4e44ed[_0xf05b('0x12')]));});});});};exports[_0xf05b('0x42')]=function(_0x39d522){var _0x46d0a2=this;return new Promise(function(_0x4cabe4,_0x5011fa){db[_0xf05b('0x23')]['describe']()[_0xf05b('0xf')](function(_0x48288f){return db[_0xf05b('0x19')][_0xf05b('0x27')]({'raw':_0x39d522[_0xf05b('0x8')]?_0x39d522[_0xf05b('0x8')][_0xf05b('0x15')]===undefined?!![]:![]:!![],'where':_0x39d522['options']?_0x39d522['options']['where']||null:null,'attributes':_0x39d522[_0xf05b('0x8')]?_0x39d522[_0xf05b('0x8')][_0xf05b('0xa')]||null:null,'limit':_0x39d522[_0xf05b('0x8')]?_0x39d522[_0xf05b('0x8')][_0xf05b('0xb')]||null:null,'include':_0x39d522[_0xf05b('0x8')]?_0x39d522['options'][_0xf05b('0xc')]?_['map'](_0x39d522[_0xf05b('0x8')]['include'],function(_0x3e1b89){return{'model':db[_0x3e1b89[_0xf05b('0xe')]],'as':_0x3e1b89['as'],'attributes':_0x3e1b89['as']===_0xf05b('0x29')?_[_0xf05b('0x2a')](_0x48288f):_0x3e1b89[_0xf05b('0xa')],'include':_0x3e1b89[_0xf05b('0xc')]?_[_0xf05b('0xd')](_0x3e1b89[_0xf05b('0xc')],function(_0x2d2d77){return{'model':db[_0x2d2d77[_0xf05b('0xe')]],'as':_0x2d2d77['as'],'attributes':_0x2d2d77[_0xf05b('0xa')],'include':_0x2d2d77['include']?_['map'](_0x2d2d77[_0xf05b('0xc')],function(_0x1e6fdb){return{'model':db[_0x1e6fdb['model']],'as':_0x1e6fdb['as'],'attributes':_0x1e6fdb[_0xf05b('0xa')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x36ab78){logger[_0xf05b('0x16')]('GetCmHopper',_0x39d522);logger[_0xf05b('0x10')](_0xf05b('0x7'),_0x39d522,JSON['stringify'](_0x36ab78));_0x4cabe4(_0x36ab78);})[_0xf05b('0x17')](function(_0x31ea4b){logger[_0xf05b('0x11')](_0xf05b('0x7'),_0x31ea4b[_0xf05b('0x12')],_0x39d522);_0x5011fa(_0x46d0a2[_0xf05b('0x11')](0x1f4,_0x31ea4b['message']));});});});};exports['GetContactByPhone']=function(_0x1db52c){var _0x5e6069=this;return new Promise(function(_0x5ce65a,_0x3162b0){return db[_0xf05b('0x23')][_0xf05b('0x43')]({'raw':!![],'where':{'phone':_0x1db52c[_0xf05b('0x8')][_0xf05b('0x9')][_0xf05b('0x44')]},'attributes':['id',_0xf05b('0x45')],'order':[['id',_0xf05b('0x46')]]})[_0xf05b('0xf')](function(_0x40d2e6){logger[_0xf05b('0x16')](_0xf05b('0x47'),_0x1db52c);logger[_0xf05b('0x10')]('getContactByPhone',_0x1db52c,JSON[_0xf05b('0x1c')](_0x40d2e6));_0x5ce65a(_0x40d2e6);})[_0xf05b('0x17')](function(_0x9e14d8){logger[_0xf05b('0x11')](_0xf05b('0x47'),_0x9e14d8[_0xf05b('0x12')],_0x1db52c);_0x3162b0(_0x5e6069[_0xf05b('0x11')](0x1f4,_0x9e14d8[_0xf05b('0x12')]));});});};exports['ResetActiveCalls']=function(_0x13a756){var _0x12ef9f=this;return new Promise(function(_0x4faa5f,_0x437265){return db['sequelize']['transaction'](function(_0x79e74e){var _0x58b044=_0x13a756['options']&&_0x13a756['options']['where']?_0x13a756[_0xf05b('0x8')]['where']:{};return db[_0xf05b('0x19')][_0xf05b('0x31')](_0x13a756['body'],{'where':_0x58b044,'transaction':_0x79e74e})['then'](function(_0x411c10){logger[_0xf05b('0x16')](_0xf05b('0x48'),_0x13a756);logger['debug'](_0xf05b('0x48'),_0x13a756,JSON[_0xf05b('0x1c')](_0x411c10));_0x4faa5f(_0x411c10);})['catch'](function(_0x55a720){logger['error'](_0xf05b('0x48'),_0x55a720[_0xf05b('0x12')],_0x13a756);_0x437265(_0x12ef9f['error'](0x1f4,_0x55a720[_0xf05b('0x12')]));});});});};exports[_0xf05b('0x49')]=function(_0x163e38){var _0x135f47=this;var _0xbf7c99=_0x163e38['body'][_0xf05b('0x9')][_0xf05b('0x4a')];var _0x234fe2=_0x163e38['body'][_0xf05b('0x9')][_0xf05b('0x4b')];var _0x5edd43=_0x163e38['body'][_0xf05b('0x9')][_0xf05b('0x4c')];return new Promise(function(_0x34c930,_0x563376){return db['CmHopper'][_0xf05b('0x27')]({'where':{'voiceQueueId':{'$in':_0xbf7c99},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0xf05b('0x25')][_0xf05b('0x38')](_0xf05b('0x4d')+_0x234fe2+_0xf05b('0x4e')),'$gt':db[_0xf05b('0x25')][_0xf05b('0x38')](_0xf05b('0x4f'))}},'UserId':{'$in':_0x5edd43}},'include':[{'model':db[_0xf05b('0x23')],'as':_0xf05b('0x29')},{'model':db[_0xf05b('0x50')],'as':'Agent','attributes':['id',_0xf05b('0x2c'),_0xf05b('0x2d')]},{'model':db[_0xf05b('0x51')],'as':_0xf05b('0x52')}]})[_0xf05b('0xf')](function(_0x3df0aa){if(_0x3df0aa[_0xf05b('0x2e')]>0x0){return db[_0xf05b('0x25')][_0xf05b('0x26')](function(_0x4d56bf){return db['CmHopper'][_0xf05b('0x31')]({'recallmeNotifiedDate':db[_0xf05b('0x25')][_0xf05b('0x38')](_0xf05b('0x4f'))},{'where':{'id':{'$in':_[_0xf05b('0xd')](_0x3df0aa,'id')}},'transaction':_0x4d56bf})[_0xf05b('0xf')](function(){_0x34c930(_0x3df0aa);})[_0xf05b('0x17')](function(_0x9e4443){logger['error']('CmHopperHandlePreviewRecallNotifications',_0x9e4443[_0xf05b('0x12')],_0x163e38);_0x563376(_0x135f47[_0xf05b('0x11')](0x1f4,_0x9e4443[_0xf05b('0x12')]));});})[_0xf05b('0x17')](function(_0x3451d8){logger[_0xf05b('0x11')](_0xf05b('0x49'),_0x3451d8[_0xf05b('0x12')],_0x163e38);_0x563376(_0x135f47['error'](0x1f4,_0x3451d8['message']));});}else{_0x34c930(_0x3df0aa);}});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index d07d065..9cd4388 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 _0x5327=['post','/preview','/timezone','getTimezone','put','update','delete','exports','Router','../../components/auth/service','./cmHopper.controller','get','/describe','describe','getOpenContacts','/timezones','isAuthenticated','/:id','/:id/previewrecall','getPreviewRecall'];(function(_0x257642,_0x270a80){var _0x3d813b=function(_0x2a1c8a){while(--_0x2a1c8a){_0x257642['push'](_0x257642['shift']());}};_0x3d813b(++_0x270a80);}(_0x5327,0xbc));var _0x7532=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5327[_0x3dd15e];return _0x231fd0;};'use strict';var express=require('express');var router=express[_0x7532('0x0')]();var auth=require(_0x7532('0x1'));var controller=require(_0x7532('0x2'));router[_0x7532('0x3')]('/',auth['isAuthenticated'](),controller['index']);router[_0x7532('0x3')](_0x7532('0x4'),auth['isAuthenticated'](),controller[_0x7532('0x5')]);router[_0x7532('0x3')]('/opencontacts',auth['isAuthenticated'](),controller[_0x7532('0x6')]);router[_0x7532('0x3')](_0x7532('0x7'),auth[_0x7532('0x8')](),controller['getTimezones']);router[_0x7532('0x3')](_0x7532('0x9'),auth[_0x7532('0x8')](),controller['show']);router[_0x7532('0x3')](_0x7532('0xa'),auth[_0x7532('0x8')](),controller[_0x7532('0xb')]);router[_0x7532('0xc')]('/',auth[_0x7532('0x8')](),controller['create']);router[_0x7532('0xc')](_0x7532('0xd'),auth[_0x7532('0x8')](),controller['getPreview']);router[_0x7532('0xc')](_0x7532('0xe'),auth[_0x7532('0x8')](),controller[_0x7532('0xf')]);router[_0x7532('0x10')](_0x7532('0x9'),auth['isAuthenticated'](),controller[_0x7532('0x11')]);router[_0x7532('0x12')](_0x7532('0x9'),auth['isAuthenticated'](),controller['destroy']);module[_0x7532('0x13')]=router; \ No newline at end of file +var _0x386d=['create','/preview','getPreview','/timezone','getTimezone','put','update','delete','exports','../../components/auth/service','./cmHopper.controller','get','isAuthenticated','index','/describe','/opencontacts','getOpenContacts','getTimezones','/:id','/:id/previewrecall','getPreviewRecall','post'];(function(_0x12045a,_0x65b4f5){var _0x4d4ceb=function(_0x416c0b){while(--_0x416c0b){_0x12045a['push'](_0x12045a['shift']());}};_0x4d4ceb(++_0x65b4f5);}(_0x386d,0x195));var _0xd386=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x386d[_0xa464c9];return _0x3d73c4;};'use strict';var express=require('express');var router=express['Router']();var auth=require(_0xd386('0x0'));var controller=require(_0xd386('0x1'));router[_0xd386('0x2')]('/',auth[_0xd386('0x3')](),controller[_0xd386('0x4')]);router['get'](_0xd386('0x5'),auth[_0xd386('0x3')](),controller['describe']);router[_0xd386('0x2')](_0xd386('0x6'),auth[_0xd386('0x3')](),controller[_0xd386('0x7')]);router['get']('/timezones',auth[_0xd386('0x3')](),controller[_0xd386('0x8')]);router[_0xd386('0x2')](_0xd386('0x9'),auth['isAuthenticated'](),controller['show']);router[_0xd386('0x2')](_0xd386('0xa'),auth['isAuthenticated'](),controller[_0xd386('0xb')]);router[_0xd386('0xc')]('/',auth['isAuthenticated'](),controller[_0xd386('0xd')]);router[_0xd386('0xc')](_0xd386('0xe'),auth[_0xd386('0x3')](),controller[_0xd386('0xf')]);router[_0xd386('0xc')](_0xd386('0x10'),auth['isAuthenticated'](),controller[_0xd386('0x11')]);router[_0xd386('0x12')](_0xd386('0x9'),auth['isAuthenticated'](),controller[_0xd386('0x13')]);router[_0xd386('0x14')](_0xd386('0x9'),auth[_0xd386('0x3')](),controller['destroy']);module[_0xd386('0x15')]=router; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js index 42427e5..556962e 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 _0x1b15=['exports','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','moment','sequelize'];(function(_0x29ebf4,_0x38489d){var _0x18f197=function(_0x4449c3){while(--_0x4449c3){_0x29ebf4['push'](_0x29ebf4['shift']());}};_0x18f197(++_0x38489d);}(_0x1b15,0x70));var _0x51b1=function(_0x11ce8f,_0x3843af){_0x11ce8f=_0x11ce8f-0x0;var _0x458cfa=_0x1b15[_0x11ce8f];return _0x458cfa;};'use strict';var moment=require(_0x51b1('0x0'));var Sequelize=require(_0x51b1('0x1'));module[_0x51b1('0x2')]={'CmHopperId':{'type':Sequelize['INTEGER']},'phone':{'type':Sequelize['STRING'],'allowNull':![]},'OrderBy':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()[_0x51b1('0x3')](_0x51b1('0x4'))},'countbusyretry':{'type':Sequelize[_0x51b1('0x5')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x51b1('0x5')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x51b1('0x5')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x51b1('0x5')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x43be=['exports','DATE','YYYY-MM-DD\x20HH:mm:ss','INTEGER','sequelize'];(function(_0x160e72,_0x270492){var _0x57c04f=function(_0x27067e){while(--_0x27067e){_0x160e72['push'](_0x160e72['shift']());}};_0x57c04f(++_0x270492);}(_0x43be,0x130));var _0xe43b=function(_0xdb0cc5,_0x33653a){_0xdb0cc5=_0xdb0cc5-0x0;var _0x153aa=_0x43be[_0xdb0cc5];return _0x153aa;};'use strict';var moment=require('moment');var Sequelize=require(_0xe43b('0x0'));module[_0xe43b('0x1')]={'CmHopperId':{'type':Sequelize['INTEGER']},'phone':{'type':Sequelize['STRING'],'allowNull':![]},'OrderBy':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0xe43b('0x2')],'defaultValue':moment()['format'](_0xe43b('0x3'))},'countbusyretry':{'type':Sequelize[_0xe43b('0x4')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xe43b('0x4')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xe43b('0x4')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0xe43b('0x4')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xe43b('0x4')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xe43b('0x4')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xe43b('0x4')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xe43b('0x4')],'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 86ffd3a..63095b8 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 _0x427a=['name','send','index','map','fieldName','type','model','keys','query','intersection','attributes','length','limit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','include','CmHopperAdditionalPhone','findAll','rows','show','params','rawAttributes','fields','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','undefined','count','offset','Content-Range','json','apply','reject','update','then','destroy','CmHopperAdditionalPhones','UserProfileResource','error'];(function(_0x1465c1,_0xa8fd77){var _0x104621=function(_0x2bd254){while(--_0x2bd254){_0x1465c1['push'](_0x1465c1['shift']());}};_0x104621(++_0xa8fd77);}(_0x427a,0x78));var _0xa427=function(_0xb97764,_0x59a156){_0xb97764=_0xb97764-0x0;var _0x801c6f=_0x427a[_0xb97764];return _0x801c6f;};'use strict';var emlformat=require(_0xa427('0x0'));var rimraf=require(_0xa427('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa427('0x2'));var rp=require(_0xa427('0x3'));var moment=require(_0xa427('0x4'));var BPromise=require(_0xa427('0x5'));var Mustache=require('mustache');var util=require(_0xa427('0x6'));var path=require(_0xa427('0x7'));var sox=require(_0xa427('0x8'));var csv=require(_0xa427('0x9'));var ejs=require(_0xa427('0xa'));var fs=require('fs');var fs_extra=require(_0xa427('0xb'));var _=require(_0xa427('0xc'));var squel=require('squel');var crypto=require(_0xa427('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xa427('0xe'));var toCsv=require('to-csv');var querystring=require(_0xa427('0xf'));var Papa=require(_0xa427('0x10'));var Redis=require('ioredis');var authService=require(_0xa427('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa427('0x12'));var logger=require(_0xa427('0x13'))(_0xa427('0x14'));var utils=require(_0xa427('0x15'));var config=require(_0xa427('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xa427('0x17'))['db'];function respondWithStatusCode(_0x2fa3e4,_0x334f2a){_0x334f2a=_0x334f2a||0xcc;return function(_0x2880fb){if(_0x2880fb){return _0x2fa3e4[_0xa427('0x18')](_0x334f2a);}return _0x2fa3e4[_0xa427('0x19')](_0x334f2a)[_0xa427('0x1a')]();};}function respondWithResult(_0x1838b1,_0x4fa5be){_0x4fa5be=_0x4fa5be||0xc8;return function(_0x2a06a0){if(_0x2a06a0){return _0x1838b1[_0xa427('0x19')](_0x4fa5be)['json'](_0x2a06a0);}};}function respondWithFilteredResult(_0x3c59fd,_0x10104a){return function(_0x26dc91){if(_0x26dc91){var _0x3e2146=typeof _0x10104a['offset']===_0xa427('0x1b')&&typeof _0x10104a['limit']===_0xa427('0x1b');var _0x9cf76d=_0x26dc91[_0xa427('0x1c')];var _0x23c2f2=_0x3e2146?0x0:_0x10104a[_0xa427('0x1d')];var _0x59a635=_0x3e2146?_0x26dc91[_0xa427('0x1c')]:_0x10104a['offset']+_0x10104a['limit'];var _0x5a198f;if(_0x59a635>=_0x9cf76d){_0x59a635=_0x9cf76d;_0x5a198f=0xc8;}else{_0x5a198f=0xce;}_0x3c59fd[_0xa427('0x19')](_0x5a198f);return _0x3c59fd['set'](_0xa427('0x1e'),_0x23c2f2+'-'+_0x59a635+'/'+_0x9cf76d)[_0xa427('0x1f')](_0x26dc91);}return null;};}function patchUpdates(_0x65ee2b){return function(_0x566cc6){try{jsonpatch[_0xa427('0x20')](_0x566cc6,_0x65ee2b,!![]);}catch(_0xa1502a){return BPromise[_0xa427('0x21')](_0xa1502a);}return _0x566cc6['save']();};}function saveUpdates(_0x3b9e2f,_0x753935){return function(_0x397898){if(_0x397898){return _0x397898[_0xa427('0x22')](_0x3b9e2f)[_0xa427('0x23')](function(_0x6df776){return _0x6df776;});}return null;};}function removeEntity(_0x1d105f,_0x139b7e){return function(_0x53a28b){if(_0x53a28b){return _0x53a28b[_0xa427('0x24')]()[_0xa427('0x23')](function(){var _0x23a2ff=_0x53a28b['get']({'plain':!![]});var _0x44608f=_0xa427('0x25');return db[_0xa427('0x26')][_0xa427('0x24')]({'where':{'type':_0x44608f,'resourceId':_0x23a2ff['id']}})[_0xa427('0x23')](function(){return _0x53a28b;});})[_0xa427('0x23')](function(){_0x1d105f[_0xa427('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x727019,_0x244adc){return function(_0x51b64a){if(!_0x51b64a){_0x727019[_0xa427('0x18')](0x194);}return _0x51b64a;};}function handleError(_0x1e8022,_0xc6c486){_0xc6c486=_0xc6c486||0x1f4;return function(_0x5b8226){logger[_0xa427('0x27')](_0x5b8226['stack']);if(_0x5b8226[_0xa427('0x28')]){delete _0x5b8226[_0xa427('0x28')];}_0x1e8022[_0xa427('0x19')](_0xc6c486)[_0xa427('0x29')](_0x5b8226);};}exports[_0xa427('0x2a')]=function(_0x46fe55,_0x456511){var _0x4f25f7={},_0x48511c={},_0x5d10e4={'count':0x0,'rows':[]};var _0x501ac5=_[_0xa427('0x2b')](db['CmHopperAdditionalPhone']['rawAttributes'],function(_0x573e0e){return{'name':_0x573e0e[_0xa427('0x2c')],'type':_0x573e0e[_0xa427('0x2d')]['key']};});_0x48511c[_0xa427('0x2e')]=_[_0xa427('0x2b')](_0x501ac5,_0xa427('0x28'));_0x48511c['query']=_[_0xa427('0x2f')](_0x46fe55[_0xa427('0x30')]);_0x48511c['filters']=_[_0xa427('0x31')](_0x48511c[_0xa427('0x2e')],_0x48511c[_0xa427('0x30')]);_0x4f25f7[_0xa427('0x32')]=_['intersection'](_0x48511c[_0xa427('0x2e')],qs['fields'](_0x46fe55[_0xa427('0x30')]['fields']));_0x4f25f7[_0xa427('0x32')]=_0x4f25f7[_0xa427('0x32')][_0xa427('0x33')]?_0x4f25f7[_0xa427('0x32')]:_0x48511c['model'];if(!_0x46fe55[_0xa427('0x30')]['hasOwnProperty']('nolimit')){_0x4f25f7['limit']=qs[_0xa427('0x34')](_0x46fe55[_0xa427('0x30')][_0xa427('0x34')]);_0x4f25f7['offset']=qs[_0xa427('0x1d')](_0x46fe55[_0xa427('0x30')][_0xa427('0x1d')]);}_0x4f25f7[_0xa427('0x35')]=qs['sort'](_0x46fe55[_0xa427('0x30')][_0xa427('0x36')]);_0x4f25f7[_0xa427('0x37')]=qs[_0xa427('0x38')](_[_0xa427('0x39')](_0x46fe55[_0xa427('0x30')],_0x48511c['filters']),_0x501ac5);if(_0x46fe55[_0xa427('0x30')]['filter']){_0x4f25f7[_0xa427('0x37')]=_[_0xa427('0x3a')](_0x4f25f7[_0xa427('0x37')],{'$or':_[_0xa427('0x2b')](_0x501ac5,function(_0x44f24b){if(_0x44f24b['type']!==_0xa427('0x3b')){var _0x3b2de7={};_0x3b2de7[_0x44f24b['name']]={'$like':'%'+_0x46fe55[_0xa427('0x30')][_0xa427('0x3c')]+'%'};return _0x3b2de7;}})});}_0x4f25f7=_[_0xa427('0x3a')]({},_0x4f25f7,_0x46fe55[_0xa427('0x3d')]);var _0x193c54={'where':_0x4f25f7['where']};return db['CmHopperAdditionalPhone']['count'](_0x193c54)[_0xa427('0x23')](function(_0x230aa5){_0x5d10e4[_0xa427('0x1c')]=_0x230aa5;if(_0x46fe55[_0xa427('0x30')]['includeAll']){_0x4f25f7[_0xa427('0x3e')]=[{'all':!![]}];}return db[_0xa427('0x3f')][_0xa427('0x40')](_0x4f25f7);})[_0xa427('0x23')](function(_0x41476a){_0x5d10e4[_0xa427('0x41')]=_0x41476a;return _0x5d10e4;})[_0xa427('0x23')](respondWithFilteredResult(_0x456511,_0x4f25f7))['catch'](handleError(_0x456511,null));};exports[_0xa427('0x42')]=function(_0x3b51aa,_0x14c57d){var _0x33c086={'raw':!![],'where':{'id':_0x3b51aa[_0xa427('0x43')]['id']}},_0x322b6a={};_0x322b6a[_0xa427('0x2e')]=_[_0xa427('0x2f')](db[_0xa427('0x3f')][_0xa427('0x44')]);_0x322b6a['query']=_[_0xa427('0x2f')](_0x3b51aa[_0xa427('0x30')]);_0x322b6a[_0xa427('0x38')]=_['intersection'](_0x322b6a[_0xa427('0x2e')],_0x322b6a['query']);_0x33c086[_0xa427('0x32')]=_[_0xa427('0x31')](_0x322b6a[_0xa427('0x2e')],qs[_0xa427('0x45')](_0x3b51aa[_0xa427('0x30')][_0xa427('0x45')]));_0x33c086[_0xa427('0x32')]=_0x33c086[_0xa427('0x32')][_0xa427('0x33')]?_0x33c086[_0xa427('0x32')]:_0x322b6a[_0xa427('0x2e')];if(_0x3b51aa[_0xa427('0x30')]['includeAll']){_0x33c086['include']=[{'all':!![]}];}_0x33c086=_[_0xa427('0x3a')]({},_0x33c086,_0x3b51aa[_0xa427('0x3d')]);return db[_0xa427('0x3f')][_0xa427('0x46')](_0x33c086)[_0xa427('0x23')](handleEntityNotFound(_0x14c57d,null))['then'](respondWithResult(_0x14c57d,null))[_0xa427('0x47')](handleError(_0x14c57d,null));};exports[_0xa427('0x48')]=function(_0x312a78,_0x1b15a8){return db[_0xa427('0x3f')][_0xa427('0x48')](_0x312a78[_0xa427('0x49')],{})['then'](function(_0x550f86){var _0x42626a=_0x312a78[_0xa427('0x4a')]['get']({'plain':!![]});if(!_0x42626a)throw new Error(_0xa427('0x4b'));if(_0x42626a[_0xa427('0x4c')]===_0xa427('0x4a')){var _0xf22db5=_0x550f86[_0xa427('0x4d')]({'plain':!![]});var _0x5e90f5=_0xa427('0x25');return db['UserProfileSection']['find']({'where':{'name':_0x5e90f5,'userProfileId':_0x42626a[_0xa427('0x4e')]},'raw':!![]})['then'](function(_0x3356d2){if(_0x3356d2&&_0x3356d2['autoAssociation']===0x0){return db[_0xa427('0x26')][_0xa427('0x48')]({'name':_0xf22db5['name'],'resourceId':_0xf22db5['id'],'type':_0x3356d2[_0xa427('0x28')],'sectionId':_0x3356d2['id']},{})[_0xa427('0x23')](function(){return _0x550f86;});}else{return _0x550f86;}})['catch'](function(_0x2db310){logger[_0xa427('0x27')](_0xa427('0x4f'),_0x2db310);throw _0x2db310;});}return _0x550f86;})[_0xa427('0x23')](respondWithResult(_0x1b15a8,0xc9))['catch'](handleError(_0x1b15a8,null));};exports[_0xa427('0x22')]=function(_0x4092a5,_0xdfc470){if(_0x4092a5[_0xa427('0x49')]['id']){delete _0x4092a5[_0xa427('0x49')]['id'];}return db[_0xa427('0x3f')][_0xa427('0x46')]({'where':{'id':_0x4092a5[_0xa427('0x43')]['id']}})[_0xa427('0x23')](handleEntityNotFound(_0xdfc470,null))[_0xa427('0x23')](saveUpdates(_0x4092a5['body'],null))[_0xa427('0x23')](respondWithResult(_0xdfc470,null))['catch'](handleError(_0xdfc470,null));};exports['destroy']=function(_0x34682c,_0x159d1d){return db[_0xa427('0x3f')][_0xa427('0x46')]({'where':{'id':_0x34682c['params']['id']}})['then'](handleEntityNotFound(_0x159d1d,null))[_0xa427('0x23')](removeEntity(_0x159d1d,null))['catch'](handleError(_0x159d1d,null));}; \ No newline at end of file +var _0x334b=['name','send','index','map','CmHopperAdditionalPhone','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','catch','show','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','params','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','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','offset','undefined','count','set','Content-Range','json','apply','reject','save','update','then','destroy','CmHopperAdditionalPhones','UserProfileResource','error'];(function(_0x3b632f,_0x453380){var _0x10e788=function(_0x2228a4){while(--_0x2228a4){_0x3b632f['push'](_0x3b632f['shift']());}};_0x10e788(++_0x453380);}(_0x334b,0x189));var _0xb334=function(_0x149dc4,_0x521346){_0x149dc4=_0x149dc4-0x0;var _0x13233e=_0x334b[_0x149dc4];return _0x13233e;};'use strict';var emlformat=require(_0xb334('0x0'));var rimraf=require(_0xb334('0x1'));var zipdir=require(_0xb334('0x2'));var jsonpatch=require(_0xb334('0x3'));var rp=require(_0xb334('0x4'));var moment=require(_0xb334('0x5'));var BPromise=require(_0xb334('0x6'));var Mustache=require(_0xb334('0x7'));var util=require(_0xb334('0x8'));var path=require(_0xb334('0x9'));var sox=require(_0xb334('0xa'));var csv=require(_0xb334('0xb'));var ejs=require(_0xb334('0xc'));var fs=require('fs');var fs_extra=require(_0xb334('0xd'));var _=require(_0xb334('0xe'));var squel=require(_0xb334('0xf'));var crypto=require(_0xb334('0x10'));var jsforce=require(_0xb334('0x11'));var deskjs=require(_0xb334('0x12'));var toCsv=require('to-csv');var querystring=require(_0xb334('0x13'));var Papa=require(_0xb334('0x14'));var Redis=require('ioredis');var authService=require(_0xb334('0x15'));var qs=require(_0xb334('0x16'));var as=require(_0xb334('0x17'));var hardwareService=require(_0xb334('0x18'));var logger=require(_0xb334('0x19'))('api');var utils=require(_0xb334('0x1a'));var config=require(_0xb334('0x1b'));var licenseUtil=require('../../config/license/util');var db=require(_0xb334('0x1c'))['db'];function respondWithStatusCode(_0x334750,_0xc5360b){_0xc5360b=_0xc5360b||0xcc;return function(_0x14be19){if(_0x14be19){return _0x334750[_0xb334('0x1d')](_0xc5360b);}return _0x334750['status'](_0xc5360b)[_0xb334('0x1e')]();};}function respondWithResult(_0x48e1fa,_0x5a3cf3){_0x5a3cf3=_0x5a3cf3||0xc8;return function(_0x3c06ed){if(_0x3c06ed){return _0x48e1fa[_0xb334('0x1f')](_0x5a3cf3)['json'](_0x3c06ed);}};}function respondWithFilteredResult(_0x4f2990,_0x326843){return function(_0x16bc67){if(_0x16bc67){var _0x3bee56=typeof _0x326843[_0xb334('0x20')]===_0xb334('0x21')&&typeof _0x326843['limit']===_0xb334('0x21');var _0x4cc0ba=_0x16bc67[_0xb334('0x22')];var _0x3706a7=_0x3bee56?0x0:_0x326843[_0xb334('0x20')];var _0x517e8f=_0x3bee56?_0x16bc67[_0xb334('0x22')]:_0x326843[_0xb334('0x20')]+_0x326843['limit'];var _0x244b06;if(_0x517e8f>=_0x4cc0ba){_0x517e8f=_0x4cc0ba;_0x244b06=0xc8;}else{_0x244b06=0xce;}_0x4f2990['status'](_0x244b06);return _0x4f2990[_0xb334('0x23')](_0xb334('0x24'),_0x3706a7+'-'+_0x517e8f+'/'+_0x4cc0ba)[_0xb334('0x25')](_0x16bc67);}return null;};}function patchUpdates(_0x4bd6f6){return function(_0x5bb026){try{jsonpatch[_0xb334('0x26')](_0x5bb026,_0x4bd6f6,!![]);}catch(_0x4dc01e){return BPromise[_0xb334('0x27')](_0x4dc01e);}return _0x5bb026[_0xb334('0x28')]();};}function saveUpdates(_0x40645e,_0x34ea43){return function(_0x5e9ed5){if(_0x5e9ed5){return _0x5e9ed5[_0xb334('0x29')](_0x40645e)[_0xb334('0x2a')](function(_0x1d1ed0){return _0x1d1ed0;});}return null;};}function removeEntity(_0x5e5b05,_0x4afca5){return function(_0x5a766c){if(_0x5a766c){return _0x5a766c[_0xb334('0x2b')]()['then'](function(){var _0x34a96a=_0x5a766c['get']({'plain':!![]});var _0x2942d6=_0xb334('0x2c');return db[_0xb334('0x2d')][_0xb334('0x2b')]({'where':{'type':_0x2942d6,'resourceId':_0x34a96a['id']}})['then'](function(){return _0x5a766c;});})[_0xb334('0x2a')](function(){_0x5e5b05['status'](0xcc)[_0xb334('0x1e')]();});}};}function handleEntityNotFound(_0x3855e4,_0x4c4a93){return function(_0x2339a6){if(!_0x2339a6){_0x3855e4[_0xb334('0x1d')](0x194);}return _0x2339a6;};}function handleError(_0x351e37,_0x5d16e6){_0x5d16e6=_0x5d16e6||0x1f4;return function(_0x52097f){logger[_0xb334('0x2e')](_0x52097f['stack']);if(_0x52097f[_0xb334('0x2f')]){delete _0x52097f['name'];}_0x351e37[_0xb334('0x1f')](_0x5d16e6)[_0xb334('0x30')](_0x52097f);};}exports[_0xb334('0x31')]=function(_0x440c79,_0x3c9550){var _0x2fa9b1={},_0x13f4b4={},_0x1f35a6={'count':0x0,'rows':[]};var _0x4b4da0=_[_0xb334('0x32')](db[_0xb334('0x33')][_0xb334('0x34')],function(_0x54c3ba){return{'name':_0x54c3ba[_0xb334('0x35')],'type':_0x54c3ba['type'][_0xb334('0x36')]};});_0x13f4b4[_0xb334('0x37')]=_['map'](_0x4b4da0,_0xb334('0x2f'));_0x13f4b4['query']=_[_0xb334('0x38')](_0x440c79[_0xb334('0x39')]);_0x13f4b4[_0xb334('0x3a')]=_[_0xb334('0x3b')](_0x13f4b4['model'],_0x13f4b4[_0xb334('0x39')]);_0x2fa9b1[_0xb334('0x3c')]=_['intersection'](_0x13f4b4[_0xb334('0x37')],qs[_0xb334('0x3d')](_0x440c79[_0xb334('0x39')][_0xb334('0x3d')]));_0x2fa9b1[_0xb334('0x3c')]=_0x2fa9b1[_0xb334('0x3c')][_0xb334('0x3e')]?_0x2fa9b1[_0xb334('0x3c')]:_0x13f4b4['model'];if(!_0x440c79[_0xb334('0x39')]['hasOwnProperty'](_0xb334('0x3f'))){_0x2fa9b1[_0xb334('0x40')]=qs[_0xb334('0x40')](_0x440c79[_0xb334('0x39')][_0xb334('0x40')]);_0x2fa9b1[_0xb334('0x20')]=qs['offset'](_0x440c79[_0xb334('0x39')][_0xb334('0x20')]);}_0x2fa9b1[_0xb334('0x41')]=qs[_0xb334('0x42')](_0x440c79[_0xb334('0x39')]['sort']);_0x2fa9b1[_0xb334('0x43')]=qs[_0xb334('0x3a')](_[_0xb334('0x44')](_0x440c79[_0xb334('0x39')],_0x13f4b4['filters']),_0x4b4da0);if(_0x440c79[_0xb334('0x39')]['filter']){_0x2fa9b1[_0xb334('0x43')]=_[_0xb334('0x45')](_0x2fa9b1[_0xb334('0x43')],{'$or':_[_0xb334('0x32')](_0x4b4da0,function(_0x16ff08){if(_0x16ff08['type']!==_0xb334('0x46')){var _0xbdbce8={};_0xbdbce8[_0x16ff08[_0xb334('0x2f')]]={'$like':'%'+_0x440c79[_0xb334('0x39')][_0xb334('0x47')]+'%'};return _0xbdbce8;}})});}_0x2fa9b1=_[_0xb334('0x45')]({},_0x2fa9b1,_0x440c79[_0xb334('0x48')]);var _0x3f611f={'where':_0x2fa9b1['where']};return db[_0xb334('0x33')][_0xb334('0x22')](_0x3f611f)[_0xb334('0x2a')](function(_0x2904d4){_0x1f35a6[_0xb334('0x22')]=_0x2904d4;if(_0x440c79[_0xb334('0x39')][_0xb334('0x49')]){_0x2fa9b1[_0xb334('0x4a')]=[{'all':!![]}];}return db['CmHopperAdditionalPhone'][_0xb334('0x4b')](_0x2fa9b1);})['then'](function(_0x32071f){_0x1f35a6['rows']=_0x32071f;return _0x1f35a6;})[_0xb334('0x2a')](respondWithFilteredResult(_0x3c9550,_0x2fa9b1))[_0xb334('0x4c')](handleError(_0x3c9550,null));};exports[_0xb334('0x4d')]=function(_0x37b771,_0x3e7d7d){var _0x447af4={'raw':!![],'where':{'id':_0x37b771['params']['id']}},_0xab7df2={};_0xab7df2['model']=_[_0xb334('0x38')](db[_0xb334('0x33')][_0xb334('0x34')]);_0xab7df2[_0xb334('0x39')]=_['keys'](_0x37b771[_0xb334('0x39')]);_0xab7df2[_0xb334('0x3a')]=_[_0xb334('0x3b')](_0xab7df2[_0xb334('0x37')],_0xab7df2[_0xb334('0x39')]);_0x447af4[_0xb334('0x3c')]=_[_0xb334('0x3b')](_0xab7df2[_0xb334('0x37')],qs[_0xb334('0x3d')](_0x37b771[_0xb334('0x39')][_0xb334('0x3d')]));_0x447af4[_0xb334('0x3c')]=_0x447af4[_0xb334('0x3c')][_0xb334('0x3e')]?_0x447af4[_0xb334('0x3c')]:_0xab7df2['model'];if(_0x37b771[_0xb334('0x39')][_0xb334('0x49')]){_0x447af4[_0xb334('0x4a')]=[{'all':!![]}];}_0x447af4=_['merge']({},_0x447af4,_0x37b771[_0xb334('0x48')]);return db[_0xb334('0x33')]['find'](_0x447af4)[_0xb334('0x2a')](handleEntityNotFound(_0x3e7d7d,null))[_0xb334('0x2a')](respondWithResult(_0x3e7d7d,null))['catch'](handleError(_0x3e7d7d,null));};exports[_0xb334('0x4e')]=function(_0x3102c5,_0x3c601d){return db[_0xb334('0x33')][_0xb334('0x4e')](_0x3102c5[_0xb334('0x4f')],{})[_0xb334('0x2a')](function(_0x5bf2c6){var _0x483300=_0x3102c5[_0xb334('0x50')][_0xb334('0x51')]({'plain':!![]});if(!_0x483300)throw new Error(_0xb334('0x52'));if(_0x483300[_0xb334('0x53')]===_0xb334('0x50')){var _0x4ac653=_0x5bf2c6[_0xb334('0x51')]({'plain':!![]});var _0x16659b=_0xb334('0x2c');return db[_0xb334('0x54')][_0xb334('0x55')]({'where':{'name':_0x16659b,'userProfileId':_0x483300[_0xb334('0x56')]},'raw':!![]})[_0xb334('0x2a')](function(_0x4b01c7){if(_0x4b01c7&&_0x4b01c7['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x4ac653[_0xb334('0x2f')],'resourceId':_0x4ac653['id'],'type':_0x4b01c7['name'],'sectionId':_0x4b01c7['id']},{})[_0xb334('0x2a')](function(){return _0x5bf2c6;});}else{return _0x5bf2c6;}})[_0xb334('0x4c')](function(_0x3511e7){logger[_0xb334('0x2e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3511e7);throw _0x3511e7;});}return _0x5bf2c6;})[_0xb334('0x2a')](respondWithResult(_0x3c601d,0xc9))[_0xb334('0x4c')](handleError(_0x3c601d,null));};exports[_0xb334('0x29')]=function(_0x15a83c,_0x123f5f){if(_0x15a83c[_0xb334('0x4f')]['id']){delete _0x15a83c[_0xb334('0x4f')]['id'];}return db['CmHopperAdditionalPhone'][_0xb334('0x55')]({'where':{'id':_0x15a83c[_0xb334('0x57')]['id']}})[_0xb334('0x2a')](handleEntityNotFound(_0x123f5f,null))[_0xb334('0x2a')](saveUpdates(_0x15a83c[_0xb334('0x4f')],null))[_0xb334('0x2a')](respondWithResult(_0x123f5f,null))[_0xb334('0x4c')](handleError(_0x123f5f,null));};exports['destroy']=function(_0x30ee04,_0x544b9c){return db[_0xb334('0x33')]['find']({'where':{'id':_0x30ee04[_0xb334('0x57')]['id']}})[_0xb334('0x2a')](handleEntityNotFound(_0x544b9c,null))['then'](removeEntity(_0x544b9c,null))[_0xb334('0x4c')](handleError(_0x544b9c,null));}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js index 9684096..b30d5a8 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 _0x1fc7=['moment','bluebird','request-promise','path','rimraf','./cmHopperAdditionalPhone.attributes','exports','define','CmHopperAdditionalPhone','cm_hopper_additional_phones','lodash','util','../../config/logger','api'];(function(_0x3b1e1c,_0x10bbb){var _0x3ddd87=function(_0x397732){while(--_0x397732){_0x3b1e1c['push'](_0x3b1e1c['shift']());}};_0x3ddd87(++_0x10bbb);}(_0x1fc7,0x1ca));var _0x71fc=function(_0x2aecb2,_0x343312){_0x2aecb2=_0x2aecb2-0x0;var _0x3ebb80=_0x1fc7[_0x2aecb2];return _0x3ebb80;};'use strict';var _=require(_0x71fc('0x0'));var util=require(_0x71fc('0x1'));var logger=require(_0x71fc('0x2'))(_0x71fc('0x3'));var moment=require(_0x71fc('0x4'));var BPromise=require(_0x71fc('0x5'));var rp=require(_0x71fc('0x6'));var fs=require('fs');var path=require(_0x71fc('0x7'));var rimraf=require(_0x71fc('0x8'));var config=require('../../config/environment');var attributes=require(_0x71fc('0x9'));module[_0x71fc('0xa')]=function(_0x2faff7,_0x52f748){return _0x2faff7[_0x71fc('0xb')](_0x71fc('0xc'),attributes,{'tableName':_0x71fc('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x418d=['path','rimraf','../../config/environment','./cmHopperAdditionalPhone.attributes','exports','define','CmHopperAdditionalPhone','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x268234,_0x426c68){var _0x56f16d=function(_0x16a027){while(--_0x16a027){_0x268234['push'](_0x268234['shift']());}};_0x56f16d(++_0x426c68);}(_0x418d,0x6f));var _0xd418=function(_0x1d38d5,_0xe5502a){_0x1d38d5=_0x1d38d5-0x0;var _0x56fd12=_0x418d[_0x1d38d5];return _0x56fd12;};'use strict';var _=require('lodash');var util=require(_0xd418('0x0'));var logger=require(_0xd418('0x1'))(_0xd418('0x2'));var moment=require(_0xd418('0x3'));var BPromise=require(_0xd418('0x4'));var rp=require(_0xd418('0x5'));var fs=require('fs');var path=require(_0xd418('0x6'));var rimraf=require(_0xd418('0x7'));var config=require(_0xd418('0x8'));var attributes=require(_0xd418('0x9'));module[_0xd418('0xa')]=function(_0x294064,_0x2f79eb){return _0x294064[_0xd418('0xb')](_0xd418('0xc'),attributes,{'tableName':'cm_hopper_additional_phones','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js index 47b195b..124a497 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 _0x4e4a=['../../mysqldb','../../config/utils','../../config/logger','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','message','result','catch','VerifyAdditionalPhones','CmHopper','findOne','body','VoiceQueueId','CampaignId','CmHopperAdditionalPhone','OrderBy','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countmachineretry','entity','dialGlobalMaxRetry','ASC','countdropretry','countagentrejectretry','SwapAdditionalPhones','ContactId','waitTime','isNil','scheduledat','add','minutes','phone','createdAt','updatedAt','sequelize','transaction','activateAdditionalPhone','IncrementPreviewCounters','update','field','lodash','util','moment','bluebird','ioredis'];(function(_0xdcaf27,_0x1ff07f){var _0x34001d=function(_0x19b528){while(--_0x19b528){_0xdcaf27['push'](_0xdcaf27['shift']());}};_0x34001d(++_0x1ff07f);}(_0x4e4a,0x15d));var _0xa4e4=function(_0x143520,_0x57cefb){_0x143520=_0x143520-0x0;var _0x5645e6=_0x4e4a[_0x143520];return _0x5645e6;};'use strict';var _=require(_0xa4e4('0x0'));var util=require(_0xa4e4('0x1'));var moment=require(_0xa4e4('0x2'));var BPromise=require(_0xa4e4('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa4e4('0x4'));var db=require(_0xa4e4('0x5'))['db'];var utils=require(_0xa4e4('0x6'));var logger=require(_0xa4e4('0x7'))(_0xa4e4('0x8'));var config=require(_0xa4e4('0x9'));var jayson=require(_0xa4e4('0xa'));var client=jayson['client'][_0xa4e4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x57b564,_0x13cb3b,_0x2c9220){return new BPromise(function(_0x4af609,_0x3dafc3){return client[_0xa4e4('0xc')](_0x57b564,_0x2c9220)[_0xa4e4('0xd')](function(_0x2b22c1){logger[_0xa4e4('0xe')](_0xa4e4('0xf'),_0x13cb3b,_0xa4e4('0x10'));logger[_0xa4e4('0x11')](_0xa4e4('0x12'),_0x13cb3b,_0xa4e4('0x10'),JSON[_0xa4e4('0x13')](_0x2b22c1));if(_0x2b22c1[_0xa4e4('0x14')]){if(_0x2b22c1['error']['code']===0x1f4){logger[_0xa4e4('0x14')](_0xa4e4('0xf'),_0x13cb3b,_0x2b22c1[_0xa4e4('0x14')][_0xa4e4('0x15')]);return _0x3dafc3(_0x2b22c1['error']['message']);}logger['error'](_0xa4e4('0xf'),_0x13cb3b,_0x2b22c1[_0xa4e4('0x14')][_0xa4e4('0x15')]);return _0x4af609(_0x2b22c1[_0xa4e4('0x14')][_0xa4e4('0x15')]);}else{logger['info'](_0xa4e4('0xf'),_0x13cb3b,_0xa4e4('0x10'));_0x4af609(_0x2b22c1[_0xa4e4('0x16')][_0xa4e4('0x15')]);}})[_0xa4e4('0x17')](function(_0x2780fe){logger[_0xa4e4('0x14')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x13cb3b,_0x2780fe);_0x3dafc3(_0x2780fe);});});}exports[_0xa4e4('0x18')]=function(_0x138f47){var _0x3e3c93=this;return new Promise(function(_0x2550fb,_0x19afdf){return db[_0xa4e4('0x19')][_0xa4e4('0x1a')]({'raw':!![],'where':{'ContactId':_0x138f47[_0xa4e4('0x1b')]['ContactId'],'ListId':_0x138f47[_0xa4e4('0x1b')]['ListId'],'VoiceQueueId':_0x138f47[_0xa4e4('0x1b')][_0xa4e4('0x1c')]===undefined?null:_0x138f47[_0xa4e4('0x1b')]['VoiceQueueId'],'CampaignId':_0x138f47[_0xa4e4('0x1b')][_0xa4e4('0x1d')]===undefined?null:_0x138f47[_0xa4e4('0x1b')][_0xa4e4('0x1d')]}})[_0xa4e4('0xd')](function(_0x1b2332){if(_0x1b2332!=null){return db[_0xa4e4('0x1e')][_0xa4e4('0x1a')]({'raw':!![],'where':{'CmHopperId':_0x1b2332['id'],'OrderBy':{'$gt':_0x1b2332[_0xa4e4('0x1f')]}},'order':[['OrderBy','ASC']]})[_0xa4e4('0xd')](function(_0x27a5f4){var _0x22be27=0x0;if(_0x27a5f4){if(_0x27a5f4[_0xa4e4('0x20')]+_0x27a5f4[_0xa4e4('0x21')]+_0x27a5f4[_0xa4e4('0x22')]+_0x27a5f4[_0xa4e4('0x23')]+_0x27a5f4['countdropretry']+_0x27a5f4[_0xa4e4('0x24')]+_0x27a5f4[_0xa4e4('0x25')]+_0x27a5f4['countagentrejectretry']<_0x138f47[_0xa4e4('0x26')][_0xa4e4('0x27')])_0x22be27=0x1;_0x2550fb({'additional':_0x22be27});}else{return db[_0xa4e4('0x1e')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x1b2332['id']},'order':[['OrderBy',_0xa4e4('0x28')]]})['then'](function(_0x117f50){var _0x574da0=0x0;if(_0x117f50){if(_0x117f50[_0xa4e4('0x20')]+_0x117f50[_0xa4e4('0x21')]+_0x117f50[_0xa4e4('0x22')]+_0x117f50[_0xa4e4('0x23')]+_0x117f50[_0xa4e4('0x29')]+_0x117f50['countabandonedretry']+_0x117f50[_0xa4e4('0x25')]+_0x117f50[_0xa4e4('0x2a')]<_0x138f47[_0xa4e4('0x26')][_0xa4e4('0x27')])_0x574da0=0x1;_0x2550fb({'additional':_0x574da0});}else{_0x2550fb({'additional':0x0});}})[_0xa4e4('0x17')](function(_0x28e00d){logger['error'](_0xa4e4('0x18'),_0x28e00d[_0xa4e4('0x15')]);_0x19afdf(_0x3e3c93['error'](0x1f4,_0x28e00d[_0xa4e4('0x15')]));});}})['catch'](function(_0x14a6f1){logger[_0xa4e4('0x14')](_0xa4e4('0x18'),_0x14a6f1[_0xa4e4('0x15')]);_0x19afdf(_0x3e3c93['error'](0x1f4,_0x14a6f1[_0xa4e4('0x15')]));});}else _0x2550fb({'additional':0x0});});});};exports[_0xa4e4('0x2b')]=function(_0x391ed4){var _0x3046d9=this;return new Promise(function(_0x119564,_0x980e87){return db[_0xa4e4('0x19')][_0xa4e4('0x1a')]({'raw':!![],'where':{'ContactId':_0x391ed4['body'][_0xa4e4('0x2c')],'ListId':_0x391ed4[_0xa4e4('0x1b')]['ListId'],'VoiceQueueId':_0x391ed4['body'][_0xa4e4('0x1c')]===undefined?null:_0x391ed4[_0xa4e4('0x1b')][_0xa4e4('0x1c')],'CampaignId':_0x391ed4[_0xa4e4('0x1b')][_0xa4e4('0x1d')]===undefined?null:_0x391ed4[_0xa4e4('0x1b')]['CampaignId']}})[_0xa4e4('0xd')](function(_0x374bf8){if(_0x374bf8!=null){return db['CmHopperAdditionalPhone'][_0xa4e4('0x1a')]({'raw':!![],'where':{'CmHopperId':_0x374bf8['id'],'OrderBy':{'$gte':_0x374bf8[_0xa4e4('0x1f')]}},'order':[['OrderBy',_0xa4e4('0x28')]]})[_0xa4e4('0xd')](function(_0x94f163){if(_0x94f163)return activateAdditionalPhone(_0x374bf8,_0x391ed4[_0xa4e4('0x1b')],_0x94f163,_0x391ed4['duration'],_0x391ed4[_0xa4e4('0x2d')])[_0xa4e4('0xd')](function(_0x15438b){_0x119564(_0x15438b);});else{return db['CmHopperAdditionalPhone']['findOne']({'raw':!![],'where':{'CmHopperId':_0x374bf8['id']},'order':[['OrderBy',_0xa4e4('0x28')]]})[_0xa4e4('0xd')](function(_0x5b5a60){if(_0x5b5a60)return activateAdditionalPhone(_0x374bf8,_0x391ed4[_0xa4e4('0x1b')],_0x5b5a60,_0x391ed4['duration'],_0x391ed4['waitTime'])[_0xa4e4('0xd')](function(_0x11dc6e){_0x119564(_0x11dc6e);});else{_0x119564({'id':_0x374bf8['id'],'phone':''});}})['catch'](function(_0x529074){logger[_0xa4e4('0x14')](_0xa4e4('0x18'),_0x529074['message']);_0x980e87(_0x3046d9[_0xa4e4('0x14')](0x1f4,_0x529074[_0xa4e4('0x15')]));});}})[_0xa4e4('0x17')](function(_0x385505){logger['error'](_0xa4e4('0x18'),_0x385505['message']);_0x980e87(_0x3046d9[_0xa4e4('0x14')](0x1f4,_0x385505[_0xa4e4('0x15')]));});}else _0x119564(0x1);});});};function activateAdditionalPhone(_0x5457ea,_0x1858bc,_0x295bc7,_0x2cd9be,_0x11c615){return new Promise(function(_0x1257f9,_0x322540){var _0x2522d6;if(_[_0xa4e4('0x2e')](_0x295bc7[_0xa4e4('0x2f')])){_0x295bc7['scheduledat']=moment();}if(moment()>moment(_0x295bc7[_0xa4e4('0x2f')])){_0x2522d6=moment()[_0xa4e4('0x30')](_0x11c615||0x3,_0xa4e4('0x31'));}else{if(_0x295bc7[_0xa4e4('0x1f')]==0x0){_0x2522d6=moment(_0x295bc7[_0xa4e4('0x2f')]);}else{_0x2522d6=moment()[_0xa4e4('0x30')](_0x11c615||0x3,_0xa4e4('0x31'));}}if(_['isNil'](_0x2522d6)){_0x2522d6=moment()[_0xa4e4('0x30')](_0x11c615||0x3,_0xa4e4('0x31'));}var _0x376dac={'phone':_0x5457ea[_0xa4e4('0x32')],'active':0x0,'OrderBy':_[_0xa4e4('0x2e')](_0x5457ea[_0xa4e4('0x1f')])?0x0:_0x5457ea[_0xa4e4('0x1f')],'scheduledat':moment()[_0xa4e4('0x30')](_0x2cd9be||0x1,'minutes'),'countbusyretry':_0x1858bc[_0xa4e4('0x20')],'countcongestionretry':_0x1858bc[_0xa4e4('0x21')],'countnoanswerretry':_0x1858bc[_0xa4e4('0x22')],'countnosuchnumberretry':_0x1858bc[_0xa4e4('0x23')],'countdropretry':_0x1858bc[_0xa4e4('0x29')],'countabandonedretry':_0x1858bc[_0xa4e4('0x24')],'countmachineretry':_0x1858bc[_0xa4e4('0x25')],'countagentrejectretry':_0x1858bc['countagentrejectretry'],'createdAt':_0x1858bc[_0xa4e4('0x33')],'updatedAt':_0x1858bc[_0xa4e4('0x34')]};var _0x5d563e={'CmHopperId':_0x5457ea['id'],'phone':_0x295bc7[_0xa4e4('0x32')],'active':0x0,'OrderBy':_[_0xa4e4('0x2e')](_0x295bc7[_0xa4e4('0x1f')])?0x0:_0x295bc7[_0xa4e4('0x1f')],'scheduledat':_0x2522d6,'countbusyretry':_0x295bc7[_0xa4e4('0x20')],'countcongestionretry':_0x295bc7[_0xa4e4('0x21')],'countnoanswerretry':_0x295bc7[_0xa4e4('0x22')],'countnosuchnumberretry':_0x295bc7[_0xa4e4('0x23')],'countdropretry':_0x295bc7[_0xa4e4('0x29')],'countabandonedretry':_0x295bc7[_0xa4e4('0x24')],'countmachineretry':_0x295bc7['countmachineretry'],'countagentrejectretry':_0x295bc7['countagentrejectretry'],'createdAt':_0x295bc7['createdAt'],'updatedAt':_0x295bc7['updatedAt']};return db[_0xa4e4('0x35')][_0xa4e4('0x36')](function(_0x2b4828){return db[_0xa4e4('0x1e')]['update'](_0x376dac,{'where':{'id':_0x295bc7['id']}},{'transaction':_0x2b4828})['then'](function(){return db[_0xa4e4('0x19')]['update'](_0x5d563e,{'where':{'id':_0x5457ea['id']}},{'transaction':_0x2b4828});});})[_0xa4e4('0xd')](function(_0x1a5591){_0x1257f9({'id':_0x5457ea['id'],'phone':_0x295bc7[_0xa4e4('0x32')]});})[_0xa4e4('0x17')](function(_0x83bb29){logger['error'](_0xa4e4('0x37'),_0x83bb29['message']);_0x322540({'error':_0x83bb29[_0xa4e4('0x15')]});});});}exports[_0xa4e4('0x38')]=function(_0x513d33){var _0x1bb0a6=this;return new Promise(function(_0xd1e381,_0x167a5e){return db[_0xa4e4('0x19')][_0xa4e4('0x39')](_0x513d33[_0xa4e4('0x1b')][_0xa4e4('0x3a')],{'where':{'id':_0x513d33[_0xa4e4('0x1b')]['id']}})['then'](function(_0xe2c57){_0xd1e381(_0xe2c57);})['catch'](function(_0x15eca8){logger[_0xa4e4('0x14')]('IncrementPreviewCounters',_0x15eca8[_0xa4e4('0x15')]);_0x167a5e(_0x1bb0a6[_0xa4e4('0x14')](0x1f4,_0x15eca8[_0xa4e4('0x15')]));});});}; \ No newline at end of file +var _0x497d=['add','minutes','phone','createdAt','updatedAt','sequelize','transaction','update','activateAdditionalPhone','IncrementPreviewCounters','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','VerifyAdditionalPhones','CmHopper','ContactId','body','ListId','VoiceQueueId','CampaignId','then','CmHopperAdditionalPhone','findOne','OrderBy','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','entity','dialGlobalMaxRetry','countbusyretry','countagentrejectretry','ASC','duration','waitTime','isNil','scheduledat'];(function(_0x129324,_0x538f27){var _0x2dd0b0=function(_0x13bbb7){while(--_0x13bbb7){_0x129324['push'](_0x129324['shift']());}};_0x2dd0b0(++_0x538f27);}(_0x497d,0x1a7));var _0xd497=function(_0x256880,_0x43e89f){_0x256880=_0x256880-0x0;var _0x563790=_0x497d[_0x256880];return _0x563790;};'use strict';var _=require(_0xd497('0x0'));var util=require(_0xd497('0x1'));var moment=require(_0xd497('0x2'));var BPromise=require(_0xd497('0x3'));var rs=require(_0xd497('0x4'));var fs=require('fs');var Redis=require(_0xd497('0x5'));var db=require(_0xd497('0x6'))['db'];var utils=require(_0xd497('0x7'));var logger=require(_0xd497('0x8'))(_0xd497('0x9'));var config=require(_0xd497('0xa'));var jayson=require(_0xd497('0xb'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x46ea57,_0x167e39,_0x569774){return new BPromise(function(_0x2b2d84,_0x1506f8){return client['request'](_0x46ea57,_0x569774)['then'](function(_0xfd1c12){logger['info'](_0xd497('0xc'),_0x167e39,_0xd497('0xd'));logger[_0xd497('0xe')](_0xd497('0xf'),_0x167e39,_0xd497('0xd'),JSON[_0xd497('0x10')](_0xfd1c12));if(_0xfd1c12[_0xd497('0x11')]){if(_0xfd1c12[_0xd497('0x11')][_0xd497('0x12')]===0x1f4){logger['error']('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x167e39,_0xfd1c12[_0xd497('0x11')][_0xd497('0x13')]);return _0x1506f8(_0xfd1c12[_0xd497('0x11')]['message']);}logger[_0xd497('0x11')](_0xd497('0xc'),_0x167e39,_0xfd1c12[_0xd497('0x11')][_0xd497('0x13')]);return _0x2b2d84(_0xfd1c12['error'][_0xd497('0x13')]);}else{logger[_0xd497('0x14')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x167e39,'request\x20sent');_0x2b2d84(_0xfd1c12[_0xd497('0x15')][_0xd497('0x13')]);}})[_0xd497('0x16')](function(_0x5b6e43){logger[_0xd497('0x11')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x167e39,_0x5b6e43);_0x1506f8(_0x5b6e43);});});}exports[_0xd497('0x17')]=function(_0x21b8d2){var _0x459604=this;return new Promise(function(_0x19472d,_0x44456d){return db[_0xd497('0x18')]['findOne']({'raw':!![],'where':{'ContactId':_0x21b8d2['body'][_0xd497('0x19')],'ListId':_0x21b8d2[_0xd497('0x1a')][_0xd497('0x1b')],'VoiceQueueId':_0x21b8d2[_0xd497('0x1a')][_0xd497('0x1c')]===undefined?null:_0x21b8d2[_0xd497('0x1a')][_0xd497('0x1c')],'CampaignId':_0x21b8d2[_0xd497('0x1a')]['CampaignId']===undefined?null:_0x21b8d2[_0xd497('0x1a')][_0xd497('0x1d')]}})[_0xd497('0x1e')](function(_0x1fa1ee){if(_0x1fa1ee!=null){return db[_0xd497('0x1f')][_0xd497('0x20')]({'raw':!![],'where':{'CmHopperId':_0x1fa1ee['id'],'OrderBy':{'$gt':_0x1fa1ee[_0xd497('0x21')]}},'order':[[_0xd497('0x21'),'ASC']]})['then'](function(_0x260be9){var _0x8b2dda=0x0;if(_0x260be9){if(_0x260be9['countbusyretry']+_0x260be9[_0xd497('0x22')]+_0x260be9[_0xd497('0x23')]+_0x260be9[_0xd497('0x24')]+_0x260be9[_0xd497('0x25')]+_0x260be9[_0xd497('0x26')]+_0x260be9[_0xd497('0x27')]+_0x260be9['countagentrejectretry']<_0x21b8d2[_0xd497('0x28')][_0xd497('0x29')])_0x8b2dda=0x1;_0x19472d({'additional':_0x8b2dda});}else{return db[_0xd497('0x1f')][_0xd497('0x20')]({'raw':!![],'where':{'CmHopperId':_0x1fa1ee['id']},'order':[['OrderBy','ASC']]})['then'](function(_0x4341ce){var _0x4341cb=0x0;if(_0x4341ce){if(_0x4341ce[_0xd497('0x2a')]+_0x4341ce[_0xd497('0x22')]+_0x4341ce['countnoanswerretry']+_0x4341ce[_0xd497('0x24')]+_0x4341ce[_0xd497('0x25')]+_0x4341ce[_0xd497('0x26')]+_0x4341ce[_0xd497('0x27')]+_0x4341ce[_0xd497('0x2b')]<_0x21b8d2['entity'][_0xd497('0x29')])_0x4341cb=0x1;_0x19472d({'additional':_0x4341cb});}else{_0x19472d({'additional':0x0});}})['catch'](function(_0x47bd1c){logger[_0xd497('0x11')](_0xd497('0x17'),_0x47bd1c[_0xd497('0x13')]);_0x44456d(_0x459604[_0xd497('0x11')](0x1f4,_0x47bd1c[_0xd497('0x13')]));});}})[_0xd497('0x16')](function(_0x13b2fa){logger[_0xd497('0x11')](_0xd497('0x17'),_0x13b2fa[_0xd497('0x13')]);_0x44456d(_0x459604[_0xd497('0x11')](0x1f4,_0x13b2fa[_0xd497('0x13')]));});}else _0x19472d({'additional':0x0});});});};exports['SwapAdditionalPhones']=function(_0x365225){var _0x174f68=this;return new Promise(function(_0x353a96,_0x19a949){return db[_0xd497('0x18')][_0xd497('0x20')]({'raw':!![],'where':{'ContactId':_0x365225[_0xd497('0x1a')]['ContactId'],'ListId':_0x365225[_0xd497('0x1a')][_0xd497('0x1b')],'VoiceQueueId':_0x365225['body'][_0xd497('0x1c')]===undefined?null:_0x365225[_0xd497('0x1a')][_0xd497('0x1c')],'CampaignId':_0x365225['body']['CampaignId']===undefined?null:_0x365225[_0xd497('0x1a')][_0xd497('0x1d')]}})[_0xd497('0x1e')](function(_0x2ba1ff){if(_0x2ba1ff!=null){return db['CmHopperAdditionalPhone']['findOne']({'raw':!![],'where':{'CmHopperId':_0x2ba1ff['id'],'OrderBy':{'$gte':_0x2ba1ff[_0xd497('0x21')]}},'order':[[_0xd497('0x21'),_0xd497('0x2c')]]})[_0xd497('0x1e')](function(_0x155c0e){if(_0x155c0e)return activateAdditionalPhone(_0x2ba1ff,_0x365225[_0xd497('0x1a')],_0x155c0e,_0x365225[_0xd497('0x2d')],_0x365225[_0xd497('0x2e')])[_0xd497('0x1e')](function(_0x10ea0f){_0x353a96(_0x10ea0f);});else{return db[_0xd497('0x1f')][_0xd497('0x20')]({'raw':!![],'where':{'CmHopperId':_0x2ba1ff['id']},'order':[[_0xd497('0x21'),_0xd497('0x2c')]]})[_0xd497('0x1e')](function(_0x485479){if(_0x485479)return activateAdditionalPhone(_0x2ba1ff,_0x365225[_0xd497('0x1a')],_0x485479,_0x365225[_0xd497('0x2d')],_0x365225[_0xd497('0x2e')])[_0xd497('0x1e')](function(_0x33ef01){_0x353a96(_0x33ef01);});else{_0x353a96({'id':_0x2ba1ff['id'],'phone':''});}})['catch'](function(_0x3b8605){logger['error'](_0xd497('0x17'),_0x3b8605['message']);_0x19a949(_0x174f68[_0xd497('0x11')](0x1f4,_0x3b8605[_0xd497('0x13')]));});}})['catch'](function(_0x147f78){logger[_0xd497('0x11')](_0xd497('0x17'),_0x147f78[_0xd497('0x13')]);_0x19a949(_0x174f68['error'](0x1f4,_0x147f78[_0xd497('0x13')]));});}else _0x353a96(0x1);});});};function activateAdditionalPhone(_0x35a07b,_0xc2f1f9,_0x1f0023,_0x3d49da,_0x9eb127){return new Promise(function(_0x4339c3,_0x24ed0e){var _0x18c09b;if(_[_0xd497('0x2f')](_0x1f0023['scheduledat'])){_0x1f0023[_0xd497('0x30')]=moment();}if(moment()>moment(_0x1f0023[_0xd497('0x30')])){_0x18c09b=moment()[_0xd497('0x31')](_0x9eb127||0x3,'minutes');}else{if(_0x1f0023[_0xd497('0x21')]==0x0){_0x18c09b=moment(_0x1f0023[_0xd497('0x30')]);}else{_0x18c09b=moment()['add'](_0x9eb127||0x3,'minutes');}}if(_[_0xd497('0x2f')](_0x18c09b)){_0x18c09b=moment()['add'](_0x9eb127||0x3,_0xd497('0x32'));}var _0x3b77dc={'phone':_0x35a07b[_0xd497('0x33')],'active':0x0,'OrderBy':_['isNil'](_0x35a07b[_0xd497('0x21')])?0x0:_0x35a07b[_0xd497('0x21')],'scheduledat':moment()[_0xd497('0x31')](_0x3d49da||0x1,_0xd497('0x32')),'countbusyretry':_0xc2f1f9[_0xd497('0x2a')],'countcongestionretry':_0xc2f1f9[_0xd497('0x22')],'countnoanswerretry':_0xc2f1f9[_0xd497('0x23')],'countnosuchnumberretry':_0xc2f1f9[_0xd497('0x24')],'countdropretry':_0xc2f1f9[_0xd497('0x25')],'countabandonedretry':_0xc2f1f9[_0xd497('0x26')],'countmachineretry':_0xc2f1f9[_0xd497('0x27')],'countagentrejectretry':_0xc2f1f9[_0xd497('0x2b')],'createdAt':_0xc2f1f9[_0xd497('0x34')],'updatedAt':_0xc2f1f9['updatedAt']};var _0x35e99e={'CmHopperId':_0x35a07b['id'],'phone':_0x1f0023[_0xd497('0x33')],'active':0x0,'OrderBy':_[_0xd497('0x2f')](_0x1f0023[_0xd497('0x21')])?0x0:_0x1f0023[_0xd497('0x21')],'scheduledat':_0x18c09b,'countbusyretry':_0x1f0023[_0xd497('0x2a')],'countcongestionretry':_0x1f0023[_0xd497('0x22')],'countnoanswerretry':_0x1f0023[_0xd497('0x23')],'countnosuchnumberretry':_0x1f0023[_0xd497('0x24')],'countdropretry':_0x1f0023[_0xd497('0x25')],'countabandonedretry':_0x1f0023[_0xd497('0x26')],'countmachineretry':_0x1f0023[_0xd497('0x27')],'countagentrejectretry':_0x1f0023[_0xd497('0x2b')],'createdAt':_0x1f0023[_0xd497('0x34')],'updatedAt':_0x1f0023[_0xd497('0x35')]};return db[_0xd497('0x36')][_0xd497('0x37')](function(_0x219266){return db[_0xd497('0x1f')][_0xd497('0x38')](_0x3b77dc,{'where':{'id':_0x1f0023['id']}},{'transaction':_0x219266})[_0xd497('0x1e')](function(){return db[_0xd497('0x18')][_0xd497('0x38')](_0x35e99e,{'where':{'id':_0x35a07b['id']}},{'transaction':_0x219266});});})[_0xd497('0x1e')](function(_0x417d8f){_0x4339c3({'id':_0x35a07b['id'],'phone':_0x1f0023[_0xd497('0x33')]});})[_0xd497('0x16')](function(_0xe46662){logger[_0xd497('0x11')](_0xd497('0x39'),_0xe46662[_0xd497('0x13')]);_0x24ed0e({'error':_0xe46662[_0xd497('0x13')]});});});}exports[_0xd497('0x3a')]=function(_0x20e167){var _0x21961e=this;return new Promise(function(_0x19b28c,_0x561750){return db[_0xd497('0x18')][_0xd497('0x38')](_0x20e167[_0xd497('0x1a')]['field'],{'where':{'id':_0x20e167[_0xd497('0x1a')]['id']}})['then'](function(_0x4fe0df){_0x19b28c(_0x4fe0df);})[_0xd497('0x16')](function(_0x17e08a){logger[_0xd497('0x11')](_0xd497('0x3a'),_0x17e08a[_0xd497('0x13')]);_0x561750(_0x21961e[_0xd497('0x11')](0x1f4,_0x17e08a[_0xd497('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/index.js b/server/api/cmHopperAdditionalPhone/index.js index 1f345c7..4984b30 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 _0x32db=['post','put','update','delete','destroy','multer','util','connect-timeout','../../components/interaction/service','../../config/environment','./cmHopperAdditionalPhone.controller','isAuthenticated','index','/:id'];(function(_0xbc0ebb,_0x2eb639){var _0x2c1693=function(_0x19894a){while(--_0x19894a){_0xbc0ebb['push'](_0xbc0ebb['shift']());}};_0x2c1693(++_0x2eb639);}(_0x32db,0x12b));var _0xb32d=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x32db[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0xb32d('0x0'));var util=require(_0xb32d('0x1'));var path=require('path');var timeout=require(_0xb32d('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xb32d('0x3'));var config=require(_0xb32d('0x4'));var controller=require(_0xb32d('0x5'));router['get']('/',auth[_0xb32d('0x6')](),controller[_0xb32d('0x7')]);router['get'](_0xb32d('0x8'),auth['isAuthenticated'](),controller['show']);router[_0xb32d('0x9')]('/',auth[_0xb32d('0x6')](),controller['create']);router[_0xb32d('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xb32d('0xb')]);router[_0xb32d('0xc')](_0xb32d('0x8'),auth[_0xb32d('0x6')](),controller[_0xb32d('0xd')]);module['exports']=router; \ No newline at end of file +var _0x1a68=['../../config/environment','get','isAuthenticated','index','/:id','show','post','create','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x53fcd0,_0x294576){var _0x456acb=function(_0x3a28d2){while(--_0x3a28d2){_0x53fcd0['push'](_0x53fcd0['shift']());}};_0x456acb(++_0x294576);}(_0x1a68,0x174));var _0x81a6=function(_0x441607,_0x5cdf60){_0x441607=_0x441607-0x0;var _0xe201eb=_0x1a68[_0x441607];return _0xe201eb;};'use strict';var multer=require(_0x81a6('0x0'));var util=require(_0x81a6('0x1'));var path=require('path');var timeout=require(_0x81a6('0x2'));var express=require(_0x81a6('0x3'));var router=express[_0x81a6('0x4')]();var fs_extra=require(_0x81a6('0x5'));var auth=require(_0x81a6('0x6'));var interaction=require(_0x81a6('0x7'));var config=require(_0x81a6('0x8'));var controller=require('./cmHopperAdditionalPhone.controller');router[_0x81a6('0x9')]('/',auth[_0x81a6('0xa')](),controller[_0x81a6('0xb')]);router[_0x81a6('0x9')](_0x81a6('0xc'),auth[_0x81a6('0xa')](),controller[_0x81a6('0xd')]);router[_0x81a6('0xe')]('/',auth['isAuthenticated'](),controller[_0x81a6('0xf')]);router['put'](_0x81a6('0xc'),auth[_0x81a6('0xa')](),controller[_0x81a6('0x10')]);router[_0x81a6('0x11')](_0x81a6('0xc'),auth[_0x81a6('0xa')](),controller[_0x81a6('0x12')]);module[_0x81a6('0x13')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index 3175685..1997e13 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 _0x933c=['STRING','INTEGER','contactListQueue','moment','sequelize','exports'];(function(_0xe6d51c,_0x24e607){var _0x10f962=function(_0x3a8e2a){while(--_0x3a8e2a){_0xe6d51c['push'](_0xe6d51c['shift']());}};_0x10f962(++_0x24e607);}(_0x933c,0x99));var _0xc933=function(_0x53959b,_0x506f60){_0x53959b=_0x53959b-0x0;var _0x3fb3e1=_0x933c[_0x53959b];return _0x3fb3e1;};'use strict';var moment=require(_0xc933('0x0'));var Sequelize=require(_0xc933('0x1'));module[_0xc933('0x2')]={'phone':{'type':Sequelize[_0xc933('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize[_0xc933('0x4')],'unique':'contactListQueue'},'ListId':{'type':Sequelize['INTEGER'],'unique':_0xc933('0x5')},'VoiceQueueId':{'type':Sequelize[_0xc933('0x4')],'unique':_0xc933('0x5')}}; \ No newline at end of file +var _0x214e=['contactListQueue','sequelize','STRING'];(function(_0xc2c91c,_0x4e4f4e){var _0x364547=function(_0x178018){while(--_0x178018){_0xc2c91c['push'](_0xc2c91c['shift']());}};_0x364547(++_0x4e4f4e);}(_0x214e,0x148));var _0xe214=function(_0x66b19e,_0x4f2893){_0x66b19e=_0x66b19e-0x0;var _0x1ac391=_0x214e[_0x66b19e];return _0x1ac391;};'use strict';var moment=require('moment');var Sequelize=require(_0xe214('0x0'));module['exports']={'phone':{'type':Sequelize[_0xe214('0x1')],'allowNull':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':_0xe214('0x2')},'ListId':{'type':Sequelize['INTEGER'],'unique':_0xe214('0x2')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0xe214('0x2')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index dc5e82b..f1c54b8 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 _0x391f=['json','offset','undefined','limit','count','apply','reject','update','then','error','stack','name','send','map','CmHopperBlack','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','length','model','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','findAll','rows','catch','params','fields','options','body','find','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end'];(function(_0x230cbf,_0xe92e33){var _0x5b1e31=function(_0x104e3c){while(--_0x104e3c){_0x230cbf['push'](_0x230cbf['shift']());}};_0x5b1e31(++_0xe92e33);}(_0x391f,0x10c));var _0xf391=function(_0x1a336a,_0x4d1cb7){_0x1a336a=_0x1a336a-0x0;var _0x38d3e9=_0x391f[_0x1a336a];return _0x38d3e9;};'use strict';var emlformat=require(_0xf391('0x0'));var rimraf=require(_0xf391('0x1'));var zipdir=require(_0xf391('0x2'));var jsonpatch=require(_0xf391('0x3'));var rp=require(_0xf391('0x4'));var moment=require(_0xf391('0x5'));var BPromise=require(_0xf391('0x6'));var Mustache=require('mustache');var util=require(_0xf391('0x7'));var path=require(_0xf391('0x8'));var sox=require(_0xf391('0x9'));var csv=require(_0xf391('0xa'));var ejs=require(_0xf391('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf391('0xc'));var squel=require(_0xf391('0xd'));var crypto=require(_0xf391('0xe'));var jsforce=require(_0xf391('0xf'));var deskjs=require(_0xf391('0x10'));var toCsv=require('to-csv');var querystring=require(_0xf391('0x11'));var Papa=require(_0xf391('0x12'));var Redis=require(_0xf391('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xf391('0x14'));var hardwareService=require(_0xf391('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0xf391('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xf391('0x17'));var db=require(_0xf391('0x18'))['db'];function respondWithStatusCode(_0x3fde73,_0x4fcb52){_0x4fcb52=_0x4fcb52||0xcc;return function(_0x3c014c){if(_0x3c014c){return _0x3fde73[_0xf391('0x19')](_0x4fcb52);}return _0x3fde73[_0xf391('0x1a')](_0x4fcb52)[_0xf391('0x1b')]();};}function respondWithResult(_0x3a1125,_0x1f7d65){_0x1f7d65=_0x1f7d65||0xc8;return function(_0x4f69f2){if(_0x4f69f2){return _0x3a1125[_0xf391('0x1a')](_0x1f7d65)[_0xf391('0x1c')](_0x4f69f2);}};}function respondWithFilteredResult(_0x5a92e1,_0x44a510){return function(_0x47dbc7){if(_0x47dbc7){var _0xbaeaba=typeof _0x44a510[_0xf391('0x1d')]===_0xf391('0x1e')&&typeof _0x44a510[_0xf391('0x1f')]===_0xf391('0x1e');var _0x5d61d0=_0x47dbc7['count'];var _0x32b6c3=_0xbaeaba?0x0:_0x44a510[_0xf391('0x1d')];var _0x548bc4=_0xbaeaba?_0x47dbc7[_0xf391('0x20')]:_0x44a510[_0xf391('0x1d')]+_0x44a510[_0xf391('0x1f')];var _0x2a6c88;if(_0x548bc4>=_0x5d61d0){_0x548bc4=_0x5d61d0;_0x2a6c88=0xc8;}else{_0x2a6c88=0xce;}_0x5a92e1['status'](_0x2a6c88);return _0x5a92e1['set']('Content-Range',_0x32b6c3+'-'+_0x548bc4+'/'+_0x5d61d0)['json'](_0x47dbc7);}return null;};}function patchUpdates(_0x5544bc){return function(_0x262c1c){try{jsonpatch[_0xf391('0x21')](_0x262c1c,_0x5544bc,!![]);}catch(_0x3c13eb){return BPromise[_0xf391('0x22')](_0x3c13eb);}return _0x262c1c['save']();};}function saveUpdates(_0x312818,_0x2b6fa0){return function(_0x41036e){if(_0x41036e){return _0x41036e[_0xf391('0x23')](_0x312818)[_0xf391('0x24')](function(_0x4ab172){return _0x4ab172;});}return null;};}function removeEntity(_0x1bc97a,_0x54632e){return function(_0x46f41f){if(_0x46f41f){return _0x46f41f['destroy']()[_0xf391('0x24')](function(){_0x1bc97a[_0xf391('0x1a')](0xcc)[_0xf391('0x1b')]();});}};}function handleEntityNotFound(_0x1a6f70,_0x122668){return function(_0x109880){if(!_0x109880){_0x1a6f70[_0xf391('0x19')](0x194);}return _0x109880;};}function handleError(_0x35a7af,_0x10b25f){_0x10b25f=_0x10b25f||0x1f4;return function(_0x3f18ca){logger[_0xf391('0x25')](_0x3f18ca[_0xf391('0x26')]);if(_0x3f18ca[_0xf391('0x27')]){delete _0x3f18ca[_0xf391('0x27')];}_0x35a7af['status'](_0x10b25f)[_0xf391('0x28')](_0x3f18ca);};}exports['index']=function(_0x2c78b8,_0x322db8){var _0x42858c={},_0x201c37={},_0x3fbedd={'count':0x0,'rows':[]};var _0x4de0b1=_[_0xf391('0x29')](db[_0xf391('0x2a')][_0xf391('0x2b')],function(_0x355d33){return{'name':_0x355d33[_0xf391('0x2c')],'type':_0x355d33[_0xf391('0x2d')][_0xf391('0x2e')]};});_0x201c37['model']=_['map'](_0x4de0b1,_0xf391('0x27'));_0x201c37[_0xf391('0x2f')]=_[_0xf391('0x30')](_0x2c78b8['query']);_0x201c37[_0xf391('0x31')]=_[_0xf391('0x32')](_0x201c37['model'],_0x201c37[_0xf391('0x2f')]);_0x42858c[_0xf391('0x33')]=_['intersection'](_0x201c37['model'],qs['fields'](_0x2c78b8[_0xf391('0x2f')]['fields']));_0x42858c[_0xf391('0x33')]=_0x42858c['attributes'][_0xf391('0x34')]?_0x42858c['attributes']:_0x201c37[_0xf391('0x35')];if(!_0x2c78b8['query'][_0xf391('0x36')](_0xf391('0x37'))){_0x42858c[_0xf391('0x1f')]=qs[_0xf391('0x1f')](_0x2c78b8['query']['limit']);_0x42858c['offset']=qs[_0xf391('0x1d')](_0x2c78b8[_0xf391('0x2f')][_0xf391('0x1d')]);}_0x42858c[_0xf391('0x38')]=qs[_0xf391('0x39')](_0x2c78b8[_0xf391('0x2f')][_0xf391('0x39')]);_0x42858c[_0xf391('0x3a')]=qs[_0xf391('0x31')](_[_0xf391('0x3b')](_0x2c78b8['query'],_0x201c37['filters']),_0x4de0b1);if(_0x2c78b8[_0xf391('0x2f')][_0xf391('0x3c')]){_0x42858c[_0xf391('0x3a')]=_['merge'](_0x42858c[_0xf391('0x3a')],{'$or':_[_0xf391('0x29')](_0x4de0b1,function(_0x533b69){if(_0x533b69[_0xf391('0x2d')]!==_0xf391('0x3d')){var _0x51fc82={};_0x51fc82[_0x533b69[_0xf391('0x27')]]={'$like':'%'+_0x2c78b8[_0xf391('0x2f')][_0xf391('0x3c')]+'%'};return _0x51fc82;}})});}_0x42858c=_[_0xf391('0x3e')]({},_0x42858c,_0x2c78b8['options']);var _0x1d6eef={'where':_0x42858c[_0xf391('0x3a')]};return db[_0xf391('0x2a')]['count'](_0x1d6eef)['then'](function(_0x115969){_0x3fbedd[_0xf391('0x20')]=_0x115969;if(_0x2c78b8[_0xf391('0x2f')][_0xf391('0x3f')]){_0x42858c[_0xf391('0x40')]=[{'all':!![]}];}return db[_0xf391('0x2a')][_0xf391('0x41')](_0x42858c);})[_0xf391('0x24')](function(_0x2bd6ab){_0x3fbedd[_0xf391('0x42')]=_0x2bd6ab;return _0x3fbedd;})[_0xf391('0x24')](respondWithFilteredResult(_0x322db8,_0x42858c))[_0xf391('0x43')](handleError(_0x322db8,null));};exports['show']=function(_0x12706e,_0x110d46){var _0xbc3afc={'raw':!![],'where':{'id':_0x12706e[_0xf391('0x44')]['id']}},_0x2aa19c={};_0x2aa19c[_0xf391('0x35')]=_[_0xf391('0x30')](db[_0xf391('0x2a')][_0xf391('0x2b')]);_0x2aa19c[_0xf391('0x2f')]=_[_0xf391('0x30')](_0x12706e[_0xf391('0x2f')]);_0x2aa19c[_0xf391('0x31')]=_['intersection'](_0x2aa19c['model'],_0x2aa19c[_0xf391('0x2f')]);_0xbc3afc[_0xf391('0x33')]=_[_0xf391('0x32')](_0x2aa19c[_0xf391('0x35')],qs[_0xf391('0x45')](_0x12706e[_0xf391('0x2f')][_0xf391('0x45')]));_0xbc3afc[_0xf391('0x33')]=_0xbc3afc['attributes']['length']?_0xbc3afc[_0xf391('0x33')]:_0x2aa19c['model'];if(_0x12706e['query']['includeAll']){_0xbc3afc[_0xf391('0x40')]=[{'all':!![]}];}_0xbc3afc=_['merge']({},_0xbc3afc,_0x12706e[_0xf391('0x46')]);return db[_0xf391('0x2a')]['find'](_0xbc3afc)[_0xf391('0x24')](handleEntityNotFound(_0x110d46,null))[_0xf391('0x24')](respondWithResult(_0x110d46,null))[_0xf391('0x43')](handleError(_0x110d46,null));};exports[_0xf391('0x23')]=function(_0x52d04d,_0x55356c){if(_0x52d04d[_0xf391('0x47')]['id']){delete _0x52d04d[_0xf391('0x47')]['id'];}return db[_0xf391('0x2a')][_0xf391('0x48')]({'where':{'id':_0x52d04d[_0xf391('0x44')]['id']}})['then'](handleEntityNotFound(_0x55356c,null))[_0xf391('0x24')](saveUpdates(_0x52d04d[_0xf391('0x47')],null))[_0xf391('0x24')](respondWithResult(_0x55356c,null))[_0xf391('0x43')](handleError(_0x55356c,null));};exports[_0xf391('0x49')]=function(_0x59d499,_0x457106){return db['CmHopperBlack'][_0xf391('0x48')]({'where':{'id':_0x59d499[_0xf391('0x44')]['id']}})[_0xf391('0x24')](handleEntityNotFound(_0x457106,null))['then'](removeEntity(_0x457106,null))[_0xf391('0x43')](handleError(_0x457106,null));};exports['describe']=function(_0x16660d,_0x3cbc7f){return db[_0xf391('0x2a')]['describe']()[_0xf391('0x24')](respondWithResult(_0x3cbc7f,null))[_0xf391('0x43')](handleError(_0x3cbc7f,null));}; \ No newline at end of file +var _0x1015=['squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','end','offset','limit','count','json','reject','save','update','then','destroy','error','stack','name','send','map','CmHopperBlack','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','merge','where','includeAll','include','findAll','rows','catch','keys','options','find','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash'];(function(_0x42839f,_0x85625e){var _0x29656f=function(_0x1038cf){while(--_0x1038cf){_0x42839f['push'](_0x42839f['shift']());}};_0x29656f(++_0x85625e);}(_0x1015,0x85));var _0x5101=function(_0x4903f2,_0x4a15f5){_0x4903f2=_0x4903f2-0x0;var _0x3a5203=_0x1015[_0x4903f2];return _0x3a5203;};'use strict';var emlformat=require(_0x5101('0x0'));var rimraf=require(_0x5101('0x1'));var zipdir=require(_0x5101('0x2'));var jsonpatch=require(_0x5101('0x3'));var rp=require(_0x5101('0x4'));var moment=require(_0x5101('0x5'));var BPromise=require(_0x5101('0x6'));var Mustache=require(_0x5101('0x7'));var util=require(_0x5101('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x5101('0x9'));var ejs=require(_0x5101('0xa'));var fs=require('fs');var fs_extra=require(_0x5101('0xb'));var _=require(_0x5101('0xc'));var squel=require(_0x5101('0xd'));var crypto=require(_0x5101('0xe'));var jsforce=require(_0x5101('0xf'));var deskjs=require(_0x5101('0x10'));var toCsv=require(_0x5101('0x9'));var querystring=require(_0x5101('0x11'));var Papa=require(_0x5101('0x12'));var Redis=require(_0x5101('0x13'));var authService=require(_0x5101('0x14'));var qs=require(_0x5101('0x15'));var as=require(_0x5101('0x16'));var hardwareService=require(_0x5101('0x17'));var logger=require('../../config/logger')(_0x5101('0x18'));var utils=require(_0x5101('0x19'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x5101('0x1a'))['db'];function respondWithStatusCode(_0x17f530,_0x40b0ab){_0x40b0ab=_0x40b0ab||0xcc;return function(_0x1ad1b1){if(_0x1ad1b1){return _0x17f530[_0x5101('0x1b')](_0x40b0ab);}return _0x17f530[_0x5101('0x1c')](_0x40b0ab)[_0x5101('0x1d')]();};}function respondWithResult(_0x14d26e,_0x3d1e35){_0x3d1e35=_0x3d1e35||0xc8;return function(_0xf514ea){if(_0xf514ea){return _0x14d26e['status'](_0x3d1e35)['json'](_0xf514ea);}};}function respondWithFilteredResult(_0x23681b,_0x599925){return function(_0x262b76){if(_0x262b76){var _0x28cc4f=typeof _0x599925[_0x5101('0x1e')]==='undefined'&&typeof _0x599925[_0x5101('0x1f')]==='undefined';var _0x42ce56=_0x262b76[_0x5101('0x20')];var _0x589b0e=_0x28cc4f?0x0:_0x599925[_0x5101('0x1e')];var _0x12ec12=_0x28cc4f?_0x262b76[_0x5101('0x20')]:_0x599925[_0x5101('0x1e')]+_0x599925[_0x5101('0x1f')];var _0x581432;if(_0x12ec12>=_0x42ce56){_0x12ec12=_0x42ce56;_0x581432=0xc8;}else{_0x581432=0xce;}_0x23681b[_0x5101('0x1c')](_0x581432);return _0x23681b['set']('Content-Range',_0x589b0e+'-'+_0x12ec12+'/'+_0x42ce56)[_0x5101('0x21')](_0x262b76);}return null;};}function patchUpdates(_0x557528){return function(_0x14d12f){try{jsonpatch['apply'](_0x14d12f,_0x557528,!![]);}catch(_0x5be082){return BPromise[_0x5101('0x22')](_0x5be082);}return _0x14d12f[_0x5101('0x23')]();};}function saveUpdates(_0x11579f,_0x15547e){return function(_0x10bd17){if(_0x10bd17){return _0x10bd17[_0x5101('0x24')](_0x11579f)[_0x5101('0x25')](function(_0x9bae2b){return _0x9bae2b;});}return null;};}function removeEntity(_0x3fa8af,_0x1e6ddc){return function(_0xa61c3e){if(_0xa61c3e){return _0xa61c3e[_0x5101('0x26')]()[_0x5101('0x25')](function(){_0x3fa8af['status'](0xcc)[_0x5101('0x1d')]();});}};}function handleEntityNotFound(_0x5131c0,_0xf27f5){return function(_0xbce4dc){if(!_0xbce4dc){_0x5131c0[_0x5101('0x1b')](0x194);}return _0xbce4dc;};}function handleError(_0x13b956,_0x14a5df){_0x14a5df=_0x14a5df||0x1f4;return function(_0x598b89){logger[_0x5101('0x27')](_0x598b89[_0x5101('0x28')]);if(_0x598b89[_0x5101('0x29')]){delete _0x598b89[_0x5101('0x29')];}_0x13b956['status'](_0x14a5df)[_0x5101('0x2a')](_0x598b89);};}exports['index']=function(_0x504769,_0x5649f6){var _0x504591={},_0x3a64fa={},_0x1543ad={'count':0x0,'rows':[]};var _0x43ec47=_[_0x5101('0x2b')](db[_0x5101('0x2c')][_0x5101('0x2d')],function(_0x26595c){return{'name':_0x26595c['fieldName'],'type':_0x26595c[_0x5101('0x2e')][_0x5101('0x2f')]};});_0x3a64fa[_0x5101('0x30')]=_[_0x5101('0x2b')](_0x43ec47,_0x5101('0x29'));_0x3a64fa[_0x5101('0x31')]=_['keys'](_0x504769[_0x5101('0x31')]);_0x3a64fa[_0x5101('0x32')]=_[_0x5101('0x33')](_0x3a64fa['model'],_0x3a64fa['query']);_0x504591[_0x5101('0x34')]=_[_0x5101('0x33')](_0x3a64fa[_0x5101('0x30')],qs[_0x5101('0x35')](_0x504769['query'][_0x5101('0x35')]));_0x504591[_0x5101('0x34')]=_0x504591[_0x5101('0x34')][_0x5101('0x36')]?_0x504591[_0x5101('0x34')]:_0x3a64fa['model'];if(!_0x504769['query'][_0x5101('0x37')](_0x5101('0x38'))){_0x504591[_0x5101('0x1f')]=qs['limit'](_0x504769[_0x5101('0x31')][_0x5101('0x1f')]);_0x504591['offset']=qs['offset'](_0x504769[_0x5101('0x31')]['offset']);}_0x504591[_0x5101('0x39')]=qs[_0x5101('0x3a')](_0x504769[_0x5101('0x31')][_0x5101('0x3a')]);_0x504591['where']=qs[_0x5101('0x32')](_['pick'](_0x504769[_0x5101('0x31')],_0x3a64fa[_0x5101('0x32')]),_0x43ec47);if(_0x504769['query'][_0x5101('0x3b')]){_0x504591['where']=_[_0x5101('0x3c')](_0x504591[_0x5101('0x3d')],{'$or':_[_0x5101('0x2b')](_0x43ec47,function(_0x210d4d){if(_0x210d4d[_0x5101('0x2e')]!=='VIRTUAL'){var _0x38acf4={};_0x38acf4[_0x210d4d[_0x5101('0x29')]]={'$like':'%'+_0x504769[_0x5101('0x31')][_0x5101('0x3b')]+'%'};return _0x38acf4;}})});}_0x504591=_[_0x5101('0x3c')]({},_0x504591,_0x504769['options']);var _0x4ca72c={'where':_0x504591['where']};return db[_0x5101('0x2c')][_0x5101('0x20')](_0x4ca72c)['then'](function(_0x3dd75b){_0x1543ad['count']=_0x3dd75b;if(_0x504769[_0x5101('0x31')][_0x5101('0x3e')]){_0x504591[_0x5101('0x3f')]=[{'all':!![]}];}return db['CmHopperBlack'][_0x5101('0x40')](_0x504591);})[_0x5101('0x25')](function(_0x1addeb){_0x1543ad[_0x5101('0x41')]=_0x1addeb;return _0x1543ad;})[_0x5101('0x25')](respondWithFilteredResult(_0x5649f6,_0x504591))[_0x5101('0x42')](handleError(_0x5649f6,null));};exports['show']=function(_0x4e5fa3,_0x53a3ad){var _0x4c61d5={'raw':!![],'where':{'id':_0x4e5fa3['params']['id']}},_0x43a105={};_0x43a105['model']=_['keys'](db[_0x5101('0x2c')][_0x5101('0x2d')]);_0x43a105[_0x5101('0x31')]=_[_0x5101('0x43')](_0x4e5fa3['query']);_0x43a105['filters']=_[_0x5101('0x33')](_0x43a105['model'],_0x43a105[_0x5101('0x31')]);_0x4c61d5[_0x5101('0x34')]=_['intersection'](_0x43a105[_0x5101('0x30')],qs[_0x5101('0x35')](_0x4e5fa3[_0x5101('0x31')][_0x5101('0x35')]));_0x4c61d5[_0x5101('0x34')]=_0x4c61d5[_0x5101('0x34')][_0x5101('0x36')]?_0x4c61d5['attributes']:_0x43a105[_0x5101('0x30')];if(_0x4e5fa3['query'][_0x5101('0x3e')]){_0x4c61d5[_0x5101('0x3f')]=[{'all':!![]}];}_0x4c61d5=_[_0x5101('0x3c')]({},_0x4c61d5,_0x4e5fa3[_0x5101('0x44')]);return db[_0x5101('0x2c')][_0x5101('0x45')](_0x4c61d5)[_0x5101('0x25')](handleEntityNotFound(_0x53a3ad,null))[_0x5101('0x25')](respondWithResult(_0x53a3ad,null))[_0x5101('0x42')](handleError(_0x53a3ad,null));};exports[_0x5101('0x24')]=function(_0x3a5067,_0x515de4){if(_0x3a5067[_0x5101('0x46')]['id']){delete _0x3a5067['body']['id'];}return db[_0x5101('0x2c')][_0x5101('0x45')]({'where':{'id':_0x3a5067[_0x5101('0x47')]['id']}})[_0x5101('0x25')](handleEntityNotFound(_0x515de4,null))[_0x5101('0x25')](saveUpdates(_0x3a5067[_0x5101('0x46')],null))[_0x5101('0x25')](respondWithResult(_0x515de4,null))[_0x5101('0x42')](handleError(_0x515de4,null));};exports[_0x5101('0x26')]=function(_0x4a477c,_0x419de9){return db[_0x5101('0x2c')]['find']({'where':{'id':_0x4a477c['params']['id']}})[_0x5101('0x25')](handleEntityNotFound(_0x419de9,null))[_0x5101('0x25')](removeEntity(_0x419de9,null))[_0x5101('0x42')](handleError(_0x419de9,null));};exports[_0x5101('0x48')]=function(_0x31e8a4,_0x2e684d){return db[_0x5101('0x2c')][_0x5101('0x48')]()['then'](respondWithResult(_0x2e684d,null))['catch'](handleError(_0x2e684d,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index 11394f8..d8d8044 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 _0x6b26=['CmHopperBlack','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','define'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6b26,0x155));var _0x66b2=function(_0x13a176,_0x59fc79){_0x13a176=_0x13a176-0x0;var _0x1a149b=_0x6b26[_0x13a176];return _0x1a149b;};'use strict';var _=require(_0x66b2('0x0'));var util=require(_0x66b2('0x1'));var logger=require(_0x66b2('0x2'))(_0x66b2('0x3'));var moment=require('moment');var BPromise=require(_0x66b2('0x4'));var rp=require(_0x66b2('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x66b2('0x6'));var config=require(_0x66b2('0x7'));var attributes=require('./cmHopperBlack.attributes');module['exports']=function(_0x37a223,_0x5676a2){return _0x37a223[_0x66b2('0x8')](_0x66b2('0x9'),attributes,{'tableName':'cm_hopper_black','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd4c5=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperBlack.attributes','cm_hopper_black','lodash','util'];(function(_0x418c6f,_0x14a64d){var _0x2ebb6d=function(_0x526c77){while(--_0x526c77){_0x418c6f['push'](_0x418c6f['shift']());}};_0x2ebb6d(++_0x14a64d);}(_0xd4c5,0x142));var _0x5d4c=function(_0x2aadb4,_0x1ac8e1){_0x2aadb4=_0x2aadb4-0x0;var _0x3628d9=_0xd4c5[_0x2aadb4];return _0x3628d9;};'use strict';var _=require(_0x5d4c('0x0'));var util=require(_0x5d4c('0x1'));var logger=require(_0x5d4c('0x2'))(_0x5d4c('0x3'));var moment=require(_0x5d4c('0x4'));var BPromise=require(_0x5d4c('0x5'));var rp=require(_0x5d4c('0x6'));var fs=require('fs');var path=require(_0x5d4c('0x7'));var rimraf=require(_0x5d4c('0x8'));var config=require(_0x5d4c('0x9'));var attributes=require(_0x5d4c('0xa'));module['exports']=function(_0x5119b1,_0x2908d7){return _0x5119b1['define']('CmHopperBlack',attributes,{'tableName':_0x5d4c('0xb'),'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 e13a9c5..c3f19d0 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 _0xf1c2=['code','message','catch','GetCmHopperBlack','options','raw','where','limit','include','model','attributes','map','stringify','UpdateCmHopperBlack','update','DestroyCmHopperBlack','destroy','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','error'];(function(_0x20cc29,_0x30a46d){var _0x28d513=function(_0x179b06){while(--_0x179b06){_0x20cc29['push'](_0x20cc29['shift']());}};_0x28d513(++_0x30a46d);}(_0xf1c2,0xa9));var _0x2f1c=function(_0x5e1e25,_0xdc1421){_0x5e1e25=_0x5e1e25-0x0;var _0x548e5f=_0xf1c2[_0x5e1e25];return _0x548e5f;};'use strict';var _=require(_0x2f1c('0x0'));var util=require(_0x2f1c('0x1'));var moment=require(_0x2f1c('0x2'));var BPromise=require(_0x2f1c('0x3'));var rs=require(_0x2f1c('0x4'));var fs=require('fs');var Redis=require(_0x2f1c('0x5'));var db=require(_0x2f1c('0x6'))['db'];var utils=require(_0x2f1c('0x7'));var logger=require(_0x2f1c('0x8'))(_0x2f1c('0x9'));var config=require(_0x2f1c('0xa'));var jayson=require(_0x2f1c('0xb'));var client=jayson['client'][_0x2f1c('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x9e59f8,_0x1fea7f,_0x90c1f){return new BPromise(function(_0x1153b0,_0x19e8ac){return client[_0x2f1c('0xd')](_0x9e59f8,_0x90c1f)[_0x2f1c('0xe')](function(_0x27e6be){logger[_0x2f1c('0xf')](_0x2f1c('0x10'),_0x1fea7f,_0x2f1c('0x11'));logger[_0x2f1c('0x12')](_0x2f1c('0x13'),_0x1fea7f,_0x2f1c('0x11'),JSON['stringify'](_0x27e6be));if(_0x27e6be['error']){if(_0x27e6be[_0x2f1c('0x14')][_0x2f1c('0x15')]===0x1f4){logger[_0x2f1c('0x14')](_0x2f1c('0x10'),_0x1fea7f,_0x27e6be[_0x2f1c('0x14')][_0x2f1c('0x16')]);return _0x19e8ac(_0x27e6be[_0x2f1c('0x14')][_0x2f1c('0x16')]);}logger[_0x2f1c('0x14')](_0x2f1c('0x10'),_0x1fea7f,_0x27e6be['error'][_0x2f1c('0x16')]);return _0x1153b0(_0x27e6be['error'][_0x2f1c('0x16')]);}else{logger[_0x2f1c('0xf')]('CmHopperBlack,\x20%s,\x20%s',_0x1fea7f,_0x2f1c('0x11'));_0x1153b0(_0x27e6be['result'][_0x2f1c('0x16')]);}})[_0x2f1c('0x17')](function(_0x3b3594){logger[_0x2f1c('0x14')](_0x2f1c('0x10'),_0x1fea7f,_0x3b3594);_0x19e8ac(_0x3b3594);});});}exports[_0x2f1c('0x18')]=function(_0x3eee2a){var _0x3c3f05=this;return new Promise(function(_0x27b170,_0x4e018a){return db['CmHopperBlack']['findAll']({'raw':_0x3eee2a['options']?_0x3eee2a[_0x2f1c('0x19')][_0x2f1c('0x1a')]===undefined?!![]:![]:!![],'where':_0x3eee2a['options']?_0x3eee2a[_0x2f1c('0x19')][_0x2f1c('0x1b')]||null:null,'attributes':_0x3eee2a[_0x2f1c('0x19')]?_0x3eee2a['options']['attributes']||null:null,'limit':_0x3eee2a['options']?_0x3eee2a[_0x2f1c('0x19')][_0x2f1c('0x1c')]||null:null,'include':_0x3eee2a[_0x2f1c('0x19')]?_0x3eee2a['options']['include']?_['map'](_0x3eee2a['options'][_0x2f1c('0x1d')],function(_0x294088){return{'model':db[_0x294088[_0x2f1c('0x1e')]],'as':_0x294088['as'],'attributes':_0x294088[_0x2f1c('0x1f')],'include':_0x294088[_0x2f1c('0x1d')]?_[_0x2f1c('0x20')](_0x294088[_0x2f1c('0x1d')],function(_0x507252){return{'model':db[_0x507252[_0x2f1c('0x1e')]],'as':_0x507252['as'],'attributes':_0x507252[_0x2f1c('0x1f')],'include':_0x507252[_0x2f1c('0x1d')]?_[_0x2f1c('0x20')](_0x507252['include'],function(_0x176b7e){return{'model':db[_0x176b7e[_0x2f1c('0x1e')]],'as':_0x176b7e['as'],'attributes':_0x176b7e[_0x2f1c('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x2f1c('0xe')](function(_0x25008e){logger[_0x2f1c('0xf')]('GetCmHopperBlack',_0x3eee2a);logger[_0x2f1c('0x12')](_0x2f1c('0x18'),_0x3eee2a,JSON[_0x2f1c('0x21')](_0x25008e));_0x27b170(_0x25008e);})[_0x2f1c('0x17')](function(_0x5aa08f){logger[_0x2f1c('0x14')](_0x2f1c('0x18'),_0x5aa08f[_0x2f1c('0x16')],_0x3eee2a);_0x4e018a(_0x3c3f05[_0x2f1c('0x14')](0x1f4,_0x5aa08f[_0x2f1c('0x16')]));});});};exports[_0x2f1c('0x22')]=function(_0x47ce76){var _0x20770b=this;return new Promise(function(_0x15d769,_0x54de17){return db['CmHopperBlack'][_0x2f1c('0x23')](_0x47ce76['body'],{'raw':_0x47ce76[_0x2f1c('0x19')]?_0x47ce76['options'][_0x2f1c('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x47ce76['options']?_0x47ce76[_0x2f1c('0x19')]['where']||null:null,'attributes':_0x47ce76[_0x2f1c('0x19')]?_0x47ce76[_0x2f1c('0x19')][_0x2f1c('0x1f')]||null:null,'limit':_0x47ce76['options']?_0x47ce76[_0x2f1c('0x19')][_0x2f1c('0x1c')]||null:null})['then'](function(_0x58ac9c){logger[_0x2f1c('0xf')](_0x2f1c('0x22'),_0x47ce76);logger[_0x2f1c('0x12')](_0x2f1c('0x22'),_0x47ce76,JSON[_0x2f1c('0x21')](_0x58ac9c));_0x15d769(_0x58ac9c);})[_0x2f1c('0x17')](function(_0x40e539){logger['error']('UpdateCmHopperBlack',_0x40e539[_0x2f1c('0x16')],_0x47ce76);_0x54de17(_0x20770b[_0x2f1c('0x14')](0x1f4,_0x40e539[_0x2f1c('0x16')]));});});};exports[_0x2f1c('0x24')]=function(_0x1080f9){var _0x205c9d=this;return new Promise(function(_0x3a81e9,_0x4432a3){return db['CmHopperBlack'][_0x2f1c('0x25')]({'where':_0x1080f9[_0x2f1c('0x19')]?_0x1080f9[_0x2f1c('0x19')]['where']||null:null})[_0x2f1c('0xe')](function(_0x5d6fa7){logger[_0x2f1c('0xf')](_0x2f1c('0x24'),_0x1080f9);logger[_0x2f1c('0x12')]('DestroyCmHopperBlack',_0x1080f9,JSON[_0x2f1c('0x21')](_0x5d6fa7));_0x3a81e9(_0x5d6fa7);})[_0x2f1c('0x17')](function(_0x39c392){logger['error']('DestroyCmHopperBlack',_0x39c392[_0x2f1c('0x16')],_0x1080f9);_0x4432a3(_0x205c9d[_0x2f1c('0x14')](0x1f4,_0x39c392[_0x2f1c('0x16')]));});});}; \ No newline at end of file +var _0xf5b0=['request','then','CmHopperBlack,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','info','result','catch','GetCmHopperBlack','CmHopperBlack','findAll','options','raw','where','attributes','include','map','model','update','limit','UpdateCmHopperBlack','DestroyCmHopperBlack','destroy','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0x425213,_0x5b0300){var _0x4c2ba2=function(_0x2bf696){while(--_0x2bf696){_0x425213['push'](_0x425213['shift']());}};_0x4c2ba2(++_0x5b0300);}(_0xf5b0,0x8a));var _0x0f5b=function(_0x55e08b,_0x421620){_0x55e08b=_0x55e08b-0x0;var _0xd1a7ff=_0xf5b0[_0x55e08b];return _0xd1a7ff;};'use strict';var _=require('lodash');var util=require(_0x0f5b('0x0'));var moment=require('moment');var BPromise=require(_0x0f5b('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0f5b('0x2'));var db=require(_0x0f5b('0x3'))['db'];var utils=require(_0x0f5b('0x4'));var logger=require(_0x0f5b('0x5'))('rpc');var config=require(_0x0f5b('0x6'));var jayson=require(_0x0f5b('0x7'));var client=jayson[_0x0f5b('0x8')][_0x0f5b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5a0ed4,_0x1b8e5e,_0xe0ad6f){return new BPromise(function(_0x2ab145,_0x4896ca){return client[_0x0f5b('0xa')](_0x5a0ed4,_0xe0ad6f)[_0x0f5b('0xb')](function(_0x548b7d){logger['info'](_0x0f5b('0xc'),_0x1b8e5e,'request\x20sent');logger[_0x0f5b('0xd')]('CmHopperBlack,\x20%s,\x20%s,\x20%s',_0x1b8e5e,_0x0f5b('0xe'),JSON[_0x0f5b('0xf')](_0x548b7d));if(_0x548b7d['error']){if(_0x548b7d[_0x0f5b('0x10')][_0x0f5b('0x11')]===0x1f4){logger[_0x0f5b('0x10')](_0x0f5b('0xc'),_0x1b8e5e,_0x548b7d[_0x0f5b('0x10')]['message']);return _0x4896ca(_0x548b7d['error'][_0x0f5b('0x12')]);}logger['error'](_0x0f5b('0xc'),_0x1b8e5e,_0x548b7d[_0x0f5b('0x10')][_0x0f5b('0x12')]);return _0x2ab145(_0x548b7d[_0x0f5b('0x10')]['message']);}else{logger[_0x0f5b('0x13')](_0x0f5b('0xc'),_0x1b8e5e,_0x0f5b('0xe'));_0x2ab145(_0x548b7d[_0x0f5b('0x14')][_0x0f5b('0x12')]);}})[_0x0f5b('0x15')](function(_0x149655){logger[_0x0f5b('0x10')](_0x0f5b('0xc'),_0x1b8e5e,_0x149655);_0x4896ca(_0x149655);});});}exports[_0x0f5b('0x16')]=function(_0x224eb8){var _0x557218=this;return new Promise(function(_0x2453a0,_0x10ba6c){return db[_0x0f5b('0x17')][_0x0f5b('0x18')]({'raw':_0x224eb8[_0x0f5b('0x19')]?_0x224eb8[_0x0f5b('0x19')][_0x0f5b('0x1a')]===undefined?!![]:![]:!![],'where':_0x224eb8['options']?_0x224eb8['options'][_0x0f5b('0x1b')]||null:null,'attributes':_0x224eb8[_0x0f5b('0x19')]?_0x224eb8[_0x0f5b('0x19')][_0x0f5b('0x1c')]||null:null,'limit':_0x224eb8[_0x0f5b('0x19')]?_0x224eb8['options']['limit']||null:null,'include':_0x224eb8[_0x0f5b('0x19')]?_0x224eb8['options'][_0x0f5b('0x1d')]?_[_0x0f5b('0x1e')](_0x224eb8['options'][_0x0f5b('0x1d')],function(_0x555761){return{'model':db[_0x555761[_0x0f5b('0x1f')]],'as':_0x555761['as'],'attributes':_0x555761[_0x0f5b('0x1c')],'include':_0x555761[_0x0f5b('0x1d')]?_[_0x0f5b('0x1e')](_0x555761[_0x0f5b('0x1d')],function(_0x51675b){return{'model':db[_0x51675b[_0x0f5b('0x1f')]],'as':_0x51675b['as'],'attributes':_0x51675b[_0x0f5b('0x1c')],'include':_0x51675b[_0x0f5b('0x1d')]?_['map'](_0x51675b['include'],function(_0x49837d){return{'model':db[_0x49837d[_0x0f5b('0x1f')]],'as':_0x49837d['as'],'attributes':_0x49837d['attributes']};}):[]};}):[]};}):[]:[]})[_0x0f5b('0xb')](function(_0x3314a5){logger[_0x0f5b('0x13')](_0x0f5b('0x16'),_0x224eb8);logger['debug']('GetCmHopperBlack',_0x224eb8,JSON['stringify'](_0x3314a5));_0x2453a0(_0x3314a5);})[_0x0f5b('0x15')](function(_0x2fca1a){logger[_0x0f5b('0x10')](_0x0f5b('0x16'),_0x2fca1a['message'],_0x224eb8);_0x10ba6c(_0x557218[_0x0f5b('0x10')](0x1f4,_0x2fca1a[_0x0f5b('0x12')]));});});};exports['UpdateCmHopperBlack']=function(_0x8df301){var _0x40ba05=this;return new Promise(function(_0x34726c,_0xfc473b){return db[_0x0f5b('0x17')][_0x0f5b('0x20')](_0x8df301['body'],{'raw':_0x8df301[_0x0f5b('0x19')]?_0x8df301[_0x0f5b('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x8df301['options']?_0x8df301[_0x0f5b('0x19')][_0x0f5b('0x1b')]||null:null,'attributes':_0x8df301[_0x0f5b('0x19')]?_0x8df301['options'][_0x0f5b('0x1c')]||null:null,'limit':_0x8df301[_0x0f5b('0x19')]?_0x8df301['options'][_0x0f5b('0x21')]||null:null})[_0x0f5b('0xb')](function(_0x32a178){logger['info'](_0x0f5b('0x22'),_0x8df301);logger['debug'](_0x0f5b('0x22'),_0x8df301,JSON[_0x0f5b('0xf')](_0x32a178));_0x34726c(_0x32a178);})['catch'](function(_0x609073){logger['error'](_0x0f5b('0x22'),_0x609073[_0x0f5b('0x12')],_0x8df301);_0xfc473b(_0x40ba05['error'](0x1f4,_0x609073['message']));});});};exports[_0x0f5b('0x23')]=function(_0x2cddfa){var _0x4d7a9a=this;return new Promise(function(_0x10c7c6,_0x4d6fa1){return db[_0x0f5b('0x17')][_0x0f5b('0x24')]({'where':_0x2cddfa['options']?_0x2cddfa[_0x0f5b('0x19')][_0x0f5b('0x1b')]||null:null})[_0x0f5b('0xb')](function(_0x57c582){logger[_0x0f5b('0x13')](_0x0f5b('0x23'),_0x2cddfa);logger[_0x0f5b('0xd')]('DestroyCmHopperBlack',_0x2cddfa,JSON[_0x0f5b('0xf')](_0x57c582));_0x10c7c6(_0x57c582);})[_0x0f5b('0x15')](function(_0x40ecca){logger[_0x0f5b('0x10')](_0x0f5b('0x23'),_0x40ecca['message'],_0x2cddfa);_0x4d6fa1(_0x4d7a9a['error'](0x1f4,_0x40ecca[_0x0f5b('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index 024d24d..91db552 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 _0xaa3f=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','index','/describe','isAuthenticated','describe','/:id','show','put','update','delete','destroy','exports','multer','util'];(function(_0x4794c3,_0x19c201){var _0x4622a7=function(_0x1ced84){while(--_0x1ced84){_0x4794c3['push'](_0x4794c3['shift']());}};_0x4622a7(++_0x19c201);}(_0xaa3f,0xbb));var _0xfaa3=function(_0x18c2e7,_0x34bb35){_0x18c2e7=_0x18c2e7-0x0;var _0x3889ec=_0xaa3f[_0x18c2e7];return _0x3889ec;};'use strict';var multer=require(_0xfaa3('0x0'));var util=require(_0xfaa3('0x1'));var path=require(_0xfaa3('0x2'));var timeout=require(_0xfaa3('0x3'));var express=require(_0xfaa3('0x4'));var router=express[_0xfaa3('0x5')]();var fs_extra=require(_0xfaa3('0x6'));var auth=require(_0xfaa3('0x7'));var interaction=require(_0xfaa3('0x8'));var config=require('../../config/environment');var controller=require('./cmHopperBlack.controller');router[_0xfaa3('0x9')]('/',auth['isAuthenticated'](),controller[_0xfaa3('0xa')]);router[_0xfaa3('0x9')](_0xfaa3('0xb'),auth[_0xfaa3('0xc')](),controller[_0xfaa3('0xd')]);router[_0xfaa3('0x9')](_0xfaa3('0xe'),auth['isAuthenticated'](),controller[_0xfaa3('0xf')]);router[_0xfaa3('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xfaa3('0x11')]);router[_0xfaa3('0x12')](_0xfaa3('0xe'),auth[_0xfaa3('0xc')](),controller[_0xfaa3('0x13')]);module[_0xfaa3('0x14')]=router; \ No newline at end of file +var _0xa6b0=['update','delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','get','isAuthenticated','index','/describe','describe','/:id','put'];(function(_0xc838b8,_0x2f4309){var _0x18c0be=function(_0x2d81cd){while(--_0x2d81cd){_0xc838b8['push'](_0xc838b8['shift']());}};_0x18c0be(++_0x2f4309);}(_0xa6b0,0xaf));var _0x0a6b=function(_0xdd929b,_0x3ff13b){_0xdd929b=_0xdd929b-0x0;var _0x557edb=_0xa6b0[_0xdd929b];return _0x557edb;};'use strict';var multer=require(_0x0a6b('0x0'));var util=require(_0x0a6b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x0a6b('0x2'));var router=express[_0x0a6b('0x3')]();var fs_extra=require(_0x0a6b('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x0a6b('0x5'));var config=require(_0x0a6b('0x6'));var controller=require(_0x0a6b('0x7'));router[_0x0a6b('0x8')]('/',auth[_0x0a6b('0x9')](),controller[_0x0a6b('0xa')]);router[_0x0a6b('0x8')](_0x0a6b('0xb'),auth[_0x0a6b('0x9')](),controller[_0x0a6b('0xc')]);router[_0x0a6b('0x8')](_0x0a6b('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x0a6b('0xe')](_0x0a6b('0xd'),auth[_0x0a6b('0x9')](),controller[_0x0a6b('0xf')]);router[_0x0a6b('0x10')](_0x0a6b('0xd'),auth[_0x0a6b('0x9')](),controller[_0x0a6b('0x11')]);module[_0x0a6b('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index b26cb15..fd1cfb4 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 _0xc404=['STRING','DATE','getDataValue','endtime','setDataValue','followuptime','diff','seconds','BOOLEAN','sequelize','moment','exports','INTEGER'];(function(_0x25fc01,_0x4ce7ee){var _0x81fbe9=function(_0x193d62){while(--_0x193d62){_0x25fc01['push'](_0x25fc01['shift']());}};_0x81fbe9(++_0x4ce7ee);}(_0xc404,0x100));var _0x4c40=function(_0x56c328,_0x3de3e4){_0x56c328=_0x56c328-0x0;var _0x215c99=_0xc404[_0x56c328];return _0x215c99;};'use strict';var Sequelize=require(_0x4c40('0x0'));var moment=require(_0x4c40('0x1'));module[_0x4c40('0x2')]={'state':{'type':Sequelize[_0x4c40('0x3')](0x2)},'statedesc':{'type':Sequelize[_0x4c40('0x4')]},'scheduledat':{'type':Sequelize[_0x4c40('0x5')]},'countbusyretry':{'type':Sequelize[_0x4c40('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x4c40('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x4c40('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x4c40('0x4')]},'originatecalleridnum':{'type':Sequelize[_0x4c40('0x4')]},'originatecalleridname':{'type':Sequelize[_0x4c40('0x4')]},'calleridnum':{'type':Sequelize[_0x4c40('0x4')]},'calleridname':{'type':Sequelize[_0x4c40('0x4')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x4c40('0x5')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0x4c40('0x5')]},'endtime':{'type':Sequelize[_0x4c40('0x5')]},'ringtime':{'type':Sequelize[_0x4c40('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x4c40('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0x4c40('0x4')]},'campaigntype':{'type':Sequelize[_0x4c40('0x4')]},'membername':{'type':Sequelize[_0x4c40('0x4')]},'reason':{'type':Sequelize[_0x4c40('0x4')]},'disposition':{'type':Sequelize[_0x4c40('0x4')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'dispositionat':{'type':Sequelize[_0x4c40('0x5')],'set':function(_0x42e478){var _0x1479c0=this[_0x4c40('0x6')](_0x4c40('0x7'));if(_0x1479c0&&_0x42e478){this[_0x4c40('0x8')](_0x4c40('0x9'),moment(_0x42e478)[_0x4c40('0xa')](moment(_0x1479c0),_0x4c40('0xb')));}}},'amd':{'type':Sequelize[_0x4c40('0xc')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'blacklist':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x4c40('0x5')]},'callback':{'type':Sequelize[_0x4c40('0xc')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x4c40('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'deleted':{'type':Sequelize[_0x4c40('0x4')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x4c40('0x5')]},'recallme':{'type':Sequelize[_0x4c40('0xc')],'defaultValue':![]},'agiafterat':{'type':Sequelize['DATE']},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x4c40('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x4c40('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x4c40('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xf2e6=['BOOLEAN','sequelize','moment','INTEGER','STRING','DATE','getDataValue','endtime','setDataValue','followuptime','diff'];(function(_0x15af6a,_0x59ada8){var _0x35f3fb=function(_0x1fd898){while(--_0x1fd898){_0x15af6a['push'](_0x15af6a['shift']());}};_0x35f3fb(++_0x59ada8);}(_0xf2e6,0x6f));var _0x6f2e=function(_0x1deb03,_0xd05ad8){_0x1deb03=_0x1deb03-0x0;var _0x189fe7=_0xf2e6[_0x1deb03];return _0x189fe7;};'use strict';var Sequelize=require(_0x6f2e('0x0'));var moment=require(_0x6f2e('0x1'));module['exports']={'state':{'type':Sequelize[_0x6f2e('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x6f2e('0x3')]},'scheduledat':{'type':Sequelize[_0x6f2e('0x4')]},'countbusyretry':{'type':Sequelize[_0x6f2e('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x6f2e('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x6f2e('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x6f2e('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x6f2e('0x3')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x6f2e('0x3')]},'calleridname':{'type':Sequelize[_0x6f2e('0x3')]},'starttime':{'type':Sequelize[_0x6f2e('0x4')]},'responsetime':{'type':Sequelize[_0x6f2e('0x4')]},'answertime':{'type':Sequelize[_0x6f2e('0x4')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x6f2e('0x4')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x6f2e('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x6f2e('0x3')]},'campaign':{'type':Sequelize[_0x6f2e('0x3')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0x6f2e('0x3')]},'disposition':{'type':Sequelize[_0x6f2e('0x3')]},'secondDisposition':{'type':Sequelize[_0x6f2e('0x3')]},'thirdDisposition':{'type':Sequelize[_0x6f2e('0x3')]},'dispositionat':{'type':Sequelize['DATE'],'set':function(_0x559e28){var _0x6d1e96=this[_0x6f2e('0x5')](_0x6f2e('0x6'));if(_0x6d1e96&&_0x559e28){this[_0x6f2e('0x7')](_0x6f2e('0x8'),moment(_0x559e28)[_0x6f2e('0x9')](moment(_0x6d1e96),'seconds'));}}},'amd':{'type':Sequelize[_0x6f2e('0xa')],'defaultValue':![]},'fax':{'type':Sequelize[_0x6f2e('0xa')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x6f2e('0xa')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x6f2e('0xa')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x6f2e('0x4')]},'callback':{'type':Sequelize[_0x6f2e('0xa')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x6f2e('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'deleted':{'type':Sequelize[_0x6f2e('0x3')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x6f2e('0x4')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x6f2e('0x4')]},'countnosuchnumberretry':{'type':Sequelize[_0x6f2e('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x6f2e('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x6f2e('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.controller.js b/server/api/cmHopperFinal/cmHopperFinal.controller.js index eedcb77..1912eed 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 _0x4888=['ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','VoiceQueueId','NOW()','from','VoiceQueueId\x20=\x20?','state\x20=\x20?','state','toString','calleridnum\x20NOT\x20IN\x20(?)','calleridnum','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','Campaign','find','CampaignId','ANY_VALUE(calleridnum)','ANY_VALUE(CampaignId)','cm_hopper_final','CampaignId\x20=\x20?','checkContactHopper','CmHopper','findOne','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','json','offset','limit','undefined','count','set','apply','reject','save','then','sendStatus','error','name','send','index','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','VIRTUAL','merge','CmHopperFinal','includeAll','include','rows','catch','params','options','describe','update','body','uniqueid','countContactsQueueCampaignHopperFinal','findAll','COUNT','sequelize','literal','noSuchContacts','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','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=\x200,\x201,\x20null','`state`\x20=\x208,\x201,\x20null','dropContacts','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ListId','createdAt','updatedAt','select','field','ANY_VALUE(ContactId)','ContactId'];(function(_0x13606d,_0x30f265){var _0x1b85b0=function(_0x285c1b){while(--_0x285c1b){_0x13606d['push'](_0x13606d['shift']());}};_0x1b85b0(++_0x30f265);}(_0x4888,0x198));var _0x8488=function(_0x3bc298,_0x583d14){_0x3bc298=_0x3bc298-0x0;var _0x31bf58=_0x4888[_0x3bc298];return _0x31bf58;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8488('0x0'));var zipdir=require(_0x8488('0x1'));var jsonpatch=require(_0x8488('0x2'));var rp=require(_0x8488('0x3'));var moment=require(_0x8488('0x4'));var BPromise=require(_0x8488('0x5'));var Mustache=require(_0x8488('0x6'));var util=require('util');var path=require(_0x8488('0x7'));var sox=require(_0x8488('0x8'));var csv=require(_0x8488('0x9'));var ejs=require(_0x8488('0xa'));var fs=require('fs');var fs_extra=require(_0x8488('0xb'));var _=require(_0x8488('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x8488('0x9'));var querystring=require(_0x8488('0xd'));var Papa=require('papaparse');var Redis=require(_0x8488('0xe'));var authService=require(_0x8488('0xf'));var qs=require(_0x8488('0x10'));var as=require(_0x8488('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8488('0x12'))(_0x8488('0x13'));var utils=require(_0x8488('0x14'));var config=require(_0x8488('0x15'));var licenseUtil=require(_0x8488('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x14462e,_0x3d1f7a){_0x3d1f7a=_0x3d1f7a||0xcc;return function(_0x58f83d){if(_0x58f83d){return _0x14462e['sendStatus'](_0x3d1f7a);}return _0x14462e[_0x8488('0x17')](_0x3d1f7a)['end']();};}function respondWithResult(_0x214083,_0x4e94fc){_0x4e94fc=_0x4e94fc||0xc8;return function(_0x5161a3){if(_0x5161a3){return _0x214083[_0x8488('0x17')](_0x4e94fc)[_0x8488('0x18')](_0x5161a3);}};}function respondWithFilteredResult(_0x5700b,_0x2bcb7c){return function(_0x3b3cfa){if(_0x3b3cfa){var _0x8d3b3d=typeof _0x2bcb7c[_0x8488('0x19')]==='undefined'&&typeof _0x2bcb7c[_0x8488('0x1a')]===_0x8488('0x1b');var _0x3edfe4=_0x3b3cfa[_0x8488('0x1c')];var _0x60ae2f=_0x8d3b3d?0x0:_0x2bcb7c[_0x8488('0x19')];var _0x1aedb1=_0x8d3b3d?_0x3b3cfa[_0x8488('0x1c')]:_0x2bcb7c[_0x8488('0x19')]+_0x2bcb7c[_0x8488('0x1a')];var _0x10bfd6;if(_0x1aedb1>=_0x3edfe4){_0x1aedb1=_0x3edfe4;_0x10bfd6=0xc8;}else{_0x10bfd6=0xce;}_0x5700b[_0x8488('0x17')](_0x10bfd6);return _0x5700b[_0x8488('0x1d')]('Content-Range',_0x60ae2f+'-'+_0x1aedb1+'/'+_0x3edfe4)['json'](_0x3b3cfa);}return null;};}function patchUpdates(_0x340d6b){return function(_0x12d40f){try{jsonpatch[_0x8488('0x1e')](_0x12d40f,_0x340d6b,!![]);}catch(_0x3c9fc2){return BPromise[_0x8488('0x1f')](_0x3c9fc2);}return _0x12d40f[_0x8488('0x20')]();};}function saveUpdates(_0x43b672,_0x3c078c){return function(_0x39dd43){if(_0x39dd43){return _0x39dd43['update'](_0x43b672)[_0x8488('0x21')](function(_0x4e07e1){return _0x4e07e1;});}return null;};}function removeEntity(_0x140b0b,_0x1361a6){return function(_0x290b33){if(_0x290b33){return _0x290b33['destroy']()['then'](function(){_0x140b0b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x472624,_0x51fe30){return function(_0x58057a){if(!_0x58057a){_0x472624[_0x8488('0x22')](0x194);}return _0x58057a;};}function handleError(_0x2f350a,_0x2b3c97){_0x2b3c97=_0x2b3c97||0x1f4;return function(_0x6ebee0){logger[_0x8488('0x23')](_0x6ebee0['stack']);if(_0x6ebee0[_0x8488('0x24')]){delete _0x6ebee0[_0x8488('0x24')];}_0x2f350a[_0x8488('0x17')](_0x2b3c97)[_0x8488('0x25')](_0x6ebee0);};}exports[_0x8488('0x26')]=function(_0x27f5cf,_0x2c15ff){var _0x296b6c={},_0x368f9c={},_0x1d9317={'count':0x0,'rows':[]};var _0x888b24=_['map'](db['CmHopperFinal']['rawAttributes'],function(_0x292fe8){return{'name':_0x292fe8[_0x8488('0x27')],'type':_0x292fe8[_0x8488('0x28')][_0x8488('0x29')]};});_0x368f9c[_0x8488('0x2a')]=_[_0x8488('0x2b')](_0x888b24,'name');_0x368f9c[_0x8488('0x2c')]=_[_0x8488('0x2d')](_0x27f5cf[_0x8488('0x2c')]);_0x368f9c[_0x8488('0x2e')]=_[_0x8488('0x2f')](_0x368f9c['model'],_0x368f9c[_0x8488('0x2c')]);_0x296b6c[_0x8488('0x30')]=_['intersection'](_0x368f9c[_0x8488('0x2a')],qs[_0x8488('0x31')](_0x27f5cf[_0x8488('0x2c')][_0x8488('0x31')]));_0x296b6c[_0x8488('0x30')]=_0x296b6c['attributes'][_0x8488('0x32')]?_0x296b6c[_0x8488('0x30')]:_0x368f9c[_0x8488('0x2a')];if(!_0x27f5cf['query'][_0x8488('0x33')]('nolimit')){_0x296b6c[_0x8488('0x1a')]=qs[_0x8488('0x1a')](_0x27f5cf[_0x8488('0x2c')][_0x8488('0x1a')]);_0x296b6c['offset']=qs[_0x8488('0x19')](_0x27f5cf[_0x8488('0x2c')][_0x8488('0x19')]);}_0x296b6c['order']=qs[_0x8488('0x34')](_0x27f5cf[_0x8488('0x2c')][_0x8488('0x34')]);_0x296b6c[_0x8488('0x35')]=qs[_0x8488('0x2e')](_[_0x8488('0x36')](_0x27f5cf[_0x8488('0x2c')],_0x368f9c[_0x8488('0x2e')]),_0x888b24);if(_0x27f5cf[_0x8488('0x2c')][_0x8488('0x37')]){_0x296b6c[_0x8488('0x35')]=_['merge'](_0x296b6c['where'],{'$or':_[_0x8488('0x2b')](_0x888b24,function(_0x36c17a){if(_0x36c17a[_0x8488('0x28')]!==_0x8488('0x38')){var _0x2d9fa1={};_0x2d9fa1[_0x36c17a[_0x8488('0x24')]]={'$like':'%'+_0x27f5cf[_0x8488('0x2c')][_0x8488('0x37')]+'%'};return _0x2d9fa1;}})});}_0x296b6c=_[_0x8488('0x39')]({},_0x296b6c,_0x27f5cf['options']);var _0xf5a0a0={'where':_0x296b6c[_0x8488('0x35')]};return db[_0x8488('0x3a')]['count'](_0xf5a0a0)[_0x8488('0x21')](function(_0xa50c4b){_0x1d9317[_0x8488('0x1c')]=_0xa50c4b;if(_0x27f5cf[_0x8488('0x2c')][_0x8488('0x3b')]){_0x296b6c[_0x8488('0x3c')]=[{'all':!![]}];}return db[_0x8488('0x3a')]['findAll'](_0x296b6c);})[_0x8488('0x21')](function(_0x1c33a1){_0x1d9317[_0x8488('0x3d')]=_0x1c33a1;return _0x1d9317;})['then'](respondWithFilteredResult(_0x2c15ff,_0x296b6c))[_0x8488('0x3e')](handleError(_0x2c15ff,null));};exports['show']=function(_0x40ee7e,_0x34b11b){var _0x5cbd11={'raw':!![],'where':{'id':_0x40ee7e[_0x8488('0x3f')]['id']}},_0x22a3f3={};_0x22a3f3[_0x8488('0x2a')]=_[_0x8488('0x2d')](db[_0x8488('0x3a')]['rawAttributes']);_0x22a3f3[_0x8488('0x2c')]=_['keys'](_0x40ee7e[_0x8488('0x2c')]);_0x22a3f3[_0x8488('0x2e')]=_[_0x8488('0x2f')](_0x22a3f3[_0x8488('0x2a')],_0x22a3f3[_0x8488('0x2c')]);_0x5cbd11[_0x8488('0x30')]=_[_0x8488('0x2f')](_0x22a3f3[_0x8488('0x2a')],qs[_0x8488('0x31')](_0x40ee7e[_0x8488('0x2c')][_0x8488('0x31')]));_0x5cbd11[_0x8488('0x30')]=_0x5cbd11[_0x8488('0x30')][_0x8488('0x32')]?_0x5cbd11[_0x8488('0x30')]:_0x22a3f3[_0x8488('0x2a')];if(_0x40ee7e[_0x8488('0x2c')]['includeAll']){_0x5cbd11[_0x8488('0x3c')]=[{'all':!![]}];}_0x5cbd11=_[_0x8488('0x39')]({},_0x5cbd11,_0x40ee7e[_0x8488('0x40')]);return db[_0x8488('0x3a')]['find'](_0x5cbd11)[_0x8488('0x21')](handleEntityNotFound(_0x34b11b,null))[_0x8488('0x21')](respondWithResult(_0x34b11b,null))[_0x8488('0x3e')](handleError(_0x34b11b,null));};exports[_0x8488('0x41')]=function(_0x52042c,_0x1f0516){return db[_0x8488('0x3a')][_0x8488('0x41')]()[_0x8488('0x21')](respondWithResult(_0x1f0516,null))[_0x8488('0x3e')](handleError(_0x1f0516,null));};exports[_0x8488('0x42')]=function(_0x886a9e,_0x299d8e){if(_0x886a9e[_0x8488('0x43')][_0x8488('0x44')]){delete _0x886a9e[_0x8488('0x43')][_0x8488('0x44')];}return db[_0x8488('0x3a')]['find']({'where':{'uniqueid':_0x886a9e['params']['id']}})[_0x8488('0x21')](handleEntityNotFound(_0x299d8e,null))[_0x8488('0x21')](saveUpdates(_0x886a9e[_0x8488('0x43')],null))[_0x8488('0x21')](respondWithResult(_0x299d8e,null))[_0x8488('0x3e')](handleError(_0x299d8e,null));};exports[_0x8488('0x45')]=function(_0x25f2dc,_0x27dfd2,_0x24fa20){return db['CmHopperFinal'][_0x8488('0x46')]({'raw':![],'where':{'VoiceQueueId':_0x25f2dc[_0x8488('0x3f')]['id']},'attributes':[[db['sequelize']['fn'](_0x8488('0x47'),db[_0x8488('0x48')]['fn']('IF',db[_0x8488('0x48')][_0x8488('0x49')]('`state`\x20=\x200,\x201,\x20null'))),_0x8488('0x4a')],[db[_0x8488('0x48')]['fn'](_0x8488('0x47'),db['sequelize']['fn']('IF',db[_0x8488('0x48')][_0x8488('0x49')](_0x8488('0x4b')))),_0x8488('0x4c')],[db['sequelize']['fn'](_0x8488('0x47'),db['sequelize']['fn']('IF',db['sequelize'][_0x8488('0x49')]('`state`\x20=\x205,\x201,\x20null'))),_0x8488('0x4d')],[db[_0x8488('0x48')]['fn'](_0x8488('0x47'),db[_0x8488('0x48')]['fn']('IF',db[_0x8488('0x48')][_0x8488('0x49')]('`state`\x20=\x208,\x201,\x20null'))),_0x8488('0x4e')],[db[_0x8488('0x48')]['fn'](_0x8488('0x47'),db[_0x8488('0x48')]['fn']('IF',db[_0x8488('0x48')]['literal'](_0x8488('0x4f')))),'dropContacts'],[db[_0x8488('0x48')]['fn'](_0x8488('0x47'),db['sequelize']['fn']('IF',db[_0x8488('0x48')][_0x8488('0x49')](_0x8488('0x50')))),_0x8488('0x51')],[db[_0x8488('0x48')]['fn'](_0x8488('0x47'),db['sequelize']['fn']('IF',db[_0x8488('0x48')]['literal'](_0x8488('0x52')))),_0x8488('0x53')],[db[_0x8488('0x48')]['fn'](_0x8488('0x47'),db[_0x8488('0x48')]['fn']('IF',db[_0x8488('0x48')]['literal'](_0x8488('0x54')))),'answeringMachine']]})[_0x8488('0x21')](handleEntityNotFound(_0x27dfd2,null))[_0x8488('0x21')](respondWithResult(_0x27dfd2,null))[_0x8488('0x3e')](handleError(_0x27dfd2,null));};exports[_0x8488('0x55')]=function(_0x1971f3,_0x24ba2d,_0x4facfb){return db['CmHopperFinal']['findAll']({'raw':![],'where':{'CampaignId':_0x1971f3[_0x8488('0x3f')]['id']},'attributes':[[db[_0x8488('0x48')]['fn'](_0x8488('0x47'),db[_0x8488('0x48')]['fn']('IF',db[_0x8488('0x48')][_0x8488('0x49')](_0x8488('0x56')))),_0x8488('0x4a')],[db[_0x8488('0x48')]['fn'](_0x8488('0x47'),db['sequelize']['fn']('IF',db[_0x8488('0x48')][_0x8488('0x49')](_0x8488('0x4b')))),'noAnswerContacts'],[db['sequelize']['fn'](_0x8488('0x47'),db[_0x8488('0x48')]['fn']('IF',db[_0x8488('0x48')][_0x8488('0x49')]('`state`\x20=\x205,\x201,\x20null'))),'busyContacts'],[db[_0x8488('0x48')]['fn'](_0x8488('0x47'),db[_0x8488('0x48')]['fn']('IF',db['sequelize'][_0x8488('0x49')](_0x8488('0x57')))),_0x8488('0x4e')],[db[_0x8488('0x48')]['fn'](_0x8488('0x47'),db['sequelize']['fn']('IF',db[_0x8488('0x48')][_0x8488('0x49')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x8488('0x58')],[db[_0x8488('0x48')]['fn']('COUNT',db[_0x8488('0x48')]['fn']('IF',db[_0x8488('0x48')][_0x8488('0x49')](_0x8488('0x50')))),_0x8488('0x51')],[db[_0x8488('0x48')]['fn'](_0x8488('0x47'),db['sequelize']['fn']('IF',db[_0x8488('0x48')][_0x8488('0x49')]('`state`\x20=\x2022,\x201,\x20null'))),'reCallContacts'],[db[_0x8488('0x48')]['fn'](_0x8488('0x47'),db[_0x8488('0x48')]['fn']('IF',db['sequelize'][_0x8488('0x49')](_0x8488('0x54')))),'answeringMachine']]})[_0x8488('0x21')](handleEntityNotFound(_0x24ba2d,null))['then'](respondWithResult(_0x24ba2d,null))[_0x8488('0x3e')](handleError(_0x24ba2d,null));};exports[_0x8488('0x59')]=function(_0x44a50b,_0x5815cb,_0xbee86e){return db[_0x8488('0x5a')]['find']({'where':{'id':_0x44a50b['params']['id']}})[_0x8488('0x21')](handleEntityNotFound(_0x5815cb,null))[_0x8488('0x21')](function(_0xfedfd2){var _0x3ab1b6;if(_0xfedfd2){_0x3ab1b6=squel[_0x8488('0x5b')]()[_0x8488('0x5c')](_0x8488('0x5d'))[_0x8488('0x5e')]([_0x8488('0x5f'),_0x8488('0x60'),'ContactId',_0x8488('0x61'),'VoiceQueueId',_0x8488('0x62'),_0x8488('0x63')],squel[_0x8488('0x64')]()[_0x8488('0x65')]('ANY_VALUE(calleridnum)',_0x8488('0x5f'))[_0x8488('0x65')]('NOW()',_0x8488('0x60'))['field'](_0x8488('0x66'),_0x8488('0x67'))[_0x8488('0x65')](_0x8488('0x68'),_0x8488('0x61'))[_0x8488('0x65')](_0x8488('0x69'),_0x8488('0x6a'))['field'](_0x8488('0x6b'),'createdAt')['field'](_0x8488('0x6b'),_0x8488('0x63'))[_0x8488('0x6c')]('cm_hopper_final')['where'](_0x8488('0x6d'),_0x44a50b[_0x8488('0x3f')]['id']['toString']())[_0x8488('0x35')](_0x8488('0x6e'),_0x44a50b[_0x8488('0x43')][_0x8488('0x6f')][_0x8488('0x70')]())[_0x8488('0x35')]('calleridnum\x20IS\x20NOT\x20NULL')[_0x8488('0x35')](_0x8488('0x71'),squel[_0x8488('0x64')]()['field'](_0x8488('0x5f'))[_0x8488('0x6c')](_0x8488('0x5d'))['where'](_0x8488('0x6d'),_0x44a50b[_0x8488('0x3f')]['id']['toString']()))['where'](_0x8488('0x71'),squel[_0x8488('0x64')]()['field'](_0x8488('0x72'))[_0x8488('0x6c')]('cm_hopper_final')['where'](_0x8488('0x6d'),_0x44a50b['params']['id'][_0x8488('0x70')]())[_0x8488('0x35')](_0x8488('0x73')))[_0x8488('0x74')]('ContactId'))[_0x8488('0x70')]();return db['sequelize'][_0x8488('0x2c')](_0x3ab1b6);}return[];})['then'](respondWithResult(_0x5815cb,null))[_0x8488('0x3e')](handleError(_0x5815cb,null));};exports[_0x8488('0x75')]=function(_0x267401,_0x1e635a,_0x31ab35){return db[_0x8488('0x76')][_0x8488('0x77')]({'where':{'id':_0x267401[_0x8488('0x3f')]['id']}})[_0x8488('0x21')](handleEntityNotFound(_0x1e635a,null))[_0x8488('0x21')](function(_0xce1d1a){var _0xc9c221;if(_0xce1d1a){_0xc9c221=squel[_0x8488('0x5b')]()[_0x8488('0x5c')]('cm_hopper')[_0x8488('0x5e')]([_0x8488('0x5f'),'scheduledAt',_0x8488('0x67'),_0x8488('0x61'),_0x8488('0x78'),_0x8488('0x62'),_0x8488('0x63')],squel[_0x8488('0x64')]()[_0x8488('0x65')](_0x8488('0x79'),_0x8488('0x5f'))[_0x8488('0x65')](_0x8488('0x6b'),'scheduledAt')[_0x8488('0x65')](_0x8488('0x66'),'ContactId')[_0x8488('0x65')](_0x8488('0x68'),_0x8488('0x61'))[_0x8488('0x65')](_0x8488('0x7a'),'CampaignId')['field'](_0x8488('0x6b'),_0x8488('0x62'))[_0x8488('0x65')](_0x8488('0x6b'),_0x8488('0x63'))[_0x8488('0x6c')](_0x8488('0x7b'))[_0x8488('0x35')](_0x8488('0x7c'),_0x267401[_0x8488('0x3f')]['id'][_0x8488('0x70')]())[_0x8488('0x35')](_0x8488('0x6e'),_0x267401[_0x8488('0x43')][_0x8488('0x6f')]['toString']())[_0x8488('0x35')]('calleridnum\x20IS\x20NOT\x20NULL')['where'](_0x8488('0x71'),squel[_0x8488('0x64')]()[_0x8488('0x65')](_0x8488('0x5f'))[_0x8488('0x6c')](_0x8488('0x5d'))[_0x8488('0x35')](_0x8488('0x7c'),_0x267401[_0x8488('0x3f')]['id'][_0x8488('0x70')]()))['where'](_0x8488('0x71'),squel[_0x8488('0x64')]()[_0x8488('0x65')](_0x8488('0x72'))[_0x8488('0x6c')](_0x8488('0x7b'))['where'](_0x8488('0x7c'),_0x267401['params']['id'][_0x8488('0x70')]())[_0x8488('0x35')]('state\x20=\x204'))['group'](_0x8488('0x67')))[_0x8488('0x70')]();return db[_0x8488('0x48')][_0x8488('0x2c')](_0xc9c221);}return[];})[_0x8488('0x21')](respondWithResult(_0x1e635a,null))['catch'](handleError(_0x1e635a,null));};exports[_0x8488('0x7d')]=function(_0x19c5c6,_0x50f773,_0x52c750){return db[_0x8488('0x7e')][_0x8488('0x7f')]({'where':{'VoiceQueueId':_0x19c5c6[_0x8488('0x43')]['VoiceQueueId'],'CampaignId':_0x19c5c6['body'][_0x8488('0x78')],'ContactId':_0x19c5c6[_0x8488('0x43')][_0x8488('0x67')]}})['then'](handleEntityNotFound(_0x50f773,null))[_0x8488('0x21')](function(_0x1e4e51){if(_0x1e4e51){return _0x1e4e51;}return null;})[_0x8488('0x21')](respondWithResult(_0x50f773,null))[_0x8488('0x3e')](handleError(_0x50f773,null));}; \ No newline at end of file +var _0xacf4=['reject','update','then','destroy','error','stack','name','send','index','map','CmHopperFinal','rawAttributes','fieldName','key','model','query','keys','filters','attributes','fields','hasOwnProperty','sort','where','pick','filter','type','VIRTUAL','merge','options','include','findAll','rows','catch','show','params','intersection','length','includeAll','find','describe','body','uniqueid','countContactsQueueCampaignHopperFinal','sequelize','COUNT','literal','noSuchContacts','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','`state`\x20=\x208,\x201,\x20null','congestionContacts','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','`state`\x20=\x200,\x201,\x20null','busyContacts','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2022,\x201,\x20null','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','createdAt','updatedAt','field','ANY_VALUE(calleridnum)','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','VoiceQueueId','from','cm_hopper_final','VoiceQueueId\x20=\x20?','state\x20=\x20?','state','toString','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','Campaign','CampaignId','select','ANY_VALUE(ContactId)','ANY_VALUE(CampaignId)','NOW()','CampaignId\x20=\x20?','checkContactHopper','CmHopper','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range'];(function(_0x33cf69,_0x1b81ea){var _0x2f6922=function(_0x13e1bf){while(--_0x13e1bf){_0x33cf69['push'](_0x33cf69['shift']());}};_0x2f6922(++_0x1b81ea);}(_0xacf4,0xe7));var _0x4acf=function(_0x233f43,_0x600ccb){_0x233f43=_0x233f43-0x0;var _0x3059d4=_0xacf4[_0x233f43];return _0x3059d4;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x4acf('0x0'));var jsonpatch=require(_0x4acf('0x1'));var rp=require(_0x4acf('0x2'));var moment=require(_0x4acf('0x3'));var BPromise=require(_0x4acf('0x4'));var Mustache=require(_0x4acf('0x5'));var util=require(_0x4acf('0x6'));var path=require('path');var sox=require(_0x4acf('0x7'));var csv=require(_0x4acf('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4acf('0x9'));var _=require(_0x4acf('0xa'));var squel=require(_0x4acf('0xb'));var crypto=require(_0x4acf('0xc'));var jsforce=require(_0x4acf('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x4acf('0xe'));var Papa=require('papaparse');var Redis=require(_0x4acf('0xf'));var authService=require(_0x4acf('0x10'));var qs=require(_0x4acf('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4acf('0x12'));var logger=require(_0x4acf('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x4acf('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1783d2,_0x979f49){_0x979f49=_0x979f49||0xcc;return function(_0x3734e1){if(_0x3734e1){return _0x1783d2[_0x4acf('0x15')](_0x979f49);}return _0x1783d2[_0x4acf('0x16')](_0x979f49)[_0x4acf('0x17')]();};}function respondWithResult(_0x7ab3ea,_0x15386a){_0x15386a=_0x15386a||0xc8;return function(_0x2025ca){if(_0x2025ca){return _0x7ab3ea[_0x4acf('0x16')](_0x15386a)[_0x4acf('0x18')](_0x2025ca);}};}function respondWithFilteredResult(_0x5f0260,_0x1b584a){return function(_0x57d8e0){if(_0x57d8e0){var _0x34cec1=typeof _0x1b584a[_0x4acf('0x19')]===_0x4acf('0x1a')&&typeof _0x1b584a['limit']==='undefined';var _0x13d10e=_0x57d8e0[_0x4acf('0x1b')];var _0x240c00=_0x34cec1?0x0:_0x1b584a['offset'];var _0x2a678b=_0x34cec1?_0x57d8e0[_0x4acf('0x1b')]:_0x1b584a[_0x4acf('0x19')]+_0x1b584a[_0x4acf('0x1c')];var _0x2f0cec;if(_0x2a678b>=_0x13d10e){_0x2a678b=_0x13d10e;_0x2f0cec=0xc8;}else{_0x2f0cec=0xce;}_0x5f0260[_0x4acf('0x16')](_0x2f0cec);return _0x5f0260[_0x4acf('0x1d')](_0x4acf('0x1e'),_0x240c00+'-'+_0x2a678b+'/'+_0x13d10e)[_0x4acf('0x18')](_0x57d8e0);}return null;};}function patchUpdates(_0x2feb89){return function(_0x1a3118){try{jsonpatch['apply'](_0x1a3118,_0x2feb89,!![]);}catch(_0x28d698){return BPromise[_0x4acf('0x1f')](_0x28d698);}return _0x1a3118['save']();};}function saveUpdates(_0x41e5d2,_0x17775f){return function(_0x569d9e){if(_0x569d9e){return _0x569d9e[_0x4acf('0x20')](_0x41e5d2)[_0x4acf('0x21')](function(_0x433b7a){return _0x433b7a;});}return null;};}function removeEntity(_0x454555,_0x53885f){return function(_0x1a2286){if(_0x1a2286){return _0x1a2286[_0x4acf('0x22')]()['then'](function(){_0x454555[_0x4acf('0x16')](0xcc)[_0x4acf('0x17')]();});}};}function handleEntityNotFound(_0x52a84a,_0x126522){return function(_0x7ebb){if(!_0x7ebb){_0x52a84a[_0x4acf('0x15')](0x194);}return _0x7ebb;};}function handleError(_0x16458f,_0x571a30){_0x571a30=_0x571a30||0x1f4;return function(_0x50236d){logger[_0x4acf('0x23')](_0x50236d[_0x4acf('0x24')]);if(_0x50236d[_0x4acf('0x25')]){delete _0x50236d[_0x4acf('0x25')];}_0x16458f[_0x4acf('0x16')](_0x571a30)[_0x4acf('0x26')](_0x50236d);};}exports[_0x4acf('0x27')]=function(_0x7a1e79,_0x382c41){var _0x2a3830={},_0x57989e={},_0x3521c2={'count':0x0,'rows':[]};var _0x3f5614=_[_0x4acf('0x28')](db[_0x4acf('0x29')][_0x4acf('0x2a')],function(_0x28570f){return{'name':_0x28570f[_0x4acf('0x2b')],'type':_0x28570f['type'][_0x4acf('0x2c')]};});_0x57989e[_0x4acf('0x2d')]=_[_0x4acf('0x28')](_0x3f5614,'name');_0x57989e[_0x4acf('0x2e')]=_[_0x4acf('0x2f')](_0x7a1e79[_0x4acf('0x2e')]);_0x57989e[_0x4acf('0x30')]=_['intersection'](_0x57989e[_0x4acf('0x2d')],_0x57989e[_0x4acf('0x2e')]);_0x2a3830[_0x4acf('0x31')]=_['intersection'](_0x57989e[_0x4acf('0x2d')],qs[_0x4acf('0x32')](_0x7a1e79[_0x4acf('0x2e')][_0x4acf('0x32')]));_0x2a3830[_0x4acf('0x31')]=_0x2a3830[_0x4acf('0x31')]['length']?_0x2a3830[_0x4acf('0x31')]:_0x57989e[_0x4acf('0x2d')];if(!_0x7a1e79['query'][_0x4acf('0x33')]('nolimit')){_0x2a3830['limit']=qs['limit'](_0x7a1e79['query']['limit']);_0x2a3830['offset']=qs['offset'](_0x7a1e79[_0x4acf('0x2e')][_0x4acf('0x19')]);}_0x2a3830['order']=qs[_0x4acf('0x34')](_0x7a1e79[_0x4acf('0x2e')][_0x4acf('0x34')]);_0x2a3830[_0x4acf('0x35')]=qs[_0x4acf('0x30')](_[_0x4acf('0x36')](_0x7a1e79[_0x4acf('0x2e')],_0x57989e[_0x4acf('0x30')]),_0x3f5614);if(_0x7a1e79[_0x4acf('0x2e')][_0x4acf('0x37')]){_0x2a3830['where']=_['merge'](_0x2a3830[_0x4acf('0x35')],{'$or':_[_0x4acf('0x28')](_0x3f5614,function(_0x4859b6){if(_0x4859b6[_0x4acf('0x38')]!==_0x4acf('0x39')){var _0x43a2ea={};_0x43a2ea[_0x4859b6[_0x4acf('0x25')]]={'$like':'%'+_0x7a1e79['query']['filter']+'%'};return _0x43a2ea;}})});}_0x2a3830=_[_0x4acf('0x3a')]({},_0x2a3830,_0x7a1e79[_0x4acf('0x3b')]);var _0x3d5529={'where':_0x2a3830[_0x4acf('0x35')]};return db['CmHopperFinal'][_0x4acf('0x1b')](_0x3d5529)[_0x4acf('0x21')](function(_0x4e9370){_0x3521c2['count']=_0x4e9370;if(_0x7a1e79['query']['includeAll']){_0x2a3830[_0x4acf('0x3c')]=[{'all':!![]}];}return db[_0x4acf('0x29')][_0x4acf('0x3d')](_0x2a3830);})['then'](function(_0x1015e3){_0x3521c2[_0x4acf('0x3e')]=_0x1015e3;return _0x3521c2;})[_0x4acf('0x21')](respondWithFilteredResult(_0x382c41,_0x2a3830))[_0x4acf('0x3f')](handleError(_0x382c41,null));};exports[_0x4acf('0x40')]=function(_0xea75e4,_0x7cf2a){var _0x17d5e9={'raw':!![],'where':{'id':_0xea75e4[_0x4acf('0x41')]['id']}},_0x461547={};_0x461547[_0x4acf('0x2d')]=_['keys'](db[_0x4acf('0x29')][_0x4acf('0x2a')]);_0x461547[_0x4acf('0x2e')]=_[_0x4acf('0x2f')](_0xea75e4[_0x4acf('0x2e')]);_0x461547['filters']=_['intersection'](_0x461547[_0x4acf('0x2d')],_0x461547[_0x4acf('0x2e')]);_0x17d5e9[_0x4acf('0x31')]=_[_0x4acf('0x42')](_0x461547[_0x4acf('0x2d')],qs[_0x4acf('0x32')](_0xea75e4['query'][_0x4acf('0x32')]));_0x17d5e9['attributes']=_0x17d5e9[_0x4acf('0x31')][_0x4acf('0x43')]?_0x17d5e9['attributes']:_0x461547['model'];if(_0xea75e4[_0x4acf('0x2e')][_0x4acf('0x44')]){_0x17d5e9[_0x4acf('0x3c')]=[{'all':!![]}];}_0x17d5e9=_[_0x4acf('0x3a')]({},_0x17d5e9,_0xea75e4['options']);return db[_0x4acf('0x29')][_0x4acf('0x45')](_0x17d5e9)[_0x4acf('0x21')](handleEntityNotFound(_0x7cf2a,null))[_0x4acf('0x21')](respondWithResult(_0x7cf2a,null))[_0x4acf('0x3f')](handleError(_0x7cf2a,null));};exports[_0x4acf('0x46')]=function(_0x1bd7d0,_0x2d946c){return db['CmHopperFinal']['describe']()[_0x4acf('0x21')](respondWithResult(_0x2d946c,null))[_0x4acf('0x3f')](handleError(_0x2d946c,null));};exports[_0x4acf('0x20')]=function(_0x33bc52,_0x287406){if(_0x33bc52[_0x4acf('0x47')][_0x4acf('0x48')]){delete _0x33bc52[_0x4acf('0x47')][_0x4acf('0x48')];}return db[_0x4acf('0x29')][_0x4acf('0x45')]({'where':{'uniqueid':_0x33bc52[_0x4acf('0x41')]['id']}})['then'](handleEntityNotFound(_0x287406,null))[_0x4acf('0x21')](saveUpdates(_0x33bc52[_0x4acf('0x47')],null))[_0x4acf('0x21')](respondWithResult(_0x287406,null))[_0x4acf('0x3f')](handleError(_0x287406,null));};exports[_0x4acf('0x49')]=function(_0x3cf54a,_0x2785b9,_0x2d0561){return db[_0x4acf('0x29')][_0x4acf('0x3d')]({'raw':![],'where':{'VoiceQueueId':_0x3cf54a[_0x4acf('0x41')]['id']},'attributes':[[db[_0x4acf('0x4a')]['fn'](_0x4acf('0x4b'),db[_0x4acf('0x4a')]['fn']('IF',db[_0x4acf('0x4a')][_0x4acf('0x4c')]('`state`\x20=\x200,\x201,\x20null'))),_0x4acf('0x4d')],[db[_0x4acf('0x4a')]['fn'](_0x4acf('0x4b'),db['sequelize']['fn']('IF',db[_0x4acf('0x4a')][_0x4acf('0x4c')](_0x4acf('0x4e')))),_0x4acf('0x4f')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x4acf('0x4a')][_0x4acf('0x4c')](_0x4acf('0x50')))),'busyContacts'],[db[_0x4acf('0x4a')]['fn'](_0x4acf('0x4b'),db['sequelize']['fn']('IF',db[_0x4acf('0x4a')][_0x4acf('0x4c')](_0x4acf('0x51')))),_0x4acf('0x52')],[db['sequelize']['fn'](_0x4acf('0x4b'),db[_0x4acf('0x4a')]['fn']('IF',db[_0x4acf('0x4a')][_0x4acf('0x4c')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x4acf('0x53')],[db['sequelize']['fn'](_0x4acf('0x4b'),db['sequelize']['fn']('IF',db[_0x4acf('0x4a')][_0x4acf('0x4c')](_0x4acf('0x54')))),_0x4acf('0x55')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x4acf('0x4a')][_0x4acf('0x4c')]('`state`\x20=\x2022,\x201,\x20null'))),_0x4acf('0x56')],[db[_0x4acf('0x4a')]['fn']('COUNT',db[_0x4acf('0x4a')]['fn']('IF',db[_0x4acf('0x4a')]['literal'](_0x4acf('0x57')))),_0x4acf('0x58')]]})[_0x4acf('0x21')](handleEntityNotFound(_0x2785b9,null))['then'](respondWithResult(_0x2785b9,null))[_0x4acf('0x3f')](handleError(_0x2785b9,null));};exports[_0x4acf('0x59')]=function(_0xb5bd81,_0x452ee6,_0x54b093){return db[_0x4acf('0x29')][_0x4acf('0x3d')]({'raw':![],'where':{'CampaignId':_0xb5bd81[_0x4acf('0x41')]['id']},'attributes':[[db['sequelize']['fn'](_0x4acf('0x4b'),db[_0x4acf('0x4a')]['fn']('IF',db[_0x4acf('0x4a')][_0x4acf('0x4c')](_0x4acf('0x5a')))),_0x4acf('0x4d')],[db[_0x4acf('0x4a')]['fn'](_0x4acf('0x4b'),db[_0x4acf('0x4a')]['fn']('IF',db[_0x4acf('0x4a')][_0x4acf('0x4c')](_0x4acf('0x4e')))),_0x4acf('0x4f')],[db[_0x4acf('0x4a')]['fn'](_0x4acf('0x4b'),db['sequelize']['fn']('IF',db[_0x4acf('0x4a')][_0x4acf('0x4c')](_0x4acf('0x50')))),_0x4acf('0x5b')],[db[_0x4acf('0x4a')]['fn'](_0x4acf('0x4b'),db[_0x4acf('0x4a')]['fn']('IF',db[_0x4acf('0x4a')]['literal']('`state`\x20=\x208,\x201,\x20null'))),_0x4acf('0x52')],[db['sequelize']['fn'](_0x4acf('0x4b'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0x4acf('0x5c')))),_0x4acf('0x53')],[db[_0x4acf('0x4a')]['fn'](_0x4acf('0x4b'),db[_0x4acf('0x4a')]['fn']('IF',db[_0x4acf('0x4a')]['literal']('`state`\x20=\x2011\x20,\x201,\x20null'))),'abandonedContacts'],[db[_0x4acf('0x4a')]['fn'](_0x4acf('0x4b'),db[_0x4acf('0x4a')]['fn']('IF',db['sequelize'][_0x4acf('0x4c')](_0x4acf('0x5d')))),_0x4acf('0x56')],[db[_0x4acf('0x4a')]['fn'](_0x4acf('0x4b'),db[_0x4acf('0x4a')]['fn']('IF',db['sequelize'][_0x4acf('0x4c')]('`state`\x20=\x2019,\x201,\x20null'))),_0x4acf('0x58')]]})[_0x4acf('0x21')](handleEntityNotFound(_0x452ee6,null))[_0x4acf('0x21')](respondWithResult(_0x452ee6,null))[_0x4acf('0x3f')](handleError(_0x452ee6,null));};exports[_0x4acf('0x5e')]=function(_0x173655,_0x1f2dbc,_0xc0d942){return db[_0x4acf('0x5f')][_0x4acf('0x45')]({'where':{'id':_0x173655[_0x4acf('0x41')]['id']}})[_0x4acf('0x21')](handleEntityNotFound(_0x1f2dbc,null))['then'](function(_0x11f356){var _0xacca91;if(_0x11f356){_0xacca91=squel[_0x4acf('0x60')]()[_0x4acf('0x61')](_0x4acf('0x62'))[_0x4acf('0x63')]([_0x4acf('0x64'),_0x4acf('0x65'),_0x4acf('0x66'),_0x4acf('0x67'),'VoiceQueueId',_0x4acf('0x68'),_0x4acf('0x69')],squel['select']()[_0x4acf('0x6a')](_0x4acf('0x6b'),'phone')[_0x4acf('0x6a')]('NOW()','scheduledAt')[_0x4acf('0x6a')]('ANY_VALUE(ContactId)',_0x4acf('0x66'))[_0x4acf('0x6a')](_0x4acf('0x6c'),_0x4acf('0x67'))['field'](_0x4acf('0x6d'),_0x4acf('0x6e'))['field']('NOW()','createdAt')[_0x4acf('0x6a')]('NOW()',_0x4acf('0x69'))[_0x4acf('0x6f')](_0x4acf('0x70'))['where'](_0x4acf('0x71'),_0x173655[_0x4acf('0x41')]['id']['toString']())[_0x4acf('0x35')](_0x4acf('0x72'),_0x173655['body'][_0x4acf('0x73')][_0x4acf('0x74')]())[_0x4acf('0x35')](_0x4acf('0x75'))[_0x4acf('0x35')](_0x4acf('0x76'),squel['select']()[_0x4acf('0x6a')]('phone')[_0x4acf('0x6f')](_0x4acf('0x62'))['where']('VoiceQueueId\x20=\x20?',_0x173655['params']['id'][_0x4acf('0x74')]()))['where']('calleridnum\x20NOT\x20IN\x20(?)',squel['select']()[_0x4acf('0x6a')]('calleridnum')[_0x4acf('0x6f')](_0x4acf('0x70'))[_0x4acf('0x35')](_0x4acf('0x71'),_0x173655[_0x4acf('0x41')]['id']['toString']())['where'](_0x4acf('0x77')))[_0x4acf('0x78')](_0x4acf('0x66')))[_0x4acf('0x74')]();return db[_0x4acf('0x4a')]['query'](_0xacca91);}return[];})[_0x4acf('0x21')](respondWithResult(_0x1f2dbc,null))[_0x4acf('0x3f')](handleError(_0x1f2dbc,null));};exports[_0x4acf('0x79')]=function(_0x453c6d,_0x1a82e7,_0x3d02c7){return db[_0x4acf('0x7a')]['find']({'where':{'id':_0x453c6d[_0x4acf('0x41')]['id']}})['then'](handleEntityNotFound(_0x1a82e7,null))[_0x4acf('0x21')](function(_0x1bbe6d){var _0x2a36e2;if(_0x1bbe6d){_0x2a36e2=squel[_0x4acf('0x60')]()[_0x4acf('0x61')]('cm_hopper')[_0x4acf('0x63')](['phone',_0x4acf('0x65'),_0x4acf('0x66'),'ListId',_0x4acf('0x7b'),_0x4acf('0x68'),_0x4acf('0x69')],squel[_0x4acf('0x7c')]()[_0x4acf('0x6a')]('ANY_VALUE(calleridnum)',_0x4acf('0x64'))['field']('NOW()',_0x4acf('0x65'))[_0x4acf('0x6a')](_0x4acf('0x7d'),_0x4acf('0x66'))['field']('ANY_VALUE(ListId)',_0x4acf('0x67'))[_0x4acf('0x6a')](_0x4acf('0x7e'),_0x4acf('0x7b'))[_0x4acf('0x6a')](_0x4acf('0x7f'),_0x4acf('0x68'))[_0x4acf('0x6a')]('NOW()','updatedAt')[_0x4acf('0x6f')](_0x4acf('0x70'))[_0x4acf('0x35')](_0x4acf('0x80'),_0x453c6d[_0x4acf('0x41')]['id'][_0x4acf('0x74')]())[_0x4acf('0x35')](_0x4acf('0x72'),_0x453c6d[_0x4acf('0x47')]['state'][_0x4acf('0x74')]())[_0x4acf('0x35')](_0x4acf('0x75'))[_0x4acf('0x35')](_0x4acf('0x76'),squel[_0x4acf('0x7c')]()[_0x4acf('0x6a')](_0x4acf('0x64'))[_0x4acf('0x6f')](_0x4acf('0x62'))[_0x4acf('0x35')](_0x4acf('0x80'),_0x453c6d[_0x4acf('0x41')]['id']['toString']()))[_0x4acf('0x35')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x4acf('0x7c')]()[_0x4acf('0x6a')]('calleridnum')[_0x4acf('0x6f')](_0x4acf('0x70'))['where']('CampaignId\x20=\x20?',_0x453c6d[_0x4acf('0x41')]['id'][_0x4acf('0x74')]())['where']('state\x20=\x204'))[_0x4acf('0x78')](_0x4acf('0x66')))[_0x4acf('0x74')]();return db[_0x4acf('0x4a')]['query'](_0x2a36e2);}return[];})[_0x4acf('0x21')](respondWithResult(_0x1a82e7,null))[_0x4acf('0x3f')](handleError(_0x1a82e7,null));};exports[_0x4acf('0x81')]=function(_0x34e1ea,_0x43e9bf,_0x367ad4){return db[_0x4acf('0x82')]['findOne']({'where':{'VoiceQueueId':_0x34e1ea[_0x4acf('0x47')][_0x4acf('0x6e')],'CampaignId':_0x34e1ea[_0x4acf('0x47')]['CampaignId'],'ContactId':_0x34e1ea[_0x4acf('0x47')][_0x4acf('0x66')]}})[_0x4acf('0x21')](handleEntityNotFound(_0x43e9bf,null))[_0x4acf('0x21')](function(_0x37ffab){if(_0x37ffab){return _0x37ffab;}return null;})[_0x4acf('0x21')](respondWithResult(_0x43e9bf,null))[_0x4acf('0x3f')](handleError(_0x43e9bf,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index d970bb8..9474553 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 _0x19c0=['CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./cmHopperFinal.attributes','exports'];(function(_0x182ac2,_0x9c7dc8){var _0x4ce726=function(_0x2cfaf0){while(--_0x2cfaf0){_0x182ac2['push'](_0x182ac2['shift']());}};_0x4ce726(++_0x9c7dc8);}(_0x19c0,0x10e));var _0x019c=function(_0x21ce3b,_0x2aa3a9){_0x21ce3b=_0x21ce3b-0x0;var _0x567835=_0x19c0[_0x21ce3b];return _0x567835;};'use strict';var _=require(_0x019c('0x0'));var util=require(_0x019c('0x1'));var logger=require(_0x019c('0x2'))(_0x019c('0x3'));var moment=require('moment');var BPromise=require(_0x019c('0x4'));var rp=require(_0x019c('0x5'));var fs=require('fs');var path=require(_0x019c('0x6'));var rimraf=require(_0x019c('0x7'));var config=require('../../config/environment');var attributes=require(_0x019c('0x8'));module[_0x019c('0x9')]=function(_0x3e7a35,_0x42f616){return _0x3e7a35['define'](_0x019c('0xa'),attributes,{'tableName':_0x019c('0xb'),'paranoid':![],'indexes':[{'name':_0x019c('0xc'),'fields':[_0x019c('0xc')]},{'name':'uniqueid','fields':[_0x019c('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe187=['api','moment','bluebird','path','rimraf','../../config/environment','./cmHopperFinal.attributes','exports','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','lodash','util','../../config/logger'];(function(_0x507d62,_0x1f83cb){var _0xed22f2=function(_0x183714){while(--_0x183714){_0x507d62['push'](_0x507d62['shift']());}};_0xed22f2(++_0x1f83cb);}(_0xe187,0x138));var _0x7e18=function(_0x18551d,_0x163c41){_0x18551d=_0x18551d-0x0;var _0x448d72=_0xe187[_0x18551d];return _0x448d72;};'use strict';var _=require(_0x7e18('0x0'));var util=require(_0x7e18('0x1'));var logger=require(_0x7e18('0x2'))(_0x7e18('0x3'));var moment=require(_0x7e18('0x4'));var BPromise=require(_0x7e18('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7e18('0x6'));var rimraf=require(_0x7e18('0x7'));var config=require(_0x7e18('0x8'));var attributes=require(_0x7e18('0x9'));module[_0x7e18('0xa')]=function(_0xf7c1d7,_0x3c880f){return _0xf7c1d7['define'](_0x7e18('0xb'),attributes,{'tableName':_0x7e18('0xc'),'paranoid':![],'indexes':[{'name':_0x7e18('0xd'),'fields':[_0x7e18('0xd')]},{'name':_0x7e18('0xe'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index 96c7625..7b0fefc 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(_0x3c6137,_0x108620){var _0x1b104c=function(_0x2b04a1){while(--_0x2b04a1){_0x3c6137['push'](_0x3c6137['shift']());}};_0x1b104c(++_0x108620);}(_0x7a54,0x106));var _0x47a5=function(_0x115aae,_0x5bf7ac){_0x115aae=_0x115aae-0x0;var _0x27961b=_0x7a54[_0x115aae];return _0x27961b;};'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 _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(_0x55dd54,_0x1be63e){var _0x31ea52=function(_0x5f3deb){while(--_0x5f3deb){_0x55dd54['push'](_0x55dd54['shift']());}};_0x31ea52(++_0x1be63e);}(_0x7a54,0x106));var _0x47a5=function(_0x39db4a,_0x275ff8){_0x39db4a=_0x39db4a-0x0;var _0x34ccd9=_0x7a54[_0x39db4a];return _0x34ccd9;};'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 diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index 33e8c7b..028578d 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 _0x3b6a=['connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','isAuthenticated','/describe','describe','/:id','show','get','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','update','exports','util','path'];(function(_0x295a3d,_0x56d487){var _0x23a732=function(_0x15cfc2){while(--_0x15cfc2){_0x295a3d['push'](_0x295a3d['shift']());}};_0x23a732(++_0x56d487);}(_0x3b6a,0x1c0));var _0xa3b6=function(_0x30804d,_0x38b1a4){_0x30804d=_0x30804d-0x0;var _0x3bdf9f=_0x3b6a[_0x30804d];return _0x3bdf9f;};'use strict';var multer=require('multer');var util=require(_0xa3b6('0x0'));var path=require(_0xa3b6('0x1'));var timeout=require(_0xa3b6('0x2'));var express=require('express');var router=express[_0xa3b6('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xa3b6('0x4'));var interaction=require(_0xa3b6('0x5'));var config=require(_0xa3b6('0x6'));var controller=require(_0xa3b6('0x7'));router['get']('/',auth[_0xa3b6('0x8')](),controller['index']);router['get'](_0xa3b6('0x9'),auth[_0xa3b6('0x8')](),controller[_0xa3b6('0xa')]);router['get'](_0xa3b6('0xb'),auth[_0xa3b6('0x8')](),controller[_0xa3b6('0xc')]);router[_0xa3b6('0xd')]('/voice/queue/countAttributes/:id',auth[_0xa3b6('0x8')](),controller[_0xa3b6('0xe')]);router[_0xa3b6('0xd')](_0xa3b6('0xf'),auth[_0xa3b6('0x8')](),controller[_0xa3b6('0x10')]);router[_0xa3b6('0x11')]('/voice/queue/moveContacts/:id',auth[_0xa3b6('0x8')](),controller[_0xa3b6('0x12')]);router['post'](_0xa3b6('0x13'),auth['isAuthenticated'](),controller[_0xa3b6('0x14')]);router[_0xa3b6('0x11')](_0xa3b6('0x15'),auth['isAuthenticated'](),controller[_0xa3b6('0x16')]);router['put'](_0xa3b6('0xb'),auth['isAuthenticated'](),controller[_0xa3b6('0x17')]);module[_0xa3b6('0x18')]=router; \ No newline at end of file +var _0x5344=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cmHopperFinal.controller','isAuthenticated','index','/describe','get','/:id','show','/voice/queue/countAttributes/:id','/voice/queue/moveContacts/:id','moveContactsIvrCampaignHopperFinal','post','checkContactHopper','put','update','exports'];(function(_0x172948,_0x4262cc){var _0x4aeaa9=function(_0x5ec4b3){while(--_0x5ec4b3){_0x172948['push'](_0x172948['shift']());}};_0x4aeaa9(++_0x4262cc);}(_0x5344,0x1b0));var _0x4534=function(_0x25f444,_0xb12bd0){_0x25f444=_0x25f444-0x0;var _0x577b61=_0x5344[_0x25f444];return _0x577b61;};'use strict';var multer=require(_0x4534('0x0'));var util=require(_0x4534('0x1'));var path=require(_0x4534('0x2'));var timeout=require(_0x4534('0x3'));var express=require(_0x4534('0x4'));var router=express[_0x4534('0x5')]();var fs_extra=require(_0x4534('0x6'));var auth=require(_0x4534('0x7'));var interaction=require(_0x4534('0x8'));var config=require('../../config/environment');var controller=require(_0x4534('0x9'));router['get']('/',auth[_0x4534('0xa')](),controller[_0x4534('0xb')]);router['get'](_0x4534('0xc'),auth[_0x4534('0xa')](),controller['describe']);router[_0x4534('0xd')](_0x4534('0xe'),auth['isAuthenticated'](),controller[_0x4534('0xf')]);router[_0x4534('0xd')](_0x4534('0x10'),auth[_0x4534('0xa')](),controller['countContactsQueueCampaignHopperFinal']);router[_0x4534('0xd')]('/campaign/countAttributes/:id',auth[_0x4534('0xa')](),controller['countContactsIvrCampaignHopperFinal']);router['post'](_0x4534('0x11'),auth[_0x4534('0xa')](),controller['moveContactsQueueCampaignHopperFinal']);router['post']('/voice/campaign/moveContacts/:id',auth[_0x4534('0xa')](),controller[_0x4534('0x12')]);router[_0x4534('0x13')]('/checkContactHopper',auth['isAuthenticated'](),controller[_0x4534('0x14')]);router[_0x4534('0x15')]('/:id',auth[_0x4534('0xa')](),controller[_0x4534('0x16')]);module[_0x4534('0x17')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index b3c8b77..6dde5fe 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 _0xa671=['INTEGER','STRING','DATE','BOOLEAN','exports'];(function(_0x2fbb8e,_0x39edeb){var _0x556d49=function(_0x34c8bb){while(--_0x34c8bb){_0x2fbb8e['push'](_0x2fbb8e['shift']());}};_0x556d49(++_0x39edeb);}(_0xa671,0x153));var _0x1a67=function(_0x541886,_0x12d2b0){_0x541886=_0x541886-0x0;var _0x599f78=_0xa671[_0x541886];return _0x599f78;};'use strict';var Sequelize=require('sequelize');module[_0x1a67('0x0')]={'state':{'type':Sequelize[_0x1a67('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x1a67('0x2')]},'scheduledat':{'type':Sequelize[_0x1a67('0x3')]},'countbusyretry':{'type':Sequelize[_0x1a67('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x1a67('0x1')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x1a67('0x1')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0x1a67('0x2')]},'calleridnum':{'type':Sequelize[_0x1a67('0x2')]},'calleridname':{'type':Sequelize[_0x1a67('0x2')]},'starttime':{'type':Sequelize[_0x1a67('0x3')]},'responsetime':{'type':Sequelize[_0x1a67('0x3')]},'answertime':{'type':Sequelize[_0x1a67('0x3')]},'droptime':{'type':Sequelize[_0x1a67('0x3')]},'endtime':{'type':Sequelize[_0x1a67('0x3')]},'ringtime':{'type':Sequelize[_0x1a67('0x1')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x1a67('0x1')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x1a67('0x1')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0x1a67('0x2')]},'campaigntype':{'type':Sequelize[_0x1a67('0x2')]},'membername':{'type':Sequelize[_0x1a67('0x2')]},'reason':{'type':Sequelize[_0x1a67('0x2')]},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0x1a67('0x4')],'defaultValue':![]},'callback':{'type':Sequelize[_0x1a67('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x1a67('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0x1a67('0x4')],'defaultValue':![]},'editedat':{'type':Sequelize['DATE']},'edited':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x1a67('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x1a67('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x1a67('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x1a67('0x1')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x1a67('0x2')]}}; \ No newline at end of file +var _0xdd34=['INTEGER','STRING','DATE','BOOLEAN','sequelize','exports'];(function(_0x1a87cd,_0x2a244f){var _0x4af60e=function(_0x195fce){while(--_0x195fce){_0x1a87cd['push'](_0x1a87cd['shift']());}};_0x4af60e(++_0x2a244f);}(_0xdd34,0xe8));var _0x4dd3=function(_0x3d9c0a,_0x1fef59){_0x3d9c0a=_0x3d9c0a-0x0;var _0x4a3699=_0xdd34[_0x3d9c0a];return _0x4a3699;};'use strict';var Sequelize=require(_0x4dd3('0x0'));module[_0x4dd3('0x1')]={'state':{'type':Sequelize[_0x4dd3('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x4dd3('0x3')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0x4dd3('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x4dd3('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x4dd3('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x4dd3('0x3')]},'originatecalleridnum':{'type':Sequelize[_0x4dd3('0x3')]},'originatecalleridname':{'type':Sequelize[_0x4dd3('0x3')]},'calleridnum':{'type':Sequelize[_0x4dd3('0x3')]},'calleridname':{'type':Sequelize[_0x4dd3('0x3')]},'starttime':{'type':Sequelize[_0x4dd3('0x4')]},'responsetime':{'type':Sequelize[_0x4dd3('0x4')]},'answertime':{'type':Sequelize[_0x4dd3('0x4')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0x4dd3('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x4dd3('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x4dd3('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x4dd3('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x4dd3('0x3')]},'campaign':{'type':Sequelize[_0x4dd3('0x3')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x4dd3('0x3')]},'reason':{'type':Sequelize[_0x4dd3('0x3')]},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0x4dd3('0x5')],'defaultValue':![]},'callback':{'type':Sequelize[_0x4dd3('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0x4dd3('0x4')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'editedat':{'type':Sequelize[_0x4dd3('0x4')]},'edited':{'type':Sequelize[_0x4dd3('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x4dd3('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x4dd3('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x4dd3('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x4dd3('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dialTimezone':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index d1e6e8d..82fe15e 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 _0x218a=['include','rows','catch','show','params','find','create','body','describe','uniqueid','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','update','then','destroy','error','name','index','CmHopperHistory','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','pick','where','VIRTUAL','merge','options','includeAll'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x218a,0x186));var _0xa218=function(_0xf19906,_0xa23c16){_0xf19906=_0xf19906-0x0;var _0x5be363=_0x218a[_0xf19906];return _0x5be363;};'use strict';var emlformat=require(_0xa218('0x0'));var rimraf=require(_0xa218('0x1'));var zipdir=require(_0xa218('0x2'));var jsonpatch=require(_0xa218('0x3'));var rp=require(_0xa218('0x4'));var moment=require(_0xa218('0x5'));var BPromise=require(_0xa218('0x6'));var Mustache=require(_0xa218('0x7'));var util=require(_0xa218('0x8'));var path=require(_0xa218('0x9'));var sox=require(_0xa218('0xa'));var csv=require(_0xa218('0xb'));var ejs=require(_0xa218('0xc'));var fs=require('fs');var fs_extra=require(_0xa218('0xd'));var _=require(_0xa218('0xe'));var squel=require(_0xa218('0xf'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xa218('0x10'));var toCsv=require(_0xa218('0xb'));var querystring=require(_0xa218('0x11'));var Papa=require('papaparse');var Redis=require(_0xa218('0x12'));var authService=require(_0xa218('0x13'));var qs=require(_0xa218('0x14'));var as=require(_0xa218('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa218('0x16'))(_0xa218('0x17'));var utils=require(_0xa218('0x18'));var config=require(_0xa218('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xa218('0x1a'))['db'];function respondWithStatusCode(_0x2e09f8,_0x16d60c){_0x16d60c=_0x16d60c||0xcc;return function(_0x2edd58){if(_0x2edd58){return _0x2e09f8[_0xa218('0x1b')](_0x16d60c);}return _0x2e09f8[_0xa218('0x1c')](_0x16d60c)[_0xa218('0x1d')]();};}function respondWithResult(_0x1197fc,_0x3b98c5){_0x3b98c5=_0x3b98c5||0xc8;return function(_0x340f6c){if(_0x340f6c){return _0x1197fc['status'](_0x3b98c5)[_0xa218('0x1e')](_0x340f6c);}};}function respondWithFilteredResult(_0x39381e,_0x2054de){return function(_0x284b27){if(_0x284b27){var _0x2692db=typeof _0x2054de[_0xa218('0x1f')]===_0xa218('0x20')&&typeof _0x2054de['limit']===_0xa218('0x20');var _0xba4a4b=_0x284b27[_0xa218('0x21')];var _0x4c0fa0=_0x2692db?0x0:_0x2054de[_0xa218('0x1f')];var _0x5687cf=_0x2692db?_0x284b27['count']:_0x2054de[_0xa218('0x1f')]+_0x2054de['limit'];var _0x280811;if(_0x5687cf>=_0xba4a4b){_0x5687cf=_0xba4a4b;_0x280811=0xc8;}else{_0x280811=0xce;}_0x39381e[_0xa218('0x1c')](_0x280811);return _0x39381e[_0xa218('0x22')](_0xa218('0x23'),_0x4c0fa0+'-'+_0x5687cf+'/'+_0xba4a4b)[_0xa218('0x1e')](_0x284b27);}return null;};}function patchUpdates(_0x469080){return function(_0x3380bd){try{jsonpatch[_0xa218('0x24')](_0x3380bd,_0x469080,!![]);}catch(_0x2e8deb){return BPromise['reject'](_0x2e8deb);}return _0x3380bd['save']();};}function saveUpdates(_0x40ff18,_0x1656af){return function(_0x59c6e0){if(_0x59c6e0){return _0x59c6e0[_0xa218('0x25')](_0x40ff18)[_0xa218('0x26')](function(_0x1d0056){return _0x1d0056;});}return null;};}function removeEntity(_0x27e2f1,_0x2e49d4){return function(_0x57c28b){if(_0x57c28b){return _0x57c28b[_0xa218('0x27')]()['then'](function(){_0x27e2f1[_0xa218('0x1c')](0xcc)[_0xa218('0x1d')]();});}};}function handleEntityNotFound(_0x2bd18b,_0x4a42ae){return function(_0x1eb84e){if(!_0x1eb84e){_0x2bd18b['sendStatus'](0x194);}return _0x1eb84e;};}function handleError(_0x44126b,_0x2d281f){_0x2d281f=_0x2d281f||0x1f4;return function(_0x346f75){logger[_0xa218('0x28')](_0x346f75['stack']);if(_0x346f75[_0xa218('0x29')]){delete _0x346f75[_0xa218('0x29')];}_0x44126b[_0xa218('0x1c')](_0x2d281f)['send'](_0x346f75);};}exports[_0xa218('0x2a')]=function(_0x221b2e,_0x2e6bd1){var _0x4d85f4={},_0x197f5b={},_0x543d86={'count':0x0,'rows':[]};var _0x4a91bf=_['map'](db[_0xa218('0x2b')][_0xa218('0x2c')],function(_0x424a0c){return{'name':_0x424a0c[_0xa218('0x2d')],'type':_0x424a0c[_0xa218('0x2e')]['key']};});_0x197f5b[_0xa218('0x2f')]=_[_0xa218('0x30')](_0x4a91bf,_0xa218('0x29'));_0x197f5b[_0xa218('0x31')]=_[_0xa218('0x32')](_0x221b2e[_0xa218('0x31')]);_0x197f5b[_0xa218('0x33')]=_[_0xa218('0x34')](_0x197f5b[_0xa218('0x2f')],_0x197f5b[_0xa218('0x31')]);_0x4d85f4[_0xa218('0x35')]=_[_0xa218('0x34')](_0x197f5b[_0xa218('0x2f')],qs[_0xa218('0x36')](_0x221b2e[_0xa218('0x31')][_0xa218('0x36')]));_0x4d85f4[_0xa218('0x35')]=_0x4d85f4['attributes'][_0xa218('0x37')]?_0x4d85f4['attributes']:_0x197f5b['model'];if(!_0x221b2e[_0xa218('0x31')]['hasOwnProperty'](_0xa218('0x38'))){_0x4d85f4['limit']=qs[_0xa218('0x39')](_0x221b2e['query'][_0xa218('0x39')]);_0x4d85f4[_0xa218('0x1f')]=qs[_0xa218('0x1f')](_0x221b2e['query'][_0xa218('0x1f')]);}_0x4d85f4[_0xa218('0x3a')]=qs[_0xa218('0x3b')](_0x221b2e[_0xa218('0x31')][_0xa218('0x3b')]);_0x4d85f4['where']=qs[_0xa218('0x33')](_[_0xa218('0x3c')](_0x221b2e['query'],_0x197f5b[_0xa218('0x33')]),_0x4a91bf);if(_0x221b2e[_0xa218('0x31')]['filter']){_0x4d85f4[_0xa218('0x3d')]=_['merge'](_0x4d85f4[_0xa218('0x3d')],{'$or':_[_0xa218('0x30')](_0x4a91bf,function(_0x59d538){if(_0x59d538['type']!==_0xa218('0x3e')){var _0x4bfa18={};_0x4bfa18[_0x59d538[_0xa218('0x29')]]={'$like':'%'+_0x221b2e['query']['filter']+'%'};return _0x4bfa18;}})});}_0x4d85f4=_[_0xa218('0x3f')]({},_0x4d85f4,_0x221b2e[_0xa218('0x40')]);var _0x23d39c={'where':_0x4d85f4[_0xa218('0x3d')]};return db[_0xa218('0x2b')][_0xa218('0x21')](_0x23d39c)[_0xa218('0x26')](function(_0x303f4a){_0x543d86[_0xa218('0x21')]=_0x303f4a;if(_0x221b2e[_0xa218('0x31')][_0xa218('0x41')]){_0x4d85f4[_0xa218('0x42')]=[{'all':!![]}];}return db['CmHopperHistory']['findAll'](_0x4d85f4);})[_0xa218('0x26')](function(_0x254944){_0x543d86[_0xa218('0x43')]=_0x254944;return _0x543d86;})['then'](respondWithFilteredResult(_0x2e6bd1,_0x4d85f4))[_0xa218('0x44')](handleError(_0x2e6bd1,null));};exports[_0xa218('0x45')]=function(_0x9c1e72,_0x3afe73){var _0x79116d={'raw':!![],'where':{'id':_0x9c1e72[_0xa218('0x46')]['id']}},_0x3c338b={};_0x3c338b[_0xa218('0x2f')]=_[_0xa218('0x32')](db[_0xa218('0x2b')]['rawAttributes']);_0x3c338b[_0xa218('0x31')]=_[_0xa218('0x32')](_0x9c1e72[_0xa218('0x31')]);_0x3c338b['filters']=_['intersection'](_0x3c338b[_0xa218('0x2f')],_0x3c338b['query']);_0x79116d[_0xa218('0x35')]=_[_0xa218('0x34')](_0x3c338b[_0xa218('0x2f')],qs[_0xa218('0x36')](_0x9c1e72[_0xa218('0x31')][_0xa218('0x36')]));_0x79116d['attributes']=_0x79116d[_0xa218('0x35')][_0xa218('0x37')]?_0x79116d['attributes']:_0x3c338b['model'];if(_0x9c1e72[_0xa218('0x31')]['includeAll']){_0x79116d[_0xa218('0x42')]=[{'all':!![]}];}_0x79116d=_[_0xa218('0x3f')]({},_0x79116d,_0x9c1e72[_0xa218('0x40')]);return db[_0xa218('0x2b')][_0xa218('0x47')](_0x79116d)[_0xa218('0x26')](handleEntityNotFound(_0x3afe73,null))[_0xa218('0x26')](respondWithResult(_0x3afe73,null))[_0xa218('0x44')](handleError(_0x3afe73,null));};exports['create']=function(_0x4735fa,_0x327879){return db['CmHopperHistory'][_0xa218('0x48')](_0x4735fa[_0xa218('0x49')],{})[_0xa218('0x26')](respondWithResult(_0x327879,0xc9))[_0xa218('0x44')](handleError(_0x327879,null));};exports[_0xa218('0x4a')]=function(_0x1c7a89,_0x1f0ce2){return db[_0xa218('0x2b')][_0xa218('0x4a')]()[_0xa218('0x26')](respondWithResult(_0x1f0ce2,null))[_0xa218('0x44')](handleError(_0x1f0ce2,null));};exports[_0xa218('0x25')]=function(_0x1b730d,_0x2fa5ac){if(_0x1b730d[_0xa218('0x49')][_0xa218('0x4b')]){delete _0x1b730d[_0xa218('0x49')][_0xa218('0x4b')];}return db[_0xa218('0x2b')][_0xa218('0x47')]({'where':{'uniqueid':_0x1b730d[_0xa218('0x46')]['id']}})[_0xa218('0x26')](handleEntityNotFound(_0x2fa5ac,null))['then'](saveUpdates(_0x1b730d[_0xa218('0x49')],null))[_0xa218('0x26')](respondWithResult(_0x2fa5ac,null))[_0xa218('0x44')](handleError(_0x2fa5ac,null));}; \ No newline at end of file +var _0x5e43=['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','../../mysqldb','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','then','destroy','sendStatus','stack','name','index','map','rawAttributes','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','sort','where','merge','type','VIRTUAL','filter','options','CmHopperHistory','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','update','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs'];(function(_0x119b4b,_0x322a87){var _0x2ca4d5=function(_0x45a93e){while(--_0x45a93e){_0x119b4b['push'](_0x119b4b['shift']());}};_0x2ca4d5(++_0x322a87);}(_0x5e43,0x16c));var _0x35e4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5e43[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x35e4('0x0'));var rimraf=require(_0x35e4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x35e4('0x2'));var rp=require(_0x35e4('0x3'));var moment=require(_0x35e4('0x4'));var BPromise=require(_0x35e4('0x5'));var Mustache=require('mustache');var util=require(_0x35e4('0x6'));var path=require(_0x35e4('0x7'));var sox=require(_0x35e4('0x8'));var csv=require(_0x35e4('0x9'));var ejs=require(_0x35e4('0xa'));var fs=require('fs');var fs_extra=require(_0x35e4('0xb'));var _=require(_0x35e4('0xc'));var squel=require(_0x35e4('0xd'));var crypto=require('crypto');var jsforce=require(_0x35e4('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x35e4('0x9'));var querystring=require(_0x35e4('0xf'));var Papa=require(_0x35e4('0x10'));var Redis=require(_0x35e4('0x11'));var authService=require(_0x35e4('0x12'));var qs=require(_0x35e4('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x35e4('0x14'));var logger=require('../../config/logger')(_0x35e4('0x15'));var utils=require(_0x35e4('0x16'));var config=require(_0x35e4('0x17'));var licenseUtil=require(_0x35e4('0x18'));var db=require(_0x35e4('0x19'))['db'];function respondWithStatusCode(_0x5b9fa0,_0x5967aa){_0x5967aa=_0x5967aa||0xcc;return function(_0x1653fe){if(_0x1653fe){return _0x5b9fa0['sendStatus'](_0x5967aa);}return _0x5b9fa0[_0x35e4('0x1a')](_0x5967aa)[_0x35e4('0x1b')]();};}function respondWithResult(_0x577775,_0x232b89){_0x232b89=_0x232b89||0xc8;return function(_0x379d4e){if(_0x379d4e){return _0x577775[_0x35e4('0x1a')](_0x232b89)[_0x35e4('0x1c')](_0x379d4e);}};}function respondWithFilteredResult(_0x4dd5a9,_0x27a456){return function(_0x493f91){if(_0x493f91){var _0x5b800d=typeof _0x27a456['offset']==='undefined'&&typeof _0x27a456['limit']===_0x35e4('0x1d');var _0x15dfee=_0x493f91[_0x35e4('0x1e')];var _0x405038=_0x5b800d?0x0:_0x27a456[_0x35e4('0x1f')];var _0xfd4c26=_0x5b800d?_0x493f91[_0x35e4('0x1e')]:_0x27a456['offset']+_0x27a456[_0x35e4('0x20')];var _0x271d1e;if(_0xfd4c26>=_0x15dfee){_0xfd4c26=_0x15dfee;_0x271d1e=0xc8;}else{_0x271d1e=0xce;}_0x4dd5a9[_0x35e4('0x1a')](_0x271d1e);return _0x4dd5a9[_0x35e4('0x21')](_0x35e4('0x22'),_0x405038+'-'+_0xfd4c26+'/'+_0x15dfee)[_0x35e4('0x1c')](_0x493f91);}return null;};}function patchUpdates(_0x9ffb2f){return function(_0x555c5e){try{jsonpatch[_0x35e4('0x23')](_0x555c5e,_0x9ffb2f,!![]);}catch(_0x4aef3b){return BPromise[_0x35e4('0x24')](_0x4aef3b);}return _0x555c5e['save']();};}function saveUpdates(_0x40320b,_0x32f8fd){return function(_0x23c109){if(_0x23c109){return _0x23c109['update'](_0x40320b)[_0x35e4('0x25')](function(_0x2b961e){return _0x2b961e;});}return null;};}function removeEntity(_0x35fe06,_0x3842bf){return function(_0x4e6770){if(_0x4e6770){return _0x4e6770[_0x35e4('0x26')]()[_0x35e4('0x25')](function(){_0x35fe06['status'](0xcc)[_0x35e4('0x1b')]();});}};}function handleEntityNotFound(_0x2564de,_0x1828b5){return function(_0x1981fa){if(!_0x1981fa){_0x2564de[_0x35e4('0x27')](0x194);}return _0x1981fa;};}function handleError(_0x4e61b3,_0x1b6472){_0x1b6472=_0x1b6472||0x1f4;return function(_0x5ce20e){logger['error'](_0x5ce20e[_0x35e4('0x28')]);if(_0x5ce20e[_0x35e4('0x29')]){delete _0x5ce20e[_0x35e4('0x29')];}_0x4e61b3[_0x35e4('0x1a')](_0x1b6472)['send'](_0x5ce20e);};}exports[_0x35e4('0x2a')]=function(_0x4b494b,_0x1d8275){var _0x5b1c35={},_0x2d0015={},_0x4a6380={'count':0x0,'rows':[]};var _0x3eba33=_[_0x35e4('0x2b')](db['CmHopperHistory'][_0x35e4('0x2c')],function(_0x2fd7c3){return{'name':_0x2fd7c3['fieldName'],'type':_0x2fd7c3['type'][_0x35e4('0x2d')]};});_0x2d0015['model']=_[_0x35e4('0x2b')](_0x3eba33,_0x35e4('0x29'));_0x2d0015[_0x35e4('0x2e')]=_[_0x35e4('0x2f')](_0x4b494b[_0x35e4('0x2e')]);_0x2d0015[_0x35e4('0x30')]=_[_0x35e4('0x31')](_0x2d0015[_0x35e4('0x32')],_0x2d0015['query']);_0x5b1c35[_0x35e4('0x33')]=_[_0x35e4('0x31')](_0x2d0015[_0x35e4('0x32')],qs[_0x35e4('0x34')](_0x4b494b[_0x35e4('0x2e')][_0x35e4('0x34')]));_0x5b1c35['attributes']=_0x5b1c35[_0x35e4('0x33')]['length']?_0x5b1c35[_0x35e4('0x33')]:_0x2d0015[_0x35e4('0x32')];if(!_0x4b494b[_0x35e4('0x2e')][_0x35e4('0x35')](_0x35e4('0x36'))){_0x5b1c35[_0x35e4('0x20')]=qs['limit'](_0x4b494b[_0x35e4('0x2e')][_0x35e4('0x20')]);_0x5b1c35[_0x35e4('0x1f')]=qs[_0x35e4('0x1f')](_0x4b494b['query'][_0x35e4('0x1f')]);}_0x5b1c35['order']=qs[_0x35e4('0x37')](_0x4b494b['query'][_0x35e4('0x37')]);_0x5b1c35[_0x35e4('0x38')]=qs[_0x35e4('0x30')](_['pick'](_0x4b494b[_0x35e4('0x2e')],_0x2d0015[_0x35e4('0x30')]),_0x3eba33);if(_0x4b494b['query']['filter']){_0x5b1c35[_0x35e4('0x38')]=_[_0x35e4('0x39')](_0x5b1c35[_0x35e4('0x38')],{'$or':_[_0x35e4('0x2b')](_0x3eba33,function(_0x2569f4){if(_0x2569f4[_0x35e4('0x3a')]!==_0x35e4('0x3b')){var _0x2ce63f={};_0x2ce63f[_0x2569f4['name']]={'$like':'%'+_0x4b494b[_0x35e4('0x2e')][_0x35e4('0x3c')]+'%'};return _0x2ce63f;}})});}_0x5b1c35=_['merge']({},_0x5b1c35,_0x4b494b[_0x35e4('0x3d')]);var _0x2223a3={'where':_0x5b1c35[_0x35e4('0x38')]};return db[_0x35e4('0x3e')][_0x35e4('0x1e')](_0x2223a3)[_0x35e4('0x25')](function(_0x40fb48){_0x4a6380[_0x35e4('0x1e')]=_0x40fb48;if(_0x4b494b[_0x35e4('0x2e')][_0x35e4('0x3f')]){_0x5b1c35[_0x35e4('0x40')]=[{'all':!![]}];}return db['CmHopperHistory'][_0x35e4('0x41')](_0x5b1c35);})[_0x35e4('0x25')](function(_0x3ca7ca){_0x4a6380[_0x35e4('0x42')]=_0x3ca7ca;return _0x4a6380;})[_0x35e4('0x25')](respondWithFilteredResult(_0x1d8275,_0x5b1c35))[_0x35e4('0x43')](handleError(_0x1d8275,null));};exports[_0x35e4('0x44')]=function(_0xf56a4c,_0x3d9234){var _0x564b1f={'raw':!![],'where':{'id':_0xf56a4c[_0x35e4('0x45')]['id']}},_0x2ceff8={};_0x2ceff8[_0x35e4('0x32')]=_[_0x35e4('0x2f')](db[_0x35e4('0x3e')][_0x35e4('0x2c')]);_0x2ceff8['query']=_['keys'](_0xf56a4c['query']);_0x2ceff8[_0x35e4('0x30')]=_[_0x35e4('0x31')](_0x2ceff8[_0x35e4('0x32')],_0x2ceff8[_0x35e4('0x2e')]);_0x564b1f['attributes']=_[_0x35e4('0x31')](_0x2ceff8[_0x35e4('0x32')],qs[_0x35e4('0x34')](_0xf56a4c[_0x35e4('0x2e')][_0x35e4('0x34')]));_0x564b1f[_0x35e4('0x33')]=_0x564b1f[_0x35e4('0x33')]['length']?_0x564b1f[_0x35e4('0x33')]:_0x2ceff8['model'];if(_0xf56a4c[_0x35e4('0x2e')][_0x35e4('0x3f')]){_0x564b1f[_0x35e4('0x40')]=[{'all':!![]}];}_0x564b1f=_[_0x35e4('0x39')]({},_0x564b1f,_0xf56a4c[_0x35e4('0x3d')]);return db[_0x35e4('0x3e')][_0x35e4('0x46')](_0x564b1f)[_0x35e4('0x25')](handleEntityNotFound(_0x3d9234,null))[_0x35e4('0x25')](respondWithResult(_0x3d9234,null))['catch'](handleError(_0x3d9234,null));};exports[_0x35e4('0x47')]=function(_0x10a903,_0x39e47c){return db[_0x35e4('0x3e')][_0x35e4('0x47')](_0x10a903[_0x35e4('0x48')],{})['then'](respondWithResult(_0x39e47c,0xc9))[_0x35e4('0x43')](handleError(_0x39e47c,null));};exports[_0x35e4('0x49')]=function(_0x2d895b,_0x2e3a76){return db[_0x35e4('0x3e')][_0x35e4('0x49')]()[_0x35e4('0x25')](respondWithResult(_0x2e3a76,null))[_0x35e4('0x43')](handleError(_0x2e3a76,null));};exports[_0x35e4('0x4a')]=function(_0x2177b2,_0x299925){if(_0x2177b2[_0x35e4('0x48')]['uniqueid']){delete _0x2177b2['body']['uniqueid'];}return db[_0x35e4('0x3e')][_0x35e4('0x46')]({'where':{'uniqueid':_0x2177b2[_0x35e4('0x45')]['id']}})[_0x35e4('0x25')](handleEntityNotFound(_0x299925,null))[_0x35e4('0x25')](saveUpdates(_0x2177b2[_0x35e4('0x48')],null))[_0x35e4('0x25')](respondWithResult(_0x299925,null))[_0x35e4('0x43')](handleError(_0x299925,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index f92bc5a..19f3698 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 _0xb0ee=['rimraf','../../config/environment','./cmHopperHistory.attributes','define','CmHopperHistory','endtime','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x164b4d,_0x53c77a){var _0x4a6b69=function(_0x6d7391){while(--_0x6d7391){_0x164b4d['push'](_0x164b4d['shift']());}};_0x4a6b69(++_0x53c77a);}(_0xb0ee,0x18f));var _0xeb0e=function(_0x17406a,_0x1e2320){_0x17406a=_0x17406a-0x0;var _0x1501ff=_0xb0ee[_0x17406a];return _0x1501ff;};'use strict';var _=require('lodash');var util=require(_0xeb0e('0x0'));var logger=require(_0xeb0e('0x1'))(_0xeb0e('0x2'));var moment=require(_0xeb0e('0x3'));var BPromise=require(_0xeb0e('0x4'));var rp=require(_0xeb0e('0x5'));var fs=require('fs');var path=require(_0xeb0e('0x6'));var rimraf=require(_0xeb0e('0x7'));var config=require(_0xeb0e('0x8'));var attributes=require(_0xeb0e('0x9'));module['exports']=function(_0x1a95ad,_0x1e8dca){return _0x1a95ad[_0xeb0e('0xa')](_0xeb0e('0xb'),attributes,{'tableName':'cm_hopper_history','paranoid':![],'indexes':[{'name':_0xeb0e('0xc'),'fields':[_0xeb0e('0xc')]},{'name':_0xeb0e('0xd'),'fields':[_0xeb0e('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7524=['bluebird','rimraf','./cmHopperHistory.attributes','exports','define','cm_hopper_history','endtime','uniqueid','util','../../config/logger','moment'];(function(_0x325710,_0x144515){var _0x23f8aa=function(_0x48e5a2){while(--_0x48e5a2){_0x325710['push'](_0x325710['shift']());}};_0x23f8aa(++_0x144515);}(_0x7524,0xce));var _0x4752=function(_0x5306a1,_0x3a2d0f){_0x5306a1=_0x5306a1-0x0;var _0x4ad734=_0x7524[_0x5306a1];return _0x4ad734;};'use strict';var _=require('lodash');var util=require(_0x4752('0x0'));var logger=require(_0x4752('0x1'))('api');var moment=require(_0x4752('0x2'));var BPromise=require(_0x4752('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x4752('0x4'));var config=require('../../config/environment');var attributes=require(_0x4752('0x5'));module[_0x4752('0x6')]=function(_0x66a421,_0x55b411){return _0x66a421[_0x4752('0x7')]('CmHopperHistory',attributes,{'tableName':_0x4752('0x8'),'paranoid':![],'indexes':[{'name':_0x4752('0x9'),'fields':['endtime']},{'name':'uniqueid','fields':[_0x4752('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index 80d8296..2b7fb1b 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 _0xcd60=['predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','AVG','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','GetVoiceQueueHopperHistory','where','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundRejectCallsDay','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','outboundReCallsDay','ivrTotalCallsDays','ivrAnswerCallsDay','GetCampaignHopperHistory','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','CmHopperHistory,\x20%s,\x20%s','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','CreateCmHopperHistory','CmHopperHistory','options','raw','AvgHandleTime','findAll','sequelize','COUNT','col','predictiveIntervalTotalCalls','literal','`state`\x20=\x204,\x201,\x20null'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcd60,0xf0));var _0x0cd6=function(_0x50ecac,_0x32aae7){_0x50ecac=_0x50ecac-0x0;var _0x5daa83=_0xcd60[_0x50ecac];return _0x5daa83;};'use strict';var _=require(_0x0cd6('0x0'));var util=require(_0x0cd6('0x1'));var moment=require(_0x0cd6('0x2'));var BPromise=require(_0x0cd6('0x3'));var rs=require(_0x0cd6('0x4'));var fs=require('fs');var Redis=require(_0x0cd6('0x5'));var db=require(_0x0cd6('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x0cd6('0x7'))(_0x0cd6('0x8'));var config=require(_0x0cd6('0x9'));var jayson=require(_0x0cd6('0xa'));var client=jayson[_0x0cd6('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2ceb47,_0x460833,_0x47c8b2){return new BPromise(function(_0x4714bf,_0x4fb298){return client[_0x0cd6('0xc')](_0x2ceb47,_0x47c8b2)[_0x0cd6('0xd')](function(_0x14f396){logger[_0x0cd6('0xe')](_0x0cd6('0xf'),_0x460833,'request\x20sent');logger[_0x0cd6('0x10')](_0x0cd6('0x11'),_0x460833,_0x0cd6('0x12'),JSON[_0x0cd6('0x13')](_0x14f396));if(_0x14f396[_0x0cd6('0x14')]){if(_0x14f396['error']['code']===0x1f4){logger[_0x0cd6('0x14')](_0x0cd6('0xf'),_0x460833,_0x14f396[_0x0cd6('0x14')]['message']);return _0x4fb298(_0x14f396[_0x0cd6('0x14')]['message']);}logger[_0x0cd6('0x14')](_0x0cd6('0xf'),_0x460833,_0x14f396[_0x0cd6('0x14')][_0x0cd6('0x15')]);return _0x4714bf(_0x14f396[_0x0cd6('0x14')][_0x0cd6('0x15')]);}else{logger[_0x0cd6('0xe')](_0x0cd6('0xf'),_0x460833,_0x0cd6('0x12'));_0x4714bf(_0x14f396[_0x0cd6('0x16')][_0x0cd6('0x15')]);}})[_0x0cd6('0x17')](function(_0x30d35c){logger[_0x0cd6('0x14')]('CmHopperHistory,\x20%s,\x20%s',_0x460833,_0x30d35c);_0x4fb298(_0x30d35c);});});}exports[_0x0cd6('0x18')]=function(_0x202d73){var _0x48ac27=this;return new Promise(function(_0x5c37ee,_0x5bebbc){return db[_0x0cd6('0x19')]['create'](_0x202d73['body'],{'raw':_0x202d73[_0x0cd6('0x1a')]?_0x202d73['options'][_0x0cd6('0x1b')]===undefined?!![]:![]:!![]})[_0x0cd6('0xd')](function(_0x1b29b1){logger[_0x0cd6('0xe')](_0x0cd6('0x18'),_0x202d73);logger[_0x0cd6('0x10')](_0x0cd6('0x18'),_0x202d73,JSON[_0x0cd6('0x13')](_0x1b29b1));_0x5c37ee(_0x1b29b1);})['catch'](function(_0x643aa0){logger[_0x0cd6('0x14')](_0x0cd6('0x18'),_0x643aa0['message'],_0x202d73);_0x5bebbc(_0x48ac27['error'](0x1f4,_0x643aa0['message']));});});};exports[_0x0cd6('0x1c')]=function(_0x5c8b8b){var _0x5ac9c0=this;return new Promise(function(_0x4e0eb1,_0x4beec7){return db[_0x0cd6('0x19')][_0x0cd6('0x1d')]({'raw':_0x5c8b8b[_0x0cd6('0x1a')]?_0x5c8b8b[_0x0cd6('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x5c8b8b['options']?_0x5c8b8b[_0x0cd6('0x1a')]['where']||null:null,'attributes':[[db[_0x0cd6('0x1e')]['fn'](_0x0cd6('0x1f'),db[_0x0cd6('0x1e')][_0x0cd6('0x20')]('id')),_0x0cd6('0x21')],[db[_0x0cd6('0x1e')]['fn'](_0x0cd6('0x1f'),db[_0x0cd6('0x1e')]['fn']('IF',db[_0x0cd6('0x1e')][_0x0cd6('0x22')](_0x0cd6('0x23')))),_0x0cd6('0x24')],[db[_0x0cd6('0x1e')]['fn'](_0x0cd6('0x1f'),db[_0x0cd6('0x1e')]['fn']('IF',db[_0x0cd6('0x1e')]['literal'](_0x0cd6('0x25')))),_0x0cd6('0x26')],[db[_0x0cd6('0x1e')]['fn'](_0x0cd6('0x1f'),db['sequelize']['fn']('IF',db[_0x0cd6('0x1e')][_0x0cd6('0x22')](_0x0cd6('0x27')))),_0x0cd6('0x28')],[db[_0x0cd6('0x1e')]['fn']('AVG',db[_0x0cd6('0x1e')]['fn']('IF',db[_0x0cd6('0x1e')][_0x0cd6('0x22')](_0x0cd6('0x29')))),_0x0cd6('0x2a')],[db['sequelize']['fn'](_0x0cd6('0x2b'),db[_0x0cd6('0x1e')]['fn']('IF',db['sequelize'][_0x0cd6('0x22')](_0x0cd6('0x2c')))),_0x0cd6('0x2d')]]})['then'](function(_0x2bf56d){logger[_0x0cd6('0xe')]('AvgHandleTime',_0x5c8b8b);logger[_0x0cd6('0x10')](_0x0cd6('0x1c'),_0x5c8b8b,JSON[_0x0cd6('0x13')](_0x2bf56d));_0x4e0eb1(_0x2bf56d);})['catch'](function(_0x23d159){logger[_0x0cd6('0x14')](_0x0cd6('0x1c'),_0x23d159['message'],_0x5c8b8b);_0x4beec7(_0x5ac9c0[_0x0cd6('0x14')](0x1f4,_0x23d159['message']));});});};exports[_0x0cd6('0x2e')]=function(_0x3b723b){var _0x4058e2=this;return new Promise(function(_0x5574dd,_0x2ac6ab){return db[_0x0cd6('0x19')][_0x0cd6('0x1d')]({'raw':_0x3b723b[_0x0cd6('0x1a')]?_0x3b723b[_0x0cd6('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x3b723b['options']?_0x3b723b[_0x0cd6('0x1a')][_0x0cd6('0x2f')]||null:null,'attributes':[[_0x0cd6('0x30'),_0x0cd6('0x31')],[db['sequelize']['fn'](_0x0cd6('0x1f'),db[_0x0cd6('0x1e')]['fn']('IF',db[_0x0cd6('0x1e')][_0x0cd6('0x22')](_0x0cd6('0x32')))),_0x0cd6('0x33')],[db['sequelize']['fn'](_0x0cd6('0x1f'),db['sequelize']['fn']('IF',db['sequelize'][_0x0cd6('0x22')](_0x0cd6('0x34')))),'outboundNoAnswerCallsDay'],[db[_0x0cd6('0x1e')]['fn'](_0x0cd6('0x1f'),db[_0x0cd6('0x1e')]['fn']('IF',db[_0x0cd6('0x1e')][_0x0cd6('0x22')](_0x0cd6('0x23')))),'outboundAnswerCallsDay'],[db[_0x0cd6('0x1e')]['fn'](_0x0cd6('0x1f'),db[_0x0cd6('0x1e')]['fn']('IF',db[_0x0cd6('0x1e')][_0x0cd6('0x22')](_0x0cd6('0x35')))),_0x0cd6('0x36')],[db[_0x0cd6('0x1e')]['fn']('COUNT',db[_0x0cd6('0x1e')]['fn']('IF',db[_0x0cd6('0x1e')]['literal'](_0x0cd6('0x37')))),_0x0cd6('0x38')],[db[_0x0cd6('0x1e')]['fn'](_0x0cd6('0x1f'),db[_0x0cd6('0x1e')]['fn']('IF',db[_0x0cd6('0x1e')][_0x0cd6('0x22')](_0x0cd6('0x39')))),'outboundDropCallsDayTimeout'],[db[_0x0cd6('0x1e')]['fn'](_0x0cd6('0x1f'),db[_0x0cd6('0x1e')]['fn']('IF',db['sequelize'][_0x0cd6('0x22')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x0cd6('0x3a')],[db[_0x0cd6('0x1e')]['fn'](_0x0cd6('0x1f'),db[_0x0cd6('0x1e')]['fn']('IF',db[_0x0cd6('0x1e')][_0x0cd6('0x22')](_0x0cd6('0x3b')))),'outboundUnknownCallsDay'],[db[_0x0cd6('0x1e')]['fn'](_0x0cd6('0x1f'),db[_0x0cd6('0x1e')]['fn']('IF',db[_0x0cd6('0x1e')][_0x0cd6('0x22')]('`state`\x20=\x2013,\x201,\x20null'))),_0x0cd6('0x3c')],[db[_0x0cd6('0x1e')]['fn'](_0x0cd6('0x1f'),db[_0x0cd6('0x1e')]['fn']('IF',db[_0x0cd6('0x1e')][_0x0cd6('0x22')](_0x0cd6('0x3d')))),'outboundOriginateFailureCallsDay'],[db['sequelize']['fn'](_0x0cd6('0x1f'),db[_0x0cd6('0x1e')]['fn']('IF',db[_0x0cd6('0x1e')][_0x0cd6('0x22')]('`state`\x20=\x2018,\x201,\x20null'))),_0x0cd6('0x3e')],[db[_0x0cd6('0x1e')]['fn']('COUNT',db[_0x0cd6('0x1e')]['fn']('IF',db[_0x0cd6('0x1e')][_0x0cd6('0x22')]('`state`\x20=\x2016,\x201,\x20null'))),_0x0cd6('0x3f')],[db[_0x0cd6('0x1e')]['fn']('COUNT',db[_0x0cd6('0x1e')]['fn']('IF',db[_0x0cd6('0x1e')][_0x0cd6('0x22')](_0x0cd6('0x40')))),_0x0cd6('0x3e')],[db[_0x0cd6('0x1e')]['fn'](_0x0cd6('0x1f'),db[_0x0cd6('0x1e')]['fn']('IF',db[_0x0cd6('0x1e')][_0x0cd6('0x22')]('`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null'))),_0x0cd6('0x41')]],'group':['campaign']})[_0x0cd6('0xd')](function(_0x1c0500){logger[_0x0cd6('0xe')](_0x0cd6('0x2e'),_0x3b723b);logger[_0x0cd6('0x10')](_0x0cd6('0x2e'),_0x3b723b,JSON[_0x0cd6('0x13')](_0x1c0500));_0x5574dd(_0x1c0500);})[_0x0cd6('0x17')](function(_0x4bd5dd){logger[_0x0cd6('0x14')](_0x0cd6('0x2e'),_0x4bd5dd[_0x0cd6('0x15')],_0x3b723b);_0x2ac6ab(_0x4058e2[_0x0cd6('0x14')](0x1f4,_0x4bd5dd['message']));});});};exports['GetCampaignHopperHistory']=function(_0x155c6c){var _0x49b08f=this;return new Promise(function(_0x38e284,_0x1825c3){return db[_0x0cd6('0x19')][_0x0cd6('0x1d')]({'raw':_0x155c6c[_0x0cd6('0x1a')]?_0x155c6c[_0x0cd6('0x1a')][_0x0cd6('0x1b')]===undefined?!![]:![]:!![],'where':_0x155c6c[_0x0cd6('0x1a')]?_0x155c6c['options'][_0x0cd6('0x2f')]||null:null,'attributes':[[_0x0cd6('0x30'),_0x0cd6('0x31')],[db[_0x0cd6('0x1e')]['fn'](_0x0cd6('0x1f'),db[_0x0cd6('0x1e')][_0x0cd6('0x20')]('id')),_0x0cd6('0x42')],[db[_0x0cd6('0x1e')]['fn'](_0x0cd6('0x1f'),db[_0x0cd6('0x1e')]['fn']('IF',db['sequelize'][_0x0cd6('0x22')](_0x0cd6('0x23')))),_0x0cd6('0x43')]],'group':[_0x0cd6('0x30')]})[_0x0cd6('0xd')](function(_0x556a11){logger[_0x0cd6('0xe')](_0x0cd6('0x44'),_0x155c6c);logger[_0x0cd6('0x10')]('GetCampaignHopperHistory',_0x155c6c,JSON[_0x0cd6('0x13')](_0x556a11));_0x38e284(_0x556a11);})[_0x0cd6('0x17')](function(_0x31b4bc){logger[_0x0cd6('0x14')](_0x0cd6('0x44'),_0x31b4bc['message'],_0x155c6c);_0x1825c3(_0x49b08f[_0x0cd6('0x14')](0x1f4,_0x31b4bc[_0x0cd6('0x15')]));});});}; \ No newline at end of file +var _0xda3f=['COUNT','sequelize','col','predictiveIntervalTotalCalls','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','GetVoiceQueueHopperHistory','findAll','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','outboundAnswerCallsDay','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','campaign','GetCampaignHopperHistory','ivrTotalCallsDays','util','moment','../../mysqldb','../../config/logger','rpc','jayson/promise','client','request','then','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateCmHopperHistory','CmHopperHistory','create','body','options','raw','AvgHandleTime','where'];(function(_0x527c39,_0x3ea2a6){var _0x3f4dd6=function(_0x1ec265){while(--_0x1ec265){_0x527c39['push'](_0x527c39['shift']());}};_0x3f4dd6(++_0x3ea2a6);}(_0xda3f,0xec));var _0xfda3=function(_0x6e82c6,_0x2ad5d1){_0x6e82c6=_0x6e82c6-0x0;var _0x1d5e6e=_0xda3f[_0x6e82c6];return _0x1d5e6e;};'use strict';var _=require('lodash');var util=require(_0xfda3('0x0'));var moment=require(_0xfda3('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfda3('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xfda3('0x3'))(_0xfda3('0x4'));var config=require('../../config/environment');var jayson=require(_0xfda3('0x5'));var client=jayson[_0xfda3('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4e72d1,_0x316792,_0x42476a){return new BPromise(function(_0x125e2a,_0x4018c0){return client[_0xfda3('0x7')](_0x4e72d1,_0x42476a)[_0xfda3('0x8')](function(_0x46655c){logger[_0xfda3('0x9')](_0xfda3('0xa'),_0x316792,_0xfda3('0xb'));logger[_0xfda3('0xc')](_0xfda3('0xd'),_0x316792,'request\x20sent',JSON[_0xfda3('0xe')](_0x46655c));if(_0x46655c[_0xfda3('0xf')]){if(_0x46655c[_0xfda3('0xf')][_0xfda3('0x10')]===0x1f4){logger[_0xfda3('0xf')]('CmHopperHistory,\x20%s,\x20%s',_0x316792,_0x46655c[_0xfda3('0xf')]['message']);return _0x4018c0(_0x46655c[_0xfda3('0xf')][_0xfda3('0x11')]);}logger['error']('CmHopperHistory,\x20%s,\x20%s',_0x316792,_0x46655c['error'][_0xfda3('0x11')]);return _0x125e2a(_0x46655c[_0xfda3('0xf')]['message']);}else{logger['info']('CmHopperHistory,\x20%s,\x20%s',_0x316792,_0xfda3('0xb'));_0x125e2a(_0x46655c[_0xfda3('0x12')][_0xfda3('0x11')]);}})[_0xfda3('0x13')](function(_0x34900d){logger[_0xfda3('0xf')](_0xfda3('0xa'),_0x316792,_0x34900d);_0x4018c0(_0x34900d);});});}exports[_0xfda3('0x14')]=function(_0x4680bf){var _0xc62ae6=this;return new Promise(function(_0x54a7c6,_0x15ddb9){return db[_0xfda3('0x15')][_0xfda3('0x16')](_0x4680bf[_0xfda3('0x17')],{'raw':_0x4680bf['options']?_0x4680bf[_0xfda3('0x18')][_0xfda3('0x19')]===undefined?!![]:![]:!![]})[_0xfda3('0x8')](function(_0x51e731){logger['info'](_0xfda3('0x14'),_0x4680bf);logger[_0xfda3('0xc')](_0xfda3('0x14'),_0x4680bf,JSON['stringify'](_0x51e731));_0x54a7c6(_0x51e731);})[_0xfda3('0x13')](function(_0xef2535){logger[_0xfda3('0xf')](_0xfda3('0x14'),_0xef2535[_0xfda3('0x11')],_0x4680bf);_0x15ddb9(_0xc62ae6[_0xfda3('0xf')](0x1f4,_0xef2535[_0xfda3('0x11')]));});});};exports[_0xfda3('0x1a')]=function(_0x16eaa6){var _0x5499f5=this;return new Promise(function(_0x82341b,_0x2d5b44){return db[_0xfda3('0x15')]['findAll']({'raw':_0x16eaa6[_0xfda3('0x18')]?_0x16eaa6[_0xfda3('0x18')][_0xfda3('0x19')]===undefined?!![]:![]:!![],'where':_0x16eaa6[_0xfda3('0x18')]?_0x16eaa6[_0xfda3('0x18')][_0xfda3('0x1b')]||null:null,'attributes':[[db['sequelize']['fn'](_0xfda3('0x1c'),db[_0xfda3('0x1d')][_0xfda3('0x1e')]('id')),_0xfda3('0x1f')],[db[_0xfda3('0x1d')]['fn']('COUNT',db[_0xfda3('0x1d')]['fn']('IF',db[_0xfda3('0x1d')][_0xfda3('0x20')](_0xfda3('0x21')))),_0xfda3('0x22')],[db[_0xfda3('0x1d')]['fn'](_0xfda3('0x1c'),db['sequelize']['fn']('IF',db['sequelize'][_0xfda3('0x20')]('`state`\x20=\x2010,\x201,\x20null'))),'predictiveIntervalDroppedCallsTimeout'],[db[_0xfda3('0x1d')]['fn'](_0xfda3('0x1c'),db[_0xfda3('0x1d')]['fn']('IF',db[_0xfda3('0x1d')][_0xfda3('0x20')](_0xfda3('0x23')))),_0xfda3('0x24')],[db[_0xfda3('0x1d')]['fn'](_0xfda3('0x25'),db['sequelize']['fn']('IF',db[_0xfda3('0x1d')][_0xfda3('0x20')](_0xfda3('0x26')))),_0xfda3('0x27')],[db[_0xfda3('0x1d')]['fn'](_0xfda3('0x25'),db[_0xfda3('0x1d')]['fn']('IF',db[_0xfda3('0x1d')][_0xfda3('0x20')]('`state`\x20=\x204,\x20`talktime`,\x20null'))),'predictiveIntervalAvgTalktime']]})[_0xfda3('0x8')](function(_0x17cccb){logger['info'](_0xfda3('0x1a'),_0x16eaa6);logger[_0xfda3('0xc')](_0xfda3('0x1a'),_0x16eaa6,JSON['stringify'](_0x17cccb));_0x82341b(_0x17cccb);})[_0xfda3('0x13')](function(_0x378bf0){logger[_0xfda3('0xf')](_0xfda3('0x1a'),_0x378bf0[_0xfda3('0x11')],_0x16eaa6);_0x2d5b44(_0x5499f5['error'](0x1f4,_0x378bf0[_0xfda3('0x11')]));});});};exports[_0xfda3('0x28')]=function(_0x33bdfb){var _0x56bed2=this;return new Promise(function(_0x373c96,_0x4854b1){return db[_0xfda3('0x15')][_0xfda3('0x29')]({'raw':_0x33bdfb[_0xfda3('0x18')]?_0x33bdfb[_0xfda3('0x18')][_0xfda3('0x19')]===undefined?!![]:![]:!![],'where':_0x33bdfb[_0xfda3('0x18')]?_0x33bdfb[_0xfda3('0x18')][_0xfda3('0x1b')]||null:null,'attributes':[['campaign',_0xfda3('0x2a')],[db[_0xfda3('0x1d')]['fn'](_0xfda3('0x1c'),db[_0xfda3('0x1d')]['fn']('IF',db['sequelize'][_0xfda3('0x20')](_0xfda3('0x2b')))),_0xfda3('0x2c')],[db['sequelize']['fn']('COUNT',db[_0xfda3('0x1d')]['fn']('IF',db[_0xfda3('0x1d')][_0xfda3('0x20')](_0xfda3('0x2d')))),_0xfda3('0x2e')],[db[_0xfda3('0x1d')]['fn'](_0xfda3('0x1c'),db[_0xfda3('0x1d')]['fn']('IF',db[_0xfda3('0x1d')][_0xfda3('0x20')]('`state`\x20=\x204,\x201,\x20null'))),_0xfda3('0x2f')],[db[_0xfda3('0x1d')]['fn']('COUNT',db[_0xfda3('0x1d')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x205,\x201,\x20null'))),_0xfda3('0x30')],[db[_0xfda3('0x1d')]['fn'](_0xfda3('0x1c'),db[_0xfda3('0x1d')]['fn']('IF',db['sequelize'][_0xfda3('0x20')](_0xfda3('0x31')))),_0xfda3('0x32')],[db[_0xfda3('0x1d')]['fn']('COUNT',db[_0xfda3('0x1d')]['fn']('IF',db[_0xfda3('0x1d')][_0xfda3('0x20')]('`state`\x20=\x2010\x20,\x201,\x20null'))),'outboundDropCallsDayTimeout'],[db[_0xfda3('0x1d')]['fn'](_0xfda3('0x1c'),db[_0xfda3('0x1d')]['fn']('IF',db[_0xfda3('0x1d')][_0xfda3('0x20')](_0xfda3('0x33')))),_0xfda3('0x34')],[db[_0xfda3('0x1d')]['fn'](_0xfda3('0x1c'),db[_0xfda3('0x1d')]['fn']('IF',db[_0xfda3('0x1d')][_0xfda3('0x20')](_0xfda3('0x35')))),_0xfda3('0x36')],[db['sequelize']['fn']('COUNT',db[_0xfda3('0x1d')]['fn']('IF',db[_0xfda3('0x1d')][_0xfda3('0x20')](_0xfda3('0x37')))),_0xfda3('0x38')],[db[_0xfda3('0x1d')]['fn'](_0xfda3('0x1c'),db[_0xfda3('0x1d')]['fn']('IF',db[_0xfda3('0x1d')][_0xfda3('0x20')]('`state`\x20=\x2014,\x201,\x20null'))),_0xfda3('0x39')],[db[_0xfda3('0x1d')]['fn'](_0xfda3('0x1c'),db[_0xfda3('0x1d')]['fn']('IF',db[_0xfda3('0x1d')]['literal'](_0xfda3('0x3a')))),_0xfda3('0x3b')],[db[_0xfda3('0x1d')]['fn']('COUNT',db[_0xfda3('0x1d')]['fn']('IF',db[_0xfda3('0x1d')][_0xfda3('0x20')]('`state`\x20=\x2016,\x201,\x20null'))),_0xfda3('0x3c')],[db[_0xfda3('0x1d')]['fn'](_0xfda3('0x1c'),db[_0xfda3('0x1d')]['fn']('IF',db[_0xfda3('0x1d')]['literal'](_0xfda3('0x3d')))),'outboundRejectCallsDay'],[db[_0xfda3('0x1d')]['fn']('COUNT',db[_0xfda3('0x1d')]['fn']('IF',db[_0xfda3('0x1d')][_0xfda3('0x20')](_0xfda3('0x3e')))),'outboundReCallsDay']],'group':[_0xfda3('0x3f')]})[_0xfda3('0x8')](function(_0x2f2c32){logger[_0xfda3('0x9')](_0xfda3('0x28'),_0x33bdfb);logger[_0xfda3('0xc')](_0xfda3('0x28'),_0x33bdfb,JSON['stringify'](_0x2f2c32));_0x373c96(_0x2f2c32);})['catch'](function(_0x4fb214){logger[_0xfda3('0xf')](_0xfda3('0x28'),_0x4fb214['message'],_0x33bdfb);_0x4854b1(_0x56bed2['error'](0x1f4,_0x4fb214[_0xfda3('0x11')]));});});};exports[_0xfda3('0x40')]=function(_0x10ee1b){var _0x421e02=this;return new Promise(function(_0x2fcbe7,_0x4bc976){return db[_0xfda3('0x15')][_0xfda3('0x29')]({'raw':_0x10ee1b[_0xfda3('0x18')]?_0x10ee1b[_0xfda3('0x18')][_0xfda3('0x19')]===undefined?!![]:![]:!![],'where':_0x10ee1b[_0xfda3('0x18')]?_0x10ee1b[_0xfda3('0x18')][_0xfda3('0x1b')]||null:null,'attributes':[[_0xfda3('0x3f'),_0xfda3('0x2a')],[db[_0xfda3('0x1d')]['fn'](_0xfda3('0x1c'),db['sequelize'][_0xfda3('0x1e')]('id')),_0xfda3('0x41')],[db[_0xfda3('0x1d')]['fn'](_0xfda3('0x1c'),db[_0xfda3('0x1d')]['fn']('IF',db[_0xfda3('0x1d')][_0xfda3('0x20')]('`state`\x20=\x204,\x201,\x20null'))),'ivrAnswerCallsDay']],'group':[_0xfda3('0x3f')]})[_0xfda3('0x8')](function(_0x486e55){logger[_0xfda3('0x9')](_0xfda3('0x40'),_0x10ee1b);logger[_0xfda3('0xc')](_0xfda3('0x40'),_0x10ee1b,JSON['stringify'](_0x486e55));_0x2fcbe7(_0x486e55);})['catch'](function(_0xb61f7c){logger[_0xfda3('0xf')](_0xfda3('0x40'),_0xb61f7c['message'],_0x10ee1b);_0x4bc976(_0x421e02[_0xfda3('0xf')](0x1f4,_0xb61f7c['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index 0f97f0c..b36fe65 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 _0x373b=['./cmHopperHistory.controller','index','get','isAuthenticated','/:id','show','post','create','put','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x28e714,_0x1ca825){var _0x2c3bf2=function(_0x2e0af6){while(--_0x2e0af6){_0x28e714['push'](_0x28e714['shift']());}};_0x2c3bf2(++_0x1ca825);}(_0x373b,0x64));var _0xb373=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x373b[_0x5ddb1c];return _0x354adc;};'use strict';var multer=require(_0xb373('0x0'));var util=require(_0xb373('0x1'));var path=require(_0xb373('0x2'));var timeout=require('connect-timeout');var express=require(_0xb373('0x3'));var router=express[_0xb373('0x4')]();var fs_extra=require(_0xb373('0x5'));var auth=require(_0xb373('0x6'));var interaction=require(_0xb373('0x7'));var config=require('../../config/environment');var controller=require(_0xb373('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xb373('0x9')]);router[_0xb373('0xa')]('/describe',auth[_0xb373('0xb')](),controller['describe']);router[_0xb373('0xa')](_0xb373('0xc'),auth[_0xb373('0xb')](),controller[_0xb373('0xd')]);router[_0xb373('0xe')]('/',auth[_0xb373('0xb')](),controller[_0xb373('0xf')]);router[_0xb373('0x10')](_0xb373('0xc'),auth[_0xb373('0xb')](),controller['update']);module[_0xb373('0x11')]=router; \ No newline at end of file +var _0x092c=['../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','exports','multer','connect-timeout','fs-extra','../../components/auth/service'];(function(_0x23215e,_0x57389e){var _0x2ab97c=function(_0xc66dee){while(--_0xc66dee){_0x23215e['push'](_0x23215e['shift']());}};_0x2ab97c(++_0x57389e);}(_0x092c,0xc8));var _0xc092=function(_0x2357d2,_0x4b3162){_0x2357d2=_0x2357d2-0x0;var _0x1553ec=_0x092c[_0x2357d2];return _0x1553ec;};'use strict';var multer=require(_0xc092('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xc092('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xc092('0x2'));var auth=require(_0xc092('0x3'));var interaction=require(_0xc092('0x4'));var config=require(_0xc092('0x5'));var controller=require(_0xc092('0x6'));router[_0xc092('0x7')]('/',auth[_0xc092('0x8')](),controller[_0xc092('0x9')]);router['get'](_0xc092('0xa'),auth[_0xc092('0x8')](),controller[_0xc092('0xb')]);router[_0xc092('0x7')](_0xc092('0xc'),auth[_0xc092('0x8')](),controller[_0xc092('0xd')]);router[_0xc092('0xe')]('/',auth[_0xc092('0x8')](),controller[_0xc092('0xf')]);router['put'](_0xc092('0xc'),auth[_0xc092('0x8')](),controller['update']);module[_0xc092('0x10')]=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index aa282fc..8ed3583 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 _0xc2d6=['exports','STRING','name'];(function(_0x7252f3,_0x19e5fc){var _0x41d40b=function(_0x37bf2e){while(--_0x37bf2e){_0x7252f3['push'](_0x7252f3['shift']());}};_0x41d40b(++_0x19e5fc);}(_0xc2d6,0x171));var _0x6c2d=function(_0xd1d19a,_0x1933f0){_0xd1d19a=_0xd1d19a-0x0;var _0x52a79d=_0xc2d6[_0xd1d19a];return _0x52a79d;};'use strict';var Sequelize=require('sequelize');module[_0x6c2d('0x0')]={'name':{'type':Sequelize[_0x6c2d('0x1')],'unique':_0x6c2d('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x6c2d('0x1')]},'dialPrefix':{'type':Sequelize[_0x6c2d('0x1')]}}; \ No newline at end of file +var _0xdefc=['sequelize','exports','STRING'];(function(_0xcfe8cc,_0xb83aeb){var _0x55ac53=function(_0x4067d4){while(--_0x4067d4){_0xcfe8cc['push'](_0xcfe8cc['shift']());}};_0x55ac53(++_0xb83aeb);}(_0xdefc,0x1b3));var _0xcdef=function(_0x497d8c,_0x2904c9){_0x497d8c=_0x497d8c-0x0;var _0xeafed7=_0xdefc[_0x497d8c];return _0xeafed7;};'use strict';var Sequelize=require(_0xcdef('0x0'));module[_0xcdef('0x1')]={'name':{'type':Sequelize[_0xcdef('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'dialPrefix':{'type':Sequelize[_0xcdef('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index 31273a5..9af38e7 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 _0xf56c=['description','toString','isEmpty','now','setHeader','Content-disposition','Content-type','text/csv','download','addCustomField','sequelize','transaction','addCustomFields','Sequelize','text','TEXT','INTEGER','switch','BOOLEAN','queryInterface','cm_contacts','getCustomFields','findAndCountAll','getGlobalCustomFields','addAgents','spread','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','User','info','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./cmList.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','get','error','stack','send','index','map','rawAttributes','type','name','keys','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','CmList','includeAll','include','findAll','rows','show','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','addDisposition','getDispositions','findOne','Disposition','order','ListId','options','removeDispositions','ids','addContacts','CmContact','describe','tags','isArray','join','push','each','omit','success','errors','message','Malformed\x20request\x20syntax','CmCustomField','concat','CustomFields','format','cf_%d','raw','getContacts','getContactsCsv','ContactItemType','OrderBy','alias','from','c.ListId\x20=\x20?','distinct','field','c.cf_','customField_','select','cm_contact_has_items','ItemTypeId\x20=\x20?','CmContactId\x20=\x20c.id'];(function(_0x72a33d,_0x5691da){var _0x2621d5=function(_0x95b7c6){while(--_0x95b7c6){_0x72a33d['push'](_0x72a33d['shift']());}};_0x2621d5(++_0x5691da);}(_0xf56c,0xc5));var _0xcf56=function(_0x4f21cd,_0x30f06f){_0x4f21cd=_0x4f21cd-0x0;var _0x1af331=_0xf56c[_0x4f21cd];return _0x1af331;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xcf56('0x0'));var zipdir=require(_0xcf56('0x1'));var jsonpatch=require(_0xcf56('0x2'));var rp=require(_0xcf56('0x3'));var moment=require(_0xcf56('0x4'));var BPromise=require(_0xcf56('0x5'));var Mustache=require(_0xcf56('0x6'));var util=require(_0xcf56('0x7'));var path=require(_0xcf56('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xcf56('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xcf56('0xa'));var squel=require(_0xcf56('0xb'));var crypto=require(_0xcf56('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xcf56('0xd'));var toCsv=require(_0xcf56('0xe'));var querystring=require(_0xcf56('0xf'));var Papa=require('papaparse');var Redis=require(_0xcf56('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xcf56('0x11'));var as=require(_0xcf56('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xcf56('0x13'))(_0xcf56('0x14'));var utils=require(_0xcf56('0x15'));var config=require(_0xcf56('0x16'));var licenseUtil=require(_0xcf56('0x17'));var db=require(_0xcf56('0x18'))['db'];var csv_results;config[_0xcf56('0x19')]=_[_0xcf56('0x1a')](config['redis'],{'host':_0xcf56('0x1b'),'port':0x18eb});var socket=require(_0xcf56('0x1c'))(new Redis(config['redis']));require(_0xcf56('0x1d'))[_0xcf56('0x1e')](socket);function respondWithStatusCode(_0x547e2b,_0x52052c){_0x52052c=_0x52052c||0xcc;return function(_0x515a2f){if(_0x515a2f){return _0x547e2b[_0xcf56('0x1f')](_0x52052c);}return _0x547e2b[_0xcf56('0x20')](_0x52052c)[_0xcf56('0x21')]();};}function respondWithResult(_0x4ab344,_0x3955c2){_0x3955c2=_0x3955c2||0xc8;return function(_0x4ac3c7){if(_0x4ac3c7){return _0x4ab344[_0xcf56('0x20')](_0x3955c2)[_0xcf56('0x22')](_0x4ac3c7);}};}function respondWithFilteredResult(_0x1679c0,_0x260f9f){return function(_0x26028e){if(_0x26028e){var _0x1c8e18=typeof _0x260f9f[_0xcf56('0x23')]===_0xcf56('0x24')&&typeof _0x260f9f[_0xcf56('0x25')]===_0xcf56('0x24');var _0x354628=_0x26028e[_0xcf56('0x26')];var _0x19a6d4=_0x1c8e18?0x0:_0x260f9f[_0xcf56('0x23')];var _0x273642=_0x1c8e18?_0x26028e[_0xcf56('0x26')]:_0x260f9f[_0xcf56('0x23')]+_0x260f9f[_0xcf56('0x25')];var _0x42cc79;if(_0x273642>=_0x354628){_0x273642=_0x354628;_0x42cc79=0xc8;}else{_0x42cc79=0xce;}_0x1679c0[_0xcf56('0x20')](_0x42cc79);return _0x1679c0['set'](_0xcf56('0x27'),_0x19a6d4+'-'+_0x273642+'/'+_0x354628)[_0xcf56('0x22')](_0x26028e);}return null;};}function patchUpdates(_0x3c94ed){return function(_0x3482c8){try{jsonpatch[_0xcf56('0x28')](_0x3482c8,_0x3c94ed,!![]);}catch(_0x7af9e0){return BPromise[_0xcf56('0x29')](_0x7af9e0);}return _0x3482c8[_0xcf56('0x2a')]();};}function saveUpdates(_0x562c03,_0x50b435){return function(_0x262427){if(_0x262427){return _0x262427[_0xcf56('0x2b')](_0x562c03)[_0xcf56('0x2c')](function(_0x534f51){return _0x534f51;});}return null;};}function removeEntity(_0x34df45,_0x2e21e6){return function(_0x4f390a){if(_0x4f390a){return _0x4f390a[_0xcf56('0x2d')]()[_0xcf56('0x2c')](function(){var _0x2dee98=_0x4f390a[_0xcf56('0x2e')]({'plain':!![]});var _0x105e47='Lists';return db['UserProfileResource'][_0xcf56('0x2d')]({'where':{'type':_0x105e47,'resourceId':_0x2dee98['id']}})[_0xcf56('0x2c')](function(){return _0x4f390a;});})[_0xcf56('0x2c')](function(){_0x34df45['status'](0xcc)[_0xcf56('0x21')]();});}};}function handleEntityNotFound(_0x42cb1a,_0x27b31b){return function(_0x259535){if(!_0x259535){_0x42cb1a[_0xcf56('0x1f')](0x194);}return _0x259535;};}function handleError(_0x278441,_0x4d99b0){_0x4d99b0=_0x4d99b0||0x1f4;return function(_0x3f5ccd){logger[_0xcf56('0x2f')](_0x3f5ccd[_0xcf56('0x30')]);if(_0x3f5ccd['name']){delete _0x3f5ccd['name'];}_0x278441['status'](_0x4d99b0)[_0xcf56('0x31')](_0x3f5ccd);};}exports[_0xcf56('0x32')]=function(_0x48b251,_0x5e521c){var _0x3efedd={},_0x93e4e5={},_0x492104={'count':0x0,'rows':[]};var _0x1fd405=_[_0xcf56('0x33')](db['CmList'][_0xcf56('0x34')],function(_0x1a359c){return{'name':_0x1a359c['fieldName'],'type':_0x1a359c[_0xcf56('0x35')]['key']};});_0x93e4e5['model']=_[_0xcf56('0x33')](_0x1fd405,_0xcf56('0x36'));_0x93e4e5['query']=_[_0xcf56('0x37')](_0x48b251[_0xcf56('0x38')]);_0x93e4e5['filters']=_[_0xcf56('0x39')](_0x93e4e5[_0xcf56('0x3a')],_0x93e4e5[_0xcf56('0x38')]);_0x3efedd[_0xcf56('0x3b')]=_['intersection'](_0x93e4e5[_0xcf56('0x3a')],qs[_0xcf56('0x3c')](_0x48b251[_0xcf56('0x38')][_0xcf56('0x3c')]));_0x3efedd[_0xcf56('0x3b')]=_0x3efedd[_0xcf56('0x3b')][_0xcf56('0x3d')]?_0x3efedd[_0xcf56('0x3b')]:_0x93e4e5[_0xcf56('0x3a')];if(!_0x48b251['query'][_0xcf56('0x3e')](_0xcf56('0x3f'))){_0x3efedd[_0xcf56('0x25')]=qs['limit'](_0x48b251[_0xcf56('0x38')][_0xcf56('0x25')]);_0x3efedd['offset']=qs[_0xcf56('0x23')](_0x48b251[_0xcf56('0x38')][_0xcf56('0x23')]);}_0x3efedd['order']=qs[_0xcf56('0x40')](_0x48b251[_0xcf56('0x38')][_0xcf56('0x40')]);_0x3efedd[_0xcf56('0x41')]=qs[_0xcf56('0x42')](_[_0xcf56('0x43')](_0x48b251['query'],_0x93e4e5['filters']),_0x1fd405);if(_0x48b251[_0xcf56('0x38')][_0xcf56('0x44')]){_0x3efedd['where']=_[_0xcf56('0x45')](_0x3efedd[_0xcf56('0x41')],{'$or':_[_0xcf56('0x33')](_0x1fd405,function(_0x2e682d){if(_0x2e682d[_0xcf56('0x35')]!=='VIRTUAL'){var _0x1b3480={};_0x1b3480[_0x2e682d[_0xcf56('0x36')]]={'$like':'%'+_0x48b251['query'][_0xcf56('0x44')]+'%'};return _0x1b3480;}})});}_0x3efedd=_['merge']({},_0x3efedd,_0x48b251['options']);var _0x14efdd={'where':_0x3efedd[_0xcf56('0x41')]};return db[_0xcf56('0x46')]['count'](_0x14efdd)[_0xcf56('0x2c')](function(_0x242207){_0x492104[_0xcf56('0x26')]=_0x242207;if(_0x48b251['query'][_0xcf56('0x47')]){_0x3efedd[_0xcf56('0x48')]=[{'all':!![]}];}return db[_0xcf56('0x46')][_0xcf56('0x49')](_0x3efedd);})['then'](function(_0x564802){_0x492104[_0xcf56('0x4a')]=_0x564802;return _0x492104;})[_0xcf56('0x2c')](respondWithFilteredResult(_0x5e521c,_0x3efedd))['catch'](handleError(_0x5e521c,null));};exports[_0xcf56('0x4b')]=function(_0x517d19,_0x2ae42e){var _0x1a3115={'raw':![],'where':{'id':_0x517d19['params']['id']}},_0x4935e4={};_0x4935e4['model']=_[_0xcf56('0x37')](db[_0xcf56('0x46')][_0xcf56('0x34')]);_0x4935e4['query']=_['keys'](_0x517d19[_0xcf56('0x38')]);_0x4935e4[_0xcf56('0x42')]=_[_0xcf56('0x39')](_0x4935e4['model'],_0x4935e4['query']);_0x1a3115[_0xcf56('0x3b')]=_[_0xcf56('0x39')](_0x4935e4[_0xcf56('0x3a')],qs[_0xcf56('0x3c')](_0x517d19['query'][_0xcf56('0x3c')]));_0x1a3115[_0xcf56('0x3b')]=_0x1a3115['attributes'][_0xcf56('0x3d')]?_0x1a3115[_0xcf56('0x3b')]:_0x4935e4[_0xcf56('0x3a')];if(_0x517d19[_0xcf56('0x38')][_0xcf56('0x47')]){_0x1a3115[_0xcf56('0x48')]=[{'all':!![]}];}_0x1a3115=_[_0xcf56('0x45')]({},_0x1a3115,_0x517d19['options']);return db['CmList'][_0xcf56('0x4c')](_0x1a3115)[_0xcf56('0x2c')](handleEntityNotFound(_0x2ae42e,null))['then'](respondWithResult(_0x2ae42e,null))['catch'](handleError(_0x2ae42e,null));};exports[_0xcf56('0x4d')]=function(_0x43d51e,_0x18f1f7){return db[_0xcf56('0x46')][_0xcf56('0x4d')](_0x43d51e[_0xcf56('0x4e')],{})[_0xcf56('0x2c')](function(_0xd0ee88){var _0x274853=_0x43d51e[_0xcf56('0x4f')][_0xcf56('0x2e')]({'plain':!![]});if(!_0x274853)throw new Error(_0xcf56('0x50'));if(_0x274853[_0xcf56('0x51')]===_0xcf56('0x4f')){var _0x3c8624=_0xd0ee88[_0xcf56('0x2e')]({'plain':!![]});var _0x25a954='Lists';return db['UserProfileSection']['find']({'where':{'name':_0x25a954,'userProfileId':_0x274853[_0xcf56('0x52')]},'raw':!![]})[_0xcf56('0x2c')](function(_0x301bd4){if(_0x301bd4&&_0x301bd4[_0xcf56('0x53')]===0x0){return db[_0xcf56('0x54')]['create']({'name':_0x3c8624['name'],'resourceId':_0x3c8624['id'],'type':_0x301bd4[_0xcf56('0x36')],'sectionId':_0x301bd4['id']},{})[_0xcf56('0x2c')](function(){return _0xd0ee88;});}else{return _0xd0ee88;}})[_0xcf56('0x55')](function(_0x4ea9f8){logger['error'](_0xcf56('0x56'),_0x4ea9f8);throw _0x4ea9f8;});}return _0xd0ee88;})[_0xcf56('0x2c')](respondWithResult(_0x18f1f7,0xc9))[_0xcf56('0x55')](handleError(_0x18f1f7,null));};exports['update']=function(_0x520f61,_0x1c69d0){if(_0x520f61[_0xcf56('0x4e')]['id']){delete _0x520f61['body']['id'];}return db[_0xcf56('0x46')][_0xcf56('0x4c')]({'where':{'id':_0x520f61[_0xcf56('0x57')]['id']}})[_0xcf56('0x2c')](handleEntityNotFound(_0x1c69d0,null))[_0xcf56('0x2c')](saveUpdates(_0x520f61[_0xcf56('0x4e')],null))[_0xcf56('0x2c')](respondWithResult(_0x1c69d0,null))[_0xcf56('0x55')](handleError(_0x1c69d0,null));};exports[_0xcf56('0x2d')]=function(_0x3b25ff,_0x156079){return db[_0xcf56('0x46')][_0xcf56('0x4c')]({'where':{'id':_0x3b25ff[_0xcf56('0x57')]['id']}})[_0xcf56('0x2c')](handleEntityNotFound(_0x156079,null))[_0xcf56('0x2c')](removeEntity(_0x156079,null))['catch'](handleError(_0x156079,null));};exports['describe']=function(_0x44663b,_0x369179){return db['CmList']['describe']()[_0xcf56('0x2c')](respondWithResult(_0x369179,null))[_0xcf56('0x55')](handleError(_0x369179,null));};exports[_0xcf56('0x58')]=function(_0x4c7fce,_0x47eb1f,_0x398d9a){if(_0x4c7fce[_0xcf56('0x4e')]['id']){delete _0x4c7fce[_0xcf56('0x4e')]['id'];}return db['CmList'][_0xcf56('0x4c')]({'where':{'id':_0x4c7fce[_0xcf56('0x57')]['id']}})[_0xcf56('0x2c')](handleEntityNotFound(_0x47eb1f,null))[_0xcf56('0x2c')](function(_0x12ad99){if(_0x12ad99){_0x4c7fce[_0xcf56('0x4e')]['ListId']=_0x12ad99['id'];return db['Disposition'][_0xcf56('0x4d')](_0x4c7fce[_0xcf56('0x4e')]);}})[_0xcf56('0x2c')](respondWithResult(_0x47eb1f,null))[_0xcf56('0x55')](handleError(_0x47eb1f,null));};exports[_0xcf56('0x59')]=function(_0x3b130a,_0x2bd155,_0x3bf091){var _0x29b911={'raw':![],'where':{}};var _0x892954={};var _0x1fd85a={'count':0x0,'rows':[]};return db['CmList'][_0xcf56('0x5a')]({'where':{'id':_0x3b130a[_0xcf56('0x57')]['id']}})['then'](handleEntityNotFound(_0x2bd155,null))['then'](function(_0x27994e){if(_0x27994e){_0x892954['model']=_[_0xcf56('0x37')](db[_0xcf56('0x5b')]['rawAttributes']);_0x892954[_0xcf56('0x38')]=_[_0xcf56('0x37')](_0x3b130a[_0xcf56('0x38')]);_0x892954[_0xcf56('0x42')]=_['intersection'](_0x892954[_0xcf56('0x3a')],_0x892954[_0xcf56('0x38')]);_0x29b911[_0xcf56('0x3b')]=_['intersection'](_0x892954[_0xcf56('0x3a')],qs[_0xcf56('0x3c')](_0x3b130a['query'][_0xcf56('0x3c')]));_0x29b911[_0xcf56('0x3b')]=_0x29b911[_0xcf56('0x3b')]['length']?_0x29b911['attributes']:_0x892954[_0xcf56('0x3a')];if(!_0x3b130a['query'][_0xcf56('0x3e')](_0xcf56('0x3f'))){_0x29b911[_0xcf56('0x25')]=qs[_0xcf56('0x25')](_0x3b130a[_0xcf56('0x38')][_0xcf56('0x25')]);_0x29b911[_0xcf56('0x23')]=qs[_0xcf56('0x23')](_0x3b130a[_0xcf56('0x38')][_0xcf56('0x23')]);}_0x29b911[_0xcf56('0x5c')]=qs['sort'](_0x3b130a[_0xcf56('0x38')][_0xcf56('0x40')]);_0x29b911[_0xcf56('0x41')]=qs[_0xcf56('0x42')](_[_0xcf56('0x43')](_0x3b130a[_0xcf56('0x38')],_0x892954[_0xcf56('0x42')]));_0x29b911['where'][_0xcf56('0x5d')]=_0x27994e['id'];if(_0x3b130a[_0xcf56('0x38')][_0xcf56('0x44')]){_0x29b911['where']=_[_0xcf56('0x45')](_0x29b911[_0xcf56('0x41')],{'$or':_[_0xcf56('0x33')](_0x29b911[_0xcf56('0x3b')],function(_0x24f03){var _0x31af06={};_0x31af06[_0x24f03]={'$like':'%'+_0x3b130a['query']['filter']+'%'};return _0x31af06;})});}_0x29b911=_['merge']({},_0x29b911,_0x3b130a[_0xcf56('0x5e')]);return db['Disposition'][_0xcf56('0x26')]({'where':_0x29b911[_0xcf56('0x41')]})['then'](function(_0x3ee81b){_0x1fd85a[_0xcf56('0x26')]=_0x3ee81b;if(_0x3b130a[_0xcf56('0x38')][_0xcf56('0x47')]){_0x29b911[_0xcf56('0x48')]=[{'all':!![]}];}return db['Disposition'][_0xcf56('0x49')](_0x29b911);})['then'](function(_0x133135){_0x1fd85a[_0xcf56('0x4a')]=_0x133135;return _0x1fd85a;});}})[_0xcf56('0x2c')](respondWithFilteredResult(_0x2bd155,_0x29b911))[_0xcf56('0x55')](handleError(_0x2bd155,null));};exports[_0xcf56('0x5f')]=function(_0x57ca82,_0x501ef2,_0x584ac1){return db[_0xcf56('0x46')]['find']({'where':{'id':_0x57ca82[_0xcf56('0x57')]['id']}})[_0xcf56('0x2c')](handleEntityNotFound(_0x501ef2,null))['then'](function(_0x57e3ac){if(_0x57e3ac){return _0x57e3ac[_0xcf56('0x5f')](_0x57ca82[_0xcf56('0x38')][_0xcf56('0x60')]);}})[_0xcf56('0x2c')](respondWithStatusCode(_0x501ef2,null))[_0xcf56('0x55')](handleError(_0x501ef2,null));};exports[_0xcf56('0x61')]=function(_0x139344,_0x4ae4ad,_0x5dc37d){return db[_0xcf56('0x46')][_0xcf56('0x4c')]({'where':{'id':_0x139344[_0xcf56('0x57')]['id']}})[_0xcf56('0x2c')](handleEntityNotFound(_0x4ae4ad,null))['then'](function(_0x240b85){if(_0x240b85){var _0x3f70dc=[];var _0x20f2bc={'success':[],'errors':[]};return db[_0xcf56('0x62')][_0xcf56('0x63')]()[_0xcf56('0x2c')](function(_0x43fa14){if(_0x139344[_0xcf56('0x4e')][_0xcf56('0x64')]&&_[_0xcf56('0x65')](_0x139344[_0xcf56('0x4e')][_0xcf56('0x64')])){if(_0x139344[_0xcf56('0x4e')][_0xcf56('0x64')][_0xcf56('0x3d')]){_0x139344[_0xcf56('0x4e')]['tags']=_0x139344['body'][_0xcf56('0x64')][_0xcf56('0x66')](';')+';';}else{_0x139344['body'][_0xcf56('0x64')]=null;}}else{_0x139344[_0xcf56('0x4e')]['tags']=null;}if(_0x139344[_0xcf56('0x4e')]&&_[_0xcf56('0x65')](_0x139344[_0xcf56('0x4e')])){for(var _0x553418=0x0;_0x553418<_0x139344[_0xcf56('0x4e')][_0xcf56('0x3d')];_0x553418+=0x1){_0x139344[_0xcf56('0x4e')][_0x553418][_0xcf56('0x5d')]=_0x139344[_0xcf56('0x57')]['id'];_0x3f70dc[_0xcf56('0x67')](_0x139344[_0xcf56('0x4e')][_0x553418]);}return BPromise[_0xcf56('0x68')](_0x3f70dc,function(_0x549f53){return db['CmContact'][_0xcf56('0x4d')](_[_0xcf56('0x69')](_0x549f53,[_0xcf56('0x60'),'id'])||{},{'fields':_[_0xcf56('0x37')](_0x43fa14),'raw':!![]})['then'](function(_0x53addf){_0x20f2bc[_0xcf56('0x6a')][_0xcf56('0x67')](_0x53addf['dataValues']);})[_0xcf56('0x55')](function(_0x43050d){_0x20f2bc[_0xcf56('0x6b')][_0xcf56('0x67')]({'data':_0x549f53,'error':_0x43050d[_0xcf56('0x6c')]});});})['then'](function(_0x4c45a8){return _0x20f2bc;})[_0xcf56('0x55')](function(_0x5c7d58){return _0x5c7d58;});}else{_0x4ae4ad[_0xcf56('0x20')](0x190)[_0xcf56('0x22')]({'message':_0xcf56('0x6d')});}});}})['then'](respondWithResult(_0x4ae4ad,null))[_0xcf56('0x55')](handleError(_0x4ae4ad,null));};exports['getContacts']=function(_0x1383d5,_0x530980,_0x5cf23f){var _0x5d7306;return db[_0xcf56('0x46')][_0xcf56('0x4c')]({'where':{'id':_0x1383d5[_0xcf56('0x57')]['id']},'include':[{'model':db[_0xcf56('0x6e')],'as':'CustomFields'}]})[_0xcf56('0x2c')](handleEntityNotFound(_0x530980,null))['then'](function(_0x572680){if(_0x572680){_0x5d7306=_0x572680;return db[_0xcf56('0x62')][_0xcf56('0x34')];}})[_0xcf56('0x2c')](function(_0x5f2f19){if(_0x5f2f19){var _0x4f8b73={};var _0x45050c={};_0x45050c['model']=_[_0xcf56('0x6f')](_[_0xcf56('0x37')](_0x5f2f19),_[_0xcf56('0x33')](_0x5d7306[_0xcf56('0x70')],function(_0x931c4e){return util[_0xcf56('0x71')](_0xcf56('0x72'),_0x931c4e['id']);}));_0x45050c[_0xcf56('0x38')]=_[_0xcf56('0x37')](_0x1383d5[_0xcf56('0x38')]);_0x45050c[_0xcf56('0x42')]=_['intersection'](_0x45050c[_0xcf56('0x3a')],_0x45050c[_0xcf56('0x38')]);_0x4f8b73['attributes']=_['intersection'](_0x45050c[_0xcf56('0x3a')],qs['fields'](_0x1383d5[_0xcf56('0x38')][_0xcf56('0x3c')]));_0x4f8b73[_0xcf56('0x3b')]=_0x4f8b73[_0xcf56('0x3b')][_0xcf56('0x3d')]?_0x4f8b73[_0xcf56('0x3b')]:_0x45050c[_0xcf56('0x3a')];if(!_0x1383d5['query']['hasOwnProperty'](_0xcf56('0x3f'))){_0x4f8b73[_0xcf56('0x25')]=qs[_0xcf56('0x25')](_0x1383d5['query'][_0xcf56('0x25')]);_0x4f8b73[_0xcf56('0x23')]=qs[_0xcf56('0x23')](_0x1383d5[_0xcf56('0x38')][_0xcf56('0x23')]);}_0x4f8b73['order']=qs[_0xcf56('0x40')](_0x1383d5[_0xcf56('0x38')][_0xcf56('0x40')]);_0x4f8b73[_0xcf56('0x41')]=qs[_0xcf56('0x42')](_[_0xcf56('0x43')](_0x1383d5[_0xcf56('0x38')],_0x45050c[_0xcf56('0x42')]));_0x4f8b73[_0xcf56('0x73')]=!![];if(_0x1383d5[_0xcf56('0x38')][_0xcf56('0x44')]){_0x4f8b73[_0xcf56('0x41')]=_[_0xcf56('0x45')](_0x4f8b73['where'],{'$or':_['map'](_0x4f8b73[_0xcf56('0x3b')],function(_0x3cf183){var _0x42c2a1={};_0x42c2a1[_0x3cf183]={'$like':'%'+_0x1383d5['query'][_0xcf56('0x44')]+'%'};return _0x42c2a1;})});}_0x4f8b73=_[_0xcf56('0x45')]({},_0x4f8b73,_0x1383d5[_0xcf56('0x5e')]);return _0x5d7306[_0xcf56('0x74')](_0x4f8b73);}})['then'](respondWithResult(_0x530980,null))[_0xcf56('0x55')](handleError(_0x530980,null));};exports[_0xcf56('0x75')]=function(_0x4406a6,_0x3c9dc7,_0x160a0f){var _0x55deca;var _0x889846;var _0x18dab3;var _0x13e801=_0x4406a6['params']['id'];csv_results=[];return db[_0xcf56('0x76')][_0xcf56('0x49')]({'attributes':['id','name'],'raw':!![],'order':[_0xcf56('0x77')]})['then'](function(_0x59971c){_0x55deca=_0x59971c;var _0x20e4e2=_[_0xcf56('0x37')](db['CmContact'][_0xcf56('0x34')]);return db['CmCustomField'][_0xcf56('0x49')]({'raw':!![],'attributes':['id',_0xcf56('0x78')]})[_0xcf56('0x2c')](function(_0x2be176){_0x889846=_0x2be176;var _0x52e8ce=squel['select']()[_0xcf56('0x3c')](_0x20e4e2)[_0xcf56('0x79')]('cm_contacts','c')[_0xcf56('0x41')](_0xcf56('0x7a'),_0x13e801)['where']('c.deletedAt\x20is\x20null')[_0xcf56('0x7b')]();for(var _0x4a545c=0x0;_0x4a545c<_0x889846[_0xcf56('0x3d')];_0x4a545c++){_0x52e8ce[_0xcf56('0x7c')](_0xcf56('0x7d')+_0x889846[_0x4a545c]['id'],_0xcf56('0x7e')+_0x889846[_0x4a545c][_0xcf56('0x78')]);}for(var _0x4a545c=0x0;_0x4a545c<_0x55deca[_0xcf56('0x3d')];_0x4a545c++){_0x52e8ce[_0xcf56('0x7c')](squel[_0xcf56('0x7f')]()[_0xcf56('0x7c')]('item')[_0xcf56('0x79')](_0xcf56('0x80'))[_0xcf56('0x41')](_0xcf56('0x81'),_0x55deca[_0x4a545c]['id'])[_0xcf56('0x41')](_0xcf56('0x82')),'additionalPhone_'+_0x55deca[_0x4a545c]['name']);_0x52e8ce[_0xcf56('0x7c')](squel[_0xcf56('0x7f')]()[_0xcf56('0x7c')](_0xcf56('0x83'))[_0xcf56('0x79')](_0xcf56('0x80'))[_0xcf56('0x41')](_0xcf56('0x81'),_0x55deca[_0x4a545c]['id'])[_0xcf56('0x41')](_0xcf56('0x82')),'description_additionalPhone_'+_0x55deca[_0x4a545c][_0xcf56('0x36')]);}var _0x1d999e=[];_0x1d999e[_0xcf56('0x67')](_0x52e8ce[_0xcf56('0x84')]());BPromise[_0xcf56('0x68')](_0x1d999e,handleQuery)['then'](function(_0x2d38c2){handleQuery(_0x52e8ce['toString']());var _0x19af8f=csv_results[0x0];if(!_[_0xcf56('0x85')](_0x19af8f)){var _0x428b1f=toCsv(_0x19af8f);var _0x250e9d=Date[_0xcf56('0x86')]();fs['writeFileSync'](util['format']('/tmp/list_%d_%s.csv',_0x13e801,_0x250e9d),_0x428b1f);_0x3c9dc7[_0xcf56('0x87')](_0xcf56('0x88'),'attachment;\x20filename='+util[_0xcf56('0x71')]('list_%d_%s.csv',_0x13e801,_0x250e9d));_0x3c9dc7[_0xcf56('0x87')](_0xcf56('0x89'),_0xcf56('0x8a'));return _0x3c9dc7[_0xcf56('0x8b')](util[_0xcf56('0x71')]('/tmp/list_%d_%s.csv',_0x13e801,_0x250e9d));}else{return _0x3c9dc7[_0xcf56('0x1f')](0xcc);}});});});};exports[_0xcf56('0x8c')]=function(_0x45509b,_0x53b6c6,_0xc34bcb){var _0xc199dd;delete _0x45509b[_0xcf56('0x4e')]['id'];return db[_0xcf56('0x46')][_0xcf56('0x5a')]({'where':{'id':_0x45509b[_0xcf56('0x57')]['id']}})[_0xcf56('0x2c')](handleEntityNotFound(_0x53b6c6,null))[_0xcf56('0x2c')](function(_0x306122){if(_0x306122){return db[_0xcf56('0x8d')][_0xcf56('0x8e')](function(_0x5d7067){return db['CmCustomField']['create'](_0x45509b[_0xcf56('0x4e')],{'transaction':_0x5d7067})[_0xcf56('0x2c')](function(_0x52d06a){_0xc199dd=_0x52d06a;return _0x306122[_0xcf56('0x8f')](_0x52d06a,{'transaction':_0x5d7067});})['then'](function(){var _0x312bf1={'type':db[_0xcf56('0x90')]['TEXT'],'transaction':_0x5d7067};switch(_0x45509b[_0xcf56('0x4e')][_0xcf56('0x35')]){case _0xcf56('0x91'):_0x312bf1[_0xcf56('0x35')]=db[_0xcf56('0x90')][_0xcf56('0x92')];break;case'number':_0x312bf1[_0xcf56('0x35')]=db[_0xcf56('0x90')][_0xcf56('0x93')];break;case _0xcf56('0x94'):_0x312bf1['type']=db[_0xcf56('0x90')][_0xcf56('0x95')];_0x312bf1['defaultValue']=![];break;default:}return db['sequelize'][_0xcf56('0x96')]['addColumn'](_0xcf56('0x97'),util[_0xcf56('0x71')]('cf_%s',_0xc199dd['id']),_0x312bf1);})['then'](function(){return _0xc199dd;});});}})[_0xcf56('0x2c')](respondWithResult(_0x53b6c6,null))[_0xcf56('0x55')](handleError(_0x53b6c6,null));};exports[_0xcf56('0x98')]=function(_0x2ea4ea,_0xe5ced9,_0x1822d8){var _0x4f0e10={};var _0x595569={};var _0x137484;var _0x3b23f4;return db[_0xcf56('0x46')][_0xcf56('0x5a')]({'where':{'id':_0x2ea4ea['params']['id']}})[_0xcf56('0x2c')](handleEntityNotFound(_0xe5ced9,null))[_0xcf56('0x2c')](function(_0x49c1d6){if(_0x49c1d6){_0x137484=_0x49c1d6;_0x595569[_0xcf56('0x3a')]=_['keys'](db[_0xcf56('0x6e')][_0xcf56('0x34')]);_0x595569[_0xcf56('0x38')]=_[_0xcf56('0x37')](_0x2ea4ea[_0xcf56('0x38')]);_0x595569[_0xcf56('0x42')]=_[_0xcf56('0x39')](_0x595569[_0xcf56('0x3a')],_0x595569['query']);_0x4f0e10[_0xcf56('0x3b')]=_['intersection'](_0x595569[_0xcf56('0x3a')],qs[_0xcf56('0x3c')](_0x2ea4ea[_0xcf56('0x38')][_0xcf56('0x3c')]));_0x4f0e10[_0xcf56('0x3b')]=_0x4f0e10[_0xcf56('0x3b')]['length']?_0x4f0e10[_0xcf56('0x3b')]:_0x595569[_0xcf56('0x3a')];_0x4f0e10[_0xcf56('0x5c')]=qs[_0xcf56('0x40')](_0x2ea4ea['query'][_0xcf56('0x40')]);_0x4f0e10[_0xcf56('0x41')]=qs[_0xcf56('0x42')](_[_0xcf56('0x43')](_0x2ea4ea[_0xcf56('0x38')],_0x595569[_0xcf56('0x42')]));_0x4f0e10['where']=_[_0xcf56('0x45')](_0x4f0e10[_0xcf56('0x41')],{'$or':[{'ListId':_0x49c1d6['id']},{'ListId':null}]});if(_0x2ea4ea['query']['filter']){_0x4f0e10['where']=_[_0xcf56('0x45')](_0x4f0e10[_0xcf56('0x41')],{'$or':_[_0xcf56('0x33')](_0x4f0e10[_0xcf56('0x3b')],function(_0x32b26e){var _0x303ad6={};_0x303ad6[_0x32b26e]={'$like':'%'+_0x2ea4ea[_0xcf56('0x38')]['filter']+'%'};return _0x303ad6;})});}_0x4f0e10=_['merge']({},_0x4f0e10,_0x2ea4ea['options']);return db[_0xcf56('0x6e')][_0xcf56('0x99')](_0x4f0e10);}})[_0xcf56('0x2c')](respondWithResult(_0xe5ced9,null))[_0xcf56('0x55')](handleError(_0xe5ced9,null));};exports[_0xcf56('0x9a')]=function(_0x48dffe,_0x518900){return db[_0xcf56('0x6e')][_0xcf56('0x99')]({'where':{'ListId':null}})['then'](handleEntityNotFound(_0x518900,null))[_0xcf56('0x2c')](function(_0x29f47f){return _0x29f47f;})[_0xcf56('0x2c')](respondWithResult(_0x518900,null))[_0xcf56('0x55')](handleError(_0x518900,null));};exports[_0xcf56('0x9b')]=function(_0x254734,_0x490fa4,_0x2124ff){return db[_0xcf56('0x46')][_0xcf56('0x4c')]({'where':{'id':_0x254734[_0xcf56('0x57')]['id']}})['then'](handleEntityNotFound(_0x490fa4,null))[_0xcf56('0x2c')](function(_0x50df2a){if(_0x50df2a){return _0x50df2a[_0xcf56('0x9b')](_0x254734[_0xcf56('0x4e')][_0xcf56('0x60')],_[_0xcf56('0x69')](_0x254734[_0xcf56('0x4e')],[_0xcf56('0x60'),'id'])||{})[_0xcf56('0x9c')](function(_0x56220c){for(var _0x671c0e=0x0;_0x671c0e<_0x254734[_0xcf56('0x4e')]['ids'][_0xcf56('0x3d')];_0x671c0e+=0x1){socket[_0xcf56('0x9d')](_0xcf56('0x9e'),{'UserId':Number(_0x254734[_0xcf56('0x4e')][_0xcf56('0x60')][_0x671c0e]),'CmListId':Number(_0x254734[_0xcf56('0x57')]['id'])});}return _0x56220c;});}})[_0xcf56('0x2c')](respondWithResult(_0x490fa4,null))[_0xcf56('0x55')](handleError(_0x490fa4,null));};exports[_0xcf56('0x9f')]=function(_0x338b66,_0x419f3b,_0x1ed9b8){return db['CmList'][_0xcf56('0x4c')]({'where':{'id':_0x338b66[_0xcf56('0x57')]['id']}})['then'](handleEntityNotFound(_0x419f3b,null))[_0xcf56('0x2c')](function(_0x1abf6b){if(_0x1abf6b){return _0x1abf6b[_0xcf56('0x9f')](_0x338b66['query']['ids'])[_0xcf56('0x2c')](function(){if(_[_0xcf56('0x65')](_0x338b66['query']['ids'])){for(var _0xcef206=0x0;_0xcef206<_0x338b66[_0xcf56('0x38')][_0xcf56('0x60')][_0xcf56('0x3d')];_0xcef206+=0x1){socket[_0xcf56('0x9d')](_0xcf56('0xa0'),{'UserId':Number(_0x338b66[_0xcf56('0x38')]['ids'][_0xcef206]),'CmListId':Number(_0x338b66[_0xcf56('0x57')]['id'])});}}else{socket[_0xcf56('0x9d')](_0xcf56('0xa0'),{'UserId':Number(_0x338b66[_0xcf56('0x38')]['ids']),'CmListId':Number(_0x338b66[_0xcf56('0x57')]['id'])});}});}})[_0xcf56('0x2c')](respondWithStatusCode(_0x419f3b,null))[_0xcf56('0x55')](handleError(_0x419f3b,null));};exports[_0xcf56('0xa1')]=function(_0x70a107,_0x4c4341,_0xb5e515){var _0x33b356={};var _0x4d6d22={};var _0x5009fb;var _0x33c903;return db[_0xcf56('0x46')][_0xcf56('0x5a')]({'where':{'id':_0x70a107['params']['id']}})[_0xcf56('0x2c')](handleEntityNotFound(_0x4c4341,null))[_0xcf56('0x2c')](function(_0x5e5201){if(_0x5e5201){_0x5009fb=_0x5e5201;_0x4d6d22['model']=_[_0xcf56('0x37')](db[_0xcf56('0xa2')][_0xcf56('0x34')]);_0x4d6d22[_0xcf56('0x38')]=_['keys'](_0x70a107['query']);_0x4d6d22['filters']=_['intersection'](_0x4d6d22[_0xcf56('0x3a')],_0x4d6d22['query']);_0x33b356[_0xcf56('0x3b')]=_[_0xcf56('0x39')](_0x4d6d22[_0xcf56('0x3a')],qs[_0xcf56('0x3c')](_0x70a107[_0xcf56('0x38')][_0xcf56('0x3c')]));_0x33b356[_0xcf56('0x3b')]=_0x33b356['attributes']['length']?_0x33b356[_0xcf56('0x3b')]:_0x4d6d22[_0xcf56('0x3a')];_0x33b356[_0xcf56('0x5c')]=qs[_0xcf56('0x40')](_0x70a107[_0xcf56('0x38')][_0xcf56('0x40')]);_0x33b356[_0xcf56('0x41')]=qs['filters'](_[_0xcf56('0x43')](_0x70a107['query'],_0x4d6d22['filters']));if(_0x70a107['query'][_0xcf56('0x44')]){_0x33b356['where']=_[_0xcf56('0x45')](_0x33b356[_0xcf56('0x41')],{'$or':_[_0xcf56('0x33')](_0x33b356['attributes'],function(_0x930129){var _0x48319a={};_0x48319a[_0x930129]={'$like':'%'+_0x70a107['query']['filter']+'%'};return _0x48319a;})});}_0x33b356=_['merge']({},_0x33b356,_0x70a107[_0xcf56('0x5e')]);return _0x5009fb[_0xcf56('0xa1')](_0x33b356);}})['then'](function(_0xf07e47){if(_0xf07e47){_0x33c903=_0xf07e47['length'];if(!_0x70a107[_0xcf56('0x38')]['hasOwnProperty'](_0xcf56('0x3f'))){_0x33b356['limit']=qs['limit'](_0x70a107[_0xcf56('0x38')][_0xcf56('0x25')]);_0x33b356[_0xcf56('0x23')]=qs[_0xcf56('0x23')](_0x70a107[_0xcf56('0x38')]['offset']);}return _0x5009fb[_0xcf56('0xa1')](_0x33b356);}})['then'](function(_0x560fba){if(_0x560fba){return _0x560fba?{'count':_0x33c903,'rows':_0x560fba}:null;}})[_0xcf56('0x2c')](respondWithResult(_0x4c4341,null))['catch'](handleError(_0x4c4341,null));};function handleQuery(_0x25a7d9){logger[_0xcf56('0xa3')](_0x25a7d9);return db[_0xcf56('0x8d')][_0xcf56('0x38')](_0x25a7d9)['spread'](function(_0x5bca79){csv_results[_0xcf56('0x67')](_0x5bca79);})[_0xcf56('0x55')](function(_0x47a66e){logger[_0xcf56('0x2f')](_0x47a66e[_0xcf56('0x6c')]);});} \ No newline at end of file +var _0xaa04=['removeAgents','userCmList:remove','getAgents','User','nolimit','info','eml-format','fast-json-patch','request-promise','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./cmList.socket','register','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','Lists','UserProfileResource','sendStatus','error','name','send','index','map','CmList','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','sort','where','pick','filter','merge','options','includeAll','findAll','catch','params','include','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','ListId','Disposition','findOne','rows','ids','CmContact','tags','isArray','join','push','each','omit','success','dataValues','errors','message','Malformed\x20request\x20syntax','getContacts','CmCustomField','CustomFields','concat','format','order','OrderBy','alias','select','from','c.ListId\x20=\x20?','c.deletedAt\x20is\x20null','distinct','field','c.cf_','customField_','item','cm_contact_has_items','additionalPhone_','description','ItemTypeId\x20=\x20?','description_additionalPhone_','toString','isEmpty','now','writeFileSync','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','setHeader','Content-type','text/csv','download','addCustomField','sequelize','transaction','Sequelize','TEXT','text','number','switch','queryInterface','addColumn','cm_contacts','getCustomFields','getGlobalCustomFields','addAgents','spread','emit','userCmList:save'];(function(_0x5b82e9,_0x382fe1){var _0x204239=function(_0x477bd3){while(--_0x477bd3){_0x5b82e9['push'](_0x5b82e9['shift']());}};_0x204239(++_0x382fe1);}(_0xaa04,0xa7));var _0x4aa0=function(_0x1721ab,_0x3e48c3){_0x1721ab=_0x1721ab-0x0;var _0x326fc9=_0xaa04[_0x1721ab];return _0x326fc9;};'use strict';var emlformat=require(_0x4aa0('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x4aa0('0x1'));var rp=require(_0x4aa0('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x4aa0('0x3'));var util=require(_0x4aa0('0x4'));var path=require(_0x4aa0('0x5'));var sox=require('sox');var csv=require(_0x4aa0('0x6'));var ejs=require(_0x4aa0('0x7'));var fs=require('fs');var fs_extra=require(_0x4aa0('0x8'));var _=require(_0x4aa0('0x9'));var squel=require(_0x4aa0('0xa'));var crypto=require(_0x4aa0('0xb'));var jsforce=require(_0x4aa0('0xc'));var deskjs=require(_0x4aa0('0xd'));var toCsv=require(_0x4aa0('0x6'));var querystring=require(_0x4aa0('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x4aa0('0xf'));var qs=require(_0x4aa0('0x10'));var as=require(_0x4aa0('0x11'));var hardwareService=require(_0x4aa0('0x12'));var logger=require(_0x4aa0('0x13'))(_0x4aa0('0x14'));var utils=require(_0x4aa0('0x15'));var config=require(_0x4aa0('0x16'));var licenseUtil=require(_0x4aa0('0x17'));var db=require(_0x4aa0('0x18'))['db'];var csv_results;config[_0x4aa0('0x19')]=_[_0x4aa0('0x1a')](config[_0x4aa0('0x19')],{'host':_0x4aa0('0x1b'),'port':0x18eb});var socket=require(_0x4aa0('0x1c'))(new Redis(config[_0x4aa0('0x19')]));require(_0x4aa0('0x1d'))[_0x4aa0('0x1e')](socket);function respondWithStatusCode(_0x54a0b4,_0x16ce36){_0x16ce36=_0x16ce36||0xcc;return function(_0x2e6983){if(_0x2e6983){return _0x54a0b4['sendStatus'](_0x16ce36);}return _0x54a0b4[_0x4aa0('0x1f')](_0x16ce36)[_0x4aa0('0x20')]();};}function respondWithResult(_0x169092,_0x3e27db){_0x3e27db=_0x3e27db||0xc8;return function(_0x1cd09c){if(_0x1cd09c){return _0x169092[_0x4aa0('0x1f')](_0x3e27db)['json'](_0x1cd09c);}};}function respondWithFilteredResult(_0x3fc2ac,_0x4dbd67){return function(_0x1ada92){if(_0x1ada92){var _0x3d6b35=typeof _0x4dbd67[_0x4aa0('0x21')]===_0x4aa0('0x22')&&typeof _0x4dbd67[_0x4aa0('0x23')]===_0x4aa0('0x22');var _0x1b933f=_0x1ada92[_0x4aa0('0x24')];var _0x2df0b4=_0x3d6b35?0x0:_0x4dbd67[_0x4aa0('0x21')];var _0x533bd9=_0x3d6b35?_0x1ada92[_0x4aa0('0x24')]:_0x4dbd67[_0x4aa0('0x21')]+_0x4dbd67[_0x4aa0('0x23')];var _0x392d79;if(_0x533bd9>=_0x1b933f){_0x533bd9=_0x1b933f;_0x392d79=0xc8;}else{_0x392d79=0xce;}_0x3fc2ac[_0x4aa0('0x1f')](_0x392d79);return _0x3fc2ac[_0x4aa0('0x25')](_0x4aa0('0x26'),_0x2df0b4+'-'+_0x533bd9+'/'+_0x1b933f)[_0x4aa0('0x27')](_0x1ada92);}return null;};}function patchUpdates(_0x5105ed){return function(_0x404b2b){try{jsonpatch[_0x4aa0('0x28')](_0x404b2b,_0x5105ed,!![]);}catch(_0x20e712){return BPromise[_0x4aa0('0x29')](_0x20e712);}return _0x404b2b[_0x4aa0('0x2a')]();};}function saveUpdates(_0x48dde2,_0x5f37c2){return function(_0x70da42){if(_0x70da42){return _0x70da42[_0x4aa0('0x2b')](_0x48dde2)[_0x4aa0('0x2c')](function(_0x39d1f7){return _0x39d1f7;});}return null;};}function removeEntity(_0x48c47f,_0xc3e655){return function(_0x30fbf7){if(_0x30fbf7){return _0x30fbf7[_0x4aa0('0x2d')]()[_0x4aa0('0x2c')](function(){var _0x2eef08=_0x30fbf7['get']({'plain':!![]});var _0x2cbf79=_0x4aa0('0x2e');return db[_0x4aa0('0x2f')][_0x4aa0('0x2d')]({'where':{'type':_0x2cbf79,'resourceId':_0x2eef08['id']}})[_0x4aa0('0x2c')](function(){return _0x30fbf7;});})['then'](function(){_0x48c47f[_0x4aa0('0x1f')](0xcc)[_0x4aa0('0x20')]();});}};}function handleEntityNotFound(_0x471505,_0x1e09d5){return function(_0x14586a){if(!_0x14586a){_0x471505[_0x4aa0('0x30')](0x194);}return _0x14586a;};}function handleError(_0x50de2c,_0xfb141c){_0xfb141c=_0xfb141c||0x1f4;return function(_0x4dc21e){logger[_0x4aa0('0x31')](_0x4dc21e['stack']);if(_0x4dc21e[_0x4aa0('0x32')]){delete _0x4dc21e[_0x4aa0('0x32')];}_0x50de2c[_0x4aa0('0x1f')](_0xfb141c)[_0x4aa0('0x33')](_0x4dc21e);};}exports[_0x4aa0('0x34')]=function(_0x1e19e8,_0x50245a){var _0x2cfbc4={},_0x404b90={},_0xf212b4={'count':0x0,'rows':[]};var _0x5591ea=_[_0x4aa0('0x35')](db[_0x4aa0('0x36')][_0x4aa0('0x37')],function(_0x537100){return{'name':_0x537100[_0x4aa0('0x38')],'type':_0x537100[_0x4aa0('0x39')][_0x4aa0('0x3a')]};});_0x404b90[_0x4aa0('0x3b')]=_[_0x4aa0('0x35')](_0x5591ea,_0x4aa0('0x32'));_0x404b90[_0x4aa0('0x3c')]=_[_0x4aa0('0x3d')](_0x1e19e8[_0x4aa0('0x3c')]);_0x404b90[_0x4aa0('0x3e')]=_[_0x4aa0('0x3f')](_0x404b90[_0x4aa0('0x3b')],_0x404b90[_0x4aa0('0x3c')]);_0x2cfbc4['attributes']=_[_0x4aa0('0x3f')](_0x404b90['model'],qs['fields'](_0x1e19e8[_0x4aa0('0x3c')][_0x4aa0('0x40')]));_0x2cfbc4[_0x4aa0('0x41')]=_0x2cfbc4[_0x4aa0('0x41')][_0x4aa0('0x42')]?_0x2cfbc4[_0x4aa0('0x41')]:_0x404b90['model'];if(!_0x1e19e8[_0x4aa0('0x3c')][_0x4aa0('0x43')]('nolimit')){_0x2cfbc4[_0x4aa0('0x23')]=qs['limit'](_0x1e19e8['query'][_0x4aa0('0x23')]);_0x2cfbc4[_0x4aa0('0x21')]=qs['offset'](_0x1e19e8[_0x4aa0('0x3c')][_0x4aa0('0x21')]);}_0x2cfbc4['order']=qs[_0x4aa0('0x44')](_0x1e19e8[_0x4aa0('0x3c')][_0x4aa0('0x44')]);_0x2cfbc4[_0x4aa0('0x45')]=qs['filters'](_[_0x4aa0('0x46')](_0x1e19e8['query'],_0x404b90['filters']),_0x5591ea);if(_0x1e19e8[_0x4aa0('0x3c')][_0x4aa0('0x47')]){_0x2cfbc4[_0x4aa0('0x45')]=_[_0x4aa0('0x48')](_0x2cfbc4[_0x4aa0('0x45')],{'$or':_[_0x4aa0('0x35')](_0x5591ea,function(_0x3db956){if(_0x3db956[_0x4aa0('0x39')]!=='VIRTUAL'){var _0x28effb={};_0x28effb[_0x3db956['name']]={'$like':'%'+_0x1e19e8[_0x4aa0('0x3c')][_0x4aa0('0x47')]+'%'};return _0x28effb;}})});}_0x2cfbc4=_[_0x4aa0('0x48')]({},_0x2cfbc4,_0x1e19e8[_0x4aa0('0x49')]);var _0x45c885={'where':_0x2cfbc4[_0x4aa0('0x45')]};return db[_0x4aa0('0x36')][_0x4aa0('0x24')](_0x45c885)[_0x4aa0('0x2c')](function(_0x2f3ad5){_0xf212b4[_0x4aa0('0x24')]=_0x2f3ad5;if(_0x1e19e8[_0x4aa0('0x3c')][_0x4aa0('0x4a')]){_0x2cfbc4['include']=[{'all':!![]}];}return db[_0x4aa0('0x36')][_0x4aa0('0x4b')](_0x2cfbc4);})[_0x4aa0('0x2c')](function(_0x592017){_0xf212b4['rows']=_0x592017;return _0xf212b4;})['then'](respondWithFilteredResult(_0x50245a,_0x2cfbc4))[_0x4aa0('0x4c')](handleError(_0x50245a,null));};exports['show']=function(_0x54fa9d,_0x2b951a){var _0x55952b={'raw':![],'where':{'id':_0x54fa9d[_0x4aa0('0x4d')]['id']}},_0x1ec8e8={};_0x1ec8e8[_0x4aa0('0x3b')]=_[_0x4aa0('0x3d')](db['CmList'][_0x4aa0('0x37')]);_0x1ec8e8['query']=_['keys'](_0x54fa9d[_0x4aa0('0x3c')]);_0x1ec8e8[_0x4aa0('0x3e')]=_['intersection'](_0x1ec8e8['model'],_0x1ec8e8[_0x4aa0('0x3c')]);_0x55952b[_0x4aa0('0x41')]=_['intersection'](_0x1ec8e8[_0x4aa0('0x3b')],qs[_0x4aa0('0x40')](_0x54fa9d[_0x4aa0('0x3c')]['fields']));_0x55952b[_0x4aa0('0x41')]=_0x55952b[_0x4aa0('0x41')][_0x4aa0('0x42')]?_0x55952b[_0x4aa0('0x41')]:_0x1ec8e8['model'];if(_0x54fa9d['query']['includeAll']){_0x55952b[_0x4aa0('0x4e')]=[{'all':!![]}];}_0x55952b=_[_0x4aa0('0x48')]({},_0x55952b,_0x54fa9d[_0x4aa0('0x49')]);return db[_0x4aa0('0x36')][_0x4aa0('0x4f')](_0x55952b)[_0x4aa0('0x2c')](handleEntityNotFound(_0x2b951a,null))[_0x4aa0('0x2c')](respondWithResult(_0x2b951a,null))['catch'](handleError(_0x2b951a,null));};exports[_0x4aa0('0x50')]=function(_0x4397c5,_0x4956a4){return db[_0x4aa0('0x36')][_0x4aa0('0x50')](_0x4397c5[_0x4aa0('0x51')],{})['then'](function(_0x570f0b){var _0xbb9b31=_0x4397c5[_0x4aa0('0x52')][_0x4aa0('0x53')]({'plain':!![]});if(!_0xbb9b31)throw new Error(_0x4aa0('0x54'));if(_0xbb9b31[_0x4aa0('0x55')]==='user'){var _0x38cdc3=_0x570f0b[_0x4aa0('0x53')]({'plain':!![]});var _0x3f95ed=_0x4aa0('0x2e');return db['UserProfileSection'][_0x4aa0('0x4f')]({'where':{'name':_0x3f95ed,'userProfileId':_0xbb9b31['userProfileId']},'raw':!![]})[_0x4aa0('0x2c')](function(_0x281cc3){if(_0x281cc3&&_0x281cc3['autoAssociation']===0x0){return db[_0x4aa0('0x2f')][_0x4aa0('0x50')]({'name':_0x38cdc3[_0x4aa0('0x32')],'resourceId':_0x38cdc3['id'],'type':_0x281cc3[_0x4aa0('0x32')],'sectionId':_0x281cc3['id']},{})[_0x4aa0('0x2c')](function(){return _0x570f0b;});}else{return _0x570f0b;}})[_0x4aa0('0x4c')](function(_0x221834){logger[_0x4aa0('0x31')](_0x4aa0('0x56'),_0x221834);throw _0x221834;});}return _0x570f0b;})[_0x4aa0('0x2c')](respondWithResult(_0x4956a4,0xc9))['catch'](handleError(_0x4956a4,null));};exports[_0x4aa0('0x2b')]=function(_0xb33224,_0xd143a0){if(_0xb33224[_0x4aa0('0x51')]['id']){delete _0xb33224[_0x4aa0('0x51')]['id'];}return db[_0x4aa0('0x36')][_0x4aa0('0x4f')]({'where':{'id':_0xb33224['params']['id']}})[_0x4aa0('0x2c')](handleEntityNotFound(_0xd143a0,null))[_0x4aa0('0x2c')](saveUpdates(_0xb33224[_0x4aa0('0x51')],null))[_0x4aa0('0x2c')](respondWithResult(_0xd143a0,null))['catch'](handleError(_0xd143a0,null));};exports[_0x4aa0('0x2d')]=function(_0x1bf9ff,_0x35c504){return db[_0x4aa0('0x36')][_0x4aa0('0x4f')]({'where':{'id':_0x1bf9ff[_0x4aa0('0x4d')]['id']}})[_0x4aa0('0x2c')](handleEntityNotFound(_0x35c504,null))['then'](removeEntity(_0x35c504,null))['catch'](handleError(_0x35c504,null));};exports[_0x4aa0('0x57')]=function(_0x5d6ca4,_0x2728d1){return db[_0x4aa0('0x36')][_0x4aa0('0x57')]()[_0x4aa0('0x2c')](respondWithResult(_0x2728d1,null))['catch'](handleError(_0x2728d1,null));};exports['addDisposition']=function(_0x28898e,_0x253e40,_0xb29c4a){if(_0x28898e[_0x4aa0('0x51')]['id']){delete _0x28898e[_0x4aa0('0x51')]['id'];}return db[_0x4aa0('0x36')][_0x4aa0('0x4f')]({'where':{'id':_0x28898e[_0x4aa0('0x4d')]['id']}})[_0x4aa0('0x2c')](handleEntityNotFound(_0x253e40,null))['then'](function(_0x368e90){if(_0x368e90){_0x28898e[_0x4aa0('0x51')][_0x4aa0('0x58')]=_0x368e90['id'];return db[_0x4aa0('0x59')][_0x4aa0('0x50')](_0x28898e[_0x4aa0('0x51')]);}})[_0x4aa0('0x2c')](respondWithResult(_0x253e40,null))['catch'](handleError(_0x253e40,null));};exports['getDispositions']=function(_0x3ca394,_0x387680,_0x5dffe3){var _0xa56123={'raw':![],'where':{}};var _0x20e9a3={};var _0x351015={'count':0x0,'rows':[]};return db[_0x4aa0('0x36')][_0x4aa0('0x5a')]({'where':{'id':_0x3ca394['params']['id']}})[_0x4aa0('0x2c')](handleEntityNotFound(_0x387680,null))[_0x4aa0('0x2c')](function(_0x18ab3f){if(_0x18ab3f){_0x20e9a3[_0x4aa0('0x3b')]=_[_0x4aa0('0x3d')](db[_0x4aa0('0x59')][_0x4aa0('0x37')]);_0x20e9a3[_0x4aa0('0x3c')]=_[_0x4aa0('0x3d')](_0x3ca394[_0x4aa0('0x3c')]);_0x20e9a3['filters']=_['intersection'](_0x20e9a3['model'],_0x20e9a3[_0x4aa0('0x3c')]);_0xa56123[_0x4aa0('0x41')]=_[_0x4aa0('0x3f')](_0x20e9a3['model'],qs[_0x4aa0('0x40')](_0x3ca394[_0x4aa0('0x3c')][_0x4aa0('0x40')]));_0xa56123[_0x4aa0('0x41')]=_0xa56123[_0x4aa0('0x41')][_0x4aa0('0x42')]?_0xa56123[_0x4aa0('0x41')]:_0x20e9a3['model'];if(!_0x3ca394[_0x4aa0('0x3c')][_0x4aa0('0x43')]('nolimit')){_0xa56123['limit']=qs[_0x4aa0('0x23')](_0x3ca394[_0x4aa0('0x3c')]['limit']);_0xa56123[_0x4aa0('0x21')]=qs[_0x4aa0('0x21')](_0x3ca394[_0x4aa0('0x3c')][_0x4aa0('0x21')]);}_0xa56123['order']=qs[_0x4aa0('0x44')](_0x3ca394[_0x4aa0('0x3c')]['sort']);_0xa56123[_0x4aa0('0x45')]=qs['filters'](_['pick'](_0x3ca394[_0x4aa0('0x3c')],_0x20e9a3[_0x4aa0('0x3e')]));_0xa56123[_0x4aa0('0x45')]['ListId']=_0x18ab3f['id'];if(_0x3ca394[_0x4aa0('0x3c')][_0x4aa0('0x47')]){_0xa56123['where']=_[_0x4aa0('0x48')](_0xa56123[_0x4aa0('0x45')],{'$or':_[_0x4aa0('0x35')](_0xa56123[_0x4aa0('0x41')],function(_0x1ecfbf){var _0x5784d9={};_0x5784d9[_0x1ecfbf]={'$like':'%'+_0x3ca394[_0x4aa0('0x3c')][_0x4aa0('0x47')]+'%'};return _0x5784d9;})});}_0xa56123=_['merge']({},_0xa56123,_0x3ca394[_0x4aa0('0x49')]);return db['Disposition'][_0x4aa0('0x24')]({'where':_0xa56123['where']})[_0x4aa0('0x2c')](function(_0x57cd73){_0x351015[_0x4aa0('0x24')]=_0x57cd73;if(_0x3ca394[_0x4aa0('0x3c')][_0x4aa0('0x4a')]){_0xa56123['include']=[{'all':!![]}];}return db[_0x4aa0('0x59')][_0x4aa0('0x4b')](_0xa56123);})[_0x4aa0('0x2c')](function(_0x4b9dd9){_0x351015[_0x4aa0('0x5b')]=_0x4b9dd9;return _0x351015;});}})['then'](respondWithFilteredResult(_0x387680,_0xa56123))[_0x4aa0('0x4c')](handleError(_0x387680,null));};exports['removeDispositions']=function(_0x2f9e74,_0x3d5bf2,_0x39c393){return db[_0x4aa0('0x36')][_0x4aa0('0x4f')]({'where':{'id':_0x2f9e74[_0x4aa0('0x4d')]['id']}})[_0x4aa0('0x2c')](handleEntityNotFound(_0x3d5bf2,null))[_0x4aa0('0x2c')](function(_0xb29ba3){if(_0xb29ba3){return _0xb29ba3['removeDispositions'](_0x2f9e74['query'][_0x4aa0('0x5c')]);}})[_0x4aa0('0x2c')](respondWithStatusCode(_0x3d5bf2,null))[_0x4aa0('0x4c')](handleError(_0x3d5bf2,null));};exports['addContacts']=function(_0x3aabac,_0x35f00f,_0x2acd5d){return db[_0x4aa0('0x36')][_0x4aa0('0x4f')]({'where':{'id':_0x3aabac[_0x4aa0('0x4d')]['id']}})[_0x4aa0('0x2c')](handleEntityNotFound(_0x35f00f,null))[_0x4aa0('0x2c')](function(_0x1ed9d0){if(_0x1ed9d0){var _0x590e57=[];var _0x55ff0e={'success':[],'errors':[]};return db[_0x4aa0('0x5d')][_0x4aa0('0x57')]()[_0x4aa0('0x2c')](function(_0x5d0c0d){if(_0x3aabac['body'][_0x4aa0('0x5e')]&&_[_0x4aa0('0x5f')](_0x3aabac['body'][_0x4aa0('0x5e')])){if(_0x3aabac[_0x4aa0('0x51')]['tags'][_0x4aa0('0x42')]){_0x3aabac['body']['tags']=_0x3aabac[_0x4aa0('0x51')]['tags'][_0x4aa0('0x60')](';')+';';}else{_0x3aabac[_0x4aa0('0x51')]['tags']=null;}}else{_0x3aabac[_0x4aa0('0x51')][_0x4aa0('0x5e')]=null;}if(_0x3aabac[_0x4aa0('0x51')]&&_['isArray'](_0x3aabac['body'])){for(var _0x587d7a=0x0;_0x587d7a<_0x3aabac['body']['length'];_0x587d7a+=0x1){_0x3aabac['body'][_0x587d7a]['ListId']=_0x3aabac[_0x4aa0('0x4d')]['id'];_0x590e57[_0x4aa0('0x61')](_0x3aabac[_0x4aa0('0x51')][_0x587d7a]);}return BPromise[_0x4aa0('0x62')](_0x590e57,function(_0x554d5c){return db[_0x4aa0('0x5d')][_0x4aa0('0x50')](_[_0x4aa0('0x63')](_0x554d5c,[_0x4aa0('0x5c'),'id'])||{},{'fields':_[_0x4aa0('0x3d')](_0x5d0c0d),'raw':!![]})[_0x4aa0('0x2c')](function(_0x3db9ed){_0x55ff0e[_0x4aa0('0x64')][_0x4aa0('0x61')](_0x3db9ed[_0x4aa0('0x65')]);})[_0x4aa0('0x4c')](function(_0x1b1b2c){_0x55ff0e[_0x4aa0('0x66')][_0x4aa0('0x61')]({'data':_0x554d5c,'error':_0x1b1b2c[_0x4aa0('0x67')]});});})[_0x4aa0('0x2c')](function(_0x28c7fe){return _0x55ff0e;})[_0x4aa0('0x4c')](function(_0x52f2e0){return _0x52f2e0;});}else{_0x35f00f['status'](0x190)[_0x4aa0('0x27')]({'message':_0x4aa0('0x68')});}});}})['then'](respondWithResult(_0x35f00f,null))[_0x4aa0('0x4c')](handleError(_0x35f00f,null));};exports[_0x4aa0('0x69')]=function(_0x3e064e,_0x399701,_0x5ff9da){var _0x23439f;return db[_0x4aa0('0x36')]['find']({'where':{'id':_0x3e064e[_0x4aa0('0x4d')]['id']},'include':[{'model':db[_0x4aa0('0x6a')],'as':_0x4aa0('0x6b')}]})[_0x4aa0('0x2c')](handleEntityNotFound(_0x399701,null))[_0x4aa0('0x2c')](function(_0xccf2b){if(_0xccf2b){_0x23439f=_0xccf2b;return db[_0x4aa0('0x5d')][_0x4aa0('0x37')];}})[_0x4aa0('0x2c')](function(_0x4842fb){if(_0x4842fb){var _0xcd235a={};var _0x358970={};_0x358970[_0x4aa0('0x3b')]=_[_0x4aa0('0x6c')](_['keys'](_0x4842fb),_[_0x4aa0('0x35')](_0x23439f[_0x4aa0('0x6b')],function(_0x4b6e22){return util[_0x4aa0('0x6d')]('cf_%d',_0x4b6e22['id']);}));_0x358970[_0x4aa0('0x3c')]=_[_0x4aa0('0x3d')](_0x3e064e['query']);_0x358970['filters']=_[_0x4aa0('0x3f')](_0x358970[_0x4aa0('0x3b')],_0x358970[_0x4aa0('0x3c')]);_0xcd235a[_0x4aa0('0x41')]=_[_0x4aa0('0x3f')](_0x358970['model'],qs['fields'](_0x3e064e['query']['fields']));_0xcd235a[_0x4aa0('0x41')]=_0xcd235a['attributes'][_0x4aa0('0x42')]?_0xcd235a['attributes']:_0x358970[_0x4aa0('0x3b')];if(!_0x3e064e[_0x4aa0('0x3c')][_0x4aa0('0x43')]('nolimit')){_0xcd235a[_0x4aa0('0x23')]=qs[_0x4aa0('0x23')](_0x3e064e['query']['limit']);_0xcd235a['offset']=qs[_0x4aa0('0x21')](_0x3e064e[_0x4aa0('0x3c')][_0x4aa0('0x21')]);}_0xcd235a[_0x4aa0('0x6e')]=qs[_0x4aa0('0x44')](_0x3e064e['query'][_0x4aa0('0x44')]);_0xcd235a[_0x4aa0('0x45')]=qs[_0x4aa0('0x3e')](_[_0x4aa0('0x46')](_0x3e064e[_0x4aa0('0x3c')],_0x358970[_0x4aa0('0x3e')]));_0xcd235a['raw']=!![];if(_0x3e064e['query'][_0x4aa0('0x47')]){_0xcd235a[_0x4aa0('0x45')]=_[_0x4aa0('0x48')](_0xcd235a[_0x4aa0('0x45')],{'$or':_['map'](_0xcd235a[_0x4aa0('0x41')],function(_0x12cb1a){var _0x1d9f60={};_0x1d9f60[_0x12cb1a]={'$like':'%'+_0x3e064e['query'][_0x4aa0('0x47')]+'%'};return _0x1d9f60;})});}_0xcd235a=_[_0x4aa0('0x48')]({},_0xcd235a,_0x3e064e[_0x4aa0('0x49')]);return _0x23439f[_0x4aa0('0x69')](_0xcd235a);}})[_0x4aa0('0x2c')](respondWithResult(_0x399701,null))[_0x4aa0('0x4c')](handleError(_0x399701,null));};exports['getContactsCsv']=function(_0x5eca4f,_0x1a5329,_0x4ba7de){var _0x53be89;var _0x461734;var _0x3174d0;var _0x888701=_0x5eca4f[_0x4aa0('0x4d')]['id'];csv_results=[];return db['ContactItemType'][_0x4aa0('0x4b')]({'attributes':['id',_0x4aa0('0x32')],'raw':!![],'order':[_0x4aa0('0x6f')]})[_0x4aa0('0x2c')](function(_0x44de7e){_0x53be89=_0x44de7e;var _0x27364e=_['keys'](db['CmContact'][_0x4aa0('0x37')]);return db[_0x4aa0('0x6a')][_0x4aa0('0x4b')]({'raw':!![],'attributes':['id',_0x4aa0('0x70')]})[_0x4aa0('0x2c')](function(_0x2a1650){_0x461734=_0x2a1650;var _0x36e298=squel[_0x4aa0('0x71')]()[_0x4aa0('0x40')](_0x27364e)[_0x4aa0('0x72')]('cm_contacts','c')[_0x4aa0('0x45')](_0x4aa0('0x73'),_0x888701)['where'](_0x4aa0('0x74'))[_0x4aa0('0x75')]();for(var _0x3112c6=0x0;_0x3112c6<_0x461734['length'];_0x3112c6++){_0x36e298[_0x4aa0('0x76')](_0x4aa0('0x77')+_0x461734[_0x3112c6]['id'],_0x4aa0('0x78')+_0x461734[_0x3112c6][_0x4aa0('0x70')]);}for(var _0x3112c6=0x0;_0x3112c6<_0x53be89[_0x4aa0('0x42')];_0x3112c6++){_0x36e298[_0x4aa0('0x76')](squel['select']()[_0x4aa0('0x76')](_0x4aa0('0x79'))[_0x4aa0('0x72')](_0x4aa0('0x7a'))[_0x4aa0('0x45')]('ItemTypeId\x20=\x20?',_0x53be89[_0x3112c6]['id'])[_0x4aa0('0x45')]('CmContactId\x20=\x20c.id'),_0x4aa0('0x7b')+_0x53be89[_0x3112c6][_0x4aa0('0x32')]);_0x36e298[_0x4aa0('0x76')](squel['select']()[_0x4aa0('0x76')](_0x4aa0('0x7c'))[_0x4aa0('0x72')](_0x4aa0('0x7a'))[_0x4aa0('0x45')](_0x4aa0('0x7d'),_0x53be89[_0x3112c6]['id'])[_0x4aa0('0x45')]('CmContactId\x20=\x20c.id'),_0x4aa0('0x7e')+_0x53be89[_0x3112c6]['name']);}var _0x534c48=[];_0x534c48[_0x4aa0('0x61')](_0x36e298[_0x4aa0('0x7f')]());BPromise[_0x4aa0('0x62')](_0x534c48,handleQuery)[_0x4aa0('0x2c')](function(_0x1ee943){handleQuery(_0x36e298['toString']());var _0x2273c6=csv_results[0x0];if(!_[_0x4aa0('0x80')](_0x2273c6)){var _0x20086c=toCsv(_0x2273c6);var _0x18d363=Date[_0x4aa0('0x81')]();fs[_0x4aa0('0x82')](util['format']('/tmp/list_%d_%s.csv',_0x888701,_0x18d363),_0x20086c);_0x1a5329['setHeader'](_0x4aa0('0x83'),_0x4aa0('0x84')+util['format'](_0x4aa0('0x85'),_0x888701,_0x18d363));_0x1a5329[_0x4aa0('0x86')](_0x4aa0('0x87'),_0x4aa0('0x88'));return _0x1a5329[_0x4aa0('0x89')](util[_0x4aa0('0x6d')]('/tmp/list_%d_%s.csv',_0x888701,_0x18d363));}else{return _0x1a5329[_0x4aa0('0x30')](0xcc);}});});});};exports[_0x4aa0('0x8a')]=function(_0x4725f2,_0x23aede,_0x498644){var _0x1439be;delete _0x4725f2[_0x4aa0('0x51')]['id'];return db['CmList'][_0x4aa0('0x5a')]({'where':{'id':_0x4725f2[_0x4aa0('0x4d')]['id']}})[_0x4aa0('0x2c')](handleEntityNotFound(_0x23aede,null))[_0x4aa0('0x2c')](function(_0x2e5261){if(_0x2e5261){return db[_0x4aa0('0x8b')][_0x4aa0('0x8c')](function(_0x1e573c){return db[_0x4aa0('0x6a')][_0x4aa0('0x50')](_0x4725f2['body'],{'transaction':_0x1e573c})[_0x4aa0('0x2c')](function(_0x12bbab){_0x1439be=_0x12bbab;return _0x2e5261['addCustomFields'](_0x12bbab,{'transaction':_0x1e573c});})[_0x4aa0('0x2c')](function(){var _0x18ea96={'type':db[_0x4aa0('0x8d')][_0x4aa0('0x8e')],'transaction':_0x1e573c};switch(_0x4725f2[_0x4aa0('0x51')][_0x4aa0('0x39')]){case _0x4aa0('0x8f'):_0x18ea96['type']=db[_0x4aa0('0x8d')][_0x4aa0('0x8e')];break;case _0x4aa0('0x90'):_0x18ea96[_0x4aa0('0x39')]=db[_0x4aa0('0x8d')]['INTEGER'];break;case _0x4aa0('0x91'):_0x18ea96[_0x4aa0('0x39')]=db[_0x4aa0('0x8d')]['BOOLEAN'];_0x18ea96['defaultValue']=![];break;default:}return db['sequelize'][_0x4aa0('0x92')][_0x4aa0('0x93')](_0x4aa0('0x94'),util[_0x4aa0('0x6d')]('cf_%s',_0x1439be['id']),_0x18ea96);})[_0x4aa0('0x2c')](function(){return _0x1439be;});});}})[_0x4aa0('0x2c')](respondWithResult(_0x23aede,null))[_0x4aa0('0x4c')](handleError(_0x23aede,null));};exports[_0x4aa0('0x95')]=function(_0x568c7b,_0xf94f2a,_0x3d4bb4){var _0x9cec6a={};var _0x56d189={};var _0x2afa74;var _0x637161;return db['CmList'][_0x4aa0('0x5a')]({'where':{'id':_0x568c7b[_0x4aa0('0x4d')]['id']}})[_0x4aa0('0x2c')](handleEntityNotFound(_0xf94f2a,null))[_0x4aa0('0x2c')](function(_0x33e4fb){if(_0x33e4fb){_0x2afa74=_0x33e4fb;_0x56d189[_0x4aa0('0x3b')]=_['keys'](db[_0x4aa0('0x6a')][_0x4aa0('0x37')]);_0x56d189[_0x4aa0('0x3c')]=_[_0x4aa0('0x3d')](_0x568c7b['query']);_0x56d189[_0x4aa0('0x3e')]=_[_0x4aa0('0x3f')](_0x56d189['model'],_0x56d189[_0x4aa0('0x3c')]);_0x9cec6a[_0x4aa0('0x41')]=_[_0x4aa0('0x3f')](_0x56d189[_0x4aa0('0x3b')],qs[_0x4aa0('0x40')](_0x568c7b[_0x4aa0('0x3c')][_0x4aa0('0x40')]));_0x9cec6a[_0x4aa0('0x41')]=_0x9cec6a[_0x4aa0('0x41')]['length']?_0x9cec6a[_0x4aa0('0x41')]:_0x56d189['model'];_0x9cec6a[_0x4aa0('0x6e')]=qs[_0x4aa0('0x44')](_0x568c7b[_0x4aa0('0x3c')][_0x4aa0('0x44')]);_0x9cec6a[_0x4aa0('0x45')]=qs[_0x4aa0('0x3e')](_[_0x4aa0('0x46')](_0x568c7b[_0x4aa0('0x3c')],_0x56d189[_0x4aa0('0x3e')]));_0x9cec6a[_0x4aa0('0x45')]=_['merge'](_0x9cec6a[_0x4aa0('0x45')],{'$or':[{'ListId':_0x33e4fb['id']},{'ListId':null}]});if(_0x568c7b[_0x4aa0('0x3c')][_0x4aa0('0x47')]){_0x9cec6a[_0x4aa0('0x45')]=_[_0x4aa0('0x48')](_0x9cec6a[_0x4aa0('0x45')],{'$or':_[_0x4aa0('0x35')](_0x9cec6a[_0x4aa0('0x41')],function(_0x2872d9){var _0x368ecf={};_0x368ecf[_0x2872d9]={'$like':'%'+_0x568c7b[_0x4aa0('0x3c')]['filter']+'%'};return _0x368ecf;})});}_0x9cec6a=_[_0x4aa0('0x48')]({},_0x9cec6a,_0x568c7b['options']);return db[_0x4aa0('0x6a')]['findAndCountAll'](_0x9cec6a);}})['then'](respondWithResult(_0xf94f2a,null))[_0x4aa0('0x4c')](handleError(_0xf94f2a,null));};exports[_0x4aa0('0x96')]=function(_0x3bf233,_0x449e3a){return db[_0x4aa0('0x6a')]['findAndCountAll']({'where':{'ListId':null}})['then'](handleEntityNotFound(_0x449e3a,null))[_0x4aa0('0x2c')](function(_0x19bfc1){return _0x19bfc1;})[_0x4aa0('0x2c')](respondWithResult(_0x449e3a,null))[_0x4aa0('0x4c')](handleError(_0x449e3a,null));};exports[_0x4aa0('0x97')]=function(_0x596d52,_0x4d7933,_0x32ac84){return db[_0x4aa0('0x36')][_0x4aa0('0x4f')]({'where':{'id':_0x596d52[_0x4aa0('0x4d')]['id']}})[_0x4aa0('0x2c')](handleEntityNotFound(_0x4d7933,null))[_0x4aa0('0x2c')](function(_0x122bd0){if(_0x122bd0){return _0x122bd0[_0x4aa0('0x97')](_0x596d52[_0x4aa0('0x51')][_0x4aa0('0x5c')],_['omit'](_0x596d52[_0x4aa0('0x51')],[_0x4aa0('0x5c'),'id'])||{})[_0x4aa0('0x98')](function(_0x13ac73){for(var _0x462da8=0x0;_0x462da8<_0x596d52[_0x4aa0('0x51')]['ids']['length'];_0x462da8+=0x1){socket[_0x4aa0('0x99')](_0x4aa0('0x9a'),{'UserId':Number(_0x596d52[_0x4aa0('0x51')]['ids'][_0x462da8]),'CmListId':Number(_0x596d52[_0x4aa0('0x4d')]['id'])});}return _0x13ac73;});}})[_0x4aa0('0x2c')](respondWithResult(_0x4d7933,null))['catch'](handleError(_0x4d7933,null));};exports[_0x4aa0('0x9b')]=function(_0x2fdd05,_0x165073,_0x15a83a){return db[_0x4aa0('0x36')][_0x4aa0('0x4f')]({'where':{'id':_0x2fdd05[_0x4aa0('0x4d')]['id']}})[_0x4aa0('0x2c')](handleEntityNotFound(_0x165073,null))[_0x4aa0('0x2c')](function(_0x5a70e4){if(_0x5a70e4){return _0x5a70e4[_0x4aa0('0x9b')](_0x2fdd05[_0x4aa0('0x3c')][_0x4aa0('0x5c')])['then'](function(){if(_['isArray'](_0x2fdd05[_0x4aa0('0x3c')][_0x4aa0('0x5c')])){for(var _0x36adff=0x0;_0x36adff<_0x2fdd05[_0x4aa0('0x3c')][_0x4aa0('0x5c')][_0x4aa0('0x42')];_0x36adff+=0x1){socket[_0x4aa0('0x99')](_0x4aa0('0x9c'),{'UserId':Number(_0x2fdd05[_0x4aa0('0x3c')][_0x4aa0('0x5c')][_0x36adff]),'CmListId':Number(_0x2fdd05[_0x4aa0('0x4d')]['id'])});}}else{socket[_0x4aa0('0x99')](_0x4aa0('0x9c'),{'UserId':Number(_0x2fdd05[_0x4aa0('0x3c')][_0x4aa0('0x5c')]),'CmListId':Number(_0x2fdd05[_0x4aa0('0x4d')]['id'])});}});}})['then'](respondWithStatusCode(_0x165073,null))['catch'](handleError(_0x165073,null));};exports[_0x4aa0('0x9d')]=function(_0x42ab52,_0x57261c,_0x272790){var _0x5456d7={};var _0x12d75a={};var _0x319ce2;var _0x328dff;return db[_0x4aa0('0x36')]['findOne']({'where':{'id':_0x42ab52['params']['id']}})[_0x4aa0('0x2c')](handleEntityNotFound(_0x57261c,null))[_0x4aa0('0x2c')](function(_0x5a625a){if(_0x5a625a){_0x319ce2=_0x5a625a;_0x12d75a[_0x4aa0('0x3b')]=_[_0x4aa0('0x3d')](db[_0x4aa0('0x9e')][_0x4aa0('0x37')]);_0x12d75a[_0x4aa0('0x3c')]=_[_0x4aa0('0x3d')](_0x42ab52[_0x4aa0('0x3c')]);_0x12d75a[_0x4aa0('0x3e')]=_[_0x4aa0('0x3f')](_0x12d75a[_0x4aa0('0x3b')],_0x12d75a[_0x4aa0('0x3c')]);_0x5456d7[_0x4aa0('0x41')]=_[_0x4aa0('0x3f')](_0x12d75a[_0x4aa0('0x3b')],qs[_0x4aa0('0x40')](_0x42ab52[_0x4aa0('0x3c')][_0x4aa0('0x40')]));_0x5456d7[_0x4aa0('0x41')]=_0x5456d7[_0x4aa0('0x41')][_0x4aa0('0x42')]?_0x5456d7[_0x4aa0('0x41')]:_0x12d75a['model'];_0x5456d7['order']=qs[_0x4aa0('0x44')](_0x42ab52[_0x4aa0('0x3c')][_0x4aa0('0x44')]);_0x5456d7[_0x4aa0('0x45')]=qs['filters'](_[_0x4aa0('0x46')](_0x42ab52[_0x4aa0('0x3c')],_0x12d75a[_0x4aa0('0x3e')]));if(_0x42ab52[_0x4aa0('0x3c')][_0x4aa0('0x47')]){_0x5456d7['where']=_[_0x4aa0('0x48')](_0x5456d7[_0x4aa0('0x45')],{'$or':_['map'](_0x5456d7['attributes'],function(_0x36812d){var _0x268077={};_0x268077[_0x36812d]={'$like':'%'+_0x42ab52['query'][_0x4aa0('0x47')]+'%'};return _0x268077;})});}_0x5456d7=_[_0x4aa0('0x48')]({},_0x5456d7,_0x42ab52[_0x4aa0('0x49')]);return _0x319ce2[_0x4aa0('0x9d')](_0x5456d7);}})[_0x4aa0('0x2c')](function(_0x4d6430){if(_0x4d6430){_0x328dff=_0x4d6430['length'];if(!_0x42ab52[_0x4aa0('0x3c')][_0x4aa0('0x43')](_0x4aa0('0x9f'))){_0x5456d7['limit']=qs[_0x4aa0('0x23')](_0x42ab52[_0x4aa0('0x3c')][_0x4aa0('0x23')]);_0x5456d7[_0x4aa0('0x21')]=qs[_0x4aa0('0x21')](_0x42ab52[_0x4aa0('0x3c')]['offset']);}return _0x319ce2[_0x4aa0('0x9d')](_0x5456d7);}})[_0x4aa0('0x2c')](function(_0x27f789){if(_0x27f789){return _0x27f789?{'count':_0x328dff,'rows':_0x27f789}:null;}})['then'](respondWithResult(_0x57261c,null))[_0x4aa0('0x4c')](handleError(_0x57261c,null));};function handleQuery(_0x5cbce0){logger[_0x4aa0('0xa0')](_0x5cbce0);return db['sequelize'][_0x4aa0('0x3c')](_0x5cbce0)[_0x4aa0('0x98')](function(_0x28b5ae){csv_results[_0x4aa0('0x61')](_0x28b5ae);})['catch'](function(_0x4e308e){logger[_0x4aa0('0x31')](_0x4e308e[_0x4aa0('0x67')]);});} \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index 2c47f0c..4d9ed98 100644 --- a/server/api/cmList/cmList.events.js +++ b/server/api/cmList/cmList.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7217=['emit','hasOwnProperty','hook','exports','events','CmList','setMaxListeners','save','update','remove'];(function(_0x4aac5a,_0x15b04c){var _0x42e7bc=function(_0x1da766){while(--_0x1da766){_0x4aac5a['push'](_0x4aac5a['shift']());}};_0x42e7bc(++_0x15b04c);}(_0x7217,0x19e));var _0x7721=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0x7217[_0x5b561d];return _0x431060;};'use strict';var EventEmitter=require(_0x7721('0x0'));var CmList=require('../../mysqldb')['db'][_0x7721('0x1')];var CmListEvents=new EventEmitter();CmListEvents[_0x7721('0x2')](0x0);var events={'afterCreate':_0x7721('0x3'),'afterUpdate':_0x7721('0x4'),'afterDestroy':_0x7721('0x5')};function emitEvent(_0x4d6446){return function(_0x5bf160,_0x472a96,_0xce17f9){CmListEvents[_0x7721('0x6')](_0x4d6446+':'+_0x5bf160['id'],_0x5bf160);CmListEvents[_0x7721('0x6')](_0x4d6446,_0x5bf160);_0xce17f9(null);};}for(var e in events){if(events[_0x7721('0x7')](e)){var event=events[e];CmList[_0x7721('0x8')](e,emitEvent(event));}}module[_0x7721('0x9')]=CmListEvents; \ No newline at end of file +var _0x7217=['emit','hasOwnProperty','hook','exports','events','CmList','setMaxListeners','save','update','remove'];(function(_0x31c201,_0x2f0396){var _0xe880b4=function(_0xc17602){while(--_0xc17602){_0x31c201['push'](_0x31c201['shift']());}};_0xe880b4(++_0x2f0396);}(_0x7217,0x19e));var _0x7721=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0x7217[_0x4ea69d];return _0x5318e0;};'use strict';var EventEmitter=require(_0x7721('0x0'));var CmList=require('../../mysqldb')['db'][_0x7721('0x1')];var CmListEvents=new EventEmitter();CmListEvents[_0x7721('0x2')](0x0);var events={'afterCreate':_0x7721('0x3'),'afterUpdate':_0x7721('0x4'),'afterDestroy':_0x7721('0x5')};function emitEvent(_0x4d6446){return function(_0x5bf160,_0x472a96,_0xce17f9){CmListEvents[_0x7721('0x6')](_0x4d6446+':'+_0x5bf160['id'],_0x5bf160);CmListEvents[_0x7721('0x6')](_0x4d6446,_0x5bf160);_0xce17f9(null);};}for(var e in events){if(events[_0x7721('0x7')](e)){var event=events[e];CmList[_0x7721('0x8')](e,emitEvent(event));}}module[_0x7721('0x9')]=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index 5e9834b..3e602e4 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 _0x54ef=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmList.attributes','define','CmList','lodash','util'];(function(_0x1d7f0b,_0x18641f){var _0x4e4e44=function(_0x4175d7){while(--_0x4175d7){_0x1d7f0b['push'](_0x1d7f0b['shift']());}};_0x4e4e44(++_0x18641f);}(_0x54ef,0x112));var _0xf54e=function(_0x26cc13,_0xda773){_0x26cc13=_0x26cc13-0x0;var _0x576b66=_0x54ef[_0x26cc13];return _0x576b66;};'use strict';var _=require(_0xf54e('0x0'));var util=require(_0xf54e('0x1'));var logger=require(_0xf54e('0x2'))('api');var moment=require(_0xf54e('0x3'));var BPromise=require(_0xf54e('0x4'));var rp=require(_0xf54e('0x5'));var fs=require('fs');var path=require(_0xf54e('0x6'));var rimraf=require(_0xf54e('0x7'));var config=require(_0xf54e('0x8'));var attributes=require(_0xf54e('0x9'));module['exports']=function(_0x55e611,_0x18e84e){return _0x55e611[_0xf54e('0xa')](_0xf54e('0xb'),attributes,{'tableName':'cm_lists','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xec56=['define','CmList','cm_lists','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmList.attributes','exports'];(function(_0x5747b7,_0x365173){var _0x5219a1=function(_0x26325a){while(--_0x26325a){_0x5747b7['push'](_0x5747b7['shift']());}};_0x5219a1(++_0x365173);}(_0xec56,0x1bd));var _0x6ec5=function(_0x52e4dd,_0x2206d2){_0x52e4dd=_0x52e4dd-0x0;var _0x311632=_0xec56[_0x52e4dd];return _0x311632;};'use strict';var _=require(_0x6ec5('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x6ec5('0x1'));var moment=require(_0x6ec5('0x2'));var BPromise=require(_0x6ec5('0x3'));var rp=require(_0x6ec5('0x4'));var fs=require('fs');var path=require(_0x6ec5('0x5'));var rimraf=require(_0x6ec5('0x6'));var config=require(_0x6ec5('0x7'));var attributes=require(_0x6ec5('0x8'));module[_0x6ec5('0x9')]=function(_0x28b12b,_0x2d0a93){return _0x28b12b[_0x6ec5('0xa')](_0x6ec5('0xb'),attributes,{'tableName':_0x6ec5('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmList/cmList.rpc.js b/server/api/cmList/cmList.rpc.js index ebadaaf..f16f13c 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 _0x462a=['rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./cmList.socket','register','request','then','info','CmList,\x20%s,\x20%s','debug','CmList,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb'];(function(_0x2927d2,_0x1ff773){var _0x18f103=function(_0x219ba3){while(--_0x219ba3){_0x2927d2['push'](_0x2927d2['shift']());}};_0x18f103(++_0x1ff773);}(_0x462a,0x156));var _0xa462=function(_0x2ae493,_0x5b50ac){_0x2ae493=_0x2ae493-0x0;var _0x4a5000=_0x462a[_0x2ae493];return _0x4a5000;};'use strict';var _=require(_0xa462('0x0'));var util=require(_0xa462('0x1'));var moment=require(_0xa462('0x2'));var BPromise=require(_0xa462('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa462('0x4'));var db=require(_0xa462('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xa462('0x6'));var config=require(_0xa462('0x7'));var jayson=require(_0xa462('0x8'));var client=jayson[_0xa462('0x9')][_0xa462('0xa')]({'port':0x232a});config[_0xa462('0xb')]=_[_0xa462('0xc')](config[_0xa462('0xb')],{'host':_0xa462('0xd'),'port':0x18eb});var socket=require(_0xa462('0xe'))(new Redis(config[_0xa462('0xb')]));require(_0xa462('0xf'))[_0xa462('0x10')](socket);function respondWithRpcPromise(_0xcbc826,_0x27def3,_0x843d6f){return new BPromise(function(_0xc068b,_0x2b31fc){return client[_0xa462('0x11')](_0xcbc826,_0x843d6f)[_0xa462('0x12')](function(_0x513960){logger[_0xa462('0x13')](_0xa462('0x14'),_0x27def3,'request\x20sent');logger[_0xa462('0x15')](_0xa462('0x16'),_0x27def3,'request\x20sent',JSON[_0xa462('0x17')](_0x513960));if(_0x513960['error']){if(_0x513960[_0xa462('0x18')][_0xa462('0x19')]===0x1f4){logger[_0xa462('0x18')](_0xa462('0x14'),_0x27def3,_0x513960[_0xa462('0x18')]['message']);return _0x2b31fc(_0x513960[_0xa462('0x18')][_0xa462('0x1a')]);}logger['error'](_0xa462('0x14'),_0x27def3,_0x513960[_0xa462('0x18')]['message']);return _0xc068b(_0x513960['error'][_0xa462('0x1a')]);}else{logger[_0xa462('0x13')](_0xa462('0x14'),_0x27def3,'request\x20sent');_0xc068b(_0x513960[_0xa462('0x1b')]['message']);}})[_0xa462('0x1c')](function(_0x1f7df9){logger[_0xa462('0x18')](_0xa462('0x14'),_0x27def3,_0x1f7df9);_0x2b31fc(_0x1f7df9);});});} \ No newline at end of file +var _0x6ec4=['localhost','socket.io-emitter','redis','./cmList.socket','register','then','info','CmList,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults'];(function(_0x499603,_0x4ca954){var _0x1c0227=function(_0x14fe86){while(--_0x14fe86){_0x499603['push'](_0x499603['shift']());}};_0x1c0227(++_0x4ca954);}(_0x6ec4,0x11d));var _0x46ec=function(_0x53f964,_0x3b52b8){_0x53f964=_0x53f964-0x0;var _0x17be6c=_0x6ec4[_0x53f964];return _0x17be6c;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x46ec('0x0'));var BPromise=require(_0x46ec('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x46ec('0x2'));var db=require(_0x46ec('0x3'))['db'];var utils=require(_0x46ec('0x4'));var logger=require(_0x46ec('0x5'))(_0x46ec('0x6'));var config=require(_0x46ec('0x7'));var jayson=require(_0x46ec('0x8'));var client=jayson[_0x46ec('0x9')][_0x46ec('0xa')]({'port':0x232a});config['redis']=_[_0x46ec('0xb')](config['redis'],{'host':_0x46ec('0xc'),'port':0x18eb});var socket=require(_0x46ec('0xd'))(new Redis(config[_0x46ec('0xe')]));require(_0x46ec('0xf'))[_0x46ec('0x10')](socket);function respondWithRpcPromise(_0x4ab190,_0x580cea,_0x26ab4e){return new BPromise(function(_0xfc139,_0x1b1529){return client['request'](_0x4ab190,_0x26ab4e)[_0x46ec('0x11')](function(_0x5f4591){logger[_0x46ec('0x12')](_0x46ec('0x13'),_0x580cea,_0x46ec('0x14'));logger[_0x46ec('0x15')]('CmList,\x20%s,\x20%s,\x20%s',_0x580cea,'request\x20sent',JSON[_0x46ec('0x16')](_0x5f4591));if(_0x5f4591[_0x46ec('0x17')]){if(_0x5f4591[_0x46ec('0x17')][_0x46ec('0x18')]===0x1f4){logger[_0x46ec('0x17')](_0x46ec('0x13'),_0x580cea,_0x5f4591['error'][_0x46ec('0x19')]);return _0x1b1529(_0x5f4591['error'][_0x46ec('0x19')]);}logger[_0x46ec('0x17')](_0x46ec('0x13'),_0x580cea,_0x5f4591[_0x46ec('0x17')][_0x46ec('0x19')]);return _0xfc139(_0x5f4591[_0x46ec('0x17')][_0x46ec('0x19')]);}else{logger['info'](_0x46ec('0x13'),_0x580cea,'request\x20sent');_0xfc139(_0x5f4591[_0x46ec('0x1a')][_0x46ec('0x19')]);}})['catch'](function(_0x926928){logger[_0x46ec('0x17')](_0x46ec('0x13'),_0x580cea,_0x926928);_0x1b1529(_0x926928);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 7e6876e..278789e 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 _0xc153=['remove','update','register','length','cmList:','save'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xc153,0x191));var _0x3c15=function(_0x55de50,_0x15d6eb){_0x55de50=_0x55de50-0x0;var _0x15123f=_0xc153[_0x55de50];return _0x15123f;};'use strict';var CmListEvents=require('./cmList.events');var events=[_0x3c15('0x0'),_0x3c15('0x1'),_0x3c15('0x2')];function createListener(_0x219d0b,_0x368beb){return function(_0x5df838){_0x368beb['emit'](_0x219d0b,_0x5df838);};}function removeListener(_0x18f340,_0x477218){return function(){CmListEvents['removeListener'](_0x18f340,_0x477218);};}exports[_0x3c15('0x3')]=function(_0x27ae0f){for(var _0x42a714=0x0,_0x3db7d7=events[_0x3c15('0x4')];_0x42a714<_0x3db7d7;_0x42a714++){var _0xd75f09=events[_0x42a714];var _0x585eab=createListener(_0x3c15('0x5')+_0xd75f09,_0x27ae0f);CmListEvents['on'](_0xd75f09,_0x585eab);}}; \ No newline at end of file +var _0x2cbb=['update','emit','length','cmList:','./cmList.events'];(function(_0x55fa03,_0xcb96c2){var _0x2cd7cd=function(_0x56611f){while(--_0x56611f){_0x55fa03['push'](_0x55fa03['shift']());}};_0x2cd7cd(++_0xcb96c2);}(_0x2cbb,0x9f));var _0xb2cb=function(_0x53b07e,_0x3bc254){_0x53b07e=_0x53b07e-0x0;var _0x5490b7=_0x2cbb[_0x53b07e];return _0x5490b7;};'use strict';var CmListEvents=require(_0xb2cb('0x0'));var events=['save','remove',_0xb2cb('0x1')];function createListener(_0x5b79b5,_0x54a40d){return function(_0x3269b7){_0x54a40d[_0xb2cb('0x2')](_0x5b79b5,_0x3269b7);};}function removeListener(_0xc86ff3,_0x23f223){return function(){CmListEvents['removeListener'](_0xc86ff3,_0x23f223);};}exports['register']=function(_0x2f0683){for(var _0x5b5217=0x0,_0x523d96=events[_0xb2cb('0x3')];_0x5b5217<_0x523d96;_0x5b5217++){var _0x1fd698=events[_0x5b5217];var _0x1b896c=createListener(_0xb2cb('0x4')+_0x1fd698,_0x2f0683);CmListEvents['on'](_0x1fd698,_0x1b896c);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index 93d69d9..6db5be5 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 _0xfda0=['/:id/contacts/csv','getContactsCsv','/:id/fields','getCustomFields','/:id/users','getAgents','create','post','addContacts','addCustomField','put','update','delete','destroy','removeDispositions','removeAgents','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmList.controller','get','isAuthenticated','/describe','describe','/global_fields','getGlobalCustomFields','/:id','show','/:id/dispositions','getDispositions','/:id/contacts','getContacts'];(function(_0x26ec0a,_0x5d9b0d){var _0x3d034e=function(_0x5d87a1){while(--_0x5d87a1){_0x26ec0a['push'](_0x26ec0a['shift']());}};_0x3d034e(++_0x5d9b0d);}(_0xfda0,0xee));var _0x0fda=function(_0x443f02,_0x6ad56a){_0x443f02=_0x443f02-0x0;var _0x5bd312=_0xfda0[_0x443f02];return _0x5bd312;};'use strict';var multer=require(_0x0fda('0x0'));var util=require(_0x0fda('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x0fda('0x2'));var router=express[_0x0fda('0x3')]();var fs_extra=require(_0x0fda('0x4'));var auth=require(_0x0fda('0x5'));var interaction=require(_0x0fda('0x6'));var config=require(_0x0fda('0x7'));var controller=require(_0x0fda('0x8'));router[_0x0fda('0x9')]('/',auth[_0x0fda('0xa')](),controller['index']);router[_0x0fda('0x9')](_0x0fda('0xb'),auth[_0x0fda('0xa')](),controller[_0x0fda('0xc')]);router[_0x0fda('0x9')](_0x0fda('0xd'),auth['isAuthenticated'](),controller[_0x0fda('0xe')]);router['get'](_0x0fda('0xf'),auth['isAuthenticated'](),controller[_0x0fda('0x10')]);router[_0x0fda('0x9')](_0x0fda('0x11'),auth[_0x0fda('0xa')](),controller[_0x0fda('0x12')]);router[_0x0fda('0x9')](_0x0fda('0x13'),auth[_0x0fda('0xa')](),controller[_0x0fda('0x14')]);router[_0x0fda('0x9')](_0x0fda('0x15'),auth[_0x0fda('0xa')](),controller[_0x0fda('0x16')]);router[_0x0fda('0x9')](_0x0fda('0x17'),auth['isAuthenticated'](),controller[_0x0fda('0x18')]);router[_0x0fda('0x9')](_0x0fda('0x19'),auth[_0x0fda('0xa')](),controller[_0x0fda('0x1a')]);router['post']('/',auth[_0x0fda('0xa')](),controller[_0x0fda('0x1b')]);router[_0x0fda('0x1c')](_0x0fda('0x11'),auth[_0x0fda('0xa')](),controller['addDisposition']);router[_0x0fda('0x1c')](_0x0fda('0x13'),auth['isAuthenticated'](),controller[_0x0fda('0x1d')]);router[_0x0fda('0x1c')](_0x0fda('0x17'),auth['isAuthenticated'](),controller[_0x0fda('0x1e')]);router[_0x0fda('0x1c')](_0x0fda('0x19'),auth[_0x0fda('0xa')](),controller['addAgents']);router[_0x0fda('0x1f')]('/:id',auth[_0x0fda('0xa')](),controller[_0x0fda('0x20')]);router[_0x0fda('0x21')](_0x0fda('0xf'),auth[_0x0fda('0xa')](),controller[_0x0fda('0x22')]);router[_0x0fda('0x21')](_0x0fda('0x11'),auth[_0x0fda('0xa')](),controller[_0x0fda('0x23')]);router[_0x0fda('0x21')](_0x0fda('0x19'),auth[_0x0fda('0xa')](),controller[_0x0fda('0x24')]);module['exports']=router; \ No newline at end of file +var _0x3cf1=['../../components/interaction/service','../../config/environment','./cmList.controller','get','isAuthenticated','index','/describe','describe','/global_fields','getGlobalCustomFields','show','/:id/dispositions','getDispositions','/:id/contacts','getContacts','/:id/contacts/csv','getContactsCsv','/:id/fields','getCustomFields','/:id/users','getAgents','post','create','addDisposition','addContacts','addCustomField','addAgents','put','/:id','update','destroy','delete','removeDispositions','removeAgents','exports','multer','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x3cf1,0x16b));var _0x13cf=function(_0x1f7152,_0x18ffff){_0x1f7152=_0x1f7152-0x0;var _0x39606b=_0x3cf1[_0x1f7152];return _0x39606b;};'use strict';var multer=require(_0x13cf('0x0'));var util=require('util');var path=require(_0x13cf('0x1'));var timeout=require(_0x13cf('0x2'));var express=require(_0x13cf('0x3'));var router=express[_0x13cf('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x13cf('0x5'));var interaction=require(_0x13cf('0x6'));var config=require(_0x13cf('0x7'));var controller=require(_0x13cf('0x8'));router[_0x13cf('0x9')]('/',auth[_0x13cf('0xa')](),controller[_0x13cf('0xb')]);router[_0x13cf('0x9')](_0x13cf('0xc'),auth['isAuthenticated'](),controller[_0x13cf('0xd')]);router[_0x13cf('0x9')](_0x13cf('0xe'),auth[_0x13cf('0xa')](),controller[_0x13cf('0xf')]);router['get']('/:id',auth[_0x13cf('0xa')](),controller[_0x13cf('0x10')]);router[_0x13cf('0x9')](_0x13cf('0x11'),auth[_0x13cf('0xa')](),controller[_0x13cf('0x12')]);router[_0x13cf('0x9')](_0x13cf('0x13'),auth['isAuthenticated'](),controller[_0x13cf('0x14')]);router[_0x13cf('0x9')](_0x13cf('0x15'),auth[_0x13cf('0xa')](),controller[_0x13cf('0x16')]);router[_0x13cf('0x9')](_0x13cf('0x17'),auth['isAuthenticated'](),controller[_0x13cf('0x18')]);router['get'](_0x13cf('0x19'),auth['isAuthenticated'](),controller[_0x13cf('0x1a')]);router[_0x13cf('0x1b')]('/',auth[_0x13cf('0xa')](),controller[_0x13cf('0x1c')]);router[_0x13cf('0x1b')](_0x13cf('0x11'),auth[_0x13cf('0xa')](),controller[_0x13cf('0x1d')]);router[_0x13cf('0x1b')](_0x13cf('0x13'),auth[_0x13cf('0xa')](),controller[_0x13cf('0x1e')]);router[_0x13cf('0x1b')](_0x13cf('0x17'),auth[_0x13cf('0xa')](),controller[_0x13cf('0x1f')]);router['post'](_0x13cf('0x19'),auth[_0x13cf('0xa')](),controller[_0x13cf('0x20')]);router[_0x13cf('0x21')](_0x13cf('0x22'),auth[_0x13cf('0xa')](),controller[_0x13cf('0x23')]);router['delete'](_0x13cf('0x22'),auth[_0x13cf('0xa')](),controller[_0x13cf('0x24')]);router[_0x13cf('0x25')](_0x13cf('0x11'),auth[_0x13cf('0xa')](),controller[_0x13cf('0x26')]);router[_0x13cf('0x25')](_0x13cf('0x19'),auth['isAuthenticated'](),controller[_0x13cf('0x27')]);module[_0x13cf('0x28')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index d45d223..67c8f57 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 _0x0845=['exports','VIRTUAL','getDataValue','field','STRING','sequelize'];(function(_0x5b22e5,_0x50a727){var _0x50aa89=function(_0x391c4e){while(--_0x391c4e){_0x5b22e5['push'](_0x5b22e5['shift']());}};_0x50aa89(++_0x50a727);}(_0x0845,0x185));var _0x5084=function(_0x4e601c,_0x157c6c){_0x4e601c=_0x4e601c-0x0;var _0x45baf2=_0x0845[_0x4e601c];return _0x45baf2;};'use strict';var Sequelize=require(_0x5084('0x0'));module[_0x5084('0x1')]={'name':{'type':Sequelize[_0x5084('0x2')],'get':function(_0x511cf4){return this[_0x5084('0x3')](_0x5084('0x4'));}},'field':{'type':Sequelize[_0x5084('0x5')],'allowNull':![]},'operator':{'type':Sequelize[_0x5084('0x5')],'allowNull':![]},'value':{'type':Sequelize[_0x5084('0x5')],'allowNull':![]}}; \ No newline at end of file +var _0x9b5d=['field','STRING','sequelize','VIRTUAL','getDataValue'];(function(_0x4108dd,_0x47c725){var _0x33732b=function(_0x13e017){while(--_0x13e017){_0x4108dd['push'](_0x4108dd['shift']());}};_0x33732b(++_0x47c725);}(_0x9b5d,0xca));var _0xd9b5=function(_0x4066dd,_0x5ac7a4){_0x4066dd=_0x4066dd-0x0;var _0xdbb5f7=_0x9b5d[_0x4066dd];return _0xdbb5f7;};'use strict';var Sequelize=require(_0xd9b5('0x0'));module['exports']={'name':{'type':Sequelize[_0xd9b5('0x1')],'get':function(_0x27e0e7){return this[_0xd9b5('0x2')](_0xd9b5('0x3'));}},'field':{'type':Sequelize[_0xd9b5('0x4')],'allowNull':![]},'operator':{'type':Sequelize[_0xd9b5('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0xd9b5('0x4')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index bda6d2b..89866e7 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(_0x3d7cfa,_0x4832b6){var _0x58b42a=function(_0x347be5){while(--_0x347be5){_0x3d7cfa['push'](_0x3d7cfa['shift']());}};_0x58b42a(++_0x4832b6);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){if(_0x4b6f99['body']['id']){delete _0x4b6f99[_0x7995('0x2c')]['id'];}return db[_0x7995('0x2d')][_0x7995('0x2e')]({'where':{'id':_0x4b6f99['params']['id']}})['then'](handleEntityNotFound(_0x9b2a15,null))['then'](saveUpdates(_0x4b6f99[_0x7995('0x2c')],null))[_0x7995('0x26')](respondWithResult(_0x9b2a15,null))[_0x7995('0x2f')](handleError(_0x9b2a15,null));};exports[_0x7995('0x27')]=function(_0x2e3493,_0x1ca460){return db['Condition']['find']({'where':{'id':_0x2e3493[_0x7995('0x30')]['id']}})['then'](handleEntityNotFound(_0x1ca460,null))[_0x7995('0x26')](removeEntity(_0x1ca460,null))[_0x7995('0x2f')](handleError(_0x1ca460,null));}; \ No newline at end of file +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(_0x6dba11,_0x5c6ee3){var _0x1388ff=function(_0x9d2912){while(--_0x9d2912){_0x6dba11['push'](_0x6dba11['shift']());}};_0x1388ff(++_0x5c6ee3);}(_0x7a54,0x106));var _0x47a5=function(_0x46580b,_0x568e97){_0x46580b=_0x46580b-0x0;var _0x52924d=_0x7a54[_0x46580b];return _0x52924d;};'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 26023da..a9431c5 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 _0xbef4=['util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./condition.attributes','Condition','tools_conditions','lodash'];(function(_0x6209a4,_0x1974a2){var _0x1c20f7=function(_0x3fa18e){while(--_0x3fa18e){_0x6209a4['push'](_0x6209a4['shift']());}};_0x1c20f7(++_0x1974a2);}(_0xbef4,0x14f));var _0x4bef=function(_0x4c0998,_0x165050){_0x4c0998=_0x4c0998-0x0;var _0x1110e2=_0xbef4[_0x4c0998];return _0x1110e2;};'use strict';var _=require(_0x4bef('0x0'));var util=require(_0x4bef('0x1'));var logger=require(_0x4bef('0x2'))(_0x4bef('0x3'));var moment=require(_0x4bef('0x4'));var BPromise=require(_0x4bef('0x5'));var rp=require(_0x4bef('0x6'));var fs=require('fs');var path=require(_0x4bef('0x7'));var rimraf=require('rimraf');var config=require(_0x4bef('0x8'));var attributes=require(_0x4bef('0x9'));module['exports']=function(_0x2830ad,_0x9b76dc){return _0x2830ad['define'](_0x4bef('0xa'),attributes,{'tableName':_0x4bef('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf036=['exports','define','tools_conditions','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./condition.attributes'];(function(_0x5d289a,_0x352880){var _0x14bd5f=function(_0x268766){while(--_0x268766){_0x5d289a['push'](_0x5d289a['shift']());}};_0x14bd5f(++_0x352880);}(_0xf036,0xea));var _0x6f03=function(_0x5bf26f,_0xbf610d){_0x5bf26f=_0x5bf26f-0x0;var _0x53fff7=_0xf036[_0x5bf26f];return _0x53fff7;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x6f03('0x0'))(_0x6f03('0x1'));var moment=require(_0x6f03('0x2'));var BPromise=require(_0x6f03('0x3'));var rp=require(_0x6f03('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6f03('0x5'));var config=require(_0x6f03('0x6'));var attributes=require(_0x6f03('0x7'));module[_0x6f03('0x8')]=function(_0x900f0e,_0xf3e533){return _0x900f0e[_0x6f03('0x9')]('Condition',attributes,{'tableName':_0x6f03('0xa'),'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 a020a55..dd6cc6a 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 _0x2f9f=['../../config/logger','rpc','jayson/promise','http','then','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','stringify','error','code','Condition,\x20%s,\x20%s','message','result','lodash','util','ioredis','../../config/utils'];(function(_0x499c0d,_0x3a36b7){var _0x19dfb4=function(_0x55463f){while(--_0x55463f){_0x499c0d['push'](_0x499c0d['shift']());}};_0x19dfb4(++_0x3a36b7);}(_0x2f9f,0x176));var _0xf2f9=function(_0x3ee223,_0x3e58d9){_0x3ee223=_0x3ee223-0x0;var _0x755369=_0x2f9f[_0x3ee223];return _0x755369;};'use strict';var _=require(_0xf2f9('0x0'));var util=require(_0xf2f9('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf2f9('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xf2f9('0x3'));var logger=require(_0xf2f9('0x4'))(_0xf2f9('0x5'));var config=require('../../config/environment');var jayson=require(_0xf2f9('0x6'));var client=jayson['client'][_0xf2f9('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x38bf34,_0x5565b3,_0x173d34){return new BPromise(function(_0x4b46b2,_0x5b7eec){return client['request'](_0x38bf34,_0x173d34)[_0xf2f9('0x8')](function(_0x53c885){logger['info']('Condition,\x20%s,\x20%s',_0x5565b3,_0xf2f9('0x9'));logger[_0xf2f9('0xa')](_0xf2f9('0xb'),_0x5565b3,_0xf2f9('0x9'),JSON[_0xf2f9('0xc')](_0x53c885));if(_0x53c885[_0xf2f9('0xd')]){if(_0x53c885[_0xf2f9('0xd')][_0xf2f9('0xe')]===0x1f4){logger[_0xf2f9('0xd')](_0xf2f9('0xf'),_0x5565b3,_0x53c885[_0xf2f9('0xd')][_0xf2f9('0x10')]);return _0x5b7eec(_0x53c885[_0xf2f9('0xd')][_0xf2f9('0x10')]);}logger['error'](_0xf2f9('0xf'),_0x5565b3,_0x53c885['error'][_0xf2f9('0x10')]);return _0x4b46b2(_0x53c885[_0xf2f9('0xd')][_0xf2f9('0x10')]);}else{logger['info']('Condition,\x20%s,\x20%s',_0x5565b3,_0xf2f9('0x9'));_0x4b46b2(_0x53c885[_0xf2f9('0x11')][_0xf2f9('0x10')]);}})['catch'](function(_0x3c33bb){logger[_0xf2f9('0xd')](_0xf2f9('0xf'),_0x5565b3,_0x3c33bb);_0x5b7eec(_0x3c33bb);});});} \ No newline at end of file +var _0x7fd2=['request\x20sent','debug','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','Condition,\x20%s,\x20%s'];(function(_0x2555d0,_0x4150a6){var _0x3bb486=function(_0x1eb89f){while(--_0x1eb89f){_0x2555d0['push'](_0x2555d0['shift']());}};_0x3bb486(++_0x4150a6);}(_0x7fd2,0x1e6));var _0x27fd=function(_0x38ced4,_0x24263f){_0x38ced4=_0x38ced4-0x0;var _0x547c07=_0x7fd2[_0x38ced4];return _0x547c07;};'use strict';var _=require(_0x27fd('0x0'));var util=require(_0x27fd('0x1'));var moment=require(_0x27fd('0x2'));var BPromise=require(_0x27fd('0x3'));var rs=require(_0x27fd('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x27fd('0x5'))['db'];var utils=require(_0x27fd('0x6'));var logger=require(_0x27fd('0x7'))(_0x27fd('0x8'));var config=require(_0x27fd('0x9'));var jayson=require(_0x27fd('0xa'));var client=jayson['client'][_0x27fd('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4ee452,_0xbc9142,_0x1ce2e7){return new BPromise(function(_0x5ac7f7,_0x33f47e){return client['request'](_0x4ee452,_0x1ce2e7)[_0x27fd('0xc')](function(_0x226048){logger['info'](_0x27fd('0xd'),_0xbc9142,_0x27fd('0xe'));logger[_0x27fd('0xf')]('Condition,\x20%s,\x20%s,\x20%s',_0xbc9142,_0x27fd('0xe'),JSON['stringify'](_0x226048));if(_0x226048[_0x27fd('0x10')]){if(_0x226048[_0x27fd('0x10')]['code']===0x1f4){logger[_0x27fd('0x10')]('Condition,\x20%s,\x20%s',_0xbc9142,_0x226048['error'][_0x27fd('0x11')]);return _0x33f47e(_0x226048[_0x27fd('0x10')][_0x27fd('0x11')]);}logger[_0x27fd('0x10')](_0x27fd('0xd'),_0xbc9142,_0x226048[_0x27fd('0x10')][_0x27fd('0x11')]);return _0x5ac7f7(_0x226048[_0x27fd('0x10')][_0x27fd('0x11')]);}else{logger['info']('Condition,\x20%s,\x20%s',_0xbc9142,'request\x20sent');_0x5ac7f7(_0x226048[_0x27fd('0x12')][_0x27fd('0x11')]);}})[_0x27fd('0x13')](function(_0x1d16bb){logger[_0x27fd('0x10')](_0x27fd('0xd'),_0xbc9142,_0x1d16bb);_0x33f47e(_0x1d16bb);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index 4b94c0b..5b0e990 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 _0x757a=['destroy','exports','util','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./condition.controller','/:id','isAuthenticated','update','delete'];(function(_0x54fd,_0x42c47b){var _0x5b929e=function(_0x3dbfff){while(--_0x3dbfff){_0x54fd['push'](_0x54fd['shift']());}};_0x5b929e(++_0x42c47b);}(_0x757a,0x1af));var _0xa757=function(_0x35ec88,_0x2ab4a3){_0x35ec88=_0x35ec88-0x0;var _0x1a9266=_0x757a[_0x35ec88];return _0x1a9266;};'use strict';var multer=require('multer');var util=require(_0xa757('0x0'));var path=require('path');var timeout=require(_0xa757('0x1'));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['put'](_0xa757('0x7'),auth[_0xa757('0x8')](),controller[_0xa757('0x9')]);router[_0xa757('0xa')](_0xa757('0x7'),auth[_0xa757('0x8')](),controller[_0xa757('0xb')]);module[_0xa757('0xc')]=router; \ No newline at end of file +var _0x6060=['isAuthenticated','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','put','/:id'];(function(_0x2f1ac9,_0x29d60b){var _0x2a063c=function(_0x578f16){while(--_0x578f16){_0x2f1ac9['push'](_0x2f1ac9['shift']());}};_0x2a063c(++_0x29d60b);}(_0x6060,0x113));var _0x0606=function(_0x24ecff,_0x5f0aca){_0x24ecff=_0x24ecff-0x0;var _0x38984c=_0x6060[_0x24ecff];return _0x38984c;};'use strict';var multer=require('multer');var util=require(_0x0606('0x0'));var path=require(_0x0606('0x1'));var timeout=require(_0x0606('0x2'));var express=require(_0x0606('0x3'));var router=express[_0x0606('0x4')]();var fs_extra=require(_0x0606('0x5'));var auth=require(_0x0606('0x6'));var interaction=require(_0x0606('0x7'));var config=require('../../config/environment');var controller=require('./condition.controller');router[_0x0606('0x8')](_0x0606('0x9'),auth[_0x0606('0xa')](),controller[_0x0606('0xb')]);router[_0x0606('0xc')](_0x0606('0x9'),auth['isAuthenticated'](),controller[_0x0606('0xd')]);module[_0x0606('0xe')]=router; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.attributes.js b/server/api/contactItemType/contactItemType.attributes.js index 4ac838b..f954562 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 _0x88c8=['name','INTEGER','STRING','sequelize','exports'];(function(_0x4874c2,_0x3ce845){var _0x3cdd3e=function(_0x3946b7){while(--_0x3946b7){_0x4874c2['push'](_0x4874c2['shift']());}};_0x3cdd3e(++_0x3ce845);}(_0x88c8,0x99));var _0x888c=function(_0x1a9d17,_0x285987){_0x1a9d17=_0x1a9d17-0x0;var _0x18f746=_0x88c8[_0x1a9d17];return _0x18f746;};'use strict';var Sequelize=require(_0x888c('0x0'));module[_0x888c('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x888c('0x2')},'OrderBy':{'type':Sequelize[_0x888c('0x3')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0x888c('0x4')],'allowNull':!![]}}; \ No newline at end of file +var _0xec04=['exports','STRING','INTEGER'];(function(_0x54e2bf,_0x7d660f){var _0x26a070=function(_0x55e3dc){while(--_0x55e3dc){_0x54e2bf['push'](_0x54e2bf['shift']());}};_0x26a070(++_0x7d660f);}(_0xec04,0x84));var _0x4ec0=function(_0x606a3a,_0x25b464){_0x606a3a=_0x606a3a-0x0;var _0x279fe7=_0xec04[_0x606a3a];return _0x279fe7;};'use strict';var Sequelize=require('sequelize');module[_0x4ec0('0x0')]={'name':{'type':Sequelize[_0x4ec0('0x1')],'allowNull':![],'unique':'name'},'OrderBy':{'type':Sequelize[_0x4ec0('0x2')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.controller.js b/server/api/contactItemType/contactItemType.controller.js index 150aa88..994c060 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 _0x6a55=['../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','apply','update','then','destroy','get','ContactItemTypes','UserProfileResource','end','error','name','index','map','ContactItemType','rawAttributes','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','include','rows','catch','show','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','userProfileId','autoAssociation','params','CmContactHasItem','eml-format','request-promise','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x263a74,_0xc31414){var _0x2aa86c=function(_0x382896){while(--_0x382896){_0x263a74['push'](_0x263a74['shift']());}};_0x2aa86c(++_0xc31414);}(_0x6a55,0xdb));var _0x56a5=function(_0x2e41e2,_0x4e7250){_0x2e41e2=_0x2e41e2-0x0;var _0x2844d6=_0x6a55[_0x2e41e2];return _0x2844d6;};'use strict';var emlformat=require(_0x56a5('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x56a5('0x1'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x56a5('0x2'));var util=require('util');var path=require(_0x56a5('0x3'));var sox=require('sox');var csv=require(_0x56a5('0x4'));var ejs=require(_0x56a5('0x5'));var fs=require('fs');var fs_extra=require(_0x56a5('0x6'));var _=require(_0x56a5('0x7'));var squel=require(_0x56a5('0x8'));var crypto=require(_0x56a5('0x9'));var jsforce=require(_0x56a5('0xa'));var deskjs=require(_0x56a5('0xb'));var toCsv=require('to-csv');var querystring=require(_0x56a5('0xc'));var Papa=require(_0x56a5('0xd'));var Redis=require(_0x56a5('0xe'));var authService=require(_0x56a5('0xf'));var qs=require(_0x56a5('0x10'));var as=require(_0x56a5('0x11'));var hardwareService=require(_0x56a5('0x12'));var logger=require(_0x56a5('0x13'))(_0x56a5('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x56a5('0x15'));var db=require(_0x56a5('0x16'))['db'];function respondWithStatusCode(_0x2b9d7d,_0x1a9bf0){_0x1a9bf0=_0x1a9bf0||0xcc;return function(_0x2de420){if(_0x2de420){return _0x2b9d7d[_0x56a5('0x17')](_0x1a9bf0);}return _0x2b9d7d['status'](_0x1a9bf0)['end']();};}function respondWithResult(_0x3e3ff6,_0x1e416f){_0x1e416f=_0x1e416f||0xc8;return function(_0x176c7b){if(_0x176c7b){return _0x3e3ff6[_0x56a5('0x18')](_0x1e416f)[_0x56a5('0x19')](_0x176c7b);}};}function respondWithFilteredResult(_0x2db112,_0xe3091f){return function(_0x5c4028){if(_0x5c4028){var _0x360297=typeof _0xe3091f['offset']===_0x56a5('0x1a')&&typeof _0xe3091f['limit']===_0x56a5('0x1a');var _0x3f3e5b=_0x5c4028[_0x56a5('0x1b')];var _0x28fe74=_0x360297?0x0:_0xe3091f[_0x56a5('0x1c')];var _0x143f3d=_0x360297?_0x5c4028[_0x56a5('0x1b')]:_0xe3091f['offset']+_0xe3091f[_0x56a5('0x1d')];var _0x3db687;if(_0x143f3d>=_0x3f3e5b){_0x143f3d=_0x3f3e5b;_0x3db687=0xc8;}else{_0x3db687=0xce;}_0x2db112[_0x56a5('0x18')](_0x3db687);return _0x2db112[_0x56a5('0x1e')]('Content-Range',_0x28fe74+'-'+_0x143f3d+'/'+_0x3f3e5b)[_0x56a5('0x19')](_0x5c4028);}return null;};}function patchUpdates(_0x1fdb7a){return function(_0xa274f4){try{jsonpatch[_0x56a5('0x1f')](_0xa274f4,_0x1fdb7a,!![]);}catch(_0x155d3b){return BPromise['reject'](_0x155d3b);}return _0xa274f4['save']();};}function saveUpdates(_0x29f181,_0x1c4ab8){return function(_0x487505){if(_0x487505){return _0x487505[_0x56a5('0x20')](_0x29f181)[_0x56a5('0x21')](function(_0x615d49){return _0x615d49;});}return null;};}function removeEntity(_0x15d9f8,_0xe1ded0){return function(_0x616922){if(_0x616922){return _0x616922[_0x56a5('0x22')]()[_0x56a5('0x21')](function(){var _0x2f4514=_0x616922[_0x56a5('0x23')]({'plain':!![]});var _0xcf212=_0x56a5('0x24');return db[_0x56a5('0x25')]['destroy']({'where':{'type':_0xcf212,'resourceId':_0x2f4514['id']}})[_0x56a5('0x21')](function(){return _0x616922;});})[_0x56a5('0x21')](function(){_0x15d9f8[_0x56a5('0x18')](0xcc)[_0x56a5('0x26')]();});}};}function handleEntityNotFound(_0x43a815,_0x527e84){return function(_0x18e863){if(!_0x18e863){_0x43a815['sendStatus'](0x194);}return _0x18e863;};}function handleError(_0x2efde7,_0x3c6ac1){_0x3c6ac1=_0x3c6ac1||0x1f4;return function(_0x1b27b5){logger[_0x56a5('0x27')](_0x1b27b5['stack']);if(_0x1b27b5[_0x56a5('0x28')]){delete _0x1b27b5[_0x56a5('0x28')];}_0x2efde7[_0x56a5('0x18')](_0x3c6ac1)['send'](_0x1b27b5);};}exports[_0x56a5('0x29')]=function(_0x29dbe7,_0xeb4378){var _0x214649={},_0x55978e={},_0x4e1a6b={'count':0x0,'rows':[]};var _0x78b2b1=_[_0x56a5('0x2a')](db[_0x56a5('0x2b')][_0x56a5('0x2c')],function(_0x643937){return{'name':_0x643937['fieldName'],'type':_0x643937['type'][_0x56a5('0x2d')]};});_0x55978e[_0x56a5('0x2e')]=_[_0x56a5('0x2a')](_0x78b2b1,'name');_0x55978e[_0x56a5('0x2f')]=_[_0x56a5('0x30')](_0x29dbe7['query']);_0x55978e['filters']=_['intersection'](_0x55978e['model'],_0x55978e[_0x56a5('0x2f')]);_0x214649[_0x56a5('0x31')]=_[_0x56a5('0x32')](_0x55978e['model'],qs[_0x56a5('0x33')](_0x29dbe7['query'][_0x56a5('0x33')]));_0x214649[_0x56a5('0x31')]=_0x214649['attributes'][_0x56a5('0x34')]?_0x214649['attributes']:_0x55978e[_0x56a5('0x2e')];if(!_0x29dbe7[_0x56a5('0x2f')][_0x56a5('0x35')]('nolimit')){_0x214649[_0x56a5('0x1d')]=qs[_0x56a5('0x1d')](_0x29dbe7[_0x56a5('0x2f')]['limit']);_0x214649[_0x56a5('0x1c')]=qs[_0x56a5('0x1c')](_0x29dbe7[_0x56a5('0x2f')][_0x56a5('0x1c')]);}_0x214649[_0x56a5('0x36')]=qs['sort'](_0x29dbe7['query'][_0x56a5('0x37')]);_0x214649[_0x56a5('0x38')]=qs[_0x56a5('0x39')](_[_0x56a5('0x3a')](_0x29dbe7[_0x56a5('0x2f')],_0x55978e[_0x56a5('0x39')]),_0x78b2b1);if(_0x29dbe7[_0x56a5('0x2f')][_0x56a5('0x3b')]){_0x214649[_0x56a5('0x38')]=_[_0x56a5('0x3c')](_0x214649[_0x56a5('0x38')],{'$or':_[_0x56a5('0x2a')](_0x78b2b1,function(_0x184186){if(_0x184186[_0x56a5('0x3d')]!==_0x56a5('0x3e')){var _0x32318c={};_0x32318c[_0x184186[_0x56a5('0x28')]]={'$like':'%'+_0x29dbe7[_0x56a5('0x2f')][_0x56a5('0x3b')]+'%'};return _0x32318c;}})});}_0x214649=_[_0x56a5('0x3c')]({},_0x214649,_0x29dbe7[_0x56a5('0x3f')]);var _0x1cca30={'where':_0x214649['where']};return db['ContactItemType'][_0x56a5('0x1b')](_0x1cca30)['then'](function(_0x7c3c3e){_0x4e1a6b[_0x56a5('0x1b')]=_0x7c3c3e;if(_0x29dbe7[_0x56a5('0x2f')][_0x56a5('0x40')]){_0x214649[_0x56a5('0x41')]=[{'all':!![]}];}return db[_0x56a5('0x2b')]['findAll'](_0x214649);})['then'](function(_0x29ab9b){_0x4e1a6b[_0x56a5('0x42')]=_0x29ab9b;return _0x4e1a6b;})[_0x56a5('0x21')](respondWithFilteredResult(_0xeb4378,_0x214649))[_0x56a5('0x43')](handleError(_0xeb4378,null));};exports[_0x56a5('0x44')]=function(_0x2ae3ea,_0x50f029){var _0x1191d0={'raw':!![],'where':{'id':_0x2ae3ea['params']['id']}},_0x252c94={};_0x252c94[_0x56a5('0x2e')]=_[_0x56a5('0x30')](db[_0x56a5('0x2b')][_0x56a5('0x2c')]);_0x252c94['query']=_[_0x56a5('0x30')](_0x2ae3ea['query']);_0x252c94[_0x56a5('0x39')]=_[_0x56a5('0x32')](_0x252c94['model'],_0x252c94[_0x56a5('0x2f')]);_0x1191d0['attributes']=_[_0x56a5('0x32')](_0x252c94[_0x56a5('0x2e')],qs['fields'](_0x2ae3ea[_0x56a5('0x2f')]['fields']));_0x1191d0[_0x56a5('0x31')]=_0x1191d0['attributes'][_0x56a5('0x34')]?_0x1191d0['attributes']:_0x252c94[_0x56a5('0x2e')];if(_0x2ae3ea[_0x56a5('0x2f')][_0x56a5('0x40')]){_0x1191d0[_0x56a5('0x41')]=[{'all':!![]}];}_0x1191d0=_[_0x56a5('0x3c')]({},_0x1191d0,_0x2ae3ea[_0x56a5('0x3f')]);return db[_0x56a5('0x2b')]['find'](_0x1191d0)['then'](handleEntityNotFound(_0x50f029,null))['then'](respondWithResult(_0x50f029,null))[_0x56a5('0x43')](handleError(_0x50f029,null));};exports[_0x56a5('0x45')]=function(_0x1e510a,_0x55d2e2){return db[_0x56a5('0x2b')][_0x56a5('0x45')](_0x1e510a[_0x56a5('0x46')],{})['then'](function(_0x19829f){var _0x3e38b9=_0x1e510a['user'][_0x56a5('0x23')]({'plain':!![]});if(!_0x3e38b9)throw new Error(_0x56a5('0x47'));if(_0x3e38b9[_0x56a5('0x48')]===_0x56a5('0x49')){var _0xcb3cb9=_0x19829f['get']({'plain':!![]});var _0x2b1fcb=_0x56a5('0x24');return db[_0x56a5('0x4a')][_0x56a5('0x4b')]({'where':{'name':_0x2b1fcb,'userProfileId':_0x3e38b9[_0x56a5('0x4c')]},'raw':!![]})['then'](function(_0x22be73){if(_0x22be73&&_0x22be73[_0x56a5('0x4d')]===0x0){return db['UserProfileResource'][_0x56a5('0x45')]({'name':_0xcb3cb9[_0x56a5('0x28')],'resourceId':_0xcb3cb9['id'],'type':_0x22be73[_0x56a5('0x28')],'sectionId':_0x22be73['id']},{})['then'](function(){return _0x19829f;});}else{return _0x19829f;}})[_0x56a5('0x43')](function(_0x5c41a9){logger[_0x56a5('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5c41a9);throw _0x5c41a9;});}return _0x19829f;})[_0x56a5('0x21')](respondWithResult(_0x55d2e2,0xc9))[_0x56a5('0x43')](handleError(_0x55d2e2,null));};exports[_0x56a5('0x20')]=function(_0x14647d,_0x4afdb9){if(_0x14647d[_0x56a5('0x46')]['id']){delete _0x14647d['body']['id'];}return db[_0x56a5('0x2b')][_0x56a5('0x4b')]({'where':{'id':_0x14647d[_0x56a5('0x4e')]['id']}})[_0x56a5('0x21')](handleEntityNotFound(_0x4afdb9,null))[_0x56a5('0x21')](saveUpdates(_0x14647d[_0x56a5('0x46')],null))[_0x56a5('0x21')](respondWithResult(_0x4afdb9,null))[_0x56a5('0x43')](handleError(_0x4afdb9,null));};exports[_0x56a5('0x22')]=function(_0x76c6bb,_0x5279fe){return db[_0x56a5('0x2b')][_0x56a5('0x4b')]({'where':{'id':_0x76c6bb['params']['id']}})[_0x56a5('0x21')](handleEntityNotFound(_0x5279fe,null))['then'](db[_0x56a5('0x4f')][_0x56a5('0x20')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x76c6bb[_0x56a5('0x4e')]['id']}}))[_0x56a5('0x21')](removeEntity(_0x5279fe,null))[_0x56a5('0x43')](handleError(_0x5279fe,null));}; \ No newline at end of file +var _0xf2e3=['../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','get','UserProfileResource','then','stack','name','index','ContactItemType','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','options','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','ContactItemTypes','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','find','params','destroy','eml-format','zip-dir','fast-json-patch','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/logger','api'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xf2e3,0x9b));var _0x3f2e=function(_0x40220a,_0x22feb1){_0x40220a=_0x40220a-0x0;var _0x3903cc=_0xf2e3[_0x40220a];return _0x3903cc;};'use strict';var emlformat=require(_0x3f2e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3f2e('0x1'));var jsonpatch=require(_0x3f2e('0x2'));var rp=require(_0x3f2e('0x3'));var moment=require(_0x3f2e('0x4'));var BPromise=require(_0x3f2e('0x5'));var Mustache=require(_0x3f2e('0x6'));var util=require(_0x3f2e('0x7'));var path=require(_0x3f2e('0x8'));var sox=require(_0x3f2e('0x9'));var csv=require('to-csv');var ejs=require(_0x3f2e('0xa'));var fs=require('fs');var fs_extra=require(_0x3f2e('0xb'));var _=require(_0x3f2e('0xc'));var squel=require(_0x3f2e('0xd'));var crypto=require(_0x3f2e('0xe'));var jsforce=require(_0x3f2e('0xf'));var deskjs=require(_0x3f2e('0x10'));var toCsv=require(_0x3f2e('0x11'));var querystring=require(_0x3f2e('0x12'));var Papa=require(_0x3f2e('0x13'));var Redis=require(_0x3f2e('0x14'));var authService=require(_0x3f2e('0x15'));var qs=require(_0x3f2e('0x16'));var as=require(_0x3f2e('0x17'));var hardwareService=require(_0x3f2e('0x18'));var logger=require(_0x3f2e('0x19'))(_0x3f2e('0x1a'));var utils=require(_0x3f2e('0x1b'));var config=require(_0x3f2e('0x1c'));var licenseUtil=require('../../config/license/util');var db=require(_0x3f2e('0x1d'))['db'];function respondWithStatusCode(_0xaa6ef5,_0x5471f9){_0x5471f9=_0x5471f9||0xcc;return function(_0xe83663){if(_0xe83663){return _0xaa6ef5[_0x3f2e('0x1e')](_0x5471f9);}return _0xaa6ef5[_0x3f2e('0x1f')](_0x5471f9)[_0x3f2e('0x20')]();};}function respondWithResult(_0x3d20d1,_0x57cba7){_0x57cba7=_0x57cba7||0xc8;return function(_0x298080){if(_0x298080){return _0x3d20d1[_0x3f2e('0x1f')](_0x57cba7)[_0x3f2e('0x21')](_0x298080);}};}function respondWithFilteredResult(_0x4f2e38,_0x43f69e){return function(_0x218b44){if(_0x218b44){var _0x17ef58=typeof _0x43f69e[_0x3f2e('0x22')]===_0x3f2e('0x23')&&typeof _0x43f69e[_0x3f2e('0x24')]===_0x3f2e('0x23');var _0x155411=_0x218b44[_0x3f2e('0x25')];var _0xc00add=_0x17ef58?0x0:_0x43f69e[_0x3f2e('0x22')];var _0x5b9989=_0x17ef58?_0x218b44[_0x3f2e('0x25')]:_0x43f69e[_0x3f2e('0x22')]+_0x43f69e[_0x3f2e('0x24')];var _0xbe899c;if(_0x5b9989>=_0x155411){_0x5b9989=_0x155411;_0xbe899c=0xc8;}else{_0xbe899c=0xce;}_0x4f2e38[_0x3f2e('0x1f')](_0xbe899c);return _0x4f2e38['set']('Content-Range',_0xc00add+'-'+_0x5b9989+'/'+_0x155411)[_0x3f2e('0x21')](_0x218b44);}return null;};}function patchUpdates(_0x11f84c){return function(_0x38bbae){try{jsonpatch[_0x3f2e('0x26')](_0x38bbae,_0x11f84c,!![]);}catch(_0x4381e5){return BPromise[_0x3f2e('0x27')](_0x4381e5);}return _0x38bbae['save']();};}function saveUpdates(_0x5a7047,_0xf81165){return function(_0x37dab2){if(_0x37dab2){return _0x37dab2['update'](_0x5a7047)['then'](function(_0x46bb1c){return _0x46bb1c;});}return null;};}function removeEntity(_0x5646f5,_0x1b8c67){return function(_0x401ed9){if(_0x401ed9){return _0x401ed9['destroy']()['then'](function(){var _0x52803d=_0x401ed9[_0x3f2e('0x28')]({'plain':!![]});var _0x3d7631='ContactItemTypes';return db[_0x3f2e('0x29')]['destroy']({'where':{'type':_0x3d7631,'resourceId':_0x52803d['id']}})[_0x3f2e('0x2a')](function(){return _0x401ed9;});})['then'](function(){_0x5646f5[_0x3f2e('0x1f')](0xcc)[_0x3f2e('0x20')]();});}};}function handleEntityNotFound(_0x12926e,_0x9c6c34){return function(_0x11bad1){if(!_0x11bad1){_0x12926e['sendStatus'](0x194);}return _0x11bad1;};}function handleError(_0x426d68,_0x28ef64){_0x28ef64=_0x28ef64||0x1f4;return function(_0x5eab38){logger['error'](_0x5eab38[_0x3f2e('0x2b')]);if(_0x5eab38[_0x3f2e('0x2c')]){delete _0x5eab38[_0x3f2e('0x2c')];}_0x426d68[_0x3f2e('0x1f')](_0x28ef64)['send'](_0x5eab38);};}exports[_0x3f2e('0x2d')]=function(_0x465a94,_0x37ddfe){var _0x4d9b8c={},_0x349ed4={},_0x2741d0={'count':0x0,'rows':[]};var _0xa6a8ab=_['map'](db[_0x3f2e('0x2e')][_0x3f2e('0x2f')],function(_0x71568e){return{'name':_0x71568e[_0x3f2e('0x30')],'type':_0x71568e[_0x3f2e('0x31')][_0x3f2e('0x32')]};});_0x349ed4['model']=_[_0x3f2e('0x33')](_0xa6a8ab,_0x3f2e('0x2c'));_0x349ed4[_0x3f2e('0x34')]=_[_0x3f2e('0x35')](_0x465a94[_0x3f2e('0x34')]);_0x349ed4[_0x3f2e('0x36')]=_[_0x3f2e('0x37')](_0x349ed4['model'],_0x349ed4[_0x3f2e('0x34')]);_0x4d9b8c[_0x3f2e('0x38')]=_[_0x3f2e('0x37')](_0x349ed4[_0x3f2e('0x39')],qs['fields'](_0x465a94['query'][_0x3f2e('0x3a')]));_0x4d9b8c[_0x3f2e('0x38')]=_0x4d9b8c[_0x3f2e('0x38')][_0x3f2e('0x3b')]?_0x4d9b8c[_0x3f2e('0x38')]:_0x349ed4[_0x3f2e('0x39')];if(!_0x465a94[_0x3f2e('0x34')][_0x3f2e('0x3c')](_0x3f2e('0x3d'))){_0x4d9b8c[_0x3f2e('0x24')]=qs['limit'](_0x465a94[_0x3f2e('0x34')][_0x3f2e('0x24')]);_0x4d9b8c[_0x3f2e('0x22')]=qs[_0x3f2e('0x22')](_0x465a94['query'][_0x3f2e('0x22')]);}_0x4d9b8c[_0x3f2e('0x3e')]=qs[_0x3f2e('0x3f')](_0x465a94[_0x3f2e('0x34')][_0x3f2e('0x3f')]);_0x4d9b8c[_0x3f2e('0x40')]=qs[_0x3f2e('0x36')](_[_0x3f2e('0x41')](_0x465a94['query'],_0x349ed4[_0x3f2e('0x36')]),_0xa6a8ab);if(_0x465a94[_0x3f2e('0x34')][_0x3f2e('0x42')]){_0x4d9b8c[_0x3f2e('0x40')]=_['merge'](_0x4d9b8c[_0x3f2e('0x40')],{'$or':_[_0x3f2e('0x33')](_0xa6a8ab,function(_0x4cb56b){if(_0x4cb56b[_0x3f2e('0x31')]!==_0x3f2e('0x43')){var _0x596124={};_0x596124[_0x4cb56b[_0x3f2e('0x2c')]]={'$like':'%'+_0x465a94[_0x3f2e('0x34')][_0x3f2e('0x42')]+'%'};return _0x596124;}})});}_0x4d9b8c=_[_0x3f2e('0x44')]({},_0x4d9b8c,_0x465a94['options']);var _0x39d324={'where':_0x4d9b8c[_0x3f2e('0x40')]};return db['ContactItemType']['count'](_0x39d324)[_0x3f2e('0x2a')](function(_0x23de01){_0x2741d0[_0x3f2e('0x25')]=_0x23de01;if(_0x465a94['query'][_0x3f2e('0x45')]){_0x4d9b8c[_0x3f2e('0x46')]=[{'all':!![]}];}return db[_0x3f2e('0x2e')][_0x3f2e('0x47')](_0x4d9b8c);})[_0x3f2e('0x2a')](function(_0x3668dc){_0x2741d0[_0x3f2e('0x48')]=_0x3668dc;return _0x2741d0;})[_0x3f2e('0x2a')](respondWithFilteredResult(_0x37ddfe,_0x4d9b8c))[_0x3f2e('0x49')](handleError(_0x37ddfe,null));};exports[_0x3f2e('0x4a')]=function(_0x50f446,_0x5d14b7){var _0x32f295={'raw':!![],'where':{'id':_0x50f446['params']['id']}},_0x38900c={};_0x38900c['model']=_[_0x3f2e('0x35')](db[_0x3f2e('0x2e')][_0x3f2e('0x2f')]);_0x38900c['query']=_[_0x3f2e('0x35')](_0x50f446[_0x3f2e('0x34')]);_0x38900c[_0x3f2e('0x36')]=_['intersection'](_0x38900c[_0x3f2e('0x39')],_0x38900c[_0x3f2e('0x34')]);_0x32f295[_0x3f2e('0x38')]=_['intersection'](_0x38900c[_0x3f2e('0x39')],qs[_0x3f2e('0x3a')](_0x50f446[_0x3f2e('0x34')]['fields']));_0x32f295[_0x3f2e('0x38')]=_0x32f295['attributes'][_0x3f2e('0x3b')]?_0x32f295['attributes']:_0x38900c['model'];if(_0x50f446[_0x3f2e('0x34')][_0x3f2e('0x45')]){_0x32f295[_0x3f2e('0x46')]=[{'all':!![]}];}_0x32f295=_[_0x3f2e('0x44')]({},_0x32f295,_0x50f446[_0x3f2e('0x4b')]);return db['ContactItemType']['find'](_0x32f295)[_0x3f2e('0x2a')](handleEntityNotFound(_0x5d14b7,null))[_0x3f2e('0x2a')](respondWithResult(_0x5d14b7,null))[_0x3f2e('0x49')](handleError(_0x5d14b7,null));};exports[_0x3f2e('0x4c')]=function(_0x39dbd1,_0xb891b2){return db[_0x3f2e('0x2e')][_0x3f2e('0x4c')](_0x39dbd1[_0x3f2e('0x4d')],{})['then'](function(_0x4f65fe){var _0x2fe0c3=_0x39dbd1['user'][_0x3f2e('0x28')]({'plain':!![]});if(!_0x2fe0c3)throw new Error(_0x3f2e('0x4e'));if(_0x2fe0c3[_0x3f2e('0x4f')]===_0x3f2e('0x50')){var _0x4b6950=_0x4f65fe[_0x3f2e('0x28')]({'plain':!![]});var _0x4e7491=_0x3f2e('0x51');return db[_0x3f2e('0x52')]['find']({'where':{'name':_0x4e7491,'userProfileId':_0x2fe0c3[_0x3f2e('0x53')]},'raw':!![]})['then'](function(_0x81a50d){if(_0x81a50d&&_0x81a50d[_0x3f2e('0x54')]===0x0){return db[_0x3f2e('0x29')]['create']({'name':_0x4b6950[_0x3f2e('0x2c')],'resourceId':_0x4b6950['id'],'type':_0x81a50d[_0x3f2e('0x2c')],'sectionId':_0x81a50d['id']},{})[_0x3f2e('0x2a')](function(){return _0x4f65fe;});}else{return _0x4f65fe;}})[_0x3f2e('0x49')](function(_0x3c4cbe){logger[_0x3f2e('0x55')](_0x3f2e('0x56'),_0x3c4cbe);throw _0x3c4cbe;});}return _0x4f65fe;})[_0x3f2e('0x2a')](respondWithResult(_0xb891b2,0xc9))[_0x3f2e('0x49')](handleError(_0xb891b2,null));};exports[_0x3f2e('0x57')]=function(_0x519afe,_0x2634a1){if(_0x519afe[_0x3f2e('0x4d')]['id']){delete _0x519afe[_0x3f2e('0x4d')]['id'];}return db[_0x3f2e('0x2e')][_0x3f2e('0x58')]({'where':{'id':_0x519afe[_0x3f2e('0x59')]['id']}})[_0x3f2e('0x2a')](handleEntityNotFound(_0x2634a1,null))[_0x3f2e('0x2a')](saveUpdates(_0x519afe['body'],null))[_0x3f2e('0x2a')](respondWithResult(_0x2634a1,null))[_0x3f2e('0x49')](handleError(_0x2634a1,null));};exports[_0x3f2e('0x5a')]=function(_0xb6e744,_0x11f48d){return db['ContactItemType']['find']({'where':{'id':_0xb6e744[_0x3f2e('0x59')]['id']}})[_0x3f2e('0x2a')](handleEntityNotFound(_0x11f48d,null))[_0x3f2e('0x2a')](db['CmContactHasItem']['update']({'ItemTypeId':null},{'where':{'ItemTypeId':_0xb6e744['params']['id']}}))[_0x3f2e('0x2a')](removeEntity(_0x11f48d,null))[_0x3f2e('0x49')](handleError(_0x11f48d,null));}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.model.js b/server/api/contactItemType/contactItemType.model.js index 4595730..fb62a55 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 _0x7373=['ContactItemType','lodash','util','../../config/logger','api','request-promise','rimraf','../../config/environment','./contactItemType.attributes','exports','define'];(function(_0x17281a,_0x487e8d){var _0x309717=function(_0x3a44ea){while(--_0x3a44ea){_0x17281a['push'](_0x17281a['shift']());}};_0x309717(++_0x487e8d);}(_0x7373,0x182));var _0x3737=function(_0x2115cd,_0x20c0da){_0x2115cd=_0x2115cd-0x0;var _0x3e935e=_0x7373[_0x2115cd];return _0x3e935e;};'use strict';var _=require(_0x3737('0x0'));var util=require(_0x3737('0x1'));var logger=require(_0x3737('0x2'))(_0x3737('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x3737('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3737('0x5'));var config=require(_0x3737('0x6'));var attributes=require(_0x3737('0x7'));module[_0x3737('0x8')]=function(_0x56902d,_0x5acb27){return _0x56902d[_0x3737('0x9')](_0x3737('0xa'),attributes,{'tableName':'tools_contact_item_types','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x64a5=['request-promise','path','../../config/environment','./contactItemType.attributes','exports','define','ContactItemType','tools_contact_item_types','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x1e003b,_0x3e4ded){var _0x268789=function(_0x559062){while(--_0x559062){_0x1e003b['push'](_0x1e003b['shift']());}};_0x268789(++_0x3e4ded);}(_0x64a5,0x86));var _0x564a=function(_0x5e378c,_0x534b69){_0x5e378c=_0x5e378c-0x0;var _0x33e9cf=_0x64a5[_0x5e378c];return _0x33e9cf;};'use strict';var _=require(_0x564a('0x0'));var util=require(_0x564a('0x1'));var logger=require(_0x564a('0x2'))(_0x564a('0x3'));var moment=require(_0x564a('0x4'));var BPromise=require(_0x564a('0x5'));var rp=require(_0x564a('0x6'));var fs=require('fs');var path=require(_0x564a('0x7'));var rimraf=require('rimraf');var config=require(_0x564a('0x8'));var attributes=require(_0x564a('0x9'));module[_0x564a('0xa')]=function(_0x5ab482,_0x4e7ed){return _0x5ab482[_0x564a('0xb')](_0x564a('0xc'),attributes,{'tableName':_0x564a('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.rpc.js b/server/api/contactItemType/contactItemType.rpc.js index f5ef0a5..b645bb5 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 _0xbf1a=['ContactItemType,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then'];(function(_0x18ab2a,_0x4debcd){var _0x16dcee=function(_0x10107a){while(--_0x10107a){_0x18ab2a['push'](_0x18ab2a['shift']());}};_0x16dcee(++_0x4debcd);}(_0xbf1a,0x16d));var _0xabf1=function(_0x40fd84,_0x2be8c0){_0x40fd84=_0x40fd84-0x0;var _0x2cb751=_0xbf1a[_0x40fd84];return _0x2cb751;};'use strict';var _=require(_0xabf1('0x0'));var util=require(_0xabf1('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xabf1('0x2'));var fs=require('fs');var Redis=require(_0xabf1('0x3'));var db=require(_0xabf1('0x4'))['db'];var utils=require(_0xabf1('0x5'));var logger=require(_0xabf1('0x6'))(_0xabf1('0x7'));var config=require(_0xabf1('0x8'));var jayson=require(_0xabf1('0x9'));var client=jayson[_0xabf1('0xa')][_0xabf1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2e5203,_0x4be08b,_0x1bf70e){return new BPromise(function(_0xcfec60,_0x48c89c){return client['request'](_0x2e5203,_0x1bf70e)[_0xabf1('0xc')](function(_0x2e36b6){logger['info'](_0xabf1('0xd'),_0x4be08b,'request\x20sent');logger[_0xabf1('0xe')]('ContactItemType,\x20%s,\x20%s,\x20%s',_0x4be08b,_0xabf1('0xf'),JSON['stringify'](_0x2e36b6));if(_0x2e36b6['error']){if(_0x2e36b6[_0xabf1('0x10')][_0xabf1('0x11')]===0x1f4){logger['error']('ContactItemType,\x20%s,\x20%s',_0x4be08b,_0x2e36b6[_0xabf1('0x10')]['message']);return _0x48c89c(_0x2e36b6[_0xabf1('0x10')][_0xabf1('0x12')]);}logger[_0xabf1('0x10')](_0xabf1('0xd'),_0x4be08b,_0x2e36b6[_0xabf1('0x10')][_0xabf1('0x12')]);return _0xcfec60(_0x2e36b6['error']['message']);}else{logger['info'](_0xabf1('0xd'),_0x4be08b,_0xabf1('0xf'));_0xcfec60(_0x2e36b6[_0xabf1('0x13')][_0xabf1('0x12')]);}})[_0xabf1('0x14')](function(_0x53c76e){logger[_0xabf1('0x10')](_0xabf1('0xd'),_0x4be08b,_0x53c76e);_0x48c89c(_0x53c76e);});});} \ No newline at end of file +var _0x7006=['client','http','request','then','info','ContactItemType,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise'];(function(_0xf2ce28,_0x2aa95e){var _0x27b9f0=function(_0x25f977){while(--_0x25f977){_0xf2ce28['push'](_0xf2ce28['shift']());}};_0x27b9f0(++_0x2aa95e);}(_0x7006,0xe8));var _0x6700=function(_0x209bbf,_0x2e2375){_0x209bbf=_0x209bbf-0x0;var _0x592d4b=_0x7006[_0x209bbf];return _0x592d4b;};'use strict';var _=require(_0x6700('0x0'));var util=require(_0x6700('0x1'));var moment=require(_0x6700('0x2'));var BPromise=require(_0x6700('0x3'));var rs=require(_0x6700('0x4'));var fs=require('fs');var Redis=require(_0x6700('0x5'));var db=require(_0x6700('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x6700('0x7'))(_0x6700('0x8'));var config=require('../../config/environment');var jayson=require(_0x6700('0x9'));var client=jayson[_0x6700('0xa')][_0x6700('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1461af,_0x48910e,_0xd9c345){return new BPromise(function(_0x4d34f,_0x326f53){return client[_0x6700('0xc')](_0x1461af,_0xd9c345)[_0x6700('0xd')](function(_0x13df87){logger[_0x6700('0xe')](_0x6700('0xf'),_0x48910e,_0x6700('0x10'));logger[_0x6700('0x11')]('ContactItemType,\x20%s,\x20%s,\x20%s',_0x48910e,_0x6700('0x10'),JSON['stringify'](_0x13df87));if(_0x13df87[_0x6700('0x12')]){if(_0x13df87[_0x6700('0x12')][_0x6700('0x13')]===0x1f4){logger[_0x6700('0x12')]('ContactItemType,\x20%s,\x20%s',_0x48910e,_0x13df87['error'][_0x6700('0x14')]);return _0x326f53(_0x13df87['error'][_0x6700('0x14')]);}logger[_0x6700('0x12')](_0x6700('0xf'),_0x48910e,_0x13df87[_0x6700('0x12')][_0x6700('0x14')]);return _0x4d34f(_0x13df87[_0x6700('0x12')]['message']);}else{logger[_0x6700('0xe')](_0x6700('0xf'),_0x48910e,_0x6700('0x10'));_0x4d34f(_0x13df87[_0x6700('0x15')][_0x6700('0x14')]);}})['catch'](function(_0x3f8771){logger['error'](_0x6700('0xf'),_0x48910e,_0x3f8771);_0x326f53(_0x3f8771);});});} \ No newline at end of file diff --git a/server/api/contactItemType/index.js b/server/api/contactItemType/index.js index ec4333a..cb7e078 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 _0x1ae1=['Router','../../config/environment','./contactItemType.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x5608a3,_0x5b33c5){var _0x1ed50a=function(_0x959171){while(--_0x959171){_0x5608a3['push'](_0x5608a3['shift']());}};_0x1ed50a(++_0x5b33c5);}(_0x1ae1,0xaf));var _0x11ae=function(_0x320537,_0x512777){_0x320537=_0x320537-0x0;var _0x5483f0=_0x1ae1[_0x320537];return _0x5483f0;};'use strict';var multer=require(_0x11ae('0x0'));var util=require(_0x11ae('0x1'));var path=require(_0x11ae('0x2'));var timeout=require(_0x11ae('0x3'));var express=require(_0x11ae('0x4'));var router=express[_0x11ae('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x11ae('0x6'));var controller=require(_0x11ae('0x7'));router[_0x11ae('0x8')]('/',auth[_0x11ae('0x9')](),controller[_0x11ae('0xa')]);router[_0x11ae('0x8')](_0x11ae('0xb'),auth[_0x11ae('0x9')](),controller[_0x11ae('0xc')]);router[_0x11ae('0xd')]('/',auth[_0x11ae('0x9')](),controller[_0x11ae('0xe')]);router[_0x11ae('0xf')](_0x11ae('0xb'),auth[_0x11ae('0x9')](),controller[_0x11ae('0x10')]);router[_0x11ae('0x11')]('/:id',auth[_0x11ae('0x9')](),controller[_0x11ae('0x12')]);module[_0x11ae('0x13')]=router; \ No newline at end of file +var _0x2ea6=['multer','path','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','post','create','delete'];(function(_0x1573ea,_0x434f02){var _0x51c0e2=function(_0x5c9b28){while(--_0x5c9b28){_0x1573ea['push'](_0x1573ea['shift']());}};_0x51c0e2(++_0x434f02);}(_0x2ea6,0xc3));var _0x62ea=function(_0x5e238b,_0x17ae49){_0x5e238b=_0x5e238b-0x0;var _0x389bea=_0x2ea6[_0x5e238b];return _0x389bea;};'use strict';var multer=require(_0x62ea('0x0'));var util=require('util');var path=require(_0x62ea('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x62ea('0x2')]();var fs_extra=require(_0x62ea('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x62ea('0x4'));var config=require(_0x62ea('0x5'));var controller=require('./contactItemType.controller');router[_0x62ea('0x6')]('/',auth[_0x62ea('0x7')](),controller[_0x62ea('0x8')]);router['get'](_0x62ea('0x9'),auth['isAuthenticated'](),controller['show']);router[_0x62ea('0xa')]('/',auth[_0x62ea('0x7')](),controller[_0x62ea('0xb')]);router['put'](_0x62ea('0x9'),auth[_0x62ea('0x7')](),controller['update']);router[_0x62ea('0xc')](_0x62ea('0x9'),auth[_0x62ea('0x7')](),controller['destroy']);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 82b4960..d25a718 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 _0x0713=['STRING','name'];(function(_0x4b4022,_0x1c388c){var _0x43e608=function(_0x1a9f01){while(--_0x1a9f01){_0x4b4022['push'](_0x4b4022['shift']());}};_0x43e608(++_0x1c388c);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x3071('0x0')],'allowNull':![],'unique':_0x3071('0x1')},'description':{'type':Sequelize[_0x3071('0x0')]}}; \ No newline at end of file +var _0x0713=['STRING','name'];(function(_0x28aa81,_0x57ed8c){var _0x5cfa62=function(_0x1359c3){while(--_0x1359c3){_0x28aa81['push'](_0x28aa81['shift']());}};_0x5cfa62(++_0x57ed8c);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x3071('0x0')],'allowNull':![],'unique':_0x3071('0x1')},'description':{'type':Sequelize[_0x3071('0x0')]}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index e332b51..587222f 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 _0xb334=['model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','params','catch','create','body','user','UserProfileSection','find','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','web-report','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardItem','getItems','findOne','map','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','register','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','get','CustomDashboards','UserProfileResource','stack','name','send','index','Dashboard','rawAttributes','fieldName','type','key','query','keys','filters','intersection'];(function(_0x2761a1,_0x1e9c00){var _0x11651e=function(_0x5996e1){while(--_0x5996e1){_0x2761a1['push'](_0x2761a1['shift']());}};_0x11651e(++_0x1e9c00);}(_0xb334,0x151));var _0x4b33=function(_0x591034,_0x5ef8da){_0x591034=_0x591034-0x0;var _0x3766c6=_0xb334[_0x591034];return _0x3766c6;};'use strict';var emlformat=require(_0x4b33('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4b33('0x1'));var jsonpatch=require(_0x4b33('0x2'));var rp=require(_0x4b33('0x3'));var moment=require(_0x4b33('0x4'));var BPromise=require(_0x4b33('0x5'));var Mustache=require('mustache');var util=require(_0x4b33('0x6'));var path=require(_0x4b33('0x7'));var sox=require('sox');var csv=require(_0x4b33('0x8'));var ejs=require(_0x4b33('0x9'));var fs=require('fs');var fs_extra=require(_0x4b33('0xa'));var _=require(_0x4b33('0xb'));var squel=require('squel');var crypto=require(_0x4b33('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x4b33('0x8'));var querystring=require(_0x4b33('0xd'));var Papa=require('papaparse');var Redis=require(_0x4b33('0xe'));var authService=require(_0x4b33('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x4b33('0x10'));var hardwareService=require(_0x4b33('0x11'));var logger=require(_0x4b33('0x12'))('api');var utils=require(_0x4b33('0x13'));var config=require(_0x4b33('0x14'));var licenseUtil=require(_0x4b33('0x15'));var db=require(_0x4b33('0x16'))['db'];config['redis']=_[_0x4b33('0x17')](config[_0x4b33('0x18')],{'host':_0x4b33('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4b33('0x18')]));require('./dashboard.socket')[_0x4b33('0x1a')](socket);function respondWithStatusCode(_0x30d8f5,_0x48d270){_0x48d270=_0x48d270||0xcc;return function(_0x22b977){if(_0x22b977){return _0x30d8f5[_0x4b33('0x1b')](_0x48d270);}return _0x30d8f5[_0x4b33('0x1c')](_0x48d270)[_0x4b33('0x1d')]();};}function respondWithResult(_0x4c3f85,_0x169e54){_0x169e54=_0x169e54||0xc8;return function(_0x119758){if(_0x119758){return _0x4c3f85[_0x4b33('0x1c')](_0x169e54)[_0x4b33('0x1e')](_0x119758);}};}function respondWithFilteredResult(_0x3f0caf,_0x1587a1){return function(_0x2a5c4c){if(_0x2a5c4c){var _0x2fae92=typeof _0x1587a1[_0x4b33('0x1f')]==='undefined'&&typeof _0x1587a1[_0x4b33('0x20')]===_0x4b33('0x21');var _0x334665=_0x2a5c4c[_0x4b33('0x22')];var _0x80b018=_0x2fae92?0x0:_0x1587a1['offset'];var _0x4d1af6=_0x2fae92?_0x2a5c4c[_0x4b33('0x22')]:_0x1587a1['offset']+_0x1587a1[_0x4b33('0x20')];var _0x270fd1;if(_0x4d1af6>=_0x334665){_0x4d1af6=_0x334665;_0x270fd1=0xc8;}else{_0x270fd1=0xce;}_0x3f0caf['status'](_0x270fd1);return _0x3f0caf[_0x4b33('0x23')](_0x4b33('0x24'),_0x80b018+'-'+_0x4d1af6+'/'+_0x334665)[_0x4b33('0x1e')](_0x2a5c4c);}return null;};}function patchUpdates(_0x402cd3){return function(_0x4cb5ca){try{jsonpatch[_0x4b33('0x25')](_0x4cb5ca,_0x402cd3,!![]);}catch(_0x43bb77){return BPromise[_0x4b33('0x26')](_0x43bb77);}return _0x4cb5ca[_0x4b33('0x27')]();};}function saveUpdates(_0x221261,_0x13504f){return function(_0x2412d6){if(_0x2412d6){return _0x2412d6[_0x4b33('0x28')](_0x221261)[_0x4b33('0x29')](function(_0x16cfbb){return _0x16cfbb;});}return null;};}function removeEntity(_0x4c436b,_0x1e2e8f){return function(_0x4354ac){if(_0x4354ac){return _0x4354ac[_0x4b33('0x2a')]()[_0x4b33('0x29')](function(){var _0x25fe9f=_0x4354ac[_0x4b33('0x2b')]({'plain':!![]});var _0x9e946=_0x4b33('0x2c');return db[_0x4b33('0x2d')][_0x4b33('0x2a')]({'where':{'type':_0x9e946,'resourceId':_0x25fe9f['id']}})[_0x4b33('0x29')](function(){return _0x4354ac;});})[_0x4b33('0x29')](function(){_0x4c436b[_0x4b33('0x1c')](0xcc)[_0x4b33('0x1d')]();});}};}function handleEntityNotFound(_0x6a637f,_0x460edb){return function(_0x2d033e){if(!_0x2d033e){_0x6a637f[_0x4b33('0x1b')](0x194);}return _0x2d033e;};}function handleError(_0x53c20f,_0x326c5f){_0x326c5f=_0x326c5f||0x1f4;return function(_0x2d0b8f){logger['error'](_0x2d0b8f[_0x4b33('0x2e')]);if(_0x2d0b8f[_0x4b33('0x2f')]){delete _0x2d0b8f[_0x4b33('0x2f')];}_0x53c20f[_0x4b33('0x1c')](_0x326c5f)[_0x4b33('0x30')](_0x2d0b8f);};}exports[_0x4b33('0x31')]=function(_0x3a7817,_0x276e8f){var _0x458f8d={},_0x20042d={},_0x1fb500={'count':0x0,'rows':[]};var _0x46109=_['map'](db[_0x4b33('0x32')][_0x4b33('0x33')],function(_0x5c807b){return{'name':_0x5c807b[_0x4b33('0x34')],'type':_0x5c807b[_0x4b33('0x35')][_0x4b33('0x36')]};});_0x20042d['model']=_['map'](_0x46109,_0x4b33('0x2f'));_0x20042d[_0x4b33('0x37')]=_[_0x4b33('0x38')](_0x3a7817['query']);_0x20042d[_0x4b33('0x39')]=_[_0x4b33('0x3a')](_0x20042d[_0x4b33('0x3b')],_0x20042d[_0x4b33('0x37')]);_0x458f8d['attributes']=_[_0x4b33('0x3a')](_0x20042d[_0x4b33('0x3b')],qs[_0x4b33('0x3c')](_0x3a7817[_0x4b33('0x37')][_0x4b33('0x3c')]));_0x458f8d['attributes']=_0x458f8d[_0x4b33('0x3d')][_0x4b33('0x3e')]?_0x458f8d[_0x4b33('0x3d')]:_0x20042d['model'];if(!_0x3a7817[_0x4b33('0x37')][_0x4b33('0x3f')](_0x4b33('0x40'))){_0x458f8d[_0x4b33('0x20')]=qs[_0x4b33('0x20')](_0x3a7817[_0x4b33('0x37')]['limit']);_0x458f8d[_0x4b33('0x1f')]=qs[_0x4b33('0x1f')](_0x3a7817[_0x4b33('0x37')][_0x4b33('0x1f')]);}_0x458f8d[_0x4b33('0x41')]=qs[_0x4b33('0x42')](_0x3a7817[_0x4b33('0x37')][_0x4b33('0x42')]);_0x458f8d[_0x4b33('0x43')]=qs['filters'](_[_0x4b33('0x44')](_0x3a7817[_0x4b33('0x37')],_0x20042d['filters']),_0x46109);if(_0x3a7817['query']['filter']){_0x458f8d[_0x4b33('0x43')]=_[_0x4b33('0x45')](_0x458f8d[_0x4b33('0x43')],{'$or':_['map'](_0x46109,function(_0x451581){if(_0x451581['type']!==_0x4b33('0x46')){var _0x565401={};_0x565401[_0x451581[_0x4b33('0x2f')]]={'$like':'%'+_0x3a7817[_0x4b33('0x37')][_0x4b33('0x47')]+'%'};return _0x565401;}})});}_0x458f8d=_[_0x4b33('0x45')]({},_0x458f8d,_0x3a7817[_0x4b33('0x48')]);var _0x5af64b={'where':_0x458f8d[_0x4b33('0x43')]};return db[_0x4b33('0x32')][_0x4b33('0x22')](_0x5af64b)[_0x4b33('0x29')](function(_0x47f4ea){_0x1fb500[_0x4b33('0x22')]=_0x47f4ea;if(_0x3a7817['query'][_0x4b33('0x49')]){_0x458f8d[_0x4b33('0x4a')]=[{'all':!![]}];}return db[_0x4b33('0x32')][_0x4b33('0x4b')](_0x458f8d);})[_0x4b33('0x29')](function(_0xfc420e){_0x1fb500[_0x4b33('0x4c')]=_0xfc420e;return _0x1fb500;})[_0x4b33('0x29')](respondWithFilteredResult(_0x276e8f,_0x458f8d))['catch'](handleError(_0x276e8f,null));};exports['show']=function(_0x5cc7bb,_0x2c262a){var _0x3ac7e2={'raw':![],'where':{'id':_0x5cc7bb[_0x4b33('0x4d')]['id']}},_0x3dd9cd={};_0x3dd9cd[_0x4b33('0x3b')]=_['keys'](db['Dashboard'][_0x4b33('0x33')]);_0x3dd9cd[_0x4b33('0x37')]=_[_0x4b33('0x38')](_0x5cc7bb[_0x4b33('0x37')]);_0x3dd9cd[_0x4b33('0x39')]=_[_0x4b33('0x3a')](_0x3dd9cd[_0x4b33('0x3b')],_0x3dd9cd[_0x4b33('0x37')]);_0x3ac7e2['attributes']=_[_0x4b33('0x3a')](_0x3dd9cd[_0x4b33('0x3b')],qs['fields'](_0x5cc7bb[_0x4b33('0x37')][_0x4b33('0x3c')]));_0x3ac7e2[_0x4b33('0x3d')]=_0x3ac7e2[_0x4b33('0x3d')][_0x4b33('0x3e')]?_0x3ac7e2['attributes']:_0x3dd9cd['model'];if(_0x5cc7bb[_0x4b33('0x37')]['includeAll']){_0x3ac7e2[_0x4b33('0x4a')]=[{'all':!![]}];}_0x3ac7e2=_[_0x4b33('0x45')]({},_0x3ac7e2,_0x5cc7bb[_0x4b33('0x48')]);return db[_0x4b33('0x32')]['find'](_0x3ac7e2)[_0x4b33('0x29')](handleEntityNotFound(_0x2c262a,null))['then'](respondWithResult(_0x2c262a,null))[_0x4b33('0x4e')](handleError(_0x2c262a,null));};exports[_0x4b33('0x4f')]=function(_0x577dd2,_0x39dcc9){return db[_0x4b33('0x32')][_0x4b33('0x4f')](_0x577dd2[_0x4b33('0x50')],{})[_0x4b33('0x29')](function(_0x46ef31){var _0xd3a206=_0x577dd2['user'][_0x4b33('0x2b')]({'plain':!![]});if(!_0xd3a206)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xd3a206['role']===_0x4b33('0x51')){var _0x378573=_0x46ef31[_0x4b33('0x2b')]({'plain':!![]});var _0x4f8d33=_0x4b33('0x2c');return db[_0x4b33('0x52')][_0x4b33('0x53')]({'where':{'name':_0x4f8d33,'userProfileId':_0xd3a206[_0x4b33('0x54')]},'raw':!![]})['then'](function(_0x12759d){if(_0x12759d&&_0x12759d[_0x4b33('0x55')]===0x0){return db[_0x4b33('0x2d')][_0x4b33('0x4f')]({'name':_0x378573[_0x4b33('0x2f')],'resourceId':_0x378573['id'],'type':_0x12759d[_0x4b33('0x2f')],'sectionId':_0x12759d['id']},{})[_0x4b33('0x29')](function(){return _0x46ef31;});}else{return _0x46ef31;}})[_0x4b33('0x4e')](function(_0x38bb95){logger[_0x4b33('0x56')](_0x4b33('0x57'),_0x38bb95);throw _0x38bb95;});}return _0x46ef31;})[_0x4b33('0x29')](respondWithResult(_0x39dcc9,0xc9))[_0x4b33('0x4e')](handleError(_0x39dcc9,null));};exports[_0x4b33('0x58')]=function(_0x47c73e,_0xd3d748){var _0x71dd9={'where':{'id':_0x47c73e['params']['id']}},_0x36976c={};_0x36976c[_0x4b33('0x3b')]=_[_0x4b33('0x38')](db['Dashboard'][_0x4b33('0x33')]);_0x71dd9[_0x4b33('0x3d')]=_[_0x4b33('0x3a')](_0x36976c[_0x4b33('0x3b')],qs['fields'](_0x47c73e[_0x4b33('0x37')][_0x4b33('0x3c')]));_0x71dd9[_0x4b33('0x3d')]=_0x71dd9['attributes']['length']?_0x71dd9['attributes']:_0x36976c[_0x4b33('0x3b')];if(_0x47c73e[_0x4b33('0x37')]['includeAll']){_0x71dd9[_0x4b33('0x4a')]=[{'all':!![]}];}_0x71dd9=_[_0x4b33('0x45')]({},_0x71dd9,_0x47c73e[_0x4b33('0x48')]);return db[_0x4b33('0x32')]['find'](_0x71dd9)[_0x4b33('0x29')](handleEntityNotFound(_0xd3d748,null))[_0x4b33('0x29')](function(_0x3ee8cc){if(_0x3ee8cc){var _0x55bcf8=_0x3ee8cc['get']({'plain':!![]});_0x55bcf8=qs[_0x4b33('0x59')](_0x55bcf8,['id',_0x4b33('0x5a'),_0x4b33('0x5b')]);_0x47c73e[_0x4b33('0x50')]=_[_0x4b33('0x59')](_0x47c73e[_0x4b33('0x50')],['id','createdAt',_0x4b33('0x5b')]);return db['Dashboard'][_0x4b33('0x4f')](_[_0x4b33('0x45')](_0x55bcf8,_0x47c73e['body']),{'include':_0x47c73e['query'][_0x4b33('0x49')]?[{'all':!![]}]:undefined})[_0x4b33('0x29')](function(_0xf4b9aa){var _0x32000f=_0x47c73e[_0x4b33('0x51')][_0x4b33('0x2b')]({'plain':!![]});if(!_0x32000f)throw new Error(_0x4b33('0x5c'));if(_0x32000f['role']===_0x4b33('0x51')){var _0x5a1095=_0xf4b9aa[_0x4b33('0x2b')]({'plain':!![]});var _0x2a6a74=_0x4b33('0x2c');return db[_0x4b33('0x52')][_0x4b33('0x53')]({'where':{'name':_0x2a6a74,'userProfileId':_0x32000f[_0x4b33('0x54')]},'raw':!![]})[_0x4b33('0x29')](function(_0x11bc2a){if(_0x11bc2a&&_0x11bc2a['autoAssociation']===0x0){return db['UserProfileResource'][_0x4b33('0x4f')]({'name':_0x5a1095[_0x4b33('0x2f')],'resourceId':_0x5a1095['id'],'type':_0x11bc2a[_0x4b33('0x2f')],'sectionId':_0x11bc2a['id']},{})['then'](function(){return _0xf4b9aa;});}else{return _0xf4b9aa;}})[_0x4b33('0x4e')](function(_0x5c1565){logger[_0x4b33('0x56')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5c1565);throw _0x5c1565;});}return _0xf4b9aa;});}})[_0x4b33('0x29')](respondWithResult(_0xd3d748,0xc9))[_0x4b33('0x4e')](handleError(_0xd3d748,null));};exports[_0x4b33('0x28')]=function(_0x375fcc,_0x1884a8){if(_0x375fcc['body']['id']){delete _0x375fcc[_0x4b33('0x50')]['id'];}return db[_0x4b33('0x32')][_0x4b33('0x53')]({'where':{'id':_0x375fcc[_0x4b33('0x4d')]['id']}})[_0x4b33('0x29')](handleEntityNotFound(_0x1884a8,null))[_0x4b33('0x29')](saveUpdates(_0x375fcc['body'],null))[_0x4b33('0x29')](respondWithResult(_0x1884a8,null))[_0x4b33('0x4e')](handleError(_0x1884a8,null));};exports[_0x4b33('0x2a')]=function(_0x1049a6,_0x27069e){return db[_0x4b33('0x32')]['find']({'where':{'id':_0x1049a6[_0x4b33('0x4d')]['id']}})[_0x4b33('0x29')](handleEntityNotFound(_0x27069e,null))[_0x4b33('0x29')](removeEntity(_0x27069e,null))[_0x4b33('0x4e')](handleError(_0x27069e,null));};function widgetAttributes(_0x5a0d4d){try{switch(_0x5a0d4d[_0x4b33('0x35')]){case _0x4b33('0x5d'):return[{'name':_0x4b33('0x5e'),'value':_0x5a0d4d[_0x4b33('0x5e')]||(_0x5a0d4d[_0x4b33('0x5f')]&&_0x5a0d4d['attrs'][0x0]?_0x5a0d4d[_0x4b33('0x5f')][0x0][_0x4b33('0x60')]:undefined)||_0x4b33('0x61')}];case _0x4b33('0x62'):return[{'name':_0x4b33('0x63'),'value':_0x5a0d4d['attrPath']||(_0x5a0d4d['attrs']&&_0x5a0d4d['attrs'][0x0]?_0x5a0d4d['attrs'][0x0][_0x4b33('0x60')]:undefined)||''}];case _0x4b33('0x64'):return[{'name':_0x4b33('0x65'),'value':_0x5a0d4d[_0x4b33('0x65')]||(_0x5a0d4d[_0x4b33('0x5f')]&&_0x5a0d4d[_0x4b33('0x5f')][0x0]?_0x5a0d4d[_0x4b33('0x5f')][0x0][_0x4b33('0x60')]:undefined)||_0x4b33('0x66')},{'name':_0x4b33('0x67'),'value':_0x5a0d4d[_0x4b33('0x67')]||(_0x5a0d4d[_0x4b33('0x5f')]&&_0x5a0d4d[_0x4b33('0x5f')][0x1]?_0x5a0d4d['attrs'][0x1]['value']:undefined)||_0x4b33('0x68')},{'name':'attrFontSize','value':_0x5a0d4d[_0x4b33('0x69')]||(_0x5a0d4d[_0x4b33('0x5f')]&&_0x5a0d4d[_0x4b33('0x5f')][0x2]?_0x5a0d4d[_0x4b33('0x5f')][0x2][_0x4b33('0x60')]:undefined)||0xc}];case _0x4b33('0x6a'):return[{'name':_0x4b33('0x6b'),'value':_0x5a0d4d[_0x4b33('0x6b')]||(_0x5a0d4d[_0x4b33('0x5f')]&&_0x5a0d4d[_0x4b33('0x5f')][0x0]?_0x5a0d4d['attrs'][0x0]['value']:undefined)||_0x4b33('0x6c')},{'name':_0x4b33('0x6d'),'value':_0x5a0d4d['attrVoiceQueues']||(_0x5a0d4d['attrs']&&_0x5a0d4d[_0x4b33('0x5f')][0x1]?_0x5a0d4d[_0x4b33('0x5f')][0x1][_0x4b33('0x60')]:undefined)||[]},{'name':'attrFontSize','value':_0x5a0d4d['attrFontSize']||(_0x5a0d4d[_0x4b33('0x5f')]&&_0x5a0d4d['attrs'][0x2]?_0x5a0d4d['attrs'][0x2][_0x4b33('0x60')]:undefined)||0x14},{'name':'attrChannel','value':_0x5a0d4d[_0x4b33('0x6e')]||(_0x5a0d4d[_0x4b33('0x5f')]&&_0x5a0d4d[_0x4b33('0x5f')][0x3]?_0x5a0d4d[_0x4b33('0x5f')][0x3][_0x4b33('0x60')]:undefined)||_0x4b33('0x6f')},{'name':'attrEmailAccounts','value':_0x5a0d4d[_0x4b33('0x70')]||(_0x5a0d4d[_0x4b33('0x5f')]&&_0x5a0d4d[_0x4b33('0x5f')][0x4]?_0x5a0d4d[_0x4b33('0x5f')][0x4][_0x4b33('0x60')]:undefined)||''},{'name':_0x4b33('0x71'),'value':_0x5a0d4d[_0x4b33('0x71')]||(_0x5a0d4d['attrs']&&_0x5a0d4d['attrs'][0x5]?_0x5a0d4d['attrs'][0x5][_0x4b33('0x60')]:undefined)||''},{'name':_0x4b33('0x72'),'value':_0x5a0d4d[_0x4b33('0x72')]||(_0x5a0d4d[_0x4b33('0x5f')]&&_0x5a0d4d[_0x4b33('0x5f')][0x6]?_0x5a0d4d[_0x4b33('0x5f')][0x6][_0x4b33('0x60')]:undefined)||''},{'name':_0x4b33('0x73'),'value':_0x5a0d4d[_0x4b33('0x73')]||(_0x5a0d4d['attrs']&&_0x5a0d4d['attrs'][0x7]?_0x5a0d4d[_0x4b33('0x5f')][0x7][_0x4b33('0x60')]:undefined)||''},{'name':_0x4b33('0x74'),'value':_0x5a0d4d['attrWhatsappAccounts']||(_0x5a0d4d[_0x4b33('0x5f')]&&_0x5a0d4d[_0x4b33('0x5f')][0x8]?_0x5a0d4d[_0x4b33('0x5f')][0x8]['value']:undefined)||''},{'name':_0x4b33('0x75'),'value':_0x5a0d4d[_0x4b33('0x75')]||(_0x5a0d4d['attrs']&&_0x5a0d4d['attrs'][0x9]?_0x5a0d4d[_0x4b33('0x5f')][0x9][_0x4b33('0x60')]:undefined)||''}];case _0x4b33('0x76'):case _0x4b33('0x77'):return[{'name':_0x4b33('0x78'),'value':_0x5a0d4d[_0x4b33('0x78')]||(_0x5a0d4d['attrs']&&_0x5a0d4d['attrs'][0x0]?_0x5a0d4d[_0x4b33('0x5f')][0x0][_0x4b33('0x60')]:undefined)||_0x4b33('0x6c')},{'name':_0x4b33('0x79'),'value':_0x5a0d4d[_0x4b33('0x79')]||(_0x5a0d4d[_0x4b33('0x5f')]&&_0x5a0d4d[_0x4b33('0x5f')][0x1]?_0x5a0d4d[_0x4b33('0x5f')][0x1]['value']:undefined)||null},{'name':'attrSerie3','value':_0x5a0d4d['attrSerie3']||(_0x5a0d4d['attrs']&&_0x5a0d4d[_0x4b33('0x5f')][0x2]?_0x5a0d4d[_0x4b33('0x5f')][0x2][_0x4b33('0x60')]:undefined)||null},{'name':_0x4b33('0x6d'),'value':_0x5a0d4d['attrVoiceQueues']||(_0x5a0d4d['attrs']&&_0x5a0d4d[_0x4b33('0x5f')][0x3]?_0x5a0d4d['attrs'][0x3][_0x4b33('0x60')]:undefined)||[]},{'name':_0x4b33('0x6e'),'value':_0x5a0d4d[_0x4b33('0x6e')]||(_0x5a0d4d[_0x4b33('0x5f')]&&_0x5a0d4d[_0x4b33('0x5f')][0x4]?_0x5a0d4d[_0x4b33('0x5f')][0x4][_0x4b33('0x60')]:undefined)||'voice'},{'name':'attrEmailAccounts','value':_0x5a0d4d[_0x4b33('0x70')]||(_0x5a0d4d[_0x4b33('0x5f')]&&_0x5a0d4d['attrs'][0x5]?_0x5a0d4d[_0x4b33('0x5f')][0x5][_0x4b33('0x60')]:undefined)||''},{'name':_0x4b33('0x71'),'value':_0x5a0d4d[_0x4b33('0x71')]||(_0x5a0d4d[_0x4b33('0x5f')]&&_0x5a0d4d[_0x4b33('0x5f')][0x6]?_0x5a0d4d[_0x4b33('0x5f')][0x6][_0x4b33('0x60')]:undefined)||''},{'name':_0x4b33('0x72'),'value':_0x5a0d4d[_0x4b33('0x72')]||(_0x5a0d4d[_0x4b33('0x5f')]&&_0x5a0d4d[_0x4b33('0x5f')][0x7]?_0x5a0d4d[_0x4b33('0x5f')][0x7]['value']:undefined)||''},{'name':_0x4b33('0x73'),'value':_0x5a0d4d[_0x4b33('0x73')]||(_0x5a0d4d[_0x4b33('0x5f')]&&_0x5a0d4d[_0x4b33('0x5f')][0x8]?_0x5a0d4d[_0x4b33('0x5f')][0x8][_0x4b33('0x60')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x5a0d4d[_0x4b33('0x74')]||(_0x5a0d4d[_0x4b33('0x5f')]&&_0x5a0d4d[_0x4b33('0x5f')][0x9]?_0x5a0d4d[_0x4b33('0x5f')][0x9][_0x4b33('0x60')]:undefined)||''},{'name':'attrChatWebsites','value':_0x5a0d4d['attrChatWebsites']||(_0x5a0d4d[_0x4b33('0x5f')]&&_0x5a0d4d[_0x4b33('0x5f')][0xa]?_0x5a0d4d[_0x4b33('0x5f')][0xa][_0x4b33('0x60')]:undefined)||''}];case _0x4b33('0x7a'):return[{'name':_0x4b33('0x7b'),'type':_0x5a0d4d['reportType']||(_0x5a0d4d['attrs']&&_0x5a0d4d[_0x4b33('0x5f')][0x0]?_0x5a0d4d[_0x4b33('0x5f')][0x0][_0x4b33('0x35')]:undefined)||null,'value':_0x5a0d4d[_0x4b33('0x7b')]||(_0x5a0d4d['attrs']&&_0x5a0d4d[_0x4b33('0x5f')][0x0]?_0x5a0d4d[_0x4b33('0x5f')][0x0][_0x4b33('0x60')]:undefined)||null},{'name':_0x4b33('0x7c'),'value':_0x5a0d4d[_0x4b33('0x7c')]||(_0x5a0d4d[_0x4b33('0x5f')]&&_0x5a0d4d[_0x4b33('0x5f')][0x1]?_0x5a0d4d[_0x4b33('0x5f')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x4773c0){logger[_0x4b33('0x56')](_0x4b33('0x7d'),JSON[_0x4b33('0x7e')](_0x4773c0));return[];}}exports[_0x4b33('0x7f')]=function(_0x5e70d2,_0x458d1a,_0xa2d764){if(_0x5e70d2['body']['id']){delete _0x5e70d2[_0x4b33('0x50')]['id'];}return db['Dashboard']['find']({'where':{'id':_0x5e70d2[_0x4b33('0x4d')]['id']}})[_0x4b33('0x29')](handleEntityNotFound(_0x458d1a,null))[_0x4b33('0x29')](function(_0x1ce6ec){if(_0x1ce6ec){_0x5e70d2[_0x4b33('0x50')]['DashboardId']=_0x1ce6ec['id'];_0x5e70d2[_0x4b33('0x50')][_0x4b33('0x5f')]=widgetAttributes(_0x5e70d2[_0x4b33('0x50')]);return db[_0x4b33('0x80')]['create'](_0x5e70d2[_0x4b33('0x50')]);}})['then'](respondWithResult(_0x458d1a,null))[_0x4b33('0x4e')](handleError(_0x458d1a,null));};exports[_0x4b33('0x81')]=function(_0x315a3c,_0x125012,_0x4c97b6){var _0x36caad={};var _0x4c1fab={};var _0x2ad158;var _0x4470c4;return db[_0x4b33('0x32')][_0x4b33('0x82')]({'where':{'id':_0x315a3c[_0x4b33('0x4d')]['id']}})['then'](handleEntityNotFound(_0x125012,null))['then'](function(_0x4696e4){if(_0x4696e4){_0x2ad158=_0x4696e4;_0x4c1fab[_0x4b33('0x3b')]=_[_0x4b33('0x38')](db[_0x4b33('0x80')]['rawAttributes']);_0x4c1fab['query']=_['keys'](_0x315a3c['query']);_0x4c1fab[_0x4b33('0x39')]=_[_0x4b33('0x3a')](_0x4c1fab[_0x4b33('0x3b')],_0x4c1fab[_0x4b33('0x37')]);_0x36caad['attributes']=_['intersection'](_0x4c1fab[_0x4b33('0x3b')],qs[_0x4b33('0x3c')](_0x315a3c['query']['fields']));_0x36caad[_0x4b33('0x3d')]=_0x36caad[_0x4b33('0x3d')][_0x4b33('0x3e')]?_0x36caad[_0x4b33('0x3d')]:_0x4c1fab[_0x4b33('0x3b')];_0x36caad[_0x4b33('0x41')]=qs[_0x4b33('0x42')](_0x315a3c['query'][_0x4b33('0x42')]);_0x36caad['where']=qs[_0x4b33('0x39')](_[_0x4b33('0x44')](_0x315a3c[_0x4b33('0x37')],_0x4c1fab[_0x4b33('0x39')]));if(_0x315a3c['query'][_0x4b33('0x47')]){_0x36caad[_0x4b33('0x43')]=_[_0x4b33('0x45')](_0x36caad['where'],{'$or':_[_0x4b33('0x83')](_0x36caad[_0x4b33('0x3d')],function(_0x309dae){var _0x558684={};_0x558684[_0x309dae]={'$like':'%'+_0x315a3c[_0x4b33('0x37')]['filter']+'%'};return _0x558684;})});}_0x36caad=_['merge']({},_0x36caad,_0x315a3c[_0x4b33('0x48')]);return _0x2ad158[_0x4b33('0x81')](_0x36caad);}})[_0x4b33('0x29')](function(_0x3604c1){if(_0x3604c1){_0x4470c4=_0x3604c1[_0x4b33('0x3e')];if(!_0x315a3c[_0x4b33('0x37')][_0x4b33('0x3f')](_0x4b33('0x40'))){_0x36caad[_0x4b33('0x20')]=qs[_0x4b33('0x20')](_0x315a3c[_0x4b33('0x37')][_0x4b33('0x20')]);_0x36caad[_0x4b33('0x1f')]=qs[_0x4b33('0x1f')](_0x315a3c['query']['offset']);}return _0x2ad158[_0x4b33('0x81')](_0x36caad);}})[_0x4b33('0x29')](function(_0x11437d){if(_0x11437d){return _0x11437d?{'count':_0x4470c4,'rows':_0x11437d}:null;}})[_0x4b33('0x29')](respondWithResult(_0x125012,null))[_0x4b33('0x4e')](handleError(_0x125012,null));}; \ No newline at end of file +var _0xdafb=['voice','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','attrSerie1','attrSerie3','attrEmailAccounts','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','DashboardItem','findOne','getItems','eml-format','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','redis','defaults','socket.io-emitter','./dashboard.socket','sendStatus','status','end','offset','limit','undefined','count','set','json','apply','reject','save','update','then','destroy','get','CustomDashboards','UserProfileResource','error','stack','name','send','map','Dashboard','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','findAll','catch','show','params','rawAttributes','keys','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','body','updatedAt','userProfileId','autoAssociation','iframe','attrUrl','attrs','value','https://','attrPath','clock','attrHourFormat','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel'];(function(_0x263d50,_0x7d038c){var _0x2e5f15=function(_0x3ae0ff){while(--_0x3ae0ff){_0x263d50['push'](_0x263d50['shift']());}};_0x2e5f15(++_0x7d038c);}(_0xdafb,0x187));var _0xbdaf=function(_0x3e85a4,_0x34627b){_0x3e85a4=_0x3e85a4-0x0;var _0xee4839=_0xdafb[_0x3e85a4];return _0xee4839;};'use strict';var emlformat=require(_0xbdaf('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xbdaf('0x1'));var Mustache=require('mustache');var util=require(_0xbdaf('0x2'));var path=require('path');var sox=require(_0xbdaf('0x3'));var csv=require(_0xbdaf('0x4'));var ejs=require(_0xbdaf('0x5'));var fs=require('fs');var fs_extra=require(_0xbdaf('0x6'));var _=require(_0xbdaf('0x7'));var squel=require(_0xbdaf('0x8'));var crypto=require(_0xbdaf('0x9'));var jsforce=require(_0xbdaf('0xa'));var deskjs=require(_0xbdaf('0xb'));var toCsv=require(_0xbdaf('0x4'));var querystring=require(_0xbdaf('0xc'));var Papa=require(_0xbdaf('0xd'));var Redis=require(_0xbdaf('0xe'));var authService=require(_0xbdaf('0xf'));var qs=require(_0xbdaf('0x10'));var as=require(_0xbdaf('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xbdaf('0x12'))(_0xbdaf('0x13'));var utils=require('../../config/utils');var config=require(_0xbdaf('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xbdaf('0x15')]=_[_0xbdaf('0x16')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xbdaf('0x17'))(new Redis(config['redis']));require(_0xbdaf('0x18'))['register'](socket);function respondWithStatusCode(_0x1774ae,_0x5556a4){_0x5556a4=_0x5556a4||0xcc;return function(_0x332bf1){if(_0x332bf1){return _0x1774ae[_0xbdaf('0x19')](_0x5556a4);}return _0x1774ae[_0xbdaf('0x1a')](_0x5556a4)[_0xbdaf('0x1b')]();};}function respondWithResult(_0x3844b8,_0x46e7b5){_0x46e7b5=_0x46e7b5||0xc8;return function(_0x25b7be){if(_0x25b7be){return _0x3844b8[_0xbdaf('0x1a')](_0x46e7b5)['json'](_0x25b7be);}};}function respondWithFilteredResult(_0x3d6664,_0x4d5d9f){return function(_0xaee0fc){if(_0xaee0fc){var _0x1ad003=typeof _0x4d5d9f[_0xbdaf('0x1c')]==='undefined'&&typeof _0x4d5d9f[_0xbdaf('0x1d')]===_0xbdaf('0x1e');var _0x3b0bbd=_0xaee0fc[_0xbdaf('0x1f')];var _0x191586=_0x1ad003?0x0:_0x4d5d9f[_0xbdaf('0x1c')];var _0x228ad8=_0x1ad003?_0xaee0fc[_0xbdaf('0x1f')]:_0x4d5d9f[_0xbdaf('0x1c')]+_0x4d5d9f[_0xbdaf('0x1d')];var _0x57bc9c;if(_0x228ad8>=_0x3b0bbd){_0x228ad8=_0x3b0bbd;_0x57bc9c=0xc8;}else{_0x57bc9c=0xce;}_0x3d6664[_0xbdaf('0x1a')](_0x57bc9c);return _0x3d6664[_0xbdaf('0x20')]('Content-Range',_0x191586+'-'+_0x228ad8+'/'+_0x3b0bbd)[_0xbdaf('0x21')](_0xaee0fc);}return null;};}function patchUpdates(_0x952219){return function(_0x3ff4fe){try{jsonpatch[_0xbdaf('0x22')](_0x3ff4fe,_0x952219,!![]);}catch(_0x5390c8){return BPromise[_0xbdaf('0x23')](_0x5390c8);}return _0x3ff4fe[_0xbdaf('0x24')]();};}function saveUpdates(_0x52630f,_0x50a840){return function(_0x44d4b9){if(_0x44d4b9){return _0x44d4b9[_0xbdaf('0x25')](_0x52630f)[_0xbdaf('0x26')](function(_0x177c6c){return _0x177c6c;});}return null;};}function removeEntity(_0x57fefa,_0x16179f){return function(_0x1abbce){if(_0x1abbce){return _0x1abbce[_0xbdaf('0x27')]()[_0xbdaf('0x26')](function(){var _0x299fa8=_0x1abbce[_0xbdaf('0x28')]({'plain':!![]});var _0x2fb9e9=_0xbdaf('0x29');return db[_0xbdaf('0x2a')][_0xbdaf('0x27')]({'where':{'type':_0x2fb9e9,'resourceId':_0x299fa8['id']}})[_0xbdaf('0x26')](function(){return _0x1abbce;});})[_0xbdaf('0x26')](function(){_0x57fefa[_0xbdaf('0x1a')](0xcc)[_0xbdaf('0x1b')]();});}};}function handleEntityNotFound(_0x2f78c2,_0x47d6d9){return function(_0x3a09a8){if(!_0x3a09a8){_0x2f78c2[_0xbdaf('0x19')](0x194);}return _0x3a09a8;};}function handleError(_0x1f7600,_0x574514){_0x574514=_0x574514||0x1f4;return function(_0x2e69a5){logger[_0xbdaf('0x2b')](_0x2e69a5[_0xbdaf('0x2c')]);if(_0x2e69a5[_0xbdaf('0x2d')]){delete _0x2e69a5[_0xbdaf('0x2d')];}_0x1f7600[_0xbdaf('0x1a')](_0x574514)[_0xbdaf('0x2e')](_0x2e69a5);};}exports['index']=function(_0x11c167,_0x5c493d){var _0xc705b8={},_0x5a7323={},_0x476cff={'count':0x0,'rows':[]};var _0x56826e=_[_0xbdaf('0x2f')](db[_0xbdaf('0x30')]['rawAttributes'],function(_0x60ea81){return{'name':_0x60ea81[_0xbdaf('0x31')],'type':_0x60ea81[_0xbdaf('0x32')][_0xbdaf('0x33')]};});_0x5a7323[_0xbdaf('0x34')]=_['map'](_0x56826e,_0xbdaf('0x2d'));_0x5a7323[_0xbdaf('0x35')]=_['keys'](_0x11c167['query']);_0x5a7323[_0xbdaf('0x36')]=_[_0xbdaf('0x37')](_0x5a7323['model'],_0x5a7323[_0xbdaf('0x35')]);_0xc705b8[_0xbdaf('0x38')]=_[_0xbdaf('0x37')](_0x5a7323['model'],qs['fields'](_0x11c167[_0xbdaf('0x35')][_0xbdaf('0x39')]));_0xc705b8['attributes']=_0xc705b8['attributes'][_0xbdaf('0x3a')]?_0xc705b8[_0xbdaf('0x38')]:_0x5a7323[_0xbdaf('0x34')];if(!_0x11c167['query'][_0xbdaf('0x3b')](_0xbdaf('0x3c'))){_0xc705b8[_0xbdaf('0x1d')]=qs['limit'](_0x11c167['query'][_0xbdaf('0x1d')]);_0xc705b8[_0xbdaf('0x1c')]=qs[_0xbdaf('0x1c')](_0x11c167[_0xbdaf('0x35')][_0xbdaf('0x1c')]);}_0xc705b8['order']=qs[_0xbdaf('0x3d')](_0x11c167[_0xbdaf('0x35')]['sort']);_0xc705b8[_0xbdaf('0x3e')]=qs['filters'](_[_0xbdaf('0x3f')](_0x11c167[_0xbdaf('0x35')],_0x5a7323[_0xbdaf('0x36')]),_0x56826e);if(_0x11c167[_0xbdaf('0x35')][_0xbdaf('0x40')]){_0xc705b8[_0xbdaf('0x3e')]=_['merge'](_0xc705b8[_0xbdaf('0x3e')],{'$or':_[_0xbdaf('0x2f')](_0x56826e,function(_0x1532cd){if(_0x1532cd['type']!=='VIRTUAL'){var _0x687915={};_0x687915[_0x1532cd[_0xbdaf('0x2d')]]={'$like':'%'+_0x11c167[_0xbdaf('0x35')][_0xbdaf('0x40')]+'%'};return _0x687915;}})});}_0xc705b8=_[_0xbdaf('0x41')]({},_0xc705b8,_0x11c167[_0xbdaf('0x42')]);var _0x1bc63d={'where':_0xc705b8[_0xbdaf('0x3e')]};return db[_0xbdaf('0x30')]['count'](_0x1bc63d)[_0xbdaf('0x26')](function(_0xdf46b6){_0x476cff['count']=_0xdf46b6;if(_0x11c167[_0xbdaf('0x35')][_0xbdaf('0x43')]){_0xc705b8['include']=[{'all':!![]}];}return db['Dashboard'][_0xbdaf('0x44')](_0xc705b8);})['then'](function(_0x12fa70){_0x476cff['rows']=_0x12fa70;return _0x476cff;})[_0xbdaf('0x26')](respondWithFilteredResult(_0x5c493d,_0xc705b8))[_0xbdaf('0x45')](handleError(_0x5c493d,null));};exports[_0xbdaf('0x46')]=function(_0x1be550,_0x2e11f2){var _0x45356e={'raw':![],'where':{'id':_0x1be550[_0xbdaf('0x47')]['id']}},_0x49b7ef={};_0x49b7ef[_0xbdaf('0x34')]=_['keys'](db[_0xbdaf('0x30')][_0xbdaf('0x48')]);_0x49b7ef[_0xbdaf('0x35')]=_[_0xbdaf('0x49')](_0x1be550[_0xbdaf('0x35')]);_0x49b7ef[_0xbdaf('0x36')]=_[_0xbdaf('0x37')](_0x49b7ef[_0xbdaf('0x34')],_0x49b7ef[_0xbdaf('0x35')]);_0x45356e['attributes']=_[_0xbdaf('0x37')](_0x49b7ef[_0xbdaf('0x34')],qs['fields'](_0x1be550[_0xbdaf('0x35')]['fields']));_0x45356e[_0xbdaf('0x38')]=_0x45356e[_0xbdaf('0x38')][_0xbdaf('0x3a')]?_0x45356e[_0xbdaf('0x38')]:_0x49b7ef[_0xbdaf('0x34')];if(_0x1be550['query'][_0xbdaf('0x43')]){_0x45356e[_0xbdaf('0x4a')]=[{'all':!![]}];}_0x45356e=_[_0xbdaf('0x41')]({},_0x45356e,_0x1be550['options']);return db[_0xbdaf('0x30')][_0xbdaf('0x4b')](_0x45356e)['then'](handleEntityNotFound(_0x2e11f2,null))['then'](respondWithResult(_0x2e11f2,null))[_0xbdaf('0x45')](handleError(_0x2e11f2,null));};exports[_0xbdaf('0x4c')]=function(_0x5754f4,_0x4bc068){return db[_0xbdaf('0x30')]['create'](_0x5754f4['body'],{})['then'](function(_0x236e8d){var _0x492b47=_0x5754f4[_0xbdaf('0x4d')][_0xbdaf('0x28')]({'plain':!![]});if(!_0x492b47)throw new Error(_0xbdaf('0x4e'));if(_0x492b47[_0xbdaf('0x4f')]===_0xbdaf('0x4d')){var _0x824645=_0x236e8d['get']({'plain':!![]});var _0x5df8d4=_0xbdaf('0x29');return db[_0xbdaf('0x50')]['find']({'where':{'name':_0x5df8d4,'userProfileId':_0x492b47['userProfileId']},'raw':!![]})[_0xbdaf('0x26')](function(_0x24ce01){if(_0x24ce01&&_0x24ce01['autoAssociation']===0x0){return db[_0xbdaf('0x2a')][_0xbdaf('0x4c')]({'name':_0x824645[_0xbdaf('0x2d')],'resourceId':_0x824645['id'],'type':_0x24ce01[_0xbdaf('0x2d')],'sectionId':_0x24ce01['id']},{})['then'](function(){return _0x236e8d;});}else{return _0x236e8d;}})[_0xbdaf('0x45')](function(_0x16d6c5){logger[_0xbdaf('0x2b')](_0xbdaf('0x51'),_0x16d6c5);throw _0x16d6c5;});}return _0x236e8d;})[_0xbdaf('0x26')](respondWithResult(_0x4bc068,0xc9))[_0xbdaf('0x45')](handleError(_0x4bc068,null));};exports[_0xbdaf('0x52')]=function(_0x1043ed,_0x4387bd){var _0x1edf6f={'where':{'id':_0x1043ed[_0xbdaf('0x47')]['id']}},_0x535075={};_0x535075[_0xbdaf('0x34')]=_[_0xbdaf('0x49')](db[_0xbdaf('0x30')][_0xbdaf('0x48')]);_0x1edf6f[_0xbdaf('0x38')]=_[_0xbdaf('0x37')](_0x535075[_0xbdaf('0x34')],qs['fields'](_0x1043ed[_0xbdaf('0x35')][_0xbdaf('0x39')]));_0x1edf6f[_0xbdaf('0x38')]=_0x1edf6f[_0xbdaf('0x38')][_0xbdaf('0x3a')]?_0x1edf6f[_0xbdaf('0x38')]:_0x535075[_0xbdaf('0x34')];if(_0x1043ed['query'][_0xbdaf('0x43')]){_0x1edf6f[_0xbdaf('0x4a')]=[{'all':!![]}];}_0x1edf6f=_[_0xbdaf('0x41')]({},_0x1edf6f,_0x1043ed[_0xbdaf('0x42')]);return db[_0xbdaf('0x30')][_0xbdaf('0x4b')](_0x1edf6f)[_0xbdaf('0x26')](handleEntityNotFound(_0x4387bd,null))['then'](function(_0x377f19){if(_0x377f19){var _0x29d140=_0x377f19[_0xbdaf('0x28')]({'plain':!![]});_0x29d140=qs[_0xbdaf('0x53')](_0x29d140,['id',_0xbdaf('0x54'),'updatedAt']);_0x1043ed[_0xbdaf('0x55')]=_[_0xbdaf('0x53')](_0x1043ed[_0xbdaf('0x55')],['id',_0xbdaf('0x54'),_0xbdaf('0x56')]);return db[_0xbdaf('0x30')]['create'](_[_0xbdaf('0x41')](_0x29d140,_0x1043ed['body']),{'include':_0x1043ed[_0xbdaf('0x35')][_0xbdaf('0x43')]?[{'all':!![]}]:undefined})[_0xbdaf('0x26')](function(_0x511b80){var _0xe3dd5a=_0x1043ed['user'][_0xbdaf('0x28')]({'plain':!![]});if(!_0xe3dd5a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xe3dd5a[_0xbdaf('0x4f')]===_0xbdaf('0x4d')){var _0x49f80f=_0x511b80['get']({'plain':!![]});var _0x9d373f=_0xbdaf('0x29');return db[_0xbdaf('0x50')]['find']({'where':{'name':_0x9d373f,'userProfileId':_0xe3dd5a[_0xbdaf('0x57')]},'raw':!![]})[_0xbdaf('0x26')](function(_0x163b99){if(_0x163b99&&_0x163b99[_0xbdaf('0x58')]===0x0){return db[_0xbdaf('0x2a')]['create']({'name':_0x49f80f[_0xbdaf('0x2d')],'resourceId':_0x49f80f['id'],'type':_0x163b99['name'],'sectionId':_0x163b99['id']},{})[_0xbdaf('0x26')](function(){return _0x511b80;});}else{return _0x511b80;}})[_0xbdaf('0x45')](function(_0x2d850b){logger[_0xbdaf('0x2b')](_0xbdaf('0x51'),_0x2d850b);throw _0x2d850b;});}return _0x511b80;});}})[_0xbdaf('0x26')](respondWithResult(_0x4387bd,0xc9))[_0xbdaf('0x45')](handleError(_0x4387bd,null));};exports[_0xbdaf('0x25')]=function(_0x2442ca,_0x24ca23){if(_0x2442ca[_0xbdaf('0x55')]['id']){delete _0x2442ca[_0xbdaf('0x55')]['id'];}return db[_0xbdaf('0x30')]['find']({'where':{'id':_0x2442ca[_0xbdaf('0x47')]['id']}})[_0xbdaf('0x26')](handleEntityNotFound(_0x24ca23,null))[_0xbdaf('0x26')](saveUpdates(_0x2442ca[_0xbdaf('0x55')],null))[_0xbdaf('0x26')](respondWithResult(_0x24ca23,null))[_0xbdaf('0x45')](handleError(_0x24ca23,null));};exports[_0xbdaf('0x27')]=function(_0x1cd242,_0x47ca09){return db[_0xbdaf('0x30')][_0xbdaf('0x4b')]({'where':{'id':_0x1cd242[_0xbdaf('0x47')]['id']}})['then'](handleEntityNotFound(_0x47ca09,null))[_0xbdaf('0x26')](removeEntity(_0x47ca09,null))[_0xbdaf('0x45')](handleError(_0x47ca09,null));};function widgetAttributes(_0x368cd9){try{switch(_0x368cd9[_0xbdaf('0x32')]){case _0xbdaf('0x59'):return[{'name':_0xbdaf('0x5a'),'value':_0x368cd9[_0xbdaf('0x5a')]||(_0x368cd9[_0xbdaf('0x5b')]&&_0x368cd9['attrs'][0x0]?_0x368cd9[_0xbdaf('0x5b')][0x0][_0xbdaf('0x5c')]:undefined)||_0xbdaf('0x5d')}];case'custom':return[{'name':_0xbdaf('0x5e'),'value':_0x368cd9['attrPath']||(_0x368cd9['attrs']&&_0x368cd9[_0xbdaf('0x5b')][0x0]?_0x368cd9[_0xbdaf('0x5b')][0x0][_0xbdaf('0x5c')]:undefined)||''}];case _0xbdaf('0x5f'):return[{'name':_0xbdaf('0x60'),'value':_0x368cd9[_0xbdaf('0x60')]||(_0x368cd9[_0xbdaf('0x5b')]&&_0x368cd9[_0xbdaf('0x5b')][0x0]?_0x368cd9[_0xbdaf('0x5b')][0x0]['value']:undefined)||'HH:mm:ss'},{'name':_0xbdaf('0x61'),'value':_0x368cd9['attrTimezone']||(_0x368cd9['attrs']&&_0x368cd9['attrs'][0x1]?_0x368cd9[_0xbdaf('0x5b')][0x1][_0xbdaf('0x5c')]:undefined)||_0xbdaf('0x62')},{'name':_0xbdaf('0x63'),'value':_0x368cd9[_0xbdaf('0x63')]||(_0x368cd9[_0xbdaf('0x5b')]&&_0x368cd9[_0xbdaf('0x5b')][0x2]?_0x368cd9[_0xbdaf('0x5b')][0x2][_0xbdaf('0x5c')]:undefined)||0xc}];case _0xbdaf('0x64'):return[{'name':_0xbdaf('0x65'),'value':_0x368cd9[_0xbdaf('0x65')]||(_0x368cd9['attrs']&&_0x368cd9['attrs'][0x0]?_0x368cd9[_0xbdaf('0x5b')][0x0][_0xbdaf('0x5c')]:undefined)||_0xbdaf('0x66')},{'name':_0xbdaf('0x67'),'value':_0x368cd9[_0xbdaf('0x67')]||(_0x368cd9[_0xbdaf('0x5b')]&&_0x368cd9['attrs'][0x1]?_0x368cd9[_0xbdaf('0x5b')][0x1][_0xbdaf('0x5c')]:undefined)||[]},{'name':_0xbdaf('0x63'),'value':_0x368cd9[_0xbdaf('0x63')]||(_0x368cd9[_0xbdaf('0x5b')]&&_0x368cd9[_0xbdaf('0x5b')][0x2]?_0x368cd9['attrs'][0x2][_0xbdaf('0x5c')]:undefined)||0x14},{'name':_0xbdaf('0x68'),'value':_0x368cd9[_0xbdaf('0x68')]||(_0x368cd9['attrs']&&_0x368cd9[_0xbdaf('0x5b')][0x3]?_0x368cd9['attrs'][0x3][_0xbdaf('0x5c')]:undefined)||_0xbdaf('0x69')},{'name':'attrEmailAccounts','value':_0x368cd9['attrEmailAccounts']||(_0x368cd9[_0xbdaf('0x5b')]&&_0x368cd9['attrs'][0x4]?_0x368cd9['attrs'][0x4][_0xbdaf('0x5c')]:undefined)||''},{'name':_0xbdaf('0x6a'),'value':_0x368cd9[_0xbdaf('0x6a')]||(_0x368cd9[_0xbdaf('0x5b')]&&_0x368cd9[_0xbdaf('0x5b')][0x5]?_0x368cd9[_0xbdaf('0x5b')][0x5][_0xbdaf('0x5c')]:undefined)||''},{'name':_0xbdaf('0x6b'),'value':_0x368cd9[_0xbdaf('0x6b')]||(_0x368cd9[_0xbdaf('0x5b')]&&_0x368cd9[_0xbdaf('0x5b')][0x6]?_0x368cd9['attrs'][0x6][_0xbdaf('0x5c')]:undefined)||''},{'name':_0xbdaf('0x6c'),'value':_0x368cd9[_0xbdaf('0x6c')]||(_0x368cd9['attrs']&&_0x368cd9[_0xbdaf('0x5b')][0x7]?_0x368cd9['attrs'][0x7][_0xbdaf('0x5c')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x368cd9[_0xbdaf('0x6d')]||(_0x368cd9[_0xbdaf('0x5b')]&&_0x368cd9[_0xbdaf('0x5b')][0x8]?_0x368cd9[_0xbdaf('0x5b')][0x8]['value']:undefined)||''},{'name':_0xbdaf('0x6e'),'value':_0x368cd9[_0xbdaf('0x6e')]||(_0x368cd9[_0xbdaf('0x5b')]&&_0x368cd9['attrs'][0x9]?_0x368cd9[_0xbdaf('0x5b')][0x9][_0xbdaf('0x5c')]:undefined)||''}];case _0xbdaf('0x6f'):case'pie-chart':return[{'name':_0xbdaf('0x70'),'value':_0x368cd9[_0xbdaf('0x70')]||(_0x368cd9[_0xbdaf('0x5b')]&&_0x368cd9[_0xbdaf('0x5b')][0x0]?_0x368cd9[_0xbdaf('0x5b')][0x0][_0xbdaf('0x5c')]:undefined)||_0xbdaf('0x66')},{'name':'attrSerie2','value':_0x368cd9['attrSerie2']||(_0x368cd9[_0xbdaf('0x5b')]&&_0x368cd9[_0xbdaf('0x5b')][0x1]?_0x368cd9[_0xbdaf('0x5b')][0x1][_0xbdaf('0x5c')]:undefined)||null},{'name':_0xbdaf('0x71'),'value':_0x368cd9['attrSerie3']||(_0x368cd9[_0xbdaf('0x5b')]&&_0x368cd9[_0xbdaf('0x5b')][0x2]?_0x368cd9[_0xbdaf('0x5b')][0x2]['value']:undefined)||null},{'name':_0xbdaf('0x67'),'value':_0x368cd9[_0xbdaf('0x67')]||(_0x368cd9[_0xbdaf('0x5b')]&&_0x368cd9[_0xbdaf('0x5b')][0x3]?_0x368cd9['attrs'][0x3][_0xbdaf('0x5c')]:undefined)||[]},{'name':'attrChannel','value':_0x368cd9['attrChannel']||(_0x368cd9[_0xbdaf('0x5b')]&&_0x368cd9['attrs'][0x4]?_0x368cd9['attrs'][0x4]['value']:undefined)||_0xbdaf('0x69')},{'name':_0xbdaf('0x72'),'value':_0x368cd9[_0xbdaf('0x72')]||(_0x368cd9['attrs']&&_0x368cd9[_0xbdaf('0x5b')][0x5]?_0x368cd9[_0xbdaf('0x5b')][0x5]['value']:undefined)||''},{'name':_0xbdaf('0x6a'),'value':_0x368cd9[_0xbdaf('0x6a')]||(_0x368cd9[_0xbdaf('0x5b')]&&_0x368cd9[_0xbdaf('0x5b')][0x6]?_0x368cd9['attrs'][0x6][_0xbdaf('0x5c')]:undefined)||''},{'name':_0xbdaf('0x6b'),'value':_0x368cd9[_0xbdaf('0x6b')]||(_0x368cd9[_0xbdaf('0x5b')]&&_0x368cd9[_0xbdaf('0x5b')][0x7]?_0x368cd9['attrs'][0x7][_0xbdaf('0x5c')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x368cd9[_0xbdaf('0x6c')]||(_0x368cd9['attrs']&&_0x368cd9[_0xbdaf('0x5b')][0x8]?_0x368cd9[_0xbdaf('0x5b')][0x8]['value']:undefined)||''},{'name':_0xbdaf('0x6d'),'value':_0x368cd9['attrWhatsappAccounts']||(_0x368cd9[_0xbdaf('0x5b')]&&_0x368cd9[_0xbdaf('0x5b')][0x9]?_0x368cd9['attrs'][0x9][_0xbdaf('0x5c')]:undefined)||''},{'name':'attrChatWebsites','value':_0x368cd9[_0xbdaf('0x6e')]||(_0x368cd9['attrs']&&_0x368cd9[_0xbdaf('0x5b')][0xa]?_0x368cd9['attrs'][0xa][_0xbdaf('0x5c')]:undefined)||''}];case _0xbdaf('0x73'):return[{'name':_0xbdaf('0x74'),'type':_0x368cd9[_0xbdaf('0x75')]||(_0x368cd9[_0xbdaf('0x5b')]&&_0x368cd9[_0xbdaf('0x5b')][0x0]?_0x368cd9[_0xbdaf('0x5b')][0x0][_0xbdaf('0x32')]:undefined)||null,'value':_0x368cd9['attrReport']||(_0x368cd9[_0xbdaf('0x5b')]&&_0x368cd9['attrs'][0x0]?_0x368cd9[_0xbdaf('0x5b')][0x0]['value']:undefined)||null},{'name':'attrRefresh','value':_0x368cd9[_0xbdaf('0x76')]||(_0x368cd9['attrs']&&_0x368cd9['attrs'][0x1]?_0x368cd9[_0xbdaf('0x5b')][0x1][_0xbdaf('0x5c')]:undefined)||0x0}];default:return[];}}catch(_0x21b065){logger[_0xbdaf('0x2b')](_0xbdaf('0x77'),JSON[_0xbdaf('0x78')](_0x21b065));return[];}}exports['addItem']=function(_0x8bc688,_0x2323fb,_0x761134){if(_0x8bc688['body']['id']){delete _0x8bc688[_0xbdaf('0x55')]['id'];}return db[_0xbdaf('0x30')][_0xbdaf('0x4b')]({'where':{'id':_0x8bc688['params']['id']}})[_0xbdaf('0x26')](handleEntityNotFound(_0x2323fb,null))[_0xbdaf('0x26')](function(_0x340116){if(_0x340116){_0x8bc688[_0xbdaf('0x55')]['DashboardId']=_0x340116['id'];_0x8bc688['body']['attrs']=widgetAttributes(_0x8bc688[_0xbdaf('0x55')]);return db[_0xbdaf('0x79')]['create'](_0x8bc688[_0xbdaf('0x55')]);}})['then'](respondWithResult(_0x2323fb,null))['catch'](handleError(_0x2323fb,null));};exports['getItems']=function(_0x394f68,_0xda908d,_0x5385d9){var _0x3eb1d1={};var _0x258906={};var _0x283fbf;var _0x1954b2;return db['Dashboard'][_0xbdaf('0x7a')]({'where':{'id':_0x394f68[_0xbdaf('0x47')]['id']}})[_0xbdaf('0x26')](handleEntityNotFound(_0xda908d,null))[_0xbdaf('0x26')](function(_0x4a98dc){if(_0x4a98dc){_0x283fbf=_0x4a98dc;_0x258906[_0xbdaf('0x34')]=_[_0xbdaf('0x49')](db[_0xbdaf('0x79')][_0xbdaf('0x48')]);_0x258906[_0xbdaf('0x35')]=_[_0xbdaf('0x49')](_0x394f68[_0xbdaf('0x35')]);_0x258906[_0xbdaf('0x36')]=_[_0xbdaf('0x37')](_0x258906[_0xbdaf('0x34')],_0x258906[_0xbdaf('0x35')]);_0x3eb1d1['attributes']=_[_0xbdaf('0x37')](_0x258906[_0xbdaf('0x34')],qs[_0xbdaf('0x39')](_0x394f68['query'][_0xbdaf('0x39')]));_0x3eb1d1[_0xbdaf('0x38')]=_0x3eb1d1[_0xbdaf('0x38')][_0xbdaf('0x3a')]?_0x3eb1d1[_0xbdaf('0x38')]:_0x258906[_0xbdaf('0x34')];_0x3eb1d1['order']=qs[_0xbdaf('0x3d')](_0x394f68[_0xbdaf('0x35')][_0xbdaf('0x3d')]);_0x3eb1d1[_0xbdaf('0x3e')]=qs[_0xbdaf('0x36')](_[_0xbdaf('0x3f')](_0x394f68[_0xbdaf('0x35')],_0x258906[_0xbdaf('0x36')]));if(_0x394f68[_0xbdaf('0x35')][_0xbdaf('0x40')]){_0x3eb1d1['where']=_[_0xbdaf('0x41')](_0x3eb1d1[_0xbdaf('0x3e')],{'$or':_[_0xbdaf('0x2f')](_0x3eb1d1[_0xbdaf('0x38')],function(_0x358cdc){var _0x46643c={};_0x46643c[_0x358cdc]={'$like':'%'+_0x394f68[_0xbdaf('0x35')]['filter']+'%'};return _0x46643c;})});}_0x3eb1d1=_['merge']({},_0x3eb1d1,_0x394f68[_0xbdaf('0x42')]);return _0x283fbf[_0xbdaf('0x7b')](_0x3eb1d1);}})[_0xbdaf('0x26')](function(_0x3d25ab){if(_0x3d25ab){_0x1954b2=_0x3d25ab['length'];if(!_0x394f68[_0xbdaf('0x35')][_0xbdaf('0x3b')]('nolimit')){_0x3eb1d1[_0xbdaf('0x1d')]=qs['limit'](_0x394f68[_0xbdaf('0x35')][_0xbdaf('0x1d')]);_0x3eb1d1[_0xbdaf('0x1c')]=qs[_0xbdaf('0x1c')](_0x394f68[_0xbdaf('0x35')][_0xbdaf('0x1c')]);}return _0x283fbf['getItems'](_0x3eb1d1);}})[_0xbdaf('0x26')](function(_0x4193e5){if(_0x4193e5){return _0x4193e5?{'count':_0x1954b2,'rows':_0x4193e5}:null;}})[_0xbdaf('0x26')](respondWithResult(_0xda908d,null))['catch'](handleError(_0xda908d,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index e497a65..f110e2f 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 _0x69a6=['Dashboard','setMaxListeners','save','remove','emit','hasOwnProperty'];(function(_0x4ab5fc,_0x473020){var _0x581b59=function(_0x5445c6){while(--_0x5445c6){_0x4ab5fc['push'](_0x4ab5fc['shift']());}};_0x581b59(++_0x473020);}(_0x69a6,0xf6));var _0x669a=function(_0x457597,_0x563a89){_0x457597=_0x457597-0x0;var _0x3503d5=_0x69a6[_0x457597];return _0x3503d5;};'use strict';var EventEmitter=require('events');var Dashboard=require('../../mysqldb')['db'][_0x669a('0x0')];var DashboardEvents=new EventEmitter();DashboardEvents[_0x669a('0x1')](0x0);var events={'afterCreate':_0x669a('0x2'),'afterUpdate':'update','afterDestroy':_0x669a('0x3')};function emitEvent(_0x1ba4e2){return function(_0x552315,_0x5982c0,_0xd1f96e){DashboardEvents[_0x669a('0x4')](_0x1ba4e2+':'+_0x552315['id'],_0x552315);DashboardEvents[_0x669a('0x4')](_0x1ba4e2,_0x552315);_0xd1f96e(null);};}for(var e in events){if(events[_0x669a('0x5')](e)){var event=events[e];Dashboard['hook'](e,emitEvent(event));}}module['exports']=DashboardEvents; \ No newline at end of file +var _0xeca3=['remove','emit','hasOwnProperty','exports','events','Dashboard','setMaxListeners','save','update'];(function(_0x99fe35,_0x1588ed){var _0x2a4c77=function(_0x434e24){while(--_0x434e24){_0x99fe35['push'](_0x99fe35['shift']());}};_0x2a4c77(++_0x1588ed);}(_0xeca3,0x13f));var _0x3eca=function(_0x35885a,_0x42fed7){_0x35885a=_0x35885a-0x0;var _0xe86249=_0xeca3[_0x35885a];return _0xe86249;};'use strict';var EventEmitter=require(_0x3eca('0x0'));var Dashboard=require('../../mysqldb')['db'][_0x3eca('0x1')];var DashboardEvents=new EventEmitter();DashboardEvents[_0x3eca('0x2')](0x0);var events={'afterCreate':_0x3eca('0x3'),'afterUpdate':_0x3eca('0x4'),'afterDestroy':_0x3eca('0x5')};function emitEvent(_0x36c7d3){return function(_0x488db5,_0x306cc5,_0x35e0ec){DashboardEvents['emit'](_0x36c7d3+':'+_0x488db5['id'],_0x488db5);DashboardEvents[_0x3eca('0x6')](_0x36c7d3,_0x488db5);_0x35e0ec(null);};}for(var e in events){if(events[_0x3eca('0x7')](e)){var event=events[e];Dashboard['hook'](e,emitEvent(event));}}module[_0x3eca('0x8')]=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index 3ecff2f..924c98f 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 _0x54bf=['Dashboard','dashboards','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./dashboard.attributes','exports','define'];(function(_0x2d34d6,_0x397ff9){var _0x1d3d12=function(_0x558800){while(--_0x558800){_0x2d34d6['push'](_0x2d34d6['shift']());}};_0x1d3d12(++_0x397ff9);}(_0x54bf,0x106));var _0xf54b=function(_0x5ef689,_0x5afd72){_0x5ef689=_0x5ef689-0x0;var _0x27d6d7=_0x54bf[_0x5ef689];return _0x27d6d7;};'use strict';var _=require(_0xf54b('0x0'));var util=require(_0xf54b('0x1'));var logger=require(_0xf54b('0x2'))('api');var moment=require(_0xf54b('0x3'));var BPromise=require(_0xf54b('0x4'));var rp=require(_0xf54b('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf54b('0x6'));var config=require(_0xf54b('0x7'));var attributes=require(_0xf54b('0x8'));module[_0xf54b('0x9')]=function(_0x4fb8a7,_0xed31bc){return _0x4fb8a7[_0xf54b('0xa')](_0xf54b('0xb'),attributes,{'tableName':_0xf54b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5a91=['api','moment','bluebird','request-promise','./dashboard.attributes','exports','define','dashboards','lodash','util'];(function(_0x44b09b,_0x115c7d){var _0x409f63=function(_0x5dc307){while(--_0x5dc307){_0x44b09b['push'](_0x44b09b['shift']());}};_0x409f63(++_0x115c7d);}(_0x5a91,0x1d4));var _0x15a9=function(_0x3009f0,_0x1c27a0){_0x3009f0=_0x3009f0-0x0;var _0x2723f5=_0x5a91[_0x3009f0];return _0x2723f5;};'use strict';var _=require(_0x15a9('0x0'));var util=require(_0x15a9('0x1'));var logger=require('../../config/logger')(_0x15a9('0x2'));var moment=require(_0x15a9('0x3'));var BPromise=require(_0x15a9('0x4'));var rp=require(_0x15a9('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x15a9('0x6'));module[_0x15a9('0x7')]=function(_0x308716,_0x338ac8){return _0x308716[_0x15a9('0x8')]('Dashboard',attributes,{'tableName':_0x15a9('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.rpc.js b/server/api/dashboard/dashboard.rpc.js index 46e3c93..4efab2f 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 _0x6297=['client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x18b191,_0x4e0684){var _0x43e146=function(_0x4b464e){while(--_0x4b464e){_0x18b191['push'](_0x18b191['shift']());}};_0x43e146(++_0x4e0684);}(_0x6297,0x18d));var _0x7629=function(_0x4f0219,_0x2eac05){_0x4f0219=_0x4f0219-0x0;var _0x1aade2=_0x6297[_0x4f0219];return _0x1aade2;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x7629('0x0'));var BPromise=require('bluebird');var rs=require(_0x7629('0x1'));var fs=require('fs');var Redis=require(_0x7629('0x2'));var db=require(_0x7629('0x3'))['db'];var utils=require(_0x7629('0x4'));var logger=require(_0x7629('0x5'))(_0x7629('0x6'));var config=require('../../config/environment');var jayson=require(_0x7629('0x7'));var client=jayson[_0x7629('0x8')][_0x7629('0x9')]({'port':0x232a});config[_0x7629('0xa')]=_[_0x7629('0xb')](config[_0x7629('0xa')],{'host':_0x7629('0xc'),'port':0x18eb});var socket=require(_0x7629('0xd'))(new Redis(config[_0x7629('0xa')]));require('./dashboard.socket')[_0x7629('0xe')](socket);function respondWithRpcPromise(_0x2fdbdf,_0x1f1276,_0x1bfed4){return new BPromise(function(_0x2cb92f,_0x482ece){return client[_0x7629('0xf')](_0x2fdbdf,_0x1bfed4)[_0x7629('0x10')](function(_0x4c7a28){logger[_0x7629('0x11')](_0x7629('0x12'),_0x1f1276,_0x7629('0x13'));logger[_0x7629('0x14')](_0x7629('0x15'),_0x1f1276,_0x7629('0x13'),JSON[_0x7629('0x16')](_0x4c7a28));if(_0x4c7a28[_0x7629('0x17')]){if(_0x4c7a28[_0x7629('0x17')][_0x7629('0x18')]===0x1f4){logger['error'](_0x7629('0x12'),_0x1f1276,_0x4c7a28[_0x7629('0x17')]['message']);return _0x482ece(_0x4c7a28[_0x7629('0x17')][_0x7629('0x19')]);}logger[_0x7629('0x17')](_0x7629('0x12'),_0x1f1276,_0x4c7a28[_0x7629('0x17')]['message']);return _0x2cb92f(_0x4c7a28['error'][_0x7629('0x19')]);}else{logger[_0x7629('0x11')](_0x7629('0x12'),_0x1f1276,_0x7629('0x13'));_0x2cb92f(_0x4c7a28['result'][_0x7629('0x19')]);}})[_0x7629('0x1a')](function(_0x361bf3){logger['error'](_0x7629('0x12'),_0x1f1276,_0x361bf3);_0x482ece(_0x361bf3);});});} \ No newline at end of file +var _0x683f=['moment','bluebird','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','register','request','then','Dashboard,\x20%s,\x20%s','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','result','catch','lodash','util'];(function(_0x3ca65b,_0x788b29){var _0x52a97c=function(_0x1ddc56){while(--_0x1ddc56){_0x3ca65b['push'](_0x3ca65b['shift']());}};_0x52a97c(++_0x788b29);}(_0x683f,0x18e));var _0xf683=function(_0x21f931,_0x598b2d){_0x21f931=_0x21f931-0x0;var _0x3f083c=_0x683f[_0x21f931];return _0x3f083c;};'use strict';var _=require(_0xf683('0x0'));var util=require(_0xf683('0x1'));var moment=require(_0xf683('0x2'));var BPromise=require(_0xf683('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf683('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xf683('0x5'))(_0xf683('0x6'));var config=require(_0xf683('0x7'));var jayson=require(_0xf683('0x8'));var client=jayson['client'][_0xf683('0x9')]({'port':0x232a});config[_0xf683('0xa')]=_['defaults'](config[_0xf683('0xa')],{'host':_0xf683('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf683('0xa')]));require('./dashboard.socket')[_0xf683('0xc')](socket);function respondWithRpcPromise(_0x290bdc,_0x25e744,_0x2d4b70){return new BPromise(function(_0x2d5b06,_0x2f61e5){return client[_0xf683('0xd')](_0x290bdc,_0x2d4b70)[_0xf683('0xe')](function(_0x238366){logger['info'](_0xf683('0xf'),_0x25e744,'request\x20sent');logger['debug'](_0xf683('0x10'),_0x25e744,'request\x20sent',JSON[_0xf683('0x11')](_0x238366));if(_0x238366[_0xf683('0x12')]){if(_0x238366[_0xf683('0x12')][_0xf683('0x13')]===0x1f4){logger[_0xf683('0x12')]('Dashboard,\x20%s,\x20%s',_0x25e744,_0x238366[_0xf683('0x12')][_0xf683('0x14')]);return _0x2f61e5(_0x238366['error'][_0xf683('0x14')]);}logger['error'](_0xf683('0xf'),_0x25e744,_0x238366[_0xf683('0x12')][_0xf683('0x14')]);return _0x2d5b06(_0x238366[_0xf683('0x12')][_0xf683('0x14')]);}else{logger[_0xf683('0x15')](_0xf683('0xf'),_0x25e744,_0xf683('0x16'));_0x2d5b06(_0x238366[_0xf683('0x17')][_0xf683('0x14')]);}})[_0xf683('0x18')](function(_0x32c502){logger[_0xf683('0x12')](_0xf683('0xf'),_0x25e744,_0x32c502);_0x2f61e5(_0x32c502);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index de9b07e..020f813 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 _0xc800=['emit','removeListener','register','length','./dashboard.events','save','update'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xc800,0x14d));var _0x0c80=function(_0x548200,_0x3241b8){_0x548200=_0x548200-0x0;var _0x1a6d74=_0xc800[_0x548200];return _0x1a6d74;};'use strict';var DashboardEvents=require(_0x0c80('0x0'));var events=[_0x0c80('0x1'),'remove',_0x0c80('0x2')];function createListener(_0x226e31,_0x2005d4){return function(_0x3f66aa){_0x2005d4[_0x0c80('0x3')](_0x226e31,_0x3f66aa);};}function removeListener(_0x124029,_0x462855){return function(){DashboardEvents[_0x0c80('0x4')](_0x124029,_0x462855);};}exports[_0x0c80('0x5')]=function(_0x23d721){for(var _0x13f0ec=0x0,_0x4d3b92=events[_0x0c80('0x6')];_0x13f0ec<_0x4d3b92;_0x13f0ec++){var _0x47a150=events[_0x13f0ec];var _0x5acd06=createListener('dashboard:'+_0x47a150,_0x23d721);DashboardEvents['on'](_0x47a150,_0x5acd06);}}; \ No newline at end of file +var _0xf414=['removeListener','register','dashboard:','./dashboard.events','save','emit'];(function(_0x5eb1c6,_0x1989ef){var _0x584208=function(_0x46261a){while(--_0x46261a){_0x5eb1c6['push'](_0x5eb1c6['shift']());}};_0x584208(++_0x1989ef);}(_0xf414,0x177));var _0x4f41=function(_0x257495,_0x18269b){_0x257495=_0x257495-0x0;var _0x3849aa=_0xf414[_0x257495];return _0x3849aa;};'use strict';var DashboardEvents=require(_0x4f41('0x0'));var events=[_0x4f41('0x1'),'remove','update'];function createListener(_0x30b886,_0x13e2b1){return function(_0xe8fb62){_0x13e2b1[_0x4f41('0x2')](_0x30b886,_0xe8fb62);};}function removeListener(_0x3773ba,_0x36339e){return function(){DashboardEvents[_0x4f41('0x3')](_0x3773ba,_0x36339e);};}exports[_0x4f41('0x4')]=function(_0x2cf336){for(var _0x1c48b0=0x0,_0x3a8d81=events['length'];_0x1c48b0<_0x3a8d81;_0x1c48b0++){var _0x3ed499=events[_0x1c48b0];var _0x19fe07=createListener(_0x4f41('0x5')+_0x3ed499,_0x2cf336);DashboardEvents['on'](_0x3ed499,_0x19fe07);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index 2348bea..8ff9fb6 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 _0x205b=['multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./dashboard.controller','isAuthenticated','get','/:id/items','getItems','post','create','/:id/clone','clone','put','update','delete','destroy','exports'];(function(_0x5b1c50,_0x56e694){var _0x2d379b=function(_0x981b9c){while(--_0x981b9c){_0x5b1c50['push'](_0x5b1c50['shift']());}};_0x2d379b(++_0x56e694);}(_0x205b,0x13b));var _0xb205=function(_0x2fd02e,_0x8ebcc5){_0x2fd02e=_0x2fd02e-0x0;var _0x4d7f54=_0x205b[_0x2fd02e];return _0x4d7f54;};'use strict';var multer=require(_0xb205('0x0'));var util=require(_0xb205('0x1'));var path=require('path');var timeout=require(_0xb205('0x2'));var express=require(_0xb205('0x3'));var router=express[_0xb205('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xb205('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xb205('0x6'));var controller=require(_0xb205('0x7'));router['get']('/',auth[_0xb205('0x8')](),controller['index']);router[_0xb205('0x9')]('/:id',auth[_0xb205('0x8')](),controller['show']);router[_0xb205('0x9')](_0xb205('0xa'),auth[_0xb205('0x8')](),controller[_0xb205('0xb')]);router[_0xb205('0xc')]('/',auth[_0xb205('0x8')](),controller[_0xb205('0xd')]);router[_0xb205('0xc')](_0xb205('0xe'),auth[_0xb205('0x8')](),controller[_0xb205('0xf')]);router[_0xb205('0xc')]('/:id/items',auth[_0xb205('0x8')](),controller['addItem']);router[_0xb205('0x10')]('/:id',auth[_0xb205('0x8')](),controller[_0xb205('0x11')]);router[_0xb205('0x12')]('/:id',auth[_0xb205('0x8')](),controller[_0xb205('0x13')]);module[_0xb205('0x14')]=router; \ No newline at end of file +var _0xaaf4=['destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboard.controller','get','isAuthenticated','index','/:id','show','/:id/items','post','create','/:id/clone','clone','update','delete'];(function(_0x9cb5f1,_0x510631){var _0x83754d=function(_0x1110f8){while(--_0x1110f8){_0x9cb5f1['push'](_0x9cb5f1['shift']());}};_0x83754d(++_0x510631);}(_0xaaf4,0x109));var _0x4aaf=function(_0xfd11d4,_0x3f9f18){_0xfd11d4=_0xfd11d4-0x0;var _0x5d5ebc=_0xaaf4[_0xfd11d4];return _0x5d5ebc;};'use strict';var multer=require(_0x4aaf('0x0'));var util=require(_0x4aaf('0x1'));var path=require(_0x4aaf('0x2'));var timeout=require(_0x4aaf('0x3'));var express=require(_0x4aaf('0x4'));var router=express[_0x4aaf('0x5')]();var fs_extra=require(_0x4aaf('0x6'));var auth=require(_0x4aaf('0x7'));var interaction=require(_0x4aaf('0x8'));var config=require(_0x4aaf('0x9'));var controller=require(_0x4aaf('0xa'));router[_0x4aaf('0xb')]('/',auth[_0x4aaf('0xc')](),controller[_0x4aaf('0xd')]);router['get'](_0x4aaf('0xe'),auth['isAuthenticated'](),controller[_0x4aaf('0xf')]);router[_0x4aaf('0xb')](_0x4aaf('0x10'),auth['isAuthenticated'](),controller['getItems']);router[_0x4aaf('0x11')]('/',auth[_0x4aaf('0xc')](),controller[_0x4aaf('0x12')]);router[_0x4aaf('0x11')](_0x4aaf('0x13'),auth['isAuthenticated'](),controller[_0x4aaf('0x14')]);router[_0x4aaf('0x11')](_0x4aaf('0x10'),auth[_0x4aaf('0xc')](),controller['addItem']);router['put'](_0x4aaf('0xe'),auth[_0x4aaf('0xc')](),controller[_0x4aaf('0x15')]);router[_0x4aaf('0x16')](_0x4aaf('0xe'),auth[_0x4aaf('0xc')](),controller[_0x4aaf('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index 062eed4..801fecc 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 _0xfcf0=['sequelize','squel','exports','STRING','TEXT','parse','getDataValue','attrs','setDataValue','stringify','INTEGER','#ffffff','#2196f3'];(function(_0x1138c4,_0x841d33){var _0x200cc1=function(_0x2f6d85){while(--_0x2f6d85){_0x1138c4['push'](_0x1138c4['shift']());}};_0x200cc1(++_0x841d33);}(_0xfcf0,0x138));var _0x0fcf=function(_0x592df4,_0x4e719b){_0x592df4=_0x592df4-0x0;var _0x3b4fe4=_0xfcf0[_0x592df4];return _0x3b4fe4;};'use strict';var Sequelize=require(_0x0fcf('0x0'));var squel=require(_0x0fcf('0x1'));var _=require('lodash');module[_0x0fcf('0x2')]={'title':{'type':Sequelize[_0x0fcf('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x0fcf('0x3')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x0fcf('0x4')]('long'),'get':function(){try{return JSON[_0x0fcf('0x5')](this[_0x0fcf('0x6')](_0x0fcf('0x7')));}catch(_0x3af316){return[];}},'set':function(_0x1bace8){try{this[_0x0fcf('0x8')](_0x0fcf('0x7'),JSON[_0x0fcf('0x9')](_0x1bace8));}catch(_0x50c575){this[_0x0fcf('0x8')](_0x0fcf('0x7'),JSON[_0x0fcf('0x9')]([]));}}},'sizeX':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x0fcf('0xa')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x0fcf('0xa')]},'col':{'type':Sequelize[_0x0fcf('0xa')]},'background':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x0fcf('0xb'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x0fcf('0xc'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x0fcf('0x3')]},'titleFontSize':{'type':Sequelize[_0x0fcf('0xa')],'defaultValue':0xc}}; \ No newline at end of file +var _0x4c60=['attrs','setDataValue','stringify','INTEGER','#ffffff','#2196f3','sequelize','squel','lodash','exports','STRING'];(function(_0x5dda2d,_0x47c117){var _0x23d8d3=function(_0x4e67d8){while(--_0x4e67d8){_0x5dda2d['push'](_0x5dda2d['shift']());}};_0x23d8d3(++_0x47c117);}(_0x4c60,0xc1));var _0x04c6=function(_0x451507,_0x18c494){_0x451507=_0x451507-0x0;var _0x3cb9d8=_0x4c60[_0x451507];return _0x3cb9d8;};'use strict';var Sequelize=require(_0x04c6('0x0'));var squel=require(_0x04c6('0x1'));var _=require(_0x04c6('0x2'));module[_0x04c6('0x3')]={'title':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x04c6('0x4')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize['TEXT']('long'),'get':function(){try{return JSON['parse'](this['getDataValue'](_0x04c6('0x5')));}catch(_0xc6e772){return[];}},'set':function(_0x2054da){try{this[_0x04c6('0x6')](_0x04c6('0x5'),JSON[_0x04c6('0x7')](_0x2054da));}catch(_0x8f9b13){this['setDataValue'](_0x04c6('0x5'),JSON[_0x04c6('0x7')]([]));}}},'sizeX':{'type':Sequelize[_0x04c6('0x8')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x04c6('0x8')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize['INTEGER']},'col':{'type':Sequelize['INTEGER']},'background':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x04c6('0x9'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x04c6('0xa'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x04c6('0x4')]},'titleFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc}}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.controller.js b/server/api/dashboardItem/dashboardItem.controller.js index 21c69e5..48c8684 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 _0xdded=['register','sendStatus','status','json','offset','undefined','count','limit','Content-Range','apply','reject','update','then','end','error','stack','name','send','show','params','model','keys','DashboardItem','rawAttributes','query','filters','intersection','fields','attributes','length','includeAll','include','merge','options','find','destroy','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','attrSerie3','web-report','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket'];(function(_0x14436b,_0xa8ed36){var _0x300d7a=function(_0x2b8ce4){while(--_0x2b8ce4){_0x14436b['push'](_0x14436b['shift']());}};_0x300d7a(++_0xa8ed36);}(_0xdded,0x17a));var _0xddde=function(_0xf482e9,_0xa115e){_0xf482e9=_0xf482e9-0x0;var _0x518e91=_0xdded[_0xf482e9];return _0x518e91;};'use strict';var emlformat=require(_0xddde('0x0'));var rimraf=require(_0xddde('0x1'));var zipdir=require(_0xddde('0x2'));var jsonpatch=require(_0xddde('0x3'));var rp=require(_0xddde('0x4'));var moment=require(_0xddde('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xddde('0x6'));var util=require(_0xddde('0x7'));var path=require(_0xddde('0x8'));var sox=require(_0xddde('0x9'));var csv=require(_0xddde('0xa'));var ejs=require(_0xddde('0xb'));var fs=require('fs');var fs_extra=require(_0xddde('0xc'));var _=require(_0xddde('0xd'));var squel=require(_0xddde('0xe'));var crypto=require(_0xddde('0xf'));var jsforce=require(_0xddde('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xddde('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xddde('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xddde('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xddde('0x13'))(_0xddde('0x14'));var utils=require(_0xddde('0x15'));var config=require(_0xddde('0x16'));var licenseUtil=require(_0xddde('0x17'));var db=require(_0xddde('0x18'))['db'];config[_0xddde('0x19')]=_[_0xddde('0x1a')](config['redis'],{'host':_0xddde('0x1b'),'port':0x18eb});var socket=require(_0xddde('0x1c'))(new Redis(config[_0xddde('0x19')]));require(_0xddde('0x1d'))[_0xddde('0x1e')](socket);function respondWithStatusCode(_0x31c111,_0x491be5){_0x491be5=_0x491be5||0xcc;return function(_0x20b440){if(_0x20b440){return _0x31c111[_0xddde('0x1f')](_0x491be5);}return _0x31c111[_0xddde('0x20')](_0x491be5)['end']();};}function respondWithResult(_0x5de7ce,_0xadd497){_0xadd497=_0xadd497||0xc8;return function(_0x4e98fd){if(_0x4e98fd){return _0x5de7ce[_0xddde('0x20')](_0xadd497)[_0xddde('0x21')](_0x4e98fd);}};}function respondWithFilteredResult(_0x338fa7,_0x463254){return function(_0x2f0e58){if(_0x2f0e58){var _0x55349b=typeof _0x463254[_0xddde('0x22')]===_0xddde('0x23')&&typeof _0x463254['limit']===_0xddde('0x23');var _0x1185f9=_0x2f0e58['count'];var _0x5ae808=_0x55349b?0x0:_0x463254[_0xddde('0x22')];var _0x4c34b1=_0x55349b?_0x2f0e58[_0xddde('0x24')]:_0x463254['offset']+_0x463254[_0xddde('0x25')];var _0xea045b;if(_0x4c34b1>=_0x1185f9){_0x4c34b1=_0x1185f9;_0xea045b=0xc8;}else{_0xea045b=0xce;}_0x338fa7['status'](_0xea045b);return _0x338fa7['set'](_0xddde('0x26'),_0x5ae808+'-'+_0x4c34b1+'/'+_0x1185f9)[_0xddde('0x21')](_0x2f0e58);}return null;};}function patchUpdates(_0x97bb0f){return function(_0x275f76){try{jsonpatch[_0xddde('0x27')](_0x275f76,_0x97bb0f,!![]);}catch(_0xa663e4){return BPromise[_0xddde('0x28')](_0xa663e4);}return _0x275f76['save']();};}function saveUpdates(_0x59320f,_0x3daa4a){return function(_0x261895){if(_0x261895){return _0x261895[_0xddde('0x29')](_0x59320f)[_0xddde('0x2a')](function(_0xdb57ef){return _0xdb57ef;});}return null;};}function removeEntity(_0x533332,_0x394da0){return function(_0x186ae3){if(_0x186ae3){return _0x186ae3['destroy']()['then'](function(){_0x533332[_0xddde('0x20')](0xcc)[_0xddde('0x2b')]();});}};}function handleEntityNotFound(_0x5ddf57,_0x560e28){return function(_0x45941e){if(!_0x45941e){_0x5ddf57['sendStatus'](0x194);}return _0x45941e;};}function handleError(_0x1d1c3e,_0x41d94b){_0x41d94b=_0x41d94b||0x1f4;return function(_0x2dd131){logger[_0xddde('0x2c')](_0x2dd131[_0xddde('0x2d')]);if(_0x2dd131[_0xddde('0x2e')]){delete _0x2dd131[_0xddde('0x2e')];}_0x1d1c3e[_0xddde('0x20')](_0x41d94b)[_0xddde('0x2f')](_0x2dd131);};}exports[_0xddde('0x30')]=function(_0x3a8226,_0x1ff3e2){var _0xe3d006={'raw':![],'where':{'id':_0x3a8226[_0xddde('0x31')]['id']}},_0x718921={};_0x718921[_0xddde('0x32')]=_[_0xddde('0x33')](db[_0xddde('0x34')][_0xddde('0x35')]);_0x718921[_0xddde('0x36')]=_['keys'](_0x3a8226['query']);_0x718921[_0xddde('0x37')]=_[_0xddde('0x38')](_0x718921[_0xddde('0x32')],_0x718921['query']);_0xe3d006['attributes']=_[_0xddde('0x38')](_0x718921[_0xddde('0x32')],qs[_0xddde('0x39')](_0x3a8226[_0xddde('0x36')]['fields']));_0xe3d006[_0xddde('0x3a')]=_0xe3d006['attributes'][_0xddde('0x3b')]?_0xe3d006[_0xddde('0x3a')]:_0x718921[_0xddde('0x32')];if(_0x3a8226[_0xddde('0x36')][_0xddde('0x3c')]){_0xe3d006[_0xddde('0x3d')]=[{'all':!![]}];}_0xe3d006=_[_0xddde('0x3e')]({},_0xe3d006,_0x3a8226[_0xddde('0x3f')]);return db[_0xddde('0x34')][_0xddde('0x40')](_0xe3d006)[_0xddde('0x2a')](handleEntityNotFound(_0x1ff3e2,null))[_0xddde('0x2a')](respondWithResult(_0x1ff3e2,null))['catch'](handleError(_0x1ff3e2,null));};exports[_0xddde('0x41')]=function(_0x170482,_0x4c68ab){return db['DashboardItem']['find']({'where':{'id':_0x170482[_0xddde('0x31')]['id']}})[_0xddde('0x2a')](handleEntityNotFound(_0x4c68ab,null))[_0xddde('0x2a')](removeEntity(_0x4c68ab,null))[_0xddde('0x42')](handleError(_0x4c68ab,null));};function widgetAttributes(_0x2825c6){try{switch(_0x2825c6[_0xddde('0x43')]){case _0xddde('0x44'):return[{'name':'attrUrl','value':_0x2825c6['attrUrl']||(_0x2825c6[_0xddde('0x45')]&&_0x2825c6['attrs'][0x0]?_0x2825c6[_0xddde('0x45')][0x0][_0xddde('0x46')]:undefined)||'https://'}];case _0xddde('0x47'):return[{'name':_0xddde('0x48'),'value':_0x2825c6[_0xddde('0x48')]||(_0x2825c6['attrs']&&_0x2825c6['attrs'][0x0]?_0x2825c6[_0xddde('0x45')][0x0]['value']:undefined)||''}];case _0xddde('0x49'):return[{'name':_0xddde('0x4a'),'value':_0x2825c6[_0xddde('0x4a')]||(_0x2825c6[_0xddde('0x45')]&&_0x2825c6[_0xddde('0x45')][0x0]?_0x2825c6[_0xddde('0x45')][0x0]['value']:undefined)||_0xddde('0x4b')},{'name':_0xddde('0x4c'),'value':_0x2825c6[_0xddde('0x4c')]||(_0x2825c6[_0xddde('0x45')]&&_0x2825c6[_0xddde('0x45')][0x1]?_0x2825c6['attrs'][0x1][_0xddde('0x46')]:undefined)||_0xddde('0x4d')},{'name':_0xddde('0x4e'),'value':_0x2825c6[_0xddde('0x4e')]||(_0x2825c6[_0xddde('0x45')]&&_0x2825c6[_0xddde('0x45')][0x2]?_0x2825c6[_0xddde('0x45')][0x2][_0xddde('0x46')]:undefined)||0xc}];case _0xddde('0x4f'):return[{'name':'attrMetric','value':_0x2825c6[_0xddde('0x50')]||(_0x2825c6['attrs']&&_0x2825c6[_0xddde('0x45')][0x0]?_0x2825c6[_0xddde('0x45')][0x0]['value']:undefined)||_0xddde('0x51')},{'name':_0xddde('0x52'),'value':_0x2825c6[_0xddde('0x52')]||(_0x2825c6['attrs']&&_0x2825c6['attrs'][0x1]?_0x2825c6['attrs'][0x1][_0xddde('0x46')]:undefined)||[]},{'name':_0xddde('0x4e'),'value':_0x2825c6[_0xddde('0x4e')]||(_0x2825c6[_0xddde('0x45')]&&_0x2825c6['attrs'][0x2]?_0x2825c6[_0xddde('0x45')][0x2][_0xddde('0x46')]:undefined)||0x14},{'name':_0xddde('0x53'),'value':_0x2825c6['attrChannel']||(_0x2825c6[_0xddde('0x45')]&&_0x2825c6[_0xddde('0x45')][0x3]?_0x2825c6[_0xddde('0x45')][0x3][_0xddde('0x46')]:undefined)||_0xddde('0x54')},{'name':'attrEmailAccounts','value':_0x2825c6[_0xddde('0x55')]||(_0x2825c6['attrs']&&_0x2825c6[_0xddde('0x45')][0x4]?_0x2825c6['attrs'][0x4][_0xddde('0x46')]:undefined)||''},{'name':_0xddde('0x56'),'value':_0x2825c6[_0xddde('0x56')]||(_0x2825c6[_0xddde('0x45')]&&_0x2825c6[_0xddde('0x45')][0x5]?_0x2825c6[_0xddde('0x45')][0x5][_0xddde('0x46')]:undefined)||''},{'name':_0xddde('0x57'),'value':_0x2825c6['attrSmsAccounts']||(_0x2825c6[_0xddde('0x45')]&&_0x2825c6[_0xddde('0x45')][0x6]?_0x2825c6[_0xddde('0x45')][0x6][_0xddde('0x46')]:undefined)||''},{'name':_0xddde('0x58'),'value':_0x2825c6[_0xddde('0x58')]||(_0x2825c6['attrs']&&_0x2825c6[_0xddde('0x45')][0x7]?_0x2825c6[_0xddde('0x45')][0x7][_0xddde('0x46')]:undefined)||''},{'name':_0xddde('0x59'),'value':_0x2825c6[_0xddde('0x59')]||(_0x2825c6['attrs']&&_0x2825c6[_0xddde('0x45')][0x8]?_0x2825c6[_0xddde('0x45')][0x8][_0xddde('0x46')]:undefined)||''},{'name':_0xddde('0x5a'),'value':_0x2825c6[_0xddde('0x5a')]||(_0x2825c6[_0xddde('0x45')]&&_0x2825c6[_0xddde('0x45')][0x9]?_0x2825c6[_0xddde('0x45')][0x9][_0xddde('0x46')]:undefined)||''}];case _0xddde('0x5b'):case _0xddde('0x5c'):return[{'name':_0xddde('0x5d'),'value':_0x2825c6[_0xddde('0x5d')]||(_0x2825c6[_0xddde('0x45')]&&_0x2825c6[_0xddde('0x45')][0x0]?_0x2825c6[_0xddde('0x45')][0x0][_0xddde('0x46')]:undefined)||_0xddde('0x51')},{'name':'attrSerie2','value':_0x2825c6['attrSerie2']||(_0x2825c6[_0xddde('0x45')]&&_0x2825c6[_0xddde('0x45')][0x1]?_0x2825c6[_0xddde('0x45')][0x1][_0xddde('0x46')]:undefined)||null},{'name':_0xddde('0x5e'),'value':_0x2825c6['attrSerie3']||(_0x2825c6[_0xddde('0x45')]&&_0x2825c6[_0xddde('0x45')][0x2]?_0x2825c6[_0xddde('0x45')][0x2][_0xddde('0x46')]:undefined)||null},{'name':_0xddde('0x52'),'value':_0x2825c6[_0xddde('0x52')]||(_0x2825c6['attrs']&&_0x2825c6[_0xddde('0x45')][0x3]?_0x2825c6[_0xddde('0x45')][0x3][_0xddde('0x46')]:undefined)||[]},{'name':'attrChannel','value':_0x2825c6[_0xddde('0x53')]||(_0x2825c6[_0xddde('0x45')]&&_0x2825c6['attrs'][0x4]?_0x2825c6['attrs'][0x4]['value']:undefined)||_0xddde('0x54')},{'name':'attrEmailAccounts','value':_0x2825c6[_0xddde('0x55')]||(_0x2825c6[_0xddde('0x45')]&&_0x2825c6[_0xddde('0x45')][0x5]?_0x2825c6[_0xddde('0x45')][0x5][_0xddde('0x46')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x2825c6['attrFaxAccounts']||(_0x2825c6[_0xddde('0x45')]&&_0x2825c6[_0xddde('0x45')][0x6]?_0x2825c6['attrs'][0x6][_0xddde('0x46')]:undefined)||''},{'name':_0xddde('0x57'),'value':_0x2825c6[_0xddde('0x57')]||(_0x2825c6[_0xddde('0x45')]&&_0x2825c6[_0xddde('0x45')][0x7]?_0x2825c6[_0xddde('0x45')][0x7][_0xddde('0x46')]:undefined)||''},{'name':_0xddde('0x58'),'value':_0x2825c6[_0xddde('0x58')]||(_0x2825c6[_0xddde('0x45')]&&_0x2825c6['attrs'][0x8]?_0x2825c6[_0xddde('0x45')][0x8]['value']:undefined)||''},{'name':_0xddde('0x59'),'value':_0x2825c6[_0xddde('0x59')]||(_0x2825c6['attrs']&&_0x2825c6['attrs'][0x9]?_0x2825c6['attrs'][0x9][_0xddde('0x46')]:undefined)||''},{'name':'attrChatWebsites','value':_0x2825c6[_0xddde('0x5a')]||(_0x2825c6[_0xddde('0x45')]&&_0x2825c6[_0xddde('0x45')][0xa]?_0x2825c6['attrs'][0xa][_0xddde('0x46')]:undefined)||''}];case _0xddde('0x5f'):return[{'name':_0xddde('0x60'),'type':_0x2825c6['reportType']||(_0x2825c6[_0xddde('0x45')]&&_0x2825c6[_0xddde('0x45')][0x0]?_0x2825c6[_0xddde('0x45')][0x0][_0xddde('0x43')]:undefined)||null,'value':_0x2825c6[_0xddde('0x60')]||(_0x2825c6['attrs']&&_0x2825c6[_0xddde('0x45')][0x0]?_0x2825c6['attrs'][0x0][_0xddde('0x46')]:undefined)||null},{'name':_0xddde('0x61'),'value':_0x2825c6[_0xddde('0x61')]||(_0x2825c6['attrs']&&_0x2825c6['attrs'][0x1]?_0x2825c6[_0xddde('0x45')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0xf33175){logger[_0xddde('0x2c')](_0xddde('0x62'),JSON[_0xddde('0x63')](_0xf33175));return[];}}exports[_0xddde('0x64')]=function(_0x4eb8ce,_0x29b5b1){if(_0x4eb8ce[_0xddde('0x65')]){_0x4eb8ce[_0xddde('0x65')]['attrs']=widgetAttributes(_0x4eb8ce[_0xddde('0x65')]);}return db['DashboardItem'][_0xddde('0x64')](_0x4eb8ce[_0xddde('0x65')],{})['then'](respondWithResult(_0x29b5b1,0xc9))[_0xddde('0x42')](handleError(_0x29b5b1,null));};exports[_0xddde('0x29')]=function(_0x378758,_0x54c787){if(_0x378758[_0xddde('0x65')]['id']){delete _0x378758[_0xddde('0x65')]['id'];}_0x378758[_0xddde('0x65')][_0xddde('0x45')]=widgetAttributes(_0x378758['body']);return db[_0xddde('0x34')][_0xddde('0x40')]({'where':{'id':_0x378758[_0xddde('0x31')]['id']}})['then'](handleEntityNotFound(_0x54c787,null))[_0xddde('0x2a')](saveUpdates(_0x378758['body'],null))[_0xddde('0x2a')](respondWithResult(_0x54c787,null))[_0xddde('0x42')](handleError(_0x54c787,null));}; \ No newline at end of file +var _0xef96=['attrChatWebsites','multibar-chart','pie-chart','attrSerie2','web-report','reportType','attrRefresh','stringify','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','to-csv','ejs','fs-extra','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','destroy','send','params','model','DashboardItem','rawAttributes','query','intersection','fields','attributes','length','merge','find','catch','type','iframe','attrUrl','attrs','value','https://','attrPath','attrHourFormat','HH:mm:ss','attrTimezone','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts'];(function(_0x2c74ab,_0x4a4ebf){var _0x5245b1=function(_0x2ab366){while(--_0x2ab366){_0x2c74ab['push'](_0x2c74ab['shift']());}};_0x5245b1(++_0x4a4ebf);}(_0xef96,0x162));var _0x6ef9=function(_0x3cf1e5,_0x1c8902){_0x3cf1e5=_0x3cf1e5-0x0;var _0x1f020d=_0xef96[_0x3cf1e5];return _0x1f020d;};'use strict';var emlformat=require(_0x6ef9('0x0'));var rimraf=require(_0x6ef9('0x1'));var zipdir=require(_0x6ef9('0x2'));var jsonpatch=require(_0x6ef9('0x3'));var rp=require(_0x6ef9('0x4'));var moment=require(_0x6ef9('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x6ef9('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x6ef9('0x7'));var ejs=require(_0x6ef9('0x8'));var fs=require('fs');var fs_extra=require(_0x6ef9('0x9'));var _=require('lodash');var squel=require(_0x6ef9('0xa'));var crypto=require('crypto');var jsforce=require(_0x6ef9('0xb'));var deskjs=require(_0x6ef9('0xc'));var toCsv=require(_0x6ef9('0x7'));var querystring=require('querystring');var Papa=require(_0x6ef9('0xd'));var Redis=require('ioredis');var authService=require(_0x6ef9('0xe'));var qs=require(_0x6ef9('0xf'));var as=require(_0x6ef9('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6ef9('0x11'))(_0x6ef9('0x12'));var utils=require(_0x6ef9('0x13'));var config=require(_0x6ef9('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x6ef9('0x15'))['db'];config[_0x6ef9('0x16')]=_[_0x6ef9('0x17')](config[_0x6ef9('0x16')],{'host':_0x6ef9('0x18'),'port':0x18eb});var socket=require(_0x6ef9('0x19'))(new Redis(config[_0x6ef9('0x16')]));require('./dashboardItem.socket')[_0x6ef9('0x1a')](socket);function respondWithStatusCode(_0x2942bc,_0x1f3793){_0x1f3793=_0x1f3793||0xcc;return function(_0x3f50e0){if(_0x3f50e0){return _0x2942bc[_0x6ef9('0x1b')](_0x1f3793);}return _0x2942bc[_0x6ef9('0x1c')](_0x1f3793)[_0x6ef9('0x1d')]();};}function respondWithResult(_0x253b13,_0x37deec){_0x37deec=_0x37deec||0xc8;return function(_0x4e0132){if(_0x4e0132){return _0x253b13[_0x6ef9('0x1c')](_0x37deec)[_0x6ef9('0x1e')](_0x4e0132);}};}function respondWithFilteredResult(_0x4fac02,_0x5064cb){return function(_0x1cb130){if(_0x1cb130){var _0x572ce6=typeof _0x5064cb[_0x6ef9('0x1f')]===_0x6ef9('0x20')&&typeof _0x5064cb[_0x6ef9('0x21')]===_0x6ef9('0x20');var _0x1d975c=_0x1cb130[_0x6ef9('0x22')];var _0x493cdd=_0x572ce6?0x0:_0x5064cb['offset'];var _0x1ac999=_0x572ce6?_0x1cb130[_0x6ef9('0x22')]:_0x5064cb['offset']+_0x5064cb[_0x6ef9('0x21')];var _0x3e74d2;if(_0x1ac999>=_0x1d975c){_0x1ac999=_0x1d975c;_0x3e74d2=0xc8;}else{_0x3e74d2=0xce;}_0x4fac02[_0x6ef9('0x1c')](_0x3e74d2);return _0x4fac02[_0x6ef9('0x23')](_0x6ef9('0x24'),_0x493cdd+'-'+_0x1ac999+'/'+_0x1d975c)[_0x6ef9('0x1e')](_0x1cb130);}return null;};}function patchUpdates(_0x404515){return function(_0x57d440){try{jsonpatch['apply'](_0x57d440,_0x404515,!![]);}catch(_0xae1b6e){return BPromise[_0x6ef9('0x25')](_0xae1b6e);}return _0x57d440['save']();};}function saveUpdates(_0x49faeb,_0x22b3d6){return function(_0x4f8520){if(_0x4f8520){return _0x4f8520[_0x6ef9('0x26')](_0x49faeb)[_0x6ef9('0x27')](function(_0xdbc856){return _0xdbc856;});}return null;};}function removeEntity(_0x383197,_0x1bdb00){return function(_0x116891){if(_0x116891){return _0x116891[_0x6ef9('0x28')]()['then'](function(){_0x383197[_0x6ef9('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x21cc0c,_0x19b575){return function(_0x4c9aba){if(!_0x4c9aba){_0x21cc0c[_0x6ef9('0x1b')](0x194);}return _0x4c9aba;};}function handleError(_0x351dce,_0x205b74){_0x205b74=_0x205b74||0x1f4;return function(_0x212d32){logger['error'](_0x212d32['stack']);if(_0x212d32['name']){delete _0x212d32['name'];}_0x351dce['status'](_0x205b74)[_0x6ef9('0x29')](_0x212d32);};}exports['show']=function(_0x40b4e7,_0x5a8f0c){var _0xe7b717={'raw':![],'where':{'id':_0x40b4e7[_0x6ef9('0x2a')]['id']}},_0x2958e0={};_0x2958e0[_0x6ef9('0x2b')]=_['keys'](db[_0x6ef9('0x2c')][_0x6ef9('0x2d')]);_0x2958e0[_0x6ef9('0x2e')]=_['keys'](_0x40b4e7[_0x6ef9('0x2e')]);_0x2958e0['filters']=_[_0x6ef9('0x2f')](_0x2958e0[_0x6ef9('0x2b')],_0x2958e0[_0x6ef9('0x2e')]);_0xe7b717['attributes']=_[_0x6ef9('0x2f')](_0x2958e0[_0x6ef9('0x2b')],qs['fields'](_0x40b4e7[_0x6ef9('0x2e')][_0x6ef9('0x30')]));_0xe7b717[_0x6ef9('0x31')]=_0xe7b717[_0x6ef9('0x31')][_0x6ef9('0x32')]?_0xe7b717[_0x6ef9('0x31')]:_0x2958e0['model'];if(_0x40b4e7['query']['includeAll']){_0xe7b717['include']=[{'all':!![]}];}_0xe7b717=_[_0x6ef9('0x33')]({},_0xe7b717,_0x40b4e7['options']);return db['DashboardItem'][_0x6ef9('0x34')](_0xe7b717)[_0x6ef9('0x27')](handleEntityNotFound(_0x5a8f0c,null))['then'](respondWithResult(_0x5a8f0c,null))[_0x6ef9('0x35')](handleError(_0x5a8f0c,null));};exports['destroy']=function(_0x578c9b,_0x1721b2){return db[_0x6ef9('0x2c')]['find']({'where':{'id':_0x578c9b[_0x6ef9('0x2a')]['id']}})[_0x6ef9('0x27')](handleEntityNotFound(_0x1721b2,null))[_0x6ef9('0x27')](removeEntity(_0x1721b2,null))['catch'](handleError(_0x1721b2,null));};function widgetAttributes(_0x319e7d){try{switch(_0x319e7d[_0x6ef9('0x36')]){case _0x6ef9('0x37'):return[{'name':_0x6ef9('0x38'),'value':_0x319e7d['attrUrl']||(_0x319e7d[_0x6ef9('0x39')]&&_0x319e7d[_0x6ef9('0x39')][0x0]?_0x319e7d['attrs'][0x0][_0x6ef9('0x3a')]:undefined)||_0x6ef9('0x3b')}];case'custom':return[{'name':_0x6ef9('0x3c'),'value':_0x319e7d[_0x6ef9('0x3c')]||(_0x319e7d[_0x6ef9('0x39')]&&_0x319e7d[_0x6ef9('0x39')][0x0]?_0x319e7d[_0x6ef9('0x39')][0x0][_0x6ef9('0x3a')]:undefined)||''}];case'clock':return[{'name':_0x6ef9('0x3d'),'value':_0x319e7d[_0x6ef9('0x3d')]||(_0x319e7d['attrs']&&_0x319e7d[_0x6ef9('0x39')][0x0]?_0x319e7d['attrs'][0x0][_0x6ef9('0x3a')]:undefined)||_0x6ef9('0x3e')},{'name':_0x6ef9('0x3f'),'value':_0x319e7d[_0x6ef9('0x3f')]||(_0x319e7d[_0x6ef9('0x39')]&&_0x319e7d['attrs'][0x1]?_0x319e7d[_0x6ef9('0x39')][0x1][_0x6ef9('0x3a')]:undefined)||'0.00'},{'name':_0x6ef9('0x40'),'value':_0x319e7d[_0x6ef9('0x40')]||(_0x319e7d[_0x6ef9('0x39')]&&_0x319e7d[_0x6ef9('0x39')][0x2]?_0x319e7d['attrs'][0x2][_0x6ef9('0x3a')]:undefined)||0xc}];case _0x6ef9('0x41'):return[{'name':_0x6ef9('0x42'),'value':_0x319e7d[_0x6ef9('0x42')]||(_0x319e7d[_0x6ef9('0x39')]&&_0x319e7d['attrs'][0x0]?_0x319e7d['attrs'][0x0]['value']:undefined)||_0x6ef9('0x43')},{'name':_0x6ef9('0x44'),'value':_0x319e7d['attrVoiceQueues']||(_0x319e7d[_0x6ef9('0x39')]&&_0x319e7d[_0x6ef9('0x39')][0x1]?_0x319e7d['attrs'][0x1][_0x6ef9('0x3a')]:undefined)||[]},{'name':'attrFontSize','value':_0x319e7d[_0x6ef9('0x40')]||(_0x319e7d[_0x6ef9('0x39')]&&_0x319e7d[_0x6ef9('0x39')][0x2]?_0x319e7d[_0x6ef9('0x39')][0x2][_0x6ef9('0x3a')]:undefined)||0x14},{'name':'attrChannel','value':_0x319e7d[_0x6ef9('0x45')]||(_0x319e7d[_0x6ef9('0x39')]&&_0x319e7d[_0x6ef9('0x39')][0x3]?_0x319e7d[_0x6ef9('0x39')][0x3][_0x6ef9('0x3a')]:undefined)||_0x6ef9('0x46')},{'name':'attrEmailAccounts','value':_0x319e7d[_0x6ef9('0x47')]||(_0x319e7d[_0x6ef9('0x39')]&&_0x319e7d[_0x6ef9('0x39')][0x4]?_0x319e7d[_0x6ef9('0x39')][0x4][_0x6ef9('0x3a')]:undefined)||''},{'name':_0x6ef9('0x48'),'value':_0x319e7d[_0x6ef9('0x48')]||(_0x319e7d['attrs']&&_0x319e7d[_0x6ef9('0x39')][0x5]?_0x319e7d[_0x6ef9('0x39')][0x5][_0x6ef9('0x3a')]:undefined)||''},{'name':_0x6ef9('0x49'),'value':_0x319e7d[_0x6ef9('0x49')]||(_0x319e7d[_0x6ef9('0x39')]&&_0x319e7d[_0x6ef9('0x39')][0x6]?_0x319e7d[_0x6ef9('0x39')][0x6]['value']:undefined)||''},{'name':_0x6ef9('0x4a'),'value':_0x319e7d[_0x6ef9('0x4a')]||(_0x319e7d['attrs']&&_0x319e7d[_0x6ef9('0x39')][0x7]?_0x319e7d['attrs'][0x7][_0x6ef9('0x3a')]:undefined)||''},{'name':_0x6ef9('0x4b'),'value':_0x319e7d['attrWhatsappAccounts']||(_0x319e7d[_0x6ef9('0x39')]&&_0x319e7d[_0x6ef9('0x39')][0x8]?_0x319e7d[_0x6ef9('0x39')][0x8][_0x6ef9('0x3a')]:undefined)||''},{'name':_0x6ef9('0x4c'),'value':_0x319e7d['attrChatWebsites']||(_0x319e7d[_0x6ef9('0x39')]&&_0x319e7d[_0x6ef9('0x39')][0x9]?_0x319e7d[_0x6ef9('0x39')][0x9][_0x6ef9('0x3a')]:undefined)||''}];case _0x6ef9('0x4d'):case _0x6ef9('0x4e'):return[{'name':'attrSerie1','value':_0x319e7d['attrSerie1']||(_0x319e7d['attrs']&&_0x319e7d[_0x6ef9('0x39')][0x0]?_0x319e7d['attrs'][0x0][_0x6ef9('0x3a')]:undefined)||_0x6ef9('0x43')},{'name':'attrSerie2','value':_0x319e7d[_0x6ef9('0x4f')]||(_0x319e7d[_0x6ef9('0x39')]&&_0x319e7d[_0x6ef9('0x39')][0x1]?_0x319e7d[_0x6ef9('0x39')][0x1][_0x6ef9('0x3a')]:undefined)||null},{'name':'attrSerie3','value':_0x319e7d['attrSerie3']||(_0x319e7d[_0x6ef9('0x39')]&&_0x319e7d['attrs'][0x2]?_0x319e7d[_0x6ef9('0x39')][0x2][_0x6ef9('0x3a')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x319e7d['attrVoiceQueues']||(_0x319e7d[_0x6ef9('0x39')]&&_0x319e7d[_0x6ef9('0x39')][0x3]?_0x319e7d[_0x6ef9('0x39')][0x3][_0x6ef9('0x3a')]:undefined)||[]},{'name':_0x6ef9('0x45'),'value':_0x319e7d['attrChannel']||(_0x319e7d['attrs']&&_0x319e7d[_0x6ef9('0x39')][0x4]?_0x319e7d[_0x6ef9('0x39')][0x4][_0x6ef9('0x3a')]:undefined)||'voice'},{'name':_0x6ef9('0x47'),'value':_0x319e7d[_0x6ef9('0x47')]||(_0x319e7d['attrs']&&_0x319e7d[_0x6ef9('0x39')][0x5]?_0x319e7d['attrs'][0x5][_0x6ef9('0x3a')]:undefined)||''},{'name':_0x6ef9('0x48'),'value':_0x319e7d[_0x6ef9('0x48')]||(_0x319e7d[_0x6ef9('0x39')]&&_0x319e7d[_0x6ef9('0x39')][0x6]?_0x319e7d[_0x6ef9('0x39')][0x6][_0x6ef9('0x3a')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x319e7d[_0x6ef9('0x49')]||(_0x319e7d[_0x6ef9('0x39')]&&_0x319e7d[_0x6ef9('0x39')][0x7]?_0x319e7d[_0x6ef9('0x39')][0x7]['value']:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x319e7d[_0x6ef9('0x4a')]||(_0x319e7d[_0x6ef9('0x39')]&&_0x319e7d[_0x6ef9('0x39')][0x8]?_0x319e7d[_0x6ef9('0x39')][0x8][_0x6ef9('0x3a')]:undefined)||''},{'name':_0x6ef9('0x4b'),'value':_0x319e7d['attrWhatsappAccounts']||(_0x319e7d[_0x6ef9('0x39')]&&_0x319e7d[_0x6ef9('0x39')][0x9]?_0x319e7d['attrs'][0x9]['value']:undefined)||''},{'name':_0x6ef9('0x4c'),'value':_0x319e7d[_0x6ef9('0x4c')]||(_0x319e7d['attrs']&&_0x319e7d[_0x6ef9('0x39')][0xa]?_0x319e7d[_0x6ef9('0x39')][0xa][_0x6ef9('0x3a')]:undefined)||''}];case _0x6ef9('0x50'):return[{'name':'attrReport','type':_0x319e7d[_0x6ef9('0x51')]||(_0x319e7d[_0x6ef9('0x39')]&&_0x319e7d[_0x6ef9('0x39')][0x0]?_0x319e7d[_0x6ef9('0x39')][0x0][_0x6ef9('0x36')]:undefined)||null,'value':_0x319e7d['attrReport']||(_0x319e7d[_0x6ef9('0x39')]&&_0x319e7d[_0x6ef9('0x39')][0x0]?_0x319e7d['attrs'][0x0]['value']:undefined)||null},{'name':_0x6ef9('0x52'),'value':_0x319e7d[_0x6ef9('0x52')]||(_0x319e7d[_0x6ef9('0x39')]&&_0x319e7d[_0x6ef9('0x39')][0x1]?_0x319e7d[_0x6ef9('0x39')][0x1][_0x6ef9('0x3a')]:undefined)||0x0}];default:return[];}}catch(_0x29c6ee){logger['error']('widgetAttributes:\x20%s',JSON[_0x6ef9('0x53')](_0x29c6ee));return[];}}exports[_0x6ef9('0x54')]=function(_0x1f85a4,_0x322f8e){if(_0x1f85a4[_0x6ef9('0x55')]){_0x1f85a4['body'][_0x6ef9('0x39')]=widgetAttributes(_0x1f85a4['body']);}return db[_0x6ef9('0x2c')][_0x6ef9('0x54')](_0x1f85a4['body'],{})['then'](respondWithResult(_0x322f8e,0xc9))[_0x6ef9('0x35')](handleError(_0x322f8e,null));};exports[_0x6ef9('0x26')]=function(_0x200896,_0x24a3d5){if(_0x200896['body']['id']){delete _0x200896['body']['id'];}_0x200896[_0x6ef9('0x55')]['attrs']=widgetAttributes(_0x200896['body']);return db[_0x6ef9('0x2c')][_0x6ef9('0x34')]({'where':{'id':_0x200896['params']['id']}})[_0x6ef9('0x27')](handleEntityNotFound(_0x24a3d5,null))['then'](saveUpdates(_0x200896[_0x6ef9('0x55')],null))['then'](respondWithResult(_0x24a3d5,null))[_0x6ef9('0x35')](handleError(_0x24a3d5,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index 6ddf28b..2283aa1 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 _0x5302=['setMaxListeners','remove','emit','hasOwnProperty','hook','DashboardItem'];(function(_0x54b4dc,_0x9931a6){var _0x19c584=function(_0x2f2839){while(--_0x2f2839){_0x54b4dc['push'](_0x54b4dc['shift']());}};_0x19c584(++_0x9931a6);}(_0x5302,0x1b5));var _0x2530=function(_0xf4a734,_0x1a4fe7){_0xf4a734=_0xf4a734-0x0;var _0x10ee33=_0x5302[_0xf4a734];return _0x10ee33;};'use strict';var EventEmitter=require('events');var DashboardItem=require('../../mysqldb')['db'][_0x2530('0x0')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x2530('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x2530('0x2')};function emitEvent(_0x5d56c2){return function(_0x1561a1,_0x4ae9db,_0x371cf1){DashboardItemEvents[_0x2530('0x3')](_0x5d56c2+':'+_0x1561a1['id'],_0x1561a1);DashboardItemEvents[_0x2530('0x3')](_0x5d56c2,_0x1561a1);_0x371cf1(null);};}for(var e in events){if(events[_0x2530('0x4')](e)){var event=events[e];DashboardItem[_0x2530('0x5')](e,emitEvent(event));}}module['exports']=DashboardItemEvents; \ No newline at end of file +var _0xaeb9=['save','update','remove','emit','hasOwnProperty','events','../../mysqldb','DashboardItem','setMaxListeners'];(function(_0x47d0e4,_0x21ccfe){var _0x2031ee=function(_0x52656c){while(--_0x52656c){_0x47d0e4['push'](_0x47d0e4['shift']());}};_0x2031ee(++_0x21ccfe);}(_0xaeb9,0x152));var _0x9aeb=function(_0x5ced37,_0x3f3924){_0x5ced37=_0x5ced37-0x0;var _0x5c3268=_0xaeb9[_0x5ced37];return _0x5c3268;};'use strict';var EventEmitter=require(_0x9aeb('0x0'));var DashboardItem=require(_0x9aeb('0x1'))['db'][_0x9aeb('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x9aeb('0x3')](0x0);var events={'afterCreate':_0x9aeb('0x4'),'afterUpdate':_0x9aeb('0x5'),'afterDestroy':_0x9aeb('0x6')};function emitEvent(_0x5e9925){return function(_0x5d61aa,_0x1e2348,_0x305b2f){DashboardItemEvents[_0x9aeb('0x7')](_0x5e9925+':'+_0x5d61aa['id'],_0x5d61aa);DashboardItemEvents[_0x9aeb('0x7')](_0x5e9925,_0x5d61aa);_0x305b2f(null);};}for(var e in events){if(events[_0x9aeb('0x8')](e)){var event=events[e];DashboardItem['hook'](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 948db87..bf1feb8 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 _0xde02=['dashboard_items','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./dashboardItem.attributes','exports','define','DashboardItem'];(function(_0x8bcf15,_0x350ba8){var _0x979fc0=function(_0x127bd0){while(--_0x127bd0){_0x8bcf15['push'](_0x8bcf15['shift']());}};_0x979fc0(++_0x350ba8);}(_0xde02,0xeb));var _0x2de0=function(_0x517e47,_0x1a30b5){_0x517e47=_0x517e47-0x0;var _0x181101=_0xde02[_0x517e47];return _0x181101;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x2de0('0x0'))(_0x2de0('0x1'));var moment=require(_0x2de0('0x2'));var BPromise=require(_0x2de0('0x3'));var rp=require(_0x2de0('0x4'));var fs=require('fs');var path=require(_0x2de0('0x5'));var rimraf=require(_0x2de0('0x6'));var config=require(_0x2de0('0x7'));var attributes=require(_0x2de0('0x8'));module[_0x2de0('0x9')]=function(_0xaf7cfb,_0x1de66f){return _0xaf7cfb[_0x2de0('0xa')](_0x2de0('0xb'),attributes,{'tableName':_0x2de0('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x782e=['rimraf','../../config/environment','./dashboardItem.attributes','exports','dashboard_items','../../config/logger','api','bluebird','request-promise'];(function(_0x3e4160,_0x20e055){var _0x1283fc=function(_0x4b72c2){while(--_0x4b72c2){_0x3e4160['push'](_0x3e4160['shift']());}};_0x1283fc(++_0x20e055);}(_0x782e,0xb9));var _0xe782=function(_0x1d22c0,_0x363aa6){_0x1d22c0=_0x1d22c0-0x0;var _0x43cfdd=_0x782e[_0x1d22c0];return _0x43cfdd;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe782('0x0'))(_0xe782('0x1'));var moment=require('moment');var BPromise=require(_0xe782('0x2'));var rp=require(_0xe782('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe782('0x4'));var config=require(_0xe782('0x5'));var attributes=require(_0xe782('0x6'));module[_0xe782('0x7')]=function(_0x5a75ef,_0x1b934f){return _0x5a75ef['define']('DashboardItem',attributes,{'tableName':_0xe782('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.rpc.js b/server/api/dashboardItem/dashboardItem.rpc.js index 4405751..fd8f7fd 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 _0x0ac5=['randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','register','then','stringify','error','code','message','DashboardItem,\x20%s,\x20%s','info','catch','lodash','util','moment'];(function(_0xdfdc8d,_0x1476e5){var _0x35a7cf=function(_0x22d392){while(--_0x22d392){_0xdfdc8d['push'](_0xdfdc8d['shift']());}};_0x35a7cf(++_0x1476e5);}(_0x0ac5,0xcc));var _0x50ac=function(_0x354929,_0x208597){_0x354929=_0x354929-0x0;var _0xa73f83=_0x0ac5[_0x354929];return _0xa73f83;};'use strict';var _=require(_0x50ac('0x0'));var util=require(_0x50ac('0x1'));var moment=require(_0x50ac('0x2'));var BPromise=require('bluebird');var rs=require(_0x50ac('0x3'));var fs=require('fs');var Redis=require(_0x50ac('0x4'));var db=require(_0x50ac('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x50ac('0x6'));var config=require(_0x50ac('0x7'));var jayson=require(_0x50ac('0x8'));var client=jayson[_0x50ac('0x9')][_0x50ac('0xa')]({'port':0x232a});config[_0x50ac('0xb')]=_[_0x50ac('0xc')](config[_0x50ac('0xb')],{'host':_0x50ac('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x50ac('0xb')]));require('./dashboardItem.socket')[_0x50ac('0xe')](socket);function respondWithRpcPromise(_0x2a01d7,_0x645b61,_0x1198fa){return new BPromise(function(_0x405d84,_0x13b9c3){return client['request'](_0x2a01d7,_0x1198fa)[_0x50ac('0xf')](function(_0x3b1b6d){logger['info']('DashboardItem,\x20%s,\x20%s',_0x645b61,'request\x20sent');logger['debug']('DashboardItem,\x20%s,\x20%s,\x20%s',_0x645b61,'request\x20sent',JSON[_0x50ac('0x10')](_0x3b1b6d));if(_0x3b1b6d[_0x50ac('0x11')]){if(_0x3b1b6d[_0x50ac('0x11')][_0x50ac('0x12')]===0x1f4){logger[_0x50ac('0x11')]('DashboardItem,\x20%s,\x20%s',_0x645b61,_0x3b1b6d[_0x50ac('0x11')]['message']);return _0x13b9c3(_0x3b1b6d[_0x50ac('0x11')][_0x50ac('0x13')]);}logger[_0x50ac('0x11')](_0x50ac('0x14'),_0x645b61,_0x3b1b6d[_0x50ac('0x11')][_0x50ac('0x13')]);return _0x405d84(_0x3b1b6d[_0x50ac('0x11')]['message']);}else{logger[_0x50ac('0x15')](_0x50ac('0x14'),_0x645b61,'request\x20sent');_0x405d84(_0x3b1b6d['result'][_0x50ac('0x13')]);}})[_0x50ac('0x16')](function(_0x8ffa6a){logger['error'](_0x50ac('0x14'),_0x645b61,_0x8ffa6a);_0x13b9c3(_0x8ffa6a);});});} \ No newline at end of file +var _0x80fc=['request','then','info','DashboardItem,\x20%s,\x20%s','request\x20sent','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','ioredis','../../config/logger','jayson/promise','redis','localhost','./dashboardItem.socket'];(function(_0xd56044,_0x34884c){var _0x29a094=function(_0x2eeec0){while(--_0x2eeec0){_0xd56044['push'](_0xd56044['shift']());}};_0x29a094(++_0x34884c);}(_0x80fc,0x11c));var _0xc80f=function(_0x73aef5,_0x5b2293){_0x73aef5=_0x73aef5-0x0;var _0x29be73=_0x80fc[_0x73aef5];return _0x29be73;};'use strict';var _=require(_0xc80f('0x0'));var util=require(_0xc80f('0x1'));var moment=require(_0xc80f('0x2'));var BPromise=require(_0xc80f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc80f('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xc80f('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xc80f('0x6'));var client=jayson['client']['http']({'port':0x232a});config[_0xc80f('0x7')]=_['defaults'](config['redis'],{'host':_0xc80f('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc80f('0x7')]));require(_0xc80f('0x9'))['register'](socket);function respondWithRpcPromise(_0x146ed9,_0x1069a7,_0x5ddc53){return new BPromise(function(_0x1b69c1,_0x2a71e3){return client[_0xc80f('0xa')](_0x146ed9,_0x5ddc53)[_0xc80f('0xb')](function(_0x1d2daf){logger[_0xc80f('0xc')](_0xc80f('0xd'),_0x1069a7,_0xc80f('0xe'));logger['debug'](_0xc80f('0xf'),_0x1069a7,'request\x20sent',JSON[_0xc80f('0x10')](_0x1d2daf));if(_0x1d2daf[_0xc80f('0x11')]){if(_0x1d2daf[_0xc80f('0x11')][_0xc80f('0x12')]===0x1f4){logger[_0xc80f('0x11')](_0xc80f('0xd'),_0x1069a7,_0x1d2daf['error'][_0xc80f('0x13')]);return _0x2a71e3(_0x1d2daf['error'][_0xc80f('0x13')]);}logger[_0xc80f('0x11')](_0xc80f('0xd'),_0x1069a7,_0x1d2daf[_0xc80f('0x11')][_0xc80f('0x13')]);return _0x1b69c1(_0x1d2daf[_0xc80f('0x11')]['message']);}else{logger[_0xc80f('0xc')](_0xc80f('0xd'),_0x1069a7,_0xc80f('0xe'));_0x1b69c1(_0x1d2daf['result']['message']);}})[_0xc80f('0x14')](function(_0x50b662){logger[_0xc80f('0x11')](_0xc80f('0xd'),_0x1069a7,_0x50b662);_0x2a71e3(_0x50b662);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index 40d035e..3d8b604 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 _0xbfc4=['emit','removeListener','register','dashboardItem:','./dashboardItem.events','save','remove','update'];(function(_0xe6ec26,_0x4d85d0){var _0x248070=function(_0x3e0b09){while(--_0x3e0b09){_0xe6ec26['push'](_0xe6ec26['shift']());}};_0x248070(++_0x4d85d0);}(_0xbfc4,0xe4));var _0x4bfc=function(_0x505775,_0x5a4d50){_0x505775=_0x505775-0x0;var _0x49c244=_0xbfc4[_0x505775];return _0x49c244;};'use strict';var DashboardItemEvents=require(_0x4bfc('0x0'));var events=[_0x4bfc('0x1'),_0x4bfc('0x2'),_0x4bfc('0x3')];function createListener(_0x160104,_0x31b0c8){return function(_0x430133){_0x31b0c8[_0x4bfc('0x4')](_0x160104,_0x430133);};}function removeListener(_0x380ada,_0x2eb7b8){return function(){DashboardItemEvents[_0x4bfc('0x5')](_0x380ada,_0x2eb7b8);};}exports[_0x4bfc('0x6')]=function(_0x204c38){for(var _0xac6184=0x0,_0x183b30=events['length'];_0xac6184<_0x183b30;_0xac6184++){var _0x122cc2=events[_0xac6184];var _0x5ae477=createListener(_0x4bfc('0x7')+_0x122cc2,_0x204c38);DashboardItemEvents['on'](_0x122cc2,_0x5ae477);}}; \ No newline at end of file +var _0xc5fc=['dashboardItem:','./dashboardItem.events','save','remove','update','emit','removeListener','register'];(function(_0x2860ab,_0x27440f){var _0x3037c4=function(_0x1eb3f3){while(--_0x1eb3f3){_0x2860ab['push'](_0x2860ab['shift']());}};_0x3037c4(++_0x27440f);}(_0xc5fc,0x181));var _0xcc5f=function(_0x47b855,_0x9cf66c){_0x47b855=_0x47b855-0x0;var _0x2f64df=_0xc5fc[_0x47b855];return _0x2f64df;};'use strict';var DashboardItemEvents=require(_0xcc5f('0x0'));var events=[_0xcc5f('0x1'),_0xcc5f('0x2'),_0xcc5f('0x3')];function createListener(_0x2bd4d2,_0x36f81e){return function(_0x2fc12a){_0x36f81e[_0xcc5f('0x4')](_0x2bd4d2,_0x2fc12a);};}function removeListener(_0x103ec4,_0x345f92){return function(){DashboardItemEvents[_0xcc5f('0x5')](_0x103ec4,_0x345f92);};}exports[_0xcc5f('0x6')]=function(_0x572e1){for(var _0x4a0024=0x0,_0x1ab3ae=events['length'];_0x4a0024<_0x1ab3ae;_0x4a0024++){var _0x45e189=events[_0x4a0024];var _0x51f9d7=createListener(_0xcc5f('0x7')+_0x45e189,_0x572e1);DashboardItemEvents['on'](_0x45e189,_0x51f9d7);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index 54f2cce..cad1508 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 _0xa2d4=['express','Router','fs-extra','../../components/auth/service','../../config/environment','/:id','isAuthenticated','show','post','create','update','delete','multer','util','path','connect-timeout'];(function(_0x3e0011,_0x1a1ad9){var _0x4c2953=function(_0x316ba1){while(--_0x316ba1){_0x3e0011['push'](_0x3e0011['shift']());}};_0x4c2953(++_0x1a1ad9);}(_0xa2d4,0xac));var _0x4a2d=function(_0x51c2a9,_0x2a96e5){_0x51c2a9=_0x51c2a9-0x0;var _0xb94150=_0xa2d4[_0x51c2a9];return _0xb94150;};'use strict';var multer=require(_0x4a2d('0x0'));var util=require(_0x4a2d('0x1'));var path=require(_0x4a2d('0x2'));var timeout=require(_0x4a2d('0x3'));var express=require(_0x4a2d('0x4'));var router=express[_0x4a2d('0x5')]();var fs_extra=require(_0x4a2d('0x6'));var auth=require(_0x4a2d('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x4a2d('0x8'));var controller=require('./dashboardItem.controller');router['get'](_0x4a2d('0x9'),auth[_0x4a2d('0xa')](),controller[_0x4a2d('0xb')]);router[_0x4a2d('0xc')]('/',auth['isAuthenticated'](),controller[_0x4a2d('0xd')]);router['put'](_0x4a2d('0x9'),auth[_0x4a2d('0xa')](),controller[_0x4a2d('0xe')]);router[_0x4a2d('0xf')](_0x4a2d('0x9'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x59f5=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboardItem.controller','get','/:id','isAuthenticated','post','create','put','update','delete','destroy','exports'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x59f5,0x1cc));var _0x559f=function(_0x7c5076,_0x1fa5d8){_0x7c5076=_0x7c5076-0x0;var _0x34276e=_0x59f5[_0x7c5076];return _0x34276e;};'use strict';var multer=require(_0x559f('0x0'));var util=require(_0x559f('0x1'));var path=require(_0x559f('0x2'));var timeout=require(_0x559f('0x3'));var express=require('express');var router=express[_0x559f('0x4')]();var fs_extra=require(_0x559f('0x5'));var auth=require(_0x559f('0x6'));var interaction=require(_0x559f('0x7'));var config=require(_0x559f('0x8'));var controller=require(_0x559f('0x9'));router[_0x559f('0xa')](_0x559f('0xb'),auth[_0x559f('0xc')](),controller['show']);router[_0x559f('0xd')]('/',auth[_0x559f('0xc')](),controller[_0x559f('0xe')]);router[_0x559f('0xf')]('/:id',auth[_0x559f('0xc')](),controller[_0x559f('0x10')]);router[_0x559f('0x11')](_0x559f('0xb'),auth[_0x559f('0xc')](),controller[_0x559f('0x12')]);module[_0x559f('0x13')]=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index ad0c22f..93a73e9 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 _0xb277=['exports','ENUM','first','second','third','STRING','sequelize'];(function(_0x1d0aee,_0x2c4454){var _0x34ee2c=function(_0x6e3b9d){while(--_0x6e3b9d){_0x1d0aee['push'](_0x1d0aee['shift']());}};_0x34ee2c(++_0x2c4454);}(_0xb277,0x187));var _0x7b27=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0xb277[_0x4154a6];return _0x3b2786;};'use strict';var Sequelize=require(_0x7b27('0x0'));module[_0x7b27('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'level':{'type':Sequelize[_0x7b27('0x2')](_0x7b27('0x3'),_0x7b27('0x4'),_0x7b27('0x5')),'allowNull':![],'defaultValue':_0x7b27('0x3')},'description':{'type':Sequelize[_0x7b27('0x6')]}}; \ No newline at end of file +var _0x707a=['exports','STRING','ENUM','first','second','third'];(function(_0x4c9c92,_0x5c2eaa){var _0x527c7d=function(_0x44dd80){while(--_0x44dd80){_0x4c9c92['push'](_0x4c9c92['shift']());}};_0x527c7d(++_0x5c2eaa);}(_0x707a,0xf0));var _0xa707=function(_0x59cf34,_0x47328f){_0x59cf34=_0x59cf34-0x0;var _0x2dcec6=_0x707a[_0x59cf34];return _0x2dcec6;};'use strict';var Sequelize=require('sequelize');module[_0xa707('0x0')]={'name':{'type':Sequelize[_0xa707('0x1')],'allowNull':![]},'level':{'type':Sequelize[_0xa707('0x2')](_0xa707('0x3'),_0xa707('0x4'),_0xa707('0x5')),'allowNull':![],'defaultValue':_0xa707('0x3')},'description':{'type':Sequelize[_0xa707('0x1')]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index 295e971..36fc578 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 _0xa7ee=['order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','catch','show','params','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','sendStatus','end','status','json','offset','limit','count','set','Content-Range','save','update','then','get','Dispositions','destroy','error','stack','name','send','index','map','Disposition','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0x5d3901,_0x5364db){var _0x5b7843=function(_0x3a1a44){while(--_0x3a1a44){_0x5d3901['push'](_0x5d3901['shift']());}};_0x5b7843(++_0x5364db);}(_0xa7ee,0x167));var _0xea7e=function(_0x49ad79,_0x48ee93){_0x49ad79=_0x49ad79-0x0;var _0xa4e38a=_0xa7ee[_0x49ad79];return _0xa4e38a;};'use strict';var emlformat=require(_0xea7e('0x0'));var rimraf=require(_0xea7e('0x1'));var zipdir=require(_0xea7e('0x2'));var jsonpatch=require(_0xea7e('0x3'));var rp=require('request-promise');var moment=require(_0xea7e('0x4'));var BPromise=require(_0xea7e('0x5'));var Mustache=require('mustache');var util=require(_0xea7e('0x6'));var path=require(_0xea7e('0x7'));var sox=require(_0xea7e('0x8'));var csv=require(_0xea7e('0x9'));var ejs=require(_0xea7e('0xa'));var fs=require('fs');var fs_extra=require(_0xea7e('0xb'));var _=require(_0xea7e('0xc'));var squel=require(_0xea7e('0xd'));var crypto=require(_0xea7e('0xe'));var jsforce=require(_0xea7e('0xf'));var deskjs=require(_0xea7e('0x10'));var toCsv=require('to-csv');var querystring=require(_0xea7e('0x11'));var Papa=require(_0xea7e('0x12'));var Redis=require('ioredis');var authService=require(_0xea7e('0x13'));var qs=require(_0xea7e('0x14'));var as=require(_0xea7e('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xea7e('0x16'))(_0xea7e('0x17'));var utils=require('../../config/utils');var config=require(_0xea7e('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x54abde,_0x385235){_0x385235=_0x385235||0xcc;return function(_0x13196b){if(_0x13196b){return _0x54abde[_0xea7e('0x19')](_0x385235);}return _0x54abde['status'](_0x385235)[_0xea7e('0x1a')]();};}function respondWithResult(_0x34bf7b,_0x317436){_0x317436=_0x317436||0xc8;return function(_0xd55a52){if(_0xd55a52){return _0x34bf7b[_0xea7e('0x1b')](_0x317436)[_0xea7e('0x1c')](_0xd55a52);}};}function respondWithFilteredResult(_0x2c7bf9,_0x4b872f){return function(_0x46a83c){if(_0x46a83c){var _0xc66b26=typeof _0x4b872f[_0xea7e('0x1d')]==='undefined'&&typeof _0x4b872f[_0xea7e('0x1e')]==='undefined';var _0x2ec11d=_0x46a83c[_0xea7e('0x1f')];var _0x327d4e=_0xc66b26?0x0:_0x4b872f[_0xea7e('0x1d')];var _0x117edb=_0xc66b26?_0x46a83c[_0xea7e('0x1f')]:_0x4b872f[_0xea7e('0x1d')]+_0x4b872f['limit'];var _0x2d2092;if(_0x117edb>=_0x2ec11d){_0x117edb=_0x2ec11d;_0x2d2092=0xc8;}else{_0x2d2092=0xce;}_0x2c7bf9[_0xea7e('0x1b')](_0x2d2092);return _0x2c7bf9[_0xea7e('0x20')](_0xea7e('0x21'),_0x327d4e+'-'+_0x117edb+'/'+_0x2ec11d)[_0xea7e('0x1c')](_0x46a83c);}return null;};}function patchUpdates(_0x4ebdcf){return function(_0x3278a8){try{jsonpatch['apply'](_0x3278a8,_0x4ebdcf,!![]);}catch(_0x3e8b79){return BPromise['reject'](_0x3e8b79);}return _0x3278a8[_0xea7e('0x22')]();};}function saveUpdates(_0x181777,_0xe14bfc){return function(_0xb8df80){if(_0xb8df80){return _0xb8df80[_0xea7e('0x23')](_0x181777)[_0xea7e('0x24')](function(_0x20286d){return _0x20286d;});}return null;};}function removeEntity(_0x120f1b,_0x30eef2){return function(_0x1fceb2){if(_0x1fceb2){return _0x1fceb2['destroy']()['then'](function(){var _0x5ec56d=_0x1fceb2[_0xea7e('0x25')]({'plain':!![]});var _0x2b8ee1=_0xea7e('0x26');return db['UserProfileResource'][_0xea7e('0x27')]({'where':{'type':_0x2b8ee1,'resourceId':_0x5ec56d['id']}})[_0xea7e('0x24')](function(){return _0x1fceb2;});})['then'](function(){_0x120f1b[_0xea7e('0x1b')](0xcc)[_0xea7e('0x1a')]();});}};}function handleEntityNotFound(_0x17c303,_0x34b545){return function(_0x29ed30){if(!_0x29ed30){_0x17c303[_0xea7e('0x19')](0x194);}return _0x29ed30;};}function handleError(_0x19854c,_0x1fa08c){_0x1fa08c=_0x1fa08c||0x1f4;return function(_0x47f109){logger[_0xea7e('0x28')](_0x47f109[_0xea7e('0x29')]);if(_0x47f109[_0xea7e('0x2a')]){delete _0x47f109['name'];}_0x19854c[_0xea7e('0x1b')](_0x1fa08c)[_0xea7e('0x2b')](_0x47f109);};}exports[_0xea7e('0x2c')]=function(_0x5dcb3c,_0x1cee16){var _0x41f931={},_0x237468={},_0x16711f={'count':0x0,'rows':[]};var _0x569908=_[_0xea7e('0x2d')](db[_0xea7e('0x2e')][_0xea7e('0x2f')],function(_0xa2bc69){return{'name':_0xa2bc69[_0xea7e('0x30')],'type':_0xa2bc69[_0xea7e('0x31')][_0xea7e('0x32')]};});_0x237468[_0xea7e('0x33')]=_[_0xea7e('0x2d')](_0x569908,_0xea7e('0x2a'));_0x237468[_0xea7e('0x34')]=_[_0xea7e('0x35')](_0x5dcb3c[_0xea7e('0x34')]);_0x237468[_0xea7e('0x36')]=_[_0xea7e('0x37')](_0x237468[_0xea7e('0x33')],_0x237468['query']);_0x41f931[_0xea7e('0x38')]=_[_0xea7e('0x37')](_0x237468[_0xea7e('0x33')],qs[_0xea7e('0x39')](_0x5dcb3c['query'][_0xea7e('0x39')]));_0x41f931[_0xea7e('0x38')]=_0x41f931[_0xea7e('0x38')][_0xea7e('0x3a')]?_0x41f931[_0xea7e('0x38')]:_0x237468[_0xea7e('0x33')];if(!_0x5dcb3c['query'][_0xea7e('0x3b')](_0xea7e('0x3c'))){_0x41f931[_0xea7e('0x1e')]=qs[_0xea7e('0x1e')](_0x5dcb3c[_0xea7e('0x34')][_0xea7e('0x1e')]);_0x41f931['offset']=qs[_0xea7e('0x1d')](_0x5dcb3c[_0xea7e('0x34')][_0xea7e('0x1d')]);}_0x41f931[_0xea7e('0x3d')]=qs[_0xea7e('0x3e')](_0x5dcb3c[_0xea7e('0x34')][_0xea7e('0x3e')]);_0x41f931['where']=qs[_0xea7e('0x36')](_[_0xea7e('0x3f')](_0x5dcb3c['query'],_0x237468[_0xea7e('0x36')]),_0x569908);if(_0x5dcb3c['query'][_0xea7e('0x40')]){_0x41f931[_0xea7e('0x41')]=_[_0xea7e('0x42')](_0x41f931[_0xea7e('0x41')],{'$or':_[_0xea7e('0x2d')](_0x569908,function(_0x9b3a2c){if(_0x9b3a2c[_0xea7e('0x31')]!==_0xea7e('0x43')){var _0x41d904={};_0x41d904[_0x9b3a2c['name']]={'$like':'%'+_0x5dcb3c['query'][_0xea7e('0x40')]+'%'};return _0x41d904;}})});}_0x41f931=_[_0xea7e('0x42')]({},_0x41f931,_0x5dcb3c[_0xea7e('0x44')]);var _0x7f0fc2={'where':_0x41f931[_0xea7e('0x41')]};return db['Disposition'][_0xea7e('0x1f')](_0x7f0fc2)['then'](function(_0x3669d5){_0x16711f[_0xea7e('0x1f')]=_0x3669d5;if(_0x5dcb3c[_0xea7e('0x34')][_0xea7e('0x45')]){_0x41f931['include']=[{'all':!![]}];}return db[_0xea7e('0x2e')]['findAll'](_0x41f931);})[_0xea7e('0x24')](function(_0x1cddcd){_0x16711f['rows']=_0x1cddcd;return _0x16711f;})['then'](respondWithFilteredResult(_0x1cee16,_0x41f931))[_0xea7e('0x46')](handleError(_0x1cee16,null));};exports[_0xea7e('0x47')]=function(_0x125249,_0x319d92){var _0x4cc158={'raw':!![],'where':{'id':_0x125249[_0xea7e('0x48')]['id']}},_0xa04200={};_0xa04200[_0xea7e('0x33')]=_[_0xea7e('0x35')](db[_0xea7e('0x2e')][_0xea7e('0x2f')]);_0xa04200[_0xea7e('0x34')]=_[_0xea7e('0x35')](_0x125249[_0xea7e('0x34')]);_0xa04200[_0xea7e('0x36')]=_[_0xea7e('0x37')](_0xa04200[_0xea7e('0x33')],_0xa04200['query']);_0x4cc158[_0xea7e('0x38')]=_[_0xea7e('0x37')](_0xa04200[_0xea7e('0x33')],qs['fields'](_0x125249[_0xea7e('0x34')][_0xea7e('0x39')]));_0x4cc158['attributes']=_0x4cc158['attributes'][_0xea7e('0x3a')]?_0x4cc158[_0xea7e('0x38')]:_0xa04200['model'];if(_0x125249[_0xea7e('0x34')]['includeAll']){_0x4cc158[_0xea7e('0x49')]=[{'all':!![]}];}_0x4cc158=_['merge']({},_0x4cc158,_0x125249[_0xea7e('0x44')]);return db[_0xea7e('0x2e')][_0xea7e('0x4a')](_0x4cc158)[_0xea7e('0x24')](handleEntityNotFound(_0x319d92,null))[_0xea7e('0x24')](respondWithResult(_0x319d92,null))[_0xea7e('0x46')](handleError(_0x319d92,null));};exports[_0xea7e('0x4b')]=function(_0x2274d3,_0x1ef46d){return db[_0xea7e('0x2e')][_0xea7e('0x4b')](_0x2274d3[_0xea7e('0x4c')],{})[_0xea7e('0x24')](function(_0x288d41){var _0x6db6c0=_0x2274d3[_0xea7e('0x4d')]['get']({'plain':!![]});if(!_0x6db6c0)throw new Error(_0xea7e('0x4e'));if(_0x6db6c0[_0xea7e('0x4f')]==='user'){var _0x1f853d=_0x288d41[_0xea7e('0x25')]({'plain':!![]});var _0x448dcc=_0xea7e('0x26');return db[_0xea7e('0x50')][_0xea7e('0x4a')]({'where':{'name':_0x448dcc,'userProfileId':_0x6db6c0[_0xea7e('0x51')]},'raw':!![]})[_0xea7e('0x24')](function(_0x22e875){if(_0x22e875&&_0x22e875[_0xea7e('0x52')]===0x0){return db['UserProfileResource'][_0xea7e('0x4b')]({'name':_0x1f853d[_0xea7e('0x2a')],'resourceId':_0x1f853d['id'],'type':_0x22e875[_0xea7e('0x2a')],'sectionId':_0x22e875['id']},{})['then'](function(){return _0x288d41;});}else{return _0x288d41;}})[_0xea7e('0x46')](function(_0x15fbbc){logger[_0xea7e('0x28')](_0xea7e('0x53'),_0x15fbbc);throw _0x15fbbc;});}return _0x288d41;})[_0xea7e('0x24')](respondWithResult(_0x1ef46d,0xc9))[_0xea7e('0x46')](handleError(_0x1ef46d,null));};exports[_0xea7e('0x23')]=function(_0x4d0e40,_0x56b189){if(_0x4d0e40[_0xea7e('0x4c')]['id']){delete _0x4d0e40[_0xea7e('0x4c')]['id'];}return db[_0xea7e('0x2e')]['find']({'where':{'id':_0x4d0e40[_0xea7e('0x48')]['id']}})[_0xea7e('0x24')](handleEntityNotFound(_0x56b189,null))[_0xea7e('0x24')](saveUpdates(_0x4d0e40['body'],null))[_0xea7e('0x24')](respondWithResult(_0x56b189,null))[_0xea7e('0x46')](handleError(_0x56b189,null));};exports[_0xea7e('0x27')]=function(_0x57a177,_0x10acdf){return db[_0xea7e('0x2e')]['find']({'where':{'id':_0x57a177['params']['id']}})[_0xea7e('0x24')](handleEntityNotFound(_0x10acdf,null))['then'](removeEntity(_0x10acdf,null))['catch'](handleError(_0x10acdf,null));}; \ No newline at end of file +var _0x8a8b=['options','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','fast-json-patch','request-promise','bluebird','util','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','apply','reject','update','destroy','Dispositions','UserProfileResource','then','error','stack','name','send','index','map','Disposition','fieldName','type','key','query','filters','intersection','attributes','model','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','include','findAll','rows','catch','params','keys','rawAttributes'];(function(_0x5aff95,_0x56cfd1){var _0x137ae7=function(_0x30a510){while(--_0x30a510){_0x5aff95['push'](_0x5aff95['shift']());}};_0x137ae7(++_0x56cfd1);}(_0x8a8b,0xae));var _0xb8a8=function(_0x50afb5,_0x488888){_0x50afb5=_0x50afb5-0x0;var _0x2f80e4=_0x8a8b[_0x50afb5];return _0x2f80e4;};'use strict';var emlformat=require(_0xb8a8('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xb8a8('0x1'));var rp=require(_0xb8a8('0x2'));var moment=require('moment');var BPromise=require(_0xb8a8('0x3'));var Mustache=require('mustache');var util=require(_0xb8a8('0x4'));var path=require('path');var sox=require(_0xb8a8('0x5'));var csv=require(_0xb8a8('0x6'));var ejs=require(_0xb8a8('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb8a8('0x8'));var squel=require('squel');var crypto=require(_0xb8a8('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xb8a8('0xa'));var toCsv=require(_0xb8a8('0x6'));var querystring=require(_0xb8a8('0xb'));var Papa=require('papaparse');var Redis=require(_0xb8a8('0xc'));var authService=require(_0xb8a8('0xd'));var qs=require(_0xb8a8('0xe'));var as=require(_0xb8a8('0xf'));var hardwareService=require(_0xb8a8('0x10'));var logger=require(_0xb8a8('0x11'))(_0xb8a8('0x12'));var utils=require(_0xb8a8('0x13'));var config=require(_0xb8a8('0x14'));var licenseUtil=require(_0xb8a8('0x15'));var db=require(_0xb8a8('0x16'))['db'];function respondWithStatusCode(_0x3ba314,_0x6e85aa){_0x6e85aa=_0x6e85aa||0xcc;return function(_0x5278f8){if(_0x5278f8){return _0x3ba314[_0xb8a8('0x17')](_0x6e85aa);}return _0x3ba314[_0xb8a8('0x18')](_0x6e85aa)[_0xb8a8('0x19')]();};}function respondWithResult(_0xad6499,_0x42fb99){_0x42fb99=_0x42fb99||0xc8;return function(_0xf3750e){if(_0xf3750e){return _0xad6499[_0xb8a8('0x18')](_0x42fb99)[_0xb8a8('0x1a')](_0xf3750e);}};}function respondWithFilteredResult(_0x22e0ac,_0x3d96dc){return function(_0x3ca02e){if(_0x3ca02e){var _0x4f6cd0=typeof _0x3d96dc[_0xb8a8('0x1b')]==='undefined'&&typeof _0x3d96dc[_0xb8a8('0x1c')]===_0xb8a8('0x1d');var _0x412041=_0x3ca02e[_0xb8a8('0x1e')];var _0x121be4=_0x4f6cd0?0x0:_0x3d96dc[_0xb8a8('0x1b')];var _0x1d0898=_0x4f6cd0?_0x3ca02e[_0xb8a8('0x1e')]:_0x3d96dc['offset']+_0x3d96dc['limit'];var _0x306c20;if(_0x1d0898>=_0x412041){_0x1d0898=_0x412041;_0x306c20=0xc8;}else{_0x306c20=0xce;}_0x22e0ac['status'](_0x306c20);return _0x22e0ac['set']('Content-Range',_0x121be4+'-'+_0x1d0898+'/'+_0x412041)[_0xb8a8('0x1a')](_0x3ca02e);}return null;};}function patchUpdates(_0x44cdee){return function(_0x421b58){try{jsonpatch[_0xb8a8('0x1f')](_0x421b58,_0x44cdee,!![]);}catch(_0x380fcb){return BPromise[_0xb8a8('0x20')](_0x380fcb);}return _0x421b58['save']();};}function saveUpdates(_0x17c2b8,_0x9ca4b){return function(_0x1a3ff2){if(_0x1a3ff2){return _0x1a3ff2[_0xb8a8('0x21')](_0x17c2b8)['then'](function(_0x404ca5){return _0x404ca5;});}return null;};}function removeEntity(_0x55c6aa,_0x32aba6){return function(_0x4bc82a){if(_0x4bc82a){return _0x4bc82a[_0xb8a8('0x22')]()['then'](function(){var _0x4ede21=_0x4bc82a['get']({'plain':!![]});var _0x5dadd6=_0xb8a8('0x23');return db[_0xb8a8('0x24')][_0xb8a8('0x22')]({'where':{'type':_0x5dadd6,'resourceId':_0x4ede21['id']}})[_0xb8a8('0x25')](function(){return _0x4bc82a;});})[_0xb8a8('0x25')](function(){_0x55c6aa['status'](0xcc)[_0xb8a8('0x19')]();});}};}function handleEntityNotFound(_0x9e1425,_0x465f0f){return function(_0x2d26fa){if(!_0x2d26fa){_0x9e1425[_0xb8a8('0x17')](0x194);}return _0x2d26fa;};}function handleError(_0x524708,_0x26aff5){_0x26aff5=_0x26aff5||0x1f4;return function(_0x118f2d){logger[_0xb8a8('0x26')](_0x118f2d[_0xb8a8('0x27')]);if(_0x118f2d[_0xb8a8('0x28')]){delete _0x118f2d['name'];}_0x524708['status'](_0x26aff5)[_0xb8a8('0x29')](_0x118f2d);};}exports[_0xb8a8('0x2a')]=function(_0x1599be,_0x3c2bea){var _0x3850e6={},_0x28c7fb={},_0x40daf7={'count':0x0,'rows':[]};var _0x45049=_[_0xb8a8('0x2b')](db[_0xb8a8('0x2c')]['rawAttributes'],function(_0x5aa416){return{'name':_0x5aa416[_0xb8a8('0x2d')],'type':_0x5aa416[_0xb8a8('0x2e')][_0xb8a8('0x2f')]};});_0x28c7fb['model']=_['map'](_0x45049,'name');_0x28c7fb['query']=_['keys'](_0x1599be[_0xb8a8('0x30')]);_0x28c7fb[_0xb8a8('0x31')]=_[_0xb8a8('0x32')](_0x28c7fb['model'],_0x28c7fb[_0xb8a8('0x30')]);_0x3850e6[_0xb8a8('0x33')]=_[_0xb8a8('0x32')](_0x28c7fb[_0xb8a8('0x34')],qs[_0xb8a8('0x35')](_0x1599be[_0xb8a8('0x30')]['fields']));_0x3850e6[_0xb8a8('0x33')]=_0x3850e6[_0xb8a8('0x33')][_0xb8a8('0x36')]?_0x3850e6[_0xb8a8('0x33')]:_0x28c7fb[_0xb8a8('0x34')];if(!_0x1599be[_0xb8a8('0x30')]['hasOwnProperty']('nolimit')){_0x3850e6[_0xb8a8('0x1c')]=qs[_0xb8a8('0x1c')](_0x1599be[_0xb8a8('0x30')][_0xb8a8('0x1c')]);_0x3850e6[_0xb8a8('0x1b')]=qs[_0xb8a8('0x1b')](_0x1599be[_0xb8a8('0x30')]['offset']);}_0x3850e6[_0xb8a8('0x37')]=qs[_0xb8a8('0x38')](_0x1599be[_0xb8a8('0x30')][_0xb8a8('0x38')]);_0x3850e6[_0xb8a8('0x39')]=qs[_0xb8a8('0x31')](_[_0xb8a8('0x3a')](_0x1599be[_0xb8a8('0x30')],_0x28c7fb[_0xb8a8('0x31')]),_0x45049);if(_0x1599be[_0xb8a8('0x30')][_0xb8a8('0x3b')]){_0x3850e6[_0xb8a8('0x39')]=_[_0xb8a8('0x3c')](_0x3850e6[_0xb8a8('0x39')],{'$or':_['map'](_0x45049,function(_0x12a7c0){if(_0x12a7c0[_0xb8a8('0x2e')]!==_0xb8a8('0x3d')){var _0x1168c4={};_0x1168c4[_0x12a7c0[_0xb8a8('0x28')]]={'$like':'%'+_0x1599be[_0xb8a8('0x30')][_0xb8a8('0x3b')]+'%'};return _0x1168c4;}})});}_0x3850e6=_[_0xb8a8('0x3c')]({},_0x3850e6,_0x1599be['options']);var _0x330b33={'where':_0x3850e6[_0xb8a8('0x39')]};return db[_0xb8a8('0x2c')][_0xb8a8('0x1e')](_0x330b33)[_0xb8a8('0x25')](function(_0x4eec73){_0x40daf7[_0xb8a8('0x1e')]=_0x4eec73;if(_0x1599be[_0xb8a8('0x30')]['includeAll']){_0x3850e6[_0xb8a8('0x3e')]=[{'all':!![]}];}return db[_0xb8a8('0x2c')][_0xb8a8('0x3f')](_0x3850e6);})['then'](function(_0x3590ac){_0x40daf7[_0xb8a8('0x40')]=_0x3590ac;return _0x40daf7;})[_0xb8a8('0x25')](respondWithFilteredResult(_0x3c2bea,_0x3850e6))[_0xb8a8('0x41')](handleError(_0x3c2bea,null));};exports['show']=function(_0x37e402,_0x5a745a){var _0x36c279={'raw':!![],'where':{'id':_0x37e402[_0xb8a8('0x42')]['id']}},_0x58e816={};_0x58e816[_0xb8a8('0x34')]=_[_0xb8a8('0x43')](db[_0xb8a8('0x2c')][_0xb8a8('0x44')]);_0x58e816[_0xb8a8('0x30')]=_[_0xb8a8('0x43')](_0x37e402[_0xb8a8('0x30')]);_0x58e816[_0xb8a8('0x31')]=_[_0xb8a8('0x32')](_0x58e816[_0xb8a8('0x34')],_0x58e816[_0xb8a8('0x30')]);_0x36c279[_0xb8a8('0x33')]=_[_0xb8a8('0x32')](_0x58e816['model'],qs[_0xb8a8('0x35')](_0x37e402['query'][_0xb8a8('0x35')]));_0x36c279[_0xb8a8('0x33')]=_0x36c279[_0xb8a8('0x33')][_0xb8a8('0x36')]?_0x36c279[_0xb8a8('0x33')]:_0x58e816[_0xb8a8('0x34')];if(_0x37e402[_0xb8a8('0x30')]['includeAll']){_0x36c279[_0xb8a8('0x3e')]=[{'all':!![]}];}_0x36c279=_[_0xb8a8('0x3c')]({},_0x36c279,_0x37e402[_0xb8a8('0x45')]);return db['Disposition'][_0xb8a8('0x46')](_0x36c279)[_0xb8a8('0x25')](handleEntityNotFound(_0x5a745a,null))['then'](respondWithResult(_0x5a745a,null))['catch'](handleError(_0x5a745a,null));};exports[_0xb8a8('0x47')]=function(_0x45e3d3,_0x2b6464){return db['Disposition'][_0xb8a8('0x47')](_0x45e3d3[_0xb8a8('0x48')],{})[_0xb8a8('0x25')](function(_0xf871a6){var _0x55e069=_0x45e3d3[_0xb8a8('0x49')][_0xb8a8('0x4a')]({'plain':!![]});if(!_0x55e069)throw new Error(_0xb8a8('0x4b'));if(_0x55e069[_0xb8a8('0x4c')]==='user'){var _0xa46a18=_0xf871a6[_0xb8a8('0x4a')]({'plain':!![]});var _0x21fd2e=_0xb8a8('0x23');return db[_0xb8a8('0x4d')][_0xb8a8('0x46')]({'where':{'name':_0x21fd2e,'userProfileId':_0x55e069[_0xb8a8('0x4e')]},'raw':!![]})['then'](function(_0x53fd0e){if(_0x53fd0e&&_0x53fd0e[_0xb8a8('0x4f')]===0x0){return db[_0xb8a8('0x24')][_0xb8a8('0x47')]({'name':_0xa46a18[_0xb8a8('0x28')],'resourceId':_0xa46a18['id'],'type':_0x53fd0e['name'],'sectionId':_0x53fd0e['id']},{})['then'](function(){return _0xf871a6;});}else{return _0xf871a6;}})[_0xb8a8('0x41')](function(_0x2ce759){logger[_0xb8a8('0x26')](_0xb8a8('0x50'),_0x2ce759);throw _0x2ce759;});}return _0xf871a6;})[_0xb8a8('0x25')](respondWithResult(_0x2b6464,0xc9))['catch'](handleError(_0x2b6464,null));};exports['update']=function(_0x5e96dd,_0x2d2d47){if(_0x5e96dd[_0xb8a8('0x48')]['id']){delete _0x5e96dd[_0xb8a8('0x48')]['id'];}return db[_0xb8a8('0x2c')][_0xb8a8('0x46')]({'where':{'id':_0x5e96dd[_0xb8a8('0x42')]['id']}})[_0xb8a8('0x25')](handleEntityNotFound(_0x2d2d47,null))[_0xb8a8('0x25')](saveUpdates(_0x5e96dd[_0xb8a8('0x48')],null))[_0xb8a8('0x25')](respondWithResult(_0x2d2d47,null))[_0xb8a8('0x41')](handleError(_0x2d2d47,null));};exports[_0xb8a8('0x22')]=function(_0x167bfa,_0x35f3b4){return db[_0xb8a8('0x2c')][_0xb8a8('0x46')]({'where':{'id':_0x167bfa[_0xb8a8('0x42')]['id']}})['then'](handleEntityNotFound(_0x35f3b4,null))['then'](removeEntity(_0x35f3b4,null))[_0xb8a8('0x41')](handleError(_0x35f3b4,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index e6b598b..312fd76 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 _0xfa50=['name','name_chat','ChatWebsiteId','name_mail','MailAccountId','name_sms','SmsAccountId','name_fax','FaxAccountId','name_openchannel','name_whatsapp','WhatsappAccountId','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./disposition.attributes','exports','define','Disposition','name_voice'];(function(_0x7f0d58,_0x573f83){var _0x446f2f=function(_0x2aee79){while(--_0x2aee79){_0x7f0d58['push'](_0x7f0d58['shift']());}};_0x446f2f(++_0x573f83);}(_0xfa50,0xc4));var _0x0fa5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfa50[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x0fa5('0x0'))(_0x0fa5('0x1'));var moment=require(_0x0fa5('0x2'));var BPromise=require(_0x0fa5('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x0fa5('0x4'));var config=require(_0x0fa5('0x5'));var attributes=require(_0x0fa5('0x6'));module[_0x0fa5('0x7')]=function(_0x2497f2,_0x58d6d2){return _0x2497f2[_0x0fa5('0x8')](_0x0fa5('0x9'),attributes,{'tableName':'tools_dispositions','paranoid':![],'indexes':[{'unique':!![],'name':_0x0fa5('0xa'),'fields':[_0x0fa5('0xb'),'ListId']},{'unique':!![],'name':_0x0fa5('0xc'),'fields':[_0x0fa5('0xb'),_0x0fa5('0xd')]},{'unique':!![],'name':_0x0fa5('0xe'),'fields':[_0x0fa5('0xb'),_0x0fa5('0xf')]},{'unique':!![],'name':_0x0fa5('0x10'),'fields':[_0x0fa5('0xb'),_0x0fa5('0x11')]},{'unique':!![],'name':_0x0fa5('0x12'),'fields':[_0x0fa5('0xb'),_0x0fa5('0x13')]},{'unique':!![],'name':_0x0fa5('0x14'),'fields':[_0x0fa5('0xb'),'OpenchannelAccountId']},{'unique':!![],'name':_0x0fa5('0x15'),'fields':[_0x0fa5('0xb'),_0x0fa5('0x16')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x50ae=['./disposition.attributes','Disposition','tools_dispositions','name_voice','name','ListId','name_chat','ChatWebsiteId','MailAccountId','name_sms','SmsAccountId','FaxAccountId','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','lodash','api','bluebird','request-promise','../../config/environment'];(function(_0x42d0b0,_0x33d3e3){var _0x3cfd26=function(_0x571eab){while(--_0x571eab){_0x42d0b0['push'](_0x42d0b0['shift']());}};_0x3cfd26(++_0x33d3e3);}(_0x50ae,0xd7));var _0xe50a=function(_0x3b0626,_0x46383a){_0x3b0626=_0x3b0626-0x0;var _0x13e1a5=_0x50ae[_0x3b0626];return _0x13e1a5;};'use strict';var _=require(_0xe50a('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xe50a('0x1'));var moment=require('moment');var BPromise=require(_0xe50a('0x2'));var rp=require(_0xe50a('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xe50a('0x4'));var attributes=require(_0xe50a('0x5'));module['exports']=function(_0x42c024,_0x229011){return _0x42c024['define'](_0xe50a('0x6'),attributes,{'tableName':_0xe50a('0x7'),'paranoid':![],'indexes':[{'unique':!![],'name':_0xe50a('0x8'),'fields':[_0xe50a('0x9'),_0xe50a('0xa')]},{'unique':!![],'name':_0xe50a('0xb'),'fields':[_0xe50a('0x9'),_0xe50a('0xc')]},{'unique':!![],'name':'name_mail','fields':['name',_0xe50a('0xd')]},{'unique':!![],'name':_0xe50a('0xe'),'fields':[_0xe50a('0x9'),_0xe50a('0xf')]},{'unique':!![],'name':'name_fax','fields':[_0xe50a('0x9'),_0xe50a('0x10')]},{'unique':!![],'name':'name_openchannel','fields':[_0xe50a('0x9'),_0xe50a('0x11')]},{'unique':!![],'name':_0xe50a('0x12'),'fields':[_0xe50a('0x9'),_0xe50a('0x13')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index 0545aa6..8cb18b1 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(_0x42652e,_0x4dfd26){var _0x1e1f7c=function(_0x54c2c5){while(--_0x54c2c5){_0x42652e['push'](_0x42652e['shift']());}};_0x1e1f7c(++_0x4dfd26);}(_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 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(_0x88c801,_0x2a6131){var _0x20bf2c=function(_0x1d8f8d){while(--_0x1d8f8d){_0x88c801['push'](_0x88c801['shift']());}};_0x20bf2c(++_0x2a6131);}(_0xa9e0,0x123));var _0x0a9e=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0xa9e0[_0xa1e3e3];return _0xc980e9;};'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 9748504..8861dd6 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 _0xae81=['../../config/environment','./disposition.controller','get','isAuthenticated','index','/:id','show','put','update','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x3b2ea3,_0x2732cb){var _0x1fa5b5=function(_0x8b4b07){while(--_0x8b4b07){_0x3b2ea3['push'](_0x3b2ea3['shift']());}};_0x1fa5b5(++_0x2732cb);}(_0xae81,0x12b));var _0x1ae8=function(_0x5469cf,_0x3d40ab){_0x5469cf=_0x5469cf-0x0;var _0x1ab9b9=_0xae81[_0x5469cf];return _0x1ab9b9;};'use strict';var multer=require(_0x1ae8('0x0'));var util=require(_0x1ae8('0x1'));var path=require(_0x1ae8('0x2'));var timeout=require('connect-timeout');var express=require(_0x1ae8('0x3'));var router=express[_0x1ae8('0x4')]();var fs_extra=require(_0x1ae8('0x5'));var auth=require(_0x1ae8('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x1ae8('0x7'));var controller=require(_0x1ae8('0x8'));router[_0x1ae8('0x9')]('/',auth[_0x1ae8('0xa')](),controller[_0x1ae8('0xb')]);router[_0x1ae8('0x9')](_0x1ae8('0xc'),auth[_0x1ae8('0xa')](),controller[_0x1ae8('0xd')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x1ae8('0xe')](_0x1ae8('0xc'),auth[_0x1ae8('0xa')](),controller[_0x1ae8('0xf')]);router['delete']('/:id',auth[_0x1ae8('0xa')](),controller[_0x1ae8('0x10')]);module[_0x1ae8('0x11')]=router; \ No newline at end of file +var _0x527e=['index','get','/:id','show','post','create','delete','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','./disposition.controller','isAuthenticated'];(function(_0x206a92,_0x305bcd){var _0x2a612a=function(_0x244665){while(--_0x244665){_0x206a92['push'](_0x206a92['shift']());}};_0x2a612a(++_0x305bcd);}(_0x527e,0xc3));var _0xe527=function(_0x549aea,_0x1875f4){_0x549aea=_0x549aea-0x0;var _0x325453=_0x527e[_0x549aea];return _0x325453;};'use strict';var multer=require(_0xe527('0x0'));var util=require(_0xe527('0x1'));var path=require(_0xe527('0x2'));var timeout=require(_0xe527('0x3'));var express=require(_0xe527('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xe527('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xe527('0x6'));var controller=require(_0xe527('0x7'));router['get']('/',auth[_0xe527('0x8')](),controller[_0xe527('0x9')]);router[_0xe527('0xa')](_0xe527('0xb'),auth['isAuthenticated'](),controller[_0xe527('0xc')]);router[_0xe527('0xd')]('/',auth[_0xe527('0x8')](),controller[_0xe527('0xe')]);router['put'](_0xe527('0xb'),auth[_0xe527('0x8')](),controller['update']);router[_0xe527('0xf')](_0xe527('0xb'),auth[_0xe527('0x8')](),controller['destroy']);module[_0xe527('0x10')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index 4656cb8..938dd18 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 _0xa751=['14400','v17,v27,v29','SIP','IAX','DADHI','TEXT','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','yes','xCALLY\x20Motion\x20Fax','ENUM','2400','4800','7200','9600','12000'];(function(_0xd839e7,_0x4209e9){var _0xc3cf23=function(_0x16ace2){while(--_0x16ace2){_0xd839e7['push'](_0xd839e7['shift']());}};_0xc3cf23(++_0x4209e9);}(_0xa751,0x175));var _0x1a75=function(_0x1c349e,_0x161c16){_0x1c349e=_0x1c349e-0x0;var _0x369b6a=_0xa751[_0x1c349e];return _0x369b6a;};'use strict';var Sequelize=require(_0x1a75('0x0'));module[_0x1a75('0x1')]={'name':{'type':Sequelize[_0x1a75('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x1a75('0x2')]},'ecm':{'type':Sequelize['ENUM'](_0x1a75('0x3'),'no'),'defaultValue':'yes'},'headerinfo':{'type':Sequelize[_0x1a75('0x2')],'defaultValue':_0x1a75('0x4')},'localstationid':{'type':Sequelize[_0x1a75('0x2')],'unique':'localstationid'},'minrate':{'type':Sequelize[_0x1a75('0x5')](_0x1a75('0x6'),_0x1a75('0x7'),_0x1a75('0x8'),_0x1a75('0x9'),_0x1a75('0xa'),_0x1a75('0xb')),'defaultValue':'4800'},'maxrate':{'type':Sequelize['ENUM']('2400',_0x1a75('0x7'),_0x1a75('0x8'),_0x1a75('0x9'),_0x1a75('0xa'),_0x1a75('0xb')),'defaultValue':_0x1a75('0xb')},'modem':{'type':Sequelize[_0x1a75('0x2')],'defaultValue':_0x1a75('0xc')},'gateway':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x1a75('0x5')](_0x1a75('0xd'),_0x1a75('0xe'),_0x1a75('0xf'),'KHOMP'),'defaultValue':'SIP'},'key':{'type':Sequelize[_0x1a75('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x1a75('0x10')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x1a75('0x11')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x1a75('0x11')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x1a75('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x1a75('0x11')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x1a75('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x1a75('0x13')},'mandatoryDisposition':{'type':Sequelize[_0x1a75('0x11')],'defaultValue':![],'comment':_0x1a75('0x14'),'set':function(_0x25e3c2){if(!_0x25e3c2)this[_0x1a75('0x15')](_0x1a75('0x16'),null);this['setDataValue'](_0x1a75('0x17'),_0x25e3c2);}}}; \ No newline at end of file +var _0xaa3f=['DADHI','KHOMP','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDisposition','sequelize','exports','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','4800','7200','9600','12000','14400','v17,v27,v29','IAX'];(function(_0x6600b9,_0x42643e){var _0xe850a4=function(_0x140164){while(--_0x140164){_0x6600b9['push'](_0x6600b9['shift']());}};_0xe850a4(++_0x42643e);}(_0xaa3f,0xbb));var _0xfaa3=function(_0x5b5813,_0x5a7b19){_0x5b5813=_0x5b5813-0x0;var _0x4f4f85=_0xaa3f[_0x5b5813];return _0x4f4f85;};'use strict';var Sequelize=require(_0xfaa3('0x0'));module[_0xfaa3('0x1')]={'name':{'type':Sequelize[_0xfaa3('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xfaa3('0x2')]},'ecm':{'type':Sequelize[_0xfaa3('0x3')](_0xfaa3('0x4'),'no'),'defaultValue':_0xfaa3('0x4')},'headerinfo':{'type':Sequelize[_0xfaa3('0x2')],'defaultValue':_0xfaa3('0x5')},'localstationid':{'type':Sequelize['STRING'],'unique':'localstationid'},'minrate':{'type':Sequelize[_0xfaa3('0x3')]('2400',_0xfaa3('0x6'),_0xfaa3('0x7'),_0xfaa3('0x8'),_0xfaa3('0x9'),_0xfaa3('0xa')),'defaultValue':_0xfaa3('0x6')},'maxrate':{'type':Sequelize[_0xfaa3('0x3')]('2400',_0xfaa3('0x6'),_0xfaa3('0x7'),'9600','12000',_0xfaa3('0xa')),'defaultValue':_0xfaa3('0xa')},'modem':{'type':Sequelize[_0xfaa3('0x2')],'defaultValue':_0xfaa3('0xb')},'gateway':{'type':Sequelize[_0xfaa3('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0xfaa3('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0xfaa3('0x3')]('SIP',_0xfaa3('0xc'),_0xfaa3('0xd'),_0xfaa3('0xe')),'defaultValue':'SIP'},'key':{'type':Sequelize[_0xfaa3('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xfaa3('0xf');}},'notificationSound':{'type':Sequelize[_0xfaa3('0x10')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xfaa3('0x10')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xfaa3('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xfaa3('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xfaa3('0x10')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xfaa3('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xfaa3('0x11')],'allowNull':!![],'defaultValue':null,'comment':_0xfaa3('0x12')},'mandatoryDisposition':{'type':Sequelize[_0xfaa3('0x10')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x5dd38c){if(!_0x5dd38c)this['setDataValue']('mandatoryDispositionPauseId',null);this['setDataValue'](_0xfaa3('0x13'),_0x5dd38c);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index 9382586..6207e7b 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 _0x956c=['findById','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','List','CmContact','Contacts','DESC','attachments','join','root','server/files/attachments','basename','isNil','\x22%s\x22\x20<%s>','fax','ListId','Send\x20Fax\x20failed','user','out','filename','FaxMessage','Contact\x20not\x20found','spread','ContactId','Messages','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','isArray','getAgents','rimraf','zip-dir','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./faxAccount.socket','register','jayson/promise','client','http','then','info','FaxAccount,\x20%s,\x20%s','debug','FaxAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','reject','save','destroy','get','FaxAccounts','UserProfileResource','stack','name','Pause','mandatoryDispositionPause','FaxAccount','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','describe','addDisposition','FaxAccountId','Disposition','getDispositions','findOne','ids','addAnswer','CannedAnswer','getAnswers','addInteraction','omit','getInteractions','FaxInteraction','Contact','User','Owner','fullname','internal','Tag','Tags','color','tag','sequelize','transaction','READ_COMMITTED','findAndCountAll','priority','getApplications','context','exten','localstationid','app','system','description','Fax\x20Extension','appdata','push','Answer','CDR(type)=inbound-fax','Set','ecm','gateway','headerinfo','maxrate','minrate','t38timeout','FAXOPT(','Wait','ReceiveFax','addAccountApplications','VoiceExtension','bulkCreate','updateAccountApplications','tech','createdAt','updatedAt','TrunkId'];(function(_0x319db5,_0x3b3f0e){var _0x311a2e=function(_0x2e1a38){while(--_0x2e1a38){_0x319db5['push'](_0x319db5['shift']());}};_0x311a2e(++_0x3b3f0e);}(_0x956c,0x1a9));var _0xc956=function(_0x45678c,_0xf7ba35){_0x45678c=_0x45678c-0x0;var _0x271704=_0x956c[_0x45678c];return _0x271704;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc956('0x0'));var zipdir=require(_0xc956('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc956('0x2'));var moment=require(_0xc956('0x3'));var BPromise=require(_0xc956('0x4'));var Mustache=require('mustache');var util=require(_0xc956('0x5'));var path=require(_0xc956('0x6'));var sox=require('sox');var csv=require(_0xc956('0x7'));var ejs=require(_0xc956('0x8'));var fs=require('fs');var fs_extra=require(_0xc956('0x9'));var _=require('lodash');var squel=require(_0xc956('0xa'));var crypto=require('crypto');var jsforce=require(_0xc956('0xb'));var deskjs=require(_0xc956('0xc'));var toCsv=require(_0xc956('0x7'));var querystring=require('querystring');var Papa=require(_0xc956('0xd'));var Redis=require('ioredis');var authService=require(_0xc956('0xe'));var qs=require(_0xc956('0xf'));var as=require(_0xc956('0x10'));var hardwareService=require(_0xc956('0x11'));var logger=require('../../config/logger')(_0xc956('0x12'));var utils=require('../../config/utils');var config=require(_0xc956('0x13'));var licenseUtil=require(_0xc956('0x14'));var db=require(_0xc956('0x15'))['db'];config[_0xc956('0x16')]=_['defaults'](config[_0xc956('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0xc956('0x17'))(new Redis(config[_0xc956('0x16')]));require(_0xc956('0x18'))[_0xc956('0x19')](socket);var jayson=require(_0xc956('0x1a'));var client=jayson[_0xc956('0x1b')][_0xc956('0x1c')]({'port':0x232c});var client9002=jayson['client'][_0xc956('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x562620,_0x51aa60,_0xbd8d38,_0x5ea2fb){return new BPromise(function(_0x880595,_0x3f952f){var _0x259d2a=_0x5ea2fb||client;return _0x259d2a['request'](_0x562620,_0xbd8d38)[_0xc956('0x1d')](function(_0x4bd463){logger[_0xc956('0x1e')](_0xc956('0x1f'),_0x51aa60,'request\x20sent');logger[_0xc956('0x20')](_0xc956('0x21'),_0x51aa60,_0xc956('0x22'),JSON[_0xc956('0x23')](_0x4bd463));if(_0x4bd463['error']){if(_0x4bd463[_0xc956('0x24')][_0xc956('0x25')]===0x1f4){logger[_0xc956('0x24')](_0xc956('0x1f'),_0x51aa60,_0x4bd463['error'][_0xc956('0x26')]);return _0x3f952f(_0x4bd463[_0xc956('0x24')]['message']);}logger['error'](_0xc956('0x1f'),_0x51aa60,_0x4bd463[_0xc956('0x24')][_0xc956('0x26')]);return _0x880595(_0x4bd463[_0xc956('0x24')][_0xc956('0x26')]);}else{logger[_0xc956('0x1e')](_0xc956('0x1f'),_0x51aa60,_0xc956('0x22'));_0x880595(_0x4bd463[_0xc956('0x27')][_0xc956('0x26')]);}})['catch'](function(_0x2480c6){logger[_0xc956('0x24')](_0xc956('0x1f'),_0x51aa60,_0x2480c6);_0x3f952f(_0x2480c6);});});}function respondWithStatusCode(_0x1a3e13,_0x2d4d36){_0x2d4d36=_0x2d4d36||0xcc;return function(_0x4c8fb5){if(_0x4c8fb5){return _0x1a3e13[_0xc956('0x28')](_0x2d4d36);}return _0x1a3e13['status'](_0x2d4d36)[_0xc956('0x29')]();};}function respondWithResult(_0x541f5d,_0x5b1b70){_0x5b1b70=_0x5b1b70||0xc8;return function(_0x374be3){if(_0x374be3){return _0x541f5d[_0xc956('0x2a')](_0x5b1b70)[_0xc956('0x2b')](_0x374be3);}};}function respondWithFilteredResult(_0x15b0e2,_0x218c4f){return function(_0x443471){if(_0x443471){var _0x1c0104=typeof _0x218c4f[_0xc956('0x2c')]===_0xc956('0x2d')&&typeof _0x218c4f[_0xc956('0x2e')]===_0xc956('0x2d');var _0x50e97d=_0x443471[_0xc956('0x2f')];var _0x2a979b=_0x1c0104?0x0:_0x218c4f[_0xc956('0x2c')];var _0xb2ecd6=_0x1c0104?_0x443471['count']:_0x218c4f[_0xc956('0x2c')]+_0x218c4f[_0xc956('0x2e')];var _0x3240e0;if(_0xb2ecd6>=_0x50e97d){_0xb2ecd6=_0x50e97d;_0x3240e0=0xc8;}else{_0x3240e0=0xce;}_0x15b0e2['status'](_0x3240e0);return _0x15b0e2[_0xc956('0x30')]('Content-Range',_0x2a979b+'-'+_0xb2ecd6+'/'+_0x50e97d)['json'](_0x443471);}return null;};}function patchUpdates(_0x18fd65){return function(_0x5871f1){try{jsonpatch[_0xc956('0x31')](_0x5871f1,_0x18fd65,!![]);}catch(_0x160e6e){return BPromise[_0xc956('0x32')](_0x160e6e);}return _0x5871f1[_0xc956('0x33')]();};}function saveUpdates(_0x469f32,_0x3b5945){return function(_0xf2112f){if(_0xf2112f){return _0xf2112f['update'](_0x469f32)[_0xc956('0x1d')](function(_0xa09311){return _0xa09311;});}return null;};}function removeEntity(_0xf3cc48,_0xe82fb4){return function(_0x1037a0){if(_0x1037a0){return _0x1037a0[_0xc956('0x34')]()[_0xc956('0x1d')](function(){var _0x36aa41=_0x1037a0[_0xc956('0x35')]({'plain':!![]});var _0x5ae57d=_0xc956('0x36');return db[_0xc956('0x37')][_0xc956('0x34')]({'where':{'type':_0x5ae57d,'resourceId':_0x36aa41['id']}})[_0xc956('0x1d')](function(){return _0x1037a0;});})[_0xc956('0x1d')](function(){_0xf3cc48[_0xc956('0x2a')](0xcc)[_0xc956('0x29')]();});}};}function handleEntityNotFound(_0x22d672,_0x345a2e){return function(_0xab6bea){if(!_0xab6bea){_0x22d672['sendStatus'](0x194);}return _0xab6bea;};}function handleError(_0x24d99e,_0x1f44f5){_0x1f44f5=_0x1f44f5||0x1f4;return function(_0x4a498d){logger[_0xc956('0x24')](_0x4a498d[_0xc956('0x38')]);if(_0x4a498d[_0xc956('0x39')]){delete _0x4a498d['name'];}_0x24d99e[_0xc956('0x2a')](_0x1f44f5)['send'](_0x4a498d);};}exports['index']=function(_0x5293b7,_0x136a82){var _0x46a559={'include':[{'model':db[_0xc956('0x3a')],'as':_0xc956('0x3b')}]},_0x42b92b={},_0x4c16b7={'count':0x0,'rows':[]};var _0xa5e454=_['map'](db[_0xc956('0x3c')][_0xc956('0x3d')],function(_0x347435){return{'name':_0x347435[_0xc956('0x3e')],'type':_0x347435[_0xc956('0x3f')][_0xc956('0x40')]};});_0x42b92b[_0xc956('0x41')]=_[_0xc956('0x42')](_0xa5e454,_0xc956('0x39'));_0x42b92b[_0xc956('0x43')]=_[_0xc956('0x44')](_0x5293b7[_0xc956('0x43')]);_0x42b92b[_0xc956('0x45')]=_[_0xc956('0x46')](_0x42b92b['model'],_0x42b92b[_0xc956('0x43')]);_0x46a559[_0xc956('0x47')]=_[_0xc956('0x46')](_0x42b92b[_0xc956('0x41')],qs[_0xc956('0x48')](_0x5293b7[_0xc956('0x43')][_0xc956('0x48')]));_0x46a559[_0xc956('0x47')]=_0x46a559[_0xc956('0x47')][_0xc956('0x49')]?_0x46a559[_0xc956('0x47')]:_0x42b92b[_0xc956('0x41')];if(!_0x5293b7[_0xc956('0x43')][_0xc956('0x4a')](_0xc956('0x4b'))){_0x46a559[_0xc956('0x2e')]=qs[_0xc956('0x2e')](_0x5293b7['query'][_0xc956('0x2e')]);_0x46a559['offset']=qs[_0xc956('0x2c')](_0x5293b7['query'][_0xc956('0x2c')]);}_0x46a559[_0xc956('0x4c')]=qs[_0xc956('0x4d')](_0x5293b7['query'][_0xc956('0x4d')]);_0x46a559[_0xc956('0x4e')]=qs[_0xc956('0x45')](_[_0xc956('0x4f')](_0x5293b7[_0xc956('0x43')],_0x42b92b[_0xc956('0x45')]),_0xa5e454);if(_0x5293b7[_0xc956('0x43')][_0xc956('0x50')]){_0x46a559['where']=_[_0xc956('0x51')](_0x46a559[_0xc956('0x4e')],{'$or':_[_0xc956('0x42')](_0xa5e454,function(_0x47e483){if(_0x47e483[_0xc956('0x3f')]!==_0xc956('0x52')){var _0x346b4e={};_0x346b4e[_0x47e483[_0xc956('0x39')]]={'$like':'%'+_0x5293b7['query']['filter']+'%'};return _0x346b4e;}})});}_0x46a559=_['merge']({},_0x46a559,_0x5293b7[_0xc956('0x53')]);var _0x426bc5={'where':_0x46a559[_0xc956('0x4e')]};return db[_0xc956('0x3c')][_0xc956('0x2f')](_0x426bc5)[_0xc956('0x1d')](function(_0x5cd63e){_0x4c16b7[_0xc956('0x2f')]=_0x5cd63e;if(_0x5293b7[_0xc956('0x43')][_0xc956('0x54')]){_0x46a559[_0xc956('0x55')]=[{'all':!![]}];}return db['FaxAccount'][_0xc956('0x56')](_0x46a559);})[_0xc956('0x1d')](function(_0x2870f7){_0x4c16b7[_0xc956('0x57')]=_0x2870f7;return _0x4c16b7;})['then'](respondWithFilteredResult(_0x136a82,_0x46a559))[_0xc956('0x58')](handleError(_0x136a82,null));};exports[_0xc956('0x59')]=function(_0x19e58e,_0x567ef8){var _0x252a2f={'raw':![],'where':{'id':_0x19e58e['params']['id']},'include':[{'model':db['Pause'],'as':_0xc956('0x3b')}]},_0x544c86={};_0x544c86[_0xc956('0x41')]=_['keys'](db[_0xc956('0x3c')][_0xc956('0x3d')]);_0x544c86['query']=_[_0xc956('0x44')](_0x19e58e[_0xc956('0x43')]);_0x544c86['filters']=_[_0xc956('0x46')](_0x544c86[_0xc956('0x41')],_0x544c86[_0xc956('0x43')]);_0x252a2f['attributes']=_[_0xc956('0x46')](_0x544c86[_0xc956('0x41')],qs[_0xc956('0x48')](_0x19e58e['query'][_0xc956('0x48')]));_0x252a2f[_0xc956('0x47')]=_0x252a2f[_0xc956('0x47')][_0xc956('0x49')]?_0x252a2f[_0xc956('0x47')]:_0x544c86[_0xc956('0x41')];if(_0x19e58e[_0xc956('0x43')][_0xc956('0x54')]){_0x252a2f[_0xc956('0x55')]=[{'all':!![]}];}_0x252a2f=_['merge']({},_0x252a2f,_0x19e58e[_0xc956('0x53')]);return db[_0xc956('0x3c')][_0xc956('0x5a')](_0x252a2f)['then'](handleEntityNotFound(_0x567ef8,null))[_0xc956('0x1d')](respondWithResult(_0x567ef8,null))['catch'](handleError(_0x567ef8,null));};exports['create']=function(_0x5dc669,_0xd6c368){return db[_0xc956('0x3c')][_0xc956('0x5b')](_0x5dc669[_0xc956('0x5c')],{})['then'](function(_0x47d570){var _0x4a5e1a=_0x5dc669['user'][_0xc956('0x35')]({'plain':!![]});if(!_0x4a5e1a)throw new Error(_0xc956('0x5d'));if(_0x4a5e1a[_0xc956('0x5e')]==='user'){var _0x549d21=_0x47d570[_0xc956('0x35')]({'plain':!![]});var _0x6d1510=_0xc956('0x36');return db['UserProfileSection'][_0xc956('0x5a')]({'where':{'name':_0x6d1510,'userProfileId':_0x4a5e1a[_0xc956('0x5f')]},'raw':!![]})[_0xc956('0x1d')](function(_0x306be1){if(_0x306be1&&_0x306be1['autoAssociation']===0x0){return db['UserProfileResource'][_0xc956('0x5b')]({'name':_0x549d21[_0xc956('0x39')],'resourceId':_0x549d21['id'],'type':_0x306be1['name'],'sectionId':_0x306be1['id']},{})[_0xc956('0x1d')](function(){return _0x47d570;});}else{return _0x47d570;}})[_0xc956('0x58')](function(_0xf42f77){logger['error'](_0xc956('0x60'),_0xf42f77);throw _0xf42f77;});}return _0x47d570;})['then'](respondWithResult(_0xd6c368,0xc9))[_0xc956('0x58')](handleError(_0xd6c368,null));};exports[_0xc956('0x61')]=function(_0x339da8,_0xfea9ea){if(_0x339da8[_0xc956('0x5c')]['id']){delete _0x339da8[_0xc956('0x5c')]['id'];}return db[_0xc956('0x3c')]['find']({'where':{'id':_0x339da8[_0xc956('0x62')]['id']},'include':[{'model':db['Pause'],'as':_0xc956('0x3b')}]})['then'](handleEntityNotFound(_0xfea9ea,null))[_0xc956('0x1d')](saveUpdates(_0x339da8[_0xc956('0x5c')],null))['then'](respondWithResult(_0xfea9ea,null))['catch'](handleError(_0xfea9ea,null));};exports[_0xc956('0x34')]=function(_0x30d08d,_0x15dd8d){return db[_0xc956('0x3c')][_0xc956('0x5a')]({'where':{'id':_0x30d08d['params']['id']}})['then'](handleEntityNotFound(_0x15dd8d,null))[_0xc956('0x1d')](removeEntity(_0x15dd8d,null))[_0xc956('0x58')](handleError(_0x15dd8d,null));};exports[_0xc956('0x63')]=function(_0x553038,_0x2665b2){return db[_0xc956('0x3c')][_0xc956('0x63')]()[_0xc956('0x1d')](respondWithResult(_0x2665b2,null))['catch'](handleError(_0x2665b2,null));};exports[_0xc956('0x64')]=function(_0x4e67dd,_0x2d5717,_0x253e10){if(_0x4e67dd[_0xc956('0x5c')]['id']){delete _0x4e67dd[_0xc956('0x5c')]['id'];}return db[_0xc956('0x3c')][_0xc956('0x5a')]({'where':{'id':_0x4e67dd[_0xc956('0x62')]['id']}})[_0xc956('0x1d')](handleEntityNotFound(_0x2d5717,null))[_0xc956('0x1d')](function(_0x310214){if(_0x310214){_0x4e67dd[_0xc956('0x5c')][_0xc956('0x65')]=_0x310214['id'];return db[_0xc956('0x66')][_0xc956('0x5b')](_0x4e67dd[_0xc956('0x5c')]);}})[_0xc956('0x1d')](respondWithResult(_0x2d5717,null))[_0xc956('0x58')](handleError(_0x2d5717,null));};exports[_0xc956('0x67')]=function(_0x25f63f,_0x4179a2,_0x1027c9){var _0x110474={'raw':![],'where':{}};var _0x5b4dcc={};var _0x213ec3={'count':0x0,'rows':[]};return db[_0xc956('0x3c')][_0xc956('0x68')]({'where':{'id':_0x25f63f[_0xc956('0x62')]['id']}})[_0xc956('0x1d')](handleEntityNotFound(_0x4179a2,null))[_0xc956('0x1d')](function(_0x570bfe){if(_0x570bfe){_0x5b4dcc[_0xc956('0x41')]=_[_0xc956('0x44')](db[_0xc956('0x66')]['rawAttributes']);_0x5b4dcc['query']=_[_0xc956('0x44')](_0x25f63f[_0xc956('0x43')]);_0x5b4dcc['filters']=_[_0xc956('0x46')](_0x5b4dcc[_0xc956('0x41')],_0x5b4dcc[_0xc956('0x43')]);_0x110474['attributes']=_[_0xc956('0x46')](_0x5b4dcc[_0xc956('0x41')],qs[_0xc956('0x48')](_0x25f63f[_0xc956('0x43')][_0xc956('0x48')]));_0x110474[_0xc956('0x47')]=_0x110474['attributes'][_0xc956('0x49')]?_0x110474[_0xc956('0x47')]:_0x5b4dcc[_0xc956('0x41')];if(!_0x25f63f['query']['hasOwnProperty'](_0xc956('0x4b'))){_0x110474[_0xc956('0x2e')]=qs[_0xc956('0x2e')](_0x25f63f[_0xc956('0x43')][_0xc956('0x2e')]);_0x110474[_0xc956('0x2c')]=qs[_0xc956('0x2c')](_0x25f63f[_0xc956('0x43')][_0xc956('0x2c')]);}_0x110474[_0xc956('0x4c')]=qs[_0xc956('0x4d')](_0x25f63f[_0xc956('0x43')]['sort']);_0x110474[_0xc956('0x4e')]=qs[_0xc956('0x45')](_[_0xc956('0x4f')](_0x25f63f[_0xc956('0x43')],_0x5b4dcc[_0xc956('0x45')]));_0x110474['where'][_0xc956('0x65')]=_0x570bfe['id'];if(_0x25f63f[_0xc956('0x43')]['filter']){_0x110474['where']=_[_0xc956('0x51')](_0x110474[_0xc956('0x4e')],{'$or':_['map'](_0x110474[_0xc956('0x47')],function(_0x4e4887){var _0x4733d0={};_0x4733d0[_0x4e4887]={'$like':'%'+_0x25f63f[_0xc956('0x43')][_0xc956('0x50')]+'%'};return _0x4733d0;})});}_0x110474=_['merge']({},_0x110474,_0x25f63f['options']);return db[_0xc956('0x66')]['count']({'where':_0x110474[_0xc956('0x4e')]})['then'](function(_0x28b77d){_0x213ec3['count']=_0x28b77d;if(_0x25f63f[_0xc956('0x43')][_0xc956('0x54')]){_0x110474[_0xc956('0x55')]=[{'all':!![]}];}return db[_0xc956('0x66')][_0xc956('0x56')](_0x110474);})[_0xc956('0x1d')](function(_0x52892d){_0x213ec3['rows']=_0x52892d;return _0x213ec3;});}})['then'](respondWithFilteredResult(_0x4179a2,_0x110474))['catch'](handleError(_0x4179a2,null));};exports['removeDispositions']=function(_0x3356db,_0x41c8e7,_0x4ff2ca){return db['FaxAccount'][_0xc956('0x5a')]({'where':{'id':_0x3356db[_0xc956('0x62')]['id']}})['then'](handleEntityNotFound(_0x41c8e7,null))[_0xc956('0x1d')](function(_0x1b0bd6){if(_0x1b0bd6){return _0x1b0bd6['removeDispositions'](_0x3356db[_0xc956('0x43')][_0xc956('0x69')]);}})[_0xc956('0x1d')](respondWithStatusCode(_0x41c8e7,null))['catch'](handleError(_0x41c8e7,null));};exports[_0xc956('0x6a')]=function(_0x18d958,_0x5addb7,_0x1550df){if(_0x18d958[_0xc956('0x5c')]['id']){delete _0x18d958[_0xc956('0x5c')]['id'];}return db[_0xc956('0x3c')][_0xc956('0x5a')]({'where':{'id':_0x18d958[_0xc956('0x62')]['id']}})['then'](handleEntityNotFound(_0x5addb7,null))['then'](function(_0x207125){if(_0x207125){_0x18d958[_0xc956('0x5c')]['FaxAccountId']=_0x207125['id'];return db[_0xc956('0x6b')][_0xc956('0x5b')](_0x18d958[_0xc956('0x5c')]);}})[_0xc956('0x1d')](respondWithResult(_0x5addb7,null))[_0xc956('0x58')](handleError(_0x5addb7,null));};exports[_0xc956('0x6c')]=function(_0x1abd5e,_0x2edf36,_0x805c55){var _0x43d8a8={'raw':![],'where':{}};var _0x2d4922={};var _0x5602a6={'count':0x0,'rows':[]};return db[_0xc956('0x3c')][_0xc956('0x68')]({'where':{'id':_0x1abd5e['params']['id']}})[_0xc956('0x1d')](handleEntityNotFound(_0x2edf36,null))[_0xc956('0x1d')](function(_0x5a4517){if(_0x5a4517){_0x2d4922['model']=_['keys'](db['CannedAnswer'][_0xc956('0x3d')]);_0x2d4922['query']=_['keys'](_0x1abd5e['query']);_0x2d4922[_0xc956('0x45')]=_['intersection'](_0x2d4922[_0xc956('0x41')],_0x2d4922['query']);_0x43d8a8[_0xc956('0x47')]=_[_0xc956('0x46')](_0x2d4922[_0xc956('0x41')],qs['fields'](_0x1abd5e[_0xc956('0x43')][_0xc956('0x48')]));_0x43d8a8[_0xc956('0x47')]=_0x43d8a8[_0xc956('0x47')][_0xc956('0x49')]?_0x43d8a8[_0xc956('0x47')]:_0x2d4922[_0xc956('0x41')];if(!_0x1abd5e['query'][_0xc956('0x4a')](_0xc956('0x4b'))){_0x43d8a8[_0xc956('0x2e')]=qs[_0xc956('0x2e')](_0x1abd5e[_0xc956('0x43')]['limit']);_0x43d8a8[_0xc956('0x2c')]=qs[_0xc956('0x2c')](_0x1abd5e['query'][_0xc956('0x2c')]);}_0x43d8a8[_0xc956('0x4c')]=qs[_0xc956('0x4d')](_0x1abd5e[_0xc956('0x43')]['sort']);_0x43d8a8[_0xc956('0x4e')]=qs[_0xc956('0x45')](_[_0xc956('0x4f')](_0x1abd5e[_0xc956('0x43')],_0x2d4922[_0xc956('0x45')]));_0x43d8a8['where']['FaxAccountId']=_0x5a4517['id'];if(_0x1abd5e[_0xc956('0x43')][_0xc956('0x50')]){_0x43d8a8[_0xc956('0x4e')]=_[_0xc956('0x51')](_0x43d8a8['where'],{'$or':_[_0xc956('0x42')](_0x43d8a8['attributes'],function(_0x47b78a){var _0x28e717={};_0x28e717[_0x47b78a]={'$like':'%'+_0x1abd5e[_0xc956('0x43')][_0xc956('0x50')]+'%'};return _0x28e717;})});}_0x43d8a8=_[_0xc956('0x51')]({},_0x43d8a8,_0x1abd5e[_0xc956('0x53')]);return db[_0xc956('0x6b')][_0xc956('0x2f')]({'where':_0x43d8a8[_0xc956('0x4e')]})[_0xc956('0x1d')](function(_0x1f3391){_0x5602a6[_0xc956('0x2f')]=_0x1f3391;if(_0x1abd5e[_0xc956('0x43')][_0xc956('0x54')]){_0x43d8a8[_0xc956('0x55')]=[{'all':!![]}];}return db[_0xc956('0x6b')][_0xc956('0x56')](_0x43d8a8);})[_0xc956('0x1d')](function(_0x1a9efa){_0x5602a6[_0xc956('0x57')]=_0x1a9efa;return _0x5602a6;});}})[_0xc956('0x1d')](respondWithFilteredResult(_0x2edf36,_0x43d8a8))[_0xc956('0x58')](handleError(_0x2edf36,null));};exports['removeAnswers']=function(_0x2a086b,_0xa8b53d,_0x59dc02){return db[_0xc956('0x3c')][_0xc956('0x5a')]({'where':{'id':_0x2a086b[_0xc956('0x62')]['id']}})[_0xc956('0x1d')](handleEntityNotFound(_0xa8b53d,null))['then'](function(_0x332173){if(_0x332173){return _0x332173['removeAnswers'](_0x2a086b[_0xc956('0x43')][_0xc956('0x69')]);}})[_0xc956('0x1d')](respondWithStatusCode(_0xa8b53d,null))[_0xc956('0x58')](handleError(_0xa8b53d,null));};exports[_0xc956('0x6d')]=function(_0x1263d8,_0x4ae910,_0x158a54){return db['FaxInteraction'][_0xc956('0x5a')]({'where':{'id':_0x1263d8[_0xc956('0x62')]['id']}})[_0xc956('0x1d')](handleEntityNotFound(_0x4ae910,null))['then'](function(_0x15d3b8){if(_0x15d3b8){return _0x15d3b8[_0xc956('0x6d')](_0x1263d8[_0xc956('0x5c')][_0xc956('0x69')],_[_0xc956('0x6e')](_0x1263d8[_0xc956('0x5c')],[_0xc956('0x69'),'id'])||{});}})['then'](respondWithResult(_0x4ae910,null))[_0xc956('0x58')](handleError(_0x4ae910,null));};exports[_0xc956('0x6f')]=function(_0x207870,_0x15d075,_0x492f9a){var _0xc92891={'raw':![],'where':{}};var _0x4eb469={};var _0x1da921={'count':0x0,'rows':[]};return db[_0xc956('0x3c')][_0xc956('0x68')]({'where':{'id':_0x207870[_0xc956('0x62')]['id']}})[_0xc956('0x1d')](handleEntityNotFound(_0x15d075,null))['then'](function(_0x43c19e){if(_0x43c19e){_0x4eb469[_0xc956('0x41')]=_['keys'](db['FaxInteraction'][_0xc956('0x3d')]);_0x4eb469[_0xc956('0x43')]=_[_0xc956('0x44')](_0x207870[_0xc956('0x43')]);_0x4eb469[_0xc956('0x45')]=_['intersection'](_0x4eb469[_0xc956('0x41')],_0x4eb469[_0xc956('0x43')]);_0xc92891[_0xc956('0x47')]=_[_0xc956('0x46')](_0x4eb469[_0xc956('0x41')],qs[_0xc956('0x48')](_0x207870[_0xc956('0x43')][_0xc956('0x48')]));_0xc92891[_0xc956('0x47')]=_0xc92891[_0xc956('0x47')]['length']?_0xc92891['attributes']:_0x4eb469['model'];if(!_0x207870[_0xc956('0x43')][_0xc956('0x4a')](_0xc956('0x4b'))){_0xc92891[_0xc956('0x2e')]=qs[_0xc956('0x2e')](_0x207870[_0xc956('0x43')][_0xc956('0x2e')]);_0xc92891['offset']=qs[_0xc956('0x2c')](_0x207870[_0xc956('0x43')][_0xc956('0x2c')]);}_0xc92891[_0xc956('0x4c')]=qs['sort'](_0x207870[_0xc956('0x43')][_0xc956('0x4d')]);_0xc92891[_0xc956('0x4e')]=qs[_0xc956('0x45')](_[_0xc956('0x4f')](_0x207870[_0xc956('0x43')],_0x4eb469[_0xc956('0x45')]));_0xc92891[_0xc956('0x4e')][_0xc956('0x65')]=_0x43c19e['id'];if(_0x207870[_0xc956('0x43')][_0xc956('0x50')]){_0xc92891[_0xc956('0x4e')]=_[_0xc956('0x51')](_0xc92891[_0xc956('0x4e')],{'$or':_[_0xc956('0x42')](_0xc92891[_0xc956('0x47')],function(_0x4516cf){var _0x5804cf={};_0x5804cf[_0x4516cf]={'$like':'%'+_0x207870[_0xc956('0x43')][_0xc956('0x50')]+'%'};return _0x5804cf;})});}_0xc92891=_[_0xc956('0x51')]({},_0xc92891,_0x207870[_0xc956('0x53')]);return db[_0xc956('0x70')][_0xc956('0x2f')]({'where':_0xc92891[_0xc956('0x4e')]})['then'](function(_0x48b49e){_0x1da921[_0xc956('0x2f')]=_0x48b49e;if(_0x207870[_0xc956('0x43')][_0xc956('0x54')]){_0xc92891['include']=[{'model':db['CmContact'],'as':_0xc956('0x71'),'required':![]},{'model':db[_0xc956('0x72')],'as':_0xc956('0x73'),'attributes':[_0xc956('0x39'),_0xc956('0x74'),_0xc956('0x75')],'required':![]},{'model':db[_0xc956('0x76')],'as':_0xc956('0x77'),'attributes':['id',_0xc956('0x39'),_0xc956('0x78')],'where':_0x207870[_0xc956('0x43')][_0xc956('0x79')]?{'id':_0x207870[_0xc956('0x43')]['tag']}:undefined,'required':_0x207870[_0xc956('0x43')][_0xc956('0x79')]?!![]:![]}];}return db[_0xc956('0x70')][_0xc956('0x56')](_0xc92891);})[_0xc956('0x1d')](function(_0xaf21a1){_0x1da921[_0xc956('0x57')]=_0xaf21a1;return _0x1da921;});}})[_0xc956('0x1d')](respondWithFilteredResult(_0x15d075,_0xc92891))[_0xc956('0x58')](handleError(_0x15d075,null));};exports['addApplications']=function(_0x54b232,_0x170a5f){var _0x44958e=_0x54b232[_0xc956('0x62')]['id'];var _0x1d405d=_0x54b232[_0xc956('0x5c')];var _0x361956=0xc8;var _0x3cd1c9=null;return db[_0xc956('0x7a')][_0xc956('0x7b')]({'isolationLevel':db['sequelize']['Transaction']['ISOLATION_LEVELS'][_0xc956('0x7c')]},function(_0x528ed4){return db[_0xc956('0x3c')][_0xc956('0x68')]({'where':{'id':_0x44958e},'transaction':_0x528ed4})[_0xc956('0x1d')](function(_0x27f3a4){if(_0x27f3a4){return db['FaxApplication'][_0xc956('0x34')]({'where':{'FaxAccountId':_0x44958e},'transaction':_0x528ed4})[_0xc956('0x1d')](function(){var _0x3ebbc8=_[_0xc956('0x42')](_0x1d405d,function(_0x138dd3){_0x138dd3['FaxAccountId']=_0x44958e;return _0x138dd3;});return db['FaxApplication']['bulkCreate'](_0x3ebbc8,{'transaction':_0x528ed4});});}else{_0x361956=0x194;_0x3cd1c9=[];}});})['then'](function(){if(_0x361956!==0x194){return db['FaxApplication'][_0xc956('0x7d')]({'where':{'FaxAccountId':_0x44958e},'order':_0xc956('0x7e')})[_0xc956('0x1d')](function(_0x47f210){_0x3cd1c9=_0x47f210;});}})[_0xc956('0x58')](function(_0x22311f){_0x361956=0x1f4;logger[_0xc956('0x24')](_0x22311f['stack']);if(_0x22311f[_0xc956('0x39')]){delete _0x22311f[_0xc956('0x39')];}_0x3cd1c9=_0x22311f;})['finally'](function(){if(_0x3cd1c9===null){_0x170a5f[_0xc956('0x28')](_0x361956);}else{if(_0x361956===0x1f4){_0x170a5f['status'](_0x361956)['send'](_0x3cd1c9);}else{_0x170a5f[_0xc956('0x2a')](_0x361956)[_0xc956('0x2b')](_0x3cd1c9);}}});};exports[_0xc956('0x7f')]=function(_0x1a9c0b,_0x3f3d2d,_0x550ec8){var _0x241a16={};var _0x2e8792={};var _0x466b5f;var _0x4695ab;return db[_0xc956('0x3c')]['findOne']({'where':{'id':_0x1a9c0b['params']['id']}})[_0xc956('0x1d')](handleEntityNotFound(_0x3f3d2d,null))[_0xc956('0x1d')](function(_0x4ce97a){if(_0x4ce97a){_0x466b5f=_0x4ce97a;_0x2e8792[_0xc956('0x41')]=_['keys'](db['FaxApplication'][_0xc956('0x3d')]);_0x2e8792[_0xc956('0x43')]=_[_0xc956('0x44')](_0x1a9c0b['query']);_0x2e8792[_0xc956('0x45')]=_[_0xc956('0x46')](_0x2e8792[_0xc956('0x41')],_0x2e8792[_0xc956('0x43')]);_0x241a16[_0xc956('0x47')]=_[_0xc956('0x46')](_0x2e8792[_0xc956('0x41')],qs[_0xc956('0x48')](_0x1a9c0b[_0xc956('0x43')]['fields']));_0x241a16[_0xc956('0x47')]=_0x241a16['attributes'][_0xc956('0x49')]?_0x241a16[_0xc956('0x47')]:_0x2e8792[_0xc956('0x41')];_0x241a16[_0xc956('0x4c')]=qs[_0xc956('0x4d')](_0x1a9c0b[_0xc956('0x43')][_0xc956('0x4d')]);_0x241a16[_0xc956('0x4e')]=qs['filters'](_[_0xc956('0x4f')](_0x1a9c0b[_0xc956('0x43')],_0x2e8792[_0xc956('0x45')]));if(_0x1a9c0b['query'][_0xc956('0x50')]){_0x241a16[_0xc956('0x4e')]=_['merge'](_0x241a16[_0xc956('0x4e')],{'$or':_[_0xc956('0x42')](_0x241a16[_0xc956('0x47')],function(_0x2297ed){var _0x1f6d88={};_0x1f6d88[_0x2297ed]={'$like':'%'+_0x1a9c0b[_0xc956('0x43')][_0xc956('0x50')]+'%'};return _0x1f6d88;})});}_0x241a16=_['merge']({},_0x241a16,_0x1a9c0b['options']);return _0x466b5f[_0xc956('0x7f')](_0x241a16);}})['then'](function(_0x20a516){if(_0x20a516){_0x4695ab=_0x20a516['length'];if(!_0x1a9c0b[_0xc956('0x43')][_0xc956('0x4a')](_0xc956('0x4b'))){_0x241a16[_0xc956('0x2e')]=qs[_0xc956('0x2e')](_0x1a9c0b[_0xc956('0x43')][_0xc956('0x2e')]);_0x241a16['offset']=qs[_0xc956('0x2c')](_0x1a9c0b[_0xc956('0x43')]['offset']);}return _0x466b5f[_0xc956('0x7f')](_0x241a16);}})[_0xc956('0x1d')](function(_0x23617e){if(_0x23617e){return _0x23617e?{'count':_0x4695ab,'rows':_0x23617e}:null;}})['then'](respondWithResult(_0x3f3d2d,null))[_0xc956('0x58')](handleError(_0x3f3d2d,null));};function Extension(_0x50d43d,_0x43c20f,_0x3dc542,_0xc4b210){this[_0xc956('0x80')]='from-voip-provider';this[_0xc956('0x81')]=_0x50d43d[_0xc956('0x82')];this[_0xc956('0x83')]=_0xc4b210;this[_0xc956('0x3f')]=_0xc956('0x84');this[_0xc956('0x85')]=_0xc956('0x86');this[_0xc956('0x65')]=_0x50d43d['id'];this['priority']=_0x43c20f;this[_0xc956('0x87')]=_0x3dc542;}function createExtensionsReciveFax(_0x42e5fa){var _0x1fb2a0=0x1;var _0x375e7=[];_0x375e7[_0xc956('0x88')](new Extension(_0x42e5fa,_0x1fb2a0,'',_0xc956('0x89')));_0x1fb2a0+=0x1;_0x375e7[_0xc956('0x88')](new Extension(_0x42e5fa,_0x1fb2a0,_0xc956('0x8a'),_0xc956('0x8b')));_0x1fb2a0+=0x1;for(var _0x18e248 in _0x42e5fa){if(_0x42e5fa[_0xc956('0x4a')](_0x18e248)&&(_0x18e248===_0xc956('0x8c')||_0x18e248===_0xc956('0x82')||_0x18e248===_0xc956('0x8d')||_0x18e248==='faxdetect'||_0x18e248===_0xc956('0x8e')||_0x18e248===_0xc956('0x8f')||_0x18e248===_0xc956('0x90')||_0x18e248==='modem'||_0x18e248===_0xc956('0x91'))){_0x375e7[_0xc956('0x88')](new Extension(_0x42e5fa,_0x1fb2a0,_0xc956('0x92')+_0x18e248+')='+_0x42e5fa[_0x18e248],_0xc956('0x8b')));_0x1fb2a0+=0x1;}}_0x375e7[_0xc956('0x88')](new Extension(_0x42e5fa,_0x1fb2a0,'6',_0xc956('0x93')));_0x1fb2a0+=0x1;_0x375e7['push'](new Extension(_0x42e5fa,_0x1fb2a0,'/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',_0xc956('0x94')));_0x1fb2a0=0x0;return _0x375e7;}exports[_0xc956('0x95')]=function(_0x2c192f,_0x5f1dac,_0x4b4d41){var _0x51a733;return db[_0xc956('0x7a')][_0xc956('0x7b')](function(_0x284aac){return db[_0xc956('0x3c')][_0xc956('0x5b')](_0x2c192f['body'],{'transaction':_0x284aac})['then'](function(_0x1da73f){_0x51a733=_0x1da73f['get']({'plain':!![]});return db[_0xc956('0x96')][_0xc956('0x97')](createExtensionsReciveFax(_0x51a733),{'transaction':_0x284aac});});})[_0xc956('0x1d')](function(){return _0x51a733;})[_0xc956('0x1d')](respondWithResult(_0x5f1dac,null))[_0xc956('0x58')](handleError(_0x5f1dac,null));};exports[_0xc956('0x98')]=function(_0x2976b9,_0x11c175,_0x1f6262){var _0x99de45;return db['sequelize']['transaction'](function(_0x2bd375){return db[_0xc956('0x3c')][_0xc956('0x61')](_0x2976b9[_0xc956('0x5c')],{'where':{'id':_0x2976b9['body']['id']},'transaction':_0x2bd375})['then'](function(_0x4708cc){return db[_0xc956('0x96')][_0xc956('0x34')]({'where':{'FaxAccountId':_0x2976b9[_0xc956('0x5c')]['id']},'transaction':_0x2bd375})[_0xc956('0x1d')](function(_0x3eb04f){return db['VoiceExtension'][_0xc956('0x97')](createExtensionsReciveFax(_['omit'](_0x2976b9[_0xc956('0x5c')],[_0xc956('0x99'),_0xc956('0x40'),_0xc956('0x9a'),_0xc956('0x9b'),_0xc956('0x9c'),'ListId'])),{'transaction':_0x2bd375});});});})['then'](function(){return db[_0xc956('0x3c')][_0xc956('0x9d')](_0x2976b9[_0xc956('0x5c')]['id']);})[_0xc956('0x1d')](respondWithResult(_0x11c175,null))[_0xc956('0x58')](handleError(_0x11c175,null));};exports[_0xc956('0x9e')]=function(_0x649c73,_0x2fbd3c,_0x11f05e){var _0x145684={'raw':!![],'where':{}};var _0x39c397={};var _0x18411a={'count':0x0,'rows':[]};return db[_0xc956('0x3c')][_0xc956('0x68')]({'where':{'id':_0x649c73[_0xc956('0x62')]['id']}})['then'](handleEntityNotFound(_0x2fbd3c,null))[_0xc956('0x1d')](function(_0x13d102){if(_0x13d102){_0x39c397['model']=_[_0xc956('0x44')](db['FaxMessage'][_0xc956('0x3d')]);_0x39c397[_0xc956('0x43')]=_['keys'](_0x649c73[_0xc956('0x43')]);_0x39c397['filters']=_[_0xc956('0x46')](_0x39c397[_0xc956('0x41')],_0x39c397[_0xc956('0x43')]);_0x145684[_0xc956('0x47')]=_[_0xc956('0x46')](_0x39c397['model'],qs[_0xc956('0x48')](_0x649c73[_0xc956('0x43')][_0xc956('0x48')]));_0x145684[_0xc956('0x47')]=_0x145684[_0xc956('0x47')][_0xc956('0x49')]?_0x145684[_0xc956('0x47')]:_0x39c397[_0xc956('0x41')];if(!_0x649c73[_0xc956('0x43')][_0xc956('0x4a')](_0xc956('0x4b'))){_0x145684['limit']=qs[_0xc956('0x2e')](_0x649c73[_0xc956('0x43')]['limit']);_0x145684[_0xc956('0x2c')]=qs['offset'](_0x649c73['query'][_0xc956('0x2c')]);}_0x145684[_0xc956('0x4c')]=qs[_0xc956('0x4d')](_0x649c73['query'][_0xc956('0x4d')]);_0x145684[_0xc956('0x4e')]=qs[_0xc956('0x45')](_[_0xc956('0x4f')](_0x649c73[_0xc956('0x43')],_0x39c397[_0xc956('0x45')]));_0x145684[_0xc956('0x4e')][_0xc956('0x65')]=_0x13d102['id'];if(_0x649c73[_0xc956('0x43')][_0xc956('0x50')]){_0x145684[_0xc956('0x4e')]=_[_0xc956('0x51')](_0x145684['where'],{'$or':_[_0xc956('0x42')](_0x145684[_0xc956('0x47')],function(_0x44b939){var _0x9484e1={};_0x9484e1[_0x44b939]={'$like':'%'+_0x649c73[_0xc956('0x43')][_0xc956('0x50')]+'%'};return _0x9484e1;})});}if(_0x649c73[_0xc956('0x43')]['$gte']){var _0x212d30=_0x649c73[_0xc956('0x43')][_0xc956('0x9f')][_0xc956('0xa0')](',');var _0x583640={};_0x583640[_0x212d30[0x0]]={'$gte':moment(_0x212d30[0x1])[_0xc956('0xa1')](_0xc956('0xa2'))};_0x145684['where']=_['merge'](_0x145684[_0xc956('0x4e')],_0x583640);}_0x145684=_[_0xc956('0x51')]({},_0x145684,_0x649c73['options']);return db['FaxMessage'][_0xc956('0x2f')]({'where':_0x145684[_0xc956('0x4e')]})[_0xc956('0x1d')](function(_0x22db81){_0x18411a[_0xc956('0x2f')]=_0x22db81;if(_0x649c73[_0xc956('0x43')]['includeAll']){_0x145684['include']=[{'all':!![]}];}return db['FaxMessage'][_0xc956('0x56')](_0x145684);})[_0xc956('0x1d')](function(_0x4639b7){_0x18411a[_0xc956('0x57')]=_0x4639b7;return _0x18411a;});}})['then'](respondWithFilteredResult(_0x2fbd3c,_0x145684))[_0xc956('0x58')](handleError(_0x2fbd3c,null));};exports['send']=function(_0x4944ae,_0x3d94a7,_0x155bd6){var _0x3e1550,_0x308713={},_0x37dc5e;if(_0x4944ae[_0xc956('0x5c')]['to']){_0x37dc5e=_0x4944ae[_0xc956('0x5c')]['to'][0x0];}return db[_0xc956('0x3c')][_0xc956('0x5a')]({'where':{'id':_0x4944ae['params']['id']},'include':[{'model':db['CmList'],'as':_0xc956('0xa3'),'include':[{'model':db[_0xc956('0xa4')],'as':_0xc956('0xa5'),'where':{'fax':_0x37dc5e},'limit':0x1,'order':[[_0xc956('0x9b'),_0xc956('0xa6')]]}]}]})[_0xc956('0x1d')](handleEntityNotFound(_0x3d94a7,null))[_0xc956('0x1d')](function(_0x1ade60){_0x3e1550=_0x1ade60;if(_0x4944ae[_0xc956('0x5c')]['attachments']&&_0x4944ae['body'][_0xc956('0xa7')]['length']){for(var _0x2bb27e=0x0;_0x2bb27e<_0x4944ae['body'][_0xc956('0xa7')]['length'];_0x2bb27e+=0x1){_0x4944ae[_0xc956('0x5c')][_0xc956('0xa7')][_0x2bb27e]={'filename':_0x4944ae[_0xc956('0x5c')][_0xc956('0xa7')][_0x2bb27e][_0xc956('0x39')],'id':_0x4944ae[_0xc956('0x5c')]['attachments'][_0x2bb27e]['id'],'path':path[_0xc956('0xa8')](config[_0xc956('0xa9')],_0xc956('0xaa'),_0x4944ae[_0xc956('0x5c')][_0xc956('0xa7')][_0x2bb27e][_0xc956('0xab')])};}}return respondWithRpcPromise('CheckAfterSend','CheckAfterSend',{'FaxAccountId':_[_0xc956('0xac')](_0x4944ae[_0xc956('0x62')]['id'])?undefined:_0x4944ae['params']['id'],'path':_[_0xc956('0xac')](_0x4944ae[_0xc956('0x5c')][_0xc956('0xa7')][0x0][_0xc956('0x6')])?undefined:_0x4944ae[_0xc956('0x5c')][_0xc956('0xa7')][0x0]['path'],'fax':_[_0xc956('0xac')](_0x4944ae[_0xc956('0x5c')]['to'][0x0])?undefined:_0x4944ae[_0xc956('0x5c')]['to'][0x0]},client9002);})['then'](function(){if(_0x3e1550){if(_['isNil'](_0x4944ae['body']['from'])){_0x4944ae[_0xc956('0x5c')]['from']=util[_0xc956('0xa1')](_0xc956('0xad'),_0x3e1550[_0xc956('0x39')],_0x3e1550[_0xc956('0xae')]);}if(_0x3e1550[_0xc956('0xa3')]){if(_0x3e1550['List'][_0xc956('0xa5')][_0xc956('0x49')]){return _0x3e1550[_0xc956('0xa3')][_0xc956('0xa5')][0x0];}else{return db[_0xc956('0xa4')][_0xc956('0x5b')](_['defaults'](_0x4944ae[_0xc956('0x5c')],{'firstName':_0x4944ae[_0xc956('0x5c')]['to'][0x0],'phone':_0x4944ae['body']['to'][0x0],'fax':_0x4944ae[_0xc956('0x5c')]['to'][0x0],'ListId':_0x3e1550[_0xc956('0xaf')]}));}}else{throw new Error('List\x20not\x20found');}}else{throw new Error(_0xc956('0xb0'));}})['then'](function(_0x22a90d){if(_0x22a90d){return db[_0xc956('0x70')][_0xc956('0x5a')]({'where':{'ContactId':_0x22a90d['id'],'closed':![],'FaxAccountId':_0x3e1550['id']}})[_0xc956('0x1d')](function(_0x43e550){if(_0x43e550){return[_0x43e550,![]];}return db[_0xc956('0x70')][_0xc956('0x5b')]({'UserId':_0x4944ae[_0xc956('0xb1')]['id'],'ContactId':_0x22a90d['id'],'FaxAccountId':_0x3e1550['id'],'fax':_0x4944ae['body']['to'][0x0],'firstMsgDirection':_0xc956('0xb2'),'Messages':[_[_0xc956('0x51')](_0x4944ae[_0xc956('0x5c')],{'read':![],'body':_0x4944ae['body'][_0xc956('0xa7')][0x0][_0xc956('0xb3')],'FaxAccountId':_0x3e1550['id'],'UserId':_0x4944ae[_0xc956('0xb1')]['id'],'ContactId':_0x22a90d['id'],'AttachmentId':_0x4944ae[_0xc956('0x5c')][_0xc956('0xa7')][0x0]['id']})]},{'include':[{'model':db[_0xc956('0xb4')],'as':'Messages'}]})[_0xc956('0x1d')](function(_0x5d69e1){return[_0x5d69e1,!![]];});});}else{throw new Error(_0xc956('0xb5'));}})[_0xc956('0xb6')](function(_0x2fadcc,_0x2806b2){if(_0x2806b2){return _0x2fadcc;}return db[_0xc956('0xb4')]['create']({'direction':'out','read':![],'body':_0x4944ae['body']['attachments'][0x0]['filename'],'FaxAccountId':_0x3e1550['id'],'FaxInteractionId':_0x2fadcc['id'],'UserId':_0x4944ae[_0xc956('0xb1')]['id'],'ContactId':_0x2fadcc[_0xc956('0xb7')],'AttachmentId':_0x4944ae[_0xc956('0x5c')][_0xc956('0xa7')][0x0]['id']})[_0xc956('0x1d')](function(_0x2f8fbe){_0x2fadcc['dataValues'][_0xc956('0xb8')]=[];_0x2fadcc[_0xc956('0xb9')][_0xc956('0xb8')][_0xc956('0x88')](_0x2f8fbe[_0xc956('0xb9')]);return _0x2fadcc;});})[_0xc956('0x1d')](function(_0x5140dd){respondWithRpcPromise(_0xc956('0xba'),_0xc956('0xba'),{'FaxAccountId':_['isNil'](_0x4944ae[_0xc956('0x62')]['id'])?undefined:_0x4944ae[_0xc956('0x62')]['id'],'path':_[_0xc956('0xac')](_0x4944ae[_0xc956('0x5c')][_0xc956('0xa7')][0x0][_0xc956('0x6')])?undefined:_0x4944ae[_0xc956('0x5c')][_0xc956('0xa7')][0x0]['path'],'fax':_[_0xc956('0xac')](_0x4944ae['body']['to'][0x0])?undefined:_0x4944ae[_0xc956('0x5c')]['to'][0x0],'AttachmentId':_0x4944ae[_0xc956('0x5c')][_0xc956('0xa7')][0x0]['id']},client9002)['then'](function(_0xd3e367){logger[_0xc956('0x1e')](_0xc956('0xbb'),_0xd3e367);})['catch'](function(_0x17350c){logger[_0xc956('0x1e')](_0xc956('0xbb'),_0x17350c);});return _0x5140dd;})[_0xc956('0x1d')](respondWithResult(_0x3d94a7,null))[_0xc956('0x58')](handleError(_0x3d94a7,null));};exports[_0xc956('0xbc')]=function(_0x4f82e0,_0xe45814,_0x37ea19){return db[_0xc956('0x3c')][_0xc956('0x5a')]({'where':{'id':_0x4f82e0['params']['id']}})[_0xc956('0x1d')](handleEntityNotFound(_0xe45814,null))[_0xc956('0x1d')](function(_0x492733){if(_0x492733){return _0x492733[_0xc956('0xbc')](_0x4f82e0[_0xc956('0x5c')]['ids'],_[_0xc956('0x6e')](_0x4f82e0['body'],['ids','id'])||{})[_0xc956('0xb6')](function(_0x100078){for(var _0x4fcb4f=0x0;_0x4fcb4f<_0x4f82e0[_0xc956('0x5c')][_0xc956('0x69')]['length'];_0x4fcb4f+=0x1){socket[_0xc956('0xbd')](_0xc956('0xbe'),{'UserId':Number(_0x4f82e0[_0xc956('0x5c')][_0xc956('0x69')][_0x4fcb4f]),'FaxAccountId':Number(_0x4f82e0[_0xc956('0x62')]['id'])});}return _0x100078;});}})['then'](respondWithResult(_0xe45814,null))[_0xc956('0x58')](handleError(_0xe45814,null));};exports[_0xc956('0xbf')]=function(_0x2b9c75,_0x500af9,_0x2a482c){return db['FaxAccount']['find']({'where':{'id':_0x2b9c75[_0xc956('0x62')]['id']}})[_0xc956('0x1d')](handleEntityNotFound(_0x500af9,null))[_0xc956('0x1d')](function(_0x35a53b){if(_0x35a53b){return _0x35a53b['removeAgents'](_0x2b9c75['query'][_0xc956('0x69')])[_0xc956('0x1d')](function(){if(_[_0xc956('0xc0')](_0x2b9c75[_0xc956('0x43')][_0xc956('0x69')])){for(var _0x56ef86=0x0;_0x56ef86<_0x2b9c75[_0xc956('0x43')][_0xc956('0x69')]['length'];_0x56ef86+=0x1){socket[_0xc956('0xbd')]('userFaxAccount:remove',{'UserId':Number(_0x2b9c75['query']['ids'][_0x56ef86]),'FaxAccountId':Number(_0x2b9c75[_0xc956('0x62')]['id'])});}}else{socket[_0xc956('0xbd')]('userFaxAccount:remove',{'UserId':Number(_0x2b9c75[_0xc956('0x43')]['ids']),'FaxAccountId':Number(_0x2b9c75['params']['id'])});}});}})[_0xc956('0x1d')](respondWithStatusCode(_0x500af9,null))[_0xc956('0x58')](handleError(_0x500af9,null));};exports[_0xc956('0xc1')]=function(_0x301be2,_0xd74fe4,_0x10058b){var _0x57e4c8={};var _0x4d421e={};var _0x20c2dc;var _0x33f800;return db[_0xc956('0x3c')]['findOne']({'where':{'id':_0x301be2[_0xc956('0x62')]['id']}})[_0xc956('0x1d')](handleEntityNotFound(_0xd74fe4,null))[_0xc956('0x1d')](function(_0x5e1de5){if(_0x5e1de5){_0x20c2dc=_0x5e1de5;_0x4d421e['model']=_[_0xc956('0x44')](db['User'][_0xc956('0x3d')]);_0x4d421e[_0xc956('0x43')]=_['keys'](_0x301be2[_0xc956('0x43')]);_0x4d421e[_0xc956('0x45')]=_[_0xc956('0x46')](_0x4d421e[_0xc956('0x41')],_0x4d421e[_0xc956('0x43')]);_0x57e4c8[_0xc956('0x47')]=_[_0xc956('0x46')](_0x4d421e['model'],qs[_0xc956('0x48')](_0x301be2[_0xc956('0x43')]['fields']));_0x57e4c8[_0xc956('0x47')]=_0x57e4c8[_0xc956('0x47')]['length']?_0x57e4c8[_0xc956('0x47')]:_0x4d421e[_0xc956('0x41')];_0x57e4c8[_0xc956('0x4c')]=qs['sort'](_0x301be2[_0xc956('0x43')][_0xc956('0x4d')]);_0x57e4c8['where']=qs[_0xc956('0x45')](_['pick'](_0x301be2[_0xc956('0x43')],_0x4d421e[_0xc956('0x45')]));if(_0x301be2[_0xc956('0x43')]['filter']){_0x57e4c8['where']=_[_0xc956('0x51')](_0x57e4c8[_0xc956('0x4e')],{'$or':_[_0xc956('0x42')](_0x57e4c8[_0xc956('0x47')],function(_0x781e1a){var _0x230351={};_0x230351[_0x781e1a]={'$like':'%'+_0x301be2['query'][_0xc956('0x50')]+'%'};return _0x230351;})});}_0x57e4c8=_[_0xc956('0x51')]({},_0x57e4c8,_0x301be2[_0xc956('0x53')]);return _0x20c2dc[_0xc956('0xc1')](_0x57e4c8);}})[_0xc956('0x1d')](function(_0x5a4cdd){if(_0x5a4cdd){_0x33f800=_0x5a4cdd[_0xc956('0x49')];if(!_0x301be2[_0xc956('0x43')]['hasOwnProperty'](_0xc956('0x4b'))){_0x57e4c8['limit']=qs[_0xc956('0x2e')](_0x301be2[_0xc956('0x43')][_0xc956('0x2e')]);_0x57e4c8['offset']=qs[_0xc956('0x2c')](_0x301be2[_0xc956('0x43')][_0xc956('0x2c')]);}return _0x20c2dc[_0xc956('0xc1')](_0x57e4c8);}})[_0xc956('0x1d')](function(_0x2706f6){if(_0x2706f6){return _0x2706f6?{'count':_0x33f800,'rows':_0x2706f6}:null;}})[_0xc956('0x1d')](respondWithResult(_0xd74fe4,null))[_0xc956('0x58')](handleError(_0xd74fe4,null));}; \ No newline at end of file +var _0xc6f2=['dataValues','Messages','SendFax','SendFaxRpc,\x20%s','addAgents','emit','removeAgents','userFaxAccount:remove','getAgents','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./faxAccount.socket','register','jayson/promise','client','http','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','offset','undefined','limit','count','json','apply','reject','save','update','destroy','get','FaxAccounts','UserProfileResource','end','name','send','index','mandatoryDispositionPause','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','FaxAccount','includeAll','findAll','params','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Pause','describe','addDisposition','FaxAccountId','Disposition','getDispositions','findOne','length','rows','ids','CannedAnswer','removeAnswers','addInteraction','FaxInteraction','getInteractions','Contact','User','fullname','internal','Tag','Tags','color','tag','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','FaxApplication','bulkCreate','findAndCountAll','priority','stack','finally','getApplications','exten','localstationid','system','Fax\x20Extension','appdata','push','CDR(type)=inbound-fax','Set','gateway','faxdetect','headerinfo','maxrate','minrate','modem','FAXOPT(','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','addAccountApplications','VoiceExtension','updateAccountApplications','omit','tech','key','createdAt','updatedAt','findById','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','FaxMessage','CmList','List','CmContact','Contacts','attachments','join','CheckAfterSend','isNil','from','fax','ListId','out','filename','Contact\x20not\x20found','spread','ContactId'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xc6f2,0x18f));var _0x2c6f=function(_0x254eb9,_0x5aba40){_0x254eb9=_0x254eb9-0x0;var _0xf020cf=_0xc6f2[_0x254eb9];return _0xf020cf;};'use strict';var emlformat=require(_0x2c6f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2c6f('0x1'));var jsonpatch=require(_0x2c6f('0x2'));var rp=require('request-promise');var moment=require(_0x2c6f('0x3'));var BPromise=require(_0x2c6f('0x4'));var Mustache=require(_0x2c6f('0x5'));var util=require(_0x2c6f('0x6'));var path=require(_0x2c6f('0x7'));var sox=require(_0x2c6f('0x8'));var csv=require(_0x2c6f('0x9'));var ejs=require(_0x2c6f('0xa'));var fs=require('fs');var fs_extra=require(_0x2c6f('0xb'));var _=require(_0x2c6f('0xc'));var squel=require(_0x2c6f('0xd'));var crypto=require(_0x2c6f('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x2c6f('0xf'));var toCsv=require(_0x2c6f('0x9'));var querystring=require('querystring');var Papa=require(_0x2c6f('0x10'));var Redis=require(_0x2c6f('0x11'));var authService=require(_0x2c6f('0x12'));var qs=require(_0x2c6f('0x13'));var as=require(_0x2c6f('0x14'));var hardwareService=require(_0x2c6f('0x15'));var logger=require(_0x2c6f('0x16'))(_0x2c6f('0x17'));var utils=require(_0x2c6f('0x18'));var config=require(_0x2c6f('0x19'));var licenseUtil=require(_0x2c6f('0x1a'));var db=require(_0x2c6f('0x1b'))['db'];config[_0x2c6f('0x1c')]=_[_0x2c6f('0x1d')](config['redis'],{'host':_0x2c6f('0x1e'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x2c6f('0x1f'))[_0x2c6f('0x20')](socket);var jayson=require(_0x2c6f('0x21'));var client=jayson[_0x2c6f('0x22')]['http']({'port':0x232c});var client9002=jayson[_0x2c6f('0x22')][_0x2c6f('0x23')]({'port':0x232a});function respondWithRpcPromise(_0x4a81c1,_0x9d99d0,_0x48f254,_0x379f7a){return new BPromise(function(_0x578121,_0x5074ac){var _0x2fbe7c=_0x379f7a||client;return _0x2fbe7c[_0x2c6f('0x24')](_0x4a81c1,_0x48f254)[_0x2c6f('0x25')](function(_0x403f15){logger[_0x2c6f('0x26')](_0x2c6f('0x27'),_0x9d99d0,_0x2c6f('0x28'));logger[_0x2c6f('0x29')](_0x2c6f('0x2a'),_0x9d99d0,_0x2c6f('0x28'),JSON[_0x2c6f('0x2b')](_0x403f15));if(_0x403f15[_0x2c6f('0x2c')]){if(_0x403f15[_0x2c6f('0x2c')]['code']===0x1f4){logger[_0x2c6f('0x2c')](_0x2c6f('0x27'),_0x9d99d0,_0x403f15[_0x2c6f('0x2c')][_0x2c6f('0x2d')]);return _0x5074ac(_0x403f15[_0x2c6f('0x2c')]['message']);}logger[_0x2c6f('0x2c')](_0x2c6f('0x27'),_0x9d99d0,_0x403f15[_0x2c6f('0x2c')]['message']);return _0x578121(_0x403f15[_0x2c6f('0x2c')]['message']);}else{logger[_0x2c6f('0x26')](_0x2c6f('0x27'),_0x9d99d0,'request\x20sent');_0x578121(_0x403f15[_0x2c6f('0x2e')][_0x2c6f('0x2d')]);}})[_0x2c6f('0x2f')](function(_0x391851){logger[_0x2c6f('0x2c')](_0x2c6f('0x27'),_0x9d99d0,_0x391851);_0x5074ac(_0x391851);});});}function respondWithStatusCode(_0x58c995,_0x1e4ccb){_0x1e4ccb=_0x1e4ccb||0xcc;return function(_0x3d02e4){if(_0x3d02e4){return _0x58c995[_0x2c6f('0x30')](_0x1e4ccb);}return _0x58c995[_0x2c6f('0x31')](_0x1e4ccb)['end']();};}function respondWithResult(_0xfc3673,_0x52f92d){_0x52f92d=_0x52f92d||0xc8;return function(_0x3788f6){if(_0x3788f6){return _0xfc3673[_0x2c6f('0x31')](_0x52f92d)['json'](_0x3788f6);}};}function respondWithFilteredResult(_0x26ab3d,_0xf6aced){return function(_0x1b6bef){if(_0x1b6bef){var _0x135920=typeof _0xf6aced[_0x2c6f('0x32')]===_0x2c6f('0x33')&&typeof _0xf6aced[_0x2c6f('0x34')]==='undefined';var _0xe2c13c=_0x1b6bef[_0x2c6f('0x35')];var _0xd4dda3=_0x135920?0x0:_0xf6aced['offset'];var _0x443ad4=_0x135920?_0x1b6bef[_0x2c6f('0x35')]:_0xf6aced[_0x2c6f('0x32')]+_0xf6aced[_0x2c6f('0x34')];var _0x577aa0;if(_0x443ad4>=_0xe2c13c){_0x443ad4=_0xe2c13c;_0x577aa0=0xc8;}else{_0x577aa0=0xce;}_0x26ab3d[_0x2c6f('0x31')](_0x577aa0);return _0x26ab3d['set']('Content-Range',_0xd4dda3+'-'+_0x443ad4+'/'+_0xe2c13c)[_0x2c6f('0x36')](_0x1b6bef);}return null;};}function patchUpdates(_0x4cc0ee){return function(_0x536826){try{jsonpatch[_0x2c6f('0x37')](_0x536826,_0x4cc0ee,!![]);}catch(_0x2ec1d8){return BPromise[_0x2c6f('0x38')](_0x2ec1d8);}return _0x536826[_0x2c6f('0x39')]();};}function saveUpdates(_0x43048f,_0x2c1e8a){return function(_0x44964a){if(_0x44964a){return _0x44964a[_0x2c6f('0x3a')](_0x43048f)[_0x2c6f('0x25')](function(_0x189327){return _0x189327;});}return null;};}function removeEntity(_0x1080f5,_0x55e37e){return function(_0x26fdb9){if(_0x26fdb9){return _0x26fdb9[_0x2c6f('0x3b')]()[_0x2c6f('0x25')](function(){var _0x7c8028=_0x26fdb9[_0x2c6f('0x3c')]({'plain':!![]});var _0x1f056f=_0x2c6f('0x3d');return db[_0x2c6f('0x3e')][_0x2c6f('0x3b')]({'where':{'type':_0x1f056f,'resourceId':_0x7c8028['id']}})['then'](function(){return _0x26fdb9;});})[_0x2c6f('0x25')](function(){_0x1080f5[_0x2c6f('0x31')](0xcc)[_0x2c6f('0x3f')]();});}};}function handleEntityNotFound(_0x5bcd56,_0x44d5ff){return function(_0x143fe0){if(!_0x143fe0){_0x5bcd56[_0x2c6f('0x30')](0x194);}return _0x143fe0;};}function handleError(_0x57ee60,_0x162a40){_0x162a40=_0x162a40||0x1f4;return function(_0xa52a81){logger[_0x2c6f('0x2c')](_0xa52a81['stack']);if(_0xa52a81[_0x2c6f('0x40')]){delete _0xa52a81[_0x2c6f('0x40')];}_0x57ee60[_0x2c6f('0x31')](_0x162a40)[_0x2c6f('0x41')](_0xa52a81);};}exports[_0x2c6f('0x42')]=function(_0x1b2b4f,_0x466ef2){var _0x52c419={'include':[{'model':db['Pause'],'as':_0x2c6f('0x43')}]},_0x449915={},_0x57073f={'count':0x0,'rows':[]};var _0x6dc373=_[_0x2c6f('0x44')](db['FaxAccount'][_0x2c6f('0x45')],function(_0x21c12f){return{'name':_0x21c12f[_0x2c6f('0x46')],'type':_0x21c12f[_0x2c6f('0x47')]['key']};});_0x449915[_0x2c6f('0x48')]=_[_0x2c6f('0x44')](_0x6dc373,_0x2c6f('0x40'));_0x449915[_0x2c6f('0x49')]=_[_0x2c6f('0x4a')](_0x1b2b4f[_0x2c6f('0x49')]);_0x449915[_0x2c6f('0x4b')]=_[_0x2c6f('0x4c')](_0x449915[_0x2c6f('0x48')],_0x449915[_0x2c6f('0x49')]);_0x52c419['attributes']=_[_0x2c6f('0x4c')](_0x449915[_0x2c6f('0x48')],qs[_0x2c6f('0x4d')](_0x1b2b4f[_0x2c6f('0x49')][_0x2c6f('0x4d')]));_0x52c419[_0x2c6f('0x4e')]=_0x52c419[_0x2c6f('0x4e')]['length']?_0x52c419[_0x2c6f('0x4e')]:_0x449915['model'];if(!_0x1b2b4f[_0x2c6f('0x49')][_0x2c6f('0x4f')](_0x2c6f('0x50'))){_0x52c419['limit']=qs[_0x2c6f('0x34')](_0x1b2b4f[_0x2c6f('0x49')][_0x2c6f('0x34')]);_0x52c419[_0x2c6f('0x32')]=qs[_0x2c6f('0x32')](_0x1b2b4f[_0x2c6f('0x49')][_0x2c6f('0x32')]);}_0x52c419[_0x2c6f('0x51')]=qs[_0x2c6f('0x52')](_0x1b2b4f['query']['sort']);_0x52c419['where']=qs['filters'](_[_0x2c6f('0x53')](_0x1b2b4f[_0x2c6f('0x49')],_0x449915[_0x2c6f('0x4b')]),_0x6dc373);if(_0x1b2b4f['query'][_0x2c6f('0x54')]){_0x52c419[_0x2c6f('0x55')]=_['merge'](_0x52c419[_0x2c6f('0x55')],{'$or':_[_0x2c6f('0x44')](_0x6dc373,function(_0x3bc08a){if(_0x3bc08a[_0x2c6f('0x47')]!=='VIRTUAL'){var _0x1a5000={};_0x1a5000[_0x3bc08a[_0x2c6f('0x40')]]={'$like':'%'+_0x1b2b4f[_0x2c6f('0x49')][_0x2c6f('0x54')]+'%'};return _0x1a5000;}})});}_0x52c419=_[_0x2c6f('0x56')]({},_0x52c419,_0x1b2b4f[_0x2c6f('0x57')]);var _0x325d6f={'where':_0x52c419[_0x2c6f('0x55')]};return db[_0x2c6f('0x58')]['count'](_0x325d6f)[_0x2c6f('0x25')](function(_0xab5e7){_0x57073f[_0x2c6f('0x35')]=_0xab5e7;if(_0x1b2b4f[_0x2c6f('0x49')][_0x2c6f('0x59')]){_0x52c419['include']=[{'all':!![]}];}return db[_0x2c6f('0x58')][_0x2c6f('0x5a')](_0x52c419);})[_0x2c6f('0x25')](function(_0x29717e){_0x57073f['rows']=_0x29717e;return _0x57073f;})['then'](respondWithFilteredResult(_0x466ef2,_0x52c419))['catch'](handleError(_0x466ef2,null));};exports['show']=function(_0x3784c3,_0x4479c4){var _0x2ba8b0={'raw':![],'where':{'id':_0x3784c3[_0x2c6f('0x5b')]['id']},'include':[{'model':db['Pause'],'as':_0x2c6f('0x43')}]},_0x4b2d9d={};_0x4b2d9d[_0x2c6f('0x48')]=_['keys'](db[_0x2c6f('0x58')][_0x2c6f('0x45')]);_0x4b2d9d[_0x2c6f('0x49')]=_['keys'](_0x3784c3[_0x2c6f('0x49')]);_0x4b2d9d['filters']=_[_0x2c6f('0x4c')](_0x4b2d9d[_0x2c6f('0x48')],_0x4b2d9d[_0x2c6f('0x49')]);_0x2ba8b0['attributes']=_[_0x2c6f('0x4c')](_0x4b2d9d[_0x2c6f('0x48')],qs[_0x2c6f('0x4d')](_0x3784c3[_0x2c6f('0x49')][_0x2c6f('0x4d')]));_0x2ba8b0['attributes']=_0x2ba8b0['attributes']['length']?_0x2ba8b0[_0x2c6f('0x4e')]:_0x4b2d9d['model'];if(_0x3784c3[_0x2c6f('0x49')][_0x2c6f('0x59')]){_0x2ba8b0[_0x2c6f('0x5c')]=[{'all':!![]}];}_0x2ba8b0=_['merge']({},_0x2ba8b0,_0x3784c3[_0x2c6f('0x57')]);return db[_0x2c6f('0x58')][_0x2c6f('0x5d')](_0x2ba8b0)[_0x2c6f('0x25')](handleEntityNotFound(_0x4479c4,null))[_0x2c6f('0x25')](respondWithResult(_0x4479c4,null))['catch'](handleError(_0x4479c4,null));};exports[_0x2c6f('0x5e')]=function(_0x557a3b,_0x4dc983){return db[_0x2c6f('0x58')]['create'](_0x557a3b[_0x2c6f('0x5f')],{})[_0x2c6f('0x25')](function(_0x35011d){var _0x3faaee=_0x557a3b[_0x2c6f('0x60')][_0x2c6f('0x3c')]({'plain':!![]});if(!_0x3faaee)throw new Error(_0x2c6f('0x61'));if(_0x3faaee[_0x2c6f('0x62')]===_0x2c6f('0x60')){var _0x19d8cb=_0x35011d['get']({'plain':!![]});var _0x2def86=_0x2c6f('0x3d');return db[_0x2c6f('0x63')][_0x2c6f('0x5d')]({'where':{'name':_0x2def86,'userProfileId':_0x3faaee[_0x2c6f('0x64')]},'raw':!![]})[_0x2c6f('0x25')](function(_0x508166){if(_0x508166&&_0x508166['autoAssociation']===0x0){return db[_0x2c6f('0x3e')][_0x2c6f('0x5e')]({'name':_0x19d8cb['name'],'resourceId':_0x19d8cb['id'],'type':_0x508166['name'],'sectionId':_0x508166['id']},{})[_0x2c6f('0x25')](function(){return _0x35011d;});}else{return _0x35011d;}})[_0x2c6f('0x2f')](function(_0x3fab03){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3fab03);throw _0x3fab03;});}return _0x35011d;})[_0x2c6f('0x25')](respondWithResult(_0x4dc983,0xc9))[_0x2c6f('0x2f')](handleError(_0x4dc983,null));};exports[_0x2c6f('0x3a')]=function(_0xcc9a94,_0x3dc82f){if(_0xcc9a94[_0x2c6f('0x5f')]['id']){delete _0xcc9a94['body']['id'];}return db['FaxAccount'][_0x2c6f('0x5d')]({'where':{'id':_0xcc9a94[_0x2c6f('0x5b')]['id']},'include':[{'model':db[_0x2c6f('0x65')],'as':'mandatoryDispositionPause'}]})[_0x2c6f('0x25')](handleEntityNotFound(_0x3dc82f,null))['then'](saveUpdates(_0xcc9a94['body'],null))[_0x2c6f('0x25')](respondWithResult(_0x3dc82f,null))['catch'](handleError(_0x3dc82f,null));};exports[_0x2c6f('0x3b')]=function(_0x75f070,_0x4e247a){return db[_0x2c6f('0x58')][_0x2c6f('0x5d')]({'where':{'id':_0x75f070[_0x2c6f('0x5b')]['id']}})[_0x2c6f('0x25')](handleEntityNotFound(_0x4e247a,null))[_0x2c6f('0x25')](removeEntity(_0x4e247a,null))[_0x2c6f('0x2f')](handleError(_0x4e247a,null));};exports[_0x2c6f('0x66')]=function(_0x910fcd,_0x211cb4){return db[_0x2c6f('0x58')]['describe']()[_0x2c6f('0x25')](respondWithResult(_0x211cb4,null))[_0x2c6f('0x2f')](handleError(_0x211cb4,null));};exports[_0x2c6f('0x67')]=function(_0x842966,_0x35b465,_0x3ad970){if(_0x842966['body']['id']){delete _0x842966[_0x2c6f('0x5f')]['id'];}return db[_0x2c6f('0x58')][_0x2c6f('0x5d')]({'where':{'id':_0x842966[_0x2c6f('0x5b')]['id']}})[_0x2c6f('0x25')](handleEntityNotFound(_0x35b465,null))[_0x2c6f('0x25')](function(_0x2e5b51){if(_0x2e5b51){_0x842966['body'][_0x2c6f('0x68')]=_0x2e5b51['id'];return db[_0x2c6f('0x69')][_0x2c6f('0x5e')](_0x842966[_0x2c6f('0x5f')]);}})[_0x2c6f('0x25')](respondWithResult(_0x35b465,null))[_0x2c6f('0x2f')](handleError(_0x35b465,null));};exports[_0x2c6f('0x6a')]=function(_0xda9dab,_0x564c6b,_0x1f7f87){var _0x590135={'raw':![],'where':{}};var _0x5c8c17={};var _0xaf0674={'count':0x0,'rows':[]};return db['FaxAccount'][_0x2c6f('0x6b')]({'where':{'id':_0xda9dab[_0x2c6f('0x5b')]['id']}})[_0x2c6f('0x25')](handleEntityNotFound(_0x564c6b,null))[_0x2c6f('0x25')](function(_0x1ce7e9){if(_0x1ce7e9){_0x5c8c17[_0x2c6f('0x48')]=_[_0x2c6f('0x4a')](db[_0x2c6f('0x69')][_0x2c6f('0x45')]);_0x5c8c17['query']=_['keys'](_0xda9dab[_0x2c6f('0x49')]);_0x5c8c17['filters']=_[_0x2c6f('0x4c')](_0x5c8c17[_0x2c6f('0x48')],_0x5c8c17['query']);_0x590135[_0x2c6f('0x4e')]=_[_0x2c6f('0x4c')](_0x5c8c17[_0x2c6f('0x48')],qs[_0x2c6f('0x4d')](_0xda9dab['query'][_0x2c6f('0x4d')]));_0x590135[_0x2c6f('0x4e')]=_0x590135[_0x2c6f('0x4e')][_0x2c6f('0x6c')]?_0x590135[_0x2c6f('0x4e')]:_0x5c8c17['model'];if(!_0xda9dab[_0x2c6f('0x49')][_0x2c6f('0x4f')](_0x2c6f('0x50'))){_0x590135[_0x2c6f('0x34')]=qs['limit'](_0xda9dab[_0x2c6f('0x49')][_0x2c6f('0x34')]);_0x590135[_0x2c6f('0x32')]=qs[_0x2c6f('0x32')](_0xda9dab[_0x2c6f('0x49')]['offset']);}_0x590135[_0x2c6f('0x51')]=qs[_0x2c6f('0x52')](_0xda9dab['query'][_0x2c6f('0x52')]);_0x590135['where']=qs[_0x2c6f('0x4b')](_[_0x2c6f('0x53')](_0xda9dab['query'],_0x5c8c17['filters']));_0x590135[_0x2c6f('0x55')][_0x2c6f('0x68')]=_0x1ce7e9['id'];if(_0xda9dab[_0x2c6f('0x49')][_0x2c6f('0x54')]){_0x590135[_0x2c6f('0x55')]=_['merge'](_0x590135[_0x2c6f('0x55')],{'$or':_[_0x2c6f('0x44')](_0x590135['attributes'],function(_0x109bee){var _0x161bd8={};_0x161bd8[_0x109bee]={'$like':'%'+_0xda9dab[_0x2c6f('0x49')][_0x2c6f('0x54')]+'%'};return _0x161bd8;})});}_0x590135=_[_0x2c6f('0x56')]({},_0x590135,_0xda9dab[_0x2c6f('0x57')]);return db[_0x2c6f('0x69')][_0x2c6f('0x35')]({'where':_0x590135[_0x2c6f('0x55')]})[_0x2c6f('0x25')](function(_0x3c65bb){_0xaf0674[_0x2c6f('0x35')]=_0x3c65bb;if(_0xda9dab[_0x2c6f('0x49')][_0x2c6f('0x59')]){_0x590135[_0x2c6f('0x5c')]=[{'all':!![]}];}return db[_0x2c6f('0x69')][_0x2c6f('0x5a')](_0x590135);})['then'](function(_0x2a406d){_0xaf0674[_0x2c6f('0x6d')]=_0x2a406d;return _0xaf0674;});}})[_0x2c6f('0x25')](respondWithFilteredResult(_0x564c6b,_0x590135))[_0x2c6f('0x2f')](handleError(_0x564c6b,null));};exports['removeDispositions']=function(_0x2f6ccc,_0x454834,_0x2070b3){return db[_0x2c6f('0x58')][_0x2c6f('0x5d')]({'where':{'id':_0x2f6ccc[_0x2c6f('0x5b')]['id']}})[_0x2c6f('0x25')](handleEntityNotFound(_0x454834,null))[_0x2c6f('0x25')](function(_0x225fbf){if(_0x225fbf){return _0x225fbf['removeDispositions'](_0x2f6ccc[_0x2c6f('0x49')][_0x2c6f('0x6e')]);}})[_0x2c6f('0x25')](respondWithStatusCode(_0x454834,null))[_0x2c6f('0x2f')](handleError(_0x454834,null));};exports['addAnswer']=function(_0xd0164b,_0x1d4fdb,_0x5ba00a){if(_0xd0164b[_0x2c6f('0x5f')]['id']){delete _0xd0164b[_0x2c6f('0x5f')]['id'];}return db['FaxAccount'][_0x2c6f('0x5d')]({'where':{'id':_0xd0164b[_0x2c6f('0x5b')]['id']}})[_0x2c6f('0x25')](handleEntityNotFound(_0x1d4fdb,null))[_0x2c6f('0x25')](function(_0x1225dd){if(_0x1225dd){_0xd0164b['body'][_0x2c6f('0x68')]=_0x1225dd['id'];return db['CannedAnswer'][_0x2c6f('0x5e')](_0xd0164b[_0x2c6f('0x5f')]);}})[_0x2c6f('0x25')](respondWithResult(_0x1d4fdb,null))['catch'](handleError(_0x1d4fdb,null));};exports['getAnswers']=function(_0x42256c,_0x8352b8,_0x10b5bb){var _0x614fbf={'raw':![],'where':{}};var _0x10c52f={};var _0x26f9e9={'count':0x0,'rows':[]};return db['FaxAccount']['findOne']({'where':{'id':_0x42256c[_0x2c6f('0x5b')]['id']}})[_0x2c6f('0x25')](handleEntityNotFound(_0x8352b8,null))[_0x2c6f('0x25')](function(_0x532fc7){if(_0x532fc7){_0x10c52f[_0x2c6f('0x48')]=_['keys'](db[_0x2c6f('0x6f')][_0x2c6f('0x45')]);_0x10c52f['query']=_[_0x2c6f('0x4a')](_0x42256c[_0x2c6f('0x49')]);_0x10c52f[_0x2c6f('0x4b')]=_[_0x2c6f('0x4c')](_0x10c52f['model'],_0x10c52f['query']);_0x614fbf[_0x2c6f('0x4e')]=_[_0x2c6f('0x4c')](_0x10c52f[_0x2c6f('0x48')],qs[_0x2c6f('0x4d')](_0x42256c[_0x2c6f('0x49')]['fields']));_0x614fbf[_0x2c6f('0x4e')]=_0x614fbf['attributes'][_0x2c6f('0x6c')]?_0x614fbf[_0x2c6f('0x4e')]:_0x10c52f[_0x2c6f('0x48')];if(!_0x42256c[_0x2c6f('0x49')][_0x2c6f('0x4f')](_0x2c6f('0x50'))){_0x614fbf[_0x2c6f('0x34')]=qs[_0x2c6f('0x34')](_0x42256c[_0x2c6f('0x49')][_0x2c6f('0x34')]);_0x614fbf['offset']=qs[_0x2c6f('0x32')](_0x42256c[_0x2c6f('0x49')]['offset']);}_0x614fbf['order']=qs[_0x2c6f('0x52')](_0x42256c['query'][_0x2c6f('0x52')]);_0x614fbf['where']=qs[_0x2c6f('0x4b')](_[_0x2c6f('0x53')](_0x42256c[_0x2c6f('0x49')],_0x10c52f[_0x2c6f('0x4b')]));_0x614fbf[_0x2c6f('0x55')][_0x2c6f('0x68')]=_0x532fc7['id'];if(_0x42256c[_0x2c6f('0x49')]['filter']){_0x614fbf[_0x2c6f('0x55')]=_[_0x2c6f('0x56')](_0x614fbf['where'],{'$or':_[_0x2c6f('0x44')](_0x614fbf[_0x2c6f('0x4e')],function(_0x108552){var _0x4f7c0a={};_0x4f7c0a[_0x108552]={'$like':'%'+_0x42256c['query'][_0x2c6f('0x54')]+'%'};return _0x4f7c0a;})});}_0x614fbf=_[_0x2c6f('0x56')]({},_0x614fbf,_0x42256c[_0x2c6f('0x57')]);return db[_0x2c6f('0x6f')][_0x2c6f('0x35')]({'where':_0x614fbf[_0x2c6f('0x55')]})[_0x2c6f('0x25')](function(_0x5df0a8){_0x26f9e9[_0x2c6f('0x35')]=_0x5df0a8;if(_0x42256c['query']['includeAll']){_0x614fbf[_0x2c6f('0x5c')]=[{'all':!![]}];}return db[_0x2c6f('0x6f')][_0x2c6f('0x5a')](_0x614fbf);})[_0x2c6f('0x25')](function(_0x43a1dd){_0x26f9e9[_0x2c6f('0x6d')]=_0x43a1dd;return _0x26f9e9;});}})[_0x2c6f('0x25')](respondWithFilteredResult(_0x8352b8,_0x614fbf))[_0x2c6f('0x2f')](handleError(_0x8352b8,null));};exports[_0x2c6f('0x70')]=function(_0x2aaa9d,_0x419b40,_0x3ea339){return db[_0x2c6f('0x58')][_0x2c6f('0x5d')]({'where':{'id':_0x2aaa9d[_0x2c6f('0x5b')]['id']}})[_0x2c6f('0x25')](handleEntityNotFound(_0x419b40,null))[_0x2c6f('0x25')](function(_0x35fe3c){if(_0x35fe3c){return _0x35fe3c[_0x2c6f('0x70')](_0x2aaa9d[_0x2c6f('0x49')][_0x2c6f('0x6e')]);}})['then'](respondWithStatusCode(_0x419b40,null))['catch'](handleError(_0x419b40,null));};exports[_0x2c6f('0x71')]=function(_0x41c9fb,_0x8f9f84,_0x37a524){return db[_0x2c6f('0x72')][_0x2c6f('0x5d')]({'where':{'id':_0x41c9fb[_0x2c6f('0x5b')]['id']}})[_0x2c6f('0x25')](handleEntityNotFound(_0x8f9f84,null))[_0x2c6f('0x25')](function(_0x5f00b8){if(_0x5f00b8){return _0x5f00b8['addInteraction'](_0x41c9fb[_0x2c6f('0x5f')][_0x2c6f('0x6e')],_['omit'](_0x41c9fb[_0x2c6f('0x5f')],[_0x2c6f('0x6e'),'id'])||{});}})[_0x2c6f('0x25')](respondWithResult(_0x8f9f84,null))[_0x2c6f('0x2f')](handleError(_0x8f9f84,null));};exports[_0x2c6f('0x73')]=function(_0x3c831c,_0x2c2f56,_0x1b9f4e){var _0x3741f5={'raw':![],'where':{}};var _0x32892a={};var _0x1eb757={'count':0x0,'rows':[]};return db[_0x2c6f('0x58')][_0x2c6f('0x6b')]({'where':{'id':_0x3c831c[_0x2c6f('0x5b')]['id']}})['then'](handleEntityNotFound(_0x2c2f56,null))[_0x2c6f('0x25')](function(_0x3fb38f){if(_0x3fb38f){_0x32892a[_0x2c6f('0x48')]=_['keys'](db[_0x2c6f('0x72')][_0x2c6f('0x45')]);_0x32892a['query']=_[_0x2c6f('0x4a')](_0x3c831c[_0x2c6f('0x49')]);_0x32892a[_0x2c6f('0x4b')]=_[_0x2c6f('0x4c')](_0x32892a['model'],_0x32892a[_0x2c6f('0x49')]);_0x3741f5['attributes']=_[_0x2c6f('0x4c')](_0x32892a['model'],qs[_0x2c6f('0x4d')](_0x3c831c[_0x2c6f('0x49')][_0x2c6f('0x4d')]));_0x3741f5['attributes']=_0x3741f5[_0x2c6f('0x4e')][_0x2c6f('0x6c')]?_0x3741f5[_0x2c6f('0x4e')]:_0x32892a[_0x2c6f('0x48')];if(!_0x3c831c[_0x2c6f('0x49')][_0x2c6f('0x4f')](_0x2c6f('0x50'))){_0x3741f5[_0x2c6f('0x34')]=qs['limit'](_0x3c831c['query']['limit']);_0x3741f5['offset']=qs[_0x2c6f('0x32')](_0x3c831c[_0x2c6f('0x49')][_0x2c6f('0x32')]);}_0x3741f5['order']=qs[_0x2c6f('0x52')](_0x3c831c[_0x2c6f('0x49')][_0x2c6f('0x52')]);_0x3741f5[_0x2c6f('0x55')]=qs[_0x2c6f('0x4b')](_['pick'](_0x3c831c[_0x2c6f('0x49')],_0x32892a[_0x2c6f('0x4b')]));_0x3741f5['where']['FaxAccountId']=_0x3fb38f['id'];if(_0x3c831c[_0x2c6f('0x49')]['filter']){_0x3741f5[_0x2c6f('0x55')]=_['merge'](_0x3741f5['where'],{'$or':_[_0x2c6f('0x44')](_0x3741f5[_0x2c6f('0x4e')],function(_0x12ac7d){var _0xc9bc37={};_0xc9bc37[_0x12ac7d]={'$like':'%'+_0x3c831c[_0x2c6f('0x49')][_0x2c6f('0x54')]+'%'};return _0xc9bc37;})});}_0x3741f5=_[_0x2c6f('0x56')]({},_0x3741f5,_0x3c831c['options']);return db['FaxInteraction'][_0x2c6f('0x35')]({'where':_0x3741f5[_0x2c6f('0x55')]})[_0x2c6f('0x25')](function(_0x131917){_0x1eb757[_0x2c6f('0x35')]=_0x131917;if(_0x3c831c[_0x2c6f('0x49')][_0x2c6f('0x59')]){_0x3741f5[_0x2c6f('0x5c')]=[{'model':db['CmContact'],'as':_0x2c6f('0x74'),'required':![]},{'model':db[_0x2c6f('0x75')],'as':'Owner','attributes':[_0x2c6f('0x40'),_0x2c6f('0x76'),_0x2c6f('0x77')],'required':![]},{'model':db[_0x2c6f('0x78')],'as':_0x2c6f('0x79'),'attributes':['id',_0x2c6f('0x40'),_0x2c6f('0x7a')],'where':_0x3c831c[_0x2c6f('0x49')]['tag']?{'id':_0x3c831c[_0x2c6f('0x49')][_0x2c6f('0x7b')]}:undefined,'required':_0x3c831c['query'][_0x2c6f('0x7b')]?!![]:![]}];}return db['FaxInteraction'][_0x2c6f('0x5a')](_0x3741f5);})[_0x2c6f('0x25')](function(_0x1bf832){_0x1eb757[_0x2c6f('0x6d')]=_0x1bf832;return _0x1eb757;});}})[_0x2c6f('0x25')](respondWithFilteredResult(_0x2c2f56,_0x3741f5))[_0x2c6f('0x2f')](handleError(_0x2c2f56,null));};exports[_0x2c6f('0x7c')]=function(_0x1feb77,_0x5d314e){var _0xd3b1e0=_0x1feb77['params']['id'];var _0x137cd0=_0x1feb77[_0x2c6f('0x5f')];var _0x5b9e6a=0xc8;var _0x140ab7=null;return db[_0x2c6f('0x7d')][_0x2c6f('0x7e')]({'isolationLevel':db['sequelize'][_0x2c6f('0x7f')][_0x2c6f('0x80')][_0x2c6f('0x81')]},function(_0x15f1e6){return db[_0x2c6f('0x58')][_0x2c6f('0x6b')]({'where':{'id':_0xd3b1e0},'transaction':_0x15f1e6})[_0x2c6f('0x25')](function(_0x513ad4){if(_0x513ad4){return db[_0x2c6f('0x82')]['destroy']({'where':{'FaxAccountId':_0xd3b1e0},'transaction':_0x15f1e6})[_0x2c6f('0x25')](function(){var _0x4cd206=_['map'](_0x137cd0,function(_0x1c803f){_0x1c803f['FaxAccountId']=_0xd3b1e0;return _0x1c803f;});return db[_0x2c6f('0x82')][_0x2c6f('0x83')](_0x4cd206,{'transaction':_0x15f1e6});});}else{_0x5b9e6a=0x194;_0x140ab7=[];}});})['then'](function(){if(_0x5b9e6a!==0x194){return db[_0x2c6f('0x82')][_0x2c6f('0x84')]({'where':{'FaxAccountId':_0xd3b1e0},'order':_0x2c6f('0x85')})['then'](function(_0xae5e72){_0x140ab7=_0xae5e72;});}})[_0x2c6f('0x2f')](function(_0x1087f9){_0x5b9e6a=0x1f4;logger[_0x2c6f('0x2c')](_0x1087f9[_0x2c6f('0x86')]);if(_0x1087f9[_0x2c6f('0x40')]){delete _0x1087f9[_0x2c6f('0x40')];}_0x140ab7=_0x1087f9;})[_0x2c6f('0x87')](function(){if(_0x140ab7===null){_0x5d314e[_0x2c6f('0x30')](_0x5b9e6a);}else{if(_0x5b9e6a===0x1f4){_0x5d314e[_0x2c6f('0x31')](_0x5b9e6a)[_0x2c6f('0x41')](_0x140ab7);}else{_0x5d314e['status'](_0x5b9e6a)[_0x2c6f('0x36')](_0x140ab7);}}});};exports[_0x2c6f('0x88')]=function(_0x2a28c7,_0x5ef39b,_0x13d401){var _0xbebea4={};var _0x238dd2={};var _0x16fc25;var _0x5e7ff5;return db[_0x2c6f('0x58')]['findOne']({'where':{'id':_0x2a28c7[_0x2c6f('0x5b')]['id']}})[_0x2c6f('0x25')](handleEntityNotFound(_0x5ef39b,null))[_0x2c6f('0x25')](function(_0x5f3f46){if(_0x5f3f46){_0x16fc25=_0x5f3f46;_0x238dd2['model']=_['keys'](db[_0x2c6f('0x82')][_0x2c6f('0x45')]);_0x238dd2['query']=_['keys'](_0x2a28c7[_0x2c6f('0x49')]);_0x238dd2[_0x2c6f('0x4b')]=_[_0x2c6f('0x4c')](_0x238dd2[_0x2c6f('0x48')],_0x238dd2[_0x2c6f('0x49')]);_0xbebea4[_0x2c6f('0x4e')]=_['intersection'](_0x238dd2[_0x2c6f('0x48')],qs[_0x2c6f('0x4d')](_0x2a28c7[_0x2c6f('0x49')]['fields']));_0xbebea4[_0x2c6f('0x4e')]=_0xbebea4['attributes'][_0x2c6f('0x6c')]?_0xbebea4[_0x2c6f('0x4e')]:_0x238dd2[_0x2c6f('0x48')];_0xbebea4[_0x2c6f('0x51')]=qs[_0x2c6f('0x52')](_0x2a28c7[_0x2c6f('0x49')]['sort']);_0xbebea4[_0x2c6f('0x55')]=qs['filters'](_[_0x2c6f('0x53')](_0x2a28c7[_0x2c6f('0x49')],_0x238dd2[_0x2c6f('0x4b')]));if(_0x2a28c7[_0x2c6f('0x49')][_0x2c6f('0x54')]){_0xbebea4['where']=_[_0x2c6f('0x56')](_0xbebea4['where'],{'$or':_['map'](_0xbebea4[_0x2c6f('0x4e')],function(_0x455651){var _0x5a9222={};_0x5a9222[_0x455651]={'$like':'%'+_0x2a28c7['query']['filter']+'%'};return _0x5a9222;})});}_0xbebea4=_[_0x2c6f('0x56')]({},_0xbebea4,_0x2a28c7[_0x2c6f('0x57')]);return _0x16fc25[_0x2c6f('0x88')](_0xbebea4);}})['then'](function(_0x1cb340){if(_0x1cb340){_0x5e7ff5=_0x1cb340[_0x2c6f('0x6c')];if(!_0x2a28c7[_0x2c6f('0x49')][_0x2c6f('0x4f')]('nolimit')){_0xbebea4[_0x2c6f('0x34')]=qs['limit'](_0x2a28c7[_0x2c6f('0x49')][_0x2c6f('0x34')]);_0xbebea4[_0x2c6f('0x32')]=qs[_0x2c6f('0x32')](_0x2a28c7[_0x2c6f('0x49')][_0x2c6f('0x32')]);}return _0x16fc25[_0x2c6f('0x88')](_0xbebea4);}})['then'](function(_0x920b39){if(_0x920b39){return _0x920b39?{'count':_0x5e7ff5,'rows':_0x920b39}:null;}})[_0x2c6f('0x25')](respondWithResult(_0x5ef39b,null))[_0x2c6f('0x2f')](handleError(_0x5ef39b,null));};function Extension(_0x240ee2,_0x26d1fd,_0x256a51,_0x168f0b){this['context']='from-voip-provider';this[_0x2c6f('0x89')]=_0x240ee2[_0x2c6f('0x8a')];this['app']=_0x168f0b;this[_0x2c6f('0x47')]=_0x2c6f('0x8b');this['description']=_0x2c6f('0x8c');this[_0x2c6f('0x68')]=_0x240ee2['id'];this[_0x2c6f('0x85')]=_0x26d1fd;this[_0x2c6f('0x8d')]=_0x256a51;}function createExtensionsReciveFax(_0x5f35ab){var _0x5d19fe=0x1;var _0x1e17f9=[];_0x1e17f9[_0x2c6f('0x8e')](new Extension(_0x5f35ab,_0x5d19fe,'','Answer'));_0x5d19fe+=0x1;_0x1e17f9['push'](new Extension(_0x5f35ab,_0x5d19fe,_0x2c6f('0x8f'),_0x2c6f('0x90')));_0x5d19fe+=0x1;for(var _0x2e9cc8 in _0x5f35ab){if(_0x5f35ab[_0x2c6f('0x4f')](_0x2e9cc8)&&(_0x2e9cc8==='ecm'||_0x2e9cc8===_0x2c6f('0x8a')||_0x2e9cc8===_0x2c6f('0x91')||_0x2e9cc8===_0x2c6f('0x92')||_0x2e9cc8===_0x2c6f('0x93')||_0x2e9cc8===_0x2c6f('0x94')||_0x2e9cc8===_0x2c6f('0x95')||_0x2e9cc8===_0x2c6f('0x96')||_0x2e9cc8==='t38timeout')){_0x1e17f9[_0x2c6f('0x8e')](new Extension(_0x5f35ab,_0x5d19fe,_0x2c6f('0x97')+_0x2e9cc8+')='+_0x5f35ab[_0x2e9cc8],'Set'));_0x5d19fe+=0x1;}}_0x1e17f9[_0x2c6f('0x8e')](new Extension(_0x5f35ab,_0x5d19fe,'6',_0x2c6f('0x98')));_0x5d19fe+=0x1;_0x1e17f9[_0x2c6f('0x8e')](new Extension(_0x5f35ab,_0x5d19fe,_0x2c6f('0x99'),_0x2c6f('0x9a')));_0x5d19fe=0x0;return _0x1e17f9;}exports[_0x2c6f('0x9b')]=function(_0x5731d5,_0x22ca52,_0x52961b){var _0x2c6e35;return db[_0x2c6f('0x7d')][_0x2c6f('0x7e')](function(_0x44abc0){return db['FaxAccount']['create'](_0x5731d5[_0x2c6f('0x5f')],{'transaction':_0x44abc0})[_0x2c6f('0x25')](function(_0x237067){_0x2c6e35=_0x237067[_0x2c6f('0x3c')]({'plain':!![]});return db[_0x2c6f('0x9c')][_0x2c6f('0x83')](createExtensionsReciveFax(_0x2c6e35),{'transaction':_0x44abc0});});})[_0x2c6f('0x25')](function(){return _0x2c6e35;})[_0x2c6f('0x25')](respondWithResult(_0x22ca52,null))[_0x2c6f('0x2f')](handleError(_0x22ca52,null));};exports[_0x2c6f('0x9d')]=function(_0x2c020f,_0x8a8d4b,_0x3ff428){var _0x4ae5a6;return db['sequelize']['transaction'](function(_0x35b2d1){return db[_0x2c6f('0x58')][_0x2c6f('0x3a')](_0x2c020f['body'],{'where':{'id':_0x2c020f[_0x2c6f('0x5f')]['id']},'transaction':_0x35b2d1})[_0x2c6f('0x25')](function(_0x93c090){return db[_0x2c6f('0x9c')][_0x2c6f('0x3b')]({'where':{'FaxAccountId':_0x2c020f[_0x2c6f('0x5f')]['id']},'transaction':_0x35b2d1})[_0x2c6f('0x25')](function(_0x76555e){return db[_0x2c6f('0x9c')][_0x2c6f('0x83')](createExtensionsReciveFax(_[_0x2c6f('0x9e')](_0x2c020f[_0x2c6f('0x5f')],[_0x2c6f('0x9f'),_0x2c6f('0xa0'),_0x2c6f('0xa1'),_0x2c6f('0xa2'),'TrunkId','ListId'])),{'transaction':_0x35b2d1});});});})['then'](function(){return db[_0x2c6f('0x58')][_0x2c6f('0xa3')](_0x2c020f['body']['id']);})['then'](respondWithResult(_0x8a8d4b,null))[_0x2c6f('0x2f')](handleError(_0x8a8d4b,null));};exports[_0x2c6f('0xa4')]=function(_0x24f16d,_0x5b9d31,_0xa2aeca){var _0x4ce9b1={'raw':!![],'where':{}};var _0x593cf1={};var _0x300de0={'count':0x0,'rows':[]};return db['FaxAccount'][_0x2c6f('0x6b')]({'where':{'id':_0x24f16d['params']['id']}})[_0x2c6f('0x25')](handleEntityNotFound(_0x5b9d31,null))[_0x2c6f('0x25')](function(_0x14d003){if(_0x14d003){_0x593cf1[_0x2c6f('0x48')]=_[_0x2c6f('0x4a')](db['FaxMessage'][_0x2c6f('0x45')]);_0x593cf1[_0x2c6f('0x49')]=_['keys'](_0x24f16d[_0x2c6f('0x49')]);_0x593cf1['filters']=_['intersection'](_0x593cf1['model'],_0x593cf1[_0x2c6f('0x49')]);_0x4ce9b1[_0x2c6f('0x4e')]=_[_0x2c6f('0x4c')](_0x593cf1[_0x2c6f('0x48')],qs[_0x2c6f('0x4d')](_0x24f16d['query'][_0x2c6f('0x4d')]));_0x4ce9b1[_0x2c6f('0x4e')]=_0x4ce9b1[_0x2c6f('0x4e')]['length']?_0x4ce9b1[_0x2c6f('0x4e')]:_0x593cf1[_0x2c6f('0x48')];if(!_0x24f16d['query'][_0x2c6f('0x4f')](_0x2c6f('0x50'))){_0x4ce9b1[_0x2c6f('0x34')]=qs['limit'](_0x24f16d[_0x2c6f('0x49')]['limit']);_0x4ce9b1[_0x2c6f('0x32')]=qs[_0x2c6f('0x32')](_0x24f16d[_0x2c6f('0x49')][_0x2c6f('0x32')]);}_0x4ce9b1['order']=qs[_0x2c6f('0x52')](_0x24f16d[_0x2c6f('0x49')][_0x2c6f('0x52')]);_0x4ce9b1[_0x2c6f('0x55')]=qs[_0x2c6f('0x4b')](_['pick'](_0x24f16d[_0x2c6f('0x49')],_0x593cf1[_0x2c6f('0x4b')]));_0x4ce9b1[_0x2c6f('0x55')][_0x2c6f('0x68')]=_0x14d003['id'];if(_0x24f16d[_0x2c6f('0x49')][_0x2c6f('0x54')]){_0x4ce9b1[_0x2c6f('0x55')]=_[_0x2c6f('0x56')](_0x4ce9b1[_0x2c6f('0x55')],{'$or':_['map'](_0x4ce9b1[_0x2c6f('0x4e')],function(_0x4efeec){var _0x4aa095={};_0x4aa095[_0x4efeec]={'$like':'%'+_0x24f16d[_0x2c6f('0x49')]['filter']+'%'};return _0x4aa095;})});}if(_0x24f16d[_0x2c6f('0x49')][_0x2c6f('0xa5')]){var _0x3b1a3a=_0x24f16d[_0x2c6f('0x49')][_0x2c6f('0xa5')][_0x2c6f('0xa6')](',');var _0x407f60={};_0x407f60[_0x3b1a3a[0x0]]={'$gte':moment(_0x3b1a3a[0x1])[_0x2c6f('0xa7')](_0x2c6f('0xa8'))};_0x4ce9b1[_0x2c6f('0x55')]=_[_0x2c6f('0x56')](_0x4ce9b1['where'],_0x407f60);}_0x4ce9b1=_[_0x2c6f('0x56')]({},_0x4ce9b1,_0x24f16d[_0x2c6f('0x57')]);return db[_0x2c6f('0xa9')][_0x2c6f('0x35')]({'where':_0x4ce9b1[_0x2c6f('0x55')]})[_0x2c6f('0x25')](function(_0x48cebf){_0x300de0[_0x2c6f('0x35')]=_0x48cebf;if(_0x24f16d[_0x2c6f('0x49')][_0x2c6f('0x59')]){_0x4ce9b1[_0x2c6f('0x5c')]=[{'all':!![]}];}return db[_0x2c6f('0xa9')]['findAll'](_0x4ce9b1);})[_0x2c6f('0x25')](function(_0xac8bc2){_0x300de0[_0x2c6f('0x6d')]=_0xac8bc2;return _0x300de0;});}})['then'](respondWithFilteredResult(_0x5b9d31,_0x4ce9b1))[_0x2c6f('0x2f')](handleError(_0x5b9d31,null));};exports[_0x2c6f('0x41')]=function(_0x40008e,_0x281fed,_0x30f19d){var _0x226411,_0x3a5e7f={},_0x5f0821;if(_0x40008e['body']['to']){_0x5f0821=_0x40008e[_0x2c6f('0x5f')]['to'][0x0];}return db[_0x2c6f('0x58')]['find']({'where':{'id':_0x40008e[_0x2c6f('0x5b')]['id']},'include':[{'model':db[_0x2c6f('0xaa')],'as':_0x2c6f('0xab'),'include':[{'model':db[_0x2c6f('0xac')],'as':_0x2c6f('0xad'),'where':{'fax':_0x5f0821},'limit':0x1,'order':[[_0x2c6f('0xa2'),'DESC']]}]}]})[_0x2c6f('0x25')](handleEntityNotFound(_0x281fed,null))[_0x2c6f('0x25')](function(_0x2ca849){_0x226411=_0x2ca849;if(_0x40008e[_0x2c6f('0x5f')][_0x2c6f('0xae')]&&_0x40008e[_0x2c6f('0x5f')][_0x2c6f('0xae')]['length']){for(var _0x5439ea=0x0;_0x5439ea<_0x40008e['body'][_0x2c6f('0xae')]['length'];_0x5439ea+=0x1){_0x40008e[_0x2c6f('0x5f')][_0x2c6f('0xae')][_0x5439ea]={'filename':_0x40008e[_0x2c6f('0x5f')][_0x2c6f('0xae')][_0x5439ea][_0x2c6f('0x40')],'id':_0x40008e[_0x2c6f('0x5f')][_0x2c6f('0xae')][_0x5439ea]['id'],'path':path[_0x2c6f('0xaf')](config['root'],'server/files/attachments',_0x40008e['body'][_0x2c6f('0xae')][_0x5439ea]['basename'])};}}return respondWithRpcPromise('CheckAfterSend',_0x2c6f('0xb0'),{'FaxAccountId':_[_0x2c6f('0xb1')](_0x40008e['params']['id'])?undefined:_0x40008e['params']['id'],'path':_[_0x2c6f('0xb1')](_0x40008e['body'][_0x2c6f('0xae')][0x0]['path'])?undefined:_0x40008e[_0x2c6f('0x5f')][_0x2c6f('0xae')][0x0][_0x2c6f('0x7')],'fax':_['isNil'](_0x40008e[_0x2c6f('0x5f')]['to'][0x0])?undefined:_0x40008e[_0x2c6f('0x5f')]['to'][0x0]},client9002);})[_0x2c6f('0x25')](function(){if(_0x226411){if(_[_0x2c6f('0xb1')](_0x40008e[_0x2c6f('0x5f')][_0x2c6f('0xb2')])){_0x40008e[_0x2c6f('0x5f')][_0x2c6f('0xb2')]=util['format']('\x22%s\x22\x20<%s>',_0x226411[_0x2c6f('0x40')],_0x226411[_0x2c6f('0xb3')]);}if(_0x226411[_0x2c6f('0xab')]){if(_0x226411[_0x2c6f('0xab')][_0x2c6f('0xad')][_0x2c6f('0x6c')]){return _0x226411[_0x2c6f('0xab')][_0x2c6f('0xad')][0x0];}else{return db[_0x2c6f('0xac')]['create'](_[_0x2c6f('0x1d')](_0x40008e[_0x2c6f('0x5f')],{'firstName':_0x40008e[_0x2c6f('0x5f')]['to'][0x0],'phone':_0x40008e['body']['to'][0x0],'fax':_0x40008e[_0x2c6f('0x5f')]['to'][0x0],'ListId':_0x226411[_0x2c6f('0xb4')]}));}}else{throw new Error('List\x20not\x20found');}}else{throw new Error('Send\x20Fax\x20failed');}})[_0x2c6f('0x25')](function(_0x3b452f){if(_0x3b452f){return db[_0x2c6f('0x72')]['find']({'where':{'ContactId':_0x3b452f['id'],'closed':![],'FaxAccountId':_0x226411['id']}})[_0x2c6f('0x25')](function(_0x138261){if(_0x138261){return[_0x138261,![]];}return db[_0x2c6f('0x72')][_0x2c6f('0x5e')]({'UserId':_0x40008e[_0x2c6f('0x60')]['id'],'ContactId':_0x3b452f['id'],'FaxAccountId':_0x226411['id'],'fax':_0x40008e[_0x2c6f('0x5f')]['to'][0x0],'firstMsgDirection':_0x2c6f('0xb5'),'Messages':[_['merge'](_0x40008e[_0x2c6f('0x5f')],{'read':![],'body':_0x40008e['body'][_0x2c6f('0xae')][0x0][_0x2c6f('0xb6')],'FaxAccountId':_0x226411['id'],'UserId':_0x40008e[_0x2c6f('0x60')]['id'],'ContactId':_0x3b452f['id'],'AttachmentId':_0x40008e['body'][_0x2c6f('0xae')][0x0]['id']})]},{'include':[{'model':db[_0x2c6f('0xa9')],'as':'Messages'}]})['then'](function(_0x3e9b8c){return[_0x3e9b8c,!![]];});});}else{throw new Error(_0x2c6f('0xb7'));}})[_0x2c6f('0xb8')](function(_0x300293,_0x331600){if(_0x331600){return _0x300293;}return db['FaxMessage'][_0x2c6f('0x5e')]({'direction':_0x2c6f('0xb5'),'read':![],'body':_0x40008e['body'][_0x2c6f('0xae')][0x0][_0x2c6f('0xb6')],'FaxAccountId':_0x226411['id'],'FaxInteractionId':_0x300293['id'],'UserId':_0x40008e[_0x2c6f('0x60')]['id'],'ContactId':_0x300293[_0x2c6f('0xb9')],'AttachmentId':_0x40008e['body'][_0x2c6f('0xae')][0x0]['id']})[_0x2c6f('0x25')](function(_0x5f2da2){_0x300293[_0x2c6f('0xba')][_0x2c6f('0xbb')]=[];_0x300293[_0x2c6f('0xba')][_0x2c6f('0xbb')][_0x2c6f('0x8e')](_0x5f2da2[_0x2c6f('0xba')]);return _0x300293;});})['then'](function(_0x4d3e68){respondWithRpcPromise(_0x2c6f('0xbc'),'SendFax',{'FaxAccountId':_['isNil'](_0x40008e[_0x2c6f('0x5b')]['id'])?undefined:_0x40008e[_0x2c6f('0x5b')]['id'],'path':_['isNil'](_0x40008e[_0x2c6f('0x5f')]['attachments'][0x0]['path'])?undefined:_0x40008e[_0x2c6f('0x5f')][_0x2c6f('0xae')][0x0][_0x2c6f('0x7')],'fax':_[_0x2c6f('0xb1')](_0x40008e[_0x2c6f('0x5f')]['to'][0x0])?undefined:_0x40008e[_0x2c6f('0x5f')]['to'][0x0],'AttachmentId':_0x40008e[_0x2c6f('0x5f')][_0x2c6f('0xae')][0x0]['id']},client9002)['then'](function(_0x3a1b57){logger[_0x2c6f('0x26')](_0x2c6f('0xbd'),_0x3a1b57);})[_0x2c6f('0x2f')](function(_0x463864){logger[_0x2c6f('0x26')](_0x2c6f('0xbd'),_0x463864);});return _0x4d3e68;})[_0x2c6f('0x25')](respondWithResult(_0x281fed,null))[_0x2c6f('0x2f')](handleError(_0x281fed,null));};exports[_0x2c6f('0xbe')]=function(_0x20d6d7,_0x1e5199,_0x3e8427){return db[_0x2c6f('0x58')][_0x2c6f('0x5d')]({'where':{'id':_0x20d6d7['params']['id']}})[_0x2c6f('0x25')](handleEntityNotFound(_0x1e5199,null))['then'](function(_0x2932b0){if(_0x2932b0){return _0x2932b0[_0x2c6f('0xbe')](_0x20d6d7[_0x2c6f('0x5f')][_0x2c6f('0x6e')],_['omit'](_0x20d6d7['body'],[_0x2c6f('0x6e'),'id'])||{})[_0x2c6f('0xb8')](function(_0x41468c){for(var _0x3d3fe4=0x0;_0x3d3fe4<_0x20d6d7[_0x2c6f('0x5f')]['ids'][_0x2c6f('0x6c')];_0x3d3fe4+=0x1){socket[_0x2c6f('0xbf')]('userFaxAccount:save',{'UserId':Number(_0x20d6d7[_0x2c6f('0x5f')][_0x2c6f('0x6e')][_0x3d3fe4]),'FaxAccountId':Number(_0x20d6d7[_0x2c6f('0x5b')]['id'])});}return _0x41468c;});}})[_0x2c6f('0x25')](respondWithResult(_0x1e5199,null))[_0x2c6f('0x2f')](handleError(_0x1e5199,null));};exports[_0x2c6f('0xc0')]=function(_0x328a42,_0xbb8d30,_0x5f5b24){return db[_0x2c6f('0x58')][_0x2c6f('0x5d')]({'where':{'id':_0x328a42[_0x2c6f('0x5b')]['id']}})['then'](handleEntityNotFound(_0xbb8d30,null))['then'](function(_0x25ec37){if(_0x25ec37){return _0x25ec37['removeAgents'](_0x328a42['query'][_0x2c6f('0x6e')])[_0x2c6f('0x25')](function(){if(_['isArray'](_0x328a42[_0x2c6f('0x49')][_0x2c6f('0x6e')])){for(var _0x42f95e=0x0;_0x42f95e<_0x328a42[_0x2c6f('0x49')]['ids'][_0x2c6f('0x6c')];_0x42f95e+=0x1){socket[_0x2c6f('0xbf')](_0x2c6f('0xc1'),{'UserId':Number(_0x328a42[_0x2c6f('0x49')][_0x2c6f('0x6e')][_0x42f95e]),'FaxAccountId':Number(_0x328a42[_0x2c6f('0x5b')]['id'])});}}else{socket[_0x2c6f('0xbf')](_0x2c6f('0xc1'),{'UserId':Number(_0x328a42[_0x2c6f('0x49')][_0x2c6f('0x6e')]),'FaxAccountId':Number(_0x328a42[_0x2c6f('0x5b')]['id'])});}});}})[_0x2c6f('0x25')](respondWithStatusCode(_0xbb8d30,null))[_0x2c6f('0x2f')](handleError(_0xbb8d30,null));};exports[_0x2c6f('0xc2')]=function(_0x13eb36,_0x31169d,_0x5e83ae){var _0xfa5929={};var _0xf58248={};var _0x5ceb6f;var _0x1e5c5c;return db['FaxAccount']['findOne']({'where':{'id':_0x13eb36[_0x2c6f('0x5b')]['id']}})['then'](handleEntityNotFound(_0x31169d,null))[_0x2c6f('0x25')](function(_0x511945){if(_0x511945){_0x5ceb6f=_0x511945;_0xf58248['model']=_[_0x2c6f('0x4a')](db[_0x2c6f('0x75')][_0x2c6f('0x45')]);_0xf58248[_0x2c6f('0x49')]=_[_0x2c6f('0x4a')](_0x13eb36['query']);_0xf58248[_0x2c6f('0x4b')]=_[_0x2c6f('0x4c')](_0xf58248[_0x2c6f('0x48')],_0xf58248['query']);_0xfa5929[_0x2c6f('0x4e')]=_[_0x2c6f('0x4c')](_0xf58248[_0x2c6f('0x48')],qs[_0x2c6f('0x4d')](_0x13eb36['query'][_0x2c6f('0x4d')]));_0xfa5929[_0x2c6f('0x4e')]=_0xfa5929[_0x2c6f('0x4e')][_0x2c6f('0x6c')]?_0xfa5929[_0x2c6f('0x4e')]:_0xf58248[_0x2c6f('0x48')];_0xfa5929['order']=qs[_0x2c6f('0x52')](_0x13eb36['query'][_0x2c6f('0x52')]);_0xfa5929[_0x2c6f('0x55')]=qs[_0x2c6f('0x4b')](_['pick'](_0x13eb36[_0x2c6f('0x49')],_0xf58248['filters']));if(_0x13eb36[_0x2c6f('0x49')][_0x2c6f('0x54')]){_0xfa5929[_0x2c6f('0x55')]=_[_0x2c6f('0x56')](_0xfa5929[_0x2c6f('0x55')],{'$or':_[_0x2c6f('0x44')](_0xfa5929['attributes'],function(_0x2ec356){var _0x11f9c9={};_0x11f9c9[_0x2ec356]={'$like':'%'+_0x13eb36[_0x2c6f('0x49')][_0x2c6f('0x54')]+'%'};return _0x11f9c9;})});}_0xfa5929=_[_0x2c6f('0x56')]({},_0xfa5929,_0x13eb36[_0x2c6f('0x57')]);return _0x5ceb6f[_0x2c6f('0xc2')](_0xfa5929);}})[_0x2c6f('0x25')](function(_0x19b74f){if(_0x19b74f){_0x1e5c5c=_0x19b74f[_0x2c6f('0x6c')];if(!_0x13eb36[_0x2c6f('0x49')][_0x2c6f('0x4f')](_0x2c6f('0x50'))){_0xfa5929['limit']=qs[_0x2c6f('0x34')](_0x13eb36[_0x2c6f('0x49')]['limit']);_0xfa5929[_0x2c6f('0x32')]=qs['offset'](_0x13eb36[_0x2c6f('0x49')][_0x2c6f('0x32')]);}return _0x5ceb6f['getAgents'](_0xfa5929);}})[_0x2c6f('0x25')](function(_0x4b6f3b){if(_0x4b6f3b){return _0x4b6f3b?{'count':_0x1e5c5c,'rows':_0x4b6f3b}:null;}})['then'](respondWithResult(_0x31169d,null))[_0x2c6f('0x2f')](handleError(_0x31169d,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index 38442f5..3ddebd7 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 _0x4df2=['remove','hasOwnProperty','hook','exports','events','../../mysqldb','FaxAccount','setMaxListeners','save','update'];(function(_0x25fa5c,_0x421141){var _0x1bade2=function(_0x3faf20){while(--_0x3faf20){_0x25fa5c['push'](_0x25fa5c['shift']());}};_0x1bade2(++_0x421141);}(_0x4df2,0x176));var _0x24df=function(_0x2b9664,_0x1437aa){_0x2b9664=_0x2b9664-0x0;var _0x4585d7=_0x4df2[_0x2b9664];return _0x4585d7;};'use strict';var EventEmitter=require(_0x24df('0x0'));var FaxAccount=require(_0x24df('0x1'))['db'][_0x24df('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x24df('0x3')](0x0);var events={'afterCreate':_0x24df('0x4'),'afterUpdate':_0x24df('0x5'),'afterDestroy':_0x24df('0x6')};function emitEvent(_0x124776){return function(_0x596e78,_0x23e3ef,_0x328d35){FaxAccountEvents['emit'](_0x124776+':'+_0x596e78['id'],_0x596e78);FaxAccountEvents['emit'](_0x124776,_0x596e78);_0x328d35(null);};}for(var e in events){if(events[_0x24df('0x7')](e)){var event=events[e];FaxAccount[_0x24df('0x8')](e,emitEvent(event));}}module[_0x24df('0x9')]=FaxAccountEvents; \ No newline at end of file +var _0x90f1=['setMaxListeners','save','update','remove','emit','hasOwnProperty','exports','events','FaxAccount'];(function(_0x57369d,_0x37ceab){var _0x34e5cc=function(_0x17f487){while(--_0x17f487){_0x57369d['push'](_0x57369d['shift']());}};_0x34e5cc(++_0x37ceab);}(_0x90f1,0xa0));var _0x190f=function(_0x4d7cb5,_0x46ffb7){_0x4d7cb5=_0x4d7cb5-0x0;var _0x33d944=_0x90f1[_0x4d7cb5];return _0x33d944;};'use strict';var EventEmitter=require(_0x190f('0x0'));var FaxAccount=require('../../mysqldb')['db'][_0x190f('0x1')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x190f('0x2')](0x0);var events={'afterCreate':_0x190f('0x3'),'afterUpdate':_0x190f('0x4'),'afterDestroy':_0x190f('0x5')};function emitEvent(_0xb9313a){return function(_0x3393fb,_0x5d0def,_0x7938d6){FaxAccountEvents[_0x190f('0x6')](_0xb9313a+':'+_0x3393fb['id'],_0x3393fb);FaxAccountEvents[_0x190f('0x6')](_0xb9313a,_0x3393fb);_0x7938d6(null);};}for(var e in events){if(events[_0x190f('0x7')](e)){var event=events[e];FaxAccount['hook'](e,emitEvent(event));}}module[_0x190f('0x8')]=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index f0b4c71..8c30f45 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 _0xee22=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxAccount.attributes','define','FaxAccount','lodash','api'];(function(_0x15bc81,_0x4d4f77){var _0x59440e=function(_0x1b60f2){while(--_0x1b60f2){_0x15bc81['push'](_0x15bc81['shift']());}};_0x59440e(++_0x4d4f77);}(_0xee22,0x1b6));var _0x2ee2=function(_0x3f0d76,_0x378fed){_0x3f0d76=_0x3f0d76-0x0;var _0x12c12e=_0xee22[_0x3f0d76];return _0x12c12e;};'use strict';var _=require(_0x2ee2('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x2ee2('0x1'));var moment=require(_0x2ee2('0x2'));var BPromise=require(_0x2ee2('0x3'));var rp=require(_0x2ee2('0x4'));var fs=require('fs');var path=require(_0x2ee2('0x5'));var rimraf=require(_0x2ee2('0x6'));var config=require(_0x2ee2('0x7'));var attributes=require(_0x2ee2('0x8'));module['exports']=function(_0x5bc6db,_0x4fcd88){return _0x5bc6db[_0x2ee2('0x9')](_0x2ee2('0xa'),attributes,{'tableName':'fax_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x954a=['FaxAccount','fax_accounts','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x562959,_0xffb46f){var _0x63c6bd=function(_0x3e61cc){while(--_0x3e61cc){_0x562959['push'](_0x562959['shift']());}};_0x63c6bd(++_0xffb46f);}(_0x954a,0x15e));var _0xa954=function(_0x28658f,_0x41429e){_0x28658f=_0x28658f-0x0;var _0x1ede09=_0x954a[_0x28658f];return _0x1ede09;};'use strict';var _=require(_0xa954('0x0'));var util=require(_0xa954('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xa954('0x2'));var BPromise=require(_0xa954('0x3'));var rp=require(_0xa954('0x4'));var fs=require('fs');var path=require(_0xa954('0x5'));var rimraf=require(_0xa954('0x6'));var config=require(_0xa954('0x7'));var attributes=require('./faxAccount.attributes');module[_0xa954('0x8')]=function(_0x33cc55,_0x2bcf3d){return _0x33cc55[_0xa954('0x9')](_0xa954('0xa'),attributes,{'tableName':_0xa954('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 5cf0612..52f82a5 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 _0x951e=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','GetFaxAccount','FaxAccount','findAll','raw','options','attributes','limit','map','include','model','NotifyFaxAccount','body','fax','CmContact','Sequelize','ValidationError','difference','updatedAt','keys','createdAt','CompanyId','ListId','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','find','account','CmList','List','DESC','FaxApplication','get','Applications','list','applications','orderBy','priority','asc','Contacts','create','contact','FaxInteraction','Contact\x20not\x20found','autoclose','push','length','close','unmanaged','*,*,*,*','interaction','FaxMessage','ContactId','UserId','User','name','agent','waitForTheAssignedAgent','queueId','FaxQueue','queue','waitForTheAssignedQueue','Start','startRouting'];(function(_0x5e0939,_0x1242ae){var _0x5ac0e7=function(_0x359cfb){while(--_0x359cfb){_0x5e0939['push'](_0x5e0939['shift']());}};_0x5ac0e7(++_0x1242ae);}(_0x951e,0x179));var _0xe951=function(_0x46d938,_0x32e9d7){_0x46d938=_0x46d938-0x0;var _0x5e128b=_0x951e[_0x46d938];return _0x5e128b;};'use strict';var _=require(_0xe951('0x0'));var util=require(_0xe951('0x1'));var moment=require(_0xe951('0x2'));var BPromise=require(_0xe951('0x3'));var rs=require(_0xe951('0x4'));var fs=require('fs');var Redis=require(_0xe951('0x5'));var db=require(_0xe951('0x6'))['db'];var utils=require(_0xe951('0x7'));var logger=require(_0xe951('0x8'))(_0xe951('0x9'));var config=require(_0xe951('0xa'));var jayson=require(_0xe951('0xb'));var client=jayson['client']['http']({'port':0x232c});config[_0xe951('0xc')]=_[_0xe951('0xd')](config['redis'],{'host':_0xe951('0xe'),'port':0x18eb});var socket=require(_0xe951('0xf'))(new Redis(config[_0xe951('0xc')]));require(_0xe951('0x10'))['register'](socket);function respondWithRpcPromise(_0x267412,_0x4c043f,_0xdcb8e5){return new BPromise(function(_0x2fde70,_0x3e2162){return client['request'](_0x267412,_0xdcb8e5)[_0xe951('0x11')](function(_0x45a8cf){logger[_0xe951('0x12')](_0xe951('0x13'),_0x4c043f,_0xe951('0x14'));logger[_0xe951('0x15')](_0xe951('0x16'),_0x4c043f,'request\x20sent',JSON[_0xe951('0x17')](_0x45a8cf));if(_0x45a8cf['error']){if(_0x45a8cf[_0xe951('0x18')][_0xe951('0x19')]===0x1f4){logger[_0xe951('0x18')](_0xe951('0x13'),_0x4c043f,_0x45a8cf[_0xe951('0x18')][_0xe951('0x1a')]);return _0x3e2162(_0x45a8cf[_0xe951('0x18')]['message']);}logger['error'](_0xe951('0x13'),_0x4c043f,_0x45a8cf[_0xe951('0x18')]['message']);return _0x2fde70(_0x45a8cf[_0xe951('0x18')][_0xe951('0x1a')]);}else{logger[_0xe951('0x12')](_0xe951('0x13'),_0x4c043f,_0xe951('0x14'));_0x2fde70(_0x45a8cf['result'][_0xe951('0x1a')]);}})['catch'](function(_0x3f14c9){logger[_0xe951('0x18')]('FaxAccount,\x20%s,\x20%s',_0x4c043f,_0x3f14c9);_0x3e2162(_0x3f14c9);});});}exports[_0xe951('0x1b')]=function(_0x46f9e7){var _0x2e2f83=this;return new Promise(function(_0x277bd9,_0x450db6){return db[_0xe951('0x1c')][_0xe951('0x1d')]({'raw':_0x46f9e7['options']?_0x46f9e7['options'][_0xe951('0x1e')]===undefined?!![]:![]:!![],'where':_0x46f9e7['options']?_0x46f9e7['options']['where']||null:null,'attributes':_0x46f9e7['options']?_0x46f9e7[_0xe951('0x1f')][_0xe951('0x20')]||null:null,'limit':_0x46f9e7[_0xe951('0x1f')]?_0x46f9e7[_0xe951('0x1f')][_0xe951('0x21')]||null:null,'include':_0x46f9e7[_0xe951('0x1f')]?_0x46f9e7[_0xe951('0x1f')]['include']?_[_0xe951('0x22')](_0x46f9e7[_0xe951('0x1f')][_0xe951('0x23')],function(_0x88eac3){return{'model':db[_0x88eac3[_0xe951('0x24')]],'as':_0x88eac3['as'],'attributes':_0x88eac3[_0xe951('0x20')],'include':_0x88eac3[_0xe951('0x23')]?_[_0xe951('0x22')](_0x88eac3[_0xe951('0x23')],function(_0xd3db3){return{'model':db[_0xd3db3[_0xe951('0x24')]],'as':_0xd3db3['as'],'attributes':_0xd3db3['attributes'],'include':_0xd3db3[_0xe951('0x23')]?_[_0xe951('0x22')](_0xd3db3['include'],function(_0x2638f6){return{'model':db[_0x2638f6[_0xe951('0x24')]],'as':_0x2638f6['as'],'attributes':_0x2638f6[_0xe951('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3a16cd){logger[_0xe951('0x12')]('GetFaxAccount',_0x46f9e7);logger['debug']('GetFaxAccount',_0x46f9e7,JSON[_0xe951('0x17')](_0x3a16cd));_0x277bd9(_0x3a16cd);})['catch'](function(_0x109366){logger[_0xe951('0x18')](_0xe951('0x1b'),_0x109366[_0xe951('0x1a')],_0x46f9e7);_0x450db6(_0x2e2f83[_0xe951('0x18')](0x1f4,_0x109366[_0xe951('0x1a')]));});});};exports[_0xe951('0x25')]=function(_0x59a86e,_0x3decd4,_0x71fe62){var _0x314b2=this;return new Promise(function(_0x31be3e,_0xc6e71){var _0x5bb1e2={'body':_0x59a86e[_0xe951('0x26')],'channel':_0xe951('0x27')};var _0x5d973a=[];var _0x5e0c6e=[];var _0x497182={};return db[_0xe951('0x28')]['describe']()[_0xe951('0x11')](function(_0x8ff065){if(!_0x8ff065){throw new db[(_0xe951('0x29'))][(_0xe951('0x2a'))]('no\x20available\x20attributes');}_0x5d973a=_[_0xe951('0x2b')](_['keys'](_0x8ff065),['createdAt',_0xe951('0x2c')]);_0x5e0c6e=_[_0xe951('0x2b')](_[_0xe951('0x2d')](_0x8ff065),[_0xe951('0x2e'),_0xe951('0x2c'),_0xe951('0x2f'),_0xe951('0x30')]);if(_0x59a86e[_0xe951('0x26')]['id']){delete _0x59a86e[_0xe951('0x26')]['id'];}if(_[_0xe951('0x31')](_0x59a86e[_0xe951('0x26')]['from'])){throw new db['Sequelize'][(_0xe951('0x2a'))]('from\x20is\x20mandatory');}if(_['isNil'](_0x59a86e[_0xe951('0x26')][_0xe951('0x26')])||_0x59a86e[_0xe951('0x26')][_0xe951('0x26')]===''){throw new db[(_0xe951('0x29'))][(_0xe951('0x2a'))](_0xe951('0x32'));}if(_['isNil'](_0x59a86e[_0xe951('0x26')][_0xe951('0x33')])){throw new db['Sequelize'][(_0xe951('0x2a'))](_0xe951('0x34')+_0x5e0c6e);}if(!_['includes'](_0x5e0c6e,_0x59a86e[_0xe951('0x26')][_0xe951('0x33')])){throw new db[(_0xe951('0x29'))][(_0xe951('0x2a'))](_0xe951('0x35')+_0x5e0c6e);}_0x497182[_0x59a86e[_0xe951('0x26')][_0xe951('0x33')]]=_0x59a86e[_0xe951('0x26')][_0xe951('0x36')];})[_0xe951('0x11')](function(){return db[_0xe951('0x1c')][_0xe951('0x37')]({'where':{'id':_0x59a86e[_0xe951('0x38')]['id']},'include':[{'model':db[_0xe951('0x39')],'as':_0xe951('0x3a'),'include':[{'model':db[_0xe951('0x28')],'as':'Contacts','where':_0x497182,'limit':0x1,'order':[[_0xe951('0x2c'),_0xe951('0x3b')]]}]},{'model':db[_0xe951('0x3c')],'as':'Applications'}]});})[_0xe951('0x11')](function(_0x57357b){if(_0x57357b&&_0x57357b[_0xe951('0x3a')]){var _0x456f17=_0x57357b[_0xe951('0x3d')]({'plain':!![]});_0x5bb1e2[_0xe951('0x38')]=_0x456f17;_0x5bb1e2['applications']=_0x456f17[_0xe951('0x3e')];_0x5bb1e2[_0xe951('0x3f')]=_0x456f17[_0xe951('0x3a')];_0x5bb1e2[_0xe951('0x40')]=_[_0xe951('0x41')](_0x5bb1e2[_0xe951('0x40')],[_0xe951('0x42')],[_0xe951('0x43')]);if(_0x5bb1e2['account'][_0xe951('0x3e')]){delete _0x5bb1e2[_0xe951('0x38')][_0xe951('0x3e')];}if(_0x5bb1e2[_0xe951('0x38')]['List']&&_0x5bb1e2[_0xe951('0x38')][_0xe951('0x3a')][_0xe951('0x44')]['length']){return _0x5bb1e2['account'][_0xe951('0x3a')][_0xe951('0x44')][0x0];}var _0x35563e=_[_0xe951('0xd')](_0x59a86e[_0xe951('0x26')],{'firstName':_0x59a86e['body']['from'],'ListId':_0x456f17['ListId']});_0x35563e[_0x59a86e['body']['mapKey']]=_0x59a86e[_0xe951('0x26')][_0xe951('0x36')];return db['CmContact'][_0xe951('0x45')](_0x35563e,{'fields':_0x5d973a,'raw':!![]});}})[_0xe951('0x11')](function(_0x4257a1){_0x5bb1e2[_0xe951('0x46')]=_0x4257a1;if(_0x4257a1){var _0x1fb265={'ContactId':_0x4257a1['id'],'FaxAccountId':_0x59a86e[_0xe951('0x38')]['id'],'fax':_0x4257a1['fax']};return db[_0xe951('0x47')][_0xe951('0x37')]({'where':{'ContactId':_0x4257a1['id'],'closed':![],'FaxAccountId':_0x59a86e[_0xe951('0x38')]['id']}})[_0xe951('0x11')](function(_0x2c5e59){if(_0x2c5e59){return[_0x2c5e59,![]];}return db['FaxInteraction'][_0xe951('0x45')](_0x1fb265)[_0xe951('0x11')](function(_0x30b1cb){return[_0x30b1cb,!![]];});});}else{throw new Error(_0xe951('0x48'));}})['spread'](function(_0x21c375,_0x2cd5dd){var _0x10a3a1=_0x21c375[_0xe951('0x3d')]({'plain':!![]});if(_0x2cd5dd){if(_0x5bb1e2['account'][_0xe951('0x49')]){_0x5bb1e2[_0xe951('0x40')][_0xe951('0x4a')]({'id':0x0,'priority':_0x5bb1e2[_0xe951('0x40')][_0xe951('0x4b')]+0x1,'app':_0xe951('0x4c'),'appdata':_0xe951('0x4d'),'interval':_0xe951('0x4e')});}_0x10a3a1['created']=!![];}else{_0x10a3a1['created']=![];}_0x5bb1e2[_0xe951('0x4f')]=_0x10a3a1;return db[_0xe951('0x50')][_0xe951('0x45')]({'body':_0x59a86e['body']['body'],'FaxAccountId':_0x59a86e['account']['id'],'FaxInteractionId':_0x21c375['id'],'direction':'in','ContactId':_0x21c375[_0xe951('0x51')],'AttachmentId':_0x59a86e['body']['AttachmentId']});})[_0xe951('0x11')](function(_0x458542){_0x5bb1e2[_0xe951('0x1a')]=_0x458542;if(!_0x5bb1e2[_0xe951('0x4f')][_0xe951('0x52')])return;return db[_0xe951('0x53')][_0xe951('0x37')]({'attributes':['id',_0xe951('0x54')],'where':{'id':_0x5bb1e2[_0xe951('0x4f')]['UserId']}});})[_0xe951('0x11')](function(_0x2a2b2e){if(_0x2a2b2e){_0x5bb1e2[_0xe951('0x40')]['unshift']({'id':0x0,'priority':0x0,'app':_0xe951('0x55'),'appdata':_0x2a2b2e['name']+','+(_0x5bb1e2[_0xe951('0x38')][_0xe951('0x56')]||0xa),'interval':_0xe951('0x4e')});}if(!_0x5bb1e2[_0xe951('0x4f')][_0xe951('0x57')])return;return db[_0xe951('0x58')][_0xe951('0x37')]({'attributes':['id',_0xe951('0x54')],'where':{'id':_0x5bb1e2[_0xe951('0x4f')]['queueId']}});})[_0xe951('0x11')](function(_0xd81023){if(_0xd81023){_0x5bb1e2[_0xe951('0x40')]['unshift']({'id':0x0,'priority':0x1,'app':_0xe951('0x59'),'appdata':_0xd81023['name']+','+(_0x5bb1e2[_0xe951('0x38')][_0xe951('0x5a')]||0x12c),'interval':_0xe951('0x4e')});}return respondWithRpcPromise(_0xe951('0x5b'),_0xe951('0x5c'),_0x5bb1e2);})[_0xe951('0x11')](function(_0x15713c){_0x31be3e(_0x15713c);})[_0xe951('0x5d')](function(_0xe3d0dc){_0xc6e71(_0x314b2['error'](0x1f4,_0xe3d0dc[_0xe951('0x1a')]));});});}; \ No newline at end of file +var _0xa619=['../../mysqldb','../../config/utils','../../config/logger','http','defaults','localhost','socket.io-emitter','redis','./faxAccount.socket','register','request','info','debug','FaxAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','FaxAccount,\x20%s,\x20%s','message','catch','findAll','options','attributes','limit','include','map','model','GetFaxAccount','NotifyFaxAccount','body','fax','CmContact','describe','then','no\x20available\x20attributes','difference','keys','createdAt','updatedAt','CompanyId','ListId','from','Sequelize','ValidationError','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','isNil','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','FaxAccount','find','account','CmList','Contacts','DESC','Applications','list','applications','priority','asc','List','length','create','contact','FaxInteraction','Contact\x20not\x20found','spread','get','autoclose','close','unmanaged','*,*,*,*','created','interaction','FaxMessage','ContactId','AttachmentId','UserId','User','name','unshift','agent','queueId','FaxQueue','queue','waitForTheAssignedQueue','startRouting','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x30e063,_0xb1d240){var _0x1439f5=function(_0x473e6c){while(--_0x473e6c){_0x30e063['push'](_0x30e063['shift']());}};_0x1439f5(++_0xb1d240);}(_0xa619,0x1da));var _0x9a61=function(_0x3916e9,_0x49c762){_0x3916e9=_0x3916e9-0x0;var _0x27dd35=_0xa619[_0x3916e9];return _0x27dd35;};'use strict';var _=require(_0x9a61('0x0'));var util=require(_0x9a61('0x1'));var moment=require(_0x9a61('0x2'));var BPromise=require(_0x9a61('0x3'));var rs=require(_0x9a61('0x4'));var fs=require('fs');var Redis=require(_0x9a61('0x5'));var db=require(_0x9a61('0x6'))['db'];var utils=require(_0x9a61('0x7'));var logger=require(_0x9a61('0x8'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x9a61('0x9')]({'port':0x232c});config['redis']=_[_0x9a61('0xa')](config['redis'],{'host':_0x9a61('0xb'),'port':0x18eb});var socket=require(_0x9a61('0xc'))(new Redis(config[_0x9a61('0xd')]));require(_0x9a61('0xe'))[_0x9a61('0xf')](socket);function respondWithRpcPromise(_0x325e9e,_0x5d831f,_0x3dd0e8){return new BPromise(function(_0x13889c,_0x3025ac){return client[_0x9a61('0x10')](_0x325e9e,_0x3dd0e8)['then'](function(_0x18c529){logger[_0x9a61('0x11')]('FaxAccount,\x20%s,\x20%s',_0x5d831f,'request\x20sent');logger[_0x9a61('0x12')](_0x9a61('0x13'),_0x5d831f,_0x9a61('0x14'),JSON[_0x9a61('0x15')](_0x18c529));if(_0x18c529[_0x9a61('0x16')]){if(_0x18c529[_0x9a61('0x16')][_0x9a61('0x17')]===0x1f4){logger[_0x9a61('0x16')](_0x9a61('0x18'),_0x5d831f,_0x18c529[_0x9a61('0x16')]['message']);return _0x3025ac(_0x18c529['error'][_0x9a61('0x19')]);}logger[_0x9a61('0x16')](_0x9a61('0x18'),_0x5d831f,_0x18c529[_0x9a61('0x16')]['message']);return _0x13889c(_0x18c529[_0x9a61('0x16')]['message']);}else{logger['info'](_0x9a61('0x18'),_0x5d831f,_0x9a61('0x14'));_0x13889c(_0x18c529['result']['message']);}})[_0x9a61('0x1a')](function(_0x959d1e){logger[_0x9a61('0x16')]('FaxAccount,\x20%s,\x20%s',_0x5d831f,_0x959d1e);_0x3025ac(_0x959d1e);});});}exports['GetFaxAccount']=function(_0x422346){var _0x18c75e=this;return new Promise(function(_0x6f281a,_0x316397){return db['FaxAccount'][_0x9a61('0x1b')]({'raw':_0x422346[_0x9a61('0x1c')]?_0x422346['options']['raw']===undefined?!![]:![]:!![],'where':_0x422346[_0x9a61('0x1c')]?_0x422346[_0x9a61('0x1c')]['where']||null:null,'attributes':_0x422346[_0x9a61('0x1c')]?_0x422346[_0x9a61('0x1c')][_0x9a61('0x1d')]||null:null,'limit':_0x422346[_0x9a61('0x1c')]?_0x422346['options'][_0x9a61('0x1e')]||null:null,'include':_0x422346[_0x9a61('0x1c')]?_0x422346[_0x9a61('0x1c')][_0x9a61('0x1f')]?_[_0x9a61('0x20')](_0x422346[_0x9a61('0x1c')][_0x9a61('0x1f')],function(_0x1c77f6){return{'model':db[_0x1c77f6[_0x9a61('0x21')]],'as':_0x1c77f6['as'],'attributes':_0x1c77f6['attributes'],'include':_0x1c77f6['include']?_[_0x9a61('0x20')](_0x1c77f6['include'],function(_0x1acc7e){return{'model':db[_0x1acc7e['model']],'as':_0x1acc7e['as'],'attributes':_0x1acc7e[_0x9a61('0x1d')],'include':_0x1acc7e['include']?_[_0x9a61('0x20')](_0x1acc7e['include'],function(_0x56aa3e){return{'model':db[_0x56aa3e[_0x9a61('0x21')]],'as':_0x56aa3e['as'],'attributes':_0x56aa3e[_0x9a61('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x48021e){logger[_0x9a61('0x11')](_0x9a61('0x22'),_0x422346);logger['debug'](_0x9a61('0x22'),_0x422346,JSON['stringify'](_0x48021e));_0x6f281a(_0x48021e);})['catch'](function(_0x2c997b){logger[_0x9a61('0x16')]('GetFaxAccount',_0x2c997b[_0x9a61('0x19')],_0x422346);_0x316397(_0x18c75e[_0x9a61('0x16')](0x1f4,_0x2c997b[_0x9a61('0x19')]));});});};exports[_0x9a61('0x23')]=function(_0x14b659,_0x22ccd5,_0x3ad281){var _0x3e14a4=this;return new Promise(function(_0x1eb5d8,_0x352d40){var _0x67b011={'body':_0x14b659[_0x9a61('0x24')],'channel':_0x9a61('0x25')};var _0x54cb14=[];var _0x2249fe=[];var _0x4776f9={};return db[_0x9a61('0x26')][_0x9a61('0x27')]()[_0x9a61('0x28')](function(_0x37cc7a){if(!_0x37cc7a){throw new db['Sequelize']['ValidationError'](_0x9a61('0x29'));}_0x54cb14=_[_0x9a61('0x2a')](_[_0x9a61('0x2b')](_0x37cc7a),[_0x9a61('0x2c'),_0x9a61('0x2d')]);_0x2249fe=_['difference'](_[_0x9a61('0x2b')](_0x37cc7a),[_0x9a61('0x2c'),_0x9a61('0x2d'),_0x9a61('0x2e'),_0x9a61('0x2f')]);if(_0x14b659[_0x9a61('0x24')]['id']){delete _0x14b659[_0x9a61('0x24')]['id'];}if(_['isNil'](_0x14b659[_0x9a61('0x24')][_0x9a61('0x30')])){throw new db[(_0x9a61('0x31'))][(_0x9a61('0x32'))](_0x9a61('0x33'));}if(_['isNil'](_0x14b659['body']['body'])||_0x14b659['body'][_0x9a61('0x24')]===''){throw new db[(_0x9a61('0x31'))][(_0x9a61('0x32'))](_0x9a61('0x34'));}if(_[_0x9a61('0x35')](_0x14b659[_0x9a61('0x24')][_0x9a61('0x36')])){throw new db[(_0x9a61('0x31'))]['ValidationError'](_0x9a61('0x37')+_0x2249fe);}if(!_[_0x9a61('0x38')](_0x2249fe,_0x14b659[_0x9a61('0x24')][_0x9a61('0x36')])){throw new db[(_0x9a61('0x31'))][(_0x9a61('0x32'))](_0x9a61('0x39')+_0x2249fe);}_0x4776f9[_0x14b659[_0x9a61('0x24')][_0x9a61('0x36')]]=_0x14b659[_0x9a61('0x24')][_0x9a61('0x30')];})[_0x9a61('0x28')](function(){return db[_0x9a61('0x3a')][_0x9a61('0x3b')]({'where':{'id':_0x14b659[_0x9a61('0x3c')]['id']},'include':[{'model':db[_0x9a61('0x3d')],'as':'List','include':[{'model':db[_0x9a61('0x26')],'as':_0x9a61('0x3e'),'where':_0x4776f9,'limit':0x1,'order':[[_0x9a61('0x2d'),_0x9a61('0x3f')]]}]},{'model':db['FaxApplication'],'as':_0x9a61('0x40')}]});})[_0x9a61('0x28')](function(_0x315308){if(_0x315308&&_0x315308['List']){var _0x2e5e36=_0x315308['get']({'plain':!![]});_0x67b011[_0x9a61('0x3c')]=_0x2e5e36;_0x67b011['applications']=_0x2e5e36['Applications'];_0x67b011[_0x9a61('0x41')]=_0x2e5e36['List'];_0x67b011[_0x9a61('0x42')]=_['orderBy'](_0x67b011[_0x9a61('0x42')],[_0x9a61('0x43')],[_0x9a61('0x44')]);if(_0x67b011[_0x9a61('0x3c')][_0x9a61('0x40')]){delete _0x67b011[_0x9a61('0x3c')][_0x9a61('0x40')];}if(_0x67b011['account']['List']&&_0x67b011[_0x9a61('0x3c')][_0x9a61('0x45')][_0x9a61('0x3e')][_0x9a61('0x46')]){return _0x67b011[_0x9a61('0x3c')]['List'][_0x9a61('0x3e')][0x0];}var _0x59dbaf=_['defaults'](_0x14b659[_0x9a61('0x24')],{'firstName':_0x14b659[_0x9a61('0x24')][_0x9a61('0x30')],'ListId':_0x2e5e36[_0x9a61('0x2f')]});_0x59dbaf[_0x14b659[_0x9a61('0x24')][_0x9a61('0x36')]]=_0x14b659[_0x9a61('0x24')][_0x9a61('0x30')];return db[_0x9a61('0x26')][_0x9a61('0x47')](_0x59dbaf,{'fields':_0x54cb14,'raw':!![]});}})[_0x9a61('0x28')](function(_0x32aba8){_0x67b011[_0x9a61('0x48')]=_0x32aba8;if(_0x32aba8){var _0x390683={'ContactId':_0x32aba8['id'],'FaxAccountId':_0x14b659[_0x9a61('0x3c')]['id'],'fax':_0x32aba8[_0x9a61('0x25')]};return db[_0x9a61('0x49')][_0x9a61('0x3b')]({'where':{'ContactId':_0x32aba8['id'],'closed':![],'FaxAccountId':_0x14b659[_0x9a61('0x3c')]['id']}})[_0x9a61('0x28')](function(_0x2b5c1e){if(_0x2b5c1e){return[_0x2b5c1e,![]];}return db[_0x9a61('0x49')]['create'](_0x390683)[_0x9a61('0x28')](function(_0x57eb08){return[_0x57eb08,!![]];});});}else{throw new Error(_0x9a61('0x4a'));}})[_0x9a61('0x4b')](function(_0x4cd548,_0x1d91c3){var _0x33952f=_0x4cd548[_0x9a61('0x4c')]({'plain':!![]});if(_0x1d91c3){if(_0x67b011[_0x9a61('0x3c')][_0x9a61('0x4d')]){_0x67b011['applications']['push']({'id':0x0,'priority':_0x67b011[_0x9a61('0x42')][_0x9a61('0x46')]+0x1,'app':_0x9a61('0x4e'),'appdata':_0x9a61('0x4f'),'interval':_0x9a61('0x50')});}_0x33952f[_0x9a61('0x51')]=!![];}else{_0x33952f['created']=![];}_0x67b011[_0x9a61('0x52')]=_0x33952f;return db[_0x9a61('0x53')][_0x9a61('0x47')]({'body':_0x14b659[_0x9a61('0x24')][_0x9a61('0x24')],'FaxAccountId':_0x14b659[_0x9a61('0x3c')]['id'],'FaxInteractionId':_0x4cd548['id'],'direction':'in','ContactId':_0x4cd548[_0x9a61('0x54')],'AttachmentId':_0x14b659[_0x9a61('0x24')][_0x9a61('0x55')]});})[_0x9a61('0x28')](function(_0x4b7187){_0x67b011['message']=_0x4b7187;if(!_0x67b011[_0x9a61('0x52')][_0x9a61('0x56')])return;return db[_0x9a61('0x57')]['find']({'attributes':['id',_0x9a61('0x58')],'where':{'id':_0x67b011[_0x9a61('0x52')][_0x9a61('0x56')]}});})[_0x9a61('0x28')](function(_0xef09df){if(_0xef09df){_0x67b011[_0x9a61('0x42')][_0x9a61('0x59')]({'id':0x0,'priority':0x0,'app':_0x9a61('0x5a'),'appdata':_0xef09df['name']+','+(_0x67b011[_0x9a61('0x3c')]['waitForTheAssignedAgent']||0xa),'interval':'*,*,*,*'});}if(!_0x67b011['interaction'][_0x9a61('0x5b')])return;return db[_0x9a61('0x5c')][_0x9a61('0x3b')]({'attributes':['id','name'],'where':{'id':_0x67b011['interaction'][_0x9a61('0x5b')]}});})['then'](function(_0xf8467b){if(_0xf8467b){_0x67b011['applications'][_0x9a61('0x59')]({'id':0x0,'priority':0x1,'app':_0x9a61('0x5d'),'appdata':_0xf8467b[_0x9a61('0x58')]+','+(_0x67b011[_0x9a61('0x3c')][_0x9a61('0x5e')]||0x12c),'interval':_0x9a61('0x50')});}return respondWithRpcPromise('Start',_0x9a61('0x5f'),_0x67b011);})[_0x9a61('0x28')](function(_0x2714aa){_0x1eb5d8(_0x2714aa);})[_0x9a61('0x1a')](function(_0x5ae6db){_0x352d40(_0x3e14a4[_0x9a61('0x16')](0x1f4,_0x5ae6db['message']));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index 42908d6..4aa632b 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 _0x432e=['update','emit','removeListener','register','length','faxAccount:','./faxAccount.events','remove'];(function(_0x37adab,_0x5c7b4f){var _0x556455=function(_0x22d71d){while(--_0x22d71d){_0x37adab['push'](_0x37adab['shift']());}};_0x556455(++_0x5c7b4f);}(_0x432e,0x15e));var _0xe432=function(_0x12eadf,_0x5c0a6e){_0x12eadf=_0x12eadf-0x0;var _0x5341d7=_0x432e[_0x12eadf];return _0x5341d7;};'use strict';var FaxAccountEvents=require(_0xe432('0x0'));var events=['save',_0xe432('0x1'),_0xe432('0x2')];function createListener(_0x1fa6cb,_0x3efe60){return function(_0x1e0cd4){_0x3efe60[_0xe432('0x3')](_0x1fa6cb,_0x1e0cd4);};}function removeListener(_0xf2a3ba,_0xe46600){return function(){FaxAccountEvents[_0xe432('0x4')](_0xf2a3ba,_0xe46600);};}exports[_0xe432('0x5')]=function(_0xb62434){for(var _0xdc1893=0x0,_0x1dab07=events[_0xe432('0x6')];_0xdc1893<_0x1dab07;_0xdc1893++){var _0x510e10=events[_0xdc1893];var _0x20e453=createListener(_0xe432('0x7')+_0x510e10,_0xb62434);FaxAccountEvents['on'](_0x510e10,_0x20e453);}}; \ No newline at end of file +var _0xcdb9=['save','remove','emit','register','length','faxAccount:','./faxAccount.events'];(function(_0x52e625,_0x2cd946){var _0x292cc6=function(_0x1b889f){while(--_0x1b889f){_0x52e625['push'](_0x52e625['shift']());}};_0x292cc6(++_0x2cd946);}(_0xcdb9,0x187));var _0x9cdb=function(_0x2b396b,_0x23893f){_0x2b396b=_0x2b396b-0x0;var _0x216882=_0xcdb9[_0x2b396b];return _0x216882;};'use strict';var FaxAccountEvents=require(_0x9cdb('0x0'));var events=[_0x9cdb('0x1'),_0x9cdb('0x2'),'update'];function createListener(_0x5862d8,_0xba739b){return function(_0x1becec){_0xba739b[_0x9cdb('0x3')](_0x5862d8,_0x1becec);};}function removeListener(_0x2a89ba,_0x15f3cd){return function(){FaxAccountEvents['removeListener'](_0x2a89ba,_0x15f3cd);};}exports[_0x9cdb('0x4')]=function(_0x3fd30a){for(var _0x1af38=0x0,_0x3a53c1=events[_0x9cdb('0x5')];_0x1af38<_0x3a53c1;_0x1af38++){var _0x2aed6b=events[_0x1af38];var _0x28a3fe=createListener(_0x9cdb('0x6')+_0x2aed6b,_0x3fd30a);FaxAccountEvents['on'](_0x2aed6b,_0x28a3fe);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index 4d163a1..cff8bdf 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 _0xff8d=['/:id/applications','getApplications','/:id/messages','getMessages','/:id/users','getAgents','post','create','/:id/canned_answers','addAnswer','/:id/interactions','addInteraction','addApplications','addAccountApplications','updateAccountApplications','addAgents','put','update','destroy','delete','removeDispositions','removeAgents','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','get','index','/describe','/:id','isAuthenticated','show','/:id/dispositions','getDispositions','getAnswers','getInteractions'];(function(_0x4617f1,_0x3e0532){var _0x5887ac=function(_0x3a5ae3){while(--_0x3a5ae3){_0x4617f1['push'](_0x4617f1['shift']());}};_0x5887ac(++_0x3e0532);}(_0xff8d,0xdf));var _0xdff8=function(_0x5b066e,_0x40302e){_0x5b066e=_0x5b066e-0x0;var _0x2b8b06=_0xff8d[_0x5b066e];return _0x2b8b06;};'use strict';var multer=require(_0xdff8('0x0'));var util=require('util');var path=require(_0xdff8('0x1'));var timeout=require(_0xdff8('0x2'));var express=require(_0xdff8('0x3'));var router=express[_0xdff8('0x4')]();var fs_extra=require(_0xdff8('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xdff8('0x6'));var config=require('../../config/environment');var controller=require('./faxAccount.controller');router[_0xdff8('0x7')]('/',auth['isAuthenticated'](),controller[_0xdff8('0x8')]);router['get'](_0xdff8('0x9'),auth['isAuthenticated'](),controller['describe']);router[_0xdff8('0x7')](_0xdff8('0xa'),auth[_0xdff8('0xb')](),controller[_0xdff8('0xc')]);router[_0xdff8('0x7')](_0xdff8('0xd'),auth[_0xdff8('0xb')](),controller[_0xdff8('0xe')]);router[_0xdff8('0x7')]('/:id/canned_answers',auth[_0xdff8('0xb')](),controller[_0xdff8('0xf')]);router[_0xdff8('0x7')]('/:id/interactions',auth[_0xdff8('0xb')](),controller[_0xdff8('0x10')]);router['get'](_0xdff8('0x11'),auth[_0xdff8('0xb')](),controller[_0xdff8('0x12')]);router[_0xdff8('0x7')](_0xdff8('0x13'),auth[_0xdff8('0xb')](),controller[_0xdff8('0x14')]);router['get'](_0xdff8('0x15'),auth[_0xdff8('0xb')](),controller[_0xdff8('0x16')]);router[_0xdff8('0x17')]('/',auth['isAuthenticated'](),controller[_0xdff8('0x18')]);router[_0xdff8('0x17')](_0xdff8('0xd'),auth['isAuthenticated'](),controller['addDisposition']);router[_0xdff8('0x17')](_0xdff8('0x19'),auth[_0xdff8('0xb')](),controller[_0xdff8('0x1a')]);router[_0xdff8('0x17')](_0xdff8('0x1b'),auth[_0xdff8('0xb')](),controller[_0xdff8('0x1c')]);router['post'](_0xdff8('0x11'),auth[_0xdff8('0xb')](),controller[_0xdff8('0x1d')]);router[_0xdff8('0x17')]('/addaccountapplications',auth[_0xdff8('0xb')](),controller[_0xdff8('0x1e')]);router[_0xdff8('0x17')]('/updateaccountapplications',auth['isAuthenticated'](),controller[_0xdff8('0x1f')]);router[_0xdff8('0x17')]('/:id/send',auth[_0xdff8('0xb')](),controller['send']);router['post'](_0xdff8('0x15'),auth[_0xdff8('0xb')](),controller[_0xdff8('0x20')]);router[_0xdff8('0x21')](_0xdff8('0xa'),auth['isAuthenticated'](),controller[_0xdff8('0x22')]);router['delete'](_0xdff8('0xa'),auth['isAuthenticated'](),controller[_0xdff8('0x23')]);router[_0xdff8('0x24')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0xdff8('0x25')]);router['delete']('/:id/canned_answers',auth[_0xdff8('0xb')](),controller['removeAnswers']);router[_0xdff8('0x24')](_0xdff8('0x15'),auth[_0xdff8('0xb')](),controller[_0xdff8('0x26')]);module[_0xdff8('0x27')]=router; \ No newline at end of file +var _0x910e=['addAccountApplications','/updateaccountapplications','/:id/send','send','addAgents','put','delete','destroy','removeAnswers','removeAgents','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','index','/describe','isAuthenticated','describe','/:id','/:id/canned_answers','getAnswers','/:id/interactions','getInteractions','/:id/applications','/:id/messages','/:id/users','getAgents','post','create','/:id/dispositions','addDisposition','addInteraction','addApplications','/addaccountapplications'];(function(_0x168838,_0x8578cc){var _0x1e99a6=function(_0x17aef4){while(--_0x17aef4){_0x168838['push'](_0x168838['shift']());}};_0x1e99a6(++_0x8578cc);}(_0x910e,0x153));var _0xe910=function(_0x5df42b,_0x339de9){_0x5df42b=_0x5df42b-0x0;var _0x5ca67c=_0x910e[_0x5df42b];return _0x5ca67c;};'use strict';var multer=require(_0xe910('0x0'));var util=require(_0xe910('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xe910('0x2'));var router=express[_0xe910('0x3')]();var fs_extra=require(_0xe910('0x4'));var auth=require(_0xe910('0x5'));var interaction=require(_0xe910('0x6'));var config=require(_0xe910('0x7'));var controller=require(_0xe910('0x8'));router[_0xe910('0x9')]('/',auth['isAuthenticated'](),controller[_0xe910('0xa')]);router[_0xe910('0x9')](_0xe910('0xb'),auth[_0xe910('0xc')](),controller[_0xe910('0xd')]);router['get'](_0xe910('0xe'),auth[_0xe910('0xc')](),controller['show']);router['get']('/:id/dispositions',auth['isAuthenticated'](),controller['getDispositions']);router[_0xe910('0x9')](_0xe910('0xf'),auth[_0xe910('0xc')](),controller[_0xe910('0x10')]);router[_0xe910('0x9')](_0xe910('0x11'),auth['isAuthenticated'](),controller[_0xe910('0x12')]);router[_0xe910('0x9')](_0xe910('0x13'),auth[_0xe910('0xc')](),controller['getApplications']);router['get'](_0xe910('0x14'),auth['isAuthenticated'](),controller['getMessages']);router['get'](_0xe910('0x15'),auth[_0xe910('0xc')](),controller[_0xe910('0x16')]);router[_0xe910('0x17')]('/',auth[_0xe910('0xc')](),controller[_0xe910('0x18')]);router[_0xe910('0x17')](_0xe910('0x19'),auth[_0xe910('0xc')](),controller[_0xe910('0x1a')]);router[_0xe910('0x17')](_0xe910('0xf'),auth[_0xe910('0xc')](),controller['addAnswer']);router[_0xe910('0x17')](_0xe910('0x11'),auth[_0xe910('0xc')](),controller[_0xe910('0x1b')]);router[_0xe910('0x17')](_0xe910('0x13'),auth['isAuthenticated'](),controller[_0xe910('0x1c')]);router['post'](_0xe910('0x1d'),auth[_0xe910('0xc')](),controller[_0xe910('0x1e')]);router['post'](_0xe910('0x1f'),auth[_0xe910('0xc')](),controller['updateAccountApplications']);router[_0xe910('0x17')](_0xe910('0x20'),auth[_0xe910('0xc')](),controller[_0xe910('0x21')]);router[_0xe910('0x17')](_0xe910('0x15'),auth[_0xe910('0xc')](),controller[_0xe910('0x22')]);router[_0xe910('0x23')]('/:id',auth[_0xe910('0xc')](),controller['update']);router[_0xe910('0x24')]('/:id',auth['isAuthenticated'](),controller[_0xe910('0x25')]);router[_0xe910('0x24')](_0xe910('0x19'),auth[_0xe910('0xc')](),controller['removeDispositions']);router[_0xe910('0x24')](_0xe910('0xf'),auth[_0xe910('0xc')](),controller[_0xe910('0x26')]);router[_0xe910('0x24')](_0xe910('0x15'),auth[_0xe910('0xc')](),controller[_0xe910('0x27')]);module[_0xe910('0x28')]=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index f4b9c9e..a579b29 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 _0xfc37=['STRING','TEXT','*,*,*,*','sequelize','exports','INTEGER'];(function(_0x5909d0,_0x956e7e){var _0x2d5240=function(_0x39f7a3){while(--_0x39f7a3){_0x5909d0['push'](_0x5909d0['shift']());}};_0x2d5240(++_0x956e7e);}(_0xfc37,0x17d));var _0x7fc3=function(_0x20ce34,_0x22684f){_0x20ce34=_0x20ce34-0x0;var _0x45054d=_0xfc37[_0x20ce34];return _0x45054d;};'use strict';var Sequelize=require(_0x7fc3('0x0'));module[_0x7fc3('0x1')]={'priority':{'type':Sequelize[_0x7fc3('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x7fc3('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x7fc3('0x4')]()},'description':{'type':Sequelize[_0x7fc3('0x3')]},'interval':{'type':Sequelize[_0x7fc3('0x3')],'defaultValue':_0x7fc3('0x5')}}; \ No newline at end of file +var _0x65a7=['sequelize','exports','INTEGER','STRING','noop','TEXT','*,*,*,*'];(function(_0x3f9525,_0x3e9141){var _0x4147b0=function(_0x54f3b4){while(--_0x54f3b4){_0x3f9525['push'](_0x3f9525['shift']());}};_0x4147b0(++_0x3e9141);}(_0x65a7,0x1b9));var _0x765a=function(_0x363f4a,_0x13ea34){_0x363f4a=_0x363f4a-0x0;var _0x406092=_0x65a7[_0x363f4a];return _0x406092;};'use strict';var Sequelize=require(_0x765a('0x0'));module[_0x765a('0x1')]={'priority':{'type':Sequelize[_0x765a('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x765a('0x3')],'allowNull':![],'defaultValue':_0x765a('0x4')},'appdata':{'type':Sequelize[_0x765a('0x5')]()},'description':{'type':Sequelize[_0x765a('0x3')]},'interval':{'type':Sequelize[_0x765a('0x3')],'defaultValue':_0x765a('0x6')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index ddd9356..d5c8621 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 _0x630e=['eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','fs-extra','lodash','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','end','stack','name','send','FaxApplication','rawAttributes','model','map','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','params','keys','length','find','catch','body'];(function(_0x5c9dc1,_0x39a1c2){var _0x4f3b1b=function(_0x11764f){while(--_0x11764f){_0x5c9dc1['push'](_0x5c9dc1['shift']());}};_0x4f3b1b(++_0x39a1c2);}(_0x630e,0x192));var _0xe630=function(_0x993a35,_0x42510b){_0x993a35=_0x993a35-0x0;var _0x3e00f2=_0x630e[_0x993a35];return _0x3e00f2;};'use strict';var emlformat=require(_0xe630('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe630('0x1'));var jsonpatch=require(_0xe630('0x2'));var rp=require(_0xe630('0x3'));var moment=require(_0xe630('0x4'));var BPromise=require(_0xe630('0x5'));var Mustache=require('mustache');var util=require(_0xe630('0x6'));var path=require('path');var sox=require(_0xe630('0x7'));var csv=require(_0xe630('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe630('0x9'));var _=require(_0xe630('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xe630('0xb'));var authService=require(_0xe630('0xc'));var qs=require(_0xe630('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe630('0xe'));var logger=require(_0xe630('0xf'))(_0xe630('0x10'));var utils=require(_0xe630('0x11'));var config=require(_0xe630('0x12'));var licenseUtil=require(_0xe630('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x46d6d7,_0x418bbe){_0x418bbe=_0x418bbe||0xcc;return function(_0x4039ed){if(_0x4039ed){return _0x46d6d7[_0xe630('0x14')](_0x418bbe);}return _0x46d6d7[_0xe630('0x15')](_0x418bbe)['end']();};}function respondWithResult(_0x1dd3a0,_0x574956){_0x574956=_0x574956||0xc8;return function(_0x42ab76){if(_0x42ab76){return _0x1dd3a0[_0xe630('0x15')](_0x574956)[_0xe630('0x16')](_0x42ab76);}};}function respondWithFilteredResult(_0x1f4b02,_0x17319f){return function(_0x1261fa){if(_0x1261fa){var _0x1cb91f=typeof _0x17319f[_0xe630('0x17')]===_0xe630('0x18')&&typeof _0x17319f[_0xe630('0x19')]===_0xe630('0x18');var _0x39895d=_0x1261fa[_0xe630('0x1a')];var _0x3514ab=_0x1cb91f?0x0:_0x17319f[_0xe630('0x17')];var _0x28671d=_0x1cb91f?_0x1261fa[_0xe630('0x1a')]:_0x17319f[_0xe630('0x17')]+_0x17319f[_0xe630('0x19')];var _0x5039b1;if(_0x28671d>=_0x39895d){_0x28671d=_0x39895d;_0x5039b1=0xc8;}else{_0x5039b1=0xce;}_0x1f4b02[_0xe630('0x15')](_0x5039b1);return _0x1f4b02[_0xe630('0x1b')](_0xe630('0x1c'),_0x3514ab+'-'+_0x28671d+'/'+_0x39895d)[_0xe630('0x16')](_0x1261fa);}return null;};}function patchUpdates(_0x2c5da8){return function(_0x239a4a){try{jsonpatch[_0xe630('0x1d')](_0x239a4a,_0x2c5da8,!![]);}catch(_0x399a57){return BPromise[_0xe630('0x1e')](_0x399a57);}return _0x239a4a[_0xe630('0x1f')]();};}function saveUpdates(_0x3d318c,_0x5d0c9c){return function(_0x2043c3){if(_0x2043c3){return _0x2043c3[_0xe630('0x20')](_0x3d318c)[_0xe630('0x21')](function(_0xdaedf0){return _0xdaedf0;});}return null;};}function removeEntity(_0x38fa38,_0x135923){return function(_0x18225e){if(_0x18225e){return _0x18225e['destroy']()['then'](function(){_0x38fa38[_0xe630('0x15')](0xcc)[_0xe630('0x22')]();});}};}function handleEntityNotFound(_0x43950f,_0x268774){return function(_0x1e0041){if(!_0x1e0041){_0x43950f['sendStatus'](0x194);}return _0x1e0041;};}function handleError(_0xee14b9,_0x2197fc){_0x2197fc=_0x2197fc||0x1f4;return function(_0x27f529){logger['error'](_0x27f529[_0xe630('0x23')]);if(_0x27f529[_0xe630('0x24')]){delete _0x27f529['name'];}_0xee14b9[_0xe630('0x15')](_0x2197fc)[_0xe630('0x25')](_0x27f529);};}exports['index']=function(_0x4304c6,_0x1ab668){var _0xb8ce59={},_0xc98061={},_0xcf44b8={'count':0x0,'rows':[]};var _0x4fcd15=_['map'](db[_0xe630('0x26')][_0xe630('0x27')],function(_0x5dc578){return{'name':_0x5dc578['fieldName'],'type':_0x5dc578['type']['key']};});_0xc98061[_0xe630('0x28')]=_[_0xe630('0x29')](_0x4fcd15,'name');_0xc98061[_0xe630('0x2a')]=_['keys'](_0x4304c6[_0xe630('0x2a')]);_0xc98061[_0xe630('0x2b')]=_[_0xe630('0x2c')](_0xc98061[_0xe630('0x28')],_0xc98061[_0xe630('0x2a')]);_0xb8ce59['attributes']=_[_0xe630('0x2c')](_0xc98061['model'],qs[_0xe630('0x2d')](_0x4304c6['query'][_0xe630('0x2d')]));_0xb8ce59[_0xe630('0x2e')]=_0xb8ce59[_0xe630('0x2e')]['length']?_0xb8ce59[_0xe630('0x2e')]:_0xc98061['model'];if(!_0x4304c6[_0xe630('0x2a')][_0xe630('0x2f')](_0xe630('0x30'))){_0xb8ce59[_0xe630('0x19')]=qs[_0xe630('0x19')](_0x4304c6[_0xe630('0x2a')][_0xe630('0x19')]);_0xb8ce59['offset']=qs[_0xe630('0x17')](_0x4304c6[_0xe630('0x2a')][_0xe630('0x17')]);}_0xb8ce59[_0xe630('0x31')]=qs[_0xe630('0x32')](_0x4304c6[_0xe630('0x2a')][_0xe630('0x32')]);_0xb8ce59[_0xe630('0x33')]=qs['filters'](_[_0xe630('0x34')](_0x4304c6[_0xe630('0x2a')],_0xc98061['filters']),_0x4fcd15);if(_0x4304c6[_0xe630('0x2a')][_0xe630('0x35')]){_0xb8ce59[_0xe630('0x33')]=_[_0xe630('0x36')](_0xb8ce59[_0xe630('0x33')],{'$or':_['map'](_0x4fcd15,function(_0x47001d){if(_0x47001d[_0xe630('0x37')]!==_0xe630('0x38')){var _0x5b9e93={};_0x5b9e93[_0x47001d['name']]={'$like':'%'+_0x4304c6[_0xe630('0x2a')][_0xe630('0x35')]+'%'};return _0x5b9e93;}})});}_0xb8ce59=_[_0xe630('0x36')]({},_0xb8ce59,_0x4304c6['options']);var _0x3160c3={'where':_0xb8ce59[_0xe630('0x33')]};return db[_0xe630('0x26')][_0xe630('0x1a')](_0x3160c3)[_0xe630('0x21')](function(_0x52d376){_0xcf44b8[_0xe630('0x1a')]=_0x52d376;if(_0x4304c6[_0xe630('0x2a')][_0xe630('0x39')]){_0xb8ce59[_0xe630('0x3a')]=[{'all':!![]}];}return db[_0xe630('0x26')][_0xe630('0x3b')](_0xb8ce59);})[_0xe630('0x21')](function(_0x10bd44){_0xcf44b8[_0xe630('0x3c')]=_0x10bd44;return _0xcf44b8;})['then'](respondWithFilteredResult(_0x1ab668,_0xb8ce59))['catch'](handleError(_0x1ab668,null));};exports['show']=function(_0x41d59d,_0x291977){var _0x13630e={'raw':!![],'where':{'id':_0x41d59d[_0xe630('0x3d')]['id']}},_0x5c313a={};_0x5c313a['model']=_[_0xe630('0x3e')](db[_0xe630('0x26')][_0xe630('0x27')]);_0x5c313a[_0xe630('0x2a')]=_[_0xe630('0x3e')](_0x41d59d[_0xe630('0x2a')]);_0x5c313a[_0xe630('0x2b')]=_[_0xe630('0x2c')](_0x5c313a['model'],_0x5c313a['query']);_0x13630e[_0xe630('0x2e')]=_[_0xe630('0x2c')](_0x5c313a[_0xe630('0x28')],qs[_0xe630('0x2d')](_0x41d59d[_0xe630('0x2a')]['fields']));_0x13630e[_0xe630('0x2e')]=_0x13630e[_0xe630('0x2e')][_0xe630('0x3f')]?_0x13630e[_0xe630('0x2e')]:_0x5c313a[_0xe630('0x28')];if(_0x41d59d[_0xe630('0x2a')]['includeAll']){_0x13630e[_0xe630('0x3a')]=[{'all':!![]}];}_0x13630e=_[_0xe630('0x36')]({},_0x13630e,_0x41d59d['options']);return db['FaxApplication'][_0xe630('0x40')](_0x13630e)[_0xe630('0x21')](handleEntityNotFound(_0x291977,null))[_0xe630('0x21')](respondWithResult(_0x291977,null))[_0xe630('0x41')](handleError(_0x291977,null));};exports['create']=function(_0x4c4596,_0x496a27){return db['FaxApplication']['create'](_0x4c4596[_0xe630('0x42')],{})[_0xe630('0x21')](respondWithResult(_0x496a27,0xc9))[_0xe630('0x41')](handleError(_0x496a27,null));};exports['update']=function(_0x48023f,_0x3fb832){if(_0x48023f[_0xe630('0x42')]['id']){delete _0x48023f[_0xe630('0x42')]['id'];}return db[_0xe630('0x26')][_0xe630('0x40')]({'where':{'id':_0x48023f['params']['id']}})[_0xe630('0x21')](handleEntityNotFound(_0x3fb832,null))[_0xe630('0x21')](saveUpdates(_0x48023f[_0xe630('0x42')],null))['then'](respondWithResult(_0x3fb832,null))[_0xe630('0x41')](handleError(_0x3fb832,null));};exports['destroy']=function(_0x3f26d6,_0x209008){return db[_0xe630('0x26')][_0xe630('0x40')]({'where':{'id':_0x3f26d6[_0xe630('0x3d')]['id']}})[_0xe630('0x21')](handleEntityNotFound(_0x209008,null))[_0xe630('0x21')](removeEntity(_0x209008,null))[_0xe630('0x41')](handleError(_0x209008,null));}; \ No newline at end of file +var _0x59ea=['query','filters','model','attributes','fields','length','nolimit','sort','where','pick','filter','merge','options','then','includeAll','rows','catch','show','params','intersection','include','find','create','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','error','name','send','index','map','FaxApplication','rawAttributes','fieldName','type','keys'];(function(_0xe0b79f,_0x4a0eed){var _0x1cec9b=function(_0x5dab21){while(--_0x5dab21){_0xe0b79f['push'](_0xe0b79f['shift']());}};_0x1cec9b(++_0x4a0eed);}(_0x59ea,0x18f));var _0xa59e=function(_0x53c90c,_0x4d6510){_0x53c90c=_0x53c90c-0x0;var _0x2f91d3=_0x59ea[_0x53c90c];return _0x2f91d3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa59e('0x0'));var zipdir=require(_0xa59e('0x1'));var jsonpatch=require(_0xa59e('0x2'));var rp=require(_0xa59e('0x3'));var moment=require(_0xa59e('0x4'));var BPromise=require(_0xa59e('0x5'));var Mustache=require('mustache');var util=require(_0xa59e('0x6'));var path=require(_0xa59e('0x7'));var sox=require('sox');var csv=require(_0xa59e('0x8'));var ejs=require(_0xa59e('0x9'));var fs=require('fs');var fs_extra=require(_0xa59e('0xa'));var _=require(_0xa59e('0xb'));var squel=require(_0xa59e('0xc'));var crypto=require(_0xa59e('0xd'));var jsforce=require(_0xa59e('0xe'));var deskjs=require(_0xa59e('0xf'));var toCsv=require('to-csv');var querystring=require(_0xa59e('0x10'));var Papa=require(_0xa59e('0x11'));var Redis=require(_0xa59e('0x12'));var authService=require(_0xa59e('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xa59e('0x14'));var hardwareService=require(_0xa59e('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0xa59e('0x16'));var config=require(_0xa59e('0x17'));var licenseUtil=require(_0xa59e('0x18'));var db=require(_0xa59e('0x19'))['db'];function respondWithStatusCode(_0x2b5c83,_0x1d6f56){_0x1d6f56=_0x1d6f56||0xcc;return function(_0x26b4c6){if(_0x26b4c6){return _0x2b5c83[_0xa59e('0x1a')](_0x1d6f56);}return _0x2b5c83[_0xa59e('0x1b')](_0x1d6f56)[_0xa59e('0x1c')]();};}function respondWithResult(_0x2c8e7a,_0x51621a){_0x51621a=_0x51621a||0xc8;return function(_0x189e1e){if(_0x189e1e){return _0x2c8e7a['status'](_0x51621a)[_0xa59e('0x1d')](_0x189e1e);}};}function respondWithFilteredResult(_0x1cde56,_0x555f21){return function(_0x1d252b){if(_0x1d252b){var _0x266a89=typeof _0x555f21[_0xa59e('0x1e')]===_0xa59e('0x1f')&&typeof _0x555f21[_0xa59e('0x20')]===_0xa59e('0x1f');var _0x421ea9=_0x1d252b[_0xa59e('0x21')];var _0x5bd6ff=_0x266a89?0x0:_0x555f21[_0xa59e('0x1e')];var _0x20f9a6=_0x266a89?_0x1d252b[_0xa59e('0x21')]:_0x555f21[_0xa59e('0x1e')]+_0x555f21[_0xa59e('0x20')];var _0x13d259;if(_0x20f9a6>=_0x421ea9){_0x20f9a6=_0x421ea9;_0x13d259=0xc8;}else{_0x13d259=0xce;}_0x1cde56[_0xa59e('0x1b')](_0x13d259);return _0x1cde56[_0xa59e('0x22')](_0xa59e('0x23'),_0x5bd6ff+'-'+_0x20f9a6+'/'+_0x421ea9)[_0xa59e('0x1d')](_0x1d252b);}return null;};}function patchUpdates(_0x544e6c){return function(_0xdfcb1c){try{jsonpatch[_0xa59e('0x24')](_0xdfcb1c,_0x544e6c,!![]);}catch(_0x3f7b58){return BPromise[_0xa59e('0x25')](_0x3f7b58);}return _0xdfcb1c[_0xa59e('0x26')]();};}function saveUpdates(_0x43b4a7,_0x17746f){return function(_0xbb793d){if(_0xbb793d){return _0xbb793d[_0xa59e('0x27')](_0x43b4a7)['then'](function(_0x51f9b9){return _0x51f9b9;});}return null;};}function removeEntity(_0x8ff583,_0x1419de){return function(_0x3b60fd){if(_0x3b60fd){return _0x3b60fd[_0xa59e('0x28')]()['then'](function(){_0x8ff583[_0xa59e('0x1b')](0xcc)[_0xa59e('0x1c')]();});}};}function handleEntityNotFound(_0x5c9465,_0x15111d){return function(_0x1cf604){if(!_0x1cf604){_0x5c9465[_0xa59e('0x1a')](0x194);}return _0x1cf604;};}function handleError(_0x378618,_0x124f2f){_0x124f2f=_0x124f2f||0x1f4;return function(_0x12d355){logger[_0xa59e('0x29')](_0x12d355['stack']);if(_0x12d355['name']){delete _0x12d355[_0xa59e('0x2a')];}_0x378618[_0xa59e('0x1b')](_0x124f2f)[_0xa59e('0x2b')](_0x12d355);};}exports[_0xa59e('0x2c')]=function(_0x2ebdd9,_0x1d24e4){var _0x4192b8={},_0x13e2e3={},_0x1edf8e={'count':0x0,'rows':[]};var _0x4706e0=_[_0xa59e('0x2d')](db[_0xa59e('0x2e')][_0xa59e('0x2f')],function(_0xf258e7){return{'name':_0xf258e7[_0xa59e('0x30')],'type':_0xf258e7[_0xa59e('0x31')]['key']};});_0x13e2e3['model']=_[_0xa59e('0x2d')](_0x4706e0,_0xa59e('0x2a'));_0x13e2e3['query']=_[_0xa59e('0x32')](_0x2ebdd9[_0xa59e('0x33')]);_0x13e2e3[_0xa59e('0x34')]=_['intersection'](_0x13e2e3[_0xa59e('0x35')],_0x13e2e3[_0xa59e('0x33')]);_0x4192b8[_0xa59e('0x36')]=_['intersection'](_0x13e2e3[_0xa59e('0x35')],qs['fields'](_0x2ebdd9[_0xa59e('0x33')][_0xa59e('0x37')]));_0x4192b8[_0xa59e('0x36')]=_0x4192b8[_0xa59e('0x36')][_0xa59e('0x38')]?_0x4192b8[_0xa59e('0x36')]:_0x13e2e3['model'];if(!_0x2ebdd9['query']['hasOwnProperty'](_0xa59e('0x39'))){_0x4192b8['limit']=qs[_0xa59e('0x20')](_0x2ebdd9[_0xa59e('0x33')][_0xa59e('0x20')]);_0x4192b8['offset']=qs[_0xa59e('0x1e')](_0x2ebdd9[_0xa59e('0x33')][_0xa59e('0x1e')]);}_0x4192b8['order']=qs[_0xa59e('0x3a')](_0x2ebdd9[_0xa59e('0x33')][_0xa59e('0x3a')]);_0x4192b8[_0xa59e('0x3b')]=qs[_0xa59e('0x34')](_[_0xa59e('0x3c')](_0x2ebdd9[_0xa59e('0x33')],_0x13e2e3[_0xa59e('0x34')]),_0x4706e0);if(_0x2ebdd9[_0xa59e('0x33')][_0xa59e('0x3d')]){_0x4192b8[_0xa59e('0x3b')]=_['merge'](_0x4192b8[_0xa59e('0x3b')],{'$or':_[_0xa59e('0x2d')](_0x4706e0,function(_0x49185b){if(_0x49185b[_0xa59e('0x31')]!=='VIRTUAL'){var _0x2f9f8b={};_0x2f9f8b[_0x49185b[_0xa59e('0x2a')]]={'$like':'%'+_0x2ebdd9[_0xa59e('0x33')][_0xa59e('0x3d')]+'%'};return _0x2f9f8b;}})});}_0x4192b8=_[_0xa59e('0x3e')]({},_0x4192b8,_0x2ebdd9[_0xa59e('0x3f')]);var _0xbd14c={'where':_0x4192b8[_0xa59e('0x3b')]};return db[_0xa59e('0x2e')][_0xa59e('0x21')](_0xbd14c)[_0xa59e('0x40')](function(_0xd29175){_0x1edf8e['count']=_0xd29175;if(_0x2ebdd9[_0xa59e('0x33')][_0xa59e('0x41')]){_0x4192b8['include']=[{'all':!![]}];}return db[_0xa59e('0x2e')]['findAll'](_0x4192b8);})[_0xa59e('0x40')](function(_0x26a453){_0x1edf8e[_0xa59e('0x42')]=_0x26a453;return _0x1edf8e;})[_0xa59e('0x40')](respondWithFilteredResult(_0x1d24e4,_0x4192b8))[_0xa59e('0x43')](handleError(_0x1d24e4,null));};exports[_0xa59e('0x44')]=function(_0x3f1722,_0x347132){var _0x55e9cf={'raw':!![],'where':{'id':_0x3f1722[_0xa59e('0x45')]['id']}},_0x3925bb={};_0x3925bb[_0xa59e('0x35')]=_['keys'](db['FaxApplication'][_0xa59e('0x2f')]);_0x3925bb['query']=_[_0xa59e('0x32')](_0x3f1722[_0xa59e('0x33')]);_0x3925bb[_0xa59e('0x34')]=_[_0xa59e('0x46')](_0x3925bb[_0xa59e('0x35')],_0x3925bb[_0xa59e('0x33')]);_0x55e9cf[_0xa59e('0x36')]=_[_0xa59e('0x46')](_0x3925bb[_0xa59e('0x35')],qs[_0xa59e('0x37')](_0x3f1722[_0xa59e('0x33')][_0xa59e('0x37')]));_0x55e9cf['attributes']=_0x55e9cf[_0xa59e('0x36')][_0xa59e('0x38')]?_0x55e9cf['attributes']:_0x3925bb['model'];if(_0x3f1722[_0xa59e('0x33')][_0xa59e('0x41')]){_0x55e9cf[_0xa59e('0x47')]=[{'all':!![]}];}_0x55e9cf=_['merge']({},_0x55e9cf,_0x3f1722[_0xa59e('0x3f')]);return db[_0xa59e('0x2e')][_0xa59e('0x48')](_0x55e9cf)[_0xa59e('0x40')](handleEntityNotFound(_0x347132,null))[_0xa59e('0x40')](respondWithResult(_0x347132,null))[_0xa59e('0x43')](handleError(_0x347132,null));};exports['create']=function(_0x46245d,_0xc91b44){return db['FaxApplication'][_0xa59e('0x49')](_0x46245d[_0xa59e('0x4a')],{})[_0xa59e('0x40')](respondWithResult(_0xc91b44,0xc9))[_0xa59e('0x43')](handleError(_0xc91b44,null));};exports['update']=function(_0x28de58,_0x3ec260){if(_0x28de58[_0xa59e('0x4a')]['id']){delete _0x28de58[_0xa59e('0x4a')]['id'];}return db[_0xa59e('0x2e')][_0xa59e('0x48')]({'where':{'id':_0x28de58[_0xa59e('0x45')]['id']}})[_0xa59e('0x40')](handleEntityNotFound(_0x3ec260,null))['then'](saveUpdates(_0x28de58[_0xa59e('0x4a')],null))['then'](respondWithResult(_0x3ec260,null))[_0xa59e('0x43')](handleError(_0x3ec260,null));};exports[_0xa59e('0x28')]=function(_0x34bb34,_0x2b38a7){return db[_0xa59e('0x2e')][_0xa59e('0x48')]({'where':{'id':_0x34bb34[_0xa59e('0x45')]['id']}})[_0xa59e('0x40')](handleEntityNotFound(_0x2b38a7,null))[_0xa59e('0x40')](removeEntity(_0x2b38a7,null))[_0xa59e('0x43')](handleError(_0x2b38a7,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index e7e890a..e5a56b4 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 _0x3c37=['bluebird','request-promise','path','../../config/environment','./faxApplication.attributes','define','FaxApplication','utf8mb4','lodash','util','../../config/logger','api','moment'];(function(_0x220f3f,_0x11c540){var _0x1f170e=function(_0x2c0ec9){while(--_0x2c0ec9){_0x220f3f['push'](_0x220f3f['shift']());}};_0x1f170e(++_0x11c540);}(_0x3c37,0xff));var _0x73c3=function(_0x230b63,_0x4f28c2){_0x230b63=_0x230b63-0x0;var _0x29306e=_0x3c37[_0x230b63];return _0x29306e;};'use strict';var _=require(_0x73c3('0x0'));var util=require(_0x73c3('0x1'));var logger=require(_0x73c3('0x2'))(_0x73c3('0x3'));var moment=require(_0x73c3('0x4'));var BPromise=require(_0x73c3('0x5'));var rp=require(_0x73c3('0x6'));var fs=require('fs');var path=require(_0x73c3('0x7'));var rimraf=require('rimraf');var config=require(_0x73c3('0x8'));var attributes=require(_0x73c3('0x9'));module['exports']=function(_0x268c2b,_0x1db5e9){return _0x268c2b[_0x73c3('0xa')](_0x73c3('0xb'),attributes,{'tableName':'fax_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x73c3('0xc'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x772d=['fax_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxApplication.attributes','exports','define','FaxApplication'];(function(_0x3ff2be,_0x1f69f6){var _0x2a69c6=function(_0xe55b29){while(--_0xe55b29){_0x3ff2be['push'](_0x3ff2be['shift']());}};_0x2a69c6(++_0x1f69f6);}(_0x772d,0xad));var _0xd772=function(_0x7371d,_0x5d145a){_0x7371d=_0x7371d-0x0;var _0x238e70=_0x772d[_0x7371d];return _0x238e70;};'use strict';var _=require(_0xd772('0x0'));var util=require(_0xd772('0x1'));var logger=require(_0xd772('0x2'))(_0xd772('0x3'));var moment=require(_0xd772('0x4'));var BPromise=require(_0xd772('0x5'));var rp=require(_0xd772('0x6'));var fs=require('fs');var path=require(_0xd772('0x7'));var rimraf=require(_0xd772('0x8'));var config=require(_0xd772('0x9'));var attributes=require(_0xd772('0xa'));module[_0xd772('0xb')]=function(_0xc486c6,_0x25786f){return _0xc486c6[_0xd772('0xc')](_0xd772('0xd'),attributes,{'tableName':_0xd772('0xe'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xd772('0xf'),'collate':_0xd772('0x10')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index b696081..d392839 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 _0xaa7d=['request\x20sent','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateFaxApplication','options','raw','where','attributes','limit','then','lodash','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','FaxApplication,\x20%s,\x20%s'];(function(_0x2a4e81,_0x74636f){var _0x38807c=function(_0x4c08fd){while(--_0x4c08fd){_0x2a4e81['push'](_0x2a4e81['shift']());}};_0x38807c(++_0x74636f);}(_0xaa7d,0x1ea));var _0xdaa7=function(_0xcfeff4,_0x3f2e19){_0xcfeff4=_0xcfeff4-0x0;var _0xb2fadc=_0xaa7d[_0xcfeff4];return _0xb2fadc;};'use strict';var _=require(_0xdaa7('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xdaa7('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdaa7('0x2'))['db'];var utils=require(_0xdaa7('0x3'));var logger=require(_0xdaa7('0x4'))(_0xdaa7('0x5'));var config=require(_0xdaa7('0x6'));var jayson=require(_0xdaa7('0x7'));var client=jayson['client'][_0xdaa7('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x995170,_0x478a70,_0x45f435){return new BPromise(function(_0x324e0b,_0x2eb2e2){return client['request'](_0x995170,_0x45f435)['then'](function(_0x5f3364){logger['info'](_0xdaa7('0x9'),_0x478a70,_0xdaa7('0xa'));logger['debug'](_0xdaa7('0xb'),_0x478a70,'request\x20sent',JSON[_0xdaa7('0xc')](_0x5f3364));if(_0x5f3364[_0xdaa7('0xd')]){if(_0x5f3364[_0xdaa7('0xd')][_0xdaa7('0xe')]===0x1f4){logger[_0xdaa7('0xd')](_0xdaa7('0x9'),_0x478a70,_0x5f3364[_0xdaa7('0xd')]['message']);return _0x2eb2e2(_0x5f3364[_0xdaa7('0xd')][_0xdaa7('0xf')]);}logger[_0xdaa7('0xd')](_0xdaa7('0x9'),_0x478a70,_0x5f3364[_0xdaa7('0xd')]['message']);return _0x324e0b(_0x5f3364[_0xdaa7('0xd')][_0xdaa7('0xf')]);}else{logger['info'](_0xdaa7('0x9'),_0x478a70,_0xdaa7('0xa'));_0x324e0b(_0x5f3364[_0xdaa7('0x10')][_0xdaa7('0xf')]);}})[_0xdaa7('0x11')](function(_0x5ddfb6){logger['error']('FaxApplication,\x20%s,\x20%s',_0x478a70,_0x5ddfb6);_0x2eb2e2(_0x5ddfb6);});});}exports[_0xdaa7('0x12')]=function(_0x34a89e){var _0x36d92c=this;return new Promise(function(_0x5d0027,_0x1c7368){return db['FaxApplication']['update'](_0x34a89e['body'],{'raw':_0x34a89e[_0xdaa7('0x13')]?_0x34a89e['options'][_0xdaa7('0x14')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x34a89e[_0xdaa7('0x13')]?_0x34a89e['options'][_0xdaa7('0x15')]||null:null,'attributes':_0x34a89e['options']?_0x34a89e[_0xdaa7('0x13')][_0xdaa7('0x16')]||null:null,'limit':_0x34a89e['options']?_0x34a89e['options'][_0xdaa7('0x17')]||null:null})[_0xdaa7('0x18')](function(_0x43362e){logger['info'](_0xdaa7('0x12'),_0x34a89e);logger['debug'](_0xdaa7('0x12'),_0x34a89e,JSON[_0xdaa7('0xc')](_0x43362e));_0x5d0027(_0x43362e);})[_0xdaa7('0x11')](function(_0x1f0ff1){logger[_0xdaa7('0xd')](_0xdaa7('0x12'),_0x1f0ff1['message'],_0x34a89e);_0x1c7368(_0x36d92c[_0xdaa7('0xd')](0x1f4,_0x1f0ff1[_0xdaa7('0xf')]));});});}; \ No newline at end of file +var _0xb4c9=['../../config/environment','jayson/promise','client','http','request','info','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','result','UpdateFaxApplication','FaxApplication','update','options','raw','where','limit','then','catch','util','randomstring','../../config/utils','../../config/logger','rpc'];(function(_0x4f16bd,_0x612751){var _0x3db72d=function(_0x748095){while(--_0x748095){_0x4f16bd['push'](_0x4f16bd['shift']());}};_0x3db72d(++_0x612751);}(_0xb4c9,0xbf));var _0x9b4c=function(_0x5d1fd9,_0xa96940){_0x5d1fd9=_0x5d1fd9-0x0;var _0x235123=_0xb4c9[_0x5d1fd9];return _0x235123;};'use strict';var _=require('lodash');var util=require(_0x9b4c('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x9b4c('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x9b4c('0x2'));var logger=require(_0x9b4c('0x3'))(_0x9b4c('0x4'));var config=require(_0x9b4c('0x5'));var jayson=require(_0x9b4c('0x6'));var client=jayson[_0x9b4c('0x7')][_0x9b4c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1dcc08,_0xb71696,_0x1e427d){return new BPromise(function(_0x24787c,_0x824e5b){return client[_0x9b4c('0x9')](_0x1dcc08,_0x1e427d)['then'](function(_0x1d7ee7){logger[_0x9b4c('0xa')](_0x9b4c('0xb'),_0xb71696,_0x9b4c('0xc'));logger[_0x9b4c('0xd')](_0x9b4c('0xe'),_0xb71696,_0x9b4c('0xc'),JSON[_0x9b4c('0xf')](_0x1d7ee7));if(_0x1d7ee7[_0x9b4c('0x10')]){if(_0x1d7ee7[_0x9b4c('0x10')]['code']===0x1f4){logger[_0x9b4c('0x10')](_0x9b4c('0xb'),_0xb71696,_0x1d7ee7['error'][_0x9b4c('0x11')]);return _0x824e5b(_0x1d7ee7['error'][_0x9b4c('0x11')]);}logger['error'](_0x9b4c('0xb'),_0xb71696,_0x1d7ee7[_0x9b4c('0x10')][_0x9b4c('0x11')]);return _0x24787c(_0x1d7ee7[_0x9b4c('0x10')][_0x9b4c('0x11')]);}else{logger[_0x9b4c('0xa')]('FaxApplication,\x20%s,\x20%s',_0xb71696,'request\x20sent');_0x24787c(_0x1d7ee7[_0x9b4c('0x12')][_0x9b4c('0x11')]);}})['catch'](function(_0x4d963e){logger[_0x9b4c('0x10')]('FaxApplication,\x20%s,\x20%s',_0xb71696,_0x4d963e);_0x824e5b(_0x4d963e);});});}exports[_0x9b4c('0x13')]=function(_0x446ee5){var _0x3394fa=this;return new Promise(function(_0x435323,_0x495073){return db[_0x9b4c('0x14')][_0x9b4c('0x15')](_0x446ee5['body'],{'raw':_0x446ee5['options']?_0x446ee5[_0x9b4c('0x16')][_0x9b4c('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x446ee5[_0x9b4c('0x16')]?_0x446ee5[_0x9b4c('0x16')][_0x9b4c('0x18')]||null:null,'attributes':_0x446ee5[_0x9b4c('0x16')]?_0x446ee5[_0x9b4c('0x16')]['attributes']||null:null,'limit':_0x446ee5[_0x9b4c('0x16')]?_0x446ee5[_0x9b4c('0x16')][_0x9b4c('0x19')]||null:null})[_0x9b4c('0x1a')](function(_0x1ca94e){logger[_0x9b4c('0xa')](_0x9b4c('0x13'),_0x446ee5);logger['debug'](_0x9b4c('0x13'),_0x446ee5,JSON[_0x9b4c('0xf')](_0x1ca94e));_0x435323(_0x1ca94e);})[_0x9b4c('0x1b')](function(_0x21f07f){logger[_0x9b4c('0x10')](_0x9b4c('0x13'),_0x21f07f['message'],_0x446ee5);_0x495073(_0x3394fa[_0x9b4c('0x10')](0x1f4,_0x21f07f[_0x9b4c('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index ce3a4a6..d2bef1d 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 _0xf4f4=['../../config/environment','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0xf38ca5,_0x31986f){var _0x2c07c7=function(_0x1c3841){while(--_0x1c3841){_0xf38ca5['push'](_0xf38ca5['shift']());}};_0x2c07c7(++_0x31986f);}(_0xf4f4,0xe3));var _0x4f4f=function(_0xe29881,_0x3b8c5e){_0xe29881=_0xe29881-0x0;var _0x36d87d=_0xf4f4[_0xe29881];return _0x36d87d;};'use strict';var multer=require(_0x4f4f('0x0'));var util=require(_0x4f4f('0x1'));var path=require('path');var timeout=require(_0x4f4f('0x2'));var express=require(_0x4f4f('0x3'));var router=express[_0x4f4f('0x4')]();var fs_extra=require(_0x4f4f('0x5'));var auth=require(_0x4f4f('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x4f4f('0x7'));var controller=require('./faxApplication.controller');router[_0x4f4f('0x8')]('/',auth[_0x4f4f('0x9')](),controller[_0x4f4f('0xa')]);router[_0x4f4f('0x8')](_0x4f4f('0xb'),auth[_0x4f4f('0x9')](),controller[_0x4f4f('0xc')]);router[_0x4f4f('0xd')]('/',auth['isAuthenticated'](),controller[_0x4f4f('0xe')]);router[_0x4f4f('0xf')](_0x4f4f('0xb'),auth[_0x4f4f('0x9')](),controller[_0x4f4f('0x10')]);router[_0x4f4f('0x11')](_0x4f4f('0xb'),auth[_0x4f4f('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x4213=['post','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./faxApplication.controller','get','isAuthenticated','index','/:id','show'];(function(_0x488c59,_0x20509f){var _0x3b2d4e=function(_0x58883e){while(--_0x58883e){_0x488c59['push'](_0x488c59['shift']());}};_0x3b2d4e(++_0x20509f);}(_0x4213,0x77));var _0x3421=function(_0x23a6d9,_0x4a1655){_0x23a6d9=_0x23a6d9-0x0;var _0x3ef1c2=_0x4213[_0x23a6d9];return _0x3ef1c2;};'use strict';var multer=require(_0x3421('0x0'));var util=require(_0x3421('0x1'));var path=require(_0x3421('0x2'));var timeout=require(_0x3421('0x3'));var express=require(_0x3421('0x4'));var router=express[_0x3421('0x5')]();var fs_extra=require(_0x3421('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x3421('0x7'));var config=require('../../config/environment');var controller=require(_0x3421('0x8'));router[_0x3421('0x9')]('/',auth[_0x3421('0xa')](),controller[_0x3421('0xb')]);router['get'](_0x3421('0xc'),auth[_0x3421('0xa')](),controller[_0x3421('0xd')]);router[_0x3421('0xe')]('/',auth[_0x3421('0xa')](),controller['create']);router[_0x3421('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x3421('0x10')]);router['delete'](_0x3421('0xc'),auth[_0x3421('0xa')](),controller[_0x3421('0x11')]);module[_0x3421('0x12')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index e47fdb7..cf85ddc 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 _0x056b=['exports','BOOLEAN','DATE','STRING','ENUM','out','INTEGER'];(function(_0x496c0c,_0x1497aa){var _0x2f673b=function(_0xda6995){while(--_0xda6995){_0x496c0c['push'](_0x496c0c['shift']());}};_0x2f673b(++_0x1497aa);}(_0x056b,0xb6));var _0xb056=function(_0x174ef5,_0x256e8e){_0x174ef5=_0x174ef5-0x0;var _0x1cc379=_0x056b[_0x174ef5];return _0x1cc379;};'use strict';var Sequelize=require('sequelize');module[_0xb056('0x0')]={'closed':{'type':Sequelize[_0xb056('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xb056('0x2')]},'disposition':{'type':Sequelize[_0xb056('0x3')]},'secondDisposition':{'type':Sequelize[_0xb056('0x3')]},'thirdDisposition':{'type':Sequelize[_0xb056('0x3')]},'note':{'type':Sequelize[_0xb056('0x3')]},'read1stAt':{'type':Sequelize[_0xb056('0x2')]},'fax':{'type':Sequelize[_0xb056('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xb056('0x4')]('in',_0xb056('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xb056('0x4')]('in',_0xb056('0x5')),'defaultValue':'in','allowNull':![]},'queueId':{'type':Sequelize[_0xb056('0x6')]}}; \ No newline at end of file +var _0x7096=['STRING','ENUM','out','INTEGER','exports','DATE'];(function(_0x3ed6b8,_0x42b6ff){var _0x411bb2=function(_0x3eb5f3){while(--_0x3eb5f3){_0x3ed6b8['push'](_0x3ed6b8['shift']());}};_0x411bb2(++_0x42b6ff);}(_0x7096,0x10c));var _0x6709=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0x7096[_0x46aff0];return _0x9d78cf;};'use strict';var Sequelize=require('sequelize');module[_0x6709('0x0')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x6709('0x1')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x6709('0x2')]},'thirdDisposition':{'type':Sequelize[_0x6709('0x2')]},'note':{'type':Sequelize[_0x6709('0x2')]},'read1stAt':{'type':Sequelize[_0x6709('0x1')]},'fax':{'type':Sequelize[_0x6709('0x2')]},'firstMsgDirection':{'type':Sequelize[_0x6709('0x3')]('in',_0x6709('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x6709('0x1')]},'lastMsgDirection':{'type':Sequelize[_0x6709('0x3')]('in',_0x6709('0x4')),'defaultValue':'in','allowNull':![]},'queueId':{'type':Sequelize[_0x6709('0x5')]}}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index e000e17..7333da9 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 _0xb7f3=['send','map','rawAttributes','type','key','getOptions','fax','user','show','params','model','FaxInteraction','query','keys','intersection','fields','attributes','includeAll','merge','catch','create','body','find','describe','addMessage','ids','omit','getMessages','findOne','FaxMessage','filters','hasOwnProperty','nolimit','order','sort','where','pick','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','options','include','findAll','rows','spread','removeTags','download','unix','toString','join','files','tmp','root','server','attachments','format','transcript-%d-%s.zip','push','Attachment','Messages','createdAt','mkdirSync','length','createReadStream','pipe','basename','resolve','log','err','unlinkSync','zip-dir','bluebird','util','path','lodash','../../components/parsers/qs','../../config/logger','../../config/environment','redis','defaults','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','error','name'];(function(_0x31ee64,_0x35266a){var _0x5a3aac=function(_0x2d5078){while(--_0x2d5078){_0x31ee64['push'](_0x31ee64['shift']());}};_0x5a3aac(++_0x35266a);}(_0xb7f3,0x1cb));var _0x3b7f=function(_0x3a10c1,_0x471d88){_0x3a10c1=_0x3a10c1-0x0;var _0x1893f4=_0xb7f3[_0x3a10c1];return _0x1893f4;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0x3b7f('0x0'));var moment=require('moment');var BPromise=require(_0x3b7f('0x1'));var util=require(_0x3b7f('0x2'));var path=require(_0x3b7f('0x3'));var fs=require('fs');var _=require(_0x3b7f('0x4'));var Redis=require('ioredis');var interaction=require('../../components/interaction/service');var qs=require(_0x3b7f('0x5'));var logger=require(_0x3b7f('0x6'))('api');var config=require(_0x3b7f('0x7'));var db=require('../../mysqldb')['db'];config[_0x3b7f('0x8')]=_[_0x3b7f('0x9')](config[_0x3b7f('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0x3b7f('0xa'))(new Redis(config[_0x3b7f('0x8')]));require('./faxInteraction.socket')[_0x3b7f('0xb')](socket);function respondWithStatusCode(_0x3a0e17,_0x58f5df){_0x58f5df=_0x58f5df||0xcc;return function(_0x3a4127){if(_0x3a4127){return _0x3a0e17[_0x3b7f('0xc')](_0x58f5df);}return _0x3a0e17[_0x3b7f('0xd')](_0x58f5df)[_0x3b7f('0xe')]();};}function respondWithResult(_0x1a3e1d,_0x3cb667){_0x3cb667=_0x3cb667||0xc8;return function(_0x599122){if(_0x599122){return _0x1a3e1d['status'](_0x3cb667)[_0x3b7f('0xf')](_0x599122);}};}function respondWithFilteredResult(_0x175253,_0x47fae5){return function(_0xc6cbce){if(_0xc6cbce){var _0x2e2a89=typeof _0x47fae5[_0x3b7f('0x10')]===_0x3b7f('0x11')&&typeof _0x47fae5[_0x3b7f('0x12')]==='undefined';var _0x38f1a3=_0xc6cbce[_0x3b7f('0x13')];var _0x1f11cb=_0x2e2a89?0x0:_0x47fae5[_0x3b7f('0x10')];var _0x36075b=_0x2e2a89?_0xc6cbce[_0x3b7f('0x13')]:_0x47fae5['offset']+_0x47fae5[_0x3b7f('0x12')];var _0x39087b;if(_0x36075b>=_0x38f1a3){_0x36075b=_0x38f1a3;_0x39087b=0xc8;}else{_0x39087b=0xce;}_0x175253[_0x3b7f('0xd')](_0x39087b);return _0x175253[_0x3b7f('0x14')](_0x3b7f('0x15'),_0x1f11cb+'-'+_0x36075b+'/'+_0x38f1a3)[_0x3b7f('0xf')](_0xc6cbce);}return null;};}function saveUpdates(_0x324f40){return function(_0x40bd6c){if(_0x40bd6c){return _0x40bd6c[_0x3b7f('0x16')](_0x324f40)[_0x3b7f('0x17')](function(_0xf918af){return _0xf918af;});}return null;};}function removeEntity(_0x13247f){return function(_0x2b9e7b){if(_0x2b9e7b){return _0x2b9e7b['destroy']()[_0x3b7f('0x17')](function(){_0x13247f[_0x3b7f('0xd')](0xcc)[_0x3b7f('0xe')]();});}};}function handleEntityNotFound(_0x4d47ef){return function(_0x4b8602){if(!_0x4b8602){_0x4d47ef[_0x3b7f('0xc')](0x194);}return _0x4b8602;};}function handleError(_0x146a54,_0x400ce2){_0x400ce2=_0x400ce2||0x1f4;return function(_0x3979b9){logger[_0x3b7f('0x18')](_0x3979b9['stack']);if(_0x3979b9[_0x3b7f('0x19')]){delete _0x3979b9['name'];}_0x146a54[_0x3b7f('0xd')](_0x400ce2)[_0x3b7f('0x1a')](_0x3979b9);};}exports['index']=function(_0x122ed2,_0x3c1d0c){var _0x1dab8b={};var _0x43ff54=_[_0x3b7f('0x1b')](db['FaxInteraction'][_0x3b7f('0x1c')],function(_0x5d564c){return{'name':_0x5d564c['fieldName'],'type':_0x5d564c[_0x3b7f('0x1d')][_0x3b7f('0x1e')]};});_0x1dab8b=qs[_0x3b7f('0x1f')](_0x43ff54,_0x122ed2);return interaction['findAll'](_0x3b7f('0x20'),_0x122ed2['query'],_0x122ed2[_0x3b7f('0x21')],_0x1dab8b,_0x43ff54)[_0x3b7f('0x17')](respondWithFilteredResult(_0x3c1d0c,_0x1dab8b))['catch'](handleError(_0x3c1d0c,null));};exports[_0x3b7f('0x22')]=function(_0x106ed1,_0x5584e8){var _0x29cf64={'raw':![],'where':{'id':_0x106ed1[_0x3b7f('0x23')]['id']}},_0x160312={};_0x160312[_0x3b7f('0x24')]=_['keys'](db[_0x3b7f('0x25')][_0x3b7f('0x1c')]);_0x160312[_0x3b7f('0x26')]=_[_0x3b7f('0x27')](_0x106ed1[_0x3b7f('0x26')]);_0x160312['filters']=_[_0x3b7f('0x28')](_0x160312['model'],_0x160312[_0x3b7f('0x26')]);_0x29cf64['attributes']=_['intersection'](_0x160312['model'],qs[_0x3b7f('0x29')](_0x106ed1['query'][_0x3b7f('0x29')]));_0x29cf64['attributes']=_0x29cf64[_0x3b7f('0x2a')]['length']?_0x29cf64[_0x3b7f('0x2a')]:_0x160312[_0x3b7f('0x24')];if(_0x106ed1[_0x3b7f('0x26')][_0x3b7f('0x2b')]){_0x29cf64['include']=[{'all':!![]}];}_0x29cf64=_[_0x3b7f('0x2c')]({},_0x29cf64,_0x106ed1['options']);return db[_0x3b7f('0x25')]['find'](_0x29cf64)[_0x3b7f('0x17')](handleEntityNotFound(_0x5584e8,null))[_0x3b7f('0x17')](respondWithResult(_0x5584e8,null))[_0x3b7f('0x2d')](handleError(_0x5584e8,null));};exports['create']=function(_0x351ecb,_0x2b2017){return db['FaxInteraction'][_0x3b7f('0x2e')](_0x351ecb[_0x3b7f('0x2f')],{})[_0x3b7f('0x17')](respondWithResult(_0x2b2017,0xc9))[_0x3b7f('0x2d')](handleError(_0x2b2017,null));};exports[_0x3b7f('0x16')]=function(_0x2cd7fc,_0x26f6d5){if(_0x2cd7fc[_0x3b7f('0x2f')]['id']){delete _0x2cd7fc[_0x3b7f('0x2f')]['id'];}return db[_0x3b7f('0x25')]['find']({'where':{'id':_0x2cd7fc[_0x3b7f('0x23')]['id']}})['then'](handleEntityNotFound(_0x26f6d5,null))[_0x3b7f('0x17')](saveUpdates(_0x2cd7fc[_0x3b7f('0x2f')],null))[_0x3b7f('0x17')](respondWithResult(_0x26f6d5,null))[_0x3b7f('0x2d')](handleError(_0x26f6d5,null));};exports['destroy']=function(_0x54668e,_0x2e85ea){return db[_0x3b7f('0x25')][_0x3b7f('0x30')]({'where':{'id':_0x54668e[_0x3b7f('0x23')]['id']}})[_0x3b7f('0x17')](handleEntityNotFound(_0x2e85ea,null))[_0x3b7f('0x17')](removeEntity(_0x2e85ea,null))['catch'](handleError(_0x2e85ea,null));};exports[_0x3b7f('0x31')]=function(_0x1010b1,_0x13e609){return db[_0x3b7f('0x25')][_0x3b7f('0x31')]()['then'](respondWithResult(_0x13e609,null))['catch'](handleError(_0x13e609,null));};exports['addMessage']=function(_0x3ba618,_0x4f180c){return db['FaxMessage']['find']({'where':{'id':_0x3ba618[_0x3b7f('0x23')]['id']}})[_0x3b7f('0x17')](handleEntityNotFound(_0x4f180c,null))[_0x3b7f('0x17')](function(_0x3973e4){if(_0x3973e4){return _0x3973e4[_0x3b7f('0x32')](_0x3ba618[_0x3b7f('0x2f')][_0x3b7f('0x33')],_[_0x3b7f('0x34')](_0x3ba618[_0x3b7f('0x2f')],[_0x3b7f('0x33'),'id'])||{});}})['then'](respondWithResult(_0x4f180c,null))['catch'](handleError(_0x4f180c,null));};exports[_0x3b7f('0x35')]=function(_0x51eeeb,_0x2c4d4d){var _0x420433={'raw':![],'where':{}};var _0x4efa7d={};var _0x26f923={'count':0x0,'rows':[]};return db['FaxInteraction'][_0x3b7f('0x36')]({'where':{'id':_0x51eeeb[_0x3b7f('0x23')]['id']}})[_0x3b7f('0x17')](handleEntityNotFound(_0x2c4d4d,null))['then'](function(_0x294cf4){if(_0x294cf4){_0x4efa7d['model']=_['keys'](db[_0x3b7f('0x37')][_0x3b7f('0x1c')]);_0x4efa7d[_0x3b7f('0x26')]=_[_0x3b7f('0x27')](_0x51eeeb[_0x3b7f('0x26')]);_0x4efa7d[_0x3b7f('0x38')]=_[_0x3b7f('0x28')](_0x4efa7d[_0x3b7f('0x24')],_0x4efa7d[_0x3b7f('0x26')]);_0x420433[_0x3b7f('0x2a')]=_[_0x3b7f('0x28')](_0x4efa7d[_0x3b7f('0x24')],qs[_0x3b7f('0x29')](_0x51eeeb[_0x3b7f('0x26')][_0x3b7f('0x29')]));_0x420433['attributes']=_0x420433[_0x3b7f('0x2a')]['length']?_0x420433['attributes']:_0x4efa7d[_0x3b7f('0x24')];if(!_0x51eeeb[_0x3b7f('0x26')][_0x3b7f('0x39')](_0x3b7f('0x3a'))){_0x420433[_0x3b7f('0x12')]=qs[_0x3b7f('0x12')](_0x51eeeb['query'][_0x3b7f('0x12')]);_0x420433[_0x3b7f('0x10')]=qs[_0x3b7f('0x10')](_0x51eeeb[_0x3b7f('0x26')]['offset']);}_0x420433[_0x3b7f('0x3b')]=qs[_0x3b7f('0x3c')](_0x51eeeb[_0x3b7f('0x26')]['sort']);_0x420433[_0x3b7f('0x3d')]=qs[_0x3b7f('0x38')](_[_0x3b7f('0x3e')](_0x51eeeb[_0x3b7f('0x26')],_0x4efa7d[_0x3b7f('0x38')]));_0x420433[_0x3b7f('0x3d')]['FaxInteractionId']=_0x294cf4['id'];if(_0x51eeeb['query'][_0x3b7f('0x3f')]){_0x420433[_0x3b7f('0x3d')]=_[_0x3b7f('0x2c')](_0x420433[_0x3b7f('0x3d')],{'$or':_[_0x3b7f('0x1b')](_0x420433[_0x3b7f('0x2a')],function(_0x11d6bc){var _0xcf72b5={};_0xcf72b5[_0x11d6bc]={'$like':'%'+_0x51eeeb[_0x3b7f('0x26')][_0x3b7f('0x3f')]+'%'};return _0xcf72b5;})});}if(_0x51eeeb['query'][_0x3b7f('0x40')]){var _0x3fd5a9=_0x51eeeb[_0x3b7f('0x26')][_0x3b7f('0x40')][_0x3b7f('0x41')](',');var _0x121a2c={};_0x121a2c[_0x3fd5a9[0x0]]={'$gte':moment(_0x3fd5a9[0x1])['format'](_0x3b7f('0x42'))};_0x420433[_0x3b7f('0x3d')]=_['merge'](_0x420433['where'],_0x121a2c);}_0x420433=_[_0x3b7f('0x2c')]({},_0x420433,_0x51eeeb[_0x3b7f('0x43')]);return db[_0x3b7f('0x37')]['count']({'where':_0x420433[_0x3b7f('0x3d')]})[_0x3b7f('0x17')](function(_0x459e19){_0x26f923[_0x3b7f('0x13')]=_0x459e19;if(_0x51eeeb['query'][_0x3b7f('0x2b')]){_0x420433[_0x3b7f('0x44')]=[{'all':!![]}];}return db[_0x3b7f('0x37')][_0x3b7f('0x45')](_0x420433);})[_0x3b7f('0x17')](function(_0x1478eb){_0x26f923[_0x3b7f('0x46')]=_0x1478eb;return _0x26f923;});}})[_0x3b7f('0x17')](respondWithFilteredResult(_0x2c4d4d,_0x420433))['catch'](handleError(_0x2c4d4d,null));};exports['addTags']=function(_0x2d8f27,_0x15dc89){return db[_0x3b7f('0x25')][_0x3b7f('0x30')]({'where':{'id':_0x2d8f27[_0x3b7f('0x23')]['id']}})[_0x3b7f('0x17')](handleEntityNotFound(_0x15dc89,null))[_0x3b7f('0x17')](function(_0x41a8f1){if(_0x41a8f1){return _0x41a8f1['setTags'](_0x2d8f27['body']['ids'],_[_0x3b7f('0x34')](_0x2d8f27['body'],[_0x3b7f('0x33'),'id'])||{})[_0x3b7f('0x47')](function(){return db['Tag'][_0x3b7f('0x45')]({'attributes':['id',_0x3b7f('0x19'),'color'],'where':{'id':_0x2d8f27[_0x3b7f('0x2f')]['ids']}});})[_0x3b7f('0x17')](function(_0x4bd3f4){socket['emit']('faxInteractionTags:save',{'id':Number(_0x2d8f27['params']['id']),'tags':_0x4bd3f4||[]});return{'id':Number(_0x2d8f27[_0x3b7f('0x23')]['id']),'tags':_0x4bd3f4||[]};});}})['then'](respondWithResult(_0x15dc89,null))['catch'](handleError(_0x15dc89,null));};exports[_0x3b7f('0x48')]=function(_0x3e9233,_0x4aef72){return db['FaxInteraction'][_0x3b7f('0x30')]({'where':{'id':_0x3e9233['params']['id']}})[_0x3b7f('0x17')](handleEntityNotFound(_0x4aef72,null))[_0x3b7f('0x17')](function(_0x265606){if(_0x265606){return _0x265606[_0x3b7f('0x48')](_0x3e9233[_0x3b7f('0x26')][_0x3b7f('0x33')]);}})[_0x3b7f('0x17')](respondWithStatusCode(_0x4aef72,null))['catch'](handleError(_0x4aef72,null));};exports[_0x3b7f('0x49')]=function(_0x3b93b5,_0x4c3e1e){var _0x582580=moment()[_0x3b7f('0x4a')]()[_0x3b7f('0x4b')]();var _0x2f453a=path[_0x3b7f('0x4c')](config['root'],'server',_0x3b7f('0x4d'),_0x3b7f('0x4e'));var _0x3bc920=path[_0x3b7f('0x4c')](config[_0x3b7f('0x4f')],_0x3b7f('0x50'),_0x3b7f('0x4d'),_0x3b7f('0x51'));var _0x1e7bdc=path[_0x3b7f('0x4c')](_0x2f453a,_0x582580);var _0x5124b6=util[_0x3b7f('0x52')](_0x3b7f('0x53'),_0x3b93b5['params']['id'],_0x582580);var _0x44f05d=path[_0x3b7f('0x4c')](_0x2f453a,_0x5124b6);var _0x3edec8=[];_0x3edec8[_0x3b7f('0x54')]({'model':db['Attachment'],'as':_0x3b7f('0x55'),'raw':!![]});var _0x1bd197=[{'model':db[_0x3b7f('0x37')],'as':_0x3b7f('0x56'),'attributes':['id','body',_0x3b7f('0x57')],'include':_0x3edec8}];return db[_0x3b7f('0x25')][_0x3b7f('0x30')]({'where':{'id':_0x3b93b5[_0x3b7f('0x23')]['id']},'include':_0x1bd197})[_0x3b7f('0x17')](handleEntityNotFound(_0x4c3e1e,null))[_0x3b7f('0x17')](function(_0x52575b){if(_0x52575b&&_0x52575b[_0x3b7f('0x56')]){var _0x8f88b2=_0x52575b['get']({'plain':!![]});fs[_0x3b7f('0x58')](_0x1e7bdc);for(var _0x1ddcc9=0x0;_0x1ddcc9<_0x8f88b2[_0x3b7f('0x56')][_0x3b7f('0x59')];_0x1ddcc9++){var _0x38af6f=_0x8f88b2[_0x3b7f('0x56')][_0x1ddcc9][_0x3b7f('0x55')];if(_0x38af6f){var _0x757e54=path[_0x3b7f('0x4c')](_0x3bc920,_0x38af6f['basename']);if(fs['existsSync'](_0x757e54)){fs[_0x3b7f('0x5a')](_0x757e54)[_0x3b7f('0x5b')](fs['createWriteStream'](path[_0x3b7f('0x4c')](_0x1e7bdc,_0x38af6f[_0x3b7f('0x5c')])));}}}return BPromise[_0x3b7f('0x5d')]()[_0x3b7f('0x17')](function(){return new BPromise(function(_0x19a4d9,_0x7097f){zipdir(_0x1e7bdc,{'saveTo':_0x44f05d},function(_0x1630d3,_0x5e09a9){if(_0x1630d3)return _0x7097f(_0x1630d3);return _0x19a4d9(_0x5e09a9);});})['then'](function(){return new BPromise(function(_0xb8f4f3,_0x948a73){rimraf(_0x1e7bdc,function(_0x4177e0){if(_0x4177e0)_0x948a73(_0x4177e0);return _0xb8f4f3();});});})[_0x3b7f('0x17')](function(){return _0x4c3e1e[_0x3b7f('0x49')](_0x44f05d,_0x5124b6,function(_0x235fb5){if(_0x235fb5){console[_0x3b7f('0x5e')](_0x3b7f('0x5f'),_0x235fb5);}else{fs[_0x3b7f('0x60')](_0x44f05d);}});});});}else{return _0x4c3e1e[_0x3b7f('0xc')](0xc8);}})['catch'](handleError(_0x4c3e1e,null));}; \ No newline at end of file +var _0xe62f=['mkdirSync','basename','existsSync','createReadStream','pipe','createWriteStream','resolve','log','err','unlinkSync','zip-dir','moment','bluebird','util','path','../../components/interaction/service','../../components/parsers/qs','api','redis','localhost','socket.io-emitter','register','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','update','destroy','then','error','stack','name','send','index','FaxInteraction','rawAttributes','type','getOptions','fax','query','catch','show','model','keys','filters','intersection','fields','attributes','length','includeAll','include','merge','options','body','find','params','describe','addMessage','FaxMessage','ids','omit','getMessages','findOne','nolimit','order','pick','filter','where','map','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','findAll','rows','setTags','spread','color','emit','removeTags','download','unix','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','push','Attachment','Messages','createdAt','get'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe62f,0x19a));var _0xfe62=function(_0x375144,_0xbcbb0a){_0x375144=_0x375144-0x0;var _0x465ddf=_0xe62f[_0x375144];return _0x465ddf;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0xfe62('0x0'));var moment=require(_0xfe62('0x1'));var BPromise=require(_0xfe62('0x2'));var util=require(_0xfe62('0x3'));var path=require(_0xfe62('0x4'));var fs=require('fs');var _=require('lodash');var Redis=require('ioredis');var interaction=require(_0xfe62('0x5'));var qs=require(_0xfe62('0x6'));var logger=require('../../config/logger')(_0xfe62('0x7'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0xfe62('0x8')]=_['defaults'](config['redis'],{'host':_0xfe62('0x9'),'port':0x18eb});var socket=require(_0xfe62('0xa'))(new Redis(config['redis']));require('./faxInteraction.socket')[_0xfe62('0xb')](socket);function respondWithStatusCode(_0x5229a6,_0x4f468a){_0x4f468a=_0x4f468a||0xcc;return function(_0x39e101){if(_0x39e101){return _0x5229a6[_0xfe62('0xc')](_0x4f468a);}return _0x5229a6[_0xfe62('0xd')](_0x4f468a)[_0xfe62('0xe')]();};}function respondWithResult(_0x454d41,_0x53d2b9){_0x53d2b9=_0x53d2b9||0xc8;return function(_0x2b1411){if(_0x2b1411){return _0x454d41['status'](_0x53d2b9)[_0xfe62('0xf')](_0x2b1411);}};}function respondWithFilteredResult(_0x49e025,_0x29b09b){return function(_0x268fad){if(_0x268fad){var _0x481b95=typeof _0x29b09b['offset']===_0xfe62('0x10')&&typeof _0x29b09b[_0xfe62('0x11')]===_0xfe62('0x10');var _0x44a33f=_0x268fad[_0xfe62('0x12')];var _0x4f1df4=_0x481b95?0x0:_0x29b09b['offset'];var _0x389adb=_0x481b95?_0x268fad[_0xfe62('0x12')]:_0x29b09b[_0xfe62('0x13')]+_0x29b09b['limit'];var _0x3f95eb;if(_0x389adb>=_0x44a33f){_0x389adb=_0x44a33f;_0x3f95eb=0xc8;}else{_0x3f95eb=0xce;}_0x49e025[_0xfe62('0xd')](_0x3f95eb);return _0x49e025[_0xfe62('0x14')](_0xfe62('0x15'),_0x4f1df4+'-'+_0x389adb+'/'+_0x44a33f)['json'](_0x268fad);}return null;};}function saveUpdates(_0x434d2e){return function(_0x29e72c){if(_0x29e72c){return _0x29e72c[_0xfe62('0x16')](_0x434d2e)['then'](function(_0x393a95){return _0x393a95;});}return null;};}function removeEntity(_0x4c4c13){return function(_0x101d39){if(_0x101d39){return _0x101d39[_0xfe62('0x17')]()[_0xfe62('0x18')](function(){_0x4c4c13[_0xfe62('0xd')](0xcc)[_0xfe62('0xe')]();});}};}function handleEntityNotFound(_0x1c5dc5){return function(_0x3ee019){if(!_0x3ee019){_0x1c5dc5[_0xfe62('0xc')](0x194);}return _0x3ee019;};}function handleError(_0x32cdb3,_0x341531){_0x341531=_0x341531||0x1f4;return function(_0x2c2b54){logger[_0xfe62('0x19')](_0x2c2b54[_0xfe62('0x1a')]);if(_0x2c2b54[_0xfe62('0x1b')]){delete _0x2c2b54[_0xfe62('0x1b')];}_0x32cdb3[_0xfe62('0xd')](_0x341531)[_0xfe62('0x1c')](_0x2c2b54);};}exports[_0xfe62('0x1d')]=function(_0x52cc74,_0xc6cc34){var _0x24059a={};var _0x4c4b9f=_['map'](db[_0xfe62('0x1e')][_0xfe62('0x1f')],function(_0x411ce7){return{'name':_0x411ce7['fieldName'],'type':_0x411ce7[_0xfe62('0x20')]['key']};});_0x24059a=qs[_0xfe62('0x21')](_0x4c4b9f,_0x52cc74);return interaction['findAll'](_0xfe62('0x22'),_0x52cc74[_0xfe62('0x23')],_0x52cc74['user'],_0x24059a,_0x4c4b9f)[_0xfe62('0x18')](respondWithFilteredResult(_0xc6cc34,_0x24059a))[_0xfe62('0x24')](handleError(_0xc6cc34,null));};exports[_0xfe62('0x25')]=function(_0xb47a75,_0x3311b0){var _0x378429={'raw':![],'where':{'id':_0xb47a75['params']['id']}},_0x59f07b={};_0x59f07b[_0xfe62('0x26')]=_[_0xfe62('0x27')](db[_0xfe62('0x1e')]['rawAttributes']);_0x59f07b[_0xfe62('0x23')]=_[_0xfe62('0x27')](_0xb47a75[_0xfe62('0x23')]);_0x59f07b[_0xfe62('0x28')]=_[_0xfe62('0x29')](_0x59f07b[_0xfe62('0x26')],_0x59f07b['query']);_0x378429['attributes']=_['intersection'](_0x59f07b[_0xfe62('0x26')],qs[_0xfe62('0x2a')](_0xb47a75[_0xfe62('0x23')][_0xfe62('0x2a')]));_0x378429[_0xfe62('0x2b')]=_0x378429[_0xfe62('0x2b')][_0xfe62('0x2c')]?_0x378429['attributes']:_0x59f07b[_0xfe62('0x26')];if(_0xb47a75['query'][_0xfe62('0x2d')]){_0x378429[_0xfe62('0x2e')]=[{'all':!![]}];}_0x378429=_[_0xfe62('0x2f')]({},_0x378429,_0xb47a75[_0xfe62('0x30')]);return db['FaxInteraction']['find'](_0x378429)[_0xfe62('0x18')](handleEntityNotFound(_0x3311b0,null))[_0xfe62('0x18')](respondWithResult(_0x3311b0,null))[_0xfe62('0x24')](handleError(_0x3311b0,null));};exports['create']=function(_0x33c3a8,_0x4d2658){return db['FaxInteraction']['create'](_0x33c3a8[_0xfe62('0x31')],{})['then'](respondWithResult(_0x4d2658,0xc9))[_0xfe62('0x24')](handleError(_0x4d2658,null));};exports[_0xfe62('0x16')]=function(_0x22f81e,_0x4a5fae){if(_0x22f81e[_0xfe62('0x31')]['id']){delete _0x22f81e[_0xfe62('0x31')]['id'];}return db[_0xfe62('0x1e')]['find']({'where':{'id':_0x22f81e['params']['id']}})['then'](handleEntityNotFound(_0x4a5fae,null))[_0xfe62('0x18')](saveUpdates(_0x22f81e[_0xfe62('0x31')],null))[_0xfe62('0x18')](respondWithResult(_0x4a5fae,null))[_0xfe62('0x24')](handleError(_0x4a5fae,null));};exports[_0xfe62('0x17')]=function(_0xd25c63,_0x223606){return db['FaxInteraction'][_0xfe62('0x32')]({'where':{'id':_0xd25c63[_0xfe62('0x33')]['id']}})[_0xfe62('0x18')](handleEntityNotFound(_0x223606,null))['then'](removeEntity(_0x223606,null))['catch'](handleError(_0x223606,null));};exports[_0xfe62('0x34')]=function(_0x1ac442,_0x203e5b){return db[_0xfe62('0x1e')]['describe']()[_0xfe62('0x18')](respondWithResult(_0x203e5b,null))[_0xfe62('0x24')](handleError(_0x203e5b,null));};exports[_0xfe62('0x35')]=function(_0x1dcf68,_0x98e6bd){return db[_0xfe62('0x36')][_0xfe62('0x32')]({'where':{'id':_0x1dcf68[_0xfe62('0x33')]['id']}})[_0xfe62('0x18')](handleEntityNotFound(_0x98e6bd,null))[_0xfe62('0x18')](function(_0x160e7f){if(_0x160e7f){return _0x160e7f[_0xfe62('0x35')](_0x1dcf68['body'][_0xfe62('0x37')],_[_0xfe62('0x38')](_0x1dcf68[_0xfe62('0x31')],[_0xfe62('0x37'),'id'])||{});}})[_0xfe62('0x18')](respondWithResult(_0x98e6bd,null))[_0xfe62('0x24')](handleError(_0x98e6bd,null));};exports[_0xfe62('0x39')]=function(_0x38c8f1,_0x54384e){var _0x19ebaa={'raw':![],'where':{}};var _0x257a10={};var _0x1b57c7={'count':0x0,'rows':[]};return db['FaxInteraction'][_0xfe62('0x3a')]({'where':{'id':_0x38c8f1[_0xfe62('0x33')]['id']}})[_0xfe62('0x18')](handleEntityNotFound(_0x54384e,null))[_0xfe62('0x18')](function(_0xea237f){if(_0xea237f){_0x257a10['model']=_[_0xfe62('0x27')](db[_0xfe62('0x36')]['rawAttributes']);_0x257a10['query']=_['keys'](_0x38c8f1[_0xfe62('0x23')]);_0x257a10[_0xfe62('0x28')]=_[_0xfe62('0x29')](_0x257a10[_0xfe62('0x26')],_0x257a10['query']);_0x19ebaa[_0xfe62('0x2b')]=_['intersection'](_0x257a10[_0xfe62('0x26')],qs[_0xfe62('0x2a')](_0x38c8f1[_0xfe62('0x23')][_0xfe62('0x2a')]));_0x19ebaa[_0xfe62('0x2b')]=_0x19ebaa['attributes'][_0xfe62('0x2c')]?_0x19ebaa[_0xfe62('0x2b')]:_0x257a10['model'];if(!_0x38c8f1[_0xfe62('0x23')]['hasOwnProperty'](_0xfe62('0x3b'))){_0x19ebaa[_0xfe62('0x11')]=qs[_0xfe62('0x11')](_0x38c8f1[_0xfe62('0x23')][_0xfe62('0x11')]);_0x19ebaa['offset']=qs[_0xfe62('0x13')](_0x38c8f1[_0xfe62('0x23')][_0xfe62('0x13')]);}_0x19ebaa[_0xfe62('0x3c')]=qs['sort'](_0x38c8f1[_0xfe62('0x23')]['sort']);_0x19ebaa['where']=qs[_0xfe62('0x28')](_[_0xfe62('0x3d')](_0x38c8f1['query'],_0x257a10[_0xfe62('0x28')]));_0x19ebaa['where']['FaxInteractionId']=_0xea237f['id'];if(_0x38c8f1[_0xfe62('0x23')][_0xfe62('0x3e')]){_0x19ebaa[_0xfe62('0x3f')]=_[_0xfe62('0x2f')](_0x19ebaa[_0xfe62('0x3f')],{'$or':_[_0xfe62('0x40')](_0x19ebaa[_0xfe62('0x2b')],function(_0x3b87ba){var _0x5cf6ec={};_0x5cf6ec[_0x3b87ba]={'$like':'%'+_0x38c8f1[_0xfe62('0x23')][_0xfe62('0x3e')]+'%'};return _0x5cf6ec;})});}if(_0x38c8f1[_0xfe62('0x23')][_0xfe62('0x41')]){var _0x132638=_0x38c8f1[_0xfe62('0x23')]['$gte'][_0xfe62('0x42')](',');var _0x275a62={};_0x275a62[_0x132638[0x0]]={'$gte':moment(_0x132638[0x1])[_0xfe62('0x43')](_0xfe62('0x44'))};_0x19ebaa[_0xfe62('0x3f')]=_[_0xfe62('0x2f')](_0x19ebaa['where'],_0x275a62);}_0x19ebaa=_[_0xfe62('0x2f')]({},_0x19ebaa,_0x38c8f1['options']);return db[_0xfe62('0x36')][_0xfe62('0x12')]({'where':_0x19ebaa[_0xfe62('0x3f')]})['then'](function(_0x13bb6e){_0x1b57c7[_0xfe62('0x12')]=_0x13bb6e;if(_0x38c8f1[_0xfe62('0x23')][_0xfe62('0x2d')]){_0x19ebaa[_0xfe62('0x2e')]=[{'all':!![]}];}return db[_0xfe62('0x36')][_0xfe62('0x45')](_0x19ebaa);})[_0xfe62('0x18')](function(_0x32bf4d){_0x1b57c7[_0xfe62('0x46')]=_0x32bf4d;return _0x1b57c7;});}})[_0xfe62('0x18')](respondWithFilteredResult(_0x54384e,_0x19ebaa))[_0xfe62('0x24')](handleError(_0x54384e,null));};exports['addTags']=function(_0x4c18bf,_0x4d0535){return db['FaxInteraction'][_0xfe62('0x32')]({'where':{'id':_0x4c18bf[_0xfe62('0x33')]['id']}})[_0xfe62('0x18')](handleEntityNotFound(_0x4d0535,null))[_0xfe62('0x18')](function(_0x1b3620){if(_0x1b3620){return _0x1b3620[_0xfe62('0x47')](_0x4c18bf['body'][_0xfe62('0x37')],_[_0xfe62('0x38')](_0x4c18bf['body'],['ids','id'])||{})[_0xfe62('0x48')](function(){return db['Tag'][_0xfe62('0x45')]({'attributes':['id',_0xfe62('0x1b'),_0xfe62('0x49')],'where':{'id':_0x4c18bf[_0xfe62('0x31')][_0xfe62('0x37')]}});})['then'](function(_0x4d0887){socket[_0xfe62('0x4a')]('faxInteractionTags:save',{'id':Number(_0x4c18bf[_0xfe62('0x33')]['id']),'tags':_0x4d0887||[]});return{'id':Number(_0x4c18bf[_0xfe62('0x33')]['id']),'tags':_0x4d0887||[]};});}})['then'](respondWithResult(_0x4d0535,null))[_0xfe62('0x24')](handleError(_0x4d0535,null));};exports[_0xfe62('0x4b')]=function(_0x2b706e,_0x2aa500){return db['FaxInteraction'][_0xfe62('0x32')]({'where':{'id':_0x2b706e[_0xfe62('0x33')]['id']}})['then'](handleEntityNotFound(_0x2aa500,null))['then'](function(_0x55c71e){if(_0x55c71e){return _0x55c71e[_0xfe62('0x4b')](_0x2b706e[_0xfe62('0x23')]['ids']);}})['then'](respondWithStatusCode(_0x2aa500,null))[_0xfe62('0x24')](handleError(_0x2aa500,null));};exports[_0xfe62('0x4c')]=function(_0x1844db,_0x1dab68){var _0x398496=moment()[_0xfe62('0x4d')]()['toString']();var _0x11c052=path[_0xfe62('0x4e')](config[_0xfe62('0x4f')],_0xfe62('0x50'),_0xfe62('0x51'),_0xfe62('0x52'));var _0x1e8a86=path[_0xfe62('0x4e')](config[_0xfe62('0x4f')],_0xfe62('0x50'),_0xfe62('0x51'),_0xfe62('0x53'));var _0x1eb8db=path['join'](_0x11c052,_0x398496);var _0x20d0cc=util[_0xfe62('0x43')](_0xfe62('0x54'),_0x1844db['params']['id'],_0x398496);var _0x5c0f5b=path['join'](_0x11c052,_0x20d0cc);var _0x3097e8=[];_0x3097e8[_0xfe62('0x55')]({'model':db[_0xfe62('0x56')],'as':_0xfe62('0x56'),'raw':!![]});var _0x27d783=[{'model':db[_0xfe62('0x36')],'as':_0xfe62('0x57'),'attributes':['id',_0xfe62('0x31'),_0xfe62('0x58')],'include':_0x3097e8}];return db['FaxInteraction'][_0xfe62('0x32')]({'where':{'id':_0x1844db[_0xfe62('0x33')]['id']},'include':_0x27d783})[_0xfe62('0x18')](handleEntityNotFound(_0x1dab68,null))[_0xfe62('0x18')](function(_0x5d72d2){if(_0x5d72d2&&_0x5d72d2[_0xfe62('0x57')]){var _0x491081=_0x5d72d2[_0xfe62('0x59')]({'plain':!![]});fs[_0xfe62('0x5a')](_0x1eb8db);for(var _0x403eb8=0x0;_0x403eb8<_0x491081['Messages']['length'];_0x403eb8++){var _0x4e3ddd=_0x491081['Messages'][_0x403eb8][_0xfe62('0x56')];if(_0x4e3ddd){var _0xc16b=path[_0xfe62('0x4e')](_0x1e8a86,_0x4e3ddd[_0xfe62('0x5b')]);if(fs[_0xfe62('0x5c')](_0xc16b)){fs[_0xfe62('0x5d')](_0xc16b)[_0xfe62('0x5e')](fs[_0xfe62('0x5f')](path[_0xfe62('0x4e')](_0x1eb8db,_0x4e3ddd[_0xfe62('0x5b')])));}}}return BPromise[_0xfe62('0x60')]()['then'](function(){return new BPromise(function(_0x1f957f,_0x134726){zipdir(_0x1eb8db,{'saveTo':_0x5c0f5b},function(_0x5ab9f3,_0x5e78c2){if(_0x5ab9f3)return _0x134726(_0x5ab9f3);return _0x1f957f(_0x5e78c2);});})['then'](function(){return new BPromise(function(_0x42c703,_0x3ef7ac){rimraf(_0x1eb8db,function(_0x3e1933){if(_0x3e1933)_0x3ef7ac(_0x3e1933);return _0x42c703();});});})[_0xfe62('0x18')](function(){return _0x1dab68[_0xfe62('0x4c')](_0x5c0f5b,_0x20d0cc,function(_0x2bb682){if(_0x2bb682){console[_0xfe62('0x61')](_0xfe62('0x62'),_0x2bb682);}else{fs[_0xfe62('0x63')](_0x5c0f5b);}});});});}else{return _0x1dab68['sendStatus'](0xc8);}})[_0xfe62('0x24')](handleError(_0x1dab68,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index 28fcb36..d208d36 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 _0xdb82=['save','update','getUsers','setDataValue','Users','map','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners'];(function(_0x5c1ce1,_0x179982){var _0x4b085e=function(_0x3b8565){while(--_0x3b8565){_0x5c1ce1['push'](_0x5c1ce1['shift']());}};_0x4b085e(++_0x179982);}(_0xdb82,0xaf));var _0x2db8=function(_0x109374,_0x59de73){_0x109374=_0x109374-0x0;var _0x30c3bc=_0xdb82[_0x109374];return _0x30c3bc;};'use strict';var EventEmitter=require(_0x2db8('0x0'));var FaxInteraction=require(_0x2db8('0x1'))['db'][_0x2db8('0x2')];var FaxMessage=require(_0x2db8('0x1'))['db'][_0x2db8('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x2db8('0x4')](0x0);var events={'afterCreate':_0x2db8('0x5'),'afterUpdate':_0x2db8('0x6'),'afterDestroy':'remove'};function emitEvent(_0x1fb7b4){return function(_0x33ecc6,_0x184df3,_0x2c6bdc){_0x33ecc6[_0x2db8('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x5bd176){_0x33ecc6[_0x2db8('0x8')](_0x2db8('0x9'),_0x5bd176[_0x2db8('0xa')](function(_0x362f25){return{'id':_0x362f25['id']};}));return FaxMessage['findAll']({'where':{'FaxInteractionId':_0x33ecc6['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x17da9f){_0x33ecc6[_0x2db8('0x8')](_0x2db8('0xb'),_0x17da9f[_0x2db8('0xc')]);FaxInteractionEvents['emit'](_0x1fb7b4+':'+_0x33ecc6['id'],_0x33ecc6);FaxInteractionEvents[_0x2db8('0xd')](_0x1fb7b4,_0x33ecc6);_0x2c6bdc(null);})[_0x2db8('0xe')](_0x2c6bdc(null));};}for(var e in events){if(events[_0x2db8('0xf')](e)){var event=events[e];FaxInteraction[_0x2db8('0x10')](e,emitEvent(event));}}module[_0x2db8('0x11')]=FaxInteractionEvents; \ No newline at end of file +var _0x9c21=['hasOwnProperty','events','../../mysqldb','setMaxListeners','update','remove','getUsers','then','setDataValue','Users','length','emit','catch'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x9c21,0x90));var _0x19c2=function(_0x1ce78e,_0x2664a7){_0x1ce78e=_0x1ce78e-0x0;var _0x28c3d6=_0x9c21[_0x1ce78e];return _0x28c3d6;};'use strict';var EventEmitter=require(_0x19c2('0x0'));var FaxInteraction=require(_0x19c2('0x1'))['db']['FaxInteraction'];var FaxMessage=require(_0x19c2('0x1'))['db']['FaxMessage'];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x19c2('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x19c2('0x3'),'afterDestroy':_0x19c2('0x4')};function emitEvent(_0x2d10c9){return function(_0x34dfcd,_0x251d15,_0x50a0b3){_0x34dfcd[_0x19c2('0x5')]({'attributes':['id'],'raw':!![]})[_0x19c2('0x6')](function(_0x3a01eb){_0x34dfcd[_0x19c2('0x7')](_0x19c2('0x8'),_0x3a01eb['map'](function(_0x2c0728){return{'id':_0x2c0728['id']};}));return FaxMessage['findAll']({'where':{'FaxInteractionId':_0x34dfcd['id'],'direction':'in','read':![]},'raw':!![]});})[_0x19c2('0x6')](function(_0x19b318){_0x34dfcd['setDataValue']('unreadMessages',_0x19b318[_0x19c2('0x9')]);FaxInteractionEvents[_0x19c2('0xa')](_0x2d10c9+':'+_0x34dfcd['id'],_0x34dfcd);FaxInteractionEvents[_0x19c2('0xa')](_0x2d10c9,_0x34dfcd);_0x50a0b3(null);})[_0x19c2('0xb')](_0x50a0b3(null));};}for(var e in events){if(events[_0x19c2('0xc')](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module['exports']=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index 0a7036e..992857e 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 _0x7d9b=['rimraf','./faxInteraction.attributes','exports','define','fax_interactions','changed','closed','closedAt','format','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x45b190,_0x6297da){var _0x46234d=function(_0x41f5ad){while(--_0x41f5ad){_0x45b190['push'](_0x45b190['shift']());}};_0x46234d(++_0x6297da);}(_0x7d9b,0x126));var _0xb7d9=function(_0x353bbb,_0x56e1ab){_0x353bbb=_0x353bbb-0x0;var _0x4e6a0e=_0x7d9b[_0x353bbb];return _0x4e6a0e;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xb7d9('0x0'))(_0xb7d9('0x1'));var moment=require(_0xb7d9('0x2'));var BPromise=require(_0xb7d9('0x3'));var rp=require(_0xb7d9('0x4'));var fs=require('fs');var path=require(_0xb7d9('0x5'));var rimraf=require(_0xb7d9('0x6'));var config=require('../../config/environment');var attributes=require(_0xb7d9('0x7'));module[_0xb7d9('0x8')]=function(_0x46f95c,_0x51a26c){return _0x46f95c[_0xb7d9('0x9')]('FaxInteraction',attributes,{'tableName':_0xb7d9('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1a9a50,_0xc731f1,_0x252b9d){if(_0x1a9a50[_0xb7d9('0xb')](_0xb7d9('0xc'))){_0x1a9a50[_0xb7d9('0xd')]=moment()[_0xb7d9('0xe')]('YYYY-MM-DD\x20HH:mm:ss');}_0x252b9d(null,_0x1a9a50);}}});}; \ No newline at end of file +var _0x94a6=['bluebird','path','rimraf','../../config/environment','./faxInteraction.attributes','exports','define','FaxInteraction','changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','util','api'];(function(_0x4fe781,_0x131965){var _0x28f3b2=function(_0x5a22ab){while(--_0x5a22ab){_0x4fe781['push'](_0x4fe781['shift']());}};_0x28f3b2(++_0x131965);}(_0x94a6,0x1ec));var _0x694a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x94a6[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x694a('0x0'));var util=require(_0x694a('0x1'));var logger=require('../../config/logger')(_0x694a('0x2'));var moment=require('moment');var BPromise=require(_0x694a('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x694a('0x4'));var rimraf=require(_0x694a('0x5'));var config=require(_0x694a('0x6'));var attributes=require(_0x694a('0x7'));module[_0x694a('0x8')]=function(_0x1910ba,_0x318f90){return _0x1910ba[_0x694a('0x9')](_0x694a('0xa'),attributes,{'tableName':'fax_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3389e2,_0x4ac10e,_0x86cbba){if(_0x3389e2[_0x694a('0xb')](_0x694a('0xc'))){_0x3389e2[_0x694a('0xd')]=moment()['format'](_0x694a('0xe'));}_0x86cbba(null,_0x3389e2);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index a438b4f..6dcdf97 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 _0x53ed=['catch','UpdateFaxInteraction','update','body','options','limit','stringify','FaxInteraction','ids','omit','spread','AddTags','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','register','then','info','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','error','FaxInteraction,\x20%s,\x20%s','message'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x53ed,0x150));var _0xd53e=function(_0x60c642,_0xd270ca){_0x60c642=_0x60c642-0x0;var _0xd32484=_0x53ed[_0x60c642];return _0xd32484;};'use strict';var _=require('lodash');var util=require(_0xd53e('0x0'));var moment=require(_0xd53e('0x1'));var BPromise=require(_0xd53e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd53e('0x3'));var db=require(_0xd53e('0x4'))['db'];var utils=require(_0xd53e('0x5'));var logger=require(_0xd53e('0x6'))(_0xd53e('0x7'));var config=require(_0xd53e('0x8'));var jayson=require(_0xd53e('0x9'));var client=jayson[_0xd53e('0xa')][_0xd53e('0xb')]({'port':0x232a});config['redis']=_['defaults'](config[_0xd53e('0xc')],{'host':_0xd53e('0xd'),'port':0x18eb});var socket=require(_0xd53e('0xe'))(new Redis(config['redis']));require('./faxInteraction.socket')[_0xd53e('0xf')](socket);function respondWithRpcPromise(_0x2375f0,_0x3fc05c,_0x15af7b){return new BPromise(function(_0x5b784b,_0x835df3){return client['request'](_0x2375f0,_0x15af7b)[_0xd53e('0x10')](function(_0x3f5953){logger[_0xd53e('0x11')]('FaxInteraction,\x20%s,\x20%s',_0x3fc05c,_0xd53e('0x12'));logger[_0xd53e('0x13')](_0xd53e('0x14'),_0x3fc05c,_0xd53e('0x12'),JSON['stringify'](_0x3f5953));if(_0x3f5953[_0xd53e('0x15')]){if(_0x3f5953['error']['code']===0x1f4){logger[_0xd53e('0x15')](_0xd53e('0x16'),_0x3fc05c,_0x3f5953[_0xd53e('0x15')][_0xd53e('0x17')]);return _0x835df3(_0x3f5953[_0xd53e('0x15')][_0xd53e('0x17')]);}logger[_0xd53e('0x15')](_0xd53e('0x16'),_0x3fc05c,_0x3f5953[_0xd53e('0x15')]['message']);return _0x5b784b(_0x3f5953[_0xd53e('0x15')][_0xd53e('0x17')]);}else{logger[_0xd53e('0x11')](_0xd53e('0x16'),_0x3fc05c,_0xd53e('0x12'));_0x5b784b(_0x3f5953['result'][_0xd53e('0x17')]);}})[_0xd53e('0x18')](function(_0x573ea5){logger[_0xd53e('0x15')](_0xd53e('0x16'),_0x3fc05c,_0x573ea5);_0x835df3(_0x573ea5);});});}exports[_0xd53e('0x19')]=function(_0x3b4697){var _0x148267=this;return new Promise(function(_0x4c6356,_0x2f1779){return db['FaxInteraction'][_0xd53e('0x1a')](_0x3b4697[_0xd53e('0x1b')],{'raw':_0x3b4697[_0xd53e('0x1c')]?_0x3b4697[_0xd53e('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3b4697['options']?_0x3b4697[_0xd53e('0x1c')]['where']||null:null,'attributes':_0x3b4697[_0xd53e('0x1c')]?_0x3b4697[_0xd53e('0x1c')]['attributes']||null:null,'limit':_0x3b4697[_0xd53e('0x1c')]?_0x3b4697['options'][_0xd53e('0x1d')]||null:null})['then'](function(_0x204899){logger[_0xd53e('0x11')](_0xd53e('0x19'),_0x3b4697);logger[_0xd53e('0x13')]('UpdateFaxInteraction',_0x3b4697,JSON[_0xd53e('0x1e')](_0x204899));_0x4c6356(_0x204899);})[_0xd53e('0x18')](function(_0x19d627){logger[_0xd53e('0x15')](_0xd53e('0x19'),_0x19d627[_0xd53e('0x17')],_0x3b4697);_0x2f1779(_0x148267['error'](0x1f4,_0x19d627[_0xd53e('0x17')]));});});};exports['AddTagsToFaxInteraction']=function(_0x14fda1){return new Promise(function(_0x3fb945,_0x526611){return db[_0xd53e('0x1f')]['find']({'where':_0x14fda1[_0xd53e('0x1c')]?_0x14fda1[_0xd53e('0x1c')]['where']||null:null})[_0xd53e('0x10')](function(_0x470018){if(_0x470018){return _0x470018['addTags'](_0x14fda1['body'][_0xd53e('0x20')],_[_0xd53e('0x21')](_0x14fda1[_0xd53e('0x1b')],[_0xd53e('0x20'),'id'])||{});}})[_0xd53e('0x22')](function(_0x51a1b2){logger[_0xd53e('0x11')](_0xd53e('0x23'),_0x14fda1);logger['debug'](_0xd53e('0x23'),_0x14fda1,JSON[_0xd53e('0x1e')](_0x51a1b2));_0x3fb945(_0x51a1b2);})[_0xd53e('0x18')](function(_0x5ed127){logger['error'](_0xd53e('0x23'),_0x5ed127[_0xd53e('0x17')],_0x14fda1);_0x526611(_this[_0xd53e('0x15')](0x1f4,_0x5ed127['message']));});});}; \ No newline at end of file +var _0xb823=['AddTagsToFaxInteraction','addTags','ids','omit','body','spread','AddTags','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','register','then','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','UpdateFaxInteraction','FaxInteraction','update','options','raw','where','attributes','limit'];(function(_0x4154a6,_0x2c0b8e){var _0x3b2786=function(_0x2f5936){while(--_0x2f5936){_0x4154a6['push'](_0x4154a6['shift']());}};_0x3b2786(++_0x2c0b8e);}(_0xb823,0xf7));var _0x3b82=function(_0xbf1875,_0x34b144){_0xbf1875=_0xbf1875-0x0;var _0x2e598b=_0xb823[_0xbf1875];return _0x2e598b;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3b82('0x0'));var BPromise=require(_0x3b82('0x1'));var rs=require(_0x3b82('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x3b82('0x3'));var logger=require(_0x3b82('0x4'))(_0x3b82('0x5'));var config=require(_0x3b82('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x3b82('0x7')][_0x3b82('0x8')]({'port':0x232a});config[_0x3b82('0x9')]=_[_0x3b82('0xa')](config[_0x3b82('0x9')],{'host':_0x3b82('0xb'),'port':0x18eb});var socket=require(_0x3b82('0xc'))(new Redis(config[_0x3b82('0x9')]));require('./faxInteraction.socket')[_0x3b82('0xd')](socket);function respondWithRpcPromise(_0x223f5b,_0x252446,_0x483df1){return new BPromise(function(_0x38d937,_0x2e5e87){return client['request'](_0x223f5b,_0x483df1)[_0x3b82('0xe')](function(_0x46c9cc){logger[_0x3b82('0xf')](_0x3b82('0x10'),_0x252446,_0x3b82('0x11'));logger[_0x3b82('0x12')]('FaxInteraction,\x20%s,\x20%s,\x20%s',_0x252446,_0x3b82('0x11'),JSON[_0x3b82('0x13')](_0x46c9cc));if(_0x46c9cc[_0x3b82('0x14')]){if(_0x46c9cc[_0x3b82('0x14')][_0x3b82('0x15')]===0x1f4){logger[_0x3b82('0x14')](_0x3b82('0x10'),_0x252446,_0x46c9cc[_0x3b82('0x14')][_0x3b82('0x16')]);return _0x2e5e87(_0x46c9cc[_0x3b82('0x14')][_0x3b82('0x16')]);}logger[_0x3b82('0x14')](_0x3b82('0x10'),_0x252446,_0x46c9cc[_0x3b82('0x14')][_0x3b82('0x16')]);return _0x38d937(_0x46c9cc['error'][_0x3b82('0x16')]);}else{logger[_0x3b82('0xf')](_0x3b82('0x10'),_0x252446,_0x3b82('0x11'));_0x38d937(_0x46c9cc[_0x3b82('0x17')][_0x3b82('0x16')]);}})[_0x3b82('0x18')](function(_0x3c27fb){logger[_0x3b82('0x14')](_0x3b82('0x10'),_0x252446,_0x3c27fb);_0x2e5e87(_0x3c27fb);});});}exports[_0x3b82('0x19')]=function(_0x2b3ae9){var _0x3d7ba7=this;return new Promise(function(_0x29424b,_0x425785){return db[_0x3b82('0x1a')][_0x3b82('0x1b')](_0x2b3ae9['body'],{'raw':_0x2b3ae9['options']?_0x2b3ae9[_0x3b82('0x1c')][_0x3b82('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2b3ae9['options']?_0x2b3ae9[_0x3b82('0x1c')][_0x3b82('0x1e')]||null:null,'attributes':_0x2b3ae9[_0x3b82('0x1c')]?_0x2b3ae9[_0x3b82('0x1c')][_0x3b82('0x1f')]||null:null,'limit':_0x2b3ae9[_0x3b82('0x1c')]?_0x2b3ae9[_0x3b82('0x1c')][_0x3b82('0x20')]||null:null})[_0x3b82('0xe')](function(_0x4de4ba){logger['info'](_0x3b82('0x19'),_0x2b3ae9);logger[_0x3b82('0x12')]('UpdateFaxInteraction',_0x2b3ae9,JSON[_0x3b82('0x13')](_0x4de4ba));_0x29424b(_0x4de4ba);})[_0x3b82('0x18')](function(_0xac78f5){logger[_0x3b82('0x14')](_0x3b82('0x19'),_0xac78f5[_0x3b82('0x16')],_0x2b3ae9);_0x425785(_0x3d7ba7[_0x3b82('0x14')](0x1f4,_0xac78f5['message']));});});};exports[_0x3b82('0x21')]=function(_0x4be5a0){return new Promise(function(_0x3b1b54,_0x149b32){return db[_0x3b82('0x1a')]['find']({'where':_0x4be5a0[_0x3b82('0x1c')]?_0x4be5a0['options']['where']||null:null})[_0x3b82('0xe')](function(_0xde34fa){if(_0xde34fa){return _0xde34fa[_0x3b82('0x22')](_0x4be5a0['body'][_0x3b82('0x23')],_[_0x3b82('0x24')](_0x4be5a0[_0x3b82('0x25')],[_0x3b82('0x23'),'id'])||{});}})[_0x3b82('0x26')](function(_0x3c4911){logger[_0x3b82('0xf')](_0x3b82('0x27'),_0x4be5a0);logger['debug'](_0x3b82('0x27'),_0x4be5a0,JSON['stringify'](_0x3c4911));_0x3b1b54(_0x3c4911);})[_0x3b82('0x18')](function(_0x183d96){logger[_0x3b82('0x14')](_0x3b82('0x27'),_0x183d96['message'],_0x4be5a0);_0x149b32(_this['error'](0x1f4,_0x183d96[_0x3b82('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index 6d528c5..ee655b1 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 _0x5eb5=['emit','register','faxInteraction:','./faxInteraction.events','save','remove'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x5eb5,0x6f));var _0x55eb=function(_0x324cae,_0xe00746){_0x324cae=_0x324cae-0x0;var _0x24ddd3=_0x5eb5[_0x324cae];return _0x24ddd3;};'use strict';var FaxInteractionEvents=require(_0x55eb('0x0'));var events=[_0x55eb('0x1'),_0x55eb('0x2'),'update'];function createListener(_0x2d1930,_0x4b4a56){return function(_0x2c774b){_0x4b4a56[_0x55eb('0x3')](_0x2d1930,_0x2c774b);};}function removeListener(_0x2e9e74,_0x526a95){return function(){FaxInteractionEvents['removeListener'](_0x2e9e74,_0x526a95);};}exports[_0x55eb('0x4')]=function(_0x25c41f){for(var _0xa7dbe2=0x0,_0x1632be=events['length'];_0xa7dbe2<_0x1632be;_0xa7dbe2++){var _0x538883=events[_0xa7dbe2];var _0x71e378=createListener(_0x55eb('0x5')+_0x538883,_0x25c41f);FaxInteractionEvents['on'](_0x538883,_0x71e378);}}; \ No newline at end of file +var _0x02dc=['register','length','faxInteraction:','./faxInteraction.events','save','emit'];(function(_0x285e32,_0xade1ae){var _0x11a12c=function(_0x55d1f5){while(--_0x55d1f5){_0x285e32['push'](_0x285e32['shift']());}};_0x11a12c(++_0xade1ae);}(_0x02dc,0x1cb));var _0xc02d=function(_0x4777e8,_0x35dc64){_0x4777e8=_0x4777e8-0x0;var _0x1cb084=_0x02dc[_0x4777e8];return _0x1cb084;};'use strict';var FaxInteractionEvents=require(_0xc02d('0x0'));var events=[_0xc02d('0x1'),'remove','update'];function createListener(_0x45dffd,_0x4a13d5){return function(_0x3b3cfb){_0x4a13d5[_0xc02d('0x2')](_0x45dffd,_0x3b3cfb);};}function removeListener(_0x4f86dc,_0x5c6bc7){return function(){FaxInteractionEvents['removeListener'](_0x4f86dc,_0x5c6bc7);};}exports[_0xc02d('0x3')]=function(_0x3b58ad){for(var _0x5e6124=0x0,_0x2692db=events[_0xc02d('0x4')];_0x5e6124<_0x2692db;_0x5e6124++){var _0x392734=events[_0x5e6124];var _0x354c14=createListener(_0xc02d('0x5')+_0x392734,_0x3b58ad);FaxInteractionEvents['on'](_0x392734,_0x354c14);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index 797ca71..5f407a4 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 _0xe700=['/:id/messages','getMessages','download','post','addMessage','tracked','fax','addTags','put','update','delete','faxinteraction:destroy','destroy','/:id/tags','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show'];(function(_0x229f3e,_0x17b958){var _0x58da80=function(_0x579c4a){while(--_0x579c4a){_0x229f3e['push'](_0x229f3e['shift']());}};_0x58da80(++_0x17b958);}(_0xe700,0xf7));var _0x0e70=function(_0x5a8e61,_0x4498a3){_0x5a8e61=_0x5a8e61-0x0;var _0x535298=_0xe700[_0x5a8e61];return _0x535298;};'use strict';var multer=require(_0x0e70('0x0'));var util=require(_0x0e70('0x1'));var path=require(_0x0e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x0e70('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x0e70('0x4'));var interaction=require(_0x0e70('0x5'));var config=require(_0x0e70('0x6'));var controller=require('./faxInteraction.controller');router[_0x0e70('0x7')]('/',auth[_0x0e70('0x8')](),controller[_0x0e70('0x9')]);router[_0x0e70('0x7')](_0x0e70('0xa'),auth[_0x0e70('0x8')](),controller[_0x0e70('0xb')]);router[_0x0e70('0x7')](_0x0e70('0xc'),auth[_0x0e70('0x8')](),controller[_0x0e70('0xd')]);router[_0x0e70('0x7')](_0x0e70('0xe'),auth[_0x0e70('0x8')](),controller[_0x0e70('0xf')]);router[_0x0e70('0x7')]('/:id/download',auth['isAuthenticated'](),controller[_0x0e70('0x10')]);router['post']('/',auth[_0x0e70('0x8')](),controller['create']);router[_0x0e70('0x11')](_0x0e70('0xe'),auth['isAuthenticated'](),controller[_0x0e70('0x12')]);router[_0x0e70('0x11')]('/:id/tags',auth[_0x0e70('0x8')](),interaction[_0x0e70('0x13')](_0x0e70('0x14'),'faxinteraction:addtags'),controller[_0x0e70('0x15')]);router[_0x0e70('0x16')]('/:id',auth['isAuthenticated'](),interaction[_0x0e70('0x13')]('fax','faxinteraction:update'),controller[_0x0e70('0x17')]);router[_0x0e70('0x18')](_0x0e70('0xc'),auth['isAuthenticated'](),interaction[_0x0e70('0x13')]('fax',_0x0e70('0x19')),controller[_0x0e70('0x1a')]);router[_0x0e70('0x18')](_0x0e70('0x1b'),auth[_0x0e70('0x8')](),controller['removeTags']);module[_0x0e70('0x1c')]=router; \ No newline at end of file +var _0x75a2=['removeTags','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','/describe','isAuthenticated','describe','show','getMessages','/:id/download','download','post','create','/:id/messages','/:id/tags','fax','faxinteraction:addtags','addTags','put','/:id','tracked','faxinteraction:update','destroy','delete'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x75a2,0x187));var _0x275a=function(_0x4307b8,_0x435dfb){_0x4307b8=_0x4307b8-0x0;var _0x589648=_0x75a2[_0x4307b8];return _0x589648;};'use strict';var multer=require(_0x275a('0x0'));var util=require(_0x275a('0x1'));var path=require(_0x275a('0x2'));var timeout=require('connect-timeout');var express=require(_0x275a('0x3'));var router=express[_0x275a('0x4')]();var fs_extra=require(_0x275a('0x5'));var auth=require(_0x275a('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x275a('0x7'));var controller=require('./faxInteraction.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x275a('0x8')](_0x275a('0x9'),auth[_0x275a('0xa')](),controller[_0x275a('0xb')]);router['get']('/:id',auth[_0x275a('0xa')](),controller[_0x275a('0xc')]);router['get']('/:id/messages',auth['isAuthenticated'](),controller[_0x275a('0xd')]);router[_0x275a('0x8')](_0x275a('0xe'),auth[_0x275a('0xa')](),controller[_0x275a('0xf')]);router[_0x275a('0x10')]('/',auth[_0x275a('0xa')](),controller[_0x275a('0x11')]);router[_0x275a('0x10')](_0x275a('0x12'),auth[_0x275a('0xa')](),controller['addMessage']);router[_0x275a('0x10')](_0x275a('0x13'),auth['isAuthenticated'](),interaction['tracked'](_0x275a('0x14'),_0x275a('0x15')),controller[_0x275a('0x16')]);router[_0x275a('0x17')](_0x275a('0x18'),auth[_0x275a('0xa')](),interaction[_0x275a('0x19')](_0x275a('0x14'),_0x275a('0x1a')),controller['update']);router['delete'](_0x275a('0x18'),auth[_0x275a('0xa')](),interaction['tracked'](_0x275a('0x14'),'faxinteraction:destroy'),controller[_0x275a('0x1b')]);router[_0x275a('0x1c')]('/:id/tags',auth[_0x275a('0xa')](),controller[_0x275a('0x1d')]);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 3593b88..0799af4 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 _0x94dc=['ENUM','out','DATE','sequelize','TEXT','BOOLEAN'];(function(_0x303735,_0x3883da){var _0x499cf0=function(_0xe6bf40){while(--_0xe6bf40){_0x303735['push'](_0x303735['shift']());}};_0x499cf0(++_0x3883da);}(_0x94dc,0xb1));var _0xc94d=function(_0x13d7fc,_0xffff10){_0x13d7fc=_0x13d7fc-0x0;var _0x38c321=_0x94dc[_0x13d7fc];return _0x38c321;};'use strict';var Sequelize=require(_0xc94d('0x0'));module['exports']={'body':{'type':Sequelize[_0xc94d('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xc94d('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0xc94d('0x3')]('in',_0xc94d('0x4')),'defaultValue':'out','allowNull':![]},'failMessage':{'type':Sequelize[_0xc94d('0x1')],'defaultValue':null},'readAt':{'type':Sequelize[_0xc94d('0x5')]}}; \ No newline at end of file +var _0xda65=['out','DATE','sequelize','exports','TEXT','BOOLEAN','ENUM'];(function(_0x4fd672,_0x52e7bd){var _0x3e395b=function(_0x193e27){while(--_0x193e27){_0x4fd672['push'](_0x4fd672['shift']());}};_0x3e395b(++_0x52e7bd);}(_0xda65,0x1d0));var _0x5da6=function(_0x594a96,_0x3da0d4){_0x594a96=_0x594a96-0x0;var _0x16d013=_0xda65[_0x594a96];return _0x16d013;};'use strict';var Sequelize=require(_0x5da6('0x0'));module[_0x5da6('0x1')]={'body':{'type':Sequelize[_0x5da6('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x5da6('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x5da6('0x4')]('in',_0x5da6('0x5')),'defaultValue':'out','allowNull':![]},'failMessage':{'type':Sequelize['TEXT'],'defaultValue':null},'readAt':{'type':Sequelize[_0x5da6('0x6')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index 5d2bde7..487d5e4 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 _0x67fd=['FaxInteractionId','isNil','interaction','user','role','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','manual','interface','channel','motionChannel','event','EventManager','acceptmessage','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','stringify','RejectMessage','rejectMessage','sequelize','create','CmContact','findOne','Attachment','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','AttachmentId','download','join','root','server','files','attachments','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register','client','http','request','info','request\x20sent','debug','error','code','FaxMessage,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','FaxMessage','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','VIRTUAL','merge','options','include','findAll','show','params','rawAttributes','length','includeAll','body','find','describe','fax-interactions','fax','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','get','FaxInteraction'];(function(_0x2a7791,_0x1fb4d8){var _0x42ce47=function(_0x5c7ceb){while(--_0x5c7ceb){_0x2a7791['push'](_0x2a7791['shift']());}};_0x42ce47(++_0x1fb4d8);}(_0x67fd,0x1dc));var _0xd67f=function(_0x2f59d6,_0x358341){_0x2f59d6=_0x2f59d6-0x0;var _0x408e22=_0x67fd[_0x2f59d6];return _0x408e22;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd67f('0x0'));var zipdir=require(_0xd67f('0x1'));var jsonpatch=require(_0xd67f('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xd67f('0x3'));var Mustache=require(_0xd67f('0x4'));var util=require(_0xd67f('0x5'));var path=require(_0xd67f('0x6'));var sox=require(_0xd67f('0x7'));var csv=require('to-csv');var ejs=require(_0xd67f('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd67f('0x9'));var squel=require('squel');var crypto=require(_0xd67f('0xa'));var jsforce=require(_0xd67f('0xb'));var deskjs=require(_0xd67f('0xc'));var toCsv=require(_0xd67f('0xd'));var querystring=require(_0xd67f('0xe'));var Papa=require(_0xd67f('0xf'));var Redis=require(_0xd67f('0x10'));var authService=require(_0xd67f('0x11'));var qs=require(_0xd67f('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd67f('0x13'));var logger=require(_0xd67f('0x14'))(_0xd67f('0x15'));var utils=require('../../config/utils');var config=require(_0xd67f('0x16'));var licenseUtil=require(_0xd67f('0x17'));var db=require('../../mysqldb')['db'];config[_0xd67f('0x18')]=_[_0xd67f('0x19')](config[_0xd67f('0x18')],{'host':_0xd67f('0x1a'),'port':0x18eb});var socket=require(_0xd67f('0x1b'))(new Redis(config[_0xd67f('0x18')]));require(_0xd67f('0x1c'))[_0xd67f('0x1d')](socket);var jayson=require('jayson/promise');var client=jayson[_0xd67f('0x1e')][_0xd67f('0x1f')]({'port':0x232c});var client9002=jayson[_0xd67f('0x1e')][_0xd67f('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x25dc3c,_0x41662f,_0x133089,_0x4b8ca9){return new BPromise(function(_0x20eb0a,_0x6f276){var _0x226d44=_0x4b8ca9||client;return _0x226d44[_0xd67f('0x20')](_0x25dc3c,_0x133089)['then'](function(_0x34cbcc){logger[_0xd67f('0x21')]('FaxMessage,\x20%s,\x20%s',_0x41662f,_0xd67f('0x22'));logger[_0xd67f('0x23')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x41662f,'request\x20sent',JSON['stringify'](_0x34cbcc));if(_0x34cbcc['error']){if(_0x34cbcc[_0xd67f('0x24')][_0xd67f('0x25')]===0x1f4){logger['error'](_0xd67f('0x26'),_0x41662f,_0x34cbcc[_0xd67f('0x24')]['message']);return _0x6f276(_0x34cbcc[_0xd67f('0x24')]['message']);}logger[_0xd67f('0x24')](_0xd67f('0x26'),_0x41662f,_0x34cbcc[_0xd67f('0x24')][_0xd67f('0x27')]);return _0x20eb0a(_0x34cbcc[_0xd67f('0x24')]['message']);}else{logger[_0xd67f('0x21')](_0xd67f('0x26'),_0x41662f,_0xd67f('0x22'));_0x20eb0a(_0x34cbcc[_0xd67f('0x28')][_0xd67f('0x27')]);}})[_0xd67f('0x29')](function(_0x3e43b7){logger[_0xd67f('0x24')](_0xd67f('0x26'),_0x41662f,_0x3e43b7);_0x6f276(_0x3e43b7);});});}function respondWithStatusCode(_0x2a4d7d,_0x51c1cf){_0x51c1cf=_0x51c1cf||0xcc;return function(_0x1735ab){if(_0x1735ab){return _0x2a4d7d[_0xd67f('0x2a')](_0x51c1cf);}return _0x2a4d7d[_0xd67f('0x2b')](_0x51c1cf)[_0xd67f('0x2c')]();};}function respondWithResult(_0x331c69,_0x5c3116){_0x5c3116=_0x5c3116||0xc8;return function(_0x5a63a2){if(_0x5a63a2){return _0x331c69[_0xd67f('0x2b')](_0x5c3116)[_0xd67f('0x2d')](_0x5a63a2);}};}function respondWithFilteredResult(_0x288abd,_0x5b93a9){return function(_0x1973c4){if(_0x1973c4){var _0x41e183=typeof _0x5b93a9[_0xd67f('0x2e')]==='undefined'&&typeof _0x5b93a9['limit']===_0xd67f('0x2f');var _0x3cf6ab=_0x1973c4['count'];var _0x231402=_0x41e183?0x0:_0x5b93a9[_0xd67f('0x2e')];var _0x4e7a93=_0x41e183?_0x1973c4[_0xd67f('0x30')]:_0x5b93a9['offset']+_0x5b93a9[_0xd67f('0x31')];var _0x2c7791;if(_0x4e7a93>=_0x3cf6ab){_0x4e7a93=_0x3cf6ab;_0x2c7791=0xc8;}else{_0x2c7791=0xce;}_0x288abd[_0xd67f('0x2b')](_0x2c7791);return _0x288abd[_0xd67f('0x32')](_0xd67f('0x33'),_0x231402+'-'+_0x4e7a93+'/'+_0x3cf6ab)[_0xd67f('0x2d')](_0x1973c4);}return null;};}function patchUpdates(_0x53ebd4){return function(_0x3f1be1){try{jsonpatch[_0xd67f('0x34')](_0x3f1be1,_0x53ebd4,!![]);}catch(_0x168f82){return BPromise[_0xd67f('0x35')](_0x168f82);}return _0x3f1be1[_0xd67f('0x36')]();};}function saveUpdates(_0x4a0ad0,_0x5233b3){return function(_0x22dcbf){if(_0x22dcbf){return _0x22dcbf[_0xd67f('0x37')](_0x4a0ad0)[_0xd67f('0x38')](function(_0x826fb5){return _0x826fb5;});}return null;};}function removeEntity(_0x137746,_0x6285eb){return function(_0x579c26){if(_0x579c26){return _0x579c26[_0xd67f('0x39')]()[_0xd67f('0x38')](function(){_0x137746[_0xd67f('0x2b')](0xcc)[_0xd67f('0x2c')]();});}};}function handleEntityNotFound(_0x46aaca,_0x1417d8){return function(_0x57ccd2){if(!_0x57ccd2){_0x46aaca['sendStatus'](0x194);}return _0x57ccd2;};}function handleError(_0x9b8ea3,_0x1285f5){_0x1285f5=_0x1285f5||0x1f4;return function(_0x19ccba){logger['error'](_0x19ccba[_0xd67f('0x3a')]);if(_0x19ccba[_0xd67f('0x3b')]){delete _0x19ccba['name'];}_0x9b8ea3[_0xd67f('0x2b')](_0x1285f5)[_0xd67f('0x3c')](_0x19ccba);};}exports[_0xd67f('0x3d')]=function(_0x15e1ae,_0x46b29e){var _0x117aee={},_0x4e7a6a={},_0x1717cc={'count':0x0,'rows':[]};var _0xf43dbb=_[_0xd67f('0x3e')](db[_0xd67f('0x3f')]['rawAttributes'],function(_0x25e0da){return{'name':_0x25e0da['fieldName'],'type':_0x25e0da[_0xd67f('0x40')]['key']};});_0x4e7a6a[_0xd67f('0x41')]=_[_0xd67f('0x3e')](_0xf43dbb,_0xd67f('0x3b'));_0x4e7a6a[_0xd67f('0x42')]=_[_0xd67f('0x43')](_0x15e1ae[_0xd67f('0x42')]);_0x4e7a6a[_0xd67f('0x44')]=_[_0xd67f('0x45')](_0x4e7a6a['model'],_0x4e7a6a[_0xd67f('0x42')]);_0x117aee[_0xd67f('0x46')]=_[_0xd67f('0x45')](_0x4e7a6a[_0xd67f('0x41')],qs[_0xd67f('0x47')](_0x15e1ae[_0xd67f('0x42')][_0xd67f('0x47')]));_0x117aee[_0xd67f('0x46')]=_0x117aee[_0xd67f('0x46')]['length']?_0x117aee[_0xd67f('0x46')]:_0x4e7a6a[_0xd67f('0x41')];if(!_0x15e1ae[_0xd67f('0x42')][_0xd67f('0x48')]('nolimit')){_0x117aee['limit']=qs['limit'](_0x15e1ae[_0xd67f('0x42')][_0xd67f('0x31')]);_0x117aee[_0xd67f('0x2e')]=qs[_0xd67f('0x2e')](_0x15e1ae[_0xd67f('0x42')]['offset']);}_0x117aee[_0xd67f('0x49')]=qs[_0xd67f('0x4a')](_0x15e1ae['query']['sort']);_0x117aee[_0xd67f('0x4b')]=qs['filters'](_[_0xd67f('0x4c')](_0x15e1ae[_0xd67f('0x42')],_0x4e7a6a[_0xd67f('0x44')]),_0xf43dbb);if(_0x15e1ae[_0xd67f('0x42')]['filter']){_0x117aee[_0xd67f('0x4b')]=_['merge'](_0x117aee[_0xd67f('0x4b')],{'$or':_[_0xd67f('0x3e')](_0xf43dbb,function(_0x3313b9){if(_0x3313b9[_0xd67f('0x40')]!==_0xd67f('0x4d')){var _0x5a6f61={};_0x5a6f61[_0x3313b9['name']]={'$like':'%'+_0x15e1ae[_0xd67f('0x42')]['filter']+'%'};return _0x5a6f61;}})});}_0x117aee=_[_0xd67f('0x4e')]({},_0x117aee,_0x15e1ae[_0xd67f('0x4f')]);var _0x53d885={'where':_0x117aee['where']};return db[_0xd67f('0x3f')]['count'](_0x53d885)[_0xd67f('0x38')](function(_0x27cc3f){_0x1717cc[_0xd67f('0x30')]=_0x27cc3f;if(_0x15e1ae[_0xd67f('0x42')]['includeAll']){_0x117aee[_0xd67f('0x50')]=[{'all':!![]}];}return db['FaxMessage'][_0xd67f('0x51')](_0x117aee);})['then'](function(_0x163211){_0x1717cc['rows']=_0x163211;return _0x1717cc;})[_0xd67f('0x38')](respondWithFilteredResult(_0x46b29e,_0x117aee))[_0xd67f('0x29')](handleError(_0x46b29e,null));};exports[_0xd67f('0x52')]=function(_0x5ec330,_0x311663){var _0x663f30={'raw':!![],'where':{'id':_0x5ec330[_0xd67f('0x53')]['id']}},_0x439ec4={};_0x439ec4['model']=_[_0xd67f('0x43')](db[_0xd67f('0x3f')][_0xd67f('0x54')]);_0x439ec4[_0xd67f('0x42')]=_[_0xd67f('0x43')](_0x5ec330[_0xd67f('0x42')]);_0x439ec4[_0xd67f('0x44')]=_[_0xd67f('0x45')](_0x439ec4[_0xd67f('0x41')],_0x439ec4[_0xd67f('0x42')]);_0x663f30[_0xd67f('0x46')]=_[_0xd67f('0x45')](_0x439ec4['model'],qs[_0xd67f('0x47')](_0x5ec330['query'][_0xd67f('0x47')]));_0x663f30[_0xd67f('0x46')]=_0x663f30[_0xd67f('0x46')][_0xd67f('0x55')]?_0x663f30[_0xd67f('0x46')]:_0x439ec4[_0xd67f('0x41')];if(_0x5ec330[_0xd67f('0x42')][_0xd67f('0x56')]){_0x663f30[_0xd67f('0x50')]=[{'all':!![]}];}_0x663f30=_[_0xd67f('0x4e')]({},_0x663f30,_0x5ec330['options']);return db[_0xd67f('0x3f')]['find'](_0x663f30)[_0xd67f('0x38')](handleEntityNotFound(_0x311663,null))[_0xd67f('0x38')](respondWithResult(_0x311663,null))[_0xd67f('0x29')](handleError(_0x311663,null));};exports[_0xd67f('0x37')]=function(_0x5e23f7,_0x50e0f7){if(_0x5e23f7[_0xd67f('0x57')]['id']){delete _0x5e23f7[_0xd67f('0x57')]['id'];}return db[_0xd67f('0x3f')][_0xd67f('0x58')]({'where':{'id':_0x5e23f7['params']['id']}})[_0xd67f('0x38')](handleEntityNotFound(_0x50e0f7,null))[_0xd67f('0x38')](saveUpdates(_0x5e23f7[_0xd67f('0x57')],null))[_0xd67f('0x38')](respondWithResult(_0x50e0f7,null))['catch'](handleError(_0x50e0f7,null));};exports[_0xd67f('0x39')]=function(_0x2a8e3c,_0x53154a){return db[_0xd67f('0x3f')]['find']({'where':{'id':_0x2a8e3c[_0xd67f('0x53')]['id']}})[_0xd67f('0x38')](handleEntityNotFound(_0x53154a,null))[_0xd67f('0x38')](removeEntity(_0x53154a,null))[_0xd67f('0x29')](handleError(_0x53154a,null));};exports[_0xd67f('0x59')]=function(_0x3b7560,_0xcf1535){return db['FaxMessage']['describe']()[_0xd67f('0x38')](respondWithResult(_0xcf1535,null))[_0xd67f('0x29')](handleError(_0xcf1535,null));};var interaction_log=require(_0xd67f('0x14'))(_0xd67f('0x5a'));exports['accept']=function(_0x11ce47,_0x1e3584,_0x25d002){var _0x5a32ee={'agent':{},'channel':_0xd67f('0x5b')};if(_0x11ce47[_0xd67f('0x57')]['id']){delete _0x11ce47[_0xd67f('0x57')]['id'];}_0x11ce47['body'][_0xd67f('0x5c')]=!![];_0x11ce47['body'][_0xd67f('0x5d')]=moment()[_0xd67f('0x5e')](_0xd67f('0x5f'));_0x11ce47[_0xd67f('0x57')][_0xd67f('0x60')]=_0x11ce47[_0xd67f('0x57')][_0xd67f('0x60')]||_0x11ce47['user']['id'];_0x5a32ee[_0xd67f('0x61')]['id']=_0x11ce47['body'][_0xd67f('0x60')];return db['FaxMessage'][_0xd67f('0x58')]({'where':{'id':_0x11ce47[_0xd67f('0x53')]['id'],'UserId':null}})[_0xd67f('0x38')](handleEntityNotFound(_0x1e3584,null))[_0xd67f('0x38')](saveUpdates(_0x11ce47['body'],null))[_0xd67f('0x38')](function(_0x4e240d){if(_0x4e240d){_0x5a32ee[_0xd67f('0x27')]=_0x4e240d[_0xd67f('0x62')]({'plain':!![]});return db[_0xd67f('0x63')][_0xd67f('0x58')]({'where':{'id':_0x4e240d[_0xd67f('0x64')]}});}return null;})[_0xd67f('0x38')](handleEntityNotFound(_0x1e3584,null))['then'](function(_0x245ac6){if(_0x245ac6){return _0x245ac6[_0xd67f('0x37')]({'UserId':_0x11ce47[_0xd67f('0x57')][_0xd67f('0x60')],'read1stAt':_[_0xd67f('0x65')](_0x245ac6['read1stAt'])?moment()['format'](_0xd67f('0x5f')):undefined});}return null;})['then'](function(_0x433a05){if(_0x433a05){_0x5a32ee[_0xd67f('0x66')]=_0x433a05[_0xd67f('0x62')]({'plain':!![]});interaction_log['info']('[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x11ce47['user']['id'],_0x11ce47[_0xd67f('0x67')][_0xd67f('0x3b')],_0x11ce47['user'][_0xd67f('0x68')],_0x5a32ee[_0xd67f('0x66')]['id'],_0x11ce47[_0xd67f('0x57')]?JSON['stringify'](_0x11ce47[_0xd67f('0x57')]):_0xd67f('0x69'));return respondWithRpcPromise('AcceptMessage',_0xd67f('0x6a'),_0x5a32ee);}return null;})['then'](function(_0x57bc6c){var _0x239390=_0xd67f('0x6b')+_0x57bc6c[_0xd67f('0x27')][_0xd67f('0x6c')];return db['sequelize']['query'](_0x239390,{'type':db[_0xd67f('0x6d')][_0xd67f('0x6e')][_0xd67f('0x6f')],'raw':!![]})['then'](function(_0x3f577b){return _0x3f577b;});})[_0xd67f('0x38')](function(_0x51f3da){if(_0x51f3da){_0x5a32ee[_0xd67f('0x27')][_0xd67f('0x70')]=_0x51f3da[0x0];if(!_0x11ce47['body'][_0xd67f('0x60')])return;return db[_0xd67f('0x71')][_0xd67f('0x58')]({'where':{'id':_0x11ce47[_0xd67f('0x57')][_0xd67f('0x60')],'role':_0xd67f('0x61')},'attributes':['id',_0xd67f('0x3b'),_0xd67f('0x72'),_0xd67f('0x73'),_0xd67f('0x74')],'raw':!![]});}return null;})[_0xd67f('0x38')](function(_0x111eac){if(!_0x111eac)return null;_0x5a32ee[_0xd67f('0x27')][_0xd67f('0x61')]=_0x111eac;return _0x5a32ee;})[_0xd67f('0x38')](function(_0x51e3c3){if(_0x51e3c3){if(_0x11ce47['body'][_0xd67f('0x75')]){_0x5a32ee['message'][_0xd67f('0x76')]=util['format']('SIP/%s',_0x11ce47['user'][_0xd67f('0x3b')]);_0x5a32ee[_0xd67f('0x27')][_0xd67f('0x77')]=_0x5a32ee[_0xd67f('0x77')];_0x5a32ee[_0xd67f('0x27')][_0xd67f('0x78')]=_0x5a32ee[_0xd67f('0x77')];_0x5a32ee[_0xd67f('0x27')][_0xd67f('0x79')]='accept';return respondWithRpcPromise(_0xd67f('0x7a'),_0xd67f('0x7a'),{'event':_0xd67f('0x7b'),'message':_0x5a32ee[_0xd67f('0x27')]},client9002)[_0xd67f('0x38')](function(){return _0x5a32ee;});}return _0x5a32ee;}return null;})['then'](respondWithResult(_0x1e3584,null))[_0xd67f('0x29')](handleError(_0x1e3584,null));};var interaction_log=require(_0xd67f('0x14'))(_0xd67f('0x5a'));exports[_0xd67f('0x35')]=function(_0x5efbdc,_0x1bbc89,_0x386dca){var _0x24e8e1={'agent':{},'channel':_0xd67f('0x5b')};if(_0x5efbdc['body']['id']){delete _0x5efbdc[_0xd67f('0x57')]['id'];}_0x5efbdc[_0xd67f('0x57')][_0xd67f('0x60')]=_0x5efbdc[_0xd67f('0x57')][_0xd67f('0x60')]||_0x5efbdc['user']['id'];_0x24e8e1['agent']['id']=_0x5efbdc[_0xd67f('0x57')]['UserId'];return db['FaxMessage'][_0xd67f('0x58')]({'where':{'id':_0x5efbdc[_0xd67f('0x53')]['id'],'UserId':null}})[_0xd67f('0x38')](handleEntityNotFound(_0x1bbc89,null))['then'](function(_0x412f1){if(_0x412f1){_0x24e8e1[_0xd67f('0x27')]=_0x412f1['get']({'plain':!![]});return db[_0xd67f('0x63')]['find']({'where':{'id':_0x412f1[_0xd67f('0x64')]}});}return null;})['then'](handleEntityNotFound(_0x1bbc89,null))['then'](function(_0x41d587){if(_0x41d587){_0x24e8e1[_0xd67f('0x66')]=_0x41d587['get']({'plain':!![]});interaction_log[_0xd67f('0x21')](_0xd67f('0x7c'),_0x5efbdc[_0xd67f('0x67')]['id'],_0x5efbdc[_0xd67f('0x67')]['name'],_0x5efbdc[_0xd67f('0x67')][_0xd67f('0x68')],_0x24e8e1[_0xd67f('0x66')]['id'],_0x5efbdc[_0xd67f('0x57')]?JSON[_0xd67f('0x7d')](_0x5efbdc[_0xd67f('0x57')]):_0xd67f('0x69'));return respondWithRpcPromise(_0xd67f('0x7e'),_0xd67f('0x7f'),_0x24e8e1);}return null;})[_0xd67f('0x38')](function(_0x2ed928){var _0x38ce08=_0xd67f('0x6b')+_0x2ed928[_0xd67f('0x27')][_0xd67f('0x6c')];return db[_0xd67f('0x80')][_0xd67f('0x42')](_0x38ce08,{'type':db[_0xd67f('0x6d')][_0xd67f('0x6e')][_0xd67f('0x6f')],'raw':!![]})['then'](function(_0x55d026){return _0x55d026;});})['then'](function(_0x319258){if(_0x319258){_0x24e8e1[_0xd67f('0x27')][_0xd67f('0x70')]=_0x319258[0x0];if(!_0x5efbdc[_0xd67f('0x57')][_0xd67f('0x60')])return;return db[_0xd67f('0x71')][_0xd67f('0x58')]({'where':{'id':_0x5efbdc[_0xd67f('0x57')][_0xd67f('0x60')],'role':_0xd67f('0x61')},'attributes':['id',_0xd67f('0x3b'),_0xd67f('0x72'),_0xd67f('0x73'),_0xd67f('0x74')],'raw':!![]});}return null;})[_0xd67f('0x38')](function(_0x5931fe){if(!_0x5931fe)return null;_0x24e8e1[_0xd67f('0x27')]['agent']=_0x5931fe;return _0x24e8e1;})[_0xd67f('0x38')](function(_0x28422e){if(_0x28422e){_0x28422e['message'][_0xd67f('0x76')]=util[_0xd67f('0x5e')]('SIP/%s',_0x5efbdc[_0xd67f('0x67')][_0xd67f('0x3b')]);_0x28422e[_0xd67f('0x27')]['channel']=_0x24e8e1[_0xd67f('0x77')];_0x28422e[_0xd67f('0x27')][_0xd67f('0x78')]=_0x24e8e1['channel'];_0x28422e[_0xd67f('0x27')][_0xd67f('0x79')]='reject';respondWithRpcPromise(_0xd67f('0x7a'),_0xd67f('0x7a'),{'event':'rejectmessage','message':_0x28422e[_0xd67f('0x27')]},client9002);return _0x24e8e1;}return null;})[_0xd67f('0x38')](respondWithResult(_0x1bbc89,null))[_0xd67f('0x29')](handleError(_0x1bbc89,null));};exports[_0xd67f('0x81')]=function(_0x5c83d6,_0x5e7e1d){var _0x578ecc;return db['FaxMessage'][_0xd67f('0x81')](_0x5c83d6[_0xd67f('0x57')],{})['then'](function(_0x1857f2){_0x578ecc=_0x1857f2;return db[_0xd67f('0x82')][_0xd67f('0x83')]({'where':{'id':_0x578ecc[_0xd67f('0x6c')]}});})[_0xd67f('0x38')](function(_0x3984c2){if(_[_0xd67f('0x65')](_0x3984c2)){return;}else{_0x578ecc[_0xd67f('0x5b')]=_0x3984c2[_0xd67f('0x5b')];return db[_0xd67f('0x84')][_0xd67f('0x83')]({'where':{'id':_0x578ecc['AttachmentId']}});}})['then'](function(_0x5059d9){return respondWithRpcPromise(_0xd67f('0x85'),_0xd67f('0x85'),{'FaxAccountId':_['isNil'](_0x5c83d6[_0xd67f('0x57')])?undefined:_0x5c83d6['body'][_0xd67f('0x86')],'path':_[_0xd67f('0x65')](_0x5059d9)?undefined:util[_0xd67f('0x5e')](_0xd67f('0x87'),_0x5059d9[_0xd67f('0x88')]),'fax':_[_0xd67f('0x65')](_0x578ecc[_0xd67f('0x5b')])?undefined:_0x578ecc['fax'],'AttachmentId':_0x578ecc[_0xd67f('0x89')]},client9002);})[_0xd67f('0x38')](respondWithResult(_0x5e7e1d,0xc9))[_0xd67f('0x29')](handleError(_0x5e7e1d,null));};exports[_0xd67f('0x8a')]=function(_0x257279,_0x3f4aab){var _0x4ab14e=path[_0xd67f('0x8b')](config[_0xd67f('0x8c')],_0xd67f('0x8d'),_0xd67f('0x8e'),_0xd67f('0x8f'));return db[_0xd67f('0x3f')]['find']({'where':{'id':_0x257279[_0xd67f('0x53')]['id']},'include':[{'model':db[_0xd67f('0x84')],'as':_0xd67f('0x84')}]})[_0xd67f('0x38')](handleEntityNotFound(_0x3f4aab,null))['then'](function(_0x5557bc){if(_0x5557bc){return _0x3f4aab[_0xd67f('0x8a')](path[_0xd67f('0x8b')](_0x4ab14e,_0x5557bc[_0xd67f('0x84')][_0xd67f('0x88')]));}})[_0xd67f('0x29')](handleError(_0x3f4aab,null));}; \ No newline at end of file +var _0x8114=['AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','contact','User','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','fax-interactions','FaxInteraction','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','Sequelize','fullname','internal','motionChannel','rejectmessage','create','CmContact','findOne','Attachment','AttachmentId','SendFax','basename','join','root','attachments','download','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','status','end','offset','limit','count','set','Content-Range','json','apply','reject','save','update','destroy','sendStatus','stack','name','send','map','FaxMessage','fieldName','type','keys','query','intersection','fields','attributes','model','nolimit','sort','where','filters','pick','merge','options','includeAll','include','rows','catch','show','params','rawAttributes','length','find','body','describe','accept','fax','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','FaxInteractionId','isNil','read1stAt','interaction','role'];(function(_0x208d75,_0x92d742){var _0x382d27=function(_0x3aaba3){while(--_0x3aaba3){_0x208d75['push'](_0x208d75['shift']());}};_0x382d27(++_0x92d742);}(_0x8114,0x145));var _0x4811=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x8114[_0x2d7f0e];return _0x110b07;};'use strict';var emlformat=require(_0x4811('0x0'));var rimraf=require(_0x4811('0x1'));var zipdir=require(_0x4811('0x2'));var jsonpatch=require(_0x4811('0x3'));var rp=require(_0x4811('0x4'));var moment=require(_0x4811('0x5'));var BPromise=require(_0x4811('0x6'));var Mustache=require(_0x4811('0x7'));var util=require('util');var path=require(_0x4811('0x8'));var sox=require(_0x4811('0x9'));var csv=require('to-csv');var ejs=require(_0x4811('0xa'));var fs=require('fs');var fs_extra=require(_0x4811('0xb'));var _=require(_0x4811('0xc'));var squel=require(_0x4811('0xd'));var crypto=require(_0x4811('0xe'));var jsforce=require(_0x4811('0xf'));var deskjs=require(_0x4811('0x10'));var toCsv=require(_0x4811('0x11'));var querystring=require('querystring');var Papa=require(_0x4811('0x12'));var Redis=require(_0x4811('0x13'));var authService=require(_0x4811('0x14'));var qs=require(_0x4811('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4811('0x16'));var logger=require(_0x4811('0x17'))(_0x4811('0x18'));var utils=require(_0x4811('0x19'));var config=require(_0x4811('0x1a'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x4811('0x1b')]=_[_0x4811('0x1c')](config[_0x4811('0x1b')],{'host':_0x4811('0x1d'),'port':0x18eb});var socket=require(_0x4811('0x1e'))(new Redis(config[_0x4811('0x1b')]));require('./faxMessage.socket')[_0x4811('0x1f')](socket);var jayson=require(_0x4811('0x20'));var client=jayson[_0x4811('0x21')][_0x4811('0x22')]({'port':0x232c});var client9002=jayson[_0x4811('0x21')]['http']({'port':0x232a});function respondWithRpcPromise(_0x438b5d,_0x18937d,_0x424147,_0x4179e8){return new BPromise(function(_0x2d6e71,_0x3f227e){var _0x43ee1c=_0x4179e8||client;return _0x43ee1c[_0x4811('0x23')](_0x438b5d,_0x424147)[_0x4811('0x24')](function(_0x25bb02){logger[_0x4811('0x25')](_0x4811('0x26'),_0x18937d,_0x4811('0x27'));logger[_0x4811('0x28')](_0x4811('0x29'),_0x18937d,_0x4811('0x27'),JSON[_0x4811('0x2a')](_0x25bb02));if(_0x25bb02[_0x4811('0x2b')]){if(_0x25bb02[_0x4811('0x2b')][_0x4811('0x2c')]===0x1f4){logger[_0x4811('0x2b')](_0x4811('0x26'),_0x18937d,_0x25bb02[_0x4811('0x2b')][_0x4811('0x2d')]);return _0x3f227e(_0x25bb02[_0x4811('0x2b')][_0x4811('0x2d')]);}logger['error'](_0x4811('0x26'),_0x18937d,_0x25bb02[_0x4811('0x2b')][_0x4811('0x2d')]);return _0x2d6e71(_0x25bb02[_0x4811('0x2b')]['message']);}else{logger[_0x4811('0x25')](_0x4811('0x26'),_0x18937d,_0x4811('0x27'));_0x2d6e71(_0x25bb02[_0x4811('0x2e')][_0x4811('0x2d')]);}})['catch'](function(_0x5c111f){logger[_0x4811('0x2b')]('FaxMessage,\x20%s,\x20%s',_0x18937d,_0x5c111f);_0x3f227e(_0x5c111f);});});}function respondWithStatusCode(_0x234617,_0x12f3d6){_0x12f3d6=_0x12f3d6||0xcc;return function(_0x17a274){if(_0x17a274){return _0x234617['sendStatus'](_0x12f3d6);}return _0x234617[_0x4811('0x2f')](_0x12f3d6)[_0x4811('0x30')]();};}function respondWithResult(_0x1f4fd0,_0xf22f6c){_0xf22f6c=_0xf22f6c||0xc8;return function(_0x4539f0){if(_0x4539f0){return _0x1f4fd0[_0x4811('0x2f')](_0xf22f6c)['json'](_0x4539f0);}};}function respondWithFilteredResult(_0x90928c,_0xc8818){return function(_0x46cb4c){if(_0x46cb4c){var _0x5c538c=typeof _0xc8818[_0x4811('0x31')]==='undefined'&&typeof _0xc8818[_0x4811('0x32')]==='undefined';var _0xed3699=_0x46cb4c[_0x4811('0x33')];var _0xaeceae=_0x5c538c?0x0:_0xc8818[_0x4811('0x31')];var _0x2ae3bb=_0x5c538c?_0x46cb4c[_0x4811('0x33')]:_0xc8818[_0x4811('0x31')]+_0xc8818[_0x4811('0x32')];var _0x27ef0b;if(_0x2ae3bb>=_0xed3699){_0x2ae3bb=_0xed3699;_0x27ef0b=0xc8;}else{_0x27ef0b=0xce;}_0x90928c[_0x4811('0x2f')](_0x27ef0b);return _0x90928c[_0x4811('0x34')](_0x4811('0x35'),_0xaeceae+'-'+_0x2ae3bb+'/'+_0xed3699)[_0x4811('0x36')](_0x46cb4c);}return null;};}function patchUpdates(_0x56aca0){return function(_0x2342c9){try{jsonpatch[_0x4811('0x37')](_0x2342c9,_0x56aca0,!![]);}catch(_0x3186f0){return BPromise[_0x4811('0x38')](_0x3186f0);}return _0x2342c9[_0x4811('0x39')]();};}function saveUpdates(_0x576106,_0x271c32){return function(_0x596d76){if(_0x596d76){return _0x596d76[_0x4811('0x3a')](_0x576106)['then'](function(_0x52ffc9){return _0x52ffc9;});}return null;};}function removeEntity(_0x50385e,_0x16d06b){return function(_0x3c726c){if(_0x3c726c){return _0x3c726c[_0x4811('0x3b')]()[_0x4811('0x24')](function(){_0x50385e[_0x4811('0x2f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4df7e1,_0x121eb6){return function(_0x4fe04d){if(!_0x4fe04d){_0x4df7e1[_0x4811('0x3c')](0x194);}return _0x4fe04d;};}function handleError(_0x2981a5,_0x58d93f){_0x58d93f=_0x58d93f||0x1f4;return function(_0x457817){logger[_0x4811('0x2b')](_0x457817[_0x4811('0x3d')]);if(_0x457817[_0x4811('0x3e')]){delete _0x457817[_0x4811('0x3e')];}_0x2981a5[_0x4811('0x2f')](_0x58d93f)[_0x4811('0x3f')](_0x457817);};}exports['index']=function(_0x105e1d,_0x1cdae5){var _0x769303={},_0x2fa7db={},_0xed11b2={'count':0x0,'rows':[]};var _0x20d629=_[_0x4811('0x40')](db[_0x4811('0x41')]['rawAttributes'],function(_0x5b0947){return{'name':_0x5b0947[_0x4811('0x42')],'type':_0x5b0947[_0x4811('0x43')]['key']};});_0x2fa7db['model']=_[_0x4811('0x40')](_0x20d629,_0x4811('0x3e'));_0x2fa7db['query']=_[_0x4811('0x44')](_0x105e1d[_0x4811('0x45')]);_0x2fa7db['filters']=_[_0x4811('0x46')](_0x2fa7db['model'],_0x2fa7db['query']);_0x769303['attributes']=_[_0x4811('0x46')](_0x2fa7db['model'],qs[_0x4811('0x47')](_0x105e1d[_0x4811('0x45')][_0x4811('0x47')]));_0x769303[_0x4811('0x48')]=_0x769303[_0x4811('0x48')]['length']?_0x769303[_0x4811('0x48')]:_0x2fa7db[_0x4811('0x49')];if(!_0x105e1d[_0x4811('0x45')]['hasOwnProperty'](_0x4811('0x4a'))){_0x769303[_0x4811('0x32')]=qs[_0x4811('0x32')](_0x105e1d['query'][_0x4811('0x32')]);_0x769303[_0x4811('0x31')]=qs['offset'](_0x105e1d['query'][_0x4811('0x31')]);}_0x769303['order']=qs['sort'](_0x105e1d[_0x4811('0x45')][_0x4811('0x4b')]);_0x769303[_0x4811('0x4c')]=qs[_0x4811('0x4d')](_[_0x4811('0x4e')](_0x105e1d['query'],_0x2fa7db[_0x4811('0x4d')]),_0x20d629);if(_0x105e1d[_0x4811('0x45')]['filter']){_0x769303[_0x4811('0x4c')]=_[_0x4811('0x4f')](_0x769303[_0x4811('0x4c')],{'$or':_[_0x4811('0x40')](_0x20d629,function(_0x196b28){if(_0x196b28['type']!=='VIRTUAL'){var _0x144c87={};_0x144c87[_0x196b28[_0x4811('0x3e')]]={'$like':'%'+_0x105e1d[_0x4811('0x45')]['filter']+'%'};return _0x144c87;}})});}_0x769303=_[_0x4811('0x4f')]({},_0x769303,_0x105e1d[_0x4811('0x50')]);var _0x213854={'where':_0x769303[_0x4811('0x4c')]};return db[_0x4811('0x41')][_0x4811('0x33')](_0x213854)[_0x4811('0x24')](function(_0x194826){_0xed11b2[_0x4811('0x33')]=_0x194826;if(_0x105e1d[_0x4811('0x45')][_0x4811('0x51')]){_0x769303[_0x4811('0x52')]=[{'all':!![]}];}return db[_0x4811('0x41')]['findAll'](_0x769303);})[_0x4811('0x24')](function(_0x507a11){_0xed11b2[_0x4811('0x53')]=_0x507a11;return _0xed11b2;})[_0x4811('0x24')](respondWithFilteredResult(_0x1cdae5,_0x769303))[_0x4811('0x54')](handleError(_0x1cdae5,null));};exports[_0x4811('0x55')]=function(_0x319e7b,_0x421288){var _0xbcf306={'raw':!![],'where':{'id':_0x319e7b[_0x4811('0x56')]['id']}},_0x298575={};_0x298575[_0x4811('0x49')]=_[_0x4811('0x44')](db[_0x4811('0x41')][_0x4811('0x57')]);_0x298575[_0x4811('0x45')]=_['keys'](_0x319e7b['query']);_0x298575[_0x4811('0x4d')]=_[_0x4811('0x46')](_0x298575[_0x4811('0x49')],_0x298575['query']);_0xbcf306['attributes']=_[_0x4811('0x46')](_0x298575[_0x4811('0x49')],qs[_0x4811('0x47')](_0x319e7b[_0x4811('0x45')][_0x4811('0x47')]));_0xbcf306[_0x4811('0x48')]=_0xbcf306[_0x4811('0x48')][_0x4811('0x58')]?_0xbcf306['attributes']:_0x298575[_0x4811('0x49')];if(_0x319e7b[_0x4811('0x45')][_0x4811('0x51')]){_0xbcf306['include']=[{'all':!![]}];}_0xbcf306=_[_0x4811('0x4f')]({},_0xbcf306,_0x319e7b[_0x4811('0x50')]);return db['FaxMessage'][_0x4811('0x59')](_0xbcf306)['then'](handleEntityNotFound(_0x421288,null))['then'](respondWithResult(_0x421288,null))[_0x4811('0x54')](handleError(_0x421288,null));};exports[_0x4811('0x3a')]=function(_0x1786aa,_0x15ef45){if(_0x1786aa[_0x4811('0x5a')]['id']){delete _0x1786aa['body']['id'];}return db[_0x4811('0x41')][_0x4811('0x59')]({'where':{'id':_0x1786aa[_0x4811('0x56')]['id']}})[_0x4811('0x24')](handleEntityNotFound(_0x15ef45,null))[_0x4811('0x24')](saveUpdates(_0x1786aa[_0x4811('0x5a')],null))[_0x4811('0x24')](respondWithResult(_0x15ef45,null))['catch'](handleError(_0x15ef45,null));};exports[_0x4811('0x3b')]=function(_0x4680df,_0xac5e39){return db[_0x4811('0x41')][_0x4811('0x59')]({'where':{'id':_0x4680df['params']['id']}})['then'](handleEntityNotFound(_0xac5e39,null))['then'](removeEntity(_0xac5e39,null))[_0x4811('0x54')](handleError(_0xac5e39,null));};exports['describe']=function(_0xf7fc43,_0x212fec){return db['FaxMessage'][_0x4811('0x5b')]()[_0x4811('0x24')](respondWithResult(_0x212fec,null))[_0x4811('0x54')](handleError(_0x212fec,null));};var interaction_log=require('../../config/logger')('fax-interactions');exports[_0x4811('0x5c')]=function(_0x46feb1,_0x171acc,_0x508c53){var _0x589677={'agent':{},'channel':_0x4811('0x5d')};if(_0x46feb1[_0x4811('0x5a')]['id']){delete _0x46feb1[_0x4811('0x5a')]['id'];}_0x46feb1[_0x4811('0x5a')][_0x4811('0x5e')]=!![];_0x46feb1[_0x4811('0x5a')][_0x4811('0x5f')]=moment()[_0x4811('0x60')](_0x4811('0x61'));_0x46feb1[_0x4811('0x5a')][_0x4811('0x62')]=_0x46feb1[_0x4811('0x5a')]['UserId']||_0x46feb1[_0x4811('0x63')]['id'];_0x589677[_0x4811('0x64')]['id']=_0x46feb1[_0x4811('0x5a')][_0x4811('0x62')];return db[_0x4811('0x41')][_0x4811('0x59')]({'where':{'id':_0x46feb1[_0x4811('0x56')]['id'],'UserId':null}})[_0x4811('0x24')](handleEntityNotFound(_0x171acc,null))[_0x4811('0x24')](saveUpdates(_0x46feb1[_0x4811('0x5a')],null))['then'](function(_0x5547c5){if(_0x5547c5){_0x589677[_0x4811('0x2d')]=_0x5547c5[_0x4811('0x65')]({'plain':!![]});return db['FaxInteraction']['find']({'where':{'id':_0x5547c5[_0x4811('0x66')]}});}return null;})[_0x4811('0x24')](handleEntityNotFound(_0x171acc,null))[_0x4811('0x24')](function(_0x597ead){if(_0x597ead){return _0x597ead['update']({'UserId':_0x46feb1[_0x4811('0x5a')][_0x4811('0x62')],'read1stAt':_[_0x4811('0x67')](_0x597ead[_0x4811('0x68')])?moment()[_0x4811('0x60')](_0x4811('0x61')):undefined});}return null;})['then'](function(_0x2144a2){if(_0x2144a2){_0x589677[_0x4811('0x69')]=_0x2144a2['get']({'plain':!![]});interaction_log[_0x4811('0x25')]('[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x46feb1[_0x4811('0x63')]['id'],_0x46feb1[_0x4811('0x63')][_0x4811('0x3e')],_0x46feb1['user'][_0x4811('0x6a')],_0x589677['interaction']['id'],_0x46feb1[_0x4811('0x5a')]?JSON[_0x4811('0x2a')](_0x46feb1[_0x4811('0x5a')]):'null');return respondWithRpcPromise(_0x4811('0x6b'),_0x4811('0x6c'),_0x589677);}return null;})['then'](function(_0x1435cc){var _0x2a5da8=_0x4811('0x6d')+_0x1435cc[_0x4811('0x2d')][_0x4811('0x6e')];return db[_0x4811('0x6f')]['query'](_0x2a5da8,{'type':db['Sequelize'][_0x4811('0x70')]['SELECT'],'raw':!![]})[_0x4811('0x24')](function(_0x57e576){return _0x57e576;});})[_0x4811('0x24')](function(_0x3bd486){if(_0x3bd486){_0x589677[_0x4811('0x2d')][_0x4811('0x71')]=_0x3bd486[0x0];if(!_0x46feb1[_0x4811('0x5a')][_0x4811('0x62')])return;return db[_0x4811('0x72')][_0x4811('0x59')]({'where':{'id':_0x46feb1[_0x4811('0x5a')][_0x4811('0x62')],'role':_0x4811('0x64')},'attributes':['id',_0x4811('0x3e'),'fullname','email','internal'],'raw':!![]});}return null;})[_0x4811('0x24')](function(_0x22df8d){if(!_0x22df8d)return null;_0x589677[_0x4811('0x2d')][_0x4811('0x64')]=_0x22df8d;return _0x589677;})[_0x4811('0x24')](function(_0x31084d){if(_0x31084d){if(_0x46feb1[_0x4811('0x5a')][_0x4811('0x73')]){_0x589677[_0x4811('0x2d')][_0x4811('0x74')]=util[_0x4811('0x60')](_0x4811('0x75'),_0x46feb1[_0x4811('0x63')][_0x4811('0x3e')]);_0x589677[_0x4811('0x2d')][_0x4811('0x76')]=_0x589677[_0x4811('0x76')];_0x589677[_0x4811('0x2d')]['motionChannel']=_0x589677['channel'];_0x589677[_0x4811('0x2d')][_0x4811('0x77')]=_0x4811('0x5c');return respondWithRpcPromise(_0x4811('0x78'),'EventManager',{'event':_0x4811('0x79'),'message':_0x589677[_0x4811('0x2d')]},client9002)[_0x4811('0x24')](function(){return _0x589677;});}return _0x589677;}return null;})['then'](respondWithResult(_0x171acc,null))[_0x4811('0x54')](handleError(_0x171acc,null));};var interaction_log=require(_0x4811('0x17'))(_0x4811('0x7a'));exports[_0x4811('0x38')]=function(_0x4afbd1,_0x288b30,_0x547dca){var _0x36d419={'agent':{},'channel':_0x4811('0x5d')};if(_0x4afbd1['body']['id']){delete _0x4afbd1['body']['id'];}_0x4afbd1[_0x4811('0x5a')][_0x4811('0x62')]=_0x4afbd1['body'][_0x4811('0x62')]||_0x4afbd1[_0x4811('0x63')]['id'];_0x36d419[_0x4811('0x64')]['id']=_0x4afbd1[_0x4811('0x5a')][_0x4811('0x62')];return db[_0x4811('0x41')]['find']({'where':{'id':_0x4afbd1['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x288b30,null))[_0x4811('0x24')](function(_0x2b2910){if(_0x2b2910){_0x36d419[_0x4811('0x2d')]=_0x2b2910[_0x4811('0x65')]({'plain':!![]});return db[_0x4811('0x7b')][_0x4811('0x59')]({'where':{'id':_0x2b2910['FaxInteractionId']}});}return null;})[_0x4811('0x24')](handleEntityNotFound(_0x288b30,null))[_0x4811('0x24')](function(_0x8d8fd2){if(_0x8d8fd2){_0x36d419['interaction']=_0x8d8fd2[_0x4811('0x65')]({'plain':!![]});interaction_log['info'](_0x4811('0x7c'),_0x4afbd1[_0x4811('0x63')]['id'],_0x4afbd1['user']['name'],_0x4afbd1[_0x4811('0x63')]['role'],_0x36d419[_0x4811('0x69')]['id'],_0x4afbd1[_0x4811('0x5a')]?JSON['stringify'](_0x4afbd1[_0x4811('0x5a')]):_0x4811('0x7d'));return respondWithRpcPromise(_0x4811('0x7e'),_0x4811('0x7f'),_0x36d419);}return null;})[_0x4811('0x24')](function(_0x16cb08){var _0x301335=_0x4811('0x6d')+_0x16cb08['message'][_0x4811('0x6e')];return db[_0x4811('0x6f')]['query'](_0x301335,{'type':db[_0x4811('0x80')][_0x4811('0x70')]['SELECT'],'raw':!![]})[_0x4811('0x24')](function(_0x285470){return _0x285470;});})[_0x4811('0x24')](function(_0x2dda56){if(_0x2dda56){_0x36d419[_0x4811('0x2d')][_0x4811('0x71')]=_0x2dda56[0x0];if(!_0x4afbd1[_0x4811('0x5a')][_0x4811('0x62')])return;return db['User'][_0x4811('0x59')]({'where':{'id':_0x4afbd1[_0x4811('0x5a')][_0x4811('0x62')],'role':_0x4811('0x64')},'attributes':['id','name',_0x4811('0x81'),'email',_0x4811('0x82')],'raw':!![]});}return null;})[_0x4811('0x24')](function(_0x2f26fa){if(!_0x2f26fa)return null;_0x36d419[_0x4811('0x2d')][_0x4811('0x64')]=_0x2f26fa;return _0x36d419;})[_0x4811('0x24')](function(_0x4f3aee){if(_0x4f3aee){_0x4f3aee[_0x4811('0x2d')]['interface']=util[_0x4811('0x60')](_0x4811('0x75'),_0x4afbd1[_0x4811('0x63')][_0x4811('0x3e')]);_0x4f3aee[_0x4811('0x2d')]['channel']=_0x36d419[_0x4811('0x76')];_0x4f3aee[_0x4811('0x2d')][_0x4811('0x83')]=_0x36d419[_0x4811('0x76')];_0x4f3aee['message'][_0x4811('0x77')]=_0x4811('0x38');respondWithRpcPromise('EventManager',_0x4811('0x78'),{'event':_0x4811('0x84'),'message':_0x4f3aee['message']},client9002);return _0x36d419;}return null;})[_0x4811('0x24')](respondWithResult(_0x288b30,null))['catch'](handleError(_0x288b30,null));};exports[_0x4811('0x85')]=function(_0x1d4fae,_0x272235){var _0x4eac25;return db['FaxMessage'][_0x4811('0x85')](_0x1d4fae[_0x4811('0x5a')],{})[_0x4811('0x24')](function(_0x502cbe){_0x4eac25=_0x502cbe;return db[_0x4811('0x86')][_0x4811('0x87')]({'where':{'id':_0x4eac25[_0x4811('0x6e')]}});})[_0x4811('0x24')](function(_0x27540d){if(_[_0x4811('0x67')](_0x27540d)){return;}else{_0x4eac25[_0x4811('0x5d')]=_0x27540d[_0x4811('0x5d')];return db[_0x4811('0x88')][_0x4811('0x87')]({'where':{'id':_0x4eac25[_0x4811('0x89')]}});}})[_0x4811('0x24')](function(_0x46bd0a){return respondWithRpcPromise(_0x4811('0x8a'),_0x4811('0x8a'),{'FaxAccountId':_[_0x4811('0x67')](_0x1d4fae[_0x4811('0x5a')])?undefined:_0x1d4fae['body']['FaxAccountId'],'path':_[_0x4811('0x67')](_0x46bd0a)?undefined:util[_0x4811('0x60')]('/var/opt/motion2/server/files/attachments/%s',_0x46bd0a[_0x4811('0x8b')]),'fax':_[_0x4811('0x67')](_0x4eac25[_0x4811('0x5d')])?undefined:_0x4eac25[_0x4811('0x5d')],'AttachmentId':_0x4eac25['AttachmentId']},client9002);})[_0x4811('0x24')](respondWithResult(_0x272235,0xc9))[_0x4811('0x54')](handleError(_0x272235,null));};exports['download']=function(_0xbd6dfa,_0xcb4e08){var _0x6055b3=path[_0x4811('0x8c')](config[_0x4811('0x8d')],'server','files',_0x4811('0x8e'));return db['FaxMessage'][_0x4811('0x59')]({'where':{'id':_0xbd6dfa[_0x4811('0x56')]['id']},'include':[{'model':db[_0x4811('0x88')],'as':_0x4811('0x88')}]})[_0x4811('0x24')](handleEntityNotFound(_0xcb4e08,null))[_0x4811('0x24')](function(_0x200443){if(_0x200443){return _0xcb4e08[_0x4811('0x8f')](path['join'](_0x6055b3,_0x200443['Attachment'][_0x4811('0x8b')]));}})[_0x4811('0x54')](handleError(_0xcb4e08,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index ae56852..c3b51d7 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 _0x2542=['exports','events','../../mysqldb','FaxMessage','setMaxListeners','update','emit','hasOwnProperty','hook'];(function(_0x2747f8,_0xd59b21){var _0x17cf95=function(_0x3d6fa4){while(--_0x3d6fa4){_0x2747f8['push'](_0x2747f8['shift']());}};_0x17cf95(++_0xd59b21);}(_0x2542,0x169));var _0x2254=function(_0x56fd29,_0x17790b){_0x56fd29=_0x56fd29-0x0;var _0x2a0bf7=_0x2542[_0x56fd29];return _0x2a0bf7;};'use strict';var EventEmitter=require(_0x2254('0x0'));var FaxMessage=require(_0x2254('0x1'))['db'][_0x2254('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x2254('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x2254('0x4'),'afterDestroy':'remove'};function emitEvent(_0x4059d1){return function(_0x3b3dcb,_0x27f5c9,_0x456612){FaxMessageEvents[_0x2254('0x5')](_0x4059d1+':'+_0x3b3dcb['id'],_0x3b3dcb);FaxMessageEvents['emit'](_0x4059d1,_0x3b3dcb);_0x456612(null);};}for(var e in events){if(events[_0x2254('0x6')](e)){var event=events[e];FaxMessage[_0x2254('0x7')](e,emitEvent(event));}}module[_0x2254('0x8')]=FaxMessageEvents; \ No newline at end of file +var _0x7b84=['events','../../mysqldb','FaxMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports'];(function(_0x266618,_0x18f637){var _0x54dbf5=function(_0x1f7985){while(--_0x1f7985){_0x266618['push'](_0x266618['shift']());}};_0x54dbf5(++_0x18f637);}(_0x7b84,0x17c));var _0x47b8=function(_0x2ee0be,_0x2bb789){_0x2ee0be=_0x2ee0be-0x0;var _0x3c1eee=_0x7b84[_0x2ee0be];return _0x3c1eee;};'use strict';var EventEmitter=require(_0x47b8('0x0'));var FaxMessage=require(_0x47b8('0x1'))['db'][_0x47b8('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x47b8('0x3')](0x0);var events={'afterCreate':_0x47b8('0x4'),'afterUpdate':_0x47b8('0x5'),'afterDestroy':_0x47b8('0x6')};function emitEvent(_0x5c7cda){return function(_0x445a5f,_0x1fa41a,_0x2279ea){FaxMessageEvents[_0x47b8('0x7')](_0x5c7cda+':'+_0x445a5f['id'],_0x445a5f);FaxMessageEvents[_0x47b8('0x7')](_0x5c7cda,_0x445a5f);_0x2279ea(null);};}for(var e in events){if(events[_0x47b8('0x8')](e)){var event=events[e];FaxMessage['hook'](e,emitEvent(event));}}module[_0x47b8('0x9')]=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index e02217a..69d9bcb 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 _0x6253=['FaxMessage','fax_messages','fti_fax_messages','body','FULLTEXT','get','direction','toLowerCase','out','isNil','UserId','findOne','update','createdAt','catch','error','utf8mb4','util','../../config/logger','moment','path','rimraf','../../config/environment','./faxMessage.attributes','exports','define'];(function(_0xe1b5f6,_0x210c09){var _0x44636e=function(_0x3a3212){while(--_0x3a3212){_0xe1b5f6['push'](_0xe1b5f6['shift']());}};_0x44636e(++_0x210c09);}(_0x6253,0x115));var _0x3625=function(_0xd5f44a,_0x553b62){_0xd5f44a=_0xd5f44a-0x0;var _0x29e55d=_0x6253[_0xd5f44a];return _0x29e55d;};'use strict';var _=require('lodash');var util=require(_0x3625('0x0'));var logger=require(_0x3625('0x1'))('api');var moment=require(_0x3625('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x3625('0x3'));var rimraf=require(_0x3625('0x4'));var config=require(_0x3625('0x5'));var attributes=require(_0x3625('0x6'));module[_0x3625('0x7')]=function(_0x1cb449,_0x357e12){return _0x1cb449[_0x3625('0x8')](_0x3625('0x9'),attributes,{'tableName':_0x3625('0xa'),'paranoid':![],'indexes':[{'name':_0x3625('0xb'),'fields':[_0x3625('0xc')],'type':_0x3625('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x10c13a,_0x26f7a1,_0x4585b4){var _0x29547d=_0x1cb449['models'];var _0x5d72ae=_0x10c13a[_0x3625('0xe')]({'plain':!![]});if(_0x5d72ae[_0x3625('0xf')][_0x3625('0x10')]()==='in'||_0x5d72ae[_0x3625('0xf')]['toLowerCase']()===_0x3625('0x11')&&!_0x5d72ae['secret']&&!_[_0x3625('0x12')](_0x5d72ae[_0x3625('0x13')])){_0x29547d['FaxInteraction'][_0x3625('0x14')]({'where':{'id':_0x5d72ae['FaxInteractionId']}})['then'](function(_0x202c18){if(_0x202c18){_0x202c18[_0x3625('0x15')]({'lastMsgAt':_0x5d72ae[_0x3625('0x16')],'lastMsgDirection':_0x5d72ae[_0x3625('0xf')][_0x3625('0x10')]()});}})[_0x3625('0x17')](function(_0xf64339){console[_0x3625('0x18')](_0xf64339);});}_0x4585b4();}},'charset':_0x3625('0x19'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x12e4=['utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxMessage.attributes','exports','define','FaxMessage','models','direction','toLowerCase','out','secret','isNil','UserId','FaxInteraction','FaxInteractionId','catch','error'];(function(_0x4523bf,_0x4e1fe6){var _0x2458ab=function(_0x3357e4){while(--_0x3357e4){_0x4523bf['push'](_0x4523bf['shift']());}};_0x2458ab(++_0x4e1fe6);}(_0x12e4,0x187));var _0x412e=function(_0xfeb2ac,_0x34f636){_0xfeb2ac=_0xfeb2ac-0x0;var _0x2ed853=_0x12e4[_0xfeb2ac];return _0x2ed853;};'use strict';var _=require(_0x412e('0x0'));var util=require(_0x412e('0x1'));var logger=require(_0x412e('0x2'))(_0x412e('0x3'));var moment=require(_0x412e('0x4'));var BPromise=require(_0x412e('0x5'));var rp=require(_0x412e('0x6'));var fs=require('fs');var path=require(_0x412e('0x7'));var rimraf=require(_0x412e('0x8'));var config=require(_0x412e('0x9'));var attributes=require(_0x412e('0xa'));module[_0x412e('0xb')]=function(_0x597b06,_0x317c1d){return _0x597b06[_0x412e('0xc')](_0x412e('0xd'),attributes,{'tableName':'fax_messages','paranoid':![],'indexes':[{'name':'fti_fax_messages','fields':['body'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2c4ceb,_0x5d5856,_0x5d8d67){var _0x308940=_0x597b06[_0x412e('0xe')];var _0x53ec91=_0x2c4ceb['get']({'plain':!![]});if(_0x53ec91[_0x412e('0xf')]['toLowerCase']()==='in'||_0x53ec91['direction'][_0x412e('0x10')]()===_0x412e('0x11')&&!_0x53ec91[_0x412e('0x12')]&&!_[_0x412e('0x13')](_0x53ec91[_0x412e('0x14')])){_0x308940[_0x412e('0x15')]['findOne']({'where':{'id':_0x53ec91[_0x412e('0x16')]}})['then'](function(_0xd24489){if(_0xd24489){_0xd24489['update']({'lastMsgAt':_0x53ec91['createdAt'],'lastMsgDirection':_0x53ec91[_0x412e('0xf')][_0x412e('0x10')]()});}})[_0x412e('0x17')](function(_0x1ec196){console[_0x412e('0x18')](_0x1ec196);});}_0x5d8d67();}},'charset':'utf8mb4','collate':_0x412e('0x19')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index e05504e..7c77d88 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 _0x9f62=['util','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','request','info','request\x20sent','stringify','error','code','FaxMessage,\x20%s,\x20%s','message','result','CreateFaxMessage','FaxMessage','body','raw','then','debug','catch','UpdateFaxMessage','update','options','where','attributes','limit'];(function(_0x257e03,_0x112d0a){var _0x27bba0=function(_0x2e6737){while(--_0x2e6737){_0x257e03['push'](_0x257e03['shift']());}};_0x27bba0(++_0x112d0a);}(_0x9f62,0x154));var _0x29f6=function(_0x256733,_0x5f1ec1){_0x256733=_0x256733-0x0;var _0x6cfef1=_0x9f62[_0x256733];return _0x6cfef1;};'use strict';var _=require('lodash');var util=require(_0x29f6('0x0'));var moment=require('moment');var BPromise=require(_0x29f6('0x1'));var rs=require(_0x29f6('0x2'));var fs=require('fs');var Redis=require(_0x29f6('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x29f6('0x4'))(_0x29f6('0x5'));var config=require(_0x29f6('0x6'));var jayson=require(_0x29f6('0x7'));var client=jayson['client'][_0x29f6('0x8')]({'port':0x232a});config[_0x29f6('0x9')]=_[_0x29f6('0xa')](config[_0x29f6('0x9')],{'host':_0x29f6('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./faxMessage.socket')['register'](socket);function respondWithRpcPromise(_0xe25841,_0x44db16,_0x4fb455){return new BPromise(function(_0x5a0724,_0x29b3f5){return client[_0x29f6('0xc')](_0xe25841,_0x4fb455)['then'](function(_0x17b69c){logger[_0x29f6('0xd')]('FaxMessage,\x20%s,\x20%s',_0x44db16,'request\x20sent');logger['debug']('FaxMessage,\x20%s,\x20%s,\x20%s',_0x44db16,_0x29f6('0xe'),JSON[_0x29f6('0xf')](_0x17b69c));if(_0x17b69c[_0x29f6('0x10')]){if(_0x17b69c[_0x29f6('0x10')][_0x29f6('0x11')]===0x1f4){logger[_0x29f6('0x10')](_0x29f6('0x12'),_0x44db16,_0x17b69c[_0x29f6('0x10')][_0x29f6('0x13')]);return _0x29b3f5(_0x17b69c[_0x29f6('0x10')][_0x29f6('0x13')]);}logger[_0x29f6('0x10')](_0x29f6('0x12'),_0x44db16,_0x17b69c[_0x29f6('0x10')][_0x29f6('0x13')]);return _0x5a0724(_0x17b69c[_0x29f6('0x10')][_0x29f6('0x13')]);}else{logger['info']('FaxMessage,\x20%s,\x20%s',_0x44db16,_0x29f6('0xe'));_0x5a0724(_0x17b69c[_0x29f6('0x14')][_0x29f6('0x13')]);}})['catch'](function(_0xcb90){logger[_0x29f6('0x10')]('FaxMessage,\x20%s,\x20%s',_0x44db16,_0xcb90);_0x29b3f5(_0xcb90);});});}exports[_0x29f6('0x15')]=function(_0x3e81af){var _0x42a8fa=this;return new Promise(function(_0x41b9f0,_0xb6e7a9){return db[_0x29f6('0x16')]['create'](_0x3e81af[_0x29f6('0x17')],{'raw':_0x3e81af['options']?_0x3e81af['options'][_0x29f6('0x18')]===undefined?!![]:![]:!![]})[_0x29f6('0x19')](function(_0x39c6b3){logger[_0x29f6('0xd')]('CreateFaxMessage',_0x3e81af);logger[_0x29f6('0x1a')]('CreateFaxMessage',_0x3e81af,JSON[_0x29f6('0xf')](_0x39c6b3));_0x41b9f0(_0x39c6b3);})[_0x29f6('0x1b')](function(_0x4200cc){logger[_0x29f6('0x10')]('CreateFaxMessage',_0x4200cc[_0x29f6('0x13')],_0x3e81af);_0xb6e7a9(_0x42a8fa[_0x29f6('0x10')](0x1f4,_0x4200cc['message']));});});};exports[_0x29f6('0x1c')]=function(_0x45f792){var _0x2519ac=this;return new Promise(function(_0x342038,_0x84ccb7){return db[_0x29f6('0x16')][_0x29f6('0x1d')](_0x45f792['body'],{'raw':_0x45f792[_0x29f6('0x1e')]?_0x45f792[_0x29f6('0x1e')][_0x29f6('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x45f792[_0x29f6('0x1e')]?_0x45f792[_0x29f6('0x1e')][_0x29f6('0x1f')]||null:null,'attributes':_0x45f792[_0x29f6('0x1e')]?_0x45f792[_0x29f6('0x1e')][_0x29f6('0x20')]||null:null,'limit':_0x45f792[_0x29f6('0x1e')]?_0x45f792[_0x29f6('0x1e')][_0x29f6('0x21')]||null:null})[_0x29f6('0x19')](function(_0x304c28){logger[_0x29f6('0xd')](_0x29f6('0x1c'),_0x45f792);logger[_0x29f6('0x1a')]('UpdateFaxMessage',_0x45f792,JSON['stringify'](_0x304c28));_0x342038(_0x304c28);})[_0x29f6('0x1b')](function(_0x489897){logger[_0x29f6('0x10')](_0x29f6('0x1c'),_0x489897[_0x29f6('0x13')],_0x45f792);_0x84ccb7(_0x2519ac[_0x29f6('0x10')](0x1f4,_0x489897['message']));});});}; \ No newline at end of file +var _0xac31=['attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','http','redis','defaults','socket.io-emitter','./faxMessage.socket','register','request','then','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreateFaxMessage','FaxMessage','create','body','options','raw','UpdateFaxMessage','update','where'];(function(_0x1f4992,_0x489664){var _0x2e2975=function(_0x84c8d2){while(--_0x84c8d2){_0x1f4992['push'](_0x1f4992['shift']());}};_0x2e2975(++_0x489664);}(_0xac31,0xca));var _0x1ac3=function(_0x1a00af,_0x32527f){_0x1a00af=_0x1a00af-0x0;var _0x59a8a1=_0xac31[_0x1a00af];return _0x59a8a1;};'use strict';var _=require(_0x1ac3('0x0'));var util=require(_0x1ac3('0x1'));var moment=require(_0x1ac3('0x2'));var BPromise=require(_0x1ac3('0x3'));var rs=require(_0x1ac3('0x4'));var fs=require('fs');var Redis=require(_0x1ac3('0x5'));var db=require(_0x1ac3('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x1ac3('0x7'))(_0x1ac3('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x1ac3('0x9')][_0x1ac3('0xa')]({'port':0x232a});config[_0x1ac3('0xb')]=_[_0x1ac3('0xc')](config[_0x1ac3('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x1ac3('0xd'))(new Redis(config['redis']));require(_0x1ac3('0xe'))[_0x1ac3('0xf')](socket);function respondWithRpcPromise(_0x344674,_0x53500b,_0xa26c88){return new BPromise(function(_0x1e2642,_0x3e835b){return client[_0x1ac3('0x10')](_0x344674,_0xa26c88)[_0x1ac3('0x11')](function(_0x422d19){logger['info'](_0x1ac3('0x12'),_0x53500b,_0x1ac3('0x13'));logger[_0x1ac3('0x14')](_0x1ac3('0x15'),_0x53500b,'request\x20sent',JSON[_0x1ac3('0x16')](_0x422d19));if(_0x422d19[_0x1ac3('0x17')]){if(_0x422d19[_0x1ac3('0x17')][_0x1ac3('0x18')]===0x1f4){logger['error'](_0x1ac3('0x12'),_0x53500b,_0x422d19[_0x1ac3('0x17')]['message']);return _0x3e835b(_0x422d19[_0x1ac3('0x17')][_0x1ac3('0x19')]);}logger[_0x1ac3('0x17')]('FaxMessage,\x20%s,\x20%s',_0x53500b,_0x422d19[_0x1ac3('0x17')][_0x1ac3('0x19')]);return _0x1e2642(_0x422d19[_0x1ac3('0x17')]['message']);}else{logger[_0x1ac3('0x1a')]('FaxMessage,\x20%s,\x20%s',_0x53500b,_0x1ac3('0x13'));_0x1e2642(_0x422d19[_0x1ac3('0x1b')][_0x1ac3('0x19')]);}})[_0x1ac3('0x1c')](function(_0x18b985){logger['error'](_0x1ac3('0x12'),_0x53500b,_0x18b985);_0x3e835b(_0x18b985);});});}exports[_0x1ac3('0x1d')]=function(_0x296abf){var _0x257f60=this;return new Promise(function(_0x5f1918,_0x48d18a){return db[_0x1ac3('0x1e')][_0x1ac3('0x1f')](_0x296abf[_0x1ac3('0x20')],{'raw':_0x296abf[_0x1ac3('0x21')]?_0x296abf[_0x1ac3('0x21')][_0x1ac3('0x22')]===undefined?!![]:![]:!![]})[_0x1ac3('0x11')](function(_0x10912a){logger[_0x1ac3('0x1a')]('CreateFaxMessage',_0x296abf);logger[_0x1ac3('0x14')](_0x1ac3('0x1d'),_0x296abf,JSON['stringify'](_0x10912a));_0x5f1918(_0x10912a);})[_0x1ac3('0x1c')](function(_0x10f30c){logger['error'](_0x1ac3('0x1d'),_0x10f30c[_0x1ac3('0x19')],_0x296abf);_0x48d18a(_0x257f60[_0x1ac3('0x17')](0x1f4,_0x10f30c[_0x1ac3('0x19')]));});});};exports[_0x1ac3('0x23')]=function(_0x565a0f){var _0x5a2ab2=this;return new Promise(function(_0x503a64,_0x528807){return db['FaxMessage'][_0x1ac3('0x24')](_0x565a0f['body'],{'raw':_0x565a0f[_0x1ac3('0x21')]?_0x565a0f[_0x1ac3('0x21')][_0x1ac3('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x565a0f[_0x1ac3('0x21')]?_0x565a0f['options'][_0x1ac3('0x25')]||null:null,'attributes':_0x565a0f['options']?_0x565a0f[_0x1ac3('0x21')][_0x1ac3('0x26')]||null:null,'limit':_0x565a0f[_0x1ac3('0x21')]?_0x565a0f[_0x1ac3('0x21')][_0x1ac3('0x27')]||null:null})[_0x1ac3('0x11')](function(_0x9c17c2){logger['info'](_0x1ac3('0x23'),_0x565a0f);logger[_0x1ac3('0x14')](_0x1ac3('0x23'),_0x565a0f,JSON[_0x1ac3('0x16')](_0x9c17c2));_0x503a64(_0x9c17c2);})['catch'](function(_0x3591a9){logger[_0x1ac3('0x17')](_0x1ac3('0x23'),_0x3591a9[_0x1ac3('0x19')],_0x565a0f);_0x528807(_0x5a2ab2[_0x1ac3('0x17')](0x1f4,_0x3591a9['message']));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index fe0c487..8a00bd8 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 _0x8feb=['register','length','faxMessage:','./faxMessage.events','save','emit','removeListener'];(function(_0x203a88,_0x32521b){var _0x46e6ce=function(_0x3fa707){while(--_0x3fa707){_0x203a88['push'](_0x203a88['shift']());}};_0x46e6ce(++_0x32521b);}(_0x8feb,0x114));var _0xb8fe=function(_0x2b890d,_0x65a536){_0x2b890d=_0x2b890d-0x0;var _0xb91abb=_0x8feb[_0x2b890d];return _0xb91abb;};'use strict';var FaxMessageEvents=require(_0xb8fe('0x0'));var events=[_0xb8fe('0x1'),'remove','update'];function createListener(_0xf31037,_0x35b90a){return function(_0x3c89f2){_0x35b90a[_0xb8fe('0x2')](_0xf31037,_0x3c89f2);};}function removeListener(_0x375579,_0x511e0f){return function(){FaxMessageEvents[_0xb8fe('0x3')](_0x375579,_0x511e0f);};}exports[_0xb8fe('0x4')]=function(_0x170995){for(var _0x3116e6=0x0,_0x77b92b=events[_0xb8fe('0x5')];_0x3116e6<_0x77b92b;_0x3116e6++){var _0x216f5b=events[_0x3116e6];var _0x1a189a=createListener(_0xb8fe('0x6')+_0x216f5b,_0x170995);FaxMessageEvents['on'](_0x216f5b,_0x1a189a);}}; \ No newline at end of file +var _0x1865=['register','length','faxMessage:','./faxMessage.events','save','remove','update','emit','removeListener'];(function(_0x34c0f4,_0x257a39){var _0x33c73a=function(_0x1244b7){while(--_0x1244b7){_0x34c0f4['push'](_0x34c0f4['shift']());}};_0x33c73a(++_0x257a39);}(_0x1865,0xc0));var _0x5186=function(_0x519f99,_0x519778){_0x519f99=_0x519f99-0x0;var _0x3e7436=_0x1865[_0x519f99];return _0x3e7436;};'use strict';var FaxMessageEvents=require(_0x5186('0x0'));var events=[_0x5186('0x1'),_0x5186('0x2'),_0x5186('0x3')];function createListener(_0x8633c3,_0x538092){return function(_0x599935){_0x538092[_0x5186('0x4')](_0x8633c3,_0x599935);};}function removeListener(_0x514b2f,_0x48a0bf){return function(){FaxMessageEvents[_0x5186('0x5')](_0x514b2f,_0x48a0bf);};}exports[_0x5186('0x6')]=function(_0x403a73){for(var _0x287982=0x0,_0x9d75e=events[_0x5186('0x7')];_0x287982<_0x9d75e;_0x287982++){var _0x557563=events[_0x287982];var _0x1ccdad=createListener(_0x5186('0x8')+_0x557563,_0x403a73);FaxMessageEvents['on'](_0x557563,_0x1ccdad);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index 7fa18d7..3da1552 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 _0x3667=['/describe','describe','/:id','show','/:id/download','download','post','tracked','fax','faxmessage:create','create','put','update','/:id/accept','accept','/:id/reject','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./faxMessage.controller','get','isAuthenticated','index'];(function(_0x8d33b5,_0x256e21){var _0x3e2ed7=function(_0x1a01c1){while(--_0x1a01c1){_0x8d33b5['push'](_0x8d33b5['shift']());}};_0x3e2ed7(++_0x256e21);}(_0x3667,0xcd));var _0x7366=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3667[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x7366('0x0'));var util=require(_0x7366('0x1'));var path=require(_0x7366('0x2'));var timeout=require(_0x7366('0x3'));var express=require(_0x7366('0x4'));var router=express['Router']();var fs_extra=require(_0x7366('0x5'));var auth=require(_0x7366('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x7366('0x7'));var controller=require(_0x7366('0x8'));router[_0x7366('0x9')]('/',auth[_0x7366('0xa')](),controller[_0x7366('0xb')]);router['get'](_0x7366('0xc'),auth[_0x7366('0xa')](),controller[_0x7366('0xd')]);router[_0x7366('0x9')](_0x7366('0xe'),auth[_0x7366('0xa')](),controller[_0x7366('0xf')]);router[_0x7366('0x9')](_0x7366('0x10'),auth[_0x7366('0xa')](),controller[_0x7366('0x11')]);router[_0x7366('0x12')]('/',auth[_0x7366('0xa')](),interaction[_0x7366('0x13')](_0x7366('0x14'),_0x7366('0x15')),controller[_0x7366('0x16')]);router[_0x7366('0x17')](_0x7366('0xe'),auth[_0x7366('0xa')](),controller[_0x7366('0x18')]);router[_0x7366('0x17')](_0x7366('0x19'),auth[_0x7366('0xa')](),controller[_0x7366('0x1a')]);router[_0x7366('0x17')](_0x7366('0x1b'),auth[_0x7366('0xa')](),controller['reject']);router[_0x7366('0x1c')](_0x7366('0xe'),auth[_0x7366('0xa')](),controller[_0x7366('0x1d')]);module[_0x7366('0x1e')]=router; \ No newline at end of file +var _0x5ec6=['express','fs-extra','../../components/interaction/service','./faxMessage.controller','isAuthenticated','index','/describe','get','/:id','/:id/download','download','post','tracked','fax','create','put','update','/:id/accept','accept','/:id/reject','reject','delete','exports','multer','util','path'];(function(_0x15666c,_0x5b6773){var _0x28414b=function(_0x5b88af){while(--_0x5b88af){_0x15666c['push'](_0x15666c['shift']());}};_0x28414b(++_0x5b6773);}(_0x5ec6,0x7f));var _0x65ec=function(_0x1aed51,_0x549e3e){_0x1aed51=_0x1aed51-0x0;var _0x1a63cf=_0x5ec6[_0x1aed51];return _0x1a63cf;};'use strict';var multer=require(_0x65ec('0x0'));var util=require(_0x65ec('0x1'));var path=require(_0x65ec('0x2'));var timeout=require('connect-timeout');var express=require(_0x65ec('0x3'));var router=express['Router']();var fs_extra=require(_0x65ec('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x65ec('0x5'));var config=require('../../config/environment');var controller=require(_0x65ec('0x6'));router['get']('/',auth[_0x65ec('0x7')](),controller[_0x65ec('0x8')]);router['get'](_0x65ec('0x9'),auth[_0x65ec('0x7')](),controller['describe']);router[_0x65ec('0xa')](_0x65ec('0xb'),auth[_0x65ec('0x7')](),controller['show']);router['get'](_0x65ec('0xc'),auth['isAuthenticated'](),controller[_0x65ec('0xd')]);router[_0x65ec('0xe')]('/',auth['isAuthenticated'](),interaction[_0x65ec('0xf')](_0x65ec('0x10'),'faxmessage:create'),controller[_0x65ec('0x11')]);router[_0x65ec('0x12')]('/:id',auth[_0x65ec('0x7')](),controller[_0x65ec('0x13')]);router[_0x65ec('0x12')](_0x65ec('0x14'),auth[_0x65ec('0x7')](),controller[_0x65ec('0x15')]);router[_0x65ec('0x12')](_0x65ec('0x16'),auth['isAuthenticated'](),controller[_0x65ec('0x17')]);router[_0x65ec('0x18')](_0x65ec('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x65ec('0x19')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index 8486251..498213b 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 _0xf970=['INTEGER','ENUM','rrmemory','beepall','sequelize','STRING','name'];(function(_0xbbe04a,_0x2467da){var _0x576dbe=function(_0x312afa){while(--_0x312afa){_0xbbe04a['push'](_0xbbe04a['shift']());}};_0x576dbe(++_0x2467da);}(_0xf970,0x1d9));var _0x0f97=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf970[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x0f97('0x0'));module['exports']={'name':{'type':Sequelize[_0x0f97('0x1')],'unique':_0x0f97('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x0f97('0x1')]},'timeout':{'type':Sequelize[_0x0f97('0x3')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x0f97('0x4')](_0x0f97('0x5'),_0x0f97('0x6'),'roundrobin'),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x0f97('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x3ace=['INTEGER','exports','STRING','name','ENUM','rrmemory','beepall'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x3ace,0xda));var _0xe3ac=function(_0x25c68c,_0x5582d8){_0x25c68c=_0x25c68c-0x0;var _0x15af70=_0x3ace[_0x25c68c];return _0x15af70;};'use strict';var Sequelize=require('sequelize');module[_0xe3ac('0x0')]={'name':{'type':Sequelize[_0xe3ac('0x1')],'unique':_0xe3ac('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER'],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xe3ac('0x3')](_0xe3ac('0x4'),_0xe3ac('0x5'),'roundrobin'),'allowNull':![]},'lastAgent':{'type':Sequelize[_0xe3ac('0x6')],'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 e9a78e5..609f312 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 _0x8645=['ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','all','union','compact','value','removeTeams','isEmpty','removeAgents','addAgents','omit','spread','userFaxQueue:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','redis','register','status','json','offset','undefined','limit','set','Content-Range','reject','save','then','destroy','FaxQueues','UserProfileResource','end','sendStatus','error','stack','name','index','map','FaxQueue','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','where','filters','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','length','includeAll','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','describe','getMembers','findOne','UserFaxQueue','order','sort','FaxQueueId','User','agent','faxPause','updatedAt','createdAt','count','format','SIP','getTeams','Team','addTeams','ids','voicePause','interface','flatMap','Agents','sequelize','transaction','each','findOrCreate','forEach','emit','userFaxQueue:save','select','field','tq.TeamId','from','team_has_fax_queues','join','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?'];(function(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0x8645,0x1b7));var _0x5864=function(_0x218556,_0x265ca4){_0x218556=_0x218556-0x0;var _0x394646=_0x8645[_0x218556];return _0x394646;};'use strict';var emlformat=require(_0x5864('0x0'));var rimraf=require(_0x5864('0x1'));var zipdir=require(_0x5864('0x2'));var jsonpatch=require(_0x5864('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x5864('0x4'));var Mustache=require(_0x5864('0x5'));var util=require(_0x5864('0x6'));var path=require('path');var sox=require(_0x5864('0x7'));var csv=require('to-csv');var ejs=require(_0x5864('0x8'));var fs=require('fs');var fs_extra=require(_0x5864('0x9'));var _=require(_0x5864('0xa'));var squel=require(_0x5864('0xb'));var crypto=require(_0x5864('0xc'));var jsforce=require(_0x5864('0xd'));var deskjs=require(_0x5864('0xe'));var toCsv=require(_0x5864('0xf'));var querystring=require(_0x5864('0x10'));var Papa=require('papaparse');var Redis=require(_0x5864('0x11'));var authService=require(_0x5864('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x5864('0x13'));var hardwareService=require(_0x5864('0x14'));var logger=require(_0x5864('0x15'))('api');var utils=require(_0x5864('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x5864('0x17')]=_['defaults'](config[_0x5864('0x17')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5864('0x17')]));require('./faxQueue.socket')[_0x5864('0x18')](socket);function respondWithStatusCode(_0x3274e4,_0x426a70){_0x426a70=_0x426a70||0xcc;return function(_0x244e3f){if(_0x244e3f){return _0x3274e4['sendStatus'](_0x426a70);}return _0x3274e4['status'](_0x426a70)['end']();};}function respondWithResult(_0x4bb86e,_0x62c301){_0x62c301=_0x62c301||0xc8;return function(_0x377506){if(_0x377506){return _0x4bb86e[_0x5864('0x19')](_0x62c301)[_0x5864('0x1a')](_0x377506);}};}function respondWithFilteredResult(_0x25f740,_0x4bbd26){return function(_0x3d0dd1){if(_0x3d0dd1){var _0x58f65e=typeof _0x4bbd26[_0x5864('0x1b')]===_0x5864('0x1c')&&typeof _0x4bbd26[_0x5864('0x1d')]==='undefined';var _0x2fee99=_0x3d0dd1['count'];var _0x5ddb32=_0x58f65e?0x0:_0x4bbd26[_0x5864('0x1b')];var _0x10ed54=_0x58f65e?_0x3d0dd1['count']:_0x4bbd26['offset']+_0x4bbd26['limit'];var _0x71f986;if(_0x10ed54>=_0x2fee99){_0x10ed54=_0x2fee99;_0x71f986=0xc8;}else{_0x71f986=0xce;}_0x25f740['status'](_0x71f986);return _0x25f740[_0x5864('0x1e')](_0x5864('0x1f'),_0x5ddb32+'-'+_0x10ed54+'/'+_0x2fee99)[_0x5864('0x1a')](_0x3d0dd1);}return null;};}function patchUpdates(_0x168162){return function(_0x3fc2ae){try{jsonpatch['apply'](_0x3fc2ae,_0x168162,!![]);}catch(_0x400c68){return BPromise[_0x5864('0x20')](_0x400c68);}return _0x3fc2ae[_0x5864('0x21')]();};}function saveUpdates(_0x3f10c7,_0x510b61){return function(_0x23454b){if(_0x23454b){return _0x23454b['update'](_0x3f10c7)[_0x5864('0x22')](function(_0x563d35){return _0x563d35;});}return null;};}function removeEntity(_0x3a21a9,_0x719a30){return function(_0xe97847){if(_0xe97847){return _0xe97847[_0x5864('0x23')]()[_0x5864('0x22')](function(){var _0x1305c2=_0xe97847['get']({'plain':!![]});var _0x455c8f=_0x5864('0x24');return db[_0x5864('0x25')][_0x5864('0x23')]({'where':{'type':_0x455c8f,'resourceId':_0x1305c2['id']}})[_0x5864('0x22')](function(){return _0xe97847;});})[_0x5864('0x22')](function(){_0x3a21a9[_0x5864('0x19')](0xcc)[_0x5864('0x26')]();});}};}function handleEntityNotFound(_0x32e8c5,_0x7d93eb){return function(_0x5f16d4){if(!_0x5f16d4){_0x32e8c5[_0x5864('0x27')](0x194);}return _0x5f16d4;};}function handleError(_0x37213d,_0x4e5abf){_0x4e5abf=_0x4e5abf||0x1f4;return function(_0x3d894d){logger[_0x5864('0x28')](_0x3d894d[_0x5864('0x29')]);if(_0x3d894d[_0x5864('0x2a')]){delete _0x3d894d[_0x5864('0x2a')];}_0x37213d[_0x5864('0x19')](_0x4e5abf)['send'](_0x3d894d);};}exports[_0x5864('0x2b')]=function(_0x58703b,_0x50d622){var _0x2a7d5f={},_0x138b33={},_0x1460ce={'count':0x0,'rows':[]};var _0x1ea857=_[_0x5864('0x2c')](db[_0x5864('0x2d')][_0x5864('0x2e')],function(_0x502f0a){return{'name':_0x502f0a['fieldName'],'type':_0x502f0a[_0x5864('0x2f')][_0x5864('0x30')]};});_0x138b33[_0x5864('0x31')]=_[_0x5864('0x2c')](_0x1ea857,_0x5864('0x2a'));_0x138b33[_0x5864('0x32')]=_[_0x5864('0x33')](_0x58703b[_0x5864('0x32')]);_0x138b33['filters']=_[_0x5864('0x34')](_0x138b33[_0x5864('0x31')],_0x138b33[_0x5864('0x32')]);_0x2a7d5f[_0x5864('0x35')]=_[_0x5864('0x34')](_0x138b33[_0x5864('0x31')],qs[_0x5864('0x36')](_0x58703b[_0x5864('0x32')]['fields']));_0x2a7d5f[_0x5864('0x35')]=_0x2a7d5f[_0x5864('0x35')]['length']?_0x2a7d5f[_0x5864('0x35')]:_0x138b33[_0x5864('0x31')];if(!_0x58703b[_0x5864('0x32')][_0x5864('0x37')](_0x5864('0x38'))){_0x2a7d5f[_0x5864('0x1d')]=qs[_0x5864('0x1d')](_0x58703b[_0x5864('0x32')]['limit']);_0x2a7d5f[_0x5864('0x1b')]=qs[_0x5864('0x1b')](_0x58703b[_0x5864('0x32')][_0x5864('0x1b')]);}_0x2a7d5f['order']=qs['sort'](_0x58703b[_0x5864('0x32')]['sort']);_0x2a7d5f[_0x5864('0x39')]=qs[_0x5864('0x3a')](_[_0x5864('0x3b')](_0x58703b['query'],_0x138b33['filters']),_0x1ea857);if(_0x58703b[_0x5864('0x32')][_0x5864('0x3c')]){_0x2a7d5f[_0x5864('0x39')]=_[_0x5864('0x3d')](_0x2a7d5f['where'],{'$or':_[_0x5864('0x2c')](_0x1ea857,function(_0x4dfdff){if(_0x4dfdff[_0x5864('0x2f')]!==_0x5864('0x3e')){var _0x2ce6ab={};_0x2ce6ab[_0x4dfdff[_0x5864('0x2a')]]={'$like':'%'+_0x58703b['query']['filter']+'%'};return _0x2ce6ab;}})});}_0x2a7d5f=_['merge']({},_0x2a7d5f,_0x58703b[_0x5864('0x3f')]);var _0x517781={'where':_0x2a7d5f[_0x5864('0x39')]};return db[_0x5864('0x2d')]['count'](_0x517781)[_0x5864('0x22')](function(_0x34feb4){_0x1460ce['count']=_0x34feb4;if(_0x58703b[_0x5864('0x32')]['includeAll']){_0x2a7d5f[_0x5864('0x40')]=[{'all':!![]}];}return db[_0x5864('0x2d')][_0x5864('0x41')](_0x2a7d5f);})['then'](function(_0x2cc5f5){_0x1460ce[_0x5864('0x42')]=_0x2cc5f5;return _0x1460ce;})[_0x5864('0x22')](respondWithFilteredResult(_0x50d622,_0x2a7d5f))[_0x5864('0x43')](handleError(_0x50d622,null));};exports[_0x5864('0x44')]=function(_0x44c594,_0x4d39ed){var _0x269282={'raw':!![],'where':{'id':_0x44c594[_0x5864('0x45')]['id']}},_0x158829={};_0x158829['model']=_['keys'](db[_0x5864('0x2d')][_0x5864('0x2e')]);_0x158829[_0x5864('0x32')]=_[_0x5864('0x33')](_0x44c594[_0x5864('0x32')]);_0x158829[_0x5864('0x3a')]=_[_0x5864('0x34')](_0x158829[_0x5864('0x31')],_0x158829[_0x5864('0x32')]);_0x269282[_0x5864('0x35')]=_[_0x5864('0x34')](_0x158829[_0x5864('0x31')],qs[_0x5864('0x36')](_0x44c594['query'][_0x5864('0x36')]));_0x269282[_0x5864('0x35')]=_0x269282[_0x5864('0x35')][_0x5864('0x46')]?_0x269282[_0x5864('0x35')]:_0x158829[_0x5864('0x31')];if(_0x44c594[_0x5864('0x32')][_0x5864('0x47')]){_0x269282['include']=[{'all':!![]}];}_0x269282=_[_0x5864('0x3d')]({},_0x269282,_0x44c594['options']);return db[_0x5864('0x2d')][_0x5864('0x48')](_0x269282)[_0x5864('0x22')](handleEntityNotFound(_0x4d39ed,null))[_0x5864('0x22')](respondWithResult(_0x4d39ed,null))[_0x5864('0x43')](handleError(_0x4d39ed,null));};exports[_0x5864('0x49')]=function(_0x580afa,_0x15a53c){return db[_0x5864('0x2d')][_0x5864('0x49')](_0x580afa['body'],{})[_0x5864('0x22')](function(_0x3a7244){var _0x4df482=_0x580afa[_0x5864('0x4a')][_0x5864('0x4b')]({'plain':!![]});if(!_0x4df482)throw new Error(_0x5864('0x4c'));if(_0x4df482['role']==='user'){var _0x5d2278=_0x3a7244[_0x5864('0x4b')]({'plain':!![]});var _0xe9cc16='FaxQueues';return db[_0x5864('0x4d')][_0x5864('0x48')]({'where':{'name':_0xe9cc16,'userProfileId':_0x4df482[_0x5864('0x4e')]},'raw':!![]})[_0x5864('0x22')](function(_0x26f67a){if(_0x26f67a&&_0x26f67a[_0x5864('0x4f')]===0x0){return db[_0x5864('0x25')][_0x5864('0x49')]({'name':_0x5d2278[_0x5864('0x2a')],'resourceId':_0x5d2278['id'],'type':_0x26f67a[_0x5864('0x2a')],'sectionId':_0x26f67a['id']},{})['then'](function(){return _0x3a7244;});}else{return _0x3a7244;}})[_0x5864('0x43')](function(_0x2b4766){logger['error'](_0x5864('0x50'),_0x2b4766);throw _0x2b4766;});}return _0x3a7244;})[_0x5864('0x22')](respondWithResult(_0x15a53c,0xc9))[_0x5864('0x43')](handleError(_0x15a53c,null));};exports[_0x5864('0x51')]=function(_0x1aa7bb,_0x5af0e2){if(_0x1aa7bb[_0x5864('0x52')]['id']){delete _0x1aa7bb[_0x5864('0x52')]['id'];}return db['FaxQueue'][_0x5864('0x48')]({'where':{'id':_0x1aa7bb['params']['id']}})['then'](handleEntityNotFound(_0x5af0e2,null))['then'](saveUpdates(_0x1aa7bb[_0x5864('0x52')],null))[_0x5864('0x22')](respondWithResult(_0x5af0e2,null))[_0x5864('0x43')](handleError(_0x5af0e2,null));};exports[_0x5864('0x23')]=function(_0x2f87a2,_0x2f4a6d){return db['FaxQueue']['find']({'where':{'id':_0x2f87a2[_0x5864('0x45')]['id']}})['then'](handleEntityNotFound(_0x2f4a6d,null))[_0x5864('0x22')](removeEntity(_0x2f4a6d,null))[_0x5864('0x43')](handleError(_0x2f4a6d,null));};exports['describe']=function(_0x4c7f71,_0x458f7a){return db[_0x5864('0x2d')][_0x5864('0x53')]()[_0x5864('0x22')](respondWithResult(_0x458f7a,null))[_0x5864('0x43')](handleError(_0x458f7a,null));};exports[_0x5864('0x54')]=function(_0x3e657d,_0x3620b3,_0x559e27){var _0x2a2520={'raw':!![],'where':{}},_0x2a3fb5={},_0x318f64;return db['FaxQueue'][_0x5864('0x55')]({'where':{'id':_0x3e657d['params']['id']}})[_0x5864('0x22')](handleEntityNotFound(_0x3620b3,null))[_0x5864('0x22')](function(_0x23b4e6){if(_0x23b4e6){_0x318f64=_0x23b4e6[_0x5864('0x4b')]({'plain':!![]});_0x2a3fb5[_0x5864('0x31')]=_[_0x5864('0x33')](db[_0x5864('0x56')][_0x5864('0x2e')]);_0x2a3fb5[_0x5864('0x32')]=_[_0x5864('0x33')](_0x3e657d[_0x5864('0x32')]);_0x2a3fb5[_0x5864('0x3a')]=_[_0x5864('0x34')](_0x2a3fb5[_0x5864('0x31')],_0x2a3fb5[_0x5864('0x32')]);_0x2a2520[_0x5864('0x35')]=_['intersection'](_0x2a3fb5[_0x5864('0x31')],qs[_0x5864('0x36')](_0x3e657d[_0x5864('0x32')][_0x5864('0x36')]));_0x2a2520[_0x5864('0x35')]=_0x2a2520[_0x5864('0x35')][_0x5864('0x46')]?_0x2a2520[_0x5864('0x35')]:_0x2a3fb5[_0x5864('0x31')];if(!_0x3e657d[_0x5864('0x32')][_0x5864('0x37')](_0x5864('0x38'))){_0x2a2520[_0x5864('0x1d')]=qs['limit'](_0x3e657d[_0x5864('0x32')][_0x5864('0x1d')]);_0x2a2520[_0x5864('0x1b')]=qs[_0x5864('0x1b')](_0x3e657d[_0x5864('0x32')][_0x5864('0x1b')]);}_0x2a2520[_0x5864('0x57')]=qs[_0x5864('0x58')](_0x3e657d['query']['sort']);_0x2a2520['where']=qs[_0x5864('0x3a')](_['pick'](_0x3e657d[_0x5864('0x32')],_0x2a3fb5[_0x5864('0x3a')]));_0x2a2520['where'][_0x5864('0x59')]=_0x23b4e6['id'];if(_0x3e657d['query'][_0x5864('0x3c')]){_0x2a2520[_0x5864('0x39')]=_['merge'](_0x2a2520[_0x5864('0x39')],{'$or':_['map'](_0x2a2520[_0x5864('0x35')],function(_0x46bd75){var _0x574ea0={};_0x574ea0[_0x46bd75]={'$like':'%'+_0x3e657d[_0x5864('0x32')][_0x5864('0x3c')]+'%'};return _0x574ea0;})});}_0x2a2520=_[_0x5864('0x3d')]({},_0x2a2520,_0x3e657d['options']);return db[_0x5864('0x56')][_0x5864('0x41')](_0x2a2520);}})[_0x5864('0x22')](function(_0x241366){if(_0x241366){return db[_0x5864('0x5a')]['findAndCountAll']({'where':{'id':_[_0x5864('0x2c')](_0x241366,'UserId'),'role':_0x5864('0x5b')},'attributes':['id','name',_0x5864('0x5c'),_0x5864('0x5d'),_0x5864('0x5e')]});}})[_0x5864('0x22')](function(_0x52e086){if(_0x52e086){return{'count':_0x52e086[_0x5864('0x5f')],'rows':_[_0x5864('0x2c')](_0x52e086[_0x5864('0x42')],function(_0x319c5d){return{'membername':_0x319c5d[_0x5864('0x2a')],'UserId':_0x319c5d['id'],'queue_name':_0x318f64[_0x5864('0x2a')],'FaxQueueId':_0x318f64['id'],'interface':util[_0x5864('0x60')]('%s/%s',_0x5864('0x61'),_0x319c5d[_0x5864('0x2a')]),'penalty':0x0,'paused':_0x319c5d['faxPause'],'createdAt':_0x319c5d[_0x5864('0x5e')],'updatedAt':_0x319c5d[_0x5864('0x5d')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x3620b3,_0x2a2520))[_0x5864('0x43')](handleError(_0x3620b3,null));};exports[_0x5864('0x62')]=function(_0xc5bfa6,_0x483985,_0x2ebb69){var _0xe821d5={};var _0x479442={};var _0x53eea5;var _0x6eda42;return db['FaxQueue'][_0x5864('0x55')]({'where':{'id':_0xc5bfa6['params']['id']}})['then'](handleEntityNotFound(_0x483985,null))[_0x5864('0x22')](function(_0x4fb1a0){if(_0x4fb1a0){_0x53eea5=_0x4fb1a0;_0x479442[_0x5864('0x31')]=_[_0x5864('0x33')](db[_0x5864('0x63')][_0x5864('0x2e')]);_0x479442[_0x5864('0x32')]=_[_0x5864('0x33')](_0xc5bfa6['query']);_0x479442[_0x5864('0x3a')]=_[_0x5864('0x34')](_0x479442[_0x5864('0x31')],_0x479442[_0x5864('0x32')]);_0xe821d5[_0x5864('0x35')]=_[_0x5864('0x34')](_0x479442[_0x5864('0x31')],qs[_0x5864('0x36')](_0xc5bfa6[_0x5864('0x32')][_0x5864('0x36')]));_0xe821d5[_0x5864('0x35')]=_0xe821d5[_0x5864('0x35')][_0x5864('0x46')]?_0xe821d5[_0x5864('0x35')]:_0x479442[_0x5864('0x31')];_0xe821d5[_0x5864('0x57')]=qs['sort'](_0xc5bfa6[_0x5864('0x32')][_0x5864('0x58')]);_0xe821d5['where']=qs[_0x5864('0x3a')](_[_0x5864('0x3b')](_0xc5bfa6[_0x5864('0x32')],_0x479442[_0x5864('0x3a')]));if(_0xc5bfa6[_0x5864('0x32')]['filter']){_0xe821d5['where']=_[_0x5864('0x3d')](_0xe821d5[_0x5864('0x39')],{'$or':_['map'](_0xe821d5[_0x5864('0x35')],function(_0x1816e7){var _0x2631bd={};_0x2631bd[_0x1816e7]={'$like':'%'+_0xc5bfa6['query'][_0x5864('0x3c')]+'%'};return _0x2631bd;})});}_0xe821d5=_[_0x5864('0x3d')]({},_0xe821d5,_0xc5bfa6[_0x5864('0x3f')]);return _0x53eea5['getTeams'](_0xe821d5);}})[_0x5864('0x22')](function(_0x49faf4){if(_0x49faf4){_0x6eda42=_0x49faf4[_0x5864('0x46')];if(!_0xc5bfa6[_0x5864('0x32')][_0x5864('0x37')](_0x5864('0x38'))){_0xe821d5[_0x5864('0x1d')]=qs[_0x5864('0x1d')](_0xc5bfa6[_0x5864('0x32')]['limit']);_0xe821d5['offset']=qs['offset'](_0xc5bfa6['query']['offset']);}return _0x53eea5[_0x5864('0x62')](_0xe821d5);}})[_0x5864('0x22')](function(_0x306cd2){if(_0x306cd2){return _0x306cd2?{'count':_0x6eda42,'rows':_0x306cd2}:null;}})['then'](respondWithResult(_0x483985,null))[_0x5864('0x43')](handleError(_0x483985,null));};exports[_0x5864('0x64')]=function(_0xdbdc71,_0x224abb,_0xd384a8){var _0x1093e7=_0xdbdc71[_0x5864('0x52')][_0x5864('0x65')];return db['Team'][_0x5864('0x41')]({'where':{'id':_0x1093e7},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id','name','online',_0x5864('0x66'),_0x5864('0x67')],'raw':!![]}]})[_0x5864('0x22')](function(_0x19df3c){if(_0x19df3c){var _0x22be27=_[_0x5864('0x68')](_0x19df3c,function(_0x342f8f){var _0x1c8b26=_0x342f8f['get']({'plain':!![]});return _0x1c8b26[_0x5864('0x69')];});return db[_0x5864('0x2d')][_0x5864('0x48')]({'where':{'id':_0xdbdc71[_0x5864('0x45')]['id']}})[_0x5864('0x22')](function(_0x303517){return db[_0x5864('0x6a')][_0x5864('0x6b')](function(_0x31236d){return _0x303517[_0x5864('0x64')](_0x1093e7,{'transaction':_0x31236d})[_0x5864('0x22')](function(){return BPromise[_0x5864('0x6c')](_0x22be27,function(_0x39d19b){return db[_0x5864('0x56')][_0x5864('0x6d')]({'where':{'UserId':_0x39d19b['id'],'FaxQueueId':_0xdbdc71['params']['id']},'transaction':_0x31236d});});})[_0x5864('0x22')](function(){_0x22be27[_0x5864('0x6e')](function(_0x4bc0cf){socket[_0x5864('0x6f')](_0x5864('0x70'),{'UserId':_0x4bc0cf['id'],'FaxQueueId':_0x303517['id']});});});});});}})[_0x5864('0x22')](respondWithStatusCode(_0x224abb,null))['catch'](handleError(_0x224abb,null));};exports['removeTeams']=function(_0x365d4c,_0x28ff93,_0x47b7ca){return db['Team'][_0x5864('0x41')]({'where':{'id':_0x365d4c['query']['ids']},'attributes':['id'],'include':[{'model':db[_0x5864('0x5a')],'as':_0x5864('0x69'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x28ff93,null))[_0x5864('0x22')](function(_0x69e894){var _0x2033d9=_[_0x5864('0x2c')](_0x69e894,'id');var _0x5385bf=[];var _0x494944=[];var _0x1fcc3f=squel[_0x5864('0x71')]();_0x1fcc3f[_0x5864('0x72')](_0x5864('0x73'))[_0x5864('0x74')](_0x5864('0x75'),'tq')[_0x5864('0x76')]('user_has_teams','ut',_0x5864('0x77'))[_0x5864('0x39')](_0x5864('0x78'),_0x365d4c[_0x5864('0x45')]['id']);for(var _0x5909cc=0x0;_0x5909cc<_0x69e894[_0x5864('0x46')];_0x5909cc+=0x1){let _0x3ffda6=_0x69e894[_0x5909cc];for(var _0x1599eb=0x0;_0x1599eb<_0x3ffda6['Agents'][_0x5864('0x46')];_0x1599eb+=0x1){let _0x55a398=_0x3ffda6['Agents'][_0x1599eb];var _0x46bed8=_0x1fcc3f['clone']();_0x46bed8[_0x5864('0x39')](_0x5864('0x79'),_0x55a398['id']);_0x494944[_0x5864('0x7a')](db[_0x5864('0x6a')][_0x5864('0x32')](_0x46bed8[_0x5864('0x7b')](),{'type':db[_0x5864('0x6a')][_0x5864('0x7c')][_0x5864('0x7d')]})[_0x5864('0x22')](function(_0x436889){if(_0x436889[_0x5864('0x46')]===0x1){return _0x55a398['id'];}else{var _0x3b877a=_[_0x5864('0x7e')](_['map'](_0x436889,_0x5864('0x7f')),function(_0x764ed9){return _['includes'](_0x2033d9,_0x764ed9);});if(_0x3b877a){return _0x55a398['id'];}}}));}}return BPromise[_0x5864('0x80')](_0x494944)['then'](function(_0x540790){_0x5385bf=_(_0x5385bf)[_0x5864('0x81')](_0x540790)[_0x5864('0x82')]()[_0x5864('0x83')]();return db[_0x5864('0x2d')][_0x5864('0x48')]({'where':{'id':_0x365d4c[_0x5864('0x45')]['id']}})[_0x5864('0x22')](function(_0x316e0c){return db[_0x5864('0x6a')][_0x5864('0x6b')](function(_0x2b0e76){return _0x316e0c[_0x5864('0x84')](_0x365d4c[_0x5864('0x32')][_0x5864('0x65')],{'transaction':_0x2b0e76})[_0x5864('0x22')](function(){if(!_[_0x5864('0x85')](_0x5385bf)){return _0x316e0c[_0x5864('0x86')](_0x5385bf,{'transaction':_0x2b0e76});}})[_0x5864('0x22')](function(){_0x5385bf[_0x5864('0x6e')](function(_0x2c2e8e){socket[_0x5864('0x6f')]('userFaxQueue:remove',{'UserId':_0x2c2e8e,'FaxQueueId':_0x316e0c['id']});});});});});});})[_0x5864('0x22')](respondWithStatusCode(_0x28ff93,null))[_0x5864('0x43')](handleError(_0x28ff93,null));};exports[_0x5864('0x87')]=function(_0x41eec8,_0x82f73e,_0x5c48a0){return db[_0x5864('0x2d')][_0x5864('0x48')]({'where':{'id':_0x41eec8[_0x5864('0x45')]['id']}})[_0x5864('0x22')](handleEntityNotFound(_0x82f73e,null))['then'](function(_0x260060){if(_0x260060){return _0x260060[_0x5864('0x87')](_0x41eec8[_0x5864('0x52')][_0x5864('0x65')],_[_0x5864('0x88')](_0x41eec8[_0x5864('0x52')],[_0x5864('0x65'),'id'])||{})[_0x5864('0x89')](function(_0x448def){for(var _0x23ca83=0x0;_0x23ca83<_0x41eec8['body']['ids']['length'];_0x23ca83+=0x1){socket[_0x5864('0x6f')](_0x5864('0x70'),{'UserId':Number(_0x41eec8[_0x5864('0x52')]['ids'][_0x23ca83]),'FaxQueueId':Number(_0x41eec8[_0x5864('0x45')]['id'])});}return _0x448def;});}})[_0x5864('0x22')](respondWithResult(_0x82f73e,null))[_0x5864('0x43')](handleError(_0x82f73e,null));};exports[_0x5864('0x86')]=function(_0x551b1c,_0x578473,_0x87d56e){return db[_0x5864('0x2d')][_0x5864('0x48')]({'where':{'id':_0x551b1c[_0x5864('0x45')]['id']}})['then'](handleEntityNotFound(_0x578473,null))[_0x5864('0x22')](function(_0xf9f724){if(_0xf9f724){return _0xf9f724['removeAgents'](_0x551b1c[_0x5864('0x32')]['ids'])[_0x5864('0x22')](function(){if(_['isArray'](_0x551b1c[_0x5864('0x32')]['ids'])){for(var _0x385215=0x0;_0x385215<_0x551b1c['query']['ids'][_0x5864('0x46')];_0x385215+=0x1){socket['emit'](_0x5864('0x8a'),{'UserId':Number(_0x551b1c[_0x5864('0x32')][_0x5864('0x65')][_0x385215]),'FaxQueueId':Number(_0x551b1c['params']['id'])});}}else{socket[_0x5864('0x6f')]('userFaxQueue:remove',{'UserId':Number(_0x551b1c['query']['ids']),'FaxQueueId':Number(_0x551b1c[_0x5864('0x45')]['id'])});}});}})['then'](respondWithStatusCode(_0x578473,null))[_0x5864('0x43')](handleError(_0x578473,null));};exports[_0x5864('0x8b')]=function(_0x1ec3eb,_0x414dbe,_0x15c8b0){var _0x2090f1={};var _0x27a12d={};var _0x12f7b6;var _0x360593;return db[_0x5864('0x2d')][_0x5864('0x55')]({'where':{'id':_0x1ec3eb['params']['id']}})['then'](handleEntityNotFound(_0x414dbe,null))['then'](function(_0x4f5355){if(_0x4f5355){_0x12f7b6=_0x4f5355;_0x27a12d[_0x5864('0x31')]=_[_0x5864('0x33')](db[_0x5864('0x5a')]['rawAttributes']);_0x27a12d[_0x5864('0x32')]=_['keys'](_0x1ec3eb[_0x5864('0x32')]);_0x27a12d['filters']=_['intersection'](_0x27a12d[_0x5864('0x31')],_0x27a12d[_0x5864('0x32')]);_0x2090f1[_0x5864('0x35')]=_[_0x5864('0x34')](_0x27a12d['model'],qs[_0x5864('0x36')](_0x1ec3eb[_0x5864('0x32')][_0x5864('0x36')]));_0x2090f1[_0x5864('0x35')]=_0x2090f1['attributes'][_0x5864('0x46')]?_0x2090f1[_0x5864('0x35')]:_0x27a12d[_0x5864('0x31')];_0x2090f1['order']=qs[_0x5864('0x58')](_0x1ec3eb['query'][_0x5864('0x58')]);_0x2090f1[_0x5864('0x39')]=qs[_0x5864('0x3a')](_[_0x5864('0x3b')](_0x1ec3eb[_0x5864('0x32')],_0x27a12d[_0x5864('0x3a')]));if(_0x1ec3eb['query'][_0x5864('0x3c')]){_0x2090f1[_0x5864('0x39')]=_[_0x5864('0x3d')](_0x2090f1['where'],{'$or':_[_0x5864('0x2c')](_0x2090f1['attributes'],function(_0x5f280c){var _0x584e06={};_0x584e06[_0x5f280c]={'$like':'%'+_0x1ec3eb['query']['filter']+'%'};return _0x584e06;})});}_0x2090f1=_[_0x5864('0x3d')]({},_0x2090f1,_0x1ec3eb[_0x5864('0x3f')]);return _0x12f7b6['getAgents'](_0x2090f1);}})[_0x5864('0x22')](function(_0x3bd816){if(_0x3bd816){_0x360593=_0x3bd816[_0x5864('0x46')];if(!_0x1ec3eb[_0x5864('0x32')][_0x5864('0x37')](_0x5864('0x38'))){_0x2090f1[_0x5864('0x1d')]=qs[_0x5864('0x1d')](_0x1ec3eb[_0x5864('0x32')][_0x5864('0x1d')]);_0x2090f1['offset']=qs[_0x5864('0x1b')](_0x1ec3eb[_0x5864('0x32')]['offset']);}return _0x12f7b6[_0x5864('0x8b')](_0x2090f1);}})[_0x5864('0x22')](function(_0x358b02){if(_0x358b02){return _0x358b02?{'count':_0x360593,'rows':_0x358b02}:null;}})[_0x5864('0x22')](respondWithResult(_0x414dbe,null))[_0x5864('0x43')](handleError(_0x414dbe,null));}; \ No newline at end of file +var _0xf237=['set','Content-Range','apply','reject','then','destroy','get','FaxQueues','UserProfileResource','name','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','FaxQueue','include','findAll','catch','show','params','includeAll','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','describe','findOne','keys','UserFaxQueue','User','findAndCountAll','UserId','agent','faxPause','rows','format','%s/%s','createdAt','updatedAt','getTeams','Team','addTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','emit','removeTeams','from','team_has_fax_queues','join','user_has_teams','FaxQueueId\x20=\x20?','clone','push','toString','QueryTypes','SELECT','every','includes','all','union','compact','value','removeAgents','forEach','userFaxQueue:remove','addAgents','omit','spread','isArray','getAgents','rimraf','fast-json-patch','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','redis','socket.io-emitter','./faxQueue.socket','register','sendStatus','status','end','json','offset','undefined','limit','count'];(function(_0x3e32a8,_0x255953){var _0x2997b0=function(_0x2d564a){while(--_0x2d564a){_0x3e32a8['push'](_0x3e32a8['shift']());}};_0x2997b0(++_0x255953);}(_0xf237,0x1ed));var _0x7f23=function(_0x142156,_0x5169f8){_0x142156=_0x142156-0x0;var _0x5b1ea3=_0xf237[_0x142156];return _0x5b1ea3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7f23('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7f23('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x7f23('0x2'));var Mustache=require('mustache');var util=require(_0x7f23('0x3'));var path=require(_0x7f23('0x4'));var sox=require(_0x7f23('0x5'));var csv=require(_0x7f23('0x6'));var ejs=require(_0x7f23('0x7'));var fs=require('fs');var fs_extra=require(_0x7f23('0x8'));var _=require(_0x7f23('0x9'));var squel=require('squel');var crypto=require(_0x7f23('0xa'));var jsforce=require(_0x7f23('0xb'));var deskjs=require(_0x7f23('0xc'));var toCsv=require(_0x7f23('0x6'));var querystring=require('querystring');var Papa=require(_0x7f23('0xd'));var Redis=require('ioredis');var authService=require(_0x7f23('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7f23('0xf'));var logger=require(_0x7f23('0x10'))('api');var utils=require('../../config/utils');var config=require(_0x7f23('0x11'));var licenseUtil=require(_0x7f23('0x12'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0x7f23('0x13')],{'host':'localhost','port':0x18eb});var socket=require(_0x7f23('0x14'))(new Redis(config[_0x7f23('0x13')]));require(_0x7f23('0x15'))[_0x7f23('0x16')](socket);function respondWithStatusCode(_0x9873ce,_0x47477c){_0x47477c=_0x47477c||0xcc;return function(_0x6adfcb){if(_0x6adfcb){return _0x9873ce[_0x7f23('0x17')](_0x47477c);}return _0x9873ce[_0x7f23('0x18')](_0x47477c)[_0x7f23('0x19')]();};}function respondWithResult(_0x4b80a9,_0x35a755){_0x35a755=_0x35a755||0xc8;return function(_0x4cc45e){if(_0x4cc45e){return _0x4b80a9[_0x7f23('0x18')](_0x35a755)[_0x7f23('0x1a')](_0x4cc45e);}};}function respondWithFilteredResult(_0xca01b0,_0x378f6a){return function(_0x510da5){if(_0x510da5){var _0x241874=typeof _0x378f6a[_0x7f23('0x1b')]===_0x7f23('0x1c')&&typeof _0x378f6a[_0x7f23('0x1d')]===_0x7f23('0x1c');var _0x590588=_0x510da5[_0x7f23('0x1e')];var _0xccbf3=_0x241874?0x0:_0x378f6a['offset'];var _0x4131d2=_0x241874?_0x510da5[_0x7f23('0x1e')]:_0x378f6a['offset']+_0x378f6a[_0x7f23('0x1d')];var _0x533c6e;if(_0x4131d2>=_0x590588){_0x4131d2=_0x590588;_0x533c6e=0xc8;}else{_0x533c6e=0xce;}_0xca01b0[_0x7f23('0x18')](_0x533c6e);return _0xca01b0[_0x7f23('0x1f')](_0x7f23('0x20'),_0xccbf3+'-'+_0x4131d2+'/'+_0x590588)[_0x7f23('0x1a')](_0x510da5);}return null;};}function patchUpdates(_0x23efae){return function(_0x424d18){try{jsonpatch[_0x7f23('0x21')](_0x424d18,_0x23efae,!![]);}catch(_0x27c901){return BPromise[_0x7f23('0x22')](_0x27c901);}return _0x424d18['save']();};}function saveUpdates(_0x219eed,_0x216b61){return function(_0x546a80){if(_0x546a80){return _0x546a80['update'](_0x219eed)[_0x7f23('0x23')](function(_0x51bfb9){return _0x51bfb9;});}return null;};}function removeEntity(_0x37af98,_0x3e25f0){return function(_0x1b32f8){if(_0x1b32f8){return _0x1b32f8[_0x7f23('0x24')]()[_0x7f23('0x23')](function(){var _0x5a1568=_0x1b32f8[_0x7f23('0x25')]({'plain':!![]});var _0x11c708=_0x7f23('0x26');return db[_0x7f23('0x27')][_0x7f23('0x24')]({'where':{'type':_0x11c708,'resourceId':_0x5a1568['id']}})[_0x7f23('0x23')](function(){return _0x1b32f8;});})[_0x7f23('0x23')](function(){_0x37af98[_0x7f23('0x18')](0xcc)[_0x7f23('0x19')]();});}};}function handleEntityNotFound(_0x166545,_0x4144cf){return function(_0x15dbc4){if(!_0x15dbc4){_0x166545[_0x7f23('0x17')](0x194);}return _0x15dbc4;};}function handleError(_0x194eb3,_0x491e3c){_0x491e3c=_0x491e3c||0x1f4;return function(_0x3af0ac){logger['error'](_0x3af0ac['stack']);if(_0x3af0ac['name']){delete _0x3af0ac[_0x7f23('0x28')];}_0x194eb3['status'](_0x491e3c)['send'](_0x3af0ac);};}exports[_0x7f23('0x29')]=function(_0xca2171,_0xefd829){var _0x41f73b={},_0x3ded53={},_0x588129={'count':0x0,'rows':[]};var _0x3210dc=_[_0x7f23('0x2a')](db['FaxQueue'][_0x7f23('0x2b')],function(_0x3039ef){return{'name':_0x3039ef[_0x7f23('0x2c')],'type':_0x3039ef[_0x7f23('0x2d')][_0x7f23('0x2e')]};});_0x3ded53[_0x7f23('0x2f')]=_['map'](_0x3210dc,_0x7f23('0x28'));_0x3ded53[_0x7f23('0x30')]=_['keys'](_0xca2171['query']);_0x3ded53[_0x7f23('0x31')]=_[_0x7f23('0x32')](_0x3ded53[_0x7f23('0x2f')],_0x3ded53['query']);_0x41f73b[_0x7f23('0x33')]=_[_0x7f23('0x32')](_0x3ded53[_0x7f23('0x2f')],qs['fields'](_0xca2171[_0x7f23('0x30')][_0x7f23('0x34')]));_0x41f73b[_0x7f23('0x33')]=_0x41f73b[_0x7f23('0x33')][_0x7f23('0x35')]?_0x41f73b[_0x7f23('0x33')]:_0x3ded53[_0x7f23('0x2f')];if(!_0xca2171['query'][_0x7f23('0x36')](_0x7f23('0x37'))){_0x41f73b[_0x7f23('0x1d')]=qs[_0x7f23('0x1d')](_0xca2171[_0x7f23('0x30')][_0x7f23('0x1d')]);_0x41f73b[_0x7f23('0x1b')]=qs[_0x7f23('0x1b')](_0xca2171[_0x7f23('0x30')]['offset']);}_0x41f73b[_0x7f23('0x38')]=qs[_0x7f23('0x39')](_0xca2171[_0x7f23('0x30')][_0x7f23('0x39')]);_0x41f73b[_0x7f23('0x3a')]=qs['filters'](_[_0x7f23('0x3b')](_0xca2171[_0x7f23('0x30')],_0x3ded53[_0x7f23('0x31')]),_0x3210dc);if(_0xca2171[_0x7f23('0x30')][_0x7f23('0x3c')]){_0x41f73b[_0x7f23('0x3a')]=_[_0x7f23('0x3d')](_0x41f73b[_0x7f23('0x3a')],{'$or':_[_0x7f23('0x2a')](_0x3210dc,function(_0x3483fa){if(_0x3483fa['type']!=='VIRTUAL'){var _0x60c06={};_0x60c06[_0x3483fa[_0x7f23('0x28')]]={'$like':'%'+_0xca2171[_0x7f23('0x30')]['filter']+'%'};return _0x60c06;}})});}_0x41f73b=_[_0x7f23('0x3d')]({},_0x41f73b,_0xca2171['options']);var _0x29f203={'where':_0x41f73b[_0x7f23('0x3a')]};return db[_0x7f23('0x3e')][_0x7f23('0x1e')](_0x29f203)['then'](function(_0x2b87f4){_0x588129[_0x7f23('0x1e')]=_0x2b87f4;if(_0xca2171['query']['includeAll']){_0x41f73b[_0x7f23('0x3f')]=[{'all':!![]}];}return db[_0x7f23('0x3e')][_0x7f23('0x40')](_0x41f73b);})[_0x7f23('0x23')](function(_0x49e2b9){_0x588129['rows']=_0x49e2b9;return _0x588129;})[_0x7f23('0x23')](respondWithFilteredResult(_0xefd829,_0x41f73b))[_0x7f23('0x41')](handleError(_0xefd829,null));};exports[_0x7f23('0x42')]=function(_0x473d92,_0x8d9f26){var _0x4d8226={'raw':!![],'where':{'id':_0x473d92[_0x7f23('0x43')]['id']}},_0x4e2aba={};_0x4e2aba[_0x7f23('0x2f')]=_['keys'](db[_0x7f23('0x3e')][_0x7f23('0x2b')]);_0x4e2aba[_0x7f23('0x30')]=_['keys'](_0x473d92[_0x7f23('0x30')]);_0x4e2aba[_0x7f23('0x31')]=_[_0x7f23('0x32')](_0x4e2aba[_0x7f23('0x2f')],_0x4e2aba['query']);_0x4d8226[_0x7f23('0x33')]=_['intersection'](_0x4e2aba[_0x7f23('0x2f')],qs[_0x7f23('0x34')](_0x473d92[_0x7f23('0x30')]['fields']));_0x4d8226[_0x7f23('0x33')]=_0x4d8226[_0x7f23('0x33')][_0x7f23('0x35')]?_0x4d8226[_0x7f23('0x33')]:_0x4e2aba[_0x7f23('0x2f')];if(_0x473d92['query'][_0x7f23('0x44')]){_0x4d8226[_0x7f23('0x3f')]=[{'all':!![]}];}_0x4d8226=_[_0x7f23('0x3d')]({},_0x4d8226,_0x473d92[_0x7f23('0x45')]);return db[_0x7f23('0x3e')][_0x7f23('0x46')](_0x4d8226)[_0x7f23('0x23')](handleEntityNotFound(_0x8d9f26,null))[_0x7f23('0x23')](respondWithResult(_0x8d9f26,null))[_0x7f23('0x41')](handleError(_0x8d9f26,null));};exports[_0x7f23('0x47')]=function(_0x273154,_0x1d3d58){return db['FaxQueue'][_0x7f23('0x47')](_0x273154['body'],{})[_0x7f23('0x23')](function(_0x54b176){var _0x41afd1=_0x273154[_0x7f23('0x48')][_0x7f23('0x25')]({'plain':!![]});if(!_0x41afd1)throw new Error(_0x7f23('0x49'));if(_0x41afd1[_0x7f23('0x4a')]===_0x7f23('0x48')){var _0x21f243=_0x54b176[_0x7f23('0x25')]({'plain':!![]});var _0x35a9c3=_0x7f23('0x26');return db['UserProfileSection'][_0x7f23('0x46')]({'where':{'name':_0x35a9c3,'userProfileId':_0x41afd1['userProfileId']},'raw':!![]})[_0x7f23('0x23')](function(_0x43f3fb){if(_0x43f3fb&&_0x43f3fb[_0x7f23('0x4b')]===0x0){return db[_0x7f23('0x27')][_0x7f23('0x47')]({'name':_0x21f243[_0x7f23('0x28')],'resourceId':_0x21f243['id'],'type':_0x43f3fb[_0x7f23('0x28')],'sectionId':_0x43f3fb['id']},{})[_0x7f23('0x23')](function(){return _0x54b176;});}else{return _0x54b176;}})[_0x7f23('0x41')](function(_0x2fdf99){logger[_0x7f23('0x4c')](_0x7f23('0x4d'),_0x2fdf99);throw _0x2fdf99;});}return _0x54b176;})[_0x7f23('0x23')](respondWithResult(_0x1d3d58,0xc9))[_0x7f23('0x41')](handleError(_0x1d3d58,null));};exports[_0x7f23('0x4e')]=function(_0x4dead1,_0x3a2eec){if(_0x4dead1[_0x7f23('0x4f')]['id']){delete _0x4dead1[_0x7f23('0x4f')]['id'];}return db[_0x7f23('0x3e')][_0x7f23('0x46')]({'where':{'id':_0x4dead1[_0x7f23('0x43')]['id']}})[_0x7f23('0x23')](handleEntityNotFound(_0x3a2eec,null))[_0x7f23('0x23')](saveUpdates(_0x4dead1['body'],null))[_0x7f23('0x23')](respondWithResult(_0x3a2eec,null))[_0x7f23('0x41')](handleError(_0x3a2eec,null));};exports[_0x7f23('0x24')]=function(_0x259a7f,_0x55ece5){return db[_0x7f23('0x3e')][_0x7f23('0x46')]({'where':{'id':_0x259a7f['params']['id']}})[_0x7f23('0x23')](handleEntityNotFound(_0x55ece5,null))[_0x7f23('0x23')](removeEntity(_0x55ece5,null))[_0x7f23('0x41')](handleError(_0x55ece5,null));};exports['describe']=function(_0x788a7e,_0x4f9e74){return db['FaxQueue'][_0x7f23('0x50')]()[_0x7f23('0x23')](respondWithResult(_0x4f9e74,null))['catch'](handleError(_0x4f9e74,null));};exports['getMembers']=function(_0x233872,_0x5ceaf4,_0x6c602d){var _0x183f46={'raw':!![],'where':{}},_0x22452c={},_0x2f3dac;return db['FaxQueue'][_0x7f23('0x51')]({'where':{'id':_0x233872[_0x7f23('0x43')]['id']}})[_0x7f23('0x23')](handleEntityNotFound(_0x5ceaf4,null))[_0x7f23('0x23')](function(_0x140c88){if(_0x140c88){_0x2f3dac=_0x140c88[_0x7f23('0x25')]({'plain':!![]});_0x22452c[_0x7f23('0x2f')]=_[_0x7f23('0x52')](db[_0x7f23('0x53')][_0x7f23('0x2b')]);_0x22452c['query']=_['keys'](_0x233872['query']);_0x22452c['filters']=_[_0x7f23('0x32')](_0x22452c[_0x7f23('0x2f')],_0x22452c[_0x7f23('0x30')]);_0x183f46[_0x7f23('0x33')]=_[_0x7f23('0x32')](_0x22452c[_0x7f23('0x2f')],qs['fields'](_0x233872['query'][_0x7f23('0x34')]));_0x183f46[_0x7f23('0x33')]=_0x183f46[_0x7f23('0x33')][_0x7f23('0x35')]?_0x183f46[_0x7f23('0x33')]:_0x22452c[_0x7f23('0x2f')];if(!_0x233872[_0x7f23('0x30')][_0x7f23('0x36')]('nolimit')){_0x183f46[_0x7f23('0x1d')]=qs['limit'](_0x233872[_0x7f23('0x30')][_0x7f23('0x1d')]);_0x183f46[_0x7f23('0x1b')]=qs[_0x7f23('0x1b')](_0x233872['query'][_0x7f23('0x1b')]);}_0x183f46[_0x7f23('0x38')]=qs['sort'](_0x233872[_0x7f23('0x30')][_0x7f23('0x39')]);_0x183f46[_0x7f23('0x3a')]=qs[_0x7f23('0x31')](_[_0x7f23('0x3b')](_0x233872[_0x7f23('0x30')],_0x22452c['filters']));_0x183f46['where']['FaxQueueId']=_0x140c88['id'];if(_0x233872['query'][_0x7f23('0x3c')]){_0x183f46[_0x7f23('0x3a')]=_[_0x7f23('0x3d')](_0x183f46[_0x7f23('0x3a')],{'$or':_[_0x7f23('0x2a')](_0x183f46[_0x7f23('0x33')],function(_0x319b98){var _0x5f573c={};_0x5f573c[_0x319b98]={'$like':'%'+_0x233872[_0x7f23('0x30')][_0x7f23('0x3c')]+'%'};return _0x5f573c;})});}_0x183f46=_['merge']({},_0x183f46,_0x233872[_0x7f23('0x45')]);return db['UserFaxQueue'][_0x7f23('0x40')](_0x183f46);}})[_0x7f23('0x23')](function(_0x2ad1a5){if(_0x2ad1a5){return db[_0x7f23('0x54')][_0x7f23('0x55')]({'where':{'id':_['map'](_0x2ad1a5,_0x7f23('0x56')),'role':_0x7f23('0x57')},'attributes':['id',_0x7f23('0x28'),_0x7f23('0x58'),'updatedAt','createdAt']});}})[_0x7f23('0x23')](function(_0x2bfb6f){if(_0x2bfb6f){return{'count':_0x2bfb6f[_0x7f23('0x1e')],'rows':_[_0x7f23('0x2a')](_0x2bfb6f[_0x7f23('0x59')],function(_0x5a8eac){return{'membername':_0x5a8eac[_0x7f23('0x28')],'UserId':_0x5a8eac['id'],'queue_name':_0x2f3dac['name'],'FaxQueueId':_0x2f3dac['id'],'interface':util[_0x7f23('0x5a')](_0x7f23('0x5b'),'SIP',_0x5a8eac[_0x7f23('0x28')]),'penalty':0x0,'paused':_0x5a8eac[_0x7f23('0x58')],'createdAt':_0x5a8eac[_0x7f23('0x5c')],'updatedAt':_0x5a8eac[_0x7f23('0x5d')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x7f23('0x23')](respondWithFilteredResult(_0x5ceaf4,_0x183f46))['catch'](handleError(_0x5ceaf4,null));};exports[_0x7f23('0x5e')]=function(_0x83cd87,_0x480994,_0x277489){var _0x58c108={};var _0x4c5501={};var _0x16a114;var _0x175bde;return db[_0x7f23('0x3e')][_0x7f23('0x51')]({'where':{'id':_0x83cd87['params']['id']}})[_0x7f23('0x23')](handleEntityNotFound(_0x480994,null))[_0x7f23('0x23')](function(_0x22f570){if(_0x22f570){_0x16a114=_0x22f570;_0x4c5501['model']=_[_0x7f23('0x52')](db[_0x7f23('0x5f')]['rawAttributes']);_0x4c5501[_0x7f23('0x30')]=_[_0x7f23('0x52')](_0x83cd87[_0x7f23('0x30')]);_0x4c5501['filters']=_[_0x7f23('0x32')](_0x4c5501[_0x7f23('0x2f')],_0x4c5501[_0x7f23('0x30')]);_0x58c108[_0x7f23('0x33')]=_[_0x7f23('0x32')](_0x4c5501['model'],qs[_0x7f23('0x34')](_0x83cd87[_0x7f23('0x30')][_0x7f23('0x34')]));_0x58c108[_0x7f23('0x33')]=_0x58c108[_0x7f23('0x33')][_0x7f23('0x35')]?_0x58c108[_0x7f23('0x33')]:_0x4c5501[_0x7f23('0x2f')];_0x58c108[_0x7f23('0x38')]=qs[_0x7f23('0x39')](_0x83cd87[_0x7f23('0x30')][_0x7f23('0x39')]);_0x58c108[_0x7f23('0x3a')]=qs[_0x7f23('0x31')](_[_0x7f23('0x3b')](_0x83cd87[_0x7f23('0x30')],_0x4c5501[_0x7f23('0x31')]));if(_0x83cd87[_0x7f23('0x30')][_0x7f23('0x3c')]){_0x58c108['where']=_['merge'](_0x58c108[_0x7f23('0x3a')],{'$or':_[_0x7f23('0x2a')](_0x58c108[_0x7f23('0x33')],function(_0x4e8d81){var _0x23c0ce={};_0x23c0ce[_0x4e8d81]={'$like':'%'+_0x83cd87['query']['filter']+'%'};return _0x23c0ce;})});}_0x58c108=_[_0x7f23('0x3d')]({},_0x58c108,_0x83cd87['options']);return _0x16a114[_0x7f23('0x5e')](_0x58c108);}})[_0x7f23('0x23')](function(_0x5dacbc){if(_0x5dacbc){_0x175bde=_0x5dacbc[_0x7f23('0x35')];if(!_0x83cd87[_0x7f23('0x30')][_0x7f23('0x36')](_0x7f23('0x37'))){_0x58c108[_0x7f23('0x1d')]=qs[_0x7f23('0x1d')](_0x83cd87[_0x7f23('0x30')]['limit']);_0x58c108[_0x7f23('0x1b')]=qs[_0x7f23('0x1b')](_0x83cd87[_0x7f23('0x30')]['offset']);}return _0x16a114[_0x7f23('0x5e')](_0x58c108);}})[_0x7f23('0x23')](function(_0x5f348c){if(_0x5f348c){return _0x5f348c?{'count':_0x175bde,'rows':_0x5f348c}:null;}})[_0x7f23('0x23')](respondWithResult(_0x480994,null))[_0x7f23('0x41')](handleError(_0x480994,null));};exports[_0x7f23('0x60')]=function(_0x10785f,_0x41da63,_0x28f006){var _0x50da88=_0x10785f[_0x7f23('0x4f')][_0x7f23('0x61')];return db['Team'][_0x7f23('0x40')]({'where':{'id':_0x50da88},'attributes':['id'],'include':[{'model':db[_0x7f23('0x54')],'as':_0x7f23('0x62'),'attributes':['id','name',_0x7f23('0x63'),_0x7f23('0x64'),_0x7f23('0x65')],'raw':!![]}]})[_0x7f23('0x23')](function(_0x38e546){if(_0x38e546){var _0x478884=_[_0x7f23('0x66')](_0x38e546,function(_0x5a44d5){var _0x6b503=_0x5a44d5[_0x7f23('0x25')]({'plain':!![]});return _0x6b503[_0x7f23('0x62')];});return db[_0x7f23('0x3e')][_0x7f23('0x46')]({'where':{'id':_0x10785f[_0x7f23('0x43')]['id']}})[_0x7f23('0x23')](function(_0x35acac){return db[_0x7f23('0x67')][_0x7f23('0x68')](function(_0x4d2a1f){return _0x35acac[_0x7f23('0x60')](_0x50da88,{'transaction':_0x4d2a1f})[_0x7f23('0x23')](function(){return BPromise['each'](_0x478884,function(_0x469bd2){return db[_0x7f23('0x53')]['findOrCreate']({'where':{'UserId':_0x469bd2['id'],'FaxQueueId':_0x10785f[_0x7f23('0x43')]['id']},'transaction':_0x4d2a1f});});})['then'](function(){_0x478884['forEach'](function(_0x1615ad){socket[_0x7f23('0x69')]('userFaxQueue:save',{'UserId':_0x1615ad['id'],'FaxQueueId':_0x35acac['id']});});});});});}})[_0x7f23('0x23')](respondWithStatusCode(_0x41da63,null))['catch'](handleError(_0x41da63,null));};exports[_0x7f23('0x6a')]=function(_0x17ad24,_0x390106,_0x384f37){return db[_0x7f23('0x5f')]['findAll']({'where':{'id':_0x17ad24[_0x7f23('0x30')][_0x7f23('0x61')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x7f23('0x62'),'attributes':['id'],'raw':!![]}]})[_0x7f23('0x23')](handleEntityNotFound(_0x390106,null))[_0x7f23('0x23')](function(_0x15d86c){var _0x19ed94=_[_0x7f23('0x2a')](_0x15d86c,'id');var _0x229b19=[];var _0x4322d9=[];var _0x29566d=squel['select']();_0x29566d['field']('tq.TeamId')[_0x7f23('0x6b')](_0x7f23('0x6c'),'tq')[_0x7f23('0x6d')](_0x7f23('0x6e'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x7f23('0x3a')](_0x7f23('0x6f'),_0x17ad24[_0x7f23('0x43')]['id']);for(var _0x315b28=0x0;_0x315b28<_0x15d86c[_0x7f23('0x35')];_0x315b28+=0x1){let _0x47449c=_0x15d86c[_0x315b28];for(var _0x505af2=0x0;_0x505af2<_0x47449c[_0x7f23('0x62')][_0x7f23('0x35')];_0x505af2+=0x1){let _0x4c255f=_0x47449c[_0x7f23('0x62')][_0x505af2];var _0x3c6951=_0x29566d[_0x7f23('0x70')]();_0x3c6951['where']('ut.UserId\x20=\x20?',_0x4c255f['id']);_0x4322d9[_0x7f23('0x71')](db[_0x7f23('0x67')][_0x7f23('0x30')](_0x3c6951[_0x7f23('0x72')](),{'type':db['sequelize'][_0x7f23('0x73')][_0x7f23('0x74')]})[_0x7f23('0x23')](function(_0x149bc2){if(_0x149bc2[_0x7f23('0x35')]===0x1){return _0x4c255f['id'];}else{var _0x4716e7=_[_0x7f23('0x75')](_['map'](_0x149bc2,'TeamId'),function(_0x4feab1){return _[_0x7f23('0x76')](_0x19ed94,_0x4feab1);});if(_0x4716e7){return _0x4c255f['id'];}}}));}}return BPromise[_0x7f23('0x77')](_0x4322d9)['then'](function(_0x4a4262){_0x229b19=_(_0x229b19)[_0x7f23('0x78')](_0x4a4262)[_0x7f23('0x79')]()[_0x7f23('0x7a')]();return db[_0x7f23('0x3e')]['find']({'where':{'id':_0x17ad24[_0x7f23('0x43')]['id']}})['then'](function(_0x563d75){return db[_0x7f23('0x67')][_0x7f23('0x68')](function(_0x54e06f){return _0x563d75[_0x7f23('0x6a')](_0x17ad24[_0x7f23('0x30')][_0x7f23('0x61')],{'transaction':_0x54e06f})[_0x7f23('0x23')](function(){if(!_['isEmpty'](_0x229b19)){return _0x563d75[_0x7f23('0x7b')](_0x229b19,{'transaction':_0x54e06f});}})[_0x7f23('0x23')](function(){_0x229b19[_0x7f23('0x7c')](function(_0x3af3a1){socket[_0x7f23('0x69')](_0x7f23('0x7d'),{'UserId':_0x3af3a1,'FaxQueueId':_0x563d75['id']});});});});});});})[_0x7f23('0x23')](respondWithStatusCode(_0x390106,null))[_0x7f23('0x41')](handleError(_0x390106,null));};exports['addAgents']=function(_0x1713d5,_0x3b0151,_0x1024b6){return db[_0x7f23('0x3e')][_0x7f23('0x46')]({'where':{'id':_0x1713d5[_0x7f23('0x43')]['id']}})[_0x7f23('0x23')](handleEntityNotFound(_0x3b0151,null))['then'](function(_0x18876b){if(_0x18876b){return _0x18876b[_0x7f23('0x7e')](_0x1713d5[_0x7f23('0x4f')][_0x7f23('0x61')],_[_0x7f23('0x7f')](_0x1713d5[_0x7f23('0x4f')],[_0x7f23('0x61'),'id'])||{})[_0x7f23('0x80')](function(_0x4382f3){for(var _0x4497c4=0x0;_0x4497c4<_0x1713d5['body']['ids'][_0x7f23('0x35')];_0x4497c4+=0x1){socket[_0x7f23('0x69')]('userFaxQueue:save',{'UserId':Number(_0x1713d5['body']['ids'][_0x4497c4]),'FaxQueueId':Number(_0x1713d5[_0x7f23('0x43')]['id'])});}return _0x4382f3;});}})[_0x7f23('0x23')](respondWithResult(_0x3b0151,null))[_0x7f23('0x41')](handleError(_0x3b0151,null));};exports[_0x7f23('0x7b')]=function(_0x1ff8bf,_0x13b1ab,_0xf85b42){return db['FaxQueue'][_0x7f23('0x46')]({'where':{'id':_0x1ff8bf['params']['id']}})[_0x7f23('0x23')](handleEntityNotFound(_0x13b1ab,null))['then'](function(_0x2c7b4e){if(_0x2c7b4e){return _0x2c7b4e[_0x7f23('0x7b')](_0x1ff8bf[_0x7f23('0x30')][_0x7f23('0x61')])[_0x7f23('0x23')](function(){if(_[_0x7f23('0x81')](_0x1ff8bf[_0x7f23('0x30')]['ids'])){for(var _0x4a5f8b=0x0;_0x4a5f8b<_0x1ff8bf[_0x7f23('0x30')]['ids'][_0x7f23('0x35')];_0x4a5f8b+=0x1){socket[_0x7f23('0x69')](_0x7f23('0x7d'),{'UserId':Number(_0x1ff8bf[_0x7f23('0x30')]['ids'][_0x4a5f8b]),'FaxQueueId':Number(_0x1ff8bf['params']['id'])});}}else{socket[_0x7f23('0x69')](_0x7f23('0x7d'),{'UserId':Number(_0x1ff8bf[_0x7f23('0x30')][_0x7f23('0x61')]),'FaxQueueId':Number(_0x1ff8bf[_0x7f23('0x43')]['id'])});}});}})[_0x7f23('0x23')](respondWithStatusCode(_0x13b1ab,null))['catch'](handleError(_0x13b1ab,null));};exports[_0x7f23('0x82')]=function(_0x1dba84,_0x401477,_0x572dad){var _0x3da768={};var _0x2f37b2={};var _0x286899;var _0x1a2b9;return db['FaxQueue'][_0x7f23('0x51')]({'where':{'id':_0x1dba84[_0x7f23('0x43')]['id']}})[_0x7f23('0x23')](handleEntityNotFound(_0x401477,null))[_0x7f23('0x23')](function(_0x5af611){if(_0x5af611){_0x286899=_0x5af611;_0x2f37b2[_0x7f23('0x2f')]=_[_0x7f23('0x52')](db[_0x7f23('0x54')][_0x7f23('0x2b')]);_0x2f37b2[_0x7f23('0x30')]=_[_0x7f23('0x52')](_0x1dba84['query']);_0x2f37b2[_0x7f23('0x31')]=_[_0x7f23('0x32')](_0x2f37b2[_0x7f23('0x2f')],_0x2f37b2[_0x7f23('0x30')]);_0x3da768[_0x7f23('0x33')]=_[_0x7f23('0x32')](_0x2f37b2[_0x7f23('0x2f')],qs['fields'](_0x1dba84[_0x7f23('0x30')][_0x7f23('0x34')]));_0x3da768[_0x7f23('0x33')]=_0x3da768[_0x7f23('0x33')][_0x7f23('0x35')]?_0x3da768[_0x7f23('0x33')]:_0x2f37b2[_0x7f23('0x2f')];_0x3da768[_0x7f23('0x38')]=qs[_0x7f23('0x39')](_0x1dba84[_0x7f23('0x30')][_0x7f23('0x39')]);_0x3da768[_0x7f23('0x3a')]=qs[_0x7f23('0x31')](_[_0x7f23('0x3b')](_0x1dba84[_0x7f23('0x30')],_0x2f37b2[_0x7f23('0x31')]));if(_0x1dba84['query']['filter']){_0x3da768[_0x7f23('0x3a')]=_[_0x7f23('0x3d')](_0x3da768[_0x7f23('0x3a')],{'$or':_[_0x7f23('0x2a')](_0x3da768[_0x7f23('0x33')],function(_0x43cd7f){var _0x24caaf={};_0x24caaf[_0x43cd7f]={'$like':'%'+_0x1dba84[_0x7f23('0x30')][_0x7f23('0x3c')]+'%'};return _0x24caaf;})});}_0x3da768=_[_0x7f23('0x3d')]({},_0x3da768,_0x1dba84[_0x7f23('0x45')]);return _0x286899[_0x7f23('0x82')](_0x3da768);}})[_0x7f23('0x23')](function(_0x127a64){if(_0x127a64){_0x1a2b9=_0x127a64[_0x7f23('0x35')];if(!_0x1dba84[_0x7f23('0x30')][_0x7f23('0x36')](_0x7f23('0x37'))){_0x3da768[_0x7f23('0x1d')]=qs[_0x7f23('0x1d')](_0x1dba84[_0x7f23('0x30')]['limit']);_0x3da768['offset']=qs['offset'](_0x1dba84[_0x7f23('0x30')][_0x7f23('0x1b')]);}return _0x286899[_0x7f23('0x82')](_0x3da768);}})[_0x7f23('0x23')](function(_0x272c63){if(_0x272c63){return _0x272c63?{'count':_0x1a2b9,'rows':_0x272c63}:null;}})[_0x7f23('0x23')](respondWithResult(_0x401477,null))['catch'](handleError(_0x401477,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index f6b7ca2..7b3fa31 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 _0x97db=['save','update','remove','emit','hasOwnProperty','exports','FaxQueue','setMaxListeners'];(function(_0x1d4b5b,_0x50a7cf){var _0x13e586=function(_0x317636){while(--_0x317636){_0x1d4b5b['push'](_0x1d4b5b['shift']());}};_0x13e586(++_0x50a7cf);}(_0x97db,0xc6));var _0xb97d=function(_0x53d5ce,_0x21ccb2){_0x53d5ce=_0x53d5ce-0x0;var _0x5238d4=_0x97db[_0x53d5ce];return _0x5238d4;};'use strict';var EventEmitter=require('events');var FaxQueue=require('../../mysqldb')['db'][_0xb97d('0x0')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0xb97d('0x1')](0x0);var events={'afterCreate':_0xb97d('0x2'),'afterUpdate':_0xb97d('0x3'),'afterDestroy':_0xb97d('0x4')};function emitEvent(_0x16d9a9){return function(_0x187278,_0x1e415d,_0x35ec00){FaxQueueEvents['emit'](_0x16d9a9+':'+_0x187278['id'],_0x187278);FaxQueueEvents[_0xb97d('0x5')](_0x16d9a9,_0x187278);_0x35ec00(null);};}for(var e in events){if(events[_0xb97d('0x6')](e)){var event=events[e];FaxQueue['hook'](e,emitEvent(event));}}module[_0xb97d('0x7')]=FaxQueueEvents; \ No newline at end of file +var _0x9bba=['FaxQueue','setMaxListeners','save','remove','hasOwnProperty','exports','events','../../mysqldb'];(function(_0xaf734f,_0x3f8728){var _0x485d8b=function(_0x47b587){while(--_0x47b587){_0xaf734f['push'](_0xaf734f['shift']());}};_0x485d8b(++_0x3f8728);}(_0x9bba,0x1c6));var _0xa9bb=function(_0x15caf8,_0x3fb3aa){_0x15caf8=_0x15caf8-0x0;var _0x2c5b7a=_0x9bba[_0x15caf8];return _0x2c5b7a;};'use strict';var EventEmitter=require(_0xa9bb('0x0'));var FaxQueue=require(_0xa9bb('0x1'))['db'][_0xa9bb('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0xa9bb('0x3')](0x0);var events={'afterCreate':_0xa9bb('0x4'),'afterUpdate':'update','afterDestroy':_0xa9bb('0x5')};function emitEvent(_0x570a6c){return function(_0x12b84e,_0x4a609c,_0x30055f){FaxQueueEvents['emit'](_0x570a6c+':'+_0x12b84e['id'],_0x12b84e);FaxQueueEvents['emit'](_0x570a6c,_0x12b84e);_0x30055f(null);};}for(var e in events){if(events[_0xa9bb('0x6')](e)){var event=events[e];FaxQueue['hook'](e,emitEvent(event));}}module[_0xa9bb('0x7')]=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index bae0afa..f615dbc 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 _0x7955=['api','moment','bluebird','path','rimraf','../../config/environment','./faxQueue.attributes','exports','define','FaxQueue','fax_queues','util','../../config/logger'];(function(_0x3b5f66,_0x1dbfc5){var _0x4aa1a8=function(_0x57c05c){while(--_0x57c05c){_0x3b5f66['push'](_0x3b5f66['shift']());}};_0x4aa1a8(++_0x1dbfc5);}(_0x7955,0x136));var _0x5795=function(_0x25abee,_0x577ca9){_0x25abee=_0x25abee-0x0;var _0x24696f=_0x7955[_0x25abee];return _0x24696f;};'use strict';var _=require('lodash');var util=require(_0x5795('0x0'));var logger=require(_0x5795('0x1'))(_0x5795('0x2'));var moment=require(_0x5795('0x3'));var BPromise=require(_0x5795('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5795('0x5'));var rimraf=require(_0x5795('0x6'));var config=require(_0x5795('0x7'));var attributes=require(_0x5795('0x8'));module[_0x5795('0x9')]=function(_0x542f85,_0x1c2e47){return _0x542f85[_0x5795('0xa')](_0x5795('0xb'),attributes,{'tableName':_0x5795('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x01e7=['fax_queues','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x5856b9,_0xa1a0cd){var _0xab812c=function(_0x5c57f9){while(--_0x5c57f9){_0x5856b9['push'](_0x5856b9['shift']());}};_0xab812c(++_0xa1a0cd);}(_0x01e7,0x135));var _0x701e=function(_0x51dcd7,_0x15147e){_0x51dcd7=_0x51dcd7-0x0;var _0x34dfd5=_0x01e7[_0x51dcd7];return _0x34dfd5;};'use strict';var _=require(_0x701e('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x701e('0x1'));var moment=require(_0x701e('0x2'));var BPromise=require(_0x701e('0x3'));var rp=require(_0x701e('0x4'));var fs=require('fs');var path=require(_0x701e('0x5'));var rimraf=require(_0x701e('0x6'));var config=require(_0x701e('0x7'));var attributes=require('./faxQueue.attributes');module[_0x701e('0x8')]=function(_0x526ad3,_0x590493){return _0x526ad3[_0x701e('0x9')]('FaxQueue',attributes,{'tableName':_0x701e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.rpc.js b/server/api/faxQueue/faxQueue.rpc.js index 6471fe0..580f4a6 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 _0xc0fd=['raw','lodash','util','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','then','info','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','findAll','options','where','limit','include','map','model','attributes','GetFaxQueue','ShowFaxQueue','FaxQueue','find'];(function(_0x43b155,_0x2fe81b){var _0x39f9f4=function(_0x250f36){while(--_0x250f36){_0x43b155['push'](_0x43b155['shift']());}};_0x39f9f4(++_0x2fe81b);}(_0xc0fd,0xc4));var _0xdc0f=function(_0x1f8212,_0x29e93b){_0x1f8212=_0x1f8212-0x0;var _0x38523f=_0xc0fd[_0x1f8212];return _0x38523f;};'use strict';var _=require(_0xdc0f('0x0'));var util=require(_0xdc0f('0x1'));var moment=require('moment');var BPromise=require(_0xdc0f('0x2'));var rs=require(_0xdc0f('0x3'));var fs=require('fs');var Redis=require(_0xdc0f('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xdc0f('0x5'))(_0xdc0f('0x6'));var config=require(_0xdc0f('0x7'));var jayson=require(_0xdc0f('0x8'));var client=jayson['client'][_0xdc0f('0x9')]({'port':0x232a});config[_0xdc0f('0xa')]=_[_0xdc0f('0xb')](config[_0xdc0f('0xa')],{'host':_0xdc0f('0xc'),'port':0x18eb});var socket=require(_0xdc0f('0xd'))(new Redis(config[_0xdc0f('0xa')]));require(_0xdc0f('0xe'))['register'](socket);function respondWithRpcPromise(_0x77af9e,_0x4e63c3,_0x28886d){return new BPromise(function(_0x41c805,_0x9fd524){return client['request'](_0x77af9e,_0x28886d)[_0xdc0f('0xf')](function(_0x4996ca){logger[_0xdc0f('0x10')](_0xdc0f('0x11'),_0x4e63c3,_0xdc0f('0x12'));logger[_0xdc0f('0x13')]('FaxQueue,\x20%s,\x20%s,\x20%s',_0x4e63c3,'request\x20sent',JSON[_0xdc0f('0x14')](_0x4996ca));if(_0x4996ca['error']){if(_0x4996ca[_0xdc0f('0x15')][_0xdc0f('0x16')]===0x1f4){logger[_0xdc0f('0x15')]('FaxQueue,\x20%s,\x20%s',_0x4e63c3,_0x4996ca['error'][_0xdc0f('0x17')]);return _0x9fd524(_0x4996ca[_0xdc0f('0x15')][_0xdc0f('0x17')]);}logger[_0xdc0f('0x15')](_0xdc0f('0x11'),_0x4e63c3,_0x4996ca[_0xdc0f('0x15')]['message']);return _0x41c805(_0x4996ca['error']['message']);}else{logger['info'](_0xdc0f('0x11'),_0x4e63c3,_0xdc0f('0x12'));_0x41c805(_0x4996ca[_0xdc0f('0x18')][_0xdc0f('0x17')]);}})[_0xdc0f('0x19')](function(_0x37d443){logger[_0xdc0f('0x15')](_0xdc0f('0x11'),_0x4e63c3,_0x37d443);_0x9fd524(_0x37d443);});});}exports['GetFaxQueue']=function(_0xc2668a){var _0x5ec372=this;return new Promise(function(_0x487a89,_0x3456bb){return db['FaxQueue'][_0xdc0f('0x1a')]({'raw':_0xc2668a[_0xdc0f('0x1b')]?_0xc2668a['options']['raw']===undefined?!![]:![]:!![],'where':_0xc2668a[_0xdc0f('0x1b')]?_0xc2668a[_0xdc0f('0x1b')][_0xdc0f('0x1c')]||null:null,'attributes':_0xc2668a['options']?_0xc2668a[_0xdc0f('0x1b')]['attributes']||null:null,'limit':_0xc2668a[_0xdc0f('0x1b')]?_0xc2668a[_0xdc0f('0x1b')][_0xdc0f('0x1d')]||null:null,'include':_0xc2668a[_0xdc0f('0x1b')]?_0xc2668a[_0xdc0f('0x1b')][_0xdc0f('0x1e')]?_[_0xdc0f('0x1f')](_0xc2668a[_0xdc0f('0x1b')][_0xdc0f('0x1e')],function(_0x4998d6){return{'model':db[_0x4998d6[_0xdc0f('0x20')]],'as':_0x4998d6['as'],'attributes':_0x4998d6[_0xdc0f('0x21')],'include':_0x4998d6[_0xdc0f('0x1e')]?_['map'](_0x4998d6[_0xdc0f('0x1e')],function(_0x4c475f){return{'model':db[_0x4c475f['model']],'as':_0x4c475f['as'],'attributes':_0x4c475f['attributes'],'include':_0x4c475f[_0xdc0f('0x1e')]?_[_0xdc0f('0x1f')](_0x4c475f[_0xdc0f('0x1e')],function(_0x1c3c13){return{'model':db[_0x1c3c13[_0xdc0f('0x20')]],'as':_0x1c3c13['as'],'attributes':_0x1c3c13[_0xdc0f('0x21')]};}):[]};}):[]};}):[]:[]})[_0xdc0f('0xf')](function(_0x67c648){logger[_0xdc0f('0x10')](_0xdc0f('0x22'),_0xc2668a);logger[_0xdc0f('0x13')]('GetFaxQueue',_0xc2668a,JSON[_0xdc0f('0x14')](_0x67c648));_0x487a89(_0x67c648);})['catch'](function(_0x3b46ab){logger[_0xdc0f('0x15')](_0xdc0f('0x22'),_0x3b46ab[_0xdc0f('0x17')],_0xc2668a);_0x3456bb(_0x5ec372['error'](0x1f4,_0x3b46ab[_0xdc0f('0x17')]));});});};exports[_0xdc0f('0x23')]=function(_0x208ec2){var _0x2dc0da=this;return new Promise(function(_0x59c9b2,_0x1c23dd){return db[_0xdc0f('0x24')][_0xdc0f('0x25')]({'raw':_0x208ec2[_0xdc0f('0x1b')]?_0x208ec2[_0xdc0f('0x1b')][_0xdc0f('0x26')]===undefined?!![]:![]:!![],'where':_0x208ec2[_0xdc0f('0x1b')]?_0x208ec2[_0xdc0f('0x1b')][_0xdc0f('0x1c')]||null:null,'attributes':_0x208ec2['options']?_0x208ec2[_0xdc0f('0x1b')][_0xdc0f('0x21')]||null:null,'include':_0x208ec2['options']?_0x208ec2[_0xdc0f('0x1b')]['include']?_['map'](_0x208ec2['options'][_0xdc0f('0x1e')],function(_0x254a94){return{'model':db[_0x254a94['model']],'as':_0x254a94['as'],'attributes':_0x254a94[_0xdc0f('0x21')],'include':_0x254a94[_0xdc0f('0x1e')]?_['map'](_0x254a94[_0xdc0f('0x1e')],function(_0x41fe38){return{'model':db[_0x41fe38['model']],'as':_0x41fe38['as'],'attributes':_0x41fe38[_0xdc0f('0x21')],'include':_0x41fe38[_0xdc0f('0x1e')]?_[_0xdc0f('0x1f')](_0x41fe38['include'],function(_0x2888af){return{'model':db[_0x2888af['model']],'as':_0x2888af['as'],'attributes':_0x2888af[_0xdc0f('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x505d59){logger[_0xdc0f('0x10')]('ShowFaxQueue',_0x208ec2);logger[_0xdc0f('0x13')](_0xdc0f('0x23'),_0x208ec2,JSON[_0xdc0f('0x14')](_0x505d59));_0x59c9b2(_0x505d59);})[_0xdc0f('0x19')](function(_0x32d766){logger[_0xdc0f('0x15')]('ShowFaxQueue',_0x32d766['message'],_0x208ec2);_0x1c23dd(_0x2dc0da['error'](0x1f4,_0x32d766[_0xdc0f('0x17')]));});});}; \ No newline at end of file +var _0xc676=['socket.io-emitter','./faxQueue.socket','register','request','then','info','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','GetFaxQueue','FaxQueue','findAll','options','raw','where','attributes','map','include','model','ShowFaxQueue','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','redis','localhost'];(function(_0x39a00e,_0x3f9100){var _0x1778f7=function(_0x30fcc2){while(--_0x30fcc2){_0x39a00e['push'](_0x39a00e['shift']());}};_0x1778f7(++_0x3f9100);}(_0xc676,0x1aa));var _0x6c67=function(_0x366318,_0x26a66f){_0x366318=_0x366318-0x0;var _0x396314=_0xc676[_0x366318];return _0x396314;};'use strict';var _=require(_0x6c67('0x0'));var util=require(_0x6c67('0x1'));var moment=require(_0x6c67('0x2'));var BPromise=require(_0x6c67('0x3'));var rs=require(_0x6c67('0x4'));var fs=require('fs');var Redis=require(_0x6c67('0x5'));var db=require(_0x6c67('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x6c67('0x7'))(_0x6c67('0x8'));var config=require('../../config/environment');var jayson=require(_0x6c67('0x9'));var client=jayson[_0x6c67('0xa')][_0x6c67('0xb')]({'port':0x232a});config[_0x6c67('0xc')]=_['defaults'](config[_0x6c67('0xc')],{'host':_0x6c67('0xd'),'port':0x18eb});var socket=require(_0x6c67('0xe'))(new Redis(config[_0x6c67('0xc')]));require(_0x6c67('0xf'))[_0x6c67('0x10')](socket);function respondWithRpcPromise(_0x340f40,_0x3e0abb,_0x48e4d9){return new BPromise(function(_0x773b89,_0x3cb916){return client[_0x6c67('0x11')](_0x340f40,_0x48e4d9)[_0x6c67('0x12')](function(_0x54f672){logger[_0x6c67('0x13')](_0x6c67('0x14'),_0x3e0abb,_0x6c67('0x15'));logger[_0x6c67('0x16')]('FaxQueue,\x20%s,\x20%s,\x20%s',_0x3e0abb,_0x6c67('0x15'),JSON[_0x6c67('0x17')](_0x54f672));if(_0x54f672[_0x6c67('0x18')]){if(_0x54f672[_0x6c67('0x18')]['code']===0x1f4){logger['error']('FaxQueue,\x20%s,\x20%s',_0x3e0abb,_0x54f672[_0x6c67('0x18')][_0x6c67('0x19')]);return _0x3cb916(_0x54f672['error']['message']);}logger[_0x6c67('0x18')](_0x6c67('0x14'),_0x3e0abb,_0x54f672[_0x6c67('0x18')][_0x6c67('0x19')]);return _0x773b89(_0x54f672[_0x6c67('0x18')]['message']);}else{logger[_0x6c67('0x13')](_0x6c67('0x14'),_0x3e0abb,'request\x20sent');_0x773b89(_0x54f672[_0x6c67('0x1a')][_0x6c67('0x19')]);}})[_0x6c67('0x1b')](function(_0x35c071){logger['error']('FaxQueue,\x20%s,\x20%s',_0x3e0abb,_0x35c071);_0x3cb916(_0x35c071);});});}exports[_0x6c67('0x1c')]=function(_0x4681c8){var _0xfa54c2=this;return new Promise(function(_0x44ae07,_0x1bd4e0){return db[_0x6c67('0x1d')][_0x6c67('0x1e')]({'raw':_0x4681c8[_0x6c67('0x1f')]?_0x4681c8[_0x6c67('0x1f')][_0x6c67('0x20')]===undefined?!![]:![]:!![],'where':_0x4681c8[_0x6c67('0x1f')]?_0x4681c8['options'][_0x6c67('0x21')]||null:null,'attributes':_0x4681c8['options']?_0x4681c8['options'][_0x6c67('0x22')]||null:null,'limit':_0x4681c8['options']?_0x4681c8[_0x6c67('0x1f')]['limit']||null:null,'include':_0x4681c8[_0x6c67('0x1f')]?_0x4681c8[_0x6c67('0x1f')]['include']?_[_0x6c67('0x23')](_0x4681c8[_0x6c67('0x1f')][_0x6c67('0x24')],function(_0x1a96b5){return{'model':db[_0x1a96b5[_0x6c67('0x25')]],'as':_0x1a96b5['as'],'attributes':_0x1a96b5['attributes'],'include':_0x1a96b5[_0x6c67('0x24')]?_[_0x6c67('0x23')](_0x1a96b5[_0x6c67('0x24')],function(_0x3eb608){return{'model':db[_0x3eb608['model']],'as':_0x3eb608['as'],'attributes':_0x3eb608[_0x6c67('0x22')],'include':_0x3eb608['include']?_['map'](_0x3eb608[_0x6c67('0x24')],function(_0x2ef124){return{'model':db[_0x2ef124['model']],'as':_0x2ef124['as'],'attributes':_0x2ef124[_0x6c67('0x22')]};}):[]};}):[]};}):[]:[]})[_0x6c67('0x12')](function(_0x3cbb9b){logger[_0x6c67('0x13')]('GetFaxQueue',_0x4681c8);logger[_0x6c67('0x16')]('GetFaxQueue',_0x4681c8,JSON[_0x6c67('0x17')](_0x3cbb9b));_0x44ae07(_0x3cbb9b);})[_0x6c67('0x1b')](function(_0x7f4645){logger[_0x6c67('0x18')](_0x6c67('0x1c'),_0x7f4645[_0x6c67('0x19')],_0x4681c8);_0x1bd4e0(_0xfa54c2[_0x6c67('0x18')](0x1f4,_0x7f4645[_0x6c67('0x19')]));});});};exports[_0x6c67('0x26')]=function(_0x16df85){var _0x583cde=this;return new Promise(function(_0x28b2a3,_0xe56dc){return db[_0x6c67('0x1d')][_0x6c67('0x27')]({'raw':_0x16df85[_0x6c67('0x1f')]?_0x16df85[_0x6c67('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x16df85[_0x6c67('0x1f')]?_0x16df85[_0x6c67('0x1f')][_0x6c67('0x21')]||null:null,'attributes':_0x16df85[_0x6c67('0x1f')]?_0x16df85['options'][_0x6c67('0x22')]||null:null,'include':_0x16df85[_0x6c67('0x1f')]?_0x16df85['options'][_0x6c67('0x24')]?_[_0x6c67('0x23')](_0x16df85[_0x6c67('0x1f')]['include'],function(_0x5e7dab){return{'model':db[_0x5e7dab[_0x6c67('0x25')]],'as':_0x5e7dab['as'],'attributes':_0x5e7dab['attributes'],'include':_0x5e7dab[_0x6c67('0x24')]?_[_0x6c67('0x23')](_0x5e7dab[_0x6c67('0x24')],function(_0x2c98f7){return{'model':db[_0x2c98f7['model']],'as':_0x2c98f7['as'],'attributes':_0x2c98f7[_0x6c67('0x22')],'include':_0x2c98f7[_0x6c67('0x24')]?_[_0x6c67('0x23')](_0x2c98f7[_0x6c67('0x24')],function(_0x4455d4){return{'model':db[_0x4455d4[_0x6c67('0x25')]],'as':_0x4455d4['as'],'attributes':_0x4455d4[_0x6c67('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5389d6){logger[_0x6c67('0x13')](_0x6c67('0x26'),_0x16df85);logger[_0x6c67('0x16')]('ShowFaxQueue',_0x16df85,JSON[_0x6c67('0x17')](_0x5389d6));_0x28b2a3(_0x5389d6);})[_0x6c67('0x1b')](function(_0x42a2ce){logger[_0x6c67('0x18')]('ShowFaxQueue',_0x42a2ce['message'],_0x16df85);_0xe56dc(_0x583cde[_0x6c67('0x18')](0x1f4,_0x42a2ce[_0x6c67('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index e9d29d4..85a23b0 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 _0x7ba0=['emit','removeListener','faxQueue:','./faxQueue.events','save','remove','update'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x7ba0,0x1bc));var _0x07ba=function(_0x84e45c,_0x1f2fae){_0x84e45c=_0x84e45c-0x0;var _0x67b239=_0x7ba0[_0x84e45c];return _0x67b239;};'use strict';var FaxQueueEvents=require(_0x07ba('0x0'));var events=[_0x07ba('0x1'),_0x07ba('0x2'),_0x07ba('0x3')];function createListener(_0x26493e,_0x291a3e){return function(_0x3c50ce){_0x291a3e[_0x07ba('0x4')](_0x26493e,_0x3c50ce);};}function removeListener(_0x670c22,_0x1e974e){return function(){FaxQueueEvents[_0x07ba('0x5')](_0x670c22,_0x1e974e);};}exports['register']=function(_0x108d98){for(var _0x506476=0x0,_0x526a8e=events['length'];_0x506476<_0x526a8e;_0x506476++){var _0xd33c43=events[_0x506476];var _0x3adcf5=createListener(_0x07ba('0x6')+_0xd33c43,_0x108d98);FaxQueueEvents['on'](_0xd33c43,_0x3adcf5);}}; \ No newline at end of file +var _0x9561=['faxQueue:','./faxQueue.events','save','update'];(function(_0x248f49,_0x135d1f){var _0x32770e=function(_0x27c5a2){while(--_0x27c5a2){_0x248f49['push'](_0x248f49['shift']());}};_0x32770e(++_0x135d1f);}(_0x9561,0x109));var _0x1956=function(_0x40d411,_0x4642f1){_0x40d411=_0x40d411-0x0;var _0x51fd22=_0x9561[_0x40d411];return _0x51fd22;};'use strict';var FaxQueueEvents=require(_0x1956('0x0'));var events=[_0x1956('0x1'),'remove',_0x1956('0x2')];function createListener(_0x54b6e3,_0x2219b8){return function(_0x2875b4){_0x2219b8['emit'](_0x54b6e3,_0x2875b4);};}function removeListener(_0x474cb1,_0x5a4dc8){return function(){FaxQueueEvents['removeListener'](_0x474cb1,_0x5a4dc8);};}exports['register']=function(_0x5e9e03){for(var _0x23e7e7=0x0,_0x3be45d=events['length'];_0x23e7e7<_0x3be45d;_0x23e7e7++){var _0x1800ff=events[_0x23e7e7];var _0x94bebc=createListener(_0x1956('0x3')+_0x1800ff,_0x5e9e03);FaxQueueEvents['on'](_0x1800ff,_0x94bebc);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index afc7034..8deb452 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 _0xaa37=['delete','removeTeams','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueue.controller','get','index','isAuthenticated','describe','show','/:id/members','getMembers','/:id/users','getAgents','post','/:id/teams','addTeams','addAgents','put','/:id','destroy'];(function(_0x4c7c45,_0x2db247){var _0x10fae5=function(_0x5a73a1){while(--_0x5a73a1){_0x4c7c45['push'](_0x4c7c45['shift']());}};_0x10fae5(++_0x2db247);}(_0xaa37,0x1d3));var _0x7aa3=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0xaa37[_0x5d2803];return _0xdcad2c;};'use strict';var multer=require(_0x7aa3('0x0'));var util=require(_0x7aa3('0x1'));var path=require(_0x7aa3('0x2'));var timeout=require(_0x7aa3('0x3'));var express=require('express');var router=express[_0x7aa3('0x4')]();var fs_extra=require(_0x7aa3('0x5'));var auth=require(_0x7aa3('0x6'));var interaction=require(_0x7aa3('0x7'));var config=require(_0x7aa3('0x8'));var controller=require(_0x7aa3('0x9'));router[_0x7aa3('0xa')]('/',auth['isAuthenticated'](),controller[_0x7aa3('0xb')]);router[_0x7aa3('0xa')]('/describe',auth[_0x7aa3('0xc')](),controller[_0x7aa3('0xd')]);router[_0x7aa3('0xa')]('/:id',auth[_0x7aa3('0xc')](),controller[_0x7aa3('0xe')]);router[_0x7aa3('0xa')](_0x7aa3('0xf'),auth[_0x7aa3('0xc')](),controller[_0x7aa3('0x10')]);router['get']('/:id/teams',auth[_0x7aa3('0xc')](),controller['getTeams']);router[_0x7aa3('0xa')](_0x7aa3('0x11'),auth['isAuthenticated'](),controller[_0x7aa3('0x12')]);router[_0x7aa3('0x13')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0x7aa3('0x14'),auth[_0x7aa3('0xc')](),controller[_0x7aa3('0x15')]);router[_0x7aa3('0x13')](_0x7aa3('0x11'),auth['isAuthenticated'](),controller[_0x7aa3('0x16')]);router[_0x7aa3('0x17')](_0x7aa3('0x18'),auth[_0x7aa3('0xc')](),controller['update']);router['delete'](_0x7aa3('0x18'),auth['isAuthenticated'](),controller[_0x7aa3('0x19')]);router[_0x7aa3('0x1a')]('/:id/teams',auth[_0x7aa3('0xc')](),controller[_0x7aa3('0x1b')]);router[_0x7aa3('0x1a')](_0x7aa3('0x11'),auth[_0x7aa3('0xc')](),controller['removeAgents']);module[_0x7aa3('0x1c')]=router; \ No newline at end of file +var _0x1893=['describe','/:id','show','/:id/members','getMembers','getTeams','/:id/users','post','create','/:id/teams','addTeams','addAgents','put','update','delete','removeTeams','removeAgents','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./faxQueue.controller','get','isAuthenticated','index','/describe'];(function(_0x14f817,_0x5ace7b){var _0x5aab2e=function(_0x4acc1b){while(--_0x4acc1b){_0x14f817['push'](_0x14f817['shift']());}};_0x5aab2e(++_0x5ace7b);}(_0x1893,0xa2));var _0x3189=function(_0x37ae17,_0x12491a){_0x37ae17=_0x37ae17-0x0;var _0x24b60f=_0x1893[_0x37ae17];return _0x24b60f;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3189('0x0'));var timeout=require(_0x3189('0x1'));var express=require(_0x3189('0x2'));var router=express[_0x3189('0x3')]();var fs_extra=require(_0x3189('0x4'));var auth=require(_0x3189('0x5'));var interaction=require(_0x3189('0x6'));var config=require('../../config/environment');var controller=require(_0x3189('0x7'));router[_0x3189('0x8')]('/',auth[_0x3189('0x9')](),controller[_0x3189('0xa')]);router[_0x3189('0x8')](_0x3189('0xb'),auth[_0x3189('0x9')](),controller[_0x3189('0xc')]);router['get'](_0x3189('0xd'),auth['isAuthenticated'](),controller[_0x3189('0xe')]);router['get'](_0x3189('0xf'),auth[_0x3189('0x9')](),controller[_0x3189('0x10')]);router[_0x3189('0x8')]('/:id/teams',auth[_0x3189('0x9')](),controller[_0x3189('0x11')]);router[_0x3189('0x8')](_0x3189('0x12'),auth[_0x3189('0x9')](),controller['getAgents']);router[_0x3189('0x13')]('/',auth[_0x3189('0x9')](),controller[_0x3189('0x14')]);router[_0x3189('0x13')](_0x3189('0x15'),auth[_0x3189('0x9')](),controller[_0x3189('0x16')]);router[_0x3189('0x13')]('/:id/users',auth[_0x3189('0x9')](),controller[_0x3189('0x17')]);router[_0x3189('0x18')](_0x3189('0xd'),auth['isAuthenticated'](),controller[_0x3189('0x19')]);router['delete']('/:id',auth[_0x3189('0x9')](),controller['destroy']);router[_0x3189('0x1a')](_0x3189('0x15'),auth[_0x3189('0x9')](),controller[_0x3189('0x1b')]);router['delete'](_0x3189('0x12'),auth[_0x3189('0x9')](),controller[_0x3189('0x1c')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index f51ce24..8b8e814 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 _0xa15d=['DATE','sequelize','exports','STRING'];(function(_0x53ac5b,_0x9cef1e){var _0x5738ca=function(_0xdc4627){while(--_0xdc4627){_0x53ac5b['push'](_0x53ac5b['shift']());}};_0x5738ca(++_0x9cef1e);}(_0xa15d,0x131));var _0xda15=function(_0x313c96,_0x3cee6e){_0x313c96=_0x313c96-0x0;var _0x522f53=_0xa15d[_0x313c96];return _0x522f53;};'use strict';var moment=require('moment');var Sequelize=require(_0xda15('0x0'));module[_0xda15('0x1')]={'uniqueid':{'type':Sequelize[_0xda15('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xda15('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xda15('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xda15('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x5042=['DATE','moment','sequelize','exports','STRING'];(function(_0x3030ed,_0x4cf7d2){var _0x47ce8a=function(_0x53cbae){while(--_0x53cbae){_0x3030ed['push'](_0x3030ed['shift']());}};_0x47ce8a(++_0x4cf7d2);}(_0x5042,0x146));var _0x2504=function(_0x4f222a,_0x51c1f6){_0x4f222a=_0x4f222a-0x0;var _0x4df4de=_0x5042[_0x4f222a];return _0x4df4de;};'use strict';var moment=require(_0x2504('0x0'));var Sequelize=require(_0x2504('0x1'));module[_0x2504('0x2')]={'uniqueid':{'type':Sequelize[_0x2504('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x2504('0x3')]},'joinAt':{'type':Sequelize[_0x2504('0x4')]},'leaveAt':{'type':Sequelize[_0x2504('0x4')]},'acceptAt':{'type':Sequelize[_0x2504('0x4')]},'exitAt':{'type':Sequelize[_0x2504('0x4')]},'reason':{'type':Sequelize[_0x2504('0x3')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index 83c6c84..4e0cb51 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 _0x6658=['includeAll','find','catch','create','body','update','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','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','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','undefined','count','offset','limit','set','Content-Range','save','then','destroy','end','sendStatus','stack','name','send','index','FaxQueueReport','rawAttributes','fieldName','type','key','map','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','include','findAll','show'];(function(_0x274638,_0x578968){var _0x5755df=function(_0x3227d5){while(--_0x3227d5){_0x274638['push'](_0x274638['shift']());}};_0x5755df(++_0x578968);}(_0x6658,0x198));var _0x8665=function(_0x5d9926,_0x1566d2){_0x5d9926=_0x5d9926-0x0;var _0x39aacb=_0x6658[_0x5d9926];return _0x39aacb;};'use strict';var emlformat=require(_0x8665('0x0'));var rimraf=require(_0x8665('0x1'));var zipdir=require(_0x8665('0x2'));var jsonpatch=require(_0x8665('0x3'));var rp=require(_0x8665('0x4'));var moment=require(_0x8665('0x5'));var BPromise=require(_0x8665('0x6'));var Mustache=require(_0x8665('0x7'));var util=require('util');var path=require(_0x8665('0x8'));var sox=require(_0x8665('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8665('0xa'));var _=require(_0x8665('0xb'));var squel=require(_0x8665('0xc'));var crypto=require(_0x8665('0xd'));var jsforce=require(_0x8665('0xe'));var deskjs=require(_0x8665('0xf'));var toCsv=require(_0x8665('0x10'));var querystring=require(_0x8665('0x11'));var Papa=require('papaparse');var Redis=require(_0x8665('0x12'));var authService=require(_0x8665('0x13'));var qs=require(_0x8665('0x14'));var as=require(_0x8665('0x15'));var hardwareService=require(_0x8665('0x16'));var logger=require(_0x8665('0x17'))(_0x8665('0x18'));var utils=require(_0x8665('0x19'));var config=require(_0x8665('0x1a'));var licenseUtil=require(_0x8665('0x1b'));var db=require(_0x8665('0x1c'))['db'];function respondWithStatusCode(_0x30d476,_0x26ffc9){_0x26ffc9=_0x26ffc9||0xcc;return function(_0x689905){if(_0x689905){return _0x30d476['sendStatus'](_0x26ffc9);}return _0x30d476[_0x8665('0x1d')](_0x26ffc9)['end']();};}function respondWithResult(_0x3d8f0b,_0x16452c){_0x16452c=_0x16452c||0xc8;return function(_0xfef706){if(_0xfef706){return _0x3d8f0b[_0x8665('0x1d')](_0x16452c)[_0x8665('0x1e')](_0xfef706);}};}function respondWithFilteredResult(_0x2a0507,_0x5186e4){return function(_0x222e87){if(_0x222e87){var _0xa2545a=typeof _0x5186e4['offset']===_0x8665('0x1f')&&typeof _0x5186e4['limit']===_0x8665('0x1f');var _0x383b79=_0x222e87[_0x8665('0x20')];var _0x50ba7d=_0xa2545a?0x0:_0x5186e4[_0x8665('0x21')];var _0x235617=_0xa2545a?_0x222e87['count']:_0x5186e4[_0x8665('0x21')]+_0x5186e4[_0x8665('0x22')];var _0x16f1f1;if(_0x235617>=_0x383b79){_0x235617=_0x383b79;_0x16f1f1=0xc8;}else{_0x16f1f1=0xce;}_0x2a0507['status'](_0x16f1f1);return _0x2a0507[_0x8665('0x23')](_0x8665('0x24'),_0x50ba7d+'-'+_0x235617+'/'+_0x383b79)[_0x8665('0x1e')](_0x222e87);}return null;};}function patchUpdates(_0x549a0a){return function(_0x519d5c){try{jsonpatch['apply'](_0x519d5c,_0x549a0a,!![]);}catch(_0x29154d){return BPromise['reject'](_0x29154d);}return _0x519d5c[_0x8665('0x25')]();};}function saveUpdates(_0x53d764,_0x34b622){return function(_0x4dc4f7){if(_0x4dc4f7){return _0x4dc4f7['update'](_0x53d764)[_0x8665('0x26')](function(_0x406e8a){return _0x406e8a;});}return null;};}function removeEntity(_0x512d8e,_0x38e3f5){return function(_0x1d7f74){if(_0x1d7f74){return _0x1d7f74[_0x8665('0x27')]()[_0x8665('0x26')](function(){_0x512d8e['status'](0xcc)[_0x8665('0x28')]();});}};}function handleEntityNotFound(_0x41394e,_0x4583f2){return function(_0x3eee64){if(!_0x3eee64){_0x41394e[_0x8665('0x29')](0x194);}return _0x3eee64;};}function handleError(_0x3c9fe3,_0x2f143f){_0x2f143f=_0x2f143f||0x1f4;return function(_0x172f47){logger['error'](_0x172f47[_0x8665('0x2a')]);if(_0x172f47[_0x8665('0x2b')]){delete _0x172f47[_0x8665('0x2b')];}_0x3c9fe3['status'](_0x2f143f)[_0x8665('0x2c')](_0x172f47);};}exports[_0x8665('0x2d')]=function(_0x149c8f,_0x1f4ebd){var _0xe34d5f={},_0x3b0302={},_0x313fca={'count':0x0,'rows':[]};var _0x183b4c=_['map'](db[_0x8665('0x2e')][_0x8665('0x2f')],function(_0x4ff80a){return{'name':_0x4ff80a[_0x8665('0x30')],'type':_0x4ff80a[_0x8665('0x31')][_0x8665('0x32')]};});_0x3b0302['model']=_[_0x8665('0x33')](_0x183b4c,'name');_0x3b0302['query']=_[_0x8665('0x34')](_0x149c8f[_0x8665('0x35')]);_0x3b0302[_0x8665('0x36')]=_[_0x8665('0x37')](_0x3b0302[_0x8665('0x38')],_0x3b0302[_0x8665('0x35')]);_0xe34d5f[_0x8665('0x39')]=_[_0x8665('0x37')](_0x3b0302['model'],qs[_0x8665('0x3a')](_0x149c8f[_0x8665('0x35')][_0x8665('0x3a')]));_0xe34d5f[_0x8665('0x39')]=_0xe34d5f[_0x8665('0x39')][_0x8665('0x3b')]?_0xe34d5f[_0x8665('0x39')]:_0x3b0302[_0x8665('0x38')];if(!_0x149c8f[_0x8665('0x35')][_0x8665('0x3c')](_0x8665('0x3d'))){_0xe34d5f[_0x8665('0x22')]=qs[_0x8665('0x22')](_0x149c8f[_0x8665('0x35')][_0x8665('0x22')]);_0xe34d5f[_0x8665('0x21')]=qs[_0x8665('0x21')](_0x149c8f[_0x8665('0x35')][_0x8665('0x21')]);}_0xe34d5f[_0x8665('0x3e')]=qs['sort'](_0x149c8f[_0x8665('0x35')][_0x8665('0x3f')]);_0xe34d5f[_0x8665('0x40')]=qs['filters'](_[_0x8665('0x41')](_0x149c8f[_0x8665('0x35')],_0x3b0302['filters']),_0x183b4c);if(_0x149c8f[_0x8665('0x35')][_0x8665('0x42')]){_0xe34d5f[_0x8665('0x40')]=_['merge'](_0xe34d5f['where'],{'$or':_[_0x8665('0x33')](_0x183b4c,function(_0xdbe67d){if(_0xdbe67d['type']!=='VIRTUAL'){var _0x8716c0={};_0x8716c0[_0xdbe67d[_0x8665('0x2b')]]={'$like':'%'+_0x149c8f[_0x8665('0x35')][_0x8665('0x42')]+'%'};return _0x8716c0;}})});}_0xe34d5f=_[_0x8665('0x43')]({},_0xe34d5f,_0x149c8f[_0x8665('0x44')]);var _0x315d3b={'where':_0xe34d5f[_0x8665('0x40')]};return db[_0x8665('0x2e')][_0x8665('0x20')](_0x315d3b)['then'](function(_0x4e3beb){_0x313fca[_0x8665('0x20')]=_0x4e3beb;if(_0x149c8f[_0x8665('0x35')]['includeAll']){_0xe34d5f[_0x8665('0x45')]=[{'all':!![]}];}return db[_0x8665('0x2e')][_0x8665('0x46')](_0xe34d5f);})[_0x8665('0x26')](function(_0xfeffde){_0x313fca['rows']=_0xfeffde;return _0x313fca;})[_0x8665('0x26')](respondWithFilteredResult(_0x1f4ebd,_0xe34d5f))['catch'](handleError(_0x1f4ebd,null));};exports[_0x8665('0x47')]=function(_0x584884,_0x524659){var _0x11fcc8={'raw':!![],'where':{'id':_0x584884['params']['id']}},_0x64c10f={};_0x64c10f['model']=_[_0x8665('0x34')](db[_0x8665('0x2e')][_0x8665('0x2f')]);_0x64c10f['query']=_['keys'](_0x584884[_0x8665('0x35')]);_0x64c10f[_0x8665('0x36')]=_[_0x8665('0x37')](_0x64c10f[_0x8665('0x38')],_0x64c10f[_0x8665('0x35')]);_0x11fcc8['attributes']=_[_0x8665('0x37')](_0x64c10f[_0x8665('0x38')],qs['fields'](_0x584884['query'][_0x8665('0x3a')]));_0x11fcc8[_0x8665('0x39')]=_0x11fcc8['attributes'][_0x8665('0x3b')]?_0x11fcc8[_0x8665('0x39')]:_0x64c10f[_0x8665('0x38')];if(_0x584884[_0x8665('0x35')][_0x8665('0x48')]){_0x11fcc8[_0x8665('0x45')]=[{'all':!![]}];}_0x11fcc8=_[_0x8665('0x43')]({},_0x11fcc8,_0x584884[_0x8665('0x44')]);return db[_0x8665('0x2e')][_0x8665('0x49')](_0x11fcc8)[_0x8665('0x26')](handleEntityNotFound(_0x524659,null))[_0x8665('0x26')](respondWithResult(_0x524659,null))[_0x8665('0x4a')](handleError(_0x524659,null));};exports['create']=function(_0x501de6,_0x3fa95f){return db['FaxQueueReport'][_0x8665('0x4b')](_0x501de6[_0x8665('0x4c')],{})['then'](respondWithResult(_0x3fa95f,0xc9))[_0x8665('0x4a')](handleError(_0x3fa95f,null));};exports[_0x8665('0x4d')]=function(_0x6ec1ff,_0x26240a){if(_0x6ec1ff[_0x8665('0x4c')]['id']){delete _0x6ec1ff[_0x8665('0x4c')]['id'];}return db['FaxQueueReport'][_0x8665('0x49')]({'where':{'id':_0x6ec1ff[_0x8665('0x4e')]['id']}})['then'](handleEntityNotFound(_0x26240a,null))['then'](saveUpdates(_0x6ec1ff[_0x8665('0x4c')],null))[_0x8665('0x26')](respondWithResult(_0x26240a,null))[_0x8665('0x4a')](handleError(_0x26240a,null));};exports[_0x8665('0x27')]=function(_0x46e6bd,_0x4f848a){return db['FaxQueueReport'][_0x8665('0x49')]({'where':{'id':_0x46e6bd[_0x8665('0x4e')]['id']}})[_0x8665('0x26')](handleEntityNotFound(_0x4f848a,null))[_0x8665('0x26')](removeEntity(_0x4f848a,null))['catch'](handleError(_0x4f848a,null));};exports[_0x8665('0x4f')]=function(_0x10ac24,_0x4c4c36){return db[_0x8665('0x2e')][_0x8665('0x4f')]()[_0x8665('0x26')](respondWithResult(_0x4c4c36,null))[_0x8665('0x4a')](handleError(_0x4c4c36,null));}; \ No newline at end of file +var _0xfa2f=['merge','options','includeAll','include','findAll','rows','catch','show','find','create','body','params','describe','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','end','error','stack','name','send','map','FaxQueueReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','order','sort','filters','pick','filter','where'];(function(_0x3d08e4,_0x2a648e){var _0xd77fc8=function(_0x5da5cb){while(--_0x5da5cb){_0x3d08e4['push'](_0x3d08e4['shift']());}};_0xd77fc8(++_0x2a648e);}(_0xfa2f,0xe8));var _0xffa2=function(_0x238e8e,_0x4623cb){_0x238e8e=_0x238e8e-0x0;var _0x3d9eac=_0xfa2f[_0x238e8e];return _0x3d9eac;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xffa2('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xffa2('0x1'));var moment=require(_0xffa2('0x2'));var BPromise=require(_0xffa2('0x3'));var Mustache=require('mustache');var util=require(_0xffa2('0x4'));var path=require(_0xffa2('0x5'));var sox=require(_0xffa2('0x6'));var csv=require(_0xffa2('0x7'));var ejs=require(_0xffa2('0x8'));var fs=require('fs');var fs_extra=require(_0xffa2('0x9'));var _=require(_0xffa2('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xffa2('0xb'));var deskjs=require(_0xffa2('0xc'));var toCsv=require(_0xffa2('0x7'));var querystring=require(_0xffa2('0xd'));var Papa=require(_0xffa2('0xe'));var Redis=require(_0xffa2('0xf'));var authService=require(_0xffa2('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xffa2('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xffa2('0x12'));var utils=require(_0xffa2('0x13'));var config=require(_0xffa2('0x14'));var licenseUtil=require(_0xffa2('0x15'));var db=require(_0xffa2('0x16'))['db'];function respondWithStatusCode(_0x569ebb,_0x33acac){_0x33acac=_0x33acac||0xcc;return function(_0x3f9363){if(_0x3f9363){return _0x569ebb[_0xffa2('0x17')](_0x33acac);}return _0x569ebb[_0xffa2('0x18')](_0x33acac)['end']();};}function respondWithResult(_0x5f44cc,_0x32e54e){_0x32e54e=_0x32e54e||0xc8;return function(_0x19a880){if(_0x19a880){return _0x5f44cc[_0xffa2('0x18')](_0x32e54e)['json'](_0x19a880);}};}function respondWithFilteredResult(_0x2d6803,_0x31a57f){return function(_0x2c4035){if(_0x2c4035){var _0x4019b3=typeof _0x31a57f[_0xffa2('0x19')]===_0xffa2('0x1a')&&typeof _0x31a57f[_0xffa2('0x1b')]==='undefined';var _0x2c83d7=_0x2c4035[_0xffa2('0x1c')];var _0x923abf=_0x4019b3?0x0:_0x31a57f[_0xffa2('0x19')];var _0x2b71e7=_0x4019b3?_0x2c4035[_0xffa2('0x1c')]:_0x31a57f[_0xffa2('0x19')]+_0x31a57f[_0xffa2('0x1b')];var _0x2e93c0;if(_0x2b71e7>=_0x2c83d7){_0x2b71e7=_0x2c83d7;_0x2e93c0=0xc8;}else{_0x2e93c0=0xce;}_0x2d6803[_0xffa2('0x18')](_0x2e93c0);return _0x2d6803[_0xffa2('0x1d')](_0xffa2('0x1e'),_0x923abf+'-'+_0x2b71e7+'/'+_0x2c83d7)['json'](_0x2c4035);}return null;};}function patchUpdates(_0x6c9785){return function(_0x54c2f){try{jsonpatch[_0xffa2('0x1f')](_0x54c2f,_0x6c9785,!![]);}catch(_0x57ac03){return BPromise[_0xffa2('0x20')](_0x57ac03);}return _0x54c2f['save']();};}function saveUpdates(_0x204a0f,_0x3f602c){return function(_0x15edba){if(_0x15edba){return _0x15edba[_0xffa2('0x21')](_0x204a0f)[_0xffa2('0x22')](function(_0x3e6b5e){return _0x3e6b5e;});}return null;};}function removeEntity(_0x341522,_0x251a0d){return function(_0xcfec26){if(_0xcfec26){return _0xcfec26[_0xffa2('0x23')]()['then'](function(){_0x341522[_0xffa2('0x18')](0xcc)[_0xffa2('0x24')]();});}};}function handleEntityNotFound(_0x4d97a3,_0x29605e){return function(_0x125975){if(!_0x125975){_0x4d97a3[_0xffa2('0x17')](0x194);}return _0x125975;};}function handleError(_0x126940,_0x2a5e5e){_0x2a5e5e=_0x2a5e5e||0x1f4;return function(_0x3fb328){logger[_0xffa2('0x25')](_0x3fb328[_0xffa2('0x26')]);if(_0x3fb328['name']){delete _0x3fb328[_0xffa2('0x27')];}_0x126940[_0xffa2('0x18')](_0x2a5e5e)[_0xffa2('0x28')](_0x3fb328);};}exports['index']=function(_0x45fa74,_0x3ee359){var _0x1449a3={},_0x48e67b={},_0x335dcf={'count':0x0,'rows':[]};var _0x406d9b=_[_0xffa2('0x29')](db[_0xffa2('0x2a')][_0xffa2('0x2b')],function(_0x2824cc){return{'name':_0x2824cc[_0xffa2('0x2c')],'type':_0x2824cc[_0xffa2('0x2d')][_0xffa2('0x2e')]};});_0x48e67b[_0xffa2('0x2f')]=_[_0xffa2('0x29')](_0x406d9b,_0xffa2('0x27'));_0x48e67b[_0xffa2('0x30')]=_[_0xffa2('0x31')](_0x45fa74[_0xffa2('0x30')]);_0x48e67b['filters']=_[_0xffa2('0x32')](_0x48e67b[_0xffa2('0x2f')],_0x48e67b['query']);_0x1449a3[_0xffa2('0x33')]=_['intersection'](_0x48e67b[_0xffa2('0x2f')],qs['fields'](_0x45fa74['query'][_0xffa2('0x34')]));_0x1449a3['attributes']=_0x1449a3[_0xffa2('0x33')]['length']?_0x1449a3[_0xffa2('0x33')]:_0x48e67b[_0xffa2('0x2f')];if(!_0x45fa74[_0xffa2('0x30')][_0xffa2('0x35')]('nolimit')){_0x1449a3[_0xffa2('0x1b')]=qs['limit'](_0x45fa74[_0xffa2('0x30')][_0xffa2('0x1b')]);_0x1449a3[_0xffa2('0x19')]=qs['offset'](_0x45fa74['query'][_0xffa2('0x19')]);}_0x1449a3[_0xffa2('0x36')]=qs[_0xffa2('0x37')](_0x45fa74['query'][_0xffa2('0x37')]);_0x1449a3['where']=qs[_0xffa2('0x38')](_[_0xffa2('0x39')](_0x45fa74[_0xffa2('0x30')],_0x48e67b[_0xffa2('0x38')]),_0x406d9b);if(_0x45fa74[_0xffa2('0x30')][_0xffa2('0x3a')]){_0x1449a3[_0xffa2('0x3b')]=_[_0xffa2('0x3c')](_0x1449a3[_0xffa2('0x3b')],{'$or':_[_0xffa2('0x29')](_0x406d9b,function(_0x3c2786){if(_0x3c2786[_0xffa2('0x2d')]!=='VIRTUAL'){var _0x1780ea={};_0x1780ea[_0x3c2786['name']]={'$like':'%'+_0x45fa74[_0xffa2('0x30')][_0xffa2('0x3a')]+'%'};return _0x1780ea;}})});}_0x1449a3=_[_0xffa2('0x3c')]({},_0x1449a3,_0x45fa74[_0xffa2('0x3d')]);var _0x30265b={'where':_0x1449a3['where']};return db[_0xffa2('0x2a')]['count'](_0x30265b)[_0xffa2('0x22')](function(_0x52f5a7){_0x335dcf['count']=_0x52f5a7;if(_0x45fa74[_0xffa2('0x30')][_0xffa2('0x3e')]){_0x1449a3[_0xffa2('0x3f')]=[{'all':!![]}];}return db[_0xffa2('0x2a')][_0xffa2('0x40')](_0x1449a3);})['then'](function(_0x4efcdb){_0x335dcf[_0xffa2('0x41')]=_0x4efcdb;return _0x335dcf;})[_0xffa2('0x22')](respondWithFilteredResult(_0x3ee359,_0x1449a3))[_0xffa2('0x42')](handleError(_0x3ee359,null));};exports[_0xffa2('0x43')]=function(_0x4c8af3,_0x385b24){var _0xcf3ad2={'raw':!![],'where':{'id':_0x4c8af3['params']['id']}},_0x386b81={};_0x386b81[_0xffa2('0x2f')]=_[_0xffa2('0x31')](db['FaxQueueReport'][_0xffa2('0x2b')]);_0x386b81['query']=_[_0xffa2('0x31')](_0x4c8af3['query']);_0x386b81['filters']=_[_0xffa2('0x32')](_0x386b81[_0xffa2('0x2f')],_0x386b81[_0xffa2('0x30')]);_0xcf3ad2[_0xffa2('0x33')]=_['intersection'](_0x386b81[_0xffa2('0x2f')],qs['fields'](_0x4c8af3[_0xffa2('0x30')][_0xffa2('0x34')]));_0xcf3ad2[_0xffa2('0x33')]=_0xcf3ad2[_0xffa2('0x33')]['length']?_0xcf3ad2[_0xffa2('0x33')]:_0x386b81['model'];if(_0x4c8af3[_0xffa2('0x30')]['includeAll']){_0xcf3ad2[_0xffa2('0x3f')]=[{'all':!![]}];}_0xcf3ad2=_[_0xffa2('0x3c')]({},_0xcf3ad2,_0x4c8af3[_0xffa2('0x3d')]);return db[_0xffa2('0x2a')][_0xffa2('0x44')](_0xcf3ad2)[_0xffa2('0x22')](handleEntityNotFound(_0x385b24,null))[_0xffa2('0x22')](respondWithResult(_0x385b24,null))[_0xffa2('0x42')](handleError(_0x385b24,null));};exports[_0xffa2('0x45')]=function(_0x39ae33,_0x7f3d9){return db['FaxQueueReport'][_0xffa2('0x45')](_0x39ae33[_0xffa2('0x46')],{})[_0xffa2('0x22')](respondWithResult(_0x7f3d9,0xc9))[_0xffa2('0x42')](handleError(_0x7f3d9,null));};exports[_0xffa2('0x21')]=function(_0x11f72e,_0x198fd5){if(_0x11f72e[_0xffa2('0x46')]['id']){delete _0x11f72e[_0xffa2('0x46')]['id'];}return db[_0xffa2('0x2a')][_0xffa2('0x44')]({'where':{'id':_0x11f72e['params']['id']}})['then'](handleEntityNotFound(_0x198fd5,null))[_0xffa2('0x22')](saveUpdates(_0x11f72e['body'],null))['then'](respondWithResult(_0x198fd5,null))[_0xffa2('0x42')](handleError(_0x198fd5,null));};exports['destroy']=function(_0x1b474c,_0x15e9b0){return db[_0xffa2('0x2a')]['find']({'where':{'id':_0x1b474c[_0xffa2('0x47')]['id']}})[_0xffa2('0x22')](handleEntityNotFound(_0x15e9b0,null))[_0xffa2('0x22')](removeEntity(_0x15e9b0,null))[_0xffa2('0x42')](handleError(_0x15e9b0,null));};exports[_0xffa2('0x48')]=function(_0x500a7d,_0x3ac858){return db['FaxQueueReport']['describe']()[_0xffa2('0x22')](respondWithResult(_0x3ac858,null))[_0xffa2('0x42')](handleError(_0x3ac858,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index 5f1e0de..399fbb0 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(_0x5c34bd,_0x475c42){var _0x5b1d2b=function(_0x57aa3a){while(--_0x57aa3a){_0x5c34bd['push'](_0x5c34bd['shift']());}};_0x5b1d2b(++_0x475c42);}(_0xabce,0x103));var _0xeabc=function(_0x33032e,_0x31411a){_0x33032e=_0x33032e-0x0;var _0x13316b=_0xabce[_0x33032e];return _0x13316b;};'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 _0x7217=['api','moment','bluebird','request-promise','../../config/environment','./faxQueueReport.attributes','exports','define','FaxQueueReport','report_fax_queue','uniqueid','lodash','../../config/logger'];(function(_0x5746a1,_0x11eab1){var _0x551a43=function(_0x7ddcbe){while(--_0x7ddcbe){_0x5746a1['push'](_0x5746a1['shift']());}};_0x551a43(++_0x11eab1);}(_0x7217,0x19e));var _0x7721=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0x7217[_0x4dbaad];return _0x226c72;};'use strict';var _=require(_0x7721('0x0'));var util=require('util');var logger=require(_0x7721('0x1'))(_0x7721('0x2'));var moment=require(_0x7721('0x3'));var BPromise=require(_0x7721('0x4'));var rp=require(_0x7721('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7721('0x6'));var attributes=require(_0x7721('0x7'));module[_0x7721('0x8')]=function(_0x3fe47c,_0xb239e0){return _0x3fe47c[_0x7721('0x9')](_0x7721('0xa'),attributes,{'tableName':_0x7721('0xb'),'paranoid':![],'indexes':[{'name':_0x7721('0xc'),'fields':[_0x7721('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 7e6e3ed..4b0618a 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 _0x7f79=['../../config/utils','rpc','jayson/promise','client','request','then','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','body','options','raw','CreateFaxQueueReport','catch','UpdateFaxQueueReport','FaxQueueReport','update','where','attributes','limit','lodash','util','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x556a83,_0x56897c){var _0x1f89bf=function(_0x5d7028){while(--_0x5d7028){_0x556a83['push'](_0x556a83['shift']());}};_0x1f89bf(++_0x56897c);}(_0x7f79,0x9f));var _0x97f7=function(_0x452aec,_0x31b562){_0x452aec=_0x452aec-0x0;var _0x210b38=_0x7f79[_0x452aec];return _0x210b38;};'use strict';var _=require(_0x97f7('0x0'));var util=require(_0x97f7('0x1'));var moment=require('moment');var BPromise=require(_0x97f7('0x2'));var rs=require(_0x97f7('0x3'));var fs=require('fs');var Redis=require(_0x97f7('0x4'));var db=require(_0x97f7('0x5'))['db'];var utils=require(_0x97f7('0x6'));var logger=require('../../config/logger')(_0x97f7('0x7'));var config=require('../../config/environment');var jayson=require(_0x97f7('0x8'));var client=jayson[_0x97f7('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5cc1b5,_0x41893c,_0x3f94f1){return new BPromise(function(_0x501055,_0x274d9f){return client[_0x97f7('0xa')](_0x5cc1b5,_0x3f94f1)[_0x97f7('0xb')](function(_0x56db61){logger[_0x97f7('0xc')](_0x97f7('0xd'),_0x41893c,_0x97f7('0xe'));logger[_0x97f7('0xf')](_0x97f7('0x10'),_0x41893c,_0x97f7('0xe'),JSON[_0x97f7('0x11')](_0x56db61));if(_0x56db61[_0x97f7('0x12')]){if(_0x56db61['error'][_0x97f7('0x13')]===0x1f4){logger[_0x97f7('0x12')](_0x97f7('0xd'),_0x41893c,_0x56db61['error'][_0x97f7('0x14')]);return _0x274d9f(_0x56db61[_0x97f7('0x12')][_0x97f7('0x14')]);}logger[_0x97f7('0x12')]('FaxQueueReport,\x20%s,\x20%s',_0x41893c,_0x56db61[_0x97f7('0x12')]['message']);return _0x501055(_0x56db61[_0x97f7('0x12')][_0x97f7('0x14')]);}else{logger['info'](_0x97f7('0xd'),_0x41893c,'request\x20sent');_0x501055(_0x56db61[_0x97f7('0x15')][_0x97f7('0x14')]);}})['catch'](function(_0x4cd3c0){logger['error']('FaxQueueReport,\x20%s,\x20%s',_0x41893c,_0x4cd3c0);_0x274d9f(_0x4cd3c0);});});}exports['CreateFaxQueueReport']=function(_0x4f537f){var _0x580325=this;return new Promise(function(_0x1bbee0,_0x22e057){return db['FaxQueueReport']['create'](_0x4f537f[_0x97f7('0x16')],{'raw':_0x4f537f[_0x97f7('0x17')]?_0x4f537f[_0x97f7('0x17')][_0x97f7('0x18')]===undefined?!![]:![]:!![]})[_0x97f7('0xb')](function(_0x56cb8b){logger[_0x97f7('0xc')](_0x97f7('0x19'),_0x4f537f);logger[_0x97f7('0xf')]('CreateFaxQueueReport',_0x4f537f,JSON[_0x97f7('0x11')](_0x56cb8b));_0x1bbee0(_0x56cb8b);})[_0x97f7('0x1a')](function(_0x55f7ef){logger[_0x97f7('0x12')](_0x97f7('0x19'),_0x55f7ef[_0x97f7('0x14')],_0x4f537f);_0x22e057(_0x580325[_0x97f7('0x12')](0x1f4,_0x55f7ef[_0x97f7('0x14')]));});});};exports[_0x97f7('0x1b')]=function(_0x204539){var _0x17920c=this;return new Promise(function(_0x2e22d3,_0x59e476){return db[_0x97f7('0x1c')][_0x97f7('0x1d')](_0x204539[_0x97f7('0x16')],{'raw':_0x204539['options']?_0x204539[_0x97f7('0x17')][_0x97f7('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x204539[_0x97f7('0x17')]?_0x204539['options'][_0x97f7('0x1e')]||null:null,'attributes':_0x204539[_0x97f7('0x17')]?_0x204539[_0x97f7('0x17')][_0x97f7('0x1f')]||null:null,'limit':_0x204539[_0x97f7('0x17')]?_0x204539[_0x97f7('0x17')][_0x97f7('0x20')]||null:null})[_0x97f7('0xb')](function(_0x403917){logger[_0x97f7('0xc')](_0x97f7('0x1b'),_0x204539);logger[_0x97f7('0xf')](_0x97f7('0x1b'),_0x204539,JSON[_0x97f7('0x11')](_0x403917));_0x2e22d3(_0x403917);})[_0x97f7('0x1a')](function(_0x2b9e07){logger[_0x97f7('0x12')](_0x97f7('0x1b'),_0x2b9e07[_0x97f7('0x14')],_0x204539);_0x59e476(_0x17920c[_0x97f7('0x12')](0x1f4,_0x2b9e07[_0x97f7('0x14')]));});});}; \ No newline at end of file +var _0xfc84=['where','attributes','limit','UpdateFaxQueueReport','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','http','then','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','CreateFaxQueueReport','FaxQueueReport','create','body','options','raw'];(function(_0x3434a2,_0xe3c256){var _0x58b35d=function(_0x39893d){while(--_0x39893d){_0x3434a2['push'](_0x3434a2['shift']());}};_0x58b35d(++_0xe3c256);}(_0xfc84,0x126));var _0x4fc8=function(_0x56c4e2,_0xebb178){_0x56c4e2=_0x56c4e2-0x0;var _0x109bfe=_0xfc84[_0x56c4e2];return _0x109bfe;};'use strict';var _=require(_0x4fc8('0x0'));var util=require(_0x4fc8('0x1'));var moment=require(_0x4fc8('0x2'));var BPromise=require('bluebird');var rs=require(_0x4fc8('0x3'));var fs=require('fs');var Redis=require(_0x4fc8('0x4'));var db=require(_0x4fc8('0x5'))['db'];var utils=require(_0x4fc8('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x4fc8('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x4fc8('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x6fee7a,_0x40d4fd,_0xc155e0){return new BPromise(function(_0x5b63f2,_0x2a2e54){return client['request'](_0x6fee7a,_0xc155e0)[_0x4fc8('0x9')](function(_0x3c94ac){logger[_0x4fc8('0xa')](_0x4fc8('0xb'),_0x40d4fd,_0x4fc8('0xc'));logger[_0x4fc8('0xd')]('FaxQueueReport,\x20%s,\x20%s,\x20%s',_0x40d4fd,'request\x20sent',JSON[_0x4fc8('0xe')](_0x3c94ac));if(_0x3c94ac[_0x4fc8('0xf')]){if(_0x3c94ac[_0x4fc8('0xf')]['code']===0x1f4){logger[_0x4fc8('0xf')](_0x4fc8('0xb'),_0x40d4fd,_0x3c94ac[_0x4fc8('0xf')][_0x4fc8('0x10')]);return _0x2a2e54(_0x3c94ac[_0x4fc8('0xf')][_0x4fc8('0x10')]);}logger['error']('FaxQueueReport,\x20%s,\x20%s',_0x40d4fd,_0x3c94ac['error'][_0x4fc8('0x10')]);return _0x5b63f2(_0x3c94ac['error'][_0x4fc8('0x10')]);}else{logger[_0x4fc8('0xa')](_0x4fc8('0xb'),_0x40d4fd,_0x4fc8('0xc'));_0x5b63f2(_0x3c94ac[_0x4fc8('0x11')][_0x4fc8('0x10')]);}})[_0x4fc8('0x12')](function(_0x849d85){logger[_0x4fc8('0xf')](_0x4fc8('0xb'),_0x40d4fd,_0x849d85);_0x2a2e54(_0x849d85);});});}exports[_0x4fc8('0x13')]=function(_0x3272a8){var _0x5778f3=this;return new Promise(function(_0x3cc2db,_0x3e76f7){return db[_0x4fc8('0x14')][_0x4fc8('0x15')](_0x3272a8[_0x4fc8('0x16')],{'raw':_0x3272a8[_0x4fc8('0x17')]?_0x3272a8[_0x4fc8('0x17')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x303be3){logger[_0x4fc8('0xa')](_0x4fc8('0x13'),_0x3272a8);logger[_0x4fc8('0xd')](_0x4fc8('0x13'),_0x3272a8,JSON[_0x4fc8('0xe')](_0x303be3));_0x3cc2db(_0x303be3);})[_0x4fc8('0x12')](function(_0x594614){logger[_0x4fc8('0xf')]('CreateFaxQueueReport',_0x594614[_0x4fc8('0x10')],_0x3272a8);_0x3e76f7(_0x5778f3[_0x4fc8('0xf')](0x1f4,_0x594614[_0x4fc8('0x10')]));});});};exports['UpdateFaxQueueReport']=function(_0x430184){var _0x4eb017=this;return new Promise(function(_0x26e432,_0x648ba8){return db[_0x4fc8('0x14')]['update'](_0x430184[_0x4fc8('0x16')],{'raw':_0x430184['options']?_0x430184['options'][_0x4fc8('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x430184[_0x4fc8('0x17')]?_0x430184['options'][_0x4fc8('0x19')]||null:null,'attributes':_0x430184['options']?_0x430184[_0x4fc8('0x17')][_0x4fc8('0x1a')]||null:null,'limit':_0x430184[_0x4fc8('0x17')]?_0x430184[_0x4fc8('0x17')][_0x4fc8('0x1b')]||null:null})[_0x4fc8('0x9')](function(_0x5df1d2){logger['info']('UpdateFaxQueueReport',_0x430184);logger['debug']('UpdateFaxQueueReport',_0x430184,JSON['stringify'](_0x5df1d2));_0x26e432(_0x5df1d2);})[_0x4fc8('0x12')](function(_0x41a381){logger[_0x4fc8('0xf')](_0x4fc8('0x1c'),_0x41a381[_0x4fc8('0x10')],_0x430184);_0x648ba8(_0x4eb017['error'](0x1f4,_0x41a381[_0x4fc8('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index bc7ace0..236e5fe 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 _0x854c=['exports','util','path','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','isAuthenticated','index','get','/describe','/:id','show','create','update','delete'];(function(_0x215dc8,_0x52c245){var _0x583ea3=function(_0x32350d){while(--_0x32350d){_0x215dc8['push'](_0x215dc8['shift']());}};_0x583ea3(++_0x52c245);}(_0x854c,0xc1));var _0xc854=function(_0x32d457,_0x3236e9){_0x32d457=_0x32d457-0x0;var _0x537856=_0x854c[_0x32d457];return _0x537856;};'use strict';var multer=require('multer');var util=require(_0xc854('0x0'));var path=require(_0xc854('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xc854('0x2'));var interaction=require(_0xc854('0x3'));var config=require(_0xc854('0x4'));var controller=require(_0xc854('0x5'));router['get']('/',auth[_0xc854('0x6')](),controller[_0xc854('0x7')]);router[_0xc854('0x8')](_0xc854('0x9'),auth['isAuthenticated'](),controller['describe']);router[_0xc854('0x8')](_0xc854('0xa'),auth[_0xc854('0x6')](),controller[_0xc854('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0xc854('0xc')]);router['put'](_0xc854('0xa'),auth['isAuthenticated'](),controller[_0xc854('0xd')]);router[_0xc854('0xe')]('/:id',auth[_0xc854('0x6')](),controller['destroy']);module[_0xc854('0xf')]=router; \ No newline at end of file +var _0x9c7c=['util','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','get','isAuthenticated','index','/describe','/:id','show','create','put','delete','destroy','exports'];(function(_0x49f67f,_0x4113a4){var _0x4779a1=function(_0x5064b0){while(--_0x5064b0){_0x49f67f['push'](_0x49f67f['shift']());}};_0x4779a1(++_0x4113a4);}(_0x9c7c,0xfc));var _0xc9c7=function(_0x3c2d5c,_0x2b1926){_0x3c2d5c=_0x3c2d5c-0x0;var _0x5d3546=_0x9c7c[_0x3c2d5c];return _0x5d3546;};'use strict';var multer=require('multer');var util=require(_0xc9c7('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xc9c7('0x1'));var router=express['Router']();var fs_extra=require(_0xc9c7('0x2'));var auth=require(_0xc9c7('0x3'));var interaction=require(_0xc9c7('0x4'));var config=require(_0xc9c7('0x5'));var controller=require(_0xc9c7('0x6'));router[_0xc9c7('0x7')]('/',auth[_0xc9c7('0x8')](),controller[_0xc9c7('0x9')]);router['get'](_0xc9c7('0xa'),auth[_0xc9c7('0x8')](),controller['describe']);router[_0xc9c7('0x7')](_0xc9c7('0xb'),auth['isAuthenticated'](),controller[_0xc9c7('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0xc9c7('0xd')]);router[_0xc9c7('0xe')](_0xc9c7('0xb'),auth[_0xc9c7('0x8')](),controller['update']);router[_0xc9c7('0xf')](_0xc9c7('0xb'),auth['isAuthenticated'](),controller[_0xc9c7('0x10')]);module[_0xc9c7('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 f6baf3c..c83a56f 100644 --- a/server/api/faxTransferReport/faxTransferReport.attributes.js +++ b/server/api/faxTransferReport/faxTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['account','queue','DATE','NOW','moment','sequelize','exports'];(function(_0x5e3139,_0x5bad26){var _0x3cdf31=function(_0x51647e){while(--_0x51647e){_0x5e3139['push'](_0x5e3139['shift']());}};_0x3cdf31(++_0x5bad26);}(_0xa9e0,0x123));var _0x0a9e=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0xa9e0[_0xea8947];return _0x2455e9;};'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 _0x54ef=['agent','queue','DATE','NOW','moment','sequelize','exports','ENUM','account'];(function(_0x37ded3,_0x371ebb){var _0x51e49e=function(_0x30cc78){while(--_0x30cc78){_0x37ded3['push'](_0x37ded3['shift']());}};_0x51e49e(++_0x371ebb);}(_0x54ef,0x112));var _0xf54e=function(_0x575952,_0x27611d){_0x575952=_0x575952-0x0;var _0xb5cb2e=_0x54ef[_0x575952];return _0xb5cb2e;};'use strict';var moment=require(_0xf54e('0x0'));var Sequelize=require(_0xf54e('0x1'));module[_0xf54e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xf54e('0x3')](_0xf54e('0x4'),_0xf54e('0x5'),_0xf54e('0x6')),'allowNull':![],'defaultValue':_0xf54e('0x6')},'transferredAt':{'type':Sequelize[_0xf54e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xf54e('0x8')]}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index b27ea8e..6e0029c 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 _0xbd35=['attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','rawAttributes','keys','length','include','find','create','update','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','ejs','lodash','squel','crypto','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','reject','save','then','destroy','name','send','index','map','FaxTransferReport','fieldName','type','key','model','query','filters','intersection'];(function(_0xc91036,_0xa49dc3){var _0x4dd8ff=function(_0x10f215){while(--_0x10f215){_0xc91036['push'](_0xc91036['shift']());}};_0x4dd8ff(++_0xa49dc3);}(_0xbd35,0x141));var _0x5bd3=function(_0x129fe0,_0x589dae){_0x129fe0=_0x129fe0-0x0;var _0x46e3a5=_0xbd35[_0x129fe0];return _0x46e3a5;};'use strict';var emlformat=require(_0x5bd3('0x0'));var rimraf=require(_0x5bd3('0x1'));var zipdir=require(_0x5bd3('0x2'));var jsonpatch=require(_0x5bd3('0x3'));var rp=require(_0x5bd3('0x4'));var moment=require(_0x5bd3('0x5'));var BPromise=require(_0x5bd3('0x6'));var Mustache=require(_0x5bd3('0x7'));var util=require(_0x5bd3('0x8'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x5bd3('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5bd3('0xa'));var squel=require(_0x5bd3('0xb'));var crypto=require(_0x5bd3('0xc'));var jsforce=require(_0x5bd3('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x5bd3('0xe'));var querystring=require('querystring');var Papa=require(_0x5bd3('0xf'));var Redis=require(_0x5bd3('0x10'));var authService=require(_0x5bd3('0x11'));var qs=require(_0x5bd3('0x12'));var as=require(_0x5bd3('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x5bd3('0x14'));var utils=require('../../config/utils');var config=require(_0x5bd3('0x15'));var licenseUtil=require(_0x5bd3('0x16'));var db=require(_0x5bd3('0x17'))['db'];function respondWithStatusCode(_0x4f7b2c,_0x323f36){_0x323f36=_0x323f36||0xcc;return function(_0x5a0cb2){if(_0x5a0cb2){return _0x4f7b2c[_0x5bd3('0x18')](_0x323f36);}return _0x4f7b2c['status'](_0x323f36)['end']();};}function respondWithResult(_0x5be179,_0x5ad4bf){_0x5ad4bf=_0x5ad4bf||0xc8;return function(_0x246ff8){if(_0x246ff8){return _0x5be179[_0x5bd3('0x19')](_0x5ad4bf)[_0x5bd3('0x1a')](_0x246ff8);}};}function respondWithFilteredResult(_0x6d5306,_0x5103bb){return function(_0x515c89){if(_0x515c89){var _0x3375b2=typeof _0x5103bb[_0x5bd3('0x1b')]===_0x5bd3('0x1c')&&typeof _0x5103bb['limit']===_0x5bd3('0x1c');var _0x24043b=_0x515c89[_0x5bd3('0x1d')];var _0x146279=_0x3375b2?0x0:_0x5103bb[_0x5bd3('0x1b')];var _0x37b2f2=_0x3375b2?_0x515c89['count']:_0x5103bb[_0x5bd3('0x1b')]+_0x5103bb[_0x5bd3('0x1e')];var _0x1afc73;if(_0x37b2f2>=_0x24043b){_0x37b2f2=_0x24043b;_0x1afc73=0xc8;}else{_0x1afc73=0xce;}_0x6d5306['status'](_0x1afc73);return _0x6d5306[_0x5bd3('0x1f')](_0x5bd3('0x20'),_0x146279+'-'+_0x37b2f2+'/'+_0x24043b)[_0x5bd3('0x1a')](_0x515c89);}return null;};}function patchUpdates(_0x2c8c8a){return function(_0x52e185){try{jsonpatch['apply'](_0x52e185,_0x2c8c8a,!![]);}catch(_0x52f8d4){return BPromise[_0x5bd3('0x21')](_0x52f8d4);}return _0x52e185[_0x5bd3('0x22')]();};}function saveUpdates(_0x58c6db,_0x164815){return function(_0x439490){if(_0x439490){return _0x439490['update'](_0x58c6db)[_0x5bd3('0x23')](function(_0x5e7ffe){return _0x5e7ffe;});}return null;};}function removeEntity(_0x1318b6,_0x432f59){return function(_0x5be36f){if(_0x5be36f){return _0x5be36f[_0x5bd3('0x24')]()[_0x5bd3('0x23')](function(){_0x1318b6['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x47fd9f,_0x4fcc2d){return function(_0x1b4b2e){if(!_0x1b4b2e){_0x47fd9f[_0x5bd3('0x18')](0x194);}return _0x1b4b2e;};}function handleError(_0x898eb7,_0x3917a1){_0x3917a1=_0x3917a1||0x1f4;return function(_0x3ab715){logger['error'](_0x3ab715['stack']);if(_0x3ab715[_0x5bd3('0x25')]){delete _0x3ab715[_0x5bd3('0x25')];}_0x898eb7[_0x5bd3('0x19')](_0x3917a1)[_0x5bd3('0x26')](_0x3ab715);};}exports[_0x5bd3('0x27')]=function(_0x2a14af,_0x57b4b0){var _0x1c565d={},_0x25b83b={},_0x4b18f9={'count':0x0,'rows':[]};var _0x2e0468=_[_0x5bd3('0x28')](db[_0x5bd3('0x29')]['rawAttributes'],function(_0x3fcd01){return{'name':_0x3fcd01[_0x5bd3('0x2a')],'type':_0x3fcd01[_0x5bd3('0x2b')][_0x5bd3('0x2c')]};});_0x25b83b[_0x5bd3('0x2d')]=_[_0x5bd3('0x28')](_0x2e0468,_0x5bd3('0x25'));_0x25b83b[_0x5bd3('0x2e')]=_['keys'](_0x2a14af['query']);_0x25b83b[_0x5bd3('0x2f')]=_[_0x5bd3('0x30')](_0x25b83b[_0x5bd3('0x2d')],_0x25b83b['query']);_0x1c565d[_0x5bd3('0x31')]=_[_0x5bd3('0x30')](_0x25b83b[_0x5bd3('0x2d')],qs[_0x5bd3('0x32')](_0x2a14af[_0x5bd3('0x2e')][_0x5bd3('0x32')]));_0x1c565d[_0x5bd3('0x31')]=_0x1c565d[_0x5bd3('0x31')]['length']?_0x1c565d[_0x5bd3('0x31')]:_0x25b83b[_0x5bd3('0x2d')];if(!_0x2a14af['query'][_0x5bd3('0x33')](_0x5bd3('0x34'))){_0x1c565d[_0x5bd3('0x1e')]=qs[_0x5bd3('0x1e')](_0x2a14af['query'][_0x5bd3('0x1e')]);_0x1c565d[_0x5bd3('0x1b')]=qs[_0x5bd3('0x1b')](_0x2a14af[_0x5bd3('0x2e')]['offset']);}_0x1c565d[_0x5bd3('0x35')]=qs['sort'](_0x2a14af['query'][_0x5bd3('0x36')]);_0x1c565d[_0x5bd3('0x37')]=qs[_0x5bd3('0x2f')](_['pick'](_0x2a14af[_0x5bd3('0x2e')],_0x25b83b['filters']),_0x2e0468);if(_0x2a14af[_0x5bd3('0x2e')][_0x5bd3('0x38')]){_0x1c565d[_0x5bd3('0x37')]=_[_0x5bd3('0x39')](_0x1c565d[_0x5bd3('0x37')],{'$or':_[_0x5bd3('0x28')](_0x2e0468,function(_0x5965c5){if(_0x5965c5[_0x5bd3('0x2b')]!==_0x5bd3('0x3a')){var _0x2a66e5={};_0x2a66e5[_0x5965c5['name']]={'$like':'%'+_0x2a14af[_0x5bd3('0x2e')][_0x5bd3('0x38')]+'%'};return _0x2a66e5;}})});}_0x1c565d=_[_0x5bd3('0x39')]({},_0x1c565d,_0x2a14af[_0x5bd3('0x3b')]);var _0x452a48={'where':_0x1c565d[_0x5bd3('0x37')]};return db['FaxTransferReport']['count'](_0x452a48)[_0x5bd3('0x23')](function(_0xd6dcaa){_0x4b18f9[_0x5bd3('0x1d')]=_0xd6dcaa;if(_0x2a14af['query'][_0x5bd3('0x3c')]){_0x1c565d['include']=[{'all':!![]}];}return db[_0x5bd3('0x29')][_0x5bd3('0x3d')](_0x1c565d);})[_0x5bd3('0x23')](function(_0x11a797){_0x4b18f9[_0x5bd3('0x3e')]=_0x11a797;return _0x4b18f9;})[_0x5bd3('0x23')](respondWithFilteredResult(_0x57b4b0,_0x1c565d))[_0x5bd3('0x3f')](handleError(_0x57b4b0,null));};exports['show']=function(_0x1997ad,_0x2fc316){var _0xd90bd5={'raw':!![],'where':{'id':_0x1997ad['params']['id']}},_0xe4cff5={};_0xe4cff5[_0x5bd3('0x2d')]=_['keys'](db[_0x5bd3('0x29')][_0x5bd3('0x40')]);_0xe4cff5['query']=_[_0x5bd3('0x41')](_0x1997ad[_0x5bd3('0x2e')]);_0xe4cff5[_0x5bd3('0x2f')]=_[_0x5bd3('0x30')](_0xe4cff5[_0x5bd3('0x2d')],_0xe4cff5[_0x5bd3('0x2e')]);_0xd90bd5[_0x5bd3('0x31')]=_[_0x5bd3('0x30')](_0xe4cff5[_0x5bd3('0x2d')],qs[_0x5bd3('0x32')](_0x1997ad[_0x5bd3('0x2e')][_0x5bd3('0x32')]));_0xd90bd5[_0x5bd3('0x31')]=_0xd90bd5[_0x5bd3('0x31')][_0x5bd3('0x42')]?_0xd90bd5['attributes']:_0xe4cff5[_0x5bd3('0x2d')];if(_0x1997ad[_0x5bd3('0x2e')]['includeAll']){_0xd90bd5[_0x5bd3('0x43')]=[{'all':!![]}];}_0xd90bd5=_[_0x5bd3('0x39')]({},_0xd90bd5,_0x1997ad[_0x5bd3('0x3b')]);return db[_0x5bd3('0x29')][_0x5bd3('0x44')](_0xd90bd5)[_0x5bd3('0x23')](handleEntityNotFound(_0x2fc316,null))['then'](respondWithResult(_0x2fc316,null))[_0x5bd3('0x3f')](handleError(_0x2fc316,null));};exports[_0x5bd3('0x45')]=function(_0x52afb6,_0x43384e){return db['FaxTransferReport'][_0x5bd3('0x45')](_0x52afb6['body'],{})['then'](respondWithResult(_0x43384e,0xc9))['catch'](handleError(_0x43384e,null));};exports[_0x5bd3('0x46')]=function(_0x5ce699,_0x21751c){if(_0x5ce699[_0x5bd3('0x47')]['id']){delete _0x5ce699[_0x5bd3('0x47')]['id'];}return db[_0x5bd3('0x29')]['find']({'where':{'id':_0x5ce699[_0x5bd3('0x48')]['id']}})[_0x5bd3('0x23')](handleEntityNotFound(_0x21751c,null))[_0x5bd3('0x23')](saveUpdates(_0x5ce699['body'],null))[_0x5bd3('0x23')](respondWithResult(_0x21751c,null))[_0x5bd3('0x3f')](handleError(_0x21751c,null));};exports[_0x5bd3('0x24')]=function(_0x26794b,_0x5dfdf8){return db['FaxTransferReport'][_0x5bd3('0x44')]({'where':{'id':_0x26794b[_0x5bd3('0x48')]['id']}})[_0x5bd3('0x23')](handleEntityNotFound(_0x5dfdf8,null))[_0x5bd3('0x23')](removeEntity(_0x5dfdf8,null))['catch'](handleError(_0x5dfdf8,null));};exports[_0x5bd3('0x49')]=function(_0x285075,_0x412e8a){return db[_0x5bd3('0x29')][_0x5bd3('0x49')]()[_0x5bd3('0x23')](respondWithResult(_0x412e8a,null))[_0x5bd3('0x3f')](handleError(_0x412e8a,null));}; \ No newline at end of file +var _0x8914=['map','FaxTransferReport','rawAttributes','fieldName','type','key','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','filters','filter','where','merge','VIRTUAL','includeAll','findAll','catch','include','options','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','save','update','then','destroy','error','name','send','index'];(function(_0x46a903,_0x13350c){var _0x5e7499=function(_0x5e97db){while(--_0x5e97db){_0x46a903['push'](_0x46a903['shift']());}};_0x5e7499(++_0x13350c);}(_0x8914,0xb5));var _0x4891=function(_0x28fd3f,_0x179ab4){_0x28fd3f=_0x28fd3f-0x0;var _0x16bcb7=_0x8914[_0x28fd3f];return _0x16bcb7;};'use strict';var emlformat=require(_0x4891('0x0'));var rimraf=require(_0x4891('0x1'));var zipdir=require(_0x4891('0x2'));var jsonpatch=require(_0x4891('0x3'));var rp=require('request-promise');var moment=require(_0x4891('0x4'));var BPromise=require(_0x4891('0x5'));var Mustache=require(_0x4891('0x6'));var util=require(_0x4891('0x7'));var path=require(_0x4891('0x8'));var sox=require(_0x4891('0x9'));var csv=require(_0x4891('0xa'));var ejs=require(_0x4891('0xb'));var fs=require('fs');var fs_extra=require(_0x4891('0xc'));var _=require(_0x4891('0xd'));var squel=require(_0x4891('0xe'));var crypto=require('crypto');var jsforce=require(_0x4891('0xf'));var deskjs=require(_0x4891('0x10'));var toCsv=require(_0x4891('0xa'));var querystring=require(_0x4891('0x11'));var Papa=require(_0x4891('0x12'));var Redis=require(_0x4891('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x4891('0x14'));var hardwareService=require(_0x4891('0x15'));var logger=require(_0x4891('0x16'))(_0x4891('0x17'));var utils=require('../../config/utils');var config=require(_0x4891('0x18'));var licenseUtil=require(_0x4891('0x19'));var db=require(_0x4891('0x1a'))['db'];function respondWithStatusCode(_0x4c76f0,_0x44430e){_0x44430e=_0x44430e||0xcc;return function(_0x5ad7e4){if(_0x5ad7e4){return _0x4c76f0[_0x4891('0x1b')](_0x44430e);}return _0x4c76f0[_0x4891('0x1c')](_0x44430e)[_0x4891('0x1d')]();};}function respondWithResult(_0x4c89cd,_0x1bd7af){_0x1bd7af=_0x1bd7af||0xc8;return function(_0x15a6b3){if(_0x15a6b3){return _0x4c89cd[_0x4891('0x1c')](_0x1bd7af)[_0x4891('0x1e')](_0x15a6b3);}};}function respondWithFilteredResult(_0x570cd4,_0x335bd6){return function(_0x370b25){if(_0x370b25){var _0x3de262=typeof _0x335bd6[_0x4891('0x1f')]===_0x4891('0x20')&&typeof _0x335bd6[_0x4891('0x21')]===_0x4891('0x20');var _0x3f2901=_0x370b25['count'];var _0xd41820=_0x3de262?0x0:_0x335bd6[_0x4891('0x1f')];var _0x34bf4=_0x3de262?_0x370b25[_0x4891('0x22')]:_0x335bd6['offset']+_0x335bd6['limit'];var _0x339d7c;if(_0x34bf4>=_0x3f2901){_0x34bf4=_0x3f2901;_0x339d7c=0xc8;}else{_0x339d7c=0xce;}_0x570cd4[_0x4891('0x1c')](_0x339d7c);return _0x570cd4[_0x4891('0x23')]('Content-Range',_0xd41820+'-'+_0x34bf4+'/'+_0x3f2901)[_0x4891('0x1e')](_0x370b25);}return null;};}function patchUpdates(_0x96200d){return function(_0x1ef0f9){try{jsonpatch['apply'](_0x1ef0f9,_0x96200d,!![]);}catch(_0x2dbf49){return BPromise['reject'](_0x2dbf49);}return _0x1ef0f9[_0x4891('0x24')]();};}function saveUpdates(_0x1e477a,_0x233acd){return function(_0x35d22a){if(_0x35d22a){return _0x35d22a[_0x4891('0x25')](_0x1e477a)[_0x4891('0x26')](function(_0x355e97){return _0x355e97;});}return null;};}function removeEntity(_0x571c49,_0x335ba7){return function(_0x39df26){if(_0x39df26){return _0x39df26[_0x4891('0x27')]()[_0x4891('0x26')](function(){_0x571c49[_0x4891('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x73fe11,_0x27bbb3){return function(_0x3b8376){if(!_0x3b8376){_0x73fe11[_0x4891('0x1b')](0x194);}return _0x3b8376;};}function handleError(_0x31b7ee,_0x4db256){_0x4db256=_0x4db256||0x1f4;return function(_0x14de19){logger[_0x4891('0x28')](_0x14de19['stack']);if(_0x14de19[_0x4891('0x29')]){delete _0x14de19[_0x4891('0x29')];}_0x31b7ee[_0x4891('0x1c')](_0x4db256)[_0x4891('0x2a')](_0x14de19);};}exports[_0x4891('0x2b')]=function(_0x195605,_0x3e3804){var _0x1600c5={},_0x25d28d={},_0x3d28f8={'count':0x0,'rows':[]};var _0x473d0e=_[_0x4891('0x2c')](db[_0x4891('0x2d')][_0x4891('0x2e')],function(_0x29ee41){return{'name':_0x29ee41[_0x4891('0x2f')],'type':_0x29ee41[_0x4891('0x30')][_0x4891('0x31')]};});_0x25d28d['model']=_[_0x4891('0x2c')](_0x473d0e,'name');_0x25d28d[_0x4891('0x32')]=_[_0x4891('0x33')](_0x195605[_0x4891('0x32')]);_0x25d28d['filters']=_[_0x4891('0x34')](_0x25d28d[_0x4891('0x35')],_0x25d28d[_0x4891('0x32')]);_0x1600c5['attributes']=_[_0x4891('0x34')](_0x25d28d[_0x4891('0x35')],qs[_0x4891('0x36')](_0x195605[_0x4891('0x32')]['fields']));_0x1600c5['attributes']=_0x1600c5[_0x4891('0x37')][_0x4891('0x38')]?_0x1600c5['attributes']:_0x25d28d[_0x4891('0x35')];if(!_0x195605[_0x4891('0x32')][_0x4891('0x39')](_0x4891('0x3a'))){_0x1600c5[_0x4891('0x21')]=qs[_0x4891('0x21')](_0x195605[_0x4891('0x32')]['limit']);_0x1600c5[_0x4891('0x1f')]=qs['offset'](_0x195605[_0x4891('0x32')][_0x4891('0x1f')]);}_0x1600c5['order']=qs[_0x4891('0x3b')](_0x195605[_0x4891('0x32')][_0x4891('0x3b')]);_0x1600c5['where']=qs[_0x4891('0x3c')](_['pick'](_0x195605[_0x4891('0x32')],_0x25d28d['filters']),_0x473d0e);if(_0x195605[_0x4891('0x32')][_0x4891('0x3d')]){_0x1600c5[_0x4891('0x3e')]=_[_0x4891('0x3f')](_0x1600c5[_0x4891('0x3e')],{'$or':_[_0x4891('0x2c')](_0x473d0e,function(_0x5d89ca){if(_0x5d89ca[_0x4891('0x30')]!==_0x4891('0x40')){var _0x15f581={};_0x15f581[_0x5d89ca[_0x4891('0x29')]]={'$like':'%'+_0x195605['query'][_0x4891('0x3d')]+'%'};return _0x15f581;}})});}_0x1600c5=_['merge']({},_0x1600c5,_0x195605['options']);var _0x28ff52={'where':_0x1600c5[_0x4891('0x3e')]};return db[_0x4891('0x2d')][_0x4891('0x22')](_0x28ff52)[_0x4891('0x26')](function(_0x13df54){_0x3d28f8[_0x4891('0x22')]=_0x13df54;if(_0x195605['query'][_0x4891('0x41')]){_0x1600c5['include']=[{'all':!![]}];}return db[_0x4891('0x2d')][_0x4891('0x42')](_0x1600c5);})[_0x4891('0x26')](function(_0x4c8610){_0x3d28f8['rows']=_0x4c8610;return _0x3d28f8;})[_0x4891('0x26')](respondWithFilteredResult(_0x3e3804,_0x1600c5))[_0x4891('0x43')](handleError(_0x3e3804,null));};exports['show']=function(_0x6d912e,_0x5e8d9d){var _0x52c66f={'raw':!![],'where':{'id':_0x6d912e['params']['id']}},_0x9d047a={};_0x9d047a[_0x4891('0x35')]=_['keys'](db[_0x4891('0x2d')][_0x4891('0x2e')]);_0x9d047a[_0x4891('0x32')]=_[_0x4891('0x33')](_0x6d912e['query']);_0x9d047a[_0x4891('0x3c')]=_[_0x4891('0x34')](_0x9d047a[_0x4891('0x35')],_0x9d047a[_0x4891('0x32')]);_0x52c66f[_0x4891('0x37')]=_[_0x4891('0x34')](_0x9d047a['model'],qs['fields'](_0x6d912e['query'][_0x4891('0x36')]));_0x52c66f[_0x4891('0x37')]=_0x52c66f[_0x4891('0x37')][_0x4891('0x38')]?_0x52c66f[_0x4891('0x37')]:_0x9d047a[_0x4891('0x35')];if(_0x6d912e['query'][_0x4891('0x41')]){_0x52c66f[_0x4891('0x44')]=[{'all':!![]}];}_0x52c66f=_['merge']({},_0x52c66f,_0x6d912e[_0x4891('0x45')]);return db[_0x4891('0x2d')][_0x4891('0x46')](_0x52c66f)[_0x4891('0x26')](handleEntityNotFound(_0x5e8d9d,null))['then'](respondWithResult(_0x5e8d9d,null))[_0x4891('0x43')](handleError(_0x5e8d9d,null));};exports[_0x4891('0x47')]=function(_0x1a6183,_0x6475e9){return db[_0x4891('0x2d')]['create'](_0x1a6183[_0x4891('0x48')],{})[_0x4891('0x26')](respondWithResult(_0x6475e9,0xc9))['catch'](handleError(_0x6475e9,null));};exports[_0x4891('0x25')]=function(_0x1c2f54,_0x42f41e){if(_0x1c2f54[_0x4891('0x48')]['id']){delete _0x1c2f54['body']['id'];}return db['FaxTransferReport'][_0x4891('0x46')]({'where':{'id':_0x1c2f54[_0x4891('0x49')]['id']}})[_0x4891('0x26')](handleEntityNotFound(_0x42f41e,null))[_0x4891('0x26')](saveUpdates(_0x1c2f54[_0x4891('0x48')],null))[_0x4891('0x26')](respondWithResult(_0x42f41e,null))[_0x4891('0x43')](handleError(_0x42f41e,null));};exports[_0x4891('0x27')]=function(_0x1eea42,_0x170439){return db[_0x4891('0x2d')][_0x4891('0x46')]({'where':{'id':_0x1eea42[_0x4891('0x49')]['id']}})[_0x4891('0x26')](handleEntityNotFound(_0x170439,null))['then'](removeEntity(_0x170439,null))[_0x4891('0x43')](handleError(_0x170439,null));};exports[_0x4891('0x4a')]=function(_0x46dc88,_0x93334e){return db[_0x4891('0x2d')]['describe']()[_0x4891('0x26')](respondWithResult(_0x93334e,null))[_0x4891('0x43')](handleError(_0x93334e,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index eb701c1..7a71aa3 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 _0xaa71=['exports','define','FaxTransferReport','report_fax_transfer','uniqueid','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxTransferReport.attributes'];(function(_0x44a3b0,_0x352810){var _0x39e6f6=function(_0x248002){while(--_0x248002){_0x44a3b0['push'](_0x44a3b0['shift']());}};_0x39e6f6(++_0x352810);}(_0xaa71,0x17f));var _0x1aa7=function(_0x53c4a7,_0x1d6ff9){_0x53c4a7=_0x53c4a7-0x0;var _0x370dd0=_0xaa71[_0x53c4a7];return _0x370dd0;};'use strict';var _=require('lodash');var util=require(_0x1aa7('0x0'));var logger=require('../../config/logger')(_0x1aa7('0x1'));var moment=require(_0x1aa7('0x2'));var BPromise=require(_0x1aa7('0x3'));var rp=require(_0x1aa7('0x4'));var fs=require('fs');var path=require(_0x1aa7('0x5'));var rimraf=require(_0x1aa7('0x6'));var config=require(_0x1aa7('0x7'));var attributes=require(_0x1aa7('0x8'));module[_0x1aa7('0x9')]=function(_0x432764,_0x53937b){return _0x432764[_0x1aa7('0xa')](_0x1aa7('0xb'),attributes,{'tableName':_0x1aa7('0xc'),'paranoid':![],'indexes':[{'name':_0x1aa7('0xd'),'fields':[_0x1aa7('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf3da=['uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./faxTransferReport.attributes','exports','define','FaxTransferReport'];(function(_0x4121ce,_0x386ea7){var _0x43e555=function(_0x50a0f4){while(--_0x50a0f4){_0x4121ce['push'](_0x4121ce['shift']());}};_0x43e555(++_0x386ea7);}(_0xf3da,0x143));var _0xaf3d=function(_0x852d09,_0x1fce93){_0x852d09=_0x852d09-0x0;var _0x1366c9=_0xf3da[_0x852d09];return _0x1366c9;};'use strict';var _=require(_0xaf3d('0x0'));var util=require(_0xaf3d('0x1'));var logger=require(_0xaf3d('0x2'))(_0xaf3d('0x3'));var moment=require(_0xaf3d('0x4'));var BPromise=require(_0xaf3d('0x5'));var rp=require(_0xaf3d('0x6'));var fs=require('fs');var path=require(_0xaf3d('0x7'));var rimraf=require(_0xaf3d('0x8'));var config=require('../../config/environment');var attributes=require(_0xaf3d('0x9'));module[_0xaf3d('0xa')]=function(_0x5c28a9,_0x3058f0){return _0x5c28a9[_0xaf3d('0xb')](_0xaf3d('0xc'),attributes,{'tableName':'report_fax_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xaf3d('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index 9e00359..645514e 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 _0x02ff=['code','message','info','result','catch','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','then','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','error'];(function(_0x1deb03,_0xd05ad8){var _0x189fe7=function(_0x321225){while(--_0x321225){_0x1deb03['push'](_0x1deb03['shift']());}};_0x189fe7(++_0xd05ad8);}(_0x02ff,0xf5));var _0xf02f=function(_0xee96c6,_0x6dc801){_0xee96c6=_0xee96c6-0x0;var _0xb990fa=_0x02ff[_0xee96c6];return _0xb990fa;};'use strict';var _=require('lodash');var util=require(_0xf02f('0x0'));var moment=require(_0xf02f('0x1'));var BPromise=require('bluebird');var rs=require(_0xf02f('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf02f('0x3'))['db'];var utils=require(_0xf02f('0x4'));var logger=require(_0xf02f('0x5'))(_0xf02f('0x6'));var config=require(_0xf02f('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xf02f('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x7d7604,_0x440524,_0x11350d){return new BPromise(function(_0x4838ec,_0x4568dc){return client['request'](_0x7d7604,_0x11350d)[_0xf02f('0x9')](function(_0xfef7cc){logger['info'](_0xf02f('0xa'),_0x440524,_0xf02f('0xb'));logger[_0xf02f('0xc')](_0xf02f('0xd'),_0x440524,_0xf02f('0xb'),JSON['stringify'](_0xfef7cc));if(_0xfef7cc[_0xf02f('0xe')]){if(_0xfef7cc[_0xf02f('0xe')][_0xf02f('0xf')]===0x1f4){logger[_0xf02f('0xe')](_0xf02f('0xa'),_0x440524,_0xfef7cc[_0xf02f('0xe')][_0xf02f('0x10')]);return _0x4568dc(_0xfef7cc['error'][_0xf02f('0x10')]);}logger[_0xf02f('0xe')](_0xf02f('0xa'),_0x440524,_0xfef7cc[_0xf02f('0xe')][_0xf02f('0x10')]);return _0x4838ec(_0xfef7cc[_0xf02f('0xe')][_0xf02f('0x10')]);}else{logger[_0xf02f('0x11')](_0xf02f('0xa'),_0x440524,_0xf02f('0xb'));_0x4838ec(_0xfef7cc[_0xf02f('0x12')][_0xf02f('0x10')]);}})[_0xf02f('0x13')](function(_0x51cfb6){logger[_0xf02f('0xe')](_0xf02f('0xa'),_0x440524,_0x51cfb6);_0x4568dc(_0x51cfb6);});});} \ No newline at end of file +var _0x3df7=['../../config/utils','../../config/logger','rpc','jayson/promise','client','http','info','FaxTransferReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','../../mysqldb'];(function(_0x27a222,_0x439e70){var _0x2825bf=function(_0x23fe2d){while(--_0x23fe2d){_0x27a222['push'](_0x27a222['shift']());}};_0x2825bf(++_0x439e70);}(_0x3df7,0x121));var _0x73df=function(_0x493a10,_0x2755cb){_0x493a10=_0x493a10-0x0;var _0x509fff=_0x3df7[_0x493a10];return _0x509fff;};'use strict';var _=require(_0x73df('0x0'));var util=require(_0x73df('0x1'));var moment=require(_0x73df('0x2'));var BPromise=require(_0x73df('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x73df('0x4'))['db'];var utils=require(_0x73df('0x5'));var logger=require(_0x73df('0x6'))(_0x73df('0x7'));var config=require('../../config/environment');var jayson=require(_0x73df('0x8'));var client=jayson[_0x73df('0x9')][_0x73df('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x78d25c,_0x4a06f9,_0x59e1ad){return new BPromise(function(_0x4c52f6,_0x2cbce7){return client['request'](_0x78d25c,_0x59e1ad)['then'](function(_0x2763a7){logger[_0x73df('0xb')](_0x73df('0xc'),_0x4a06f9,'request\x20sent');logger[_0x73df('0xd')]('FaxTransferReport,\x20%s,\x20%s,\x20%s',_0x4a06f9,_0x73df('0xe'),JSON[_0x73df('0xf')](_0x2763a7));if(_0x2763a7[_0x73df('0x10')]){if(_0x2763a7[_0x73df('0x10')][_0x73df('0x11')]===0x1f4){logger[_0x73df('0x10')](_0x73df('0xc'),_0x4a06f9,_0x2763a7[_0x73df('0x10')][_0x73df('0x12')]);return _0x2cbce7(_0x2763a7['error'][_0x73df('0x12')]);}logger['error'](_0x73df('0xc'),_0x4a06f9,_0x2763a7['error']['message']);return _0x4c52f6(_0x2763a7[_0x73df('0x10')][_0x73df('0x12')]);}else{logger[_0x73df('0xb')]('FaxTransferReport,\x20%s,\x20%s',_0x4a06f9,_0x73df('0xe'));_0x4c52f6(_0x2763a7[_0x73df('0x13')][_0x73df('0x12')]);}})[_0x73df('0x14')](function(_0x4edee0){logger['error']('FaxTransferReport,\x20%s,\x20%s',_0x4a06f9,_0x4edee0);_0x2cbce7(_0x4edee0);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index b31edcc..2eb8d71 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 _0xd328=['describe','show','create','put','/:id','update','delete','destroy','exports','multer','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','isAuthenticated','get','/describe'];(function(_0x4e7abc,_0x2aeca1){var _0x428796=function(_0xa2c1d){while(--_0xa2c1d){_0x4e7abc['push'](_0x4e7abc['shift']());}};_0x428796(++_0x2aeca1);}(_0xd328,0x199));var _0x8d32=function(_0x1d3af6,_0x11a445){_0x1d3af6=_0x1d3af6-0x0;var _0x50ecb1=_0xd328[_0x1d3af6];return _0x50ecb1;};'use strict';var multer=require(_0x8d32('0x0'));var util=require('util');var path=require(_0x8d32('0x1'));var timeout=require(_0x8d32('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x8d32('0x3'));var auth=require(_0x8d32('0x4'));var interaction=require(_0x8d32('0x5'));var config=require(_0x8d32('0x6'));var controller=require(_0x8d32('0x7'));router['get']('/',auth[_0x8d32('0x8')](),controller['index']);router[_0x8d32('0x9')](_0x8d32('0xa'),auth[_0x8d32('0x8')](),controller[_0x8d32('0xb')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x8d32('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x8d32('0xd')]);router[_0x8d32('0xe')](_0x8d32('0xf'),auth[_0x8d32('0x8')](),controller[_0x8d32('0x10')]);router[_0x8d32('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x8d32('0x12')]);module[_0x8d32('0x13')]=router; \ No newline at end of file +var _0x3441=['/:id','show','post','create','put','update','delete','destroy','exports','multer','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x969173,_0x144236){var _0x49f664=function(_0x5ea9ae){while(--_0x5ea9ae){_0x969173['push'](_0x969173['shift']());}};_0x49f664(++_0x144236);}(_0x3441,0xb1));var _0x1344=function(_0x20a573,_0x3328b4){_0x20a573=_0x20a573-0x0;var _0x399adf=_0x3441[_0x20a573];return _0x399adf;};'use strict';var multer=require(_0x1344('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x1344('0x1'));var express=require('express');var router=express[_0x1344('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x1344('0x3'));var interaction=require(_0x1344('0x4'));var config=require(_0x1344('0x5'));var controller=require(_0x1344('0x6'));router[_0x1344('0x7')]('/',auth[_0x1344('0x8')](),controller[_0x1344('0x9')]);router[_0x1344('0x7')](_0x1344('0xa'),auth['isAuthenticated'](),controller[_0x1344('0xb')]);router[_0x1344('0x7')](_0x1344('0xc'),auth[_0x1344('0x8')](),controller[_0x1344('0xd')]);router[_0x1344('0xe')]('/',auth[_0x1344('0x8')](),controller[_0x1344('0xf')]);router[_0x1344('0x10')](_0x1344('0xc'),auth[_0x1344('0x8')](),controller[_0x1344('0x11')]);router[_0x1344('0x12')](_0x1344('0xc'),auth[_0x1344('0x8')](),controller[_0x1344('0x13')]);module[_0x1344('0x14')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index 79271d1..f31d4d7 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 _0x5463=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','delete','destroy','exports','multer','connect-timeout','express','Router'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x5463,0x1dc));var _0x3546=function(_0x4d92a1,_0x4c6e1a){_0x4d92a1=_0x4d92a1-0x0;var _0x1f634c=_0x5463[_0x4d92a1];return _0x1f634c;};'use strict';var multer=require(_0x3546('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x3546('0x1'));var express=require(_0x3546('0x2'));var router=express[_0x3546('0x3')]();var fs_extra=require(_0x3546('0x4'));var auth=require(_0x3546('0x5'));var interaction=require(_0x3546('0x6'));var config=require(_0x3546('0x7'));var controller=require('./intDeskAccount.controller');router[_0x3546('0x8')]('/',auth[_0x3546('0x9')](),controller[_0x3546('0xa')]);router[_0x3546('0x8')](_0x3546('0xb'),auth[_0x3546('0x9')](),controller[_0x3546('0xc')]);router[_0x3546('0x8')](_0x3546('0xd'),auth['isAuthenticated'](),controller[_0x3546('0xe')]);router[_0x3546('0x8')](_0x3546('0xf'),auth[_0x3546('0x9')](),controller[_0x3546('0x10')]);router[_0x3546('0x11')]('/',auth[_0x3546('0x9')](),controller[_0x3546('0x12')]);router[_0x3546('0x11')]('/:id/configurations',auth[_0x3546('0x9')](),controller[_0x3546('0x13')]);router[_0x3546('0x14')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x3546('0x15')]('/:id',auth[_0x3546('0x9')](),controller[_0x3546('0x16')]);module[_0x3546('0x17')]=router; \ No newline at end of file +var _0x0090=['delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','isAuthenticated','index','get','/:id','show','/:id/configurations','/:id/fields','getFields','create','put','update'];(function(_0x11f74c,_0x573b47){var _0x56fa0b=function(_0x2d5f33){while(--_0x2d5f33){_0x11f74c['push'](_0x11f74c['shift']());}};_0x56fa0b(++_0x573b47);}(_0x0090,0x87));var _0x0009=function(_0x5a4667,_0xfb8fd7){_0x5a4667=_0x5a4667-0x0;var _0x54c4c8=_0x0090[_0x5a4667];return _0x54c4c8;};'use strict';var multer=require(_0x0009('0x0'));var util=require('util');var path=require(_0x0009('0x1'));var timeout=require(_0x0009('0x2'));var express=require('express');var router=express[_0x0009('0x3')]();var fs_extra=require(_0x0009('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x0009('0x5'));var config=require(_0x0009('0x6'));var controller=require(_0x0009('0x7'));router['get']('/',auth[_0x0009('0x8')](),controller[_0x0009('0x9')]);router[_0x0009('0xa')](_0x0009('0xb'),auth[_0x0009('0x8')](),controller[_0x0009('0xc')]);router[_0x0009('0xa')](_0x0009('0xd'),auth[_0x0009('0x8')](),controller['getConfigurations']);router[_0x0009('0xa')](_0x0009('0xe'),auth['isAuthenticated'](),controller[_0x0009('0xf')]);router['post']('/',auth[_0x0009('0x8')](),controller[_0x0009('0x10')]);router['post'](_0x0009('0xd'),auth[_0x0009('0x8')](),controller['addConfiguration']);router[_0x0009('0x11')](_0x0009('0xb'),auth['isAuthenticated'](),controller[_0x0009('0x12')]);router[_0x0009('0x13')](_0x0009('0xb'),auth[_0x0009('0x8')](),controller[_0x0009('0x14')]);module[_0x0009('0x15')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index 3ede009..3b2a01a 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 _0xdb97=['sequelize','exports','STRING','ENUM','basic','integrationTab','newTab'];(function(_0x193a6e,_0x45dd00){var _0x599a9b=function(_0x37a9e2){while(--_0x37a9e2){_0x193a6e['push'](_0x193a6e['shift']());}};_0x599a9b(++_0x45dd00);}(_0xdb97,0x134));var _0x7db9=function(_0x2a8ace,_0x5a0673){_0x2a8ace=_0x2a8ace-0x0;var _0x7e7c64=_0xdb97[_0x2a8ace];return _0x7e7c64;};'use strict';var Sequelize=require(_0x7db9('0x0'));module[_0x7db9('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x7db9('0x2')]},'username':{'type':Sequelize[_0x7db9('0x2')]},'remoteUri':{'type':Sequelize[_0x7db9('0x2')]},'authType':{'type':Sequelize[_0x7db9('0x3')](_0x7db9('0x4')),'defaultValue':_0x7db9('0x4')},'password':{'type':Sequelize['STRING']},'consumerKey':{'type':Sequelize[_0x7db9('0x2')]},'consumerSecret':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0x7db9('0x2')]},'tokenSecret':{'type':Sequelize[_0x7db9('0x2')]},'serverUrl':{'type':Sequelize[_0x7db9('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x7db9('0x3')](_0x7db9('0x5'),_0x7db9('0x6')),'defaultValue':_0x7db9('0x5')}}; \ No newline at end of file +var _0xf2cf=['STRING','ENUM','basic','newTab','integrationTab','sequelize','exports'];(function(_0x2e4e19,_0x493b50){var _0x9ba20b=function(_0x2f6456){while(--_0x2f6456){_0x2e4e19['push'](_0x2e4e19['shift']());}};_0x9ba20b(++_0x493b50);}(_0xf2cf,0x91));var _0xff2c=function(_0x641a1d,_0x2af414){_0x641a1d=_0x641a1d-0x0;var _0x18ed41=_0xf2cf[_0x641a1d];return _0x18ed41;};'use strict';var Sequelize=require(_0xff2c('0x0'));module[_0xff2c('0x1')]={'name':{'type':Sequelize[_0xff2c('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xff2c('0x2')]},'remoteUri':{'type':Sequelize['STRING']},'authType':{'type':Sequelize[_0xff2c('0x3')]('basic'),'defaultValue':_0xff2c('0x4')},'password':{'type':Sequelize[_0xff2c('0x2')]},'consumerKey':{'type':Sequelize[_0xff2c('0x2')]},'consumerSecret':{'type':Sequelize[_0xff2c('0x2')]},'token':{'type':Sequelize[_0xff2c('0x2')]},'tokenSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0xff2c('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM']('integrationTab',_0xff2c('0x5')),'defaultValue':_0xff2c('0x6')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index eee7fe9..d9ba315 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 _0xf569=['name','send','index','map','rawAttributes','fieldName','type','key','keys','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','where','filter','merge','options','includeAll','include','DeskAccount','findAll','catch','find','create','body','params','findOne','sort','addConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions','DeskConfiguration','DeskField','Descriptions','getFields','priority','remoteUri','authType','username','consumerKey','token','slice','substring','lastIndexOf','GET','format','%s/custom_fields','application/json','headers','Authorization','Basic\x20%s','%s:%s','password','base64','_embedded','entries','active','label','test','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','statusCode','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','update','then','error','stack'];(function(_0x434e99,_0x4ba69b){var _0x1b4084=function(_0x197879){while(--_0x197879){_0x434e99['push'](_0x434e99['shift']());}};_0x1b4084(++_0x4ba69b);}(_0xf569,0xbc));var _0x9f56=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0xf569[_0x5d6456];return _0x4d66c1;};'use strict';var emlformat=require(_0x9f56('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9f56('0x1'));var jsonpatch=require(_0x9f56('0x2'));var rp=require(_0x9f56('0x3'));var moment=require(_0x9f56('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x9f56('0x5'));var util=require(_0x9f56('0x6'));var path=require('path');var sox=require(_0x9f56('0x7'));var csv=require('to-csv');var ejs=require(_0x9f56('0x8'));var fs=require('fs');var fs_extra=require(_0x9f56('0x9'));var _=require(_0x9f56('0xa'));var squel=require(_0x9f56('0xb'));var crypto=require(_0x9f56('0xc'));var jsforce=require(_0x9f56('0xd'));var deskjs=require(_0x9f56('0xe'));var toCsv=require('to-csv');var querystring=require(_0x9f56('0xf'));var Papa=require(_0x9f56('0x10'));var Redis=require(_0x9f56('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x9f56('0x12'));var as=require(_0x9f56('0x13'));var hardwareService=require(_0x9f56('0x14'));var logger=require(_0x9f56('0x15'))(_0x9f56('0x16'));var utils=require(_0x9f56('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x9f56('0x18'));var db=require(_0x9f56('0x19'))['db'];var integrations=require(_0x9f56('0x1a'));function respondWithStatusCode(_0x4b0b1d,_0x316379){_0x316379=_0x316379||0xcc;return function(_0x5e8536){if(_0x5e8536){return _0x4b0b1d[_0x9f56('0x1b')](_0x316379);}return _0x4b0b1d[_0x9f56('0x1c')](_0x316379)[_0x9f56('0x1d')]();};}function respondWithResult(_0x30ceab,_0x4759f5){_0x4759f5=_0x4759f5||0xc8;return function(_0x2617c6){if(_0x2617c6){return _0x30ceab[_0x9f56('0x1c')](_0x4759f5)[_0x9f56('0x1e')](_0x2617c6);}};}function respondWithFilteredResult(_0xaaeeec,_0x334979){return function(_0x3153c6){if(_0x3153c6){var _0x13b407=typeof _0x334979[_0x9f56('0x1f')]===_0x9f56('0x20')&&typeof _0x334979['limit']==='undefined';var _0x5be20f=_0x3153c6[_0x9f56('0x21')];var _0x4ad6ae=_0x13b407?0x0:_0x334979['offset'];var _0x15c284=_0x13b407?_0x3153c6[_0x9f56('0x21')]:_0x334979[_0x9f56('0x1f')]+_0x334979['limit'];var _0x4cde86;if(_0x15c284>=_0x5be20f){_0x15c284=_0x5be20f;_0x4cde86=0xc8;}else{_0x4cde86=0xce;}_0xaaeeec[_0x9f56('0x1c')](_0x4cde86);return _0xaaeeec[_0x9f56('0x22')](_0x9f56('0x23'),_0x4ad6ae+'-'+_0x15c284+'/'+_0x5be20f)['json'](_0x3153c6);}return null;};}function patchUpdates(_0x1124e1){return function(_0x11c23b){try{jsonpatch[_0x9f56('0x24')](_0x11c23b,_0x1124e1,!![]);}catch(_0x40600c){return BPromise[_0x9f56('0x25')](_0x40600c);}return _0x11c23b['save']();};}function saveUpdates(_0x5de010,_0x33aead){return function(_0x2a4e0a){if(_0x2a4e0a){return _0x2a4e0a[_0x9f56('0x26')](_0x5de010)[_0x9f56('0x27')](function(_0x100d4f){return _0x100d4f;});}return null;};}function removeEntity(_0x5c55d6,_0x1aa55e){return function(_0x28b0a1){if(_0x28b0a1){return _0x28b0a1['destroy']()[_0x9f56('0x27')](function(){_0x5c55d6[_0x9f56('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x440234,_0x382e17){return function(_0x4eb871){if(!_0x4eb871){_0x440234[_0x9f56('0x1b')](0x194);}return _0x4eb871;};}function handleError(_0x370435,_0x3890a3){_0x3890a3=_0x3890a3||0x1f4;return function(_0xc8318d){logger[_0x9f56('0x28')](_0xc8318d[_0x9f56('0x29')]);if(_0xc8318d['name']){delete _0xc8318d[_0x9f56('0x2a')];}_0x370435['status'](_0x3890a3)[_0x9f56('0x2b')](_0xc8318d);};}exports[_0x9f56('0x2c')]=function(_0x55f48b,_0x26a58f){var _0x15a2df={},_0x45d9b7={},_0x2ff193={'count':0x0,'rows':[]};var _0x522472=_[_0x9f56('0x2d')](db['DeskAccount'][_0x9f56('0x2e')],function(_0x28fd08){return{'name':_0x28fd08[_0x9f56('0x2f')],'type':_0x28fd08[_0x9f56('0x30')][_0x9f56('0x31')]};});_0x45d9b7['model']=_[_0x9f56('0x2d')](_0x522472,_0x9f56('0x2a'));_0x45d9b7['query']=_[_0x9f56('0x32')](_0x55f48b[_0x9f56('0x33')]);_0x45d9b7[_0x9f56('0x34')]=_['intersection'](_0x45d9b7[_0x9f56('0x35')],_0x45d9b7['query']);_0x15a2df[_0x9f56('0x36')]=_[_0x9f56('0x37')](_0x45d9b7[_0x9f56('0x35')],qs[_0x9f56('0x38')](_0x55f48b[_0x9f56('0x33')][_0x9f56('0x38')]));_0x15a2df[_0x9f56('0x36')]=_0x15a2df[_0x9f56('0x36')][_0x9f56('0x39')]?_0x15a2df[_0x9f56('0x36')]:_0x45d9b7[_0x9f56('0x35')];if(!_0x55f48b['query'][_0x9f56('0x3a')](_0x9f56('0x3b'))){_0x15a2df[_0x9f56('0x3c')]=qs[_0x9f56('0x3c')](_0x55f48b[_0x9f56('0x33')][_0x9f56('0x3c')]);_0x15a2df[_0x9f56('0x1f')]=qs[_0x9f56('0x1f')](_0x55f48b['query']['offset']);}_0x15a2df[_0x9f56('0x3d')]=qs['sort'](_0x55f48b[_0x9f56('0x33')]['sort']);_0x15a2df[_0x9f56('0x3e')]=qs[_0x9f56('0x34')](_['pick'](_0x55f48b[_0x9f56('0x33')],_0x45d9b7[_0x9f56('0x34')]),_0x522472);if(_0x55f48b['query'][_0x9f56('0x3f')]){_0x15a2df[_0x9f56('0x3e')]=_[_0x9f56('0x40')](_0x15a2df['where'],{'$or':_[_0x9f56('0x2d')](_0x522472,function(_0x123bd6){if(_0x123bd6['type']!=='VIRTUAL'){var _0x4c371e={};_0x4c371e[_0x123bd6[_0x9f56('0x2a')]]={'$like':'%'+_0x55f48b[_0x9f56('0x33')][_0x9f56('0x3f')]+'%'};return _0x4c371e;}})});}_0x15a2df=_[_0x9f56('0x40')]({},_0x15a2df,_0x55f48b[_0x9f56('0x41')]);var _0x3b2fd3={'where':_0x15a2df['where']};return db['DeskAccount']['count'](_0x3b2fd3)[_0x9f56('0x27')](function(_0x4c0798){_0x2ff193[_0x9f56('0x21')]=_0x4c0798;if(_0x55f48b[_0x9f56('0x33')][_0x9f56('0x42')]){_0x15a2df[_0x9f56('0x43')]=[{'all':!![]}];}return db[_0x9f56('0x44')][_0x9f56('0x45')](_0x15a2df);})[_0x9f56('0x27')](function(_0x8d43c1){_0x2ff193['rows']=_0x8d43c1;return _0x2ff193;})[_0x9f56('0x27')](respondWithFilteredResult(_0x26a58f,_0x15a2df))[_0x9f56('0x46')](handleError(_0x26a58f,null));};exports['show']=function(_0x424489,_0x2030e6){var _0x4c934a={'raw':![],'where':{'id':_0x424489['params']['id']}},_0x3d6d0c={};_0x3d6d0c[_0x9f56('0x35')]=_[_0x9f56('0x32')](db['DeskAccount'][_0x9f56('0x2e')]);_0x3d6d0c[_0x9f56('0x33')]=_[_0x9f56('0x32')](_0x424489[_0x9f56('0x33')]);_0x3d6d0c[_0x9f56('0x34')]=_['intersection'](_0x3d6d0c[_0x9f56('0x35')],_0x3d6d0c[_0x9f56('0x33')]);_0x4c934a['attributes']=_['intersection'](_0x3d6d0c[_0x9f56('0x35')],qs[_0x9f56('0x38')](_0x424489['query'][_0x9f56('0x38')]));_0x4c934a[_0x9f56('0x36')]=_0x4c934a[_0x9f56('0x36')][_0x9f56('0x39')]?_0x4c934a[_0x9f56('0x36')]:_0x3d6d0c[_0x9f56('0x35')];if(_0x424489[_0x9f56('0x33')]['includeAll']){_0x4c934a[_0x9f56('0x43')]=[{'all':!![]}];}_0x4c934a=_['merge']({},_0x4c934a,_0x424489[_0x9f56('0x41')]);return db[_0x9f56('0x44')][_0x9f56('0x47')](_0x4c934a)['then'](handleEntityNotFound(_0x2030e6,null))[_0x9f56('0x27')](respondWithResult(_0x2030e6,null))['catch'](handleError(_0x2030e6,null));};exports[_0x9f56('0x48')]=function(_0x1d7dff,_0x3ec3e7){return db[_0x9f56('0x44')][_0x9f56('0x48')](_0x1d7dff[_0x9f56('0x49')],{})[_0x9f56('0x27')](respondWithResult(_0x3ec3e7,0xc9))[_0x9f56('0x46')](handleError(_0x3ec3e7,null));};exports[_0x9f56('0x26')]=function(_0x4f7d3b,_0x13a377){if(_0x4f7d3b['body']['id']){delete _0x4f7d3b['body']['id'];}return db[_0x9f56('0x44')]['find']({'where':{'id':_0x4f7d3b['params']['id']}})[_0x9f56('0x27')](handleEntityNotFound(_0x13a377,null))[_0x9f56('0x27')](saveUpdates(_0x4f7d3b[_0x9f56('0x49')],null))['then'](respondWithResult(_0x13a377,null))[_0x9f56('0x46')](handleError(_0x13a377,null));};exports['destroy']=function(_0x4f80fc,_0x46e6f1){return db[_0x9f56('0x44')][_0x9f56('0x47')]({'where':{'id':_0x4f80fc[_0x9f56('0x4a')]['id']}})[_0x9f56('0x27')](handleEntityNotFound(_0x46e6f1,null))[_0x9f56('0x27')](removeEntity(_0x46e6f1,null))[_0x9f56('0x46')](handleError(_0x46e6f1,null));};exports['getConfigurations']=function(_0x1d15ef,_0x3c91a7,_0x1e4883){var _0x4f1ae8={};var _0x14f8cf={};var _0x2a98e6;var _0x3188ea;return db['DeskAccount'][_0x9f56('0x4b')]({'where':{'id':_0x1d15ef[_0x9f56('0x4a')]['id']}})[_0x9f56('0x27')](handleEntityNotFound(_0x3c91a7,null))[_0x9f56('0x27')](function(_0x7d3ac2){if(_0x7d3ac2){_0x2a98e6=_0x7d3ac2;_0x14f8cf['model']=_[_0x9f56('0x32')](db['DeskConfiguration'][_0x9f56('0x2e')]);_0x14f8cf[_0x9f56('0x33')]=_[_0x9f56('0x32')](_0x1d15ef[_0x9f56('0x33')]);_0x14f8cf['filters']=_[_0x9f56('0x37')](_0x14f8cf[_0x9f56('0x35')],_0x14f8cf[_0x9f56('0x33')]);_0x4f1ae8['attributes']=_[_0x9f56('0x37')](_0x14f8cf[_0x9f56('0x35')],qs[_0x9f56('0x38')](_0x1d15ef[_0x9f56('0x33')]['fields']));_0x4f1ae8['attributes']=_0x4f1ae8[_0x9f56('0x36')][_0x9f56('0x39')]?_0x4f1ae8[_0x9f56('0x36')]:_0x14f8cf['model'];_0x4f1ae8[_0x9f56('0x3d')]=qs['sort'](_0x1d15ef[_0x9f56('0x33')][_0x9f56('0x4c')]);_0x4f1ae8[_0x9f56('0x3e')]=qs[_0x9f56('0x34')](_['pick'](_0x1d15ef[_0x9f56('0x33')],_0x14f8cf[_0x9f56('0x34')]));if(_0x1d15ef['query'][_0x9f56('0x3f')]){_0x4f1ae8[_0x9f56('0x3e')]=_[_0x9f56('0x40')](_0x4f1ae8['where'],{'$or':_[_0x9f56('0x2d')](_0x4f1ae8[_0x9f56('0x36')],function(_0xa8553d){var _0x246f6f={};_0x246f6f[_0xa8553d]={'$like':'%'+_0x1d15ef['query'][_0x9f56('0x3f')]+'%'};return _0x246f6f;})});}_0x4f1ae8=_[_0x9f56('0x40')]({},_0x4f1ae8,_0x1d15ef[_0x9f56('0x41')]);return _0x2a98e6['getConfigurations'](_0x4f1ae8);}})[_0x9f56('0x27')](function(_0x1800c2){if(_0x1800c2){_0x3188ea=_0x1800c2[_0x9f56('0x39')];if(!_0x1d15ef[_0x9f56('0x33')]['hasOwnProperty']('nolimit')){_0x4f1ae8[_0x9f56('0x3c')]=qs['limit'](_0x1d15ef[_0x9f56('0x33')][_0x9f56('0x3c')]);_0x4f1ae8[_0x9f56('0x1f')]=qs[_0x9f56('0x1f')](_0x1d15ef[_0x9f56('0x33')][_0x9f56('0x1f')]);}return _0x2a98e6['getConfigurations'](_0x4f1ae8);}})['then'](function(_0x3ff788){if(_0x3ff788){return _0x3ff788?{'count':_0x3188ea,'rows':_0x3ff788}:null;}})['then'](respondWithResult(_0x3c91a7,null))[_0x9f56('0x46')](handleError(_0x3c91a7,null));};exports[_0x9f56('0x4d')]=function(_0x1f2057,_0x387783,_0x2801fa){if(_0x1f2057[_0x9f56('0x49')]['id']){delete _0x1f2057[_0x9f56('0x49')]['id'];}return db[_0x9f56('0x44')][_0x9f56('0x4b')]({'where':{'id':_0x1f2057[_0x9f56('0x4a')]['id']}})['then'](handleEntityNotFound(_0x387783,null))[_0x9f56('0x27')](function(_0x35cae5){if(_0x35cae5){_0x1f2057[_0x9f56('0x49')][_0x9f56('0x4e')]=_0x35cae5['id'];_0x1f2057[_0x9f56('0x49')][_0x9f56('0x4f')]=integrations[_0x9f56('0x50')](_0x1f2057['body'][_0x9f56('0x51')],_0x1f2057['body']['type']);_0x1f2057['body']['Descriptions']=integrations[_0x9f56('0x52')](_0x1f2057[_0x9f56('0x49')][_0x9f56('0x51')],_0x1f2057[_0x9f56('0x49')][_0x9f56('0x30')]);return db[_0x9f56('0x53')]['create'](_0x1f2057['body'],{'include':[{'model':db[_0x9f56('0x54')],'as':'Subjects'},{'model':db['DeskField'],'as':_0x9f56('0x55')}]});}return null;})[_0x9f56('0x27')](respondWithResult(_0x387783,null))[_0x9f56('0x46')](handleError(_0x387783,null));};exports[_0x9f56('0x56')]=function(_0x35fb73,_0x5d5c5d,_0x15fa2a){var _0x5d23fc=[{'name':_0x9f56('0x57'),'label':_0x9f56('0x57'),'custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x5b842c='';return db[_0x9f56('0x44')]['findOne']({'where':{'id':_0x35fb73[_0x9f56('0x4a')]['id']},'attributes':['id',_0x9f56('0x58'),_0x9f56('0x59'),_0x9f56('0x5a'),'password',_0x9f56('0x5b'),'consumerSecret',_0x9f56('0x5c'),'tokenSecret']})[_0x9f56('0x27')](handleEntityNotFound(_0x5d5c5d,null))[_0x9f56('0x27')](function(_0x295b2f){if(_0x295b2f){_0x5b842c=_0x295b2f['remoteUri'];var _0x48a0d6=_0x5b842c[_0x9f56('0x5d')](-0x1);if(_0x48a0d6==='/'){_0x5b842c=_0x5b842c[_0x9f56('0x5e')](0x0,_0x5b842c[_0x9f56('0x5f')](_0x48a0d6));}var _0x10d410={'method':_0x9f56('0x60'),'uri':util[_0x9f56('0x61')](_0x9f56('0x62'),_0x5b842c),'headers':{'Content-Type':_0x9f56('0x63'),'Accept':_0x9f56('0x63')},'json':!![]};if(_0x295b2f[_0x9f56('0x59')]==='basic'){_0x10d410[_0x9f56('0x64')][_0x9f56('0x65')]=util[_0x9f56('0x61')](_0x9f56('0x66'),new Buffer(util[_0x9f56('0x61')](_0x9f56('0x67'),_0x295b2f[_0x9f56('0x5a')],_0x295b2f[_0x9f56('0x68')]))['toString'](_0x9f56('0x69')));}return rp(_0x10d410)[_0x9f56('0x27')](function(_0x27aaf7){return _0x5d23fc['concat'](_['map'](_0x27aaf7[_0x9f56('0x6a')][_0x9f56('0x6b')],function(_0x8cbc16){return{'id':_0x8cbc16[_0x9f56('0x2a')],'name':_0x8cbc16[_0x9f56('0x2a')],'type':_0x8cbc16[_0x9f56('0x30')],'active':_0x8cbc16[_0x9f56('0x6c')],'label':_0x8cbc16[_0x9f56('0x6d')],'custom':!![]};}));});}})[_0x9f56('0x27')](function(_0x43b38f){return{'count':_0x43b38f['length'],'rows':_0x43b38f};})[_0x9f56('0x27')](respondWithResult(_0x5d5c5d,null))[_0x9f56('0x46')](function(_0x3a6282){var _0x20d242=_0x35fb73['query'][_0x9f56('0x6e')]?0x1f4:_0x3a6282['statusCode']||0x1f4;logger['error'](_0x9f56('0x6f'),_0x9f56('0x56'),_0x20d242,JSON[_0x9f56('0x70')](_0x3a6282));delete _0x3a6282[_0x9f56('0x2a')];if(_0x20d242===0x191){_0x20d242=0x190;}_0x5d5c5d['status'](_0x20d242)[_0x9f56('0x2b')](_0x35fb73[_0x9f56('0x33')]['test']?{'message':_0x9f56('0x71'),'statusCode':_0x3a6282[_0x9f56('0x72')]}:_0x3a6282);});}; \ No newline at end of file +var _0x1089=['count','Content-Range','json','apply','reject','save','update','then','destroy','sendStatus','name','send','map','DeskAccount','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','params','find','catch','create','body','getConfigurations','findOne','DeskConfiguration','nolimit','Subjects','channel','Descriptions','getDescriptions','DeskField','getFields','remoteUri','authType','password','consumerSecret','slice','substring','lastIndexOf','GET','format','basic','headers','Authorization','username','toString','base64','concat','_embedded','entries','active','label','test','error','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','rimraf','fast-json-patch','moment','bluebird','mustache','util','sox','ejs','fs-extra','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','end','offset','undefined','limit'];(function(_0x14b078,_0x5ddb26){var _0x40e35d=function(_0x30c286){while(--_0x30c286){_0x14b078['push'](_0x14b078['shift']());}};_0x40e35d(++_0x5ddb26);}(_0x1089,0xb5));var _0x9108=function(_0x3bf35f,_0xe8efd3){_0x3bf35f=_0x3bf35f-0x0;var _0x548e46=_0x1089[_0x3bf35f];return _0x548e46;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9108('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9108('0x1'));var rp=require('request-promise');var moment=require(_0x9108('0x2'));var BPromise=require(_0x9108('0x3'));var Mustache=require(_0x9108('0x4'));var util=require(_0x9108('0x5'));var path=require('path');var sox=require(_0x9108('0x6'));var csv=require('to-csv');var ejs=require(_0x9108('0x7'));var fs=require('fs');var fs_extra=require(_0x9108('0x8'));var _=require('lodash');var squel=require(_0x9108('0x9'));var crypto=require(_0x9108('0xa'));var jsforce=require(_0x9108('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x9108('0xc'));var querystring=require(_0x9108('0xd'));var Papa=require(_0x9108('0xe'));var Redis=require(_0x9108('0xf'));var authService=require(_0x9108('0x10'));var qs=require(_0x9108('0x11'));var as=require(_0x9108('0x12'));var hardwareService=require(_0x9108('0x13'));var logger=require(_0x9108('0x14'))(_0x9108('0x15'));var utils=require(_0x9108('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x9108('0x17'));var db=require(_0x9108('0x18'))['db'];var integrations=require(_0x9108('0x19'));function respondWithStatusCode(_0x324b78,_0x256caa){_0x256caa=_0x256caa||0xcc;return function(_0x252060){if(_0x252060){return _0x324b78['sendStatus'](_0x256caa);}return _0x324b78[_0x9108('0x1a')](_0x256caa)[_0x9108('0x1b')]();};}function respondWithResult(_0x3ae3c8,_0x2790f6){_0x2790f6=_0x2790f6||0xc8;return function(_0x57289c){if(_0x57289c){return _0x3ae3c8[_0x9108('0x1a')](_0x2790f6)['json'](_0x57289c);}};}function respondWithFilteredResult(_0x327940,_0xc0c48a){return function(_0x4da414){if(_0x4da414){var _0x1b3e29=typeof _0xc0c48a[_0x9108('0x1c')]===_0x9108('0x1d')&&typeof _0xc0c48a[_0x9108('0x1e')]===_0x9108('0x1d');var _0x66df0=_0x4da414[_0x9108('0x1f')];var _0x41ec38=_0x1b3e29?0x0:_0xc0c48a['offset'];var _0x1ec1f8=_0x1b3e29?_0x4da414[_0x9108('0x1f')]:_0xc0c48a[_0x9108('0x1c')]+_0xc0c48a[_0x9108('0x1e')];var _0x33bb45;if(_0x1ec1f8>=_0x66df0){_0x1ec1f8=_0x66df0;_0x33bb45=0xc8;}else{_0x33bb45=0xce;}_0x327940[_0x9108('0x1a')](_0x33bb45);return _0x327940['set'](_0x9108('0x20'),_0x41ec38+'-'+_0x1ec1f8+'/'+_0x66df0)[_0x9108('0x21')](_0x4da414);}return null;};}function patchUpdates(_0x5276db){return function(_0x5857a5){try{jsonpatch[_0x9108('0x22')](_0x5857a5,_0x5276db,!![]);}catch(_0x1e1345){return BPromise[_0x9108('0x23')](_0x1e1345);}return _0x5857a5[_0x9108('0x24')]();};}function saveUpdates(_0x513c15,_0x42dff5){return function(_0x4b143a){if(_0x4b143a){return _0x4b143a[_0x9108('0x25')](_0x513c15)[_0x9108('0x26')](function(_0x30a63a){return _0x30a63a;});}return null;};}function removeEntity(_0x420a56,_0x10a276){return function(_0xe88357){if(_0xe88357){return _0xe88357[_0x9108('0x27')]()[_0x9108('0x26')](function(){_0x420a56[_0x9108('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x490c97,_0x85cf12){return function(_0x29f165){if(!_0x29f165){_0x490c97[_0x9108('0x28')](0x194);}return _0x29f165;};}function handleError(_0xa22542,_0x12e139){_0x12e139=_0x12e139||0x1f4;return function(_0x1ab620){logger['error'](_0x1ab620['stack']);if(_0x1ab620['name']){delete _0x1ab620[_0x9108('0x29')];}_0xa22542[_0x9108('0x1a')](_0x12e139)[_0x9108('0x2a')](_0x1ab620);};}exports['index']=function(_0x576345,_0x24c846){var _0x52a85e={},_0x78583e={},_0x160d74={'count':0x0,'rows':[]};var _0x1065c0=_[_0x9108('0x2b')](db[_0x9108('0x2c')][_0x9108('0x2d')],function(_0x11c9d9){return{'name':_0x11c9d9['fieldName'],'type':_0x11c9d9[_0x9108('0x2e')][_0x9108('0x2f')]};});_0x78583e[_0x9108('0x30')]=_[_0x9108('0x2b')](_0x1065c0,_0x9108('0x29'));_0x78583e[_0x9108('0x31')]=_[_0x9108('0x32')](_0x576345[_0x9108('0x31')]);_0x78583e['filters']=_[_0x9108('0x33')](_0x78583e[_0x9108('0x30')],_0x78583e[_0x9108('0x31')]);_0x52a85e[_0x9108('0x34')]=_[_0x9108('0x33')](_0x78583e['model'],qs['fields'](_0x576345[_0x9108('0x31')][_0x9108('0x35')]));_0x52a85e[_0x9108('0x34')]=_0x52a85e[_0x9108('0x34')][_0x9108('0x36')]?_0x52a85e['attributes']:_0x78583e[_0x9108('0x30')];if(!_0x576345[_0x9108('0x31')][_0x9108('0x37')]('nolimit')){_0x52a85e[_0x9108('0x1e')]=qs[_0x9108('0x1e')](_0x576345[_0x9108('0x31')][_0x9108('0x1e')]);_0x52a85e[_0x9108('0x1c')]=qs[_0x9108('0x1c')](_0x576345[_0x9108('0x31')][_0x9108('0x1c')]);}_0x52a85e['order']=qs[_0x9108('0x38')](_0x576345[_0x9108('0x31')][_0x9108('0x38')]);_0x52a85e[_0x9108('0x39')]=qs[_0x9108('0x3a')](_[_0x9108('0x3b')](_0x576345[_0x9108('0x31')],_0x78583e['filters']),_0x1065c0);if(_0x576345[_0x9108('0x31')][_0x9108('0x3c')]){_0x52a85e['where']=_[_0x9108('0x3d')](_0x52a85e[_0x9108('0x39')],{'$or':_['map'](_0x1065c0,function(_0x56ef61){if(_0x56ef61[_0x9108('0x2e')]!==_0x9108('0x3e')){var _0x24e544={};_0x24e544[_0x56ef61['name']]={'$like':'%'+_0x576345[_0x9108('0x31')][_0x9108('0x3c')]+'%'};return _0x24e544;}})});}_0x52a85e=_[_0x9108('0x3d')]({},_0x52a85e,_0x576345[_0x9108('0x3f')]);var _0x49f8e1={'where':_0x52a85e[_0x9108('0x39')]};return db['DeskAccount'][_0x9108('0x1f')](_0x49f8e1)[_0x9108('0x26')](function(_0x566be4){_0x160d74[_0x9108('0x1f')]=_0x566be4;if(_0x576345[_0x9108('0x31')][_0x9108('0x40')]){_0x52a85e[_0x9108('0x41')]=[{'all':!![]}];}return db['DeskAccount']['findAll'](_0x52a85e);})[_0x9108('0x26')](function(_0x38ed67){_0x160d74['rows']=_0x38ed67;return _0x160d74;})['then'](respondWithFilteredResult(_0x24c846,_0x52a85e))['catch'](handleError(_0x24c846,null));};exports['show']=function(_0x3befb6,_0x444d67){var _0x54877f={'raw':![],'where':{'id':_0x3befb6[_0x9108('0x42')]['id']}},_0x398da8={};_0x398da8[_0x9108('0x30')]=_[_0x9108('0x32')](db[_0x9108('0x2c')][_0x9108('0x2d')]);_0x398da8[_0x9108('0x31')]=_[_0x9108('0x32')](_0x3befb6[_0x9108('0x31')]);_0x398da8[_0x9108('0x3a')]=_[_0x9108('0x33')](_0x398da8[_0x9108('0x30')],_0x398da8[_0x9108('0x31')]);_0x54877f['attributes']=_[_0x9108('0x33')](_0x398da8['model'],qs['fields'](_0x3befb6[_0x9108('0x31')][_0x9108('0x35')]));_0x54877f[_0x9108('0x34')]=_0x54877f[_0x9108('0x34')][_0x9108('0x36')]?_0x54877f[_0x9108('0x34')]:_0x398da8[_0x9108('0x30')];if(_0x3befb6['query'][_0x9108('0x40')]){_0x54877f[_0x9108('0x41')]=[{'all':!![]}];}_0x54877f=_[_0x9108('0x3d')]({},_0x54877f,_0x3befb6['options']);return db['DeskAccount'][_0x9108('0x43')](_0x54877f)[_0x9108('0x26')](handleEntityNotFound(_0x444d67,null))[_0x9108('0x26')](respondWithResult(_0x444d67,null))[_0x9108('0x44')](handleError(_0x444d67,null));};exports['create']=function(_0xa3b983,_0x582227){return db['DeskAccount'][_0x9108('0x45')](_0xa3b983[_0x9108('0x46')],{})[_0x9108('0x26')](respondWithResult(_0x582227,0xc9))[_0x9108('0x44')](handleError(_0x582227,null));};exports['update']=function(_0x3a70f3,_0x141419){if(_0x3a70f3[_0x9108('0x46')]['id']){delete _0x3a70f3['body']['id'];}return db[_0x9108('0x2c')][_0x9108('0x43')]({'where':{'id':_0x3a70f3['params']['id']}})[_0x9108('0x26')](handleEntityNotFound(_0x141419,null))[_0x9108('0x26')](saveUpdates(_0x3a70f3[_0x9108('0x46')],null))[_0x9108('0x26')](respondWithResult(_0x141419,null))[_0x9108('0x44')](handleError(_0x141419,null));};exports[_0x9108('0x27')]=function(_0x2212c4,_0x385537){return db[_0x9108('0x2c')]['find']({'where':{'id':_0x2212c4[_0x9108('0x42')]['id']}})['then'](handleEntityNotFound(_0x385537,null))[_0x9108('0x26')](removeEntity(_0x385537,null))['catch'](handleError(_0x385537,null));};exports[_0x9108('0x47')]=function(_0x3c8639,_0x5cad53,_0xaeb023){var _0x3cdf67={};var _0x12dc21={};var _0x35227d;var _0x3de2c2;return db[_0x9108('0x2c')][_0x9108('0x48')]({'where':{'id':_0x3c8639['params']['id']}})['then'](handleEntityNotFound(_0x5cad53,null))[_0x9108('0x26')](function(_0x4f1e1e){if(_0x4f1e1e){_0x35227d=_0x4f1e1e;_0x12dc21[_0x9108('0x30')]=_[_0x9108('0x32')](db[_0x9108('0x49')][_0x9108('0x2d')]);_0x12dc21[_0x9108('0x31')]=_[_0x9108('0x32')](_0x3c8639['query']);_0x12dc21['filters']=_[_0x9108('0x33')](_0x12dc21[_0x9108('0x30')],_0x12dc21[_0x9108('0x31')]);_0x3cdf67[_0x9108('0x34')]=_[_0x9108('0x33')](_0x12dc21[_0x9108('0x30')],qs[_0x9108('0x35')](_0x3c8639['query'][_0x9108('0x35')]));_0x3cdf67[_0x9108('0x34')]=_0x3cdf67[_0x9108('0x34')]['length']?_0x3cdf67['attributes']:_0x12dc21[_0x9108('0x30')];_0x3cdf67['order']=qs[_0x9108('0x38')](_0x3c8639[_0x9108('0x31')][_0x9108('0x38')]);_0x3cdf67[_0x9108('0x39')]=qs['filters'](_[_0x9108('0x3b')](_0x3c8639['query'],_0x12dc21[_0x9108('0x3a')]));if(_0x3c8639[_0x9108('0x31')]['filter']){_0x3cdf67[_0x9108('0x39')]=_[_0x9108('0x3d')](_0x3cdf67[_0x9108('0x39')],{'$or':_[_0x9108('0x2b')](_0x3cdf67[_0x9108('0x34')],function(_0x59adf4){var _0x5d6cf4={};_0x5d6cf4[_0x59adf4]={'$like':'%'+_0x3c8639[_0x9108('0x31')][_0x9108('0x3c')]+'%'};return _0x5d6cf4;})});}_0x3cdf67=_[_0x9108('0x3d')]({},_0x3cdf67,_0x3c8639[_0x9108('0x3f')]);return _0x35227d[_0x9108('0x47')](_0x3cdf67);}})[_0x9108('0x26')](function(_0xfa7cd){if(_0xfa7cd){_0x3de2c2=_0xfa7cd['length'];if(!_0x3c8639[_0x9108('0x31')][_0x9108('0x37')](_0x9108('0x4a'))){_0x3cdf67['limit']=qs[_0x9108('0x1e')](_0x3c8639[_0x9108('0x31')][_0x9108('0x1e')]);_0x3cdf67[_0x9108('0x1c')]=qs[_0x9108('0x1c')](_0x3c8639[_0x9108('0x31')][_0x9108('0x1c')]);}return _0x35227d['getConfigurations'](_0x3cdf67);}})[_0x9108('0x26')](function(_0x26dce1){if(_0x26dce1){return _0x26dce1?{'count':_0x3de2c2,'rows':_0x26dce1}:null;}})[_0x9108('0x26')](respondWithResult(_0x5cad53,null))['catch'](handleError(_0x5cad53,null));};exports['addConfiguration']=function(_0x313b91,_0x43d79f,_0x492f77){if(_0x313b91[_0x9108('0x46')]['id']){delete _0x313b91[_0x9108('0x46')]['id'];}return db[_0x9108('0x2c')][_0x9108('0x48')]({'where':{'id':_0x313b91['params']['id']}})[_0x9108('0x26')](handleEntityNotFound(_0x43d79f,null))[_0x9108('0x26')](function(_0x219b0f){if(_0x219b0f){_0x313b91['body']['AccountId']=_0x219b0f['id'];_0x313b91[_0x9108('0x46')][_0x9108('0x4b')]=integrations['getSubjects'](_0x313b91['body'][_0x9108('0x4c')],_0x313b91[_0x9108('0x46')][_0x9108('0x2e')]);_0x313b91[_0x9108('0x46')][_0x9108('0x4d')]=integrations[_0x9108('0x4e')](_0x313b91[_0x9108('0x46')][_0x9108('0x4c')],_0x313b91['body']['type']);return db[_0x9108('0x49')][_0x9108('0x45')](_0x313b91[_0x9108('0x46')],{'include':[{'model':db[_0x9108('0x4f')],'as':_0x9108('0x4b')},{'model':db['DeskField'],'as':_0x9108('0x4d')}]});}return null;})[_0x9108('0x26')](respondWithResult(_0x43d79f,null))[_0x9108('0x44')](handleError(_0x43d79f,null));};exports[_0x9108('0x50')]=function(_0x342584,_0xb774c,_0x49f726){var _0xdaedf4=[{'name':'priority','label':'priority','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 _0x4df720='';return db[_0x9108('0x2c')][_0x9108('0x48')]({'where':{'id':_0x342584[_0x9108('0x42')]['id']},'attributes':['id',_0x9108('0x51'),_0x9108('0x52'),'username',_0x9108('0x53'),'consumerKey',_0x9108('0x54'),'token','tokenSecret']})[_0x9108('0x26')](handleEntityNotFound(_0xb774c,null))[_0x9108('0x26')](function(_0x5f1770){if(_0x5f1770){_0x4df720=_0x5f1770['remoteUri'];var _0x4dd653=_0x4df720[_0x9108('0x55')](-0x1);if(_0x4dd653==='/'){_0x4df720=_0x4df720[_0x9108('0x56')](0x0,_0x4df720[_0x9108('0x57')](_0x4dd653));}var _0x32f73a={'method':_0x9108('0x58'),'uri':util[_0x9108('0x59')]('%s/custom_fields',_0x4df720),'headers':{'Content-Type':'application/json','Accept':'application/json'},'json':!![]};if(_0x5f1770[_0x9108('0x52')]===_0x9108('0x5a')){_0x32f73a[_0x9108('0x5b')][_0x9108('0x5c')]=util['format']('Basic\x20%s',new Buffer(util[_0x9108('0x59')]('%s:%s',_0x5f1770[_0x9108('0x5d')],_0x5f1770[_0x9108('0x53')]))[_0x9108('0x5e')](_0x9108('0x5f')));}return rp(_0x32f73a)['then'](function(_0x2a9183){return _0xdaedf4[_0x9108('0x60')](_[_0x9108('0x2b')](_0x2a9183[_0x9108('0x61')][_0x9108('0x62')],function(_0x39f81c){return{'id':_0x39f81c['name'],'name':_0x39f81c[_0x9108('0x29')],'type':_0x39f81c[_0x9108('0x2e')],'active':_0x39f81c[_0x9108('0x63')],'label':_0x39f81c[_0x9108('0x64')],'custom':!![]};}));});}})[_0x9108('0x26')](function(_0xa3e5e2){return{'count':_0xa3e5e2[_0x9108('0x36')],'rows':_0xa3e5e2};})[_0x9108('0x26')](respondWithResult(_0xb774c,null))['catch'](function(_0x1bb9bf){var _0x58dd61=_0x342584[_0x9108('0x31')][_0x9108('0x65')]?0x1f4:_0x1bb9bf['statusCode']||0x1f4;logger[_0x9108('0x66')](_0x9108('0x67'),_0x9108('0x50'),_0x58dd61,JSON[_0x9108('0x68')](_0x1bb9bf));delete _0x1bb9bf[_0x9108('0x29')];if(_0x58dd61===0x191){_0x58dd61=0x190;}_0xb774c['status'](_0x58dd61)['send'](_0x342584[_0x9108('0x31')]['test']?{'message':_0x9108('0x69'),'statusCode':_0x1bb9bf['statusCode']}:_0x1bb9bf);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index 3b6b321..bc7a969 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 _0xb600=['define','DeskAccount','int_desk_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','exports'];(function(_0x14492f,_0x31e099){var _0x142a3d=function(_0x3e3f46){while(--_0x3e3f46){_0x14492f['push'](_0x14492f['shift']());}};_0x142a3d(++_0x31e099);}(_0xb600,0x1d3));var _0x0b60=function(_0x332862,_0x374c82){_0x332862=_0x332862-0x0;var _0xa37e14=_0xb600[_0x332862];return _0xa37e14;};'use strict';var _=require(_0x0b60('0x0'));var util=require(_0x0b60('0x1'));var logger=require(_0x0b60('0x2'))(_0x0b60('0x3'));var moment=require(_0x0b60('0x4'));var BPromise=require(_0x0b60('0x5'));var rp=require(_0x0b60('0x6'));var fs=require('fs');var path=require(_0x0b60('0x7'));var rimraf=require(_0x0b60('0x8'));var config=require(_0x0b60('0x9'));var attributes=require(_0x0b60('0xa'));var integrations=require(_0x0b60('0xb'));module[_0x0b60('0xc')]=function(_0x53aab5,_0x481a68){return _0x53aab5[_0x0b60('0xd')](_0x0b60('0xe'),attributes,{'tableName':_0x0b60('0xf'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6778=['define','DeskAccount','int_desk_accounts','lodash','util','../../config/logger','moment','bluebird','request-promise','../../config/environment','../../components/integrations/configuration'];(function(_0x52b2ba,_0x4c4134){var _0x4695a5=function(_0x2275ab){while(--_0x2275ab){_0x52b2ba['push'](_0x52b2ba['shift']());}};_0x4695a5(++_0x4c4134);}(_0x6778,0x1e7));var _0x8677=function(_0x233cb1,_0x8ca9a2){_0x233cb1=_0x233cb1-0x0;var _0x29ee7e=_0x6778[_0x233cb1];return _0x29ee7e;};'use strict';var _=require(_0x8677('0x0'));var util=require(_0x8677('0x1'));var logger=require(_0x8677('0x2'))('api');var moment=require(_0x8677('0x3'));var BPromise=require(_0x8677('0x4'));var rp=require(_0x8677('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x8677('0x6'));var attributes=require('./intDeskAccount.attributes');var integrations=require(_0x8677('0x7'));module['exports']=function(_0x382720,_0x16f16e){return _0x382720[_0x8677('0x8')](_0x8677('0x9'),attributes,{'tableName':_0x8677('0xa'),'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 8749909..774f24a 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 _0xd344=['stringify','code','error','message','result','catch','GetDeskAccount','DeskAccount','findAll','options','raw','attributes','limit','include','map','model','then','info','ShowDeskAccount','find','lodash','util','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s'];(function(_0x139ac8,_0x1c3870){var _0x22371a=function(_0x8d6ae4){while(--_0x8d6ae4){_0x139ac8['push'](_0x139ac8['shift']());}};_0x22371a(++_0x1c3870);}(_0xd344,0x1e5));var _0x4d34=function(_0x17a190,_0xa78b29){_0x17a190=_0x17a190-0x0;var _0x191064=_0xd344[_0x17a190];return _0x191064;};'use strict';var _=require(_0x4d34('0x0'));var util=require(_0x4d34('0x1'));var moment=require('moment');var BPromise=require(_0x4d34('0x2'));var rs=require(_0x4d34('0x3'));var fs=require('fs');var Redis=require(_0x4d34('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x4d34('0x5'))('rpc');var config=require(_0x4d34('0x6'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5d2ab2,_0x10c553,_0x2f26cf){return new BPromise(function(_0x5314c2,_0x4664f2){return client['request'](_0x5d2ab2,_0x2f26cf)['then'](function(_0x427d62){logger['info'](_0x4d34('0x7'),_0x10c553,_0x4d34('0x8'));logger[_0x4d34('0x9')](_0x4d34('0xa'),_0x10c553,'request\x20sent',JSON[_0x4d34('0xb')](_0x427d62));if(_0x427d62['error']){if(_0x427d62['error'][_0x4d34('0xc')]===0x1f4){logger[_0x4d34('0xd')](_0x4d34('0x7'),_0x10c553,_0x427d62['error']['message']);return _0x4664f2(_0x427d62[_0x4d34('0xd')]['message']);}logger[_0x4d34('0xd')](_0x4d34('0x7'),_0x10c553,_0x427d62[_0x4d34('0xd')][_0x4d34('0xe')]);return _0x5314c2(_0x427d62['error'][_0x4d34('0xe')]);}else{logger['info'](_0x4d34('0x7'),_0x10c553,_0x4d34('0x8'));_0x5314c2(_0x427d62[_0x4d34('0xf')][_0x4d34('0xe')]);}})[_0x4d34('0x10')](function(_0x4a8019){logger['error']('DeskAccount,\x20%s,\x20%s',_0x10c553,_0x4a8019);_0x4664f2(_0x4a8019);});});}exports[_0x4d34('0x11')]=function(_0x54c588){var _0x5a937c=this;return new Promise(function(_0x3b8974,_0x24f404){return db[_0x4d34('0x12')][_0x4d34('0x13')]({'raw':_0x54c588[_0x4d34('0x14')]?_0x54c588[_0x4d34('0x14')][_0x4d34('0x15')]===undefined?!![]:![]:!![],'where':_0x54c588[_0x4d34('0x14')]?_0x54c588['options']['where']||null:null,'attributes':_0x54c588[_0x4d34('0x14')]?_0x54c588[_0x4d34('0x14')][_0x4d34('0x16')]||null:null,'limit':_0x54c588['options']?_0x54c588[_0x4d34('0x14')][_0x4d34('0x17')]||null:null,'include':_0x54c588[_0x4d34('0x14')]?_0x54c588[_0x4d34('0x14')][_0x4d34('0x18')]?_[_0x4d34('0x19')](_0x54c588[_0x4d34('0x14')][_0x4d34('0x18')],function(_0x5a2e1a){return{'model':db[_0x5a2e1a[_0x4d34('0x1a')]],'as':_0x5a2e1a['as'],'attributes':_0x5a2e1a[_0x4d34('0x16')],'include':_0x5a2e1a[_0x4d34('0x18')]?_[_0x4d34('0x19')](_0x5a2e1a['include'],function(_0x20fb41){return{'model':db[_0x20fb41[_0x4d34('0x1a')]],'as':_0x20fb41['as'],'attributes':_0x20fb41[_0x4d34('0x16')],'include':_0x20fb41['include']?_[_0x4d34('0x19')](_0x20fb41[_0x4d34('0x18')],function(_0x58d223){return{'model':db[_0x58d223[_0x4d34('0x1a')]],'as':_0x58d223['as'],'attributes':_0x58d223[_0x4d34('0x16')]};}):[]};}):[]};}):[]:[]})[_0x4d34('0x1b')](function(_0x966061){logger[_0x4d34('0x1c')]('GetDeskAccount',_0x54c588);logger['debug'](_0x4d34('0x11'),_0x54c588,JSON[_0x4d34('0xb')](_0x966061));_0x3b8974(_0x966061);})['catch'](function(_0x23de88){logger[_0x4d34('0xd')]('GetDeskAccount',_0x23de88['message'],_0x54c588);_0x24f404(_0x5a937c[_0x4d34('0xd')](0x1f4,_0x23de88[_0x4d34('0xe')]));});});};exports[_0x4d34('0x1d')]=function(_0x4d639a){var _0xfa33d6=this;return new Promise(function(_0x58fd23,_0x23410e){return db[_0x4d34('0x12')][_0x4d34('0x1e')]({'raw':_0x4d639a[_0x4d34('0x14')]?_0x4d639a[_0x4d34('0x14')]['raw']===undefined?!![]:![]:!![],'where':_0x4d639a[_0x4d34('0x14')]?_0x4d639a[_0x4d34('0x14')]['where']||null:null,'attributes':_0x4d639a[_0x4d34('0x14')]?_0x4d639a[_0x4d34('0x14')][_0x4d34('0x16')]||null:null,'include':_0x4d639a[_0x4d34('0x14')]?_0x4d639a['options'][_0x4d34('0x18')]?_['map'](_0x4d639a['options']['include'],function(_0x32c094){return{'model':db[_0x32c094['model']],'as':_0x32c094['as'],'attributes':_0x32c094[_0x4d34('0x16')],'include':_0x32c094[_0x4d34('0x18')]?_[_0x4d34('0x19')](_0x32c094[_0x4d34('0x18')],function(_0x30333c){return{'model':db[_0x30333c[_0x4d34('0x1a')]],'as':_0x30333c['as'],'attributes':_0x30333c[_0x4d34('0x16')],'include':_0x30333c[_0x4d34('0x18')]?_['map'](_0x30333c['include'],function(_0x53d1db){return{'model':db[_0x53d1db[_0x4d34('0x1a')]],'as':_0x53d1db['as'],'attributes':_0x53d1db['attributes']};}):[]};}):[]};}):[]:[]})[_0x4d34('0x1b')](function(_0x20f82c){logger[_0x4d34('0x1c')](_0x4d34('0x1d'),_0x4d639a);logger[_0x4d34('0x9')]('ShowDeskAccount',_0x4d639a,JSON['stringify'](_0x20f82c));_0x58fd23(_0x20f82c);})[_0x4d34('0x10')](function(_0x50e2ee){logger[_0x4d34('0xd')](_0x4d34('0x1d'),_0x50e2ee[_0x4d34('0xe')],_0x4d639a);_0x23410e(_0xfa33d6[_0x4d34('0xd')](0x1f4,_0x50e2ee[_0x4d34('0xe')]));});});}; \ No newline at end of file +var _0x2ecd=['stringify','error','code','message','result','catch','GetDeskAccount','findAll','options','raw','attributes','limit','include','map','model','ShowDeskAccount','DeskAccount','where','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s'];(function(_0x39fd11,_0x5d7883){var _0x302799=function(_0x4a0615){while(--_0x4a0615){_0x39fd11['push'](_0x39fd11['shift']());}};_0x302799(++_0x5d7883);}(_0x2ecd,0x9a));var _0xd2ec=function(_0x21dada,_0x3faed3){_0x21dada=_0x21dada-0x0;var _0x377dc1=_0x2ecd[_0x21dada];return _0x377dc1;};'use strict';var _=require(_0xd2ec('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xd2ec('0x1'));var rs=require(_0xd2ec('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd2ec('0x3'))['db'];var utils=require(_0xd2ec('0x4'));var logger=require('../../config/logger')(_0xd2ec('0x5'));var config=require(_0xd2ec('0x6'));var jayson=require(_0xd2ec('0x7'));var client=jayson[_0xd2ec('0x8')][_0xd2ec('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x49cdc1,_0x42ef8b,_0x5a66da){return new BPromise(function(_0x100655,_0xf9938c){return client[_0xd2ec('0xa')](_0x49cdc1,_0x5a66da)['then'](function(_0x53b206){logger[_0xd2ec('0xb')](_0xd2ec('0xc'),_0x42ef8b,_0xd2ec('0xd'));logger[_0xd2ec('0xe')](_0xd2ec('0xf'),_0x42ef8b,_0xd2ec('0xd'),JSON[_0xd2ec('0x10')](_0x53b206));if(_0x53b206[_0xd2ec('0x11')]){if(_0x53b206[_0xd2ec('0x11')][_0xd2ec('0x12')]===0x1f4){logger[_0xd2ec('0x11')](_0xd2ec('0xc'),_0x42ef8b,_0x53b206['error'][_0xd2ec('0x13')]);return _0xf9938c(_0x53b206[_0xd2ec('0x11')][_0xd2ec('0x13')]);}logger['error'](_0xd2ec('0xc'),_0x42ef8b,_0x53b206['error'][_0xd2ec('0x13')]);return _0x100655(_0x53b206[_0xd2ec('0x11')][_0xd2ec('0x13')]);}else{logger['info']('DeskAccount,\x20%s,\x20%s',_0x42ef8b,'request\x20sent');_0x100655(_0x53b206[_0xd2ec('0x14')][_0xd2ec('0x13')]);}})[_0xd2ec('0x15')](function(_0x4aaf70){logger['error'](_0xd2ec('0xc'),_0x42ef8b,_0x4aaf70);_0xf9938c(_0x4aaf70);});});}exports[_0xd2ec('0x16')]=function(_0x584b37){var _0x5927d9=this;return new Promise(function(_0x5300b2,_0x2b35bf){return db['DeskAccount'][_0xd2ec('0x17')]({'raw':_0x584b37['options']?_0x584b37[_0xd2ec('0x18')][_0xd2ec('0x19')]===undefined?!![]:![]:!![],'where':_0x584b37[_0xd2ec('0x18')]?_0x584b37[_0xd2ec('0x18')]['where']||null:null,'attributes':_0x584b37[_0xd2ec('0x18')]?_0x584b37['options'][_0xd2ec('0x1a')]||null:null,'limit':_0x584b37[_0xd2ec('0x18')]?_0x584b37[_0xd2ec('0x18')][_0xd2ec('0x1b')]||null:null,'include':_0x584b37[_0xd2ec('0x18')]?_0x584b37['options'][_0xd2ec('0x1c')]?_[_0xd2ec('0x1d')](_0x584b37['options'][_0xd2ec('0x1c')],function(_0x5bc9d6){return{'model':db[_0x5bc9d6[_0xd2ec('0x1e')]],'as':_0x5bc9d6['as'],'attributes':_0x5bc9d6[_0xd2ec('0x1a')],'include':_0x5bc9d6[_0xd2ec('0x1c')]?_[_0xd2ec('0x1d')](_0x5bc9d6[_0xd2ec('0x1c')],function(_0x5d18c8){return{'model':db[_0x5d18c8[_0xd2ec('0x1e')]],'as':_0x5d18c8['as'],'attributes':_0x5d18c8[_0xd2ec('0x1a')],'include':_0x5d18c8[_0xd2ec('0x1c')]?_[_0xd2ec('0x1d')](_0x5d18c8[_0xd2ec('0x1c')],function(_0x50c810){return{'model':db[_0x50c810['model']],'as':_0x50c810['as'],'attributes':_0x50c810[_0xd2ec('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2fbc7c){logger[_0xd2ec('0xb')](_0xd2ec('0x16'),_0x584b37);logger[_0xd2ec('0xe')](_0xd2ec('0x16'),_0x584b37,JSON[_0xd2ec('0x10')](_0x2fbc7c));_0x5300b2(_0x2fbc7c);})[_0xd2ec('0x15')](function(_0x423364){logger[_0xd2ec('0x11')](_0xd2ec('0x16'),_0x423364['message'],_0x584b37);_0x2b35bf(_0x5927d9['error'](0x1f4,_0x423364[_0xd2ec('0x13')]));});});};exports[_0xd2ec('0x1f')]=function(_0x542eaa){var _0x15d58d=this;return new Promise(function(_0x58d2ef,_0x5eede7){return db[_0xd2ec('0x20')]['find']({'raw':_0x542eaa[_0xd2ec('0x18')]?_0x542eaa['options'][_0xd2ec('0x19')]===undefined?!![]:![]:!![],'where':_0x542eaa['options']?_0x542eaa[_0xd2ec('0x18')][_0xd2ec('0x21')]||null:null,'attributes':_0x542eaa[_0xd2ec('0x18')]?_0x542eaa[_0xd2ec('0x18')][_0xd2ec('0x1a')]||null:null,'include':_0x542eaa[_0xd2ec('0x18')]?_0x542eaa[_0xd2ec('0x18')][_0xd2ec('0x1c')]?_['map'](_0x542eaa[_0xd2ec('0x18')][_0xd2ec('0x1c')],function(_0x4a6e98){return{'model':db[_0x4a6e98[_0xd2ec('0x1e')]],'as':_0x4a6e98['as'],'attributes':_0x4a6e98[_0xd2ec('0x1a')],'include':_0x4a6e98[_0xd2ec('0x1c')]?_[_0xd2ec('0x1d')](_0x4a6e98[_0xd2ec('0x1c')],function(_0x56dd26){return{'model':db[_0x56dd26['model']],'as':_0x56dd26['as'],'attributes':_0x56dd26[_0xd2ec('0x1a')],'include':_0x56dd26[_0xd2ec('0x1c')]?_['map'](_0x56dd26[_0xd2ec('0x1c')],function(_0x1a0e62){return{'model':db[_0x1a0e62[_0xd2ec('0x1e')]],'as':_0x1a0e62['as'],'attributes':_0x1a0e62[_0xd2ec('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5cd7ed){logger[_0xd2ec('0xb')](_0xd2ec('0x1f'),_0x542eaa);logger[_0xd2ec('0xe')](_0xd2ec('0x1f'),_0x542eaa,JSON[_0xd2ec('0x10')](_0x5cd7ed));_0x58d2ef(_0x5cd7ed);})[_0xd2ec('0x15')](function(_0x7df2f8){logger[_0xd2ec('0x11')]('ShowDeskAccount',_0x7df2f8['message'],_0x542eaa);_0x5eede7(_0x15d58d['error'](0x1f4,_0x7df2f8[_0xd2ec('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index 19bb237..a9ea162 100644 --- a/server/api/intDeskConfiguration/index.js +++ b/server/api/intDeskConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x55ca=['../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','setTags','put','/:id','update','destroy','exports','multer','util','Router','fs-extra','../../components/interaction/service'];(function(_0x39ad4c,_0x2fa27e){var _0xf3314d=function(_0x4de109){while(--_0x4de109){_0x39ad4c['push'](_0x39ad4c['shift']());}};_0xf3314d(++_0x2fa27e);}(_0x55ca,0x126));var _0xa55c=function(_0x20a822,_0x5dc295){_0x20a822=_0x20a822-0x0;var _0x3775d1=_0x55ca[_0x20a822];return _0x3775d1;};'use strict';var multer=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa55c('0x2')]();var fs_extra=require(_0xa55c('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var controller=require(_0xa55c('0x6'));router[_0xa55c('0x7')]('/',auth[_0xa55c('0x8')](),controller[_0xa55c('0x9')]);router[_0xa55c('0x7')]('/:id',auth[_0xa55c('0x8')](),controller[_0xa55c('0xa')]);router['get'](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller['getFields']);router['get'](_0xa55c('0xc'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xd')]);router[_0xa55c('0x7')](_0xa55c('0xe'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xf')]);router[_0xa55c('0x7')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller['getTags']);router['post']('/',auth[_0xa55c('0x8')](),controller['create']);router['post']('/:id/tags',auth[_0xa55c('0x8')](),controller[_0xa55c('0x11')]);router[_0xa55c('0x12')](_0xa55c('0x13'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x14')]);router['delete'](_0xa55c('0x13'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x15')]);module[_0xa55c('0x16')]=router; \ No newline at end of file +var _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(_0x37ad96,_0x26183d){var _0x364f99=function(_0x36ac43){while(--_0x36ac43){_0x37ad96['push'](_0x37ad96['shift']());}};_0x364f99(++_0x26183d);}(_0x9c44,0x178));var _0x49c4=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x9c44[_0x8c43de];return _0xa6591b;};'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 599575e..9cfe2e5 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 _0xc4d0=['exports','STRING','sequelize'];(function(_0x33e3a8,_0x1d697e){var _0x45289e=function(_0x32e234){while(--_0x32e234){_0x33e3a8['push'](_0x33e3a8['shift']());}};_0x45289e(++_0x1d697e);}(_0xc4d0,0xc8));var _0x0c4d=function(_0x1f7839,_0x2a26e6){_0x1f7839=_0x1f7839-0x0;var _0x36b42e=_0xc4d0[_0x1f7839];return _0x36b42e;};'use strict';var Sequelize=require(_0x0c4d('0x0'));module[_0x0c4d('0x1')]={'name':{'type':Sequelize[_0x0c4d('0x2')]},'description':{'type':Sequelize[_0x0c4d('0x2')]}}; \ No newline at end of file +var _0x25d8=['sequelize','STRING'];(function(_0x58460b,_0x391d08){var _0x5ed926=function(_0x50ce0e){while(--_0x50ce0e){_0x58460b['push'](_0x58460b['shift']());}};_0x5ed926(++_0x391d08);}(_0x25d8,0x194));var _0x825d=function(_0x5b510b,_0x4573fc){_0x5b510b=_0x5b510b-0x0;var _0x26ba26=_0x25d8[_0x5b510b];return _0x26ba26;};'use strict';var Sequelize=require(_0x825d('0x0'));module['exports']={'name':{'type':Sequelize[_0x825d('0x1')]},'description':{'type':Sequelize[_0x825d('0x1')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index e4a737a..c59e4e2 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 _0xadd5=['send','index','DeskConfiguration','rawAttributes','type','key','model','map','query','keys','filters','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','then','includeAll','findAll','rows','catch','show','intersection','length','include','options','find','create','body','params','findOne','getFields','getSubjects','DeskField','getDescriptions','Tag','getTags','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','undefined','limit','count','offset','set','json','apply','reject','save','destroy','end','sendStatus','error','stack','name'];(function(_0x2fdd68,_0x142f0b){var _0x48c3ab=function(_0x1a314d){while(--_0x1a314d){_0x2fdd68['push'](_0x2fdd68['shift']());}};_0x48c3ab(++_0x142f0b);}(_0xadd5,0xdd));var _0x5add=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xadd5[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x5add('0x0'));var rimraf=require(_0x5add('0x1'));var zipdir=require(_0x5add('0x2'));var jsonpatch=require(_0x5add('0x3'));var rp=require(_0x5add('0x4'));var moment=require(_0x5add('0x5'));var BPromise=require(_0x5add('0x6'));var Mustache=require('mustache');var util=require(_0x5add('0x7'));var path=require(_0x5add('0x8'));var sox=require(_0x5add('0x9'));var csv=require(_0x5add('0xa'));var ejs=require(_0x5add('0xb'));var fs=require('fs');var fs_extra=require(_0x5add('0xc'));var _=require(_0x5add('0xd'));var squel=require('squel');var crypto=require(_0x5add('0xe'));var jsforce=require(_0x5add('0xf'));var deskjs=require(_0x5add('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x5add('0x11'));var Redis=require(_0x5add('0x12'));var authService=require(_0x5add('0x13'));var qs=require(_0x5add('0x14'));var as=require(_0x5add('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5add('0x16'))(_0x5add('0x17'));var utils=require(_0x5add('0x18'));var config=require(_0x5add('0x19'));var licenseUtil=require(_0x5add('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x326f03,_0x4a60b3){_0x4a60b3=_0x4a60b3||0xcc;return function(_0x31cdc3){if(_0x31cdc3){return _0x326f03['sendStatus'](_0x4a60b3);}return _0x326f03[_0x5add('0x1b')](_0x4a60b3)['end']();};}function respondWithResult(_0x442b26,_0x5aa89c){_0x5aa89c=_0x5aa89c||0xc8;return function(_0x4750f3){if(_0x4750f3){return _0x442b26['status'](_0x5aa89c)['json'](_0x4750f3);}};}function respondWithFilteredResult(_0x5a0685,_0xb98c14){return function(_0x22a073){if(_0x22a073){var _0x3a10c2=typeof _0xb98c14['offset']===_0x5add('0x1c')&&typeof _0xb98c14[_0x5add('0x1d')]==='undefined';var _0x35c440=_0x22a073[_0x5add('0x1e')];var _0x1b5e98=_0x3a10c2?0x0:_0xb98c14[_0x5add('0x1f')];var _0x10adcf=_0x3a10c2?_0x22a073['count']:_0xb98c14['offset']+_0xb98c14[_0x5add('0x1d')];var _0x32f8f1;if(_0x10adcf>=_0x35c440){_0x10adcf=_0x35c440;_0x32f8f1=0xc8;}else{_0x32f8f1=0xce;}_0x5a0685['status'](_0x32f8f1);return _0x5a0685[_0x5add('0x20')]('Content-Range',_0x1b5e98+'-'+_0x10adcf+'/'+_0x35c440)[_0x5add('0x21')](_0x22a073);}return null;};}function patchUpdates(_0x3a9614){return function(_0x466d4a){try{jsonpatch[_0x5add('0x22')](_0x466d4a,_0x3a9614,!![]);}catch(_0x10836e){return BPromise[_0x5add('0x23')](_0x10836e);}return _0x466d4a[_0x5add('0x24')]();};}function saveUpdates(_0x4f4610,_0x4a36da){return function(_0x16f20d){if(_0x16f20d){return _0x16f20d['update'](_0x4f4610)['then'](function(_0x18cf41){return _0x18cf41;});}return null;};}function removeEntity(_0x154249,_0x20425e){return function(_0x3f71da){if(_0x3f71da){return _0x3f71da[_0x5add('0x25')]()['then'](function(){_0x154249[_0x5add('0x1b')](0xcc)[_0x5add('0x26')]();});}};}function handleEntityNotFound(_0x27a99c,_0x42e7af){return function(_0x455902){if(!_0x455902){_0x27a99c[_0x5add('0x27')](0x194);}return _0x455902;};}function handleError(_0x2ad917,_0x330cf0){_0x330cf0=_0x330cf0||0x1f4;return function(_0x724b8b){logger[_0x5add('0x28')](_0x724b8b[_0x5add('0x29')]);if(_0x724b8b[_0x5add('0x2a')]){delete _0x724b8b[_0x5add('0x2a')];}_0x2ad917[_0x5add('0x1b')](_0x330cf0)[_0x5add('0x2b')](_0x724b8b);};}exports[_0x5add('0x2c')]=function(_0x4f5b42,_0x4151aa){var _0x29f015={},_0x34d293={},_0xce801e={'count':0x0,'rows':[]};var _0x5f39cd=_['map'](db[_0x5add('0x2d')][_0x5add('0x2e')],function(_0x30a6ba){return{'name':_0x30a6ba['fieldName'],'type':_0x30a6ba[_0x5add('0x2f')][_0x5add('0x30')]};});_0x34d293[_0x5add('0x31')]=_[_0x5add('0x32')](_0x5f39cd,_0x5add('0x2a'));_0x34d293[_0x5add('0x33')]=_[_0x5add('0x34')](_0x4f5b42[_0x5add('0x33')]);_0x34d293[_0x5add('0x35')]=_['intersection'](_0x34d293[_0x5add('0x31')],_0x34d293[_0x5add('0x33')]);_0x29f015[_0x5add('0x36')]=_['intersection'](_0x34d293[_0x5add('0x31')],qs[_0x5add('0x37')](_0x4f5b42[_0x5add('0x33')][_0x5add('0x37')]));_0x29f015[_0x5add('0x36')]=_0x29f015[_0x5add('0x36')]['length']?_0x29f015[_0x5add('0x36')]:_0x34d293['model'];if(!_0x4f5b42[_0x5add('0x33')][_0x5add('0x38')](_0x5add('0x39'))){_0x29f015['limit']=qs[_0x5add('0x1d')](_0x4f5b42['query'][_0x5add('0x1d')]);_0x29f015[_0x5add('0x1f')]=qs[_0x5add('0x1f')](_0x4f5b42[_0x5add('0x33')][_0x5add('0x1f')]);}_0x29f015[_0x5add('0x3a')]=qs[_0x5add('0x3b')](_0x4f5b42[_0x5add('0x33')]['sort']);_0x29f015[_0x5add('0x3c')]=qs[_0x5add('0x35')](_[_0x5add('0x3d')](_0x4f5b42[_0x5add('0x33')],_0x34d293['filters']),_0x5f39cd);if(_0x4f5b42[_0x5add('0x33')][_0x5add('0x3e')]){_0x29f015[_0x5add('0x3c')]=_[_0x5add('0x3f')](_0x29f015[_0x5add('0x3c')],{'$or':_[_0x5add('0x32')](_0x5f39cd,function(_0x13cf29){if(_0x13cf29[_0x5add('0x2f')]!==_0x5add('0x40')){var _0x5d6dd6={};_0x5d6dd6[_0x13cf29[_0x5add('0x2a')]]={'$like':'%'+_0x4f5b42[_0x5add('0x33')][_0x5add('0x3e')]+'%'};return _0x5d6dd6;}})});}_0x29f015=_[_0x5add('0x3f')]({},_0x29f015,_0x4f5b42['options']);var _0x49d1f4={'where':_0x29f015[_0x5add('0x3c')]};return db['DeskConfiguration'][_0x5add('0x1e')](_0x49d1f4)[_0x5add('0x41')](function(_0x56d06e){_0xce801e[_0x5add('0x1e')]=_0x56d06e;if(_0x4f5b42['query'][_0x5add('0x42')]){_0x29f015['include']=[{'all':!![]}];}return db[_0x5add('0x2d')][_0x5add('0x43')](_0x29f015);})[_0x5add('0x41')](function(_0x4a855b){_0xce801e[_0x5add('0x44')]=_0x4a855b;return _0xce801e;})[_0x5add('0x41')](respondWithFilteredResult(_0x4151aa,_0x29f015))[_0x5add('0x45')](handleError(_0x4151aa,null));};exports[_0x5add('0x46')]=function(_0x25e1de,_0x61c722){var _0x4c2bb6={'raw':![],'where':{'id':_0x25e1de['params']['id']}},_0x2f61ee={};_0x2f61ee[_0x5add('0x31')]=_[_0x5add('0x34')](db[_0x5add('0x2d')][_0x5add('0x2e')]);_0x2f61ee[_0x5add('0x33')]=_[_0x5add('0x34')](_0x25e1de[_0x5add('0x33')]);_0x2f61ee[_0x5add('0x35')]=_[_0x5add('0x47')](_0x2f61ee[_0x5add('0x31')],_0x2f61ee[_0x5add('0x33')]);_0x4c2bb6['attributes']=_['intersection'](_0x2f61ee[_0x5add('0x31')],qs[_0x5add('0x37')](_0x25e1de['query'][_0x5add('0x37')]));_0x4c2bb6['attributes']=_0x4c2bb6[_0x5add('0x36')][_0x5add('0x48')]?_0x4c2bb6[_0x5add('0x36')]:_0x2f61ee[_0x5add('0x31')];if(_0x25e1de['query'][_0x5add('0x42')]){_0x4c2bb6[_0x5add('0x49')]=[{'all':!![]}];}_0x4c2bb6=_[_0x5add('0x3f')]({},_0x4c2bb6,_0x25e1de[_0x5add('0x4a')]);return db[_0x5add('0x2d')][_0x5add('0x4b')](_0x4c2bb6)[_0x5add('0x41')](handleEntityNotFound(_0x61c722,null))[_0x5add('0x41')](respondWithResult(_0x61c722,null))[_0x5add('0x45')](handleError(_0x61c722,null));};exports[_0x5add('0x4c')]=function(_0x4f2cbf,_0x5e2f6b){return db['DeskConfiguration'][_0x5add('0x4c')](_0x4f2cbf[_0x5add('0x4d')],{})[_0x5add('0x41')](respondWithResult(_0x5e2f6b,0xc9))[_0x5add('0x45')](handleError(_0x5e2f6b,null));};exports['update']=function(_0x1e5e89,_0x2d3237){if(_0x1e5e89[_0x5add('0x4d')]['id']){delete _0x1e5e89['body']['id'];}return db[_0x5add('0x2d')]['find']({'where':{'id':_0x1e5e89[_0x5add('0x4e')]['id']}})[_0x5add('0x41')](handleEntityNotFound(_0x2d3237,null))[_0x5add('0x41')](saveUpdates(_0x1e5e89['body'],null))['then'](respondWithResult(_0x2d3237,null))[_0x5add('0x45')](handleError(_0x2d3237,null));};exports[_0x5add('0x25')]=function(_0x1df541,_0x2c9877){return db[_0x5add('0x2d')][_0x5add('0x4b')]({'where':{'id':_0x1df541[_0x5add('0x4e')]['id']}})[_0x5add('0x41')](handleEntityNotFound(_0x2c9877,null))[_0x5add('0x41')](removeEntity(_0x2c9877,null))[_0x5add('0x45')](handleError(_0x2c9877,null));};exports['getFields']=function(_0x45d877,_0x538a1c,_0x1ba9db){var _0x4fdcf2={};var _0x351e40={};var _0x2be43f;var _0x2e4287;return db[_0x5add('0x2d')][_0x5add('0x4f')]({'where':{'id':_0x45d877['params']['id']}})['then'](handleEntityNotFound(_0x538a1c,null))[_0x5add('0x41')](function(_0x5dfa1e){if(_0x5dfa1e){_0x2be43f=_0x5dfa1e;_0x351e40[_0x5add('0x31')]=_[_0x5add('0x34')](db['DeskField'][_0x5add('0x2e')]);_0x351e40[_0x5add('0x33')]=_[_0x5add('0x34')](_0x45d877[_0x5add('0x33')]);_0x351e40[_0x5add('0x35')]=_['intersection'](_0x351e40[_0x5add('0x31')],_0x351e40[_0x5add('0x33')]);_0x4fdcf2[_0x5add('0x36')]=_[_0x5add('0x47')](_0x351e40[_0x5add('0x31')],qs[_0x5add('0x37')](_0x45d877[_0x5add('0x33')]['fields']));_0x4fdcf2[_0x5add('0x36')]=_0x4fdcf2[_0x5add('0x36')]['length']?_0x4fdcf2[_0x5add('0x36')]:_0x351e40[_0x5add('0x31')];_0x4fdcf2[_0x5add('0x3a')]=qs[_0x5add('0x3b')](_0x45d877[_0x5add('0x33')]['sort']);_0x4fdcf2[_0x5add('0x3c')]=qs[_0x5add('0x35')](_[_0x5add('0x3d')](_0x45d877[_0x5add('0x33')],_0x351e40['filters']));if(_0x45d877[_0x5add('0x33')][_0x5add('0x3e')]){_0x4fdcf2[_0x5add('0x3c')]=_[_0x5add('0x3f')](_0x4fdcf2[_0x5add('0x3c')],{'$or':_['map'](_0x4fdcf2[_0x5add('0x36')],function(_0x32e681){var _0x514d29={};_0x514d29[_0x32e681]={'$like':'%'+_0x45d877['query'][_0x5add('0x3e')]+'%'};return _0x514d29;})});}_0x4fdcf2=_[_0x5add('0x3f')]({},_0x4fdcf2,_0x45d877['options']);return _0x2be43f['getFields'](_0x4fdcf2);}})[_0x5add('0x41')](function(_0x4e1cac){if(_0x4e1cac){_0x2e4287=_0x4e1cac[_0x5add('0x48')];if(!_0x45d877['query']['hasOwnProperty'](_0x5add('0x39'))){_0x4fdcf2[_0x5add('0x1d')]=qs['limit'](_0x45d877[_0x5add('0x33')][_0x5add('0x1d')]);_0x4fdcf2[_0x5add('0x1f')]=qs[_0x5add('0x1f')](_0x45d877[_0x5add('0x33')][_0x5add('0x1f')]);}return _0x2be43f[_0x5add('0x50')](_0x4fdcf2);}})[_0x5add('0x41')](function(_0x38535a){if(_0x38535a){return _0x38535a?{'count':_0x2e4287,'rows':_0x38535a}:null;}})['then'](respondWithResult(_0x538a1c,null))[_0x5add('0x45')](handleError(_0x538a1c,null));};exports[_0x5add('0x51')]=function(_0x212216,_0x29ef6b,_0x5e2d22){var _0x24dacf={};var _0x1ef776={};var _0x31a36c;var _0xa937bd;return db[_0x5add('0x2d')][_0x5add('0x4f')]({'where':{'id':_0x212216[_0x5add('0x4e')]['id']}})[_0x5add('0x41')](handleEntityNotFound(_0x29ef6b,null))[_0x5add('0x41')](function(_0x39ca3d){if(_0x39ca3d){_0x31a36c=_0x39ca3d;_0x1ef776['model']=_[_0x5add('0x34')](db[_0x5add('0x52')][_0x5add('0x2e')]);_0x1ef776['query']=_[_0x5add('0x34')](_0x212216[_0x5add('0x33')]);_0x1ef776[_0x5add('0x35')]=_[_0x5add('0x47')](_0x1ef776[_0x5add('0x31')],_0x1ef776[_0x5add('0x33')]);_0x24dacf['attributes']=_['intersection'](_0x1ef776[_0x5add('0x31')],qs['fields'](_0x212216[_0x5add('0x33')][_0x5add('0x37')]));_0x24dacf[_0x5add('0x36')]=_0x24dacf['attributes'][_0x5add('0x48')]?_0x24dacf['attributes']:_0x1ef776[_0x5add('0x31')];_0x24dacf[_0x5add('0x3a')]=qs[_0x5add('0x3b')](_0x212216[_0x5add('0x33')][_0x5add('0x3b')]);_0x24dacf[_0x5add('0x3c')]=qs['filters'](_[_0x5add('0x3d')](_0x212216[_0x5add('0x33')],_0x1ef776[_0x5add('0x35')]));if(_0x212216['query']['filter']){_0x24dacf[_0x5add('0x3c')]=_['merge'](_0x24dacf[_0x5add('0x3c')],{'$or':_['map'](_0x24dacf['attributes'],function(_0x4ec0a3){var _0x177221={};_0x177221[_0x4ec0a3]={'$like':'%'+_0x212216[_0x5add('0x33')]['filter']+'%'};return _0x177221;})});}_0x24dacf=_[_0x5add('0x3f')]({},_0x24dacf,_0x212216['options']);return _0x31a36c[_0x5add('0x51')](_0x24dacf);}})['then'](function(_0x4116be){if(_0x4116be){_0xa937bd=_0x4116be[_0x5add('0x48')];if(!_0x212216[_0x5add('0x33')][_0x5add('0x38')](_0x5add('0x39'))){_0x24dacf[_0x5add('0x1d')]=qs[_0x5add('0x1d')](_0x212216[_0x5add('0x33')]['limit']);_0x24dacf[_0x5add('0x1f')]=qs['offset'](_0x212216[_0x5add('0x33')][_0x5add('0x1f')]);}return _0x31a36c[_0x5add('0x51')](_0x24dacf);}})[_0x5add('0x41')](function(_0x5c9004){if(_0x5c9004){return _0x5c9004?{'count':_0xa937bd,'rows':_0x5c9004}:null;}})[_0x5add('0x41')](respondWithResult(_0x29ef6b,null))[_0x5add('0x45')](handleError(_0x29ef6b,null));};exports['getDescriptions']=function(_0x52bd6,_0x103042,_0x1e899f){var _0x354bfd={};var _0x4c78f6={};var _0x5458f0;var _0x4e461c;return db[_0x5add('0x2d')]['findOne']({'where':{'id':_0x52bd6[_0x5add('0x4e')]['id']}})['then'](handleEntityNotFound(_0x103042,null))[_0x5add('0x41')](function(_0x4277df){if(_0x4277df){_0x5458f0=_0x4277df;_0x4c78f6[_0x5add('0x31')]=_[_0x5add('0x34')](db[_0x5add('0x52')][_0x5add('0x2e')]);_0x4c78f6[_0x5add('0x33')]=_[_0x5add('0x34')](_0x52bd6['query']);_0x4c78f6['filters']=_[_0x5add('0x47')](_0x4c78f6[_0x5add('0x31')],_0x4c78f6[_0x5add('0x33')]);_0x354bfd[_0x5add('0x36')]=_['intersection'](_0x4c78f6[_0x5add('0x31')],qs[_0x5add('0x37')](_0x52bd6[_0x5add('0x33')][_0x5add('0x37')]));_0x354bfd[_0x5add('0x36')]=_0x354bfd['attributes']['length']?_0x354bfd[_0x5add('0x36')]:_0x4c78f6[_0x5add('0x31')];_0x354bfd['order']=qs['sort'](_0x52bd6[_0x5add('0x33')][_0x5add('0x3b')]);_0x354bfd[_0x5add('0x3c')]=qs[_0x5add('0x35')](_[_0x5add('0x3d')](_0x52bd6[_0x5add('0x33')],_0x4c78f6[_0x5add('0x35')]));if(_0x52bd6[_0x5add('0x33')][_0x5add('0x3e')]){_0x354bfd[_0x5add('0x3c')]=_[_0x5add('0x3f')](_0x354bfd[_0x5add('0x3c')],{'$or':_[_0x5add('0x32')](_0x354bfd[_0x5add('0x36')],function(_0x3f8e5d){var _0x237338={};_0x237338[_0x3f8e5d]={'$like':'%'+_0x52bd6['query']['filter']+'%'};return _0x237338;})});}_0x354bfd=_[_0x5add('0x3f')]({},_0x354bfd,_0x52bd6[_0x5add('0x4a')]);return _0x5458f0[_0x5add('0x53')](_0x354bfd);}})[_0x5add('0x41')](function(_0x2d326a){if(_0x2d326a){_0x4e461c=_0x2d326a['length'];if(!_0x52bd6['query'][_0x5add('0x38')](_0x5add('0x39'))){_0x354bfd[_0x5add('0x1d')]=qs[_0x5add('0x1d')](_0x52bd6[_0x5add('0x33')][_0x5add('0x1d')]);_0x354bfd[_0x5add('0x1f')]=qs[_0x5add('0x1f')](_0x52bd6['query'][_0x5add('0x1f')]);}return _0x5458f0['getDescriptions'](_0x354bfd);}})[_0x5add('0x41')](function(_0xfa36bf){if(_0xfa36bf){return _0xfa36bf?{'count':_0x4e461c,'rows':_0xfa36bf}:null;}})['then'](respondWithResult(_0x103042,null))[_0x5add('0x45')](handleError(_0x103042,null));};exports['getTags']=function(_0x1ea5ef,_0x1a4203,_0x4fde34){var _0x17c2ef={};var _0x261fd0={};var _0xba07af;var _0x13e908;return db['DeskConfiguration'][_0x5add('0x4f')]({'where':{'id':_0x1ea5ef[_0x5add('0x4e')]['id']}})[_0x5add('0x41')](handleEntityNotFound(_0x1a4203,null))[_0x5add('0x41')](function(_0xbeea1a){if(_0xbeea1a){_0xba07af=_0xbeea1a;_0x261fd0[_0x5add('0x31')]=_[_0x5add('0x34')](db[_0x5add('0x54')][_0x5add('0x2e')]);_0x261fd0[_0x5add('0x33')]=_[_0x5add('0x34')](_0x1ea5ef[_0x5add('0x33')]);_0x261fd0['filters']=_[_0x5add('0x47')](_0x261fd0[_0x5add('0x31')],_0x261fd0['query']);_0x17c2ef['attributes']=_[_0x5add('0x47')](_0x261fd0[_0x5add('0x31')],qs[_0x5add('0x37')](_0x1ea5ef[_0x5add('0x33')]['fields']));_0x17c2ef[_0x5add('0x36')]=_0x17c2ef[_0x5add('0x36')]['length']?_0x17c2ef[_0x5add('0x36')]:_0x261fd0[_0x5add('0x31')];_0x17c2ef[_0x5add('0x3a')]=qs[_0x5add('0x3b')](_0x1ea5ef[_0x5add('0x33')][_0x5add('0x3b')]);_0x17c2ef[_0x5add('0x3c')]=qs[_0x5add('0x35')](_[_0x5add('0x3d')](_0x1ea5ef[_0x5add('0x33')],_0x261fd0['filters']));if(_0x1ea5ef['query'][_0x5add('0x3e')]){_0x17c2ef['where']=_[_0x5add('0x3f')](_0x17c2ef['where'],{'$or':_[_0x5add('0x32')](_0x17c2ef[_0x5add('0x36')],function(_0x43a57c){var _0x31729a={};_0x31729a[_0x43a57c]={'$like':'%'+_0x1ea5ef[_0x5add('0x33')][_0x5add('0x3e')]+'%'};return _0x31729a;})});}_0x17c2ef=_[_0x5add('0x3f')]({},_0x17c2ef,_0x1ea5ef[_0x5add('0x4a')]);return _0xba07af['getTags'](_0x17c2ef);}})[_0x5add('0x41')](function(_0x3309cf){if(_0x3309cf){_0x13e908=_0x3309cf[_0x5add('0x48')];if(!_0x1ea5ef['query']['hasOwnProperty'](_0x5add('0x39'))){_0x17c2ef[_0x5add('0x1d')]=qs[_0x5add('0x1d')](_0x1ea5ef['query'][_0x5add('0x1d')]);_0x17c2ef[_0x5add('0x1f')]=qs[_0x5add('0x1f')](_0x1ea5ef[_0x5add('0x33')][_0x5add('0x1f')]);}return _0xba07af[_0x5add('0x55')](_0x17c2ef);}})[_0x5add('0x41')](function(_0x382a01){if(_0x382a01){return _0x382a01?{'count':_0x13e908,'rows':_0x382a01}:null;}})[_0x5add('0x41')](respondWithResult(_0x1a4203,null))[_0x5add('0x45')](handleError(_0x1a4203,null));};exports[_0x5add('0x56')]=function(_0x597c13,_0x5107be,_0x4834e2){if(_0x597c13[_0x5add('0x4d')]['id']){delete _0x597c13[_0x5add('0x4d')]['id'];}return db[_0x5add('0x2d')][_0x5add('0x4f')]({'where':{'id':_0x597c13[_0x5add('0x4e')]['id']}})['then'](handleEntityNotFound(_0x5107be,null))[_0x5add('0x41')](function(_0x867af6){if(_0x867af6){return _0x867af6[_0x5add('0x56')](_0x597c13[_0x5add('0x4d')][_0x5add('0x57')]||[]);}return null;})['then'](respondWithResult(_0x5107be,null))[_0x5add('0x45')](handleError(_0x5107be,null));}; \ No newline at end of file +var _0x3b91=['show','params','includeAll','options','create','body','catch','update','find','getFields','DeskField','getSubjects','findOne','getDescriptions','getTags','setTags','ids','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','apply','reject','save','then','destroy','error','stack','name','send','index','map','DeskConfiguration','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','VIRTUAL','filter','include','findAll','rows'];(function(_0x4c0b23,_0x474c1c){var _0x3a06f0=function(_0x340837){while(--_0x340837){_0x4c0b23['push'](_0x4c0b23['shift']());}};_0x3a06f0(++_0x474c1c);}(_0x3b91,0x65));var _0x13b9=function(_0x3be9c7,_0x10c8db){_0x3be9c7=_0x3be9c7-0x0;var _0x2bd45c=_0x3b91[_0x3be9c7];return _0x2bd45c;};'use strict';var emlformat=require(_0x13b9('0x0'));var rimraf=require(_0x13b9('0x1'));var zipdir=require(_0x13b9('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x13b9('0x3'));var moment=require(_0x13b9('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x13b9('0x5'));var util=require(_0x13b9('0x6'));var path=require('path');var sox=require(_0x13b9('0x7'));var csv=require(_0x13b9('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x13b9('0x9'));var _=require(_0x13b9('0xa'));var squel=require('squel');var crypto=require(_0x13b9('0xb'));var jsforce=require(_0x13b9('0xc'));var deskjs=require(_0x13b9('0xd'));var toCsv=require(_0x13b9('0x8'));var querystring=require('querystring');var Papa=require(_0x13b9('0xe'));var Redis=require(_0x13b9('0xf'));var authService=require(_0x13b9('0x10'));var qs=require(_0x13b9('0x11'));var as=require(_0x13b9('0x12'));var hardwareService=require(_0x13b9('0x13'));var logger=require(_0x13b9('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x13b9('0x15'));var licenseUtil=require(_0x13b9('0x16'));var db=require(_0x13b9('0x17'))['db'];function respondWithStatusCode(_0x34492e,_0x33e366){_0x33e366=_0x33e366||0xcc;return function(_0xac5ede){if(_0xac5ede){return _0x34492e[_0x13b9('0x18')](_0x33e366);}return _0x34492e[_0x13b9('0x19')](_0x33e366)[_0x13b9('0x1a')]();};}function respondWithResult(_0x4f4158,_0x199827){_0x199827=_0x199827||0xc8;return function(_0xf4ff8e){if(_0xf4ff8e){return _0x4f4158[_0x13b9('0x19')](_0x199827)[_0x13b9('0x1b')](_0xf4ff8e);}};}function respondWithFilteredResult(_0x5bdc92,_0x40165b){return function(_0x454713){if(_0x454713){var _0x378284=typeof _0x40165b[_0x13b9('0x1c')]==='undefined'&&typeof _0x40165b['limit']===_0x13b9('0x1d');var _0x4d9857=_0x454713[_0x13b9('0x1e')];var _0x492bfd=_0x378284?0x0:_0x40165b['offset'];var _0x4cc3c0=_0x378284?_0x454713[_0x13b9('0x1e')]:_0x40165b[_0x13b9('0x1c')]+_0x40165b['limit'];var _0x168ca5;if(_0x4cc3c0>=_0x4d9857){_0x4cc3c0=_0x4d9857;_0x168ca5=0xc8;}else{_0x168ca5=0xce;}_0x5bdc92['status'](_0x168ca5);return _0x5bdc92[_0x13b9('0x1f')]('Content-Range',_0x492bfd+'-'+_0x4cc3c0+'/'+_0x4d9857)[_0x13b9('0x1b')](_0x454713);}return null;};}function patchUpdates(_0xd8e3ed){return function(_0x3b73a5){try{jsonpatch[_0x13b9('0x20')](_0x3b73a5,_0xd8e3ed,!![]);}catch(_0x170463){return BPromise[_0x13b9('0x21')](_0x170463);}return _0x3b73a5[_0x13b9('0x22')]();};}function saveUpdates(_0xed5246,_0x165013){return function(_0x50e16c){if(_0x50e16c){return _0x50e16c['update'](_0xed5246)[_0x13b9('0x23')](function(_0x535a53){return _0x535a53;});}return null;};}function removeEntity(_0x1f6112,_0x5ba66b){return function(_0xeaa676){if(_0xeaa676){return _0xeaa676[_0x13b9('0x24')]()[_0x13b9('0x23')](function(){_0x1f6112[_0x13b9('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1a3821,_0x940734){return function(_0x1e8423){if(!_0x1e8423){_0x1a3821['sendStatus'](0x194);}return _0x1e8423;};}function handleError(_0x19674f,_0x299f5a){_0x299f5a=_0x299f5a||0x1f4;return function(_0x6c89bc){logger[_0x13b9('0x25')](_0x6c89bc[_0x13b9('0x26')]);if(_0x6c89bc[_0x13b9('0x27')]){delete _0x6c89bc[_0x13b9('0x27')];}_0x19674f[_0x13b9('0x19')](_0x299f5a)[_0x13b9('0x28')](_0x6c89bc);};}exports[_0x13b9('0x29')]=function(_0x50475e,_0x1ea7a9){var _0x23ca05={},_0x2f43be={},_0x1115b0={'count':0x0,'rows':[]};var _0x129758=_[_0x13b9('0x2a')](db[_0x13b9('0x2b')][_0x13b9('0x2c')],function(_0x258869){return{'name':_0x258869[_0x13b9('0x2d')],'type':_0x258869['type']['key']};});_0x2f43be[_0x13b9('0x2e')]=_[_0x13b9('0x2a')](_0x129758,_0x13b9('0x27'));_0x2f43be[_0x13b9('0x2f')]=_[_0x13b9('0x30')](_0x50475e[_0x13b9('0x2f')]);_0x2f43be[_0x13b9('0x31')]=_[_0x13b9('0x32')](_0x2f43be[_0x13b9('0x2e')],_0x2f43be[_0x13b9('0x2f')]);_0x23ca05[_0x13b9('0x33')]=_[_0x13b9('0x32')](_0x2f43be[_0x13b9('0x2e')],qs[_0x13b9('0x34')](_0x50475e[_0x13b9('0x2f')][_0x13b9('0x34')]));_0x23ca05[_0x13b9('0x33')]=_0x23ca05[_0x13b9('0x33')][_0x13b9('0x35')]?_0x23ca05[_0x13b9('0x33')]:_0x2f43be['model'];if(!_0x50475e[_0x13b9('0x2f')][_0x13b9('0x36')](_0x13b9('0x37'))){_0x23ca05[_0x13b9('0x38')]=qs[_0x13b9('0x38')](_0x50475e[_0x13b9('0x2f')][_0x13b9('0x38')]);_0x23ca05[_0x13b9('0x1c')]=qs[_0x13b9('0x1c')](_0x50475e[_0x13b9('0x2f')][_0x13b9('0x1c')]);}_0x23ca05[_0x13b9('0x39')]=qs['sort'](_0x50475e[_0x13b9('0x2f')][_0x13b9('0x3a')]);_0x23ca05[_0x13b9('0x3b')]=qs[_0x13b9('0x31')](_[_0x13b9('0x3c')](_0x50475e[_0x13b9('0x2f')],_0x2f43be[_0x13b9('0x31')]),_0x129758);if(_0x50475e[_0x13b9('0x2f')]['filter']){_0x23ca05[_0x13b9('0x3b')]=_[_0x13b9('0x3d')](_0x23ca05[_0x13b9('0x3b')],{'$or':_[_0x13b9('0x2a')](_0x129758,function(_0x5e368f){if(_0x5e368f['type']!==_0x13b9('0x3e')){var _0xceb077={};_0xceb077[_0x5e368f[_0x13b9('0x27')]]={'$like':'%'+_0x50475e['query'][_0x13b9('0x3f')]+'%'};return _0xceb077;}})});}_0x23ca05=_['merge']({},_0x23ca05,_0x50475e['options']);var _0x28ac8b={'where':_0x23ca05[_0x13b9('0x3b')]};return db[_0x13b9('0x2b')][_0x13b9('0x1e')](_0x28ac8b)[_0x13b9('0x23')](function(_0x1bda41){_0x1115b0[_0x13b9('0x1e')]=_0x1bda41;if(_0x50475e[_0x13b9('0x2f')]['includeAll']){_0x23ca05[_0x13b9('0x40')]=[{'all':!![]}];}return db[_0x13b9('0x2b')][_0x13b9('0x41')](_0x23ca05);})[_0x13b9('0x23')](function(_0x525545){_0x1115b0[_0x13b9('0x42')]=_0x525545;return _0x1115b0;})['then'](respondWithFilteredResult(_0x1ea7a9,_0x23ca05))['catch'](handleError(_0x1ea7a9,null));};exports[_0x13b9('0x43')]=function(_0x40133d,_0x3cd504){var _0x596f42={'raw':![],'where':{'id':_0x40133d[_0x13b9('0x44')]['id']}},_0x15cb2e={};_0x15cb2e[_0x13b9('0x2e')]=_[_0x13b9('0x30')](db[_0x13b9('0x2b')]['rawAttributes']);_0x15cb2e['query']=_['keys'](_0x40133d[_0x13b9('0x2f')]);_0x15cb2e['filters']=_[_0x13b9('0x32')](_0x15cb2e[_0x13b9('0x2e')],_0x15cb2e[_0x13b9('0x2f')]);_0x596f42[_0x13b9('0x33')]=_[_0x13b9('0x32')](_0x15cb2e[_0x13b9('0x2e')],qs['fields'](_0x40133d[_0x13b9('0x2f')][_0x13b9('0x34')]));_0x596f42['attributes']=_0x596f42[_0x13b9('0x33')]['length']?_0x596f42[_0x13b9('0x33')]:_0x15cb2e[_0x13b9('0x2e')];if(_0x40133d[_0x13b9('0x2f')][_0x13b9('0x45')]){_0x596f42[_0x13b9('0x40')]=[{'all':!![]}];}_0x596f42=_['merge']({},_0x596f42,_0x40133d[_0x13b9('0x46')]);return db[_0x13b9('0x2b')]['find'](_0x596f42)[_0x13b9('0x23')](handleEntityNotFound(_0x3cd504,null))[_0x13b9('0x23')](respondWithResult(_0x3cd504,null))['catch'](handleError(_0x3cd504,null));};exports[_0x13b9('0x47')]=function(_0x887af7,_0x4fb247){return db[_0x13b9('0x2b')]['create'](_0x887af7[_0x13b9('0x48')],{})['then'](respondWithResult(_0x4fb247,0xc9))[_0x13b9('0x49')](handleError(_0x4fb247,null));};exports[_0x13b9('0x4a')]=function(_0x459a46,_0x2cfebc){if(_0x459a46[_0x13b9('0x48')]['id']){delete _0x459a46[_0x13b9('0x48')]['id'];}return db[_0x13b9('0x2b')][_0x13b9('0x4b')]({'where':{'id':_0x459a46['params']['id']}})[_0x13b9('0x23')](handleEntityNotFound(_0x2cfebc,null))[_0x13b9('0x23')](saveUpdates(_0x459a46[_0x13b9('0x48')],null))['then'](respondWithResult(_0x2cfebc,null))[_0x13b9('0x49')](handleError(_0x2cfebc,null));};exports[_0x13b9('0x24')]=function(_0x3a5c0f,_0x24e71a){return db[_0x13b9('0x2b')][_0x13b9('0x4b')]({'where':{'id':_0x3a5c0f[_0x13b9('0x44')]['id']}})['then'](handleEntityNotFound(_0x24e71a,null))['then'](removeEntity(_0x24e71a,null))[_0x13b9('0x49')](handleError(_0x24e71a,null));};exports[_0x13b9('0x4c')]=function(_0x6fad45,_0x21df4b,_0x5d4bf6){var _0x382624={};var _0x2778c1={};var _0x38b240;var _0x3788dc;return db[_0x13b9('0x2b')]['findOne']({'where':{'id':_0x6fad45[_0x13b9('0x44')]['id']}})['then'](handleEntityNotFound(_0x21df4b,null))[_0x13b9('0x23')](function(_0x19e878){if(_0x19e878){_0x38b240=_0x19e878;_0x2778c1[_0x13b9('0x2e')]=_[_0x13b9('0x30')](db[_0x13b9('0x4d')][_0x13b9('0x2c')]);_0x2778c1[_0x13b9('0x2f')]=_['keys'](_0x6fad45[_0x13b9('0x2f')]);_0x2778c1[_0x13b9('0x31')]=_[_0x13b9('0x32')](_0x2778c1[_0x13b9('0x2e')],_0x2778c1['query']);_0x382624[_0x13b9('0x33')]=_[_0x13b9('0x32')](_0x2778c1[_0x13b9('0x2e')],qs[_0x13b9('0x34')](_0x6fad45[_0x13b9('0x2f')][_0x13b9('0x34')]));_0x382624[_0x13b9('0x33')]=_0x382624[_0x13b9('0x33')]['length']?_0x382624[_0x13b9('0x33')]:_0x2778c1[_0x13b9('0x2e')];_0x382624[_0x13b9('0x39')]=qs[_0x13b9('0x3a')](_0x6fad45[_0x13b9('0x2f')]['sort']);_0x382624[_0x13b9('0x3b')]=qs[_0x13b9('0x31')](_['pick'](_0x6fad45[_0x13b9('0x2f')],_0x2778c1[_0x13b9('0x31')]));if(_0x6fad45[_0x13b9('0x2f')]['filter']){_0x382624[_0x13b9('0x3b')]=_[_0x13b9('0x3d')](_0x382624['where'],{'$or':_[_0x13b9('0x2a')](_0x382624[_0x13b9('0x33')],function(_0x48b397){var _0x20a0e1={};_0x20a0e1[_0x48b397]={'$like':'%'+_0x6fad45[_0x13b9('0x2f')][_0x13b9('0x3f')]+'%'};return _0x20a0e1;})});}_0x382624=_[_0x13b9('0x3d')]({},_0x382624,_0x6fad45[_0x13b9('0x46')]);return _0x38b240[_0x13b9('0x4c')](_0x382624);}})['then'](function(_0x461ed9){if(_0x461ed9){_0x3788dc=_0x461ed9[_0x13b9('0x35')];if(!_0x6fad45[_0x13b9('0x2f')][_0x13b9('0x36')](_0x13b9('0x37'))){_0x382624['limit']=qs['limit'](_0x6fad45[_0x13b9('0x2f')][_0x13b9('0x38')]);_0x382624[_0x13b9('0x1c')]=qs['offset'](_0x6fad45[_0x13b9('0x2f')][_0x13b9('0x1c')]);}return _0x38b240[_0x13b9('0x4c')](_0x382624);}})[_0x13b9('0x23')](function(_0x2e5aa8){if(_0x2e5aa8){return _0x2e5aa8?{'count':_0x3788dc,'rows':_0x2e5aa8}:null;}})['then'](respondWithResult(_0x21df4b,null))[_0x13b9('0x49')](handleError(_0x21df4b,null));};exports[_0x13b9('0x4e')]=function(_0x3ec226,_0x3796e8,_0x2c9dfc){var _0x3efe59={};var _0x171d5b={};var _0x112d1d;var _0x4314ed;return db[_0x13b9('0x2b')][_0x13b9('0x4f')]({'where':{'id':_0x3ec226['params']['id']}})[_0x13b9('0x23')](handleEntityNotFound(_0x3796e8,null))[_0x13b9('0x23')](function(_0x35cdd9){if(_0x35cdd9){_0x112d1d=_0x35cdd9;_0x171d5b[_0x13b9('0x2e')]=_[_0x13b9('0x30')](db[_0x13b9('0x4d')][_0x13b9('0x2c')]);_0x171d5b[_0x13b9('0x2f')]=_[_0x13b9('0x30')](_0x3ec226[_0x13b9('0x2f')]);_0x171d5b[_0x13b9('0x31')]=_[_0x13b9('0x32')](_0x171d5b['model'],_0x171d5b[_0x13b9('0x2f')]);_0x3efe59[_0x13b9('0x33')]=_[_0x13b9('0x32')](_0x171d5b[_0x13b9('0x2e')],qs[_0x13b9('0x34')](_0x3ec226[_0x13b9('0x2f')][_0x13b9('0x34')]));_0x3efe59[_0x13b9('0x33')]=_0x3efe59[_0x13b9('0x33')][_0x13b9('0x35')]?_0x3efe59[_0x13b9('0x33')]:_0x171d5b[_0x13b9('0x2e')];_0x3efe59[_0x13b9('0x39')]=qs[_0x13b9('0x3a')](_0x3ec226[_0x13b9('0x2f')][_0x13b9('0x3a')]);_0x3efe59[_0x13b9('0x3b')]=qs[_0x13b9('0x31')](_[_0x13b9('0x3c')](_0x3ec226[_0x13b9('0x2f')],_0x171d5b[_0x13b9('0x31')]));if(_0x3ec226['query'][_0x13b9('0x3f')]){_0x3efe59['where']=_['merge'](_0x3efe59['where'],{'$or':_[_0x13b9('0x2a')](_0x3efe59[_0x13b9('0x33')],function(_0x556492){var _0x3187e5={};_0x3187e5[_0x556492]={'$like':'%'+_0x3ec226['query'][_0x13b9('0x3f')]+'%'};return _0x3187e5;})});}_0x3efe59=_[_0x13b9('0x3d')]({},_0x3efe59,_0x3ec226['options']);return _0x112d1d[_0x13b9('0x4e')](_0x3efe59);}})[_0x13b9('0x23')](function(_0x219071){if(_0x219071){_0x4314ed=_0x219071['length'];if(!_0x3ec226[_0x13b9('0x2f')][_0x13b9('0x36')](_0x13b9('0x37'))){_0x3efe59[_0x13b9('0x38')]=qs['limit'](_0x3ec226[_0x13b9('0x2f')]['limit']);_0x3efe59['offset']=qs[_0x13b9('0x1c')](_0x3ec226[_0x13b9('0x2f')]['offset']);}return _0x112d1d[_0x13b9('0x4e')](_0x3efe59);}})[_0x13b9('0x23')](function(_0x2cc3c0){if(_0x2cc3c0){return _0x2cc3c0?{'count':_0x4314ed,'rows':_0x2cc3c0}:null;}})[_0x13b9('0x23')](respondWithResult(_0x3796e8,null))[_0x13b9('0x49')](handleError(_0x3796e8,null));};exports['getDescriptions']=function(_0x155e82,_0x3fcd41,_0x325beb){var _0x4a8a97={};var _0x56634b={};var _0x1590e8;var _0x11bd32;return db['DeskConfiguration'][_0x13b9('0x4f')]({'where':{'id':_0x155e82[_0x13b9('0x44')]['id']}})[_0x13b9('0x23')](handleEntityNotFound(_0x3fcd41,null))[_0x13b9('0x23')](function(_0x3d1c1e){if(_0x3d1c1e){_0x1590e8=_0x3d1c1e;_0x56634b[_0x13b9('0x2e')]=_[_0x13b9('0x30')](db[_0x13b9('0x4d')][_0x13b9('0x2c')]);_0x56634b[_0x13b9('0x2f')]=_['keys'](_0x155e82[_0x13b9('0x2f')]);_0x56634b[_0x13b9('0x31')]=_['intersection'](_0x56634b[_0x13b9('0x2e')],_0x56634b['query']);_0x4a8a97[_0x13b9('0x33')]=_[_0x13b9('0x32')](_0x56634b[_0x13b9('0x2e')],qs[_0x13b9('0x34')](_0x155e82[_0x13b9('0x2f')][_0x13b9('0x34')]));_0x4a8a97['attributes']=_0x4a8a97[_0x13b9('0x33')][_0x13b9('0x35')]?_0x4a8a97[_0x13b9('0x33')]:_0x56634b[_0x13b9('0x2e')];_0x4a8a97[_0x13b9('0x39')]=qs[_0x13b9('0x3a')](_0x155e82['query'][_0x13b9('0x3a')]);_0x4a8a97[_0x13b9('0x3b')]=qs[_0x13b9('0x31')](_['pick'](_0x155e82[_0x13b9('0x2f')],_0x56634b[_0x13b9('0x31')]));if(_0x155e82[_0x13b9('0x2f')][_0x13b9('0x3f')]){_0x4a8a97['where']=_[_0x13b9('0x3d')](_0x4a8a97[_0x13b9('0x3b')],{'$or':_[_0x13b9('0x2a')](_0x4a8a97[_0x13b9('0x33')],function(_0x5b7303){var _0x40bd7b={};_0x40bd7b[_0x5b7303]={'$like':'%'+_0x155e82[_0x13b9('0x2f')][_0x13b9('0x3f')]+'%'};return _0x40bd7b;})});}_0x4a8a97=_[_0x13b9('0x3d')]({},_0x4a8a97,_0x155e82[_0x13b9('0x46')]);return _0x1590e8[_0x13b9('0x50')](_0x4a8a97);}})[_0x13b9('0x23')](function(_0x277d14){if(_0x277d14){_0x11bd32=_0x277d14[_0x13b9('0x35')];if(!_0x155e82[_0x13b9('0x2f')]['hasOwnProperty'](_0x13b9('0x37'))){_0x4a8a97[_0x13b9('0x38')]=qs[_0x13b9('0x38')](_0x155e82[_0x13b9('0x2f')][_0x13b9('0x38')]);_0x4a8a97[_0x13b9('0x1c')]=qs[_0x13b9('0x1c')](_0x155e82[_0x13b9('0x2f')]['offset']);}return _0x1590e8['getDescriptions'](_0x4a8a97);}})['then'](function(_0x262a89){if(_0x262a89){return _0x262a89?{'count':_0x11bd32,'rows':_0x262a89}:null;}})[_0x13b9('0x23')](respondWithResult(_0x3fcd41,null))[_0x13b9('0x49')](handleError(_0x3fcd41,null));};exports[_0x13b9('0x51')]=function(_0x1af1f3,_0x5e2738,_0xda84d8){var _0xa26561={};var _0x385e73={};var _0x135d47;var _0x4f7f26;return db[_0x13b9('0x2b')]['findOne']({'where':{'id':_0x1af1f3['params']['id']}})[_0x13b9('0x23')](handleEntityNotFound(_0x5e2738,null))[_0x13b9('0x23')](function(_0x1edede){if(_0x1edede){_0x135d47=_0x1edede;_0x385e73[_0x13b9('0x2e')]=_['keys'](db['Tag'][_0x13b9('0x2c')]);_0x385e73[_0x13b9('0x2f')]=_[_0x13b9('0x30')](_0x1af1f3[_0x13b9('0x2f')]);_0x385e73[_0x13b9('0x31')]=_[_0x13b9('0x32')](_0x385e73[_0x13b9('0x2e')],_0x385e73[_0x13b9('0x2f')]);_0xa26561[_0x13b9('0x33')]=_[_0x13b9('0x32')](_0x385e73['model'],qs['fields'](_0x1af1f3[_0x13b9('0x2f')]['fields']));_0xa26561[_0x13b9('0x33')]=_0xa26561['attributes']['length']?_0xa26561['attributes']:_0x385e73['model'];_0xa26561[_0x13b9('0x39')]=qs[_0x13b9('0x3a')](_0x1af1f3[_0x13b9('0x2f')][_0x13b9('0x3a')]);_0xa26561['where']=qs[_0x13b9('0x31')](_[_0x13b9('0x3c')](_0x1af1f3[_0x13b9('0x2f')],_0x385e73[_0x13b9('0x31')]));if(_0x1af1f3[_0x13b9('0x2f')][_0x13b9('0x3f')]){_0xa26561[_0x13b9('0x3b')]=_['merge'](_0xa26561[_0x13b9('0x3b')],{'$or':_[_0x13b9('0x2a')](_0xa26561['attributes'],function(_0x4d2635){var _0x40cd14={};_0x40cd14[_0x4d2635]={'$like':'%'+_0x1af1f3[_0x13b9('0x2f')][_0x13b9('0x3f')]+'%'};return _0x40cd14;})});}_0xa26561=_[_0x13b9('0x3d')]({},_0xa26561,_0x1af1f3['options']);return _0x135d47[_0x13b9('0x51')](_0xa26561);}})['then'](function(_0x4f9476){if(_0x4f9476){_0x4f7f26=_0x4f9476[_0x13b9('0x35')];if(!_0x1af1f3[_0x13b9('0x2f')][_0x13b9('0x36')](_0x13b9('0x37'))){_0xa26561['limit']=qs[_0x13b9('0x38')](_0x1af1f3[_0x13b9('0x2f')][_0x13b9('0x38')]);_0xa26561[_0x13b9('0x1c')]=qs['offset'](_0x1af1f3['query'][_0x13b9('0x1c')]);}return _0x135d47[_0x13b9('0x51')](_0xa26561);}})[_0x13b9('0x23')](function(_0x2e1633){if(_0x2e1633){return _0x2e1633?{'count':_0x4f7f26,'rows':_0x2e1633}:null;}})['then'](respondWithResult(_0x5e2738,null))[_0x13b9('0x49')](handleError(_0x5e2738,null));};exports['setTags']=function(_0x23bc92,_0x2b2e94,_0x2f0cf3){if(_0x23bc92[_0x13b9('0x48')]['id']){delete _0x23bc92[_0x13b9('0x48')]['id'];}return db[_0x13b9('0x2b')][_0x13b9('0x4f')]({'where':{'id':_0x23bc92[_0x13b9('0x44')]['id']}})[_0x13b9('0x23')](handleEntityNotFound(_0x2b2e94,null))[_0x13b9('0x23')](function(_0x150fa5){if(_0x150fa5){return _0x150fa5[_0x13b9('0x52')](_0x23bc92[_0x13b9('0x48')][_0x13b9('0x53')]||[]);}return null;})[_0x13b9('0x23')](respondWithResult(_0x2b2e94,null))[_0x13b9('0x49')](handleError(_0x2b2e94,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index 456a660..8238faf 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 _0x96cf=['util','api','bluebird','path','./intDeskConfiguration.attributes','exports','define','DeskConfiguration','int_desk_configurations','lodash'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x96cf,0xdb));var _0xf96c=function(_0xf9cff4,_0x3158ce){_0xf9cff4=_0xf9cff4-0x0;var _0x1b0a0a=_0x96cf[_0xf9cff4];return _0x1b0a0a;};'use strict';var _=require(_0xf96c('0x0'));var util=require(_0xf96c('0x1'));var logger=require('../../config/logger')(_0xf96c('0x2'));var moment=require('moment');var BPromise=require(_0xf96c('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf96c('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xf96c('0x5'));module[_0xf96c('0x6')]=function(_0x46dab3,_0x45eed7){return _0x46dab3[_0xf96c('0x7')](_0xf96c('0x8'),attributes,{'tableName':_0xf96c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2dd1=['exports','define','DeskConfiguration','int_desk_configurations','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./intDeskConfiguration.attributes'];(function(_0xc77819,_0x139fdc){var _0x1c9434=function(_0x11d15d){while(--_0x11d15d){_0xc77819['push'](_0xc77819['shift']());}};_0x1c9434(++_0x139fdc);}(_0x2dd1,0x18c));var _0x12dd=function(_0x274a3d,_0x5dfb7f){_0x274a3d=_0x274a3d-0x0;var _0x3a7aac=_0x2dd1[_0x274a3d];return _0x3a7aac;};'use strict';var _=require(_0x12dd('0x0'));var util=require(_0x12dd('0x1'));var logger=require(_0x12dd('0x2'))(_0x12dd('0x3'));var moment=require(_0x12dd('0x4'));var BPromise=require(_0x12dd('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x12dd('0x6'));var rimraf=require(_0x12dd('0x7'));var config=require(_0x12dd('0x8'));var attributes=require(_0x12dd('0x9'));module[_0x12dd('0xa')]=function(_0x42f4a0,_0x5bcb6e){return _0x42f4a0[_0x12dd('0xb')](_0x12dd('0xc'),attributes,{'tableName':_0x12dd('0xd'),'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 4509854..18a5fb4 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 _0xfdb5=['message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','then','info','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','DeskConfiguration,\x20%s,\x20%s'];(function(_0x5123bb,_0x50e6d1){var _0x166fda=function(_0x3e03e2){while(--_0x3e03e2){_0x5123bb['push'](_0x5123bb['shift']());}};_0x166fda(++_0x50e6d1);}(_0xfdb5,0x18f));var _0x5fdb=function(_0x476bf4,_0x2a3755){_0x476bf4=_0x476bf4-0x0;var _0x788ffe=_0xfdb5[_0x476bf4];return _0x788ffe;};'use strict';var _=require(_0x5fdb('0x0'));var util=require('util');var moment=require(_0x5fdb('0x1'));var BPromise=require(_0x5fdb('0x2'));var rs=require(_0x5fdb('0x3'));var fs=require('fs');var Redis=require(_0x5fdb('0x4'));var db=require(_0x5fdb('0x5'))['db'];var utils=require(_0x5fdb('0x6'));var logger=require(_0x5fdb('0x7'))(_0x5fdb('0x8'));var config=require('../../config/environment');var jayson=require(_0x5fdb('0x9'));var client=jayson['client'][_0x5fdb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x378c45,_0x465fbc,_0x2b5dbf){return new BPromise(function(_0x591cb2,_0xb82680){return client['request'](_0x378c45,_0x2b5dbf)[_0x5fdb('0xb')](function(_0x1cd059){logger[_0x5fdb('0xc')]('DeskConfiguration,\x20%s,\x20%s',_0x465fbc,_0x5fdb('0xd'));logger[_0x5fdb('0xe')](_0x5fdb('0xf'),_0x465fbc,'request\x20sent',JSON['stringify'](_0x1cd059));if(_0x1cd059[_0x5fdb('0x10')]){if(_0x1cd059[_0x5fdb('0x10')][_0x5fdb('0x11')]===0x1f4){logger[_0x5fdb('0x10')](_0x5fdb('0x12'),_0x465fbc,_0x1cd059[_0x5fdb('0x10')]['message']);return _0xb82680(_0x1cd059[_0x5fdb('0x10')][_0x5fdb('0x13')]);}logger[_0x5fdb('0x10')](_0x5fdb('0x12'),_0x465fbc,_0x1cd059[_0x5fdb('0x10')]['message']);return _0x591cb2(_0x1cd059[_0x5fdb('0x10')][_0x5fdb('0x13')]);}else{logger['info'](_0x5fdb('0x12'),_0x465fbc,_0x5fdb('0xd'));_0x591cb2(_0x1cd059[_0x5fdb('0x14')][_0x5fdb('0x13')]);}})[_0x5fdb('0x15')](function(_0x955a8c){logger['error']('DeskConfiguration,\x20%s,\x20%s',_0x465fbc,_0x955a8c);_0xb82680(_0x955a8c);});});} \ No newline at end of file +var _0xddd1=['http','request','DeskConfiguration,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0xd1c39b,_0x16f0c6){var _0x58f5bc=function(_0x412cf3){while(--_0x412cf3){_0xd1c39b['push'](_0xd1c39b['shift']());}};_0x58f5bc(++_0x16f0c6);}(_0xddd1,0xab));var _0x1ddd=function(_0x273ac1,_0x307b37){_0x273ac1=_0x273ac1-0x0;var _0x9e278d=_0xddd1[_0x273ac1];return _0x9e278d;};'use strict';var _=require('lodash');var util=require(_0x1ddd('0x0'));var moment=require(_0x1ddd('0x1'));var BPromise=require(_0x1ddd('0x2'));var rs=require(_0x1ddd('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x1ddd('0x4'));var logger=require(_0x1ddd('0x5'))('rpc');var config=require(_0x1ddd('0x6'));var jayson=require(_0x1ddd('0x7'));var client=jayson[_0x1ddd('0x8')][_0x1ddd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3bc2bd,_0x3fe670,_0x17a8d4){return new BPromise(function(_0x325590,_0x32aadc){return client[_0x1ddd('0xa')](_0x3bc2bd,_0x17a8d4)['then'](function(_0x3add38){logger['info'](_0x1ddd('0xb'),_0x3fe670,_0x1ddd('0xc'));logger['debug']('DeskConfiguration,\x20%s,\x20%s,\x20%s',_0x3fe670,_0x1ddd('0xc'),JSON['stringify'](_0x3add38));if(_0x3add38[_0x1ddd('0xd')]){if(_0x3add38[_0x1ddd('0xd')][_0x1ddd('0xe')]===0x1f4){logger[_0x1ddd('0xd')]('DeskConfiguration,\x20%s,\x20%s',_0x3fe670,_0x3add38['error'][_0x1ddd('0xf')]);return _0x32aadc(_0x3add38[_0x1ddd('0xd')][_0x1ddd('0xf')]);}logger[_0x1ddd('0xd')](_0x1ddd('0xb'),_0x3fe670,_0x3add38['error'][_0x1ddd('0xf')]);return _0x325590(_0x3add38[_0x1ddd('0xd')]['message']);}else{logger[_0x1ddd('0x10')](_0x1ddd('0xb'),_0x3fe670,'request\x20sent');_0x325590(_0x3add38[_0x1ddd('0x11')][_0x1ddd('0xf')]);}})['catch'](function(_0x74eebe){logger[_0x1ddd('0xd')](_0x1ddd('0xb'),_0x3fe670,_0x74eebe);_0x32aadc(_0x74eebe);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index 79febbd..2594e92 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 _0x07c9=['put','update','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskField.controller','get','isAuthenticated','/:id','post','create'];(function(_0xd9c529,_0x19f8cc){var _0x146760=function(_0x1aa5e8){while(--_0x1aa5e8){_0xd9c529['push'](_0xd9c529['shift']());}};_0x146760(++_0x19f8cc);}(_0x07c9,0x6f));var _0x907c=function(_0x545a65,_0x50eeac){_0x545a65=_0x545a65-0x0;var _0x57dddb=_0x07c9[_0x545a65];return _0x57dddb;};'use strict';var multer=require(_0x907c('0x0'));var util=require(_0x907c('0x1'));var path=require('path');var timeout=require(_0x907c('0x2'));var express=require(_0x907c('0x3'));var router=express[_0x907c('0x4')]();var fs_extra=require(_0x907c('0x5'));var auth=require(_0x907c('0x6'));var interaction=require(_0x907c('0x7'));var config=require(_0x907c('0x8'));var controller=require(_0x907c('0x9'));router[_0x907c('0xa')]('/',auth[_0x907c('0xb')](),controller['index']);router[_0x907c('0xa')](_0x907c('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x907c('0xd')]('/',auth[_0x907c('0xb')](),controller[_0x907c('0xe')]);router[_0x907c('0xf')](_0x907c('0xc'),auth[_0x907c('0xb')](),controller[_0x907c('0x10')]);router['delete']('/:id',auth[_0x907c('0xb')](),controller['destroy']);module[_0x907c('0x11')]=router; \ No newline at end of file +var _0x11c8=['destroy','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','put','update','delete'];(function(_0x477d1f,_0x15c01b){var _0x49a8ee=function(_0x587a02){while(--_0x587a02){_0x477d1f['push'](_0x477d1f['shift']());}};_0x49a8ee(++_0x15c01b);}(_0x11c8,0x19a));var _0x811c=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x11c8[_0x126558];return _0x1f6d14;};'use strict';var multer=require('multer');var util=require(_0x811c('0x0'));var path=require(_0x811c('0x1'));var timeout=require('connect-timeout');var express=require(_0x811c('0x2'));var router=express[_0x811c('0x3')]();var fs_extra=require(_0x811c('0x4'));var auth=require(_0x811c('0x5'));var interaction=require(_0x811c('0x6'));var config=require(_0x811c('0x7'));var controller=require('./intDeskField.controller');router[_0x811c('0x8')]('/',auth[_0x811c('0x9')](),controller['index']);router[_0x811c('0x8')](_0x811c('0xa'),auth[_0x811c('0x9')](),controller[_0x811c('0xb')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x811c('0xc')]('/:id',auth['isAuthenticated'](),controller[_0x811c('0xd')]);router[_0x811c('0xe')]('/:id',auth[_0x811c('0x9')](),controller[_0x811c('0xf')]);module[_0x811c('0x10')]=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index bee48d0..c7b6c04 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 _0x56ce=['STRING','ENUM','string','BOOLEAN','sequelize','exports','variable','customVariable','keyValue','picklist'];(function(_0x18a378,_0x46dc75){var _0x23760a=function(_0x7ed1f3){while(--_0x7ed1f3){_0x18a378['push'](_0x18a378['shift']());}};_0x23760a(++_0x46dc75);}(_0x56ce,0x194));var _0xe56c=function(_0x42bdb9,_0x1a4dc2){_0x42bdb9=_0x42bdb9-0x0;var _0x157a65=_0x56ce[_0x42bdb9];return _0x157a65;};'use strict';var Sequelize=require(_0xe56c('0x0'));module[_0xe56c('0x1')]={'type':{'type':Sequelize['ENUM']('string',_0xe56c('0x2'),_0xe56c('0x3'),_0xe56c('0x4'),_0xe56c('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0xe56c('0x6')]},'key':{'type':Sequelize[_0xe56c('0x6')]},'keyType':{'type':Sequelize[_0xe56c('0x7')](_0xe56c('0x8'),_0xe56c('0x2'),_0xe56c('0x3'))},'keyContent':{'type':Sequelize[_0xe56c('0x6')]},'idField':{'type':Sequelize[_0xe56c('0x6')]},'nameField':{'type':Sequelize[_0xe56c('0x6')]},'customField':{'type':Sequelize[_0xe56c('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x429a=['variable','customVariable','picklist','STRING','BOOLEAN','sequelize','ENUM','string'];(function(_0x36f41d,_0x2ed560){var _0x48347f=function(_0x153227){while(--_0x153227){_0x36f41d['push'](_0x36f41d['shift']());}};_0x48347f(++_0x2ed560);}(_0x429a,0x10d));var _0xa429=function(_0x1e3c02,_0x5c07a2){_0x1e3c02=_0x1e3c02-0x0;var _0x4d26d7=_0x429a[_0x1e3c02];return _0x4d26d7;};'use strict';var Sequelize=require(_0xa429('0x0'));module['exports']={'type':{'type':Sequelize[_0xa429('0x1')](_0xa429('0x2'),_0xa429('0x3'),_0xa429('0x4'),'keyValue',_0xa429('0x5')),'defaultValue':_0xa429('0x2')},'content':{'type':Sequelize[_0xa429('0x6')]},'key':{'type':Sequelize[_0xa429('0x6')]},'keyType':{'type':Sequelize[_0xa429('0x1')](_0xa429('0x2'),_0xa429('0x3'),_0xa429('0x4'))},'keyContent':{'type':Sequelize[_0xa429('0x6')]},'idField':{'type':Sequelize[_0xa429('0x6')]},'nameField':{'type':Sequelize[_0xa429('0x6')]},'customField':{'type':Sequelize[_0xa429('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index 691bfba..b60730a 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 _0xfef9=['moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','offset','undefined','count','limit','Content-Range','reject','save','update','destroy','end','error','name','send','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','DeskField','then','include','findAll','rows','rawAttributes','find','catch','create','body','params','eml-format','zip-dir','fast-json-patch'];(function(_0x56ee67,_0x237415){var _0x37eb77=function(_0x314b32){while(--_0x314b32){_0x56ee67['push'](_0x56ee67['shift']());}};_0x37eb77(++_0x237415);}(_0xfef9,0xcc));var _0x9fef=function(_0x36bc58,_0x27f03c){_0x36bc58=_0x36bc58-0x0;var _0x4a547e=_0xfef9[_0x36bc58];return _0x4a547e;};'use strict';var emlformat=require(_0x9fef('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9fef('0x1'));var jsonpatch=require(_0x9fef('0x2'));var rp=require('request-promise');var moment=require(_0x9fef('0x3'));var BPromise=require(_0x9fef('0x4'));var Mustache=require(_0x9fef('0x5'));var util=require(_0x9fef('0x6'));var path=require(_0x9fef('0x7'));var sox=require(_0x9fef('0x8'));var csv=require(_0x9fef('0x9'));var ejs=require(_0x9fef('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9fef('0xb'));var squel=require(_0x9fef('0xc'));var crypto=require(_0x9fef('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x9fef('0xe'));var toCsv=require(_0x9fef('0x9'));var querystring=require(_0x9fef('0xf'));var Papa=require(_0x9fef('0x10'));var Redis=require(_0x9fef('0x11'));var authService=require(_0x9fef('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x9fef('0x13'));var hardwareService=require(_0x9fef('0x14'));var logger=require('../../config/logger')(_0x9fef('0x15'));var utils=require(_0x9fef('0x16'));var config=require(_0x9fef('0x17'));var licenseUtil=require(_0x9fef('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x523338,_0x46bddd){_0x46bddd=_0x46bddd||0xcc;return function(_0x5dc912){if(_0x5dc912){return _0x523338[_0x9fef('0x19')](_0x46bddd);}return _0x523338[_0x9fef('0x1a')](_0x46bddd)['end']();};}function respondWithResult(_0x32df04,_0x99232a){_0x99232a=_0x99232a||0xc8;return function(_0x56bf4c){if(_0x56bf4c){return _0x32df04['status'](_0x99232a)['json'](_0x56bf4c);}};}function respondWithFilteredResult(_0x2ac9ac,_0x5588f0){return function(_0x174119){if(_0x174119){var _0x5b4fdc=typeof _0x5588f0[_0x9fef('0x1b')]===_0x9fef('0x1c')&&typeof _0x5588f0['limit']===_0x9fef('0x1c');var _0x4c4638=_0x174119[_0x9fef('0x1d')];var _0xa2cd58=_0x5b4fdc?0x0:_0x5588f0['offset'];var _0x4e3f2b=_0x5b4fdc?_0x174119[_0x9fef('0x1d')]:_0x5588f0[_0x9fef('0x1b')]+_0x5588f0[_0x9fef('0x1e')];var _0x34e4f6;if(_0x4e3f2b>=_0x4c4638){_0x4e3f2b=_0x4c4638;_0x34e4f6=0xc8;}else{_0x34e4f6=0xce;}_0x2ac9ac['status'](_0x34e4f6);return _0x2ac9ac['set'](_0x9fef('0x1f'),_0xa2cd58+'-'+_0x4e3f2b+'/'+_0x4c4638)['json'](_0x174119);}return null;};}function patchUpdates(_0x5779c8){return function(_0x5f5633){try{jsonpatch['apply'](_0x5f5633,_0x5779c8,!![]);}catch(_0x422457){return BPromise[_0x9fef('0x20')](_0x422457);}return _0x5f5633[_0x9fef('0x21')]();};}function saveUpdates(_0x373670,_0x3be60e){return function(_0x532dcb){if(_0x532dcb){return _0x532dcb[_0x9fef('0x22')](_0x373670)['then'](function(_0x28cff0){return _0x28cff0;});}return null;};}function removeEntity(_0x217afa,_0x109b47){return function(_0x57b1f9){if(_0x57b1f9){return _0x57b1f9[_0x9fef('0x23')]()['then'](function(){_0x217afa[_0x9fef('0x1a')](0xcc)[_0x9fef('0x24')]();});}};}function handleEntityNotFound(_0x2edd84,_0x341cc5){return function(_0x34982b){if(!_0x34982b){_0x2edd84[_0x9fef('0x19')](0x194);}return _0x34982b;};}function handleError(_0x592421,_0x45d4a0){_0x45d4a0=_0x45d4a0||0x1f4;return function(_0x175a7a){logger[_0x9fef('0x25')](_0x175a7a['stack']);if(_0x175a7a[_0x9fef('0x26')]){delete _0x175a7a['name'];}_0x592421[_0x9fef('0x1a')](_0x45d4a0)[_0x9fef('0x27')](_0x175a7a);};}exports['index']=function(_0x199e25,_0xc47713){var _0xd673c5={},_0x4c5f57={},_0x3f6ee5={'count':0x0,'rows':[]};var _0x287fdd=_['map'](db['DeskField']['rawAttributes'],function(_0x2e0f4a){return{'name':_0x2e0f4a['fieldName'],'type':_0x2e0f4a[_0x9fef('0x28')][_0x9fef('0x29')]};});_0x4c5f57['model']=_['map'](_0x287fdd,_0x9fef('0x26'));_0x4c5f57[_0x9fef('0x2a')]=_[_0x9fef('0x2b')](_0x199e25[_0x9fef('0x2a')]);_0x4c5f57[_0x9fef('0x2c')]=_[_0x9fef('0x2d')](_0x4c5f57[_0x9fef('0x2e')],_0x4c5f57[_0x9fef('0x2a')]);_0xd673c5['attributes']=_[_0x9fef('0x2d')](_0x4c5f57['model'],qs[_0x9fef('0x2f')](_0x199e25[_0x9fef('0x2a')][_0x9fef('0x2f')]));_0xd673c5['attributes']=_0xd673c5[_0x9fef('0x30')][_0x9fef('0x31')]?_0xd673c5[_0x9fef('0x30')]:_0x4c5f57[_0x9fef('0x2e')];if(!_0x199e25[_0x9fef('0x2a')][_0x9fef('0x32')](_0x9fef('0x33'))){_0xd673c5[_0x9fef('0x1e')]=qs[_0x9fef('0x1e')](_0x199e25[_0x9fef('0x2a')]['limit']);_0xd673c5[_0x9fef('0x1b')]=qs['offset'](_0x199e25[_0x9fef('0x2a')][_0x9fef('0x1b')]);}_0xd673c5[_0x9fef('0x34')]=qs[_0x9fef('0x35')](_0x199e25[_0x9fef('0x2a')][_0x9fef('0x35')]);_0xd673c5['where']=qs[_0x9fef('0x2c')](_['pick'](_0x199e25[_0x9fef('0x2a')],_0x4c5f57['filters']),_0x287fdd);if(_0x199e25[_0x9fef('0x2a')][_0x9fef('0x36')]){_0xd673c5[_0x9fef('0x37')]=_[_0x9fef('0x38')](_0xd673c5[_0x9fef('0x37')],{'$or':_['map'](_0x287fdd,function(_0x3a3aba){if(_0x3a3aba[_0x9fef('0x28')]!==_0x9fef('0x39')){var _0x344cdf={};_0x344cdf[_0x3a3aba[_0x9fef('0x26')]]={'$like':'%'+_0x199e25[_0x9fef('0x2a')]['filter']+'%'};return _0x344cdf;}})});}_0xd673c5=_[_0x9fef('0x38')]({},_0xd673c5,_0x199e25['options']);var _0x3a61c6={'where':_0xd673c5[_0x9fef('0x37')]};return db[_0x9fef('0x3a')][_0x9fef('0x1d')](_0x3a61c6)[_0x9fef('0x3b')](function(_0x3744ce){_0x3f6ee5[_0x9fef('0x1d')]=_0x3744ce;if(_0x199e25[_0x9fef('0x2a')]['includeAll']){_0xd673c5[_0x9fef('0x3c')]=[{'all':!![]}];}return db['DeskField'][_0x9fef('0x3d')](_0xd673c5);})['then'](function(_0x552621){_0x3f6ee5[_0x9fef('0x3e')]=_0x552621;return _0x3f6ee5;})[_0x9fef('0x3b')](respondWithFilteredResult(_0xc47713,_0xd673c5))['catch'](handleError(_0xc47713,null));};exports['show']=function(_0x489cc1,_0x3b0252){var _0x458ff3={'raw':!![],'where':{'id':_0x489cc1['params']['id']}},_0x406313={};_0x406313[_0x9fef('0x2e')]=_[_0x9fef('0x2b')](db['DeskField'][_0x9fef('0x3f')]);_0x406313['query']=_['keys'](_0x489cc1['query']);_0x406313['filters']=_[_0x9fef('0x2d')](_0x406313[_0x9fef('0x2e')],_0x406313[_0x9fef('0x2a')]);_0x458ff3[_0x9fef('0x30')]=_[_0x9fef('0x2d')](_0x406313[_0x9fef('0x2e')],qs[_0x9fef('0x2f')](_0x489cc1[_0x9fef('0x2a')][_0x9fef('0x2f')]));_0x458ff3['attributes']=_0x458ff3[_0x9fef('0x30')]['length']?_0x458ff3[_0x9fef('0x30')]:_0x406313[_0x9fef('0x2e')];if(_0x489cc1[_0x9fef('0x2a')]['includeAll']){_0x458ff3[_0x9fef('0x3c')]=[{'all':!![]}];}_0x458ff3=_['merge']({},_0x458ff3,_0x489cc1['options']);return db[_0x9fef('0x3a')][_0x9fef('0x40')](_0x458ff3)[_0x9fef('0x3b')](handleEntityNotFound(_0x3b0252,null))['then'](respondWithResult(_0x3b0252,null))[_0x9fef('0x41')](handleError(_0x3b0252,null));};exports['create']=function(_0x252ae9,_0x415285){return db['DeskField'][_0x9fef('0x42')](_0x252ae9[_0x9fef('0x43')],{})[_0x9fef('0x3b')](respondWithResult(_0x415285,0xc9))[_0x9fef('0x41')](handleError(_0x415285,null));};exports[_0x9fef('0x22')]=function(_0x16bc30,_0x41edc8){if(_0x16bc30[_0x9fef('0x43')]['id']){delete _0x16bc30[_0x9fef('0x43')]['id'];}return db[_0x9fef('0x3a')][_0x9fef('0x40')]({'where':{'id':_0x16bc30[_0x9fef('0x44')]['id']}})[_0x9fef('0x3b')](handleEntityNotFound(_0x41edc8,null))['then'](saveUpdates(_0x16bc30[_0x9fef('0x43')],null))[_0x9fef('0x3b')](respondWithResult(_0x41edc8,null))[_0x9fef('0x41')](handleError(_0x41edc8,null));};exports[_0x9fef('0x23')]=function(_0x4f31c2,_0x331369){return db['DeskField']['find']({'where':{'id':_0x4f31c2[_0x9fef('0x44')]['id']}})[_0x9fef('0x3b')](handleEntityNotFound(_0x331369,null))['then'](removeEntity(_0x331369,null))[_0x9fef('0x41')](handleError(_0x331369,null));}; \ No newline at end of file +var _0x2876=['body','eml-format','rimraf','zip-dir','fast-json-patch','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','DeskField','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','catch','params','keys','length','find','create'];(function(_0x39d885,_0x375c3d){var _0x1251ee=function(_0x3e8703){while(--_0x3e8703){_0x39d885['push'](_0x39d885['shift']());}};_0x1251ee(++_0x375c3d);}(_0x2876,0x91));var _0x6287=function(_0x3176d6,_0x27ef13){_0x3176d6=_0x3176d6-0x0;var _0x4ec505=_0x2876[_0x3176d6];return _0x4ec505;};'use strict';var emlformat=require(_0x6287('0x0'));var rimraf=require(_0x6287('0x1'));var zipdir=require(_0x6287('0x2'));var jsonpatch=require(_0x6287('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x6287('0x4'));var util=require(_0x6287('0x5'));var path=require(_0x6287('0x6'));var sox=require(_0x6287('0x7'));var csv=require('to-csv');var ejs=require(_0x6287('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6287('0x9'));var squel=require(_0x6287('0xa'));var crypto=require(_0x6287('0xb'));var jsforce=require(_0x6287('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x6287('0xd'));var querystring=require(_0x6287('0xe'));var Papa=require(_0x6287('0xf'));var Redis=require('ioredis');var authService=require(_0x6287('0x10'));var qs=require(_0x6287('0x11'));var as=require(_0x6287('0x12'));var hardwareService=require(_0x6287('0x13'));var logger=require('../../config/logger')(_0x6287('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x6287('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3f35d1,_0x5c448e){_0x5c448e=_0x5c448e||0xcc;return function(_0x36ed0e){if(_0x36ed0e){return _0x3f35d1[_0x6287('0x16')](_0x5c448e);}return _0x3f35d1[_0x6287('0x17')](_0x5c448e)[_0x6287('0x18')]();};}function respondWithResult(_0x469510,_0x14554f){_0x14554f=_0x14554f||0xc8;return function(_0x532ef0){if(_0x532ef0){return _0x469510[_0x6287('0x17')](_0x14554f)[_0x6287('0x19')](_0x532ef0);}};}function respondWithFilteredResult(_0x5e18d4,_0x5bf662){return function(_0x5a8b13){if(_0x5a8b13){var _0x356562=typeof _0x5bf662['offset']===_0x6287('0x1a')&&typeof _0x5bf662[_0x6287('0x1b')]==='undefined';var _0x26ff47=_0x5a8b13['count'];var _0x10797c=_0x356562?0x0:_0x5bf662[_0x6287('0x1c')];var _0x2d2fe3=_0x356562?_0x5a8b13[_0x6287('0x1d')]:_0x5bf662[_0x6287('0x1c')]+_0x5bf662[_0x6287('0x1b')];var _0x39a7ed;if(_0x2d2fe3>=_0x26ff47){_0x2d2fe3=_0x26ff47;_0x39a7ed=0xc8;}else{_0x39a7ed=0xce;}_0x5e18d4[_0x6287('0x17')](_0x39a7ed);return _0x5e18d4[_0x6287('0x1e')](_0x6287('0x1f'),_0x10797c+'-'+_0x2d2fe3+'/'+_0x26ff47)[_0x6287('0x19')](_0x5a8b13);}return null;};}function patchUpdates(_0x2d14f1){return function(_0x1bda0b){try{jsonpatch[_0x6287('0x20')](_0x1bda0b,_0x2d14f1,!![]);}catch(_0x55b98d){return BPromise[_0x6287('0x21')](_0x55b98d);}return _0x1bda0b[_0x6287('0x22')]();};}function saveUpdates(_0x53d619,_0x766ef9){return function(_0x59e341){if(_0x59e341){return _0x59e341[_0x6287('0x23')](_0x53d619)['then'](function(_0x12c4b8){return _0x12c4b8;});}return null;};}function removeEntity(_0x58f5f6,_0x27f3bb){return function(_0xcf59cc){if(_0xcf59cc){return _0xcf59cc['destroy']()[_0x6287('0x24')](function(){_0x58f5f6[_0x6287('0x17')](0xcc)[_0x6287('0x18')]();});}};}function handleEntityNotFound(_0x59b75d,_0x42d96c){return function(_0x375bf6){if(!_0x375bf6){_0x59b75d[_0x6287('0x16')](0x194);}return _0x375bf6;};}function handleError(_0x50438b,_0x492e1b){_0x492e1b=_0x492e1b||0x1f4;return function(_0x960adb){logger[_0x6287('0x25')](_0x960adb[_0x6287('0x26')]);if(_0x960adb[_0x6287('0x27')]){delete _0x960adb[_0x6287('0x27')];}_0x50438b['status'](_0x492e1b)[_0x6287('0x28')](_0x960adb);};}exports['index']=function(_0x41458b,_0x16e5ce){var _0x22d9b5={},_0x5d41fa={},_0x166669={'count':0x0,'rows':[]};var _0x3ca8a0=_['map'](db[_0x6287('0x29')][_0x6287('0x2a')],function(_0x574c4b){return{'name':_0x574c4b[_0x6287('0x2b')],'type':_0x574c4b[_0x6287('0x2c')][_0x6287('0x2d')]};});_0x5d41fa[_0x6287('0x2e')]=_[_0x6287('0x2f')](_0x3ca8a0,_0x6287('0x27'));_0x5d41fa[_0x6287('0x30')]=_['keys'](_0x41458b['query']);_0x5d41fa[_0x6287('0x31')]=_[_0x6287('0x32')](_0x5d41fa[_0x6287('0x2e')],_0x5d41fa[_0x6287('0x30')]);_0x22d9b5[_0x6287('0x33')]=_[_0x6287('0x32')](_0x5d41fa[_0x6287('0x2e')],qs[_0x6287('0x34')](_0x41458b['query'][_0x6287('0x34')]));_0x22d9b5[_0x6287('0x33')]=_0x22d9b5[_0x6287('0x33')]['length']?_0x22d9b5[_0x6287('0x33')]:_0x5d41fa['model'];if(!_0x41458b[_0x6287('0x30')][_0x6287('0x35')]('nolimit')){_0x22d9b5['limit']=qs['limit'](_0x41458b[_0x6287('0x30')]['limit']);_0x22d9b5[_0x6287('0x1c')]=qs[_0x6287('0x1c')](_0x41458b[_0x6287('0x30')][_0x6287('0x1c')]);}_0x22d9b5['order']=qs[_0x6287('0x36')](_0x41458b['query'][_0x6287('0x36')]);_0x22d9b5[_0x6287('0x37')]=qs[_0x6287('0x31')](_[_0x6287('0x38')](_0x41458b[_0x6287('0x30')],_0x5d41fa[_0x6287('0x31')]),_0x3ca8a0);if(_0x41458b[_0x6287('0x30')]['filter']){_0x22d9b5[_0x6287('0x37')]=_['merge'](_0x22d9b5[_0x6287('0x37')],{'$or':_['map'](_0x3ca8a0,function(_0x3e33ef){if(_0x3e33ef[_0x6287('0x2c')]!==_0x6287('0x39')){var _0x4f3799={};_0x4f3799[_0x3e33ef[_0x6287('0x27')]]={'$like':'%'+_0x41458b['query'][_0x6287('0x3a')]+'%'};return _0x4f3799;}})});}_0x22d9b5=_[_0x6287('0x3b')]({},_0x22d9b5,_0x41458b[_0x6287('0x3c')]);var _0x46f973={'where':_0x22d9b5[_0x6287('0x37')]};return db[_0x6287('0x29')][_0x6287('0x1d')](_0x46f973)[_0x6287('0x24')](function(_0x27549e){_0x166669['count']=_0x27549e;if(_0x41458b[_0x6287('0x30')][_0x6287('0x3d')]){_0x22d9b5[_0x6287('0x3e')]=[{'all':!![]}];}return db[_0x6287('0x29')][_0x6287('0x3f')](_0x22d9b5);})['then'](function(_0x41377e){_0x166669[_0x6287('0x40')]=_0x41377e;return _0x166669;})[_0x6287('0x24')](respondWithFilteredResult(_0x16e5ce,_0x22d9b5))[_0x6287('0x41')](handleError(_0x16e5ce,null));};exports['show']=function(_0x31e8d3,_0x343fda){var _0x4c25fa={'raw':!![],'where':{'id':_0x31e8d3[_0x6287('0x42')]['id']}},_0xa2e8c1={};_0xa2e8c1[_0x6287('0x2e')]=_[_0x6287('0x43')](db[_0x6287('0x29')][_0x6287('0x2a')]);_0xa2e8c1['query']=_[_0x6287('0x43')](_0x31e8d3[_0x6287('0x30')]);_0xa2e8c1[_0x6287('0x31')]=_['intersection'](_0xa2e8c1[_0x6287('0x2e')],_0xa2e8c1[_0x6287('0x30')]);_0x4c25fa[_0x6287('0x33')]=_[_0x6287('0x32')](_0xa2e8c1[_0x6287('0x2e')],qs[_0x6287('0x34')](_0x31e8d3[_0x6287('0x30')][_0x6287('0x34')]));_0x4c25fa['attributes']=_0x4c25fa[_0x6287('0x33')][_0x6287('0x44')]?_0x4c25fa['attributes']:_0xa2e8c1['model'];if(_0x31e8d3[_0x6287('0x30')][_0x6287('0x3d')]){_0x4c25fa[_0x6287('0x3e')]=[{'all':!![]}];}_0x4c25fa=_[_0x6287('0x3b')]({},_0x4c25fa,_0x31e8d3[_0x6287('0x3c')]);return db[_0x6287('0x29')][_0x6287('0x45')](_0x4c25fa)[_0x6287('0x24')](handleEntityNotFound(_0x343fda,null))[_0x6287('0x24')](respondWithResult(_0x343fda,null))[_0x6287('0x41')](handleError(_0x343fda,null));};exports[_0x6287('0x46')]=function(_0x3ca209,_0xb2cbe9){return db[_0x6287('0x29')][_0x6287('0x46')](_0x3ca209['body'],{})[_0x6287('0x24')](respondWithResult(_0xb2cbe9,0xc9))[_0x6287('0x41')](handleError(_0xb2cbe9,null));};exports[_0x6287('0x23')]=function(_0x3e1e66,_0x904051){if(_0x3e1e66[_0x6287('0x47')]['id']){delete _0x3e1e66[_0x6287('0x47')]['id'];}return db['DeskField'][_0x6287('0x45')]({'where':{'id':_0x3e1e66[_0x6287('0x42')]['id']}})[_0x6287('0x24')](handleEntityNotFound(_0x904051,null))[_0x6287('0x24')](saveUpdates(_0x3e1e66[_0x6287('0x47')],null))['then'](respondWithResult(_0x904051,null))['catch'](handleError(_0x904051,null));};exports['destroy']=function(_0x3ad7c8,_0x59bad3){return db[_0x6287('0x29')]['find']({'where':{'id':_0x3ad7c8[_0x6287('0x42')]['id']}})[_0x6287('0x24')](handleEntityNotFound(_0x59bad3,null))[_0x6287('0x24')](removeEntity(_0x59bad3,null))[_0x6287('0x41')](handleError(_0x59bad3,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index 0688954..60eaafc 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 _0x5b9c=['bluebird','path','rimraf','DeskField','int_desk_fields','idField','FieldId','lodash','util','api','moment'];(function(_0x11cbcd,_0x13a2ce){var _0x597934=function(_0x253ba9){while(--_0x253ba9){_0x11cbcd['push'](_0x11cbcd['shift']());}};_0x597934(++_0x13a2ce);}(_0x5b9c,0x19e));var _0xc5b9=function(_0x1bd24a,_0x16314a){_0x1bd24a=_0x1bd24a-0x0;var _0x2f24d0=_0x5b9c[_0x1bd24a];return _0x2f24d0;};'use strict';var _=require(_0xc5b9('0x0'));var util=require(_0xc5b9('0x1'));var logger=require('../../config/logger')(_0xc5b9('0x2'));var moment=require(_0xc5b9('0x3'));var BPromise=require(_0xc5b9('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc5b9('0x5'));var rimraf=require(_0xc5b9('0x6'));var config=require('../../config/environment');var attributes=require('./intDeskField.attributes');module['exports']=function(_0x5128c3,_0x54d0fe){return _0x5128c3['define'](_0xc5b9('0x7'),attributes,{'tableName':_0xc5b9('0x8'),'paranoid':![],'indexes':[{'name':'desk_unique_index','fields':[_0xc5b9('0x9'),_0xc5b9('0xa')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x36c7=['idField','FieldId','lodash','util','../../config/logger','api','moment','path','../../config/environment','./intDeskField.attributes','DeskField','int_desk_fields'];(function(_0x12754d,_0xe6f8eb){var _0x35eb74=function(_0x1f593c){while(--_0x1f593c){_0x12754d['push'](_0x12754d['shift']());}};_0x35eb74(++_0xe6f8eb);}(_0x36c7,0xb6));var _0x736c=function(_0x2f1591,_0x1184bb){_0x2f1591=_0x2f1591-0x0;var _0x32fcc7=_0x36c7[_0x2f1591];return _0x32fcc7;};'use strict';var _=require(_0x736c('0x0'));var util=require(_0x736c('0x1'));var logger=require(_0x736c('0x2'))(_0x736c('0x3'));var moment=require(_0x736c('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x736c('0x5'));var rimraf=require('rimraf');var config=require(_0x736c('0x6'));var attributes=require(_0x736c('0x7'));module['exports']=function(_0x108ef4,_0x30d437){return _0x108ef4['define'](_0x736c('0x8'),attributes,{'tableName':_0x736c('0x9'),'paranoid':![],'indexes':[{'name':'desk_unique_index','fields':[_0x736c('0xa'),_0x736c('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.rpc.js b/server/api/intDeskField/intDeskField.rpc.js index e04e634..784ef40 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 _0x376c=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','info','DeskField,\x20%s,\x20%s','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','moment','bluebird'];(function(_0x563594,_0x21642f){var _0x300b3d=function(_0x14546f){while(--_0x14546f){_0x563594['push'](_0x563594['shift']());}};_0x300b3d(++_0x21642f);}(_0x376c,0xed));var _0xc376=function(_0x346737,_0x3e6081){_0x346737=_0x346737-0x0;var _0x1ade2e=_0x376c[_0x346737];return _0x1ade2e;};'use strict';var _=require('lodash');var util=require(_0xc376('0x0'));var moment=require(_0xc376('0x1'));var BPromise=require(_0xc376('0x2'));var rs=require(_0xc376('0x3'));var fs=require('fs');var Redis=require(_0xc376('0x4'));var db=require(_0xc376('0x5'))['db'];var utils=require(_0xc376('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xc376('0x7'));var jayson=require(_0xc376('0x8'));var client=jayson[_0xc376('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2e4d1e,_0x400150,_0x11913d){return new BPromise(function(_0x39e169,_0x10c9b3){return client['request'](_0x2e4d1e,_0x11913d)['then'](function(_0x343511){logger[_0xc376('0xa')](_0xc376('0xb'),_0x400150,_0xc376('0xc'));logger[_0xc376('0xd')](_0xc376('0xe'),_0x400150,'request\x20sent',JSON['stringify'](_0x343511));if(_0x343511[_0xc376('0xf')]){if(_0x343511[_0xc376('0xf')][_0xc376('0x10')]===0x1f4){logger[_0xc376('0xf')](_0xc376('0xb'),_0x400150,_0x343511[_0xc376('0xf')][_0xc376('0x11')]);return _0x10c9b3(_0x343511['error'][_0xc376('0x11')]);}logger[_0xc376('0xf')](_0xc376('0xb'),_0x400150,_0x343511[_0xc376('0xf')][_0xc376('0x11')]);return _0x39e169(_0x343511[_0xc376('0xf')][_0xc376('0x11')]);}else{logger[_0xc376('0xa')](_0xc376('0xb'),_0x400150,_0xc376('0xc'));_0x39e169(_0x343511[_0xc376('0x12')]['message']);}})[_0xc376('0x13')](function(_0x3fcbdd){logger[_0xc376('0xf')](_0xc376('0xb'),_0x400150,_0x3fcbdd);_0x10c9b3(_0x3fcbdd);});});} \ No newline at end of file +var _0x217f=['result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','DeskField,\x20%s,\x20%s','debug','DeskField,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x5983c5,_0x26e268){var _0x14ddac=function(_0x2975eb){while(--_0x2975eb){_0x5983c5['push'](_0x5983c5['shift']());}};_0x14ddac(++_0x26e268);}(_0x217f,0x106));var _0xf217=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x217f[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xf217('0x0'));var BPromise=require(_0xf217('0x1'));var rs=require(_0xf217('0x2'));var fs=require('fs');var Redis=require(_0xf217('0x3'));var db=require(_0xf217('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xf217('0x5'))(_0xf217('0x6'));var config=require(_0xf217('0x7'));var jayson=require(_0xf217('0x8'));var client=jayson[_0xf217('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3b1ca5,_0x360f27,_0x28927d){return new BPromise(function(_0x35a87d,_0x5c3cb6){return client[_0xf217('0xa')](_0x3b1ca5,_0x28927d)['then'](function(_0x20be96){logger[_0xf217('0xb')](_0xf217('0xc'),_0x360f27,'request\x20sent');logger[_0xf217('0xd')](_0xf217('0xe'),_0x360f27,'request\x20sent',JSON['stringify'](_0x20be96));if(_0x20be96[_0xf217('0xf')]){if(_0x20be96[_0xf217('0xf')][_0xf217('0x10')]===0x1f4){logger[_0xf217('0xf')](_0xf217('0xc'),_0x360f27,_0x20be96['error'][_0xf217('0x11')]);return _0x5c3cb6(_0x20be96[_0xf217('0xf')][_0xf217('0x11')]);}logger[_0xf217('0xf')](_0xf217('0xc'),_0x360f27,_0x20be96[_0xf217('0xf')]['message']);return _0x35a87d(_0x20be96[_0xf217('0xf')][_0xf217('0x11')]);}else{logger[_0xf217('0xb')]('DeskField,\x20%s,\x20%s',_0x360f27,'request\x20sent');_0x35a87d(_0x20be96[_0xf217('0x12')]['message']);}})[_0xf217('0x13')](function(_0x46dbc6){logger[_0xf217('0xf')](_0xf217('0xc'),_0x360f27,_0x46dbc6);_0x5c3cb6(_0x46dbc6);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index 0cdb115..13dbee3 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 _0x30bc=['/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','put','update','delete','destroy','exports','multer','connect-timeout','Router','../../config/environment','./intDynamics365Account.controller','get','isAuthenticated','index','/:id'];(function(_0x119235,_0x5b8c5b){var _0x2ca9da=function(_0x346747){while(--_0x346747){_0x119235['push'](_0x119235['shift']());}};_0x2ca9da(++_0x5b8c5b);}(_0x30bc,0x1eb));var _0xc30b=function(_0x384c23,_0x30cd65){_0x384c23=_0x384c23-0x0;var _0x1fdf67=_0x30bc[_0x384c23];return _0x1fdf67;};'use strict';var multer=require(_0xc30b('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xc30b('0x1'));var express=require('express');var router=express[_0xc30b('0x2')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xc30b('0x3'));var controller=require(_0xc30b('0x4'));router[_0xc30b('0x5')]('/',auth[_0xc30b('0x6')](),controller[_0xc30b('0x7')]);router[_0xc30b('0x5')](_0xc30b('0x8'),auth[_0xc30b('0x6')](),controller['show']);router[_0xc30b('0x5')](_0xc30b('0x9'),auth[_0xc30b('0x6')](),controller[_0xc30b('0xa')]);router[_0xc30b('0x5')](_0xc30b('0xb'),auth['isAuthenticated'](),controller[_0xc30b('0xc')]);router[_0xc30b('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0xc30b('0xd')](_0xc30b('0x9'),auth[_0xc30b('0x6')](),controller[_0xc30b('0xe')]);router[_0xc30b('0xf')]('/:id',auth[_0xc30b('0x6')](),controller[_0xc30b('0x10')]);router[_0xc30b('0x11')]('/:id',auth[_0xc30b('0x6')](),controller[_0xc30b('0x12')]);module[_0xc30b('0x13')]=router; \ No newline at end of file +var _0x851b=['Router','fs-extra','../../components/auth/service','../../config/environment','index','get','/:id','/:id/configurations','isAuthenticated','getConfigurations','post','addConfiguration','put','update','destroy','exports','multer','util','connect-timeout','express'];(function(_0x24e0c9,_0x284109){var _0x4448f0=function(_0x576980){while(--_0x576980){_0x24e0c9['push'](_0x24e0c9['shift']());}};_0x4448f0(++_0x284109);}(_0x851b,0x18c));var _0xb851=function(_0x576d44,_0xbc976d){_0x576d44=_0x576d44-0x0;var _0x48e586=_0x851b[_0x576d44];return _0x48e586;};'use strict';var multer=require(_0xb851('0x0'));var util=require(_0xb851('0x1'));var path=require('path');var timeout=require(_0xb851('0x2'));var express=require(_0xb851('0x3'));var router=express[_0xb851('0x4')]();var fs_extra=require(_0xb851('0x5'));var auth=require(_0xb851('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xb851('0x7'));var controller=require('./intDynamics365Account.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xb851('0x8')]);router[_0xb851('0x9')](_0xb851('0xa'),auth['isAuthenticated'](),controller['show']);router[_0xb851('0x9')](_0xb851('0xb'),auth[_0xb851('0xc')](),controller[_0xb851('0xd')]);router['get']('/:id/fields',auth[_0xb851('0xc')](),controller['getFields']);router[_0xb851('0xe')]('/',auth[_0xb851('0xc')](),controller['create']);router[_0xb851('0xe')]('/:id/configurations',auth[_0xb851('0xc')](),controller[_0xb851('0xf')]);router[_0xb851('0x10')](_0xb851('0xa'),auth['isAuthenticated'](),controller[_0xb851('0x11')]);router['delete'](_0xb851('0xa'),auth[_0xb851('0xc')](),controller[_0xb851('0x12')]);module[_0xb851('0x13')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index 1de9a39..a63c287 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 _0x0c29=['BOOLEAN','STRING'];(function(_0x52f1e6,_0xf70489){var _0x21f104=function(_0xb89f9e){while(--_0xb89f9e){_0x52f1e6['push'](_0x52f1e6['shift']());}};_0x21f104(++_0xf70489);}(_0x0c29,0xb7));var _0x90c2=function(_0x2de020,_0x252df0){_0x2de020=_0x2de020-0x0;var _0x182b7c=_0x0c29[_0x2de020];return _0x182b7c;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x90c2('0x0')]},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x90c2('0x0')]},'remoteUri':{'type':Sequelize[_0x90c2('0x0')]},'tenantId':{'type':Sequelize[_0x90c2('0x0')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x90c2('0x0')],'allowNull':![]},'description':{'type':Sequelize[_0x90c2('0x0')]},'modernAuthentication':{'type':Sequelize[_0x90c2('0x1')],'defaultValue':!![]}}; \ No newline at end of file +var _0xfcbd=['BOOLEAN','sequelize','STRING'];(function(_0x5307f1,_0x66442d){var _0x212ae1=function(_0x471731){while(--_0x471731){_0x5307f1['push'](_0x5307f1['shift']());}};_0x212ae1(++_0x66442d);}(_0xfcbd,0x160));var _0xdfcb=function(_0x30ffc1,_0x556cd6){_0x30ffc1=_0x30ffc1-0x0;var _0x586b40=_0xfcbd[_0x30ffc1];return _0x586b40;};'use strict';var Sequelize=require(_0xdfcb('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xdfcb('0x1')]},'password':{'type':Sequelize[_0xdfcb('0x1')]},'remoteUri':{'type':Sequelize[_0xdfcb('0x1')]},'tenantId':{'type':Sequelize[_0xdfcb('0x1')]},'clientId':{'type':Sequelize[_0xdfcb('0x1')]},'clientSecret':{'type':Sequelize[_0xdfcb('0x1')]},'serverUrl':{'type':Sequelize[_0xdfcb('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xdfcb('0x1')]},'modernAuthentication':{'type':Sequelize[_0xdfcb('0x2')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index b8fabb9..dbee412 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 _0xa0f2=['LogicalName','@odata.type','PicklistAttributeMetadata','forEach','BooleanAttributeMetadata','push','all','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','DecimalAttributeMetadata','test','Wrong\x20credentials',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','UserLocalizedLabel','Value','DisplayName','Label',')/Attributes(','TrueOption','true','FalseOption','false',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','request-promise','util','lodash','../../components/parsers/qs','../../config/logger','api','../../mysqldb','../../components/integrations/configuration','status','json','offset','undefined','limit','count','Content-Range','then','destroy','end','sendStatus','error','stack','name','send','map','Dynamics365Account','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','options','includeAll','include','catch','show','params','rawAttributes','find','create','body','getConfigurations','findOne','filter','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','Dynamics365Configuration','Dynamics365Field','slice','substring','lastIndexOf','getFields','ticketType','incident','Incident','PhoneCall','title','description','customerid','caseorigincode','subject','phonenumber','regardingobjectid','phonecall_activity_parties','accountidname','accountidyominame','actualserviceunits','contactidname','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridtype','customeridyominame','emailaddress','entityimage_timestamp','entityimage_url','escalatedon','exchangerate','firstresponsebykpiidname','followupby','importsequencenumber','influencescore','masteridname','modifiedbyname','modifiedbyyominame','modifiedonbehalfbyname','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','overriddencreatedon','owneridtype','owneridyominame','parentcaseidname','primarycontactidname','productidname','productserialnumber','resolveby','resolvebykpiidname','responsiblecontactidname','sentimentvalue','slainvokedidname','slaname','socialprofileidname','statecode','statuscode','subjectidname','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','versionnumber','concat','username','password','remoteUri','tenantId','clientId','clientSecret','modernAuthentication','CloudProvider','data5','data7','access_token','POST','/oauth2/token','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','4.0','value','MetadataId','EntityDefinitions(','Bearer\x20','Attributes','remove'];(function(_0x322489,_0x32f0e6){var _0x1ac3ed=function(_0xd635ed){while(--_0xd635ed){_0x322489['push'](_0x322489['shift']());}};_0x1ac3ed(++_0x32f0e6);}(_0xa0f2,0x19a));var _0x2a0f=function(_0x4dd887,_0x36661f){_0x4dd887=_0x4dd887-0x0;var _0x22ec81=_0xa0f2[_0x4dd887];return _0x22ec81;};'use strict';var rp=require(_0x2a0f('0x0'));var util=require(_0x2a0f('0x1'));var _=require(_0x2a0f('0x2'));var qs=require(_0x2a0f('0x3'));var logger=require(_0x2a0f('0x4'))(_0x2a0f('0x5'));var db=require(_0x2a0f('0x6'))['db'];var integrations=require(_0x2a0f('0x7'));function respondWithResult(_0xe8e7e5,_0x40756a){_0x40756a=_0x40756a||0xc8;return function(_0x4d6307){if(_0x4d6307){return _0xe8e7e5[_0x2a0f('0x8')](_0x40756a)[_0x2a0f('0x9')](_0x4d6307);}};}function respondWithFilteredResult(_0x348e06,_0x267539){return function(_0x3da7e8){if(_0x3da7e8){var _0x3e444e=typeof _0x267539[_0x2a0f('0xa')]===_0x2a0f('0xb')&&typeof _0x267539[_0x2a0f('0xc')]===_0x2a0f('0xb');var _0x21d399=_0x3da7e8[_0x2a0f('0xd')];var _0x43d2de=_0x3e444e?0x0:_0x267539[_0x2a0f('0xa')];var _0x529f9c=_0x3e444e?_0x3da7e8[_0x2a0f('0xd')]:_0x267539[_0x2a0f('0xa')]+_0x267539[_0x2a0f('0xc')];var _0x3adb65;if(_0x529f9c>=_0x21d399){_0x529f9c=_0x21d399;_0x3adb65=0xc8;}else{_0x3adb65=0xce;}_0x348e06[_0x2a0f('0x8')](_0x3adb65);return _0x348e06['set'](_0x2a0f('0xe'),_0x43d2de+'-'+_0x529f9c+'/'+_0x21d399)[_0x2a0f('0x9')](_0x3da7e8);}return null;};}function saveUpdates(_0xb5b165){return function(_0x3d2f4a){if(_0x3d2f4a){return _0x3d2f4a['update'](_0xb5b165)[_0x2a0f('0xf')](function(_0x27c9e8){return _0x27c9e8;});}return null;};}function removeEntity(_0x41b0b9){return function(_0x35d282){if(_0x35d282){return _0x35d282[_0x2a0f('0x10')]()['then'](function(){_0x41b0b9['status'](0xcc)[_0x2a0f('0x11')]();});}};}function handleEntityNotFound(_0x10b1e6){return function(_0x3c5dac){if(!_0x3c5dac){_0x10b1e6[_0x2a0f('0x12')](0x194);}return _0x3c5dac;};}function handleError(_0x453541,_0x11872e){_0x11872e=_0x11872e||0x1f4;return function(_0x16a245){logger[_0x2a0f('0x13')](_0x16a245[_0x2a0f('0x14')]);if(_0x16a245[_0x2a0f('0x15')]){delete _0x16a245[_0x2a0f('0x15')];}_0x453541['status'](_0x11872e)[_0x2a0f('0x16')](_0x16a245);};}exports['index']=function(_0xdd90a8,_0x120808){var _0x3e8eae={},_0x3c4b34={},_0x54a008={'count':0x0,'rows':[]};var _0x203498=_[_0x2a0f('0x17')](db[_0x2a0f('0x18')]['rawAttributes'],function(_0x351b1e){return{'name':_0x351b1e['fieldName'],'type':_0x351b1e[_0x2a0f('0x19')][_0x2a0f('0x1a')]};});_0x3c4b34[_0x2a0f('0x1b')]=_[_0x2a0f('0x17')](_0x203498,'name');_0x3c4b34[_0x2a0f('0x1c')]=_[_0x2a0f('0x1d')](_0xdd90a8[_0x2a0f('0x1c')]);_0x3c4b34[_0x2a0f('0x1e')]=_[_0x2a0f('0x1f')](_0x3c4b34[_0x2a0f('0x1b')],_0x3c4b34[_0x2a0f('0x1c')]);_0x3e8eae[_0x2a0f('0x20')]=_[_0x2a0f('0x1f')](_0x3c4b34[_0x2a0f('0x1b')],qs[_0x2a0f('0x21')](_0xdd90a8['query'][_0x2a0f('0x21')]));_0x3e8eae[_0x2a0f('0x20')]=_0x3e8eae[_0x2a0f('0x20')][_0x2a0f('0x22')]?_0x3e8eae[_0x2a0f('0x20')]:_0x3c4b34[_0x2a0f('0x1b')];if(!_0xdd90a8[_0x2a0f('0x1c')][_0x2a0f('0x23')](_0x2a0f('0x24'))){_0x3e8eae[_0x2a0f('0xc')]=qs[_0x2a0f('0xc')](_0xdd90a8['query'][_0x2a0f('0xc')]);_0x3e8eae[_0x2a0f('0xa')]=qs[_0x2a0f('0xa')](_0xdd90a8[_0x2a0f('0x1c')][_0x2a0f('0xa')]);}_0x3e8eae[_0x2a0f('0x25')]=qs[_0x2a0f('0x26')](_0xdd90a8[_0x2a0f('0x1c')][_0x2a0f('0x26')]);_0x3e8eae[_0x2a0f('0x27')]=qs['filters'](_['pick'](_0xdd90a8[_0x2a0f('0x1c')],_0x3c4b34[_0x2a0f('0x1e')]),_0x203498);if(_0xdd90a8[_0x2a0f('0x1c')]['filter']){_0x3e8eae[_0x2a0f('0x27')]=_[_0x2a0f('0x28')](_0x3e8eae[_0x2a0f('0x27')],{'$or':_[_0x2a0f('0x17')](_0x203498,function(_0x15d980){if(_0x15d980[_0x2a0f('0x19')]!==_0x2a0f('0x29')){var _0x54a641={};_0x54a641[_0x15d980[_0x2a0f('0x15')]]={'$like':'%'+_0xdd90a8[_0x2a0f('0x1c')]['filter']+'%'};return _0x54a641;}})});}_0x3e8eae=_[_0x2a0f('0x28')]({},_0x3e8eae,_0xdd90a8[_0x2a0f('0x2a')]);var _0x4e99c4={'where':_0x3e8eae[_0x2a0f('0x27')]};return db[_0x2a0f('0x18')]['count'](_0x4e99c4)[_0x2a0f('0xf')](function(_0x375df4){_0x54a008[_0x2a0f('0xd')]=_0x375df4;if(_0xdd90a8[_0x2a0f('0x1c')][_0x2a0f('0x2b')]){_0x3e8eae[_0x2a0f('0x2c')]=[{'all':!![]}];}return db[_0x2a0f('0x18')]['findAll'](_0x3e8eae);})[_0x2a0f('0xf')](function(_0x267fcc){_0x54a008['rows']=_0x267fcc;return _0x54a008;})[_0x2a0f('0xf')](respondWithFilteredResult(_0x120808,_0x3e8eae))[_0x2a0f('0x2d')](handleError(_0x120808,null));};exports[_0x2a0f('0x2e')]=function(_0x12e6aa,_0x1bfe4b){var _0x411c5a={'raw':![],'where':{'id':_0x12e6aa[_0x2a0f('0x2f')]['id']}},_0x39f28f={};_0x39f28f['model']=_[_0x2a0f('0x1d')](db[_0x2a0f('0x18')][_0x2a0f('0x30')]);_0x39f28f[_0x2a0f('0x1c')]=_[_0x2a0f('0x1d')](_0x12e6aa[_0x2a0f('0x1c')]);_0x39f28f[_0x2a0f('0x1e')]=_[_0x2a0f('0x1f')](_0x39f28f[_0x2a0f('0x1b')],_0x39f28f['query']);_0x411c5a[_0x2a0f('0x20')]=_[_0x2a0f('0x1f')](_0x39f28f[_0x2a0f('0x1b')],qs[_0x2a0f('0x21')](_0x12e6aa[_0x2a0f('0x1c')]['fields']));_0x411c5a[_0x2a0f('0x20')]=_0x411c5a[_0x2a0f('0x20')][_0x2a0f('0x22')]?_0x411c5a[_0x2a0f('0x20')]:_0x39f28f['model'];if(_0x12e6aa[_0x2a0f('0x1c')][_0x2a0f('0x2b')]){_0x411c5a[_0x2a0f('0x2c')]=[{'all':!![]}];}_0x411c5a=_['merge']({},_0x411c5a,_0x12e6aa[_0x2a0f('0x2a')]);return db[_0x2a0f('0x18')][_0x2a0f('0x31')](_0x411c5a)[_0x2a0f('0xf')](handleEntityNotFound(_0x1bfe4b,null))['then'](respondWithResult(_0x1bfe4b,null))['catch'](handleError(_0x1bfe4b,null));};exports[_0x2a0f('0x32')]=function(_0x19beb2,_0x29eba5){return db['Dynamics365Account'][_0x2a0f('0x32')](_0x19beb2[_0x2a0f('0x33')],{})[_0x2a0f('0xf')](respondWithResult(_0x29eba5,0xc9))['catch'](handleError(_0x29eba5,null));};exports['update']=function(_0x204891,_0x8f3330){if(_0x204891['body']['id']){delete _0x204891[_0x2a0f('0x33')]['id'];}return db[_0x2a0f('0x18')]['find']({'where':{'id':_0x204891['params']['id']}})[_0x2a0f('0xf')](handleEntityNotFound(_0x8f3330,null))[_0x2a0f('0xf')](saveUpdates(_0x204891[_0x2a0f('0x33')],null))[_0x2a0f('0xf')](respondWithResult(_0x8f3330,null))[_0x2a0f('0x2d')](handleError(_0x8f3330,null));};exports['destroy']=function(_0x5ae779,_0x3a937b){return db['Dynamics365Account'][_0x2a0f('0x31')]({'where':{'id':_0x5ae779[_0x2a0f('0x2f')]['id']}})[_0x2a0f('0xf')](handleEntityNotFound(_0x3a937b,null))[_0x2a0f('0xf')](removeEntity(_0x3a937b,null))[_0x2a0f('0x2d')](handleError(_0x3a937b,null));};exports[_0x2a0f('0x34')]=function(_0x750c58,_0x5d5d00){var _0x544a75={};var _0x37d059={};var _0x584809;var _0xede223;return db['Dynamics365Account'][_0x2a0f('0x35')]({'where':{'id':_0x750c58[_0x2a0f('0x2f')]['id']}})[_0x2a0f('0xf')](handleEntityNotFound(_0x5d5d00,null))['then'](function(_0x152539){if(_0x152539){_0x584809=_0x152539;_0x37d059[_0x2a0f('0x1b')]=_[_0x2a0f('0x1d')](db['Dynamics365Configuration'][_0x2a0f('0x30')]);_0x37d059['query']=_[_0x2a0f('0x1d')](_0x750c58[_0x2a0f('0x1c')]);_0x37d059[_0x2a0f('0x1e')]=_[_0x2a0f('0x1f')](_0x37d059['model'],_0x37d059[_0x2a0f('0x1c')]);_0x544a75[_0x2a0f('0x20')]=_['intersection'](_0x37d059['model'],qs[_0x2a0f('0x21')](_0x750c58[_0x2a0f('0x1c')][_0x2a0f('0x21')]));_0x544a75[_0x2a0f('0x20')]=_0x544a75['attributes'][_0x2a0f('0x22')]?_0x544a75[_0x2a0f('0x20')]:_0x37d059['model'];_0x544a75['order']=qs['sort'](_0x750c58[_0x2a0f('0x1c')]['sort']);_0x544a75['where']=qs[_0x2a0f('0x1e')](_['pick'](_0x750c58[_0x2a0f('0x1c')],_0x37d059[_0x2a0f('0x1e')]));if(_0x750c58[_0x2a0f('0x1c')]['filter']){_0x544a75['where']=_['merge'](_0x544a75['where'],{'$or':_['map'](_0x544a75[_0x2a0f('0x20')],function(_0x53411f){var _0x3b8930={};_0x3b8930[_0x53411f]={'$like':'%'+_0x750c58[_0x2a0f('0x1c')][_0x2a0f('0x36')]+'%'};return _0x3b8930;})});}_0x544a75=_['merge']({},_0x544a75,_0x750c58[_0x2a0f('0x2a')]);return _0x584809['getConfigurations'](_0x544a75);}})[_0x2a0f('0xf')](function(_0x3b6c0b){if(_0x3b6c0b){_0xede223=_0x3b6c0b[_0x2a0f('0x22')];if(!_0x750c58[_0x2a0f('0x1c')][_0x2a0f('0x23')](_0x2a0f('0x24'))){_0x544a75['limit']=qs[_0x2a0f('0xc')](_0x750c58[_0x2a0f('0x1c')][_0x2a0f('0xc')]);_0x544a75[_0x2a0f('0xa')]=qs[_0x2a0f('0xa')](_0x750c58[_0x2a0f('0x1c')][_0x2a0f('0xa')]);}return _0x584809[_0x2a0f('0x34')](_0x544a75);}})[_0x2a0f('0xf')](function(_0x42d4ce){if(_0x42d4ce){return _0x42d4ce?{'count':_0xede223,'rows':_0x42d4ce}:null;}})[_0x2a0f('0xf')](respondWithResult(_0x5d5d00,null))[_0x2a0f('0x2d')](handleError(_0x5d5d00,null));};exports[_0x2a0f('0x37')]=function(_0x4a27ce,_0x84228d){if(_0x4a27ce[_0x2a0f('0x33')]['id']){delete _0x4a27ce[_0x2a0f('0x33')]['id'];}return db[_0x2a0f('0x18')][_0x2a0f('0x35')]({'where':{'id':_0x4a27ce[_0x2a0f('0x2f')]['id']}})[_0x2a0f('0xf')](handleEntityNotFound(_0x84228d,null))['then'](function(_0x11362d){if(_0x11362d){_0x4a27ce[_0x2a0f('0x33')][_0x2a0f('0x38')]=_0x11362d['id'];_0x4a27ce['body'][_0x2a0f('0x39')]=integrations[_0x2a0f('0x3a')](_0x4a27ce[_0x2a0f('0x33')][_0x2a0f('0x3b')],_0x4a27ce[_0x2a0f('0x33')][_0x2a0f('0x19')]);_0x4a27ce[_0x2a0f('0x33')][_0x2a0f('0x3c')]=integrations[_0x2a0f('0x3d')](_0x4a27ce['body']['channel'],_0x4a27ce[_0x2a0f('0x33')]['type']);return db[_0x2a0f('0x3e')]['create'](_0x4a27ce[_0x2a0f('0x33')],{'include':[{'model':db[_0x2a0f('0x3f')],'as':'Subjects'},{'model':db[_0x2a0f('0x3f')],'as':_0x2a0f('0x3c')}]});}return null;})[_0x2a0f('0xf')](respondWithResult(_0x84228d,null))[_0x2a0f('0x2d')](handleError(_0x84228d,null));};function sanitizeRemoteUri(_0x235448){var _0x277fa9=_0x235448[_0x2a0f('0x40')](-0x1);if(_0x277fa9==='/')return _0x235448[_0x2a0f('0x41')](0x0,_0x235448[_0x2a0f('0x42')](_0x277fa9));return _0x235448;}function getWebApiUrl(_0x5526dd){return util['format']('%s/api/data/v9.0/',_0x5526dd);}exports[_0x2a0f('0x43')]=function(_0xb4e3c2,_0x13b103){var _0x36e0bf=_0xb4e3c2[_0x2a0f('0x1c')][_0x2a0f('0x44')];var _0x21ee96=_0x36e0bf===_0x2a0f('0x45')?_0x2a0f('0x46'):_0x2a0f('0x47');var _0x3a6386='';var _0x3a734b='';var _0x39ea54='';var _0x5e6c73='';var _0x50ba4b='';var _0x4ccc8a='';var _0x377fca='';var _0x844beb='';var _0x4371a2=[_0x2a0f('0x48'),_0x2a0f('0x49'),_0x2a0f('0x4a'),'ownerid',_0x2a0f('0x4b'),_0x2a0f('0x4c'),_0x2a0f('0x4d'),_0x2a0f('0x4e'),'directioncode',_0x2a0f('0x4f')];var _0x463b80=[_0x2a0f('0x50'),_0x2a0f('0x51'),_0x2a0f('0x52'),'billedserviceunits',_0x2a0f('0x53'),'contactidyominame',_0x2a0f('0x54'),_0x2a0f('0x55'),_0x2a0f('0x56'),_0x2a0f('0x57'),_0x2a0f('0x58'),_0x2a0f('0x59'),_0x2a0f('0x5a'),_0x2a0f('0x5b'),_0x2a0f('0x5c'),'customeridname',_0x2a0f('0x5d'),_0x2a0f('0x5e'),_0x2a0f('0x5f'),'entitlementidname',_0x2a0f('0x60'),_0x2a0f('0x61'),_0x2a0f('0x62'),_0x2a0f('0x63'),_0x2a0f('0x64'),_0x2a0f('0x65'),_0x2a0f('0x66'),_0x2a0f('0x67'),'kbarticleidname','lastonholdtime',_0x2a0f('0x68'),'modifiedbyexternalpartyname','modifiedbyexternalpartyyominame',_0x2a0f('0x69'),_0x2a0f('0x6a'),'modifiedon',_0x2a0f('0x6b'),'modifiedonbehalfbyyominame',_0x2a0f('0x6c'),_0x2a0f('0x6d'),_0x2a0f('0x6e'),'onholdtime',_0x2a0f('0x6f'),'owneridname',_0x2a0f('0x70'),_0x2a0f('0x71'),_0x2a0f('0x72'),_0x2a0f('0x73'),'primarycontactidyominame','prioritycodename',_0x2a0f('0x74'),_0x2a0f('0x75'),_0x2a0f('0x76'),_0x2a0f('0x77'),'responseby',_0x2a0f('0x78'),'responsiblecontactidyominame',_0x2a0f('0x79'),_0x2a0f('0x7a'),_0x2a0f('0x7b'),_0x2a0f('0x7c'),_0x2a0f('0x7d'),_0x2a0f('0x7e'),_0x2a0f('0x7f'),_0x2a0f('0x80'),_0x2a0f('0x81'),_0x2a0f('0x82'),_0x2a0f('0x83'),_0x2a0f('0x84'),_0x2a0f('0x85')];var _0x42a536=_0x4371a2[_0x2a0f('0x86')](_0x463b80);return db[_0x2a0f('0x18')][_0x2a0f('0x35')]({'where':{'id':_0xb4e3c2[_0x2a0f('0x2f')]['id']},'attributes':['id',_0x2a0f('0x87'),_0x2a0f('0x88'),_0x2a0f('0x89'),_0x2a0f('0x8a'),_0x2a0f('0x8b'),_0x2a0f('0x8c'),_0x2a0f('0x8d')],'include':[{'model':db[_0x2a0f('0x8e')],'as':_0x2a0f('0x8e'),'attributes':['id',_0x2a0f('0x8f'),_0x2a0f('0x90')]}]})[_0x2a0f('0xf')](handleEntityNotFound(_0x13b103,null))[_0x2a0f('0xf')](function(_0x348181){if(_0x348181){if(_0x348181[_0x2a0f('0x8d')]){_0x348181[_0x2a0f('0x91')]=_0x348181[_0x2a0f('0x8e')][_0x2a0f('0x8f')];_0x844beb=sanitizeRemoteUri(_0x348181[_0x2a0f('0x8e')][_0x2a0f('0x90')]);_0x377fca=getWebApiUrl(_0x844beb);return _0x348181;}_0x844beb=sanitizeRemoteUri(_0x348181[_0x2a0f('0x89')]);_0x377fca=getWebApiUrl(_0x844beb);var _0x373079={'method':_0x2a0f('0x92'),'uri':'https://login.microsoftonline.com/'+_0x348181[_0x2a0f('0x8a')]+_0x2a0f('0x93'),'form':{'client_id':_0x348181['clientId'],'resource':_0x844beb,'username':_0x348181[_0x2a0f('0x87')],'password':_0x348181['password'],'grant_type':_0x2a0f('0x88'),'client_secret':_0x348181['clientSecret']},'json':!![]};return rp(_0x373079);}})[_0x2a0f('0xf')](function(_0x430e15){_0x4ccc8a=_0x430e15[_0x2a0f('0x91')];var _0x35a399={'method':_0x2a0f('0x94'),'uri':encodeURI(_0x377fca+_0x2a0f('0x95')+_0x21ee96+'\x27'),'headers':{'Authorization':'Bearer\x20'+_0x4ccc8a,'If-None-Match':null,'OData-Version':_0x2a0f('0x96')},'json':!![]};return rp(_0x35a399);})['then'](function(_0x381481){var _0x310fa3=_0x381481[_0x2a0f('0x97')][0x0];var _0x2d3e74=_0x310fa3[_0x2a0f('0x98')];var _0x5288fd={'method':_0x2a0f('0x94'),'uri':_0x377fca+_0x2a0f('0x99')+_0x2d3e74+')?$select=LogicalName&$expand=Attributes($select=LogicalName)','headers':{'Authorization':_0x2a0f('0x9a')+_0x4ccc8a,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x5288fd);})[_0x2a0f('0xf')](function(_0x3d4966){_0x3a6386=_0x3d4966;_0x3a734b=_0x3a6386[_0x2a0f('0x9b')];_0x3a734b=_[_0x2a0f('0x9c')](_0x3a734b,function(_0x368fe6){return!_0x42a536['includes'](_0x368fe6[_0x2a0f('0x9d')]);});var _0x3557ac=[];var _0x89259=[];_0x3a734b['forEach'](function(_0xb4af8b){if(_0xb4af8b[_0x2a0f('0x9e')]){var _0x421e2b=_0xb4af8b[_0x2a0f('0x9e')][_0x2a0f('0x41')](_0xb4af8b[_0x2a0f('0x9e')]['lastIndexOf']('.')+0x1);if(_0x421e2b===_0x2a0f('0x9f')){_0x3557ac['push'](getSelectList(_0x377fca,_0x36e0bf,_0x89259,_0x3a6386[_0x2a0f('0x98')],_0xb4af8b[_0x2a0f('0x98')],_0x4ccc8a));}}});return Promise['all'](_0x3557ac);})[_0x2a0f('0xf')](function(_0x1aee7f){_0x39ea54=_0x1aee7f[0x0];var _0x4d2e6e=[];var _0x1121ff=[];_0x3a734b[_0x2a0f('0xa0')](function(_0x494e4a){if(!_['isNil'](_0x494e4a[_0x2a0f('0x9e')])){var _0x2563b6=_0x494e4a[_0x2a0f('0x9e')][_0x2a0f('0x41')](_0x494e4a[_0x2a0f('0x9e')][_0x2a0f('0x42')]('.')+0x1);if(_0x2563b6===_0x2a0f('0xa1')){_0x4d2e6e[_0x2a0f('0xa2')](getBooleanList(_0x377fca,_0x36e0bf,_0x1121ff,_0x3a6386[_0x2a0f('0x98')],_0x494e4a[_0x2a0f('0x98')],_0x4ccc8a));}}});return Promise[_0x2a0f('0xa3')](_0x4d2e6e);})['then'](function(_0x3b8ee1){_0x5e6c73=_0x3b8ee1[0x0];var _0x48b3be=[];var _0x480fd2=[];_0x3a734b[_0x2a0f('0xa0')](function(_0xd126fe){if(_0xd126fe[_0x2a0f('0x9e')]){var _0x1d44c8=_0xd126fe['@odata.type']['substring'](_0xd126fe[_0x2a0f('0x9e')][_0x2a0f('0x42')]('.')+0x1);if(_0x1d44c8===_0x2a0f('0xa4')||_0x1d44c8===_0x2a0f('0xa5')||_0x1d44c8===_0x2a0f('0xa6')||_0x1d44c8===_0x2a0f('0xa7')||_0x1d44c8===_0x2a0f('0xa8')||_0x1d44c8===_0x2a0f('0xa9')||_0x1d44c8===_0x2a0f('0xaa')||_0x1d44c8===_0x2a0f('0xab')||_0x1d44c8==='StateAttributeMetadata'||_0x1d44c8===_0x2a0f('0xac')){_0x48b3be[_0x2a0f('0xa2')](getInputList(_0x377fca,_0x36e0bf,_0x1d44c8,_0x480fd2,_0x3a6386[_0x2a0f('0x98')],_0xd126fe[_0x2a0f('0x98')],_0x4ccc8a));}}});return Promise['all'](_0x48b3be);})['then'](function(_0x868ade){_0x50ba4b=_0x868ade[0x0];var _0x5dc1e4=_0x39ea54[_0x2a0f('0x86')](_0x5e6c73)[_0x2a0f('0x86')](_0x50ba4b);var _0x522a3b={'count':_0x5dc1e4[_0x2a0f('0x22')],'rows':_0x5dc1e4};return _0x522a3b;})['then'](respondWithResult(_0x13b103,null))[_0x2a0f('0x2d')](function(_0xb74da5){var _0x2355f8=_0xb4e3c2[_0x2a0f('0x1c')][_0x2a0f('0xad')]?0x1f4:_0xb74da5['statusCode']||0x1f4;logger['error'](_0xb74da5[_0x2a0f('0x14')]);delete _0xb74da5[_0x2a0f('0x15')];if(_0x2355f8===0x191){_0x2355f8=0x190;}_0x13b103['status'](_0x2355f8)['send'](_0xb4e3c2[_0x2a0f('0x1c')][_0x2a0f('0xad')]?{'message':_0x2a0f('0xae'),'statusCode':_0xb74da5['statusCode']}:_0xb74da5);});};function getSelectList(_0x1d724c,_0x2b2c8a,_0x420238,_0x1424f2,_0x5e42eb,_0x46344b){var _0x1d26f1={'method':'GET','uri':_0x1d724c+_0x2a0f('0x99')+_0x1424f2+')/Attributes('+_0x5e42eb+_0x2a0f('0xaf')+_0x2a0f('0xb0'),'headers':{'Authorization':_0x2a0f('0x9a')+_0x46344b,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x1d26f1)[_0x2a0f('0xf')](function(_0x58bda8){var _0x1d4e71=[];var _0x2ea680=_0x58bda8[_0x2a0f('0xb1')]['Options'];_0x2ea680[_0x2a0f('0xa0')](function(_0x115ef6){_0x1d4e71[_0x2a0f('0xa2')]({'name':_0x115ef6['Label'][_0x2a0f('0xb2')]['Label'],'value':String(_0x115ef6[_0x2a0f('0xb3')])});});var _0x5c704b={'id':_0x2b2c8a+'_'+_0x58bda8[_0x2a0f('0x9d')],'name':_0x58bda8[_0x2a0f('0xb4')]['UserLocalizedLabel'][_0x2a0f('0xb5')],'custom':![],'options':_0x1d4e71};_0x420238[_0x2a0f('0xa2')](_0x5c704b);return _0x420238;});}function getBooleanList(_0x4aced9,_0x113426,_0x4dc8bf,_0x28d4e3,_0x2164f4,_0x2bb502){var _0xbb4451={'method':_0x2a0f('0x94'),'uri':_0x4aced9+'EntityDefinitions('+_0x28d4e3+_0x2a0f('0xb6')+_0x2164f4+')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','headers':{'Authorization':'Bearer\x20'+_0x2bb502,'If-None-Match':null,'OData-Version':_0x2a0f('0x96')},'json':!![]};return rp(_0xbb4451)[_0x2a0f('0xf')](function(_0x37c44e){var _0x2d420d=[];_0x2d420d['push']({'name':_0x37c44e['OptionSet'][_0x2a0f('0xb7')][_0x2a0f('0xb5')][_0x2a0f('0xb2')][_0x2a0f('0xb5')],'value':_0x2a0f('0xb8')},{'name':_0x37c44e[_0x2a0f('0xb1')][_0x2a0f('0xb9')][_0x2a0f('0xb5')][_0x2a0f('0xb2')]['Label'],'value':_0x2a0f('0xba')});var _0x4ccec3={'id':_0x113426+'_'+_0x37c44e[_0x2a0f('0x9d')],'name':_0x37c44e[_0x2a0f('0xb4')][_0x2a0f('0xb2')][_0x2a0f('0xb5')],'custom':![],'options':_0x2d420d};_0x4dc8bf[_0x2a0f('0xa2')](_0x4ccec3);return _0x4dc8bf;});}function getInputList(_0x42ffe7,_0x206d7e,_0x3522c6,_0x714764,_0x37def9,_0x209fff,_0x3501d6){var _0x528768={'method':_0x2a0f('0x94'),'uri':_0x42ffe7+_0x2a0f('0x99')+_0x37def9+_0x2a0f('0xb6')+_0x209fff+_0x2a0f('0xbb')+_0x3522c6+_0x2a0f('0xbc'),'headers':{'Authorization':_0x2a0f('0x9a')+_0x3501d6,'If-None-Match':null,'OData-Version':_0x2a0f('0x96')},'json':!![]};return rp(_0x528768)[_0x2a0f('0xf')](function(_0x1c655b){var _0x5468cd={'id':_0x206d7e+'_'+_0x1c655b[_0x2a0f('0x9d')],'name':_0x1c655b['DisplayName'][_0x2a0f('0xb2')]?_0x1c655b[_0x2a0f('0xb4')][_0x2a0f('0xb2')][_0x2a0f('0xb5')]:_0x1c655b[_0x2a0f('0x9d')],'custom':![],'options':[]};_0x714764[_0x2a0f('0xa2')](_0x5468cd);return _0x714764;});} \ No newline at end of file +var _0x0868=['includes','LogicalName','forEach','@odata.type','PicklistAttributeMetadata','push','isNil','BooleanAttributeMetadata','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','all','concat','test','statusCode','Wrong\x20credentials',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','Label','DisplayName',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','OptionSet','UserLocalizedLabel','FalseOption','false',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','request-promise','util','lodash','../../components/parsers/qs','api','../../mysqldb','../../components/integrations/configuration','status','json','offset','undefined','count','set','Content-Range','update','destroy','then','sendStatus','error','stack','name','send','map','Dynamics365Account','type','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','sort','where','pick','merge','VIRTUAL','includeAll','include','catch','show','options','find','create','body','params','getConfigurations','findOne','Dynamics365Configuration','rawAttributes','order','filter','addConfiguration','AccountId','Subjects','channel','Descriptions','getDescriptions','Dynamics365Field','slice','substring','lastIndexOf','%s/api/data/v9.0/','getFields','ticketType','incident','PhoneCall','title','description','ownerid','caseorigincode','subject','regardingobjectid','directioncode','phonecall_activity_parties','accountidyominame','actualserviceunits','billedserviceunits','contactidname','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdon','createdonbehalfbyyominame','customeridname','customeridtype','customeridyominame','entitlementidname','entityimage_timestamp','entityimage_url','exchangerate','firstresponsebykpiidname','followupby','importsequencenumber','kbarticleidname','lastonholdtime','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','onholdtime','overriddencreatedon','owneridname','owneridyominame','parentcaseidname','primarycontactidyominame','prioritycodename','productserialnumber','resolveby','responseby','sentimentvalue','slainvokedidname','slaname','socialprofileidname','statecode','statuscode','subjectidname','ticketnumber','timezoneruleversionnumber','traversedpath','versionnumber','username','password','remoteUri','tenantId','clientId','modernAuthentication','CloudProvider','data5','data7','access_token','POST','https://login.microsoftonline.com/','/oauth2/token','clientSecret','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','value','MetadataId','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Attributes','remove'];(function(_0x3f8f75,_0x2b066a){var _0x1104d3=function(_0x165246){while(--_0x165246){_0x3f8f75['push'](_0x3f8f75['shift']());}};_0x1104d3(++_0x2b066a);}(_0x0868,0xdf));var _0x8086=function(_0x15490a,_0x56db92){_0x15490a=_0x15490a-0x0;var _0x5a0f51=_0x0868[_0x15490a];return _0x5a0f51;};'use strict';var rp=require(_0x8086('0x0'));var util=require(_0x8086('0x1'));var _=require(_0x8086('0x2'));var qs=require(_0x8086('0x3'));var logger=require('../../config/logger')(_0x8086('0x4'));var db=require(_0x8086('0x5'))['db'];var integrations=require(_0x8086('0x6'));function respondWithResult(_0x29c56b,_0x4d0c84){_0x4d0c84=_0x4d0c84||0xc8;return function(_0x1ee35f){if(_0x1ee35f){return _0x29c56b[_0x8086('0x7')](_0x4d0c84)[_0x8086('0x8')](_0x1ee35f);}};}function respondWithFilteredResult(_0x13e6e3,_0x2f44ae){return function(_0x4dc83f){if(_0x4dc83f){var _0x194280=typeof _0x2f44ae[_0x8086('0x9')]==='undefined'&&typeof _0x2f44ae['limit']===_0x8086('0xa');var _0x3ac1a3=_0x4dc83f[_0x8086('0xb')];var _0x31fa93=_0x194280?0x0:_0x2f44ae[_0x8086('0x9')];var _0x53c3da=_0x194280?_0x4dc83f[_0x8086('0xb')]:_0x2f44ae[_0x8086('0x9')]+_0x2f44ae['limit'];var _0x4a671d;if(_0x53c3da>=_0x3ac1a3){_0x53c3da=_0x3ac1a3;_0x4a671d=0xc8;}else{_0x4a671d=0xce;}_0x13e6e3['status'](_0x4a671d);return _0x13e6e3[_0x8086('0xc')](_0x8086('0xd'),_0x31fa93+'-'+_0x53c3da+'/'+_0x3ac1a3)['json'](_0x4dc83f);}return null;};}function saveUpdates(_0x1b979a){return function(_0x2eac44){if(_0x2eac44){return _0x2eac44[_0x8086('0xe')](_0x1b979a)['then'](function(_0x415283){return _0x415283;});}return null;};}function removeEntity(_0x517118){return function(_0x37327b){if(_0x37327b){return _0x37327b[_0x8086('0xf')]()[_0x8086('0x10')](function(){_0x517118[_0x8086('0x7')](0xcc)['end']();});}};}function handleEntityNotFound(_0x16ec8a){return function(_0x6195c0){if(!_0x6195c0){_0x16ec8a[_0x8086('0x11')](0x194);}return _0x6195c0;};}function handleError(_0x43187b,_0x402a25){_0x402a25=_0x402a25||0x1f4;return function(_0x8bbaf4){logger[_0x8086('0x12')](_0x8bbaf4[_0x8086('0x13')]);if(_0x8bbaf4['name']){delete _0x8bbaf4[_0x8086('0x14')];}_0x43187b[_0x8086('0x7')](_0x402a25)[_0x8086('0x15')](_0x8bbaf4);};}exports['index']=function(_0x497596,_0x4d6818){var _0x214588={},_0x42699c={},_0x11edbe={'count':0x0,'rows':[]};var _0x2be465=_[_0x8086('0x16')](db[_0x8086('0x17')]['rawAttributes'],function(_0x1fccd1){return{'name':_0x1fccd1['fieldName'],'type':_0x1fccd1[_0x8086('0x18')]['key']};});_0x42699c[_0x8086('0x19')]=_[_0x8086('0x16')](_0x2be465,_0x8086('0x14'));_0x42699c['query']=_[_0x8086('0x1a')](_0x497596[_0x8086('0x1b')]);_0x42699c[_0x8086('0x1c')]=_['intersection'](_0x42699c[_0x8086('0x19')],_0x42699c[_0x8086('0x1b')]);_0x214588['attributes']=_[_0x8086('0x1d')](_0x42699c[_0x8086('0x19')],qs['fields'](_0x497596[_0x8086('0x1b')][_0x8086('0x1e')]));_0x214588['attributes']=_0x214588[_0x8086('0x1f')][_0x8086('0x20')]?_0x214588[_0x8086('0x1f')]:_0x42699c[_0x8086('0x19')];if(!_0x497596['query'][_0x8086('0x21')](_0x8086('0x22'))){_0x214588['limit']=qs[_0x8086('0x23')](_0x497596['query']['limit']);_0x214588[_0x8086('0x9')]=qs['offset'](_0x497596['query'][_0x8086('0x9')]);}_0x214588['order']=qs[_0x8086('0x24')](_0x497596[_0x8086('0x1b')][_0x8086('0x24')]);_0x214588[_0x8086('0x25')]=qs['filters'](_[_0x8086('0x26')](_0x497596[_0x8086('0x1b')],_0x42699c[_0x8086('0x1c')]),_0x2be465);if(_0x497596[_0x8086('0x1b')]['filter']){_0x214588['where']=_[_0x8086('0x27')](_0x214588['where'],{'$or':_[_0x8086('0x16')](_0x2be465,function(_0x59f3d0){if(_0x59f3d0[_0x8086('0x18')]!==_0x8086('0x28')){var _0xdaa138={};_0xdaa138[_0x59f3d0[_0x8086('0x14')]]={'$like':'%'+_0x497596[_0x8086('0x1b')]['filter']+'%'};return _0xdaa138;}})});}_0x214588=_['merge']({},_0x214588,_0x497596['options']);var _0x517690={'where':_0x214588[_0x8086('0x25')]};return db[_0x8086('0x17')][_0x8086('0xb')](_0x517690)[_0x8086('0x10')](function(_0x5527c5){_0x11edbe[_0x8086('0xb')]=_0x5527c5;if(_0x497596[_0x8086('0x1b')][_0x8086('0x29')]){_0x214588[_0x8086('0x2a')]=[{'all':!![]}];}return db[_0x8086('0x17')]['findAll'](_0x214588);})['then'](function(_0x3146ed){_0x11edbe['rows']=_0x3146ed;return _0x11edbe;})[_0x8086('0x10')](respondWithFilteredResult(_0x4d6818,_0x214588))[_0x8086('0x2b')](handleError(_0x4d6818,null));};exports[_0x8086('0x2c')]=function(_0x110311,_0x1fe6fd){var _0x1af1fe={'raw':![],'where':{'id':_0x110311['params']['id']}},_0x49e00a={};_0x49e00a[_0x8086('0x19')]=_[_0x8086('0x1a')](db['Dynamics365Account']['rawAttributes']);_0x49e00a[_0x8086('0x1b')]=_['keys'](_0x110311[_0x8086('0x1b')]);_0x49e00a[_0x8086('0x1c')]=_[_0x8086('0x1d')](_0x49e00a['model'],_0x49e00a[_0x8086('0x1b')]);_0x1af1fe[_0x8086('0x1f')]=_['intersection'](_0x49e00a[_0x8086('0x19')],qs[_0x8086('0x1e')](_0x110311['query']['fields']));_0x1af1fe[_0x8086('0x1f')]=_0x1af1fe[_0x8086('0x1f')][_0x8086('0x20')]?_0x1af1fe['attributes']:_0x49e00a[_0x8086('0x19')];if(_0x110311[_0x8086('0x1b')][_0x8086('0x29')]){_0x1af1fe[_0x8086('0x2a')]=[{'all':!![]}];}_0x1af1fe=_[_0x8086('0x27')]({},_0x1af1fe,_0x110311[_0x8086('0x2d')]);return db[_0x8086('0x17')][_0x8086('0x2e')](_0x1af1fe)[_0x8086('0x10')](handleEntityNotFound(_0x1fe6fd,null))[_0x8086('0x10')](respondWithResult(_0x1fe6fd,null))[_0x8086('0x2b')](handleError(_0x1fe6fd,null));};exports[_0x8086('0x2f')]=function(_0x1f3914,_0xe7fbf6){return db[_0x8086('0x17')][_0x8086('0x2f')](_0x1f3914[_0x8086('0x30')],{})['then'](respondWithResult(_0xe7fbf6,0xc9))[_0x8086('0x2b')](handleError(_0xe7fbf6,null));};exports[_0x8086('0xe')]=function(_0x165fa3,_0x406255){if(_0x165fa3[_0x8086('0x30')]['id']){delete _0x165fa3['body']['id'];}return db['Dynamics365Account']['find']({'where':{'id':_0x165fa3['params']['id']}})['then'](handleEntityNotFound(_0x406255,null))[_0x8086('0x10')](saveUpdates(_0x165fa3['body'],null))[_0x8086('0x10')](respondWithResult(_0x406255,null))[_0x8086('0x2b')](handleError(_0x406255,null));};exports[_0x8086('0xf')]=function(_0x44999c,_0x55f7a1){return db[_0x8086('0x17')][_0x8086('0x2e')]({'where':{'id':_0x44999c[_0x8086('0x31')]['id']}})[_0x8086('0x10')](handleEntityNotFound(_0x55f7a1,null))[_0x8086('0x10')](removeEntity(_0x55f7a1,null))['catch'](handleError(_0x55f7a1,null));};exports[_0x8086('0x32')]=function(_0x3af131,_0x479a41){var _0x3e35e8={};var _0x24239b={};var _0x355004;var _0x2f932b;return db['Dynamics365Account'][_0x8086('0x33')]({'where':{'id':_0x3af131[_0x8086('0x31')]['id']}})[_0x8086('0x10')](handleEntityNotFound(_0x479a41,null))['then'](function(_0x45ef5c){if(_0x45ef5c){_0x355004=_0x45ef5c;_0x24239b[_0x8086('0x19')]=_[_0x8086('0x1a')](db[_0x8086('0x34')][_0x8086('0x35')]);_0x24239b['query']=_['keys'](_0x3af131[_0x8086('0x1b')]);_0x24239b[_0x8086('0x1c')]=_[_0x8086('0x1d')](_0x24239b[_0x8086('0x19')],_0x24239b[_0x8086('0x1b')]);_0x3e35e8['attributes']=_['intersection'](_0x24239b['model'],qs['fields'](_0x3af131[_0x8086('0x1b')][_0x8086('0x1e')]));_0x3e35e8[_0x8086('0x1f')]=_0x3e35e8[_0x8086('0x1f')][_0x8086('0x20')]?_0x3e35e8[_0x8086('0x1f')]:_0x24239b[_0x8086('0x19')];_0x3e35e8[_0x8086('0x36')]=qs[_0x8086('0x24')](_0x3af131[_0x8086('0x1b')][_0x8086('0x24')]);_0x3e35e8[_0x8086('0x25')]=qs[_0x8086('0x1c')](_[_0x8086('0x26')](_0x3af131['query'],_0x24239b['filters']));if(_0x3af131[_0x8086('0x1b')]['filter']){_0x3e35e8[_0x8086('0x25')]=_[_0x8086('0x27')](_0x3e35e8[_0x8086('0x25')],{'$or':_[_0x8086('0x16')](_0x3e35e8[_0x8086('0x1f')],function(_0x4f0d0a){var _0x55f6d0={};_0x55f6d0[_0x4f0d0a]={'$like':'%'+_0x3af131[_0x8086('0x1b')][_0x8086('0x37')]+'%'};return _0x55f6d0;})});}_0x3e35e8=_[_0x8086('0x27')]({},_0x3e35e8,_0x3af131[_0x8086('0x2d')]);return _0x355004[_0x8086('0x32')](_0x3e35e8);}})[_0x8086('0x10')](function(_0x4da725){if(_0x4da725){_0x2f932b=_0x4da725[_0x8086('0x20')];if(!_0x3af131[_0x8086('0x1b')][_0x8086('0x21')](_0x8086('0x22'))){_0x3e35e8[_0x8086('0x23')]=qs['limit'](_0x3af131[_0x8086('0x1b')][_0x8086('0x23')]);_0x3e35e8[_0x8086('0x9')]=qs[_0x8086('0x9')](_0x3af131[_0x8086('0x1b')][_0x8086('0x9')]);}return _0x355004[_0x8086('0x32')](_0x3e35e8);}})[_0x8086('0x10')](function(_0x583758){if(_0x583758){return _0x583758?{'count':_0x2f932b,'rows':_0x583758}:null;}})[_0x8086('0x10')](respondWithResult(_0x479a41,null))[_0x8086('0x2b')](handleError(_0x479a41,null));};exports[_0x8086('0x38')]=function(_0x20a6ed,_0x5a2ad4){if(_0x20a6ed[_0x8086('0x30')]['id']){delete _0x20a6ed['body']['id'];}return db[_0x8086('0x17')][_0x8086('0x33')]({'where':{'id':_0x20a6ed[_0x8086('0x31')]['id']}})[_0x8086('0x10')](handleEntityNotFound(_0x5a2ad4,null))['then'](function(_0x282891){if(_0x282891){_0x20a6ed['body'][_0x8086('0x39')]=_0x282891['id'];_0x20a6ed[_0x8086('0x30')][_0x8086('0x3a')]=integrations['getSubjects'](_0x20a6ed['body'][_0x8086('0x3b')],_0x20a6ed[_0x8086('0x30')][_0x8086('0x18')]);_0x20a6ed[_0x8086('0x30')][_0x8086('0x3c')]=integrations[_0x8086('0x3d')](_0x20a6ed[_0x8086('0x30')][_0x8086('0x3b')],_0x20a6ed[_0x8086('0x30')][_0x8086('0x18')]);return db[_0x8086('0x34')][_0x8086('0x2f')](_0x20a6ed[_0x8086('0x30')],{'include':[{'model':db[_0x8086('0x3e')],'as':_0x8086('0x3a')},{'model':db['Dynamics365Field'],'as':_0x8086('0x3c')}]});}return null;})['then'](respondWithResult(_0x5a2ad4,null))[_0x8086('0x2b')](handleError(_0x5a2ad4,null));};function sanitizeRemoteUri(_0x22c1c5){var _0x367d7a=_0x22c1c5[_0x8086('0x3f')](-0x1);if(_0x367d7a==='/')return _0x22c1c5[_0x8086('0x40')](0x0,_0x22c1c5[_0x8086('0x41')](_0x367d7a));return _0x22c1c5;}function getWebApiUrl(_0x1afdf2){return util['format'](_0x8086('0x42'),_0x1afdf2);}exports[_0x8086('0x43')]=function(_0x462698,_0x4607e2){var _0x5081d3=_0x462698[_0x8086('0x1b')][_0x8086('0x44')];var _0x3e66cb=_0x5081d3===_0x8086('0x45')?'Incident':_0x8086('0x46');var _0x4c913c='';var _0x16206c='';var _0x17b7f4='';var _0x1f08ce='';var _0x5a6cc4='';var _0x2aee23='';var _0x2ec353='';var _0x21d865='';var _0x102ced=[_0x8086('0x47'),_0x8086('0x48'),'customerid',_0x8086('0x49'),_0x8086('0x4a'),_0x8086('0x4b'),'phonenumber',_0x8086('0x4c'),_0x8086('0x4d'),_0x8086('0x4e')];var _0x1193a9=['accountidname',_0x8086('0x4f'),_0x8086('0x50'),_0x8086('0x51'),_0x8086('0x52'),_0x8086('0x53'),_0x8086('0x54'),_0x8086('0x55'),_0x8086('0x56'),_0x8086('0x57'),_0x8086('0x58'),'createdbyyominame',_0x8086('0x59'),'createdonbehalfbyname',_0x8086('0x5a'),_0x8086('0x5b'),_0x8086('0x5c'),_0x8086('0x5d'),'emailaddress',_0x8086('0x5e'),_0x8086('0x5f'),_0x8086('0x60'),'escalatedon',_0x8086('0x61'),_0x8086('0x62'),_0x8086('0x63'),_0x8086('0x64'),'influencescore',_0x8086('0x65'),_0x8086('0x66'),'masteridname',_0x8086('0x67'),_0x8086('0x68'),'modifiedbyname',_0x8086('0x69'),_0x8086('0x6a'),_0x8086('0x6b'),_0x8086('0x6c'),_0x8086('0x6d'),_0x8086('0x6e'),_0x8086('0x6f'),_0x8086('0x70'),_0x8086('0x71'),_0x8086('0x72'),'owneridtype',_0x8086('0x73'),_0x8086('0x74'),'primarycontactidname',_0x8086('0x75'),_0x8086('0x76'),'productidname',_0x8086('0x77'),_0x8086('0x78'),'resolvebykpiidname',_0x8086('0x79'),'responsiblecontactidname','responsiblecontactidyominame',_0x8086('0x7a'),_0x8086('0x7b'),_0x8086('0x7c'),_0x8086('0x7d'),_0x8086('0x7e'),_0x8086('0x7f'),_0x8086('0x80'),_0x8086('0x81'),_0x8086('0x82'),'transactioncurrencyidname',_0x8086('0x83'),'utcconversiontimezonecode',_0x8086('0x84')];var _0x5f0b27=_0x102ced['concat'](_0x1193a9);return db[_0x8086('0x17')][_0x8086('0x33')]({'where':{'id':_0x462698[_0x8086('0x31')]['id']},'attributes':['id',_0x8086('0x85'),_0x8086('0x86'),_0x8086('0x87'),_0x8086('0x88'),_0x8086('0x89'),'clientSecret',_0x8086('0x8a')],'include':[{'model':db['CloudProvider'],'as':_0x8086('0x8b'),'attributes':['id',_0x8086('0x8c'),_0x8086('0x8d')]}]})[_0x8086('0x10')](handleEntityNotFound(_0x4607e2,null))[_0x8086('0x10')](function(_0xe246c2){if(_0xe246c2){if(_0xe246c2[_0x8086('0x8a')]){_0xe246c2[_0x8086('0x8e')]=_0xe246c2[_0x8086('0x8b')][_0x8086('0x8c')];_0x21d865=sanitizeRemoteUri(_0xe246c2[_0x8086('0x8b')]['data7']);_0x2ec353=getWebApiUrl(_0x21d865);return _0xe246c2;}_0x21d865=sanitizeRemoteUri(_0xe246c2[_0x8086('0x87')]);_0x2ec353=getWebApiUrl(_0x21d865);var _0x1b0a8c={'method':_0x8086('0x8f'),'uri':_0x8086('0x90')+_0xe246c2[_0x8086('0x88')]+_0x8086('0x91'),'form':{'client_id':_0xe246c2[_0x8086('0x89')],'resource':_0x21d865,'username':_0xe246c2[_0x8086('0x85')],'password':_0xe246c2[_0x8086('0x86')],'grant_type':'password','client_secret':_0xe246c2[_0x8086('0x92')]},'json':!![]};return rp(_0x1b0a8c);}})[_0x8086('0x10')](function(_0x5521b2){_0x2aee23=_0x5521b2[_0x8086('0x8e')];var _0x26da62={'method':_0x8086('0x93'),'uri':encodeURI(_0x2ec353+_0x8086('0x94')+_0x3e66cb+'\x27'),'headers':{'Authorization':_0x8086('0x95')+_0x2aee23,'If-None-Match':null,'OData-Version':_0x8086('0x96')},'json':!![]};return rp(_0x26da62);})[_0x8086('0x10')](function(_0x3810e1){var _0x1f24cf=_0x3810e1[_0x8086('0x97')][0x0];var _0x58c735=_0x1f24cf[_0x8086('0x98')];var _0x5c07ce={'method':'GET','uri':_0x2ec353+_0x8086('0x99')+_0x58c735+_0x8086('0x9a'),'headers':{'Authorization':_0x8086('0x95')+_0x2aee23,'If-None-Match':null,'OData-Version':_0x8086('0x96')},'json':!![]};return rp(_0x5c07ce);})[_0x8086('0x10')](function(_0x2c844a){_0x4c913c=_0x2c844a;_0x16206c=_0x4c913c[_0x8086('0x9b')];_0x16206c=_[_0x8086('0x9c')](_0x16206c,function(_0x4e69cd){return!_0x5f0b27[_0x8086('0x9d')](_0x4e69cd[_0x8086('0x9e')]);});var _0x4dbf54=[];var _0x2a760d=[];_0x16206c[_0x8086('0x9f')](function(_0x10f391){if(_0x10f391[_0x8086('0xa0')]){var _0x500c52=_0x10f391[_0x8086('0xa0')][_0x8086('0x40')](_0x10f391[_0x8086('0xa0')]['lastIndexOf']('.')+0x1);if(_0x500c52===_0x8086('0xa1')){_0x4dbf54[_0x8086('0xa2')](getSelectList(_0x2ec353,_0x5081d3,_0x2a760d,_0x4c913c[_0x8086('0x98')],_0x10f391[_0x8086('0x98')],_0x2aee23));}}});return Promise['all'](_0x4dbf54);})[_0x8086('0x10')](function(_0x44276e){_0x17b7f4=_0x44276e[0x0];var _0x1e0a27=[];var _0x52ca08=[];_0x16206c[_0x8086('0x9f')](function(_0x5782b3){if(!_[_0x8086('0xa3')](_0x5782b3[_0x8086('0xa0')])){var _0x1e6115=_0x5782b3[_0x8086('0xa0')]['substring'](_0x5782b3[_0x8086('0xa0')][_0x8086('0x41')]('.')+0x1);if(_0x1e6115===_0x8086('0xa4')){_0x1e0a27[_0x8086('0xa2')](getBooleanList(_0x2ec353,_0x5081d3,_0x52ca08,_0x4c913c[_0x8086('0x98')],_0x5782b3[_0x8086('0x98')],_0x2aee23));}}});return Promise['all'](_0x1e0a27);})[_0x8086('0x10')](function(_0x5a5e0b){_0x1f08ce=_0x5a5e0b[0x0];var _0x40cf87=[];var _0x286302=[];_0x16206c[_0x8086('0x9f')](function(_0x110aa9){if(_0x110aa9[_0x8086('0xa0')]){var _0x2a5ac4=_0x110aa9['@odata.type'][_0x8086('0x40')](_0x110aa9[_0x8086('0xa0')][_0x8086('0x41')]('.')+0x1);if(_0x2a5ac4===_0x8086('0xa5')||_0x2a5ac4===_0x8086('0xa6')||_0x2a5ac4===_0x8086('0xa7')||_0x2a5ac4===_0x8086('0xa8')||_0x2a5ac4===_0x8086('0xa9')||_0x2a5ac4===_0x8086('0xaa')||_0x2a5ac4===_0x8086('0xab')||_0x2a5ac4==='EntityNameAttributeMetadata'||_0x2a5ac4===_0x8086('0xac')||_0x2a5ac4===_0x8086('0xad')){_0x40cf87[_0x8086('0xa2')](getInputList(_0x2ec353,_0x5081d3,_0x2a5ac4,_0x286302,_0x4c913c[_0x8086('0x98')],_0x110aa9['MetadataId'],_0x2aee23));}}});return Promise[_0x8086('0xae')](_0x40cf87);})[_0x8086('0x10')](function(_0xa2caac){_0x5a6cc4=_0xa2caac[0x0];var _0x4a75cf=_0x17b7f4[_0x8086('0xaf')](_0x1f08ce)['concat'](_0x5a6cc4);var _0x9d8b6c={'count':_0x4a75cf[_0x8086('0x20')],'rows':_0x4a75cf};return _0x9d8b6c;})[_0x8086('0x10')](respondWithResult(_0x4607e2,null))['catch'](function(_0xb139f9){var _0x491d2e=_0x462698[_0x8086('0x1b')][_0x8086('0xb0')]?0x1f4:_0xb139f9[_0x8086('0xb1')]||0x1f4;logger[_0x8086('0x12')](_0xb139f9[_0x8086('0x13')]);delete _0xb139f9[_0x8086('0x14')];if(_0x491d2e===0x191){_0x491d2e=0x190;}_0x4607e2[_0x8086('0x7')](_0x491d2e)['send'](_0x462698[_0x8086('0x1b')][_0x8086('0xb0')]?{'message':_0x8086('0xb2'),'statusCode':_0xb139f9[_0x8086('0xb1')]}:_0xb139f9);});};function getSelectList(_0x2d518e,_0x5d60f1,_0x5ca488,_0x5c0921,_0x87184d,_0x10a2e6){var _0x590f07={'method':_0x8086('0x93'),'uri':_0x2d518e+'EntityDefinitions('+_0x5c0921+_0x8086('0xb3')+_0x87184d+_0x8086('0xb4')+'$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','headers':{'Authorization':_0x8086('0x95')+_0x10a2e6,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x590f07)[_0x8086('0x10')](function(_0x1113d4){var _0x37a104=[];var _0x59c02f=_0x1113d4['OptionSet']['Options'];_0x59c02f[_0x8086('0x9f')](function(_0x4ab66b){_0x37a104['push']({'name':_0x4ab66b[_0x8086('0xb5')]['UserLocalizedLabel']['Label'],'value':String(_0x4ab66b['Value'])});});var _0x4a184d={'id':_0x5d60f1+'_'+_0x1113d4['LogicalName'],'name':_0x1113d4[_0x8086('0xb6')]['UserLocalizedLabel']['Label'],'custom':![],'options':_0x37a104};_0x5ca488[_0x8086('0xa2')](_0x4a184d);return _0x5ca488;});}function getBooleanList(_0x3e026f,_0x30212c,_0x13d430,_0x463610,_0x4ce06d,_0x11f143){var _0x4a2156={'method':_0x8086('0x93'),'uri':_0x3e026f+_0x8086('0x99')+_0x463610+_0x8086('0xb3')+_0x4ce06d+_0x8086('0xb7'),'headers':{'Authorization':_0x8086('0x95')+_0x11f143,'If-None-Match':null,'OData-Version':_0x8086('0x96')},'json':!![]};return rp(_0x4a2156)['then'](function(_0x107ca0){var _0x5ddb17=[];_0x5ddb17[_0x8086('0xa2')]({'name':_0x107ca0[_0x8086('0xb8')]['TrueOption'][_0x8086('0xb5')][_0x8086('0xb9')][_0x8086('0xb5')],'value':'true'},{'name':_0x107ca0[_0x8086('0xb8')][_0x8086('0xba')][_0x8086('0xb5')][_0x8086('0xb9')][_0x8086('0xb5')],'value':_0x8086('0xbb')});var _0x8c8297={'id':_0x30212c+'_'+_0x107ca0[_0x8086('0x9e')],'name':_0x107ca0['DisplayName'][_0x8086('0xb9')][_0x8086('0xb5')],'custom':![],'options':_0x5ddb17};_0x13d430[_0x8086('0xa2')](_0x8c8297);return _0x13d430;});}function getInputList(_0x56d535,_0x1dc855,_0x460049,_0x39448f,_0x15ca11,_0x5029d0,_0x1edf8d){var _0x3b7273={'method':'GET','uri':_0x56d535+_0x8086('0x99')+_0x15ca11+_0x8086('0xb3')+_0x5029d0+_0x8086('0xbc')+_0x460049+_0x8086('0xbd'),'headers':{'Authorization':_0x8086('0x95')+_0x1edf8d,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x3b7273)[_0x8086('0x10')](function(_0x4f171c){var _0x36fce4={'id':_0x1dc855+'_'+_0x4f171c[_0x8086('0x9e')],'name':_0x4f171c[_0x8086('0xb6')]['UserLocalizedLabel']?_0x4f171c[_0x8086('0xb6')][_0x8086('0xb9')]['Label']:_0x4f171c[_0x8086('0x9e')],'custom':![],'options':[]};_0x39448f[_0x8086('0xa2')](_0x36fce4);return _0x39448f;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index b87a406..54c5063 100644 --- a/server/api/intDynamics365Account/intDynamics365Account.model.js +++ b/server/api/intDynamics365Account/intDynamics365Account.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb7e7=['int_dynamics365_accounts','lodash','../../config/logger','moment','request-promise','rimraf','../../config/environment','./intDynamics365Account.attributes','define'];(function(_0x2a8d9b,_0x328437){var _0x8d17a4=function(_0x1ef1fe){while(--_0x1ef1fe){_0x2a8d9b['push'](_0x2a8d9b['shift']());}};_0x8d17a4(++_0x328437);}(_0xb7e7,0x121));var _0x7b7e=function(_0x68ee8b,_0x3cc6c5){_0x68ee8b=_0x68ee8b-0x0;var _0x5148f7=_0xb7e7[_0x68ee8b];return _0x5148f7;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var logger=require(_0x7b7e('0x1'))('api');var moment=require(_0x7b7e('0x2'));var BPromise=require('bluebird');var rp=require(_0x7b7e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7b7e('0x4'));var config=require(_0x7b7e('0x5'));var attributes=require(_0x7b7e('0x6'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x333fa4,_0x372bde){return _0x333fa4[_0x7b7e('0x7')]('Dynamics365Account',attributes,{'tableName':_0x7b7e('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd8b0=['exports','Dynamics365Account','int_dynamics365_accounts','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x1da598,_0x265258){var _0x516235=function(_0xc87887){while(--_0xc87887){_0x1da598['push'](_0x1da598['shift']());}};_0x516235(++_0x265258);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0d8b('0x2'));var rp=require(_0x0d8b('0x3'));var fs=require('fs');var path=require(_0x0d8b('0x4'));var rimraf=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var attributes=require('./intDynamics365Account.attributes');var integrations=require('../../components/integrations/configuration');module[_0x0d8b('0x7')]=function(_0x227c63,_0x39f43a){return _0x227c63['define'](_0x0d8b('0x8'),attributes,{'tableName':_0x0d8b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.rpc.js b/server/api/intDynamics365Account/intDynamics365Account.rpc.js index 6b82bf7..3b4af73 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 _0x36dc=['bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetDynamics365Account','findAll','options','raw','where','attributes','map','include','model','ShowDynamics365Account','Dynamics365Account','find','util','moment'];(function(_0x286ce7,_0x4479f7){var _0x558579=function(_0x226a9b){while(--_0x226a9b){_0x286ce7['push'](_0x286ce7['shift']());}};_0x558579(++_0x4479f7);}(_0x36dc,0xec));var _0xc36d=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x36dc[_0x2641f9];return _0x585741;};'use strict';var _=require('lodash');var util=require(_0xc36d('0x0'));var moment=require(_0xc36d('0x1'));var BPromise=require(_0xc36d('0x2'));var rs=require(_0xc36d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xc36d('0x4'));var logger=require(_0xc36d('0x5'))(_0xc36d('0x6'));var config=require(_0xc36d('0x7'));var jayson=require(_0xc36d('0x8'));var client=jayson['client'][_0xc36d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3956bd,_0x37ccbc,_0x3609e0){return new BPromise(function(_0x5c57f8,_0x4e163c){return client[_0xc36d('0xa')](_0x3956bd,_0x3609e0)[_0xc36d('0xb')](function(_0x4db8fa){logger[_0xc36d('0xc')](_0xc36d('0xd'),_0x37ccbc,_0xc36d('0xe'));logger[_0xc36d('0xf')]('Dynamics365Account,\x20%s,\x20%s,\x20%s',_0x37ccbc,_0xc36d('0xe'),JSON[_0xc36d('0x10')](_0x4db8fa));if(_0x4db8fa[_0xc36d('0x11')]){if(_0x4db8fa[_0xc36d('0x11')][_0xc36d('0x12')]===0x1f4){logger['error'](_0xc36d('0xd'),_0x37ccbc,_0x4db8fa[_0xc36d('0x11')][_0xc36d('0x13')]);return _0x4e163c(_0x4db8fa[_0xc36d('0x11')][_0xc36d('0x13')]);}logger[_0xc36d('0x11')](_0xc36d('0xd'),_0x37ccbc,_0x4db8fa[_0xc36d('0x11')][_0xc36d('0x13')]);return _0x5c57f8(_0x4db8fa[_0xc36d('0x11')][_0xc36d('0x13')]);}else{logger['info'](_0xc36d('0xd'),_0x37ccbc,_0xc36d('0xe'));_0x5c57f8(_0x4db8fa[_0xc36d('0x14')]['message']);}})[_0xc36d('0x15')](function(_0xd2e81d){logger['error'](_0xc36d('0xd'),_0x37ccbc,_0xd2e81d);_0x4e163c(_0xd2e81d);});});}exports[_0xc36d('0x16')]=function(_0x37dc51){var _0x37d9d9=this;return new Promise(function(_0x24d989,_0x46081f){return db['Dynamics365Account'][_0xc36d('0x17')]({'raw':_0x37dc51['options']?_0x37dc51[_0xc36d('0x18')][_0xc36d('0x19')]===undefined?!![]:![]:!![],'where':_0x37dc51[_0xc36d('0x18')]?_0x37dc51['options'][_0xc36d('0x1a')]||null:null,'attributes':_0x37dc51['options']?_0x37dc51[_0xc36d('0x18')][_0xc36d('0x1b')]||null:null,'limit':_0x37dc51[_0xc36d('0x18')]?_0x37dc51[_0xc36d('0x18')]['limit']||null:null,'include':_0x37dc51[_0xc36d('0x18')]?_0x37dc51[_0xc36d('0x18')]['include']?_[_0xc36d('0x1c')](_0x37dc51[_0xc36d('0x18')][_0xc36d('0x1d')],function(_0x4476af){return{'model':db[_0x4476af[_0xc36d('0x1e')]],'as':_0x4476af['as'],'attributes':_0x4476af['attributes'],'include':_0x4476af['include']?_[_0xc36d('0x1c')](_0x4476af[_0xc36d('0x1d')],function(_0x9078b9){return{'model':db[_0x9078b9[_0xc36d('0x1e')]],'as':_0x9078b9['as'],'attributes':_0x9078b9['attributes'],'include':_0x9078b9[_0xc36d('0x1d')]?_[_0xc36d('0x1c')](_0x9078b9[_0xc36d('0x1d')],function(_0x588bf3){return{'model':db[_0x588bf3[_0xc36d('0x1e')]],'as':_0x588bf3['as'],'attributes':_0x588bf3['attributes']};}):[]};}):[]};}):[]:[]})[_0xc36d('0xb')](function(_0x4d7c0a){logger[_0xc36d('0xc')](_0xc36d('0x16'),_0x37dc51);logger['debug'](_0xc36d('0x16'),_0x37dc51,JSON[_0xc36d('0x10')](_0x4d7c0a));_0x24d989(_0x4d7c0a);})[_0xc36d('0x15')](function(_0x2a19de){logger[_0xc36d('0x11')](_0xc36d('0x16'),_0x2a19de[_0xc36d('0x13')],_0x37dc51);_0x46081f(_0x37d9d9[_0xc36d('0x11')](0x1f4,_0x2a19de[_0xc36d('0x13')]));});});};exports[_0xc36d('0x1f')]=function(_0x1caff4){var _0x54f959=this;return new Promise(function(_0x2f20f7,_0x102932){return db[_0xc36d('0x20')][_0xc36d('0x21')]({'raw':_0x1caff4[_0xc36d('0x18')]?_0x1caff4['options'][_0xc36d('0x19')]===undefined?!![]:![]:!![],'where':_0x1caff4[_0xc36d('0x18')]?_0x1caff4[_0xc36d('0x18')][_0xc36d('0x1a')]||null:null,'attributes':_0x1caff4[_0xc36d('0x18')]?_0x1caff4['options'][_0xc36d('0x1b')]||null:null,'include':_0x1caff4['options']?_0x1caff4[_0xc36d('0x18')][_0xc36d('0x1d')]?_[_0xc36d('0x1c')](_0x1caff4[_0xc36d('0x18')]['include'],function(_0x3fef8c){return{'model':db[_0x3fef8c[_0xc36d('0x1e')]],'as':_0x3fef8c['as'],'attributes':_0x3fef8c[_0xc36d('0x1b')],'include':_0x3fef8c[_0xc36d('0x1d')]?_['map'](_0x3fef8c[_0xc36d('0x1d')],function(_0x5b5513){return{'model':db[_0x5b5513[_0xc36d('0x1e')]],'as':_0x5b5513['as'],'attributes':_0x5b5513[_0xc36d('0x1b')],'include':_0x5b5513[_0xc36d('0x1d')]?_['map'](_0x5b5513[_0xc36d('0x1d')],function(_0x3db502){return{'model':db[_0x3db502[_0xc36d('0x1e')]],'as':_0x3db502['as'],'attributes':_0x3db502[_0xc36d('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xc36d('0xb')](function(_0x2f3256){logger[_0xc36d('0xc')](_0xc36d('0x1f'),_0x1caff4);logger[_0xc36d('0xf')](_0xc36d('0x1f'),_0x1caff4,JSON[_0xc36d('0x10')](_0x2f3256));_0x2f20f7(_0x2f3256);})['catch'](function(_0x19485e){logger['error'](_0xc36d('0x1f'),_0x19485e[_0xc36d('0x13')],_0x1caff4);_0x102932(_0x54f959[_0xc36d('0x11')](0x1f4,_0x19485e[_0xc36d('0x13')]));});});}; \ No newline at end of file +var _0x996c=['options','raw','where','attributes','limit','include','map','model','ShowDynamics365Account','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','request','then','info','Dynamics365Account,\x20%s,\x20%s','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetDynamics365Account','Dynamics365Account','findAll'];(function(_0x257e65,_0x3f4a68){var _0x3eef2f=function(_0x1c61e2){while(--_0x1c61e2){_0x257e65['push'](_0x257e65['shift']());}};_0x3eef2f(++_0x3f4a68);}(_0x996c,0x6f));var _0xc996=function(_0x59a18f,_0x4afe67){_0x59a18f=_0x59a18f-0x0;var _0x4c2323=_0x996c[_0x59a18f];return _0x4c2323;};'use strict';var _=require('lodash');var util=require(_0xc996('0x0'));var moment=require(_0xc996('0x1'));var BPromise=require(_0xc996('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc996('0x3'));var db=require(_0xc996('0x4'))['db'];var utils=require(_0xc996('0x5'));var logger=require(_0xc996('0x6'))(_0xc996('0x7'));var config=require(_0xc996('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x25bc80,_0x16a42f,_0x30561b){return new BPromise(function(_0x4f912b,_0x2701aa){return client[_0xc996('0x9')](_0x25bc80,_0x30561b)[_0xc996('0xa')](function(_0xff6b08){logger[_0xc996('0xb')](_0xc996('0xc'),_0x16a42f,'request\x20sent');logger[_0xc996('0xd')](_0xc996('0xe'),_0x16a42f,_0xc996('0xf'),JSON[_0xc996('0x10')](_0xff6b08));if(_0xff6b08[_0xc996('0x11')]){if(_0xff6b08[_0xc996('0x11')][_0xc996('0x12')]===0x1f4){logger[_0xc996('0x11')](_0xc996('0xc'),_0x16a42f,_0xff6b08[_0xc996('0x11')][_0xc996('0x13')]);return _0x2701aa(_0xff6b08[_0xc996('0x11')][_0xc996('0x13')]);}logger[_0xc996('0x11')](_0xc996('0xc'),_0x16a42f,_0xff6b08[_0xc996('0x11')][_0xc996('0x13')]);return _0x4f912b(_0xff6b08[_0xc996('0x11')][_0xc996('0x13')]);}else{logger[_0xc996('0xb')](_0xc996('0xc'),_0x16a42f,_0xc996('0xf'));_0x4f912b(_0xff6b08[_0xc996('0x14')][_0xc996('0x13')]);}})[_0xc996('0x15')](function(_0x2e98eb){logger['error'](_0xc996('0xc'),_0x16a42f,_0x2e98eb);_0x2701aa(_0x2e98eb);});});}exports[_0xc996('0x16')]=function(_0x23cec8){var _0x4acd4f=this;return new Promise(function(_0xc22fae,_0x1b7aa0){return db[_0xc996('0x17')][_0xc996('0x18')]({'raw':_0x23cec8[_0xc996('0x19')]?_0x23cec8['options'][_0xc996('0x1a')]===undefined?!![]:![]:!![],'where':_0x23cec8['options']?_0x23cec8[_0xc996('0x19')][_0xc996('0x1b')]||null:null,'attributes':_0x23cec8['options']?_0x23cec8[_0xc996('0x19')][_0xc996('0x1c')]||null:null,'limit':_0x23cec8[_0xc996('0x19')]?_0x23cec8['options'][_0xc996('0x1d')]||null:null,'include':_0x23cec8[_0xc996('0x19')]?_0x23cec8[_0xc996('0x19')][_0xc996('0x1e')]?_[_0xc996('0x1f')](_0x23cec8[_0xc996('0x19')][_0xc996('0x1e')],function(_0x2a7042){return{'model':db[_0x2a7042[_0xc996('0x20')]],'as':_0x2a7042['as'],'attributes':_0x2a7042[_0xc996('0x1c')],'include':_0x2a7042[_0xc996('0x1e')]?_[_0xc996('0x1f')](_0x2a7042[_0xc996('0x1e')],function(_0x5aefe1){return{'model':db[_0x5aefe1[_0xc996('0x20')]],'as':_0x5aefe1['as'],'attributes':_0x5aefe1[_0xc996('0x1c')],'include':_0x5aefe1[_0xc996('0x1e')]?_['map'](_0x5aefe1[_0xc996('0x1e')],function(_0x54617f){return{'model':db[_0x54617f['model']],'as':_0x54617f['as'],'attributes':_0x54617f[_0xc996('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xc996('0xa')](function(_0x16902b){logger[_0xc996('0xb')]('GetDynamics365Account',_0x23cec8);logger[_0xc996('0xd')](_0xc996('0x16'),_0x23cec8,JSON[_0xc996('0x10')](_0x16902b));_0xc22fae(_0x16902b);})[_0xc996('0x15')](function(_0x2aec81){logger['error'](_0xc996('0x16'),_0x2aec81[_0xc996('0x13')],_0x23cec8);_0x1b7aa0(_0x4acd4f[_0xc996('0x11')](0x1f4,_0x2aec81[_0xc996('0x13')]));});});};exports['ShowDynamics365Account']=function(_0x5bf782){var _0x35478a=this;return new Promise(function(_0x73badb,_0x3bd43b){return db[_0xc996('0x17')]['find']({'raw':_0x5bf782[_0xc996('0x19')]?_0x5bf782[_0xc996('0x19')][_0xc996('0x1a')]===undefined?!![]:![]:!![],'where':_0x5bf782[_0xc996('0x19')]?_0x5bf782[_0xc996('0x19')][_0xc996('0x1b')]||null:null,'attributes':_0x5bf782[_0xc996('0x19')]?_0x5bf782[_0xc996('0x19')]['attributes']||null:null,'include':_0x5bf782[_0xc996('0x19')]?_0x5bf782[_0xc996('0x19')][_0xc996('0x1e')]?_[_0xc996('0x1f')](_0x5bf782[_0xc996('0x19')]['include'],function(_0x4ec117){return{'model':db[_0x4ec117[_0xc996('0x20')]],'as':_0x4ec117['as'],'attributes':_0x4ec117['attributes'],'include':_0x4ec117[_0xc996('0x1e')]?_[_0xc996('0x1f')](_0x4ec117[_0xc996('0x1e')],function(_0x150ad1){return{'model':db[_0x150ad1[_0xc996('0x20')]],'as':_0x150ad1['as'],'attributes':_0x150ad1[_0xc996('0x1c')],'include':_0x150ad1[_0xc996('0x1e')]?_['map'](_0x150ad1['include'],function(_0x2f482c){return{'model':db[_0x2f482c[_0xc996('0x20')]],'as':_0x2f482c['as'],'attributes':_0x2f482c['attributes']};}):[]};}):[]};}):[]:[]})[_0xc996('0xa')](function(_0x104a79){logger[_0xc996('0xb')](_0xc996('0x21'),_0x5bf782);logger['debug'](_0xc996('0x21'),_0x5bf782,JSON[_0xc996('0x10')](_0x104a79));_0x73badb(_0x104a79);})['catch'](function(_0x1e764f){logger['error'](_0xc996('0x21'),_0x1e764f[_0xc996('0x13')],_0x5bf782);_0x3bd43b(_0x35478a[_0xc996('0x11')](0x1f4,_0x1e764f['message']));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index 0489ed9..eb956d3 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 _0x2baf=['get','isAuthenticated','index','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','./intDynamics365Configuration.controller'];(function(_0x27c90e,_0xd10579){var _0x734c18=function(_0xec725d){while(--_0xec725d){_0x27c90e['push'](_0x27c90e['shift']());}};_0x734c18(++_0xd10579);}(_0x2baf,0xc8));var _0xf2ba=function(_0x500785,_0x15e5ff){_0x500785=_0x500785-0x0;var _0x1f8bcc=_0x2baf[_0x500785];return _0x1f8bcc;};'use strict';var multer=require('multer');var util=require(_0xf2ba('0x0'));var path=require(_0xf2ba('0x1'));var timeout=require(_0xf2ba('0x2'));var express=require(_0xf2ba('0x3'));var router=express[_0xf2ba('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xf2ba('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf2ba('0x6'));router[_0xf2ba('0x7')]('/',auth[_0xf2ba('0x8')](),controller[_0xf2ba('0x9')]);router[_0xf2ba('0x7')]('/:id',auth[_0xf2ba('0x8')](),controller[_0xf2ba('0xa')]);router[_0xf2ba('0x7')](_0xf2ba('0xb'),auth[_0xf2ba('0x8')](),controller[_0xf2ba('0xc')]);router[_0xf2ba('0x7')](_0xf2ba('0xd'),auth[_0xf2ba('0x8')](),controller[_0xf2ba('0xe')]);router[_0xf2ba('0x7')](_0xf2ba('0xf'),auth[_0xf2ba('0x8')](),controller[_0xf2ba('0x10')]);router['post']('/',auth['isAuthenticated'](),controller[_0xf2ba('0x11')]);router[_0xf2ba('0x12')]('/:id',auth[_0xf2ba('0x8')](),controller[_0xf2ba('0x13')]);router[_0xf2ba('0x14')]('/:id',auth[_0xf2ba('0x8')](),controller[_0xf2ba('0x15')]);module[_0xf2ba('0x16')]=router; \ No newline at end of file +var _0xa169=['../../config/environment','./intDynamics365Configuration.controller','get','isAuthenticated','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','post','put','update','destroy','exports','multer','util','path','Router','fs-extra','../../components/interaction/service'];(function(_0x2abc3d,_0x48edca){var _0x252745=function(_0x32bb6f){while(--_0x32bb6f){_0x2abc3d['push'](_0x2abc3d['shift']());}};_0x252745(++_0x48edca);}(_0xa169,0xaa));var _0x9a16=function(_0xb6bb8a,_0x5a6aa1){_0xb6bb8a=_0xb6bb8a-0x0;var _0x245f87=_0xa169[_0xb6bb8a];return _0x245f87;};'use strict';var multer=require(_0x9a16('0x0'));var util=require(_0x9a16('0x1'));var path=require(_0x9a16('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x9a16('0x3')]();var fs_extra=require(_0x9a16('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x9a16('0x5'));var config=require(_0x9a16('0x6'));var controller=require(_0x9a16('0x7'));router[_0x9a16('0x8')]('/',auth[_0x9a16('0x9')](),controller['index']);router[_0x9a16('0x8')](_0x9a16('0xa'),auth[_0x9a16('0x9')](),controller[_0x9a16('0xb')]);router['get'](_0x9a16('0xc'),auth['isAuthenticated'](),controller[_0x9a16('0xd')]);router['get'](_0x9a16('0xe'),auth[_0x9a16('0x9')](),controller[_0x9a16('0xf')]);router[_0x9a16('0x8')](_0x9a16('0x10'),auth['isAuthenticated'](),controller['getDescriptions']);router[_0x9a16('0x11')]('/',auth['isAuthenticated'](),controller['create']);router[_0x9a16('0x12')](_0x9a16('0xa'),auth[_0x9a16('0x9')](),controller[_0x9a16('0x13')]);router['delete'](_0x9a16('0xa'),auth[_0x9a16('0x9')](),controller[_0x9a16('0x14')]);module[_0x9a16('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 a8e87ca..8c3f68d 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 _0x6f33=['BOOLEAN','sequelize','STRING','ENUM','incident','phonecall','contact','nothing'];(function(_0x39c3a6,_0x30d9e1){var _0xbaea15=function(_0xa60daa){while(--_0xa60daa){_0x39c3a6['push'](_0x39c3a6['shift']());}};_0xbaea15(++_0x30d9e1);}(_0x6f33,0xb9));var _0x36f3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6f33[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x36f3('0x0'));module['exports']={'name':{'type':Sequelize[_0x36f3('0x1')]},'description':{'type':Sequelize[_0x36f3('0x1')]},'ticketType':{'type':Sequelize[_0x36f3('0x2')](_0x36f3('0x3'),_0x36f3('0x4')),'defaultValue':_0x36f3('0x3')},'moduleCreate':{'type':Sequelize[_0x36f3('0x2')](_0x36f3('0x5'),_0x36f3('0x6')),'defaultValue':_0x36f3('0x5'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0x36f3('0x1')],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0x36f3('0x7')],'defaultValue':!![]}}; \ No newline at end of file +var _0x330d=['ENUM','contact','STRING','BOOLEAN','exports','incident','phonecall'];(function(_0x5b6055,_0x52c806){var _0x1fcbe=function(_0x4cc378){while(--_0x4cc378){_0x5b6055['push'](_0x5b6055['shift']());}};_0x1fcbe(++_0x52c806);}(_0x330d,0x9e));var _0xd330=function(_0x57fa33,_0x2b8222){_0x57fa33=_0x57fa33-0x0;var _0x12e724=_0x330d[_0x57fa33];return _0x12e724;};'use strict';var Sequelize=require('sequelize');module[_0xd330('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize['ENUM'](_0xd330('0x1'),_0xd330('0x2')),'defaultValue':_0xd330('0x1')},'moduleCreate':{'type':Sequelize[_0xd330('0x3')](_0xd330('0x4'),'nothing'),'defaultValue':_0xd330('0x4'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0xd330('0x5')],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0xd330('0x6')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index bd248ff..ebca006 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 _0x00de=['model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','options','includeAll','include','findAll','catch','show','params','keys','find','create','body','getFields','findOne','Dynamics365Field','hasOwnProperty','getSubjects','getDescriptions','zip-dir','moment','bluebird','mustache','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','then','destroy','error','stack','name','Dynamics365Configuration','rawAttributes','fieldName','type','key'];(function(_0x1aea88,_0xe0ef5c){var _0x1268bd=function(_0x18890f){while(--_0x18890f){_0x1aea88['push'](_0x1aea88['shift']());}};_0x1268bd(++_0xe0ef5c);}(_0x00de,0xbb));var _0xe00d=function(_0x9d639c,_0x524dbe){_0x9d639c=_0x9d639c-0x0;var _0x1671de=_0x00de[_0x9d639c];return _0x1671de;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe00d('0x0'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xe00d('0x1'));var BPromise=require(_0xe00d('0x2'));var Mustache=require(_0xe00d('0x3'));var util=require('util');var path=require('path');var sox=require(_0xe00d('0x4'));var csv=require(_0xe00d('0x5'));var ejs=require(_0xe00d('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe00d('0x7'));var squel=require(_0xe00d('0x8'));var crypto=require(_0xe00d('0x9'));var jsforce=require(_0xe00d('0xa'));var deskjs=require(_0xe00d('0xb'));var toCsv=require(_0xe00d('0x5'));var querystring=require(_0xe00d('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xe00d('0xd'));var qs=require(_0xe00d('0xe'));var as=require(_0xe00d('0xf'));var hardwareService=require(_0xe00d('0x10'));var logger=require(_0xe00d('0x11'))(_0xe00d('0x12'));var utils=require('../../config/utils');var config=require(_0xe00d('0x13'));var licenseUtil=require(_0xe00d('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x52b246,_0x29012b){_0x29012b=_0x29012b||0xcc;return function(_0x201cfa){if(_0x201cfa){return _0x52b246[_0xe00d('0x15')](_0x29012b);}return _0x52b246[_0xe00d('0x16')](_0x29012b)[_0xe00d('0x17')]();};}function respondWithResult(_0x30bd6c,_0x11f453){_0x11f453=_0x11f453||0xc8;return function(_0x2cb6f1){if(_0x2cb6f1){return _0x30bd6c[_0xe00d('0x16')](_0x11f453)[_0xe00d('0x18')](_0x2cb6f1);}};}function respondWithFilteredResult(_0x2d4e6a,_0x279bc6){return function(_0x31d378){if(_0x31d378){var _0x218051=typeof _0x279bc6[_0xe00d('0x19')]==='undefined'&&typeof _0x279bc6['limit']===_0xe00d('0x1a');var _0x51b8f7=_0x31d378[_0xe00d('0x1b')];var _0x225b71=_0x218051?0x0:_0x279bc6[_0xe00d('0x19')];var _0x105f2b=_0x218051?_0x31d378[_0xe00d('0x1b')]:_0x279bc6[_0xe00d('0x19')]+_0x279bc6[_0xe00d('0x1c')];var _0x5dd6f4;if(_0x105f2b>=_0x51b8f7){_0x105f2b=_0x51b8f7;_0x5dd6f4=0xc8;}else{_0x5dd6f4=0xce;}_0x2d4e6a['status'](_0x5dd6f4);return _0x2d4e6a[_0xe00d('0x1d')](_0xe00d('0x1e'),_0x225b71+'-'+_0x105f2b+'/'+_0x51b8f7)[_0xe00d('0x18')](_0x31d378);}return null;};}function patchUpdates(_0x511901){return function(_0x22b4f2){try{jsonpatch[_0xe00d('0x1f')](_0x22b4f2,_0x511901,!![]);}catch(_0x5ad851){return BPromise['reject'](_0x5ad851);}return _0x22b4f2[_0xe00d('0x20')]();};}function saveUpdates(_0x43e61e,_0xa1bbff){return function(_0x1c7686){if(_0x1c7686){return _0x1c7686[_0xe00d('0x21')](_0x43e61e)[_0xe00d('0x22')](function(_0x5b8291){return _0x5b8291;});}return null;};}function removeEntity(_0x7811eb,_0x2d1f6d){return function(_0x1ebc92){if(_0x1ebc92){return _0x1ebc92[_0xe00d('0x23')]()['then'](function(){_0x7811eb['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x17b3ac,_0xb7c9d4){return function(_0x3e6d66){if(!_0x3e6d66){_0x17b3ac['sendStatus'](0x194);}return _0x3e6d66;};}function handleError(_0x285ee1,_0x5f328c){_0x5f328c=_0x5f328c||0x1f4;return function(_0x16cc83){logger[_0xe00d('0x24')](_0x16cc83[_0xe00d('0x25')]);if(_0x16cc83[_0xe00d('0x26')]){delete _0x16cc83['name'];}_0x285ee1[_0xe00d('0x16')](_0x5f328c)['send'](_0x16cc83);};}exports['index']=function(_0x3ec95b,_0x16e02b){var _0x567e65={},_0x1689ba={},_0x14c269={'count':0x0,'rows':[]};var _0x40887e=_['map'](db[_0xe00d('0x27')][_0xe00d('0x28')],function(_0x52e03f){return{'name':_0x52e03f[_0xe00d('0x29')],'type':_0x52e03f[_0xe00d('0x2a')][_0xe00d('0x2b')]};});_0x1689ba[_0xe00d('0x2c')]=_['map'](_0x40887e,_0xe00d('0x26'));_0x1689ba[_0xe00d('0x2d')]=_['keys'](_0x3ec95b[_0xe00d('0x2d')]);_0x1689ba[_0xe00d('0x2e')]=_[_0xe00d('0x2f')](_0x1689ba['model'],_0x1689ba['query']);_0x567e65[_0xe00d('0x30')]=_[_0xe00d('0x2f')](_0x1689ba[_0xe00d('0x2c')],qs[_0xe00d('0x31')](_0x3ec95b[_0xe00d('0x2d')]['fields']));_0x567e65[_0xe00d('0x30')]=_0x567e65[_0xe00d('0x30')][_0xe00d('0x32')]?_0x567e65['attributes']:_0x1689ba[_0xe00d('0x2c')];if(!_0x3ec95b[_0xe00d('0x2d')]['hasOwnProperty'](_0xe00d('0x33'))){_0x567e65[_0xe00d('0x1c')]=qs[_0xe00d('0x1c')](_0x3ec95b[_0xe00d('0x2d')][_0xe00d('0x1c')]);_0x567e65[_0xe00d('0x19')]=qs['offset'](_0x3ec95b[_0xe00d('0x2d')][_0xe00d('0x19')]);}_0x567e65[_0xe00d('0x34')]=qs[_0xe00d('0x35')](_0x3ec95b['query']['sort']);_0x567e65[_0xe00d('0x36')]=qs[_0xe00d('0x2e')](_[_0xe00d('0x37')](_0x3ec95b[_0xe00d('0x2d')],_0x1689ba[_0xe00d('0x2e')]),_0x40887e);if(_0x3ec95b[_0xe00d('0x2d')][_0xe00d('0x38')]){_0x567e65[_0xe00d('0x36')]=_[_0xe00d('0x39')](_0x567e65[_0xe00d('0x36')],{'$or':_[_0xe00d('0x3a')](_0x40887e,function(_0xf7edfb){if(_0xf7edfb['type']!==_0xe00d('0x3b')){var _0x1320e5={};_0x1320e5[_0xf7edfb[_0xe00d('0x26')]]={'$like':'%'+_0x3ec95b[_0xe00d('0x2d')][_0xe00d('0x38')]+'%'};return _0x1320e5;}})});}_0x567e65=_[_0xe00d('0x39')]({},_0x567e65,_0x3ec95b[_0xe00d('0x3c')]);var _0x1de99e={'where':_0x567e65['where']};return db[_0xe00d('0x27')][_0xe00d('0x1b')](_0x1de99e)[_0xe00d('0x22')](function(_0x283439){_0x14c269[_0xe00d('0x1b')]=_0x283439;if(_0x3ec95b[_0xe00d('0x2d')][_0xe00d('0x3d')]){_0x567e65[_0xe00d('0x3e')]=[{'all':!![]}];}return db[_0xe00d('0x27')][_0xe00d('0x3f')](_0x567e65);})[_0xe00d('0x22')](function(_0x595d52){_0x14c269['rows']=_0x595d52;return _0x14c269;})['then'](respondWithFilteredResult(_0x16e02b,_0x567e65))[_0xe00d('0x40')](handleError(_0x16e02b,null));};exports[_0xe00d('0x41')]=function(_0x1177fb,_0x19ac8b){var _0x2ad1a4={'raw':![],'where':{'id':_0x1177fb[_0xe00d('0x42')]['id']}},_0x1eefe7={};_0x1eefe7[_0xe00d('0x2c')]=_[_0xe00d('0x43')](db['Dynamics365Configuration']['rawAttributes']);_0x1eefe7[_0xe00d('0x2d')]=_[_0xe00d('0x43')](_0x1177fb[_0xe00d('0x2d')]);_0x1eefe7[_0xe00d('0x2e')]=_[_0xe00d('0x2f')](_0x1eefe7[_0xe00d('0x2c')],_0x1eefe7[_0xe00d('0x2d')]);_0x2ad1a4[_0xe00d('0x30')]=_['intersection'](_0x1eefe7[_0xe00d('0x2c')],qs[_0xe00d('0x31')](_0x1177fb[_0xe00d('0x2d')][_0xe00d('0x31')]));_0x2ad1a4[_0xe00d('0x30')]=_0x2ad1a4[_0xe00d('0x30')][_0xe00d('0x32')]?_0x2ad1a4['attributes']:_0x1eefe7[_0xe00d('0x2c')];if(_0x1177fb['query'][_0xe00d('0x3d')]){_0x2ad1a4[_0xe00d('0x3e')]=[{'all':!![]}];}_0x2ad1a4=_['merge']({},_0x2ad1a4,_0x1177fb[_0xe00d('0x3c')]);return db['Dynamics365Configuration'][_0xe00d('0x44')](_0x2ad1a4)[_0xe00d('0x22')](handleEntityNotFound(_0x19ac8b,null))[_0xe00d('0x22')](respondWithResult(_0x19ac8b,null))[_0xe00d('0x40')](handleError(_0x19ac8b,null));};exports[_0xe00d('0x45')]=function(_0x4a4405,_0x5a5219){return db[_0xe00d('0x27')]['create'](_0x4a4405['body'],{})['then'](respondWithResult(_0x5a5219,0xc9))[_0xe00d('0x40')](handleError(_0x5a5219,null));};exports[_0xe00d('0x21')]=function(_0xaa7f08,_0x4aa476){if(_0xaa7f08[_0xe00d('0x46')]['id']){delete _0xaa7f08[_0xe00d('0x46')]['id'];}return db['Dynamics365Configuration'][_0xe00d('0x44')]({'where':{'id':_0xaa7f08['params']['id']}})['then'](handleEntityNotFound(_0x4aa476,null))[_0xe00d('0x22')](saveUpdates(_0xaa7f08[_0xe00d('0x46')],null))[_0xe00d('0x22')](respondWithResult(_0x4aa476,null))[_0xe00d('0x40')](handleError(_0x4aa476,null));};exports[_0xe00d('0x23')]=function(_0x4265e7,_0x26107a){return db['Dynamics365Configuration']['find']({'where':{'id':_0x4265e7[_0xe00d('0x42')]['id']}})[_0xe00d('0x22')](handleEntityNotFound(_0x26107a,null))[_0xe00d('0x22')](removeEntity(_0x26107a,null))[_0xe00d('0x40')](handleError(_0x26107a,null));};exports[_0xe00d('0x47')]=function(_0x1d2f74,_0x4758cd,_0x175ba4){var _0x445444={};var _0x3f28fd={};var _0x1ac494;var _0x110dfa;return db[_0xe00d('0x27')][_0xe00d('0x48')]({'where':{'id':_0x1d2f74['params']['id']}})[_0xe00d('0x22')](handleEntityNotFound(_0x4758cd,null))[_0xe00d('0x22')](function(_0x2ec970){if(_0x2ec970){_0x1ac494=_0x2ec970;_0x3f28fd[_0xe00d('0x2c')]=_[_0xe00d('0x43')](db[_0xe00d('0x49')][_0xe00d('0x28')]);_0x3f28fd[_0xe00d('0x2d')]=_[_0xe00d('0x43')](_0x1d2f74[_0xe00d('0x2d')]);_0x3f28fd[_0xe00d('0x2e')]=_[_0xe00d('0x2f')](_0x3f28fd['model'],_0x3f28fd[_0xe00d('0x2d')]);_0x445444[_0xe00d('0x30')]=_[_0xe00d('0x2f')](_0x3f28fd[_0xe00d('0x2c')],qs[_0xe00d('0x31')](_0x1d2f74['query'][_0xe00d('0x31')]));_0x445444[_0xe00d('0x30')]=_0x445444[_0xe00d('0x30')][_0xe00d('0x32')]?_0x445444[_0xe00d('0x30')]:_0x3f28fd[_0xe00d('0x2c')];_0x445444['order']=qs[_0xe00d('0x35')](_0x1d2f74[_0xe00d('0x2d')][_0xe00d('0x35')]);_0x445444['where']=qs[_0xe00d('0x2e')](_[_0xe00d('0x37')](_0x1d2f74['query'],_0x3f28fd['filters']));if(_0x1d2f74[_0xe00d('0x2d')][_0xe00d('0x38')]){_0x445444[_0xe00d('0x36')]=_[_0xe00d('0x39')](_0x445444[_0xe00d('0x36')],{'$or':_[_0xe00d('0x3a')](_0x445444[_0xe00d('0x30')],function(_0x23d445){var _0x5be504={};_0x5be504[_0x23d445]={'$like':'%'+_0x1d2f74[_0xe00d('0x2d')][_0xe00d('0x38')]+'%'};return _0x5be504;})});}_0x445444=_[_0xe00d('0x39')]({},_0x445444,_0x1d2f74[_0xe00d('0x3c')]);return _0x1ac494[_0xe00d('0x47')](_0x445444);}})['then'](function(_0xecd83e){if(_0xecd83e){_0x110dfa=_0xecd83e[_0xe00d('0x32')];if(!_0x1d2f74[_0xe00d('0x2d')][_0xe00d('0x4a')](_0xe00d('0x33'))){_0x445444['limit']=qs['limit'](_0x1d2f74[_0xe00d('0x2d')][_0xe00d('0x1c')]);_0x445444[_0xe00d('0x19')]=qs[_0xe00d('0x19')](_0x1d2f74['query'][_0xe00d('0x19')]);}return _0x1ac494['getFields'](_0x445444);}})[_0xe00d('0x22')](function(_0x48ea20){if(_0x48ea20){return _0x48ea20?{'count':_0x110dfa,'rows':_0x48ea20}:null;}})[_0xe00d('0x22')](respondWithResult(_0x4758cd,null))['catch'](handleError(_0x4758cd,null));};exports[_0xe00d('0x4b')]=function(_0xd86c8b,_0x342a67,_0x5a005b){var _0x271962={};var _0x610d79={};var _0x31a45e;var _0x4354c3;return db[_0xe00d('0x27')]['findOne']({'where':{'id':_0xd86c8b[_0xe00d('0x42')]['id']}})[_0xe00d('0x22')](handleEntityNotFound(_0x342a67,null))[_0xe00d('0x22')](function(_0x5e34cd){if(_0x5e34cd){_0x31a45e=_0x5e34cd;_0x610d79[_0xe00d('0x2c')]=_[_0xe00d('0x43')](db[_0xe00d('0x49')][_0xe00d('0x28')]);_0x610d79['query']=_[_0xe00d('0x43')](_0xd86c8b[_0xe00d('0x2d')]);_0x610d79[_0xe00d('0x2e')]=_['intersection'](_0x610d79['model'],_0x610d79[_0xe00d('0x2d')]);_0x271962[_0xe00d('0x30')]=_[_0xe00d('0x2f')](_0x610d79['model'],qs['fields'](_0xd86c8b['query'][_0xe00d('0x31')]));_0x271962['attributes']=_0x271962[_0xe00d('0x30')]['length']?_0x271962[_0xe00d('0x30')]:_0x610d79['model'];_0x271962[_0xe00d('0x34')]=qs[_0xe00d('0x35')](_0xd86c8b[_0xe00d('0x2d')][_0xe00d('0x35')]);_0x271962['where']=qs[_0xe00d('0x2e')](_[_0xe00d('0x37')](_0xd86c8b[_0xe00d('0x2d')],_0x610d79[_0xe00d('0x2e')]));if(_0xd86c8b[_0xe00d('0x2d')][_0xe00d('0x38')]){_0x271962['where']=_['merge'](_0x271962[_0xe00d('0x36')],{'$or':_['map'](_0x271962[_0xe00d('0x30')],function(_0x478b8b){var _0x5d6e91={};_0x5d6e91[_0x478b8b]={'$like':'%'+_0xd86c8b[_0xe00d('0x2d')][_0xe00d('0x38')]+'%'};return _0x5d6e91;})});}_0x271962=_[_0xe00d('0x39')]({},_0x271962,_0xd86c8b[_0xe00d('0x3c')]);return _0x31a45e[_0xe00d('0x4b')](_0x271962);}})[_0xe00d('0x22')](function(_0x344319){if(_0x344319){_0x4354c3=_0x344319['length'];if(!_0xd86c8b['query'][_0xe00d('0x4a')]('nolimit')){_0x271962[_0xe00d('0x1c')]=qs['limit'](_0xd86c8b[_0xe00d('0x2d')][_0xe00d('0x1c')]);_0x271962['offset']=qs['offset'](_0xd86c8b['query'][_0xe00d('0x19')]);}return _0x31a45e[_0xe00d('0x4b')](_0x271962);}})[_0xe00d('0x22')](function(_0x340cdb){if(_0x340cdb){return _0x340cdb?{'count':_0x4354c3,'rows':_0x340cdb}:null;}})[_0xe00d('0x22')](respondWithResult(_0x342a67,null))['catch'](handleError(_0x342a67,null));};exports['getDescriptions']=function(_0x1f437d,_0x2d5a56,_0x1e1e63){var _0xed5729={};var _0x426e92={};var _0x1b432e;var _0x3541ab;return db[_0xe00d('0x27')][_0xe00d('0x48')]({'where':{'id':_0x1f437d[_0xe00d('0x42')]['id']}})['then'](handleEntityNotFound(_0x2d5a56,null))['then'](function(_0x24446d){if(_0x24446d){_0x1b432e=_0x24446d;_0x426e92[_0xe00d('0x2c')]=_[_0xe00d('0x43')](db[_0xe00d('0x49')][_0xe00d('0x28')]);_0x426e92['query']=_['keys'](_0x1f437d[_0xe00d('0x2d')]);_0x426e92[_0xe00d('0x2e')]=_[_0xe00d('0x2f')](_0x426e92[_0xe00d('0x2c')],_0x426e92[_0xe00d('0x2d')]);_0xed5729[_0xe00d('0x30')]=_['intersection'](_0x426e92[_0xe00d('0x2c')],qs[_0xe00d('0x31')](_0x1f437d[_0xe00d('0x2d')][_0xe00d('0x31')]));_0xed5729[_0xe00d('0x30')]=_0xed5729['attributes'][_0xe00d('0x32')]?_0xed5729['attributes']:_0x426e92['model'];_0xed5729[_0xe00d('0x34')]=qs['sort'](_0x1f437d[_0xe00d('0x2d')][_0xe00d('0x35')]);_0xed5729[_0xe00d('0x36')]=qs[_0xe00d('0x2e')](_[_0xe00d('0x37')](_0x1f437d[_0xe00d('0x2d')],_0x426e92[_0xe00d('0x2e')]));if(_0x1f437d['query']['filter']){_0xed5729[_0xe00d('0x36')]=_['merge'](_0xed5729[_0xe00d('0x36')],{'$or':_[_0xe00d('0x3a')](_0xed5729[_0xe00d('0x30')],function(_0x720652){var _0x51735b={};_0x51735b[_0x720652]={'$like':'%'+_0x1f437d[_0xe00d('0x2d')][_0xe00d('0x38')]+'%'};return _0x51735b;})});}_0xed5729=_[_0xe00d('0x39')]({},_0xed5729,_0x1f437d[_0xe00d('0x3c')]);return _0x1b432e[_0xe00d('0x4c')](_0xed5729);}})[_0xe00d('0x22')](function(_0x2633d9){if(_0x2633d9){_0x3541ab=_0x2633d9[_0xe00d('0x32')];if(!_0x1f437d['query'][_0xe00d('0x4a')](_0xe00d('0x33'))){_0xed5729['limit']=qs[_0xe00d('0x1c')](_0x1f437d[_0xe00d('0x2d')][_0xe00d('0x1c')]);_0xed5729[_0xe00d('0x19')]=qs[_0xe00d('0x19')](_0x1f437d[_0xe00d('0x2d')][_0xe00d('0x19')]);}return _0x1b432e[_0xe00d('0x4c')](_0xed5729);}})['then'](function(_0x982ecc){if(_0x982ecc){return _0x982ecc?{'count':_0x3541ab,'rows':_0x982ecc}:null;}})['then'](respondWithResult(_0x2d5a56,null))['catch'](handleError(_0x2d5a56,null));}; \ No newline at end of file +var _0x7af8=['to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','count','limit','set','Content-Range','json','reject','save','update','then','destroy','sendStatus','error','stack','send','index','map','Dynamics365Configuration','rawAttributes','fieldName','type','key','model','name','query','keys','intersection','fields','attributes','nolimit','order','where','filters','pick','filter','merge','VIRTUAL','options','rows','catch','show','params','length','include','find','create','body','getFields','Dynamics365Field','sort','hasOwnProperty','getSubjects','findOne','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x7af8,0xee));var _0x87af=function(_0x5ef639,_0x535c66){_0x5ef639=_0x5ef639-0x0;var _0x13216d=_0x7af8[_0x5ef639];return _0x13216d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x87af('0x0'));var zipdir=require(_0x87af('0x1'));var jsonpatch=require(_0x87af('0x2'));var rp=require(_0x87af('0x3'));var moment=require(_0x87af('0x4'));var BPromise=require(_0x87af('0x5'));var Mustache=require(_0x87af('0x6'));var util=require('util');var path=require('path');var sox=require(_0x87af('0x7'));var csv=require(_0x87af('0x8'));var ejs=require(_0x87af('0x9'));var fs=require('fs');var fs_extra=require(_0x87af('0xa'));var _=require(_0x87af('0xb'));var squel=require(_0x87af('0xc'));var crypto=require(_0x87af('0xd'));var jsforce=require(_0x87af('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x87af('0x8'));var querystring=require(_0x87af('0xf'));var Papa=require(_0x87af('0x10'));var Redis=require('ioredis');var authService=require(_0x87af('0x11'));var qs=require(_0x87af('0x12'));var as=require(_0x87af('0x13'));var hardwareService=require(_0x87af('0x14'));var logger=require(_0x87af('0x15'))(_0x87af('0x16'));var utils=require('../../config/utils');var config=require(_0x87af('0x17'));var licenseUtil=require(_0x87af('0x18'));var db=require(_0x87af('0x19'))['db'];function respondWithStatusCode(_0x458d27,_0x1f3033){_0x1f3033=_0x1f3033||0xcc;return function(_0x8c1f4d){if(_0x8c1f4d){return _0x458d27['sendStatus'](_0x1f3033);}return _0x458d27[_0x87af('0x1a')](_0x1f3033)[_0x87af('0x1b')]();};}function respondWithResult(_0x1d78e3,_0x4c82a4){_0x4c82a4=_0x4c82a4||0xc8;return function(_0x3195e4){if(_0x3195e4){return _0x1d78e3[_0x87af('0x1a')](_0x4c82a4)['json'](_0x3195e4);}};}function respondWithFilteredResult(_0x30e7f4,_0x45a2c7){return function(_0x2f4f7a){if(_0x2f4f7a){var _0x5681fb=typeof _0x45a2c7[_0x87af('0x1c')]==='undefined'&&typeof _0x45a2c7['limit']==='undefined';var _0x2ff36=_0x2f4f7a[_0x87af('0x1d')];var _0x2aa941=_0x5681fb?0x0:_0x45a2c7[_0x87af('0x1c')];var _0x410833=_0x5681fb?_0x2f4f7a[_0x87af('0x1d')]:_0x45a2c7[_0x87af('0x1c')]+_0x45a2c7[_0x87af('0x1e')];var _0x2178ff;if(_0x410833>=_0x2ff36){_0x410833=_0x2ff36;_0x2178ff=0xc8;}else{_0x2178ff=0xce;}_0x30e7f4[_0x87af('0x1a')](_0x2178ff);return _0x30e7f4[_0x87af('0x1f')](_0x87af('0x20'),_0x2aa941+'-'+_0x410833+'/'+_0x2ff36)[_0x87af('0x21')](_0x2f4f7a);}return null;};}function patchUpdates(_0x164d16){return function(_0x49d60d){try{jsonpatch['apply'](_0x49d60d,_0x164d16,!![]);}catch(_0x5bb75c){return BPromise[_0x87af('0x22')](_0x5bb75c);}return _0x49d60d[_0x87af('0x23')]();};}function saveUpdates(_0x30cc80,_0x2188a4){return function(_0x1abd8f){if(_0x1abd8f){return _0x1abd8f[_0x87af('0x24')](_0x30cc80)[_0x87af('0x25')](function(_0x2108cf){return _0x2108cf;});}return null;};}function removeEntity(_0x3918ed,_0x202c97){return function(_0x278735){if(_0x278735){return _0x278735[_0x87af('0x26')]()['then'](function(){_0x3918ed[_0x87af('0x1a')](0xcc)[_0x87af('0x1b')]();});}};}function handleEntityNotFound(_0x11229b,_0x4a2dd5){return function(_0x1bfd47){if(!_0x1bfd47){_0x11229b[_0x87af('0x27')](0x194);}return _0x1bfd47;};}function handleError(_0x1f47ec,_0x3bc855){_0x3bc855=_0x3bc855||0x1f4;return function(_0x6c0e84){logger[_0x87af('0x28')](_0x6c0e84[_0x87af('0x29')]);if(_0x6c0e84['name']){delete _0x6c0e84['name'];}_0x1f47ec['status'](_0x3bc855)[_0x87af('0x2a')](_0x6c0e84);};}exports[_0x87af('0x2b')]=function(_0x2865da,_0x3b5338){var _0x1a1104={},_0x55cc21={},_0x37af8e={'count':0x0,'rows':[]};var _0x1099fe=_[_0x87af('0x2c')](db[_0x87af('0x2d')][_0x87af('0x2e')],function(_0x2277d8){return{'name':_0x2277d8[_0x87af('0x2f')],'type':_0x2277d8[_0x87af('0x30')][_0x87af('0x31')]};});_0x55cc21[_0x87af('0x32')]=_[_0x87af('0x2c')](_0x1099fe,_0x87af('0x33'));_0x55cc21[_0x87af('0x34')]=_[_0x87af('0x35')](_0x2865da[_0x87af('0x34')]);_0x55cc21['filters']=_[_0x87af('0x36')](_0x55cc21[_0x87af('0x32')],_0x55cc21[_0x87af('0x34')]);_0x1a1104['attributes']=_[_0x87af('0x36')](_0x55cc21['model'],qs[_0x87af('0x37')](_0x2865da[_0x87af('0x34')][_0x87af('0x37')]));_0x1a1104['attributes']=_0x1a1104[_0x87af('0x38')]['length']?_0x1a1104[_0x87af('0x38')]:_0x55cc21[_0x87af('0x32')];if(!_0x2865da[_0x87af('0x34')]['hasOwnProperty'](_0x87af('0x39'))){_0x1a1104[_0x87af('0x1e')]=qs[_0x87af('0x1e')](_0x2865da[_0x87af('0x34')]['limit']);_0x1a1104[_0x87af('0x1c')]=qs[_0x87af('0x1c')](_0x2865da['query'][_0x87af('0x1c')]);}_0x1a1104[_0x87af('0x3a')]=qs['sort'](_0x2865da[_0x87af('0x34')]['sort']);_0x1a1104[_0x87af('0x3b')]=qs[_0x87af('0x3c')](_[_0x87af('0x3d')](_0x2865da['query'],_0x55cc21[_0x87af('0x3c')]),_0x1099fe);if(_0x2865da[_0x87af('0x34')][_0x87af('0x3e')]){_0x1a1104[_0x87af('0x3b')]=_[_0x87af('0x3f')](_0x1a1104['where'],{'$or':_[_0x87af('0x2c')](_0x1099fe,function(_0x41b325){if(_0x41b325[_0x87af('0x30')]!==_0x87af('0x40')){var _0x4cabe7={};_0x4cabe7[_0x41b325[_0x87af('0x33')]]={'$like':'%'+_0x2865da[_0x87af('0x34')][_0x87af('0x3e')]+'%'};return _0x4cabe7;}})});}_0x1a1104=_[_0x87af('0x3f')]({},_0x1a1104,_0x2865da[_0x87af('0x41')]);var _0x568105={'where':_0x1a1104[_0x87af('0x3b')]};return db[_0x87af('0x2d')][_0x87af('0x1d')](_0x568105)[_0x87af('0x25')](function(_0x4c1916){_0x37af8e[_0x87af('0x1d')]=_0x4c1916;if(_0x2865da[_0x87af('0x34')]['includeAll']){_0x1a1104['include']=[{'all':!![]}];}return db['Dynamics365Configuration']['findAll'](_0x1a1104);})[_0x87af('0x25')](function(_0x196281){_0x37af8e[_0x87af('0x42')]=_0x196281;return _0x37af8e;})[_0x87af('0x25')](respondWithFilteredResult(_0x3b5338,_0x1a1104))[_0x87af('0x43')](handleError(_0x3b5338,null));};exports[_0x87af('0x44')]=function(_0x4bef41,_0x40113e){var _0x9d5918={'raw':![],'where':{'id':_0x4bef41[_0x87af('0x45')]['id']}},_0x35906d={};_0x35906d[_0x87af('0x32')]=_[_0x87af('0x35')](db[_0x87af('0x2d')][_0x87af('0x2e')]);_0x35906d[_0x87af('0x34')]=_['keys'](_0x4bef41['query']);_0x35906d[_0x87af('0x3c')]=_[_0x87af('0x36')](_0x35906d['model'],_0x35906d[_0x87af('0x34')]);_0x9d5918['attributes']=_[_0x87af('0x36')](_0x35906d[_0x87af('0x32')],qs['fields'](_0x4bef41[_0x87af('0x34')][_0x87af('0x37')]));_0x9d5918[_0x87af('0x38')]=_0x9d5918[_0x87af('0x38')][_0x87af('0x46')]?_0x9d5918[_0x87af('0x38')]:_0x35906d[_0x87af('0x32')];if(_0x4bef41[_0x87af('0x34')]['includeAll']){_0x9d5918[_0x87af('0x47')]=[{'all':!![]}];}_0x9d5918=_['merge']({},_0x9d5918,_0x4bef41[_0x87af('0x41')]);return db['Dynamics365Configuration'][_0x87af('0x48')](_0x9d5918)[_0x87af('0x25')](handleEntityNotFound(_0x40113e,null))[_0x87af('0x25')](respondWithResult(_0x40113e,null))[_0x87af('0x43')](handleError(_0x40113e,null));};exports[_0x87af('0x49')]=function(_0x57ddc9,_0x2c52d3){return db['Dynamics365Configuration'][_0x87af('0x49')](_0x57ddc9['body'],{})['then'](respondWithResult(_0x2c52d3,0xc9))[_0x87af('0x43')](handleError(_0x2c52d3,null));};exports[_0x87af('0x24')]=function(_0x20f46b,_0x2766f3){if(_0x20f46b[_0x87af('0x4a')]['id']){delete _0x20f46b[_0x87af('0x4a')]['id'];}return db[_0x87af('0x2d')][_0x87af('0x48')]({'where':{'id':_0x20f46b['params']['id']}})[_0x87af('0x25')](handleEntityNotFound(_0x2766f3,null))[_0x87af('0x25')](saveUpdates(_0x20f46b[_0x87af('0x4a')],null))[_0x87af('0x25')](respondWithResult(_0x2766f3,null))[_0x87af('0x43')](handleError(_0x2766f3,null));};exports[_0x87af('0x26')]=function(_0x34befa,_0x58900f){return db['Dynamics365Configuration']['find']({'where':{'id':_0x34befa[_0x87af('0x45')]['id']}})[_0x87af('0x25')](handleEntityNotFound(_0x58900f,null))[_0x87af('0x25')](removeEntity(_0x58900f,null))[_0x87af('0x43')](handleError(_0x58900f,null));};exports[_0x87af('0x4b')]=function(_0x3431de,_0x5cee9c,_0x55119e){var _0x146e1e={};var _0x58cdab={};var _0x1e0c56;var _0x27bc2d;return db[_0x87af('0x2d')]['findOne']({'where':{'id':_0x3431de[_0x87af('0x45')]['id']}})[_0x87af('0x25')](handleEntityNotFound(_0x5cee9c,null))[_0x87af('0x25')](function(_0x216165){if(_0x216165){_0x1e0c56=_0x216165;_0x58cdab[_0x87af('0x32')]=_['keys'](db[_0x87af('0x4c')][_0x87af('0x2e')]);_0x58cdab[_0x87af('0x34')]=_[_0x87af('0x35')](_0x3431de['query']);_0x58cdab[_0x87af('0x3c')]=_['intersection'](_0x58cdab[_0x87af('0x32')],_0x58cdab[_0x87af('0x34')]);_0x146e1e['attributes']=_[_0x87af('0x36')](_0x58cdab[_0x87af('0x32')],qs['fields'](_0x3431de[_0x87af('0x34')][_0x87af('0x37')]));_0x146e1e[_0x87af('0x38')]=_0x146e1e[_0x87af('0x38')]['length']?_0x146e1e['attributes']:_0x58cdab[_0x87af('0x32')];_0x146e1e[_0x87af('0x3a')]=qs[_0x87af('0x4d')](_0x3431de[_0x87af('0x34')][_0x87af('0x4d')]);_0x146e1e['where']=qs[_0x87af('0x3c')](_[_0x87af('0x3d')](_0x3431de[_0x87af('0x34')],_0x58cdab[_0x87af('0x3c')]));if(_0x3431de[_0x87af('0x34')]['filter']){_0x146e1e[_0x87af('0x3b')]=_['merge'](_0x146e1e[_0x87af('0x3b')],{'$or':_[_0x87af('0x2c')](_0x146e1e[_0x87af('0x38')],function(_0x58d624){var _0x305b77={};_0x305b77[_0x58d624]={'$like':'%'+_0x3431de[_0x87af('0x34')][_0x87af('0x3e')]+'%'};return _0x305b77;})});}_0x146e1e=_[_0x87af('0x3f')]({},_0x146e1e,_0x3431de[_0x87af('0x41')]);return _0x1e0c56['getFields'](_0x146e1e);}})[_0x87af('0x25')](function(_0x2cfd0c){if(_0x2cfd0c){_0x27bc2d=_0x2cfd0c['length'];if(!_0x3431de['query'][_0x87af('0x4e')]('nolimit')){_0x146e1e[_0x87af('0x1e')]=qs[_0x87af('0x1e')](_0x3431de[_0x87af('0x34')][_0x87af('0x1e')]);_0x146e1e[_0x87af('0x1c')]=qs['offset'](_0x3431de['query'][_0x87af('0x1c')]);}return _0x1e0c56['getFields'](_0x146e1e);}})[_0x87af('0x25')](function(_0x839193){if(_0x839193){return _0x839193?{'count':_0x27bc2d,'rows':_0x839193}:null;}})[_0x87af('0x25')](respondWithResult(_0x5cee9c,null))[_0x87af('0x43')](handleError(_0x5cee9c,null));};exports[_0x87af('0x4f')]=function(_0x3c4d95,_0x2b3b7e,_0x405e54){var _0x550214={};var _0x1d86c9={};var _0x499f04;var _0x457b17;return db[_0x87af('0x2d')]['findOne']({'where':{'id':_0x3c4d95[_0x87af('0x45')]['id']}})[_0x87af('0x25')](handleEntityNotFound(_0x2b3b7e,null))[_0x87af('0x25')](function(_0x4d3bfc){if(_0x4d3bfc){_0x499f04=_0x4d3bfc;_0x1d86c9[_0x87af('0x32')]=_[_0x87af('0x35')](db[_0x87af('0x4c')][_0x87af('0x2e')]);_0x1d86c9['query']=_[_0x87af('0x35')](_0x3c4d95[_0x87af('0x34')]);_0x1d86c9[_0x87af('0x3c')]=_[_0x87af('0x36')](_0x1d86c9[_0x87af('0x32')],_0x1d86c9[_0x87af('0x34')]);_0x550214[_0x87af('0x38')]=_[_0x87af('0x36')](_0x1d86c9[_0x87af('0x32')],qs[_0x87af('0x37')](_0x3c4d95[_0x87af('0x34')]['fields']));_0x550214[_0x87af('0x38')]=_0x550214[_0x87af('0x38')][_0x87af('0x46')]?_0x550214['attributes']:_0x1d86c9[_0x87af('0x32')];_0x550214[_0x87af('0x3a')]=qs[_0x87af('0x4d')](_0x3c4d95['query']['sort']);_0x550214[_0x87af('0x3b')]=qs[_0x87af('0x3c')](_[_0x87af('0x3d')](_0x3c4d95[_0x87af('0x34')],_0x1d86c9[_0x87af('0x3c')]));if(_0x3c4d95[_0x87af('0x34')][_0x87af('0x3e')]){_0x550214[_0x87af('0x3b')]=_['merge'](_0x550214[_0x87af('0x3b')],{'$or':_[_0x87af('0x2c')](_0x550214[_0x87af('0x38')],function(_0x42cf5f){var _0x2c3aa5={};_0x2c3aa5[_0x42cf5f]={'$like':'%'+_0x3c4d95[_0x87af('0x34')][_0x87af('0x3e')]+'%'};return _0x2c3aa5;})});}_0x550214=_[_0x87af('0x3f')]({},_0x550214,_0x3c4d95[_0x87af('0x41')]);return _0x499f04[_0x87af('0x4f')](_0x550214);}})['then'](function(_0xe21ce2){if(_0xe21ce2){_0x457b17=_0xe21ce2[_0x87af('0x46')];if(!_0x3c4d95['query']['hasOwnProperty'](_0x87af('0x39'))){_0x550214[_0x87af('0x1e')]=qs[_0x87af('0x1e')](_0x3c4d95[_0x87af('0x34')]['limit']);_0x550214['offset']=qs['offset'](_0x3c4d95[_0x87af('0x34')][_0x87af('0x1c')]);}return _0x499f04[_0x87af('0x4f')](_0x550214);}})[_0x87af('0x25')](function(_0x1b1d56){if(_0x1b1d56){return _0x1b1d56?{'count':_0x457b17,'rows':_0x1b1d56}:null;}})[_0x87af('0x25')](respondWithResult(_0x2b3b7e,null))['catch'](handleError(_0x2b3b7e,null));};exports['getDescriptions']=function(_0x3f7796,_0x1c2693,_0x228990){var _0x37b2cc={};var _0x19745b={};var _0x4bebbc;var _0xf0fb61;return db[_0x87af('0x2d')][_0x87af('0x50')]({'where':{'id':_0x3f7796[_0x87af('0x45')]['id']}})[_0x87af('0x25')](handleEntityNotFound(_0x1c2693,null))['then'](function(_0x29b90c){if(_0x29b90c){_0x4bebbc=_0x29b90c;_0x19745b[_0x87af('0x32')]=_['keys'](db[_0x87af('0x4c')]['rawAttributes']);_0x19745b[_0x87af('0x34')]=_['keys'](_0x3f7796[_0x87af('0x34')]);_0x19745b[_0x87af('0x3c')]=_['intersection'](_0x19745b[_0x87af('0x32')],_0x19745b[_0x87af('0x34')]);_0x37b2cc['attributes']=_[_0x87af('0x36')](_0x19745b['model'],qs[_0x87af('0x37')](_0x3f7796[_0x87af('0x34')][_0x87af('0x37')]));_0x37b2cc[_0x87af('0x38')]=_0x37b2cc[_0x87af('0x38')][_0x87af('0x46')]?_0x37b2cc[_0x87af('0x38')]:_0x19745b[_0x87af('0x32')];_0x37b2cc[_0x87af('0x3a')]=qs[_0x87af('0x4d')](_0x3f7796['query']['sort']);_0x37b2cc[_0x87af('0x3b')]=qs[_0x87af('0x3c')](_['pick'](_0x3f7796[_0x87af('0x34')],_0x19745b[_0x87af('0x3c')]));if(_0x3f7796['query'][_0x87af('0x3e')]){_0x37b2cc[_0x87af('0x3b')]=_[_0x87af('0x3f')](_0x37b2cc[_0x87af('0x3b')],{'$or':_[_0x87af('0x2c')](_0x37b2cc[_0x87af('0x38')],function(_0x33dc51){var _0x3fcfe4={};_0x3fcfe4[_0x33dc51]={'$like':'%'+_0x3f7796['query'][_0x87af('0x3e')]+'%'};return _0x3fcfe4;})});}_0x37b2cc=_['merge']({},_0x37b2cc,_0x3f7796[_0x87af('0x41')]);return _0x4bebbc[_0x87af('0x51')](_0x37b2cc);}})[_0x87af('0x25')](function(_0x5ed629){if(_0x5ed629){_0xf0fb61=_0x5ed629[_0x87af('0x46')];if(!_0x3f7796[_0x87af('0x34')][_0x87af('0x4e')](_0x87af('0x39'))){_0x37b2cc['limit']=qs[_0x87af('0x1e')](_0x3f7796[_0x87af('0x34')][_0x87af('0x1e')]);_0x37b2cc[_0x87af('0x1c')]=qs[_0x87af('0x1c')](_0x3f7796[_0x87af('0x34')]['offset']);}return _0x4bebbc[_0x87af('0x51')](_0x37b2cc);}})[_0x87af('0x25')](function(_0x1e53e2){if(_0x1e53e2){return _0x1e53e2?{'count':_0xf0fb61,'rows':_0x1e53e2}:null;}})['then'](respondWithResult(_0x1c2693,null))[_0x87af('0x43')](handleError(_0x1c2693,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index 4fbcbd1..4d9d7ca 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 _0xdace=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports','Dynamics365Configuration','int_dynamics365_configurations','lodash'];(function(_0x5cb4b8,_0x46af1d){var _0x54ab24=function(_0x644534){while(--_0x644534){_0x5cb4b8['push'](_0x5cb4b8['shift']());}};_0x54ab24(++_0x46af1d);}(_0xdace,0xc5));var _0xedac=function(_0x34bc6c,_0x10d089){_0x34bc6c=_0x34bc6c-0x0;var _0x168820=_0xdace[_0x34bc6c];return _0x168820;};'use strict';var _=require(_0xedac('0x0'));var util=require('util');var logger=require(_0xedac('0x1'))(_0xedac('0x2'));var moment=require(_0xedac('0x3'));var BPromise=require('bluebird');var rp=require(_0xedac('0x4'));var fs=require('fs');var path=require(_0xedac('0x5'));var rimraf=require(_0xedac('0x6'));var config=require(_0xedac('0x7'));var attributes=require('./intDynamics365Configuration.attributes');module[_0xedac('0x8')]=function(_0x1cba89,_0x39328a){return _0x1cba89['define'](_0xedac('0x9'),attributes,{'tableName':_0xedac('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x008c=['define','int_dynamics365_configurations','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./intDynamics365Configuration.attributes','exports'];(function(_0x504df1,_0x289598){var _0x1063b5=function(_0x627abd){while(--_0x627abd){_0x504df1['push'](_0x504df1['shift']());}};_0x1063b5(++_0x289598);}(_0x008c,0x188));var _0xc008=function(_0x5a4c93,_0x283aa8){_0x5a4c93=_0x5a4c93-0x0;var _0x421ff4=_0x008c[_0x5a4c93];return _0x421ff4;};'use strict';var _=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var logger=require(_0xc008('0x2'))(_0xc008('0x3'));var moment=require(_0xc008('0x4'));var BPromise=require('bluebird');var rp=require(_0xc008('0x5'));var fs=require('fs');var path=require(_0xc008('0x6'));var rimraf=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var attributes=require(_0xc008('0x9'));module[_0xc008('0xa')]=function(_0x13aa7,_0x39bb5e){return _0x13aa7[_0xc008('0xb')]('Dynamics365Configuration',attributes,{'tableName':_0xc008('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 b0e65ab..2523932 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 _0xeb73=['code','message','Dynamics365Configuration,\x20%s,\x20%s','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','error'];(function(_0x3d825e,_0x2563d2){var _0x1a84ed=function(_0x806253){while(--_0x806253){_0x3d825e['push'](_0x3d825e['shift']());}};_0x1a84ed(++_0x2563d2);}(_0xeb73,0x8f));var _0x3eb7=function(_0x59c683,_0x209444){_0x59c683=_0x59c683-0x0;var _0x47251b=_0xeb73[_0x59c683];return _0x47251b;};'use strict';var _=require('lodash');var util=require(_0x3eb7('0x0'));var moment=require('moment');var BPromise=require(_0x3eb7('0x1'));var rs=require(_0x3eb7('0x2'));var fs=require('fs');var Redis=require(_0x3eb7('0x3'));var db=require(_0x3eb7('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3eb7('0x5'))(_0x3eb7('0x6'));var config=require(_0x3eb7('0x7'));var jayson=require(_0x3eb7('0x8'));var client=jayson[_0x3eb7('0x9')][_0x3eb7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x164efb,_0x4ed883,_0x4f7de1){return new BPromise(function(_0x5b3d0c,_0x44ddfd){return client[_0x3eb7('0xb')](_0x164efb,_0x4f7de1)[_0x3eb7('0xc')](function(_0x53bfe3){logger[_0x3eb7('0xd')]('Dynamics365Configuration,\x20%s,\x20%s',_0x4ed883,_0x3eb7('0xe'));logger[_0x3eb7('0xf')](_0x3eb7('0x10'),_0x4ed883,_0x3eb7('0xe'),JSON['stringify'](_0x53bfe3));if(_0x53bfe3[_0x3eb7('0x11')]){if(_0x53bfe3[_0x3eb7('0x11')][_0x3eb7('0x12')]===0x1f4){logger['error']('Dynamics365Configuration,\x20%s,\x20%s',_0x4ed883,_0x53bfe3[_0x3eb7('0x11')][_0x3eb7('0x13')]);return _0x44ddfd(_0x53bfe3[_0x3eb7('0x11')][_0x3eb7('0x13')]);}logger[_0x3eb7('0x11')]('Dynamics365Configuration,\x20%s,\x20%s',_0x4ed883,_0x53bfe3[_0x3eb7('0x11')][_0x3eb7('0x13')]);return _0x5b3d0c(_0x53bfe3['error']['message']);}else{logger[_0x3eb7('0xd')](_0x3eb7('0x14'),_0x4ed883,_0x3eb7('0xe'));_0x5b3d0c(_0x53bfe3[_0x3eb7('0x15')][_0x3eb7('0x13')]);}})[_0x3eb7('0x16')](function(_0x1f36ae){logger[_0x3eb7('0x11')](_0x3eb7('0x14'),_0x4ed883,_0x1f36ae);_0x44ddfd(_0x1f36ae);});});} \ No newline at end of file +var _0xde23=['result','catch','lodash','util','moment','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Dynamics365Configuration,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message'];(function(_0xcb9d13,_0x5e9e19){var _0x1b70a9=function(_0x2dd0f0){while(--_0x2dd0f0){_0xcb9d13['push'](_0xcb9d13['shift']());}};_0x1b70a9(++_0x5e9e19);}(_0xde23,0x86));var _0x3de2=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xde23[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x3de2('0x0'));var util=require(_0x3de2('0x1'));var moment=require(_0x3de2('0x2'));var BPromise=require('bluebird');var rs=require(_0x3de2('0x3'));var fs=require('fs');var Redis=require(_0x3de2('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x3de2('0x5'))(_0x3de2('0x6'));var config=require(_0x3de2('0x7'));var jayson=require(_0x3de2('0x8'));var client=jayson['client'][_0x3de2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3b7ae3,_0x1babec,_0x13fac6){return new BPromise(function(_0x374547,_0x1ee7ec){return client[_0x3de2('0xa')](_0x3b7ae3,_0x13fac6)[_0x3de2('0xb')](function(_0x9fbf6d){logger[_0x3de2('0xc')](_0x3de2('0xd'),_0x1babec,'request\x20sent');logger[_0x3de2('0xe')]('Dynamics365Configuration,\x20%s,\x20%s,\x20%s',_0x1babec,_0x3de2('0xf'),JSON[_0x3de2('0x10')](_0x9fbf6d));if(_0x9fbf6d[_0x3de2('0x11')]){if(_0x9fbf6d[_0x3de2('0x11')][_0x3de2('0x12')]===0x1f4){logger[_0x3de2('0x11')](_0x3de2('0xd'),_0x1babec,_0x9fbf6d[_0x3de2('0x11')][_0x3de2('0x13')]);return _0x1ee7ec(_0x9fbf6d[_0x3de2('0x11')][_0x3de2('0x13')]);}logger[_0x3de2('0x11')](_0x3de2('0xd'),_0x1babec,_0x9fbf6d['error'][_0x3de2('0x13')]);return _0x374547(_0x9fbf6d['error'][_0x3de2('0x13')]);}else{logger[_0x3de2('0xc')](_0x3de2('0xd'),_0x1babec,_0x3de2('0xf'));_0x374547(_0x9fbf6d[_0x3de2('0x14')][_0x3de2('0x13')]);}})[_0x3de2('0x15')](function(_0x3d5e84){logger[_0x3de2('0x11')](_0x3de2('0xd'),_0x1babec,_0x3d5e84);_0x1ee7ec(_0x3d5e84);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index 165aea3..6e5b0b3 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 _0x237b=['delete','destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intDynamics365Field.controller','isAuthenticated','index','/:id','show','post','create','put','update'];(function(_0xf34895,_0x21fb70){var _0x143f44=function(_0x2e7730){while(--_0x2e7730){_0xf34895['push'](_0xf34895['shift']());}};_0x143f44(++_0x21fb70);}(_0x237b,0x145));var _0xb237=function(_0x46bae1,_0x50014d){_0x46bae1=_0x46bae1-0x0;var _0x4a7ee1=_0x237b[_0x46bae1];return _0x4a7ee1;};'use strict';var multer=require(_0xb237('0x0'));var util=require(_0xb237('0x1'));var path=require(_0xb237('0x2'));var timeout=require('connect-timeout');var express=require(_0xb237('0x3'));var router=express[_0xb237('0x4')]();var fs_extra=require(_0xb237('0x5'));var auth=require(_0xb237('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xb237('0x7'));var controller=require(_0xb237('0x8'));router['get']('/',auth[_0xb237('0x9')](),controller[_0xb237('0xa')]);router['get'](_0xb237('0xb'),auth[_0xb237('0x9')](),controller[_0xb237('0xc')]);router[_0xb237('0xd')]('/',auth[_0xb237('0x9')](),controller[_0xb237('0xe')]);router[_0xb237('0xf')](_0xb237('0xb'),auth[_0xb237('0x9')](),controller[_0xb237('0x10')]);router[_0xb237('0x11')](_0xb237('0xb'),auth['isAuthenticated'](),controller[_0xb237('0x12')]);module['exports']=router; \ No newline at end of file +var _0x63f9=['get','isAuthenticated','index','/:id','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Field.controller'];(function(_0x4973d5,_0xc5c9f){var _0x52d77=function(_0x126686){while(--_0x126686){_0x4973d5['push'](_0x4973d5['shift']());}};_0x52d77(++_0xc5c9f);}(_0x63f9,0x15b));var _0x963f=function(_0x4ed308,_0x348f13){_0x4ed308=_0x4ed308-0x0;var _0x44170c=_0x63f9[_0x4ed308];return _0x44170c;};'use strict';var multer=require('multer');var util=require(_0x963f('0x0'));var path=require(_0x963f('0x1'));var timeout=require(_0x963f('0x2'));var express=require(_0x963f('0x3'));var router=express[_0x963f('0x4')]();var fs_extra=require(_0x963f('0x5'));var auth=require(_0x963f('0x6'));var interaction=require(_0x963f('0x7'));var config=require(_0x963f('0x8'));var controller=require(_0x963f('0x9'));router[_0x963f('0xa')]('/',auth[_0x963f('0xb')](),controller[_0x963f('0xc')]);router[_0x963f('0xa')](_0x963f('0xd'),auth[_0x963f('0xb')](),controller['show']);router[_0x963f('0xe')]('/',auth[_0x963f('0xb')](),controller[_0x963f('0xf')]);router[_0x963f('0x10')](_0x963f('0xd'),auth[_0x963f('0xb')](),controller[_0x963f('0x11')]);router[_0x963f('0x12')]('/:id',auth[_0x963f('0xb')](),controller[_0x963f('0x13')]);module[_0x963f('0x14')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index 5486a07..6cee93a 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 _0x4ec9=['ENUM','string','customVariable','keyValue','picklist','STRING','variable','sequelize','exports'];(function(_0x1796bc,_0x1d8a78){var _0x3a381f=function(_0x3a8e5d){while(--_0x3a8e5d){_0x1796bc['push'](_0x1796bc['shift']());}};_0x3a381f(++_0x1d8a78);}(_0x4ec9,0x1d2));var _0x94ec=function(_0x35d2d6,_0x14e944){_0x35d2d6=_0x35d2d6-0x0;var _0x1637d5=_0x4ec9[_0x35d2d6];return _0x1637d5;};'use strict';var Sequelize=require(_0x94ec('0x0'));module[_0x94ec('0x1')]={'type':{'type':Sequelize[_0x94ec('0x2')](_0x94ec('0x3'),'variable',_0x94ec('0x4'),_0x94ec('0x5'),_0x94ec('0x6')),'defaultValue':_0x94ec('0x3')},'content':{'type':Sequelize[_0x94ec('0x7')]},'key':{'type':Sequelize[_0x94ec('0x7')]},'keyType':{'type':Sequelize[_0x94ec('0x2')](_0x94ec('0x3'),_0x94ec('0x8'),_0x94ec('0x4'))},'keyContent':{'type':Sequelize[_0x94ec('0x7')]},'idField':{'type':Sequelize[_0x94ec('0x7')]},'nameField':{'type':Sequelize[_0x94ec('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x94ec('0x7')]}}; \ No newline at end of file +var _0x144a=['string','variable','customVariable','keyValue','picklist','STRING','ENUM','exports'];(function(_0x2996df,_0x124a62){var _0x43ce4b=function(_0x12a1aa){while(--_0x12a1aa){_0x2996df['push'](_0x2996df['shift']());}};_0x43ce4b(++_0x124a62);}(_0x144a,0x1cf));var _0xa144=function(_0x3b3589,_0x15502c){_0x3b3589=_0x3b3589-0x0;var _0x443d81=_0x144a[_0x3b3589];return _0x443d81;};'use strict';var Sequelize=require('sequelize');module[_0xa144('0x0')]={'type':{'type':Sequelize['ENUM'](_0xa144('0x1'),_0xa144('0x2'),_0xa144('0x3'),_0xa144('0x4'),_0xa144('0x5')),'defaultValue':_0xa144('0x1')},'content':{'type':Sequelize[_0xa144('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xa144('0x7')](_0xa144('0x1'),_0xa144('0x2'),_0xa144('0x3'))},'keyContent':{'type':Sequelize[_0xa144('0x6')]},'idField':{'type':Sequelize[_0xa144('0x6')]},'nameField':{'type':Sequelize[_0xa144('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xa144('0x6')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index d03652e..42d4582 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 _0x0d2a=['squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../config/license/hardware','../../config/environment','../../config/license/util','status','json','offset','undefined','limit','count','reject','save','then','destroy','sendStatus','stack','name','send','index','Dynamics365Field','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','rows','show','params','include','find','create','body','catch','update','eml-format','rimraf','zip-dir','moment','mustache','util','path','fs-extra','lodash'];(function(_0x512d56,_0x152c89){var _0x48923d=function(_0x331ca7){while(--_0x331ca7){_0x512d56['push'](_0x512d56['shift']());}};_0x48923d(++_0x152c89);}(_0x0d2a,0x7f));var _0xa0d2=function(_0x3509d8,_0x17b28d){_0x3509d8=_0x3509d8-0x0;var _0x244e60=_0x0d2a[_0x3509d8];return _0x244e60;};'use strict';var emlformat=require(_0xa0d2('0x0'));var rimraf=require(_0xa0d2('0x1'));var zipdir=require(_0xa0d2('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa0d2('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xa0d2('0x4'));var util=require(_0xa0d2('0x5'));var path=require(_0xa0d2('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa0d2('0x7'));var _=require(_0xa0d2('0x8'));var squel=require(_0xa0d2('0x9'));var crypto=require(_0xa0d2('0xa'));var jsforce=require(_0xa0d2('0xb'));var deskjs=require(_0xa0d2('0xc'));var toCsv=require(_0xa0d2('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xa0d2('0xe'));var authService=require(_0xa0d2('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa0d2('0x10'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xa0d2('0x11'));var licenseUtil=require(_0xa0d2('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1c6cf4,_0xf9d8ac){_0xf9d8ac=_0xf9d8ac||0xcc;return function(_0x21ae91){if(_0x21ae91){return _0x1c6cf4['sendStatus'](_0xf9d8ac);}return _0x1c6cf4['status'](_0xf9d8ac)['end']();};}function respondWithResult(_0x41b3fc,_0x3364b0){_0x3364b0=_0x3364b0||0xc8;return function(_0x44231d){if(_0x44231d){return _0x41b3fc[_0xa0d2('0x13')](_0x3364b0)[_0xa0d2('0x14')](_0x44231d);}};}function respondWithFilteredResult(_0x5f2714,_0x561437){return function(_0x2df1d4){if(_0x2df1d4){var _0x139970=typeof _0x561437[_0xa0d2('0x15')]===_0xa0d2('0x16')&&typeof _0x561437[_0xa0d2('0x17')]===_0xa0d2('0x16');var _0x1fc049=_0x2df1d4['count'];var _0x1cabcc=_0x139970?0x0:_0x561437[_0xa0d2('0x15')];var _0x17d78a=_0x139970?_0x2df1d4[_0xa0d2('0x18')]:_0x561437['offset']+_0x561437['limit'];var _0x30ae13;if(_0x17d78a>=_0x1fc049){_0x17d78a=_0x1fc049;_0x30ae13=0xc8;}else{_0x30ae13=0xce;}_0x5f2714['status'](_0x30ae13);return _0x5f2714['set']('Content-Range',_0x1cabcc+'-'+_0x17d78a+'/'+_0x1fc049)['json'](_0x2df1d4);}return null;};}function patchUpdates(_0x49ebec){return function(_0xe67990){try{jsonpatch['apply'](_0xe67990,_0x49ebec,!![]);}catch(_0x6d0534){return BPromise[_0xa0d2('0x19')](_0x6d0534);}return _0xe67990[_0xa0d2('0x1a')]();};}function saveUpdates(_0xbe43be,_0x46b2e7){return function(_0x499ce4){if(_0x499ce4){return _0x499ce4['update'](_0xbe43be)[_0xa0d2('0x1b')](function(_0x54041a){return _0x54041a;});}return null;};}function removeEntity(_0x19719b,_0x232eb0){return function(_0x32611d){if(_0x32611d){return _0x32611d[_0xa0d2('0x1c')]()[_0xa0d2('0x1b')](function(){_0x19719b[_0xa0d2('0x13')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1ba6d6,_0x103db6){return function(_0x10e6cb){if(!_0x10e6cb){_0x1ba6d6[_0xa0d2('0x1d')](0x194);}return _0x10e6cb;};}function handleError(_0x41d48c,_0x582114){_0x582114=_0x582114||0x1f4;return function(_0x11732b){logger['error'](_0x11732b[_0xa0d2('0x1e')]);if(_0x11732b['name']){delete _0x11732b[_0xa0d2('0x1f')];}_0x41d48c[_0xa0d2('0x13')](_0x582114)[_0xa0d2('0x20')](_0x11732b);};}exports[_0xa0d2('0x21')]=function(_0x997b28,_0x47c018){var _0x3ce087={},_0x5d1af2={},_0x5b8867={'count':0x0,'rows':[]};var _0xbbac85=_['map'](db[_0xa0d2('0x22')][_0xa0d2('0x23')],function(_0x4b927a){return{'name':_0x4b927a[_0xa0d2('0x24')],'type':_0x4b927a[_0xa0d2('0x25')][_0xa0d2('0x26')]};});_0x5d1af2[_0xa0d2('0x27')]=_[_0xa0d2('0x28')](_0xbbac85,_0xa0d2('0x1f'));_0x5d1af2[_0xa0d2('0x29')]=_[_0xa0d2('0x2a')](_0x997b28[_0xa0d2('0x29')]);_0x5d1af2[_0xa0d2('0x2b')]=_[_0xa0d2('0x2c')](_0x5d1af2[_0xa0d2('0x27')],_0x5d1af2[_0xa0d2('0x29')]);_0x3ce087['attributes']=_['intersection'](_0x5d1af2['model'],qs[_0xa0d2('0x2d')](_0x997b28[_0xa0d2('0x29')][_0xa0d2('0x2d')]));_0x3ce087[_0xa0d2('0x2e')]=_0x3ce087[_0xa0d2('0x2e')][_0xa0d2('0x2f')]?_0x3ce087[_0xa0d2('0x2e')]:_0x5d1af2['model'];if(!_0x997b28['query'][_0xa0d2('0x30')](_0xa0d2('0x31'))){_0x3ce087['limit']=qs[_0xa0d2('0x17')](_0x997b28[_0xa0d2('0x29')][_0xa0d2('0x17')]);_0x3ce087[_0xa0d2('0x15')]=qs[_0xa0d2('0x15')](_0x997b28[_0xa0d2('0x29')][_0xa0d2('0x15')]);}_0x3ce087[_0xa0d2('0x32')]=qs['sort'](_0x997b28[_0xa0d2('0x29')][_0xa0d2('0x33')]);_0x3ce087[_0xa0d2('0x34')]=qs['filters'](_[_0xa0d2('0x35')](_0x997b28[_0xa0d2('0x29')],_0x5d1af2[_0xa0d2('0x2b')]),_0xbbac85);if(_0x997b28[_0xa0d2('0x29')][_0xa0d2('0x36')]){_0x3ce087[_0xa0d2('0x34')]=_['merge'](_0x3ce087[_0xa0d2('0x34')],{'$or':_[_0xa0d2('0x28')](_0xbbac85,function(_0xe80841){if(_0xe80841[_0xa0d2('0x25')]!==_0xa0d2('0x37')){var _0x7f051a={};_0x7f051a[_0xe80841['name']]={'$like':'%'+_0x997b28[_0xa0d2('0x29')]['filter']+'%'};return _0x7f051a;}})});}_0x3ce087=_[_0xa0d2('0x38')]({},_0x3ce087,_0x997b28[_0xa0d2('0x39')]);var _0x33a35b={'where':_0x3ce087[_0xa0d2('0x34')]};return db['Dynamics365Field']['count'](_0x33a35b)[_0xa0d2('0x1b')](function(_0x49cccd){_0x5b8867[_0xa0d2('0x18')]=_0x49cccd;if(_0x997b28['query'][_0xa0d2('0x3a')]){_0x3ce087['include']=[{'all':!![]}];}return db[_0xa0d2('0x22')]['findAll'](_0x3ce087);})[_0xa0d2('0x1b')](function(_0x499afd){_0x5b8867[_0xa0d2('0x3b')]=_0x499afd;return _0x5b8867;})['then'](respondWithFilteredResult(_0x47c018,_0x3ce087))['catch'](handleError(_0x47c018,null));};exports[_0xa0d2('0x3c')]=function(_0x229865,_0x48ade5){var _0x161a73={'raw':!![],'where':{'id':_0x229865[_0xa0d2('0x3d')]['id']}},_0x3a5820={};_0x3a5820[_0xa0d2('0x27')]=_[_0xa0d2('0x2a')](db[_0xa0d2('0x22')][_0xa0d2('0x23')]);_0x3a5820[_0xa0d2('0x29')]=_[_0xa0d2('0x2a')](_0x229865['query']);_0x3a5820['filters']=_[_0xa0d2('0x2c')](_0x3a5820[_0xa0d2('0x27')],_0x3a5820[_0xa0d2('0x29')]);_0x161a73['attributes']=_[_0xa0d2('0x2c')](_0x3a5820[_0xa0d2('0x27')],qs[_0xa0d2('0x2d')](_0x229865[_0xa0d2('0x29')]['fields']));_0x161a73[_0xa0d2('0x2e')]=_0x161a73[_0xa0d2('0x2e')][_0xa0d2('0x2f')]?_0x161a73[_0xa0d2('0x2e')]:_0x3a5820[_0xa0d2('0x27')];if(_0x229865[_0xa0d2('0x29')][_0xa0d2('0x3a')]){_0x161a73[_0xa0d2('0x3e')]=[{'all':!![]}];}_0x161a73=_[_0xa0d2('0x38')]({},_0x161a73,_0x229865[_0xa0d2('0x39')]);return db[_0xa0d2('0x22')][_0xa0d2('0x3f')](_0x161a73)[_0xa0d2('0x1b')](handleEntityNotFound(_0x48ade5,null))['then'](respondWithResult(_0x48ade5,null))['catch'](handleError(_0x48ade5,null));};exports['create']=function(_0x2847eb,_0x25168a){return db[_0xa0d2('0x22')][_0xa0d2('0x40')](_0x2847eb[_0xa0d2('0x41')],{})['then'](respondWithResult(_0x25168a,0xc9))[_0xa0d2('0x42')](handleError(_0x25168a,null));};exports[_0xa0d2('0x43')]=function(_0x2a756c,_0x23c455){if(_0x2a756c[_0xa0d2('0x41')]['id']){delete _0x2a756c['body']['id'];}return db[_0xa0d2('0x22')]['find']({'where':{'id':_0x2a756c[_0xa0d2('0x3d')]['id']}})[_0xa0d2('0x1b')](handleEntityNotFound(_0x23c455,null))[_0xa0d2('0x1b')](saveUpdates(_0x2a756c[_0xa0d2('0x41')],null))[_0xa0d2('0x1b')](respondWithResult(_0x23c455,null))[_0xa0d2('0x42')](handleError(_0x23c455,null));};exports[_0xa0d2('0x1c')]=function(_0xda3375,_0x210c31){return db[_0xa0d2('0x22')]['find']({'where':{'id':_0xda3375[_0xa0d2('0x3d')]['id']}})[_0xa0d2('0x1b')](handleEntityNotFound(_0x210c31,null))[_0xa0d2('0x1b')](removeEntity(_0x210c31,null))[_0xa0d2('0x42')](handleError(_0x210c31,null));}; \ No newline at end of file +var _0xf380=['Content-Range','apply','save','update','destroy','then','error','stack','name','send','Dynamics365Field','rawAttributes','fieldName','map','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','keys','find','body','params','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count'];(function(_0x263234,_0x38d73e){var _0x59c4fc=function(_0x443de5){while(--_0x443de5){_0x263234['push'](_0x263234['shift']());}};_0x59c4fc(++_0x38d73e);}(_0xf380,0x149));var _0x0f38=function(_0x3707d,_0x3dbdd6){_0x3707d=_0x3707d-0x0;var _0x242684=_0xf380[_0x3707d];return _0x242684;};'use strict';var emlformat=require(_0x0f38('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x0f38('0x1'));var rp=require(_0x0f38('0x2'));var moment=require(_0x0f38('0x3'));var BPromise=require(_0x0f38('0x4'));var Mustache=require(_0x0f38('0x5'));var util=require(_0x0f38('0x6'));var path=require(_0x0f38('0x7'));var sox=require(_0x0f38('0x8'));var csv=require('to-csv');var ejs=require(_0x0f38('0x9'));var fs=require('fs');var fs_extra=require(_0x0f38('0xa'));var _=require(_0x0f38('0xb'));var squel=require('squel');var crypto=require(_0x0f38('0xc'));var jsforce=require(_0x0f38('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x0f38('0xe'));var querystring=require(_0x0f38('0xf'));var Papa=require('papaparse');var Redis=require(_0x0f38('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x0f38('0x11'));var as=require(_0x0f38('0x12'));var hardwareService=require(_0x0f38('0x13'));var logger=require(_0x0f38('0x14'))('api');var utils=require(_0x0f38('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x0f38('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2ac848,_0x340167){_0x340167=_0x340167||0xcc;return function(_0x484834){if(_0x484834){return _0x2ac848[_0x0f38('0x17')](_0x340167);}return _0x2ac848[_0x0f38('0x18')](_0x340167)[_0x0f38('0x19')]();};}function respondWithResult(_0x375b79,_0x58b497){_0x58b497=_0x58b497||0xc8;return function(_0x8b4967){if(_0x8b4967){return _0x375b79[_0x0f38('0x18')](_0x58b497)[_0x0f38('0x1a')](_0x8b4967);}};}function respondWithFilteredResult(_0x2846b6,_0x357145){return function(_0x2301ef){if(_0x2301ef){var _0x503434=typeof _0x357145[_0x0f38('0x1b')]===_0x0f38('0x1c')&&typeof _0x357145[_0x0f38('0x1d')]===_0x0f38('0x1c');var _0x182ed5=_0x2301ef[_0x0f38('0x1e')];var _0x1201c9=_0x503434?0x0:_0x357145[_0x0f38('0x1b')];var _0x4b3d15=_0x503434?_0x2301ef[_0x0f38('0x1e')]:_0x357145[_0x0f38('0x1b')]+_0x357145[_0x0f38('0x1d')];var _0x2ff907;if(_0x4b3d15>=_0x182ed5){_0x4b3d15=_0x182ed5;_0x2ff907=0xc8;}else{_0x2ff907=0xce;}_0x2846b6[_0x0f38('0x18')](_0x2ff907);return _0x2846b6['set'](_0x0f38('0x1f'),_0x1201c9+'-'+_0x4b3d15+'/'+_0x182ed5)[_0x0f38('0x1a')](_0x2301ef);}return null;};}function patchUpdates(_0x3b49c0){return function(_0xf8f3de){try{jsonpatch[_0x0f38('0x20')](_0xf8f3de,_0x3b49c0,!![]);}catch(_0x2a7667){return BPromise['reject'](_0x2a7667);}return _0xf8f3de[_0x0f38('0x21')]();};}function saveUpdates(_0x3f7bde,_0x380cfe){return function(_0x35e382){if(_0x35e382){return _0x35e382[_0x0f38('0x22')](_0x3f7bde)['then'](function(_0x573d9e){return _0x573d9e;});}return null;};}function removeEntity(_0x44705b,_0x5c2142){return function(_0x599e47){if(_0x599e47){return _0x599e47[_0x0f38('0x23')]()[_0x0f38('0x24')](function(){_0x44705b[_0x0f38('0x18')](0xcc)[_0x0f38('0x19')]();});}};}function handleEntityNotFound(_0x38e44b,_0x195521){return function(_0x532b0d){if(!_0x532b0d){_0x38e44b['sendStatus'](0x194);}return _0x532b0d;};}function handleError(_0x4bf26d,_0x1164ca){_0x1164ca=_0x1164ca||0x1f4;return function(_0x283d7d){logger[_0x0f38('0x25')](_0x283d7d[_0x0f38('0x26')]);if(_0x283d7d[_0x0f38('0x27')]){delete _0x283d7d[_0x0f38('0x27')];}_0x4bf26d['status'](_0x1164ca)[_0x0f38('0x28')](_0x283d7d);};}exports['index']=function(_0x7efc53,_0x1b5a1c){var _0x474d0c={},_0x159bfb={},_0x58d533={'count':0x0,'rows':[]};var _0x142560=_['map'](db[_0x0f38('0x29')][_0x0f38('0x2a')],function(_0x59b76f){return{'name':_0x59b76f[_0x0f38('0x2b')],'type':_0x59b76f['type']['key']};});_0x159bfb['model']=_[_0x0f38('0x2c')](_0x142560,_0x0f38('0x27'));_0x159bfb[_0x0f38('0x2d')]=_['keys'](_0x7efc53[_0x0f38('0x2d')]);_0x159bfb[_0x0f38('0x2e')]=_[_0x0f38('0x2f')](_0x159bfb[_0x0f38('0x30')],_0x159bfb[_0x0f38('0x2d')]);_0x474d0c['attributes']=_[_0x0f38('0x2f')](_0x159bfb['model'],qs[_0x0f38('0x31')](_0x7efc53[_0x0f38('0x2d')][_0x0f38('0x31')]));_0x474d0c[_0x0f38('0x32')]=_0x474d0c[_0x0f38('0x32')][_0x0f38('0x33')]?_0x474d0c[_0x0f38('0x32')]:_0x159bfb[_0x0f38('0x30')];if(!_0x7efc53[_0x0f38('0x2d')][_0x0f38('0x34')](_0x0f38('0x35'))){_0x474d0c[_0x0f38('0x1d')]=qs['limit'](_0x7efc53[_0x0f38('0x2d')]['limit']);_0x474d0c[_0x0f38('0x1b')]=qs['offset'](_0x7efc53[_0x0f38('0x2d')][_0x0f38('0x1b')]);}_0x474d0c['order']=qs[_0x0f38('0x36')](_0x7efc53[_0x0f38('0x2d')][_0x0f38('0x36')]);_0x474d0c[_0x0f38('0x37')]=qs[_0x0f38('0x2e')](_[_0x0f38('0x38')](_0x7efc53[_0x0f38('0x2d')],_0x159bfb[_0x0f38('0x2e')]),_0x142560);if(_0x7efc53[_0x0f38('0x2d')][_0x0f38('0x39')]){_0x474d0c[_0x0f38('0x37')]=_[_0x0f38('0x3a')](_0x474d0c[_0x0f38('0x37')],{'$or':_[_0x0f38('0x2c')](_0x142560,function(_0x38abe1){if(_0x38abe1[_0x0f38('0x3b')]!==_0x0f38('0x3c')){var _0x49b7b4={};_0x49b7b4[_0x38abe1[_0x0f38('0x27')]]={'$like':'%'+_0x7efc53['query'][_0x0f38('0x39')]+'%'};return _0x49b7b4;}})});}_0x474d0c=_[_0x0f38('0x3a')]({},_0x474d0c,_0x7efc53[_0x0f38('0x3d')]);var _0x56b5d1={'where':_0x474d0c['where']};return db[_0x0f38('0x29')][_0x0f38('0x1e')](_0x56b5d1)[_0x0f38('0x24')](function(_0x42d177){_0x58d533[_0x0f38('0x1e')]=_0x42d177;if(_0x7efc53[_0x0f38('0x2d')][_0x0f38('0x3e')]){_0x474d0c[_0x0f38('0x3f')]=[{'all':!![]}];}return db[_0x0f38('0x29')][_0x0f38('0x40')](_0x474d0c);})[_0x0f38('0x24')](function(_0x31e769){_0x58d533[_0x0f38('0x41')]=_0x31e769;return _0x58d533;})[_0x0f38('0x24')](respondWithFilteredResult(_0x1b5a1c,_0x474d0c))[_0x0f38('0x42')](handleError(_0x1b5a1c,null));};exports[_0x0f38('0x43')]=function(_0x4334c3,_0x4be8e8){var _0x100280={'raw':!![],'where':{'id':_0x4334c3['params']['id']}},_0x3ded00={};_0x3ded00['model']=_[_0x0f38('0x44')](db['Dynamics365Field']['rawAttributes']);_0x3ded00[_0x0f38('0x2d')]=_[_0x0f38('0x44')](_0x4334c3[_0x0f38('0x2d')]);_0x3ded00[_0x0f38('0x2e')]=_[_0x0f38('0x2f')](_0x3ded00[_0x0f38('0x30')],_0x3ded00[_0x0f38('0x2d')]);_0x100280[_0x0f38('0x32')]=_['intersection'](_0x3ded00[_0x0f38('0x30')],qs[_0x0f38('0x31')](_0x4334c3[_0x0f38('0x2d')]['fields']));_0x100280['attributes']=_0x100280[_0x0f38('0x32')][_0x0f38('0x33')]?_0x100280[_0x0f38('0x32')]:_0x3ded00[_0x0f38('0x30')];if(_0x4334c3[_0x0f38('0x2d')][_0x0f38('0x3e')]){_0x100280['include']=[{'all':!![]}];}_0x100280=_['merge']({},_0x100280,_0x4334c3['options']);return db['Dynamics365Field'][_0x0f38('0x45')](_0x100280)[_0x0f38('0x24')](handleEntityNotFound(_0x4be8e8,null))['then'](respondWithResult(_0x4be8e8,null))[_0x0f38('0x42')](handleError(_0x4be8e8,null));};exports['create']=function(_0x527fc6,_0x4efc7a){return db[_0x0f38('0x29')]['create'](_0x527fc6[_0x0f38('0x46')],{})[_0x0f38('0x24')](respondWithResult(_0x4efc7a,0xc9))[_0x0f38('0x42')](handleError(_0x4efc7a,null));};exports[_0x0f38('0x22')]=function(_0xaef05f,_0xf188f7){if(_0xaef05f[_0x0f38('0x46')]['id']){delete _0xaef05f[_0x0f38('0x46')]['id'];}return db[_0x0f38('0x29')][_0x0f38('0x45')]({'where':{'id':_0xaef05f[_0x0f38('0x47')]['id']}})[_0x0f38('0x24')](handleEntityNotFound(_0xf188f7,null))[_0x0f38('0x24')](saveUpdates(_0xaef05f[_0x0f38('0x46')],null))[_0x0f38('0x24')](respondWithResult(_0xf188f7,null))['catch'](handleError(_0xf188f7,null));};exports['destroy']=function(_0x3db300,_0xfcb49d){return db[_0x0f38('0x29')][_0x0f38('0x45')]({'where':{'id':_0x3db300[_0x0f38('0x47')]['id']}})[_0x0f38('0x24')](handleEntityNotFound(_0xfcb49d,null))[_0x0f38('0x24')](removeEntity(_0xfcb49d,null))[_0x0f38('0x42')](handleError(_0xfcb49d,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index b6cd496..8b0d489 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 _0xe518=['exports','define','Dynamics365Field','dynamics365_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDynamics365Field.attributes'];(function(_0x16c3a8,_0x511fec){var _0x7c7b33=function(_0x5cf1f1){while(--_0x5cf1f1){_0x16c3a8['push'](_0x16c3a8['shift']());}};_0x7c7b33(++_0x511fec);}(_0xe518,0x17c));var _0x8e51=function(_0x538d2a,_0x15f840){_0x538d2a=_0x538d2a-0x0;var _0x5a0d8a=_0xe518[_0x538d2a];return _0x5a0d8a;};'use strict';var _=require(_0x8e51('0x0'));var util=require(_0x8e51('0x1'));var logger=require(_0x8e51('0x2'))(_0x8e51('0x3'));var moment=require(_0x8e51('0x4'));var BPromise=require(_0x8e51('0x5'));var rp=require(_0x8e51('0x6'));var fs=require('fs');var path=require(_0x8e51('0x7'));var rimraf=require(_0x8e51('0x8'));var config=require(_0x8e51('0x9'));var attributes=require(_0x8e51('0xa'));module[_0x8e51('0xb')]=function(_0x304486,_0x248cd3){return _0x304486[_0x8e51('0xc')](_0x8e51('0xd'),attributes,{'tableName':'int_dynamics365_fields','paranoid':![],'indexes':[{'name':_0x8e51('0xe'),'fields':[_0x8e51('0xf'),_0x8e51('0x10')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x690b=['./intDynamics365Field.attributes','exports','define','Dynamics365Field','dynamics365_unique_index','idField','FieldId','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x24b532,_0x275e05){var _0x5f5d2c=function(_0x43d620){while(--_0x43d620){_0x24b532['push'](_0x24b532['shift']());}};_0x5f5d2c(++_0x275e05);}(_0x690b,0x7f));var _0xb690=function(_0x5db313,_0x3c8f0c){_0x5db313=_0x5db313-0x0;var _0x36d503=_0x690b[_0x5db313];return _0x36d503;};'use strict';var _=require(_0xb690('0x0'));var util=require(_0xb690('0x1'));var logger=require(_0xb690('0x2'))(_0xb690('0x3'));var moment=require('moment');var BPromise=require(_0xb690('0x4'));var rp=require(_0xb690('0x5'));var fs=require('fs');var path=require(_0xb690('0x6'));var rimraf=require(_0xb690('0x7'));var config=require('../../config/environment');var attributes=require(_0xb690('0x8'));module[_0xb690('0x9')]=function(_0xf508d8,_0x174bba){return _0xf508d8[_0xb690('0xa')](_0xb690('0xb'),attributes,{'tableName':'int_dynamics365_fields','paranoid':![],'indexes':[{'name':_0xb690('0xc'),'fields':[_0xb690('0xd'),_0xb690('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.rpc.js b/server/api/intDynamics365Field/intDynamics365Field.rpc.js index 467a3fe..628e61f 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 _0xd7ca=['code','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x53c7ec,_0x106447){var _0x2b6f4a=function(_0x1a3496){while(--_0x1a3496){_0x53c7ec['push'](_0x53c7ec['shift']());}};_0x2b6f4a(++_0x106447);}(_0xd7ca,0xea));var _0xad7c=function(_0x36b356,_0x169723){_0x36b356=_0x36b356-0x0;var _0x3a3f70=_0xd7ca[_0x36b356];return _0x3a3f70;};'use strict';var _=require('lodash');var util=require(_0xad7c('0x0'));var moment=require(_0xad7c('0x1'));var BPromise=require(_0xad7c('0x2'));var rs=require(_0xad7c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xad7c('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xad7c('0x5'))(_0xad7c('0x6'));var config=require(_0xad7c('0x7'));var jayson=require(_0xad7c('0x8'));var client=jayson[_0xad7c('0x9')][_0xad7c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2eca34,_0x2a88e8,_0x24001b){return new BPromise(function(_0x5bd30e,_0x11a29d){return client[_0xad7c('0xb')](_0x2eca34,_0x24001b)['then'](function(_0x3aee76){logger[_0xad7c('0xc')](_0xad7c('0xd'),_0x2a88e8,_0xad7c('0xe'));logger[_0xad7c('0xf')](_0xad7c('0x10'),_0x2a88e8,'request\x20sent',JSON[_0xad7c('0x11')](_0x3aee76));if(_0x3aee76[_0xad7c('0x12')]){if(_0x3aee76[_0xad7c('0x12')][_0xad7c('0x13')]===0x1f4){logger[_0xad7c('0x12')]('Dynamics365Field,\x20%s,\x20%s',_0x2a88e8,_0x3aee76[_0xad7c('0x12')][_0xad7c('0x14')]);return _0x11a29d(_0x3aee76[_0xad7c('0x12')][_0xad7c('0x14')]);}logger[_0xad7c('0x12')](_0xad7c('0xd'),_0x2a88e8,_0x3aee76['error'][_0xad7c('0x14')]);return _0x5bd30e(_0x3aee76[_0xad7c('0x12')]['message']);}else{logger[_0xad7c('0xc')](_0xad7c('0xd'),_0x2a88e8,_0xad7c('0xe'));_0x5bd30e(_0x3aee76[_0xad7c('0x15')][_0xad7c('0x14')]);}})[_0xad7c('0x16')](function(_0x2e5173){logger['error'](_0xad7c('0xd'),_0x2a88e8,_0x2e5173);_0x11a29d(_0x2e5173);});});} \ No newline at end of file +var _0xc364=['Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x178c08,_0x241d0b){var _0x32d997=function(_0x3adafc){while(--_0x3adafc){_0x178c08['push'](_0x178c08['shift']());}};_0x32d997(++_0x241d0b);}(_0xc364,0x1e4));var _0x4c36=function(_0x49f66e,_0x3e2369){_0x49f66e=_0x49f66e-0x0;var _0x55a1e2=_0xc364[_0x49f66e];return _0x55a1e2;};'use strict';var _=require(_0x4c36('0x0'));var util=require(_0x4c36('0x1'));var moment=require(_0x4c36('0x2'));var BPromise=require(_0x4c36('0x3'));var rs=require(_0x4c36('0x4'));var fs=require('fs');var Redis=require(_0x4c36('0x5'));var db=require(_0x4c36('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x4c36('0x7'))(_0x4c36('0x8'));var config=require(_0x4c36('0x9'));var jayson=require(_0x4c36('0xa'));var client=jayson[_0x4c36('0xb')][_0x4c36('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2e7612,_0xdbcd1a,_0x3fdc91){return new BPromise(function(_0x247f11,_0x382780){return client[_0x4c36('0xd')](_0x2e7612,_0x3fdc91)[_0x4c36('0xe')](function(_0x27289a){logger[_0x4c36('0xf')](_0x4c36('0x10'),_0xdbcd1a,_0x4c36('0x11'));logger[_0x4c36('0x12')](_0x4c36('0x13'),_0xdbcd1a,'request\x20sent',JSON['stringify'](_0x27289a));if(_0x27289a[_0x4c36('0x14')]){if(_0x27289a['error'][_0x4c36('0x15')]===0x1f4){logger[_0x4c36('0x14')]('Dynamics365Field,\x20%s,\x20%s',_0xdbcd1a,_0x27289a[_0x4c36('0x14')][_0x4c36('0x16')]);return _0x382780(_0x27289a[_0x4c36('0x14')][_0x4c36('0x16')]);}logger[_0x4c36('0x14')](_0x4c36('0x10'),_0xdbcd1a,_0x27289a['error'][_0x4c36('0x16')]);return _0x247f11(_0x27289a['error'][_0x4c36('0x16')]);}else{logger[_0x4c36('0xf')](_0x4c36('0x10'),_0xdbcd1a,_0x4c36('0x11'));_0x247f11(_0x27289a[_0x4c36('0x17')][_0x4c36('0x16')]);}})[_0x4c36('0x18')](function(_0x2a8863){logger[_0x4c36('0x14')]('Dynamics365Field,\x20%s,\x20%s',_0xdbcd1a,_0x2a8863);_0x382780(_0x2a8863);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index 237aa81..7bfc25d 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 _0xb9ae=['./intFreshdeskAccount.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','post','/:id/configurations','put','update','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x1809c5,_0x46cabc){var _0x5254a4=function(_0xd1d319){while(--_0xd1d319){_0x1809c5['push'](_0x1809c5['shift']());}};_0x5254a4(++_0x46cabc);}(_0xb9ae,0x85));var _0xeb9a=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xb9ae[_0x57b54c];return _0x59cc19;};'use strict';var multer=require(_0xeb9a('0x0'));var util=require(_0xeb9a('0x1'));var path=require('path');var timeout=require(_0xeb9a('0x2'));var express=require(_0xeb9a('0x3'));var router=express['Router']();var fs_extra=require(_0xeb9a('0x4'));var auth=require(_0xeb9a('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xeb9a('0x6'));var controller=require(_0xeb9a('0x7'));router[_0xeb9a('0x8')]('/',auth[_0xeb9a('0x9')](),controller[_0xeb9a('0xa')]);router[_0xeb9a('0x8')](_0xeb9a('0xb'),auth[_0xeb9a('0x9')](),controller[_0xeb9a('0xc')]);router[_0xeb9a('0x8')]('/:id/configurations',auth[_0xeb9a('0x9')](),controller['getConfigurations']);router[_0xeb9a('0x8')](_0xeb9a('0xd'),auth[_0xeb9a('0x9')](),controller[_0xeb9a('0xe')]);router['post']('/',auth[_0xeb9a('0x9')](),controller['create']);router[_0xeb9a('0xf')](_0xeb9a('0x10'),auth[_0xeb9a('0x9')](),controller['addConfiguration']);router[_0xeb9a('0x11')](_0xeb9a('0xb'),auth['isAuthenticated'](),controller[_0xeb9a('0x12')]);router['delete'](_0xeb9a('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0xeb9a('0x13')]=router; \ No newline at end of file +var _0x972f=['isAuthenticated','index','/:id','show','/:id/configurations','/:id/fields','getFields','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','get'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x972f,0x81));var _0xf972=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x972f[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xf972('0x0'));var util=require('util');var path=require(_0xf972('0x1'));var timeout=require(_0xf972('0x2'));var express=require(_0xf972('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xf972('0x4'));var interaction=require(_0xf972('0x5'));var config=require(_0xf972('0x6'));var controller=require(_0xf972('0x7'));router[_0xf972('0x8')]('/',auth[_0xf972('0x9')](),controller[_0xf972('0xa')]);router['get'](_0xf972('0xb'),auth[_0xf972('0x9')](),controller[_0xf972('0xc')]);router[_0xf972('0x8')](_0xf972('0xd'),auth[_0xf972('0x9')](),controller['getConfigurations']);router['get'](_0xf972('0xe'),auth[_0xf972('0x9')](),controller[_0xf972('0xf')]);router[_0xf972('0x10')]('/',auth['isAuthenticated'](),controller[_0xf972('0x11')]);router[_0xf972('0x10')](_0xf972('0xd'),auth['isAuthenticated'](),controller['addConfiguration']);router[_0xf972('0x12')](_0xf972('0xb'),auth[_0xf972('0x9')](),controller[_0xf972('0x13')]);router[_0xf972('0x14')](_0xf972('0xb'),auth[_0xf972('0x9')](),controller[_0xf972('0x15')]);module[_0xf972('0x16')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index 239a35a..9be5ec3 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 _0x1eba=['exports','STRING','remoteUri','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1eba,0x1d7));var _0xa1eb=function(_0x4dcc2d,_0x422839){_0x4dcc2d=_0x4dcc2d-0x0;var _0x1bbd79=_0x1eba[_0x4dcc2d];return _0x1bbd79;};'use strict';var Sequelize=require(_0xa1eb('0x0'));module[_0xa1eb('0x1')]={'name':{'type':Sequelize[_0xa1eb('0x2')]},'description':{'type':Sequelize[_0xa1eb('0x2')]},'username':{'type':Sequelize[_0xa1eb('0x2')],'unique':'username'},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xa1eb('0x2')],'unique':_0xa1eb('0x3')},'serverUrl':{'type':Sequelize[_0xa1eb('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x955f=['exports','STRING','sequelize'];(function(_0x58a78c,_0x7a4fad){var _0x542a38=function(_0x597501){while(--_0x597501){_0x58a78c['push'](_0x58a78c['shift']());}};_0x542a38(++_0x7a4fad);}(_0x955f,0x1eb));var _0xf955=function(_0x47ecc8,_0x8cba65){_0x47ecc8=_0x47ecc8-0x0;var _0x3af8e6=_0x955f[_0x47ecc8];return _0x3af8e6;};'use strict';var Sequelize=require(_0xf955('0x0'));module[_0xf955('0x1')]={'name':{'type':Sequelize[_0xf955('0x2')]},'description':{'type':Sequelize[_0xf955('0x2')]},'username':{'type':Sequelize[_0xf955('0x2')],'unique':'username'},'apiKey':{'type':Sequelize[_0xf955('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0xf955('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index 3927545..1265a09 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 _0xb84e=['index','FreshdeskAccount','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','where','filters','pick','filter','VIRTUAL','options','include','findAll','catch','show','includeAll','merge','body','find','params','FreshdeskConfiguration','sort','getConfigurations','nolimit','addConfiguration','findOne','AccountId','Subjects','channel','Descriptions','getDescriptions','create','getFields','remoteUri','apiKey','slice','lastIndexOf','format','%s/%s','Basic\x20%s','%s:X','toString','base64','requester','subject','agent','description','priority','group','source','ticket_type','remove','includes','custom_text','default','choices','capitalize','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','stack','name','send'];(function(_0x3e6d0e,_0x5c2ef9){var _0x4e1cd9=function(_0x2590a1){while(--_0x2590a1){_0x3e6d0e['push'](_0x3e6d0e['shift']());}};_0x4e1cd9(++_0x5c2ef9);}(_0xb84e,0xbf));var _0xeb84=function(_0x3b231a,_0x53a00d){_0x3b231a=_0x3b231a-0x0;var _0x18d67a=_0xb84e[_0x3b231a];return _0x18d67a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xeb84('0x0'));var zipdir=require(_0xeb84('0x1'));var jsonpatch=require(_0xeb84('0x2'));var rp=require(_0xeb84('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xeb84('0x4'));var util=require(_0xeb84('0x5'));var path=require(_0xeb84('0x6'));var sox=require(_0xeb84('0x7'));var csv=require(_0xeb84('0x8'));var ejs=require(_0xeb84('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xeb84('0xa'));var crypto=require('crypto');var jsforce=require(_0xeb84('0xb'));var deskjs=require(_0xeb84('0xc'));var toCsv=require(_0xeb84('0x8'));var querystring=require(_0xeb84('0xd'));var Papa=require('papaparse');var Redis=require(_0xeb84('0xe'));var authService=require(_0xeb84('0xf'));var qs=require(_0xeb84('0x10'));var as=require(_0xeb84('0x11'));var hardwareService=require(_0xeb84('0x12'));var logger=require(_0xeb84('0x13'))(_0xeb84('0x14'));var utils=require(_0xeb84('0x15'));var config=require(_0xeb84('0x16'));var licenseUtil=require(_0xeb84('0x17'));var db=require(_0xeb84('0x18'))['db'];var integrations=require(_0xeb84('0x19'));function respondWithStatusCode(_0xfe7209,_0x59692e){_0x59692e=_0x59692e||0xcc;return function(_0x5bab5f){if(_0x5bab5f){return _0xfe7209[_0xeb84('0x1a')](_0x59692e);}return _0xfe7209[_0xeb84('0x1b')](_0x59692e)[_0xeb84('0x1c')]();};}function respondWithResult(_0x24cb39,_0x460016){_0x460016=_0x460016||0xc8;return function(_0xf54282){if(_0xf54282){return _0x24cb39['status'](_0x460016)[_0xeb84('0x1d')](_0xf54282);}};}function respondWithFilteredResult(_0x457b61,_0x105382){return function(_0xff258e){if(_0xff258e){var _0x4e7839=typeof _0x105382[_0xeb84('0x1e')]===_0xeb84('0x1f')&&typeof _0x105382[_0xeb84('0x20')]===_0xeb84('0x1f');var _0x3c5415=_0xff258e['count'];var _0x6ec07d=_0x4e7839?0x0:_0x105382['offset'];var _0x360575=_0x4e7839?_0xff258e[_0xeb84('0x21')]:_0x105382[_0xeb84('0x1e')]+_0x105382['limit'];var _0x568a75;if(_0x360575>=_0x3c5415){_0x360575=_0x3c5415;_0x568a75=0xc8;}else{_0x568a75=0xce;}_0x457b61[_0xeb84('0x1b')](_0x568a75);return _0x457b61[_0xeb84('0x22')](_0xeb84('0x23'),_0x6ec07d+'-'+_0x360575+'/'+_0x3c5415)[_0xeb84('0x1d')](_0xff258e);}return null;};}function patchUpdates(_0x3401ce){return function(_0x30f460){try{jsonpatch[_0xeb84('0x24')](_0x30f460,_0x3401ce,!![]);}catch(_0x224c91){return BPromise[_0xeb84('0x25')](_0x224c91);}return _0x30f460[_0xeb84('0x26')]();};}function saveUpdates(_0x159622,_0xea877a){return function(_0x3d0789){if(_0x3d0789){return _0x3d0789[_0xeb84('0x27')](_0x159622)[_0xeb84('0x28')](function(_0xae2c58){return _0xae2c58;});}return null;};}function removeEntity(_0x507115,_0x22ebf7){return function(_0x64b4ac){if(_0x64b4ac){return _0x64b4ac['destroy']()[_0xeb84('0x28')](function(){_0x507115[_0xeb84('0x1b')](0xcc)[_0xeb84('0x1c')]();});}};}function handleEntityNotFound(_0x993591,_0x3ccca6){return function(_0x31634b){if(!_0x31634b){_0x993591[_0xeb84('0x1a')](0x194);}return _0x31634b;};}function handleError(_0x4c805a,_0x4fae19){_0x4fae19=_0x4fae19||0x1f4;return function(_0x3cb622){logger[_0xeb84('0x29')](_0x3cb622[_0xeb84('0x2a')]);if(_0x3cb622[_0xeb84('0x2b')]){delete _0x3cb622[_0xeb84('0x2b')];}_0x4c805a[_0xeb84('0x1b')](_0x4fae19)[_0xeb84('0x2c')](_0x3cb622);};}exports[_0xeb84('0x2d')]=function(_0x397ecf,_0x87142a){var _0x2cd088={},_0x238772={},_0x414be4={'count':0x0,'rows':[]};var _0xb914ec=_['map'](db[_0xeb84('0x2e')][_0xeb84('0x2f')],function(_0x3e6bd5){return{'name':_0x3e6bd5[_0xeb84('0x30')],'type':_0x3e6bd5[_0xeb84('0x31')][_0xeb84('0x32')]};});_0x238772[_0xeb84('0x33')]=_[_0xeb84('0x34')](_0xb914ec,_0xeb84('0x2b'));_0x238772[_0xeb84('0x35')]=_[_0xeb84('0x36')](_0x397ecf['query']);_0x238772['filters']=_[_0xeb84('0x37')](_0x238772['model'],_0x238772[_0xeb84('0x35')]);_0x2cd088[_0xeb84('0x38')]=_[_0xeb84('0x37')](_0x238772[_0xeb84('0x33')],qs['fields'](_0x397ecf['query'][_0xeb84('0x39')]));_0x2cd088[_0xeb84('0x38')]=_0x2cd088['attributes'][_0xeb84('0x3a')]?_0x2cd088[_0xeb84('0x38')]:_0x238772['model'];if(!_0x397ecf[_0xeb84('0x35')][_0xeb84('0x3b')]('nolimit')){_0x2cd088[_0xeb84('0x20')]=qs['limit'](_0x397ecf['query'][_0xeb84('0x20')]);_0x2cd088['offset']=qs[_0xeb84('0x1e')](_0x397ecf[_0xeb84('0x35')][_0xeb84('0x1e')]);}_0x2cd088[_0xeb84('0x3c')]=qs['sort'](_0x397ecf[_0xeb84('0x35')]['sort']);_0x2cd088[_0xeb84('0x3d')]=qs[_0xeb84('0x3e')](_[_0xeb84('0x3f')](_0x397ecf[_0xeb84('0x35')],_0x238772[_0xeb84('0x3e')]),_0xb914ec);if(_0x397ecf[_0xeb84('0x35')][_0xeb84('0x40')]){_0x2cd088[_0xeb84('0x3d')]=_['merge'](_0x2cd088[_0xeb84('0x3d')],{'$or':_[_0xeb84('0x34')](_0xb914ec,function(_0x46df8a){if(_0x46df8a[_0xeb84('0x31')]!==_0xeb84('0x41')){var _0x413e36={};_0x413e36[_0x46df8a['name']]={'$like':'%'+_0x397ecf['query'][_0xeb84('0x40')]+'%'};return _0x413e36;}})});}_0x2cd088=_['merge']({},_0x2cd088,_0x397ecf[_0xeb84('0x42')]);var _0xa84c41={'where':_0x2cd088[_0xeb84('0x3d')]};return db['FreshdeskAccount'][_0xeb84('0x21')](_0xa84c41)[_0xeb84('0x28')](function(_0x1ee328){_0x414be4['count']=_0x1ee328;if(_0x397ecf[_0xeb84('0x35')]['includeAll']){_0x2cd088[_0xeb84('0x43')]=[{'all':!![]}];}return db['FreshdeskAccount'][_0xeb84('0x44')](_0x2cd088);})[_0xeb84('0x28')](function(_0x5095f3){_0x414be4['rows']=_0x5095f3;return _0x414be4;})[_0xeb84('0x28')](respondWithFilteredResult(_0x87142a,_0x2cd088))[_0xeb84('0x45')](handleError(_0x87142a,null));};exports[_0xeb84('0x46')]=function(_0x4e4df3,_0x4eb810){var _0x20edc6={'raw':![],'where':{'id':_0x4e4df3['params']['id']}},_0x354d83={};_0x354d83[_0xeb84('0x33')]=_['keys'](db[_0xeb84('0x2e')][_0xeb84('0x2f')]);_0x354d83['query']=_[_0xeb84('0x36')](_0x4e4df3[_0xeb84('0x35')]);_0x354d83[_0xeb84('0x3e')]=_[_0xeb84('0x37')](_0x354d83[_0xeb84('0x33')],_0x354d83[_0xeb84('0x35')]);_0x20edc6['attributes']=_[_0xeb84('0x37')](_0x354d83[_0xeb84('0x33')],qs['fields'](_0x4e4df3[_0xeb84('0x35')]['fields']));_0x20edc6['attributes']=_0x20edc6[_0xeb84('0x38')][_0xeb84('0x3a')]?_0x20edc6[_0xeb84('0x38')]:_0x354d83[_0xeb84('0x33')];if(_0x4e4df3['query'][_0xeb84('0x47')]){_0x20edc6[_0xeb84('0x43')]=[{'all':!![]}];}_0x20edc6=_[_0xeb84('0x48')]({},_0x20edc6,_0x4e4df3[_0xeb84('0x42')]);return db[_0xeb84('0x2e')]['find'](_0x20edc6)[_0xeb84('0x28')](handleEntityNotFound(_0x4eb810,null))['then'](respondWithResult(_0x4eb810,null))['catch'](handleError(_0x4eb810,null));};exports['create']=function(_0x24cc99,_0x1087da){return db[_0xeb84('0x2e')]['create'](_0x24cc99[_0xeb84('0x49')],{})[_0xeb84('0x28')](respondWithResult(_0x1087da,0xc9))[_0xeb84('0x45')](handleError(_0x1087da,null));};exports[_0xeb84('0x27')]=function(_0x130047,_0x5b9374){if(_0x130047['body']['id']){delete _0x130047['body']['id'];}return db['FreshdeskAccount'][_0xeb84('0x4a')]({'where':{'id':_0x130047[_0xeb84('0x4b')]['id']}})[_0xeb84('0x28')](handleEntityNotFound(_0x5b9374,null))['then'](saveUpdates(_0x130047[_0xeb84('0x49')],null))[_0xeb84('0x28')](respondWithResult(_0x5b9374,null))['catch'](handleError(_0x5b9374,null));};exports['destroy']=function(_0x2837f5,_0xb77b41){return db['FreshdeskAccount']['find']({'where':{'id':_0x2837f5[_0xeb84('0x4b')]['id']}})['then'](handleEntityNotFound(_0xb77b41,null))[_0xeb84('0x28')](removeEntity(_0xb77b41,null))['catch'](handleError(_0xb77b41,null));};exports['getConfigurations']=function(_0x880f19,_0x541829,_0x1529dc){var _0x3aa4b8={};var _0x2ad97c={};var _0x591a7e;var _0x2c0673;return db['FreshdeskAccount']['findOne']({'where':{'id':_0x880f19[_0xeb84('0x4b')]['id']}})[_0xeb84('0x28')](handleEntityNotFound(_0x541829,null))['then'](function(_0x53c259){if(_0x53c259){_0x591a7e=_0x53c259;_0x2ad97c['model']=_['keys'](db[_0xeb84('0x4c')][_0xeb84('0x2f')]);_0x2ad97c[_0xeb84('0x35')]=_[_0xeb84('0x36')](_0x880f19['query']);_0x2ad97c[_0xeb84('0x3e')]=_[_0xeb84('0x37')](_0x2ad97c['model'],_0x2ad97c[_0xeb84('0x35')]);_0x3aa4b8[_0xeb84('0x38')]=_[_0xeb84('0x37')](_0x2ad97c[_0xeb84('0x33')],qs['fields'](_0x880f19[_0xeb84('0x35')]['fields']));_0x3aa4b8[_0xeb84('0x38')]=_0x3aa4b8[_0xeb84('0x38')][_0xeb84('0x3a')]?_0x3aa4b8['attributes']:_0x2ad97c[_0xeb84('0x33')];_0x3aa4b8[_0xeb84('0x3c')]=qs[_0xeb84('0x4d')](_0x880f19[_0xeb84('0x35')][_0xeb84('0x4d')]);_0x3aa4b8[_0xeb84('0x3d')]=qs[_0xeb84('0x3e')](_[_0xeb84('0x3f')](_0x880f19[_0xeb84('0x35')],_0x2ad97c[_0xeb84('0x3e')]));if(_0x880f19['query']['filter']){_0x3aa4b8[_0xeb84('0x3d')]=_[_0xeb84('0x48')](_0x3aa4b8[_0xeb84('0x3d')],{'$or':_[_0xeb84('0x34')](_0x3aa4b8[_0xeb84('0x38')],function(_0xc1f63a){var _0x79551f={};_0x79551f[_0xc1f63a]={'$like':'%'+_0x880f19[_0xeb84('0x35')]['filter']+'%'};return _0x79551f;})});}_0x3aa4b8=_['merge']({},_0x3aa4b8,_0x880f19[_0xeb84('0x42')]);return _0x591a7e[_0xeb84('0x4e')](_0x3aa4b8);}})[_0xeb84('0x28')](function(_0x3505f2){if(_0x3505f2){_0x2c0673=_0x3505f2[_0xeb84('0x3a')];if(!_0x880f19['query'][_0xeb84('0x3b')](_0xeb84('0x4f'))){_0x3aa4b8[_0xeb84('0x20')]=qs['limit'](_0x880f19[_0xeb84('0x35')]['limit']);_0x3aa4b8['offset']=qs[_0xeb84('0x1e')](_0x880f19['query'][_0xeb84('0x1e')]);}return _0x591a7e['getConfigurations'](_0x3aa4b8);}})['then'](function(_0x4fe2e8){if(_0x4fe2e8){return _0x4fe2e8?{'count':_0x2c0673,'rows':_0x4fe2e8}:null;}})['then'](respondWithResult(_0x541829,null))[_0xeb84('0x45')](handleError(_0x541829,null));};exports[_0xeb84('0x50')]=function(_0x10214d,_0x495813,_0x312bd8){if(_0x10214d[_0xeb84('0x49')]['id']){delete _0x10214d[_0xeb84('0x49')]['id'];}return db[_0xeb84('0x2e')][_0xeb84('0x51')]({'where':{'id':_0x10214d['params']['id']}})[_0xeb84('0x28')](handleEntityNotFound(_0x495813,null))[_0xeb84('0x28')](function(_0x1f232c){if(_0x1f232c){_0x10214d[_0xeb84('0x49')][_0xeb84('0x52')]=_0x1f232c['id'];_0x10214d[_0xeb84('0x49')][_0xeb84('0x53')]=integrations['getSubjects'](_0x10214d[_0xeb84('0x49')][_0xeb84('0x54')],_0x10214d['body'][_0xeb84('0x31')]);_0x10214d[_0xeb84('0x49')][_0xeb84('0x55')]=integrations[_0xeb84('0x56')](_0x10214d[_0xeb84('0x49')]['channel'],_0x10214d[_0xeb84('0x49')]['type']);return db['FreshdeskConfiguration'][_0xeb84('0x57')](_0x10214d[_0xeb84('0x49')],{'include':[{'model':db['FreshdeskField'],'as':'Subjects'},{'model':db['FreshdeskField'],'as':_0xeb84('0x55')}]});}return null;})[_0xeb84('0x28')](respondWithResult(_0x495813,null))[_0xeb84('0x45')](handleError(_0x495813,null));};exports[_0xeb84('0x58')]=function(_0x3d3ead,_0x327c99,_0x371465){var _0x25daf1='';return db[_0xeb84('0x2e')][_0xeb84('0x51')]({'where':{'id':_0x3d3ead[_0xeb84('0x4b')]['id']},'attributes':['id',_0xeb84('0x59'),_0xeb84('0x5a')]})['then'](handleEntityNotFound(_0x327c99,null))['then'](function(_0x287900){if(_0x287900){_0x25daf1=_0x287900['remoteUri'];var _0x2d841a=_0x25daf1[_0xeb84('0x5b')](-0x1);if(_0x2d841a==='/'){_0x25daf1=_0x25daf1['substring'](0x0,_0x25daf1[_0xeb84('0x5c')](_0x2d841a));}return rp({'method':'GET','uri':util[_0xeb84('0x5d')](_0xeb84('0x5e'),_0x25daf1,'api/v2/ticket_fields'),'headers':{'Authorization':util[_0xeb84('0x5d')](_0xeb84('0x5f'),new Buffer(util['format'](_0xeb84('0x60'),_0x287900['apiKey']))[_0xeb84('0x61')](_0xeb84('0x62')))},'json':!![]});}})[_0xeb84('0x28')](function(_0x356ea3){if(_0x356ea3){var _0x1e9921=[_0xeb84('0x63'),_0xeb84('0x64'),_0xeb84('0x65'),_0xeb84('0x66'),_0xeb84('0x1b'),_0xeb84('0x67'),_0xeb84('0x68'),_0xeb84('0x69'),_0xeb84('0x6a'),'group','company'];_[_0xeb84('0x6b')](_0x356ea3,function(_0x38d0f2){return _0x1e9921[_0xeb84('0x6c')](_0x38d0f2[_0xeb84('0x2b')])||!_0x38d0f2['default']&&_0x38d0f2[_0xeb84('0x31')]!==_0xeb84('0x6d')&&_0x38d0f2[_0xeb84('0x31')]!=='custom_dropdown';});return{'count':_0x356ea3[_0xeb84('0x3a')],'rows':_[_0xeb84('0x34')](_0x356ea3,function(_0xb5b6d3){return{'id':_0xb5b6d3[_0xeb84('0x2b')],'name':_0xb5b6d3['label'],'custom':!_0xb5b6d3[_0xeb84('0x6e')],'options':_0xb5b6d3[_0xeb84('0x6f')]?_[_0xeb84('0x34')](_0xb5b6d3[_0xeb84('0x6f')],function(_0x1ab28d){return{'name':_[_0xeb84('0x70')](_0x1ab28d),'value':_0x1ab28d};}):[]};})};}})[_0xeb84('0x28')](respondWithResult(_0x327c99,null))[_0xeb84('0x45')](function(_0x1effa8){var _0x145fdd=_0x3d3ead[_0xeb84('0x35')][_0xeb84('0x71')]?0x1f4:_0x1effa8[_0xeb84('0x72')]||0x1f4;logger['error'](_0xeb84('0x73'),_0xeb84('0x58'),_0x145fdd,JSON[_0xeb84('0x74')](_0x1effa8));delete _0x1effa8['name'];if(_0x145fdd===0x191){_0x145fdd=0x190;}_0x327c99['status'](_0x145fdd)[_0xeb84('0x2c')](_0x3d3ead['query'][_0xeb84('0x71')]?{'message':_0xeb84('0x75'),'statusCode':_0x1effa8['statusCode']}:_0x1effa8);});}; \ No newline at end of file +var _0x22a4=['capitalize','getFields,\x20%s,\x20%s,\x20%s','stringify','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','error','name','send','type','key','model','map','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','VIRTUAL','merge','options','FreshdeskAccount','includeAll','include','findAll','show','params','rawAttributes','length','find','create','body','catch','update','getConfigurations','findOne','filter','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshdeskConfiguration','FreshdeskField','getFields','remoteUri','slice','substring','lastIndexOf','GET','format','%s/%s','api/v2/ticket_fields','Basic\x20%s','%s:X','apiKey','subject','agent','description','group','company','remove','includes','default','custom_dropdown','label','choices'];(function(_0x4bb132,_0x224513){var _0x3b9b74=function(_0x2cb6d4){while(--_0x2cb6d4){_0x4bb132['push'](_0x4bb132['shift']());}};_0x3b9b74(++_0x224513);}(_0x22a4,0x1cb));var _0x422a=function(_0x4eec2f,_0x55a635){_0x4eec2f=_0x4eec2f-0x0;var _0x4d8b0d=_0x22a4[_0x4eec2f];return _0x4d8b0d;};'use strict';var emlformat=require(_0x422a('0x0'));var rimraf=require(_0x422a('0x1'));var zipdir=require(_0x422a('0x2'));var jsonpatch=require(_0x422a('0x3'));var rp=require(_0x422a('0x4'));var moment=require(_0x422a('0x5'));var BPromise=require(_0x422a('0x6'));var Mustache=require(_0x422a('0x7'));var util=require('util');var path=require(_0x422a('0x8'));var sox=require(_0x422a('0x9'));var csv=require(_0x422a('0xa'));var ejs=require(_0x422a('0xb'));var fs=require('fs');var fs_extra=require(_0x422a('0xc'));var _=require('lodash');var squel=require(_0x422a('0xd'));var crypto=require(_0x422a('0xe'));var jsforce=require(_0x422a('0xf'));var deskjs=require(_0x422a('0x10'));var toCsv=require(_0x422a('0xa'));var querystring=require(_0x422a('0x11'));var Papa=require(_0x422a('0x12'));var Redis=require(_0x422a('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x422a('0x14'));var hardwareService=require(_0x422a('0x15'));var logger=require(_0x422a('0x16'))(_0x422a('0x17'));var utils=require(_0x422a('0x18'));var config=require(_0x422a('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0x422a('0x1a'));function respondWithStatusCode(_0x4dbed1,_0x5a0c59){_0x5a0c59=_0x5a0c59||0xcc;return function(_0x5a1200){if(_0x5a1200){return _0x4dbed1[_0x422a('0x1b')](_0x5a0c59);}return _0x4dbed1[_0x422a('0x1c')](_0x5a0c59)[_0x422a('0x1d')]();};}function respondWithResult(_0x2dc9b2,_0x147af5){_0x147af5=_0x147af5||0xc8;return function(_0x428752){if(_0x428752){return _0x2dc9b2[_0x422a('0x1c')](_0x147af5)[_0x422a('0x1e')](_0x428752);}};}function respondWithFilteredResult(_0xf9fcf7,_0x2ba53b){return function(_0x30b6e9){if(_0x30b6e9){var _0x441fa8=typeof _0x2ba53b[_0x422a('0x1f')]===_0x422a('0x20')&&typeof _0x2ba53b[_0x422a('0x21')]===_0x422a('0x20');var _0x41c0a9=_0x30b6e9['count'];var _0x30847a=_0x441fa8?0x0:_0x2ba53b[_0x422a('0x1f')];var _0x5b29fc=_0x441fa8?_0x30b6e9[_0x422a('0x22')]:_0x2ba53b['offset']+_0x2ba53b['limit'];var _0x3ef74f;if(_0x5b29fc>=_0x41c0a9){_0x5b29fc=_0x41c0a9;_0x3ef74f=0xc8;}else{_0x3ef74f=0xce;}_0xf9fcf7[_0x422a('0x1c')](_0x3ef74f);return _0xf9fcf7[_0x422a('0x23')](_0x422a('0x24'),_0x30847a+'-'+_0x5b29fc+'/'+_0x41c0a9)[_0x422a('0x1e')](_0x30b6e9);}return null;};}function patchUpdates(_0x5f9720){return function(_0x6569d4){try{jsonpatch[_0x422a('0x25')](_0x6569d4,_0x5f9720,!![]);}catch(_0x55e0c8){return BPromise[_0x422a('0x26')](_0x55e0c8);}return _0x6569d4[_0x422a('0x27')]();};}function saveUpdates(_0x211d93,_0x3d3213){return function(_0x2283ca){if(_0x2283ca){return _0x2283ca['update'](_0x211d93)[_0x422a('0x28')](function(_0x33bc88){return _0x33bc88;});}return null;};}function removeEntity(_0x6e209d,_0x5e3138){return function(_0x14f06b){if(_0x14f06b){return _0x14f06b[_0x422a('0x29')]()[_0x422a('0x28')](function(){_0x6e209d[_0x422a('0x1c')](0xcc)[_0x422a('0x1d')]();});}};}function handleEntityNotFound(_0xa7e1dd,_0xca7e3c){return function(_0xe39bf5){if(!_0xe39bf5){_0xa7e1dd['sendStatus'](0x194);}return _0xe39bf5;};}function handleError(_0x911cc9,_0x15d2ab){_0x15d2ab=_0x15d2ab||0x1f4;return function(_0x572924){logger[_0x422a('0x2a')](_0x572924['stack']);if(_0x572924[_0x422a('0x2b')]){delete _0x572924[_0x422a('0x2b')];}_0x911cc9[_0x422a('0x1c')](_0x15d2ab)[_0x422a('0x2c')](_0x572924);};}exports['index']=function(_0x3cb362,_0x2f833e){var _0x50cc29={},_0x5826ac={},_0x3414ad={'count':0x0,'rows':[]};var _0x34226a=_['map'](db['FreshdeskAccount']['rawAttributes'],function(_0x56c732){return{'name':_0x56c732['fieldName'],'type':_0x56c732[_0x422a('0x2d')][_0x422a('0x2e')]};});_0x5826ac[_0x422a('0x2f')]=_[_0x422a('0x30')](_0x34226a,_0x422a('0x2b'));_0x5826ac['query']=_[_0x422a('0x31')](_0x3cb362[_0x422a('0x32')]);_0x5826ac[_0x422a('0x33')]=_[_0x422a('0x34')](_0x5826ac[_0x422a('0x2f')],_0x5826ac[_0x422a('0x32')]);_0x50cc29[_0x422a('0x35')]=_['intersection'](_0x5826ac[_0x422a('0x2f')],qs[_0x422a('0x36')](_0x3cb362[_0x422a('0x32')][_0x422a('0x36')]));_0x50cc29['attributes']=_0x50cc29[_0x422a('0x35')]['length']?_0x50cc29[_0x422a('0x35')]:_0x5826ac[_0x422a('0x2f')];if(!_0x3cb362['query'][_0x422a('0x37')](_0x422a('0x38'))){_0x50cc29['limit']=qs[_0x422a('0x21')](_0x3cb362[_0x422a('0x32')][_0x422a('0x21')]);_0x50cc29[_0x422a('0x1f')]=qs[_0x422a('0x1f')](_0x3cb362[_0x422a('0x32')][_0x422a('0x1f')]);}_0x50cc29[_0x422a('0x39')]=qs['sort'](_0x3cb362['query'][_0x422a('0x3a')]);_0x50cc29[_0x422a('0x3b')]=qs[_0x422a('0x33')](_['pick'](_0x3cb362[_0x422a('0x32')],_0x5826ac[_0x422a('0x33')]),_0x34226a);if(_0x3cb362['query']['filter']){_0x50cc29[_0x422a('0x3b')]=_['merge'](_0x50cc29[_0x422a('0x3b')],{'$or':_[_0x422a('0x30')](_0x34226a,function(_0x4d8328){if(_0x4d8328['type']!==_0x422a('0x3c')){var _0x31eedf={};_0x31eedf[_0x4d8328[_0x422a('0x2b')]]={'$like':'%'+_0x3cb362['query']['filter']+'%'};return _0x31eedf;}})});}_0x50cc29=_[_0x422a('0x3d')]({},_0x50cc29,_0x3cb362[_0x422a('0x3e')]);var _0x226638={'where':_0x50cc29['where']};return db[_0x422a('0x3f')][_0x422a('0x22')](_0x226638)[_0x422a('0x28')](function(_0x4388b6){_0x3414ad[_0x422a('0x22')]=_0x4388b6;if(_0x3cb362['query'][_0x422a('0x40')]){_0x50cc29[_0x422a('0x41')]=[{'all':!![]}];}return db[_0x422a('0x3f')][_0x422a('0x42')](_0x50cc29);})[_0x422a('0x28')](function(_0x58462e){_0x3414ad['rows']=_0x58462e;return _0x3414ad;})[_0x422a('0x28')](respondWithFilteredResult(_0x2f833e,_0x50cc29))['catch'](handleError(_0x2f833e,null));};exports[_0x422a('0x43')]=function(_0x42bbc1,_0x7a59f8){var _0x10302c={'raw':![],'where':{'id':_0x42bbc1[_0x422a('0x44')]['id']}},_0x474255={};_0x474255[_0x422a('0x2f')]=_['keys'](db[_0x422a('0x3f')][_0x422a('0x45')]);_0x474255[_0x422a('0x32')]=_[_0x422a('0x31')](_0x42bbc1[_0x422a('0x32')]);_0x474255[_0x422a('0x33')]=_[_0x422a('0x34')](_0x474255['model'],_0x474255[_0x422a('0x32')]);_0x10302c[_0x422a('0x35')]=_['intersection'](_0x474255[_0x422a('0x2f')],qs[_0x422a('0x36')](_0x42bbc1[_0x422a('0x32')][_0x422a('0x36')]));_0x10302c[_0x422a('0x35')]=_0x10302c[_0x422a('0x35')][_0x422a('0x46')]?_0x10302c['attributes']:_0x474255[_0x422a('0x2f')];if(_0x42bbc1[_0x422a('0x32')][_0x422a('0x40')]){_0x10302c[_0x422a('0x41')]=[{'all':!![]}];}_0x10302c=_[_0x422a('0x3d')]({},_0x10302c,_0x42bbc1[_0x422a('0x3e')]);return db[_0x422a('0x3f')][_0x422a('0x47')](_0x10302c)[_0x422a('0x28')](handleEntityNotFound(_0x7a59f8,null))[_0x422a('0x28')](respondWithResult(_0x7a59f8,null))['catch'](handleError(_0x7a59f8,null));};exports['create']=function(_0x3fd514,_0x18d748){return db['FreshdeskAccount'][_0x422a('0x48')](_0x3fd514[_0x422a('0x49')],{})[_0x422a('0x28')](respondWithResult(_0x18d748,0xc9))[_0x422a('0x4a')](handleError(_0x18d748,null));};exports[_0x422a('0x4b')]=function(_0x792783,_0x2c8f29){if(_0x792783[_0x422a('0x49')]['id']){delete _0x792783[_0x422a('0x49')]['id'];}return db[_0x422a('0x3f')]['find']({'where':{'id':_0x792783['params']['id']}})[_0x422a('0x28')](handleEntityNotFound(_0x2c8f29,null))[_0x422a('0x28')](saveUpdates(_0x792783['body'],null))[_0x422a('0x28')](respondWithResult(_0x2c8f29,null))[_0x422a('0x4a')](handleError(_0x2c8f29,null));};exports[_0x422a('0x29')]=function(_0x10de41,_0x111e64){return db[_0x422a('0x3f')][_0x422a('0x47')]({'where':{'id':_0x10de41['params']['id']}})[_0x422a('0x28')](handleEntityNotFound(_0x111e64,null))[_0x422a('0x28')](removeEntity(_0x111e64,null))[_0x422a('0x4a')](handleError(_0x111e64,null));};exports[_0x422a('0x4c')]=function(_0x139d54,_0x28d1ba,_0x5ba834){var _0x5e2cda={};var _0x433cf2={};var _0x1a3778;var _0x1ff3ad;return db[_0x422a('0x3f')][_0x422a('0x4d')]({'where':{'id':_0x139d54[_0x422a('0x44')]['id']}})[_0x422a('0x28')](handleEntityNotFound(_0x28d1ba,null))[_0x422a('0x28')](function(_0x445f7c){if(_0x445f7c){_0x1a3778=_0x445f7c;_0x433cf2['model']=_['keys'](db['FreshdeskConfiguration'][_0x422a('0x45')]);_0x433cf2[_0x422a('0x32')]=_[_0x422a('0x31')](_0x139d54[_0x422a('0x32')]);_0x433cf2['filters']=_[_0x422a('0x34')](_0x433cf2[_0x422a('0x2f')],_0x433cf2[_0x422a('0x32')]);_0x5e2cda[_0x422a('0x35')]=_[_0x422a('0x34')](_0x433cf2[_0x422a('0x2f')],qs['fields'](_0x139d54['query'][_0x422a('0x36')]));_0x5e2cda[_0x422a('0x35')]=_0x5e2cda[_0x422a('0x35')]['length']?_0x5e2cda[_0x422a('0x35')]:_0x433cf2['model'];_0x5e2cda[_0x422a('0x39')]=qs[_0x422a('0x3a')](_0x139d54['query']['sort']);_0x5e2cda[_0x422a('0x3b')]=qs[_0x422a('0x33')](_['pick'](_0x139d54[_0x422a('0x32')],_0x433cf2[_0x422a('0x33')]));if(_0x139d54[_0x422a('0x32')][_0x422a('0x4e')]){_0x5e2cda[_0x422a('0x3b')]=_[_0x422a('0x3d')](_0x5e2cda[_0x422a('0x3b')],{'$or':_[_0x422a('0x30')](_0x5e2cda['attributes'],function(_0x547a67){var _0x9bdbe5={};_0x9bdbe5[_0x547a67]={'$like':'%'+_0x139d54[_0x422a('0x32')][_0x422a('0x4e')]+'%'};return _0x9bdbe5;})});}_0x5e2cda=_[_0x422a('0x3d')]({},_0x5e2cda,_0x139d54[_0x422a('0x3e')]);return _0x1a3778['getConfigurations'](_0x5e2cda);}})['then'](function(_0xf89005){if(_0xf89005){_0x1ff3ad=_0xf89005[_0x422a('0x46')];if(!_0x139d54[_0x422a('0x32')][_0x422a('0x37')]('nolimit')){_0x5e2cda[_0x422a('0x21')]=qs['limit'](_0x139d54['query']['limit']);_0x5e2cda[_0x422a('0x1f')]=qs[_0x422a('0x1f')](_0x139d54[_0x422a('0x32')][_0x422a('0x1f')]);}return _0x1a3778['getConfigurations'](_0x5e2cda);}})[_0x422a('0x28')](function(_0x1726dd){if(_0x1726dd){return _0x1726dd?{'count':_0x1ff3ad,'rows':_0x1726dd}:null;}})[_0x422a('0x28')](respondWithResult(_0x28d1ba,null))[_0x422a('0x4a')](handleError(_0x28d1ba,null));};exports[_0x422a('0x4f')]=function(_0x21a2c3,_0x524d68,_0x3546aa){if(_0x21a2c3[_0x422a('0x49')]['id']){delete _0x21a2c3[_0x422a('0x49')]['id'];}return db[_0x422a('0x3f')][_0x422a('0x4d')]({'where':{'id':_0x21a2c3[_0x422a('0x44')]['id']}})['then'](handleEntityNotFound(_0x524d68,null))['then'](function(_0x1e2320){if(_0x1e2320){_0x21a2c3[_0x422a('0x49')][_0x422a('0x50')]=_0x1e2320['id'];_0x21a2c3[_0x422a('0x49')][_0x422a('0x51')]=integrations[_0x422a('0x52')](_0x21a2c3[_0x422a('0x49')][_0x422a('0x53')],_0x21a2c3[_0x422a('0x49')]['type']);_0x21a2c3[_0x422a('0x49')][_0x422a('0x54')]=integrations[_0x422a('0x55')](_0x21a2c3['body']['channel'],_0x21a2c3['body'][_0x422a('0x2d')]);return db[_0x422a('0x56')][_0x422a('0x48')](_0x21a2c3[_0x422a('0x49')],{'include':[{'model':db[_0x422a('0x57')],'as':_0x422a('0x51')},{'model':db[_0x422a('0x57')],'as':_0x422a('0x54')}]});}return null;})[_0x422a('0x28')](respondWithResult(_0x524d68,null))[_0x422a('0x4a')](handleError(_0x524d68,null));};exports[_0x422a('0x58')]=function(_0x4913ad,_0x38e87a,_0xeaff7){var _0x51fd26='';return db[_0x422a('0x3f')][_0x422a('0x4d')]({'where':{'id':_0x4913ad[_0x422a('0x44')]['id']},'attributes':['id',_0x422a('0x59'),'apiKey']})[_0x422a('0x28')](handleEntityNotFound(_0x38e87a,null))['then'](function(_0x24937a){if(_0x24937a){_0x51fd26=_0x24937a['remoteUri'];var _0xb6d861=_0x51fd26[_0x422a('0x5a')](-0x1);if(_0xb6d861==='/'){_0x51fd26=_0x51fd26[_0x422a('0x5b')](0x0,_0x51fd26[_0x422a('0x5c')](_0xb6d861));}return rp({'method':_0x422a('0x5d'),'uri':util[_0x422a('0x5e')](_0x422a('0x5f'),_0x51fd26,_0x422a('0x60')),'headers':{'Authorization':util[_0x422a('0x5e')](_0x422a('0x61'),new Buffer(util[_0x422a('0x5e')](_0x422a('0x62'),_0x24937a[_0x422a('0x63')]))['toString']('base64'))},'json':!![]});}})[_0x422a('0x28')](function(_0x13b25b){if(_0x13b25b){var _0x4f5acc=['requester',_0x422a('0x64'),_0x422a('0x65'),_0x422a('0x66'),'status','priority',_0x422a('0x67'),'source','ticket_type',_0x422a('0x67'),_0x422a('0x68')];_[_0x422a('0x69')](_0x13b25b,function(_0x26d32f){return _0x4f5acc[_0x422a('0x6a')](_0x26d32f['name'])||!_0x26d32f[_0x422a('0x6b')]&&_0x26d32f[_0x422a('0x2d')]!=='custom_text'&&_0x26d32f[_0x422a('0x2d')]!==_0x422a('0x6c');});return{'count':_0x13b25b[_0x422a('0x46')],'rows':_['map'](_0x13b25b,function(_0xc99ce9){return{'id':_0xc99ce9[_0x422a('0x2b')],'name':_0xc99ce9[_0x422a('0x6d')],'custom':!_0xc99ce9[_0x422a('0x6b')],'options':_0xc99ce9[_0x422a('0x6e')]?_[_0x422a('0x30')](_0xc99ce9[_0x422a('0x6e')],function(_0x5159fe){return{'name':_[_0x422a('0x6f')](_0x5159fe),'value':_0x5159fe};}):[]};})};}})[_0x422a('0x28')](respondWithResult(_0x38e87a,null))[_0x422a('0x4a')](function(_0x62b2e8){var _0x2faae0=_0x4913ad[_0x422a('0x32')]['test']?0x1f4:_0x62b2e8['statusCode']||0x1f4;logger[_0x422a('0x2a')](_0x422a('0x70'),'getFields',_0x2faae0,JSON[_0x422a('0x71')](_0x62b2e8));delete _0x62b2e8[_0x422a('0x2b')];if(_0x2faae0===0x191){_0x2faae0=0x190;}_0x38e87a[_0x422a('0x1c')](_0x2faae0)[_0x422a('0x2c')](_0x4913ad[_0x422a('0x32')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x62b2e8['statusCode']}:_0x62b2e8);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index 85d629f..deb1522 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 _0x20fe=['exports','define','FreshdeskAccount','int_freshdesk_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intFreshdeskAccount.attributes','../../components/integrations/configuration'];(function(_0x567d37,_0x1ce5eb){var _0x481a92=function(_0x3adc58){while(--_0x3adc58){_0x567d37['push'](_0x567d37['shift']());}};_0x481a92(++_0x1ce5eb);}(_0x20fe,0x18a));var _0xe20f=function(_0x2feab5,_0x462c25){_0x2feab5=_0x2feab5-0x0;var _0x586632=_0x20fe[_0x2feab5];return _0x586632;};'use strict';var _=require(_0xe20f('0x0'));var util=require(_0xe20f('0x1'));var logger=require(_0xe20f('0x2'))(_0xe20f('0x3'));var moment=require(_0xe20f('0x4'));var BPromise=require(_0xe20f('0x5'));var rp=require(_0xe20f('0x6'));var fs=require('fs');var path=require(_0xe20f('0x7'));var rimraf=require(_0xe20f('0x8'));var config=require('../../config/environment');var attributes=require(_0xe20f('0x9'));var integrations=require(_0xe20f('0xa'));module[_0xe20f('0xb')]=function(_0x4fec92,_0x2341a5){return _0x4fec92[_0xe20f('0xc')](_0xe20f('0xd'),attributes,{'tableName':_0xe20f('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6e3d=['define','FreshdeskAccount','int_freshdesk_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration'];(function(_0x260b2f,_0x56907c){var _0x3f4d35=function(_0x15ee1f){while(--_0x15ee1f){_0x260b2f['push'](_0x260b2f['shift']());}};_0x3f4d35(++_0x56907c);}(_0x6e3d,0xd5));var _0xd6e3=function(_0x504df1,_0x289598){_0x504df1=_0x504df1-0x0;var _0x1063b5=_0x6e3d[_0x504df1];return _0x1063b5;};'use strict';var _=require(_0xd6e3('0x0'));var util=require(_0xd6e3('0x1'));var logger=require(_0xd6e3('0x2'))(_0xd6e3('0x3'));var moment=require(_0xd6e3('0x4'));var BPromise=require(_0xd6e3('0x5'));var rp=require(_0xd6e3('0x6'));var fs=require('fs');var path=require(_0xd6e3('0x7'));var rimraf=require('rimraf');var config=require(_0xd6e3('0x8'));var attributes=require(_0xd6e3('0x9'));var integrations=require(_0xd6e3('0xa'));module['exports']=function(_0x355e88,_0x3b2580){return _0x355e88[_0xd6e3('0xb')](_0xd6e3('0xc'),attributes,{'tableName':_0xd6e3('0xd'),'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 d634279..7eb7088 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 _0x59cb=['../../config/logger','../../config/environment','client','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','GetFreshdeskAccount','FreshdeskAccount','findAll','options','raw','where','limit','include','attributes','model','map','debug','stringify','find','ShowFreshdeskAccount','lodash','util','randomstring','ioredis','../../mysqldb'];(function(_0x119820,_0x57035f){var _0xa3d353=function(_0x37daba){while(--_0x37daba){_0x119820['push'](_0x119820['shift']());}};_0xa3d353(++_0x57035f);}(_0x59cb,0x9b));var _0xb59c=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x59cb[_0x53ccf2];return _0x5a2964;};'use strict';var _=require(_0xb59c('0x0'));var util=require(_0xb59c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xb59c('0x2'));var fs=require('fs');var Redis=require(_0xb59c('0x3'));var db=require(_0xb59c('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xb59c('0x5'))('rpc');var config=require(_0xb59c('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xb59c('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x440c13,_0x5e1d53,_0x345ec0){return new BPromise(function(_0x366fe6,_0x5ecc05){return client['request'](_0x440c13,_0x345ec0)[_0xb59c('0x8')](function(_0x302803){logger[_0xb59c('0x9')](_0xb59c('0xa'),_0x5e1d53,_0xb59c('0xb'));logger['debug']('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0x5e1d53,'request\x20sent',JSON['stringify'](_0x302803));if(_0x302803[_0xb59c('0xc')]){if(_0x302803[_0xb59c('0xc')][_0xb59c('0xd')]===0x1f4){logger[_0xb59c('0xc')](_0xb59c('0xa'),_0x5e1d53,_0x302803['error']['message']);return _0x5ecc05(_0x302803['error'][_0xb59c('0xe')]);}logger[_0xb59c('0xc')]('FreshdeskAccount,\x20%s,\x20%s',_0x5e1d53,_0x302803[_0xb59c('0xc')][_0xb59c('0xe')]);return _0x366fe6(_0x302803[_0xb59c('0xc')][_0xb59c('0xe')]);}else{logger[_0xb59c('0x9')](_0xb59c('0xa'),_0x5e1d53,_0xb59c('0xb'));_0x366fe6(_0x302803[_0xb59c('0xf')]['message']);}})[_0xb59c('0x10')](function(_0x48111c){logger[_0xb59c('0xc')](_0xb59c('0xa'),_0x5e1d53,_0x48111c);_0x5ecc05(_0x48111c);});});}exports[_0xb59c('0x11')]=function(_0x1cebb5){var _0x4fbf5d=this;return new Promise(function(_0x515a31,_0x82b5ec){return db[_0xb59c('0x12')][_0xb59c('0x13')]({'raw':_0x1cebb5['options']?_0x1cebb5[_0xb59c('0x14')][_0xb59c('0x15')]===undefined?!![]:![]:!![],'where':_0x1cebb5[_0xb59c('0x14')]?_0x1cebb5[_0xb59c('0x14')][_0xb59c('0x16')]||null:null,'attributes':_0x1cebb5[_0xb59c('0x14')]?_0x1cebb5[_0xb59c('0x14')]['attributes']||null:null,'limit':_0x1cebb5['options']?_0x1cebb5[_0xb59c('0x14')][_0xb59c('0x17')]||null:null,'include':_0x1cebb5[_0xb59c('0x14')]?_0x1cebb5[_0xb59c('0x14')][_0xb59c('0x18')]?_['map'](_0x1cebb5[_0xb59c('0x14')][_0xb59c('0x18')],function(_0x43b32a){return{'model':db[_0x43b32a['model']],'as':_0x43b32a['as'],'attributes':_0x43b32a[_0xb59c('0x19')],'include':_0x43b32a[_0xb59c('0x18')]?_['map'](_0x43b32a[_0xb59c('0x18')],function(_0x4464d0){return{'model':db[_0x4464d0[_0xb59c('0x1a')]],'as':_0x4464d0['as'],'attributes':_0x4464d0[_0xb59c('0x19')],'include':_0x4464d0[_0xb59c('0x18')]?_[_0xb59c('0x1b')](_0x4464d0[_0xb59c('0x18')],function(_0x2079d5){return{'model':db[_0x2079d5['model']],'as':_0x2079d5['as'],'attributes':_0x2079d5[_0xb59c('0x19')]};}):[]};}):[]};}):[]:[]})[_0xb59c('0x8')](function(_0x396786){logger[_0xb59c('0x9')]('GetFreshdeskAccount',_0x1cebb5);logger[_0xb59c('0x1c')](_0xb59c('0x11'),_0x1cebb5,JSON[_0xb59c('0x1d')](_0x396786));_0x515a31(_0x396786);})[_0xb59c('0x10')](function(_0xab9c25){logger[_0xb59c('0xc')](_0xb59c('0x11'),_0xab9c25['message'],_0x1cebb5);_0x82b5ec(_0x4fbf5d[_0xb59c('0xc')](0x1f4,_0xab9c25[_0xb59c('0xe')]));});});};exports['ShowFreshdeskAccount']=function(_0x4e283e){var _0x9c4f4e=this;return new Promise(function(_0x47cdf9,_0x35d5f9){return db[_0xb59c('0x12')][_0xb59c('0x1e')]({'raw':_0x4e283e['options']?_0x4e283e[_0xb59c('0x14')][_0xb59c('0x15')]===undefined?!![]:![]:!![],'where':_0x4e283e[_0xb59c('0x14')]?_0x4e283e[_0xb59c('0x14')][_0xb59c('0x16')]||null:null,'attributes':_0x4e283e[_0xb59c('0x14')]?_0x4e283e[_0xb59c('0x14')]['attributes']||null:null,'include':_0x4e283e[_0xb59c('0x14')]?_0x4e283e['options'][_0xb59c('0x18')]?_['map'](_0x4e283e[_0xb59c('0x14')][_0xb59c('0x18')],function(_0x4cd412){return{'model':db[_0x4cd412['model']],'as':_0x4cd412['as'],'attributes':_0x4cd412[_0xb59c('0x19')],'include':_0x4cd412['include']?_['map'](_0x4cd412['include'],function(_0x8613f3){return{'model':db[_0x8613f3['model']],'as':_0x8613f3['as'],'attributes':_0x8613f3[_0xb59c('0x19')],'include':_0x8613f3[_0xb59c('0x18')]?_[_0xb59c('0x1b')](_0x8613f3['include'],function(_0x331a6f){return{'model':db[_0x331a6f[_0xb59c('0x1a')]],'as':_0x331a6f['as'],'attributes':_0x331a6f[_0xb59c('0x19')]};}):[]};}):[]};}):[]:[]})[_0xb59c('0x8')](function(_0x5a3c44){logger[_0xb59c('0x9')](_0xb59c('0x1f'),_0x4e283e);logger[_0xb59c('0x1c')](_0xb59c('0x1f'),_0x4e283e,JSON[_0xb59c('0x1d')](_0x5a3c44));_0x47cdf9(_0x5a3c44);})[_0xb59c('0x10')](function(_0x4a0bef){logger[_0xb59c('0xc')](_0xb59c('0x1f'),_0x4a0bef[_0xb59c('0xe')],_0x4e283e);_0x35d5f9(_0x9c4f4e[_0xb59c('0xc')](0x1f4,_0x4a0bef[_0xb59c('0xe')]));});});}; \ No newline at end of file +var _0xf3cb=['debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','FreshdeskAccount','findAll','options','raw','where','limit','include','map','model','attributes','then','GetFreshdeskAccount','find','ShowFreshdeskAccount','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','FreshdeskAccount,\x20%s,\x20%s','request\x20sent'];(function(_0x36eaaa,_0x326732){var _0x461349=function(_0x4e4180){while(--_0x4e4180){_0x36eaaa['push'](_0x36eaaa['shift']());}};_0x461349(++_0x326732);}(_0xf3cb,0x89));var _0xbf3c=function(_0x404930,_0x428554){_0x404930=_0x404930-0x0;var _0x4b36c0=_0xf3cb[_0x404930];return _0x4b36c0;};'use strict';var _=require(_0xbf3c('0x0'));var util=require(_0xbf3c('0x1'));var moment=require(_0xbf3c('0x2'));var BPromise=require(_0xbf3c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbf3c('0x4'))['db'];var utils=require(_0xbf3c('0x5'));var logger=require(_0xbf3c('0x6'))(_0xbf3c('0x7'));var config=require(_0xbf3c('0x8'));var jayson=require(_0xbf3c('0x9'));var client=jayson[_0xbf3c('0xa')][_0xbf3c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x41ba53,_0x5e09ce,_0x1249d7){return new BPromise(function(_0x4ddb46,_0x341954){return client[_0xbf3c('0xc')](_0x41ba53,_0x1249d7)['then'](function(_0xa48a74){logger['info'](_0xbf3c('0xd'),_0x5e09ce,_0xbf3c('0xe'));logger[_0xbf3c('0xf')](_0xbf3c('0x10'),_0x5e09ce,_0xbf3c('0xe'),JSON[_0xbf3c('0x11')](_0xa48a74));if(_0xa48a74['error']){if(_0xa48a74[_0xbf3c('0x12')][_0xbf3c('0x13')]===0x1f4){logger[_0xbf3c('0x12')](_0xbf3c('0xd'),_0x5e09ce,_0xa48a74[_0xbf3c('0x12')][_0xbf3c('0x14')]);return _0x341954(_0xa48a74['error'][_0xbf3c('0x14')]);}logger[_0xbf3c('0x12')]('FreshdeskAccount,\x20%s,\x20%s',_0x5e09ce,_0xa48a74['error'][_0xbf3c('0x14')]);return _0x4ddb46(_0xa48a74[_0xbf3c('0x12')]['message']);}else{logger[_0xbf3c('0x15')](_0xbf3c('0xd'),_0x5e09ce,_0xbf3c('0xe'));_0x4ddb46(_0xa48a74[_0xbf3c('0x16')][_0xbf3c('0x14')]);}})[_0xbf3c('0x17')](function(_0x557ee1){logger[_0xbf3c('0x12')](_0xbf3c('0xd'),_0x5e09ce,_0x557ee1);_0x341954(_0x557ee1);});});}exports['GetFreshdeskAccount']=function(_0x3e47aa){var _0x5ade2b=this;return new Promise(function(_0x2bf64c,_0x2314e0){return db[_0xbf3c('0x18')][_0xbf3c('0x19')]({'raw':_0x3e47aa[_0xbf3c('0x1a')]?_0x3e47aa[_0xbf3c('0x1a')][_0xbf3c('0x1b')]===undefined?!![]:![]:!![],'where':_0x3e47aa[_0xbf3c('0x1a')]?_0x3e47aa[_0xbf3c('0x1a')][_0xbf3c('0x1c')]||null:null,'attributes':_0x3e47aa[_0xbf3c('0x1a')]?_0x3e47aa[_0xbf3c('0x1a')]['attributes']||null:null,'limit':_0x3e47aa[_0xbf3c('0x1a')]?_0x3e47aa[_0xbf3c('0x1a')][_0xbf3c('0x1d')]||null:null,'include':_0x3e47aa[_0xbf3c('0x1a')]?_0x3e47aa[_0xbf3c('0x1a')][_0xbf3c('0x1e')]?_[_0xbf3c('0x1f')](_0x3e47aa['options'][_0xbf3c('0x1e')],function(_0x585347){return{'model':db[_0x585347[_0xbf3c('0x20')]],'as':_0x585347['as'],'attributes':_0x585347[_0xbf3c('0x21')],'include':_0x585347[_0xbf3c('0x1e')]?_[_0xbf3c('0x1f')](_0x585347['include'],function(_0x34b707){return{'model':db[_0x34b707[_0xbf3c('0x20')]],'as':_0x34b707['as'],'attributes':_0x34b707[_0xbf3c('0x21')],'include':_0x34b707[_0xbf3c('0x1e')]?_[_0xbf3c('0x1f')](_0x34b707[_0xbf3c('0x1e')],function(_0x317400){return{'model':db[_0x317400['model']],'as':_0x317400['as'],'attributes':_0x317400[_0xbf3c('0x21')]};}):[]};}):[]};}):[]:[]})[_0xbf3c('0x22')](function(_0x30389f){logger[_0xbf3c('0x15')](_0xbf3c('0x23'),_0x3e47aa);logger[_0xbf3c('0xf')](_0xbf3c('0x23'),_0x3e47aa,JSON[_0xbf3c('0x11')](_0x30389f));_0x2bf64c(_0x30389f);})[_0xbf3c('0x17')](function(_0x2a77ef){logger[_0xbf3c('0x12')](_0xbf3c('0x23'),_0x2a77ef[_0xbf3c('0x14')],_0x3e47aa);_0x2314e0(_0x5ade2b['error'](0x1f4,_0x2a77ef[_0xbf3c('0x14')]));});});};exports['ShowFreshdeskAccount']=function(_0xa43aa3){var _0x461716=this;return new Promise(function(_0x190a73,_0x2a985e){return db[_0xbf3c('0x18')][_0xbf3c('0x24')]({'raw':_0xa43aa3['options']?_0xa43aa3[_0xbf3c('0x1a')][_0xbf3c('0x1b')]===undefined?!![]:![]:!![],'where':_0xa43aa3[_0xbf3c('0x1a')]?_0xa43aa3[_0xbf3c('0x1a')][_0xbf3c('0x1c')]||null:null,'attributes':_0xa43aa3[_0xbf3c('0x1a')]?_0xa43aa3[_0xbf3c('0x1a')][_0xbf3c('0x21')]||null:null,'include':_0xa43aa3[_0xbf3c('0x1a')]?_0xa43aa3[_0xbf3c('0x1a')][_0xbf3c('0x1e')]?_[_0xbf3c('0x1f')](_0xa43aa3[_0xbf3c('0x1a')][_0xbf3c('0x1e')],function(_0x16849f){return{'model':db[_0x16849f[_0xbf3c('0x20')]],'as':_0x16849f['as'],'attributes':_0x16849f['attributes'],'include':_0x16849f['include']?_['map'](_0x16849f[_0xbf3c('0x1e')],function(_0x49f3eb){return{'model':db[_0x49f3eb[_0xbf3c('0x20')]],'as':_0x49f3eb['as'],'attributes':_0x49f3eb[_0xbf3c('0x21')],'include':_0x49f3eb[_0xbf3c('0x1e')]?_[_0xbf3c('0x1f')](_0x49f3eb[_0xbf3c('0x1e')],function(_0x430b3c){return{'model':db[_0x430b3c[_0xbf3c('0x20')]],'as':_0x430b3c['as'],'attributes':_0x430b3c[_0xbf3c('0x21')]};}):[]};}):[]};}):[]:[]})[_0xbf3c('0x22')](function(_0x233276){logger[_0xbf3c('0x15')]('ShowFreshdeskAccount',_0xa43aa3);logger[_0xbf3c('0xf')]('ShowFreshdeskAccount',_0xa43aa3,JSON[_0xbf3c('0x11')](_0x233276));_0x190a73(_0x233276);})[_0xbf3c('0x17')](function(_0x2da473){logger['error'](_0xbf3c('0x25'),_0x2da473[_0xbf3c('0x14')],_0xa43aa3);_0x2a985e(_0x461716[_0xbf3c('0x12')](0x1f4,_0x2da473['message']));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index c035325..8b54d91 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 _0x5a39=['getDescriptions','/:id/tags','getTags','post','create','setTags','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/descriptions'];(function(_0x43a1a9,_0x1d56cc){var _0x3c6c38=function(_0x416013){while(--_0x416013){_0x43a1a9['push'](_0x43a1a9['shift']());}};_0x3c6c38(++_0x1d56cc);}(_0x5a39,0x91));var _0x95a3=function(_0x4bfb8a,_0x5bd7e9){_0x4bfb8a=_0x4bfb8a-0x0;var _0x31826e=_0x5a39[_0x4bfb8a];return _0x31826e;};'use strict';var multer=require(_0x95a3('0x0'));var util=require(_0x95a3('0x1'));var path=require(_0x95a3('0x2'));var timeout=require(_0x95a3('0x3'));var express=require(_0x95a3('0x4'));var router=express[_0x95a3('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x95a3('0x6'));var interaction=require(_0x95a3('0x7'));var config=require(_0x95a3('0x8'));var controller=require('./intFreshdeskConfiguration.controller');router[_0x95a3('0x9')]('/',auth[_0x95a3('0xa')](),controller[_0x95a3('0xb')]);router[_0x95a3('0x9')](_0x95a3('0xc'),auth['isAuthenticated'](),controller[_0x95a3('0xd')]);router[_0x95a3('0x9')](_0x95a3('0xe'),auth['isAuthenticated'](),controller[_0x95a3('0xf')]);router['get']('/:id/subjects',auth['isAuthenticated'](),controller['getSubjects']);router[_0x95a3('0x9')](_0x95a3('0x10'),auth[_0x95a3('0xa')](),controller[_0x95a3('0x11')]);router['get'](_0x95a3('0x12'),auth[_0x95a3('0xa')](),controller[_0x95a3('0x13')]);router[_0x95a3('0x14')]('/',auth[_0x95a3('0xa')](),controller[_0x95a3('0x15')]);router['post']('/:id/tags',auth['isAuthenticated'](),controller[_0x95a3('0x16')]);router[_0x95a3('0x17')](_0x95a3('0xc'),auth[_0x95a3('0xa')](),controller[_0x95a3('0x18')]);router[_0x95a3('0x19')](_0x95a3('0xc'),auth['isAuthenticated'](),controller[_0x95a3('0x1a')]);module['exports']=router; \ No newline at end of file +var _0xae01=['/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','create','post','setTags','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','./intFreshdeskConfiguration.controller','get','isAuthenticated','/:id'];(function(_0x5317b5,_0x4dfd6e){var _0x3b7ce2=function(_0xc146d6){while(--_0xc146d6){_0x5317b5['push'](_0x5317b5['shift']());}};_0x3b7ce2(++_0x4dfd6e);}(_0xae01,0x16c));var _0x1ae0=function(_0xfdc33b,_0x5bad7f){_0xfdc33b=_0xfdc33b-0x0;var _0x37a1eb=_0xae01[_0xfdc33b];return _0x37a1eb;};'use strict';var multer=require(_0x1ae0('0x0'));var util=require(_0x1ae0('0x1'));var path=require(_0x1ae0('0x2'));var timeout=require(_0x1ae0('0x3'));var express=require(_0x1ae0('0x4'));var router=express[_0x1ae0('0x5')]();var fs_extra=require(_0x1ae0('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x1ae0('0x7'));router[_0x1ae0('0x8')]('/',auth[_0x1ae0('0x9')](),controller['index']);router[_0x1ae0('0x8')](_0x1ae0('0xa'),auth['isAuthenticated'](),controller['show']);router['get'](_0x1ae0('0xb'),auth[_0x1ae0('0x9')](),controller[_0x1ae0('0xc')]);router[_0x1ae0('0x8')](_0x1ae0('0xd'),auth[_0x1ae0('0x9')](),controller[_0x1ae0('0xe')]);router['get'](_0x1ae0('0xf'),auth[_0x1ae0('0x9')](),controller[_0x1ae0('0x10')]);router['get'](_0x1ae0('0x11'),auth[_0x1ae0('0x9')](),controller['getTags']);router['post']('/',auth['isAuthenticated'](),controller[_0x1ae0('0x12')]);router[_0x1ae0('0x13')](_0x1ae0('0x11'),auth[_0x1ae0('0x9')](),controller[_0x1ae0('0x14')]);router[_0x1ae0('0x15')](_0x1ae0('0xa'),auth['isAuthenticated'](),controller[_0x1ae0('0x16')]);router[_0x1ae0('0x17')](_0x1ae0('0xa'),auth[_0x1ae0('0x9')](),controller['destroy']);module[_0x1ae0('0x18')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index ce4b32d..d2bc4cc 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 _0x85c9=['sequelize','STRING'];(function(_0x4fc9e6,_0xc51915){var _0x551d28=function(_0x1a603b){while(--_0x1a603b){_0x4fc9e6['push'](_0x4fc9e6['shift']());}};_0x551d28(++_0xc51915);}(_0x85c9,0x1c0));var _0x985c=function(_0x20845e,_0x211e78){_0x20845e=_0x20845e-0x0;var _0x28cf2b=_0x85c9[_0x20845e];return _0x28cf2b;};'use strict';var Sequelize=require(_0x985c('0x0'));module['exports']={'name':{'type':Sequelize[_0x985c('0x1')]},'description':{'type':Sequelize[_0x985c('0x1')]}}; \ No newline at end of file +var _0xed6f=['STRING','exports'];(function(_0x1dcd08,_0x50a6ba){var _0x1e3edd=function(_0xf7556){while(--_0xf7556){_0x1dcd08['push'](_0x1dcd08['shift']());}};_0x1e3edd(++_0x50a6ba);}(_0xed6f,0x89));var _0xfed6=function(_0x32cae3,_0x3075fe){_0x32cae3=_0x32cae3-0x0;var _0x25526b=_0xed6f[_0x32cae3];return _0x25526b;};'use strict';var Sequelize=require('sequelize');module[_0xfed6('0x0')]={'name':{'type':Sequelize[_0xfed6('0x1')]},'description':{'type':Sequelize[_0xfed6('0x1')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index 1262a8e..5d0b753 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 _0x33e4=['create','body','getFields','findOne','FreshdeskField','getSubjects','getDescriptions','getTags','Tag','ids','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','count','limit','set','apply','reject','update','then','end','sendStatus','error','stack','name','index','map','FreshdeskConfiguration','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys','options','find'];(function(_0x4f0f27,_0x51deba){var _0x2ce661=function(_0x52a20f){while(--_0x52a20f){_0x4f0f27['push'](_0x4f0f27['shift']());}};_0x2ce661(++_0x51deba);}(_0x33e4,0x1a4));var _0x433e=function(_0x3b36be,_0x5b5b18){_0x3b36be=_0x3b36be-0x0;var _0x40d1f2=_0x33e4[_0x3b36be];return _0x40d1f2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x433e('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x433e('0x1'));var rp=require(_0x433e('0x2'));var moment=require(_0x433e('0x3'));var BPromise=require(_0x433e('0x4'));var Mustache=require(_0x433e('0x5'));var util=require('util');var path=require('path');var sox=require(_0x433e('0x6'));var csv=require('to-csv');var ejs=require(_0x433e('0x7'));var fs=require('fs');var fs_extra=require(_0x433e('0x8'));var _=require(_0x433e('0x9'));var squel=require(_0x433e('0xa'));var crypto=require(_0x433e('0xb'));var jsforce=require(_0x433e('0xc'));var deskjs=require(_0x433e('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x433e('0xe'));var Redis=require(_0x433e('0xf'));var authService=require(_0x433e('0x10'));var qs=require(_0x433e('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x433e('0x12'));var logger=require(_0x433e('0x13'))('api');var utils=require(_0x433e('0x14'));var config=require(_0x433e('0x15'));var licenseUtil=require(_0x433e('0x16'));var db=require(_0x433e('0x17'))['db'];function respondWithStatusCode(_0x5384e4,_0x27888f){_0x27888f=_0x27888f||0xcc;return function(_0xf87d58){if(_0xf87d58){return _0x5384e4['sendStatus'](_0x27888f);}return _0x5384e4['status'](_0x27888f)['end']();};}function respondWithResult(_0x23f054,_0x17afaf){_0x17afaf=_0x17afaf||0xc8;return function(_0x44d32b){if(_0x44d32b){return _0x23f054[_0x433e('0x18')](_0x17afaf)[_0x433e('0x19')](_0x44d32b);}};}function respondWithFilteredResult(_0x51cc67,_0x40ac2c){return function(_0x191f06){if(_0x191f06){var _0x179e62=typeof _0x40ac2c[_0x433e('0x1a')]===_0x433e('0x1b')&&typeof _0x40ac2c['limit']===_0x433e('0x1b');var _0x271b71=_0x191f06['count'];var _0x4b0b7c=_0x179e62?0x0:_0x40ac2c[_0x433e('0x1a')];var _0x2353b4=_0x179e62?_0x191f06[_0x433e('0x1c')]:_0x40ac2c[_0x433e('0x1a')]+_0x40ac2c[_0x433e('0x1d')];var _0xd8db4f;if(_0x2353b4>=_0x271b71){_0x2353b4=_0x271b71;_0xd8db4f=0xc8;}else{_0xd8db4f=0xce;}_0x51cc67[_0x433e('0x18')](_0xd8db4f);return _0x51cc67[_0x433e('0x1e')]('Content-Range',_0x4b0b7c+'-'+_0x2353b4+'/'+_0x271b71)[_0x433e('0x19')](_0x191f06);}return null;};}function patchUpdates(_0x519776){return function(_0xb3cf80){try{jsonpatch[_0x433e('0x1f')](_0xb3cf80,_0x519776,!![]);}catch(_0x38228b){return BPromise[_0x433e('0x20')](_0x38228b);}return _0xb3cf80['save']();};}function saveUpdates(_0x13049a,_0x541f54){return function(_0x2757d4){if(_0x2757d4){return _0x2757d4[_0x433e('0x21')](_0x13049a)[_0x433e('0x22')](function(_0x19ecdb){return _0x19ecdb;});}return null;};}function removeEntity(_0x482d0b,_0x41b3a1){return function(_0x1408b1){if(_0x1408b1){return _0x1408b1['destroy']()[_0x433e('0x22')](function(){_0x482d0b[_0x433e('0x18')](0xcc)[_0x433e('0x23')]();});}};}function handleEntityNotFound(_0xc386ab,_0x25ab7e){return function(_0xcb0d2f){if(!_0xcb0d2f){_0xc386ab[_0x433e('0x24')](0x194);}return _0xcb0d2f;};}function handleError(_0x1c5e4b,_0x5ec84c){_0x5ec84c=_0x5ec84c||0x1f4;return function(_0x1f6a31){logger[_0x433e('0x25')](_0x1f6a31[_0x433e('0x26')]);if(_0x1f6a31['name']){delete _0x1f6a31[_0x433e('0x27')];}_0x1c5e4b[_0x433e('0x18')](_0x5ec84c)['send'](_0x1f6a31);};}exports[_0x433e('0x28')]=function(_0x4216f1,_0x12c202){var _0x4b88d6={},_0x45e3c2={},_0x5367e3={'count':0x0,'rows':[]};var _0x329eb5=_[_0x433e('0x29')](db[_0x433e('0x2a')][_0x433e('0x2b')],function(_0x322ac3){return{'name':_0x322ac3[_0x433e('0x2c')],'type':_0x322ac3['type'][_0x433e('0x2d')]};});_0x45e3c2[_0x433e('0x2e')]=_['map'](_0x329eb5,_0x433e('0x27'));_0x45e3c2['query']=_['keys'](_0x4216f1[_0x433e('0x2f')]);_0x45e3c2[_0x433e('0x30')]=_[_0x433e('0x31')](_0x45e3c2[_0x433e('0x2e')],_0x45e3c2[_0x433e('0x2f')]);_0x4b88d6[_0x433e('0x32')]=_[_0x433e('0x31')](_0x45e3c2['model'],qs[_0x433e('0x33')](_0x4216f1[_0x433e('0x2f')][_0x433e('0x33')]));_0x4b88d6[_0x433e('0x32')]=_0x4b88d6[_0x433e('0x32')][_0x433e('0x34')]?_0x4b88d6[_0x433e('0x32')]:_0x45e3c2[_0x433e('0x2e')];if(!_0x4216f1[_0x433e('0x2f')][_0x433e('0x35')](_0x433e('0x36'))){_0x4b88d6[_0x433e('0x1d')]=qs['limit'](_0x4216f1[_0x433e('0x2f')][_0x433e('0x1d')]);_0x4b88d6['offset']=qs[_0x433e('0x1a')](_0x4216f1[_0x433e('0x2f')]['offset']);}_0x4b88d6[_0x433e('0x37')]=qs[_0x433e('0x38')](_0x4216f1[_0x433e('0x2f')]['sort']);_0x4b88d6[_0x433e('0x39')]=qs[_0x433e('0x30')](_[_0x433e('0x3a')](_0x4216f1[_0x433e('0x2f')],_0x45e3c2[_0x433e('0x30')]),_0x329eb5);if(_0x4216f1[_0x433e('0x2f')][_0x433e('0x3b')]){_0x4b88d6[_0x433e('0x39')]=_[_0x433e('0x3c')](_0x4b88d6[_0x433e('0x39')],{'$or':_[_0x433e('0x29')](_0x329eb5,function(_0x4dda14){if(_0x4dda14['type']!==_0x433e('0x3d')){var _0x2eb41c={};_0x2eb41c[_0x4dda14['name']]={'$like':'%'+_0x4216f1['query'][_0x433e('0x3b')]+'%'};return _0x2eb41c;}})});}_0x4b88d6=_[_0x433e('0x3c')]({},_0x4b88d6,_0x4216f1['options']);var _0x319095={'where':_0x4b88d6[_0x433e('0x39')]};return db[_0x433e('0x2a')][_0x433e('0x1c')](_0x319095)[_0x433e('0x22')](function(_0x249e2a){_0x5367e3['count']=_0x249e2a;if(_0x4216f1[_0x433e('0x2f')][_0x433e('0x3e')]){_0x4b88d6[_0x433e('0x3f')]=[{'all':!![]}];}return db['FreshdeskConfiguration'][_0x433e('0x40')](_0x4b88d6);})[_0x433e('0x22')](function(_0x3ec4e0){_0x5367e3[_0x433e('0x41')]=_0x3ec4e0;return _0x5367e3;})[_0x433e('0x22')](respondWithFilteredResult(_0x12c202,_0x4b88d6))[_0x433e('0x42')](handleError(_0x12c202,null));};exports[_0x433e('0x43')]=function(_0x33d34d,_0x2ca0df){var _0x137234={'raw':![],'where':{'id':_0x33d34d[_0x433e('0x44')]['id']}},_0x72c434={};_0x72c434[_0x433e('0x2e')]=_[_0x433e('0x45')](db[_0x433e('0x2a')][_0x433e('0x2b')]);_0x72c434['query']=_['keys'](_0x33d34d['query']);_0x72c434['filters']=_[_0x433e('0x31')](_0x72c434['model'],_0x72c434[_0x433e('0x2f')]);_0x137234['attributes']=_[_0x433e('0x31')](_0x72c434[_0x433e('0x2e')],qs[_0x433e('0x33')](_0x33d34d['query']['fields']));_0x137234[_0x433e('0x32')]=_0x137234[_0x433e('0x32')]['length']?_0x137234['attributes']:_0x72c434[_0x433e('0x2e')];if(_0x33d34d['query'][_0x433e('0x3e')]){_0x137234['include']=[{'all':!![]}];}_0x137234=_['merge']({},_0x137234,_0x33d34d[_0x433e('0x46')]);return db[_0x433e('0x2a')][_0x433e('0x47')](_0x137234)[_0x433e('0x22')](handleEntityNotFound(_0x2ca0df,null))[_0x433e('0x22')](respondWithResult(_0x2ca0df,null))[_0x433e('0x42')](handleError(_0x2ca0df,null));};exports[_0x433e('0x48')]=function(_0x35a036,_0x31587f){return db['FreshdeskConfiguration'][_0x433e('0x48')](_0x35a036['body'],{})['then'](respondWithResult(_0x31587f,0xc9))['catch'](handleError(_0x31587f,null));};exports[_0x433e('0x21')]=function(_0x38405d,_0x53ad6a){if(_0x38405d[_0x433e('0x49')]['id']){delete _0x38405d[_0x433e('0x49')]['id'];}return db[_0x433e('0x2a')][_0x433e('0x47')]({'where':{'id':_0x38405d[_0x433e('0x44')]['id']}})[_0x433e('0x22')](handleEntityNotFound(_0x53ad6a,null))['then'](saveUpdates(_0x38405d['body'],null))[_0x433e('0x22')](respondWithResult(_0x53ad6a,null))['catch'](handleError(_0x53ad6a,null));};exports['destroy']=function(_0x4867ce,_0x4112c0){return db[_0x433e('0x2a')][_0x433e('0x47')]({'where':{'id':_0x4867ce[_0x433e('0x44')]['id']}})[_0x433e('0x22')](handleEntityNotFound(_0x4112c0,null))['then'](removeEntity(_0x4112c0,null))[_0x433e('0x42')](handleError(_0x4112c0,null));};exports[_0x433e('0x4a')]=function(_0x3b9c8f,_0xd97a25,_0x4e5502){var _0x44d7ab={};var _0x1fc9e3={};var _0x1a1015;var _0xbdcbb7;return db[_0x433e('0x2a')][_0x433e('0x4b')]({'where':{'id':_0x3b9c8f['params']['id']}})['then'](handleEntityNotFound(_0xd97a25,null))['then'](function(_0x591bcd){if(_0x591bcd){_0x1a1015=_0x591bcd;_0x1fc9e3[_0x433e('0x2e')]=_['keys'](db['FreshdeskField']['rawAttributes']);_0x1fc9e3[_0x433e('0x2f')]=_['keys'](_0x3b9c8f[_0x433e('0x2f')]);_0x1fc9e3['filters']=_[_0x433e('0x31')](_0x1fc9e3[_0x433e('0x2e')],_0x1fc9e3[_0x433e('0x2f')]);_0x44d7ab[_0x433e('0x32')]=_[_0x433e('0x31')](_0x1fc9e3[_0x433e('0x2e')],qs['fields'](_0x3b9c8f['query']['fields']));_0x44d7ab[_0x433e('0x32')]=_0x44d7ab['attributes']['length']?_0x44d7ab[_0x433e('0x32')]:_0x1fc9e3['model'];_0x44d7ab[_0x433e('0x37')]=qs[_0x433e('0x38')](_0x3b9c8f[_0x433e('0x2f')][_0x433e('0x38')]);_0x44d7ab[_0x433e('0x39')]=qs['filters'](_[_0x433e('0x3a')](_0x3b9c8f[_0x433e('0x2f')],_0x1fc9e3[_0x433e('0x30')]));if(_0x3b9c8f[_0x433e('0x2f')][_0x433e('0x3b')]){_0x44d7ab[_0x433e('0x39')]=_[_0x433e('0x3c')](_0x44d7ab[_0x433e('0x39')],{'$or':_[_0x433e('0x29')](_0x44d7ab[_0x433e('0x32')],function(_0x1b5b5e){var _0x5f1085={};_0x5f1085[_0x1b5b5e]={'$like':'%'+_0x3b9c8f[_0x433e('0x2f')][_0x433e('0x3b')]+'%'};return _0x5f1085;})});}_0x44d7ab=_[_0x433e('0x3c')]({},_0x44d7ab,_0x3b9c8f['options']);return _0x1a1015['getFields'](_0x44d7ab);}})[_0x433e('0x22')](function(_0x1f939f){if(_0x1f939f){_0xbdcbb7=_0x1f939f[_0x433e('0x34')];if(!_0x3b9c8f['query'][_0x433e('0x35')](_0x433e('0x36'))){_0x44d7ab[_0x433e('0x1d')]=qs['limit'](_0x3b9c8f['query']['limit']);_0x44d7ab[_0x433e('0x1a')]=qs[_0x433e('0x1a')](_0x3b9c8f[_0x433e('0x2f')][_0x433e('0x1a')]);}return _0x1a1015['getFields'](_0x44d7ab);}})[_0x433e('0x22')](function(_0x69f589){if(_0x69f589){return _0x69f589?{'count':_0xbdcbb7,'rows':_0x69f589}:null;}})[_0x433e('0x22')](respondWithResult(_0xd97a25,null))[_0x433e('0x42')](handleError(_0xd97a25,null));};exports['getSubjects']=function(_0x4b648f,_0x3c92a3,_0x51a025){var _0x2e1185={};var _0x1c1cdd={};var _0x232feb;var _0x2b1c77;return db[_0x433e('0x2a')][_0x433e('0x4b')]({'where':{'id':_0x4b648f['params']['id']}})['then'](handleEntityNotFound(_0x3c92a3,null))['then'](function(_0x49dc3d){if(_0x49dc3d){_0x232feb=_0x49dc3d;_0x1c1cdd['model']=_['keys'](db[_0x433e('0x4c')][_0x433e('0x2b')]);_0x1c1cdd[_0x433e('0x2f')]=_['keys'](_0x4b648f[_0x433e('0x2f')]);_0x1c1cdd['filters']=_['intersection'](_0x1c1cdd['model'],_0x1c1cdd['query']);_0x2e1185[_0x433e('0x32')]=_[_0x433e('0x31')](_0x1c1cdd[_0x433e('0x2e')],qs['fields'](_0x4b648f[_0x433e('0x2f')][_0x433e('0x33')]));_0x2e1185[_0x433e('0x32')]=_0x2e1185[_0x433e('0x32')][_0x433e('0x34')]?_0x2e1185[_0x433e('0x32')]:_0x1c1cdd[_0x433e('0x2e')];_0x2e1185['order']=qs['sort'](_0x4b648f[_0x433e('0x2f')][_0x433e('0x38')]);_0x2e1185[_0x433e('0x39')]=qs[_0x433e('0x30')](_[_0x433e('0x3a')](_0x4b648f[_0x433e('0x2f')],_0x1c1cdd[_0x433e('0x30')]));if(_0x4b648f['query'][_0x433e('0x3b')]){_0x2e1185[_0x433e('0x39')]=_[_0x433e('0x3c')](_0x2e1185['where'],{'$or':_[_0x433e('0x29')](_0x2e1185[_0x433e('0x32')],function(_0x59d865){var _0x5b75bd={};_0x5b75bd[_0x59d865]={'$like':'%'+_0x4b648f[_0x433e('0x2f')][_0x433e('0x3b')]+'%'};return _0x5b75bd;})});}_0x2e1185=_[_0x433e('0x3c')]({},_0x2e1185,_0x4b648f['options']);return _0x232feb['getSubjects'](_0x2e1185);}})[_0x433e('0x22')](function(_0x29e7c9){if(_0x29e7c9){_0x2b1c77=_0x29e7c9[_0x433e('0x34')];if(!_0x4b648f['query'][_0x433e('0x35')](_0x433e('0x36'))){_0x2e1185[_0x433e('0x1d')]=qs[_0x433e('0x1d')](_0x4b648f['query']['limit']);_0x2e1185[_0x433e('0x1a')]=qs[_0x433e('0x1a')](_0x4b648f['query'][_0x433e('0x1a')]);}return _0x232feb[_0x433e('0x4d')](_0x2e1185);}})[_0x433e('0x22')](function(_0x412f66){if(_0x412f66){return _0x412f66?{'count':_0x2b1c77,'rows':_0x412f66}:null;}})[_0x433e('0x22')](respondWithResult(_0x3c92a3,null))[_0x433e('0x42')](handleError(_0x3c92a3,null));};exports['getDescriptions']=function(_0x440cc4,_0x313942,_0x52b5b4){var _0x687aea={};var _0x5c3bc5={};var _0x5e243c;var _0x4a1768;return db[_0x433e('0x2a')][_0x433e('0x4b')]({'where':{'id':_0x440cc4[_0x433e('0x44')]['id']}})[_0x433e('0x22')](handleEntityNotFound(_0x313942,null))[_0x433e('0x22')](function(_0x436e3a){if(_0x436e3a){_0x5e243c=_0x436e3a;_0x5c3bc5[_0x433e('0x2e')]=_[_0x433e('0x45')](db[_0x433e('0x4c')]['rawAttributes']);_0x5c3bc5[_0x433e('0x2f')]=_['keys'](_0x440cc4[_0x433e('0x2f')]);_0x5c3bc5[_0x433e('0x30')]=_[_0x433e('0x31')](_0x5c3bc5[_0x433e('0x2e')],_0x5c3bc5[_0x433e('0x2f')]);_0x687aea[_0x433e('0x32')]=_[_0x433e('0x31')](_0x5c3bc5['model'],qs['fields'](_0x440cc4[_0x433e('0x2f')][_0x433e('0x33')]));_0x687aea[_0x433e('0x32')]=_0x687aea[_0x433e('0x32')][_0x433e('0x34')]?_0x687aea['attributes']:_0x5c3bc5[_0x433e('0x2e')];_0x687aea[_0x433e('0x37')]=qs[_0x433e('0x38')](_0x440cc4[_0x433e('0x2f')][_0x433e('0x38')]);_0x687aea['where']=qs[_0x433e('0x30')](_[_0x433e('0x3a')](_0x440cc4['query'],_0x5c3bc5['filters']));if(_0x440cc4[_0x433e('0x2f')][_0x433e('0x3b')]){_0x687aea[_0x433e('0x39')]=_['merge'](_0x687aea[_0x433e('0x39')],{'$or':_[_0x433e('0x29')](_0x687aea['attributes'],function(_0x23cc6c){var _0x47b23f={};_0x47b23f[_0x23cc6c]={'$like':'%'+_0x440cc4['query'][_0x433e('0x3b')]+'%'};return _0x47b23f;})});}_0x687aea=_[_0x433e('0x3c')]({},_0x687aea,_0x440cc4['options']);return _0x5e243c[_0x433e('0x4e')](_0x687aea);}})[_0x433e('0x22')](function(_0x2c9a91){if(_0x2c9a91){_0x4a1768=_0x2c9a91[_0x433e('0x34')];if(!_0x440cc4['query'][_0x433e('0x35')]('nolimit')){_0x687aea['limit']=qs['limit'](_0x440cc4[_0x433e('0x2f')][_0x433e('0x1d')]);_0x687aea[_0x433e('0x1a')]=qs['offset'](_0x440cc4[_0x433e('0x2f')]['offset']);}return _0x5e243c['getDescriptions'](_0x687aea);}})[_0x433e('0x22')](function(_0x1668f8){if(_0x1668f8){return _0x1668f8?{'count':_0x4a1768,'rows':_0x1668f8}:null;}})['then'](respondWithResult(_0x313942,null))[_0x433e('0x42')](handleError(_0x313942,null));};exports[_0x433e('0x4f')]=function(_0x4018b9,_0x21df48,_0x24e59a){var _0xa3e06f={};var _0x27ff78={};var _0x353068;var _0x44e7de;return db[_0x433e('0x2a')][_0x433e('0x4b')]({'where':{'id':_0x4018b9[_0x433e('0x44')]['id']}})[_0x433e('0x22')](handleEntityNotFound(_0x21df48,null))[_0x433e('0x22')](function(_0x235d55){if(_0x235d55){_0x353068=_0x235d55;_0x27ff78[_0x433e('0x2e')]=_[_0x433e('0x45')](db[_0x433e('0x50')][_0x433e('0x2b')]);_0x27ff78[_0x433e('0x2f')]=_['keys'](_0x4018b9[_0x433e('0x2f')]);_0x27ff78[_0x433e('0x30')]=_['intersection'](_0x27ff78[_0x433e('0x2e')],_0x27ff78[_0x433e('0x2f')]);_0xa3e06f[_0x433e('0x32')]=_[_0x433e('0x31')](_0x27ff78[_0x433e('0x2e')],qs[_0x433e('0x33')](_0x4018b9[_0x433e('0x2f')][_0x433e('0x33')]));_0xa3e06f[_0x433e('0x32')]=_0xa3e06f[_0x433e('0x32')][_0x433e('0x34')]?_0xa3e06f['attributes']:_0x27ff78[_0x433e('0x2e')];_0xa3e06f[_0x433e('0x37')]=qs[_0x433e('0x38')](_0x4018b9['query'][_0x433e('0x38')]);_0xa3e06f['where']=qs[_0x433e('0x30')](_[_0x433e('0x3a')](_0x4018b9[_0x433e('0x2f')],_0x27ff78['filters']));if(_0x4018b9['query'][_0x433e('0x3b')]){_0xa3e06f[_0x433e('0x39')]=_[_0x433e('0x3c')](_0xa3e06f[_0x433e('0x39')],{'$or':_[_0x433e('0x29')](_0xa3e06f[_0x433e('0x32')],function(_0x1c381f){var _0x2828dd={};_0x2828dd[_0x1c381f]={'$like':'%'+_0x4018b9[_0x433e('0x2f')][_0x433e('0x3b')]+'%'};return _0x2828dd;})});}_0xa3e06f=_[_0x433e('0x3c')]({},_0xa3e06f,_0x4018b9[_0x433e('0x46')]);return _0x353068[_0x433e('0x4f')](_0xa3e06f);}})[_0x433e('0x22')](function(_0x2c908d){if(_0x2c908d){_0x44e7de=_0x2c908d[_0x433e('0x34')];if(!_0x4018b9[_0x433e('0x2f')][_0x433e('0x35')](_0x433e('0x36'))){_0xa3e06f['limit']=qs[_0x433e('0x1d')](_0x4018b9[_0x433e('0x2f')][_0x433e('0x1d')]);_0xa3e06f[_0x433e('0x1a')]=qs[_0x433e('0x1a')](_0x4018b9[_0x433e('0x2f')][_0x433e('0x1a')]);}return _0x353068[_0x433e('0x4f')](_0xa3e06f);}})['then'](function(_0x22424a){if(_0x22424a){return _0x22424a?{'count':_0x44e7de,'rows':_0x22424a}:null;}})[_0x433e('0x22')](respondWithResult(_0x21df48,null))[_0x433e('0x42')](handleError(_0x21df48,null));};exports['setTags']=function(_0x448300,_0x2580d0,_0x2292d8){if(_0x448300[_0x433e('0x49')]['id']){delete _0x448300['body']['id'];}return db[_0x433e('0x2a')][_0x433e('0x4b')]({'where':{'id':_0x448300[_0x433e('0x44')]['id']}})[_0x433e('0x22')](handleEntityNotFound(_0x2580d0,null))[_0x433e('0x22')](function(_0x3a954c){if(_0x3a954c){return _0x3a954c['setTags'](_0x448300['body'][_0x433e('0x51')]||[]);}return null;})[_0x433e('0x22')](respondWithResult(_0x2580d0,null))[_0x433e('0x42')](handleError(_0x2580d0,null));}; \ No newline at end of file +var _0xda43=['../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','limit','undefined','offset','apply','reject','save','then','sendStatus','error','name','index','FreshdeskConfiguration','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','type','VIRTUAL','options','count','rows','catch','params','rawAttributes','includeAll','include','find','create','body','update','destroy','getFields','findOne','FreshdeskField','pick','getSubjects','order','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x39e551,_0x4a505d){var _0x5d49a6=function(_0x2a772f){while(--_0x2a772f){_0x39e551['push'](_0x39e551['shift']());}};_0x5d49a6(++_0x4a505d);}(_0xda43,0x91));var _0x3da4=function(_0x556477,_0x1b7214){_0x556477=_0x556477-0x0;var _0x552276=_0xda43[_0x556477];return _0x552276;};'use strict';var emlformat=require(_0x3da4('0x0'));var rimraf=require(_0x3da4('0x1'));var zipdir=require(_0x3da4('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x3da4('0x3'));var BPromise=require(_0x3da4('0x4'));var Mustache=require(_0x3da4('0x5'));var util=require(_0x3da4('0x6'));var path=require(_0x3da4('0x7'));var sox=require('sox');var csv=require(_0x3da4('0x8'));var ejs=require(_0x3da4('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3da4('0xa'));var squel=require(_0x3da4('0xb'));var crypto=require('crypto');var jsforce=require(_0x3da4('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x3da4('0x8'));var querystring=require(_0x3da4('0xd'));var Papa=require(_0x3da4('0xe'));var Redis=require(_0x3da4('0xf'));var authService=require(_0x3da4('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x3da4('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x3da4('0x12'));var utils=require(_0x3da4('0x13'));var config=require(_0x3da4('0x14'));var licenseUtil=require(_0x3da4('0x15'));var db=require(_0x3da4('0x16'))['db'];function respondWithStatusCode(_0x2b05aa,_0x44a05e){_0x44a05e=_0x44a05e||0xcc;return function(_0x812a27){if(_0x812a27){return _0x2b05aa['sendStatus'](_0x44a05e);}return _0x2b05aa[_0x3da4('0x17')](_0x44a05e)[_0x3da4('0x18')]();};}function respondWithResult(_0x284290,_0x4a11d4){_0x4a11d4=_0x4a11d4||0xc8;return function(_0x525718){if(_0x525718){return _0x284290[_0x3da4('0x17')](_0x4a11d4)[_0x3da4('0x19')](_0x525718);}};}function respondWithFilteredResult(_0x4f41d7,_0x22f28e){return function(_0x422f62){if(_0x422f62){var _0x11755a=typeof _0x22f28e['offset']==='undefined'&&typeof _0x22f28e[_0x3da4('0x1a')]===_0x3da4('0x1b');var _0x5dbf80=_0x422f62['count'];var _0x4b0d5d=_0x11755a?0x0:_0x22f28e[_0x3da4('0x1c')];var _0x54b738=_0x11755a?_0x422f62['count']:_0x22f28e[_0x3da4('0x1c')]+_0x22f28e['limit'];var _0x195a9e;if(_0x54b738>=_0x5dbf80){_0x54b738=_0x5dbf80;_0x195a9e=0xc8;}else{_0x195a9e=0xce;}_0x4f41d7['status'](_0x195a9e);return _0x4f41d7['set']('Content-Range',_0x4b0d5d+'-'+_0x54b738+'/'+_0x5dbf80)[_0x3da4('0x19')](_0x422f62);}return null;};}function patchUpdates(_0x4cac26){return function(_0x26dd49){try{jsonpatch[_0x3da4('0x1d')](_0x26dd49,_0x4cac26,!![]);}catch(_0x2e4c12){return BPromise[_0x3da4('0x1e')](_0x2e4c12);}return _0x26dd49[_0x3da4('0x1f')]();};}function saveUpdates(_0x50a089,_0x2b9654){return function(_0x1193e0){if(_0x1193e0){return _0x1193e0['update'](_0x50a089)[_0x3da4('0x20')](function(_0x3ea6df){return _0x3ea6df;});}return null;};}function removeEntity(_0x21f5a4,_0x6f3c0e){return function(_0x3bfe50){if(_0x3bfe50){return _0x3bfe50['destroy']()[_0x3da4('0x20')](function(){_0x21f5a4[_0x3da4('0x17')](0xcc)[_0x3da4('0x18')]();});}};}function handleEntityNotFound(_0x3bfcc6,_0x69f8f3){return function(_0x1bfab6){if(!_0x1bfab6){_0x3bfcc6[_0x3da4('0x21')](0x194);}return _0x1bfab6;};}function handleError(_0x982ae8,_0x51052d){_0x51052d=_0x51052d||0x1f4;return function(_0x195340){logger[_0x3da4('0x22')](_0x195340['stack']);if(_0x195340[_0x3da4('0x23')]){delete _0x195340[_0x3da4('0x23')];}_0x982ae8[_0x3da4('0x17')](_0x51052d)['send'](_0x195340);};}exports[_0x3da4('0x24')]=function(_0x193d2d,_0x482787){var _0x140400={},_0x3627f0={},_0x4a2d68={'count':0x0,'rows':[]};var _0x3eb926=_['map'](db[_0x3da4('0x25')]['rawAttributes'],function(_0xcc9c41){return{'name':_0xcc9c41[_0x3da4('0x26')],'type':_0xcc9c41['type'][_0x3da4('0x27')]};});_0x3627f0[_0x3da4('0x28')]=_[_0x3da4('0x29')](_0x3eb926,_0x3da4('0x23'));_0x3627f0[_0x3da4('0x2a')]=_[_0x3da4('0x2b')](_0x193d2d['query']);_0x3627f0[_0x3da4('0x2c')]=_[_0x3da4('0x2d')](_0x3627f0[_0x3da4('0x28')],_0x3627f0[_0x3da4('0x2a')]);_0x140400[_0x3da4('0x2e')]=_[_0x3da4('0x2d')](_0x3627f0['model'],qs[_0x3da4('0x2f')](_0x193d2d[_0x3da4('0x2a')][_0x3da4('0x2f')]));_0x140400[_0x3da4('0x2e')]=_0x140400[_0x3da4('0x2e')][_0x3da4('0x30')]?_0x140400[_0x3da4('0x2e')]:_0x3627f0[_0x3da4('0x28')];if(!_0x193d2d[_0x3da4('0x2a')][_0x3da4('0x31')](_0x3da4('0x32'))){_0x140400[_0x3da4('0x1a')]=qs[_0x3da4('0x1a')](_0x193d2d[_0x3da4('0x2a')][_0x3da4('0x1a')]);_0x140400[_0x3da4('0x1c')]=qs[_0x3da4('0x1c')](_0x193d2d[_0x3da4('0x2a')][_0x3da4('0x1c')]);}_0x140400['order']=qs[_0x3da4('0x33')](_0x193d2d[_0x3da4('0x2a')][_0x3da4('0x33')]);_0x140400[_0x3da4('0x34')]=qs[_0x3da4('0x2c')](_['pick'](_0x193d2d[_0x3da4('0x2a')],_0x3627f0[_0x3da4('0x2c')]),_0x3eb926);if(_0x193d2d[_0x3da4('0x2a')][_0x3da4('0x35')]){_0x140400[_0x3da4('0x34')]=_[_0x3da4('0x36')](_0x140400[_0x3da4('0x34')],{'$or':_[_0x3da4('0x29')](_0x3eb926,function(_0x27a3e1){if(_0x27a3e1[_0x3da4('0x37')]!==_0x3da4('0x38')){var _0x3d7f7a={};_0x3d7f7a[_0x27a3e1['name']]={'$like':'%'+_0x193d2d[_0x3da4('0x2a')][_0x3da4('0x35')]+'%'};return _0x3d7f7a;}})});}_0x140400=_[_0x3da4('0x36')]({},_0x140400,_0x193d2d[_0x3da4('0x39')]);var _0x1c7b7b={'where':_0x140400['where']};return db['FreshdeskConfiguration'][_0x3da4('0x3a')](_0x1c7b7b)[_0x3da4('0x20')](function(_0x40ffce){_0x4a2d68['count']=_0x40ffce;if(_0x193d2d[_0x3da4('0x2a')]['includeAll']){_0x140400['include']=[{'all':!![]}];}return db[_0x3da4('0x25')]['findAll'](_0x140400);})[_0x3da4('0x20')](function(_0x37279f){_0x4a2d68[_0x3da4('0x3b')]=_0x37279f;return _0x4a2d68;})[_0x3da4('0x20')](respondWithFilteredResult(_0x482787,_0x140400))[_0x3da4('0x3c')](handleError(_0x482787,null));};exports['show']=function(_0x4c2f0c,_0x556c11){var _0x300c97={'raw':![],'where':{'id':_0x4c2f0c[_0x3da4('0x3d')]['id']}},_0x2d8d79={};_0x2d8d79[_0x3da4('0x28')]=_[_0x3da4('0x2b')](db[_0x3da4('0x25')][_0x3da4('0x3e')]);_0x2d8d79['query']=_[_0x3da4('0x2b')](_0x4c2f0c[_0x3da4('0x2a')]);_0x2d8d79[_0x3da4('0x2c')]=_[_0x3da4('0x2d')](_0x2d8d79['model'],_0x2d8d79[_0x3da4('0x2a')]);_0x300c97[_0x3da4('0x2e')]=_[_0x3da4('0x2d')](_0x2d8d79[_0x3da4('0x28')],qs[_0x3da4('0x2f')](_0x4c2f0c[_0x3da4('0x2a')][_0x3da4('0x2f')]));_0x300c97[_0x3da4('0x2e')]=_0x300c97[_0x3da4('0x2e')][_0x3da4('0x30')]?_0x300c97[_0x3da4('0x2e')]:_0x2d8d79[_0x3da4('0x28')];if(_0x4c2f0c['query'][_0x3da4('0x3f')]){_0x300c97[_0x3da4('0x40')]=[{'all':!![]}];}_0x300c97=_[_0x3da4('0x36')]({},_0x300c97,_0x4c2f0c['options']);return db[_0x3da4('0x25')][_0x3da4('0x41')](_0x300c97)[_0x3da4('0x20')](handleEntityNotFound(_0x556c11,null))[_0x3da4('0x20')](respondWithResult(_0x556c11,null))[_0x3da4('0x3c')](handleError(_0x556c11,null));};exports[_0x3da4('0x42')]=function(_0x37b985,_0x215bc3){return db[_0x3da4('0x25')]['create'](_0x37b985[_0x3da4('0x43')],{})['then'](respondWithResult(_0x215bc3,0xc9))['catch'](handleError(_0x215bc3,null));};exports[_0x3da4('0x44')]=function(_0x330069,_0x1b67eb){if(_0x330069['body']['id']){delete _0x330069[_0x3da4('0x43')]['id'];}return db['FreshdeskConfiguration'][_0x3da4('0x41')]({'where':{'id':_0x330069[_0x3da4('0x3d')]['id']}})['then'](handleEntityNotFound(_0x1b67eb,null))[_0x3da4('0x20')](saveUpdates(_0x330069[_0x3da4('0x43')],null))[_0x3da4('0x20')](respondWithResult(_0x1b67eb,null))[_0x3da4('0x3c')](handleError(_0x1b67eb,null));};exports[_0x3da4('0x45')]=function(_0x5171f6,_0x13c414){return db[_0x3da4('0x25')][_0x3da4('0x41')]({'where':{'id':_0x5171f6['params']['id']}})['then'](handleEntityNotFound(_0x13c414,null))['then'](removeEntity(_0x13c414,null))[_0x3da4('0x3c')](handleError(_0x13c414,null));};exports[_0x3da4('0x46')]=function(_0x47a3f7,_0x1a356a,_0xb96d39){var _0x3ac82f={};var _0x127839={};var _0x31f202;var _0x559cce;return db[_0x3da4('0x25')][_0x3da4('0x47')]({'where':{'id':_0x47a3f7[_0x3da4('0x3d')]['id']}})[_0x3da4('0x20')](handleEntityNotFound(_0x1a356a,null))['then'](function(_0x20e1a5){if(_0x20e1a5){_0x31f202=_0x20e1a5;_0x127839['model']=_[_0x3da4('0x2b')](db[_0x3da4('0x48')][_0x3da4('0x3e')]);_0x127839['query']=_['keys'](_0x47a3f7[_0x3da4('0x2a')]);_0x127839['filters']=_[_0x3da4('0x2d')](_0x127839['model'],_0x127839[_0x3da4('0x2a')]);_0x3ac82f['attributes']=_[_0x3da4('0x2d')](_0x127839[_0x3da4('0x28')],qs['fields'](_0x47a3f7[_0x3da4('0x2a')][_0x3da4('0x2f')]));_0x3ac82f[_0x3da4('0x2e')]=_0x3ac82f[_0x3da4('0x2e')][_0x3da4('0x30')]?_0x3ac82f['attributes']:_0x127839['model'];_0x3ac82f['order']=qs[_0x3da4('0x33')](_0x47a3f7['query'][_0x3da4('0x33')]);_0x3ac82f['where']=qs[_0x3da4('0x2c')](_[_0x3da4('0x49')](_0x47a3f7['query'],_0x127839[_0x3da4('0x2c')]));if(_0x47a3f7[_0x3da4('0x2a')][_0x3da4('0x35')]){_0x3ac82f[_0x3da4('0x34')]=_['merge'](_0x3ac82f[_0x3da4('0x34')],{'$or':_[_0x3da4('0x29')](_0x3ac82f['attributes'],function(_0x1ffd0f){var _0x1b221b={};_0x1b221b[_0x1ffd0f]={'$like':'%'+_0x47a3f7[_0x3da4('0x2a')][_0x3da4('0x35')]+'%'};return _0x1b221b;})});}_0x3ac82f=_[_0x3da4('0x36')]({},_0x3ac82f,_0x47a3f7[_0x3da4('0x39')]);return _0x31f202['getFields'](_0x3ac82f);}})[_0x3da4('0x20')](function(_0x48d4d4){if(_0x48d4d4){_0x559cce=_0x48d4d4[_0x3da4('0x30')];if(!_0x47a3f7[_0x3da4('0x2a')][_0x3da4('0x31')](_0x3da4('0x32'))){_0x3ac82f[_0x3da4('0x1a')]=qs[_0x3da4('0x1a')](_0x47a3f7[_0x3da4('0x2a')][_0x3da4('0x1a')]);_0x3ac82f[_0x3da4('0x1c')]=qs['offset'](_0x47a3f7[_0x3da4('0x2a')][_0x3da4('0x1c')]);}return _0x31f202[_0x3da4('0x46')](_0x3ac82f);}})[_0x3da4('0x20')](function(_0x2f8320){if(_0x2f8320){return _0x2f8320?{'count':_0x559cce,'rows':_0x2f8320}:null;}})[_0x3da4('0x20')](respondWithResult(_0x1a356a,null))[_0x3da4('0x3c')](handleError(_0x1a356a,null));};exports[_0x3da4('0x4a')]=function(_0x4515bf,_0x275bb0,_0x2ac552){var _0x291f80={};var _0x446931={};var _0x576e7b;var _0x531bad;return db[_0x3da4('0x25')][_0x3da4('0x47')]({'where':{'id':_0x4515bf[_0x3da4('0x3d')]['id']}})[_0x3da4('0x20')](handleEntityNotFound(_0x275bb0,null))['then'](function(_0x4167de){if(_0x4167de){_0x576e7b=_0x4167de;_0x446931[_0x3da4('0x28')]=_[_0x3da4('0x2b')](db['FreshdeskField']['rawAttributes']);_0x446931[_0x3da4('0x2a')]=_['keys'](_0x4515bf['query']);_0x446931[_0x3da4('0x2c')]=_[_0x3da4('0x2d')](_0x446931[_0x3da4('0x28')],_0x446931[_0x3da4('0x2a')]);_0x291f80['attributes']=_[_0x3da4('0x2d')](_0x446931['model'],qs['fields'](_0x4515bf['query'][_0x3da4('0x2f')]));_0x291f80[_0x3da4('0x2e')]=_0x291f80[_0x3da4('0x2e')]['length']?_0x291f80[_0x3da4('0x2e')]:_0x446931[_0x3da4('0x28')];_0x291f80[_0x3da4('0x4b')]=qs[_0x3da4('0x33')](_0x4515bf['query'][_0x3da4('0x33')]);_0x291f80['where']=qs['filters'](_[_0x3da4('0x49')](_0x4515bf[_0x3da4('0x2a')],_0x446931[_0x3da4('0x2c')]));if(_0x4515bf[_0x3da4('0x2a')][_0x3da4('0x35')]){_0x291f80[_0x3da4('0x34')]=_[_0x3da4('0x36')](_0x291f80['where'],{'$or':_[_0x3da4('0x29')](_0x291f80[_0x3da4('0x2e')],function(_0x2c5d4b){var _0x16ccac={};_0x16ccac[_0x2c5d4b]={'$like':'%'+_0x4515bf[_0x3da4('0x2a')][_0x3da4('0x35')]+'%'};return _0x16ccac;})});}_0x291f80=_[_0x3da4('0x36')]({},_0x291f80,_0x4515bf[_0x3da4('0x39')]);return _0x576e7b[_0x3da4('0x4a')](_0x291f80);}})[_0x3da4('0x20')](function(_0x344bf4){if(_0x344bf4){_0x531bad=_0x344bf4[_0x3da4('0x30')];if(!_0x4515bf[_0x3da4('0x2a')]['hasOwnProperty'](_0x3da4('0x32'))){_0x291f80[_0x3da4('0x1a')]=qs['limit'](_0x4515bf[_0x3da4('0x2a')][_0x3da4('0x1a')]);_0x291f80['offset']=qs[_0x3da4('0x1c')](_0x4515bf[_0x3da4('0x2a')][_0x3da4('0x1c')]);}return _0x576e7b[_0x3da4('0x4a')](_0x291f80);}})[_0x3da4('0x20')](function(_0x1f266f){if(_0x1f266f){return _0x1f266f?{'count':_0x531bad,'rows':_0x1f266f}:null;}})[_0x3da4('0x20')](respondWithResult(_0x275bb0,null))[_0x3da4('0x3c')](handleError(_0x275bb0,null));};exports[_0x3da4('0x4c')]=function(_0x254d3f,_0x223dc2,_0x1ac9a4){var _0x5b8e22={};var _0x2615f8={};var _0xc06b68;var _0x5783f7;return db[_0x3da4('0x25')][_0x3da4('0x47')]({'where':{'id':_0x254d3f[_0x3da4('0x3d')]['id']}})['then'](handleEntityNotFound(_0x223dc2,null))[_0x3da4('0x20')](function(_0x3afbed){if(_0x3afbed){_0xc06b68=_0x3afbed;_0x2615f8[_0x3da4('0x28')]=_['keys'](db[_0x3da4('0x48')][_0x3da4('0x3e')]);_0x2615f8['query']=_[_0x3da4('0x2b')](_0x254d3f[_0x3da4('0x2a')]);_0x2615f8['filters']=_[_0x3da4('0x2d')](_0x2615f8[_0x3da4('0x28')],_0x2615f8['query']);_0x5b8e22['attributes']=_[_0x3da4('0x2d')](_0x2615f8[_0x3da4('0x28')],qs[_0x3da4('0x2f')](_0x254d3f[_0x3da4('0x2a')][_0x3da4('0x2f')]));_0x5b8e22['attributes']=_0x5b8e22[_0x3da4('0x2e')]['length']?_0x5b8e22[_0x3da4('0x2e')]:_0x2615f8[_0x3da4('0x28')];_0x5b8e22[_0x3da4('0x4b')]=qs['sort'](_0x254d3f[_0x3da4('0x2a')][_0x3da4('0x33')]);_0x5b8e22[_0x3da4('0x34')]=qs['filters'](_[_0x3da4('0x49')](_0x254d3f[_0x3da4('0x2a')],_0x2615f8[_0x3da4('0x2c')]));if(_0x254d3f['query']['filter']){_0x5b8e22[_0x3da4('0x34')]=_[_0x3da4('0x36')](_0x5b8e22['where'],{'$or':_['map'](_0x5b8e22[_0x3da4('0x2e')],function(_0x4ea882){var _0x1cfe11={};_0x1cfe11[_0x4ea882]={'$like':'%'+_0x254d3f[_0x3da4('0x2a')][_0x3da4('0x35')]+'%'};return _0x1cfe11;})});}_0x5b8e22=_[_0x3da4('0x36')]({},_0x5b8e22,_0x254d3f[_0x3da4('0x39')]);return _0xc06b68[_0x3da4('0x4c')](_0x5b8e22);}})['then'](function(_0x166597){if(_0x166597){_0x5783f7=_0x166597[_0x3da4('0x30')];if(!_0x254d3f['query'][_0x3da4('0x31')](_0x3da4('0x32'))){_0x5b8e22[_0x3da4('0x1a')]=qs[_0x3da4('0x1a')](_0x254d3f[_0x3da4('0x2a')][_0x3da4('0x1a')]);_0x5b8e22[_0x3da4('0x1c')]=qs[_0x3da4('0x1c')](_0x254d3f[_0x3da4('0x2a')][_0x3da4('0x1c')]);}return _0xc06b68['getDescriptions'](_0x5b8e22);}})[_0x3da4('0x20')](function(_0x1bfdd1){if(_0x1bfdd1){return _0x1bfdd1?{'count':_0x5783f7,'rows':_0x1bfdd1}:null;}})['then'](respondWithResult(_0x223dc2,null))[_0x3da4('0x3c')](handleError(_0x223dc2,null));};exports[_0x3da4('0x4d')]=function(_0x5c6422,_0xa2ed65,_0x47fb9a){var _0x46761f={};var _0xc57673={};var _0x2d93b4;var _0xb2c7a;return db[_0x3da4('0x25')][_0x3da4('0x47')]({'where':{'id':_0x5c6422[_0x3da4('0x3d')]['id']}})[_0x3da4('0x20')](handleEntityNotFound(_0xa2ed65,null))['then'](function(_0x4139ff){if(_0x4139ff){_0x2d93b4=_0x4139ff;_0xc57673[_0x3da4('0x28')]=_['keys'](db[_0x3da4('0x4e')][_0x3da4('0x3e')]);_0xc57673['query']=_[_0x3da4('0x2b')](_0x5c6422['query']);_0xc57673[_0x3da4('0x2c')]=_[_0x3da4('0x2d')](_0xc57673['model'],_0xc57673['query']);_0x46761f[_0x3da4('0x2e')]=_[_0x3da4('0x2d')](_0xc57673['model'],qs[_0x3da4('0x2f')](_0x5c6422[_0x3da4('0x2a')]['fields']));_0x46761f[_0x3da4('0x2e')]=_0x46761f[_0x3da4('0x2e')]['length']?_0x46761f[_0x3da4('0x2e')]:_0xc57673[_0x3da4('0x28')];_0x46761f['order']=qs[_0x3da4('0x33')](_0x5c6422['query'][_0x3da4('0x33')]);_0x46761f['where']=qs[_0x3da4('0x2c')](_[_0x3da4('0x49')](_0x5c6422[_0x3da4('0x2a')],_0xc57673[_0x3da4('0x2c')]));if(_0x5c6422[_0x3da4('0x2a')][_0x3da4('0x35')]){_0x46761f[_0x3da4('0x34')]=_[_0x3da4('0x36')](_0x46761f[_0x3da4('0x34')],{'$or':_[_0x3da4('0x29')](_0x46761f[_0x3da4('0x2e')],function(_0xbd18cc){var _0x422c6e={};_0x422c6e[_0xbd18cc]={'$like':'%'+_0x5c6422[_0x3da4('0x2a')][_0x3da4('0x35')]+'%'};return _0x422c6e;})});}_0x46761f=_[_0x3da4('0x36')]({},_0x46761f,_0x5c6422[_0x3da4('0x39')]);return _0x2d93b4[_0x3da4('0x4d')](_0x46761f);}})[_0x3da4('0x20')](function(_0x270f2e){if(_0x270f2e){_0xb2c7a=_0x270f2e[_0x3da4('0x30')];if(!_0x5c6422[_0x3da4('0x2a')][_0x3da4('0x31')](_0x3da4('0x32'))){_0x46761f[_0x3da4('0x1a')]=qs[_0x3da4('0x1a')](_0x5c6422[_0x3da4('0x2a')][_0x3da4('0x1a')]);_0x46761f[_0x3da4('0x1c')]=qs[_0x3da4('0x1c')](_0x5c6422['query']['offset']);}return _0x2d93b4['getTags'](_0x46761f);}})[_0x3da4('0x20')](function(_0x585501){if(_0x585501){return _0x585501?{'count':_0xb2c7a,'rows':_0x585501}:null;}})[_0x3da4('0x20')](respondWithResult(_0xa2ed65,null))[_0x3da4('0x3c')](handleError(_0xa2ed65,null));};exports[_0x3da4('0x4f')]=function(_0x4648fa,_0xa6e684,_0x3a6288){if(_0x4648fa[_0x3da4('0x43')]['id']){delete _0x4648fa[_0x3da4('0x43')]['id'];}return db[_0x3da4('0x25')][_0x3da4('0x47')]({'where':{'id':_0x4648fa[_0x3da4('0x3d')]['id']}})[_0x3da4('0x20')](handleEntityNotFound(_0xa6e684,null))[_0x3da4('0x20')](function(_0x48f37f){if(_0x48f37f){return _0x48f37f[_0x3da4('0x4f')](_0x4648fa[_0x3da4('0x43')][_0x3da4('0x50')]||[]);}return null;})[_0x3da4('0x20')](respondWithResult(_0xa6e684,null))['catch'](handleError(_0xa6e684,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index 8271f7b..f598052 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 _0x2289=['define','FreshdeskConfiguration','int_freshdesk_configurations','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./intFreshdeskConfiguration.attributes','exports'];(function(_0x3764a9,_0x4da8f6){var _0x47d5b9=function(_0x4ab698){while(--_0x4ab698){_0x3764a9['push'](_0x3764a9['shift']());}};_0x47d5b9(++_0x4da8f6);}(_0x2289,0x1b0));var _0x9228=function(_0x590856,_0x408448){_0x590856=_0x590856-0x0;var _0x1d755c=_0x2289[_0x590856];return _0x1d755c;};'use strict';var _=require(_0x9228('0x0'));var util=require('util');var logger=require(_0x9228('0x1'))(_0x9228('0x2'));var moment=require(_0x9228('0x3'));var BPromise=require(_0x9228('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9228('0x5'));var rimraf=require(_0x9228('0x6'));var config=require(_0x9228('0x7'));var attributes=require(_0x9228('0x8'));module[_0x9228('0x9')]=function(_0x31a26e,_0x202184){return _0x31a26e[_0x9228('0xa')](_0x9228('0xb'),attributes,{'tableName':_0x9228('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xac08=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','FreshdeskConfiguration','util','../../config/logger','api'];(function(_0x50790e,_0x17349e){var _0x46bbe3=function(_0xd0c621){while(--_0xd0c621){_0x50790e['push'](_0x50790e['shift']());}};_0x46bbe3(++_0x17349e);}(_0xac08,0x1d1));var _0x8ac0=function(_0xe0b041,_0x309a9f){_0xe0b041=_0xe0b041-0x0;var _0x176057=_0xac08[_0xe0b041];return _0x176057;};'use strict';var _=require('lodash');var util=require(_0x8ac0('0x0'));var logger=require(_0x8ac0('0x1'))(_0x8ac0('0x2'));var moment=require(_0x8ac0('0x3'));var BPromise=require(_0x8ac0('0x4'));var rp=require(_0x8ac0('0x5'));var fs=require('fs');var path=require(_0x8ac0('0x6'));var rimraf=require(_0x8ac0('0x7'));var config=require(_0x8ac0('0x8'));var attributes=require('./intFreshdeskConfiguration.attributes');module[_0x8ac0('0x9')]=function(_0x297ae1,_0x54e9ed){return _0x297ae1[_0x8ac0('0xa')](_0x8ac0('0xb'),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 5f467e6..24e980d 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 _0x8767=['stringify','error','code','message','lodash','util','moment','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x4027c0,_0x3c5c0d){var _0x3f08f8=function(_0x4c6865){while(--_0x4c6865){_0x4027c0['push'](_0x4027c0['shift']());}};_0x3f08f8(++_0x3c5c0d);}(_0x8767,0xe8));var _0x7876=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8767[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x7876('0x0'));var util=require(_0x7876('0x1'));var moment=require(_0x7876('0x2'));var BPromise=require('bluebird');var rs=require(_0x7876('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x7876('0x4'));var logger=require(_0x7876('0x5'))(_0x7876('0x6'));var config=require('../../config/environment');var jayson=require(_0x7876('0x7'));var client=jayson[_0x7876('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4f9438,_0x26caa2,_0x355d72){return new BPromise(function(_0x5e759b,_0x2ffe52){return client[_0x7876('0x9')](_0x4f9438,_0x355d72)[_0x7876('0xa')](function(_0x58a35b){logger[_0x7876('0xb')](_0x7876('0xc'),_0x26caa2,'request\x20sent');logger['debug'](_0x7876('0xd'),_0x26caa2,_0x7876('0xe'),JSON[_0x7876('0xf')](_0x58a35b));if(_0x58a35b[_0x7876('0x10')]){if(_0x58a35b[_0x7876('0x10')][_0x7876('0x11')]===0x1f4){logger[_0x7876('0x10')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x26caa2,_0x58a35b['error'][_0x7876('0x12')]);return _0x2ffe52(_0x58a35b[_0x7876('0x10')][_0x7876('0x12')]);}logger['error'](_0x7876('0xc'),_0x26caa2,_0x58a35b[_0x7876('0x10')]['message']);return _0x5e759b(_0x58a35b['error'][_0x7876('0x12')]);}else{logger[_0x7876('0xb')](_0x7876('0xc'),_0x26caa2,_0x7876('0xe'));_0x5e759b(_0x58a35b['result']['message']);}})['catch'](function(_0x3430aa){logger['error'](_0x7876('0xc'),_0x26caa2,_0x3430aa);_0x2ffe52(_0x3430aa);});});} \ No newline at end of file +var _0x0f9c=['error','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','then','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x43b06b,_0x1929c7){var _0x2c555b=function(_0x30fa8c){while(--_0x30fa8c){_0x43b06b['push'](_0x43b06b['shift']());}};_0x2c555b(++_0x1929c7);}(_0x0f9c,0x1a9));var _0xc0f9=function(_0x40fd5e,_0xecea2f){_0x40fd5e=_0x40fd5e-0x0;var _0x3a255e=_0x0f9c[_0x40fd5e];return _0x3a255e;};'use strict';var _=require(_0xc0f9('0x0'));var util=require(_0xc0f9('0x1'));var moment=require(_0xc0f9('0x2'));var BPromise=require(_0xc0f9('0x3'));var rs=require(_0xc0f9('0x4'));var fs=require('fs');var Redis=require(_0xc0f9('0x5'));var db=require(_0xc0f9('0x6'))['db'];var utils=require(_0xc0f9('0x7'));var logger=require(_0xc0f9('0x8'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xc0f9('0x9')][_0xc0f9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x368df8,_0x33beab,_0xfe2956){return new BPromise(function(_0x5bcba5,_0x5c38b8){return client['request'](_0x368df8,_0xfe2956)[_0xc0f9('0xb')](function(_0x4254ef){logger['info'](_0xc0f9('0xc'),_0x33beab,_0xc0f9('0xd'));logger['debug'](_0xc0f9('0xe'),_0x33beab,_0xc0f9('0xd'),JSON['stringify'](_0x4254ef));if(_0x4254ef[_0xc0f9('0xf')]){if(_0x4254ef[_0xc0f9('0xf')]['code']===0x1f4){logger[_0xc0f9('0xf')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x33beab,_0x4254ef[_0xc0f9('0xf')][_0xc0f9('0x10')]);return _0x5c38b8(_0x4254ef[_0xc0f9('0xf')][_0xc0f9('0x10')]);}logger[_0xc0f9('0xf')](_0xc0f9('0xc'),_0x33beab,_0x4254ef['error'][_0xc0f9('0x10')]);return _0x5bcba5(_0x4254ef[_0xc0f9('0xf')]['message']);}else{logger[_0xc0f9('0x11')](_0xc0f9('0xc'),_0x33beab,_0xc0f9('0xd'));_0x5bcba5(_0x4254ef[_0xc0f9('0x12')]['message']);}})[_0xc0f9('0x13')](function(_0x1c9a93){logger[_0xc0f9('0xf')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x33beab,_0x1c9a93);_0x5c38b8(_0x1c9a93);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index 88c8a53..a8b4cb6 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 _0xdaa8=['/:id','show','post','create','put','delete','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','get','isAuthenticated'];(function(_0x3765a6,_0x23f4b4){var _0x31d4fd=function(_0xea9508){while(--_0xea9508){_0x3765a6['push'](_0x3765a6['shift']());}};_0x31d4fd(++_0x23f4b4);}(_0xdaa8,0x171));var _0x8daa=function(_0x4ce19b,_0xbba834){_0x4ce19b=_0x4ce19b-0x0;var _0x617495=_0xdaa8[_0x4ce19b];return _0x617495;};'use strict';var multer=require(_0x8daa('0x0'));var util=require(_0x8daa('0x1'));var path=require('path');var timeout=require(_0x8daa('0x2'));var express=require('express');var router=express[_0x8daa('0x3')]();var fs_extra=require(_0x8daa('0x4'));var auth=require(_0x8daa('0x5'));var interaction=require(_0x8daa('0x6'));var config=require(_0x8daa('0x7'));var controller=require(_0x8daa('0x8'));router[_0x8daa('0x9')]('/',auth[_0x8daa('0xa')](),controller['index']);router[_0x8daa('0x9')](_0x8daa('0xb'),auth[_0x8daa('0xa')](),controller[_0x8daa('0xc')]);router[_0x8daa('0xd')]('/',auth['isAuthenticated'](),controller[_0x8daa('0xe')]);router[_0x8daa('0xf')](_0x8daa('0xb'),auth[_0x8daa('0xa')](),controller['update']);router[_0x8daa('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x8daa('0x11')]);module[_0x8daa('0x12')]=router; \ No newline at end of file +var _0x3dde=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','isAuthenticated','index','get','/:id','show','put','delete','exports'];(function(_0x431ae1,_0x385f06){var _0x27fcbd=function(_0x16e71f){while(--_0x16e71f){_0x431ae1['push'](_0x431ae1['shift']());}};_0x27fcbd(++_0x385f06);}(_0x3dde,0x18f));var _0xe3dd=function(_0x50748b,_0x599d6d){_0x50748b=_0x50748b-0x0;var _0x5688d7=_0x3dde[_0x50748b];return _0x5688d7;};'use strict';var multer=require(_0xe3dd('0x0'));var util=require(_0xe3dd('0x1'));var path=require(_0xe3dd('0x2'));var timeout=require(_0xe3dd('0x3'));var express=require(_0xe3dd('0x4'));var router=express[_0xe3dd('0x5')]();var fs_extra=require(_0xe3dd('0x6'));var auth=require(_0xe3dd('0x7'));var interaction=require(_0xe3dd('0x8'));var config=require(_0xe3dd('0x9'));var controller=require(_0xe3dd('0xa'));router['get']('/',auth[_0xe3dd('0xb')](),controller[_0xe3dd('0xc')]);router[_0xe3dd('0xd')](_0xe3dd('0xe'),auth[_0xe3dd('0xb')](),controller[_0xe3dd('0xf')]);router['post']('/',auth[_0xe3dd('0xb')](),controller['create']);router[_0xe3dd('0x10')](_0xe3dd('0xe'),auth[_0xe3dd('0xb')](),controller['update']);router[_0xe3dd('0x11')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xe3dd('0x12')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index 687f60b..4ac4097 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 _0xe4cc=['keyValue','picklist','STRING','BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable'];(function(_0x563dae,_0x3a2b96){var _0x568291=function(_0x4f9cfd){while(--_0x4f9cfd){_0x563dae['push'](_0x563dae['shift']());}};_0x568291(++_0x3a2b96);}(_0xe4cc,0xcc));var _0xce4c=function(_0x20754a,_0x275fc4){_0x20754a=_0x20754a-0x0;var _0x41e8aa=_0xe4cc[_0x20754a];return _0x41e8aa;};'use strict';var Sequelize=require(_0xce4c('0x0'));module[_0xce4c('0x1')]={'type':{'type':Sequelize[_0xce4c('0x2')](_0xce4c('0x3'),_0xce4c('0x4'),_0xce4c('0x5'),_0xce4c('0x6'),_0xce4c('0x7')),'defaultValue':_0xce4c('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xce4c('0x8')]},'keyType':{'type':Sequelize[_0xce4c('0x2')](_0xce4c('0x3'),_0xce4c('0x4'),'customVariable')},'keyContent':{'type':Sequelize[_0xce4c('0x8')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xce4c('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xce4c('0x8')]}}; \ No newline at end of file +var _0x9b71=['picklist','string','STRING','BOOLEAN','sequelize','exports','ENUM','variable','keyValue'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x9b71,0x12d));var _0x19b7=function(_0x1dc341,_0x392b1c){_0x1dc341=_0x1dc341-0x0;var _0x41cc48=_0x9b71[_0x1dc341];return _0x41cc48;};'use strict';var Sequelize=require(_0x19b7('0x0'));module[_0x19b7('0x1')]={'type':{'type':Sequelize[_0x19b7('0x2')]('string',_0x19b7('0x3'),'customVariable',_0x19b7('0x4'),_0x19b7('0x5')),'defaultValue':_0x19b7('0x6')},'content':{'type':Sequelize[_0x19b7('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0x19b7('0x6'),'variable','customVariable')},'keyContent':{'type':Sequelize[_0x19b7('0x7')]},'idField':{'type':Sequelize[_0x19b7('0x7')]},'nameField':{'type':Sequelize[_0x19b7('0x7')]},'customField':{'type':Sequelize[_0x19b7('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x19b7('0x7')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index 664104b..edd8744 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 _0x1bca=['index','map','fieldName','key','model','keys','filters','intersection','fields','attributes','query','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','length','create','FreshdeskField','body','find','rimraf','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','update','destroy','then','error','stack','send'];(function(_0x21c5b0,_0x55e19e){var _0x523284=function(_0x53568c){while(--_0x53568c){_0x21c5b0['push'](_0x21c5b0['shift']());}};_0x523284(++_0x55e19e);}(_0x1bca,0xb6));var _0xa1bc=function(_0x517f73,_0x4d1bd4){_0x517f73=_0x517f73-0x0;var _0x4b626d=_0x1bca[_0x517f73];return _0x4b626d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa1bc('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xa1bc('0x1'));var moment=require('moment');var BPromise=require(_0xa1bc('0x2'));var Mustache=require(_0xa1bc('0x3'));var util=require(_0xa1bc('0x4'));var path=require('path');var sox=require(_0xa1bc('0x5'));var csv=require(_0xa1bc('0x6'));var ejs=require(_0xa1bc('0x7'));var fs=require('fs');var fs_extra=require(_0xa1bc('0x8'));var _=require('lodash');var squel=require(_0xa1bc('0x9'));var crypto=require(_0xa1bc('0xa'));var jsforce=require(_0xa1bc('0xb'));var deskjs=require(_0xa1bc('0xc'));var toCsv=require(_0xa1bc('0x6'));var querystring=require(_0xa1bc('0xd'));var Papa=require(_0xa1bc('0xe'));var Redis=require('ioredis');var authService=require(_0xa1bc('0xf'));var qs=require(_0xa1bc('0x10'));var as=require(_0xa1bc('0x11'));var hardwareService=require(_0xa1bc('0x12'));var logger=require(_0xa1bc('0x13'))(_0xa1bc('0x14'));var utils=require(_0xa1bc('0x15'));var config=require(_0xa1bc('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1f65bc,_0x37913b){_0x37913b=_0x37913b||0xcc;return function(_0x2b38cf){if(_0x2b38cf){return _0x1f65bc[_0xa1bc('0x17')](_0x37913b);}return _0x1f65bc[_0xa1bc('0x18')](_0x37913b)[_0xa1bc('0x19')]();};}function respondWithResult(_0x165acf,_0x2c5f01){_0x2c5f01=_0x2c5f01||0xc8;return function(_0xe0d028){if(_0xe0d028){return _0x165acf[_0xa1bc('0x18')](_0x2c5f01)[_0xa1bc('0x1a')](_0xe0d028);}};}function respondWithFilteredResult(_0x5a22e0,_0x565bc2){return function(_0xdb513d){if(_0xdb513d){var _0xf8c08e=typeof _0x565bc2[_0xa1bc('0x1b')]===_0xa1bc('0x1c')&&typeof _0x565bc2[_0xa1bc('0x1d')]===_0xa1bc('0x1c');var _0x36b899=_0xdb513d[_0xa1bc('0x1e')];var _0x4765be=_0xf8c08e?0x0:_0x565bc2['offset'];var _0x510046=_0xf8c08e?_0xdb513d[_0xa1bc('0x1e')]:_0x565bc2[_0xa1bc('0x1b')]+_0x565bc2[_0xa1bc('0x1d')];var _0x2b0410;if(_0x510046>=_0x36b899){_0x510046=_0x36b899;_0x2b0410=0xc8;}else{_0x2b0410=0xce;}_0x5a22e0['status'](_0x2b0410);return _0x5a22e0['set'](_0xa1bc('0x1f'),_0x4765be+'-'+_0x510046+'/'+_0x36b899)[_0xa1bc('0x1a')](_0xdb513d);}return null;};}function patchUpdates(_0x322703){return function(_0x95a766){try{jsonpatch[_0xa1bc('0x20')](_0x95a766,_0x322703,!![]);}catch(_0x3e8cd7){return BPromise['reject'](_0x3e8cd7);}return _0x95a766[_0xa1bc('0x21')]();};}function saveUpdates(_0xc81195,_0x1e4f4e){return function(_0x4fdf7d){if(_0x4fdf7d){return _0x4fdf7d[_0xa1bc('0x22')](_0xc81195)['then'](function(_0x10636d){return _0x10636d;});}return null;};}function removeEntity(_0x44f952,_0x23d67d){return function(_0x2a77a2){if(_0x2a77a2){return _0x2a77a2[_0xa1bc('0x23')]()[_0xa1bc('0x24')](function(){_0x44f952['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3cc2e0,_0x3a87f4){return function(_0x5eff38){if(!_0x5eff38){_0x3cc2e0[_0xa1bc('0x17')](0x194);}return _0x5eff38;};}function handleError(_0x31d31c,_0x14e37b){_0x14e37b=_0x14e37b||0x1f4;return function(_0x2a0348){logger[_0xa1bc('0x25')](_0x2a0348[_0xa1bc('0x26')]);if(_0x2a0348['name']){delete _0x2a0348['name'];}_0x31d31c[_0xa1bc('0x18')](_0x14e37b)[_0xa1bc('0x27')](_0x2a0348);};}exports[_0xa1bc('0x28')]=function(_0x1270f5,_0x16a9d7){var _0x4ae5d0={},_0x228fc8={},_0x512608={'count':0x0,'rows':[]};var _0x332201=_[_0xa1bc('0x29')](db['FreshdeskField']['rawAttributes'],function(_0x4a120c){return{'name':_0x4a120c[_0xa1bc('0x2a')],'type':_0x4a120c['type'][_0xa1bc('0x2b')]};});_0x228fc8[_0xa1bc('0x2c')]=_[_0xa1bc('0x29')](_0x332201,'name');_0x228fc8['query']=_[_0xa1bc('0x2d')](_0x1270f5['query']);_0x228fc8[_0xa1bc('0x2e')]=_[_0xa1bc('0x2f')](_0x228fc8[_0xa1bc('0x2c')],_0x228fc8['query']);_0x4ae5d0['attributes']=_['intersection'](_0x228fc8[_0xa1bc('0x2c')],qs[_0xa1bc('0x30')](_0x1270f5['query'][_0xa1bc('0x30')]));_0x4ae5d0[_0xa1bc('0x31')]=_0x4ae5d0[_0xa1bc('0x31')]['length']?_0x4ae5d0[_0xa1bc('0x31')]:_0x228fc8[_0xa1bc('0x2c')];if(!_0x1270f5[_0xa1bc('0x32')]['hasOwnProperty'](_0xa1bc('0x33'))){_0x4ae5d0[_0xa1bc('0x1d')]=qs[_0xa1bc('0x1d')](_0x1270f5[_0xa1bc('0x32')][_0xa1bc('0x1d')]);_0x4ae5d0[_0xa1bc('0x1b')]=qs[_0xa1bc('0x1b')](_0x1270f5[_0xa1bc('0x32')]['offset']);}_0x4ae5d0[_0xa1bc('0x34')]=qs[_0xa1bc('0x35')](_0x1270f5[_0xa1bc('0x32')][_0xa1bc('0x35')]);_0x4ae5d0['where']=qs[_0xa1bc('0x2e')](_[_0xa1bc('0x36')](_0x1270f5['query'],_0x228fc8[_0xa1bc('0x2e')]),_0x332201);if(_0x1270f5[_0xa1bc('0x32')][_0xa1bc('0x37')]){_0x4ae5d0[_0xa1bc('0x38')]=_[_0xa1bc('0x39')](_0x4ae5d0['where'],{'$or':_[_0xa1bc('0x29')](_0x332201,function(_0x14c645){if(_0x14c645[_0xa1bc('0x3a')]!==_0xa1bc('0x3b')){var _0x3abf84={};_0x3abf84[_0x14c645['name']]={'$like':'%'+_0x1270f5[_0xa1bc('0x32')][_0xa1bc('0x37')]+'%'};return _0x3abf84;}})});}_0x4ae5d0=_[_0xa1bc('0x39')]({},_0x4ae5d0,_0x1270f5[_0xa1bc('0x3c')]);var _0xf9b275={'where':_0x4ae5d0['where']};return db['FreshdeskField']['count'](_0xf9b275)[_0xa1bc('0x24')](function(_0x57160e){_0x512608[_0xa1bc('0x1e')]=_0x57160e;if(_0x1270f5[_0xa1bc('0x32')][_0xa1bc('0x3d')]){_0x4ae5d0[_0xa1bc('0x3e')]=[{'all':!![]}];}return db['FreshdeskField'][_0xa1bc('0x3f')](_0x4ae5d0);})['then'](function(_0x482d37){_0x512608[_0xa1bc('0x40')]=_0x482d37;return _0x512608;})['then'](respondWithFilteredResult(_0x16a9d7,_0x4ae5d0))[_0xa1bc('0x41')](handleError(_0x16a9d7,null));};exports[_0xa1bc('0x42')]=function(_0x5d6c5c,_0x1d8e3c){var _0x5cd49d={'raw':!![],'where':{'id':_0x5d6c5c[_0xa1bc('0x43')]['id']}},_0x1544c8={};_0x1544c8[_0xa1bc('0x2c')]=_[_0xa1bc('0x2d')](db['FreshdeskField'][_0xa1bc('0x44')]);_0x1544c8[_0xa1bc('0x32')]=_['keys'](_0x5d6c5c[_0xa1bc('0x32')]);_0x1544c8[_0xa1bc('0x2e')]=_[_0xa1bc('0x2f')](_0x1544c8[_0xa1bc('0x2c')],_0x1544c8[_0xa1bc('0x32')]);_0x5cd49d[_0xa1bc('0x31')]=_[_0xa1bc('0x2f')](_0x1544c8[_0xa1bc('0x2c')],qs[_0xa1bc('0x30')](_0x5d6c5c[_0xa1bc('0x32')][_0xa1bc('0x30')]));_0x5cd49d[_0xa1bc('0x31')]=_0x5cd49d[_0xa1bc('0x31')][_0xa1bc('0x45')]?_0x5cd49d['attributes']:_0x1544c8[_0xa1bc('0x2c')];if(_0x5d6c5c['query'][_0xa1bc('0x3d')]){_0x5cd49d[_0xa1bc('0x3e')]=[{'all':!![]}];}_0x5cd49d=_[_0xa1bc('0x39')]({},_0x5cd49d,_0x5d6c5c[_0xa1bc('0x3c')]);return db['FreshdeskField']['find'](_0x5cd49d)['then'](handleEntityNotFound(_0x1d8e3c,null))['then'](respondWithResult(_0x1d8e3c,null))['catch'](handleError(_0x1d8e3c,null));};exports[_0xa1bc('0x46')]=function(_0x5cc542,_0x2dfad5){return db[_0xa1bc('0x47')][_0xa1bc('0x46')](_0x5cc542[_0xa1bc('0x48')],{})['then'](respondWithResult(_0x2dfad5,0xc9))[_0xa1bc('0x41')](handleError(_0x2dfad5,null));};exports[_0xa1bc('0x22')]=function(_0x3fa784,_0x3eb3d7){if(_0x3fa784[_0xa1bc('0x48')]['id']){delete _0x3fa784['body']['id'];}return db[_0xa1bc('0x47')][_0xa1bc('0x49')]({'where':{'id':_0x3fa784[_0xa1bc('0x43')]['id']}})[_0xa1bc('0x24')](handleEntityNotFound(_0x3eb3d7,null))['then'](saveUpdates(_0x3fa784['body'],null))['then'](respondWithResult(_0x3eb3d7,null))[_0xa1bc('0x41')](handleError(_0x3eb3d7,null));};exports[_0xa1bc('0x23')]=function(_0x5b3b1,_0x274684){return db[_0xa1bc('0x47')]['find']({'where':{'id':_0x5b3b1['params']['id']}})[_0xa1bc('0x24')](handleEntityNotFound(_0x274684,null))[_0xa1bc('0x24')](removeEntity(_0x274684,null))[_0xa1bc('0x41')](handleError(_0x274684,null));}; \ No newline at end of file +var _0xeb74=['crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filters','pick','merge','where','VIRTUAL','filter','options','FreshdeskField','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash'];(function(_0x142ec2,_0x177dbb){var _0x3de461=function(_0x4ffa60){while(--_0x4ffa60){_0x142ec2['push'](_0x142ec2['shift']());}};_0x3de461(++_0x177dbb);}(_0xeb74,0xe3));var _0x4eb7=function(_0x3a94f0,_0x201154){_0x3a94f0=_0x3a94f0-0x0;var _0x8781d3=_0xeb74[_0x3a94f0];return _0x8781d3;};'use strict';var emlformat=require(_0x4eb7('0x0'));var rimraf=require(_0x4eb7('0x1'));var zipdir=require(_0x4eb7('0x2'));var jsonpatch=require(_0x4eb7('0x3'));var rp=require(_0x4eb7('0x4'));var moment=require(_0x4eb7('0x5'));var BPromise=require(_0x4eb7('0x6'));var Mustache=require('mustache');var util=require(_0x4eb7('0x7'));var path=require(_0x4eb7('0x8'));var sox=require(_0x4eb7('0x9'));var csv=require(_0x4eb7('0xa'));var ejs=require(_0x4eb7('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4eb7('0xc'));var squel=require('squel');var crypto=require(_0x4eb7('0xd'));var jsforce=require(_0x4eb7('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x4eb7('0xf'));var Papa=require(_0x4eb7('0x10'));var Redis=require('ioredis');var authService=require(_0x4eb7('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x4eb7('0x12'));var hardwareService=require(_0x4eb7('0x13'));var logger=require(_0x4eb7('0x14'))('api');var utils=require(_0x4eb7('0x15'));var config=require(_0x4eb7('0x16'));var licenseUtil=require(_0x4eb7('0x17'));var db=require(_0x4eb7('0x18'))['db'];function respondWithStatusCode(_0x35fa89,_0x4194e1){_0x4194e1=_0x4194e1||0xcc;return function(_0x3c9f45){if(_0x3c9f45){return _0x35fa89['sendStatus'](_0x4194e1);}return _0x35fa89['status'](_0x4194e1)['end']();};}function respondWithResult(_0x17fb81,_0x51f09d){_0x51f09d=_0x51f09d||0xc8;return function(_0x84c68b){if(_0x84c68b){return _0x17fb81[_0x4eb7('0x19')](_0x51f09d)[_0x4eb7('0x1a')](_0x84c68b);}};}function respondWithFilteredResult(_0x1c4a97,_0x5d6d5){return function(_0x21433d){if(_0x21433d){var _0x11674f=typeof _0x5d6d5[_0x4eb7('0x1b')]===_0x4eb7('0x1c')&&typeof _0x5d6d5[_0x4eb7('0x1d')]==='undefined';var _0xb86bc9=_0x21433d[_0x4eb7('0x1e')];var _0x3b6d41=_0x11674f?0x0:_0x5d6d5[_0x4eb7('0x1b')];var _0x302e16=_0x11674f?_0x21433d[_0x4eb7('0x1e')]:_0x5d6d5[_0x4eb7('0x1b')]+_0x5d6d5[_0x4eb7('0x1d')];var _0x5f4780;if(_0x302e16>=_0xb86bc9){_0x302e16=_0xb86bc9;_0x5f4780=0xc8;}else{_0x5f4780=0xce;}_0x1c4a97[_0x4eb7('0x19')](_0x5f4780);return _0x1c4a97[_0x4eb7('0x1f')](_0x4eb7('0x20'),_0x3b6d41+'-'+_0x302e16+'/'+_0xb86bc9)[_0x4eb7('0x1a')](_0x21433d);}return null;};}function patchUpdates(_0x32f0f5){return function(_0x2efd67){try{jsonpatch[_0x4eb7('0x21')](_0x2efd67,_0x32f0f5,!![]);}catch(_0x4ddbe4){return BPromise[_0x4eb7('0x22')](_0x4ddbe4);}return _0x2efd67[_0x4eb7('0x23')]();};}function saveUpdates(_0x4783b1,_0x164515){return function(_0x14a7be){if(_0x14a7be){return _0x14a7be[_0x4eb7('0x24')](_0x4783b1)[_0x4eb7('0x25')](function(_0x2df1b1){return _0x2df1b1;});}return null;};}function removeEntity(_0x1a2b8b,_0x13e871){return function(_0x4de2d9){if(_0x4de2d9){return _0x4de2d9[_0x4eb7('0x26')]()[_0x4eb7('0x25')](function(){_0x1a2b8b[_0x4eb7('0x19')](0xcc)[_0x4eb7('0x27')]();});}};}function handleEntityNotFound(_0x3e0da2,_0x25eb74){return function(_0x365060){if(!_0x365060){_0x3e0da2[_0x4eb7('0x28')](0x194);}return _0x365060;};}function handleError(_0x80b804,_0x248759){_0x248759=_0x248759||0x1f4;return function(_0xf83c11){logger[_0x4eb7('0x29')](_0xf83c11[_0x4eb7('0x2a')]);if(_0xf83c11[_0x4eb7('0x2b')]){delete _0xf83c11[_0x4eb7('0x2b')];}_0x80b804[_0x4eb7('0x19')](_0x248759)[_0x4eb7('0x2c')](_0xf83c11);};}exports[_0x4eb7('0x2d')]=function(_0x33a2c1,_0x28fda8){var _0x114c68={},_0x17030a={},_0x3ed224={'count':0x0,'rows':[]};var _0x50209d=_[_0x4eb7('0x2e')](db['FreshdeskField'][_0x4eb7('0x2f')],function(_0x13f71a){return{'name':_0x13f71a[_0x4eb7('0x30')],'type':_0x13f71a[_0x4eb7('0x31')][_0x4eb7('0x32')]};});_0x17030a[_0x4eb7('0x33')]=_[_0x4eb7('0x2e')](_0x50209d,_0x4eb7('0x2b'));_0x17030a[_0x4eb7('0x34')]=_['keys'](_0x33a2c1[_0x4eb7('0x34')]);_0x17030a['filters']=_[_0x4eb7('0x35')](_0x17030a[_0x4eb7('0x33')],_0x17030a['query']);_0x114c68['attributes']=_[_0x4eb7('0x35')](_0x17030a[_0x4eb7('0x33')],qs[_0x4eb7('0x36')](_0x33a2c1[_0x4eb7('0x34')]['fields']));_0x114c68[_0x4eb7('0x37')]=_0x114c68[_0x4eb7('0x37')][_0x4eb7('0x38')]?_0x114c68[_0x4eb7('0x37')]:_0x17030a[_0x4eb7('0x33')];if(!_0x33a2c1['query'][_0x4eb7('0x39')](_0x4eb7('0x3a'))){_0x114c68[_0x4eb7('0x1d')]=qs['limit'](_0x33a2c1[_0x4eb7('0x34')][_0x4eb7('0x1d')]);_0x114c68[_0x4eb7('0x1b')]=qs['offset'](_0x33a2c1[_0x4eb7('0x34')]['offset']);}_0x114c68[_0x4eb7('0x3b')]=qs[_0x4eb7('0x3c')](_0x33a2c1[_0x4eb7('0x34')][_0x4eb7('0x3c')]);_0x114c68['where']=qs[_0x4eb7('0x3d')](_[_0x4eb7('0x3e')](_0x33a2c1[_0x4eb7('0x34')],_0x17030a[_0x4eb7('0x3d')]),_0x50209d);if(_0x33a2c1['query']['filter']){_0x114c68['where']=_[_0x4eb7('0x3f')](_0x114c68[_0x4eb7('0x40')],{'$or':_[_0x4eb7('0x2e')](_0x50209d,function(_0x20ac7b){if(_0x20ac7b[_0x4eb7('0x31')]!==_0x4eb7('0x41')){var _0x1038c1={};_0x1038c1[_0x20ac7b[_0x4eb7('0x2b')]]={'$like':'%'+_0x33a2c1[_0x4eb7('0x34')][_0x4eb7('0x42')]+'%'};return _0x1038c1;}})});}_0x114c68=_['merge']({},_0x114c68,_0x33a2c1[_0x4eb7('0x43')]);var _0x38218f={'where':_0x114c68[_0x4eb7('0x40')]};return db[_0x4eb7('0x44')][_0x4eb7('0x1e')](_0x38218f)[_0x4eb7('0x25')](function(_0x704d4d){_0x3ed224[_0x4eb7('0x1e')]=_0x704d4d;if(_0x33a2c1[_0x4eb7('0x34')][_0x4eb7('0x45')]){_0x114c68[_0x4eb7('0x46')]=[{'all':!![]}];}return db[_0x4eb7('0x44')][_0x4eb7('0x47')](_0x114c68);})[_0x4eb7('0x25')](function(_0x38af1f){_0x3ed224[_0x4eb7('0x48')]=_0x38af1f;return _0x3ed224;})[_0x4eb7('0x25')](respondWithFilteredResult(_0x28fda8,_0x114c68))[_0x4eb7('0x49')](handleError(_0x28fda8,null));};exports[_0x4eb7('0x4a')]=function(_0x79aec5,_0x5eff9e){var _0x2fd5c2={'raw':!![],'where':{'id':_0x79aec5[_0x4eb7('0x4b')]['id']}},_0x2df542={};_0x2df542[_0x4eb7('0x33')]=_[_0x4eb7('0x4c')](db[_0x4eb7('0x44')][_0x4eb7('0x2f')]);_0x2df542[_0x4eb7('0x34')]=_[_0x4eb7('0x4c')](_0x79aec5['query']);_0x2df542[_0x4eb7('0x3d')]=_['intersection'](_0x2df542[_0x4eb7('0x33')],_0x2df542[_0x4eb7('0x34')]);_0x2fd5c2[_0x4eb7('0x37')]=_['intersection'](_0x2df542[_0x4eb7('0x33')],qs[_0x4eb7('0x36')](_0x79aec5[_0x4eb7('0x34')][_0x4eb7('0x36')]));_0x2fd5c2['attributes']=_0x2fd5c2[_0x4eb7('0x37')]['length']?_0x2fd5c2[_0x4eb7('0x37')]:_0x2df542[_0x4eb7('0x33')];if(_0x79aec5[_0x4eb7('0x34')][_0x4eb7('0x45')]){_0x2fd5c2[_0x4eb7('0x46')]=[{'all':!![]}];}_0x2fd5c2=_['merge']({},_0x2fd5c2,_0x79aec5['options']);return db[_0x4eb7('0x44')][_0x4eb7('0x4d')](_0x2fd5c2)[_0x4eb7('0x25')](handleEntityNotFound(_0x5eff9e,null))[_0x4eb7('0x25')](respondWithResult(_0x5eff9e,null))[_0x4eb7('0x49')](handleError(_0x5eff9e,null));};exports['create']=function(_0x6086,_0x104284){return db['FreshdeskField'][_0x4eb7('0x4e')](_0x6086[_0x4eb7('0x4f')],{})['then'](respondWithResult(_0x104284,0xc9))[_0x4eb7('0x49')](handleError(_0x104284,null));};exports[_0x4eb7('0x24')]=function(_0x3c8049,_0x5774d5){if(_0x3c8049[_0x4eb7('0x4f')]['id']){delete _0x3c8049['body']['id'];}return db['FreshdeskField'][_0x4eb7('0x4d')]({'where':{'id':_0x3c8049[_0x4eb7('0x4b')]['id']}})[_0x4eb7('0x25')](handleEntityNotFound(_0x5774d5,null))[_0x4eb7('0x25')](saveUpdates(_0x3c8049[_0x4eb7('0x4f')],null))[_0x4eb7('0x25')](respondWithResult(_0x5774d5,null))[_0x4eb7('0x49')](handleError(_0x5774d5,null));};exports[_0x4eb7('0x26')]=function(_0x2913c5,_0x23c0d5){return db[_0x4eb7('0x44')][_0x4eb7('0x4d')]({'where':{'id':_0x2913c5[_0x4eb7('0x4b')]['id']}})[_0x4eb7('0x25')](handleEntityNotFound(_0x23c0d5,null))[_0x4eb7('0x25')](removeEntity(_0x23c0d5,null))[_0x4eb7('0x49')](handleError(_0x23c0d5,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index 973eeef..88bb927 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 _0x70d8=['FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intFreshdeskField.attributes','define','FreshdeskField','int_freshdesk_fields'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x70d8,0xa9));var _0x870d=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x70d8[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0x870d('0x0'));var util=require(_0x870d('0x1'));var logger=require(_0x870d('0x2'))(_0x870d('0x3'));var moment=require(_0x870d('0x4'));var BPromise=require(_0x870d('0x5'));var rp=require(_0x870d('0x6'));var fs=require('fs');var path=require(_0x870d('0x7'));var rimraf=require(_0x870d('0x8'));var config=require('../../config/environment');var attributes=require(_0x870d('0x9'));module['exports']=function(_0x5b131d,_0x161ad6){return _0x5b131d[_0x870d('0xa')](_0x870d('0xb'),attributes,{'tableName':_0x870d('0xc'),'paranoid':![],'indexes':[{'name':'freshdesk_unique_index','fields':['idField',_0x870d('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1b9c=['moment','request-promise','rimraf','./intFreshdeskField.attributes','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','idField','FieldId','lodash','util','api'];(function(_0x2a2991,_0x2fdbf1){var _0x21ac5c=function(_0x4fc701){while(--_0x4fc701){_0x2a2991['push'](_0x2a2991['shift']());}};_0x21ac5c(++_0x2fdbf1);}(_0x1b9c,0x1ad));var _0xc1b9=function(_0x1f6553,_0x278aa0){_0x1f6553=_0x1f6553-0x0;var _0x5206da=_0x1b9c[_0x1f6553];return _0x5206da;};'use strict';var _=require(_0xc1b9('0x0'));var util=require(_0xc1b9('0x1'));var logger=require('../../config/logger')(_0xc1b9('0x2'));var moment=require(_0xc1b9('0x3'));var BPromise=require('bluebird');var rp=require(_0xc1b9('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc1b9('0x5'));var config=require('../../config/environment');var attributes=require(_0xc1b9('0x6'));module['exports']=function(_0x21e501,_0x56a1f5){return _0x21e501['define'](_0xc1b9('0x7'),attributes,{'tableName':_0xc1b9('0x8'),'paranoid':![],'indexes':[{'name':_0xc1b9('0x9'),'fields':[_0xc1b9('0xa'),_0xc1b9('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.rpc.js b/server/api/intFreshdeskField/intFreshdeskField.rpc.js index 9afdd60..766413c 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 _0x4d50=['../../config/logger','rpc','../../config/environment','http','then','info','FreshdeskField,\x20%s,\x20%s','request\x20sent','FreshdeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils'];(function(_0x5c351c,_0x2046d8){var _0x26f3b3=function(_0x47ac18){while(--_0x47ac18){_0x5c351c['push'](_0x5c351c['shift']());}};_0x26f3b3(++_0x2046d8);}(_0x4d50,0x120));var _0x04d5=function(_0x3276fb,_0x122c07){_0x3276fb=_0x3276fb-0x0;var _0x23f2c5=_0x4d50[_0x3276fb];return _0x23f2c5;};'use strict';var _=require(_0x04d5('0x0'));var util=require(_0x04d5('0x1'));var moment=require(_0x04d5('0x2'));var BPromise=require('bluebird');var rs=require(_0x04d5('0x3'));var fs=require('fs');var Redis=require(_0x04d5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x04d5('0x5'));var logger=require(_0x04d5('0x6'))(_0x04d5('0x7'));var config=require(_0x04d5('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x04d5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x27e527,_0xcd7115,_0x412394){return new BPromise(function(_0x33d95d,_0x465dd2){return client['request'](_0x27e527,_0x412394)[_0x04d5('0xa')](function(_0x450d38){logger[_0x04d5('0xb')](_0x04d5('0xc'),_0xcd7115,_0x04d5('0xd'));logger['debug'](_0x04d5('0xe'),_0xcd7115,_0x04d5('0xd'),JSON[_0x04d5('0xf')](_0x450d38));if(_0x450d38[_0x04d5('0x10')]){if(_0x450d38[_0x04d5('0x10')][_0x04d5('0x11')]===0x1f4){logger[_0x04d5('0x10')](_0x04d5('0xc'),_0xcd7115,_0x450d38[_0x04d5('0x10')]['message']);return _0x465dd2(_0x450d38[_0x04d5('0x10')][_0x04d5('0x12')]);}logger[_0x04d5('0x10')](_0x04d5('0xc'),_0xcd7115,_0x450d38[_0x04d5('0x10')][_0x04d5('0x12')]);return _0x33d95d(_0x450d38[_0x04d5('0x10')]['message']);}else{logger[_0x04d5('0xb')]('FreshdeskField,\x20%s,\x20%s',_0xcd7115,_0x04d5('0xd'));_0x33d95d(_0x450d38[_0x04d5('0x13')]['message']);}})[_0x04d5('0x14')](function(_0x46b89d){logger[_0x04d5('0x10')](_0x04d5('0xc'),_0xcd7115,_0x46b89d);_0x465dd2(_0x46b89d);});});} \ No newline at end of file +var _0x939c=['info','FreshdeskField,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','client','http','request','then'];(function(_0x58204f,_0x5bab98){var _0x567b26=function(_0x2092e1){while(--_0x2092e1){_0x58204f['push'](_0x58204f['shift']());}};_0x567b26(++_0x5bab98);}(_0x939c,0xd1));var _0xc939=function(_0x483d8b,_0x526c52){_0x483d8b=_0x483d8b-0x0;var _0x6500f1=_0x939c[_0x483d8b];return _0x6500f1;};'use strict';var _=require(_0xc939('0x0'));var util=require(_0xc939('0x1'));var moment=require(_0xc939('0x2'));var BPromise=require('bluebird');var rs=require(_0xc939('0x3'));var fs=require('fs');var Redis=require(_0xc939('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xc939('0x5'));var logger=require(_0xc939('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xc939('0x7')][_0xc939('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x150dc6,_0xbcb4ca,_0x2dcd91){return new BPromise(function(_0x3f4f23,_0x1486a4){return client[_0xc939('0x9')](_0x150dc6,_0x2dcd91)[_0xc939('0xa')](function(_0x3ced49){logger[_0xc939('0xb')](_0xc939('0xc'),_0xbcb4ca,_0xc939('0xd'));logger['debug']('FreshdeskField,\x20%s,\x20%s,\x20%s',_0xbcb4ca,'request\x20sent',JSON[_0xc939('0xe')](_0x3ced49));if(_0x3ced49[_0xc939('0xf')]){if(_0x3ced49[_0xc939('0xf')][_0xc939('0x10')]===0x1f4){logger[_0xc939('0xf')](_0xc939('0xc'),_0xbcb4ca,_0x3ced49['error'][_0xc939('0x11')]);return _0x1486a4(_0x3ced49[_0xc939('0xf')][_0xc939('0x11')]);}logger[_0xc939('0xf')](_0xc939('0xc'),_0xbcb4ca,_0x3ced49[_0xc939('0xf')]['message']);return _0x3f4f23(_0x3ced49[_0xc939('0xf')][_0xc939('0x11')]);}else{logger['info'](_0xc939('0xc'),_0xbcb4ca,_0xc939('0xd'));_0x3f4f23(_0x3ced49[_0xc939('0x12')]['message']);}})[_0xc939('0x13')](function(_0x37fdac){logger[_0xc939('0xf')](_0xc939('0xc'),_0xbcb4ca,_0x37fdac);_0x1486a4(_0x37fdac);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index ae458ad..88487fe 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 _0x4e81=['update','delete','exports','multer','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','get','/:id','isAuthenticated','show','/:id/configurations','getConfigurations','getFields','post','create','put'];(function(_0x1b4c04,_0x8d961d){var _0x374f5d=function(_0x11dc31){while(--_0x11dc31){_0x1b4c04['push'](_0x1b4c04['shift']());}};_0x374f5d(++_0x8d961d);}(_0x4e81,0x1bc));var _0x14e8=function(_0x5f08a6,_0x400121){_0x5f08a6=_0x5f08a6-0x0;var _0x5d0641=_0x4e81[_0x5f08a6];return _0x5d0641;};'use strict';var multer=require(_0x14e8('0x0'));var util=require(_0x14e8('0x1'));var path=require(_0x14e8('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x14e8('0x3'));var auth=require(_0x14e8('0x4'));var interaction=require(_0x14e8('0x5'));var config=require(_0x14e8('0x6'));var controller=require(_0x14e8('0x7'));router[_0x14e8('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x14e8('0x8')](_0x14e8('0x9'),auth[_0x14e8('0xa')](),controller[_0x14e8('0xb')]);router[_0x14e8('0x8')](_0x14e8('0xc'),auth[_0x14e8('0xa')](),controller[_0x14e8('0xd')]);router[_0x14e8('0x8')]('/:id/fields',auth[_0x14e8('0xa')](),controller[_0x14e8('0xe')]);router[_0x14e8('0xf')]('/',auth[_0x14e8('0xa')](),controller[_0x14e8('0x10')]);router[_0x14e8('0xf')](_0x14e8('0xc'),auth[_0x14e8('0xa')](),controller['addConfiguration']);router[_0x14e8('0x11')]('/:id',auth[_0x14e8('0xa')](),controller[_0x14e8('0x12')]);router[_0x14e8('0x13')]('/:id',auth[_0x14e8('0xa')](),controller['destroy']);module[_0x14e8('0x14')]=router; \ No newline at end of file +var _0xd87e=['post','create','addConfiguration','update','delete','destroy','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intFreshsalesAccount.controller','isAuthenticated','/:id','show','get','getConfigurations','/:id/fields','getFields'];(function(_0x493765,_0x44f6d6){var _0x220718=function(_0x3083d5){while(--_0x3083d5){_0x493765['push'](_0x493765['shift']());}};_0x220718(++_0x44f6d6);}(_0xd87e,0x1bf));var _0xed87=function(_0x27530d,_0x46480a){_0x27530d=_0x27530d-0x0;var _0x59e561=_0xd87e[_0x27530d];return _0x59e561;};'use strict';var multer=require(_0xed87('0x0'));var util=require(_0xed87('0x1'));var path=require('path');var timeout=require(_0xed87('0x2'));var express=require(_0xed87('0x3'));var router=express[_0xed87('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xed87('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xed87('0x6'));var controller=require(_0xed87('0x7'));router['get']('/',auth[_0xed87('0x8')](),controller['index']);router['get'](_0xed87('0x9'),auth[_0xed87('0x8')](),controller[_0xed87('0xa')]);router[_0xed87('0xb')]('/:id/configurations',auth[_0xed87('0x8')](),controller[_0xed87('0xc')]);router[_0xed87('0xb')](_0xed87('0xd'),auth[_0xed87('0x8')](),controller[_0xed87('0xe')]);router[_0xed87('0xf')]('/',auth['isAuthenticated'](),controller[_0xed87('0x10')]);router[_0xed87('0xf')]('/:id/configurations',auth[_0xed87('0x8')](),controller[_0xed87('0x11')]);router['put']('/:id',auth[_0xed87('0x8')](),controller[_0xed87('0x12')]);router[_0xed87('0x13')](_0xed87('0x9'),auth[_0xed87('0x8')](),controller[_0xed87('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index ec5657e..4ca118e 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 _0x4137=['STRING','username','remoteUri','sequelize','exports'];(function(_0x411680,_0xfdcf5){var _0x200ab5=function(_0x4b0862){while(--_0x4b0862){_0x411680['push'](_0x411680['shift']());}};_0x200ab5(++_0xfdcf5);}(_0x4137,0xf8));var _0x7413=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x4137[_0x178e48];return _0x440d7e;};'use strict';var Sequelize=require(_0x7413('0x0'));module[_0x7413('0x1')]={'name':{'type':Sequelize[_0x7413('0x2')]},'description':{'type':Sequelize[_0x7413('0x2')]},'username':{'type':Sequelize[_0x7413('0x2')],'unique':_0x7413('0x3')},'apiKey':{'type':Sequelize[_0x7413('0x2')]},'remoteUri':{'type':Sequelize[_0x7413('0x2')],'unique':_0x7413('0x4')},'serverUrl':{'type':Sequelize[_0x7413('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x32f4=['sequelize','exports','STRING','username','remoteUri'];(function(_0xe206ed,_0x179821){var _0x4423ab=function(_0x2668d2){while(--_0x2668d2){_0xe206ed['push'](_0xe206ed['shift']());}};_0x4423ab(++_0x179821);}(_0x32f4,0x154));var _0x432f=function(_0x1e2252,_0x2c0021){_0x1e2252=_0x1e2252-0x0;var _0x2fa4db=_0x32f4[_0x1e2252];return _0x2fa4db;};'use strict';var Sequelize=require(_0x432f('0x0'));module[_0x432f('0x1')]={'name':{'type':Sequelize[_0x432f('0x2')]},'description':{'type':Sequelize[_0x432f('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0x432f('0x3')},'apiKey':{'type':Sequelize[_0x432f('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x432f('0x4')},'serverUrl':{'type':Sequelize[_0x432f('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 bb3304e..37a6e00 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 _0xdca7=['options','includeAll','include','findAll','rows','show','params','rawAttributes','length','find','catch','create','body','getConfigurations','findOne','addConfiguration','AccountId','Subjects','Descriptions','channel','FreshsalesConfiguration','FreshsalesField','getFields','remoteUri','apiKey','username','substring','lastIndexOf','GET','%s%s','/api/selector/owners','Token\x20token=','users','email','Requested\x20Resource\x20not\x20Found','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','FreshsalesAccount','type','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge'];(function(_0x173f10,_0x35db61){var _0x53142d=function(_0x37bbef){while(--_0x37bbef){_0x173f10['push'](_0x173f10['shift']());}};_0x53142d(++_0x35db61);}(_0xdca7,0x153));var _0x7dca=function(_0x4adab6,_0x367bb9){_0x4adab6=_0x4adab6-0x0;var _0x568563=_0xdca7[_0x4adab6];return _0x568563;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x7dca('0x0'));var jsonpatch=require(_0x7dca('0x1'));var rp=require(_0x7dca('0x2'));var moment=require(_0x7dca('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x7dca('0x4'));var util=require('util');var path=require(_0x7dca('0x5'));var sox=require(_0x7dca('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7dca('0x7'));var squel=require(_0x7dca('0x8'));var crypto=require(_0x7dca('0x9'));var jsforce=require(_0x7dca('0xa'));var deskjs=require(_0x7dca('0xb'));var toCsv=require(_0x7dca('0xc'));var querystring=require(_0x7dca('0xd'));var Papa=require('papaparse');var Redis=require(_0x7dca('0xe'));var authService=require(_0x7dca('0xf'));var qs=require(_0x7dca('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x7dca('0x11'))(_0x7dca('0x12'));var utils=require(_0x7dca('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x7dca('0x14'));var db=require(_0x7dca('0x15'))['db'];var integrations=require(_0x7dca('0x16'));function respondWithStatusCode(_0x5b4681,_0x51622a){_0x51622a=_0x51622a||0xcc;return function(_0x34f266){if(_0x34f266){return _0x5b4681[_0x7dca('0x17')](_0x51622a);}return _0x5b4681[_0x7dca('0x18')](_0x51622a)[_0x7dca('0x19')]();};}function respondWithResult(_0x56deab,_0x1c8843){_0x1c8843=_0x1c8843||0xc8;return function(_0x283d67){if(_0x283d67){return _0x56deab[_0x7dca('0x18')](_0x1c8843)[_0x7dca('0x1a')](_0x283d67);}};}function respondWithFilteredResult(_0x262fcc,_0x21109c){return function(_0x1300c9){if(_0x1300c9){var _0x400616=typeof _0x21109c[_0x7dca('0x1b')]==='undefined'&&typeof _0x21109c[_0x7dca('0x1c')]===_0x7dca('0x1d');var _0x47c643=_0x1300c9[_0x7dca('0x1e')];var _0x3e471d=_0x400616?0x0:_0x21109c['offset'];var _0x240eba=_0x400616?_0x1300c9[_0x7dca('0x1e')]:_0x21109c[_0x7dca('0x1b')]+_0x21109c[_0x7dca('0x1c')];var _0x200d48;if(_0x240eba>=_0x47c643){_0x240eba=_0x47c643;_0x200d48=0xc8;}else{_0x200d48=0xce;}_0x262fcc[_0x7dca('0x18')](_0x200d48);return _0x262fcc[_0x7dca('0x1f')](_0x7dca('0x20'),_0x3e471d+'-'+_0x240eba+'/'+_0x47c643)[_0x7dca('0x1a')](_0x1300c9);}return null;};}function patchUpdates(_0x284782){return function(_0x45dae6){try{jsonpatch[_0x7dca('0x21')](_0x45dae6,_0x284782,!![]);}catch(_0x99da13){return BPromise[_0x7dca('0x22')](_0x99da13);}return _0x45dae6['save']();};}function saveUpdates(_0x37a108,_0x201fcd){return function(_0x388bd6){if(_0x388bd6){return _0x388bd6[_0x7dca('0x23')](_0x37a108)[_0x7dca('0x24')](function(_0x4302d5){return _0x4302d5;});}return null;};}function removeEntity(_0x1ee381,_0x290dc0){return function(_0x9ba4b1){if(_0x9ba4b1){return _0x9ba4b1[_0x7dca('0x25')]()['then'](function(){_0x1ee381[_0x7dca('0x18')](0xcc)[_0x7dca('0x19')]();});}};}function handleEntityNotFound(_0x2985a5,_0x5bdbea){return function(_0x32d27a){if(!_0x32d27a){_0x2985a5['sendStatus'](0x194);}return _0x32d27a;};}function handleError(_0x35b1a7,_0x5a2bef){_0x5a2bef=_0x5a2bef||0x1f4;return function(_0x11a6a5){logger[_0x7dca('0x26')](_0x11a6a5[_0x7dca('0x27')]);if(_0x11a6a5['name']){delete _0x11a6a5[_0x7dca('0x28')];}_0x35b1a7[_0x7dca('0x18')](_0x5a2bef)[_0x7dca('0x29')](_0x11a6a5);};}exports[_0x7dca('0x2a')]=function(_0x361a61,_0x10a9b3){var _0xad0c08={},_0x14c36b={},_0x1c00bc={'count':0x0,'rows':[]};var _0x3db39c=_[_0x7dca('0x2b')](db[_0x7dca('0x2c')]['rawAttributes'],function(_0x519aca){return{'name':_0x519aca['fieldName'],'type':_0x519aca[_0x7dca('0x2d')]['key']};});_0x14c36b[_0x7dca('0x2e')]=_[_0x7dca('0x2b')](_0x3db39c,_0x7dca('0x28'));_0x14c36b['query']=_[_0x7dca('0x2f')](_0x361a61[_0x7dca('0x30')]);_0x14c36b[_0x7dca('0x31')]=_[_0x7dca('0x32')](_0x14c36b[_0x7dca('0x2e')],_0x14c36b['query']);_0xad0c08[_0x7dca('0x33')]=_[_0x7dca('0x32')](_0x14c36b[_0x7dca('0x2e')],qs[_0x7dca('0x34')](_0x361a61[_0x7dca('0x30')][_0x7dca('0x34')]));_0xad0c08['attributes']=_0xad0c08['attributes']['length']?_0xad0c08[_0x7dca('0x33')]:_0x14c36b[_0x7dca('0x2e')];if(!_0x361a61[_0x7dca('0x30')][_0x7dca('0x35')](_0x7dca('0x36'))){_0xad0c08[_0x7dca('0x1c')]=qs['limit'](_0x361a61[_0x7dca('0x30')][_0x7dca('0x1c')]);_0xad0c08['offset']=qs[_0x7dca('0x1b')](_0x361a61[_0x7dca('0x30')]['offset']);}_0xad0c08[_0x7dca('0x37')]=qs['sort'](_0x361a61[_0x7dca('0x30')][_0x7dca('0x38')]);_0xad0c08['where']=qs[_0x7dca('0x31')](_[_0x7dca('0x39')](_0x361a61[_0x7dca('0x30')],_0x14c36b[_0x7dca('0x31')]),_0x3db39c);if(_0x361a61[_0x7dca('0x30')][_0x7dca('0x3a')]){_0xad0c08[_0x7dca('0x3b')]=_[_0x7dca('0x3c')](_0xad0c08[_0x7dca('0x3b')],{'$or':_['map'](_0x3db39c,function(_0x154071){if(_0x154071['type']!=='VIRTUAL'){var _0x43d06a={};_0x43d06a[_0x154071['name']]={'$like':'%'+_0x361a61['query'][_0x7dca('0x3a')]+'%'};return _0x43d06a;}})});}_0xad0c08=_[_0x7dca('0x3c')]({},_0xad0c08,_0x361a61[_0x7dca('0x3d')]);var _0x48b49f={'where':_0xad0c08['where']};return db[_0x7dca('0x2c')][_0x7dca('0x1e')](_0x48b49f)[_0x7dca('0x24')](function(_0x31e8c9){_0x1c00bc[_0x7dca('0x1e')]=_0x31e8c9;if(_0x361a61[_0x7dca('0x30')][_0x7dca('0x3e')]){_0xad0c08[_0x7dca('0x3f')]=[{'all':!![]}];}return db[_0x7dca('0x2c')][_0x7dca('0x40')](_0xad0c08);})[_0x7dca('0x24')](function(_0x55ff1b){_0x1c00bc[_0x7dca('0x41')]=_0x55ff1b;return _0x1c00bc;})[_0x7dca('0x24')](respondWithFilteredResult(_0x10a9b3,_0xad0c08))['catch'](handleError(_0x10a9b3,null));};exports[_0x7dca('0x42')]=function(_0x3ff688,_0x5bd891){var _0x311b05={'raw':![],'where':{'id':_0x3ff688[_0x7dca('0x43')]['id']}},_0x495091={};_0x495091[_0x7dca('0x2e')]=_[_0x7dca('0x2f')](db[_0x7dca('0x2c')][_0x7dca('0x44')]);_0x495091[_0x7dca('0x30')]=_[_0x7dca('0x2f')](_0x3ff688[_0x7dca('0x30')]);_0x495091['filters']=_[_0x7dca('0x32')](_0x495091[_0x7dca('0x2e')],_0x495091['query']);_0x311b05['attributes']=_['intersection'](_0x495091[_0x7dca('0x2e')],qs[_0x7dca('0x34')](_0x3ff688[_0x7dca('0x30')][_0x7dca('0x34')]));_0x311b05[_0x7dca('0x33')]=_0x311b05['attributes'][_0x7dca('0x45')]?_0x311b05[_0x7dca('0x33')]:_0x495091['model'];if(_0x3ff688[_0x7dca('0x30')]['includeAll']){_0x311b05[_0x7dca('0x3f')]=[{'all':!![]}];}_0x311b05=_[_0x7dca('0x3c')]({},_0x311b05,_0x3ff688[_0x7dca('0x3d')]);return db[_0x7dca('0x2c')][_0x7dca('0x46')](_0x311b05)[_0x7dca('0x24')](handleEntityNotFound(_0x5bd891,null))[_0x7dca('0x24')](respondWithResult(_0x5bd891,null))[_0x7dca('0x47')](handleError(_0x5bd891,null));};exports[_0x7dca('0x48')]=function(_0x5d0b20,_0x20a588){return db[_0x7dca('0x2c')][_0x7dca('0x48')](_0x5d0b20[_0x7dca('0x49')],{})[_0x7dca('0x24')](respondWithResult(_0x20a588,0xc9))[_0x7dca('0x47')](handleError(_0x20a588,null));};exports[_0x7dca('0x23')]=function(_0x3ccbd3,_0x6b172e){if(_0x3ccbd3['body']['id']){delete _0x3ccbd3[_0x7dca('0x49')]['id'];}return db[_0x7dca('0x2c')][_0x7dca('0x46')]({'where':{'id':_0x3ccbd3[_0x7dca('0x43')]['id']}})[_0x7dca('0x24')](handleEntityNotFound(_0x6b172e,null))[_0x7dca('0x24')](saveUpdates(_0x3ccbd3[_0x7dca('0x49')],null))[_0x7dca('0x24')](respondWithResult(_0x6b172e,null))[_0x7dca('0x47')](handleError(_0x6b172e,null));};exports[_0x7dca('0x25')]=function(_0x2cd21a,_0x1d209a){return db[_0x7dca('0x2c')][_0x7dca('0x46')]({'where':{'id':_0x2cd21a[_0x7dca('0x43')]['id']}})[_0x7dca('0x24')](handleEntityNotFound(_0x1d209a,null))[_0x7dca('0x24')](removeEntity(_0x1d209a,null))['catch'](handleError(_0x1d209a,null));};exports[_0x7dca('0x4a')]=function(_0x5ce05a,_0x36d471,_0x247dfc){var _0x2a86e0={};var _0x2c3b78={};var _0x1da3b9;var _0x253d5a;return db[_0x7dca('0x2c')][_0x7dca('0x4b')]({'where':{'id':_0x5ce05a[_0x7dca('0x43')]['id']}})[_0x7dca('0x24')](handleEntityNotFound(_0x36d471,null))[_0x7dca('0x24')](function(_0x4439f0){if(_0x4439f0){_0x1da3b9=_0x4439f0;_0x2c3b78[_0x7dca('0x2e')]=_[_0x7dca('0x2f')](db['FreshsalesConfiguration'][_0x7dca('0x44')]);_0x2c3b78['query']=_[_0x7dca('0x2f')](_0x5ce05a[_0x7dca('0x30')]);_0x2c3b78[_0x7dca('0x31')]=_['intersection'](_0x2c3b78['model'],_0x2c3b78[_0x7dca('0x30')]);_0x2a86e0[_0x7dca('0x33')]=_['intersection'](_0x2c3b78[_0x7dca('0x2e')],qs[_0x7dca('0x34')](_0x5ce05a[_0x7dca('0x30')][_0x7dca('0x34')]));_0x2a86e0['attributes']=_0x2a86e0[_0x7dca('0x33')]['length']?_0x2a86e0[_0x7dca('0x33')]:_0x2c3b78[_0x7dca('0x2e')];_0x2a86e0[_0x7dca('0x37')]=qs[_0x7dca('0x38')](_0x5ce05a[_0x7dca('0x30')][_0x7dca('0x38')]);_0x2a86e0[_0x7dca('0x3b')]=qs['filters'](_[_0x7dca('0x39')](_0x5ce05a[_0x7dca('0x30')],_0x2c3b78[_0x7dca('0x31')]));if(_0x5ce05a['query']['filter']){_0x2a86e0[_0x7dca('0x3b')]=_[_0x7dca('0x3c')](_0x2a86e0[_0x7dca('0x3b')],{'$or':_['map'](_0x2a86e0[_0x7dca('0x33')],function(_0x53192e){var _0x45e1be={};_0x45e1be[_0x53192e]={'$like':'%'+_0x5ce05a['query']['filter']+'%'};return _0x45e1be;})});}_0x2a86e0=_[_0x7dca('0x3c')]({},_0x2a86e0,_0x5ce05a[_0x7dca('0x3d')]);return _0x1da3b9[_0x7dca('0x4a')](_0x2a86e0);}})['then'](function(_0x2524db){if(_0x2524db){_0x253d5a=_0x2524db[_0x7dca('0x45')];if(!_0x5ce05a[_0x7dca('0x30')][_0x7dca('0x35')]('nolimit')){_0x2a86e0[_0x7dca('0x1c')]=qs[_0x7dca('0x1c')](_0x5ce05a['query']['limit']);_0x2a86e0[_0x7dca('0x1b')]=qs[_0x7dca('0x1b')](_0x5ce05a[_0x7dca('0x30')][_0x7dca('0x1b')]);}return _0x1da3b9['getConfigurations'](_0x2a86e0);}})[_0x7dca('0x24')](function(_0x57233f){if(_0x57233f){return _0x57233f?{'count':_0x253d5a,'rows':_0x57233f}:null;}})[_0x7dca('0x24')](respondWithResult(_0x36d471,null))[_0x7dca('0x47')](handleError(_0x36d471,null));};exports[_0x7dca('0x4c')]=function(_0x380e57,_0x1cee1b,_0x511688){if(_0x380e57['body']['id']){delete _0x380e57[_0x7dca('0x49')]['id'];}return db[_0x7dca('0x2c')][_0x7dca('0x4b')]({'where':{'id':_0x380e57[_0x7dca('0x43')]['id']}})[_0x7dca('0x24')](handleEntityNotFound(_0x1cee1b,null))[_0x7dca('0x24')](function(_0x16db9b){if(_0x16db9b){_0x380e57[_0x7dca('0x49')][_0x7dca('0x4d')]=_0x16db9b['id'];_0x380e57[_0x7dca('0x49')][_0x7dca('0x4e')]=integrations['getSubjects'](_0x380e57['body']['channel'],_0x380e57[_0x7dca('0x49')][_0x7dca('0x2d')]);_0x380e57[_0x7dca('0x49')][_0x7dca('0x4f')]=integrations['getDescriptions'](_0x380e57[_0x7dca('0x49')][_0x7dca('0x50')],_0x380e57[_0x7dca('0x49')][_0x7dca('0x2d')]);return db[_0x7dca('0x51')]['create'](_0x380e57[_0x7dca('0x49')],{'include':[{'model':db['FreshsalesField'],'as':_0x7dca('0x4e')},{'model':db[_0x7dca('0x52')],'as':_0x7dca('0x4f')}]});}return null;})[_0x7dca('0x24')](respondWithResult(_0x1cee1b,null))['catch'](handleError(_0x1cee1b,null));};exports[_0x7dca('0x53')]=function(_0x5e31ce,_0x49b03d,_0x3f8bf0){var _0x39b8fc='';var _0x36f5d4='';return db[_0x7dca('0x2c')][_0x7dca('0x4b')]({'where':{'id':_0x5e31ce[_0x7dca('0x43')]['id']},'attributes':['id','username',_0x7dca('0x54'),_0x7dca('0x55')]})[_0x7dca('0x24')](handleEntityNotFound(_0x49b03d,null))[_0x7dca('0x24')](function(_0x4dcdce){if(_0x4dcdce){_0x36f5d4=_0x4dcdce[_0x7dca('0x56')];_0x39b8fc=_0x4dcdce['remoteUri'];var _0x47cf54=_0x4dcdce[_0x7dca('0x54')]['slice'](-0x1);if(_0x47cf54==='/'){_0x39b8fc=_0x39b8fc[_0x7dca('0x57')](0x0,_0x39b8fc[_0x7dca('0x58')](_0x47cf54));}return rp({'method':_0x7dca('0x59'),'uri':util['format'](_0x7dca('0x5a'),_0x39b8fc,_0x7dca('0x5b')),'headers':{'Authorization':_0x7dca('0x5c')+_0x4dcdce[_0x7dca('0x55')]},'json':!![]});}})[_0x7dca('0x24')](function(_0x33778a){if(_0x33778a){var _0x771475=_0x33778a[_0x7dca('0x5d')];var _0x1d675a=![];var _0x32a2e0=null;for(_0x32a2e0=0x0;_0x32a2e0<_0x771475[_0x7dca('0x45')];_0x32a2e0++){if(_0x771475[_0x32a2e0][_0x7dca('0x5e')]===_0x36f5d4){_0x1d675a=!![];}}if(_0x1d675a){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x7dca('0x5f')});}}})[_0x7dca('0x24')](respondWithResult(_0x49b03d,null))['catch'](function(_0x56d566){var _0x4e839c=_0x5e31ce[_0x7dca('0x30')][_0x7dca('0x60')]?0x1f4:_0x56d566[_0x7dca('0x61')]||0x1f4;logger[_0x7dca('0x26')](_0x7dca('0x62'),_0x7dca('0x53'),_0x4e839c,JSON[_0x7dca('0x63')](_0x56d566));delete _0x56d566[_0x7dca('0x28')];if(_0x4e839c===0x191){_0x4e839c=0x190;}_0x49b03d[_0x7dca('0x18')](_0x4e839c)[_0x7dca('0x29')](_0x5e31ce[_0x7dca('0x30')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x56d566[_0x7dca('0x61')]}:_0x56d566);});}; \ No newline at end of file +var _0x6cc5=['offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','FreshsalesAccount','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','show','params','keys','find','create','catch','body','getConfigurations','findOne','FreshsalesConfiguration','order','addConfiguration','AccountId','Subjects','channel','Descriptions','getDescriptions','FreshsalesField','username','remoteUri','apiKey','slice','substring','GET','format','%s%s','Token\x20token=','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','Wrong\x20credentials','zip-dir','request-promise','moment','mustache','path','sox','ejs','lodash','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','../../components/integrations/configuration','sendStatus','end','status','json'];(function(_0x4ac382,_0x34c2dd){var _0x6c9502=function(_0x2ff0ab){while(--_0x2ff0ab){_0x4ac382['push'](_0x4ac382['shift']());}};_0x6c9502(++_0x34c2dd);}(_0x6cc5,0x116));var _0x56cc=function(_0xb24fe8,_0x6c82b4){_0xb24fe8=_0xb24fe8-0x0;var _0x1ff63c=_0x6cc5[_0xb24fe8];return _0x1ff63c;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x56cc('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x56cc('0x1'));var moment=require(_0x56cc('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x56cc('0x3'));var util=require('util');var path=require(_0x56cc('0x4'));var sox=require(_0x56cc('0x5'));var csv=require('to-csv');var ejs=require(_0x56cc('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x56cc('0x7'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x56cc('0x8'));var deskjs=require(_0x56cc('0x9'));var toCsv=require(_0x56cc('0xa'));var querystring=require(_0x56cc('0xb'));var Papa=require(_0x56cc('0xc'));var Redis=require(_0x56cc('0xd'));var authService=require(_0x56cc('0xe'));var qs=require(_0x56cc('0xf'));var as=require(_0x56cc('0x10'));var hardwareService=require(_0x56cc('0x11'));var logger=require(_0x56cc('0x12'))(_0x56cc('0x13'));var utils=require(_0x56cc('0x14'));var config=require(_0x56cc('0x15'));var licenseUtil=require(_0x56cc('0x16'));var db=require('../../mysqldb')['db'];var integrations=require(_0x56cc('0x17'));function respondWithStatusCode(_0x9a1df3,_0x4261c8){_0x4261c8=_0x4261c8||0xcc;return function(_0xdc5315){if(_0xdc5315){return _0x9a1df3[_0x56cc('0x18')](_0x4261c8);}return _0x9a1df3['status'](_0x4261c8)[_0x56cc('0x19')]();};}function respondWithResult(_0x3ca739,_0x50c5b4){_0x50c5b4=_0x50c5b4||0xc8;return function(_0x3acf3d){if(_0x3acf3d){return _0x3ca739[_0x56cc('0x1a')](_0x50c5b4)[_0x56cc('0x1b')](_0x3acf3d);}};}function respondWithFilteredResult(_0x3c3061,_0x5354e1){return function(_0x4a312f){if(_0x4a312f){var _0x4dca94=typeof _0x5354e1[_0x56cc('0x1c')]===_0x56cc('0x1d')&&typeof _0x5354e1[_0x56cc('0x1e')]===_0x56cc('0x1d');var _0x160fa5=_0x4a312f['count'];var _0x487a9c=_0x4dca94?0x0:_0x5354e1[_0x56cc('0x1c')];var _0x47cf55=_0x4dca94?_0x4a312f[_0x56cc('0x1f')]:_0x5354e1['offset']+_0x5354e1[_0x56cc('0x1e')];var _0xdff8b;if(_0x47cf55>=_0x160fa5){_0x47cf55=_0x160fa5;_0xdff8b=0xc8;}else{_0xdff8b=0xce;}_0x3c3061[_0x56cc('0x1a')](_0xdff8b);return _0x3c3061[_0x56cc('0x20')](_0x56cc('0x21'),_0x487a9c+'-'+_0x47cf55+'/'+_0x160fa5)['json'](_0x4a312f);}return null;};}function patchUpdates(_0x31f39e){return function(_0x49e15a){try{jsonpatch[_0x56cc('0x22')](_0x49e15a,_0x31f39e,!![]);}catch(_0x2e2ab5){return BPromise[_0x56cc('0x23')](_0x2e2ab5);}return _0x49e15a[_0x56cc('0x24')]();};}function saveUpdates(_0x52b47c,_0x3c3fed){return function(_0x2a808b){if(_0x2a808b){return _0x2a808b[_0x56cc('0x25')](_0x52b47c)[_0x56cc('0x26')](function(_0x3d7fd9){return _0x3d7fd9;});}return null;};}function removeEntity(_0x3d87b4,_0x142bf9){return function(_0x560663){if(_0x560663){return _0x560663[_0x56cc('0x27')]()[_0x56cc('0x26')](function(){_0x3d87b4['status'](0xcc)[_0x56cc('0x19')]();});}};}function handleEntityNotFound(_0x518e53,_0x4bbbd7){return function(_0x9b91ec){if(!_0x9b91ec){_0x518e53[_0x56cc('0x18')](0x194);}return _0x9b91ec;};}function handleError(_0x573dd7,_0x3558d0){_0x3558d0=_0x3558d0||0x1f4;return function(_0x4033e6){logger[_0x56cc('0x28')](_0x4033e6[_0x56cc('0x29')]);if(_0x4033e6[_0x56cc('0x2a')]){delete _0x4033e6[_0x56cc('0x2a')];}_0x573dd7[_0x56cc('0x1a')](_0x3558d0)[_0x56cc('0x2b')](_0x4033e6);};}exports[_0x56cc('0x2c')]=function(_0x18e3f6,_0x5ac527){var _0x4ac3df={},_0xd4677b={},_0xeeccc0={'count':0x0,'rows':[]};var _0x334682=_[_0x56cc('0x2d')](db[_0x56cc('0x2e')][_0x56cc('0x2f')],function(_0x4fd7f8){return{'name':_0x4fd7f8[_0x56cc('0x30')],'type':_0x4fd7f8[_0x56cc('0x31')][_0x56cc('0x32')]};});_0xd4677b[_0x56cc('0x33')]=_[_0x56cc('0x2d')](_0x334682,_0x56cc('0x2a'));_0xd4677b[_0x56cc('0x34')]=_['keys'](_0x18e3f6[_0x56cc('0x34')]);_0xd4677b[_0x56cc('0x35')]=_[_0x56cc('0x36')](_0xd4677b[_0x56cc('0x33')],_0xd4677b[_0x56cc('0x34')]);_0x4ac3df[_0x56cc('0x37')]=_[_0x56cc('0x36')](_0xd4677b[_0x56cc('0x33')],qs[_0x56cc('0x38')](_0x18e3f6['query'][_0x56cc('0x38')]));_0x4ac3df[_0x56cc('0x37')]=_0x4ac3df[_0x56cc('0x37')][_0x56cc('0x39')]?_0x4ac3df[_0x56cc('0x37')]:_0xd4677b[_0x56cc('0x33')];if(!_0x18e3f6['query'][_0x56cc('0x3a')](_0x56cc('0x3b'))){_0x4ac3df[_0x56cc('0x1e')]=qs[_0x56cc('0x1e')](_0x18e3f6[_0x56cc('0x34')][_0x56cc('0x1e')]);_0x4ac3df[_0x56cc('0x1c')]=qs[_0x56cc('0x1c')](_0x18e3f6[_0x56cc('0x34')][_0x56cc('0x1c')]);}_0x4ac3df['order']=qs[_0x56cc('0x3c')](_0x18e3f6[_0x56cc('0x34')][_0x56cc('0x3c')]);_0x4ac3df[_0x56cc('0x3d')]=qs['filters'](_[_0x56cc('0x3e')](_0x18e3f6[_0x56cc('0x34')],_0xd4677b[_0x56cc('0x35')]),_0x334682);if(_0x18e3f6[_0x56cc('0x34')]['filter']){_0x4ac3df[_0x56cc('0x3d')]=_['merge'](_0x4ac3df[_0x56cc('0x3d')],{'$or':_[_0x56cc('0x2d')](_0x334682,function(_0x13ea57){if(_0x13ea57[_0x56cc('0x31')]!=='VIRTUAL'){var _0x1616a1={};_0x1616a1[_0x13ea57[_0x56cc('0x2a')]]={'$like':'%'+_0x18e3f6['query'][_0x56cc('0x3f')]+'%'};return _0x1616a1;}})});}_0x4ac3df=_[_0x56cc('0x40')]({},_0x4ac3df,_0x18e3f6[_0x56cc('0x41')]);var _0x1423dd={'where':_0x4ac3df['where']};return db[_0x56cc('0x2e')][_0x56cc('0x1f')](_0x1423dd)[_0x56cc('0x26')](function(_0x33203f){_0xeeccc0[_0x56cc('0x1f')]=_0x33203f;if(_0x18e3f6['query'][_0x56cc('0x42')]){_0x4ac3df[_0x56cc('0x43')]=[{'all':!![]}];}return db[_0x56cc('0x2e')][_0x56cc('0x44')](_0x4ac3df);})[_0x56cc('0x26')](function(_0x2c6deb){_0xeeccc0[_0x56cc('0x45')]=_0x2c6deb;return _0xeeccc0;})['then'](respondWithFilteredResult(_0x5ac527,_0x4ac3df))['catch'](handleError(_0x5ac527,null));};exports[_0x56cc('0x46')]=function(_0x43b256,_0x1d2adf){var _0x5364ba={'raw':![],'where':{'id':_0x43b256[_0x56cc('0x47')]['id']}},_0x3f8f6b={};_0x3f8f6b[_0x56cc('0x33')]=_[_0x56cc('0x48')](db['FreshsalesAccount'][_0x56cc('0x2f')]);_0x3f8f6b['query']=_[_0x56cc('0x48')](_0x43b256[_0x56cc('0x34')]);_0x3f8f6b[_0x56cc('0x35')]=_['intersection'](_0x3f8f6b[_0x56cc('0x33')],_0x3f8f6b[_0x56cc('0x34')]);_0x5364ba[_0x56cc('0x37')]=_['intersection'](_0x3f8f6b['model'],qs[_0x56cc('0x38')](_0x43b256[_0x56cc('0x34')]['fields']));_0x5364ba[_0x56cc('0x37')]=_0x5364ba['attributes'][_0x56cc('0x39')]?_0x5364ba[_0x56cc('0x37')]:_0x3f8f6b['model'];if(_0x43b256[_0x56cc('0x34')]['includeAll']){_0x5364ba[_0x56cc('0x43')]=[{'all':!![]}];}_0x5364ba=_['merge']({},_0x5364ba,_0x43b256[_0x56cc('0x41')]);return db[_0x56cc('0x2e')][_0x56cc('0x49')](_0x5364ba)[_0x56cc('0x26')](handleEntityNotFound(_0x1d2adf,null))[_0x56cc('0x26')](respondWithResult(_0x1d2adf,null))['catch'](handleError(_0x1d2adf,null));};exports[_0x56cc('0x4a')]=function(_0x304466,_0x58fc13){return db[_0x56cc('0x2e')][_0x56cc('0x4a')](_0x304466['body'],{})['then'](respondWithResult(_0x58fc13,0xc9))[_0x56cc('0x4b')](handleError(_0x58fc13,null));};exports[_0x56cc('0x25')]=function(_0x4df18a,_0x1ffebd){if(_0x4df18a[_0x56cc('0x4c')]['id']){delete _0x4df18a['body']['id'];}return db[_0x56cc('0x2e')][_0x56cc('0x49')]({'where':{'id':_0x4df18a[_0x56cc('0x47')]['id']}})['then'](handleEntityNotFound(_0x1ffebd,null))[_0x56cc('0x26')](saveUpdates(_0x4df18a['body'],null))[_0x56cc('0x26')](respondWithResult(_0x1ffebd,null))[_0x56cc('0x4b')](handleError(_0x1ffebd,null));};exports[_0x56cc('0x27')]=function(_0x3f7de,_0x80df38){return db[_0x56cc('0x2e')][_0x56cc('0x49')]({'where':{'id':_0x3f7de['params']['id']}})[_0x56cc('0x26')](handleEntityNotFound(_0x80df38,null))[_0x56cc('0x26')](removeEntity(_0x80df38,null))[_0x56cc('0x4b')](handleError(_0x80df38,null));};exports[_0x56cc('0x4d')]=function(_0x5f8d71,_0x3476e1,_0x12ab35){var _0x516d73={};var _0x17b55c={};var _0x32287d;var _0x7c7c87;return db[_0x56cc('0x2e')][_0x56cc('0x4e')]({'where':{'id':_0x5f8d71['params']['id']}})[_0x56cc('0x26')](handleEntityNotFound(_0x3476e1,null))['then'](function(_0x583edc){if(_0x583edc){_0x32287d=_0x583edc;_0x17b55c[_0x56cc('0x33')]=_[_0x56cc('0x48')](db[_0x56cc('0x4f')][_0x56cc('0x2f')]);_0x17b55c[_0x56cc('0x34')]=_[_0x56cc('0x48')](_0x5f8d71[_0x56cc('0x34')]);_0x17b55c['filters']=_[_0x56cc('0x36')](_0x17b55c[_0x56cc('0x33')],_0x17b55c[_0x56cc('0x34')]);_0x516d73[_0x56cc('0x37')]=_[_0x56cc('0x36')](_0x17b55c['model'],qs[_0x56cc('0x38')](_0x5f8d71[_0x56cc('0x34')][_0x56cc('0x38')]));_0x516d73['attributes']=_0x516d73[_0x56cc('0x37')][_0x56cc('0x39')]?_0x516d73['attributes']:_0x17b55c[_0x56cc('0x33')];_0x516d73[_0x56cc('0x50')]=qs[_0x56cc('0x3c')](_0x5f8d71[_0x56cc('0x34')][_0x56cc('0x3c')]);_0x516d73[_0x56cc('0x3d')]=qs[_0x56cc('0x35')](_[_0x56cc('0x3e')](_0x5f8d71['query'],_0x17b55c['filters']));if(_0x5f8d71[_0x56cc('0x34')][_0x56cc('0x3f')]){_0x516d73['where']=_['merge'](_0x516d73[_0x56cc('0x3d')],{'$or':_[_0x56cc('0x2d')](_0x516d73[_0x56cc('0x37')],function(_0xd72d95){var _0x562838={};_0x562838[_0xd72d95]={'$like':'%'+_0x5f8d71['query'][_0x56cc('0x3f')]+'%'};return _0x562838;})});}_0x516d73=_[_0x56cc('0x40')]({},_0x516d73,_0x5f8d71['options']);return _0x32287d[_0x56cc('0x4d')](_0x516d73);}})[_0x56cc('0x26')](function(_0x3182bd){if(_0x3182bd){_0x7c7c87=_0x3182bd[_0x56cc('0x39')];if(!_0x5f8d71[_0x56cc('0x34')]['hasOwnProperty'](_0x56cc('0x3b'))){_0x516d73[_0x56cc('0x1e')]=qs['limit'](_0x5f8d71[_0x56cc('0x34')][_0x56cc('0x1e')]);_0x516d73[_0x56cc('0x1c')]=qs[_0x56cc('0x1c')](_0x5f8d71[_0x56cc('0x34')][_0x56cc('0x1c')]);}return _0x32287d['getConfigurations'](_0x516d73);}})[_0x56cc('0x26')](function(_0x5eb950){if(_0x5eb950){return _0x5eb950?{'count':_0x7c7c87,'rows':_0x5eb950}:null;}})[_0x56cc('0x26')](respondWithResult(_0x3476e1,null))[_0x56cc('0x4b')](handleError(_0x3476e1,null));};exports[_0x56cc('0x51')]=function(_0x21846b,_0x486059,_0x2a6330){if(_0x21846b[_0x56cc('0x4c')]['id']){delete _0x21846b[_0x56cc('0x4c')]['id'];}return db[_0x56cc('0x2e')][_0x56cc('0x4e')]({'where':{'id':_0x21846b[_0x56cc('0x47')]['id']}})[_0x56cc('0x26')](handleEntityNotFound(_0x486059,null))[_0x56cc('0x26')](function(_0x52a793){if(_0x52a793){_0x21846b[_0x56cc('0x4c')][_0x56cc('0x52')]=_0x52a793['id'];_0x21846b[_0x56cc('0x4c')][_0x56cc('0x53')]=integrations['getSubjects'](_0x21846b[_0x56cc('0x4c')][_0x56cc('0x54')],_0x21846b[_0x56cc('0x4c')][_0x56cc('0x31')]);_0x21846b['body'][_0x56cc('0x55')]=integrations[_0x56cc('0x56')](_0x21846b['body']['channel'],_0x21846b[_0x56cc('0x4c')][_0x56cc('0x31')]);return db['FreshsalesConfiguration'][_0x56cc('0x4a')](_0x21846b[_0x56cc('0x4c')],{'include':[{'model':db[_0x56cc('0x57')],'as':'Subjects'},{'model':db[_0x56cc('0x57')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x486059,null))[_0x56cc('0x4b')](handleError(_0x486059,null));};exports['getFields']=function(_0x6e389,_0x3d3d4a,_0xf481){var _0x2a47dc='';var _0x1b3ab9='';return db[_0x56cc('0x2e')][_0x56cc('0x4e')]({'where':{'id':_0x6e389[_0x56cc('0x47')]['id']},'attributes':['id',_0x56cc('0x58'),_0x56cc('0x59'),_0x56cc('0x5a')]})[_0x56cc('0x26')](handleEntityNotFound(_0x3d3d4a,null))[_0x56cc('0x26')](function(_0x975101){if(_0x975101){_0x1b3ab9=_0x975101[_0x56cc('0x58')];_0x2a47dc=_0x975101['remoteUri'];var _0x477790=_0x975101[_0x56cc('0x59')][_0x56cc('0x5b')](-0x1);if(_0x477790==='/'){_0x2a47dc=_0x2a47dc[_0x56cc('0x5c')](0x0,_0x2a47dc['lastIndexOf'](_0x477790));}return rp({'method':_0x56cc('0x5d'),'uri':util[_0x56cc('0x5e')](_0x56cc('0x5f'),_0x2a47dc,'/api/selector/owners'),'headers':{'Authorization':_0x56cc('0x60')+_0x975101[_0x56cc('0x5a')]},'json':!![]});}})[_0x56cc('0x26')](function(_0x4f1115){if(_0x4f1115){var _0x5e9ca3=_0x4f1115['users'];var _0x4a29f9=![];var _0x24e091=null;for(_0x24e091=0x0;_0x24e091<_0x5e9ca3[_0x56cc('0x39')];_0x24e091++){if(_0x5e9ca3[_0x24e091]['email']===_0x1b3ab9){_0x4a29f9=!![];}}if(_0x4a29f9){return!![];}else{throw new Error({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}})[_0x56cc('0x26')](respondWithResult(_0x3d3d4a,null))[_0x56cc('0x4b')](function(_0x49acbe){var _0x546dee=_0x6e389[_0x56cc('0x34')][_0x56cc('0x61')]?0x1f4:_0x49acbe[_0x56cc('0x62')]||0x1f4;logger[_0x56cc('0x28')](_0x56cc('0x63'),_0x56cc('0x64'),_0x546dee,JSON['stringify'](_0x49acbe));delete _0x49acbe[_0x56cc('0x2a')];if(_0x546dee===0x191){_0x546dee=0x190;}_0x3d3d4a[_0x56cc('0x1a')](_0x546dee)[_0x56cc('0x2b')](_0x6e389['query'][_0x56cc('0x61')]?{'message':_0x56cc('0x65'),'statusCode':_0x49acbe[_0x56cc('0x62')]}:_0x49acbe);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index 790778f..0ccac6b 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 _0xcaf2=['./intFreshsalesAccount.attributes','../../components/integrations/configuration','exports','define','FreshsalesAccount','int_freshsales_accounts','lodash','../../config/logger','api','bluebird','request-promise','rimraf'];(function(_0x385467,_0x298239){var _0x5ed67e=function(_0x4b252c){while(--_0x4b252c){_0x385467['push'](_0x385467['shift']());}};_0x5ed67e(++_0x298239);}(_0xcaf2,0x8a));var _0x2caf=function(_0x4cce3e,_0x4a1349){_0x4cce3e=_0x4cce3e-0x0;var _0x391e08=_0xcaf2[_0x4cce3e];return _0x391e08;};'use strict';var _=require(_0x2caf('0x0'));var util=require('util');var logger=require(_0x2caf('0x1'))(_0x2caf('0x2'));var moment=require('moment');var BPromise=require(_0x2caf('0x3'));var rp=require(_0x2caf('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2caf('0x5'));var config=require('../../config/environment');var attributes=require(_0x2caf('0x6'));var integrations=require(_0x2caf('0x7'));module[_0x2caf('0x8')]=function(_0x599ce7,_0xc44e4e){return _0x599ce7[_0x2caf('0x9')](_0x2caf('0xa'),attributes,{'tableName':_0x2caf('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8f9d=['exports','define','FreshsalesAccount','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesAccount.attributes'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0x8f9d,0x93));var _0xd8f9=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x8f9d[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0xd8f9('0x0'));var util=require('util');var logger=require(_0xd8f9('0x1'))('api');var moment=require(_0xd8f9('0x2'));var BPromise=require(_0xd8f9('0x3'));var rp=require(_0xd8f9('0x4'));var fs=require('fs');var path=require(_0xd8f9('0x5'));var rimraf=require(_0xd8f9('0x6'));var config=require(_0xd8f9('0x7'));var attributes=require(_0xd8f9('0x8'));var integrations=require('../../components/integrations/configuration');module[_0xd8f9('0x9')]=function(_0x24dd1e,_0x25d417){return _0x24dd1e[_0xd8f9('0xa')](_0xd8f9('0xb'),attributes,{'tableName':'int_freshsales_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js index b549635..b8c7b13 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 _0x7b84=['FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','options','where','attributes','limit','map','model','include','GetFreshsalesAccount','ShowFreshsalesAccount','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0x7b84,0x17c));var _0x47b8=function(_0x186938,_0x31503f){_0x186938=_0x186938-0x0;var _0x527527=_0x7b84[_0x186938];return _0x527527;};'use strict';var _=require(_0x47b8('0x0'));var util=require(_0x47b8('0x1'));var moment=require(_0x47b8('0x2'));var BPromise=require(_0x47b8('0x3'));var rs=require(_0x47b8('0x4'));var fs=require('fs');var Redis=require(_0x47b8('0x5'));var db=require(_0x47b8('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x47b8('0x7'))(_0x47b8('0x8'));var config=require(_0x47b8('0x9'));var jayson=require(_0x47b8('0xa'));var client=jayson[_0x47b8('0xb')][_0x47b8('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x53e656,_0x3867ca,_0x3ce846){return new BPromise(function(_0x46245a,_0xb845c9){return client[_0x47b8('0xd')](_0x53e656,_0x3ce846)[_0x47b8('0xe')](function(_0x24d240){logger[_0x47b8('0xf')](_0x47b8('0x10'),_0x3867ca,_0x47b8('0x11'));logger[_0x47b8('0x12')](_0x47b8('0x13'),_0x3867ca,_0x47b8('0x11'),JSON[_0x47b8('0x14')](_0x24d240));if(_0x24d240[_0x47b8('0x15')]){if(_0x24d240[_0x47b8('0x15')][_0x47b8('0x16')]===0x1f4){logger[_0x47b8('0x15')](_0x47b8('0x10'),_0x3867ca,_0x24d240[_0x47b8('0x15')][_0x47b8('0x17')]);return _0xb845c9(_0x24d240[_0x47b8('0x15')][_0x47b8('0x17')]);}logger[_0x47b8('0x15')](_0x47b8('0x10'),_0x3867ca,_0x24d240[_0x47b8('0x15')][_0x47b8('0x17')]);return _0x46245a(_0x24d240['error'][_0x47b8('0x17')]);}else{logger[_0x47b8('0xf')](_0x47b8('0x10'),_0x3867ca,_0x47b8('0x11'));_0x46245a(_0x24d240[_0x47b8('0x18')][_0x47b8('0x17')]);}})[_0x47b8('0x19')](function(_0x5ad3ae){logger[_0x47b8('0x15')]('FreshsalesAccount,\x20%s,\x20%s',_0x3867ca,_0x5ad3ae);_0xb845c9(_0x5ad3ae);});});}exports['GetFreshsalesAccount']=function(_0x4f7317){var _0x299195=this;return new Promise(function(_0x36faf1,_0x2797ac){return db['FreshsalesAccount']['findAll']({'raw':_0x4f7317['options']?_0x4f7317[_0x47b8('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x4f7317[_0x47b8('0x1a')]?_0x4f7317[_0x47b8('0x1a')][_0x47b8('0x1b')]||null:null,'attributes':_0x4f7317[_0x47b8('0x1a')]?_0x4f7317['options'][_0x47b8('0x1c')]||null:null,'limit':_0x4f7317[_0x47b8('0x1a')]?_0x4f7317[_0x47b8('0x1a')][_0x47b8('0x1d')]||null:null,'include':_0x4f7317[_0x47b8('0x1a')]?_0x4f7317[_0x47b8('0x1a')]['include']?_[_0x47b8('0x1e')](_0x4f7317[_0x47b8('0x1a')]['include'],function(_0x22e7dd){return{'model':db[_0x22e7dd[_0x47b8('0x1f')]],'as':_0x22e7dd['as'],'attributes':_0x22e7dd[_0x47b8('0x1c')],'include':_0x22e7dd[_0x47b8('0x20')]?_['map'](_0x22e7dd[_0x47b8('0x20')],function(_0x332c23){return{'model':db[_0x332c23[_0x47b8('0x1f')]],'as':_0x332c23['as'],'attributes':_0x332c23[_0x47b8('0x1c')],'include':_0x332c23[_0x47b8('0x20')]?_[_0x47b8('0x1e')](_0x332c23[_0x47b8('0x20')],function(_0x568c1e){return{'model':db[_0x568c1e[_0x47b8('0x1f')]],'as':_0x568c1e['as'],'attributes':_0x568c1e[_0x47b8('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x195a66){logger[_0x47b8('0xf')](_0x47b8('0x21'),_0x4f7317);logger[_0x47b8('0x12')]('GetFreshsalesAccount',_0x4f7317,JSON[_0x47b8('0x14')](_0x195a66));_0x36faf1(_0x195a66);})['catch'](function(_0x2c89fc){logger[_0x47b8('0x15')](_0x47b8('0x21'),_0x2c89fc[_0x47b8('0x17')],_0x4f7317);_0x2797ac(_0x299195['error'](0x1f4,_0x2c89fc[_0x47b8('0x17')]));});});};exports[_0x47b8('0x22')]=function(_0x402e7c){var _0x1b6c0a=this;return new Promise(function(_0x132f37,_0x197cb5){return db['FreshsalesAccount']['find']({'raw':_0x402e7c['options']?_0x402e7c[_0x47b8('0x1a')][_0x47b8('0x23')]===undefined?!![]:![]:!![],'where':_0x402e7c[_0x47b8('0x1a')]?_0x402e7c['options']['where']||null:null,'attributes':_0x402e7c['options']?_0x402e7c['options'][_0x47b8('0x1c')]||null:null,'include':_0x402e7c[_0x47b8('0x1a')]?_0x402e7c[_0x47b8('0x1a')][_0x47b8('0x20')]?_[_0x47b8('0x1e')](_0x402e7c[_0x47b8('0x1a')][_0x47b8('0x20')],function(_0x460dcc){return{'model':db[_0x460dcc[_0x47b8('0x1f')]],'as':_0x460dcc['as'],'attributes':_0x460dcc['attributes'],'include':_0x460dcc['include']?_[_0x47b8('0x1e')](_0x460dcc[_0x47b8('0x20')],function(_0x531dd2){return{'model':db[_0x531dd2['model']],'as':_0x531dd2['as'],'attributes':_0x531dd2[_0x47b8('0x1c')],'include':_0x531dd2[_0x47b8('0x20')]?_[_0x47b8('0x1e')](_0x531dd2['include'],function(_0x240ab6){return{'model':db[_0x240ab6[_0x47b8('0x1f')]],'as':_0x240ab6['as'],'attributes':_0x240ab6['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x4f1892){logger['info'](_0x47b8('0x22'),_0x402e7c);logger[_0x47b8('0x12')](_0x47b8('0x22'),_0x402e7c,JSON[_0x47b8('0x14')](_0x4f1892));_0x132f37(_0x4f1892);})[_0x47b8('0x19')](function(_0x3c24c1){logger['error']('ShowFreshsalesAccount',_0x3c24c1[_0x47b8('0x17')],_0x402e7c);_0x197cb5(_0x1b6c0a[_0x47b8('0x15')](0x1f4,_0x3c24c1[_0x47b8('0x17')]));});});}; \ No newline at end of file +var _0x958a=['attributes','limit','include','map','model','ShowFreshsalesAccount','find','where','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','then','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'];(function(_0x27f146,_0x5515bf){var _0xd45e2a=function(_0x51dce2){while(--_0x51dce2){_0x27f146['push'](_0x27f146['shift']());}};_0xd45e2a(++_0x5515bf);}(_0x958a,0x128));var _0xa958=function(_0x2bc24d,_0x145789){_0x2bc24d=_0x2bc24d-0x0;var _0x3c363b=_0x958a[_0x2bc24d];return _0x3c363b;};'use strict';var _=require(_0xa958('0x0'));var util=require(_0xa958('0x1'));var moment=require('moment');var BPromise=require(_0xa958('0x2'));var rs=require(_0xa958('0x3'));var fs=require('fs');var Redis=require(_0xa958('0x4'));var db=require(_0xa958('0x5'))['db'];var utils=require(_0xa958('0x6'));var logger=require('../../config/logger')(_0xa958('0x7'));var config=require('../../config/environment');var jayson=require(_0xa958('0x8'));var client=jayson[_0xa958('0x9')][_0xa958('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3ddaa9,_0x3ca01f,_0x3b2693){return new BPromise(function(_0x1895da,_0x54c0e0){return client['request'](_0x3ddaa9,_0x3b2693)[_0xa958('0xb')](function(_0x249764){logger[_0xa958('0xc')](_0xa958('0xd'),_0x3ca01f,_0xa958('0xe'));logger[_0xa958('0xf')](_0xa958('0x10'),_0x3ca01f,_0xa958('0xe'),JSON[_0xa958('0x11')](_0x249764));if(_0x249764[_0xa958('0x12')]){if(_0x249764[_0xa958('0x12')][_0xa958('0x13')]===0x1f4){logger[_0xa958('0x12')]('FreshsalesAccount,\x20%s,\x20%s',_0x3ca01f,_0x249764['error']['message']);return _0x54c0e0(_0x249764[_0xa958('0x12')][_0xa958('0x14')]);}logger[_0xa958('0x12')]('FreshsalesAccount,\x20%s,\x20%s',_0x3ca01f,_0x249764[_0xa958('0x12')]['message']);return _0x1895da(_0x249764['error']['message']);}else{logger[_0xa958('0xc')](_0xa958('0xd'),_0x3ca01f,_0xa958('0xe'));_0x1895da(_0x249764[_0xa958('0x15')][_0xa958('0x14')]);}})[_0xa958('0x16')](function(_0x23736f){logger[_0xa958('0x12')]('FreshsalesAccount,\x20%s,\x20%s',_0x3ca01f,_0x23736f);_0x54c0e0(_0x23736f);});});}exports[_0xa958('0x17')]=function(_0x4eadc9){var _0x3a053f=this;return new Promise(function(_0x70d13e,_0x52a184){return db[_0xa958('0x18')][_0xa958('0x19')]({'raw':_0x4eadc9[_0xa958('0x1a')]?_0x4eadc9[_0xa958('0x1a')][_0xa958('0x1b')]===undefined?!![]:![]:!![],'where':_0x4eadc9[_0xa958('0x1a')]?_0x4eadc9['options']['where']||null:null,'attributes':_0x4eadc9[_0xa958('0x1a')]?_0x4eadc9[_0xa958('0x1a')][_0xa958('0x1c')]||null:null,'limit':_0x4eadc9['options']?_0x4eadc9[_0xa958('0x1a')][_0xa958('0x1d')]||null:null,'include':_0x4eadc9['options']?_0x4eadc9[_0xa958('0x1a')][_0xa958('0x1e')]?_['map'](_0x4eadc9['options'][_0xa958('0x1e')],function(_0x40b51e){return{'model':db[_0x40b51e['model']],'as':_0x40b51e['as'],'attributes':_0x40b51e[_0xa958('0x1c')],'include':_0x40b51e[_0xa958('0x1e')]?_[_0xa958('0x1f')](_0x40b51e[_0xa958('0x1e')],function(_0x16b04a){return{'model':db[_0x16b04a[_0xa958('0x20')]],'as':_0x16b04a['as'],'attributes':_0x16b04a['attributes'],'include':_0x16b04a[_0xa958('0x1e')]?_['map'](_0x16b04a[_0xa958('0x1e')],function(_0x3c2ea3){return{'model':db[_0x3c2ea3[_0xa958('0x20')]],'as':_0x3c2ea3['as'],'attributes':_0x3c2ea3[_0xa958('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xa958('0xb')](function(_0xddc7f6){logger[_0xa958('0xc')](_0xa958('0x17'),_0x4eadc9);logger[_0xa958('0xf')](_0xa958('0x17'),_0x4eadc9,JSON['stringify'](_0xddc7f6));_0x70d13e(_0xddc7f6);})['catch'](function(_0xd2fcc9){logger['error'](_0xa958('0x17'),_0xd2fcc9[_0xa958('0x14')],_0x4eadc9);_0x52a184(_0x3a053f['error'](0x1f4,_0xd2fcc9[_0xa958('0x14')]));});});};exports[_0xa958('0x21')]=function(_0x179bc2){var _0x374c77=this;return new Promise(function(_0x283452,_0x54ad35){return db['FreshsalesAccount'][_0xa958('0x22')]({'raw':_0x179bc2['options']?_0x179bc2['options'][_0xa958('0x1b')]===undefined?!![]:![]:!![],'where':_0x179bc2[_0xa958('0x1a')]?_0x179bc2[_0xa958('0x1a')][_0xa958('0x23')]||null:null,'attributes':_0x179bc2[_0xa958('0x1a')]?_0x179bc2[_0xa958('0x1a')]['attributes']||null:null,'include':_0x179bc2[_0xa958('0x1a')]?_0x179bc2['options']['include']?_[_0xa958('0x1f')](_0x179bc2[_0xa958('0x1a')][_0xa958('0x1e')],function(_0x1cc55d){return{'model':db[_0x1cc55d[_0xa958('0x20')]],'as':_0x1cc55d['as'],'attributes':_0x1cc55d[_0xa958('0x1c')],'include':_0x1cc55d[_0xa958('0x1e')]?_[_0xa958('0x1f')](_0x1cc55d['include'],function(_0x579e4c){return{'model':db[_0x579e4c[_0xa958('0x20')]],'as':_0x579e4c['as'],'attributes':_0x579e4c[_0xa958('0x1c')],'include':_0x579e4c[_0xa958('0x1e')]?_[_0xa958('0x1f')](_0x579e4c[_0xa958('0x1e')],function(_0x5da411){return{'model':db[_0x5da411[_0xa958('0x20')]],'as':_0x5da411['as'],'attributes':_0x5da411[_0xa958('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xa958('0xb')](function(_0x30effe){logger['info'](_0xa958('0x21'),_0x179bc2);logger[_0xa958('0xf')](_0xa958('0x21'),_0x179bc2,JSON[_0xa958('0x11')](_0x30effe));_0x283452(_0x30effe);})[_0xa958('0x16')](function(_0x48189e){logger[_0xa958('0x12')](_0xa958('0x21'),_0x48189e[_0xa958('0x14')],_0x179bc2);_0x54ad35(_0x374c77[_0xa958('0x12')](0x1f4,_0x48189e[_0xa958('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index 07c3fbf..c94b39d 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 _0x1313=['/:id/fields','create','put','delete','destroy','exports','util','path','connect-timeout','express','Router','../../config/environment','./intFreshsalesConfiguration.controller','get','isAuthenticated','index','/:id','show','getSubjects','/:id/descriptions'];(function(_0x4e30fc,_0x1152c6){var _0x3fa43c=function(_0x439ee8){while(--_0x439ee8){_0x4e30fc['push'](_0x4e30fc['shift']());}};_0x3fa43c(++_0x1152c6);}(_0x1313,0x6a));var _0x3131=function(_0x4da9cc,_0x1328d9){_0x4da9cc=_0x4da9cc-0x0;var _0x54cc22=_0x1313[_0x4da9cc];return _0x54cc22;};'use strict';var multer=require('multer');var util=require(_0x3131('0x0'));var path=require(_0x3131('0x1'));var timeout=require(_0x3131('0x2'));var express=require(_0x3131('0x3'));var router=express[_0x3131('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x3131('0x5'));var controller=require(_0x3131('0x6'));router[_0x3131('0x7')]('/',auth[_0x3131('0x8')](),controller[_0x3131('0x9')]);router[_0x3131('0x7')](_0x3131('0xa'),auth[_0x3131('0x8')](),controller[_0x3131('0xb')]);router['get']('/:id/subjects',auth[_0x3131('0x8')](),controller[_0x3131('0xc')]);router['get'](_0x3131('0xd'),auth[_0x3131('0x8')](),controller['getDescriptions']);router[_0x3131('0x7')](_0x3131('0xe'),auth[_0x3131('0x8')](),controller['getFields']);router['post']('/',auth[_0x3131('0x8')](),controller[_0x3131('0xf')]);router[_0x3131('0x10')](_0x3131('0xa'),auth[_0x3131('0x8')](),controller['update']);router[_0x3131('0x11')]('/:id',auth[_0x3131('0x8')](),controller[_0x3131('0x12')]);module[_0x3131('0x13')]=router; \ No newline at end of file +var _0x8ef8=['../../components/interaction/service','get','isAuthenticated','show','getSubjects','/:id/descriptions','getDescriptions','/:id/fields','getFields','post','create','put','update','/:id','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x35e018,_0x30c393){var _0x53a753=function(_0x421d6c){while(--_0x421d6c){_0x35e018['push'](_0x35e018['shift']());}};_0x53a753(++_0x30c393);}(_0x8ef8,0x93));var _0x88ef=function(_0x55b2f5,_0x34d28e){_0x55b2f5=_0x55b2f5-0x0;var _0x47908e=_0x8ef8[_0x55b2f5];return _0x47908e;};'use strict';var multer=require('multer');var util=require(_0x88ef('0x0'));var path=require(_0x88ef('0x1'));var timeout=require(_0x88ef('0x2'));var express=require(_0x88ef('0x3'));var router=express[_0x88ef('0x4')]();var fs_extra=require(_0x88ef('0x5'));var auth=require(_0x88ef('0x6'));var interaction=require(_0x88ef('0x7'));var config=require('../../config/environment');var controller=require('./intFreshsalesConfiguration.controller');router[_0x88ef('0x8')]('/',auth[_0x88ef('0x9')](),controller['index']);router['get']('/:id',auth[_0x88ef('0x9')](),controller[_0x88ef('0xa')]);router['get']('/:id/subjects',auth['isAuthenticated'](),controller[_0x88ef('0xb')]);router[_0x88ef('0x8')](_0x88ef('0xc'),auth[_0x88ef('0x9')](),controller[_0x88ef('0xd')]);router[_0x88ef('0x8')](_0x88ef('0xe'),auth[_0x88ef('0x9')](),controller[_0x88ef('0xf')]);router[_0x88ef('0x10')]('/',auth['isAuthenticated'](),controller[_0x88ef('0x11')]);router[_0x88ef('0x12')]('/:id',auth[_0x88ef('0x9')](),controller[_0x88ef('0x13')]);router['delete'](_0x88ef('0x14'),auth['isAuthenticated'](),controller['destroy']);module[_0x88ef('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 7c53fbd..4e69fb0 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 _0x8255=['STRING','sequelize','exports'];(function(_0x451df9,_0x5e6047){var _0x59da59=function(_0x42bcd8){while(--_0x42bcd8){_0x451df9['push'](_0x451df9['shift']());}};_0x59da59(++_0x5e6047);}(_0x8255,0xa6));var _0x5825=function(_0x1c81da,_0x48a91c){_0x1c81da=_0x1c81da-0x0;var _0x5ee760=_0x8255[_0x1c81da];return _0x5ee760;};'use strict';var Sequelize=require(_0x5825('0x0'));module[_0x5825('0x1')]={'name':{'type':Sequelize[_0x5825('0x2')]},'description':{'type':Sequelize[_0x5825('0x2')]}}; \ No newline at end of file +var _0x0694=['STRING','exports'];(function(_0x33f895,_0x113818){var _0xb04d84=function(_0x4a8ff9){while(--_0x4a8ff9){_0x33f895['push'](_0x33f895['shift']());}};_0xb04d84(++_0x113818);}(_0x0694,0xf3));var _0x4069=function(_0x581af1,_0x4f02c5){_0x581af1=_0x581af1-0x0;var _0x54c22e=_0x0694[_0x581af1];return _0x54c22e;};'use strict';var Sequelize=require('sequelize');module[_0x4069('0x0')]={'name':{'type':Sequelize[_0x4069('0x1')]},'description':{'type':Sequelize[_0x4069('0x1')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index b6fe5c4..b868bfd 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 _0x4a64=['FreshsalesField','getDescriptions','order','nolimit','getFields','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','offset','limit','count','set','json','apply','reject','save','update','then','destroy','error','name','send','index','FreshsalesConfiguration','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','options','includeAll','include','catch','show','params','intersection','find','create','body','getSubjects','findOne'];(function(_0x403f85,_0x15fc9a){var _0x3a1029=function(_0x17e453){while(--_0x17e453){_0x403f85['push'](_0x403f85['shift']());}};_0x3a1029(++_0x15fc9a);}(_0x4a64,0x1cd));var _0x44a6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4a64[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x44a6('0x0'));var zipdir=require(_0x44a6('0x1'));var jsonpatch=require(_0x44a6('0x2'));var rp=require('request-promise');var moment=require(_0x44a6('0x3'));var BPromise=require(_0x44a6('0x4'));var Mustache=require('mustache');var util=require(_0x44a6('0x5'));var path=require(_0x44a6('0x6'));var sox=require(_0x44a6('0x7'));var csv=require(_0x44a6('0x8'));var ejs=require(_0x44a6('0x9'));var fs=require('fs');var fs_extra=require(_0x44a6('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x44a6('0xb'));var jsforce=require(_0x44a6('0xc'));var deskjs=require(_0x44a6('0xd'));var toCsv=require(_0x44a6('0x8'));var querystring=require(_0x44a6('0xe'));var Papa=require('papaparse');var Redis=require(_0x44a6('0xf'));var authService=require(_0x44a6('0x10'));var qs=require(_0x44a6('0x11'));var as=require(_0x44a6('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x44a6('0x13'));var utils=require(_0x44a6('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x44a6('0x15'));var db=require(_0x44a6('0x16'))['db'];function respondWithStatusCode(_0x38ff12,_0x52fd53){_0x52fd53=_0x52fd53||0xcc;return function(_0x500893){if(_0x500893){return _0x38ff12[_0x44a6('0x17')](_0x52fd53);}return _0x38ff12[_0x44a6('0x18')](_0x52fd53)['end']();};}function respondWithResult(_0x5740d0,_0x111727){_0x111727=_0x111727||0xc8;return function(_0x28f41e){if(_0x28f41e){return _0x5740d0['status'](_0x111727)['json'](_0x28f41e);}};}function respondWithFilteredResult(_0x40a4d6,_0x2eee65){return function(_0x43eca5){if(_0x43eca5){var _0x4b1547=typeof _0x2eee65[_0x44a6('0x19')]==='undefined'&&typeof _0x2eee65[_0x44a6('0x1a')]==='undefined';var _0x3e8072=_0x43eca5[_0x44a6('0x1b')];var _0x33ce02=_0x4b1547?0x0:_0x2eee65[_0x44a6('0x19')];var _0x3f445c=_0x4b1547?_0x43eca5[_0x44a6('0x1b')]:_0x2eee65['offset']+_0x2eee65[_0x44a6('0x1a')];var _0x437cdb;if(_0x3f445c>=_0x3e8072){_0x3f445c=_0x3e8072;_0x437cdb=0xc8;}else{_0x437cdb=0xce;}_0x40a4d6[_0x44a6('0x18')](_0x437cdb);return _0x40a4d6[_0x44a6('0x1c')]('Content-Range',_0x33ce02+'-'+_0x3f445c+'/'+_0x3e8072)[_0x44a6('0x1d')](_0x43eca5);}return null;};}function patchUpdates(_0x51c23f){return function(_0x95a669){try{jsonpatch[_0x44a6('0x1e')](_0x95a669,_0x51c23f,!![]);}catch(_0x6d3af9){return BPromise[_0x44a6('0x1f')](_0x6d3af9);}return _0x95a669[_0x44a6('0x20')]();};}function saveUpdates(_0x563f1a,_0x55657b){return function(_0x1e6e86){if(_0x1e6e86){return _0x1e6e86[_0x44a6('0x21')](_0x563f1a)[_0x44a6('0x22')](function(_0x39f154){return _0x39f154;});}return null;};}function removeEntity(_0x273aa8,_0x2866b2){return function(_0x2a8610){if(_0x2a8610){return _0x2a8610[_0x44a6('0x23')]()[_0x44a6('0x22')](function(){_0x273aa8['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xfbe02d,_0x31c473){return function(_0x13f690){if(!_0x13f690){_0xfbe02d[_0x44a6('0x17')](0x194);}return _0x13f690;};}function handleError(_0x1ee7f8,_0x182077){_0x182077=_0x182077||0x1f4;return function(_0x3af428){logger[_0x44a6('0x24')](_0x3af428['stack']);if(_0x3af428[_0x44a6('0x25')]){delete _0x3af428[_0x44a6('0x25')];}_0x1ee7f8[_0x44a6('0x18')](_0x182077)[_0x44a6('0x26')](_0x3af428);};}exports[_0x44a6('0x27')]=function(_0xe398bd,_0x55745c){var _0x704d08={},_0x3e8bbe={},_0x57815d={'count':0x0,'rows':[]};var _0x19e570=_['map'](db[_0x44a6('0x28')][_0x44a6('0x29')],function(_0x3d5ce8){return{'name':_0x3d5ce8[_0x44a6('0x2a')],'type':_0x3d5ce8[_0x44a6('0x2b')][_0x44a6('0x2c')]};});_0x3e8bbe[_0x44a6('0x2d')]=_[_0x44a6('0x2e')](_0x19e570,'name');_0x3e8bbe[_0x44a6('0x2f')]=_[_0x44a6('0x30')](_0xe398bd[_0x44a6('0x2f')]);_0x3e8bbe[_0x44a6('0x31')]=_['intersection'](_0x3e8bbe[_0x44a6('0x2d')],_0x3e8bbe[_0x44a6('0x2f')]);_0x704d08[_0x44a6('0x32')]=_['intersection'](_0x3e8bbe[_0x44a6('0x2d')],qs[_0x44a6('0x33')](_0xe398bd[_0x44a6('0x2f')]['fields']));_0x704d08[_0x44a6('0x32')]=_0x704d08[_0x44a6('0x32')][_0x44a6('0x34')]?_0x704d08[_0x44a6('0x32')]:_0x3e8bbe[_0x44a6('0x2d')];if(!_0xe398bd[_0x44a6('0x2f')][_0x44a6('0x35')]('nolimit')){_0x704d08['limit']=qs[_0x44a6('0x1a')](_0xe398bd[_0x44a6('0x2f')][_0x44a6('0x1a')]);_0x704d08[_0x44a6('0x19')]=qs[_0x44a6('0x19')](_0xe398bd['query']['offset']);}_0x704d08['order']=qs['sort'](_0xe398bd[_0x44a6('0x2f')][_0x44a6('0x36')]);_0x704d08[_0x44a6('0x37')]=qs[_0x44a6('0x31')](_[_0x44a6('0x38')](_0xe398bd[_0x44a6('0x2f')],_0x3e8bbe[_0x44a6('0x31')]),_0x19e570);if(_0xe398bd[_0x44a6('0x2f')][_0x44a6('0x39')]){_0x704d08[_0x44a6('0x37')]=_[_0x44a6('0x3a')](_0x704d08[_0x44a6('0x37')],{'$or':_[_0x44a6('0x2e')](_0x19e570,function(_0x2d5526){if(_0x2d5526[_0x44a6('0x2b')]!=='VIRTUAL'){var _0x2e7dd2={};_0x2e7dd2[_0x2d5526[_0x44a6('0x25')]]={'$like':'%'+_0xe398bd[_0x44a6('0x2f')][_0x44a6('0x39')]+'%'};return _0x2e7dd2;}})});}_0x704d08=_[_0x44a6('0x3a')]({},_0x704d08,_0xe398bd[_0x44a6('0x3b')]);var _0x54e96b={'where':_0x704d08[_0x44a6('0x37')]};return db[_0x44a6('0x28')][_0x44a6('0x1b')](_0x54e96b)['then'](function(_0x2780ae){_0x57815d[_0x44a6('0x1b')]=_0x2780ae;if(_0xe398bd[_0x44a6('0x2f')][_0x44a6('0x3c')]){_0x704d08[_0x44a6('0x3d')]=[{'all':!![]}];}return db[_0x44a6('0x28')]['findAll'](_0x704d08);})[_0x44a6('0x22')](function(_0x1d2154){_0x57815d['rows']=_0x1d2154;return _0x57815d;})['then'](respondWithFilteredResult(_0x55745c,_0x704d08))[_0x44a6('0x3e')](handleError(_0x55745c,null));};exports[_0x44a6('0x3f')]=function(_0x2d17e6,_0x21a3ad){var _0x4c86da={'raw':![],'where':{'id':_0x2d17e6[_0x44a6('0x40')]['id']}},_0x3eff91={};_0x3eff91[_0x44a6('0x2d')]=_[_0x44a6('0x30')](db[_0x44a6('0x28')]['rawAttributes']);_0x3eff91['query']=_[_0x44a6('0x30')](_0x2d17e6[_0x44a6('0x2f')]);_0x3eff91['filters']=_[_0x44a6('0x41')](_0x3eff91[_0x44a6('0x2d')],_0x3eff91[_0x44a6('0x2f')]);_0x4c86da[_0x44a6('0x32')]=_[_0x44a6('0x41')](_0x3eff91[_0x44a6('0x2d')],qs[_0x44a6('0x33')](_0x2d17e6[_0x44a6('0x2f')][_0x44a6('0x33')]));_0x4c86da[_0x44a6('0x32')]=_0x4c86da[_0x44a6('0x32')][_0x44a6('0x34')]?_0x4c86da[_0x44a6('0x32')]:_0x3eff91['model'];if(_0x2d17e6[_0x44a6('0x2f')][_0x44a6('0x3c')]){_0x4c86da[_0x44a6('0x3d')]=[{'all':!![]}];}_0x4c86da=_['merge']({},_0x4c86da,_0x2d17e6['options']);return db[_0x44a6('0x28')][_0x44a6('0x42')](_0x4c86da)[_0x44a6('0x22')](handleEntityNotFound(_0x21a3ad,null))[_0x44a6('0x22')](respondWithResult(_0x21a3ad,null))[_0x44a6('0x3e')](handleError(_0x21a3ad,null));};exports[_0x44a6('0x43')]=function(_0x1c9f13,_0x3207f2){return db[_0x44a6('0x28')]['create'](_0x1c9f13[_0x44a6('0x44')],{})[_0x44a6('0x22')](respondWithResult(_0x3207f2,0xc9))[_0x44a6('0x3e')](handleError(_0x3207f2,null));};exports['update']=function(_0x89292f,_0x22296c){if(_0x89292f[_0x44a6('0x44')]['id']){delete _0x89292f['body']['id'];}return db['FreshsalesConfiguration'][_0x44a6('0x42')]({'where':{'id':_0x89292f[_0x44a6('0x40')]['id']}})[_0x44a6('0x22')](handleEntityNotFound(_0x22296c,null))[_0x44a6('0x22')](saveUpdates(_0x89292f[_0x44a6('0x44')],null))[_0x44a6('0x22')](respondWithResult(_0x22296c,null))[_0x44a6('0x3e')](handleError(_0x22296c,null));};exports['destroy']=function(_0x12960d,_0x34da81){return db['FreshsalesConfiguration'][_0x44a6('0x42')]({'where':{'id':_0x12960d[_0x44a6('0x40')]['id']}})['then'](handleEntityNotFound(_0x34da81,null))[_0x44a6('0x22')](removeEntity(_0x34da81,null))[_0x44a6('0x3e')](handleError(_0x34da81,null));};exports[_0x44a6('0x45')]=function(_0xa8fd48,_0x4b6074,_0x18144b){var _0x32014e={};var _0x444b2f={};var _0x3ae94d;var _0x3526cd;return db[_0x44a6('0x28')][_0x44a6('0x46')]({'where':{'id':_0xa8fd48['params']['id']}})[_0x44a6('0x22')](handleEntityNotFound(_0x4b6074,null))['then'](function(_0x5e393e){if(_0x5e393e){_0x3ae94d=_0x5e393e;_0x444b2f[_0x44a6('0x2d')]=_[_0x44a6('0x30')](db[_0x44a6('0x47')][_0x44a6('0x29')]);_0x444b2f[_0x44a6('0x2f')]=_['keys'](_0xa8fd48[_0x44a6('0x2f')]);_0x444b2f[_0x44a6('0x31')]=_[_0x44a6('0x41')](_0x444b2f[_0x44a6('0x2d')],_0x444b2f[_0x44a6('0x2f')]);_0x32014e[_0x44a6('0x32')]=_[_0x44a6('0x41')](_0x444b2f[_0x44a6('0x2d')],qs['fields'](_0xa8fd48[_0x44a6('0x2f')][_0x44a6('0x33')]));_0x32014e['attributes']=_0x32014e[_0x44a6('0x32')][_0x44a6('0x34')]?_0x32014e[_0x44a6('0x32')]:_0x444b2f['model'];_0x32014e['order']=qs[_0x44a6('0x36')](_0xa8fd48['query'][_0x44a6('0x36')]);_0x32014e[_0x44a6('0x37')]=qs['filters'](_[_0x44a6('0x38')](_0xa8fd48[_0x44a6('0x2f')],_0x444b2f[_0x44a6('0x31')]));if(_0xa8fd48[_0x44a6('0x2f')]['filter']){_0x32014e[_0x44a6('0x37')]=_[_0x44a6('0x3a')](_0x32014e[_0x44a6('0x37')],{'$or':_[_0x44a6('0x2e')](_0x32014e['attributes'],function(_0x5a7340){var _0x444f74={};_0x444f74[_0x5a7340]={'$like':'%'+_0xa8fd48['query']['filter']+'%'};return _0x444f74;})});}_0x32014e=_[_0x44a6('0x3a')]({},_0x32014e,_0xa8fd48[_0x44a6('0x3b')]);return _0x3ae94d[_0x44a6('0x45')](_0x32014e);}})[_0x44a6('0x22')](function(_0x5a99d4){if(_0x5a99d4){_0x3526cd=_0x5a99d4[_0x44a6('0x34')];if(!_0xa8fd48[_0x44a6('0x2f')][_0x44a6('0x35')]('nolimit')){_0x32014e[_0x44a6('0x1a')]=qs[_0x44a6('0x1a')](_0xa8fd48[_0x44a6('0x2f')]['limit']);_0x32014e[_0x44a6('0x19')]=qs[_0x44a6('0x19')](_0xa8fd48['query'][_0x44a6('0x19')]);}return _0x3ae94d['getSubjects'](_0x32014e);}})['then'](function(_0xbd43a9){if(_0xbd43a9){return _0xbd43a9?{'count':_0x3526cd,'rows':_0xbd43a9}:null;}})[_0x44a6('0x22')](respondWithResult(_0x4b6074,null))[_0x44a6('0x3e')](handleError(_0x4b6074,null));};exports[_0x44a6('0x48')]=function(_0x57abf4,_0xdcd509,_0x32f2b2){var _0x146018={};var _0x7675a3={};var _0x5323d4;var _0x435188;return db[_0x44a6('0x28')][_0x44a6('0x46')]({'where':{'id':_0x57abf4[_0x44a6('0x40')]['id']}})[_0x44a6('0x22')](handleEntityNotFound(_0xdcd509,null))[_0x44a6('0x22')](function(_0x5b8a31){if(_0x5b8a31){_0x5323d4=_0x5b8a31;_0x7675a3['model']=_[_0x44a6('0x30')](db[_0x44a6('0x47')][_0x44a6('0x29')]);_0x7675a3[_0x44a6('0x2f')]=_[_0x44a6('0x30')](_0x57abf4[_0x44a6('0x2f')]);_0x7675a3[_0x44a6('0x31')]=_[_0x44a6('0x41')](_0x7675a3['model'],_0x7675a3['query']);_0x146018[_0x44a6('0x32')]=_[_0x44a6('0x41')](_0x7675a3[_0x44a6('0x2d')],qs[_0x44a6('0x33')](_0x57abf4[_0x44a6('0x2f')]['fields']));_0x146018[_0x44a6('0x32')]=_0x146018[_0x44a6('0x32')]['length']?_0x146018['attributes']:_0x7675a3['model'];_0x146018[_0x44a6('0x49')]=qs[_0x44a6('0x36')](_0x57abf4[_0x44a6('0x2f')][_0x44a6('0x36')]);_0x146018[_0x44a6('0x37')]=qs[_0x44a6('0x31')](_[_0x44a6('0x38')](_0x57abf4[_0x44a6('0x2f')],_0x7675a3[_0x44a6('0x31')]));if(_0x57abf4['query'][_0x44a6('0x39')]){_0x146018[_0x44a6('0x37')]=_[_0x44a6('0x3a')](_0x146018[_0x44a6('0x37')],{'$or':_['map'](_0x146018['attributes'],function(_0x1539e3){var _0x1c440a={};_0x1c440a[_0x1539e3]={'$like':'%'+_0x57abf4[_0x44a6('0x2f')]['filter']+'%'};return _0x1c440a;})});}_0x146018=_[_0x44a6('0x3a')]({},_0x146018,_0x57abf4[_0x44a6('0x3b')]);return _0x5323d4[_0x44a6('0x48')](_0x146018);}})['then'](function(_0x659ac6){if(_0x659ac6){_0x435188=_0x659ac6[_0x44a6('0x34')];if(!_0x57abf4[_0x44a6('0x2f')]['hasOwnProperty'](_0x44a6('0x4a'))){_0x146018[_0x44a6('0x1a')]=qs[_0x44a6('0x1a')](_0x57abf4[_0x44a6('0x2f')][_0x44a6('0x1a')]);_0x146018['offset']=qs[_0x44a6('0x19')](_0x57abf4['query'][_0x44a6('0x19')]);}return _0x5323d4[_0x44a6('0x48')](_0x146018);}})[_0x44a6('0x22')](function(_0xba0f4c){if(_0xba0f4c){return _0xba0f4c?{'count':_0x435188,'rows':_0xba0f4c}:null;}})[_0x44a6('0x22')](respondWithResult(_0xdcd509,null))[_0x44a6('0x3e')](handleError(_0xdcd509,null));};exports[_0x44a6('0x4b')]=function(_0x52653a,_0xc068c3,_0x2153c4){var _0x5e3451={};var _0x4097cf={};var _0x547842;var _0xb4749d;return db[_0x44a6('0x28')]['findOne']({'where':{'id':_0x52653a[_0x44a6('0x40')]['id']}})[_0x44a6('0x22')](handleEntityNotFound(_0xc068c3,null))[_0x44a6('0x22')](function(_0x2f35c4){if(_0x2f35c4){_0x547842=_0x2f35c4;_0x4097cf[_0x44a6('0x2d')]=_['keys'](db[_0x44a6('0x47')][_0x44a6('0x29')]);_0x4097cf[_0x44a6('0x2f')]=_[_0x44a6('0x30')](_0x52653a['query']);_0x4097cf['filters']=_[_0x44a6('0x41')](_0x4097cf[_0x44a6('0x2d')],_0x4097cf[_0x44a6('0x2f')]);_0x5e3451[_0x44a6('0x32')]=_[_0x44a6('0x41')](_0x4097cf[_0x44a6('0x2d')],qs[_0x44a6('0x33')](_0x52653a[_0x44a6('0x2f')][_0x44a6('0x33')]));_0x5e3451[_0x44a6('0x32')]=_0x5e3451[_0x44a6('0x32')][_0x44a6('0x34')]?_0x5e3451[_0x44a6('0x32')]:_0x4097cf[_0x44a6('0x2d')];_0x5e3451[_0x44a6('0x49')]=qs[_0x44a6('0x36')](_0x52653a[_0x44a6('0x2f')][_0x44a6('0x36')]);_0x5e3451['where']=qs[_0x44a6('0x31')](_[_0x44a6('0x38')](_0x52653a[_0x44a6('0x2f')],_0x4097cf['filters']));if(_0x52653a[_0x44a6('0x2f')]['filter']){_0x5e3451[_0x44a6('0x37')]=_[_0x44a6('0x3a')](_0x5e3451[_0x44a6('0x37')],{'$or':_[_0x44a6('0x2e')](_0x5e3451[_0x44a6('0x32')],function(_0x23a655){var _0x488c1d={};_0x488c1d[_0x23a655]={'$like':'%'+_0x52653a[_0x44a6('0x2f')][_0x44a6('0x39')]+'%'};return _0x488c1d;})});}_0x5e3451=_[_0x44a6('0x3a')]({},_0x5e3451,_0x52653a[_0x44a6('0x3b')]);return _0x547842[_0x44a6('0x4b')](_0x5e3451);}})[_0x44a6('0x22')](function(_0x5bf819){if(_0x5bf819){_0xb4749d=_0x5bf819['length'];if(!_0x52653a[_0x44a6('0x2f')][_0x44a6('0x35')](_0x44a6('0x4a'))){_0x5e3451[_0x44a6('0x1a')]=qs[_0x44a6('0x1a')](_0x52653a[_0x44a6('0x2f')][_0x44a6('0x1a')]);_0x5e3451[_0x44a6('0x19')]=qs[_0x44a6('0x19')](_0x52653a[_0x44a6('0x2f')]['offset']);}return _0x547842['getFields'](_0x5e3451);}})[_0x44a6('0x22')](function(_0x36543c){if(_0x36543c){return _0x36543c?{'count':_0xb4749d,'rows':_0x36543c}:null;}})[_0x44a6('0x22')](respondWithResult(_0xc068c3,null))[_0x44a6('0x3e')](handleError(_0xc068c3,null));}; \ No newline at end of file +var _0xe33f=['fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','name','send','map','FreshsalesConfiguration','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','rows','catch','show','find','create','body','params','getSubjects','FreshsalesField','options','getDescriptions','findOne','getFields','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','sox','to-csv','ejs'];(function(_0x4975f8,_0x3a226c){var _0x86d59f=function(_0x17a8d4){while(--_0x17a8d4){_0x4975f8['push'](_0x4975f8['shift']());}};_0x86d59f(++_0x3a226c);}(_0xe33f,0x1c5));var _0xfe33=function(_0x299829,_0x2557cc){_0x299829=_0x299829-0x0;var _0x3aed38=_0xe33f[_0x299829];return _0x3aed38;};'use strict';var emlformat=require(_0xfe33('0x0'));var rimraf=require(_0xfe33('0x1'));var zipdir=require(_0xfe33('0x2'));var jsonpatch=require(_0xfe33('0x3'));var rp=require(_0xfe33('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xfe33('0x5'));var path=require('path');var sox=require(_0xfe33('0x6'));var csv=require(_0xfe33('0x7'));var ejs=require(_0xfe33('0x8'));var fs=require('fs');var fs_extra=require(_0xfe33('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xfe33('0xa'));var jsforce=require(_0xfe33('0xb'));var deskjs=require(_0xfe33('0xc'));var toCsv=require('to-csv');var querystring=require(_0xfe33('0xd'));var Papa=require(_0xfe33('0xe'));var Redis=require(_0xfe33('0xf'));var authService=require(_0xfe33('0x10'));var qs=require(_0xfe33('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xfe33('0x12'))('api');var utils=require(_0xfe33('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xfe33('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4a505a,_0x47a630){_0x47a630=_0x47a630||0xcc;return function(_0x3811b5){if(_0x3811b5){return _0x4a505a[_0xfe33('0x15')](_0x47a630);}return _0x4a505a[_0xfe33('0x16')](_0x47a630)[_0xfe33('0x17')]();};}function respondWithResult(_0x3f6ae0,_0x8dccfe){_0x8dccfe=_0x8dccfe||0xc8;return function(_0x25a479){if(_0x25a479){return _0x3f6ae0['status'](_0x8dccfe)[_0xfe33('0x18')](_0x25a479);}};}function respondWithFilteredResult(_0x16f679,_0x11aecb){return function(_0xe89c4){if(_0xe89c4){var _0x4c902d=typeof _0x11aecb[_0xfe33('0x19')]==='undefined'&&typeof _0x11aecb['limit']===_0xfe33('0x1a');var _0x3b47f1=_0xe89c4[_0xfe33('0x1b')];var _0x171d12=_0x4c902d?0x0:_0x11aecb['offset'];var _0x49cbb8=_0x4c902d?_0xe89c4[_0xfe33('0x1b')]:_0x11aecb[_0xfe33('0x19')]+_0x11aecb[_0xfe33('0x1c')];var _0x12c816;if(_0x49cbb8>=_0x3b47f1){_0x49cbb8=_0x3b47f1;_0x12c816=0xc8;}else{_0x12c816=0xce;}_0x16f679[_0xfe33('0x16')](_0x12c816);return _0x16f679[_0xfe33('0x1d')](_0xfe33('0x1e'),_0x171d12+'-'+_0x49cbb8+'/'+_0x3b47f1)[_0xfe33('0x18')](_0xe89c4);}return null;};}function patchUpdates(_0x2f1979){return function(_0x736706){try{jsonpatch['apply'](_0x736706,_0x2f1979,!![]);}catch(_0x6f251b){return BPromise[_0xfe33('0x1f')](_0x6f251b);}return _0x736706[_0xfe33('0x20')]();};}function saveUpdates(_0xef1eee,_0x576651){return function(_0x2328ff){if(_0x2328ff){return _0x2328ff[_0xfe33('0x21')](_0xef1eee)[_0xfe33('0x22')](function(_0x3683f6){return _0x3683f6;});}return null;};}function removeEntity(_0x2140bd,_0x5c7d9d){return function(_0xb4cb68){if(_0xb4cb68){return _0xb4cb68[_0xfe33('0x23')]()[_0xfe33('0x22')](function(){_0x2140bd['status'](0xcc)[_0xfe33('0x17')]();});}};}function handleEntityNotFound(_0x512b2c,_0x12fe92){return function(_0x227f6e){if(!_0x227f6e){_0x512b2c[_0xfe33('0x15')](0x194);}return _0x227f6e;};}function handleError(_0x1f83aa,_0x477283){_0x477283=_0x477283||0x1f4;return function(_0x2053ee){logger[_0xfe33('0x24')](_0x2053ee['stack']);if(_0x2053ee[_0xfe33('0x25')]){delete _0x2053ee['name'];}_0x1f83aa['status'](_0x477283)[_0xfe33('0x26')](_0x2053ee);};}exports['index']=function(_0xe9f130,_0x52e2a7){var _0x3bd320={},_0x2d3a78={},_0x16aa0c={'count':0x0,'rows':[]};var _0x3f07ea=_[_0xfe33('0x27')](db[_0xfe33('0x28')][_0xfe33('0x29')],function(_0x33b35b){return{'name':_0x33b35b[_0xfe33('0x2a')],'type':_0x33b35b[_0xfe33('0x2b')][_0xfe33('0x2c')]};});_0x2d3a78['model']=_[_0xfe33('0x27')](_0x3f07ea,_0xfe33('0x25'));_0x2d3a78['query']=_[_0xfe33('0x2d')](_0xe9f130[_0xfe33('0x2e')]);_0x2d3a78[_0xfe33('0x2f')]=_[_0xfe33('0x30')](_0x2d3a78[_0xfe33('0x31')],_0x2d3a78['query']);_0x3bd320[_0xfe33('0x32')]=_[_0xfe33('0x30')](_0x2d3a78[_0xfe33('0x31')],qs['fields'](_0xe9f130[_0xfe33('0x2e')][_0xfe33('0x33')]));_0x3bd320[_0xfe33('0x32')]=_0x3bd320[_0xfe33('0x32')][_0xfe33('0x34')]?_0x3bd320[_0xfe33('0x32')]:_0x2d3a78[_0xfe33('0x31')];if(!_0xe9f130['query'][_0xfe33('0x35')](_0xfe33('0x36'))){_0x3bd320[_0xfe33('0x1c')]=qs['limit'](_0xe9f130[_0xfe33('0x2e')][_0xfe33('0x1c')]);_0x3bd320[_0xfe33('0x19')]=qs['offset'](_0xe9f130[_0xfe33('0x2e')]['offset']);}_0x3bd320[_0xfe33('0x37')]=qs[_0xfe33('0x38')](_0xe9f130['query'][_0xfe33('0x38')]);_0x3bd320[_0xfe33('0x39')]=qs[_0xfe33('0x2f')](_[_0xfe33('0x3a')](_0xe9f130[_0xfe33('0x2e')],_0x2d3a78[_0xfe33('0x2f')]),_0x3f07ea);if(_0xe9f130['query'][_0xfe33('0x3b')]){_0x3bd320[_0xfe33('0x39')]=_[_0xfe33('0x3c')](_0x3bd320[_0xfe33('0x39')],{'$or':_['map'](_0x3f07ea,function(_0x574c73){if(_0x574c73[_0xfe33('0x2b')]!==_0xfe33('0x3d')){var _0x5ab1a0={};_0x5ab1a0[_0x574c73[_0xfe33('0x25')]]={'$like':'%'+_0xe9f130[_0xfe33('0x2e')][_0xfe33('0x3b')]+'%'};return _0x5ab1a0;}})});}_0x3bd320=_['merge']({},_0x3bd320,_0xe9f130['options']);var _0x47d9f5={'where':_0x3bd320[_0xfe33('0x39')]};return db[_0xfe33('0x28')][_0xfe33('0x1b')](_0x47d9f5)[_0xfe33('0x22')](function(_0x5316b0){_0x16aa0c[_0xfe33('0x1b')]=_0x5316b0;if(_0xe9f130['query'][_0xfe33('0x3e')]){_0x3bd320[_0xfe33('0x3f')]=[{'all':!![]}];}return db[_0xfe33('0x28')]['findAll'](_0x3bd320);})['then'](function(_0x218afe){_0x16aa0c[_0xfe33('0x40')]=_0x218afe;return _0x16aa0c;})[_0xfe33('0x22')](respondWithFilteredResult(_0x52e2a7,_0x3bd320))[_0xfe33('0x41')](handleError(_0x52e2a7,null));};exports[_0xfe33('0x42')]=function(_0x20924f,_0x4c6907){var _0x2f2aa1={'raw':![],'where':{'id':_0x20924f['params']['id']}},_0x5e941={};_0x5e941[_0xfe33('0x31')]=_[_0xfe33('0x2d')](db[_0xfe33('0x28')][_0xfe33('0x29')]);_0x5e941[_0xfe33('0x2e')]=_[_0xfe33('0x2d')](_0x20924f[_0xfe33('0x2e')]);_0x5e941[_0xfe33('0x2f')]=_[_0xfe33('0x30')](_0x5e941[_0xfe33('0x31')],_0x5e941[_0xfe33('0x2e')]);_0x2f2aa1['attributes']=_[_0xfe33('0x30')](_0x5e941[_0xfe33('0x31')],qs[_0xfe33('0x33')](_0x20924f[_0xfe33('0x2e')][_0xfe33('0x33')]));_0x2f2aa1['attributes']=_0x2f2aa1[_0xfe33('0x32')]['length']?_0x2f2aa1[_0xfe33('0x32')]:_0x5e941[_0xfe33('0x31')];if(_0x20924f['query']['includeAll']){_0x2f2aa1['include']=[{'all':!![]}];}_0x2f2aa1=_[_0xfe33('0x3c')]({},_0x2f2aa1,_0x20924f['options']);return db[_0xfe33('0x28')][_0xfe33('0x43')](_0x2f2aa1)[_0xfe33('0x22')](handleEntityNotFound(_0x4c6907,null))['then'](respondWithResult(_0x4c6907,null))['catch'](handleError(_0x4c6907,null));};exports['create']=function(_0x4cea0c,_0x46d6b6){return db[_0xfe33('0x28')][_0xfe33('0x44')](_0x4cea0c[_0xfe33('0x45')],{})[_0xfe33('0x22')](respondWithResult(_0x46d6b6,0xc9))[_0xfe33('0x41')](handleError(_0x46d6b6,null));};exports['update']=function(_0x105ffd,_0x1a0d66){if(_0x105ffd[_0xfe33('0x45')]['id']){delete _0x105ffd[_0xfe33('0x45')]['id'];}return db['FreshsalesConfiguration'][_0xfe33('0x43')]({'where':{'id':_0x105ffd[_0xfe33('0x46')]['id']}})['then'](handleEntityNotFound(_0x1a0d66,null))[_0xfe33('0x22')](saveUpdates(_0x105ffd[_0xfe33('0x45')],null))[_0xfe33('0x22')](respondWithResult(_0x1a0d66,null))['catch'](handleError(_0x1a0d66,null));};exports[_0xfe33('0x23')]=function(_0x4ecaf0,_0x448078){return db[_0xfe33('0x28')][_0xfe33('0x43')]({'where':{'id':_0x4ecaf0['params']['id']}})[_0xfe33('0x22')](handleEntityNotFound(_0x448078,null))[_0xfe33('0x22')](removeEntity(_0x448078,null))[_0xfe33('0x41')](handleError(_0x448078,null));};exports[_0xfe33('0x47')]=function(_0x2cb827,_0x35d9ba,_0x309a82){var _0xccac32={};var _0x18a5b8={};var _0x45e573;var _0x269188;return db[_0xfe33('0x28')]['findOne']({'where':{'id':_0x2cb827['params']['id']}})[_0xfe33('0x22')](handleEntityNotFound(_0x35d9ba,null))['then'](function(_0x230a57){if(_0x230a57){_0x45e573=_0x230a57;_0x18a5b8[_0xfe33('0x31')]=_[_0xfe33('0x2d')](db[_0xfe33('0x48')]['rawAttributes']);_0x18a5b8['query']=_[_0xfe33('0x2d')](_0x2cb827['query']);_0x18a5b8['filters']=_[_0xfe33('0x30')](_0x18a5b8['model'],_0x18a5b8[_0xfe33('0x2e')]);_0xccac32[_0xfe33('0x32')]=_[_0xfe33('0x30')](_0x18a5b8[_0xfe33('0x31')],qs[_0xfe33('0x33')](_0x2cb827[_0xfe33('0x2e')][_0xfe33('0x33')]));_0xccac32[_0xfe33('0x32')]=_0xccac32[_0xfe33('0x32')][_0xfe33('0x34')]?_0xccac32['attributes']:_0x18a5b8['model'];_0xccac32['order']=qs[_0xfe33('0x38')](_0x2cb827['query'][_0xfe33('0x38')]);_0xccac32['where']=qs[_0xfe33('0x2f')](_[_0xfe33('0x3a')](_0x2cb827[_0xfe33('0x2e')],_0x18a5b8['filters']));if(_0x2cb827[_0xfe33('0x2e')][_0xfe33('0x3b')]){_0xccac32['where']=_[_0xfe33('0x3c')](_0xccac32[_0xfe33('0x39')],{'$or':_['map'](_0xccac32[_0xfe33('0x32')],function(_0x5f58ca){var _0x3f1dc0={};_0x3f1dc0[_0x5f58ca]={'$like':'%'+_0x2cb827['query'][_0xfe33('0x3b')]+'%'};return _0x3f1dc0;})});}_0xccac32=_[_0xfe33('0x3c')]({},_0xccac32,_0x2cb827[_0xfe33('0x49')]);return _0x45e573[_0xfe33('0x47')](_0xccac32);}})[_0xfe33('0x22')](function(_0x35bd3a){if(_0x35bd3a){_0x269188=_0x35bd3a['length'];if(!_0x2cb827[_0xfe33('0x2e')]['hasOwnProperty'](_0xfe33('0x36'))){_0xccac32[_0xfe33('0x1c')]=qs[_0xfe33('0x1c')](_0x2cb827['query'][_0xfe33('0x1c')]);_0xccac32[_0xfe33('0x19')]=qs['offset'](_0x2cb827['query'][_0xfe33('0x19')]);}return _0x45e573['getSubjects'](_0xccac32);}})[_0xfe33('0x22')](function(_0x70fa39){if(_0x70fa39){return _0x70fa39?{'count':_0x269188,'rows':_0x70fa39}:null;}})[_0xfe33('0x22')](respondWithResult(_0x35d9ba,null))[_0xfe33('0x41')](handleError(_0x35d9ba,null));};exports[_0xfe33('0x4a')]=function(_0x50356b,_0x3d4137,_0x46e589){var _0x51297b={};var _0x26a6ec={};var _0x12cfb7;var _0x1fa1e6;return db[_0xfe33('0x28')][_0xfe33('0x4b')]({'where':{'id':_0x50356b['params']['id']}})[_0xfe33('0x22')](handleEntityNotFound(_0x3d4137,null))[_0xfe33('0x22')](function(_0x14f7f2){if(_0x14f7f2){_0x12cfb7=_0x14f7f2;_0x26a6ec[_0xfe33('0x31')]=_[_0xfe33('0x2d')](db[_0xfe33('0x48')][_0xfe33('0x29')]);_0x26a6ec[_0xfe33('0x2e')]=_[_0xfe33('0x2d')](_0x50356b['query']);_0x26a6ec[_0xfe33('0x2f')]=_[_0xfe33('0x30')](_0x26a6ec[_0xfe33('0x31')],_0x26a6ec[_0xfe33('0x2e')]);_0x51297b['attributes']=_['intersection'](_0x26a6ec[_0xfe33('0x31')],qs['fields'](_0x50356b[_0xfe33('0x2e')]['fields']));_0x51297b[_0xfe33('0x32')]=_0x51297b[_0xfe33('0x32')][_0xfe33('0x34')]?_0x51297b[_0xfe33('0x32')]:_0x26a6ec['model'];_0x51297b['order']=qs[_0xfe33('0x38')](_0x50356b['query'][_0xfe33('0x38')]);_0x51297b['where']=qs['filters'](_[_0xfe33('0x3a')](_0x50356b[_0xfe33('0x2e')],_0x26a6ec[_0xfe33('0x2f')]));if(_0x50356b['query'][_0xfe33('0x3b')]){_0x51297b[_0xfe33('0x39')]=_[_0xfe33('0x3c')](_0x51297b[_0xfe33('0x39')],{'$or':_[_0xfe33('0x27')](_0x51297b['attributes'],function(_0x473419){var _0x5c28ea={};_0x5c28ea[_0x473419]={'$like':'%'+_0x50356b['query'][_0xfe33('0x3b')]+'%'};return _0x5c28ea;})});}_0x51297b=_[_0xfe33('0x3c')]({},_0x51297b,_0x50356b[_0xfe33('0x49')]);return _0x12cfb7['getDescriptions'](_0x51297b);}})[_0xfe33('0x22')](function(_0x3d606f){if(_0x3d606f){_0x1fa1e6=_0x3d606f[_0xfe33('0x34')];if(!_0x50356b['query'][_0xfe33('0x35')](_0xfe33('0x36'))){_0x51297b[_0xfe33('0x1c')]=qs[_0xfe33('0x1c')](_0x50356b[_0xfe33('0x2e')][_0xfe33('0x1c')]);_0x51297b['offset']=qs[_0xfe33('0x19')](_0x50356b[_0xfe33('0x2e')][_0xfe33('0x19')]);}return _0x12cfb7[_0xfe33('0x4a')](_0x51297b);}})[_0xfe33('0x22')](function(_0x3667ac){if(_0x3667ac){return _0x3667ac?{'count':_0x1fa1e6,'rows':_0x3667ac}:null;}})[_0xfe33('0x22')](respondWithResult(_0x3d4137,null))[_0xfe33('0x41')](handleError(_0x3d4137,null));};exports[_0xfe33('0x4c')]=function(_0x17328c,_0x1ccd81,_0x5d0d49){var _0x4d71a6={};var _0x2c9053={};var _0x422471;var _0x1a6d65;return db[_0xfe33('0x28')][_0xfe33('0x4b')]({'where':{'id':_0x17328c[_0xfe33('0x46')]['id']}})[_0xfe33('0x22')](handleEntityNotFound(_0x1ccd81,null))[_0xfe33('0x22')](function(_0x5ed412){if(_0x5ed412){_0x422471=_0x5ed412;_0x2c9053['model']=_[_0xfe33('0x2d')](db['FreshsalesField'][_0xfe33('0x29')]);_0x2c9053[_0xfe33('0x2e')]=_[_0xfe33('0x2d')](_0x17328c['query']);_0x2c9053[_0xfe33('0x2f')]=_[_0xfe33('0x30')](_0x2c9053['model'],_0x2c9053[_0xfe33('0x2e')]);_0x4d71a6['attributes']=_[_0xfe33('0x30')](_0x2c9053[_0xfe33('0x31')],qs[_0xfe33('0x33')](_0x17328c[_0xfe33('0x2e')][_0xfe33('0x33')]));_0x4d71a6['attributes']=_0x4d71a6[_0xfe33('0x32')][_0xfe33('0x34')]?_0x4d71a6[_0xfe33('0x32')]:_0x2c9053[_0xfe33('0x31')];_0x4d71a6[_0xfe33('0x37')]=qs[_0xfe33('0x38')](_0x17328c[_0xfe33('0x2e')][_0xfe33('0x38')]);_0x4d71a6[_0xfe33('0x39')]=qs[_0xfe33('0x2f')](_[_0xfe33('0x3a')](_0x17328c[_0xfe33('0x2e')],_0x2c9053[_0xfe33('0x2f')]));if(_0x17328c[_0xfe33('0x2e')][_0xfe33('0x3b')]){_0x4d71a6[_0xfe33('0x39')]=_[_0xfe33('0x3c')](_0x4d71a6[_0xfe33('0x39')],{'$or':_[_0xfe33('0x27')](_0x4d71a6[_0xfe33('0x32')],function(_0x4c2578){var _0x2222c4={};_0x2222c4[_0x4c2578]={'$like':'%'+_0x17328c[_0xfe33('0x2e')][_0xfe33('0x3b')]+'%'};return _0x2222c4;})});}_0x4d71a6=_[_0xfe33('0x3c')]({},_0x4d71a6,_0x17328c[_0xfe33('0x49')]);return _0x422471[_0xfe33('0x4c')](_0x4d71a6);}})['then'](function(_0x2a6cef){if(_0x2a6cef){_0x1a6d65=_0x2a6cef[_0xfe33('0x34')];if(!_0x17328c[_0xfe33('0x2e')][_0xfe33('0x35')](_0xfe33('0x36'))){_0x4d71a6[_0xfe33('0x1c')]=qs[_0xfe33('0x1c')](_0x17328c['query'][_0xfe33('0x1c')]);_0x4d71a6[_0xfe33('0x19')]=qs[_0xfe33('0x19')](_0x17328c[_0xfe33('0x2e')][_0xfe33('0x19')]);}return _0x422471[_0xfe33('0x4c')](_0x4d71a6);}})[_0xfe33('0x22')](function(_0x4b5c10){if(_0x4b5c10){return _0x4b5c10?{'count':_0x1a6d65,'rows':_0x4b5c10}:null;}})[_0xfe33('0x22')](respondWithResult(_0x1ccd81,null))[_0xfe33('0x41')](handleError(_0x1ccd81,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index f217285..94e5c74 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 _0x63b5=['bluebird','rimraf','../../config/environment','./intFreshsalesConfiguration.attributes','exports','define','FreshsalesConfiguration','int_freshsales_configurations','lodash','util','../../config/logger'];(function(_0x324125,_0x3120aa){var _0x29faad=function(_0x23c367){while(--_0x23c367){_0x324125['push'](_0x324125['shift']());}};_0x29faad(++_0x3120aa);}(_0x63b5,0x17e));var _0x563b=function(_0x5bc323,_0x3706d4){_0x5bc323=_0x5bc323-0x0;var _0x52ac03=_0x63b5[_0x5bc323];return _0x52ac03;};'use strict';var _=require(_0x563b('0x0'));var util=require(_0x563b('0x1'));var logger=require(_0x563b('0x2'))('api');var moment=require('moment');var BPromise=require(_0x563b('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x563b('0x4'));var config=require(_0x563b('0x5'));var attributes=require(_0x563b('0x6'));module[_0x563b('0x7')]=function(_0x59cfc0,_0x38ce33){return _0x59cfc0[_0x563b('0x8')](_0x563b('0x9'),attributes,{'tableName':_0x563b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3d9a=['request-promise','rimraf','../../config/environment','./intFreshsalesConfiguration.attributes','define','FreshsalesConfiguration','int_freshsales_configurations','../../config/logger','api','moment'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x3d9a,0x183));var _0xa3d9=function(_0x5b88db,_0x15eae7){_0x5b88db=_0x5b88db-0x0;var _0x19d452=_0x3d9a[_0x5b88db];return _0x19d452;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xa3d9('0x0'))(_0xa3d9('0x1'));var moment=require(_0xa3d9('0x2'));var BPromise=require('bluebird');var rp=require(_0xa3d9('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa3d9('0x4'));var config=require(_0xa3d9('0x5'));var attributes=require(_0xa3d9('0x6'));module['exports']=function(_0x37fb0b,_0x13b29a){return _0x37fb0b[_0xa3d9('0x7')](_0xa3d9('0x8'),attributes,{'tableName':_0xa3d9('0x9'),'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 9ca97f3..ced7515 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 _0xecd9=['error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x4f1626,_0x298634){var _0x12f399=function(_0x11ab42){while(--_0x11ab42){_0x4f1626['push'](_0x4f1626['shift']());}};_0x12f399(++_0x298634);}(_0xecd9,0x73));var _0x9ecd=function(_0x347dfe,_0x205d95){_0x347dfe=_0x347dfe-0x0;var _0x415a90=_0xecd9[_0x347dfe];return _0x415a90;};'use strict';var _=require(_0x9ecd('0x0'));var util=require('util');var moment=require(_0x9ecd('0x1'));var BPromise=require(_0x9ecd('0x2'));var rs=require(_0x9ecd('0x3'));var fs=require('fs');var Redis=require(_0x9ecd('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x9ecd('0x5'));var logger=require(_0x9ecd('0x6'))('rpc');var config=require(_0x9ecd('0x7'));var jayson=require(_0x9ecd('0x8'));var client=jayson[_0x9ecd('0x9')][_0x9ecd('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x157743,_0x14a205,_0x21fdcb){return new BPromise(function(_0x36649b,_0x5b8d67){return client[_0x9ecd('0xb')](_0x157743,_0x21fdcb)[_0x9ecd('0xc')](function(_0x1c58a8){logger[_0x9ecd('0xd')](_0x9ecd('0xe'),_0x14a205,_0x9ecd('0xf'));logger['debug']('FreshsalesConfiguration,\x20%s,\x20%s,\x20%s',_0x14a205,_0x9ecd('0xf'),JSON[_0x9ecd('0x10')](_0x1c58a8));if(_0x1c58a8[_0x9ecd('0x11')]){if(_0x1c58a8[_0x9ecd('0x11')][_0x9ecd('0x12')]===0x1f4){logger[_0x9ecd('0x11')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x14a205,_0x1c58a8[_0x9ecd('0x11')][_0x9ecd('0x13')]);return _0x5b8d67(_0x1c58a8[_0x9ecd('0x11')][_0x9ecd('0x13')]);}logger[_0x9ecd('0x11')](_0x9ecd('0xe'),_0x14a205,_0x1c58a8[_0x9ecd('0x11')][_0x9ecd('0x13')]);return _0x36649b(_0x1c58a8[_0x9ecd('0x11')][_0x9ecd('0x13')]);}else{logger['info'](_0x9ecd('0xe'),_0x14a205,_0x9ecd('0xf'));_0x36649b(_0x1c58a8[_0x9ecd('0x14')][_0x9ecd('0x13')]);}})[_0x9ecd('0x15')](function(_0x117e2d){logger[_0x9ecd('0x11')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x14a205,_0x117e2d);_0x5b8d67(_0x117e2d);});});} \ No newline at end of file +var _0xbc07=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','request\x20sent','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','FreshsalesConfiguration,\x20%s,\x20%s','lodash','util','bluebird','randomstring','../../mysqldb'];(function(_0x1889d1,_0x5c56a6){var _0x2fa32e=function(_0x4c1e6e){while(--_0x4c1e6e){_0x1889d1['push'](_0x1889d1['shift']());}};_0x2fa32e(++_0x5c56a6);}(_0xbc07,0x13e));var _0x7bc0=function(_0x162db3,_0x3b9f8c){_0x162db3=_0x162db3-0x0;var _0xb0b2ba=_0xbc07[_0x162db3];return _0xb0b2ba;};'use strict';var _=require(_0x7bc0('0x0'));var util=require(_0x7bc0('0x1'));var moment=require('moment');var BPromise=require(_0x7bc0('0x2'));var rs=require(_0x7bc0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7bc0('0x4'))['db'];var utils=require(_0x7bc0('0x5'));var logger=require(_0x7bc0('0x6'))('rpc');var config=require(_0x7bc0('0x7'));var jayson=require(_0x7bc0('0x8'));var client=jayson[_0x7bc0('0x9')][_0x7bc0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1999d9,_0x4b8d17,_0x1567d1){return new BPromise(function(_0x952009,_0x53f24f){return client[_0x7bc0('0xb')](_0x1999d9,_0x1567d1)['then'](function(_0x501f9d){logger['info']('FreshsalesConfiguration,\x20%s,\x20%s',_0x4b8d17,_0x7bc0('0xc'));logger['debug'](_0x7bc0('0xd'),_0x4b8d17,_0x7bc0('0xc'),JSON[_0x7bc0('0xe')](_0x501f9d));if(_0x501f9d[_0x7bc0('0xf')]){if(_0x501f9d[_0x7bc0('0xf')][_0x7bc0('0x10')]===0x1f4){logger['error']('FreshsalesConfiguration,\x20%s,\x20%s',_0x4b8d17,_0x501f9d[_0x7bc0('0xf')][_0x7bc0('0x11')]);return _0x53f24f(_0x501f9d[_0x7bc0('0xf')][_0x7bc0('0x11')]);}logger['error'](_0x7bc0('0x12'),_0x4b8d17,_0x501f9d[_0x7bc0('0xf')][_0x7bc0('0x11')]);return _0x952009(_0x501f9d[_0x7bc0('0xf')]['message']);}else{logger['info']('FreshsalesConfiguration,\x20%s,\x20%s',_0x4b8d17,_0x7bc0('0xc'));_0x952009(_0x501f9d['result'][_0x7bc0('0x11')]);}})['catch'](function(_0x1788a4){logger[_0x7bc0('0xf')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x4b8d17,_0x1788a4);_0x53f24f(_0x1788a4);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index 9aecf69..489921d 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 _0x84ab=['connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./intFreshsalesField.controller','get','/:id','show','post','create','isAuthenticated','update','destroy','exports','multer','util','path'];(function(_0x4240c2,_0x44baff){var _0x163903=function(_0x4d1d78){while(--_0x4d1d78){_0x4240c2['push'](_0x4240c2['shift']());}};_0x163903(++_0x44baff);}(_0x84ab,0x12f));var _0xb84a=function(_0x26b80e,_0x5c9333){_0x26b80e=_0x26b80e-0x0;var _0x84a8a8=_0x84ab[_0x26b80e];return _0x84a8a8;};'use strict';var multer=require(_0xb84a('0x0'));var util=require(_0xb84a('0x1'));var path=require(_0xb84a('0x2'));var timeout=require(_0xb84a('0x3'));var express=require(_0xb84a('0x4'));var router=express['Router']();var fs_extra=require(_0xb84a('0x5'));var auth=require(_0xb84a('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xb84a('0x7'));var controller=require(_0xb84a('0x8'));router[_0xb84a('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xb84a('0xa'),auth['isAuthenticated'](),controller[_0xb84a('0xb')]);router[_0xb84a('0xc')]('/',auth['isAuthenticated'](),controller[_0xb84a('0xd')]);router['put'](_0xb84a('0xa'),auth[_0xb84a('0xe')](),controller[_0xb84a('0xf')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xb84a('0x10')]);module[_0xb84a('0x11')]=router; \ No newline at end of file +var _0x668b=['express','fs-extra','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','isAuthenticated','index','get','/:id','show','create','put','update','delete','destroy','exports','multer','util','connect-timeout'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x668b,0x140));var _0xb668=function(_0x1dfa63,_0x362bd4){_0x1dfa63=_0x1dfa63-0x0;var _0x26f2a9=_0x668b[_0x1dfa63];return _0x26f2a9;};'use strict';var multer=require(_0xb668('0x0'));var util=require(_0xb668('0x1'));var path=require('path');var timeout=require(_0xb668('0x2'));var express=require(_0xb668('0x3'));var router=express['Router']();var fs_extra=require(_0xb668('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xb668('0x5'));var config=require(_0xb668('0x6'));var controller=require(_0xb668('0x7'));router['get']('/',auth[_0xb668('0x8')](),controller[_0xb668('0x9')]);router[_0xb668('0xa')](_0xb668('0xb'),auth[_0xb668('0x8')](),controller[_0xb668('0xc')]);router['post']('/',auth[_0xb668('0x8')](),controller[_0xb668('0xd')]);router[_0xb668('0xe')](_0xb668('0xb'),auth[_0xb668('0x8')](),controller[_0xb668('0xf')]);router[_0xb668('0x10')](_0xb668('0xb'),auth['isAuthenticated'](),controller[_0xb668('0x11')]);module[_0xb668('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 f43a0a3..049bcb6 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 _0x30b1=['STRING','customVariable','BOOLEAN','sequelize','ENUM','string','variable','keyValue','picklist'];(function(_0x1f420c,_0x3f1d9f){var _0x40c9cb=function(_0x1ffcd8){while(--_0x1ffcd8){_0x1f420c['push'](_0x1f420c['shift']());}};_0x40c9cb(++_0x3f1d9f);}(_0x30b1,0x93));var _0x130b=function(_0x3d44b9,_0x3ce78d){_0x3d44b9=_0x3d44b9-0x0;var _0x24b26f=_0x30b1[_0x3d44b9];return _0x24b26f;};'use strict';var Sequelize=require(_0x130b('0x0'));module['exports']={'type':{'type':Sequelize[_0x130b('0x1')](_0x130b('0x2'),_0x130b('0x3'),'customVariable',_0x130b('0x4'),_0x130b('0x5')),'defaultValue':_0x130b('0x2')},'content':{'type':Sequelize[_0x130b('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x130b('0x1')]('string',_0x130b('0x3'),_0x130b('0x7'))},'keyContent':{'type':Sequelize[_0x130b('0x6')]},'idField':{'type':Sequelize[_0x130b('0x6')]},'nameField':{'type':Sequelize[_0x130b('0x6')]},'customField':{'type':Sequelize[_0x130b('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x130b('0x6')]}}; \ No newline at end of file +var _0x93d8=['variable','customVariable','picklist','STRING','ENUM','exports','string'];(function(_0x1bea66,_0x1e4f17){var _0x1fd4e1=function(_0xc2b7a3){while(--_0xc2b7a3){_0x1bea66['push'](_0x1bea66['shift']());}};_0x1fd4e1(++_0x1e4f17);}(_0x93d8,0x132));var _0x893d=function(_0x578717,_0x4ae20d){_0x578717=_0x578717-0x0;var _0x3c5074=_0x93d8[_0x578717];return _0x3c5074;};'use strict';var Sequelize=require('sequelize');module[_0x893d('0x0')]={'type':{'type':Sequelize['ENUM'](_0x893d('0x1'),_0x893d('0x2'),_0x893d('0x3'),'keyValue',_0x893d('0x4')),'defaultValue':'string'},'content':{'type':Sequelize[_0x893d('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x893d('0x6')](_0x893d('0x1'),_0x893d('0x2'),_0x893d('0x3'))},'keyContent':{'type':Sequelize[_0x893d('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x893d('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x893d('0x5')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index e7f326d..d0310ec 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 _0x7d03=['name','send','FreshsalesField','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','filter','options','then','includeAll','include','findAll','rows','catch','params','find','create','body','update','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','reject','save','sendStatus','stack'];(function(_0x459335,_0x2e95dd){var _0x50f00b=function(_0x5ccdaf){while(--_0x5ccdaf){_0x459335['push'](_0x459335['shift']());}};_0x50f00b(++_0x2e95dd);}(_0x7d03,0x195));var _0x37d0=function(_0x4fecdc,_0x1e0888){_0x4fecdc=_0x4fecdc-0x0;var _0x5cfa6e=_0x7d03[_0x4fecdc];return _0x5cfa6e;};'use strict';var emlformat=require(_0x37d0('0x0'));var rimraf=require(_0x37d0('0x1'));var zipdir=require(_0x37d0('0x2'));var jsonpatch=require(_0x37d0('0x3'));var rp=require('request-promise');var moment=require(_0x37d0('0x4'));var BPromise=require(_0x37d0('0x5'));var Mustache=require(_0x37d0('0x6'));var util=require(_0x37d0('0x7'));var path=require(_0x37d0('0x8'));var sox=require(_0x37d0('0x9'));var csv=require(_0x37d0('0xa'));var ejs=require(_0x37d0('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x37d0('0xc'));var squel=require(_0x37d0('0xd'));var crypto=require(_0x37d0('0xe'));var jsforce=require(_0x37d0('0xf'));var deskjs=require(_0x37d0('0x10'));var toCsv=require(_0x37d0('0xa'));var querystring=require(_0x37d0('0x11'));var Papa=require(_0x37d0('0x12'));var Redis=require(_0x37d0('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x37d0('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x37d0('0x15'));var logger=require(_0x37d0('0x16'))(_0x37d0('0x17'));var utils=require(_0x37d0('0x18'));var config=require(_0x37d0('0x19'));var licenseUtil=require(_0x37d0('0x1a'));var db=require(_0x37d0('0x1b'))['db'];function respondWithStatusCode(_0x38dc31,_0x4d17f8){_0x4d17f8=_0x4d17f8||0xcc;return function(_0x219834){if(_0x219834){return _0x38dc31['sendStatus'](_0x4d17f8);}return _0x38dc31[_0x37d0('0x1c')](_0x4d17f8)[_0x37d0('0x1d')]();};}function respondWithResult(_0x2b5f07,_0x11207d){_0x11207d=_0x11207d||0xc8;return function(_0x3ae7b8){if(_0x3ae7b8){return _0x2b5f07[_0x37d0('0x1c')](_0x11207d)[_0x37d0('0x1e')](_0x3ae7b8);}};}function respondWithFilteredResult(_0x188b6e,_0x23073f){return function(_0x1f49dc){if(_0x1f49dc){var _0x6ad015=typeof _0x23073f[_0x37d0('0x1f')]===_0x37d0('0x20')&&typeof _0x23073f[_0x37d0('0x21')]===_0x37d0('0x20');var _0x585137=_0x1f49dc[_0x37d0('0x22')];var _0x5debbc=_0x6ad015?0x0:_0x23073f[_0x37d0('0x1f')];var _0x55ee38=_0x6ad015?_0x1f49dc[_0x37d0('0x22')]:_0x23073f[_0x37d0('0x1f')]+_0x23073f[_0x37d0('0x21')];var _0x2f1db3;if(_0x55ee38>=_0x585137){_0x55ee38=_0x585137;_0x2f1db3=0xc8;}else{_0x2f1db3=0xce;}_0x188b6e[_0x37d0('0x1c')](_0x2f1db3);return _0x188b6e['set']('Content-Range',_0x5debbc+'-'+_0x55ee38+'/'+_0x585137)[_0x37d0('0x1e')](_0x1f49dc);}return null;};}function patchUpdates(_0x49d36e){return function(_0x45bb7d){try{jsonpatch['apply'](_0x45bb7d,_0x49d36e,!![]);}catch(_0x356083){return BPromise[_0x37d0('0x23')](_0x356083);}return _0x45bb7d[_0x37d0('0x24')]();};}function saveUpdates(_0x3e0b06,_0x268f6d){return function(_0x1d049){if(_0x1d049){return _0x1d049['update'](_0x3e0b06)['then'](function(_0x3bf707){return _0x3bf707;});}return null;};}function removeEntity(_0x28545d,_0x38b6b4){return function(_0x24b1af){if(_0x24b1af){return _0x24b1af['destroy']()['then'](function(){_0x28545d[_0x37d0('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x17c056,_0x289e23){return function(_0x3dbeea){if(!_0x3dbeea){_0x17c056[_0x37d0('0x25')](0x194);}return _0x3dbeea;};}function handleError(_0x2d2f4c,_0x2f4d15){_0x2f4d15=_0x2f4d15||0x1f4;return function(_0x3f2095){logger['error'](_0x3f2095[_0x37d0('0x26')]);if(_0x3f2095['name']){delete _0x3f2095[_0x37d0('0x27')];}_0x2d2f4c['status'](_0x2f4d15)[_0x37d0('0x28')](_0x3f2095);};}exports['index']=function(_0x29eb01,_0x1f4a7d){var _0x47206d={},_0x2d3819={},_0x3f9b68={'count':0x0,'rows':[]};var _0x1976d1=_['map'](db[_0x37d0('0x29')][_0x37d0('0x2a')],function(_0x1d0628){return{'name':_0x1d0628[_0x37d0('0x2b')],'type':_0x1d0628[_0x37d0('0x2c')][_0x37d0('0x2d')]};});_0x2d3819[_0x37d0('0x2e')]=_[_0x37d0('0x2f')](_0x1976d1,_0x37d0('0x27'));_0x2d3819[_0x37d0('0x30')]=_[_0x37d0('0x31')](_0x29eb01['query']);_0x2d3819[_0x37d0('0x32')]=_[_0x37d0('0x33')](_0x2d3819['model'],_0x2d3819[_0x37d0('0x30')]);_0x47206d[_0x37d0('0x34')]=_[_0x37d0('0x33')](_0x2d3819['model'],qs[_0x37d0('0x35')](_0x29eb01[_0x37d0('0x30')][_0x37d0('0x35')]));_0x47206d[_0x37d0('0x34')]=_0x47206d[_0x37d0('0x34')][_0x37d0('0x36')]?_0x47206d[_0x37d0('0x34')]:_0x2d3819[_0x37d0('0x2e')];if(!_0x29eb01[_0x37d0('0x30')][_0x37d0('0x37')]('nolimit')){_0x47206d['limit']=qs[_0x37d0('0x21')](_0x29eb01['query'][_0x37d0('0x21')]);_0x47206d[_0x37d0('0x1f')]=qs[_0x37d0('0x1f')](_0x29eb01[_0x37d0('0x30')][_0x37d0('0x1f')]);}_0x47206d[_0x37d0('0x38')]=qs[_0x37d0('0x39')](_0x29eb01[_0x37d0('0x30')][_0x37d0('0x39')]);_0x47206d[_0x37d0('0x3a')]=qs[_0x37d0('0x32')](_[_0x37d0('0x3b')](_0x29eb01['query'],_0x2d3819['filters']),_0x1976d1);if(_0x29eb01['query']['filter']){_0x47206d[_0x37d0('0x3a')]=_[_0x37d0('0x3c')](_0x47206d[_0x37d0('0x3a')],{'$or':_[_0x37d0('0x2f')](_0x1976d1,function(_0x359f2e){if(_0x359f2e[_0x37d0('0x2c')]!=='VIRTUAL'){var _0x3fa038={};_0x3fa038[_0x359f2e[_0x37d0('0x27')]]={'$like':'%'+_0x29eb01[_0x37d0('0x30')][_0x37d0('0x3d')]+'%'};return _0x3fa038;}})});}_0x47206d=_[_0x37d0('0x3c')]({},_0x47206d,_0x29eb01[_0x37d0('0x3e')]);var _0x4fe60b={'where':_0x47206d['where']};return db[_0x37d0('0x29')][_0x37d0('0x22')](_0x4fe60b)[_0x37d0('0x3f')](function(_0x2755ef){_0x3f9b68[_0x37d0('0x22')]=_0x2755ef;if(_0x29eb01[_0x37d0('0x30')][_0x37d0('0x40')]){_0x47206d[_0x37d0('0x41')]=[{'all':!![]}];}return db[_0x37d0('0x29')][_0x37d0('0x42')](_0x47206d);})[_0x37d0('0x3f')](function(_0x44311a){_0x3f9b68[_0x37d0('0x43')]=_0x44311a;return _0x3f9b68;})[_0x37d0('0x3f')](respondWithFilteredResult(_0x1f4a7d,_0x47206d))[_0x37d0('0x44')](handleError(_0x1f4a7d,null));};exports['show']=function(_0x2f89fb,_0x4e6715){var _0x10d234={'raw':!![],'where':{'id':_0x2f89fb[_0x37d0('0x45')]['id']}},_0x289d13={};_0x289d13[_0x37d0('0x2e')]=_[_0x37d0('0x31')](db[_0x37d0('0x29')][_0x37d0('0x2a')]);_0x289d13[_0x37d0('0x30')]=_[_0x37d0('0x31')](_0x2f89fb[_0x37d0('0x30')]);_0x289d13[_0x37d0('0x32')]=_[_0x37d0('0x33')](_0x289d13[_0x37d0('0x2e')],_0x289d13[_0x37d0('0x30')]);_0x10d234[_0x37d0('0x34')]=_['intersection'](_0x289d13[_0x37d0('0x2e')],qs['fields'](_0x2f89fb['query'][_0x37d0('0x35')]));_0x10d234[_0x37d0('0x34')]=_0x10d234[_0x37d0('0x34')][_0x37d0('0x36')]?_0x10d234[_0x37d0('0x34')]:_0x289d13[_0x37d0('0x2e')];if(_0x2f89fb[_0x37d0('0x30')][_0x37d0('0x40')]){_0x10d234['include']=[{'all':!![]}];}_0x10d234=_['merge']({},_0x10d234,_0x2f89fb[_0x37d0('0x3e')]);return db[_0x37d0('0x29')][_0x37d0('0x46')](_0x10d234)[_0x37d0('0x3f')](handleEntityNotFound(_0x4e6715,null))[_0x37d0('0x3f')](respondWithResult(_0x4e6715,null))[_0x37d0('0x44')](handleError(_0x4e6715,null));};exports['create']=function(_0x2cd998,_0x2fa1a1){return db[_0x37d0('0x29')][_0x37d0('0x47')](_0x2cd998[_0x37d0('0x48')],{})[_0x37d0('0x3f')](respondWithResult(_0x2fa1a1,0xc9))[_0x37d0('0x44')](handleError(_0x2fa1a1,null));};exports[_0x37d0('0x49')]=function(_0x518df1,_0x38efdf){if(_0x518df1[_0x37d0('0x48')]['id']){delete _0x518df1[_0x37d0('0x48')]['id'];}return db[_0x37d0('0x29')][_0x37d0('0x46')]({'where':{'id':_0x518df1['params']['id']}})['then'](handleEntityNotFound(_0x38efdf,null))[_0x37d0('0x3f')](saveUpdates(_0x518df1[_0x37d0('0x48')],null))[_0x37d0('0x3f')](respondWithResult(_0x38efdf,null))[_0x37d0('0x44')](handleError(_0x38efdf,null));};exports['destroy']=function(_0x5ca53,_0x53bb29){return db[_0x37d0('0x29')]['find']({'where':{'id':_0x5ca53['params']['id']}})[_0x37d0('0x3f')](handleEntityNotFound(_0x53bb29,null))[_0x37d0('0x3f')](removeEntity(_0x53bb29,null))['catch'](handleError(_0x53bb29,null));}; \ No newline at end of file +var _0x2d56=['fieldName','type','query','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','limit','sort','where','filters','pick','VIRTUAL','filter','merge','options','includeAll','include','rows','params','keys','find','catch','create','body','eml-format','rimraf','zip-dir','moment','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','set','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','index','map','FreshsalesField','rawAttributes'];(function(_0x273c39,_0x1052e6){var _0x46d6b5=function(_0x44f1fb){while(--_0x44f1fb){_0x273c39['push'](_0x273c39['shift']());}};_0x46d6b5(++_0x1052e6);}(_0x2d56,0xee));var _0x62d5=function(_0x889656,_0x3b75db){_0x889656=_0x889656-0x0;var _0x2c0ba0=_0x2d56[_0x889656];return _0x2c0ba0;};'use strict';var emlformat=require(_0x62d5('0x0'));var rimraf=require(_0x62d5('0x1'));var zipdir=require(_0x62d5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x62d5('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x62d5('0x4'));var csv=require(_0x62d5('0x5'));var ejs=require(_0x62d5('0x6'));var fs=require('fs');var fs_extra=require(_0x62d5('0x7'));var _=require(_0x62d5('0x8'));var squel=require(_0x62d5('0x9'));var crypto=require(_0x62d5('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x62d5('0x5'));var querystring=require(_0x62d5('0xb'));var Papa=require(_0x62d5('0xc'));var Redis=require(_0x62d5('0xd'));var authService=require(_0x62d5('0xe'));var qs=require(_0x62d5('0xf'));var as=require(_0x62d5('0x10'));var hardwareService=require(_0x62d5('0x11'));var logger=require(_0x62d5('0x12'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x62d5('0x13'));var db=require(_0x62d5('0x14'))['db'];function respondWithStatusCode(_0x52ef38,_0x4c886a){_0x4c886a=_0x4c886a||0xcc;return function(_0xd49542){if(_0xd49542){return _0x52ef38['sendStatus'](_0x4c886a);}return _0x52ef38[_0x62d5('0x15')](_0x4c886a)[_0x62d5('0x16')]();};}function respondWithResult(_0x136c6d,_0x32bf36){_0x32bf36=_0x32bf36||0xc8;return function(_0x2e1bb2){if(_0x2e1bb2){return _0x136c6d['status'](_0x32bf36)[_0x62d5('0x17')](_0x2e1bb2);}};}function respondWithFilteredResult(_0x5648fe,_0x367d06){return function(_0x374db9){if(_0x374db9){var _0x45e996=typeof _0x367d06[_0x62d5('0x18')]===_0x62d5('0x19')&&typeof _0x367d06['limit']===_0x62d5('0x19');var _0x575261=_0x374db9[_0x62d5('0x1a')];var _0x54fa7f=_0x45e996?0x0:_0x367d06[_0x62d5('0x18')];var _0x808e4b=_0x45e996?_0x374db9[_0x62d5('0x1a')]:_0x367d06[_0x62d5('0x18')]+_0x367d06['limit'];var _0x3e60cc;if(_0x808e4b>=_0x575261){_0x808e4b=_0x575261;_0x3e60cc=0xc8;}else{_0x3e60cc=0xce;}_0x5648fe[_0x62d5('0x15')](_0x3e60cc);return _0x5648fe[_0x62d5('0x1b')]('Content-Range',_0x54fa7f+'-'+_0x808e4b+'/'+_0x575261)[_0x62d5('0x17')](_0x374db9);}return null;};}function patchUpdates(_0x11fe87){return function(_0x2fcf3d){try{jsonpatch[_0x62d5('0x1c')](_0x2fcf3d,_0x11fe87,!![]);}catch(_0x1917a7){return BPromise[_0x62d5('0x1d')](_0x1917a7);}return _0x2fcf3d[_0x62d5('0x1e')]();};}function saveUpdates(_0x211cac,_0x9120cb){return function(_0x2de7d1){if(_0x2de7d1){return _0x2de7d1[_0x62d5('0x1f')](_0x211cac)[_0x62d5('0x20')](function(_0x32007f){return _0x32007f;});}return null;};}function removeEntity(_0x87e5b8,_0x41a9d7){return function(_0x540f3){if(_0x540f3){return _0x540f3[_0x62d5('0x21')]()[_0x62d5('0x20')](function(){_0x87e5b8[_0x62d5('0x15')](0xcc)[_0x62d5('0x16')]();});}};}function handleEntityNotFound(_0x33a7af,_0x3086a7){return function(_0x3813c6){if(!_0x3813c6){_0x33a7af[_0x62d5('0x22')](0x194);}return _0x3813c6;};}function handleError(_0x5d4479,_0xd3286b){_0xd3286b=_0xd3286b||0x1f4;return function(_0x2efe37){logger[_0x62d5('0x23')](_0x2efe37[_0x62d5('0x24')]);if(_0x2efe37[_0x62d5('0x25')]){delete _0x2efe37[_0x62d5('0x25')];}_0x5d4479[_0x62d5('0x15')](_0xd3286b)['send'](_0x2efe37);};}exports[_0x62d5('0x26')]=function(_0x2ff935,_0x4bf776){var _0x572626={},_0x1badfb={},_0x3b88ea={'count':0x0,'rows':[]};var _0x2c4b59=_[_0x62d5('0x27')](db[_0x62d5('0x28')][_0x62d5('0x29')],function(_0x9a237f){return{'name':_0x9a237f[_0x62d5('0x2a')],'type':_0x9a237f[_0x62d5('0x2b')]['key']};});_0x1badfb['model']=_[_0x62d5('0x27')](_0x2c4b59,_0x62d5('0x25'));_0x1badfb[_0x62d5('0x2c')]=_['keys'](_0x2ff935[_0x62d5('0x2c')]);_0x1badfb['filters']=_[_0x62d5('0x2d')](_0x1badfb[_0x62d5('0x2e')],_0x1badfb[_0x62d5('0x2c')]);_0x572626['attributes']=_[_0x62d5('0x2d')](_0x1badfb['model'],qs[_0x62d5('0x2f')](_0x2ff935[_0x62d5('0x2c')][_0x62d5('0x2f')]));_0x572626[_0x62d5('0x30')]=_0x572626[_0x62d5('0x30')][_0x62d5('0x31')]?_0x572626[_0x62d5('0x30')]:_0x1badfb['model'];if(!_0x2ff935['query'][_0x62d5('0x32')](_0x62d5('0x33'))){_0x572626[_0x62d5('0x34')]=qs[_0x62d5('0x34')](_0x2ff935[_0x62d5('0x2c')][_0x62d5('0x34')]);_0x572626[_0x62d5('0x18')]=qs[_0x62d5('0x18')](_0x2ff935[_0x62d5('0x2c')][_0x62d5('0x18')]);}_0x572626['order']=qs[_0x62d5('0x35')](_0x2ff935[_0x62d5('0x2c')][_0x62d5('0x35')]);_0x572626[_0x62d5('0x36')]=qs[_0x62d5('0x37')](_[_0x62d5('0x38')](_0x2ff935[_0x62d5('0x2c')],_0x1badfb[_0x62d5('0x37')]),_0x2c4b59);if(_0x2ff935[_0x62d5('0x2c')]['filter']){_0x572626[_0x62d5('0x36')]=_['merge'](_0x572626['where'],{'$or':_['map'](_0x2c4b59,function(_0x3b1a69){if(_0x3b1a69[_0x62d5('0x2b')]!==_0x62d5('0x39')){var _0x3ad5bb={};_0x3ad5bb[_0x3b1a69[_0x62d5('0x25')]]={'$like':'%'+_0x2ff935[_0x62d5('0x2c')][_0x62d5('0x3a')]+'%'};return _0x3ad5bb;}})});}_0x572626=_[_0x62d5('0x3b')]({},_0x572626,_0x2ff935[_0x62d5('0x3c')]);var _0xdbf487={'where':_0x572626[_0x62d5('0x36')]};return db[_0x62d5('0x28')][_0x62d5('0x1a')](_0xdbf487)[_0x62d5('0x20')](function(_0x1d96cf){_0x3b88ea[_0x62d5('0x1a')]=_0x1d96cf;if(_0x2ff935[_0x62d5('0x2c')][_0x62d5('0x3d')]){_0x572626[_0x62d5('0x3e')]=[{'all':!![]}];}return db['FreshsalesField']['findAll'](_0x572626);})[_0x62d5('0x20')](function(_0x3dceeb){_0x3b88ea[_0x62d5('0x3f')]=_0x3dceeb;return _0x3b88ea;})[_0x62d5('0x20')](respondWithFilteredResult(_0x4bf776,_0x572626))['catch'](handleError(_0x4bf776,null));};exports['show']=function(_0x32285a,_0x81de4e){var _0xc6aa4d={'raw':!![],'where':{'id':_0x32285a[_0x62d5('0x40')]['id']}},_0x5ced75={};_0x5ced75[_0x62d5('0x2e')]=_['keys'](db[_0x62d5('0x28')]['rawAttributes']);_0x5ced75[_0x62d5('0x2c')]=_[_0x62d5('0x41')](_0x32285a[_0x62d5('0x2c')]);_0x5ced75[_0x62d5('0x37')]=_[_0x62d5('0x2d')](_0x5ced75[_0x62d5('0x2e')],_0x5ced75[_0x62d5('0x2c')]);_0xc6aa4d[_0x62d5('0x30')]=_['intersection'](_0x5ced75[_0x62d5('0x2e')],qs[_0x62d5('0x2f')](_0x32285a['query'][_0x62d5('0x2f')]));_0xc6aa4d['attributes']=_0xc6aa4d[_0x62d5('0x30')][_0x62d5('0x31')]?_0xc6aa4d[_0x62d5('0x30')]:_0x5ced75['model'];if(_0x32285a[_0x62d5('0x2c')][_0x62d5('0x3d')]){_0xc6aa4d['include']=[{'all':!![]}];}_0xc6aa4d=_[_0x62d5('0x3b')]({},_0xc6aa4d,_0x32285a[_0x62d5('0x3c')]);return db[_0x62d5('0x28')][_0x62d5('0x42')](_0xc6aa4d)[_0x62d5('0x20')](handleEntityNotFound(_0x81de4e,null))['then'](respondWithResult(_0x81de4e,null))[_0x62d5('0x43')](handleError(_0x81de4e,null));};exports[_0x62d5('0x44')]=function(_0x5d2c4a,_0x5b7314){return db[_0x62d5('0x28')][_0x62d5('0x44')](_0x5d2c4a[_0x62d5('0x45')],{})[_0x62d5('0x20')](respondWithResult(_0x5b7314,0xc9))[_0x62d5('0x43')](handleError(_0x5b7314,null));};exports['update']=function(_0x543c39,_0x464deb){if(_0x543c39[_0x62d5('0x45')]['id']){delete _0x543c39['body']['id'];}return db['FreshsalesField']['find']({'where':{'id':_0x543c39[_0x62d5('0x40')]['id']}})[_0x62d5('0x20')](handleEntityNotFound(_0x464deb,null))[_0x62d5('0x20')](saveUpdates(_0x543c39['body'],null))[_0x62d5('0x20')](respondWithResult(_0x464deb,null))['catch'](handleError(_0x464deb,null));};exports[_0x62d5('0x21')]=function(_0x43935c,_0x3532bf){return db[_0x62d5('0x28')][_0x62d5('0x42')]({'where':{'id':_0x43935c['params']['id']}})[_0x62d5('0x20')](handleEntityNotFound(_0x3532bf,null))[_0x62d5('0x20')](removeEntity(_0x3532bf,null))[_0x62d5('0x43')](handleError(_0x3532bf,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index a48cbbb..b6f6158 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 _0x980c=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesField.attributes','define','FreshsalesField','int_freshsales_fields','freshsales_unique_index','idField'];(function(_0x59e862,_0x477bf2){var _0x1a25ee=function(_0xc61e64){while(--_0xc61e64){_0x59e862['push'](_0x59e862['shift']());}};_0x1a25ee(++_0x477bf2);}(_0x980c,0x100));var _0xc980=function(_0xcd50b3,_0x57e3c5){_0xcd50b3=_0xcd50b3-0x0;var _0x252f3e=_0x980c[_0xcd50b3];return _0x252f3e;};'use strict';var _=require(_0xc980('0x0'));var util=require(_0xc980('0x1'));var logger=require(_0xc980('0x2'))(_0xc980('0x3'));var moment=require(_0xc980('0x4'));var BPromise=require(_0xc980('0x5'));var rp=require(_0xc980('0x6'));var fs=require('fs');var path=require(_0xc980('0x7'));var rimraf=require(_0xc980('0x8'));var config=require(_0xc980('0x9'));var attributes=require(_0xc980('0xa'));module['exports']=function(_0x472ece,_0x311a54){return _0x472ece[_0xc980('0xb')](_0xc980('0xc'),attributes,{'tableName':_0xc980('0xd'),'paranoid':![],'indexes':[{'name':_0xc980('0xe'),'fields':[_0xc980('0xf'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x07a2=['path','rimraf','../../config/environment','./intFreshsalesField.attributes','exports','define','FreshsalesField','int_freshsales_fields','freshsales_unique_index','idField','FieldId','lodash','util','api','moment','bluebird','request-promise'];(function(_0x3bf919,_0x2d77a5){var _0x265f0b=function(_0x592425){while(--_0x592425){_0x3bf919['push'](_0x3bf919['shift']());}};_0x265f0b(++_0x2d77a5);}(_0x07a2,0x12c));var _0x207a=function(_0x1f44e4,_0x22d9fd){_0x1f44e4=_0x1f44e4-0x0;var _0x591989=_0x07a2[_0x1f44e4];return _0x591989;};'use strict';var _=require(_0x207a('0x0'));var util=require(_0x207a('0x1'));var logger=require('../../config/logger')(_0x207a('0x2'));var moment=require(_0x207a('0x3'));var BPromise=require(_0x207a('0x4'));var rp=require(_0x207a('0x5'));var fs=require('fs');var path=require(_0x207a('0x6'));var rimraf=require(_0x207a('0x7'));var config=require(_0x207a('0x8'));var attributes=require(_0x207a('0x9'));module[_0x207a('0xa')]=function(_0x47dbbf,_0x5b1fa9){return _0x47dbbf[_0x207a('0xb')](_0x207a('0xc'),attributes,{'tableName':_0x207a('0xd'),'paranoid':![],'indexes':[{'name':_0x207a('0xe'),'fields':[_0x207a('0xf'),_0x207a('0x10')],'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 3504607..f4b9c83 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(_0x51e317,_0x27f9f5){var _0x5a9a1d=function(_0x4ab835){while(--_0x4ab835){_0x51e317['push'](_0x51e317['shift']());}};_0x5a9a1d(++_0x27f9f5);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x1e4360,_0x930b9b){_0x1e4360=_0x1e4360-0x0;var _0x31e6b4=_0xc4aa[_0x1e4360];return _0x31e6b4;};'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 _0x5496=['../../mysqldb','../../config/logger','rpc','../../config/environment','http','then','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0xf1c6a0,_0x41530a){var _0x3b7216=function(_0x34e4e0){while(--_0x34e4e0){_0xf1c6a0['push'](_0xf1c6a0['shift']());}};_0x3b7216(++_0x41530a);}(_0x5496,0x175));var _0x6549=function(_0x162bc0,_0x5a1238){_0x162bc0=_0x162bc0-0x0;var _0x2aa83b=_0x5496[_0x162bc0];return _0x2aa83b;};'use strict';var _=require(_0x6549('0x0'));var util=require(_0x6549('0x1'));var moment=require(_0x6549('0x2'));var BPromise=require(_0x6549('0x3'));var rs=require(_0x6549('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6549('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x6549('0x6'))(_0x6549('0x7'));var config=require(_0x6549('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x6549('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1d8cea,_0x4fcffd,_0x1ca8fc){return new BPromise(function(_0x3442c3,_0x1ef2a6){return client['request'](_0x1d8cea,_0x1ca8fc)[_0x6549('0xa')](function(_0x35d008){logger[_0x6549('0xb')](_0x6549('0xc'),_0x4fcffd,_0x6549('0xd'));logger[_0x6549('0xe')]('FreshsalesField,\x20%s,\x20%s,\x20%s',_0x4fcffd,'request\x20sent',JSON[_0x6549('0xf')](_0x35d008));if(_0x35d008[_0x6549('0x10')]){if(_0x35d008[_0x6549('0x10')][_0x6549('0x11')]===0x1f4){logger[_0x6549('0x10')]('FreshsalesField,\x20%s,\x20%s',_0x4fcffd,_0x35d008['error'][_0x6549('0x12')]);return _0x1ef2a6(_0x35d008[_0x6549('0x10')]['message']);}logger[_0x6549('0x10')](_0x6549('0xc'),_0x4fcffd,_0x35d008[_0x6549('0x10')][_0x6549('0x12')]);return _0x3442c3(_0x35d008[_0x6549('0x10')][_0x6549('0x12')]);}else{logger['info']('FreshsalesField,\x20%s,\x20%s',_0x4fcffd,_0x6549('0xd'));_0x3442c3(_0x35d008[_0x6549('0x13')]['message']);}})[_0x6549('0x14')](function(_0x67acc0){logger[_0x6549('0x10')](_0x6549('0xc'),_0x4fcffd,_0x67acc0);_0x1ef2a6(_0x67acc0);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index 60ea4d7..0e91b98 100644 --- a/server/api/intSalesforceAccount/index.js +++ b/server/api/intSalesforceAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSalesforceAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x43fc98,_0x22141f){var _0x183d92=function(_0x5e5940){while(--_0x5e5940){_0x43fc98['push'](_0x43fc98['shift']());}};_0x183d92(++_0x22141f);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file +var _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(_0x48425e,_0x270a2c){var _0x5339c6=function(_0x5ee674){while(--_0x5ee674){_0x48425e['push'](_0x48425e['shift']());}};_0x5339c6(++_0x270a2c);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index 8c7432d..d1e35d4 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 _0x1a21=['username','ENUM','integrationTab','newTab','sequelize','exports','STRING'];(function(_0xa818e3,_0x4f7563){var _0x1ce31a=function(_0x489338){while(--_0x489338){_0xa818e3['push'](_0xa818e3['shift']());}};_0x1ce31a(++_0x4f7563);}(_0x1a21,0x1d9));var _0x11a2=function(_0x1ca4c3,_0x554126){_0x1ca4c3=_0x1ca4c3-0x0;var _0x4426a6=_0x1a21[_0x1ca4c3];return _0x4426a6;};'use strict';var Sequelize=require(_0x11a2('0x0'));module[_0x11a2('0x1')]={'name':{'type':Sequelize[_0x11a2('0x2')]},'description':{'type':Sequelize[_0x11a2('0x2')]},'username':{'type':Sequelize[_0x11a2('0x2')],'unique':_0x11a2('0x3')},'remoteUri':{'type':Sequelize[_0x11a2('0x2')]},'password':{'type':Sequelize[_0x11a2('0x2')]},'clientId':{'type':Sequelize[_0x11a2('0x2')]},'clientSecret':{'type':Sequelize[_0x11a2('0x2')]},'securityToken':{'type':Sequelize[_0x11a2('0x2')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x11a2('0x4')](_0x11a2('0x5'),_0x11a2('0x6')),'defaultValue':_0x11a2('0x5')}}; \ No newline at end of file +var _0x1cbc=['STRING','username','ENUM','integrationTab','sequelize'];(function(_0x1f83a5,_0x59843f){var _0x45edf0=function(_0x431e25){while(--_0x431e25){_0x1f83a5['push'](_0x1f83a5['shift']());}};_0x45edf0(++_0x59843f);}(_0x1cbc,0xf4));var _0xc1cb=function(_0x3b67e4,_0x2a5d46){_0x3b67e4=_0x3b67e4-0x0;var _0x21adcf=_0x1cbc[_0x3b67e4];return _0x21adcf;};'use strict';var Sequelize=require(_0xc1cb('0x0'));module['exports']={'name':{'type':Sequelize[_0xc1cb('0x1')]},'description':{'type':Sequelize[_0xc1cb('0x1')]},'username':{'type':Sequelize[_0xc1cb('0x1')],'unique':_0xc1cb('0x2')},'remoteUri':{'type':Sequelize[_0xc1cb('0x1')]},'password':{'type':Sequelize[_0xc1cb('0x1')]},'clientId':{'type':Sequelize[_0xc1cb('0x1')]},'clientSecret':{'type':Sequelize[_0xc1cb('0x1')]},'securityToken':{'type':Sequelize[_0xc1cb('0x1')]},'serverUrl':{'type':Sequelize[_0xc1cb('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xc1cb('0x3')](_0xc1cb('0x4'),'newTab'),'defaultValue':_0xc1cb('0x4')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index 0f24822..fd3c739 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 _0xd3eb=['remove','includes','custom','label','boolean','True','true','False','test','error','getFields,\x20%s,\x20%s,\x20%s','stringify','send','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','save','update','then','destroy','stack','name','index','map','SalesforceAccount','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','length','find','create','body','params','getConfigurations','findOne','SalesforceConfiguration','AccountId','Subjects','channel','Descriptions','getDescriptions','SalesforceField','getFields','Task','remoteUri','clientId','clientSecret','password','securityToken','substring','lastIndexOf','concat','isNil','ticketType','sobject','describe','OwnerId','IsRecurrence','Subject','Description','picklist','textarea','phone'];(function(_0x4f2530,_0x5c0bb5){var _0x4a9e71=function(_0x52c15d){while(--_0x52c15d){_0x4f2530['push'](_0x4f2530['shift']());}};_0x4a9e71(++_0x5c0bb5);}(_0xd3eb,0x176));var _0xbd3e=function(_0x260073,_0xbe6af9){_0x260073=_0x260073-0x0;var _0x4ff033=_0xd3eb[_0x260073];return _0x4ff033;};'use strict';var emlformat=require(_0xbd3e('0x0'));var rimraf=require(_0xbd3e('0x1'));var zipdir=require(_0xbd3e('0x2'));var jsonpatch=require(_0xbd3e('0x3'));var rp=require('request-promise');var moment=require(_0xbd3e('0x4'));var BPromise=require(_0xbd3e('0x5'));var Mustache=require(_0xbd3e('0x6'));var util=require('util');var path=require(_0xbd3e('0x7'));var sox=require('sox');var csv=require(_0xbd3e('0x8'));var ejs=require(_0xbd3e('0x9'));var fs=require('fs');var fs_extra=require(_0xbd3e('0xa'));var _=require(_0xbd3e('0xb'));var squel=require(_0xbd3e('0xc'));var crypto=require(_0xbd3e('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xbd3e('0xe'));var toCsv=require('to-csv');var querystring=require(_0xbd3e('0xf'));var Papa=require(_0xbd3e('0x10'));var Redis=require(_0xbd3e('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xbd3e('0x12'));var as=require(_0xbd3e('0x13'));var hardwareService=require(_0xbd3e('0x14'));var logger=require('../../config/logger')(_0xbd3e('0x15'));var utils=require(_0xbd3e('0x16'));var config=require(_0xbd3e('0x17'));var licenseUtil=require(_0xbd3e('0x18'));var db=require(_0xbd3e('0x19'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x5d1c08,_0x4945b9){_0x4945b9=_0x4945b9||0xcc;return function(_0x4d32ad){if(_0x4d32ad){return _0x5d1c08[_0xbd3e('0x1a')](_0x4945b9);}return _0x5d1c08[_0xbd3e('0x1b')](_0x4945b9)[_0xbd3e('0x1c')]();};}function respondWithResult(_0x16d4c2,_0x457e73){_0x457e73=_0x457e73||0xc8;return function(_0x4aa0af){if(_0x4aa0af){return _0x16d4c2[_0xbd3e('0x1b')](_0x457e73)[_0xbd3e('0x1d')](_0x4aa0af);}};}function respondWithFilteredResult(_0x5f13b0,_0x2ea4fd){return function(_0x2c8cf1){if(_0x2c8cf1){var _0x2bb14c=typeof _0x2ea4fd[_0xbd3e('0x1e')]==='undefined'&&typeof _0x2ea4fd[_0xbd3e('0x1f')]==='undefined';var _0x285a8c=_0x2c8cf1[_0xbd3e('0x20')];var _0x3c88ef=_0x2bb14c?0x0:_0x2ea4fd[_0xbd3e('0x1e')];var _0x4ca7cd=_0x2bb14c?_0x2c8cf1[_0xbd3e('0x20')]:_0x2ea4fd['offset']+_0x2ea4fd[_0xbd3e('0x1f')];var _0x85b2c0;if(_0x4ca7cd>=_0x285a8c){_0x4ca7cd=_0x285a8c;_0x85b2c0=0xc8;}else{_0x85b2c0=0xce;}_0x5f13b0['status'](_0x85b2c0);return _0x5f13b0[_0xbd3e('0x21')](_0xbd3e('0x22'),_0x3c88ef+'-'+_0x4ca7cd+'/'+_0x285a8c)['json'](_0x2c8cf1);}return null;};}function patchUpdates(_0x210edb){return function(_0x13e09c){try{jsonpatch[_0xbd3e('0x23')](_0x13e09c,_0x210edb,!![]);}catch(_0x44a588){return BPromise['reject'](_0x44a588);}return _0x13e09c[_0xbd3e('0x24')]();};}function saveUpdates(_0x2a4b7f,_0x160643){return function(_0x200e3b){if(_0x200e3b){return _0x200e3b[_0xbd3e('0x25')](_0x2a4b7f)[_0xbd3e('0x26')](function(_0x387f67){return _0x387f67;});}return null;};}function removeEntity(_0x59ecb9,_0x57e847){return function(_0x5411d0){if(_0x5411d0){return _0x5411d0[_0xbd3e('0x27')]()[_0xbd3e('0x26')](function(){_0x59ecb9[_0xbd3e('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x136e68,_0x2b25fb){return function(_0x2302f3){if(!_0x2302f3){_0x136e68['sendStatus'](0x194);}return _0x2302f3;};}function handleError(_0x25de92,_0x3abcf8){_0x3abcf8=_0x3abcf8||0x1f4;return function(_0x2dd829){logger['error'](_0x2dd829[_0xbd3e('0x28')]);if(_0x2dd829[_0xbd3e('0x29')]){delete _0x2dd829[_0xbd3e('0x29')];}_0x25de92[_0xbd3e('0x1b')](_0x3abcf8)['send'](_0x2dd829);};}exports[_0xbd3e('0x2a')]=function(_0x189466,_0x4146b7){var _0xa40d44={},_0xc89035={},_0x5268a6={'count':0x0,'rows':[]};var _0x390fb6=_[_0xbd3e('0x2b')](db[_0xbd3e('0x2c')][_0xbd3e('0x2d')],function(_0x5ea77d){return{'name':_0x5ea77d[_0xbd3e('0x2e')],'type':_0x5ea77d[_0xbd3e('0x2f')][_0xbd3e('0x30')]};});_0xc89035[_0xbd3e('0x31')]=_['map'](_0x390fb6,_0xbd3e('0x29'));_0xc89035['query']=_[_0xbd3e('0x32')](_0x189466['query']);_0xc89035[_0xbd3e('0x33')]=_[_0xbd3e('0x34')](_0xc89035[_0xbd3e('0x31')],_0xc89035[_0xbd3e('0x35')]);_0xa40d44[_0xbd3e('0x36')]=_[_0xbd3e('0x34')](_0xc89035[_0xbd3e('0x31')],qs[_0xbd3e('0x37')](_0x189466['query'][_0xbd3e('0x37')]));_0xa40d44['attributes']=_0xa40d44[_0xbd3e('0x36')]['length']?_0xa40d44['attributes']:_0xc89035[_0xbd3e('0x31')];if(!_0x189466[_0xbd3e('0x35')][_0xbd3e('0x38')](_0xbd3e('0x39'))){_0xa40d44[_0xbd3e('0x1f')]=qs[_0xbd3e('0x1f')](_0x189466[_0xbd3e('0x35')][_0xbd3e('0x1f')]);_0xa40d44['offset']=qs['offset'](_0x189466[_0xbd3e('0x35')][_0xbd3e('0x1e')]);}_0xa40d44[_0xbd3e('0x3a')]=qs[_0xbd3e('0x3b')](_0x189466[_0xbd3e('0x35')][_0xbd3e('0x3b')]);_0xa40d44[_0xbd3e('0x3c')]=qs[_0xbd3e('0x33')](_[_0xbd3e('0x3d')](_0x189466[_0xbd3e('0x35')],_0xc89035['filters']),_0x390fb6);if(_0x189466[_0xbd3e('0x35')][_0xbd3e('0x3e')]){_0xa40d44['where']=_[_0xbd3e('0x3f')](_0xa40d44['where'],{'$or':_['map'](_0x390fb6,function(_0x219cbb){if(_0x219cbb['type']!==_0xbd3e('0x40')){var _0x1902b6={};_0x1902b6[_0x219cbb['name']]={'$like':'%'+_0x189466[_0xbd3e('0x35')][_0xbd3e('0x3e')]+'%'};return _0x1902b6;}})});}_0xa40d44=_[_0xbd3e('0x3f')]({},_0xa40d44,_0x189466[_0xbd3e('0x41')]);var _0x182d59={'where':_0xa40d44[_0xbd3e('0x3c')]};return db[_0xbd3e('0x2c')][_0xbd3e('0x20')](_0x182d59)[_0xbd3e('0x26')](function(_0x5c0159){_0x5268a6['count']=_0x5c0159;if(_0x189466[_0xbd3e('0x35')]['includeAll']){_0xa40d44[_0xbd3e('0x42')]=[{'all':!![]}];}return db[_0xbd3e('0x2c')][_0xbd3e('0x43')](_0xa40d44);})[_0xbd3e('0x26')](function(_0x241178){_0x5268a6[_0xbd3e('0x44')]=_0x241178;return _0x5268a6;})[_0xbd3e('0x26')](respondWithFilteredResult(_0x4146b7,_0xa40d44))[_0xbd3e('0x45')](handleError(_0x4146b7,null));};exports[_0xbd3e('0x46')]=function(_0x39edaa,_0x504c3e){var _0x4db055={'raw':![],'where':{'id':_0x39edaa['params']['id']}},_0x2dcee6={};_0x2dcee6[_0xbd3e('0x31')]=_['keys'](db[_0xbd3e('0x2c')][_0xbd3e('0x2d')]);_0x2dcee6[_0xbd3e('0x35')]=_[_0xbd3e('0x32')](_0x39edaa[_0xbd3e('0x35')]);_0x2dcee6[_0xbd3e('0x33')]=_[_0xbd3e('0x34')](_0x2dcee6[_0xbd3e('0x31')],_0x2dcee6[_0xbd3e('0x35')]);_0x4db055[_0xbd3e('0x36')]=_[_0xbd3e('0x34')](_0x2dcee6[_0xbd3e('0x31')],qs[_0xbd3e('0x37')](_0x39edaa[_0xbd3e('0x35')][_0xbd3e('0x37')]));_0x4db055[_0xbd3e('0x36')]=_0x4db055['attributes'][_0xbd3e('0x47')]?_0x4db055[_0xbd3e('0x36')]:_0x2dcee6['model'];if(_0x39edaa[_0xbd3e('0x35')]['includeAll']){_0x4db055[_0xbd3e('0x42')]=[{'all':!![]}];}_0x4db055=_[_0xbd3e('0x3f')]({},_0x4db055,_0x39edaa[_0xbd3e('0x41')]);return db['SalesforceAccount'][_0xbd3e('0x48')](_0x4db055)[_0xbd3e('0x26')](handleEntityNotFound(_0x504c3e,null))['then'](respondWithResult(_0x504c3e,null))[_0xbd3e('0x45')](handleError(_0x504c3e,null));};exports[_0xbd3e('0x49')]=function(_0xa7cc80,_0x109c69){return db[_0xbd3e('0x2c')][_0xbd3e('0x49')](_0xa7cc80[_0xbd3e('0x4a')],{})[_0xbd3e('0x26')](respondWithResult(_0x109c69,0xc9))[_0xbd3e('0x45')](handleError(_0x109c69,null));};exports[_0xbd3e('0x25')]=function(_0x2f328a,_0x3ea7cc){if(_0x2f328a[_0xbd3e('0x4a')]['id']){delete _0x2f328a[_0xbd3e('0x4a')]['id'];}return db[_0xbd3e('0x2c')][_0xbd3e('0x48')]({'where':{'id':_0x2f328a['params']['id']}})[_0xbd3e('0x26')](handleEntityNotFound(_0x3ea7cc,null))[_0xbd3e('0x26')](saveUpdates(_0x2f328a['body'],null))[_0xbd3e('0x26')](respondWithResult(_0x3ea7cc,null))[_0xbd3e('0x45')](handleError(_0x3ea7cc,null));};exports['destroy']=function(_0x1a858c,_0x61ee89){return db[_0xbd3e('0x2c')][_0xbd3e('0x48')]({'where':{'id':_0x1a858c[_0xbd3e('0x4b')]['id']}})[_0xbd3e('0x26')](handleEntityNotFound(_0x61ee89,null))[_0xbd3e('0x26')](removeEntity(_0x61ee89,null))[_0xbd3e('0x45')](handleError(_0x61ee89,null));};exports[_0xbd3e('0x4c')]=function(_0x42a422,_0x169be2,_0x28583a){var _0x556d58={};var _0x5dc830={};var _0x5da8d9;var _0x5cf4d6;return db['SalesforceAccount'][_0xbd3e('0x4d')]({'where':{'id':_0x42a422[_0xbd3e('0x4b')]['id']}})[_0xbd3e('0x26')](handleEntityNotFound(_0x169be2,null))[_0xbd3e('0x26')](function(_0x4172c8){if(_0x4172c8){_0x5da8d9=_0x4172c8;_0x5dc830[_0xbd3e('0x31')]=_[_0xbd3e('0x32')](db[_0xbd3e('0x4e')]['rawAttributes']);_0x5dc830[_0xbd3e('0x35')]=_[_0xbd3e('0x32')](_0x42a422[_0xbd3e('0x35')]);_0x5dc830['filters']=_['intersection'](_0x5dc830[_0xbd3e('0x31')],_0x5dc830[_0xbd3e('0x35')]);_0x556d58[_0xbd3e('0x36')]=_[_0xbd3e('0x34')](_0x5dc830[_0xbd3e('0x31')],qs[_0xbd3e('0x37')](_0x42a422[_0xbd3e('0x35')][_0xbd3e('0x37')]));_0x556d58[_0xbd3e('0x36')]=_0x556d58[_0xbd3e('0x36')]['length']?_0x556d58[_0xbd3e('0x36')]:_0x5dc830['model'];_0x556d58['order']=qs[_0xbd3e('0x3b')](_0x42a422['query'][_0xbd3e('0x3b')]);_0x556d58[_0xbd3e('0x3c')]=qs[_0xbd3e('0x33')](_['pick'](_0x42a422[_0xbd3e('0x35')],_0x5dc830[_0xbd3e('0x33')]));if(_0x42a422[_0xbd3e('0x35')]['filter']){_0x556d58['where']=_[_0xbd3e('0x3f')](_0x556d58[_0xbd3e('0x3c')],{'$or':_[_0xbd3e('0x2b')](_0x556d58[_0xbd3e('0x36')],function(_0x325b5c){var _0x32105f={};_0x32105f[_0x325b5c]={'$like':'%'+_0x42a422[_0xbd3e('0x35')][_0xbd3e('0x3e')]+'%'};return _0x32105f;})});}_0x556d58=_[_0xbd3e('0x3f')]({},_0x556d58,_0x42a422[_0xbd3e('0x41')]);return _0x5da8d9['getConfigurations'](_0x556d58);}})['then'](function(_0x112e24){if(_0x112e24){_0x5cf4d6=_0x112e24[_0xbd3e('0x47')];if(!_0x42a422[_0xbd3e('0x35')][_0xbd3e('0x38')](_0xbd3e('0x39'))){_0x556d58['limit']=qs[_0xbd3e('0x1f')](_0x42a422[_0xbd3e('0x35')][_0xbd3e('0x1f')]);_0x556d58[_0xbd3e('0x1e')]=qs[_0xbd3e('0x1e')](_0x42a422[_0xbd3e('0x35')]['offset']);}return _0x5da8d9[_0xbd3e('0x4c')](_0x556d58);}})['then'](function(_0x270ad7){if(_0x270ad7){return _0x270ad7?{'count':_0x5cf4d6,'rows':_0x270ad7}:null;}})['then'](respondWithResult(_0x169be2,null))[_0xbd3e('0x45')](handleError(_0x169be2,null));};exports['addConfiguration']=function(_0x5b0a12,_0x40d280,_0xaba730){if(_0x5b0a12[_0xbd3e('0x4a')]['id']){delete _0x5b0a12[_0xbd3e('0x4a')]['id'];}return db[_0xbd3e('0x2c')]['findOne']({'where':{'id':_0x5b0a12[_0xbd3e('0x4b')]['id']}})[_0xbd3e('0x26')](handleEntityNotFound(_0x40d280,null))[_0xbd3e('0x26')](function(_0x686733){if(_0x686733){_0x5b0a12['body'][_0xbd3e('0x4f')]=_0x686733['id'];_0x5b0a12[_0xbd3e('0x4a')][_0xbd3e('0x50')]=integrations['getSubjects'](_0x5b0a12[_0xbd3e('0x4a')][_0xbd3e('0x51')],_0x5b0a12[_0xbd3e('0x4a')][_0xbd3e('0x2f')]);_0x5b0a12[_0xbd3e('0x4a')][_0xbd3e('0x52')]=integrations[_0xbd3e('0x53')](_0x5b0a12[_0xbd3e('0x4a')][_0xbd3e('0x51')],_0x5b0a12['body']['type']);return db[_0xbd3e('0x4e')][_0xbd3e('0x49')](_0x5b0a12[_0xbd3e('0x4a')],{'include':[{'model':db['SalesforceField'],'as':'Subjects'},{'model':db[_0xbd3e('0x54')],'as':_0xbd3e('0x52')}]});}return null;})['then'](respondWithResult(_0x40d280,null))[_0xbd3e('0x45')](handleError(_0x40d280,null));};exports[_0xbd3e('0x55')]=function(_0x50869a,_0x4b5ca4,_0x2f9dcc){var _0x18d73b;var _0x319ff9='';var _0x351164=_0xbd3e('0x56');return db[_0xbd3e('0x2c')][_0xbd3e('0x4d')]({'where':{'id':_0x50869a[_0xbd3e('0x4b')]['id']},'attributes':['id',_0xbd3e('0x57'),_0xbd3e('0x58'),_0xbd3e('0x59'),'username',_0xbd3e('0x5a'),_0xbd3e('0x5b')]})[_0xbd3e('0x26')](handleEntityNotFound(_0x4b5ca4,null))[_0xbd3e('0x26')](function(_0x5e616f){if(_0x5e616f){_0x319ff9=_0x5e616f[_0xbd3e('0x57')];var _0x2c7278=_0x319ff9['slice'](-0x1);if(_0x2c7278==='/'){_0x319ff9=_0x319ff9[_0xbd3e('0x5c')](0x0,_0x319ff9[_0xbd3e('0x5d')](_0x2c7278));}_0x18d73b=new jsforce['Connection']({'oauth2':{'loginUrl':_0x319ff9,'clientId':_0x5e616f[_0xbd3e('0x58')],'clientSecret':_0x5e616f[_0xbd3e('0x59')]}});return _0x18d73b['login'](_0x5e616f['username'],_0x5e616f[_0xbd3e('0x5a')][_0xbd3e('0x5e')](_0x5e616f[_0xbd3e('0x5b')]));}})[_0xbd3e('0x26')](function(_0x424701){if(_0x424701){if(!_[_0xbd3e('0x5f')](_0x50869a['query'][_0xbd3e('0x60')])){_0x351164=_0x50869a['query']['ticketType'];}return _0x18d73b[_0xbd3e('0x61')](_0x351164)[_0xbd3e('0x62')]();}})['then'](function(_0x33b4b7){var _0x2bf63f=[_0xbd3e('0x63'),'ActivityDate','IsReminderSet',_0xbd3e('0x64'),_0xbd3e('0x65'),_0xbd3e('0x66')];var _0x1dde69=['string','int',_0xbd3e('0x67'),'boolean','email',_0xbd3e('0x68'),_0xbd3e('0x69')];if(_0x33b4b7){_[_0xbd3e('0x6a')](_0x33b4b7[_0xbd3e('0x37')],function(_0x587742){return _0x2bf63f[_0xbd3e('0x6b')](_0x587742[_0xbd3e('0x29')])||!_0x1dde69[_0xbd3e('0x6b')](_0x587742[_0xbd3e('0x2f')]);});return{'count':_0x33b4b7[_0xbd3e('0x37')][_0xbd3e('0x47')],'rows':_['map'](_0x33b4b7[_0xbd3e('0x37')],function(_0x3119cc){return{'id':_0x3119cc[_0xbd3e('0x29')],'name':_0x3119cc['label'],'custom':_0x3119cc[_0xbd3e('0x6c')],'options':_0x3119cc['picklistValues']['length']>0x0?_[_0xbd3e('0x2b')](_0x3119cc['picklistValues'],function(_0x410858){return{'name':_0x410858[_0xbd3e('0x6d')],'value':_0x410858['value']};}):_0x3119cc[_0xbd3e('0x2f')]==_0xbd3e('0x6e')?[{'name':_0xbd3e('0x6f'),'value':_0xbd3e('0x70')},{'name':_0xbd3e('0x71'),'value':'false'}]:[]};})};}})[_0xbd3e('0x26')](respondWithResult(_0x4b5ca4,null))[_0xbd3e('0x45')](function(_0x38dd35){var _0xc92619=_0x50869a[_0xbd3e('0x35')][_0xbd3e('0x72')]?0x1f4:_0x38dd35['statusCode']||0x1f4;logger[_0xbd3e('0x73')](_0xbd3e('0x74'),_0xbd3e('0x55'),_0xc92619,JSON[_0xbd3e('0x75')](_0x38dd35));delete _0x38dd35['name'];if(_0xc92619===0x191){_0xc92619=0x190;}_0x4b5ca4['status'](_0xc92619)[_0xbd3e('0x76')](_0x50869a[_0xbd3e('0x35')][_0xbd3e('0x72')]?{'message':_0xbd3e('0x77'),'statusCode':_0x38dd35['statusCode']}:_0x38dd35);});}; \ No newline at end of file +var _0x0133=['../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','SalesforceAccount','rawAttributes','fieldName','type','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys','options','create','body','find','pick','nolimit','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','SalesforceConfiguration','SalesforceField','findOne','remoteUri','clientId','clientSecret','username','password','securityToken','slice','substring','lastIndexOf','login','concat','isNil','ticketType','sobject','describe','OwnerId','ActivityDate','IsReminderSet','Subject','string','int','boolean','email','textarea','phone','includes','label','custom','picklistValues','value','True','true','false','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','../../components/auth/service'];(function(_0x99c2dd,_0x1d32eb){var _0x173349=function(_0x211a30){while(--_0x211a30){_0x99c2dd['push'](_0x99c2dd['shift']());}};_0x173349(++_0x1d32eb);}(_0x0133,0x6c));var _0x3013=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0x0133[_0x2f3848];return _0x102668;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3013('0x0'));var zipdir=require(_0x3013('0x1'));var jsonpatch=require(_0x3013('0x2'));var rp=require('request-promise');var moment=require(_0x3013('0x3'));var BPromise=require(_0x3013('0x4'));var Mustache=require(_0x3013('0x5'));var util=require(_0x3013('0x6'));var path=require('path');var sox=require(_0x3013('0x7'));var csv=require(_0x3013('0x8'));var ejs=require(_0x3013('0x9'));var fs=require('fs');var fs_extra=require(_0x3013('0xa'));var _=require(_0x3013('0xb'));var squel=require(_0x3013('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x3013('0xd'));var toCsv=require('to-csv');var querystring=require(_0x3013('0xe'));var Papa=require(_0x3013('0xf'));var Redis=require('ioredis');var authService=require(_0x3013('0x10'));var qs=require(_0x3013('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3013('0x12'));var logger=require(_0x3013('0x13'))('api');var utils=require(_0x3013('0x14'));var config=require(_0x3013('0x15'));var licenseUtil=require(_0x3013('0x16'));var db=require('../../mysqldb')['db'];var integrations=require(_0x3013('0x17'));function respondWithStatusCode(_0x32607b,_0x22e373){_0x22e373=_0x22e373||0xcc;return function(_0x26bb3d){if(_0x26bb3d){return _0x32607b[_0x3013('0x18')](_0x22e373);}return _0x32607b[_0x3013('0x19')](_0x22e373)[_0x3013('0x1a')]();};}function respondWithResult(_0x3c1db1,_0x2c57ca){_0x2c57ca=_0x2c57ca||0xc8;return function(_0x4474e3){if(_0x4474e3){return _0x3c1db1['status'](_0x2c57ca)[_0x3013('0x1b')](_0x4474e3);}};}function respondWithFilteredResult(_0x291c1f,_0x3048b9){return function(_0x5496cb){if(_0x5496cb){var _0x19e474=typeof _0x3048b9[_0x3013('0x1c')]===_0x3013('0x1d')&&typeof _0x3048b9['limit']===_0x3013('0x1d');var _0x552552=_0x5496cb[_0x3013('0x1e')];var _0x34ccd3=_0x19e474?0x0:_0x3048b9['offset'];var _0x329b49=_0x19e474?_0x5496cb[_0x3013('0x1e')]:_0x3048b9[_0x3013('0x1c')]+_0x3048b9[_0x3013('0x1f')];var _0x508059;if(_0x329b49>=_0x552552){_0x329b49=_0x552552;_0x508059=0xc8;}else{_0x508059=0xce;}_0x291c1f[_0x3013('0x19')](_0x508059);return _0x291c1f[_0x3013('0x20')]('Content-Range',_0x34ccd3+'-'+_0x329b49+'/'+_0x552552)[_0x3013('0x1b')](_0x5496cb);}return null;};}function patchUpdates(_0xcfb0b7){return function(_0x4c5f8f){try{jsonpatch[_0x3013('0x21')](_0x4c5f8f,_0xcfb0b7,!![]);}catch(_0x232995){return BPromise[_0x3013('0x22')](_0x232995);}return _0x4c5f8f[_0x3013('0x23')]();};}function saveUpdates(_0x43348d,_0x1f1bd5){return function(_0x21f07f){if(_0x21f07f){return _0x21f07f[_0x3013('0x24')](_0x43348d)[_0x3013('0x25')](function(_0x5af004){return _0x5af004;});}return null;};}function removeEntity(_0x497089,_0x42c932){return function(_0x2e8ad6){if(_0x2e8ad6){return _0x2e8ad6[_0x3013('0x26')]()['then'](function(){_0x497089['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5f15ec,_0x4406b5){return function(_0x5de386){if(!_0x5de386){_0x5f15ec[_0x3013('0x18')](0x194);}return _0x5de386;};}function handleError(_0x56f167,_0x123c09){_0x123c09=_0x123c09||0x1f4;return function(_0x2c9332){logger[_0x3013('0x27')](_0x2c9332[_0x3013('0x28')]);if(_0x2c9332[_0x3013('0x29')]){delete _0x2c9332['name'];}_0x56f167[_0x3013('0x19')](_0x123c09)[_0x3013('0x2a')](_0x2c9332);};}exports[_0x3013('0x2b')]=function(_0x56fde9,_0x6e2cf1){var _0x2a6ea9={},_0x5d81fc={},_0x2f8547={'count':0x0,'rows':[]};var _0x10caf8=_[_0x3013('0x2c')](db[_0x3013('0x2d')][_0x3013('0x2e')],function(_0x2c2ebb){return{'name':_0x2c2ebb[_0x3013('0x2f')],'type':_0x2c2ebb[_0x3013('0x30')]['key']};});_0x5d81fc['model']=_['map'](_0x10caf8,_0x3013('0x29'));_0x5d81fc[_0x3013('0x31')]=_['keys'](_0x56fde9[_0x3013('0x31')]);_0x5d81fc[_0x3013('0x32')]=_[_0x3013('0x33')](_0x5d81fc[_0x3013('0x34')],_0x5d81fc['query']);_0x2a6ea9[_0x3013('0x35')]=_[_0x3013('0x33')](_0x5d81fc[_0x3013('0x34')],qs[_0x3013('0x36')](_0x56fde9['query'][_0x3013('0x36')]));_0x2a6ea9['attributes']=_0x2a6ea9[_0x3013('0x35')][_0x3013('0x37')]?_0x2a6ea9[_0x3013('0x35')]:_0x5d81fc[_0x3013('0x34')];if(!_0x56fde9['query'][_0x3013('0x38')]('nolimit')){_0x2a6ea9[_0x3013('0x1f')]=qs['limit'](_0x56fde9[_0x3013('0x31')][_0x3013('0x1f')]);_0x2a6ea9[_0x3013('0x1c')]=qs[_0x3013('0x1c')](_0x56fde9[_0x3013('0x31')][_0x3013('0x1c')]);}_0x2a6ea9[_0x3013('0x39')]=qs[_0x3013('0x3a')](_0x56fde9[_0x3013('0x31')][_0x3013('0x3a')]);_0x2a6ea9[_0x3013('0x3b')]=qs['filters'](_['pick'](_0x56fde9[_0x3013('0x31')],_0x5d81fc['filters']),_0x10caf8);if(_0x56fde9[_0x3013('0x31')][_0x3013('0x3c')]){_0x2a6ea9[_0x3013('0x3b')]=_[_0x3013('0x3d')](_0x2a6ea9['where'],{'$or':_['map'](_0x10caf8,function(_0xc6073e){if(_0xc6073e[_0x3013('0x30')]!==_0x3013('0x3e')){var _0xde0c72={};_0xde0c72[_0xc6073e[_0x3013('0x29')]]={'$like':'%'+_0x56fde9[_0x3013('0x31')]['filter']+'%'};return _0xde0c72;}})});}_0x2a6ea9=_['merge']({},_0x2a6ea9,_0x56fde9['options']);var _0x5b4537={'where':_0x2a6ea9[_0x3013('0x3b')]};return db[_0x3013('0x2d')][_0x3013('0x1e')](_0x5b4537)[_0x3013('0x25')](function(_0x1e60bf){_0x2f8547[_0x3013('0x1e')]=_0x1e60bf;if(_0x56fde9[_0x3013('0x31')][_0x3013('0x3f')]){_0x2a6ea9[_0x3013('0x40')]=[{'all':!![]}];}return db[_0x3013('0x2d')][_0x3013('0x41')](_0x2a6ea9);})['then'](function(_0x4fdc57){_0x2f8547[_0x3013('0x42')]=_0x4fdc57;return _0x2f8547;})[_0x3013('0x25')](respondWithFilteredResult(_0x6e2cf1,_0x2a6ea9))[_0x3013('0x43')](handleError(_0x6e2cf1,null));};exports[_0x3013('0x44')]=function(_0x4ebeac,_0x378f01){var _0x48ca6e={'raw':![],'where':{'id':_0x4ebeac[_0x3013('0x45')]['id']}},_0x3a96f2={};_0x3a96f2[_0x3013('0x34')]=_[_0x3013('0x46')](db[_0x3013('0x2d')][_0x3013('0x2e')]);_0x3a96f2[_0x3013('0x31')]=_[_0x3013('0x46')](_0x4ebeac[_0x3013('0x31')]);_0x3a96f2[_0x3013('0x32')]=_[_0x3013('0x33')](_0x3a96f2['model'],_0x3a96f2['query']);_0x48ca6e['attributes']=_[_0x3013('0x33')](_0x3a96f2['model'],qs[_0x3013('0x36')](_0x4ebeac[_0x3013('0x31')][_0x3013('0x36')]));_0x48ca6e['attributes']=_0x48ca6e[_0x3013('0x35')][_0x3013('0x37')]?_0x48ca6e['attributes']:_0x3a96f2[_0x3013('0x34')];if(_0x4ebeac[_0x3013('0x31')]['includeAll']){_0x48ca6e[_0x3013('0x40')]=[{'all':!![]}];}_0x48ca6e=_[_0x3013('0x3d')]({},_0x48ca6e,_0x4ebeac[_0x3013('0x47')]);return db[_0x3013('0x2d')]['find'](_0x48ca6e)[_0x3013('0x25')](handleEntityNotFound(_0x378f01,null))[_0x3013('0x25')](respondWithResult(_0x378f01,null))[_0x3013('0x43')](handleError(_0x378f01,null));};exports[_0x3013('0x48')]=function(_0x14c247,_0x24d55d){return db[_0x3013('0x2d')]['create'](_0x14c247[_0x3013('0x49')],{})[_0x3013('0x25')](respondWithResult(_0x24d55d,0xc9))[_0x3013('0x43')](handleError(_0x24d55d,null));};exports[_0x3013('0x24')]=function(_0x5cb538,_0x16ed93){if(_0x5cb538[_0x3013('0x49')]['id']){delete _0x5cb538[_0x3013('0x49')]['id'];}return db[_0x3013('0x2d')][_0x3013('0x4a')]({'where':{'id':_0x5cb538['params']['id']}})['then'](handleEntityNotFound(_0x16ed93,null))['then'](saveUpdates(_0x5cb538[_0x3013('0x49')],null))[_0x3013('0x25')](respondWithResult(_0x16ed93,null))[_0x3013('0x43')](handleError(_0x16ed93,null));};exports['destroy']=function(_0x5ad972,_0x252468){return db[_0x3013('0x2d')][_0x3013('0x4a')]({'where':{'id':_0x5ad972[_0x3013('0x45')]['id']}})[_0x3013('0x25')](handleEntityNotFound(_0x252468,null))[_0x3013('0x25')](removeEntity(_0x252468,null))[_0x3013('0x43')](handleError(_0x252468,null));};exports['getConfigurations']=function(_0x4fa2bb,_0x265f67,_0x45a263){var _0x5bc75f={};var _0x359027={};var _0xa29bf8;var _0x2b668c;return db[_0x3013('0x2d')]['findOne']({'where':{'id':_0x4fa2bb[_0x3013('0x45')]['id']}})['then'](handleEntityNotFound(_0x265f67,null))[_0x3013('0x25')](function(_0x2aa338){if(_0x2aa338){_0xa29bf8=_0x2aa338;_0x359027[_0x3013('0x34')]=_[_0x3013('0x46')](db['SalesforceConfiguration'][_0x3013('0x2e')]);_0x359027[_0x3013('0x31')]=_[_0x3013('0x46')](_0x4fa2bb[_0x3013('0x31')]);_0x359027[_0x3013('0x32')]=_[_0x3013('0x33')](_0x359027[_0x3013('0x34')],_0x359027[_0x3013('0x31')]);_0x5bc75f[_0x3013('0x35')]=_[_0x3013('0x33')](_0x359027[_0x3013('0x34')],qs[_0x3013('0x36')](_0x4fa2bb[_0x3013('0x31')][_0x3013('0x36')]));_0x5bc75f[_0x3013('0x35')]=_0x5bc75f[_0x3013('0x35')][_0x3013('0x37')]?_0x5bc75f['attributes']:_0x359027[_0x3013('0x34')];_0x5bc75f[_0x3013('0x39')]=qs['sort'](_0x4fa2bb[_0x3013('0x31')]['sort']);_0x5bc75f[_0x3013('0x3b')]=qs[_0x3013('0x32')](_[_0x3013('0x4b')](_0x4fa2bb['query'],_0x359027[_0x3013('0x32')]));if(_0x4fa2bb[_0x3013('0x31')][_0x3013('0x3c')]){_0x5bc75f['where']=_['merge'](_0x5bc75f[_0x3013('0x3b')],{'$or':_[_0x3013('0x2c')](_0x5bc75f[_0x3013('0x35')],function(_0x449eed){var _0x3e7871={};_0x3e7871[_0x449eed]={'$like':'%'+_0x4fa2bb['query'][_0x3013('0x3c')]+'%'};return _0x3e7871;})});}_0x5bc75f=_['merge']({},_0x5bc75f,_0x4fa2bb['options']);return _0xa29bf8['getConfigurations'](_0x5bc75f);}})[_0x3013('0x25')](function(_0x4b6ca7){if(_0x4b6ca7){_0x2b668c=_0x4b6ca7[_0x3013('0x37')];if(!_0x4fa2bb[_0x3013('0x31')][_0x3013('0x38')](_0x3013('0x4c'))){_0x5bc75f[_0x3013('0x1f')]=qs[_0x3013('0x1f')](_0x4fa2bb[_0x3013('0x31')][_0x3013('0x1f')]);_0x5bc75f[_0x3013('0x1c')]=qs[_0x3013('0x1c')](_0x4fa2bb[_0x3013('0x31')][_0x3013('0x1c')]);}return _0xa29bf8['getConfigurations'](_0x5bc75f);}})[_0x3013('0x25')](function(_0x6a4960){if(_0x6a4960){return _0x6a4960?{'count':_0x2b668c,'rows':_0x6a4960}:null;}})[_0x3013('0x25')](respondWithResult(_0x265f67,null))[_0x3013('0x43')](handleError(_0x265f67,null));};exports['addConfiguration']=function(_0x2e67de,_0x2a2e51,_0x1ea9c7){if(_0x2e67de['body']['id']){delete _0x2e67de[_0x3013('0x49')]['id'];}return db[_0x3013('0x2d')]['findOne']({'where':{'id':_0x2e67de[_0x3013('0x45')]['id']}})[_0x3013('0x25')](handleEntityNotFound(_0x2a2e51,null))[_0x3013('0x25')](function(_0x4e0825){if(_0x4e0825){_0x2e67de[_0x3013('0x49')][_0x3013('0x4d')]=_0x4e0825['id'];_0x2e67de['body'][_0x3013('0x4e')]=integrations[_0x3013('0x4f')](_0x2e67de[_0x3013('0x49')][_0x3013('0x50')],_0x2e67de[_0x3013('0x49')]['type']);_0x2e67de['body'][_0x3013('0x51')]=integrations[_0x3013('0x52')](_0x2e67de['body'][_0x3013('0x50')],_0x2e67de[_0x3013('0x49')][_0x3013('0x30')]);return db[_0x3013('0x53')][_0x3013('0x48')](_0x2e67de[_0x3013('0x49')],{'include':[{'model':db[_0x3013('0x54')],'as':_0x3013('0x4e')},{'model':db[_0x3013('0x54')],'as':_0x3013('0x51')}]});}return null;})[_0x3013('0x25')](respondWithResult(_0x2a2e51,null))['catch'](handleError(_0x2a2e51,null));};exports['getFields']=function(_0x3f1d89,_0x39d8fb,_0x4f47ca){var _0x278a82;var _0x1cc358='';var _0x395f0c='Task';return db['SalesforceAccount'][_0x3013('0x55')]({'where':{'id':_0x3f1d89[_0x3013('0x45')]['id']},'attributes':['id',_0x3013('0x56'),_0x3013('0x57'),_0x3013('0x58'),_0x3013('0x59'),_0x3013('0x5a'),_0x3013('0x5b')]})[_0x3013('0x25')](handleEntityNotFound(_0x39d8fb,null))[_0x3013('0x25')](function(_0x1abf19){if(_0x1abf19){_0x1cc358=_0x1abf19[_0x3013('0x56')];var _0x53fe22=_0x1cc358[_0x3013('0x5c')](-0x1);if(_0x53fe22==='/'){_0x1cc358=_0x1cc358[_0x3013('0x5d')](0x0,_0x1cc358[_0x3013('0x5e')](_0x53fe22));}_0x278a82=new jsforce['Connection']({'oauth2':{'loginUrl':_0x1cc358,'clientId':_0x1abf19['clientId'],'clientSecret':_0x1abf19[_0x3013('0x58')]}});return _0x278a82[_0x3013('0x5f')](_0x1abf19[_0x3013('0x59')],_0x1abf19[_0x3013('0x5a')][_0x3013('0x60')](_0x1abf19[_0x3013('0x5b')]));}})['then'](function(_0x20c63c){if(_0x20c63c){if(!_[_0x3013('0x61')](_0x3f1d89[_0x3013('0x31')][_0x3013('0x62')])){_0x395f0c=_0x3f1d89[_0x3013('0x31')]['ticketType'];}return _0x278a82[_0x3013('0x63')](_0x395f0c)[_0x3013('0x64')]();}})[_0x3013('0x25')](function(_0x40bd36){var _0xb5741c=[_0x3013('0x65'),_0x3013('0x66'),_0x3013('0x67'),'IsRecurrence',_0x3013('0x68'),'Description'];var _0x501672=[_0x3013('0x69'),_0x3013('0x6a'),'picklist',_0x3013('0x6b'),_0x3013('0x6c'),_0x3013('0x6d'),_0x3013('0x6e')];if(_0x40bd36){_['remove'](_0x40bd36[_0x3013('0x36')],function(_0x5a2f7a){return _0xb5741c['includes'](_0x5a2f7a[_0x3013('0x29')])||!_0x501672[_0x3013('0x6f')](_0x5a2f7a[_0x3013('0x30')]);});return{'count':_0x40bd36[_0x3013('0x36')][_0x3013('0x37')],'rows':_['map'](_0x40bd36[_0x3013('0x36')],function(_0x3110e7){return{'id':_0x3110e7[_0x3013('0x29')],'name':_0x3110e7[_0x3013('0x70')],'custom':_0x3110e7[_0x3013('0x71')],'options':_0x3110e7[_0x3013('0x72')][_0x3013('0x37')]>0x0?_[_0x3013('0x2c')](_0x3110e7[_0x3013('0x72')],function(_0xa23953){return{'name':_0xa23953[_0x3013('0x70')],'value':_0xa23953[_0x3013('0x73')]};}):_0x3110e7[_0x3013('0x30')]==_0x3013('0x6b')?[{'name':_0x3013('0x74'),'value':_0x3013('0x75')},{'name':'False','value':_0x3013('0x76')}]:[]};})};}})[_0x3013('0x25')](respondWithResult(_0x39d8fb,null))['catch'](function(_0x36da67){var _0xa8a1f0=_0x3f1d89['query'][_0x3013('0x77')]?0x1f4:_0x36da67[_0x3013('0x78')]||0x1f4;logger[_0x3013('0x27')](_0x3013('0x79'),_0x3013('0x7a'),_0xa8a1f0,JSON[_0x3013('0x7b')](_0x36da67));delete _0x36da67[_0x3013('0x29')];if(_0xa8a1f0===0x191){_0xa8a1f0=0x190;}_0x39d8fb[_0x3013('0x19')](_0xa8a1f0)[_0x3013('0x2a')](_0x3f1d89[_0x3013('0x31')][_0x3013('0x77')]?{'message':_0x3013('0x7c'),'statusCode':_0x36da67[_0x3013('0x78')]}:_0x36da67);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index 602600d..6ebcd13 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 _0xbd94=['exports','define','SalesforceAccount','lodash','api','bluebird','request-promise','path','../../config/environment','./intSalesforceAccount.attributes'];(function(_0x1f46e2,_0x16ec34){var _0x236421=function(_0x7b62a){while(--_0x7b62a){_0x1f46e2['push'](_0x1f46e2['shift']());}};_0x236421(++_0x16ec34);}(_0xbd94,0xfd));var _0x4bd9=function(_0x1a7846,_0x59723e){_0x1a7846=_0x1a7846-0x0;var _0x48049=_0xbd94[_0x1a7846];return _0x48049;};'use strict';var _=require(_0x4bd9('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x4bd9('0x1'));var moment=require('moment');var BPromise=require(_0x4bd9('0x2'));var rp=require(_0x4bd9('0x3'));var fs=require('fs');var path=require(_0x4bd9('0x4'));var rimraf=require('rimraf');var config=require(_0x4bd9('0x5'));var attributes=require(_0x4bd9('0x6'));var integrations=require('../../components/integrations/configuration');module[_0x4bd9('0x7')]=function(_0x2011f9,_0x513442){return _0x2011f9[_0x4bd9('0x8')](_0x4bd9('0x9'),attributes,{'tableName':'int_salesforce_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x79e4=['SalesforceAccount','int_salesforce_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSalesforceAccount.attributes','../../components/integrations/configuration','exports'];(function(_0x3ab928,_0x2b990b){var _0xf47692=function(_0x311b8e){while(--_0x311b8e){_0x3ab928['push'](_0x3ab928['shift']());}};_0xf47692(++_0x2b990b);}(_0x79e4,0x15b));var _0x479e=function(_0x3b1e4c,_0x58a6ce){_0x3b1e4c=_0x3b1e4c-0x0;var _0xa0dd63=_0x79e4[_0x3b1e4c];return _0xa0dd63;};'use strict';var _=require(_0x479e('0x0'));var util=require(_0x479e('0x1'));var logger=require(_0x479e('0x2'))(_0x479e('0x3'));var moment=require(_0x479e('0x4'));var BPromise=require(_0x479e('0x5'));var rp=require(_0x479e('0x6'));var fs=require('fs');var path=require(_0x479e('0x7'));var rimraf=require(_0x479e('0x8'));var config=require(_0x479e('0x9'));var attributes=require(_0x479e('0xa'));var integrations=require(_0x479e('0xb'));module[_0x479e('0xc')]=function(_0x571949,_0x58bfce){return _0x571949['define'](_0x479e('0xd'),attributes,{'tableName':_0x479e('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js b/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js index 0c1b18d..725f609 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 _0xf352=['SalesforceAccount','find','raw','model','then','ShowSalesforceAccount','debug','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request\x20sent','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','SalesforceAccount,\x20%s,\x20%s','message','result','GetSalesforceAccount','findAll','options','where','attributes','limit','include','map','info','catch'];(function(_0x551303,_0x4132c3){var _0x22cbd3=function(_0x146a3f){while(--_0x146a3f){_0x551303['push'](_0x551303['shift']());}};_0x22cbd3(++_0x4132c3);}(_0xf352,0xdf));var _0x2f35=function(_0x586363,_0x37701a){_0x586363=_0x586363-0x0;var _0xbec4c9=_0xf352[_0x586363];return _0xbec4c9;};'use strict';var _=require(_0x2f35('0x0'));var util=require(_0x2f35('0x1'));var moment=require(_0x2f35('0x2'));var BPromise=require('bluebird');var rs=require(_0x2f35('0x3'));var fs=require('fs');var Redis=require(_0x2f35('0x4'));var db=require(_0x2f35('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x2f35('0x6'))(_0x2f35('0x7'));var config=require(_0x2f35('0x8'));var jayson=require(_0x2f35('0x9'));var client=jayson[_0x2f35('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3443f4,_0x2a3888,_0x57ac72){return new BPromise(function(_0x41ceee,_0x2aa51b){return client['request'](_0x3443f4,_0x57ac72)['then'](function(_0x50905e){logger['info']('SalesforceAccount,\x20%s,\x20%s',_0x2a3888,_0x2f35('0xb'));logger['debug'](_0x2f35('0xc'),_0x2a3888,_0x2f35('0xb'),JSON[_0x2f35('0xd')](_0x50905e));if(_0x50905e[_0x2f35('0xe')]){if(_0x50905e[_0x2f35('0xe')][_0x2f35('0xf')]===0x1f4){logger[_0x2f35('0xe')](_0x2f35('0x10'),_0x2a3888,_0x50905e[_0x2f35('0xe')][_0x2f35('0x11')]);return _0x2aa51b(_0x50905e['error'][_0x2f35('0x11')]);}logger[_0x2f35('0xe')](_0x2f35('0x10'),_0x2a3888,_0x50905e[_0x2f35('0xe')][_0x2f35('0x11')]);return _0x41ceee(_0x50905e[_0x2f35('0xe')][_0x2f35('0x11')]);}else{logger['info']('SalesforceAccount,\x20%s,\x20%s',_0x2a3888,'request\x20sent');_0x41ceee(_0x50905e[_0x2f35('0x12')][_0x2f35('0x11')]);}})['catch'](function(_0x107fc6){logger['error'](_0x2f35('0x10'),_0x2a3888,_0x107fc6);_0x2aa51b(_0x107fc6);});});}exports[_0x2f35('0x13')]=function(_0x410b82){var _0x150469=this;return new Promise(function(_0x3b5e5d,_0x260198){return db['SalesforceAccount'][_0x2f35('0x14')]({'raw':_0x410b82[_0x2f35('0x15')]?_0x410b82['options']['raw']===undefined?!![]:![]:!![],'where':_0x410b82['options']?_0x410b82[_0x2f35('0x15')][_0x2f35('0x16')]||null:null,'attributes':_0x410b82[_0x2f35('0x15')]?_0x410b82[_0x2f35('0x15')][_0x2f35('0x17')]||null:null,'limit':_0x410b82[_0x2f35('0x15')]?_0x410b82[_0x2f35('0x15')][_0x2f35('0x18')]||null:null,'include':_0x410b82[_0x2f35('0x15')]?_0x410b82[_0x2f35('0x15')][_0x2f35('0x19')]?_[_0x2f35('0x1a')](_0x410b82[_0x2f35('0x15')]['include'],function(_0x30d38c){return{'model':db[_0x30d38c['model']],'as':_0x30d38c['as'],'attributes':_0x30d38c[_0x2f35('0x17')],'include':_0x30d38c['include']?_[_0x2f35('0x1a')](_0x30d38c['include'],function(_0x16cc4a){return{'model':db[_0x16cc4a['model']],'as':_0x16cc4a['as'],'attributes':_0x16cc4a[_0x2f35('0x17')],'include':_0x16cc4a[_0x2f35('0x19')]?_[_0x2f35('0x1a')](_0x16cc4a['include'],function(_0x2373a4){return{'model':db[_0x2373a4['model']],'as':_0x2373a4['as'],'attributes':_0x2373a4[_0x2f35('0x17')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x19ddd0){logger[_0x2f35('0x1b')](_0x2f35('0x13'),_0x410b82);logger['debug'](_0x2f35('0x13'),_0x410b82,JSON[_0x2f35('0xd')](_0x19ddd0));_0x3b5e5d(_0x19ddd0);})[_0x2f35('0x1c')](function(_0x392620){logger[_0x2f35('0xe')](_0x2f35('0x13'),_0x392620[_0x2f35('0x11')],_0x410b82);_0x260198(_0x150469['error'](0x1f4,_0x392620[_0x2f35('0x11')]));});});};exports['ShowSalesforceAccount']=function(_0x20e13c){var _0x12d7f2=this;return new Promise(function(_0x3d24bf,_0x5294c8){return db[_0x2f35('0x1d')][_0x2f35('0x1e')]({'raw':_0x20e13c[_0x2f35('0x15')]?_0x20e13c['options'][_0x2f35('0x1f')]===undefined?!![]:![]:!![],'where':_0x20e13c[_0x2f35('0x15')]?_0x20e13c[_0x2f35('0x15')][_0x2f35('0x16')]||null:null,'attributes':_0x20e13c['options']?_0x20e13c[_0x2f35('0x15')][_0x2f35('0x17')]||null:null,'include':_0x20e13c[_0x2f35('0x15')]?_0x20e13c['options'][_0x2f35('0x19')]?_[_0x2f35('0x1a')](_0x20e13c['options'][_0x2f35('0x19')],function(_0x428a85){return{'model':db[_0x428a85[_0x2f35('0x20')]],'as':_0x428a85['as'],'attributes':_0x428a85['attributes'],'include':_0x428a85[_0x2f35('0x19')]?_['map'](_0x428a85[_0x2f35('0x19')],function(_0x5daf78){return{'model':db[_0x5daf78[_0x2f35('0x20')]],'as':_0x5daf78['as'],'attributes':_0x5daf78[_0x2f35('0x17')],'include':_0x5daf78[_0x2f35('0x19')]?_['map'](_0x5daf78[_0x2f35('0x19')],function(_0x20d16a){return{'model':db[_0x20d16a[_0x2f35('0x20')]],'as':_0x20d16a['as'],'attributes':_0x20d16a[_0x2f35('0x17')]};}):[]};}):[]};}):[]:[]})[_0x2f35('0x21')](function(_0x3e20aa){logger[_0x2f35('0x1b')](_0x2f35('0x22'),_0x20e13c);logger[_0x2f35('0x23')](_0x2f35('0x22'),_0x20e13c,JSON[_0x2f35('0xd')](_0x3e20aa));_0x3d24bf(_0x3e20aa);})[_0x2f35('0x1c')](function(_0xe54a70){logger['error'](_0x2f35('0x22'),_0xe54a70['message'],_0x20e13c);_0x5294c8(_0x12d7f2[_0x2f35('0xe')](0x1f4,_0xe54a70[_0x2f35('0x11')]));});});}; \ No newline at end of file +var _0xe685=['catch','ShowSalesforceAccount','find','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','then','info','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','SalesforceAccount,\x20%s,\x20%s','message','result','GetSalesforceAccount','SalesforceAccount','findAll','options','raw','attributes','include','map','model'];(function(_0x5353d6,_0xc2e060){var _0x465292=function(_0x259aed){while(--_0x259aed){_0x5353d6['push'](_0x5353d6['shift']());}};_0x465292(++_0xc2e060);}(_0xe685,0x1bd));var _0x5e68=function(_0x90a948,_0x4f5036){_0x90a948=_0x90a948-0x0;var _0x1302d9=_0xe685[_0x90a948];return _0x1302d9;};'use strict';var _=require(_0x5e68('0x0'));var util=require(_0x5e68('0x1'));var moment=require(_0x5e68('0x2'));var BPromise=require(_0x5e68('0x3'));var rs=require(_0x5e68('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5e68('0x5'))['db'];var utils=require(_0x5e68('0x6'));var logger=require(_0x5e68('0x7'))(_0x5e68('0x8'));var config=require('../../config/environment');var jayson=require(_0x5e68('0x9'));var client=jayson['client'][_0x5e68('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4f5957,_0x3fbec7,_0x15624f){return new BPromise(function(_0x45dfcb,_0x3be51c){return client['request'](_0x4f5957,_0x15624f)[_0x5e68('0xb')](function(_0x5a23e1){logger[_0x5e68('0xc')]('SalesforceAccount,\x20%s,\x20%s',_0x3fbec7,_0x5e68('0xd'));logger[_0x5e68('0xe')](_0x5e68('0xf'),_0x3fbec7,_0x5e68('0xd'),JSON[_0x5e68('0x10')](_0x5a23e1));if(_0x5a23e1[_0x5e68('0x11')]){if(_0x5a23e1[_0x5e68('0x11')][_0x5e68('0x12')]===0x1f4){logger[_0x5e68('0x11')](_0x5e68('0x13'),_0x3fbec7,_0x5a23e1['error'][_0x5e68('0x14')]);return _0x3be51c(_0x5a23e1[_0x5e68('0x11')][_0x5e68('0x14')]);}logger[_0x5e68('0x11')](_0x5e68('0x13'),_0x3fbec7,_0x5a23e1['error']['message']);return _0x45dfcb(_0x5a23e1[_0x5e68('0x11')][_0x5e68('0x14')]);}else{logger[_0x5e68('0xc')](_0x5e68('0x13'),_0x3fbec7,'request\x20sent');_0x45dfcb(_0x5a23e1[_0x5e68('0x15')][_0x5e68('0x14')]);}})['catch'](function(_0x2e2af9){logger[_0x5e68('0x11')](_0x5e68('0x13'),_0x3fbec7,_0x2e2af9);_0x3be51c(_0x2e2af9);});});}exports[_0x5e68('0x16')]=function(_0x4ab830){var _0x55195c=this;return new Promise(function(_0x5a22b4,_0x274cc4){return db[_0x5e68('0x17')][_0x5e68('0x18')]({'raw':_0x4ab830[_0x5e68('0x19')]?_0x4ab830[_0x5e68('0x19')][_0x5e68('0x1a')]===undefined?!![]:![]:!![],'where':_0x4ab830[_0x5e68('0x19')]?_0x4ab830['options']['where']||null:null,'attributes':_0x4ab830[_0x5e68('0x19')]?_0x4ab830[_0x5e68('0x19')][_0x5e68('0x1b')]||null:null,'limit':_0x4ab830[_0x5e68('0x19')]?_0x4ab830[_0x5e68('0x19')]['limit']||null:null,'include':_0x4ab830[_0x5e68('0x19')]?_0x4ab830['options'][_0x5e68('0x1c')]?_[_0x5e68('0x1d')](_0x4ab830[_0x5e68('0x19')]['include'],function(_0x1b6c7e){return{'model':db[_0x1b6c7e[_0x5e68('0x1e')]],'as':_0x1b6c7e['as'],'attributes':_0x1b6c7e[_0x5e68('0x1b')],'include':_0x1b6c7e[_0x5e68('0x1c')]?_['map'](_0x1b6c7e[_0x5e68('0x1c')],function(_0x103ce1){return{'model':db[_0x103ce1['model']],'as':_0x103ce1['as'],'attributes':_0x103ce1[_0x5e68('0x1b')],'include':_0x103ce1[_0x5e68('0x1c')]?_['map'](_0x103ce1[_0x5e68('0x1c')],function(_0x21a582){return{'model':db[_0x21a582[_0x5e68('0x1e')]],'as':_0x21a582['as'],'attributes':_0x21a582[_0x5e68('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x5e68('0xb')](function(_0x3cf172){logger[_0x5e68('0xc')]('GetSalesforceAccount',_0x4ab830);logger['debug']('GetSalesforceAccount',_0x4ab830,JSON[_0x5e68('0x10')](_0x3cf172));_0x5a22b4(_0x3cf172);})[_0x5e68('0x1f')](function(_0x4f0ee9){logger[_0x5e68('0x11')](_0x5e68('0x16'),_0x4f0ee9[_0x5e68('0x14')],_0x4ab830);_0x274cc4(_0x55195c[_0x5e68('0x11')](0x1f4,_0x4f0ee9['message']));});});};exports[_0x5e68('0x20')]=function(_0x1b6b12){var _0x38285b=this;return new Promise(function(_0x3206cd,_0x5b3c1a){return db[_0x5e68('0x17')][_0x5e68('0x21')]({'raw':_0x1b6b12['options']?_0x1b6b12[_0x5e68('0x19')][_0x5e68('0x1a')]===undefined?!![]:![]:!![],'where':_0x1b6b12[_0x5e68('0x19')]?_0x1b6b12['options']['where']||null:null,'attributes':_0x1b6b12[_0x5e68('0x19')]?_0x1b6b12[_0x5e68('0x19')][_0x5e68('0x1b')]||null:null,'include':_0x1b6b12[_0x5e68('0x19')]?_0x1b6b12[_0x5e68('0x19')][_0x5e68('0x1c')]?_[_0x5e68('0x1d')](_0x1b6b12[_0x5e68('0x19')][_0x5e68('0x1c')],function(_0x5baadd){return{'model':db[_0x5baadd[_0x5e68('0x1e')]],'as':_0x5baadd['as'],'attributes':_0x5baadd['attributes'],'include':_0x5baadd['include']?_[_0x5e68('0x1d')](_0x5baadd['include'],function(_0x42835f){return{'model':db[_0x42835f[_0x5e68('0x1e')]],'as':_0x42835f['as'],'attributes':_0x42835f[_0x5e68('0x1b')],'include':_0x42835f['include']?_[_0x5e68('0x1d')](_0x42835f['include'],function(_0x35c07d){return{'model':db[_0x35c07d[_0x5e68('0x1e')]],'as':_0x35c07d['as'],'attributes':_0x35c07d[_0x5e68('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x53fb04){logger['info']('ShowSalesforceAccount',_0x1b6b12);logger[_0x5e68('0xe')](_0x5e68('0x20'),_0x1b6b12,JSON[_0x5e68('0x10')](_0x53fb04));_0x3206cd(_0x53fb04);})['catch'](function(_0x20459a){logger[_0x5e68('0x11')](_0x5e68('0x20'),_0x20459a[_0x5e68('0x14')],_0x1b6b12);_0x5b3c1a(_0x38285b[_0x5e68('0x11')](0x1f4,_0x20459a[_0x5e68('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index bf3d8af..f5e345f 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(_0xa25359,_0x22c39f){var _0x3e0db1=function(_0x3061d0){while(--_0x3061d0){_0xa25359['push'](_0xa25359['shift']());}};_0x3e0db1(++_0x22c39f);}(_0x5f2f,0x73));var _0xf5f2=function(_0x422cc4,_0x6db5ad){_0x422cc4=_0x422cc4-0x0;var _0x1fcb75=_0x5f2f[_0x422cc4];return _0x1fcb75;};'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 _0x2032=['Router','fs-extra','../../components/interaction/service','../../config/environment','./intSalesforceConfiguration.controller','get','isAuthenticated','index','/:id','show','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','create','exports','util','path','connect-timeout'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x2032,0xd9));var _0x2203=function(_0x16e07c,_0x299196){_0x16e07c=_0x16e07c-0x0;var _0x79fb93=_0x2032[_0x16e07c];return _0x79fb93;};'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/fields',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['put']('/:id',auth['isAuthenticated'](),controller['update']);router['delete'](_0x2203('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x2203('0x13')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index 79b7d6f..f2fd85a 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 _0x22c9=['ENUM','contact_lead','contact','lead','account_contact_lead','account','nothing','sequelize','exports','STRING','Case','Task'];(function(_0x2f3065,_0x2ad936){var _0x1f37bd=function(_0x2da4f8){while(--_0x2da4f8){_0x2f3065['push'](_0x2f3065['shift']());}};_0x1f37bd(++_0x2ad936);}(_0x22c9,0x8b));var _0x922c=function(_0x5d09d9,_0x181abf){_0x5d09d9=_0x5d09d9-0x0;var _0x7ce182=_0x22c9[_0x5d09d9];return _0x7ce182;};'use strict';var Sequelize=require(_0x922c('0x0'));module[_0x922c('0x1')]={'name':{'type':Sequelize[_0x922c('0x2')]},'description':{'type':Sequelize[_0x922c('0x2')]},'ticketType':{'type':Sequelize['ENUM']('Task',_0x922c('0x3')),'defaultValue':_0x922c('0x4')},'moduleSearch':{'type':Sequelize[_0x922c('0x5')](_0x922c('0x6'),_0x922c('0x7'),_0x922c('0x8'),_0x922c('0x9'),_0x922c('0xa')),'defaultValue':_0x922c('0x6')},'moduleCreate':{'type':Sequelize[_0x922c('0x5')](_0x922c('0xb'),_0x922c('0x7'),_0x922c('0x8'),_0x922c('0xa')),'defaultValue':_0x922c('0x8')},'leadId':{'type':Sequelize[_0x922c('0x2')]},'additionalSearchAccount':{'type':Sequelize['STRING']},'additionalSearchContact':{'type':Sequelize['STRING']},'additionalSearchLead':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x1f98=['nothing','contact','account','sequelize','STRING','ENUM','Task','contact_lead','lead'];(function(_0x450abe,_0x936da){var _0x34606f=function(_0x1866e6){while(--_0x1866e6){_0x450abe['push'](_0x450abe['shift']());}};_0x34606f(++_0x936da);}(_0x1f98,0x11a));var _0x81f9=function(_0xddaeee,_0x4f5dad){_0xddaeee=_0xddaeee-0x0;var _0x1cbd0b=_0x1f98[_0xddaeee];return _0x1cbd0b;};'use strict';var Sequelize=require(_0x81f9('0x0'));module['exports']={'name':{'type':Sequelize[_0x81f9('0x1')]},'description':{'type':Sequelize[_0x81f9('0x1')]},'ticketType':{'type':Sequelize[_0x81f9('0x2')](_0x81f9('0x3'),'Case'),'defaultValue':_0x81f9('0x3')},'moduleSearch':{'type':Sequelize[_0x81f9('0x2')](_0x81f9('0x4'),'contact',_0x81f9('0x5'),'account_contact_lead','account'),'defaultValue':_0x81f9('0x4')},'moduleCreate':{'type':Sequelize['ENUM'](_0x81f9('0x6'),_0x81f9('0x7'),_0x81f9('0x5'),_0x81f9('0x8')),'defaultValue':_0x81f9('0x5')},'leadId':{'type':Sequelize['STRING']},'additionalSearchAccount':{'type':Sequelize['STRING']},'additionalSearchContact':{'type':Sequelize['STRING']},'additionalSearchLead':{'type':Sequelize[_0x81f9('0x1')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index e46892c..cb33fd4 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 _0x09a4=['getSubjects','getDescriptions','findOne','eml-format','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','destroy','then','error','stack','send','index','map','SalesforceConfiguration','fieldName','key','model','query','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','merge','type','options','includeAll','include','findAll','rows','catch','show','keys','find','create','body','params','getFields','SalesforceField','rawAttributes','filter','hasOwnProperty'];(function(_0x31407c,_0x236721){var _0x1077cf=function(_0x298f24){while(--_0x298f24){_0x31407c['push'](_0x31407c['shift']());}};_0x1077cf(++_0x236721);}(_0x09a4,0x147));var _0x409a=function(_0x41fb49,_0x241318){_0x41fb49=_0x41fb49-0x0;var _0x579de4=_0x09a4[_0x41fb49];return _0x579de4;};'use strict';var emlformat=require(_0x409a('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x409a('0x1'));var rp=require(_0x409a('0x2'));var moment=require(_0x409a('0x3'));var BPromise=require(_0x409a('0x4'));var Mustache=require('mustache');var util=require(_0x409a('0x5'));var path=require(_0x409a('0x6'));var sox=require(_0x409a('0x7'));var csv=require(_0x409a('0x8'));var ejs=require(_0x409a('0x9'));var fs=require('fs');var fs_extra=require(_0x409a('0xa'));var _=require(_0x409a('0xb'));var squel=require(_0x409a('0xc'));var crypto=require(_0x409a('0xd'));var jsforce=require(_0x409a('0xe'));var deskjs=require(_0x409a('0xf'));var toCsv=require('to-csv');var querystring=require(_0x409a('0x10'));var Papa=require('papaparse');var Redis=require(_0x409a('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x409a('0x12'));var as=require(_0x409a('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x409a('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x409a('0x15'));var licenseUtil=require(_0x409a('0x16'));var db=require(_0x409a('0x17'))['db'];function respondWithStatusCode(_0x4286ae,_0x19b595){_0x19b595=_0x19b595||0xcc;return function(_0x407117){if(_0x407117){return _0x4286ae[_0x409a('0x18')](_0x19b595);}return _0x4286ae[_0x409a('0x19')](_0x19b595)[_0x409a('0x1a')]();};}function respondWithResult(_0x4ff33a,_0x2b50cd){_0x2b50cd=_0x2b50cd||0xc8;return function(_0xd4ca32){if(_0xd4ca32){return _0x4ff33a[_0x409a('0x19')](_0x2b50cd)[_0x409a('0x1b')](_0xd4ca32);}};}function respondWithFilteredResult(_0x5ed815,_0x12a38c){return function(_0x3ce3dd){if(_0x3ce3dd){var _0x4fcebe=typeof _0x12a38c['offset']===_0x409a('0x1c')&&typeof _0x12a38c[_0x409a('0x1d')]==='undefined';var _0x5a8cb5=_0x3ce3dd[_0x409a('0x1e')];var _0x33e424=_0x4fcebe?0x0:_0x12a38c['offset'];var _0x31739a=_0x4fcebe?_0x3ce3dd[_0x409a('0x1e')]:_0x12a38c[_0x409a('0x1f')]+_0x12a38c[_0x409a('0x1d')];var _0x171335;if(_0x31739a>=_0x5a8cb5){_0x31739a=_0x5a8cb5;_0x171335=0xc8;}else{_0x171335=0xce;}_0x5ed815[_0x409a('0x19')](_0x171335);return _0x5ed815[_0x409a('0x20')](_0x409a('0x21'),_0x33e424+'-'+_0x31739a+'/'+_0x5a8cb5)['json'](_0x3ce3dd);}return null;};}function patchUpdates(_0x537e71){return function(_0x419c19){try{jsonpatch[_0x409a('0x22')](_0x419c19,_0x537e71,!![]);}catch(_0x1fb4bb){return BPromise[_0x409a('0x23')](_0x1fb4bb);}return _0x419c19[_0x409a('0x24')]();};}function saveUpdates(_0xe37972,_0x450083){return function(_0x40731f){if(_0x40731f){return _0x40731f['update'](_0xe37972)['then'](function(_0x342de3){return _0x342de3;});}return null;};}function removeEntity(_0x46de02,_0x5e4fe7){return function(_0x2d51ff){if(_0x2d51ff){return _0x2d51ff[_0x409a('0x25')]()[_0x409a('0x26')](function(){_0x46de02[_0x409a('0x19')](0xcc)[_0x409a('0x1a')]();});}};}function handleEntityNotFound(_0x49e7f3,_0xee595){return function(_0x16f969){if(!_0x16f969){_0x49e7f3[_0x409a('0x18')](0x194);}return _0x16f969;};}function handleError(_0x278811,_0x712dbc){_0x712dbc=_0x712dbc||0x1f4;return function(_0x9913dd){logger[_0x409a('0x27')](_0x9913dd[_0x409a('0x28')]);if(_0x9913dd['name']){delete _0x9913dd['name'];}_0x278811[_0x409a('0x19')](_0x712dbc)[_0x409a('0x29')](_0x9913dd);};}exports[_0x409a('0x2a')]=function(_0x14960d,_0x4c42f9){var _0x22143a={},_0x249ea4={},_0x5633ca={'count':0x0,'rows':[]};var _0x326797=_[_0x409a('0x2b')](db[_0x409a('0x2c')]['rawAttributes'],function(_0x448265){return{'name':_0x448265[_0x409a('0x2d')],'type':_0x448265['type'][_0x409a('0x2e')]};});_0x249ea4[_0x409a('0x2f')]=_[_0x409a('0x2b')](_0x326797,'name');_0x249ea4[_0x409a('0x30')]=_['keys'](_0x14960d[_0x409a('0x30')]);_0x249ea4[_0x409a('0x31')]=_[_0x409a('0x32')](_0x249ea4[_0x409a('0x2f')],_0x249ea4[_0x409a('0x30')]);_0x22143a['attributes']=_[_0x409a('0x32')](_0x249ea4[_0x409a('0x2f')],qs[_0x409a('0x33')](_0x14960d[_0x409a('0x30')][_0x409a('0x33')]));_0x22143a[_0x409a('0x34')]=_0x22143a['attributes'][_0x409a('0x35')]?_0x22143a[_0x409a('0x34')]:_0x249ea4['model'];if(!_0x14960d[_0x409a('0x30')]['hasOwnProperty'](_0x409a('0x36'))){_0x22143a[_0x409a('0x1d')]=qs[_0x409a('0x1d')](_0x14960d[_0x409a('0x30')]['limit']);_0x22143a[_0x409a('0x1f')]=qs[_0x409a('0x1f')](_0x14960d[_0x409a('0x30')][_0x409a('0x1f')]);}_0x22143a[_0x409a('0x37')]=qs[_0x409a('0x38')](_0x14960d[_0x409a('0x30')][_0x409a('0x38')]);_0x22143a[_0x409a('0x39')]=qs[_0x409a('0x31')](_[_0x409a('0x3a')](_0x14960d[_0x409a('0x30')],_0x249ea4['filters']),_0x326797);if(_0x14960d[_0x409a('0x30')]['filter']){_0x22143a[_0x409a('0x39')]=_[_0x409a('0x3b')](_0x22143a['where'],{'$or':_[_0x409a('0x2b')](_0x326797,function(_0x259359){if(_0x259359[_0x409a('0x3c')]!=='VIRTUAL'){var _0x1c67ec={};_0x1c67ec[_0x259359['name']]={'$like':'%'+_0x14960d[_0x409a('0x30')]['filter']+'%'};return _0x1c67ec;}})});}_0x22143a=_[_0x409a('0x3b')]({},_0x22143a,_0x14960d[_0x409a('0x3d')]);var _0x3e7e5f={'where':_0x22143a[_0x409a('0x39')]};return db[_0x409a('0x2c')][_0x409a('0x1e')](_0x3e7e5f)[_0x409a('0x26')](function(_0x17f245){_0x5633ca[_0x409a('0x1e')]=_0x17f245;if(_0x14960d[_0x409a('0x30')][_0x409a('0x3e')]){_0x22143a[_0x409a('0x3f')]=[{'all':!![]}];}return db['SalesforceConfiguration'][_0x409a('0x40')](_0x22143a);})['then'](function(_0x5131b0){_0x5633ca[_0x409a('0x41')]=_0x5131b0;return _0x5633ca;})['then'](respondWithFilteredResult(_0x4c42f9,_0x22143a))[_0x409a('0x42')](handleError(_0x4c42f9,null));};exports[_0x409a('0x43')]=function(_0x3d59b5,_0x332fc2){var _0x5f21ea={'raw':![],'where':{'id':_0x3d59b5['params']['id']}},_0x759d4={};_0x759d4[_0x409a('0x2f')]=_[_0x409a('0x44')](db[_0x409a('0x2c')]['rawAttributes']);_0x759d4[_0x409a('0x30')]=_[_0x409a('0x44')](_0x3d59b5[_0x409a('0x30')]);_0x759d4[_0x409a('0x31')]=_[_0x409a('0x32')](_0x759d4[_0x409a('0x2f')],_0x759d4[_0x409a('0x30')]);_0x5f21ea[_0x409a('0x34')]=_[_0x409a('0x32')](_0x759d4['model'],qs[_0x409a('0x33')](_0x3d59b5[_0x409a('0x30')][_0x409a('0x33')]));_0x5f21ea[_0x409a('0x34')]=_0x5f21ea['attributes']['length']?_0x5f21ea[_0x409a('0x34')]:_0x759d4[_0x409a('0x2f')];if(_0x3d59b5[_0x409a('0x30')]['includeAll']){_0x5f21ea[_0x409a('0x3f')]=[{'all':!![]}];}_0x5f21ea=_['merge']({},_0x5f21ea,_0x3d59b5[_0x409a('0x3d')]);return db['SalesforceConfiguration'][_0x409a('0x45')](_0x5f21ea)[_0x409a('0x26')](handleEntityNotFound(_0x332fc2,null))[_0x409a('0x26')](respondWithResult(_0x332fc2,null))['catch'](handleError(_0x332fc2,null));};exports[_0x409a('0x46')]=function(_0x180679,_0x59f305){return db[_0x409a('0x2c')]['create'](_0x180679['body'],{})[_0x409a('0x26')](respondWithResult(_0x59f305,0xc9))[_0x409a('0x42')](handleError(_0x59f305,null));};exports['update']=function(_0x48d77a,_0x25605b){if(_0x48d77a[_0x409a('0x47')]['id']){delete _0x48d77a[_0x409a('0x47')]['id'];}return db[_0x409a('0x2c')]['find']({'where':{'id':_0x48d77a[_0x409a('0x48')]['id']}})[_0x409a('0x26')](handleEntityNotFound(_0x25605b,null))[_0x409a('0x26')](saveUpdates(_0x48d77a[_0x409a('0x47')],null))['then'](respondWithResult(_0x25605b,null))[_0x409a('0x42')](handleError(_0x25605b,null));};exports['destroy']=function(_0x2471f8,_0x5db48b){return db[_0x409a('0x2c')][_0x409a('0x45')]({'where':{'id':_0x2471f8[_0x409a('0x48')]['id']}})[_0x409a('0x26')](handleEntityNotFound(_0x5db48b,null))['then'](removeEntity(_0x5db48b,null))[_0x409a('0x42')](handleError(_0x5db48b,null));};exports[_0x409a('0x49')]=function(_0x46b395,_0x202079,_0x150235){var _0x213d3c={};var _0xec5fe6={};var _0xce5837;var _0x5ed63b;return db[_0x409a('0x2c')]['findOne']({'where':{'id':_0x46b395[_0x409a('0x48')]['id']}})['then'](handleEntityNotFound(_0x202079,null))[_0x409a('0x26')](function(_0x371ca5){if(_0x371ca5){_0xce5837=_0x371ca5;_0xec5fe6[_0x409a('0x2f')]=_[_0x409a('0x44')](db[_0x409a('0x4a')][_0x409a('0x4b')]);_0xec5fe6[_0x409a('0x30')]=_['keys'](_0x46b395[_0x409a('0x30')]);_0xec5fe6[_0x409a('0x31')]=_[_0x409a('0x32')](_0xec5fe6[_0x409a('0x2f')],_0xec5fe6[_0x409a('0x30')]);_0x213d3c['attributes']=_[_0x409a('0x32')](_0xec5fe6['model'],qs[_0x409a('0x33')](_0x46b395[_0x409a('0x30')]['fields']));_0x213d3c[_0x409a('0x34')]=_0x213d3c['attributes'][_0x409a('0x35')]?_0x213d3c['attributes']:_0xec5fe6['model'];_0x213d3c[_0x409a('0x37')]=qs['sort'](_0x46b395[_0x409a('0x30')]['sort']);_0x213d3c[_0x409a('0x39')]=qs[_0x409a('0x31')](_[_0x409a('0x3a')](_0x46b395['query'],_0xec5fe6[_0x409a('0x31')]));if(_0x46b395[_0x409a('0x30')][_0x409a('0x4c')]){_0x213d3c['where']=_[_0x409a('0x3b')](_0x213d3c[_0x409a('0x39')],{'$or':_[_0x409a('0x2b')](_0x213d3c[_0x409a('0x34')],function(_0x1c59ed){var _0x370a53={};_0x370a53[_0x1c59ed]={'$like':'%'+_0x46b395[_0x409a('0x30')][_0x409a('0x4c')]+'%'};return _0x370a53;})});}_0x213d3c=_['merge']({},_0x213d3c,_0x46b395['options']);return _0xce5837['getFields'](_0x213d3c);}})['then'](function(_0x23d5c9){if(_0x23d5c9){_0x5ed63b=_0x23d5c9['length'];if(!_0x46b395[_0x409a('0x30')][_0x409a('0x4d')]('nolimit')){_0x213d3c[_0x409a('0x1d')]=qs['limit'](_0x46b395[_0x409a('0x30')][_0x409a('0x1d')]);_0x213d3c[_0x409a('0x1f')]=qs['offset'](_0x46b395[_0x409a('0x30')][_0x409a('0x1f')]);}return _0xce5837[_0x409a('0x49')](_0x213d3c);}})[_0x409a('0x26')](function(_0x38884e){if(_0x38884e){return _0x38884e?{'count':_0x5ed63b,'rows':_0x38884e}:null;}})[_0x409a('0x26')](respondWithResult(_0x202079,null))[_0x409a('0x42')](handleError(_0x202079,null));};exports[_0x409a('0x4e')]=function(_0x18f7b1,_0x4e6502,_0x463af2){var _0x18df5c={};var _0x5cd757={};var _0x3b0108;var _0x73fa17;return db['SalesforceConfiguration']['findOne']({'where':{'id':_0x18f7b1[_0x409a('0x48')]['id']}})['then'](handleEntityNotFound(_0x4e6502,null))[_0x409a('0x26')](function(_0x5de32c){if(_0x5de32c){_0x3b0108=_0x5de32c;_0x5cd757[_0x409a('0x2f')]=_[_0x409a('0x44')](db[_0x409a('0x4a')]['rawAttributes']);_0x5cd757['query']=_[_0x409a('0x44')](_0x18f7b1['query']);_0x5cd757[_0x409a('0x31')]=_['intersection'](_0x5cd757[_0x409a('0x2f')],_0x5cd757[_0x409a('0x30')]);_0x18df5c[_0x409a('0x34')]=_[_0x409a('0x32')](_0x5cd757['model'],qs[_0x409a('0x33')](_0x18f7b1[_0x409a('0x30')]['fields']));_0x18df5c[_0x409a('0x34')]=_0x18df5c[_0x409a('0x34')][_0x409a('0x35')]?_0x18df5c[_0x409a('0x34')]:_0x5cd757[_0x409a('0x2f')];_0x18df5c[_0x409a('0x37')]=qs[_0x409a('0x38')](_0x18f7b1[_0x409a('0x30')]['sort']);_0x18df5c[_0x409a('0x39')]=qs[_0x409a('0x31')](_[_0x409a('0x3a')](_0x18f7b1[_0x409a('0x30')],_0x5cd757['filters']));if(_0x18f7b1[_0x409a('0x30')][_0x409a('0x4c')]){_0x18df5c['where']=_[_0x409a('0x3b')](_0x18df5c[_0x409a('0x39')],{'$or':_[_0x409a('0x2b')](_0x18df5c[_0x409a('0x34')],function(_0x3d6b45){var _0x12e5cb={};_0x12e5cb[_0x3d6b45]={'$like':'%'+_0x18f7b1[_0x409a('0x30')][_0x409a('0x4c')]+'%'};return _0x12e5cb;})});}_0x18df5c=_['merge']({},_0x18df5c,_0x18f7b1[_0x409a('0x3d')]);return _0x3b0108[_0x409a('0x4e')](_0x18df5c);}})[_0x409a('0x26')](function(_0x4eed1f){if(_0x4eed1f){_0x73fa17=_0x4eed1f[_0x409a('0x35')];if(!_0x18f7b1[_0x409a('0x30')][_0x409a('0x4d')](_0x409a('0x36'))){_0x18df5c[_0x409a('0x1d')]=qs[_0x409a('0x1d')](_0x18f7b1['query'][_0x409a('0x1d')]);_0x18df5c[_0x409a('0x1f')]=qs['offset'](_0x18f7b1[_0x409a('0x30')][_0x409a('0x1f')]);}return _0x3b0108[_0x409a('0x4e')](_0x18df5c);}})[_0x409a('0x26')](function(_0x52b029){if(_0x52b029){return _0x52b029?{'count':_0x73fa17,'rows':_0x52b029}:null;}})[_0x409a('0x26')](respondWithResult(_0x4e6502,null))[_0x409a('0x42')](handleError(_0x4e6502,null));};exports[_0x409a('0x4f')]=function(_0x3c5b33,_0x2c1d67,_0x1e2db0){var _0x45dc42={};var _0x9456c={};var _0x1a89d9;var _0x3b2402;return db[_0x409a('0x2c')][_0x409a('0x50')]({'where':{'id':_0x3c5b33[_0x409a('0x48')]['id']}})[_0x409a('0x26')](handleEntityNotFound(_0x2c1d67,null))[_0x409a('0x26')](function(_0x50f507){if(_0x50f507){_0x1a89d9=_0x50f507;_0x9456c['model']=_[_0x409a('0x44')](db['SalesforceField'][_0x409a('0x4b')]);_0x9456c[_0x409a('0x30')]=_['keys'](_0x3c5b33[_0x409a('0x30')]);_0x9456c['filters']=_[_0x409a('0x32')](_0x9456c[_0x409a('0x2f')],_0x9456c[_0x409a('0x30')]);_0x45dc42[_0x409a('0x34')]=_[_0x409a('0x32')](_0x9456c[_0x409a('0x2f')],qs[_0x409a('0x33')](_0x3c5b33[_0x409a('0x30')][_0x409a('0x33')]));_0x45dc42['attributes']=_0x45dc42[_0x409a('0x34')]['length']?_0x45dc42[_0x409a('0x34')]:_0x9456c[_0x409a('0x2f')];_0x45dc42['order']=qs[_0x409a('0x38')](_0x3c5b33[_0x409a('0x30')]['sort']);_0x45dc42[_0x409a('0x39')]=qs[_0x409a('0x31')](_[_0x409a('0x3a')](_0x3c5b33[_0x409a('0x30')],_0x9456c[_0x409a('0x31')]));if(_0x3c5b33[_0x409a('0x30')][_0x409a('0x4c')]){_0x45dc42[_0x409a('0x39')]=_[_0x409a('0x3b')](_0x45dc42[_0x409a('0x39')],{'$or':_[_0x409a('0x2b')](_0x45dc42[_0x409a('0x34')],function(_0x391550){var _0x2ef273={};_0x2ef273[_0x391550]={'$like':'%'+_0x3c5b33[_0x409a('0x30')][_0x409a('0x4c')]+'%'};return _0x2ef273;})});}_0x45dc42=_[_0x409a('0x3b')]({},_0x45dc42,_0x3c5b33[_0x409a('0x3d')]);return _0x1a89d9[_0x409a('0x4f')](_0x45dc42);}})[_0x409a('0x26')](function(_0x4ec8d9){if(_0x4ec8d9){_0x3b2402=_0x4ec8d9['length'];if(!_0x3c5b33[_0x409a('0x30')][_0x409a('0x4d')](_0x409a('0x36'))){_0x45dc42['limit']=qs[_0x409a('0x1d')](_0x3c5b33[_0x409a('0x30')][_0x409a('0x1d')]);_0x45dc42[_0x409a('0x1f')]=qs[_0x409a('0x1f')](_0x3c5b33[_0x409a('0x30')][_0x409a('0x1f')]);}return _0x1a89d9[_0x409a('0x4f')](_0x45dc42);}})[_0x409a('0x26')](function(_0x4c8497){if(_0x4c8497){return _0x4c8497?{'count':_0x3b2402,'rows':_0x4c8497}:null;}})[_0x409a('0x26')](respondWithResult(_0x2c1d67,null))[_0x409a('0x42')](handleError(_0x2c1d67,null));}; \ No newline at end of file +var _0x9e8e=['ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','json','offset','undefined','limit','count','status','Content-Range','apply','reject','update','then','destroy','error','stack','name','index','map','rawAttributes','key','query','keys','intersection','attributes','model','fields','hasOwnProperty','nolimit','order','sort','filters','pick','where','merge','type','VIRTUAL','filter','SalesforceConfiguration','findAll','catch','show','params','length','includeAll','include','options','find','create','body','getFields','findOne','SalesforceField','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','path','sox','to-csv'];(function(_0x473ad1,_0x5b0b98){var _0xc22592=function(_0x53b22c){while(--_0x53b22c){_0x473ad1['push'](_0x473ad1['shift']());}};_0xc22592(++_0x5b0b98);}(_0x9e8e,0x1cb));var _0xe9e8=function(_0x102f0a,_0x13474d){_0x102f0a=_0x102f0a-0x0;var _0x35e503=_0x9e8e[_0x102f0a];return _0x35e503;};'use strict';var emlformat=require(_0xe9e8('0x0'));var rimraf=require(_0xe9e8('0x1'));var zipdir=require(_0xe9e8('0x2'));var jsonpatch=require(_0xe9e8('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xe9e8('0x4'));var Mustache=require('mustache');var util=require(_0xe9e8('0x5'));var path=require(_0xe9e8('0x6'));var sox=require(_0xe9e8('0x7'));var csv=require(_0xe9e8('0x8'));var ejs=require(_0xe9e8('0x9'));var fs=require('fs');var fs_extra=require(_0xe9e8('0xa'));var _=require(_0xe9e8('0xb'));var squel=require('squel');var crypto=require(_0xe9e8('0xc'));var jsforce=require(_0xe9e8('0xd'));var deskjs=require(_0xe9e8('0xe'));var toCsv=require(_0xe9e8('0x8'));var querystring=require(_0xe9e8('0xf'));var Papa=require(_0xe9e8('0x10'));var Redis=require(_0xe9e8('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe9e8('0x12'));var hardwareService=require(_0xe9e8('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xe9e8('0x14'));var config=require(_0xe9e8('0x15'));var licenseUtil=require(_0xe9e8('0x16'));var db=require(_0xe9e8('0x17'))['db'];function respondWithStatusCode(_0x21ef48,_0xbc9b9d){_0xbc9b9d=_0xbc9b9d||0xcc;return function(_0x4f8f7a){if(_0x4f8f7a){return _0x21ef48[_0xe9e8('0x18')](_0xbc9b9d);}return _0x21ef48['status'](_0xbc9b9d)['end']();};}function respondWithResult(_0x115dc1,_0x4bbaa1){_0x4bbaa1=_0x4bbaa1||0xc8;return function(_0x38f587){if(_0x38f587){return _0x115dc1['status'](_0x4bbaa1)[_0xe9e8('0x19')](_0x38f587);}};}function respondWithFilteredResult(_0x5945c5,_0x2c5c4f){return function(_0xc0d8f2){if(_0xc0d8f2){var _0x2e8df9=typeof _0x2c5c4f[_0xe9e8('0x1a')]===_0xe9e8('0x1b')&&typeof _0x2c5c4f[_0xe9e8('0x1c')]===_0xe9e8('0x1b');var _0x124c9b=_0xc0d8f2[_0xe9e8('0x1d')];var _0x425bb7=_0x2e8df9?0x0:_0x2c5c4f[_0xe9e8('0x1a')];var _0x2ae3e9=_0x2e8df9?_0xc0d8f2['count']:_0x2c5c4f['offset']+_0x2c5c4f['limit'];var _0x25b019;if(_0x2ae3e9>=_0x124c9b){_0x2ae3e9=_0x124c9b;_0x25b019=0xc8;}else{_0x25b019=0xce;}_0x5945c5[_0xe9e8('0x1e')](_0x25b019);return _0x5945c5['set'](_0xe9e8('0x1f'),_0x425bb7+'-'+_0x2ae3e9+'/'+_0x124c9b)[_0xe9e8('0x19')](_0xc0d8f2);}return null;};}function patchUpdates(_0x372820){return function(_0x58d9b7){try{jsonpatch[_0xe9e8('0x20')](_0x58d9b7,_0x372820,!![]);}catch(_0xc2b1c4){return BPromise[_0xe9e8('0x21')](_0xc2b1c4);}return _0x58d9b7['save']();};}function saveUpdates(_0x11a347,_0x24a8c1){return function(_0x5ece1e){if(_0x5ece1e){return _0x5ece1e[_0xe9e8('0x22')](_0x11a347)[_0xe9e8('0x23')](function(_0x551b70){return _0x551b70;});}return null;};}function removeEntity(_0x5ba3af,_0x83b1b){return function(_0x5a3664){if(_0x5a3664){return _0x5a3664[_0xe9e8('0x24')]()[_0xe9e8('0x23')](function(){_0x5ba3af[_0xe9e8('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x22a540,_0xc49010){return function(_0x34b4d9){if(!_0x34b4d9){_0x22a540['sendStatus'](0x194);}return _0x34b4d9;};}function handleError(_0x11c2d0,_0x3c7441){_0x3c7441=_0x3c7441||0x1f4;return function(_0x19334e){logger[_0xe9e8('0x25')](_0x19334e[_0xe9e8('0x26')]);if(_0x19334e[_0xe9e8('0x27')]){delete _0x19334e[_0xe9e8('0x27')];}_0x11c2d0[_0xe9e8('0x1e')](_0x3c7441)['send'](_0x19334e);};}exports[_0xe9e8('0x28')]=function(_0x3d3674,_0x26ebad){var _0x389bf6={},_0x35286a={},_0x3e0501={'count':0x0,'rows':[]};var _0x19d232=_[_0xe9e8('0x29')](db['SalesforceConfiguration'][_0xe9e8('0x2a')],function(_0x23d08b){return{'name':_0x23d08b['fieldName'],'type':_0x23d08b['type'][_0xe9e8('0x2b')]};});_0x35286a['model']=_[_0xe9e8('0x29')](_0x19d232,_0xe9e8('0x27'));_0x35286a[_0xe9e8('0x2c')]=_[_0xe9e8('0x2d')](_0x3d3674[_0xe9e8('0x2c')]);_0x35286a['filters']=_[_0xe9e8('0x2e')](_0x35286a['model'],_0x35286a[_0xe9e8('0x2c')]);_0x389bf6[_0xe9e8('0x2f')]=_[_0xe9e8('0x2e')](_0x35286a[_0xe9e8('0x30')],qs[_0xe9e8('0x31')](_0x3d3674[_0xe9e8('0x2c')][_0xe9e8('0x31')]));_0x389bf6[_0xe9e8('0x2f')]=_0x389bf6[_0xe9e8('0x2f')]['length']?_0x389bf6[_0xe9e8('0x2f')]:_0x35286a[_0xe9e8('0x30')];if(!_0x3d3674[_0xe9e8('0x2c')][_0xe9e8('0x32')](_0xe9e8('0x33'))){_0x389bf6[_0xe9e8('0x1c')]=qs[_0xe9e8('0x1c')](_0x3d3674['query'][_0xe9e8('0x1c')]);_0x389bf6[_0xe9e8('0x1a')]=qs[_0xe9e8('0x1a')](_0x3d3674[_0xe9e8('0x2c')][_0xe9e8('0x1a')]);}_0x389bf6[_0xe9e8('0x34')]=qs[_0xe9e8('0x35')](_0x3d3674[_0xe9e8('0x2c')][_0xe9e8('0x35')]);_0x389bf6['where']=qs[_0xe9e8('0x36')](_[_0xe9e8('0x37')](_0x3d3674[_0xe9e8('0x2c')],_0x35286a[_0xe9e8('0x36')]),_0x19d232);if(_0x3d3674['query']['filter']){_0x389bf6[_0xe9e8('0x38')]=_[_0xe9e8('0x39')](_0x389bf6[_0xe9e8('0x38')],{'$or':_[_0xe9e8('0x29')](_0x19d232,function(_0x1eaac9){if(_0x1eaac9[_0xe9e8('0x3a')]!==_0xe9e8('0x3b')){var _0x31d776={};_0x31d776[_0x1eaac9[_0xe9e8('0x27')]]={'$like':'%'+_0x3d3674[_0xe9e8('0x2c')][_0xe9e8('0x3c')]+'%'};return _0x31d776;}})});}_0x389bf6=_[_0xe9e8('0x39')]({},_0x389bf6,_0x3d3674['options']);var _0x2eb8d7={'where':_0x389bf6[_0xe9e8('0x38')]};return db['SalesforceConfiguration']['count'](_0x2eb8d7)[_0xe9e8('0x23')](function(_0x3617fe){_0x3e0501[_0xe9e8('0x1d')]=_0x3617fe;if(_0x3d3674['query']['includeAll']){_0x389bf6['include']=[{'all':!![]}];}return db[_0xe9e8('0x3d')][_0xe9e8('0x3e')](_0x389bf6);})[_0xe9e8('0x23')](function(_0x5400fa){_0x3e0501['rows']=_0x5400fa;return _0x3e0501;})[_0xe9e8('0x23')](respondWithFilteredResult(_0x26ebad,_0x389bf6))[_0xe9e8('0x3f')](handleError(_0x26ebad,null));};exports[_0xe9e8('0x40')]=function(_0x2ff9b1,_0x43d069){var _0x5ea8db={'raw':![],'where':{'id':_0x2ff9b1[_0xe9e8('0x41')]['id']}},_0x5c1eb1={};_0x5c1eb1[_0xe9e8('0x30')]=_[_0xe9e8('0x2d')](db[_0xe9e8('0x3d')][_0xe9e8('0x2a')]);_0x5c1eb1[_0xe9e8('0x2c')]=_[_0xe9e8('0x2d')](_0x2ff9b1['query']);_0x5c1eb1[_0xe9e8('0x36')]=_[_0xe9e8('0x2e')](_0x5c1eb1['model'],_0x5c1eb1[_0xe9e8('0x2c')]);_0x5ea8db[_0xe9e8('0x2f')]=_[_0xe9e8('0x2e')](_0x5c1eb1['model'],qs[_0xe9e8('0x31')](_0x2ff9b1[_0xe9e8('0x2c')][_0xe9e8('0x31')]));_0x5ea8db[_0xe9e8('0x2f')]=_0x5ea8db['attributes'][_0xe9e8('0x42')]?_0x5ea8db[_0xe9e8('0x2f')]:_0x5c1eb1['model'];if(_0x2ff9b1[_0xe9e8('0x2c')][_0xe9e8('0x43')]){_0x5ea8db[_0xe9e8('0x44')]=[{'all':!![]}];}_0x5ea8db=_[_0xe9e8('0x39')]({},_0x5ea8db,_0x2ff9b1[_0xe9e8('0x45')]);return db[_0xe9e8('0x3d')][_0xe9e8('0x46')](_0x5ea8db)[_0xe9e8('0x23')](handleEntityNotFound(_0x43d069,null))['then'](respondWithResult(_0x43d069,null))[_0xe9e8('0x3f')](handleError(_0x43d069,null));};exports[_0xe9e8('0x47')]=function(_0x3e94f1,_0x4ca8b7){return db[_0xe9e8('0x3d')][_0xe9e8('0x47')](_0x3e94f1[_0xe9e8('0x48')],{})[_0xe9e8('0x23')](respondWithResult(_0x4ca8b7,0xc9))[_0xe9e8('0x3f')](handleError(_0x4ca8b7,null));};exports['update']=function(_0x1f8165,_0x3b2b13){if(_0x1f8165[_0xe9e8('0x48')]['id']){delete _0x1f8165['body']['id'];}return db[_0xe9e8('0x3d')][_0xe9e8('0x46')]({'where':{'id':_0x1f8165[_0xe9e8('0x41')]['id']}})[_0xe9e8('0x23')](handleEntityNotFound(_0x3b2b13,null))[_0xe9e8('0x23')](saveUpdates(_0x1f8165['body'],null))[_0xe9e8('0x23')](respondWithResult(_0x3b2b13,null))[_0xe9e8('0x3f')](handleError(_0x3b2b13,null));};exports[_0xe9e8('0x24')]=function(_0x5103f6,_0x423ed5){return db[_0xe9e8('0x3d')][_0xe9e8('0x46')]({'where':{'id':_0x5103f6[_0xe9e8('0x41')]['id']}})['then'](handleEntityNotFound(_0x423ed5,null))[_0xe9e8('0x23')](removeEntity(_0x423ed5,null))[_0xe9e8('0x3f')](handleError(_0x423ed5,null));};exports[_0xe9e8('0x49')]=function(_0x4cd4a1,_0x131c4b,_0x230640){var _0x5225dd={};var _0xd83808={};var _0x24d142;var _0x58d0a9;return db[_0xe9e8('0x3d')][_0xe9e8('0x4a')]({'where':{'id':_0x4cd4a1[_0xe9e8('0x41')]['id']}})['then'](handleEntityNotFound(_0x131c4b,null))[_0xe9e8('0x23')](function(_0xa6ebb0){if(_0xa6ebb0){_0x24d142=_0xa6ebb0;_0xd83808[_0xe9e8('0x30')]=_[_0xe9e8('0x2d')](db[_0xe9e8('0x4b')]['rawAttributes']);_0xd83808[_0xe9e8('0x2c')]=_[_0xe9e8('0x2d')](_0x4cd4a1[_0xe9e8('0x2c')]);_0xd83808['filters']=_[_0xe9e8('0x2e')](_0xd83808[_0xe9e8('0x30')],_0xd83808[_0xe9e8('0x2c')]);_0x5225dd[_0xe9e8('0x2f')]=_['intersection'](_0xd83808[_0xe9e8('0x30')],qs['fields'](_0x4cd4a1[_0xe9e8('0x2c')][_0xe9e8('0x31')]));_0x5225dd['attributes']=_0x5225dd[_0xe9e8('0x2f')]['length']?_0x5225dd[_0xe9e8('0x2f')]:_0xd83808['model'];_0x5225dd[_0xe9e8('0x34')]=qs['sort'](_0x4cd4a1['query'][_0xe9e8('0x35')]);_0x5225dd['where']=qs['filters'](_['pick'](_0x4cd4a1[_0xe9e8('0x2c')],_0xd83808[_0xe9e8('0x36')]));if(_0x4cd4a1[_0xe9e8('0x2c')][_0xe9e8('0x3c')]){_0x5225dd[_0xe9e8('0x38')]=_[_0xe9e8('0x39')](_0x5225dd[_0xe9e8('0x38')],{'$or':_[_0xe9e8('0x29')](_0x5225dd['attributes'],function(_0x2bf23f){var _0x8a59ca={};_0x8a59ca[_0x2bf23f]={'$like':'%'+_0x4cd4a1['query']['filter']+'%'};return _0x8a59ca;})});}_0x5225dd=_['merge']({},_0x5225dd,_0x4cd4a1[_0xe9e8('0x45')]);return _0x24d142[_0xe9e8('0x49')](_0x5225dd);}})[_0xe9e8('0x23')](function(_0x29c3b7){if(_0x29c3b7){_0x58d0a9=_0x29c3b7[_0xe9e8('0x42')];if(!_0x4cd4a1[_0xe9e8('0x2c')][_0xe9e8('0x32')](_0xe9e8('0x33'))){_0x5225dd[_0xe9e8('0x1c')]=qs[_0xe9e8('0x1c')](_0x4cd4a1[_0xe9e8('0x2c')][_0xe9e8('0x1c')]);_0x5225dd['offset']=qs[_0xe9e8('0x1a')](_0x4cd4a1[_0xe9e8('0x2c')][_0xe9e8('0x1a')]);}return _0x24d142[_0xe9e8('0x49')](_0x5225dd);}})[_0xe9e8('0x23')](function(_0x5d6dbf){if(_0x5d6dbf){return _0x5d6dbf?{'count':_0x58d0a9,'rows':_0x5d6dbf}:null;}})['then'](respondWithResult(_0x131c4b,null))[_0xe9e8('0x3f')](handleError(_0x131c4b,null));};exports[_0xe9e8('0x4c')]=function(_0x406a06,_0x33d791,_0x3dbf34){var _0x46ae35={};var _0xa8ae12={};var _0x243676;var _0x2f8853;return db[_0xe9e8('0x3d')][_0xe9e8('0x4a')]({'where':{'id':_0x406a06[_0xe9e8('0x41')]['id']}})[_0xe9e8('0x23')](handleEntityNotFound(_0x33d791,null))[_0xe9e8('0x23')](function(_0x4152c4){if(_0x4152c4){_0x243676=_0x4152c4;_0xa8ae12[_0xe9e8('0x30')]=_[_0xe9e8('0x2d')](db[_0xe9e8('0x4b')][_0xe9e8('0x2a')]);_0xa8ae12[_0xe9e8('0x2c')]=_['keys'](_0x406a06[_0xe9e8('0x2c')]);_0xa8ae12['filters']=_[_0xe9e8('0x2e')](_0xa8ae12[_0xe9e8('0x30')],_0xa8ae12['query']);_0x46ae35[_0xe9e8('0x2f')]=_[_0xe9e8('0x2e')](_0xa8ae12['model'],qs[_0xe9e8('0x31')](_0x406a06['query']['fields']));_0x46ae35[_0xe9e8('0x2f')]=_0x46ae35[_0xe9e8('0x2f')][_0xe9e8('0x42')]?_0x46ae35['attributes']:_0xa8ae12['model'];_0x46ae35[_0xe9e8('0x34')]=qs['sort'](_0x406a06['query'][_0xe9e8('0x35')]);_0x46ae35[_0xe9e8('0x38')]=qs[_0xe9e8('0x36')](_[_0xe9e8('0x37')](_0x406a06[_0xe9e8('0x2c')],_0xa8ae12[_0xe9e8('0x36')]));if(_0x406a06[_0xe9e8('0x2c')]['filter']){_0x46ae35['where']=_['merge'](_0x46ae35['where'],{'$or':_['map'](_0x46ae35[_0xe9e8('0x2f')],function(_0x3ebfa7){var _0x5ed814={};_0x5ed814[_0x3ebfa7]={'$like':'%'+_0x406a06[_0xe9e8('0x2c')][_0xe9e8('0x3c')]+'%'};return _0x5ed814;})});}_0x46ae35=_['merge']({},_0x46ae35,_0x406a06[_0xe9e8('0x45')]);return _0x243676[_0xe9e8('0x4c')](_0x46ae35);}})['then'](function(_0x48c3ca){if(_0x48c3ca){_0x2f8853=_0x48c3ca[_0xe9e8('0x42')];if(!_0x406a06['query']['hasOwnProperty']('nolimit')){_0x46ae35[_0xe9e8('0x1c')]=qs['limit'](_0x406a06['query']['limit']);_0x46ae35['offset']=qs[_0xe9e8('0x1a')](_0x406a06[_0xe9e8('0x2c')]['offset']);}return _0x243676[_0xe9e8('0x4c')](_0x46ae35);}})['then'](function(_0x201d4a){if(_0x201d4a){return _0x201d4a?{'count':_0x2f8853,'rows':_0x201d4a}:null;}})['then'](respondWithResult(_0x33d791,null))['catch'](handleError(_0x33d791,null));};exports[_0xe9e8('0x4d')]=function(_0x57e85d,_0x149bad,_0xee3576){var _0x1e3351={};var _0x1d2e75={};var _0x4dbaff;var _0x49ab0b;return db['SalesforceConfiguration'][_0xe9e8('0x4a')]({'where':{'id':_0x57e85d[_0xe9e8('0x41')]['id']}})[_0xe9e8('0x23')](handleEntityNotFound(_0x149bad,null))[_0xe9e8('0x23')](function(_0x1ca38b){if(_0x1ca38b){_0x4dbaff=_0x1ca38b;_0x1d2e75['model']=_['keys'](db[_0xe9e8('0x4b')][_0xe9e8('0x2a')]);_0x1d2e75[_0xe9e8('0x2c')]=_[_0xe9e8('0x2d')](_0x57e85d['query']);_0x1d2e75['filters']=_[_0xe9e8('0x2e')](_0x1d2e75[_0xe9e8('0x30')],_0x1d2e75[_0xe9e8('0x2c')]);_0x1e3351['attributes']=_['intersection'](_0x1d2e75[_0xe9e8('0x30')],qs[_0xe9e8('0x31')](_0x57e85d['query']['fields']));_0x1e3351[_0xe9e8('0x2f')]=_0x1e3351['attributes'][_0xe9e8('0x42')]?_0x1e3351[_0xe9e8('0x2f')]:_0x1d2e75['model'];_0x1e3351['order']=qs[_0xe9e8('0x35')](_0x57e85d['query'][_0xe9e8('0x35')]);_0x1e3351[_0xe9e8('0x38')]=qs[_0xe9e8('0x36')](_[_0xe9e8('0x37')](_0x57e85d[_0xe9e8('0x2c')],_0x1d2e75[_0xe9e8('0x36')]));if(_0x57e85d[_0xe9e8('0x2c')][_0xe9e8('0x3c')]){_0x1e3351[_0xe9e8('0x38')]=_[_0xe9e8('0x39')](_0x1e3351[_0xe9e8('0x38')],{'$or':_[_0xe9e8('0x29')](_0x1e3351[_0xe9e8('0x2f')],function(_0xc03aef){var _0x36b994={};_0x36b994[_0xc03aef]={'$like':'%'+_0x57e85d[_0xe9e8('0x2c')][_0xe9e8('0x3c')]+'%'};return _0x36b994;})});}_0x1e3351=_['merge']({},_0x1e3351,_0x57e85d[_0xe9e8('0x45')]);return _0x4dbaff[_0xe9e8('0x4d')](_0x1e3351);}})[_0xe9e8('0x23')](function(_0x53c132){if(_0x53c132){_0x49ab0b=_0x53c132['length'];if(!_0x57e85d[_0xe9e8('0x2c')][_0xe9e8('0x32')](_0xe9e8('0x33'))){_0x1e3351[_0xe9e8('0x1c')]=qs['limit'](_0x57e85d[_0xe9e8('0x2c')]['limit']);_0x1e3351[_0xe9e8('0x1a')]=qs[_0xe9e8('0x1a')](_0x57e85d[_0xe9e8('0x2c')][_0xe9e8('0x1a')]);}return _0x4dbaff[_0xe9e8('0x4d')](_0x1e3351);}})[_0xe9e8('0x23')](function(_0x45f04f){if(_0x45f04f){return _0x45f04f?{'count':_0x49ab0b,'rows':_0x45f04f}:null;}})[_0xe9e8('0x23')](respondWithResult(_0x149bad,null))[_0xe9e8('0x3f')](handleError(_0x149bad,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index b6daed2..c178186 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 _0x4270=['int_salesforce_configurations','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./intSalesforceConfiguration.attributes','exports','define','SalesforceConfiguration'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x4270,0xeb));var _0x0427=function(_0x5f24f5,_0x3a7ec4){_0x5f24f5=_0x5f24f5-0x0;var _0x22e4ab=_0x4270[_0x5f24f5];return _0x22e4ab;};'use strict';var _=require(_0x0427('0x0'));var util=require(_0x0427('0x1'));var logger=require(_0x0427('0x2'))(_0x0427('0x3'));var moment=require('moment');var BPromise=require(_0x0427('0x4'));var rp=require(_0x0427('0x5'));var fs=require('fs');var path=require(_0x0427('0x6'));var rimraf=require(_0x0427('0x7'));var config=require('../../config/environment');var attributes=require(_0x0427('0x8'));module[_0x0427('0x9')]=function(_0x3cb78d,_0x583496){return _0x3cb78d[_0x0427('0xa')](_0x0427('0xb'),attributes,{'tableName':_0x0427('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8915=['bluebird','request-promise','path','../../config/environment','./intSalesforceConfiguration.attributes','exports','define','SalesforceConfiguration','int_salesforce_configurations','lodash','util','../../config/logger','api'];(function(_0x30d1a2,_0x5d10ea){var _0x46d0ff=function(_0x335a59){while(--_0x335a59){_0x30d1a2['push'](_0x30d1a2['shift']());}};_0x46d0ff(++_0x5d10ea);}(_0x8915,0x1dd));var _0x5891=function(_0x3ce2c4,_0x4544c1){_0x3ce2c4=_0x3ce2c4-0x0;var _0x4047c1=_0x8915[_0x3ce2c4];return _0x4047c1;};'use strict';var _=require(_0x5891('0x0'));var util=require(_0x5891('0x1'));var logger=require(_0x5891('0x2'))(_0x5891('0x3'));var moment=require('moment');var BPromise=require(_0x5891('0x4'));var rp=require(_0x5891('0x5'));var fs=require('fs');var path=require(_0x5891('0x6'));var rimraf=require('rimraf');var config=require(_0x5891('0x7'));var attributes=require(_0x5891('0x8'));module[_0x5891('0x9')]=function(_0xfbfce4,_0x6b58cf){return _0xfbfce4[_0x5891('0xa')](_0x5891('0xb'),attributes,{'tableName':_0x5891('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js index 73f4ea6..13c61e5 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 _0x618e=['stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x9d73ab,_0x1817de){var _0x1df342=function(_0x46783f){while(--_0x46783f){_0x9d73ab['push'](_0x9d73ab['shift']());}};_0x1df342(++_0x1817de);}(_0x618e,0x11a));var _0xe618=function(_0x319f60,_0x4f36b0){_0x319f60=_0x319f60-0x0;var _0x1d4491=_0x618e[_0x319f60];return _0x1d4491;};'use strict';var _=require('lodash');var util=require(_0xe618('0x0'));var moment=require(_0xe618('0x1'));var BPromise=require(_0xe618('0x2'));var rs=require(_0xe618('0x3'));var fs=require('fs');var Redis=require(_0xe618('0x4'));var db=require(_0xe618('0x5'))['db'];var utils=require(_0xe618('0x6'));var logger=require('../../config/logger')(_0xe618('0x7'));var config=require(_0xe618('0x8'));var jayson=require(_0xe618('0x9'));var client=jayson['client'][_0xe618('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4b4eee,_0xdbc4f5,_0x583632){return new BPromise(function(_0x323f74,_0xd6af6c){return client[_0xe618('0xb')](_0x4b4eee,_0x583632)['then'](function(_0x1512c6){logger[_0xe618('0xc')](_0xe618('0xd'),_0xdbc4f5,_0xe618('0xe'));logger[_0xe618('0xf')](_0xe618('0x10'),_0xdbc4f5,'request\x20sent',JSON[_0xe618('0x11')](_0x1512c6));if(_0x1512c6[_0xe618('0x12')]){if(_0x1512c6[_0xe618('0x12')][_0xe618('0x13')]===0x1f4){logger[_0xe618('0x12')](_0xe618('0xd'),_0xdbc4f5,_0x1512c6[_0xe618('0x12')]['message']);return _0xd6af6c(_0x1512c6[_0xe618('0x12')][_0xe618('0x14')]);}logger['error'](_0xe618('0xd'),_0xdbc4f5,_0x1512c6[_0xe618('0x12')]['message']);return _0x323f74(_0x1512c6[_0xe618('0x12')]['message']);}else{logger[_0xe618('0xc')]('SalesforceConfiguration,\x20%s,\x20%s',_0xdbc4f5,_0xe618('0xe'));_0x323f74(_0x1512c6[_0xe618('0x15')][_0xe618('0x14')]);}})[_0xe618('0x16')](function(_0x15781f){logger[_0xe618('0x12')](_0xe618('0xd'),_0xdbc4f5,_0x15781f);_0xd6af6c(_0x15781f);});});} \ No newline at end of file +var _0xa906=['../../config/environment','client','http','request','then','info','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','SalesforceConfiguration,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x20ebb5,_0x237d88){var _0x487182=function(_0xaa5491){while(--_0xaa5491){_0x20ebb5['push'](_0x20ebb5['shift']());}};_0x487182(++_0x237d88);}(_0xa906,0x1c4));var _0x6a90=function(_0x40c206,_0x527d05){_0x40c206=_0x40c206-0x0;var _0x52897a=_0xa906[_0x40c206];return _0x52897a;};'use strict';var _=require(_0x6a90('0x0'));var util=require(_0x6a90('0x1'));var moment=require(_0x6a90('0x2'));var BPromise=require(_0x6a90('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6a90('0x4'));var db=require(_0x6a90('0x5'))['db'];var utils=require(_0x6a90('0x6'));var logger=require(_0x6a90('0x7'))('rpc');var config=require(_0x6a90('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x6a90('0x9')][_0x6a90('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5c7d32,_0x30d89f,_0x1152e3){return new BPromise(function(_0x16b887,_0x251360){return client[_0x6a90('0xb')](_0x5c7d32,_0x1152e3)[_0x6a90('0xc')](function(_0x5b2793){logger[_0x6a90('0xd')]('SalesforceConfiguration,\x20%s,\x20%s',_0x30d89f,'request\x20sent');logger[_0x6a90('0xe')](_0x6a90('0xf'),_0x30d89f,_0x6a90('0x10'),JSON['stringify'](_0x5b2793));if(_0x5b2793[_0x6a90('0x11')]){if(_0x5b2793[_0x6a90('0x11')][_0x6a90('0x12')]===0x1f4){logger[_0x6a90('0x11')]('SalesforceConfiguration,\x20%s,\x20%s',_0x30d89f,_0x5b2793[_0x6a90('0x11')][_0x6a90('0x13')]);return _0x251360(_0x5b2793[_0x6a90('0x11')][_0x6a90('0x13')]);}logger[_0x6a90('0x11')]('SalesforceConfiguration,\x20%s,\x20%s',_0x30d89f,_0x5b2793['error'][_0x6a90('0x13')]);return _0x16b887(_0x5b2793[_0x6a90('0x11')][_0x6a90('0x13')]);}else{logger[_0x6a90('0xd')](_0x6a90('0x14'),_0x30d89f,_0x6a90('0x10'));_0x16b887(_0x5b2793[_0x6a90('0x15')][_0x6a90('0x13')]);}})[_0x6a90('0x16')](function(_0x5c82cc){logger[_0x6a90('0x11')]('SalesforceConfiguration,\x20%s,\x20%s',_0x30d89f,_0x5c82cc);_0x251360(_0x5c82cc);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index a45a282..809ace8 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 _0x4c59=['Router','fs-extra','../../components/auth/service','./intSalesforceField.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','exports','util','connect-timeout','express'];(function(_0x1a68a,_0x2f6c45){var _0x44128f=function(_0x1d2c21){while(--_0x1d2c21){_0x1a68a['push'](_0x1a68a['shift']());}};_0x44128f(++_0x2f6c45);}(_0x4c59,0x10b));var _0x94c5=function(_0x272d97,_0x3cb745){_0x272d97=_0x272d97-0x0;var _0x40fc01=_0x4c59[_0x272d97];return _0x40fc01;};'use strict';var multer=require('multer');var util=require(_0x94c5('0x0'));var path=require('path');var timeout=require(_0x94c5('0x1'));var express=require(_0x94c5('0x2'));var router=express[_0x94c5('0x3')]();var fs_extra=require(_0x94c5('0x4'));var auth=require(_0x94c5('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x94c5('0x6'));router[_0x94c5('0x7')]('/',auth[_0x94c5('0x8')](),controller[_0x94c5('0x9')]);router[_0x94c5('0x7')](_0x94c5('0xa'),auth[_0x94c5('0x8')](),controller[_0x94c5('0xb')]);router[_0x94c5('0xc')]('/',auth[_0x94c5('0x8')](),controller[_0x94c5('0xd')]);router[_0x94c5('0xe')]('/:id',auth[_0x94c5('0x8')](),controller[_0x94c5('0xf')]);router[_0x94c5('0x10')]('/:id',auth[_0x94c5('0x8')](),controller['destroy']);module[_0x94c5('0x11')]=router; \ No newline at end of file +var _0x81b9=['destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete'];(function(_0x17977a,_0x351883){var _0x15f466=function(_0xf734eb){while(--_0xf734eb){_0x17977a['push'](_0x17977a['shift']());}};_0x15f466(++_0x351883);}(_0x81b9,0x6b));var _0x981b=function(_0x146115,_0x2f71b7){_0x146115=_0x146115-0x0;var _0x258e7f=_0x81b9[_0x146115];return _0x258e7f;};'use strict';var multer=require('multer');var util=require(_0x981b('0x0'));var path=require(_0x981b('0x1'));var timeout=require(_0x981b('0x2'));var express=require(_0x981b('0x3'));var router=express[_0x981b('0x4')]();var fs_extra=require(_0x981b('0x5'));var auth=require(_0x981b('0x6'));var interaction=require(_0x981b('0x7'));var config=require(_0x981b('0x8'));var controller=require(_0x981b('0x9'));router[_0x981b('0xa')]('/',auth[_0x981b('0xb')](),controller[_0x981b('0xc')]);router['get'](_0x981b('0xd'),auth['isAuthenticated'](),controller[_0x981b('0xe')]);router[_0x981b('0xf')]('/',auth[_0x981b('0xb')](),controller['create']);router[_0x981b('0x10')](_0x981b('0xd'),auth[_0x981b('0xb')](),controller[_0x981b('0x11')]);router[_0x981b('0x12')]('/:id',auth[_0x981b('0xb')](),controller[_0x981b('0x13')]);module[_0x981b('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index a6e8a0f..a379372 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 _0x46f1=['picklist','STRING','customVariable','ENUM','string','variable'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x46f1,0x8d));var _0x146f=function(_0x50ac1d,_0x2d02d9){_0x50ac1d=_0x50ac1d-0x0;var _0x102568=_0x46f1[_0x50ac1d];return _0x102568;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x146f('0x0')](_0x146f('0x1'),_0x146f('0x2'),'customVariable','keyValue',_0x146f('0x3')),'defaultValue':'string'},'content':{'type':Sequelize[_0x146f('0x4')]},'key':{'type':Sequelize[_0x146f('0x4')]},'keyType':{'type':Sequelize[_0x146f('0x0')](_0x146f('0x1'),_0x146f('0x2'),_0x146f('0x5'))},'keyContent':{'type':Sequelize[_0x146f('0x4')]},'idField':{'type':Sequelize['STRING']},'variableName':{'type':Sequelize[_0x146f('0x4')]}}; \ No newline at end of file +var _0x5384=['keyValue','STRING','variable','sequelize','ENUM','string','customVariable'];(function(_0x3cff41,_0x6d45b6){var _0x16ab1f=function(_0x3c30cc){while(--_0x3c30cc){_0x3cff41['push'](_0x3cff41['shift']());}};_0x16ab1f(++_0x6d45b6);}(_0x5384,0xce));var _0x4538=function(_0x573262,_0x4e0f57){_0x573262=_0x573262-0x0;var _0x159178=_0x5384[_0x573262];return _0x159178;};'use strict';var Sequelize=require(_0x4538('0x0'));module['exports']={'type':{'type':Sequelize[_0x4538('0x1')](_0x4538('0x2'),'variable',_0x4538('0x3'),_0x4538('0x4'),'picklist'),'defaultValue':_0x4538('0x2')},'content':{'type':Sequelize[_0x4538('0x5')]},'key':{'type':Sequelize[_0x4538('0x5')]},'keyType':{'type':Sequelize[_0x4538('0x1')]('string',_0x4538('0x6'),_0x4538('0x3'))},'keyContent':{'type':Sequelize[_0x4538('0x5')]},'idField':{'type':Sequelize['STRING']},'variableName':{'type':Sequelize[_0x4538('0x5')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index 5094b57..22b2fb0 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 _0x9457=['util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','then','error','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','SalesforceField','includeAll','include','rows','catch','show','params','length','create','body','update','find','eml-format','rimraf','moment','bluebird','mustache'];(function(_0x5a821,_0x4d4d18){var _0x678ad0=function(_0x554cde){while(--_0x554cde){_0x5a821['push'](_0x5a821['shift']());}};_0x678ad0(++_0x4d4d18);}(_0x9457,0x1b1));var _0x7945=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9457[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x7945('0x0'));var rimraf=require(_0x7945('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x7945('0x2'));var BPromise=require(_0x7945('0x3'));var Mustache=require(_0x7945('0x4'));var util=require(_0x7945('0x5'));var path=require('path');var sox=require(_0x7945('0x6'));var csv=require(_0x7945('0x7'));var ejs=require(_0x7945('0x8'));var fs=require('fs');var fs_extra=require(_0x7945('0x9'));var _=require(_0x7945('0xa'));var squel=require(_0x7945('0xb'));var crypto=require(_0x7945('0xc'));var jsforce=require(_0x7945('0xd'));var deskjs=require(_0x7945('0xe'));var toCsv=require(_0x7945('0x7'));var querystring=require(_0x7945('0xf'));var Papa=require(_0x7945('0x10'));var Redis=require(_0x7945('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x7945('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x7945('0x13'))(_0x7945('0x14'));var utils=require(_0x7945('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x7945('0x16'));var db=require(_0x7945('0x17'))['db'];function respondWithStatusCode(_0x4a31cd,_0x2dba84){_0x2dba84=_0x2dba84||0xcc;return function(_0x4aa5db){if(_0x4aa5db){return _0x4a31cd[_0x7945('0x18')](_0x2dba84);}return _0x4a31cd[_0x7945('0x19')](_0x2dba84)[_0x7945('0x1a')]();};}function respondWithResult(_0x20deda,_0x5e5c99){_0x5e5c99=_0x5e5c99||0xc8;return function(_0x1b26dc){if(_0x1b26dc){return _0x20deda[_0x7945('0x19')](_0x5e5c99)[_0x7945('0x1b')](_0x1b26dc);}};}function respondWithFilteredResult(_0x5805bb,_0x342c0f){return function(_0x4d5f5f){if(_0x4d5f5f){var _0x3748c2=typeof _0x342c0f[_0x7945('0x1c')]===_0x7945('0x1d')&&typeof _0x342c0f[_0x7945('0x1e')]===_0x7945('0x1d');var _0xef9aec=_0x4d5f5f[_0x7945('0x1f')];var _0x149633=_0x3748c2?0x0:_0x342c0f['offset'];var _0x437908=_0x3748c2?_0x4d5f5f['count']:_0x342c0f[_0x7945('0x1c')]+_0x342c0f[_0x7945('0x1e')];var _0x89aadd;if(_0x437908>=_0xef9aec){_0x437908=_0xef9aec;_0x89aadd=0xc8;}else{_0x89aadd=0xce;}_0x5805bb[_0x7945('0x19')](_0x89aadd);return _0x5805bb[_0x7945('0x20')](_0x7945('0x21'),_0x149633+'-'+_0x437908+'/'+_0xef9aec)[_0x7945('0x1b')](_0x4d5f5f);}return null;};}function patchUpdates(_0x537c03){return function(_0x293c4d){try{jsonpatch[_0x7945('0x22')](_0x293c4d,_0x537c03,!![]);}catch(_0x8520ea){return BPromise[_0x7945('0x23')](_0x8520ea);}return _0x293c4d['save']();};}function saveUpdates(_0x4b43fd,_0x56bcce){return function(_0x47db7f){if(_0x47db7f){return _0x47db7f['update'](_0x4b43fd)[_0x7945('0x24')](function(_0x55d2b4){return _0x55d2b4;});}return null;};}function removeEntity(_0x2856f5,_0x15b042){return function(_0x277c01){if(_0x277c01){return _0x277c01['destroy']()[_0x7945('0x24')](function(){_0x2856f5[_0x7945('0x19')](0xcc)[_0x7945('0x1a')]();});}};}function handleEntityNotFound(_0x1fa57e,_0x210d70){return function(_0x116589){if(!_0x116589){_0x1fa57e[_0x7945('0x18')](0x194);}return _0x116589;};}function handleError(_0x206194,_0x414b1e){_0x414b1e=_0x414b1e||0x1f4;return function(_0x4c4a2c){logger[_0x7945('0x25')](_0x4c4a2c['stack']);if(_0x4c4a2c[_0x7945('0x26')]){delete _0x4c4a2c[_0x7945('0x26')];}_0x206194[_0x7945('0x19')](_0x414b1e)[_0x7945('0x27')](_0x4c4a2c);};}exports[_0x7945('0x28')]=function(_0x336e3b,_0xc57abb){var _0x1ebddd={},_0x5b49a4={},_0x500f7d={'count':0x0,'rows':[]};var _0x357db7=_[_0x7945('0x29')](db['SalesforceField'][_0x7945('0x2a')],function(_0x56edc9){return{'name':_0x56edc9[_0x7945('0x2b')],'type':_0x56edc9[_0x7945('0x2c')][_0x7945('0x2d')]};});_0x5b49a4[_0x7945('0x2e')]=_[_0x7945('0x29')](_0x357db7,'name');_0x5b49a4['query']=_[_0x7945('0x2f')](_0x336e3b[_0x7945('0x30')]);_0x5b49a4[_0x7945('0x31')]=_[_0x7945('0x32')](_0x5b49a4[_0x7945('0x2e')],_0x5b49a4[_0x7945('0x30')]);_0x1ebddd[_0x7945('0x33')]=_[_0x7945('0x32')](_0x5b49a4[_0x7945('0x2e')],qs[_0x7945('0x34')](_0x336e3b[_0x7945('0x30')][_0x7945('0x34')]));_0x1ebddd['attributes']=_0x1ebddd[_0x7945('0x33')]['length']?_0x1ebddd['attributes']:_0x5b49a4[_0x7945('0x2e')];if(!_0x336e3b[_0x7945('0x30')][_0x7945('0x35')](_0x7945('0x36'))){_0x1ebddd[_0x7945('0x1e')]=qs[_0x7945('0x1e')](_0x336e3b[_0x7945('0x30')][_0x7945('0x1e')]);_0x1ebddd[_0x7945('0x1c')]=qs[_0x7945('0x1c')](_0x336e3b['query'][_0x7945('0x1c')]);}_0x1ebddd[_0x7945('0x37')]=qs[_0x7945('0x38')](_0x336e3b[_0x7945('0x30')][_0x7945('0x38')]);_0x1ebddd[_0x7945('0x39')]=qs[_0x7945('0x31')](_['pick'](_0x336e3b[_0x7945('0x30')],_0x5b49a4[_0x7945('0x31')]),_0x357db7);if(_0x336e3b[_0x7945('0x30')][_0x7945('0x3a')]){_0x1ebddd[_0x7945('0x39')]=_[_0x7945('0x3b')](_0x1ebddd['where'],{'$or':_[_0x7945('0x29')](_0x357db7,function(_0x2b92e6){if(_0x2b92e6[_0x7945('0x2c')]!=='VIRTUAL'){var _0x4e0f1d={};_0x4e0f1d[_0x2b92e6[_0x7945('0x26')]]={'$like':'%'+_0x336e3b[_0x7945('0x30')][_0x7945('0x3a')]+'%'};return _0x4e0f1d;}})});}_0x1ebddd=_[_0x7945('0x3b')]({},_0x1ebddd,_0x336e3b[_0x7945('0x3c')]);var _0x134ffc={'where':_0x1ebddd[_0x7945('0x39')]};return db[_0x7945('0x3d')][_0x7945('0x1f')](_0x134ffc)['then'](function(_0x3e3307){_0x500f7d['count']=_0x3e3307;if(_0x336e3b[_0x7945('0x30')][_0x7945('0x3e')]){_0x1ebddd[_0x7945('0x3f')]=[{'all':!![]}];}return db['SalesforceField']['findAll'](_0x1ebddd);})[_0x7945('0x24')](function(_0xe1be5a){_0x500f7d[_0x7945('0x40')]=_0xe1be5a;return _0x500f7d;})[_0x7945('0x24')](respondWithFilteredResult(_0xc57abb,_0x1ebddd))[_0x7945('0x41')](handleError(_0xc57abb,null));};exports[_0x7945('0x42')]=function(_0xed05b7,_0x455245){var _0x260833={'raw':!![],'where':{'id':_0xed05b7[_0x7945('0x43')]['id']}},_0xa4b3da={};_0xa4b3da['model']=_['keys'](db[_0x7945('0x3d')][_0x7945('0x2a')]);_0xa4b3da['query']=_[_0x7945('0x2f')](_0xed05b7[_0x7945('0x30')]);_0xa4b3da[_0x7945('0x31')]=_[_0x7945('0x32')](_0xa4b3da['model'],_0xa4b3da[_0x7945('0x30')]);_0x260833[_0x7945('0x33')]=_[_0x7945('0x32')](_0xa4b3da['model'],qs['fields'](_0xed05b7[_0x7945('0x30')][_0x7945('0x34')]));_0x260833[_0x7945('0x33')]=_0x260833[_0x7945('0x33')][_0x7945('0x44')]?_0x260833['attributes']:_0xa4b3da['model'];if(_0xed05b7['query'][_0x7945('0x3e')]){_0x260833[_0x7945('0x3f')]=[{'all':!![]}];}_0x260833=_[_0x7945('0x3b')]({},_0x260833,_0xed05b7[_0x7945('0x3c')]);return db[_0x7945('0x3d')]['find'](_0x260833)[_0x7945('0x24')](handleEntityNotFound(_0x455245,null))[_0x7945('0x24')](respondWithResult(_0x455245,null))['catch'](handleError(_0x455245,null));};exports['create']=function(_0x7e24bb,_0x59ed4b){return db[_0x7945('0x3d')][_0x7945('0x45')](_0x7e24bb[_0x7945('0x46')],{})[_0x7945('0x24')](respondWithResult(_0x59ed4b,0xc9))[_0x7945('0x41')](handleError(_0x59ed4b,null));};exports[_0x7945('0x47')]=function(_0x1a97c8,_0x21cd82){if(_0x1a97c8[_0x7945('0x46')]['id']){delete _0x1a97c8[_0x7945('0x46')]['id'];}return db['SalesforceField'][_0x7945('0x48')]({'where':{'id':_0x1a97c8[_0x7945('0x43')]['id']}})[_0x7945('0x24')](handleEntityNotFound(_0x21cd82,null))[_0x7945('0x24')](saveUpdates(_0x1a97c8[_0x7945('0x46')],null))['then'](respondWithResult(_0x21cd82,null))[_0x7945('0x41')](handleError(_0x21cd82,null));};exports['destroy']=function(_0x51f6a6,_0x582f48){return db[_0x7945('0x3d')][_0x7945('0x48')]({'where':{'id':_0x51f6a6['params']['id']}})[_0x7945('0x24')](handleEntityNotFound(_0x582f48,null))['then'](removeEntity(_0x582f48,null))['catch'](handleError(_0x582f48,null));}; \ No newline at end of file +var _0x26ad=['undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','index','map','SalesforceField','type','key','model','query','keys','filters','attributes','intersection','fields','nolimit','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','findAll','rows','catch','show','params','rawAttributes','length','find','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','status','end','offset'];(function(_0xf48cce,_0x3531e4){var _0x2a5c38=function(_0x22a454){while(--_0x22a454){_0xf48cce['push'](_0xf48cce['shift']());}};_0x2a5c38(++_0x3531e4);}(_0x26ad,0x199));var _0xd26a=function(_0x3740fe,_0x6c543c){_0x3740fe=_0x3740fe-0x0;var _0x55492b=_0x26ad[_0x3740fe];return _0x55492b;};'use strict';var emlformat=require(_0xd26a('0x0'));var rimraf=require(_0xd26a('0x1'));var zipdir=require(_0xd26a('0x2'));var jsonpatch=require(_0xd26a('0x3'));var rp=require(_0xd26a('0x4'));var moment=require(_0xd26a('0x5'));var BPromise=require(_0xd26a('0x6'));var Mustache=require(_0xd26a('0x7'));var util=require('util');var path=require(_0xd26a('0x8'));var sox=require(_0xd26a('0x9'));var csv=require(_0xd26a('0xa'));var ejs=require(_0xd26a('0xb'));var fs=require('fs');var fs_extra=require(_0xd26a('0xc'));var _=require(_0xd26a('0xd'));var squel=require('squel');var crypto=require(_0xd26a('0xe'));var jsforce=require(_0xd26a('0xf'));var deskjs=require(_0xd26a('0x10'));var toCsv=require(_0xd26a('0xa'));var querystring=require(_0xd26a('0x11'));var Papa=require('papaparse');var Redis=require(_0xd26a('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xd26a('0x13'));var as=require(_0xd26a('0x14'));var hardwareService=require(_0xd26a('0x15'));var logger=require('../../config/logger')(_0xd26a('0x16'));var utils=require(_0xd26a('0x17'));var config=require(_0xd26a('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xd26a('0x19'))['db'];function respondWithStatusCode(_0x445972,_0x423107){_0x423107=_0x423107||0xcc;return function(_0x2bedd0){if(_0x2bedd0){return _0x445972['sendStatus'](_0x423107);}return _0x445972[_0xd26a('0x1a')](_0x423107)[_0xd26a('0x1b')]();};}function respondWithResult(_0x4c46ad,_0x5f3877){_0x5f3877=_0x5f3877||0xc8;return function(_0x1658cf){if(_0x1658cf){return _0x4c46ad['status'](_0x5f3877)['json'](_0x1658cf);}};}function respondWithFilteredResult(_0x43c7d8,_0x485f01){return function(_0x398328){if(_0x398328){var _0x568169=typeof _0x485f01[_0xd26a('0x1c')]===_0xd26a('0x1d')&&typeof _0x485f01[_0xd26a('0x1e')]===_0xd26a('0x1d');var _0x37f74b=_0x398328[_0xd26a('0x1f')];var _0x4b6eac=_0x568169?0x0:_0x485f01[_0xd26a('0x1c')];var _0x2266f9=_0x568169?_0x398328['count']:_0x485f01[_0xd26a('0x1c')]+_0x485f01[_0xd26a('0x1e')];var _0x7e492d;if(_0x2266f9>=_0x37f74b){_0x2266f9=_0x37f74b;_0x7e492d=0xc8;}else{_0x7e492d=0xce;}_0x43c7d8[_0xd26a('0x1a')](_0x7e492d);return _0x43c7d8['set'](_0xd26a('0x20'),_0x4b6eac+'-'+_0x2266f9+'/'+_0x37f74b)['json'](_0x398328);}return null;};}function patchUpdates(_0x4eef5d){return function(_0x5a0b9){try{jsonpatch[_0xd26a('0x21')](_0x5a0b9,_0x4eef5d,!![]);}catch(_0x3bd336){return BPromise[_0xd26a('0x22')](_0x3bd336);}return _0x5a0b9[_0xd26a('0x23')]();};}function saveUpdates(_0x46e9bd,_0x4e3665){return function(_0x5af52f){if(_0x5af52f){return _0x5af52f[_0xd26a('0x24')](_0x46e9bd)[_0xd26a('0x25')](function(_0x2ea600){return _0x2ea600;});}return null;};}function removeEntity(_0xe7c243,_0x13c462){return function(_0x1e4148){if(_0x1e4148){return _0x1e4148[_0xd26a('0x26')]()[_0xd26a('0x25')](function(){_0xe7c243['status'](0xcc)[_0xd26a('0x1b')]();});}};}function handleEntityNotFound(_0x1d498d,_0x1ab640){return function(_0x30bd12){if(!_0x30bd12){_0x1d498d[_0xd26a('0x27')](0x194);}return _0x30bd12;};}function handleError(_0x4e677e,_0x479a0f){_0x479a0f=_0x479a0f||0x1f4;return function(_0x3e5518){logger[_0xd26a('0x28')](_0x3e5518[_0xd26a('0x29')]);if(_0x3e5518[_0xd26a('0x2a')]){delete _0x3e5518[_0xd26a('0x2a')];}_0x4e677e['status'](_0x479a0f)['send'](_0x3e5518);};}exports[_0xd26a('0x2b')]=function(_0x397399,_0xaa1a9){var _0x5f4901={},_0x2e7abd={},_0x4a5304={'count':0x0,'rows':[]};var _0xd9d768=_[_0xd26a('0x2c')](db[_0xd26a('0x2d')]['rawAttributes'],function(_0x2856e1){return{'name':_0x2856e1['fieldName'],'type':_0x2856e1[_0xd26a('0x2e')][_0xd26a('0x2f')]};});_0x2e7abd[_0xd26a('0x30')]=_['map'](_0xd9d768,_0xd26a('0x2a'));_0x2e7abd[_0xd26a('0x31')]=_[_0xd26a('0x32')](_0x397399[_0xd26a('0x31')]);_0x2e7abd[_0xd26a('0x33')]=_['intersection'](_0x2e7abd[_0xd26a('0x30')],_0x2e7abd[_0xd26a('0x31')]);_0x5f4901[_0xd26a('0x34')]=_[_0xd26a('0x35')](_0x2e7abd[_0xd26a('0x30')],qs[_0xd26a('0x36')](_0x397399[_0xd26a('0x31')]['fields']));_0x5f4901['attributes']=_0x5f4901[_0xd26a('0x34')]['length']?_0x5f4901[_0xd26a('0x34')]:_0x2e7abd[_0xd26a('0x30')];if(!_0x397399[_0xd26a('0x31')]['hasOwnProperty'](_0xd26a('0x37'))){_0x5f4901[_0xd26a('0x1e')]=qs[_0xd26a('0x1e')](_0x397399[_0xd26a('0x31')]['limit']);_0x5f4901[_0xd26a('0x1c')]=qs[_0xd26a('0x1c')](_0x397399[_0xd26a('0x31')][_0xd26a('0x1c')]);}_0x5f4901['order']=qs[_0xd26a('0x38')](_0x397399[_0xd26a('0x31')][_0xd26a('0x38')]);_0x5f4901[_0xd26a('0x39')]=qs[_0xd26a('0x33')](_[_0xd26a('0x3a')](_0x397399[_0xd26a('0x31')],_0x2e7abd[_0xd26a('0x33')]),_0xd9d768);if(_0x397399[_0xd26a('0x31')]['filter']){_0x5f4901[_0xd26a('0x39')]=_[_0xd26a('0x3b')](_0x5f4901[_0xd26a('0x39')],{'$or':_[_0xd26a('0x2c')](_0xd9d768,function(_0x143a9e){if(_0x143a9e['type']!==_0xd26a('0x3c')){var _0x139ff3={};_0x139ff3[_0x143a9e[_0xd26a('0x2a')]]={'$like':'%'+_0x397399[_0xd26a('0x31')][_0xd26a('0x3d')]+'%'};return _0x139ff3;}})});}_0x5f4901=_[_0xd26a('0x3b')]({},_0x5f4901,_0x397399['options']);var _0x3eb9e8={'where':_0x5f4901[_0xd26a('0x39')]};return db[_0xd26a('0x2d')][_0xd26a('0x1f')](_0x3eb9e8)[_0xd26a('0x25')](function(_0x3990bc){_0x4a5304['count']=_0x3990bc;if(_0x397399[_0xd26a('0x31')][_0xd26a('0x3e')]){_0x5f4901[_0xd26a('0x3f')]=[{'all':!![]}];}return db['SalesforceField'][_0xd26a('0x40')](_0x5f4901);})[_0xd26a('0x25')](function(_0x463484){_0x4a5304[_0xd26a('0x41')]=_0x463484;return _0x4a5304;})['then'](respondWithFilteredResult(_0xaa1a9,_0x5f4901))[_0xd26a('0x42')](handleError(_0xaa1a9,null));};exports[_0xd26a('0x43')]=function(_0x27712e,_0x49d60f){var _0x5e83c3={'raw':!![],'where':{'id':_0x27712e[_0xd26a('0x44')]['id']}},_0x1bae1f={};_0x1bae1f[_0xd26a('0x30')]=_[_0xd26a('0x32')](db['SalesforceField'][_0xd26a('0x45')]);_0x1bae1f[_0xd26a('0x31')]=_[_0xd26a('0x32')](_0x27712e[_0xd26a('0x31')]);_0x1bae1f[_0xd26a('0x33')]=_['intersection'](_0x1bae1f[_0xd26a('0x30')],_0x1bae1f[_0xd26a('0x31')]);_0x5e83c3[_0xd26a('0x34')]=_[_0xd26a('0x35')](_0x1bae1f[_0xd26a('0x30')],qs[_0xd26a('0x36')](_0x27712e['query'][_0xd26a('0x36')]));_0x5e83c3[_0xd26a('0x34')]=_0x5e83c3[_0xd26a('0x34')][_0xd26a('0x46')]?_0x5e83c3[_0xd26a('0x34')]:_0x1bae1f[_0xd26a('0x30')];if(_0x27712e[_0xd26a('0x31')][_0xd26a('0x3e')]){_0x5e83c3['include']=[{'all':!![]}];}_0x5e83c3=_[_0xd26a('0x3b')]({},_0x5e83c3,_0x27712e['options']);return db[_0xd26a('0x2d')][_0xd26a('0x47')](_0x5e83c3)['then'](handleEntityNotFound(_0x49d60f,null))[_0xd26a('0x25')](respondWithResult(_0x49d60f,null))['catch'](handleError(_0x49d60f,null));};exports['create']=function(_0x5e6c7e,_0x69d52){return db[_0xd26a('0x2d')]['create'](_0x5e6c7e[_0xd26a('0x48')],{})[_0xd26a('0x25')](respondWithResult(_0x69d52,0xc9))[_0xd26a('0x42')](handleError(_0x69d52,null));};exports[_0xd26a('0x24')]=function(_0x5e47a5,_0x35690f){if(_0x5e47a5[_0xd26a('0x48')]['id']){delete _0x5e47a5[_0xd26a('0x48')]['id'];}return db[_0xd26a('0x2d')]['find']({'where':{'id':_0x5e47a5[_0xd26a('0x44')]['id']}})[_0xd26a('0x25')](handleEntityNotFound(_0x35690f,null))[_0xd26a('0x25')](saveUpdates(_0x5e47a5[_0xd26a('0x48')],null))['then'](respondWithResult(_0x35690f,null))[_0xd26a('0x42')](handleError(_0x35690f,null));};exports['destroy']=function(_0x3271a1,_0x41560c){return db[_0xd26a('0x2d')][_0xd26a('0x47')]({'where':{'id':_0x3271a1[_0xd26a('0x44')]['id']}})[_0xd26a('0x25')](handleEntityNotFound(_0x41560c,null))[_0xd26a('0x25')](removeEntity(_0x41560c,null))[_0xd26a('0x42')](handleError(_0x41560c,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index 7e4e71c..5e711a7 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 _0x59a2=['lodash','util','api','moment','bluebird','rimraf','./intSalesforceField.attributes','exports','define','SalesforceField','int_salesforce_fields','salesforce_unique_index'];(function(_0x2e224b,_0x49c352){var _0x3a7a3a=function(_0x4762ca){while(--_0x4762ca){_0x2e224b['push'](_0x2e224b['shift']());}};_0x3a7a3a(++_0x49c352);}(_0x59a2,0xcc));var _0x259a=function(_0x24bcb,_0x1eb5f4){_0x24bcb=_0x24bcb-0x0;var _0x46e7fc=_0x59a2[_0x24bcb];return _0x46e7fc;};'use strict';var _=require(_0x259a('0x0'));var util=require(_0x259a('0x1'));var logger=require('../../config/logger')(_0x259a('0x2'));var moment=require(_0x259a('0x3'));var BPromise=require(_0x259a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x259a('0x5'));var config=require('../../config/environment');var attributes=require(_0x259a('0x6'));module[_0x259a('0x7')]=function(_0x17dbbe,_0x116690){return _0x17dbbe[_0x259a('0x8')](_0x259a('0x9'),attributes,{'tableName':_0x259a('0xa'),'paranoid':![],'indexes':[{'name':_0x259a('0xb'),'fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2159=['api','bluebird','request-promise','path','rimraf','./intSalesforceField.attributes','exports','define','SalesforceField','int_salesforce_fields','salesforce_unique_index','idField','FieldId','util','../../config/logger'];(function(_0x2a334b,_0x10e5b2){var _0xb7ac2b=function(_0x23415e){while(--_0x23415e){_0x2a334b['push'](_0x2a334b['shift']());}};_0xb7ac2b(++_0x10e5b2);}(_0x2159,0x1ed));var _0x9215=function(_0x37952b,_0x69eef0){_0x37952b=_0x37952b-0x0;var _0x4fcc35=_0x2159[_0x37952b];return _0x4fcc35;};'use strict';var _=require('lodash');var util=require(_0x9215('0x0'));var logger=require(_0x9215('0x1'))(_0x9215('0x2'));var moment=require('moment');var BPromise=require(_0x9215('0x3'));var rp=require(_0x9215('0x4'));var fs=require('fs');var path=require(_0x9215('0x5'));var rimraf=require(_0x9215('0x6'));var config=require('../../config/environment');var attributes=require(_0x9215('0x7'));module[_0x9215('0x8')]=function(_0x385f97,_0x41c8e){return _0x385f97[_0x9215('0x9')](_0x9215('0xa'),attributes,{'tableName':_0x9215('0xb'),'paranoid':![],'indexes':[{'name':_0x9215('0xc'),'fields':[_0x9215('0xd'),_0x9215('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.rpc.js b/server/api/intSalesforceField/intSalesforceField.rpc.js index 5c73cdf..7b9cae6 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 _0xcb0c=['result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','error','message'];(function(_0x90b787,_0x47161d){var _0xa89292=function(_0x6bac79){while(--_0x6bac79){_0x90b787['push'](_0x90b787['shift']());}};_0xa89292(++_0x47161d);}(_0xcb0c,0xd4));var _0xccb0=function(_0x3ea392,_0x59d098){_0x3ea392=_0x3ea392-0x0;var _0x160ddf=_0xcb0c[_0x3ea392];return _0x160ddf;};'use strict';var _=require(_0xccb0('0x0'));var util=require('util');var moment=require(_0xccb0('0x1'));var BPromise=require(_0xccb0('0x2'));var rs=require(_0xccb0('0x3'));var fs=require('fs');var Redis=require(_0xccb0('0x4'));var db=require(_0xccb0('0x5'))['db'];var utils=require(_0xccb0('0x6'));var logger=require('../../config/logger')(_0xccb0('0x7'));var config=require(_0xccb0('0x8'));var jayson=require(_0xccb0('0x9'));var client=jayson['client'][_0xccb0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x31dfbf,_0x9daac1,_0x3bdcc7){return new BPromise(function(_0x252e60,_0x19f47){return client[_0xccb0('0xb')](_0x31dfbf,_0x3bdcc7)[_0xccb0('0xc')](function(_0xda80a){logger[_0xccb0('0xd')](_0xccb0('0xe'),_0x9daac1,_0xccb0('0xf'));logger[_0xccb0('0x10')]('SalesforceField,\x20%s,\x20%s,\x20%s',_0x9daac1,_0xccb0('0xf'),JSON['stringify'](_0xda80a));if(_0xda80a['error']){if(_0xda80a[_0xccb0('0x11')]['code']===0x1f4){logger[_0xccb0('0x11')](_0xccb0('0xe'),_0x9daac1,_0xda80a[_0xccb0('0x11')][_0xccb0('0x12')]);return _0x19f47(_0xda80a[_0xccb0('0x11')]['message']);}logger[_0xccb0('0x11')](_0xccb0('0xe'),_0x9daac1,_0xda80a[_0xccb0('0x11')][_0xccb0('0x12')]);return _0x252e60(_0xda80a[_0xccb0('0x11')][_0xccb0('0x12')]);}else{logger[_0xccb0('0xd')](_0xccb0('0xe'),_0x9daac1,_0xccb0('0xf'));_0x252e60(_0xda80a[_0xccb0('0x13')][_0xccb0('0x12')]);}})[_0xccb0('0x14')](function(_0x36daf3){logger[_0xccb0('0x11')](_0xccb0('0xe'),_0x9daac1,_0x36daf3);_0x19f47(_0x36daf3);});});} \ No newline at end of file +var _0x03e2=['catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','then','info','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result'];(function(_0x409398,_0x5468f0){var _0x41e84c=function(_0x2a9a90){while(--_0x2a9a90){_0x409398['push'](_0x409398['shift']());}};_0x41e84c(++_0x5468f0);}(_0x03e2,0xfd));var _0x203e=function(_0x21eba9,_0x4d65e2){_0x21eba9=_0x21eba9-0x0;var _0x1b1411=_0x03e2[_0x21eba9];return _0x1b1411;};'use strict';var _=require(_0x203e('0x0'));var util=require('util');var moment=require(_0x203e('0x1'));var BPromise=require(_0x203e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x203e('0x3'));var db=require(_0x203e('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x203e('0x5'))(_0x203e('0x6'));var config=require(_0x203e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x203e('0x8')][_0x203e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x16740a,_0x394ee7,_0x320627){return new BPromise(function(_0x1b1c46,_0x9ae527){return client['request'](_0x16740a,_0x320627)[_0x203e('0xa')](function(_0x1094c6){logger[_0x203e('0xb')](_0x203e('0xc'),_0x394ee7,_0x203e('0xd'));logger[_0x203e('0xe')]('SalesforceField,\x20%s,\x20%s,\x20%s',_0x394ee7,'request\x20sent',JSON[_0x203e('0xf')](_0x1094c6));if(_0x1094c6[_0x203e('0x10')]){if(_0x1094c6['error'][_0x203e('0x11')]===0x1f4){logger['error'](_0x203e('0xc'),_0x394ee7,_0x1094c6[_0x203e('0x10')]['message']);return _0x9ae527(_0x1094c6[_0x203e('0x10')]['message']);}logger[_0x203e('0x10')](_0x203e('0xc'),_0x394ee7,_0x1094c6[_0x203e('0x10')]['message']);return _0x1b1c46(_0x1094c6['error'][_0x203e('0x12')]);}else{logger[_0x203e('0xb')](_0x203e('0xc'),_0x394ee7,_0x203e('0xd'));_0x1b1c46(_0x1094c6[_0x203e('0x13')][_0x203e('0x12')]);}})[_0x203e('0x14')](function(_0x15b82f){logger[_0x203e('0x10')](_0x203e('0xc'),_0x394ee7,_0x15b82f);_0x9ae527(_0x15b82f);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index ed4a0e1..69a5173 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 _0x573e=['util','path','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','/:id','update','delete','destroy','exports'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x573e,0x134));var _0xe573=function(_0x2ac6fd,_0x1f843a){_0x2ac6fd=_0x2ac6fd-0x0;var _0x68f1f6=_0x573e[_0x2ac6fd];return _0x68f1f6;};'use strict';var multer=require('multer');var util=require(_0xe573('0x0'));var path=require(_0xe573('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xe573('0x2'));var auth=require(_0xe573('0x3'));var interaction=require(_0xe573('0x4'));var config=require('../../config/environment');var controller=require('./intServicenowAccount.controller');router[_0xe573('0x5')]('/',auth[_0xe573('0x6')](),controller[_0xe573('0x7')]);router[_0xe573('0x5')]('/:id',auth[_0xe573('0x6')](),controller[_0xe573('0x8')]);router[_0xe573('0x5')](_0xe573('0x9'),auth[_0xe573('0x6')](),controller[_0xe573('0xa')]);router[_0xe573('0x5')](_0xe573('0xb'),auth[_0xe573('0x6')](),controller[_0xe573('0xc')]);router[_0xe573('0xd')]('/',auth[_0xe573('0x6')](),controller[_0xe573('0xe')]);router[_0xe573('0xd')](_0xe573('0x9'),auth[_0xe573('0x6')](),controller[_0xe573('0xf')]);router[_0xe573('0x10')](_0xe573('0x11'),auth[_0xe573('0x6')](),controller[_0xe573('0x12')]);router[_0xe573('0x13')](_0xe573('0x11'),auth[_0xe573('0x6')](),controller[_0xe573('0x14')]);module[_0xe573('0x15')]=router; \ No newline at end of file +var _0x7eee=['create','addConfiguration','put','/:id','update','destroy','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','get','isAuthenticated','index','show','/:id/configurations','/:id/fields','getFields','post'];(function(_0x29acf0,_0x2f89a4){var _0x3d3071=function(_0x3f8d9f){while(--_0x3f8d9f){_0x29acf0['push'](_0x29acf0['shift']());}};_0x3d3071(++_0x2f89a4);}(_0x7eee,0x1bb));var _0xe7ee=function(_0x57cd3d,_0x50bcf3){_0x57cd3d=_0x57cd3d-0x0;var _0x5b0c68=_0x7eee[_0x57cd3d];return _0x5b0c68;};'use strict';var multer=require('multer');var util=require(_0xe7ee('0x0'));var path=require('path');var timeout=require(_0xe7ee('0x1'));var express=require(_0xe7ee('0x2'));var router=express[_0xe7ee('0x3')]();var fs_extra=require(_0xe7ee('0x4'));var auth=require(_0xe7ee('0x5'));var interaction=require(_0xe7ee('0x6'));var config=require(_0xe7ee('0x7'));var controller=require(_0xe7ee('0x8'));router[_0xe7ee('0x9')]('/',auth[_0xe7ee('0xa')](),controller[_0xe7ee('0xb')]);router[_0xe7ee('0x9')]('/:id',auth[_0xe7ee('0xa')](),controller[_0xe7ee('0xc')]);router[_0xe7ee('0x9')](_0xe7ee('0xd'),auth[_0xe7ee('0xa')](),controller['getConfigurations']);router['get'](_0xe7ee('0xe'),auth['isAuthenticated'](),controller[_0xe7ee('0xf')]);router[_0xe7ee('0x10')]('/',auth['isAuthenticated'](),controller[_0xe7ee('0x11')]);router[_0xe7ee('0x10')](_0xe7ee('0xd'),auth[_0xe7ee('0xa')](),controller[_0xe7ee('0x12')]);router[_0xe7ee('0x13')](_0xe7ee('0x14'),auth[_0xe7ee('0xa')](),controller[_0xe7ee('0x15')]);router['delete'](_0xe7ee('0x14'),auth['isAuthenticated'](),controller[_0xe7ee('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index 4016202..c8cfc0f 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 _0xcc91=['STRING','remoteUri','sequelize','exports'];(function(_0x32e758,_0x13c271){var _0x349316=function(_0x27a9da){while(--_0x27a9da){_0x32e758['push'](_0x32e758['shift']());}};_0x349316(++_0x13c271);}(_0xcc91,0xf6));var _0x1cc9=function(_0x149083,_0x4047b6){_0x149083=_0x149083-0x0;var _0x4dc74e=_0xcc91[_0x149083];return _0x4dc74e;};'use strict';var Sequelize=require(_0x1cc9('0x0'));module[_0x1cc9('0x1')]={'name':{'type':Sequelize[_0x1cc9('0x2')]},'description':{'type':Sequelize[_0x1cc9('0x2')]},'username':{'type':Sequelize['STRING'],'unique':'username'},'password':{'type':Sequelize[_0x1cc9('0x2')]},'email':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x1cc9('0x2')],'unique':_0x1cc9('0x3')},'serverUrl':{'type':Sequelize[_0x1cc9('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x16dd=['STRING','username','remoteUri','sequelize','exports'];(function(_0x1fb2b3,_0x22524d){var _0xb13eb2=function(_0x3bbca7){while(--_0x3bbca7){_0x1fb2b3['push'](_0x1fb2b3['shift']());}};_0xb13eb2(++_0x22524d);}(_0x16dd,0xee));var _0xd16d=function(_0x152d79,_0x4e4602){_0x152d79=_0x152d79-0x0;var _0x41d90e=_0x16dd[_0x152d79];return _0x41d90e;};'use strict';var Sequelize=require(_0xd16d('0x0'));module[_0xd16d('0x1')]={'name':{'type':Sequelize[_0xd16d('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xd16d('0x2')],'unique':_0xd16d('0x3')},'password':{'type':Sequelize[_0xd16d('0x2')]},'email':{'type':Sequelize[_0xd16d('0x2')]},'remoteUri':{'type':Sequelize[_0xd16d('0x2')],'unique':_0xd16d('0x4')},'serverUrl':{'type':Sequelize[_0xd16d('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index afbbf14..1270736 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 _0xf2b1=['status','end','json','offset','limit','undefined','count','set','apply','reject','update','destroy','then','stack','name','send','index','map','ServicenowAccount','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','findAll','rows','catch','show','params','includeAll','body','find','getConfigurations','findOne','ServicenowConfiguration','addConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','create','ServicenowField','getFields','made_sla','hold_reason','subcategory','close_code','notify','incident_state','category','parent','caused_by','watch_list','upon_reject','sys_updated_on','number','user_input','sys_created_on','sys_domain','state','knowledge','closed_at','delivery_plan','impact','work_notes_list','sys_domain_path','rfc','time_worked','expected_start','opened_at','business_duration','group_list','reopened_time','resolved_at','caller_id','approval_set','short_description','correlation_display','work_start','assignment_group','business_stc','description','calendar_duration','sys_class_name','close_notes','closed_by','parent_incident','contact_type','reopened_by','problem_id','reassignment_count','activity_due','assigned_to','severity','sla_due','approval','comments_and_work_notes','reopen_count','escalation','upon_approval','correlation_id','location','username','password','email','remoteUri','slice','substring','lastIndexOf','format','%s/api/now/doc/table/schema/','%s/api/now/table/','result','incident\x20table\x20objects','assign','remove','includes','forEach','internalType','label','all','log','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','push','concat','ServiceNow\x20error:\x20','test','statusCode','error','Wrong\x20credentials','boolean','True','true','False','GET','sys_choice?sysparm_query=name=incident^element=','inactive','false','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../components/integrations/configuration','sendStatus'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xf2b1,0x153));var _0x1f2b=function(_0x1d0764,_0x2beb7c){_0x1d0764=_0x1d0764-0x0;var _0x423f49=_0xf2b1[_0x1d0764];return _0x423f49;};'use strict';var emlformat=require(_0x1f2b('0x0'));var rimraf=require(_0x1f2b('0x1'));var zipdir=require(_0x1f2b('0x2'));var jsonpatch=require(_0x1f2b('0x3'));var rp=require(_0x1f2b('0x4'));var moment=require(_0x1f2b('0x5'));var BPromise=require(_0x1f2b('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x1f2b('0x7'));var sox=require('sox');var csv=require(_0x1f2b('0x8'));var ejs=require(_0x1f2b('0x9'));var fs=require('fs');var fs_extra=require(_0x1f2b('0xa'));var _=require(_0x1f2b('0xb'));var squel=require('squel');var crypto=require(_0x1f2b('0xc'));var jsforce=require(_0x1f2b('0xd'));var deskjs=require(_0x1f2b('0xe'));var toCsv=require('to-csv');var querystring=require(_0x1f2b('0xf'));var Papa=require(_0x1f2b('0x10'));var Redis=require('ioredis');var authService=require(_0x1f2b('0x11'));var qs=require(_0x1f2b('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1f2b('0x13'));var logger=require(_0x1f2b('0x14'))('api');var utils=require(_0x1f2b('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x1f2b('0x16'));var db=require('../../mysqldb')['db'];var integrations=require(_0x1f2b('0x17'));function respondWithStatusCode(_0x14561e,_0x151f8f){_0x151f8f=_0x151f8f||0xcc;return function(_0x38b752){if(_0x38b752){return _0x14561e[_0x1f2b('0x18')](_0x151f8f);}return _0x14561e[_0x1f2b('0x19')](_0x151f8f)[_0x1f2b('0x1a')]();};}function respondWithResult(_0x46abe8,_0x59ce38){_0x59ce38=_0x59ce38||0xc8;return function(_0x5a8139){if(_0x5a8139){return _0x46abe8[_0x1f2b('0x19')](_0x59ce38)[_0x1f2b('0x1b')](_0x5a8139);}};}function respondWithFilteredResult(_0x4dbfa8,_0xc80856){return function(_0xc8be70){if(_0xc8be70){var _0x1280cf=typeof _0xc80856[_0x1f2b('0x1c')]==='undefined'&&typeof _0xc80856[_0x1f2b('0x1d')]===_0x1f2b('0x1e');var _0x598f4c=_0xc8be70[_0x1f2b('0x1f')];var _0x2ff103=_0x1280cf?0x0:_0xc80856[_0x1f2b('0x1c')];var _0x51bb7a=_0x1280cf?_0xc8be70[_0x1f2b('0x1f')]:_0xc80856[_0x1f2b('0x1c')]+_0xc80856[_0x1f2b('0x1d')];var _0x1d17f7;if(_0x51bb7a>=_0x598f4c){_0x51bb7a=_0x598f4c;_0x1d17f7=0xc8;}else{_0x1d17f7=0xce;}_0x4dbfa8[_0x1f2b('0x19')](_0x1d17f7);return _0x4dbfa8[_0x1f2b('0x20')]('Content-Range',_0x2ff103+'-'+_0x51bb7a+'/'+_0x598f4c)[_0x1f2b('0x1b')](_0xc8be70);}return null;};}function patchUpdates(_0x2c33d1){return function(_0xceb43a){try{jsonpatch[_0x1f2b('0x21')](_0xceb43a,_0x2c33d1,!![]);}catch(_0x4aa3ea){return BPromise[_0x1f2b('0x22')](_0x4aa3ea);}return _0xceb43a['save']();};}function saveUpdates(_0x493ddc,_0x1982b6){return function(_0x1cfb1e){if(_0x1cfb1e){return _0x1cfb1e[_0x1f2b('0x23')](_0x493ddc)['then'](function(_0xd91105){return _0xd91105;});}return null;};}function removeEntity(_0x4f94a7,_0x2f89b0){return function(_0x598037){if(_0x598037){return _0x598037[_0x1f2b('0x24')]()[_0x1f2b('0x25')](function(){_0x4f94a7[_0x1f2b('0x19')](0xcc)[_0x1f2b('0x1a')]();});}};}function handleEntityNotFound(_0x336a86,_0x4193e5){return function(_0x2e8a52){if(!_0x2e8a52){_0x336a86[_0x1f2b('0x18')](0x194);}return _0x2e8a52;};}function handleError(_0x37de37,_0x565a98){_0x565a98=_0x565a98||0x1f4;return function(_0x3fbbbb){logger['error'](_0x3fbbbb[_0x1f2b('0x26')]);if(_0x3fbbbb[_0x1f2b('0x27')]){delete _0x3fbbbb[_0x1f2b('0x27')];}_0x37de37[_0x1f2b('0x19')](_0x565a98)[_0x1f2b('0x28')](_0x3fbbbb);};}exports[_0x1f2b('0x29')]=function(_0x5ccc27,_0x3ceaff){var _0x465fd9={},_0x4c2ed2={},_0x1722e4={'count':0x0,'rows':[]};var _0x5d92c4=_[_0x1f2b('0x2a')](db[_0x1f2b('0x2b')][_0x1f2b('0x2c')],function(_0x9fb7eb){return{'name':_0x9fb7eb[_0x1f2b('0x2d')],'type':_0x9fb7eb[_0x1f2b('0x2e')][_0x1f2b('0x2f')]};});_0x4c2ed2['model']=_[_0x1f2b('0x2a')](_0x5d92c4,'name');_0x4c2ed2[_0x1f2b('0x30')]=_[_0x1f2b('0x31')](_0x5ccc27[_0x1f2b('0x30')]);_0x4c2ed2[_0x1f2b('0x32')]=_[_0x1f2b('0x33')](_0x4c2ed2[_0x1f2b('0x34')],_0x4c2ed2[_0x1f2b('0x30')]);_0x465fd9['attributes']=_[_0x1f2b('0x33')](_0x4c2ed2[_0x1f2b('0x34')],qs[_0x1f2b('0x35')](_0x5ccc27['query'][_0x1f2b('0x35')]));_0x465fd9[_0x1f2b('0x36')]=_0x465fd9['attributes'][_0x1f2b('0x37')]?_0x465fd9[_0x1f2b('0x36')]:_0x4c2ed2[_0x1f2b('0x34')];if(!_0x5ccc27[_0x1f2b('0x30')][_0x1f2b('0x38')](_0x1f2b('0x39'))){_0x465fd9[_0x1f2b('0x1d')]=qs['limit'](_0x5ccc27['query'][_0x1f2b('0x1d')]);_0x465fd9[_0x1f2b('0x1c')]=qs[_0x1f2b('0x1c')](_0x5ccc27['query']['offset']);}_0x465fd9[_0x1f2b('0x3a')]=qs[_0x1f2b('0x3b')](_0x5ccc27[_0x1f2b('0x30')][_0x1f2b('0x3b')]);_0x465fd9[_0x1f2b('0x3c')]=qs[_0x1f2b('0x32')](_[_0x1f2b('0x3d')](_0x5ccc27[_0x1f2b('0x30')],_0x4c2ed2[_0x1f2b('0x32')]),_0x5d92c4);if(_0x5ccc27[_0x1f2b('0x30')][_0x1f2b('0x3e')]){_0x465fd9[_0x1f2b('0x3c')]=_[_0x1f2b('0x3f')](_0x465fd9['where'],{'$or':_[_0x1f2b('0x2a')](_0x5d92c4,function(_0xf1c561){if(_0xf1c561[_0x1f2b('0x2e')]!==_0x1f2b('0x40')){var _0x1c6b17={};_0x1c6b17[_0xf1c561[_0x1f2b('0x27')]]={'$like':'%'+_0x5ccc27[_0x1f2b('0x30')]['filter']+'%'};return _0x1c6b17;}})});}_0x465fd9=_[_0x1f2b('0x3f')]({},_0x465fd9,_0x5ccc27[_0x1f2b('0x41')]);var _0x1fd777={'where':_0x465fd9['where']};return db[_0x1f2b('0x2b')]['count'](_0x1fd777)[_0x1f2b('0x25')](function(_0x4f4968){_0x1722e4[_0x1f2b('0x1f')]=_0x4f4968;if(_0x5ccc27[_0x1f2b('0x30')]['includeAll']){_0x465fd9['include']=[{'all':!![]}];}return db[_0x1f2b('0x2b')][_0x1f2b('0x42')](_0x465fd9);})[_0x1f2b('0x25')](function(_0x63e6c0){_0x1722e4[_0x1f2b('0x43')]=_0x63e6c0;return _0x1722e4;})[_0x1f2b('0x25')](respondWithFilteredResult(_0x3ceaff,_0x465fd9))[_0x1f2b('0x44')](handleError(_0x3ceaff,null));};exports[_0x1f2b('0x45')]=function(_0x3873b2,_0x8fd218){var _0x1c752b={'raw':![],'where':{'id':_0x3873b2[_0x1f2b('0x46')]['id']}},_0x21b594={};_0x21b594['model']=_['keys'](db['ServicenowAccount'][_0x1f2b('0x2c')]);_0x21b594[_0x1f2b('0x30')]=_[_0x1f2b('0x31')](_0x3873b2[_0x1f2b('0x30')]);_0x21b594[_0x1f2b('0x32')]=_[_0x1f2b('0x33')](_0x21b594[_0x1f2b('0x34')],_0x21b594['query']);_0x1c752b[_0x1f2b('0x36')]=_[_0x1f2b('0x33')](_0x21b594[_0x1f2b('0x34')],qs[_0x1f2b('0x35')](_0x3873b2['query'][_0x1f2b('0x35')]));_0x1c752b[_0x1f2b('0x36')]=_0x1c752b['attributes'][_0x1f2b('0x37')]?_0x1c752b[_0x1f2b('0x36')]:_0x21b594['model'];if(_0x3873b2[_0x1f2b('0x30')][_0x1f2b('0x47')]){_0x1c752b['include']=[{'all':!![]}];}_0x1c752b=_[_0x1f2b('0x3f')]({},_0x1c752b,_0x3873b2[_0x1f2b('0x41')]);return db[_0x1f2b('0x2b')]['find'](_0x1c752b)['then'](handleEntityNotFound(_0x8fd218,null))[_0x1f2b('0x25')](respondWithResult(_0x8fd218,null))['catch'](handleError(_0x8fd218,null));};exports['create']=function(_0xf68435,_0x51c496){return db['ServicenowAccount']['create'](_0xf68435[_0x1f2b('0x48')],{})['then'](respondWithResult(_0x51c496,0xc9))[_0x1f2b('0x44')](handleError(_0x51c496,null));};exports['update']=function(_0xae616c,_0x237563){if(_0xae616c[_0x1f2b('0x48')]['id']){delete _0xae616c[_0x1f2b('0x48')]['id'];}return db[_0x1f2b('0x2b')][_0x1f2b('0x49')]({'where':{'id':_0xae616c[_0x1f2b('0x46')]['id']}})['then'](handleEntityNotFound(_0x237563,null))[_0x1f2b('0x25')](saveUpdates(_0xae616c[_0x1f2b('0x48')],null))[_0x1f2b('0x25')](respondWithResult(_0x237563,null))['catch'](handleError(_0x237563,null));};exports['destroy']=function(_0x4f6de2,_0x1fffec){return db[_0x1f2b('0x2b')][_0x1f2b('0x49')]({'where':{'id':_0x4f6de2[_0x1f2b('0x46')]['id']}})[_0x1f2b('0x25')](handleEntityNotFound(_0x1fffec,null))[_0x1f2b('0x25')](removeEntity(_0x1fffec,null))[_0x1f2b('0x44')](handleError(_0x1fffec,null));};exports[_0x1f2b('0x4a')]=function(_0x31ae7c,_0x5c3824,_0x566697){var _0x35d415={};var _0x124e5a={};var _0x4efbbf;var _0x42392f;return db[_0x1f2b('0x2b')][_0x1f2b('0x4b')]({'where':{'id':_0x31ae7c[_0x1f2b('0x46')]['id']}})[_0x1f2b('0x25')](handleEntityNotFound(_0x5c3824,null))[_0x1f2b('0x25')](function(_0x3761e3){if(_0x3761e3){_0x4efbbf=_0x3761e3;_0x124e5a[_0x1f2b('0x34')]=_[_0x1f2b('0x31')](db[_0x1f2b('0x4c')][_0x1f2b('0x2c')]);_0x124e5a[_0x1f2b('0x30')]=_[_0x1f2b('0x31')](_0x31ae7c[_0x1f2b('0x30')]);_0x124e5a['filters']=_['intersection'](_0x124e5a[_0x1f2b('0x34')],_0x124e5a[_0x1f2b('0x30')]);_0x35d415[_0x1f2b('0x36')]=_[_0x1f2b('0x33')](_0x124e5a['model'],qs[_0x1f2b('0x35')](_0x31ae7c[_0x1f2b('0x30')][_0x1f2b('0x35')]));_0x35d415[_0x1f2b('0x36')]=_0x35d415[_0x1f2b('0x36')][_0x1f2b('0x37')]?_0x35d415['attributes']:_0x124e5a['model'];_0x35d415[_0x1f2b('0x3a')]=qs[_0x1f2b('0x3b')](_0x31ae7c[_0x1f2b('0x30')][_0x1f2b('0x3b')]);_0x35d415['where']=qs[_0x1f2b('0x32')](_['pick'](_0x31ae7c[_0x1f2b('0x30')],_0x124e5a['filters']));if(_0x31ae7c[_0x1f2b('0x30')][_0x1f2b('0x3e')]){_0x35d415[_0x1f2b('0x3c')]=_[_0x1f2b('0x3f')](_0x35d415[_0x1f2b('0x3c')],{'$or':_['map'](_0x35d415[_0x1f2b('0x36')],function(_0x21d925){var _0x12ab3d={};_0x12ab3d[_0x21d925]={'$like':'%'+_0x31ae7c['query'][_0x1f2b('0x3e')]+'%'};return _0x12ab3d;})});}_0x35d415=_[_0x1f2b('0x3f')]({},_0x35d415,_0x31ae7c[_0x1f2b('0x41')]);return _0x4efbbf[_0x1f2b('0x4a')](_0x35d415);}})[_0x1f2b('0x25')](function(_0x37d773){if(_0x37d773){_0x42392f=_0x37d773[_0x1f2b('0x37')];if(!_0x31ae7c[_0x1f2b('0x30')][_0x1f2b('0x38')](_0x1f2b('0x39'))){_0x35d415[_0x1f2b('0x1d')]=qs['limit'](_0x31ae7c[_0x1f2b('0x30')]['limit']);_0x35d415[_0x1f2b('0x1c')]=qs['offset'](_0x31ae7c[_0x1f2b('0x30')]['offset']);}return _0x4efbbf[_0x1f2b('0x4a')](_0x35d415);}})[_0x1f2b('0x25')](function(_0x523ea8){if(_0x523ea8){return _0x523ea8?{'count':_0x42392f,'rows':_0x523ea8}:null;}})[_0x1f2b('0x25')](respondWithResult(_0x5c3824,null))[_0x1f2b('0x44')](handleError(_0x5c3824,null));};exports[_0x1f2b('0x4d')]=function(_0x53e3cc,_0x200fe9,_0x38a09f){if(_0x53e3cc[_0x1f2b('0x48')]['id']){delete _0x53e3cc[_0x1f2b('0x48')]['id'];}return db[_0x1f2b('0x2b')]['findOne']({'where':{'id':_0x53e3cc[_0x1f2b('0x46')]['id']}})[_0x1f2b('0x25')](handleEntityNotFound(_0x200fe9,null))[_0x1f2b('0x25')](function(_0x65769f){if(_0x65769f){_0x53e3cc[_0x1f2b('0x48')]['AccountId']=_0x65769f['id'];_0x53e3cc[_0x1f2b('0x48')][_0x1f2b('0x4e')]=integrations[_0x1f2b('0x4f')](_0x53e3cc[_0x1f2b('0x48')][_0x1f2b('0x50')],_0x53e3cc[_0x1f2b('0x48')][_0x1f2b('0x2e')]);_0x53e3cc['body'][_0x1f2b('0x51')]=integrations[_0x1f2b('0x52')](_0x53e3cc[_0x1f2b('0x48')]['channel'],_0x53e3cc['body']['type']);return db['ServicenowConfiguration'][_0x1f2b('0x53')](_0x53e3cc['body'],{'include':[{'model':db['ServicenowField'],'as':'Subjects'},{'model':db[_0x1f2b('0x54')],'as':_0x1f2b('0x51')}]});}return null;})[_0x1f2b('0x25')](respondWithResult(_0x200fe9,null))['catch'](handleError(_0x200fe9,null));};exports[_0x1f2b('0x55')]=function(_0x762c8d,_0x562bb6,_0x540160){var _0x383933=[_0x1f2b('0x56'),_0x1f2b('0x57'),'knowledge',_0x1f2b('0x58'),_0x1f2b('0x59'),_0x1f2b('0x5a'),_0x1f2b('0x5b'),'severity',_0x1f2b('0x5c')];var _0x4e6e97=[_0x1f2b('0x5d'),_0x1f2b('0x56'),_0x1f2b('0x5e'),_0x1f2b('0x5f'),_0x1f2b('0x60'),_0x1f2b('0x61'),'child_incidents',_0x1f2b('0x57'),'approval_history',_0x1f2b('0x62'),'resolved_by','sys_updated_by','opened_by',_0x1f2b('0x63'),_0x1f2b('0x64'),_0x1f2b('0x65'),_0x1f2b('0x66'),'sys_created_by',_0x1f2b('0x67'),_0x1f2b('0x3a'),'calendar_stc',_0x1f2b('0x68'),'cmdb_ci',_0x1f2b('0x69'),_0x1f2b('0x6a'),'active',_0x1f2b('0x6b'),'business_service','priority',_0x1f2b('0x6c'),_0x1f2b('0x6d'),_0x1f2b('0x6e'),_0x1f2b('0x6f'),_0x1f2b('0x70'),_0x1f2b('0x71'),_0x1f2b('0x72'),'work_end',_0x1f2b('0x73'),_0x1f2b('0x74'),_0x1f2b('0x75'),_0x1f2b('0x76'),'subcategory','work_notes',_0x1f2b('0x77'),_0x1f2b('0x59'),_0x1f2b('0x78'),'delivery_task',_0x1f2b('0x79'),_0x1f2b('0x7a'),_0x1f2b('0x7b'),'additional_assignee_list',_0x1f2b('0x7c'),_0x1f2b('0x7d'),_0x1f2b('0x5a'),_0x1f2b('0x7e'),_0x1f2b('0x7f'),_0x1f2b('0x80'),'follow_up',_0x1f2b('0x81'),'sys_id',_0x1f2b('0x82'),_0x1f2b('0x83'),_0x1f2b('0x5b'),'urgency',_0x1f2b('0x84'),'company',_0x1f2b('0x85'),_0x1f2b('0x86'),_0x1f2b('0x87'),_0x1f2b('0x88'),'comments',_0x1f2b('0x89'),_0x1f2b('0x8a'),_0x1f2b('0x8b'),'due_date','sys_mod_count',_0x1f2b('0x8c'),'sys_tags',_0x1f2b('0x8d'),_0x1f2b('0x8e'),_0x1f2b('0x8f'),_0x1f2b('0x90'),'category'];var _0x261171='';var _0x109e7e='';var _0x515566=[];var _0x537524='';var _0x430185='';var _0x26d776=[];var _0x57c907='';var _0x4cc9e1='';var _0x2e4bb9={};var _0x50528f='';return db[_0x1f2b('0x2b')][_0x1f2b('0x4b')]({'where':{'id':_0x762c8d[_0x1f2b('0x46')]['id']},'attributes':['id',_0x1f2b('0x91'),_0x1f2b('0x92'),_0x1f2b('0x93'),_0x1f2b('0x94'),'serverUrl']})['then'](handleEntityNotFound(_0x562bb6,null))[_0x1f2b('0x25')](function(_0x3e1ae7){if(_0x3e1ae7){_0x50528f=_0x3e1ae7['remoteUri'];var _0x58b618=_0x50528f[_0x1f2b('0x95')](-0x1);if(_0x58b618==='/'){_0x50528f=_0x50528f[_0x1f2b('0x96')](0x0,_0x50528f[_0x1f2b('0x97')](_0x58b618));}_0x4cc9e1=util[_0x1f2b('0x98')](_0x1f2b('0x99'),_0x50528f);_0x57c907=util[_0x1f2b('0x98')](_0x1f2b('0x9a'),_0x50528f);_0x2e4bb9={'user':_0x3e1ae7[_0x1f2b('0x91')],'pass':_0x3e1ae7[_0x1f2b('0x92')]};var _0x7202ed={'method':'GET','uri':_0x4cc9e1+'incident?sysparm_display_value=all','auth':_0x2e4bb9,'json':!![]};return rp(_0x7202ed);}})['then'](function(_0xfb1ea0){if(_0xfb1ea0[_0x1f2b('0x9b')][_0x1f2b('0x37')]>0x0){_0x261171=_0xfb1ea0[_0x1f2b('0x9b')];}console['log'](_0x1f2b('0x9c'),_0x261171);_0x26d776=[];_0x109e7e=Object[_0x1f2b('0x9d')]([],_0x261171);_[_0x1f2b('0x9e')](_0x109e7e,function(_0x24b36a){return!_0x383933[_0x1f2b('0x9f')](_0x24b36a[_0x1f2b('0x27')]);});_0x109e7e[_0x1f2b('0xa0')](function(_0x3028a2){var _0x52019a=createFieldObject(_0x57c907,_0x2e4bb9,_0x3028a2[_0x1f2b('0xa1')],_0x3028a2[_0x1f2b('0x27')],_0x3028a2[_0x1f2b('0xa2')],![]);_0x26d776['push'](_0x52019a);});return Promise[_0x1f2b('0xa3')](_0x26d776);})[_0x1f2b('0x25')](function(_0x41b738){_0x515566=_0x41b738;_0x537524=Object[_0x1f2b('0x9d')]([],_0x261171);console[_0x1f2b('0xa4')](_0x1f2b('0xa5'),_0x261171);_[_0x1f2b('0x9e')](_0x537524,function(_0x4e0713){return _0x4e6e97[_0x1f2b('0x9f')](_0x4e0713[_0x1f2b('0x27')]);});console[_0x1f2b('0xa4')](_0x1f2b('0xa6'),_0x537524);_0x26d776=[];_0x537524[_0x1f2b('0xa0')](function(_0x305fde){var _0x9d4c5c=createFieldObject(_0x57c907,_0x2e4bb9,_0x305fde['internalType'],_0x305fde[_0x1f2b('0x27')],_0x305fde['label'],!![]);_0x26d776[_0x1f2b('0xa7')](_0x9d4c5c);});return Promise['all'](_0x26d776);})['then'](function(_0x35e584){_0x430185=_0x35e584;var _0x5125fb=_0x515566[_0x1f2b('0xa8')](_0x430185);return{'count':_0x5125fb['length'],'rows':_0x5125fb};})[_0x1f2b('0x25')](respondWithResult(_0x562bb6,null))[_0x1f2b('0x44')](function(_0xdd72f5){console[_0x1f2b('0xa4')](_0x1f2b('0xa9')+_0xdd72f5);var _0x330c56=_0x762c8d[_0x1f2b('0x30')][_0x1f2b('0xaa')]?0x1f4:_0xdd72f5[_0x1f2b('0xab')]||0x1f4;logger[_0x1f2b('0xac')](_0xdd72f5[_0x1f2b('0x26')]);delete _0xdd72f5[_0x1f2b('0x27')];if(_0x330c56===0x191){_0x330c56=0x190;}_0x562bb6[_0x1f2b('0x19')](_0x330c56)[_0x1f2b('0x28')](_0x762c8d[_0x1f2b('0x30')][_0x1f2b('0xaa')]?{'message':_0x1f2b('0xad'),'statusCode':_0xdd72f5[_0x1f2b('0xab')]}:_0xdd72f5);});};function createFieldObject(_0x41c0a1,_0xb34fd9,_0xb0e187,_0x26e512,_0x358164,_0x188f16){return new Promise(function(_0x3957ea,_0x346114){var _0x5ae4d8={'id':_0x26e512,'name':_0x358164,'custom':_0x188f16};if(_0xb0e187===_0x1f2b('0xae')){_0x5ae4d8[_0x1f2b('0x41')]=[{'name':_0x1f2b('0xaf'),'value':_0x1f2b('0xb0')},{'name':_0x1f2b('0xb1'),'value':'false'}];_0x3957ea(_0x5ae4d8);}else{var _0x22615b={'method':_0x1f2b('0xb2'),'uri':_0x41c0a1+_0x1f2b('0xb3')+_0x26e512,'auth':_0xb34fd9,'json':!![]};return rp(_0x22615b)['then'](function(_0x545dcf){var _0x5a91d3=[];if(_0x545dcf[_0x1f2b('0x9b')][_0x1f2b('0x37')]>0x0){_0x545dcf[_0x1f2b('0x9b')]['forEach'](function(_0x525683){if(_0x525683[_0x1f2b('0xb4')]===_0x1f2b('0xb5')){var _0x13b740={'name':_0x525683[_0x1f2b('0xa2')],'value':_0x525683['value']};_0x5a91d3[_0x1f2b('0xa7')](_0x13b740);}});}_0x5ae4d8['options']=_0x5a91d3;if(_0x5ae4d8['options'][_0x1f2b('0x37')]>0x0){_0x3957ea(_0x5ae4d8);}else{if(_0x188f16==![]){_0x3957ea();}else{_0x3957ea(_0x5ae4d8);}}});}});} \ No newline at end of file +var _0x52e4=['sys_created_on','sys_domain','state','sys_created_by','calendar_stc','closed_at','cmdb_ci','delivery_plan','active','priority','sys_domain_path','rfc','expected_start','opened_at','business_duration','work_end','reopened_time','resolved_at','caller_id','approval_set','work_notes','short_description','delivery_task','work_start','business_stc','additional_assignee_list','calendar_duration','sys_class_name','closed_by','follow_up','parent_incident','sys_id','contact_type','urgency','problem_id','company','reassignment_count','assigned_to','comments','sla_due','approval','due_date','sys_mod_count','reopen_count','sys_tags','escalation','upon_approval','correlation_id','location','username','password','email','remoteUri','serverUrl','slice','lastIndexOf','format','%s/api/now/doc/table/schema/','%s/api/now/table/','GET','result','log','remove','includes','forEach','internalType','label','push','all','assign','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','concat','ServiceNow\x20error:\x20','test','stack','Wrong\x20credentials','statusCode','boolean','True','true','False','inactive','false','value','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','end','json','offset','limit','count','Content-Range','apply','reject','update','then','destroy','sendStatus','error','name','send','index','map','ServicenowAccount','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','where','filters','filter','merge','VIRTUAL','findAll','rows','catch','includeAll','include','options','find','create','body','findOne','params','rawAttributes','sort','pick','getConfigurations','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ServicenowConfiguration','ServicenowField','hold_reason','knowledge','subcategory','close_code','notify','incident_state','severity','parent','caused_by','upon_reject','sys_updated_on','child_incidents','approval_history','number','opened_by','user_input'];(function(_0x7fe9db,_0x58aa90){var _0x5394c6=function(_0x494862){while(--_0x494862){_0x7fe9db['push'](_0x7fe9db['shift']());}};_0x5394c6(++_0x58aa90);}(_0x52e4,0x1ca));var _0x452e=function(_0x1bd984,_0xf4ff8e){_0x1bd984=_0x1bd984-0x0;var _0x3032ee=_0x52e4[_0x1bd984];return _0x3032ee;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x452e('0x0'));var zipdir=require(_0x452e('0x1'));var jsonpatch=require(_0x452e('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x452e('0x3'));var Mustache=require(_0x452e('0x4'));var util=require(_0x452e('0x5'));var path=require(_0x452e('0x6'));var sox=require('sox');var csv=require(_0x452e('0x7'));var ejs=require(_0x452e('0x8'));var fs=require('fs');var fs_extra=require(_0x452e('0x9'));var _=require(_0x452e('0xa'));var squel=require(_0x452e('0xb'));var crypto=require('crypto');var jsforce=require(_0x452e('0xc'));var deskjs=require(_0x452e('0xd'));var toCsv=require(_0x452e('0x7'));var querystring=require(_0x452e('0xe'));var Papa=require(_0x452e('0xf'));var Redis=require(_0x452e('0x10'));var authService=require(_0x452e('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x452e('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x452e('0x13'))(_0x452e('0x14'));var utils=require(_0x452e('0x15'));var config=require(_0x452e('0x16'));var licenseUtil=require(_0x452e('0x17'));var db=require(_0x452e('0x18'))['db'];var integrations=require(_0x452e('0x19'));function respondWithStatusCode(_0x101ad0,_0x3d0710){_0x3d0710=_0x3d0710||0xcc;return function(_0x21d400){if(_0x21d400){return _0x101ad0['sendStatus'](_0x3d0710);}return _0x101ad0[_0x452e('0x1a')](_0x3d0710)[_0x452e('0x1b')]();};}function respondWithResult(_0x3fc31a,_0x36c8e3){_0x36c8e3=_0x36c8e3||0xc8;return function(_0x3a74c0){if(_0x3a74c0){return _0x3fc31a[_0x452e('0x1a')](_0x36c8e3)[_0x452e('0x1c')](_0x3a74c0);}};}function respondWithFilteredResult(_0x132b7a,_0x27c4cb){return function(_0x47e679){if(_0x47e679){var _0x42c814=typeof _0x27c4cb[_0x452e('0x1d')]==='undefined'&&typeof _0x27c4cb[_0x452e('0x1e')]==='undefined';var _0x338af1=_0x47e679[_0x452e('0x1f')];var _0x20f92a=_0x42c814?0x0:_0x27c4cb[_0x452e('0x1d')];var _0x130417=_0x42c814?_0x47e679[_0x452e('0x1f')]:_0x27c4cb[_0x452e('0x1d')]+_0x27c4cb[_0x452e('0x1e')];var _0x2403fd;if(_0x130417>=_0x338af1){_0x130417=_0x338af1;_0x2403fd=0xc8;}else{_0x2403fd=0xce;}_0x132b7a[_0x452e('0x1a')](_0x2403fd);return _0x132b7a['set'](_0x452e('0x20'),_0x20f92a+'-'+_0x130417+'/'+_0x338af1)['json'](_0x47e679);}return null;};}function patchUpdates(_0x1888b9){return function(_0xb0a6fc){try{jsonpatch[_0x452e('0x21')](_0xb0a6fc,_0x1888b9,!![]);}catch(_0x497bda){return BPromise[_0x452e('0x22')](_0x497bda);}return _0xb0a6fc['save']();};}function saveUpdates(_0x3f67a5,_0xe2fbcf){return function(_0x2cbf87){if(_0x2cbf87){return _0x2cbf87[_0x452e('0x23')](_0x3f67a5)[_0x452e('0x24')](function(_0x278dc6){return _0x278dc6;});}return null;};}function removeEntity(_0x292006,_0x5c8477){return function(_0x4bf147){if(_0x4bf147){return _0x4bf147[_0x452e('0x25')]()[_0x452e('0x24')](function(){_0x292006['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x112ef9,_0xe1a3dd){return function(_0x4acc61){if(!_0x4acc61){_0x112ef9[_0x452e('0x26')](0x194);}return _0x4acc61;};}function handleError(_0x20f176,_0x527ae3){_0x527ae3=_0x527ae3||0x1f4;return function(_0x4b1358){logger[_0x452e('0x27')](_0x4b1358['stack']);if(_0x4b1358[_0x452e('0x28')]){delete _0x4b1358[_0x452e('0x28')];}_0x20f176[_0x452e('0x1a')](_0x527ae3)[_0x452e('0x29')](_0x4b1358);};}exports[_0x452e('0x2a')]=function(_0x421545,_0x38a181){var _0x3353e0={},_0x47c68c={},_0x11040e={'count':0x0,'rows':[]};var _0x162d71=_[_0x452e('0x2b')](db[_0x452e('0x2c')]['rawAttributes'],function(_0x48a806){return{'name':_0x48a806[_0x452e('0x2d')],'type':_0x48a806[_0x452e('0x2e')][_0x452e('0x2f')]};});_0x47c68c[_0x452e('0x30')]=_[_0x452e('0x2b')](_0x162d71,_0x452e('0x28'));_0x47c68c[_0x452e('0x31')]=_[_0x452e('0x32')](_0x421545[_0x452e('0x31')]);_0x47c68c['filters']=_[_0x452e('0x33')](_0x47c68c['model'],_0x47c68c[_0x452e('0x31')]);_0x3353e0[_0x452e('0x34')]=_[_0x452e('0x33')](_0x47c68c['model'],qs[_0x452e('0x35')](_0x421545['query']['fields']));_0x3353e0[_0x452e('0x34')]=_0x3353e0[_0x452e('0x34')][_0x452e('0x36')]?_0x3353e0[_0x452e('0x34')]:_0x47c68c[_0x452e('0x30')];if(!_0x421545['query'][_0x452e('0x37')]('nolimit')){_0x3353e0[_0x452e('0x1e')]=qs[_0x452e('0x1e')](_0x421545[_0x452e('0x31')][_0x452e('0x1e')]);_0x3353e0[_0x452e('0x1d')]=qs[_0x452e('0x1d')](_0x421545['query'][_0x452e('0x1d')]);}_0x3353e0[_0x452e('0x38')]=qs['sort'](_0x421545[_0x452e('0x31')]['sort']);_0x3353e0[_0x452e('0x39')]=qs[_0x452e('0x3a')](_['pick'](_0x421545[_0x452e('0x31')],_0x47c68c[_0x452e('0x3a')]),_0x162d71);if(_0x421545[_0x452e('0x31')][_0x452e('0x3b')]){_0x3353e0[_0x452e('0x39')]=_[_0x452e('0x3c')](_0x3353e0[_0x452e('0x39')],{'$or':_['map'](_0x162d71,function(_0x18e92d){if(_0x18e92d['type']!==_0x452e('0x3d')){var _0x15d95a={};_0x15d95a[_0x18e92d[_0x452e('0x28')]]={'$like':'%'+_0x421545['query'][_0x452e('0x3b')]+'%'};return _0x15d95a;}})});}_0x3353e0=_['merge']({},_0x3353e0,_0x421545['options']);var _0x227267={'where':_0x3353e0[_0x452e('0x39')]};return db[_0x452e('0x2c')][_0x452e('0x1f')](_0x227267)[_0x452e('0x24')](function(_0x208a43){_0x11040e['count']=_0x208a43;if(_0x421545[_0x452e('0x31')]['includeAll']){_0x3353e0['include']=[{'all':!![]}];}return db[_0x452e('0x2c')][_0x452e('0x3e')](_0x3353e0);})[_0x452e('0x24')](function(_0x4166c0){_0x11040e[_0x452e('0x3f')]=_0x4166c0;return _0x11040e;})[_0x452e('0x24')](respondWithFilteredResult(_0x38a181,_0x3353e0))[_0x452e('0x40')](handleError(_0x38a181,null));};exports['show']=function(_0x1338aa,_0x64d8cb){var _0x10af9d={'raw':![],'where':{'id':_0x1338aa['params']['id']}},_0xf3b3bb={};_0xf3b3bb[_0x452e('0x30')]=_[_0x452e('0x32')](db[_0x452e('0x2c')]['rawAttributes']);_0xf3b3bb['query']=_[_0x452e('0x32')](_0x1338aa[_0x452e('0x31')]);_0xf3b3bb[_0x452e('0x3a')]=_[_0x452e('0x33')](_0xf3b3bb[_0x452e('0x30')],_0xf3b3bb['query']);_0x10af9d['attributes']=_['intersection'](_0xf3b3bb[_0x452e('0x30')],qs[_0x452e('0x35')](_0x1338aa[_0x452e('0x31')]['fields']));_0x10af9d[_0x452e('0x34')]=_0x10af9d[_0x452e('0x34')][_0x452e('0x36')]?_0x10af9d['attributes']:_0xf3b3bb[_0x452e('0x30')];if(_0x1338aa[_0x452e('0x31')][_0x452e('0x41')]){_0x10af9d[_0x452e('0x42')]=[{'all':!![]}];}_0x10af9d=_[_0x452e('0x3c')]({},_0x10af9d,_0x1338aa[_0x452e('0x43')]);return db[_0x452e('0x2c')][_0x452e('0x44')](_0x10af9d)[_0x452e('0x24')](handleEntityNotFound(_0x64d8cb,null))['then'](respondWithResult(_0x64d8cb,null))[_0x452e('0x40')](handleError(_0x64d8cb,null));};exports['create']=function(_0x153b09,_0x1488d4){return db['ServicenowAccount'][_0x452e('0x45')](_0x153b09[_0x452e('0x46')],{})[_0x452e('0x24')](respondWithResult(_0x1488d4,0xc9))['catch'](handleError(_0x1488d4,null));};exports[_0x452e('0x23')]=function(_0x2c3b11,_0x46c5e){if(_0x2c3b11[_0x452e('0x46')]['id']){delete _0x2c3b11['body']['id'];}return db[_0x452e('0x2c')]['find']({'where':{'id':_0x2c3b11['params']['id']}})[_0x452e('0x24')](handleEntityNotFound(_0x46c5e,null))[_0x452e('0x24')](saveUpdates(_0x2c3b11[_0x452e('0x46')],null))[_0x452e('0x24')](respondWithResult(_0x46c5e,null))[_0x452e('0x40')](handleError(_0x46c5e,null));};exports[_0x452e('0x25')]=function(_0xe356b1,_0x468bc8){return db[_0x452e('0x2c')]['find']({'where':{'id':_0xe356b1['params']['id']}})[_0x452e('0x24')](handleEntityNotFound(_0x468bc8,null))[_0x452e('0x24')](removeEntity(_0x468bc8,null))['catch'](handleError(_0x468bc8,null));};exports['getConfigurations']=function(_0x28b4e5,_0x158d09,_0x498ad5){var _0x1d5bc9={};var _0x2daf40={};var _0x149d18;var _0x101cf5;return db[_0x452e('0x2c')][_0x452e('0x47')]({'where':{'id':_0x28b4e5[_0x452e('0x48')]['id']}})['then'](handleEntityNotFound(_0x158d09,null))[_0x452e('0x24')](function(_0xdd00e9){if(_0xdd00e9){_0x149d18=_0xdd00e9;_0x2daf40['model']=_[_0x452e('0x32')](db['ServicenowConfiguration'][_0x452e('0x49')]);_0x2daf40[_0x452e('0x31')]=_[_0x452e('0x32')](_0x28b4e5['query']);_0x2daf40[_0x452e('0x3a')]=_['intersection'](_0x2daf40[_0x452e('0x30')],_0x2daf40[_0x452e('0x31')]);_0x1d5bc9['attributes']=_[_0x452e('0x33')](_0x2daf40['model'],qs[_0x452e('0x35')](_0x28b4e5[_0x452e('0x31')]['fields']));_0x1d5bc9['attributes']=_0x1d5bc9[_0x452e('0x34')]['length']?_0x1d5bc9[_0x452e('0x34')]:_0x2daf40[_0x452e('0x30')];_0x1d5bc9[_0x452e('0x38')]=qs[_0x452e('0x4a')](_0x28b4e5[_0x452e('0x31')][_0x452e('0x4a')]);_0x1d5bc9['where']=qs[_0x452e('0x3a')](_[_0x452e('0x4b')](_0x28b4e5[_0x452e('0x31')],_0x2daf40[_0x452e('0x3a')]));if(_0x28b4e5[_0x452e('0x31')][_0x452e('0x3b')]){_0x1d5bc9[_0x452e('0x39')]=_[_0x452e('0x3c')](_0x1d5bc9[_0x452e('0x39')],{'$or':_[_0x452e('0x2b')](_0x1d5bc9['attributes'],function(_0x55fa4e){var _0x30d895={};_0x30d895[_0x55fa4e]={'$like':'%'+_0x28b4e5[_0x452e('0x31')][_0x452e('0x3b')]+'%'};return _0x30d895;})});}_0x1d5bc9=_[_0x452e('0x3c')]({},_0x1d5bc9,_0x28b4e5[_0x452e('0x43')]);return _0x149d18[_0x452e('0x4c')](_0x1d5bc9);}})[_0x452e('0x24')](function(_0x493212){if(_0x493212){_0x101cf5=_0x493212['length'];if(!_0x28b4e5[_0x452e('0x31')]['hasOwnProperty'](_0x452e('0x4d'))){_0x1d5bc9['limit']=qs['limit'](_0x28b4e5['query'][_0x452e('0x1e')]);_0x1d5bc9[_0x452e('0x1d')]=qs['offset'](_0x28b4e5[_0x452e('0x31')][_0x452e('0x1d')]);}return _0x149d18[_0x452e('0x4c')](_0x1d5bc9);}})[_0x452e('0x24')](function(_0x53583f){if(_0x53583f){return _0x53583f?{'count':_0x101cf5,'rows':_0x53583f}:null;}})[_0x452e('0x24')](respondWithResult(_0x158d09,null))[_0x452e('0x40')](handleError(_0x158d09,null));};exports[_0x452e('0x4e')]=function(_0x8028b5,_0x48569b,_0x224459){if(_0x8028b5[_0x452e('0x46')]['id']){delete _0x8028b5[_0x452e('0x46')]['id'];}return db['ServicenowAccount']['findOne']({'where':{'id':_0x8028b5[_0x452e('0x48')]['id']}})['then'](handleEntityNotFound(_0x48569b,null))[_0x452e('0x24')](function(_0x348014){if(_0x348014){_0x8028b5[_0x452e('0x46')][_0x452e('0x4f')]=_0x348014['id'];_0x8028b5[_0x452e('0x46')][_0x452e('0x50')]=integrations[_0x452e('0x51')](_0x8028b5[_0x452e('0x46')][_0x452e('0x52')],_0x8028b5[_0x452e('0x46')][_0x452e('0x2e')]);_0x8028b5[_0x452e('0x46')][_0x452e('0x53')]=integrations[_0x452e('0x54')](_0x8028b5[_0x452e('0x46')][_0x452e('0x52')],_0x8028b5[_0x452e('0x46')]['type']);return db[_0x452e('0x55')]['create'](_0x8028b5[_0x452e('0x46')],{'include':[{'model':db[_0x452e('0x56')],'as':_0x452e('0x50')},{'model':db['ServicenowField'],'as':_0x452e('0x53')}]});}return null;})['then'](respondWithResult(_0x48569b,null))['catch'](handleError(_0x48569b,null));};exports['getFields']=function(_0x2fbba0,_0x33b92,_0x2f05ff){var _0x3f7c25=['made_sla',_0x452e('0x57'),_0x452e('0x58'),_0x452e('0x59'),_0x452e('0x5a'),_0x452e('0x5b'),_0x452e('0x5c'),_0x452e('0x5d'),'category'];var _0x6516f=[_0x452e('0x5e'),'made_sla',_0x452e('0x5f'),'watch_list',_0x452e('0x60'),_0x452e('0x61'),_0x452e('0x62'),_0x452e('0x57'),_0x452e('0x63'),_0x452e('0x64'),'resolved_by','sys_updated_by',_0x452e('0x65'),_0x452e('0x66'),_0x452e('0x67'),_0x452e('0x68'),_0x452e('0x69'),_0x452e('0x6a'),_0x452e('0x58'),_0x452e('0x38'),_0x452e('0x6b'),_0x452e('0x6c'),_0x452e('0x6d'),_0x452e('0x6e'),'impact',_0x452e('0x6f'),'work_notes_list','business_service',_0x452e('0x70'),_0x452e('0x71'),_0x452e('0x72'),'time_worked',_0x452e('0x73'),_0x452e('0x74'),_0x452e('0x75'),'group_list',_0x452e('0x76'),_0x452e('0x77'),_0x452e('0x78'),_0x452e('0x79'),_0x452e('0x7a'),_0x452e('0x59'),_0x452e('0x7b'),_0x452e('0x7c'),_0x452e('0x5a'),'correlation_display',_0x452e('0x7d'),_0x452e('0x7e'),'assignment_group',_0x452e('0x7f'),_0x452e('0x80'),'description',_0x452e('0x81'),_0x452e('0x5b'),_0x452e('0x82'),'close_notes',_0x452e('0x83'),_0x452e('0x84'),_0x452e('0x85'),_0x452e('0x86'),_0x452e('0x87'),'reopened_by',_0x452e('0x5c'),_0x452e('0x88'),_0x452e('0x89'),_0x452e('0x8a'),_0x452e('0x8b'),'activity_due',_0x452e('0x8c'),'severity',_0x452e('0x8d'),_0x452e('0x8e'),_0x452e('0x8f'),'comments_and_work_notes',_0x452e('0x90'),_0x452e('0x91'),_0x452e('0x92'),_0x452e('0x93'),_0x452e('0x94'),_0x452e('0x95'),_0x452e('0x96'),_0x452e('0x97'),'category'];var _0xa5ca40='';var _0x309dce='';var _0x1a3f53=[];var _0x3d7566='';var _0x291f4e='';var _0x3bce6f=[];var _0x535880='';var _0x1c3d6a='';var _0x2caf88={};var _0x3ab00b='';return db[_0x452e('0x2c')][_0x452e('0x47')]({'where':{'id':_0x2fbba0[_0x452e('0x48')]['id']},'attributes':['id',_0x452e('0x98'),_0x452e('0x99'),_0x452e('0x9a'),_0x452e('0x9b'),_0x452e('0x9c')]})[_0x452e('0x24')](handleEntityNotFound(_0x33b92,null))[_0x452e('0x24')](function(_0xdc6c31){if(_0xdc6c31){_0x3ab00b=_0xdc6c31[_0x452e('0x9b')];var _0x28d7c9=_0x3ab00b[_0x452e('0x9d')](-0x1);if(_0x28d7c9==='/'){_0x3ab00b=_0x3ab00b['substring'](0x0,_0x3ab00b[_0x452e('0x9e')](_0x28d7c9));}_0x1c3d6a=util[_0x452e('0x9f')](_0x452e('0xa0'),_0x3ab00b);_0x535880=util[_0x452e('0x9f')](_0x452e('0xa1'),_0x3ab00b);_0x2caf88={'user':_0xdc6c31['username'],'pass':_0xdc6c31['password']};var _0x5eb059={'method':_0x452e('0xa2'),'uri':_0x1c3d6a+'incident?sysparm_display_value=all','auth':_0x2caf88,'json':!![]};return rp(_0x5eb059);}})[_0x452e('0x24')](function(_0x83202e){if(_0x83202e[_0x452e('0xa3')][_0x452e('0x36')]>0x0){_0xa5ca40=_0x83202e[_0x452e('0xa3')];}console[_0x452e('0xa4')]('incident\x20table\x20objects',_0xa5ca40);_0x3bce6f=[];_0x309dce=Object['assign']([],_0xa5ca40);_[_0x452e('0xa5')](_0x309dce,function(_0xdb5799){return!_0x3f7c25[_0x452e('0xa6')](_0xdb5799[_0x452e('0x28')]);});_0x309dce[_0x452e('0xa7')](function(_0x435eb7){var _0x587e0a=createFieldObject(_0x535880,_0x2caf88,_0x435eb7[_0x452e('0xa8')],_0x435eb7[_0x452e('0x28')],_0x435eb7[_0x452e('0xa9')],![]);_0x3bce6f[_0x452e('0xaa')](_0x587e0a);});return Promise[_0x452e('0xab')](_0x3bce6f);})['then'](function(_0x1b89a6){_0x1a3f53=_0x1b89a6;_0x3d7566=Object[_0x452e('0xac')]([],_0xa5ca40);console[_0x452e('0xa4')]('TCL:\x20_object',_0xa5ca40);_[_0x452e('0xa5')](_0x3d7566,function(_0x52143f){return _0x6516f['includes'](_0x52143f[_0x452e('0x28')]);});console[_0x452e('0xa4')](_0x452e('0xad'),_0x3d7566);_0x3bce6f=[];_0x3d7566[_0x452e('0xa7')](function(_0x100ab3){var _0x260536=createFieldObject(_0x535880,_0x2caf88,_0x100ab3[_0x452e('0xa8')],_0x100ab3[_0x452e('0x28')],_0x100ab3[_0x452e('0xa9')],!![]);_0x3bce6f['push'](_0x260536);});return Promise[_0x452e('0xab')](_0x3bce6f);})[_0x452e('0x24')](function(_0x4e1c5b){_0x291f4e=_0x4e1c5b;var _0x48cdd2=_0x1a3f53[_0x452e('0xae')](_0x291f4e);return{'count':_0x48cdd2['length'],'rows':_0x48cdd2};})[_0x452e('0x24')](respondWithResult(_0x33b92,null))[_0x452e('0x40')](function(_0x22be08){console[_0x452e('0xa4')](_0x452e('0xaf')+_0x22be08);var _0x535548=_0x2fbba0[_0x452e('0x31')][_0x452e('0xb0')]?0x1f4:_0x22be08['statusCode']||0x1f4;logger[_0x452e('0x27')](_0x22be08[_0x452e('0xb1')]);delete _0x22be08[_0x452e('0x28')];if(_0x535548===0x191){_0x535548=0x190;}_0x33b92[_0x452e('0x1a')](_0x535548)[_0x452e('0x29')](_0x2fbba0['query'][_0x452e('0xb0')]?{'message':_0x452e('0xb2'),'statusCode':_0x22be08[_0x452e('0xb3')]}:_0x22be08);});};function createFieldObject(_0x5a3a3e,_0x1eeae5,_0x3b979d,_0x39ca74,_0xcd30d,_0x33a7f4){return new Promise(function(_0x253571,_0x250a28){var _0x515a14={'id':_0x39ca74,'name':_0xcd30d,'custom':_0x33a7f4};if(_0x3b979d===_0x452e('0xb4')){_0x515a14[_0x452e('0x43')]=[{'name':_0x452e('0xb5'),'value':_0x452e('0xb6')},{'name':_0x452e('0xb7'),'value':'false'}];_0x253571(_0x515a14);}else{var _0x59081e={'method':'GET','uri':_0x5a3a3e+'sys_choice?sysparm_query=name=incident^element='+_0x39ca74,'auth':_0x1eeae5,'json':!![]};return rp(_0x59081e)['then'](function(_0x869fb8){var _0x5a6cf7=[];if(_0x869fb8['result'][_0x452e('0x36')]>0x0){_0x869fb8[_0x452e('0xa3')]['forEach'](function(_0x486470){if(_0x486470[_0x452e('0xb8')]===_0x452e('0xb9')){var _0x483d3c={'name':_0x486470[_0x452e('0xa9')],'value':_0x486470[_0x452e('0xba')]};_0x5a6cf7[_0x452e('0xaa')](_0x483d3c);}});}_0x515a14[_0x452e('0x43')]=_0x5a6cf7;if(_0x515a14['options'][_0x452e('0x36')]>0x0){_0x253571(_0x515a14);}else{if(_0x33a7f4==![]){_0x253571();}else{_0x253571(_0x515a14);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index a54a893..abc2a53 100644 --- a/server/api/intServicenowAccount/intServicenowAccount.model.js +++ b/server/api/intServicenowAccount/intServicenowAccount.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x687b=['./intServicenowAccount.attributes','../../components/integrations/configuration','exports','define','int_servicenow_accounts','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment'];(function(_0x1ebd80,_0x2ef0d5){var _0x10534a=function(_0x5e5c35){while(--_0x5e5c35){_0x1ebd80['push'](_0x1ebd80['shift']());}};_0x10534a(++_0x2ef0d5);}(_0x687b,0x14a));var _0xb687=function(_0x4828f3,_0x5774b6){_0x4828f3=_0x4828f3-0x0;var _0x8a2a6=_0x687b[_0x4828f3];return _0x8a2a6;};'use strict';var _=require(_0xb687('0x0'));var util=require(_0xb687('0x1'));var logger=require(_0xb687('0x2'))(_0xb687('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xb687('0x4'));var fs=require('fs');var path=require(_0xb687('0x5'));var rimraf=require(_0xb687('0x6'));var config=require(_0xb687('0x7'));var attributes=require(_0xb687('0x8'));var integrations=require(_0xb687('0x9'));module[_0xb687('0xa')]=function(_0xf43a1f,_0x47ffea){return _0xf43a1f[_0xb687('0xb')]('ServicenowAccount',attributes,{'tableName':_0xb687('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe14b=['bluebird','path','./intServicenowAccount.attributes','../../components/integrations/configuration','exports','define','ServicenowAccount','lodash','util','moment'];(function(_0x2508dd,_0x4558c4){var _0x51a42b=function(_0xc47854){while(--_0xc47854){_0x2508dd['push'](_0x2508dd['shift']());}};_0x51a42b(++_0x4558c4);}(_0xe14b,0x93));var _0xbe14=function(_0x36b102,_0x4d6760){_0x36b102=_0x36b102-0x0;var _0x3c352a=_0xe14b[_0x36b102];return _0x3c352a;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xbe14('0x2'));var BPromise=require(_0xbe14('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbe14('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xbe14('0x5'));var integrations=require(_0xbe14('0x6'));module[_0xbe14('0x7')]=function(_0x1ff100,_0x1d9ade){return _0x1ff100[_0xbe14('0x8')](_0xbe14('0x9'),attributes,{'tableName':'int_servicenow_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.rpc.js b/server/api/intServicenowAccount/intServicenowAccount.rpc.js index a4f984a..b10d145 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 _0x84db=['include','map','model','then','GetServicenowAccount','stringify','ShowServicenowAccount','util','moment','ioredis','../../mysqldb','../../config/utils','rpc','http','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','error','message','result','catch','ServicenowAccount','findAll','options','raw','where','attributes','limit'];(function(_0x263a74,_0xc31414){var _0x2aa86c=function(_0x382896){while(--_0x382896){_0x263a74['push'](_0x263a74['shift']());}};_0x2aa86c(++_0xc31414);}(_0x84db,0xf7));var _0xb84d=function(_0xa7daf5,_0x406f1c){_0xa7daf5=_0xa7daf5-0x0;var _0x1d3c9a=_0x84db[_0xa7daf5];return _0x1d3c9a;};'use strict';var _=require('lodash');var util=require(_0xb84d('0x0'));var moment=require(_0xb84d('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb84d('0x2'));var db=require(_0xb84d('0x3'))['db'];var utils=require(_0xb84d('0x4'));var logger=require('../../config/logger')(_0xb84d('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xb84d('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x4c2ad8,_0x29e4f9,_0xa26e43){return new BPromise(function(_0x3a3450,_0xb18ca){return client['request'](_0x4c2ad8,_0xa26e43)['then'](function(_0x31feb0){logger[_0xb84d('0x7')](_0xb84d('0x8'),_0x29e4f9,_0xb84d('0x9'));logger[_0xb84d('0xa')](_0xb84d('0xb'),_0x29e4f9,'request\x20sent',JSON['stringify'](_0x31feb0));if(_0x31feb0[_0xb84d('0xc')]){if(_0x31feb0['error']['code']===0x1f4){logger[_0xb84d('0xc')](_0xb84d('0x8'),_0x29e4f9,_0x31feb0['error'][_0xb84d('0xd')]);return _0xb18ca(_0x31feb0[_0xb84d('0xc')][_0xb84d('0xd')]);}logger['error'](_0xb84d('0x8'),_0x29e4f9,_0x31feb0[_0xb84d('0xc')][_0xb84d('0xd')]);return _0x3a3450(_0x31feb0[_0xb84d('0xc')]['message']);}else{logger['info'](_0xb84d('0x8'),_0x29e4f9,_0xb84d('0x9'));_0x3a3450(_0x31feb0[_0xb84d('0xe')]['message']);}})[_0xb84d('0xf')](function(_0x3229ac){logger['error']('ServicenowAccount,\x20%s,\x20%s',_0x29e4f9,_0x3229ac);_0xb18ca(_0x3229ac);});});}exports['GetServicenowAccount']=function(_0x4744da){var _0x4c9051=this;return new Promise(function(_0x44cf01,_0x4a616c){return db[_0xb84d('0x10')][_0xb84d('0x11')]({'raw':_0x4744da['options']?_0x4744da[_0xb84d('0x12')][_0xb84d('0x13')]===undefined?!![]:![]:!![],'where':_0x4744da['options']?_0x4744da['options'][_0xb84d('0x14')]||null:null,'attributes':_0x4744da[_0xb84d('0x12')]?_0x4744da[_0xb84d('0x12')][_0xb84d('0x15')]||null:null,'limit':_0x4744da[_0xb84d('0x12')]?_0x4744da['options'][_0xb84d('0x16')]||null:null,'include':_0x4744da[_0xb84d('0x12')]?_0x4744da[_0xb84d('0x12')][_0xb84d('0x17')]?_[_0xb84d('0x18')](_0x4744da[_0xb84d('0x12')][_0xb84d('0x17')],function(_0x1a63f3){return{'model':db[_0x1a63f3[_0xb84d('0x19')]],'as':_0x1a63f3['as'],'attributes':_0x1a63f3['attributes'],'include':_0x1a63f3[_0xb84d('0x17')]?_[_0xb84d('0x18')](_0x1a63f3[_0xb84d('0x17')],function(_0x3b3891){return{'model':db[_0x3b3891[_0xb84d('0x19')]],'as':_0x3b3891['as'],'attributes':_0x3b3891[_0xb84d('0x15')],'include':_0x3b3891[_0xb84d('0x17')]?_[_0xb84d('0x18')](_0x3b3891[_0xb84d('0x17')],function(_0x56ea47){return{'model':db[_0x56ea47[_0xb84d('0x19')]],'as':_0x56ea47['as'],'attributes':_0x56ea47['attributes']};}):[]};}):[]};}):[]:[]})[_0xb84d('0x1a')](function(_0xd4907c){logger['info'](_0xb84d('0x1b'),_0x4744da);logger['debug']('GetServicenowAccount',_0x4744da,JSON[_0xb84d('0x1c')](_0xd4907c));_0x44cf01(_0xd4907c);})[_0xb84d('0xf')](function(_0x1171f5){logger['error'](_0xb84d('0x1b'),_0x1171f5[_0xb84d('0xd')],_0x4744da);_0x4a616c(_0x4c9051[_0xb84d('0xc')](0x1f4,_0x1171f5[_0xb84d('0xd')]));});});};exports[_0xb84d('0x1d')]=function(_0x469cfe){var _0x5c6c02=this;return new Promise(function(_0x29314e,_0x3e86dd){return db[_0xb84d('0x10')]['find']({'raw':_0x469cfe[_0xb84d('0x12')]?_0x469cfe[_0xb84d('0x12')][_0xb84d('0x13')]===undefined?!![]:![]:!![],'where':_0x469cfe['options']?_0x469cfe['options'][_0xb84d('0x14')]||null:null,'attributes':_0x469cfe[_0xb84d('0x12')]?_0x469cfe[_0xb84d('0x12')][_0xb84d('0x15')]||null:null,'include':_0x469cfe[_0xb84d('0x12')]?_0x469cfe[_0xb84d('0x12')][_0xb84d('0x17')]?_['map'](_0x469cfe['options'][_0xb84d('0x17')],function(_0x467971){return{'model':db[_0x467971[_0xb84d('0x19')]],'as':_0x467971['as'],'attributes':_0x467971['attributes'],'include':_0x467971[_0xb84d('0x17')]?_[_0xb84d('0x18')](_0x467971[_0xb84d('0x17')],function(_0x4b0051){return{'model':db[_0x4b0051['model']],'as':_0x4b0051['as'],'attributes':_0x4b0051[_0xb84d('0x15')],'include':_0x4b0051[_0xb84d('0x17')]?_['map'](_0x4b0051[_0xb84d('0x17')],function(_0x359415){return{'model':db[_0x359415['model']],'as':_0x359415['as'],'attributes':_0x359415['attributes']};}):[]};}):[]};}):[]:[]})[_0xb84d('0x1a')](function(_0xbb9466){logger[_0xb84d('0x7')](_0xb84d('0x1d'),_0x469cfe);logger[_0xb84d('0xa')](_0xb84d('0x1d'),_0x469cfe,JSON[_0xb84d('0x1c')](_0xbb9466));_0x29314e(_0xbb9466);})['catch'](function(_0x19bb5c){logger['error'](_0xb84d('0x1d'),_0x19bb5c[_0xb84d('0xd')],_0x469cfe);_0x3e86dd(_0x5c6c02['error'](0x1f4,_0x19bb5c[_0xb84d('0xd')]));});});}; \ No newline at end of file +var _0xed79=['attributes','limit','map','model','include','ShowServicenowAccount','stringify','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','code','error','ServicenowAccount,\x20%s,\x20%s','message','result','GetServicenowAccount','ServicenowAccount','findAll','options','raw','where'];(function(_0x389bf1,_0x3394ed){var _0x1c7575=function(_0x2135b3){while(--_0x2135b3){_0x389bf1['push'](_0x389bf1['shift']());}};_0x1c7575(++_0x3394ed);}(_0xed79,0x1e9));var _0x9ed7=function(_0x5745c7,_0x3ad6ff){_0x5745c7=_0x5745c7-0x0;var _0x16253d=_0xed79[_0x5745c7];return _0x16253d;};'use strict';var _=require(_0x9ed7('0x0'));var util=require(_0x9ed7('0x1'));var moment=require(_0x9ed7('0x2'));var BPromise=require(_0x9ed7('0x3'));var rs=require(_0x9ed7('0x4'));var fs=require('fs');var Redis=require(_0x9ed7('0x5'));var db=require(_0x9ed7('0x6'))['db'];var utils=require(_0x9ed7('0x7'));var logger=require(_0x9ed7('0x8'))(_0x9ed7('0x9'));var config=require(_0x9ed7('0xa'));var jayson=require(_0x9ed7('0xb'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x342919,_0x52fe91,_0x13c3b8){return new BPromise(function(_0x3a4c86,_0x5ac28a){return client[_0x9ed7('0xc')](_0x342919,_0x13c3b8)[_0x9ed7('0xd')](function(_0x4a1f16){logger[_0x9ed7('0xe')]('ServicenowAccount,\x20%s,\x20%s',_0x52fe91,_0x9ed7('0xf'));logger[_0x9ed7('0x10')](_0x9ed7('0x11'),_0x52fe91,_0x9ed7('0xf'),JSON['stringify'](_0x4a1f16));if(_0x4a1f16['error']){if(_0x4a1f16['error'][_0x9ed7('0x12')]===0x1f4){logger[_0x9ed7('0x13')](_0x9ed7('0x14'),_0x52fe91,_0x4a1f16[_0x9ed7('0x13')][_0x9ed7('0x15')]);return _0x5ac28a(_0x4a1f16[_0x9ed7('0x13')]['message']);}logger[_0x9ed7('0x13')](_0x9ed7('0x14'),_0x52fe91,_0x4a1f16[_0x9ed7('0x13')][_0x9ed7('0x15')]);return _0x3a4c86(_0x4a1f16[_0x9ed7('0x13')]['message']);}else{logger['info']('ServicenowAccount,\x20%s,\x20%s',_0x52fe91,_0x9ed7('0xf'));_0x3a4c86(_0x4a1f16[_0x9ed7('0x16')][_0x9ed7('0x15')]);}})['catch'](function(_0x5b8e57){logger[_0x9ed7('0x13')]('ServicenowAccount,\x20%s,\x20%s',_0x52fe91,_0x5b8e57);_0x5ac28a(_0x5b8e57);});});}exports[_0x9ed7('0x17')]=function(_0x5b9f92){var _0x3f0b0a=this;return new Promise(function(_0x482ed0,_0x3db921){return db[_0x9ed7('0x18')][_0x9ed7('0x19')]({'raw':_0x5b9f92['options']?_0x5b9f92[_0x9ed7('0x1a')][_0x9ed7('0x1b')]===undefined?!![]:![]:!![],'where':_0x5b9f92[_0x9ed7('0x1a')]?_0x5b9f92[_0x9ed7('0x1a')][_0x9ed7('0x1c')]||null:null,'attributes':_0x5b9f92['options']?_0x5b9f92['options'][_0x9ed7('0x1d')]||null:null,'limit':_0x5b9f92[_0x9ed7('0x1a')]?_0x5b9f92[_0x9ed7('0x1a')][_0x9ed7('0x1e')]||null:null,'include':_0x5b9f92[_0x9ed7('0x1a')]?_0x5b9f92['options']['include']?_[_0x9ed7('0x1f')](_0x5b9f92[_0x9ed7('0x1a')]['include'],function(_0xee9822){return{'model':db[_0xee9822[_0x9ed7('0x20')]],'as':_0xee9822['as'],'attributes':_0xee9822[_0x9ed7('0x1d')],'include':_0xee9822[_0x9ed7('0x21')]?_['map'](_0xee9822[_0x9ed7('0x21')],function(_0x56620e){return{'model':db[_0x56620e[_0x9ed7('0x20')]],'as':_0x56620e['as'],'attributes':_0x56620e[_0x9ed7('0x1d')],'include':_0x56620e[_0x9ed7('0x21')]?_['map'](_0x56620e[_0x9ed7('0x21')],function(_0x1725c0){return{'model':db[_0x1725c0['model']],'as':_0x1725c0['as'],'attributes':_0x1725c0['attributes']};}):[]};}):[]};}):[]:[]})[_0x9ed7('0xd')](function(_0x33189e){logger[_0x9ed7('0xe')](_0x9ed7('0x17'),_0x5b9f92);logger[_0x9ed7('0x10')](_0x9ed7('0x17'),_0x5b9f92,JSON['stringify'](_0x33189e));_0x482ed0(_0x33189e);})['catch'](function(_0x3b484a){logger[_0x9ed7('0x13')](_0x9ed7('0x17'),_0x3b484a[_0x9ed7('0x15')],_0x5b9f92);_0x3db921(_0x3f0b0a[_0x9ed7('0x13')](0x1f4,_0x3b484a[_0x9ed7('0x15')]));});});};exports[_0x9ed7('0x22')]=function(_0x3b37e6){var _0x5d37c2=this;return new Promise(function(_0x5ccd88,_0x52e5ac){return db[_0x9ed7('0x18')]['find']({'raw':_0x3b37e6[_0x9ed7('0x1a')]?_0x3b37e6[_0x9ed7('0x1a')][_0x9ed7('0x1b')]===undefined?!![]:![]:!![],'where':_0x3b37e6[_0x9ed7('0x1a')]?_0x3b37e6[_0x9ed7('0x1a')][_0x9ed7('0x1c')]||null:null,'attributes':_0x3b37e6[_0x9ed7('0x1a')]?_0x3b37e6['options'][_0x9ed7('0x1d')]||null:null,'include':_0x3b37e6[_0x9ed7('0x1a')]?_0x3b37e6['options']['include']?_[_0x9ed7('0x1f')](_0x3b37e6['options'][_0x9ed7('0x21')],function(_0x3877a4){return{'model':db[_0x3877a4[_0x9ed7('0x20')]],'as':_0x3877a4['as'],'attributes':_0x3877a4[_0x9ed7('0x1d')],'include':_0x3877a4[_0x9ed7('0x21')]?_[_0x9ed7('0x1f')](_0x3877a4[_0x9ed7('0x21')],function(_0xc5337d){return{'model':db[_0xc5337d[_0x9ed7('0x20')]],'as':_0xc5337d['as'],'attributes':_0xc5337d[_0x9ed7('0x1d')],'include':_0xc5337d[_0x9ed7('0x21')]?_[_0x9ed7('0x1f')](_0xc5337d[_0x9ed7('0x21')],function(_0x47d680){return{'model':db[_0x47d680[_0x9ed7('0x20')]],'as':_0x47d680['as'],'attributes':_0x47d680['attributes']};}):[]};}):[]};}):[]:[]})[_0x9ed7('0xd')](function(_0x281634){logger[_0x9ed7('0xe')](_0x9ed7('0x22'),_0x3b37e6);logger[_0x9ed7('0x10')](_0x9ed7('0x22'),_0x3b37e6,JSON[_0x9ed7('0x23')](_0x281634));_0x5ccd88(_0x281634);})[_0x9ed7('0x24')](function(_0x16a083){logger[_0x9ed7('0x13')](_0x9ed7('0x22'),_0x16a083[_0x9ed7('0x15')],_0x3b37e6);_0x52e5ac(_0x5d37c2[_0x9ed7('0x13')](0x1f4,_0x16a083[_0x9ed7('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index 1a60877..147d6cf 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 _0x3712=['/:id/descriptions','getDescriptions','post','create','put','update','delete','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intServicenowConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3712,0x6c));var _0x2371=function(_0x34fc32,_0x1b372f){_0x34fc32=_0x34fc32-0x0;var _0x567758=_0x3712[_0x34fc32];return _0x567758;};'use strict';var multer=require(_0x2371('0x0'));var util=require(_0x2371('0x1'));var path=require(_0x2371('0x2'));var timeout=require('connect-timeout');var express=require(_0x2371('0x3'));var router=express[_0x2371('0x4')]();var fs_extra=require(_0x2371('0x5'));var auth=require(_0x2371('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x2371('0x7'));var controller=require(_0x2371('0x8'));router[_0x2371('0x9')]('/',auth[_0x2371('0xa')](),controller[_0x2371('0xb')]);router[_0x2371('0x9')](_0x2371('0xc'),auth[_0x2371('0xa')](),controller[_0x2371('0xd')]);router[_0x2371('0x9')](_0x2371('0xe'),auth[_0x2371('0xa')](),controller[_0x2371('0xf')]);router[_0x2371('0x9')](_0x2371('0x10'),auth[_0x2371('0xa')](),controller['getSubjects']);router[_0x2371('0x9')](_0x2371('0x11'),auth['isAuthenticated'](),controller[_0x2371('0x12')]);router[_0x2371('0x13')]('/',auth[_0x2371('0xa')](),controller[_0x2371('0x14')]);router[_0x2371('0x15')](_0x2371('0xc'),auth[_0x2371('0xa')](),controller[_0x2371('0x16')]);router[_0x2371('0x17')](_0x2371('0xc'),auth[_0x2371('0xa')](),controller['destroy']);module[_0x2371('0x18')]=router; \ No newline at end of file +var _0x1e28=['getDescriptions','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','get','isAuthenticated','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions'];(function(_0x3f8ec9,_0x5dcb2a){var _0x59b457=function(_0x52df86){while(--_0x52df86){_0x3f8ec9['push'](_0x3f8ec9['shift']());}};_0x59b457(++_0x5dcb2a);}(_0x1e28,0x100));var _0x81e2=function(_0x3dc68d,_0x1c1951){_0x3dc68d=_0x3dc68d-0x0;var _0xdf7f94=_0x1e28[_0x3dc68d];return _0xdf7f94;};'use strict';var multer=require(_0x81e2('0x0'));var util=require(_0x81e2('0x1'));var path=require(_0x81e2('0x2'));var timeout=require(_0x81e2('0x3'));var express=require(_0x81e2('0x4'));var router=express[_0x81e2('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x81e2('0x6'));var interaction=require(_0x81e2('0x7'));var config=require(_0x81e2('0x8'));var controller=require(_0x81e2('0x9'));router[_0x81e2('0xa')]('/',auth[_0x81e2('0xb')](),controller['index']);router[_0x81e2('0xa')](_0x81e2('0xc'),auth[_0x81e2('0xb')](),controller[_0x81e2('0xd')]);router[_0x81e2('0xa')](_0x81e2('0xe'),auth[_0x81e2('0xb')](),controller[_0x81e2('0xf')]);router['get'](_0x81e2('0x10'),auth[_0x81e2('0xb')](),controller[_0x81e2('0x11')]);router[_0x81e2('0xa')](_0x81e2('0x12'),auth['isAuthenticated'](),controller[_0x81e2('0x13')]);router['post']('/',auth[_0x81e2('0xb')](),controller[_0x81e2('0x14')]);router['put']('/:id',auth[_0x81e2('0xb')](),controller[_0x81e2('0x15')]);router[_0x81e2('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x81e2('0x17')]);module[_0x81e2('0x18')]=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index 809124a..e3259b8 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 _0x8fde=['STRING','sequelize'];(function(_0x2d2f8c,_0x165ba6){var _0x25de7e=function(_0x17c81d){while(--_0x17c81d){_0x2d2f8c['push'](_0x2d2f8c['shift']());}};_0x25de7e(++_0x165ba6);}(_0x8fde,0x1b5));var _0xe8fd=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0x8fde[_0x68c979];return _0x4f0001;};'use strict';var Sequelize=require(_0xe8fd('0x0'));module['exports']={'name':{'type':Sequelize[_0xe8fd('0x1')]},'description':{'type':Sequelize[_0xe8fd('0x1')]}}; \ No newline at end of file +var _0xf9ac=['sequelize','exports','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf9ac,0x1b6));var _0xcf9a=function(_0x2f3569,_0x1f8585){_0x2f3569=_0x2f3569-0x0;var _0x3e4c30=_0xf9ac[_0x2f3569];return _0x3e4c30;};'use strict';var Sequelize=require(_0xcf9a('0x0'));module[_0xcf9a('0x1')]={'name':{'type':Sequelize[_0xcf9a('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index 16a7d44..d564dba 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 _0x6424=['api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','key','query','keys','intersection','model','attributes','fields','length','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','ServicenowConfiguration','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','getFields','findOne','ServicenowField','hasOwnProperty','nolimit','getSubjects','getDescriptions','eml-format','rimraf','moment','bluebird','util','path','sox','to-csv','lodash','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger'];(function(_0x850f7c,_0x3d1dd5){var _0x281696=function(_0x161ed4){while(--_0x161ed4){_0x850f7c['push'](_0x850f7c['shift']());}};_0x281696(++_0x3d1dd5);}(_0x6424,0x127));var _0x4642=function(_0x2ded5b,_0x674460){_0x2ded5b=_0x2ded5b-0x0;var _0x1f8a79=_0x6424[_0x2ded5b];return _0x1f8a79;};'use strict';var emlformat=require(_0x4642('0x0'));var rimraf=require(_0x4642('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x4642('0x2'));var BPromise=require(_0x4642('0x3'));var Mustache=require('mustache');var util=require(_0x4642('0x4'));var path=require(_0x4642('0x5'));var sox=require(_0x4642('0x6'));var csv=require(_0x4642('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4642('0x8'));var squel=require('squel');var crypto=require(_0x4642('0x9'));var jsforce=require(_0x4642('0xa'));var deskjs=require(_0x4642('0xb'));var toCsv=require(_0x4642('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x4642('0xc'));var authService=require(_0x4642('0xd'));var qs=require(_0x4642('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4642('0xf'));var logger=require(_0x4642('0x10'))(_0x4642('0x11'));var utils=require('../../config/utils');var config=require(_0x4642('0x12'));var licenseUtil=require(_0x4642('0x13'));var db=require(_0x4642('0x14'))['db'];function respondWithStatusCode(_0x3ebad1,_0x151c71){_0x151c71=_0x151c71||0xcc;return function(_0x53e242){if(_0x53e242){return _0x3ebad1[_0x4642('0x15')](_0x151c71);}return _0x3ebad1[_0x4642('0x16')](_0x151c71)[_0x4642('0x17')]();};}function respondWithResult(_0xb124a6,_0x2e3513){_0x2e3513=_0x2e3513||0xc8;return function(_0x4b696c){if(_0x4b696c){return _0xb124a6['status'](_0x2e3513)[_0x4642('0x18')](_0x4b696c);}};}function respondWithFilteredResult(_0x16d1b0,_0x241e8a){return function(_0x43149a){if(_0x43149a){var _0x49815b=typeof _0x241e8a[_0x4642('0x19')]===_0x4642('0x1a')&&typeof _0x241e8a[_0x4642('0x1b')]==='undefined';var _0x5fc98f=_0x43149a[_0x4642('0x1c')];var _0x6ae8a=_0x49815b?0x0:_0x241e8a[_0x4642('0x19')];var _0xfc65a=_0x49815b?_0x43149a[_0x4642('0x1c')]:_0x241e8a[_0x4642('0x19')]+_0x241e8a[_0x4642('0x1b')];var _0xe69fe8;if(_0xfc65a>=_0x5fc98f){_0xfc65a=_0x5fc98f;_0xe69fe8=0xc8;}else{_0xe69fe8=0xce;}_0x16d1b0['status'](_0xe69fe8);return _0x16d1b0['set'](_0x4642('0x1d'),_0x6ae8a+'-'+_0xfc65a+'/'+_0x5fc98f)[_0x4642('0x18')](_0x43149a);}return null;};}function patchUpdates(_0x2061be){return function(_0x294e9e){try{jsonpatch[_0x4642('0x1e')](_0x294e9e,_0x2061be,!![]);}catch(_0x980df4){return BPromise[_0x4642('0x1f')](_0x980df4);}return _0x294e9e[_0x4642('0x20')]();};}function saveUpdates(_0x5c8f4d,_0x301756){return function(_0x19a8aa){if(_0x19a8aa){return _0x19a8aa[_0x4642('0x21')](_0x5c8f4d)[_0x4642('0x22')](function(_0x4b5b6d){return _0x4b5b6d;});}return null;};}function removeEntity(_0x3f1247,_0x1176f1){return function(_0x2039f4){if(_0x2039f4){return _0x2039f4[_0x4642('0x23')]()[_0x4642('0x22')](function(){_0x3f1247[_0x4642('0x16')](0xcc)[_0x4642('0x17')]();});}};}function handleEntityNotFound(_0x477b24,_0x2e6e79){return function(_0x4cb6fd){if(!_0x4cb6fd){_0x477b24['sendStatus'](0x194);}return _0x4cb6fd;};}function handleError(_0x4d598e,_0x59d984){_0x59d984=_0x59d984||0x1f4;return function(_0x336f24){logger[_0x4642('0x24')](_0x336f24[_0x4642('0x25')]);if(_0x336f24['name']){delete _0x336f24[_0x4642('0x26')];}_0x4d598e['status'](_0x59d984)[_0x4642('0x27')](_0x336f24);};}exports[_0x4642('0x28')]=function(_0x218c61,_0x2b1816){var _0x32e2d2={},_0x11c46d={},_0x30d525={'count':0x0,'rows':[]};var _0x5f2a6a=_[_0x4642('0x29')](db['ServicenowConfiguration']['rawAttributes'],function(_0x462872){return{'name':_0x462872['fieldName'],'type':_0x462872['type'][_0x4642('0x2a')]};});_0x11c46d['model']=_['map'](_0x5f2a6a,'name');_0x11c46d[_0x4642('0x2b')]=_[_0x4642('0x2c')](_0x218c61[_0x4642('0x2b')]);_0x11c46d['filters']=_[_0x4642('0x2d')](_0x11c46d[_0x4642('0x2e')],_0x11c46d['query']);_0x32e2d2[_0x4642('0x2f')]=_[_0x4642('0x2d')](_0x11c46d[_0x4642('0x2e')],qs[_0x4642('0x30')](_0x218c61[_0x4642('0x2b')][_0x4642('0x30')]));_0x32e2d2['attributes']=_0x32e2d2[_0x4642('0x2f')][_0x4642('0x31')]?_0x32e2d2['attributes']:_0x11c46d[_0x4642('0x2e')];if(!_0x218c61[_0x4642('0x2b')]['hasOwnProperty']('nolimit')){_0x32e2d2['limit']=qs[_0x4642('0x1b')](_0x218c61['query']['limit']);_0x32e2d2[_0x4642('0x19')]=qs['offset'](_0x218c61[_0x4642('0x2b')]['offset']);}_0x32e2d2[_0x4642('0x32')]=qs[_0x4642('0x33')](_0x218c61[_0x4642('0x2b')][_0x4642('0x33')]);_0x32e2d2[_0x4642('0x34')]=qs['filters'](_[_0x4642('0x35')](_0x218c61[_0x4642('0x2b')],_0x11c46d[_0x4642('0x36')]),_0x5f2a6a);if(_0x218c61['query'][_0x4642('0x37')]){_0x32e2d2[_0x4642('0x34')]=_[_0x4642('0x38')](_0x32e2d2[_0x4642('0x34')],{'$or':_['map'](_0x5f2a6a,function(_0x539781){if(_0x539781['type']!==_0x4642('0x39')){var _0x38be78={};_0x38be78[_0x539781[_0x4642('0x26')]]={'$like':'%'+_0x218c61[_0x4642('0x2b')][_0x4642('0x37')]+'%'};return _0x38be78;}})});}_0x32e2d2=_[_0x4642('0x38')]({},_0x32e2d2,_0x218c61[_0x4642('0x3a')]);var _0x1b9284={'where':_0x32e2d2['where']};return db[_0x4642('0x3b')][_0x4642('0x1c')](_0x1b9284)[_0x4642('0x22')](function(_0x2e0647){_0x30d525['count']=_0x2e0647;if(_0x218c61[_0x4642('0x2b')][_0x4642('0x3c')]){_0x32e2d2[_0x4642('0x3d')]=[{'all':!![]}];}return db[_0x4642('0x3b')][_0x4642('0x3e')](_0x32e2d2);})[_0x4642('0x22')](function(_0x5c1f4d){_0x30d525[_0x4642('0x3f')]=_0x5c1f4d;return _0x30d525;})[_0x4642('0x22')](respondWithFilteredResult(_0x2b1816,_0x32e2d2))[_0x4642('0x40')](handleError(_0x2b1816,null));};exports[_0x4642('0x41')]=function(_0x420f6e,_0x4e496c){var _0x251e34={'raw':![],'where':{'id':_0x420f6e[_0x4642('0x42')]['id']}},_0xbaca94={};_0xbaca94[_0x4642('0x2e')]=_[_0x4642('0x2c')](db['ServicenowConfiguration'][_0x4642('0x43')]);_0xbaca94['query']=_[_0x4642('0x2c')](_0x420f6e[_0x4642('0x2b')]);_0xbaca94['filters']=_[_0x4642('0x2d')](_0xbaca94[_0x4642('0x2e')],_0xbaca94[_0x4642('0x2b')]);_0x251e34[_0x4642('0x2f')]=_[_0x4642('0x2d')](_0xbaca94['model'],qs['fields'](_0x420f6e['query']['fields']));_0x251e34[_0x4642('0x2f')]=_0x251e34['attributes'][_0x4642('0x31')]?_0x251e34['attributes']:_0xbaca94[_0x4642('0x2e')];if(_0x420f6e[_0x4642('0x2b')][_0x4642('0x3c')]){_0x251e34[_0x4642('0x3d')]=[{'all':!![]}];}_0x251e34=_[_0x4642('0x38')]({},_0x251e34,_0x420f6e[_0x4642('0x3a')]);return db[_0x4642('0x3b')][_0x4642('0x44')](_0x251e34)[_0x4642('0x22')](handleEntityNotFound(_0x4e496c,null))['then'](respondWithResult(_0x4e496c,null))[_0x4642('0x40')](handleError(_0x4e496c,null));};exports[_0x4642('0x45')]=function(_0x3783c8,_0x3b9ade){return db[_0x4642('0x3b')]['create'](_0x3783c8[_0x4642('0x46')],{})[_0x4642('0x22')](respondWithResult(_0x3b9ade,0xc9))[_0x4642('0x40')](handleError(_0x3b9ade,null));};exports['update']=function(_0x5daa72,_0x4b064c){if(_0x5daa72[_0x4642('0x46')]['id']){delete _0x5daa72[_0x4642('0x46')]['id'];}return db[_0x4642('0x3b')][_0x4642('0x44')]({'where':{'id':_0x5daa72[_0x4642('0x42')]['id']}})[_0x4642('0x22')](handleEntityNotFound(_0x4b064c,null))[_0x4642('0x22')](saveUpdates(_0x5daa72['body'],null))[_0x4642('0x22')](respondWithResult(_0x4b064c,null))['catch'](handleError(_0x4b064c,null));};exports[_0x4642('0x23')]=function(_0x2e4aff,_0x3a9d1a){return db[_0x4642('0x3b')][_0x4642('0x44')]({'where':{'id':_0x2e4aff[_0x4642('0x42')]['id']}})[_0x4642('0x22')](handleEntityNotFound(_0x3a9d1a,null))[_0x4642('0x22')](removeEntity(_0x3a9d1a,null))[_0x4642('0x40')](handleError(_0x3a9d1a,null));};exports[_0x4642('0x47')]=function(_0x6520a7,_0x56fbaf,_0x3015fe){var _0x4d5627={};var _0x27531e={};var _0x2665d2;var _0x7ab4c9;return db[_0x4642('0x3b')][_0x4642('0x48')]({'where':{'id':_0x6520a7[_0x4642('0x42')]['id']}})[_0x4642('0x22')](handleEntityNotFound(_0x56fbaf,null))[_0x4642('0x22')](function(_0x4a0602){if(_0x4a0602){_0x2665d2=_0x4a0602;_0x27531e[_0x4642('0x2e')]=_[_0x4642('0x2c')](db[_0x4642('0x49')][_0x4642('0x43')]);_0x27531e[_0x4642('0x2b')]=_['keys'](_0x6520a7[_0x4642('0x2b')]);_0x27531e[_0x4642('0x36')]=_[_0x4642('0x2d')](_0x27531e[_0x4642('0x2e')],_0x27531e['query']);_0x4d5627['attributes']=_['intersection'](_0x27531e[_0x4642('0x2e')],qs['fields'](_0x6520a7[_0x4642('0x2b')]['fields']));_0x4d5627[_0x4642('0x2f')]=_0x4d5627[_0x4642('0x2f')][_0x4642('0x31')]?_0x4d5627[_0x4642('0x2f')]:_0x27531e[_0x4642('0x2e')];_0x4d5627['order']=qs['sort'](_0x6520a7[_0x4642('0x2b')][_0x4642('0x33')]);_0x4d5627[_0x4642('0x34')]=qs[_0x4642('0x36')](_[_0x4642('0x35')](_0x6520a7[_0x4642('0x2b')],_0x27531e[_0x4642('0x36')]));if(_0x6520a7[_0x4642('0x2b')][_0x4642('0x37')]){_0x4d5627[_0x4642('0x34')]=_[_0x4642('0x38')](_0x4d5627[_0x4642('0x34')],{'$or':_[_0x4642('0x29')](_0x4d5627[_0x4642('0x2f')],function(_0xa304c7){var _0x25bbc6={};_0x25bbc6[_0xa304c7]={'$like':'%'+_0x6520a7['query']['filter']+'%'};return _0x25bbc6;})});}_0x4d5627=_[_0x4642('0x38')]({},_0x4d5627,_0x6520a7['options']);return _0x2665d2['getFields'](_0x4d5627);}})[_0x4642('0x22')](function(_0x1ebb86){if(_0x1ebb86){_0x7ab4c9=_0x1ebb86[_0x4642('0x31')];if(!_0x6520a7[_0x4642('0x2b')][_0x4642('0x4a')](_0x4642('0x4b'))){_0x4d5627[_0x4642('0x1b')]=qs[_0x4642('0x1b')](_0x6520a7['query'][_0x4642('0x1b')]);_0x4d5627[_0x4642('0x19')]=qs['offset'](_0x6520a7['query'][_0x4642('0x19')]);}return _0x2665d2[_0x4642('0x47')](_0x4d5627);}})[_0x4642('0x22')](function(_0x4e7331){if(_0x4e7331){return _0x4e7331?{'count':_0x7ab4c9,'rows':_0x4e7331}:null;}})[_0x4642('0x22')](respondWithResult(_0x56fbaf,null))['catch'](handleError(_0x56fbaf,null));};exports[_0x4642('0x4c')]=function(_0x2e2047,_0x3a0a6d,_0x91b58c){var _0x3c31d9={};var _0x2a0bad={};var _0x5da86c;var _0x50c2c5;return db[_0x4642('0x3b')]['findOne']({'where':{'id':_0x2e2047[_0x4642('0x42')]['id']}})['then'](handleEntityNotFound(_0x3a0a6d,null))[_0x4642('0x22')](function(_0x209b06){if(_0x209b06){_0x5da86c=_0x209b06;_0x2a0bad[_0x4642('0x2e')]=_['keys'](db[_0x4642('0x49')][_0x4642('0x43')]);_0x2a0bad[_0x4642('0x2b')]=_[_0x4642('0x2c')](_0x2e2047[_0x4642('0x2b')]);_0x2a0bad['filters']=_[_0x4642('0x2d')](_0x2a0bad[_0x4642('0x2e')],_0x2a0bad[_0x4642('0x2b')]);_0x3c31d9[_0x4642('0x2f')]=_[_0x4642('0x2d')](_0x2a0bad['model'],qs[_0x4642('0x30')](_0x2e2047[_0x4642('0x2b')][_0x4642('0x30')]));_0x3c31d9['attributes']=_0x3c31d9[_0x4642('0x2f')][_0x4642('0x31')]?_0x3c31d9[_0x4642('0x2f')]:_0x2a0bad[_0x4642('0x2e')];_0x3c31d9[_0x4642('0x32')]=qs['sort'](_0x2e2047[_0x4642('0x2b')][_0x4642('0x33')]);_0x3c31d9[_0x4642('0x34')]=qs[_0x4642('0x36')](_['pick'](_0x2e2047[_0x4642('0x2b')],_0x2a0bad[_0x4642('0x36')]));if(_0x2e2047['query'][_0x4642('0x37')]){_0x3c31d9[_0x4642('0x34')]=_[_0x4642('0x38')](_0x3c31d9[_0x4642('0x34')],{'$or':_[_0x4642('0x29')](_0x3c31d9['attributes'],function(_0x2229f4){var _0x5d2843={};_0x5d2843[_0x2229f4]={'$like':'%'+_0x2e2047['query']['filter']+'%'};return _0x5d2843;})});}_0x3c31d9=_['merge']({},_0x3c31d9,_0x2e2047[_0x4642('0x3a')]);return _0x5da86c[_0x4642('0x4c')](_0x3c31d9);}})['then'](function(_0x2ecafc){if(_0x2ecafc){_0x50c2c5=_0x2ecafc['length'];if(!_0x2e2047['query']['hasOwnProperty'](_0x4642('0x4b'))){_0x3c31d9[_0x4642('0x1b')]=qs[_0x4642('0x1b')](_0x2e2047['query'][_0x4642('0x1b')]);_0x3c31d9[_0x4642('0x19')]=qs['offset'](_0x2e2047[_0x4642('0x2b')][_0x4642('0x19')]);}return _0x5da86c[_0x4642('0x4c')](_0x3c31d9);}})[_0x4642('0x22')](function(_0x1cf7c6){if(_0x1cf7c6){return _0x1cf7c6?{'count':_0x50c2c5,'rows':_0x1cf7c6}:null;}})['then'](respondWithResult(_0x3a0a6d,null))['catch'](handleError(_0x3a0a6d,null));};exports[_0x4642('0x4d')]=function(_0x3a0c42,_0x400772,_0x4c3ea3){var _0x1cc409={};var _0x57258d={};var _0xfdea37;var _0x24fc3e;return db['ServicenowConfiguration'][_0x4642('0x48')]({'where':{'id':_0x3a0c42[_0x4642('0x42')]['id']}})[_0x4642('0x22')](handleEntityNotFound(_0x400772,null))['then'](function(_0x372f0e){if(_0x372f0e){_0xfdea37=_0x372f0e;_0x57258d[_0x4642('0x2e')]=_[_0x4642('0x2c')](db['ServicenowField']['rawAttributes']);_0x57258d[_0x4642('0x2b')]=_[_0x4642('0x2c')](_0x3a0c42[_0x4642('0x2b')]);_0x57258d['filters']=_['intersection'](_0x57258d[_0x4642('0x2e')],_0x57258d[_0x4642('0x2b')]);_0x1cc409[_0x4642('0x2f')]=_[_0x4642('0x2d')](_0x57258d[_0x4642('0x2e')],qs[_0x4642('0x30')](_0x3a0c42[_0x4642('0x2b')][_0x4642('0x30')]));_0x1cc409[_0x4642('0x2f')]=_0x1cc409[_0x4642('0x2f')][_0x4642('0x31')]?_0x1cc409[_0x4642('0x2f')]:_0x57258d[_0x4642('0x2e')];_0x1cc409[_0x4642('0x32')]=qs[_0x4642('0x33')](_0x3a0c42['query']['sort']);_0x1cc409[_0x4642('0x34')]=qs['filters'](_[_0x4642('0x35')](_0x3a0c42[_0x4642('0x2b')],_0x57258d[_0x4642('0x36')]));if(_0x3a0c42[_0x4642('0x2b')][_0x4642('0x37')]){_0x1cc409[_0x4642('0x34')]=_['merge'](_0x1cc409[_0x4642('0x34')],{'$or':_['map'](_0x1cc409[_0x4642('0x2f')],function(_0x4e747e){var _0x49e8e1={};_0x49e8e1[_0x4e747e]={'$like':'%'+_0x3a0c42['query'][_0x4642('0x37')]+'%'};return _0x49e8e1;})});}_0x1cc409=_[_0x4642('0x38')]({},_0x1cc409,_0x3a0c42[_0x4642('0x3a')]);return _0xfdea37[_0x4642('0x4d')](_0x1cc409);}})[_0x4642('0x22')](function(_0x2793b6){if(_0x2793b6){_0x24fc3e=_0x2793b6[_0x4642('0x31')];if(!_0x3a0c42[_0x4642('0x2b')][_0x4642('0x4a')](_0x4642('0x4b'))){_0x1cc409[_0x4642('0x1b')]=qs['limit'](_0x3a0c42[_0x4642('0x2b')][_0x4642('0x1b')]);_0x1cc409[_0x4642('0x19')]=qs[_0x4642('0x19')](_0x3a0c42[_0x4642('0x2b')][_0x4642('0x19')]);}return _0xfdea37['getDescriptions'](_0x1cc409);}})['then'](function(_0x35d724){if(_0x35d724){return _0x35d724?{'count':_0x24fc3e,'rows':_0x35d724}:null;}})[_0x4642('0x22')](respondWithResult(_0x400772,null))[_0x4642('0x40')](handleError(_0x400772,null));}; \ No newline at end of file +var _0xec4b=['undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','name','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','options','ServicenowConfiguration','findAll','rows','catch','show','params','find','create','body','getFields','getSubjects','findOne','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/license/util','../../mysqldb','status','end','json','offset'];(function(_0x845304,_0x154c0f){var _0x51c06d=function(_0x36a285){while(--_0x36a285){_0x845304['push'](_0x845304['shift']());}};_0x51c06d(++_0x154c0f);}(_0xec4b,0x80));var _0xbec4=function(_0x1cc271,_0x353fd5){_0x1cc271=_0x1cc271-0x0;var _0x5b2ff9=_0xec4b[_0x1cc271];return _0x5b2ff9;};'use strict';var emlformat=require(_0xbec4('0x0'));var rimraf=require(_0xbec4('0x1'));var zipdir=require(_0xbec4('0x2'));var jsonpatch=require(_0xbec4('0x3'));var rp=require(_0xbec4('0x4'));var moment=require(_0xbec4('0x5'));var BPromise=require(_0xbec4('0x6'));var Mustache=require(_0xbec4('0x7'));var util=require(_0xbec4('0x8'));var path=require(_0xbec4('0x9'));var sox=require(_0xbec4('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbec4('0xb'));var _=require(_0xbec4('0xc'));var squel=require(_0xbec4('0xd'));var crypto=require(_0xbec4('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xbec4('0xf'));var toCsv=require('to-csv');var querystring=require(_0xbec4('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xbec4('0x11'));var as=require(_0xbec4('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xbec4('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xbec4('0x14'));var db=require(_0xbec4('0x15'))['db'];function respondWithStatusCode(_0x4b64f3,_0x21b551){_0x21b551=_0x21b551||0xcc;return function(_0x4463d0){if(_0x4463d0){return _0x4b64f3['sendStatus'](_0x21b551);}return _0x4b64f3[_0xbec4('0x16')](_0x21b551)[_0xbec4('0x17')]();};}function respondWithResult(_0x57127b,_0x230caa){_0x230caa=_0x230caa||0xc8;return function(_0x2cee7f){if(_0x2cee7f){return _0x57127b[_0xbec4('0x16')](_0x230caa)[_0xbec4('0x18')](_0x2cee7f);}};}function respondWithFilteredResult(_0x44a94,_0x474e87){return function(_0x8d16d7){if(_0x8d16d7){var _0x4acb34=typeof _0x474e87[_0xbec4('0x19')]===_0xbec4('0x1a')&&typeof _0x474e87[_0xbec4('0x1b')]===_0xbec4('0x1a');var _0xe97e4d=_0x8d16d7[_0xbec4('0x1c')];var _0x732c9a=_0x4acb34?0x0:_0x474e87[_0xbec4('0x19')];var _0x1e3e26=_0x4acb34?_0x8d16d7[_0xbec4('0x1c')]:_0x474e87['offset']+_0x474e87[_0xbec4('0x1b')];var _0x12b17c;if(_0x1e3e26>=_0xe97e4d){_0x1e3e26=_0xe97e4d;_0x12b17c=0xc8;}else{_0x12b17c=0xce;}_0x44a94[_0xbec4('0x16')](_0x12b17c);return _0x44a94[_0xbec4('0x1d')](_0xbec4('0x1e'),_0x732c9a+'-'+_0x1e3e26+'/'+_0xe97e4d)[_0xbec4('0x18')](_0x8d16d7);}return null;};}function patchUpdates(_0x4fa12e){return function(_0x321326){try{jsonpatch[_0xbec4('0x1f')](_0x321326,_0x4fa12e,!![]);}catch(_0x208860){return BPromise[_0xbec4('0x20')](_0x208860);}return _0x321326[_0xbec4('0x21')]();};}function saveUpdates(_0x890801,_0x2e1578){return function(_0x224612){if(_0x224612){return _0x224612[_0xbec4('0x22')](_0x890801)[_0xbec4('0x23')](function(_0x340615){return _0x340615;});}return null;};}function removeEntity(_0x174e7a,_0x2e37a0){return function(_0x96323a){if(_0x96323a){return _0x96323a[_0xbec4('0x24')]()['then'](function(){_0x174e7a[_0xbec4('0x16')](0xcc)[_0xbec4('0x17')]();});}};}function handleEntityNotFound(_0x4bc04d,_0x47d5ec){return function(_0x430456){if(!_0x430456){_0x4bc04d[_0xbec4('0x25')](0x194);}return _0x430456;};}function handleError(_0x400575,_0x5e619c){_0x5e619c=_0x5e619c||0x1f4;return function(_0x356e66){logger['error'](_0x356e66[_0xbec4('0x26')]);if(_0x356e66[_0xbec4('0x27')]){delete _0x356e66[_0xbec4('0x27')];}_0x400575['status'](_0x5e619c)['send'](_0x356e66);};}exports[_0xbec4('0x28')]=function(_0x5306fd,_0xa9c423){var _0x30ebd3={},_0x34eeba={},_0x23e456={'count':0x0,'rows':[]};var _0x44a304=_[_0xbec4('0x29')](db['ServicenowConfiguration'][_0xbec4('0x2a')],function(_0x5dd2da){return{'name':_0x5dd2da[_0xbec4('0x2b')],'type':_0x5dd2da['type'][_0xbec4('0x2c')]};});_0x34eeba[_0xbec4('0x2d')]=_[_0xbec4('0x29')](_0x44a304,_0xbec4('0x27'));_0x34eeba[_0xbec4('0x2e')]=_[_0xbec4('0x2f')](_0x5306fd[_0xbec4('0x2e')]);_0x34eeba[_0xbec4('0x30')]=_[_0xbec4('0x31')](_0x34eeba[_0xbec4('0x2d')],_0x34eeba[_0xbec4('0x2e')]);_0x30ebd3['attributes']=_['intersection'](_0x34eeba[_0xbec4('0x2d')],qs[_0xbec4('0x32')](_0x5306fd['query']['fields']));_0x30ebd3['attributes']=_0x30ebd3[_0xbec4('0x33')][_0xbec4('0x34')]?_0x30ebd3['attributes']:_0x34eeba[_0xbec4('0x2d')];if(!_0x5306fd[_0xbec4('0x2e')][_0xbec4('0x35')](_0xbec4('0x36'))){_0x30ebd3[_0xbec4('0x1b')]=qs[_0xbec4('0x1b')](_0x5306fd[_0xbec4('0x2e')][_0xbec4('0x1b')]);_0x30ebd3['offset']=qs[_0xbec4('0x19')](_0x5306fd[_0xbec4('0x2e')][_0xbec4('0x19')]);}_0x30ebd3[_0xbec4('0x37')]=qs[_0xbec4('0x38')](_0x5306fd[_0xbec4('0x2e')][_0xbec4('0x38')]);_0x30ebd3['where']=qs['filters'](_[_0xbec4('0x39')](_0x5306fd[_0xbec4('0x2e')],_0x34eeba[_0xbec4('0x30')]),_0x44a304);if(_0x5306fd[_0xbec4('0x2e')][_0xbec4('0x3a')]){_0x30ebd3[_0xbec4('0x3b')]=_[_0xbec4('0x3c')](_0x30ebd3['where'],{'$or':_['map'](_0x44a304,function(_0x149779){if(_0x149779[_0xbec4('0x3d')]!==_0xbec4('0x3e')){var _0x5f1b37={};_0x5f1b37[_0x149779['name']]={'$like':'%'+_0x5306fd[_0xbec4('0x2e')][_0xbec4('0x3a')]+'%'};return _0x5f1b37;}})});}_0x30ebd3=_[_0xbec4('0x3c')]({},_0x30ebd3,_0x5306fd[_0xbec4('0x3f')]);var _0x13ed6f={'where':_0x30ebd3['where']};return db[_0xbec4('0x40')][_0xbec4('0x1c')](_0x13ed6f)[_0xbec4('0x23')](function(_0x3f328c){_0x23e456[_0xbec4('0x1c')]=_0x3f328c;if(_0x5306fd[_0xbec4('0x2e')]['includeAll']){_0x30ebd3['include']=[{'all':!![]}];}return db[_0xbec4('0x40')][_0xbec4('0x41')](_0x30ebd3);})[_0xbec4('0x23')](function(_0x208bb1){_0x23e456[_0xbec4('0x42')]=_0x208bb1;return _0x23e456;})[_0xbec4('0x23')](respondWithFilteredResult(_0xa9c423,_0x30ebd3))[_0xbec4('0x43')](handleError(_0xa9c423,null));};exports[_0xbec4('0x44')]=function(_0x40f8ab,_0x2803ad){var _0x2610fc={'raw':![],'where':{'id':_0x40f8ab[_0xbec4('0x45')]['id']}},_0x3ddd74={};_0x3ddd74[_0xbec4('0x2d')]=_[_0xbec4('0x2f')](db[_0xbec4('0x40')][_0xbec4('0x2a')]);_0x3ddd74[_0xbec4('0x2e')]=_['keys'](_0x40f8ab[_0xbec4('0x2e')]);_0x3ddd74[_0xbec4('0x30')]=_['intersection'](_0x3ddd74['model'],_0x3ddd74[_0xbec4('0x2e')]);_0x2610fc[_0xbec4('0x33')]=_[_0xbec4('0x31')](_0x3ddd74['model'],qs[_0xbec4('0x32')](_0x40f8ab['query'][_0xbec4('0x32')]));_0x2610fc[_0xbec4('0x33')]=_0x2610fc[_0xbec4('0x33')][_0xbec4('0x34')]?_0x2610fc[_0xbec4('0x33')]:_0x3ddd74['model'];if(_0x40f8ab[_0xbec4('0x2e')]['includeAll']){_0x2610fc['include']=[{'all':!![]}];}_0x2610fc=_[_0xbec4('0x3c')]({},_0x2610fc,_0x40f8ab['options']);return db[_0xbec4('0x40')][_0xbec4('0x46')](_0x2610fc)[_0xbec4('0x23')](handleEntityNotFound(_0x2803ad,null))[_0xbec4('0x23')](respondWithResult(_0x2803ad,null))[_0xbec4('0x43')](handleError(_0x2803ad,null));};exports[_0xbec4('0x47')]=function(_0x2a993e,_0x4f1351){return db[_0xbec4('0x40')][_0xbec4('0x47')](_0x2a993e[_0xbec4('0x48')],{})['then'](respondWithResult(_0x4f1351,0xc9))[_0xbec4('0x43')](handleError(_0x4f1351,null));};exports['update']=function(_0x3bdcb7,_0x2a07e3){if(_0x3bdcb7['body']['id']){delete _0x3bdcb7[_0xbec4('0x48')]['id'];}return db[_0xbec4('0x40')][_0xbec4('0x46')]({'where':{'id':_0x3bdcb7[_0xbec4('0x45')]['id']}})['then'](handleEntityNotFound(_0x2a07e3,null))[_0xbec4('0x23')](saveUpdates(_0x3bdcb7['body'],null))[_0xbec4('0x23')](respondWithResult(_0x2a07e3,null))[_0xbec4('0x43')](handleError(_0x2a07e3,null));};exports['destroy']=function(_0x483de5,_0x56485f){return db[_0xbec4('0x40')][_0xbec4('0x46')]({'where':{'id':_0x483de5[_0xbec4('0x45')]['id']}})[_0xbec4('0x23')](handleEntityNotFound(_0x56485f,null))[_0xbec4('0x23')](removeEntity(_0x56485f,null))[_0xbec4('0x43')](handleError(_0x56485f,null));};exports[_0xbec4('0x49')]=function(_0x53c2df,_0x5a4351,_0x3560da){var _0x602380={};var _0x1827ff={};var _0x3b02ab;var _0x354418;return db[_0xbec4('0x40')]['findOne']({'where':{'id':_0x53c2df[_0xbec4('0x45')]['id']}})[_0xbec4('0x23')](handleEntityNotFound(_0x5a4351,null))[_0xbec4('0x23')](function(_0x3d6df1){if(_0x3d6df1){_0x3b02ab=_0x3d6df1;_0x1827ff['model']=_[_0xbec4('0x2f')](db['ServicenowField'][_0xbec4('0x2a')]);_0x1827ff[_0xbec4('0x2e')]=_[_0xbec4('0x2f')](_0x53c2df[_0xbec4('0x2e')]);_0x1827ff[_0xbec4('0x30')]=_[_0xbec4('0x31')](_0x1827ff[_0xbec4('0x2d')],_0x1827ff['query']);_0x602380[_0xbec4('0x33')]=_[_0xbec4('0x31')](_0x1827ff[_0xbec4('0x2d')],qs[_0xbec4('0x32')](_0x53c2df[_0xbec4('0x2e')]['fields']));_0x602380[_0xbec4('0x33')]=_0x602380['attributes'][_0xbec4('0x34')]?_0x602380[_0xbec4('0x33')]:_0x1827ff[_0xbec4('0x2d')];_0x602380[_0xbec4('0x37')]=qs[_0xbec4('0x38')](_0x53c2df['query'][_0xbec4('0x38')]);_0x602380[_0xbec4('0x3b')]=qs[_0xbec4('0x30')](_[_0xbec4('0x39')](_0x53c2df[_0xbec4('0x2e')],_0x1827ff['filters']));if(_0x53c2df['query'][_0xbec4('0x3a')]){_0x602380[_0xbec4('0x3b')]=_[_0xbec4('0x3c')](_0x602380['where'],{'$or':_[_0xbec4('0x29')](_0x602380['attributes'],function(_0x52dd31){var _0x1047c7={};_0x1047c7[_0x52dd31]={'$like':'%'+_0x53c2df['query'][_0xbec4('0x3a')]+'%'};return _0x1047c7;})});}_0x602380=_['merge']({},_0x602380,_0x53c2df[_0xbec4('0x3f')]);return _0x3b02ab[_0xbec4('0x49')](_0x602380);}})[_0xbec4('0x23')](function(_0x2bc198){if(_0x2bc198){_0x354418=_0x2bc198[_0xbec4('0x34')];if(!_0x53c2df[_0xbec4('0x2e')][_0xbec4('0x35')](_0xbec4('0x36'))){_0x602380[_0xbec4('0x1b')]=qs['limit'](_0x53c2df[_0xbec4('0x2e')][_0xbec4('0x1b')]);_0x602380[_0xbec4('0x19')]=qs['offset'](_0x53c2df[_0xbec4('0x2e')]['offset']);}return _0x3b02ab[_0xbec4('0x49')](_0x602380);}})[_0xbec4('0x23')](function(_0x41a08d){if(_0x41a08d){return _0x41a08d?{'count':_0x354418,'rows':_0x41a08d}:null;}})[_0xbec4('0x23')](respondWithResult(_0x5a4351,null))[_0xbec4('0x43')](handleError(_0x5a4351,null));};exports[_0xbec4('0x4a')]=function(_0x29e925,_0xe4a5f,_0x3f6ec5){var _0x143218={};var _0x1e618d={};var _0x3d1b54;var _0x529dc9;return db[_0xbec4('0x40')][_0xbec4('0x4b')]({'where':{'id':_0x29e925['params']['id']}})[_0xbec4('0x23')](handleEntityNotFound(_0xe4a5f,null))[_0xbec4('0x23')](function(_0x1f8785){if(_0x1f8785){_0x3d1b54=_0x1f8785;_0x1e618d[_0xbec4('0x2d')]=_[_0xbec4('0x2f')](db['ServicenowField'][_0xbec4('0x2a')]);_0x1e618d[_0xbec4('0x2e')]=_[_0xbec4('0x2f')](_0x29e925[_0xbec4('0x2e')]);_0x1e618d[_0xbec4('0x30')]=_[_0xbec4('0x31')](_0x1e618d['model'],_0x1e618d[_0xbec4('0x2e')]);_0x143218['attributes']=_[_0xbec4('0x31')](_0x1e618d[_0xbec4('0x2d')],qs[_0xbec4('0x32')](_0x29e925[_0xbec4('0x2e')][_0xbec4('0x32')]));_0x143218[_0xbec4('0x33')]=_0x143218[_0xbec4('0x33')][_0xbec4('0x34')]?_0x143218['attributes']:_0x1e618d[_0xbec4('0x2d')];_0x143218['order']=qs[_0xbec4('0x38')](_0x29e925[_0xbec4('0x2e')][_0xbec4('0x38')]);_0x143218[_0xbec4('0x3b')]=qs[_0xbec4('0x30')](_['pick'](_0x29e925['query'],_0x1e618d[_0xbec4('0x30')]));if(_0x29e925[_0xbec4('0x2e')]['filter']){_0x143218['where']=_[_0xbec4('0x3c')](_0x143218[_0xbec4('0x3b')],{'$or':_['map'](_0x143218['attributes'],function(_0x4c87b8){var _0xe322a2={};_0xe322a2[_0x4c87b8]={'$like':'%'+_0x29e925['query'][_0xbec4('0x3a')]+'%'};return _0xe322a2;})});}_0x143218=_[_0xbec4('0x3c')]({},_0x143218,_0x29e925[_0xbec4('0x3f')]);return _0x3d1b54[_0xbec4('0x4a')](_0x143218);}})['then'](function(_0x3a4eeb){if(_0x3a4eeb){_0x529dc9=_0x3a4eeb[_0xbec4('0x34')];if(!_0x29e925[_0xbec4('0x2e')][_0xbec4('0x35')](_0xbec4('0x36'))){_0x143218[_0xbec4('0x1b')]=qs[_0xbec4('0x1b')](_0x29e925[_0xbec4('0x2e')][_0xbec4('0x1b')]);_0x143218[_0xbec4('0x19')]=qs[_0xbec4('0x19')](_0x29e925['query']['offset']);}return _0x3d1b54[_0xbec4('0x4a')](_0x143218);}})[_0xbec4('0x23')](function(_0x40e797){if(_0x40e797){return _0x40e797?{'count':_0x529dc9,'rows':_0x40e797}:null;}})[_0xbec4('0x23')](respondWithResult(_0xe4a5f,null))[_0xbec4('0x43')](handleError(_0xe4a5f,null));};exports[_0xbec4('0x4c')]=function(_0x409b23,_0x2d9a27,_0x5a2ad5){var _0x279b65={};var _0x7b42c1={};var _0x392b09;var _0x3d36d9;return db[_0xbec4('0x40')][_0xbec4('0x4b')]({'where':{'id':_0x409b23[_0xbec4('0x45')]['id']}})[_0xbec4('0x23')](handleEntityNotFound(_0x2d9a27,null))['then'](function(_0x4b769c){if(_0x4b769c){_0x392b09=_0x4b769c;_0x7b42c1[_0xbec4('0x2d')]=_[_0xbec4('0x2f')](db['ServicenowField'][_0xbec4('0x2a')]);_0x7b42c1['query']=_[_0xbec4('0x2f')](_0x409b23['query']);_0x7b42c1['filters']=_[_0xbec4('0x31')](_0x7b42c1[_0xbec4('0x2d')],_0x7b42c1[_0xbec4('0x2e')]);_0x279b65[_0xbec4('0x33')]=_['intersection'](_0x7b42c1[_0xbec4('0x2d')],qs[_0xbec4('0x32')](_0x409b23[_0xbec4('0x2e')]['fields']));_0x279b65['attributes']=_0x279b65[_0xbec4('0x33')]['length']?_0x279b65[_0xbec4('0x33')]:_0x7b42c1[_0xbec4('0x2d')];_0x279b65[_0xbec4('0x37')]=qs[_0xbec4('0x38')](_0x409b23[_0xbec4('0x2e')][_0xbec4('0x38')]);_0x279b65[_0xbec4('0x3b')]=qs[_0xbec4('0x30')](_[_0xbec4('0x39')](_0x409b23[_0xbec4('0x2e')],_0x7b42c1[_0xbec4('0x30')]));if(_0x409b23[_0xbec4('0x2e')][_0xbec4('0x3a')]){_0x279b65['where']=_[_0xbec4('0x3c')](_0x279b65['where'],{'$or':_[_0xbec4('0x29')](_0x279b65['attributes'],function(_0x4dfbf4){var _0x475809={};_0x475809[_0x4dfbf4]={'$like':'%'+_0x409b23[_0xbec4('0x2e')]['filter']+'%'};return _0x475809;})});}_0x279b65=_['merge']({},_0x279b65,_0x409b23['options']);return _0x392b09[_0xbec4('0x4c')](_0x279b65);}})['then'](function(_0x26c98a){if(_0x26c98a){_0x3d36d9=_0x26c98a[_0xbec4('0x34')];if(!_0x409b23[_0xbec4('0x2e')]['hasOwnProperty'](_0xbec4('0x36'))){_0x279b65[_0xbec4('0x1b')]=qs[_0xbec4('0x1b')](_0x409b23[_0xbec4('0x2e')][_0xbec4('0x1b')]);_0x279b65[_0xbec4('0x19')]=qs['offset'](_0x409b23[_0xbec4('0x2e')]['offset']);}return _0x392b09[_0xbec4('0x4c')](_0x279b65);}})[_0xbec4('0x23')](function(_0x8c62e){if(_0x8c62e){return _0x8c62e?{'count':_0x3d36d9,'rows':_0x8c62e}:null;}})['then'](respondWithResult(_0x2d9a27,null))[_0xbec4('0x43')](handleError(_0x2d9a27,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index e702a05..240b91a 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 _0x9861=['ServicenowConfiguration','int_servicenow_configurations','lodash','api','moment','bluebird','request-promise','path','rimraf','./intServicenowConfiguration.attributes','exports','define'];(function(_0x41bfbe,_0x5eebff){var _0x470d5c=function(_0x2bd839){while(--_0x2bd839){_0x41bfbe['push'](_0x41bfbe['shift']());}};_0x470d5c(++_0x5eebff);}(_0x9861,0x176));var _0x1986=function(_0x383680,_0x3d3681){_0x383680=_0x383680-0x0;var _0x1765cb=_0x9861[_0x383680];return _0x1765cb;};'use strict';var _=require(_0x1986('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x1986('0x1'));var moment=require(_0x1986('0x2'));var BPromise=require(_0x1986('0x3'));var rp=require(_0x1986('0x4'));var fs=require('fs');var path=require(_0x1986('0x5'));var rimraf=require(_0x1986('0x6'));var config=require('../../config/environment');var attributes=require(_0x1986('0x7'));module[_0x1986('0x8')]=function(_0x1b56d6,_0x17ccbf){return _0x1b56d6[_0x1986('0x9')](_0x1986('0xa'),attributes,{'tableName':_0x1986('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x57c3=['path','rimraf','../../config/environment','exports','define','ServicenowConfiguration','int_servicenow_configurations','lodash','util','../../config/logger','request-promise'];(function(_0x3b53e8,_0xb5ea60){var _0x37c31c=function(_0x41048c){while(--_0x41048c){_0x3b53e8['push'](_0x3b53e8['shift']());}};_0x37c31c(++_0xb5ea60);}(_0x57c3,0xc2));var _0x357c=function(_0x4dbebb,_0x357da8){_0x4dbebb=_0x4dbebb-0x0;var _0x1ff55e=_0x57c3[_0x4dbebb];return _0x1ff55e;};'use strict';var _=require(_0x357c('0x0'));var util=require(_0x357c('0x1'));var logger=require(_0x357c('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x357c('0x3'));var fs=require('fs');var path=require(_0x357c('0x4'));var rimraf=require(_0x357c('0x5'));var config=require(_0x357c('0x6'));var attributes=require('./intServicenowConfiguration.attributes');module[_0x357c('0x7')]=function(_0x4ef0ce,_0x26c35d){return _0x4ef0ce[_0x357c('0x8')](_0x357c('0x9'),attributes,{'tableName':_0x357c('0xa'),'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 a9c47bd..925bc6b 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 _0x99d6=['ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','ServicenowConfiguration,\x20%s,\x20%s','message','result','catch','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug'];(function(_0x41e9af,_0x32f8aa){var _0x1a08f9=function(_0x321dfc){while(--_0x321dfc){_0x41e9af['push'](_0x41e9af['shift']());}};_0x1a08f9(++_0x32f8aa);}(_0x99d6,0x193));var _0x699d=function(_0x102ff9,_0x907658){_0x102ff9=_0x102ff9-0x0;var _0x24fa97=_0x99d6[_0x102ff9];return _0x24fa97;};'use strict';var _=require(_0x699d('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x699d('0x1'));var fs=require('fs');var Redis=require(_0x699d('0x2'));var db=require(_0x699d('0x3'))['db'];var utils=require(_0x699d('0x4'));var logger=require(_0x699d('0x5'))(_0x699d('0x6'));var config=require(_0x699d('0x7'));var jayson=require(_0x699d('0x8'));var client=jayson[_0x699d('0x9')][_0x699d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xee5e8,_0x2a0387,_0x4f6d7f){return new BPromise(function(_0x5765b7,_0x17751e){return client[_0x699d('0xb')](_0xee5e8,_0x4f6d7f)['then'](function(_0x100389){logger[_0x699d('0xc')]('ServicenowConfiguration,\x20%s,\x20%s',_0x2a0387,_0x699d('0xd'));logger[_0x699d('0xe')](_0x699d('0xf'),_0x2a0387,_0x699d('0xd'),JSON[_0x699d('0x10')](_0x100389));if(_0x100389[_0x699d('0x11')]){if(_0x100389[_0x699d('0x11')]['code']===0x1f4){logger[_0x699d('0x11')](_0x699d('0x12'),_0x2a0387,_0x100389[_0x699d('0x11')][_0x699d('0x13')]);return _0x17751e(_0x100389['error'][_0x699d('0x13')]);}logger['error'](_0x699d('0x12'),_0x2a0387,_0x100389[_0x699d('0x11')]['message']);return _0x5765b7(_0x100389[_0x699d('0x11')][_0x699d('0x13')]);}else{logger[_0x699d('0xc')](_0x699d('0x12'),_0x2a0387,_0x699d('0xd'));_0x5765b7(_0x100389[_0x699d('0x14')][_0x699d('0x13')]);}})[_0x699d('0x15')](function(_0x560e02){logger[_0x699d('0x11')](_0x699d('0x12'),_0x2a0387,_0x560e02);_0x17751e(_0x560e02);});});} \ No newline at end of file +var _0x6500=['jayson/promise','client','then','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x445175,_0x49ee96){var _0x559740=function(_0x42132d){while(--_0x42132d){_0x445175['push'](_0x445175['shift']());}};_0x559740(++_0x49ee96);}(_0x6500,0x13b));var _0x0650=function(_0x2a329f,_0x447230){_0x2a329f=_0x2a329f-0x0;var _0x7be9cf=_0x6500[_0x2a329f];return _0x7be9cf;};'use strict';var _=require('lodash');var util=require(_0x0650('0x0'));var moment=require(_0x0650('0x1'));var BPromise=require(_0x0650('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0650('0x3'));var db=require(_0x0650('0x4'))['db'];var utils=require(_0x0650('0x5'));var logger=require(_0x0650('0x6'))(_0x0650('0x7'));var config=require('../../config/environment');var jayson=require(_0x0650('0x8'));var client=jayson[_0x0650('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0xc02b3,_0x7f455a,_0x1ece37){return new BPromise(function(_0x2e90e7,_0x26e11c){return client['request'](_0xc02b3,_0x1ece37)[_0x0650('0xa')](function(_0x52e042){logger[_0x0650('0xb')](_0x0650('0xc'),_0x7f455a,_0x0650('0xd'));logger['debug'](_0x0650('0xe'),_0x7f455a,_0x0650('0xd'),JSON[_0x0650('0xf')](_0x52e042));if(_0x52e042[_0x0650('0x10')]){if(_0x52e042[_0x0650('0x10')]['code']===0x1f4){logger[_0x0650('0x10')]('ServicenowConfiguration,\x20%s,\x20%s',_0x7f455a,_0x52e042[_0x0650('0x10')][_0x0650('0x11')]);return _0x26e11c(_0x52e042['error'][_0x0650('0x11')]);}logger['error'](_0x0650('0xc'),_0x7f455a,_0x52e042[_0x0650('0x10')][_0x0650('0x11')]);return _0x2e90e7(_0x52e042[_0x0650('0x10')][_0x0650('0x11')]);}else{logger[_0x0650('0xb')]('ServicenowConfiguration,\x20%s,\x20%s',_0x7f455a,'request\x20sent');_0x2e90e7(_0x52e042[_0x0650('0x12')]['message']);}})['catch'](function(_0x11c2a3){logger[_0x0650('0x10')](_0x0650('0xc'),_0x7f455a,_0x11c2a3);_0x26e11c(_0x11c2a3);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index c88d6c2..ad2c28b 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 _0x6b22=['post','update','delete','destroy','exports','multer','util','path','fs-extra','../../components/interaction/service','get','isAuthenticated','index','/:id','show'];(function(_0x221d4e,_0x4d1e7a){var _0x1b4c8b=function(_0x9b7673){while(--_0x9b7673){_0x221d4e['push'](_0x221d4e['shift']());}};_0x1b4c8b(++_0x4d1e7a);}(_0x6b22,0x122));var _0x26b2=function(_0x1f79ba,_0x5ef27b){_0x1f79ba=_0x1f79ba-0x0;var _0x125016=_0x6b22[_0x1f79ba];return _0x125016;};'use strict';var multer=require(_0x26b2('0x0'));var util=require(_0x26b2('0x1'));var path=require(_0x26b2('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x26b2('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x26b2('0x4'));var config=require('../../config/environment');var controller=require('./intServicenowField.controller');router[_0x26b2('0x5')]('/',auth[_0x26b2('0x6')](),controller[_0x26b2('0x7')]);router['get'](_0x26b2('0x8'),auth[_0x26b2('0x6')](),controller[_0x26b2('0x9')]);router[_0x26b2('0xa')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x26b2('0x8'),auth[_0x26b2('0x6')](),controller[_0x26b2('0xb')]);router[_0x26b2('0xc')](_0x26b2('0x8'),auth['isAuthenticated'](),controller[_0x26b2('0xd')]);module[_0x26b2('0xe')]=router; \ No newline at end of file +var _0xc80e=['../../components/interaction/service','../../config/environment','./intServicenowField.controller','get','isAuthenticated','/:id','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x38d224,_0x2ec0ea){var _0x43f7f1=function(_0x5116a1){while(--_0x5116a1){_0x38d224['push'](_0x38d224['shift']());}};_0x43f7f1(++_0x2ec0ea);}(_0xc80e,0x189));var _0xec80=function(_0x308a9a,_0xd452bb){_0x308a9a=_0x308a9a-0x0;var _0xf317d1=_0xc80e[_0x308a9a];return _0xf317d1;};'use strict';var multer=require(_0xec80('0x0'));var util=require(_0xec80('0x1'));var path=require(_0xec80('0x2'));var timeout=require(_0xec80('0x3'));var express=require(_0xec80('0x4'));var router=express['Router']();var fs_extra=require(_0xec80('0x5'));var auth=require(_0xec80('0x6'));var interaction=require(_0xec80('0x7'));var config=require(_0xec80('0x8'));var controller=require(_0xec80('0x9'));router[_0xec80('0xa')]('/',auth[_0xec80('0xb')](),controller['index']);router[_0xec80('0xa')](_0xec80('0xc'),auth[_0xec80('0xb')](),controller['show']);router[_0xec80('0xd')]('/',auth[_0xec80('0xb')](),controller[_0xec80('0xe')]);router[_0xec80('0xf')](_0xec80('0xc'),auth[_0xec80('0xb')](),controller[_0xec80('0x10')]);router[_0xec80('0x11')](_0xec80('0xc'),auth[_0xec80('0xb')](),controller[_0xec80('0x12')]);module[_0xec80('0x13')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index efd6968..e65e184 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 _0x71a0=['variable','customVariable','keyValue','picklist','STRING','sequelize','exports','ENUM','string'];(function(_0x2fc7ca,_0x5d022a){var _0x5c3f39=function(_0x518113){while(--_0x518113){_0x2fc7ca['push'](_0x2fc7ca['shift']());}};_0x5c3f39(++_0x5d022a);}(_0x71a0,0x10a));var _0x071a=function(_0x37c581,_0x3433c9){_0x37c581=_0x37c581-0x0;var _0x118806=_0x71a0[_0x37c581];return _0x118806;};'use strict';var Sequelize=require(_0x071a('0x0'));module[_0x071a('0x1')]={'type':{'type':Sequelize[_0x071a('0x2')](_0x071a('0x3'),_0x071a('0x4'),_0x071a('0x5'),_0x071a('0x6'),_0x071a('0x7')),'defaultValue':'string'},'content':{'type':Sequelize[_0x071a('0x8')]},'key':{'type':Sequelize[_0x071a('0x8')]},'keyType':{'type':Sequelize[_0x071a('0x2')](_0x071a('0x3'),_0x071a('0x4'),_0x071a('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x071a('0x8')]},'nameField':{'type':Sequelize[_0x071a('0x8')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x071a('0x8')]}}; \ No newline at end of file +var _0xe3df=['picklist','STRING','customVariable','BOOLEAN','ENUM','string','variable','keyValue'];(function(_0x67b24,_0x8ca542){var _0x16212c=function(_0xedbe0b){while(--_0xedbe0b){_0x67b24['push'](_0x67b24['shift']());}};_0x16212c(++_0x8ca542);}(_0xe3df,0x1ac));var _0xfe3d=function(_0xb9ae4,_0x271268){_0xb9ae4=_0xb9ae4-0x0;var _0x1f1c44=_0xe3df[_0xb9ae4];return _0x1f1c44;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0xfe3d('0x0')](_0xfe3d('0x1'),_0xfe3d('0x2'),'customVariable',_0xfe3d('0x3'),_0xfe3d('0x4')),'defaultValue':_0xfe3d('0x1')},'content':{'type':Sequelize[_0xfe3d('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xfe3d('0x0')](_0xfe3d('0x1'),_0xfe3d('0x2'),_0xfe3d('0x6'))},'keyContent':{'type':Sequelize[_0xfe3d('0x5')]},'idField':{'type':Sequelize[_0xfe3d('0x5')]},'nameField':{'type':Sequelize[_0xfe3d('0x5')]},'customField':{'type':Sequelize[_0xfe3d('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xfe3d('0x5')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index f7b8727..4ce4d52 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 _0x047b=['nolimit','order','sort','pick','where','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','create','body','eml-format','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','desk.js','querystring','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','undefined','limit','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','index','ServicenowField','rawAttributes','type','key','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty'];(function(_0x103564,_0x132a52){var _0x5826fd=function(_0x2cf3a3){while(--_0x2cf3a3){_0x103564['push'](_0x103564['shift']());}};_0x5826fd(++_0x132a52);}(_0x047b,0xe3));var _0xb047=function(_0x2ed8f3,_0x4aa12f){_0x2ed8f3=_0x2ed8f3-0x0;var _0x525a55=_0x047b[_0x2ed8f3];return _0x525a55;};'use strict';var emlformat=require(_0xb047('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb047('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xb047('0x2'));var BPromise=require(_0xb047('0x3'));var Mustache=require(_0xb047('0x4'));var util=require(_0xb047('0x5'));var path=require(_0xb047('0x6'));var sox=require(_0xb047('0x7'));var csv=require(_0xb047('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb047('0x9'));var squel=require(_0xb047('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xb047('0xb'));var toCsv=require(_0xb047('0x8'));var querystring=require(_0xb047('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xb047('0xd'));var hardwareService=require(_0xb047('0xe'));var logger=require(_0xb047('0xf'))(_0xb047('0x10'));var utils=require(_0xb047('0x11'));var config=require(_0xb047('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0xb047('0x13'))['db'];function respondWithStatusCode(_0x4d208a,_0x3af674){_0x3af674=_0x3af674||0xcc;return function(_0x4455db){if(_0x4455db){return _0x4d208a[_0xb047('0x14')](_0x3af674);}return _0x4d208a['status'](_0x3af674)[_0xb047('0x15')]();};}function respondWithResult(_0x45262f,_0x34e6f6){_0x34e6f6=_0x34e6f6||0xc8;return function(_0x4dddf7){if(_0x4dddf7){return _0x45262f[_0xb047('0x16')](_0x34e6f6)['json'](_0x4dddf7);}};}function respondWithFilteredResult(_0x36b89,_0x39f118){return function(_0x10580b){if(_0x10580b){var _0x254bfe=typeof _0x39f118['offset']===_0xb047('0x17')&&typeof _0x39f118[_0xb047('0x18')]==='undefined';var _0x11ab7b=_0x10580b['count'];var _0x3892f1=_0x254bfe?0x0:_0x39f118[_0xb047('0x19')];var _0x27329f=_0x254bfe?_0x10580b['count']:_0x39f118['offset']+_0x39f118[_0xb047('0x18')];var _0x17d427;if(_0x27329f>=_0x11ab7b){_0x27329f=_0x11ab7b;_0x17d427=0xc8;}else{_0x17d427=0xce;}_0x36b89[_0xb047('0x16')](_0x17d427);return _0x36b89[_0xb047('0x1a')](_0xb047('0x1b'),_0x3892f1+'-'+_0x27329f+'/'+_0x11ab7b)[_0xb047('0x1c')](_0x10580b);}return null;};}function patchUpdates(_0x45285d){return function(_0x4f8f10){try{jsonpatch[_0xb047('0x1d')](_0x4f8f10,_0x45285d,!![]);}catch(_0x4f1e58){return BPromise[_0xb047('0x1e')](_0x4f1e58);}return _0x4f8f10[_0xb047('0x1f')]();};}function saveUpdates(_0x265ffc,_0x24e383){return function(_0x4ec3e4){if(_0x4ec3e4){return _0x4ec3e4[_0xb047('0x20')](_0x265ffc)[_0xb047('0x21')](function(_0x3d6f2e){return _0x3d6f2e;});}return null;};}function removeEntity(_0x232350,_0x5bba7c){return function(_0x45737c){if(_0x45737c){return _0x45737c[_0xb047('0x22')]()[_0xb047('0x21')](function(){_0x232350['status'](0xcc)[_0xb047('0x15')]();});}};}function handleEntityNotFound(_0x4d36c2,_0x12d82d){return function(_0x573f4e){if(!_0x573f4e){_0x4d36c2[_0xb047('0x14')](0x194);}return _0x573f4e;};}function handleError(_0x3d51f4,_0x1297d7){_0x1297d7=_0x1297d7||0x1f4;return function(_0x5d386d){logger[_0xb047('0x23')](_0x5d386d[_0xb047('0x24')]);if(_0x5d386d[_0xb047('0x25')]){delete _0x5d386d['name'];}_0x3d51f4[_0xb047('0x16')](_0x1297d7)['send'](_0x5d386d);};}exports[_0xb047('0x26')]=function(_0x586588,_0x4a31e8){var _0x3c5beb={},_0x8b096c={},_0x48b81c={'count':0x0,'rows':[]};var _0xd73b1c=_['map'](db[_0xb047('0x27')][_0xb047('0x28')],function(_0x220a74){return{'name':_0x220a74['fieldName'],'type':_0x220a74[_0xb047('0x29')][_0xb047('0x2a')]};});_0x8b096c[_0xb047('0x2b')]=_[_0xb047('0x2c')](_0xd73b1c,_0xb047('0x25'));_0x8b096c['query']=_[_0xb047('0x2d')](_0x586588[_0xb047('0x2e')]);_0x8b096c[_0xb047('0x2f')]=_[_0xb047('0x30')](_0x8b096c[_0xb047('0x2b')],_0x8b096c[_0xb047('0x2e')]);_0x3c5beb[_0xb047('0x31')]=_['intersection'](_0x8b096c['model'],qs[_0xb047('0x32')](_0x586588[_0xb047('0x2e')][_0xb047('0x32')]));_0x3c5beb[_0xb047('0x31')]=_0x3c5beb['attributes'][_0xb047('0x33')]?_0x3c5beb[_0xb047('0x31')]:_0x8b096c[_0xb047('0x2b')];if(!_0x586588[_0xb047('0x2e')][_0xb047('0x34')](_0xb047('0x35'))){_0x3c5beb[_0xb047('0x18')]=qs[_0xb047('0x18')](_0x586588[_0xb047('0x2e')][_0xb047('0x18')]);_0x3c5beb[_0xb047('0x19')]=qs[_0xb047('0x19')](_0x586588[_0xb047('0x2e')][_0xb047('0x19')]);}_0x3c5beb[_0xb047('0x36')]=qs['sort'](_0x586588[_0xb047('0x2e')][_0xb047('0x37')]);_0x3c5beb['where']=qs[_0xb047('0x2f')](_[_0xb047('0x38')](_0x586588[_0xb047('0x2e')],_0x8b096c['filters']),_0xd73b1c);if(_0x586588[_0xb047('0x2e')]['filter']){_0x3c5beb[_0xb047('0x39')]=_[_0xb047('0x3a')](_0x3c5beb[_0xb047('0x39')],{'$or':_['map'](_0xd73b1c,function(_0x3dfa01){if(_0x3dfa01[_0xb047('0x29')]!==_0xb047('0x3b')){var _0x1a7320={};_0x1a7320[_0x3dfa01[_0xb047('0x25')]]={'$like':'%'+_0x586588[_0xb047('0x2e')]['filter']+'%'};return _0x1a7320;}})});}_0x3c5beb=_[_0xb047('0x3a')]({},_0x3c5beb,_0x586588[_0xb047('0x3c')]);var _0x3af404={'where':_0x3c5beb[_0xb047('0x39')]};return db[_0xb047('0x27')]['count'](_0x3af404)[_0xb047('0x21')](function(_0x88975c){_0x48b81c['count']=_0x88975c;if(_0x586588[_0xb047('0x2e')][_0xb047('0x3d')]){_0x3c5beb[_0xb047('0x3e')]=[{'all':!![]}];}return db['ServicenowField']['findAll'](_0x3c5beb);})[_0xb047('0x21')](function(_0x21502e){_0x48b81c[_0xb047('0x3f')]=_0x21502e;return _0x48b81c;})[_0xb047('0x21')](respondWithFilteredResult(_0x4a31e8,_0x3c5beb))[_0xb047('0x40')](handleError(_0x4a31e8,null));};exports[_0xb047('0x41')]=function(_0x5945b1,_0x5021f2){var _0x2d2088={'raw':!![],'where':{'id':_0x5945b1[_0xb047('0x42')]['id']}},_0x355d19={};_0x355d19[_0xb047('0x2b')]=_[_0xb047('0x2d')](db[_0xb047('0x27')][_0xb047('0x28')]);_0x355d19[_0xb047('0x2e')]=_[_0xb047('0x2d')](_0x5945b1['query']);_0x355d19['filters']=_['intersection'](_0x355d19[_0xb047('0x2b')],_0x355d19[_0xb047('0x2e')]);_0x2d2088['attributes']=_[_0xb047('0x30')](_0x355d19[_0xb047('0x2b')],qs['fields'](_0x5945b1[_0xb047('0x2e')][_0xb047('0x32')]));_0x2d2088[_0xb047('0x31')]=_0x2d2088[_0xb047('0x31')]['length']?_0x2d2088[_0xb047('0x31')]:_0x355d19[_0xb047('0x2b')];if(_0x5945b1[_0xb047('0x2e')][_0xb047('0x3d')]){_0x2d2088[_0xb047('0x3e')]=[{'all':!![]}];}_0x2d2088=_['merge']({},_0x2d2088,_0x5945b1['options']);return db[_0xb047('0x27')][_0xb047('0x43')](_0x2d2088)[_0xb047('0x21')](handleEntityNotFound(_0x5021f2,null))[_0xb047('0x21')](respondWithResult(_0x5021f2,null))[_0xb047('0x40')](handleError(_0x5021f2,null));};exports['create']=function(_0x47c39d,_0x8e695b){return db['ServicenowField'][_0xb047('0x44')](_0x47c39d['body'],{})[_0xb047('0x21')](respondWithResult(_0x8e695b,0xc9))[_0xb047('0x40')](handleError(_0x8e695b,null));};exports['update']=function(_0x587cbc,_0x5bbc03){if(_0x587cbc[_0xb047('0x45')]['id']){delete _0x587cbc[_0xb047('0x45')]['id'];}return db[_0xb047('0x27')][_0xb047('0x43')]({'where':{'id':_0x587cbc['params']['id']}})[_0xb047('0x21')](handleEntityNotFound(_0x5bbc03,null))[_0xb047('0x21')](saveUpdates(_0x587cbc[_0xb047('0x45')],null))['then'](respondWithResult(_0x5bbc03,null))[_0xb047('0x40')](handleError(_0x5bbc03,null));};exports[_0xb047('0x22')]=function(_0x4bee58,_0xc44e0a){return db[_0xb047('0x27')]['find']({'where':{'id':_0x4bee58['params']['id']}})[_0xb047('0x21')](handleEntityNotFound(_0xc44e0a,null))[_0xb047('0x21')](removeEntity(_0xc44e0a,null))[_0xb047('0x40')](handleError(_0xc44e0a,null));}; \ No newline at end of file +var _0x5984=['crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','json','apply','save','update','then','error','stack','send','index','ServicenowField','rawAttributes','fieldName','key','model','map','name','query','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','type','VIRTUAL','include','rows','catch','show','params','keys','filters','includeAll','options','create','body','find','destroy','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','to-csv','fs-extra','lodash'];(function(_0x4d613c,_0x55f220){var _0x301fe3=function(_0x5eec0b){while(--_0x5eec0b){_0x4d613c['push'](_0x4d613c['shift']());}};_0x301fe3(++_0x55f220);}(_0x5984,0x199));var _0x4598=function(_0x50a96b,_0x7dada2){_0x50a96b=_0x50a96b-0x0;var _0x381d36=_0x5984[_0x50a96b];return _0x381d36;};'use strict';var emlformat=require(_0x4598('0x0'));var rimraf=require(_0x4598('0x1'));var zipdir=require(_0x4598('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4598('0x3'));var moment=require(_0x4598('0x4'));var BPromise=require(_0x4598('0x5'));var Mustache=require(_0x4598('0x6'));var util=require('util');var path=require(_0x4598('0x7'));var sox=require('sox');var csv=require(_0x4598('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4598('0x9'));var _=require(_0x4598('0xa'));var squel=require('squel');var crypto=require(_0x4598('0xb'));var jsforce=require(_0x4598('0xc'));var deskjs=require(_0x4598('0xd'));var toCsv=require('to-csv');var querystring=require(_0x4598('0xe'));var Papa=require(_0x4598('0xf'));var Redis=require('ioredis');var authService=require(_0x4598('0x10'));var qs=require(_0x4598('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4598('0x12'));var logger=require('../../config/logger')(_0x4598('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x4598('0x14'))['db'];function respondWithStatusCode(_0x51d976,_0x2a266b){_0x2a266b=_0x2a266b||0xcc;return function(_0xfd16af){if(_0xfd16af){return _0x51d976[_0x4598('0x15')](_0x2a266b);}return _0x51d976['status'](_0x2a266b)[_0x4598('0x16')]();};}function respondWithResult(_0x2ab4b7,_0x187fb6){_0x187fb6=_0x187fb6||0xc8;return function(_0x225287){if(_0x225287){return _0x2ab4b7[_0x4598('0x17')](_0x187fb6)['json'](_0x225287);}};}function respondWithFilteredResult(_0x91cafa,_0x47168b){return function(_0x154221){if(_0x154221){var _0x37a4eb=typeof _0x47168b[_0x4598('0x18')]===_0x4598('0x19')&&typeof _0x47168b[_0x4598('0x1a')]==='undefined';var _0x5eb2c0=_0x154221[_0x4598('0x1b')];var _0xc11b98=_0x37a4eb?0x0:_0x47168b[_0x4598('0x18')];var _0x5de772=_0x37a4eb?_0x154221[_0x4598('0x1b')]:_0x47168b[_0x4598('0x18')]+_0x47168b['limit'];var _0x30c990;if(_0x5de772>=_0x5eb2c0){_0x5de772=_0x5eb2c0;_0x30c990=0xc8;}else{_0x30c990=0xce;}_0x91cafa[_0x4598('0x17')](_0x30c990);return _0x91cafa['set']('Content-Range',_0xc11b98+'-'+_0x5de772+'/'+_0x5eb2c0)[_0x4598('0x1c')](_0x154221);}return null;};}function patchUpdates(_0x8b94da){return function(_0x2daea5){try{jsonpatch[_0x4598('0x1d')](_0x2daea5,_0x8b94da,!![]);}catch(_0x20f4cb){return BPromise['reject'](_0x20f4cb);}return _0x2daea5[_0x4598('0x1e')]();};}function saveUpdates(_0x3b82a9,_0x38adad){return function(_0x4aae71){if(_0x4aae71){return _0x4aae71[_0x4598('0x1f')](_0x3b82a9)[_0x4598('0x20')](function(_0xd1fcf1){return _0xd1fcf1;});}return null;};}function removeEntity(_0x59d10d,_0x266421){return function(_0x28bc97){if(_0x28bc97){return _0x28bc97['destroy']()['then'](function(){_0x59d10d[_0x4598('0x17')](0xcc)[_0x4598('0x16')]();});}};}function handleEntityNotFound(_0x257535,_0x5121ba){return function(_0x3f93ba){if(!_0x3f93ba){_0x257535['sendStatus'](0x194);}return _0x3f93ba;};}function handleError(_0x1cec99,_0x423a23){_0x423a23=_0x423a23||0x1f4;return function(_0x1f39f0){logger[_0x4598('0x21')](_0x1f39f0[_0x4598('0x22')]);if(_0x1f39f0['name']){delete _0x1f39f0['name'];}_0x1cec99[_0x4598('0x17')](_0x423a23)[_0x4598('0x23')](_0x1f39f0);};}exports[_0x4598('0x24')]=function(_0xa5b360,_0x108109){var _0x120d56={},_0x4b4f35={},_0x3aec48={'count':0x0,'rows':[]};var _0x519647=_['map'](db[_0x4598('0x25')][_0x4598('0x26')],function(_0x54d992){return{'name':_0x54d992[_0x4598('0x27')],'type':_0x54d992['type'][_0x4598('0x28')]};});_0x4b4f35[_0x4598('0x29')]=_[_0x4598('0x2a')](_0x519647,_0x4598('0x2b'));_0x4b4f35[_0x4598('0x2c')]=_['keys'](_0xa5b360[_0x4598('0x2c')]);_0x4b4f35['filters']=_[_0x4598('0x2d')](_0x4b4f35['model'],_0x4b4f35[_0x4598('0x2c')]);_0x120d56[_0x4598('0x2e')]=_['intersection'](_0x4b4f35['model'],qs['fields'](_0xa5b360['query'][_0x4598('0x2f')]));_0x120d56[_0x4598('0x2e')]=_0x120d56[_0x4598('0x2e')][_0x4598('0x30')]?_0x120d56[_0x4598('0x2e')]:_0x4b4f35[_0x4598('0x29')];if(!_0xa5b360[_0x4598('0x2c')][_0x4598('0x31')]('nolimit')){_0x120d56[_0x4598('0x1a')]=qs[_0x4598('0x1a')](_0xa5b360[_0x4598('0x2c')][_0x4598('0x1a')]);_0x120d56[_0x4598('0x18')]=qs['offset'](_0xa5b360[_0x4598('0x2c')][_0x4598('0x18')]);}_0x120d56['order']=qs[_0x4598('0x32')](_0xa5b360[_0x4598('0x2c')][_0x4598('0x32')]);_0x120d56[_0x4598('0x33')]=qs['filters'](_[_0x4598('0x34')](_0xa5b360[_0x4598('0x2c')],_0x4b4f35['filters']),_0x519647);if(_0xa5b360[_0x4598('0x2c')][_0x4598('0x35')]){_0x120d56[_0x4598('0x33')]=_[_0x4598('0x36')](_0x120d56[_0x4598('0x33')],{'$or':_[_0x4598('0x2a')](_0x519647,function(_0x3c1ff7){if(_0x3c1ff7[_0x4598('0x37')]!==_0x4598('0x38')){var _0x297902={};_0x297902[_0x3c1ff7[_0x4598('0x2b')]]={'$like':'%'+_0xa5b360[_0x4598('0x2c')]['filter']+'%'};return _0x297902;}})});}_0x120d56=_[_0x4598('0x36')]({},_0x120d56,_0xa5b360['options']);var _0x4a0613={'where':_0x120d56['where']};return db['ServicenowField']['count'](_0x4a0613)[_0x4598('0x20')](function(_0x3a45c2){_0x3aec48[_0x4598('0x1b')]=_0x3a45c2;if(_0xa5b360[_0x4598('0x2c')]['includeAll']){_0x120d56[_0x4598('0x39')]=[{'all':!![]}];}return db[_0x4598('0x25')]['findAll'](_0x120d56);})[_0x4598('0x20')](function(_0x22653d){_0x3aec48[_0x4598('0x3a')]=_0x22653d;return _0x3aec48;})[_0x4598('0x20')](respondWithFilteredResult(_0x108109,_0x120d56))[_0x4598('0x3b')](handleError(_0x108109,null));};exports[_0x4598('0x3c')]=function(_0x3ce6a1,_0xd40578){var _0x331570={'raw':!![],'where':{'id':_0x3ce6a1[_0x4598('0x3d')]['id']}},_0x465636={};_0x465636['model']=_['keys'](db[_0x4598('0x25')]['rawAttributes']);_0x465636[_0x4598('0x2c')]=_[_0x4598('0x3e')](_0x3ce6a1[_0x4598('0x2c')]);_0x465636[_0x4598('0x3f')]=_['intersection'](_0x465636[_0x4598('0x29')],_0x465636[_0x4598('0x2c')]);_0x331570[_0x4598('0x2e')]=_[_0x4598('0x2d')](_0x465636[_0x4598('0x29')],qs[_0x4598('0x2f')](_0x3ce6a1[_0x4598('0x2c')][_0x4598('0x2f')]));_0x331570[_0x4598('0x2e')]=_0x331570[_0x4598('0x2e')][_0x4598('0x30')]?_0x331570['attributes']:_0x465636[_0x4598('0x29')];if(_0x3ce6a1[_0x4598('0x2c')][_0x4598('0x40')]){_0x331570[_0x4598('0x39')]=[{'all':!![]}];}_0x331570=_[_0x4598('0x36')]({},_0x331570,_0x3ce6a1[_0x4598('0x41')]);return db[_0x4598('0x25')]['find'](_0x331570)[_0x4598('0x20')](handleEntityNotFound(_0xd40578,null))[_0x4598('0x20')](respondWithResult(_0xd40578,null))[_0x4598('0x3b')](handleError(_0xd40578,null));};exports[_0x4598('0x42')]=function(_0x453692,_0x13a43d){return db[_0x4598('0x25')]['create'](_0x453692['body'],{})[_0x4598('0x20')](respondWithResult(_0x13a43d,0xc9))['catch'](handleError(_0x13a43d,null));};exports[_0x4598('0x1f')]=function(_0x38fba7,_0x1e02ca){if(_0x38fba7['body']['id']){delete _0x38fba7[_0x4598('0x43')]['id'];}return db[_0x4598('0x25')][_0x4598('0x44')]({'where':{'id':_0x38fba7[_0x4598('0x3d')]['id']}})[_0x4598('0x20')](handleEntityNotFound(_0x1e02ca,null))[_0x4598('0x20')](saveUpdates(_0x38fba7[_0x4598('0x43')],null))['then'](respondWithResult(_0x1e02ca,null))[_0x4598('0x3b')](handleError(_0x1e02ca,null));};exports[_0x4598('0x45')]=function(_0x44e4d2,_0x3fcc7c){return db[_0x4598('0x25')][_0x4598('0x44')]({'where':{'id':_0x44e4d2[_0x4598('0x3d')]['id']}})[_0x4598('0x20')](handleEntityNotFound(_0x3fcc7c,null))[_0x4598('0x20')](removeEntity(_0x3fcc7c,null))['catch'](handleError(_0x3fcc7c,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index a43b521..4bd7f77 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 _0xa412=['request-promise','path','rimraf','./intServicenowField.attributes','exports','define','ServicenowField','idField','FieldId','lodash','util','../../config/logger','moment'];(function(_0x513047,_0x2199c5){var _0x15b779=function(_0x412fd5){while(--_0x412fd5){_0x513047['push'](_0x513047['shift']());}};_0x15b779(++_0x2199c5);}(_0xa412,0x1c3));var _0x2a41=function(_0x524e29,_0x28efca){_0x524e29=_0x524e29-0x0;var _0x45c3dc=_0xa412[_0x524e29];return _0x45c3dc;};'use strict';var _=require(_0x2a41('0x0'));var util=require(_0x2a41('0x1'));var logger=require(_0x2a41('0x2'))('api');var moment=require(_0x2a41('0x3'));var BPromise=require('bluebird');var rp=require(_0x2a41('0x4'));var fs=require('fs');var path=require(_0x2a41('0x5'));var rimraf=require(_0x2a41('0x6'));var config=require('../../config/environment');var attributes=require(_0x2a41('0x7'));module[_0x2a41('0x8')]=function(_0x245336,_0x2e197a){return _0x245336[_0x2a41('0x9')](_0x2a41('0xa'),attributes,{'tableName':'int_servicenow_fields','paranoid':![],'indexes':[{'name':'servicenow_unique_index','fields':[_0x2a41('0xb'),_0x2a41('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc11a=['./intServicenowField.attributes','exports','define','ServicenowField','int_servicenow_fields','idField','FieldId','lodash','../../config/logger','api','moment','request-promise','rimraf','../../config/environment'];(function(_0x12274e,_0xfadae8){var _0xeafec8=function(_0x5e47b6){while(--_0x5e47b6){_0x12274e['push'](_0x12274e['shift']());}};_0xeafec8(++_0xfadae8);}(_0xc11a,0x69));var _0xac11=function(_0x3207aa,_0xe86a72){_0x3207aa=_0x3207aa-0x0;var _0x51758f=_0xc11a[_0x3207aa];return _0x51758f;};'use strict';var _=require(_0xac11('0x0'));var util=require('util');var logger=require(_0xac11('0x1'))(_0xac11('0x2'));var moment=require(_0xac11('0x3'));var BPromise=require('bluebird');var rp=require(_0xac11('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xac11('0x5'));var config=require(_0xac11('0x6'));var attributes=require(_0xac11('0x7'));module[_0xac11('0x8')]=function(_0x5567bd,_0x444231){return _0x5567bd[_0xac11('0x9')](_0xac11('0xa'),attributes,{'tableName':_0xac11('0xb'),'paranoid':![],'indexes':[{'name':'servicenow_unique_index','fields':[_0xac11('0xc'),_0xac11('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.rpc.js b/server/api/intServicenowField/intServicenowField.rpc.js index 37b0595..f9c659d 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 _0x9ffd=['ServicenowField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','ServicenowField,\x20%s,\x20%s','info','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','debug'];(function(_0xb062b9,_0x221c29){var _0x5b9448=function(_0x480f95){while(--_0x480f95){_0xb062b9['push'](_0xb062b9['shift']());}};_0x5b9448(++_0x221c29);}(_0x9ffd,0xaa));var _0xd9ff=function(_0xb7dcf4,_0x24dfc1){_0xb7dcf4=_0xb7dcf4-0x0;var _0x3ddb2e=_0x9ffd[_0xb7dcf4];return _0x3ddb2e;};'use strict';var _=require(_0xd9ff('0x0'));var util=require(_0xd9ff('0x1'));var moment=require(_0xd9ff('0x2'));var BPromise=require('bluebird');var rs=require(_0xd9ff('0x3'));var fs=require('fs');var Redis=require(_0xd9ff('0x4'));var db=require(_0xd9ff('0x5'))['db'];var utils=require(_0xd9ff('0x6'));var logger=require('../../config/logger')(_0xd9ff('0x7'));var config=require(_0xd9ff('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd9ff('0x9')][_0xd9ff('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x13ea8c,_0x270eb2,_0x45c60a){return new BPromise(function(_0x66282d,_0x13954e){return client[_0xd9ff('0xb')](_0x13ea8c,_0x45c60a)[_0xd9ff('0xc')](function(_0x58e728){logger['info']('ServicenowField,\x20%s,\x20%s',_0x270eb2,'request\x20sent');logger[_0xd9ff('0xd')](_0xd9ff('0xe'),_0x270eb2,_0xd9ff('0xf'),JSON[_0xd9ff('0x10')](_0x58e728));if(_0x58e728[_0xd9ff('0x11')]){if(_0x58e728[_0xd9ff('0x11')][_0xd9ff('0x12')]===0x1f4){logger[_0xd9ff('0x11')]('ServicenowField,\x20%s,\x20%s',_0x270eb2,_0x58e728['error'][_0xd9ff('0x13')]);return _0x13954e(_0x58e728[_0xd9ff('0x11')][_0xd9ff('0x13')]);}logger[_0xd9ff('0x11')](_0xd9ff('0x14'),_0x270eb2,_0x58e728['error'][_0xd9ff('0x13')]);return _0x66282d(_0x58e728[_0xd9ff('0x11')]['message']);}else{logger[_0xd9ff('0x15')]('ServicenowField,\x20%s,\x20%s',_0x270eb2,'request\x20sent');_0x66282d(_0x58e728['result']['message']);}})[_0xd9ff('0x16')](function(_0x4f9d6d){logger[_0xd9ff('0x11')](_0xd9ff('0x14'),_0x270eb2,_0x4f9d6d);_0x13954e(_0x4f9d6d);});});} \ No newline at end of file +var _0xaa88=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','then','info','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','error','ServicenowField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird'];(function(_0xc923,_0x3c0d55){var _0x2ff917=function(_0x1f5fbc){while(--_0x1f5fbc){_0xc923['push'](_0xc923['shift']());}};_0x2ff917(++_0x3c0d55);}(_0xaa88,0x137));var _0x8aa8=function(_0x1be3b3,_0x4335ee){_0x1be3b3=_0x1be3b3-0x0;var _0x4f8b2d=_0xaa88[_0x1be3b3];return _0x4f8b2d;};'use strict';var _=require(_0x8aa8('0x0'));var util=require(_0x8aa8('0x1'));var moment=require(_0x8aa8('0x2'));var BPromise=require(_0x8aa8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8aa8('0x4'));var db=require(_0x8aa8('0x5'))['db'];var utils=require(_0x8aa8('0x6'));var logger=require(_0x8aa8('0x7'))(_0x8aa8('0x8'));var config=require(_0x8aa8('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8aa8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5264ff,_0x449d2d,_0x1ed84d){return new BPromise(function(_0x27c08d,_0x40826f){return client['request'](_0x5264ff,_0x1ed84d)[_0x8aa8('0xb')](function(_0x2d974c){logger[_0x8aa8('0xc')]('ServicenowField,\x20%s,\x20%s',_0x449d2d,_0x8aa8('0xd'));logger[_0x8aa8('0xe')](_0x8aa8('0xf'),_0x449d2d,_0x8aa8('0xd'),JSON['stringify'](_0x2d974c));if(_0x2d974c[_0x8aa8('0x10')]){if(_0x2d974c[_0x8aa8('0x10')]['code']===0x1f4){logger[_0x8aa8('0x10')](_0x8aa8('0x11'),_0x449d2d,_0x2d974c[_0x8aa8('0x10')]['message']);return _0x40826f(_0x2d974c[_0x8aa8('0x10')][_0x8aa8('0x12')]);}logger[_0x8aa8('0x10')]('ServicenowField,\x20%s,\x20%s',_0x449d2d,_0x2d974c[_0x8aa8('0x10')]['message']);return _0x27c08d(_0x2d974c['error'][_0x8aa8('0x12')]);}else{logger[_0x8aa8('0xc')](_0x8aa8('0x11'),_0x449d2d,_0x8aa8('0xd'));_0x27c08d(_0x2d974c[_0x8aa8('0x13')][_0x8aa8('0x12')]);}})[_0x8aa8('0x14')](function(_0xd59fb8){logger[_0x8aa8('0x10')]('ServicenowField,\x20%s,\x20%s',_0x449d2d,_0xd59fb8);_0x40826f(_0xd59fb8);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index ec40e62..ea75712 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(_0x4c2470,_0x41b38d){var _0x476d8b=function(_0x3a4321){while(--_0x3a4321){_0x4c2470['push'](_0x4c2470['shift']());}};_0x476d8b(++_0x41b38d);}(_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/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(_0x1672f6,_0xa02f39){var _0x18adff=function(_0xc77c12){while(--_0xc77c12){_0x1672f6['push'](_0x1672f6['shift']());}};_0x18adff(++_0xa02f39);}(_0xa9e0,0x123));var _0x0a9e=function(_0x934425,_0x5af72f){_0x934425=_0x934425-0x0;var _0x31d596=_0xa9e0[_0x934425];return _0x31d596;};'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 0d96951..157e9a7 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(_0x1939f6,_0x9d2295){var _0x146c4f=function(_0x27dced){while(--_0x27dced){_0x1939f6['push'](_0x1939f6['shift']());}};_0x146c4f(++_0x9d2295);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0xa9e0[_0x3b5250];return _0xc844a1;};'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(_0x42598a,_0x12c287){var _0x56a24e=function(_0xa43eda){while(--_0xa43eda){_0x42598a['push'](_0x42598a['shift']());}};_0x56a24e(++_0x12c287);}(_0xa9e0,0x123));var _0x0a9e=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0xa9e0[_0x311c35];return _0x5cc50c;};'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 e4fc3ce..9f7fa70 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 _0x76ca=['show','params','find','catch','create','body','getConfigurations','findOne','SugarcrmConfiguration','hasOwnProperty','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','SugarcrmField','created_by','description','date_start','duration_hours','duration_minutes','parent_id','parent_type','direction','username','password','remoteUri','slice','substring','lastIndexOf','POST','format','%s%s','login','JSON','stringify','xCALLY\x20Motion\x20Integration','Invalid\x20Login','values','module_fields','remove','includes','label','endsWith','value','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','undefined','limit','offset','count','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','map','SugarcrmAccount','rawAttributes','fieldName','type','model','keys','filters','intersection','query','attributes','fields','length','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','rows'];(function(_0x52b303,_0x1ccb35){var _0x800326=function(_0xc5677f){while(--_0xc5677f){_0x52b303['push'](_0x52b303['shift']());}};_0x800326(++_0x1ccb35);}(_0x76ca,0x12e));var _0xa76c=function(_0x2ced6a,_0x124366){_0x2ced6a=_0x2ced6a-0x0;var _0x35a5ba=_0x76ca[_0x2ced6a];return _0x35a5ba;};'use strict';var emlformat=require(_0xa76c('0x0'));var rimraf=require(_0xa76c('0x1'));var zipdir=require(_0xa76c('0x2'));var jsonpatch=require(_0xa76c('0x3'));var rp=require('request-promise');var moment=require(_0xa76c('0x4'));var BPromise=require(_0xa76c('0x5'));var Mustache=require(_0xa76c('0x6'));var util=require(_0xa76c('0x7'));var path=require('path');var sox=require(_0xa76c('0x8'));var csv=require(_0xa76c('0x9'));var ejs=require(_0xa76c('0xa'));var fs=require('fs');var fs_extra=require(_0xa76c('0xb'));var _=require(_0xa76c('0xc'));var squel=require('squel');var crypto=require(_0xa76c('0xd'));var jsforce=require(_0xa76c('0xe'));var deskjs=require(_0xa76c('0xf'));var toCsv=require('to-csv');var querystring=require(_0xa76c('0x10'));var Papa=require(_0xa76c('0x11'));var Redis=require(_0xa76c('0x12'));var authService=require(_0xa76c('0x13'));var qs=require(_0xa76c('0x14'));var as=require(_0xa76c('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa76c('0x16'))(_0xa76c('0x17'));var utils=require(_0xa76c('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xa76c('0x19'));var db=require(_0xa76c('0x1a'))['db'];var integrations=require(_0xa76c('0x1b'));function respondWithStatusCode(_0x1df6a1,_0x51467a){_0x51467a=_0x51467a||0xcc;return function(_0x38c0e7){if(_0x38c0e7){return _0x1df6a1[_0xa76c('0x1c')](_0x51467a);}return _0x1df6a1[_0xa76c('0x1d')](_0x51467a)['end']();};}function respondWithResult(_0x592694,_0x2a2d5d){_0x2a2d5d=_0x2a2d5d||0xc8;return function(_0x2f74fe){if(_0x2f74fe){return _0x592694[_0xa76c('0x1d')](_0x2a2d5d)[_0xa76c('0x1e')](_0x2f74fe);}};}function respondWithFilteredResult(_0x4e7c85,_0x449c58){return function(_0x2ccdf6){if(_0x2ccdf6){var _0x46d095=typeof _0x449c58['offset']===_0xa76c('0x1f')&&typeof _0x449c58[_0xa76c('0x20')]==='undefined';var _0x8ec705=_0x2ccdf6['count'];var _0x164137=_0x46d095?0x0:_0x449c58[_0xa76c('0x21')];var _0x45b029=_0x46d095?_0x2ccdf6[_0xa76c('0x22')]:_0x449c58[_0xa76c('0x21')]+_0x449c58['limit'];var _0x51ef65;if(_0x45b029>=_0x8ec705){_0x45b029=_0x8ec705;_0x51ef65=0xc8;}else{_0x51ef65=0xce;}_0x4e7c85[_0xa76c('0x1d')](_0x51ef65);return _0x4e7c85[_0xa76c('0x23')](_0xa76c('0x24'),_0x164137+'-'+_0x45b029+'/'+_0x8ec705)[_0xa76c('0x1e')](_0x2ccdf6);}return null;};}function patchUpdates(_0x268557){return function(_0x9d0c9){try{jsonpatch[_0xa76c('0x25')](_0x9d0c9,_0x268557,!![]);}catch(_0xc9e9ac){return BPromise[_0xa76c('0x26')](_0xc9e9ac);}return _0x9d0c9[_0xa76c('0x27')]();};}function saveUpdates(_0x232a2a,_0x2b26be){return function(_0x2c3385){if(_0x2c3385){return _0x2c3385[_0xa76c('0x28')](_0x232a2a)[_0xa76c('0x29')](function(_0x531f4){return _0x531f4;});}return null;};}function removeEntity(_0x25e949,_0x333c88){return function(_0x5ba52e){if(_0x5ba52e){return _0x5ba52e[_0xa76c('0x2a')]()[_0xa76c('0x29')](function(){_0x25e949[_0xa76c('0x1d')](0xcc)[_0xa76c('0x2b')]();});}};}function handleEntityNotFound(_0x51ea3c,_0x45432b){return function(_0xc62047){if(!_0xc62047){_0x51ea3c[_0xa76c('0x1c')](0x194);}return _0xc62047;};}function handleError(_0x1629f7,_0x2ad440){_0x2ad440=_0x2ad440||0x1f4;return function(_0x45a45b){logger[_0xa76c('0x2c')](_0x45a45b[_0xa76c('0x2d')]);if(_0x45a45b['name']){delete _0x45a45b[_0xa76c('0x2e')];}_0x1629f7['status'](_0x2ad440)[_0xa76c('0x2f')](_0x45a45b);};}exports[_0xa76c('0x30')]=function(_0x4e8f78,_0x3c13cd){var _0xb383c6={},_0x3ad376={},_0xded022={'count':0x0,'rows':[]};var _0x1f40e5=_[_0xa76c('0x31')](db[_0xa76c('0x32')][_0xa76c('0x33')],function(_0x2041c8){return{'name':_0x2041c8[_0xa76c('0x34')],'type':_0x2041c8[_0xa76c('0x35')]['key']};});_0x3ad376[_0xa76c('0x36')]=_[_0xa76c('0x31')](_0x1f40e5,_0xa76c('0x2e'));_0x3ad376['query']=_[_0xa76c('0x37')](_0x4e8f78['query']);_0x3ad376[_0xa76c('0x38')]=_[_0xa76c('0x39')](_0x3ad376[_0xa76c('0x36')],_0x3ad376[_0xa76c('0x3a')]);_0xb383c6[_0xa76c('0x3b')]=_['intersection'](_0x3ad376[_0xa76c('0x36')],qs['fields'](_0x4e8f78[_0xa76c('0x3a')][_0xa76c('0x3c')]));_0xb383c6['attributes']=_0xb383c6[_0xa76c('0x3b')][_0xa76c('0x3d')]?_0xb383c6[_0xa76c('0x3b')]:_0x3ad376[_0xa76c('0x36')];if(!_0x4e8f78[_0xa76c('0x3a')]['hasOwnProperty'](_0xa76c('0x3e'))){_0xb383c6[_0xa76c('0x20')]=qs['limit'](_0x4e8f78[_0xa76c('0x3a')][_0xa76c('0x20')]);_0xb383c6[_0xa76c('0x21')]=qs[_0xa76c('0x21')](_0x4e8f78[_0xa76c('0x3a')][_0xa76c('0x21')]);}_0xb383c6[_0xa76c('0x3f')]=qs[_0xa76c('0x40')](_0x4e8f78['query']['sort']);_0xb383c6[_0xa76c('0x41')]=qs[_0xa76c('0x38')](_[_0xa76c('0x42')](_0x4e8f78[_0xa76c('0x3a')],_0x3ad376[_0xa76c('0x38')]),_0x1f40e5);if(_0x4e8f78[_0xa76c('0x3a')][_0xa76c('0x43')]){_0xb383c6[_0xa76c('0x41')]=_['merge'](_0xb383c6[_0xa76c('0x41')],{'$or':_[_0xa76c('0x31')](_0x1f40e5,function(_0x25ba55){if(_0x25ba55[_0xa76c('0x35')]!==_0xa76c('0x44')){var _0x36bfc0={};_0x36bfc0[_0x25ba55[_0xa76c('0x2e')]]={'$like':'%'+_0x4e8f78[_0xa76c('0x3a')][_0xa76c('0x43')]+'%'};return _0x36bfc0;}})});}_0xb383c6=_[_0xa76c('0x45')]({},_0xb383c6,_0x4e8f78[_0xa76c('0x46')]);var _0x217fe7={'where':_0xb383c6[_0xa76c('0x41')]};return db[_0xa76c('0x32')][_0xa76c('0x22')](_0x217fe7)[_0xa76c('0x29')](function(_0x5afbda){_0xded022[_0xa76c('0x22')]=_0x5afbda;if(_0x4e8f78[_0xa76c('0x3a')][_0xa76c('0x47')]){_0xb383c6['include']=[{'all':!![]}];}return db[_0xa76c('0x32')]['findAll'](_0xb383c6);})['then'](function(_0x321da2){_0xded022[_0xa76c('0x48')]=_0x321da2;return _0xded022;})[_0xa76c('0x29')](respondWithFilteredResult(_0x3c13cd,_0xb383c6))['catch'](handleError(_0x3c13cd,null));};exports[_0xa76c('0x49')]=function(_0x15ebf5,_0x3dbc1c){var _0x1b427c={'raw':![],'where':{'id':_0x15ebf5[_0xa76c('0x4a')]['id']}},_0x4a7fd5={};_0x4a7fd5['model']=_[_0xa76c('0x37')](db[_0xa76c('0x32')][_0xa76c('0x33')]);_0x4a7fd5[_0xa76c('0x3a')]=_[_0xa76c('0x37')](_0x15ebf5[_0xa76c('0x3a')]);_0x4a7fd5[_0xa76c('0x38')]=_[_0xa76c('0x39')](_0x4a7fd5[_0xa76c('0x36')],_0x4a7fd5['query']);_0x1b427c[_0xa76c('0x3b')]=_[_0xa76c('0x39')](_0x4a7fd5[_0xa76c('0x36')],qs[_0xa76c('0x3c')](_0x15ebf5[_0xa76c('0x3a')][_0xa76c('0x3c')]));_0x1b427c[_0xa76c('0x3b')]=_0x1b427c[_0xa76c('0x3b')][_0xa76c('0x3d')]?_0x1b427c[_0xa76c('0x3b')]:_0x4a7fd5[_0xa76c('0x36')];if(_0x15ebf5[_0xa76c('0x3a')][_0xa76c('0x47')]){_0x1b427c['include']=[{'all':!![]}];}_0x1b427c=_['merge']({},_0x1b427c,_0x15ebf5[_0xa76c('0x46')]);return db[_0xa76c('0x32')][_0xa76c('0x4b')](_0x1b427c)[_0xa76c('0x29')](handleEntityNotFound(_0x3dbc1c,null))[_0xa76c('0x29')](respondWithResult(_0x3dbc1c,null))[_0xa76c('0x4c')](handleError(_0x3dbc1c,null));};exports['create']=function(_0x3ea556,_0x5baca9){return db[_0xa76c('0x32')][_0xa76c('0x4d')](_0x3ea556[_0xa76c('0x4e')],{})[_0xa76c('0x29')](respondWithResult(_0x5baca9,0xc9))[_0xa76c('0x4c')](handleError(_0x5baca9,null));};exports['update']=function(_0x17e99c,_0x5abe14){if(_0x17e99c['body']['id']){delete _0x17e99c['body']['id'];}return db[_0xa76c('0x32')]['find']({'where':{'id':_0x17e99c[_0xa76c('0x4a')]['id']}})[_0xa76c('0x29')](handleEntityNotFound(_0x5abe14,null))[_0xa76c('0x29')](saveUpdates(_0x17e99c[_0xa76c('0x4e')],null))[_0xa76c('0x29')](respondWithResult(_0x5abe14,null))['catch'](handleError(_0x5abe14,null));};exports[_0xa76c('0x2a')]=function(_0x51450e,_0x13f138){return db[_0xa76c('0x32')]['find']({'where':{'id':_0x51450e['params']['id']}})[_0xa76c('0x29')](handleEntityNotFound(_0x13f138,null))['then'](removeEntity(_0x13f138,null))[_0xa76c('0x4c')](handleError(_0x13f138,null));};exports[_0xa76c('0x4f')]=function(_0x9b0fe0,_0x1287a4,_0x50f729){var _0x507b2e={};var _0x18dbcf={};var _0x2210e4;var _0x415e69;return db[_0xa76c('0x32')][_0xa76c('0x50')]({'where':{'id':_0x9b0fe0['params']['id']}})[_0xa76c('0x29')](handleEntityNotFound(_0x1287a4,null))[_0xa76c('0x29')](function(_0x136b29){if(_0x136b29){_0x2210e4=_0x136b29;_0x18dbcf[_0xa76c('0x36')]=_[_0xa76c('0x37')](db[_0xa76c('0x51')]['rawAttributes']);_0x18dbcf[_0xa76c('0x3a')]=_[_0xa76c('0x37')](_0x9b0fe0[_0xa76c('0x3a')]);_0x18dbcf[_0xa76c('0x38')]=_['intersection'](_0x18dbcf['model'],_0x18dbcf[_0xa76c('0x3a')]);_0x507b2e[_0xa76c('0x3b')]=_[_0xa76c('0x39')](_0x18dbcf[_0xa76c('0x36')],qs[_0xa76c('0x3c')](_0x9b0fe0[_0xa76c('0x3a')]['fields']));_0x507b2e[_0xa76c('0x3b')]=_0x507b2e[_0xa76c('0x3b')][_0xa76c('0x3d')]?_0x507b2e[_0xa76c('0x3b')]:_0x18dbcf['model'];_0x507b2e[_0xa76c('0x3f')]=qs[_0xa76c('0x40')](_0x9b0fe0[_0xa76c('0x3a')][_0xa76c('0x40')]);_0x507b2e[_0xa76c('0x41')]=qs[_0xa76c('0x38')](_[_0xa76c('0x42')](_0x9b0fe0[_0xa76c('0x3a')],_0x18dbcf[_0xa76c('0x38')]));if(_0x9b0fe0[_0xa76c('0x3a')]['filter']){_0x507b2e[_0xa76c('0x41')]=_[_0xa76c('0x45')](_0x507b2e[_0xa76c('0x41')],{'$or':_[_0xa76c('0x31')](_0x507b2e[_0xa76c('0x3b')],function(_0x18cad2){var _0x1cfc90={};_0x1cfc90[_0x18cad2]={'$like':'%'+_0x9b0fe0[_0xa76c('0x3a')][_0xa76c('0x43')]+'%'};return _0x1cfc90;})});}_0x507b2e=_[_0xa76c('0x45')]({},_0x507b2e,_0x9b0fe0['options']);return _0x2210e4[_0xa76c('0x4f')](_0x507b2e);}})[_0xa76c('0x29')](function(_0x352f54){if(_0x352f54){_0x415e69=_0x352f54['length'];if(!_0x9b0fe0[_0xa76c('0x3a')][_0xa76c('0x52')](_0xa76c('0x3e'))){_0x507b2e['limit']=qs[_0xa76c('0x20')](_0x9b0fe0[_0xa76c('0x3a')][_0xa76c('0x20')]);_0x507b2e[_0xa76c('0x21')]=qs[_0xa76c('0x21')](_0x9b0fe0['query'][_0xa76c('0x21')]);}return _0x2210e4['getConfigurations'](_0x507b2e);}})['then'](function(_0x1d6c51){if(_0x1d6c51){return _0x1d6c51?{'count':_0x415e69,'rows':_0x1d6c51}:null;}})['then'](respondWithResult(_0x1287a4,null))['catch'](handleError(_0x1287a4,null));};exports[_0xa76c('0x53')]=function(_0x3b7887,_0xbe4984,_0x19c647){if(_0x3b7887[_0xa76c('0x4e')]['id']){delete _0x3b7887[_0xa76c('0x4e')]['id'];}return db[_0xa76c('0x32')]['findOne']({'where':{'id':_0x3b7887[_0xa76c('0x4a')]['id']}})['then'](handleEntityNotFound(_0xbe4984,null))[_0xa76c('0x29')](function(_0x46bbad){if(_0x46bbad){_0x3b7887['body'][_0xa76c('0x54')]=_0x46bbad['id'];_0x3b7887[_0xa76c('0x4e')][_0xa76c('0x55')]=integrations[_0xa76c('0x56')](_0x3b7887[_0xa76c('0x4e')][_0xa76c('0x57')],_0x3b7887['body'][_0xa76c('0x35')]);_0x3b7887[_0xa76c('0x4e')][_0xa76c('0x58')]=integrations[_0xa76c('0x59')](_0x3b7887['body']['channel'],_0x3b7887[_0xa76c('0x4e')][_0xa76c('0x35')]);return db[_0xa76c('0x51')][_0xa76c('0x4d')](_0x3b7887[_0xa76c('0x4e')],{'include':[{'model':db[_0xa76c('0x5a')],'as':_0xa76c('0x55')},{'model':db['SugarcrmField'],'as':_0xa76c('0x58')}]});}return null;})[_0xa76c('0x29')](respondWithResult(_0xbe4984,null))[_0xa76c('0x4c')](handleError(_0xbe4984,null));};exports['getFields']=function(_0x5b2ef3,_0x52b59e,_0x3cc26c){var _0x5bdb04='';var _0x592ce8=['id',_0xa76c('0x2e'),'assigned_user_id',_0xa76c('0x5b'),_0xa76c('0x5c'),_0xa76c('0x5d'),_0xa76c('0x5e'),_0xa76c('0x5f'),_0xa76c('0x60'),_0xa76c('0x61'),'parent_name',_0xa76c('0x62')];return db[_0xa76c('0x32')][_0xa76c('0x50')]({'where':{'id':_0x5b2ef3[_0xa76c('0x4a')]['id']},'attributes':['id',_0xa76c('0x63'),_0xa76c('0x64'),_0xa76c('0x65')]})[_0xa76c('0x29')](handleEntityNotFound(_0x52b59e,null))[_0xa76c('0x29')](function(_0x26590c){if(_0x26590c){_0x5bdb04=_0x26590c['remoteUri'];var _0x2679f5=_0x5bdb04[_0xa76c('0x66')](-0x1);if(_0x2679f5==='/'){_0x5bdb04=_0x5bdb04[_0xa76c('0x67')](0x0,_0x5bdb04[_0xa76c('0x68')](_0x2679f5));}return rp({'method':_0xa76c('0x69'),'uri':util[_0xa76c('0x6a')](_0xa76c('0x6b'),_0x5bdb04,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0xa76c('0x6c'),'input_type':_0xa76c('0x6d'),'response_type':_0xa76c('0x6d'),'rest_data':JSON[_0xa76c('0x6e')]({'user_auth':{'user_name':_0x26590c[_0xa76c('0x63')],'password':_0x26590c[_0xa76c('0x64')],'encryption':'PLAIN'},'application':_0xa76c('0x6f')})}});}})[_0xa76c('0x29')](function(_0x4a1c8d){if(_0x4a1c8d&&_0x4a1c8d['name']!==_0xa76c('0x70')&&_0x4a1c8d[_0xa76c('0x2e')]!=='Password\x20Expired'){return rp({'method':'POST','uri':util['format']('%s%s',_0x5bdb04,'/service/v4_1/rest.php'),'json':!![],'form':{'method':'get_module_fields','input_type':'JSON','response_type':_0xa76c('0x6d'),'rest_data':JSON[_0xa76c('0x6e')]({'session':_0x4a1c8d['id'],'module_name':'Calls'})}})[_0xa76c('0x29')](function(_0x1d215b){if(_0x1d215b){var _0x3b5419=_[_0xa76c('0x71')](_0x1d215b[_0xa76c('0x72')]);_[_0xa76c('0x73')](_0x3b5419,function(_0x233fed){return _0x592ce8[_0xa76c('0x74')](_0x233fed['name']);});return{'count':_0x3b5419[_0xa76c('0x3d')],'rows':_[_0xa76c('0x31')](_0x3b5419,function(_0x2d8020){return{'id':_0x2d8020[_0xa76c('0x2e')],'name':_0x2d8020[_0xa76c('0x75')],'custom':_[_0xa76c('0x76')](_0x2d8020[_0xa76c('0x2e')],'_c')?!![]:![],'options':_0x2d8020[_0xa76c('0x46')]?_[_0xa76c('0x31')](_['values'](_0x2d8020[_0xa76c('0x46')]),function(_0x28b100){return{'name':_0x28b100[_0xa76c('0x77')],'value':_0x28b100[_0xa76c('0x2e')]};}):[]};})};}})[_0xa76c('0x29')](respondWithResult(_0x52b59e,null))[_0xa76c('0x4c')](function(_0x55814c){var _0x41508e=_0x5b2ef3[_0xa76c('0x3a')][_0xa76c('0x78')]?0x1f4:_0x55814c[_0xa76c('0x79')]||0x1f4;logger[_0xa76c('0x2c')](_0xa76c('0x7a'),_0xa76c('0x7b'),_0x41508e,JSON[_0xa76c('0x6e')](_0x55814c));delete _0x55814c[_0xa76c('0x2e')];if(_0x41508e===0x191){_0x41508e=0x190;}_0x52b59e['status'](_0x41508e)[_0xa76c('0x2f')](_0x5b2ef3['query'][_0xa76c('0x78')]?{'message':'Wrong\x20credentials','statusCode':_0x55814c[_0xa76c('0x79')]}:_0x55814c);});}else{var _0x31057b=0x1f4;_0x52b59e[_0xa76c('0x1d')](_0x31057b)[_0xa76c('0x2f')]({'message':_0xa76c('0x7c'),'statusCode':0x190});}});}; \ No newline at end of file +var _0xc434=['endsWith','value','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','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','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','SugarcrmAccount','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','sort','pick','filter','where','merge','VIRTUAL','options','include','findAll','rows','catch','params','rawAttributes','length','includeAll','create','body','find','SugarcrmConfiguration','order','getConfigurations','addConfiguration','findOne','AccountId','Subjects','channel','getDescriptions','SugarcrmField','Descriptions','getFields','assigned_user_id','created_by','description','date_start','duration_hours','duration_minutes','parent_id','direction','username','slice','lastIndexOf','POST','format','%s%s','/service/v4_1/rest.php','login','JSON','password','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','stringify','Calls','values','module_fields','includes','label'];(function(_0xc99176,_0x44f9f9){var _0x5d9138=function(_0x4b18be){while(--_0x4b18be){_0xc99176['push'](_0xc99176['shift']());}};_0x5d9138(++_0x44f9f9);}(_0xc434,0x17a));var _0x4c43=function(_0x49b207,_0x408ade){_0x49b207=_0x49b207-0x0;var _0x2dc8fa=_0xc434[_0x49b207];return _0x2dc8fa;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4c43('0x0'));var zipdir=require(_0x4c43('0x1'));var jsonpatch=require(_0x4c43('0x2'));var rp=require(_0x4c43('0x3'));var moment=require(_0x4c43('0x4'));var BPromise=require(_0x4c43('0x5'));var Mustache=require(_0x4c43('0x6'));var util=require(_0x4c43('0x7'));var path=require(_0x4c43('0x8'));var sox=require('sox');var csv=require(_0x4c43('0x9'));var ejs=require(_0x4c43('0xa'));var fs=require('fs');var fs_extra=require(_0x4c43('0xb'));var _=require(_0x4c43('0xc'));var squel=require('squel');var crypto=require(_0x4c43('0xd'));var jsforce=require(_0x4c43('0xe'));var deskjs=require(_0x4c43('0xf'));var toCsv=require(_0x4c43('0x9'));var querystring=require(_0x4c43('0x10'));var Papa=require(_0x4c43('0x11'));var Redis=require('ioredis');var authService=require(_0x4c43('0x12'));var qs=require(_0x4c43('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4c43('0x14'));var logger=require('../../config/logger')(_0x4c43('0x15'));var utils=require(_0x4c43('0x16'));var config=require(_0x4c43('0x17'));var licenseUtil=require(_0x4c43('0x18'));var db=require(_0x4c43('0x19'))['db'];var integrations=require(_0x4c43('0x1a'));function respondWithStatusCode(_0x2e5fbd,_0xdd5fc9){_0xdd5fc9=_0xdd5fc9||0xcc;return function(_0x5887b1){if(_0x5887b1){return _0x2e5fbd[_0x4c43('0x1b')](_0xdd5fc9);}return _0x2e5fbd[_0x4c43('0x1c')](_0xdd5fc9)[_0x4c43('0x1d')]();};}function respondWithResult(_0x132897,_0xf0bd64){_0xf0bd64=_0xf0bd64||0xc8;return function(_0x1bd17b){if(_0x1bd17b){return _0x132897['status'](_0xf0bd64)[_0x4c43('0x1e')](_0x1bd17b);}};}function respondWithFilteredResult(_0x24b0c3,_0x54004e){return function(_0x16c5f4){if(_0x16c5f4){var _0x295abc=typeof _0x54004e[_0x4c43('0x1f')]==='undefined'&&typeof _0x54004e['limit']===_0x4c43('0x20');var _0x5e56b0=_0x16c5f4[_0x4c43('0x21')];var _0x5b7a08=_0x295abc?0x0:_0x54004e['offset'];var _0x4093fb=_0x295abc?_0x16c5f4[_0x4c43('0x21')]:_0x54004e[_0x4c43('0x1f')]+_0x54004e['limit'];var _0xcf84f9;if(_0x4093fb>=_0x5e56b0){_0x4093fb=_0x5e56b0;_0xcf84f9=0xc8;}else{_0xcf84f9=0xce;}_0x24b0c3[_0x4c43('0x1c')](_0xcf84f9);return _0x24b0c3['set'](_0x4c43('0x22'),_0x5b7a08+'-'+_0x4093fb+'/'+_0x5e56b0)['json'](_0x16c5f4);}return null;};}function patchUpdates(_0x4aebbc){return function(_0x195b11){try{jsonpatch[_0x4c43('0x23')](_0x195b11,_0x4aebbc,!![]);}catch(_0x3b41eb){return BPromise[_0x4c43('0x24')](_0x3b41eb);}return _0x195b11[_0x4c43('0x25')]();};}function saveUpdates(_0x410fb3,_0x2ecb6d){return function(_0x52fb8b){if(_0x52fb8b){return _0x52fb8b[_0x4c43('0x26')](_0x410fb3)[_0x4c43('0x27')](function(_0x3512e9){return _0x3512e9;});}return null;};}function removeEntity(_0x4ce3a6,_0x2db761){return function(_0x1c42d5){if(_0x1c42d5){return _0x1c42d5[_0x4c43('0x28')]()[_0x4c43('0x27')](function(){_0x4ce3a6['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x478ab2,_0x4bb638){return function(_0x492975){if(!_0x492975){_0x478ab2[_0x4c43('0x1b')](0x194);}return _0x492975;};}function handleError(_0x282686,_0x51e5db){_0x51e5db=_0x51e5db||0x1f4;return function(_0x3224dc){logger[_0x4c43('0x29')](_0x3224dc[_0x4c43('0x2a')]);if(_0x3224dc[_0x4c43('0x2b')]){delete _0x3224dc['name'];}_0x282686[_0x4c43('0x1c')](_0x51e5db)[_0x4c43('0x2c')](_0x3224dc);};}exports[_0x4c43('0x2d')]=function(_0x3147b4,_0x39d405){var _0x2be7a6={},_0x11f63c={},_0x5b14b8={'count':0x0,'rows':[]};var _0xa83217=_[_0x4c43('0x2e')](db[_0x4c43('0x2f')]['rawAttributes'],function(_0x14c173){return{'name':_0x14c173['fieldName'],'type':_0x14c173[_0x4c43('0x30')][_0x4c43('0x31')]};});_0x11f63c[_0x4c43('0x32')]=_[_0x4c43('0x2e')](_0xa83217,'name');_0x11f63c[_0x4c43('0x33')]=_[_0x4c43('0x34')](_0x3147b4['query']);_0x11f63c[_0x4c43('0x35')]=_[_0x4c43('0x36')](_0x11f63c['model'],_0x11f63c['query']);_0x2be7a6[_0x4c43('0x37')]=_[_0x4c43('0x36')](_0x11f63c[_0x4c43('0x32')],qs[_0x4c43('0x38')](_0x3147b4[_0x4c43('0x33')][_0x4c43('0x38')]));_0x2be7a6[_0x4c43('0x37')]=_0x2be7a6[_0x4c43('0x37')]['length']?_0x2be7a6[_0x4c43('0x37')]:_0x11f63c[_0x4c43('0x32')];if(!_0x3147b4[_0x4c43('0x33')][_0x4c43('0x39')](_0x4c43('0x3a'))){_0x2be7a6[_0x4c43('0x3b')]=qs[_0x4c43('0x3b')](_0x3147b4[_0x4c43('0x33')][_0x4c43('0x3b')]);_0x2be7a6[_0x4c43('0x1f')]=qs[_0x4c43('0x1f')](_0x3147b4[_0x4c43('0x33')][_0x4c43('0x1f')]);}_0x2be7a6['order']=qs[_0x4c43('0x3c')](_0x3147b4['query']['sort']);_0x2be7a6['where']=qs[_0x4c43('0x35')](_[_0x4c43('0x3d')](_0x3147b4[_0x4c43('0x33')],_0x11f63c['filters']),_0xa83217);if(_0x3147b4['query'][_0x4c43('0x3e')]){_0x2be7a6[_0x4c43('0x3f')]=_[_0x4c43('0x40')](_0x2be7a6[_0x4c43('0x3f')],{'$or':_[_0x4c43('0x2e')](_0xa83217,function(_0x359560){if(_0x359560['type']!==_0x4c43('0x41')){var _0x1001d9={};_0x1001d9[_0x359560[_0x4c43('0x2b')]]={'$like':'%'+_0x3147b4['query'][_0x4c43('0x3e')]+'%'};return _0x1001d9;}})});}_0x2be7a6=_['merge']({},_0x2be7a6,_0x3147b4[_0x4c43('0x42')]);var _0x1de2fd={'where':_0x2be7a6['where']};return db[_0x4c43('0x2f')][_0x4c43('0x21')](_0x1de2fd)[_0x4c43('0x27')](function(_0x4ec2eb){_0x5b14b8[_0x4c43('0x21')]=_0x4ec2eb;if(_0x3147b4[_0x4c43('0x33')]['includeAll']){_0x2be7a6[_0x4c43('0x43')]=[{'all':!![]}];}return db['SugarcrmAccount'][_0x4c43('0x44')](_0x2be7a6);})[_0x4c43('0x27')](function(_0x45cc7c){_0x5b14b8[_0x4c43('0x45')]=_0x45cc7c;return _0x5b14b8;})[_0x4c43('0x27')](respondWithFilteredResult(_0x39d405,_0x2be7a6))[_0x4c43('0x46')](handleError(_0x39d405,null));};exports['show']=function(_0x15a775,_0x2b0aaa){var _0x19d12e={'raw':![],'where':{'id':_0x15a775[_0x4c43('0x47')]['id']}},_0x4ef5a1={};_0x4ef5a1[_0x4c43('0x32')]=_[_0x4c43('0x34')](db[_0x4c43('0x2f')][_0x4c43('0x48')]);_0x4ef5a1[_0x4c43('0x33')]=_['keys'](_0x15a775[_0x4c43('0x33')]);_0x4ef5a1[_0x4c43('0x35')]=_[_0x4c43('0x36')](_0x4ef5a1[_0x4c43('0x32')],_0x4ef5a1[_0x4c43('0x33')]);_0x19d12e[_0x4c43('0x37')]=_[_0x4c43('0x36')](_0x4ef5a1[_0x4c43('0x32')],qs['fields'](_0x15a775[_0x4c43('0x33')]['fields']));_0x19d12e['attributes']=_0x19d12e[_0x4c43('0x37')][_0x4c43('0x49')]?_0x19d12e[_0x4c43('0x37')]:_0x4ef5a1[_0x4c43('0x32')];if(_0x15a775[_0x4c43('0x33')][_0x4c43('0x4a')]){_0x19d12e['include']=[{'all':!![]}];}_0x19d12e=_[_0x4c43('0x40')]({},_0x19d12e,_0x15a775[_0x4c43('0x42')]);return db[_0x4c43('0x2f')]['find'](_0x19d12e)[_0x4c43('0x27')](handleEntityNotFound(_0x2b0aaa,null))['then'](respondWithResult(_0x2b0aaa,null))[_0x4c43('0x46')](handleError(_0x2b0aaa,null));};exports[_0x4c43('0x4b')]=function(_0x33b7f3,_0x1df124){return db['SugarcrmAccount'][_0x4c43('0x4b')](_0x33b7f3[_0x4c43('0x4c')],{})[_0x4c43('0x27')](respondWithResult(_0x1df124,0xc9))[_0x4c43('0x46')](handleError(_0x1df124,null));};exports['update']=function(_0x4a407e,_0x32d3a9){if(_0x4a407e[_0x4c43('0x4c')]['id']){delete _0x4a407e[_0x4c43('0x4c')]['id'];}return db[_0x4c43('0x2f')]['find']({'where':{'id':_0x4a407e['params']['id']}})[_0x4c43('0x27')](handleEntityNotFound(_0x32d3a9,null))[_0x4c43('0x27')](saveUpdates(_0x4a407e['body'],null))[_0x4c43('0x27')](respondWithResult(_0x32d3a9,null))[_0x4c43('0x46')](handleError(_0x32d3a9,null));};exports[_0x4c43('0x28')]=function(_0x44a274,_0x5da716){return db[_0x4c43('0x2f')][_0x4c43('0x4d')]({'where':{'id':_0x44a274[_0x4c43('0x47')]['id']}})[_0x4c43('0x27')](handleEntityNotFound(_0x5da716,null))[_0x4c43('0x27')](removeEntity(_0x5da716,null))[_0x4c43('0x46')](handleError(_0x5da716,null));};exports['getConfigurations']=function(_0x3846d5,_0x1a7ab2,_0x2b6079){var _0x1fb85c={};var _0x81bbbf={};var _0x5f58b2;var _0x11a1ae;return db[_0x4c43('0x2f')]['findOne']({'where':{'id':_0x3846d5[_0x4c43('0x47')]['id']}})[_0x4c43('0x27')](handleEntityNotFound(_0x1a7ab2,null))[_0x4c43('0x27')](function(_0x1e50c6){if(_0x1e50c6){_0x5f58b2=_0x1e50c6;_0x81bbbf[_0x4c43('0x32')]=_[_0x4c43('0x34')](db[_0x4c43('0x4e')][_0x4c43('0x48')]);_0x81bbbf[_0x4c43('0x33')]=_['keys'](_0x3846d5['query']);_0x81bbbf[_0x4c43('0x35')]=_['intersection'](_0x81bbbf[_0x4c43('0x32')],_0x81bbbf[_0x4c43('0x33')]);_0x1fb85c['attributes']=_['intersection'](_0x81bbbf[_0x4c43('0x32')],qs['fields'](_0x3846d5[_0x4c43('0x33')][_0x4c43('0x38')]));_0x1fb85c['attributes']=_0x1fb85c['attributes'][_0x4c43('0x49')]?_0x1fb85c[_0x4c43('0x37')]:_0x81bbbf[_0x4c43('0x32')];_0x1fb85c[_0x4c43('0x4f')]=qs[_0x4c43('0x3c')](_0x3846d5[_0x4c43('0x33')][_0x4c43('0x3c')]);_0x1fb85c[_0x4c43('0x3f')]=qs[_0x4c43('0x35')](_['pick'](_0x3846d5['query'],_0x81bbbf[_0x4c43('0x35')]));if(_0x3846d5[_0x4c43('0x33')][_0x4c43('0x3e')]){_0x1fb85c[_0x4c43('0x3f')]=_['merge'](_0x1fb85c['where'],{'$or':_['map'](_0x1fb85c['attributes'],function(_0x5984dc){var _0x36b72a={};_0x36b72a[_0x5984dc]={'$like':'%'+_0x3846d5[_0x4c43('0x33')]['filter']+'%'};return _0x36b72a;})});}_0x1fb85c=_[_0x4c43('0x40')]({},_0x1fb85c,_0x3846d5[_0x4c43('0x42')]);return _0x5f58b2[_0x4c43('0x50')](_0x1fb85c);}})[_0x4c43('0x27')](function(_0x51a6d1){if(_0x51a6d1){_0x11a1ae=_0x51a6d1[_0x4c43('0x49')];if(!_0x3846d5['query'][_0x4c43('0x39')]('nolimit')){_0x1fb85c[_0x4c43('0x3b')]=qs['limit'](_0x3846d5[_0x4c43('0x33')][_0x4c43('0x3b')]);_0x1fb85c[_0x4c43('0x1f')]=qs['offset'](_0x3846d5['query'][_0x4c43('0x1f')]);}return _0x5f58b2[_0x4c43('0x50')](_0x1fb85c);}})['then'](function(_0x373ef4){if(_0x373ef4){return _0x373ef4?{'count':_0x11a1ae,'rows':_0x373ef4}:null;}})[_0x4c43('0x27')](respondWithResult(_0x1a7ab2,null))[_0x4c43('0x46')](handleError(_0x1a7ab2,null));};exports[_0x4c43('0x51')]=function(_0x4c71df,_0xee52f0,_0x456e44){if(_0x4c71df[_0x4c43('0x4c')]['id']){delete _0x4c71df[_0x4c43('0x4c')]['id'];}return db['SugarcrmAccount'][_0x4c43('0x52')]({'where':{'id':_0x4c71df[_0x4c43('0x47')]['id']}})[_0x4c43('0x27')](handleEntityNotFound(_0xee52f0,null))['then'](function(_0x15f775){if(_0x15f775){_0x4c71df[_0x4c43('0x4c')][_0x4c43('0x53')]=_0x15f775['id'];_0x4c71df[_0x4c43('0x4c')][_0x4c43('0x54')]=integrations['getSubjects'](_0x4c71df['body'][_0x4c43('0x55')],_0x4c71df[_0x4c43('0x4c')][_0x4c43('0x30')]);_0x4c71df[_0x4c43('0x4c')]['Descriptions']=integrations[_0x4c43('0x56')](_0x4c71df[_0x4c43('0x4c')][_0x4c43('0x55')],_0x4c71df['body']['type']);return db[_0x4c43('0x4e')]['create'](_0x4c71df['body'],{'include':[{'model':db[_0x4c43('0x57')],'as':_0x4c43('0x54')},{'model':db[_0x4c43('0x57')],'as':_0x4c43('0x58')}]});}return null;})['then'](respondWithResult(_0xee52f0,null))['catch'](handleError(_0xee52f0,null));};exports[_0x4c43('0x59')]=function(_0x1ffe39,_0x40f2ea,_0x4a8b95){var _0x46e641='';var _0xd542f9=['id','name',_0x4c43('0x5a'),_0x4c43('0x5b'),_0x4c43('0x5c'),_0x4c43('0x5d'),_0x4c43('0x5e'),_0x4c43('0x5f'),_0x4c43('0x60'),'parent_type','parent_name',_0x4c43('0x61')];return db[_0x4c43('0x2f')][_0x4c43('0x52')]({'where':{'id':_0x1ffe39[_0x4c43('0x47')]['id']},'attributes':['id',_0x4c43('0x62'),'password','remoteUri']})[_0x4c43('0x27')](handleEntityNotFound(_0x40f2ea,null))['then'](function(_0x545e26){if(_0x545e26){_0x46e641=_0x545e26['remoteUri'];var _0x39702e=_0x46e641[_0x4c43('0x63')](-0x1);if(_0x39702e==='/'){_0x46e641=_0x46e641['substring'](0x0,_0x46e641[_0x4c43('0x64')](_0x39702e));}return rp({'method':_0x4c43('0x65'),'uri':util[_0x4c43('0x66')](_0x4c43('0x67'),_0x46e641,_0x4c43('0x68')),'json':!![],'form':{'method':_0x4c43('0x69'),'input_type':'JSON','response_type':_0x4c43('0x6a'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x545e26[_0x4c43('0x62')],'password':_0x545e26[_0x4c43('0x6b')],'encryption':_0x4c43('0x6c')},'application':_0x4c43('0x6d')})}});}})[_0x4c43('0x27')](function(_0x4f1855){if(_0x4f1855&&_0x4f1855[_0x4c43('0x2b')]!==_0x4c43('0x6e')&&_0x4f1855[_0x4c43('0x2b')]!==_0x4c43('0x6f')){return rp({'method':'POST','uri':util[_0x4c43('0x66')](_0x4c43('0x67'),_0x46e641,_0x4c43('0x68')),'json':!![],'form':{'method':'get_module_fields','input_type':_0x4c43('0x6a'),'response_type':_0x4c43('0x6a'),'rest_data':JSON[_0x4c43('0x70')]({'session':_0x4f1855['id'],'module_name':_0x4c43('0x71')})}})[_0x4c43('0x27')](function(_0x47f05c){if(_0x47f05c){var _0x3976dc=_[_0x4c43('0x72')](_0x47f05c[_0x4c43('0x73')]);_['remove'](_0x3976dc,function(_0x594a51){return _0xd542f9[_0x4c43('0x74')](_0x594a51[_0x4c43('0x2b')]);});return{'count':_0x3976dc[_0x4c43('0x49')],'rows':_[_0x4c43('0x2e')](_0x3976dc,function(_0xc364c7){return{'id':_0xc364c7[_0x4c43('0x2b')],'name':_0xc364c7[_0x4c43('0x75')],'custom':_[_0x4c43('0x76')](_0xc364c7[_0x4c43('0x2b')],'_c')?!![]:![],'options':_0xc364c7[_0x4c43('0x42')]?_[_0x4c43('0x2e')](_['values'](_0xc364c7[_0x4c43('0x42')]),function(_0x5a65f9){return{'name':_0x5a65f9[_0x4c43('0x77')],'value':_0x5a65f9['name']};}):[]};})};}})['then'](respondWithResult(_0x40f2ea,null))[_0x4c43('0x46')](function(_0x478338){var _0x5655da=_0x1ffe39[_0x4c43('0x33')][_0x4c43('0x78')]?0x1f4:_0x478338[_0x4c43('0x79')]||0x1f4;logger['error'](_0x4c43('0x7a'),_0x4c43('0x59'),_0x5655da,JSON[_0x4c43('0x70')](_0x478338));delete _0x478338['name'];if(_0x5655da===0x191){_0x5655da=0x190;}_0x40f2ea[_0x4c43('0x1c')](_0x5655da)['send'](_0x1ffe39[_0x4c43('0x33')][_0x4c43('0x78')]?{'message':_0x4c43('0x7b'),'statusCode':_0x478338[_0x4c43('0x79')]}:_0x478338);});}else{var _0x5d05da=0x1f4;_0x40f2ea['status'](_0x5d05da)[_0x4c43('0x2c')]({'message':_0x4c43('0x7b'),'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 75f1272..b170182 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 _0xd33a=['int_sugarcrm_accounts','api','moment','request-promise','rimraf','../../config/environment','./intSugarcrmAccount.attributes','../../components/integrations/configuration','define','SugarcrmAccount'];(function(_0x6fcc6e,_0x5d1c4e){var _0x234cee=function(_0x298e0e){while(--_0x298e0e){_0x6fcc6e['push'](_0x6fcc6e['shift']());}};_0x234cee(++_0x5d1c4e);}(_0xd33a,0x123));var _0xad33=function(_0x48c1a4,_0x3a2447){_0x48c1a4=_0x48c1a4-0x0;var _0x3d8016=_0xd33a[_0x48c1a4];return _0x3d8016;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xad33('0x0'));var moment=require(_0xad33('0x1'));var BPromise=require('bluebird');var rp=require(_0xad33('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0xad33('0x3'));var config=require(_0xad33('0x4'));var attributes=require(_0xad33('0x5'));var integrations=require(_0xad33('0x6'));module['exports']=function(_0x184c18,_0x34126a){return _0x184c18[_0xad33('0x7')](_0xad33('0x8'),attributes,{'tableName':_0xad33('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa63a=['define','int_sugarcrm_accounts','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSugarcrmAccount.attributes','../../components/integrations/configuration'];(function(_0x3dde11,_0x2d7449){var _0x541c04=function(_0x362043){while(--_0x362043){_0x3dde11['push'](_0x3dde11['shift']());}};_0x541c04(++_0x2d7449);}(_0xa63a,0x154));var _0xaa63=function(_0x4cc492,_0x162c85){_0x4cc492=_0x4cc492-0x0;var _0x1f36b9=_0xa63a[_0x4cc492];return _0x1f36b9;};'use strict';var _=require('lodash');var util=require(_0xaa63('0x0'));var logger=require(_0xaa63('0x1'))(_0xaa63('0x2'));var moment=require(_0xaa63('0x3'));var BPromise=require(_0xaa63('0x4'));var rp=require(_0xaa63('0x5'));var fs=require('fs');var path=require(_0xaa63('0x6'));var rimraf=require(_0xaa63('0x7'));var config=require(_0xaa63('0x8'));var attributes=require(_0xaa63('0x9'));var integrations=require(_0xaa63('0xa'));module['exports']=function(_0x5160dc,_0x5ee756){return _0x5160dc[_0xaa63('0xb')]('SugarcrmAccount',attributes,{'tableName':_0xaa63('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js index b367884..6ee2a67 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 _0xac94=['lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetSugarcrmAccount','SugarcrmAccount','findAll','options','raw','where','attributes','limit','include','map','model','catch','find','ShowSugarcrmAccount'];(function(_0x39130f,_0x493826){var _0x564662=function(_0x4a20ca){while(--_0x4a20ca){_0x39130f['push'](_0x39130f['shift']());}};_0x564662(++_0x493826);}(_0xac94,0x90));var _0x4ac9=function(_0x11db7c,_0x4840fe){_0x11db7c=_0x11db7c-0x0;var _0x37ccc7=_0xac94[_0x11db7c];return _0x37ccc7;};'use strict';var _=require(_0x4ac9('0x0'));var util=require(_0x4ac9('0x1'));var moment=require(_0x4ac9('0x2'));var BPromise=require(_0x4ac9('0x3'));var rs=require(_0x4ac9('0x4'));var fs=require('fs');var Redis=require(_0x4ac9('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x4ac9('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x4ac9('0x7'));var jayson=require(_0x4ac9('0x8'));var client=jayson[_0x4ac9('0x9')][_0x4ac9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15cf04,_0x39e3f0,_0x2b9542){return new BPromise(function(_0x212281,_0x2944f2){return client['request'](_0x15cf04,_0x2b9542)[_0x4ac9('0xb')](function(_0x2f5050){logger[_0x4ac9('0xc')](_0x4ac9('0xd'),_0x39e3f0,_0x4ac9('0xe'));logger[_0x4ac9('0xf')](_0x4ac9('0x10'),_0x39e3f0,_0x4ac9('0xe'),JSON[_0x4ac9('0x11')](_0x2f5050));if(_0x2f5050['error']){if(_0x2f5050[_0x4ac9('0x12')][_0x4ac9('0x13')]===0x1f4){logger[_0x4ac9('0x12')](_0x4ac9('0xd'),_0x39e3f0,_0x2f5050['error'][_0x4ac9('0x14')]);return _0x2944f2(_0x2f5050[_0x4ac9('0x12')][_0x4ac9('0x14')]);}logger[_0x4ac9('0x12')]('SugarcrmAccount,\x20%s,\x20%s',_0x39e3f0,_0x2f5050[_0x4ac9('0x12')][_0x4ac9('0x14')]);return _0x212281(_0x2f5050[_0x4ac9('0x12')]['message']);}else{logger[_0x4ac9('0xc')]('SugarcrmAccount,\x20%s,\x20%s',_0x39e3f0,_0x4ac9('0xe'));_0x212281(_0x2f5050[_0x4ac9('0x15')][_0x4ac9('0x14')]);}})['catch'](function(_0x3ef03f){logger[_0x4ac9('0x12')](_0x4ac9('0xd'),_0x39e3f0,_0x3ef03f);_0x2944f2(_0x3ef03f);});});}exports[_0x4ac9('0x16')]=function(_0x91e1c7){var _0x41aaf6=this;return new Promise(function(_0x5db2c9,_0x1fdff8){return db[_0x4ac9('0x17')][_0x4ac9('0x18')]({'raw':_0x91e1c7[_0x4ac9('0x19')]?_0x91e1c7[_0x4ac9('0x19')][_0x4ac9('0x1a')]===undefined?!![]:![]:!![],'where':_0x91e1c7[_0x4ac9('0x19')]?_0x91e1c7[_0x4ac9('0x19')][_0x4ac9('0x1b')]||null:null,'attributes':_0x91e1c7['options']?_0x91e1c7[_0x4ac9('0x19')][_0x4ac9('0x1c')]||null:null,'limit':_0x91e1c7[_0x4ac9('0x19')]?_0x91e1c7['options'][_0x4ac9('0x1d')]||null:null,'include':_0x91e1c7[_0x4ac9('0x19')]?_0x91e1c7[_0x4ac9('0x19')][_0x4ac9('0x1e')]?_['map'](_0x91e1c7[_0x4ac9('0x19')][_0x4ac9('0x1e')],function(_0x48898e){return{'model':db[_0x48898e['model']],'as':_0x48898e['as'],'attributes':_0x48898e['attributes'],'include':_0x48898e['include']?_[_0x4ac9('0x1f')](_0x48898e[_0x4ac9('0x1e')],function(_0x544fb3){return{'model':db[_0x544fb3[_0x4ac9('0x20')]],'as':_0x544fb3['as'],'attributes':_0x544fb3['attributes'],'include':_0x544fb3[_0x4ac9('0x1e')]?_[_0x4ac9('0x1f')](_0x544fb3['include'],function(_0x47ded3){return{'model':db[_0x47ded3[_0x4ac9('0x20')]],'as':_0x47ded3['as'],'attributes':_0x47ded3[_0x4ac9('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x4ac9('0xb')](function(_0x5a83fa){logger[_0x4ac9('0xc')](_0x4ac9('0x16'),_0x91e1c7);logger[_0x4ac9('0xf')](_0x4ac9('0x16'),_0x91e1c7,JSON[_0x4ac9('0x11')](_0x5a83fa));_0x5db2c9(_0x5a83fa);})[_0x4ac9('0x21')](function(_0x4b93c8){logger[_0x4ac9('0x12')](_0x4ac9('0x16'),_0x4b93c8[_0x4ac9('0x14')],_0x91e1c7);_0x1fdff8(_0x41aaf6[_0x4ac9('0x12')](0x1f4,_0x4b93c8['message']));});});};exports['ShowSugarcrmAccount']=function(_0x44754c){var _0x1bc0f7=this;return new Promise(function(_0x1423c2,_0x321735){return db[_0x4ac9('0x17')][_0x4ac9('0x22')]({'raw':_0x44754c['options']?_0x44754c[_0x4ac9('0x19')][_0x4ac9('0x1a')]===undefined?!![]:![]:!![],'where':_0x44754c[_0x4ac9('0x19')]?_0x44754c[_0x4ac9('0x19')][_0x4ac9('0x1b')]||null:null,'attributes':_0x44754c[_0x4ac9('0x19')]?_0x44754c[_0x4ac9('0x19')][_0x4ac9('0x1c')]||null:null,'include':_0x44754c[_0x4ac9('0x19')]?_0x44754c['options']['include']?_[_0x4ac9('0x1f')](_0x44754c[_0x4ac9('0x19')]['include'],function(_0x1e0c9c){return{'model':db[_0x1e0c9c['model']],'as':_0x1e0c9c['as'],'attributes':_0x1e0c9c['attributes'],'include':_0x1e0c9c[_0x4ac9('0x1e')]?_[_0x4ac9('0x1f')](_0x1e0c9c[_0x4ac9('0x1e')],function(_0x229359){return{'model':db[_0x229359[_0x4ac9('0x20')]],'as':_0x229359['as'],'attributes':_0x229359[_0x4ac9('0x1c')],'include':_0x229359[_0x4ac9('0x1e')]?_['map'](_0x229359[_0x4ac9('0x1e')],function(_0x44e7da){return{'model':db[_0x44e7da[_0x4ac9('0x20')]],'as':_0x44e7da['as'],'attributes':_0x44e7da[_0x4ac9('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x4ac9('0xb')](function(_0x4877a0){logger[_0x4ac9('0xc')](_0x4ac9('0x23'),_0x44754c);logger[_0x4ac9('0xf')]('ShowSugarcrmAccount',_0x44754c,JSON[_0x4ac9('0x11')](_0x4877a0));_0x1423c2(_0x4877a0);})['catch'](function(_0x5b22d8){logger['error']('ShowSugarcrmAccount',_0x5b22d8[_0x4ac9('0x14')],_0x44754c);_0x321735(_0x1bc0f7[_0x4ac9('0x12')](0x1f4,_0x5b22d8[_0x4ac9('0x14')]));});});}; \ No newline at end of file +var _0xf043=['jayson/promise','client','http','request','then','info','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','SugarcrmAccount,\x20%s,\x20%s','message','result','catch','GetSugarcrmAccount','findAll','options','raw','where','include','map','model','attributes','ShowSugarcrmAccount','find','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0xc67773,_0x549380){var _0x5e7631=function(_0x5f399e){while(--_0x5f399e){_0xc67773['push'](_0xc67773['shift']());}};_0x5e7631(++_0x549380);}(_0xf043,0xbf));var _0x3f04=function(_0x23fafe,_0x2107fa){_0x23fafe=_0x23fafe-0x0;var _0x3fa126=_0xf043[_0x23fafe];return _0x3fa126;};'use strict';var _=require('lodash');var util=require(_0x3f04('0x0'));var moment=require(_0x3f04('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3f04('0x2'));var db=require(_0x3f04('0x3'))['db'];var utils=require(_0x3f04('0x4'));var logger=require(_0x3f04('0x5'))(_0x3f04('0x6'));var config=require('../../config/environment');var jayson=require(_0x3f04('0x7'));var client=jayson[_0x3f04('0x8')][_0x3f04('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3181d6,_0x589720,_0x47f6f5){return new BPromise(function(_0x4365fc,_0x1d02c3){return client[_0x3f04('0xa')](_0x3181d6,_0x47f6f5)[_0x3f04('0xb')](function(_0x48abb5){logger[_0x3f04('0xc')]('SugarcrmAccount,\x20%s,\x20%s',_0x589720,_0x3f04('0xd'));logger[_0x3f04('0xe')](_0x3f04('0xf'),_0x589720,_0x3f04('0xd'),JSON[_0x3f04('0x10')](_0x48abb5));if(_0x48abb5['error']){if(_0x48abb5['error']['code']===0x1f4){logger[_0x3f04('0x11')](_0x3f04('0x12'),_0x589720,_0x48abb5['error'][_0x3f04('0x13')]);return _0x1d02c3(_0x48abb5['error'][_0x3f04('0x13')]);}logger[_0x3f04('0x11')](_0x3f04('0x12'),_0x589720,_0x48abb5[_0x3f04('0x11')]['message']);return _0x4365fc(_0x48abb5[_0x3f04('0x11')][_0x3f04('0x13')]);}else{logger[_0x3f04('0xc')](_0x3f04('0x12'),_0x589720,_0x3f04('0xd'));_0x4365fc(_0x48abb5[_0x3f04('0x14')][_0x3f04('0x13')]);}})[_0x3f04('0x15')](function(_0x2676d9){logger[_0x3f04('0x11')](_0x3f04('0x12'),_0x589720,_0x2676d9);_0x1d02c3(_0x2676d9);});});}exports[_0x3f04('0x16')]=function(_0x3b15e9){var _0x45cfa7=this;return new Promise(function(_0x5108a5,_0xcac024){return db['SugarcrmAccount'][_0x3f04('0x17')]({'raw':_0x3b15e9['options']?_0x3b15e9[_0x3f04('0x18')][_0x3f04('0x19')]===undefined?!![]:![]:!![],'where':_0x3b15e9['options']?_0x3b15e9['options'][_0x3f04('0x1a')]||null:null,'attributes':_0x3b15e9[_0x3f04('0x18')]?_0x3b15e9['options']['attributes']||null:null,'limit':_0x3b15e9[_0x3f04('0x18')]?_0x3b15e9[_0x3f04('0x18')]['limit']||null:null,'include':_0x3b15e9[_0x3f04('0x18')]?_0x3b15e9['options'][_0x3f04('0x1b')]?_[_0x3f04('0x1c')](_0x3b15e9[_0x3f04('0x18')][_0x3f04('0x1b')],function(_0x59e142){return{'model':db[_0x59e142[_0x3f04('0x1d')]],'as':_0x59e142['as'],'attributes':_0x59e142[_0x3f04('0x1e')],'include':_0x59e142[_0x3f04('0x1b')]?_[_0x3f04('0x1c')](_0x59e142[_0x3f04('0x1b')],function(_0x1e6e5c){return{'model':db[_0x1e6e5c[_0x3f04('0x1d')]],'as':_0x1e6e5c['as'],'attributes':_0x1e6e5c[_0x3f04('0x1e')],'include':_0x1e6e5c[_0x3f04('0x1b')]?_[_0x3f04('0x1c')](_0x1e6e5c['include'],function(_0x4625b5){return{'model':db[_0x4625b5[_0x3f04('0x1d')]],'as':_0x4625b5['as'],'attributes':_0x4625b5['attributes']};}):[]};}):[]};}):[]:[]})[_0x3f04('0xb')](function(_0x546be6){logger[_0x3f04('0xc')](_0x3f04('0x16'),_0x3b15e9);logger[_0x3f04('0xe')](_0x3f04('0x16'),_0x3b15e9,JSON[_0x3f04('0x10')](_0x546be6));_0x5108a5(_0x546be6);})[_0x3f04('0x15')](function(_0x35d4dd){logger[_0x3f04('0x11')](_0x3f04('0x16'),_0x35d4dd[_0x3f04('0x13')],_0x3b15e9);_0xcac024(_0x45cfa7['error'](0x1f4,_0x35d4dd['message']));});});};exports[_0x3f04('0x1f')]=function(_0x47c932){var _0x391d0d=this;return new Promise(function(_0x645361,_0x4dc9fb){return db['SugarcrmAccount'][_0x3f04('0x20')]({'raw':_0x47c932[_0x3f04('0x18')]?_0x47c932['options'][_0x3f04('0x19')]===undefined?!![]:![]:!![],'where':_0x47c932[_0x3f04('0x18')]?_0x47c932[_0x3f04('0x18')][_0x3f04('0x1a')]||null:null,'attributes':_0x47c932[_0x3f04('0x18')]?_0x47c932[_0x3f04('0x18')][_0x3f04('0x1e')]||null:null,'include':_0x47c932['options']?_0x47c932[_0x3f04('0x18')][_0x3f04('0x1b')]?_[_0x3f04('0x1c')](_0x47c932[_0x3f04('0x18')][_0x3f04('0x1b')],function(_0x344b0a){return{'model':db[_0x344b0a[_0x3f04('0x1d')]],'as':_0x344b0a['as'],'attributes':_0x344b0a[_0x3f04('0x1e')],'include':_0x344b0a[_0x3f04('0x1b')]?_['map'](_0x344b0a[_0x3f04('0x1b')],function(_0x49d348){return{'model':db[_0x49d348[_0x3f04('0x1d')]],'as':_0x49d348['as'],'attributes':_0x49d348['attributes'],'include':_0x49d348[_0x3f04('0x1b')]?_['map'](_0x49d348[_0x3f04('0x1b')],function(_0x2dec6c){return{'model':db[_0x2dec6c[_0x3f04('0x1d')]],'as':_0x2dec6c['as'],'attributes':_0x2dec6c['attributes']};}):[]};}):[]};}):[]:[]})[_0x3f04('0xb')](function(_0x1dfb01){logger[_0x3f04('0xc')](_0x3f04('0x1f'),_0x47c932);logger[_0x3f04('0xe')](_0x3f04('0x1f'),_0x47c932,JSON[_0x3f04('0x10')](_0x1dfb01));_0x645361(_0x1dfb01);})[_0x3f04('0x15')](function(_0xf9943e){logger[_0x3f04('0x11')](_0x3f04('0x1f'),_0xf9943e[_0x3f04('0x13')],_0x47c932);_0x4dc9fb(_0x391d0d[_0x3f04('0x11')](0x1f4,_0xf9943e[_0x3f04('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index da49bd0..4a9d07e 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 _0x850b=['put','delete','exports','multer','path','Router','fs-extra','../../config/environment','./intSugarcrmConfiguration.controller','get','index','/:id','show','isAuthenticated','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post'];(function(_0x23a97d,_0x528dfc){var _0x2f8cd4=function(_0x2a5385){while(--_0x2a5385){_0x23a97d['push'](_0x23a97d['shift']());}};_0x2f8cd4(++_0x528dfc);}(_0x850b,0x146));var _0xb850=function(_0x2da6fa,_0x130078){_0x2da6fa=_0x2da6fa-0x0;var _0x1a9064=_0x850b[_0x2da6fa];return _0x1a9064;};'use strict';var multer=require(_0xb850('0x0'));var util=require('util');var path=require(_0xb850('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xb850('0x2')]();var fs_extra=require(_0xb850('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xb850('0x4'));var controller=require(_0xb850('0x5'));router[_0xb850('0x6')]('/',auth['isAuthenticated'](),controller[_0xb850('0x7')]);router['get'](_0xb850('0x8'),auth['isAuthenticated'](),controller[_0xb850('0x9')]);router[_0xb850('0x6')]('/:id/fields',auth[_0xb850('0xa')](),controller['getFields']);router['get'](_0xb850('0xb'),auth['isAuthenticated'](),controller[_0xb850('0xc')]);router[_0xb850('0x6')](_0xb850('0xd'),auth[_0xb850('0xa')](),controller[_0xb850('0xe')]);router[_0xb850('0xf')]('/',auth[_0xb850('0xa')](),controller['create']);router[_0xb850('0x10')](_0xb850('0x8'),auth['isAuthenticated'](),controller['update']);router[_0xb850('0x11')](_0xb850('0x8'),auth[_0xb850('0xa')](),controller['destroy']);module[_0xb850('0x12')]=router; \ No newline at end of file +var _0x5ea0=['express','Router','fs-extra','../../components/auth/service','../../config/environment','./intSugarcrmConfiguration.controller','get','isAuthenticated','/:id','show','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','destroy','exports','multer','path','connect-timeout'];(function(_0xa687fe,_0x24693c){var _0xced286=function(_0x22118f){while(--_0x22118f){_0xa687fe['push'](_0xa687fe['shift']());}};_0xced286(++_0x24693c);}(_0x5ea0,0xb5));var _0x05ea=function(_0xa20f68,_0x5e0e38){_0xa20f68=_0xa20f68-0x0;var _0xd2f95e=_0x5ea0[_0xa20f68];return _0xd2f95e;};'use strict';var multer=require(_0x05ea('0x0'));var util=require('util');var path=require(_0x05ea('0x1'));var timeout=require(_0x05ea('0x2'));var express=require(_0x05ea('0x3'));var router=express[_0x05ea('0x4')]();var fs_extra=require(_0x05ea('0x5'));var auth=require(_0x05ea('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x05ea('0x7'));var controller=require(_0x05ea('0x8'));router[_0x05ea('0x9')]('/',auth[_0x05ea('0xa')](),controller['index']);router[_0x05ea('0x9')](_0x05ea('0xb'),auth[_0x05ea('0xa')](),controller[_0x05ea('0xc')]);router[_0x05ea('0x9')]('/:id/fields',auth[_0x05ea('0xa')](),controller['getFields']);router[_0x05ea('0x9')](_0x05ea('0xd'),auth[_0x05ea('0xa')](),controller[_0x05ea('0xe')]);router[_0x05ea('0x9')](_0x05ea('0xf'),auth[_0x05ea('0xa')](),controller[_0x05ea('0x10')]);router[_0x05ea('0x11')]('/',auth['isAuthenticated'](),controller[_0x05ea('0x12')]);router[_0x05ea('0x13')](_0x05ea('0xb'),auth[_0x05ea('0xa')](),controller[_0x05ea('0x14')]);router['delete'](_0x05ea('0xb'),auth[_0x05ea('0xa')](),controller[_0x05ea('0x15')]);module[_0x05ea('0x16')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index 8113f13..8795179 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 _0xd389=['exports','STRING','sequelize'];(function(_0x286bfc,_0x58cb9e){var _0x2b6288=function(_0x3e4990){while(--_0x3e4990){_0x286bfc['push'](_0x286bfc['shift']());}};_0x2b6288(++_0x58cb9e);}(_0xd389,0x12b));var _0x9d38=function(_0x42671d,_0x5862f3){_0x42671d=_0x42671d-0x0;var _0x19a157=_0xd389[_0x42671d];return _0x19a157;};'use strict';var Sequelize=require(_0x9d38('0x0'));module[_0x9d38('0x1')]={'name':{'type':Sequelize[_0x9d38('0x2')]},'description':{'type':Sequelize[_0x9d38('0x2')]}}; \ No newline at end of file +var _0x2127=['STRING','sequelize'];(function(_0x1e3c16,_0x372caa){var _0x47a0c9=function(_0x47f81d){while(--_0x47f81d){_0x1e3c16['push'](_0x1e3c16['shift']());}};_0x47a0c9(++_0x372caa);}(_0x2127,0x1e7));var _0x7212=function(_0x4420c8,_0x2cabca){_0x4420c8=_0x4420c8-0x0;var _0x46955e=_0x2127[_0x4420c8];return _0x46955e;};'use strict';var Sequelize=require(_0x7212('0x0'));module['exports']={'name':{'type':Sequelize[_0x7212('0x1')]},'description':{'type':Sequelize[_0x7212('0x1')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index 552aab0..8ff15dc 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 _0xc965=['reject','update','then','destroy','name','send','index','map','SugarcrmConfiguration','rawAttributes','fieldName','key','model','keys','filters','intersection','query','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','includeAll','include','findAll','catch','show','length','find','create','body','params','getFields','findOne','SugarcrmField','pick','getSubjects','getDescriptions','eml-format','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','undefined','limit','offset','count','set','json','apply'];(function(_0x480a6d,_0x8be3e5){var _0x4372ed=function(_0x38bc1a){while(--_0x38bc1a){_0x480a6d['push'](_0x480a6d['shift']());}};_0x4372ed(++_0x8be3e5);}(_0xc965,0x1ed));var _0x5c96=function(_0x218681,_0x16971b){_0x218681=_0x218681-0x0;var _0x56c5de=_0xc965[_0x218681];return _0x56c5de;};'use strict';var emlformat=require(_0x5c96('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5c96('0x1'));var jsonpatch=require(_0x5c96('0x2'));var rp=require(_0x5c96('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x5c96('0x4'));var util=require(_0x5c96('0x5'));var path=require(_0x5c96('0x6'));var sox=require(_0x5c96('0x7'));var csv=require(_0x5c96('0x8'));var ejs=require(_0x5c96('0x9'));var fs=require('fs');var fs_extra=require(_0x5c96('0xa'));var _=require(_0x5c96('0xb'));var squel=require(_0x5c96('0xc'));var crypto=require(_0x5c96('0xd'));var jsforce=require(_0x5c96('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x5c96('0x8'));var querystring=require('querystring');var Papa=require(_0x5c96('0xf'));var Redis=require(_0x5c96('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x5c96('0x11'));var hardwareService=require(_0x5c96('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x5c96('0x13'));var config=require(_0x5c96('0x14'));var licenseUtil=require(_0x5c96('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x586edb,_0x26bb77){_0x26bb77=_0x26bb77||0xcc;return function(_0x567254){if(_0x567254){return _0x586edb[_0x5c96('0x16')](_0x26bb77);}return _0x586edb[_0x5c96('0x17')](_0x26bb77)[_0x5c96('0x18')]();};}function respondWithResult(_0x3a82f2,_0x129c95){_0x129c95=_0x129c95||0xc8;return function(_0x41314b){if(_0x41314b){return _0x3a82f2[_0x5c96('0x17')](_0x129c95)['json'](_0x41314b);}};}function respondWithFilteredResult(_0x59b504,_0x3ca8c6){return function(_0x5bdb43){if(_0x5bdb43){var _0x195611=typeof _0x3ca8c6['offset']===_0x5c96('0x19')&&typeof _0x3ca8c6[_0x5c96('0x1a')]===_0x5c96('0x19');var _0x1f7014=_0x5bdb43['count'];var _0x1ce309=_0x195611?0x0:_0x3ca8c6[_0x5c96('0x1b')];var _0x2aef6b=_0x195611?_0x5bdb43[_0x5c96('0x1c')]:_0x3ca8c6[_0x5c96('0x1b')]+_0x3ca8c6[_0x5c96('0x1a')];var _0x396663;if(_0x2aef6b>=_0x1f7014){_0x2aef6b=_0x1f7014;_0x396663=0xc8;}else{_0x396663=0xce;}_0x59b504['status'](_0x396663);return _0x59b504[_0x5c96('0x1d')]('Content-Range',_0x1ce309+'-'+_0x2aef6b+'/'+_0x1f7014)[_0x5c96('0x1e')](_0x5bdb43);}return null;};}function patchUpdates(_0x5db67f){return function(_0x2069a3){try{jsonpatch[_0x5c96('0x1f')](_0x2069a3,_0x5db67f,!![]);}catch(_0x469c1e){return BPromise[_0x5c96('0x20')](_0x469c1e);}return _0x2069a3['save']();};}function saveUpdates(_0x1895bb,_0x3b99b1){return function(_0xe00e8b){if(_0xe00e8b){return _0xe00e8b[_0x5c96('0x21')](_0x1895bb)[_0x5c96('0x22')](function(_0x1cd644){return _0x1cd644;});}return null;};}function removeEntity(_0x15bd5f,_0xe35ffb){return function(_0x3470dd){if(_0x3470dd){return _0x3470dd[_0x5c96('0x23')]()[_0x5c96('0x22')](function(){_0x15bd5f['status'](0xcc)[_0x5c96('0x18')]();});}};}function handleEntityNotFound(_0x12520d,_0x1d79ac){return function(_0x32555c){if(!_0x32555c){_0x12520d[_0x5c96('0x16')](0x194);}return _0x32555c;};}function handleError(_0x314700,_0x208daf){_0x208daf=_0x208daf||0x1f4;return function(_0xaa1314){logger['error'](_0xaa1314['stack']);if(_0xaa1314['name']){delete _0xaa1314[_0x5c96('0x24')];}_0x314700['status'](_0x208daf)[_0x5c96('0x25')](_0xaa1314);};}exports[_0x5c96('0x26')]=function(_0x2b7fe7,_0xb9cbcd){var _0x369d37={},_0x191f9d={},_0xe953a4={'count':0x0,'rows':[]};var _0x1711e7=_[_0x5c96('0x27')](db[_0x5c96('0x28')][_0x5c96('0x29')],function(_0x604204){return{'name':_0x604204[_0x5c96('0x2a')],'type':_0x604204['type'][_0x5c96('0x2b')]};});_0x191f9d[_0x5c96('0x2c')]=_[_0x5c96('0x27')](_0x1711e7,_0x5c96('0x24'));_0x191f9d['query']=_[_0x5c96('0x2d')](_0x2b7fe7['query']);_0x191f9d[_0x5c96('0x2e')]=_[_0x5c96('0x2f')](_0x191f9d['model'],_0x191f9d[_0x5c96('0x30')]);_0x369d37[_0x5c96('0x31')]=_[_0x5c96('0x2f')](_0x191f9d[_0x5c96('0x2c')],qs['fields'](_0x2b7fe7[_0x5c96('0x30')][_0x5c96('0x32')]));_0x369d37['attributes']=_0x369d37[_0x5c96('0x31')]['length']?_0x369d37[_0x5c96('0x31')]:_0x191f9d[_0x5c96('0x2c')];if(!_0x2b7fe7['query'][_0x5c96('0x33')](_0x5c96('0x34'))){_0x369d37[_0x5c96('0x1a')]=qs[_0x5c96('0x1a')](_0x2b7fe7[_0x5c96('0x30')]['limit']);_0x369d37[_0x5c96('0x1b')]=qs[_0x5c96('0x1b')](_0x2b7fe7[_0x5c96('0x30')][_0x5c96('0x1b')]);}_0x369d37[_0x5c96('0x35')]=qs[_0x5c96('0x36')](_0x2b7fe7['query'][_0x5c96('0x36')]);_0x369d37[_0x5c96('0x37')]=qs[_0x5c96('0x2e')](_['pick'](_0x2b7fe7['query'],_0x191f9d[_0x5c96('0x2e')]),_0x1711e7);if(_0x2b7fe7['query'][_0x5c96('0x38')]){_0x369d37[_0x5c96('0x37')]=_[_0x5c96('0x39')](_0x369d37[_0x5c96('0x37')],{'$or':_[_0x5c96('0x27')](_0x1711e7,function(_0x4710ab){if(_0x4710ab['type']!=='VIRTUAL'){var _0x3232f0={};_0x3232f0[_0x4710ab['name']]={'$like':'%'+_0x2b7fe7['query'][_0x5c96('0x38')]+'%'};return _0x3232f0;}})});}_0x369d37=_['merge']({},_0x369d37,_0x2b7fe7[_0x5c96('0x3a')]);var _0x1534b7={'where':_0x369d37[_0x5c96('0x37')]};return db[_0x5c96('0x28')][_0x5c96('0x1c')](_0x1534b7)[_0x5c96('0x22')](function(_0x23575e){_0xe953a4[_0x5c96('0x1c')]=_0x23575e;if(_0x2b7fe7['query'][_0x5c96('0x3b')]){_0x369d37[_0x5c96('0x3c')]=[{'all':!![]}];}return db[_0x5c96('0x28')][_0x5c96('0x3d')](_0x369d37);})['then'](function(_0xb0ec4d){_0xe953a4['rows']=_0xb0ec4d;return _0xe953a4;})[_0x5c96('0x22')](respondWithFilteredResult(_0xb9cbcd,_0x369d37))[_0x5c96('0x3e')](handleError(_0xb9cbcd,null));};exports[_0x5c96('0x3f')]=function(_0x191437,_0x3909ef){var _0x211376={'raw':![],'where':{'id':_0x191437['params']['id']}},_0x6b258e={};_0x6b258e[_0x5c96('0x2c')]=_[_0x5c96('0x2d')](db['SugarcrmConfiguration'][_0x5c96('0x29')]);_0x6b258e[_0x5c96('0x30')]=_['keys'](_0x191437[_0x5c96('0x30')]);_0x6b258e[_0x5c96('0x2e')]=_['intersection'](_0x6b258e[_0x5c96('0x2c')],_0x6b258e['query']);_0x211376[_0x5c96('0x31')]=_[_0x5c96('0x2f')](_0x6b258e['model'],qs['fields'](_0x191437['query'][_0x5c96('0x32')]));_0x211376[_0x5c96('0x31')]=_0x211376[_0x5c96('0x31')][_0x5c96('0x40')]?_0x211376[_0x5c96('0x31')]:_0x6b258e[_0x5c96('0x2c')];if(_0x191437[_0x5c96('0x30')]['includeAll']){_0x211376[_0x5c96('0x3c')]=[{'all':!![]}];}_0x211376=_[_0x5c96('0x39')]({},_0x211376,_0x191437[_0x5c96('0x3a')]);return db[_0x5c96('0x28')][_0x5c96('0x41')](_0x211376)[_0x5c96('0x22')](handleEntityNotFound(_0x3909ef,null))['then'](respondWithResult(_0x3909ef,null))[_0x5c96('0x3e')](handleError(_0x3909ef,null));};exports[_0x5c96('0x42')]=function(_0x3ea168,_0xb7127a){return db[_0x5c96('0x28')][_0x5c96('0x42')](_0x3ea168['body'],{})[_0x5c96('0x22')](respondWithResult(_0xb7127a,0xc9))['catch'](handleError(_0xb7127a,null));};exports[_0x5c96('0x21')]=function(_0x5293bf,_0x4a74d9){if(_0x5293bf[_0x5c96('0x43')]['id']){delete _0x5293bf['body']['id'];}return db[_0x5c96('0x28')][_0x5c96('0x41')]({'where':{'id':_0x5293bf['params']['id']}})[_0x5c96('0x22')](handleEntityNotFound(_0x4a74d9,null))[_0x5c96('0x22')](saveUpdates(_0x5293bf[_0x5c96('0x43')],null))['then'](respondWithResult(_0x4a74d9,null))[_0x5c96('0x3e')](handleError(_0x4a74d9,null));};exports[_0x5c96('0x23')]=function(_0x3d835a,_0x43e8da){return db[_0x5c96('0x28')]['find']({'where':{'id':_0x3d835a[_0x5c96('0x44')]['id']}})['then'](handleEntityNotFound(_0x43e8da,null))[_0x5c96('0x22')](removeEntity(_0x43e8da,null))[_0x5c96('0x3e')](handleError(_0x43e8da,null));};exports[_0x5c96('0x45')]=function(_0x5ab7da,_0xf686cc,_0x5d20d6){var _0x286719={};var _0x30f86a={};var _0xccf1e0;var _0x55b368;return db['SugarcrmConfiguration'][_0x5c96('0x46')]({'where':{'id':_0x5ab7da[_0x5c96('0x44')]['id']}})[_0x5c96('0x22')](handleEntityNotFound(_0xf686cc,null))[_0x5c96('0x22')](function(_0xae2c4e){if(_0xae2c4e){_0xccf1e0=_0xae2c4e;_0x30f86a[_0x5c96('0x2c')]=_[_0x5c96('0x2d')](db[_0x5c96('0x47')][_0x5c96('0x29')]);_0x30f86a['query']=_[_0x5c96('0x2d')](_0x5ab7da[_0x5c96('0x30')]);_0x30f86a[_0x5c96('0x2e')]=_[_0x5c96('0x2f')](_0x30f86a[_0x5c96('0x2c')],_0x30f86a[_0x5c96('0x30')]);_0x286719[_0x5c96('0x31')]=_[_0x5c96('0x2f')](_0x30f86a['model'],qs[_0x5c96('0x32')](_0x5ab7da[_0x5c96('0x30')][_0x5c96('0x32')]));_0x286719['attributes']=_0x286719['attributes']['length']?_0x286719[_0x5c96('0x31')]:_0x30f86a['model'];_0x286719[_0x5c96('0x35')]=qs['sort'](_0x5ab7da[_0x5c96('0x30')]['sort']);_0x286719[_0x5c96('0x37')]=qs[_0x5c96('0x2e')](_[_0x5c96('0x48')](_0x5ab7da['query'],_0x30f86a[_0x5c96('0x2e')]));if(_0x5ab7da['query'][_0x5c96('0x38')]){_0x286719[_0x5c96('0x37')]=_['merge'](_0x286719[_0x5c96('0x37')],{'$or':_[_0x5c96('0x27')](_0x286719[_0x5c96('0x31')],function(_0x59288b){var _0x4f1d4c={};_0x4f1d4c[_0x59288b]={'$like':'%'+_0x5ab7da['query'][_0x5c96('0x38')]+'%'};return _0x4f1d4c;})});}_0x286719=_[_0x5c96('0x39')]({},_0x286719,_0x5ab7da[_0x5c96('0x3a')]);return _0xccf1e0[_0x5c96('0x45')](_0x286719);}})[_0x5c96('0x22')](function(_0x54f54c){if(_0x54f54c){_0x55b368=_0x54f54c[_0x5c96('0x40')];if(!_0x5ab7da[_0x5c96('0x30')]['hasOwnProperty']('nolimit')){_0x286719['limit']=qs[_0x5c96('0x1a')](_0x5ab7da['query']['limit']);_0x286719[_0x5c96('0x1b')]=qs[_0x5c96('0x1b')](_0x5ab7da[_0x5c96('0x30')][_0x5c96('0x1b')]);}return _0xccf1e0['getFields'](_0x286719);}})[_0x5c96('0x22')](function(_0x42d26a){if(_0x42d26a){return _0x42d26a?{'count':_0x55b368,'rows':_0x42d26a}:null;}})[_0x5c96('0x22')](respondWithResult(_0xf686cc,null))['catch'](handleError(_0xf686cc,null));};exports['getSubjects']=function(_0x203e42,_0x54fe13,_0x32e9ef){var _0x1f4531={};var _0x3655f5={};var _0x8bb999;var _0x397b22;return db[_0x5c96('0x28')][_0x5c96('0x46')]({'where':{'id':_0x203e42['params']['id']}})['then'](handleEntityNotFound(_0x54fe13,null))[_0x5c96('0x22')](function(_0x4edfc1){if(_0x4edfc1){_0x8bb999=_0x4edfc1;_0x3655f5[_0x5c96('0x2c')]=_[_0x5c96('0x2d')](db[_0x5c96('0x47')][_0x5c96('0x29')]);_0x3655f5[_0x5c96('0x30')]=_[_0x5c96('0x2d')](_0x203e42['query']);_0x3655f5[_0x5c96('0x2e')]=_[_0x5c96('0x2f')](_0x3655f5[_0x5c96('0x2c')],_0x3655f5[_0x5c96('0x30')]);_0x1f4531['attributes']=_[_0x5c96('0x2f')](_0x3655f5[_0x5c96('0x2c')],qs[_0x5c96('0x32')](_0x203e42[_0x5c96('0x30')][_0x5c96('0x32')]));_0x1f4531['attributes']=_0x1f4531['attributes'][_0x5c96('0x40')]?_0x1f4531[_0x5c96('0x31')]:_0x3655f5['model'];_0x1f4531['order']=qs[_0x5c96('0x36')](_0x203e42[_0x5c96('0x30')][_0x5c96('0x36')]);_0x1f4531[_0x5c96('0x37')]=qs[_0x5c96('0x2e')](_[_0x5c96('0x48')](_0x203e42[_0x5c96('0x30')],_0x3655f5[_0x5c96('0x2e')]));if(_0x203e42[_0x5c96('0x30')][_0x5c96('0x38')]){_0x1f4531[_0x5c96('0x37')]=_[_0x5c96('0x39')](_0x1f4531[_0x5c96('0x37')],{'$or':_[_0x5c96('0x27')](_0x1f4531[_0x5c96('0x31')],function(_0x57b8ef){var _0xdabcac={};_0xdabcac[_0x57b8ef]={'$like':'%'+_0x203e42['query'][_0x5c96('0x38')]+'%'};return _0xdabcac;})});}_0x1f4531=_['merge']({},_0x1f4531,_0x203e42[_0x5c96('0x3a')]);return _0x8bb999['getSubjects'](_0x1f4531);}})[_0x5c96('0x22')](function(_0xdcf83b){if(_0xdcf83b){_0x397b22=_0xdcf83b[_0x5c96('0x40')];if(!_0x203e42['query'][_0x5c96('0x33')](_0x5c96('0x34'))){_0x1f4531[_0x5c96('0x1a')]=qs[_0x5c96('0x1a')](_0x203e42['query'][_0x5c96('0x1a')]);_0x1f4531[_0x5c96('0x1b')]=qs['offset'](_0x203e42['query']['offset']);}return _0x8bb999[_0x5c96('0x49')](_0x1f4531);}})[_0x5c96('0x22')](function(_0x52b028){if(_0x52b028){return _0x52b028?{'count':_0x397b22,'rows':_0x52b028}:null;}})[_0x5c96('0x22')](respondWithResult(_0x54fe13,null))['catch'](handleError(_0x54fe13,null));};exports[_0x5c96('0x4a')]=function(_0x4d580e,_0x31f4e3,_0x262eed){var _0x7390ef={};var _0x5eb38b={};var _0x1486bf;var _0x246362;return db[_0x5c96('0x28')][_0x5c96('0x46')]({'where':{'id':_0x4d580e[_0x5c96('0x44')]['id']}})[_0x5c96('0x22')](handleEntityNotFound(_0x31f4e3,null))['then'](function(_0x188559){if(_0x188559){_0x1486bf=_0x188559;_0x5eb38b['model']=_[_0x5c96('0x2d')](db['SugarcrmField']['rawAttributes']);_0x5eb38b['query']=_[_0x5c96('0x2d')](_0x4d580e['query']);_0x5eb38b[_0x5c96('0x2e')]=_[_0x5c96('0x2f')](_0x5eb38b[_0x5c96('0x2c')],_0x5eb38b[_0x5c96('0x30')]);_0x7390ef[_0x5c96('0x31')]=_[_0x5c96('0x2f')](_0x5eb38b[_0x5c96('0x2c')],qs[_0x5c96('0x32')](_0x4d580e['query'][_0x5c96('0x32')]));_0x7390ef[_0x5c96('0x31')]=_0x7390ef[_0x5c96('0x31')][_0x5c96('0x40')]?_0x7390ef[_0x5c96('0x31')]:_0x5eb38b[_0x5c96('0x2c')];_0x7390ef[_0x5c96('0x35')]=qs['sort'](_0x4d580e[_0x5c96('0x30')][_0x5c96('0x36')]);_0x7390ef[_0x5c96('0x37')]=qs[_0x5c96('0x2e')](_['pick'](_0x4d580e[_0x5c96('0x30')],_0x5eb38b[_0x5c96('0x2e')]));if(_0x4d580e[_0x5c96('0x30')][_0x5c96('0x38')]){_0x7390ef[_0x5c96('0x37')]=_[_0x5c96('0x39')](_0x7390ef[_0x5c96('0x37')],{'$or':_['map'](_0x7390ef[_0x5c96('0x31')],function(_0x36e321){var _0x157e26={};_0x157e26[_0x36e321]={'$like':'%'+_0x4d580e[_0x5c96('0x30')][_0x5c96('0x38')]+'%'};return _0x157e26;})});}_0x7390ef=_[_0x5c96('0x39')]({},_0x7390ef,_0x4d580e[_0x5c96('0x3a')]);return _0x1486bf[_0x5c96('0x4a')](_0x7390ef);}})['then'](function(_0x38d288){if(_0x38d288){_0x246362=_0x38d288['length'];if(!_0x4d580e[_0x5c96('0x30')][_0x5c96('0x33')]('nolimit')){_0x7390ef[_0x5c96('0x1a')]=qs[_0x5c96('0x1a')](_0x4d580e[_0x5c96('0x30')][_0x5c96('0x1a')]);_0x7390ef[_0x5c96('0x1b')]=qs[_0x5c96('0x1b')](_0x4d580e[_0x5c96('0x30')]['offset']);}return _0x1486bf[_0x5c96('0x4a')](_0x7390ef);}})['then'](function(_0x21bfad){if(_0x21bfad){return _0x21bfad?{'count':_0x246362,'rows':_0x21bfad}:null;}})[_0x5c96('0x22')](respondWithResult(_0x31f4e3,null))['catch'](handleError(_0x31f4e3,null));}; \ No newline at end of file +var _0x1934=['fields','length','limit','order','sort','where','pick','filters','filter','options','findAll','rows','catch','show','params','includeAll','create','body','find','destroy','SugarcrmField','rawAttributes','getFields','hasOwnProperty','nolimit','getSubjects','findOne','merge','getDescriptions','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','SugarcrmConfiguration','type','key','model','query','keys','intersection','attributes'];(function(_0x367e5b,_0x5721e4){var _0x4b909e=function(_0x22c6a4){while(--_0x22c6a4){_0x367e5b['push'](_0x367e5b['shift']());}};_0x4b909e(++_0x5721e4);}(_0x1934,0xbd));var _0x4193=function(_0x1cac97,_0x14901b){_0x1cac97=_0x1cac97-0x0;var _0xc47a1=_0x1934[_0x1cac97];return _0xc47a1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4193('0x0'));var zipdir=require(_0x4193('0x1'));var jsonpatch=require(_0x4193('0x2'));var rp=require('request-promise');var moment=require(_0x4193('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x4193('0x4'));var util=require(_0x4193('0x5'));var path=require(_0x4193('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4193('0x7'));var _=require(_0x4193('0x8'));var squel=require(_0x4193('0x9'));var crypto=require(_0x4193('0xa'));var jsforce=require(_0x4193('0xb'));var deskjs=require(_0x4193('0xc'));var toCsv=require('to-csv');var querystring=require(_0x4193('0xd'));var Papa=require(_0x4193('0xe'));var Redis=require(_0x4193('0xf'));var authService=require(_0x4193('0x10'));var qs=require(_0x4193('0x11'));var as=require(_0x4193('0x12'));var hardwareService=require(_0x4193('0x13'));var logger=require(_0x4193('0x14'))(_0x4193('0x15'));var utils=require('../../config/utils');var config=require(_0x4193('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x4193('0x17'))['db'];function respondWithStatusCode(_0x2e29f2,_0x426e44){_0x426e44=_0x426e44||0xcc;return function(_0x180207){if(_0x180207){return _0x2e29f2[_0x4193('0x18')](_0x426e44);}return _0x2e29f2[_0x4193('0x19')](_0x426e44)[_0x4193('0x1a')]();};}function respondWithResult(_0x3d2998,_0x100dff){_0x100dff=_0x100dff||0xc8;return function(_0x5297b3){if(_0x5297b3){return _0x3d2998[_0x4193('0x19')](_0x100dff)['json'](_0x5297b3);}};}function respondWithFilteredResult(_0x18f8fc,_0x20e462){return function(_0x45678b){if(_0x45678b){var _0x50eb2e=typeof _0x20e462[_0x4193('0x1b')]===_0x4193('0x1c')&&typeof _0x20e462['limit']==='undefined';var _0x5a760f=_0x45678b[_0x4193('0x1d')];var _0x2d19b3=_0x50eb2e?0x0:_0x20e462[_0x4193('0x1b')];var _0x59d933=_0x50eb2e?_0x45678b[_0x4193('0x1d')]:_0x20e462['offset']+_0x20e462['limit'];var _0x53b101;if(_0x59d933>=_0x5a760f){_0x59d933=_0x5a760f;_0x53b101=0xc8;}else{_0x53b101=0xce;}_0x18f8fc[_0x4193('0x19')](_0x53b101);return _0x18f8fc[_0x4193('0x1e')](_0x4193('0x1f'),_0x2d19b3+'-'+_0x59d933+'/'+_0x5a760f)['json'](_0x45678b);}return null;};}function patchUpdates(_0x48c604){return function(_0x1fa05d){try{jsonpatch[_0x4193('0x20')](_0x1fa05d,_0x48c604,!![]);}catch(_0x784945){return BPromise[_0x4193('0x21')](_0x784945);}return _0x1fa05d[_0x4193('0x22')]();};}function saveUpdates(_0xd83b6c,_0x3694a3){return function(_0x13fa7b){if(_0x13fa7b){return _0x13fa7b[_0x4193('0x23')](_0xd83b6c)[_0x4193('0x24')](function(_0x12e644){return _0x12e644;});}return null;};}function removeEntity(_0x53baa3,_0x565396){return function(_0x406a0f){if(_0x406a0f){return _0x406a0f['destroy']()[_0x4193('0x24')](function(){_0x53baa3[_0x4193('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0xd584f1,_0x331a89){return function(_0x353366){if(!_0x353366){_0xd584f1[_0x4193('0x18')](0x194);}return _0x353366;};}function handleError(_0xf62f59,_0x10449c){_0x10449c=_0x10449c||0x1f4;return function(_0x4fe5fe){logger[_0x4193('0x25')](_0x4fe5fe[_0x4193('0x26')]);if(_0x4fe5fe[_0x4193('0x27')]){delete _0x4fe5fe[_0x4193('0x27')];}_0xf62f59[_0x4193('0x19')](_0x10449c)[_0x4193('0x28')](_0x4fe5fe);};}exports[_0x4193('0x29')]=function(_0x3e495b,_0x1635b8){var _0x5b356d={},_0x3d72d6={},_0x5c7661={'count':0x0,'rows':[]};var _0x284d17=_[_0x4193('0x2a')](db[_0x4193('0x2b')]['rawAttributes'],function(_0xb8a33b){return{'name':_0xb8a33b['fieldName'],'type':_0xb8a33b[_0x4193('0x2c')][_0x4193('0x2d')]};});_0x3d72d6[_0x4193('0x2e')]=_['map'](_0x284d17,_0x4193('0x27'));_0x3d72d6[_0x4193('0x2f')]=_[_0x4193('0x30')](_0x3e495b[_0x4193('0x2f')]);_0x3d72d6['filters']=_[_0x4193('0x31')](_0x3d72d6[_0x4193('0x2e')],_0x3d72d6[_0x4193('0x2f')]);_0x5b356d[_0x4193('0x32')]=_[_0x4193('0x31')](_0x3d72d6[_0x4193('0x2e')],qs[_0x4193('0x33')](_0x3e495b[_0x4193('0x2f')]['fields']));_0x5b356d['attributes']=_0x5b356d[_0x4193('0x32')][_0x4193('0x34')]?_0x5b356d[_0x4193('0x32')]:_0x3d72d6[_0x4193('0x2e')];if(!_0x3e495b[_0x4193('0x2f')]['hasOwnProperty']('nolimit')){_0x5b356d[_0x4193('0x35')]=qs[_0x4193('0x35')](_0x3e495b[_0x4193('0x2f')][_0x4193('0x35')]);_0x5b356d[_0x4193('0x1b')]=qs[_0x4193('0x1b')](_0x3e495b[_0x4193('0x2f')][_0x4193('0x1b')]);}_0x5b356d[_0x4193('0x36')]=qs[_0x4193('0x37')](_0x3e495b['query'][_0x4193('0x37')]);_0x5b356d[_0x4193('0x38')]=qs['filters'](_[_0x4193('0x39')](_0x3e495b[_0x4193('0x2f')],_0x3d72d6[_0x4193('0x3a')]),_0x284d17);if(_0x3e495b[_0x4193('0x2f')][_0x4193('0x3b')]){_0x5b356d[_0x4193('0x38')]=_['merge'](_0x5b356d['where'],{'$or':_[_0x4193('0x2a')](_0x284d17,function(_0x2c0236){if(_0x2c0236[_0x4193('0x2c')]!=='VIRTUAL'){var _0x1c529b={};_0x1c529b[_0x2c0236[_0x4193('0x27')]]={'$like':'%'+_0x3e495b['query'][_0x4193('0x3b')]+'%'};return _0x1c529b;}})});}_0x5b356d=_['merge']({},_0x5b356d,_0x3e495b[_0x4193('0x3c')]);var _0x2c3f6e={'where':_0x5b356d[_0x4193('0x38')]};return db[_0x4193('0x2b')]['count'](_0x2c3f6e)['then'](function(_0x4f54d2){_0x5c7661[_0x4193('0x1d')]=_0x4f54d2;if(_0x3e495b[_0x4193('0x2f')]['includeAll']){_0x5b356d['include']=[{'all':!![]}];}return db[_0x4193('0x2b')][_0x4193('0x3d')](_0x5b356d);})[_0x4193('0x24')](function(_0x2155d2){_0x5c7661[_0x4193('0x3e')]=_0x2155d2;return _0x5c7661;})[_0x4193('0x24')](respondWithFilteredResult(_0x1635b8,_0x5b356d))[_0x4193('0x3f')](handleError(_0x1635b8,null));};exports[_0x4193('0x40')]=function(_0x3b73d8,_0x574ad4){var _0x480acf={'raw':![],'where':{'id':_0x3b73d8[_0x4193('0x41')]['id']}},_0x4f754d={};_0x4f754d['model']=_[_0x4193('0x30')](db[_0x4193('0x2b')]['rawAttributes']);_0x4f754d[_0x4193('0x2f')]=_[_0x4193('0x30')](_0x3b73d8['query']);_0x4f754d[_0x4193('0x3a')]=_[_0x4193('0x31')](_0x4f754d[_0x4193('0x2e')],_0x4f754d[_0x4193('0x2f')]);_0x480acf[_0x4193('0x32')]=_['intersection'](_0x4f754d[_0x4193('0x2e')],qs[_0x4193('0x33')](_0x3b73d8[_0x4193('0x2f')][_0x4193('0x33')]));_0x480acf['attributes']=_0x480acf['attributes'][_0x4193('0x34')]?_0x480acf[_0x4193('0x32')]:_0x4f754d[_0x4193('0x2e')];if(_0x3b73d8[_0x4193('0x2f')][_0x4193('0x42')]){_0x480acf['include']=[{'all':!![]}];}_0x480acf=_['merge']({},_0x480acf,_0x3b73d8[_0x4193('0x3c')]);return db[_0x4193('0x2b')]['find'](_0x480acf)[_0x4193('0x24')](handleEntityNotFound(_0x574ad4,null))['then'](respondWithResult(_0x574ad4,null))[_0x4193('0x3f')](handleError(_0x574ad4,null));};exports[_0x4193('0x43')]=function(_0x1982c6,_0x3676e6){return db[_0x4193('0x2b')][_0x4193('0x43')](_0x1982c6[_0x4193('0x44')],{})['then'](respondWithResult(_0x3676e6,0xc9))[_0x4193('0x3f')](handleError(_0x3676e6,null));};exports[_0x4193('0x23')]=function(_0xfebb64,_0x149540){if(_0xfebb64[_0x4193('0x44')]['id']){delete _0xfebb64[_0x4193('0x44')]['id'];}return db[_0x4193('0x2b')][_0x4193('0x45')]({'where':{'id':_0xfebb64[_0x4193('0x41')]['id']}})['then'](handleEntityNotFound(_0x149540,null))[_0x4193('0x24')](saveUpdates(_0xfebb64[_0x4193('0x44')],null))[_0x4193('0x24')](respondWithResult(_0x149540,null))[_0x4193('0x3f')](handleError(_0x149540,null));};exports[_0x4193('0x46')]=function(_0x447d46,_0x976ffe){return db[_0x4193('0x2b')][_0x4193('0x45')]({'where':{'id':_0x447d46[_0x4193('0x41')]['id']}})[_0x4193('0x24')](handleEntityNotFound(_0x976ffe,null))['then'](removeEntity(_0x976ffe,null))['catch'](handleError(_0x976ffe,null));};exports['getFields']=function(_0x5744e0,_0x40ab11,_0x13dcc1){var _0x1d9975={};var _0x25b533={};var _0x2867df;var _0x1d8f09;return db[_0x4193('0x2b')]['findOne']({'where':{'id':_0x5744e0[_0x4193('0x41')]['id']}})[_0x4193('0x24')](handleEntityNotFound(_0x40ab11,null))['then'](function(_0x2a7940){if(_0x2a7940){_0x2867df=_0x2a7940;_0x25b533[_0x4193('0x2e')]=_[_0x4193('0x30')](db[_0x4193('0x47')][_0x4193('0x48')]);_0x25b533[_0x4193('0x2f')]=_[_0x4193('0x30')](_0x5744e0[_0x4193('0x2f')]);_0x25b533[_0x4193('0x3a')]=_[_0x4193('0x31')](_0x25b533[_0x4193('0x2e')],_0x25b533[_0x4193('0x2f')]);_0x1d9975[_0x4193('0x32')]=_[_0x4193('0x31')](_0x25b533[_0x4193('0x2e')],qs[_0x4193('0x33')](_0x5744e0[_0x4193('0x2f')][_0x4193('0x33')]));_0x1d9975[_0x4193('0x32')]=_0x1d9975['attributes'][_0x4193('0x34')]?_0x1d9975[_0x4193('0x32')]:_0x25b533[_0x4193('0x2e')];_0x1d9975[_0x4193('0x36')]=qs[_0x4193('0x37')](_0x5744e0[_0x4193('0x2f')][_0x4193('0x37')]);_0x1d9975[_0x4193('0x38')]=qs['filters'](_[_0x4193('0x39')](_0x5744e0[_0x4193('0x2f')],_0x25b533['filters']));if(_0x5744e0[_0x4193('0x2f')][_0x4193('0x3b')]){_0x1d9975[_0x4193('0x38')]=_['merge'](_0x1d9975[_0x4193('0x38')],{'$or':_['map'](_0x1d9975[_0x4193('0x32')],function(_0x8b7da0){var _0x56c788={};_0x56c788[_0x8b7da0]={'$like':'%'+_0x5744e0[_0x4193('0x2f')][_0x4193('0x3b')]+'%'};return _0x56c788;})});}_0x1d9975=_['merge']({},_0x1d9975,_0x5744e0[_0x4193('0x3c')]);return _0x2867df[_0x4193('0x49')](_0x1d9975);}})[_0x4193('0x24')](function(_0x4fa100){if(_0x4fa100){_0x1d8f09=_0x4fa100[_0x4193('0x34')];if(!_0x5744e0['query'][_0x4193('0x4a')](_0x4193('0x4b'))){_0x1d9975['limit']=qs[_0x4193('0x35')](_0x5744e0[_0x4193('0x2f')][_0x4193('0x35')]);_0x1d9975['offset']=qs[_0x4193('0x1b')](_0x5744e0[_0x4193('0x2f')]['offset']);}return _0x2867df[_0x4193('0x49')](_0x1d9975);}})['then'](function(_0x61a710){if(_0x61a710){return _0x61a710?{'count':_0x1d8f09,'rows':_0x61a710}:null;}})['then'](respondWithResult(_0x40ab11,null))['catch'](handleError(_0x40ab11,null));};exports[_0x4193('0x4c')]=function(_0x25e290,_0x1c52ca,_0x2dc57b){var _0x21088c={};var _0x3d476f={};var _0x444c91;var _0x4f24ae;return db[_0x4193('0x2b')][_0x4193('0x4d')]({'where':{'id':_0x25e290[_0x4193('0x41')]['id']}})['then'](handleEntityNotFound(_0x1c52ca,null))[_0x4193('0x24')](function(_0x1d2a83){if(_0x1d2a83){_0x444c91=_0x1d2a83;_0x3d476f[_0x4193('0x2e')]=_[_0x4193('0x30')](db['SugarcrmField'][_0x4193('0x48')]);_0x3d476f[_0x4193('0x2f')]=_[_0x4193('0x30')](_0x25e290['query']);_0x3d476f['filters']=_['intersection'](_0x3d476f[_0x4193('0x2e')],_0x3d476f[_0x4193('0x2f')]);_0x21088c[_0x4193('0x32')]=_[_0x4193('0x31')](_0x3d476f['model'],qs['fields'](_0x25e290[_0x4193('0x2f')][_0x4193('0x33')]));_0x21088c[_0x4193('0x32')]=_0x21088c['attributes']['length']?_0x21088c[_0x4193('0x32')]:_0x3d476f[_0x4193('0x2e')];_0x21088c[_0x4193('0x36')]=qs[_0x4193('0x37')](_0x25e290['query']['sort']);_0x21088c['where']=qs[_0x4193('0x3a')](_[_0x4193('0x39')](_0x25e290[_0x4193('0x2f')],_0x3d476f[_0x4193('0x3a')]));if(_0x25e290['query'][_0x4193('0x3b')]){_0x21088c[_0x4193('0x38')]=_[_0x4193('0x4e')](_0x21088c['where'],{'$or':_[_0x4193('0x2a')](_0x21088c[_0x4193('0x32')],function(_0x916870){var _0x25bb49={};_0x25bb49[_0x916870]={'$like':'%'+_0x25e290['query'][_0x4193('0x3b')]+'%'};return _0x25bb49;})});}_0x21088c=_[_0x4193('0x4e')]({},_0x21088c,_0x25e290[_0x4193('0x3c')]);return _0x444c91[_0x4193('0x4c')](_0x21088c);}})[_0x4193('0x24')](function(_0x1dbe3f){if(_0x1dbe3f){_0x4f24ae=_0x1dbe3f[_0x4193('0x34')];if(!_0x25e290[_0x4193('0x2f')][_0x4193('0x4a')]('nolimit')){_0x21088c[_0x4193('0x35')]=qs['limit'](_0x25e290[_0x4193('0x2f')][_0x4193('0x35')]);_0x21088c[_0x4193('0x1b')]=qs[_0x4193('0x1b')](_0x25e290['query'][_0x4193('0x1b')]);}return _0x444c91[_0x4193('0x4c')](_0x21088c);}})[_0x4193('0x24')](function(_0x9bd463){if(_0x9bd463){return _0x9bd463?{'count':_0x4f24ae,'rows':_0x9bd463}:null;}})['then'](respondWithResult(_0x1c52ca,null))[_0x4193('0x3f')](handleError(_0x1c52ca,null));};exports[_0x4193('0x4f')]=function(_0x3b06b2,_0x928f1b,_0x57a366){var _0x17372a={};var _0x2d510a={};var _0x5051c0;var _0x7f07cb;return db['SugarcrmConfiguration'][_0x4193('0x4d')]({'where':{'id':_0x3b06b2[_0x4193('0x41')]['id']}})[_0x4193('0x24')](handleEntityNotFound(_0x928f1b,null))['then'](function(_0x6ccca0){if(_0x6ccca0){_0x5051c0=_0x6ccca0;_0x2d510a[_0x4193('0x2e')]=_[_0x4193('0x30')](db[_0x4193('0x47')]['rawAttributes']);_0x2d510a[_0x4193('0x2f')]=_[_0x4193('0x30')](_0x3b06b2['query']);_0x2d510a[_0x4193('0x3a')]=_[_0x4193('0x31')](_0x2d510a[_0x4193('0x2e')],_0x2d510a[_0x4193('0x2f')]);_0x17372a[_0x4193('0x32')]=_[_0x4193('0x31')](_0x2d510a['model'],qs[_0x4193('0x33')](_0x3b06b2['query'][_0x4193('0x33')]));_0x17372a[_0x4193('0x32')]=_0x17372a[_0x4193('0x32')][_0x4193('0x34')]?_0x17372a['attributes']:_0x2d510a['model'];_0x17372a[_0x4193('0x36')]=qs[_0x4193('0x37')](_0x3b06b2['query']['sort']);_0x17372a[_0x4193('0x38')]=qs[_0x4193('0x3a')](_['pick'](_0x3b06b2[_0x4193('0x2f')],_0x2d510a[_0x4193('0x3a')]));if(_0x3b06b2[_0x4193('0x2f')][_0x4193('0x3b')]){_0x17372a[_0x4193('0x38')]=_['merge'](_0x17372a[_0x4193('0x38')],{'$or':_[_0x4193('0x2a')](_0x17372a[_0x4193('0x32')],function(_0x997fa4){var _0x31ff9c={};_0x31ff9c[_0x997fa4]={'$like':'%'+_0x3b06b2[_0x4193('0x2f')]['filter']+'%'};return _0x31ff9c;})});}_0x17372a=_[_0x4193('0x4e')]({},_0x17372a,_0x3b06b2[_0x4193('0x3c')]);return _0x5051c0[_0x4193('0x4f')](_0x17372a);}})[_0x4193('0x24')](function(_0x7570ad){if(_0x7570ad){_0x7f07cb=_0x7570ad[_0x4193('0x34')];if(!_0x3b06b2[_0x4193('0x2f')]['hasOwnProperty']('nolimit')){_0x17372a[_0x4193('0x35')]=qs[_0x4193('0x35')](_0x3b06b2['query'][_0x4193('0x35')]);_0x17372a[_0x4193('0x1b')]=qs['offset'](_0x3b06b2['query'][_0x4193('0x1b')]);}return _0x5051c0[_0x4193('0x4f')](_0x17372a);}})[_0x4193('0x24')](function(_0xee442d){if(_0xee442d){return _0xee442d?{'count':_0x7f07cb,'rows':_0xee442d}:null;}})['then'](respondWithResult(_0x928f1b,null))[_0x4193('0x3f')](handleError(_0x928f1b,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index 4256a28..5a465e8 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 _0x1f0d=['path','rimraf','./intSugarcrmConfiguration.attributes','exports','define','SugarcrmConfiguration','int_sugarcrm_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x2b281b,_0x360f48){var _0x514213=function(_0x2d9ac1){while(--_0x2d9ac1){_0x2b281b['push'](_0x2b281b['shift']());}};_0x514213(++_0x360f48);}(_0x1f0d,0x165));var _0xd1f0=function(_0xd9c42e,_0x235dbf){_0xd9c42e=_0xd9c42e-0x0;var _0x326d74=_0x1f0d[_0xd9c42e];return _0x326d74;};'use strict';var _=require(_0xd1f0('0x0'));var util=require(_0xd1f0('0x1'));var logger=require(_0xd1f0('0x2'))(_0xd1f0('0x3'));var moment=require(_0xd1f0('0x4'));var BPromise=require(_0xd1f0('0x5'));var rp=require(_0xd1f0('0x6'));var fs=require('fs');var path=require(_0xd1f0('0x7'));var rimraf=require(_0xd1f0('0x8'));var config=require('../../config/environment');var attributes=require(_0xd1f0('0x9'));module[_0xd1f0('0xa')]=function(_0x21dce4,_0x595cd0){return _0x21dce4[_0xd1f0('0xb')](_0xd1f0('0xc'),attributes,{'tableName':_0xd1f0('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc30a=['rimraf','../../config/environment','./intSugarcrmConfiguration.attributes','exports','SugarcrmConfiguration','int_sugarcrm_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x460b85,_0x5c5149){var _0xabc1db=function(_0x54eff6){while(--_0x54eff6){_0x460b85['push'](_0x460b85['shift']());}};_0xabc1db(++_0x5c5149);}(_0xc30a,0x172));var _0xac30=function(_0x397cfb,_0xb8f317){_0x397cfb=_0x397cfb-0x0;var _0x15fed9=_0xc30a[_0x397cfb];return _0x15fed9;};'use strict';var _=require(_0xac30('0x0'));var util=require(_0xac30('0x1'));var logger=require(_0xac30('0x2'))(_0xac30('0x3'));var moment=require(_0xac30('0x4'));var BPromise=require(_0xac30('0x5'));var rp=require(_0xac30('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xac30('0x7'));var config=require(_0xac30('0x8'));var attributes=require(_0xac30('0x9'));module[_0xac30('0xa')]=function(_0x24c5c0,_0x4bc768){return _0x24c5c0['define'](_0xac30('0xb'),attributes,{'tableName':_0xac30('0xc'),'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 34693fc..3144af5 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 _0xda96=['client','http','info','SugarcrmConfiguration,\x20%s,\x20%s','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x2f89d5,_0x53affd){var _0x16f8b8=function(_0x5e3dfd){while(--_0x5e3dfd){_0x2f89d5['push'](_0x2f89d5['shift']());}};_0x16f8b8(++_0x53affd);}(_0xda96,0x175));var _0x6da9=function(_0x560634,_0x1674cc){_0x560634=_0x560634-0x0;var _0x27bdba=_0xda96[_0x560634];return _0x27bdba;};'use strict';var _=require(_0x6da9('0x0'));var util=require('util');var moment=require(_0x6da9('0x1'));var BPromise=require(_0x6da9('0x2'));var rs=require(_0x6da9('0x3'));var fs=require('fs');var Redis=require(_0x6da9('0x4'));var db=require(_0x6da9('0x5'))['db'];var utils=require(_0x6da9('0x6'));var logger=require(_0x6da9('0x7'))(_0x6da9('0x8'));var config=require(_0x6da9('0x9'));var jayson=require(_0x6da9('0xa'));var client=jayson[_0x6da9('0xb')][_0x6da9('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x327877,_0x1c2736,_0x1c7a72){return new BPromise(function(_0x56116c,_0xf41307){return client['request'](_0x327877,_0x1c7a72)['then'](function(_0x399d70){logger[_0x6da9('0xd')](_0x6da9('0xe'),_0x1c2736,'request\x20sent');logger[_0x6da9('0xf')](_0x6da9('0x10'),_0x1c2736,'request\x20sent',JSON[_0x6da9('0x11')](_0x399d70));if(_0x399d70['error']){if(_0x399d70[_0x6da9('0x12')][_0x6da9('0x13')]===0x1f4){logger[_0x6da9('0x12')](_0x6da9('0xe'),_0x1c2736,_0x399d70[_0x6da9('0x12')][_0x6da9('0x14')]);return _0xf41307(_0x399d70['error'][_0x6da9('0x14')]);}logger[_0x6da9('0x12')](_0x6da9('0xe'),_0x1c2736,_0x399d70['error'][_0x6da9('0x14')]);return _0x56116c(_0x399d70[_0x6da9('0x12')]['message']);}else{logger[_0x6da9('0xd')](_0x6da9('0xe'),_0x1c2736,_0x6da9('0x15'));_0x56116c(_0x399d70[_0x6da9('0x16')][_0x6da9('0x14')]);}})[_0x6da9('0x17')](function(_0x30d7de){logger[_0x6da9('0x12')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x1c2736,_0x30d7de);_0xf41307(_0x30d7de);});});} \ No newline at end of file +var _0xef05=['SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xef05,0x177));var _0x5ef0=function(_0x2e64cc,_0x3c4a78){_0x2e64cc=_0x2e64cc-0x0;var _0x86eab4=_0xef05[_0x2e64cc];return _0x86eab4;};'use strict';var _=require(_0x5ef0('0x0'));var util=require('util');var moment=require(_0x5ef0('0x1'));var BPromise=require(_0x5ef0('0x2'));var rs=require(_0x5ef0('0x3'));var fs=require('fs');var Redis=require(_0x5ef0('0x4'));var db=require(_0x5ef0('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x5ef0('0x6'))(_0x5ef0('0x7'));var config=require(_0x5ef0('0x8'));var jayson=require(_0x5ef0('0x9'));var client=jayson[_0x5ef0('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x22c022,_0x12f1e0,_0x3641b){return new BPromise(function(_0x4e2d65,_0x54dc09){return client[_0x5ef0('0xb')](_0x22c022,_0x3641b)['then'](function(_0x423b2d){logger[_0x5ef0('0xc')](_0x5ef0('0xd'),_0x12f1e0,_0x5ef0('0xe'));logger[_0x5ef0('0xf')](_0x5ef0('0x10'),_0x12f1e0,_0x5ef0('0xe'),JSON[_0x5ef0('0x11')](_0x423b2d));if(_0x423b2d[_0x5ef0('0x12')]){if(_0x423b2d[_0x5ef0('0x12')][_0x5ef0('0x13')]===0x1f4){logger[_0x5ef0('0x12')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x12f1e0,_0x423b2d[_0x5ef0('0x12')]['message']);return _0x54dc09(_0x423b2d['error'][_0x5ef0('0x14')]);}logger[_0x5ef0('0x12')](_0x5ef0('0xd'),_0x12f1e0,_0x423b2d[_0x5ef0('0x12')][_0x5ef0('0x14')]);return _0x4e2d65(_0x423b2d[_0x5ef0('0x12')][_0x5ef0('0x14')]);}else{logger['info']('SugarcrmConfiguration,\x20%s,\x20%s',_0x12f1e0,_0x5ef0('0xe'));_0x4e2d65(_0x423b2d[_0x5ef0('0x15')]['message']);}})[_0x5ef0('0x16')](function(_0x29cc15){logger[_0x5ef0('0x12')](_0x5ef0('0xd'),_0x12f1e0,_0x29cc15);_0x54dc09(_0x29cc15);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index 427b04e..60d7c34 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 _0x3664=['express','Router','fs-extra','../../components/interaction/service','./intSugarcrmField.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','exports','multer','path','connect-timeout'];(function(_0x2257c3,_0x38dc9b){var _0x53638c=function(_0x26bcdb){while(--_0x26bcdb){_0x2257c3['push'](_0x2257c3['shift']());}};_0x53638c(++_0x38dc9b);}(_0x3664,0x1eb));var _0x4366=function(_0x4fe7e7,_0x10a581){_0x4fe7e7=_0x4fe7e7-0x0;var _0x1dc756=_0x3664[_0x4fe7e7];return _0x1dc756;};'use strict';var multer=require(_0x4366('0x0'));var util=require('util');var path=require(_0x4366('0x1'));var timeout=require(_0x4366('0x2'));var express=require(_0x4366('0x3'));var router=express[_0x4366('0x4')]();var fs_extra=require(_0x4366('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x4366('0x6'));var config=require('../../config/environment');var controller=require(_0x4366('0x7'));router[_0x4366('0x8')]('/',auth[_0x4366('0x9')](),controller[_0x4366('0xa')]);router[_0x4366('0x8')](_0x4366('0xb'),auth[_0x4366('0x9')](),controller[_0x4366('0xc')]);router[_0x4366('0xd')]('/',auth[_0x4366('0x9')](),controller[_0x4366('0xe')]);router[_0x4366('0xf')]('/:id',auth[_0x4366('0x9')](),controller[_0x4366('0x10')]);router[_0x4366('0x11')]('/:id',auth[_0x4366('0x9')](),controller['destroy']);module[_0x4366('0x12')]=router; \ No newline at end of file +var _0x37b0=['../../components/auth/service','../../components/interaction/service','./intSugarcrmField.controller','get','index','/:id','isAuthenticated','show','post','put','update','delete','exports','util','path','express','Router'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x37b0,0x84));var _0x037b=function(_0x42db95,_0x5e2eda){_0x42db95=_0x42db95-0x0;var _0x13b043=_0x37b0[_0x42db95];return _0x13b043;};'use strict';var multer=require('multer');var util=require(_0x037b('0x0'));var path=require(_0x037b('0x1'));var timeout=require('connect-timeout');var express=require(_0x037b('0x2'));var router=express[_0x037b('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x037b('0x4'));var interaction=require(_0x037b('0x5'));var config=require('../../config/environment');var controller=require(_0x037b('0x6'));router[_0x037b('0x7')]('/',auth['isAuthenticated'](),controller[_0x037b('0x8')]);router[_0x037b('0x7')](_0x037b('0x9'),auth[_0x037b('0xa')](),controller[_0x037b('0xb')]);router[_0x037b('0xc')]('/',auth[_0x037b('0xa')](),controller['create']);router[_0x037b('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x037b('0xe')]);router[_0x037b('0xf')](_0x037b('0x9'),auth['isAuthenticated'](),controller['destroy']);module[_0x037b('0x10')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index 6af7c10..2d3dde6 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 _0x09e0=['keyValue','STRING','customVariable','BOOLEAN','ENUM','string','variable'];(function(_0x564294,_0x23477e){var _0x46b368=function(_0x2523ec){while(--_0x2523ec){_0x564294['push'](_0x564294['shift']());}};_0x46b368(++_0x23477e);}(_0x09e0,0xac));var _0x009e=function(_0x3ab164,_0x2fa5e9){_0x3ab164=_0x3ab164-0x0;var _0x39565e=_0x09e0[_0x3ab164];return _0x39565e;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x009e('0x0')](_0x009e('0x1'),_0x009e('0x2'),'customVariable',_0x009e('0x3'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0x009e('0x4')]},'key':{'type':Sequelize[_0x009e('0x4')]},'keyType':{'type':Sequelize[_0x009e('0x0')]('string','variable',_0x009e('0x5'))},'keyContent':{'type':Sequelize[_0x009e('0x4')]},'idField':{'type':Sequelize[_0x009e('0x4')]},'nameField':{'type':Sequelize[_0x009e('0x4')]},'customField':{'type':Sequelize[_0x009e('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x009e('0x4')]}}; \ No newline at end of file +var _0xc1f2=['ENUM','string','customVariable','picklist','STRING','BOOLEAN','sequelize','exports'];(function(_0x331df3,_0x254452){var _0x4c4bb0=function(_0x25980c){while(--_0x25980c){_0x331df3['push'](_0x331df3['shift']());}};_0x4c4bb0(++_0x254452);}(_0xc1f2,0x196));var _0x2c1f=function(_0x5cc993,_0x4c9b54){_0x5cc993=_0x5cc993-0x0;var _0x35d0e2=_0xc1f2[_0x5cc993];return _0x35d0e2;};'use strict';var Sequelize=require(_0x2c1f('0x0'));module[_0x2c1f('0x1')]={'type':{'type':Sequelize[_0x2c1f('0x2')](_0x2c1f('0x3'),'variable',_0x2c1f('0x4'),'keyValue',_0x2c1f('0x5')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x2c1f('0x2')]('string','variable',_0x2c1f('0x4'))},'keyContent':{'type':Sequelize[_0x2c1f('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x2c1f('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index 15f240b..d4a7f90 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 _0xdafb=['jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','map','SugarcrmField','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','includeAll','include','findAll','catch','params','keys','length','find','create','body','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','squel','crypto'];(function(_0x2dd25a,_0x473907){var _0x59f26c=function(_0x4d2253){while(--_0x4d2253){_0x2dd25a['push'](_0x2dd25a['shift']());}};_0x59f26c(++_0x473907);}(_0xdafb,0xdb));var _0xbdaf=function(_0x42a8d9,_0x2dd442){_0x42a8d9=_0x42a8d9-0x0;var _0x45d8bc=_0xdafb[_0x42a8d9];return _0x45d8bc;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xbdaf('0x0'));var jsonpatch=require(_0xbdaf('0x1'));var rp=require(_0xbdaf('0x2'));var moment=require(_0xbdaf('0x3'));var BPromise=require(_0xbdaf('0x4'));var Mustache=require(_0xbdaf('0x5'));var util=require(_0xbdaf('0x6'));var path=require('path');var sox=require(_0xbdaf('0x7'));var csv=require('to-csv');var ejs=require(_0xbdaf('0x8'));var fs=require('fs');var fs_extra=require(_0xbdaf('0x9'));var _=require('lodash');var squel=require(_0xbdaf('0xa'));var crypto=require(_0xbdaf('0xb'));var jsforce=require(_0xbdaf('0xc'));var deskjs=require(_0xbdaf('0xd'));var toCsv=require('to-csv');var querystring=require(_0xbdaf('0xe'));var Papa=require(_0xbdaf('0xf'));var Redis=require(_0xbdaf('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xbdaf('0x11'));var as=require(_0xbdaf('0x12'));var hardwareService=require(_0xbdaf('0x13'));var logger=require(_0xbdaf('0x14'))(_0xbdaf('0x15'));var utils=require(_0xbdaf('0x16'));var config=require(_0xbdaf('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xbdaf('0x18'))['db'];function respondWithStatusCode(_0x419a77,_0x5b73a5){_0x5b73a5=_0x5b73a5||0xcc;return function(_0xdc766f){if(_0xdc766f){return _0x419a77[_0xbdaf('0x19')](_0x5b73a5);}return _0x419a77[_0xbdaf('0x1a')](_0x5b73a5)['end']();};}function respondWithResult(_0x16b562,_0x1b2ffb){_0x1b2ffb=_0x1b2ffb||0xc8;return function(_0x54f92f){if(_0x54f92f){return _0x16b562[_0xbdaf('0x1a')](_0x1b2ffb)['json'](_0x54f92f);}};}function respondWithFilteredResult(_0x3dcf25,_0x2c0318){return function(_0x5b20ae){if(_0x5b20ae){var _0x32777b=typeof _0x2c0318[_0xbdaf('0x1b')]===_0xbdaf('0x1c')&&typeof _0x2c0318[_0xbdaf('0x1d')]===_0xbdaf('0x1c');var _0x44f18c=_0x5b20ae[_0xbdaf('0x1e')];var _0x264be5=_0x32777b?0x0:_0x2c0318[_0xbdaf('0x1b')];var _0x32c068=_0x32777b?_0x5b20ae[_0xbdaf('0x1e')]:_0x2c0318['offset']+_0x2c0318[_0xbdaf('0x1d')];var _0xb06f6d;if(_0x32c068>=_0x44f18c){_0x32c068=_0x44f18c;_0xb06f6d=0xc8;}else{_0xb06f6d=0xce;}_0x3dcf25[_0xbdaf('0x1a')](_0xb06f6d);return _0x3dcf25[_0xbdaf('0x1f')](_0xbdaf('0x20'),_0x264be5+'-'+_0x32c068+'/'+_0x44f18c)[_0xbdaf('0x21')](_0x5b20ae);}return null;};}function patchUpdates(_0x48e91c){return function(_0x5f1070){try{jsonpatch[_0xbdaf('0x22')](_0x5f1070,_0x48e91c,!![]);}catch(_0x55c4c4){return BPromise[_0xbdaf('0x23')](_0x55c4c4);}return _0x5f1070[_0xbdaf('0x24')]();};}function saveUpdates(_0x360eb8,_0x4365a3){return function(_0x503d27){if(_0x503d27){return _0x503d27[_0xbdaf('0x25')](_0x360eb8)[_0xbdaf('0x26')](function(_0x418129){return _0x418129;});}return null;};}function removeEntity(_0x5d678c,_0x586f36){return function(_0x2ed960){if(_0x2ed960){return _0x2ed960[_0xbdaf('0x27')]()['then'](function(){_0x5d678c[_0xbdaf('0x1a')](0xcc)[_0xbdaf('0x28')]();});}};}function handleEntityNotFound(_0x3d56b2,_0x2e7907){return function(_0x4313e4){if(!_0x4313e4){_0x3d56b2['sendStatus'](0x194);}return _0x4313e4;};}function handleError(_0x38aaad,_0x3ff7e8){_0x3ff7e8=_0x3ff7e8||0x1f4;return function(_0x5f3d75){logger[_0xbdaf('0x29')](_0x5f3d75[_0xbdaf('0x2a')]);if(_0x5f3d75[_0xbdaf('0x2b')]){delete _0x5f3d75['name'];}_0x38aaad[_0xbdaf('0x1a')](_0x3ff7e8)[_0xbdaf('0x2c')](_0x5f3d75);};}exports[_0xbdaf('0x2d')]=function(_0x43b8e3,_0xc44eb8){var _0x4a2ac6={},_0x480f31={},_0x17f7f1={'count':0x0,'rows':[]};var _0x152638=_[_0xbdaf('0x2e')](db[_0xbdaf('0x2f')][_0xbdaf('0x30')],function(_0x412237){return{'name':_0x412237[_0xbdaf('0x31')],'type':_0x412237[_0xbdaf('0x32')][_0xbdaf('0x33')]};});_0x480f31[_0xbdaf('0x34')]=_[_0xbdaf('0x2e')](_0x152638,_0xbdaf('0x2b'));_0x480f31[_0xbdaf('0x35')]=_['keys'](_0x43b8e3[_0xbdaf('0x35')]);_0x480f31[_0xbdaf('0x36')]=_[_0xbdaf('0x37')](_0x480f31['model'],_0x480f31['query']);_0x4a2ac6[_0xbdaf('0x38')]=_[_0xbdaf('0x37')](_0x480f31['model'],qs[_0xbdaf('0x39')](_0x43b8e3['query'][_0xbdaf('0x39')]));_0x4a2ac6[_0xbdaf('0x38')]=_0x4a2ac6[_0xbdaf('0x38')]['length']?_0x4a2ac6[_0xbdaf('0x38')]:_0x480f31[_0xbdaf('0x34')];if(!_0x43b8e3[_0xbdaf('0x35')][_0xbdaf('0x3a')](_0xbdaf('0x3b'))){_0x4a2ac6[_0xbdaf('0x1d')]=qs[_0xbdaf('0x1d')](_0x43b8e3[_0xbdaf('0x35')][_0xbdaf('0x1d')]);_0x4a2ac6['offset']=qs[_0xbdaf('0x1b')](_0x43b8e3['query'][_0xbdaf('0x1b')]);}_0x4a2ac6[_0xbdaf('0x3c')]=qs['sort'](_0x43b8e3[_0xbdaf('0x35')][_0xbdaf('0x3d')]);_0x4a2ac6['where']=qs[_0xbdaf('0x36')](_[_0xbdaf('0x3e')](_0x43b8e3['query'],_0x480f31[_0xbdaf('0x36')]),_0x152638);if(_0x43b8e3[_0xbdaf('0x35')][_0xbdaf('0x3f')]){_0x4a2ac6[_0xbdaf('0x40')]=_[_0xbdaf('0x41')](_0x4a2ac6[_0xbdaf('0x40')],{'$or':_[_0xbdaf('0x2e')](_0x152638,function(_0x351bb5){if(_0x351bb5[_0xbdaf('0x32')]!=='VIRTUAL'){var _0x5939c4={};_0x5939c4[_0x351bb5[_0xbdaf('0x2b')]]={'$like':'%'+_0x43b8e3[_0xbdaf('0x35')][_0xbdaf('0x3f')]+'%'};return _0x5939c4;}})});}_0x4a2ac6=_[_0xbdaf('0x41')]({},_0x4a2ac6,_0x43b8e3[_0xbdaf('0x42')]);var _0x280ee7={'where':_0x4a2ac6[_0xbdaf('0x40')]};return db['SugarcrmField'][_0xbdaf('0x1e')](_0x280ee7)[_0xbdaf('0x26')](function(_0x3c7c90){_0x17f7f1['count']=_0x3c7c90;if(_0x43b8e3[_0xbdaf('0x35')][_0xbdaf('0x43')]){_0x4a2ac6[_0xbdaf('0x44')]=[{'all':!![]}];}return db[_0xbdaf('0x2f')][_0xbdaf('0x45')](_0x4a2ac6);})[_0xbdaf('0x26')](function(_0xe2f5cf){_0x17f7f1['rows']=_0xe2f5cf;return _0x17f7f1;})[_0xbdaf('0x26')](respondWithFilteredResult(_0xc44eb8,_0x4a2ac6))[_0xbdaf('0x46')](handleError(_0xc44eb8,null));};exports['show']=function(_0x3404e7,_0x35818b){var _0x49ae72={'raw':!![],'where':{'id':_0x3404e7[_0xbdaf('0x47')]['id']}},_0x4d0adb={};_0x4d0adb['model']=_[_0xbdaf('0x48')](db[_0xbdaf('0x2f')][_0xbdaf('0x30')]);_0x4d0adb[_0xbdaf('0x35')]=_[_0xbdaf('0x48')](_0x3404e7[_0xbdaf('0x35')]);_0x4d0adb['filters']=_['intersection'](_0x4d0adb[_0xbdaf('0x34')],_0x4d0adb[_0xbdaf('0x35')]);_0x49ae72[_0xbdaf('0x38')]=_[_0xbdaf('0x37')](_0x4d0adb[_0xbdaf('0x34')],qs['fields'](_0x3404e7[_0xbdaf('0x35')]['fields']));_0x49ae72[_0xbdaf('0x38')]=_0x49ae72[_0xbdaf('0x38')][_0xbdaf('0x49')]?_0x49ae72[_0xbdaf('0x38')]:_0x4d0adb[_0xbdaf('0x34')];if(_0x3404e7[_0xbdaf('0x35')][_0xbdaf('0x43')]){_0x49ae72[_0xbdaf('0x44')]=[{'all':!![]}];}_0x49ae72=_[_0xbdaf('0x41')]({},_0x49ae72,_0x3404e7[_0xbdaf('0x42')]);return db[_0xbdaf('0x2f')][_0xbdaf('0x4a')](_0x49ae72)[_0xbdaf('0x26')](handleEntityNotFound(_0x35818b,null))[_0xbdaf('0x26')](respondWithResult(_0x35818b,null))[_0xbdaf('0x46')](handleError(_0x35818b,null));};exports[_0xbdaf('0x4b')]=function(_0xed9fde,_0x2ccd69){return db[_0xbdaf('0x2f')][_0xbdaf('0x4b')](_0xed9fde[_0xbdaf('0x4c')],{})[_0xbdaf('0x26')](respondWithResult(_0x2ccd69,0xc9))[_0xbdaf('0x46')](handleError(_0x2ccd69,null));};exports[_0xbdaf('0x25')]=function(_0x47f446,_0x5b2ea9){if(_0x47f446['body']['id']){delete _0x47f446[_0xbdaf('0x4c')]['id'];}return db[_0xbdaf('0x2f')][_0xbdaf('0x4a')]({'where':{'id':_0x47f446['params']['id']}})['then'](handleEntityNotFound(_0x5b2ea9,null))[_0xbdaf('0x26')](saveUpdates(_0x47f446[_0xbdaf('0x4c')],null))[_0xbdaf('0x26')](respondWithResult(_0x5b2ea9,null))['catch'](handleError(_0x5b2ea9,null));};exports[_0xbdaf('0x27')]=function(_0x47ab54,_0x3d2bd8){return db['SugarcrmField']['find']({'where':{'id':_0x47ab54[_0xbdaf('0x47')]['id']}})[_0xbdaf('0x26')](handleEntityNotFound(_0x3d2bd8,null))[_0xbdaf('0x26')](removeEntity(_0x3d2bd8,null))['catch'](handleError(_0x3d2bd8,null));}; \ No newline at end of file +var _0x199b=['fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','include','findAll','rows','catch','show','params','keys','includeAll','find','create','body','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','Content-Range','json','apply','reject','update','then','destroy','end','stack','name','send','index','map','SugarcrmField','rawAttributes','fieldName','model','query','filters','attributes','intersection'];(function(_0x1c193e,_0x2f7d46){var _0x6cd5ab=function(_0x3eaa80){while(--_0x3eaa80){_0x1c193e['push'](_0x1c193e['shift']());}};_0x6cd5ab(++_0x2f7d46);}(_0x199b,0xa9));var _0xb199=function(_0x1e175c,_0x3b9102){_0x1e175c=_0x1e175c-0x0;var _0x373c37=_0x199b[_0x1e175c];return _0x373c37;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xb199('0x0'));var jsonpatch=require(_0xb199('0x1'));var rp=require(_0xb199('0x2'));var moment=require(_0xb199('0x3'));var BPromise=require(_0xb199('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xb199('0x5'));var sox=require('sox');var csv=require(_0xb199('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xb199('0x7'));var crypto=require(_0xb199('0x8'));var jsforce=require(_0xb199('0x9'));var deskjs=require(_0xb199('0xa'));var toCsv=require(_0xb199('0x6'));var querystring=require(_0xb199('0xb'));var Papa=require(_0xb199('0xc'));var Redis=require('ioredis');var authService=require(_0xb199('0xd'));var qs=require(_0xb199('0xe'));var as=require(_0xb199('0xf'));var hardwareService=require(_0xb199('0x10'));var logger=require(_0xb199('0x11'))(_0xb199('0x12'));var utils=require(_0xb199('0x13'));var config=require(_0xb199('0x14'));var licenseUtil=require(_0xb199('0x15'));var db=require(_0xb199('0x16'))['db'];function respondWithStatusCode(_0x372cb0,_0xa01187){_0xa01187=_0xa01187||0xcc;return function(_0x6922d7){if(_0x6922d7){return _0x372cb0[_0xb199('0x17')](_0xa01187);}return _0x372cb0[_0xb199('0x18')](_0xa01187)['end']();};}function respondWithResult(_0x3b1ddd,_0x5cc75b){_0x5cc75b=_0x5cc75b||0xc8;return function(_0x10c613){if(_0x10c613){return _0x3b1ddd[_0xb199('0x18')](_0x5cc75b)['json'](_0x10c613);}};}function respondWithFilteredResult(_0x450208,_0x21ad61){return function(_0x220c74){if(_0x220c74){var _0x541318=typeof _0x21ad61[_0xb199('0x19')]===_0xb199('0x1a')&&typeof _0x21ad61[_0xb199('0x1b')]==='undefined';var _0x35f098=_0x220c74[_0xb199('0x1c')];var _0x15455e=_0x541318?0x0:_0x21ad61[_0xb199('0x19')];var _0x2efc92=_0x541318?_0x220c74[_0xb199('0x1c')]:_0x21ad61[_0xb199('0x19')]+_0x21ad61[_0xb199('0x1b')];var _0x3d7528;if(_0x2efc92>=_0x35f098){_0x2efc92=_0x35f098;_0x3d7528=0xc8;}else{_0x3d7528=0xce;}_0x450208[_0xb199('0x18')](_0x3d7528);return _0x450208['set'](_0xb199('0x1d'),_0x15455e+'-'+_0x2efc92+'/'+_0x35f098)[_0xb199('0x1e')](_0x220c74);}return null;};}function patchUpdates(_0x9dda80){return function(_0x4b419b){try{jsonpatch[_0xb199('0x1f')](_0x4b419b,_0x9dda80,!![]);}catch(_0x23a0c5){return BPromise[_0xb199('0x20')](_0x23a0c5);}return _0x4b419b['save']();};}function saveUpdates(_0x5530a1,_0x17fa7d){return function(_0xdb3806){if(_0xdb3806){return _0xdb3806[_0xb199('0x21')](_0x5530a1)[_0xb199('0x22')](function(_0x4084d1){return _0x4084d1;});}return null;};}function removeEntity(_0x3cdca8,_0x1a2469){return function(_0x2f7a30){if(_0x2f7a30){return _0x2f7a30[_0xb199('0x23')]()[_0xb199('0x22')](function(){_0x3cdca8[_0xb199('0x18')](0xcc)[_0xb199('0x24')]();});}};}function handleEntityNotFound(_0x1273fd,_0x4ff465){return function(_0x5c783d){if(!_0x5c783d){_0x1273fd[_0xb199('0x17')](0x194);}return _0x5c783d;};}function handleError(_0x53a604,_0x1a5d65){_0x1a5d65=_0x1a5d65||0x1f4;return function(_0x2fb21b){logger['error'](_0x2fb21b[_0xb199('0x25')]);if(_0x2fb21b[_0xb199('0x26')]){delete _0x2fb21b[_0xb199('0x26')];}_0x53a604[_0xb199('0x18')](_0x1a5d65)[_0xb199('0x27')](_0x2fb21b);};}exports[_0xb199('0x28')]=function(_0x59fd68,_0x37f92d){var _0x51cdc2={},_0x14054e={},_0x180ea7={'count':0x0,'rows':[]};var _0x2687ae=_[_0xb199('0x29')](db[_0xb199('0x2a')][_0xb199('0x2b')],function(_0x4c639e){return{'name':_0x4c639e[_0xb199('0x2c')],'type':_0x4c639e['type']['key']};});_0x14054e[_0xb199('0x2d')]=_[_0xb199('0x29')](_0x2687ae,_0xb199('0x26'));_0x14054e[_0xb199('0x2e')]=_['keys'](_0x59fd68['query']);_0x14054e[_0xb199('0x2f')]=_['intersection'](_0x14054e[_0xb199('0x2d')],_0x14054e[_0xb199('0x2e')]);_0x51cdc2[_0xb199('0x30')]=_[_0xb199('0x31')](_0x14054e[_0xb199('0x2d')],qs[_0xb199('0x32')](_0x59fd68[_0xb199('0x2e')][_0xb199('0x32')]));_0x51cdc2[_0xb199('0x30')]=_0x51cdc2[_0xb199('0x30')][_0xb199('0x33')]?_0x51cdc2[_0xb199('0x30')]:_0x14054e[_0xb199('0x2d')];if(!_0x59fd68[_0xb199('0x2e')][_0xb199('0x34')](_0xb199('0x35'))){_0x51cdc2[_0xb199('0x1b')]=qs['limit'](_0x59fd68[_0xb199('0x2e')][_0xb199('0x1b')]);_0x51cdc2[_0xb199('0x19')]=qs[_0xb199('0x19')](_0x59fd68[_0xb199('0x2e')][_0xb199('0x19')]);}_0x51cdc2[_0xb199('0x36')]=qs[_0xb199('0x37')](_0x59fd68[_0xb199('0x2e')][_0xb199('0x37')]);_0x51cdc2[_0xb199('0x38')]=qs[_0xb199('0x2f')](_['pick'](_0x59fd68[_0xb199('0x2e')],_0x14054e[_0xb199('0x2f')]),_0x2687ae);if(_0x59fd68[_0xb199('0x2e')][_0xb199('0x39')]){_0x51cdc2[_0xb199('0x38')]=_[_0xb199('0x3a')](_0x51cdc2['where'],{'$or':_['map'](_0x2687ae,function(_0x20fee8){if(_0x20fee8[_0xb199('0x3b')]!==_0xb199('0x3c')){var _0x529108={};_0x529108[_0x20fee8[_0xb199('0x26')]]={'$like':'%'+_0x59fd68[_0xb199('0x2e')]['filter']+'%'};return _0x529108;}})});}_0x51cdc2=_[_0xb199('0x3a')]({},_0x51cdc2,_0x59fd68[_0xb199('0x3d')]);var _0x52a203={'where':_0x51cdc2['where']};return db['SugarcrmField'][_0xb199('0x1c')](_0x52a203)['then'](function(_0x3e5e64){_0x180ea7[_0xb199('0x1c')]=_0x3e5e64;if(_0x59fd68['query']['includeAll']){_0x51cdc2[_0xb199('0x3e')]=[{'all':!![]}];}return db['SugarcrmField'][_0xb199('0x3f')](_0x51cdc2);})[_0xb199('0x22')](function(_0x4a611b){_0x180ea7[_0xb199('0x40')]=_0x4a611b;return _0x180ea7;})[_0xb199('0x22')](respondWithFilteredResult(_0x37f92d,_0x51cdc2))[_0xb199('0x41')](handleError(_0x37f92d,null));};exports[_0xb199('0x42')]=function(_0x48e751,_0x1c0138){var _0x4c9a99={'raw':!![],'where':{'id':_0x48e751[_0xb199('0x43')]['id']}},_0x505826={};_0x505826[_0xb199('0x2d')]=_[_0xb199('0x44')](db[_0xb199('0x2a')][_0xb199('0x2b')]);_0x505826[_0xb199('0x2e')]=_[_0xb199('0x44')](_0x48e751[_0xb199('0x2e')]);_0x505826[_0xb199('0x2f')]=_[_0xb199('0x31')](_0x505826[_0xb199('0x2d')],_0x505826[_0xb199('0x2e')]);_0x4c9a99[_0xb199('0x30')]=_[_0xb199('0x31')](_0x505826[_0xb199('0x2d')],qs[_0xb199('0x32')](_0x48e751[_0xb199('0x2e')][_0xb199('0x32')]));_0x4c9a99[_0xb199('0x30')]=_0x4c9a99[_0xb199('0x30')]['length']?_0x4c9a99['attributes']:_0x505826['model'];if(_0x48e751['query'][_0xb199('0x45')]){_0x4c9a99[_0xb199('0x3e')]=[{'all':!![]}];}_0x4c9a99=_[_0xb199('0x3a')]({},_0x4c9a99,_0x48e751[_0xb199('0x3d')]);return db[_0xb199('0x2a')][_0xb199('0x46')](_0x4c9a99)[_0xb199('0x22')](handleEntityNotFound(_0x1c0138,null))['then'](respondWithResult(_0x1c0138,null))[_0xb199('0x41')](handleError(_0x1c0138,null));};exports[_0xb199('0x47')]=function(_0x2c1ed4,_0x290989){return db['SugarcrmField'][_0xb199('0x47')](_0x2c1ed4[_0xb199('0x48')],{})['then'](respondWithResult(_0x290989,0xc9))[_0xb199('0x41')](handleError(_0x290989,null));};exports[_0xb199('0x21')]=function(_0x295f27,_0x1a1872){if(_0x295f27[_0xb199('0x48')]['id']){delete _0x295f27[_0xb199('0x48')]['id'];}return db[_0xb199('0x2a')][_0xb199('0x46')]({'where':{'id':_0x295f27[_0xb199('0x43')]['id']}})[_0xb199('0x22')](handleEntityNotFound(_0x1a1872,null))[_0xb199('0x22')](saveUpdates(_0x295f27[_0xb199('0x48')],null))[_0xb199('0x22')](respondWithResult(_0x1a1872,null))[_0xb199('0x41')](handleError(_0x1a1872,null));};exports[_0xb199('0x23')]=function(_0x58783a,_0xf6525b){return db['SugarcrmField'][_0xb199('0x46')]({'where':{'id':_0x58783a[_0xb199('0x43')]['id']}})['then'](handleEntityNotFound(_0xf6525b,null))[_0xb199('0x22')](removeEntity(_0xf6525b,null))[_0xb199('0x41')](handleError(_0xf6525b,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index 69dcb0e..1f61870 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 _0xc7f1=['define','SugarcrmField','int_sugarcrm_fields','sugarcrm_unique_index','FieldId','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intSugarcrmField.attributes'];(function(_0x2cb1e2,_0x2fbd59){var _0x1777e6=function(_0x5c7412){while(--_0x5c7412){_0x2cb1e2['push'](_0x2cb1e2['shift']());}};_0x1777e6(++_0x2fbd59);}(_0xc7f1,0x147));var _0x1c7f=function(_0x123e08,_0x4b0dcd){_0x123e08=_0x123e08-0x0;var _0x4c8c73=_0xc7f1[_0x123e08];return _0x4c8c73;};'use strict';var _=require(_0x1c7f('0x0'));var util=require('util');var logger=require(_0x1c7f('0x1'))(_0x1c7f('0x2'));var moment=require(_0x1c7f('0x3'));var BPromise=require(_0x1c7f('0x4'));var rp=require(_0x1c7f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1c7f('0x6'));var config=require(_0x1c7f('0x7'));var attributes=require(_0x1c7f('0x8'));module['exports']=function(_0x2d4571,_0x36c032){return _0x2d4571[_0x1c7f('0x9')](_0x1c7f('0xa'),attributes,{'tableName':_0x1c7f('0xb'),'paranoid':![],'indexes':[{'name':_0x1c7f('0xc'),'fields':['idField',_0x1c7f('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xbb47=['bluebird','request-promise','rimraf','../../config/environment','exports','define','SugarcrmField','int_sugarcrm_fields','sugarcrm_unique_index','FieldId','../../config/logger','api','moment'];(function(_0x21e09d,_0x45c129){var _0x209bb6=function(_0x368428){while(--_0x368428){_0x21e09d['push'](_0x21e09d['shift']());}};_0x209bb6(++_0x45c129);}(_0xbb47,0xcd));var _0x7bb4=function(_0x5311e8,_0x57c5bb){_0x5311e8=_0x5311e8-0x0;var _0x582ad8=_0xbb47[_0x5311e8];return _0x582ad8;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x7bb4('0x0'))(_0x7bb4('0x1'));var moment=require(_0x7bb4('0x2'));var BPromise=require(_0x7bb4('0x3'));var rp=require(_0x7bb4('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7bb4('0x5'));var config=require(_0x7bb4('0x6'));var attributes=require('./intSugarcrmField.attributes');module[_0x7bb4('0x7')]=function(_0x43ab4b,_0x441d29){return _0x43ab4b[_0x7bb4('0x8')](_0x7bb4('0x9'),attributes,{'tableName':_0x7bb4('0xa'),'paranoid':![],'indexes':[{'name':_0x7bb4('0xb'),'fields':['idField',_0x7bb4('0xc')],'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 6a8abcc..e38705d 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 _0x3167=['randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird'];(function(_0x3e6dcd,_0x15b6db){var _0xe19073=function(_0x3c96ed){while(--_0x3c96ed){_0x3e6dcd['push'](_0x3e6dcd['shift']());}};_0xe19073(++_0x15b6db);}(_0x3167,0x1c4));var _0x7316=function(_0x1cd65a,_0x29fa8f){_0x1cd65a=_0x1cd65a-0x0;var _0xf93849=_0x3167[_0x1cd65a];return _0xf93849;};'use strict';var _=require(_0x7316('0x0'));var util=require(_0x7316('0x1'));var moment=require(_0x7316('0x2'));var BPromise=require(_0x7316('0x3'));var rs=require(_0x7316('0x4'));var fs=require('fs');var Redis=require(_0x7316('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x7316('0x6'))(_0x7316('0x7'));var config=require(_0x7316('0x8'));var jayson=require(_0x7316('0x9'));var client=jayson[_0x7316('0xa')][_0x7316('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x37842c,_0x3c79b2,_0x58434e){return new BPromise(function(_0x56dbc7,_0x135b21){return client[_0x7316('0xc')](_0x37842c,_0x58434e)[_0x7316('0xd')](function(_0x12b76a){logger[_0x7316('0xe')](_0x7316('0xf'),_0x3c79b2,_0x7316('0x10'));logger[_0x7316('0x11')](_0x7316('0x12'),_0x3c79b2,_0x7316('0x10'),JSON[_0x7316('0x13')](_0x12b76a));if(_0x12b76a['error']){if(_0x12b76a[_0x7316('0x14')][_0x7316('0x15')]===0x1f4){logger[_0x7316('0x14')](_0x7316('0xf'),_0x3c79b2,_0x12b76a['error'][_0x7316('0x16')]);return _0x135b21(_0x12b76a['error'][_0x7316('0x16')]);}logger[_0x7316('0x14')](_0x7316('0xf'),_0x3c79b2,_0x12b76a[_0x7316('0x14')][_0x7316('0x16')]);return _0x56dbc7(_0x12b76a['error']['message']);}else{logger[_0x7316('0xe')](_0x7316('0xf'),_0x3c79b2,_0x7316('0x10'));_0x56dbc7(_0x12b76a['result']['message']);}})[_0x7316('0x17')](function(_0x2d3331){logger[_0x7316('0x14')](_0x7316('0xf'),_0x3c79b2,_0x2d3331);_0x135b21(_0x2d3331);});});} \ No newline at end of file +var _0x7867=['../../config/environment','jayson/promise','http','info','SugarcrmField,\x20%s,\x20%s','request\x20sent','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','rpc'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x7867,0x1d5));var _0x7786=function(_0x11d68d,_0x305828){_0x11d68d=_0x11d68d-0x0;var _0x147098=_0x7867[_0x11d68d];return _0x147098;};'use strict';var _=require('lodash');var util=require(_0x7786('0x0'));var moment=require(_0x7786('0x1'));var BPromise=require(_0x7786('0x2'));var rs=require(_0x7786('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7786('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7786('0x5'));var config=require(_0x7786('0x6'));var jayson=require(_0x7786('0x7'));var client=jayson['client'][_0x7786('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4dc942,_0x36342b,_0x9e1460){return new BPromise(function(_0x41674d,_0xf01f30){return client['request'](_0x4dc942,_0x9e1460)['then'](function(_0x3ade74){logger[_0x7786('0x9')](_0x7786('0xa'),_0x36342b,_0x7786('0xb'));logger['debug'](_0x7786('0xc'),_0x36342b,_0x7786('0xb'),JSON[_0x7786('0xd')](_0x3ade74));if(_0x3ade74['error']){if(_0x3ade74[_0x7786('0xe')][_0x7786('0xf')]===0x1f4){logger[_0x7786('0xe')]('SugarcrmField,\x20%s,\x20%s',_0x36342b,_0x3ade74[_0x7786('0xe')]['message']);return _0xf01f30(_0x3ade74['error'][_0x7786('0x10')]);}logger[_0x7786('0xe')](_0x7786('0xa'),_0x36342b,_0x3ade74[_0x7786('0xe')][_0x7786('0x10')]);return _0x41674d(_0x3ade74[_0x7786('0xe')][_0x7786('0x10')]);}else{logger[_0x7786('0x9')]('SugarcrmField,\x20%s,\x20%s',_0x36342b,'request\x20sent');_0x41674d(_0x3ade74[_0x7786('0x11')]['message']);}})[_0x7786('0x12')](function(_0x236315){logger[_0x7786('0xe')](_0x7786('0xa'),_0x36342b,_0x236315);_0xf01f30(_0x236315);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index 51dc4fc..67b5f8e 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 _0x0328=['getFields','post','create','/:id/configurations','addConfiguration','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','isAuthenticated','/:id','get','getConfigurations'];(function(_0x1551e1,_0x368d72){var _0x5e23ac=function(_0x5280f2){while(--_0x5280f2){_0x1551e1['push'](_0x1551e1['shift']());}};_0x5e23ac(++_0x368d72);}(_0x0328,0x172));var _0x8032=function(_0x476bb5,_0x14dbef){_0x476bb5=_0x476bb5-0x0;var _0x468c1e=_0x0328[_0x476bb5];return _0x468c1e;};'use strict';var multer=require(_0x8032('0x0'));var util=require(_0x8032('0x1'));var path=require(_0x8032('0x2'));var timeout=require(_0x8032('0x3'));var express=require(_0x8032('0x4'));var router=express[_0x8032('0x5')]();var fs_extra=require(_0x8032('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x8032('0x7'));var config=require(_0x8032('0x8'));var controller=require(_0x8032('0x9'));router['get']('/',auth[_0x8032('0xa')](),controller['index']);router['get'](_0x8032('0xb'),auth[_0x8032('0xa')](),controller['show']);router[_0x8032('0xc')]('/:id/configurations',auth[_0x8032('0xa')](),controller[_0x8032('0xd')]);router[_0x8032('0xc')]('/:id/fields',auth[_0x8032('0xa')](),controller[_0x8032('0xe')]);router[_0x8032('0xf')]('/',auth['isAuthenticated'](),controller[_0x8032('0x10')]);router['post'](_0x8032('0x11'),auth[_0x8032('0xa')](),controller[_0x8032('0x12')]);router[_0x8032('0x13')](_0x8032('0xb'),auth[_0x8032('0xa')](),controller[_0x8032('0x14')]);router[_0x8032('0x15')]('/:id',auth['isAuthenticated'](),controller[_0x8032('0x16')]);module[_0x8032('0x17')]=router; \ No newline at end of file +var _0xef1c=['../../components/auth/service','../../components/interaction/service','./intVtigerAccount.controller','get','isAuthenticated','show','/:id/configurations','getConfigurations','getFields','post','create','put','/:id','delete','multer','util','connect-timeout','express','Router','fs-extra'];(function(_0x40506d,_0x4acec1){var _0x4b733b=function(_0x27a74a){while(--_0x27a74a){_0x40506d['push'](_0x40506d['shift']());}};_0x4b733b(++_0x4acec1);}(_0xef1c,0x176));var _0xcef1=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0xef1c[_0x1d1779];return _0x2377e9;};'use strict';var multer=require(_0xcef1('0x0'));var util=require(_0xcef1('0x1'));var path=require('path');var timeout=require(_0xcef1('0x2'));var express=require(_0xcef1('0x3'));var router=express[_0xcef1('0x4')]();var fs_extra=require(_0xcef1('0x5'));var auth=require(_0xcef1('0x6'));var interaction=require(_0xcef1('0x7'));var config=require('../../config/environment');var controller=require(_0xcef1('0x8'));router[_0xcef1('0x9')]('/',auth[_0xcef1('0xa')](),controller['index']);router[_0xcef1('0x9')]('/:id',auth[_0xcef1('0xa')](),controller[_0xcef1('0xb')]);router[_0xcef1('0x9')](_0xcef1('0xc'),auth['isAuthenticated'](),controller[_0xcef1('0xd')]);router[_0xcef1('0x9')]('/:id/fields',auth[_0xcef1('0xa')](),controller[_0xcef1('0xe')]);router[_0xcef1('0xf')]('/',auth['isAuthenticated'](),controller[_0xcef1('0x10')]);router['post']('/:id/configurations',auth[_0xcef1('0xa')](),controller['addConfiguration']);router[_0xcef1('0x11')](_0xcef1('0x12'),auth[_0xcef1('0xa')](),controller['update']);router[_0xcef1('0x13')](_0xcef1('0x12'),auth[_0xcef1('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index 1852ac1..ae1a74a 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 _0x6643=['STRING','sequelize','exports'];(function(_0x77773a,_0x5a7026){var _0x1091a2=function(_0x276af5){while(--_0x276af5){_0x77773a['push'](_0x77773a['shift']());}};_0x1091a2(++_0x5a7026);}(_0x6643,0xa6));var _0x3664=function(_0x46a273,_0x310f3a){_0x46a273=_0x46a273-0x0;var _0x556773=_0x6643[_0x46a273];return _0x556773;};'use strict';var Sequelize=require(_0x3664('0x0'));module[_0x3664('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'allowNull':![]},'moduleName':{'type':Sequelize[_0x3664('0x2')],'allowNull':![],'defaultValue':'HelpDesk'},'remoteUri':{'type':Sequelize[_0x3664('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x3664('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x3664('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x6188=['sequelize','exports','STRING','HelpDesk'];(function(_0x21f9c2,_0x2b3d2a){var _0x3da17f=function(_0x57e2b9){while(--_0x57e2b9){_0x21f9c2['push'](_0x21f9c2['shift']());}};_0x3da17f(++_0x2b3d2a);}(_0x6188,0x94));var _0x8618=function(_0x68ee8b,_0x3cc6c5){_0x68ee8b=_0x68ee8b-0x0;var _0x5148f7=_0x6188[_0x68ee8b];return _0x5148f7;};'use strict';var Sequelize=require(_0x8618('0x0'));module[_0x8618('0x1')]={'name':{'type':Sequelize[_0x8618('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x8618('0x2')]},'username':{'type':Sequelize[_0x8618('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x8618('0x3')},'remoteUri':{'type':Sequelize[_0x8618('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x8618('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x8618('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index 1072ff1..b111b6c 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 _0x7205=['cf_','picklistValues','value','log','test','statusCode','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','save','update','then','destroy','stack','name','send','map','VtigerAccount','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','where','filters','filter','merge','type','VIRTUAL','options','include','findAll','rows','show','includeAll','catch','create','body','find','params','getConfigurations','findOne','VtigerConfiguration','sort','pick','nolimit','AccountId','Subjects','channel','Descriptions','getDescriptions','VtigerField','md5','getFields','username','description','remoteUri','serverUrl','accessKey','moduleName','slice','substring','lastIndexOf','%s/webservice.php','getchallenge','success','POST','login','result','token','GET','describe','sessionName','autogenerated','reference','owner','remove','includes','editable','false','label','startsWith'];(function(_0xf60cd0,_0x34bf81){var _0x32ad56=function(_0x44cf0b){while(--_0x44cf0b){_0xf60cd0['push'](_0xf60cd0['shift']());}};_0x32ad56(++_0x34bf81);}(_0x7205,0xfe));var _0x5720=function(_0x492eac,_0x45e6ec){_0x492eac=_0x492eac-0x0;var _0x567837=_0x7205[_0x492eac];return _0x567837;};'use strict';var emlformat=require(_0x5720('0x0'));var rimraf=require(_0x5720('0x1'));var zipdir=require(_0x5720('0x2'));var jsonpatch=require(_0x5720('0x3'));var rp=require(_0x5720('0x4'));var moment=require(_0x5720('0x5'));var BPromise=require(_0x5720('0x6'));var Mustache=require(_0x5720('0x7'));var util=require(_0x5720('0x8'));var path=require(_0x5720('0x9'));var sox=require(_0x5720('0xa'));var csv=require(_0x5720('0xb'));var ejs=require(_0x5720('0xc'));var fs=require('fs');var fs_extra=require(_0x5720('0xd'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x5720('0xe'));var deskjs=require(_0x5720('0xf'));var toCsv=require(_0x5720('0xb'));var querystring=require('querystring');var Papa=require(_0x5720('0x10'));var Redis=require(_0x5720('0x11'));var authService=require(_0x5720('0x12'));var qs=require(_0x5720('0x13'));var as=require(_0x5720('0x14'));var hardwareService=require(_0x5720('0x15'));var logger=require('../../config/logger')(_0x5720('0x16'));var utils=require(_0x5720('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x5720('0x18'))['db'];var integrations=require(_0x5720('0x19'));function respondWithStatusCode(_0x30ec11,_0x521015){_0x521015=_0x521015||0xcc;return function(_0x337530){if(_0x337530){return _0x30ec11[_0x5720('0x1a')](_0x521015);}return _0x30ec11[_0x5720('0x1b')](_0x521015)[_0x5720('0x1c')]();};}function respondWithResult(_0x2252f0,_0x89af37){_0x89af37=_0x89af37||0xc8;return function(_0x1a74aa){if(_0x1a74aa){return _0x2252f0[_0x5720('0x1b')](_0x89af37)['json'](_0x1a74aa);}};}function respondWithFilteredResult(_0x4cfb5c,_0x5b06ae){return function(_0xba29e0){if(_0xba29e0){var _0x121a28=typeof _0x5b06ae[_0x5720('0x1d')]===_0x5720('0x1e')&&typeof _0x5b06ae[_0x5720('0x1f')]===_0x5720('0x1e');var _0x4cba01=_0xba29e0[_0x5720('0x20')];var _0x368a50=_0x121a28?0x0:_0x5b06ae[_0x5720('0x1d')];var _0x2f7cfa=_0x121a28?_0xba29e0[_0x5720('0x20')]:_0x5b06ae[_0x5720('0x1d')]+_0x5b06ae[_0x5720('0x1f')];var _0xd094fc;if(_0x2f7cfa>=_0x4cba01){_0x2f7cfa=_0x4cba01;_0xd094fc=0xc8;}else{_0xd094fc=0xce;}_0x4cfb5c[_0x5720('0x1b')](_0xd094fc);return _0x4cfb5c[_0x5720('0x21')]('Content-Range',_0x368a50+'-'+_0x2f7cfa+'/'+_0x4cba01)[_0x5720('0x22')](_0xba29e0);}return null;};}function patchUpdates(_0x336999){return function(_0x285c5c){try{jsonpatch[_0x5720('0x23')](_0x285c5c,_0x336999,!![]);}catch(_0x385e99){return BPromise['reject'](_0x385e99);}return _0x285c5c[_0x5720('0x24')]();};}function saveUpdates(_0x519202,_0x8208f){return function(_0x4070e8){if(_0x4070e8){return _0x4070e8[_0x5720('0x25')](_0x519202)[_0x5720('0x26')](function(_0x1766f0){return _0x1766f0;});}return null;};}function removeEntity(_0x45c783,_0xefea87){return function(_0x145cbe){if(_0x145cbe){return _0x145cbe[_0x5720('0x27')]()[_0x5720('0x26')](function(){_0x45c783[_0x5720('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x17ff27,_0x1c8ad1){return function(_0x220008){if(!_0x220008){_0x17ff27[_0x5720('0x1a')](0x194);}return _0x220008;};}function handleError(_0x5bdee5,_0x29f4c8){_0x29f4c8=_0x29f4c8||0x1f4;return function(_0x5bcfc1){logger['error'](_0x5bcfc1[_0x5720('0x28')]);if(_0x5bcfc1['name']){delete _0x5bcfc1[_0x5720('0x29')];}_0x5bdee5[_0x5720('0x1b')](_0x29f4c8)[_0x5720('0x2a')](_0x5bcfc1);};}exports['index']=function(_0x3fbddb,_0x36c1bd){var _0x58f264={},_0x22590a={},_0xb469b4={'count':0x0,'rows':[]};var _0xf0f2fe=_[_0x5720('0x2b')](db[_0x5720('0x2c')][_0x5720('0x2d')],function(_0x311c11){return{'name':_0x311c11[_0x5720('0x2e')],'type':_0x311c11['type'][_0x5720('0x2f')]};});_0x22590a[_0x5720('0x30')]=_[_0x5720('0x2b')](_0xf0f2fe,_0x5720('0x29'));_0x22590a[_0x5720('0x31')]=_[_0x5720('0x32')](_0x3fbddb[_0x5720('0x31')]);_0x22590a['filters']=_[_0x5720('0x33')](_0x22590a[_0x5720('0x30')],_0x22590a[_0x5720('0x31')]);_0x58f264[_0x5720('0x34')]=_['intersection'](_0x22590a[_0x5720('0x30')],qs[_0x5720('0x35')](_0x3fbddb[_0x5720('0x31')]['fields']));_0x58f264['attributes']=_0x58f264[_0x5720('0x34')][_0x5720('0x36')]?_0x58f264['attributes']:_0x22590a[_0x5720('0x30')];if(!_0x3fbddb[_0x5720('0x31')][_0x5720('0x37')]('nolimit')){_0x58f264['limit']=qs[_0x5720('0x1f')](_0x3fbddb[_0x5720('0x31')][_0x5720('0x1f')]);_0x58f264[_0x5720('0x1d')]=qs[_0x5720('0x1d')](_0x3fbddb[_0x5720('0x31')]['offset']);}_0x58f264['order']=qs['sort'](_0x3fbddb[_0x5720('0x31')]['sort']);_0x58f264[_0x5720('0x38')]=qs[_0x5720('0x39')](_['pick'](_0x3fbddb['query'],_0x22590a['filters']),_0xf0f2fe);if(_0x3fbddb[_0x5720('0x31')][_0x5720('0x3a')]){_0x58f264['where']=_[_0x5720('0x3b')](_0x58f264[_0x5720('0x38')],{'$or':_[_0x5720('0x2b')](_0xf0f2fe,function(_0x4fdc64){if(_0x4fdc64[_0x5720('0x3c')]!==_0x5720('0x3d')){var _0x51b6a0={};_0x51b6a0[_0x4fdc64[_0x5720('0x29')]]={'$like':'%'+_0x3fbddb[_0x5720('0x31')][_0x5720('0x3a')]+'%'};return _0x51b6a0;}})});}_0x58f264=_[_0x5720('0x3b')]({},_0x58f264,_0x3fbddb[_0x5720('0x3e')]);var _0x3b9300={'where':_0x58f264[_0x5720('0x38')]};return db['VtigerAccount'][_0x5720('0x20')](_0x3b9300)[_0x5720('0x26')](function(_0x2c9ca3){_0xb469b4[_0x5720('0x20')]=_0x2c9ca3;if(_0x3fbddb['query']['includeAll']){_0x58f264[_0x5720('0x3f')]=[{'all':!![]}];}return db[_0x5720('0x2c')][_0x5720('0x40')](_0x58f264);})[_0x5720('0x26')](function(_0x193d5e){_0xb469b4[_0x5720('0x41')]=_0x193d5e;return _0xb469b4;})['then'](respondWithFilteredResult(_0x36c1bd,_0x58f264))['catch'](handleError(_0x36c1bd,null));};exports[_0x5720('0x42')]=function(_0x4c524c,_0x191e7c){var _0x335e1e={'raw':![],'where':{'id':_0x4c524c['params']['id']}},_0x399336={};_0x399336[_0x5720('0x30')]=_[_0x5720('0x32')](db[_0x5720('0x2c')]['rawAttributes']);_0x399336[_0x5720('0x31')]=_[_0x5720('0x32')](_0x4c524c[_0x5720('0x31')]);_0x399336[_0x5720('0x39')]=_[_0x5720('0x33')](_0x399336[_0x5720('0x30')],_0x399336[_0x5720('0x31')]);_0x335e1e[_0x5720('0x34')]=_['intersection'](_0x399336[_0x5720('0x30')],qs['fields'](_0x4c524c[_0x5720('0x31')][_0x5720('0x35')]));_0x335e1e[_0x5720('0x34')]=_0x335e1e[_0x5720('0x34')][_0x5720('0x36')]?_0x335e1e[_0x5720('0x34')]:_0x399336[_0x5720('0x30')];if(_0x4c524c['query'][_0x5720('0x43')]){_0x335e1e[_0x5720('0x3f')]=[{'all':!![]}];}_0x335e1e=_[_0x5720('0x3b')]({},_0x335e1e,_0x4c524c['options']);return db[_0x5720('0x2c')]['find'](_0x335e1e)[_0x5720('0x26')](handleEntityNotFound(_0x191e7c,null))['then'](respondWithResult(_0x191e7c,null))[_0x5720('0x44')](handleError(_0x191e7c,null));};exports[_0x5720('0x45')]=function(_0x3157f7,_0x3dbf61){return db[_0x5720('0x2c')][_0x5720('0x45')](_0x3157f7[_0x5720('0x46')],{})['then'](respondWithResult(_0x3dbf61,0xc9))[_0x5720('0x44')](handleError(_0x3dbf61,null));};exports[_0x5720('0x25')]=function(_0x1c0621,_0x3d57c3){if(_0x1c0621['body']['id']){delete _0x1c0621[_0x5720('0x46')]['id'];}return db[_0x5720('0x2c')][_0x5720('0x47')]({'where':{'id':_0x1c0621[_0x5720('0x48')]['id']}})[_0x5720('0x26')](handleEntityNotFound(_0x3d57c3,null))[_0x5720('0x26')](saveUpdates(_0x1c0621['body'],null))[_0x5720('0x26')](respondWithResult(_0x3d57c3,null))[_0x5720('0x44')](handleError(_0x3d57c3,null));};exports[_0x5720('0x27')]=function(_0x3104dc,_0x27d38b){return db[_0x5720('0x2c')]['find']({'where':{'id':_0x3104dc['params']['id']}})[_0x5720('0x26')](handleEntityNotFound(_0x27d38b,null))[_0x5720('0x26')](removeEntity(_0x27d38b,null))[_0x5720('0x44')](handleError(_0x27d38b,null));};exports[_0x5720('0x49')]=function(_0x3ec9f6,_0x4409ed,_0x52f8d2){var _0x12d833={};var _0x26eb11={};var _0x567167;var _0x107088;return db['VtigerAccount'][_0x5720('0x4a')]({'where':{'id':_0x3ec9f6['params']['id']}})[_0x5720('0x26')](handleEntityNotFound(_0x4409ed,null))['then'](function(_0x339c0e){if(_0x339c0e){_0x567167=_0x339c0e;_0x26eb11[_0x5720('0x30')]=_[_0x5720('0x32')](db[_0x5720('0x4b')]['rawAttributes']);_0x26eb11['query']=_[_0x5720('0x32')](_0x3ec9f6[_0x5720('0x31')]);_0x26eb11[_0x5720('0x39')]=_[_0x5720('0x33')](_0x26eb11[_0x5720('0x30')],_0x26eb11['query']);_0x12d833[_0x5720('0x34')]=_[_0x5720('0x33')](_0x26eb11['model'],qs[_0x5720('0x35')](_0x3ec9f6[_0x5720('0x31')][_0x5720('0x35')]));_0x12d833['attributes']=_0x12d833[_0x5720('0x34')][_0x5720('0x36')]?_0x12d833[_0x5720('0x34')]:_0x26eb11[_0x5720('0x30')];_0x12d833['order']=qs[_0x5720('0x4c')](_0x3ec9f6[_0x5720('0x31')][_0x5720('0x4c')]);_0x12d833[_0x5720('0x38')]=qs[_0x5720('0x39')](_[_0x5720('0x4d')](_0x3ec9f6[_0x5720('0x31')],_0x26eb11['filters']));if(_0x3ec9f6[_0x5720('0x31')][_0x5720('0x3a')]){_0x12d833[_0x5720('0x38')]=_[_0x5720('0x3b')](_0x12d833[_0x5720('0x38')],{'$or':_[_0x5720('0x2b')](_0x12d833[_0x5720('0x34')],function(_0x16b3d9){var _0xd9d51c={};_0xd9d51c[_0x16b3d9]={'$like':'%'+_0x3ec9f6[_0x5720('0x31')][_0x5720('0x3a')]+'%'};return _0xd9d51c;})});}_0x12d833=_[_0x5720('0x3b')]({},_0x12d833,_0x3ec9f6['options']);return _0x567167[_0x5720('0x49')](_0x12d833);}})[_0x5720('0x26')](function(_0x28d137){if(_0x28d137){_0x107088=_0x28d137[_0x5720('0x36')];if(!_0x3ec9f6['query'][_0x5720('0x37')](_0x5720('0x4e'))){_0x12d833[_0x5720('0x1f')]=qs[_0x5720('0x1f')](_0x3ec9f6[_0x5720('0x31')][_0x5720('0x1f')]);_0x12d833['offset']=qs['offset'](_0x3ec9f6[_0x5720('0x31')][_0x5720('0x1d')]);}return _0x567167[_0x5720('0x49')](_0x12d833);}})[_0x5720('0x26')](function(_0x41d5fd){if(_0x41d5fd){return _0x41d5fd?{'count':_0x107088,'rows':_0x41d5fd}:null;}})['then'](respondWithResult(_0x4409ed,null))['catch'](handleError(_0x4409ed,null));};exports['addConfiguration']=function(_0x2fa0d2,_0x10ffb8,_0x449f8d){if(_0x2fa0d2['body']['id']){delete _0x2fa0d2[_0x5720('0x46')]['id'];}return db[_0x5720('0x2c')][_0x5720('0x4a')]({'where':{'id':_0x2fa0d2['params']['id']}})[_0x5720('0x26')](handleEntityNotFound(_0x10ffb8,null))[_0x5720('0x26')](function(_0x4f1e26){if(_0x4f1e26){_0x2fa0d2[_0x5720('0x46')][_0x5720('0x4f')]=_0x4f1e26['id'];_0x2fa0d2[_0x5720('0x46')][_0x5720('0x50')]=integrations['getSubjects'](_0x2fa0d2[_0x5720('0x46')][_0x5720('0x51')],_0x2fa0d2['body'][_0x5720('0x3c')]);_0x2fa0d2[_0x5720('0x46')][_0x5720('0x52')]=integrations[_0x5720('0x53')](_0x2fa0d2['body'][_0x5720('0x51')],_0x2fa0d2[_0x5720('0x46')][_0x5720('0x3c')]);return db[_0x5720('0x4b')][_0x5720('0x45')](_0x2fa0d2['body'],{'include':[{'model':db[_0x5720('0x54')],'as':_0x5720('0x50')},{'model':db['VtigerField'],'as':'Descriptions'}]});}return null;})[_0x5720('0x26')](respondWithResult(_0x10ffb8,null))['catch'](handleError(_0x10ffb8,null));};var md5=require(_0x5720('0x55'));exports[_0x5720('0x56')]=function(_0x5f356a,_0x505913,_0x2ceb47){var _0x23dc17=null;var _0x82c64c=null;var _0x73c096=null;var _0x718235=null;var _0x1efe1f='';return db[_0x5720('0x2c')][_0x5720('0x4a')]({'where':{'id':_0x5f356a[_0x5720('0x48')]['id']},'attributes':['id',_0x5720('0x29'),_0x5720('0x57'),_0x5720('0x58'),'moduleName',_0x5720('0x59'),_0x5720('0x5a'),_0x5720('0x5b')]})[_0x5720('0x26')](handleEntityNotFound(_0x505913,null))[_0x5720('0x26')](function(_0x54bf02){if(_0x54bf02){_0x23dc17=_0x54bf02[_0x5720('0x57')];_0x82c64c=_0x54bf02['accessKey'];_0x73c096=_0x54bf02[_0x5720('0x5c')];_0x1efe1f=_0x54bf02['remoteUri'];var _0x36f445=_0x1efe1f[_0x5720('0x5d')](-0x1);if(_0x36f445==='/'){_0x1efe1f=_0x1efe1f[_0x5720('0x5e')](0x0,_0x1efe1f[_0x5720('0x5f')](_0x36f445));}_0x718235=util['format'](_0x5720('0x60'),_0x1efe1f);var _0x537a65={'method':'GET','uri':_0x718235,'qs':{'operation':_0x5720('0x61'),'username':_0x54bf02[_0x5720('0x57')]},'json':!![]};return rp(_0x537a65);}})[_0x5720('0x26')](function(_0x14d27b){if(_0x14d27b[_0x5720('0x62')]){var _0x2e8e9c={'method':_0x5720('0x63'),'uri':_0x718235,'form':{'operation':_0x5720('0x64'),'username':_0x23dc17,'accessKey':md5(_0x14d27b[_0x5720('0x65')][_0x5720('0x66')]+_0x82c64c)},'json':!![]};return rp(_0x2e8e9c);}})[_0x5720('0x26')](function(_0x1124bd){if(_0x1124bd[_0x5720('0x62')]){var _0x4e96a8={'method':_0x5720('0x67'),'uri':_0x718235,'qs':{'operation':_0x5720('0x68'),'username':_0x23dc17,'sessionName':_0x1124bd['result'][_0x5720('0x69')],'elementType':_0x73c096},'json':!![]};return rp(_0x4e96a8);}})[_0x5720('0x26')](function(_0x5064e5){if(_0x5064e5[_0x5720('0x62')]){var _0x358c1b=[_0x5720('0x6a'),_0x5720('0x6b'),_0x5720('0x6c')];_[_0x5720('0x6d')](_0x5064e5[_0x5720('0x65')]['fields'],function(_0xf8ff49){return _0x358c1b[_0x5720('0x6e')](_0xf8ff49[_0x5720('0x3c')][_0x5720('0x29')]);});_[_0x5720('0x6d')](_0x5064e5[_0x5720('0x65')]['fields'],function(_0x8285d1){return _0x8285d1[_0x5720('0x6f')]===_0x5720('0x70');});return{'count':_0x5064e5[_0x5720('0x65')]['fields'][_0x5720('0x36')],'rows':_[_0x5720('0x2b')](_0x5064e5[_0x5720('0x65')][_0x5720('0x35')],function(_0x479d13){return{'id':_0x479d13[_0x5720('0x29')],'name':_0x479d13[_0x5720('0x71')],'custom':_[_0x5720('0x72')](_0x479d13['name'],_0x5720('0x73'))?!![]:![],'options':_0x479d13[_0x5720('0x3c')][_0x5720('0x29')]==='picklist'&&_0x479d13[_0x5720('0x3c')][_0x5720('0x74')][_0x5720('0x36')]>0x0?_[_0x5720('0x2b')](_0x479d13[_0x5720('0x3c')]['picklistValues'],function(_0x4ad642){return{'name':_0x4ad642[_0x5720('0x71')],'value':_0x4ad642[_0x5720('0x75')]};}):[]};})};}})[_0x5720('0x26')](respondWithResult(_0x505913,null))[_0x5720('0x44')](function(_0x35bec9){console[_0x5720('0x76')]('vTiger\x20error:\x20'+_0x35bec9);var _0x58b893=_0x5f356a[_0x5720('0x31')][_0x5720('0x77')]?0x1f4:_0x35bec9[_0x5720('0x78')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x58b893,JSON[_0x5720('0x79')](_0x35bec9));delete _0x35bec9[_0x5720('0x29')];if(_0x58b893===0x191){_0x58b893=0x190;}_0x505913['status'](_0x58b893)[_0x5720('0x2a')](_0x5f356a['query'][_0x5720('0x77')]?{'message':_0x5720('0x7a'),'statusCode':_0x35bec9[_0x5720('0x78')]}:_0x35bec9);});}; \ No newline at end of file +var _0x89ae=['AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','VtigerField','md5','getFields','username','description','moduleName','remoteUri','serverUrl','accessKey','slice','substring','lastIndexOf','format','%s/webservice.php','GET','POST','result','token','success','describe','sessionName','reference','owner','remove','includes','false','startsWith','picklist','picklistValues','label','log','vTiger\x20error:\x20','statusCode','getFields,\x20%s,\x20%s,\x20%s','test','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','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../components/integrations/configuration','status','end','offset','undefined','limit','count','Content-Range','json','apply','save','update','then','destroy','error','stack','send','map','rawAttributes','fieldName','type','key','model','name','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','VtigerAccount','includeAll','include','findAll','show','params','keys','find','catch','create','body','getConfigurations','VtigerConfiguration','length','addConfiguration','findOne'];(function(_0x4351c9,_0x2e620c){var _0x30de2f=function(_0x16d688){while(--_0x16d688){_0x4351c9['push'](_0x4351c9['shift']());}};_0x30de2f(++_0x2e620c);}(_0x89ae,0xa1));var _0xe89a=function(_0x368c1d,_0x4683cd){_0x368c1d=_0x368c1d-0x0;var _0xface06=_0x89ae[_0x368c1d];return _0xface06;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe89a('0x0'));var zipdir=require(_0xe89a('0x1'));var jsonpatch=require(_0xe89a('0x2'));var rp=require(_0xe89a('0x3'));var moment=require(_0xe89a('0x4'));var BPromise=require(_0xe89a('0x5'));var Mustache=require(_0xe89a('0x6'));var util=require(_0xe89a('0x7'));var path=require(_0xe89a('0x8'));var sox=require(_0xe89a('0x9'));var csv=require(_0xe89a('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe89a('0xb'));var _=require(_0xe89a('0xc'));var squel=require(_0xe89a('0xd'));var crypto=require(_0xe89a('0xe'));var jsforce=require(_0xe89a('0xf'));var deskjs=require(_0xe89a('0x10'));var toCsv=require('to-csv');var querystring=require(_0xe89a('0x11'));var Papa=require(_0xe89a('0x12'));var Redis=require(_0xe89a('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe89a('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe89a('0x15'))(_0xe89a('0x16'));var utils=require(_0xe89a('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0xe89a('0x18'));function respondWithStatusCode(_0x247eba,_0x2e976f){_0x2e976f=_0x2e976f||0xcc;return function(_0x3f564b){if(_0x3f564b){return _0x247eba['sendStatus'](_0x2e976f);}return _0x247eba[_0xe89a('0x19')](_0x2e976f)[_0xe89a('0x1a')]();};}function respondWithResult(_0x1d8cdb,_0x1498e8){_0x1498e8=_0x1498e8||0xc8;return function(_0x2d29f9){if(_0x2d29f9){return _0x1d8cdb[_0xe89a('0x19')](_0x1498e8)['json'](_0x2d29f9);}};}function respondWithFilteredResult(_0x36ea29,_0x4f42b3){return function(_0xe47f35){if(_0xe47f35){var _0x32f539=typeof _0x4f42b3[_0xe89a('0x1b')]===_0xe89a('0x1c')&&typeof _0x4f42b3[_0xe89a('0x1d')]===_0xe89a('0x1c');var _0x431f1a=_0xe47f35[_0xe89a('0x1e')];var _0x5244e7=_0x32f539?0x0:_0x4f42b3[_0xe89a('0x1b')];var _0x4ac2e=_0x32f539?_0xe47f35[_0xe89a('0x1e')]:_0x4f42b3['offset']+_0x4f42b3[_0xe89a('0x1d')];var _0x253cab;if(_0x4ac2e>=_0x431f1a){_0x4ac2e=_0x431f1a;_0x253cab=0xc8;}else{_0x253cab=0xce;}_0x36ea29[_0xe89a('0x19')](_0x253cab);return _0x36ea29['set'](_0xe89a('0x1f'),_0x5244e7+'-'+_0x4ac2e+'/'+_0x431f1a)[_0xe89a('0x20')](_0xe47f35);}return null;};}function patchUpdates(_0x2d0679){return function(_0x4ec5bb){try{jsonpatch[_0xe89a('0x21')](_0x4ec5bb,_0x2d0679,!![]);}catch(_0x2fb72a){return BPromise['reject'](_0x2fb72a);}return _0x4ec5bb[_0xe89a('0x22')]();};}function saveUpdates(_0x47347e,_0x55b70f){return function(_0x143faa){if(_0x143faa){return _0x143faa[_0xe89a('0x23')](_0x47347e)[_0xe89a('0x24')](function(_0x1718e6){return _0x1718e6;});}return null;};}function removeEntity(_0x2377bf,_0x594636){return function(_0x10c8d5){if(_0x10c8d5){return _0x10c8d5[_0xe89a('0x25')]()[_0xe89a('0x24')](function(){_0x2377bf[_0xe89a('0x19')](0xcc)[_0xe89a('0x1a')]();});}};}function handleEntityNotFound(_0x28f2b2,_0x2aa7d4){return function(_0x5e5563){if(!_0x5e5563){_0x28f2b2['sendStatus'](0x194);}return _0x5e5563;};}function handleError(_0x350a33,_0x494267){_0x494267=_0x494267||0x1f4;return function(_0x22e096){logger[_0xe89a('0x26')](_0x22e096[_0xe89a('0x27')]);if(_0x22e096['name']){delete _0x22e096['name'];}_0x350a33[_0xe89a('0x19')](_0x494267)[_0xe89a('0x28')](_0x22e096);};}exports['index']=function(_0x5afbbc,_0x6762e4){var _0x1849d0={},_0xa8aad0={},_0x1c8821={'count':0x0,'rows':[]};var _0x5e5573=_[_0xe89a('0x29')](db['VtigerAccount'][_0xe89a('0x2a')],function(_0x45b915){return{'name':_0x45b915[_0xe89a('0x2b')],'type':_0x45b915[_0xe89a('0x2c')][_0xe89a('0x2d')]};});_0xa8aad0[_0xe89a('0x2e')]=_[_0xe89a('0x29')](_0x5e5573,_0xe89a('0x2f'));_0xa8aad0[_0xe89a('0x30')]=_['keys'](_0x5afbbc[_0xe89a('0x30')]);_0xa8aad0[_0xe89a('0x31')]=_[_0xe89a('0x32')](_0xa8aad0[_0xe89a('0x2e')],_0xa8aad0[_0xe89a('0x30')]);_0x1849d0[_0xe89a('0x33')]=_[_0xe89a('0x32')](_0xa8aad0[_0xe89a('0x2e')],qs[_0xe89a('0x34')](_0x5afbbc['query'][_0xe89a('0x34')]));_0x1849d0[_0xe89a('0x33')]=_0x1849d0['attributes']['length']?_0x1849d0['attributes']:_0xa8aad0[_0xe89a('0x2e')];if(!_0x5afbbc[_0xe89a('0x30')][_0xe89a('0x35')](_0xe89a('0x36'))){_0x1849d0[_0xe89a('0x1d')]=qs[_0xe89a('0x1d')](_0x5afbbc[_0xe89a('0x30')][_0xe89a('0x1d')]);_0x1849d0['offset']=qs[_0xe89a('0x1b')](_0x5afbbc[_0xe89a('0x30')][_0xe89a('0x1b')]);}_0x1849d0[_0xe89a('0x37')]=qs[_0xe89a('0x38')](_0x5afbbc['query']['sort']);_0x1849d0[_0xe89a('0x39')]=qs[_0xe89a('0x31')](_[_0xe89a('0x3a')](_0x5afbbc[_0xe89a('0x30')],_0xa8aad0['filters']),_0x5e5573);if(_0x5afbbc[_0xe89a('0x30')][_0xe89a('0x3b')]){_0x1849d0[_0xe89a('0x39')]=_['merge'](_0x1849d0[_0xe89a('0x39')],{'$or':_[_0xe89a('0x29')](_0x5e5573,function(_0x2ddd50){if(_0x2ddd50[_0xe89a('0x2c')]!==_0xe89a('0x3c')){var _0x10e967={};_0x10e967[_0x2ddd50[_0xe89a('0x2f')]]={'$like':'%'+_0x5afbbc[_0xe89a('0x30')][_0xe89a('0x3b')]+'%'};return _0x10e967;}})});}_0x1849d0=_[_0xe89a('0x3d')]({},_0x1849d0,_0x5afbbc[_0xe89a('0x3e')]);var _0x57072f={'where':_0x1849d0[_0xe89a('0x39')]};return db[_0xe89a('0x3f')][_0xe89a('0x1e')](_0x57072f)['then'](function(_0x48d41a){_0x1c8821[_0xe89a('0x1e')]=_0x48d41a;if(_0x5afbbc[_0xe89a('0x30')][_0xe89a('0x40')]){_0x1849d0[_0xe89a('0x41')]=[{'all':!![]}];}return db[_0xe89a('0x3f')][_0xe89a('0x42')](_0x1849d0);})[_0xe89a('0x24')](function(_0xebf6cb){_0x1c8821['rows']=_0xebf6cb;return _0x1c8821;})[_0xe89a('0x24')](respondWithFilteredResult(_0x6762e4,_0x1849d0))['catch'](handleError(_0x6762e4,null));};exports[_0xe89a('0x43')]=function(_0x2f3757,_0x3d04ce){var _0x2ee442={'raw':![],'where':{'id':_0x2f3757[_0xe89a('0x44')]['id']}},_0x20ebdd={};_0x20ebdd[_0xe89a('0x2e')]=_[_0xe89a('0x45')](db[_0xe89a('0x3f')]['rawAttributes']);_0x20ebdd[_0xe89a('0x30')]=_['keys'](_0x2f3757['query']);_0x20ebdd[_0xe89a('0x31')]=_[_0xe89a('0x32')](_0x20ebdd[_0xe89a('0x2e')],_0x20ebdd[_0xe89a('0x30')]);_0x2ee442[_0xe89a('0x33')]=_[_0xe89a('0x32')](_0x20ebdd[_0xe89a('0x2e')],qs[_0xe89a('0x34')](_0x2f3757[_0xe89a('0x30')]['fields']));_0x2ee442[_0xe89a('0x33')]=_0x2ee442[_0xe89a('0x33')]['length']?_0x2ee442[_0xe89a('0x33')]:_0x20ebdd['model'];if(_0x2f3757['query'][_0xe89a('0x40')]){_0x2ee442[_0xe89a('0x41')]=[{'all':!![]}];}_0x2ee442=_['merge']({},_0x2ee442,_0x2f3757[_0xe89a('0x3e')]);return db[_0xe89a('0x3f')][_0xe89a('0x46')](_0x2ee442)[_0xe89a('0x24')](handleEntityNotFound(_0x3d04ce,null))[_0xe89a('0x24')](respondWithResult(_0x3d04ce,null))[_0xe89a('0x47')](handleError(_0x3d04ce,null));};exports[_0xe89a('0x48')]=function(_0x2b8d96,_0xf76b98){return db[_0xe89a('0x3f')][_0xe89a('0x48')](_0x2b8d96[_0xe89a('0x49')],{})[_0xe89a('0x24')](respondWithResult(_0xf76b98,0xc9))[_0xe89a('0x47')](handleError(_0xf76b98,null));};exports[_0xe89a('0x23')]=function(_0x4c0632,_0x165e5c){if(_0x4c0632[_0xe89a('0x49')]['id']){delete _0x4c0632['body']['id'];}return db['VtigerAccount'][_0xe89a('0x46')]({'where':{'id':_0x4c0632['params']['id']}})[_0xe89a('0x24')](handleEntityNotFound(_0x165e5c,null))['then'](saveUpdates(_0x4c0632[_0xe89a('0x49')],null))[_0xe89a('0x24')](respondWithResult(_0x165e5c,null))[_0xe89a('0x47')](handleError(_0x165e5c,null));};exports[_0xe89a('0x25')]=function(_0xa89850,_0x42af46){return db[_0xe89a('0x3f')][_0xe89a('0x46')]({'where':{'id':_0xa89850[_0xe89a('0x44')]['id']}})['then'](handleEntityNotFound(_0x42af46,null))['then'](removeEntity(_0x42af46,null))['catch'](handleError(_0x42af46,null));};exports[_0xe89a('0x4a')]=function(_0x623a03,_0x55616a,_0x599617){var _0x429b6d={};var _0x1afdc0={};var _0xdf3354;var _0x4d4298;return db['VtigerAccount']['findOne']({'where':{'id':_0x623a03['params']['id']}})[_0xe89a('0x24')](handleEntityNotFound(_0x55616a,null))['then'](function(_0xe8ac93){if(_0xe8ac93){_0xdf3354=_0xe8ac93;_0x1afdc0['model']=_[_0xe89a('0x45')](db[_0xe89a('0x4b')]['rawAttributes']);_0x1afdc0[_0xe89a('0x30')]=_[_0xe89a('0x45')](_0x623a03[_0xe89a('0x30')]);_0x1afdc0[_0xe89a('0x31')]=_[_0xe89a('0x32')](_0x1afdc0[_0xe89a('0x2e')],_0x1afdc0['query']);_0x429b6d[_0xe89a('0x33')]=_[_0xe89a('0x32')](_0x1afdc0[_0xe89a('0x2e')],qs[_0xe89a('0x34')](_0x623a03[_0xe89a('0x30')][_0xe89a('0x34')]));_0x429b6d[_0xe89a('0x33')]=_0x429b6d[_0xe89a('0x33')][_0xe89a('0x4c')]?_0x429b6d[_0xe89a('0x33')]:_0x1afdc0[_0xe89a('0x2e')];_0x429b6d[_0xe89a('0x37')]=qs[_0xe89a('0x38')](_0x623a03[_0xe89a('0x30')][_0xe89a('0x38')]);_0x429b6d[_0xe89a('0x39')]=qs[_0xe89a('0x31')](_['pick'](_0x623a03[_0xe89a('0x30')],_0x1afdc0[_0xe89a('0x31')]));if(_0x623a03[_0xe89a('0x30')][_0xe89a('0x3b')]){_0x429b6d[_0xe89a('0x39')]=_[_0xe89a('0x3d')](_0x429b6d['where'],{'$or':_[_0xe89a('0x29')](_0x429b6d['attributes'],function(_0x56d708){var _0x30814d={};_0x30814d[_0x56d708]={'$like':'%'+_0x623a03[_0xe89a('0x30')][_0xe89a('0x3b')]+'%'};return _0x30814d;})});}_0x429b6d=_[_0xe89a('0x3d')]({},_0x429b6d,_0x623a03['options']);return _0xdf3354[_0xe89a('0x4a')](_0x429b6d);}})[_0xe89a('0x24')](function(_0x557931){if(_0x557931){_0x4d4298=_0x557931[_0xe89a('0x4c')];if(!_0x623a03['query'][_0xe89a('0x35')](_0xe89a('0x36'))){_0x429b6d['limit']=qs[_0xe89a('0x1d')](_0x623a03['query'][_0xe89a('0x1d')]);_0x429b6d[_0xe89a('0x1b')]=qs[_0xe89a('0x1b')](_0x623a03[_0xe89a('0x30')][_0xe89a('0x1b')]);}return _0xdf3354[_0xe89a('0x4a')](_0x429b6d);}})[_0xe89a('0x24')](function(_0x14e464){if(_0x14e464){return _0x14e464?{'count':_0x4d4298,'rows':_0x14e464}:null;}})['then'](respondWithResult(_0x55616a,null))['catch'](handleError(_0x55616a,null));};exports[_0xe89a('0x4d')]=function(_0x1535c8,_0x5b7e45,_0x4e6d65){if(_0x1535c8[_0xe89a('0x49')]['id']){delete _0x1535c8[_0xe89a('0x49')]['id'];}return db[_0xe89a('0x3f')][_0xe89a('0x4e')]({'where':{'id':_0x1535c8[_0xe89a('0x44')]['id']}})[_0xe89a('0x24')](handleEntityNotFound(_0x5b7e45,null))['then'](function(_0x3c15c0){if(_0x3c15c0){_0x1535c8[_0xe89a('0x49')][_0xe89a('0x4f')]=_0x3c15c0['id'];_0x1535c8[_0xe89a('0x49')][_0xe89a('0x50')]=integrations[_0xe89a('0x51')](_0x1535c8[_0xe89a('0x49')][_0xe89a('0x52')],_0x1535c8[_0xe89a('0x49')]['type']);_0x1535c8['body'][_0xe89a('0x53')]=integrations[_0xe89a('0x54')](_0x1535c8[_0xe89a('0x49')][_0xe89a('0x52')],_0x1535c8[_0xe89a('0x49')][_0xe89a('0x2c')]);return db[_0xe89a('0x4b')][_0xe89a('0x48')](_0x1535c8[_0xe89a('0x49')],{'include':[{'model':db['VtigerField'],'as':_0xe89a('0x50')},{'model':db[_0xe89a('0x55')],'as':_0xe89a('0x53')}]});}return null;})[_0xe89a('0x24')](respondWithResult(_0x5b7e45,null))[_0xe89a('0x47')](handleError(_0x5b7e45,null));};var md5=require(_0xe89a('0x56'));exports[_0xe89a('0x57')]=function(_0x9c31dc,_0x3017a7,_0x386c5e){var _0x4a850b=null;var _0x2ce731=null;var _0x3092f1=null;var _0x29e5ce=null;var _0x5db844='';return db['VtigerAccount'][_0xe89a('0x4e')]({'where':{'id':_0x9c31dc['params']['id']},'attributes':['id',_0xe89a('0x2f'),_0xe89a('0x58'),_0xe89a('0x59'),_0xe89a('0x5a'),_0xe89a('0x5b'),_0xe89a('0x5c'),_0xe89a('0x5d')]})[_0xe89a('0x24')](handleEntityNotFound(_0x3017a7,null))[_0xe89a('0x24')](function(_0x9e7db3){if(_0x9e7db3){_0x4a850b=_0x9e7db3[_0xe89a('0x58')];_0x2ce731=_0x9e7db3[_0xe89a('0x5d')];_0x3092f1=_0x9e7db3[_0xe89a('0x5a')];_0x5db844=_0x9e7db3[_0xe89a('0x5b')];var _0x88f675=_0x5db844[_0xe89a('0x5e')](-0x1);if(_0x88f675==='/'){_0x5db844=_0x5db844[_0xe89a('0x5f')](0x0,_0x5db844[_0xe89a('0x60')](_0x88f675));}_0x29e5ce=util[_0xe89a('0x61')](_0xe89a('0x62'),_0x5db844);var _0xc94413={'method':_0xe89a('0x63'),'uri':_0x29e5ce,'qs':{'operation':'getchallenge','username':_0x9e7db3['username']},'json':!![]};return rp(_0xc94413);}})[_0xe89a('0x24')](function(_0x5f529b){if(_0x5f529b['success']){var _0x3bf9a3={'method':_0xe89a('0x64'),'uri':_0x29e5ce,'form':{'operation':'login','username':_0x4a850b,'accessKey':md5(_0x5f529b[_0xe89a('0x65')][_0xe89a('0x66')]+_0x2ce731)},'json':!![]};return rp(_0x3bf9a3);}})[_0xe89a('0x24')](function(_0x4a547d){if(_0x4a547d[_0xe89a('0x67')]){var _0x12a9b9={'method':'GET','uri':_0x29e5ce,'qs':{'operation':_0xe89a('0x68'),'username':_0x4a850b,'sessionName':_0x4a547d[_0xe89a('0x65')][_0xe89a('0x69')],'elementType':_0x3092f1},'json':!![]};return rp(_0x12a9b9);}})['then'](function(_0x28bfaf){if(_0x28bfaf[_0xe89a('0x67')]){var _0x28e62c=['autogenerated',_0xe89a('0x6a'),_0xe89a('0x6b')];_[_0xe89a('0x6c')](_0x28bfaf['result'][_0xe89a('0x34')],function(_0x2453f2){return _0x28e62c[_0xe89a('0x6d')](_0x2453f2[_0xe89a('0x2c')][_0xe89a('0x2f')]);});_[_0xe89a('0x6c')](_0x28bfaf[_0xe89a('0x65')][_0xe89a('0x34')],function(_0x2dd76c){return _0x2dd76c['editable']===_0xe89a('0x6e');});return{'count':_0x28bfaf[_0xe89a('0x65')][_0xe89a('0x34')][_0xe89a('0x4c')],'rows':_[_0xe89a('0x29')](_0x28bfaf[_0xe89a('0x65')][_0xe89a('0x34')],function(_0xa06b69){return{'id':_0xa06b69[_0xe89a('0x2f')],'name':_0xa06b69['label'],'custom':_[_0xe89a('0x6f')](_0xa06b69[_0xe89a('0x2f')],'cf_')?!![]:![],'options':_0xa06b69[_0xe89a('0x2c')][_0xe89a('0x2f')]===_0xe89a('0x70')&&_0xa06b69[_0xe89a('0x2c')][_0xe89a('0x71')][_0xe89a('0x4c')]>0x0?_[_0xe89a('0x29')](_0xa06b69[_0xe89a('0x2c')][_0xe89a('0x71')],function(_0x34f651){return{'name':_0x34f651[_0xe89a('0x72')],'value':_0x34f651['value']};}):[]};})};}})[_0xe89a('0x24')](respondWithResult(_0x3017a7,null))['catch'](function(_0xed7c19){console[_0xe89a('0x73')](_0xe89a('0x74')+_0xed7c19);var _0x171697=_0x9c31dc['query']['test']?0x1f4:_0xed7c19[_0xe89a('0x75')]||0x1f4;logger[_0xe89a('0x26')](_0xe89a('0x76'),_0xe89a('0x57'),_0x171697,JSON['stringify'](_0xed7c19));delete _0xed7c19[_0xe89a('0x2f')];if(_0x171697===0x191){_0x171697=0x190;}_0x3017a7[_0xe89a('0x19')](_0x171697)[_0xe89a('0x28')](_0x9c31dc['query'][_0xe89a('0x77')]?{'message':'Wrong\x20credentials','statusCode':_0xed7c19[_0xe89a('0x75')]}:_0xed7c19);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index b12ed2f..98ef6cc 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 _0x050f=['define','VtigerAccount','int_vtiger_accounts','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration','exports'];(function(_0x3f6460,_0x303072){var _0x4446f4=function(_0x50f6f0){while(--_0x50f6f0){_0x3f6460['push'](_0x3f6460['shift']());}};_0x4446f4(++_0x303072);}(_0x050f,0x17a));var _0xf050=function(_0x30a5f8,_0x25b651){_0x30a5f8=_0x30a5f8-0x0;var _0x380e77=_0x050f[_0x30a5f8];return _0x380e77;};'use strict';var _=require('lodash');var util=require(_0xf050('0x0'));var logger=require(_0xf050('0x1'))(_0xf050('0x2'));var moment=require(_0xf050('0x3'));var BPromise=require(_0xf050('0x4'));var rp=require(_0xf050('0x5'));var fs=require('fs');var path=require(_0xf050('0x6'));var rimraf=require(_0xf050('0x7'));var config=require(_0xf050('0x8'));var attributes=require(_0xf050('0x9'));var integrations=require(_0xf050('0xa'));module[_0xf050('0xb')]=function(_0x32339b,_0x5b072e){return _0x32339b[_0xf050('0xc')](_0xf050('0xd'),attributes,{'tableName':_0xf050('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe66a=['../../components/integrations/configuration','define','VtigerAccount','int_vtiger_accounts','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x21e18d,_0x1ecea5){var _0x354b32=function(_0x4df010){while(--_0x4df010){_0x21e18d['push'](_0x21e18d['shift']());}};_0x354b32(++_0x1ecea5);}(_0xe66a,0x1a8));var _0xae66=function(_0x12c27c,_0x32a628){_0x12c27c=_0x12c27c-0x0;var _0x3aebdf=_0xe66a[_0x12c27c];return _0x3aebdf;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xae66('0x0'))(_0xae66('0x1'));var moment=require(_0xae66('0x2'));var BPromise=require(_0xae66('0x3'));var rp=require(_0xae66('0x4'));var fs=require('fs');var path=require(_0xae66('0x5'));var rimraf=require(_0xae66('0x6'));var config=require(_0xae66('0x7'));var attributes=require('./intVtigerAccount.attributes');var integrations=require(_0xae66('0x8'));module['exports']=function(_0x179ad1,_0x44e276){return _0x179ad1[_0xae66('0x9')](_0xae66('0xa'),attributes,{'tableName':_0xae66('0xb'),'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 dc68823..5f1e7e0 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 _0x6c76=['findAll','options','raw','where','attributes','map','include','model','GetVtigerAccount','debug','ShowVtigerAccount','VtigerAccount','find','then','lodash','util','moment','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','request','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x523c46,_0x5b8a47){var _0x5b7f60=function(_0x31bd13){while(--_0x31bd13){_0x523c46['push'](_0x523c46['shift']());}};_0x5b7f60(++_0x5b8a47);}(_0x6c76,0x184));var _0x66c7=function(_0x1d9e5e,_0x15c8ba){_0x1d9e5e=_0x1d9e5e-0x0;var _0x2034b7=_0x6c76[_0x1d9e5e];return _0x2034b7;};'use strict';var _=require(_0x66c7('0x0'));var util=require(_0x66c7('0x1'));var moment=require(_0x66c7('0x2'));var BPromise=require('bluebird');var rs=require(_0x66c7('0x3'));var fs=require('fs');var Redis=require(_0x66c7('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x66c7('0x5'))(_0x66c7('0x6'));var config=require('../../config/environment');var jayson=require(_0x66c7('0x7'));var client=jayson[_0x66c7('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x23408c,_0x4dffcd,_0x4fa6ce){return new BPromise(function(_0x208d06,_0x2b0065){return client[_0x66c7('0x9')](_0x23408c,_0x4fa6ce)['then'](function(_0x20c010){logger[_0x66c7('0xa')](_0x66c7('0xb'),_0x4dffcd,_0x66c7('0xc'));logger['debug'](_0x66c7('0xd'),_0x4dffcd,_0x66c7('0xc'),JSON[_0x66c7('0xe')](_0x20c010));if(_0x20c010[_0x66c7('0xf')]){if(_0x20c010[_0x66c7('0xf')][_0x66c7('0x10')]===0x1f4){logger[_0x66c7('0xf')]('VtigerAccount,\x20%s,\x20%s',_0x4dffcd,_0x20c010[_0x66c7('0xf')][_0x66c7('0x11')]);return _0x2b0065(_0x20c010[_0x66c7('0xf')][_0x66c7('0x11')]);}logger[_0x66c7('0xf')](_0x66c7('0xb'),_0x4dffcd,_0x20c010[_0x66c7('0xf')][_0x66c7('0x11')]);return _0x208d06(_0x20c010[_0x66c7('0xf')]['message']);}else{logger[_0x66c7('0xa')]('VtigerAccount,\x20%s,\x20%s',_0x4dffcd,_0x66c7('0xc'));_0x208d06(_0x20c010[_0x66c7('0x12')][_0x66c7('0x11')]);}})[_0x66c7('0x13')](function(_0x22b262){logger['error']('VtigerAccount,\x20%s,\x20%s',_0x4dffcd,_0x22b262);_0x2b0065(_0x22b262);});});}exports['GetVtigerAccount']=function(_0x5129f6){var _0x8ad572=this;return new Promise(function(_0x19f29d,_0x47a299){return db['VtigerAccount'][_0x66c7('0x14')]({'raw':_0x5129f6[_0x66c7('0x15')]?_0x5129f6[_0x66c7('0x15')][_0x66c7('0x16')]===undefined?!![]:![]:!![],'where':_0x5129f6['options']?_0x5129f6['options'][_0x66c7('0x17')]||null:null,'attributes':_0x5129f6[_0x66c7('0x15')]?_0x5129f6[_0x66c7('0x15')][_0x66c7('0x18')]||null:null,'limit':_0x5129f6[_0x66c7('0x15')]?_0x5129f6[_0x66c7('0x15')]['limit']||null:null,'include':_0x5129f6[_0x66c7('0x15')]?_0x5129f6[_0x66c7('0x15')]['include']?_[_0x66c7('0x19')](_0x5129f6[_0x66c7('0x15')][_0x66c7('0x1a')],function(_0x1fc9d3){return{'model':db[_0x1fc9d3['model']],'as':_0x1fc9d3['as'],'attributes':_0x1fc9d3[_0x66c7('0x18')],'include':_0x1fc9d3[_0x66c7('0x1a')]?_['map'](_0x1fc9d3[_0x66c7('0x1a')],function(_0x11a6b9){return{'model':db[_0x11a6b9[_0x66c7('0x1b')]],'as':_0x11a6b9['as'],'attributes':_0x11a6b9[_0x66c7('0x18')],'include':_0x11a6b9[_0x66c7('0x1a')]?_['map'](_0x11a6b9['include'],function(_0x4e514a){return{'model':db[_0x4e514a[_0x66c7('0x1b')]],'as':_0x4e514a['as'],'attributes':_0x4e514a[_0x66c7('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x9afd50){logger[_0x66c7('0xa')](_0x66c7('0x1c'),_0x5129f6);logger[_0x66c7('0x1d')](_0x66c7('0x1c'),_0x5129f6,JSON[_0x66c7('0xe')](_0x9afd50));_0x19f29d(_0x9afd50);})['catch'](function(_0xccefb2){logger[_0x66c7('0xf')](_0x66c7('0x1c'),_0xccefb2[_0x66c7('0x11')],_0x5129f6);_0x47a299(_0x8ad572[_0x66c7('0xf')](0x1f4,_0xccefb2['message']));});});};exports[_0x66c7('0x1e')]=function(_0x4f1a34){var _0xfbd97=this;return new Promise(function(_0x543fbf,_0x296875){return db[_0x66c7('0x1f')][_0x66c7('0x20')]({'raw':_0x4f1a34[_0x66c7('0x15')]?_0x4f1a34[_0x66c7('0x15')][_0x66c7('0x16')]===undefined?!![]:![]:!![],'where':_0x4f1a34['options']?_0x4f1a34['options'][_0x66c7('0x17')]||null:null,'attributes':_0x4f1a34[_0x66c7('0x15')]?_0x4f1a34[_0x66c7('0x15')][_0x66c7('0x18')]||null:null,'include':_0x4f1a34[_0x66c7('0x15')]?_0x4f1a34[_0x66c7('0x15')][_0x66c7('0x1a')]?_[_0x66c7('0x19')](_0x4f1a34[_0x66c7('0x15')][_0x66c7('0x1a')],function(_0x1fd460){return{'model':db[_0x1fd460[_0x66c7('0x1b')]],'as':_0x1fd460['as'],'attributes':_0x1fd460['attributes'],'include':_0x1fd460['include']?_[_0x66c7('0x19')](_0x1fd460[_0x66c7('0x1a')],function(_0x367ad5){return{'model':db[_0x367ad5[_0x66c7('0x1b')]],'as':_0x367ad5['as'],'attributes':_0x367ad5[_0x66c7('0x18')],'include':_0x367ad5[_0x66c7('0x1a')]?_[_0x66c7('0x19')](_0x367ad5['include'],function(_0x30b90f){return{'model':db[_0x30b90f[_0x66c7('0x1b')]],'as':_0x30b90f['as'],'attributes':_0x30b90f[_0x66c7('0x18')]};}):[]};}):[]};}):[]:[]})[_0x66c7('0x21')](function(_0x1e5993){logger[_0x66c7('0xa')](_0x66c7('0x1e'),_0x4f1a34);logger[_0x66c7('0x1d')](_0x66c7('0x1e'),_0x4f1a34,JSON[_0x66c7('0xe')](_0x1e5993));_0x543fbf(_0x1e5993);})[_0x66c7('0x13')](function(_0x4cd663){logger['error'](_0x66c7('0x1e'),_0x4cd663[_0x66c7('0x11')],_0x4f1a34);_0x296875(_0xfbd97[_0x66c7('0xf')](0x1f4,_0x4cd663['message']));});});}; \ No newline at end of file +var _0x3c81=['debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetVtigerAccount','VtigerAccount','findAll','options','raw','where','attributes','limit','include','map','model','catch','ShowVtigerAccount','lodash','util','bluebird','randomstring','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent'];(function(_0x225740,_0x339d2b){var _0x183a4a=function(_0x518019){while(--_0x518019){_0x225740['push'](_0x225740['shift']());}};_0x183a4a(++_0x339d2b);}(_0x3c81,0x102));var _0x13c8=function(_0x117a81,_0x226576){_0x117a81=_0x117a81-0x0;var _0x13ebe3=_0x3c81[_0x117a81];return _0x13ebe3;};'use strict';var _=require(_0x13c8('0x0'));var util=require(_0x13c8('0x1'));var moment=require('moment');var BPromise=require(_0x13c8('0x2'));var rs=require(_0x13c8('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x13c8('0x4'));var config=require(_0x13c8('0x5'));var jayson=require(_0x13c8('0x6'));var client=jayson[_0x13c8('0x7')][_0x13c8('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3f0bd2,_0x445b69,_0x4f7bcc){return new BPromise(function(_0x17c228,_0x4905c3){return client[_0x13c8('0x9')](_0x3f0bd2,_0x4f7bcc)[_0x13c8('0xa')](function(_0x189ce6){logger[_0x13c8('0xb')](_0x13c8('0xc'),_0x445b69,_0x13c8('0xd'));logger[_0x13c8('0xe')](_0x13c8('0xf'),_0x445b69,_0x13c8('0xd'),JSON[_0x13c8('0x10')](_0x189ce6));if(_0x189ce6[_0x13c8('0x11')]){if(_0x189ce6[_0x13c8('0x11')][_0x13c8('0x12')]===0x1f4){logger[_0x13c8('0x11')]('VtigerAccount,\x20%s,\x20%s',_0x445b69,_0x189ce6[_0x13c8('0x11')][_0x13c8('0x13')]);return _0x4905c3(_0x189ce6[_0x13c8('0x11')][_0x13c8('0x13')]);}logger['error'](_0x13c8('0xc'),_0x445b69,_0x189ce6['error']['message']);return _0x17c228(_0x189ce6['error'][_0x13c8('0x13')]);}else{logger['info'](_0x13c8('0xc'),_0x445b69,_0x13c8('0xd'));_0x17c228(_0x189ce6[_0x13c8('0x14')][_0x13c8('0x13')]);}})['catch'](function(_0x13a9e1){logger[_0x13c8('0x11')](_0x13c8('0xc'),_0x445b69,_0x13a9e1);_0x4905c3(_0x13a9e1);});});}exports[_0x13c8('0x15')]=function(_0xce1ad2){var _0x28f07e=this;return new Promise(function(_0x346417,_0x251c38){return db[_0x13c8('0x16')][_0x13c8('0x17')]({'raw':_0xce1ad2[_0x13c8('0x18')]?_0xce1ad2['options'][_0x13c8('0x19')]===undefined?!![]:![]:!![],'where':_0xce1ad2[_0x13c8('0x18')]?_0xce1ad2[_0x13c8('0x18')][_0x13c8('0x1a')]||null:null,'attributes':_0xce1ad2['options']?_0xce1ad2[_0x13c8('0x18')][_0x13c8('0x1b')]||null:null,'limit':_0xce1ad2[_0x13c8('0x18')]?_0xce1ad2[_0x13c8('0x18')][_0x13c8('0x1c')]||null:null,'include':_0xce1ad2[_0x13c8('0x18')]?_0xce1ad2['options'][_0x13c8('0x1d')]?_[_0x13c8('0x1e')](_0xce1ad2[_0x13c8('0x18')][_0x13c8('0x1d')],function(_0x577df6){return{'model':db[_0x577df6[_0x13c8('0x1f')]],'as':_0x577df6['as'],'attributes':_0x577df6[_0x13c8('0x1b')],'include':_0x577df6['include']?_['map'](_0x577df6[_0x13c8('0x1d')],function(_0x4aff35){return{'model':db[_0x4aff35['model']],'as':_0x4aff35['as'],'attributes':_0x4aff35['attributes'],'include':_0x4aff35[_0x13c8('0x1d')]?_[_0x13c8('0x1e')](_0x4aff35['include'],function(_0x4df077){return{'model':db[_0x4df077[_0x13c8('0x1f')]],'as':_0x4df077['as'],'attributes':_0x4df077['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x1c7dc4){logger[_0x13c8('0xb')](_0x13c8('0x15'),_0xce1ad2);logger['debug']('GetVtigerAccount',_0xce1ad2,JSON[_0x13c8('0x10')](_0x1c7dc4));_0x346417(_0x1c7dc4);})[_0x13c8('0x20')](function(_0x399840){logger[_0x13c8('0x11')](_0x13c8('0x15'),_0x399840[_0x13c8('0x13')],_0xce1ad2);_0x251c38(_0x28f07e[_0x13c8('0x11')](0x1f4,_0x399840['message']));});});};exports[_0x13c8('0x21')]=function(_0xcbc9b7){var _0x5a5911=this;return new Promise(function(_0x5c85e4,_0x23a725){return db[_0x13c8('0x16')]['find']({'raw':_0xcbc9b7[_0x13c8('0x18')]?_0xcbc9b7[_0x13c8('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0xcbc9b7[_0x13c8('0x18')]?_0xcbc9b7[_0x13c8('0x18')][_0x13c8('0x1a')]||null:null,'attributes':_0xcbc9b7[_0x13c8('0x18')]?_0xcbc9b7[_0x13c8('0x18')][_0x13c8('0x1b')]||null:null,'include':_0xcbc9b7[_0x13c8('0x18')]?_0xcbc9b7[_0x13c8('0x18')]['include']?_['map'](_0xcbc9b7[_0x13c8('0x18')][_0x13c8('0x1d')],function(_0x517d01){return{'model':db[_0x517d01[_0x13c8('0x1f')]],'as':_0x517d01['as'],'attributes':_0x517d01['attributes'],'include':_0x517d01[_0x13c8('0x1d')]?_['map'](_0x517d01[_0x13c8('0x1d')],function(_0x53de18){return{'model':db[_0x53de18[_0x13c8('0x1f')]],'as':_0x53de18['as'],'attributes':_0x53de18[_0x13c8('0x1b')],'include':_0x53de18[_0x13c8('0x1d')]?_[_0x13c8('0x1e')](_0x53de18[_0x13c8('0x1d')],function(_0x5287f2){return{'model':db[_0x5287f2[_0x13c8('0x1f')]],'as':_0x5287f2['as'],'attributes':_0x5287f2[_0x13c8('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x362b9c){logger[_0x13c8('0xb')](_0x13c8('0x21'),_0xcbc9b7);logger['debug']('ShowVtigerAccount',_0xcbc9b7,JSON['stringify'](_0x362b9c));_0x5c85e4(_0x362b9c);})[_0x13c8('0x20')](function(_0x2c8218){logger[_0x13c8('0x11')](_0x13c8('0x21'),_0x2c8218[_0x13c8('0x13')],_0xcbc9b7);_0x23a725(_0x5a5911[_0x13c8('0x11')](0x1f4,_0x2c8218[_0x13c8('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index aa23fe9..3d665c2 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 _0xdda8=['/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','post','put','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show'];(function(_0x44a9a9,_0x4acfa6){var _0x31b17c=function(_0x2b9427){while(--_0x2b9427){_0x44a9a9['push'](_0x44a9a9['shift']());}};_0x31b17c(++_0x4acfa6);}(_0xdda8,0x7c));var _0x8dda=function(_0x285925,_0x1e13c3){_0x285925=_0x285925-0x0;var _0x355d72=_0xdda8[_0x285925];return _0x355d72;};'use strict';var multer=require(_0x8dda('0x0'));var util=require(_0x8dda('0x1'));var path=require(_0x8dda('0x2'));var timeout=require(_0x8dda('0x3'));var express=require(_0x8dda('0x4'));var router=express['Router']();var fs_extra=require(_0x8dda('0x5'));var auth=require(_0x8dda('0x6'));var interaction=require(_0x8dda('0x7'));var config=require(_0x8dda('0x8'));var controller=require('./intVtigerConfiguration.controller');router[_0x8dda('0x9')]('/',auth[_0x8dda('0xa')](),controller[_0x8dda('0xb')]);router['get'](_0x8dda('0xc'),auth[_0x8dda('0xa')](),controller[_0x8dda('0xd')]);router[_0x8dda('0x9')](_0x8dda('0xe'),auth['isAuthenticated'](),controller['getFields']);router[_0x8dda('0x9')](_0x8dda('0xf'),auth[_0x8dda('0xa')](),controller[_0x8dda('0x10')]);router[_0x8dda('0x9')](_0x8dda('0x11'),auth[_0x8dda('0xa')](),controller['getDescriptions']);router[_0x8dda('0x12')]('/',auth['isAuthenticated'](),controller['create']);router[_0x8dda('0x13')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x8dda('0x14')]('/:id',auth['isAuthenticated'](),controller[_0x8dda('0x15')]);module[_0x8dda('0x16')]=router; \ No newline at end of file +var _0x484a=['path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','post','create','put','update','delete','destroy','exports','multer','util'];(function(_0xee58d1,_0x7d3543){var _0x31adc8=function(_0x5d0579){while(--_0x5d0579){_0xee58d1['push'](_0xee58d1['shift']());}};_0x31adc8(++_0x7d3543);}(_0x484a,0x1a7));var _0xa484=function(_0x2d81c1,_0x5a4193){_0x2d81c1=_0x2d81c1-0x0;var _0x3cd1f6=_0x484a[_0x2d81c1];return _0x3cd1f6;};'use strict';var multer=require(_0xa484('0x0'));var util=require(_0xa484('0x1'));var path=require(_0xa484('0x2'));var timeout=require('connect-timeout');var express=require(_0xa484('0x3'));var router=express['Router']();var fs_extra=require(_0xa484('0x4'));var auth=require(_0xa484('0x5'));var interaction=require(_0xa484('0x6'));var config=require(_0xa484('0x7'));var controller=require(_0xa484('0x8'));router[_0xa484('0x9')]('/',auth[_0xa484('0xa')](),controller[_0xa484('0xb')]);router[_0xa484('0x9')](_0xa484('0xc'),auth[_0xa484('0xa')](),controller[_0xa484('0xd')]);router[_0xa484('0x9')](_0xa484('0xe'),auth[_0xa484('0xa')](),controller[_0xa484('0xf')]);router['get'](_0xa484('0x10'),auth[_0xa484('0xa')](),controller['getSubjects']);router[_0xa484('0x9')](_0xa484('0x11'),auth[_0xa484('0xa')](),controller['getDescriptions']);router[_0xa484('0x12')]('/',auth[_0xa484('0xa')](),controller[_0xa484('0x13')]);router[_0xa484('0x14')]('/:id',auth[_0xa484('0xa')](),controller[_0xa484('0x15')]);router[_0xa484('0x16')]('/:id',auth[_0xa484('0xa')](),controller[_0xa484('0x17')]);module[_0xa484('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 62b88a0..bb81e98 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 _0x5543=['sequelize','STRING'];(function(_0x272b69,_0x4ccffb){var _0x26925c=function(_0x17050a){while(--_0x17050a){_0x272b69['push'](_0x272b69['shift']());}};_0x26925c(++_0x4ccffb);}(_0x5543,0xb2));var _0x3554=function(_0x35d4e9,_0x298c61){_0x35d4e9=_0x35d4e9-0x0;var _0x5c2770=_0x5543[_0x35d4e9];return _0x5c2770;};'use strict';var Sequelize=require(_0x3554('0x0'));module['exports']={'name':{'type':Sequelize[_0x3554('0x1')]},'description':{'type':Sequelize[_0x3554('0x1')]}}; \ No newline at end of file +var _0xc639=['STRING','sequelize'];(function(_0x219a67,_0x213249){var _0x1c6efc=function(_0x312651){while(--_0x312651){_0x219a67['push'](_0x219a67['shift']());}};_0x1c6efc(++_0x213249);}(_0xc639,0xa9));var _0x9c63=function(_0x5c8866,_0x23e7d9){_0x5c8866=_0x5c8866-0x0;var _0x2f1dd0=_0xc639[_0x5c8866];return _0x2f1dd0;};'use strict';var Sequelize=require(_0x9c63('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x9c63('0x1')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index fa852aa..18e5e20 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 _0x01d3=['../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','apply','reject','save','update','then','destroy','error','stack','name','index','VtigerConfiguration','rawAttributes','fieldName','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','map','type','VIRTUAL','include','rows','catch','show','params','includeAll','options','create','body','find','getFields','findOne','nolimit','getSubjects','VtigerField','getDescriptions','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x2ce0fb,_0x5793e9){var _0x1a5f35=function(_0xe59b54){while(--_0xe59b54){_0x2ce0fb['push'](_0x2ce0fb['shift']());}};_0x1a5f35(++_0x5793e9);}(_0x01d3,0xdb));var _0x301d=function(_0x2c6af3,_0x3ce442){_0x2c6af3=_0x2c6af3-0x0;var _0x4895bf=_0x01d3[_0x2c6af3];return _0x4895bf;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x301d('0x0'));var jsonpatch=require(_0x301d('0x1'));var rp=require(_0x301d('0x2'));var moment=require('moment');var BPromise=require(_0x301d('0x3'));var Mustache=require(_0x301d('0x4'));var util=require(_0x301d('0x5'));var path=require(_0x301d('0x6'));var sox=require(_0x301d('0x7'));var csv=require('to-csv');var ejs=require(_0x301d('0x8'));var fs=require('fs');var fs_extra=require(_0x301d('0x9'));var _=require(_0x301d('0xa'));var squel=require(_0x301d('0xb'));var crypto=require(_0x301d('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x301d('0xd'));var toCsv=require(_0x301d('0xe'));var querystring=require(_0x301d('0xf'));var Papa=require(_0x301d('0x10'));var Redis=require(_0x301d('0x11'));var authService=require(_0x301d('0x12'));var qs=require(_0x301d('0x13'));var as=require(_0x301d('0x14'));var hardwareService=require(_0x301d('0x15'));var logger=require('../../config/logger')(_0x301d('0x16'));var utils=require(_0x301d('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x301d('0x18'));var db=require(_0x301d('0x19'))['db'];function respondWithStatusCode(_0x2eb3af,_0x53bfe2){_0x53bfe2=_0x53bfe2||0xcc;return function(_0x496f0c){if(_0x496f0c){return _0x2eb3af[_0x301d('0x1a')](_0x53bfe2);}return _0x2eb3af[_0x301d('0x1b')](_0x53bfe2)[_0x301d('0x1c')]();};}function respondWithResult(_0x377c7f,_0x11bacf){_0x11bacf=_0x11bacf||0xc8;return function(_0x5bdd8a){if(_0x5bdd8a){return _0x377c7f[_0x301d('0x1b')](_0x11bacf)['json'](_0x5bdd8a);}};}function respondWithFilteredResult(_0x1d4fb4,_0xc35239){return function(_0x4fd833){if(_0x4fd833){var _0x10d277=typeof _0xc35239[_0x301d('0x1d')]===_0x301d('0x1e')&&typeof _0xc35239[_0x301d('0x1f')]===_0x301d('0x1e');var _0x1c409b=_0x4fd833[_0x301d('0x20')];var _0x2c7afb=_0x10d277?0x0:_0xc35239[_0x301d('0x1d')];var _0x3a2ad2=_0x10d277?_0x4fd833[_0x301d('0x20')]:_0xc35239[_0x301d('0x1d')]+_0xc35239[_0x301d('0x1f')];var _0x3d75e5;if(_0x3a2ad2>=_0x1c409b){_0x3a2ad2=_0x1c409b;_0x3d75e5=0xc8;}else{_0x3d75e5=0xce;}_0x1d4fb4[_0x301d('0x1b')](_0x3d75e5);return _0x1d4fb4['set']('Content-Range',_0x2c7afb+'-'+_0x3a2ad2+'/'+_0x1c409b)['json'](_0x4fd833);}return null;};}function patchUpdates(_0x31c94e){return function(_0x17ee2a){try{jsonpatch[_0x301d('0x21')](_0x17ee2a,_0x31c94e,!![]);}catch(_0x4d8006){return BPromise[_0x301d('0x22')](_0x4d8006);}return _0x17ee2a[_0x301d('0x23')]();};}function saveUpdates(_0x5b6631,_0x485f96){return function(_0x292c89){if(_0x292c89){return _0x292c89[_0x301d('0x24')](_0x5b6631)[_0x301d('0x25')](function(_0x3fa47d){return _0x3fa47d;});}return null;};}function removeEntity(_0x549e57,_0x1119da){return function(_0x2491b8){if(_0x2491b8){return _0x2491b8[_0x301d('0x26')]()[_0x301d('0x25')](function(){_0x549e57[_0x301d('0x1b')](0xcc)[_0x301d('0x1c')]();});}};}function handleEntityNotFound(_0x4fae3d,_0x470b7a){return function(_0xb315b6){if(!_0xb315b6){_0x4fae3d[_0x301d('0x1a')](0x194);}return _0xb315b6;};}function handleError(_0x2f7092,_0x31ce2c){_0x31ce2c=_0x31ce2c||0x1f4;return function(_0x23c934){logger[_0x301d('0x27')](_0x23c934[_0x301d('0x28')]);if(_0x23c934['name']){delete _0x23c934[_0x301d('0x29')];}_0x2f7092['status'](_0x31ce2c)['send'](_0x23c934);};}exports[_0x301d('0x2a')]=function(_0x52eb42,_0x326722){var _0x119143={},_0x362c68={},_0x46127a={'count':0x0,'rows':[]};var _0xb6a139=_['map'](db[_0x301d('0x2b')][_0x301d('0x2c')],function(_0x2385ef){return{'name':_0x2385ef[_0x301d('0x2d')],'type':_0x2385ef['type']['key']};});_0x362c68['model']=_['map'](_0xb6a139,_0x301d('0x29'));_0x362c68[_0x301d('0x2e')]=_[_0x301d('0x2f')](_0x52eb42[_0x301d('0x2e')]);_0x362c68[_0x301d('0x30')]=_[_0x301d('0x31')](_0x362c68[_0x301d('0x32')],_0x362c68[_0x301d('0x2e')]);_0x119143[_0x301d('0x33')]=_[_0x301d('0x31')](_0x362c68['model'],qs[_0x301d('0x34')](_0x52eb42[_0x301d('0x2e')][_0x301d('0x34')]));_0x119143[_0x301d('0x33')]=_0x119143[_0x301d('0x33')][_0x301d('0x35')]?_0x119143[_0x301d('0x33')]:_0x362c68[_0x301d('0x32')];if(!_0x52eb42[_0x301d('0x2e')][_0x301d('0x36')]('nolimit')){_0x119143['limit']=qs[_0x301d('0x1f')](_0x52eb42[_0x301d('0x2e')][_0x301d('0x1f')]);_0x119143[_0x301d('0x1d')]=qs[_0x301d('0x1d')](_0x52eb42['query'][_0x301d('0x1d')]);}_0x119143[_0x301d('0x37')]=qs[_0x301d('0x38')](_0x52eb42['query'][_0x301d('0x38')]);_0x119143['where']=qs[_0x301d('0x30')](_[_0x301d('0x39')](_0x52eb42[_0x301d('0x2e')],_0x362c68[_0x301d('0x30')]),_0xb6a139);if(_0x52eb42[_0x301d('0x2e')][_0x301d('0x3a')]){_0x119143[_0x301d('0x3b')]=_[_0x301d('0x3c')](_0x119143['where'],{'$or':_[_0x301d('0x3d')](_0xb6a139,function(_0x2a1459){if(_0x2a1459[_0x301d('0x3e')]!==_0x301d('0x3f')){var _0xc4e7ff={};_0xc4e7ff[_0x2a1459['name']]={'$like':'%'+_0x52eb42['query']['filter']+'%'};return _0xc4e7ff;}})});}_0x119143=_[_0x301d('0x3c')]({},_0x119143,_0x52eb42['options']);var _0x35047e={'where':_0x119143[_0x301d('0x3b')]};return db[_0x301d('0x2b')][_0x301d('0x20')](_0x35047e)[_0x301d('0x25')](function(_0x5ee9cc){_0x46127a[_0x301d('0x20')]=_0x5ee9cc;if(_0x52eb42['query']['includeAll']){_0x119143[_0x301d('0x40')]=[{'all':!![]}];}return db['VtigerConfiguration']['findAll'](_0x119143);})[_0x301d('0x25')](function(_0x168211){_0x46127a[_0x301d('0x41')]=_0x168211;return _0x46127a;})[_0x301d('0x25')](respondWithFilteredResult(_0x326722,_0x119143))[_0x301d('0x42')](handleError(_0x326722,null));};exports[_0x301d('0x43')]=function(_0x499ca8,_0x16a7ca){var _0x29ef1d={'raw':![],'where':{'id':_0x499ca8[_0x301d('0x44')]['id']}},_0x3dd5f5={};_0x3dd5f5[_0x301d('0x32')]=_[_0x301d('0x2f')](db[_0x301d('0x2b')]['rawAttributes']);_0x3dd5f5[_0x301d('0x2e')]=_['keys'](_0x499ca8['query']);_0x3dd5f5[_0x301d('0x30')]=_[_0x301d('0x31')](_0x3dd5f5['model'],_0x3dd5f5[_0x301d('0x2e')]);_0x29ef1d[_0x301d('0x33')]=_['intersection'](_0x3dd5f5['model'],qs[_0x301d('0x34')](_0x499ca8[_0x301d('0x2e')][_0x301d('0x34')]));_0x29ef1d['attributes']=_0x29ef1d['attributes'][_0x301d('0x35')]?_0x29ef1d[_0x301d('0x33')]:_0x3dd5f5[_0x301d('0x32')];if(_0x499ca8[_0x301d('0x2e')][_0x301d('0x45')]){_0x29ef1d['include']=[{'all':!![]}];}_0x29ef1d=_[_0x301d('0x3c')]({},_0x29ef1d,_0x499ca8[_0x301d('0x46')]);return db[_0x301d('0x2b')]['find'](_0x29ef1d)[_0x301d('0x25')](handleEntityNotFound(_0x16a7ca,null))[_0x301d('0x25')](respondWithResult(_0x16a7ca,null))[_0x301d('0x42')](handleError(_0x16a7ca,null));};exports[_0x301d('0x47')]=function(_0x54cce3,_0x2c1fc8){return db['VtigerConfiguration'][_0x301d('0x47')](_0x54cce3['body'],{})[_0x301d('0x25')](respondWithResult(_0x2c1fc8,0xc9))[_0x301d('0x42')](handleError(_0x2c1fc8,null));};exports[_0x301d('0x24')]=function(_0x155912,_0x2ed897){if(_0x155912[_0x301d('0x48')]['id']){delete _0x155912[_0x301d('0x48')]['id'];}return db[_0x301d('0x2b')][_0x301d('0x49')]({'where':{'id':_0x155912['params']['id']}})[_0x301d('0x25')](handleEntityNotFound(_0x2ed897,null))[_0x301d('0x25')](saveUpdates(_0x155912[_0x301d('0x48')],null))[_0x301d('0x25')](respondWithResult(_0x2ed897,null))['catch'](handleError(_0x2ed897,null));};exports[_0x301d('0x26')]=function(_0x5c1d19,_0x59d4f4){return db['VtigerConfiguration'][_0x301d('0x49')]({'where':{'id':_0x5c1d19['params']['id']}})['then'](handleEntityNotFound(_0x59d4f4,null))[_0x301d('0x25')](removeEntity(_0x59d4f4,null))[_0x301d('0x42')](handleError(_0x59d4f4,null));};exports[_0x301d('0x4a')]=function(_0x29cb7b,_0x243cb2,_0x2d4142){var _0x2f2d3b={};var _0x1a6813={};var _0x46c232;var _0x1f2db5;return db[_0x301d('0x2b')][_0x301d('0x4b')]({'where':{'id':_0x29cb7b[_0x301d('0x44')]['id']}})[_0x301d('0x25')](handleEntityNotFound(_0x243cb2,null))[_0x301d('0x25')](function(_0x1aabbc){if(_0x1aabbc){_0x46c232=_0x1aabbc;_0x1a6813[_0x301d('0x32')]=_[_0x301d('0x2f')](db['VtigerField'][_0x301d('0x2c')]);_0x1a6813[_0x301d('0x2e')]=_[_0x301d('0x2f')](_0x29cb7b[_0x301d('0x2e')]);_0x1a6813[_0x301d('0x30')]=_[_0x301d('0x31')](_0x1a6813[_0x301d('0x32')],_0x1a6813['query']);_0x2f2d3b[_0x301d('0x33')]=_[_0x301d('0x31')](_0x1a6813['model'],qs[_0x301d('0x34')](_0x29cb7b['query']['fields']));_0x2f2d3b['attributes']=_0x2f2d3b[_0x301d('0x33')][_0x301d('0x35')]?_0x2f2d3b[_0x301d('0x33')]:_0x1a6813['model'];_0x2f2d3b[_0x301d('0x37')]=qs['sort'](_0x29cb7b[_0x301d('0x2e')][_0x301d('0x38')]);_0x2f2d3b[_0x301d('0x3b')]=qs[_0x301d('0x30')](_[_0x301d('0x39')](_0x29cb7b[_0x301d('0x2e')],_0x1a6813['filters']));if(_0x29cb7b[_0x301d('0x2e')]['filter']){_0x2f2d3b[_0x301d('0x3b')]=_[_0x301d('0x3c')](_0x2f2d3b[_0x301d('0x3b')],{'$or':_['map'](_0x2f2d3b['attributes'],function(_0x48301b){var _0x33d2b4={};_0x33d2b4[_0x48301b]={'$like':'%'+_0x29cb7b[_0x301d('0x2e')][_0x301d('0x3a')]+'%'};return _0x33d2b4;})});}_0x2f2d3b=_['merge']({},_0x2f2d3b,_0x29cb7b[_0x301d('0x46')]);return _0x46c232[_0x301d('0x4a')](_0x2f2d3b);}})[_0x301d('0x25')](function(_0x363f33){if(_0x363f33){_0x1f2db5=_0x363f33['length'];if(!_0x29cb7b[_0x301d('0x2e')]['hasOwnProperty'](_0x301d('0x4c'))){_0x2f2d3b[_0x301d('0x1f')]=qs[_0x301d('0x1f')](_0x29cb7b['query'][_0x301d('0x1f')]);_0x2f2d3b[_0x301d('0x1d')]=qs[_0x301d('0x1d')](_0x29cb7b[_0x301d('0x2e')]['offset']);}return _0x46c232[_0x301d('0x4a')](_0x2f2d3b);}})[_0x301d('0x25')](function(_0x2bc95e){if(_0x2bc95e){return _0x2bc95e?{'count':_0x1f2db5,'rows':_0x2bc95e}:null;}})[_0x301d('0x25')](respondWithResult(_0x243cb2,null))[_0x301d('0x42')](handleError(_0x243cb2,null));};exports[_0x301d('0x4d')]=function(_0x4ca952,_0x26b920,_0x38fcf8){var _0x26fedc={};var _0x57f725={};var _0x567cad;var _0x53a72c;return db[_0x301d('0x2b')][_0x301d('0x4b')]({'where':{'id':_0x4ca952[_0x301d('0x44')]['id']}})[_0x301d('0x25')](handleEntityNotFound(_0x26b920,null))[_0x301d('0x25')](function(_0x2b66f0){if(_0x2b66f0){_0x567cad=_0x2b66f0;_0x57f725['model']=_['keys'](db[_0x301d('0x4e')][_0x301d('0x2c')]);_0x57f725[_0x301d('0x2e')]=_[_0x301d('0x2f')](_0x4ca952[_0x301d('0x2e')]);_0x57f725['filters']=_[_0x301d('0x31')](_0x57f725['model'],_0x57f725[_0x301d('0x2e')]);_0x26fedc['attributes']=_[_0x301d('0x31')](_0x57f725['model'],qs[_0x301d('0x34')](_0x4ca952['query']['fields']));_0x26fedc[_0x301d('0x33')]=_0x26fedc['attributes'][_0x301d('0x35')]?_0x26fedc[_0x301d('0x33')]:_0x57f725[_0x301d('0x32')];_0x26fedc[_0x301d('0x37')]=qs[_0x301d('0x38')](_0x4ca952[_0x301d('0x2e')]['sort']);_0x26fedc[_0x301d('0x3b')]=qs[_0x301d('0x30')](_[_0x301d('0x39')](_0x4ca952[_0x301d('0x2e')],_0x57f725[_0x301d('0x30')]));if(_0x4ca952[_0x301d('0x2e')][_0x301d('0x3a')]){_0x26fedc['where']=_[_0x301d('0x3c')](_0x26fedc[_0x301d('0x3b')],{'$or':_[_0x301d('0x3d')](_0x26fedc[_0x301d('0x33')],function(_0xe9a40){var _0x3bffe9={};_0x3bffe9[_0xe9a40]={'$like':'%'+_0x4ca952[_0x301d('0x2e')]['filter']+'%'};return _0x3bffe9;})});}_0x26fedc=_[_0x301d('0x3c')]({},_0x26fedc,_0x4ca952[_0x301d('0x46')]);return _0x567cad[_0x301d('0x4d')](_0x26fedc);}})[_0x301d('0x25')](function(_0x445cbb){if(_0x445cbb){_0x53a72c=_0x445cbb['length'];if(!_0x4ca952[_0x301d('0x2e')]['hasOwnProperty']('nolimit')){_0x26fedc[_0x301d('0x1f')]=qs['limit'](_0x4ca952[_0x301d('0x2e')][_0x301d('0x1f')]);_0x26fedc['offset']=qs[_0x301d('0x1d')](_0x4ca952[_0x301d('0x2e')][_0x301d('0x1d')]);}return _0x567cad[_0x301d('0x4d')](_0x26fedc);}})['then'](function(_0x44aef0){if(_0x44aef0){return _0x44aef0?{'count':_0x53a72c,'rows':_0x44aef0}:null;}})[_0x301d('0x25')](respondWithResult(_0x26b920,null))['catch'](handleError(_0x26b920,null));};exports[_0x301d('0x4f')]=function(_0x14967c,_0x3e3e15,_0x1a83d5){var _0x136370={};var _0x43e8da={};var _0x1a7735;var _0x584d46;return db[_0x301d('0x2b')][_0x301d('0x4b')]({'where':{'id':_0x14967c['params']['id']}})[_0x301d('0x25')](handleEntityNotFound(_0x3e3e15,null))['then'](function(_0x13222e){if(_0x13222e){_0x1a7735=_0x13222e;_0x43e8da[_0x301d('0x32')]=_[_0x301d('0x2f')](db['VtigerField'][_0x301d('0x2c')]);_0x43e8da[_0x301d('0x2e')]=_[_0x301d('0x2f')](_0x14967c[_0x301d('0x2e')]);_0x43e8da[_0x301d('0x30')]=_[_0x301d('0x31')](_0x43e8da[_0x301d('0x32')],_0x43e8da[_0x301d('0x2e')]);_0x136370[_0x301d('0x33')]=_[_0x301d('0x31')](_0x43e8da[_0x301d('0x32')],qs[_0x301d('0x34')](_0x14967c['query'][_0x301d('0x34')]));_0x136370[_0x301d('0x33')]=_0x136370[_0x301d('0x33')][_0x301d('0x35')]?_0x136370[_0x301d('0x33')]:_0x43e8da[_0x301d('0x32')];_0x136370[_0x301d('0x37')]=qs[_0x301d('0x38')](_0x14967c[_0x301d('0x2e')][_0x301d('0x38')]);_0x136370['where']=qs[_0x301d('0x30')](_['pick'](_0x14967c[_0x301d('0x2e')],_0x43e8da[_0x301d('0x30')]));if(_0x14967c[_0x301d('0x2e')][_0x301d('0x3a')]){_0x136370[_0x301d('0x3b')]=_[_0x301d('0x3c')](_0x136370[_0x301d('0x3b')],{'$or':_[_0x301d('0x3d')](_0x136370[_0x301d('0x33')],function(_0x5a6366){var _0x5e47d6={};_0x5e47d6[_0x5a6366]={'$like':'%'+_0x14967c['query'][_0x301d('0x3a')]+'%'};return _0x5e47d6;})});}_0x136370=_['merge']({},_0x136370,_0x14967c[_0x301d('0x46')]);return _0x1a7735[_0x301d('0x4f')](_0x136370);}})[_0x301d('0x25')](function(_0x25749f){if(_0x25749f){_0x584d46=_0x25749f[_0x301d('0x35')];if(!_0x14967c[_0x301d('0x2e')][_0x301d('0x36')](_0x301d('0x4c'))){_0x136370[_0x301d('0x1f')]=qs[_0x301d('0x1f')](_0x14967c['query']['limit']);_0x136370[_0x301d('0x1d')]=qs[_0x301d('0x1d')](_0x14967c[_0x301d('0x2e')][_0x301d('0x1d')]);}return _0x1a7735[_0x301d('0x4f')](_0x136370);}})[_0x301d('0x25')](function(_0x55bb6e){if(_0x55bb6e){return _0x55bb6e?{'count':_0x584d46,'rows':_0x55bb6e}:null;}})[_0x301d('0x25')](respondWithResult(_0x3e3e15,null))[_0x301d('0x42')](handleError(_0x3e3e15,null));}; \ No newline at end of file +var _0x86d5=['filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','VtigerConfiguration','includeAll','findAll','rows','catch','params','fields','include','find','create','body','getFields','findOne','VtigerField','pick','getSubjects','getDescriptions','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','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','end','sendStatus','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','keys'];(function(_0x1ec731,_0x5d5755){var _0x2234bf=function(_0x26ce61){while(--_0x26ce61){_0x1ec731['push'](_0x1ec731['shift']());}};_0x2234bf(++_0x5d5755);}(_0x86d5,0x71));var _0x586d=function(_0x419679,_0x4fef00){_0x419679=_0x419679-0x0;var _0x449ed5=_0x86d5[_0x419679];return _0x449ed5;};'use strict';var emlformat=require(_0x586d('0x0'));var rimraf=require(_0x586d('0x1'));var zipdir=require(_0x586d('0x2'));var jsonpatch=require(_0x586d('0x3'));var rp=require(_0x586d('0x4'));var moment=require(_0x586d('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x586d('0x6'));var util=require(_0x586d('0x7'));var path=require(_0x586d('0x8'));var sox=require(_0x586d('0x9'));var csv=require(_0x586d('0xa'));var ejs=require(_0x586d('0xb'));var fs=require('fs');var fs_extra=require(_0x586d('0xc'));var _=require(_0x586d('0xd'));var squel=require(_0x586d('0xe'));var crypto=require(_0x586d('0xf'));var jsforce=require(_0x586d('0x10'));var deskjs=require(_0x586d('0x11'));var toCsv=require(_0x586d('0xa'));var querystring=require(_0x586d('0x12'));var Papa=require(_0x586d('0x13'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x586d('0x14'));var hardwareService=require(_0x586d('0x15'));var logger=require(_0x586d('0x16'))(_0x586d('0x17'));var utils=require(_0x586d('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xee9355,_0x32e892){_0x32e892=_0x32e892||0xcc;return function(_0x2914ef){if(_0x2914ef){return _0xee9355['sendStatus'](_0x32e892);}return _0xee9355[_0x586d('0x19')](_0x32e892)['end']();};}function respondWithResult(_0x3bc516,_0x5b7458){_0x5b7458=_0x5b7458||0xc8;return function(_0x1a873f){if(_0x1a873f){return _0x3bc516[_0x586d('0x19')](_0x5b7458)['json'](_0x1a873f);}};}function respondWithFilteredResult(_0x121e77,_0x4f87f9){return function(_0x29cd7c){if(_0x29cd7c){var _0x5902d5=typeof _0x4f87f9[_0x586d('0x1a')]===_0x586d('0x1b')&&typeof _0x4f87f9[_0x586d('0x1c')]==='undefined';var _0x42e7ff=_0x29cd7c[_0x586d('0x1d')];var _0x3c2c15=_0x5902d5?0x0:_0x4f87f9[_0x586d('0x1a')];var _0x3e63bb=_0x5902d5?_0x29cd7c['count']:_0x4f87f9['offset']+_0x4f87f9['limit'];var _0x2ebda2;if(_0x3e63bb>=_0x42e7ff){_0x3e63bb=_0x42e7ff;_0x2ebda2=0xc8;}else{_0x2ebda2=0xce;}_0x121e77[_0x586d('0x19')](_0x2ebda2);return _0x121e77[_0x586d('0x1e')](_0x586d('0x1f'),_0x3c2c15+'-'+_0x3e63bb+'/'+_0x42e7ff)[_0x586d('0x20')](_0x29cd7c);}return null;};}function patchUpdates(_0x475889){return function(_0x2cc1ae){try{jsonpatch[_0x586d('0x21')](_0x2cc1ae,_0x475889,!![]);}catch(_0xbfd15a){return BPromise[_0x586d('0x22')](_0xbfd15a);}return _0x2cc1ae[_0x586d('0x23')]();};}function saveUpdates(_0x5d86b9,_0x334f25){return function(_0x538348){if(_0x538348){return _0x538348[_0x586d('0x24')](_0x5d86b9)[_0x586d('0x25')](function(_0x519fb6){return _0x519fb6;});}return null;};}function removeEntity(_0x349636,_0x28c7f4){return function(_0x51f0b2){if(_0x51f0b2){return _0x51f0b2[_0x586d('0x26')]()['then'](function(){_0x349636[_0x586d('0x19')](0xcc)[_0x586d('0x27')]();});}};}function handleEntityNotFound(_0x1c93cd,_0x3ae54a){return function(_0x51709b){if(!_0x51709b){_0x1c93cd[_0x586d('0x28')](0x194);}return _0x51709b;};}function handleError(_0x57553e,_0x5ea4ae){_0x5ea4ae=_0x5ea4ae||0x1f4;return function(_0x59d6ff){logger[_0x586d('0x29')](_0x59d6ff[_0x586d('0x2a')]);if(_0x59d6ff[_0x586d('0x2b')]){delete _0x59d6ff[_0x586d('0x2b')];}_0x57553e['status'](_0x5ea4ae)[_0x586d('0x2c')](_0x59d6ff);};}exports['index']=function(_0xcc5afd,_0x37a8fe){var _0x30ca3e={},_0x2271fb={},_0x58feef={'count':0x0,'rows':[]};var _0x23dd1d=_[_0x586d('0x2d')](db['VtigerConfiguration'][_0x586d('0x2e')],function(_0x39695d){return{'name':_0x39695d[_0x586d('0x2f')],'type':_0x39695d[_0x586d('0x30')][_0x586d('0x31')]};});_0x2271fb[_0x586d('0x32')]=_[_0x586d('0x2d')](_0x23dd1d,'name');_0x2271fb[_0x586d('0x33')]=_[_0x586d('0x34')](_0xcc5afd[_0x586d('0x33')]);_0x2271fb[_0x586d('0x35')]=_[_0x586d('0x36')](_0x2271fb[_0x586d('0x32')],_0x2271fb[_0x586d('0x33')]);_0x30ca3e['attributes']=_[_0x586d('0x36')](_0x2271fb[_0x586d('0x32')],qs['fields'](_0xcc5afd['query']['fields']));_0x30ca3e[_0x586d('0x37')]=_0x30ca3e[_0x586d('0x37')][_0x586d('0x38')]?_0x30ca3e[_0x586d('0x37')]:_0x2271fb[_0x586d('0x32')];if(!_0xcc5afd['query'][_0x586d('0x39')](_0x586d('0x3a'))){_0x30ca3e[_0x586d('0x1c')]=qs[_0x586d('0x1c')](_0xcc5afd['query']['limit']);_0x30ca3e['offset']=qs[_0x586d('0x1a')](_0xcc5afd[_0x586d('0x33')][_0x586d('0x1a')]);}_0x30ca3e[_0x586d('0x3b')]=qs[_0x586d('0x3c')](_0xcc5afd['query'][_0x586d('0x3c')]);_0x30ca3e[_0x586d('0x3d')]=qs[_0x586d('0x35')](_['pick'](_0xcc5afd['query'],_0x2271fb[_0x586d('0x35')]),_0x23dd1d);if(_0xcc5afd[_0x586d('0x33')][_0x586d('0x3e')]){_0x30ca3e[_0x586d('0x3d')]=_[_0x586d('0x3f')](_0x30ca3e['where'],{'$or':_[_0x586d('0x2d')](_0x23dd1d,function(_0x317a22){if(_0x317a22[_0x586d('0x30')]!==_0x586d('0x40')){var _0x2e8499={};_0x2e8499[_0x317a22[_0x586d('0x2b')]]={'$like':'%'+_0xcc5afd[_0x586d('0x33')][_0x586d('0x3e')]+'%'};return _0x2e8499;}})});}_0x30ca3e=_[_0x586d('0x3f')]({},_0x30ca3e,_0xcc5afd[_0x586d('0x41')]);var _0xdc1531={'where':_0x30ca3e[_0x586d('0x3d')]};return db[_0x586d('0x42')][_0x586d('0x1d')](_0xdc1531)[_0x586d('0x25')](function(_0x35d79b){_0x58feef[_0x586d('0x1d')]=_0x35d79b;if(_0xcc5afd[_0x586d('0x33')][_0x586d('0x43')]){_0x30ca3e['include']=[{'all':!![]}];}return db[_0x586d('0x42')][_0x586d('0x44')](_0x30ca3e);})[_0x586d('0x25')](function(_0xb4033a){_0x58feef[_0x586d('0x45')]=_0xb4033a;return _0x58feef;})[_0x586d('0x25')](respondWithFilteredResult(_0x37a8fe,_0x30ca3e))[_0x586d('0x46')](handleError(_0x37a8fe,null));};exports['show']=function(_0x1eb197,_0x127fbb){var _0x53f899={'raw':![],'where':{'id':_0x1eb197[_0x586d('0x47')]['id']}},_0x26b644={};_0x26b644['model']=_[_0x586d('0x34')](db[_0x586d('0x42')][_0x586d('0x2e')]);_0x26b644['query']=_[_0x586d('0x34')](_0x1eb197[_0x586d('0x33')]);_0x26b644[_0x586d('0x35')]=_[_0x586d('0x36')](_0x26b644[_0x586d('0x32')],_0x26b644[_0x586d('0x33')]);_0x53f899[_0x586d('0x37')]=_['intersection'](_0x26b644[_0x586d('0x32')],qs[_0x586d('0x48')](_0x1eb197[_0x586d('0x33')]['fields']));_0x53f899[_0x586d('0x37')]=_0x53f899[_0x586d('0x37')][_0x586d('0x38')]?_0x53f899[_0x586d('0x37')]:_0x26b644[_0x586d('0x32')];if(_0x1eb197[_0x586d('0x33')]['includeAll']){_0x53f899[_0x586d('0x49')]=[{'all':!![]}];}_0x53f899=_[_0x586d('0x3f')]({},_0x53f899,_0x1eb197['options']);return db['VtigerConfiguration'][_0x586d('0x4a')](_0x53f899)[_0x586d('0x25')](handleEntityNotFound(_0x127fbb,null))[_0x586d('0x25')](respondWithResult(_0x127fbb,null))[_0x586d('0x46')](handleError(_0x127fbb,null));};exports['create']=function(_0x32f1e2,_0x409b3f){return db[_0x586d('0x42')][_0x586d('0x4b')](_0x32f1e2['body'],{})[_0x586d('0x25')](respondWithResult(_0x409b3f,0xc9))['catch'](handleError(_0x409b3f,null));};exports[_0x586d('0x24')]=function(_0x25f107,_0x2af1bf){if(_0x25f107[_0x586d('0x4c')]['id']){delete _0x25f107[_0x586d('0x4c')]['id'];}return db[_0x586d('0x42')]['find']({'where':{'id':_0x25f107[_0x586d('0x47')]['id']}})[_0x586d('0x25')](handleEntityNotFound(_0x2af1bf,null))[_0x586d('0x25')](saveUpdates(_0x25f107[_0x586d('0x4c')],null))[_0x586d('0x25')](respondWithResult(_0x2af1bf,null))[_0x586d('0x46')](handleError(_0x2af1bf,null));};exports[_0x586d('0x26')]=function(_0x15396a,_0x5d9741){return db[_0x586d('0x42')][_0x586d('0x4a')]({'where':{'id':_0x15396a[_0x586d('0x47')]['id']}})[_0x586d('0x25')](handleEntityNotFound(_0x5d9741,null))[_0x586d('0x25')](removeEntity(_0x5d9741,null))['catch'](handleError(_0x5d9741,null));};exports[_0x586d('0x4d')]=function(_0x44f5eb,_0x4f9e1c,_0x1bfa02){var _0x3f2443={};var _0xd00e84={};var _0xaf70de;var _0x7c45b6;return db[_0x586d('0x42')][_0x586d('0x4e')]({'where':{'id':_0x44f5eb[_0x586d('0x47')]['id']}})[_0x586d('0x25')](handleEntityNotFound(_0x4f9e1c,null))[_0x586d('0x25')](function(_0x4611db){if(_0x4611db){_0xaf70de=_0x4611db;_0xd00e84[_0x586d('0x32')]=_[_0x586d('0x34')](db[_0x586d('0x4f')][_0x586d('0x2e')]);_0xd00e84[_0x586d('0x33')]=_[_0x586d('0x34')](_0x44f5eb[_0x586d('0x33')]);_0xd00e84[_0x586d('0x35')]=_['intersection'](_0xd00e84['model'],_0xd00e84['query']);_0x3f2443[_0x586d('0x37')]=_['intersection'](_0xd00e84[_0x586d('0x32')],qs[_0x586d('0x48')](_0x44f5eb['query'][_0x586d('0x48')]));_0x3f2443[_0x586d('0x37')]=_0x3f2443[_0x586d('0x37')][_0x586d('0x38')]?_0x3f2443[_0x586d('0x37')]:_0xd00e84[_0x586d('0x32')];_0x3f2443[_0x586d('0x3b')]=qs[_0x586d('0x3c')](_0x44f5eb[_0x586d('0x33')][_0x586d('0x3c')]);_0x3f2443[_0x586d('0x3d')]=qs[_0x586d('0x35')](_[_0x586d('0x50')](_0x44f5eb['query'],_0xd00e84['filters']));if(_0x44f5eb[_0x586d('0x33')]['filter']){_0x3f2443[_0x586d('0x3d')]=_['merge'](_0x3f2443['where'],{'$or':_[_0x586d('0x2d')](_0x3f2443[_0x586d('0x37')],function(_0x19c9e7){var _0x461963={};_0x461963[_0x19c9e7]={'$like':'%'+_0x44f5eb[_0x586d('0x33')]['filter']+'%'};return _0x461963;})});}_0x3f2443=_[_0x586d('0x3f')]({},_0x3f2443,_0x44f5eb[_0x586d('0x41')]);return _0xaf70de['getFields'](_0x3f2443);}})[_0x586d('0x25')](function(_0x5517ed){if(_0x5517ed){_0x7c45b6=_0x5517ed[_0x586d('0x38')];if(!_0x44f5eb[_0x586d('0x33')][_0x586d('0x39')]('nolimit')){_0x3f2443[_0x586d('0x1c')]=qs[_0x586d('0x1c')](_0x44f5eb['query'][_0x586d('0x1c')]);_0x3f2443['offset']=qs[_0x586d('0x1a')](_0x44f5eb[_0x586d('0x33')][_0x586d('0x1a')]);}return _0xaf70de['getFields'](_0x3f2443);}})[_0x586d('0x25')](function(_0xf36a23){if(_0xf36a23){return _0xf36a23?{'count':_0x7c45b6,'rows':_0xf36a23}:null;}})['then'](respondWithResult(_0x4f9e1c,null))[_0x586d('0x46')](handleError(_0x4f9e1c,null));};exports['getSubjects']=function(_0xf773c7,_0x3e22cc,_0x4498a4){var _0x32ea3b={};var _0x344694={};var _0x2935be;var _0x1df94c;return db[_0x586d('0x42')][_0x586d('0x4e')]({'where':{'id':_0xf773c7[_0x586d('0x47')]['id']}})[_0x586d('0x25')](handleEntityNotFound(_0x3e22cc,null))[_0x586d('0x25')](function(_0x2b5fdc){if(_0x2b5fdc){_0x2935be=_0x2b5fdc;_0x344694['model']=_[_0x586d('0x34')](db[_0x586d('0x4f')]['rawAttributes']);_0x344694['query']=_[_0x586d('0x34')](_0xf773c7[_0x586d('0x33')]);_0x344694[_0x586d('0x35')]=_[_0x586d('0x36')](_0x344694['model'],_0x344694[_0x586d('0x33')]);_0x32ea3b['attributes']=_[_0x586d('0x36')](_0x344694[_0x586d('0x32')],qs[_0x586d('0x48')](_0xf773c7[_0x586d('0x33')][_0x586d('0x48')]));_0x32ea3b['attributes']=_0x32ea3b[_0x586d('0x37')][_0x586d('0x38')]?_0x32ea3b[_0x586d('0x37')]:_0x344694[_0x586d('0x32')];_0x32ea3b['order']=qs[_0x586d('0x3c')](_0xf773c7[_0x586d('0x33')][_0x586d('0x3c')]);_0x32ea3b['where']=qs[_0x586d('0x35')](_[_0x586d('0x50')](_0xf773c7['query'],_0x344694[_0x586d('0x35')]));if(_0xf773c7[_0x586d('0x33')][_0x586d('0x3e')]){_0x32ea3b[_0x586d('0x3d')]=_[_0x586d('0x3f')](_0x32ea3b[_0x586d('0x3d')],{'$or':_[_0x586d('0x2d')](_0x32ea3b[_0x586d('0x37')],function(_0xa7b4a7){var _0x1a8f42={};_0x1a8f42[_0xa7b4a7]={'$like':'%'+_0xf773c7[_0x586d('0x33')]['filter']+'%'};return _0x1a8f42;})});}_0x32ea3b=_[_0x586d('0x3f')]({},_0x32ea3b,_0xf773c7[_0x586d('0x41')]);return _0x2935be[_0x586d('0x51')](_0x32ea3b);}})[_0x586d('0x25')](function(_0x5e5c8d){if(_0x5e5c8d){_0x1df94c=_0x5e5c8d['length'];if(!_0xf773c7[_0x586d('0x33')][_0x586d('0x39')](_0x586d('0x3a'))){_0x32ea3b[_0x586d('0x1c')]=qs[_0x586d('0x1c')](_0xf773c7[_0x586d('0x33')][_0x586d('0x1c')]);_0x32ea3b[_0x586d('0x1a')]=qs[_0x586d('0x1a')](_0xf773c7[_0x586d('0x33')]['offset']);}return _0x2935be['getSubjects'](_0x32ea3b);}})[_0x586d('0x25')](function(_0x3197fc){if(_0x3197fc){return _0x3197fc?{'count':_0x1df94c,'rows':_0x3197fc}:null;}})[_0x586d('0x25')](respondWithResult(_0x3e22cc,null))[_0x586d('0x46')](handleError(_0x3e22cc,null));};exports[_0x586d('0x52')]=function(_0x3a5e10,_0x52c140,_0x3291ba){var _0x2c74c8={};var _0x25bd83={};var _0x33ce5b;var _0x236ac1;return db[_0x586d('0x42')][_0x586d('0x4e')]({'where':{'id':_0x3a5e10[_0x586d('0x47')]['id']}})[_0x586d('0x25')](handleEntityNotFound(_0x52c140,null))[_0x586d('0x25')](function(_0x36d5b2){if(_0x36d5b2){_0x33ce5b=_0x36d5b2;_0x25bd83[_0x586d('0x32')]=_[_0x586d('0x34')](db[_0x586d('0x4f')]['rawAttributes']);_0x25bd83[_0x586d('0x33')]=_[_0x586d('0x34')](_0x3a5e10['query']);_0x25bd83['filters']=_[_0x586d('0x36')](_0x25bd83[_0x586d('0x32')],_0x25bd83['query']);_0x2c74c8[_0x586d('0x37')]=_['intersection'](_0x25bd83[_0x586d('0x32')],qs[_0x586d('0x48')](_0x3a5e10['query']['fields']));_0x2c74c8[_0x586d('0x37')]=_0x2c74c8['attributes']['length']?_0x2c74c8[_0x586d('0x37')]:_0x25bd83['model'];_0x2c74c8[_0x586d('0x3b')]=qs['sort'](_0x3a5e10[_0x586d('0x33')][_0x586d('0x3c')]);_0x2c74c8[_0x586d('0x3d')]=qs[_0x586d('0x35')](_[_0x586d('0x50')](_0x3a5e10[_0x586d('0x33')],_0x25bd83[_0x586d('0x35')]));if(_0x3a5e10['query'][_0x586d('0x3e')]){_0x2c74c8['where']=_['merge'](_0x2c74c8[_0x586d('0x3d')],{'$or':_['map'](_0x2c74c8[_0x586d('0x37')],function(_0x17b1f1){var _0x17554a={};_0x17554a[_0x17b1f1]={'$like':'%'+_0x3a5e10[_0x586d('0x33')][_0x586d('0x3e')]+'%'};return _0x17554a;})});}_0x2c74c8=_[_0x586d('0x3f')]({},_0x2c74c8,_0x3a5e10[_0x586d('0x41')]);return _0x33ce5b[_0x586d('0x52')](_0x2c74c8);}})[_0x586d('0x25')](function(_0x160357){if(_0x160357){_0x236ac1=_0x160357['length'];if(!_0x3a5e10['query'][_0x586d('0x39')](_0x586d('0x3a'))){_0x2c74c8[_0x586d('0x1c')]=qs[_0x586d('0x1c')](_0x3a5e10[_0x586d('0x33')][_0x586d('0x1c')]);_0x2c74c8['offset']=qs[_0x586d('0x1a')](_0x3a5e10['query'][_0x586d('0x1a')]);}return _0x33ce5b[_0x586d('0x52')](_0x2c74c8);}})[_0x586d('0x25')](function(_0x1e21d2){if(_0x1e21d2){return _0x1e21d2?{'count':_0x236ac1,'rows':_0x1e21d2}:null;}})[_0x586d('0x25')](respondWithResult(_0x52c140,null))[_0x586d('0x46')](handleError(_0x52c140,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index eba1d0e..6a7c6ff 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 _0x6e4f=['request-promise','path','rimraf','exports','define','VtigerConfiguration','int_vtiger_configurations','../../config/logger','api','bluebird'];(function(_0x362d8d,_0x543ba7){var _0x88cef5=function(_0x57d2e8){while(--_0x57d2e8){_0x362d8d['push'](_0x362d8d['shift']());}};_0x88cef5(++_0x543ba7);}(_0x6e4f,0x9d));var _0xf6e4=function(_0x11c723,_0x313a70){_0x11c723=_0x11c723-0x0;var _0x3d7c76=_0x6e4f[_0x11c723];return _0x3d7c76;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xf6e4('0x0'))(_0xf6e4('0x1'));var moment=require('moment');var BPromise=require(_0xf6e4('0x2'));var rp=require(_0xf6e4('0x3'));var fs=require('fs');var path=require(_0xf6e4('0x4'));var rimraf=require(_0xf6e4('0x5'));var config=require('../../config/environment');var attributes=require('./intVtigerConfiguration.attributes');module[_0xf6e4('0x6')]=function(_0x11f6ff,_0x4971f4){return _0x11f6ff[_0xf6e4('0x7')](_0xf6e4('0x8'),attributes,{'tableName':_0xf6e4('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfc90=['path','rimraf','../../config/environment','./intVtigerConfiguration.attributes','exports','VtigerConfiguration','int_vtiger_configurations','lodash','util','api','moment','bluebird','request-promise'];(function(_0x1608e2,_0x46320c){var _0x2438a2=function(_0x236786){while(--_0x236786){_0x1608e2['push'](_0x1608e2['shift']());}};_0x2438a2(++_0x46320c);}(_0xfc90,0x180));var _0x0fc9=function(_0x14f2a0,_0x3597d6){_0x14f2a0=_0x14f2a0-0x0;var _0x5de531=_0xfc90[_0x14f2a0];return _0x5de531;};'use strict';var _=require(_0x0fc9('0x0'));var util=require(_0x0fc9('0x1'));var logger=require('../../config/logger')(_0x0fc9('0x2'));var moment=require(_0x0fc9('0x3'));var BPromise=require(_0x0fc9('0x4'));var rp=require(_0x0fc9('0x5'));var fs=require('fs');var path=require(_0x0fc9('0x6'));var rimraf=require(_0x0fc9('0x7'));var config=require(_0x0fc9('0x8'));var attributes=require(_0x0fc9('0x9'));module[_0x0fc9('0xa')]=function(_0x597506,_0x46666f){return _0x597506['define'](_0x0fc9('0xb'),attributes,{'tableName':_0x0fc9('0xc'),'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 60d1dfe..a61a9c7 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 _0x3221=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','error','code','message','result','lodash','moment','randomstring','ioredis'];(function(_0x1a7e2a,_0x206e31){var _0x427b57=function(_0x44b103){while(--_0x44b103){_0x1a7e2a['push'](_0x1a7e2a['shift']());}};_0x427b57(++_0x206e31);}(_0x3221,0x1f0));var _0x1322=function(_0x42b58d,_0x2e7f1b){_0x42b58d=_0x42b58d-0x0;var _0x3a7106=_0x3221[_0x42b58d];return _0x3a7106;};'use strict';var _=require(_0x1322('0x0'));var util=require('util');var moment=require(_0x1322('0x1'));var BPromise=require('bluebird');var rs=require(_0x1322('0x2'));var fs=require('fs');var Redis=require(_0x1322('0x3'));var db=require(_0x1322('0x4'))['db'];var utils=require(_0x1322('0x5'));var logger=require(_0x1322('0x6'))(_0x1322('0x7'));var config=require(_0x1322('0x8'));var jayson=require(_0x1322('0x9'));var client=jayson[_0x1322('0xa')][_0x1322('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2e8b4e,_0x1686f5,_0x4ec05e){return new BPromise(function(_0x445cb8,_0x14aa9d){return client['request'](_0x2e8b4e,_0x4ec05e)[_0x1322('0xc')](function(_0x2e5c5c){logger[_0x1322('0xd')](_0x1322('0xe'),_0x1686f5,_0x1322('0xf'));logger['debug']('VtigerConfiguration,\x20%s,\x20%s,\x20%s',_0x1686f5,'request\x20sent',JSON['stringify'](_0x2e5c5c));if(_0x2e5c5c[_0x1322('0x10')]){if(_0x2e5c5c['error'][_0x1322('0x11')]===0x1f4){logger[_0x1322('0x10')]('VtigerConfiguration,\x20%s,\x20%s',_0x1686f5,_0x2e5c5c[_0x1322('0x10')]['message']);return _0x14aa9d(_0x2e5c5c['error'][_0x1322('0x12')]);}logger[_0x1322('0x10')](_0x1322('0xe'),_0x1686f5,_0x2e5c5c[_0x1322('0x10')][_0x1322('0x12')]);return _0x445cb8(_0x2e5c5c[_0x1322('0x10')][_0x1322('0x12')]);}else{logger['info'](_0x1322('0xe'),_0x1686f5,_0x1322('0xf'));_0x445cb8(_0x2e5c5c[_0x1322('0x13')][_0x1322('0x12')]);}})['catch'](function(_0x68d16){logger[_0x1322('0x10')](_0x1322('0xe'),_0x1686f5,_0x68d16);_0x14aa9d(_0x68d16);});});} \ No newline at end of file +var _0xb5b6=['info','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','client','request','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x55e1d1,_0x3c9376){var _0x1165db=function(_0x5b0120){while(--_0x5b0120){_0x55e1d1['push'](_0x55e1d1['shift']());}};_0x1165db(++_0x3c9376);}(_0xb5b6,0x1d1));var _0x6b5b=function(_0x11671a,_0x1a56e6){_0x11671a=_0x11671a-0x0;var _0x2ece20=_0xb5b6[_0x11671a];return _0x2ece20;};'use strict';var _=require(_0x6b5b('0x0'));var util=require(_0x6b5b('0x1'));var moment=require('moment');var BPromise=require(_0x6b5b('0x2'));var rs=require(_0x6b5b('0x3'));var fs=require('fs');var Redis=require(_0x6b5b('0x4'));var db=require(_0x6b5b('0x5'))['db'];var utils=require(_0x6b5b('0x6'));var logger=require('../../config/logger')(_0x6b5b('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x6b5b('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3dcade,_0x19d917,_0x2001a3){return new BPromise(function(_0x2d526b,_0x45989d){return client[_0x6b5b('0x9')](_0x3dcade,_0x2001a3)['then'](function(_0xd7c69c){logger['info'](_0x6b5b('0xa'),_0x19d917,_0x6b5b('0xb'));logger[_0x6b5b('0xc')](_0x6b5b('0xd'),_0x19d917,_0x6b5b('0xb'),JSON[_0x6b5b('0xe')](_0xd7c69c));if(_0xd7c69c[_0x6b5b('0xf')]){if(_0xd7c69c[_0x6b5b('0xf')][_0x6b5b('0x10')]===0x1f4){logger[_0x6b5b('0xf')]('VtigerConfiguration,\x20%s,\x20%s',_0x19d917,_0xd7c69c[_0x6b5b('0xf')][_0x6b5b('0x11')]);return _0x45989d(_0xd7c69c[_0x6b5b('0xf')][_0x6b5b('0x11')]);}logger[_0x6b5b('0xf')](_0x6b5b('0xa'),_0x19d917,_0xd7c69c[_0x6b5b('0xf')][_0x6b5b('0x11')]);return _0x2d526b(_0xd7c69c['error'][_0x6b5b('0x11')]);}else{logger[_0x6b5b('0x12')]('VtigerConfiguration,\x20%s,\x20%s',_0x19d917,'request\x20sent');_0x2d526b(_0xd7c69c[_0x6b5b('0x13')]['message']);}})[_0x6b5b('0x14')](function(_0x3eadcf){logger['error'](_0x6b5b('0xa'),_0x19d917,_0x3eadcf);_0x45989d(_0x3eadcf);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 0159039..bf62db0 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 _0xf8c7=['connect-timeout','express','Router','fs-extra','../../components/auth/service','./intVtigerField.controller','get','isAuthenticated','index','/:id','show','post','create','put','delete','destroy','exports','multer','util','path'];(function(_0x59532e,_0x425759){var _0x59b91b=function(_0x4053fa){while(--_0x4053fa){_0x59532e['push'](_0x59532e['shift']());}};_0x59b91b(++_0x425759);}(_0xf8c7,0x1a1));var _0x7f8c=function(_0x35c981,_0x1dba19){_0x35c981=_0x35c981-0x0;var _0xfa34d3=_0xf8c7[_0x35c981];return _0xfa34d3;};'use strict';var multer=require(_0x7f8c('0x0'));var util=require(_0x7f8c('0x1'));var path=require(_0x7f8c('0x2'));var timeout=require(_0x7f8c('0x3'));var express=require(_0x7f8c('0x4'));var router=express[_0x7f8c('0x5')]();var fs_extra=require(_0x7f8c('0x6'));var auth=require(_0x7f8c('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x7f8c('0x8'));router[_0x7f8c('0x9')]('/',auth[_0x7f8c('0xa')](),controller[_0x7f8c('0xb')]);router['get'](_0x7f8c('0xc'),auth[_0x7f8c('0xa')](),controller[_0x7f8c('0xd')]);router[_0x7f8c('0xe')]('/',auth[_0x7f8c('0xa')](),controller[_0x7f8c('0xf')]);router[_0x7f8c('0x10')](_0x7f8c('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x7f8c('0x11')](_0x7f8c('0xc'),auth[_0x7f8c('0xa')](),controller[_0x7f8c('0x12')]);module[_0x7f8c('0x13')]=router; \ No newline at end of file +var _0xde1b=['post','create','put','update','delete','destroy','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerField.controller','get','/:id','isAuthenticated','show'];(function(_0x22f8ab,_0x15d8ff){var _0x2a70e5=function(_0x5e6895){while(--_0x5e6895){_0x22f8ab['push'](_0x22f8ab['shift']());}};_0x2a70e5(++_0x15d8ff);}(_0xde1b,0xd7));var _0xbde1=function(_0x59cddf,_0x4fce08){_0x59cddf=_0x59cddf-0x0;var _0xb28e6f=_0xde1b[_0x59cddf];return _0xb28e6f;};'use strict';var multer=require(_0xbde1('0x0'));var util=require(_0xbde1('0x1'));var path=require(_0xbde1('0x2'));var timeout=require('connect-timeout');var express=require(_0xbde1('0x3'));var router=express[_0xbde1('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xbde1('0x5'));var interaction=require(_0xbde1('0x6'));var config=require(_0xbde1('0x7'));var controller=require(_0xbde1('0x8'));router[_0xbde1('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xbde1('0xa'),auth[_0xbde1('0xb')](),controller[_0xbde1('0xc')]);router[_0xbde1('0xd')]('/',auth[_0xbde1('0xb')](),controller[_0xbde1('0xe')]);router[_0xbde1('0xf')](_0xbde1('0xa'),auth[_0xbde1('0xb')](),controller[_0xbde1('0x10')]);router[_0xbde1('0x11')](_0xbde1('0xa'),auth[_0xbde1('0xb')](),controller[_0xbde1('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index dd4815b..611348c 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 _0x397c=['keyValue','STRING','BOOLEAN','exports','ENUM','string','variable','customVariable'];(function(_0x5723f0,_0x319526){var _0x3c61f3=function(_0x46a02b){while(--_0x46a02b){_0x5723f0['push'](_0x5723f0['shift']());}};_0x3c61f3(++_0x319526);}(_0x397c,0x11b));var _0xc397=function(_0x5cb1af,_0x4bdc8c){_0x5cb1af=_0x5cb1af-0x0;var _0x8d7940=_0x397c[_0x5cb1af];return _0x8d7940;};'use strict';var Sequelize=require('sequelize');module[_0xc397('0x0')]={'type':{'type':Sequelize[_0xc397('0x1')](_0xc397('0x2'),_0xc397('0x3'),_0xc397('0x4'),_0xc397('0x5'),'picklist'),'defaultValue':_0xc397('0x2')},'content':{'type':Sequelize[_0xc397('0x6')]},'key':{'type':Sequelize[_0xc397('0x6')]},'keyType':{'type':Sequelize[_0xc397('0x1')](_0xc397('0x2'),_0xc397('0x3'),_0xc397('0x4'))},'keyContent':{'type':Sequelize[_0xc397('0x6')]},'idField':{'type':Sequelize[_0xc397('0x6')]},'nameField':{'type':Sequelize[_0xc397('0x6')]},'customField':{'type':Sequelize[_0xc397('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x4eb9=['keyValue','picklist','STRING','BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x4eb9,0x86));var _0x94eb=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0x4eb9[_0x376b45];return _0x2341b3;};'use strict';var Sequelize=require(_0x94eb('0x0'));module[_0x94eb('0x1')]={'type':{'type':Sequelize[_0x94eb('0x2')](_0x94eb('0x3'),_0x94eb('0x4'),_0x94eb('0x5'),_0x94eb('0x6'),_0x94eb('0x7')),'defaultValue':'string'},'content':{'type':Sequelize[_0x94eb('0x8')]},'key':{'type':Sequelize[_0x94eb('0x8')]},'keyType':{'type':Sequelize[_0x94eb('0x2')](_0x94eb('0x3'),_0x94eb('0x4'),_0x94eb('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x94eb('0x8')]},'nameField':{'type':Sequelize[_0x94eb('0x8')]},'customField':{'type':Sequelize[_0x94eb('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x94eb('0x8')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index c9dd86e..b26a24f 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 _0x06c7=['moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','reject','save','update','then','destroy','error','name','index','VtigerField','rawAttributes','fieldName','key','model','map','query','filters','attributes','intersection','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','include','findAll','catch','show','params','keys','fields','find','create','body','eml-format','zip-dir','fast-json-patch'];(function(_0x521e8d,_0x23a290){var _0x518bbd=function(_0x4241eb){while(--_0x4241eb){_0x521e8d['push'](_0x521e8d['shift']());}};_0x518bbd(++_0x23a290);}(_0x06c7,0x125));var _0x706c=function(_0x21a05a,_0x189744){_0x21a05a=_0x21a05a-0x0;var _0x8264d4=_0x06c7[_0x21a05a];return _0x8264d4;};'use strict';var emlformat=require(_0x706c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x706c('0x1'));var jsonpatch=require(_0x706c('0x2'));var rp=require('request-promise');var moment=require(_0x706c('0x3'));var BPromise=require(_0x706c('0x4'));var Mustache=require('mustache');var util=require(_0x706c('0x5'));var path=require(_0x706c('0x6'));var sox=require(_0x706c('0x7'));var csv=require(_0x706c('0x8'));var ejs=require(_0x706c('0x9'));var fs=require('fs');var fs_extra=require(_0x706c('0xa'));var _=require(_0x706c('0xb'));var squel=require(_0x706c('0xc'));var crypto=require('crypto');var jsforce=require(_0x706c('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x706c('0x8'));var querystring=require('querystring');var Papa=require(_0x706c('0xe'));var Redis=require(_0x706c('0xf'));var authService=require(_0x706c('0x10'));var qs=require(_0x706c('0x11'));var as=require(_0x706c('0x12'));var hardwareService=require(_0x706c('0x13'));var logger=require(_0x706c('0x14'))(_0x706c('0x15'));var utils=require(_0x706c('0x16'));var config=require(_0x706c('0x17'));var licenseUtil=require(_0x706c('0x18'));var db=require(_0x706c('0x19'))['db'];function respondWithStatusCode(_0x1fbd29,_0x4d18e8){_0x4d18e8=_0x4d18e8||0xcc;return function(_0x21438c){if(_0x21438c){return _0x1fbd29[_0x706c('0x1a')](_0x4d18e8);}return _0x1fbd29[_0x706c('0x1b')](_0x4d18e8)[_0x706c('0x1c')]();};}function respondWithResult(_0x487cf6,_0xc6037b){_0xc6037b=_0xc6037b||0xc8;return function(_0x1ef968){if(_0x1ef968){return _0x487cf6[_0x706c('0x1b')](_0xc6037b)[_0x706c('0x1d')](_0x1ef968);}};}function respondWithFilteredResult(_0x230433,_0x19bbd5){return function(_0x4652db){if(_0x4652db){var _0x58e273=typeof _0x19bbd5[_0x706c('0x1e')]===_0x706c('0x1f')&&typeof _0x19bbd5['limit']===_0x706c('0x1f');var _0x53b96d=_0x4652db[_0x706c('0x20')];var _0x527250=_0x58e273?0x0:_0x19bbd5[_0x706c('0x1e')];var _0x4481ba=_0x58e273?_0x4652db[_0x706c('0x20')]:_0x19bbd5['offset']+_0x19bbd5[_0x706c('0x21')];var _0x13729e;if(_0x4481ba>=_0x53b96d){_0x4481ba=_0x53b96d;_0x13729e=0xc8;}else{_0x13729e=0xce;}_0x230433[_0x706c('0x1b')](_0x13729e);return _0x230433['set'](_0x706c('0x22'),_0x527250+'-'+_0x4481ba+'/'+_0x53b96d)['json'](_0x4652db);}return null;};}function patchUpdates(_0x63c14){return function(_0x25590d){try{jsonpatch['apply'](_0x25590d,_0x63c14,!![]);}catch(_0x3c4b7f){return BPromise[_0x706c('0x23')](_0x3c4b7f);}return _0x25590d[_0x706c('0x24')]();};}function saveUpdates(_0x502e9e,_0x3d0dec){return function(_0x571b3a){if(_0x571b3a){return _0x571b3a[_0x706c('0x25')](_0x502e9e)[_0x706c('0x26')](function(_0x184ea2){return _0x184ea2;});}return null;};}function removeEntity(_0x3008f3,_0x14da3a){return function(_0x3d7b95){if(_0x3d7b95){return _0x3d7b95[_0x706c('0x27')]()[_0x706c('0x26')](function(){_0x3008f3['status'](0xcc)[_0x706c('0x1c')]();});}};}function handleEntityNotFound(_0x455a64,_0x3634b9){return function(_0xfc4975){if(!_0xfc4975){_0x455a64[_0x706c('0x1a')](0x194);}return _0xfc4975;};}function handleError(_0x4b0977,_0xb8cdff){_0xb8cdff=_0xb8cdff||0x1f4;return function(_0x12ea5e){logger[_0x706c('0x28')](_0x12ea5e['stack']);if(_0x12ea5e[_0x706c('0x29')]){delete _0x12ea5e['name'];}_0x4b0977[_0x706c('0x1b')](_0xb8cdff)['send'](_0x12ea5e);};}exports[_0x706c('0x2a')]=function(_0x3ee6a0,_0xf25627){var _0xd416f7={},_0x59ad92={},_0x4bb171={'count':0x0,'rows':[]};var _0x53c619=_['map'](db[_0x706c('0x2b')][_0x706c('0x2c')],function(_0x78e3e8){return{'name':_0x78e3e8[_0x706c('0x2d')],'type':_0x78e3e8['type'][_0x706c('0x2e')]};});_0x59ad92[_0x706c('0x2f')]=_[_0x706c('0x30')](_0x53c619,'name');_0x59ad92[_0x706c('0x31')]=_['keys'](_0x3ee6a0[_0x706c('0x31')]);_0x59ad92[_0x706c('0x32')]=_['intersection'](_0x59ad92['model'],_0x59ad92[_0x706c('0x31')]);_0xd416f7[_0x706c('0x33')]=_[_0x706c('0x34')](_0x59ad92[_0x706c('0x2f')],qs['fields'](_0x3ee6a0[_0x706c('0x31')]['fields']));_0xd416f7[_0x706c('0x33')]=_0xd416f7['attributes'][_0x706c('0x35')]?_0xd416f7[_0x706c('0x33')]:_0x59ad92[_0x706c('0x2f')];if(!_0x3ee6a0['query'][_0x706c('0x36')](_0x706c('0x37'))){_0xd416f7[_0x706c('0x21')]=qs[_0x706c('0x21')](_0x3ee6a0[_0x706c('0x31')]['limit']);_0xd416f7[_0x706c('0x1e')]=qs[_0x706c('0x1e')](_0x3ee6a0[_0x706c('0x31')]['offset']);}_0xd416f7[_0x706c('0x38')]=qs[_0x706c('0x39')](_0x3ee6a0[_0x706c('0x31')][_0x706c('0x39')]);_0xd416f7['where']=qs[_0x706c('0x32')](_[_0x706c('0x3a')](_0x3ee6a0[_0x706c('0x31')],_0x59ad92[_0x706c('0x32')]),_0x53c619);if(_0x3ee6a0[_0x706c('0x31')][_0x706c('0x3b')]){_0xd416f7[_0x706c('0x3c')]=_[_0x706c('0x3d')](_0xd416f7[_0x706c('0x3c')],{'$or':_[_0x706c('0x30')](_0x53c619,function(_0x4fd86a){if(_0x4fd86a[_0x706c('0x3e')]!==_0x706c('0x3f')){var _0x3e5011={};_0x3e5011[_0x4fd86a[_0x706c('0x29')]]={'$like':'%'+_0x3ee6a0[_0x706c('0x31')][_0x706c('0x3b')]+'%'};return _0x3e5011;}})});}_0xd416f7=_['merge']({},_0xd416f7,_0x3ee6a0['options']);var _0xa2fb2f={'where':_0xd416f7[_0x706c('0x3c')]};return db[_0x706c('0x2b')]['count'](_0xa2fb2f)['then'](function(_0x3e38f7){_0x4bb171[_0x706c('0x20')]=_0x3e38f7;if(_0x3ee6a0[_0x706c('0x31')]['includeAll']){_0xd416f7[_0x706c('0x40')]=[{'all':!![]}];}return db[_0x706c('0x2b')][_0x706c('0x41')](_0xd416f7);})['then'](function(_0x597a20){_0x4bb171['rows']=_0x597a20;return _0x4bb171;})[_0x706c('0x26')](respondWithFilteredResult(_0xf25627,_0xd416f7))[_0x706c('0x42')](handleError(_0xf25627,null));};exports[_0x706c('0x43')]=function(_0x30fad1,_0x849cc){var _0x419947={'raw':!![],'where':{'id':_0x30fad1[_0x706c('0x44')]['id']}},_0x5d5815={};_0x5d5815['model']=_['keys'](db[_0x706c('0x2b')][_0x706c('0x2c')]);_0x5d5815['query']=_[_0x706c('0x45')](_0x30fad1[_0x706c('0x31')]);_0x5d5815[_0x706c('0x32')]=_[_0x706c('0x34')](_0x5d5815[_0x706c('0x2f')],_0x5d5815[_0x706c('0x31')]);_0x419947[_0x706c('0x33')]=_[_0x706c('0x34')](_0x5d5815[_0x706c('0x2f')],qs[_0x706c('0x46')](_0x30fad1[_0x706c('0x31')][_0x706c('0x46')]));_0x419947[_0x706c('0x33')]=_0x419947['attributes'][_0x706c('0x35')]?_0x419947[_0x706c('0x33')]:_0x5d5815[_0x706c('0x2f')];if(_0x30fad1['query']['includeAll']){_0x419947[_0x706c('0x40')]=[{'all':!![]}];}_0x419947=_['merge']({},_0x419947,_0x30fad1['options']);return db[_0x706c('0x2b')][_0x706c('0x47')](_0x419947)[_0x706c('0x26')](handleEntityNotFound(_0x849cc,null))['then'](respondWithResult(_0x849cc,null))['catch'](handleError(_0x849cc,null));};exports[_0x706c('0x48')]=function(_0x26484b,_0x47eb87){return db['VtigerField'][_0x706c('0x48')](_0x26484b[_0x706c('0x49')],{})[_0x706c('0x26')](respondWithResult(_0x47eb87,0xc9))[_0x706c('0x42')](handleError(_0x47eb87,null));};exports['update']=function(_0x2b78a0,_0x35d6bf){if(_0x2b78a0[_0x706c('0x49')]['id']){delete _0x2b78a0[_0x706c('0x49')]['id'];}return db['VtigerField'][_0x706c('0x47')]({'where':{'id':_0x2b78a0['params']['id']}})['then'](handleEntityNotFound(_0x35d6bf,null))[_0x706c('0x26')](saveUpdates(_0x2b78a0[_0x706c('0x49')],null))[_0x706c('0x26')](respondWithResult(_0x35d6bf,null))[_0x706c('0x42')](handleError(_0x35d6bf,null));};exports[_0x706c('0x27')]=function(_0x34fa70,_0x361021){return db[_0x706c('0x2b')][_0x706c('0x47')]({'where':{'id':_0x34fa70[_0x706c('0x44')]['id']}})['then'](handleEntityNotFound(_0x361021,null))['then'](removeEntity(_0x361021,null))[_0x706c('0x42')](handleError(_0x361021,null));}; \ No newline at end of file +var _0xc5cc=['squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','name','send','index','map','VtigerField','rawAttributes','type','key','model','filters','intersection','query','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','findAll','rows','show','keys','length','include','options','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','lodash'];(function(_0xaa0097,_0x5c908c){var _0x20210b=function(_0x20a71d){while(--_0x20a71d){_0xaa0097['push'](_0xaa0097['shift']());}};_0x20210b(++_0x5c908c);}(_0xc5cc,0x86));var _0xcc5c=function(_0x186ae5,_0x1882d6){_0x186ae5=_0x186ae5-0x0;var _0x58e99b=_0xc5cc[_0x186ae5];return _0x58e99b;};'use strict';var emlformat=require(_0xcc5c('0x0'));var rimraf=require(_0xcc5c('0x1'));var zipdir=require(_0xcc5c('0x2'));var jsonpatch=require(_0xcc5c('0x3'));var rp=require('request-promise');var moment=require(_0xcc5c('0x4'));var BPromise=require(_0xcc5c('0x5'));var Mustache=require(_0xcc5c('0x6'));var util=require(_0xcc5c('0x7'));var path=require(_0xcc5c('0x8'));var sox=require(_0xcc5c('0x9'));var csv=require(_0xcc5c('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xcc5c('0xb'));var squel=require(_0xcc5c('0xc'));var crypto=require(_0xcc5c('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xcc5c('0xe'));var toCsv=require(_0xcc5c('0xa'));var querystring=require(_0xcc5c('0xf'));var Papa=require('papaparse');var Redis=require(_0xcc5c('0x10'));var authService=require(_0xcc5c('0x11'));var qs=require(_0xcc5c('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcc5c('0x13'));var logger=require('../../config/logger')(_0xcc5c('0x14'));var utils=require('../../config/utils');var config=require(_0xcc5c('0x15'));var licenseUtil=require(_0xcc5c('0x16'));var db=require(_0xcc5c('0x17'))['db'];function respondWithStatusCode(_0x4bb032,_0x26cd8b){_0x26cd8b=_0x26cd8b||0xcc;return function(_0x367fd6){if(_0x367fd6){return _0x4bb032['sendStatus'](_0x26cd8b);}return _0x4bb032['status'](_0x26cd8b)[_0xcc5c('0x18')]();};}function respondWithResult(_0x37acf8,_0x46d88b){_0x46d88b=_0x46d88b||0xc8;return function(_0x5ea49a){if(_0x5ea49a){return _0x37acf8[_0xcc5c('0x19')](_0x46d88b)[_0xcc5c('0x1a')](_0x5ea49a);}};}function respondWithFilteredResult(_0x4e141f,_0x564f4c){return function(_0x115593){if(_0x115593){var _0x563641=typeof _0x564f4c[_0xcc5c('0x1b')]===_0xcc5c('0x1c')&&typeof _0x564f4c['limit']===_0xcc5c('0x1c');var _0x520b38=_0x115593[_0xcc5c('0x1d')];var _0x29430c=_0x563641?0x0:_0x564f4c[_0xcc5c('0x1b')];var _0x3c5725=_0x563641?_0x115593[_0xcc5c('0x1d')]:_0x564f4c[_0xcc5c('0x1b')]+_0x564f4c[_0xcc5c('0x1e')];var _0xe54a78;if(_0x3c5725>=_0x520b38){_0x3c5725=_0x520b38;_0xe54a78=0xc8;}else{_0xe54a78=0xce;}_0x4e141f[_0xcc5c('0x19')](_0xe54a78);return _0x4e141f['set'](_0xcc5c('0x1f'),_0x29430c+'-'+_0x3c5725+'/'+_0x520b38)['json'](_0x115593);}return null;};}function patchUpdates(_0x18e1ff){return function(_0xae6db2){try{jsonpatch[_0xcc5c('0x20')](_0xae6db2,_0x18e1ff,!![]);}catch(_0x489c2c){return BPromise[_0xcc5c('0x21')](_0x489c2c);}return _0xae6db2[_0xcc5c('0x22')]();};}function saveUpdates(_0x439885,_0x2706c1){return function(_0x3dd4dc){if(_0x3dd4dc){return _0x3dd4dc[_0xcc5c('0x23')](_0x439885)[_0xcc5c('0x24')](function(_0x3c1e70){return _0x3c1e70;});}return null;};}function removeEntity(_0x7176f9,_0x4f9e0b){return function(_0x772bea){if(_0x772bea){return _0x772bea[_0xcc5c('0x25')]()[_0xcc5c('0x24')](function(){_0x7176f9['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xd2866e,_0x43ac87){return function(_0x17f520){if(!_0x17f520){_0xd2866e[_0xcc5c('0x26')](0x194);}return _0x17f520;};}function handleError(_0x50fa9e,_0x39295b){_0x39295b=_0x39295b||0x1f4;return function(_0x48d829){logger['error'](_0x48d829[_0xcc5c('0x27')]);if(_0x48d829[_0xcc5c('0x28')]){delete _0x48d829[_0xcc5c('0x28')];}_0x50fa9e[_0xcc5c('0x19')](_0x39295b)[_0xcc5c('0x29')](_0x48d829);};}exports[_0xcc5c('0x2a')]=function(_0x5c7a66,_0x556188){var _0x2db566={},_0xec908={},_0x454a1d={'count':0x0,'rows':[]};var _0x1be7ed=_[_0xcc5c('0x2b')](db[_0xcc5c('0x2c')][_0xcc5c('0x2d')],function(_0x28247b){return{'name':_0x28247b['fieldName'],'type':_0x28247b[_0xcc5c('0x2e')][_0xcc5c('0x2f')]};});_0xec908[_0xcc5c('0x30')]=_[_0xcc5c('0x2b')](_0x1be7ed,'name');_0xec908['query']=_['keys'](_0x5c7a66['query']);_0xec908[_0xcc5c('0x31')]=_[_0xcc5c('0x32')](_0xec908['model'],_0xec908[_0xcc5c('0x33')]);_0x2db566[_0xcc5c('0x34')]=_[_0xcc5c('0x32')](_0xec908[_0xcc5c('0x30')],qs[_0xcc5c('0x35')](_0x5c7a66[_0xcc5c('0x33')][_0xcc5c('0x35')]));_0x2db566[_0xcc5c('0x34')]=_0x2db566[_0xcc5c('0x34')]['length']?_0x2db566['attributes']:_0xec908[_0xcc5c('0x30')];if(!_0x5c7a66[_0xcc5c('0x33')][_0xcc5c('0x36')](_0xcc5c('0x37'))){_0x2db566[_0xcc5c('0x1e')]=qs[_0xcc5c('0x1e')](_0x5c7a66[_0xcc5c('0x33')][_0xcc5c('0x1e')]);_0x2db566['offset']=qs[_0xcc5c('0x1b')](_0x5c7a66[_0xcc5c('0x33')][_0xcc5c('0x1b')]);}_0x2db566['order']=qs[_0xcc5c('0x38')](_0x5c7a66['query'][_0xcc5c('0x38')]);_0x2db566[_0xcc5c('0x39')]=qs[_0xcc5c('0x31')](_[_0xcc5c('0x3a')](_0x5c7a66[_0xcc5c('0x33')],_0xec908[_0xcc5c('0x31')]),_0x1be7ed);if(_0x5c7a66['query'][_0xcc5c('0x3b')]){_0x2db566['where']=_[_0xcc5c('0x3c')](_0x2db566[_0xcc5c('0x39')],{'$or':_['map'](_0x1be7ed,function(_0x3eacd5){if(_0x3eacd5['type']!==_0xcc5c('0x3d')){var _0x54aa18={};_0x54aa18[_0x3eacd5[_0xcc5c('0x28')]]={'$like':'%'+_0x5c7a66[_0xcc5c('0x33')][_0xcc5c('0x3b')]+'%'};return _0x54aa18;}})});}_0x2db566=_[_0xcc5c('0x3c')]({},_0x2db566,_0x5c7a66['options']);var _0x37abcb={'where':_0x2db566['where']};return db[_0xcc5c('0x2c')][_0xcc5c('0x1d')](_0x37abcb)[_0xcc5c('0x24')](function(_0x4e6296){_0x454a1d[_0xcc5c('0x1d')]=_0x4e6296;if(_0x5c7a66[_0xcc5c('0x33')]['includeAll']){_0x2db566['include']=[{'all':!![]}];}return db['VtigerField'][_0xcc5c('0x3e')](_0x2db566);})[_0xcc5c('0x24')](function(_0x2bb9b8){_0x454a1d[_0xcc5c('0x3f')]=_0x2bb9b8;return _0x454a1d;})[_0xcc5c('0x24')](respondWithFilteredResult(_0x556188,_0x2db566))['catch'](handleError(_0x556188,null));};exports[_0xcc5c('0x40')]=function(_0x29f336,_0x1fa729){var _0x550701={'raw':!![],'where':{'id':_0x29f336['params']['id']}},_0x1b2666={};_0x1b2666[_0xcc5c('0x30')]=_[_0xcc5c('0x41')](db[_0xcc5c('0x2c')]['rawAttributes']);_0x1b2666['query']=_['keys'](_0x29f336[_0xcc5c('0x33')]);_0x1b2666['filters']=_[_0xcc5c('0x32')](_0x1b2666[_0xcc5c('0x30')],_0x1b2666['query']);_0x550701[_0xcc5c('0x34')]=_[_0xcc5c('0x32')](_0x1b2666[_0xcc5c('0x30')],qs[_0xcc5c('0x35')](_0x29f336['query'][_0xcc5c('0x35')]));_0x550701['attributes']=_0x550701[_0xcc5c('0x34')][_0xcc5c('0x42')]?_0x550701[_0xcc5c('0x34')]:_0x1b2666[_0xcc5c('0x30')];if(_0x29f336[_0xcc5c('0x33')]['includeAll']){_0x550701[_0xcc5c('0x43')]=[{'all':!![]}];}_0x550701=_[_0xcc5c('0x3c')]({},_0x550701,_0x29f336[_0xcc5c('0x44')]);return db[_0xcc5c('0x2c')][_0xcc5c('0x45')](_0x550701)[_0xcc5c('0x24')](handleEntityNotFound(_0x1fa729,null))[_0xcc5c('0x24')](respondWithResult(_0x1fa729,null))[_0xcc5c('0x46')](handleError(_0x1fa729,null));};exports[_0xcc5c('0x47')]=function(_0x1ea570,_0x52a118){return db['VtigerField'][_0xcc5c('0x47')](_0x1ea570[_0xcc5c('0x48')],{})[_0xcc5c('0x24')](respondWithResult(_0x52a118,0xc9))[_0xcc5c('0x46')](handleError(_0x52a118,null));};exports[_0xcc5c('0x23')]=function(_0x23a213,_0x241dba){if(_0x23a213[_0xcc5c('0x48')]['id']){delete _0x23a213['body']['id'];}return db[_0xcc5c('0x2c')][_0xcc5c('0x45')]({'where':{'id':_0x23a213['params']['id']}})[_0xcc5c('0x24')](handleEntityNotFound(_0x241dba,null))['then'](saveUpdates(_0x23a213[_0xcc5c('0x48')],null))['then'](respondWithResult(_0x241dba,null))[_0xcc5c('0x46')](handleError(_0x241dba,null));};exports[_0xcc5c('0x25')]=function(_0x446f60,_0x158124){return db['VtigerField'][_0xcc5c('0x45')]({'where':{'id':_0x446f60['params']['id']}})[_0xcc5c('0x24')](handleEntityNotFound(_0x158124,null))[_0xcc5c('0x24')](removeEntity(_0x158124,null))[_0xcc5c('0x46')](handleError(_0x158124,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index 52a4be2..be89a5e 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 _0x604d=['vtiger_unique_index','idField','FieldId','lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./intVtigerField.attributes','exports','define','VtigerField','int_vtiger_fields'];(function(_0x3b1e3f,_0xf8826b){var _0x3b1cd3=function(_0x26ad44){while(--_0x26ad44){_0x3b1e3f['push'](_0x3b1e3f['shift']());}};_0x3b1cd3(++_0xf8826b);}(_0x604d,0x1b3));var _0xd604=function(_0x4fb884,_0x26c6f5){_0x4fb884=_0x4fb884-0x0;var _0x4f2cf9=_0x604d[_0x4fb884];return _0x4f2cf9;};'use strict';var _=require(_0xd604('0x0'));var util=require(_0xd604('0x1'));var logger=require(_0xd604('0x2'))('api');var moment=require(_0xd604('0x3'));var BPromise=require(_0xd604('0x4'));var rp=require(_0xd604('0x5'));var fs=require('fs');var path=require(_0xd604('0x6'));var rimraf=require('rimraf');var config=require(_0xd604('0x7'));var attributes=require(_0xd604('0x8'));module[_0xd604('0x9')]=function(_0x5dc3be,_0x1d3b97){return _0x5dc3be[_0xd604('0xa')](_0xd604('0xb'),attributes,{'tableName':_0xd604('0xc'),'paranoid':![],'indexes':[{'name':_0xd604('0xd'),'fields':[_0xd604('0xe'),_0xd604('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8d46=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intVtigerField.attributes','VtigerField','vtiger_unique_index','idField','FieldId'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x8d46,0x186));var _0x68d4=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x8d46[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0x68d4('0x0'));var util=require('util');var logger=require(_0x68d4('0x1'))(_0x68d4('0x2'));var moment=require(_0x68d4('0x3'));var BPromise=require(_0x68d4('0x4'));var rp=require(_0x68d4('0x5'));var fs=require('fs');var path=require(_0x68d4('0x6'));var rimraf=require(_0x68d4('0x7'));var config=require('../../config/environment');var attributes=require(_0x68d4('0x8'));module['exports']=function(_0x164277,_0xefd4f2){return _0x164277['define'](_0x68d4('0x9'),attributes,{'tableName':'int_vtiger_fields','paranoid':![],'indexes':[{'name':_0x68d4('0xa'),'fields':[_0x68d4('0xb'),_0x68d4('0xc')],'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 5a48db5..02dce23 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 _0xa936=['jayson/promise','request','then','debug','VtigerField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','VtigerField,\x20%s,\x20%s','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment'];(function(_0x140202,_0x4245c7){var _0x3037c2=function(_0x525d19){while(--_0x525d19){_0x140202['push'](_0x140202['shift']());}};_0x3037c2(++_0x4245c7);}(_0xa936,0x99));var _0x6a93=function(_0x3070dc,_0x40cf11){_0x3070dc=_0x3070dc-0x0;var _0x431489=_0xa936[_0x3070dc];return _0x431489;};'use strict';var _=require('lodash');var util=require(_0x6a93('0x0'));var moment=require('moment');var BPromise=require(_0x6a93('0x1'));var rs=require(_0x6a93('0x2'));var fs=require('fs');var Redis=require(_0x6a93('0x3'));var db=require(_0x6a93('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x6a93('0x5'));var config=require(_0x6a93('0x6'));var jayson=require(_0x6a93('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2904b3,_0x245b17,_0x19e993){return new BPromise(function(_0x11cf7f,_0x499a34){return client[_0x6a93('0x8')](_0x2904b3,_0x19e993)[_0x6a93('0x9')](function(_0x1d3781){logger['info']('VtigerField,\x20%s,\x20%s',_0x245b17,'request\x20sent');logger[_0x6a93('0xa')](_0x6a93('0xb'),_0x245b17,_0x6a93('0xc'),JSON[_0x6a93('0xd')](_0x1d3781));if(_0x1d3781['error']){if(_0x1d3781[_0x6a93('0xe')][_0x6a93('0xf')]===0x1f4){logger['error'](_0x6a93('0x10'),_0x245b17,_0x1d3781[_0x6a93('0xe')][_0x6a93('0x11')]);return _0x499a34(_0x1d3781[_0x6a93('0xe')]['message']);}logger[_0x6a93('0xe')](_0x6a93('0x10'),_0x245b17,_0x1d3781['error'][_0x6a93('0x11')]);return _0x11cf7f(_0x1d3781[_0x6a93('0xe')][_0x6a93('0x11')]);}else{logger['info'](_0x6a93('0x10'),_0x245b17,'request\x20sent');_0x11cf7f(_0x1d3781[_0x6a93('0x12')][_0x6a93('0x11')]);}})[_0x6a93('0x13')](function(_0x3e10e8){logger['error'](_0x6a93('0x10'),_0x245b17,_0x3e10e8);_0x499a34(_0x3e10e8);});});} \ No newline at end of file +var _0xff7e=['../../config/logger','jayson/promise','http','request','info','VtigerField,\x20%s,\x20%s','debug','VtigerField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','lodash','util','moment','bluebird','../../config/utils'];(function(_0x4eb6ec,_0x7f2520){var _0x58881b=function(_0x4f375f){while(--_0x4f375f){_0x4eb6ec['push'](_0x4eb6ec['shift']());}};_0x58881b(++_0x7f2520);}(_0xff7e,0x163));var _0xeff7=function(_0x20160d,_0x31e77b){_0x20160d=_0x20160d-0x0;var _0x185397=_0xff7e[_0x20160d];return _0x185397;};'use strict';var _=require(_0xeff7('0x0'));var util=require(_0xeff7('0x1'));var moment=require(_0xeff7('0x2'));var BPromise=require(_0xeff7('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xeff7('0x4'));var logger=require(_0xeff7('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xeff7('0x6'));var client=jayson['client'][_0xeff7('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x45a825,_0x422243,_0x16876c){return new BPromise(function(_0x392f3f,_0x136a47){return client[_0xeff7('0x8')](_0x45a825,_0x16876c)['then'](function(_0xc61a7f){logger[_0xeff7('0x9')](_0xeff7('0xa'),_0x422243,'request\x20sent');logger[_0xeff7('0xb')](_0xeff7('0xc'),_0x422243,_0xeff7('0xd'),JSON[_0xeff7('0xe')](_0xc61a7f));if(_0xc61a7f[_0xeff7('0xf')]){if(_0xc61a7f[_0xeff7('0xf')]['code']===0x1f4){logger[_0xeff7('0xf')](_0xeff7('0xa'),_0x422243,_0xc61a7f[_0xeff7('0xf')]['message']);return _0x136a47(_0xc61a7f['error'][_0xeff7('0x10')]);}logger[_0xeff7('0xf')](_0xeff7('0xa'),_0x422243,_0xc61a7f[_0xeff7('0xf')][_0xeff7('0x10')]);return _0x392f3f(_0xc61a7f[_0xeff7('0xf')][_0xeff7('0x10')]);}else{logger[_0xeff7('0x9')](_0xeff7('0xa'),_0x422243,'request\x20sent');_0x392f3f(_0xc61a7f[_0xeff7('0x11')][_0xeff7('0x10')]);}})['catch'](function(_0x5f3b6d){logger[_0xeff7('0xf')](_0xeff7('0xa'),_0x422243,_0x5f3b6d);_0x136a47(_0x5f3b6d);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index 3e17dfa..846e2de 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 _0xf8a4=['exports','util','path','connect-timeout','express','Router','get','/:id','isAuthenticated','getConfigurations','getFields','post','/:id/configurations','addConfiguration','update','delete'];(function(_0x44fef1,_0x132cf4){var _0x3c3a04=function(_0x175a90){while(--_0x175a90){_0x44fef1['push'](_0x44fef1['shift']());}};_0x3c3a04(++_0x132cf4);}(_0xf8a4,0xe1));var _0x4f8a=function(_0x4e93a9,_0x413f30){_0x4e93a9=_0x4e93a9-0x0;var _0x43013c=_0xf8a4[_0x4e93a9];return _0x43013c;};'use strict';var multer=require('multer');var util=require(_0x4f8a('0x0'));var path=require(_0x4f8a('0x1'));var timeout=require(_0x4f8a('0x2'));var express=require(_0x4f8a('0x3'));var router=express[_0x4f8a('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intZendeskAccount.controller');router[_0x4f8a('0x5')]('/',auth['isAuthenticated'](),controller['index']);router[_0x4f8a('0x5')](_0x4f8a('0x6'),auth[_0x4f8a('0x7')](),controller['show']);router[_0x4f8a('0x5')]('/:id/configurations',auth[_0x4f8a('0x7')](),controller[_0x4f8a('0x8')]);router['get']('/:id/fields',auth[_0x4f8a('0x7')](),controller[_0x4f8a('0x9')]);router[_0x4f8a('0xa')]('/',auth['isAuthenticated'](),controller['create']);router[_0x4f8a('0xa')](_0x4f8a('0xb'),auth[_0x4f8a('0x7')](),controller[_0x4f8a('0xc')]);router['put'](_0x4f8a('0x6'),auth['isAuthenticated'](),controller[_0x4f8a('0xd')]);router[_0x4f8a('0xe')](_0x4f8a('0x6'),auth[_0x4f8a('0x7')](),controller['destroy']);module[_0x4f8a('0xf')]=router; \ No newline at end of file +var _0x5ef8=['put','destroy','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration'];(function(_0x45fde2,_0x53a4f3){var _0x1c241b=function(_0x527756){while(--_0x527756){_0x45fde2['push'](_0x45fde2['shift']());}};_0x1c241b(++_0x53a4f3);}(_0x5ef8,0x86));var _0x85ef=function(_0x5f44f6,_0x5bf9cf){_0x5f44f6=_0x5f44f6-0x0;var _0x420ae8=_0x5ef8[_0x5f44f6];return _0x420ae8;};'use strict';var multer=require('multer');var util=require(_0x85ef('0x0'));var path=require(_0x85ef('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x85ef('0x2')]();var fs_extra=require(_0x85ef('0x3'));var auth=require(_0x85ef('0x4'));var interaction=require(_0x85ef('0x5'));var config=require(_0x85ef('0x6'));var controller=require(_0x85ef('0x7'));router[_0x85ef('0x8')]('/',auth[_0x85ef('0x9')](),controller[_0x85ef('0xa')]);router['get'](_0x85ef('0xb'),auth[_0x85ef('0x9')](),controller[_0x85ef('0xc')]);router[_0x85ef('0x8')](_0x85ef('0xd'),auth['isAuthenticated'](),controller[_0x85ef('0xe')]);router['get'](_0x85ef('0xf'),auth[_0x85ef('0x9')](),controller[_0x85ef('0x10')]);router[_0x85ef('0x11')]('/',auth['isAuthenticated'](),controller[_0x85ef('0x12')]);router[_0x85ef('0x11')](_0x85ef('0xd'),auth['isAuthenticated'](),controller[_0x85ef('0x13')]);router[_0x85ef('0x14')](_0x85ef('0xb'),auth[_0x85ef('0x9')](),controller['update']);router['delete']('/:id',auth[_0x85ef('0x9')](),controller[_0x85ef('0x15')]);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 7b8e1b0..ed22ae9 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 _0x0272=['password','token','newTab','sequelize','exports','STRING','username'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0272,0x15a));var _0x2027=function(_0x4e7777,_0x3cc510){_0x4e7777=_0x4e7777-0x0;var _0x2ea23e=_0x0272[_0x4e7777];return _0x2ea23e;};'use strict';var Sequelize=require(_0x2027('0x0'));module[_0x2027('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x2027('0x2')]},'username':{'type':Sequelize[_0x2027('0x2')],'unique':_0x2027('0x3')},'password':{'type':Sequelize[_0x2027('0x2')]},'token':{'type':Sequelize[_0x2027('0x2')]},'remoteUri':{'type':Sequelize[_0x2027('0x2')],'unique':'remoteUri'},'authType':{'type':Sequelize['ENUM'](_0x2027('0x4'),_0x2027('0x5')),'defaultValue':_0x2027('0x4')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM']('integrationTab',_0x2027('0x6')),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0x677a=['username','remoteUri','ENUM','password','token','integrationTab','newTab','sequelize','STRING'];(function(_0x32b29d,_0x2c2da3){var _0x1bf6b8=function(_0x58ced1){while(--_0x58ced1){_0x32b29d['push'](_0x32b29d['shift']());}};_0x1bf6b8(++_0x2c2da3);}(_0x677a,0xd6));var _0xa677=function(_0x811584,_0x26de8b){_0x811584=_0x811584-0x0;var _0x532eec=_0x677a[_0x811584];return _0x532eec;};'use strict';var Sequelize=require(_0xa677('0x0'));module['exports']={'name':{'type':Sequelize[_0xa677('0x1')]},'description':{'type':Sequelize[_0xa677('0x1')]},'username':{'type':Sequelize[_0xa677('0x1')],'unique':_0xa677('0x2')},'password':{'type':Sequelize[_0xa677('0x1')]},'token':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xa677('0x1')],'unique':_0xa677('0x3')},'authType':{'type':Sequelize[_0xa677('0x4')](_0xa677('0x5'),_0xa677('0x6')),'defaultValue':'password'},'serverUrl':{'type':Sequelize[_0xa677('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xa677('0x4')](_0xa677('0x7'),_0xa677('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 6449a6e..b8b352e 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 _0x0972=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','undefined','limit','count','offset','set','apply','save','update','then','error','name','send','index','map','ZendeskAccount','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','destroy','getConfigurations','findOne','AccountId','channel','Descriptions','ZendeskField','getFields','username','password','token','authType','remoteUri','slice','lastIndexOf','GET','format','%s/%s','headers','Basic\x20%s','%s:%s','base64','%s/token:%s','toString','Sequelize','ValidationError','Unknown\x20authentication\x20type','subject','description','group','assignee','remove','ticket_fields','title','position','system_field_options','custom_field_options','test','statusCode','stringify','Wrong\x20credentials','rimraf','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x559870,_0x385c43){var _0x5e57a1=function(_0x51a02c){while(--_0x51a02c){_0x559870['push'](_0x559870['shift']());}};_0x5e57a1(++_0x385c43);}(_0x0972,0x64));var _0x2097=function(_0x2897d8,_0x271da9){_0x2897d8=_0x2897d8-0x0;var _0x16ffde=_0x0972[_0x2897d8];return _0x16ffde;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2097('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2097('0x1'));var rp=require('request-promise');var moment=require(_0x2097('0x2'));var BPromise=require(_0x2097('0x3'));var Mustache=require('mustache');var util=require(_0x2097('0x4'));var path=require(_0x2097('0x5'));var sox=require(_0x2097('0x6'));var csv=require(_0x2097('0x7'));var ejs=require(_0x2097('0x8'));var fs=require('fs');var fs_extra=require(_0x2097('0x9'));var _=require(_0x2097('0xa'));var squel=require('squel');var crypto=require(_0x2097('0xb'));var jsforce=require(_0x2097('0xc'));var deskjs=require(_0x2097('0xd'));var toCsv=require(_0x2097('0x7'));var querystring=require(_0x2097('0xe'));var Papa=require('papaparse');var Redis=require(_0x2097('0xf'));var authService=require(_0x2097('0x10'));var qs=require(_0x2097('0x11'));var as=require(_0x2097('0x12'));var hardwareService=require(_0x2097('0x13'));var logger=require(_0x2097('0x14'))(_0x2097('0x15'));var utils=require(_0x2097('0x16'));var config=require(_0x2097('0x17'));var licenseUtil=require(_0x2097('0x18'));var db=require(_0x2097('0x19'))['db'];var integrations=require(_0x2097('0x1a'));function respondWithStatusCode(_0x170005,_0x16871b){_0x16871b=_0x16871b||0xcc;return function(_0x24ca42){if(_0x24ca42){return _0x170005[_0x2097('0x1b')](_0x16871b);}return _0x170005[_0x2097('0x1c')](_0x16871b)[_0x2097('0x1d')]();};}function respondWithResult(_0x2c3e41,_0x354387){_0x354387=_0x354387||0xc8;return function(_0x5d0a43){if(_0x5d0a43){return _0x2c3e41[_0x2097('0x1c')](_0x354387)[_0x2097('0x1e')](_0x5d0a43);}};}function respondWithFilteredResult(_0x4d31bc,_0x4eec05){return function(_0x4fc8c5){if(_0x4fc8c5){var _0x409deb=typeof _0x4eec05['offset']===_0x2097('0x1f')&&typeof _0x4eec05[_0x2097('0x20')]===_0x2097('0x1f');var _0x1347e4=_0x4fc8c5[_0x2097('0x21')];var _0x53e2b4=_0x409deb?0x0:_0x4eec05[_0x2097('0x22')];var _0x140094=_0x409deb?_0x4fc8c5[_0x2097('0x21')]:_0x4eec05[_0x2097('0x22')]+_0x4eec05[_0x2097('0x20')];var _0x235304;if(_0x140094>=_0x1347e4){_0x140094=_0x1347e4;_0x235304=0xc8;}else{_0x235304=0xce;}_0x4d31bc[_0x2097('0x1c')](_0x235304);return _0x4d31bc[_0x2097('0x23')]('Content-Range',_0x53e2b4+'-'+_0x140094+'/'+_0x1347e4)['json'](_0x4fc8c5);}return null;};}function patchUpdates(_0xf65dc6){return function(_0x569c21){try{jsonpatch[_0x2097('0x24')](_0x569c21,_0xf65dc6,!![]);}catch(_0x1ac5f1){return BPromise['reject'](_0x1ac5f1);}return _0x569c21[_0x2097('0x25')]();};}function saveUpdates(_0x5b0582,_0x2e17c8){return function(_0xf32d3f){if(_0xf32d3f){return _0xf32d3f[_0x2097('0x26')](_0x5b0582)[_0x2097('0x27')](function(_0x36b15e){return _0x36b15e;});}return null;};}function removeEntity(_0x35047b,_0x56390a){return function(_0xae5f9){if(_0xae5f9){return _0xae5f9['destroy']()[_0x2097('0x27')](function(){_0x35047b[_0x2097('0x1c')](0xcc)[_0x2097('0x1d')]();});}};}function handleEntityNotFound(_0x9f59bc,_0x499988){return function(_0x2d683a){if(!_0x2d683a){_0x9f59bc[_0x2097('0x1b')](0x194);}return _0x2d683a;};}function handleError(_0x56af3b,_0x1229fc){_0x1229fc=_0x1229fc||0x1f4;return function(_0x5ed0fa){logger[_0x2097('0x28')](_0x5ed0fa['stack']);if(_0x5ed0fa[_0x2097('0x29')]){delete _0x5ed0fa[_0x2097('0x29')];}_0x56af3b[_0x2097('0x1c')](_0x1229fc)[_0x2097('0x2a')](_0x5ed0fa);};}exports[_0x2097('0x2b')]=function(_0x36228c,_0x450e0b){var _0x4b443d={},_0x11242f={},_0x14d964={'count':0x0,'rows':[]};var _0x5cce55=_[_0x2097('0x2c')](db[_0x2097('0x2d')]['rawAttributes'],function(_0x4d0916){return{'name':_0x4d0916[_0x2097('0x2e')],'type':_0x4d0916[_0x2097('0x2f')][_0x2097('0x30')]};});_0x11242f[_0x2097('0x31')]=_[_0x2097('0x2c')](_0x5cce55,_0x2097('0x29'));_0x11242f['query']=_[_0x2097('0x32')](_0x36228c['query']);_0x11242f[_0x2097('0x33')]=_[_0x2097('0x34')](_0x11242f[_0x2097('0x31')],_0x11242f[_0x2097('0x35')]);_0x4b443d[_0x2097('0x36')]=_[_0x2097('0x34')](_0x11242f[_0x2097('0x31')],qs[_0x2097('0x37')](_0x36228c[_0x2097('0x35')]['fields']));_0x4b443d[_0x2097('0x36')]=_0x4b443d[_0x2097('0x36')][_0x2097('0x38')]?_0x4b443d['attributes']:_0x11242f[_0x2097('0x31')];if(!_0x36228c[_0x2097('0x35')][_0x2097('0x39')](_0x2097('0x3a'))){_0x4b443d['limit']=qs['limit'](_0x36228c['query'][_0x2097('0x20')]);_0x4b443d[_0x2097('0x22')]=qs[_0x2097('0x22')](_0x36228c[_0x2097('0x35')][_0x2097('0x22')]);}_0x4b443d[_0x2097('0x3b')]=qs['sort'](_0x36228c[_0x2097('0x35')][_0x2097('0x3c')]);_0x4b443d[_0x2097('0x3d')]=qs[_0x2097('0x33')](_[_0x2097('0x3e')](_0x36228c[_0x2097('0x35')],_0x11242f['filters']),_0x5cce55);if(_0x36228c[_0x2097('0x35')][_0x2097('0x3f')]){_0x4b443d[_0x2097('0x3d')]=_['merge'](_0x4b443d['where'],{'$or':_[_0x2097('0x2c')](_0x5cce55,function(_0x372693){if(_0x372693[_0x2097('0x2f')]!==_0x2097('0x40')){var _0x41c9e6={};_0x41c9e6[_0x372693[_0x2097('0x29')]]={'$like':'%'+_0x36228c[_0x2097('0x35')][_0x2097('0x3f')]+'%'};return _0x41c9e6;}})});}_0x4b443d=_[_0x2097('0x41')]({},_0x4b443d,_0x36228c[_0x2097('0x42')]);var _0x337979={'where':_0x4b443d[_0x2097('0x3d')]};return db['ZendeskAccount'][_0x2097('0x21')](_0x337979)[_0x2097('0x27')](function(_0x7b556c){_0x14d964['count']=_0x7b556c;if(_0x36228c[_0x2097('0x35')][_0x2097('0x43')]){_0x4b443d[_0x2097('0x44')]=[{'all':!![]}];}return db[_0x2097('0x2d')][_0x2097('0x45')](_0x4b443d);})[_0x2097('0x27')](function(_0x29dab3){_0x14d964[_0x2097('0x46')]=_0x29dab3;return _0x14d964;})['then'](respondWithFilteredResult(_0x450e0b,_0x4b443d))[_0x2097('0x47')](handleError(_0x450e0b,null));};exports[_0x2097('0x48')]=function(_0x186ca5,_0x3288ae){var _0x12e0e2={'raw':![],'where':{'id':_0x186ca5[_0x2097('0x49')]['id']}},_0xe3ac1b={};_0xe3ac1b[_0x2097('0x31')]=_['keys'](db[_0x2097('0x2d')]['rawAttributes']);_0xe3ac1b[_0x2097('0x35')]=_[_0x2097('0x32')](_0x186ca5[_0x2097('0x35')]);_0xe3ac1b[_0x2097('0x33')]=_[_0x2097('0x34')](_0xe3ac1b['model'],_0xe3ac1b[_0x2097('0x35')]);_0x12e0e2[_0x2097('0x36')]=_[_0x2097('0x34')](_0xe3ac1b[_0x2097('0x31')],qs[_0x2097('0x37')](_0x186ca5['query'][_0x2097('0x37')]));_0x12e0e2[_0x2097('0x36')]=_0x12e0e2[_0x2097('0x36')][_0x2097('0x38')]?_0x12e0e2[_0x2097('0x36')]:_0xe3ac1b[_0x2097('0x31')];if(_0x186ca5[_0x2097('0x35')][_0x2097('0x43')]){_0x12e0e2['include']=[{'all':!![]}];}_0x12e0e2=_[_0x2097('0x41')]({},_0x12e0e2,_0x186ca5[_0x2097('0x42')]);return db[_0x2097('0x2d')][_0x2097('0x4a')](_0x12e0e2)['then'](handleEntityNotFound(_0x3288ae,null))['then'](respondWithResult(_0x3288ae,null))['catch'](handleError(_0x3288ae,null));};exports[_0x2097('0x4b')]=function(_0x396979,_0x4c4ef9){return db[_0x2097('0x2d')][_0x2097('0x4b')](_0x396979['body'],{})['then'](respondWithResult(_0x4c4ef9,0xc9))[_0x2097('0x47')](handleError(_0x4c4ef9,null));};exports[_0x2097('0x26')]=function(_0x1b4de6,_0x5a0c05){if(_0x1b4de6[_0x2097('0x4c')]['id']){delete _0x1b4de6[_0x2097('0x4c')]['id'];}return db['ZendeskAccount'][_0x2097('0x4a')]({'where':{'id':_0x1b4de6[_0x2097('0x49')]['id']}})[_0x2097('0x27')](handleEntityNotFound(_0x5a0c05,null))[_0x2097('0x27')](saveUpdates(_0x1b4de6[_0x2097('0x4c')],null))['then'](respondWithResult(_0x5a0c05,null))['catch'](handleError(_0x5a0c05,null));};exports[_0x2097('0x4d')]=function(_0x39f9cb,_0x329632){return db['ZendeskAccount']['find']({'where':{'id':_0x39f9cb[_0x2097('0x49')]['id']}})[_0x2097('0x27')](handleEntityNotFound(_0x329632,null))['then'](removeEntity(_0x329632,null))[_0x2097('0x47')](handleError(_0x329632,null));};exports[_0x2097('0x4e')]=function(_0x12bdbd,_0x33490e,_0x390a52){var _0x4a709a={};var _0x42b222={};var _0x228b60;var _0x190859;return db['ZendeskAccount'][_0x2097('0x4f')]({'where':{'id':_0x12bdbd[_0x2097('0x49')]['id']}})['then'](handleEntityNotFound(_0x33490e,null))[_0x2097('0x27')](function(_0x4d6ed6){if(_0x4d6ed6){_0x228b60=_0x4d6ed6;_0x42b222[_0x2097('0x31')]=_['keys'](db['ZendeskConfiguration']['rawAttributes']);_0x42b222[_0x2097('0x35')]=_['keys'](_0x12bdbd['query']);_0x42b222[_0x2097('0x33')]=_['intersection'](_0x42b222[_0x2097('0x31')],_0x42b222[_0x2097('0x35')]);_0x4a709a['attributes']=_[_0x2097('0x34')](_0x42b222[_0x2097('0x31')],qs[_0x2097('0x37')](_0x12bdbd[_0x2097('0x35')][_0x2097('0x37')]));_0x4a709a['attributes']=_0x4a709a[_0x2097('0x36')]['length']?_0x4a709a[_0x2097('0x36')]:_0x42b222[_0x2097('0x31')];_0x4a709a[_0x2097('0x3b')]=qs['sort'](_0x12bdbd[_0x2097('0x35')][_0x2097('0x3c')]);_0x4a709a[_0x2097('0x3d')]=qs[_0x2097('0x33')](_[_0x2097('0x3e')](_0x12bdbd['query'],_0x42b222['filters']));if(_0x12bdbd[_0x2097('0x35')][_0x2097('0x3f')]){_0x4a709a['where']=_['merge'](_0x4a709a['where'],{'$or':_['map'](_0x4a709a[_0x2097('0x36')],function(_0x4cdc65){var _0x4445ff={};_0x4445ff[_0x4cdc65]={'$like':'%'+_0x12bdbd[_0x2097('0x35')]['filter']+'%'};return _0x4445ff;})});}_0x4a709a=_[_0x2097('0x41')]({},_0x4a709a,_0x12bdbd[_0x2097('0x42')]);return _0x228b60[_0x2097('0x4e')](_0x4a709a);}})[_0x2097('0x27')](function(_0x2a2673){if(_0x2a2673){_0x190859=_0x2a2673[_0x2097('0x38')];if(!_0x12bdbd[_0x2097('0x35')][_0x2097('0x39')](_0x2097('0x3a'))){_0x4a709a['limit']=qs[_0x2097('0x20')](_0x12bdbd[_0x2097('0x35')][_0x2097('0x20')]);_0x4a709a[_0x2097('0x22')]=qs[_0x2097('0x22')](_0x12bdbd[_0x2097('0x35')]['offset']);}return _0x228b60[_0x2097('0x4e')](_0x4a709a);}})[_0x2097('0x27')](function(_0xcabda7){if(_0xcabda7){return _0xcabda7?{'count':_0x190859,'rows':_0xcabda7}:null;}})[_0x2097('0x27')](respondWithResult(_0x33490e,null))[_0x2097('0x47')](handleError(_0x33490e,null));};exports['addConfiguration']=function(_0x437b79,_0x28dd95,_0x5ea02c){if(_0x437b79['body']['id']){delete _0x437b79['body']['id'];}return db[_0x2097('0x2d')][_0x2097('0x4f')]({'where':{'id':_0x437b79[_0x2097('0x49')]['id']}})[_0x2097('0x27')](handleEntityNotFound(_0x28dd95,null))[_0x2097('0x27')](function(_0x18d90a){if(_0x18d90a){_0x437b79[_0x2097('0x4c')][_0x2097('0x50')]=_0x18d90a['id'];_0x437b79[_0x2097('0x4c')]['Subjects']=integrations['getSubjects'](_0x437b79[_0x2097('0x4c')][_0x2097('0x51')],_0x437b79[_0x2097('0x4c')][_0x2097('0x2f')]);_0x437b79[_0x2097('0x4c')][_0x2097('0x52')]=integrations['getDescriptions'](_0x437b79[_0x2097('0x4c')][_0x2097('0x51')],_0x437b79[_0x2097('0x4c')][_0x2097('0x2f')]);return db['ZendeskConfiguration']['create'](_0x437b79[_0x2097('0x4c')],{'include':[{'model':db[_0x2097('0x53')],'as':'Subjects'},{'model':db[_0x2097('0x53')],'as':_0x2097('0x52')}]});}return null;})[_0x2097('0x27')](respondWithResult(_0x28dd95,null))[_0x2097('0x47')](handleError(_0x28dd95,null));};exports[_0x2097('0x54')]=function(_0x3b5519,_0x10f891,_0x2c6f24){var _0x54159e='';return db[_0x2097('0x2d')][_0x2097('0x4f')]({'where':{'id':_0x3b5519['params']['id']},'attributes':['id',_0x2097('0x55'),_0x2097('0x56'),_0x2097('0x57'),_0x2097('0x58'),_0x2097('0x59')]})[_0x2097('0x27')](handleEntityNotFound(_0x10f891,null))[_0x2097('0x27')](function(_0x22d1ce){if(_0x22d1ce){_0x54159e=_0x22d1ce[_0x2097('0x59')];var _0x1b7021=_0x54159e[_0x2097('0x5a')](-0x1);if(_0x1b7021==='/'){_0x54159e=_0x54159e['substring'](0x0,_0x54159e[_0x2097('0x5b')](_0x1b7021));}var _0x41abda={'method':_0x2097('0x5c'),'uri':util[_0x2097('0x5d')](_0x2097('0x5e'),_0x54159e,'ticket_fields'),'json':!![]};switch(_0x22d1ce[_0x2097('0x58')]){case _0x2097('0x56'):_0x41abda[_0x2097('0x5f')]={'Authorization':util['format'](_0x2097('0x60'),new Buffer(util['format'](_0x2097('0x61'),_0x22d1ce['username'],_0x22d1ce[_0x2097('0x56')]))['toString'](_0x2097('0x62')))};break;case'token':_0x41abda[_0x2097('0x5f')]={'Authorization':util[_0x2097('0x5d')](_0x2097('0x60'),new Buffer(util[_0x2097('0x5d')](_0x2097('0x63'),_0x22d1ce['username'],_0x22d1ce[_0x2097('0x57')]))[_0x2097('0x64')](_0x2097('0x62')))};break;default:throw new db[(_0x2097('0x65'))][(_0x2097('0x66'))](_0x2097('0x67'));}return rp(_0x41abda);}})[_0x2097('0x27')](function(_0x360dd5){if(_0x360dd5){var _0xd4e39d=[_0x2097('0x68'),_0x2097('0x69'),_0x2097('0x6a'),_0x2097('0x6b')];_[_0x2097('0x6c')](_0x360dd5[_0x2097('0x6d')],function(_0xf3831c){return _0xd4e39d['includes'](_0xf3831c[_0x2097('0x2f')]);});return{'count':_0x360dd5['ticket_fields']['length'],'rows':_[_0x2097('0x2c')](_0x360dd5[_0x2097('0x6d')],function(_0x107fab){return{'id':_0x107fab['id'],'name':_0x107fab['position']>0x7?_0x107fab[_0x2097('0x6e')]:_0x107fab[_0x2097('0x2f')],'custom':_0x107fab[_0x2097('0x6f')]>0x7?!![]:![],'options':_0x107fab[_0x2097('0x70')]?_0x107fab['system_field_options']:_0x107fab[_0x2097('0x71')]?_0x107fab['custom_field_options']:[]};})};}})[_0x2097('0x27')](respondWithResult(_0x10f891,null))[_0x2097('0x47')](function(_0x2619db){var _0x1e380e=_0x3b5519['query'][_0x2097('0x72')]?0x1f4:_0x2619db[_0x2097('0x73')]||0x1f4;logger[_0x2097('0x28')]('getFields,\x20%s,\x20%s,\x20%s',_0x2097('0x54'),_0x1e380e,JSON[_0x2097('0x74')](_0x2619db));delete _0x2619db[_0x2097('0x29')];if(_0x1e380e===0x191){_0x1e380e=0x190;}_0x10f891['status'](_0x1e380e)[_0x2097('0x2a')](_0x3b5519[_0x2097('0x35')][_0x2097('0x72')]?{'message':_0x2097('0x75'),'statusCode':_0x2619db[_0x2097('0x73')]}:_0x2619db);});}; \ No newline at end of file +var _0xdb94=['query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','keys','find','create','body','params','destroy','getConfigurations','findOne','ZendeskConfiguration','addConfiguration','getSubjects','channel','getDescriptions','ZendeskField','Descriptions','getFields','password','authType','remoteUri','slice','substring','%s/%s','ticket_fields','format','%s:%s','username','toString','base64','token','Basic\x20%s','Sequelize','includes','position','title','system_field_options','custom_field_options','test','statusCode','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','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','../../config/utils','../../config/environment','../../components/integrations/configuration','sendStatus','end','offset','undefined','count','limit','status','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','ZendeskAccount','rawAttributes','fieldName','key','model'];(function(_0x45aca3,_0x2dc880){var _0x540d06=function(_0x1ca425){while(--_0x1ca425){_0x45aca3['push'](_0x45aca3['shift']());}};_0x540d06(++_0x2dc880);}(_0xdb94,0xab));var _0x4db9=function(_0x3403f5,_0x2afc29){_0x3403f5=_0x3403f5-0x0;var _0x5b79ad=_0xdb94[_0x3403f5];return _0x5b79ad;};'use strict';var emlformat=require(_0x4db9('0x0'));var rimraf=require(_0x4db9('0x1'));var zipdir=require(_0x4db9('0x2'));var jsonpatch=require(_0x4db9('0x3'));var rp=require(_0x4db9('0x4'));var moment=require('moment');var BPromise=require(_0x4db9('0x5'));var Mustache=require(_0x4db9('0x6'));var util=require('util');var path=require('path');var sox=require(_0x4db9('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4db9('0x8'));var _=require('lodash');var squel=require(_0x4db9('0x9'));var crypto=require('crypto');var jsforce=require(_0x4db9('0xa'));var deskjs=require(_0x4db9('0xb'));var toCsv=require(_0x4db9('0xc'));var querystring=require(_0x4db9('0xd'));var Papa=require(_0x4db9('0xe'));var Redis=require(_0x4db9('0xf'));var authService=require(_0x4db9('0x10'));var qs=require(_0x4db9('0x11'));var as=require(_0x4db9('0x12'));var hardwareService=require(_0x4db9('0x13'));var logger=require(_0x4db9('0x14'))('api');var utils=require(_0x4db9('0x15'));var config=require(_0x4db9('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0x4db9('0x17'));function respondWithStatusCode(_0x5e644c,_0x571685){_0x571685=_0x571685||0xcc;return function(_0x34fc7d){if(_0x34fc7d){return _0x5e644c[_0x4db9('0x18')](_0x571685);}return _0x5e644c['status'](_0x571685)[_0x4db9('0x19')]();};}function respondWithResult(_0x1f9638,_0x452896){_0x452896=_0x452896||0xc8;return function(_0x22667c){if(_0x22667c){return _0x1f9638['status'](_0x452896)['json'](_0x22667c);}};}function respondWithFilteredResult(_0x102274,_0x34de1a){return function(_0x4a037f){if(_0x4a037f){var _0xadc104=typeof _0x34de1a[_0x4db9('0x1a')]==='undefined'&&typeof _0x34de1a['limit']===_0x4db9('0x1b');var _0x143b88=_0x4a037f[_0x4db9('0x1c')];var _0xa693c4=_0xadc104?0x0:_0x34de1a[_0x4db9('0x1a')];var _0x55494a=_0xadc104?_0x4a037f[_0x4db9('0x1c')]:_0x34de1a[_0x4db9('0x1a')]+_0x34de1a[_0x4db9('0x1d')];var _0x5e3b36;if(_0x55494a>=_0x143b88){_0x55494a=_0x143b88;_0x5e3b36=0xc8;}else{_0x5e3b36=0xce;}_0x102274[_0x4db9('0x1e')](_0x5e3b36);return _0x102274[_0x4db9('0x1f')](_0x4db9('0x20'),_0xa693c4+'-'+_0x55494a+'/'+_0x143b88)['json'](_0x4a037f);}return null;};}function patchUpdates(_0x46b522){return function(_0x2e8f95){try{jsonpatch[_0x4db9('0x21')](_0x2e8f95,_0x46b522,!![]);}catch(_0x46fc3d){return BPromise[_0x4db9('0x22')](_0x46fc3d);}return _0x2e8f95[_0x4db9('0x23')]();};}function saveUpdates(_0x3585d5,_0x5aef3b){return function(_0x4ceb0c){if(_0x4ceb0c){return _0x4ceb0c[_0x4db9('0x24')](_0x3585d5)[_0x4db9('0x25')](function(_0x319475){return _0x319475;});}return null;};}function removeEntity(_0x4aaa84,_0x213daa){return function(_0xdac966){if(_0xdac966){return _0xdac966['destroy']()[_0x4db9('0x25')](function(){_0x4aaa84[_0x4db9('0x1e')](0xcc)[_0x4db9('0x19')]();});}};}function handleEntityNotFound(_0x4dbb1b,_0x3c8237){return function(_0xd250c5){if(!_0xd250c5){_0x4dbb1b[_0x4db9('0x18')](0x194);}return _0xd250c5;};}function handleError(_0x2d330e,_0x3f9f7e){_0x3f9f7e=_0x3f9f7e||0x1f4;return function(_0x385e22){logger[_0x4db9('0x26')](_0x385e22[_0x4db9('0x27')]);if(_0x385e22[_0x4db9('0x28')]){delete _0x385e22[_0x4db9('0x28')];}_0x2d330e[_0x4db9('0x1e')](_0x3f9f7e)[_0x4db9('0x29')](_0x385e22);};}exports[_0x4db9('0x2a')]=function(_0x20f133,_0x583861){var _0x5031fe={},_0x3951b2={},_0x331279={'count':0x0,'rows':[]};var _0x119371=_[_0x4db9('0x2b')](db[_0x4db9('0x2c')][_0x4db9('0x2d')],function(_0x4dc946){return{'name':_0x4dc946[_0x4db9('0x2e')],'type':_0x4dc946['type'][_0x4db9('0x2f')]};});_0x3951b2[_0x4db9('0x30')]=_[_0x4db9('0x2b')](_0x119371,_0x4db9('0x28'));_0x3951b2[_0x4db9('0x31')]=_['keys'](_0x20f133['query']);_0x3951b2[_0x4db9('0x32')]=_['intersection'](_0x3951b2[_0x4db9('0x30')],_0x3951b2[_0x4db9('0x31')]);_0x5031fe['attributes']=_[_0x4db9('0x33')](_0x3951b2[_0x4db9('0x30')],qs[_0x4db9('0x34')](_0x20f133['query'][_0x4db9('0x34')]));_0x5031fe['attributes']=_0x5031fe[_0x4db9('0x35')][_0x4db9('0x36')]?_0x5031fe[_0x4db9('0x35')]:_0x3951b2['model'];if(!_0x20f133['query'][_0x4db9('0x37')](_0x4db9('0x38'))){_0x5031fe[_0x4db9('0x1d')]=qs[_0x4db9('0x1d')](_0x20f133[_0x4db9('0x31')][_0x4db9('0x1d')]);_0x5031fe[_0x4db9('0x1a')]=qs[_0x4db9('0x1a')](_0x20f133[_0x4db9('0x31')]['offset']);}_0x5031fe[_0x4db9('0x39')]=qs[_0x4db9('0x3a')](_0x20f133[_0x4db9('0x31')][_0x4db9('0x3a')]);_0x5031fe['where']=qs[_0x4db9('0x32')](_[_0x4db9('0x3b')](_0x20f133[_0x4db9('0x31')],_0x3951b2['filters']),_0x119371);if(_0x20f133[_0x4db9('0x31')][_0x4db9('0x3c')]){_0x5031fe[_0x4db9('0x3d')]=_[_0x4db9('0x3e')](_0x5031fe['where'],{'$or':_['map'](_0x119371,function(_0x41da52){if(_0x41da52[_0x4db9('0x3f')]!==_0x4db9('0x40')){var _0x8bc540={};_0x8bc540[_0x41da52[_0x4db9('0x28')]]={'$like':'%'+_0x20f133['query'][_0x4db9('0x3c')]+'%'};return _0x8bc540;}})});}_0x5031fe=_[_0x4db9('0x3e')]({},_0x5031fe,_0x20f133[_0x4db9('0x41')]);var _0x367c4c={'where':_0x5031fe[_0x4db9('0x3d')]};return db['ZendeskAccount'][_0x4db9('0x1c')](_0x367c4c)[_0x4db9('0x25')](function(_0x38a727){_0x331279['count']=_0x38a727;if(_0x20f133[_0x4db9('0x31')][_0x4db9('0x42')]){_0x5031fe[_0x4db9('0x43')]=[{'all':!![]}];}return db[_0x4db9('0x2c')][_0x4db9('0x44')](_0x5031fe);})[_0x4db9('0x25')](function(_0x412aab){_0x331279[_0x4db9('0x45')]=_0x412aab;return _0x331279;})[_0x4db9('0x25')](respondWithFilteredResult(_0x583861,_0x5031fe))[_0x4db9('0x46')](handleError(_0x583861,null));};exports['show']=function(_0x56bd68,_0x48aaf5){var _0x22a021={'raw':![],'where':{'id':_0x56bd68['params']['id']}},_0x28a3ef={};_0x28a3ef[_0x4db9('0x30')]=_[_0x4db9('0x47')](db['ZendeskAccount']['rawAttributes']);_0x28a3ef[_0x4db9('0x31')]=_['keys'](_0x56bd68[_0x4db9('0x31')]);_0x28a3ef[_0x4db9('0x32')]=_['intersection'](_0x28a3ef[_0x4db9('0x30')],_0x28a3ef[_0x4db9('0x31')]);_0x22a021['attributes']=_[_0x4db9('0x33')](_0x28a3ef[_0x4db9('0x30')],qs[_0x4db9('0x34')](_0x56bd68['query']['fields']));_0x22a021[_0x4db9('0x35')]=_0x22a021[_0x4db9('0x35')][_0x4db9('0x36')]?_0x22a021[_0x4db9('0x35')]:_0x28a3ef[_0x4db9('0x30')];if(_0x56bd68[_0x4db9('0x31')][_0x4db9('0x42')]){_0x22a021[_0x4db9('0x43')]=[{'all':!![]}];}_0x22a021=_[_0x4db9('0x3e')]({},_0x22a021,_0x56bd68[_0x4db9('0x41')]);return db[_0x4db9('0x2c')][_0x4db9('0x48')](_0x22a021)[_0x4db9('0x25')](handleEntityNotFound(_0x48aaf5,null))['then'](respondWithResult(_0x48aaf5,null))[_0x4db9('0x46')](handleError(_0x48aaf5,null));};exports[_0x4db9('0x49')]=function(_0x3852f0,_0xba27c0){return db[_0x4db9('0x2c')][_0x4db9('0x49')](_0x3852f0[_0x4db9('0x4a')],{})[_0x4db9('0x25')](respondWithResult(_0xba27c0,0xc9))[_0x4db9('0x46')](handleError(_0xba27c0,null));};exports[_0x4db9('0x24')]=function(_0x10dccb,_0x49ea0c){if(_0x10dccb['body']['id']){delete _0x10dccb[_0x4db9('0x4a')]['id'];}return db[_0x4db9('0x2c')][_0x4db9('0x48')]({'where':{'id':_0x10dccb[_0x4db9('0x4b')]['id']}})[_0x4db9('0x25')](handleEntityNotFound(_0x49ea0c,null))[_0x4db9('0x25')](saveUpdates(_0x10dccb[_0x4db9('0x4a')],null))[_0x4db9('0x25')](respondWithResult(_0x49ea0c,null))['catch'](handleError(_0x49ea0c,null));};exports[_0x4db9('0x4c')]=function(_0xcb832e,_0x121225){return db[_0x4db9('0x2c')][_0x4db9('0x48')]({'where':{'id':_0xcb832e[_0x4db9('0x4b')]['id']}})[_0x4db9('0x25')](handleEntityNotFound(_0x121225,null))[_0x4db9('0x25')](removeEntity(_0x121225,null))['catch'](handleError(_0x121225,null));};exports[_0x4db9('0x4d')]=function(_0xd6701a,_0x216696,_0x3a1f0e){var _0x15486f={};var _0x2d7fa2={};var _0x4e88c2;var _0x188663;return db['ZendeskAccount'][_0x4db9('0x4e')]({'where':{'id':_0xd6701a['params']['id']}})['then'](handleEntityNotFound(_0x216696,null))[_0x4db9('0x25')](function(_0x5996f2){if(_0x5996f2){_0x4e88c2=_0x5996f2;_0x2d7fa2[_0x4db9('0x30')]=_[_0x4db9('0x47')](db[_0x4db9('0x4f')][_0x4db9('0x2d')]);_0x2d7fa2['query']=_[_0x4db9('0x47')](_0xd6701a['query']);_0x2d7fa2[_0x4db9('0x32')]=_[_0x4db9('0x33')](_0x2d7fa2['model'],_0x2d7fa2[_0x4db9('0x31')]);_0x15486f['attributes']=_[_0x4db9('0x33')](_0x2d7fa2[_0x4db9('0x30')],qs[_0x4db9('0x34')](_0xd6701a[_0x4db9('0x31')][_0x4db9('0x34')]));_0x15486f[_0x4db9('0x35')]=_0x15486f[_0x4db9('0x35')][_0x4db9('0x36')]?_0x15486f[_0x4db9('0x35')]:_0x2d7fa2[_0x4db9('0x30')];_0x15486f[_0x4db9('0x39')]=qs[_0x4db9('0x3a')](_0xd6701a[_0x4db9('0x31')][_0x4db9('0x3a')]);_0x15486f[_0x4db9('0x3d')]=qs['filters'](_[_0x4db9('0x3b')](_0xd6701a[_0x4db9('0x31')],_0x2d7fa2['filters']));if(_0xd6701a[_0x4db9('0x31')][_0x4db9('0x3c')]){_0x15486f[_0x4db9('0x3d')]=_[_0x4db9('0x3e')](_0x15486f[_0x4db9('0x3d')],{'$or':_[_0x4db9('0x2b')](_0x15486f[_0x4db9('0x35')],function(_0x355083){var _0x215538={};_0x215538[_0x355083]={'$like':'%'+_0xd6701a['query']['filter']+'%'};return _0x215538;})});}_0x15486f=_[_0x4db9('0x3e')]({},_0x15486f,_0xd6701a[_0x4db9('0x41')]);return _0x4e88c2[_0x4db9('0x4d')](_0x15486f);}})[_0x4db9('0x25')](function(_0x35e822){if(_0x35e822){_0x188663=_0x35e822[_0x4db9('0x36')];if(!_0xd6701a[_0x4db9('0x31')][_0x4db9('0x37')](_0x4db9('0x38'))){_0x15486f[_0x4db9('0x1d')]=qs['limit'](_0xd6701a[_0x4db9('0x31')]['limit']);_0x15486f['offset']=qs['offset'](_0xd6701a['query'][_0x4db9('0x1a')]);}return _0x4e88c2['getConfigurations'](_0x15486f);}})['then'](function(_0x7aea3a){if(_0x7aea3a){return _0x7aea3a?{'count':_0x188663,'rows':_0x7aea3a}:null;}})[_0x4db9('0x25')](respondWithResult(_0x216696,null))[_0x4db9('0x46')](handleError(_0x216696,null));};exports[_0x4db9('0x50')]=function(_0x2d91d9,_0x3e833d,_0xaea8ff){if(_0x2d91d9[_0x4db9('0x4a')]['id']){delete _0x2d91d9[_0x4db9('0x4a')]['id'];}return db[_0x4db9('0x2c')][_0x4db9('0x4e')]({'where':{'id':_0x2d91d9[_0x4db9('0x4b')]['id']}})[_0x4db9('0x25')](handleEntityNotFound(_0x3e833d,null))[_0x4db9('0x25')](function(_0xd84c6c){if(_0xd84c6c){_0x2d91d9[_0x4db9('0x4a')]['AccountId']=_0xd84c6c['id'];_0x2d91d9['body']['Subjects']=integrations[_0x4db9('0x51')](_0x2d91d9['body'][_0x4db9('0x52')],_0x2d91d9[_0x4db9('0x4a')][_0x4db9('0x3f')]);_0x2d91d9['body']['Descriptions']=integrations[_0x4db9('0x53')](_0x2d91d9['body'][_0x4db9('0x52')],_0x2d91d9[_0x4db9('0x4a')][_0x4db9('0x3f')]);return db[_0x4db9('0x4f')][_0x4db9('0x49')](_0x2d91d9['body'],{'include':[{'model':db[_0x4db9('0x54')],'as':'Subjects'},{'model':db[_0x4db9('0x54')],'as':_0x4db9('0x55')}]});}return null;})[_0x4db9('0x25')](respondWithResult(_0x3e833d,null))[_0x4db9('0x46')](handleError(_0x3e833d,null));};exports[_0x4db9('0x56')]=function(_0x543d35,_0x524d82,_0x3901b5){var _0xd8a34='';return db['ZendeskAccount']['findOne']({'where':{'id':_0x543d35[_0x4db9('0x4b')]['id']},'attributes':['id','username',_0x4db9('0x57'),'token',_0x4db9('0x58'),_0x4db9('0x59')]})['then'](handleEntityNotFound(_0x524d82,null))['then'](function(_0x3de95c){if(_0x3de95c){_0xd8a34=_0x3de95c[_0x4db9('0x59')];var _0x294111=_0xd8a34[_0x4db9('0x5a')](-0x1);if(_0x294111==='/'){_0xd8a34=_0xd8a34[_0x4db9('0x5b')](0x0,_0xd8a34['lastIndexOf'](_0x294111));}var _0x593497={'method':'GET','uri':util['format'](_0x4db9('0x5c'),_0xd8a34,_0x4db9('0x5d')),'json':!![]};switch(_0x3de95c[_0x4db9('0x58')]){case _0x4db9('0x57'):_0x593497['headers']={'Authorization':util[_0x4db9('0x5e')]('Basic\x20%s',new Buffer(util[_0x4db9('0x5e')](_0x4db9('0x5f'),_0x3de95c[_0x4db9('0x60')],_0x3de95c[_0x4db9('0x57')]))[_0x4db9('0x61')](_0x4db9('0x62')))};break;case _0x4db9('0x63'):_0x593497['headers']={'Authorization':util[_0x4db9('0x5e')](_0x4db9('0x64'),new Buffer(util[_0x4db9('0x5e')]('%s/token:%s',_0x3de95c[_0x4db9('0x60')],_0x3de95c[_0x4db9('0x63')]))['toString']('base64'))};break;default:throw new db[(_0x4db9('0x65'))]['ValidationError']('Unknown\x20authentication\x20type');}return rp(_0x593497);}})[_0x4db9('0x25')](function(_0x30ba05){if(_0x30ba05){var _0x190e38=['subject','description','group','assignee'];_['remove'](_0x30ba05[_0x4db9('0x5d')],function(_0x3f4cb6){return _0x190e38[_0x4db9('0x66')](_0x3f4cb6[_0x4db9('0x3f')]);});return{'count':_0x30ba05[_0x4db9('0x5d')][_0x4db9('0x36')],'rows':_[_0x4db9('0x2b')](_0x30ba05[_0x4db9('0x5d')],function(_0x4c5be0){return{'id':_0x4c5be0['id'],'name':_0x4c5be0[_0x4db9('0x67')]>0x7?_0x4c5be0[_0x4db9('0x68')]:_0x4c5be0[_0x4db9('0x3f')],'custom':_0x4c5be0[_0x4db9('0x67')]>0x7?!![]:![],'options':_0x4c5be0[_0x4db9('0x69')]?_0x4c5be0[_0x4db9('0x69')]:_0x4c5be0[_0x4db9('0x6a')]?_0x4c5be0[_0x4db9('0x6a')]:[]};})};}})['then'](respondWithResult(_0x524d82,null))[_0x4db9('0x46')](function(_0x4a7e8b){var _0x17bbcb=_0x543d35[_0x4db9('0x31')][_0x4db9('0x6b')]?0x1f4:_0x4a7e8b[_0x4db9('0x6c')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0x4db9('0x56'),_0x17bbcb,JSON['stringify'](_0x4a7e8b));delete _0x4a7e8b[_0x4db9('0x28')];if(_0x17bbcb===0x191){_0x17bbcb=0x190;}_0x524d82[_0x4db9('0x1e')](_0x17bbcb)[_0x4db9('0x29')](_0x543d35[_0x4db9('0x31')][_0x4db9('0x6b')]?{'message':_0x4db9('0x6d'),'statusCode':_0x4a7e8b[_0x4db9('0x6c')]}:_0x4a7e8b);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index 196948a..db04957 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 _0x2186=['rimraf','../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration','exports','ZendeskAccount','int_zendesk_accounts','lodash','moment','bluebird','request-promise'];(function(_0x5ea120,_0x271931){var _0x36b321=function(_0x1b6845){while(--_0x1b6845){_0x5ea120['push'](_0x5ea120['shift']());}};_0x36b321(++_0x271931);}(_0x2186,0x1ca));var _0x6218=function(_0x5768bf,_0x5e4085){_0x5768bf=_0x5768bf-0x0;var _0x40454a=_0x2186[_0x5768bf];return _0x40454a;};'use strict';var _=require(_0x6218('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x6218('0x1'));var BPromise=require(_0x6218('0x2'));var rp=require(_0x6218('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6218('0x4'));var config=require(_0x6218('0x5'));var attributes=require(_0x6218('0x6'));var integrations=require(_0x6218('0x7'));module[_0x6218('0x8')]=function(_0x4cf11b,_0x486978){return _0x4cf11b['define'](_0x6218('0x9'),attributes,{'tableName':_0x6218('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe570=['api','bluebird','request-promise','path','rimraf','./intZendeskAccount.attributes','../../components/integrations/configuration','define','ZendeskAccount','int_zendesk_accounts','lodash','util','../../config/logger'];(function(_0x5e4633,_0x2cf0d0){var _0x3edbc0=function(_0x3d1b40){while(--_0x3d1b40){_0x5e4633['push'](_0x5e4633['shift']());}};_0x3edbc0(++_0x2cf0d0);}(_0xe570,0x10e));var _0x0e57=function(_0x42cf29,_0x3fc977){_0x42cf29=_0x42cf29-0x0;var _0x5350ad=_0xe570[_0x42cf29];return _0x5350ad;};'use strict';var _=require(_0x0e57('0x0'));var util=require(_0x0e57('0x1'));var logger=require(_0x0e57('0x2'))(_0x0e57('0x3'));var moment=require('moment');var BPromise=require(_0x0e57('0x4'));var rp=require(_0x0e57('0x5'));var fs=require('fs');var path=require(_0x0e57('0x6'));var rimraf=require(_0x0e57('0x7'));var config=require('../../config/environment');var attributes=require(_0x0e57('0x8'));var integrations=require(_0x0e57('0x9'));module['exports']=function(_0x1d198d,_0xd68a68){return _0x1d198d[_0x0e57('0xa')](_0x0e57('0xb'),attributes,{'tableName':_0x0e57('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.rpc.js b/server/api/intZendeskAccount/intZendeskAccount.rpc.js index 9fdbdd7..4bcda05 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 _0x0b49=['lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','ZendeskAccount','findAll','options','where','attributes','include','map','model','GetZendeskAccount','find','raw','ShowZendeskAccount'];(function(_0x5d97d7,_0x5c127a){var _0x16c7f8=function(_0x4b5049){while(--_0x4b5049){_0x5d97d7['push'](_0x5d97d7['shift']());}};_0x16c7f8(++_0x5c127a);}(_0x0b49,0x69));var _0x90b4=function(_0xaa0309,_0x1c8008){_0xaa0309=_0xaa0309-0x0;var _0x5de7ce=_0x0b49[_0xaa0309];return _0x5de7ce;};'use strict';var _=require(_0x90b4('0x0'));var util=require(_0x90b4('0x1'));var moment=require(_0x90b4('0x2'));var BPromise=require('bluebird');var rs=require(_0x90b4('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x90b4('0x4'))['db'];var utils=require(_0x90b4('0x5'));var logger=require(_0x90b4('0x6'))(_0x90b4('0x7'));var config=require('../../config/environment');var jayson=require(_0x90b4('0x8'));var client=jayson[_0x90b4('0x9')][_0x90b4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x165f22,_0x1d5f2e,_0x3ad9d5){return new BPromise(function(_0x1001fa,_0x4a0410){return client[_0x90b4('0xb')](_0x165f22,_0x3ad9d5)[_0x90b4('0xc')](function(_0x30700c){logger[_0x90b4('0xd')](_0x90b4('0xe'),_0x1d5f2e,_0x90b4('0xf'));logger[_0x90b4('0x10')](_0x90b4('0x11'),_0x1d5f2e,'request\x20sent',JSON[_0x90b4('0x12')](_0x30700c));if(_0x30700c[_0x90b4('0x13')]){if(_0x30700c[_0x90b4('0x13')][_0x90b4('0x14')]===0x1f4){logger[_0x90b4('0x13')](_0x90b4('0xe'),_0x1d5f2e,_0x30700c[_0x90b4('0x13')][_0x90b4('0x15')]);return _0x4a0410(_0x30700c[_0x90b4('0x13')][_0x90b4('0x15')]);}logger[_0x90b4('0x13')](_0x90b4('0xe'),_0x1d5f2e,_0x30700c[_0x90b4('0x13')][_0x90b4('0x15')]);return _0x1001fa(_0x30700c[_0x90b4('0x13')]['message']);}else{logger['info'](_0x90b4('0xe'),_0x1d5f2e,'request\x20sent');_0x1001fa(_0x30700c['result']['message']);}})[_0x90b4('0x16')](function(_0xcaefe8){logger['error'](_0x90b4('0xe'),_0x1d5f2e,_0xcaefe8);_0x4a0410(_0xcaefe8);});});}exports['GetZendeskAccount']=function(_0x2daae4){var _0x4b74a4=this;return new Promise(function(_0x3a1863,_0x52163b){return db[_0x90b4('0x17')][_0x90b4('0x18')]({'raw':_0x2daae4[_0x90b4('0x19')]?_0x2daae4[_0x90b4('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x2daae4[_0x90b4('0x19')]?_0x2daae4[_0x90b4('0x19')][_0x90b4('0x1a')]||null:null,'attributes':_0x2daae4[_0x90b4('0x19')]?_0x2daae4['options'][_0x90b4('0x1b')]||null:null,'limit':_0x2daae4[_0x90b4('0x19')]?_0x2daae4[_0x90b4('0x19')]['limit']||null:null,'include':_0x2daae4['options']?_0x2daae4['options'][_0x90b4('0x1c')]?_[_0x90b4('0x1d')](_0x2daae4[_0x90b4('0x19')]['include'],function(_0x16869b){return{'model':db[_0x16869b[_0x90b4('0x1e')]],'as':_0x16869b['as'],'attributes':_0x16869b['attributes'],'include':_0x16869b[_0x90b4('0x1c')]?_[_0x90b4('0x1d')](_0x16869b[_0x90b4('0x1c')],function(_0x289035){return{'model':db[_0x289035['model']],'as':_0x289035['as'],'attributes':_0x289035[_0x90b4('0x1b')],'include':_0x289035[_0x90b4('0x1c')]?_['map'](_0x289035[_0x90b4('0x1c')],function(_0x415a07){return{'model':db[_0x415a07[_0x90b4('0x1e')]],'as':_0x415a07['as'],'attributes':_0x415a07[_0x90b4('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x90b4('0xc')](function(_0x2bfa1d){logger['info'](_0x90b4('0x1f'),_0x2daae4);logger[_0x90b4('0x10')](_0x90b4('0x1f'),_0x2daae4,JSON[_0x90b4('0x12')](_0x2bfa1d));_0x3a1863(_0x2bfa1d);})[_0x90b4('0x16')](function(_0x2d692a){logger[_0x90b4('0x13')]('GetZendeskAccount',_0x2d692a[_0x90b4('0x15')],_0x2daae4);_0x52163b(_0x4b74a4[_0x90b4('0x13')](0x1f4,_0x2d692a[_0x90b4('0x15')]));});});};exports['ShowZendeskAccount']=function(_0x391139){var _0x3fca08=this;return new Promise(function(_0x379963,_0x51180c){return db[_0x90b4('0x17')][_0x90b4('0x20')]({'raw':_0x391139[_0x90b4('0x19')]?_0x391139[_0x90b4('0x19')][_0x90b4('0x21')]===undefined?!![]:![]:!![],'where':_0x391139[_0x90b4('0x19')]?_0x391139[_0x90b4('0x19')]['where']||null:null,'attributes':_0x391139[_0x90b4('0x19')]?_0x391139[_0x90b4('0x19')]['attributes']||null:null,'include':_0x391139[_0x90b4('0x19')]?_0x391139[_0x90b4('0x19')][_0x90b4('0x1c')]?_[_0x90b4('0x1d')](_0x391139[_0x90b4('0x19')][_0x90b4('0x1c')],function(_0x57d51c){return{'model':db[_0x57d51c['model']],'as':_0x57d51c['as'],'attributes':_0x57d51c[_0x90b4('0x1b')],'include':_0x57d51c[_0x90b4('0x1c')]?_['map'](_0x57d51c[_0x90b4('0x1c')],function(_0x4e1fde){return{'model':db[_0x4e1fde[_0x90b4('0x1e')]],'as':_0x4e1fde['as'],'attributes':_0x4e1fde['attributes'],'include':_0x4e1fde['include']?_[_0x90b4('0x1d')](_0x4e1fde[_0x90b4('0x1c')],function(_0xa7a9b8){return{'model':db[_0xa7a9b8[_0x90b4('0x1e')]],'as':_0xa7a9b8['as'],'attributes':_0xa7a9b8[_0x90b4('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5007ae){logger[_0x90b4('0xd')]('ShowZendeskAccount',_0x391139);logger[_0x90b4('0x10')]('ShowZendeskAccount',_0x391139,JSON[_0x90b4('0x12')](_0x5007ae));_0x379963(_0x5007ae);})[_0x90b4('0x16')](function(_0x1bc9f2){logger[_0x90b4('0x13')](_0x90b4('0x22'),_0x1bc9f2[_0x90b4('0x15')],_0x391139);_0x51180c(_0x3fca08[_0x90b4('0x13')](0x1f4,_0x1bc9f2[_0x90b4('0x15')]));});});}; \ No newline at end of file +var _0x4b8b=['options','raw','where','attributes','include','map','model','debug','catch','ShowZendeskAccount','ZendeskAccount','find','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetZendeskAccount'];(function(_0x4fd986,_0x438c95){var _0xdae2ad=function(_0x4ca0ad){while(--_0x4ca0ad){_0x4fd986['push'](_0x4fd986['shift']());}};_0xdae2ad(++_0x438c95);}(_0x4b8b,0x16a));var _0xb4b8=function(_0x5e3139,_0x5bad26){_0x5e3139=_0x5e3139-0x0;var _0x3cdf31=_0x4b8b[_0x5e3139];return _0x3cdf31;};'use strict';var _=require(_0xb4b8('0x0'));var util=require(_0xb4b8('0x1'));var moment=require(_0xb4b8('0x2'));var BPromise=require(_0xb4b8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb4b8('0x4'))['db'];var utils=require(_0xb4b8('0x5'));var logger=require('../../config/logger')(_0xb4b8('0x6'));var config=require(_0xb4b8('0x7'));var jayson=require(_0xb4b8('0x8'));var client=jayson[_0xb4b8('0x9')][_0xb4b8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x101b8f,_0x33d218,_0x1f607b){return new BPromise(function(_0x2e0e26,_0x8dff27){return client[_0xb4b8('0xb')](_0x101b8f,_0x1f607b)[_0xb4b8('0xc')](function(_0x34d86e){logger[_0xb4b8('0xd')](_0xb4b8('0xe'),_0x33d218,_0xb4b8('0xf'));logger['debug'](_0xb4b8('0x10'),_0x33d218,'request\x20sent',JSON[_0xb4b8('0x11')](_0x34d86e));if(_0x34d86e['error']){if(_0x34d86e[_0xb4b8('0x12')][_0xb4b8('0x13')]===0x1f4){logger[_0xb4b8('0x12')](_0xb4b8('0xe'),_0x33d218,_0x34d86e[_0xb4b8('0x12')]['message']);return _0x8dff27(_0x34d86e[_0xb4b8('0x12')][_0xb4b8('0x14')]);}logger[_0xb4b8('0x12')](_0xb4b8('0xe'),_0x33d218,_0x34d86e[_0xb4b8('0x12')][_0xb4b8('0x14')]);return _0x2e0e26(_0x34d86e[_0xb4b8('0x12')][_0xb4b8('0x14')]);}else{logger[_0xb4b8('0xd')](_0xb4b8('0xe'),_0x33d218,_0xb4b8('0xf'));_0x2e0e26(_0x34d86e[_0xb4b8('0x15')][_0xb4b8('0x14')]);}})['catch'](function(_0x10c7b9){logger[_0xb4b8('0x12')](_0xb4b8('0xe'),_0x33d218,_0x10c7b9);_0x8dff27(_0x10c7b9);});});}exports[_0xb4b8('0x16')]=function(_0x9f0e2){var _0x40026e=this;return new Promise(function(_0x3fbd11,_0x5d79b5){return db['ZendeskAccount']['findAll']({'raw':_0x9f0e2[_0xb4b8('0x17')]?_0x9f0e2['options'][_0xb4b8('0x18')]===undefined?!![]:![]:!![],'where':_0x9f0e2[_0xb4b8('0x17')]?_0x9f0e2[_0xb4b8('0x17')][_0xb4b8('0x19')]||null:null,'attributes':_0x9f0e2['options']?_0x9f0e2[_0xb4b8('0x17')][_0xb4b8('0x1a')]||null:null,'limit':_0x9f0e2[_0xb4b8('0x17')]?_0x9f0e2[_0xb4b8('0x17')]['limit']||null:null,'include':_0x9f0e2[_0xb4b8('0x17')]?_0x9f0e2[_0xb4b8('0x17')][_0xb4b8('0x1b')]?_[_0xb4b8('0x1c')](_0x9f0e2[_0xb4b8('0x17')][_0xb4b8('0x1b')],function(_0x137322){return{'model':db[_0x137322[_0xb4b8('0x1d')]],'as':_0x137322['as'],'attributes':_0x137322[_0xb4b8('0x1a')],'include':_0x137322['include']?_[_0xb4b8('0x1c')](_0x137322['include'],function(_0xf8083d){return{'model':db[_0xf8083d[_0xb4b8('0x1d')]],'as':_0xf8083d['as'],'attributes':_0xf8083d['attributes'],'include':_0xf8083d[_0xb4b8('0x1b')]?_['map'](_0xf8083d[_0xb4b8('0x1b')],function(_0x199b11){return{'model':db[_0x199b11[_0xb4b8('0x1d')]],'as':_0x199b11['as'],'attributes':_0x199b11['attributes']};}):[]};}):[]};}):[]:[]})[_0xb4b8('0xc')](function(_0x1bfcd1){logger['info'](_0xb4b8('0x16'),_0x9f0e2);logger[_0xb4b8('0x1e')](_0xb4b8('0x16'),_0x9f0e2,JSON[_0xb4b8('0x11')](_0x1bfcd1));_0x3fbd11(_0x1bfcd1);})[_0xb4b8('0x1f')](function(_0x3362c7){logger[_0xb4b8('0x12')]('GetZendeskAccount',_0x3362c7[_0xb4b8('0x14')],_0x9f0e2);_0x5d79b5(_0x40026e['error'](0x1f4,_0x3362c7[_0xb4b8('0x14')]));});});};exports[_0xb4b8('0x20')]=function(_0x4e7d21){var _0xa5c2a7=this;return new Promise(function(_0x43d67d,_0x77818e){return db[_0xb4b8('0x21')][_0xb4b8('0x22')]({'raw':_0x4e7d21[_0xb4b8('0x17')]?_0x4e7d21[_0xb4b8('0x17')][_0xb4b8('0x18')]===undefined?!![]:![]:!![],'where':_0x4e7d21[_0xb4b8('0x17')]?_0x4e7d21[_0xb4b8('0x17')][_0xb4b8('0x19')]||null:null,'attributes':_0x4e7d21['options']?_0x4e7d21[_0xb4b8('0x17')]['attributes']||null:null,'include':_0x4e7d21[_0xb4b8('0x17')]?_0x4e7d21['options'][_0xb4b8('0x1b')]?_['map'](_0x4e7d21[_0xb4b8('0x17')][_0xb4b8('0x1b')],function(_0x2db83b){return{'model':db[_0x2db83b[_0xb4b8('0x1d')]],'as':_0x2db83b['as'],'attributes':_0x2db83b[_0xb4b8('0x1a')],'include':_0x2db83b[_0xb4b8('0x1b')]?_[_0xb4b8('0x1c')](_0x2db83b[_0xb4b8('0x1b')],function(_0x570a10){return{'model':db[_0x570a10[_0xb4b8('0x1d')]],'as':_0x570a10['as'],'attributes':_0x570a10[_0xb4b8('0x1a')],'include':_0x570a10[_0xb4b8('0x1b')]?_['map'](_0x570a10[_0xb4b8('0x1b')],function(_0xd72ce2){return{'model':db[_0xd72ce2['model']],'as':_0xd72ce2['as'],'attributes':_0xd72ce2['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x45d21c){logger[_0xb4b8('0xd')]('ShowZendeskAccount',_0x4e7d21);logger[_0xb4b8('0x1e')]('ShowZendeskAccount',_0x4e7d21,JSON[_0xb4b8('0x11')](_0x45d21c));_0x43d67d(_0x45d21c);})[_0xb4b8('0x1f')](function(_0x3adebe){logger[_0xb4b8('0x12')](_0xb4b8('0x20'),_0x3adebe[_0xb4b8('0x14')],_0x4e7d21);_0x77818e(_0xa5c2a7['error'](0x1f4,_0x3adebe[_0xb4b8('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index da7b400..6de2b58 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 _0xcb91=['get','index','isAuthenticated','show','/:id/fields','/:id/subjects','getSubjects','getDescriptions','/:id/tags','create','post','put','/:id','update','delete','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intZendeskConfiguration.controller'];(function(_0x505dcb,_0x3d3646){var _0x3f1944=function(_0x22dfa1){while(--_0x22dfa1){_0x505dcb['push'](_0x505dcb['shift']());}};_0x3f1944(++_0x3d3646);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x903228,_0x42c429){_0x903228=_0x903228-0x0;var _0xcec81d=_0xcb91[_0x903228];return _0xcec81d;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');var controller=require(_0x1cb9('0x6'));router[_0x1cb9('0x7')]('/',auth['isAuthenticated'](),controller[_0x1cb9('0x8')]);router[_0x1cb9('0x7')]('/:id',auth[_0x1cb9('0x9')](),controller[_0x1cb9('0xa')]);router['get'](_0x1cb9('0xb'),auth['isAuthenticated'](),controller['getFields']);router[_0x1cb9('0x7')](_0x1cb9('0xc'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0xd')]);router[_0x1cb9('0x7')]('/:id/descriptions',auth[_0x1cb9('0x9')](),controller[_0x1cb9('0xe')]);router[_0x1cb9('0x7')](_0x1cb9('0xf'),auth[_0x1cb9('0x9')](),controller['getTags']);router['post']('/',auth['isAuthenticated'](),controller[_0x1cb9('0x10')]);router[_0x1cb9('0x11')](_0x1cb9('0xf'),auth[_0x1cb9('0x9')](),controller['setTags']);router[_0x1cb9('0x12')](_0x1cb9('0x13'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0x14')]);router[_0x1cb9('0x15')]('/:id',auth['isAuthenticated'](),controller[_0x1cb9('0x16')]);module[_0x1cb9('0x17')]=router; \ No newline at end of file +var _0xe706=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','/:id/tags','getTags','post','create','put','update','delete','exports','multer','util','path','express','Router'];(function(_0xd15440,_0x5b1aa9){var _0x65ab60=function(_0x3f1d6c){while(--_0x3f1d6c){_0xd15440['push'](_0xd15440['shift']());}};_0x65ab60(++_0x5b1aa9);}(_0xe706,0xa3));var _0x6e70=function(_0x37eb5c,_0x477cc0){_0x37eb5c=_0x37eb5c-0x0;var _0x243e31=_0xe706[_0x37eb5c];return _0x243e31;};'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('0xa')](_0x6e70('0x11'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x12')]);router[_0x6e70('0xa')](_0x6e70('0x13'),auth['isAuthenticated'](),controller['getDescriptions']);router[_0x6e70('0xa')](_0x6e70('0x14'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x15')]);router[_0x6e70('0x16')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0x17')]);router[_0x6e70('0x16')]('/:id/tags',auth['isAuthenticated'](),controller['setTags']);router[_0x6e70('0x18')]('/:id',auth['isAuthenticated'](),controller[_0x6e70('0x19')]);router[_0x6e70('0x1a')]('/:id',auth[_0x6e70('0xb')](),controller['destroy']);module[_0x6e70('0x1b')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index 85d3405..b92daa7 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 _0x5f87=['STRING','exports'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x5f87,0xe7));var _0x75f8=function(_0x3d0069,_0x59e049){_0x3d0069=_0x3d0069-0x0;var _0x136fba=_0x5f87[_0x3d0069];return _0x136fba;};'use strict';var Sequelize=require('sequelize');module[_0x75f8('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x75f8('0x1')]}}; \ No newline at end of file +var _0x72c8=['sequelize','exports','STRING'];(function(_0x1995a2,_0x7d41f4){var _0x43c7ca=function(_0x4aee15){while(--_0x4aee15){_0x1995a2['push'](_0x1995a2['shift']());}};_0x43c7ca(++_0x7d41f4);}(_0x72c8,0x72));var _0x872c=function(_0x2e019e,_0x226bee){_0x2e019e=_0x2e019e-0x0;var _0x14b1d1=_0x72c8[_0x2e019e];return _0x14b1d1;};'use strict';var Sequelize=require(_0x872c('0x0'));module[_0x872c('0x1')]={'name':{'type':Sequelize[_0x872c('0x2')]},'description':{'type':Sequelize[_0x872c('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index 4701571..fd7b5d3 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 _0x576b=['send','index','map','ZendeskConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','params','find','create','body','destroy','findOne','getFields','ZendeskField','getDescriptions','getTags','setTags','ids','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','end','stack','name'];(function(_0xc4193e,_0x431718){var _0x3af225=function(_0xd95ef0){while(--_0xd95ef0){_0xc4193e['push'](_0xc4193e['shift']());}};_0x3af225(++_0x431718);}(_0x576b,0x7c));var _0xb576=function(_0x3f6b05,_0x363cfe){_0x3f6b05=_0x3f6b05-0x0;var _0x37248e=_0x576b[_0x3f6b05];return _0x37248e;};'use strict';var emlformat=require(_0xb576('0x0'));var rimraf=require(_0xb576('0x1'));var zipdir=require(_0xb576('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb576('0x3'));var moment=require(_0xb576('0x4'));var BPromise=require(_0xb576('0x5'));var Mustache=require(_0xb576('0x6'));var util=require(_0xb576('0x7'));var path=require(_0xb576('0x8'));var sox=require('sox');var csv=require(_0xb576('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb576('0xa'));var _=require(_0xb576('0xb'));var squel=require(_0xb576('0xc'));var crypto=require(_0xb576('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xb576('0x9'));var querystring=require(_0xb576('0xe'));var Papa=require('papaparse');var Redis=require(_0xb576('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xb576('0x10'));var as=require(_0xb576('0x11'));var hardwareService=require(_0xb576('0x12'));var logger=require(_0xb576('0x13'))(_0xb576('0x14'));var utils=require(_0xb576('0x15'));var config=require(_0xb576('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1aaa7c,_0x43bd69){_0x43bd69=_0x43bd69||0xcc;return function(_0x23f39b){if(_0x23f39b){return _0x1aaa7c[_0xb576('0x17')](_0x43bd69);}return _0x1aaa7c['status'](_0x43bd69)['end']();};}function respondWithResult(_0x2a7500,_0x5c0e14){_0x5c0e14=_0x5c0e14||0xc8;return function(_0x180cbb){if(_0x180cbb){return _0x2a7500[_0xb576('0x18')](_0x5c0e14)['json'](_0x180cbb);}};}function respondWithFilteredResult(_0x2e9b9f,_0x2e1774){return function(_0x3103e6){if(_0x3103e6){var _0xd50c21=typeof _0x2e1774[_0xb576('0x19')]===_0xb576('0x1a')&&typeof _0x2e1774[_0xb576('0x1b')]===_0xb576('0x1a');var _0x1ae8ed=_0x3103e6[_0xb576('0x1c')];var _0x452f88=_0xd50c21?0x0:_0x2e1774[_0xb576('0x19')];var _0x459c5b=_0xd50c21?_0x3103e6[_0xb576('0x1c')]:_0x2e1774['offset']+_0x2e1774[_0xb576('0x1b')];var _0x3bc6f2;if(_0x459c5b>=_0x1ae8ed){_0x459c5b=_0x1ae8ed;_0x3bc6f2=0xc8;}else{_0x3bc6f2=0xce;}_0x2e9b9f[_0xb576('0x18')](_0x3bc6f2);return _0x2e9b9f[_0xb576('0x1d')](_0xb576('0x1e'),_0x452f88+'-'+_0x459c5b+'/'+_0x1ae8ed)['json'](_0x3103e6);}return null;};}function patchUpdates(_0x3421de){return function(_0x142993){try{jsonpatch['apply'](_0x142993,_0x3421de,!![]);}catch(_0x1666c1){return BPromise[_0xb576('0x1f')](_0x1666c1);}return _0x142993[_0xb576('0x20')]();};}function saveUpdates(_0x61cb6c,_0x5516c1){return function(_0x27f0ad){if(_0x27f0ad){return _0x27f0ad[_0xb576('0x21')](_0x61cb6c)[_0xb576('0x22')](function(_0x10696a){return _0x10696a;});}return null;};}function removeEntity(_0xcd1db9,_0x411f83){return function(_0x4b2682){if(_0x4b2682){return _0x4b2682['destroy']()[_0xb576('0x22')](function(){_0xcd1db9[_0xb576('0x18')](0xcc)[_0xb576('0x23')]();});}};}function handleEntityNotFound(_0x217d9c,_0x46fdc5){return function(_0x51abe1){if(!_0x51abe1){_0x217d9c['sendStatus'](0x194);}return _0x51abe1;};}function handleError(_0x7f554a,_0x16f078){_0x16f078=_0x16f078||0x1f4;return function(_0x43f81f){logger['error'](_0x43f81f[_0xb576('0x24')]);if(_0x43f81f[_0xb576('0x25')]){delete _0x43f81f[_0xb576('0x25')];}_0x7f554a[_0xb576('0x18')](_0x16f078)[_0xb576('0x26')](_0x43f81f);};}exports[_0xb576('0x27')]=function(_0x56bee5,_0x383802){var _0x11799a={},_0x4f2bc4={},_0x3e8620={'count':0x0,'rows':[]};var _0x9de5a9=_[_0xb576('0x28')](db[_0xb576('0x29')][_0xb576('0x2a')],function(_0x2cdd32){return{'name':_0x2cdd32[_0xb576('0x2b')],'type':_0x2cdd32[_0xb576('0x2c')][_0xb576('0x2d')]};});_0x4f2bc4[_0xb576('0x2e')]=_[_0xb576('0x28')](_0x9de5a9,_0xb576('0x25'));_0x4f2bc4[_0xb576('0x2f')]=_[_0xb576('0x30')](_0x56bee5[_0xb576('0x2f')]);_0x4f2bc4[_0xb576('0x31')]=_[_0xb576('0x32')](_0x4f2bc4[_0xb576('0x2e')],_0x4f2bc4[_0xb576('0x2f')]);_0x11799a[_0xb576('0x33')]=_[_0xb576('0x32')](_0x4f2bc4['model'],qs['fields'](_0x56bee5[_0xb576('0x2f')][_0xb576('0x34')]));_0x11799a['attributes']=_0x11799a[_0xb576('0x33')][_0xb576('0x35')]?_0x11799a[_0xb576('0x33')]:_0x4f2bc4['model'];if(!_0x56bee5[_0xb576('0x2f')][_0xb576('0x36')](_0xb576('0x37'))){_0x11799a[_0xb576('0x1b')]=qs[_0xb576('0x1b')](_0x56bee5[_0xb576('0x2f')]['limit']);_0x11799a[_0xb576('0x19')]=qs[_0xb576('0x19')](_0x56bee5['query'][_0xb576('0x19')]);}_0x11799a[_0xb576('0x38')]=qs[_0xb576('0x39')](_0x56bee5[_0xb576('0x2f')]['sort']);_0x11799a[_0xb576('0x3a')]=qs[_0xb576('0x31')](_[_0xb576('0x3b')](_0x56bee5[_0xb576('0x2f')],_0x4f2bc4[_0xb576('0x31')]),_0x9de5a9);if(_0x56bee5[_0xb576('0x2f')][_0xb576('0x3c')]){_0x11799a[_0xb576('0x3a')]=_['merge'](_0x11799a[_0xb576('0x3a')],{'$or':_[_0xb576('0x28')](_0x9de5a9,function(_0x1b4a59){if(_0x1b4a59[_0xb576('0x2c')]!==_0xb576('0x3d')){var _0x14c377={};_0x14c377[_0x1b4a59[_0xb576('0x25')]]={'$like':'%'+_0x56bee5[_0xb576('0x2f')][_0xb576('0x3c')]+'%'};return _0x14c377;}})});}_0x11799a=_[_0xb576('0x3e')]({},_0x11799a,_0x56bee5[_0xb576('0x3f')]);var _0x171205={'where':_0x11799a[_0xb576('0x3a')]};return db['ZendeskConfiguration']['count'](_0x171205)[_0xb576('0x22')](function(_0x3d9b2e){_0x3e8620['count']=_0x3d9b2e;if(_0x56bee5[_0xb576('0x2f')][_0xb576('0x40')]){_0x11799a[_0xb576('0x41')]=[{'all':!![]}];}return db[_0xb576('0x29')][_0xb576('0x42')](_0x11799a);})[_0xb576('0x22')](function(_0x2b4c73){_0x3e8620['rows']=_0x2b4c73;return _0x3e8620;})[_0xb576('0x22')](respondWithFilteredResult(_0x383802,_0x11799a))[_0xb576('0x43')](handleError(_0x383802,null));};exports[_0xb576('0x44')]=function(_0x299a49,_0xf4dbb3){var _0x7c3f0a={'raw':![],'where':{'id':_0x299a49[_0xb576('0x45')]['id']}},_0x20251f={};_0x20251f[_0xb576('0x2e')]=_[_0xb576('0x30')](db[_0xb576('0x29')]['rawAttributes']);_0x20251f['query']=_['keys'](_0x299a49['query']);_0x20251f['filters']=_[_0xb576('0x32')](_0x20251f[_0xb576('0x2e')],_0x20251f['query']);_0x7c3f0a[_0xb576('0x33')]=_['intersection'](_0x20251f[_0xb576('0x2e')],qs['fields'](_0x299a49[_0xb576('0x2f')][_0xb576('0x34')]));_0x7c3f0a['attributes']=_0x7c3f0a[_0xb576('0x33')][_0xb576('0x35')]?_0x7c3f0a[_0xb576('0x33')]:_0x20251f['model'];if(_0x299a49[_0xb576('0x2f')]['includeAll']){_0x7c3f0a['include']=[{'all':!![]}];}_0x7c3f0a=_[_0xb576('0x3e')]({},_0x7c3f0a,_0x299a49[_0xb576('0x3f')]);return db[_0xb576('0x29')][_0xb576('0x46')](_0x7c3f0a)[_0xb576('0x22')](handleEntityNotFound(_0xf4dbb3,null))[_0xb576('0x22')](respondWithResult(_0xf4dbb3,null))[_0xb576('0x43')](handleError(_0xf4dbb3,null));};exports[_0xb576('0x47')]=function(_0x9cc02d,_0x46bf7d){return db['ZendeskConfiguration']['create'](_0x9cc02d[_0xb576('0x48')],{})[_0xb576('0x22')](respondWithResult(_0x46bf7d,0xc9))[_0xb576('0x43')](handleError(_0x46bf7d,null));};exports[_0xb576('0x21')]=function(_0x3fc207,_0xcdf0eb){if(_0x3fc207[_0xb576('0x48')]['id']){delete _0x3fc207[_0xb576('0x48')]['id'];}return db[_0xb576('0x29')][_0xb576('0x46')]({'where':{'id':_0x3fc207[_0xb576('0x45')]['id']}})[_0xb576('0x22')](handleEntityNotFound(_0xcdf0eb,null))[_0xb576('0x22')](saveUpdates(_0x3fc207[_0xb576('0x48')],null))[_0xb576('0x22')](respondWithResult(_0xcdf0eb,null))['catch'](handleError(_0xcdf0eb,null));};exports[_0xb576('0x49')]=function(_0x934f2f,_0x580e9a){return db[_0xb576('0x29')][_0xb576('0x46')]({'where':{'id':_0x934f2f[_0xb576('0x45')]['id']}})['then'](handleEntityNotFound(_0x580e9a,null))['then'](removeEntity(_0x580e9a,null))[_0xb576('0x43')](handleError(_0x580e9a,null));};exports['getFields']=function(_0x2b082b,_0x465001,_0x520254){var _0x3354d7={};var _0x1877e5={};var _0x2304fa;var _0x5ec828;return db[_0xb576('0x29')][_0xb576('0x4a')]({'where':{'id':_0x2b082b[_0xb576('0x45')]['id']}})['then'](handleEntityNotFound(_0x465001,null))[_0xb576('0x22')](function(_0x29f68f){if(_0x29f68f){_0x2304fa=_0x29f68f;_0x1877e5['model']=_[_0xb576('0x30')](db['ZendeskField'][_0xb576('0x2a')]);_0x1877e5[_0xb576('0x2f')]=_[_0xb576('0x30')](_0x2b082b[_0xb576('0x2f')]);_0x1877e5[_0xb576('0x31')]=_[_0xb576('0x32')](_0x1877e5[_0xb576('0x2e')],_0x1877e5[_0xb576('0x2f')]);_0x3354d7[_0xb576('0x33')]=_[_0xb576('0x32')](_0x1877e5[_0xb576('0x2e')],qs['fields'](_0x2b082b[_0xb576('0x2f')][_0xb576('0x34')]));_0x3354d7[_0xb576('0x33')]=_0x3354d7[_0xb576('0x33')][_0xb576('0x35')]?_0x3354d7[_0xb576('0x33')]:_0x1877e5[_0xb576('0x2e')];_0x3354d7[_0xb576('0x38')]=qs[_0xb576('0x39')](_0x2b082b[_0xb576('0x2f')][_0xb576('0x39')]);_0x3354d7['where']=qs['filters'](_[_0xb576('0x3b')](_0x2b082b[_0xb576('0x2f')],_0x1877e5[_0xb576('0x31')]));if(_0x2b082b[_0xb576('0x2f')][_0xb576('0x3c')]){_0x3354d7['where']=_[_0xb576('0x3e')](_0x3354d7[_0xb576('0x3a')],{'$or':_[_0xb576('0x28')](_0x3354d7['attributes'],function(_0x10c47e){var _0x20d83a={};_0x20d83a[_0x10c47e]={'$like':'%'+_0x2b082b[_0xb576('0x2f')][_0xb576('0x3c')]+'%'};return _0x20d83a;})});}_0x3354d7=_[_0xb576('0x3e')]({},_0x3354d7,_0x2b082b[_0xb576('0x3f')]);return _0x2304fa['getFields'](_0x3354d7);}})[_0xb576('0x22')](function(_0x2e9bd){if(_0x2e9bd){_0x5ec828=_0x2e9bd[_0xb576('0x35')];if(!_0x2b082b[_0xb576('0x2f')]['hasOwnProperty']('nolimit')){_0x3354d7[_0xb576('0x1b')]=qs['limit'](_0x2b082b[_0xb576('0x2f')][_0xb576('0x1b')]);_0x3354d7[_0xb576('0x19')]=qs[_0xb576('0x19')](_0x2b082b[_0xb576('0x2f')][_0xb576('0x19')]);}return _0x2304fa[_0xb576('0x4b')](_0x3354d7);}})[_0xb576('0x22')](function(_0x2c4627){if(_0x2c4627){return _0x2c4627?{'count':_0x5ec828,'rows':_0x2c4627}:null;}})[_0xb576('0x22')](respondWithResult(_0x465001,null))[_0xb576('0x43')](handleError(_0x465001,null));};exports['getSubjects']=function(_0xa09bd8,_0x4a1ac3,_0x114b4b){var _0x33e9a6={};var _0x5624d3={};var _0x21e973;var _0x4e5e2d;return db[_0xb576('0x29')]['findOne']({'where':{'id':_0xa09bd8[_0xb576('0x45')]['id']}})[_0xb576('0x22')](handleEntityNotFound(_0x4a1ac3,null))['then'](function(_0x1bbdd1){if(_0x1bbdd1){_0x21e973=_0x1bbdd1;_0x5624d3[_0xb576('0x2e')]=_[_0xb576('0x30')](db[_0xb576('0x4c')][_0xb576('0x2a')]);_0x5624d3[_0xb576('0x2f')]=_[_0xb576('0x30')](_0xa09bd8[_0xb576('0x2f')]);_0x5624d3[_0xb576('0x31')]=_[_0xb576('0x32')](_0x5624d3[_0xb576('0x2e')],_0x5624d3['query']);_0x33e9a6['attributes']=_[_0xb576('0x32')](_0x5624d3['model'],qs[_0xb576('0x34')](_0xa09bd8[_0xb576('0x2f')]['fields']));_0x33e9a6[_0xb576('0x33')]=_0x33e9a6[_0xb576('0x33')][_0xb576('0x35')]?_0x33e9a6[_0xb576('0x33')]:_0x5624d3[_0xb576('0x2e')];_0x33e9a6[_0xb576('0x38')]=qs[_0xb576('0x39')](_0xa09bd8[_0xb576('0x2f')][_0xb576('0x39')]);_0x33e9a6[_0xb576('0x3a')]=qs[_0xb576('0x31')](_[_0xb576('0x3b')](_0xa09bd8[_0xb576('0x2f')],_0x5624d3[_0xb576('0x31')]));if(_0xa09bd8[_0xb576('0x2f')][_0xb576('0x3c')]){_0x33e9a6[_0xb576('0x3a')]=_[_0xb576('0x3e')](_0x33e9a6['where'],{'$or':_[_0xb576('0x28')](_0x33e9a6['attributes'],function(_0x47ce89){var _0x5969c7={};_0x5969c7[_0x47ce89]={'$like':'%'+_0xa09bd8[_0xb576('0x2f')][_0xb576('0x3c')]+'%'};return _0x5969c7;})});}_0x33e9a6=_[_0xb576('0x3e')]({},_0x33e9a6,_0xa09bd8[_0xb576('0x3f')]);return _0x21e973['getSubjects'](_0x33e9a6);}})[_0xb576('0x22')](function(_0x3eb3c4){if(_0x3eb3c4){_0x4e5e2d=_0x3eb3c4[_0xb576('0x35')];if(!_0xa09bd8['query'][_0xb576('0x36')]('nolimit')){_0x33e9a6[_0xb576('0x1b')]=qs['limit'](_0xa09bd8[_0xb576('0x2f')][_0xb576('0x1b')]);_0x33e9a6[_0xb576('0x19')]=qs[_0xb576('0x19')](_0xa09bd8[_0xb576('0x2f')][_0xb576('0x19')]);}return _0x21e973['getSubjects'](_0x33e9a6);}})[_0xb576('0x22')](function(_0x57923d){if(_0x57923d){return _0x57923d?{'count':_0x4e5e2d,'rows':_0x57923d}:null;}})[_0xb576('0x22')](respondWithResult(_0x4a1ac3,null))['catch'](handleError(_0x4a1ac3,null));};exports[_0xb576('0x4d')]=function(_0x547c72,_0x410a3f,_0x18b67c){var _0x5c8546={};var _0x1e07a6={};var _0x164468;var _0x465bc9;return db[_0xb576('0x29')][_0xb576('0x4a')]({'where':{'id':_0x547c72[_0xb576('0x45')]['id']}})[_0xb576('0x22')](handleEntityNotFound(_0x410a3f,null))[_0xb576('0x22')](function(_0x5ab488){if(_0x5ab488){_0x164468=_0x5ab488;_0x1e07a6['model']=_['keys'](db[_0xb576('0x4c')][_0xb576('0x2a')]);_0x1e07a6['query']=_[_0xb576('0x30')](_0x547c72['query']);_0x1e07a6[_0xb576('0x31')]=_[_0xb576('0x32')](_0x1e07a6[_0xb576('0x2e')],_0x1e07a6[_0xb576('0x2f')]);_0x5c8546[_0xb576('0x33')]=_[_0xb576('0x32')](_0x1e07a6[_0xb576('0x2e')],qs[_0xb576('0x34')](_0x547c72[_0xb576('0x2f')][_0xb576('0x34')]));_0x5c8546[_0xb576('0x33')]=_0x5c8546[_0xb576('0x33')]['length']?_0x5c8546[_0xb576('0x33')]:_0x1e07a6[_0xb576('0x2e')];_0x5c8546[_0xb576('0x38')]=qs[_0xb576('0x39')](_0x547c72['query'][_0xb576('0x39')]);_0x5c8546[_0xb576('0x3a')]=qs[_0xb576('0x31')](_[_0xb576('0x3b')](_0x547c72[_0xb576('0x2f')],_0x1e07a6[_0xb576('0x31')]));if(_0x547c72[_0xb576('0x2f')]['filter']){_0x5c8546[_0xb576('0x3a')]=_['merge'](_0x5c8546['where'],{'$or':_['map'](_0x5c8546['attributes'],function(_0x21061f){var _0x2b2cd4={};_0x2b2cd4[_0x21061f]={'$like':'%'+_0x547c72[_0xb576('0x2f')][_0xb576('0x3c')]+'%'};return _0x2b2cd4;})});}_0x5c8546=_['merge']({},_0x5c8546,_0x547c72['options']);return _0x164468[_0xb576('0x4d')](_0x5c8546);}})[_0xb576('0x22')](function(_0x4143fb){if(_0x4143fb){_0x465bc9=_0x4143fb[_0xb576('0x35')];if(!_0x547c72['query'][_0xb576('0x36')](_0xb576('0x37'))){_0x5c8546[_0xb576('0x1b')]=qs[_0xb576('0x1b')](_0x547c72['query'][_0xb576('0x1b')]);_0x5c8546[_0xb576('0x19')]=qs[_0xb576('0x19')](_0x547c72[_0xb576('0x2f')][_0xb576('0x19')]);}return _0x164468[_0xb576('0x4d')](_0x5c8546);}})[_0xb576('0x22')](function(_0x20bbbc){if(_0x20bbbc){return _0x20bbbc?{'count':_0x465bc9,'rows':_0x20bbbc}:null;}})[_0xb576('0x22')](respondWithResult(_0x410a3f,null))[_0xb576('0x43')](handleError(_0x410a3f,null));};exports[_0xb576('0x4e')]=function(_0x55dbb6,_0x180f9b,_0x4e6705){var _0x33c76b={};var _0x5988e3={};var _0x1ea6dd;var _0x46301f;return db[_0xb576('0x29')]['findOne']({'where':{'id':_0x55dbb6[_0xb576('0x45')]['id']}})[_0xb576('0x22')](handleEntityNotFound(_0x180f9b,null))[_0xb576('0x22')](function(_0xe31ce8){if(_0xe31ce8){_0x1ea6dd=_0xe31ce8;_0x5988e3['model']=_[_0xb576('0x30')](db['Tag'][_0xb576('0x2a')]);_0x5988e3[_0xb576('0x2f')]=_[_0xb576('0x30')](_0x55dbb6[_0xb576('0x2f')]);_0x5988e3[_0xb576('0x31')]=_[_0xb576('0x32')](_0x5988e3['model'],_0x5988e3[_0xb576('0x2f')]);_0x33c76b[_0xb576('0x33')]=_[_0xb576('0x32')](_0x5988e3[_0xb576('0x2e')],qs[_0xb576('0x34')](_0x55dbb6[_0xb576('0x2f')][_0xb576('0x34')]));_0x33c76b[_0xb576('0x33')]=_0x33c76b[_0xb576('0x33')][_0xb576('0x35')]?_0x33c76b['attributes']:_0x5988e3[_0xb576('0x2e')];_0x33c76b[_0xb576('0x38')]=qs[_0xb576('0x39')](_0x55dbb6['query'][_0xb576('0x39')]);_0x33c76b[_0xb576('0x3a')]=qs[_0xb576('0x31')](_[_0xb576('0x3b')](_0x55dbb6[_0xb576('0x2f')],_0x5988e3[_0xb576('0x31')]));if(_0x55dbb6[_0xb576('0x2f')][_0xb576('0x3c')]){_0x33c76b['where']=_[_0xb576('0x3e')](_0x33c76b[_0xb576('0x3a')],{'$or':_['map'](_0x33c76b['attributes'],function(_0x2cbb8c){var _0x63ec76={};_0x63ec76[_0x2cbb8c]={'$like':'%'+_0x55dbb6[_0xb576('0x2f')][_0xb576('0x3c')]+'%'};return _0x63ec76;})});}_0x33c76b=_[_0xb576('0x3e')]({},_0x33c76b,_0x55dbb6['options']);return _0x1ea6dd['getTags'](_0x33c76b);}})[_0xb576('0x22')](function(_0x5266be){if(_0x5266be){_0x46301f=_0x5266be[_0xb576('0x35')];if(!_0x55dbb6[_0xb576('0x2f')][_0xb576('0x36')]('nolimit')){_0x33c76b[_0xb576('0x1b')]=qs[_0xb576('0x1b')](_0x55dbb6['query'][_0xb576('0x1b')]);_0x33c76b[_0xb576('0x19')]=qs[_0xb576('0x19')](_0x55dbb6['query']['offset']);}return _0x1ea6dd[_0xb576('0x4e')](_0x33c76b);}})[_0xb576('0x22')](function(_0x8fbff){if(_0x8fbff){return _0x8fbff?{'count':_0x46301f,'rows':_0x8fbff}:null;}})['then'](respondWithResult(_0x180f9b,null))[_0xb576('0x43')](handleError(_0x180f9b,null));};exports['setTags']=function(_0x190a08,_0x5e369c,_0xe87a96){if(_0x190a08['body']['id']){delete _0x190a08[_0xb576('0x48')]['id'];}return db[_0xb576('0x29')][_0xb576('0x4a')]({'where':{'id':_0x190a08['params']['id']}})[_0xb576('0x22')](handleEntityNotFound(_0x5e369c,null))[_0xb576('0x22')](function(_0x4e6c7d){if(_0x4e6c7d){return _0x4e6c7d[_0xb576('0x4f')](_0x190a08[_0xb576('0x48')][_0xb576('0x50')]||[]);}return null;})['then'](respondWithResult(_0x5e369c,null))[_0xb576('0x43')](handleError(_0x5e369c,null));}; \ No newline at end of file +var _0x8d70=['../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','save','then','destroy','stack','name','index','map','ZendeskConfiguration','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','update','getFields','ZendeskField','findOne','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util'];(function(_0x571570,_0x3d7c78){var _0x51a034=function(_0x3e2776){while(--_0x3e2776){_0x571570['push'](_0x571570['shift']());}};_0x51a034(++_0x3d7c78);}(_0x8d70,0xe4));var _0x08d7=function(_0x401a30,_0x11ca71){_0x401a30=_0x401a30-0x0;var _0x50c815=_0x8d70[_0x401a30];return _0x50c815;};'use strict';var emlformat=require(_0x08d7('0x0'));var rimraf=require(_0x08d7('0x1'));var zipdir=require(_0x08d7('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x08d7('0x3'));var moment=require(_0x08d7('0x4'));var BPromise=require(_0x08d7('0x5'));var Mustache=require(_0x08d7('0x6'));var util=require(_0x08d7('0x7'));var path=require(_0x08d7('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x08d7('0x9'));var fs=require('fs');var fs_extra=require(_0x08d7('0xa'));var _=require(_0x08d7('0xb'));var squel=require(_0x08d7('0xc'));var crypto=require(_0x08d7('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x08d7('0xe'));var querystring=require(_0x08d7('0xf'));var Papa=require(_0x08d7('0x10'));var Redis=require(_0x08d7('0x11'));var authService=require(_0x08d7('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x08d7('0x13'));var logger=require(_0x08d7('0x14'))(_0x08d7('0x15'));var utils=require('../../config/utils');var config=require(_0x08d7('0x16'));var licenseUtil=require(_0x08d7('0x17'));var db=require(_0x08d7('0x18'))['db'];function respondWithStatusCode(_0x38e9c1,_0x85e454){_0x85e454=_0x85e454||0xcc;return function(_0x1064eb){if(_0x1064eb){return _0x38e9c1[_0x08d7('0x19')](_0x85e454);}return _0x38e9c1[_0x08d7('0x1a')](_0x85e454)[_0x08d7('0x1b')]();};}function respondWithResult(_0x2b3edb,_0xcf27b5){_0xcf27b5=_0xcf27b5||0xc8;return function(_0xf59aec){if(_0xf59aec){return _0x2b3edb[_0x08d7('0x1a')](_0xcf27b5)[_0x08d7('0x1c')](_0xf59aec);}};}function respondWithFilteredResult(_0x40730a,_0x570b21){return function(_0x224e3c){if(_0x224e3c){var _0x3a9c13=typeof _0x570b21['offset']===_0x08d7('0x1d')&&typeof _0x570b21[_0x08d7('0x1e')]===_0x08d7('0x1d');var _0x3be29d=_0x224e3c[_0x08d7('0x1f')];var _0x193744=_0x3a9c13?0x0:_0x570b21[_0x08d7('0x20')];var _0x222864=_0x3a9c13?_0x224e3c[_0x08d7('0x1f')]:_0x570b21[_0x08d7('0x20')]+_0x570b21[_0x08d7('0x1e')];var _0x31e8c7;if(_0x222864>=_0x3be29d){_0x222864=_0x3be29d;_0x31e8c7=0xc8;}else{_0x31e8c7=0xce;}_0x40730a[_0x08d7('0x1a')](_0x31e8c7);return _0x40730a['set'](_0x08d7('0x21'),_0x193744+'-'+_0x222864+'/'+_0x3be29d)['json'](_0x224e3c);}return null;};}function patchUpdates(_0x5d3012){return function(_0xb757cc){try{jsonpatch[_0x08d7('0x22')](_0xb757cc,_0x5d3012,!![]);}catch(_0x39d1dc){return BPromise[_0x08d7('0x23')](_0x39d1dc);}return _0xb757cc[_0x08d7('0x24')]();};}function saveUpdates(_0x411b4d,_0x13503c){return function(_0x2718a7){if(_0x2718a7){return _0x2718a7['update'](_0x411b4d)[_0x08d7('0x25')](function(_0x87737a){return _0x87737a;});}return null;};}function removeEntity(_0x4fabab,_0x20f68a){return function(_0x4e9df9){if(_0x4e9df9){return _0x4e9df9[_0x08d7('0x26')]()[_0x08d7('0x25')](function(){_0x4fabab[_0x08d7('0x1a')](0xcc)[_0x08d7('0x1b')]();});}};}function handleEntityNotFound(_0x52637f,_0x55e358){return function(_0x2c2d99){if(!_0x2c2d99){_0x52637f[_0x08d7('0x19')](0x194);}return _0x2c2d99;};}function handleError(_0x22cf1d,_0x539bbd){_0x539bbd=_0x539bbd||0x1f4;return function(_0x38c835){logger['error'](_0x38c835[_0x08d7('0x27')]);if(_0x38c835[_0x08d7('0x28')]){delete _0x38c835[_0x08d7('0x28')];}_0x22cf1d[_0x08d7('0x1a')](_0x539bbd)['send'](_0x38c835);};}exports[_0x08d7('0x29')]=function(_0xe79860,_0x132e49){var _0x53acd3={},_0x384226={},_0x3c77db={'count':0x0,'rows':[]};var _0x2b703d=_[_0x08d7('0x2a')](db[_0x08d7('0x2b')][_0x08d7('0x2c')],function(_0x2f7203){return{'name':_0x2f7203['fieldName'],'type':_0x2f7203[_0x08d7('0x2d')][_0x08d7('0x2e')]};});_0x384226[_0x08d7('0x2f')]=_[_0x08d7('0x2a')](_0x2b703d,_0x08d7('0x28'));_0x384226['query']=_[_0x08d7('0x30')](_0xe79860[_0x08d7('0x31')]);_0x384226[_0x08d7('0x32')]=_[_0x08d7('0x33')](_0x384226[_0x08d7('0x2f')],_0x384226[_0x08d7('0x31')]);_0x53acd3[_0x08d7('0x34')]=_[_0x08d7('0x33')](_0x384226[_0x08d7('0x2f')],qs[_0x08d7('0x35')](_0xe79860[_0x08d7('0x31')][_0x08d7('0x35')]));_0x53acd3[_0x08d7('0x34')]=_0x53acd3['attributes']['length']?_0x53acd3[_0x08d7('0x34')]:_0x384226['model'];if(!_0xe79860['query'][_0x08d7('0x36')](_0x08d7('0x37'))){_0x53acd3[_0x08d7('0x1e')]=qs[_0x08d7('0x1e')](_0xe79860['query'][_0x08d7('0x1e')]);_0x53acd3['offset']=qs[_0x08d7('0x20')](_0xe79860[_0x08d7('0x31')][_0x08d7('0x20')]);}_0x53acd3[_0x08d7('0x38')]=qs[_0x08d7('0x39')](_0xe79860[_0x08d7('0x31')][_0x08d7('0x39')]);_0x53acd3['where']=qs['filters'](_[_0x08d7('0x3a')](_0xe79860[_0x08d7('0x31')],_0x384226[_0x08d7('0x32')]),_0x2b703d);if(_0xe79860[_0x08d7('0x31')][_0x08d7('0x3b')]){_0x53acd3[_0x08d7('0x3c')]=_[_0x08d7('0x3d')](_0x53acd3['where'],{'$or':_[_0x08d7('0x2a')](_0x2b703d,function(_0x581803){if(_0x581803['type']!=='VIRTUAL'){var _0x355fba={};_0x355fba[_0x581803[_0x08d7('0x28')]]={'$like':'%'+_0xe79860[_0x08d7('0x31')][_0x08d7('0x3b')]+'%'};return _0x355fba;}})});}_0x53acd3=_[_0x08d7('0x3d')]({},_0x53acd3,_0xe79860[_0x08d7('0x3e')]);var _0x248a88={'where':_0x53acd3[_0x08d7('0x3c')]};return db[_0x08d7('0x2b')][_0x08d7('0x1f')](_0x248a88)[_0x08d7('0x25')](function(_0x226a74){_0x3c77db[_0x08d7('0x1f')]=_0x226a74;if(_0xe79860['query'][_0x08d7('0x3f')]){_0x53acd3[_0x08d7('0x40')]=[{'all':!![]}];}return db['ZendeskConfiguration'][_0x08d7('0x41')](_0x53acd3);})[_0x08d7('0x25')](function(_0x12b7c2){_0x3c77db[_0x08d7('0x42')]=_0x12b7c2;return _0x3c77db;})[_0x08d7('0x25')](respondWithFilteredResult(_0x132e49,_0x53acd3))[_0x08d7('0x43')](handleError(_0x132e49,null));};exports[_0x08d7('0x44')]=function(_0x4e7746,_0x9e29a2){var _0x518776={'raw':![],'where':{'id':_0x4e7746[_0x08d7('0x45')]['id']}},_0x596cc5={};_0x596cc5['model']=_[_0x08d7('0x30')](db[_0x08d7('0x2b')][_0x08d7('0x2c')]);_0x596cc5[_0x08d7('0x31')]=_[_0x08d7('0x30')](_0x4e7746['query']);_0x596cc5[_0x08d7('0x32')]=_[_0x08d7('0x33')](_0x596cc5[_0x08d7('0x2f')],_0x596cc5[_0x08d7('0x31')]);_0x518776[_0x08d7('0x34')]=_[_0x08d7('0x33')](_0x596cc5[_0x08d7('0x2f')],qs[_0x08d7('0x35')](_0x4e7746[_0x08d7('0x31')][_0x08d7('0x35')]));_0x518776['attributes']=_0x518776[_0x08d7('0x34')][_0x08d7('0x46')]?_0x518776[_0x08d7('0x34')]:_0x596cc5[_0x08d7('0x2f')];if(_0x4e7746[_0x08d7('0x31')][_0x08d7('0x3f')]){_0x518776[_0x08d7('0x40')]=[{'all':!![]}];}_0x518776=_['merge']({},_0x518776,_0x4e7746[_0x08d7('0x3e')]);return db[_0x08d7('0x2b')][_0x08d7('0x47')](_0x518776)[_0x08d7('0x25')](handleEntityNotFound(_0x9e29a2,null))['then'](respondWithResult(_0x9e29a2,null))['catch'](handleError(_0x9e29a2,null));};exports[_0x08d7('0x48')]=function(_0x26bb9e,_0x19459b){return db[_0x08d7('0x2b')][_0x08d7('0x48')](_0x26bb9e[_0x08d7('0x49')],{})[_0x08d7('0x25')](respondWithResult(_0x19459b,0xc9))[_0x08d7('0x43')](handleError(_0x19459b,null));};exports[_0x08d7('0x4a')]=function(_0x5c1387,_0x4785c1){if(_0x5c1387[_0x08d7('0x49')]['id']){delete _0x5c1387[_0x08d7('0x49')]['id'];}return db['ZendeskConfiguration']['find']({'where':{'id':_0x5c1387[_0x08d7('0x45')]['id']}})['then'](handleEntityNotFound(_0x4785c1,null))[_0x08d7('0x25')](saveUpdates(_0x5c1387[_0x08d7('0x49')],null))['then'](respondWithResult(_0x4785c1,null))[_0x08d7('0x43')](handleError(_0x4785c1,null));};exports[_0x08d7('0x26')]=function(_0x175e39,_0x4ba79b){return db[_0x08d7('0x2b')][_0x08d7('0x47')]({'where':{'id':_0x175e39[_0x08d7('0x45')]['id']}})['then'](handleEntityNotFound(_0x4ba79b,null))['then'](removeEntity(_0x4ba79b,null))[_0x08d7('0x43')](handleError(_0x4ba79b,null));};exports[_0x08d7('0x4b')]=function(_0x48d53e,_0x47239b,_0x27e280){var _0x73eb28={};var _0x4a477d={};var _0x11394e;var _0x417e7e;return db[_0x08d7('0x2b')]['findOne']({'where':{'id':_0x48d53e[_0x08d7('0x45')]['id']}})['then'](handleEntityNotFound(_0x47239b,null))[_0x08d7('0x25')](function(_0x59bc85){if(_0x59bc85){_0x11394e=_0x59bc85;_0x4a477d[_0x08d7('0x2f')]=_[_0x08d7('0x30')](db[_0x08d7('0x4c')][_0x08d7('0x2c')]);_0x4a477d[_0x08d7('0x31')]=_['keys'](_0x48d53e['query']);_0x4a477d[_0x08d7('0x32')]=_[_0x08d7('0x33')](_0x4a477d[_0x08d7('0x2f')],_0x4a477d[_0x08d7('0x31')]);_0x73eb28[_0x08d7('0x34')]=_[_0x08d7('0x33')](_0x4a477d[_0x08d7('0x2f')],qs[_0x08d7('0x35')](_0x48d53e[_0x08d7('0x31')][_0x08d7('0x35')]));_0x73eb28['attributes']=_0x73eb28[_0x08d7('0x34')][_0x08d7('0x46')]?_0x73eb28[_0x08d7('0x34')]:_0x4a477d[_0x08d7('0x2f')];_0x73eb28[_0x08d7('0x38')]=qs['sort'](_0x48d53e[_0x08d7('0x31')][_0x08d7('0x39')]);_0x73eb28['where']=qs[_0x08d7('0x32')](_['pick'](_0x48d53e['query'],_0x4a477d[_0x08d7('0x32')]));if(_0x48d53e['query'][_0x08d7('0x3b')]){_0x73eb28[_0x08d7('0x3c')]=_[_0x08d7('0x3d')](_0x73eb28[_0x08d7('0x3c')],{'$or':_[_0x08d7('0x2a')](_0x73eb28[_0x08d7('0x34')],function(_0x4af360){var _0x3de235={};_0x3de235[_0x4af360]={'$like':'%'+_0x48d53e[_0x08d7('0x31')][_0x08d7('0x3b')]+'%'};return _0x3de235;})});}_0x73eb28=_[_0x08d7('0x3d')]({},_0x73eb28,_0x48d53e['options']);return _0x11394e[_0x08d7('0x4b')](_0x73eb28);}})[_0x08d7('0x25')](function(_0x3142ab){if(_0x3142ab){_0x417e7e=_0x3142ab[_0x08d7('0x46')];if(!_0x48d53e['query'][_0x08d7('0x36')](_0x08d7('0x37'))){_0x73eb28[_0x08d7('0x1e')]=qs[_0x08d7('0x1e')](_0x48d53e[_0x08d7('0x31')][_0x08d7('0x1e')]);_0x73eb28[_0x08d7('0x20')]=qs['offset'](_0x48d53e[_0x08d7('0x31')]['offset']);}return _0x11394e[_0x08d7('0x4b')](_0x73eb28);}})[_0x08d7('0x25')](function(_0x237db1){if(_0x237db1){return _0x237db1?{'count':_0x417e7e,'rows':_0x237db1}:null;}})[_0x08d7('0x25')](respondWithResult(_0x47239b,null))[_0x08d7('0x43')](handleError(_0x47239b,null));};exports['getSubjects']=function(_0x128d8f,_0x4f91f3,_0xf6e31e){var _0x32db3f={};var _0x3432a4={};var _0x4d9903;var _0x55db32;return db[_0x08d7('0x2b')][_0x08d7('0x4d')]({'where':{'id':_0x128d8f[_0x08d7('0x45')]['id']}})['then'](handleEntityNotFound(_0x4f91f3,null))['then'](function(_0x30f21b){if(_0x30f21b){_0x4d9903=_0x30f21b;_0x3432a4[_0x08d7('0x2f')]=_[_0x08d7('0x30')](db[_0x08d7('0x4c')][_0x08d7('0x2c')]);_0x3432a4[_0x08d7('0x31')]=_[_0x08d7('0x30')](_0x128d8f[_0x08d7('0x31')]);_0x3432a4['filters']=_[_0x08d7('0x33')](_0x3432a4[_0x08d7('0x2f')],_0x3432a4[_0x08d7('0x31')]);_0x32db3f[_0x08d7('0x34')]=_[_0x08d7('0x33')](_0x3432a4['model'],qs[_0x08d7('0x35')](_0x128d8f[_0x08d7('0x31')][_0x08d7('0x35')]));_0x32db3f['attributes']=_0x32db3f['attributes'][_0x08d7('0x46')]?_0x32db3f[_0x08d7('0x34')]:_0x3432a4[_0x08d7('0x2f')];_0x32db3f[_0x08d7('0x38')]=qs[_0x08d7('0x39')](_0x128d8f[_0x08d7('0x31')]['sort']);_0x32db3f['where']=qs[_0x08d7('0x32')](_[_0x08d7('0x3a')](_0x128d8f[_0x08d7('0x31')],_0x3432a4[_0x08d7('0x32')]));if(_0x128d8f[_0x08d7('0x31')][_0x08d7('0x3b')]){_0x32db3f[_0x08d7('0x3c')]=_[_0x08d7('0x3d')](_0x32db3f[_0x08d7('0x3c')],{'$or':_[_0x08d7('0x2a')](_0x32db3f['attributes'],function(_0x420176){var _0x1c3a4f={};_0x1c3a4f[_0x420176]={'$like':'%'+_0x128d8f[_0x08d7('0x31')]['filter']+'%'};return _0x1c3a4f;})});}_0x32db3f=_[_0x08d7('0x3d')]({},_0x32db3f,_0x128d8f[_0x08d7('0x3e')]);return _0x4d9903[_0x08d7('0x4e')](_0x32db3f);}})[_0x08d7('0x25')](function(_0x1e79cb){if(_0x1e79cb){_0x55db32=_0x1e79cb[_0x08d7('0x46')];if(!_0x128d8f['query'][_0x08d7('0x36')](_0x08d7('0x37'))){_0x32db3f['limit']=qs[_0x08d7('0x1e')](_0x128d8f[_0x08d7('0x31')][_0x08d7('0x1e')]);_0x32db3f[_0x08d7('0x20')]=qs[_0x08d7('0x20')](_0x128d8f['query'][_0x08d7('0x20')]);}return _0x4d9903[_0x08d7('0x4e')](_0x32db3f);}})[_0x08d7('0x25')](function(_0x5a74bc){if(_0x5a74bc){return _0x5a74bc?{'count':_0x55db32,'rows':_0x5a74bc}:null;}})[_0x08d7('0x25')](respondWithResult(_0x4f91f3,null))[_0x08d7('0x43')](handleError(_0x4f91f3,null));};exports[_0x08d7('0x4f')]=function(_0x5e0e7b,_0x2218dc,_0x4072ef){var _0x1aaf14={};var _0x1a3539={};var _0x457483;var _0x554d9b;return db[_0x08d7('0x2b')][_0x08d7('0x4d')]({'where':{'id':_0x5e0e7b[_0x08d7('0x45')]['id']}})[_0x08d7('0x25')](handleEntityNotFound(_0x2218dc,null))['then'](function(_0x5bdf6d){if(_0x5bdf6d){_0x457483=_0x5bdf6d;_0x1a3539[_0x08d7('0x2f')]=_[_0x08d7('0x30')](db[_0x08d7('0x4c')][_0x08d7('0x2c')]);_0x1a3539[_0x08d7('0x31')]=_[_0x08d7('0x30')](_0x5e0e7b[_0x08d7('0x31')]);_0x1a3539['filters']=_[_0x08d7('0x33')](_0x1a3539[_0x08d7('0x2f')],_0x1a3539['query']);_0x1aaf14[_0x08d7('0x34')]=_[_0x08d7('0x33')](_0x1a3539['model'],qs['fields'](_0x5e0e7b[_0x08d7('0x31')][_0x08d7('0x35')]));_0x1aaf14['attributes']=_0x1aaf14['attributes'][_0x08d7('0x46')]?_0x1aaf14[_0x08d7('0x34')]:_0x1a3539['model'];_0x1aaf14[_0x08d7('0x38')]=qs[_0x08d7('0x39')](_0x5e0e7b['query'][_0x08d7('0x39')]);_0x1aaf14[_0x08d7('0x3c')]=qs[_0x08d7('0x32')](_[_0x08d7('0x3a')](_0x5e0e7b['query'],_0x1a3539[_0x08d7('0x32')]));if(_0x5e0e7b[_0x08d7('0x31')][_0x08d7('0x3b')]){_0x1aaf14[_0x08d7('0x3c')]=_['merge'](_0x1aaf14[_0x08d7('0x3c')],{'$or':_[_0x08d7('0x2a')](_0x1aaf14[_0x08d7('0x34')],function(_0xd72de3){var _0x2e8ad2={};_0x2e8ad2[_0xd72de3]={'$like':'%'+_0x5e0e7b[_0x08d7('0x31')][_0x08d7('0x3b')]+'%'};return _0x2e8ad2;})});}_0x1aaf14=_[_0x08d7('0x3d')]({},_0x1aaf14,_0x5e0e7b[_0x08d7('0x3e')]);return _0x457483[_0x08d7('0x4f')](_0x1aaf14);}})['then'](function(_0x3f352f){if(_0x3f352f){_0x554d9b=_0x3f352f[_0x08d7('0x46')];if(!_0x5e0e7b[_0x08d7('0x31')][_0x08d7('0x36')]('nolimit')){_0x1aaf14['limit']=qs[_0x08d7('0x1e')](_0x5e0e7b['query'][_0x08d7('0x1e')]);_0x1aaf14[_0x08d7('0x20')]=qs[_0x08d7('0x20')](_0x5e0e7b[_0x08d7('0x31')]['offset']);}return _0x457483[_0x08d7('0x4f')](_0x1aaf14);}})[_0x08d7('0x25')](function(_0x11345f){if(_0x11345f){return _0x11345f?{'count':_0x554d9b,'rows':_0x11345f}:null;}})['then'](respondWithResult(_0x2218dc,null))[_0x08d7('0x43')](handleError(_0x2218dc,null));};exports[_0x08d7('0x50')]=function(_0x30a33f,_0x4c9f2b,_0x2f2664){var _0x57d4df={};var _0x292806={};var _0x50a882;var _0x48a2a9;return db[_0x08d7('0x2b')]['findOne']({'where':{'id':_0x30a33f[_0x08d7('0x45')]['id']}})[_0x08d7('0x25')](handleEntityNotFound(_0x4c9f2b,null))[_0x08d7('0x25')](function(_0x189bb1){if(_0x189bb1){_0x50a882=_0x189bb1;_0x292806[_0x08d7('0x2f')]=_[_0x08d7('0x30')](db[_0x08d7('0x51')]['rawAttributes']);_0x292806[_0x08d7('0x31')]=_['keys'](_0x30a33f[_0x08d7('0x31')]);_0x292806['filters']=_[_0x08d7('0x33')](_0x292806['model'],_0x292806[_0x08d7('0x31')]);_0x57d4df[_0x08d7('0x34')]=_['intersection'](_0x292806[_0x08d7('0x2f')],qs[_0x08d7('0x35')](_0x30a33f[_0x08d7('0x31')][_0x08d7('0x35')]));_0x57d4df[_0x08d7('0x34')]=_0x57d4df['attributes'][_0x08d7('0x46')]?_0x57d4df[_0x08d7('0x34')]:_0x292806['model'];_0x57d4df[_0x08d7('0x38')]=qs['sort'](_0x30a33f[_0x08d7('0x31')][_0x08d7('0x39')]);_0x57d4df[_0x08d7('0x3c')]=qs[_0x08d7('0x32')](_['pick'](_0x30a33f['query'],_0x292806[_0x08d7('0x32')]));if(_0x30a33f[_0x08d7('0x31')][_0x08d7('0x3b')]){_0x57d4df['where']=_[_0x08d7('0x3d')](_0x57d4df[_0x08d7('0x3c')],{'$or':_[_0x08d7('0x2a')](_0x57d4df[_0x08d7('0x34')],function(_0x759212){var _0x70193e={};_0x70193e[_0x759212]={'$like':'%'+_0x30a33f[_0x08d7('0x31')][_0x08d7('0x3b')]+'%'};return _0x70193e;})});}_0x57d4df=_[_0x08d7('0x3d')]({},_0x57d4df,_0x30a33f['options']);return _0x50a882['getTags'](_0x57d4df);}})[_0x08d7('0x25')](function(_0x527425){if(_0x527425){_0x48a2a9=_0x527425[_0x08d7('0x46')];if(!_0x30a33f[_0x08d7('0x31')][_0x08d7('0x36')](_0x08d7('0x37'))){_0x57d4df[_0x08d7('0x1e')]=qs['limit'](_0x30a33f[_0x08d7('0x31')]['limit']);_0x57d4df[_0x08d7('0x20')]=qs[_0x08d7('0x20')](_0x30a33f[_0x08d7('0x31')]['offset']);}return _0x50a882[_0x08d7('0x50')](_0x57d4df);}})[_0x08d7('0x25')](function(_0xe604c4){if(_0xe604c4){return _0xe604c4?{'count':_0x48a2a9,'rows':_0xe604c4}:null;}})[_0x08d7('0x25')](respondWithResult(_0x4c9f2b,null))['catch'](handleError(_0x4c9f2b,null));};exports[_0x08d7('0x52')]=function(_0x191d39,_0x2da0af,_0x1484ce){if(_0x191d39[_0x08d7('0x49')]['id']){delete _0x191d39[_0x08d7('0x49')]['id'];}return db[_0x08d7('0x2b')][_0x08d7('0x4d')]({'where':{'id':_0x191d39[_0x08d7('0x45')]['id']}})[_0x08d7('0x25')](handleEntityNotFound(_0x2da0af,null))[_0x08d7('0x25')](function(_0x566972){if(_0x566972){return _0x566972[_0x08d7('0x52')](_0x191d39['body'][_0x08d7('0x53')]||[]);}return null;})[_0x08d7('0x25')](respondWithResult(_0x2da0af,null))['catch'](handleError(_0x2da0af,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index d8a316a..de327c2 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 _0x757a=['define','int_zendesk_configurations','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./intZendeskConfiguration.attributes','exports'];(function(_0xab58e1,_0x5d47ce){var _0x295351=function(_0x43f2a7){while(--_0x43f2a7){_0xab58e1['push'](_0xab58e1['shift']());}};_0x295351(++_0x5d47ce);}(_0x757a,0xde));var _0xa757=function(_0x25d24c,_0x13b0bd){_0x25d24c=_0x25d24c-0x0;var _0x5ba2aa=_0x757a[_0x25d24c];return _0x5ba2aa;};'use strict';var _=require('lodash');var util=require(_0xa757('0x0'));var logger=require(_0xa757('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa757('0x2'));var fs=require('fs');var path=require(_0xa757('0x3'));var rimraf=require(_0xa757('0x4'));var config=require(_0xa757('0x5'));var attributes=require(_0xa757('0x6'));module[_0xa757('0x7')]=function(_0x5edca8,_0xae0e7c){return _0x5edca8[_0xa757('0x8')]('ZendeskConfiguration',attributes,{'tableName':_0xa757('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xefda=['../../config/environment','./intZendeskConfiguration.attributes','exports','define','ZendeskConfiguration','int_zendesk_configurations','lodash','api','moment','request-promise','path','rimraf'];(function(_0xb213ec,_0x3f9aec){var _0x55e3c5=function(_0x1ae5a5){while(--_0x1ae5a5){_0xb213ec['push'](_0xb213ec['shift']());}};_0x55e3c5(++_0x3f9aec);}(_0xefda,0x96));var _0xaefd=function(_0x514ef1,_0x5d5cb1){_0x514ef1=_0x514ef1-0x0;var _0x3f5790=_0xefda[_0x514ef1];return _0x3f5790;};'use strict';var _=require(_0xaefd('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xaefd('0x1'));var moment=require(_0xaefd('0x2'));var BPromise=require('bluebird');var rp=require(_0xaefd('0x3'));var fs=require('fs');var path=require(_0xaefd('0x4'));var rimraf=require(_0xaefd('0x5'));var config=require(_0xaefd('0x6'));var attributes=require(_0xaefd('0x7'));module[_0xaefd('0x8')]=function(_0x497258,_0x3677ea){return _0x497258[_0xaefd('0x9')](_0xaefd('0xa'),attributes,{'tableName':_0xaefd('0xb'),'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 07e5f87..96a391c 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 _0x7e71=['client','http','request','then','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','error','ZendeskConfiguration,\x20%s,\x20%s','message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x39469e,_0x34b25f){var _0x1c3c46=function(_0x1af337){while(--_0x1af337){_0x39469e['push'](_0x39469e['shift']());}};_0x1c3c46(++_0x34b25f);}(_0x7e71,0x131));var _0x17e7=function(_0x252328,_0x4c22f0){_0x252328=_0x252328-0x0;var _0xaa85b7=_0x7e71[_0x252328];return _0xaa85b7;};'use strict';var _=require(_0x17e7('0x0'));var util=require(_0x17e7('0x1'));var moment=require(_0x17e7('0x2'));var BPromise=require(_0x17e7('0x3'));var rs=require(_0x17e7('0x4'));var fs=require('fs');var Redis=require(_0x17e7('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x17e7('0x6'));var logger=require(_0x17e7('0x7'))(_0x17e7('0x8'));var config=require('../../config/environment');var jayson=require(_0x17e7('0x9'));var client=jayson[_0x17e7('0xa')][_0x17e7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xf10682,_0x3d24b8,_0x2d56f5){return new BPromise(function(_0x2ef707,_0x15cba5){return client[_0x17e7('0xc')](_0xf10682,_0x2d56f5)[_0x17e7('0xd')](function(_0x783ca8){logger['info']('ZendeskConfiguration,\x20%s,\x20%s',_0x3d24b8,'request\x20sent');logger[_0x17e7('0xe')](_0x17e7('0xf'),_0x3d24b8,'request\x20sent',JSON['stringify'](_0x783ca8));if(_0x783ca8[_0x17e7('0x10')]){if(_0x783ca8[_0x17e7('0x10')]['code']===0x1f4){logger['error'](_0x17e7('0x11'),_0x3d24b8,_0x783ca8[_0x17e7('0x10')]['message']);return _0x15cba5(_0x783ca8[_0x17e7('0x10')]['message']);}logger[_0x17e7('0x10')](_0x17e7('0x11'),_0x3d24b8,_0x783ca8[_0x17e7('0x10')][_0x17e7('0x12')]);return _0x2ef707(_0x783ca8[_0x17e7('0x10')][_0x17e7('0x12')]);}else{logger[_0x17e7('0x13')]('ZendeskConfiguration,\x20%s,\x20%s',_0x3d24b8,'request\x20sent');_0x2ef707(_0x783ca8['result'][_0x17e7('0x12')]);}})[_0x17e7('0x14')](function(_0x40876a){logger[_0x17e7('0x10')](_0x17e7('0x11'),_0x3d24b8,_0x40876a);_0x15cba5(_0x40876a);});});} \ No newline at end of file +var _0xc8eb=['ZendeskConfiguration,\x20%s,\x20%s','message','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x35da7f,_0x119087){var _0x3b18f2=function(_0x5d8c62){while(--_0x5d8c62){_0x35da7f['push'](_0x35da7f['shift']());}};_0x3b18f2(++_0x119087);}(_0xc8eb,0x137));var _0xbc8e=function(_0x20beae,_0x5eac6d){_0x20beae=_0x20beae-0x0;var _0xf5725=_0xc8eb[_0x20beae];return _0xf5725;};'use strict';var _=require('lodash');var util=require(_0xbc8e('0x0'));var moment=require('moment');var BPromise=require(_0xbc8e('0x1'));var rs=require(_0xbc8e('0x2'));var fs=require('fs');var Redis=require(_0xbc8e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xbc8e('0x4'));var logger=require(_0xbc8e('0x5'))('rpc');var config=require(_0xbc8e('0x6'));var jayson=require(_0xbc8e('0x7'));var client=jayson[_0xbc8e('0x8')][_0xbc8e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x10200b,_0x1d1a81,_0x32e510){return new BPromise(function(_0x373734,_0x31a40c){return client[_0xbc8e('0xa')](_0x10200b,_0x32e510)[_0xbc8e('0xb')](function(_0x87235a){logger[_0xbc8e('0xc')]('ZendeskConfiguration,\x20%s,\x20%s',_0x1d1a81,'request\x20sent');logger[_0xbc8e('0xd')](_0xbc8e('0xe'),_0x1d1a81,_0xbc8e('0xf'),JSON[_0xbc8e('0x10')](_0x87235a));if(_0x87235a[_0xbc8e('0x11')]){if(_0x87235a[_0xbc8e('0x11')][_0xbc8e('0x12')]===0x1f4){logger[_0xbc8e('0x11')](_0xbc8e('0x13'),_0x1d1a81,_0x87235a[_0xbc8e('0x11')]['message']);return _0x31a40c(_0x87235a[_0xbc8e('0x11')][_0xbc8e('0x14')]);}logger[_0xbc8e('0x11')](_0xbc8e('0x13'),_0x1d1a81,_0x87235a[_0xbc8e('0x11')][_0xbc8e('0x14')]);return _0x373734(_0x87235a[_0xbc8e('0x11')][_0xbc8e('0x14')]);}else{logger['info'](_0xbc8e('0x13'),_0x1d1a81,_0xbc8e('0xf'));_0x373734(_0x87235a['result']['message']);}})[_0xbc8e('0x15')](function(_0x59f238){logger[_0xbc8e('0x11')](_0xbc8e('0x13'),_0x1d1a81,_0x59f238);_0x31a40c(_0x59f238);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index 94dbd0f..1dbcf3c 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 _0x2985=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intZendeskField.controller','index','get','/:id','isAuthenticated','create','update','delete','destroy','multer','util','path'];(function(_0x1e1a55,_0x46c9f0){var _0x454435=function(_0x3a0ec0){while(--_0x3a0ec0){_0x1e1a55['push'](_0x1e1a55['shift']());}};_0x454435(++_0x46c9f0);}(_0x2985,0x8d));var _0x5298=function(_0x3fd905,_0x250850){_0x3fd905=_0x3fd905-0x0;var _0x3dc65c=_0x2985[_0x3fd905];return _0x3dc65c;};'use strict';var multer=require(_0x5298('0x0'));var util=require(_0x5298('0x1'));var path=require(_0x5298('0x2'));var timeout=require(_0x5298('0x3'));var express=require(_0x5298('0x4'));var router=express[_0x5298('0x5')]();var fs_extra=require(_0x5298('0x6'));var auth=require(_0x5298('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x5298('0x8'));var controller=require(_0x5298('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x5298('0xa')]);router[_0x5298('0xb')](_0x5298('0xc'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x5298('0xd')](),controller[_0x5298('0xe')]);router['put'](_0x5298('0xc'),auth['isAuthenticated'](),controller[_0x5298('0xf')]);router[_0x5298('0x10')]('/:id',auth[_0x5298('0xd')](),controller[_0x5298('0x11')]);module['exports']=router; \ No newline at end of file +var _0xac2d=['post','isAuthenticated','create','/:id','update','delete','destroy','exports','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','show'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xac2d,0x86));var _0xdac2=function(_0x2c9d67,_0x4e888c){_0x2c9d67=_0x2c9d67-0x0;var _0x180833=_0xac2d[_0x2c9d67];return _0x180833;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xdac2('0x0'));var timeout=require(_0xdac2('0x1'));var express=require('express');var router=express[_0xdac2('0x2')]();var fs_extra=require(_0xdac2('0x3'));var auth=require(_0xdac2('0x4'));var interaction=require(_0xdac2('0x5'));var config=require(_0xdac2('0x6'));var controller=require('./intZendeskField.controller');router[_0xdac2('0x7')]('/',auth['isAuthenticated'](),controller[_0xdac2('0x8')]);router[_0xdac2('0x7')]('/:id',auth['isAuthenticated'](),controller[_0xdac2('0x9')]);router[_0xdac2('0xa')]('/',auth[_0xdac2('0xb')](),controller[_0xdac2('0xc')]);router['put'](_0xdac2('0xd'),auth[_0xdac2('0xb')](),controller[_0xdac2('0xe')]);router[_0xdac2('0xf')](_0xdac2('0xd'),auth['isAuthenticated'](),controller[_0xdac2('0x10')]);module[_0xdac2('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 19f13f6..cd957a5 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 _0x0b73=['string','variable','customVariable','STRING','BOOLEAN','exports','ENUM'];(function(_0x1d1eec,_0x259cac){var _0xff16bb=function(_0x409510){while(--_0x409510){_0x1d1eec['push'](_0x1d1eec['shift']());}};_0xff16bb(++_0x259cac);}(_0x0b73,0x108));var _0x30b7=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0x0b73[_0x36eaaa];return _0x461349;};'use strict';var Sequelize=require('sequelize');module[_0x30b7('0x0')]={'type':{'type':Sequelize[_0x30b7('0x1')](_0x30b7('0x2'),_0x30b7('0x3'),_0x30b7('0x4'),'keyValue','picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0x30b7('0x5')]},'key':{'type':Sequelize[_0x30b7('0x5')]},'keyType':{'type':Sequelize[_0x30b7('0x1')](_0x30b7('0x2'),_0x30b7('0x3'),_0x30b7('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x30b7('0x5')]},'nameField':{'type':Sequelize[_0x30b7('0x5')]},'customField':{'type':Sequelize[_0x30b7('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x30b7('0x5')]}}; \ No newline at end of file +var _0x14fd=['customVariable','keyValue','picklist','STRING','ENUM','sequelize','exports','string','variable'];(function(_0x1d50f2,_0x3c3ec6){var _0x3769b8=function(_0x50926a){while(--_0x50926a){_0x1d50f2['push'](_0x1d50f2['shift']());}};_0x3769b8(++_0x3c3ec6);}(_0x14fd,0x19a));var _0xd14f=function(_0x430572,_0xa2506e){_0x430572=_0x430572-0x0;var _0x1fbde3=_0x14fd[_0x430572];return _0x1fbde3;};'use strict';var Sequelize=require(_0xd14f('0x0'));module[_0xd14f('0x1')]={'type':{'type':Sequelize['ENUM'](_0xd14f('0x2'),_0xd14f('0x3'),_0xd14f('0x4'),_0xd14f('0x5'),_0xd14f('0x6')),'defaultValue':_0xd14f('0x2')},'content':{'type':Sequelize[_0xd14f('0x7')]},'key':{'type':Sequelize[_0xd14f('0x7')]},'keyType':{'type':Sequelize[_0xd14f('0x8')]('string','variable',_0xd14f('0x4'))},'keyContent':{'type':Sequelize[_0xd14f('0x7')]},'idField':{'type':Sequelize[_0xd14f('0x7')]},'nameField':{'type':Sequelize[_0xd14f('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index 1212e5b..9e79172 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 _0xc130=['ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','status','end','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','ZendeskField','rawAttributes','fieldName','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','type','VIRTUAL','includeAll','include','rows','catch','show','params','keys','merge','options','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','lodash','squel','crypto','desk.js','papaparse'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xc130,0x115));var _0x0c13=function(_0x38c27a,_0x54cc58){_0x38c27a=_0x38c27a-0x0;var _0x4c9db4=_0xc130[_0x38c27a];return _0x4c9db4;};'use strict';var emlformat=require(_0x0c13('0x0'));var rimraf=require(_0x0c13('0x1'));var zipdir=require(_0x0c13('0x2'));var jsonpatch=require(_0x0c13('0x3'));var rp=require(_0x0c13('0x4'));var moment=require(_0x0c13('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x0c13('0x6'));var util=require(_0x0c13('0x7'));var path=require('path');var sox=require(_0x0c13('0x8'));var csv=require(_0x0c13('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0c13('0xa'));var squel=require(_0x0c13('0xb'));var crypto=require(_0x0c13('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x0c13('0xd'));var toCsv=require(_0x0c13('0x9'));var querystring=require('querystring');var Papa=require(_0x0c13('0xe'));var Redis=require(_0x0c13('0xf'));var authService=require(_0x0c13('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x0c13('0x11'));var hardwareService=require(_0x0c13('0x12'));var logger=require(_0x0c13('0x13'))(_0x0c13('0x14'));var utils=require('../../config/utils');var config=require(_0x0c13('0x15'));var licenseUtil=require(_0x0c13('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xb4d472,_0x326995){_0x326995=_0x326995||0xcc;return function(_0xfe6857){if(_0xfe6857){return _0xb4d472['sendStatus'](_0x326995);}return _0xb4d472[_0x0c13('0x17')](_0x326995)[_0x0c13('0x18')]();};}function respondWithResult(_0x59781f,_0x3b0031){_0x3b0031=_0x3b0031||0xc8;return function(_0x571027){if(_0x571027){return _0x59781f['status'](_0x3b0031)['json'](_0x571027);}};}function respondWithFilteredResult(_0x4da34f,_0x1002f8){return function(_0x370907){if(_0x370907){var _0x211938=typeof _0x1002f8['offset']===_0x0c13('0x19')&&typeof _0x1002f8[_0x0c13('0x1a')]===_0x0c13('0x19');var _0xb722b8=_0x370907[_0x0c13('0x1b')];var _0x2250b4=_0x211938?0x0:_0x1002f8[_0x0c13('0x1c')];var _0xaf865a=_0x211938?_0x370907[_0x0c13('0x1b')]:_0x1002f8[_0x0c13('0x1c')]+_0x1002f8[_0x0c13('0x1a')];var _0x4a6782;if(_0xaf865a>=_0xb722b8){_0xaf865a=_0xb722b8;_0x4a6782=0xc8;}else{_0x4a6782=0xce;}_0x4da34f[_0x0c13('0x17')](_0x4a6782);return _0x4da34f[_0x0c13('0x1d')](_0x0c13('0x1e'),_0x2250b4+'-'+_0xaf865a+'/'+_0xb722b8)['json'](_0x370907);}return null;};}function patchUpdates(_0x478270){return function(_0x21c36d){try{jsonpatch[_0x0c13('0x1f')](_0x21c36d,_0x478270,!![]);}catch(_0x4eafb1){return BPromise[_0x0c13('0x20')](_0x4eafb1);}return _0x21c36d[_0x0c13('0x21')]();};}function saveUpdates(_0x33297e,_0x33b4f8){return function(_0x911eff){if(_0x911eff){return _0x911eff[_0x0c13('0x22')](_0x33297e)[_0x0c13('0x23')](function(_0x3cdfb0){return _0x3cdfb0;});}return null;};}function removeEntity(_0x6252e4,_0x3abf8f){return function(_0x1c5aea){if(_0x1c5aea){return _0x1c5aea['destroy']()[_0x0c13('0x23')](function(){_0x6252e4[_0x0c13('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x45cbe4,_0x1cfc8b){return function(_0x424bcd){if(!_0x424bcd){_0x45cbe4['sendStatus'](0x194);}return _0x424bcd;};}function handleError(_0x16a158,_0x203bf9){_0x203bf9=_0x203bf9||0x1f4;return function(_0x272d0e){logger[_0x0c13('0x24')](_0x272d0e[_0x0c13('0x25')]);if(_0x272d0e[_0x0c13('0x26')]){delete _0x272d0e[_0x0c13('0x26')];}_0x16a158[_0x0c13('0x17')](_0x203bf9)[_0x0c13('0x27')](_0x272d0e);};}exports[_0x0c13('0x28')]=function(_0x3924ab,_0x54a770){var _0x4830c8={},_0x58af58={},_0x13d672={'count':0x0,'rows':[]};var _0x5bfb0e=_[_0x0c13('0x29')](db[_0x0c13('0x2a')][_0x0c13('0x2b')],function(_0x5928af){return{'name':_0x5928af[_0x0c13('0x2c')],'type':_0x5928af['type'][_0x0c13('0x2d')]};});_0x58af58[_0x0c13('0x2e')]=_[_0x0c13('0x29')](_0x5bfb0e,_0x0c13('0x26'));_0x58af58[_0x0c13('0x2f')]=_['keys'](_0x3924ab['query']);_0x58af58[_0x0c13('0x30')]=_[_0x0c13('0x31')](_0x58af58[_0x0c13('0x2e')],_0x58af58[_0x0c13('0x2f')]);_0x4830c8['attributes']=_[_0x0c13('0x31')](_0x58af58[_0x0c13('0x2e')],qs[_0x0c13('0x32')](_0x3924ab[_0x0c13('0x2f')][_0x0c13('0x32')]));_0x4830c8[_0x0c13('0x33')]=_0x4830c8[_0x0c13('0x33')][_0x0c13('0x34')]?_0x4830c8[_0x0c13('0x33')]:_0x58af58[_0x0c13('0x2e')];if(!_0x3924ab['query'][_0x0c13('0x35')](_0x0c13('0x36'))){_0x4830c8['limit']=qs[_0x0c13('0x1a')](_0x3924ab[_0x0c13('0x2f')][_0x0c13('0x1a')]);_0x4830c8[_0x0c13('0x1c')]=qs[_0x0c13('0x1c')](_0x3924ab[_0x0c13('0x2f')][_0x0c13('0x1c')]);}_0x4830c8[_0x0c13('0x37')]=qs[_0x0c13('0x38')](_0x3924ab[_0x0c13('0x2f')][_0x0c13('0x38')]);_0x4830c8[_0x0c13('0x39')]=qs['filters'](_['pick'](_0x3924ab[_0x0c13('0x2f')],_0x58af58[_0x0c13('0x30')]),_0x5bfb0e);if(_0x3924ab[_0x0c13('0x2f')][_0x0c13('0x3a')]){_0x4830c8[_0x0c13('0x39')]=_['merge'](_0x4830c8[_0x0c13('0x39')],{'$or':_[_0x0c13('0x29')](_0x5bfb0e,function(_0xceb189){if(_0xceb189[_0x0c13('0x3b')]!==_0x0c13('0x3c')){var _0x518bfc={};_0x518bfc[_0xceb189[_0x0c13('0x26')]]={'$like':'%'+_0x3924ab[_0x0c13('0x2f')][_0x0c13('0x3a')]+'%'};return _0x518bfc;}})});}_0x4830c8=_['merge']({},_0x4830c8,_0x3924ab['options']);var _0x50b399={'where':_0x4830c8['where']};return db[_0x0c13('0x2a')][_0x0c13('0x1b')](_0x50b399)[_0x0c13('0x23')](function(_0x3afaef){_0x13d672[_0x0c13('0x1b')]=_0x3afaef;if(_0x3924ab[_0x0c13('0x2f')][_0x0c13('0x3d')]){_0x4830c8[_0x0c13('0x3e')]=[{'all':!![]}];}return db['ZendeskField']['findAll'](_0x4830c8);})[_0x0c13('0x23')](function(_0x381a2b){_0x13d672[_0x0c13('0x3f')]=_0x381a2b;return _0x13d672;})['then'](respondWithFilteredResult(_0x54a770,_0x4830c8))[_0x0c13('0x40')](handleError(_0x54a770,null));};exports[_0x0c13('0x41')]=function(_0x407677,_0x48adcf){var _0x113e33={'raw':!![],'where':{'id':_0x407677[_0x0c13('0x42')]['id']}},_0x5a74db={};_0x5a74db[_0x0c13('0x2e')]=_['keys'](db[_0x0c13('0x2a')][_0x0c13('0x2b')]);_0x5a74db[_0x0c13('0x2f')]=_[_0x0c13('0x43')](_0x407677[_0x0c13('0x2f')]);_0x5a74db[_0x0c13('0x30')]=_[_0x0c13('0x31')](_0x5a74db['model'],_0x5a74db[_0x0c13('0x2f')]);_0x113e33[_0x0c13('0x33')]=_['intersection'](_0x5a74db[_0x0c13('0x2e')],qs[_0x0c13('0x32')](_0x407677['query']['fields']));_0x113e33[_0x0c13('0x33')]=_0x113e33[_0x0c13('0x33')][_0x0c13('0x34')]?_0x113e33[_0x0c13('0x33')]:_0x5a74db[_0x0c13('0x2e')];if(_0x407677[_0x0c13('0x2f')][_0x0c13('0x3d')]){_0x113e33['include']=[{'all':!![]}];}_0x113e33=_[_0x0c13('0x44')]({},_0x113e33,_0x407677[_0x0c13('0x45')]);return db['ZendeskField'][_0x0c13('0x46')](_0x113e33)[_0x0c13('0x23')](handleEntityNotFound(_0x48adcf,null))[_0x0c13('0x23')](respondWithResult(_0x48adcf,null))[_0x0c13('0x40')](handleError(_0x48adcf,null));};exports[_0x0c13('0x47')]=function(_0x4fa338,_0x17e175){return db['ZendeskField']['create'](_0x4fa338['body'],{})[_0x0c13('0x23')](respondWithResult(_0x17e175,0xc9))['catch'](handleError(_0x17e175,null));};exports[_0x0c13('0x22')]=function(_0xcc7265,_0x58a8a3){if(_0xcc7265['body']['id']){delete _0xcc7265[_0x0c13('0x48')]['id'];}return db[_0x0c13('0x2a')][_0x0c13('0x46')]({'where':{'id':_0xcc7265['params']['id']}})[_0x0c13('0x23')](handleEntityNotFound(_0x58a8a3,null))['then'](saveUpdates(_0xcc7265[_0x0c13('0x48')],null))['then'](respondWithResult(_0x58a8a3,null))[_0x0c13('0x40')](handleError(_0x58a8a3,null));};exports['destroy']=function(_0x52d7f5,_0x23b0be){return db[_0x0c13('0x2a')][_0x0c13('0x46')]({'where':{'id':_0x52d7f5[_0x0c13('0x42')]['id']}})[_0x0c13('0x23')](handleEntityNotFound(_0x23b0be,null))[_0x0c13('0x23')](removeEntity(_0x23b0be,null))['catch'](handleError(_0x23b0be,null));}; \ No newline at end of file +var _0x0e7a=['query','filters','model','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','include','ZendeskField','findAll','catch','show','params','keys','fields','find','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','offset','count','limit','set','Content-Range','apply','reject','update','then','error','stack','name','send','index','map','type','key'];(function(_0x3e5888,_0xc14b4c){var _0x144128=function(_0x1a17ea){while(--_0x1a17ea){_0x3e5888['push'](_0x3e5888['shift']());}};_0x144128(++_0xc14b4c);}(_0x0e7a,0xff));var _0xa0e7=function(_0xcb8b1b,_0x5e0145){_0xcb8b1b=_0xcb8b1b-0x0;var _0x155b1b=_0x0e7a[_0xcb8b1b];return _0x155b1b;};'use strict';var emlformat=require(_0xa0e7('0x0'));var rimraf=require(_0xa0e7('0x1'));var zipdir=require(_0xa0e7('0x2'));var jsonpatch=require(_0xa0e7('0x3'));var rp=require('request-promise');var moment=require(_0xa0e7('0x4'));var BPromise=require(_0xa0e7('0x5'));var Mustache=require(_0xa0e7('0x6'));var util=require(_0xa0e7('0x7'));var path=require(_0xa0e7('0x8'));var sox=require('sox');var csv=require(_0xa0e7('0x9'));var ejs=require(_0xa0e7('0xa'));var fs=require('fs');var fs_extra=require(_0xa0e7('0xb'));var _=require(_0xa0e7('0xc'));var squel=require(_0xa0e7('0xd'));var crypto=require(_0xa0e7('0xe'));var jsforce=require(_0xa0e7('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xa0e7('0x9'));var querystring=require('querystring');var Papa=require(_0xa0e7('0x10'));var Redis=require(_0xa0e7('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xa0e7('0x12'));var as=require(_0xa0e7('0x13'));var hardwareService=require(_0xa0e7('0x14'));var logger=require(_0xa0e7('0x15'))(_0xa0e7('0x16'));var utils=require(_0xa0e7('0x17'));var config=require(_0xa0e7('0x18'));var licenseUtil=require(_0xa0e7('0x19'));var db=require(_0xa0e7('0x1a'))['db'];function respondWithStatusCode(_0x17bc35,_0x49cd4b){_0x49cd4b=_0x49cd4b||0xcc;return function(_0x240f56){if(_0x240f56){return _0x17bc35[_0xa0e7('0x1b')](_0x49cd4b);}return _0x17bc35[_0xa0e7('0x1c')](_0x49cd4b)[_0xa0e7('0x1d')]();};}function respondWithResult(_0x48c1d9,_0x593205){_0x593205=_0x593205||0xc8;return function(_0x3a890b){if(_0x3a890b){return _0x48c1d9[_0xa0e7('0x1c')](_0x593205)[_0xa0e7('0x1e')](_0x3a890b);}};}function respondWithFilteredResult(_0x1f2574,_0x406541){return function(_0x22852b){if(_0x22852b){var _0x36dd93=typeof _0x406541['offset']===_0xa0e7('0x1f')&&typeof _0x406541['limit']===_0xa0e7('0x1f');var _0x57dad2=_0x22852b['count'];var _0x4358b0=_0x36dd93?0x0:_0x406541[_0xa0e7('0x20')];var _0xd15ec2=_0x36dd93?_0x22852b[_0xa0e7('0x21')]:_0x406541[_0xa0e7('0x20')]+_0x406541[_0xa0e7('0x22')];var _0x131126;if(_0xd15ec2>=_0x57dad2){_0xd15ec2=_0x57dad2;_0x131126=0xc8;}else{_0x131126=0xce;}_0x1f2574['status'](_0x131126);return _0x1f2574[_0xa0e7('0x23')](_0xa0e7('0x24'),_0x4358b0+'-'+_0xd15ec2+'/'+_0x57dad2)['json'](_0x22852b);}return null;};}function patchUpdates(_0x45affa){return function(_0x277f66){try{jsonpatch[_0xa0e7('0x25')](_0x277f66,_0x45affa,!![]);}catch(_0x294bff){return BPromise[_0xa0e7('0x26')](_0x294bff);}return _0x277f66['save']();};}function saveUpdates(_0x4e42a6,_0x312a79){return function(_0x1d837d){if(_0x1d837d){return _0x1d837d[_0xa0e7('0x27')](_0x4e42a6)[_0xa0e7('0x28')](function(_0xf1c31a){return _0xf1c31a;});}return null;};}function removeEntity(_0x4f3176,_0x3b0993){return function(_0x55e564){if(_0x55e564){return _0x55e564['destroy']()[_0xa0e7('0x28')](function(){_0x4f3176[_0xa0e7('0x1c')](0xcc)[_0xa0e7('0x1d')]();});}};}function handleEntityNotFound(_0x5821be,_0x3d4486){return function(_0x522e56){if(!_0x522e56){_0x5821be['sendStatus'](0x194);}return _0x522e56;};}function handleError(_0x209717,_0x5061c9){_0x5061c9=_0x5061c9||0x1f4;return function(_0x1d0ac4){logger[_0xa0e7('0x29')](_0x1d0ac4[_0xa0e7('0x2a')]);if(_0x1d0ac4[_0xa0e7('0x2b')]){delete _0x1d0ac4['name'];}_0x209717['status'](_0x5061c9)[_0xa0e7('0x2c')](_0x1d0ac4);};}exports[_0xa0e7('0x2d')]=function(_0x1e90a4,_0x1588e0){var _0x557f8d={},_0x415084={},_0x5bf934={'count':0x0,'rows':[]};var _0xf7bf8=_[_0xa0e7('0x2e')](db['ZendeskField']['rawAttributes'],function(_0x4cdbaf){return{'name':_0x4cdbaf['fieldName'],'type':_0x4cdbaf[_0xa0e7('0x2f')][_0xa0e7('0x30')]};});_0x415084['model']=_[_0xa0e7('0x2e')](_0xf7bf8,_0xa0e7('0x2b'));_0x415084[_0xa0e7('0x31')]=_['keys'](_0x1e90a4[_0xa0e7('0x31')]);_0x415084[_0xa0e7('0x32')]=_['intersection'](_0x415084[_0xa0e7('0x33')],_0x415084[_0xa0e7('0x31')]);_0x557f8d['attributes']=_[_0xa0e7('0x34')](_0x415084[_0xa0e7('0x33')],qs['fields'](_0x1e90a4[_0xa0e7('0x31')]['fields']));_0x557f8d[_0xa0e7('0x35')]=_0x557f8d[_0xa0e7('0x35')][_0xa0e7('0x36')]?_0x557f8d[_0xa0e7('0x35')]:_0x415084[_0xa0e7('0x33')];if(!_0x1e90a4[_0xa0e7('0x31')][_0xa0e7('0x37')](_0xa0e7('0x38'))){_0x557f8d[_0xa0e7('0x22')]=qs[_0xa0e7('0x22')](_0x1e90a4[_0xa0e7('0x31')]['limit']);_0x557f8d[_0xa0e7('0x20')]=qs[_0xa0e7('0x20')](_0x1e90a4['query'][_0xa0e7('0x20')]);}_0x557f8d[_0xa0e7('0x39')]=qs[_0xa0e7('0x3a')](_0x1e90a4[_0xa0e7('0x31')][_0xa0e7('0x3a')]);_0x557f8d['where']=qs[_0xa0e7('0x32')](_[_0xa0e7('0x3b')](_0x1e90a4[_0xa0e7('0x31')],_0x415084[_0xa0e7('0x32')]),_0xf7bf8);if(_0x1e90a4[_0xa0e7('0x31')]['filter']){_0x557f8d[_0xa0e7('0x3c')]=_[_0xa0e7('0x3d')](_0x557f8d[_0xa0e7('0x3c')],{'$or':_[_0xa0e7('0x2e')](_0xf7bf8,function(_0x27d351){if(_0x27d351[_0xa0e7('0x2f')]!==_0xa0e7('0x3e')){var _0x22f1cd={};_0x22f1cd[_0x27d351[_0xa0e7('0x2b')]]={'$like':'%'+_0x1e90a4[_0xa0e7('0x31')][_0xa0e7('0x3f')]+'%'};return _0x22f1cd;}})});}_0x557f8d=_[_0xa0e7('0x3d')]({},_0x557f8d,_0x1e90a4[_0xa0e7('0x40')]);var _0x2ef3ff={'where':_0x557f8d[_0xa0e7('0x3c')]};return db['ZendeskField'][_0xa0e7('0x21')](_0x2ef3ff)[_0xa0e7('0x28')](function(_0x1e0cea){_0x5bf934[_0xa0e7('0x21')]=_0x1e0cea;if(_0x1e90a4[_0xa0e7('0x31')][_0xa0e7('0x41')]){_0x557f8d[_0xa0e7('0x42')]=[{'all':!![]}];}return db[_0xa0e7('0x43')][_0xa0e7('0x44')](_0x557f8d);})['then'](function(_0x3803bd){_0x5bf934['rows']=_0x3803bd;return _0x5bf934;})[_0xa0e7('0x28')](respondWithFilteredResult(_0x1588e0,_0x557f8d))[_0xa0e7('0x45')](handleError(_0x1588e0,null));};exports[_0xa0e7('0x46')]=function(_0x540c69,_0x25fc1f){var _0x1d21e5={'raw':!![],'where':{'id':_0x540c69[_0xa0e7('0x47')]['id']}},_0x30389a={};_0x30389a[_0xa0e7('0x33')]=_[_0xa0e7('0x48')](db[_0xa0e7('0x43')]['rawAttributes']);_0x30389a['query']=_[_0xa0e7('0x48')](_0x540c69[_0xa0e7('0x31')]);_0x30389a[_0xa0e7('0x32')]=_[_0xa0e7('0x34')](_0x30389a[_0xa0e7('0x33')],_0x30389a['query']);_0x1d21e5['attributes']=_[_0xa0e7('0x34')](_0x30389a[_0xa0e7('0x33')],qs[_0xa0e7('0x49')](_0x540c69[_0xa0e7('0x31')][_0xa0e7('0x49')]));_0x1d21e5[_0xa0e7('0x35')]=_0x1d21e5[_0xa0e7('0x35')][_0xa0e7('0x36')]?_0x1d21e5[_0xa0e7('0x35')]:_0x30389a[_0xa0e7('0x33')];if(_0x540c69[_0xa0e7('0x31')][_0xa0e7('0x41')]){_0x1d21e5[_0xa0e7('0x42')]=[{'all':!![]}];}_0x1d21e5=_['merge']({},_0x1d21e5,_0x540c69[_0xa0e7('0x40')]);return db[_0xa0e7('0x43')][_0xa0e7('0x4a')](_0x1d21e5)[_0xa0e7('0x28')](handleEntityNotFound(_0x25fc1f,null))['then'](respondWithResult(_0x25fc1f,null))[_0xa0e7('0x45')](handleError(_0x25fc1f,null));};exports['create']=function(_0x569384,_0x66279e){return db[_0xa0e7('0x43')]['create'](_0x569384[_0xa0e7('0x4b')],{})[_0xa0e7('0x28')](respondWithResult(_0x66279e,0xc9))[_0xa0e7('0x45')](handleError(_0x66279e,null));};exports[_0xa0e7('0x27')]=function(_0x151c46,_0x525e34){if(_0x151c46[_0xa0e7('0x4b')]['id']){delete _0x151c46['body']['id'];}return db['ZendeskField'][_0xa0e7('0x4a')]({'where':{'id':_0x151c46[_0xa0e7('0x47')]['id']}})[_0xa0e7('0x28')](handleEntityNotFound(_0x525e34,null))[_0xa0e7('0x28')](saveUpdates(_0x151c46[_0xa0e7('0x4b')],null))[_0xa0e7('0x28')](respondWithResult(_0x525e34,null))['catch'](handleError(_0x525e34,null));};exports['destroy']=function(_0x10b7ba,_0x9ea9ab){return db[_0xa0e7('0x43')][_0xa0e7('0x4a')]({'where':{'id':_0x10b7ba[_0xa0e7('0x47')]['id']}})[_0xa0e7('0x28')](handleEntityNotFound(_0x9ea9ab,null))[_0xa0e7('0x28')](removeEntity(_0x9ea9ab,null))[_0xa0e7('0x45')](handleError(_0x9ea9ab,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index 02113f6..fb216f7 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 _0xd906=['api','bluebird','path','../../config/environment','exports','ZendeskField','int_zendesk_fields','zendesk_unique_index','idField','FieldId','util','../../config/logger'];(function(_0x50193e,_0x20538a){var _0x520ebb=function(_0x589eb8){while(--_0x589eb8){_0x50193e['push'](_0x50193e['shift']());}};_0x520ebb(++_0x20538a);}(_0xd906,0xd6));var _0x6d90=function(_0x13f409,_0x34ec12){_0x13f409=_0x13f409-0x0;var _0x4560da=_0xd906[_0x13f409];return _0x4560da;};'use strict';var _=require('lodash');var util=require(_0x6d90('0x0'));var logger=require(_0x6d90('0x1'))(_0x6d90('0x2'));var moment=require('moment');var BPromise=require(_0x6d90('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6d90('0x4'));var rimraf=require('rimraf');var config=require(_0x6d90('0x5'));var attributes=require('./intZendeskField.attributes');module[_0x6d90('0x6')]=function(_0x225bb9,_0x4e0b43){return _0x225bb9['define'](_0x6d90('0x7'),attributes,{'tableName':_0x6d90('0x8'),'paranoid':![],'indexes':[{'name':_0x6d90('0x9'),'fields':[_0x6d90('0xa'),_0x6d90('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd4ab=['util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZendeskField.attributes','define','ZendeskField','int_zendesk_fields','FieldId','lodash'];(function(_0xd8d93d,_0x305ae5){var _0x80f7e2=function(_0x3f6937){while(--_0x3f6937){_0xd8d93d['push'](_0xd8d93d['shift']());}};_0x80f7e2(++_0x305ae5);}(_0xd4ab,0x109));var _0xbd4a=function(_0x1b14b0,_0x71edcb){_0x1b14b0=_0x1b14b0-0x0;var _0x3f1982=_0xd4ab[_0x1b14b0];return _0x3f1982;};'use strict';var _=require(_0xbd4a('0x0'));var util=require(_0xbd4a('0x1'));var logger=require('../../config/logger')(_0xbd4a('0x2'));var moment=require(_0xbd4a('0x3'));var BPromise=require(_0xbd4a('0x4'));var rp=require(_0xbd4a('0x5'));var fs=require('fs');var path=require(_0xbd4a('0x6'));var rimraf=require(_0xbd4a('0x7'));var config=require(_0xbd4a('0x8'));var attributes=require(_0xbd4a('0x9'));module['exports']=function(_0x10e084,_0x45b9b4){return _0x10e084[_0xbd4a('0xa')](_0xbd4a('0xb'),attributes,{'tableName':_0xbd4a('0xc'),'paranoid':![],'indexes':[{'name':'zendesk_unique_index','fields':['idField',_0xbd4a('0xd')],'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 f3db1f6..168cf7a 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 _0x40d0=['request\x20sent','debug','stringify','error','code','message','info','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http','request','ZendeskField,\x20%s,\x20%s'];(function(_0x4b663a,_0x10dfb9){var _0x4faf1a=function(_0x4e6af7){while(--_0x4e6af7){_0x4b663a['push'](_0x4b663a['shift']());}};_0x4faf1a(++_0x10dfb9);}(_0x40d0,0x185));var _0x040d=function(_0x1e8b3c,_0x57aec9){_0x1e8b3c=_0x1e8b3c-0x0;var _0xcf5709=_0x40d0[_0x1e8b3c];return _0xcf5709;};'use strict';var _=require('lodash');var util=require(_0x040d('0x0'));var moment=require('moment');var BPromise=require(_0x040d('0x1'));var rs=require(_0x040d('0x2'));var fs=require('fs');var Redis=require(_0x040d('0x3'));var db=require(_0x040d('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x040d('0x5'))(_0x040d('0x6'));var config=require(_0x040d('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x040d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5c598a,_0x42a5d9,_0x473a3f){return new BPromise(function(_0x5e5a6e,_0x1b9155){return client[_0x040d('0x9')](_0x5c598a,_0x473a3f)['then'](function(_0x5db508){logger['info'](_0x040d('0xa'),_0x42a5d9,_0x040d('0xb'));logger[_0x040d('0xc')]('ZendeskField,\x20%s,\x20%s,\x20%s',_0x42a5d9,_0x040d('0xb'),JSON[_0x040d('0xd')](_0x5db508));if(_0x5db508[_0x040d('0xe')]){if(_0x5db508[_0x040d('0xe')][_0x040d('0xf')]===0x1f4){logger[_0x040d('0xe')](_0x040d('0xa'),_0x42a5d9,_0x5db508['error']['message']);return _0x1b9155(_0x5db508['error'][_0x040d('0x10')]);}logger[_0x040d('0xe')]('ZendeskField,\x20%s,\x20%s',_0x42a5d9,_0x5db508['error'][_0x040d('0x10')]);return _0x5e5a6e(_0x5db508[_0x040d('0xe')][_0x040d('0x10')]);}else{logger[_0x040d('0x11')](_0x040d('0xa'),_0x42a5d9,_0x040d('0xb'));_0x5e5a6e(_0x5db508[_0x040d('0x12')]['message']);}})[_0x040d('0x13')](function(_0x1ede49){logger[_0x040d('0xe')](_0x040d('0xa'),_0x42a5d9,_0x1ede49);_0x1b9155(_0x1ede49);});});} \ No newline at end of file +var _0x8b0b=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ZendeskField,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x5a08f9,_0x2633c4){var _0x49dc98=function(_0x353c30){while(--_0x353c30){_0x5a08f9['push'](_0x5a08f9['shift']());}};_0x49dc98(++_0x2633c4);}(_0x8b0b,0x18b));var _0xb8b0=function(_0x45aa72,_0x8af642){_0x45aa72=_0x45aa72-0x0;var _0x75adaa=_0x8b0b[_0x45aa72];return _0x75adaa;};'use strict';var _=require(_0xb8b0('0x0'));var util=require(_0xb8b0('0x1'));var moment=require(_0xb8b0('0x2'));var BPromise=require(_0xb8b0('0x3'));var rs=require(_0xb8b0('0x4'));var fs=require('fs');var Redis=require(_0xb8b0('0x5'));var db=require(_0xb8b0('0x6'))['db'];var utils=require(_0xb8b0('0x7'));var logger=require(_0xb8b0('0x8'))(_0xb8b0('0x9'));var config=require(_0xb8b0('0xa'));var jayson=require(_0xb8b0('0xb'));var client=jayson[_0xb8b0('0xc')][_0xb8b0('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x405607,_0x2ccd38,_0x4d2f1b){return new BPromise(function(_0x100874,_0x555634){return client[_0xb8b0('0xe')](_0x405607,_0x4d2f1b)[_0xb8b0('0xf')](function(_0x53766a){logger[_0xb8b0('0x10')](_0xb8b0('0x11'),_0x2ccd38,'request\x20sent');logger['debug']('ZendeskField,\x20%s,\x20%s,\x20%s',_0x2ccd38,_0xb8b0('0x12'),JSON[_0xb8b0('0x13')](_0x53766a));if(_0x53766a[_0xb8b0('0x14')]){if(_0x53766a[_0xb8b0('0x14')][_0xb8b0('0x15')]===0x1f4){logger[_0xb8b0('0x14')](_0xb8b0('0x11'),_0x2ccd38,_0x53766a[_0xb8b0('0x14')]['message']);return _0x555634(_0x53766a[_0xb8b0('0x14')]['message']);}logger[_0xb8b0('0x14')](_0xb8b0('0x11'),_0x2ccd38,_0x53766a[_0xb8b0('0x14')][_0xb8b0('0x16')]);return _0x100874(_0x53766a['error'][_0xb8b0('0x16')]);}else{logger[_0xb8b0('0x10')](_0xb8b0('0x11'),_0x2ccd38,_0xb8b0('0x12'));_0x100874(_0x53766a[_0xb8b0('0x17')][_0xb8b0('0x16')]);}})[_0xb8b0('0x18')](function(_0x509a55){logger[_0xb8b0('0x14')]('ZendeskField,\x20%s,\x20%s',_0x2ccd38,_0x509a55);_0x555634(_0x509a55);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index 0421b17..eca04c5 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 _0x209e=['get','/:id','show','/:id/configurations','isAuthenticated','getConfigurations','/:id/fields','getFields','post','create','put','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x5a8696,_0x307a16){var _0x5d39ed=function(_0x1a5dda){while(--_0x1a5dda){_0x5a8696['push'](_0x5a8696['shift']());}};_0x5d39ed(++_0x307a16);}(_0x209e,0x1af));var _0xe209=function(_0x44b59e,_0x1aac3f){_0x44b59e=_0x44b59e-0x0;var _0x5a5a05=_0x209e[_0x44b59e];return _0x5a5a05;};'use strict';var multer=require(_0xe209('0x0'));var util=require(_0xe209('0x1'));var path=require(_0xe209('0x2'));var timeout=require(_0xe209('0x3'));var express=require(_0xe209('0x4'));var router=express[_0xe209('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xe209('0x6'));var interaction=require(_0xe209('0x7'));var config=require(_0xe209('0x8'));var controller=require('./intZohoAccount.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xe209('0x9')](_0xe209('0xa'),auth['isAuthenticated'](),controller[_0xe209('0xb')]);router[_0xe209('0x9')](_0xe209('0xc'),auth[_0xe209('0xd')](),controller[_0xe209('0xe')]);router[_0xe209('0x9')](_0xe209('0xf'),auth['isAuthenticated'](),controller[_0xe209('0x10')]);router[_0xe209('0x11')]('/',auth[_0xe209('0xd')](),controller[_0xe209('0x12')]);router['post'](_0xe209('0xc'),auth[_0xe209('0xd')](),controller['addConfiguration']);router[_0xe209('0x13')](_0xe209('0xa'),auth[_0xe209('0xd')](),controller['update']);router[_0xe209('0x14')]('/:id',auth['isAuthenticated'](),controller[_0xe209('0x15')]);module['exports']=router; \ No newline at end of file +var _0xf682=['addConfiguration','put','/:id','delete','destroy','exports','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoAccount.controller','get','index','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create'];(function(_0x238be2,_0x4bb9b9){var _0x280661=function(_0x561113){while(--_0x561113){_0x238be2['push'](_0x238be2['shift']());}};_0x280661(++_0x4bb9b9);}(_0xf682,0x1a4));var _0x2f68=function(_0x35a5bf,_0x43bd0c){_0x35a5bf=_0x35a5bf-0x0;var _0x1ed93b=_0xf682[_0x35a5bf];return _0x1ed93b;};'use strict';var multer=require('multer');var util=require(_0x2f68('0x0'));var path=require(_0x2f68('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x2f68('0x2'));var auth=require(_0x2f68('0x3'));var interaction=require(_0x2f68('0x4'));var config=require(_0x2f68('0x5'));var controller=require(_0x2f68('0x6'));router[_0x2f68('0x7')]('/',auth['isAuthenticated'](),controller[_0x2f68('0x8')]);router[_0x2f68('0x7')]('/:id',auth[_0x2f68('0x9')](),controller[_0x2f68('0xa')]);router[_0x2f68('0x7')](_0x2f68('0xb'),auth[_0x2f68('0x9')](),controller[_0x2f68('0xc')]);router[_0x2f68('0x7')](_0x2f68('0xd'),auth[_0x2f68('0x9')](),controller[_0x2f68('0xe')]);router[_0x2f68('0xf')]('/',auth['isAuthenticated'](),controller[_0x2f68('0x10')]);router[_0x2f68('0xf')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x2f68('0x11')]);router[_0x2f68('0x12')](_0x2f68('0x13'),auth[_0x2f68('0x9')](),controller['update']);router[_0x2f68('0x14')](_0x2f68('0x13'),auth[_0x2f68('0x9')](),controller[_0x2f68('0x15')]);module[_0x2f68('0x16')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index 032ef8b..29359bc 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 _0x54ef=['STRING','sequelize','exports'];(function(_0x5043f3,_0x3be189){var _0x4e712c=function(_0x5bfc32){while(--_0x5bfc32){_0x5043f3['push'](_0x5043f3['shift']());}};_0x4e712c(++_0x3be189);}(_0x54ef,0x112));var _0xf54e=function(_0xc2550a,_0xdef35c){_0xc2550a=_0xc2550a-0x0;var _0x1a1b05=_0x54ef[_0xc2550a];return _0x1a1b05;};'use strict';var Sequelize=require(_0xf54e('0x0'));module[_0xf54e('0x1')]={'name':{'type':Sequelize[_0xf54e('0x2')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0xf54e('0x2')]},'zone':{'type':Sequelize[_0xf54e('0x2')]},'clientId':{'type':Sequelize[_0xf54e('0x2')]},'clientSecret':{'type':Sequelize[_0xf54e('0x2')]},'serverUrl':{'type':Sequelize[_0xf54e('0x2')],'allowNull':![]},'code':{'type':Sequelize[_0xf54e('0x2')]},'refreshToken':{'type':Sequelize[_0xf54e('0x2')]}}; \ No newline at end of file +var _0x4b84=['STRING','sequelize','exports'];(function(_0x5de967,_0x515918){var _0x5b07a3=function(_0x563020){while(--_0x563020){_0x5de967['push'](_0x5de967['shift']());}};_0x5b07a3(++_0x515918);}(_0x4b84,0x1cc));var _0x44b8=function(_0x4b3e49,_0x9e566c){_0x4b3e49=_0x4b3e49-0x0;var _0x57e339=_0x4b84[_0x4b3e49];return _0x57e339;};'use strict';var Sequelize=require(_0x44b8('0x0'));module[_0x44b8('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x44b8('0x2')]},'zone':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0x44b8('0x2')]},'serverUrl':{'type':Sequelize[_0x44b8('0x2')],'allowNull':![]},'code':{'type':Sequelize[_0x44b8('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 7495774..a159428 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 _0x9f66=['Subjects','getSubjects','channel','Descriptions','getDescriptions','ZohoField','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','serverUrl','code','zoho.eu','slice','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','response','message','Owner','Subject','Description','Call_Duration','Call_Result','Call_Type','includes','system_mandatory','push','display_label','custom_field','data_type','picklist','pick_list_values','statusCode','stringify','test','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','end','json','offset','undefined','limit','count','apply','save','update','then','destroy','sendStatus','error','stack','name','send','index','ZohoAccount','rawAttributes','type','key','model','map','query','keys','filters','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','create','body','find','params','getConfigurations','findOne','ZohoConfiguration','intersection','nolimit','addConfiguration','AccountId'];(function(_0x56916d,_0x37b935){var _0x2b7f1f=function(_0x206eb1){while(--_0x206eb1){_0x56916d['push'](_0x56916d['shift']());}};_0x2b7f1f(++_0x37b935);}(_0x9f66,0x145));var _0x69f6=function(_0x5a2291,_0x3ddda7){_0x5a2291=_0x5a2291-0x0;var _0x10e3f5=_0x9f66[_0x5a2291];return _0x10e3f5;};'use strict';var emlformat=require(_0x69f6('0x0'));var rimraf=require(_0x69f6('0x1'));var zipdir=require(_0x69f6('0x2'));var jsonpatch=require(_0x69f6('0x3'));var rp=require(_0x69f6('0x4'));var moment=require(_0x69f6('0x5'));var BPromise=require(_0x69f6('0x6'));var Mustache=require(_0x69f6('0x7'));var util=require(_0x69f6('0x8'));var path=require(_0x69f6('0x9'));var sox=require('sox');var csv=require(_0x69f6('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x69f6('0xb'));var _=require(_0x69f6('0xc'));var squel=require(_0x69f6('0xd'));var crypto=require(_0x69f6('0xe'));var jsforce=require(_0x69f6('0xf'));var deskjs=require(_0x69f6('0x10'));var toCsv=require(_0x69f6('0xa'));var querystring=require(_0x69f6('0x11'));var Papa=require('papaparse');var Redis=require(_0x69f6('0x12'));var authService=require(_0x69f6('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x69f6('0x14'));var hardwareService=require(_0x69f6('0x15'));var logger=require(_0x69f6('0x16'))('api');var utils=require(_0x69f6('0x17'));var config=require(_0x69f6('0x18'));var licenseUtil=require(_0x69f6('0x19'));var db=require(_0x69f6('0x1a'))['db'];var integrations=require(_0x69f6('0x1b'));function respondWithStatusCode(_0x539931,_0x2aa7eb){_0x2aa7eb=_0x2aa7eb||0xcc;return function(_0x449e61){if(_0x449e61){return _0x539931['sendStatus'](_0x2aa7eb);}return _0x539931[_0x69f6('0x1c')](_0x2aa7eb)[_0x69f6('0x1d')]();};}function respondWithResult(_0x4f8fa2,_0x4ad2da){_0x4ad2da=_0x4ad2da||0xc8;return function(_0x5b0023){if(_0x5b0023){return _0x4f8fa2[_0x69f6('0x1c')](_0x4ad2da)[_0x69f6('0x1e')](_0x5b0023);}};}function respondWithFilteredResult(_0x5e9f0e,_0x5bba52){return function(_0x5e64b1){if(_0x5e64b1){var _0x4981ad=typeof _0x5bba52[_0x69f6('0x1f')]===_0x69f6('0x20')&&typeof _0x5bba52[_0x69f6('0x21')]===_0x69f6('0x20');var _0x2dc82a=_0x5e64b1[_0x69f6('0x22')];var _0x106f0e=_0x4981ad?0x0:_0x5bba52[_0x69f6('0x1f')];var _0x5911ff=_0x4981ad?_0x5e64b1[_0x69f6('0x22')]:_0x5bba52[_0x69f6('0x1f')]+_0x5bba52[_0x69f6('0x21')];var _0x2ae224;if(_0x5911ff>=_0x2dc82a){_0x5911ff=_0x2dc82a;_0x2ae224=0xc8;}else{_0x2ae224=0xce;}_0x5e9f0e['status'](_0x2ae224);return _0x5e9f0e['set']('Content-Range',_0x106f0e+'-'+_0x5911ff+'/'+_0x2dc82a)[_0x69f6('0x1e')](_0x5e64b1);}return null;};}function patchUpdates(_0x14079a){return function(_0xf21447){try{jsonpatch[_0x69f6('0x23')](_0xf21447,_0x14079a,!![]);}catch(_0xe4d293){return BPromise['reject'](_0xe4d293);}return _0xf21447[_0x69f6('0x24')]();};}function saveUpdates(_0x10fd6a,_0x52fd25){return function(_0x5cb94c){if(_0x5cb94c){return _0x5cb94c[_0x69f6('0x25')](_0x10fd6a)[_0x69f6('0x26')](function(_0x322a59){return _0x322a59;});}return null;};}function removeEntity(_0x145ad3,_0x19f786){return function(_0x52e703){if(_0x52e703){return _0x52e703[_0x69f6('0x27')]()[_0x69f6('0x26')](function(){_0x145ad3[_0x69f6('0x1c')](0xcc)[_0x69f6('0x1d')]();});}};}function handleEntityNotFound(_0x569f24,_0x581246){return function(_0x2ee861){if(!_0x2ee861){_0x569f24[_0x69f6('0x28')](0x194);}return _0x2ee861;};}function handleError(_0xf3dd93,_0x228158){_0x228158=_0x228158||0x1f4;return function(_0x46e606){logger[_0x69f6('0x29')](_0x46e606[_0x69f6('0x2a')]);if(_0x46e606[_0x69f6('0x2b')]){delete _0x46e606[_0x69f6('0x2b')];}_0xf3dd93[_0x69f6('0x1c')](_0x228158)[_0x69f6('0x2c')](_0x46e606);};}exports[_0x69f6('0x2d')]=function(_0x1aa8e6,_0x106cb4){var _0xbd78c4={},_0x5f38fa={},_0x5cf986={'count':0x0,'rows':[]};var _0x3071e3=_['map'](db[_0x69f6('0x2e')][_0x69f6('0x2f')],function(_0x29e431){return{'name':_0x29e431['fieldName'],'type':_0x29e431[_0x69f6('0x30')][_0x69f6('0x31')]};});_0x5f38fa[_0x69f6('0x32')]=_[_0x69f6('0x33')](_0x3071e3,_0x69f6('0x2b'));_0x5f38fa[_0x69f6('0x34')]=_[_0x69f6('0x35')](_0x1aa8e6[_0x69f6('0x34')]);_0x5f38fa[_0x69f6('0x36')]=_['intersection'](_0x5f38fa[_0x69f6('0x32')],_0x5f38fa[_0x69f6('0x34')]);_0xbd78c4[_0x69f6('0x37')]=_['intersection'](_0x5f38fa[_0x69f6('0x32')],qs[_0x69f6('0x38')](_0x1aa8e6[_0x69f6('0x34')][_0x69f6('0x38')]));_0xbd78c4[_0x69f6('0x37')]=_0xbd78c4[_0x69f6('0x37')][_0x69f6('0x39')]?_0xbd78c4[_0x69f6('0x37')]:_0x5f38fa[_0x69f6('0x32')];if(!_0x1aa8e6['query'][_0x69f6('0x3a')]('nolimit')){_0xbd78c4[_0x69f6('0x21')]=qs[_0x69f6('0x21')](_0x1aa8e6[_0x69f6('0x34')]['limit']);_0xbd78c4[_0x69f6('0x1f')]=qs[_0x69f6('0x1f')](_0x1aa8e6[_0x69f6('0x34')][_0x69f6('0x1f')]);}_0xbd78c4[_0x69f6('0x3b')]=qs[_0x69f6('0x3c')](_0x1aa8e6[_0x69f6('0x34')][_0x69f6('0x3c')]);_0xbd78c4[_0x69f6('0x3d')]=qs[_0x69f6('0x36')](_[_0x69f6('0x3e')](_0x1aa8e6[_0x69f6('0x34')],_0x5f38fa[_0x69f6('0x36')]),_0x3071e3);if(_0x1aa8e6[_0x69f6('0x34')][_0x69f6('0x3f')]){_0xbd78c4[_0x69f6('0x3d')]=_[_0x69f6('0x40')](_0xbd78c4[_0x69f6('0x3d')],{'$or':_['map'](_0x3071e3,function(_0x30497c){if(_0x30497c[_0x69f6('0x30')]!==_0x69f6('0x41')){var _0x2bc2f4={};_0x2bc2f4[_0x30497c[_0x69f6('0x2b')]]={'$like':'%'+_0x1aa8e6[_0x69f6('0x34')][_0x69f6('0x3f')]+'%'};return _0x2bc2f4;}})});}_0xbd78c4=_[_0x69f6('0x40')]({},_0xbd78c4,_0x1aa8e6[_0x69f6('0x42')]);var _0x4fc5e0={'where':_0xbd78c4[_0x69f6('0x3d')]};return db[_0x69f6('0x2e')][_0x69f6('0x22')](_0x4fc5e0)[_0x69f6('0x26')](function(_0x19e7eb){_0x5cf986[_0x69f6('0x22')]=_0x19e7eb;if(_0x1aa8e6['query'][_0x69f6('0x43')]){_0xbd78c4[_0x69f6('0x44')]=[{'all':!![]}];}return db[_0x69f6('0x2e')][_0x69f6('0x45')](_0xbd78c4);})[_0x69f6('0x26')](function(_0x42a80c){_0x5cf986[_0x69f6('0x46')]=_0x42a80c;return _0x5cf986;})[_0x69f6('0x26')](respondWithFilteredResult(_0x106cb4,_0xbd78c4))[_0x69f6('0x47')](handleError(_0x106cb4,null));};exports['show']=function(_0x15a164,_0x44b427){var _0xb45a7={'raw':![],'where':{'id':_0x15a164['params']['id']}},_0x28ffb7={};_0x28ffb7['model']=_[_0x69f6('0x35')](db[_0x69f6('0x2e')][_0x69f6('0x2f')]);_0x28ffb7[_0x69f6('0x34')]=_[_0x69f6('0x35')](_0x15a164[_0x69f6('0x34')]);_0x28ffb7[_0x69f6('0x36')]=_['intersection'](_0x28ffb7['model'],_0x28ffb7[_0x69f6('0x34')]);_0xb45a7['attributes']=_['intersection'](_0x28ffb7[_0x69f6('0x32')],qs[_0x69f6('0x38')](_0x15a164[_0x69f6('0x34')]['fields']));_0xb45a7[_0x69f6('0x37')]=_0xb45a7['attributes'][_0x69f6('0x39')]?_0xb45a7[_0x69f6('0x37')]:_0x28ffb7[_0x69f6('0x32')];if(_0x15a164['query'][_0x69f6('0x43')]){_0xb45a7[_0x69f6('0x44')]=[{'all':!![]}];}_0xb45a7=_['merge']({},_0xb45a7,_0x15a164[_0x69f6('0x42')]);return db[_0x69f6('0x2e')]['find'](_0xb45a7)['then'](handleEntityNotFound(_0x44b427,null))['then'](respondWithResult(_0x44b427,null))[_0x69f6('0x47')](handleError(_0x44b427,null));};exports[_0x69f6('0x48')]=function(_0x2d773d,_0x460253){return db[_0x69f6('0x2e')][_0x69f6('0x48')](_0x2d773d[_0x69f6('0x49')],{})[_0x69f6('0x26')](respondWithResult(_0x460253,0xc9))[_0x69f6('0x47')](handleError(_0x460253,null));};exports['update']=function(_0x191009,_0x3b1058){if(_0x191009['body']['id']){delete _0x191009['body']['id'];}return db[_0x69f6('0x2e')]['find']({'where':{'id':_0x191009['params']['id']}})[_0x69f6('0x26')](handleEntityNotFound(_0x3b1058,null))[_0x69f6('0x26')](saveUpdates(_0x191009[_0x69f6('0x49')],null))[_0x69f6('0x26')](respondWithResult(_0x3b1058,null))[_0x69f6('0x47')](handleError(_0x3b1058,null));};exports[_0x69f6('0x27')]=function(_0x4c5607,_0x179e77){return db[_0x69f6('0x2e')][_0x69f6('0x4a')]({'where':{'id':_0x4c5607[_0x69f6('0x4b')]['id']}})[_0x69f6('0x26')](handleEntityNotFound(_0x179e77,null))[_0x69f6('0x26')](removeEntity(_0x179e77,null))[_0x69f6('0x47')](handleError(_0x179e77,null));};exports[_0x69f6('0x4c')]=function(_0xcbc303,_0x4eda65,_0x24a481){var _0x244ab8={};var _0x28cf30={};var _0x31c5f3;var _0x3a8596;return db['ZohoAccount'][_0x69f6('0x4d')]({'where':{'id':_0xcbc303[_0x69f6('0x4b')]['id']}})[_0x69f6('0x26')](handleEntityNotFound(_0x4eda65,null))[_0x69f6('0x26')](function(_0x37ef2c){if(_0x37ef2c){_0x31c5f3=_0x37ef2c;_0x28cf30[_0x69f6('0x32')]=_[_0x69f6('0x35')](db[_0x69f6('0x4e')][_0x69f6('0x2f')]);_0x28cf30['query']=_['keys'](_0xcbc303['query']);_0x28cf30[_0x69f6('0x36')]=_[_0x69f6('0x4f')](_0x28cf30['model'],_0x28cf30[_0x69f6('0x34')]);_0x244ab8[_0x69f6('0x37')]=_[_0x69f6('0x4f')](_0x28cf30['model'],qs[_0x69f6('0x38')](_0xcbc303[_0x69f6('0x34')][_0x69f6('0x38')]));_0x244ab8[_0x69f6('0x37')]=_0x244ab8[_0x69f6('0x37')][_0x69f6('0x39')]?_0x244ab8['attributes']:_0x28cf30['model'];_0x244ab8[_0x69f6('0x3b')]=qs[_0x69f6('0x3c')](_0xcbc303[_0x69f6('0x34')][_0x69f6('0x3c')]);_0x244ab8[_0x69f6('0x3d')]=qs[_0x69f6('0x36')](_[_0x69f6('0x3e')](_0xcbc303[_0x69f6('0x34')],_0x28cf30['filters']));if(_0xcbc303[_0x69f6('0x34')][_0x69f6('0x3f')]){_0x244ab8[_0x69f6('0x3d')]=_['merge'](_0x244ab8[_0x69f6('0x3d')],{'$or':_[_0x69f6('0x33')](_0x244ab8[_0x69f6('0x37')],function(_0x1249b1){var _0x40b243={};_0x40b243[_0x1249b1]={'$like':'%'+_0xcbc303[_0x69f6('0x34')][_0x69f6('0x3f')]+'%'};return _0x40b243;})});}_0x244ab8=_['merge']({},_0x244ab8,_0xcbc303[_0x69f6('0x42')]);return _0x31c5f3[_0x69f6('0x4c')](_0x244ab8);}})[_0x69f6('0x26')](function(_0x1c9d41){if(_0x1c9d41){_0x3a8596=_0x1c9d41[_0x69f6('0x39')];if(!_0xcbc303['query'][_0x69f6('0x3a')](_0x69f6('0x50'))){_0x244ab8[_0x69f6('0x21')]=qs[_0x69f6('0x21')](_0xcbc303[_0x69f6('0x34')][_0x69f6('0x21')]);_0x244ab8[_0x69f6('0x1f')]=qs['offset'](_0xcbc303[_0x69f6('0x34')][_0x69f6('0x1f')]);}return _0x31c5f3['getConfigurations'](_0x244ab8);}})[_0x69f6('0x26')](function(_0x3c2aaf){if(_0x3c2aaf){return _0x3c2aaf?{'count':_0x3a8596,'rows':_0x3c2aaf}:null;}})[_0x69f6('0x26')](respondWithResult(_0x4eda65,null))[_0x69f6('0x47')](handleError(_0x4eda65,null));};exports[_0x69f6('0x51')]=function(_0x10a056,_0x34aa66,_0x426ebf){if(_0x10a056[_0x69f6('0x49')]['id']){delete _0x10a056[_0x69f6('0x49')]['id'];}return db[_0x69f6('0x2e')][_0x69f6('0x4d')]({'where':{'id':_0x10a056[_0x69f6('0x4b')]['id']}})[_0x69f6('0x26')](handleEntityNotFound(_0x34aa66,null))[_0x69f6('0x26')](function(_0x3bd07f){if(_0x3bd07f){_0x10a056[_0x69f6('0x49')][_0x69f6('0x52')]=_0x3bd07f['id'];_0x10a056[_0x69f6('0x49')][_0x69f6('0x53')]=integrations[_0x69f6('0x54')](_0x10a056[_0x69f6('0x49')][_0x69f6('0x55')],_0x10a056['body'][_0x69f6('0x30')]);_0x10a056[_0x69f6('0x49')][_0x69f6('0x56')]=integrations[_0x69f6('0x57')](_0x10a056[_0x69f6('0x49')][_0x69f6('0x55')],_0x10a056['body'][_0x69f6('0x30')]);return db[_0x69f6('0x4e')][_0x69f6('0x48')](_0x10a056[_0x69f6('0x49')],{'include':[{'model':db[_0x69f6('0x58')],'as':_0x69f6('0x53')},{'model':db[_0x69f6('0x58')],'as':_0x69f6('0x56')}]});}return null;})[_0x69f6('0x26')](respondWithResult(_0x34aa66,null))[_0x69f6('0x47')](handleError(_0x34aa66,null));};function getAccessToken(_0x59debf){return new Promise(function(_0x481ae5,_0x36a10a){var _0x45a170;switch(_0x59debf[_0x69f6('0x59')]){case'US':_0x45a170=_0x69f6('0x5a');break;case'AU':_0x45a170=_0x69f6('0x5b');break;case'EU':_0x45a170=_0x69f6('0x5c');break;case'IN':_0x45a170=_0x69f6('0x5d');break;case'CN':_0x45a170=_0x69f6('0x5e');break;default:_0x45a170=_0x69f6('0x5c');break;}var _0x2c10f4={'method':_0x69f6('0x5f'),'uri':_0x45a170+_0x69f6('0x60'),'qs':{'refresh_token':_0x59debf[_0x69f6('0x61')],'client_id':_0x59debf[_0x69f6('0x62')],'client_secret':_0x59debf[_0x69f6('0x63')],'grant_type':_0x69f6('0x64')},'json':!![]};return rp(_0x2c10f4)[_0x69f6('0x26')](function(_0x17761c){if(_0x17761c[_0x69f6('0x65')]){_0x481ae5(_0x17761c[_0x69f6('0x65')]);}else{_0x36a10a(_0x69f6('0x66'));}})['catch'](function(_0x203210){_0x36a10a(_0x203210);});});}exports[_0x69f6('0x67')]=function(_0x31229c,_0x1ba35a,_0x5c6974){var _0x32ab53,_0x1aca44,_0x27d24a,_0x5bcb78,_0x469034;return db[_0x69f6('0x2e')][_0x69f6('0x4d')]({'where':{'id':_0x31229c[_0x69f6('0x4b')]['id']},'attributes':['id',_0x69f6('0x68'),_0x69f6('0x59'),_0x69f6('0x62'),'clientSecret',_0x69f6('0x69'),_0x69f6('0x6a'),_0x69f6('0x61')]})[_0x69f6('0x26')](handleEntityNotFound(_0x1ba35a,null))[_0x69f6('0x26')](function(_0x13a3bd){_0x469034=_0x13a3bd;_0x32ab53=_0x469034[_0x69f6('0x68')];_0x1aca44=_0x32ab53===_0x69f6('0x6b')?'eu':'com';_0x27d24a=_0x469034['serverUrl'];var _0x4ba89d=_0x27d24a[_0x69f6('0x6c')](-0x1);if(_0x4ba89d==='/'||_0x4ba89d==='\x5c'||_0x4ba89d===':'){_0x27d24a=_0x27d24a['substring'](0x0,_0x27d24a[_0x69f6('0x6d')](_0x4ba89d));}if(!_0x469034[_0x69f6('0x61')]){throw new Error(_0x69f6('0x6e'));}return getAccessToken(_0x469034);})[_0x69f6('0x26')](function(_0x43004a){if(_0x43004a){return rp({'method':_0x69f6('0x6f'),'uri':util[_0x69f6('0x70')](_0x69f6('0x71'),_0x1aca44),'qs':{'module':_0x69f6('0x72')},'headers':{'Authorization':_0x69f6('0x73')+_0x43004a},'json':!![]});}})[_0x69f6('0x26')](function(_0x2e5a68){if(_0x2e5a68){if(_0x2e5a68[_0x69f6('0x74')]&&_0x2e5a68['response']['error']){throw new Error(_0x2e5a68['response'][_0x69f6('0x29')][_0x69f6('0x75')]);}var _0x122eed=[];var _0x3098ff=[];var _0x2cd6c5=[_0x69f6('0x76'),_0x69f6('0x77'),_0x69f6('0x78'),'WhoId',_0x69f6('0x79'),_0x69f6('0x7a'),'Call_Start_Time',_0x69f6('0x7b')];_0x3098ff=_['remove'](_0x2e5a68[_0x69f6('0x38')],function(_0x2d24cd){return _0x2cd6c5[_0x69f6('0x7c')](_0x2d24cd['api_name']);});for(var _0x1ade70=0x0;_0x1ade70<_0x3098ff[_0x69f6('0x39')];_0x1ade70++){if(_0x3098ff[_0x1ade70][_0x69f6('0x7d')]===![]){_0x122eed[_0x69f6('0x7e')]({'id':_0x3098ff[_0x1ade70]['id'],'name':_0x3098ff[_0x1ade70][_0x69f6('0x7f')],'custom':_0x3098ff[_0x1ade70][_0x69f6('0x80')],'options':_0x3098ff[_0x1ade70][_0x69f6('0x81')]===_0x69f6('0x82')&&_0x3098ff[_0x1ade70][_0x69f6('0x83')][_0x69f6('0x39')]>-0x1?_[_0x69f6('0x33')](_0x3098ff[_0x1ade70][_0x69f6('0x83')],function(_0xc0f8){return{'name':_0xc0f8,'value':_0xc0f8};}):[]});}}return{'count':_0x122eed[_0x69f6('0x39')],'rows':_0x122eed};}else{return{'count':0x0,'rows':[]};}})[_0x69f6('0x26')](respondWithResult(_0x1ba35a,null))[_0x69f6('0x47')](function(_0x1d8942){var _0x420261=_0x31229c[_0x69f6('0x34')]['test']?0x1f4:_0x1d8942[_0x69f6('0x84')]||0x1f4;logger[_0x69f6('0x29')]('getFields,\x20%s,\x20%s,\x20%s',_0x69f6('0x67'),_0x420261,JSON[_0x69f6('0x85')](_0x1d8942));delete _0x1d8942[_0x69f6('0x2b')];if(_0x420261===0x191){_0x420261=0x190;}_0x1ba35a['status'](_0x420261)[_0x69f6('0x2c')](_0x31229c[_0x69f6('0x34')][_0x69f6('0x86')]?{'message':_0x69f6('0x87'),'statusCode':_0x1d8942['statusCode']}:_0x1d8942);});}; \ No newline at end of file +var _0x49ac=['end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','fieldName','key','model','map','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','type','VIRTUAL','merge','options','ZohoAccount','includeAll','include','findAll','rows','catch','params','rawAttributes','fields','find','create','body','getConfigurations','findOne','order','addConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','ZohoConfiguration','ZohoField','zone','https://accounts.zoho.eu','https://accounts.zoho.com.cn','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','serverUrl','host','zoho.eu','com','slice','substring','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','response','Owner','Subject','Description','WhoId','Call_Duration','Call_Start_Time','remove','includes','system_mandatory','push','display_label','custom_field','data_type','picklist','pick_list_values','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','test','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','bluebird','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration'];(function(_0x1edd20,_0x1dbc2f){var _0x4188b9=function(_0x465e48){while(--_0x465e48){_0x1edd20['push'](_0x1edd20['shift']());}};_0x4188b9(++_0x1dbc2f);}(_0x49ac,0x1ea));var _0xc49a=function(_0x14d896,_0x53578b){_0x14d896=_0x14d896-0x0;var _0x28679a=_0x49ac[_0x14d896];return _0x28679a;};'use strict';var emlformat=require(_0xc49a('0x0'));var rimraf=require(_0xc49a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc49a('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xc49a('0x3'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xc49a('0x4'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xc49a('0x5'));var crypto=require(_0xc49a('0x6'));var jsforce=require(_0xc49a('0x7'));var deskjs=require(_0xc49a('0x8'));var toCsv=require(_0xc49a('0x9'));var querystring=require(_0xc49a('0xa'));var Papa=require(_0xc49a('0xb'));var Redis=require('ioredis');var authService=require(_0xc49a('0xc'));var qs=require(_0xc49a('0xd'));var as=require(_0xc49a('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc49a('0xf'))(_0xc49a('0x10'));var utils=require(_0xc49a('0x11'));var config=require(_0xc49a('0x12'));var licenseUtil=require(_0xc49a('0x13'));var db=require(_0xc49a('0x14'))['db'];var integrations=require(_0xc49a('0x15'));function respondWithStatusCode(_0x2512b8,_0x2667c1){_0x2667c1=_0x2667c1||0xcc;return function(_0x1b1af1){if(_0x1b1af1){return _0x2512b8['sendStatus'](_0x2667c1);}return _0x2512b8['status'](_0x2667c1)[_0xc49a('0x16')]();};}function respondWithResult(_0x56b7dd,_0x116947){_0x116947=_0x116947||0xc8;return function(_0x439fb3){if(_0x439fb3){return _0x56b7dd[_0xc49a('0x17')](_0x116947)[_0xc49a('0x18')](_0x439fb3);}};}function respondWithFilteredResult(_0x37dfb3,_0x2f1043){return function(_0x41b9ec){if(_0x41b9ec){var _0x4908e2=typeof _0x2f1043[_0xc49a('0x19')]===_0xc49a('0x1a')&&typeof _0x2f1043[_0xc49a('0x1b')]===_0xc49a('0x1a');var _0x3a4ca5=_0x41b9ec[_0xc49a('0x1c')];var _0x4b773a=_0x4908e2?0x0:_0x2f1043['offset'];var _0x4f3235=_0x4908e2?_0x41b9ec[_0xc49a('0x1c')]:_0x2f1043['offset']+_0x2f1043[_0xc49a('0x1b')];var _0x1697b8;if(_0x4f3235>=_0x3a4ca5){_0x4f3235=_0x3a4ca5;_0x1697b8=0xc8;}else{_0x1697b8=0xce;}_0x37dfb3[_0xc49a('0x17')](_0x1697b8);return _0x37dfb3[_0xc49a('0x1d')](_0xc49a('0x1e'),_0x4b773a+'-'+_0x4f3235+'/'+_0x3a4ca5)[_0xc49a('0x18')](_0x41b9ec);}return null;};}function patchUpdates(_0x579c70){return function(_0x483e84){try{jsonpatch['apply'](_0x483e84,_0x579c70,!![]);}catch(_0x3a3080){return BPromise[_0xc49a('0x1f')](_0x3a3080);}return _0x483e84[_0xc49a('0x20')]();};}function saveUpdates(_0x4a0a2a,_0x2a87f1){return function(_0x183bf2){if(_0x183bf2){return _0x183bf2[_0xc49a('0x21')](_0x4a0a2a)[_0xc49a('0x22')](function(_0x5ddf23){return _0x5ddf23;});}return null;};}function removeEntity(_0x372180,_0x4f1928){return function(_0x1364d3){if(_0x1364d3){return _0x1364d3[_0xc49a('0x23')]()['then'](function(){_0x372180[_0xc49a('0x17')](0xcc)[_0xc49a('0x16')]();});}};}function handleEntityNotFound(_0x25e545,_0x4fbe22){return function(_0x5cb099){if(!_0x5cb099){_0x25e545['sendStatus'](0x194);}return _0x5cb099;};}function handleError(_0x3697a8,_0x3f48f5){_0x3f48f5=_0x3f48f5||0x1f4;return function(_0x191e8b){logger[_0xc49a('0x24')](_0x191e8b[_0xc49a('0x25')]);if(_0x191e8b[_0xc49a('0x26')]){delete _0x191e8b['name'];}_0x3697a8[_0xc49a('0x17')](_0x3f48f5)[_0xc49a('0x27')](_0x191e8b);};}exports[_0xc49a('0x28')]=function(_0x2be948,_0x5519cf){var _0x15facc={},_0x4742c6={},_0x2aa316={'count':0x0,'rows':[]};var _0x3f5231=_['map'](db['ZohoAccount']['rawAttributes'],function(_0x4a508a){return{'name':_0x4a508a[_0xc49a('0x29')],'type':_0x4a508a['type'][_0xc49a('0x2a')]};});_0x4742c6[_0xc49a('0x2b')]=_[_0xc49a('0x2c')](_0x3f5231,_0xc49a('0x26'));_0x4742c6[_0xc49a('0x2d')]=_[_0xc49a('0x2e')](_0x2be948[_0xc49a('0x2d')]);_0x4742c6[_0xc49a('0x2f')]=_[_0xc49a('0x30')](_0x4742c6[_0xc49a('0x2b')],_0x4742c6['query']);_0x15facc['attributes']=_['intersection'](_0x4742c6['model'],qs['fields'](_0x2be948[_0xc49a('0x2d')]['fields']));_0x15facc[_0xc49a('0x31')]=_0x15facc[_0xc49a('0x31')][_0xc49a('0x32')]?_0x15facc['attributes']:_0x4742c6[_0xc49a('0x2b')];if(!_0x2be948[_0xc49a('0x2d')][_0xc49a('0x33')](_0xc49a('0x34'))){_0x15facc[_0xc49a('0x1b')]=qs[_0xc49a('0x1b')](_0x2be948[_0xc49a('0x2d')]['limit']);_0x15facc[_0xc49a('0x19')]=qs[_0xc49a('0x19')](_0x2be948[_0xc49a('0x2d')][_0xc49a('0x19')]);}_0x15facc['order']=qs[_0xc49a('0x35')](_0x2be948[_0xc49a('0x2d')]['sort']);_0x15facc[_0xc49a('0x36')]=qs[_0xc49a('0x2f')](_[_0xc49a('0x37')](_0x2be948[_0xc49a('0x2d')],_0x4742c6[_0xc49a('0x2f')]),_0x3f5231);if(_0x2be948[_0xc49a('0x2d')][_0xc49a('0x38')]){_0x15facc[_0xc49a('0x36')]=_['merge'](_0x15facc['where'],{'$or':_[_0xc49a('0x2c')](_0x3f5231,function(_0x5a74be){if(_0x5a74be[_0xc49a('0x39')]!==_0xc49a('0x3a')){var _0x5cfa02={};_0x5cfa02[_0x5a74be[_0xc49a('0x26')]]={'$like':'%'+_0x2be948['query'][_0xc49a('0x38')]+'%'};return _0x5cfa02;}})});}_0x15facc=_[_0xc49a('0x3b')]({},_0x15facc,_0x2be948[_0xc49a('0x3c')]);var _0x29c893={'where':_0x15facc[_0xc49a('0x36')]};return db[_0xc49a('0x3d')][_0xc49a('0x1c')](_0x29c893)[_0xc49a('0x22')](function(_0x3744e9){_0x2aa316[_0xc49a('0x1c')]=_0x3744e9;if(_0x2be948[_0xc49a('0x2d')][_0xc49a('0x3e')]){_0x15facc[_0xc49a('0x3f')]=[{'all':!![]}];}return db[_0xc49a('0x3d')][_0xc49a('0x40')](_0x15facc);})[_0xc49a('0x22')](function(_0x208f37){_0x2aa316[_0xc49a('0x41')]=_0x208f37;return _0x2aa316;})[_0xc49a('0x22')](respondWithFilteredResult(_0x5519cf,_0x15facc))[_0xc49a('0x42')](handleError(_0x5519cf,null));};exports['show']=function(_0x8bdb77,_0x2cb3b9){var _0x471ea8={'raw':![],'where':{'id':_0x8bdb77[_0xc49a('0x43')]['id']}},_0x164393={};_0x164393[_0xc49a('0x2b')]=_[_0xc49a('0x2e')](db[_0xc49a('0x3d')][_0xc49a('0x44')]);_0x164393['query']=_[_0xc49a('0x2e')](_0x8bdb77['query']);_0x164393[_0xc49a('0x2f')]=_[_0xc49a('0x30')](_0x164393[_0xc49a('0x2b')],_0x164393[_0xc49a('0x2d')]);_0x471ea8[_0xc49a('0x31')]=_[_0xc49a('0x30')](_0x164393[_0xc49a('0x2b')],qs[_0xc49a('0x45')](_0x8bdb77[_0xc49a('0x2d')][_0xc49a('0x45')]));_0x471ea8[_0xc49a('0x31')]=_0x471ea8[_0xc49a('0x31')]['length']?_0x471ea8[_0xc49a('0x31')]:_0x164393['model'];if(_0x8bdb77[_0xc49a('0x2d')][_0xc49a('0x3e')]){_0x471ea8['include']=[{'all':!![]}];}_0x471ea8=_[_0xc49a('0x3b')]({},_0x471ea8,_0x8bdb77['options']);return db[_0xc49a('0x3d')][_0xc49a('0x46')](_0x471ea8)[_0xc49a('0x22')](handleEntityNotFound(_0x2cb3b9,null))['then'](respondWithResult(_0x2cb3b9,null))[_0xc49a('0x42')](handleError(_0x2cb3b9,null));};exports[_0xc49a('0x47')]=function(_0x1375ea,_0x26f0dd){return db[_0xc49a('0x3d')][_0xc49a('0x47')](_0x1375ea[_0xc49a('0x48')],{})['then'](respondWithResult(_0x26f0dd,0xc9))[_0xc49a('0x42')](handleError(_0x26f0dd,null));};exports[_0xc49a('0x21')]=function(_0x144153,_0x121f58){if(_0x144153[_0xc49a('0x48')]['id']){delete _0x144153[_0xc49a('0x48')]['id'];}return db[_0xc49a('0x3d')]['find']({'where':{'id':_0x144153[_0xc49a('0x43')]['id']}})[_0xc49a('0x22')](handleEntityNotFound(_0x121f58,null))[_0xc49a('0x22')](saveUpdates(_0x144153['body'],null))[_0xc49a('0x22')](respondWithResult(_0x121f58,null))[_0xc49a('0x42')](handleError(_0x121f58,null));};exports[_0xc49a('0x23')]=function(_0x2ddbe3,_0x1df800){return db[_0xc49a('0x3d')][_0xc49a('0x46')]({'where':{'id':_0x2ddbe3[_0xc49a('0x43')]['id']}})['then'](handleEntityNotFound(_0x1df800,null))[_0xc49a('0x22')](removeEntity(_0x1df800,null))[_0xc49a('0x42')](handleError(_0x1df800,null));};exports[_0xc49a('0x49')]=function(_0x14e31a,_0x689fab,_0x4485c1){var _0x393e38={};var _0x3df3f4={};var _0x14d8d6;var _0x2aae01;return db[_0xc49a('0x3d')][_0xc49a('0x4a')]({'where':{'id':_0x14e31a[_0xc49a('0x43')]['id']}})['then'](handleEntityNotFound(_0x689fab,null))[_0xc49a('0x22')](function(_0x5e8078){if(_0x5e8078){_0x14d8d6=_0x5e8078;_0x3df3f4[_0xc49a('0x2b')]=_[_0xc49a('0x2e')](db['ZohoConfiguration'][_0xc49a('0x44')]);_0x3df3f4[_0xc49a('0x2d')]=_[_0xc49a('0x2e')](_0x14e31a[_0xc49a('0x2d')]);_0x3df3f4[_0xc49a('0x2f')]=_[_0xc49a('0x30')](_0x3df3f4[_0xc49a('0x2b')],_0x3df3f4[_0xc49a('0x2d')]);_0x393e38['attributes']=_[_0xc49a('0x30')](_0x3df3f4[_0xc49a('0x2b')],qs[_0xc49a('0x45')](_0x14e31a[_0xc49a('0x2d')][_0xc49a('0x45')]));_0x393e38['attributes']=_0x393e38[_0xc49a('0x31')][_0xc49a('0x32')]?_0x393e38[_0xc49a('0x31')]:_0x3df3f4['model'];_0x393e38[_0xc49a('0x4b')]=qs['sort'](_0x14e31a[_0xc49a('0x2d')]['sort']);_0x393e38[_0xc49a('0x36')]=qs[_0xc49a('0x2f')](_[_0xc49a('0x37')](_0x14e31a[_0xc49a('0x2d')],_0x3df3f4[_0xc49a('0x2f')]));if(_0x14e31a[_0xc49a('0x2d')][_0xc49a('0x38')]){_0x393e38['where']=_[_0xc49a('0x3b')](_0x393e38[_0xc49a('0x36')],{'$or':_[_0xc49a('0x2c')](_0x393e38[_0xc49a('0x31')],function(_0x53abb8){var _0xace67f={};_0xace67f[_0x53abb8]={'$like':'%'+_0x14e31a[_0xc49a('0x2d')][_0xc49a('0x38')]+'%'};return _0xace67f;})});}_0x393e38=_[_0xc49a('0x3b')]({},_0x393e38,_0x14e31a[_0xc49a('0x3c')]);return _0x14d8d6[_0xc49a('0x49')](_0x393e38);}})[_0xc49a('0x22')](function(_0x3b3638){if(_0x3b3638){_0x2aae01=_0x3b3638[_0xc49a('0x32')];if(!_0x14e31a[_0xc49a('0x2d')][_0xc49a('0x33')](_0xc49a('0x34'))){_0x393e38['limit']=qs['limit'](_0x14e31a[_0xc49a('0x2d')][_0xc49a('0x1b')]);_0x393e38[_0xc49a('0x19')]=qs['offset'](_0x14e31a['query'][_0xc49a('0x19')]);}return _0x14d8d6[_0xc49a('0x49')](_0x393e38);}})['then'](function(_0x40c7b3){if(_0x40c7b3){return _0x40c7b3?{'count':_0x2aae01,'rows':_0x40c7b3}:null;}})[_0xc49a('0x22')](respondWithResult(_0x689fab,null))[_0xc49a('0x42')](handleError(_0x689fab,null));};exports[_0xc49a('0x4c')]=function(_0x28ad38,_0x3c5470,_0x2a997b){if(_0x28ad38[_0xc49a('0x48')]['id']){delete _0x28ad38[_0xc49a('0x48')]['id'];}return db[_0xc49a('0x3d')][_0xc49a('0x4a')]({'where':{'id':_0x28ad38['params']['id']}})[_0xc49a('0x22')](handleEntityNotFound(_0x3c5470,null))[_0xc49a('0x22')](function(_0x559a72){if(_0x559a72){_0x28ad38[_0xc49a('0x48')]['AccountId']=_0x559a72['id'];_0x28ad38['body'][_0xc49a('0x4d')]=integrations[_0xc49a('0x4e')](_0x28ad38[_0xc49a('0x48')][_0xc49a('0x4f')],_0x28ad38[_0xc49a('0x48')]['type']);_0x28ad38['body'][_0xc49a('0x50')]=integrations[_0xc49a('0x51')](_0x28ad38[_0xc49a('0x48')]['channel'],_0x28ad38[_0xc49a('0x48')][_0xc49a('0x39')]);return db[_0xc49a('0x52')][_0xc49a('0x47')](_0x28ad38['body'],{'include':[{'model':db['ZohoField'],'as':_0xc49a('0x4d')},{'model':db[_0xc49a('0x53')],'as':_0xc49a('0x50')}]});}return null;})[_0xc49a('0x22')](respondWithResult(_0x3c5470,null))[_0xc49a('0x42')](handleError(_0x3c5470,null));};function getAccessToken(_0x234254){return new Promise(function(_0x366596,_0x25366c){var _0x5239d2;switch(_0x234254[_0xc49a('0x54')]){case'US':_0x5239d2='https://accounts.zoho.com';break;case'AU':_0x5239d2='https://accounts.zoho.com.au';break;case'EU':_0x5239d2=_0xc49a('0x55');break;case'IN':_0x5239d2='https://accounts.zoho.in';break;case'CN':_0x5239d2=_0xc49a('0x56');break;default:_0x5239d2=_0xc49a('0x55');break;}var _0x388433={'method':'POST','uri':_0x5239d2+_0xc49a('0x57'),'qs':{'refresh_token':_0x234254[_0xc49a('0x58')],'client_id':_0x234254[_0xc49a('0x59')],'client_secret':_0x234254[_0xc49a('0x5a')],'grant_type':_0xc49a('0x5b')},'json':!![]};return rp(_0x388433)['then'](function(_0xf9dc0d){if(_0xf9dc0d[_0xc49a('0x5c')]){_0x366596(_0xf9dc0d[_0xc49a('0x5c')]);}else{_0x25366c(_0xc49a('0x5d'));}})['catch'](function(_0x3e6cac){_0x25366c(_0x3e6cac);});});}exports[_0xc49a('0x5e')]=function(_0x387878,_0x1c8963,_0x22de29){var _0x166131,_0x10626b,_0x4db238,_0x3058f7,_0x110ad8;return db['ZohoAccount'][_0xc49a('0x4a')]({'where':{'id':_0x387878[_0xc49a('0x43')]['id']},'attributes':['id','host',_0xc49a('0x54'),_0xc49a('0x59'),_0xc49a('0x5a'),_0xc49a('0x5f'),'code',_0xc49a('0x58')]})[_0xc49a('0x22')](handleEntityNotFound(_0x1c8963,null))[_0xc49a('0x22')](function(_0x137522){_0x110ad8=_0x137522;_0x166131=_0x110ad8[_0xc49a('0x60')];_0x10626b=_0x166131===_0xc49a('0x61')?'eu':_0xc49a('0x62');_0x4db238=_0x110ad8[_0xc49a('0x5f')];var _0x4cea75=_0x4db238[_0xc49a('0x63')](-0x1);if(_0x4cea75==='/'||_0x4cea75==='\x5c'||_0x4cea75===':'){_0x4db238=_0x4db238[_0xc49a('0x64')](0x0,_0x4db238['lastIndexOf'](_0x4cea75));}if(!_0x110ad8['refreshToken']){throw new Error(_0xc49a('0x65'));}return getAccessToken(_0x110ad8);})['then'](function(_0xc196f6){if(_0xc196f6){return rp({'method':_0xc49a('0x66'),'uri':util[_0xc49a('0x67')](_0xc49a('0x68'),_0x10626b),'qs':{'module':_0xc49a('0x69')},'headers':{'Authorization':_0xc49a('0x6a')+_0xc196f6},'json':!![]});}})[_0xc49a('0x22')](function(_0x33687c){if(_0x33687c){if(_0x33687c[_0xc49a('0x6b')]&&_0x33687c[_0xc49a('0x6b')][_0xc49a('0x24')]){throw new Error(_0x33687c[_0xc49a('0x6b')][_0xc49a('0x24')]['message']);}var _0x58d122=[];var _0xf986d4=[];var _0x312a76=[_0xc49a('0x6c'),_0xc49a('0x6d'),_0xc49a('0x6e'),_0xc49a('0x6f'),_0xc49a('0x70'),'Call_Result',_0xc49a('0x71'),'Call_Type'];_0xf986d4=_[_0xc49a('0x72')](_0x33687c[_0xc49a('0x45')],function(_0x55c4d3){return _0x312a76[_0xc49a('0x73')](_0x55c4d3['api_name']);});for(var _0x4711ff=0x0;_0x4711ff<_0xf986d4[_0xc49a('0x32')];_0x4711ff++){if(_0xf986d4[_0x4711ff][_0xc49a('0x74')]===![]){_0x58d122[_0xc49a('0x75')]({'id':_0xf986d4[_0x4711ff]['id'],'name':_0xf986d4[_0x4711ff][_0xc49a('0x76')],'custom':_0xf986d4[_0x4711ff][_0xc49a('0x77')],'options':_0xf986d4[_0x4711ff][_0xc49a('0x78')]===_0xc49a('0x79')&&_0xf986d4[_0x4711ff][_0xc49a('0x7a')][_0xc49a('0x32')]>-0x1?_[_0xc49a('0x2c')](_0xf986d4[_0x4711ff][_0xc49a('0x7a')],function(_0x59fccc){return{'name':_0x59fccc,'value':_0x59fccc};}):[]});}}return{'count':_0x58d122[_0xc49a('0x32')],'rows':_0x58d122};}else{return{'count':0x0,'rows':[]};}})[_0xc49a('0x22')](respondWithResult(_0x1c8963,null))[_0xc49a('0x42')](function(_0x2c1195){var _0x5065b7=_0x387878[_0xc49a('0x2d')]['test']?0x1f4:_0x2c1195[_0xc49a('0x7b')]||0x1f4;logger[_0xc49a('0x24')](_0xc49a('0x7c'),'getFields',_0x5065b7,JSON[_0xc49a('0x7d')](_0x2c1195));delete _0x2c1195['name'];if(_0x5065b7===0x191){_0x5065b7=0x190;}_0x1c8963['status'](_0x5065b7)[_0xc49a('0x27')](_0x387878[_0xc49a('0x2d')][_0xc49a('0x7e')]?{'message':_0xc49a('0x7f'),'statusCode':_0x2c1195['statusCode']}:_0x2c1195);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index 6562685..526d0cd 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 _0xeba9=['https://accounts.zoho.com.cn','catch','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration','exports','define','ZohoAccount','changed','serverUrl','clientSecret','code','host','slice','lastIndexOf','zone','https://accounts.zoho.com','https://accounts.zoho.in','https://accounts.zoho.eu','/oauth/v2/token','authorization_code','application/x-www-form-urlencoded','parse','refresh_token','refreshToken','info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','inspect','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','substring','https://accounts.zoho.com.au'];(function(_0x2741ff,_0x219a13){var _0x12e441=function(_0x4da599){while(--_0x4da599){_0x2741ff['push'](_0x2741ff['shift']());}};_0x12e441(++_0x219a13);}(_0xeba9,0xa6));var _0x9eba=function(_0x50572c,_0x206cbc){_0x50572c=_0x50572c-0x0;var _0x8c4e3a=_0xeba9[_0x50572c];return _0x8c4e3a;};'use strict';var _=require(_0x9eba('0x0'));var util=require(_0x9eba('0x1'));var logger=require(_0x9eba('0x2'))(_0x9eba('0x3'));var moment=require(_0x9eba('0x4'));var BPromise=require('bluebird');var rp=require(_0x9eba('0x5'));var fs=require('fs');var path=require(_0x9eba('0x6'));var rimraf=require(_0x9eba('0x7'));var config=require(_0x9eba('0x8'));var attributes=require('./intZohoAccount.attributes');var integrations=require(_0x9eba('0x9'));module[_0x9eba('0xa')]=function(_0x525bdb,_0x4bc1c6){return _0x525bdb[_0x9eba('0xb')](_0x9eba('0xc'),attributes,{'tableName':'int_zoho_accounts','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x14ee49,_0x57a02c,_0x4afed4){if(_0x14ee49[_0x9eba('0xd')]('zone')||_0x14ee49[_0x9eba('0xd')](_0x9eba('0xe'))||_0x14ee49[_0x9eba('0xd')]('clientId')||_0x14ee49['changed'](_0x9eba('0xf'))||_0x14ee49[_0x9eba('0xd')](_0x9eba('0x10'))||_0x14ee49['changed'](_0x9eba('0x11'))){var _0x1a4ca1,_0x4c8b59;_0x1a4ca1=_0x14ee49[_0x9eba('0xe')];var _0x58f592=_0x1a4ca1[_0x9eba('0x12')](-0x1);if(_0x58f592==='/'||_0x58f592==='\x5c'||_0x58f592===':'){_0x1a4ca1=_0x1a4ca1['substring'](0x0,_0x1a4ca1[_0x9eba('0x13')](_0x58f592));}switch(_0x14ee49[_0x9eba('0x14')]){case'US':_0x4c8b59=_0x9eba('0x15');break;case'AU':_0x4c8b59='https://accounts.zoho.com.au';break;case'IN':_0x4c8b59=_0x9eba('0x16');break;case'CN':_0x4c8b59='https://accounts.zoho.com.cn';break;default:_0x4c8b59=_0x9eba('0x17');break;}var _0x13a218={'method':'POST','uri':_0x4c8b59+_0x9eba('0x18'),'form':{'grant_type':_0x9eba('0x19'),'client_id':_0x14ee49['clientId'],'client_secret':_0x14ee49[_0x9eba('0xf')],'redirect_uri':_0x14ee49[_0x9eba('0xe')],'code':_0x14ee49[_0x9eba('0x10')]},'headers':{'Content-Type':_0x9eba('0x1a')}};return rp(_0x13a218)['then'](function(_0xadd860){var _0x7e612a=JSON[_0x9eba('0x1b')](_0xadd860);if(_0x7e612a[_0x9eba('0x1c')]){_0x14ee49[_0x9eba('0x1d')]=_0x7e612a['refresh_token'];logger[_0x9eba('0x1e')](util[_0x9eba('0x1f')](_0x9eba('0x20'),_0x14ee49[_0x9eba('0x21')],_0x14ee49['id']));}else{logger[_0x9eba('0x22')](util['format']('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x14ee49[_0x9eba('0x21')],_0x14ee49['id']),util[_0x9eba('0x23')](_0x7e612a,{'showHidden':![],'depth':null}));}return _0x4afed4(null,_0x57a02c);})['catch'](function(_0x4ba7da){logger[_0x9eba('0x22')](util['format'](_0x9eba('0x24'),_0x14ee49[_0x9eba('0x21')],_0x14ee49['id']),util[_0x9eba('0x23')](parsedResult,{'showHidden':![],'depth':null}));return _0x4afed4(_0x4ba7da);});}else{return _0x4afed4(null,_0x57a02c);}},'beforeUpdate':function(_0x1a4882,_0x63e9ba,_0x6a6e09){if(_0x1a4882[_0x9eba('0xd')]('zone')||_0x1a4882[_0x9eba('0xd')](_0x9eba('0xe'))||_0x1a4882[_0x9eba('0xd')]('clientId')||_0x1a4882['changed'](_0x9eba('0xf'))||_0x1a4882[_0x9eba('0xd')](_0x9eba('0x10'))||_0x1a4882['changed']('host')){var _0x4f2df4,_0x55c33c;_0x4f2df4=_0x1a4882[_0x9eba('0xe')];var _0x3fc012=_0x4f2df4[_0x9eba('0x12')](-0x1);if(_0x3fc012==='/'||_0x3fc012==='\x5c'||_0x3fc012===':'){_0x4f2df4=_0x4f2df4[_0x9eba('0x25')](0x0,_0x4f2df4[_0x9eba('0x13')](_0x3fc012));}switch(_0x1a4882[_0x9eba('0x14')]){case'US':_0x55c33c=_0x9eba('0x15');break;case'AU':_0x55c33c=_0x9eba('0x26');break;case'IN':_0x55c33c='https://accounts.zoho.in';break;case'CN':_0x55c33c=_0x9eba('0x27');break;default:_0x55c33c=_0x9eba('0x17');break;}var _0x59422f={'method':'POST','uri':_0x55c33c+_0x9eba('0x18'),'form':{'grant_type':_0x9eba('0x19'),'client_id':_0x1a4882['clientId'],'client_secret':_0x1a4882[_0x9eba('0xf')],'redirect_uri':_0x1a4882['serverUrl'],'code':_0x1a4882[_0x9eba('0x10')]},'headers':{'Content-Type':_0x9eba('0x1a')}};return rp(_0x59422f)['then'](function(_0x5e7f99){var _0x44d902=JSON[_0x9eba('0x1b')](_0x5e7f99);if(_0x44d902[_0x9eba('0x1c')]){_0x1a4882[_0x9eba('0x1d')]=_0x44d902[_0x9eba('0x1c')];logger['info'](util['format'](_0x9eba('0x20'),_0x1a4882['name'],_0x1a4882['id']));}else{logger[_0x9eba('0x22')](util[_0x9eba('0x1f')](_0x9eba('0x24'),_0x1a4882['name'],_0x1a4882['id']),util[_0x9eba('0x23')](_0x44d902,{'showHidden':![],'depth':null}));}return _0x6a6e09(null,_0x63e9ba);})[_0x9eba('0x28')](function(_0x5c32bb){logger['error'](util[_0x9eba('0x1f')](_0x9eba('0x24'),_0x1a4882['name'],_0x1a4882['id']),util[_0x9eba('0x23')](parsedResult,{'showHidden':![],'depth':null}));return _0x6a6e09(_0x5c32bb);});}else{return _0x6a6e09(null,_0x63e9ba);}}}});}; \ No newline at end of file +var _0xe0be=['authorization_code','application/x-www-form-urlencoded','info','catch','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','int_zoho_accounts','serverUrl','changed','clientId','code','slice','substring','lastIndexOf','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','/oauth/v2/token','clientSecret','then','parse','refresh_token','refreshToken','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','name','inspect','error','zone','host','POST'];(function(_0x391f65,_0x13b4bc){var _0x19b9d7=function(_0x1c025e){while(--_0x1c025e){_0x391f65['push'](_0x391f65['shift']());}};_0x19b9d7(++_0x13b4bc);}(_0xe0be,0x1b2));var _0xee0b=function(_0x174e1e,_0x7d2152){_0x174e1e=_0x174e1e-0x0;var _0x2c6af9=_0xe0be[_0x174e1e];return _0x2c6af9;};'use strict';var _=require(_0xee0b('0x0'));var util=require(_0xee0b('0x1'));var logger=require(_0xee0b('0x2'))(_0xee0b('0x3'));var moment=require(_0xee0b('0x4'));var BPromise=require(_0xee0b('0x5'));var rp=require(_0xee0b('0x6'));var fs=require('fs');var path=require(_0xee0b('0x7'));var rimraf=require(_0xee0b('0x8'));var config=require(_0xee0b('0x9'));var attributes=require(_0xee0b('0xa'));var integrations=require(_0xee0b('0xb'));module['exports']=function(_0xe9cf1,_0xf14ea9){return _0xe9cf1['define']('ZohoAccount',attributes,{'tableName':_0xee0b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x3f111d,_0x21a86a,_0x35239a){if(_0x3f111d['changed']('zone')||_0x3f111d['changed'](_0xee0b('0xd'))||_0x3f111d[_0xee0b('0xe')](_0xee0b('0xf'))||_0x3f111d['changed']('clientSecret')||_0x3f111d[_0xee0b('0xe')](_0xee0b('0x10'))||_0x3f111d[_0xee0b('0xe')]('host')){var _0x58c868,_0x1fee8d;_0x58c868=_0x3f111d['serverUrl'];var _0x4ba71f=_0x58c868[_0xee0b('0x11')](-0x1);if(_0x4ba71f==='/'||_0x4ba71f==='\x5c'||_0x4ba71f===':'){_0x58c868=_0x58c868[_0xee0b('0x12')](0x0,_0x58c868[_0xee0b('0x13')](_0x4ba71f));}switch(_0x3f111d['zone']){case'US':_0x1fee8d='https://accounts.zoho.com';break;case'AU':_0x1fee8d=_0xee0b('0x14');break;case'IN':_0x1fee8d=_0xee0b('0x15');break;case'CN':_0x1fee8d=_0xee0b('0x16');break;default:_0x1fee8d=_0xee0b('0x17');break;}var _0x5f2548={'method':'POST','uri':_0x1fee8d+_0xee0b('0x18'),'form':{'grant_type':'authorization_code','client_id':_0x3f111d[_0xee0b('0xf')],'client_secret':_0x3f111d[_0xee0b('0x19')],'redirect_uri':_0x3f111d[_0xee0b('0xd')],'code':_0x3f111d[_0xee0b('0x10')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x5f2548)[_0xee0b('0x1a')](function(_0x196cd1){var _0xfb1f4f=JSON[_0xee0b('0x1b')](_0x196cd1);if(_0xfb1f4f[_0xee0b('0x1c')]){_0x3f111d[_0xee0b('0x1d')]=_0xfb1f4f[_0xee0b('0x1c')];logger['info'](util[_0xee0b('0x1e')](_0xee0b('0x1f'),_0x3f111d['name'],_0x3f111d['id']));}else{logger['error'](util[_0xee0b('0x1e')](_0xee0b('0x20'),_0x3f111d[_0xee0b('0x21')],_0x3f111d['id']),util[_0xee0b('0x22')](_0xfb1f4f,{'showHidden':![],'depth':null}));}return _0x35239a(null,_0x21a86a);})['catch'](function(_0xcd6837){logger[_0xee0b('0x23')](util[_0xee0b('0x1e')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x3f111d[_0xee0b('0x21')],_0x3f111d['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x35239a(_0xcd6837);});}else{return _0x35239a(null,_0x21a86a);}},'beforeUpdate':function(_0x2ab391,_0x181062,_0x5256ac){if(_0x2ab391[_0xee0b('0xe')](_0xee0b('0x24'))||_0x2ab391[_0xee0b('0xe')](_0xee0b('0xd'))||_0x2ab391[_0xee0b('0xe')]('clientId')||_0x2ab391[_0xee0b('0xe')](_0xee0b('0x19'))||_0x2ab391[_0xee0b('0xe')](_0xee0b('0x10'))||_0x2ab391[_0xee0b('0xe')](_0xee0b('0x25'))){var _0x20aaf2,_0x317253;_0x20aaf2=_0x2ab391[_0xee0b('0xd')];var _0x1b8b0f=_0x20aaf2[_0xee0b('0x11')](-0x1);if(_0x1b8b0f==='/'||_0x1b8b0f==='\x5c'||_0x1b8b0f===':'){_0x20aaf2=_0x20aaf2[_0xee0b('0x12')](0x0,_0x20aaf2[_0xee0b('0x13')](_0x1b8b0f));}switch(_0x2ab391[_0xee0b('0x24')]){case'US':_0x317253='https://accounts.zoho.com';break;case'AU':_0x317253='https://accounts.zoho.com.au';break;case'IN':_0x317253='https://accounts.zoho.in';break;case'CN':_0x317253=_0xee0b('0x16');break;default:_0x317253=_0xee0b('0x17');break;}var _0x47ce10={'method':_0xee0b('0x26'),'uri':_0x317253+_0xee0b('0x18'),'form':{'grant_type':_0xee0b('0x27'),'client_id':_0x2ab391[_0xee0b('0xf')],'client_secret':_0x2ab391[_0xee0b('0x19')],'redirect_uri':_0x2ab391[_0xee0b('0xd')],'code':_0x2ab391[_0xee0b('0x10')]},'headers':{'Content-Type':_0xee0b('0x28')}};return rp(_0x47ce10)[_0xee0b('0x1a')](function(_0x3f1f99){var _0x1eda88=JSON[_0xee0b('0x1b')](_0x3f1f99);if(_0x1eda88[_0xee0b('0x1c')]){_0x2ab391['refreshToken']=_0x1eda88[_0xee0b('0x1c')];logger[_0xee0b('0x29')](util['format'](_0xee0b('0x1f'),_0x2ab391[_0xee0b('0x21')],_0x2ab391['id']));}else{logger[_0xee0b('0x23')](util[_0xee0b('0x1e')](_0xee0b('0x20'),_0x2ab391[_0xee0b('0x21')],_0x2ab391['id']),util[_0xee0b('0x22')](_0x1eda88,{'showHidden':![],'depth':null}));}return _0x5256ac(null,_0x181062);})[_0xee0b('0x2a')](function(_0x198d0c){logger[_0xee0b('0x23')](util[_0xee0b('0x1e')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x2ab391[_0xee0b('0x21')],_0x2ab391['id']),util[_0xee0b('0x22')](parsedResult,{'showHidden':![],'depth':null}));return _0x5256ac(_0x198d0c);});}else{return _0x5256ac(null,_0x181062);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index bb630d1..473f5f8 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 _0x8325=['ShowZohoAccount','find','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','GetZohoAccount','ZohoAccount','findAll','options','where','map','model','attributes','include','stringify','catch'];(function(_0x457ef8,_0x1a19ae){var _0x596c56=function(_0x3b3b8f){while(--_0x3b3b8f){_0x457ef8['push'](_0x457ef8['shift']());}};_0x596c56(++_0x1a19ae);}(_0x8325,0x1f1));var _0x5832=function(_0xf579fd,_0x5d78a3){_0xf579fd=_0xf579fd-0x0;var _0x488069=_0x8325[_0xf579fd];return _0x488069;};'use strict';var _=require(_0x5832('0x0'));var util=require('util');var moment=require(_0x5832('0x1'));var BPromise=require('bluebird');var rs=require(_0x5832('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5832('0x3'))['db'];var utils=require(_0x5832('0x4'));var logger=require(_0x5832('0x5'))(_0x5832('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x5832('0x7')][_0x5832('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x8b3b30,_0xe80d1d,_0xb4e9b9){return new BPromise(function(_0x333780,_0x495531){return client[_0x5832('0x9')](_0x8b3b30,_0xb4e9b9)[_0x5832('0xa')](function(_0x10192d){logger[_0x5832('0xb')](_0x5832('0xc'),_0xe80d1d,_0x5832('0xd'));logger[_0x5832('0xe')](_0x5832('0xf'),_0xe80d1d,_0x5832('0xd'),JSON['stringify'](_0x10192d));if(_0x10192d['error']){if(_0x10192d[_0x5832('0x10')][_0x5832('0x11')]===0x1f4){logger[_0x5832('0x10')](_0x5832('0xc'),_0xe80d1d,_0x10192d['error']['message']);return _0x495531(_0x10192d[_0x5832('0x10')][_0x5832('0x12')]);}logger[_0x5832('0x10')](_0x5832('0xc'),_0xe80d1d,_0x10192d['error'][_0x5832('0x12')]);return _0x333780(_0x10192d[_0x5832('0x10')][_0x5832('0x12')]);}else{logger[_0x5832('0xb')]('ZohoAccount,\x20%s,\x20%s',_0xe80d1d,_0x5832('0xd'));_0x333780(_0x10192d[_0x5832('0x13')][_0x5832('0x12')]);}})['catch'](function(_0x32d360){logger[_0x5832('0x10')](_0x5832('0xc'),_0xe80d1d,_0x32d360);_0x495531(_0x32d360);});});}exports[_0x5832('0x14')]=function(_0x1f986d){var _0x3598f5=this;return new Promise(function(_0x2c929f,_0xc466d0){return db[_0x5832('0x15')][_0x5832('0x16')]({'raw':_0x1f986d['options']?_0x1f986d[_0x5832('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x1f986d['options']?_0x1f986d['options'][_0x5832('0x18')]||null:null,'attributes':_0x1f986d['options']?_0x1f986d['options']['attributes']||null:null,'limit':_0x1f986d['options']?_0x1f986d[_0x5832('0x17')]['limit']||null:null,'include':_0x1f986d['options']?_0x1f986d[_0x5832('0x17')]['include']?_[_0x5832('0x19')](_0x1f986d['options']['include'],function(_0x5de263){return{'model':db[_0x5de263[_0x5832('0x1a')]],'as':_0x5de263['as'],'attributes':_0x5de263[_0x5832('0x1b')],'include':_0x5de263[_0x5832('0x1c')]?_[_0x5832('0x19')](_0x5de263['include'],function(_0x52bc08){return{'model':db[_0x52bc08[_0x5832('0x1a')]],'as':_0x52bc08['as'],'attributes':_0x52bc08[_0x5832('0x1b')],'include':_0x52bc08['include']?_[_0x5832('0x19')](_0x52bc08[_0x5832('0x1c')],function(_0x5bd864){return{'model':db[_0x5bd864[_0x5832('0x1a')]],'as':_0x5bd864['as'],'attributes':_0x5bd864[_0x5832('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x5832('0xa')](function(_0x32b4da){logger[_0x5832('0xb')](_0x5832('0x14'),_0x1f986d);logger[_0x5832('0xe')](_0x5832('0x14'),_0x1f986d,JSON[_0x5832('0x1d')](_0x32b4da));_0x2c929f(_0x32b4da);})[_0x5832('0x1e')](function(_0xdb70aa){logger['error'](_0x5832('0x14'),_0xdb70aa[_0x5832('0x12')],_0x1f986d);_0xc466d0(_0x3598f5[_0x5832('0x10')](0x1f4,_0xdb70aa['message']));});});};exports[_0x5832('0x1f')]=function(_0x5d3828){var _0x47cd38=this;return new Promise(function(_0x227873,_0x4603d5){return db[_0x5832('0x15')][_0x5832('0x20')]({'raw':_0x5d3828['options']?_0x5d3828[_0x5832('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x5d3828[_0x5832('0x17')]?_0x5d3828[_0x5832('0x17')][_0x5832('0x18')]||null:null,'attributes':_0x5d3828[_0x5832('0x17')]?_0x5d3828[_0x5832('0x17')][_0x5832('0x1b')]||null:null,'include':_0x5d3828['options']?_0x5d3828[_0x5832('0x17')]['include']?_['map'](_0x5d3828[_0x5832('0x17')][_0x5832('0x1c')],function(_0x2bc0c7){return{'model':db[_0x2bc0c7[_0x5832('0x1a')]],'as':_0x2bc0c7['as'],'attributes':_0x2bc0c7[_0x5832('0x1b')],'include':_0x2bc0c7[_0x5832('0x1c')]?_[_0x5832('0x19')](_0x2bc0c7[_0x5832('0x1c')],function(_0x5434bb){return{'model':db[_0x5434bb[_0x5832('0x1a')]],'as':_0x5434bb['as'],'attributes':_0x5434bb['attributes'],'include':_0x5434bb[_0x5832('0x1c')]?_[_0x5832('0x19')](_0x5434bb[_0x5832('0x1c')],function(_0x7e1f88){return{'model':db[_0x7e1f88['model']],'as':_0x7e1f88['as'],'attributes':_0x7e1f88[_0x5832('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x5832('0xa')](function(_0x38d21b){logger[_0x5832('0xb')](_0x5832('0x1f'),_0x5d3828);logger[_0x5832('0xe')](_0x5832('0x1f'),_0x5d3828,JSON[_0x5832('0x1d')](_0x38d21b));_0x227873(_0x38d21b);})['catch'](function(_0x571a5a){logger[_0x5832('0x10')]('ShowZohoAccount',_0x571a5a[_0x5832('0x12')],_0x5d3828);_0x4603d5(_0x47cd38[_0x5832('0x10')](0x1f4,_0x571a5a[_0x5832('0x12')]));});});}; \ No newline at end of file +var _0xb4b6=['result','catch','GetZohoAccount','findAll','options','raw','where','limit','map','include','attributes','ShowZohoAccount','ZohoAccount','find','model','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xb4b6,0x7e));var _0x6b4b=function(_0x1029ea,_0x4a83ad){_0x1029ea=_0x1029ea-0x0;var _0x5db63d=_0xb4b6[_0x1029ea];return _0x5db63d;};'use strict';var _=require('lodash');var util=require(_0x6b4b('0x0'));var moment=require(_0x6b4b('0x1'));var BPromise=require(_0x6b4b('0x2'));var rs=require(_0x6b4b('0x3'));var fs=require('fs');var Redis=require(_0x6b4b('0x4'));var db=require(_0x6b4b('0x5'))['db'];var utils=require(_0x6b4b('0x6'));var logger=require(_0x6b4b('0x7'))(_0x6b4b('0x8'));var config=require('../../config/environment');var jayson=require(_0x6b4b('0x9'));var client=jayson['client'][_0x6b4b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x25eef2,_0x8b279d,_0x127577){return new BPromise(function(_0x2e6b81,_0x572b2d){return client[_0x6b4b('0xb')](_0x25eef2,_0x127577)[_0x6b4b('0xc')](function(_0x40b391){logger[_0x6b4b('0xd')](_0x6b4b('0xe'),_0x8b279d,_0x6b4b('0xf'));logger[_0x6b4b('0x10')](_0x6b4b('0x11'),_0x8b279d,'request\x20sent',JSON[_0x6b4b('0x12')](_0x40b391));if(_0x40b391['error']){if(_0x40b391[_0x6b4b('0x13')][_0x6b4b('0x14')]===0x1f4){logger[_0x6b4b('0x13')](_0x6b4b('0xe'),_0x8b279d,_0x40b391[_0x6b4b('0x13')][_0x6b4b('0x15')]);return _0x572b2d(_0x40b391[_0x6b4b('0x13')]['message']);}logger[_0x6b4b('0x13')](_0x6b4b('0xe'),_0x8b279d,_0x40b391[_0x6b4b('0x13')]['message']);return _0x2e6b81(_0x40b391['error'][_0x6b4b('0x15')]);}else{logger[_0x6b4b('0xd')]('ZohoAccount,\x20%s,\x20%s',_0x8b279d,_0x6b4b('0xf'));_0x2e6b81(_0x40b391[_0x6b4b('0x16')][_0x6b4b('0x15')]);}})[_0x6b4b('0x17')](function(_0x22a176){logger[_0x6b4b('0x13')](_0x6b4b('0xe'),_0x8b279d,_0x22a176);_0x572b2d(_0x22a176);});});}exports[_0x6b4b('0x18')]=function(_0x15333b){var _0x5308da=this;return new Promise(function(_0x5a1afc,_0x26b9b4){return db['ZohoAccount'][_0x6b4b('0x19')]({'raw':_0x15333b[_0x6b4b('0x1a')]?_0x15333b[_0x6b4b('0x1a')][_0x6b4b('0x1b')]===undefined?!![]:![]:!![],'where':_0x15333b['options']?_0x15333b[_0x6b4b('0x1a')][_0x6b4b('0x1c')]||null:null,'attributes':_0x15333b['options']?_0x15333b['options']['attributes']||null:null,'limit':_0x15333b[_0x6b4b('0x1a')]?_0x15333b[_0x6b4b('0x1a')][_0x6b4b('0x1d')]||null:null,'include':_0x15333b[_0x6b4b('0x1a')]?_0x15333b[_0x6b4b('0x1a')]['include']?_[_0x6b4b('0x1e')](_0x15333b[_0x6b4b('0x1a')][_0x6b4b('0x1f')],function(_0xef64c9){return{'model':db[_0xef64c9['model']],'as':_0xef64c9['as'],'attributes':_0xef64c9['attributes'],'include':_0xef64c9['include']?_['map'](_0xef64c9[_0x6b4b('0x1f')],function(_0x526f6d){return{'model':db[_0x526f6d['model']],'as':_0x526f6d['as'],'attributes':_0x526f6d[_0x6b4b('0x20')],'include':_0x526f6d[_0x6b4b('0x1f')]?_[_0x6b4b('0x1e')](_0x526f6d[_0x6b4b('0x1f')],function(_0x5afba8){return{'model':db[_0x5afba8['model']],'as':_0x5afba8['as'],'attributes':_0x5afba8[_0x6b4b('0x20')]};}):[]};}):[]};}):[]:[]})[_0x6b4b('0xc')](function(_0x2973f){logger[_0x6b4b('0xd')]('GetZohoAccount',_0x15333b);logger[_0x6b4b('0x10')]('GetZohoAccount',_0x15333b,JSON[_0x6b4b('0x12')](_0x2973f));_0x5a1afc(_0x2973f);})[_0x6b4b('0x17')](function(_0x334cf8){logger['error'](_0x6b4b('0x18'),_0x334cf8[_0x6b4b('0x15')],_0x15333b);_0x26b9b4(_0x5308da[_0x6b4b('0x13')](0x1f4,_0x334cf8[_0x6b4b('0x15')]));});});};exports[_0x6b4b('0x21')]=function(_0x1ab7de){var _0x4bea7a=this;return new Promise(function(_0x509a54,_0x55e595){return db[_0x6b4b('0x22')][_0x6b4b('0x23')]({'raw':_0x1ab7de[_0x6b4b('0x1a')]?_0x1ab7de[_0x6b4b('0x1a')][_0x6b4b('0x1b')]===undefined?!![]:![]:!![],'where':_0x1ab7de[_0x6b4b('0x1a')]?_0x1ab7de['options']['where']||null:null,'attributes':_0x1ab7de['options']?_0x1ab7de[_0x6b4b('0x1a')]['attributes']||null:null,'include':_0x1ab7de[_0x6b4b('0x1a')]?_0x1ab7de['options']['include']?_['map'](_0x1ab7de[_0x6b4b('0x1a')][_0x6b4b('0x1f')],function(_0x2cb4ff){return{'model':db[_0x2cb4ff[_0x6b4b('0x24')]],'as':_0x2cb4ff['as'],'attributes':_0x2cb4ff[_0x6b4b('0x20')],'include':_0x2cb4ff['include']?_[_0x6b4b('0x1e')](_0x2cb4ff['include'],function(_0x5b0252){return{'model':db[_0x5b0252['model']],'as':_0x5b0252['as'],'attributes':_0x5b0252[_0x6b4b('0x20')],'include':_0x5b0252[_0x6b4b('0x1f')]?_[_0x6b4b('0x1e')](_0x5b0252['include'],function(_0x273521){return{'model':db[_0x273521[_0x6b4b('0x24')]],'as':_0x273521['as'],'attributes':_0x273521[_0x6b4b('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x550465){logger[_0x6b4b('0xd')](_0x6b4b('0x21'),_0x1ab7de);logger[_0x6b4b('0x10')](_0x6b4b('0x21'),_0x1ab7de,JSON[_0x6b4b('0x12')](_0x550465));_0x509a54(_0x550465);})[_0x6b4b('0x17')](function(_0x4a8af8){logger[_0x6b4b('0x13')]('ShowZohoAccount',_0x4a8af8[_0x6b4b('0x15')],_0x1ab7de);_0x55e595(_0x4bea7a[_0x6b4b('0x13')](0x1f4,_0x4a8af8['message']));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index e94d6db..3f41681 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 _0xb195=['../../config/environment','./intZohoConfiguration.controller','get','isAuthenticated','index','/:id','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x17a057,_0x51ef19){var _0x5b34d2=function(_0x3f69f0){while(--_0x3f69f0){_0x17a057['push'](_0x17a057['shift']());}};_0x5b34d2(++_0x51ef19);}(_0xb195,0x75));var _0x5b19=function(_0x35da42,_0x5c2610){_0x35da42=_0x35da42-0x0;var _0x370035=_0xb195[_0x35da42];return _0x370035;};'use strict';var multer=require(_0x5b19('0x0'));var util=require(_0x5b19('0x1'));var path=require(_0x5b19('0x2'));var timeout=require(_0x5b19('0x3'));var express=require(_0x5b19('0x4'));var router=express[_0x5b19('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x5b19('0x6'));var interaction=require(_0x5b19('0x7'));var config=require(_0x5b19('0x8'));var controller=require(_0x5b19('0x9'));router[_0x5b19('0xa')]('/',auth[_0x5b19('0xb')](),controller[_0x5b19('0xc')]);router[_0x5b19('0xa')](_0x5b19('0xd'),auth['isAuthenticated'](),controller['show']);router['get']('/:id/fields',auth[_0x5b19('0xb')](),controller['getFields']);router[_0x5b19('0xa')](_0x5b19('0xe'),auth[_0x5b19('0xb')](),controller[_0x5b19('0xf')]);router[_0x5b19('0xa')](_0x5b19('0x10'),auth[_0x5b19('0xb')](),controller[_0x5b19('0x11')]);router[_0x5b19('0x12')]('/',auth[_0x5b19('0xb')](),controller[_0x5b19('0x13')]);router[_0x5b19('0x14')]('/:id',auth[_0x5b19('0xb')](),controller[_0x5b19('0x15')]);router[_0x5b19('0x16')](_0x5b19('0xd'),auth['isAuthenticated'](),controller[_0x5b19('0x17')]);module[_0x5b19('0x18')]=router; \ No newline at end of file +var _0x7cc5=['show','/:id/fields','/:id/subjects','getDescriptions','post','create','/:id','update','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get'];(function(_0x23737b,_0x5367d4){var _0x19af74=function(_0xa1d7da){while(--_0xa1d7da){_0x23737b['push'](_0x23737b['shift']());}};_0x19af74(++_0x5367d4);}(_0x7cc5,0x1d8));var _0x57cc=function(_0x3537e1,_0xbc7714){_0x3537e1=_0x3537e1-0x0;var _0x164a50=_0x7cc5[_0x3537e1];return _0x164a50;};'use strict';var multer=require(_0x57cc('0x0'));var util=require(_0x57cc('0x1'));var path=require(_0x57cc('0x2'));var timeout=require(_0x57cc('0x3'));var express=require('express');var router=express[_0x57cc('0x4')]();var fs_extra=require(_0x57cc('0x5'));var auth=require(_0x57cc('0x6'));var interaction=require(_0x57cc('0x7'));var config=require(_0x57cc('0x8'));var controller=require('./intZohoConfiguration.controller');router['get']('/',auth[_0x57cc('0x9')](),controller[_0x57cc('0xa')]);router[_0x57cc('0xb')]('/:id',auth[_0x57cc('0x9')](),controller[_0x57cc('0xc')]);router[_0x57cc('0xb')](_0x57cc('0xd'),auth[_0x57cc('0x9')](),controller['getFields']);router[_0x57cc('0xb')](_0x57cc('0xe'),auth[_0x57cc('0x9')](),controller['getSubjects']);router['get']('/:id/descriptions',auth['isAuthenticated'](),controller[_0x57cc('0xf')]);router[_0x57cc('0x10')]('/',auth[_0x57cc('0x9')](),controller[_0x57cc('0x11')]);router['put'](_0x57cc('0x12'),auth[_0x57cc('0x9')](),controller[_0x57cc('0x13')]);router['delete']('/:id',auth[_0x57cc('0x9')](),controller[_0x57cc('0x14')]);module[_0x57cc('0x15')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index c1f9f36..71b3a66 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 _0x5f10=['nothing','lead','ENUM','contact_lead','STRING','sequelize','exports','contact'];(function(_0x42fd5c,_0x232b55){var _0x452a76=function(_0x519852){while(--_0x519852){_0x42fd5c['push'](_0x42fd5c['shift']());}};_0x452a76(++_0x232b55);}(_0x5f10,0xd5));var _0x05f1=function(_0x1e17eb,_0x2e15c5){_0x1e17eb=_0x1e17eb-0x0;var _0x4de4c7=_0x5f10[_0x1e17eb];return _0x4de4c7;};'use strict';var Sequelize=require(_0x05f1('0x0'));module[_0x05f1('0x1')]={'name':{'type':Sequelize['STRING']},'moduleCreate':{'type':Sequelize['ENUM']('lead',_0x05f1('0x2'),_0x05f1('0x3')),'defaultValue':_0x05f1('0x4')},'moduleSearch':{'type':Sequelize[_0x05f1('0x5')](_0x05f1('0x6'),_0x05f1('0x2'),'lead'),'defaultValue':_0x05f1('0x6')},'description':{'type':Sequelize[_0x05f1('0x7')]}}; \ No newline at end of file +var _0x0e1c=['sequelize','exports','ENUM','contact','nothing','lead','contact_lead'];(function(_0x3fccdc,_0x543784){var _0x2c37a2=function(_0x5b8ed5){while(--_0x5b8ed5){_0x3fccdc['push'](_0x3fccdc['shift']());}};_0x2c37a2(++_0x543784);}(_0x0e1c,0x16c));var _0xc0e1=function(_0x236ebc,_0x447d50){_0x236ebc=_0x236ebc-0x0;var _0x48eeaf=_0x0e1c[_0x236ebc];return _0x48eeaf;};'use strict';var Sequelize=require(_0xc0e1('0x0'));module[_0xc0e1('0x1')]={'name':{'type':Sequelize['STRING']},'moduleCreate':{'type':Sequelize[_0xc0e1('0x2')]('lead',_0xc0e1('0x3'),_0xc0e1('0x4')),'defaultValue':_0xc0e1('0x5')},'moduleSearch':{'type':Sequelize['ENUM']('contact_lead',_0xc0e1('0x3'),_0xc0e1('0x5')),'defaultValue':_0xc0e1('0x6')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index bf67bac..90e1a64 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 _0xd4d9=['getDescriptions','eml-format','rimraf','fast-json-patch','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','offset','undefined','count','limit','set','reject','save','update','end','error','stack','name','index','map','ZohoConfiguration','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','options','then','includeAll','include','findAll','rows','catch','show','params','create','body','find','getFields','findOne','ZohoField','length','getSubjects'];(function(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_0xd4d9,0xee));var _0x9d4d=function(_0x377ac0,_0x5c6208){_0x377ac0=_0x377ac0-0x0;var _0x230711=_0xd4d9[_0x377ac0];return _0x230711;};'use strict';var emlformat=require(_0x9d4d('0x0'));var rimraf=require(_0x9d4d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9d4d('0x2'));var rp=require('request-promise');var moment=require(_0x9d4d('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x9d4d('0x4'));var util=require(_0x9d4d('0x5'));var path=require(_0x9d4d('0x6'));var sox=require(_0x9d4d('0x7'));var csv=require(_0x9d4d('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9d4d('0x9'));var _=require(_0x9d4d('0xa'));var squel=require(_0x9d4d('0xb'));var crypto=require(_0x9d4d('0xc'));var jsforce=require(_0x9d4d('0xd'));var deskjs=require(_0x9d4d('0xe'));var toCsv=require('to-csv');var querystring=require(_0x9d4d('0xf'));var Papa=require(_0x9d4d('0x10'));var Redis=require(_0x9d4d('0x11'));var authService=require(_0x9d4d('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9d4d('0x13'));var logger=require(_0x9d4d('0x14'))(_0x9d4d('0x15'));var utils=require(_0x9d4d('0x16'));var config=require(_0x9d4d('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x9d4d('0x18'))['db'];function respondWithStatusCode(_0x576978,_0x190db4){_0x190db4=_0x190db4||0xcc;return function(_0x4575a1){if(_0x4575a1){return _0x576978[_0x9d4d('0x19')](_0x190db4);}return _0x576978[_0x9d4d('0x1a')](_0x190db4)['end']();};}function respondWithResult(_0x58121f,_0x19579a){_0x19579a=_0x19579a||0xc8;return function(_0x1e32a4){if(_0x1e32a4){return _0x58121f[_0x9d4d('0x1a')](_0x19579a)['json'](_0x1e32a4);}};}function respondWithFilteredResult(_0x458926,_0x2958d2){return function(_0x422ecc){if(_0x422ecc){var _0x44e3ce=typeof _0x2958d2[_0x9d4d('0x1b')]===_0x9d4d('0x1c')&&typeof _0x2958d2['limit']===_0x9d4d('0x1c');var _0x93c38e=_0x422ecc[_0x9d4d('0x1d')];var _0x490453=_0x44e3ce?0x0:_0x2958d2[_0x9d4d('0x1b')];var _0x457c6b=_0x44e3ce?_0x422ecc['count']:_0x2958d2['offset']+_0x2958d2[_0x9d4d('0x1e')];var _0x208f8f;if(_0x457c6b>=_0x93c38e){_0x457c6b=_0x93c38e;_0x208f8f=0xc8;}else{_0x208f8f=0xce;}_0x458926[_0x9d4d('0x1a')](_0x208f8f);return _0x458926[_0x9d4d('0x1f')]('Content-Range',_0x490453+'-'+_0x457c6b+'/'+_0x93c38e)['json'](_0x422ecc);}return null;};}function patchUpdates(_0x45f239){return function(_0x5e0111){try{jsonpatch['apply'](_0x5e0111,_0x45f239,!![]);}catch(_0x54c312){return BPromise[_0x9d4d('0x20')](_0x54c312);}return _0x5e0111[_0x9d4d('0x21')]();};}function saveUpdates(_0x4de25c,_0x54db39){return function(_0x1be041){if(_0x1be041){return _0x1be041[_0x9d4d('0x22')](_0x4de25c)['then'](function(_0x205578){return _0x205578;});}return null;};}function removeEntity(_0x643e98,_0x4226f3){return function(_0xe7dc6c){if(_0xe7dc6c){return _0xe7dc6c['destroy']()['then'](function(){_0x643e98[_0x9d4d('0x1a')](0xcc)[_0x9d4d('0x23')]();});}};}function handleEntityNotFound(_0x139028,_0x4cbd2a){return function(_0x569d25){if(!_0x569d25){_0x139028[_0x9d4d('0x19')](0x194);}return _0x569d25;};}function handleError(_0x1d1a8a,_0x6d6355){_0x6d6355=_0x6d6355||0x1f4;return function(_0x5f3046){logger[_0x9d4d('0x24')](_0x5f3046[_0x9d4d('0x25')]);if(_0x5f3046['name']){delete _0x5f3046[_0x9d4d('0x26')];}_0x1d1a8a[_0x9d4d('0x1a')](_0x6d6355)['send'](_0x5f3046);};}exports[_0x9d4d('0x27')]=function(_0xeb7629,_0x593dde){var _0x3e3888={},_0x16b7a6={},_0x16309a={'count':0x0,'rows':[]};var _0x47dd0a=_[_0x9d4d('0x28')](db[_0x9d4d('0x29')][_0x9d4d('0x2a')],function(_0x1ae70b){return{'name':_0x1ae70b[_0x9d4d('0x2b')],'type':_0x1ae70b['type'][_0x9d4d('0x2c')]};});_0x16b7a6[_0x9d4d('0x2d')]=_['map'](_0x47dd0a,_0x9d4d('0x26'));_0x16b7a6[_0x9d4d('0x2e')]=_[_0x9d4d('0x2f')](_0xeb7629[_0x9d4d('0x2e')]);_0x16b7a6[_0x9d4d('0x30')]=_[_0x9d4d('0x31')](_0x16b7a6[_0x9d4d('0x2d')],_0x16b7a6[_0x9d4d('0x2e')]);_0x3e3888[_0x9d4d('0x32')]=_[_0x9d4d('0x31')](_0x16b7a6['model'],qs[_0x9d4d('0x33')](_0xeb7629[_0x9d4d('0x2e')][_0x9d4d('0x33')]));_0x3e3888[_0x9d4d('0x32')]=_0x3e3888['attributes']['length']?_0x3e3888[_0x9d4d('0x32')]:_0x16b7a6['model'];if(!_0xeb7629[_0x9d4d('0x2e')][_0x9d4d('0x34')](_0x9d4d('0x35'))){_0x3e3888[_0x9d4d('0x1e')]=qs[_0x9d4d('0x1e')](_0xeb7629[_0x9d4d('0x2e')][_0x9d4d('0x1e')]);_0x3e3888[_0x9d4d('0x1b')]=qs[_0x9d4d('0x1b')](_0xeb7629[_0x9d4d('0x2e')][_0x9d4d('0x1b')]);}_0x3e3888[_0x9d4d('0x36')]=qs[_0x9d4d('0x37')](_0xeb7629[_0x9d4d('0x2e')][_0x9d4d('0x37')]);_0x3e3888[_0x9d4d('0x38')]=qs['filters'](_[_0x9d4d('0x39')](_0xeb7629['query'],_0x16b7a6['filters']),_0x47dd0a);if(_0xeb7629[_0x9d4d('0x2e')][_0x9d4d('0x3a')]){_0x3e3888[_0x9d4d('0x38')]=_[_0x9d4d('0x3b')](_0x3e3888[_0x9d4d('0x38')],{'$or':_['map'](_0x47dd0a,function(_0x43efff){if(_0x43efff[_0x9d4d('0x3c')]!=='VIRTUAL'){var _0x39dd73={};_0x39dd73[_0x43efff[_0x9d4d('0x26')]]={'$like':'%'+_0xeb7629[_0x9d4d('0x2e')]['filter']+'%'};return _0x39dd73;}})});}_0x3e3888=_[_0x9d4d('0x3b')]({},_0x3e3888,_0xeb7629[_0x9d4d('0x3d')]);var _0x1d01b8={'where':_0x3e3888['where']};return db['ZohoConfiguration'][_0x9d4d('0x1d')](_0x1d01b8)[_0x9d4d('0x3e')](function(_0x4ac268){_0x16309a[_0x9d4d('0x1d')]=_0x4ac268;if(_0xeb7629[_0x9d4d('0x2e')][_0x9d4d('0x3f')]){_0x3e3888[_0x9d4d('0x40')]=[{'all':!![]}];}return db['ZohoConfiguration'][_0x9d4d('0x41')](_0x3e3888);})['then'](function(_0x27a9be){_0x16309a[_0x9d4d('0x42')]=_0x27a9be;return _0x16309a;})[_0x9d4d('0x3e')](respondWithFilteredResult(_0x593dde,_0x3e3888))[_0x9d4d('0x43')](handleError(_0x593dde,null));};exports[_0x9d4d('0x44')]=function(_0x303183,_0xd718a9){var _0x19ea29={'raw':![],'where':{'id':_0x303183[_0x9d4d('0x45')]['id']}},_0x217274={};_0x217274[_0x9d4d('0x2d')]=_[_0x9d4d('0x2f')](db[_0x9d4d('0x29')][_0x9d4d('0x2a')]);_0x217274[_0x9d4d('0x2e')]=_['keys'](_0x303183[_0x9d4d('0x2e')]);_0x217274[_0x9d4d('0x30')]=_['intersection'](_0x217274[_0x9d4d('0x2d')],_0x217274['query']);_0x19ea29['attributes']=_['intersection'](_0x217274['model'],qs['fields'](_0x303183[_0x9d4d('0x2e')]['fields']));_0x19ea29[_0x9d4d('0x32')]=_0x19ea29['attributes']['length']?_0x19ea29['attributes']:_0x217274['model'];if(_0x303183[_0x9d4d('0x2e')][_0x9d4d('0x3f')]){_0x19ea29['include']=[{'all':!![]}];}_0x19ea29=_[_0x9d4d('0x3b')]({},_0x19ea29,_0x303183['options']);return db[_0x9d4d('0x29')]['find'](_0x19ea29)['then'](handleEntityNotFound(_0xd718a9,null))[_0x9d4d('0x3e')](respondWithResult(_0xd718a9,null))['catch'](handleError(_0xd718a9,null));};exports[_0x9d4d('0x46')]=function(_0x1a5d8a,_0x5cebe9){return db[_0x9d4d('0x29')][_0x9d4d('0x46')](_0x1a5d8a[_0x9d4d('0x47')],{})[_0x9d4d('0x3e')](respondWithResult(_0x5cebe9,0xc9))[_0x9d4d('0x43')](handleError(_0x5cebe9,null));};exports[_0x9d4d('0x22')]=function(_0x15de11,_0x12011d){if(_0x15de11['body']['id']){delete _0x15de11[_0x9d4d('0x47')]['id'];}return db[_0x9d4d('0x29')][_0x9d4d('0x48')]({'where':{'id':_0x15de11[_0x9d4d('0x45')]['id']}})[_0x9d4d('0x3e')](handleEntityNotFound(_0x12011d,null))[_0x9d4d('0x3e')](saveUpdates(_0x15de11[_0x9d4d('0x47')],null))['then'](respondWithResult(_0x12011d,null))[_0x9d4d('0x43')](handleError(_0x12011d,null));};exports['destroy']=function(_0x11675d,_0x4c5ff5){return db['ZohoConfiguration'][_0x9d4d('0x48')]({'where':{'id':_0x11675d[_0x9d4d('0x45')]['id']}})[_0x9d4d('0x3e')](handleEntityNotFound(_0x4c5ff5,null))[_0x9d4d('0x3e')](removeEntity(_0x4c5ff5,null))['catch'](handleError(_0x4c5ff5,null));};exports[_0x9d4d('0x49')]=function(_0x128e23,_0x48364e,_0x1b1c1e){var _0x3d13b1={};var _0x15f894={};var _0x4c1598;var _0x1536ba;return db[_0x9d4d('0x29')][_0x9d4d('0x4a')]({'where':{'id':_0x128e23['params']['id']}})[_0x9d4d('0x3e')](handleEntityNotFound(_0x48364e,null))[_0x9d4d('0x3e')](function(_0x31bbbd){if(_0x31bbbd){_0x4c1598=_0x31bbbd;_0x15f894['model']=_[_0x9d4d('0x2f')](db[_0x9d4d('0x4b')]['rawAttributes']);_0x15f894[_0x9d4d('0x2e')]=_[_0x9d4d('0x2f')](_0x128e23[_0x9d4d('0x2e')]);_0x15f894[_0x9d4d('0x30')]=_[_0x9d4d('0x31')](_0x15f894['model'],_0x15f894['query']);_0x3d13b1[_0x9d4d('0x32')]=_[_0x9d4d('0x31')](_0x15f894['model'],qs[_0x9d4d('0x33')](_0x128e23[_0x9d4d('0x2e')][_0x9d4d('0x33')]));_0x3d13b1[_0x9d4d('0x32')]=_0x3d13b1[_0x9d4d('0x32')][_0x9d4d('0x4c')]?_0x3d13b1['attributes']:_0x15f894[_0x9d4d('0x2d')];_0x3d13b1['order']=qs['sort'](_0x128e23[_0x9d4d('0x2e')][_0x9d4d('0x37')]);_0x3d13b1['where']=qs[_0x9d4d('0x30')](_[_0x9d4d('0x39')](_0x128e23['query'],_0x15f894[_0x9d4d('0x30')]));if(_0x128e23[_0x9d4d('0x2e')][_0x9d4d('0x3a')]){_0x3d13b1[_0x9d4d('0x38')]=_[_0x9d4d('0x3b')](_0x3d13b1[_0x9d4d('0x38')],{'$or':_[_0x9d4d('0x28')](_0x3d13b1[_0x9d4d('0x32')],function(_0x33b111){var _0x56a243={};_0x56a243[_0x33b111]={'$like':'%'+_0x128e23[_0x9d4d('0x2e')][_0x9d4d('0x3a')]+'%'};return _0x56a243;})});}_0x3d13b1=_['merge']({},_0x3d13b1,_0x128e23[_0x9d4d('0x3d')]);return _0x4c1598[_0x9d4d('0x49')](_0x3d13b1);}})[_0x9d4d('0x3e')](function(_0x1d4b63){if(_0x1d4b63){_0x1536ba=_0x1d4b63[_0x9d4d('0x4c')];if(!_0x128e23[_0x9d4d('0x2e')]['hasOwnProperty'](_0x9d4d('0x35'))){_0x3d13b1[_0x9d4d('0x1e')]=qs['limit'](_0x128e23['query'][_0x9d4d('0x1e')]);_0x3d13b1[_0x9d4d('0x1b')]=qs[_0x9d4d('0x1b')](_0x128e23[_0x9d4d('0x2e')][_0x9d4d('0x1b')]);}return _0x4c1598['getFields'](_0x3d13b1);}})[_0x9d4d('0x3e')](function(_0x497ad0){if(_0x497ad0){return _0x497ad0?{'count':_0x1536ba,'rows':_0x497ad0}:null;}})[_0x9d4d('0x3e')](respondWithResult(_0x48364e,null))[_0x9d4d('0x43')](handleError(_0x48364e,null));};exports[_0x9d4d('0x4d')]=function(_0x182a49,_0x766690,_0x59fcc0){var _0x17b232={};var _0x4a31fd={};var _0x414819;var _0x42a57b;return db['ZohoConfiguration'][_0x9d4d('0x4a')]({'where':{'id':_0x182a49[_0x9d4d('0x45')]['id']}})[_0x9d4d('0x3e')](handleEntityNotFound(_0x766690,null))['then'](function(_0x361fb6){if(_0x361fb6){_0x414819=_0x361fb6;_0x4a31fd['model']=_[_0x9d4d('0x2f')](db[_0x9d4d('0x4b')]['rawAttributes']);_0x4a31fd[_0x9d4d('0x2e')]=_[_0x9d4d('0x2f')](_0x182a49['query']);_0x4a31fd[_0x9d4d('0x30')]=_[_0x9d4d('0x31')](_0x4a31fd[_0x9d4d('0x2d')],_0x4a31fd['query']);_0x17b232[_0x9d4d('0x32')]=_[_0x9d4d('0x31')](_0x4a31fd['model'],qs[_0x9d4d('0x33')](_0x182a49['query']['fields']));_0x17b232[_0x9d4d('0x32')]=_0x17b232[_0x9d4d('0x32')][_0x9d4d('0x4c')]?_0x17b232[_0x9d4d('0x32')]:_0x4a31fd['model'];_0x17b232['order']=qs['sort'](_0x182a49['query'][_0x9d4d('0x37')]);_0x17b232[_0x9d4d('0x38')]=qs[_0x9d4d('0x30')](_['pick'](_0x182a49[_0x9d4d('0x2e')],_0x4a31fd[_0x9d4d('0x30')]));if(_0x182a49[_0x9d4d('0x2e')]['filter']){_0x17b232[_0x9d4d('0x38')]=_[_0x9d4d('0x3b')](_0x17b232['where'],{'$or':_[_0x9d4d('0x28')](_0x17b232['attributes'],function(_0x198d40){var _0x18d47b={};_0x18d47b[_0x198d40]={'$like':'%'+_0x182a49[_0x9d4d('0x2e')][_0x9d4d('0x3a')]+'%'};return _0x18d47b;})});}_0x17b232=_['merge']({},_0x17b232,_0x182a49['options']);return _0x414819[_0x9d4d('0x4d')](_0x17b232);}})['then'](function(_0x54872b){if(_0x54872b){_0x42a57b=_0x54872b[_0x9d4d('0x4c')];if(!_0x182a49[_0x9d4d('0x2e')][_0x9d4d('0x34')](_0x9d4d('0x35'))){_0x17b232[_0x9d4d('0x1e')]=qs[_0x9d4d('0x1e')](_0x182a49[_0x9d4d('0x2e')]['limit']);_0x17b232[_0x9d4d('0x1b')]=qs['offset'](_0x182a49[_0x9d4d('0x2e')]['offset']);}return _0x414819[_0x9d4d('0x4d')](_0x17b232);}})[_0x9d4d('0x3e')](function(_0x51e441){if(_0x51e441){return _0x51e441?{'count':_0x42a57b,'rows':_0x51e441}:null;}})[_0x9d4d('0x3e')](respondWithResult(_0x766690,null))[_0x9d4d('0x43')](handleError(_0x766690,null));};exports['getDescriptions']=function(_0x3396b8,_0x3f0525,_0x11336a){var _0x426d8d={};var _0x76bf05={};var _0x445578;var _0xc10e09;return db[_0x9d4d('0x29')][_0x9d4d('0x4a')]({'where':{'id':_0x3396b8[_0x9d4d('0x45')]['id']}})[_0x9d4d('0x3e')](handleEntityNotFound(_0x3f0525,null))[_0x9d4d('0x3e')](function(_0x1c088f){if(_0x1c088f){_0x445578=_0x1c088f;_0x76bf05[_0x9d4d('0x2d')]=_[_0x9d4d('0x2f')](db[_0x9d4d('0x4b')][_0x9d4d('0x2a')]);_0x76bf05[_0x9d4d('0x2e')]=_[_0x9d4d('0x2f')](_0x3396b8['query']);_0x76bf05['filters']=_[_0x9d4d('0x31')](_0x76bf05[_0x9d4d('0x2d')],_0x76bf05['query']);_0x426d8d[_0x9d4d('0x32')]=_['intersection'](_0x76bf05['model'],qs[_0x9d4d('0x33')](_0x3396b8[_0x9d4d('0x2e')][_0x9d4d('0x33')]));_0x426d8d['attributes']=_0x426d8d[_0x9d4d('0x32')][_0x9d4d('0x4c')]?_0x426d8d[_0x9d4d('0x32')]:_0x76bf05[_0x9d4d('0x2d')];_0x426d8d[_0x9d4d('0x36')]=qs[_0x9d4d('0x37')](_0x3396b8['query'][_0x9d4d('0x37')]);_0x426d8d[_0x9d4d('0x38')]=qs[_0x9d4d('0x30')](_[_0x9d4d('0x39')](_0x3396b8[_0x9d4d('0x2e')],_0x76bf05[_0x9d4d('0x30')]));if(_0x3396b8['query']['filter']){_0x426d8d[_0x9d4d('0x38')]=_[_0x9d4d('0x3b')](_0x426d8d[_0x9d4d('0x38')],{'$or':_[_0x9d4d('0x28')](_0x426d8d[_0x9d4d('0x32')],function(_0xa5e4a0){var _0x4928ad={};_0x4928ad[_0xa5e4a0]={'$like':'%'+_0x3396b8[_0x9d4d('0x2e')][_0x9d4d('0x3a')]+'%'};return _0x4928ad;})});}_0x426d8d=_[_0x9d4d('0x3b')]({},_0x426d8d,_0x3396b8['options']);return _0x445578[_0x9d4d('0x4e')](_0x426d8d);}})[_0x9d4d('0x3e')](function(_0x23cf87){if(_0x23cf87){_0xc10e09=_0x23cf87[_0x9d4d('0x4c')];if(!_0x3396b8['query']['hasOwnProperty']('nolimit')){_0x426d8d[_0x9d4d('0x1e')]=qs[_0x9d4d('0x1e')](_0x3396b8[_0x9d4d('0x2e')][_0x9d4d('0x1e')]);_0x426d8d[_0x9d4d('0x1b')]=qs[_0x9d4d('0x1b')](_0x3396b8[_0x9d4d('0x2e')][_0x9d4d('0x1b')]);}return _0x445578['getDescriptions'](_0x426d8d);}})[_0x9d4d('0x3e')](function(_0x16b4b2){if(_0x16b4b2){return _0x16b4b2?{'count':_0xc10e09,'rows':_0x16b4b2}:null;}})[_0x9d4d('0x3e')](respondWithResult(_0x3f0525,null))[_0x9d4d('0x43')](handleError(_0x3f0525,null));}; \ No newline at end of file +var _0xa2d2=['../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','then','error','name','send','index','map','ZohoConfiguration','rawAttributes','fieldName','type','key','query','filters','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','keys','find','create','body','update','destroy','params','findOne','ZohoField','intersection','getFields','getSubjects','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','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x504a10,_0x23456b){var _0x55384f=function(_0x12aa56){while(--_0x12aa56){_0x504a10['push'](_0x504a10['shift']());}};_0x55384f(++_0x23456b);}(_0xa2d2,0x1e6));var _0x2a2d=function(_0x2373b8,_0x545a08){_0x2373b8=_0x2373b8-0x0;var _0xbfef30=_0xa2d2[_0x2373b8];return _0xbfef30;};'use strict';var emlformat=require(_0x2a2d('0x0'));var rimraf=require(_0x2a2d('0x1'));var zipdir=require(_0x2a2d('0x2'));var jsonpatch=require(_0x2a2d('0x3'));var rp=require(_0x2a2d('0x4'));var moment=require(_0x2a2d('0x5'));var BPromise=require(_0x2a2d('0x6'));var Mustache=require(_0x2a2d('0x7'));var util=require(_0x2a2d('0x8'));var path=require(_0x2a2d('0x9'));var sox=require(_0x2a2d('0xa'));var csv=require(_0x2a2d('0xb'));var ejs=require(_0x2a2d('0xc'));var fs=require('fs');var fs_extra=require(_0x2a2d('0xd'));var _=require(_0x2a2d('0xe'));var squel=require(_0x2a2d('0xf'));var crypto=require(_0x2a2d('0x10'));var jsforce=require(_0x2a2d('0x11'));var deskjs=require(_0x2a2d('0x12'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2a2d('0x13'));var Redis=require(_0x2a2d('0x14'));var authService=require(_0x2a2d('0x15'));var qs=require(_0x2a2d('0x16'));var as=require(_0x2a2d('0x17'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2a2d('0x18'))('api');var utils=require(_0x2a2d('0x19'));var config=require(_0x2a2d('0x1a'));var licenseUtil=require(_0x2a2d('0x1b'));var db=require(_0x2a2d('0x1c'))['db'];function respondWithStatusCode(_0x2b5abb,_0x48e140){_0x48e140=_0x48e140||0xcc;return function(_0x418e5c){if(_0x418e5c){return _0x2b5abb[_0x2a2d('0x1d')](_0x48e140);}return _0x2b5abb[_0x2a2d('0x1e')](_0x48e140)[_0x2a2d('0x1f')]();};}function respondWithResult(_0x2ade34,_0x2360c7){_0x2360c7=_0x2360c7||0xc8;return function(_0x247f8a){if(_0x247f8a){return _0x2ade34[_0x2a2d('0x1e')](_0x2360c7)[_0x2a2d('0x20')](_0x247f8a);}};}function respondWithFilteredResult(_0x36f7fc,_0x429e7f){return function(_0x201d5b){if(_0x201d5b){var _0x31e126=typeof _0x429e7f[_0x2a2d('0x21')]===_0x2a2d('0x22')&&typeof _0x429e7f[_0x2a2d('0x23')]==='undefined';var _0x5ee119=_0x201d5b[_0x2a2d('0x24')];var _0x4f0bb7=_0x31e126?0x0:_0x429e7f[_0x2a2d('0x21')];var _0x5a8760=_0x31e126?_0x201d5b[_0x2a2d('0x24')]:_0x429e7f['offset']+_0x429e7f[_0x2a2d('0x23')];var _0x2fe472;if(_0x5a8760>=_0x5ee119){_0x5a8760=_0x5ee119;_0x2fe472=0xc8;}else{_0x2fe472=0xce;}_0x36f7fc[_0x2a2d('0x1e')](_0x2fe472);return _0x36f7fc[_0x2a2d('0x25')](_0x2a2d('0x26'),_0x4f0bb7+'-'+_0x5a8760+'/'+_0x5ee119)[_0x2a2d('0x20')](_0x201d5b);}return null;};}function patchUpdates(_0x27d91f){return function(_0x100cbb){try{jsonpatch[_0x2a2d('0x27')](_0x100cbb,_0x27d91f,!![]);}catch(_0x2bd34d){return BPromise['reject'](_0x2bd34d);}return _0x100cbb['save']();};}function saveUpdates(_0x415550,_0x49864e){return function(_0x9050e7){if(_0x9050e7){return _0x9050e7['update'](_0x415550)['then'](function(_0x1902a1){return _0x1902a1;});}return null;};}function removeEntity(_0x1b695c,_0x47d00c){return function(_0x4744a0){if(_0x4744a0){return _0x4744a0['destroy']()[_0x2a2d('0x28')](function(){_0x1b695c['status'](0xcc)[_0x2a2d('0x1f')]();});}};}function handleEntityNotFound(_0x11e4c7,_0x1627ef){return function(_0xa4c9ce){if(!_0xa4c9ce){_0x11e4c7[_0x2a2d('0x1d')](0x194);}return _0xa4c9ce;};}function handleError(_0x5cce42,_0x3852a6){_0x3852a6=_0x3852a6||0x1f4;return function(_0x256964){logger[_0x2a2d('0x29')](_0x256964['stack']);if(_0x256964[_0x2a2d('0x2a')]){delete _0x256964['name'];}_0x5cce42[_0x2a2d('0x1e')](_0x3852a6)[_0x2a2d('0x2b')](_0x256964);};}exports[_0x2a2d('0x2c')]=function(_0xcc6cd2,_0x34e7da){var _0x6a1386={},_0x5b9f9b={},_0x2df70a={'count':0x0,'rows':[]};var _0xbb4d40=_[_0x2a2d('0x2d')](db[_0x2a2d('0x2e')][_0x2a2d('0x2f')],function(_0x41d616){return{'name':_0x41d616[_0x2a2d('0x30')],'type':_0x41d616[_0x2a2d('0x31')][_0x2a2d('0x32')]};});_0x5b9f9b['model']=_[_0x2a2d('0x2d')](_0xbb4d40,_0x2a2d('0x2a'));_0x5b9f9b[_0x2a2d('0x33')]=_['keys'](_0xcc6cd2['query']);_0x5b9f9b[_0x2a2d('0x34')]=_['intersection'](_0x5b9f9b['model'],_0x5b9f9b[_0x2a2d('0x33')]);_0x6a1386[_0x2a2d('0x35')]=_['intersection'](_0x5b9f9b[_0x2a2d('0x36')],qs['fields'](_0xcc6cd2[_0x2a2d('0x33')][_0x2a2d('0x37')]));_0x6a1386[_0x2a2d('0x35')]=_0x6a1386[_0x2a2d('0x35')][_0x2a2d('0x38')]?_0x6a1386[_0x2a2d('0x35')]:_0x5b9f9b[_0x2a2d('0x36')];if(!_0xcc6cd2[_0x2a2d('0x33')][_0x2a2d('0x39')](_0x2a2d('0x3a'))){_0x6a1386[_0x2a2d('0x23')]=qs[_0x2a2d('0x23')](_0xcc6cd2['query'][_0x2a2d('0x23')]);_0x6a1386[_0x2a2d('0x21')]=qs[_0x2a2d('0x21')](_0xcc6cd2[_0x2a2d('0x33')][_0x2a2d('0x21')]);}_0x6a1386[_0x2a2d('0x3b')]=qs[_0x2a2d('0x3c')](_0xcc6cd2['query'][_0x2a2d('0x3c')]);_0x6a1386['where']=qs[_0x2a2d('0x34')](_[_0x2a2d('0x3d')](_0xcc6cd2['query'],_0x5b9f9b[_0x2a2d('0x34')]),_0xbb4d40);if(_0xcc6cd2[_0x2a2d('0x33')][_0x2a2d('0x3e')]){_0x6a1386[_0x2a2d('0x3f')]=_[_0x2a2d('0x40')](_0x6a1386[_0x2a2d('0x3f')],{'$or':_[_0x2a2d('0x2d')](_0xbb4d40,function(_0xdbb512){if(_0xdbb512[_0x2a2d('0x31')]!==_0x2a2d('0x41')){var _0x45c963={};_0x45c963[_0xdbb512[_0x2a2d('0x2a')]]={'$like':'%'+_0xcc6cd2[_0x2a2d('0x33')][_0x2a2d('0x3e')]+'%'};return _0x45c963;}})});}_0x6a1386=_[_0x2a2d('0x40')]({},_0x6a1386,_0xcc6cd2[_0x2a2d('0x42')]);var _0x5a6681={'where':_0x6a1386[_0x2a2d('0x3f')]};return db[_0x2a2d('0x2e')]['count'](_0x5a6681)[_0x2a2d('0x28')](function(_0x841196){_0x2df70a[_0x2a2d('0x24')]=_0x841196;if(_0xcc6cd2[_0x2a2d('0x33')][_0x2a2d('0x43')]){_0x6a1386[_0x2a2d('0x44')]=[{'all':!![]}];}return db[_0x2a2d('0x2e')][_0x2a2d('0x45')](_0x6a1386);})['then'](function(_0x1ec71a){_0x2df70a['rows']=_0x1ec71a;return _0x2df70a;})[_0x2a2d('0x28')](respondWithFilteredResult(_0x34e7da,_0x6a1386))[_0x2a2d('0x46')](handleError(_0x34e7da,null));};exports[_0x2a2d('0x47')]=function(_0x2d18f9,_0x2548b4){var _0x3e2aae={'raw':![],'where':{'id':_0x2d18f9['params']['id']}},_0x3fbb99={};_0x3fbb99[_0x2a2d('0x36')]=_[_0x2a2d('0x48')](db[_0x2a2d('0x2e')]['rawAttributes']);_0x3fbb99[_0x2a2d('0x33')]=_[_0x2a2d('0x48')](_0x2d18f9[_0x2a2d('0x33')]);_0x3fbb99[_0x2a2d('0x34')]=_['intersection'](_0x3fbb99['model'],_0x3fbb99['query']);_0x3e2aae['attributes']=_['intersection'](_0x3fbb99['model'],qs[_0x2a2d('0x37')](_0x2d18f9[_0x2a2d('0x33')][_0x2a2d('0x37')]));_0x3e2aae[_0x2a2d('0x35')]=_0x3e2aae[_0x2a2d('0x35')][_0x2a2d('0x38')]?_0x3e2aae[_0x2a2d('0x35')]:_0x3fbb99[_0x2a2d('0x36')];if(_0x2d18f9[_0x2a2d('0x33')][_0x2a2d('0x43')]){_0x3e2aae[_0x2a2d('0x44')]=[{'all':!![]}];}_0x3e2aae=_['merge']({},_0x3e2aae,_0x2d18f9['options']);return db['ZohoConfiguration'][_0x2a2d('0x49')](_0x3e2aae)['then'](handleEntityNotFound(_0x2548b4,null))[_0x2a2d('0x28')](respondWithResult(_0x2548b4,null))[_0x2a2d('0x46')](handleError(_0x2548b4,null));};exports['create']=function(_0x4077c3,_0x59dff0){return db['ZohoConfiguration'][_0x2a2d('0x4a')](_0x4077c3[_0x2a2d('0x4b')],{})[_0x2a2d('0x28')](respondWithResult(_0x59dff0,0xc9))[_0x2a2d('0x46')](handleError(_0x59dff0,null));};exports[_0x2a2d('0x4c')]=function(_0x39da39,_0x164eea){if(_0x39da39[_0x2a2d('0x4b')]['id']){delete _0x39da39[_0x2a2d('0x4b')]['id'];}return db[_0x2a2d('0x2e')]['find']({'where':{'id':_0x39da39['params']['id']}})['then'](handleEntityNotFound(_0x164eea,null))[_0x2a2d('0x28')](saveUpdates(_0x39da39[_0x2a2d('0x4b')],null))['then'](respondWithResult(_0x164eea,null))['catch'](handleError(_0x164eea,null));};exports[_0x2a2d('0x4d')]=function(_0x444364,_0x19aabf){return db['ZohoConfiguration'][_0x2a2d('0x49')]({'where':{'id':_0x444364[_0x2a2d('0x4e')]['id']}})[_0x2a2d('0x28')](handleEntityNotFound(_0x19aabf,null))[_0x2a2d('0x28')](removeEntity(_0x19aabf,null))[_0x2a2d('0x46')](handleError(_0x19aabf,null));};exports['getFields']=function(_0x4352d8,_0x5255d7,_0x366d8f){var _0x1a2257={};var _0x320710={};var _0x4b93e2;var _0x57ce29;return db[_0x2a2d('0x2e')][_0x2a2d('0x4f')]({'where':{'id':_0x4352d8[_0x2a2d('0x4e')]['id']}})[_0x2a2d('0x28')](handleEntityNotFound(_0x5255d7,null))[_0x2a2d('0x28')](function(_0x22d8dc){if(_0x22d8dc){_0x4b93e2=_0x22d8dc;_0x320710[_0x2a2d('0x36')]=_[_0x2a2d('0x48')](db[_0x2a2d('0x50')]['rawAttributes']);_0x320710['query']=_[_0x2a2d('0x48')](_0x4352d8[_0x2a2d('0x33')]);_0x320710[_0x2a2d('0x34')]=_['intersection'](_0x320710['model'],_0x320710[_0x2a2d('0x33')]);_0x1a2257['attributes']=_[_0x2a2d('0x51')](_0x320710[_0x2a2d('0x36')],qs[_0x2a2d('0x37')](_0x4352d8[_0x2a2d('0x33')][_0x2a2d('0x37')]));_0x1a2257[_0x2a2d('0x35')]=_0x1a2257[_0x2a2d('0x35')][_0x2a2d('0x38')]?_0x1a2257['attributes']:_0x320710['model'];_0x1a2257[_0x2a2d('0x3b')]=qs[_0x2a2d('0x3c')](_0x4352d8[_0x2a2d('0x33')][_0x2a2d('0x3c')]);_0x1a2257[_0x2a2d('0x3f')]=qs[_0x2a2d('0x34')](_[_0x2a2d('0x3d')](_0x4352d8[_0x2a2d('0x33')],_0x320710[_0x2a2d('0x34')]));if(_0x4352d8[_0x2a2d('0x33')]['filter']){_0x1a2257[_0x2a2d('0x3f')]=_[_0x2a2d('0x40')](_0x1a2257[_0x2a2d('0x3f')],{'$or':_[_0x2a2d('0x2d')](_0x1a2257[_0x2a2d('0x35')],function(_0x117048){var _0x443279={};_0x443279[_0x117048]={'$like':'%'+_0x4352d8[_0x2a2d('0x33')][_0x2a2d('0x3e')]+'%'};return _0x443279;})});}_0x1a2257=_['merge']({},_0x1a2257,_0x4352d8[_0x2a2d('0x42')]);return _0x4b93e2[_0x2a2d('0x52')](_0x1a2257);}})[_0x2a2d('0x28')](function(_0x30ac2a){if(_0x30ac2a){_0x57ce29=_0x30ac2a[_0x2a2d('0x38')];if(!_0x4352d8[_0x2a2d('0x33')]['hasOwnProperty'](_0x2a2d('0x3a'))){_0x1a2257['limit']=qs[_0x2a2d('0x23')](_0x4352d8[_0x2a2d('0x33')][_0x2a2d('0x23')]);_0x1a2257[_0x2a2d('0x21')]=qs[_0x2a2d('0x21')](_0x4352d8[_0x2a2d('0x33')][_0x2a2d('0x21')]);}return _0x4b93e2[_0x2a2d('0x52')](_0x1a2257);}})[_0x2a2d('0x28')](function(_0x56a4da){if(_0x56a4da){return _0x56a4da?{'count':_0x57ce29,'rows':_0x56a4da}:null;}})[_0x2a2d('0x28')](respondWithResult(_0x5255d7,null))[_0x2a2d('0x46')](handleError(_0x5255d7,null));};exports[_0x2a2d('0x53')]=function(_0x37472f,_0x294e2b,_0x58a0ed){var _0x778bd2={};var _0x361f32={};var _0x444b75;var _0x8520b3;return db[_0x2a2d('0x2e')][_0x2a2d('0x4f')]({'where':{'id':_0x37472f[_0x2a2d('0x4e')]['id']}})[_0x2a2d('0x28')](handleEntityNotFound(_0x294e2b,null))[_0x2a2d('0x28')](function(_0x51a8e0){if(_0x51a8e0){_0x444b75=_0x51a8e0;_0x361f32[_0x2a2d('0x36')]=_[_0x2a2d('0x48')](db['ZohoField'][_0x2a2d('0x2f')]);_0x361f32['query']=_[_0x2a2d('0x48')](_0x37472f[_0x2a2d('0x33')]);_0x361f32[_0x2a2d('0x34')]=_[_0x2a2d('0x51')](_0x361f32[_0x2a2d('0x36')],_0x361f32['query']);_0x778bd2['attributes']=_['intersection'](_0x361f32['model'],qs[_0x2a2d('0x37')](_0x37472f[_0x2a2d('0x33')]['fields']));_0x778bd2[_0x2a2d('0x35')]=_0x778bd2['attributes'][_0x2a2d('0x38')]?_0x778bd2[_0x2a2d('0x35')]:_0x361f32[_0x2a2d('0x36')];_0x778bd2[_0x2a2d('0x3b')]=qs[_0x2a2d('0x3c')](_0x37472f[_0x2a2d('0x33')][_0x2a2d('0x3c')]);_0x778bd2[_0x2a2d('0x3f')]=qs['filters'](_[_0x2a2d('0x3d')](_0x37472f[_0x2a2d('0x33')],_0x361f32[_0x2a2d('0x34')]));if(_0x37472f[_0x2a2d('0x33')][_0x2a2d('0x3e')]){_0x778bd2[_0x2a2d('0x3f')]=_[_0x2a2d('0x40')](_0x778bd2[_0x2a2d('0x3f')],{'$or':_['map'](_0x778bd2[_0x2a2d('0x35')],function(_0x817f1c){var _0x365d0b={};_0x365d0b[_0x817f1c]={'$like':'%'+_0x37472f['query'][_0x2a2d('0x3e')]+'%'};return _0x365d0b;})});}_0x778bd2=_[_0x2a2d('0x40')]({},_0x778bd2,_0x37472f['options']);return _0x444b75[_0x2a2d('0x53')](_0x778bd2);}})[_0x2a2d('0x28')](function(_0xaff02f){if(_0xaff02f){_0x8520b3=_0xaff02f[_0x2a2d('0x38')];if(!_0x37472f[_0x2a2d('0x33')][_0x2a2d('0x39')](_0x2a2d('0x3a'))){_0x778bd2[_0x2a2d('0x23')]=qs[_0x2a2d('0x23')](_0x37472f[_0x2a2d('0x33')][_0x2a2d('0x23')]);_0x778bd2['offset']=qs[_0x2a2d('0x21')](_0x37472f['query'][_0x2a2d('0x21')]);}return _0x444b75[_0x2a2d('0x53')](_0x778bd2);}})[_0x2a2d('0x28')](function(_0x2c5452){if(_0x2c5452){return _0x2c5452?{'count':_0x8520b3,'rows':_0x2c5452}:null;}})[_0x2a2d('0x28')](respondWithResult(_0x294e2b,null))[_0x2a2d('0x46')](handleError(_0x294e2b,null));};exports[_0x2a2d('0x54')]=function(_0x51ef61,_0x3a73ba,_0x2d7f6e){var _0x50f3aa={};var _0x5f2e9c={};var _0xcbb2ce;var _0x2dd1c9;return db['ZohoConfiguration'][_0x2a2d('0x4f')]({'where':{'id':_0x51ef61[_0x2a2d('0x4e')]['id']}})[_0x2a2d('0x28')](handleEntityNotFound(_0x3a73ba,null))[_0x2a2d('0x28')](function(_0x2acf0e){if(_0x2acf0e){_0xcbb2ce=_0x2acf0e;_0x5f2e9c[_0x2a2d('0x36')]=_[_0x2a2d('0x48')](db[_0x2a2d('0x50')][_0x2a2d('0x2f')]);_0x5f2e9c['query']=_[_0x2a2d('0x48')](_0x51ef61['query']);_0x5f2e9c['filters']=_[_0x2a2d('0x51')](_0x5f2e9c[_0x2a2d('0x36')],_0x5f2e9c['query']);_0x50f3aa[_0x2a2d('0x35')]=_[_0x2a2d('0x51')](_0x5f2e9c[_0x2a2d('0x36')],qs[_0x2a2d('0x37')](_0x51ef61[_0x2a2d('0x33')]['fields']));_0x50f3aa[_0x2a2d('0x35')]=_0x50f3aa[_0x2a2d('0x35')]['length']?_0x50f3aa['attributes']:_0x5f2e9c[_0x2a2d('0x36')];_0x50f3aa['order']=qs[_0x2a2d('0x3c')](_0x51ef61[_0x2a2d('0x33')][_0x2a2d('0x3c')]);_0x50f3aa[_0x2a2d('0x3f')]=qs[_0x2a2d('0x34')](_[_0x2a2d('0x3d')](_0x51ef61['query'],_0x5f2e9c[_0x2a2d('0x34')]));if(_0x51ef61[_0x2a2d('0x33')]['filter']){_0x50f3aa[_0x2a2d('0x3f')]=_['merge'](_0x50f3aa['where'],{'$or':_[_0x2a2d('0x2d')](_0x50f3aa[_0x2a2d('0x35')],function(_0x19aa8f){var _0x442599={};_0x442599[_0x19aa8f]={'$like':'%'+_0x51ef61[_0x2a2d('0x33')][_0x2a2d('0x3e')]+'%'};return _0x442599;})});}_0x50f3aa=_[_0x2a2d('0x40')]({},_0x50f3aa,_0x51ef61[_0x2a2d('0x42')]);return _0xcbb2ce[_0x2a2d('0x54')](_0x50f3aa);}})[_0x2a2d('0x28')](function(_0xb89f2b){if(_0xb89f2b){_0x2dd1c9=_0xb89f2b[_0x2a2d('0x38')];if(!_0x51ef61[_0x2a2d('0x33')][_0x2a2d('0x39')](_0x2a2d('0x3a'))){_0x50f3aa[_0x2a2d('0x23')]=qs[_0x2a2d('0x23')](_0x51ef61[_0x2a2d('0x33')][_0x2a2d('0x23')]);_0x50f3aa['offset']=qs[_0x2a2d('0x21')](_0x51ef61[_0x2a2d('0x33')][_0x2a2d('0x21')]);}return _0xcbb2ce[_0x2a2d('0x54')](_0x50f3aa);}})[_0x2a2d('0x28')](function(_0x2ea994){if(_0x2ea994){return _0x2ea994?{'count':_0x2dd1c9,'rows':_0x2ea994}:null;}})['then'](respondWithResult(_0x3a73ba,null))[_0x2a2d('0x46')](handleError(_0x3a73ba,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index c527e76..caf1125 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 _0xef63=['./intZohoConfiguration.attributes','exports','define','ZohoConfiguration','int_zoho_configurations','util','../../config/logger','api','moment','path','rimraf','../../config/environment'];(function(_0x1458dc,_0x8968ff){var _0x428dcc=function(_0x31bbd3){while(--_0x31bbd3){_0x1458dc['push'](_0x1458dc['shift']());}};_0x428dcc(++_0x8968ff);}(_0xef63,0x13d));var _0x3ef6=function(_0x52f0c8,_0xa4c8bc){_0x52f0c8=_0x52f0c8-0x0;var _0x43bffa=_0xef63[_0x52f0c8];return _0x43bffa;};'use strict';var _=require('lodash');var util=require(_0x3ef6('0x0'));var logger=require(_0x3ef6('0x1'))(_0x3ef6('0x2'));var moment=require(_0x3ef6('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x3ef6('0x4'));var rimraf=require(_0x3ef6('0x5'));var config=require(_0x3ef6('0x6'));var attributes=require(_0x3ef6('0x7'));module[_0x3ef6('0x8')]=function(_0x16cb27,_0xc698c1){return _0x16cb27[_0x3ef6('0x9')](_0x3ef6('0xa'),attributes,{'tableName':_0x3ef6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0447=['exports','define','ZohoConfiguration','int_zoho_configurations','api','moment','request-promise','path','rimraf','../../config/environment','./intZohoConfiguration.attributes'];(function(_0x1969a7,_0x5a133a){var _0x3d665f=function(_0x39c64b){while(--_0x39c64b){_0x1969a7['push'](_0x1969a7['shift']());}};_0x3d665f(++_0x5a133a);}(_0x0447,0x88));var _0x7044=function(_0x1d6e21,_0x74504f){_0x1d6e21=_0x1d6e21-0x0;var _0x24b7df=_0x0447[_0x1d6e21];return _0x24b7df;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x7044('0x0'));var moment=require(_0x7044('0x1'));var BPromise=require('bluebird');var rp=require(_0x7044('0x2'));var fs=require('fs');var path=require(_0x7044('0x3'));var rimraf=require(_0x7044('0x4'));var config=require(_0x7044('0x5'));var attributes=require(_0x7044('0x6'));module[_0x7044('0x7')]=function(_0x8b330c,_0x31003f){return _0x8b330c[_0x7044('0x8')](_0x7044('0x9'),attributes,{'tableName':_0x7044('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js b/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js index 0583895..e038aaa 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 _0xa131=['util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash'];(function(_0x3c4a7c,_0x2f4e3c){var _0xf13d1e=function(_0x24cb78){while(--_0x24cb78){_0x3c4a7c['push'](_0x3c4a7c['shift']());}};_0xf13d1e(++_0x2f4e3c);}(_0xa131,0x149));var _0x1a13=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0xa131[_0x30ae5e];return _0x1f2e93;};'use strict';var _=require(_0x1a13('0x0'));var util=require(_0x1a13('0x1'));var moment=require(_0x1a13('0x2'));var BPromise=require(_0x1a13('0x3'));var rs=require(_0x1a13('0x4'));var fs=require('fs');var Redis=require(_0x1a13('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x1a13('0x6'));var logger=require(_0x1a13('0x7'))('rpc');var config=require(_0x1a13('0x8'));var jayson=require(_0x1a13('0x9'));var client=jayson['client'][_0x1a13('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5b61d6,_0xba559b,_0xc0ed43){return new BPromise(function(_0x10d667,_0x1e4ec7){return client[_0x1a13('0xb')](_0x5b61d6,_0xc0ed43)['then'](function(_0x173e43){logger[_0x1a13('0xc')](_0x1a13('0xd'),_0xba559b,_0x1a13('0xe'));logger[_0x1a13('0xf')](_0x1a13('0x10'),_0xba559b,_0x1a13('0xe'),JSON[_0x1a13('0x11')](_0x173e43));if(_0x173e43[_0x1a13('0x12')]){if(_0x173e43[_0x1a13('0x12')][_0x1a13('0x13')]===0x1f4){logger[_0x1a13('0x12')](_0x1a13('0xd'),_0xba559b,_0x173e43[_0x1a13('0x12')][_0x1a13('0x14')]);return _0x1e4ec7(_0x173e43[_0x1a13('0x12')][_0x1a13('0x14')]);}logger[_0x1a13('0x12')]('ZohoConfiguration,\x20%s,\x20%s',_0xba559b,_0x173e43[_0x1a13('0x12')][_0x1a13('0x14')]);return _0x10d667(_0x173e43[_0x1a13('0x12')][_0x1a13('0x14')]);}else{logger['info'](_0x1a13('0xd'),_0xba559b,_0x1a13('0xe'));_0x10d667(_0x173e43[_0x1a13('0x15')][_0x1a13('0x14')]);}})['catch'](function(_0x99e826){logger[_0x1a13('0x12')](_0x1a13('0xd'),_0xba559b,_0x99e826);_0x1e4ec7(_0x99e826);});});} \ No newline at end of file +var _0xf72f=['jayson/promise','client','http','request','then','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','lodash','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x36c1bd,_0x481465){var _0x80c757=function(_0x157200){while(--_0x157200){_0x36c1bd['push'](_0x36c1bd['shift']());}};_0x80c757(++_0x481465);}(_0xf72f,0x1af));var _0xff72=function(_0x2aeeec,_0x3fc296){_0x2aeeec=_0x2aeeec-0x0;var _0x175d20=_0xf72f[_0x2aeeec];return _0x175d20;};'use strict';var _=require(_0xff72('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xff72('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xff72('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xff72('0x3'))(_0xff72('0x4'));var config=require(_0xff72('0x5'));var jayson=require(_0xff72('0x6'));var client=jayson[_0xff72('0x7')][_0xff72('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x344a5a,_0x5543d6,_0x444282){return new BPromise(function(_0x8540b9,_0x26f40d){return client[_0xff72('0x9')](_0x344a5a,_0x444282)[_0xff72('0xa')](function(_0x572b94){logger['info'](_0xff72('0xb'),_0x5543d6,_0xff72('0xc'));logger['debug'](_0xff72('0xd'),_0x5543d6,_0xff72('0xc'),JSON[_0xff72('0xe')](_0x572b94));if(_0x572b94['error']){if(_0x572b94[_0xff72('0xf')]['code']===0x1f4){logger['error'](_0xff72('0xb'),_0x5543d6,_0x572b94[_0xff72('0xf')][_0xff72('0x10')]);return _0x26f40d(_0x572b94['error']['message']);}logger[_0xff72('0xf')](_0xff72('0xb'),_0x5543d6,_0x572b94[_0xff72('0xf')][_0xff72('0x10')]);return _0x8540b9(_0x572b94['error'][_0xff72('0x10')]);}else{logger[_0xff72('0x11')]('ZohoConfiguration,\x20%s,\x20%s',_0x5543d6,_0xff72('0xc'));_0x8540b9(_0x572b94['result']['message']);}})[_0xff72('0x12')](function(_0x2ac7aa){logger[_0xff72('0xf')]('ZohoConfiguration,\x20%s,\x20%s',_0x5543d6,_0x2ac7aa);_0x26f40d(_0x2ac7aa);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index c0e3924..78a7920 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 _0x7a45=['index','isAuthenticated','create','put','/:id','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoField.controller'];(function(_0x3f25db,_0x1d3686){var _0x54f29d=function(_0x2963bb){while(--_0x2963bb){_0x3f25db['push'](_0x3f25db['shift']());}};_0x54f29d(++_0x1d3686);}(_0x7a45,0x185));var _0x57a4=function(_0x3d0e40,_0x3c3577){_0x3d0e40=_0x3d0e40-0x0;var _0x49f675=_0x7a45[_0x3d0e40];return _0x49f675;};'use strict';var multer=require('multer');var util=require(_0x57a4('0x0'));var path=require(_0x57a4('0x1'));var timeout=require(_0x57a4('0x2'));var express=require(_0x57a4('0x3'));var router=express[_0x57a4('0x4')]();var fs_extra=require(_0x57a4('0x5'));var auth=require(_0x57a4('0x6'));var interaction=require(_0x57a4('0x7'));var config=require(_0x57a4('0x8'));var controller=require(_0x57a4('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x57a4('0xa')]);router['get']('/:id',auth[_0x57a4('0xb')](),controller['show']);router['post']('/',auth[_0x57a4('0xb')](),controller[_0x57a4('0xc')]);router[_0x57a4('0xd')](_0x57a4('0xe'),auth[_0x57a4('0xb')](),controller[_0x57a4('0xf')]);router[_0x57a4('0x10')](_0x57a4('0xe'),auth['isAuthenticated'](),controller[_0x57a4('0x11')]);module[_0x57a4('0x12')]=router; \ No newline at end of file +var _0x264d=['show','create','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./intZohoField.controller','get','isAuthenticated','index','/:id'];(function(_0xf4a941,_0x31bd6a){var _0x1ed867=function(_0x400ac7){while(--_0x400ac7){_0xf4a941['push'](_0xf4a941['shift']());}};_0x1ed867(++_0x31bd6a);}(_0x264d,0x169));var _0xd264=function(_0x16a8c9,_0x4742ba){_0x16a8c9=_0x16a8c9-0x0;var _0x3b701a=_0x264d[_0x16a8c9];return _0x3b701a;};'use strict';var multer=require(_0xd264('0x0'));var util=require(_0xd264('0x1'));var path=require(_0xd264('0x2'));var timeout=require(_0xd264('0x3'));var express=require(_0xd264('0x4'));var router=express['Router']();var fs_extra=require(_0xd264('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xd264('0x6'));var config=require(_0xd264('0x7'));var controller=require(_0xd264('0x8'));router[_0xd264('0x9')]('/',auth[_0xd264('0xa')](),controller[_0xd264('0xb')]);router[_0xd264('0x9')](_0xd264('0xc'),auth['isAuthenticated'](),controller[_0xd264('0xd')]);router['post']('/',auth[_0xd264('0xa')](),controller[_0xd264('0xe')]);router['put']('/:id',auth[_0xd264('0xa')](),controller['update']);router['delete'](_0xd264('0xc'),auth[_0xd264('0xa')](),controller[_0xd264('0xf')]);module[_0xd264('0x10')]=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index 523f877..c735fcd 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 _0xcc84=['picklist','string','STRING','ENUM','customVariable','exports','variable','keyValue'];(function(_0x223e34,_0x3f92e4){var _0x5470a8=function(_0x15c08c){while(--_0x15c08c){_0x223e34['push'](_0x223e34['shift']());}};_0x5470a8(++_0x3f92e4);}(_0xcc84,0x125));var _0x4cc8=function(_0x4e4e9a,_0x2fd576){_0x4e4e9a=_0x4e4e9a-0x0;var _0x2c2cda=_0xcc84[_0x4e4e9a];return _0x2c2cda;};'use strict';var Sequelize=require('sequelize');module[_0x4cc8('0x0')]={'type':{'type':Sequelize['ENUM']('string',_0x4cc8('0x1'),'customVariable',_0x4cc8('0x2'),_0x4cc8('0x3')),'defaultValue':_0x4cc8('0x4')},'content':{'type':Sequelize[_0x4cc8('0x5')]},'key':{'type':Sequelize[_0x4cc8('0x5')]},'keyType':{'type':Sequelize[_0x4cc8('0x6')](_0x4cc8('0x4'),_0x4cc8('0x1'),_0x4cc8('0x7'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x4cc8('0x5')]},'nameField':{'type':Sequelize[_0x4cc8('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x0ab0=['ENUM','customVariable','keyValue','picklist','string','STRING','variable','BOOLEAN'];(function(_0x4792c8,_0x5158a1){var _0x35edb1=function(_0x2472d3){while(--_0x2472d3){_0x4792c8['push'](_0x4792c8['shift']());}};_0x35edb1(++_0x5158a1);}(_0x0ab0,0x1f0));var _0x00ab=function(_0x609c03,_0x6045d){_0x609c03=_0x609c03-0x0;var _0x4bdd68=_0x0ab0[_0x609c03];return _0x4bdd68;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x00ab('0x0')]('string','variable',_0x00ab('0x1'),_0x00ab('0x2'),_0x00ab('0x3')),'defaultValue':_0x00ab('0x4')},'content':{'type':Sequelize[_0x00ab('0x5')]},'key':{'type':Sequelize[_0x00ab('0x5')]},'keyType':{'type':Sequelize['ENUM'](_0x00ab('0x4'),_0x00ab('0x6'),_0x00ab('0x1'))},'keyContent':{'type':Sequelize[_0x00ab('0x5')]},'idField':{'type':Sequelize[_0x00ab('0x5')]},'nameField':{'type':Sequelize[_0x00ab('0x5')]},'customField':{'type':Sequelize[_0x00ab('0x7')],'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 801da11..e24ac42 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 _0xf264=['../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','count','limit','set','Content-Range','apply','save','destroy','then','error','name','send','index','map','fieldName','type','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','merge','VIRTUAL','options','ZohoField','includeAll','rows','show','params','rawAttributes','find','catch','create','body','update','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','path','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils'];(function(_0x1f98c5,_0x330b14){var _0x3b1049=function(_0x44f378){while(--_0x44f378){_0x1f98c5['push'](_0x1f98c5['shift']());}};_0x3b1049(++_0x330b14);}(_0xf264,0xfd));var _0x4f26=function(_0xa6acf,_0x21786f){_0xa6acf=_0xa6acf-0x0;var _0x2bfb1e=_0xf264[_0xa6acf];return _0x2bfb1e;};'use strict';var emlformat=require(_0x4f26('0x0'));var rimraf=require(_0x4f26('0x1'));var zipdir=require(_0x4f26('0x2'));var jsonpatch=require(_0x4f26('0x3'));var rp=require('request-promise');var moment=require(_0x4f26('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x4f26('0x5'));var util=require('util');var path=require(_0x4f26('0x6'));var sox=require('sox');var csv=require(_0x4f26('0x7'));var ejs=require(_0x4f26('0x8'));var fs=require('fs');var fs_extra=require(_0x4f26('0x9'));var _=require(_0x4f26('0xa'));var squel=require(_0x4f26('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x4f26('0xc'));var toCsv=require(_0x4f26('0x7'));var querystring=require(_0x4f26('0xd'));var Papa=require(_0x4f26('0xe'));var Redis=require(_0x4f26('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x4f26('0x10'));var as=require(_0x4f26('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x4f26('0x12'));var config=require(_0x4f26('0x13'));var licenseUtil=require(_0x4f26('0x14'));var db=require(_0x4f26('0x15'))['db'];function respondWithStatusCode(_0x4f344e,_0xff78a8){_0xff78a8=_0xff78a8||0xcc;return function(_0x776ed2){if(_0x776ed2){return _0x4f344e[_0x4f26('0x16')](_0xff78a8);}return _0x4f344e['status'](_0xff78a8)[_0x4f26('0x17')]();};}function respondWithResult(_0x26c3b5,_0x108c26){_0x108c26=_0x108c26||0xc8;return function(_0xb068dc){if(_0xb068dc){return _0x26c3b5[_0x4f26('0x18')](_0x108c26)['json'](_0xb068dc);}};}function respondWithFilteredResult(_0x24b370,_0x22d671){return function(_0x4b2cdb){if(_0x4b2cdb){var _0x44b416=typeof _0x22d671[_0x4f26('0x19')]===_0x4f26('0x1a')&&typeof _0x22d671['limit']===_0x4f26('0x1a');var _0x3283e5=_0x4b2cdb[_0x4f26('0x1b')];var _0x593561=_0x44b416?0x0:_0x22d671['offset'];var _0x5a8004=_0x44b416?_0x4b2cdb['count']:_0x22d671[_0x4f26('0x19')]+_0x22d671[_0x4f26('0x1c')];var _0x30fa50;if(_0x5a8004>=_0x3283e5){_0x5a8004=_0x3283e5;_0x30fa50=0xc8;}else{_0x30fa50=0xce;}_0x24b370['status'](_0x30fa50);return _0x24b370[_0x4f26('0x1d')](_0x4f26('0x1e'),_0x593561+'-'+_0x5a8004+'/'+_0x3283e5)['json'](_0x4b2cdb);}return null;};}function patchUpdates(_0x3a4713){return function(_0x498897){try{jsonpatch[_0x4f26('0x1f')](_0x498897,_0x3a4713,!![]);}catch(_0x37d04f){return BPromise['reject'](_0x37d04f);}return _0x498897[_0x4f26('0x20')]();};}function saveUpdates(_0x1d2c63,_0x1f02d7){return function(_0xae0482){if(_0xae0482){return _0xae0482['update'](_0x1d2c63)['then'](function(_0x32a2d5){return _0x32a2d5;});}return null;};}function removeEntity(_0x3b1cb0,_0x1717dd){return function(_0x3b0c84){if(_0x3b0c84){return _0x3b0c84[_0x4f26('0x21')]()[_0x4f26('0x22')](function(){_0x3b1cb0[_0x4f26('0x18')](0xcc)[_0x4f26('0x17')]();});}};}function handleEntityNotFound(_0x9fa472,_0x1a95ff){return function(_0x532bea){if(!_0x532bea){_0x9fa472[_0x4f26('0x16')](0x194);}return _0x532bea;};}function handleError(_0x8ff896,_0x15271c){_0x15271c=_0x15271c||0x1f4;return function(_0x39f7a8){logger[_0x4f26('0x23')](_0x39f7a8['stack']);if(_0x39f7a8[_0x4f26('0x24')]){delete _0x39f7a8[_0x4f26('0x24')];}_0x8ff896['status'](_0x15271c)[_0x4f26('0x25')](_0x39f7a8);};}exports[_0x4f26('0x26')]=function(_0x3c396b,_0x5ce655){var _0x4d210b={},_0x5351b7={},_0x4449e3={'count':0x0,'rows':[]};var _0x4174eb=_[_0x4f26('0x27')](db['ZohoField']['rawAttributes'],function(_0x3cdfd7){return{'name':_0x3cdfd7[_0x4f26('0x28')],'type':_0x3cdfd7[_0x4f26('0x29')]['key']};});_0x5351b7[_0x4f26('0x2a')]=_['map'](_0x4174eb,_0x4f26('0x24'));_0x5351b7['query']=_[_0x4f26('0x2b')](_0x3c396b[_0x4f26('0x2c')]);_0x5351b7[_0x4f26('0x2d')]=_['intersection'](_0x5351b7[_0x4f26('0x2a')],_0x5351b7[_0x4f26('0x2c')]);_0x4d210b[_0x4f26('0x2e')]=_[_0x4f26('0x2f')](_0x5351b7['model'],qs[_0x4f26('0x30')](_0x3c396b[_0x4f26('0x2c')][_0x4f26('0x30')]));_0x4d210b['attributes']=_0x4d210b[_0x4f26('0x2e')][_0x4f26('0x31')]?_0x4d210b[_0x4f26('0x2e')]:_0x5351b7['model'];if(!_0x3c396b['query'][_0x4f26('0x32')]('nolimit')){_0x4d210b[_0x4f26('0x1c')]=qs['limit'](_0x3c396b[_0x4f26('0x2c')][_0x4f26('0x1c')]);_0x4d210b[_0x4f26('0x19')]=qs['offset'](_0x3c396b[_0x4f26('0x2c')][_0x4f26('0x19')]);}_0x4d210b[_0x4f26('0x33')]=qs[_0x4f26('0x34')](_0x3c396b[_0x4f26('0x2c')][_0x4f26('0x34')]);_0x4d210b['where']=qs[_0x4f26('0x2d')](_['pick'](_0x3c396b[_0x4f26('0x2c')],_0x5351b7[_0x4f26('0x2d')]),_0x4174eb);if(_0x3c396b[_0x4f26('0x2c')]['filter']){_0x4d210b[_0x4f26('0x35')]=_[_0x4f26('0x36')](_0x4d210b[_0x4f26('0x35')],{'$or':_[_0x4f26('0x27')](_0x4174eb,function(_0x216f13){if(_0x216f13['type']!==_0x4f26('0x37')){var _0x4c9d81={};_0x4c9d81[_0x216f13['name']]={'$like':'%'+_0x3c396b[_0x4f26('0x2c')]['filter']+'%'};return _0x4c9d81;}})});}_0x4d210b=_[_0x4f26('0x36')]({},_0x4d210b,_0x3c396b[_0x4f26('0x38')]);var _0x5c8f5f={'where':_0x4d210b['where']};return db[_0x4f26('0x39')]['count'](_0x5c8f5f)[_0x4f26('0x22')](function(_0x2a9d2e){_0x4449e3[_0x4f26('0x1b')]=_0x2a9d2e;if(_0x3c396b[_0x4f26('0x2c')][_0x4f26('0x3a')]){_0x4d210b['include']=[{'all':!![]}];}return db[_0x4f26('0x39')]['findAll'](_0x4d210b);})[_0x4f26('0x22')](function(_0x3d4714){_0x4449e3[_0x4f26('0x3b')]=_0x3d4714;return _0x4449e3;})[_0x4f26('0x22')](respondWithFilteredResult(_0x5ce655,_0x4d210b))['catch'](handleError(_0x5ce655,null));};exports[_0x4f26('0x3c')]=function(_0x59a15d,_0x1e6752){var _0x58f222={'raw':!![],'where':{'id':_0x59a15d[_0x4f26('0x3d')]['id']}},_0x104cae={};_0x104cae[_0x4f26('0x2a')]=_['keys'](db[_0x4f26('0x39')][_0x4f26('0x3e')]);_0x104cae[_0x4f26('0x2c')]=_['keys'](_0x59a15d['query']);_0x104cae['filters']=_[_0x4f26('0x2f')](_0x104cae['model'],_0x104cae[_0x4f26('0x2c')]);_0x58f222['attributes']=_[_0x4f26('0x2f')](_0x104cae['model'],qs[_0x4f26('0x30')](_0x59a15d['query'][_0x4f26('0x30')]));_0x58f222[_0x4f26('0x2e')]=_0x58f222[_0x4f26('0x2e')][_0x4f26('0x31')]?_0x58f222[_0x4f26('0x2e')]:_0x104cae[_0x4f26('0x2a')];if(_0x59a15d[_0x4f26('0x2c')][_0x4f26('0x3a')]){_0x58f222['include']=[{'all':!![]}];}_0x58f222=_['merge']({},_0x58f222,_0x59a15d[_0x4f26('0x38')]);return db[_0x4f26('0x39')][_0x4f26('0x3f')](_0x58f222)[_0x4f26('0x22')](handleEntityNotFound(_0x1e6752,null))[_0x4f26('0x22')](respondWithResult(_0x1e6752,null))[_0x4f26('0x40')](handleError(_0x1e6752,null));};exports[_0x4f26('0x41')]=function(_0xabfad5,_0x1c277a){return db[_0x4f26('0x39')][_0x4f26('0x41')](_0xabfad5[_0x4f26('0x42')],{})['then'](respondWithResult(_0x1c277a,0xc9))[_0x4f26('0x40')](handleError(_0x1c277a,null));};exports[_0x4f26('0x43')]=function(_0x1e50c5,_0xebf86d){if(_0x1e50c5[_0x4f26('0x42')]['id']){delete _0x1e50c5[_0x4f26('0x42')]['id'];}return db[_0x4f26('0x39')]['find']({'where':{'id':_0x1e50c5[_0x4f26('0x3d')]['id']}})[_0x4f26('0x22')](handleEntityNotFound(_0xebf86d,null))[_0x4f26('0x22')](saveUpdates(_0x1e50c5[_0x4f26('0x42')],null))['then'](respondWithResult(_0xebf86d,null))['catch'](handleError(_0xebf86d,null));};exports[_0x4f26('0x21')]=function(_0x3bcd3b,_0x31db09){return db[_0x4f26('0x39')][_0x4f26('0x3f')]({'where':{'id':_0x3bcd3b['params']['id']}})[_0x4f26('0x22')](handleEntityNotFound(_0x31db09,null))[_0x4f26('0x22')](removeEntity(_0x31db09,null))['catch'](handleError(_0x31db09,null));}; \ No newline at end of file +var _0xbdbe=['create','body','eml-format','zip-dir','request-promise','bluebird','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','end','status','json','undefined','count','offset','set','Content-Range','apply','update','then','destroy','error','name','send','map','ZohoField','rawAttributes','key','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','sort','filters','pick','merge','where','type','VIRTUAL','filter','options','include','rows','catch','show','params','keys','includeAll','find'];(function(_0x5c0ba6,_0x56eebd){var _0x10362f=function(_0x21f3a0){while(--_0x21f3a0){_0x5c0ba6['push'](_0x5c0ba6['shift']());}};_0x10362f(++_0x56eebd);}(_0xbdbe,0x1f3));var _0xebdb=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xbdbe[_0x4a9fb1];return _0x348672;};'use strict';var emlformat=require(_0xebdb('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xebdb('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xebdb('0x2'));var moment=require('moment');var BPromise=require(_0xebdb('0x3'));var Mustache=require('mustache');var util=require(_0xebdb('0x4'));var path=require('path');var sox=require(_0xebdb('0x5'));var csv=require('to-csv');var ejs=require(_0xebdb('0x6'));var fs=require('fs');var fs_extra=require(_0xebdb('0x7'));var _=require(_0xebdb('0x8'));var squel=require(_0xebdb('0x9'));var crypto=require(_0xebdb('0xa'));var jsforce=require(_0xebdb('0xb'));var deskjs=require(_0xebdb('0xc'));var toCsv=require(_0xebdb('0xd'));var querystring=require(_0xebdb('0xe'));var Papa=require(_0xebdb('0xf'));var Redis=require(_0xebdb('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xebdb('0x11'));var as=require(_0xebdb('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xebdb('0x13'))(_0xebdb('0x14'));var utils=require(_0xebdb('0x15'));var config=require(_0xebdb('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xb4bc79,_0x3e0a6d){_0x3e0a6d=_0x3e0a6d||0xcc;return function(_0x14a535){if(_0x14a535){return _0xb4bc79[_0xebdb('0x17')](_0x3e0a6d);}return _0xb4bc79['status'](_0x3e0a6d)[_0xebdb('0x18')]();};}function respondWithResult(_0x13187a,_0x363be4){_0x363be4=_0x363be4||0xc8;return function(_0x46f8f8){if(_0x46f8f8){return _0x13187a[_0xebdb('0x19')](_0x363be4)[_0xebdb('0x1a')](_0x46f8f8);}};}function respondWithFilteredResult(_0x3fee99,_0x9118e0){return function(_0xced6f8){if(_0xced6f8){var _0x74f971=typeof _0x9118e0['offset']===_0xebdb('0x1b')&&typeof _0x9118e0['limit']==='undefined';var _0x169a69=_0xced6f8[_0xebdb('0x1c')];var _0x594085=_0x74f971?0x0:_0x9118e0[_0xebdb('0x1d')];var _0x2663d7=_0x74f971?_0xced6f8['count']:_0x9118e0[_0xebdb('0x1d')]+_0x9118e0['limit'];var _0x5d5ac8;if(_0x2663d7>=_0x169a69){_0x2663d7=_0x169a69;_0x5d5ac8=0xc8;}else{_0x5d5ac8=0xce;}_0x3fee99[_0xebdb('0x19')](_0x5d5ac8);return _0x3fee99[_0xebdb('0x1e')](_0xebdb('0x1f'),_0x594085+'-'+_0x2663d7+'/'+_0x169a69)['json'](_0xced6f8);}return null;};}function patchUpdates(_0x38a4dd){return function(_0x4c5a44){try{jsonpatch[_0xebdb('0x20')](_0x4c5a44,_0x38a4dd,!![]);}catch(_0x42f688){return BPromise['reject'](_0x42f688);}return _0x4c5a44['save']();};}function saveUpdates(_0x2efa43,_0x521da8){return function(_0x264e94){if(_0x264e94){return _0x264e94[_0xebdb('0x21')](_0x2efa43)[_0xebdb('0x22')](function(_0x5a6576){return _0x5a6576;});}return null;};}function removeEntity(_0x5cbd95,_0x349f8f){return function(_0x27c9ec){if(_0x27c9ec){return _0x27c9ec[_0xebdb('0x23')]()[_0xebdb('0x22')](function(){_0x5cbd95[_0xebdb('0x19')](0xcc)[_0xebdb('0x18')]();});}};}function handleEntityNotFound(_0x42026f,_0x184871){return function(_0x5b721f){if(!_0x5b721f){_0x42026f[_0xebdb('0x17')](0x194);}return _0x5b721f;};}function handleError(_0x368c77,_0x124321){_0x124321=_0x124321||0x1f4;return function(_0x577abd){logger[_0xebdb('0x24')](_0x577abd['stack']);if(_0x577abd[_0xebdb('0x25')]){delete _0x577abd[_0xebdb('0x25')];}_0x368c77['status'](_0x124321)[_0xebdb('0x26')](_0x577abd);};}exports['index']=function(_0x497642,_0x184ec4){var _0x37a52d={},_0x12fafd={},_0x5136f2={'count':0x0,'rows':[]};var _0x3d525a=_[_0xebdb('0x27')](db[_0xebdb('0x28')][_0xebdb('0x29')],function(_0x11fe9f){return{'name':_0x11fe9f['fieldName'],'type':_0x11fe9f['type'][_0xebdb('0x2a')]};});_0x12fafd[_0xebdb('0x2b')]=_['map'](_0x3d525a,'name');_0x12fafd['query']=_['keys'](_0x497642[_0xebdb('0x2c')]);_0x12fafd['filters']=_[_0xebdb('0x2d')](_0x12fafd[_0xebdb('0x2b')],_0x12fafd['query']);_0x37a52d['attributes']=_[_0xebdb('0x2d')](_0x12fafd[_0xebdb('0x2b')],qs[_0xebdb('0x2e')](_0x497642['query'][_0xebdb('0x2e')]));_0x37a52d[_0xebdb('0x2f')]=_0x37a52d[_0xebdb('0x2f')][_0xebdb('0x30')]?_0x37a52d[_0xebdb('0x2f')]:_0x12fafd[_0xebdb('0x2b')];if(!_0x497642['query'][_0xebdb('0x31')](_0xebdb('0x32'))){_0x37a52d[_0xebdb('0x33')]=qs[_0xebdb('0x33')](_0x497642[_0xebdb('0x2c')][_0xebdb('0x33')]);_0x37a52d[_0xebdb('0x1d')]=qs[_0xebdb('0x1d')](_0x497642[_0xebdb('0x2c')]['offset']);}_0x37a52d['order']=qs['sort'](_0x497642[_0xebdb('0x2c')][_0xebdb('0x34')]);_0x37a52d['where']=qs[_0xebdb('0x35')](_[_0xebdb('0x36')](_0x497642['query'],_0x12fafd[_0xebdb('0x35')]),_0x3d525a);if(_0x497642[_0xebdb('0x2c')]['filter']){_0x37a52d['where']=_[_0xebdb('0x37')](_0x37a52d[_0xebdb('0x38')],{'$or':_[_0xebdb('0x27')](_0x3d525a,function(_0x5896cf){if(_0x5896cf[_0xebdb('0x39')]!==_0xebdb('0x3a')){var _0x3adb04={};_0x3adb04[_0x5896cf[_0xebdb('0x25')]]={'$like':'%'+_0x497642[_0xebdb('0x2c')][_0xebdb('0x3b')]+'%'};return _0x3adb04;}})});}_0x37a52d=_[_0xebdb('0x37')]({},_0x37a52d,_0x497642[_0xebdb('0x3c')]);var _0x3a66c5={'where':_0x37a52d[_0xebdb('0x38')]};return db[_0xebdb('0x28')]['count'](_0x3a66c5)[_0xebdb('0x22')](function(_0x22fe4a){_0x5136f2[_0xebdb('0x1c')]=_0x22fe4a;if(_0x497642[_0xebdb('0x2c')]['includeAll']){_0x37a52d[_0xebdb('0x3d')]=[{'all':!![]}];}return db['ZohoField']['findAll'](_0x37a52d);})[_0xebdb('0x22')](function(_0x1f434e){_0x5136f2[_0xebdb('0x3e')]=_0x1f434e;return _0x5136f2;})[_0xebdb('0x22')](respondWithFilteredResult(_0x184ec4,_0x37a52d))[_0xebdb('0x3f')](handleError(_0x184ec4,null));};exports[_0xebdb('0x40')]=function(_0x202f9b,_0x162b79){var _0x5f4333={'raw':!![],'where':{'id':_0x202f9b[_0xebdb('0x41')]['id']}},_0x57ad10={};_0x57ad10[_0xebdb('0x2b')]=_[_0xebdb('0x42')](db[_0xebdb('0x28')][_0xebdb('0x29')]);_0x57ad10[_0xebdb('0x2c')]=_['keys'](_0x202f9b['query']);_0x57ad10[_0xebdb('0x35')]=_[_0xebdb('0x2d')](_0x57ad10[_0xebdb('0x2b')],_0x57ad10['query']);_0x5f4333[_0xebdb('0x2f')]=_['intersection'](_0x57ad10[_0xebdb('0x2b')],qs[_0xebdb('0x2e')](_0x202f9b[_0xebdb('0x2c')][_0xebdb('0x2e')]));_0x5f4333['attributes']=_0x5f4333[_0xebdb('0x2f')][_0xebdb('0x30')]?_0x5f4333['attributes']:_0x57ad10[_0xebdb('0x2b')];if(_0x202f9b[_0xebdb('0x2c')][_0xebdb('0x43')]){_0x5f4333['include']=[{'all':!![]}];}_0x5f4333=_[_0xebdb('0x37')]({},_0x5f4333,_0x202f9b[_0xebdb('0x3c')]);return db[_0xebdb('0x28')][_0xebdb('0x44')](_0x5f4333)[_0xebdb('0x22')](handleEntityNotFound(_0x162b79,null))[_0xebdb('0x22')](respondWithResult(_0x162b79,null))[_0xebdb('0x3f')](handleError(_0x162b79,null));};exports[_0xebdb('0x45')]=function(_0x278b58,_0x2af46a){return db[_0xebdb('0x28')]['create'](_0x278b58[_0xebdb('0x46')],{})[_0xebdb('0x22')](respondWithResult(_0x2af46a,0xc9))['catch'](handleError(_0x2af46a,null));};exports[_0xebdb('0x21')]=function(_0x431e9f,_0x2d8822){if(_0x431e9f['body']['id']){delete _0x431e9f['body']['id'];}return db[_0xebdb('0x28')][_0xebdb('0x44')]({'where':{'id':_0x431e9f[_0xebdb('0x41')]['id']}})['then'](handleEntityNotFound(_0x2d8822,null))[_0xebdb('0x22')](saveUpdates(_0x431e9f[_0xebdb('0x46')],null))[_0xebdb('0x22')](respondWithResult(_0x2d8822,null))['catch'](handleError(_0x2d8822,null));};exports['destroy']=function(_0x49000e,_0x4beb88){return db[_0xebdb('0x28')][_0xebdb('0x44')]({'where':{'id':_0x49000e[_0xebdb('0x41')]['id']}})[_0xebdb('0x22')](handleEntityNotFound(_0x4beb88,null))[_0xebdb('0x22')](removeEntity(_0x4beb88,null))[_0xebdb('0x3f')](handleError(_0x4beb88,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index d87c099..6cba021 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 _0x0295=['rimraf','../../config/environment','./intZohoField.attributes','exports','define','idField','lodash','api','request-promise','path'];(function(_0x40b83d,_0x594e0e){var _0x445bb9=function(_0x3b6a80){while(--_0x3b6a80){_0x40b83d['push'](_0x40b83d['shift']());}};_0x445bb9(++_0x594e0e);}(_0x0295,0x1f0));var _0x5029=function(_0x48ace4,_0x3ecb6d){_0x48ace4=_0x48ace4-0x0;var _0x1605a1=_0x0295[_0x48ace4];return _0x1605a1;};'use strict';var _=require(_0x5029('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x5029('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x5029('0x2'));var fs=require('fs');var path=require(_0x5029('0x3'));var rimraf=require(_0x5029('0x4'));var config=require(_0x5029('0x5'));var attributes=require(_0x5029('0x6'));module[_0x5029('0x7')]=function(_0x200217,_0x215955){return _0x200217[_0x5029('0x8')]('ZohoField',attributes,{'tableName':'int_zoho_fields','paranoid':![],'indexes':[{'name':'zoho_unique_index','fields':[_0x5029('0x9'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2ef3=['path','rimraf','./intZohoField.attributes','exports','define','ZohoField','int_zoho_fields','zoho_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x54b110,_0x18d50f){var _0x1979c0=function(_0x530034){while(--_0x530034){_0x54b110['push'](_0x54b110['shift']());}};_0x1979c0(++_0x18d50f);}(_0x2ef3,0xba));var _0x32ef=function(_0x1a1cbe,_0x3545ee){_0x1a1cbe=_0x1a1cbe-0x0;var _0x1deddf=_0x2ef3[_0x1a1cbe];return _0x1deddf;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var logger=require(_0x32ef('0x2'))(_0x32ef('0x3'));var moment=require(_0x32ef('0x4'));var BPromise=require(_0x32ef('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x32ef('0x6'));var rimraf=require(_0x32ef('0x7'));var config=require('../../config/environment');var attributes=require(_0x32ef('0x8'));module[_0x32ef('0x9')]=function(_0x4c8104,_0x5dfa09){return _0x4c8104[_0x32ef('0xa')](_0x32ef('0xb'),attributes,{'tableName':_0x32ef('0xc'),'paranoid':![],'indexes':[{'name':_0x32ef('0xd'),'fields':[_0x32ef('0xe'),_0x32ef('0xf')],'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 8a72054..1a7d141 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 _0xbef3=['request','then','info','ZohoField,\x20%s,\x20%s','debug','ZohoField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xbef3,0x12a));var _0x3bef=function(_0x5364e5,_0xc4c2a8){_0x5364e5=_0x5364e5-0x0;var _0x2ceba7=_0xbef3[_0x5364e5];return _0x2ceba7;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x3bef('0x0'));var rs=require(_0x3bef('0x1'));var fs=require('fs');var Redis=require(_0x3bef('0x2'));var db=require(_0x3bef('0x3'))['db'];var utils=require(_0x3bef('0x4'));var logger=require(_0x3bef('0x5'))('rpc');var config=require(_0x3bef('0x6'));var jayson=require(_0x3bef('0x7'));var client=jayson[_0x3bef('0x8')][_0x3bef('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x935c7,_0x5dfb3c,_0x5a867e){return new BPromise(function(_0x153274,_0x2d09cb){return client[_0x3bef('0xa')](_0x935c7,_0x5a867e)[_0x3bef('0xb')](function(_0x3a3bc4){logger[_0x3bef('0xc')](_0x3bef('0xd'),_0x5dfb3c,'request\x20sent');logger[_0x3bef('0xe')](_0x3bef('0xf'),_0x5dfb3c,_0x3bef('0x10'),JSON[_0x3bef('0x11')](_0x3a3bc4));if(_0x3a3bc4[_0x3bef('0x12')]){if(_0x3a3bc4[_0x3bef('0x12')]['code']===0x1f4){logger[_0x3bef('0x12')](_0x3bef('0xd'),_0x5dfb3c,_0x3a3bc4[_0x3bef('0x12')][_0x3bef('0x13')]);return _0x2d09cb(_0x3a3bc4[_0x3bef('0x12')][_0x3bef('0x13')]);}logger[_0x3bef('0x12')](_0x3bef('0xd'),_0x5dfb3c,_0x3a3bc4[_0x3bef('0x12')][_0x3bef('0x13')]);return _0x153274(_0x3a3bc4['error'][_0x3bef('0x13')]);}else{logger[_0x3bef('0xc')]('ZohoField,\x20%s,\x20%s',_0x5dfb3c,_0x3bef('0x10'));_0x153274(_0x3a3bc4[_0x3bef('0x14')][_0x3bef('0x13')]);}})[_0x3bef('0x15')](function(_0x10c65c){logger[_0x3bef('0x12')](_0x3bef('0xd'),_0x5dfb3c,_0x10c65c);_0x2d09cb(_0x10c65c);});});} \ No newline at end of file +var _0x9077=['request\x20sent','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','ZohoField,\x20%s,\x20%s'];(function(_0x12f688,_0x585c25){var _0x59c3de=function(_0x4ac301){while(--_0x4ac301){_0x12f688['push'](_0x12f688['shift']());}};_0x59c3de(++_0x585c25);}(_0x9077,0x8d));var _0x7907=function(_0x4528e4,_0x5cd15f){_0x4528e4=_0x4528e4-0x0;var _0x33ac80=_0x9077[_0x4528e4];return _0x33ac80;};'use strict';var _=require(_0x7907('0x0'));var util=require(_0x7907('0x1'));var moment=require(_0x7907('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7907('0x3'));var db=require(_0x7907('0x4'))['db'];var utils=require(_0x7907('0x5'));var logger=require(_0x7907('0x6'))(_0x7907('0x7'));var config=require(_0x7907('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x7907('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x571215,_0x182833,_0x57dc11){return new BPromise(function(_0xe2734c,_0x5683e6){return client[_0x7907('0xa')](_0x571215,_0x57dc11)[_0x7907('0xb')](function(_0xaf2d0d){logger['info'](_0x7907('0xc'),_0x182833,_0x7907('0xd'));logger['debug'](_0x7907('0xe'),_0x182833,_0x7907('0xd'),JSON[_0x7907('0xf')](_0xaf2d0d));if(_0xaf2d0d['error']){if(_0xaf2d0d[_0x7907('0x10')][_0x7907('0x11')]===0x1f4){logger['error'](_0x7907('0xc'),_0x182833,_0xaf2d0d['error'][_0x7907('0x12')]);return _0x5683e6(_0xaf2d0d[_0x7907('0x10')][_0x7907('0x12')]);}logger[_0x7907('0x10')](_0x7907('0xc'),_0x182833,_0xaf2d0d[_0x7907('0x10')][_0x7907('0x12')]);return _0xe2734c(_0xaf2d0d[_0x7907('0x10')][_0x7907('0x12')]);}else{logger[_0x7907('0x13')]('ZohoField,\x20%s,\x20%s',_0x182833,_0x7907('0xd'));_0xe2734c(_0xaf2d0d[_0x7907('0x14')][_0x7907('0x12')]);}})[_0x7907('0x15')](function(_0x3e7f70){logger['error']('ZohoField,\x20%s,\x20%s',_0x182833,_0x3e7f70);_0x5683e6(_0x3e7f70);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index 0c47301..ca434c0 100644 --- a/server/api/integration/index.js +++ b/server/api/integration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x16659f,_0x7cf48e){var _0x49f826=function(_0x17875f){while(--_0x17875f){_0x16659f['push'](_0x16659f['shift']());}};_0x49f826(++_0x7cf48e);}(_0xe706,0xa3));var _0x6e70=function(_0x4144ef,_0x3ed22b){_0x4144ef=_0x4144ef-0x0;var _0x3691ba=_0xe706[_0x4144ef];return _0x3691ba;};'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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x5c7a88,_0x3a484b){var _0x4592e0=function(_0x1129d9){while(--_0x1129d9){_0x5c7a88['push'](_0x5c7a88['shift']());}};_0x4592e0(++_0x3a484b);}(_0x70e0,0x17b));var _0x070e=function(_0x5b55c8,_0x38b76b){_0x5b55c8=_0x5b55c8-0x0;var _0x199a34=_0x70e0[_0x5b55c8];return _0x199a34;};'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/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index 5f8882e..829143d 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 _0x219a=['app.js','INTEGER','BOOLEAN','state','sequelize','exports','STRING','unique_name_and_version'];(function(_0x1fd9b2,_0x1be29e){var _0x1aacca=function(_0x740af1){while(--_0x740af1){_0x1fd9b2['push'](_0x1fd9b2['shift']());}};_0x1aacca(++_0x1be29e);}(_0x219a,0x184));var _0xa219=function(_0x592dff,_0x5daf48){_0x592dff=_0x592dff-0x0;var _0x2a32b6=_0x219a[_0x592dff];return _0x2a32b6;};'use strict';var Sequelize=require(_0xa219('0x0'));module[_0xa219('0x1')]={'name':{'type':Sequelize[_0xa219('0x2')],'allowNull':![],'unique':_0xa219('0x3')},'version':{'type':Sequelize[_0xa219('0x2')],'allowNull':![],'unique':_0xa219('0x3')},'main':{'type':Sequelize[_0xa219('0x2')],'defaultValue':_0xa219('0x4')},'filename':{'type':Sequelize[_0xa219('0x2')]},'path':{'type':Sequelize[_0xa219('0x2')]},'type':{'type':Sequelize[_0xa219('0x2')]},'size':{'type':Sequelize[_0xa219('0x5')]},'active':{'type':Sequelize[_0xa219('0x6')],'defaultValue':![]},'author':{'type':Sequelize[_0xa219('0x2')]},'logo':{'type':Sequelize[_0xa219('0x2')]},'state':{'type':Sequelize[_0xa219('0x2')],'unique':_0xa219('0x7')},'description':{'type':Sequelize[_0xa219('0x2')]},'title':{'type':Sequelize[_0xa219('0x2')]},'remoteUri':{'type':Sequelize[_0xa219('0x2')]},'link':{'type':Sequelize['STRING'],'defaultValue':'#'}}; \ No newline at end of file +var _0x6f58=['sequelize','exports','STRING','unique_name_and_version','INTEGER','BOOLEAN'];(function(_0x34ffcb,_0x5694f7){var _0x9791f8=function(_0x5049d0){while(--_0x5049d0){_0x34ffcb['push'](_0x34ffcb['shift']());}};_0x9791f8(++_0x5694f7);}(_0x6f58,0x1ec));var _0x86f5=function(_0x224f8b,_0x29e073){_0x224f8b=_0x224f8b-0x0;var _0xadee1d=_0x6f58[_0x224f8b];return _0xadee1d;};'use strict';var Sequelize=require(_0x86f5('0x0'));module[_0x86f5('0x1')]={'name':{'type':Sequelize[_0x86f5('0x2')],'allowNull':![],'unique':_0x86f5('0x3')},'version':{'type':Sequelize['STRING'],'allowNull':![],'unique':'unique_name_and_version'},'main':{'type':Sequelize[_0x86f5('0x2')],'defaultValue':'app.js'},'filename':{'type':Sequelize['STRING']},'path':{'type':Sequelize[_0x86f5('0x2')]},'type':{'type':Sequelize['STRING']},'size':{'type':Sequelize[_0x86f5('0x4')]},'active':{'type':Sequelize[_0x86f5('0x5')],'defaultValue':![]},'author':{'type':Sequelize[_0x86f5('0x2')]},'logo':{'type':Sequelize[_0x86f5('0x2')]},'state':{'type':Sequelize['STRING'],'unique':'state'},'description':{'type':Sequelize[_0x86f5('0x2')]},'title':{'type':Sequelize[_0x86f5('0x2')]},'remoteUri':{'type':Sequelize[_0x86f5('0x2')]},'link':{'type':Sequelize[_0x86f5('0x2')],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index 5554ea3..def41df 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 _0x1967=['sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','set','apply','save','update','then','status','error','name','send','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','Integration','includeAll','include','findAll','rows','show','params','fields','options','find','catch','create','body','destroy','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path'];(function(_0x3c5f8d,_0x39891f){var _0x3b7beb=function(_0x44d6c9){while(--_0x44d6c9){_0x3c5f8d['push'](_0x3c5f8d['shift']());}};_0x3b7beb(++_0x39891f);}(_0x1967,0x173));var _0x7196=function(_0x1813af,_0xb65f4){_0x1813af=_0x1813af-0x0;var _0x16c27d=_0x1967[_0x1813af];return _0x16c27d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7196('0x0'));var zipdir=require(_0x7196('0x1'));var jsonpatch=require(_0x7196('0x2'));var rp=require(_0x7196('0x3'));var moment=require(_0x7196('0x4'));var BPromise=require(_0x7196('0x5'));var Mustache=require(_0x7196('0x6'));var util=require(_0x7196('0x7'));var path=require(_0x7196('0x8'));var sox=require(_0x7196('0x9'));var csv=require('to-csv');var ejs=require(_0x7196('0xa'));var fs=require('fs');var fs_extra=require(_0x7196('0xb'));var _=require(_0x7196('0xc'));var squel=require(_0x7196('0xd'));var crypto=require(_0x7196('0xe'));var jsforce=require(_0x7196('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x7196('0x10'));var querystring=require(_0x7196('0x11'));var Papa=require(_0x7196('0x12'));var Redis=require(_0x7196('0x13'));var authService=require(_0x7196('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7196('0x15'));var logger=require(_0x7196('0x16'))(_0x7196('0x17'));var utils=require(_0x7196('0x18'));var config=require(_0x7196('0x19'));var licenseUtil=require(_0x7196('0x1a'));var db=require(_0x7196('0x1b'))['db'];function respondWithStatusCode(_0x325641,_0x24f1c3){_0x24f1c3=_0x24f1c3||0xcc;return function(_0xba707b){if(_0xba707b){return _0x325641[_0x7196('0x1c')](_0x24f1c3);}return _0x325641['status'](_0x24f1c3)[_0x7196('0x1d')]();};}function respondWithResult(_0x3feccd,_0x3545aa){_0x3545aa=_0x3545aa||0xc8;return function(_0xf098c1){if(_0xf098c1){return _0x3feccd['status'](_0x3545aa)[_0x7196('0x1e')](_0xf098c1);}};}function respondWithFilteredResult(_0x539414,_0xe32933){return function(_0x2590a6){if(_0x2590a6){var _0xf7e97=typeof _0xe32933[_0x7196('0x1f')]===_0x7196('0x20')&&typeof _0xe32933[_0x7196('0x21')]===_0x7196('0x20');var _0x1ed296=_0x2590a6[_0x7196('0x22')];var _0x32fe2b=_0xf7e97?0x0:_0xe32933[_0x7196('0x1f')];var _0x5b716a=_0xf7e97?_0x2590a6['count']:_0xe32933[_0x7196('0x1f')]+_0xe32933[_0x7196('0x21')];var _0x40418d;if(_0x5b716a>=_0x1ed296){_0x5b716a=_0x1ed296;_0x40418d=0xc8;}else{_0x40418d=0xce;}_0x539414['status'](_0x40418d);return _0x539414[_0x7196('0x23')]('Content-Range',_0x32fe2b+'-'+_0x5b716a+'/'+_0x1ed296)['json'](_0x2590a6);}return null;};}function patchUpdates(_0x296e07){return function(_0x627223){try{jsonpatch[_0x7196('0x24')](_0x627223,_0x296e07,!![]);}catch(_0x4ddf78){return BPromise['reject'](_0x4ddf78);}return _0x627223[_0x7196('0x25')]();};}function saveUpdates(_0x3cd8ff,_0x598a26){return function(_0x18649b){if(_0x18649b){return _0x18649b[_0x7196('0x26')](_0x3cd8ff)[_0x7196('0x27')](function(_0x18d389){return _0x18d389;});}return null;};}function removeEntity(_0x38b3d6,_0x549f34){return function(_0x3f8178){if(_0x3f8178){return _0x3f8178['destroy']()[_0x7196('0x27')](function(){_0x38b3d6[_0x7196('0x28')](0xcc)[_0x7196('0x1d')]();});}};}function handleEntityNotFound(_0xa69810,_0x70aa65){return function(_0x43f6a2){if(!_0x43f6a2){_0xa69810['sendStatus'](0x194);}return _0x43f6a2;};}function handleError(_0x57c404,_0x1482e5){_0x1482e5=_0x1482e5||0x1f4;return function(_0x2d284f){logger[_0x7196('0x29')](_0x2d284f['stack']);if(_0x2d284f['name']){delete _0x2d284f[_0x7196('0x2a')];}_0x57c404[_0x7196('0x28')](_0x1482e5)[_0x7196('0x2b')](_0x2d284f);};}exports['index']=function(_0x35eef9,_0x4ecea1){var _0x4fd339={},_0x59d79d={},_0x30151f={'count':0x0,'rows':[]};var _0x985727=_[_0x7196('0x2c')](db['Integration'][_0x7196('0x2d')],function(_0x45d567){return{'name':_0x45d567[_0x7196('0x2e')],'type':_0x45d567[_0x7196('0x2f')]['key']};});_0x59d79d[_0x7196('0x30')]=_[_0x7196('0x2c')](_0x985727,_0x7196('0x2a'));_0x59d79d[_0x7196('0x31')]=_[_0x7196('0x32')](_0x35eef9[_0x7196('0x31')]);_0x59d79d[_0x7196('0x33')]=_[_0x7196('0x34')](_0x59d79d[_0x7196('0x30')],_0x59d79d[_0x7196('0x31')]);_0x4fd339[_0x7196('0x35')]=_['intersection'](_0x59d79d[_0x7196('0x30')],qs['fields'](_0x35eef9[_0x7196('0x31')]['fields']));_0x4fd339[_0x7196('0x35')]=_0x4fd339[_0x7196('0x35')]['length']?_0x4fd339[_0x7196('0x35')]:_0x59d79d[_0x7196('0x30')];if(!_0x35eef9[_0x7196('0x31')][_0x7196('0x36')](_0x7196('0x37'))){_0x4fd339['limit']=qs[_0x7196('0x21')](_0x35eef9[_0x7196('0x31')][_0x7196('0x21')]);_0x4fd339[_0x7196('0x1f')]=qs[_0x7196('0x1f')](_0x35eef9[_0x7196('0x31')]['offset']);}_0x4fd339[_0x7196('0x38')]=qs[_0x7196('0x39')](_0x35eef9[_0x7196('0x31')]['sort']);_0x4fd339[_0x7196('0x3a')]=qs[_0x7196('0x33')](_[_0x7196('0x3b')](_0x35eef9[_0x7196('0x31')],_0x59d79d[_0x7196('0x33')]),_0x985727);if(_0x35eef9[_0x7196('0x31')][_0x7196('0x3c')]){_0x4fd339[_0x7196('0x3a')]=_[_0x7196('0x3d')](_0x4fd339[_0x7196('0x3a')],{'$or':_['map'](_0x985727,function(_0x257754){if(_0x257754[_0x7196('0x2f')]!=='VIRTUAL'){var _0x186efe={};_0x186efe[_0x257754['name']]={'$like':'%'+_0x35eef9['query'][_0x7196('0x3c')]+'%'};return _0x186efe;}})});}_0x4fd339=_[_0x7196('0x3d')]({},_0x4fd339,_0x35eef9['options']);var _0x587f6f={'where':_0x4fd339[_0x7196('0x3a')]};return db[_0x7196('0x3e')][_0x7196('0x22')](_0x587f6f)['then'](function(_0x36a990){_0x30151f[_0x7196('0x22')]=_0x36a990;if(_0x35eef9[_0x7196('0x31')][_0x7196('0x3f')]){_0x4fd339[_0x7196('0x40')]=[{'all':!![]}];}return db[_0x7196('0x3e')][_0x7196('0x41')](_0x4fd339);})[_0x7196('0x27')](function(_0x5cd903){_0x30151f[_0x7196('0x42')]=_0x5cd903;return _0x30151f;})[_0x7196('0x27')](respondWithFilteredResult(_0x4ecea1,_0x4fd339))['catch'](handleError(_0x4ecea1,null));};exports[_0x7196('0x43')]=function(_0x43d4c0,_0x48178f){var _0x471915={'raw':![],'where':{'id':_0x43d4c0[_0x7196('0x44')]['id']}},_0x471bb2={};_0x471bb2['model']=_[_0x7196('0x32')](db[_0x7196('0x3e')]['rawAttributes']);_0x471bb2[_0x7196('0x31')]=_[_0x7196('0x32')](_0x43d4c0['query']);_0x471bb2[_0x7196('0x33')]=_['intersection'](_0x471bb2['model'],_0x471bb2['query']);_0x471915['attributes']=_['intersection'](_0x471bb2[_0x7196('0x30')],qs['fields'](_0x43d4c0[_0x7196('0x31')][_0x7196('0x45')]));_0x471915[_0x7196('0x35')]=_0x471915[_0x7196('0x35')]['length']?_0x471915[_0x7196('0x35')]:_0x471bb2['model'];if(_0x43d4c0[_0x7196('0x31')][_0x7196('0x3f')]){_0x471915[_0x7196('0x40')]=[{'all':!![]}];}_0x471915=_['merge']({},_0x471915,_0x43d4c0[_0x7196('0x46')]);return db[_0x7196('0x3e')][_0x7196('0x47')](_0x471915)['then'](handleEntityNotFound(_0x48178f,null))['then'](respondWithResult(_0x48178f,null))[_0x7196('0x48')](handleError(_0x48178f,null));};exports['create']=function(_0x29c7e8,_0x582884){return db['Integration'][_0x7196('0x49')](_0x29c7e8['body'],{})['then'](respondWithResult(_0x582884,0xc9))['catch'](handleError(_0x582884,null));};exports[_0x7196('0x26')]=function(_0x5052ee,_0x48e3b5){if(_0x5052ee[_0x7196('0x4a')]['id']){delete _0x5052ee[_0x7196('0x4a')]['id'];}return db[_0x7196('0x3e')][_0x7196('0x47')]({'where':{'id':_0x5052ee['params']['id']}})[_0x7196('0x27')](handleEntityNotFound(_0x48e3b5,null))['then'](saveUpdates(_0x5052ee[_0x7196('0x4a')],null))[_0x7196('0x27')](respondWithResult(_0x48e3b5,null))['catch'](handleError(_0x48e3b5,null));};exports[_0x7196('0x4b')]=function(_0x2fd056,_0x3fe092){return db['Integration'][_0x7196('0x47')]({'where':{'id':_0x2fd056['params']['id']}})[_0x7196('0x27')](handleEntityNotFound(_0x3fe092,null))[_0x7196('0x27')](removeEntity(_0x3fe092,null))[_0x7196('0x48')](handleError(_0x3fe092,null));}; \ No newline at end of file +var _0x2542=['../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','update','then','error','stack','name','index','map','Integration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x1d7c83,_0x2d8f2d){var _0x283ef2=function(_0x68da53){while(--_0x68da53){_0x1d7c83['push'](_0x1d7c83['shift']());}};_0x283ef2(++_0x2d8f2d);}(_0x2542,0x169));var _0x2254=function(_0x4788f7,_0x1a939b){_0x4788f7=_0x4788f7-0x0;var _0x503e13=_0x2542[_0x4788f7];return _0x503e13;};'use strict';var emlformat=require(_0x2254('0x0'));var rimraf=require(_0x2254('0x1'));var zipdir=require(_0x2254('0x2'));var jsonpatch=require(_0x2254('0x3'));var rp=require('request-promise');var moment=require(_0x2254('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x2254('0x5'));var util=require(_0x2254('0x6'));var path=require(_0x2254('0x7'));var sox=require(_0x2254('0x8'));var csv=require(_0x2254('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2254('0xa'));var _=require(_0x2254('0xb'));var squel=require(_0x2254('0xc'));var crypto=require(_0x2254('0xd'));var jsforce=require(_0x2254('0xe'));var deskjs=require(_0x2254('0xf'));var toCsv=require(_0x2254('0x9'));var querystring=require(_0x2254('0x10'));var Papa=require(_0x2254('0x11'));var Redis=require(_0x2254('0x12'));var authService=require(_0x2254('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x2254('0x14'));var hardwareService=require(_0x2254('0x15'));var logger=require(_0x2254('0x16'))(_0x2254('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x2254('0x18'));var db=require(_0x2254('0x19'))['db'];function respondWithStatusCode(_0x116b70,_0xdcb670){_0xdcb670=_0xdcb670||0xcc;return function(_0x3c326b){if(_0x3c326b){return _0x116b70[_0x2254('0x1a')](_0xdcb670);}return _0x116b70['status'](_0xdcb670)[_0x2254('0x1b')]();};}function respondWithResult(_0x7c7ab0,_0x504749){_0x504749=_0x504749||0xc8;return function(_0x2f4de){if(_0x2f4de){return _0x7c7ab0[_0x2254('0x1c')](_0x504749)[_0x2254('0x1d')](_0x2f4de);}};}function respondWithFilteredResult(_0x145272,_0x26285a){return function(_0xbc5548){if(_0xbc5548){var _0x50f137=typeof _0x26285a[_0x2254('0x1e')]==='undefined'&&typeof _0x26285a[_0x2254('0x1f')]===_0x2254('0x20');var _0x170ffa=_0xbc5548[_0x2254('0x21')];var _0x1ae11e=_0x50f137?0x0:_0x26285a[_0x2254('0x1e')];var _0x497724=_0x50f137?_0xbc5548['count']:_0x26285a['offset']+_0x26285a[_0x2254('0x1f')];var _0x3a79f8;if(_0x497724>=_0x170ffa){_0x497724=_0x170ffa;_0x3a79f8=0xc8;}else{_0x3a79f8=0xce;}_0x145272[_0x2254('0x1c')](_0x3a79f8);return _0x145272[_0x2254('0x22')](_0x2254('0x23'),_0x1ae11e+'-'+_0x497724+'/'+_0x170ffa)[_0x2254('0x1d')](_0xbc5548);}return null;};}function patchUpdates(_0x487f72){return function(_0x28381e){try{jsonpatch[_0x2254('0x24')](_0x28381e,_0x487f72,!![]);}catch(_0x906cde){return BPromise['reject'](_0x906cde);}return _0x28381e['save']();};}function saveUpdates(_0x5bd982,_0x1e8a98){return function(_0x559af4){if(_0x559af4){return _0x559af4[_0x2254('0x25')](_0x5bd982)['then'](function(_0x5713e4){return _0x5713e4;});}return null;};}function removeEntity(_0x4d8faf,_0x540020){return function(_0x5e5edb){if(_0x5e5edb){return _0x5e5edb['destroy']()[_0x2254('0x26')](function(){_0x4d8faf[_0x2254('0x1c')](0xcc)[_0x2254('0x1b')]();});}};}function handleEntityNotFound(_0x265467,_0x13522d){return function(_0x1349c9){if(!_0x1349c9){_0x265467['sendStatus'](0x194);}return _0x1349c9;};}function handleError(_0x4a8274,_0x1ada42){_0x1ada42=_0x1ada42||0x1f4;return function(_0x4f6877){logger[_0x2254('0x27')](_0x4f6877[_0x2254('0x28')]);if(_0x4f6877[_0x2254('0x29')]){delete _0x4f6877[_0x2254('0x29')];}_0x4a8274[_0x2254('0x1c')](_0x1ada42)['send'](_0x4f6877);};}exports[_0x2254('0x2a')]=function(_0x2a789b,_0x21285d){var _0x37af8b={},_0x13366a={},_0x377c41={'count':0x0,'rows':[]};var _0x3214a7=_[_0x2254('0x2b')](db[_0x2254('0x2c')][_0x2254('0x2d')],function(_0x21c641){return{'name':_0x21c641[_0x2254('0x2e')],'type':_0x21c641[_0x2254('0x2f')][_0x2254('0x30')]};});_0x13366a[_0x2254('0x31')]=_[_0x2254('0x2b')](_0x3214a7,_0x2254('0x29'));_0x13366a[_0x2254('0x32')]=_[_0x2254('0x33')](_0x2a789b['query']);_0x13366a[_0x2254('0x34')]=_[_0x2254('0x35')](_0x13366a[_0x2254('0x31')],_0x13366a[_0x2254('0x32')]);_0x37af8b[_0x2254('0x36')]=_[_0x2254('0x35')](_0x13366a[_0x2254('0x31')],qs[_0x2254('0x37')](_0x2a789b[_0x2254('0x32')]['fields']));_0x37af8b[_0x2254('0x36')]=_0x37af8b[_0x2254('0x36')]['length']?_0x37af8b[_0x2254('0x36')]:_0x13366a[_0x2254('0x31')];if(!_0x2a789b[_0x2254('0x32')][_0x2254('0x38')]('nolimit')){_0x37af8b['limit']=qs[_0x2254('0x1f')](_0x2a789b['query'][_0x2254('0x1f')]);_0x37af8b[_0x2254('0x1e')]=qs[_0x2254('0x1e')](_0x2a789b[_0x2254('0x32')][_0x2254('0x1e')]);}_0x37af8b[_0x2254('0x39')]=qs[_0x2254('0x3a')](_0x2a789b['query'][_0x2254('0x3a')]);_0x37af8b[_0x2254('0x3b')]=qs[_0x2254('0x34')](_[_0x2254('0x3c')](_0x2a789b[_0x2254('0x32')],_0x13366a[_0x2254('0x34')]),_0x3214a7);if(_0x2a789b[_0x2254('0x32')][_0x2254('0x3d')]){_0x37af8b[_0x2254('0x3b')]=_[_0x2254('0x3e')](_0x37af8b['where'],{'$or':_[_0x2254('0x2b')](_0x3214a7,function(_0xde3e4a){if(_0xde3e4a[_0x2254('0x2f')]!==_0x2254('0x3f')){var _0x4c7cc3={};_0x4c7cc3[_0xde3e4a[_0x2254('0x29')]]={'$like':'%'+_0x2a789b[_0x2254('0x32')][_0x2254('0x3d')]+'%'};return _0x4c7cc3;}})});}_0x37af8b=_[_0x2254('0x3e')]({},_0x37af8b,_0x2a789b[_0x2254('0x40')]);var _0x2602db={'where':_0x37af8b[_0x2254('0x3b')]};return db[_0x2254('0x2c')]['count'](_0x2602db)[_0x2254('0x26')](function(_0x5c15d7){_0x377c41[_0x2254('0x21')]=_0x5c15d7;if(_0x2a789b[_0x2254('0x32')][_0x2254('0x41')]){_0x37af8b[_0x2254('0x42')]=[{'all':!![]}];}return db[_0x2254('0x2c')][_0x2254('0x43')](_0x37af8b);})[_0x2254('0x26')](function(_0x568ec9){_0x377c41[_0x2254('0x44')]=_0x568ec9;return _0x377c41;})[_0x2254('0x26')](respondWithFilteredResult(_0x21285d,_0x37af8b))[_0x2254('0x45')](handleError(_0x21285d,null));};exports[_0x2254('0x46')]=function(_0x40d4da,_0x57cda2){var _0x22bb98={'raw':![],'where':{'id':_0x40d4da[_0x2254('0x47')]['id']}},_0x1dec43={};_0x1dec43[_0x2254('0x31')]=_[_0x2254('0x33')](db['Integration'][_0x2254('0x2d')]);_0x1dec43['query']=_[_0x2254('0x33')](_0x40d4da[_0x2254('0x32')]);_0x1dec43[_0x2254('0x34')]=_[_0x2254('0x35')](_0x1dec43[_0x2254('0x31')],_0x1dec43[_0x2254('0x32')]);_0x22bb98[_0x2254('0x36')]=_[_0x2254('0x35')](_0x1dec43[_0x2254('0x31')],qs[_0x2254('0x37')](_0x40d4da[_0x2254('0x32')][_0x2254('0x37')]));_0x22bb98[_0x2254('0x36')]=_0x22bb98['attributes'][_0x2254('0x48')]?_0x22bb98[_0x2254('0x36')]:_0x1dec43[_0x2254('0x31')];if(_0x40d4da['query'][_0x2254('0x41')]){_0x22bb98[_0x2254('0x42')]=[{'all':!![]}];}_0x22bb98=_[_0x2254('0x3e')]({},_0x22bb98,_0x40d4da[_0x2254('0x40')]);return db[_0x2254('0x2c')][_0x2254('0x49')](_0x22bb98)[_0x2254('0x26')](handleEntityNotFound(_0x57cda2,null))[_0x2254('0x26')](respondWithResult(_0x57cda2,null))[_0x2254('0x45')](handleError(_0x57cda2,null));};exports['create']=function(_0x239ba0,_0x405eb2){return db[_0x2254('0x2c')][_0x2254('0x4a')](_0x239ba0[_0x2254('0x4b')],{})[_0x2254('0x26')](respondWithResult(_0x405eb2,0xc9))[_0x2254('0x45')](handleError(_0x405eb2,null));};exports[_0x2254('0x25')]=function(_0x3ac691,_0xa103ea){if(_0x3ac691['body']['id']){delete _0x3ac691[_0x2254('0x4b')]['id'];}return db[_0x2254('0x2c')]['find']({'where':{'id':_0x3ac691[_0x2254('0x47')]['id']}})[_0x2254('0x26')](handleEntityNotFound(_0xa103ea,null))[_0x2254('0x26')](saveUpdates(_0x3ac691[_0x2254('0x4b')],null))['then'](respondWithResult(_0xa103ea,null))[_0x2254('0x45')](handleError(_0xa103ea,null));};exports[_0x2254('0x4c')]=function(_0x4d2c96,_0x26d01a){return db[_0x2254('0x2c')][_0x2254('0x49')]({'where':{'id':_0x4d2c96[_0x2254('0x47')]['id']}})['then'](handleEntityNotFound(_0x26d01a,null))[_0x2254('0x26')](removeEntity(_0x26d01a,null))[_0x2254('0x45')](handleError(_0x26d01a,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index bb0bc2e..2f28bec 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 _0xc22d=['util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./integration.attributes','define','integrations','lodash'];(function(_0x535ad6,_0x22b56c){var _0x12d4f6=function(_0x3d65a6){while(--_0x3d65a6){_0x535ad6['push'](_0x535ad6['shift']());}};_0x12d4f6(++_0x22b56c);}(_0xc22d,0xa4));var _0xdc22=function(_0x355f93,_0x96b5bc){_0x355f93=_0x355f93-0x0;var _0x54ef64=_0xc22d[_0x355f93];return _0x54ef64;};'use strict';var _=require(_0xdc22('0x0'));var util=require(_0xdc22('0x1'));var logger=require(_0xdc22('0x2'))('api');var moment=require('moment');var BPromise=require(_0xdc22('0x3'));var rp=require(_0xdc22('0x4'));var fs=require('fs');var path=require(_0xdc22('0x5'));var rimraf=require(_0xdc22('0x6'));var config=require(_0xdc22('0x7'));var attributes=require(_0xdc22('0x8'));module['exports']=function(_0x5b1b5d,_0x5628e7){return _0x5b1b5d[_0xdc22('0x9')]('Integration',attributes,{'tableName':_0xdc22('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbc1a=['request-promise','path','../../config/environment','exports','define','integrations','lodash','util','../../config/logger','api'];(function(_0x39096d,_0x51f8a0){var _0x13da4f=function(_0x11e6b2){while(--_0x11e6b2){_0x39096d['push'](_0x39096d['shift']());}};_0x13da4f(++_0x51f8a0);}(_0xbc1a,0x9c));var _0xabc1=function(_0x4c445a,_0x4ee80f){_0x4c445a=_0x4c445a-0x0;var _0x2f611c=_0xbc1a[_0x4c445a];return _0x2f611c;};'use strict';var _=require(_0xabc1('0x0'));var util=require(_0xabc1('0x1'));var logger=require(_0xabc1('0x2'))(_0xabc1('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xabc1('0x4'));var fs=require('fs');var path=require(_0xabc1('0x5'));var rimraf=require('rimraf');var config=require(_0xabc1('0x6'));var attributes=require('./integration.attributes');module[_0xabc1('0x7')]=function(_0x428cc3,_0x47a994){return _0x428cc3[_0xabc1('0x8')]('Integration',attributes,{'tableName':_0xabc1('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integration/integration.rpc.js b/server/api/integration/integration.rpc.js index 4a5b5a9..cdd28b7 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 _0x9f0e=['../../config/environment','jayson/promise','request','then','info','Integration,\x20%s,\x20%s','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc'];(function(_0x4acf95,_0x52e69a){var _0x38a343=function(_0x44c399){while(--_0x44c399){_0x4acf95['push'](_0x4acf95['shift']());}};_0x38a343(++_0x52e69a);}(_0x9f0e,0x116));var _0xe9f0=function(_0xcc1a78,_0x1a9492){_0xcc1a78=_0xcc1a78-0x0;var _0x559415=_0x9f0e[_0xcc1a78];return _0x559415;};'use strict';var _=require(_0xe9f0('0x0'));var util=require(_0xe9f0('0x1'));var moment=require(_0xe9f0('0x2'));var BPromise=require(_0xe9f0('0x3'));var rs=require(_0xe9f0('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xe9f0('0x5'));var logger=require(_0xe9f0('0x6'))(_0xe9f0('0x7'));var config=require(_0xe9f0('0x8'));var jayson=require(_0xe9f0('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3a17b3,_0x167198,_0xe64a79){return new BPromise(function(_0x4be6a6,_0xf4a256){return client[_0xe9f0('0xa')](_0x3a17b3,_0xe64a79)[_0xe9f0('0xb')](function(_0x3386a8){logger[_0xe9f0('0xc')](_0xe9f0('0xd'),_0x167198,_0xe9f0('0xe'));logger[_0xe9f0('0xf')](_0xe9f0('0x10'),_0x167198,'request\x20sent',JSON[_0xe9f0('0x11')](_0x3386a8));if(_0x3386a8[_0xe9f0('0x12')]){if(_0x3386a8[_0xe9f0('0x12')]['code']===0x1f4){logger[_0xe9f0('0x12')]('Integration,\x20%s,\x20%s',_0x167198,_0x3386a8[_0xe9f0('0x12')][_0xe9f0('0x13')]);return _0xf4a256(_0x3386a8[_0xe9f0('0x12')][_0xe9f0('0x13')]);}logger['error'](_0xe9f0('0xd'),_0x167198,_0x3386a8['error'][_0xe9f0('0x13')]);return _0x4be6a6(_0x3386a8[_0xe9f0('0x12')][_0xe9f0('0x13')]);}else{logger['info'](_0xe9f0('0xd'),_0x167198,_0xe9f0('0xe'));_0x4be6a6(_0x3386a8[_0xe9f0('0x14')]['message']);}})[_0xe9f0('0x15')](function(_0x1e16e0){logger[_0xe9f0('0x12')](_0xe9f0('0xd'),_0x167198,_0x1e16e0);_0xf4a256(_0x1e16e0);});});} \ No newline at end of file +var _0x7880=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','Integration,\x20%s,\x20%s','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x20e2e2,_0x26bce0){var _0x3af300=function(_0x2c65b7){while(--_0x2c65b7){_0x20e2e2['push'](_0x20e2e2['shift']());}};_0x3af300(++_0x26bce0);}(_0x7880,0x1f4));var _0x0788=function(_0xa3ff70,_0x4a8609){_0xa3ff70=_0xa3ff70-0x0;var _0x538dbb=_0x7880[_0xa3ff70];return _0x538dbb;};'use strict';var _=require('lodash');var util=require(_0x0788('0x0'));var moment=require(_0x0788('0x1'));var BPromise=require(_0x0788('0x2'));var rs=require(_0x0788('0x3'));var fs=require('fs');var Redis=require(_0x0788('0x4'));var db=require(_0x0788('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0788('0x6'))(_0x0788('0x7'));var config=require(_0x0788('0x8'));var jayson=require(_0x0788('0x9'));var client=jayson[_0x0788('0xa')][_0x0788('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3f9cb8,_0x44bbb5,_0x3c29f3){return new BPromise(function(_0x422f8b,_0x55e48a){return client[_0x0788('0xc')](_0x3f9cb8,_0x3c29f3)['then'](function(_0xabaf81){logger['info'](_0x0788('0xd'),_0x44bbb5,_0x0788('0xe'));logger[_0x0788('0xf')](_0x0788('0x10'),_0x44bbb5,_0x0788('0xe'),JSON['stringify'](_0xabaf81));if(_0xabaf81[_0x0788('0x11')]){if(_0xabaf81[_0x0788('0x11')][_0x0788('0x12')]===0x1f4){logger[_0x0788('0x11')](_0x0788('0xd'),_0x44bbb5,_0xabaf81[_0x0788('0x11')][_0x0788('0x13')]);return _0x55e48a(_0xabaf81['error'][_0x0788('0x13')]);}logger[_0x0788('0x11')](_0x0788('0xd'),_0x44bbb5,_0xabaf81[_0x0788('0x11')]['message']);return _0x422f8b(_0xabaf81[_0x0788('0x11')]['message']);}else{logger[_0x0788('0x14')](_0x0788('0xd'),_0x44bbb5,_0x0788('0xe'));_0x422f8b(_0xabaf81[_0x0788('0x15')][_0x0788('0x13')]);}})[_0x0788('0x16')](function(_0x5e1a29){logger['error'](_0x0788('0xd'),_0x44bbb5,_0x5e1a29);_0x55e48a(_0x5e1a29);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index d2d7c3d..37c859f 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 _0x7a54=['destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./integrationReport.controller','get','index','/describe','isAuthenticated','post','put','update','delete','/:id'];(function(_0x55e17c,_0x4ce6c5){var _0x377b3f=function(_0x4c7a49){while(--_0x4c7a49){_0x55e17c['push'](_0x55e17c['shift']());}};_0x377b3f(++_0x4ce6c5);}(_0x7a54,0x106));var _0x47a5=function(_0x2abc34,_0x1786e1){_0x2abc34=_0x2abc34-0x0;var _0x3a0e7a=_0x7a54[_0x2abc34];return _0x3a0e7a;};'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('0xd')]('/',auth[_0x47a5('0xc')](),controller['create']);router[_0x47a5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x47a5('0xf')]);router[_0x47a5('0x10')](_0x47a5('0x11'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x12')]);module[_0x47a5('0x13')]=router; \ No newline at end of file +var _0x2ef3=['express','Router','../../components/auth/service','../../components/interaction/service','./integrationReport.controller','get','/describe','isAuthenticated','describe','/:id','show','post','update','delete','exports','multer','util','path','connect-timeout'];(function(_0x27ee1c,_0x222593){var _0x322117=function(_0x2de54f){while(--_0x2de54f){_0x27ee1c['push'](_0x27ee1c['shift']());}};_0x322117(++_0x222593);}(_0x2ef3,0xba));var _0x32ef=function(_0x570dad,_0x180937){_0x570dad=_0x570dad-0x0;var _0x174a10=_0x2ef3[_0x570dad];return _0x174a10;};'use strict';var multer=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var path=require(_0x32ef('0x2'));var timeout=require(_0x32ef('0x3'));var express=require(_0x32ef('0x4'));var router=express[_0x32ef('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x32ef('0x6'));var interaction=require(_0x32ef('0x7'));var config=require('../../config/environment');var controller=require(_0x32ef('0x8'));router[_0x32ef('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x32ef('0x9')](_0x32ef('0xa'),auth[_0x32ef('0xb')](),controller[_0x32ef('0xc')]);router[_0x32ef('0x9')](_0x32ef('0xd'),auth[_0x32ef('0xb')](),controller[_0x32ef('0xe')]);router[_0x32ef('0xf')]('/',auth[_0x32ef('0xb')](),controller['create']);router['put'](_0x32ef('0xd'),auth[_0x32ef('0xb')](),controller[_0x32ef('0x10')]);router[_0x32ef('0x11')]('/:id',auth[_0x32ef('0xb')](),controller['destroy']);module[_0x32ef('0x12')]=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index 40692c3..31a5f79 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 _0xe91f=['SENDING','exports','STRING','DATE','INTEGER','TEXT','ENUM','SENT'];(function(_0x2ea1d4,_0x34f914){var _0x53ddb7=function(_0x496e68){while(--_0x496e68){_0x2ea1d4['push'](_0x2ea1d4['shift']());}};_0x53ddb7(++_0x34f914);}(_0xe91f,0x79));var _0xfe91=function(_0x1cc3fa,_0x427be6){_0x1cc3fa=_0x1cc3fa-0x0;var _0xd25d23=_0xe91f[_0x1cc3fa];return _0xd25d23;};'use strict';var Sequelize=require('sequelize');module[_0xfe91('0x0')]={'integration':{'type':Sequelize['STRING']},'eventChannel':{'type':Sequelize[_0xfe91('0x1')]},'exitStatus':{'type':Sequelize[_0xfe91('0x1')]},'ticketId':{'type':Sequelize[_0xfe91('0x1')]},'integrationId':{'type':Sequelize['INTEGER']},'contacts':{'type':Sequelize[_0xfe91('0x1')]},'uniqueid':{'type':Sequelize[_0xfe91('0x1')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xfe91('0x1')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0xfe91('0x1')]},'membername':{'type':Sequelize[_0xfe91('0x1')]},'agentcalledAt':{'type':Sequelize[_0xfe91('0x2')]},'agentconnectAt':{'type':Sequelize[_0xfe91('0x2')]},'holdtime':{'type':Sequelize[_0xfe91('0x3')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0xfe91('0x2')]},'talktime':{'type':Sequelize[_0xfe91('0x3')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xfe91('0x3')]},'reason':{'type':Sequelize[_0xfe91('0x1')]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0xfe91('0x2')]},'lastevent':{'type':Sequelize[_0xfe91('0x1')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0xfe91('0x3')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xfe91('0x1')]},'context':{'type':Sequelize[_0xfe91('0x1')]},'exten':{'type':Sequelize[_0xfe91('0x1')]},'priority':{'type':Sequelize[_0xfe91('0x1')]},'destchannel':{'type':Sequelize[_0xfe91('0x1')]},'destchannelstate':{'type':Sequelize[_0xfe91('0x3')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0xfe91('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0xfe91('0x1')]},'destconnectedlinename':{'type':Sequelize[_0xfe91('0x1')]},'destlanguage':{'type':Sequelize[_0xfe91('0x1')]},'destaccountcode':{'type':Sequelize[_0xfe91('0x1')]},'destcontext':{'type':Sequelize[_0xfe91('0x1')]},'destexten':{'type':Sequelize[_0xfe91('0x1')]},'destpriority':{'type':Sequelize[_0xfe91('0x1')]},'destuniqueid':{'type':Sequelize['STRING']},'messageId':{'type':Sequelize[_0xfe91('0x1')]},'inReplyTo':{'type':Sequelize[_0xfe91('0x1')]},'subject':{'type':Sequelize[_0xfe91('0x1')]},'from':{'type':Sequelize[_0xfe91('0x1')]},'to':{'type':Sequelize[_0xfe91('0x1')]},'cc':{'type':Sequelize[_0xfe91('0x1')]},'attachment':{'type':Sequelize[_0xfe91('0x4')]},'html':{'type':Sequelize['TEXT']},'text':{'type':Sequelize[_0xfe91('0x4')]},'status':{'type':Sequelize[_0xfe91('0x5')](_0xfe91('0x6'),_0xfe91('0x7'),'RECEIVED','FAILED')},'url':{'type':Sequelize[_0xfe91('0x1')]},'app':{'type':Sequelize[_0xfe91('0x1')]},'appdata':{'type':Sequelize['STRING']},'projectId':{'type':Sequelize[_0xfe91('0x3')]}}; \ No newline at end of file +var _0x4ad0=['DATE','BOOLEAN','TEXT','ENUM','SENT','RECEIVED','FAILED','sequelize','STRING','INTEGER'];(function(_0x1b58e0,_0x2fbfc8){var _0x53158e=function(_0x5ed222){while(--_0x5ed222){_0x1b58e0['push'](_0x1b58e0['shift']());}};_0x53158e(++_0x2fbfc8);}(_0x4ad0,0x7f));var _0x04ad=function(_0x5cddda,_0x1c5e82){_0x5cddda=_0x5cddda-0x0;var _0x503ade=_0x4ad0[_0x5cddda];return _0x503ade;};'use strict';var Sequelize=require(_0x04ad('0x0'));module['exports']={'integration':{'type':Sequelize[_0x04ad('0x1')]},'eventChannel':{'type':Sequelize[_0x04ad('0x1')]},'exitStatus':{'type':Sequelize[_0x04ad('0x1')]},'ticketId':{'type':Sequelize[_0x04ad('0x1')]},'integrationId':{'type':Sequelize[_0x04ad('0x2')]},'contacts':{'type':Sequelize[_0x04ad('0x1')]},'uniqueid':{'type':Sequelize[_0x04ad('0x1')]},'calleridnum':{'type':Sequelize[_0x04ad('0x1')]},'calleridname':{'type':Sequelize[_0x04ad('0x1')]},'queue':{'type':Sequelize[_0x04ad('0x1')]},'interface':{'type':Sequelize[_0x04ad('0x1')]},'membername':{'type':Sequelize[_0x04ad('0x1')]},'agentcalledAt':{'type':Sequelize[_0x04ad('0x3')]},'agentconnectAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0x04ad('0x2')]},'agentcomplete':{'type':Sequelize[_0x04ad('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize['DATE']},'talktime':{'type':Sequelize[_0x04ad('0x2')]},'agentacw':{'type':Sequelize[_0x04ad('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0x04ad('0x1')]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x04ad('0x3')]},'agentdump':{'type':Sequelize[_0x04ad('0x4')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize[_0x04ad('0x1')]},'channel':{'type':Sequelize[_0x04ad('0x1')]},'channelstate':{'type':Sequelize[_0x04ad('0x2')]},'channelstatedesc':{'type':Sequelize[_0x04ad('0x1')]},'connectedlinenum':{'type':Sequelize[_0x04ad('0x1')]},'connectedlinename':{'type':Sequelize[_0x04ad('0x1')]},'language':{'type':Sequelize[_0x04ad('0x1')]},'accountcode':{'type':Sequelize[_0x04ad('0x1')]},'context':{'type':Sequelize[_0x04ad('0x1')]},'exten':{'type':Sequelize[_0x04ad('0x1')]},'priority':{'type':Sequelize[_0x04ad('0x1')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x04ad('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0x04ad('0x1')]},'destcalleridnum':{'type':Sequelize[_0x04ad('0x1')]},'destcalleridname':{'type':Sequelize[_0x04ad('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0x04ad('0x1')]},'destconnectedlinename':{'type':Sequelize[_0x04ad('0x1')]},'destlanguage':{'type':Sequelize[_0x04ad('0x1')]},'destaccountcode':{'type':Sequelize[_0x04ad('0x1')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x04ad('0x1')]},'destpriority':{'type':Sequelize[_0x04ad('0x1')]},'destuniqueid':{'type':Sequelize[_0x04ad('0x1')]},'messageId':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0x04ad('0x1')]},'subject':{'type':Sequelize['STRING']},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0x04ad('0x1')]},'cc':{'type':Sequelize[_0x04ad('0x1')]},'attachment':{'type':Sequelize[_0x04ad('0x5')]},'html':{'type':Sequelize['TEXT']},'text':{'type':Sequelize[_0x04ad('0x5')]},'status':{'type':Sequelize[_0x04ad('0x6')](_0x04ad('0x7'),'SENDING',_0x04ad('0x8'),_0x04ad('0x9'))},'url':{'type':Sequelize[_0x04ad('0x1')]},'app':{'type':Sequelize[_0x04ad('0x1')]},'appdata':{'type':Sequelize[_0x04ad('0x1')]},'projectId':{'type':Sequelize[_0x04ad('0x2')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index e98852a..43fe41b 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 _0x2fdc=['map','keys','query','filters','intersection','attributes','length','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','options','includeAll','include','IntegrationReport','findAll','show','params','rawAttributes','fields','find','create','body','update','catch','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','end','error','stack','name','index','fieldName','key','model'];(function(_0x50aa2e,_0xfbd6f0){var _0x5e07f0=function(_0x3ed540){while(--_0x3ed540){_0x50aa2e['push'](_0x50aa2e['shift']());}};_0x5e07f0(++_0xfbd6f0);}(_0x2fdc,0x1a0));var _0xc2fd=function(_0x255ac0,_0x3f6645){_0x255ac0=_0x255ac0-0x0;var _0x437bf1=_0x2fdc[_0x255ac0];return _0x437bf1;};'use strict';var emlformat=require(_0xc2fd('0x0'));var rimraf=require(_0xc2fd('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc2fd('0x2'));var rp=require(_0xc2fd('0x3'));var moment=require(_0xc2fd('0x4'));var BPromise=require(_0xc2fd('0x5'));var Mustache=require('mustache');var util=require(_0xc2fd('0x6'));var path=require(_0xc2fd('0x7'));var sox=require(_0xc2fd('0x8'));var csv=require(_0xc2fd('0x9'));var ejs=require(_0xc2fd('0xa'));var fs=require('fs');var fs_extra=require(_0xc2fd('0xb'));var _=require(_0xc2fd('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xc2fd('0xd'));var deskjs=require(_0xc2fd('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc2fd('0xf'));var Redis=require(_0xc2fd('0x10'));var authService=require(_0xc2fd('0x11'));var qs=require(_0xc2fd('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc2fd('0x13'));var logger=require(_0xc2fd('0x14'))('api');var utils=require(_0xc2fd('0x15'));var config=require(_0xc2fd('0x16'));var licenseUtil=require(_0xc2fd('0x17'));var db=require(_0xc2fd('0x18'))['db'];function respondWithStatusCode(_0x34c9dc,_0x45ddbe){_0x45ddbe=_0x45ddbe||0xcc;return function(_0x44a219){if(_0x44a219){return _0x34c9dc[_0xc2fd('0x19')](_0x45ddbe);}return _0x34c9dc['status'](_0x45ddbe)['end']();};}function respondWithResult(_0xe02639,_0x1d615e){_0x1d615e=_0x1d615e||0xc8;return function(_0x3d1db2){if(_0x3d1db2){return _0xe02639['status'](_0x1d615e)[_0xc2fd('0x1a')](_0x3d1db2);}};}function respondWithFilteredResult(_0x3bccae,_0x30734d){return function(_0x512e8b){if(_0x512e8b){var _0x571604=typeof _0x30734d[_0xc2fd('0x1b')]===_0xc2fd('0x1c')&&typeof _0x30734d[_0xc2fd('0x1d')]===_0xc2fd('0x1c');var _0x1b0d85=_0x512e8b[_0xc2fd('0x1e')];var _0x36330b=_0x571604?0x0:_0x30734d[_0xc2fd('0x1b')];var _0x459b9e=_0x571604?_0x512e8b[_0xc2fd('0x1e')]:_0x30734d['offset']+_0x30734d[_0xc2fd('0x1d')];var _0x27e542;if(_0x459b9e>=_0x1b0d85){_0x459b9e=_0x1b0d85;_0x27e542=0xc8;}else{_0x27e542=0xce;}_0x3bccae['status'](_0x27e542);return _0x3bccae[_0xc2fd('0x1f')](_0xc2fd('0x20'),_0x36330b+'-'+_0x459b9e+'/'+_0x1b0d85)[_0xc2fd('0x1a')](_0x512e8b);}return null;};}function patchUpdates(_0x221bd9){return function(_0x5bef7f){try{jsonpatch[_0xc2fd('0x21')](_0x5bef7f,_0x221bd9,!![]);}catch(_0x45dc4a){return BPromise[_0xc2fd('0x22')](_0x45dc4a);}return _0x5bef7f[_0xc2fd('0x23')]();};}function saveUpdates(_0x5e992e,_0x343e16){return function(_0x171d6d){if(_0x171d6d){return _0x171d6d['update'](_0x5e992e)[_0xc2fd('0x24')](function(_0x255278){return _0x255278;});}return null;};}function removeEntity(_0x2743de,_0x3ba18c){return function(_0x36aef8){if(_0x36aef8){return _0x36aef8[_0xc2fd('0x25')]()[_0xc2fd('0x24')](function(){_0x2743de['status'](0xcc)[_0xc2fd('0x26')]();});}};}function handleEntityNotFound(_0x574db9,_0x504245){return function(_0x38e8c9){if(!_0x38e8c9){_0x574db9[_0xc2fd('0x19')](0x194);}return _0x38e8c9;};}function handleError(_0x5c6bef,_0x294413){_0x294413=_0x294413||0x1f4;return function(_0x35cd65){logger[_0xc2fd('0x27')](_0x35cd65[_0xc2fd('0x28')]);if(_0x35cd65[_0xc2fd('0x29')]){delete _0x35cd65['name'];}_0x5c6bef['status'](_0x294413)['send'](_0x35cd65);};}exports[_0xc2fd('0x2a')]=function(_0x1051c9,_0x39c7ef){var _0x2fb34d={},_0x5c01a8={},_0x3faa8b={'count':0x0,'rows':[]};var _0x10e5b8=_['map'](db['IntegrationReport']['rawAttributes'],function(_0x12dfab){return{'name':_0x12dfab[_0xc2fd('0x2b')],'type':_0x12dfab['type'][_0xc2fd('0x2c')]};});_0x5c01a8[_0xc2fd('0x2d')]=_[_0xc2fd('0x2e')](_0x10e5b8,_0xc2fd('0x29'));_0x5c01a8['query']=_[_0xc2fd('0x2f')](_0x1051c9[_0xc2fd('0x30')]);_0x5c01a8[_0xc2fd('0x31')]=_[_0xc2fd('0x32')](_0x5c01a8['model'],_0x5c01a8[_0xc2fd('0x30')]);_0x2fb34d['attributes']=_[_0xc2fd('0x32')](_0x5c01a8['model'],qs['fields'](_0x1051c9['query']['fields']));_0x2fb34d[_0xc2fd('0x33')]=_0x2fb34d[_0xc2fd('0x33')][_0xc2fd('0x34')]?_0x2fb34d[_0xc2fd('0x33')]:_0x5c01a8['model'];if(!_0x1051c9[_0xc2fd('0x30')]['hasOwnProperty'](_0xc2fd('0x35'))){_0x2fb34d[_0xc2fd('0x1d')]=qs[_0xc2fd('0x1d')](_0x1051c9[_0xc2fd('0x30')]['limit']);_0x2fb34d['offset']=qs[_0xc2fd('0x1b')](_0x1051c9[_0xc2fd('0x30')][_0xc2fd('0x1b')]);}_0x2fb34d[_0xc2fd('0x36')]=qs[_0xc2fd('0x37')](_0x1051c9[_0xc2fd('0x30')][_0xc2fd('0x37')]);_0x2fb34d[_0xc2fd('0x38')]=qs['filters'](_[_0xc2fd('0x39')](_0x1051c9[_0xc2fd('0x30')],_0x5c01a8['filters']),_0x10e5b8);if(_0x1051c9[_0xc2fd('0x30')]['filter']){_0x2fb34d[_0xc2fd('0x38')]=_[_0xc2fd('0x3a')](_0x2fb34d[_0xc2fd('0x38')],{'$or':_[_0xc2fd('0x2e')](_0x10e5b8,function(_0x44281b){if(_0x44281b[_0xc2fd('0x3b')]!==_0xc2fd('0x3c')){var _0x15b4fa={};_0x15b4fa[_0x44281b[_0xc2fd('0x29')]]={'$like':'%'+_0x1051c9[_0xc2fd('0x30')][_0xc2fd('0x3d')]+'%'};return _0x15b4fa;}})});}_0x2fb34d=_[_0xc2fd('0x3a')]({},_0x2fb34d,_0x1051c9[_0xc2fd('0x3e')]);var _0x3bb05c={'where':_0x2fb34d[_0xc2fd('0x38')]};return db['IntegrationReport'][_0xc2fd('0x1e')](_0x3bb05c)[_0xc2fd('0x24')](function(_0x234e79){_0x3faa8b['count']=_0x234e79;if(_0x1051c9['query'][_0xc2fd('0x3f')]){_0x2fb34d[_0xc2fd('0x40')]=[{'all':!![]}];}return db[_0xc2fd('0x41')][_0xc2fd('0x42')](_0x2fb34d);})[_0xc2fd('0x24')](function(_0x169da0){_0x3faa8b['rows']=_0x169da0;return _0x3faa8b;})[_0xc2fd('0x24')](respondWithFilteredResult(_0x39c7ef,_0x2fb34d))['catch'](handleError(_0x39c7ef,null));};exports[_0xc2fd('0x43')]=function(_0x38b3d3,_0x503105){var _0x463dda={'raw':![],'where':{'id':_0x38b3d3[_0xc2fd('0x44')]['id']}},_0x31b9b0={};_0x31b9b0[_0xc2fd('0x2d')]=_['keys'](db['IntegrationReport'][_0xc2fd('0x45')]);_0x31b9b0[_0xc2fd('0x30')]=_[_0xc2fd('0x2f')](_0x38b3d3[_0xc2fd('0x30')]);_0x31b9b0[_0xc2fd('0x31')]=_['intersection'](_0x31b9b0['model'],_0x31b9b0[_0xc2fd('0x30')]);_0x463dda[_0xc2fd('0x33')]=_[_0xc2fd('0x32')](_0x31b9b0[_0xc2fd('0x2d')],qs[_0xc2fd('0x46')](_0x38b3d3[_0xc2fd('0x30')][_0xc2fd('0x46')]));_0x463dda[_0xc2fd('0x33')]=_0x463dda[_0xc2fd('0x33')][_0xc2fd('0x34')]?_0x463dda[_0xc2fd('0x33')]:_0x31b9b0[_0xc2fd('0x2d')];if(_0x38b3d3[_0xc2fd('0x30')]['includeAll']){_0x463dda[_0xc2fd('0x40')]=[{'all':!![]}];}_0x463dda=_['merge']({},_0x463dda,_0x38b3d3[_0xc2fd('0x3e')]);return db[_0xc2fd('0x41')][_0xc2fd('0x47')](_0x463dda)[_0xc2fd('0x24')](handleEntityNotFound(_0x503105,null))['then'](respondWithResult(_0x503105,null))['catch'](handleError(_0x503105,null));};exports[_0xc2fd('0x48')]=function(_0x450087,_0x3e79a2){return db[_0xc2fd('0x41')][_0xc2fd('0x48')](_0x450087[_0xc2fd('0x49')],{})['then'](respondWithResult(_0x3e79a2,0xc9))['catch'](handleError(_0x3e79a2,null));};exports[_0xc2fd('0x4a')]=function(_0x58ec8f,_0x125520){if(_0x58ec8f[_0xc2fd('0x49')]['id']){delete _0x58ec8f[_0xc2fd('0x49')]['id'];}return db[_0xc2fd('0x41')][_0xc2fd('0x47')]({'where':{'id':_0x58ec8f[_0xc2fd('0x44')]['id']}})[_0xc2fd('0x24')](handleEntityNotFound(_0x125520,null))[_0xc2fd('0x24')](saveUpdates(_0x58ec8f['body'],null))[_0xc2fd('0x24')](respondWithResult(_0x125520,null))[_0xc2fd('0x4b')](handleError(_0x125520,null));};exports[_0xc2fd('0x25')]=function(_0x183eb6,_0x312682){return db[_0xc2fd('0x41')][_0xc2fd('0x47')]({'where':{'id':_0x183eb6['params']['id']}})[_0xc2fd('0x24')](handleEntityNotFound(_0x312682,null))['then'](removeEntity(_0x312682,null))[_0xc2fd('0x4b')](handleError(_0x312682,null));};exports[_0xc2fd('0x4c')]=function(_0x42a844,_0x40192a){return db[_0xc2fd('0x41')]['describe']()['then'](respondWithResult(_0x40192a,null))[_0xc2fd('0x4b')](handleError(_0x40192a,null));}; \ No newline at end of file +var _0xa2b3=['../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','Content-Range','apply','reject','update','then','destroy','status','error','stack','name','index','map','IntegrationReport','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','show','params','catch','create','body','find','describe','rimraf','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x1dca51,_0x44b5b1){var _0x598366=function(_0x195d86){while(--_0x195d86){_0x1dca51['push'](_0x1dca51['shift']());}};_0x598366(++_0x44b5b1);}(_0xa2b3,0x1af));var _0x3a2b=function(_0x4b8b21,_0x1a910b){_0x4b8b21=_0x4b8b21-0x0;var _0xeb8cc1=_0xa2b3[_0x4b8b21];return _0xeb8cc1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3a2b('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x3a2b('0x1'));var moment=require(_0x3a2b('0x2'));var BPromise=require(_0x3a2b('0x3'));var Mustache=require(_0x3a2b('0x4'));var util=require(_0x3a2b('0x5'));var path=require(_0x3a2b('0x6'));var sox=require('sox');var csv=require(_0x3a2b('0x7'));var ejs=require(_0x3a2b('0x8'));var fs=require('fs');var fs_extra=require(_0x3a2b('0x9'));var _=require(_0x3a2b('0xa'));var squel=require(_0x3a2b('0xb'));var crypto=require(_0x3a2b('0xc'));var jsforce=require(_0x3a2b('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x3a2b('0x7'));var querystring=require(_0x3a2b('0xe'));var Papa=require(_0x3a2b('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x3a2b('0x10'));var as=require(_0x3a2b('0x11'));var hardwareService=require(_0x3a2b('0x12'));var logger=require(_0x3a2b('0x13'))(_0x3a2b('0x14'));var utils=require(_0x3a2b('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x3a2b('0x16'));var db=require(_0x3a2b('0x17'))['db'];function respondWithStatusCode(_0x2bd91a,_0x503026){_0x503026=_0x503026||0xcc;return function(_0x5da247){if(_0x5da247){return _0x2bd91a[_0x3a2b('0x18')](_0x503026);}return _0x2bd91a['status'](_0x503026)[_0x3a2b('0x19')]();};}function respondWithResult(_0x3257ab,_0x220126){_0x220126=_0x220126||0xc8;return function(_0x5c11cd){if(_0x5c11cd){return _0x3257ab['status'](_0x220126)[_0x3a2b('0x1a')](_0x5c11cd);}};}function respondWithFilteredResult(_0x36f040,_0x3da5b7){return function(_0x5c09c7){if(_0x5c09c7){var _0xd1639b=typeof _0x3da5b7[_0x3a2b('0x1b')]===_0x3a2b('0x1c')&&typeof _0x3da5b7[_0x3a2b('0x1d')]===_0x3a2b('0x1c');var _0x37a5cf=_0x5c09c7['count'];var _0x4fae42=_0xd1639b?0x0:_0x3da5b7[_0x3a2b('0x1b')];var _0x1f1cc1=_0xd1639b?_0x5c09c7['count']:_0x3da5b7[_0x3a2b('0x1b')]+_0x3da5b7[_0x3a2b('0x1d')];var _0x39eb06;if(_0x1f1cc1>=_0x37a5cf){_0x1f1cc1=_0x37a5cf;_0x39eb06=0xc8;}else{_0x39eb06=0xce;}_0x36f040['status'](_0x39eb06);return _0x36f040['set'](_0x3a2b('0x1e'),_0x4fae42+'-'+_0x1f1cc1+'/'+_0x37a5cf)['json'](_0x5c09c7);}return null;};}function patchUpdates(_0x457751){return function(_0x5b756){try{jsonpatch[_0x3a2b('0x1f')](_0x5b756,_0x457751,!![]);}catch(_0x26191c){return BPromise[_0x3a2b('0x20')](_0x26191c);}return _0x5b756['save']();};}function saveUpdates(_0x3f702f,_0x39c728){return function(_0x55496d){if(_0x55496d){return _0x55496d[_0x3a2b('0x21')](_0x3f702f)[_0x3a2b('0x22')](function(_0x5955cc){return _0x5955cc;});}return null;};}function removeEntity(_0x35e3cd,_0x17b3a3){return function(_0x27b628){if(_0x27b628){return _0x27b628[_0x3a2b('0x23')]()[_0x3a2b('0x22')](function(){_0x35e3cd[_0x3a2b('0x24')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1e146d,_0x4980f7){return function(_0x4dd123){if(!_0x4dd123){_0x1e146d[_0x3a2b('0x18')](0x194);}return _0x4dd123;};}function handleError(_0xa625b7,_0x103691){_0x103691=_0x103691||0x1f4;return function(_0x136f84){logger[_0x3a2b('0x25')](_0x136f84[_0x3a2b('0x26')]);if(_0x136f84[_0x3a2b('0x27')]){delete _0x136f84['name'];}_0xa625b7[_0x3a2b('0x24')](_0x103691)['send'](_0x136f84);};}exports[_0x3a2b('0x28')]=function(_0x60e3e8,_0x38aedb){var _0x11f917={},_0x14a849={},_0x400731={'count':0x0,'rows':[]};var _0x36485c=_[_0x3a2b('0x29')](db[_0x3a2b('0x2a')][_0x3a2b('0x2b')],function(_0x2ab55a){return{'name':_0x2ab55a[_0x3a2b('0x2c')],'type':_0x2ab55a[_0x3a2b('0x2d')][_0x3a2b('0x2e')]};});_0x14a849['model']=_[_0x3a2b('0x29')](_0x36485c,'name');_0x14a849['query']=_[_0x3a2b('0x2f')](_0x60e3e8[_0x3a2b('0x30')]);_0x14a849[_0x3a2b('0x31')]=_[_0x3a2b('0x32')](_0x14a849[_0x3a2b('0x33')],_0x14a849[_0x3a2b('0x30')]);_0x11f917['attributes']=_['intersection'](_0x14a849[_0x3a2b('0x33')],qs[_0x3a2b('0x34')](_0x60e3e8['query'][_0x3a2b('0x34')]));_0x11f917[_0x3a2b('0x35')]=_0x11f917[_0x3a2b('0x35')][_0x3a2b('0x36')]?_0x11f917[_0x3a2b('0x35')]:_0x14a849[_0x3a2b('0x33')];if(!_0x60e3e8['query'][_0x3a2b('0x37')]('nolimit')){_0x11f917[_0x3a2b('0x1d')]=qs['limit'](_0x60e3e8[_0x3a2b('0x30')][_0x3a2b('0x1d')]);_0x11f917[_0x3a2b('0x1b')]=qs[_0x3a2b('0x1b')](_0x60e3e8[_0x3a2b('0x30')]['offset']);}_0x11f917[_0x3a2b('0x38')]=qs['sort'](_0x60e3e8[_0x3a2b('0x30')][_0x3a2b('0x39')]);_0x11f917[_0x3a2b('0x3a')]=qs[_0x3a2b('0x31')](_[_0x3a2b('0x3b')](_0x60e3e8[_0x3a2b('0x30')],_0x14a849[_0x3a2b('0x31')]),_0x36485c);if(_0x60e3e8['query'][_0x3a2b('0x3c')]){_0x11f917[_0x3a2b('0x3a')]=_[_0x3a2b('0x3d')](_0x11f917[_0x3a2b('0x3a')],{'$or':_['map'](_0x36485c,function(_0x369885){if(_0x369885[_0x3a2b('0x2d')]!==_0x3a2b('0x3e')){var _0x3e7df6={};_0x3e7df6[_0x369885['name']]={'$like':'%'+_0x60e3e8[_0x3a2b('0x30')][_0x3a2b('0x3c')]+'%'};return _0x3e7df6;}})});}_0x11f917=_[_0x3a2b('0x3d')]({},_0x11f917,_0x60e3e8[_0x3a2b('0x3f')]);var _0xbfe68={'where':_0x11f917['where']};return db[_0x3a2b('0x2a')][_0x3a2b('0x40')](_0xbfe68)['then'](function(_0x1b3241){_0x400731[_0x3a2b('0x40')]=_0x1b3241;if(_0x60e3e8['query'][_0x3a2b('0x41')]){_0x11f917[_0x3a2b('0x42')]=[{'all':!![]}];}return db[_0x3a2b('0x2a')][_0x3a2b('0x43')](_0x11f917);})[_0x3a2b('0x22')](function(_0x2deaa7){_0x400731['rows']=_0x2deaa7;return _0x400731;})[_0x3a2b('0x22')](respondWithFilteredResult(_0x38aedb,_0x11f917))['catch'](handleError(_0x38aedb,null));};exports[_0x3a2b('0x44')]=function(_0x54e51e,_0x49067f){var _0x247827={'raw':![],'where':{'id':_0x54e51e[_0x3a2b('0x45')]['id']}},_0x510296={};_0x510296[_0x3a2b('0x33')]=_[_0x3a2b('0x2f')](db[_0x3a2b('0x2a')][_0x3a2b('0x2b')]);_0x510296['query']=_[_0x3a2b('0x2f')](_0x54e51e['query']);_0x510296[_0x3a2b('0x31')]=_[_0x3a2b('0x32')](_0x510296[_0x3a2b('0x33')],_0x510296[_0x3a2b('0x30')]);_0x247827['attributes']=_['intersection'](_0x510296[_0x3a2b('0x33')],qs['fields'](_0x54e51e['query'][_0x3a2b('0x34')]));_0x247827[_0x3a2b('0x35')]=_0x247827[_0x3a2b('0x35')][_0x3a2b('0x36')]?_0x247827[_0x3a2b('0x35')]:_0x510296[_0x3a2b('0x33')];if(_0x54e51e[_0x3a2b('0x30')]['includeAll']){_0x247827[_0x3a2b('0x42')]=[{'all':!![]}];}_0x247827=_[_0x3a2b('0x3d')]({},_0x247827,_0x54e51e['options']);return db[_0x3a2b('0x2a')]['find'](_0x247827)[_0x3a2b('0x22')](handleEntityNotFound(_0x49067f,null))[_0x3a2b('0x22')](respondWithResult(_0x49067f,null))[_0x3a2b('0x46')](handleError(_0x49067f,null));};exports[_0x3a2b('0x47')]=function(_0x10b86c,_0x1d703a){return db[_0x3a2b('0x2a')][_0x3a2b('0x47')](_0x10b86c[_0x3a2b('0x48')],{})[_0x3a2b('0x22')](respondWithResult(_0x1d703a,0xc9))[_0x3a2b('0x46')](handleError(_0x1d703a,null));};exports['update']=function(_0x214c3f,_0x383249){if(_0x214c3f[_0x3a2b('0x48')]['id']){delete _0x214c3f[_0x3a2b('0x48')]['id'];}return db[_0x3a2b('0x2a')][_0x3a2b('0x49')]({'where':{'id':_0x214c3f[_0x3a2b('0x45')]['id']}})[_0x3a2b('0x22')](handleEntityNotFound(_0x383249,null))[_0x3a2b('0x22')](saveUpdates(_0x214c3f[_0x3a2b('0x48')],null))[_0x3a2b('0x22')](respondWithResult(_0x383249,null))[_0x3a2b('0x46')](handleError(_0x383249,null));};exports[_0x3a2b('0x23')]=function(_0x388ee8,_0x1621a9){return db[_0x3a2b('0x2a')][_0x3a2b('0x49')]({'where':{'id':_0x388ee8[_0x3a2b('0x45')]['id']}})[_0x3a2b('0x22')](handleEntityNotFound(_0x1621a9,null))[_0x3a2b('0x22')](removeEntity(_0x1621a9,null))[_0x3a2b('0x46')](handleError(_0x1621a9,null));};exports[_0x3a2b('0x4a')]=function(_0x491b30,_0x4c97e3){return db['IntegrationReport'][_0x3a2b('0x4a')]()[_0x3a2b('0x22')](respondWithResult(_0x4c97e3,null))[_0x3a2b('0x46')](handleError(_0x4c97e3,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index cf88c83..dd0954d 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 _0x27bb=['util','../../config/logger','api','bluebird','request-promise','path','rimraf','./integrationReport.attributes','exports','define','IntegrationReport','lodash'];(function(_0x3759fa,_0x4a1baa){var _0x4e512e=function(_0x4cd625){while(--_0x4cd625){_0x3759fa['push'](_0x3759fa['shift']());}};_0x4e512e(++_0x4a1baa);}(_0x27bb,0xd7));var _0xb27b=function(_0x16570e,_0x15895f){_0x16570e=_0x16570e-0x0;var _0x23cb22=_0x27bb[_0x16570e];return _0x23cb22;};'use strict';var _=require(_0xb27b('0x0'));var util=require(_0xb27b('0x1'));var logger=require(_0xb27b('0x2'))(_0xb27b('0x3'));var moment=require('moment');var BPromise=require(_0xb27b('0x4'));var rp=require(_0xb27b('0x5'));var fs=require('fs');var path=require(_0xb27b('0x6'));var rimraf=require(_0xb27b('0x7'));var config=require('../../config/environment');var attributes=require(_0xb27b('0x8'));module[_0xb27b('0x9')]=function(_0x19a442,_0x548031){return _0x19a442[_0xb27b('0xa')](_0xb27b('0xb'),attributes,{'tableName':'report_integration','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x05da=['report_integration','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./integrationReport.attributes','exports','define','IntegrationReport'];(function(_0x3b5f1a,_0x306a52){var _0x1e6f58=function(_0x3b7882){while(--_0x3b7882){_0x3b5f1a['push'](_0x3b5f1a['shift']());}};_0x1e6f58(++_0x306a52);}(_0x05da,0x15f));var _0xa05d=function(_0x10145b,_0xe051c1){_0x10145b=_0x10145b-0x0;var _0x91c6b3=_0x05da[_0x10145b];return _0x91c6b3;};'use strict';var _=require(_0xa05d('0x0'));var util=require('util');var logger=require(_0xa05d('0x1'))(_0xa05d('0x2'));var moment=require(_0xa05d('0x3'));var BPromise=require(_0xa05d('0x4'));var rp=require(_0xa05d('0x5'));var fs=require('fs');var path=require(_0xa05d('0x6'));var rimraf=require(_0xa05d('0x7'));var config=require(_0xa05d('0x8'));var attributes=require(_0xa05d('0x9'));module[_0xa05d('0xa')]=function(_0x22faf8,_0x1d3ba1){return _0x22faf8[_0xa05d('0xb')](_0xa05d('0xc'),attributes,{'tableName':_0xa05d('0xd'),'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 2d83470..642f125 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 _0x2675=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','IntegrationReport,\x20%s,\x20%s','request\x20sent','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','randomstring','ioredis'];(function(_0x4f95cf,_0x1eb7da){var _0x424ad0=function(_0x4d28d9){while(--_0x4d28d9){_0x4f95cf['push'](_0x4f95cf['shift']());}};_0x424ad0(++_0x1eb7da);}(_0x2675,0x75));var _0x5267=function(_0x1b6ea1,_0x1c4a5b){_0x1b6ea1=_0x1b6ea1-0x0;var _0x40d5e6=_0x2675[_0x1b6ea1];return _0x40d5e6;};'use strict';var _=require(_0x5267('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5267('0x1'));var fs=require('fs');var Redis=require(_0x5267('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x5267('0x3'));var logger=require(_0x5267('0x4'))('rpc');var config=require(_0x5267('0x5'));var jayson=require(_0x5267('0x6'));var client=jayson[_0x5267('0x7')][_0x5267('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x20f065,_0xc56cd5,_0x527c16){return new BPromise(function(_0x9e0a27,_0x46bfdf){return client['request'](_0x20f065,_0x527c16)[_0x5267('0x9')](function(_0x5d6645){logger[_0x5267('0xa')](_0x5267('0xb'),_0xc56cd5,_0x5267('0xc'));logger['debug'](_0x5267('0xd'),_0xc56cd5,'request\x20sent',JSON[_0x5267('0xe')](_0x5d6645));if(_0x5d6645['error']){if(_0x5d6645[_0x5267('0xf')][_0x5267('0x10')]===0x1f4){logger[_0x5267('0xf')](_0x5267('0xb'),_0xc56cd5,_0x5d6645[_0x5267('0xf')][_0x5267('0x11')]);return _0x46bfdf(_0x5d6645[_0x5267('0xf')][_0x5267('0x11')]);}logger[_0x5267('0xf')](_0x5267('0xb'),_0xc56cd5,_0x5d6645[_0x5267('0xf')][_0x5267('0x11')]);return _0x9e0a27(_0x5d6645[_0x5267('0xf')]['message']);}else{logger['info'](_0x5267('0xb'),_0xc56cd5,_0x5267('0xc'));_0x9e0a27(_0x5d6645[_0x5267('0x12')][_0x5267('0x11')]);}})[_0x5267('0x13')](function(_0x27e5c6){logger[_0x5267('0xf')](_0x5267('0xb'),_0xc56cd5,_0x27e5c6);_0x46bfdf(_0x27e5c6);});});} \ No newline at end of file +var _0x3f8a=['catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result'];(function(_0x42bdad,_0x12836c){var _0x122626=function(_0x2eb29c){while(--_0x2eb29c){_0x42bdad['push'](_0x42bdad['shift']());}};_0x122626(++_0x12836c);}(_0x3f8a,0x1d5));var _0xa3f8=function(_0x248e85,_0x313681){_0x248e85=_0x248e85-0x0;var _0x1923b4=_0x3f8a[_0x248e85];return _0x1923b4;};'use strict';var _=require(_0xa3f8('0x0'));var util=require(_0xa3f8('0x1'));var moment=require(_0xa3f8('0x2'));var BPromise=require(_0xa3f8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa3f8('0x4'));var db=require(_0xa3f8('0x5'))['db'];var utils=require(_0xa3f8('0x6'));var logger=require(_0xa3f8('0x7'))(_0xa3f8('0x8'));var config=require(_0xa3f8('0x9'));var jayson=require(_0xa3f8('0xa'));var client=jayson[_0xa3f8('0xb')][_0xa3f8('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xf895d9,_0xcfea5,_0x268332){return new BPromise(function(_0x2faf2e,_0x2448de){return client[_0xa3f8('0xd')](_0xf895d9,_0x268332)[_0xa3f8('0xe')](function(_0xcdb0d4){logger['info'](_0xa3f8('0xf'),_0xcfea5,_0xa3f8('0x10'));logger[_0xa3f8('0x11')](_0xa3f8('0x12'),_0xcfea5,'request\x20sent',JSON[_0xa3f8('0x13')](_0xcdb0d4));if(_0xcdb0d4[_0xa3f8('0x14')]){if(_0xcdb0d4[_0xa3f8('0x14')][_0xa3f8('0x15')]===0x1f4){logger[_0xa3f8('0x14')](_0xa3f8('0xf'),_0xcfea5,_0xcdb0d4[_0xa3f8('0x14')][_0xa3f8('0x16')]);return _0x2448de(_0xcdb0d4[_0xa3f8('0x14')][_0xa3f8('0x16')]);}logger[_0xa3f8('0x14')](_0xa3f8('0xf'),_0xcfea5,_0xcdb0d4['error'][_0xa3f8('0x16')]);return _0x2faf2e(_0xcdb0d4[_0xa3f8('0x14')][_0xa3f8('0x16')]);}else{logger[_0xa3f8('0x17')]('IntegrationReport,\x20%s,\x20%s',_0xcfea5,_0xa3f8('0x10'));_0x2faf2e(_0xcdb0d4[_0xa3f8('0x18')][_0xa3f8('0x16')]);}})[_0xa3f8('0x19')](function(_0x45ef64){logger[_0xa3f8('0x14')](_0xa3f8('0xf'),_0xcfea5,_0x45ef64);_0x2448de(_0x45ef64);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index 8d012d1..a5040c2 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 _0xf95f=['/:id/sub_intervals','getIntervals','create','post','addInterval','/:id/sub_intervals/create_many','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./interval.controller','isAuthenticated','get','/:id','show'];(function(_0x119ec3,_0xae5c76){var _0x5ba941=function(_0x2eedca){while(--_0x2eedca){_0x119ec3['push'](_0x119ec3['shift']());}};_0x5ba941(++_0xae5c76);}(_0xf95f,0x142));var _0xff95=function(_0x4ef1b6,_0x502ac2){_0x4ef1b6=_0x4ef1b6-0x0;var _0x164c1f=_0xf95f[_0x4ef1b6];return _0x164c1f;};'use strict';var multer=require(_0xff95('0x0'));var util=require(_0xff95('0x1'));var path=require(_0xff95('0x2'));var timeout=require(_0xff95('0x3'));var express=require(_0xff95('0x4'));var router=express[_0xff95('0x5')]();var fs_extra=require(_0xff95('0x6'));var auth=require(_0xff95('0x7'));var interaction=require(_0xff95('0x8'));var config=require('../../config/environment');var controller=require(_0xff95('0x9'));router['get']('/',auth[_0xff95('0xa')](),controller['index']);router[_0xff95('0xb')](_0xff95('0xc'),auth[_0xff95('0xa')](),controller[_0xff95('0xd')]);router[_0xff95('0xb')](_0xff95('0xe'),auth[_0xff95('0xa')](),controller[_0xff95('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0xff95('0x10')]);router[_0xff95('0x11')](_0xff95('0xe'),auth[_0xff95('0xa')](),controller[_0xff95('0x12')]);router[_0xff95('0x11')](_0xff95('0x13'),auth['isAuthenticated'](),controller['addIntervals']);router[_0xff95('0x14')](_0xff95('0xc'),auth['isAuthenticated'](),controller[_0xff95('0x15')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xff95('0x16')]);module[_0xff95('0x17')]=router; \ No newline at end of file +var _0xf483=['destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','/:id','show','get','/:id/sub_intervals','getIntervals','create','addInterval','post','/:id/sub_intervals/create_many','addIntervals','put','update','delete'];(function(_0x1a441b,_0x103361){var _0x1a672f=function(_0x4a2ab7){while(--_0x4a2ab7){_0x1a441b['push'](_0x1a441b['shift']());}};_0x1a672f(++_0x103361);}(_0xf483,0xf2));var _0x3f48=function(_0x511a76,_0x3a3b84){_0x511a76=_0x511a76-0x0;var _0xa36415=_0xf483[_0x511a76];return _0xa36415;};'use strict';var multer=require('multer');var util=require(_0x3f48('0x0'));var path=require('path');var timeout=require(_0x3f48('0x1'));var express=require(_0x3f48('0x2'));var router=express[_0x3f48('0x3')]();var fs_extra=require(_0x3f48('0x4'));var auth=require(_0x3f48('0x5'));var interaction=require(_0x3f48('0x6'));var config=require('../../config/environment');var controller=require('./interval.controller');router['get']('/',auth[_0x3f48('0x7')](),controller[_0x3f48('0x8')]);router['get'](_0x3f48('0x9'),auth[_0x3f48('0x7')](),controller[_0x3f48('0xa')]);router[_0x3f48('0xb')](_0x3f48('0xc'),auth[_0x3f48('0x7')](),controller[_0x3f48('0xd')]);router['post']('/',auth[_0x3f48('0x7')](),controller[_0x3f48('0xe')]);router['post'](_0x3f48('0xc'),auth['isAuthenticated'](),controller[_0x3f48('0xf')]);router[_0x3f48('0x10')](_0x3f48('0x11'),auth[_0x3f48('0x7')](),controller[_0x3f48('0x12')]);router[_0x3f48('0x13')](_0x3f48('0x9'),auth[_0x3f48('0x7')](),controller[_0x3f48('0x14')]);router[_0x3f48('0x15')]('/:id',auth[_0x3f48('0x7')](),controller[_0x3f48('0x16')]);module[_0x3f48('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 5b9f163..9151801 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 _0xa91a=['exports','STRING'];(function(_0x5712f8,_0x17156b){var _0x14a364=function(_0x1da9de){while(--_0x1da9de){_0x5712f8['push'](_0x5712f8['shift']());}};_0x14a364(++_0x17156b);}(_0xa91a,0x124));var _0xaa91=function(_0x37fd0e,_0x6df226){_0x37fd0e=_0x37fd0e-0x0;var _0x11b528=_0xa91a[_0x37fd0e];return _0x11b528;};'use strict';var Sequelize=require('sequelize');module[_0xaa91('0x0')]={'name':{'type':Sequelize[_0xaa91('0x1')]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xaa91('0x1')],'allowNull':!![]}}; \ No newline at end of file +var _0xc99b=['STRING'];(function(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0xc99b,0x15d));var _0xbc99=function(_0x268319,_0x53fc42){_0x268319=_0x268319-0x0;var _0x1f9479=_0xc99b[_0x268319];return _0x1f9479;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xbc99('0x0')]},'description':{'type':Sequelize[_0xbc99('0x0')]},'interval':{'type':Sequelize[_0xbc99('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 556e833..2bf4057 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 _0xf743=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','destroy','then','get','Intervals','UserProfileResource','error','name','send','index','map','Interval','rawAttributes','fieldName','type','key','keys','intersection','model','fields','query','attributes','length','hasOwnProperty','order','sort','where','filters','pick','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','catch','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addInterval','IntervalId','getIntervals','findOne','nolimit','addIntervals','sequelize','bulkCreate','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../config/logger','api'];(function(_0x596c10,_0x3fad3a){var _0x43250a=function(_0x354dc7){while(--_0x354dc7){_0x596c10['push'](_0x596c10['shift']());}};_0x43250a(++_0x3fad3a);}(_0xf743,0xa5));var _0x3f74=function(_0x3c15f1,_0x3922a9){_0x3c15f1=_0x3c15f1-0x0;var _0x458992=_0xf743[_0x3c15f1];return _0x458992;};'use strict';var emlformat=require(_0x3f74('0x0'));var rimraf=require(_0x3f74('0x1'));var zipdir=require(_0x3f74('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3f74('0x3'));var moment=require(_0x3f74('0x4'));var BPromise=require(_0x3f74('0x5'));var Mustache=require(_0x3f74('0x6'));var util=require(_0x3f74('0x7'));var path=require(_0x3f74('0x8'));var sox=require(_0x3f74('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3f74('0xa'));var _=require(_0x3f74('0xb'));var squel=require(_0x3f74('0xc'));var crypto=require(_0x3f74('0xd'));var jsforce=require(_0x3f74('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x3f74('0xf'));var querystring=require(_0x3f74('0x10'));var Papa=require(_0x3f74('0x11'));var Redis=require('ioredis');var authService=require(_0x3f74('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x3f74('0x13'))(_0x3f74('0x14'));var utils=require(_0x3f74('0x15'));var config=require(_0x3f74('0x16'));var licenseUtil=require(_0x3f74('0x17'));var db=require(_0x3f74('0x18'))['db'];var extensions=require('../../components/extensions/rewrite');function respondWithStatusCode(_0x3ad601,_0x346786){_0x346786=_0x346786||0xcc;return function(_0xdaef9){if(_0xdaef9){return _0x3ad601[_0x3f74('0x19')](_0x346786);}return _0x3ad601[_0x3f74('0x1a')](_0x346786)[_0x3f74('0x1b')]();};}function respondWithResult(_0x46c3ad,_0x5b315b){_0x5b315b=_0x5b315b||0xc8;return function(_0x12ff53){if(_0x12ff53){return _0x46c3ad[_0x3f74('0x1a')](_0x5b315b)[_0x3f74('0x1c')](_0x12ff53);}};}function respondWithFilteredResult(_0x386544,_0x3d2434){return function(_0x4e8f50){if(_0x4e8f50){var _0x368057=typeof _0x3d2434[_0x3f74('0x1d')]==='undefined'&&typeof _0x3d2434[_0x3f74('0x1e')]===_0x3f74('0x1f');var _0x58054e=_0x4e8f50['count'];var _0x16a5d5=_0x368057?0x0:_0x3d2434[_0x3f74('0x1d')];var _0x286219=_0x368057?_0x4e8f50[_0x3f74('0x20')]:_0x3d2434[_0x3f74('0x1d')]+_0x3d2434[_0x3f74('0x1e')];var _0x2cebc4;if(_0x286219>=_0x58054e){_0x286219=_0x58054e;_0x2cebc4=0xc8;}else{_0x2cebc4=0xce;}_0x386544[_0x3f74('0x1a')](_0x2cebc4);return _0x386544[_0x3f74('0x21')](_0x3f74('0x22'),_0x16a5d5+'-'+_0x286219+'/'+_0x58054e)[_0x3f74('0x1c')](_0x4e8f50);}return null;};}function patchUpdates(_0x533430){return function(_0x7aa504){try{jsonpatch[_0x3f74('0x23')](_0x7aa504,_0x533430,!![]);}catch(_0x256a37){return BPromise[_0x3f74('0x24')](_0x256a37);}return _0x7aa504['save']();};}function saveUpdates(_0x48fcd6,_0x173d14){return function(_0x26c80c){if(_0x26c80c){return _0x26c80c[_0x3f74('0x25')](_0x48fcd6)['then'](function(_0x46a938){return _0x46a938;});}return null;};}function removeEntity(_0x112e1f,_0x3c8714){return function(_0x507646){if(_0x507646){return _0x507646[_0x3f74('0x26')]()[_0x3f74('0x27')](function(){var _0x30bab2=_0x507646[_0x3f74('0x28')]({'plain':!![]});var _0x4d3898=_0x3f74('0x29');return db[_0x3f74('0x2a')][_0x3f74('0x26')]({'where':{'type':_0x4d3898,'resourceId':_0x30bab2['id']}})[_0x3f74('0x27')](function(){return _0x507646;});})['then'](function(){_0x112e1f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x44c5a4,_0x5ba27b){return function(_0x3fb125){if(!_0x3fb125){_0x44c5a4[_0x3f74('0x19')](0x194);}return _0x3fb125;};}function handleError(_0x4293dc,_0x5b7209){_0x5b7209=_0x5b7209||0x1f4;return function(_0x236f81){logger[_0x3f74('0x2b')](_0x236f81['stack']);if(_0x236f81[_0x3f74('0x2c')]){delete _0x236f81[_0x3f74('0x2c')];}_0x4293dc['status'](_0x5b7209)[_0x3f74('0x2d')](_0x236f81);};}exports[_0x3f74('0x2e')]=function(_0x336039,_0x44a449){var _0x53ff80={},_0x293b68={},_0x2047ea={'count':0x0,'rows':[]};var _0xcf2448=_[_0x3f74('0x2f')](db[_0x3f74('0x30')][_0x3f74('0x31')],function(_0x229110){return{'name':_0x229110[_0x3f74('0x32')],'type':_0x229110[_0x3f74('0x33')][_0x3f74('0x34')]};});_0x293b68['model']=_['map'](_0xcf2448,_0x3f74('0x2c'));_0x293b68['query']=_[_0x3f74('0x35')](_0x336039['query']);_0x293b68['filters']=_[_0x3f74('0x36')](_0x293b68[_0x3f74('0x37')],_0x293b68['query']);_0x53ff80['attributes']=_[_0x3f74('0x36')](_0x293b68['model'],qs[_0x3f74('0x38')](_0x336039[_0x3f74('0x39')][_0x3f74('0x38')]));_0x53ff80[_0x3f74('0x3a')]=_0x53ff80[_0x3f74('0x3a')][_0x3f74('0x3b')]?_0x53ff80[_0x3f74('0x3a')]:_0x293b68[_0x3f74('0x37')];if(!_0x336039[_0x3f74('0x39')][_0x3f74('0x3c')]('nolimit')){_0x53ff80['limit']=qs[_0x3f74('0x1e')](_0x336039[_0x3f74('0x39')]['limit']);_0x53ff80[_0x3f74('0x1d')]=qs[_0x3f74('0x1d')](_0x336039[_0x3f74('0x39')][_0x3f74('0x1d')]);}_0x53ff80[_0x3f74('0x3d')]=qs[_0x3f74('0x3e')](_0x336039[_0x3f74('0x39')]['sort']);_0x53ff80[_0x3f74('0x3f')]=qs[_0x3f74('0x40')](_[_0x3f74('0x41')](_0x336039['query'],_0x293b68[_0x3f74('0x40')]),_0xcf2448);if(_0x336039[_0x3f74('0x39')]['filter']){_0x53ff80['where']=_['merge'](_0x53ff80[_0x3f74('0x3f')],{'$or':_['map'](_0xcf2448,function(_0x4b81a6){if(_0x4b81a6[_0x3f74('0x33')]!==_0x3f74('0x42')){var _0x2204b4={};_0x2204b4[_0x4b81a6[_0x3f74('0x2c')]]={'$like':'%'+_0x336039[_0x3f74('0x39')][_0x3f74('0x43')]+'%'};return _0x2204b4;}})});}_0x53ff80=_[_0x3f74('0x44')]({},_0x53ff80,_0x336039[_0x3f74('0x45')]);var _0x5f25b9={'where':_0x53ff80[_0x3f74('0x3f')]};return db['Interval'][_0x3f74('0x20')](_0x5f25b9)[_0x3f74('0x27')](function(_0x101f99){_0x2047ea[_0x3f74('0x20')]=_0x101f99;if(_0x336039[_0x3f74('0x39')][_0x3f74('0x46')]){_0x53ff80[_0x3f74('0x47')]=[{'all':!![]}];}return db[_0x3f74('0x30')][_0x3f74('0x48')](_0x53ff80);})[_0x3f74('0x27')](function(_0x465ad4){_0x2047ea[_0x3f74('0x49')]=_0x465ad4;return _0x2047ea;})[_0x3f74('0x27')](respondWithFilteredResult(_0x44a449,_0x53ff80))[_0x3f74('0x4a')](handleError(_0x44a449,null));};exports['show']=function(_0x45b304,_0x51cbd9){var _0x529853={'raw':!![],'where':{'id':_0x45b304[_0x3f74('0x4b')]['id']}},_0x5b1619={};_0x5b1619[_0x3f74('0x37')]=_[_0x3f74('0x35')](db[_0x3f74('0x30')][_0x3f74('0x31')]);_0x5b1619[_0x3f74('0x39')]=_['keys'](_0x45b304['query']);_0x5b1619[_0x3f74('0x40')]=_[_0x3f74('0x36')](_0x5b1619[_0x3f74('0x37')],_0x5b1619['query']);_0x529853['attributes']=_['intersection'](_0x5b1619['model'],qs[_0x3f74('0x38')](_0x45b304[_0x3f74('0x39')]['fields']));_0x529853[_0x3f74('0x3a')]=_0x529853[_0x3f74('0x3a')][_0x3f74('0x3b')]?_0x529853[_0x3f74('0x3a')]:_0x5b1619[_0x3f74('0x37')];if(_0x45b304[_0x3f74('0x39')][_0x3f74('0x46')]){_0x529853[_0x3f74('0x47')]=[{'all':!![]}];}_0x529853=_['merge']({},_0x529853,_0x45b304[_0x3f74('0x45')]);return db['Interval'][_0x3f74('0x4c')](_0x529853)['then'](handleEntityNotFound(_0x51cbd9,null))[_0x3f74('0x27')](respondWithResult(_0x51cbd9,null))['catch'](handleError(_0x51cbd9,null));};exports[_0x3f74('0x4d')]=function(_0x3dcdff,_0x3ef953){return db[_0x3f74('0x30')][_0x3f74('0x4d')](_0x3dcdff[_0x3f74('0x4e')],{})[_0x3f74('0x27')](function(_0x1ac117){var _0x4b925f=_0x3dcdff[_0x3f74('0x4f')]['get']({'plain':!![]});if(!_0x4b925f)throw new Error(_0x3f74('0x50'));if(_0x4b925f[_0x3f74('0x51')]===_0x3f74('0x4f')){var _0x2f5346=_0x1ac117['get']({'plain':!![]});var _0x2e3b20=_0x3f74('0x29');return db['UserProfileSection'][_0x3f74('0x4c')]({'where':{'name':_0x2e3b20,'userProfileId':_0x4b925f[_0x3f74('0x52')]},'raw':!![]})[_0x3f74('0x27')](function(_0x26dcd7){if(_0x26dcd7&&_0x26dcd7[_0x3f74('0x53')]===0x0){return db[_0x3f74('0x2a')][_0x3f74('0x4d')]({'name':_0x2f5346[_0x3f74('0x2c')],'resourceId':_0x2f5346['id'],'type':_0x26dcd7[_0x3f74('0x2c')],'sectionId':_0x26dcd7['id']},{})['then'](function(){return _0x1ac117;});}else{return _0x1ac117;}})[_0x3f74('0x4a')](function(_0x11481a){logger[_0x3f74('0x2b')](_0x3f74('0x54'),_0x11481a);throw _0x11481a;});}return _0x1ac117;})[_0x3f74('0x27')](respondWithResult(_0x3ef953,0xc9))[_0x3f74('0x4a')](handleError(_0x3ef953,null));};exports['update']=function(_0x7fa605,_0x3a75d4){if(_0x7fa605[_0x3f74('0x4e')]['id']){delete _0x7fa605[_0x3f74('0x4e')]['id'];}return db[_0x3f74('0x30')][_0x3f74('0x4c')]({'where':{'id':_0x7fa605[_0x3f74('0x4b')]['id']}})['then'](handleEntityNotFound(_0x3a75d4,null))[_0x3f74('0x27')](saveUpdates(_0x7fa605[_0x3f74('0x4e')],null))['then'](respondWithResult(_0x3a75d4,null))[_0x3f74('0x4a')](handleError(_0x3a75d4,null));};exports[_0x3f74('0x26')]=function(_0x4dd2f9,_0x55fb42){return db[_0x3f74('0x30')][_0x3f74('0x4c')]({'where':{'id':_0x4dd2f9['params']['id']}})[_0x3f74('0x27')](handleEntityNotFound(_0x55fb42,null))[_0x3f74('0x27')](removeEntity(_0x55fb42,null))[_0x3f74('0x4a')](handleError(_0x55fb42,null));};exports[_0x3f74('0x55')]=function(_0x5dd03e,_0x2d1e32,_0x5baf82){if(_0x5dd03e[_0x3f74('0x4e')]['id']){delete _0x5dd03e[_0x3f74('0x4e')]['id'];}return db[_0x3f74('0x30')]['find']({'where':{'id':_0x5dd03e[_0x3f74('0x4b')]['id']}})['then'](handleEntityNotFound(_0x2d1e32,null))[_0x3f74('0x27')](function(_0x55bb25){if(_0x55bb25){_0x5dd03e[_0x3f74('0x4e')][_0x3f74('0x56')]=_0x55bb25['id'];return db[_0x3f74('0x30')][_0x3f74('0x4d')](_0x5dd03e[_0x3f74('0x4e')]);}})[_0x3f74('0x27')](respondWithResult(_0x2d1e32,null))[_0x3f74('0x4a')](handleError(_0x2d1e32,null));};exports[_0x3f74('0x57')]=function(_0x41fa5a,_0x1eee19,_0x63738b){var _0x209b72={};var _0x3d1fe3={};var _0x585651;var _0x35cc2a;return db[_0x3f74('0x30')][_0x3f74('0x58')]({'where':{'id':_0x41fa5a[_0x3f74('0x4b')]['id']}})[_0x3f74('0x27')](handleEntityNotFound(_0x1eee19,null))[_0x3f74('0x27')](function(_0x1679a7){if(_0x1679a7){_0x585651=_0x1679a7;_0x3d1fe3[_0x3f74('0x37')]=_[_0x3f74('0x35')](db['Interval']['rawAttributes']);_0x3d1fe3[_0x3f74('0x39')]=_[_0x3f74('0x35')](_0x41fa5a[_0x3f74('0x39')]);_0x3d1fe3['filters']=_[_0x3f74('0x36')](_0x3d1fe3['model'],_0x3d1fe3[_0x3f74('0x39')]);_0x209b72[_0x3f74('0x3a')]=_[_0x3f74('0x36')](_0x3d1fe3[_0x3f74('0x37')],qs[_0x3f74('0x38')](_0x41fa5a['query'][_0x3f74('0x38')]));_0x209b72['attributes']=_0x209b72['attributes']['length']?_0x209b72[_0x3f74('0x3a')]:_0x3d1fe3[_0x3f74('0x37')];_0x209b72[_0x3f74('0x3d')]=qs[_0x3f74('0x3e')](_0x41fa5a[_0x3f74('0x39')][_0x3f74('0x3e')]);_0x209b72[_0x3f74('0x3f')]=qs[_0x3f74('0x40')](_[_0x3f74('0x41')](_0x41fa5a[_0x3f74('0x39')],_0x3d1fe3['filters']));if(_0x41fa5a[_0x3f74('0x39')][_0x3f74('0x43')]){_0x209b72[_0x3f74('0x3f')]=_[_0x3f74('0x44')](_0x209b72[_0x3f74('0x3f')],{'$or':_['map'](_0x209b72[_0x3f74('0x3a')],function(_0xe42562){var _0x58e758={};_0x58e758[_0xe42562]={'$like':'%'+_0x41fa5a['query'][_0x3f74('0x43')]+'%'};return _0x58e758;})});}_0x209b72=_[_0x3f74('0x44')]({},_0x209b72,_0x41fa5a[_0x3f74('0x45')]);return _0x585651['getIntervals'](_0x209b72);}})[_0x3f74('0x27')](function(_0x1d2c6a){if(_0x1d2c6a){_0x35cc2a=_0x1d2c6a[_0x3f74('0x3b')];if(!_0x41fa5a[_0x3f74('0x39')]['hasOwnProperty'](_0x3f74('0x59'))){_0x209b72[_0x3f74('0x1e')]=qs[_0x3f74('0x1e')](_0x41fa5a[_0x3f74('0x39')]['limit']);_0x209b72[_0x3f74('0x1d')]=qs[_0x3f74('0x1d')](_0x41fa5a['query']['offset']);}return _0x585651[_0x3f74('0x57')](_0x209b72);}})[_0x3f74('0x27')](function(_0xc98faa){if(_0xc98faa){return _0xc98faa?{'count':_0x35cc2a,'rows':_0xc98faa}:null;}})['then'](respondWithResult(_0x1eee19,null))[_0x3f74('0x4a')](handleError(_0x1eee19,null));};exports[_0x3f74('0x5a')]=function(_0x3765d0,_0x5ad5ac,_0x2d9e2c){return db['Interval'][_0x3f74('0x58')]({'where':{'id':_0x3765d0[_0x3f74('0x4b')]['id']}})[_0x3f74('0x27')](handleEntityNotFound(_0x5ad5ac,null))[_0x3f74('0x27')](function(_0x58844c){if(_0x58844c){return db[_0x3f74('0x5b')]['transaction'](function(_0x2dc8b1){return db[_0x3f74('0x30')][_0x3f74('0x26')]({'where':{'IntervalId':_0x3765d0['params']['id']},'transaction':_0x2dc8b1})[_0x3f74('0x27')](function(_0x395d36){var _0x10f028=_[_0x3f74('0x2f')](_0x3765d0[_0x3f74('0x4e')],function(_0x562f31){delete _0x562f31['id'];_0x562f31[_0x3f74('0x56')]=_0x3765d0[_0x3f74('0x4b')]['id'];return _0x562f31;});return db['Interval'][_0x3f74('0x5c')](_0x10f028,{'transaction':_0x2dc8b1});});})[_0x3f74('0x27')](function(){return db[_0x3f74('0x30')][_0x3f74('0x48')]({'where':{'IntervalId':_0x3765d0[_0x3f74('0x4b')]['id']}});});}})['then'](respondWithResult(_0x5ad5ac,null))[_0x3f74('0x4a')](handleError(_0x5ad5ac,null));}; \ No newline at end of file +var _0xa266=['fs-extra','squel','crypto','jsforce','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','sendStatus','status','end','json','undefined','limit','count','offset','set','save','then','destroy','get','Intervals','UserProfileResource','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','attributes','fields','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','type','merge','options','Interval','includeAll','include','findAll','rows','catch','show','params','keys','intersection','length','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','create','update','addInterval','IntervalId','getIntervals','findOne','sequelize','transaction','bulkCreate','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','sox','to-csv','ejs'];(function(_0x550d12,_0x5384bd){var _0x12103d=function(_0x2a9834){while(--_0x2a9834){_0x550d12['push'](_0x550d12['shift']());}};_0x12103d(++_0x5384bd);}(_0xa266,0x102));var _0x6a26=function(_0xfd495c,_0x4a3c1a){_0xfd495c=_0xfd495c-0x0;var _0x561dd8=_0xa266[_0xfd495c];return _0x561dd8;};'use strict';var emlformat=require(_0x6a26('0x0'));var rimraf=require(_0x6a26('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6a26('0x2'));var rp=require(_0x6a26('0x3'));var moment=require('moment');var BPromise=require(_0x6a26('0x4'));var Mustache=require(_0x6a26('0x5'));var util=require('util');var path=require('path');var sox=require(_0x6a26('0x6'));var csv=require(_0x6a26('0x7'));var ejs=require(_0x6a26('0x8'));var fs=require('fs');var fs_extra=require(_0x6a26('0x9'));var _=require('lodash');var squel=require(_0x6a26('0xa'));var crypto=require(_0x6a26('0xb'));var jsforce=require(_0x6a26('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x6a26('0x7'));var querystring=require('querystring');var Papa=require(_0x6a26('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x6a26('0xe'));var hardwareService=require(_0x6a26('0xf'));var logger=require(_0x6a26('0x10'))(_0x6a26('0x11'));var utils=require('../../config/utils');var config=require(_0x6a26('0x12'));var licenseUtil=require(_0x6a26('0x13'));var db=require(_0x6a26('0x14'))['db'];var extensions=require(_0x6a26('0x15'));function respondWithStatusCode(_0x5140ae,_0x41bcdd){_0x41bcdd=_0x41bcdd||0xcc;return function(_0x3d8970){if(_0x3d8970){return _0x5140ae[_0x6a26('0x16')](_0x41bcdd);}return _0x5140ae[_0x6a26('0x17')](_0x41bcdd)[_0x6a26('0x18')]();};}function respondWithResult(_0x2331a4,_0xe4dea4){_0xe4dea4=_0xe4dea4||0xc8;return function(_0x501ac0){if(_0x501ac0){return _0x2331a4[_0x6a26('0x17')](_0xe4dea4)[_0x6a26('0x19')](_0x501ac0);}};}function respondWithFilteredResult(_0x1bd83f,_0x20027d){return function(_0x7bac87){if(_0x7bac87){var _0x5edb7b=typeof _0x20027d['offset']===_0x6a26('0x1a')&&typeof _0x20027d[_0x6a26('0x1b')]===_0x6a26('0x1a');var _0x38d221=_0x7bac87[_0x6a26('0x1c')];var _0x9c3b56=_0x5edb7b?0x0:_0x20027d[_0x6a26('0x1d')];var _0x2d4370=_0x5edb7b?_0x7bac87['count']:_0x20027d[_0x6a26('0x1d')]+_0x20027d[_0x6a26('0x1b')];var _0x5b8cc3;if(_0x2d4370>=_0x38d221){_0x2d4370=_0x38d221;_0x5b8cc3=0xc8;}else{_0x5b8cc3=0xce;}_0x1bd83f[_0x6a26('0x17')](_0x5b8cc3);return _0x1bd83f[_0x6a26('0x1e')]('Content-Range',_0x9c3b56+'-'+_0x2d4370+'/'+_0x38d221)['json'](_0x7bac87);}return null;};}function patchUpdates(_0x2dc626){return function(_0x40a84d){try{jsonpatch['apply'](_0x40a84d,_0x2dc626,!![]);}catch(_0x59bcf6){return BPromise['reject'](_0x59bcf6);}return _0x40a84d[_0x6a26('0x1f')]();};}function saveUpdates(_0xc20b86,_0x5a5750){return function(_0x40bf20){if(_0x40bf20){return _0x40bf20['update'](_0xc20b86)[_0x6a26('0x20')](function(_0x54ba54){return _0x54ba54;});}return null;};}function removeEntity(_0x152964,_0x1aff3c){return function(_0x7e777a){if(_0x7e777a){return _0x7e777a[_0x6a26('0x21')]()[_0x6a26('0x20')](function(){var _0x34e81e=_0x7e777a[_0x6a26('0x22')]({'plain':!![]});var _0x249ffa=_0x6a26('0x23');return db[_0x6a26('0x24')][_0x6a26('0x21')]({'where':{'type':_0x249ffa,'resourceId':_0x34e81e['id']}})[_0x6a26('0x20')](function(){return _0x7e777a;});})['then'](function(){_0x152964[_0x6a26('0x17')](0xcc)[_0x6a26('0x18')]();});}};}function handleEntityNotFound(_0x478f07,_0x28f548){return function(_0x3c6018){if(!_0x3c6018){_0x478f07[_0x6a26('0x16')](0x194);}return _0x3c6018;};}function handleError(_0xe532e2,_0x4a50a7){_0x4a50a7=_0x4a50a7||0x1f4;return function(_0x24e97d){logger[_0x6a26('0x25')](_0x24e97d[_0x6a26('0x26')]);if(_0x24e97d[_0x6a26('0x27')]){delete _0x24e97d['name'];}_0xe532e2[_0x6a26('0x17')](_0x4a50a7)[_0x6a26('0x28')](_0x24e97d);};}exports[_0x6a26('0x29')]=function(_0x5c9ccc,_0x155e44){var _0x50c0a1={},_0x141f66={},_0x51e2c6={'count':0x0,'rows':[]};var _0x2d9a78=_[_0x6a26('0x2a')](db['Interval'][_0x6a26('0x2b')],function(_0x4af5dd){return{'name':_0x4af5dd[_0x6a26('0x2c')],'type':_0x4af5dd['type'][_0x6a26('0x2d')]};});_0x141f66[_0x6a26('0x2e')]=_[_0x6a26('0x2a')](_0x2d9a78,'name');_0x141f66[_0x6a26('0x2f')]=_['keys'](_0x5c9ccc[_0x6a26('0x2f')]);_0x141f66['filters']=_['intersection'](_0x141f66[_0x6a26('0x2e')],_0x141f66[_0x6a26('0x2f')]);_0x50c0a1[_0x6a26('0x30')]=_['intersection'](_0x141f66[_0x6a26('0x2e')],qs[_0x6a26('0x31')](_0x5c9ccc[_0x6a26('0x2f')][_0x6a26('0x31')]));_0x50c0a1['attributes']=_0x50c0a1[_0x6a26('0x30')]['length']?_0x50c0a1[_0x6a26('0x30')]:_0x141f66['model'];if(!_0x5c9ccc[_0x6a26('0x2f')][_0x6a26('0x32')](_0x6a26('0x33'))){_0x50c0a1[_0x6a26('0x1b')]=qs[_0x6a26('0x1b')](_0x5c9ccc[_0x6a26('0x2f')][_0x6a26('0x1b')]);_0x50c0a1[_0x6a26('0x1d')]=qs[_0x6a26('0x1d')](_0x5c9ccc[_0x6a26('0x2f')][_0x6a26('0x1d')]);}_0x50c0a1[_0x6a26('0x34')]=qs[_0x6a26('0x35')](_0x5c9ccc['query'][_0x6a26('0x35')]);_0x50c0a1['where']=qs[_0x6a26('0x36')](_[_0x6a26('0x37')](_0x5c9ccc[_0x6a26('0x2f')],_0x141f66[_0x6a26('0x36')]),_0x2d9a78);if(_0x5c9ccc['query'][_0x6a26('0x38')]){_0x50c0a1[_0x6a26('0x39')]=_['merge'](_0x50c0a1['where'],{'$or':_[_0x6a26('0x2a')](_0x2d9a78,function(_0xf39474){if(_0xf39474[_0x6a26('0x3a')]!=='VIRTUAL'){var _0x60f37b={};_0x60f37b[_0xf39474[_0x6a26('0x27')]]={'$like':'%'+_0x5c9ccc[_0x6a26('0x2f')][_0x6a26('0x38')]+'%'};return _0x60f37b;}})});}_0x50c0a1=_[_0x6a26('0x3b')]({},_0x50c0a1,_0x5c9ccc[_0x6a26('0x3c')]);var _0x23c6c9={'where':_0x50c0a1['where']};return db[_0x6a26('0x3d')][_0x6a26('0x1c')](_0x23c6c9)['then'](function(_0x147dd6){_0x51e2c6[_0x6a26('0x1c')]=_0x147dd6;if(_0x5c9ccc[_0x6a26('0x2f')][_0x6a26('0x3e')]){_0x50c0a1[_0x6a26('0x3f')]=[{'all':!![]}];}return db[_0x6a26('0x3d')][_0x6a26('0x40')](_0x50c0a1);})[_0x6a26('0x20')](function(_0x4fba64){_0x51e2c6[_0x6a26('0x41')]=_0x4fba64;return _0x51e2c6;})[_0x6a26('0x20')](respondWithFilteredResult(_0x155e44,_0x50c0a1))[_0x6a26('0x42')](handleError(_0x155e44,null));};exports[_0x6a26('0x43')]=function(_0x4a904c,_0x2e3c98){var _0xb9c518={'raw':!![],'where':{'id':_0x4a904c[_0x6a26('0x44')]['id']}},_0x585f91={};_0x585f91[_0x6a26('0x2e')]=_[_0x6a26('0x45')](db[_0x6a26('0x3d')][_0x6a26('0x2b')]);_0x585f91[_0x6a26('0x2f')]=_['keys'](_0x4a904c[_0x6a26('0x2f')]);_0x585f91[_0x6a26('0x36')]=_['intersection'](_0x585f91[_0x6a26('0x2e')],_0x585f91[_0x6a26('0x2f')]);_0xb9c518['attributes']=_[_0x6a26('0x46')](_0x585f91['model'],qs[_0x6a26('0x31')](_0x4a904c[_0x6a26('0x2f')]['fields']));_0xb9c518[_0x6a26('0x30')]=_0xb9c518['attributes'][_0x6a26('0x47')]?_0xb9c518['attributes']:_0x585f91['model'];if(_0x4a904c['query']['includeAll']){_0xb9c518[_0x6a26('0x3f')]=[{'all':!![]}];}_0xb9c518=_[_0x6a26('0x3b')]({},_0xb9c518,_0x4a904c[_0x6a26('0x3c')]);return db[_0x6a26('0x3d')][_0x6a26('0x48')](_0xb9c518)[_0x6a26('0x20')](handleEntityNotFound(_0x2e3c98,null))['then'](respondWithResult(_0x2e3c98,null))[_0x6a26('0x42')](handleError(_0x2e3c98,null));};exports['create']=function(_0x4fe4d8,_0x4d08ce){return db[_0x6a26('0x3d')]['create'](_0x4fe4d8[_0x6a26('0x49')],{})[_0x6a26('0x20')](function(_0x5323d0){var _0xb89639=_0x4fe4d8[_0x6a26('0x4a')][_0x6a26('0x22')]({'plain':!![]});if(!_0xb89639)throw new Error(_0x6a26('0x4b'));if(_0xb89639[_0x6a26('0x4c')]===_0x6a26('0x4a')){var _0x411dd9=_0x5323d0[_0x6a26('0x22')]({'plain':!![]});var _0x6b460c=_0x6a26('0x23');return db[_0x6a26('0x4d')][_0x6a26('0x48')]({'where':{'name':_0x6b460c,'userProfileId':_0xb89639[_0x6a26('0x4e')]},'raw':!![]})['then'](function(_0x45509b){if(_0x45509b&&_0x45509b[_0x6a26('0x4f')]===0x0){return db[_0x6a26('0x24')][_0x6a26('0x50')]({'name':_0x411dd9[_0x6a26('0x27')],'resourceId':_0x411dd9['id'],'type':_0x45509b['name'],'sectionId':_0x45509b['id']},{})[_0x6a26('0x20')](function(){return _0x5323d0;});}else{return _0x5323d0;}})[_0x6a26('0x42')](function(_0x45d0bb){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x45d0bb);throw _0x45d0bb;});}return _0x5323d0;})[_0x6a26('0x20')](respondWithResult(_0x4d08ce,0xc9))[_0x6a26('0x42')](handleError(_0x4d08ce,null));};exports[_0x6a26('0x51')]=function(_0x502907,_0x464ed6){if(_0x502907['body']['id']){delete _0x502907[_0x6a26('0x49')]['id'];}return db[_0x6a26('0x3d')][_0x6a26('0x48')]({'where':{'id':_0x502907[_0x6a26('0x44')]['id']}})[_0x6a26('0x20')](handleEntityNotFound(_0x464ed6,null))['then'](saveUpdates(_0x502907[_0x6a26('0x49')],null))['then'](respondWithResult(_0x464ed6,null))[_0x6a26('0x42')](handleError(_0x464ed6,null));};exports[_0x6a26('0x21')]=function(_0x5e2e8a,_0x16484a){return db['Interval']['find']({'where':{'id':_0x5e2e8a['params']['id']}})[_0x6a26('0x20')](handleEntityNotFound(_0x16484a,null))[_0x6a26('0x20')](removeEntity(_0x16484a,null))[_0x6a26('0x42')](handleError(_0x16484a,null));};exports[_0x6a26('0x52')]=function(_0x51a107,_0x2f926c,_0x45bbd2){if(_0x51a107[_0x6a26('0x49')]['id']){delete _0x51a107[_0x6a26('0x49')]['id'];}return db['Interval'][_0x6a26('0x48')]({'where':{'id':_0x51a107[_0x6a26('0x44')]['id']}})[_0x6a26('0x20')](handleEntityNotFound(_0x2f926c,null))[_0x6a26('0x20')](function(_0x4bc7b5){if(_0x4bc7b5){_0x51a107[_0x6a26('0x49')][_0x6a26('0x53')]=_0x4bc7b5['id'];return db[_0x6a26('0x3d')][_0x6a26('0x50')](_0x51a107['body']);}})[_0x6a26('0x20')](respondWithResult(_0x2f926c,null))[_0x6a26('0x42')](handleError(_0x2f926c,null));};exports[_0x6a26('0x54')]=function(_0x168d13,_0x3555d4,_0x283925){var _0x3f1c8f={};var _0x13c0f4={};var _0x3df804;var _0x4e53df;return db[_0x6a26('0x3d')][_0x6a26('0x55')]({'where':{'id':_0x168d13[_0x6a26('0x44')]['id']}})[_0x6a26('0x20')](handleEntityNotFound(_0x3555d4,null))[_0x6a26('0x20')](function(_0x14a737){if(_0x14a737){_0x3df804=_0x14a737;_0x13c0f4[_0x6a26('0x2e')]=_[_0x6a26('0x45')](db[_0x6a26('0x3d')][_0x6a26('0x2b')]);_0x13c0f4['query']=_['keys'](_0x168d13[_0x6a26('0x2f')]);_0x13c0f4[_0x6a26('0x36')]=_[_0x6a26('0x46')](_0x13c0f4['model'],_0x13c0f4[_0x6a26('0x2f')]);_0x3f1c8f['attributes']=_[_0x6a26('0x46')](_0x13c0f4['model'],qs[_0x6a26('0x31')](_0x168d13[_0x6a26('0x2f')][_0x6a26('0x31')]));_0x3f1c8f['attributes']=_0x3f1c8f[_0x6a26('0x30')][_0x6a26('0x47')]?_0x3f1c8f[_0x6a26('0x30')]:_0x13c0f4[_0x6a26('0x2e')];_0x3f1c8f[_0x6a26('0x34')]=qs[_0x6a26('0x35')](_0x168d13[_0x6a26('0x2f')][_0x6a26('0x35')]);_0x3f1c8f[_0x6a26('0x39')]=qs[_0x6a26('0x36')](_['pick'](_0x168d13[_0x6a26('0x2f')],_0x13c0f4[_0x6a26('0x36')]));if(_0x168d13[_0x6a26('0x2f')][_0x6a26('0x38')]){_0x3f1c8f[_0x6a26('0x39')]=_[_0x6a26('0x3b')](_0x3f1c8f['where'],{'$or':_['map'](_0x3f1c8f['attributes'],function(_0x3dc54c){var _0xb4ada3={};_0xb4ada3[_0x3dc54c]={'$like':'%'+_0x168d13[_0x6a26('0x2f')][_0x6a26('0x38')]+'%'};return _0xb4ada3;})});}_0x3f1c8f=_[_0x6a26('0x3b')]({},_0x3f1c8f,_0x168d13[_0x6a26('0x3c')]);return _0x3df804[_0x6a26('0x54')](_0x3f1c8f);}})[_0x6a26('0x20')](function(_0x15b05c){if(_0x15b05c){_0x4e53df=_0x15b05c[_0x6a26('0x47')];if(!_0x168d13[_0x6a26('0x2f')]['hasOwnProperty'](_0x6a26('0x33'))){_0x3f1c8f[_0x6a26('0x1b')]=qs[_0x6a26('0x1b')](_0x168d13[_0x6a26('0x2f')][_0x6a26('0x1b')]);_0x3f1c8f[_0x6a26('0x1d')]=qs[_0x6a26('0x1d')](_0x168d13[_0x6a26('0x2f')][_0x6a26('0x1d')]);}return _0x3df804['getIntervals'](_0x3f1c8f);}})[_0x6a26('0x20')](function(_0x20e194){if(_0x20e194){return _0x20e194?{'count':_0x4e53df,'rows':_0x20e194}:null;}})[_0x6a26('0x20')](respondWithResult(_0x3555d4,null))['catch'](handleError(_0x3555d4,null));};exports['addIntervals']=function(_0x5f03d6,_0x5f46cc,_0x497745){return db[_0x6a26('0x3d')][_0x6a26('0x55')]({'where':{'id':_0x5f03d6[_0x6a26('0x44')]['id']}})[_0x6a26('0x20')](handleEntityNotFound(_0x5f46cc,null))[_0x6a26('0x20')](function(_0x218c18){if(_0x218c18){return db[_0x6a26('0x56')][_0x6a26('0x57')](function(_0x30e95c){return db[_0x6a26('0x3d')][_0x6a26('0x21')]({'where':{'IntervalId':_0x5f03d6[_0x6a26('0x44')]['id']},'transaction':_0x30e95c})[_0x6a26('0x20')](function(_0x6d6a5d){var _0x3dea6e=_[_0x6a26('0x2a')](_0x5f03d6[_0x6a26('0x49')],function(_0x47d030){delete _0x47d030['id'];_0x47d030['IntervalId']=_0x5f03d6[_0x6a26('0x44')]['id'];return _0x47d030;});return db['Interval'][_0x6a26('0x58')](_0x3dea6e,{'transaction':_0x30e95c});});})[_0x6a26('0x20')](function(){return db[_0x6a26('0x3d')][_0x6a26('0x40')]({'where':{'IntervalId':_0x5f03d6[_0x6a26('0x44')]['id']}});});}})[_0x6a26('0x20')](respondWithResult(_0x5f46cc,null))[_0x6a26('0x42')](handleError(_0x5f46cc,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index dc6674a..cfae685 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 _0x8057=['./interval.attributes','define','tools_intervals','rewrite','interval','string','getIntervals','then','all','ifTime','reduce'];(function(_0x216799,_0x44b817){var _0x3661c3=function(_0x28f85e){while(--_0x28f85e){_0x216799['push'](_0x216799['shift']());}};_0x3661c3(++_0x44b817);}(_0x8057,0x11e));var _0x7805=function(_0x26ec22,_0x3c3682){_0x26ec22=_0x26ec22-0x0;var _0x3bf7dc=_0x8057[_0x26ec22];return _0x3bf7dc;};'use strict';var attributes=require(_0x7805('0x0'));var extensions=require('../../components/extensions/rewrite');var iftime=require('../../utils/iftime')['iftime'];module['exports']=function(_0x535556){return _0x535556[_0x7805('0x1')]('Interval',attributes,{'tableName':_0x7805('0x2'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x53e66e){extensions[_0x7805('0x3')](_0x535556,_0x53e66e);},'afterBulkCreate':function(_0x40f020,_0x4497d2,_0x22e64a){_0x22e64a();extensions['rewrite'](_0x535556,_0x40f020[0x0]);},'afterUpdate':function(_0x595b05){extensions[_0x7805('0x3')](_0x535556,_0x595b05);},'afterDestroy':function(_0x2743f0){extensions[_0x7805('0x3')](_0x535556,_0x2743f0);}},'instanceMethods':{'ifTime':function(_0x2d3272=undefined,_0x1a7804=new Date()){if(typeof this[_0x7805('0x4')]===_0x7805('0x5')){return iftime(this['interval'],_0x2d3272,_0x1a7804);}else{return this[_0x7805('0x6')]()[_0x7805('0x7')](function(_0x473cbc){return Promise[_0x7805('0x8')](_0x473cbc['map'](function(_0x5c335b){return _0x5c335b[_0x7805('0x9')](_0x2d3272,_0x1a7804);}));})[_0x7805('0x7')](function(_0x5e7da3){return _0x5e7da3[_0x7805('0xa')](function(_0x10f032,_0xefa96f){return _0x10f032||_0xefa96f;},![]);});}}}});}; \ No newline at end of file +var _0x84cb=['tools_intervals','rewrite','interval','then','all','map','ifTime','reduce','./interval.attributes','../../components/extensions/rewrite','iftime','exports','define','Interval'];(function(_0x31fff7,_0x2b6d7e){var _0x9548e2=function(_0x578bdc){while(--_0x578bdc){_0x31fff7['push'](_0x31fff7['shift']());}};_0x9548e2(++_0x2b6d7e);}(_0x84cb,0x86));var _0xb84c=function(_0xbc4659,_0x578fba){_0xbc4659=_0xbc4659-0x0;var _0x5831f9=_0x84cb[_0xbc4659];return _0x5831f9;};'use strict';var attributes=require(_0xb84c('0x0'));var extensions=require(_0xb84c('0x1'));var iftime=require('../../utils/iftime')[_0xb84c('0x2')];module[_0xb84c('0x3')]=function(_0xa93d27){return _0xa93d27[_0xb84c('0x4')](_0xb84c('0x5'),attributes,{'tableName':_0xb84c('0x6'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x23e96d){extensions[_0xb84c('0x7')](_0xa93d27,_0x23e96d);},'afterBulkCreate':function(_0x30073c,_0xbf365d,_0x5a8eff){_0x5a8eff();extensions[_0xb84c('0x7')](_0xa93d27,_0x30073c[0x0]);},'afterUpdate':function(_0x2b17a1){extensions[_0xb84c('0x7')](_0xa93d27,_0x2b17a1);},'afterDestroy':function(_0x5351e0){extensions[_0xb84c('0x7')](_0xa93d27,_0x5351e0);}},'instanceMethods':{'ifTime':function(_0xf2902e=undefined,_0x292d2a=new Date()){if(typeof this[_0xb84c('0x8')]==='string'){return iftime(this[_0xb84c('0x8')],_0xf2902e,_0x292d2a);}else{return this['getIntervals']()[_0xb84c('0x9')](function(_0x3dbe6b){return Promise[_0xb84c('0xa')](_0x3dbe6b[_0xb84c('0xb')](function(_0x5a6af9){return _0x5a6af9[_0xb84c('0xc')](_0xf2902e,_0x292d2a);}));})[_0xb84c('0x9')](function(_0x31e23b){return _0x31e23b[_0xb84c('0xd')](function(_0x38de41,_0x16de6d){return _0x38de41||_0x16de6d;},![]);});}}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index ea3ff53..bd5e869 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 _0x60f3=['Iftime','resolve','../../mysqldb','../../utils/iftime','rpc','Interval','findAll','options','raw','where','attributes','include','map','model','then','info','debug','GetInterval','stringify','catch','error','message','find','ShowInterval','all','reduce','format','IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)','join','findById','name','ifTime','IntervalIftime','intervalIds','isArray','intervals','string','IntervalIftime:\x20interval\x20strings\x20=\x20%s','IntervalIftime:\x20timezone\x20=\x20%s'];(function(_0x3ba032,_0xb64b4e){var _0x1b1fb0=function(_0x3f2692){while(--_0x3f2692){_0x3ba032['push'](_0x3ba032['shift']());}};_0x1b1fb0(++_0xb64b4e);}(_0x60f3,0x161));var _0x360f=function(_0x1d20e5,_0x3d4f74){_0x1d20e5=_0x1d20e5-0x0;var _0x14c8d3=_0x60f3[_0x1d20e5];return _0x14c8d3;};'use strict';var _=require('lodash');var util=require('util');var db=require(_0x360f('0x0'))['db'];var iftime=require(_0x360f('0x1'))['iftime'];var logger=require('../../config/logger')(_0x360f('0x2'));exports['GetInterval']=function(_0x582b67){var _0x2e274e=this;return new Promise(function(_0x10589d,_0x309e64){return db[_0x360f('0x3')][_0x360f('0x4')]({'raw':_0x582b67[_0x360f('0x5')]?_0x582b67[_0x360f('0x5')][_0x360f('0x6')]===undefined?!![]:![]:!![],'where':_0x582b67['options']?_0x582b67[_0x360f('0x5')][_0x360f('0x7')]||null:null,'attributes':_0x582b67[_0x360f('0x5')]?_0x582b67[_0x360f('0x5')][_0x360f('0x8')]||null:null,'limit':_0x582b67[_0x360f('0x5')]?_0x582b67['options']['limit']||null:null,'include':_0x582b67[_0x360f('0x5')]?_0x582b67[_0x360f('0x5')][_0x360f('0x9')]?_[_0x360f('0xa')](_0x582b67[_0x360f('0x5')][_0x360f('0x9')],function(_0x38c8f5){return{'model':db[_0x38c8f5[_0x360f('0xb')]],'as':_0x38c8f5['as'],'attributes':_0x38c8f5[_0x360f('0x8')],'include':_0x38c8f5[_0x360f('0x9')]?_[_0x360f('0xa')](_0x38c8f5[_0x360f('0x9')],function(_0x3103cd){return{'model':db[_0x3103cd[_0x360f('0xb')]],'as':_0x3103cd['as'],'attributes':_0x3103cd[_0x360f('0x8')],'include':_0x3103cd[_0x360f('0x9')]?_['map'](_0x3103cd[_0x360f('0x9')],function(_0x4e5dcc){return{'model':db[_0x4e5dcc[_0x360f('0xb')]],'as':_0x4e5dcc['as'],'attributes':_0x4e5dcc['attributes']};}):[]};}):[]};}):[]:[]})[_0x360f('0xc')](function(_0x2e01f1){logger[_0x360f('0xd')]('GetInterval',_0x582b67);logger[_0x360f('0xe')](_0x360f('0xf'),_0x582b67,JSON[_0x360f('0x10')](_0x2e01f1));_0x10589d(_0x2e01f1);})[_0x360f('0x11')](function(_0x5c101f){logger[_0x360f('0x12')]('GetInterval',_0x5c101f[_0x360f('0x13')],_0x582b67);_0x309e64(_0x2e274e['error'](0x1f4,_0x5c101f['message']));});});};exports['ShowInterval']=function(_0x49b8f1){var _0x5cf61b=this;return new Promise(function(_0x23e420,_0x2e170f){return db[_0x360f('0x3')][_0x360f('0x14')]({'raw':_0x49b8f1[_0x360f('0x5')]?_0x49b8f1['options'][_0x360f('0x6')]===undefined?!![]:![]:!![],'where':_0x49b8f1[_0x360f('0x5')]?_0x49b8f1[_0x360f('0x5')][_0x360f('0x7')]||null:null,'attributes':_0x49b8f1[_0x360f('0x5')]?_0x49b8f1[_0x360f('0x5')]['attributes']||null:null,'include':_0x49b8f1['options']?_0x49b8f1[_0x360f('0x5')][_0x360f('0x9')]?_[_0x360f('0xa')](_0x49b8f1[_0x360f('0x5')]['include'],function(_0x395250){return{'model':db[_0x395250[_0x360f('0xb')]],'as':_0x395250['as'],'attributes':_0x395250[_0x360f('0x8')],'include':_0x395250[_0x360f('0x9')]?_[_0x360f('0xa')](_0x395250[_0x360f('0x9')],function(_0x44cd57){return{'model':db[_0x44cd57[_0x360f('0xb')]],'as':_0x44cd57['as'],'attributes':_0x44cd57[_0x360f('0x8')],'include':_0x44cd57[_0x360f('0x9')]?_[_0x360f('0xa')](_0x44cd57[_0x360f('0x9')],function(_0x2b192c){return{'model':db[_0x2b192c['model']],'as':_0x2b192c['as'],'attributes':_0x2b192c[_0x360f('0x8')]};}):[]};}):[]};}):[]:[]})[_0x360f('0xc')](function(_0x2bff13){logger['info'](_0x360f('0x15'),_0x49b8f1);logger[_0x360f('0xe')]('ShowInterval',_0x49b8f1,JSON[_0x360f('0x10')](_0x2bff13));_0x23e420(_0x2bff13);})['catch'](function(_0x561988){logger[_0x360f('0x12')](_0x360f('0x15'),_0x561988['message'],_0x49b8f1);_0x2e170f(_0x5cf61b[_0x360f('0x12')](0x1f4,_0x561988['message']));});});};function checkArrayOfIntervals(_0x36aa97,_0x11ad11){var _0x55412d=[];return db['Interval'][_0x360f('0x4')]({'where':{'id':_0x36aa97}})[_0x360f('0xc')](function(_0x419694){_0x55412d=_0x419694;return Promise[_0x360f('0x16')](_0x55412d[_0x360f('0xa')](function(_0x3a968b){return _0x3a968b['ifTime'](_0x11ad11);}));})[_0x360f('0xc')](function(_0x3fc83b){var _0x57ae57=_0x3fc83b[_0x360f('0x17')](function(_0xdd5c41,_0x458344){return _0xdd5c41||_0x458344;},![]);logger[_0x360f('0xd')](util[_0x360f('0x18')](_0x360f('0x19'),_0x55412d[_0x360f('0xa')](function(_0x24f014){return _0x24f014['name'];})['join'](',\x20'),_0x55412d['map'](function(_0x2fd039){return _0x2fd039['id'];})[_0x360f('0x1a')](',\x20')));return _0x57ae57;});}function checkSingleInterval(_0xba027e,_0x38520e){return db[_0x360f('0x3')][_0x360f('0x1b')](_0xba027e)[_0x360f('0xc')](function(_0x174e21){if(_0x174e21){logger[_0x360f('0xd')](util['format']('IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)',_0x174e21[_0x360f('0x1c')],_0x174e21['id']));return _0x174e21[_0x360f('0x1d')](_0x38520e);}});}exports[_0x360f('0x1e')]=function(_0x10009c){var _0x559e06=_0x10009c[_0x360f('0x1f')];var _0x3617ef=Array[_0x360f('0x20')](_0x10009c[_0x360f('0x21')])?_0x10009c[_0x360f('0x21')]:typeof _0x10009c[_0x360f('0x21')]===_0x360f('0x22')?[_0x10009c['intervals']]:[];var _0x550350=_0x10009c['timezone']||undefined;var _0x1f26ad=![];if(_0x3617ef['length']){logger[_0x360f('0xd')](util[_0x360f('0x18')](_0x360f('0x23'),_0x3617ef['join'](';\x20')));}if(_0x550350){logger[_0x360f('0xd')](util['format'](_0x360f('0x24'),_0x550350));}logger[_0x360f('0xe')](_0x360f('0x25'),_0x1f26ad);logger['silly'](_0x360f('0x1e'),_0x10009c);return Promise[_0x360f('0x26')]()[_0x360f('0xc')](function(){if(Array[_0x360f('0x20')](_0x559e06)){return checkArrayOfIntervals(_0x559e06,_0x550350);}else if(_0x559e06){return checkSingleInterval(_0x559e06,_0x550350);}})[_0x360f('0xc')](function(_0x378a9c){var _0x44c285=_0x3617ef[_0x360f('0x17')](function(_0x358224,_0x1b97ff){return _0x358224||iftime(_0x1b97ff,_0x550350);},![]);_0x1f26ad=_0x378a9c||_0x44c285;return _0x1f26ad;})[_0x360f('0x11')](function(_0x234ef8){logger[_0x360f('0x12')]('IntervalIftime',_0x10009c,_0x234ef8);throw this[_0x360f('0x12')](0x1f4,_0x234ef8[_0x360f('0x13')]);});}; \ No newline at end of file +var _0x6246=['IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)','name','join','findById','format','IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)','intervalIds','intervals','timezone','length','IntervalIftime:\x20interval\x20strings\x20=\x20%s','IntervalIftime:\x20timezone\x20=\x20%s','Iftime','silly','IntervalIftime','resolve','isArray','lodash','util','../../mysqldb','../../utils/iftime','iftime','../../config/logger','rpc','GetInterval','Interval','options','where','attributes','limit','include','map','model','then','info','debug','stringify','catch','message','ShowInterval','find','raw','error','findAll','all','ifTime','reduce'];(function(_0x25c988,_0xce8221){var _0x45fcc2=function(_0x47fba5){while(--_0x47fba5){_0x25c988['push'](_0x25c988['shift']());}};_0x45fcc2(++_0xce8221);}(_0x6246,0x12b));var _0x6624=function(_0x5e33df,_0x15b730){_0x5e33df=_0x5e33df-0x0;var _0x322da5=_0x6246[_0x5e33df];return _0x322da5;};'use strict';var _=require(_0x6624('0x0'));var util=require(_0x6624('0x1'));var db=require(_0x6624('0x2'))['db'];var iftime=require(_0x6624('0x3'))[_0x6624('0x4')];var logger=require(_0x6624('0x5'))(_0x6624('0x6'));exports[_0x6624('0x7')]=function(_0x22ae9a){var _0x2aef7b=this;return new Promise(function(_0x5aab2a,_0x5cb3de){return db[_0x6624('0x8')]['findAll']({'raw':_0x22ae9a[_0x6624('0x9')]?_0x22ae9a[_0x6624('0x9')]['raw']===undefined?!![]:![]:!![],'where':_0x22ae9a[_0x6624('0x9')]?_0x22ae9a[_0x6624('0x9')][_0x6624('0xa')]||null:null,'attributes':_0x22ae9a['options']?_0x22ae9a[_0x6624('0x9')][_0x6624('0xb')]||null:null,'limit':_0x22ae9a[_0x6624('0x9')]?_0x22ae9a['options'][_0x6624('0xc')]||null:null,'include':_0x22ae9a[_0x6624('0x9')]?_0x22ae9a[_0x6624('0x9')][_0x6624('0xd')]?_[_0x6624('0xe')](_0x22ae9a['options'][_0x6624('0xd')],function(_0x1a851a){return{'model':db[_0x1a851a[_0x6624('0xf')]],'as':_0x1a851a['as'],'attributes':_0x1a851a[_0x6624('0xb')],'include':_0x1a851a[_0x6624('0xd')]?_[_0x6624('0xe')](_0x1a851a['include'],function(_0x202ddf){return{'model':db[_0x202ddf['model']],'as':_0x202ddf['as'],'attributes':_0x202ddf[_0x6624('0xb')],'include':_0x202ddf['include']?_['map'](_0x202ddf['include'],function(_0x29e612){return{'model':db[_0x29e612[_0x6624('0xf')]],'as':_0x29e612['as'],'attributes':_0x29e612[_0x6624('0xb')]};}):[]};}):[]};}):[]:[]})[_0x6624('0x10')](function(_0x491aa5){logger[_0x6624('0x11')](_0x6624('0x7'),_0x22ae9a);logger[_0x6624('0x12')](_0x6624('0x7'),_0x22ae9a,JSON[_0x6624('0x13')](_0x491aa5));_0x5aab2a(_0x491aa5);})[_0x6624('0x14')](function(_0x8daf64){logger['error'](_0x6624('0x7'),_0x8daf64[_0x6624('0x15')],_0x22ae9a);_0x5cb3de(_0x2aef7b['error'](0x1f4,_0x8daf64['message']));});});};exports[_0x6624('0x16')]=function(_0x50a611){var _0x55c804=this;return new Promise(function(_0x4e28e7,_0x5700b9){return db[_0x6624('0x8')][_0x6624('0x17')]({'raw':_0x50a611['options']?_0x50a611[_0x6624('0x9')][_0x6624('0x18')]===undefined?!![]:![]:!![],'where':_0x50a611[_0x6624('0x9')]?_0x50a611['options'][_0x6624('0xa')]||null:null,'attributes':_0x50a611[_0x6624('0x9')]?_0x50a611[_0x6624('0x9')][_0x6624('0xb')]||null:null,'include':_0x50a611[_0x6624('0x9')]?_0x50a611['options'][_0x6624('0xd')]?_[_0x6624('0xe')](_0x50a611['options'][_0x6624('0xd')],function(_0x1e954c){return{'model':db[_0x1e954c[_0x6624('0xf')]],'as':_0x1e954c['as'],'attributes':_0x1e954c[_0x6624('0xb')],'include':_0x1e954c[_0x6624('0xd')]?_[_0x6624('0xe')](_0x1e954c[_0x6624('0xd')],function(_0x4904a8){return{'model':db[_0x4904a8[_0x6624('0xf')]],'as':_0x4904a8['as'],'attributes':_0x4904a8['attributes'],'include':_0x4904a8['include']?_[_0x6624('0xe')](_0x4904a8['include'],function(_0x5d93d5){return{'model':db[_0x5d93d5[_0x6624('0xf')]],'as':_0x5d93d5['as'],'attributes':_0x5d93d5[_0x6624('0xb')]};}):[]};}):[]};}):[]:[]})[_0x6624('0x10')](function(_0x2e82fe){logger['info']('ShowInterval',_0x50a611);logger['debug'](_0x6624('0x16'),_0x50a611,JSON[_0x6624('0x13')](_0x2e82fe));_0x4e28e7(_0x2e82fe);})['catch'](function(_0x54d320){logger[_0x6624('0x19')](_0x6624('0x16'),_0x54d320['message'],_0x50a611);_0x5700b9(_0x55c804[_0x6624('0x19')](0x1f4,_0x54d320[_0x6624('0x15')]));});});};function checkArrayOfIntervals(_0xd7f4,_0x55a406){var _0x46592c=[];return db[_0x6624('0x8')][_0x6624('0x1a')]({'where':{'id':_0xd7f4}})[_0x6624('0x10')](function(_0x513a0a){_0x46592c=_0x513a0a;return Promise[_0x6624('0x1b')](_0x46592c[_0x6624('0xe')](function(_0x417081){return _0x417081[_0x6624('0x1c')](_0x55a406);}));})[_0x6624('0x10')](function(_0x10463a){var _0x50f911=_0x10463a[_0x6624('0x1d')](function(_0x38c53b,_0x1e8a85){return _0x38c53b||_0x1e8a85;},![]);logger[_0x6624('0x11')](util['format'](_0x6624('0x1e'),_0x46592c[_0x6624('0xe')](function(_0x4464d6){return _0x4464d6[_0x6624('0x1f')];})['join'](',\x20'),_0x46592c[_0x6624('0xe')](function(_0x2b982a){return _0x2b982a['id'];})[_0x6624('0x20')](',\x20')));return _0x50f911;});}function checkSingleInterval(_0x1d4b1b,_0x4b4398){return db[_0x6624('0x8')][_0x6624('0x21')](_0x1d4b1b)[_0x6624('0x10')](function(_0x1291a2){if(_0x1291a2){logger['info'](util[_0x6624('0x22')](_0x6624('0x23'),_0x1291a2[_0x6624('0x1f')],_0x1291a2['id']));return _0x1291a2[_0x6624('0x1c')](_0x4b4398);}});}exports['IntervalIftime']=function(_0x494b2d){var _0x194921=_0x494b2d[_0x6624('0x24')];var _0xa66830=Array['isArray'](_0x494b2d['intervals'])?_0x494b2d['intervals']:typeof _0x494b2d[_0x6624('0x25')]==='string'?[_0x494b2d[_0x6624('0x25')]]:[];var _0x471002=_0x494b2d[_0x6624('0x26')]||undefined;var _0xc5ca60=![];if(_0xa66830[_0x6624('0x27')]){logger[_0x6624('0x11')](util[_0x6624('0x22')](_0x6624('0x28'),_0xa66830[_0x6624('0x20')](';\x20')));}if(_0x471002){logger[_0x6624('0x11')](util['format'](_0x6624('0x29'),_0x471002));}logger[_0x6624('0x12')](_0x6624('0x2a'),_0xc5ca60);logger[_0x6624('0x2b')](_0x6624('0x2c'),_0x494b2d);return Promise[_0x6624('0x2d')]()[_0x6624('0x10')](function(){if(Array[_0x6624('0x2e')](_0x194921)){return checkArrayOfIntervals(_0x194921,_0x471002);}else if(_0x194921){return checkSingleInterval(_0x194921,_0x471002);}})[_0x6624('0x10')](function(_0x58a2e7){var _0x3b2e84=_0xa66830[_0x6624('0x1d')](function(_0x416081,_0x26862c){return _0x416081||iftime(_0x26862c,_0x471002);},![]);_0xc5ca60=_0x58a2e7||_0x3b2e84;return _0xc5ca60;})['catch'](function(_0x120235){logger[_0x6624('0x19')](_0x6624('0x2c'),_0x494b2d,_0x120235);throw this[_0x6624('0x19')](0x1f4,_0x120235['message']);});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index d4526ca..33b0bfd 100644 --- a/server/api/jira/index.js +++ b/server/api/jira/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['isAuthenticated','send','exports','express','Router','../../components/auth/service','./jira.controller','post'];(function(_0x2ebe38,_0xae57e8){var _0x5617a0=function(_0x19a3fc){while(--_0x19a3fc){_0x2ebe38['push'](_0x2ebe38['shift']());}};_0x5617a0(++_0xae57e8);}(_0x5f2f,0x73));var _0xf5f2=function(_0x1e1af0,_0x5abc3c){_0x1e1af0=_0x1e1af0-0x0;var _0x3d161d=_0x5f2f[_0x1e1af0];return _0x3d161d;};'use strict';var express=require(_0xf5f2('0x0'));var router=express[_0xf5f2('0x1')]();var auth=require(_0xf5f2('0x2'));var controller=require(_0xf5f2('0x3'));router[_0xf5f2('0x4')]('/',auth[_0xf5f2('0x5')](),controller[_0xf5f2('0x6')]);module[_0xf5f2('0x7')]=router; \ No newline at end of file +var _0xdb28=['isAuthenticated','send','exports','express','Router','../../components/auth/service','./jira.controller'];(function(_0xe5adeb,_0x1c7965){var _0x2a5e50=function(_0xc5807){while(--_0xc5807){_0xe5adeb['push'](_0xe5adeb['shift']());}};_0x2a5e50(++_0x1c7965);}(_0xdb28,0x106));var _0x8db2=function(_0x5b18c2,_0xb9b147){_0x5b18c2=_0x5b18c2-0x0;var _0xf2363a=_0xdb28[_0x5b18c2];return _0xf2363a;};'use strict';var express=require(_0x8db2('0x0'));var router=express[_0x8db2('0x1')]();var auth=require(_0x8db2('0x2'));var controller=require(_0x8db2('0x3'));router['post']('/',auth[_0x8db2('0x4')](),controller[_0x8db2('0x5')]);module[_0x8db2('0x6')]=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index 7582565..06b3c0c 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 _0x8040=['openIssue','send','body','x-forwarded-for','connection','remoteAddress','socket','bluebird','https','../../config/logger','api','support','3eAmWpBVP0','MOTGUI','summary','Report','stringify','fields','customfield_11500','customfield_11502','customfield_11503','name','reason','customfield_10102','track.xcallymotion.com','POST','application/json','Basic\x20','toString','request','data','end','statusCode','json','parse','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request'];(function(_0x3c7090,_0x159720){var _0x422d9a=function(_0x22509b){while(--_0x22509b){_0x3c7090['push'](_0x3c7090['shift']());}};_0x422d9a(++_0x159720);}(_0x8040,0xdf));var _0x0804=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0x8040[_0x46aff0];return _0x9d78cf;};'use strict';var BPromise=require(_0x0804('0x0'));var https=require(_0x0804('0x1'));var logger=require(_0x0804('0x2'))(_0x0804('0x3'));var USERNAME=_0x0804('0x4');var PASSWORD=_0x0804('0x5');function openIssue(_0x11f592,_0x4f6471){var _0x26ea9b={'fields':{'project':{'key':_0x11f592['key']||_0x0804('0x6')},'summary':(_0x11f592[_0x0804('0x7')]||_0x0804('0x8'))+'\x20from\x20'+_0x11f592['ip'],'description':_0x11f592['description']||JSON[_0x0804('0x9')](_0x11f592),'issuetype':{'name':_0x11f592['issuetype']||'Bug'}}};_0x26ea9b[_0x0804('0xa')][_0x0804('0xb')]=_0x11f592['email'];_0x26ea9b[_0x0804('0xa')]['customfield_11501']=_0x11f592['oldToken'];_0x26ea9b[_0x0804('0xa')][_0x0804('0xc')]=_0x11f592['newToken'];_0x26ea9b[_0x0804('0xa')][_0x0804('0xd')]=_0x11f592[_0x0804('0xe')];_0x26ea9b[_0x0804('0xa')]['customfield_11504']=_0x11f592[_0x0804('0xf')];_0x26ea9b['fields'][_0x0804('0x10')]=_0x11f592['ip'];var _0x36d31a={'host':_0x0804('0x11'),'port':0x1bb,'path':'/rest/api/2/issue','method':_0x0804('0x12'),'timeout':0x4e20,'headers':{'Content-Type':_0x0804('0x13'),'Authorization':_0x0804('0x14')+new Buffer(USERNAME+':'+PASSWORD)[_0x0804('0x15')]('base64')}};var _0x4d9d71=JSON['stringify'](_0x26ea9b);var _0x48044c=https[_0x0804('0x16')](_0x36d31a,function(_0x149738){_0x149738['setEncoding']('utf8');var _0x50b494='';_0x149738['on'](_0x0804('0x17'),function(_0x2a2066){_0x50b494+=_0x2a2066;});_0x149738['on'](_0x0804('0x18'),function(){if(_0x4f6471){return _0x4f6471['status'](_0x149738[_0x0804('0x19')])[_0x0804('0x1a')](JSON[_0x0804('0x1b')](_0x50b494));}});});_0x48044c['on']('error',function(_0xe6862e){if(_0x4f6471){return _0x4f6471['status'](0x1f4)[_0x0804('0x1a')]({'errors':[{'message':_0x0804('0x1c'),'type':'api.jira'}]});}});_0x48044c['write'](_0x4d9d71);_0x48044c[_0x0804('0x18')]();}exports[_0x0804('0x1d')]=openIssue;exports[_0x0804('0x1e')]=function(_0x8afe2,_0x2c3558){_0x8afe2[_0x0804('0x1f')]['ip']=_0x8afe2['headers'][_0x0804('0x20')]||_0x8afe2[_0x0804('0x21')][_0x0804('0x22')]||_0x8afe2['socket']['remoteAddress']||_0x8afe2['connection'][_0x0804('0x23')]['remoteAddress'];return openIssue(_0x8afe2[_0x0804('0x1f')],_0x2c3558);}; \ No newline at end of file +var _0xec69=['remoteAddress','body','bluebird','https','../../config/logger','support','MOTGUI','summary','Report','\x20from\x20','issuetype','Bug','customfield_11500','fields','customfield_11501','oldToken','customfield_11502','newToken','customfield_11503','customfield_11504','reason','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','POST','application/json','Basic\x20','toString','base64','stringify','request','setEncoding','utf8','data','end','status','statusCode','parse','error','json','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','openIssue','send','x-forwarded-for','connection'];(function(_0x16629d,_0x492375){var _0x56ccee=function(_0xa982b7){while(--_0xa982b7){_0x16629d['push'](_0x16629d['shift']());}};_0x56ccee(++_0x492375);}(_0xec69,0x1a9));var _0x9ec6=function(_0x49a975,_0x1d28d6){_0x49a975=_0x49a975-0x0;var _0x410d19=_0xec69[_0x49a975];return _0x410d19;};'use strict';var BPromise=require(_0x9ec6('0x0'));var https=require(_0x9ec6('0x1'));var logger=require(_0x9ec6('0x2'))('api');var USERNAME=_0x9ec6('0x3');var PASSWORD='3eAmWpBVP0';function openIssue(_0x478f3d,_0x3b1dc5){var _0x4f0b7b={'fields':{'project':{'key':_0x478f3d['key']||_0x9ec6('0x4')},'summary':(_0x478f3d[_0x9ec6('0x5')]||_0x9ec6('0x6'))+_0x9ec6('0x7')+_0x478f3d['ip'],'description':_0x478f3d['description']||JSON['stringify'](_0x478f3d),'issuetype':{'name':_0x478f3d[_0x9ec6('0x8')]||_0x9ec6('0x9')}}};_0x4f0b7b['fields'][_0x9ec6('0xa')]=_0x478f3d['email'];_0x4f0b7b[_0x9ec6('0xb')][_0x9ec6('0xc')]=_0x478f3d[_0x9ec6('0xd')];_0x4f0b7b['fields'][_0x9ec6('0xe')]=_0x478f3d[_0x9ec6('0xf')];_0x4f0b7b[_0x9ec6('0xb')][_0x9ec6('0x10')]=_0x478f3d['name'];_0x4f0b7b['fields'][_0x9ec6('0x11')]=_0x478f3d[_0x9ec6('0x12')];_0x4f0b7b[_0x9ec6('0xb')][_0x9ec6('0x13')]=_0x478f3d['ip'];var _0x1b865d={'host':_0x9ec6('0x14'),'port':0x1bb,'path':_0x9ec6('0x15'),'method':_0x9ec6('0x16'),'timeout':0x4e20,'headers':{'Content-Type':_0x9ec6('0x17'),'Authorization':_0x9ec6('0x18')+new Buffer(USERNAME+':'+PASSWORD)[_0x9ec6('0x19')](_0x9ec6('0x1a'))}};var _0x3af2fc=JSON[_0x9ec6('0x1b')](_0x4f0b7b);var _0x26ba4d=https[_0x9ec6('0x1c')](_0x1b865d,function(_0x5a2202){_0x5a2202[_0x9ec6('0x1d')](_0x9ec6('0x1e'));var _0x95b08a='';_0x5a2202['on'](_0x9ec6('0x1f'),function(_0x5168b8){_0x95b08a+=_0x5168b8;});_0x5a2202['on'](_0x9ec6('0x20'),function(){if(_0x3b1dc5){return _0x3b1dc5[_0x9ec6('0x21')](_0x5a2202[_0x9ec6('0x22')])['json'](JSON[_0x9ec6('0x23')](_0x95b08a));}});});_0x26ba4d['on'](_0x9ec6('0x24'),function(_0x4e71b1){if(_0x3b1dc5){return _0x3b1dc5[_0x9ec6('0x21')](0x1f4)[_0x9ec6('0x25')]({'errors':[{'message':_0x9ec6('0x26'),'type':_0x9ec6('0x27')}]});}});_0x26ba4d[_0x9ec6('0x28')](_0x3af2fc);_0x26ba4d[_0x9ec6('0x20')]();}exports[_0x9ec6('0x29')]=openIssue;exports[_0x9ec6('0x2a')]=function(_0x1052b2,_0x16b8ca){_0x1052b2['body']['ip']=_0x1052b2['headers'][_0x9ec6('0x2b')]||_0x1052b2[_0x9ec6('0x2c')][_0x9ec6('0x2d')]||_0x1052b2['socket'][_0x9ec6('0x2d')]||_0x1052b2['connection']['socket'][_0x9ec6('0x2d')];return openIssue(_0x1052b2[_0x9ec6('0x2e')],_0x16b8ca);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index 89fe0da..275e375 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 _0x2dae=['show','create','put','update','delete','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','get','index','/describe','isAuthenticated','describe','/:id'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x2dae,0xc3));var _0xe2da=function(_0x363ef8,_0x4ecb1a){_0x363ef8=_0x363ef8-0x0;var _0x148822=_0x2dae[_0x363ef8];return _0x148822;};'use strict';var multer=require(_0xe2da('0x0'));var util=require('util');var path=require(_0xe2da('0x1'));var timeout=require(_0xe2da('0x2'));var express=require(_0xe2da('0x3'));var router=express[_0xe2da('0x4')]();var fs_extra=require(_0xe2da('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xe2da('0x6'));var config=require(_0xe2da('0x7'));var controller=require(_0xe2da('0x8'));router[_0xe2da('0x9')]('/',auth['isAuthenticated'](),controller[_0xe2da('0xa')]);router[_0xe2da('0x9')](_0xe2da('0xb'),auth[_0xe2da('0xc')](),controller[_0xe2da('0xd')]);router[_0xe2da('0x9')](_0xe2da('0xe'),auth[_0xe2da('0xc')](),controller[_0xe2da('0xf')]);router['post']('/',auth[_0xe2da('0xc')](),controller[_0xe2da('0x10')]);router[_0xe2da('0x11')](_0xe2da('0xe'),auth[_0xe2da('0xc')](),controller[_0xe2da('0x12')]);router[_0xe2da('0x13')](_0xe2da('0xe'),auth['isAuthenticated'](),controller[_0xe2da('0x14')]);module['exports']=router; \ No newline at end of file +var _0x6324=['path','connect-timeout','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','describe','show','create','put','/:id','update','delete','exports','multer','util'];(function(_0x39ce06,_0x83e9b9){var _0x2c6e47=function(_0xe84619){while(--_0xe84619){_0x39ce06['push'](_0x39ce06['shift']());}};_0x2c6e47(++_0x83e9b9);}(_0x6324,0x142));var _0x4632=function(_0x41d684,_0x52f976){_0x41d684=_0x41d684-0x0;var _0x83b011=_0x6324[_0x41d684];return _0x83b011;};'use strict';var multer=require(_0x4632('0x0'));var util=require(_0x4632('0x1'));var path=require(_0x4632('0x2'));var timeout=require(_0x4632('0x3'));var express=require('express');var router=express[_0x4632('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x4632('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x4632('0x6'));var controller=require('./jscriptyAnswerReport.controller');router[_0x4632('0x7')]('/',auth[_0x4632('0x8')](),controller[_0x4632('0x9')]);router[_0x4632('0x7')]('/describe',auth[_0x4632('0x8')](),controller[_0x4632('0xa')]);router[_0x4632('0x7')]('/:id',auth[_0x4632('0x8')](),controller[_0x4632('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0x4632('0xc')]);router[_0x4632('0xd')](_0x4632('0xe'),auth[_0x4632('0x8')](),controller[_0x4632('0xf')]);router[_0x4632('0x10')](_0x4632('0xe'),auth[_0x4632('0x8')](),controller['destroy']);module[_0x4632('0x11')]=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index fd1b50e..a3a400f 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(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x7a54,0x106));var _0x47a5=function(_0x437c30,_0x4a1417){_0x437c30=_0x437c30-0x0;var _0x51f315=_0x7a54[_0x437c30];return _0x51f315;};'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(_0x35885a,_0x42fed7){var _0xe86249=function(_0x98edb3){while(--_0x98edb3){_0x35885a['push'](_0x35885a['shift']());}};_0xe86249(++_0x42fed7);}(_0x7a54,0x106));var _0x47a5=function(_0x3f7450,_0x255a98){_0x3f7450=_0x3f7450-0x0;var _0x3b3d1b=_0x7a54[_0x3f7450];return _0x3b3d1b;};'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 284c374..7aa556f 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 _0x0d4d=['zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','json','limit','undefined','count','offset','status','Content-Range','apply','save','update','then','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','JscriptyAnswerReport','rows','catch','show','params','keys','length','find','create','body','destroy','describe','eml-format','rimraf'];(function(_0x3a024b,_0x413f45){var _0x1c7fb8=function(_0x1a08e8){while(--_0x1a08e8){_0x3a024b['push'](_0x3a024b['shift']());}};_0x1c7fb8(++_0x413f45);}(_0x0d4d,0x132));var _0xd0d4=function(_0x358f68,_0x8bb529){_0x358f68=_0x358f68-0x0;var _0x118d98=_0x0d4d[_0x358f68];return _0x118d98;};'use strict';var emlformat=require(_0xd0d4('0x0'));var rimraf=require(_0xd0d4('0x1'));var zipdir=require(_0xd0d4('0x2'));var jsonpatch=require(_0xd0d4('0x3'));var rp=require(_0xd0d4('0x4'));var moment=require(_0xd0d4('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xd0d4('0x6'));var util=require('util');var path=require(_0xd0d4('0x7'));var sox=require(_0xd0d4('0x8'));var csv=require('to-csv');var ejs=require(_0xd0d4('0x9'));var fs=require('fs');var fs_extra=require(_0xd0d4('0xa'));var _=require(_0xd0d4('0xb'));var squel=require('squel');var crypto=require(_0xd0d4('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xd0d4('0xd'));var toCsv=require('to-csv');var querystring=require(_0xd0d4('0xe'));var Papa=require(_0xd0d4('0xf'));var Redis=require(_0xd0d4('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xd0d4('0x11'));var as=require(_0xd0d4('0x12'));var hardwareService=require(_0xd0d4('0x13'));var logger=require(_0xd0d4('0x14'))(_0xd0d4('0x15'));var utils=require(_0xd0d4('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xd0d4('0x17'));var db=require(_0xd0d4('0x18'))['db'];function respondWithStatusCode(_0x29ee49,_0x2ddeca){_0x2ddeca=_0x2ddeca||0xcc;return function(_0x38ca06){if(_0x38ca06){return _0x29ee49[_0xd0d4('0x19')](_0x2ddeca);}return _0x29ee49['status'](_0x2ddeca)[_0xd0d4('0x1a')]();};}function respondWithResult(_0x2131c8,_0x10a175){_0x10a175=_0x10a175||0xc8;return function(_0x5d6dd7){if(_0x5d6dd7){return _0x2131c8['status'](_0x10a175)[_0xd0d4('0x1b')](_0x5d6dd7);}};}function respondWithFilteredResult(_0x186405,_0x553b47){return function(_0x29bda4){if(_0x29bda4){var _0x1e8608=typeof _0x553b47['offset']==='undefined'&&typeof _0x553b47[_0xd0d4('0x1c')]===_0xd0d4('0x1d');var _0x268e1a=_0x29bda4['count'];var _0x5cf4c6=_0x1e8608?0x0:_0x553b47['offset'];var _0x407cda=_0x1e8608?_0x29bda4[_0xd0d4('0x1e')]:_0x553b47[_0xd0d4('0x1f')]+_0x553b47['limit'];var _0x568c75;if(_0x407cda>=_0x268e1a){_0x407cda=_0x268e1a;_0x568c75=0xc8;}else{_0x568c75=0xce;}_0x186405[_0xd0d4('0x20')](_0x568c75);return _0x186405['set'](_0xd0d4('0x21'),_0x5cf4c6+'-'+_0x407cda+'/'+_0x268e1a)[_0xd0d4('0x1b')](_0x29bda4);}return null;};}function patchUpdates(_0x1dcc1b){return function(_0x485cd8){try{jsonpatch[_0xd0d4('0x22')](_0x485cd8,_0x1dcc1b,!![]);}catch(_0x4d9fac){return BPromise['reject'](_0x4d9fac);}return _0x485cd8[_0xd0d4('0x23')]();};}function saveUpdates(_0xda03dd,_0x49b6f0){return function(_0x50f959){if(_0x50f959){return _0x50f959[_0xd0d4('0x24')](_0xda03dd)[_0xd0d4('0x25')](function(_0x398a00){return _0x398a00;});}return null;};}function removeEntity(_0x4c94b1,_0x1d8033){return function(_0x1c0831){if(_0x1c0831){return _0x1c0831['destroy']()[_0xd0d4('0x25')](function(){_0x4c94b1['status'](0xcc)[_0xd0d4('0x1a')]();});}};}function handleEntityNotFound(_0x1b03ef,_0x16808c){return function(_0x5380c3){if(!_0x5380c3){_0x1b03ef['sendStatus'](0x194);}return _0x5380c3;};}function handleError(_0x131de5,_0x4e7cc1){_0x4e7cc1=_0x4e7cc1||0x1f4;return function(_0x50e7f0){logger[_0xd0d4('0x26')](_0x50e7f0[_0xd0d4('0x27')]);if(_0x50e7f0[_0xd0d4('0x28')]){delete _0x50e7f0[_0xd0d4('0x28')];}_0x131de5['status'](_0x4e7cc1)[_0xd0d4('0x29')](_0x50e7f0);};}exports[_0xd0d4('0x2a')]=function(_0x45acf8,_0x22e142){var _0x7eecce={},_0xefce4f={},_0x1b07e8={'count':0x0,'rows':[]};var _0x266b91=_[_0xd0d4('0x2b')](db['JscriptyAnswerReport'][_0xd0d4('0x2c')],function(_0x7aa87e){return{'name':_0x7aa87e[_0xd0d4('0x2d')],'type':_0x7aa87e[_0xd0d4('0x2e')][_0xd0d4('0x2f')]};});_0xefce4f[_0xd0d4('0x30')]=_['map'](_0x266b91,'name');_0xefce4f[_0xd0d4('0x31')]=_['keys'](_0x45acf8[_0xd0d4('0x31')]);_0xefce4f[_0xd0d4('0x32')]=_[_0xd0d4('0x33')](_0xefce4f[_0xd0d4('0x30')],_0xefce4f[_0xd0d4('0x31')]);_0x7eecce[_0xd0d4('0x34')]=_[_0xd0d4('0x33')](_0xefce4f['model'],qs['fields'](_0x45acf8[_0xd0d4('0x31')][_0xd0d4('0x35')]));_0x7eecce['attributes']=_0x7eecce[_0xd0d4('0x34')]['length']?_0x7eecce['attributes']:_0xefce4f[_0xd0d4('0x30')];if(!_0x45acf8[_0xd0d4('0x31')][_0xd0d4('0x36')](_0xd0d4('0x37'))){_0x7eecce['limit']=qs['limit'](_0x45acf8[_0xd0d4('0x31')][_0xd0d4('0x1c')]);_0x7eecce[_0xd0d4('0x1f')]=qs['offset'](_0x45acf8[_0xd0d4('0x31')][_0xd0d4('0x1f')]);}_0x7eecce[_0xd0d4('0x38')]=qs[_0xd0d4('0x39')](_0x45acf8[_0xd0d4('0x31')][_0xd0d4('0x39')]);_0x7eecce[_0xd0d4('0x3a')]=qs[_0xd0d4('0x32')](_['pick'](_0x45acf8[_0xd0d4('0x31')],_0xefce4f['filters']),_0x266b91);if(_0x45acf8['query'][_0xd0d4('0x3b')]){_0x7eecce['where']=_[_0xd0d4('0x3c')](_0x7eecce[_0xd0d4('0x3a')],{'$or':_[_0xd0d4('0x2b')](_0x266b91,function(_0x1d6329){if(_0x1d6329[_0xd0d4('0x2e')]!==_0xd0d4('0x3d')){var _0x560e77={};_0x560e77[_0x1d6329[_0xd0d4('0x28')]]={'$like':'%'+_0x45acf8[_0xd0d4('0x31')]['filter']+'%'};return _0x560e77;}})});}_0x7eecce=_['merge']({},_0x7eecce,_0x45acf8[_0xd0d4('0x3e')]);var _0x3e6527={'where':_0x7eecce[_0xd0d4('0x3a')]};return db['JscriptyAnswerReport'][_0xd0d4('0x1e')](_0x3e6527)[_0xd0d4('0x25')](function(_0x230101){_0x1b07e8[_0xd0d4('0x1e')]=_0x230101;if(_0x45acf8[_0xd0d4('0x31')][_0xd0d4('0x3f')]){_0x7eecce[_0xd0d4('0x40')]=[{'all':!![]}];}return db[_0xd0d4('0x41')]['findAll'](_0x7eecce);})[_0xd0d4('0x25')](function(_0x4174e8){_0x1b07e8[_0xd0d4('0x42')]=_0x4174e8;return _0x1b07e8;})['then'](respondWithFilteredResult(_0x22e142,_0x7eecce))[_0xd0d4('0x43')](handleError(_0x22e142,null));};exports[_0xd0d4('0x44')]=function(_0x5db657,_0x11b77e){var _0x32d1c1={'raw':!![],'where':{'id':_0x5db657[_0xd0d4('0x45')]['id']}},_0x429b84={};_0x429b84[_0xd0d4('0x30')]=_[_0xd0d4('0x46')](db['JscriptyAnswerReport'][_0xd0d4('0x2c')]);_0x429b84[_0xd0d4('0x31')]=_[_0xd0d4('0x46')](_0x5db657[_0xd0d4('0x31')]);_0x429b84['filters']=_[_0xd0d4('0x33')](_0x429b84[_0xd0d4('0x30')],_0x429b84[_0xd0d4('0x31')]);_0x32d1c1[_0xd0d4('0x34')]=_[_0xd0d4('0x33')](_0x429b84[_0xd0d4('0x30')],qs[_0xd0d4('0x35')](_0x5db657['query'][_0xd0d4('0x35')]));_0x32d1c1[_0xd0d4('0x34')]=_0x32d1c1['attributes'][_0xd0d4('0x47')]?_0x32d1c1[_0xd0d4('0x34')]:_0x429b84[_0xd0d4('0x30')];if(_0x5db657[_0xd0d4('0x31')][_0xd0d4('0x3f')]){_0x32d1c1[_0xd0d4('0x40')]=[{'all':!![]}];}_0x32d1c1=_['merge']({},_0x32d1c1,_0x5db657[_0xd0d4('0x3e')]);return db['JscriptyAnswerReport'][_0xd0d4('0x48')](_0x32d1c1)[_0xd0d4('0x25')](handleEntityNotFound(_0x11b77e,null))['then'](respondWithResult(_0x11b77e,null))[_0xd0d4('0x43')](handleError(_0x11b77e,null));};exports['create']=function(_0x5d61d5,_0x1dad8b){return db['JscriptyAnswerReport'][_0xd0d4('0x49')](_0x5d61d5[_0xd0d4('0x4a')],{})['then'](respondWithResult(_0x1dad8b,0xc9))[_0xd0d4('0x43')](handleError(_0x1dad8b,null));};exports['update']=function(_0xdf2562,_0x258cd1){if(_0xdf2562[_0xd0d4('0x4a')]['id']){delete _0xdf2562[_0xd0d4('0x4a')]['id'];}return db[_0xd0d4('0x41')][_0xd0d4('0x48')]({'where':{'id':_0xdf2562[_0xd0d4('0x45')]['id']}})[_0xd0d4('0x25')](handleEntityNotFound(_0x258cd1,null))[_0xd0d4('0x25')](saveUpdates(_0xdf2562['body'],null))['then'](respondWithResult(_0x258cd1,null))[_0xd0d4('0x43')](handleError(_0x258cd1,null));};exports[_0xd0d4('0x4b')]=function(_0x333a5b,_0x6af64e){return db[_0xd0d4('0x41')][_0xd0d4('0x48')]({'where':{'id':_0x333a5b[_0xd0d4('0x45')]['id']}})[_0xd0d4('0x25')](handleEntityNotFound(_0x6af64e,null))[_0xd0d4('0x25')](removeEntity(_0x6af64e,null))['catch'](handleError(_0x6af64e,null));};exports[_0xd0d4('0x4c')]=function(_0x5b23bb,_0x4b97e1){return db[_0xd0d4('0x41')]['describe']()[_0xd0d4('0x25')](respondWithResult(_0x4b97e1,null))[_0xd0d4('0x43')](handleError(_0x4b97e1,null));}; \ No newline at end of file +var _0x6c65=['offset','limit','Content-Range','json','apply','reject','save','then','destroy','stack','name','send','index','map','JscriptyAnswerReport','rawAttributes','fieldName','type','query','filters','intersection','attributes','model','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','keys','find','create','update','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','end','status','undefined','count'];(function(_0x324bb0,_0x4810fd){var _0x56ed69=function(_0x199fbf){while(--_0x199fbf){_0x324bb0['push'](_0x324bb0['shift']());}};_0x56ed69(++_0x4810fd);}(_0x6c65,0x78));var _0x56c6=function(_0x53821d,_0x1fd786){_0x53821d=_0x53821d-0x0;var _0x427dbe=_0x6c65[_0x53821d];return _0x427dbe;};'use strict';var emlformat=require(_0x56c6('0x0'));var rimraf=require(_0x56c6('0x1'));var zipdir=require(_0x56c6('0x2'));var jsonpatch=require(_0x56c6('0x3'));var rp=require(_0x56c6('0x4'));var moment=require(_0x56c6('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x56c6('0x6'));var util=require(_0x56c6('0x7'));var path=require(_0x56c6('0x8'));var sox=require(_0x56c6('0x9'));var csv=require(_0x56c6('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x56c6('0xb'));var _=require(_0x56c6('0xc'));var squel=require(_0x56c6('0xd'));var crypto=require(_0x56c6('0xe'));var jsforce=require(_0x56c6('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x56c6('0xa'));var querystring=require(_0x56c6('0x10'));var Papa=require(_0x56c6('0x11'));var Redis=require('ioredis');var authService=require(_0x56c6('0x12'));var qs=require(_0x56c6('0x13'));var as=require(_0x56c6('0x14'));var hardwareService=require(_0x56c6('0x15'));var logger=require(_0x56c6('0x16'))(_0x56c6('0x17'));var utils=require('../../config/utils');var config=require(_0x56c6('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1d7c67,_0x2bb84e){_0x2bb84e=_0x2bb84e||0xcc;return function(_0x3310ed){if(_0x3310ed){return _0x1d7c67[_0x56c6('0x19')](_0x2bb84e);}return _0x1d7c67['status'](_0x2bb84e)[_0x56c6('0x1a')]();};}function respondWithResult(_0x511316,_0x17f72e){_0x17f72e=_0x17f72e||0xc8;return function(_0x59b7b5){if(_0x59b7b5){return _0x511316[_0x56c6('0x1b')](_0x17f72e)['json'](_0x59b7b5);}};}function respondWithFilteredResult(_0x557189,_0x4b47ce){return function(_0x4d0838){if(_0x4d0838){var _0x3e6082=typeof _0x4b47ce['offset']===_0x56c6('0x1c')&&typeof _0x4b47ce['limit']===_0x56c6('0x1c');var _0x49fff5=_0x4d0838[_0x56c6('0x1d')];var _0x5625f2=_0x3e6082?0x0:_0x4b47ce[_0x56c6('0x1e')];var _0x288325=_0x3e6082?_0x4d0838['count']:_0x4b47ce[_0x56c6('0x1e')]+_0x4b47ce[_0x56c6('0x1f')];var _0x27b5b0;if(_0x288325>=_0x49fff5){_0x288325=_0x49fff5;_0x27b5b0=0xc8;}else{_0x27b5b0=0xce;}_0x557189[_0x56c6('0x1b')](_0x27b5b0);return _0x557189['set'](_0x56c6('0x20'),_0x5625f2+'-'+_0x288325+'/'+_0x49fff5)[_0x56c6('0x21')](_0x4d0838);}return null;};}function patchUpdates(_0x413ca7){return function(_0x137570){try{jsonpatch[_0x56c6('0x22')](_0x137570,_0x413ca7,!![]);}catch(_0x58bc6f){return BPromise[_0x56c6('0x23')](_0x58bc6f);}return _0x137570[_0x56c6('0x24')]();};}function saveUpdates(_0x55271c,_0x40d7be){return function(_0x4d33f7){if(_0x4d33f7){return _0x4d33f7['update'](_0x55271c)[_0x56c6('0x25')](function(_0x1f1bb1){return _0x1f1bb1;});}return null;};}function removeEntity(_0x17dd94,_0x5c6682){return function(_0x27806e){if(_0x27806e){return _0x27806e[_0x56c6('0x26')]()[_0x56c6('0x25')](function(){_0x17dd94[_0x56c6('0x1b')](0xcc)[_0x56c6('0x1a')]();});}};}function handleEntityNotFound(_0x207f05,_0x50d7ee){return function(_0x4be5df){if(!_0x4be5df){_0x207f05[_0x56c6('0x19')](0x194);}return _0x4be5df;};}function handleError(_0x44164c,_0x5cb361){_0x5cb361=_0x5cb361||0x1f4;return function(_0x33f95e){logger['error'](_0x33f95e[_0x56c6('0x27')]);if(_0x33f95e['name']){delete _0x33f95e[_0x56c6('0x28')];}_0x44164c['status'](_0x5cb361)[_0x56c6('0x29')](_0x33f95e);};}exports[_0x56c6('0x2a')]=function(_0x24fb02,_0x2e6b07){var _0x1acdcf={},_0x67fec3={},_0x14094b={'count':0x0,'rows':[]};var _0x3938d4=_[_0x56c6('0x2b')](db[_0x56c6('0x2c')][_0x56c6('0x2d')],function(_0x492d80){return{'name':_0x492d80[_0x56c6('0x2e')],'type':_0x492d80[_0x56c6('0x2f')]['key']};});_0x67fec3['model']=_[_0x56c6('0x2b')](_0x3938d4,'name');_0x67fec3[_0x56c6('0x30')]=_['keys'](_0x24fb02[_0x56c6('0x30')]);_0x67fec3[_0x56c6('0x31')]=_[_0x56c6('0x32')](_0x67fec3['model'],_0x67fec3[_0x56c6('0x30')]);_0x1acdcf[_0x56c6('0x33')]=_[_0x56c6('0x32')](_0x67fec3[_0x56c6('0x34')],qs[_0x56c6('0x35')](_0x24fb02[_0x56c6('0x30')][_0x56c6('0x35')]));_0x1acdcf[_0x56c6('0x33')]=_0x1acdcf[_0x56c6('0x33')][_0x56c6('0x36')]?_0x1acdcf['attributes']:_0x67fec3[_0x56c6('0x34')];if(!_0x24fb02[_0x56c6('0x30')]['hasOwnProperty'](_0x56c6('0x37'))){_0x1acdcf[_0x56c6('0x1f')]=qs[_0x56c6('0x1f')](_0x24fb02[_0x56c6('0x30')][_0x56c6('0x1f')]);_0x1acdcf[_0x56c6('0x1e')]=qs[_0x56c6('0x1e')](_0x24fb02['query'][_0x56c6('0x1e')]);}_0x1acdcf[_0x56c6('0x38')]=qs[_0x56c6('0x39')](_0x24fb02[_0x56c6('0x30')][_0x56c6('0x39')]);_0x1acdcf[_0x56c6('0x3a')]=qs[_0x56c6('0x31')](_['pick'](_0x24fb02['query'],_0x67fec3[_0x56c6('0x31')]),_0x3938d4);if(_0x24fb02[_0x56c6('0x30')][_0x56c6('0x3b')]){_0x1acdcf[_0x56c6('0x3a')]=_[_0x56c6('0x3c')](_0x1acdcf[_0x56c6('0x3a')],{'$or':_[_0x56c6('0x2b')](_0x3938d4,function(_0xbc92e){if(_0xbc92e[_0x56c6('0x2f')]!==_0x56c6('0x3d')){var _0x493865={};_0x493865[_0xbc92e[_0x56c6('0x28')]]={'$like':'%'+_0x24fb02[_0x56c6('0x30')][_0x56c6('0x3b')]+'%'};return _0x493865;}})});}_0x1acdcf=_['merge']({},_0x1acdcf,_0x24fb02[_0x56c6('0x3e')]);var _0x74516a={'where':_0x1acdcf[_0x56c6('0x3a')]};return db['JscriptyAnswerReport']['count'](_0x74516a)[_0x56c6('0x25')](function(_0x2dea5d){_0x14094b[_0x56c6('0x1d')]=_0x2dea5d;if(_0x24fb02[_0x56c6('0x30')][_0x56c6('0x3f')]){_0x1acdcf[_0x56c6('0x40')]=[{'all':!![]}];}return db[_0x56c6('0x2c')][_0x56c6('0x41')](_0x1acdcf);})[_0x56c6('0x25')](function(_0x295522){_0x14094b[_0x56c6('0x42')]=_0x295522;return _0x14094b;})[_0x56c6('0x25')](respondWithFilteredResult(_0x2e6b07,_0x1acdcf))[_0x56c6('0x43')](handleError(_0x2e6b07,null));};exports['show']=function(_0x217723,_0x851bbe){var _0x1e6b10={'raw':!![],'where':{'id':_0x217723[_0x56c6('0x44')]['id']}},_0x5968ac={};_0x5968ac[_0x56c6('0x34')]=_[_0x56c6('0x45')](db[_0x56c6('0x2c')][_0x56c6('0x2d')]);_0x5968ac[_0x56c6('0x30')]=_[_0x56c6('0x45')](_0x217723[_0x56c6('0x30')]);_0x5968ac['filters']=_[_0x56c6('0x32')](_0x5968ac['model'],_0x5968ac['query']);_0x1e6b10[_0x56c6('0x33')]=_[_0x56c6('0x32')](_0x5968ac[_0x56c6('0x34')],qs[_0x56c6('0x35')](_0x217723['query'][_0x56c6('0x35')]));_0x1e6b10[_0x56c6('0x33')]=_0x1e6b10[_0x56c6('0x33')]['length']?_0x1e6b10[_0x56c6('0x33')]:_0x5968ac[_0x56c6('0x34')];if(_0x217723[_0x56c6('0x30')][_0x56c6('0x3f')]){_0x1e6b10[_0x56c6('0x40')]=[{'all':!![]}];}_0x1e6b10=_['merge']({},_0x1e6b10,_0x217723[_0x56c6('0x3e')]);return db[_0x56c6('0x2c')][_0x56c6('0x46')](_0x1e6b10)[_0x56c6('0x25')](handleEntityNotFound(_0x851bbe,null))[_0x56c6('0x25')](respondWithResult(_0x851bbe,null))[_0x56c6('0x43')](handleError(_0x851bbe,null));};exports[_0x56c6('0x47')]=function(_0x1b6ac4,_0x4529df){return db[_0x56c6('0x2c')][_0x56c6('0x47')](_0x1b6ac4['body'],{})[_0x56c6('0x25')](respondWithResult(_0x4529df,0xc9))['catch'](handleError(_0x4529df,null));};exports[_0x56c6('0x48')]=function(_0x58cfa5,_0x5b449f){if(_0x58cfa5[_0x56c6('0x49')]['id']){delete _0x58cfa5[_0x56c6('0x49')]['id'];}return db[_0x56c6('0x2c')][_0x56c6('0x46')]({'where':{'id':_0x58cfa5[_0x56c6('0x44')]['id']}})[_0x56c6('0x25')](handleEntityNotFound(_0x5b449f,null))[_0x56c6('0x25')](saveUpdates(_0x58cfa5[_0x56c6('0x49')],null))[_0x56c6('0x25')](respondWithResult(_0x5b449f,null))[_0x56c6('0x43')](handleError(_0x5b449f,null));};exports['destroy']=function(_0x2b1ff0,_0x20598b){return db[_0x56c6('0x2c')][_0x56c6('0x46')]({'where':{'id':_0x2b1ff0['params']['id']}})[_0x56c6('0x25')](handleEntityNotFound(_0x20598b,null))[_0x56c6('0x25')](removeEntity(_0x20598b,null))[_0x56c6('0x43')](handleError(_0x20598b,null));};exports['describe']=function(_0x438674,_0xacbb0d){return db[_0x56c6('0x2c')][_0x56c6('0x4a')]()['then'](respondWithResult(_0xacbb0d,null))[_0x56c6('0x43')](handleError(_0xacbb0d,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index 3d2bd1d..190284a 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 _0x2b31=['util','../../config/logger','api','moment','path','rimraf','../../config/environment','exports','define','JscriptyAnswerReport'];(function(_0x5f44ba,_0x1f318e){var _0x312dbe=function(_0x3ea0af){while(--_0x3ea0af){_0x5f44ba['push'](_0x5f44ba['shift']());}};_0x312dbe(++_0x1f318e);}(_0x2b31,0xd2));var _0x12b3=function(_0x49a821,_0x70c3ff){_0x49a821=_0x49a821-0x0;var _0x2ae168=_0x2b31[_0x49a821];return _0x2ae168;};'use strict';var _=require('lodash');var util=require(_0x12b3('0x0'));var logger=require(_0x12b3('0x1'))(_0x12b3('0x2'));var moment=require(_0x12b3('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x12b3('0x4'));var rimraf=require(_0x12b3('0x5'));var config=require(_0x12b3('0x6'));var attributes=require('./jscriptyAnswerReport.attributes');module[_0x12b3('0x7')]=function(_0x1cd5be,_0x1d40c4){return _0x1cd5be[_0x12b3('0x8')](_0x12b3('0x9'),attributes,{'tableName':'report_jscripty_answers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5ce0=['moment','bluebird','request-promise','path','../../config/environment','exports','define','JscriptyAnswerReport','util','../../config/logger','api'];(function(_0xeceb76,_0x16cedf){var _0x55d889=function(_0x4a8268){while(--_0x4a8268){_0xeceb76['push'](_0xeceb76['shift']());}};_0x55d889(++_0x16cedf);}(_0x5ce0,0x1d6));var _0x05ce=function(_0x3438cf,_0x73b174){_0x3438cf=_0x3438cf-0x0;var _0x278698=_0x5ce0[_0x3438cf];return _0x278698;};'use strict';var _=require('lodash');var util=require(_0x05ce('0x0'));var logger=require(_0x05ce('0x1'))(_0x05ce('0x2'));var moment=require(_0x05ce('0x3'));var BPromise=require(_0x05ce('0x4'));var rp=require(_0x05ce('0x5'));var fs=require('fs');var path=require(_0x05ce('0x6'));var rimraf=require('rimraf');var config=require(_0x05ce('0x7'));var attributes=require('./jscriptyAnswerReport.attributes');module[_0x05ce('0x8')]=function(_0x4a6f35,_0x125374){return _0x4a6f35[_0x05ce('0x9')](_0x05ce('0xa'),attributes,{'tableName':'report_jscripty_answers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js index c110f95..540076a 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 _0xf90b=['http','request','then','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','JscriptyAnswerReport,\x20%s,\x20%s','util','bluebird','ioredis','../../config/environment','client'];(function(_0x265f52,_0x2d59d1){var _0x108c85=function(_0x56bc80){while(--_0x56bc80){_0x265f52['push'](_0x265f52['shift']());}};_0x108c85(++_0x2d59d1);}(_0xf90b,0x14f));var _0xbf90=function(_0x3c1f9e,_0x50e515){_0x3c1f9e=_0x3c1f9e-0x0;var _0x13c335=_0xf90b[_0x3c1f9e];return _0x13c335;};'use strict';var _=require('lodash');var util=require(_0xbf90('0x0'));var moment=require('moment');var BPromise=require(_0xbf90('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbf90('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xbf90('0x3'));var jayson=require('jayson/promise');var client=jayson[_0xbf90('0x4')][_0xbf90('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x5172e1,_0x1e9566,_0x37533b){return new BPromise(function(_0x40ff16,_0xfc4713){return client[_0xbf90('0x6')](_0x5172e1,_0x37533b)[_0xbf90('0x7')](function(_0x2517e0){logger['info']('JscriptyAnswerReport,\x20%s,\x20%s',_0x1e9566,_0xbf90('0x8'));logger[_0xbf90('0x9')](_0xbf90('0xa'),_0x1e9566,'request\x20sent',JSON[_0xbf90('0xb')](_0x2517e0));if(_0x2517e0[_0xbf90('0xc')]){if(_0x2517e0[_0xbf90('0xc')][_0xbf90('0xd')]===0x1f4){logger[_0xbf90('0xc')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x1e9566,_0x2517e0[_0xbf90('0xc')][_0xbf90('0xe')]);return _0xfc4713(_0x2517e0[_0xbf90('0xc')][_0xbf90('0xe')]);}logger[_0xbf90('0xc')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x1e9566,_0x2517e0[_0xbf90('0xc')][_0xbf90('0xe')]);return _0x40ff16(_0x2517e0['error'][_0xbf90('0xe')]);}else{logger['info']('JscriptyAnswerReport,\x20%s,\x20%s',_0x1e9566,_0xbf90('0x8'));_0x40ff16(_0x2517e0[_0xbf90('0xf')][_0xbf90('0xe')]);}})['catch'](function(_0xf3f635){logger[_0xbf90('0xc')](_0xbf90('0x10'),_0x1e9566,_0xf3f635);_0xfc4713(_0xf3f635);});});} \ No newline at end of file +var _0x85e3=['util','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash'];(function(_0x1020d5,_0x5179de){var _0x5c7242=function(_0x47736f){while(--_0x47736f){_0x1020d5['push'](_0x1020d5['shift']());}};_0x5c7242(++_0x5179de);}(_0x85e3,0x99));var _0x385e=function(_0x591976,_0x337840){_0x591976=_0x591976-0x0;var _0x16ad47=_0x85e3[_0x591976];return _0x16ad47;};'use strict';var _=require(_0x385e('0x0'));var util=require(_0x385e('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x385e('0x2'));var db=require(_0x385e('0x3'))['db'];var utils=require(_0x385e('0x4'));var logger=require(_0x385e('0x5'))('rpc');var config=require(_0x385e('0x6'));var jayson=require(_0x385e('0x7'));var client=jayson[_0x385e('0x8')][_0x385e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1fd3fe,_0x302733,_0x6d6140){return new BPromise(function(_0x44b2c2,_0x24c0af){return client[_0x385e('0xa')](_0x1fd3fe,_0x6d6140)[_0x385e('0xb')](function(_0x1a697b){logger[_0x385e('0xc')](_0x385e('0xd'),_0x302733,_0x385e('0xe'));logger[_0x385e('0xf')]('JscriptyAnswerReport,\x20%s,\x20%s,\x20%s',_0x302733,'request\x20sent',JSON[_0x385e('0x10')](_0x1a697b));if(_0x1a697b[_0x385e('0x11')]){if(_0x1a697b[_0x385e('0x11')][_0x385e('0x12')]===0x1f4){logger[_0x385e('0x11')](_0x385e('0xd'),_0x302733,_0x1a697b[_0x385e('0x11')][_0x385e('0x13')]);return _0x24c0af(_0x1a697b['error']['message']);}logger['error'](_0x385e('0xd'),_0x302733,_0x1a697b[_0x385e('0x11')][_0x385e('0x13')]);return _0x44b2c2(_0x1a697b[_0x385e('0x11')][_0x385e('0x13')]);}else{logger[_0x385e('0xc')](_0x385e('0xd'),_0x302733,'request\x20sent');_0x44b2c2(_0x1a697b[_0x385e('0x14')][_0x385e('0x13')]);}})[_0x385e('0x15')](function(_0x4773f2){logger[_0x385e('0x11')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x302733,_0x4773f2);_0x24c0af(_0x4773f2);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index c406acb..8bae5d8 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 _0xb3ed=['getSummary','post','create','/:id/clone','clone','put','update','delete','destroy','exports','multer','path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','get','isAuthenticated','/:id','getSessions','/:id/answers','getAnswers','30s'];(function(_0x33155c,_0x3fdde1){var _0x5becf7=function(_0x2f7a2f){while(--_0x2f7a2f){_0x33155c['push'](_0x33155c['shift']());}};_0x5becf7(++_0x3fdde1);}(_0xb3ed,0x1d2));var _0xdb3e=function(_0x3c5d31,_0x1b6ce7){_0x3c5d31=_0x3c5d31-0x0;var _0x250c19=_0xb3ed[_0x3c5d31];return _0x250c19;};'use strict';var multer=require(_0xdb3e('0x0'));var util=require('util');var path=require(_0xdb3e('0x1'));var timeout=require(_0xdb3e('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xdb3e('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xdb3e('0x4'));var config=require(_0xdb3e('0x5'));var controller=require(_0xdb3e('0x6'));router[_0xdb3e('0x7')]('/',auth[_0xdb3e('0x8')](),controller['index']);router[_0xdb3e('0x7')](_0xdb3e('0x9'),auth['isAuthenticated'](),controller['show']);router[_0xdb3e('0x7')]('/:id/sessions',auth[_0xdb3e('0x8')](),controller[_0xdb3e('0xa')]);router[_0xdb3e('0x7')](_0xdb3e('0xb'),auth[_0xdb3e('0x8')](),controller[_0xdb3e('0xc')]);router[_0xdb3e('0x7')]('/:id/summary',auth[_0xdb3e('0x8')](),timeout(_0xdb3e('0xd')),controller[_0xdb3e('0xe')]);router[_0xdb3e('0xf')]('/',auth[_0xdb3e('0x8')](),controller[_0xdb3e('0x10')]);router['post'](_0xdb3e('0x11'),auth[_0xdb3e('0x8')](),controller[_0xdb3e('0x12')]);router[_0xdb3e('0x13')](_0xdb3e('0x9'),auth[_0xdb3e('0x8')](),controller[_0xdb3e('0x14')]);router[_0xdb3e('0x15')](_0xdb3e('0x9'),auth[_0xdb3e('0x8')](),controller[_0xdb3e('0x16')]);module[_0xdb3e('0x17')]=router; \ No newline at end of file +var _0x9904=['multer','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','./jscriptyProject.controller','get','isAuthenticated','show','/:id/sessions','getSessions','/:id/answers','getAnswers','30s','create','/:id/clone','put','/:id','delete','exports'];(function(_0x473868,_0x2a5c88){var _0x6bc8ea=function(_0x3c629e){while(--_0x3c629e){_0x473868['push'](_0x473868['shift']());}};_0x6bc8ea(++_0x2a5c88);}(_0x9904,0xd2));var _0x4990=function(_0x5bbf6a,_0x29460a){_0x5bbf6a=_0x5bbf6a-0x0;var _0x5d051a=_0x9904[_0x5bbf6a];return _0x5d051a;};'use strict';var multer=require(_0x4990('0x0'));var util=require('util');var path=require(_0x4990('0x1'));var timeout=require('connect-timeout');var express=require(_0x4990('0x2'));var router=express['Router']();var fs_extra=require(_0x4990('0x3'));var auth=require(_0x4990('0x4'));var interaction=require(_0x4990('0x5'));var config=require('../../config/environment');var controller=require(_0x4990('0x6'));router[_0x4990('0x7')]('/',auth[_0x4990('0x8')](),controller['index']);router[_0x4990('0x7')]('/:id',auth[_0x4990('0x8')](),controller[_0x4990('0x9')]);router[_0x4990('0x7')](_0x4990('0xa'),auth[_0x4990('0x8')](),controller[_0x4990('0xb')]);router[_0x4990('0x7')](_0x4990('0xc'),auth[_0x4990('0x8')](),controller[_0x4990('0xd')]);router[_0x4990('0x7')]('/:id/summary',auth[_0x4990('0x8')](),timeout(_0x4990('0xe')),controller['getSummary']);router['post']('/',auth['isAuthenticated'](),controller[_0x4990('0xf')]);router['post'](_0x4990('0x10'),auth[_0x4990('0x8')](),controller['clone']);router[_0x4990('0x11')](_0x4990('0x12'),auth[_0x4990('0x8')](),controller['update']);router[_0x4990('0x13')]('/:id',auth[_0x4990('0x8')](),controller['destroy']);module[_0x4990('0x14')]=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index 6e494ca..c0c1a09 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 _0x4e67=['formData','isString','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','name','description','BOOLEAN','sequelize','lodash','util','STRING','TEXT','long','isObjectLike','setDataValue'];(function(_0x1c7b78,_0x1a494e){var _0x35c64f=function(_0x4b3e66){while(--_0x4b3e66){_0x1c7b78['push'](_0x1c7b78['shift']());}};_0x35c64f(++_0x1a494e);}(_0x4e67,0xc8));var _0x74e6=function(_0x1cfe2e,_0x1ebbcd){_0x1cfe2e=_0x1cfe2e-0x0;var _0x39233f=_0x4e67[_0x1cfe2e];return _0x39233f;};'use strict';var Sequelize=require(_0x74e6('0x0'));var _=require(_0x74e6('0x1'));var util=require(_0x74e6('0x2'));module['exports']={'name':{'type':Sequelize[_0x74e6('0x3')],'unique':'name'},'description':{'type':Sequelize[_0x74e6('0x3')]},'formData':{'type':Sequelize[_0x74e6('0x4')](_0x74e6('0x5')),'set':function(_0x2c2d75){if(_[_0x74e6('0x6')](_0x2c2d75)){this[_0x74e6('0x7')](_0x74e6('0x8'),JSON['stringify'](_0x2c2d75));}else if(_[_0x74e6('0x9')](_0x2c2d75)){this[_0x74e6('0x7')](_0x74e6('0x8'),_0x2c2d75);}else{this[_0x74e6('0x7')](_0x74e6('0x8'),util[_0x74e6('0xa')](_0x74e6('0xb'),this[_0x74e6('0xc')](_0x74e6('0xd'))||'',this[_0x74e6('0xc')](_0x74e6('0xe'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x74e6('0xf')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x74e6('0xf')],'defaultValue':![]}}; \ No newline at end of file +var _0xa882=['lodash','util','exports','STRING','long','isObjectLike','formData','stringify','isString','setDataValue','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','BOOLEAN','sequelize'];(function(_0xda501a,_0x159d6a){var _0x44be3a=function(_0x5c1c5f){while(--_0x5c1c5f){_0xda501a['push'](_0xda501a['shift']());}};_0x44be3a(++_0x159d6a);}(_0xa882,0xd1));var _0x2a88=function(_0x4a7631,_0x2c85b9){_0x4a7631=_0x4a7631-0x0;var _0x1a5a6f=_0xa882[_0x4a7631];return _0x1a5a6f;};'use strict';var Sequelize=require(_0x2a88('0x0'));var _=require(_0x2a88('0x1'));var util=require(_0x2a88('0x2'));module[_0x2a88('0x3')]={'name':{'type':Sequelize[_0x2a88('0x4')],'unique':'name'},'description':{'type':Sequelize[_0x2a88('0x4')]},'formData':{'type':Sequelize['TEXT'](_0x2a88('0x5')),'set':function(_0x5d9944){if(_[_0x2a88('0x6')](_0x5d9944)){this['setDataValue'](_0x2a88('0x7'),JSON[_0x2a88('0x8')](_0x5d9944));}else if(_[_0x2a88('0x9')](_0x5d9944)){this['setDataValue'](_0x2a88('0x7'),_0x5d9944);}else{this[_0x2a88('0xa')](_0x2a88('0x7'),util['format'](_0x2a88('0xb'),this[_0x2a88('0xc')]('name')||'',this['getDataValue'](_0x2a88('0xd'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x2a88('0xe')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x2a88('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 80befee..e43fb0a 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 _0xd1d3=['sendStatus','status','end','json','undefined','limit','offset','count','Content-Range','apply','reject','save','update','then','destroy','Projects','UserProfileResource','error','name','send','index','map','JscriptyProject','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','pick','filter','where','merge','VIRTUAL','options','includeAll','include','rows','show','params','find','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','createdAt','updatedAt','omit','findOne','sort','ProjectId','JscriptySessionReport','findAll','order','JscriptyAnswerReport','fromCharCode','toString','indexOf','replace','getSummary','startTime','starttime','parse','-createdAt','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','isEmpty','now','writeFileSync','setHeader','Content-disposition','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','Content-type','text/csv','download','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x2576d7,_0x167624){var _0x16a08c=function(_0x19de1e){while(--_0x19de1e){_0x2576d7['push'](_0x2576d7['shift']());}};_0x16a08c(++_0x167624);}(_0xd1d3,0xd7));var _0x3d1d=function(_0x1b6300,_0x4c0c67){_0x1b6300=_0x1b6300-0x0;var _0x5d3aeb=_0xd1d3[_0x1b6300];return _0x5d3aeb;};'use strict';var emlformat=require(_0x3d1d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3d1d('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3d1d('0x2'));var moment=require(_0x3d1d('0x3'));var BPromise=require(_0x3d1d('0x4'));var Mustache=require(_0x3d1d('0x5'));var util=require(_0x3d1d('0x6'));var path=require('path');var sox=require(_0x3d1d('0x7'));var csv=require(_0x3d1d('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3d1d('0x9'));var _=require(_0x3d1d('0xa'));var squel=require('squel');var crypto=require(_0x3d1d('0xb'));var jsforce=require(_0x3d1d('0xc'));var deskjs=require(_0x3d1d('0xd'));var toCsv=require(_0x3d1d('0x8'));var querystring=require(_0x3d1d('0xe'));var Papa=require(_0x3d1d('0xf'));var Redis=require(_0x3d1d('0x10'));var authService=require(_0x3d1d('0x11'));var qs=require(_0x3d1d('0x12'));var as=require(_0x3d1d('0x13'));var hardwareService=require(_0x3d1d('0x14'));var logger=require(_0x3d1d('0x15'))(_0x3d1d('0x16'));var utils=require(_0x3d1d('0x17'));var config=require(_0x3d1d('0x18'));var licenseUtil=require(_0x3d1d('0x19'));var db=require(_0x3d1d('0x1a'))['db'];function respondWithStatusCode(_0x24b002,_0x8a7a6e){_0x8a7a6e=_0x8a7a6e||0xcc;return function(_0x5d7db5){if(_0x5d7db5){return _0x24b002[_0x3d1d('0x1b')](_0x8a7a6e);}return _0x24b002[_0x3d1d('0x1c')](_0x8a7a6e)[_0x3d1d('0x1d')]();};}function respondWithResult(_0x277ada,_0x461a0a){_0x461a0a=_0x461a0a||0xc8;return function(_0x12dd84){if(_0x12dd84){return _0x277ada[_0x3d1d('0x1c')](_0x461a0a)[_0x3d1d('0x1e')](_0x12dd84);}};}function respondWithFilteredResult(_0x59fa63,_0x325e90){return function(_0x128f51){if(_0x128f51){var _0x5d6a51=typeof _0x325e90['offset']===_0x3d1d('0x1f')&&typeof _0x325e90[_0x3d1d('0x20')]===_0x3d1d('0x1f');var _0x2f984c=_0x128f51['count'];var _0x1898ce=_0x5d6a51?0x0:_0x325e90[_0x3d1d('0x21')];var _0x1f6035=_0x5d6a51?_0x128f51[_0x3d1d('0x22')]:_0x325e90[_0x3d1d('0x21')]+_0x325e90[_0x3d1d('0x20')];var _0x4b1f8f;if(_0x1f6035>=_0x2f984c){_0x1f6035=_0x2f984c;_0x4b1f8f=0xc8;}else{_0x4b1f8f=0xce;}_0x59fa63['status'](_0x4b1f8f);return _0x59fa63['set'](_0x3d1d('0x23'),_0x1898ce+'-'+_0x1f6035+'/'+_0x2f984c)[_0x3d1d('0x1e')](_0x128f51);}return null;};}function patchUpdates(_0x982a88){return function(_0xedf825){try{jsonpatch[_0x3d1d('0x24')](_0xedf825,_0x982a88,!![]);}catch(_0x4737f4){return BPromise[_0x3d1d('0x25')](_0x4737f4);}return _0xedf825[_0x3d1d('0x26')]();};}function saveUpdates(_0x3f1543,_0x4bbb58){return function(_0x553fa1){if(_0x553fa1){return _0x553fa1[_0x3d1d('0x27')](_0x3f1543)[_0x3d1d('0x28')](function(_0x36331f){return _0x36331f;});}return null;};}function removeEntity(_0x550bb5,_0x228735){return function(_0x3dae29){if(_0x3dae29){return _0x3dae29[_0x3d1d('0x29')]()[_0x3d1d('0x28')](function(){var _0x12f5ab=_0x3dae29['get']({'plain':!![]});var _0xb56ae1=_0x3d1d('0x2a');return db[_0x3d1d('0x2b')][_0x3d1d('0x29')]({'where':{'type':_0xb56ae1,'resourceId':_0x12f5ab['id']}})[_0x3d1d('0x28')](function(){return _0x3dae29;});})[_0x3d1d('0x28')](function(){_0x550bb5['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4efc5c,_0x2feb04){return function(_0x2a983f){if(!_0x2a983f){_0x4efc5c[_0x3d1d('0x1b')](0x194);}return _0x2a983f;};}function handleError(_0xf7687d,_0x54d7d5){_0x54d7d5=_0x54d7d5||0x1f4;return function(_0x4a4623){logger[_0x3d1d('0x2c')](_0x4a4623['stack']);if(_0x4a4623[_0x3d1d('0x2d')]){delete _0x4a4623[_0x3d1d('0x2d')];}_0xf7687d[_0x3d1d('0x1c')](_0x54d7d5)[_0x3d1d('0x2e')](_0x4a4623);};}exports[_0x3d1d('0x2f')]=function(_0x151ded,_0x1d2bb5){var _0x635ca5={},_0x33bbed={},_0x58b541={'count':0x0,'rows':[]};var _0x1de5cf=_[_0x3d1d('0x30')](db[_0x3d1d('0x31')][_0x3d1d('0x32')],function(_0x262e6e){return{'name':_0x262e6e[_0x3d1d('0x33')],'type':_0x262e6e[_0x3d1d('0x34')][_0x3d1d('0x35')]};});_0x33bbed['model']=_[_0x3d1d('0x30')](_0x1de5cf,_0x3d1d('0x2d'));_0x33bbed[_0x3d1d('0x36')]=_[_0x3d1d('0x37')](_0x151ded[_0x3d1d('0x36')]);_0x33bbed[_0x3d1d('0x38')]=_[_0x3d1d('0x39')](_0x33bbed[_0x3d1d('0x3a')],_0x33bbed[_0x3d1d('0x36')]);_0x635ca5[_0x3d1d('0x3b')]=_['intersection'](_0x33bbed[_0x3d1d('0x3a')],qs[_0x3d1d('0x3c')](_0x151ded[_0x3d1d('0x36')][_0x3d1d('0x3c')]));_0x635ca5[_0x3d1d('0x3b')]=_0x635ca5[_0x3d1d('0x3b')][_0x3d1d('0x3d')]?_0x635ca5[_0x3d1d('0x3b')]:_0x33bbed[_0x3d1d('0x3a')];if(!_0x151ded[_0x3d1d('0x36')][_0x3d1d('0x3e')](_0x3d1d('0x3f'))){_0x635ca5['limit']=qs[_0x3d1d('0x20')](_0x151ded[_0x3d1d('0x36')][_0x3d1d('0x20')]);_0x635ca5['offset']=qs[_0x3d1d('0x21')](_0x151ded[_0x3d1d('0x36')][_0x3d1d('0x21')]);}_0x635ca5['order']=qs['sort'](_0x151ded[_0x3d1d('0x36')]['sort']);_0x635ca5['where']=qs[_0x3d1d('0x38')](_[_0x3d1d('0x40')](_0x151ded[_0x3d1d('0x36')],_0x33bbed[_0x3d1d('0x38')]),_0x1de5cf);if(_0x151ded['query'][_0x3d1d('0x41')]){_0x635ca5[_0x3d1d('0x42')]=_[_0x3d1d('0x43')](_0x635ca5['where'],{'$or':_[_0x3d1d('0x30')](_0x1de5cf,function(_0x16661d){if(_0x16661d[_0x3d1d('0x34')]!==_0x3d1d('0x44')){var _0x1e34bc={};_0x1e34bc[_0x16661d[_0x3d1d('0x2d')]]={'$like':'%'+_0x151ded[_0x3d1d('0x36')]['filter']+'%'};return _0x1e34bc;}})});}_0x635ca5=_[_0x3d1d('0x43')]({},_0x635ca5,_0x151ded[_0x3d1d('0x45')]);var _0x1aa04b={'where':_0x635ca5[_0x3d1d('0x42')]};return db[_0x3d1d('0x31')][_0x3d1d('0x22')](_0x1aa04b)[_0x3d1d('0x28')](function(_0x102b18){_0x58b541[_0x3d1d('0x22')]=_0x102b18;if(_0x151ded[_0x3d1d('0x36')][_0x3d1d('0x46')]){_0x635ca5[_0x3d1d('0x47')]=[{'all':!![]}];}return db['JscriptyProject']['findAll'](_0x635ca5);})[_0x3d1d('0x28')](function(_0x493175){_0x58b541[_0x3d1d('0x48')]=_0x493175;return _0x58b541;})['then'](respondWithFilteredResult(_0x1d2bb5,_0x635ca5))['catch'](handleError(_0x1d2bb5,null));};exports[_0x3d1d('0x49')]=function(_0x12a8e3,_0x60066e){var _0x13b618={'raw':![],'where':{'id':_0x12a8e3[_0x3d1d('0x4a')]['id']}},_0x44e43e={};_0x44e43e[_0x3d1d('0x3a')]=_[_0x3d1d('0x37')](db[_0x3d1d('0x31')][_0x3d1d('0x32')]);_0x44e43e[_0x3d1d('0x36')]=_[_0x3d1d('0x37')](_0x12a8e3[_0x3d1d('0x36')]);_0x44e43e['filters']=_[_0x3d1d('0x39')](_0x44e43e[_0x3d1d('0x3a')],_0x44e43e[_0x3d1d('0x36')]);_0x13b618[_0x3d1d('0x3b')]=_[_0x3d1d('0x39')](_0x44e43e[_0x3d1d('0x3a')],qs[_0x3d1d('0x3c')](_0x12a8e3['query']['fields']));_0x13b618['attributes']=_0x13b618[_0x3d1d('0x3b')][_0x3d1d('0x3d')]?_0x13b618[_0x3d1d('0x3b')]:_0x44e43e['model'];if(_0x12a8e3[_0x3d1d('0x36')][_0x3d1d('0x46')]){_0x13b618[_0x3d1d('0x47')]=[{'all':!![]}];}_0x13b618=_[_0x3d1d('0x43')]({},_0x13b618,_0x12a8e3[_0x3d1d('0x45')]);return db[_0x3d1d('0x31')][_0x3d1d('0x4b')](_0x13b618)[_0x3d1d('0x28')](handleEntityNotFound(_0x60066e,null))[_0x3d1d('0x28')](respondWithResult(_0x60066e,null))[_0x3d1d('0x4c')](handleError(_0x60066e,null));};exports[_0x3d1d('0x4d')]=function(_0x1b3c71,_0x2330fe){return db['JscriptyProject']['create'](_0x1b3c71[_0x3d1d('0x4e')],{})[_0x3d1d('0x28')](function(_0x5579ad){var _0x1a4ff0=_0x1b3c71[_0x3d1d('0x4f')][_0x3d1d('0x50')]({'plain':!![]});if(!_0x1a4ff0)throw new Error(_0x3d1d('0x51'));if(_0x1a4ff0[_0x3d1d('0x52')]===_0x3d1d('0x4f')){var _0x110738=_0x5579ad[_0x3d1d('0x50')]({'plain':!![]});var _0x1d7d9f=_0x3d1d('0x2a');return db['UserProfileSection'][_0x3d1d('0x4b')]({'where':{'name':_0x1d7d9f,'userProfileId':_0x1a4ff0[_0x3d1d('0x53')]},'raw':!![]})['then'](function(_0x3a2a6c){if(_0x3a2a6c&&_0x3a2a6c[_0x3d1d('0x54')]===0x0){return db[_0x3d1d('0x2b')]['create']({'name':_0x110738[_0x3d1d('0x2d')],'resourceId':_0x110738['id'],'type':_0x3a2a6c['name'],'sectionId':_0x3a2a6c['id']},{})['then'](function(){return _0x5579ad;});}else{return _0x5579ad;}})['catch'](function(_0x250e43){logger[_0x3d1d('0x2c')](_0x3d1d('0x55'),_0x250e43);throw _0x250e43;});}return _0x5579ad;})[_0x3d1d('0x28')](respondWithResult(_0x2330fe,0xc9))[_0x3d1d('0x4c')](handleError(_0x2330fe,null));};exports['clone']=function(_0x63702f,_0x3a1ba9){var _0x493aa7={'where':{'id':_0x63702f[_0x3d1d('0x4a')]['id']}},_0x4b8170={};_0x4b8170[_0x3d1d('0x3a')]=_[_0x3d1d('0x37')](db['JscriptyProject'][_0x3d1d('0x32')]);_0x493aa7[_0x3d1d('0x3b')]=_['intersection'](_0x4b8170[_0x3d1d('0x3a')],qs[_0x3d1d('0x3c')](_0x63702f[_0x3d1d('0x36')]['fields']));_0x493aa7[_0x3d1d('0x3b')]=_0x493aa7[_0x3d1d('0x3b')][_0x3d1d('0x3d')]?_0x493aa7['attributes']:_0x4b8170[_0x3d1d('0x3a')];if(_0x63702f['query']['includeAll']){_0x493aa7[_0x3d1d('0x47')]=[{'all':!![]}];}_0x493aa7=_[_0x3d1d('0x43')]({},_0x493aa7,_0x63702f['options']);return db[_0x3d1d('0x31')]['find'](_0x493aa7)[_0x3d1d('0x28')](handleEntityNotFound(_0x3a1ba9,null))['then'](function(_0x1a15aa){if(_0x1a15aa){var _0x4a222d=_0x1a15aa[_0x3d1d('0x50')]({'plain':!![]});_0x4a222d=qs['omit'](_0x4a222d,['id',_0x3d1d('0x56'),_0x3d1d('0x57')]);_0x63702f[_0x3d1d('0x4e')]=_[_0x3d1d('0x58')](_0x63702f[_0x3d1d('0x4e')],['id',_0x3d1d('0x56'),'updatedAt']);return db[_0x3d1d('0x31')][_0x3d1d('0x4d')](_[_0x3d1d('0x43')](_0x4a222d,_0x63702f[_0x3d1d('0x4e')]),{'include':_0x63702f['query'][_0x3d1d('0x46')]?[{'all':!![]}]:undefined})[_0x3d1d('0x28')](function(_0x274a6b){var _0x1ace4a=_0x63702f[_0x3d1d('0x4f')][_0x3d1d('0x50')]({'plain':!![]});if(!_0x1ace4a)throw new Error(_0x3d1d('0x51'));if(_0x1ace4a[_0x3d1d('0x52')]===_0x3d1d('0x4f')){var _0x474d6f=_0x274a6b[_0x3d1d('0x50')]({'plain':!![]});var _0x26c51e=_0x3d1d('0x2a');return db['UserProfileSection'][_0x3d1d('0x4b')]({'where':{'name':_0x26c51e,'userProfileId':_0x1ace4a[_0x3d1d('0x53')]},'raw':!![]})['then'](function(_0x344700){if(_0x344700&&_0x344700[_0x3d1d('0x54')]===0x0){return db[_0x3d1d('0x2b')][_0x3d1d('0x4d')]({'name':_0x474d6f[_0x3d1d('0x2d')],'resourceId':_0x474d6f['id'],'type':_0x344700['name'],'sectionId':_0x344700['id']},{})[_0x3d1d('0x28')](function(){return _0x274a6b;});}else{return _0x274a6b;}})['catch'](function(_0x334d6b){logger[_0x3d1d('0x2c')](_0x3d1d('0x55'),_0x334d6b);throw _0x334d6b;});}return _0x274a6b;});}})[_0x3d1d('0x28')](respondWithResult(_0x3a1ba9,0xc9))['catch'](handleError(_0x3a1ba9,null));};exports['update']=function(_0x5222cb,_0x3097ac){if(_0x5222cb['body']['id']){delete _0x5222cb[_0x3d1d('0x4e')]['id'];}return db['JscriptyProject'][_0x3d1d('0x4b')]({'where':{'id':_0x5222cb[_0x3d1d('0x4a')]['id']}})['then'](handleEntityNotFound(_0x3097ac,null))[_0x3d1d('0x28')](saveUpdates(_0x5222cb[_0x3d1d('0x4e')],null))['then'](respondWithResult(_0x3097ac,null))[_0x3d1d('0x4c')](handleError(_0x3097ac,null));};exports[_0x3d1d('0x29')]=function(_0x1f5b43,_0x4ad96e){return db['JscriptyProject'][_0x3d1d('0x4b')]({'where':{'id':_0x1f5b43[_0x3d1d('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4ad96e,null))['then'](removeEntity(_0x4ad96e,null))['catch'](handleError(_0x4ad96e,null));};exports['getSessions']=function(_0x119f45,_0x40d393,_0x5d8609){var _0x205c4a={'raw':!![],'where':{}};var _0x1ae110={};var _0x1c46ad={'count':0x0,'rows':[]};return db[_0x3d1d('0x31')][_0x3d1d('0x59')]({'where':{'id':_0x119f45[_0x3d1d('0x4a')]['id']}})[_0x3d1d('0x28')](handleEntityNotFound(_0x40d393,null))['then'](function(_0x19fde5){if(_0x19fde5){_0x1ae110[_0x3d1d('0x3a')]=_[_0x3d1d('0x37')](db['JscriptySessionReport']['rawAttributes']);_0x1ae110[_0x3d1d('0x36')]=_[_0x3d1d('0x37')](_0x119f45[_0x3d1d('0x36')]);_0x1ae110[_0x3d1d('0x38')]=_[_0x3d1d('0x39')](_0x1ae110[_0x3d1d('0x3a')],_0x1ae110[_0x3d1d('0x36')]);_0x205c4a['attributes']=_['intersection'](_0x1ae110[_0x3d1d('0x3a')],qs[_0x3d1d('0x3c')](_0x119f45[_0x3d1d('0x36')]['fields']));_0x205c4a[_0x3d1d('0x3b')]=_0x205c4a['attributes']['length']?_0x205c4a[_0x3d1d('0x3b')]:_0x1ae110[_0x3d1d('0x3a')];if(!_0x119f45[_0x3d1d('0x36')][_0x3d1d('0x3e')](_0x3d1d('0x3f'))){_0x205c4a['limit']=qs[_0x3d1d('0x20')](_0x119f45[_0x3d1d('0x36')]['limit']);_0x205c4a[_0x3d1d('0x21')]=qs['offset'](_0x119f45['query']['offset']);}_0x205c4a['order']=qs[_0x3d1d('0x5a')](_0x119f45[_0x3d1d('0x36')][_0x3d1d('0x5a')]);_0x205c4a[_0x3d1d('0x42')]=qs[_0x3d1d('0x38')](_[_0x3d1d('0x40')](_0x119f45[_0x3d1d('0x36')],_0x1ae110[_0x3d1d('0x38')]));_0x205c4a[_0x3d1d('0x42')][_0x3d1d('0x5b')]=_0x19fde5['id'];if(_0x119f45['query'][_0x3d1d('0x41')]){_0x205c4a['where']=_[_0x3d1d('0x43')](_0x205c4a['where'],{'$or':_[_0x3d1d('0x30')](_0x205c4a[_0x3d1d('0x3b')],function(_0x16d5c3){var _0x146a46={};_0x146a46[_0x16d5c3]={'$like':'%'+_0x119f45['query'][_0x3d1d('0x41')]+'%'};return _0x146a46;})});}_0x205c4a=_[_0x3d1d('0x43')]({},_0x205c4a,_0x119f45['options']);return db[_0x3d1d('0x5c')][_0x3d1d('0x22')]({'where':_0x205c4a[_0x3d1d('0x42')]})['then'](function(_0x859b55){_0x1c46ad[_0x3d1d('0x22')]=_0x859b55;if(_0x119f45[_0x3d1d('0x36')]['includeAll']){_0x205c4a[_0x3d1d('0x47')]=[{'all':!![]}];}return db[_0x3d1d('0x5c')][_0x3d1d('0x5d')](_0x205c4a);})[_0x3d1d('0x28')](function(_0x5cd169){_0x1c46ad[_0x3d1d('0x48')]=_0x5cd169;return _0x1c46ad;});}})[_0x3d1d('0x28')](respondWithFilteredResult(_0x40d393,_0x205c4a))[_0x3d1d('0x4c')](handleError(_0x40d393,null));};exports['getAnswers']=function(_0x4fc823,_0x206967,_0x516146){var _0x50479e={'raw':!![],'where':{}};var _0x315788={};var _0x2cf63d={'count':0x0,'rows':[]};return db['JscriptyProject'][_0x3d1d('0x59')]({'where':{'id':_0x4fc823[_0x3d1d('0x4a')]['id']}})['then'](handleEntityNotFound(_0x206967,null))[_0x3d1d('0x28')](function(_0x1b901f){if(_0x1b901f){_0x315788[_0x3d1d('0x3a')]=_[_0x3d1d('0x37')](db['JscriptyAnswerReport']['rawAttributes']);_0x315788['query']=_[_0x3d1d('0x37')](_0x4fc823[_0x3d1d('0x36')]);_0x315788[_0x3d1d('0x38')]=_[_0x3d1d('0x39')](_0x315788[_0x3d1d('0x3a')],_0x315788['query']);_0x50479e['attributes']=_['intersection'](_0x315788[_0x3d1d('0x3a')],qs[_0x3d1d('0x3c')](_0x4fc823[_0x3d1d('0x36')][_0x3d1d('0x3c')]));_0x50479e[_0x3d1d('0x3b')]=_0x50479e[_0x3d1d('0x3b')]['length']?_0x50479e[_0x3d1d('0x3b')]:_0x315788['model'];if(!_0x4fc823[_0x3d1d('0x36')][_0x3d1d('0x3e')]('nolimit')){_0x50479e[_0x3d1d('0x20')]=qs['limit'](_0x4fc823[_0x3d1d('0x36')]['limit']);_0x50479e[_0x3d1d('0x21')]=qs[_0x3d1d('0x21')](_0x4fc823[_0x3d1d('0x36')]['offset']);}_0x50479e[_0x3d1d('0x5e')]=qs[_0x3d1d('0x5a')](_0x4fc823[_0x3d1d('0x36')][_0x3d1d('0x5a')]);_0x50479e[_0x3d1d('0x42')]=qs[_0x3d1d('0x38')](_[_0x3d1d('0x40')](_0x4fc823[_0x3d1d('0x36')],_0x315788['filters']));_0x50479e[_0x3d1d('0x42')][_0x3d1d('0x5b')]=_0x1b901f['id'];if(_0x4fc823[_0x3d1d('0x36')]['filter']){_0x50479e[_0x3d1d('0x42')]=_['merge'](_0x50479e[_0x3d1d('0x42')],{'$or':_[_0x3d1d('0x30')](_0x50479e[_0x3d1d('0x3b')],function(_0x19bdb8){var _0x5379fb={};_0x5379fb[_0x19bdb8]={'$like':'%'+_0x4fc823[_0x3d1d('0x36')][_0x3d1d('0x41')]+'%'};return _0x5379fb;})});}_0x50479e=_['merge']({},_0x50479e,_0x4fc823[_0x3d1d('0x45')]);return db['JscriptyAnswerReport'][_0x3d1d('0x22')]({'where':_0x50479e['where']})['then'](function(_0x1a26f2){_0x2cf63d['count']=_0x1a26f2;if(_0x4fc823[_0x3d1d('0x36')][_0x3d1d('0x46')]){_0x50479e[_0x3d1d('0x47')]=[{'all':!![]}];}return db[_0x3d1d('0x5f')][_0x3d1d('0x5d')](_0x50479e);})[_0x3d1d('0x28')](function(_0x22de2f){_0x2cf63d[_0x3d1d('0x48')]=_0x22de2f;return _0x2cf63d;});}})[_0x3d1d('0x28')](respondWithFilteredResult(_0x206967,_0x50479e))['catch'](handleError(_0x206967,null));};function char(_0x338302){return'number'===typeof _0x338302?String[_0x3d1d('0x60')][_0x3d1d('0x24')](null,arguments):_0x338302;}function needsEncapsulation(_0x460382){return!!_0x460382&&(_0x460382[_0x3d1d('0x61')]()['indexOf'](char(0xd))>=0x0||_0x460382[_0x3d1d('0x61')]()[_0x3d1d('0x62')](char(0xa))>=0x0||_0x460382[_0x3d1d('0x61')]()[_0x3d1d('0x62')](char(0x2c))>=0x0||_0x460382[_0x3d1d('0x61')]()[_0x3d1d('0x62')](char(0x22))>=0x0);}function encapsulate(_0x2e77d0){var _0x46511c=char(0x22),_0x329e78='\x5c'+char(0x22),_0x164831=_0x2e77d0['toString']()[_0x3d1d('0x63')](new RegExp(_0x46511c,'g'),_0x329e78);return _0x46511c+_0x164831+_0x46511c;}exports[_0x3d1d('0x64')]=function(_0x1c2ae9,_0x38ecd9,_0xafe17a){var _0x3e3427,_0x2483ea;var _0x3928af={'where':{'ProjectId':_0x1c2ae9['params']['id']}};if(_0x1c2ae9[_0x3d1d('0x36')][_0x3d1d('0x65')]){_0x3928af[_0x3d1d('0x42')][_0x3d1d('0x66')]=JSON[_0x3d1d('0x67')](_0x1c2ae9[_0x3d1d('0x36')]['startTime']);}return db[_0x3d1d('0x5c')][_0x3d1d('0x5d')](_0x3928af)[_0x3d1d('0x28')](handleEntityNotFound(_0x38ecd9,null))['then'](function(_0x40622a){if(_0x40622a){_0x3e3427=_0x40622a;return db['JscriptyQuestionReport'][_0x3d1d('0x5d')]({'where':{'SessionId':{'$in':_[_0x3d1d('0x30')](_0x3e3427,'id')},'ProjectId':_0x1c2ae9[_0x3d1d('0x4a')]['id']},'order':_0x3d1d('0x68')});}})[_0x3d1d('0x28')](handleEntityNotFound(_0x38ecd9,null))[_0x3d1d('0x28')](function(_0x52091d){if(_0x52091d){_0x2483ea=_0x52091d;var _0xd96f98={};for(var _0x8dc454=0x0,_0x5ad7cd=_0x2483ea['length'];_0x8dc454<_0x5ad7cd;_0x8dc454++){if(!_0xd96f98[_0x3d1d('0x3e')](_0x2483ea[_0x8dc454][_0x3d1d('0x69')])){_0xd96f98[_0x2483ea[_0x8dc454][_0x3d1d('0x69')]]=needsEncapsulation(_0x2483ea[_0x8dc454][_0x3d1d('0x6a')])?encapsulate(_0x2483ea[_0x8dc454][_0x3d1d('0x6a')]):_0x2483ea[_0x8dc454][_0x3d1d('0x6a')];}}var _0x274983=[],_0x4a1cd7={};for(var _0x5b1e9e=0x0,_0x52b32f=_0x3e3427['length'];_0x5b1e9e<_0x52b32f;_0x5b1e9e++){_0x4a1cd7={'ProjectId':_0x1c2ae9[_0x3d1d('0x4a')]['id'],'SessionId':_0x3e3427[_0x5b1e9e]['id'],'StartTime':moment(_0x3e3427[_0x5b1e9e]['starttime'])[_0x3d1d('0x6b')](_0x3d1d('0x6c'))};for(var _0x1a9925=0x0,_0x34cc7a=_0x2483ea['length'];_0x1a9925<_0x34cc7a;_0x1a9925++){if(_0x2483ea[_0x1a9925][_0x3d1d('0x6d')]==_0x3e3427[_0x5b1e9e]['id']&&_0xd96f98['hasOwnProperty'](_0x2483ea[_0x1a9925][_0x3d1d('0x69')])){_0x4a1cd7[_0xd96f98[_0x2483ea[_0x1a9925][_0x3d1d('0x69')]]]=_0x2483ea[_0x1a9925][_0x3d1d('0x6e')];}}for(var _0xf18151 in _0xd96f98){if(!_0x4a1cd7['hasOwnProperty'](_0xd96f98[_0xf18151])){_0x4a1cd7[_0xd96f98[_0xf18151]]=null;}}_0x274983['push'](_0x4a1cd7);}return _0x274983;}})[_0x3d1d('0x28')](function(_0x1a0c8e){if(!_[_0x3d1d('0x6f')](_0x1a0c8e)){var _0x40dcd7=toCsv(_0x1a0c8e);var _0x3cbed5=Date[_0x3d1d('0x70')]();fs[_0x3d1d('0x71')](util[_0x3d1d('0x6b')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x1c2ae9['params']['id'],_0x3cbed5),_0x40dcd7);_0x38ecd9[_0x3d1d('0x72')](_0x3d1d('0x73'),_0x3d1d('0x74')+util['format'](_0x3d1d('0x75'),_0x1c2ae9['params']['id'],_0x3cbed5));_0x38ecd9[_0x3d1d('0x72')](_0x3d1d('0x76'),_0x3d1d('0x77'));return _0x38ecd9[_0x3d1d('0x78')](util['format']('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x1c2ae9[_0x3d1d('0x4a')]['id'],_0x3cbed5));}else{return _0x38ecd9[_0x3d1d('0x1b')](0xcc);}})[_0x3d1d('0x4c')](handleError(_0x38ecd9,null));}; \ No newline at end of file +var _0x0e5a=['lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','end','json','undefined','limit','count','offset','status','Content-Range','apply','reject','save','update','then','get','Projects','UserProfileResource','destroy','error','stack','name','send','index','map','JscriptyProject','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','rawAttributes','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','omit','createdAt','updatedAt','body','getSessions','JscriptySessionReport','ProjectId','getAnswers','findOne','JscriptyAnswerReport','rows','number','fromCharCode','toString','indexOf','replace','getSummary','startTime','starttime','parse','JscriptyQuestionReport','-createdAt','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','push','isEmpty','now','writeFileSync','setHeader','Content-disposition','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','text/csv','/tmp/Jscripty_Project_%d_Summary_%s.csv','eml-format','rimraf','request-promise','moment','bluebird','mustache','path','sox','to-csv'];(function(_0x4ff68b,_0x14e950){var _0x3ef39a=function(_0x23f446){while(--_0x23f446){_0x4ff68b['push'](_0x4ff68b['shift']());}};_0x3ef39a(++_0x14e950);}(_0x0e5a,0x70));var _0xa0e5=function(_0x11f9e4,_0x226100){_0x11f9e4=_0x11f9e4-0x0;var _0x1bee30=_0x0e5a[_0x11f9e4];return _0x1bee30;};'use strict';var emlformat=require(_0xa0e5('0x0'));var rimraf=require(_0xa0e5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xa0e5('0x2'));var moment=require(_0xa0e5('0x3'));var BPromise=require(_0xa0e5('0x4'));var Mustache=require(_0xa0e5('0x5'));var util=require('util');var path=require(_0xa0e5('0x6'));var sox=require(_0xa0e5('0x7'));var csv=require(_0xa0e5('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa0e5('0x9'));var squel=require(_0xa0e5('0xa'));var crypto=require(_0xa0e5('0xb'));var jsforce=require(_0xa0e5('0xc'));var deskjs=require(_0xa0e5('0xd'));var toCsv=require(_0xa0e5('0x8'));var querystring=require(_0xa0e5('0xe'));var Papa=require(_0xa0e5('0xf'));var Redis=require(_0xa0e5('0x10'));var authService=require(_0xa0e5('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xa0e5('0x12'));var hardwareService=require(_0xa0e5('0x13'));var logger=require(_0xa0e5('0x14'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xa0e5('0x15'));var db=require(_0xa0e5('0x16'))['db'];function respondWithStatusCode(_0x3dd91e,_0x280cf1){_0x280cf1=_0x280cf1||0xcc;return function(_0x4fa117){if(_0x4fa117){return _0x3dd91e[_0xa0e5('0x17')](_0x280cf1);}return _0x3dd91e['status'](_0x280cf1)[_0xa0e5('0x18')]();};}function respondWithResult(_0x289ff7,_0x3fc9a4){_0x3fc9a4=_0x3fc9a4||0xc8;return function(_0x16b0f1){if(_0x16b0f1){return _0x289ff7['status'](_0x3fc9a4)[_0xa0e5('0x19')](_0x16b0f1);}};}function respondWithFilteredResult(_0x1814db,_0x9a4baa){return function(_0x58c077){if(_0x58c077){var _0x414d4c=typeof _0x9a4baa['offset']===_0xa0e5('0x1a')&&typeof _0x9a4baa[_0xa0e5('0x1b')]==='undefined';var _0x323c9c=_0x58c077[_0xa0e5('0x1c')];var _0x29c923=_0x414d4c?0x0:_0x9a4baa[_0xa0e5('0x1d')];var _0x1680e9=_0x414d4c?_0x58c077[_0xa0e5('0x1c')]:_0x9a4baa[_0xa0e5('0x1d')]+_0x9a4baa[_0xa0e5('0x1b')];var _0x54bde6;if(_0x1680e9>=_0x323c9c){_0x1680e9=_0x323c9c;_0x54bde6=0xc8;}else{_0x54bde6=0xce;}_0x1814db[_0xa0e5('0x1e')](_0x54bde6);return _0x1814db['set'](_0xa0e5('0x1f'),_0x29c923+'-'+_0x1680e9+'/'+_0x323c9c)[_0xa0e5('0x19')](_0x58c077);}return null;};}function patchUpdates(_0x4d3906){return function(_0x504bc1){try{jsonpatch[_0xa0e5('0x20')](_0x504bc1,_0x4d3906,!![]);}catch(_0x2227cd){return BPromise[_0xa0e5('0x21')](_0x2227cd);}return _0x504bc1[_0xa0e5('0x22')]();};}function saveUpdates(_0xd71969,_0x35883a){return function(_0x5d8c87){if(_0x5d8c87){return _0x5d8c87[_0xa0e5('0x23')](_0xd71969)[_0xa0e5('0x24')](function(_0x3522f0){return _0x3522f0;});}return null;};}function removeEntity(_0x50f968,_0x2d9f05){return function(_0x3aa6c9){if(_0x3aa6c9){return _0x3aa6c9['destroy']()[_0xa0e5('0x24')](function(){var _0x582f19=_0x3aa6c9[_0xa0e5('0x25')]({'plain':!![]});var _0x2b5379=_0xa0e5('0x26');return db[_0xa0e5('0x27')][_0xa0e5('0x28')]({'where':{'type':_0x2b5379,'resourceId':_0x582f19['id']}})[_0xa0e5('0x24')](function(){return _0x3aa6c9;});})[_0xa0e5('0x24')](function(){_0x50f968[_0xa0e5('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x20eb14,_0x1da62d){return function(_0x1fec4c){if(!_0x1fec4c){_0x20eb14[_0xa0e5('0x17')](0x194);}return _0x1fec4c;};}function handleError(_0x5ab380,_0x1844b4){_0x1844b4=_0x1844b4||0x1f4;return function(_0xdac5da){logger[_0xa0e5('0x29')](_0xdac5da[_0xa0e5('0x2a')]);if(_0xdac5da[_0xa0e5('0x2b')]){delete _0xdac5da[_0xa0e5('0x2b')];}_0x5ab380['status'](_0x1844b4)[_0xa0e5('0x2c')](_0xdac5da);};}exports[_0xa0e5('0x2d')]=function(_0x19b0cf,_0x52cc03){var _0x20281e={},_0x548e4f={},_0x4d4b06={'count':0x0,'rows':[]};var _0x17d3cd=_[_0xa0e5('0x2e')](db[_0xa0e5('0x2f')]['rawAttributes'],function(_0x3ffd50){return{'name':_0x3ffd50[_0xa0e5('0x30')],'type':_0x3ffd50[_0xa0e5('0x31')]['key']};});_0x548e4f[_0xa0e5('0x32')]=_[_0xa0e5('0x2e')](_0x17d3cd,_0xa0e5('0x2b'));_0x548e4f[_0xa0e5('0x33')]=_[_0xa0e5('0x34')](_0x19b0cf['query']);_0x548e4f[_0xa0e5('0x35')]=_[_0xa0e5('0x36')](_0x548e4f[_0xa0e5('0x32')],_0x548e4f[_0xa0e5('0x33')]);_0x20281e[_0xa0e5('0x37')]=_[_0xa0e5('0x36')](_0x548e4f['model'],qs['fields'](_0x19b0cf[_0xa0e5('0x33')][_0xa0e5('0x38')]));_0x20281e[_0xa0e5('0x37')]=_0x20281e[_0xa0e5('0x37')][_0xa0e5('0x39')]?_0x20281e[_0xa0e5('0x37')]:_0x548e4f['model'];if(!_0x19b0cf['query'][_0xa0e5('0x3a')](_0xa0e5('0x3b'))){_0x20281e[_0xa0e5('0x1b')]=qs[_0xa0e5('0x1b')](_0x19b0cf['query'][_0xa0e5('0x1b')]);_0x20281e['offset']=qs[_0xa0e5('0x1d')](_0x19b0cf[_0xa0e5('0x33')][_0xa0e5('0x1d')]);}_0x20281e[_0xa0e5('0x3c')]=qs[_0xa0e5('0x3d')](_0x19b0cf[_0xa0e5('0x33')][_0xa0e5('0x3d')]);_0x20281e[_0xa0e5('0x3e')]=qs[_0xa0e5('0x35')](_[_0xa0e5('0x3f')](_0x19b0cf[_0xa0e5('0x33')],_0x548e4f['filters']),_0x17d3cd);if(_0x19b0cf[_0xa0e5('0x33')][_0xa0e5('0x40')]){_0x20281e[_0xa0e5('0x3e')]=_[_0xa0e5('0x41')](_0x20281e[_0xa0e5('0x3e')],{'$or':_[_0xa0e5('0x2e')](_0x17d3cd,function(_0x337bc5){if(_0x337bc5[_0xa0e5('0x31')]!==_0xa0e5('0x42')){var _0x3f9282={};_0x3f9282[_0x337bc5[_0xa0e5('0x2b')]]={'$like':'%'+_0x19b0cf['query'][_0xa0e5('0x40')]+'%'};return _0x3f9282;}})});}_0x20281e=_[_0xa0e5('0x41')]({},_0x20281e,_0x19b0cf[_0xa0e5('0x43')]);var _0x5325f8={'where':_0x20281e['where']};return db['JscriptyProject'][_0xa0e5('0x1c')](_0x5325f8)[_0xa0e5('0x24')](function(_0x588b9f){_0x4d4b06[_0xa0e5('0x1c')]=_0x588b9f;if(_0x19b0cf[_0xa0e5('0x33')][_0xa0e5('0x44')]){_0x20281e[_0xa0e5('0x45')]=[{'all':!![]}];}return db[_0xa0e5('0x2f')][_0xa0e5('0x46')](_0x20281e);})[_0xa0e5('0x24')](function(_0x5c9b2f){_0x4d4b06['rows']=_0x5c9b2f;return _0x4d4b06;})[_0xa0e5('0x24')](respondWithFilteredResult(_0x52cc03,_0x20281e))[_0xa0e5('0x47')](handleError(_0x52cc03,null));};exports[_0xa0e5('0x48')]=function(_0x57dcf0,_0xb42349){var _0x37ee88={'raw':![],'where':{'id':_0x57dcf0[_0xa0e5('0x49')]['id']}},_0x284854={};_0x284854[_0xa0e5('0x32')]=_[_0xa0e5('0x34')](db[_0xa0e5('0x2f')][_0xa0e5('0x4a')]);_0x284854[_0xa0e5('0x33')]=_[_0xa0e5('0x34')](_0x57dcf0['query']);_0x284854['filters']=_['intersection'](_0x284854[_0xa0e5('0x32')],_0x284854[_0xa0e5('0x33')]);_0x37ee88[_0xa0e5('0x37')]=_[_0xa0e5('0x36')](_0x284854[_0xa0e5('0x32')],qs[_0xa0e5('0x38')](_0x57dcf0[_0xa0e5('0x33')][_0xa0e5('0x38')]));_0x37ee88[_0xa0e5('0x37')]=_0x37ee88['attributes'][_0xa0e5('0x39')]?_0x37ee88['attributes']:_0x284854[_0xa0e5('0x32')];if(_0x57dcf0[_0xa0e5('0x33')][_0xa0e5('0x44')]){_0x37ee88[_0xa0e5('0x45')]=[{'all':!![]}];}_0x37ee88=_[_0xa0e5('0x41')]({},_0x37ee88,_0x57dcf0[_0xa0e5('0x43')]);return db[_0xa0e5('0x2f')][_0xa0e5('0x4b')](_0x37ee88)[_0xa0e5('0x24')](handleEntityNotFound(_0xb42349,null))['then'](respondWithResult(_0xb42349,null))[_0xa0e5('0x47')](handleError(_0xb42349,null));};exports[_0xa0e5('0x4c')]=function(_0xa111dd,_0x56445a){return db[_0xa0e5('0x2f')][_0xa0e5('0x4c')](_0xa111dd['body'],{})[_0xa0e5('0x24')](function(_0x4b0f20){var _0x179d11=_0xa111dd[_0xa0e5('0x4d')][_0xa0e5('0x25')]({'plain':!![]});if(!_0x179d11)throw new Error(_0xa0e5('0x4e'));if(_0x179d11[_0xa0e5('0x4f')]===_0xa0e5('0x4d')){var _0x2d70a8=_0x4b0f20['get']({'plain':!![]});var _0x27a88c='Projects';return db[_0xa0e5('0x50')][_0xa0e5('0x4b')]({'where':{'name':_0x27a88c,'userProfileId':_0x179d11[_0xa0e5('0x51')]},'raw':!![]})[_0xa0e5('0x24')](function(_0xa08e0b){if(_0xa08e0b&&_0xa08e0b['autoAssociation']===0x0){return db[_0xa0e5('0x27')][_0xa0e5('0x4c')]({'name':_0x2d70a8[_0xa0e5('0x2b')],'resourceId':_0x2d70a8['id'],'type':_0xa08e0b['name'],'sectionId':_0xa08e0b['id']},{})['then'](function(){return _0x4b0f20;});}else{return _0x4b0f20;}})[_0xa0e5('0x47')](function(_0x1ae63c){logger['error'](_0xa0e5('0x52'),_0x1ae63c);throw _0x1ae63c;});}return _0x4b0f20;})['then'](respondWithResult(_0x56445a,0xc9))[_0xa0e5('0x47')](handleError(_0x56445a,null));};exports['clone']=function(_0xeab35a,_0x5cd8c0){var _0x118764={'where':{'id':_0xeab35a['params']['id']}},_0x1c4c50={};_0x1c4c50[_0xa0e5('0x32')]=_[_0xa0e5('0x34')](db[_0xa0e5('0x2f')][_0xa0e5('0x4a')]);_0x118764['attributes']=_[_0xa0e5('0x36')](_0x1c4c50['model'],qs['fields'](_0xeab35a[_0xa0e5('0x33')][_0xa0e5('0x38')]));_0x118764[_0xa0e5('0x37')]=_0x118764['attributes'][_0xa0e5('0x39')]?_0x118764['attributes']:_0x1c4c50[_0xa0e5('0x32')];if(_0xeab35a[_0xa0e5('0x33')][_0xa0e5('0x44')]){_0x118764[_0xa0e5('0x45')]=[{'all':!![]}];}_0x118764=_[_0xa0e5('0x41')]({},_0x118764,_0xeab35a[_0xa0e5('0x43')]);return db[_0xa0e5('0x2f')][_0xa0e5('0x4b')](_0x118764)[_0xa0e5('0x24')](handleEntityNotFound(_0x5cd8c0,null))[_0xa0e5('0x24')](function(_0x4ea4ff){if(_0x4ea4ff){var _0x227488=_0x4ea4ff[_0xa0e5('0x25')]({'plain':!![]});_0x227488=qs[_0xa0e5('0x53')](_0x227488,['id',_0xa0e5('0x54'),_0xa0e5('0x55')]);_0xeab35a['body']=_[_0xa0e5('0x53')](_0xeab35a['body'],['id',_0xa0e5('0x54'),_0xa0e5('0x55')]);return db['JscriptyProject'][_0xa0e5('0x4c')](_[_0xa0e5('0x41')](_0x227488,_0xeab35a[_0xa0e5('0x56')]),{'include':_0xeab35a[_0xa0e5('0x33')]['includeAll']?[{'all':!![]}]:undefined})[_0xa0e5('0x24')](function(_0xceca01){var _0xf1175=_0xeab35a['user'][_0xa0e5('0x25')]({'plain':!![]});if(!_0xf1175)throw new Error(_0xa0e5('0x4e'));if(_0xf1175['role']===_0xa0e5('0x4d')){var _0x1369fe=_0xceca01[_0xa0e5('0x25')]({'plain':!![]});var _0x151f32='Projects';return db[_0xa0e5('0x50')]['find']({'where':{'name':_0x151f32,'userProfileId':_0xf1175[_0xa0e5('0x51')]},'raw':!![]})[_0xa0e5('0x24')](function(_0x1903d7){if(_0x1903d7&&_0x1903d7['autoAssociation']===0x0){return db[_0xa0e5('0x27')][_0xa0e5('0x4c')]({'name':_0x1369fe['name'],'resourceId':_0x1369fe['id'],'type':_0x1903d7[_0xa0e5('0x2b')],'sectionId':_0x1903d7['id']},{})['then'](function(){return _0xceca01;});}else{return _0xceca01;}})[_0xa0e5('0x47')](function(_0x4a9cac){logger[_0xa0e5('0x29')](_0xa0e5('0x52'),_0x4a9cac);throw _0x4a9cac;});}return _0xceca01;});}})[_0xa0e5('0x24')](respondWithResult(_0x5cd8c0,0xc9))[_0xa0e5('0x47')](handleError(_0x5cd8c0,null));};exports[_0xa0e5('0x23')]=function(_0x5b4593,_0x248b17){if(_0x5b4593['body']['id']){delete _0x5b4593[_0xa0e5('0x56')]['id'];}return db[_0xa0e5('0x2f')]['find']({'where':{'id':_0x5b4593[_0xa0e5('0x49')]['id']}})[_0xa0e5('0x24')](handleEntityNotFound(_0x248b17,null))[_0xa0e5('0x24')](saveUpdates(_0x5b4593['body'],null))[_0xa0e5('0x24')](respondWithResult(_0x248b17,null))['catch'](handleError(_0x248b17,null));};exports['destroy']=function(_0x22a1f7,_0x544476){return db[_0xa0e5('0x2f')][_0xa0e5('0x4b')]({'where':{'id':_0x22a1f7[_0xa0e5('0x49')]['id']}})[_0xa0e5('0x24')](handleEntityNotFound(_0x544476,null))[_0xa0e5('0x24')](removeEntity(_0x544476,null))[_0xa0e5('0x47')](handleError(_0x544476,null));};exports[_0xa0e5('0x57')]=function(_0x2d38af,_0x2d11cf,_0x4de82c){var _0x1ba72f={'raw':!![],'where':{}};var _0x907f20={};var _0x166fe9={'count':0x0,'rows':[]};return db[_0xa0e5('0x2f')]['findOne']({'where':{'id':_0x2d38af[_0xa0e5('0x49')]['id']}})[_0xa0e5('0x24')](handleEntityNotFound(_0x2d11cf,null))[_0xa0e5('0x24')](function(_0x542c6d){if(_0x542c6d){_0x907f20['model']=_[_0xa0e5('0x34')](db[_0xa0e5('0x58')][_0xa0e5('0x4a')]);_0x907f20[_0xa0e5('0x33')]=_['keys'](_0x2d38af[_0xa0e5('0x33')]);_0x907f20['filters']=_[_0xa0e5('0x36')](_0x907f20[_0xa0e5('0x32')],_0x907f20[_0xa0e5('0x33')]);_0x1ba72f['attributes']=_[_0xa0e5('0x36')](_0x907f20[_0xa0e5('0x32')],qs[_0xa0e5('0x38')](_0x2d38af[_0xa0e5('0x33')]['fields']));_0x1ba72f[_0xa0e5('0x37')]=_0x1ba72f[_0xa0e5('0x37')][_0xa0e5('0x39')]?_0x1ba72f[_0xa0e5('0x37')]:_0x907f20[_0xa0e5('0x32')];if(!_0x2d38af[_0xa0e5('0x33')][_0xa0e5('0x3a')](_0xa0e5('0x3b'))){_0x1ba72f[_0xa0e5('0x1b')]=qs[_0xa0e5('0x1b')](_0x2d38af[_0xa0e5('0x33')]['limit']);_0x1ba72f[_0xa0e5('0x1d')]=qs[_0xa0e5('0x1d')](_0x2d38af[_0xa0e5('0x33')][_0xa0e5('0x1d')]);}_0x1ba72f[_0xa0e5('0x3c')]=qs[_0xa0e5('0x3d')](_0x2d38af['query']['sort']);_0x1ba72f['where']=qs[_0xa0e5('0x35')](_[_0xa0e5('0x3f')](_0x2d38af['query'],_0x907f20[_0xa0e5('0x35')]));_0x1ba72f[_0xa0e5('0x3e')][_0xa0e5('0x59')]=_0x542c6d['id'];if(_0x2d38af[_0xa0e5('0x33')][_0xa0e5('0x40')]){_0x1ba72f[_0xa0e5('0x3e')]=_['merge'](_0x1ba72f[_0xa0e5('0x3e')],{'$or':_['map'](_0x1ba72f[_0xa0e5('0x37')],function(_0x16c471){var _0x3bbdf9={};_0x3bbdf9[_0x16c471]={'$like':'%'+_0x2d38af[_0xa0e5('0x33')][_0xa0e5('0x40')]+'%'};return _0x3bbdf9;})});}_0x1ba72f=_[_0xa0e5('0x41')]({},_0x1ba72f,_0x2d38af[_0xa0e5('0x43')]);return db[_0xa0e5('0x58')]['count']({'where':_0x1ba72f[_0xa0e5('0x3e')]})[_0xa0e5('0x24')](function(_0x137d9f){_0x166fe9[_0xa0e5('0x1c')]=_0x137d9f;if(_0x2d38af['query'][_0xa0e5('0x44')]){_0x1ba72f[_0xa0e5('0x45')]=[{'all':!![]}];}return db[_0xa0e5('0x58')][_0xa0e5('0x46')](_0x1ba72f);})[_0xa0e5('0x24')](function(_0x458f1a){_0x166fe9['rows']=_0x458f1a;return _0x166fe9;});}})[_0xa0e5('0x24')](respondWithFilteredResult(_0x2d11cf,_0x1ba72f))[_0xa0e5('0x47')](handleError(_0x2d11cf,null));};exports[_0xa0e5('0x5a')]=function(_0xf8d702,_0x5b78fc,_0x3786f0){var _0x21ed14={'raw':!![],'where':{}};var _0x1580ee={};var _0x488960={'count':0x0,'rows':[]};return db[_0xa0e5('0x2f')][_0xa0e5('0x5b')]({'where':{'id':_0xf8d702[_0xa0e5('0x49')]['id']}})[_0xa0e5('0x24')](handleEntityNotFound(_0x5b78fc,null))[_0xa0e5('0x24')](function(_0x48968b){if(_0x48968b){_0x1580ee[_0xa0e5('0x32')]=_[_0xa0e5('0x34')](db[_0xa0e5('0x5c')][_0xa0e5('0x4a')]);_0x1580ee[_0xa0e5('0x33')]=_[_0xa0e5('0x34')](_0xf8d702[_0xa0e5('0x33')]);_0x1580ee['filters']=_[_0xa0e5('0x36')](_0x1580ee[_0xa0e5('0x32')],_0x1580ee[_0xa0e5('0x33')]);_0x21ed14[_0xa0e5('0x37')]=_['intersection'](_0x1580ee[_0xa0e5('0x32')],qs[_0xa0e5('0x38')](_0xf8d702[_0xa0e5('0x33')][_0xa0e5('0x38')]));_0x21ed14[_0xa0e5('0x37')]=_0x21ed14[_0xa0e5('0x37')][_0xa0e5('0x39')]?_0x21ed14[_0xa0e5('0x37')]:_0x1580ee[_0xa0e5('0x32')];if(!_0xf8d702[_0xa0e5('0x33')][_0xa0e5('0x3a')](_0xa0e5('0x3b'))){_0x21ed14['limit']=qs[_0xa0e5('0x1b')](_0xf8d702['query'][_0xa0e5('0x1b')]);_0x21ed14[_0xa0e5('0x1d')]=qs[_0xa0e5('0x1d')](_0xf8d702[_0xa0e5('0x33')][_0xa0e5('0x1d')]);}_0x21ed14[_0xa0e5('0x3c')]=qs[_0xa0e5('0x3d')](_0xf8d702[_0xa0e5('0x33')]['sort']);_0x21ed14[_0xa0e5('0x3e')]=qs[_0xa0e5('0x35')](_[_0xa0e5('0x3f')](_0xf8d702[_0xa0e5('0x33')],_0x1580ee[_0xa0e5('0x35')]));_0x21ed14[_0xa0e5('0x3e')][_0xa0e5('0x59')]=_0x48968b['id'];if(_0xf8d702[_0xa0e5('0x33')]['filter']){_0x21ed14['where']=_[_0xa0e5('0x41')](_0x21ed14[_0xa0e5('0x3e')],{'$or':_[_0xa0e5('0x2e')](_0x21ed14['attributes'],function(_0x1f6070){var _0x49ab70={};_0x49ab70[_0x1f6070]={'$like':'%'+_0xf8d702[_0xa0e5('0x33')][_0xa0e5('0x40')]+'%'};return _0x49ab70;})});}_0x21ed14=_[_0xa0e5('0x41')]({},_0x21ed14,_0xf8d702[_0xa0e5('0x43')]);return db['JscriptyAnswerReport'][_0xa0e5('0x1c')]({'where':_0x21ed14[_0xa0e5('0x3e')]})[_0xa0e5('0x24')](function(_0x42a5be){_0x488960[_0xa0e5('0x1c')]=_0x42a5be;if(_0xf8d702['query']['includeAll']){_0x21ed14['include']=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0xa0e5('0x46')](_0x21ed14);})[_0xa0e5('0x24')](function(_0x50eedd){_0x488960[_0xa0e5('0x5d')]=_0x50eedd;return _0x488960;});}})[_0xa0e5('0x24')](respondWithFilteredResult(_0x5b78fc,_0x21ed14))[_0xa0e5('0x47')](handleError(_0x5b78fc,null));};function char(_0x4b7ba2){return _0xa0e5('0x5e')===typeof _0x4b7ba2?String[_0xa0e5('0x5f')][_0xa0e5('0x20')](null,arguments):_0x4b7ba2;}function needsEncapsulation(_0x51444c){return!!_0x51444c&&(_0x51444c[_0xa0e5('0x60')]()[_0xa0e5('0x61')](char(0xd))>=0x0||_0x51444c[_0xa0e5('0x60')]()[_0xa0e5('0x61')](char(0xa))>=0x0||_0x51444c[_0xa0e5('0x60')]()['indexOf'](char(0x2c))>=0x0||_0x51444c[_0xa0e5('0x60')]()['indexOf'](char(0x22))>=0x0);}function encapsulate(_0x2cd7a2){var _0x4cd241=char(0x22),_0x530240='\x5c'+char(0x22),_0x4ae15f=_0x2cd7a2['toString']()[_0xa0e5('0x62')](new RegExp(_0x4cd241,'g'),_0x530240);return _0x4cd241+_0x4ae15f+_0x4cd241;}exports[_0xa0e5('0x63')]=function(_0x8c249b,_0x5c8461,_0x3bd86e){var _0x441b13,_0x507c95;var _0x18bbd9={'where':{'ProjectId':_0x8c249b[_0xa0e5('0x49')]['id']}};if(_0x8c249b[_0xa0e5('0x33')][_0xa0e5('0x64')]){_0x18bbd9[_0xa0e5('0x3e')][_0xa0e5('0x65')]=JSON[_0xa0e5('0x66')](_0x8c249b['query'][_0xa0e5('0x64')]);}return db[_0xa0e5('0x58')]['findAll'](_0x18bbd9)['then'](handleEntityNotFound(_0x5c8461,null))['then'](function(_0x591cf3){if(_0x591cf3){_0x441b13=_0x591cf3;return db[_0xa0e5('0x67')][_0xa0e5('0x46')]({'where':{'SessionId':{'$in':_['map'](_0x441b13,'id')},'ProjectId':_0x8c249b[_0xa0e5('0x49')]['id']},'order':_0xa0e5('0x68')});}})[_0xa0e5('0x24')](handleEntityNotFound(_0x5c8461,null))[_0xa0e5('0x24')](function(_0x4f974c){if(_0x4f974c){_0x507c95=_0x4f974c;var _0x2ef28d={};for(var _0x4033ef=0x0,_0x37062e=_0x507c95[_0xa0e5('0x39')];_0x4033ef<_0x37062e;_0x4033ef++){if(!_0x2ef28d['hasOwnProperty'](_0x507c95[_0x4033ef][_0xa0e5('0x69')])){_0x2ef28d[_0x507c95[_0x4033ef][_0xa0e5('0x69')]]=needsEncapsulation(_0x507c95[_0x4033ef][_0xa0e5('0x6a')])?encapsulate(_0x507c95[_0x4033ef][_0xa0e5('0x6a')]):_0x507c95[_0x4033ef][_0xa0e5('0x6a')];}}var _0x214b5c=[],_0x1f88e4={};for(var _0x3c0058=0x0,_0x379662=_0x441b13[_0xa0e5('0x39')];_0x3c0058<_0x379662;_0x3c0058++){_0x1f88e4={'ProjectId':_0x8c249b[_0xa0e5('0x49')]['id'],'SessionId':_0x441b13[_0x3c0058]['id'],'StartTime':moment(_0x441b13[_0x3c0058][_0xa0e5('0x65')])[_0xa0e5('0x6b')](_0xa0e5('0x6c'))};for(var _0x521d7b=0x0,_0x1e86f=_0x507c95[_0xa0e5('0x39')];_0x521d7b<_0x1e86f;_0x521d7b++){if(_0x507c95[_0x521d7b][_0xa0e5('0x6d')]==_0x441b13[_0x3c0058]['id']&&_0x2ef28d[_0xa0e5('0x3a')](_0x507c95[_0x521d7b][_0xa0e5('0x69')])){_0x1f88e4[_0x2ef28d[_0x507c95[_0x521d7b][_0xa0e5('0x69')]]]=_0x507c95[_0x521d7b][_0xa0e5('0x6e')];}}for(var _0x46786c in _0x2ef28d){if(!_0x1f88e4['hasOwnProperty'](_0x2ef28d[_0x46786c])){_0x1f88e4[_0x2ef28d[_0x46786c]]=null;}}_0x214b5c[_0xa0e5('0x6f')](_0x1f88e4);}return _0x214b5c;}})['then'](function(_0x848ef7){if(!_[_0xa0e5('0x70')](_0x848ef7)){var _0x4c5851=toCsv(_0x848ef7);var _0x4d0be7=Date[_0xa0e5('0x71')]();fs[_0xa0e5('0x72')](util[_0xa0e5('0x6b')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x8c249b[_0xa0e5('0x49')]['id'],_0x4d0be7),_0x4c5851);_0x5c8461[_0xa0e5('0x73')](_0xa0e5('0x74'),_0xa0e5('0x75')+util[_0xa0e5('0x6b')](_0xa0e5('0x76'),_0x8c249b[_0xa0e5('0x49')]['id'],_0x4d0be7));_0x5c8461[_0xa0e5('0x73')]('Content-type',_0xa0e5('0x77'));return _0x5c8461['download'](util[_0xa0e5('0x6b')](_0xa0e5('0x78'),_0x8c249b[_0xa0e5('0x49')]['id'],_0x4d0be7));}else{return _0x5c8461[_0xa0e5('0x17')](0xcc);}})[_0xa0e5('0x47')](handleError(_0x5c8461,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index 89a52cc..7f258b6 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 _0xe647=['./jscriptyProject.attributes','exports','define','JscriptyProject','jscripty_projects','lodash','util','api','moment','bluebird','rimraf','../../config/environment'];(function(_0x17d540,_0x153164){var _0x291612=function(_0xea9308){while(--_0xea9308){_0x17d540['push'](_0x17d540['shift']());}};_0x291612(++_0x153164);}(_0xe647,0x16d));var _0x7e64=function(_0x3fc5e0,_0x1cc8dd){_0x3fc5e0=_0x3fc5e0-0x0;var _0x4577b6=_0xe647[_0x3fc5e0];return _0x4577b6;};'use strict';var _=require(_0x7e64('0x0'));var util=require(_0x7e64('0x1'));var logger=require('../../config/logger')(_0x7e64('0x2'));var moment=require(_0x7e64('0x3'));var BPromise=require(_0x7e64('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x7e64('0x5'));var config=require(_0x7e64('0x6'));var attributes=require(_0x7e64('0x7'));module[_0x7e64('0x8')]=function(_0x221235,_0x552ed3){return _0x221235[_0x7e64('0x9')](_0x7e64('0xa'),attributes,{'tableName':_0x7e64('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8c52=['path','rimraf','../../config/environment','./jscriptyProject.attributes','exports','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x39bc44,_0x1d4373){var _0x2916d8=function(_0x1767ac){while(--_0x1767ac){_0x39bc44['push'](_0x39bc44['shift']());}};_0x2916d8(++_0x1d4373);}(_0x8c52,0x7e));var _0x28c5=function(_0x2f133c,_0x2d0ee7){_0x2f133c=_0x2f133c-0x0;var _0x17fe82=_0x8c52[_0x2f133c];return _0x17fe82;};'use strict';var _=require(_0x28c5('0x0'));var util=require('util');var logger=require(_0x28c5('0x1'))(_0x28c5('0x2'));var moment=require(_0x28c5('0x3'));var BPromise=require(_0x28c5('0x4'));var rp=require(_0x28c5('0x5'));var fs=require('fs');var path=require(_0x28c5('0x6'));var rimraf=require(_0x28c5('0x7'));var config=require(_0x28c5('0x8'));var attributes=require(_0x28c5('0x9'));module[_0x28c5('0xa')]=function(_0x209f3d,_0x3b5c38){return _0x209f3d['define']('JscriptyProject',attributes,{'tableName':'jscripty_projects','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 df8df6f..05fc3d6 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 _0xa9e0=['http','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\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(_0x568ce8,_0x375dcd){var _0x31b66f=function(_0x3def8b){while(--_0x3def8b){_0x568ce8['push'](_0x568ce8['shift']());}};_0x31b66f(++_0x375dcd);}(_0xa9e0,0x123));var _0x0a9e=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xa9e0[_0x19e35c];return _0x3e1fe8;};'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 _0x9bde=['code','message','JscriptyProject,\x20%s,\x20%s','result','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','request\x20sent','error'];(function(_0x4ee41f,_0x8d4c0f){var _0x2d9c92=function(_0x400f7c){while(--_0x400f7c){_0x4ee41f['push'](_0x4ee41f['shift']());}};_0x2d9c92(++_0x8d4c0f);}(_0x9bde,0xe1));var _0xe9bd=function(_0x63b88b,_0x11bc18){_0x63b88b=_0x63b88b-0x0;var _0x2475fd=_0x9bde[_0x63b88b];return _0x2475fd;};'use strict';var _=require('lodash');var util=require(_0xe9bd('0x0'));var moment=require('moment');var BPromise=require(_0xe9bd('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe9bd('0x2'));var db=require(_0xe9bd('0x3'))['db'];var utils=require(_0xe9bd('0x4'));var logger=require(_0xe9bd('0x5'))(_0xe9bd('0x6'));var config=require(_0xe9bd('0x7'));var jayson=require(_0xe9bd('0x8'));var client=jayson['client'][_0xe9bd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5f18fe,_0x22a438,_0xa66ae2){return new BPromise(function(_0x2d5c75,_0x3ef9e3){return client[_0xe9bd('0xa')](_0x5f18fe,_0xa66ae2)[_0xe9bd('0xb')](function(_0x439abc){logger[_0xe9bd('0xc')]('JscriptyProject,\x20%s,\x20%s',_0x22a438,'request\x20sent');logger[_0xe9bd('0xd')](_0xe9bd('0xe'),_0x22a438,_0xe9bd('0xf'),JSON['stringify'](_0x439abc));if(_0x439abc[_0xe9bd('0x10')]){if(_0x439abc[_0xe9bd('0x10')][_0xe9bd('0x11')]===0x1f4){logger[_0xe9bd('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x22a438,_0x439abc[_0xe9bd('0x10')]['message']);return _0x3ef9e3(_0x439abc[_0xe9bd('0x10')][_0xe9bd('0x12')]);}logger[_0xe9bd('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x22a438,_0x439abc['error'][_0xe9bd('0x12')]);return _0x2d5c75(_0x439abc[_0xe9bd('0x10')][_0xe9bd('0x12')]);}else{logger[_0xe9bd('0xc')](_0xe9bd('0x13'),_0x22a438,_0xe9bd('0xf'));_0x2d5c75(_0x439abc[_0xe9bd('0x14')]['message']);}})[_0xe9bd('0x15')](function(_0x464a1b){logger[_0xe9bd('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x22a438,_0x464a1b);_0x3ef9e3(_0x464a1b);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index d82a013..793ac48 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 _0xec11=['/:id','show','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../config/environment','./jscriptyQuestionReport.controller','isAuthenticated','/describe','describe','get'];(function(_0x701ad0,_0x406c52){var _0x2264a6=function(_0x19dd80){while(--_0x19dd80){_0x701ad0['push'](_0x701ad0['shift']());}};_0x2264a6(++_0x406c52);}(_0xec11,0xd8));var _0x1ec1=function(_0x1c2c55,_0x1e2dbe){_0x1c2c55=_0x1c2c55-0x0;var _0x28aebf=_0xec11[_0x1c2c55];return _0x28aebf;};'use strict';var multer=require(_0x1ec1('0x0'));var util=require(_0x1ec1('0x1'));var path=require(_0x1ec1('0x2'));var timeout=require(_0x1ec1('0x3'));var express=require(_0x1ec1('0x4'));var router=express['Router']();var fs_extra=require(_0x1ec1('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x1ec1('0x6'));var controller=require(_0x1ec1('0x7'));router['get']('/',auth[_0x1ec1('0x8')](),controller['index']);router['get'](_0x1ec1('0x9'),auth['isAuthenticated'](),controller[_0x1ec1('0xa')]);router[_0x1ec1('0xb')](_0x1ec1('0xc'),auth['isAuthenticated'](),controller[_0x1ec1('0xd')]);router['post']('/',auth[_0x1ec1('0x8')](),controller[_0x1ec1('0xe')]);router[_0x1ec1('0xf')](_0x1ec1('0xc'),auth[_0x1ec1('0x8')](),controller[_0x1ec1('0x10')]);router['delete'](_0x1ec1('0xc'),auth[_0x1ec1('0x8')](),controller[_0x1ec1('0x11')]);module[_0x1ec1('0x12')]=router; \ No newline at end of file +var _0x1191=['path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','create','put','delete','destroy','exports','multer','util'];(function(_0x383864,_0xa47803){var _0x271a7a=function(_0x470b7e){while(--_0x470b7e){_0x383864['push'](_0x383864['shift']());}};_0x271a7a(++_0xa47803);}(_0x1191,0x70));var _0x1119=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x1191[_0x3b380d];return _0x54502b;};'use strict';var multer=require(_0x1119('0x0'));var util=require(_0x1119('0x1'));var path=require(_0x1119('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x1119('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1119('0x4'));var interaction=require(_0x1119('0x5'));var config=require(_0x1119('0x6'));var controller=require('./jscriptyQuestionReport.controller');router[_0x1119('0x7')]('/',auth[_0x1119('0x8')](),controller[_0x1119('0x9')]);router['get'](_0x1119('0xa'),auth['isAuthenticated'](),controller[_0x1119('0xb')]);router['get'](_0x1119('0xc'),auth['isAuthenticated'](),controller[_0x1119('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x1119('0xe')]);router[_0x1119('0xf')](_0x1119('0xc'),auth[_0x1119('0x8')](),controller['update']);router[_0x1119('0x10')](_0x1119('0xc'),auth[_0x1119('0x8')](),controller[_0x1119('0x11')]);module[_0x1119('0x12')]=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index 377fe77..89453d0 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(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x7a54,0x106));var _0x47a5=function(_0xfd5957,_0x27ecc8){_0xfd5957=_0xfd5957-0x0;var _0x551e52=_0x7a54[_0xfd5957];return _0x551e52;};'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(_0x4f9b18,_0x2cb5ca){var _0x29f20c=function(_0x268b3d){while(--_0x268b3d){_0x4f9b18['push'](_0x4f9b18['shift']());}};_0x29f20c(++_0x2cb5ca);}(_0x7a54,0x106));var _0x47a5=function(_0x3dd33b,_0x5a041f){_0x3dd33b=_0x3dd33b-0x0;var _0x39dc79=_0x7a54[_0x3dd33b];return _0x39dc79;};'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 f33f27a..8117ec1 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 _0x3ea5=['crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','map','JscriptyQuestionReport','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','show','params','create','body','catch','find','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash'];(function(_0x2cedbe,_0x323510){var _0x1176b7=function(_0x4c389a){while(--_0x4c389a){_0x2cedbe['push'](_0x2cedbe['shift']());}};_0x1176b7(++_0x323510);}(_0x3ea5,0x1f2));var _0x53ea=function(_0x5af0ae,_0x162634){_0x5af0ae=_0x5af0ae-0x0;var _0x1a5083=_0x3ea5[_0x5af0ae];return _0x1a5083;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x53ea('0x0'));var jsonpatch=require(_0x53ea('0x1'));var rp=require(_0x53ea('0x2'));var moment=require(_0x53ea('0x3'));var BPromise=require(_0x53ea('0x4'));var Mustache=require(_0x53ea('0x5'));var util=require(_0x53ea('0x6'));var path=require(_0x53ea('0x7'));var sox=require(_0x53ea('0x8'));var csv=require(_0x53ea('0x9'));var ejs=require(_0x53ea('0xa'));var fs=require('fs');var fs_extra=require(_0x53ea('0xb'));var _=require(_0x53ea('0xc'));var squel=require('squel');var crypto=require(_0x53ea('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x53ea('0xe'));var toCsv=require(_0x53ea('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x53ea('0xf'));var authService=require(_0x53ea('0x10'));var qs=require(_0x53ea('0x11'));var as=require(_0x53ea('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x53ea('0x13'))(_0x53ea('0x14'));var utils=require('../../config/utils');var config=require(_0x53ea('0x15'));var licenseUtil=require(_0x53ea('0x16'));var db=require(_0x53ea('0x17'))['db'];function respondWithStatusCode(_0x7e7804,_0x15fb2f){_0x15fb2f=_0x15fb2f||0xcc;return function(_0x37e821){if(_0x37e821){return _0x7e7804[_0x53ea('0x18')](_0x15fb2f);}return _0x7e7804['status'](_0x15fb2f)['end']();};}function respondWithResult(_0x267771,_0x1f1972){_0x1f1972=_0x1f1972||0xc8;return function(_0x1d8948){if(_0x1d8948){return _0x267771[_0x53ea('0x19')](_0x1f1972)[_0x53ea('0x1a')](_0x1d8948);}};}function respondWithFilteredResult(_0x2e9068,_0x4ba0f0){return function(_0x46d525){if(_0x46d525){var _0x19469b=typeof _0x4ba0f0['offset']===_0x53ea('0x1b')&&typeof _0x4ba0f0[_0x53ea('0x1c')]===_0x53ea('0x1b');var _0x14272d=_0x46d525[_0x53ea('0x1d')];var _0x435879=_0x19469b?0x0:_0x4ba0f0[_0x53ea('0x1e')];var _0x3d873=_0x19469b?_0x46d525[_0x53ea('0x1d')]:_0x4ba0f0[_0x53ea('0x1e')]+_0x4ba0f0[_0x53ea('0x1c')];var _0x86f7a5;if(_0x3d873>=_0x14272d){_0x3d873=_0x14272d;_0x86f7a5=0xc8;}else{_0x86f7a5=0xce;}_0x2e9068[_0x53ea('0x19')](_0x86f7a5);return _0x2e9068[_0x53ea('0x1f')](_0x53ea('0x20'),_0x435879+'-'+_0x3d873+'/'+_0x14272d)[_0x53ea('0x1a')](_0x46d525);}return null;};}function patchUpdates(_0x39cfc8){return function(_0x40778a){try{jsonpatch[_0x53ea('0x21')](_0x40778a,_0x39cfc8,!![]);}catch(_0x2ed1f1){return BPromise[_0x53ea('0x22')](_0x2ed1f1);}return _0x40778a[_0x53ea('0x23')]();};}function saveUpdates(_0x297b8d,_0x8fcf6d){return function(_0x121759){if(_0x121759){return _0x121759[_0x53ea('0x24')](_0x297b8d)[_0x53ea('0x25')](function(_0x4c7a2d){return _0x4c7a2d;});}return null;};}function removeEntity(_0x293e45,_0x3cd94a){return function(_0x54532f){if(_0x54532f){return _0x54532f[_0x53ea('0x26')]()[_0x53ea('0x25')](function(){_0x293e45[_0x53ea('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3185c3,_0x576e1f){return function(_0x5778f6){if(!_0x5778f6){_0x3185c3[_0x53ea('0x18')](0x194);}return _0x5778f6;};}function handleError(_0x541b01,_0xccad63){_0xccad63=_0xccad63||0x1f4;return function(_0x129918){logger[_0x53ea('0x27')](_0x129918[_0x53ea('0x28')]);if(_0x129918[_0x53ea('0x29')]){delete _0x129918[_0x53ea('0x29')];}_0x541b01[_0x53ea('0x19')](_0xccad63)['send'](_0x129918);};}exports[_0x53ea('0x2a')]=function(_0x2cb9e4,_0x2df16a){var _0xd14045={},_0x562f77={},_0x15f129={'count':0x0,'rows':[]};var _0x2e3831=_[_0x53ea('0x2b')](db[_0x53ea('0x2c')]['rawAttributes'],function(_0x48ac69){return{'name':_0x48ac69[_0x53ea('0x2d')],'type':_0x48ac69[_0x53ea('0x2e')][_0x53ea('0x2f')]};});_0x562f77[_0x53ea('0x30')]=_['map'](_0x2e3831,_0x53ea('0x29'));_0x562f77[_0x53ea('0x31')]=_[_0x53ea('0x32')](_0x2cb9e4[_0x53ea('0x31')]);_0x562f77[_0x53ea('0x33')]=_['intersection'](_0x562f77['model'],_0x562f77[_0x53ea('0x31')]);_0xd14045[_0x53ea('0x34')]=_[_0x53ea('0x35')](_0x562f77[_0x53ea('0x30')],qs[_0x53ea('0x36')](_0x2cb9e4['query'][_0x53ea('0x36')]));_0xd14045[_0x53ea('0x34')]=_0xd14045['attributes'][_0x53ea('0x37')]?_0xd14045[_0x53ea('0x34')]:_0x562f77['model'];if(!_0x2cb9e4[_0x53ea('0x31')][_0x53ea('0x38')]('nolimit')){_0xd14045[_0x53ea('0x1c')]=qs[_0x53ea('0x1c')](_0x2cb9e4[_0x53ea('0x31')]['limit']);_0xd14045[_0x53ea('0x1e')]=qs[_0x53ea('0x1e')](_0x2cb9e4[_0x53ea('0x31')][_0x53ea('0x1e')]);}_0xd14045[_0x53ea('0x39')]=qs[_0x53ea('0x3a')](_0x2cb9e4[_0x53ea('0x31')]['sort']);_0xd14045['where']=qs[_0x53ea('0x33')](_['pick'](_0x2cb9e4['query'],_0x562f77['filters']),_0x2e3831);if(_0x2cb9e4[_0x53ea('0x31')]['filter']){_0xd14045[_0x53ea('0x3b')]=_[_0x53ea('0x3c')](_0xd14045[_0x53ea('0x3b')],{'$or':_['map'](_0x2e3831,function(_0x458c82){if(_0x458c82[_0x53ea('0x2e')]!==_0x53ea('0x3d')){var _0x1ecd1e={};_0x1ecd1e[_0x458c82['name']]={'$like':'%'+_0x2cb9e4['query'][_0x53ea('0x3e')]+'%'};return _0x1ecd1e;}})});}_0xd14045=_[_0x53ea('0x3c')]({},_0xd14045,_0x2cb9e4[_0x53ea('0x3f')]);var _0x4a26ed={'where':_0xd14045[_0x53ea('0x3b')]};return db[_0x53ea('0x2c')][_0x53ea('0x1d')](_0x4a26ed)[_0x53ea('0x25')](function(_0x22843f){_0x15f129['count']=_0x22843f;if(_0x2cb9e4[_0x53ea('0x31')][_0x53ea('0x40')]){_0xd14045[_0x53ea('0x41')]=[{'all':!![]}];}return db[_0x53ea('0x2c')]['findAll'](_0xd14045);})['then'](function(_0x257715){_0x15f129['rows']=_0x257715;return _0x15f129;})[_0x53ea('0x25')](respondWithFilteredResult(_0x2df16a,_0xd14045))['catch'](handleError(_0x2df16a,null));};exports[_0x53ea('0x42')]=function(_0x2cacb2,_0x366eef){var _0x321b6b={'raw':!![],'where':{'id':_0x2cacb2[_0x53ea('0x43')]['id']}},_0x112959={};_0x112959[_0x53ea('0x30')]=_[_0x53ea('0x32')](db['JscriptyQuestionReport']['rawAttributes']);_0x112959[_0x53ea('0x31')]=_['keys'](_0x2cacb2[_0x53ea('0x31')]);_0x112959['filters']=_['intersection'](_0x112959[_0x53ea('0x30')],_0x112959['query']);_0x321b6b['attributes']=_['intersection'](_0x112959[_0x53ea('0x30')],qs['fields'](_0x2cacb2['query'][_0x53ea('0x36')]));_0x321b6b[_0x53ea('0x34')]=_0x321b6b[_0x53ea('0x34')][_0x53ea('0x37')]?_0x321b6b[_0x53ea('0x34')]:_0x112959[_0x53ea('0x30')];if(_0x2cacb2['query'][_0x53ea('0x40')]){_0x321b6b['include']=[{'all':!![]}];}_0x321b6b=_[_0x53ea('0x3c')]({},_0x321b6b,_0x2cacb2[_0x53ea('0x3f')]);return db['JscriptyQuestionReport']['find'](_0x321b6b)[_0x53ea('0x25')](handleEntityNotFound(_0x366eef,null))[_0x53ea('0x25')](respondWithResult(_0x366eef,null))['catch'](handleError(_0x366eef,null));};exports[_0x53ea('0x44')]=function(_0x1e4334,_0x33011b){return db[_0x53ea('0x2c')][_0x53ea('0x44')](_0x1e4334[_0x53ea('0x45')],{})[_0x53ea('0x25')](respondWithResult(_0x33011b,0xc9))[_0x53ea('0x46')](handleError(_0x33011b,null));};exports[_0x53ea('0x24')]=function(_0x146d53,_0x3f6557){if(_0x146d53[_0x53ea('0x45')]['id']){delete _0x146d53['body']['id'];}return db[_0x53ea('0x2c')]['find']({'where':{'id':_0x146d53[_0x53ea('0x43')]['id']}})['then'](handleEntityNotFound(_0x3f6557,null))['then'](saveUpdates(_0x146d53[_0x53ea('0x45')],null))[_0x53ea('0x25')](respondWithResult(_0x3f6557,null))[_0x53ea('0x46')](handleError(_0x3f6557,null));};exports[_0x53ea('0x26')]=function(_0x4692f6,_0x4bec37){return db[_0x53ea('0x2c')][_0x53ea('0x47')]({'where':{'id':_0x4692f6[_0x53ea('0x43')]['id']}})[_0x53ea('0x25')](handleEntityNotFound(_0x4bec37,null))[_0x53ea('0x25')](removeEntity(_0x4bec37,null))['catch'](handleError(_0x4bec37,null));};exports['describe']=function(_0x1eb9b7,_0xc6913d){return db[_0x53ea('0x2c')][_0x53ea('0x48')]()[_0x53ea('0x25')](respondWithResult(_0xc6913d,null))[_0x53ea('0x46')](handleError(_0xc6913d,null));}; \ No newline at end of file +var _0xe84c=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','count','limit','set','Content-Range','apply','save','update','destroy','then','sendStatus','error','stack','name','send','index','JscriptyQuestionReport','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','options','includeAll','include','findAll','catch','params','create','body','find','describe','eml-format','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','squel','jsforce','querystring','papaparse'];(function(_0x29ac10,_0xdc966e){var _0x59548a=function(_0x2bacd6){while(--_0x2bacd6){_0x29ac10['push'](_0x29ac10['shift']());}};_0x59548a(++_0xdc966e);}(_0xe84c,0x15f));var _0xce84=function(_0xe7c79c,_0x158b85){_0xe7c79c=_0xe7c79c-0x0;var _0x173572=_0xe84c[_0xe7c79c];return _0x173572;};'use strict';var emlformat=require(_0xce84('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xce84('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xce84('0x2'));var moment=require('moment');var BPromise=require(_0xce84('0x3'));var Mustache=require(_0xce84('0x4'));var util=require(_0xce84('0x5'));var path=require(_0xce84('0x6'));var sox=require(_0xce84('0x7'));var csv=require(_0xce84('0x8'));var ejs=require(_0xce84('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xce84('0xa'));var crypto=require('crypto');var jsforce=require(_0xce84('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xce84('0x8'));var querystring=require(_0xce84('0xc'));var Papa=require(_0xce84('0xd'));var Redis=require(_0xce84('0xe'));var authService=require(_0xce84('0xf'));var qs=require(_0xce84('0x10'));var as=require(_0xce84('0x11'));var hardwareService=require(_0xce84('0x12'));var logger=require(_0xce84('0x13'))(_0xce84('0x14'));var utils=require(_0xce84('0x15'));var config=require(_0xce84('0x16'));var licenseUtil=require(_0xce84('0x17'));var db=require(_0xce84('0x18'))['db'];function respondWithStatusCode(_0x2b36c3,_0x1c8974){_0x1c8974=_0x1c8974||0xcc;return function(_0x4ba090){if(_0x4ba090){return _0x2b36c3['sendStatus'](_0x1c8974);}return _0x2b36c3[_0xce84('0x19')](_0x1c8974)[_0xce84('0x1a')]();};}function respondWithResult(_0x247ea7,_0xa235b2){_0xa235b2=_0xa235b2||0xc8;return function(_0x12470c){if(_0x12470c){return _0x247ea7[_0xce84('0x19')](_0xa235b2)['json'](_0x12470c);}};}function respondWithFilteredResult(_0x1da22b,_0x280ba6){return function(_0x28866a){if(_0x28866a){var _0x53f556=typeof _0x280ba6[_0xce84('0x1b')]===_0xce84('0x1c')&&typeof _0x280ba6['limit']===_0xce84('0x1c');var _0x27b0e1=_0x28866a[_0xce84('0x1d')];var _0x49f094=_0x53f556?0x0:_0x280ba6[_0xce84('0x1b')];var _0x4a97a5=_0x53f556?_0x28866a[_0xce84('0x1d')]:_0x280ba6[_0xce84('0x1b')]+_0x280ba6[_0xce84('0x1e')];var _0x36197a;if(_0x4a97a5>=_0x27b0e1){_0x4a97a5=_0x27b0e1;_0x36197a=0xc8;}else{_0x36197a=0xce;}_0x1da22b[_0xce84('0x19')](_0x36197a);return _0x1da22b[_0xce84('0x1f')](_0xce84('0x20'),_0x49f094+'-'+_0x4a97a5+'/'+_0x27b0e1)['json'](_0x28866a);}return null;};}function patchUpdates(_0x38ace1){return function(_0xa31785){try{jsonpatch[_0xce84('0x21')](_0xa31785,_0x38ace1,!![]);}catch(_0x4426bb){return BPromise['reject'](_0x4426bb);}return _0xa31785[_0xce84('0x22')]();};}function saveUpdates(_0x40fd34,_0x5eb2f8){return function(_0x467e25){if(_0x467e25){return _0x467e25[_0xce84('0x23')](_0x40fd34)['then'](function(_0x4890b0){return _0x4890b0;});}return null;};}function removeEntity(_0x4e7475,_0x230fcf){return function(_0x165f4a){if(_0x165f4a){return _0x165f4a[_0xce84('0x24')]()[_0xce84('0x25')](function(){_0x4e7475[_0xce84('0x19')](0xcc)[_0xce84('0x1a')]();});}};}function handleEntityNotFound(_0x49317d,_0x2ac7fb){return function(_0x26cd0a){if(!_0x26cd0a){_0x49317d[_0xce84('0x26')](0x194);}return _0x26cd0a;};}function handleError(_0x409040,_0x40c2a2){_0x40c2a2=_0x40c2a2||0x1f4;return function(_0xbb114c){logger[_0xce84('0x27')](_0xbb114c[_0xce84('0x28')]);if(_0xbb114c['name']){delete _0xbb114c[_0xce84('0x29')];}_0x409040['status'](_0x40c2a2)[_0xce84('0x2a')](_0xbb114c);};}exports[_0xce84('0x2b')]=function(_0x3f19bc,_0x4b442a){var _0x44b7e6={},_0x1f6977={},_0x1460af={'count':0x0,'rows':[]};var _0x247ef7=_['map'](db[_0xce84('0x2c')]['rawAttributes'],function(_0x3ad4ac){return{'name':_0x3ad4ac[_0xce84('0x2d')],'type':_0x3ad4ac[_0xce84('0x2e')]['key']};});_0x1f6977[_0xce84('0x2f')]=_['map'](_0x247ef7,_0xce84('0x29'));_0x1f6977[_0xce84('0x30')]=_[_0xce84('0x31')](_0x3f19bc[_0xce84('0x30')]);_0x1f6977[_0xce84('0x32')]=_[_0xce84('0x33')](_0x1f6977[_0xce84('0x2f')],_0x1f6977[_0xce84('0x30')]);_0x44b7e6[_0xce84('0x34')]=_['intersection'](_0x1f6977['model'],qs[_0xce84('0x35')](_0x3f19bc[_0xce84('0x30')][_0xce84('0x35')]));_0x44b7e6[_0xce84('0x34')]=_0x44b7e6['attributes'][_0xce84('0x36')]?_0x44b7e6[_0xce84('0x34')]:_0x1f6977[_0xce84('0x2f')];if(!_0x3f19bc[_0xce84('0x30')][_0xce84('0x37')](_0xce84('0x38'))){_0x44b7e6[_0xce84('0x1e')]=qs[_0xce84('0x1e')](_0x3f19bc[_0xce84('0x30')]['limit']);_0x44b7e6['offset']=qs[_0xce84('0x1b')](_0x3f19bc[_0xce84('0x30')][_0xce84('0x1b')]);}_0x44b7e6[_0xce84('0x39')]=qs[_0xce84('0x3a')](_0x3f19bc[_0xce84('0x30')][_0xce84('0x3a')]);_0x44b7e6['where']=qs[_0xce84('0x32')](_[_0xce84('0x3b')](_0x3f19bc[_0xce84('0x30')],_0x1f6977[_0xce84('0x32')]),_0x247ef7);if(_0x3f19bc[_0xce84('0x30')][_0xce84('0x3c')]){_0x44b7e6['where']=_[_0xce84('0x3d')](_0x44b7e6[_0xce84('0x3e')],{'$or':_['map'](_0x247ef7,function(_0x19923a){if(_0x19923a[_0xce84('0x2e')]!=='VIRTUAL'){var _0x1fe01f={};_0x1fe01f[_0x19923a[_0xce84('0x29')]]={'$like':'%'+_0x3f19bc[_0xce84('0x30')]['filter']+'%'};return _0x1fe01f;}})});}_0x44b7e6=_['merge']({},_0x44b7e6,_0x3f19bc[_0xce84('0x3f')]);var _0x417f60={'where':_0x44b7e6['where']};return db[_0xce84('0x2c')]['count'](_0x417f60)['then'](function(_0x996d2c){_0x1460af[_0xce84('0x1d')]=_0x996d2c;if(_0x3f19bc[_0xce84('0x30')][_0xce84('0x40')]){_0x44b7e6[_0xce84('0x41')]=[{'all':!![]}];}return db[_0xce84('0x2c')][_0xce84('0x42')](_0x44b7e6);})[_0xce84('0x25')](function(_0x3e5f24){_0x1460af['rows']=_0x3e5f24;return _0x1460af;})[_0xce84('0x25')](respondWithFilteredResult(_0x4b442a,_0x44b7e6))[_0xce84('0x43')](handleError(_0x4b442a,null));};exports['show']=function(_0x4d80e8,_0x282b66){var _0x1f3f3f={'raw':!![],'where':{'id':_0x4d80e8[_0xce84('0x44')]['id']}},_0x2f19c7={};_0x2f19c7['model']=_[_0xce84('0x31')](db[_0xce84('0x2c')]['rawAttributes']);_0x2f19c7[_0xce84('0x30')]=_[_0xce84('0x31')](_0x4d80e8[_0xce84('0x30')]);_0x2f19c7['filters']=_['intersection'](_0x2f19c7[_0xce84('0x2f')],_0x2f19c7[_0xce84('0x30')]);_0x1f3f3f[_0xce84('0x34')]=_['intersection'](_0x2f19c7[_0xce84('0x2f')],qs[_0xce84('0x35')](_0x4d80e8[_0xce84('0x30')][_0xce84('0x35')]));_0x1f3f3f[_0xce84('0x34')]=_0x1f3f3f['attributes'][_0xce84('0x36')]?_0x1f3f3f[_0xce84('0x34')]:_0x2f19c7['model'];if(_0x4d80e8[_0xce84('0x30')][_0xce84('0x40')]){_0x1f3f3f[_0xce84('0x41')]=[{'all':!![]}];}_0x1f3f3f=_[_0xce84('0x3d')]({},_0x1f3f3f,_0x4d80e8[_0xce84('0x3f')]);return db['JscriptyQuestionReport']['find'](_0x1f3f3f)[_0xce84('0x25')](handleEntityNotFound(_0x282b66,null))[_0xce84('0x25')](respondWithResult(_0x282b66,null))[_0xce84('0x43')](handleError(_0x282b66,null));};exports[_0xce84('0x45')]=function(_0xee1572,_0x5aaf99){return db[_0xce84('0x2c')][_0xce84('0x45')](_0xee1572[_0xce84('0x46')],{})[_0xce84('0x25')](respondWithResult(_0x5aaf99,0xc9))[_0xce84('0x43')](handleError(_0x5aaf99,null));};exports['update']=function(_0x43b7e8,_0x4d0841){if(_0x43b7e8['body']['id']){delete _0x43b7e8['body']['id'];}return db[_0xce84('0x2c')][_0xce84('0x47')]({'where':{'id':_0x43b7e8[_0xce84('0x44')]['id']}})[_0xce84('0x25')](handleEntityNotFound(_0x4d0841,null))[_0xce84('0x25')](saveUpdates(_0x43b7e8[_0xce84('0x46')],null))['then'](respondWithResult(_0x4d0841,null))[_0xce84('0x43')](handleError(_0x4d0841,null));};exports[_0xce84('0x24')]=function(_0x35adbc,_0x1b5265){return db[_0xce84('0x2c')][_0xce84('0x47')]({'where':{'id':_0x35adbc[_0xce84('0x44')]['id']}})[_0xce84('0x25')](handleEntityNotFound(_0x1b5265,null))[_0xce84('0x25')](removeEntity(_0x1b5265,null))[_0xce84('0x43')](handleError(_0x1b5265,null));};exports['describe']=function(_0x3b2cc7,_0x24913a){return db[_0xce84('0x2c')][_0xce84('0x48')]()[_0xce84('0x25')](respondWithResult(_0x24913a,null))[_0xce84('0x43')](handleError(_0x24913a,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index 5f36d92..a00a72c 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 _0x7b14=['report_jscripty_questions','lodash','util','api','bluebird','request-promise','path','../../config/environment','./jscriptyQuestionReport.attributes','exports','define','JscriptyQuestionReport'];(function(_0x36408e,_0x3eba0d){var _0x5e75f4=function(_0x3d98e3){while(--_0x3d98e3){_0x36408e['push'](_0x36408e['shift']());}};_0x5e75f4(++_0x3eba0d);}(_0x7b14,0x121));var _0x47b1=function(_0x1fa8c2,_0x2b8012){_0x1fa8c2=_0x1fa8c2-0x0;var _0x4b0e05=_0x7b14[_0x1fa8c2];return _0x4b0e05;};'use strict';var _=require(_0x47b1('0x0'));var util=require(_0x47b1('0x1'));var logger=require('../../config/logger')(_0x47b1('0x2'));var moment=require('moment');var BPromise=require(_0x47b1('0x3'));var rp=require(_0x47b1('0x4'));var fs=require('fs');var path=require(_0x47b1('0x5'));var rimraf=require('rimraf');var config=require(_0x47b1('0x6'));var attributes=require(_0x47b1('0x7'));module[_0x47b1('0x8')]=function(_0x20f7eb,_0x3b4305){return _0x20f7eb[_0x47b1('0x9')](_0x47b1('0xa'),attributes,{'tableName':_0x47b1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb8da=['JscriptyQuestionReport','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptyQuestionReport.attributes','exports','define'];(function(_0x36375a,_0x43ede3){var _0xe646d0=function(_0x4e9ea2){while(--_0x4e9ea2){_0x36375a['push'](_0x36375a['shift']());}};_0xe646d0(++_0x43ede3);}(_0xb8da,0x9d));var _0xab8d=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xb8da[_0x502c7d];return _0x30b7ed;};'use strict';var _=require('lodash');var util=require(_0xab8d('0x0'));var logger=require(_0xab8d('0x1'))('api');var moment=require(_0xab8d('0x2'));var BPromise=require(_0xab8d('0x3'));var rp=require(_0xab8d('0x4'));var fs=require('fs');var path=require(_0xab8d('0x5'));var rimraf=require(_0xab8d('0x6'));var config=require(_0xab8d('0x7'));var attributes=require(_0xab8d('0x8'));module[_0xab8d('0x9')]=function(_0x413343,_0x18a4ac){return _0x413343[_0xab8d('0xa')](_0xab8d('0xb'),attributes,{'tableName':'report_jscripty_questions','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 936b81c..894de56 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 _0x1186=['message','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','http','request','then','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0x521929,_0x479be5){var _0x632436=function(_0x288290){while(--_0x288290){_0x521929['push'](_0x521929['shift']());}};_0x632436(++_0x479be5);}(_0x1186,0x1e6));var _0x6118=function(_0x28b1b3,_0x39e92a){_0x28b1b3=_0x28b1b3-0x0;var _0xb4bac6=_0x1186[_0x28b1b3];return _0xb4bac6;};'use strict';var _=require(_0x6118('0x0'));var util=require(_0x6118('0x1'));var moment=require(_0x6118('0x2'));var BPromise=require('bluebird');var rs=require(_0x6118('0x3'));var fs=require('fs');var Redis=require(_0x6118('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6118('0x5'));var logger=require(_0x6118('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x6118('0x7'));var client=jayson['client'][_0x6118('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4bcb0d,_0x18b5f2,_0x59d7c4){return new BPromise(function(_0x1e27e4,_0x52c933){return client[_0x6118('0x9')](_0x4bcb0d,_0x59d7c4)[_0x6118('0xa')](function(_0x29bb53){logger[_0x6118('0xb')](_0x6118('0xc'),_0x18b5f2,_0x6118('0xd'));logger[_0x6118('0xe')]('JscriptyQuestionReport,\x20%s,\x20%s,\x20%s',_0x18b5f2,_0x6118('0xd'),JSON[_0x6118('0xf')](_0x29bb53));if(_0x29bb53[_0x6118('0x10')]){if(_0x29bb53[_0x6118('0x10')][_0x6118('0x11')]===0x1f4){logger[_0x6118('0x10')](_0x6118('0xc'),_0x18b5f2,_0x29bb53['error']['message']);return _0x52c933(_0x29bb53['error'][_0x6118('0x12')]);}logger[_0x6118('0x10')](_0x6118('0xc'),_0x18b5f2,_0x29bb53[_0x6118('0x10')]['message']);return _0x1e27e4(_0x29bb53[_0x6118('0x10')][_0x6118('0x12')]);}else{logger[_0x6118('0xb')](_0x6118('0xc'),_0x18b5f2,_0x6118('0xd'));_0x1e27e4(_0x29bb53[_0x6118('0x13')][_0x6118('0x12')]);}})[_0x6118('0x14')](function(_0x27b4ea){logger[_0x6118('0x10')](_0x6118('0xc'),_0x18b5f2,_0x27b4ea);_0x52c933(_0x27b4ea);});});} \ No newline at end of file +var _0x9d63=['../../mysqldb','../../config/utils','../../config/logger','jayson/promise','request','then','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','JscriptyQuestionReport,\x20%s,\x20%s','message','info','catch','lodash','util','moment','bluebird','ioredis'];(function(_0x3e5db0,_0x369dc2){var _0x3864d8=function(_0x22b51d){while(--_0x22b51d){_0x3e5db0['push'](_0x3e5db0['shift']());}};_0x3864d8(++_0x369dc2);}(_0x9d63,0x151));var _0x39d6=function(_0x35d4e9,_0x298c61){_0x35d4e9=_0x35d4e9-0x0;var _0x5c2770=_0x9d63[_0x35d4e9];return _0x5c2770;};'use strict';var _=require(_0x39d6('0x0'));var util=require(_0x39d6('0x1'));var moment=require(_0x39d6('0x2'));var BPromise=require(_0x39d6('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x39d6('0x4'));var db=require(_0x39d6('0x5'))['db'];var utils=require(_0x39d6('0x6'));var logger=require(_0x39d6('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x39d6('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x49191d,_0x1904fc,_0x18cd95){return new BPromise(function(_0x1632c3,_0x21e794){return client[_0x39d6('0x9')](_0x49191d,_0x18cd95)[_0x39d6('0xa')](function(_0x475ad3){logger['info']('JscriptyQuestionReport,\x20%s,\x20%s',_0x1904fc,'request\x20sent');logger[_0x39d6('0xb')](_0x39d6('0xc'),_0x1904fc,_0x39d6('0xd'),JSON['stringify'](_0x475ad3));if(_0x475ad3[_0x39d6('0xe')]){if(_0x475ad3['error']['code']===0x1f4){logger[_0x39d6('0xe')](_0x39d6('0xf'),_0x1904fc,_0x475ad3[_0x39d6('0xe')][_0x39d6('0x10')]);return _0x21e794(_0x475ad3[_0x39d6('0xe')][_0x39d6('0x10')]);}logger['error'](_0x39d6('0xf'),_0x1904fc,_0x475ad3[_0x39d6('0xe')][_0x39d6('0x10')]);return _0x1632c3(_0x475ad3[_0x39d6('0xe')][_0x39d6('0x10')]);}else{logger[_0x39d6('0x11')](_0x39d6('0xf'),_0x1904fc,_0x39d6('0xd'));_0x1632c3(_0x475ad3['result']['message']);}})[_0x39d6('0x12')](function(_0x3a19b0){logger[_0x39d6('0xe')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x1904fc,_0x3a19b0);_0x21e794(_0x3a19b0);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index 564f6c4..c1d358e 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 _0xcc9e=['delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','show','/:id/questions','getQuestions','create','/:id'];(function(_0x14095c,_0x5ec985){var _0x2c4cf5=function(_0x1b7fdb){while(--_0x1b7fdb){_0x14095c['push'](_0x14095c['shift']());}};_0x2c4cf5(++_0x5ec985);}(_0xcc9e,0xfa));var _0xecc9=function(_0x49eefe,_0x12e8a9){_0x49eefe=_0x49eefe-0x0;var _0xc8b1df=_0xcc9e[_0x49eefe];return _0xc8b1df;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xecc9('0x0'));var timeout=require(_0xecc9('0x1'));var express=require(_0xecc9('0x2'));var router=express[_0xecc9('0x3')]();var fs_extra=require(_0xecc9('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xecc9('0x5'));var config=require('../../config/environment');var controller=require('./jscriptySessionReport.controller');router[_0xecc9('0x6')]('/',auth[_0xecc9('0x7')](),controller[_0xecc9('0x8')]);router[_0xecc9('0x6')](_0xecc9('0x9'),auth[_0xecc9('0x7')](),controller[_0xecc9('0xa')]);router[_0xecc9('0x6')]('/:id',auth[_0xecc9('0x7')](),controller[_0xecc9('0xb')]);router[_0xecc9('0x6')](_0xecc9('0xc'),auth[_0xecc9('0x7')](),controller[_0xecc9('0xd')]);router['post']('/',auth[_0xecc9('0x7')](),controller[_0xecc9('0xe')]);router['put'](_0xecc9('0xf'),auth[_0xecc9('0x7')](),controller['update']);router[_0xecc9('0x10')](_0xecc9('0xf'),auth[_0xecc9('0x7')](),controller[_0xecc9('0x11')]);module[_0xecc9('0x12')]=router; \ No newline at end of file +var _0xeabf=['../../config/environment','./jscriptySessionReport.controller','isAuthenticated','index','get','describe','/:id','show','/:id/questions','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service'];(function(_0x299e74,_0x436e09){var _0xf51015=function(_0x3ceadd){while(--_0x3ceadd){_0x299e74['push'](_0x299e74['shift']());}};_0xf51015(++_0x436e09);}(_0xeabf,0x99));var _0xfeab=function(_0x33898e,_0x57af61){_0x33898e=_0x33898e-0x0;var _0x437ed7=_0xeabf[_0x33898e];return _0x437ed7;};'use strict';var multer=require(_0xfeab('0x0'));var util=require(_0xfeab('0x1'));var path=require(_0xfeab('0x2'));var timeout=require(_0xfeab('0x3'));var express=require(_0xfeab('0x4'));var router=express[_0xfeab('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xfeab('0x6'));var config=require(_0xfeab('0x7'));var controller=require(_0xfeab('0x8'));router['get']('/',auth[_0xfeab('0x9')](),controller[_0xfeab('0xa')]);router[_0xfeab('0xb')]('/describe',auth[_0xfeab('0x9')](),controller[_0xfeab('0xc')]);router['get'](_0xfeab('0xd'),auth[_0xfeab('0x9')](),controller[_0xfeab('0xe')]);router[_0xfeab('0xb')](_0xfeab('0xf'),auth[_0xfeab('0x9')](),controller['getQuestions']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xfeab('0x10')](_0xfeab('0xd'),auth[_0xfeab('0x9')](),controller['update']);router[_0xfeab('0x11')](_0xfeab('0xd'),auth[_0xfeab('0x9')](),controller[_0xfeab('0x12')]);module[_0xfeab('0x13')]=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index 735bab0..73cdf37 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 _0x85c8=['exports','DATE','setDataValue','starttime','endtime','format','STRING','moment','sequelize'];(function(_0x588011,_0x5e9d11){var _0x3b3773=function(_0x4cca54){while(--_0x4cca54){_0x588011['push'](_0x588011['shift']());}};_0x3b3773(++_0x5e9d11);}(_0x85c8,0x193));var _0x885c=function(_0x1cea66,_0x1be1cd){_0x1cea66=_0x1cea66-0x0;var _0x192553=_0x85c8[_0x1cea66];return _0x192553;};'use strict';var moment=require(_0x885c('0x0'));var Sequelize=require(_0x885c('0x1'));module[_0x885c('0x2')]={'starttime':{'type':Sequelize[_0x885c('0x3')],'set':function(_0x5cd201){this[_0x885c('0x4')](_0x885c('0x5'),_0x5cd201);this[_0x885c('0x4')](_0x885c('0x6'),moment()[_0x885c('0x7')]('YYYY-MM-DD\x20HH:mm:ss'));}},'endtime':{'type':Sequelize[_0x885c('0x3')]},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize[_0x885c('0x8')]},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x885c('0x8')]},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x885c('0x8')]},'completed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xeccc=['DATE','setDataValue','starttime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN','moment','exports'];(function(_0x1a36a5,_0x746928){var _0x746243=function(_0x481966){while(--_0x481966){_0x1a36a5['push'](_0x1a36a5['shift']());}};_0x746243(++_0x746928);}(_0xeccc,0x17a));var _0xcecc=function(_0x2550ce,_0x45209b){_0x2550ce=_0x2550ce-0x0;var _0x25748d=_0xeccc[_0x2550ce];return _0x25748d;};'use strict';var moment=require(_0xcecc('0x0'));var Sequelize=require('sequelize');module[_0xcecc('0x1')]={'starttime':{'type':Sequelize[_0xcecc('0x2')],'set':function(_0x40baca){this[_0xcecc('0x3')](_0xcecc('0x4'),_0x40baca);this['setDataValue'](_0xcecc('0x5'),moment()[_0xcecc('0x6')](_0xcecc('0x7')));}},'endtime':{'type':Sequelize[_0xcecc('0x2')]},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize[_0xcecc('0x8')]},'queue':{'type':Sequelize[_0xcecc('0x8')]},'uniqueid':{'type':Sequelize[_0xcecc('0x8')]},'calleridname':{'type':Sequelize[_0xcecc('0x8')]},'calleridnum':{'type':Sequelize[_0xcecc('0x8')]},'completed':{'type':Sequelize[_0xcecc('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 e7251da..a534fc9 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 _0x1c18=['destroy','end','sendStatus','error','stack','name','index','map','JscriptySessionReport','rawAttributes','fieldName','type','key','model','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','then','includeAll','include','findAll','rows','catch','params','keys','options','create','body','find','describe','getQuestions','findOne','JscriptyQuestionReport','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','fs-extra','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','apply','save','update'];(function(_0x5f5555,_0x11dada){var _0x4b0975=function(_0xc9f9d5){while(--_0xc9f9d5){_0x5f5555['push'](_0x5f5555['shift']());}};_0x4b0975(++_0x11dada);}(_0x1c18,0x158));var _0x81c1=function(_0x45512f,_0xc21fc9){_0x45512f=_0x45512f-0x0;var _0x24a9f8=_0x1c18[_0x45512f];return _0x24a9f8;};'use strict';var emlformat=require(_0x81c1('0x0'));var rimraf=require(_0x81c1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x81c1('0x2'));var rp=require('request-promise');var moment=require(_0x81c1('0x3'));var BPromise=require(_0x81c1('0x4'));var Mustache=require(_0x81c1('0x5'));var util=require(_0x81c1('0x6'));var path=require(_0x81c1('0x7'));var sox=require(_0x81c1('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x81c1('0x9'));var _=require('lodash');var squel=require(_0x81c1('0xa'));var crypto=require('crypto');var jsforce=require(_0x81c1('0xb'));var deskjs=require(_0x81c1('0xc'));var toCsv=require('to-csv');var querystring=require(_0x81c1('0xd'));var Papa=require(_0x81c1('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x81c1('0xf'));var hardwareService=require(_0x81c1('0x10'));var logger=require(_0x81c1('0x11'))(_0x81c1('0x12'));var utils=require('../../config/utils');var config=require(_0x81c1('0x13'));var licenseUtil=require(_0x81c1('0x14'));var db=require(_0x81c1('0x15'))['db'];function respondWithStatusCode(_0x28c277,_0x2f44f1){_0x2f44f1=_0x2f44f1||0xcc;return function(_0x3fe5ce){if(_0x3fe5ce){return _0x28c277['sendStatus'](_0x2f44f1);}return _0x28c277[_0x81c1('0x16')](_0x2f44f1)['end']();};}function respondWithResult(_0x30c48f,_0x4eb6d5){_0x4eb6d5=_0x4eb6d5||0xc8;return function(_0x17a055){if(_0x17a055){return _0x30c48f[_0x81c1('0x16')](_0x4eb6d5)[_0x81c1('0x17')](_0x17a055);}};}function respondWithFilteredResult(_0x11d30c,_0x2ec7c9){return function(_0x4f6ba5){if(_0x4f6ba5){var _0x1e76ae=typeof _0x2ec7c9[_0x81c1('0x18')]===_0x81c1('0x19')&&typeof _0x2ec7c9[_0x81c1('0x1a')]==='undefined';var _0x1a5990=_0x4f6ba5[_0x81c1('0x1b')];var _0x58a714=_0x1e76ae?0x0:_0x2ec7c9[_0x81c1('0x18')];var _0x5e63bc=_0x1e76ae?_0x4f6ba5[_0x81c1('0x1b')]:_0x2ec7c9['offset']+_0x2ec7c9[_0x81c1('0x1a')];var _0x38b9e5;if(_0x5e63bc>=_0x1a5990){_0x5e63bc=_0x1a5990;_0x38b9e5=0xc8;}else{_0x38b9e5=0xce;}_0x11d30c['status'](_0x38b9e5);return _0x11d30c['set']('Content-Range',_0x58a714+'-'+_0x5e63bc+'/'+_0x1a5990)[_0x81c1('0x17')](_0x4f6ba5);}return null;};}function patchUpdates(_0x27a241){return function(_0x3638b6){try{jsonpatch[_0x81c1('0x1c')](_0x3638b6,_0x27a241,!![]);}catch(_0x4d8897){return BPromise['reject'](_0x4d8897);}return _0x3638b6[_0x81c1('0x1d')]();};}function saveUpdates(_0x5eed8a,_0xf45a03){return function(_0x32a5d0){if(_0x32a5d0){return _0x32a5d0[_0x81c1('0x1e')](_0x5eed8a)['then'](function(_0x1f2980){return _0x1f2980;});}return null;};}function removeEntity(_0x5bc2d5,_0x3407bd){return function(_0x40fc33){if(_0x40fc33){return _0x40fc33[_0x81c1('0x1f')]()['then'](function(){_0x5bc2d5['status'](0xcc)[_0x81c1('0x20')]();});}};}function handleEntityNotFound(_0x244561,_0x549ec9){return function(_0x1fcd06){if(!_0x1fcd06){_0x244561[_0x81c1('0x21')](0x194);}return _0x1fcd06;};}function handleError(_0x47a3c0,_0x37dc00){_0x37dc00=_0x37dc00||0x1f4;return function(_0x4ac6aa){logger[_0x81c1('0x22')](_0x4ac6aa[_0x81c1('0x23')]);if(_0x4ac6aa[_0x81c1('0x24')]){delete _0x4ac6aa[_0x81c1('0x24')];}_0x47a3c0[_0x81c1('0x16')](_0x37dc00)['send'](_0x4ac6aa);};}exports[_0x81c1('0x25')]=function(_0x38a381,_0x12dce8){var _0x3eb255={},_0xef2e2e={},_0x3c0bb2={'count':0x0,'rows':[]};var _0x17ffd1=_[_0x81c1('0x26')](db[_0x81c1('0x27')][_0x81c1('0x28')],function(_0x5a3b91){return{'name':_0x5a3b91[_0x81c1('0x29')],'type':_0x5a3b91[_0x81c1('0x2a')][_0x81c1('0x2b')]};});_0xef2e2e[_0x81c1('0x2c')]=_['map'](_0x17ffd1,'name');_0xef2e2e['query']=_['keys'](_0x38a381[_0x81c1('0x2d')]);_0xef2e2e['filters']=_['intersection'](_0xef2e2e[_0x81c1('0x2c')],_0xef2e2e[_0x81c1('0x2d')]);_0x3eb255[_0x81c1('0x2e')]=_[_0x81c1('0x2f')](_0xef2e2e[_0x81c1('0x2c')],qs[_0x81c1('0x30')](_0x38a381['query'][_0x81c1('0x30')]));_0x3eb255['attributes']=_0x3eb255[_0x81c1('0x2e')][_0x81c1('0x31')]?_0x3eb255[_0x81c1('0x2e')]:_0xef2e2e[_0x81c1('0x2c')];if(!_0x38a381['query'][_0x81c1('0x32')](_0x81c1('0x33'))){_0x3eb255[_0x81c1('0x1a')]=qs['limit'](_0x38a381['query']['limit']);_0x3eb255[_0x81c1('0x18')]=qs[_0x81c1('0x18')](_0x38a381[_0x81c1('0x2d')]['offset']);}_0x3eb255[_0x81c1('0x34')]=qs[_0x81c1('0x35')](_0x38a381[_0x81c1('0x2d')][_0x81c1('0x35')]);_0x3eb255[_0x81c1('0x36')]=qs[_0x81c1('0x37')](_[_0x81c1('0x38')](_0x38a381['query'],_0xef2e2e[_0x81c1('0x37')]),_0x17ffd1);if(_0x38a381[_0x81c1('0x2d')][_0x81c1('0x39')]){_0x3eb255[_0x81c1('0x36')]=_[_0x81c1('0x3a')](_0x3eb255['where'],{'$or':_['map'](_0x17ffd1,function(_0x2b50c6){if(_0x2b50c6['type']!=='VIRTUAL'){var _0x5b0e85={};_0x5b0e85[_0x2b50c6['name']]={'$like':'%'+_0x38a381[_0x81c1('0x2d')][_0x81c1('0x39')]+'%'};return _0x5b0e85;}})});}_0x3eb255=_[_0x81c1('0x3a')]({},_0x3eb255,_0x38a381['options']);var _0x3b0d3d={'where':_0x3eb255[_0x81c1('0x36')]};return db[_0x81c1('0x27')][_0x81c1('0x1b')](_0x3b0d3d)[_0x81c1('0x3b')](function(_0x464b44){_0x3c0bb2['count']=_0x464b44;if(_0x38a381[_0x81c1('0x2d')][_0x81c1('0x3c')]){_0x3eb255[_0x81c1('0x3d')]=[{'all':!![]}];}return db[_0x81c1('0x27')][_0x81c1('0x3e')](_0x3eb255);})[_0x81c1('0x3b')](function(_0x35cfd7){_0x3c0bb2[_0x81c1('0x3f')]=_0x35cfd7;return _0x3c0bb2;})[_0x81c1('0x3b')](respondWithFilteredResult(_0x12dce8,_0x3eb255))[_0x81c1('0x40')](handleError(_0x12dce8,null));};exports['show']=function(_0x2e27d8,_0x296a0a){var _0xa422b0={'raw':!![],'where':{'id':_0x2e27d8[_0x81c1('0x41')]['id']}},_0x5dfa6e={};_0x5dfa6e[_0x81c1('0x2c')]=_[_0x81c1('0x42')](db[_0x81c1('0x27')][_0x81c1('0x28')]);_0x5dfa6e[_0x81c1('0x2d')]=_[_0x81c1('0x42')](_0x2e27d8['query']);_0x5dfa6e[_0x81c1('0x37')]=_[_0x81c1('0x2f')](_0x5dfa6e[_0x81c1('0x2c')],_0x5dfa6e['query']);_0xa422b0['attributes']=_[_0x81c1('0x2f')](_0x5dfa6e['model'],qs['fields'](_0x2e27d8[_0x81c1('0x2d')]['fields']));_0xa422b0[_0x81c1('0x2e')]=_0xa422b0['attributes'][_0x81c1('0x31')]?_0xa422b0[_0x81c1('0x2e')]:_0x5dfa6e[_0x81c1('0x2c')];if(_0x2e27d8[_0x81c1('0x2d')][_0x81c1('0x3c')]){_0xa422b0[_0x81c1('0x3d')]=[{'all':!![]}];}_0xa422b0=_['merge']({},_0xa422b0,_0x2e27d8[_0x81c1('0x43')]);return db[_0x81c1('0x27')]['find'](_0xa422b0)[_0x81c1('0x3b')](handleEntityNotFound(_0x296a0a,null))['then'](respondWithResult(_0x296a0a,null))[_0x81c1('0x40')](handleError(_0x296a0a,null));};exports[_0x81c1('0x44')]=function(_0x149cd6,_0x17c71e){return db[_0x81c1('0x27')][_0x81c1('0x44')](_0x149cd6['body'],{})['then'](respondWithResult(_0x17c71e,0xc9))['catch'](handleError(_0x17c71e,null));};exports[_0x81c1('0x1e')]=function(_0x531c45,_0x2127ad){if(_0x531c45[_0x81c1('0x45')]['id']){delete _0x531c45['body']['id'];}return db[_0x81c1('0x27')][_0x81c1('0x46')]({'where':{'id':_0x531c45[_0x81c1('0x41')]['id']}})[_0x81c1('0x3b')](handleEntityNotFound(_0x2127ad,null))['then'](saveUpdates(_0x531c45[_0x81c1('0x45')],null))[_0x81c1('0x3b')](respondWithResult(_0x2127ad,null))['catch'](handleError(_0x2127ad,null));};exports[_0x81c1('0x1f')]=function(_0x4671b3,_0x5c2389){return db[_0x81c1('0x27')][_0x81c1('0x46')]({'where':{'id':_0x4671b3[_0x81c1('0x41')]['id']}})[_0x81c1('0x3b')](handleEntityNotFound(_0x5c2389,null))[_0x81c1('0x3b')](removeEntity(_0x5c2389,null))[_0x81c1('0x40')](handleError(_0x5c2389,null));};exports[_0x81c1('0x47')]=function(_0x116486,_0xad233a){return db['JscriptySessionReport'][_0x81c1('0x47')]()[_0x81c1('0x3b')](respondWithResult(_0xad233a,null))[_0x81c1('0x40')](handleError(_0xad233a,null));};exports[_0x81c1('0x48')]=function(_0x2f4b48,_0x41cfd5,_0x546622){var _0x2997a9={'raw':!![],'where':{}};var _0x211d55={};var _0x458d9f={'count':0x0,'rows':[]};return db[_0x81c1('0x27')][_0x81c1('0x49')]({'where':{'id':_0x2f4b48['params']['id']}})[_0x81c1('0x3b')](handleEntityNotFound(_0x41cfd5,null))['then'](function(_0x3ff1a3){if(_0x3ff1a3){_0x211d55[_0x81c1('0x2c')]=_[_0x81c1('0x42')](db[_0x81c1('0x4a')][_0x81c1('0x28')]);_0x211d55[_0x81c1('0x2d')]=_[_0x81c1('0x42')](_0x2f4b48[_0x81c1('0x2d')]);_0x211d55[_0x81c1('0x37')]=_[_0x81c1('0x2f')](_0x211d55[_0x81c1('0x2c')],_0x211d55[_0x81c1('0x2d')]);_0x2997a9[_0x81c1('0x2e')]=_[_0x81c1('0x2f')](_0x211d55[_0x81c1('0x2c')],qs[_0x81c1('0x30')](_0x2f4b48['query']['fields']));_0x2997a9['attributes']=_0x2997a9[_0x81c1('0x2e')][_0x81c1('0x31')]?_0x2997a9[_0x81c1('0x2e')]:_0x211d55[_0x81c1('0x2c')];if(!_0x2f4b48[_0x81c1('0x2d')][_0x81c1('0x32')]('nolimit')){_0x2997a9[_0x81c1('0x1a')]=qs[_0x81c1('0x1a')](_0x2f4b48[_0x81c1('0x2d')][_0x81c1('0x1a')]);_0x2997a9['offset']=qs[_0x81c1('0x18')](_0x2f4b48['query'][_0x81c1('0x18')]);}_0x2997a9[_0x81c1('0x34')]=qs[_0x81c1('0x35')](_0x2f4b48[_0x81c1('0x2d')][_0x81c1('0x35')]);_0x2997a9[_0x81c1('0x36')]=qs[_0x81c1('0x37')](_['pick'](_0x2f4b48[_0x81c1('0x2d')],_0x211d55['filters']));_0x2997a9[_0x81c1('0x36')]['SessionId']=_0x3ff1a3['id'];if(_0x2f4b48['query'][_0x81c1('0x39')]){_0x2997a9[_0x81c1('0x36')]=_[_0x81c1('0x3a')](_0x2997a9[_0x81c1('0x36')],{'$or':_[_0x81c1('0x26')](_0x2997a9['attributes'],function(_0x4d39b7){var _0xd574b5={};_0xd574b5[_0x4d39b7]={'$like':'%'+_0x2f4b48['query'][_0x81c1('0x39')]+'%'};return _0xd574b5;})});}_0x2997a9=_[_0x81c1('0x3a')]({},_0x2997a9,_0x2f4b48[_0x81c1('0x43')]);return db[_0x81c1('0x4a')][_0x81c1('0x1b')]({'where':_0x2997a9['where']})[_0x81c1('0x3b')](function(_0x45c847){_0x458d9f[_0x81c1('0x1b')]=_0x45c847;if(_0x2f4b48[_0x81c1('0x2d')]['includeAll']){_0x2997a9[_0x81c1('0x3d')]=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0x81c1('0x3e')](_0x2997a9);})[_0x81c1('0x3b')](function(_0x561532){_0x458d9f[_0x81c1('0x3f')]=_0x561532;return _0x458d9f;});}})[_0x81c1('0x3b')](respondWithFilteredResult(_0x41cfd5,_0x2997a9))[_0x81c1('0x40')](handleError(_0x41cfd5,null));}; \ No newline at end of file +var _0x40fa=['filter','options','findAll','rows','catch','show','params','include','create','body','update','find','describe','getQuestions','JscriptyQuestionReport','SessionId','includeAll','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','undefined','limit','count','set','Content-Range','json','apply','save','then','destroy','error','stack','name','send','index','map','JscriptySessionReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','merge','VIRTUAL'];(function(_0x3b4e9e,_0x1a8123){var _0x51eb8b=function(_0x4d1e9e){while(--_0x4d1e9e){_0x3b4e9e['push'](_0x3b4e9e['shift']());}};_0x51eb8b(++_0x1a8123);}(_0x40fa,0xb5));var _0xa40f=function(_0x310a42,_0xe50896){_0x310a42=_0x310a42-0x0;var _0x1dcbc8=_0x40fa[_0x310a42];return _0x1dcbc8;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xa40f('0x0'));var jsonpatch=require(_0xa40f('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xa40f('0x2'));var Mustache=require(_0xa40f('0x3'));var util=require(_0xa40f('0x4'));var path=require(_0xa40f('0x5'));var sox=require(_0xa40f('0x6'));var csv=require(_0xa40f('0x7'));var ejs=require(_0xa40f('0x8'));var fs=require('fs');var fs_extra=require(_0xa40f('0x9'));var _=require(_0xa40f('0xa'));var squel=require(_0xa40f('0xb'));var crypto=require(_0xa40f('0xc'));var jsforce=require(_0xa40f('0xd'));var deskjs=require(_0xa40f('0xe'));var toCsv=require(_0xa40f('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xa40f('0xf'));var authService=require(_0xa40f('0x10'));var qs=require(_0xa40f('0x11'));var as=require(_0xa40f('0x12'));var hardwareService=require(_0xa40f('0x13'));var logger=require(_0xa40f('0x14'))(_0xa40f('0x15'));var utils=require(_0xa40f('0x16'));var config=require(_0xa40f('0x17'));var licenseUtil=require(_0xa40f('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2e985e,_0x5d5954){_0x5d5954=_0x5d5954||0xcc;return function(_0x59fa7a){if(_0x59fa7a){return _0x2e985e[_0xa40f('0x19')](_0x5d5954);}return _0x2e985e[_0xa40f('0x1a')](_0x5d5954)[_0xa40f('0x1b')]();};}function respondWithResult(_0xb66d1a,_0x28229b){_0x28229b=_0x28229b||0xc8;return function(_0x4285c1){if(_0x4285c1){return _0xb66d1a[_0xa40f('0x1a')](_0x28229b)['json'](_0x4285c1);}};}function respondWithFilteredResult(_0x45462a,_0x362f0f){return function(_0x1a31d9){if(_0x1a31d9){var _0x5732e1=typeof _0x362f0f['offset']===_0xa40f('0x1c')&&typeof _0x362f0f[_0xa40f('0x1d')]==='undefined';var _0x4baeed=_0x1a31d9[_0xa40f('0x1e')];var _0x8114d9=_0x5732e1?0x0:_0x362f0f['offset'];var _0x405c48=_0x5732e1?_0x1a31d9[_0xa40f('0x1e')]:_0x362f0f['offset']+_0x362f0f[_0xa40f('0x1d')];var _0x42662d;if(_0x405c48>=_0x4baeed){_0x405c48=_0x4baeed;_0x42662d=0xc8;}else{_0x42662d=0xce;}_0x45462a[_0xa40f('0x1a')](_0x42662d);return _0x45462a[_0xa40f('0x1f')](_0xa40f('0x20'),_0x8114d9+'-'+_0x405c48+'/'+_0x4baeed)[_0xa40f('0x21')](_0x1a31d9);}return null;};}function patchUpdates(_0x242749){return function(_0x573461){try{jsonpatch[_0xa40f('0x22')](_0x573461,_0x242749,!![]);}catch(_0x53ad2e){return BPromise['reject'](_0x53ad2e);}return _0x573461[_0xa40f('0x23')]();};}function saveUpdates(_0x598ac6,_0x56dee1){return function(_0x3b100f){if(_0x3b100f){return _0x3b100f['update'](_0x598ac6)[_0xa40f('0x24')](function(_0x3be083){return _0x3be083;});}return null;};}function removeEntity(_0x1306ce,_0x55b0f2){return function(_0x4039e0){if(_0x4039e0){return _0x4039e0[_0xa40f('0x25')]()[_0xa40f('0x24')](function(){_0x1306ce[_0xa40f('0x1a')](0xcc)[_0xa40f('0x1b')]();});}};}function handleEntityNotFound(_0x43812d,_0x4d6dc8){return function(_0x1ebc9a){if(!_0x1ebc9a){_0x43812d[_0xa40f('0x19')](0x194);}return _0x1ebc9a;};}function handleError(_0x3ca870,_0x25c630){_0x25c630=_0x25c630||0x1f4;return function(_0x3f5185){logger[_0xa40f('0x26')](_0x3f5185[_0xa40f('0x27')]);if(_0x3f5185['name']){delete _0x3f5185[_0xa40f('0x28')];}_0x3ca870[_0xa40f('0x1a')](_0x25c630)[_0xa40f('0x29')](_0x3f5185);};}exports[_0xa40f('0x2a')]=function(_0x1ba51a,_0x48324e){var _0x49b856={},_0x1cb7e6={},_0x356863={'count':0x0,'rows':[]};var _0x2ece13=_[_0xa40f('0x2b')](db[_0xa40f('0x2c')][_0xa40f('0x2d')],function(_0x3f66e5){return{'name':_0x3f66e5[_0xa40f('0x2e')],'type':_0x3f66e5[_0xa40f('0x2f')]['key']};});_0x1cb7e6[_0xa40f('0x30')]=_[_0xa40f('0x2b')](_0x2ece13,_0xa40f('0x28'));_0x1cb7e6[_0xa40f('0x31')]=_[_0xa40f('0x32')](_0x1ba51a[_0xa40f('0x31')]);_0x1cb7e6[_0xa40f('0x33')]=_[_0xa40f('0x34')](_0x1cb7e6[_0xa40f('0x30')],_0x1cb7e6['query']);_0x49b856[_0xa40f('0x35')]=_['intersection'](_0x1cb7e6[_0xa40f('0x30')],qs[_0xa40f('0x36')](_0x1ba51a[_0xa40f('0x31')][_0xa40f('0x36')]));_0x49b856[_0xa40f('0x35')]=_0x49b856[_0xa40f('0x35')][_0xa40f('0x37')]?_0x49b856[_0xa40f('0x35')]:_0x1cb7e6['model'];if(!_0x1ba51a[_0xa40f('0x31')][_0xa40f('0x38')](_0xa40f('0x39'))){_0x49b856['limit']=qs[_0xa40f('0x1d')](_0x1ba51a[_0xa40f('0x31')]['limit']);_0x49b856[_0xa40f('0x3a')]=qs[_0xa40f('0x3a')](_0x1ba51a[_0xa40f('0x31')][_0xa40f('0x3a')]);}_0x49b856[_0xa40f('0x3b')]=qs[_0xa40f('0x3c')](_0x1ba51a[_0xa40f('0x31')]['sort']);_0x49b856[_0xa40f('0x3d')]=qs['filters'](_[_0xa40f('0x3e')](_0x1ba51a[_0xa40f('0x31')],_0x1cb7e6['filters']),_0x2ece13);if(_0x1ba51a[_0xa40f('0x31')]['filter']){_0x49b856[_0xa40f('0x3d')]=_[_0xa40f('0x3f')](_0x49b856[_0xa40f('0x3d')],{'$or':_[_0xa40f('0x2b')](_0x2ece13,function(_0x10924d){if(_0x10924d[_0xa40f('0x2f')]!==_0xa40f('0x40')){var _0x302daf={};_0x302daf[_0x10924d[_0xa40f('0x28')]]={'$like':'%'+_0x1ba51a[_0xa40f('0x31')][_0xa40f('0x41')]+'%'};return _0x302daf;}})});}_0x49b856=_['merge']({},_0x49b856,_0x1ba51a[_0xa40f('0x42')]);var _0x41a2eb={'where':_0x49b856[_0xa40f('0x3d')]};return db[_0xa40f('0x2c')]['count'](_0x41a2eb)[_0xa40f('0x24')](function(_0x3e0b66){_0x356863[_0xa40f('0x1e')]=_0x3e0b66;if(_0x1ba51a[_0xa40f('0x31')]['includeAll']){_0x49b856['include']=[{'all':!![]}];}return db[_0xa40f('0x2c')][_0xa40f('0x43')](_0x49b856);})[_0xa40f('0x24')](function(_0x5890ca){_0x356863[_0xa40f('0x44')]=_0x5890ca;return _0x356863;})[_0xa40f('0x24')](respondWithFilteredResult(_0x48324e,_0x49b856))[_0xa40f('0x45')](handleError(_0x48324e,null));};exports[_0xa40f('0x46')]=function(_0x2aa2a3,_0x3ab63f){var _0x34292b={'raw':!![],'where':{'id':_0x2aa2a3[_0xa40f('0x47')]['id']}},_0x411b59={};_0x411b59['model']=_['keys'](db['JscriptySessionReport'][_0xa40f('0x2d')]);_0x411b59[_0xa40f('0x31')]=_['keys'](_0x2aa2a3['query']);_0x411b59[_0xa40f('0x33')]=_[_0xa40f('0x34')](_0x411b59[_0xa40f('0x30')],_0x411b59[_0xa40f('0x31')]);_0x34292b[_0xa40f('0x35')]=_[_0xa40f('0x34')](_0x411b59[_0xa40f('0x30')],qs['fields'](_0x2aa2a3[_0xa40f('0x31')][_0xa40f('0x36')]));_0x34292b[_0xa40f('0x35')]=_0x34292b['attributes'][_0xa40f('0x37')]?_0x34292b[_0xa40f('0x35')]:_0x411b59['model'];if(_0x2aa2a3['query']['includeAll']){_0x34292b[_0xa40f('0x48')]=[{'all':!![]}];}_0x34292b=_[_0xa40f('0x3f')]({},_0x34292b,_0x2aa2a3[_0xa40f('0x42')]);return db[_0xa40f('0x2c')]['find'](_0x34292b)[_0xa40f('0x24')](handleEntityNotFound(_0x3ab63f,null))[_0xa40f('0x24')](respondWithResult(_0x3ab63f,null))[_0xa40f('0x45')](handleError(_0x3ab63f,null));};exports[_0xa40f('0x49')]=function(_0x5297da,_0x5c3506){return db[_0xa40f('0x2c')][_0xa40f('0x49')](_0x5297da[_0xa40f('0x4a')],{})[_0xa40f('0x24')](respondWithResult(_0x5c3506,0xc9))[_0xa40f('0x45')](handleError(_0x5c3506,null));};exports[_0xa40f('0x4b')]=function(_0x31d6c0,_0xf2fc34){if(_0x31d6c0[_0xa40f('0x4a')]['id']){delete _0x31d6c0[_0xa40f('0x4a')]['id'];}return db[_0xa40f('0x2c')]['find']({'where':{'id':_0x31d6c0[_0xa40f('0x47')]['id']}})['then'](handleEntityNotFound(_0xf2fc34,null))[_0xa40f('0x24')](saveUpdates(_0x31d6c0[_0xa40f('0x4a')],null))['then'](respondWithResult(_0xf2fc34,null))[_0xa40f('0x45')](handleError(_0xf2fc34,null));};exports['destroy']=function(_0x4de5f8,_0x57f86b){return db[_0xa40f('0x2c')][_0xa40f('0x4c')]({'where':{'id':_0x4de5f8[_0xa40f('0x47')]['id']}})[_0xa40f('0x24')](handleEntityNotFound(_0x57f86b,null))[_0xa40f('0x24')](removeEntity(_0x57f86b,null))['catch'](handleError(_0x57f86b,null));};exports[_0xa40f('0x4d')]=function(_0x3f558c,_0xe8e747){return db[_0xa40f('0x2c')][_0xa40f('0x4d')]()[_0xa40f('0x24')](respondWithResult(_0xe8e747,null))[_0xa40f('0x45')](handleError(_0xe8e747,null));};exports[_0xa40f('0x4e')]=function(_0x1f63cd,_0x2a12eb,_0x50ed93){var _0x4dde04={'raw':!![],'where':{}};var _0x52ed32={};var _0x11bbe5={'count':0x0,'rows':[]};return db[_0xa40f('0x2c')]['findOne']({'where':{'id':_0x1f63cd[_0xa40f('0x47')]['id']}})['then'](handleEntityNotFound(_0x2a12eb,null))[_0xa40f('0x24')](function(_0xa74110){if(_0xa74110){_0x52ed32[_0xa40f('0x30')]=_[_0xa40f('0x32')](db[_0xa40f('0x4f')][_0xa40f('0x2d')]);_0x52ed32['query']=_[_0xa40f('0x32')](_0x1f63cd[_0xa40f('0x31')]);_0x52ed32[_0xa40f('0x33')]=_[_0xa40f('0x34')](_0x52ed32['model'],_0x52ed32[_0xa40f('0x31')]);_0x4dde04[_0xa40f('0x35')]=_['intersection'](_0x52ed32[_0xa40f('0x30')],qs['fields'](_0x1f63cd['query'][_0xa40f('0x36')]));_0x4dde04['attributes']=_0x4dde04[_0xa40f('0x35')][_0xa40f('0x37')]?_0x4dde04[_0xa40f('0x35')]:_0x52ed32[_0xa40f('0x30')];if(!_0x1f63cd[_0xa40f('0x31')][_0xa40f('0x38')](_0xa40f('0x39'))){_0x4dde04[_0xa40f('0x1d')]=qs[_0xa40f('0x1d')](_0x1f63cd[_0xa40f('0x31')][_0xa40f('0x1d')]);_0x4dde04['offset']=qs[_0xa40f('0x3a')](_0x1f63cd['query'][_0xa40f('0x3a')]);}_0x4dde04[_0xa40f('0x3b')]=qs[_0xa40f('0x3c')](_0x1f63cd[_0xa40f('0x31')][_0xa40f('0x3c')]);_0x4dde04[_0xa40f('0x3d')]=qs[_0xa40f('0x33')](_[_0xa40f('0x3e')](_0x1f63cd['query'],_0x52ed32[_0xa40f('0x33')]));_0x4dde04['where'][_0xa40f('0x50')]=_0xa74110['id'];if(_0x1f63cd[_0xa40f('0x31')]['filter']){_0x4dde04[_0xa40f('0x3d')]=_[_0xa40f('0x3f')](_0x4dde04[_0xa40f('0x3d')],{'$or':_[_0xa40f('0x2b')](_0x4dde04[_0xa40f('0x35')],function(_0x150c0b){var _0xce4200={};_0xce4200[_0x150c0b]={'$like':'%'+_0x1f63cd[_0xa40f('0x31')][_0xa40f('0x41')]+'%'};return _0xce4200;})});}_0x4dde04=_[_0xa40f('0x3f')]({},_0x4dde04,_0x1f63cd[_0xa40f('0x42')]);return db[_0xa40f('0x4f')][_0xa40f('0x1e')]({'where':_0x4dde04['where']})[_0xa40f('0x24')](function(_0x319694){_0x11bbe5[_0xa40f('0x1e')]=_0x319694;if(_0x1f63cd[_0xa40f('0x31')][_0xa40f('0x51')]){_0x4dde04[_0xa40f('0x48')]=[{'all':!![]}];}return db[_0xa40f('0x4f')][_0xa40f('0x43')](_0x4dde04);})['then'](function(_0x24c5ee){_0x11bbe5[_0xa40f('0x44')]=_0x24c5ee;return _0x11bbe5;});}})[_0xa40f('0x24')](respondWithFilteredResult(_0x2a12eb,_0x4dde04))[_0xa40f('0x45')](handleError(_0x2a12eb,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 8923d48..444d387 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 _0x7046=['path','../../config/environment','./jscriptySessionReport.attributes','exports','JscriptySessionReport','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x33466d,_0x4d7e8c){var _0x401b25=function(_0x13a18d){while(--_0x13a18d){_0x33466d['push'](_0x33466d['shift']());}};_0x401b25(++_0x4d7e8c);}(_0x7046,0x144));var _0x6704=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x7046[_0xfae23b];return _0x200640;};'use strict';var _=require(_0x6704('0x0'));var util=require(_0x6704('0x1'));var logger=require(_0x6704('0x2'))(_0x6704('0x3'));var moment=require('moment');var BPromise=require(_0x6704('0x4'));var rp=require(_0x6704('0x5'));var fs=require('fs');var path=require(_0x6704('0x6'));var rimraf=require('rimraf');var config=require(_0x6704('0x7'));var attributes=require(_0x6704('0x8'));module[_0x6704('0x9')]=function(_0x626a14,_0x2917be){return _0x626a14['define'](_0x6704('0xa'),attributes,{'tableName':'report_jscripty_sessions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9fd4=['rimraf','exports','define','report_jscripty_sessions','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9fd4,0x16c));var _0x49fd=function(_0x464d1b,_0x4d4525){_0x464d1b=_0x464d1b-0x0;var _0x1b21c0=_0x9fd4[_0x464d1b];return _0x1b21c0;};'use strict';var _=require(_0x49fd('0x0'));var util=require(_0x49fd('0x1'));var logger=require(_0x49fd('0x2'))(_0x49fd('0x3'));var moment=require(_0x49fd('0x4'));var BPromise=require(_0x49fd('0x5'));var rp=require(_0x49fd('0x6'));var fs=require('fs');var path=require(_0x49fd('0x7'));var rimraf=require(_0x49fd('0x8'));var config=require('../../config/environment');var attributes=require('./jscriptySessionReport.attributes');module[_0x49fd('0x9')]=function(_0x42fdc7,_0x1bc16e){return _0x42fdc7[_0x49fd('0xa')]('JscriptySessionReport',attributes,{'tableName':_0x49fd('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 fe64595..7878441 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 _0x68b3=['rpc','jayson/promise','client','http','request','then','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x30b631,_0x2603ac){var _0x5d4397=function(_0x12ef2f){while(--_0x12ef2f){_0x30b631['push'](_0x30b631['shift']());}};_0x5d4397(++_0x2603ac);}(_0x68b3,0x1d8));var _0x368b=function(_0x4821ee,_0x490242){_0x4821ee=_0x4821ee-0x0;var _0x47c03b=_0x68b3[_0x4821ee];return _0x47c03b;};'use strict';var _=require(_0x368b('0x0'));var util=require(_0x368b('0x1'));var moment=require(_0x368b('0x2'));var BPromise=require(_0x368b('0x3'));var rs=require(_0x368b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x368b('0x5'))['db'];var utils=require(_0x368b('0x6'));var logger=require(_0x368b('0x7'))(_0x368b('0x8'));var config=require('../../config/environment');var jayson=require(_0x368b('0x9'));var client=jayson[_0x368b('0xa')][_0x368b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x23584a,_0x4406c8,_0x127c1e){return new BPromise(function(_0x2dec1c,_0x142d05){return client[_0x368b('0xc')](_0x23584a,_0x127c1e)[_0x368b('0xd')](function(_0x2a7b9f){logger['info'](_0x368b('0xe'),_0x4406c8,_0x368b('0xf'));logger[_0x368b('0x10')]('JscriptySessionReport,\x20%s,\x20%s,\x20%s',_0x4406c8,_0x368b('0xf'),JSON[_0x368b('0x11')](_0x2a7b9f));if(_0x2a7b9f[_0x368b('0x12')]){if(_0x2a7b9f['error'][_0x368b('0x13')]===0x1f4){logger[_0x368b('0x12')]('JscriptySessionReport,\x20%s,\x20%s',_0x4406c8,_0x2a7b9f[_0x368b('0x12')][_0x368b('0x14')]);return _0x142d05(_0x2a7b9f[_0x368b('0x12')][_0x368b('0x14')]);}logger[_0x368b('0x12')]('JscriptySessionReport,\x20%s,\x20%s',_0x4406c8,_0x2a7b9f[_0x368b('0x12')][_0x368b('0x14')]);return _0x2dec1c(_0x2a7b9f['error'][_0x368b('0x14')]);}else{logger[_0x368b('0x15')](_0x368b('0xe'),_0x4406c8,'request\x20sent');_0x2dec1c(_0x2a7b9f[_0x368b('0x16')][_0x368b('0x14')]);}})[_0x368b('0x17')](function(_0x4d6d9d){logger[_0x368b('0x12')](_0x368b('0xe'),_0x4406c8,_0x4d6d9d);_0x142d05(_0x4d6d9d);});});} \ No newline at end of file +var _0x187d=['lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch'];(function(_0x27e99c,_0x91c78d){var _0x4cfbf8=function(_0x24be9e){while(--_0x24be9e){_0x27e99c['push'](_0x27e99c['shift']());}};_0x4cfbf8(++_0x91c78d);}(_0x187d,0x93));var _0xd187=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0x187d[_0x491a7f];return _0x3d8f44;};'use strict';var _=require(_0xd187('0x0'));var util=require('util');var moment=require(_0xd187('0x1'));var BPromise=require(_0xd187('0x2'));var rs=require(_0xd187('0x3'));var fs=require('fs');var Redis=require(_0xd187('0x4'));var db=require(_0xd187('0x5'))['db'];var utils=require(_0xd187('0x6'));var logger=require('../../config/logger')(_0xd187('0x7'));var config=require(_0xd187('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd187('0x9')][_0xd187('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x444a60,_0x1d3fe4,_0x28ce2f){return new BPromise(function(_0x2d6992,_0x358c45){return client[_0xd187('0xb')](_0x444a60,_0x28ce2f)['then'](function(_0x342539){logger[_0xd187('0xc')](_0xd187('0xd'),_0x1d3fe4,_0xd187('0xe'));logger[_0xd187('0xf')](_0xd187('0x10'),_0x1d3fe4,'request\x20sent',JSON[_0xd187('0x11')](_0x342539));if(_0x342539[_0xd187('0x12')]){if(_0x342539[_0xd187('0x12')]['code']===0x1f4){logger[_0xd187('0x12')](_0xd187('0xd'),_0x1d3fe4,_0x342539[_0xd187('0x12')]['message']);return _0x358c45(_0x342539[_0xd187('0x12')][_0xd187('0x13')]);}logger[_0xd187('0x12')](_0xd187('0xd'),_0x1d3fe4,_0x342539['error'][_0xd187('0x13')]);return _0x2d6992(_0x342539[_0xd187('0x12')][_0xd187('0x13')]);}else{logger[_0xd187('0xc')]('JscriptySessionReport,\x20%s,\x20%s',_0x1d3fe4,_0xd187('0xe'));_0x2d6992(_0x342539['result']['message']);}})[_0xd187('0x14')](function(_0x5a4986){logger['error'](_0xd187('0xd'),_0x1d3fe4,_0x5a4986);_0x358c45(_0x5a4986);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index 783bf04..e942093 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 _0x1159=['../../config/environment','./license.controller','get','index','/:id','isAuthenticated','update','/download_log_file','downloadLogFile','exports','multer','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x4d0df6,_0x4634f3){var _0x4e2615=function(_0x5285e2){while(--_0x5285e2){_0x4d0df6['push'](_0x4d0df6['shift']());}};_0x4e2615(++_0x4634f3);}(_0x1159,0x13a));var _0x9115=function(_0x2725dd,_0x1e87e4){_0x2725dd=_0x2725dd-0x0;var _0x1dc7c6=_0x1159[_0x2725dd];return _0x1dc7c6;};'use strict';var multer=require(_0x9115('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x9115('0x1'));var express=require('express');var router=express[_0x9115('0x2')]();var fs_extra=require(_0x9115('0x3'));var auth=require(_0x9115('0x4'));var interaction=require(_0x9115('0x5'));var config=require(_0x9115('0x6'));var controller=require(_0x9115('0x7'));router[_0x9115('0x8')]('/',controller[_0x9115('0x9')]);router['put'](_0x9115('0xa'),auth[_0x9115('0xb')](),controller[_0x9115('0xc')]);router[_0x9115('0x8')](_0x9115('0xd'),auth[_0x9115('0xb')](),controller[_0x9115('0xe')]);module[_0x9115('0xf')]=router; \ No newline at end of file +var _0x6ab8=['../../config/environment','get','index','put','downloadLogFile','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x276725,_0x36b07d){var _0x5e0dba=function(_0xc6fa28){while(--_0xc6fa28){_0x276725['push'](_0x276725['shift']());}};_0x5e0dba(++_0x36b07d);}(_0x6ab8,0x1aa));var _0x86ab=function(_0x51536e,_0x31ba57){_0x51536e=_0x51536e-0x0;var _0x3cd30f=_0x6ab8[_0x51536e];return _0x3cd30f;};'use strict';var multer=require('multer');var util=require(_0x86ab('0x0'));var path=require('path');var timeout=require(_0x86ab('0x1'));var express=require(_0x86ab('0x2'));var router=express[_0x86ab('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x86ab('0x4'));var interaction=require(_0x86ab('0x5'));var config=require(_0x86ab('0x6'));var controller=require('./license.controller');router[_0x86ab('0x7')]('/',controller[_0x86ab('0x8')]);router[_0x86ab('0x9')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x86ab('0x7')]('/download_log_file',auth['isAuthenticated'](),controller[_0x86ab('0xa')]);module[_0x86ab('0xb')]=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index 6243867..03b659a 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 _0x60d7=['STRING','INTEGER','exports'];(function(_0x1928c9,_0x13a6d1){var _0x51b5fb=function(_0x24cf70){while(--_0x24cf70){_0x1928c9['push'](_0x1928c9['shift']());}};_0x51b5fb(++_0x13a6d1);}(_0x60d7,0x191));var _0x760d=function(_0x195b3f,_0x431ec9){_0x195b3f=_0x195b3f-0x0;var _0x5adb9a=_0x60d7[_0x195b3f];return _0x5adb9a;};'use strict';var Sequelize=require('sequelize');module[_0x760d('0x0')]={'license':{'type':Sequelize['TEXT']},'data1':{'type':Sequelize[_0x760d('0x1')]},'data2':{'type':Sequelize[_0x760d('0x1')]},'chatLicenseExceeded':{'type':Sequelize[_0x760d('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x3b09=['INTEGER','sequelize','exports','TEXT','STRING'];(function(_0xe21b73,_0x4c1fac){var _0x3546ce=function(_0x1dc8a3){while(--_0x1dc8a3){_0xe21b73['push'](_0xe21b73['shift']());}};_0x3546ce(++_0x4c1fac);}(_0x3b09,0xdd));var _0x93b0=function(_0x1a6bde,_0x3e8809){_0x1a6bde=_0x1a6bde-0x0;var _0x490911=_0x3b09[_0x1a6bde];return _0x490911;};'use strict';var Sequelize=require(_0x93b0('0x0'));module[_0x93b0('0x1')]={'license':{'type':Sequelize[_0x93b0('0x2')]},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize[_0x93b0('0x3')]},'chatLicenseExceeded':{'type':Sequelize[_0x93b0('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/license/license.controller.js b/server/api/license/license.controller.js index f6d2e44..e54b5d2 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 _0x62d7=['crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','model','keys','License','rawAttributes','query','filters','intersection','attributes','fields','length','merge','options','getLicense','catch','params','checkLicense','body','key','demo','join','/var','log','xcally','Content-disposition','attachment;\x20filename=','Content-Type','text/plain','download','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel'];(function(_0x5e88c3,_0x3fbc3e){var _0x4045a3=function(_0x5c63c4){while(--_0x5c63c4){_0x5e88c3['push'](_0x5e88c3['shift']());}};_0x4045a3(++_0x3fbc3e);}(_0x62d7,0x83));var _0x762d=function(_0x1226de,_0x1d6e43){_0x1226de=_0x1226de-0x0;var _0x4965f7=_0x62d7[_0x1226de];return _0x4965f7;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x762d('0x0'));var jsonpatch=require(_0x762d('0x1'));var rp=require(_0x762d('0x2'));var moment=require(_0x762d('0x3'));var BPromise=require(_0x762d('0x4'));var Mustache=require(_0x762d('0x5'));var util=require(_0x762d('0x6'));var path=require('path');var sox=require(_0x762d('0x7'));var csv=require(_0x762d('0x8'));var ejs=require(_0x762d('0x9'));var fs=require('fs');var fs_extra=require(_0x762d('0xa'));var _=require(_0x762d('0xb'));var squel=require(_0x762d('0xc'));var crypto=require(_0x762d('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x762d('0xe'));var toCsv=require(_0x762d('0x8'));var querystring=require(_0x762d('0xf'));var Papa=require(_0x762d('0x10'));var Redis=require(_0x762d('0x11'));var authService=require(_0x762d('0x12'));var qs=require(_0x762d('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x762d('0x14'));var logger=require(_0x762d('0x15'))('api');var utils=require(_0x762d('0x16'));var config=require(_0x762d('0x17'));var licenseUtil=require(_0x762d('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x48eb54,_0x329b7f){_0x329b7f=_0x329b7f||0xcc;return function(_0x2d8119){if(_0x2d8119){return _0x48eb54[_0x762d('0x19')](_0x329b7f);}return _0x48eb54[_0x762d('0x1a')](_0x329b7f)['end']();};}function respondWithResult(_0x21c807,_0x5f27d3){_0x5f27d3=_0x5f27d3||0xc8;return function(_0xbe3148){if(_0xbe3148){return _0x21c807['status'](_0x5f27d3)[_0x762d('0x1b')](_0xbe3148);}};}function respondWithFilteredResult(_0x315f1e,_0xb5c78d){return function(_0x108136){if(_0x108136){var _0x5b83aa=typeof _0xb5c78d['offset']===_0x762d('0x1c')&&typeof _0xb5c78d[_0x762d('0x1d')]===_0x762d('0x1c');var _0x5074ca=_0x108136['count'];var _0x3d9a36=_0x5b83aa?0x0:_0xb5c78d['offset'];var _0x16da5d=_0x5b83aa?_0x108136[_0x762d('0x1e')]:_0xb5c78d[_0x762d('0x1f')]+_0xb5c78d[_0x762d('0x1d')];var _0x4f9e20;if(_0x16da5d>=_0x5074ca){_0x16da5d=_0x5074ca;_0x4f9e20=0xc8;}else{_0x4f9e20=0xce;}_0x315f1e[_0x762d('0x1a')](_0x4f9e20);return _0x315f1e[_0x762d('0x20')](_0x762d('0x21'),_0x3d9a36+'-'+_0x16da5d+'/'+_0x5074ca)[_0x762d('0x1b')](_0x108136);}return null;};}function patchUpdates(_0x40461e){return function(_0x5003e4){try{jsonpatch[_0x762d('0x22')](_0x5003e4,_0x40461e,!![]);}catch(_0x3969f5){return BPromise[_0x762d('0x23')](_0x3969f5);}return _0x5003e4['save']();};}function saveUpdates(_0x1bf26a,_0x3aa198){return function(_0x4c8ef6){if(_0x4c8ef6){return _0x4c8ef6[_0x762d('0x24')](_0x1bf26a)[_0x762d('0x25')](function(_0xbd8329){return _0xbd8329;});}return null;};}function removeEntity(_0x6ab0df,_0x43f06e){return function(_0x160e64){if(_0x160e64){return _0x160e64[_0x762d('0x26')]()[_0x762d('0x25')](function(){_0x6ab0df[_0x762d('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1b704f,_0xc2c574){return function(_0xb4ecdb){if(!_0xb4ecdb){_0x1b704f[_0x762d('0x19')](0x194);}return _0xb4ecdb;};}function handleError(_0x4d9c54,_0x243717){_0x243717=_0x243717||0x1f4;return function(_0x200207){logger[_0x762d('0x27')](_0x200207[_0x762d('0x28')]);if(_0x200207[_0x762d('0x29')]){delete _0x200207[_0x762d('0x29')];}_0x4d9c54[_0x762d('0x1a')](_0x243717)[_0x762d('0x2a')](_0x200207);};}var utilLicense=require(_0x762d('0x18'));exports[_0x762d('0x2b')]=function(_0x31ae12,_0x5e66c4){var _0x38587f={'raw':!![],'where':{'id':0x1}},_0x439070={};_0x439070[_0x762d('0x2c')]=_[_0x762d('0x2d')](db[_0x762d('0x2e')][_0x762d('0x2f')]);_0x439070[_0x762d('0x30')]=_['keys'](_0x31ae12['query']);_0x439070[_0x762d('0x31')]=_[_0x762d('0x32')](_0x439070['model'],_0x439070[_0x762d('0x30')]);_0x38587f[_0x762d('0x33')]=_['intersection'](_0x439070[_0x762d('0x2c')],qs[_0x762d('0x34')](_0x31ae12[_0x762d('0x30')][_0x762d('0x34')]));_0x38587f[_0x762d('0x33')]=_0x38587f['attributes'][_0x762d('0x35')]?_0x38587f[_0x762d('0x33')]:_0x439070[_0x762d('0x2c')];_0x38587f=_[_0x762d('0x36')]({},_0x38587f,_0x31ae12[_0x762d('0x37')]);return utilLicense[_0x762d('0x38')](_0x38587f)[_0x762d('0x25')](respondWithResult(_0x5e66c4,null))[_0x762d('0x39')](handleError(_0x5e66c4,null));};exports['update']=function(_0x44c0a0,_0x155da9){if(_0x44c0a0['body']['id']){delete _0x44c0a0['body']['id'];}return db['License']['find']({'where':{'id':_0x44c0a0[_0x762d('0x3a')]['id']}})[_0x762d('0x25')](handleEntityNotFound(_0x155da9,null))[_0x762d('0x25')](function(_0x2bbd99){var _0xc5e775=_0x2bbd99['get']({'plain':!![]});return utilLicense[_0x762d('0x3b')](_0xc5e775,_0x44c0a0[_0x762d('0x3c')][_0x762d('0x3d')]);})[_0x762d('0x25')](function(_0x438f8c){if(!_0x438f8c[_0x762d('0x3e')]){return saveUpdates(_0x44c0a0[_0x762d('0x3c')],null);}return _0x438f8c;})['then'](respondWithResult(_0x155da9,null))[_0x762d('0x39')](handleError(_0x155da9,null));};exports['downloadLogFile']=function(_0x47c060,_0x4d67d0){var _0x26e3bc='license-info.log';var _0x484ed4=path[_0x762d('0x3f')](_0x762d('0x40'),_0x762d('0x41'),_0x762d('0x42'),_0x26e3bc);_0x4d67d0['setHeader'](_0x762d('0x43'),_0x762d('0x44')+_0x26e3bc);_0x4d67d0['set'](_0x762d('0x45'),_0x762d('0x46'));_0x4d67d0[_0x762d('0x47')](_0x484ed4);}; \ No newline at end of file +var _0x6674=['api','../../config/utils','../../config/environment','../../config/license/util','status','end','offset','undefined','limit','set','Content-Range','json','apply','reject','save','then','sendStatus','error','stack','name','send','model','keys','License','filters','intersection','fields','attributes','length','merge','catch','update','body','find','params','get','key','downloadLogFile','join','/var','xcally','setHeader','Content-disposition','attachment;\x20filename=','Content-Type','text/plain','download','rimraf','fast-json-patch','mustache','util','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x1bfdfa,_0xada2a8){var _0x30dc94=function(_0x503eff){while(--_0x503eff){_0x1bfdfa['push'](_0x1bfdfa['shift']());}};_0x30dc94(++_0xada2a8);}(_0x6674,0xec));var _0x4667=function(_0x1aa937,_0x2d5a25){_0x1aa937=_0x1aa937-0x0;var _0x13f5b9=_0x6674[_0x1aa937];return _0x13f5b9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4667('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4667('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x4667('0x2'));var util=require(_0x4667('0x3'));var path=require('path');var sox=require('sox');var csv=require(_0x4667('0x4'));var ejs=require(_0x4667('0x5'));var fs=require('fs');var fs_extra=require(_0x4667('0x6'));var _=require(_0x4667('0x7'));var squel=require(_0x4667('0x8'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x4667('0x9'));var toCsv=require(_0x4667('0x4'));var querystring=require(_0x4667('0xa'));var Papa=require('papaparse');var Redis=require(_0x4667('0xb'));var authService=require('../../components/auth/service');var qs=require(_0x4667('0xc'));var as=require(_0x4667('0xd'));var hardwareService=require(_0x4667('0xe'));var logger=require(_0x4667('0xf'))(_0x4667('0x10'));var utils=require(_0x4667('0x11'));var config=require(_0x4667('0x12'));var licenseUtil=require(_0x4667('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x448156,_0x321c8c){_0x321c8c=_0x321c8c||0xcc;return function(_0x1889a7){if(_0x1889a7){return _0x448156['sendStatus'](_0x321c8c);}return _0x448156[_0x4667('0x14')](_0x321c8c)[_0x4667('0x15')]();};}function respondWithResult(_0x251876,_0x4a919f){_0x4a919f=_0x4a919f||0xc8;return function(_0xd34029){if(_0xd34029){return _0x251876['status'](_0x4a919f)['json'](_0xd34029);}};}function respondWithFilteredResult(_0x4768d4,_0x3641b2){return function(_0x54120d){if(_0x54120d){var _0x17f1d2=typeof _0x3641b2[_0x4667('0x16')]===_0x4667('0x17')&&typeof _0x3641b2[_0x4667('0x18')]===_0x4667('0x17');var _0x290833=_0x54120d['count'];var _0x478b95=_0x17f1d2?0x0:_0x3641b2[_0x4667('0x16')];var _0x34e6e6=_0x17f1d2?_0x54120d['count']:_0x3641b2[_0x4667('0x16')]+_0x3641b2[_0x4667('0x18')];var _0x3707bc;if(_0x34e6e6>=_0x290833){_0x34e6e6=_0x290833;_0x3707bc=0xc8;}else{_0x3707bc=0xce;}_0x4768d4[_0x4667('0x14')](_0x3707bc);return _0x4768d4[_0x4667('0x19')](_0x4667('0x1a'),_0x478b95+'-'+_0x34e6e6+'/'+_0x290833)[_0x4667('0x1b')](_0x54120d);}return null;};}function patchUpdates(_0x217c70){return function(_0x2cd9cf){try{jsonpatch[_0x4667('0x1c')](_0x2cd9cf,_0x217c70,!![]);}catch(_0x43f41b){return BPromise[_0x4667('0x1d')](_0x43f41b);}return _0x2cd9cf[_0x4667('0x1e')]();};}function saveUpdates(_0x43298c,_0x565309){return function(_0x46bc19){if(_0x46bc19){return _0x46bc19['update'](_0x43298c)['then'](function(_0x3e0bcc){return _0x3e0bcc;});}return null;};}function removeEntity(_0x124cbf,_0x3b3262){return function(_0x355b3d){if(_0x355b3d){return _0x355b3d['destroy']()[_0x4667('0x1f')](function(){_0x124cbf[_0x4667('0x14')](0xcc)[_0x4667('0x15')]();});}};}function handleEntityNotFound(_0x18c448,_0x4f8263){return function(_0x2fe1d){if(!_0x2fe1d){_0x18c448[_0x4667('0x20')](0x194);}return _0x2fe1d;};}function handleError(_0x5ded81,_0x497f8d){_0x497f8d=_0x497f8d||0x1f4;return function(_0x4224cf){logger[_0x4667('0x21')](_0x4224cf[_0x4667('0x22')]);if(_0x4224cf[_0x4667('0x23')]){delete _0x4224cf['name'];}_0x5ded81[_0x4667('0x14')](_0x497f8d)[_0x4667('0x24')](_0x4224cf);};}var utilLicense=require(_0x4667('0x13'));exports['index']=function(_0x55dd42,_0x4b0087){var _0x3131e1={'raw':!![],'where':{'id':0x1}},_0x56462c={};_0x56462c[_0x4667('0x25')]=_[_0x4667('0x26')](db[_0x4667('0x27')]['rawAttributes']);_0x56462c['query']=_['keys'](_0x55dd42['query']);_0x56462c[_0x4667('0x28')]=_[_0x4667('0x29')](_0x56462c[_0x4667('0x25')],_0x56462c['query']);_0x3131e1['attributes']=_[_0x4667('0x29')](_0x56462c[_0x4667('0x25')],qs['fields'](_0x55dd42['query'][_0x4667('0x2a')]));_0x3131e1[_0x4667('0x2b')]=_0x3131e1[_0x4667('0x2b')][_0x4667('0x2c')]?_0x3131e1[_0x4667('0x2b')]:_0x56462c[_0x4667('0x25')];_0x3131e1=_[_0x4667('0x2d')]({},_0x3131e1,_0x55dd42['options']);return utilLicense['getLicense'](_0x3131e1)[_0x4667('0x1f')](respondWithResult(_0x4b0087,null))[_0x4667('0x2e')](handleError(_0x4b0087,null));};exports[_0x4667('0x2f')]=function(_0x11f4fe,_0x54d55d){if(_0x11f4fe[_0x4667('0x30')]['id']){delete _0x11f4fe[_0x4667('0x30')]['id'];}return db[_0x4667('0x27')][_0x4667('0x31')]({'where':{'id':_0x11f4fe[_0x4667('0x32')]['id']}})[_0x4667('0x1f')](handleEntityNotFound(_0x54d55d,null))[_0x4667('0x1f')](function(_0x48a7af){var _0x5e7157=_0x48a7af[_0x4667('0x33')]({'plain':!![]});return utilLicense['checkLicense'](_0x5e7157,_0x11f4fe['body'][_0x4667('0x34')]);})[_0x4667('0x1f')](function(_0x853dd6){if(!_0x853dd6['demo']){return saveUpdates(_0x11f4fe['body'],null);}return _0x853dd6;})[_0x4667('0x1f')](respondWithResult(_0x54d55d,null))[_0x4667('0x2e')](handleError(_0x54d55d,null));};exports[_0x4667('0x35')]=function(_0x2b536d,_0x9aee0e){var _0x474f37='license-info.log';var _0x3673f5=path[_0x4667('0x36')](_0x4667('0x37'),'log',_0x4667('0x38'),_0x474f37);_0x9aee0e[_0x4667('0x39')](_0x4667('0x3a'),_0x4667('0x3b')+_0x474f37);_0x9aee0e[_0x4667('0x19')](_0x4667('0x3c'),_0x4667('0x3d'));_0x9aee0e[_0x4667('0x3e')](_0x3673f5);}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index 3d11e91..3d23e12 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 _0x95c0=['License','license','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment','exports','define'];(function(_0x480a53,_0x5d3f3e){var _0x24e1f2=function(_0x2015fb){while(--_0x2015fb){_0x480a53['push'](_0x480a53['shift']());}};_0x24e1f2(++_0x5d3f3e);}(_0x95c0,0x6e));var _0x095c=function(_0x36e018,_0x2ee761){_0x36e018=_0x36e018-0x0;var _0x4cebdb=_0x95c0[_0x36e018];return _0x4cebdb;};'use strict';var _=require(_0x095c('0x0'));var util=require(_0x095c('0x1'));var logger=require(_0x095c('0x2'))(_0x095c('0x3'));var moment=require(_0x095c('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x095c('0x5'));var rimraf=require(_0x095c('0x6'));var config=require(_0x095c('0x7'));var attributes=require('./license.attributes');module[_0x095c('0x8')]=function(_0x5e946c,_0x33c1ab){return _0x5e946c[_0x095c('0x9')](_0x095c('0xa'),attributes,{'tableName':_0x095c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9872=['./license.attributes','exports','License','license','lodash','util','api','moment','bluebird','request-promise','rimraf'];(function(_0x48eddc,_0x5729b2){var _0xc8e91f=function(_0x1df926){while(--_0x1df926){_0x48eddc['push'](_0x48eddc['shift']());}};_0xc8e91f(++_0x5729b2);}(_0x9872,0x9e));var _0x2987=function(_0x50f966,_0x391014){_0x50f966=_0x50f966-0x0;var _0x545849=_0x9872[_0x50f966];return _0x545849;};'use strict';var _=require(_0x2987('0x0'));var util=require(_0x2987('0x1'));var logger=require('../../config/logger')(_0x2987('0x2'));var moment=require(_0x2987('0x3'));var BPromise=require(_0x2987('0x4'));var rp=require(_0x2987('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2987('0x6'));var config=require('../../config/environment');var attributes=require(_0x2987('0x7'));module[_0x2987('0x8')]=function(_0x454e0e,_0x19d6c4){return _0x454e0e['define'](_0x2987('0x9'),attributes,{'tableName':_0x2987('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/license/license.rpc.js b/server/api/license/license.rpc.js index 7a1a97c..43cb828 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 _0xe0c4=['debug','License,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','License,\x20%s,\x20%s','message','info','result','catch','lodash','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then'];(function(_0x870b62,_0x2143f9){var _0x2dcb39=function(_0x2fb63d){while(--_0x2fb63d){_0x870b62['push'](_0x870b62['shift']());}};_0x2dcb39(++_0x2143f9);}(_0xe0c4,0x180));var _0x4e0c=function(_0x48fa1b,_0x369aa5){_0x48fa1b=_0x48fa1b-0x0;var _0x6b81a5=_0xe0c4[_0x48fa1b];return _0x6b81a5;};'use strict';var _=require(_0x4e0c('0x0'));var util=require('util');var moment=require(_0x4e0c('0x1'));var BPromise=require('bluebird');var rs=require(_0x4e0c('0x2'));var fs=require('fs');var Redis=require(_0x4e0c('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x4e0c('0x4'));var logger=require(_0x4e0c('0x5'))(_0x4e0c('0x6'));var config=require(_0x4e0c('0x7'));var jayson=require(_0x4e0c('0x8'));var client=jayson['client'][_0x4e0c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x41f78b,_0x18f5be,_0x2fc3ee){return new BPromise(function(_0x5632ba,_0xe7d9d6){return client[_0x4e0c('0xa')](_0x41f78b,_0x2fc3ee)[_0x4e0c('0xb')](function(_0x3b1a15){logger['info']('License,\x20%s,\x20%s',_0x18f5be,'request\x20sent');logger[_0x4e0c('0xc')](_0x4e0c('0xd'),_0x18f5be,_0x4e0c('0xe'),JSON['stringify'](_0x3b1a15));if(_0x3b1a15['error']){if(_0x3b1a15[_0x4e0c('0xf')][_0x4e0c('0x10')]===0x1f4){logger[_0x4e0c('0xf')](_0x4e0c('0x11'),_0x18f5be,_0x3b1a15[_0x4e0c('0xf')]['message']);return _0xe7d9d6(_0x3b1a15['error']['message']);}logger['error'](_0x4e0c('0x11'),_0x18f5be,_0x3b1a15[_0x4e0c('0xf')][_0x4e0c('0x12')]);return _0x5632ba(_0x3b1a15['error'][_0x4e0c('0x12')]);}else{logger[_0x4e0c('0x13')](_0x4e0c('0x11'),_0x18f5be,_0x4e0c('0xe'));_0x5632ba(_0x3b1a15[_0x4e0c('0x14')][_0x4e0c('0x12')]);}})[_0x4e0c('0x15')](function(_0x421448){logger['error'](_0x4e0c('0x11'),_0x18f5be,_0x421448);_0xe7d9d6(_0x421448);});});} \ No newline at end of file +var _0x2f47=['code','message','result','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','http','request','then','License,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x171cc3,_0x2fcf4b){var _0x184d96=function(_0x2e495c){while(--_0x2e495c){_0x171cc3['push'](_0x171cc3['shift']());}};_0x184d96(++_0x2fcf4b);}(_0x2f47,0x1a1));var _0x72f4=function(_0x538f97,_0x42d702){_0x538f97=_0x538f97-0x0;var _0xd0fcbe=_0x2f47[_0x538f97];return _0xd0fcbe;};'use strict';var _=require('lodash');var util=require(_0x72f4('0x0'));var moment=require(_0x72f4('0x1'));var BPromise=require(_0x72f4('0x2'));var rs=require(_0x72f4('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x72f4('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x72f4('0x5'))(_0x72f4('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x72f4('0x7')]({'port':0x232a});function respondWithRpcPromise(_0xc8a542,_0x132ad1,_0x3ae09f){return new BPromise(function(_0x3823b0,_0x40cee8){return client[_0x72f4('0x8')](_0xc8a542,_0x3ae09f)[_0x72f4('0x9')](function(_0x3331d7){logger['info'](_0x72f4('0xa'),_0x132ad1,_0x72f4('0xb'));logger[_0x72f4('0xc')]('License,\x20%s,\x20%s,\x20%s',_0x132ad1,_0x72f4('0xb'),JSON[_0x72f4('0xd')](_0x3331d7));if(_0x3331d7[_0x72f4('0xe')]){if(_0x3331d7[_0x72f4('0xe')][_0x72f4('0xf')]===0x1f4){logger[_0x72f4('0xe')](_0x72f4('0xa'),_0x132ad1,_0x3331d7['error'][_0x72f4('0x10')]);return _0x40cee8(_0x3331d7['error']['message']);}logger[_0x72f4('0xe')]('License,\x20%s,\x20%s',_0x132ad1,_0x3331d7[_0x72f4('0xe')][_0x72f4('0x10')]);return _0x3823b0(_0x3331d7[_0x72f4('0xe')][_0x72f4('0x10')]);}else{logger['info'](_0x72f4('0xa'),_0x132ad1,_0x72f4('0xb'));_0x3823b0(_0x3331d7[_0x72f4('0x11')]['message']);}})['catch'](function(_0x15b4ff){logger[_0x72f4('0xe')]('License,\x20%s,\x20%s',_0x132ad1,_0x15b4ff);_0x40cee8(_0x15b4ff);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index f136f89..c0b5c9b 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 _0xaa31=['getMessages','/:id/verify','/:id/users','getAgents','post','addImap','addSmtp','addInteraction','addApplications','/:id/send','put','update','removeDispositions','delete','removeAnswers','removeImap','removeSmtp','removeAgents','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./mailAccount.controller','get','isAuthenticated','index','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/in_servers','getImap','/:id/out_servers','/:id/interactions','/:id/applications','getApplications','/:id/messages'];(function(_0x247fa1,_0x4ec37c){var _0x244f35=function(_0xfb98be){while(--_0xfb98be){_0x247fa1['push'](_0x247fa1['shift']());}};_0x244f35(++_0x4ec37c);}(_0xaa31,0x94));var _0x1aa3=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xaa31[_0x4a9fb1];return _0x348672;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1aa3('0x0'));var timeout=require(_0x1aa3('0x1'));var express=require(_0x1aa3('0x2'));var router=express[_0x1aa3('0x3')]();var fs_extra=require(_0x1aa3('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x1aa3('0x5'));var config=require('../../config/environment');var controller=require(_0x1aa3('0x6'));router[_0x1aa3('0x7')]('/',auth[_0x1aa3('0x8')](),controller[_0x1aa3('0x9')]);router[_0x1aa3('0x7')]('/describe',auth[_0x1aa3('0x8')](),controller[_0x1aa3('0xa')]);router[_0x1aa3('0x7')](_0x1aa3('0xb'),auth[_0x1aa3('0x8')](),controller[_0x1aa3('0xc')]);router[_0x1aa3('0x7')](_0x1aa3('0xd'),auth['isAuthenticated'](),controller[_0x1aa3('0xe')]);router[_0x1aa3('0x7')](_0x1aa3('0xf'),auth[_0x1aa3('0x8')](),controller[_0x1aa3('0x10')]);router['get'](_0x1aa3('0x11'),auth[_0x1aa3('0x8')](),controller[_0x1aa3('0x12')]);router[_0x1aa3('0x7')](_0x1aa3('0x13'),auth[_0x1aa3('0x8')](),controller['getSmtp']);router[_0x1aa3('0x7')](_0x1aa3('0x14'),auth[_0x1aa3('0x8')](),controller['getInteractions']);router['get'](_0x1aa3('0x15'),auth[_0x1aa3('0x8')](),controller[_0x1aa3('0x16')]);router[_0x1aa3('0x7')](_0x1aa3('0x17'),auth['isAuthenticated'](),controller[_0x1aa3('0x18')]);router[_0x1aa3('0x7')](_0x1aa3('0x19'),auth[_0x1aa3('0x8')](),controller['verifySmtp']);router[_0x1aa3('0x7')](_0x1aa3('0x1a'),auth[_0x1aa3('0x8')](),controller[_0x1aa3('0x1b')]);router[_0x1aa3('0x1c')]('/:id/dispositions',auth[_0x1aa3('0x8')](),controller['addDisposition']);router[_0x1aa3('0x1c')]('/:id/canned_answers',auth[_0x1aa3('0x8')](),controller['addAnswer']);router[_0x1aa3('0x1c')]('/',auth[_0x1aa3('0x8')](),controller['create']);router[_0x1aa3('0x1c')](_0x1aa3('0x11'),auth[_0x1aa3('0x8')](),controller[_0x1aa3('0x1d')]);router['post'](_0x1aa3('0x13'),auth[_0x1aa3('0x8')](),controller[_0x1aa3('0x1e')]);router[_0x1aa3('0x1c')](_0x1aa3('0x14'),auth[_0x1aa3('0x8')](),controller[_0x1aa3('0x1f')]);router[_0x1aa3('0x1c')](_0x1aa3('0x15'),auth[_0x1aa3('0x8')](),controller[_0x1aa3('0x20')]);router[_0x1aa3('0x1c')](_0x1aa3('0x21'),auth[_0x1aa3('0x8')](),controller['send']);router[_0x1aa3('0x1c')](_0x1aa3('0x1a'),auth[_0x1aa3('0x8')](),controller['addAgents']);router[_0x1aa3('0x22')](_0x1aa3('0xb'),auth[_0x1aa3('0x8')](),controller[_0x1aa3('0x23')]);router['delete'](_0x1aa3('0xd'),auth['isAuthenticated'](),controller[_0x1aa3('0x24')]);router[_0x1aa3('0x25')](_0x1aa3('0xf'),auth[_0x1aa3('0x8')](),controller[_0x1aa3('0x26')]);router['delete']('/:id/in_servers',auth[_0x1aa3('0x8')](),controller[_0x1aa3('0x27')]);router[_0x1aa3('0x25')]('/:id/out_servers',auth[_0x1aa3('0x8')](),controller[_0x1aa3('0x28')]);router['delete'](_0x1aa3('0xb'),auth['isAuthenticated'](),controller['destroy']);router[_0x1aa3('0x25')](_0x1aa3('0x1a'),auth[_0x1aa3('0x8')](),controller[_0x1aa3('0x29')]);module[_0x1aa3('0x2a')]=router; \ No newline at end of file +var _0x7b43=['/:id/send','send','addAgents','put','update','delete','removeDispositions','removeAnswers','removeImap','removeSmtp','destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailAccount.controller','isAuthenticated','index','get','/:id','show','/:id/dispositions','getDispositions','getAnswers','getImap','/:id/out_servers','getSmtp','/:id/interactions','/:id/applications','getApplications','/:id/messages','getMessages','/:id/verify','verifySmtp','/:id/users','getAgents','addDisposition','post','/:id/canned_answers','create','/:id/in_servers','addSmtp'];(function(_0x33490e,_0x5e8b16){var _0x3fa5f1=function(_0x3e24d9){while(--_0x3e24d9){_0x33490e['push'](_0x33490e['shift']());}};_0x3fa5f1(++_0x5e8b16);}(_0x7b43,0x1a9));var _0x37b4=function(_0x4a797a,_0x4f6329){_0x4a797a=_0x4a797a-0x0;var _0x126ef6=_0x7b43[_0x4a797a];return _0x126ef6;};'use strict';var multer=require(_0x37b4('0x0'));var util=require(_0x37b4('0x1'));var path=require(_0x37b4('0x2'));var timeout=require('connect-timeout');var express=require(_0x37b4('0x3'));var router=express[_0x37b4('0x4')]();var fs_extra=require(_0x37b4('0x5'));var auth=require(_0x37b4('0x6'));var interaction=require(_0x37b4('0x7'));var config=require('../../config/environment');var controller=require(_0x37b4('0x8'));router['get']('/',auth[_0x37b4('0x9')](),controller[_0x37b4('0xa')]);router[_0x37b4('0xb')]('/describe',auth['isAuthenticated'](),controller['describe']);router['get'](_0x37b4('0xc'),auth['isAuthenticated'](),controller[_0x37b4('0xd')]);router[_0x37b4('0xb')](_0x37b4('0xe'),auth['isAuthenticated'](),controller[_0x37b4('0xf')]);router[_0x37b4('0xb')]('/:id/canned_answers',auth[_0x37b4('0x9')](),controller[_0x37b4('0x10')]);router[_0x37b4('0xb')]('/:id/in_servers',auth['isAuthenticated'](),controller[_0x37b4('0x11')]);router[_0x37b4('0xb')](_0x37b4('0x12'),auth[_0x37b4('0x9')](),controller[_0x37b4('0x13')]);router['get'](_0x37b4('0x14'),auth['isAuthenticated'](),controller['getInteractions']);router[_0x37b4('0xb')](_0x37b4('0x15'),auth[_0x37b4('0x9')](),controller[_0x37b4('0x16')]);router[_0x37b4('0xb')](_0x37b4('0x17'),auth[_0x37b4('0x9')](),controller[_0x37b4('0x18')]);router[_0x37b4('0xb')](_0x37b4('0x19'),auth[_0x37b4('0x9')](),controller[_0x37b4('0x1a')]);router[_0x37b4('0xb')](_0x37b4('0x1b'),auth[_0x37b4('0x9')](),controller[_0x37b4('0x1c')]);router['post'](_0x37b4('0xe'),auth['isAuthenticated'](),controller[_0x37b4('0x1d')]);router[_0x37b4('0x1e')](_0x37b4('0x1f'),auth[_0x37b4('0x9')](),controller['addAnswer']);router[_0x37b4('0x1e')]('/',auth[_0x37b4('0x9')](),controller[_0x37b4('0x20')]);router[_0x37b4('0x1e')](_0x37b4('0x21'),auth[_0x37b4('0x9')](),controller['addImap']);router[_0x37b4('0x1e')]('/:id/out_servers',auth[_0x37b4('0x9')](),controller[_0x37b4('0x22')]);router[_0x37b4('0x1e')]('/:id/interactions',auth[_0x37b4('0x9')](),controller['addInteraction']);router[_0x37b4('0x1e')](_0x37b4('0x15'),auth['isAuthenticated'](),controller['addApplications']);router[_0x37b4('0x1e')](_0x37b4('0x23'),auth[_0x37b4('0x9')](),controller[_0x37b4('0x24')]);router[_0x37b4('0x1e')](_0x37b4('0x1b'),auth[_0x37b4('0x9')](),controller[_0x37b4('0x25')]);router[_0x37b4('0x26')](_0x37b4('0xc'),auth[_0x37b4('0x9')](),controller[_0x37b4('0x27')]);router[_0x37b4('0x28')](_0x37b4('0xe'),auth[_0x37b4('0x9')](),controller[_0x37b4('0x29')]);router[_0x37b4('0x28')](_0x37b4('0x1f'),auth[_0x37b4('0x9')](),controller[_0x37b4('0x2a')]);router[_0x37b4('0x28')](_0x37b4('0x21'),auth[_0x37b4('0x9')](),controller[_0x37b4('0x2b')]);router[_0x37b4('0x28')](_0x37b4('0x12'),auth['isAuthenticated'](),controller[_0x37b4('0x2c')]);router[_0x37b4('0x28')]('/:id',auth[_0x37b4('0x9')](),controller[_0x37b4('0x2d')]);router[_0x37b4('0x28')](_0x37b4('0x1b'),auth[_0x37b4('0x9')](),controller['removeAgents']);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 2fb4ff6..e502074 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 _0x7ea5=['TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','gmail','hotmail','outlook365','getDataValue','provider','custom','sequelize','exports','STRING','BOOLEAN','UNSIGNED'];(function(_0x90f34f,_0x404021){var _0x4b18cf=function(_0x25112d){while(--_0x25112d){_0x90f34f['push'](_0x90f34f['shift']());}};_0x4b18cf(++_0x404021);}(_0x7ea5,0x1f3));var _0x57ea=function(_0x22f98e,_0xe01ed5){_0x22f98e=_0x22f98e-0x0;var _0x450ccc=_0x7ea5[_0x22f98e];return _0x450ccc;};'use strict';var Sequelize=require(_0x57ea('0x0'));module[_0x57ea('0x1')]={'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0x57ea('0x2')],'allowNull':![]},'service':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x57ea('0x3')],'defaultValue':!![]},'key':{'type':Sequelize[_0x57ea('0x2')],'allowNull':![]},'template':{'type':Sequelize['TEXT']},'markAsUnread':{'type':Sequelize[_0x57ea('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x57ea('0x2')],'allowNull':![],'defaultValue':'Arial,Helvetica,sans-serif'},'fontSize':{'type':Sequelize['INTEGER'](0x2)[_0x57ea('0x4')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x57ea('0x5')],'defaultValue':function(){return _0x57ea('0x6');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x57ea('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x57ea('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x57ea('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x57ea('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x57ea('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x57ea('0x7')],'allowNull':!![],'defaultValue':null,'comment':_0x57ea('0x8')},'mandatoryDisposition':{'type':Sequelize[_0x57ea('0x3')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x535150){if(!_0x535150)this[_0x57ea('0x9')](_0x57ea('0xa'),null);this[_0x57ea('0x9')](_0x57ea('0xb'),_0x535150);}},'provider':{'type':Sequelize['ENUM'](_0x57ea('0xc'),_0x57ea('0xd'),'yahoo',_0x57ea('0xe')),'defaultValue':null,'get':function(){if(!this[_0x57ea('0xf')](_0x57ea('0x10')))return _0x57ea('0x11');return this[_0x57ea('0xf')](_0x57ea('0x10'));},'set':function(_0x110e41){if(_0x110e41==='custom')_0x110e41=null;return this[_0x57ea('0x9')](_0x57ea('0x10'),_0x110e41);}}}; \ No newline at end of file +var _0x7ca7=['setDataValue','mandatoryDisposition','getDataValue','provider','custom','sequelize','exports','STRING','BOOLEAN','Arial,Helvetica,sans-serif','INTEGER','UNSIGNED','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'];(function(_0x4fa48f,_0x566172){var _0xa2c114=function(_0x278581){while(--_0x278581){_0x4fa48f['push'](_0x4fa48f['shift']());}};_0xa2c114(++_0x566172);}(_0x7ca7,0x1e5));var _0x77ca=function(_0x3a8db5,_0x31cff7){_0x3a8db5=_0x3a8db5-0x0;var _0x2c03cd=_0x7ca7[_0x3a8db5];return _0x2c03cd;};'use strict';var Sequelize=require(_0x77ca('0x0'));module[_0x77ca('0x1')]={'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0x77ca('0x2')],'allowNull':![]},'service':{'type':Sequelize[_0x77ca('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x77ca('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x77ca('0x3')],'defaultValue':!![]},'key':{'type':Sequelize[_0x77ca('0x2')],'allowNull':![]},'template':{'type':Sequelize['TEXT']},'markAsUnread':{'type':Sequelize[_0x77ca('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x77ca('0x4')},'fontSize':{'type':Sequelize[_0x77ca('0x5')](0x2)[_0x77ca('0x6')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x77ca('0x7')],'defaultValue':function(){return _0x77ca('0x8');}},'notificationSound':{'type':Sequelize[_0x77ca('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x77ca('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x77ca('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x77ca('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x77ca('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x77ca('0x5')],'allowNull':!![],'defaultValue':null,'comment':_0x77ca('0x9')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x177148){if(!_0x177148)this[_0x77ca('0xa')]('mandatoryDispositionPauseId',null);this['setDataValue'](_0x77ca('0xb'),_0x177148);}},'provider':{'type':Sequelize['ENUM']('gmail','hotmail','yahoo','outlook365'),'defaultValue':null,'get':function(){if(!this[_0x77ca('0xc')](_0x77ca('0xd')))return _0x77ca('0xe');return this[_0x77ca('0xc')](_0x77ca('0xd'));},'set':function(_0x3f831a){if(_0x3f831a===_0x77ca('0xe'))_0x3f831a=null;return this['setDataValue'](_0x77ca('0xd'),_0x3f831a);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index b2bb887..3ae3aae 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 _0x7439=['result','catch','sendStatus','status','end','undefined','count','update','destroy','get','MailAccounts','stack','gmail','imap.gmail.com','hotmail','outlook.office365.com','Unknown\x20email\x20service\x20provider','yahoo','smtp.mail.yahoo.com','outlook365','smtp.office365.com','user','username','password','modernAuthentication','CloudProviderId','pass','host','port','secure','authentication','Imap','index','MailServerIn','MailServerOut','Pause','map','MailAccount','fieldName','type','key','query','keys','model','attributes','fields','length','hasOwnProperty','nolimit','limit','offset','order','sort','where','pick','filters','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','Smtp','rawAttributes','intersection','options','find','body','provider','custom','Mail\x20Account\x20not\x20found','service','describe','addDisposition','Disposition','create','getDispositions','MailAccountId','removeDispositions','ids','addAnswer','findOne','CannedAnswer','removeAnswers','name','email','ListId','isNil','active','description','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','getSmtp','removeSmtp','setSmtp','omit','getInteractions','MailInteraction','CmContact','Owner','internal','Tag','Tags','color','tag','ISOLATION_LEVELS','READ_COMMITTED','MailApplication','bulkCreate','findAndCountAll','send','getApplications','getMessages','MailMessage','$gte','split','format','inlineCss','true','CmList','List','Contacts','updatedAt','CloudProvider','Smtp\x20configuration\x20not\x20found','from','%s\x20<%s>','attachments','join','root','server/files/attachments','basename','getSmtpOptions','SendMail','sendMail','defaults','messageId','attach','YYYY-MM-DD\x20HH:mm:ss','out','Interaction','Messages','verifySmtp','VerifySmtp','Sequelize','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','emit','userMailAccount:save','userMailAccount:remove','getAgents','User','bluebird','path','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','localhost','socket.io-emitter','redis','./mailAccount.socket','jayson/promise','client','http','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x1094d3,_0x35babc){var _0x21c8f7=function(_0x115b4c){while(--_0x115b4c){_0x1094d3['push'](_0x1094d3['shift']());}};_0x21c8f7(++_0x35babc);}(_0x7439,0x15c));var _0x9743=function(_0x271a64,_0x53b70c){_0x271a64=_0x271a64-0x0;var _0x97423=_0x7439[_0x271a64];return _0x97423;};'use strict';var moment=require('moment');var BPromise=require(_0x9743('0x0'));var util=require('util');var path=require(_0x9743('0x1'));var _=require('lodash');var juice=require('juice');var Redis=require('ioredis');var qs=require(_0x9743('0x2'));var logger=require(_0x9743('0x3'))(_0x9743('0x4'));var config=require(_0x9743('0x5'));var db=require(_0x9743('0x6'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0x9743('0x7'),'port':0x18eb});var socket=require(_0x9743('0x8'))(new Redis(config[_0x9743('0x9')]));require(_0x9743('0xa'))['register'](socket);var jayson=require(_0x9743('0xb'));var client=jayson[_0x9743('0xc')][_0x9743('0xd')]({'port':0x232b});function respondWithRpcPromise(_0xfb1b2c,_0x3d67c3,_0x1fbd69,_0xb533f7){return new BPromise(function(_0x4ece7a,_0x3ba77c){var _0x1807a8=_0xb533f7||client;return _0x1807a8[_0x9743('0xe')](_0xfb1b2c,_0x1fbd69)[_0x9743('0xf')](function(_0x5eebb6){logger[_0x9743('0x10')](_0x9743('0x11'),_0x3d67c3,_0x9743('0x12'));logger[_0x9743('0x13')](_0x9743('0x14'),_0x3d67c3,'request\x20sent',JSON[_0x9743('0x15')](_0x5eebb6));if(_0x5eebb6['error']){if(_0x5eebb6[_0x9743('0x16')]['code']===0x1f4){logger['error'](_0x9743('0x11'),_0x3d67c3,_0x5eebb6[_0x9743('0x16')][_0x9743('0x17')]);return _0x3ba77c(_0x5eebb6[_0x9743('0x16')][_0x9743('0x17')]);}logger['error'](_0x9743('0x11'),_0x3d67c3,_0x5eebb6[_0x9743('0x16')][_0x9743('0x17')]);return _0x4ece7a(_0x5eebb6['error'][_0x9743('0x17')]);}else{logger['info'](_0x9743('0x11'),_0x3d67c3,_0x9743('0x12'));_0x4ece7a(_0x5eebb6[_0x9743('0x18')][_0x9743('0x17')]);}})[_0x9743('0x19')](function(_0x6529ae){logger['error']('MailAccount,\x20%s,\x20%s',_0x3d67c3,_0x6529ae);_0x3ba77c(_0x6529ae);});});}function respondWithStatusCode(_0x3d7aee,_0x224ad1){_0x224ad1=_0x224ad1||0xcc;return function(_0x33f6d8){if(_0x33f6d8){return _0x3d7aee[_0x9743('0x1a')](_0x224ad1);}return _0x3d7aee[_0x9743('0x1b')](_0x224ad1)[_0x9743('0x1c')]();};}function respondWithResult(_0x28806b,_0x44d3ee){_0x44d3ee=_0x44d3ee||0xc8;return function(_0x885f12){if(_0x885f12){return _0x28806b[_0x9743('0x1b')](_0x44d3ee)['json'](_0x885f12);}};}function respondWithFilteredResult(_0x1cb2f0,_0x702066){return function(_0x5cb278){if(_0x5cb278){var _0x5ed1bd=typeof _0x702066['offset']==='undefined'&&typeof _0x702066['limit']===_0x9743('0x1d');var _0x11eecb=_0x5cb278['count'];var _0xf3aeb9=_0x5ed1bd?0x0:_0x702066['offset'];var _0x40f3e7=_0x5ed1bd?_0x5cb278[_0x9743('0x1e')]:_0x702066['offset']+_0x702066['limit'];var _0x2f58c0;if(_0x40f3e7>=_0x11eecb){_0x40f3e7=_0x11eecb;_0x2f58c0=0xc8;}else{_0x2f58c0=0xce;}_0x1cb2f0[_0x9743('0x1b')](_0x2f58c0);return _0x1cb2f0['set']('Content-Range',_0xf3aeb9+'-'+_0x40f3e7+'/'+_0x11eecb)['json'](_0x5cb278);}return null;};}function saveUpdates(_0x166ea0){return function(_0x427585){if(_0x427585){return _0x427585[_0x9743('0x1f')](_0x166ea0)[_0x9743('0xf')](function(_0x466ecf){return _0x466ecf;});}return null;};}function removeEntity(_0x5bacc1){return function(_0xbb282e){if(_0xbb282e){return _0xbb282e[_0x9743('0x20')]()[_0x9743('0xf')](function(){var _0x5fe1a0=_0xbb282e[_0x9743('0x21')]({'plain':!![]});var _0x3ab5de=_0x9743('0x22');return db['UserProfileResource'][_0x9743('0x20')]({'where':{'type':_0x3ab5de,'resourceId':_0x5fe1a0['id']}})[_0x9743('0xf')](function(){return _0xbb282e;});})['then'](function(){_0x5bacc1['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5a06b4){return function(_0x362868){if(!_0x362868){_0x5a06b4['sendStatus'](0x194);}return _0x362868;};}function handleError(_0x1ad54a,_0x3e794b){_0x3e794b=_0x3e794b||0x1f4;return function(_0x42b62e){logger[_0x9743('0x16')](_0x42b62e[_0x9743('0x23')]);if(_0x42b62e['name']){delete _0x42b62e['name'];}_0x1ad54a[_0x9743('0x1b')](_0x3e794b)['send'](_0x42b62e);};}function getImapHost(_0x154aa1){switch(_0x154aa1){case _0x9743('0x24'):return _0x9743('0x25');case'yahoo':return'imap.mail.yahoo.com';case _0x9743('0x26'):return'imap-mail.outlook.com';case'outlook365':return _0x9743('0x27');}throw new Error(_0x9743('0x28'),_0x154aa1);}function getSmtpHost(_0x5ad32f){switch(_0x5ad32f){case'gmail':return'smtp.gmail.com';case _0x9743('0x29'):return _0x9743('0x2a');case _0x9743('0x26'):return'smtp-mail.outlook.com';case _0x9743('0x2b'):return _0x9743('0x2c');}throw new Error('Unknown\x20email\x20service\x20provider',_0x5ad32f);}function getAuthenticationOptions(_0xc17536,_0x4d0060){var _0x21150f={};var _0x56090f={};if(_0xc17536){_0x21150f['user']=_0x56090f[_0x9743('0x2d')]=_0x4d0060[_0x9743('0x2e')];_0x21150f[_0x9743('0x2f')]=_0x56090f['pass']=_0x4d0060[_0x9743('0x2f')];if(_0x4d0060[_0x9743('0x30')]){_0x21150f[_0x9743('0x30')]=_0x56090f[_0x9743('0x30')]=!![];_0x21150f[_0x9743('0x31')]=_0x56090f['CloudProviderId']=_0x4d0060[_0x9743('0x31')];_0x21150f[_0x9743('0x2f')]=_0x56090f[_0x9743('0x32')]=null;}else{_0x21150f[_0x9743('0x31')]=_0x56090f[_0x9743('0x31')]=null;}_0x21150f[_0x9743('0x33')]=getImapHost(_0xc17536);_0x21150f[_0x9743('0x34')]=0x3e1;_0x56090f[_0x9743('0x33')]=getSmtpHost(_0xc17536);_0x56090f['port']=0x24b;_0x56090f[_0x9743('0x35')]=![];_0x21150f['service']=_0x56090f['service']=null;}else{if(_0x4d0060[_0x9743('0x36')]){_0x21150f[_0x9743('0x2d')]=_0x56090f[_0x9743('0x2d')]=_0x4d0060['username'];_0x21150f[_0x9743('0x2f')]=_0x56090f[_0x9743('0x32')]=_0x4d0060[_0x9743('0x2f')];}else{_0x21150f[_0x9743('0x36')]=_0x56090f[_0x9743('0x36')]=![];_0x21150f['user']=_0x56090f[_0x9743('0x2d')]=null;_0x21150f[_0x9743('0x2f')]=_0x56090f[_0x9743('0x32')]=null;}_0x21150f[_0x9743('0x33')]=_0x4d0060[_0x9743('0x37')][_0x9743('0x33')];_0x21150f[_0x9743('0x34')]=_0x4d0060[_0x9743('0x37')][_0x9743('0x34')];_0x56090f['host']=_0x4d0060['Smtp']['host'];_0x56090f['port']=_0x4d0060['Smtp'][_0x9743('0x34')];}return{'Imap':_0x21150f,'Smtp':_0x56090f};}exports[_0x9743('0x38')]=function(_0x250d56,_0x56a3a3){var _0x5f3ed2={'include':[{'model':db[_0x9743('0x39')],'as':_0x9743('0x37')},{'model':db[_0x9743('0x3a')],'as':'Smtp'},{'model':db[_0x9743('0x3b')],'as':'mandatoryDispositionPause'}]},_0x4e2bac={},_0x13ef34={'count':0x0,'rows':[]};var _0x9e38e1=_[_0x9743('0x3c')](db[_0x9743('0x3d')]['rawAttributes'],function(_0x176c87){return{'name':_0x176c87[_0x9743('0x3e')],'type':_0x176c87[_0x9743('0x3f')][_0x9743('0x40')]};});_0x4e2bac['model']=_[_0x9743('0x3c')](_0x9e38e1,'name');_0x4e2bac[_0x9743('0x41')]=_[_0x9743('0x42')](_0x250d56[_0x9743('0x41')]);_0x4e2bac['filters']=_['intersection'](_0x4e2bac[_0x9743('0x43')],_0x4e2bac[_0x9743('0x41')]);_0x5f3ed2[_0x9743('0x44')]=_['intersection'](_0x4e2bac['model'],qs[_0x9743('0x45')](_0x250d56[_0x9743('0x41')][_0x9743('0x45')]));_0x5f3ed2[_0x9743('0x44')]=_0x5f3ed2[_0x9743('0x44')][_0x9743('0x46')]?_0x5f3ed2['attributes']:_0x4e2bac[_0x9743('0x43')];if(!_0x250d56[_0x9743('0x41')][_0x9743('0x47')](_0x9743('0x48'))){_0x5f3ed2[_0x9743('0x49')]=qs[_0x9743('0x49')](_0x250d56[_0x9743('0x41')][_0x9743('0x49')]);_0x5f3ed2[_0x9743('0x4a')]=qs[_0x9743('0x4a')](_0x250d56['query'][_0x9743('0x4a')]);}_0x5f3ed2[_0x9743('0x4b')]=qs[_0x9743('0x4c')](_0x250d56['query'][_0x9743('0x4c')]);_0x5f3ed2[_0x9743('0x4d')]=qs['filters'](_[_0x9743('0x4e')](_0x250d56[_0x9743('0x41')],_0x4e2bac[_0x9743('0x4f')]),_0x9e38e1);if(_0x250d56[_0x9743('0x41')][_0x9743('0x50')]){_0x5f3ed2[_0x9743('0x4d')]=_[_0x9743('0x51')](_0x5f3ed2[_0x9743('0x4d')],{'$or':_[_0x9743('0x3c')](_0x9e38e1,function(_0x44c0e5){if(_0x44c0e5[_0x9743('0x3f')]!==_0x9743('0x52')){var _0xb917b5={};_0xb917b5[_0x44c0e5['name']]={'$like':'%'+_0x250d56[_0x9743('0x41')]['filter']+'%'};return _0xb917b5;}})});}_0x5f3ed2=_[_0x9743('0x51')]({},_0x5f3ed2,_0x250d56['options']);var _0x1fee2c={'where':_0x5f3ed2[_0x9743('0x4d')]};return db[_0x9743('0x3d')][_0x9743('0x1e')](_0x1fee2c)['then'](function(_0x4c8c2a){_0x13ef34[_0x9743('0x1e')]=_0x4c8c2a;if(_0x250d56['query'][_0x9743('0x53')]){_0x5f3ed2[_0x9743('0x54')]=[{'all':!![]}];}return db[_0x9743('0x3d')][_0x9743('0x55')](_0x5f3ed2);})[_0x9743('0xf')](function(_0x1cd241){_0x13ef34[_0x9743('0x56')]=_0x1cd241;return _0x13ef34;})[_0x9743('0xf')](respondWithFilteredResult(_0x56a3a3,_0x5f3ed2))['catch'](handleError(_0x56a3a3,null));};exports[_0x9743('0x57')]=function(_0x275b30,_0x4117e4){var _0x40f619={'raw':![],'where':{'id':_0x275b30[_0x9743('0x58')]['id']},'include':[{'model':db[_0x9743('0x39')],'as':_0x9743('0x37')},{'model':db[_0x9743('0x3a')],'as':_0x9743('0x59')},{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x22b9ee={};_0x22b9ee[_0x9743('0x43')]=_[_0x9743('0x42')](db['MailAccount'][_0x9743('0x5a')]);_0x22b9ee['query']=_[_0x9743('0x42')](_0x275b30[_0x9743('0x41')]);_0x22b9ee['filters']=_[_0x9743('0x5b')](_0x22b9ee[_0x9743('0x43')],_0x22b9ee[_0x9743('0x41')]);_0x40f619[_0x9743('0x44')]=_[_0x9743('0x5b')](_0x22b9ee[_0x9743('0x43')],qs[_0x9743('0x45')](_0x275b30[_0x9743('0x41')][_0x9743('0x45')]));_0x40f619[_0x9743('0x44')]=_0x40f619[_0x9743('0x44')]['length']?_0x40f619[_0x9743('0x44')]:_0x22b9ee[_0x9743('0x43')];if(_0x275b30[_0x9743('0x41')][_0x9743('0x53')]){_0x40f619[_0x9743('0x54')]=[{'all':!![]}];}_0x40f619=_['merge']({},_0x40f619,_0x275b30[_0x9743('0x5c')]);return db[_0x9743('0x3d')][_0x9743('0x5d')](_0x40f619)[_0x9743('0xf')](handleEntityNotFound(_0x4117e4,null))[_0x9743('0xf')](respondWithResult(_0x4117e4,null))['catch'](handleError(_0x4117e4,null));};exports['update']=function(_0x2a6325,_0xe3979c){if(_0x2a6325[_0x9743('0x5e')]['id']){delete _0x2a6325[_0x9743('0x5e')]['id'];}var _0x4a24d1=_0x2a6325[_0x9743('0x5e')][_0x9743('0x5f')]===_0x9743('0x60')?null:_0x2a6325[_0x9743('0x5e')][_0x9743('0x5f')];var _0x2309bd=_0x2a6325[_0x9743('0x5e')][_0x9743('0x37')]||{};var _0x43ef40=_0x2a6325[_0x9743('0x5e')][_0x9743('0x59')]||{};if(_0x4a24d1){_0x2309bd[_0x9743('0x33')]=getImapHost(_0x4a24d1);_0x2309bd[_0x9743('0x34')]=0x3e1;_0x43ef40[_0x9743('0x33')]=getSmtpHost(_0x4a24d1);_0x43ef40['port']=0x24b;_0x43ef40['secure']=![];}if(_0x43ef40[_0x9743('0x30')]){_0x43ef40[_0x9743('0x35')]=![];}else{_0x43ef40[_0x9743('0x31')]=null;}if(!_0x2309bd[_0x9743('0x30')])_0x2309bd[_0x9743('0x31')]=null;_0x2a6325[_0x9743('0x5e')][_0x9743('0x37')]=_0x2309bd;_0x2a6325[_0x9743('0x5e')]['Smtp']=_0x43ef40;return db[_0x9743('0x3d')][_0x9743('0x5d')]({'where':{'id':_0x2a6325['params']['id']},'include':[{'model':db[_0x9743('0x39')],'as':'Imap'},{'model':db[_0x9743('0x3a')],'as':_0x9743('0x59')},{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})[_0x9743('0xf')](handleEntityNotFound(_0xe3979c,null))[_0x9743('0xf')](function(_0x3c8fdb){if(!_0x3c8fdb)throw new Error(_0x9743('0x61'));if(_0x3c8fdb[_0x9743('0x62')])delete _0x2a6325[_0x9743('0x5e')][_0x9743('0x37')];return _0x3c8fdb;})[_0x9743('0xf')](saveUpdates(_0x2a6325['body'],null))[_0x9743('0xf')](function(_0x9d336){if(!_0x2a6325[_0x9743('0x5e')][_0x9743('0x37')])return _0x9d336;return db['MailServerIn'][_0x9743('0x1f')](_0x2a6325['body'][_0x9743('0x37')],{'where':{'MailAccountId':_0x9d336['id']}})['then'](function(){return _0x9d336;});})[_0x9743('0xf')](function(_0xc0ebcf){if(!_0x2a6325['body'][_0x9743('0x59')])return _0xc0ebcf;return db[_0x9743('0x3a')][_0x9743('0x1f')](_0x2a6325[_0x9743('0x5e')]['Smtp'],{'where':{'MailAccountId':_0xc0ebcf['id']}})['then'](function(){return _0xc0ebcf;});})[_0x9743('0xf')](respondWithResult(_0xe3979c,null))['catch'](handleError(_0xe3979c,null));};exports[_0x9743('0x63')]=function(_0x5846aa,_0x521e68){return db[_0x9743('0x3d')][_0x9743('0x63')]()[_0x9743('0xf')](respondWithResult(_0x521e68,null))['catch'](handleError(_0x521e68,null));};exports[_0x9743('0x64')]=function(_0x502f55,_0x31a15b){if(_0x502f55[_0x9743('0x5e')]['id']){delete _0x502f55['body']['id'];}return db[_0x9743('0x3d')][_0x9743('0x5d')]({'where':{'id':_0x502f55[_0x9743('0x58')]['id']}})[_0x9743('0xf')](handleEntityNotFound(_0x31a15b,null))[_0x9743('0xf')](function(_0x4d4bb3){if(_0x4d4bb3){_0x502f55['body']['MailAccountId']=_0x4d4bb3['id'];return db[_0x9743('0x65')][_0x9743('0x66')](_0x502f55[_0x9743('0x5e')]);}})[_0x9743('0xf')](respondWithResult(_0x31a15b,null))[_0x9743('0x19')](handleError(_0x31a15b,null));};exports[_0x9743('0x67')]=function(_0x5aa209,_0x865742){var _0x5386ce={'raw':![],'where':{}};var _0x2ecd79={};var _0x5a29cc={'count':0x0,'rows':[]};return db[_0x9743('0x3d')]['findOne']({'where':{'id':_0x5aa209['params']['id']}})[_0x9743('0xf')](handleEntityNotFound(_0x865742,null))[_0x9743('0xf')](function(_0x1e1c75){if(_0x1e1c75){_0x2ecd79['model']=_[_0x9743('0x42')](db[_0x9743('0x65')][_0x9743('0x5a')]);_0x2ecd79[_0x9743('0x41')]=_[_0x9743('0x42')](_0x5aa209['query']);_0x2ecd79[_0x9743('0x4f')]=_[_0x9743('0x5b')](_0x2ecd79[_0x9743('0x43')],_0x2ecd79['query']);_0x5386ce[_0x9743('0x44')]=_[_0x9743('0x5b')](_0x2ecd79[_0x9743('0x43')],qs[_0x9743('0x45')](_0x5aa209['query'][_0x9743('0x45')]));_0x5386ce[_0x9743('0x44')]=_0x5386ce['attributes'][_0x9743('0x46')]?_0x5386ce[_0x9743('0x44')]:_0x2ecd79[_0x9743('0x43')];if(!_0x5aa209[_0x9743('0x41')][_0x9743('0x47')](_0x9743('0x48'))){_0x5386ce['limit']=qs[_0x9743('0x49')](_0x5aa209[_0x9743('0x41')][_0x9743('0x49')]);_0x5386ce[_0x9743('0x4a')]=qs[_0x9743('0x4a')](_0x5aa209['query'][_0x9743('0x4a')]);}_0x5386ce[_0x9743('0x4b')]=qs[_0x9743('0x4c')](_0x5aa209[_0x9743('0x41')]['sort']);_0x5386ce[_0x9743('0x4d')]=qs[_0x9743('0x4f')](_[_0x9743('0x4e')](_0x5aa209[_0x9743('0x41')],_0x2ecd79[_0x9743('0x4f')]));_0x5386ce['where'][_0x9743('0x68')]=_0x1e1c75['id'];if(_0x5aa209[_0x9743('0x41')]['filter']){_0x5386ce['where']=_[_0x9743('0x51')](_0x5386ce[_0x9743('0x4d')],{'$or':_[_0x9743('0x3c')](_0x5386ce[_0x9743('0x44')],function(_0x530991){var _0x25b364={};_0x25b364[_0x530991]={'$like':'%'+_0x5aa209['query'][_0x9743('0x50')]+'%'};return _0x25b364;})});}_0x5386ce=_['merge']({},_0x5386ce,_0x5aa209[_0x9743('0x5c')]);return db[_0x9743('0x65')][_0x9743('0x1e')]({'where':_0x5386ce['where']})[_0x9743('0xf')](function(_0x13c97c){_0x5a29cc[_0x9743('0x1e')]=_0x13c97c;if(_0x5aa209[_0x9743('0x41')]['includeAll']){_0x5386ce[_0x9743('0x54')]=[{'all':!![]}];}return db[_0x9743('0x65')][_0x9743('0x55')](_0x5386ce);})[_0x9743('0xf')](function(_0x4127b6){_0x5a29cc[_0x9743('0x56')]=_0x4127b6;return _0x5a29cc;});}})[_0x9743('0xf')](respondWithFilteredResult(_0x865742,_0x5386ce))[_0x9743('0x19')](handleError(_0x865742,null));};exports[_0x9743('0x69')]=function(_0x2de8c0,_0x280877){return db[_0x9743('0x3d')]['find']({'where':{'id':_0x2de8c0[_0x9743('0x58')]['id']}})[_0x9743('0xf')](handleEntityNotFound(_0x280877,null))[_0x9743('0xf')](function(_0x37327b){if(_0x37327b){return _0x37327b[_0x9743('0x69')](_0x2de8c0[_0x9743('0x41')][_0x9743('0x6a')]);}})[_0x9743('0xf')](respondWithStatusCode(_0x280877,null))[_0x9743('0x19')](handleError(_0x280877,null));};exports[_0x9743('0x6b')]=function(_0x26f053,_0x274370){if(_0x26f053['body']['id']){delete _0x26f053[_0x9743('0x5e')]['id'];}return db['MailAccount'][_0x9743('0x5d')]({'where':{'id':_0x26f053[_0x9743('0x58')]['id']}})[_0x9743('0xf')](handleEntityNotFound(_0x274370,null))[_0x9743('0xf')](function(_0x58cc2e){if(_0x58cc2e){_0x26f053[_0x9743('0x5e')][_0x9743('0x68')]=_0x58cc2e['id'];return db['CannedAnswer'][_0x9743('0x66')](_0x26f053[_0x9743('0x5e')]);}})['then'](respondWithResult(_0x274370,null))[_0x9743('0x19')](handleError(_0x274370,null));};exports['getAnswers']=function(_0x170127,_0x56759d){var _0x4c7ca4={'raw':![],'where':{}};var _0x130d5c={};var _0x2bb211={'count':0x0,'rows':[]};return db[_0x9743('0x3d')][_0x9743('0x6c')]({'where':{'id':_0x170127[_0x9743('0x58')]['id']}})[_0x9743('0xf')](handleEntityNotFound(_0x56759d,null))[_0x9743('0xf')](function(_0x2b926f){if(_0x2b926f){_0x130d5c[_0x9743('0x43')]=_['keys'](db[_0x9743('0x6d')][_0x9743('0x5a')]);_0x130d5c['query']=_[_0x9743('0x42')](_0x170127[_0x9743('0x41')]);_0x130d5c[_0x9743('0x4f')]=_['intersection'](_0x130d5c[_0x9743('0x43')],_0x130d5c[_0x9743('0x41')]);_0x4c7ca4[_0x9743('0x44')]=_[_0x9743('0x5b')](_0x130d5c[_0x9743('0x43')],qs[_0x9743('0x45')](_0x170127[_0x9743('0x41')][_0x9743('0x45')]));_0x4c7ca4[_0x9743('0x44')]=_0x4c7ca4[_0x9743('0x44')]['length']?_0x4c7ca4[_0x9743('0x44')]:_0x130d5c[_0x9743('0x43')];if(!_0x170127[_0x9743('0x41')][_0x9743('0x47')](_0x9743('0x48'))){_0x4c7ca4[_0x9743('0x49')]=qs['limit'](_0x170127[_0x9743('0x41')][_0x9743('0x49')]);_0x4c7ca4[_0x9743('0x4a')]=qs[_0x9743('0x4a')](_0x170127[_0x9743('0x41')][_0x9743('0x4a')]);}_0x4c7ca4[_0x9743('0x4b')]=qs[_0x9743('0x4c')](_0x170127['query'][_0x9743('0x4c')]);_0x4c7ca4[_0x9743('0x4d')]=qs[_0x9743('0x4f')](_[_0x9743('0x4e')](_0x170127[_0x9743('0x41')],_0x130d5c[_0x9743('0x4f')]));_0x4c7ca4[_0x9743('0x4d')]['MailAccountId']=_0x2b926f['id'];if(_0x170127[_0x9743('0x41')]['filter']){_0x4c7ca4[_0x9743('0x4d')]=_[_0x9743('0x51')](_0x4c7ca4[_0x9743('0x4d')],{'$or':_['map'](_0x4c7ca4[_0x9743('0x44')],function(_0x1bbb8e){var _0x56b028={};_0x56b028[_0x1bbb8e]={'$like':'%'+_0x170127[_0x9743('0x41')][_0x9743('0x50')]+'%'};return _0x56b028;})});}_0x4c7ca4=_[_0x9743('0x51')]({},_0x4c7ca4,_0x170127[_0x9743('0x5c')]);return db[_0x9743('0x6d')][_0x9743('0x1e')]({'where':_0x4c7ca4[_0x9743('0x4d')]})['then'](function(_0x43d7e1){_0x2bb211[_0x9743('0x1e')]=_0x43d7e1;if(_0x170127[_0x9743('0x41')]['includeAll']){_0x4c7ca4['include']=[{'all':!![]}];}return db[_0x9743('0x6d')][_0x9743('0x55')](_0x4c7ca4);})[_0x9743('0xf')](function(_0x5c2209){_0x2bb211[_0x9743('0x56')]=_0x5c2209;return _0x2bb211;});}})[_0x9743('0xf')](respondWithFilteredResult(_0x56759d,_0x4c7ca4))['catch'](handleError(_0x56759d,null));};exports[_0x9743('0x6e')]=function(_0x10f158,_0x1eaffe){return db[_0x9743('0x3d')][_0x9743('0x5d')]({'where':{'id':_0x10f158[_0x9743('0x58')]['id']}})[_0x9743('0xf')](handleEntityNotFound(_0x1eaffe,null))['then'](function(_0x1568ec){if(_0x1568ec){return _0x1568ec[_0x9743('0x6e')](_0x10f158['query'][_0x9743('0x6a')]);}})['then'](respondWithStatusCode(_0x1eaffe,null))[_0x9743('0x19')](handleError(_0x1eaffe,null));};exports[_0x9743('0x66')]=function(_0x8bd5d6,_0x324932){var _0x24b3bd={'name':_0x8bd5d6[_0x9743('0x5e')][_0x9743('0x6f')],'key':_0x8bd5d6[_0x9743('0x5e')][_0x9743('0x40')],'provider':_0x8bd5d6[_0x9743('0x5e')][_0x9743('0x5f')]===_0x9743('0x60')?null:_0x8bd5d6[_0x9743('0x5e')]['provider'],'email':_0x8bd5d6[_0x9743('0x5e')][_0x9743('0x70')],'ListId':_0x8bd5d6[_0x9743('0x5e')][_0x9743('0x71')],'active':!_[_0x9743('0x72')](_0x8bd5d6[_0x9743('0x5e')][_0x9743('0x73')])?_0x8bd5d6[_0x9743('0x5e')][_0x9743('0x73')]:!![],'description':_0x8bd5d6[_0x9743('0x5e')][_0x9743('0x74')]||null};var _0x39bb09=getAuthenticationOptions(_0x24b3bd[_0x9743('0x5f')],_0x8bd5d6[_0x9743('0x5e')]);_0x24b3bd[_0x9743('0x37')]=_0x39bb09[_0x9743('0x37')];_0x24b3bd[_0x9743('0x59')]=_0x39bb09[_0x9743('0x59')];return db[_0x9743('0x3d')]['create'](_0x24b3bd,{'include':[{'model':db['MailServerOut'],'as':_0x9743('0x59')},{'model':db[_0x9743('0x39')],'as':_0x9743('0x37')}]})[_0x9743('0xf')](function(_0x393f07){var _0x391d85=_0x8bd5d6[_0x9743('0x2d')][_0x9743('0x21')]({'plain':!![]});if(!_0x391d85)throw new Error(_0x9743('0x75'));if(_0x391d85['role']===_0x9743('0x2d')){var _0x4d8c65=_0x393f07[_0x9743('0x21')]({'plain':!![]});return db[_0x9743('0x76')][_0x9743('0x5d')]({'where':{'name':_0x9743('0x22'),'userProfileId':_0x391d85[_0x9743('0x77')]},'raw':!![]})[_0x9743('0xf')](function(_0x325f04){if(_0x325f04&&_0x325f04['autoAssociation']===0x0){return db[_0x9743('0x78')][_0x9743('0x66')]({'name':_0x4d8c65[_0x9743('0x6f')],'resourceId':_0x4d8c65['id'],'type':_0x325f04[_0x9743('0x6f')],'sectionId':_0x325f04['id']},{})['then'](function(){return _0x393f07;});}else{return _0x393f07;}})[_0x9743('0x19')](function(_0x31db30){logger[_0x9743('0x16')](_0x9743('0x79'),_0x31db30);throw _0x31db30;});}return _0x393f07;})[_0x9743('0xf')](respondWithResult(_0x324932,0xc9))['catch'](handleError(_0x324932,null));};exports[_0x9743('0x7a')]=function(_0x160ee9,_0x107cb3){return db[_0x9743('0x3d')]['findOne']({'where':{'id':_0x160ee9['params']['id']}})[_0x9743('0xf')](handleEntityNotFound(_0x107cb3,null))['then'](function(_0x4b4ad7){if(_0x4b4ad7){return _0x4b4ad7[_0x9743('0x7a')]();}return null;})['then'](respondWithResult(_0x107cb3,null))[_0x9743('0x19')](handleError(_0x107cb3,null));};exports[_0x9743('0x7b')]=function(_0x21c48e,_0x386ca7){if(_0x21c48e[_0x9743('0x5e')]['id']){delete _0x21c48e[_0x9743('0x5e')]['id'];}return db[_0x9743('0x3d')][_0x9743('0x5d')]({'where':{'id':_0x21c48e['params']['id']}})[_0x9743('0xf')](handleEntityNotFound(_0x386ca7,null))[_0x9743('0xf')](function(_0x5732c4){if(_0x5732c4){_0x21c48e[_0x9743('0x5e')][_0x9743('0x68')]=_0x5732c4['id'];return db[_0x9743('0x39')][_0x9743('0x66')](_0x21c48e[_0x9743('0x5e')]);}})[_0x9743('0xf')](respondWithResult(_0x386ca7,null))[_0x9743('0x19')](handleError(_0x386ca7,null));};exports[_0x9743('0x7c')]=function(_0x3c3b80,_0x119cfe){return db[_0x9743('0x3d')][_0x9743('0x6c')]({'where':{'id':_0x3c3b80[_0x9743('0x58')]['id']}})[_0x9743('0xf')](handleEntityNotFound(_0x119cfe,null))[_0x9743('0xf')](function(_0x576e33){if(_0x576e33){return _0x576e33['setImap'](null);}return null;})['then'](respondWithStatusCode(_0x119cfe,null))[_0x9743('0x19')](handleError(_0x119cfe,null));};exports[_0x9743('0x7d')]=function(_0x8a57a5,_0x473541){return db['MailAccount']['findOne']({'where':{'id':_0x8a57a5[_0x9743('0x58')]['id']}})[_0x9743('0xf')](handleEntityNotFound(_0x473541,null))['then'](function(_0x3086b5){if(_0x3086b5){return _0x3086b5[_0x9743('0x7d')]();}return null;})[_0x9743('0xf')](respondWithResult(_0x473541,null))[_0x9743('0x19')](handleError(_0x473541,null));};exports['addSmtp']=function(_0xc8c735,_0x462462){if(_0xc8c735['body']['id']){delete _0xc8c735[_0x9743('0x5e')]['id'];}return db['MailAccount']['find']({'where':{'id':_0xc8c735[_0x9743('0x58')]['id']}})[_0x9743('0xf')](handleEntityNotFound(_0x462462,null))['then'](function(_0x751fa0){if(_0x751fa0){_0xc8c735[_0x9743('0x5e')][_0x9743('0x68')]=_0x751fa0['id'];return db[_0x9743('0x3a')]['create'](_0xc8c735[_0x9743('0x5e')]);}})[_0x9743('0xf')](respondWithResult(_0x462462,null))[_0x9743('0x19')](handleError(_0x462462,null));};exports[_0x9743('0x7e')]=function(_0x2107bc,_0x5590e1){return db['MailAccount'][_0x9743('0x6c')]({'where':{'id':_0x2107bc[_0x9743('0x58')]['id']}})['then'](handleEntityNotFound(_0x5590e1,null))['then'](function(_0x54e013){if(_0x54e013){return _0x54e013[_0x9743('0x7f')](null);}return null;})[_0x9743('0xf')](respondWithStatusCode(_0x5590e1,null))[_0x9743('0x19')](handleError(_0x5590e1,null));};exports['addInteraction']=function(_0x12ed7e,_0x34877b){return db['MailInteraction']['find']({'where':{'id':_0x12ed7e['params']['id']}})['then'](handleEntityNotFound(_0x34877b,null))['then'](function(_0x1b4895){if(_0x1b4895){return _0x1b4895['addInteraction'](_0x12ed7e['body']['ids'],_[_0x9743('0x80')](_0x12ed7e['body'],[_0x9743('0x6a'),'id'])||{});}})[_0x9743('0xf')](respondWithResult(_0x34877b,null))['catch'](handleError(_0x34877b,null));};exports[_0x9743('0x81')]=function(_0x5a15e6,_0x259d0e){var _0x2595da={'raw':![],'where':{}};var _0x2ba789={};var _0x4bcf1e={'count':0x0,'rows':[]};return db['MailAccount'][_0x9743('0x6c')]({'where':{'id':_0x5a15e6[_0x9743('0x58')]['id']}})[_0x9743('0xf')](handleEntityNotFound(_0x259d0e,null))[_0x9743('0xf')](function(_0x1cb06a){if(_0x1cb06a){_0x2ba789[_0x9743('0x43')]=_[_0x9743('0x42')](db['MailInteraction']['rawAttributes']);_0x2ba789[_0x9743('0x41')]=_[_0x9743('0x42')](_0x5a15e6[_0x9743('0x41')]);_0x2ba789[_0x9743('0x4f')]=_[_0x9743('0x5b')](_0x2ba789[_0x9743('0x43')],_0x2ba789[_0x9743('0x41')]);_0x2595da[_0x9743('0x44')]=_['intersection'](_0x2ba789[_0x9743('0x43')],qs[_0x9743('0x45')](_0x5a15e6[_0x9743('0x41')][_0x9743('0x45')]));_0x2595da[_0x9743('0x44')]=_0x2595da[_0x9743('0x44')][_0x9743('0x46')]?_0x2595da['attributes']:_0x2ba789['model'];if(!_0x5a15e6['query'][_0x9743('0x47')](_0x9743('0x48'))){_0x2595da[_0x9743('0x49')]=qs[_0x9743('0x49')](_0x5a15e6[_0x9743('0x41')][_0x9743('0x49')]);_0x2595da['offset']=qs['offset'](_0x5a15e6['query'][_0x9743('0x4a')]);}_0x2595da[_0x9743('0x4b')]=qs[_0x9743('0x4c')](_0x5a15e6[_0x9743('0x41')]['sort']);_0x2595da[_0x9743('0x4d')]=qs[_0x9743('0x4f')](_[_0x9743('0x4e')](_0x5a15e6[_0x9743('0x41')],_0x2ba789[_0x9743('0x4f')]));_0x2595da[_0x9743('0x4d')][_0x9743('0x68')]=_0x1cb06a['id'];if(_0x5a15e6[_0x9743('0x41')]['filter']){_0x2595da['where']=_[_0x9743('0x51')](_0x2595da[_0x9743('0x4d')],{'$or':_[_0x9743('0x3c')](_0x2595da[_0x9743('0x44')],function(_0x5862a7){var _0x1bc1fb={};_0x1bc1fb[_0x5862a7]={'$like':'%'+_0x5a15e6[_0x9743('0x41')]['filter']+'%'};return _0x1bc1fb;})});}_0x2595da=_[_0x9743('0x51')]({},_0x2595da,_0x5a15e6['options']);return db[_0x9743('0x82')][_0x9743('0x1e')]({'where':_0x2595da['where']})[_0x9743('0xf')](function(_0x106aab){_0x4bcf1e['count']=_0x106aab;if(_0x5a15e6[_0x9743('0x41')][_0x9743('0x53')]){_0x2595da[_0x9743('0x54')]=[{'model':db[_0x9743('0x83')],'as':'Contact','required':![]},{'model':db['User'],'as':_0x9743('0x84'),'attributes':[_0x9743('0x6f'),'fullname',_0x9743('0x85')],'required':![]},{'model':db[_0x9743('0x86')],'as':_0x9743('0x87'),'attributes':['id',_0x9743('0x6f'),_0x9743('0x88')],'where':_0x5a15e6[_0x9743('0x41')]['tag']?{'id':_0x5a15e6['query']['tag']}:undefined,'required':_0x5a15e6['query'][_0x9743('0x89')]?!![]:![]}];}return db[_0x9743('0x82')][_0x9743('0x55')](_0x2595da);})['then'](function(_0x4853c1){_0x4bcf1e[_0x9743('0x56')]=_0x4853c1;return _0x4bcf1e;});}})['then'](respondWithFilteredResult(_0x259d0e,_0x2595da))[_0x9743('0x19')](handleError(_0x259d0e,null));};exports['addApplications']=function addApplications(_0x1c6fb4,_0x443390){var _0x2d7558=_0x1c6fb4[_0x9743('0x58')]['id'];var _0x403e06=_0x1c6fb4[_0x9743('0x5e')];var _0x394db9=0xc8;var _0x4fc6a3=null;return db['sequelize']['transaction']({'isolationLevel':db['sequelize']['Transaction'][_0x9743('0x8a')][_0x9743('0x8b')]},function(_0x3523f6){return db[_0x9743('0x3d')][_0x9743('0x6c')]({'where':{'id':_0x2d7558},'transaction':_0x3523f6})['then'](function(_0x49c92a){if(_0x49c92a){return db[_0x9743('0x8c')][_0x9743('0x20')]({'where':{'MailAccountId':_0x2d7558},'transaction':_0x3523f6})[_0x9743('0xf')](function(){var _0x45f03c=_['map'](_0x403e06,function(_0x350671){_0x350671['MailAccountId']=_0x2d7558;return _0x350671;});return db['MailApplication'][_0x9743('0x8d')](_0x45f03c,{'transaction':_0x3523f6});});}else{_0x394db9=0x194;_0x4fc6a3=[];}});})['then'](function(){if(_0x394db9!==0x194){return db[_0x9743('0x8c')][_0x9743('0x8e')]({'where':{'MailAccountId':_0x2d7558},'order':'priority'})['then'](function(_0x1a4a75){_0x4fc6a3=_0x1a4a75;});}})['catch'](function(_0x2be0a3){_0x394db9=0x1f4;logger['error'](_0x2be0a3[_0x9743('0x23')]);if(_0x2be0a3[_0x9743('0x6f')]){delete _0x2be0a3[_0x9743('0x6f')];}_0x4fc6a3=_0x2be0a3;})['finally'](function(){if(_0x4fc6a3===null){_0x443390[_0x9743('0x1a')](_0x394db9);}else{if(_0x394db9===0x1f4){_0x443390[_0x9743('0x1b')](_0x394db9)[_0x9743('0x8f')](_0x4fc6a3);}else{_0x443390['status'](_0x394db9)['json'](_0x4fc6a3);}}});};exports['getApplications']=function(_0x43f237,_0x42b79d){var _0x1825f5={};var _0x3ce287={};var _0x250251;var _0xd04646;return db[_0x9743('0x3d')][_0x9743('0x6c')]({'where':{'id':_0x43f237['params']['id']}})[_0x9743('0xf')](handleEntityNotFound(_0x42b79d,null))['then'](function(_0x5889f0){if(_0x5889f0){_0x250251=_0x5889f0;_0x3ce287[_0x9743('0x43')]=_[_0x9743('0x42')](db[_0x9743('0x8c')][_0x9743('0x5a')]);_0x3ce287[_0x9743('0x41')]=_[_0x9743('0x42')](_0x43f237[_0x9743('0x41')]);_0x3ce287[_0x9743('0x4f')]=_[_0x9743('0x5b')](_0x3ce287[_0x9743('0x43')],_0x3ce287[_0x9743('0x41')]);_0x1825f5[_0x9743('0x44')]=_['intersection'](_0x3ce287[_0x9743('0x43')],qs[_0x9743('0x45')](_0x43f237[_0x9743('0x41')][_0x9743('0x45')]));_0x1825f5[_0x9743('0x44')]=_0x1825f5[_0x9743('0x44')]['length']?_0x1825f5[_0x9743('0x44')]:_0x3ce287[_0x9743('0x43')];_0x1825f5[_0x9743('0x4b')]=qs[_0x9743('0x4c')](_0x43f237[_0x9743('0x41')][_0x9743('0x4c')]);_0x1825f5['where']=qs[_0x9743('0x4f')](_[_0x9743('0x4e')](_0x43f237[_0x9743('0x41')],_0x3ce287[_0x9743('0x4f')]));if(_0x43f237[_0x9743('0x41')]['filter']){_0x1825f5[_0x9743('0x4d')]=_[_0x9743('0x51')](_0x1825f5[_0x9743('0x4d')],{'$or':_[_0x9743('0x3c')](_0x1825f5[_0x9743('0x44')],function(_0x8d0ec5){var _0xde2e0d={};_0xde2e0d[_0x8d0ec5]={'$like':'%'+_0x43f237[_0x9743('0x41')]['filter']+'%'};return _0xde2e0d;})});}_0x1825f5=_[_0x9743('0x51')]({},_0x1825f5,_0x43f237[_0x9743('0x5c')]);return _0x250251[_0x9743('0x90')](_0x1825f5);}})[_0x9743('0xf')](function(_0xde21e2){if(_0xde21e2){_0xd04646=_0xde21e2[_0x9743('0x46')];if(!_0x43f237['query'][_0x9743('0x47')](_0x9743('0x48'))){_0x1825f5[_0x9743('0x49')]=qs[_0x9743('0x49')](_0x43f237[_0x9743('0x41')][_0x9743('0x49')]);_0x1825f5['offset']=qs[_0x9743('0x4a')](_0x43f237['query'][_0x9743('0x4a')]);}return _0x250251[_0x9743('0x90')](_0x1825f5);}})[_0x9743('0xf')](function(_0x335dbe){if(_0x335dbe){return _0x335dbe?{'count':_0xd04646,'rows':_0x335dbe}:null;}})[_0x9743('0xf')](respondWithResult(_0x42b79d,null))['catch'](handleError(_0x42b79d,null));};exports[_0x9743('0x91')]=function(_0x1ac700,_0x3d19cc){var _0xafcc54={'raw':!![],'where':{}};var _0x181a3b={};var _0x4ad1df={'count':0x0,'rows':[]};return db['MailAccount'][_0x9743('0x6c')]({'where':{'id':_0x1ac700[_0x9743('0x58')]['id']}})[_0x9743('0xf')](handleEntityNotFound(_0x3d19cc,null))[_0x9743('0xf')](function(_0x39530e){if(_0x39530e){_0x181a3b[_0x9743('0x43')]=_['keys'](db[_0x9743('0x92')][_0x9743('0x5a')]);_0x181a3b[_0x9743('0x41')]=_['keys'](_0x1ac700[_0x9743('0x41')]);_0x181a3b[_0x9743('0x4f')]=_[_0x9743('0x5b')](_0x181a3b[_0x9743('0x43')],_0x181a3b[_0x9743('0x41')]);_0xafcc54[_0x9743('0x44')]=_[_0x9743('0x5b')](_0x181a3b[_0x9743('0x43')],qs[_0x9743('0x45')](_0x1ac700[_0x9743('0x41')][_0x9743('0x45')]));_0xafcc54[_0x9743('0x44')]=_0xafcc54[_0x9743('0x44')][_0x9743('0x46')]?_0xafcc54['attributes']:_0x181a3b['model'];if(!_0x1ac700[_0x9743('0x41')][_0x9743('0x47')](_0x9743('0x48'))){_0xafcc54[_0x9743('0x49')]=qs[_0x9743('0x49')](_0x1ac700[_0x9743('0x41')]['limit']);_0xafcc54[_0x9743('0x4a')]=qs[_0x9743('0x4a')](_0x1ac700['query'][_0x9743('0x4a')]);}_0xafcc54[_0x9743('0x4b')]=qs[_0x9743('0x4c')](_0x1ac700[_0x9743('0x41')][_0x9743('0x4c')]);_0xafcc54[_0x9743('0x4d')]=qs['filters'](_[_0x9743('0x4e')](_0x1ac700[_0x9743('0x41')],_0x181a3b[_0x9743('0x4f')]));_0xafcc54[_0x9743('0x4d')]['MailAccountId']=_0x39530e['id'];if(_0x1ac700[_0x9743('0x41')][_0x9743('0x50')]){_0xafcc54[_0x9743('0x4d')]=_[_0x9743('0x51')](_0xafcc54[_0x9743('0x4d')],{'$or':_[_0x9743('0x3c')](_0xafcc54[_0x9743('0x44')],function(_0x7cc858){var _0x23d324={};_0x23d324[_0x7cc858]={'$like':'%'+_0x1ac700['query'][_0x9743('0x50')]+'%'};return _0x23d324;})});}if(_0x1ac700[_0x9743('0x41')][_0x9743('0x93')]){var _0x689e2f=_0x1ac700[_0x9743('0x41')][_0x9743('0x93')][_0x9743('0x94')](',');var _0x57a67a={};_0x57a67a[_0x689e2f[0x0]]={'$gte':moment(_0x689e2f[0x1])[_0x9743('0x95')]('YYYY-MM-DD\x20HH:mm:ss')};_0xafcc54[_0x9743('0x4d')]=_[_0x9743('0x51')](_0xafcc54[_0x9743('0x4d')],_0x57a67a);}_0xafcc54=_[_0x9743('0x51')]({},_0xafcc54,_0x1ac700[_0x9743('0x5c')]);return db[_0x9743('0x92')][_0x9743('0x1e')]({'where':_0xafcc54[_0x9743('0x4d')]})[_0x9743('0xf')](function(_0x5d6272){_0x4ad1df[_0x9743('0x1e')]=_0x5d6272;if(_0x1ac700[_0x9743('0x41')][_0x9743('0x53')]){_0xafcc54['include']=[{'all':!![]}];}return db[_0x9743('0x92')][_0x9743('0x55')](_0xafcc54);})['then'](function(_0x58567f){if(_0x1ac700[_0x9743('0x41')][_0x9743('0x96')]===_0x9743('0x97')){for(var _0x372170=0x0;_0x372170<_0x58567f[_0x9743('0x46')];_0x372170++){_0x58567f[_0x372170][_0x9743('0x5e')]=juice(_0x58567f[_0x372170][_0x9743('0x5e')]);}}_0x4ad1df[_0x9743('0x56')]=_0x58567f;return _0x4ad1df;});}})[_0x9743('0xf')](respondWithFilteredResult(_0x3d19cc,_0xafcc54))['catch'](handleError(_0x3d19cc,null));};exports[_0x9743('0x8f')]=function(_0xccac51,_0x852a35){var _0x20dc69,_0x3e9179={},_0x3b230e;if(_0xccac51[_0x9743('0x5e')]['to']){_0x3b230e=_0xccac51[_0x9743('0x5e')]['to']['split'](',')[0x0];}return db[_0x9743('0x3d')][_0x9743('0x5d')]({'where':{'id':_0xccac51[_0x9743('0x58')]['id']},'include':[{'model':db[_0x9743('0x98')],'as':_0x9743('0x99'),'include':[{'model':db[_0x9743('0x83')],'as':_0x9743('0x9a'),'where':{'email':_0x3b230e},'limit':0x1,'order':[[_0x9743('0x9b'),'DESC']]}]},{'model':db[_0x9743('0x3a')],'as':'Smtp','raw':!![],'include':[{'model':db[_0x9743('0x9c')],'as':_0x9743('0x9c'),'raw':!![]}]}]})[_0x9743('0xf')](handleEntityNotFound(_0x852a35,null))[_0x9743('0xf')](function(_0x3a1caf){if(!_0x3a1caf)return;_0x20dc69=_0x3a1caf;if(!_0x3a1caf[_0x9743('0x59')])throw new Error(_0x9743('0x9d'));if(_[_0x9743('0x72')](_0xccac51[_0x9743('0x5e')][_0x9743('0x9e')])){_0xccac51['body'][_0x9743('0x9e')]=util[_0x9743('0x95')](_0x9743('0x9f'),_0x3a1caf[_0x9743('0x6f')],_0x3a1caf[_0x9743('0x70')]||_0x3a1caf[_0x9743('0x59')][_0x9743('0x2d')]);}if(_0xccac51['body'][_0x9743('0xa0')]&&_0xccac51[_0x9743('0x5e')]['attachments'][_0x9743('0x46')]){for(var _0x1b421f=0x0;_0x1b421f<_0xccac51['body'][_0x9743('0xa0')][_0x9743('0x46')];_0x1b421f+=0x1){_0xccac51[_0x9743('0x5e')][_0x9743('0xa0')][_0x1b421f]={'filename':_0xccac51[_0x9743('0x5e')][_0x9743('0xa0')][_0x1b421f]['name'],'path':path[_0x9743('0xa1')](config[_0x9743('0xa2')],_0x9743('0xa3'),_0xccac51[_0x9743('0x5e')][_0x9743('0xa0')][_0x1b421f][_0x9743('0xa4')])};}}var _0x37fa52=_0x3a1caf[_0x9743('0xa5')]();return respondWithRpcPromise(_0x9743('0xa6'),_0x9743('0xa7'),{'account':_0x37fa52,'message':_0xccac51[_0x9743('0x5e')]});})[_0x9743('0xf')](function(_0x2bfdd7){if(!_0x2bfdd7)return;_0x3e9179=_0x2bfdd7;if(!_0x20dc69[_0x9743('0x99')])throw new Error('List\x20not\x20found');if(_0x20dc69['List'][_0x9743('0x9a')]['length'])return _0x20dc69[_0x9743('0x99')]['Contacts'][0x0];return db[_0x9743('0x83')][_0x9743('0x66')](_[_0x9743('0xa8')](_0xccac51[_0x9743('0x5e')],{'firstName':_0xccac51[_0x9743('0x5e')]['to'],'email':_0xccac51[_0x9743('0x5e')]['to'],'phone':_0xccac51[_0x9743('0x5e')]['to'],'ListId':_0x20dc69[_0x9743('0x71')]}));})['then'](function(_0x2c4b0a){if(!_0x2c4b0a)return;var _0x19d918={'UserId':_0xccac51[_0x9743('0x2d')]['id'],'ContactId':_0x2c4b0a['id'],'MailAccountId':_0x20dc69['id'],'inReplyTo':_0x3e9179[_0x9743('0xa9')],'to':_0xccac51[_0x9743('0x5e')]['from'],'cc':_0xccac51[_0x9743('0x5e')]['cc'],'subject':_0xccac51['body']['subject'],'attach':_0xccac51[_0x9743('0x5e')][_0x9743('0xaa')],'firstMsgDirection':'out','lastMsgAt':moment()[_0x9743('0x95')](_0x9743('0xab')),'lastMsgDirection':_0x9743('0xac'),'Messages':[_['merge'](_0xccac51[_0x9743('0x5e')],{'messageId':_0x3e9179[_0x9743('0xa9')],'sentAt':moment()['format'](_0x9743('0xab')),'read':!![],'MailAccountId':_0x20dc69['id'],'UserId':_0xccac51[_0x9743('0x2d')]['id'],'ContactId':_0x2c4b0a['id']})]};if(_0xccac51[_0x9743('0x5e')][_0x9743('0xad')]){_0x19d918=_[_0x9743('0x51')](_0x19d918,_0xccac51[_0x9743('0x5e')][_0x9743('0xad')]);}return db[_0x9743('0x82')][_0x9743('0x66')](_0x19d918,{'include':[{'model':db[_0x9743('0x92')],'as':_0x9743('0xae')}]});})[_0x9743('0xf')](respondWithResult(_0x852a35,null))[_0x9743('0x19')](handleError(_0x852a35,null));};exports[_0x9743('0xaf')]=function(_0x4fda55,_0x39d361){return db['MailAccount'][_0x9743('0x5d')]({'where':{'id':_0x4fda55[_0x9743('0x58')]['id']},'include':[{'model':db[_0x9743('0x3a')],'as':_0x9743('0x59'),'raw':!![],'include':[{'model':db[_0x9743('0x9c')],'as':_0x9743('0x9c'),'raw':!![]}]}]})[_0x9743('0xf')](handleEntityNotFound(_0x39d361,null))['then'](function(_0x1727bb){if(!_0x1727bb['Smtp'])return;var _0x415724=_0x1727bb[_0x9743('0xa5')]();return respondWithRpcPromise(_0x9743('0xb0'),'verifySmtp',{'account':_0x415724});})['then'](respondWithResult(_0x39d361,null))[_0x9743('0x19')](handleError(_0x39d361,null));};exports[_0x9743('0x20')]=function(_0x2404a8,_0x4ea3db){return db[_0x9743('0x3d')][_0x9743('0x5d')]({'where':{'id':_0x2404a8[_0x9743('0x58')]['id']}})[_0x9743('0xf')](handleEntityNotFound(_0x4ea3db,null))[_0x9743('0xf')](function(_0x1f33ce){if(_0x1f33ce&&_0x1f33ce['service']){throw new db[(_0x9743('0xb1'))]['ValidationError'](_0x9743('0xb2'));}return _0x1f33ce;})[_0x9743('0xf')](removeEntity(_0x4ea3db,null))['catch'](handleError(_0x4ea3db,null));};exports[_0x9743('0xb3')]=function(_0x586550,_0x3e795e){return db[_0x9743('0x3d')][_0x9743('0x5d')]({'where':{'id':_0x586550['params']['id']}})[_0x9743('0xf')](handleEntityNotFound(_0x3e795e,null))[_0x9743('0xf')](function(_0x2e135f){if(_0x2e135f){return _0x2e135f[_0x9743('0xb3')](_0x586550[_0x9743('0x5e')][_0x9743('0x6a')],_['omit'](_0x586550[_0x9743('0x5e')],['ids','id'])||{})[_0x9743('0xb4')](function(_0x389031){for(var _0x1abbe5=0x0;_0x1abbe5<_0x586550[_0x9743('0x5e')][_0x9743('0x6a')][_0x9743('0x46')];_0x1abbe5+=0x1){socket[_0x9743('0xb5')](_0x9743('0xb6'),{'UserId':Number(_0x586550['body'][_0x9743('0x6a')][_0x1abbe5]),'MailAccountId':Number(_0x586550[_0x9743('0x58')]['id'])});}return _0x389031;});}})['then'](respondWithResult(_0x3e795e,null))['catch'](handleError(_0x3e795e,null));};exports['removeAgents']=function(_0xfc8cbc,_0x423b88){return db[_0x9743('0x3d')][_0x9743('0x5d')]({'where':{'id':_0xfc8cbc['params']['id']}})[_0x9743('0xf')](handleEntityNotFound(_0x423b88,null))[_0x9743('0xf')](function(_0x5a442f){if(_0x5a442f){return _0x5a442f['removeAgents'](_0xfc8cbc['query']['ids'])['then'](function(){if(_['isArray'](_0xfc8cbc[_0x9743('0x41')][_0x9743('0x6a')])){for(var _0x29f45c=0x0;_0x29f45c<_0xfc8cbc[_0x9743('0x41')][_0x9743('0x6a')]['length'];_0x29f45c+=0x1){socket[_0x9743('0xb5')](_0x9743('0xb7'),{'UserId':Number(_0xfc8cbc['query'][_0x9743('0x6a')][_0x29f45c]),'MailAccountId':Number(_0xfc8cbc[_0x9743('0x58')]['id'])});}}else{socket[_0x9743('0xb5')](_0x9743('0xb7'),{'UserId':Number(_0xfc8cbc[_0x9743('0x41')]['ids']),'MailAccountId':Number(_0xfc8cbc[_0x9743('0x58')]['id'])});}});}})[_0x9743('0xf')](respondWithStatusCode(_0x423b88,null))[_0x9743('0x19')](handleError(_0x423b88,null));};exports[_0x9743('0xb8')]=function(_0x2cb455,_0x221508){var _0x5c5ea2={};var _0x5647e8={};var _0x5ef6c9;var _0x33d0b7;return db[_0x9743('0x3d')]['findOne']({'where':{'id':_0x2cb455[_0x9743('0x58')]['id']}})[_0x9743('0xf')](handleEntityNotFound(_0x221508,null))[_0x9743('0xf')](function(_0x524218){if(_0x524218){_0x5ef6c9=_0x524218;_0x5647e8['model']=_['keys'](db[_0x9743('0xb9')][_0x9743('0x5a')]);_0x5647e8[_0x9743('0x41')]=_[_0x9743('0x42')](_0x2cb455[_0x9743('0x41')]);_0x5647e8['filters']=_[_0x9743('0x5b')](_0x5647e8[_0x9743('0x43')],_0x5647e8['query']);_0x5c5ea2['attributes']=_['intersection'](_0x5647e8['model'],qs[_0x9743('0x45')](_0x2cb455[_0x9743('0x41')][_0x9743('0x45')]));_0x5c5ea2[_0x9743('0x44')]=_0x5c5ea2[_0x9743('0x44')][_0x9743('0x46')]?_0x5c5ea2[_0x9743('0x44')]:_0x5647e8['model'];_0x5c5ea2['order']=qs[_0x9743('0x4c')](_0x2cb455[_0x9743('0x41')]['sort']);_0x5c5ea2[_0x9743('0x4d')]=qs[_0x9743('0x4f')](_['pick'](_0x2cb455['query'],_0x5647e8[_0x9743('0x4f')]));if(_0x2cb455['query'][_0x9743('0x50')]){_0x5c5ea2[_0x9743('0x4d')]=_['merge'](_0x5c5ea2[_0x9743('0x4d')],{'$or':_[_0x9743('0x3c')](_0x5c5ea2['attributes'],function(_0x568826){var _0x2d8452={};_0x2d8452[_0x568826]={'$like':'%'+_0x2cb455[_0x9743('0x41')][_0x9743('0x50')]+'%'};return _0x2d8452;})});}_0x5c5ea2=_[_0x9743('0x51')]({},_0x5c5ea2,_0x2cb455[_0x9743('0x5c')]);return _0x5ef6c9[_0x9743('0xb8')](_0x5c5ea2);}})[_0x9743('0xf')](function(_0x4a063d){if(_0x4a063d){_0x33d0b7=_0x4a063d[_0x9743('0x46')];if(!_0x2cb455[_0x9743('0x41')][_0x9743('0x47')]('nolimit')){_0x5c5ea2[_0x9743('0x49')]=qs[_0x9743('0x49')](_0x2cb455[_0x9743('0x41')][_0x9743('0x49')]);_0x5c5ea2[_0x9743('0x4a')]=qs[_0x9743('0x4a')](_0x2cb455[_0x9743('0x41')][_0x9743('0x4a')]);}return _0x5ef6c9[_0x9743('0xb8')](_0x5c5ea2);}})['then'](function(_0x363d3b){if(_0x363d3b){return _0x363d3b?{'count':_0x33d0b7,'rows':_0x363d3b}:null;}})[_0x9743('0xf')](respondWithResult(_0x221508,null))['catch'](handleError(_0x221508,null));}; \ No newline at end of file +var _0x7af8=['moment','bluebird','util','lodash','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./mailAccount.socket','register','jayson/promise','client','http','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','count','limit','set','update','destroy','get','MailAccounts','UserProfileResource','stack','name','gmail','imap.gmail.com','yahoo','hotmail','imap-mail.outlook.com','outlook.office365.com','smtp.gmail.com','smtp.mail.yahoo.com','smtp.office365.com','Unknown\x20email\x20service\x20provider','user','username','password','modernAuthentication','CloudProviderId','pass','port','host','service','authentication','Imap','Smtp','index','MailServerOut','Pause','map','MailAccount','rawAttributes','type','model','query','keys','filters','attributes','intersection','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','rows','show','params','mandatoryDispositionPause','fields','includeAll','body','custom','provider','secure','find','MailServerIn','describe','addDisposition','MailAccountId','create','getDispositions','findOne','Disposition','include','findAll','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','email','ListId','isNil','active','description','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','setImap','getSmtp','addSmtp','removeSmtp','addInteraction','MailInteraction','omit','CmContact','Contact','User','Owner','fullname','internal','Tag','Tags','color','tag','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','MailApplication','findAndCountAll','finally','getApplications','getMessages','MailMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','inlineCss','true','send','CmList','List','updatedAt','CloudProvider','Smtp\x20configuration\x20not\x20found','from','%s\x20<%s>','attachments','join','root','server/files/attachments','basename','getSmtpOptions','SendMail','sendMail','List\x20not\x20found','Contacts','messageId','subject','attach','out','Interaction','verifySmtp','VerifySmtp','Sequelize','ValidationError','addAgents','spread','emit','removeAgents','userMailAccount:remove','getAgents'];(function(_0x1f9083,_0x421e92){var _0x1767dc=function(_0x5b9319){while(--_0x5b9319){_0x1f9083['push'](_0x1f9083['shift']());}};_0x1767dc(++_0x421e92);}(_0x7af8,0xc6));var _0x87af=function(_0x4085c5,_0x5615b6){_0x4085c5=_0x4085c5-0x0;var _0xee1c3d=_0x7af8[_0x4085c5];return _0xee1c3d;};'use strict';var moment=require(_0x87af('0x0'));var BPromise=require(_0x87af('0x1'));var util=require(_0x87af('0x2'));var path=require('path');var _=require(_0x87af('0x3'));var juice=require('juice');var Redis=require('ioredis');var qs=require(_0x87af('0x4'));var logger=require(_0x87af('0x5'))(_0x87af('0x6'));var config=require(_0x87af('0x7'));var db=require(_0x87af('0x8'))['db'];config[_0x87af('0x9')]=_[_0x87af('0xa')](config[_0x87af('0x9')],{'host':_0x87af('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x87af('0x9')]));require(_0x87af('0xc'))[_0x87af('0xd')](socket);var jayson=require(_0x87af('0xe'));var client=jayson[_0x87af('0xf')][_0x87af('0x10')]({'port':0x232b});function respondWithRpcPromise(_0x555896,_0x19374a,_0x591cb7,_0x2c0eee){return new BPromise(function(_0x4ed037,_0x4ad6f3){var _0x3b284b=_0x2c0eee||client;return _0x3b284b[_0x87af('0x11')](_0x555896,_0x591cb7)[_0x87af('0x12')](function(_0x6859b6){logger[_0x87af('0x13')](_0x87af('0x14'),_0x19374a,_0x87af('0x15'));logger['debug']('MailAccount,\x20%s,\x20%s,\x20%s',_0x19374a,'request\x20sent',JSON[_0x87af('0x16')](_0x6859b6));if(_0x6859b6['error']){if(_0x6859b6[_0x87af('0x17')][_0x87af('0x18')]===0x1f4){logger[_0x87af('0x17')](_0x87af('0x14'),_0x19374a,_0x6859b6[_0x87af('0x17')][_0x87af('0x19')]);return _0x4ad6f3(_0x6859b6[_0x87af('0x17')]['message']);}logger[_0x87af('0x17')](_0x87af('0x14'),_0x19374a,_0x6859b6[_0x87af('0x17')][_0x87af('0x19')]);return _0x4ed037(_0x6859b6[_0x87af('0x17')][_0x87af('0x19')]);}else{logger[_0x87af('0x13')](_0x87af('0x14'),_0x19374a,_0x87af('0x15'));_0x4ed037(_0x6859b6[_0x87af('0x1a')][_0x87af('0x19')]);}})[_0x87af('0x1b')](function(_0x2f8ea8){logger['error']('MailAccount,\x20%s,\x20%s',_0x19374a,_0x2f8ea8);_0x4ad6f3(_0x2f8ea8);});});}function respondWithStatusCode(_0x5d6053,_0x34c3f8){_0x34c3f8=_0x34c3f8||0xcc;return function(_0x54aada){if(_0x54aada){return _0x5d6053[_0x87af('0x1c')](_0x34c3f8);}return _0x5d6053[_0x87af('0x1d')](_0x34c3f8)[_0x87af('0x1e')]();};}function respondWithResult(_0x442107,_0x212710){_0x212710=_0x212710||0xc8;return function(_0x5154e9){if(_0x5154e9){return _0x442107['status'](_0x212710)[_0x87af('0x1f')](_0x5154e9);}};}function respondWithFilteredResult(_0x223b1a,_0x27daf0){return function(_0x370e45){if(_0x370e45){var _0x5a40dd=typeof _0x27daf0[_0x87af('0x20')]==='undefined'&&typeof _0x27daf0['limit']===_0x87af('0x21');var _0x30cc38=_0x370e45['count'];var _0x1045aa=_0x5a40dd?0x0:_0x27daf0[_0x87af('0x20')];var _0x27d62c=_0x5a40dd?_0x370e45[_0x87af('0x22')]:_0x27daf0[_0x87af('0x20')]+_0x27daf0[_0x87af('0x23')];var _0x5c7640;if(_0x27d62c>=_0x30cc38){_0x27d62c=_0x30cc38;_0x5c7640=0xc8;}else{_0x5c7640=0xce;}_0x223b1a[_0x87af('0x1d')](_0x5c7640);return _0x223b1a[_0x87af('0x24')]('Content-Range',_0x1045aa+'-'+_0x27d62c+'/'+_0x30cc38)['json'](_0x370e45);}return null;};}function saveUpdates(_0x4f6186){return function(_0x4f0ab8){if(_0x4f0ab8){return _0x4f0ab8[_0x87af('0x25')](_0x4f6186)[_0x87af('0x12')](function(_0x327d70){return _0x327d70;});}return null;};}function removeEntity(_0x1e1dad){return function(_0x15296e){if(_0x15296e){return _0x15296e[_0x87af('0x26')]()[_0x87af('0x12')](function(){var _0x273d84=_0x15296e[_0x87af('0x27')]({'plain':!![]});var _0x44286d=_0x87af('0x28');return db[_0x87af('0x29')][_0x87af('0x26')]({'where':{'type':_0x44286d,'resourceId':_0x273d84['id']}})['then'](function(){return _0x15296e;});})[_0x87af('0x12')](function(){_0x1e1dad['status'](0xcc)[_0x87af('0x1e')]();});}};}function handleEntityNotFound(_0x154c23){return function(_0x14058a){if(!_0x14058a){_0x154c23[_0x87af('0x1c')](0x194);}return _0x14058a;};}function handleError(_0x4076a7,_0x5a1dd9){_0x5a1dd9=_0x5a1dd9||0x1f4;return function(_0x2d7adf){logger[_0x87af('0x17')](_0x2d7adf[_0x87af('0x2a')]);if(_0x2d7adf[_0x87af('0x2b')]){delete _0x2d7adf[_0x87af('0x2b')];}_0x4076a7[_0x87af('0x1d')](_0x5a1dd9)['send'](_0x2d7adf);};}function getImapHost(_0x545e98){switch(_0x545e98){case _0x87af('0x2c'):return _0x87af('0x2d');case _0x87af('0x2e'):return'imap.mail.yahoo.com';case _0x87af('0x2f'):return _0x87af('0x30');case'outlook365':return _0x87af('0x31');}throw new Error('Unknown\x20email\x20service\x20provider',_0x545e98);}function getSmtpHost(_0x4b0227){switch(_0x4b0227){case _0x87af('0x2c'):return _0x87af('0x32');case _0x87af('0x2e'):return _0x87af('0x33');case _0x87af('0x2f'):return'smtp-mail.outlook.com';case'outlook365':return _0x87af('0x34');}throw new Error(_0x87af('0x35'),_0x4b0227);}function getAuthenticationOptions(_0x400bee,_0x37800b){var _0x117878={};var _0x376b16={};if(_0x400bee){_0x117878[_0x87af('0x36')]=_0x376b16[_0x87af('0x36')]=_0x37800b[_0x87af('0x37')];_0x117878['password']=_0x376b16['pass']=_0x37800b[_0x87af('0x38')];if(_0x37800b[_0x87af('0x39')]){_0x117878[_0x87af('0x39')]=_0x376b16[_0x87af('0x39')]=!![];_0x117878[_0x87af('0x3a')]=_0x376b16[_0x87af('0x3a')]=_0x37800b[_0x87af('0x3a')];_0x117878[_0x87af('0x38')]=_0x376b16[_0x87af('0x3b')]=null;}else{_0x117878[_0x87af('0x3a')]=_0x376b16['CloudProviderId']=null;}_0x117878['host']=getImapHost(_0x400bee);_0x117878[_0x87af('0x3c')]=0x3e1;_0x376b16[_0x87af('0x3d')]=getSmtpHost(_0x400bee);_0x376b16[_0x87af('0x3c')]=0x24b;_0x376b16['secure']=![];_0x117878['service']=_0x376b16[_0x87af('0x3e')]=null;}else{if(_0x37800b[_0x87af('0x3f')]){_0x117878[_0x87af('0x36')]=_0x376b16[_0x87af('0x36')]=_0x37800b['username'];_0x117878['password']=_0x376b16[_0x87af('0x3b')]=_0x37800b['password'];}else{_0x117878['authentication']=_0x376b16[_0x87af('0x3f')]=![];_0x117878['user']=_0x376b16[_0x87af('0x36')]=null;_0x117878[_0x87af('0x38')]=_0x376b16['pass']=null;}_0x117878['host']=_0x37800b[_0x87af('0x40')][_0x87af('0x3d')];_0x117878['port']=_0x37800b[_0x87af('0x40')][_0x87af('0x3c')];_0x376b16[_0x87af('0x3d')]=_0x37800b[_0x87af('0x41')][_0x87af('0x3d')];_0x376b16[_0x87af('0x3c')]=_0x37800b[_0x87af('0x41')]['port'];}return{'Imap':_0x117878,'Smtp':_0x376b16};}exports[_0x87af('0x42')]=function(_0x11c486,_0x46883a){var _0x4e106={'include':[{'model':db['MailServerIn'],'as':_0x87af('0x40')},{'model':db[_0x87af('0x43')],'as':'Smtp'},{'model':db[_0x87af('0x44')],'as':'mandatoryDispositionPause'}]},_0x89e9e1={},_0x5009b6={'count':0x0,'rows':[]};var _0x42f1d6=_[_0x87af('0x45')](db[_0x87af('0x46')][_0x87af('0x47')],function(_0x3dc72c){return{'name':_0x3dc72c['fieldName'],'type':_0x3dc72c[_0x87af('0x48')]['key']};});_0x89e9e1[_0x87af('0x49')]=_[_0x87af('0x45')](_0x42f1d6,_0x87af('0x2b'));_0x89e9e1[_0x87af('0x4a')]=_[_0x87af('0x4b')](_0x11c486[_0x87af('0x4a')]);_0x89e9e1[_0x87af('0x4c')]=_['intersection'](_0x89e9e1['model'],_0x89e9e1[_0x87af('0x4a')]);_0x4e106[_0x87af('0x4d')]=_[_0x87af('0x4e')](_0x89e9e1[_0x87af('0x49')],qs['fields'](_0x11c486[_0x87af('0x4a')]['fields']));_0x4e106[_0x87af('0x4d')]=_0x4e106[_0x87af('0x4d')][_0x87af('0x4f')]?_0x4e106[_0x87af('0x4d')]:_0x89e9e1[_0x87af('0x49')];if(!_0x11c486[_0x87af('0x4a')][_0x87af('0x50')](_0x87af('0x51'))){_0x4e106['limit']=qs[_0x87af('0x23')](_0x11c486[_0x87af('0x4a')]['limit']);_0x4e106['offset']=qs['offset'](_0x11c486[_0x87af('0x4a')][_0x87af('0x20')]);}_0x4e106[_0x87af('0x52')]=qs[_0x87af('0x53')](_0x11c486[_0x87af('0x4a')][_0x87af('0x53')]);_0x4e106[_0x87af('0x54')]=qs['filters'](_[_0x87af('0x55')](_0x11c486[_0x87af('0x4a')],_0x89e9e1[_0x87af('0x4c')]),_0x42f1d6);if(_0x11c486[_0x87af('0x4a')][_0x87af('0x56')]){_0x4e106[_0x87af('0x54')]=_[_0x87af('0x57')](_0x4e106[_0x87af('0x54')],{'$or':_[_0x87af('0x45')](_0x42f1d6,function(_0x1728b5){if(_0x1728b5['type']!==_0x87af('0x58')){var _0x3fc37e={};_0x3fc37e[_0x1728b5[_0x87af('0x2b')]]={'$like':'%'+_0x11c486['query'][_0x87af('0x56')]+'%'};return _0x3fc37e;}})});}_0x4e106=_[_0x87af('0x57')]({},_0x4e106,_0x11c486[_0x87af('0x59')]);var _0x1a1d2f={'where':_0x4e106[_0x87af('0x54')]};return db['MailAccount'][_0x87af('0x22')](_0x1a1d2f)[_0x87af('0x12')](function(_0x9078a7){_0x5009b6['count']=_0x9078a7;if(_0x11c486[_0x87af('0x4a')]['includeAll']){_0x4e106['include']=[{'all':!![]}];}return db[_0x87af('0x46')]['findAll'](_0x4e106);})['then'](function(_0x4c17fa){_0x5009b6[_0x87af('0x5a')]=_0x4c17fa;return _0x5009b6;})[_0x87af('0x12')](respondWithFilteredResult(_0x46883a,_0x4e106))[_0x87af('0x1b')](handleError(_0x46883a,null));};exports[_0x87af('0x5b')]=function(_0x176260,_0x1095ab){var _0x35a6ef={'raw':![],'where':{'id':_0x176260[_0x87af('0x5c')]['id']},'include':[{'model':db['MailServerIn'],'as':_0x87af('0x40')},{'model':db[_0x87af('0x43')],'as':_0x87af('0x41')},{'model':db[_0x87af('0x44')],'as':_0x87af('0x5d')}]},_0x594b92={};_0x594b92[_0x87af('0x49')]=_['keys'](db[_0x87af('0x46')][_0x87af('0x47')]);_0x594b92[_0x87af('0x4a')]=_[_0x87af('0x4b')](_0x176260[_0x87af('0x4a')]);_0x594b92[_0x87af('0x4c')]=_[_0x87af('0x4e')](_0x594b92[_0x87af('0x49')],_0x594b92[_0x87af('0x4a')]);_0x35a6ef['attributes']=_[_0x87af('0x4e')](_0x594b92[_0x87af('0x49')],qs[_0x87af('0x5e')](_0x176260[_0x87af('0x4a')]['fields']));_0x35a6ef[_0x87af('0x4d')]=_0x35a6ef[_0x87af('0x4d')]['length']?_0x35a6ef[_0x87af('0x4d')]:_0x594b92[_0x87af('0x49')];if(_0x176260[_0x87af('0x4a')][_0x87af('0x5f')]){_0x35a6ef['include']=[{'all':!![]}];}_0x35a6ef=_[_0x87af('0x57')]({},_0x35a6ef,_0x176260['options']);return db['MailAccount']['find'](_0x35a6ef)[_0x87af('0x12')](handleEntityNotFound(_0x1095ab,null))[_0x87af('0x12')](respondWithResult(_0x1095ab,null))[_0x87af('0x1b')](handleError(_0x1095ab,null));};exports['update']=function(_0x5ac67d,_0x562c99){if(_0x5ac67d['body']['id']){delete _0x5ac67d[_0x87af('0x60')]['id'];}var _0x59544e=_0x5ac67d[_0x87af('0x60')]['provider']===_0x87af('0x61')?null:_0x5ac67d[_0x87af('0x60')][_0x87af('0x62')];var _0x4b4715=_0x5ac67d[_0x87af('0x60')][_0x87af('0x40')]||{};var _0x4178f0=_0x5ac67d[_0x87af('0x60')][_0x87af('0x41')]||{};if(_0x59544e){_0x4b4715[_0x87af('0x3d')]=getImapHost(_0x59544e);_0x4b4715[_0x87af('0x3c')]=0x3e1;_0x4178f0[_0x87af('0x3d')]=getSmtpHost(_0x59544e);_0x4178f0['port']=0x24b;_0x4178f0[_0x87af('0x63')]=![];}if(_0x4178f0[_0x87af('0x39')]){_0x4178f0[_0x87af('0x63')]=![];}else{_0x4178f0[_0x87af('0x3a')]=null;}if(!_0x4b4715[_0x87af('0x39')])_0x4b4715[_0x87af('0x3a')]=null;_0x5ac67d['body'][_0x87af('0x40')]=_0x4b4715;_0x5ac67d['body'][_0x87af('0x41')]=_0x4178f0;return db[_0x87af('0x46')][_0x87af('0x64')]({'where':{'id':_0x5ac67d[_0x87af('0x5c')]['id']},'include':[{'model':db[_0x87af('0x65')],'as':'Imap'},{'model':db[_0x87af('0x43')],'as':_0x87af('0x41')},{'model':db[_0x87af('0x44')],'as':_0x87af('0x5d')}]})[_0x87af('0x12')](handleEntityNotFound(_0x562c99,null))[_0x87af('0x12')](function(_0x1db854){if(!_0x1db854)throw new Error('Mail\x20Account\x20not\x20found');if(_0x1db854[_0x87af('0x3e')])delete _0x5ac67d[_0x87af('0x60')][_0x87af('0x40')];return _0x1db854;})['then'](saveUpdates(_0x5ac67d['body'],null))[_0x87af('0x12')](function(_0x17ebef){if(!_0x5ac67d[_0x87af('0x60')]['Imap'])return _0x17ebef;return db[_0x87af('0x65')][_0x87af('0x25')](_0x5ac67d[_0x87af('0x60')]['Imap'],{'where':{'MailAccountId':_0x17ebef['id']}})[_0x87af('0x12')](function(){return _0x17ebef;});})['then'](function(_0x128031){if(!_0x5ac67d[_0x87af('0x60')][_0x87af('0x41')])return _0x128031;return db[_0x87af('0x43')][_0x87af('0x25')](_0x5ac67d['body'][_0x87af('0x41')],{'where':{'MailAccountId':_0x128031['id']}})[_0x87af('0x12')](function(){return _0x128031;});})[_0x87af('0x12')](respondWithResult(_0x562c99,null))[_0x87af('0x1b')](handleError(_0x562c99,null));};exports['describe']=function(_0x53b8d8,_0x36bda7){return db[_0x87af('0x46')][_0x87af('0x66')]()[_0x87af('0x12')](respondWithResult(_0x36bda7,null))[_0x87af('0x1b')](handleError(_0x36bda7,null));};exports[_0x87af('0x67')]=function(_0x1ea1bb,_0x1bfed8){if(_0x1ea1bb['body']['id']){delete _0x1ea1bb[_0x87af('0x60')]['id'];}return db[_0x87af('0x46')][_0x87af('0x64')]({'where':{'id':_0x1ea1bb['params']['id']}})[_0x87af('0x12')](handleEntityNotFound(_0x1bfed8,null))[_0x87af('0x12')](function(_0x357e45){if(_0x357e45){_0x1ea1bb[_0x87af('0x60')][_0x87af('0x68')]=_0x357e45['id'];return db['Disposition'][_0x87af('0x69')](_0x1ea1bb[_0x87af('0x60')]);}})[_0x87af('0x12')](respondWithResult(_0x1bfed8,null))[_0x87af('0x1b')](handleError(_0x1bfed8,null));};exports[_0x87af('0x6a')]=function(_0x369206,_0xce0cd9){var _0x5375ee={'raw':![],'where':{}};var _0xf59ece={};var _0x1fa3be={'count':0x0,'rows':[]};return db['MailAccount'][_0x87af('0x6b')]({'where':{'id':_0x369206['params']['id']}})[_0x87af('0x12')](handleEntityNotFound(_0xce0cd9,null))[_0x87af('0x12')](function(_0x270f6b){if(_0x270f6b){_0xf59ece[_0x87af('0x49')]=_[_0x87af('0x4b')](db[_0x87af('0x6c')]['rawAttributes']);_0xf59ece[_0x87af('0x4a')]=_[_0x87af('0x4b')](_0x369206[_0x87af('0x4a')]);_0xf59ece[_0x87af('0x4c')]=_[_0x87af('0x4e')](_0xf59ece[_0x87af('0x49')],_0xf59ece[_0x87af('0x4a')]);_0x5375ee[_0x87af('0x4d')]=_['intersection'](_0xf59ece[_0x87af('0x49')],qs['fields'](_0x369206[_0x87af('0x4a')][_0x87af('0x5e')]));_0x5375ee['attributes']=_0x5375ee[_0x87af('0x4d')][_0x87af('0x4f')]?_0x5375ee[_0x87af('0x4d')]:_0xf59ece[_0x87af('0x49')];if(!_0x369206['query'][_0x87af('0x50')](_0x87af('0x51'))){_0x5375ee[_0x87af('0x23')]=qs[_0x87af('0x23')](_0x369206['query'][_0x87af('0x23')]);_0x5375ee['offset']=qs[_0x87af('0x20')](_0x369206[_0x87af('0x4a')]['offset']);}_0x5375ee['order']=qs[_0x87af('0x53')](_0x369206['query'][_0x87af('0x53')]);_0x5375ee[_0x87af('0x54')]=qs[_0x87af('0x4c')](_['pick'](_0x369206[_0x87af('0x4a')],_0xf59ece[_0x87af('0x4c')]));_0x5375ee['where'][_0x87af('0x68')]=_0x270f6b['id'];if(_0x369206['query'][_0x87af('0x56')]){_0x5375ee['where']=_[_0x87af('0x57')](_0x5375ee[_0x87af('0x54')],{'$or':_['map'](_0x5375ee[_0x87af('0x4d')],function(_0x5b3af1){var _0x3d55cd={};_0x3d55cd[_0x5b3af1]={'$like':'%'+_0x369206[_0x87af('0x4a')][_0x87af('0x56')]+'%'};return _0x3d55cd;})});}_0x5375ee=_[_0x87af('0x57')]({},_0x5375ee,_0x369206[_0x87af('0x59')]);return db['Disposition']['count']({'where':_0x5375ee[_0x87af('0x54')]})[_0x87af('0x12')](function(_0x47432b){_0x1fa3be['count']=_0x47432b;if(_0x369206[_0x87af('0x4a')][_0x87af('0x5f')]){_0x5375ee[_0x87af('0x6d')]=[{'all':!![]}];}return db[_0x87af('0x6c')][_0x87af('0x6e')](_0x5375ee);})[_0x87af('0x12')](function(_0xada76){_0x1fa3be[_0x87af('0x5a')]=_0xada76;return _0x1fa3be;});}})['then'](respondWithFilteredResult(_0xce0cd9,_0x5375ee))[_0x87af('0x1b')](handleError(_0xce0cd9,null));};exports['removeDispositions']=function(_0x2b33f3,_0x272255){return db['MailAccount'][_0x87af('0x64')]({'where':{'id':_0x2b33f3[_0x87af('0x5c')]['id']}})[_0x87af('0x12')](handleEntityNotFound(_0x272255,null))['then'](function(_0x4a5ebe){if(_0x4a5ebe){return _0x4a5ebe[_0x87af('0x6f')](_0x2b33f3['query'][_0x87af('0x70')]);}})[_0x87af('0x12')](respondWithStatusCode(_0x272255,null))[_0x87af('0x1b')](handleError(_0x272255,null));};exports[_0x87af('0x71')]=function(_0x109397,_0x32036c){if(_0x109397[_0x87af('0x60')]['id']){delete _0x109397[_0x87af('0x60')]['id'];}return db['MailAccount'][_0x87af('0x64')]({'where':{'id':_0x109397[_0x87af('0x5c')]['id']}})[_0x87af('0x12')](handleEntityNotFound(_0x32036c,null))[_0x87af('0x12')](function(_0x510c04){if(_0x510c04){_0x109397[_0x87af('0x60')][_0x87af('0x68')]=_0x510c04['id'];return db[_0x87af('0x72')][_0x87af('0x69')](_0x109397[_0x87af('0x60')]);}})[_0x87af('0x12')](respondWithResult(_0x32036c,null))['catch'](handleError(_0x32036c,null));};exports['getAnswers']=function(_0x4d1659,_0x38ffa8){var _0x2e44fa={'raw':![],'where':{}};var _0xa8109f={};var _0x585ba5={'count':0x0,'rows':[]};return db[_0x87af('0x46')][_0x87af('0x6b')]({'where':{'id':_0x4d1659['params']['id']}})[_0x87af('0x12')](handleEntityNotFound(_0x38ffa8,null))[_0x87af('0x12')](function(_0x43bb34){if(_0x43bb34){_0xa8109f[_0x87af('0x49')]=_[_0x87af('0x4b')](db[_0x87af('0x72')][_0x87af('0x47')]);_0xa8109f['query']=_[_0x87af('0x4b')](_0x4d1659[_0x87af('0x4a')]);_0xa8109f['filters']=_[_0x87af('0x4e')](_0xa8109f[_0x87af('0x49')],_0xa8109f['query']);_0x2e44fa['attributes']=_[_0x87af('0x4e')](_0xa8109f[_0x87af('0x49')],qs[_0x87af('0x5e')](_0x4d1659['query'][_0x87af('0x5e')]));_0x2e44fa['attributes']=_0x2e44fa['attributes'][_0x87af('0x4f')]?_0x2e44fa[_0x87af('0x4d')]:_0xa8109f[_0x87af('0x49')];if(!_0x4d1659[_0x87af('0x4a')]['hasOwnProperty'](_0x87af('0x51'))){_0x2e44fa[_0x87af('0x23')]=qs[_0x87af('0x23')](_0x4d1659[_0x87af('0x4a')][_0x87af('0x23')]);_0x2e44fa[_0x87af('0x20')]=qs['offset'](_0x4d1659[_0x87af('0x4a')][_0x87af('0x20')]);}_0x2e44fa[_0x87af('0x52')]=qs[_0x87af('0x53')](_0x4d1659['query']['sort']);_0x2e44fa[_0x87af('0x54')]=qs[_0x87af('0x4c')](_[_0x87af('0x55')](_0x4d1659[_0x87af('0x4a')],_0xa8109f[_0x87af('0x4c')]));_0x2e44fa[_0x87af('0x54')][_0x87af('0x68')]=_0x43bb34['id'];if(_0x4d1659[_0x87af('0x4a')][_0x87af('0x56')]){_0x2e44fa[_0x87af('0x54')]=_[_0x87af('0x57')](_0x2e44fa['where'],{'$or':_['map'](_0x2e44fa[_0x87af('0x4d')],function(_0x26b0da){var _0x4571ab={};_0x4571ab[_0x26b0da]={'$like':'%'+_0x4d1659[_0x87af('0x4a')][_0x87af('0x56')]+'%'};return _0x4571ab;})});}_0x2e44fa=_['merge']({},_0x2e44fa,_0x4d1659[_0x87af('0x59')]);return db[_0x87af('0x72')]['count']({'where':_0x2e44fa[_0x87af('0x54')]})[_0x87af('0x12')](function(_0x80f900){_0x585ba5[_0x87af('0x22')]=_0x80f900;if(_0x4d1659['query']['includeAll']){_0x2e44fa['include']=[{'all':!![]}];}return db[_0x87af('0x72')][_0x87af('0x6e')](_0x2e44fa);})[_0x87af('0x12')](function(_0x2e4826){_0x585ba5['rows']=_0x2e4826;return _0x585ba5;});}})[_0x87af('0x12')](respondWithFilteredResult(_0x38ffa8,_0x2e44fa))[_0x87af('0x1b')](handleError(_0x38ffa8,null));};exports[_0x87af('0x73')]=function(_0x395a84,_0x5557fd){return db[_0x87af('0x46')][_0x87af('0x64')]({'where':{'id':_0x395a84[_0x87af('0x5c')]['id']}})[_0x87af('0x12')](handleEntityNotFound(_0x5557fd,null))['then'](function(_0x2f8a87){if(_0x2f8a87){return _0x2f8a87[_0x87af('0x73')](_0x395a84[_0x87af('0x4a')][_0x87af('0x70')]);}})[_0x87af('0x12')](respondWithStatusCode(_0x5557fd,null))[_0x87af('0x1b')](handleError(_0x5557fd,null));};exports[_0x87af('0x69')]=function(_0x3ae3aa,_0x6eb8da){var _0x5a97ba={'name':_0x3ae3aa[_0x87af('0x60')][_0x87af('0x2b')],'key':_0x3ae3aa['body']['key'],'provider':_0x3ae3aa[_0x87af('0x60')][_0x87af('0x62')]===_0x87af('0x61')?null:_0x3ae3aa[_0x87af('0x60')][_0x87af('0x62')],'email':_0x3ae3aa['body'][_0x87af('0x74')],'ListId':_0x3ae3aa[_0x87af('0x60')][_0x87af('0x75')],'active':!_[_0x87af('0x76')](_0x3ae3aa['body']['active'])?_0x3ae3aa[_0x87af('0x60')][_0x87af('0x77')]:!![],'description':_0x3ae3aa[_0x87af('0x60')][_0x87af('0x78')]||null};var _0x1d2172=getAuthenticationOptions(_0x5a97ba['provider'],_0x3ae3aa[_0x87af('0x60')]);_0x5a97ba[_0x87af('0x40')]=_0x1d2172['Imap'];_0x5a97ba['Smtp']=_0x1d2172[_0x87af('0x41')];return db[_0x87af('0x46')][_0x87af('0x69')](_0x5a97ba,{'include':[{'model':db['MailServerOut'],'as':_0x87af('0x41')},{'model':db[_0x87af('0x65')],'as':_0x87af('0x40')}]})[_0x87af('0x12')](function(_0x4dc66a){var _0x3c4a8c=_0x3ae3aa[_0x87af('0x36')][_0x87af('0x27')]({'plain':!![]});if(!_0x3c4a8c)throw new Error(_0x87af('0x79'));if(_0x3c4a8c[_0x87af('0x7a')]===_0x87af('0x36')){var _0x169f18=_0x4dc66a[_0x87af('0x27')]({'plain':!![]});return db[_0x87af('0x7b')][_0x87af('0x64')]({'where':{'name':'MailAccounts','userProfileId':_0x3c4a8c[_0x87af('0x7c')]},'raw':!![]})[_0x87af('0x12')](function(_0x4d0c75){if(_0x4d0c75&&_0x4d0c75[_0x87af('0x7d')]===0x0){return db[_0x87af('0x29')][_0x87af('0x69')]({'name':_0x169f18['name'],'resourceId':_0x169f18['id'],'type':_0x4d0c75['name'],'sectionId':_0x4d0c75['id']},{})[_0x87af('0x12')](function(){return _0x4dc66a;});}else{return _0x4dc66a;}})[_0x87af('0x1b')](function(_0xea0bfa){logger[_0x87af('0x17')](_0x87af('0x7e'),_0xea0bfa);throw _0xea0bfa;});}return _0x4dc66a;})[_0x87af('0x12')](respondWithResult(_0x6eb8da,0xc9))[_0x87af('0x1b')](handleError(_0x6eb8da,null));};exports[_0x87af('0x7f')]=function(_0x2fc91b,_0x182e44){return db[_0x87af('0x46')][_0x87af('0x6b')]({'where':{'id':_0x2fc91b[_0x87af('0x5c')]['id']}})[_0x87af('0x12')](handleEntityNotFound(_0x182e44,null))[_0x87af('0x12')](function(_0x220e7f){if(_0x220e7f){return _0x220e7f[_0x87af('0x7f')]();}return null;})[_0x87af('0x12')](respondWithResult(_0x182e44,null))[_0x87af('0x1b')](handleError(_0x182e44,null));};exports[_0x87af('0x80')]=function(_0x3e00b5,_0x47fec1){if(_0x3e00b5[_0x87af('0x60')]['id']){delete _0x3e00b5[_0x87af('0x60')]['id'];}return db[_0x87af('0x46')][_0x87af('0x64')]({'where':{'id':_0x3e00b5['params']['id']}})[_0x87af('0x12')](handleEntityNotFound(_0x47fec1,null))[_0x87af('0x12')](function(_0x3d617a){if(_0x3d617a){_0x3e00b5[_0x87af('0x60')][_0x87af('0x68')]=_0x3d617a['id'];return db[_0x87af('0x65')][_0x87af('0x69')](_0x3e00b5['body']);}})[_0x87af('0x12')](respondWithResult(_0x47fec1,null))[_0x87af('0x1b')](handleError(_0x47fec1,null));};exports[_0x87af('0x81')]=function(_0x1019f5,_0x364967){return db[_0x87af('0x46')][_0x87af('0x6b')]({'where':{'id':_0x1019f5['params']['id']}})[_0x87af('0x12')](handleEntityNotFound(_0x364967,null))[_0x87af('0x12')](function(_0x328071){if(_0x328071){return _0x328071[_0x87af('0x82')](null);}return null;})['then'](respondWithStatusCode(_0x364967,null))[_0x87af('0x1b')](handleError(_0x364967,null));};exports[_0x87af('0x83')]=function(_0x2d293d,_0x518ae3){return db[_0x87af('0x46')][_0x87af('0x6b')]({'where':{'id':_0x2d293d[_0x87af('0x5c')]['id']}})[_0x87af('0x12')](handleEntityNotFound(_0x518ae3,null))[_0x87af('0x12')](function(_0x31d4bf){if(_0x31d4bf){return _0x31d4bf[_0x87af('0x83')]();}return null;})['then'](respondWithResult(_0x518ae3,null))[_0x87af('0x1b')](handleError(_0x518ae3,null));};exports[_0x87af('0x84')]=function(_0x114671,_0x484fee){if(_0x114671[_0x87af('0x60')]['id']){delete _0x114671['body']['id'];}return db['MailAccount'][_0x87af('0x64')]({'where':{'id':_0x114671[_0x87af('0x5c')]['id']}})[_0x87af('0x12')](handleEntityNotFound(_0x484fee,null))[_0x87af('0x12')](function(_0x2bb73){if(_0x2bb73){_0x114671[_0x87af('0x60')][_0x87af('0x68')]=_0x2bb73['id'];return db['MailServerOut'][_0x87af('0x69')](_0x114671[_0x87af('0x60')]);}})[_0x87af('0x12')](respondWithResult(_0x484fee,null))[_0x87af('0x1b')](handleError(_0x484fee,null));};exports[_0x87af('0x85')]=function(_0xa91087,_0x4a31e6){return db[_0x87af('0x46')][_0x87af('0x6b')]({'where':{'id':_0xa91087[_0x87af('0x5c')]['id']}})[_0x87af('0x12')](handleEntityNotFound(_0x4a31e6,null))[_0x87af('0x12')](function(_0x53c8be){if(_0x53c8be){return _0x53c8be['setSmtp'](null);}return null;})[_0x87af('0x12')](respondWithStatusCode(_0x4a31e6,null))[_0x87af('0x1b')](handleError(_0x4a31e6,null));};exports[_0x87af('0x86')]=function(_0x44b0d5,_0x1cd4cf){return db[_0x87af('0x87')]['find']({'where':{'id':_0x44b0d5[_0x87af('0x5c')]['id']}})[_0x87af('0x12')](handleEntityNotFound(_0x1cd4cf,null))[_0x87af('0x12')](function(_0x5ba8e){if(_0x5ba8e){return _0x5ba8e[_0x87af('0x86')](_0x44b0d5['body']['ids'],_[_0x87af('0x88')](_0x44b0d5[_0x87af('0x60')],[_0x87af('0x70'),'id'])||{});}})[_0x87af('0x12')](respondWithResult(_0x1cd4cf,null))['catch'](handleError(_0x1cd4cf,null));};exports['getInteractions']=function(_0x27adc9,_0x39c1fe){var _0xf25391={'raw':![],'where':{}};var _0x40bf7e={};var _0x15191c={'count':0x0,'rows':[]};return db[_0x87af('0x46')][_0x87af('0x6b')]({'where':{'id':_0x27adc9[_0x87af('0x5c')]['id']}})[_0x87af('0x12')](handleEntityNotFound(_0x39c1fe,null))[_0x87af('0x12')](function(_0x54b363){if(_0x54b363){_0x40bf7e[_0x87af('0x49')]=_['keys'](db[_0x87af('0x87')][_0x87af('0x47')]);_0x40bf7e['query']=_['keys'](_0x27adc9['query']);_0x40bf7e[_0x87af('0x4c')]=_[_0x87af('0x4e')](_0x40bf7e[_0x87af('0x49')],_0x40bf7e[_0x87af('0x4a')]);_0xf25391['attributes']=_[_0x87af('0x4e')](_0x40bf7e[_0x87af('0x49')],qs[_0x87af('0x5e')](_0x27adc9[_0x87af('0x4a')][_0x87af('0x5e')]));_0xf25391[_0x87af('0x4d')]=_0xf25391[_0x87af('0x4d')][_0x87af('0x4f')]?_0xf25391[_0x87af('0x4d')]:_0x40bf7e[_0x87af('0x49')];if(!_0x27adc9[_0x87af('0x4a')][_0x87af('0x50')]('nolimit')){_0xf25391[_0x87af('0x23')]=qs[_0x87af('0x23')](_0x27adc9[_0x87af('0x4a')][_0x87af('0x23')]);_0xf25391[_0x87af('0x20')]=qs['offset'](_0x27adc9[_0x87af('0x4a')][_0x87af('0x20')]);}_0xf25391['order']=qs[_0x87af('0x53')](_0x27adc9[_0x87af('0x4a')][_0x87af('0x53')]);_0xf25391[_0x87af('0x54')]=qs[_0x87af('0x4c')](_[_0x87af('0x55')](_0x27adc9[_0x87af('0x4a')],_0x40bf7e[_0x87af('0x4c')]));_0xf25391[_0x87af('0x54')]['MailAccountId']=_0x54b363['id'];if(_0x27adc9[_0x87af('0x4a')]['filter']){_0xf25391['where']=_[_0x87af('0x57')](_0xf25391['where'],{'$or':_['map'](_0xf25391['attributes'],function(_0x3f3448){var _0x7c0cac={};_0x7c0cac[_0x3f3448]={'$like':'%'+_0x27adc9[_0x87af('0x4a')][_0x87af('0x56')]+'%'};return _0x7c0cac;})});}_0xf25391=_[_0x87af('0x57')]({},_0xf25391,_0x27adc9[_0x87af('0x59')]);return db[_0x87af('0x87')][_0x87af('0x22')]({'where':_0xf25391['where']})[_0x87af('0x12')](function(_0x48d203){_0x15191c[_0x87af('0x22')]=_0x48d203;if(_0x27adc9[_0x87af('0x4a')][_0x87af('0x5f')]){_0xf25391[_0x87af('0x6d')]=[{'model':db[_0x87af('0x89')],'as':_0x87af('0x8a'),'required':![]},{'model':db[_0x87af('0x8b')],'as':_0x87af('0x8c'),'attributes':['name',_0x87af('0x8d'),_0x87af('0x8e')],'required':![]},{'model':db[_0x87af('0x8f')],'as':_0x87af('0x90'),'attributes':['id',_0x87af('0x2b'),_0x87af('0x91')],'where':_0x27adc9[_0x87af('0x4a')][_0x87af('0x92')]?{'id':_0x27adc9[_0x87af('0x4a')]['tag']}:undefined,'required':_0x27adc9[_0x87af('0x4a')][_0x87af('0x92')]?!![]:![]}];}return db[_0x87af('0x87')][_0x87af('0x6e')](_0xf25391);})['then'](function(_0x3a7e43){_0x15191c['rows']=_0x3a7e43;return _0x15191c;});}})[_0x87af('0x12')](respondWithFilteredResult(_0x39c1fe,_0xf25391))[_0x87af('0x1b')](handleError(_0x39c1fe,null));};exports[_0x87af('0x93')]=function addApplications(_0x2e5bcc,_0x538cbb){var _0xb7826d=_0x2e5bcc[_0x87af('0x5c')]['id'];var _0x269ac9=_0x2e5bcc[_0x87af('0x60')];var _0x4b5c5e=0xc8;var _0xe400de=null;return db[_0x87af('0x94')][_0x87af('0x95')]({'isolationLevel':db[_0x87af('0x94')][_0x87af('0x96')][_0x87af('0x97')][_0x87af('0x98')]},function(_0x30078f){return db[_0x87af('0x46')][_0x87af('0x6b')]({'where':{'id':_0xb7826d},'transaction':_0x30078f})[_0x87af('0x12')](function(_0x68ccfc){if(_0x68ccfc){return db[_0x87af('0x99')]['destroy']({'where':{'MailAccountId':_0xb7826d},'transaction':_0x30078f})[_0x87af('0x12')](function(){var _0x255ce8=_[_0x87af('0x45')](_0x269ac9,function(_0x4d335c){_0x4d335c[_0x87af('0x68')]=_0xb7826d;return _0x4d335c;});return db[_0x87af('0x99')]['bulkCreate'](_0x255ce8,{'transaction':_0x30078f});});}else{_0x4b5c5e=0x194;_0xe400de=[];}});})[_0x87af('0x12')](function(){if(_0x4b5c5e!==0x194){return db[_0x87af('0x99')][_0x87af('0x9a')]({'where':{'MailAccountId':_0xb7826d},'order':'priority'})[_0x87af('0x12')](function(_0xe9abb3){_0xe400de=_0xe9abb3;});}})[_0x87af('0x1b')](function(_0x24ee91){_0x4b5c5e=0x1f4;logger['error'](_0x24ee91[_0x87af('0x2a')]);if(_0x24ee91[_0x87af('0x2b')]){delete _0x24ee91[_0x87af('0x2b')];}_0xe400de=_0x24ee91;})[_0x87af('0x9b')](function(){if(_0xe400de===null){_0x538cbb[_0x87af('0x1c')](_0x4b5c5e);}else{if(_0x4b5c5e===0x1f4){_0x538cbb['status'](_0x4b5c5e)['send'](_0xe400de);}else{_0x538cbb['status'](_0x4b5c5e)[_0x87af('0x1f')](_0xe400de);}}});};exports['getApplications']=function(_0x3c6b8c,_0x46e20b){var _0x59fcd1={};var _0x219999={};var _0x47b06a;var _0x277d6c;return db['MailAccount'][_0x87af('0x6b')]({'where':{'id':_0x3c6b8c[_0x87af('0x5c')]['id']}})[_0x87af('0x12')](handleEntityNotFound(_0x46e20b,null))[_0x87af('0x12')](function(_0x3eff7f){if(_0x3eff7f){_0x47b06a=_0x3eff7f;_0x219999['model']=_[_0x87af('0x4b')](db['MailApplication'][_0x87af('0x47')]);_0x219999[_0x87af('0x4a')]=_[_0x87af('0x4b')](_0x3c6b8c[_0x87af('0x4a')]);_0x219999[_0x87af('0x4c')]=_[_0x87af('0x4e')](_0x219999[_0x87af('0x49')],_0x219999[_0x87af('0x4a')]);_0x59fcd1[_0x87af('0x4d')]=_['intersection'](_0x219999[_0x87af('0x49')],qs['fields'](_0x3c6b8c[_0x87af('0x4a')][_0x87af('0x5e')]));_0x59fcd1['attributes']=_0x59fcd1['attributes']['length']?_0x59fcd1[_0x87af('0x4d')]:_0x219999[_0x87af('0x49')];_0x59fcd1[_0x87af('0x52')]=qs['sort'](_0x3c6b8c[_0x87af('0x4a')]['sort']);_0x59fcd1[_0x87af('0x54')]=qs[_0x87af('0x4c')](_[_0x87af('0x55')](_0x3c6b8c[_0x87af('0x4a')],_0x219999[_0x87af('0x4c')]));if(_0x3c6b8c[_0x87af('0x4a')][_0x87af('0x56')]){_0x59fcd1[_0x87af('0x54')]=_['merge'](_0x59fcd1['where'],{'$or':_['map'](_0x59fcd1[_0x87af('0x4d')],function(_0x5616b4){var _0x5cc6bf={};_0x5cc6bf[_0x5616b4]={'$like':'%'+_0x3c6b8c[_0x87af('0x4a')][_0x87af('0x56')]+'%'};return _0x5cc6bf;})});}_0x59fcd1=_['merge']({},_0x59fcd1,_0x3c6b8c[_0x87af('0x59')]);return _0x47b06a[_0x87af('0x9c')](_0x59fcd1);}})['then'](function(_0x59e0b7){if(_0x59e0b7){_0x277d6c=_0x59e0b7[_0x87af('0x4f')];if(!_0x3c6b8c[_0x87af('0x4a')][_0x87af('0x50')](_0x87af('0x51'))){_0x59fcd1['limit']=qs[_0x87af('0x23')](_0x3c6b8c[_0x87af('0x4a')][_0x87af('0x23')]);_0x59fcd1[_0x87af('0x20')]=qs[_0x87af('0x20')](_0x3c6b8c[_0x87af('0x4a')]['offset']);}return _0x47b06a['getApplications'](_0x59fcd1);}})[_0x87af('0x12')](function(_0x157b69){if(_0x157b69){return _0x157b69?{'count':_0x277d6c,'rows':_0x157b69}:null;}})[_0x87af('0x12')](respondWithResult(_0x46e20b,null))[_0x87af('0x1b')](handleError(_0x46e20b,null));};exports[_0x87af('0x9d')]=function(_0x3c0eb1,_0x800f26){var _0x188215={'raw':!![],'where':{}};var _0x5c54f8={};var _0x20197d={'count':0x0,'rows':[]};return db[_0x87af('0x46')][_0x87af('0x6b')]({'where':{'id':_0x3c0eb1['params']['id']}})[_0x87af('0x12')](handleEntityNotFound(_0x800f26,null))[_0x87af('0x12')](function(_0x4708ea){if(_0x4708ea){_0x5c54f8['model']=_[_0x87af('0x4b')](db[_0x87af('0x9e')][_0x87af('0x47')]);_0x5c54f8['query']=_[_0x87af('0x4b')](_0x3c0eb1[_0x87af('0x4a')]);_0x5c54f8['filters']=_[_0x87af('0x4e')](_0x5c54f8[_0x87af('0x49')],_0x5c54f8[_0x87af('0x4a')]);_0x188215[_0x87af('0x4d')]=_[_0x87af('0x4e')](_0x5c54f8[_0x87af('0x49')],qs['fields'](_0x3c0eb1[_0x87af('0x4a')][_0x87af('0x5e')]));_0x188215[_0x87af('0x4d')]=_0x188215[_0x87af('0x4d')][_0x87af('0x4f')]?_0x188215['attributes']:_0x5c54f8[_0x87af('0x49')];if(!_0x3c0eb1[_0x87af('0x4a')][_0x87af('0x50')](_0x87af('0x51'))){_0x188215[_0x87af('0x23')]=qs[_0x87af('0x23')](_0x3c0eb1[_0x87af('0x4a')][_0x87af('0x23')]);_0x188215[_0x87af('0x20')]=qs[_0x87af('0x20')](_0x3c0eb1[_0x87af('0x4a')][_0x87af('0x20')]);}_0x188215[_0x87af('0x52')]=qs[_0x87af('0x53')](_0x3c0eb1[_0x87af('0x4a')][_0x87af('0x53')]);_0x188215[_0x87af('0x54')]=qs[_0x87af('0x4c')](_[_0x87af('0x55')](_0x3c0eb1[_0x87af('0x4a')],_0x5c54f8[_0x87af('0x4c')]));_0x188215[_0x87af('0x54')]['MailAccountId']=_0x4708ea['id'];if(_0x3c0eb1[_0x87af('0x4a')][_0x87af('0x56')]){_0x188215[_0x87af('0x54')]=_['merge'](_0x188215['where'],{'$or':_[_0x87af('0x45')](_0x188215[_0x87af('0x4d')],function(_0x506e14){var _0x3c55fb={};_0x3c55fb[_0x506e14]={'$like':'%'+_0x3c0eb1['query']['filter']+'%'};return _0x3c55fb;})});}if(_0x3c0eb1['query'][_0x87af('0x9f')]){var _0x58692d=_0x3c0eb1[_0x87af('0x4a')]['$gte'][_0x87af('0xa0')](',');var _0x3b0497={};_0x3b0497[_0x58692d[0x0]]={'$gte':moment(_0x58692d[0x1])[_0x87af('0xa1')](_0x87af('0xa2'))};_0x188215[_0x87af('0x54')]=_[_0x87af('0x57')](_0x188215[_0x87af('0x54')],_0x3b0497);}_0x188215=_[_0x87af('0x57')]({},_0x188215,_0x3c0eb1['options']);return db[_0x87af('0x9e')][_0x87af('0x22')]({'where':_0x188215[_0x87af('0x54')]})[_0x87af('0x12')](function(_0x5dd1d0){_0x20197d[_0x87af('0x22')]=_0x5dd1d0;if(_0x3c0eb1['query']['includeAll']){_0x188215[_0x87af('0x6d')]=[{'all':!![]}];}return db[_0x87af('0x9e')][_0x87af('0x6e')](_0x188215);})[_0x87af('0x12')](function(_0x298aa0){if(_0x3c0eb1[_0x87af('0x4a')][_0x87af('0xa3')]===_0x87af('0xa4')){for(var _0x72186c=0x0;_0x72186c<_0x298aa0[_0x87af('0x4f')];_0x72186c++){_0x298aa0[_0x72186c][_0x87af('0x60')]=juice(_0x298aa0[_0x72186c]['body']);}}_0x20197d[_0x87af('0x5a')]=_0x298aa0;return _0x20197d;});}})[_0x87af('0x12')](respondWithFilteredResult(_0x800f26,_0x188215))[_0x87af('0x1b')](handleError(_0x800f26,null));};exports[_0x87af('0xa5')]=function(_0x1bf7c,_0x41a11a){var _0x51ac72,_0x14a150={},_0x4c0e24;if(_0x1bf7c[_0x87af('0x60')]['to']){_0x4c0e24=_0x1bf7c['body']['to'][_0x87af('0xa0')](',')[0x0];}return db[_0x87af('0x46')][_0x87af('0x64')]({'where':{'id':_0x1bf7c[_0x87af('0x5c')]['id']},'include':[{'model':db[_0x87af('0xa6')],'as':_0x87af('0xa7'),'include':[{'model':db[_0x87af('0x89')],'as':'Contacts','where':{'email':_0x4c0e24},'limit':0x1,'order':[[_0x87af('0xa8'),'DESC']]}]},{'model':db['MailServerOut'],'as':_0x87af('0x41'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0x87af('0xa9'),'raw':!![]}]}]})[_0x87af('0x12')](handleEntityNotFound(_0x41a11a,null))[_0x87af('0x12')](function(_0x20f278){if(!_0x20f278)return;_0x51ac72=_0x20f278;if(!_0x20f278[_0x87af('0x41')])throw new Error(_0x87af('0xaa'));if(_[_0x87af('0x76')](_0x1bf7c[_0x87af('0x60')][_0x87af('0xab')])){_0x1bf7c[_0x87af('0x60')][_0x87af('0xab')]=util['format'](_0x87af('0xac'),_0x20f278['name'],_0x20f278['email']||_0x20f278[_0x87af('0x41')][_0x87af('0x36')]);}if(_0x1bf7c[_0x87af('0x60')]['attachments']&&_0x1bf7c[_0x87af('0x60')][_0x87af('0xad')][_0x87af('0x4f')]){for(var _0x128345=0x0;_0x128345<_0x1bf7c[_0x87af('0x60')][_0x87af('0xad')][_0x87af('0x4f')];_0x128345+=0x1){_0x1bf7c['body'][_0x87af('0xad')][_0x128345]={'filename':_0x1bf7c[_0x87af('0x60')]['attachments'][_0x128345][_0x87af('0x2b')],'path':path[_0x87af('0xae')](config[_0x87af('0xaf')],_0x87af('0xb0'),_0x1bf7c[_0x87af('0x60')][_0x87af('0xad')][_0x128345][_0x87af('0xb1')])};}}var _0x2401b5=_0x20f278[_0x87af('0xb2')]();return respondWithRpcPromise(_0x87af('0xb3'),_0x87af('0xb4'),{'account':_0x2401b5,'message':_0x1bf7c['body']});})['then'](function(_0x4abf1b){if(!_0x4abf1b)return;_0x14a150=_0x4abf1b;if(!_0x51ac72[_0x87af('0xa7')])throw new Error(_0x87af('0xb5'));if(_0x51ac72[_0x87af('0xa7')][_0x87af('0xb6')][_0x87af('0x4f')])return _0x51ac72[_0x87af('0xa7')][_0x87af('0xb6')][0x0];return db[_0x87af('0x89')][_0x87af('0x69')](_[_0x87af('0xa')](_0x1bf7c[_0x87af('0x60')],{'firstName':_0x1bf7c['body']['to'],'email':_0x1bf7c['body']['to'],'phone':_0x1bf7c[_0x87af('0x60')]['to'],'ListId':_0x51ac72['ListId']}));})[_0x87af('0x12')](function(_0x383abd){if(!_0x383abd)return;var _0x22da16={'UserId':_0x1bf7c[_0x87af('0x36')]['id'],'ContactId':_0x383abd['id'],'MailAccountId':_0x51ac72['id'],'inReplyTo':_0x14a150[_0x87af('0xb7')],'to':_0x1bf7c[_0x87af('0x60')][_0x87af('0xab')],'cc':_0x1bf7c[_0x87af('0x60')]['cc'],'subject':_0x1bf7c['body'][_0x87af('0xb8')],'attach':_0x1bf7c[_0x87af('0x60')][_0x87af('0xb9')],'firstMsgDirection':_0x87af('0xba'),'lastMsgAt':moment()[_0x87af('0xa1')](_0x87af('0xa2')),'lastMsgDirection':'out','Messages':[_[_0x87af('0x57')](_0x1bf7c[_0x87af('0x60')],{'messageId':_0x14a150[_0x87af('0xb7')],'sentAt':moment()[_0x87af('0xa1')](_0x87af('0xa2')),'read':!![],'MailAccountId':_0x51ac72['id'],'UserId':_0x1bf7c[_0x87af('0x36')]['id'],'ContactId':_0x383abd['id']})]};if(_0x1bf7c[_0x87af('0x60')][_0x87af('0xbb')]){_0x22da16=_['merge'](_0x22da16,_0x1bf7c['body'][_0x87af('0xbb')]);}return db[_0x87af('0x87')]['create'](_0x22da16,{'include':[{'model':db[_0x87af('0x9e')],'as':'Messages'}]});})[_0x87af('0x12')](respondWithResult(_0x41a11a,null))[_0x87af('0x1b')](handleError(_0x41a11a,null));};exports[_0x87af('0xbc')]=function(_0x26a3dc,_0x640a63){return db[_0x87af('0x46')][_0x87af('0x64')]({'where':{'id':_0x26a3dc[_0x87af('0x5c')]['id']},'include':[{'model':db[_0x87af('0x43')],'as':'Smtp','raw':!![],'include':[{'model':db[_0x87af('0xa9')],'as':_0x87af('0xa9'),'raw':!![]}]}]})['then'](handleEntityNotFound(_0x640a63,null))[_0x87af('0x12')](function(_0x45f52e){if(!_0x45f52e['Smtp'])return;var _0x7a6d95=_0x45f52e[_0x87af('0xb2')]();return respondWithRpcPromise(_0x87af('0xbd'),_0x87af('0xbc'),{'account':_0x7a6d95});})[_0x87af('0x12')](respondWithResult(_0x640a63,null))[_0x87af('0x1b')](handleError(_0x640a63,null));};exports[_0x87af('0x26')]=function(_0xa70368,_0x5429a3){return db[_0x87af('0x46')]['find']({'where':{'id':_0xa70368[_0x87af('0x5c')]['id']}})['then'](handleEntityNotFound(_0x5429a3,null))[_0x87af('0x12')](function(_0xd9e807){if(_0xd9e807&&_0xd9e807[_0x87af('0x3e')]){throw new db[(_0x87af('0xbe'))][(_0x87af('0xbf'))]('You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account');}return _0xd9e807;})['then'](removeEntity(_0x5429a3,null))[_0x87af('0x1b')](handleError(_0x5429a3,null));};exports['addAgents']=function(_0x38eda1,_0x37d2f3){return db[_0x87af('0x46')][_0x87af('0x64')]({'where':{'id':_0x38eda1[_0x87af('0x5c')]['id']}})[_0x87af('0x12')](handleEntityNotFound(_0x37d2f3,null))['then'](function(_0x228c77){if(_0x228c77){return _0x228c77[_0x87af('0xc0')](_0x38eda1[_0x87af('0x60')]['ids'],_[_0x87af('0x88')](_0x38eda1[_0x87af('0x60')],['ids','id'])||{})[_0x87af('0xc1')](function(_0x4c470c){for(var _0x3076b2=0x0;_0x3076b2<_0x38eda1[_0x87af('0x60')][_0x87af('0x70')][_0x87af('0x4f')];_0x3076b2+=0x1){socket[_0x87af('0xc2')]('userMailAccount:save',{'UserId':Number(_0x38eda1['body'][_0x87af('0x70')][_0x3076b2]),'MailAccountId':Number(_0x38eda1['params']['id'])});}return _0x4c470c;});}})[_0x87af('0x12')](respondWithResult(_0x37d2f3,null))[_0x87af('0x1b')](handleError(_0x37d2f3,null));};exports[_0x87af('0xc3')]=function(_0x15a036,_0x115cb0){return db[_0x87af('0x46')][_0x87af('0x64')]({'where':{'id':_0x15a036[_0x87af('0x5c')]['id']}})[_0x87af('0x12')](handleEntityNotFound(_0x115cb0,null))['then'](function(_0x30dff2){if(_0x30dff2){return _0x30dff2[_0x87af('0xc3')](_0x15a036[_0x87af('0x4a')][_0x87af('0x70')])[_0x87af('0x12')](function(){if(_['isArray'](_0x15a036[_0x87af('0x4a')]['ids'])){for(var _0x183457=0x0;_0x183457<_0x15a036[_0x87af('0x4a')][_0x87af('0x70')][_0x87af('0x4f')];_0x183457+=0x1){socket[_0x87af('0xc2')](_0x87af('0xc4'),{'UserId':Number(_0x15a036[_0x87af('0x4a')][_0x87af('0x70')][_0x183457]),'MailAccountId':Number(_0x15a036['params']['id'])});}}else{socket['emit'](_0x87af('0xc4'),{'UserId':Number(_0x15a036['query']['ids']),'MailAccountId':Number(_0x15a036['params']['id'])});}});}})[_0x87af('0x12')](respondWithStatusCode(_0x115cb0,null))[_0x87af('0x1b')](handleError(_0x115cb0,null));};exports['getAgents']=function(_0x1d4d01,_0x1839c6){var _0x291da6={};var _0x3d98da={};var _0x31e3ac;var _0x508e5e;return db[_0x87af('0x46')][_0x87af('0x6b')]({'where':{'id':_0x1d4d01['params']['id']}})[_0x87af('0x12')](handleEntityNotFound(_0x1839c6,null))['then'](function(_0x481855){if(_0x481855){_0x31e3ac=_0x481855;_0x3d98da['model']=_[_0x87af('0x4b')](db[_0x87af('0x8b')]['rawAttributes']);_0x3d98da[_0x87af('0x4a')]=_[_0x87af('0x4b')](_0x1d4d01['query']);_0x3d98da['filters']=_['intersection'](_0x3d98da[_0x87af('0x49')],_0x3d98da[_0x87af('0x4a')]);_0x291da6[_0x87af('0x4d')]=_[_0x87af('0x4e')](_0x3d98da['model'],qs[_0x87af('0x5e')](_0x1d4d01['query']['fields']));_0x291da6[_0x87af('0x4d')]=_0x291da6[_0x87af('0x4d')][_0x87af('0x4f')]?_0x291da6[_0x87af('0x4d')]:_0x3d98da[_0x87af('0x49')];_0x291da6[_0x87af('0x52')]=qs[_0x87af('0x53')](_0x1d4d01['query']['sort']);_0x291da6['where']=qs[_0x87af('0x4c')](_['pick'](_0x1d4d01[_0x87af('0x4a')],_0x3d98da[_0x87af('0x4c')]));if(_0x1d4d01['query'][_0x87af('0x56')]){_0x291da6['where']=_[_0x87af('0x57')](_0x291da6[_0x87af('0x54')],{'$or':_[_0x87af('0x45')](_0x291da6[_0x87af('0x4d')],function(_0xdf083b){var _0x30cdfa={};_0x30cdfa[_0xdf083b]={'$like':'%'+_0x1d4d01[_0x87af('0x4a')][_0x87af('0x56')]+'%'};return _0x30cdfa;})});}_0x291da6=_[_0x87af('0x57')]({},_0x291da6,_0x1d4d01[_0x87af('0x59')]);return _0x31e3ac[_0x87af('0xc5')](_0x291da6);}})[_0x87af('0x12')](function(_0x2edf3d){if(_0x2edf3d){_0x508e5e=_0x2edf3d['length'];if(!_0x1d4d01[_0x87af('0x4a')]['hasOwnProperty'](_0x87af('0x51'))){_0x291da6[_0x87af('0x23')]=qs[_0x87af('0x23')](_0x1d4d01[_0x87af('0x4a')][_0x87af('0x23')]);_0x291da6[_0x87af('0x20')]=qs[_0x87af('0x20')](_0x1d4d01['query'][_0x87af('0x20')]);}return _0x31e3ac['getAgents'](_0x291da6);}})[_0x87af('0x12')](function(_0x527ad0){if(_0x527ad0){return _0x527ad0?{'count':_0x508e5e,'rows':_0x527ad0}:null;}})[_0x87af('0x12')](respondWithResult(_0x1839c6,null))[_0x87af('0x1b')](handleError(_0x1839c6,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index aa4c1a9..b71dc5c 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 _0x6c1a=['setMaxListeners','remove','emit','hasOwnProperty','hook','events','../../mysqldb'];(function(_0x412e35,_0x5af5dc){var _0x2e2a61=function(_0xa14b52){while(--_0xa14b52){_0x412e35['push'](_0x412e35['shift']());}};_0x2e2a61(++_0x5af5dc);}(_0x6c1a,0xf3));var _0xa6c1=function(_0xf654ab,_0x15c4db){_0xf654ab=_0xf654ab-0x0;var _0x385783=_0x6c1a[_0xf654ab];return _0x385783;};'use strict';var EventEmitter=require(_0xa6c1('0x0'));var MailAccount=require(_0xa6c1('0x1'))['db']['MailAccount'];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0xa6c1('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xa6c1('0x3')};function emitEvent(_0x4b3bcc){return function(_0x200b3a,_0x329395,_0x55f74b){MailAccountEvents[_0xa6c1('0x4')](_0x4b3bcc+':'+_0x200b3a['id'],_0x200b3a);MailAccountEvents[_0xa6c1('0x4')](_0x4b3bcc,_0x200b3a);_0x55f74b(null);};}for(var e in events){if(events[_0xa6c1('0x5')](e)){var event=events[e];MailAccount[_0xa6c1('0x6')](e,emitEvent(event));}}module['exports']=MailAccountEvents; \ No newline at end of file +var _0x7374=['exports','events','../../mysqldb','MailAccount','setMaxListeners','save','remove','emit','hasOwnProperty','hook'];(function(_0x471863,_0x31a1e6){var _0x575cae=function(_0x1271ef){while(--_0x1271ef){_0x471863['push'](_0x471863['shift']());}};_0x575cae(++_0x31a1e6);}(_0x7374,0x1b9));var _0x4737=function(_0x19fc11,_0x170bc6){_0x19fc11=_0x19fc11-0x0;var _0x23f9ab=_0x7374[_0x19fc11];return _0x23f9ab;};'use strict';var EventEmitter=require(_0x4737('0x0'));var MailAccount=require(_0x4737('0x1'))['db'][_0x4737('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x4737('0x3')](0x0);var events={'afterCreate':_0x4737('0x4'),'afterUpdate':'update','afterDestroy':_0x4737('0x5')};function emitEvent(_0x3d3aed){return function(_0x4bc490,_0x3887cc,_0x5a9003){MailAccountEvents['emit'](_0x3d3aed+':'+_0x4bc490['id'],_0x4bc490);MailAccountEvents[_0x4737('0x6')](_0x3d3aed,_0x4bc490);_0x5a9003(null);};}for(var e in events){if(events[_0x4737('0x7')](e)){var event=events[e];MailAccount[_0x4737('0x8')](e,emitEvent(event));}}module[_0x4737('0x9')]=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index 4525f15..b1f8544 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 _0xf504=['secure','authentication','modernAuthentication','auth','OAuth2','user','CloudProvider','data5','pass','./mailAccount.attributes','exports','define','MailAccount','mail_accounts','provider','custom','service','host','Smtp','port'];(function(_0x45d3f0,_0x4be53f){var _0x314b79=function(_0x563d32){while(--_0x563d32){_0x45d3f0['push'](_0x45d3f0['shift']());}};_0x314b79(++_0x4be53f);}(_0xf504,0xd1));var _0x4f50=function(_0x1f58d1,_0x883b14){_0x1f58d1=_0x1f58d1-0x0;var _0x6882f1=_0xf504[_0x1f58d1];return _0x6882f1;};'use strict';var attributes=require(_0x4f50('0x0'));module[_0x4f50('0x1')]=function(_0x4f9afa){return _0x4f9afa[_0x4f50('0x2')](_0x4f50('0x3'),attributes,{'tableName':_0x4f50('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x54f0f3=this;var _0x12b9ff={'id':_0x54f0f3['id'],'tls':{'rejectUnauthorized':![]}};if(_0x54f0f3[_0x4f50('0x5')]!==_0x4f50('0x6')){_0x12b9ff[_0x4f50('0x7')]=_0x54f0f3[_0x4f50('0x5')];}else{_0x12b9ff[_0x4f50('0x8')]=_0x54f0f3[_0x4f50('0x9')][_0x4f50('0x8')];_0x12b9ff['port']=_0x54f0f3[_0x4f50('0x9')][_0x4f50('0xa')];_0x12b9ff[_0x4f50('0xb')]=_0x54f0f3[_0x4f50('0x9')][_0x4f50('0xb')];}if(_0x54f0f3[_0x4f50('0x9')][_0x4f50('0xc')]){if(_0x54f0f3[_0x4f50('0x9')][_0x4f50('0xd')]){if(!_0x54f0f3['Smtp']['CloudProvider'])throw new Error('Cloud\x20Provider\x20configuration\x20not\x20found');_0x12b9ff[_0x4f50('0xe')]={'type':_0x4f50('0xf'),'user':_0x54f0f3[_0x4f50('0x9')][_0x4f50('0x10')],'accessToken':_0x54f0f3[_0x4f50('0x9')][_0x4f50('0x11')][_0x4f50('0x12')]};}else{_0x12b9ff[_0x4f50('0xe')]={'user':_0x54f0f3['Smtp']['user'],'pass':_0x54f0f3[_0x4f50('0x9')][_0x4f50('0x13')]};}}return _0x12b9ff;}}});}; \ No newline at end of file +var _0x75df=['provider','Smtp','host','port','secure','authentication','modernAuthentication','CloudProvider','Cloud\x20Provider\x20configuration\x20not\x20found','auth','user','data5','pass','./mailAccount.attributes','define','MailAccount','mail_accounts'];(function(_0x2405bc,_0x2f28a1){var _0x5272d4=function(_0x225294){while(--_0x225294){_0x2405bc['push'](_0x2405bc['shift']());}};_0x5272d4(++_0x2f28a1);}(_0x75df,0x150));var _0xf75d=function(_0x4f83c3,_0x21a1d5){_0x4f83c3=_0x4f83c3-0x0;var _0xead83b=_0x75df[_0x4f83c3];return _0xead83b;};'use strict';var attributes=require(_0xf75d('0x0'));module['exports']=function(_0x7ebaad){return _0x7ebaad[_0xf75d('0x1')](_0xf75d('0x2'),attributes,{'tableName':_0xf75d('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x58a313=this;var _0x1a3de6={'id':_0x58a313['id'],'tls':{'rejectUnauthorized':![]}};if(_0x58a313[_0xf75d('0x4')]!=='custom'){_0x1a3de6['service']=_0x58a313['provider'];}else{_0x1a3de6['host']=_0x58a313[_0xf75d('0x5')][_0xf75d('0x6')];_0x1a3de6[_0xf75d('0x7')]=_0x58a313['Smtp']['port'];_0x1a3de6['secure']=_0x58a313[_0xf75d('0x5')][_0xf75d('0x8')];}if(_0x58a313[_0xf75d('0x5')][_0xf75d('0x9')]){if(_0x58a313[_0xf75d('0x5')][_0xf75d('0xa')]){if(!_0x58a313[_0xf75d('0x5')][_0xf75d('0xb')])throw new Error(_0xf75d('0xc'));_0x1a3de6[_0xf75d('0xd')]={'type':'OAuth2','user':_0x58a313['Smtp'][_0xf75d('0xe')],'accessToken':_0x58a313[_0xf75d('0x5')][_0xf75d('0xb')][_0xf75d('0xf')]};}else{_0x1a3de6[_0xf75d('0xd')]={'user':_0x58a313['Smtp']['user'],'pass':_0x58a313[_0xf75d('0x5')][_0xf75d('0x10')]};}}return _0x1a3de6;}}});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index 242ac3b..3521940 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 _0xafc4=['lodash','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','http','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','register','then','info','MailAccount,\x20%s,\x20%s','debug','MailAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','findAll','options','raw','where','attributes','include','map','model','GetMailAccount','ShowMailAccount','MailAccount','find','smtp','setDataValue','smtpOptions','getSmtpOptions','NotifyMailAccount','body','keys','CmContact','createdAt','updatedAt','CompanyId','ListId','isNil','from','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','DESC','Smtp','CloudProvider','get','account','omit','Applications','list','applications','asc','autoclose','push','length','close','*,*,*,*','create','List\x20not\x20found','contact','messageId','generate','subject','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','Messages','spread','attachments','originTo','originCc','bcc','ChatWebsiteId','originChannel','Email','Attachments','UserId','User','name','interaction','unshift','agent','waitForTheAssignedAgent','MailQueue','queueId','waitForTheAssignedQueue','startRouting'];(function(_0x10df1e,_0xf56f85){var _0x3e24fb=function(_0x5cdb59){while(--_0x5cdb59){_0x10df1e['push'](_0x10df1e['shift']());}};_0x3e24fb(++_0xf56f85);}(_0xafc4,0x69));var _0x4afc=function(_0x2622ba,_0xabb967){_0x2622ba=_0x2622ba-0x0;var _0x257e2b=_0xafc4[_0x2622ba];return _0x257e2b;};'use strict';var _=require(_0x4afc('0x0'));var moment=require('moment');var BPromise=require(_0x4afc('0x1'));var rs=require('randomstring');var Redis=require(_0x4afc('0x2'));var db=require(_0x4afc('0x3'))['db'];var logger=require(_0x4afc('0x4'))(_0x4afc('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x4afc('0x6')]({'port':0x232c});config[_0x4afc('0x7')]=_[_0x4afc('0x8')](config[_0x4afc('0x7')],{'host':_0x4afc('0x9'),'port':0x18eb});var socket=require(_0x4afc('0xa'))(new Redis(config['redis']));require(_0x4afc('0xb'))[_0x4afc('0xc')](socket);function respondWithRpcPromise(_0x134aad,_0x1e6bf5,_0x1b8981){return new BPromise(function(_0x458fde,_0x5542ec){return client['request'](_0x134aad,_0x1b8981)[_0x4afc('0xd')](function(_0x49222e){logger[_0x4afc('0xe')](_0x4afc('0xf'),_0x1e6bf5,'request\x20sent');logger[_0x4afc('0x10')](_0x4afc('0x11'),_0x1e6bf5,_0x4afc('0x12'),JSON[_0x4afc('0x13')](_0x49222e));if(_0x49222e[_0x4afc('0x14')]){if(_0x49222e[_0x4afc('0x14')][_0x4afc('0x15')]===0x1f4){logger[_0x4afc('0x14')]('MailAccount,\x20%s,\x20%s',_0x1e6bf5,_0x49222e[_0x4afc('0x14')][_0x4afc('0x16')]);return _0x5542ec(_0x49222e[_0x4afc('0x14')][_0x4afc('0x16')]);}logger['error']('MailAccount,\x20%s,\x20%s',_0x1e6bf5,_0x49222e[_0x4afc('0x14')]['message']);return _0x458fde(_0x49222e[_0x4afc('0x14')][_0x4afc('0x16')]);}else{logger[_0x4afc('0xe')](_0x4afc('0xf'),_0x1e6bf5,_0x4afc('0x12'));_0x458fde(_0x49222e[_0x4afc('0x17')][_0x4afc('0x16')]);}})[_0x4afc('0x18')](function(_0x16365f){logger[_0x4afc('0x14')](_0x4afc('0xf'),_0x1e6bf5,_0x16365f);_0x5542ec(_0x16365f);});});}exports['GetMailAccount']=function(_0x1a8f49){var _0x25603b=this;return new Promise(function(_0x32865e,_0x14558a){return db['MailAccount'][_0x4afc('0x19')]({'raw':_0x1a8f49[_0x4afc('0x1a')]?_0x1a8f49[_0x4afc('0x1a')][_0x4afc('0x1b')]===undefined?!![]:![]:!![],'where':_0x1a8f49[_0x4afc('0x1a')]?_0x1a8f49[_0x4afc('0x1a')][_0x4afc('0x1c')]||null:null,'attributes':_0x1a8f49['options']?_0x1a8f49[_0x4afc('0x1a')][_0x4afc('0x1d')]||null:null,'limit':_0x1a8f49['options']?_0x1a8f49[_0x4afc('0x1a')]['limit']||null:null,'include':_0x1a8f49[_0x4afc('0x1a')]?_0x1a8f49[_0x4afc('0x1a')][_0x4afc('0x1e')]?_[_0x4afc('0x1f')](_0x1a8f49[_0x4afc('0x1a')][_0x4afc('0x1e')],function(_0x40a0db){return{'model':db[_0x40a0db[_0x4afc('0x20')]],'as':_0x40a0db['as'],'attributes':_0x40a0db[_0x4afc('0x1d')],'include':_0x40a0db[_0x4afc('0x1e')]?_[_0x4afc('0x1f')](_0x40a0db[_0x4afc('0x1e')],function(_0x35f5b3){return{'model':db[_0x35f5b3['model']],'as':_0x35f5b3['as'],'attributes':_0x35f5b3[_0x4afc('0x1d')],'include':_0x35f5b3[_0x4afc('0x1e')]?_[_0x4afc('0x1f')](_0x35f5b3['include'],function(_0x52212d){return{'model':db[_0x52212d['model']],'as':_0x52212d['as'],'attributes':_0x52212d[_0x4afc('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x4afc('0xd')](function(_0x5e4747){logger[_0x4afc('0xe')](_0x4afc('0x21'),_0x1a8f49);logger['debug']('GetMailAccount',_0x1a8f49,JSON['stringify'](_0x5e4747));_0x32865e(_0x5e4747);})[_0x4afc('0x18')](function(_0x34434a){logger[_0x4afc('0x14')](_0x4afc('0x21'),_0x34434a[_0x4afc('0x16')],_0x1a8f49);_0x14558a(_0x25603b[_0x4afc('0x14')](0x1f4,_0x34434a['message']));});});};exports[_0x4afc('0x22')]=function(_0x3d1693){var _0x1ba6b5=this;return new Promise(function(_0x2f178c,_0x2b115d){return db[_0x4afc('0x23')][_0x4afc('0x24')]({'raw':_0x3d1693[_0x4afc('0x1a')]?_0x3d1693['options'][_0x4afc('0x1b')]===undefined?!![]:![]:!![],'where':_0x3d1693['options']?_0x3d1693['options'][_0x4afc('0x1c')]||null:null,'attributes':_0x3d1693[_0x4afc('0x1a')]?_0x3d1693[_0x4afc('0x1a')][_0x4afc('0x1d')]||null:null,'include':_0x3d1693[_0x4afc('0x1a')]?_0x3d1693[_0x4afc('0x1a')]['include']?_[_0x4afc('0x1f')](_0x3d1693[_0x4afc('0x1a')][_0x4afc('0x1e')],function(_0x127ac8){return{'model':db[_0x127ac8[_0x4afc('0x20')]],'as':_0x127ac8['as'],'attributes':_0x127ac8[_0x4afc('0x1d')],'include':_0x127ac8['include']?_[_0x4afc('0x1f')](_0x127ac8[_0x4afc('0x1e')],function(_0x91565d){return{'model':db[_0x91565d[_0x4afc('0x20')]],'as':_0x91565d['as'],'attributes':_0x91565d['attributes'],'include':_0x91565d['include']?_[_0x4afc('0x1f')](_0x91565d[_0x4afc('0x1e')],function(_0x17ea03){return{'model':db[_0x17ea03['model']],'as':_0x17ea03['as'],'attributes':_0x17ea03['attributes']};}):[]};}):[]};}):[]:[]})[_0x4afc('0xd')](function(_0x4a06cf){if(_0x3d1693['options'][_0x4afc('0x25')]===!![])_0x4a06cf[_0x4afc('0x26')](_0x4afc('0x27'),_0x4a06cf[_0x4afc('0x28')]());logger[_0x4afc('0xe')](_0x4afc('0x22'),_0x3d1693);logger[_0x4afc('0x10')](_0x4afc('0x22'),_0x3d1693,JSON[_0x4afc('0x13')](_0x4a06cf));_0x2f178c(_0x4a06cf);})[_0x4afc('0x18')](function(_0x26e59f){logger[_0x4afc('0x14')](_0x4afc('0x22'),_0x26e59f[_0x4afc('0x16')],_0x3d1693);_0x2b115d(_0x1ba6b5[_0x4afc('0x14')](0x1f4,_0x26e59f['message']));});});};exports[_0x4afc('0x29')]=function(_0x6a8345){var _0x4357a6=this;return new Promise(function(_0xe6db12,_0x12db1d){var _0x260b06={'body':_0x6a8345[_0x4afc('0x2a')],'channel':'mail'};var _0x5e97f4=_['difference'](_[_0x4afc('0x2b')](db[_0x4afc('0x2c')]['rawAttributes']),[_0x4afc('0x2d'),_0x4afc('0x2e'),_0x4afc('0x2f'),_0x4afc('0x30')]);var _0x545109=![];if(_0x6a8345[_0x4afc('0x2a')]['id']){delete _0x6a8345[_0x4afc('0x2a')]['id'];}if(_[_0x4afc('0x31')](_0x6a8345[_0x4afc('0x2a')][_0x4afc('0x32')])){return _0x12db1d(_0x4357a6[_0x4afc('0x14')](0x1f4,'from\x20is\x20mandatory'));}if(_[_0x4afc('0x31')](_0x6a8345['body'][_0x4afc('0x2a')])||_0x6a8345[_0x4afc('0x2a')][_0x4afc('0x2a')]===''){return _0x12db1d(_0x4357a6['error'](0x1f4,'body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0x4afc('0x31')](_0x6a8345[_0x4afc('0x2a')][_0x4afc('0x33')])){return _0x12db1d(_0x4357a6[_0x4afc('0x14')](0x1f4,_0x4afc('0x34')+_0x5e97f4));}if(!_[_0x4afc('0x35')](_0x5e97f4,_0x6a8345[_0x4afc('0x2a')][_0x4afc('0x33')])){return _0x12db1d(_0x4357a6['error'](0x1f4,_0x4afc('0x36')+_0x5e97f4));}var _0xb1e91e={};_0xb1e91e[_0x6a8345['body'][_0x4afc('0x33')]]=_0x6a8345['body'][_0x4afc('0x32')];return db[_0x4afc('0x23')][_0x4afc('0x24')]({'where':{'id':_0x6a8345['account']['id']},'include':[{'model':db[_0x4afc('0x37')],'as':_0x4afc('0x38'),'include':[{'model':db[_0x4afc('0x2c')],'as':_0x4afc('0x39'),'where':_0xb1e91e,'limit':0x1,'order':[[_0x4afc('0x2e'),_0x4afc('0x3a')]]}]},{'model':db['MailApplication'],'as':'Applications'},{'model':db['MailServerOut'],'as':_0x4afc('0x3b'),'include':[{'model':db[_0x4afc('0x3c')],'as':_0x4afc('0x3c')}]}]})[_0x4afc('0xd')](function(_0xb5cca9){if(_0xb5cca9&&_0xb5cca9[_0x4afc('0x38')]){var _0x22e8b0=_0xb5cca9[_0x4afc('0x3d')]({'plain':!![]});_0x260b06[_0x4afc('0x3e')]=_[_0x4afc('0x3f')](_0x22e8b0,['Applications',_0x4afc('0x38')]);_0x260b06['account']['smtpOptions']=_0xb5cca9[_0x4afc('0x28')]();_0x260b06['applications']=_0x22e8b0[_0x4afc('0x40')];_0x260b06[_0x4afc('0x41')]=_0x22e8b0[_0x4afc('0x38')];_0x260b06[_0x4afc('0x42')]=_['orderBy'](_0x260b06[_0x4afc('0x42')],['priority'],[_0x4afc('0x43')]);if(_0x260b06[_0x4afc('0x3e')]&&_0x260b06[_0x4afc('0x3e')][_0x4afc('0x44')]){_0x260b06[_0x4afc('0x42')][_0x4afc('0x45')]({'id':0x0,'priority':_0x260b06[_0x4afc('0x42')][_0x4afc('0x46')]+0x1,'app':_0x4afc('0x47'),'appdata':_0x4afc('0x44'),'interval':_0x4afc('0x48')});}if(_0x260b06[_0x4afc('0x3e')]['Applications']){delete _0x260b06[_0x4afc('0x3e')][_0x4afc('0x40')];}if(_0x260b06[_0x4afc('0x3e')][_0x4afc('0x38')]){delete _0x260b06[_0x4afc('0x3e')][_0x4afc('0x38')];}if(_0x22e8b0[_0x4afc('0x38')][_0x4afc('0x39')][_0x4afc('0x46')]){return _0x22e8b0[_0x4afc('0x38')][_0x4afc('0x39')][0x0];}var _0x2aa927=_[_0x4afc('0x8')](_0x6a8345['body'],{'firstName':_0x6a8345[_0x4afc('0x2a')]['from'],'ListId':_0x22e8b0[_0x4afc('0x30')]});_0x2aa927[_0x6a8345[_0x4afc('0x2a')][_0x4afc('0x33')]]=_0x6a8345[_0x4afc('0x2a')]['from'];return db['CmContact'][_0x4afc('0x49')](_0x2aa927);}else{throw new Error(_0x4afc('0x4a'));}})['then'](function(_0x40021e){_0x260b06[_0x4afc('0x4b')]=_0x40021e;if(_0x40021e){if(!_0x6a8345[_0x4afc('0x2a')][_0x4afc('0x16')][_0x4afc('0x4c')]){_0x6a8345[_0x4afc('0x2a')][_0x4afc('0x16')][_0x4afc('0x4c')]=rs[_0x4afc('0x4d')]()+'\x20'+_0x6a8345[_0x4afc('0x2a')][_0x4afc('0x16')][_0x4afc('0x32')];}var _0x22f586={'ContactId':_0x40021e['id'],'MailAccountId':_0x6a8345[_0x4afc('0x3e')]['id'],'inReplyTo':_0x6a8345['body'][_0x4afc('0x16')][_0x4afc('0x4c')],'to':_0x6a8345[_0x4afc('0x2a')][_0x4afc('0x16')][_0x4afc('0x32')],'cc':_0x6a8345[_0x4afc('0x2a')][_0x4afc('0x16')]['cc'],'subject':_0x6a8345['body'][_0x4afc('0x16')][_0x4afc('0x4e')],'attach':_0x6a8345['body']['message'][_0x4afc('0x4f')],'lastMsgAt':moment()[_0x4afc('0x50')](_0x4afc('0x51')),'lastMsgDirection':'in'};return db[_0x4afc('0x52')][_0x4afc('0x24')]({'where':{'closed':![],'MailAccountId':_0x6a8345[_0x4afc('0x3e')]['id']},'include':[{'model':db[_0x4afc('0x53')],'as':_0x4afc('0x54'),'attributes':[_0x4afc('0x4c')],'where':{'messageId':_0x6a8345[_0x4afc('0x2a')]['message']['inReplyTo']}}]})[_0x4afc('0xd')](function(_0x139786){if(_0x139786){return[_0x139786,![]];}return db['MailInteraction'][_0x4afc('0x49')](_0x22f586)[_0x4afc('0xd')](function(_0x5be1a7){return[_0x5be1a7,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0x4afc('0x55')](function(_0x26f4ee,_0x576ea0){if(_0x26f4ee){_0x545109=_0x576ea0;if(!_0x576ea0){return _0x26f4ee['update']({'inReplyTo':_0x6a8345[_0x4afc('0x2a')]['message']['messageId'],'to':_0x6a8345[_0x4afc('0x2a')][_0x4afc('0x16')][_0x4afc('0x32')],'cc':_0x6a8345[_0x4afc('0x2a')][_0x4afc('0x16')]['cc'],'subject':_0x6a8345[_0x4afc('0x2a')][_0x4afc('0x16')][_0x4afc('0x4e')],'attach':_0x26f4ee[_0x4afc('0x4f')]?_0x26f4ee['attach']:_0x6a8345[_0x4afc('0x2a')][_0x4afc('0x16')][_0x4afc('0x4f')],'substatus':null,'substatusAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgAt':moment()['format'](_0x4afc('0x51')),'lastMsgDirection':'in'});}else{return _0x26f4ee;}}})[_0x4afc('0xd')](function(_0x195378){_0x260b06['interaction']=_0x195378[_0x4afc('0x3d')]({'plain':!![]});_0x260b06['interaction']['created']=_0x545109;return db['MailMessage'][_0x4afc('0x49')]({'body':_0x6a8345[_0x4afc('0x2a')][_0x4afc('0x2a')],'MailAccountId':_0x6a8345['account']['id'],'MailInteractionId':_0x195378['id'],'direction':'in','ContactId':_0x260b06[_0x4afc('0x4b')]['id'],'messageId':_0x6a8345[_0x4afc('0x2a')][_0x4afc('0x16')]['messageId'],'from':_0x6a8345[_0x4afc('0x2a')][_0x4afc('0x16')][_0x4afc('0x32')],'to':_0x6a8345[_0x4afc('0x2a')][_0x4afc('0x16')]['to'],'cc':_0x6a8345['body']['message']['cc'],'subject':_0x6a8345[_0x4afc('0x2a')][_0x4afc('0x16')][_0x4afc('0x4e')],'attach':_0x6a8345['body'][_0x4afc('0x16')][_0x4afc('0x4f')],'Attachments':_0x6a8345[_0x4afc('0x2a')][_0x4afc('0x16')][_0x4afc('0x56')],'originTo':_0x6a8345['body'][_0x4afc('0x16')][_0x4afc('0x57')],'originCc':_0x6a8345['body'][_0x4afc('0x16')][_0x4afc('0x58')],'bcc':_0x6a8345[_0x4afc('0x2a')]['message'][_0x4afc('0x59')],'ChatWebsiteId':_0x6a8345[_0x4afc('0x2a')][_0x4afc('0x16')][_0x4afc('0x5a')]||null,'originChannel':_0x6a8345[_0x4afc('0x2a')][_0x4afc('0x16')][_0x4afc('0x5b')]||_0x4afc('0x5c'),'ChatOfflineMessageId':_0x6a8345['body'][_0x4afc('0x16')]['ChatOfflineMessageId']||null},{'include':[{'model':db['Attachment'],'as':_0x4afc('0x5d')}]});})[_0x4afc('0xd')](function(_0x1354f1){_0x260b06['message']=_0x1354f1;if(!_0x260b06['interaction'][_0x4afc('0x5e')]){return;}return db[_0x4afc('0x5f')][_0x4afc('0x24')]({'attributes':['id',_0x4afc('0x60')],'where':{'id':_0x260b06[_0x4afc('0x61')][_0x4afc('0x5e')]}});})[_0x4afc('0xd')](function(_0x198ec9){if(_0x198ec9){_0x260b06[_0x4afc('0x42')][_0x4afc('0x62')]({'id':0x0,'priority':0x0,'app':_0x4afc('0x63'),'appdata':_0x198ec9[_0x4afc('0x60')]+','+(_0x260b06[_0x4afc('0x3e')][_0x4afc('0x64')]||0xa),'interval':_0x4afc('0x48')});}if(!_0x260b06[_0x4afc('0x61')]['queueId']){return;}return db[_0x4afc('0x65')][_0x4afc('0x24')]({'attributes':['id',_0x4afc('0x60')],'where':{'id':_0x260b06[_0x4afc('0x61')][_0x4afc('0x66')]}});})[_0x4afc('0xd')](function(_0x3fddd1){if(_0x3fddd1){_0x260b06[_0x4afc('0x42')][_0x4afc('0x62')]({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x3fddd1[_0x4afc('0x60')]+','+(_0x260b06[_0x4afc('0x3e')][_0x4afc('0x67')]||0x12c),'interval':_0x4afc('0x48')});}return respondWithRpcPromise('Start',_0x4afc('0x68'),_0x260b06);})[_0x4afc('0xd')](function(_0x4ce81a){_0xe6db12(_0x4ce81a);})[_0x4afc('0x18')](function(_0x46fe52){_0x12db1d(_0x4357a6[_0x4afc('0x14')](0x1f4,_0x46fe52[_0x4afc('0x16')]));});});}; \ No newline at end of file +var _0x1115=['UserId','unshift','agent','name','waitForTheAssignedAgent','queueId','MailQueue','queue','waitForTheAssignedQueue','Start','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetMailAccount','MailAccount','findAll','options','raw','where','attributes','limit','include','map','model','ShowMailAccount','find','smtp','setDataValue','smtpOptions','NotifyMailAccount','body','mail','difference','keys','CmContact','createdAt','updatedAt','CompanyId','ListId','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','account','List','Contacts','Applications','CloudProvider','get','omit','getSmtpOptions','applications','list','orderBy','priority','asc','autoclose','push','length','close','*,*,*,*','from','List\x20not\x20found','contact','messageId','generate','subject','attach','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','inReplyTo','Contact\x20not\x20found','spread','update','format','interaction','originTo','ChatWebsiteId','originChannel','Email','ChatOfflineMessageId','Attachments'];(function(_0x3cfe66,_0x222d5c){var _0x4d0b8b=function(_0x4dea5a){while(--_0x4dea5a){_0x3cfe66['push'](_0x3cfe66['shift']());}};_0x4d0b8b(++_0x222d5c);}(_0x1115,0x1b6));var _0x5111=function(_0x3b4679,_0x4bbc1b){_0x3b4679=_0x3b4679-0x0;var _0x4ed7f6=_0x1115[_0x3b4679];return _0x4ed7f6;};'use strict';var _=require('lodash');var moment=require(_0x5111('0x0'));var BPromise=require(_0x5111('0x1'));var rs=require(_0x5111('0x2'));var Redis=require(_0x5111('0x3'));var db=require(_0x5111('0x4'))['db'];var logger=require(_0x5111('0x5'))(_0x5111('0x6'));var config=require(_0x5111('0x7'));var jayson=require(_0x5111('0x8'));var client=jayson['client']['http']({'port':0x232c});config[_0x5111('0x9')]=_[_0x5111('0xa')](config['redis'],{'host':_0x5111('0xb'),'port':0x18eb});var socket=require(_0x5111('0xc'))(new Redis(config['redis']));require(_0x5111('0xd'))['register'](socket);function respondWithRpcPromise(_0x2d8e0a,_0x3bbc8c,_0x4ecb50){return new BPromise(function(_0x5e12a7,_0x347d87){return client['request'](_0x2d8e0a,_0x4ecb50)[_0x5111('0xe')](function(_0x4f0b34){logger[_0x5111('0xf')](_0x5111('0x10'),_0x3bbc8c,_0x5111('0x11'));logger[_0x5111('0x12')](_0x5111('0x13'),_0x3bbc8c,_0x5111('0x11'),JSON[_0x5111('0x14')](_0x4f0b34));if(_0x4f0b34[_0x5111('0x15')]){if(_0x4f0b34[_0x5111('0x15')][_0x5111('0x16')]===0x1f4){logger[_0x5111('0x15')](_0x5111('0x10'),_0x3bbc8c,_0x4f0b34[_0x5111('0x15')][_0x5111('0x17')]);return _0x347d87(_0x4f0b34[_0x5111('0x15')][_0x5111('0x17')]);}logger[_0x5111('0x15')](_0x5111('0x10'),_0x3bbc8c,_0x4f0b34['error'][_0x5111('0x17')]);return _0x5e12a7(_0x4f0b34['error']['message']);}else{logger[_0x5111('0xf')](_0x5111('0x10'),_0x3bbc8c,_0x5111('0x11'));_0x5e12a7(_0x4f0b34['result'][_0x5111('0x17')]);}})[_0x5111('0x18')](function(_0x52c614){logger[_0x5111('0x15')](_0x5111('0x10'),_0x3bbc8c,_0x52c614);_0x347d87(_0x52c614);});});}exports[_0x5111('0x19')]=function(_0x1b3b45){var _0x5e8f1d=this;return new Promise(function(_0x52d236,_0x2a1840){return db[_0x5111('0x1a')][_0x5111('0x1b')]({'raw':_0x1b3b45[_0x5111('0x1c')]?_0x1b3b45[_0x5111('0x1c')][_0x5111('0x1d')]===undefined?!![]:![]:!![],'where':_0x1b3b45[_0x5111('0x1c')]?_0x1b3b45[_0x5111('0x1c')][_0x5111('0x1e')]||null:null,'attributes':_0x1b3b45['options']?_0x1b3b45[_0x5111('0x1c')][_0x5111('0x1f')]||null:null,'limit':_0x1b3b45[_0x5111('0x1c')]?_0x1b3b45['options'][_0x5111('0x20')]||null:null,'include':_0x1b3b45[_0x5111('0x1c')]?_0x1b3b45[_0x5111('0x1c')][_0x5111('0x21')]?_[_0x5111('0x22')](_0x1b3b45[_0x5111('0x1c')][_0x5111('0x21')],function(_0x316b39){return{'model':db[_0x316b39[_0x5111('0x23')]],'as':_0x316b39['as'],'attributes':_0x316b39[_0x5111('0x1f')],'include':_0x316b39['include']?_[_0x5111('0x22')](_0x316b39[_0x5111('0x21')],function(_0x151b67){return{'model':db[_0x151b67[_0x5111('0x23')]],'as':_0x151b67['as'],'attributes':_0x151b67[_0x5111('0x1f')],'include':_0x151b67[_0x5111('0x21')]?_[_0x5111('0x22')](_0x151b67['include'],function(_0x1ce17f){return{'model':db[_0x1ce17f[_0x5111('0x23')]],'as':_0x1ce17f['as'],'attributes':_0x1ce17f[_0x5111('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xdf9031){logger[_0x5111('0xf')](_0x5111('0x19'),_0x1b3b45);logger['debug']('GetMailAccount',_0x1b3b45,JSON[_0x5111('0x14')](_0xdf9031));_0x52d236(_0xdf9031);})['catch'](function(_0xbacf9e){logger['error'](_0x5111('0x19'),_0xbacf9e['message'],_0x1b3b45);_0x2a1840(_0x5e8f1d['error'](0x1f4,_0xbacf9e['message']));});});};exports[_0x5111('0x24')]=function(_0x3fb9a5){var _0xe0839e=this;return new Promise(function(_0x3763f4,_0x13fafe){return db[_0x5111('0x1a')][_0x5111('0x25')]({'raw':_0x3fb9a5['options']?_0x3fb9a5[_0x5111('0x1c')][_0x5111('0x1d')]===undefined?!![]:![]:!![],'where':_0x3fb9a5[_0x5111('0x1c')]?_0x3fb9a5[_0x5111('0x1c')]['where']||null:null,'attributes':_0x3fb9a5['options']?_0x3fb9a5[_0x5111('0x1c')][_0x5111('0x1f')]||null:null,'include':_0x3fb9a5[_0x5111('0x1c')]?_0x3fb9a5[_0x5111('0x1c')][_0x5111('0x21')]?_[_0x5111('0x22')](_0x3fb9a5[_0x5111('0x1c')][_0x5111('0x21')],function(_0x4d4bf5){return{'model':db[_0x4d4bf5[_0x5111('0x23')]],'as':_0x4d4bf5['as'],'attributes':_0x4d4bf5[_0x5111('0x1f')],'include':_0x4d4bf5[_0x5111('0x21')]?_['map'](_0x4d4bf5[_0x5111('0x21')],function(_0xdc5c58){return{'model':db[_0xdc5c58[_0x5111('0x23')]],'as':_0xdc5c58['as'],'attributes':_0xdc5c58['attributes'],'include':_0xdc5c58['include']?_['map'](_0xdc5c58[_0x5111('0x21')],function(_0x187cab){return{'model':db[_0x187cab[_0x5111('0x23')]],'as':_0x187cab['as'],'attributes':_0x187cab[_0x5111('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x5111('0xe')](function(_0x570126){if(_0x3fb9a5[_0x5111('0x1c')][_0x5111('0x26')]===!![])_0x570126[_0x5111('0x27')](_0x5111('0x28'),_0x570126['getSmtpOptions']());logger[_0x5111('0xf')](_0x5111('0x24'),_0x3fb9a5);logger[_0x5111('0x12')](_0x5111('0x24'),_0x3fb9a5,JSON[_0x5111('0x14')](_0x570126));_0x3763f4(_0x570126);})[_0x5111('0x18')](function(_0x295d5e){logger[_0x5111('0x15')](_0x5111('0x24'),_0x295d5e[_0x5111('0x17')],_0x3fb9a5);_0x13fafe(_0xe0839e[_0x5111('0x15')](0x1f4,_0x295d5e[_0x5111('0x17')]));});});};exports[_0x5111('0x29')]=function(_0x4e0bc4){var _0x352de9=this;return new Promise(function(_0xf00f9,_0x54d2f1){var _0x2818ec={'body':_0x4e0bc4[_0x5111('0x2a')],'channel':_0x5111('0x2b')};var _0x41005f=_[_0x5111('0x2c')](_[_0x5111('0x2d')](db[_0x5111('0x2e')]['rawAttributes']),[_0x5111('0x2f'),_0x5111('0x30'),_0x5111('0x31'),_0x5111('0x32')]);var _0x96893c=![];if(_0x4e0bc4['body']['id']){delete _0x4e0bc4['body']['id'];}if(_[_0x5111('0x33')](_0x4e0bc4[_0x5111('0x2a')]['from'])){return _0x54d2f1(_0x352de9[_0x5111('0x15')](0x1f4,_0x5111('0x34')));}if(_[_0x5111('0x33')](_0x4e0bc4[_0x5111('0x2a')][_0x5111('0x2a')])||_0x4e0bc4[_0x5111('0x2a')][_0x5111('0x2a')]===''){return _0x54d2f1(_0x352de9[_0x5111('0x15')](0x1f4,_0x5111('0x35')));}if(_[_0x5111('0x33')](_0x4e0bc4['body']['mapKey'])){return _0x54d2f1(_0x352de9[_0x5111('0x15')](0x1f4,_0x5111('0x36')+_0x41005f));}if(!_[_0x5111('0x37')](_0x41005f,_0x4e0bc4[_0x5111('0x2a')][_0x5111('0x38')])){return _0x54d2f1(_0x352de9[_0x5111('0x15')](0x1f4,'mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x41005f));}var _0x1b9a74={};_0x1b9a74[_0x4e0bc4[_0x5111('0x2a')][_0x5111('0x38')]]=_0x4e0bc4[_0x5111('0x2a')]['from'];return db[_0x5111('0x1a')][_0x5111('0x25')]({'where':{'id':_0x4e0bc4[_0x5111('0x39')]['id']},'include':[{'model':db['CmList'],'as':_0x5111('0x3a'),'include':[{'model':db[_0x5111('0x2e')],'as':_0x5111('0x3b'),'where':_0x1b9a74,'limit':0x1,'order':[[_0x5111('0x30'),'DESC']]}]},{'model':db['MailApplication'],'as':_0x5111('0x3c')},{'model':db['MailServerOut'],'as':'Smtp','include':[{'model':db[_0x5111('0x3d')],'as':_0x5111('0x3d')}]}]})['then'](function(_0x296f87){if(_0x296f87&&_0x296f87[_0x5111('0x3a')]){var _0x1676f9=_0x296f87[_0x5111('0x3e')]({'plain':!![]});_0x2818ec[_0x5111('0x39')]=_[_0x5111('0x3f')](_0x1676f9,[_0x5111('0x3c'),_0x5111('0x3a')]);_0x2818ec[_0x5111('0x39')][_0x5111('0x28')]=_0x296f87[_0x5111('0x40')]();_0x2818ec[_0x5111('0x41')]=_0x1676f9['Applications'];_0x2818ec[_0x5111('0x42')]=_0x1676f9[_0x5111('0x3a')];_0x2818ec[_0x5111('0x41')]=_[_0x5111('0x43')](_0x2818ec[_0x5111('0x41')],[_0x5111('0x44')],[_0x5111('0x45')]);if(_0x2818ec['account']&&_0x2818ec['account'][_0x5111('0x46')]){_0x2818ec['applications'][_0x5111('0x47')]({'id':0x0,'priority':_0x2818ec[_0x5111('0x41')][_0x5111('0x48')]+0x1,'app':_0x5111('0x49'),'appdata':_0x5111('0x46'),'interval':_0x5111('0x4a')});}if(_0x2818ec[_0x5111('0x39')]['Applications']){delete _0x2818ec[_0x5111('0x39')][_0x5111('0x3c')];}if(_0x2818ec['account'][_0x5111('0x3a')]){delete _0x2818ec[_0x5111('0x39')]['List'];}if(_0x1676f9[_0x5111('0x3a')]['Contacts']['length']){return _0x1676f9['List'][_0x5111('0x3b')][0x0];}var _0x30fb6d=_[_0x5111('0xa')](_0x4e0bc4[_0x5111('0x2a')],{'firstName':_0x4e0bc4['body'][_0x5111('0x4b')],'ListId':_0x1676f9[_0x5111('0x32')]});_0x30fb6d[_0x4e0bc4[_0x5111('0x2a')]['mapKey']]=_0x4e0bc4[_0x5111('0x2a')][_0x5111('0x4b')];return db[_0x5111('0x2e')]['create'](_0x30fb6d);}else{throw new Error(_0x5111('0x4c'));}})['then'](function(_0x3bf42d){_0x2818ec[_0x5111('0x4d')]=_0x3bf42d;if(_0x3bf42d){if(!_0x4e0bc4[_0x5111('0x2a')][_0x5111('0x17')]['messageId']){_0x4e0bc4[_0x5111('0x2a')][_0x5111('0x17')][_0x5111('0x4e')]=rs[_0x5111('0x4f')]()+'\x20'+_0x4e0bc4[_0x5111('0x2a')][_0x5111('0x17')][_0x5111('0x4b')];}var _0x54c415={'ContactId':_0x3bf42d['id'],'MailAccountId':_0x4e0bc4[_0x5111('0x39')]['id'],'inReplyTo':_0x4e0bc4['body'][_0x5111('0x17')][_0x5111('0x4e')],'to':_0x4e0bc4[_0x5111('0x2a')][_0x5111('0x17')][_0x5111('0x4b')],'cc':_0x4e0bc4[_0x5111('0x2a')]['message']['cc'],'subject':_0x4e0bc4[_0x5111('0x2a')][_0x5111('0x17')][_0x5111('0x50')],'attach':_0x4e0bc4[_0x5111('0x2a')][_0x5111('0x17')][_0x5111('0x51')],'lastMsgAt':moment()['format'](_0x5111('0x52')),'lastMsgDirection':'in'};return db[_0x5111('0x53')][_0x5111('0x25')]({'where':{'closed':![],'MailAccountId':_0x4e0bc4[_0x5111('0x39')]['id']},'include':[{'model':db[_0x5111('0x54')],'as':'Messages','attributes':[_0x5111('0x4e')],'where':{'messageId':_0x4e0bc4[_0x5111('0x2a')][_0x5111('0x17')][_0x5111('0x55')]}}]})[_0x5111('0xe')](function(_0x39de80){if(_0x39de80){return[_0x39de80,![]];}return db[_0x5111('0x53')]['create'](_0x54c415)['then'](function(_0x4eaed9){return[_0x4eaed9,!![]];});});}else{throw new Error(_0x5111('0x56'));}})[_0x5111('0x57')](function(_0x1674d6,_0x3fb713){if(_0x1674d6){_0x96893c=_0x3fb713;if(!_0x3fb713){return _0x1674d6[_0x5111('0x58')]({'inReplyTo':_0x4e0bc4['body'][_0x5111('0x17')][_0x5111('0x4e')],'to':_0x4e0bc4[_0x5111('0x2a')][_0x5111('0x17')][_0x5111('0x4b')],'cc':_0x4e0bc4[_0x5111('0x2a')][_0x5111('0x17')]['cc'],'subject':_0x4e0bc4[_0x5111('0x2a')][_0x5111('0x17')][_0x5111('0x50')],'attach':_0x1674d6['attach']?_0x1674d6[_0x5111('0x51')]:_0x4e0bc4[_0x5111('0x2a')]['message'][_0x5111('0x51')],'substatus':null,'substatusAt':moment()[_0x5111('0x59')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgAt':moment()[_0x5111('0x59')](_0x5111('0x52')),'lastMsgDirection':'in'});}else{return _0x1674d6;}}})[_0x5111('0xe')](function(_0x3a7cc9){_0x2818ec[_0x5111('0x5a')]=_0x3a7cc9[_0x5111('0x3e')]({'plain':!![]});_0x2818ec[_0x5111('0x5a')]['created']=_0x96893c;return db[_0x5111('0x54')]['create']({'body':_0x4e0bc4['body'][_0x5111('0x2a')],'MailAccountId':_0x4e0bc4['account']['id'],'MailInteractionId':_0x3a7cc9['id'],'direction':'in','ContactId':_0x2818ec[_0x5111('0x4d')]['id'],'messageId':_0x4e0bc4['body'][_0x5111('0x17')][_0x5111('0x4e')],'from':_0x4e0bc4[_0x5111('0x2a')][_0x5111('0x17')][_0x5111('0x4b')],'to':_0x4e0bc4[_0x5111('0x2a')][_0x5111('0x17')]['to'],'cc':_0x4e0bc4[_0x5111('0x2a')][_0x5111('0x17')]['cc'],'subject':_0x4e0bc4[_0x5111('0x2a')][_0x5111('0x17')][_0x5111('0x50')],'attach':_0x4e0bc4[_0x5111('0x2a')]['message'][_0x5111('0x51')],'Attachments':_0x4e0bc4['body'][_0x5111('0x17')]['attachments'],'originTo':_0x4e0bc4[_0x5111('0x2a')][_0x5111('0x17')][_0x5111('0x5b')],'originCc':_0x4e0bc4[_0x5111('0x2a')][_0x5111('0x17')]['originCc'],'bcc':_0x4e0bc4['body'][_0x5111('0x17')]['bcc'],'ChatWebsiteId':_0x4e0bc4['body'][_0x5111('0x17')][_0x5111('0x5c')]||null,'originChannel':_0x4e0bc4[_0x5111('0x2a')][_0x5111('0x17')][_0x5111('0x5d')]||_0x5111('0x5e'),'ChatOfflineMessageId':_0x4e0bc4['body'][_0x5111('0x17')][_0x5111('0x5f')]||null},{'include':[{'model':db['Attachment'],'as':_0x5111('0x60')}]});})['then'](function(_0x1ffb56){_0x2818ec[_0x5111('0x17')]=_0x1ffb56;if(!_0x2818ec[_0x5111('0x5a')][_0x5111('0x61')]){return;}return db['User'][_0x5111('0x25')]({'attributes':['id','name'],'where':{'id':_0x2818ec[_0x5111('0x5a')]['UserId']}});})[_0x5111('0xe')](function(_0x335919){if(_0x335919){_0x2818ec[_0x5111('0x41')][_0x5111('0x62')]({'id':0x0,'priority':0x0,'app':_0x5111('0x63'),'appdata':_0x335919[_0x5111('0x64')]+','+(_0x2818ec[_0x5111('0x39')][_0x5111('0x65')]||0xa),'interval':'*,*,*,*'});}if(!_0x2818ec[_0x5111('0x5a')][_0x5111('0x66')]){return;}return db[_0x5111('0x67')][_0x5111('0x25')]({'attributes':['id',_0x5111('0x64')],'where':{'id':_0x2818ec['interaction'][_0x5111('0x66')]}});})[_0x5111('0xe')](function(_0x5d2772){if(_0x5d2772){_0x2818ec[_0x5111('0x41')][_0x5111('0x62')]({'id':0x0,'priority':0x1,'app':_0x5111('0x68'),'appdata':_0x5d2772['name']+','+(_0x2818ec[_0x5111('0x39')][_0x5111('0x69')]||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x5111('0x6a'),'startRouting',_0x2818ec);})[_0x5111('0xe')](function(_0x5dcc50){_0xf00f9(_0x5dcc50);})[_0x5111('0x18')](function(_0x44b7ff){_0x54d2f1(_0x352de9[_0x5111('0x15')](0x1f4,_0x44b7ff[_0x5111('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index 22443db..9e2186f 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 _0x8556=['./mailAccount.events','save','remove','emit','removeListener','register'];(function(_0x118da4,_0x2e192e){var _0x40dfbb=function(_0x43b165){while(--_0x43b165){_0x118da4['push'](_0x118da4['shift']());}};_0x40dfbb(++_0x2e192e);}(_0x8556,0x1da));var _0x6855=function(_0xd274ec,_0x6b590b){_0xd274ec=_0xd274ec-0x0;var _0x5345c8=_0x8556[_0xd274ec];return _0x5345c8;};'use strict';var MailAccountEvents=require(_0x6855('0x0'));var events=[_0x6855('0x1'),_0x6855('0x2'),'update'];function createListener(_0xe452b0,_0x174c33){return function(_0x121ac9){_0x174c33[_0x6855('0x3')](_0xe452b0,_0x121ac9);};}function removeListener(_0x1c8537,_0x3ba6bb){return function(){MailAccountEvents[_0x6855('0x4')](_0x1c8537,_0x3ba6bb);};}exports[_0x6855('0x5')]=function(_0x346b22){for(var _0x2b02bf=0x0,_0x1c9def=events['length'];_0x2b02bf<_0x1c9def;_0x2b02bf++){var _0x1c060f=events[_0x2b02bf];var _0x1d7e9c=createListener('mailAccount:'+_0x1c060f,_0x346b22);MailAccountEvents['on'](_0x1c060f,_0x1d7e9c);}}; \ No newline at end of file +var _0x5879=['register','mailAccount:','./mailAccount.events','save','remove','update','removeListener'];(function(_0x11222f,_0x17d22e){var _0x47b914=function(_0xed9e7e){while(--_0xed9e7e){_0x11222f['push'](_0x11222f['shift']());}};_0x47b914(++_0x17d22e);}(_0x5879,0xdb));var _0x9587=function(_0x1089b6,_0x2b212c){_0x1089b6=_0x1089b6-0x0;var _0x1b2afb=_0x5879[_0x1089b6];return _0x1b2afb;};'use strict';var MailAccountEvents=require(_0x9587('0x0'));var events=[_0x9587('0x1'),_0x9587('0x2'),_0x9587('0x3')];function createListener(_0x2bb439,_0xb3fbfe){return function(_0x463363){_0xb3fbfe['emit'](_0x2bb439,_0x463363);};}function removeListener(_0x63f5e8,_0x5b5c55){return function(){MailAccountEvents[_0x9587('0x4')](_0x63f5e8,_0x5b5c55);};}exports[_0x9587('0x5')]=function(_0x387eed){for(var _0x1f922f=0x0,_0x4430c5=events['length'];_0x1f922f<_0x4430c5;_0x1f922f++){var _0xc5892d=events[_0x1f922f];var _0xa2bcbe=createListener(_0x9587('0x6')+_0xc5892d,_0x387eed);MailAccountEvents['on'](_0xc5892d,_0xa2bcbe);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index 9fe806d..f486deb 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 _0xe8d2=['show','put','isAuthenticated','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','get','/:id'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xe8d2,0x1e6));var _0x2e8d=function(_0x2424c0,_0x514724){_0x2424c0=_0x2424c0-0x0;var _0x3c592f=_0xe8d2[_0x2424c0];return _0x3c592f;};'use strict';var multer=require(_0x2e8d('0x0'));var util=require(_0x2e8d('0x1'));var path=require(_0x2e8d('0x2'));var timeout=require(_0x2e8d('0x3'));var express=require('express');var router=express[_0x2e8d('0x4')]();var fs_extra=require(_0x2e8d('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x2e8d('0x6'));var config=require(_0x2e8d('0x7'));var controller=require('./mailApplication.controller');router[_0x2e8d('0x8')](_0x2e8d('0x9'),auth['isAuthenticated'](),controller[_0x2e8d('0xa')]);router[_0x2e8d('0xb')](_0x2e8d('0x9'),auth[_0x2e8d('0xc')](),controller['update']);router[_0x2e8d('0xd')](_0x2e8d('0x9'),auth['isAuthenticated'](),controller[_0x2e8d('0xe')]);module[_0x2e8d('0xf')]=router; \ No newline at end of file +var _0xffbe=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailApplication.controller','get','/:id','isAuthenticated','show','put','update','delete','exports','multer','util'];(function(_0x51d256,_0x5310bd){var _0x19a699=function(_0xb5f7da){while(--_0xb5f7da){_0x51d256['push'](_0x51d256['shift']());}};_0x19a699(++_0x5310bd);}(_0xffbe,0x15e));var _0xeffb=function(_0x461350,_0x141a3c){_0x461350=_0x461350-0x0;var _0x339686=_0xffbe[_0x461350];return _0x339686;};'use strict';var multer=require(_0xeffb('0x0'));var util=require(_0xeffb('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xeffb('0x2')]();var fs_extra=require(_0xeffb('0x3'));var auth=require(_0xeffb('0x4'));var interaction=require(_0xeffb('0x5'));var config=require(_0xeffb('0x6'));var controller=require(_0xeffb('0x7'));router[_0xeffb('0x8')](_0xeffb('0x9'),auth[_0xeffb('0xa')](),controller[_0xeffb('0xb')]);router[_0xeffb('0xc')](_0xeffb('0x9'),auth[_0xeffb('0xa')](),controller[_0xeffb('0xd')]);router[_0xeffb('0xe')](_0xeffb('0x9'),auth['isAuthenticated'](),controller['destroy']);module[_0xeffb('0xf')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index ac70818..d23a072 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 _0x234a=['STRING','*,*,*,*','sequelize','INTEGER','noop','TEXT'];(function(_0x5da177,_0x5b48a7){var _0x4a98b9=function(_0x497d4f){while(--_0x497d4f){_0x5da177['push'](_0x5da177['shift']());}};_0x4a98b9(++_0x5b48a7);}(_0x234a,0x1e2));var _0xa234=function(_0x2fe3b9,_0xca959f){_0x2fe3b9=_0x2fe3b9-0x0;var _0x35c846=_0x234a[_0x2fe3b9];return _0x35c846;};'use strict';var Sequelize=require(_0xa234('0x0'));module['exports']={'priority':{'type':Sequelize[_0xa234('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xa234('0x2')},'appdata':{'type':Sequelize[_0xa234('0x3')]()},'description':{'type':Sequelize[_0xa234('0x4')]},'interval':{'type':Sequelize[_0xa234('0x4')],'defaultValue':_0xa234('0x5')}}; \ No newline at end of file +var _0x7059=['*,*,*,*','sequelize','INTEGER','STRING','noop'];(function(_0x5b15ea,_0x331377){var _0x30d43e=function(_0x26dbc8){while(--_0x26dbc8){_0x5b15ea['push'](_0x5b15ea['shift']());}};_0x30d43e(++_0x331377);}(_0x7059,0x123));var _0x9705=function(_0x4ec93a,_0x15fcb5){_0x4ec93a=_0x4ec93a-0x0;var _0xffdbd2=_0x7059[_0x4ec93a];return _0xffdbd2;};'use strict';var Sequelize=require(_0x9705('0x0'));module['exports']={'priority':{'type':Sequelize[_0x9705('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x9705('0x2')],'allowNull':![],'defaultValue':_0x9705('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x9705('0x2')],'defaultValue':_0x9705('0x4')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index 8892e2b..0feda30 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 _0xf4eb=['limit','count','Content-Range','json','apply','reject','save','then','destroy','error','name','send','params','keys','MailApplication','rawAttributes','query','filters','intersection','model','fields','attributes','includeAll','include','options','find','catch','body','eml-format','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined'];(function(_0x21b12e,_0x359427){var _0x2408dc=function(_0x5f2d89){while(--_0x5f2d89){_0x21b12e['push'](_0x21b12e['shift']());}};_0x2408dc(++_0x359427);}(_0xf4eb,0xec));var _0xbf4e=function(_0x8ff429,_0x5cd3e7){_0x8ff429=_0x8ff429-0x0;var _0x4b8ef1=_0xf4eb[_0x8ff429];return _0x4b8ef1;};'use strict';var emlformat=require(_0xbf4e('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xbf4e('0x1'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xbf4e('0x2'));var path=require(_0xbf4e('0x3'));var sox=require(_0xbf4e('0x4'));var csv=require(_0xbf4e('0x5'));var ejs=require(_0xbf4e('0x6'));var fs=require('fs');var fs_extra=require(_0xbf4e('0x7'));var _=require(_0xbf4e('0x8'));var squel=require('squel');var crypto=require(_0xbf4e('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xbf4e('0x5'));var querystring=require(_0xbf4e('0xa'));var Papa=require(_0xbf4e('0xb'));var Redis=require(_0xbf4e('0xc'));var authService=require(_0xbf4e('0xd'));var qs=require(_0xbf4e('0xe'));var as=require(_0xbf4e('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xbf4e('0x10'));var utils=require('../../config/utils');var config=require(_0xbf4e('0x11'));var licenseUtil=require(_0xbf4e('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x17fd01,_0x5a3035){_0x5a3035=_0x5a3035||0xcc;return function(_0x56d185){if(_0x56d185){return _0x17fd01[_0xbf4e('0x13')](_0x5a3035);}return _0x17fd01[_0xbf4e('0x14')](_0x5a3035)[_0xbf4e('0x15')]();};}function respondWithResult(_0x302841,_0x3b74bd){_0x3b74bd=_0x3b74bd||0xc8;return function(_0x61bd54){if(_0x61bd54){return _0x302841['status'](_0x3b74bd)['json'](_0x61bd54);}};}function respondWithFilteredResult(_0x180432,_0x1735ae){return function(_0x28fc6b){if(_0x28fc6b){var _0x542909=typeof _0x1735ae[_0xbf4e('0x16')]===_0xbf4e('0x17')&&typeof _0x1735ae[_0xbf4e('0x18')]===_0xbf4e('0x17');var _0x5a631e=_0x28fc6b[_0xbf4e('0x19')];var _0x577c27=_0x542909?0x0:_0x1735ae['offset'];var _0x566ec3=_0x542909?_0x28fc6b['count']:_0x1735ae[_0xbf4e('0x16')]+_0x1735ae[_0xbf4e('0x18')];var _0x1fc800;if(_0x566ec3>=_0x5a631e){_0x566ec3=_0x5a631e;_0x1fc800=0xc8;}else{_0x1fc800=0xce;}_0x180432['status'](_0x1fc800);return _0x180432['set'](_0xbf4e('0x1a'),_0x577c27+'-'+_0x566ec3+'/'+_0x5a631e)[_0xbf4e('0x1b')](_0x28fc6b);}return null;};}function patchUpdates(_0x3be138){return function(_0x3a875b){try{jsonpatch[_0xbf4e('0x1c')](_0x3a875b,_0x3be138,!![]);}catch(_0x1e2a68){return BPromise[_0xbf4e('0x1d')](_0x1e2a68);}return _0x3a875b[_0xbf4e('0x1e')]();};}function saveUpdates(_0xd09e12,_0x376832){return function(_0x30539b){if(_0x30539b){return _0x30539b['update'](_0xd09e12)[_0xbf4e('0x1f')](function(_0x2e7673){return _0x2e7673;});}return null;};}function removeEntity(_0x51648c,_0x31e3f5){return function(_0x30994d){if(_0x30994d){return _0x30994d[_0xbf4e('0x20')]()[_0xbf4e('0x1f')](function(){_0x51648c[_0xbf4e('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x90635e,_0x36688a){return function(_0x3d6863){if(!_0x3d6863){_0x90635e['sendStatus'](0x194);}return _0x3d6863;};}function handleError(_0x2fb490,_0x5e08b1){_0x5e08b1=_0x5e08b1||0x1f4;return function(_0x5bcf71){logger[_0xbf4e('0x21')](_0x5bcf71['stack']);if(_0x5bcf71[_0xbf4e('0x22')]){delete _0x5bcf71[_0xbf4e('0x22')];}_0x2fb490[_0xbf4e('0x14')](_0x5e08b1)[_0xbf4e('0x23')](_0x5bcf71);};}exports['show']=function(_0x2d4686,_0x8e0ab5){var _0x43879d={'raw':!![],'where':{'id':_0x2d4686[_0xbf4e('0x24')]['id']}},_0x4cd4a1={};_0x4cd4a1['model']=_[_0xbf4e('0x25')](db[_0xbf4e('0x26')][_0xbf4e('0x27')]);_0x4cd4a1['query']=_[_0xbf4e('0x25')](_0x2d4686[_0xbf4e('0x28')]);_0x4cd4a1[_0xbf4e('0x29')]=_[_0xbf4e('0x2a')](_0x4cd4a1[_0xbf4e('0x2b')],_0x4cd4a1[_0xbf4e('0x28')]);_0x43879d['attributes']=_[_0xbf4e('0x2a')](_0x4cd4a1[_0xbf4e('0x2b')],qs['fields'](_0x2d4686[_0xbf4e('0x28')][_0xbf4e('0x2c')]));_0x43879d['attributes']=_0x43879d[_0xbf4e('0x2d')]['length']?_0x43879d[_0xbf4e('0x2d')]:_0x4cd4a1['model'];if(_0x2d4686[_0xbf4e('0x28')][_0xbf4e('0x2e')]){_0x43879d[_0xbf4e('0x2f')]=[{'all':!![]}];}_0x43879d=_['merge']({},_0x43879d,_0x2d4686[_0xbf4e('0x30')]);return db[_0xbf4e('0x26')][_0xbf4e('0x31')](_0x43879d)[_0xbf4e('0x1f')](handleEntityNotFound(_0x8e0ab5,null))[_0xbf4e('0x1f')](respondWithResult(_0x8e0ab5,null))[_0xbf4e('0x32')](handleError(_0x8e0ab5,null));};exports['update']=function(_0x99b320,_0x3dbb2b){if(_0x99b320[_0xbf4e('0x33')]['id']){delete _0x99b320[_0xbf4e('0x33')]['id'];}return db[_0xbf4e('0x26')]['find']({'where':{'id':_0x99b320['params']['id']}})['then'](handleEntityNotFound(_0x3dbb2b,null))['then'](saveUpdates(_0x99b320[_0xbf4e('0x33')],null))[_0xbf4e('0x1f')](respondWithResult(_0x3dbb2b,null))[_0xbf4e('0x32')](handleError(_0x3dbb2b,null));};exports[_0xbf4e('0x20')]=function(_0x22ddde,_0x257b74){return db[_0xbf4e('0x26')][_0xbf4e('0x31')]({'where':{'id':_0x22ddde[_0xbf4e('0x24')]['id']}})['then'](handleEntityNotFound(_0x257b74,null))['then'](removeEntity(_0x257b74,null))[_0xbf4e('0x32')](handleError(_0x257b74,null));}; \ No newline at end of file +var _0x9bde=['../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','save','then','destroy','error','name','send','show','model','keys','MailApplication','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','include','merge','options','find','catch','update','body','params','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment'];(function(_0x270af6,_0x87f513){var _0x55a014=function(_0x10f83b){while(--_0x10f83b){_0x270af6['push'](_0x270af6['shift']());}};_0x55a014(++_0x87f513);}(_0x9bde,0xe1));var _0xe9bd=function(_0x16d182,_0x2f3839){_0x16d182=_0x16d182-0x0;var _0x46e28f=_0x9bde[_0x16d182];return _0x46e28f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe9bd('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe9bd('0x1'));var rp=require('request-promise');var moment=require(_0xe9bd('0x2'));var BPromise=require(_0xe9bd('0x3'));var Mustache=require(_0xe9bd('0x4'));var util=require(_0xe9bd('0x5'));var path=require(_0xe9bd('0x6'));var sox=require(_0xe9bd('0x7'));var csv=require(_0xe9bd('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe9bd('0x9'));var _=require(_0xe9bd('0xa'));var squel=require(_0xe9bd('0xb'));var crypto=require(_0xe9bd('0xc'));var jsforce=require(_0xe9bd('0xd'));var deskjs=require(_0xe9bd('0xe'));var toCsv=require(_0xe9bd('0x8'));var querystring=require(_0xe9bd('0xf'));var Papa=require(_0xe9bd('0x10'));var Redis=require(_0xe9bd('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe9bd('0x12'));var hardwareService=require(_0xe9bd('0x13'));var logger=require(_0xe9bd('0x14'))('api');var utils=require(_0xe9bd('0x15'));var config=require(_0xe9bd('0x16'));var licenseUtil=require(_0xe9bd('0x17'));var db=require(_0xe9bd('0x18'))['db'];function respondWithStatusCode(_0x5e022a,_0x2c1d98){_0x2c1d98=_0x2c1d98||0xcc;return function(_0x4ac319){if(_0x4ac319){return _0x5e022a[_0xe9bd('0x19')](_0x2c1d98);}return _0x5e022a[_0xe9bd('0x1a')](_0x2c1d98)[_0xe9bd('0x1b')]();};}function respondWithResult(_0x51109f,_0x47ba5e){_0x47ba5e=_0x47ba5e||0xc8;return function(_0x46a95e){if(_0x46a95e){return _0x51109f[_0xe9bd('0x1a')](_0x47ba5e)[_0xe9bd('0x1c')](_0x46a95e);}};}function respondWithFilteredResult(_0x46a59b,_0x3360bd){return function(_0x389e7b){if(_0x389e7b){var _0x45a9f2=typeof _0x3360bd['offset']===_0xe9bd('0x1d')&&typeof _0x3360bd[_0xe9bd('0x1e')]===_0xe9bd('0x1d');var _0x494b27=_0x389e7b[_0xe9bd('0x1f')];var _0x3bae08=_0x45a9f2?0x0:_0x3360bd[_0xe9bd('0x20')];var _0x330733=_0x45a9f2?_0x389e7b['count']:_0x3360bd[_0xe9bd('0x20')]+_0x3360bd['limit'];var _0xc6b661;if(_0x330733>=_0x494b27){_0x330733=_0x494b27;_0xc6b661=0xc8;}else{_0xc6b661=0xce;}_0x46a59b['status'](_0xc6b661);return _0x46a59b[_0xe9bd('0x21')](_0xe9bd('0x22'),_0x3bae08+'-'+_0x330733+'/'+_0x494b27)[_0xe9bd('0x1c')](_0x389e7b);}return null;};}function patchUpdates(_0x3dda13){return function(_0x1acb82){try{jsonpatch[_0xe9bd('0x23')](_0x1acb82,_0x3dda13,!![]);}catch(_0x6593ce){return BPromise['reject'](_0x6593ce);}return _0x1acb82[_0xe9bd('0x24')]();};}function saveUpdates(_0x28cd17,_0x4ecaf5){return function(_0x37aec1){if(_0x37aec1){return _0x37aec1['update'](_0x28cd17)[_0xe9bd('0x25')](function(_0x1b9cc9){return _0x1b9cc9;});}return null;};}function removeEntity(_0x36f8c0,_0xf02209){return function(_0x5bc4bf){if(_0x5bc4bf){return _0x5bc4bf[_0xe9bd('0x26')]()[_0xe9bd('0x25')](function(){_0x36f8c0[_0xe9bd('0x1a')](0xcc)[_0xe9bd('0x1b')]();});}};}function handleEntityNotFound(_0x2641be,_0xb52d45){return function(_0x399f3c){if(!_0x399f3c){_0x2641be[_0xe9bd('0x19')](0x194);}return _0x399f3c;};}function handleError(_0x1ae889,_0x5987af){_0x5987af=_0x5987af||0x1f4;return function(_0x3c211a){logger[_0xe9bd('0x27')](_0x3c211a['stack']);if(_0x3c211a[_0xe9bd('0x28')]){delete _0x3c211a[_0xe9bd('0x28')];}_0x1ae889[_0xe9bd('0x1a')](_0x5987af)[_0xe9bd('0x29')](_0x3c211a);};}exports[_0xe9bd('0x2a')]=function(_0x183601,_0x519f48){var _0x5b7f1d={'raw':!![],'where':{'id':_0x183601['params']['id']}},_0x1de54c={};_0x1de54c[_0xe9bd('0x2b')]=_[_0xe9bd('0x2c')](db[_0xe9bd('0x2d')][_0xe9bd('0x2e')]);_0x1de54c[_0xe9bd('0x2f')]=_['keys'](_0x183601['query']);_0x1de54c[_0xe9bd('0x30')]=_[_0xe9bd('0x31')](_0x1de54c[_0xe9bd('0x2b')],_0x1de54c[_0xe9bd('0x2f')]);_0x5b7f1d[_0xe9bd('0x32')]=_[_0xe9bd('0x31')](_0x1de54c[_0xe9bd('0x2b')],qs[_0xe9bd('0x33')](_0x183601[_0xe9bd('0x2f')]['fields']));_0x5b7f1d[_0xe9bd('0x32')]=_0x5b7f1d[_0xe9bd('0x32')][_0xe9bd('0x34')]?_0x5b7f1d['attributes']:_0x1de54c['model'];if(_0x183601[_0xe9bd('0x2f')][_0xe9bd('0x35')]){_0x5b7f1d[_0xe9bd('0x36')]=[{'all':!![]}];}_0x5b7f1d=_[_0xe9bd('0x37')]({},_0x5b7f1d,_0x183601[_0xe9bd('0x38')]);return db[_0xe9bd('0x2d')][_0xe9bd('0x39')](_0x5b7f1d)[_0xe9bd('0x25')](handleEntityNotFound(_0x519f48,null))[_0xe9bd('0x25')](respondWithResult(_0x519f48,null))[_0xe9bd('0x3a')](handleError(_0x519f48,null));};exports[_0xe9bd('0x3b')]=function(_0x549dd1,_0x2ad46e){if(_0x549dd1[_0xe9bd('0x3c')]['id']){delete _0x549dd1[_0xe9bd('0x3c')]['id'];}return db[_0xe9bd('0x2d')][_0xe9bd('0x39')]({'where':{'id':_0x549dd1[_0xe9bd('0x3d')]['id']}})['then'](handleEntityNotFound(_0x2ad46e,null))[_0xe9bd('0x25')](saveUpdates(_0x549dd1[_0xe9bd('0x3c')],null))['then'](respondWithResult(_0x2ad46e,null))[_0xe9bd('0x3a')](handleError(_0x2ad46e,null));};exports[_0xe9bd('0x26')]=function(_0x4c7d47,_0x4b1da0){return db[_0xe9bd('0x2d')][_0xe9bd('0x39')]({'where':{'id':_0x4c7d47['params']['id']}})[_0xe9bd('0x25')](handleEntityNotFound(_0x4b1da0,null))[_0xe9bd('0x25')](removeEntity(_0x4b1da0,null))[_0xe9bd('0x3a')](handleError(_0x4b1da0,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index c568d48..8b40df5 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 _0xbe45=['utf8mb4','utf8mb4_unicode_ci','../../config/logger','bluebird','path','./mailApplication.attributes','exports','define','MailApplication','mail_applications'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbe45,0xe8));var _0x5be4=function(_0x17a2b8,_0x3b3ffb){_0x17a2b8=_0x17a2b8-0x0;var _0x118472=_0xbe45[_0x17a2b8];return _0x118472;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x5be4('0x0'))('api');var moment=require('moment');var BPromise=require(_0x5be4('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5be4('0x2'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x5be4('0x3'));module[_0x5be4('0x4')]=function(_0xd8c8e0,_0x957b37){return _0xd8c8e0[_0x5be4('0x5')](_0x5be4('0x6'),attributes,{'tableName':_0x5be4('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x5be4('0x8'),'collate':_0x5be4('0x9')});}; \ No newline at end of file +var _0xcc3f=['moment','bluebird','path','rimraf','../../config/environment','exports','define','mail_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api'];(function(_0xff26e7,_0x38ae8a){var _0x577667=function(_0x3cd8ba){while(--_0x3cd8ba){_0xff26e7['push'](_0xff26e7['shift']());}};_0x577667(++_0x38ae8a);}(_0xcc3f,0xa4));var _0xfcc3=function(_0x485e6e,_0x525c50){_0x485e6e=_0x485e6e-0x0;var _0x53be48=_0xcc3f[_0x485e6e];return _0x53be48;};'use strict';var _=require(_0xfcc3('0x0'));var util=require(_0xfcc3('0x1'));var logger=require(_0xfcc3('0x2'))(_0xfcc3('0x3'));var moment=require(_0xfcc3('0x4'));var BPromise=require(_0xfcc3('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfcc3('0x6'));var rimraf=require(_0xfcc3('0x7'));var config=require(_0xfcc3('0x8'));var attributes=require('./mailApplication.attributes');module[_0xfcc3('0x9')]=function(_0x1da2ae,_0x933768){return _0x1da2ae[_0xfcc3('0xa')]('MailApplication',attributes,{'tableName':_0xfcc3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xfcc3('0xc'),'collate':_0xfcc3('0xd')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index 3cc99fd..ae111a6 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 _0xfcfc=['request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','MailApplication','update','options','raw','where','limit','UpdateMailApplication','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','MailApplication,\x20%s,\x20%s'];(function(_0xbb2e1a,_0xbc50fe){var _0x57fddf=function(_0x5635d7){while(--_0x5635d7){_0xbb2e1a['push'](_0xbb2e1a['shift']());}};_0x57fddf(++_0xbc50fe);}(_0xfcfc,0x150));var _0xcfcf=function(_0x1137e0,_0x1cd95a){_0x1137e0=_0x1137e0-0x0;var _0x30fecc=_0xfcfc[_0x1137e0];return _0x30fecc;};'use strict';var _=require(_0xcfcf('0x0'));var util=require(_0xcfcf('0x1'));var moment=require(_0xcfcf('0x2'));var BPromise=require(_0xcfcf('0x3'));var rs=require(_0xcfcf('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcfcf('0x5'))['db'];var utils=require(_0xcfcf('0x6'));var logger=require(_0xcfcf('0x7'))(_0xcfcf('0x8'));var config=require('../../config/environment');var jayson=require(_0xcfcf('0x9'));var client=jayson[_0xcfcf('0xa')][_0xcfcf('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x396d64,_0x386dc5,_0x3b6ac0){return new BPromise(function(_0x22d1f4,_0x1c8b00){return client[_0xcfcf('0xc')](_0x396d64,_0x3b6ac0)[_0xcfcf('0xd')](function(_0x4f5a7e){logger[_0xcfcf('0xe')](_0xcfcf('0xf'),_0x386dc5,_0xcfcf('0x10'));logger[_0xcfcf('0x11')](_0xcfcf('0x12'),_0x386dc5,'request\x20sent',JSON[_0xcfcf('0x13')](_0x4f5a7e));if(_0x4f5a7e[_0xcfcf('0x14')]){if(_0x4f5a7e[_0xcfcf('0x14')][_0xcfcf('0x15')]===0x1f4){logger[_0xcfcf('0x14')]('MailApplication,\x20%s,\x20%s',_0x386dc5,_0x4f5a7e[_0xcfcf('0x14')][_0xcfcf('0x16')]);return _0x1c8b00(_0x4f5a7e['error']['message']);}logger['error'](_0xcfcf('0xf'),_0x386dc5,_0x4f5a7e['error'][_0xcfcf('0x16')]);return _0x22d1f4(_0x4f5a7e[_0xcfcf('0x14')][_0xcfcf('0x16')]);}else{logger['info'](_0xcfcf('0xf'),_0x386dc5,_0xcfcf('0x10'));_0x22d1f4(_0x4f5a7e[_0xcfcf('0x17')][_0xcfcf('0x16')]);}})[_0xcfcf('0x18')](function(_0xefa269){logger['error'](_0xcfcf('0xf'),_0x386dc5,_0xefa269);_0x1c8b00(_0xefa269);});});}exports['UpdateMailApplication']=function(_0x1db11d){var _0x163baa=this;return new Promise(function(_0x97b562,_0x4d991d){return db[_0xcfcf('0x19')][_0xcfcf('0x1a')](_0x1db11d['body'],{'raw':_0x1db11d['options']?_0x1db11d[_0xcfcf('0x1b')][_0xcfcf('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1db11d['options']?_0x1db11d['options'][_0xcfcf('0x1d')]||null:null,'attributes':_0x1db11d[_0xcfcf('0x1b')]?_0x1db11d[_0xcfcf('0x1b')]['attributes']||null:null,'limit':_0x1db11d[_0xcfcf('0x1b')]?_0x1db11d[_0xcfcf('0x1b')][_0xcfcf('0x1e')]||null:null})['then'](function(_0xc80e0f){logger['info'](_0xcfcf('0x1f'),_0x1db11d);logger[_0xcfcf('0x11')](_0xcfcf('0x1f'),_0x1db11d,JSON[_0xcfcf('0x13')](_0xc80e0f));_0x97b562(_0xc80e0f);})[_0xcfcf('0x18')](function(_0x221dfc){logger[_0xcfcf('0x14')](_0xcfcf('0x1f'),_0x221dfc['message'],_0x1db11d);_0x4d991d(_0x163baa[_0xcfcf('0x14')](0x1f4,_0x221dfc[_0xcfcf('0x16')]));});});}; \ No newline at end of file +var _0xd2b2=['../../config/logger','request','then','info','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','MailApplication,\x20%s,\x20%s','message','result','catch','UpdateMailApplication','MailApplication','update','options','where','attributes','limit','lodash','util','moment','bluebird','../../mysqldb','../../config/utils'];(function(_0x10515f,_0x4cb5ad){var _0x820a5a=function(_0x289a60){while(--_0x289a60){_0x10515f['push'](_0x10515f['shift']());}};_0x820a5a(++_0x4cb5ad);}(_0xd2b2,0x1e8));var _0x2d2b=function(_0x2a8cda,_0x1136b2){_0x2a8cda=_0x2a8cda-0x0;var _0x574c5b=_0xd2b2[_0x2a8cda];return _0x574c5b;};'use strict';var _=require(_0x2d2b('0x0'));var util=require(_0x2d2b('0x1'));var moment=require(_0x2d2b('0x2'));var BPromise=require(_0x2d2b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2d2b('0x4'))['db'];var utils=require(_0x2d2b('0x5'));var logger=require(_0x2d2b('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x263690,_0xe92dae,_0x1bc9ab){return new BPromise(function(_0x13ee61,_0x1d89c1){return client[_0x2d2b('0x7')](_0x263690,_0x1bc9ab)[_0x2d2b('0x8')](function(_0x1a8dde){logger[_0x2d2b('0x9')]('MailApplication,\x20%s,\x20%s',_0xe92dae,_0x2d2b('0xa'));logger[_0x2d2b('0xb')](_0x2d2b('0xc'),_0xe92dae,_0x2d2b('0xa'),JSON[_0x2d2b('0xd')](_0x1a8dde));if(_0x1a8dde['error']){if(_0x1a8dde[_0x2d2b('0xe')]['code']===0x1f4){logger[_0x2d2b('0xe')](_0x2d2b('0xf'),_0xe92dae,_0x1a8dde[_0x2d2b('0xe')][_0x2d2b('0x10')]);return _0x1d89c1(_0x1a8dde[_0x2d2b('0xe')][_0x2d2b('0x10')]);}logger[_0x2d2b('0xe')]('MailApplication,\x20%s,\x20%s',_0xe92dae,_0x1a8dde[_0x2d2b('0xe')][_0x2d2b('0x10')]);return _0x13ee61(_0x1a8dde[_0x2d2b('0xe')]['message']);}else{logger[_0x2d2b('0x9')]('MailApplication,\x20%s,\x20%s',_0xe92dae,_0x2d2b('0xa'));_0x13ee61(_0x1a8dde[_0x2d2b('0x11')][_0x2d2b('0x10')]);}})[_0x2d2b('0x12')](function(_0x1327b8){logger[_0x2d2b('0xe')](_0x2d2b('0xf'),_0xe92dae,_0x1327b8);_0x1d89c1(_0x1327b8);});});}exports[_0x2d2b('0x13')]=function(_0x3bfe8f){var _0xdab117=this;return new Promise(function(_0x271ec8,_0x2aff9c){return db[_0x2d2b('0x14')][_0x2d2b('0x15')](_0x3bfe8f['body'],{'raw':_0x3bfe8f['options']?_0x3bfe8f[_0x2d2b('0x16')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3bfe8f[_0x2d2b('0x16')]?_0x3bfe8f['options'][_0x2d2b('0x17')]||null:null,'attributes':_0x3bfe8f[_0x2d2b('0x16')]?_0x3bfe8f['options'][_0x2d2b('0x18')]||null:null,'limit':_0x3bfe8f['options']?_0x3bfe8f['options'][_0x2d2b('0x19')]||null:null})[_0x2d2b('0x8')](function(_0x4690ce){logger['info'](_0x2d2b('0x13'),_0x3bfe8f);logger[_0x2d2b('0xb')](_0x2d2b('0x13'),_0x3bfe8f,JSON['stringify'](_0x4690ce));_0x271ec8(_0x4690ce);})[_0x2d2b('0x12')](function(_0x2f3e3e){logger[_0x2d2b('0xe')](_0x2d2b('0x13'),_0x2f3e3e[_0x2d2b('0x10')],_0x3bfe8f);_0x2aff9c(_0xdab117[_0x2d2b('0xe')](0x1f4,_0x2f3e3e[_0x2d2b('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index 2eec5bb..5428cb0 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 _0xd87e=['download','post','create','/:id/messages','/:id/tags','mailinteraction:addtags','addTags','put','tracked','mail','mailinteraction:update','update','delete','mailinteraction:destroy','removeTags','exports','express','Router','../../components/auth/service','../../components/interaction/service','./mailInteraction.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/download'];(function(_0x49d426,_0x14423c){var _0x1e7840=function(_0xe67669){while(--_0xe67669){_0x49d426['push'](_0x49d426['shift']());}};_0x1e7840(++_0x14423c);}(_0xd87e,0x14f));var _0xed87=function(_0x4b1434,_0x1fa900){_0x4b1434=_0x4b1434-0x0;var _0x9870da=_0xd87e[_0x4b1434];return _0x9870da;};'use strict';var express=require(_0xed87('0x0'));var router=express[_0xed87('0x1')]();var auth=require(_0xed87('0x2'));var interaction=require(_0xed87('0x3'));var controller=require(_0xed87('0x4'));router['get']('/',auth[_0xed87('0x5')](),controller[_0xed87('0x6')]);router[_0xed87('0x7')](_0xed87('0x8'),auth[_0xed87('0x5')](),controller[_0xed87('0x9')]);router[_0xed87('0x7')](_0xed87('0xa'),auth[_0xed87('0x5')](),controller[_0xed87('0xb')]);router[_0xed87('0x7')]('/:id/messages',auth[_0xed87('0x5')](),controller['getMessages']);router[_0xed87('0x7')](_0xed87('0xc'),auth['isAuthenticated'](),controller[_0xed87('0xd')]);router[_0xed87('0xe')]('/',auth['isAuthenticated'](),controller[_0xed87('0xf')]);router[_0xed87('0xe')](_0xed87('0x10'),auth[_0xed87('0x5')](),controller['addMessage']);router[_0xed87('0xe')](_0xed87('0x11'),auth['isAuthenticated'](),interaction['tracked']('mail',_0xed87('0x12')),controller[_0xed87('0x13')]);router[_0xed87('0x14')](_0xed87('0xa'),auth[_0xed87('0x5')](),interaction[_0xed87('0x15')](_0xed87('0x16'),_0xed87('0x17')),controller[_0xed87('0x18')]);router[_0xed87('0x19')](_0xed87('0xa'),auth['isAuthenticated'](),interaction[_0xed87('0x15')](_0xed87('0x16'),_0xed87('0x1a')),controller['destroy']);router[_0xed87('0x19')](_0xed87('0x11'),auth[_0xed87('0x5')](),controller[_0xed87('0x1b')]);module[_0xed87('0x1c')]=router; \ No newline at end of file +var _0xf3ab=['addTags','/:id','update','mailinteraction:destroy','destroy','/:id/tags','removeTags','exports','express','Router','../../components/interaction/service','./mailInteraction.controller','get','index','/describe','isAuthenticated','describe','show','/:id/messages','getMessages','/:id/download','post','create','addMessage','tracked','mail'];(function(_0x4eefc9,_0x4656b4){var _0x2832ce=function(_0x4eecb1){while(--_0x4eecb1){_0x4eefc9['push'](_0x4eefc9['shift']());}};_0x2832ce(++_0x4656b4);}(_0xf3ab,0x140));var _0xbf3a=function(_0x55d911,_0x2b768c){_0x55d911=_0x55d911-0x0;var _0x3104c2=_0xf3ab[_0x55d911];return _0x3104c2;};'use strict';var express=require(_0xbf3a('0x0'));var router=express[_0xbf3a('0x1')]();var auth=require('../../components/auth/service');var interaction=require(_0xbf3a('0x2'));var controller=require(_0xbf3a('0x3'));router[_0xbf3a('0x4')]('/',auth['isAuthenticated'](),controller[_0xbf3a('0x5')]);router[_0xbf3a('0x4')](_0xbf3a('0x6'),auth[_0xbf3a('0x7')](),controller[_0xbf3a('0x8')]);router[_0xbf3a('0x4')]('/:id',auth[_0xbf3a('0x7')](),controller[_0xbf3a('0x9')]);router['get'](_0xbf3a('0xa'),auth[_0xbf3a('0x7')](),controller[_0xbf3a('0xb')]);router[_0xbf3a('0x4')](_0xbf3a('0xc'),auth['isAuthenticated'](),controller['download']);router[_0xbf3a('0xd')]('/',auth[_0xbf3a('0x7')](),controller[_0xbf3a('0xe')]);router[_0xbf3a('0xd')](_0xbf3a('0xa'),auth[_0xbf3a('0x7')](),controller[_0xbf3a('0xf')]);router[_0xbf3a('0xd')]('/:id/tags',auth[_0xbf3a('0x7')](),interaction[_0xbf3a('0x10')](_0xbf3a('0x11'),'mailinteraction:addtags'),controller[_0xbf3a('0x12')]);router['put'](_0xbf3a('0x13'),auth[_0xbf3a('0x7')](),interaction[_0xbf3a('0x10')](_0xbf3a('0x11'),'mailinteraction:update'),controller[_0xbf3a('0x14')]);router['delete'](_0xbf3a('0x13'),auth[_0xbf3a('0x7')](),interaction[_0xbf3a('0x10')](_0xbf3a('0x11'),_0xbf3a('0x15')),controller[_0xbf3a('0x16')]);router['delete'](_0xbf3a('0x17'),auth[_0xbf3a('0x7')](),controller[_0xbf3a('0x18')]);module[_0xbf3a('0x19')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index 7e6d4a4..b8747cb 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 _0x290a=['BOOLEAN','DATE','STRING','long','TEXT','ENUM','INTEGER','sequelize','iconv','exports'];(function(_0x5decdb,_0x5959df){var _0x144810=function(_0x3155f5){while(--_0x3155f5){_0x5decdb['push'](_0x5decdb['shift']());}};_0x144810(++_0x5959df);}(_0x290a,0xa7));var _0xa290=function(_0x3866d6,_0xaff5b){_0x3866d6=_0x3866d6-0x0;var _0x5e5d7=_0x290a[_0x3866d6];return _0x5e5d7;};'use strict';var Sequelize=require(_0xa290('0x0'));var iconv=require(_0xa290('0x1'));module[_0xa290('0x2')]={'closed':{'type':Sequelize[_0xa290('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xa290('0x4')]},'disposition':{'type':Sequelize[_0xa290('0x5')]},'secondDisposition':{'type':Sequelize[_0xa290('0x5')]},'thirdDisposition':{'type':Sequelize[_0xa290('0x5')]},'note':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0xa290('0x5')](0x1fe)},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize['TEXT'](_0xa290('0x6'))},'subject':{'type':Sequelize[_0xa290('0x7')]()},'attach':{'type':Sequelize[_0xa290('0x3')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0xa290('0x4')]},'substatus':{'type':Sequelize['STRING'](0x3c)},'substatusAt':{'type':Sequelize[_0xa290('0x4')]},'firstMsgDirection':{'type':Sequelize[_0xa290('0x8')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xa290('0x4')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueId':{'type':Sequelize[_0xa290('0x9')]}}; \ No newline at end of file +var _0xc018=['TEXT','ENUM','out','iconv','BOOLEAN','DATE','STRING','long'];(function(_0x57912c,_0x553b2b){var _0xde2f9d=function(_0x16f0a9){while(--_0x16f0a9){_0x57912c['push'](_0x57912c['shift']());}};_0xde2f9d(++_0x553b2b);}(_0xc018,0x113));var _0x8c01=function(_0xa4d4c5,_0x47f8f8){_0xa4d4c5=_0xa4d4c5-0x0;var _0x2d8d54=_0xc018[_0xa4d4c5];return _0x2d8d54;};'use strict';var Sequelize=require('sequelize');var iconv=require(_0x8c01('0x0'));module['exports']={'closed':{'type':Sequelize[_0x8c01('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x8c01('0x2')]},'disposition':{'type':Sequelize[_0x8c01('0x3')]},'secondDisposition':{'type':Sequelize[_0x8c01('0x3')]},'thirdDisposition':{'type':Sequelize[_0x8c01('0x3')]},'note':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0x8c01('0x3')](0x1fe)},'to':{'type':Sequelize[_0x8c01('0x3')]},'cc':{'type':Sequelize['TEXT'](_0x8c01('0x4'))},'subject':{'type':Sequelize[_0x8c01('0x5')]()},'attach':{'type':Sequelize[_0x8c01('0x1')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x8c01('0x2')]},'substatus':{'type':Sequelize[_0x8c01('0x3')](0x3c)},'substatusAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x8c01('0x6')]('in',_0x8c01('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x8c01('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x8c01('0x6')]('in',_0x8c01('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x8c01('0x1')],'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 721ee9a..1908172 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 _0x9d5b=['end','json','offset','undefined','limit','count','set','destroy','then','error','stack','name','send','index','map','fieldName','type','key','getOptions','findAll','mail','query','user','catch','show','params','keys','rawAttributes','intersection','attributes','model','fields','length','includeAll','include','merge','MailInteraction','find','create','update','body','describe','addMessage','MailMessage','ids','omit','getMessages','filters','hasOwnProperty','nolimit','where','pick','MailInteractionId','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','options','rows','addTags','setTags','spread','Tag','color','emit','mailInteractionTags:save','removeTags','download','unix','server','files','tmp','join','root','format','transcript-%d-%s.zip','attachments','push','Attachment','Attachments','Messages','bcc','subject','createdAt','sort','get','mkdirSync','each','from','missing.recipient@your.company.com','headers','Bcc','basename','existsSync','readFileSync','build','writeFileSync','unlinkSync','eml-format','rimraf','zip-dir','moment','bluebird','util','lodash','juice','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','socket.io-emitter','register','sendStatus','status'];(function(_0x48d255,_0x5475ce){var _0x33fd0f=function(_0x21cc11){while(--_0x21cc11){_0x48d255['push'](_0x48d255['shift']());}};_0x33fd0f(++_0x5475ce);}(_0x9d5b,0x14e));var _0xb9d5=function(_0x475f07,_0x4f2d0c){_0x475f07=_0x475f07-0x0;var _0xdf9cd7=_0x9d5b[_0x475f07];return _0xdf9cd7;};'use strict';var emlformat=require(_0xb9d5('0x0'));var rimraf=require(_0xb9d5('0x1'));var zipdir=require(_0xb9d5('0x2'));var moment=require(_0xb9d5('0x3'));var BPromise=require(_0xb9d5('0x4'));var util=require(_0xb9d5('0x5'));var path=require('path');var fs=require('fs');var _=require(_0xb9d5('0x6'));var juice=require(_0xb9d5('0x7'));var Redis=require(_0xb9d5('0x8'));var interaction=require('../../components/interaction/service');var qs=require(_0xb9d5('0x9'));var logger=require(_0xb9d5('0xa'))(_0xb9d5('0xb'));var config=require(_0xb9d5('0xc'));var db=require(_0xb9d5('0xd'))['db'];var htmlEntities=require('html-entities');config['redis']=_[_0xb9d5('0xe')](config[_0xb9d5('0xf')],{'host':'localhost','port':0x18eb});var socket=require(_0xb9d5('0x10'))(new Redis(config[_0xb9d5('0xf')]));require('./mailInteraction.socket')[_0xb9d5('0x11')](socket);function respondWithStatusCode(_0x4bcab6,_0x1a347b){_0x1a347b=_0x1a347b||0xcc;return function(_0x838102){if(_0x838102){return _0x4bcab6[_0xb9d5('0x12')](_0x1a347b);}return _0x4bcab6[_0xb9d5('0x13')](_0x1a347b)[_0xb9d5('0x14')]();};}function respondWithResult(_0x47dc4b,_0x23d332){_0x23d332=_0x23d332||0xc8;return function(_0x190efb){if(_0x190efb){return _0x47dc4b[_0xb9d5('0x13')](_0x23d332)[_0xb9d5('0x15')](_0x190efb);}};}function respondWithFilteredResult(_0x3fc8cf,_0x2ffadf){return function(_0x2627fe){if(_0x2627fe){var _0x4c2e57=typeof _0x2ffadf[_0xb9d5('0x16')]===_0xb9d5('0x17')&&typeof _0x2ffadf[_0xb9d5('0x18')]==='undefined';var _0x17eaec=_0x2627fe[_0xb9d5('0x19')];var _0x18a6f1=_0x4c2e57?0x0:_0x2ffadf[_0xb9d5('0x16')];var _0x33a4f4=_0x4c2e57?_0x2627fe['count']:_0x2ffadf[_0xb9d5('0x16')]+_0x2ffadf[_0xb9d5('0x18')];var _0x96f780;if(_0x33a4f4>=_0x17eaec){_0x33a4f4=_0x17eaec;_0x96f780=0xc8;}else{_0x96f780=0xce;}_0x3fc8cf[_0xb9d5('0x13')](_0x96f780);return _0x3fc8cf[_0xb9d5('0x1a')]('Content-Range',_0x18a6f1+'-'+_0x33a4f4+'/'+_0x17eaec)[_0xb9d5('0x15')](_0x2627fe);}return null;};}function saveUpdates(_0x37714b){return function(_0x397832){if(_0x397832){return _0x397832['update'](_0x37714b)['then'](function(_0x3d4608){return _0x3d4608;});}return null;};}function removeEntity(_0x19dabc){return function(_0x8a288c){if(_0x8a288c){return _0x8a288c[_0xb9d5('0x1b')]()[_0xb9d5('0x1c')](function(){_0x19dabc['status'](0xcc)[_0xb9d5('0x14')]();});}};}function handleEntityNotFound(_0x325587){return function(_0x3f42f2){if(!_0x3f42f2){_0x325587['sendStatus'](0x194);}return _0x3f42f2;};}function handleError(_0x56ca34,_0x4e8a2c){_0x4e8a2c=_0x4e8a2c||0x1f4;return function(_0x460aae){logger[_0xb9d5('0x1d')](_0x460aae[_0xb9d5('0x1e')]);if(_0x460aae[_0xb9d5('0x1f')]){delete _0x460aae[_0xb9d5('0x1f')];}_0x56ca34['status'](_0x4e8a2c)[_0xb9d5('0x20')](_0x460aae);};}exports[_0xb9d5('0x21')]=function(_0x4bb653,_0x518eb7){var _0x2ea1d8={};var _0x30b862=_[_0xb9d5('0x22')](db['MailInteraction']['rawAttributes'],function(_0x3cdaa3){return{'name':_0x3cdaa3[_0xb9d5('0x23')],'type':_0x3cdaa3[_0xb9d5('0x24')][_0xb9d5('0x25')]};});_0x2ea1d8=qs[_0xb9d5('0x26')](_0x30b862,_0x4bb653);return interaction[_0xb9d5('0x27')](_0xb9d5('0x28'),_0x4bb653[_0xb9d5('0x29')],_0x4bb653[_0xb9d5('0x2a')],_0x2ea1d8,_0x30b862)[_0xb9d5('0x1c')](respondWithFilteredResult(_0x518eb7,_0x2ea1d8))[_0xb9d5('0x2b')](handleError(_0x518eb7,null));};exports[_0xb9d5('0x2c')]=function(_0x23706a,_0x16e682){var _0x349f52={'raw':![],'where':{'id':_0x23706a[_0xb9d5('0x2d')]['id']}},_0x3210a3={};_0x3210a3['model']=_[_0xb9d5('0x2e')](db['MailInteraction'][_0xb9d5('0x2f')]);_0x3210a3['query']=_['keys'](_0x23706a['query']);_0x3210a3['filters']=_[_0xb9d5('0x30')](_0x3210a3['model'],_0x3210a3['query']);_0x349f52[_0xb9d5('0x31')]=_[_0xb9d5('0x30')](_0x3210a3[_0xb9d5('0x32')],qs[_0xb9d5('0x33')](_0x23706a[_0xb9d5('0x29')][_0xb9d5('0x33')]));_0x349f52['attributes']=_0x349f52['attributes'][_0xb9d5('0x34')]?_0x349f52['attributes']:_0x3210a3['model'];if(_0x23706a[_0xb9d5('0x29')][_0xb9d5('0x35')]){_0x349f52[_0xb9d5('0x36')]=[{'all':!![]}];}_0x349f52=_[_0xb9d5('0x37')]({},_0x349f52,_0x23706a['options']);return db[_0xb9d5('0x38')][_0xb9d5('0x39')](_0x349f52)[_0xb9d5('0x1c')](handleEntityNotFound(_0x16e682,null))[_0xb9d5('0x1c')](respondWithResult(_0x16e682,null))['catch'](handleError(_0x16e682,null));};exports['create']=function(_0xa07ac1,_0x21f87c){return db[_0xb9d5('0x38')][_0xb9d5('0x3a')](_0xa07ac1['body'],{})[_0xb9d5('0x1c')](respondWithResult(_0x21f87c,0xc9))[_0xb9d5('0x2b')](handleError(_0x21f87c,null));};exports[_0xb9d5('0x3b')]=function(_0x14ff75,_0x4f0f52){if(_0x14ff75['body']['id']){delete _0x14ff75[_0xb9d5('0x3c')]['id'];}return db['MailInteraction']['find']({'where':{'id':_0x14ff75[_0xb9d5('0x2d')]['id']}})[_0xb9d5('0x1c')](handleEntityNotFound(_0x4f0f52,null))[_0xb9d5('0x1c')](saveUpdates(_0x14ff75[_0xb9d5('0x3c')],null))['then'](respondWithResult(_0x4f0f52,null))['catch'](handleError(_0x4f0f52,null));};exports['destroy']=function(_0x358a84,_0xa329dc){return db[_0xb9d5('0x38')][_0xb9d5('0x39')]({'where':{'id':_0x358a84[_0xb9d5('0x2d')]['id']}})['then'](handleEntityNotFound(_0xa329dc,null))[_0xb9d5('0x1c')](removeEntity(_0xa329dc,null))[_0xb9d5('0x2b')](handleError(_0xa329dc,null));};exports[_0xb9d5('0x3d')]=function(_0x4a9986,_0x2c35bb){return db[_0xb9d5('0x38')][_0xb9d5('0x3d')]()[_0xb9d5('0x1c')](respondWithResult(_0x2c35bb,null))[_0xb9d5('0x2b')](handleError(_0x2c35bb,null));};exports[_0xb9d5('0x3e')]=function(_0x20432d,_0xf2cb18){return db[_0xb9d5('0x3f')]['find']({'where':{'id':_0x20432d[_0xb9d5('0x2d')]['id']}})[_0xb9d5('0x1c')](handleEntityNotFound(_0xf2cb18,null))[_0xb9d5('0x1c')](function(_0x142d56){if(_0x142d56){return _0x142d56[_0xb9d5('0x3e')](_0x20432d[_0xb9d5('0x3c')][_0xb9d5('0x40')],_[_0xb9d5('0x41')](_0x20432d[_0xb9d5('0x3c')],[_0xb9d5('0x40'),'id'])||{});}})[_0xb9d5('0x1c')](respondWithResult(_0xf2cb18,null))[_0xb9d5('0x2b')](handleError(_0xf2cb18,null));};exports[_0xb9d5('0x42')]=function(_0x2e3e77,_0x1a15fc){var _0x2c5f18={'raw':![],'where':{}};var _0x28cb75={};var _0x3063f3={'count':0x0,'rows':[]};return db[_0xb9d5('0x38')]['findOne']({'where':{'id':_0x2e3e77[_0xb9d5('0x2d')]['id']}})[_0xb9d5('0x1c')](handleEntityNotFound(_0x1a15fc,null))[_0xb9d5('0x1c')](function(_0x22b506){if(_0x22b506){_0x28cb75[_0xb9d5('0x32')]=_['keys'](db[_0xb9d5('0x3f')][_0xb9d5('0x2f')]);_0x28cb75[_0xb9d5('0x29')]=_[_0xb9d5('0x2e')](_0x2e3e77['query']);_0x28cb75[_0xb9d5('0x43')]=_[_0xb9d5('0x30')](_0x28cb75['model'],_0x28cb75[_0xb9d5('0x29')]);_0x2c5f18[_0xb9d5('0x31')]=_[_0xb9d5('0x30')](_0x28cb75[_0xb9d5('0x32')],qs['fields'](_0x2e3e77['query'][_0xb9d5('0x33')]));_0x2c5f18[_0xb9d5('0x31')]=_0x2c5f18[_0xb9d5('0x31')][_0xb9d5('0x34')]?_0x2c5f18[_0xb9d5('0x31')]:_0x28cb75['model'];if(!_0x2e3e77[_0xb9d5('0x29')][_0xb9d5('0x44')](_0xb9d5('0x45'))){_0x2c5f18[_0xb9d5('0x18')]=qs[_0xb9d5('0x18')](_0x2e3e77[_0xb9d5('0x29')]['limit']);_0x2c5f18[_0xb9d5('0x16')]=qs[_0xb9d5('0x16')](_0x2e3e77['query'][_0xb9d5('0x16')]);}_0x2c5f18['order']=qs['sort'](_0x2e3e77['query']['sort']);_0x2c5f18[_0xb9d5('0x46')]=qs[_0xb9d5('0x43')](_[_0xb9d5('0x47')](_0x2e3e77[_0xb9d5('0x29')],_0x28cb75[_0xb9d5('0x43')]));_0x2c5f18[_0xb9d5('0x46')][_0xb9d5('0x48')]=_0x22b506['id'];if(_0x2e3e77[_0xb9d5('0x29')][_0xb9d5('0x49')]){_0x2c5f18[_0xb9d5('0x46')]=_[_0xb9d5('0x37')](_0x2c5f18[_0xb9d5('0x46')],{'$or':_[_0xb9d5('0x22')](_0x2c5f18[_0xb9d5('0x31')],function(_0x4cfcaf){var _0x2ad2ab={};_0x2ad2ab[_0x4cfcaf]={'$like':'%'+_0x2e3e77[_0xb9d5('0x29')][_0xb9d5('0x49')]+'%'};return _0x2ad2ab;})});}if(_0x2e3e77[_0xb9d5('0x29')][_0xb9d5('0x4a')]){var _0x8bae29=_0x2e3e77['query']['$gte'][_0xb9d5('0x4b')](',');var _0x552261={};_0x552261[_0x8bae29[0x0]]={'$gte':moment(_0x8bae29[0x1])['format'](_0xb9d5('0x4c'))};_0x2c5f18[_0xb9d5('0x46')]=_[_0xb9d5('0x37')](_0x2c5f18[_0xb9d5('0x46')],_0x552261);}_0x2c5f18=_[_0xb9d5('0x37')]({},_0x2c5f18,_0x2e3e77[_0xb9d5('0x4d')]);return db[_0xb9d5('0x3f')][_0xb9d5('0x19')]({'where':_0x2c5f18[_0xb9d5('0x46')]})[_0xb9d5('0x1c')](function(_0x2e7518){_0x3063f3[_0xb9d5('0x19')]=_0x2e7518;if(_0x2e3e77[_0xb9d5('0x29')][_0xb9d5('0x35')]){_0x2c5f18['include']=[{'all':!![]}];}return db[_0xb9d5('0x3f')][_0xb9d5('0x27')](_0x2c5f18);})[_0xb9d5('0x1c')](function(_0x32b799){if(_0x2e3e77[_0xb9d5('0x29')]['inlineCss']==='true'){for(var _0x2f0222=0x0;_0x2f0222<_0x32b799[_0xb9d5('0x34')];_0x2f0222++){_0x32b799[_0x2f0222][_0xb9d5('0x3c')]=juice(_0x32b799[_0x2f0222][_0xb9d5('0x3c')]);}}_0x3063f3[_0xb9d5('0x4e')]=_0x32b799;return _0x3063f3;});}})[_0xb9d5('0x1c')](respondWithFilteredResult(_0x1a15fc,_0x2c5f18))[_0xb9d5('0x2b')](handleError(_0x1a15fc,null));};exports[_0xb9d5('0x4f')]=function(_0x2b853f,_0xfd07ff){return db['MailInteraction'][_0xb9d5('0x39')]({'where':{'id':_0x2b853f['params']['id']}})[_0xb9d5('0x1c')](handleEntityNotFound(_0xfd07ff,null))[_0xb9d5('0x1c')](function(_0x48a593){if(_0x48a593){return _0x48a593[_0xb9d5('0x50')](_0x2b853f[_0xb9d5('0x3c')]['ids'],_[_0xb9d5('0x41')](_0x2b853f[_0xb9d5('0x3c')],[_0xb9d5('0x40'),'id'])||{})[_0xb9d5('0x51')](function(){return db[_0xb9d5('0x52')]['findAll']({'attributes':['id',_0xb9d5('0x1f'),_0xb9d5('0x53')],'where':{'id':_0x2b853f['body']['ids']}});})[_0xb9d5('0x1c')](function(_0x5b30dd){socket[_0xb9d5('0x54')](_0xb9d5('0x55'),{'id':Number(_0x2b853f[_0xb9d5('0x2d')]['id']),'tags':_0x5b30dd||[]});return{'id':Number(_0x2b853f[_0xb9d5('0x2d')]['id']),'tags':_0x5b30dd||[]};});}})[_0xb9d5('0x1c')](respondWithResult(_0xfd07ff,null))['catch'](handleError(_0xfd07ff,null));};exports['removeTags']=function(_0x4cfea7,_0x779cb2){return db[_0xb9d5('0x38')][_0xb9d5('0x39')]({'where':{'id':_0x4cfea7[_0xb9d5('0x2d')]['id']}})[_0xb9d5('0x1c')](handleEntityNotFound(_0x779cb2,null))[_0xb9d5('0x1c')](function(_0x4448c0){if(_0x4448c0){return _0x4448c0[_0xb9d5('0x56')](_0x4cfea7['query'][_0xb9d5('0x40')]);}})[_0xb9d5('0x1c')](respondWithStatusCode(_0x779cb2,null))[_0xb9d5('0x2b')](handleError(_0x779cb2,null));};exports[_0xb9d5('0x57')]=function(_0x3329da,_0x13100c){var _0x548dae=moment()[_0xb9d5('0x58')]()['toString']();var _0x3f53b8=path['join'](config['root'],_0xb9d5('0x59'),_0xb9d5('0x5a'),_0xb9d5('0x5b'));var _0x56e9a2=path[_0xb9d5('0x5c')](config[_0xb9d5('0x5d')],_0xb9d5('0x59'),'files','attachments');var _0x36a8d7=path[_0xb9d5('0x5c')](_0x3f53b8,_0x548dae);var _0x1b313a=util[_0xb9d5('0x5e')](_0xb9d5('0x5f'),_0x3329da[_0xb9d5('0x2d')]['id'],_0x548dae);var _0x2dfe25=path[_0xb9d5('0x5c')](_0x3f53b8,_0x1b313a);var _0x283cd4=[];if(_0x3329da['query'][_0xb9d5('0x60')]){_0x283cd4[_0xb9d5('0x61')]({'model':db[_0xb9d5('0x62')],'as':_0xb9d5('0x63'),'raw':!![]});}var _0x44a126=[{'model':db[_0xb9d5('0x3f')],'as':_0xb9d5('0x64'),'attributes':['id',_0xb9d5('0x3c'),'from','to','cc',_0xb9d5('0x65'),_0xb9d5('0x66'),_0xb9d5('0x67')],'where':{'secret':![]},'order':qs[_0xb9d5('0x68')]('id'),'include':_0x283cd4}];return db[_0xb9d5('0x38')][_0xb9d5('0x39')]({'where':{'id':_0x3329da[_0xb9d5('0x2d')]['id']},'include':_0x44a126})[_0xb9d5('0x1c')](handleEntityNotFound(_0x13100c,null))[_0xb9d5('0x1c')](function(_0x3d474a){if(_0x3d474a&&_0x3d474a[_0xb9d5('0x64')]){var _0x1ca60a=_0x3d474a[_0xb9d5('0x69')]({'plain':!![]});fs[_0xb9d5('0x6a')](_0x36a8d7);return BPromise[_0xb9d5('0x6b')](_0x1ca60a[_0xb9d5('0x64')],function(_0x1d74d6,_0x4bf507){var _0x52da51={'from':_0x1d74d6[_0xb9d5('0x6c')],'to':_0x1d74d6['to']||_0xb9d5('0x6d'),'subject':_0x1d74d6['subject'],'html':htmlEntities['decode'](_0x1d74d6[_0xb9d5('0x3c')]),'headers':{'Date':moment(_0x1d74d6[_0xb9d5('0x67')])['format']('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x1d74d6['cc']){_0x52da51[_0xb9d5('0x6e')]['Cc']=_0x1d74d6['cc'];}if(_0x1d74d6['bcc']){_0x52da51['headers'][_0xb9d5('0x6f')]=_0x1d74d6['bcc'];}return new BPromise(function(_0x475ed2,_0x4ec341){if(_0x1d74d6[_0xb9d5('0x63')]){for(var _0x17f312=0x0;_0x17f312<_0x1d74d6[_0xb9d5('0x63')]['length'];_0x17f312++){var _0x173f16=_0x1d74d6[_0xb9d5('0x63')][_0x17f312];var _0x1bb711=path[_0xb9d5('0x5c')](_0x56e9a2,_0x173f16[_0xb9d5('0x70')]);if(fs[_0xb9d5('0x71')](_0x1bb711)){_0x52da51['attachments'][_0xb9d5('0x61')]({'name':_0x173f16[_0xb9d5('0x1f')],'contentType':_0x173f16['type'],'data':fs[_0xb9d5('0x72')](_0x1bb711)});}}}emlformat[_0xb9d5('0x73')](_0x52da51,function(_0xa0597c,_0x817542){if(_0xa0597c)return _0x4ec341(_0xa0597c);fs[_0xb9d5('0x74')](path[_0xb9d5('0x5c')](_0x36a8d7,util['format']('message%d.eml',_0x4bf507)),_0x817542);return _0x475ed2(_0x817542);});});})[_0xb9d5('0x1c')](function(){return new BPromise(function(_0x2bea83,_0x3e1a0a){zipdir(_0x36a8d7,{'saveTo':_0x2dfe25},function(_0xbb1211,_0x45865b){if(_0xbb1211)return _0x3e1a0a(_0xbb1211);return _0x2bea83(_0x45865b);});})[_0xb9d5('0x1c')](function(){return new BPromise(function(_0x548336,_0x19d705){rimraf(_0x36a8d7,function(_0x5c1f4c){if(_0x5c1f4c)_0x19d705(_0x5c1f4c);return _0x548336();});});})[_0xb9d5('0x1c')](function(){return _0x13100c[_0xb9d5('0x57')](_0x2dfe25,_0x1b313a,function(_0x2ae782){if(!_0x2ae782)fs[_0xb9d5('0x75')](_0x2dfe25);});});});}else{return _0x13100c[_0xb9d5('0x12')](0xc8);}})[_0xb9d5('0x2b')](handleError(_0x13100c,null));}; \ No newline at end of file +var _0xbcf7=['bluebird','util','path','lodash','juice','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','html-entities','redis','defaults','socket.io-emitter','./mailInteraction.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','update','then','destroy','name','send','index','MailInteraction','rawAttributes','fieldName','getOptions','findAll','mail','query','params','model','keys','filters','intersection','fields','attributes','length','include','merge','options','find','catch','create','body','describe','addMessage','ids','omit','getMessages','MailMessage','hasOwnProperty','order','sort','where','pick','MailInteractionId','filter','map','split','YYYY-MM-DD\x20HH:mm:ss','includeAll','inlineCss','true','addTags','setTags','Tag','color','emit','mailInteractionTags:save','removeTags','unix','toString','join','root','server','tmp','attachments','format','transcript-%d-%s.zip','push','Attachment','Messages','bcc','subject','createdAt','get','mkdirSync','each','from','missing.recipient@your.company.com','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','Attachments','basename','type','readFileSync','writeFileSync','message%d.eml','unlinkSync','eml-format','moment'];(function(_0x2b4ed4,_0x4e12d0){var _0x126c32=function(_0x238a43){while(--_0x238a43){_0x2b4ed4['push'](_0x2b4ed4['shift']());}};_0x126c32(++_0x4e12d0);}(_0xbcf7,0x1ba));var _0x7bcf=function(_0x205232,_0x5867db){_0x205232=_0x205232-0x0;var _0x18786d=_0xbcf7[_0x205232];return _0x18786d;};'use strict';var emlformat=require(_0x7bcf('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var moment=require(_0x7bcf('0x1'));var BPromise=require(_0x7bcf('0x2'));var util=require(_0x7bcf('0x3'));var path=require(_0x7bcf('0x4'));var fs=require('fs');var _=require(_0x7bcf('0x5'));var juice=require(_0x7bcf('0x6'));var Redis=require(_0x7bcf('0x7'));var interaction=require('../../components/interaction/service');var qs=require(_0x7bcf('0x8'));var logger=require('../../config/logger')(_0x7bcf('0x9'));var config=require(_0x7bcf('0xa'));var db=require(_0x7bcf('0xb'))['db'];var htmlEntities=require(_0x7bcf('0xc'));config[_0x7bcf('0xd')]=_[_0x7bcf('0xe')](config[_0x7bcf('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x7bcf('0xf'))(new Redis(config[_0x7bcf('0xd')]));require(_0x7bcf('0x10'))[_0x7bcf('0x11')](socket);function respondWithStatusCode(_0x552c2e,_0x50e975){_0x50e975=_0x50e975||0xcc;return function(_0x35afcf){if(_0x35afcf){return _0x552c2e[_0x7bcf('0x12')](_0x50e975);}return _0x552c2e[_0x7bcf('0x13')](_0x50e975)[_0x7bcf('0x14')]();};}function respondWithResult(_0x3d8e9b,_0x154f82){_0x154f82=_0x154f82||0xc8;return function(_0x2eef4f){if(_0x2eef4f){return _0x3d8e9b[_0x7bcf('0x13')](_0x154f82)[_0x7bcf('0x15')](_0x2eef4f);}};}function respondWithFilteredResult(_0x5e6320,_0x1d8bff){return function(_0x14b0fb){if(_0x14b0fb){var _0x35cbfe=typeof _0x1d8bff[_0x7bcf('0x16')]===_0x7bcf('0x17')&&typeof _0x1d8bff[_0x7bcf('0x18')]===_0x7bcf('0x17');var _0x2c5706=_0x14b0fb[_0x7bcf('0x19')];var _0x370dc8=_0x35cbfe?0x0:_0x1d8bff['offset'];var _0x1377b4=_0x35cbfe?_0x14b0fb['count']:_0x1d8bff[_0x7bcf('0x16')]+_0x1d8bff[_0x7bcf('0x18')];var _0x5accc4;if(_0x1377b4>=_0x2c5706){_0x1377b4=_0x2c5706;_0x5accc4=0xc8;}else{_0x5accc4=0xce;}_0x5e6320[_0x7bcf('0x13')](_0x5accc4);return _0x5e6320['set'](_0x7bcf('0x1a'),_0x370dc8+'-'+_0x1377b4+'/'+_0x2c5706)[_0x7bcf('0x15')](_0x14b0fb);}return null;};}function saveUpdates(_0x418282){return function(_0x311b26){if(_0x311b26){return _0x311b26[_0x7bcf('0x1b')](_0x418282)[_0x7bcf('0x1c')](function(_0x56cd24){return _0x56cd24;});}return null;};}function removeEntity(_0x5940d6){return function(_0x5c2f31){if(_0x5c2f31){return _0x5c2f31[_0x7bcf('0x1d')]()[_0x7bcf('0x1c')](function(){_0x5940d6[_0x7bcf('0x13')](0xcc)['end']();});}};}function handleEntityNotFound(_0x363b97){return function(_0xcfb6ed){if(!_0xcfb6ed){_0x363b97[_0x7bcf('0x12')](0x194);}return _0xcfb6ed;};}function handleError(_0x212075,_0x48b861){_0x48b861=_0x48b861||0x1f4;return function(_0x22cd7a){logger['error'](_0x22cd7a['stack']);if(_0x22cd7a[_0x7bcf('0x1e')]){delete _0x22cd7a[_0x7bcf('0x1e')];}_0x212075[_0x7bcf('0x13')](_0x48b861)[_0x7bcf('0x1f')](_0x22cd7a);};}exports[_0x7bcf('0x20')]=function(_0x4c3386,_0xe24a9a){var _0x4c41ee={};var _0x2748c8=_['map'](db[_0x7bcf('0x21')][_0x7bcf('0x22')],function(_0x291feb){return{'name':_0x291feb[_0x7bcf('0x23')],'type':_0x291feb['type']['key']};});_0x4c41ee=qs[_0x7bcf('0x24')](_0x2748c8,_0x4c3386);return interaction[_0x7bcf('0x25')](_0x7bcf('0x26'),_0x4c3386[_0x7bcf('0x27')],_0x4c3386['user'],_0x4c41ee,_0x2748c8)['then'](respondWithFilteredResult(_0xe24a9a,_0x4c41ee))['catch'](handleError(_0xe24a9a,null));};exports['show']=function(_0x150a81,_0x37518c){var _0xbdebfb={'raw':![],'where':{'id':_0x150a81[_0x7bcf('0x28')]['id']}},_0x3faf32={};_0x3faf32[_0x7bcf('0x29')]=_['keys'](db[_0x7bcf('0x21')]['rawAttributes']);_0x3faf32[_0x7bcf('0x27')]=_[_0x7bcf('0x2a')](_0x150a81[_0x7bcf('0x27')]);_0x3faf32[_0x7bcf('0x2b')]=_['intersection'](_0x3faf32[_0x7bcf('0x29')],_0x3faf32['query']);_0xbdebfb['attributes']=_[_0x7bcf('0x2c')](_0x3faf32[_0x7bcf('0x29')],qs[_0x7bcf('0x2d')](_0x150a81[_0x7bcf('0x27')][_0x7bcf('0x2d')]));_0xbdebfb[_0x7bcf('0x2e')]=_0xbdebfb[_0x7bcf('0x2e')][_0x7bcf('0x2f')]?_0xbdebfb[_0x7bcf('0x2e')]:_0x3faf32['model'];if(_0x150a81[_0x7bcf('0x27')]['includeAll']){_0xbdebfb[_0x7bcf('0x30')]=[{'all':!![]}];}_0xbdebfb=_[_0x7bcf('0x31')]({},_0xbdebfb,_0x150a81[_0x7bcf('0x32')]);return db[_0x7bcf('0x21')][_0x7bcf('0x33')](_0xbdebfb)[_0x7bcf('0x1c')](handleEntityNotFound(_0x37518c,null))['then'](respondWithResult(_0x37518c,null))[_0x7bcf('0x34')](handleError(_0x37518c,null));};exports[_0x7bcf('0x35')]=function(_0x58bca6,_0xc03591){return db[_0x7bcf('0x21')][_0x7bcf('0x35')](_0x58bca6['body'],{})['then'](respondWithResult(_0xc03591,0xc9))[_0x7bcf('0x34')](handleError(_0xc03591,null));};exports['update']=function(_0x492d1d,_0x19049a){if(_0x492d1d[_0x7bcf('0x36')]['id']){delete _0x492d1d[_0x7bcf('0x36')]['id'];}return db[_0x7bcf('0x21')][_0x7bcf('0x33')]({'where':{'id':_0x492d1d[_0x7bcf('0x28')]['id']}})[_0x7bcf('0x1c')](handleEntityNotFound(_0x19049a,null))[_0x7bcf('0x1c')](saveUpdates(_0x492d1d[_0x7bcf('0x36')],null))[_0x7bcf('0x1c')](respondWithResult(_0x19049a,null))['catch'](handleError(_0x19049a,null));};exports['destroy']=function(_0x25fadc,_0x20b83a){return db['MailInteraction'][_0x7bcf('0x33')]({'where':{'id':_0x25fadc[_0x7bcf('0x28')]['id']}})['then'](handleEntityNotFound(_0x20b83a,null))[_0x7bcf('0x1c')](removeEntity(_0x20b83a,null))[_0x7bcf('0x34')](handleError(_0x20b83a,null));};exports[_0x7bcf('0x37')]=function(_0x284a6e,_0x151239){return db['MailInteraction'][_0x7bcf('0x37')]()['then'](respondWithResult(_0x151239,null))['catch'](handleError(_0x151239,null));};exports[_0x7bcf('0x38')]=function(_0x1e77eb,_0xba4c16){return db['MailMessage']['find']({'where':{'id':_0x1e77eb['params']['id']}})[_0x7bcf('0x1c')](handleEntityNotFound(_0xba4c16,null))[_0x7bcf('0x1c')](function(_0x2bc6ca){if(_0x2bc6ca){return _0x2bc6ca[_0x7bcf('0x38')](_0x1e77eb[_0x7bcf('0x36')][_0x7bcf('0x39')],_[_0x7bcf('0x3a')](_0x1e77eb[_0x7bcf('0x36')],['ids','id'])||{});}})[_0x7bcf('0x1c')](respondWithResult(_0xba4c16,null))[_0x7bcf('0x34')](handleError(_0xba4c16,null));};exports[_0x7bcf('0x3b')]=function(_0x1d79f3,_0x104974){var _0x214973={'raw':![],'where':{}};var _0x5d5116={};var _0x154a42={'count':0x0,'rows':[]};return db[_0x7bcf('0x21')]['findOne']({'where':{'id':_0x1d79f3[_0x7bcf('0x28')]['id']}})[_0x7bcf('0x1c')](handleEntityNotFound(_0x104974,null))[_0x7bcf('0x1c')](function(_0x3c288f){if(_0x3c288f){_0x5d5116['model']=_[_0x7bcf('0x2a')](db[_0x7bcf('0x3c')]['rawAttributes']);_0x5d5116['query']=_[_0x7bcf('0x2a')](_0x1d79f3['query']);_0x5d5116[_0x7bcf('0x2b')]=_[_0x7bcf('0x2c')](_0x5d5116[_0x7bcf('0x29')],_0x5d5116['query']);_0x214973[_0x7bcf('0x2e')]=_['intersection'](_0x5d5116['model'],qs[_0x7bcf('0x2d')](_0x1d79f3['query'][_0x7bcf('0x2d')]));_0x214973[_0x7bcf('0x2e')]=_0x214973[_0x7bcf('0x2e')][_0x7bcf('0x2f')]?_0x214973['attributes']:_0x5d5116[_0x7bcf('0x29')];if(!_0x1d79f3['query'][_0x7bcf('0x3d')]('nolimit')){_0x214973[_0x7bcf('0x18')]=qs['limit'](_0x1d79f3[_0x7bcf('0x27')][_0x7bcf('0x18')]);_0x214973['offset']=qs[_0x7bcf('0x16')](_0x1d79f3['query'][_0x7bcf('0x16')]);}_0x214973[_0x7bcf('0x3e')]=qs[_0x7bcf('0x3f')](_0x1d79f3[_0x7bcf('0x27')]['sort']);_0x214973[_0x7bcf('0x40')]=qs[_0x7bcf('0x2b')](_[_0x7bcf('0x41')](_0x1d79f3[_0x7bcf('0x27')],_0x5d5116[_0x7bcf('0x2b')]));_0x214973[_0x7bcf('0x40')][_0x7bcf('0x42')]=_0x3c288f['id'];if(_0x1d79f3['query'][_0x7bcf('0x43')]){_0x214973[_0x7bcf('0x40')]=_[_0x7bcf('0x31')](_0x214973[_0x7bcf('0x40')],{'$or':_[_0x7bcf('0x44')](_0x214973[_0x7bcf('0x2e')],function(_0x256e06){var _0x2b813c={};_0x2b813c[_0x256e06]={'$like':'%'+_0x1d79f3[_0x7bcf('0x27')][_0x7bcf('0x43')]+'%'};return _0x2b813c;})});}if(_0x1d79f3[_0x7bcf('0x27')]['$gte']){var _0x4ce1a4=_0x1d79f3[_0x7bcf('0x27')]['$gte'][_0x7bcf('0x45')](',');var _0x4a5eec={};_0x4a5eec[_0x4ce1a4[0x0]]={'$gte':moment(_0x4ce1a4[0x1])['format'](_0x7bcf('0x46'))};_0x214973[_0x7bcf('0x40')]=_[_0x7bcf('0x31')](_0x214973[_0x7bcf('0x40')],_0x4a5eec);}_0x214973=_['merge']({},_0x214973,_0x1d79f3[_0x7bcf('0x32')]);return db['MailMessage'][_0x7bcf('0x19')]({'where':_0x214973['where']})[_0x7bcf('0x1c')](function(_0x452382){_0x154a42[_0x7bcf('0x19')]=_0x452382;if(_0x1d79f3[_0x7bcf('0x27')][_0x7bcf('0x47')]){_0x214973[_0x7bcf('0x30')]=[{'all':!![]}];}return db[_0x7bcf('0x3c')]['findAll'](_0x214973);})[_0x7bcf('0x1c')](function(_0xf718b5){if(_0x1d79f3['query'][_0x7bcf('0x48')]===_0x7bcf('0x49')){for(var _0x44581c=0x0;_0x44581c<_0xf718b5['length'];_0x44581c++){_0xf718b5[_0x44581c][_0x7bcf('0x36')]=juice(_0xf718b5[_0x44581c][_0x7bcf('0x36')]);}}_0x154a42['rows']=_0xf718b5;return _0x154a42;});}})['then'](respondWithFilteredResult(_0x104974,_0x214973))[_0x7bcf('0x34')](handleError(_0x104974,null));};exports[_0x7bcf('0x4a')]=function(_0x2304eb,_0x3f2a91){return db['MailInteraction'][_0x7bcf('0x33')]({'where':{'id':_0x2304eb[_0x7bcf('0x28')]['id']}})[_0x7bcf('0x1c')](handleEntityNotFound(_0x3f2a91,null))[_0x7bcf('0x1c')](function(_0x4b9691){if(_0x4b9691){return _0x4b9691[_0x7bcf('0x4b')](_0x2304eb[_0x7bcf('0x36')][_0x7bcf('0x39')],_[_0x7bcf('0x3a')](_0x2304eb[_0x7bcf('0x36')],[_0x7bcf('0x39'),'id'])||{})['spread'](function(){return db[_0x7bcf('0x4c')][_0x7bcf('0x25')]({'attributes':['id','name',_0x7bcf('0x4d')],'where':{'id':_0x2304eb[_0x7bcf('0x36')]['ids']}});})[_0x7bcf('0x1c')](function(_0x38e65c){socket[_0x7bcf('0x4e')](_0x7bcf('0x4f'),{'id':Number(_0x2304eb[_0x7bcf('0x28')]['id']),'tags':_0x38e65c||[]});return{'id':Number(_0x2304eb['params']['id']),'tags':_0x38e65c||[]};});}})[_0x7bcf('0x1c')](respondWithResult(_0x3f2a91,null))['catch'](handleError(_0x3f2a91,null));};exports[_0x7bcf('0x50')]=function(_0x1ef217,_0x4ec7d7){return db[_0x7bcf('0x21')]['find']({'where':{'id':_0x1ef217[_0x7bcf('0x28')]['id']}})[_0x7bcf('0x1c')](handleEntityNotFound(_0x4ec7d7,null))[_0x7bcf('0x1c')](function(_0xd298bc){if(_0xd298bc){return _0xd298bc['removeTags'](_0x1ef217[_0x7bcf('0x27')][_0x7bcf('0x39')]);}})[_0x7bcf('0x1c')](respondWithStatusCode(_0x4ec7d7,null))[_0x7bcf('0x34')](handleError(_0x4ec7d7,null));};exports['download']=function(_0x45467c,_0x686dd9){var _0x48c660=moment()[_0x7bcf('0x51')]()[_0x7bcf('0x52')]();var _0x2ca7b4=path[_0x7bcf('0x53')](config[_0x7bcf('0x54')],_0x7bcf('0x55'),'files',_0x7bcf('0x56'));var _0x2eae82=path['join'](config[_0x7bcf('0x54')],_0x7bcf('0x55'),'files',_0x7bcf('0x57'));var _0x3f3b2f=path['join'](_0x2ca7b4,_0x48c660);var _0x37ddfa=util[_0x7bcf('0x58')](_0x7bcf('0x59'),_0x45467c['params']['id'],_0x48c660);var _0x2e4ce4=path[_0x7bcf('0x53')](_0x2ca7b4,_0x37ddfa);var _0x2f5b2e=[];if(_0x45467c[_0x7bcf('0x27')][_0x7bcf('0x57')]){_0x2f5b2e[_0x7bcf('0x5a')]({'model':db[_0x7bcf('0x5b')],'as':'Attachments','raw':!![]});}var _0x177033=[{'model':db[_0x7bcf('0x3c')],'as':_0x7bcf('0x5c'),'attributes':['id',_0x7bcf('0x36'),'from','to','cc',_0x7bcf('0x5d'),_0x7bcf('0x5e'),_0x7bcf('0x5f')],'where':{'secret':![]},'order':qs[_0x7bcf('0x3f')]('id'),'include':_0x2f5b2e}];return db[_0x7bcf('0x21')][_0x7bcf('0x33')]({'where':{'id':_0x45467c['params']['id']},'include':_0x177033})['then'](handleEntityNotFound(_0x686dd9,null))['then'](function(_0x5b1556){if(_0x5b1556&&_0x5b1556[_0x7bcf('0x5c')]){var _0xd40b69=_0x5b1556[_0x7bcf('0x60')]({'plain':!![]});fs[_0x7bcf('0x61')](_0x3f3b2f);return BPromise[_0x7bcf('0x62')](_0xd40b69[_0x7bcf('0x5c')],function(_0x4a14d6,_0xc18b4a){var _0x39088a={'from':_0x4a14d6[_0x7bcf('0x63')],'to':_0x4a14d6['to']||_0x7bcf('0x64'),'subject':_0x4a14d6['subject'],'html':htmlEntities['decode'](_0x4a14d6[_0x7bcf('0x36')]),'headers':{'Date':moment(_0x4a14d6[_0x7bcf('0x5f')])['format'](_0x7bcf('0x65'))},'attachments':[]};if(_0x4a14d6['cc']){_0x39088a[_0x7bcf('0x66')]['Cc']=_0x4a14d6['cc'];}if(_0x4a14d6[_0x7bcf('0x5d')]){_0x39088a['headers'][_0x7bcf('0x67')]=_0x4a14d6[_0x7bcf('0x5d')];}return new BPromise(function(_0x54bb57,_0x16e531){if(_0x4a14d6[_0x7bcf('0x68')]){for(var _0x5832a7=0x0;_0x5832a7<_0x4a14d6[_0x7bcf('0x68')][_0x7bcf('0x2f')];_0x5832a7++){var _0x4fbd47=_0x4a14d6['Attachments'][_0x5832a7];var _0x69b82e=path[_0x7bcf('0x53')](_0x2eae82,_0x4fbd47[_0x7bcf('0x69')]);if(fs['existsSync'](_0x69b82e)){_0x39088a[_0x7bcf('0x57')][_0x7bcf('0x5a')]({'name':_0x4fbd47[_0x7bcf('0x1e')],'contentType':_0x4fbd47[_0x7bcf('0x6a')],'data':fs[_0x7bcf('0x6b')](_0x69b82e)});}}}emlformat['build'](_0x39088a,function(_0x2bc4cc,_0x1061d7){if(_0x2bc4cc)return _0x16e531(_0x2bc4cc);fs[_0x7bcf('0x6c')](path[_0x7bcf('0x53')](_0x3f3b2f,util[_0x7bcf('0x58')](_0x7bcf('0x6d'),_0xc18b4a)),_0x1061d7);return _0x54bb57(_0x1061d7);});});})[_0x7bcf('0x1c')](function(){return new BPromise(function(_0x3e79de,_0x3fb3af){zipdir(_0x3f3b2f,{'saveTo':_0x2e4ce4},function(_0x441172,_0x5b1bb9){if(_0x441172)return _0x3fb3af(_0x441172);return _0x3e79de(_0x5b1bb9);});})[_0x7bcf('0x1c')](function(){return new BPromise(function(_0x49ce71,_0x29a1de){rimraf(_0x3f3b2f,function(_0x499cb1){if(_0x499cb1)_0x29a1de(_0x499cb1);return _0x49ce71();});});})[_0x7bcf('0x1c')](function(){return _0x686dd9['download'](_0x2e4ce4,_0x37ddfa,function(_0x5ac00b){if(!_0x5ac00b)fs[_0x7bcf('0x6e')](_0x2e4ce4);});});});}else{return _0x686dd9[_0x7bcf('0x12')](0xc8);}})['catch'](handleError(_0x686dd9,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index 2e2be6c..d375532 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 _0x9860=['events','../../mysqldb','MailInteraction','MailMessage','setMaxListeners','remove','getUsers','then','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports'];(function(_0x592fe4,_0xa3d75d){var _0x48b30c=function(_0x4a29da){while(--_0x4a29da){_0x592fe4['push'](_0x592fe4['shift']());}};_0x48b30c(++_0xa3d75d);}(_0x9860,0x1ba));var _0x0986=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x9860[_0xa464c9];return _0x3d73c4;};'use strict';var EventEmitter=require(_0x0986('0x0'));var MailInteraction=require(_0x0986('0x1'))['db'][_0x0986('0x2')];var MailMessage=require(_0x0986('0x1'))['db'][_0x0986('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x0986('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x0986('0x5')};function emitEvent(_0x410d61){return function(_0x5be4dd,_0xbf3233,_0x25fab9){_0x5be4dd[_0x0986('0x6')]({'attributes':['id'],'raw':!![]})[_0x0986('0x7')](function(_0x252423){_0x5be4dd['setDataValue']('Users',_0x252423[_0x0986('0x8')](function(_0x3af3df){return{'id':_0x3af3df['id']};}));return MailMessage[_0x0986('0x9')]({'where':{'MailInteractionId':_0x5be4dd['id'],'direction':'in','read':![]},'raw':!![]});})[_0x0986('0x7')](function(_0x3634b4){_0x5be4dd['setDataValue'](_0x0986('0xa'),_0x3634b4[_0x0986('0xb')]);MailInteractionEvents['emit'](_0x410d61+':'+_0x5be4dd['id'],_0x5be4dd);MailInteractionEvents[_0x0986('0xc')](_0x410d61,_0x5be4dd);_0x25fab9(null);})[_0x0986('0xd')](_0x25fab9(null));};}for(var e in events){if(events[_0x0986('0xe')](e)){var event=events[e];MailInteraction[_0x0986('0xf')](e,emitEvent(event));}}module[_0x0986('0x10')]=MailInteractionEvents; \ No newline at end of file +var _0x9d61=['save','update','remove','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','catch','hook','events','../../mysqldb','MailMessage'];(function(_0x56482c,_0x16118d){var _0x5aae7a=function(_0x52512f){while(--_0x52512f){_0x56482c['push'](_0x56482c['shift']());}};_0x5aae7a(++_0x16118d);}(_0x9d61,0x1ad));var _0x19d6=function(_0x5a7d43,_0x419af2){_0x5a7d43=_0x5a7d43-0x0;var _0x246e6d=_0x9d61[_0x5a7d43];return _0x246e6d;};'use strict';var EventEmitter=require(_0x19d6('0x0'));var MailInteraction=require('../../mysqldb')['db']['MailInteraction'];var MailMessage=require(_0x19d6('0x1'))['db'][_0x19d6('0x2')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x19d6('0x3'),'afterUpdate':_0x19d6('0x4'),'afterDestroy':_0x19d6('0x5')};function emitEvent(_0x1596fa){return function(_0x1ffb62,_0x464384,_0x23314b){_0x1ffb62['getUsers']({'attributes':['id'],'raw':!![]})[_0x19d6('0x6')](function(_0x2d7bec){_0x1ffb62[_0x19d6('0x7')](_0x19d6('0x8'),_0x2d7bec[_0x19d6('0x9')](function(_0xe70015){return{'id':_0xe70015['id']};}));return MailMessage[_0x19d6('0xa')]({'where':{'MailInteractionId':_0x1ffb62['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x9ee802){_0x1ffb62[_0x19d6('0x7')](_0x19d6('0xb'),_0x9ee802[_0x19d6('0xc')]);MailInteractionEvents[_0x19d6('0xd')](_0x1596fa+':'+_0x1ffb62['id'],_0x1ffb62);MailInteractionEvents[_0x19d6('0xd')](_0x1596fa,_0x1ffb62);_0x23314b(null);})[_0x19d6('0xe')](_0x23314b(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailInteraction[_0x19d6('0xf')](e,emitEvent(event));}}module['exports']=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index d8d8880..0f53aa9 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 _0xf9af=['./mailInteraction.attributes','exports','define','MailInteraction','subject','substatus','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','changed','get','update','utf8mb4','lodash','util','../../config/logger','moment','bluebird','../../config/environment'];(function(_0x2df74c,_0x42b9cb){var _0x219cc6=function(_0x1a2d86){while(--_0x1a2d86){_0x2df74c['push'](_0x2df74c['shift']());}};_0x219cc6(++_0x42b9cb);}(_0xf9af,0x135));var _0xff9a=function(_0x54eb8b,_0x4db9d4){_0x54eb8b=_0x54eb8b-0x0;var _0x547d02=_0xf9af[_0x54eb8b];return _0x547d02;};'use strict';var _=require(_0xff9a('0x0'));var util=require(_0xff9a('0x1'));var logger=require(_0xff9a('0x2'))('api');var moment=require(_0xff9a('0x3'));var BPromise=require(_0xff9a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xff9a('0x5'));var attributes=require(_0xff9a('0x6'));module[_0xff9a('0x7')]=function(_0x5adc6d,_0xf2cfe5){return _0x5adc6d[_0xff9a('0x8')](_0xff9a('0x9'),attributes,{'tableName':'mail_interactions','paranoid':![],'indexes':[{'name':'fti_mail_interactions','fields':[_0xff9a('0xa'),'to'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x2efda6,_0x2e1d47,_0x131ac2){if(_0x2efda6[_0xff9a('0xb')]){_0x2efda6[_0xff9a('0xc')]=moment()[_0xff9a('0xd')](_0xff9a('0xe'));}if(_0x2efda6[_0xff9a('0xf')]){_0x2efda6[_0xff9a('0x10')]=moment()[_0xff9a('0xd')](_0xff9a('0xe'));}_0x131ac2(null,_0x2e1d47);},'beforeUpdate':function(_0x210a2,_0x26996c,_0x3c46fd){if(_0x210a2[_0xff9a('0x11')]('substatus')){_0x210a2[_0xff9a('0xc')]=_0x210a2[_0xff9a('0xb')]?moment()[_0xff9a('0xd')](_0xff9a('0xe')):null;}if(_0x210a2[_0xff9a('0x11')](_0xff9a('0xf'))){_0x210a2[_0xff9a('0x10')]=moment()[_0xff9a('0xd')](_0xff9a('0xe'));_0x210a2[_0xff9a('0xb')]=null;_0x210a2[_0xff9a('0xc')]=null;}_0x3c46fd(null,_0x210a2);},'afterUpdate':function(_0x1f330e,_0x51c12a,_0xc44ae9){var _0x5d6753=_0x5adc6d['models'];var _0x261e14=_0x1f330e[_0xff9a('0x12')]({'plain':!![]});if(_0x261e14[_0xff9a('0xf')]){return _0x5d6753['MailMessage'][_0xff9a('0x13')]({'read':!![]},{'where':{'MailInteractionId':_0x261e14['id']}})['then'](function(){_0xc44ae9();})['catch'](function(_0x38b7ac){_0xc44ae9(_0x38b7ac);});}else{_0xc44ae9();}}},'charset':_0xff9a('0x14'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x3e4b=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','MailInteraction','mail_interactions','subject','FULLTEXT','substatus','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','changed','models','get','MailMessage','update','then','catch','utf8mb4_unicode_ci','lodash'];(function(_0x5e3c4c,_0x570558){var _0x33064e=function(_0x2af5b6){while(--_0x2af5b6){_0x5e3c4c['push'](_0x5e3c4c['shift']());}};_0x33064e(++_0x570558);}(_0x3e4b,0x10d));var _0xb3e4=function(_0x29ec77,_0x54c61a){_0x29ec77=_0x29ec77-0x0;var _0x93243d=_0x3e4b[_0x29ec77];return _0x93243d;};'use strict';var _=require(_0xb3e4('0x0'));var util=require('util');var logger=require(_0xb3e4('0x1'))('api');var moment=require(_0xb3e4('0x2'));var BPromise=require(_0xb3e4('0x3'));var rp=require(_0xb3e4('0x4'));var fs=require('fs');var path=require(_0xb3e4('0x5'));var rimraf=require(_0xb3e4('0x6'));var config=require(_0xb3e4('0x7'));var attributes=require('./mailInteraction.attributes');module['exports']=function(_0x1078e,_0x2d3640){return _0x1078e[_0xb3e4('0x8')](_0xb3e4('0x9'),attributes,{'tableName':_0xb3e4('0xa'),'paranoid':![],'indexes':[{'name':'fti_mail_interactions','fields':[_0xb3e4('0xb'),'to'],'type':_0xb3e4('0xc')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x111949,_0x553ade,_0x1f069d){if(_0x111949[_0xb3e4('0xd')]){_0x111949[_0xb3e4('0xe')]=moment()[_0xb3e4('0xf')](_0xb3e4('0x10'));}if(_0x111949[_0xb3e4('0x11')]){_0x111949[_0xb3e4('0x12')]=moment()[_0xb3e4('0xf')](_0xb3e4('0x10'));}_0x1f069d(null,_0x553ade);},'beforeUpdate':function(_0x42bdbd,_0x506c2a,_0x337487){if(_0x42bdbd[_0xb3e4('0x13')](_0xb3e4('0xd'))){_0x42bdbd[_0xb3e4('0xe')]=_0x42bdbd['substatus']?moment()[_0xb3e4('0xf')](_0xb3e4('0x10')):null;}if(_0x42bdbd[_0xb3e4('0x13')](_0xb3e4('0x11'))){_0x42bdbd[_0xb3e4('0x12')]=moment()[_0xb3e4('0xf')]('YYYY-MM-DD\x20HH:mm:ss');_0x42bdbd[_0xb3e4('0xd')]=null;_0x42bdbd['substatusAt']=null;}_0x337487(null,_0x42bdbd);},'afterUpdate':function(_0x1717a8,_0x43f2b8,_0x48e7f8){var _0xd5ef8b=_0x1078e[_0xb3e4('0x14')];var _0x395964=_0x1717a8[_0xb3e4('0x15')]({'plain':!![]});if(_0x395964[_0xb3e4('0x11')]){return _0xd5ef8b[_0xb3e4('0x16')][_0xb3e4('0x17')]({'read':!![]},{'where':{'MailInteractionId':_0x395964['id']}})[_0xb3e4('0x18')](function(){_0x48e7f8();})[_0xb3e4('0x19')](function(_0x49f17b){_0x48e7f8(_0x49f17b);});}else{_0x48e7f8();}}},'charset':'utf8mb4','collate':_0xb3e4('0x1a')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index f9e1f11..2aef327 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 _0x292c=['localhost','socket.io-emitter','./mailInteraction.socket','then','info','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','UpdateMailInteraction','MailInteraction','update','body','options','raw','attributes','limit','AddTagsToMailInteraction','ids','omit','spread','AddTags','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','redis','defaults'];(function(_0x27cc7c,_0x219fd5){var _0x31cf83=function(_0x38d3ce){while(--_0x38d3ce){_0x27cc7c['push'](_0x27cc7c['shift']());}};_0x31cf83(++_0x219fd5);}(_0x292c,0x66));var _0xc292=function(_0x521929,_0x479be5){_0x521929=_0x521929-0x0;var _0x632436=_0x292c[_0x521929];return _0x632436;};'use strict';var _=require(_0xc292('0x0'));var util=require('util');var moment=require(_0xc292('0x1'));var BPromise=require(_0xc292('0x2'));var rs=require(_0xc292('0x3'));var fs=require('fs');var Redis=require(_0xc292('0x4'));var db=require(_0xc292('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc292('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xc292('0x7'));var client=jayson[_0xc292('0x8')][_0xc292('0x9')]({'port':0x232a});config[_0xc292('0xa')]=_[_0xc292('0xb')](config[_0xc292('0xa')],{'host':_0xc292('0xc'),'port':0x18eb});var socket=require(_0xc292('0xd'))(new Redis(config[_0xc292('0xa')]));require(_0xc292('0xe'))['register'](socket);function respondWithRpcPromise(_0x1be13f,_0x659c9a,_0x45fe79){return new BPromise(function(_0x25d1f0,_0x556537){return client['request'](_0x1be13f,_0x45fe79)[_0xc292('0xf')](function(_0x215ae7){logger[_0xc292('0x10')](_0xc292('0x11'),_0x659c9a,_0xc292('0x12'));logger[_0xc292('0x13')]('MailInteraction,\x20%s,\x20%s,\x20%s',_0x659c9a,_0xc292('0x12'),JSON[_0xc292('0x14')](_0x215ae7));if(_0x215ae7[_0xc292('0x15')]){if(_0x215ae7[_0xc292('0x15')][_0xc292('0x16')]===0x1f4){logger['error']('MailInteraction,\x20%s,\x20%s',_0x659c9a,_0x215ae7[_0xc292('0x15')][_0xc292('0x17')]);return _0x556537(_0x215ae7['error'][_0xc292('0x17')]);}logger['error']('MailInteraction,\x20%s,\x20%s',_0x659c9a,_0x215ae7[_0xc292('0x15')]['message']);return _0x25d1f0(_0x215ae7[_0xc292('0x15')][_0xc292('0x17')]);}else{logger[_0xc292('0x10')]('MailInteraction,\x20%s,\x20%s',_0x659c9a,_0xc292('0x12'));_0x25d1f0(_0x215ae7['result']['message']);}})[_0xc292('0x18')](function(_0x502f23){logger['error'](_0xc292('0x11'),_0x659c9a,_0x502f23);_0x556537(_0x502f23);});});}exports[_0xc292('0x19')]=function(_0x314f3b){var _0x5a9873=this;return new Promise(function(_0x4b7c83,_0x29b51a){return db[_0xc292('0x1a')][_0xc292('0x1b')](_0x314f3b[_0xc292('0x1c')],{'raw':_0x314f3b[_0xc292('0x1d')]?_0x314f3b[_0xc292('0x1d')][_0xc292('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x314f3b[_0xc292('0x1d')]?_0x314f3b[_0xc292('0x1d')]['where']||null:null,'attributes':_0x314f3b['options']?_0x314f3b[_0xc292('0x1d')][_0xc292('0x1f')]||null:null,'limit':_0x314f3b['options']?_0x314f3b[_0xc292('0x1d')][_0xc292('0x20')]||null:null})[_0xc292('0xf')](function(_0x595f4b){logger[_0xc292('0x10')](_0xc292('0x19'),_0x314f3b);logger['debug']('UpdateMailInteraction',_0x314f3b,JSON[_0xc292('0x14')](_0x595f4b));_0x4b7c83(_0x595f4b);})[_0xc292('0x18')](function(_0x53fcb9){logger['error']('UpdateMailInteraction',_0x53fcb9[_0xc292('0x17')],_0x314f3b);_0x29b51a(_0x5a9873[_0xc292('0x15')](0x1f4,_0x53fcb9['message']));});});};exports[_0xc292('0x21')]=function(_0x51a56e){return new Promise(function(_0x212eb7,_0x20452e){return db['MailInteraction']['find']({'where':_0x51a56e[_0xc292('0x1d')]?_0x51a56e[_0xc292('0x1d')]['where']||null:null})['then'](function(_0x939e19){if(_0x939e19){return _0x939e19['addTags'](_0x51a56e[_0xc292('0x1c')][_0xc292('0x22')],_[_0xc292('0x23')](_0x51a56e['body'],[_0xc292('0x22'),'id'])||{});}})[_0xc292('0x24')](function(_0x1ffd9f){logger[_0xc292('0x10')](_0xc292('0x25'),_0x51a56e);logger['debug'](_0xc292('0x25'),_0x51a56e,JSON[_0xc292('0x14')](_0x1ffd9f));_0x212eb7(_0x1ffd9f);})[_0xc292('0x18')](function(_0x253f7c){logger['error']('AddTags',_0x253f7c[_0xc292('0x17')],_0x51a56e);_0x20452e(_this[_0xc292('0x15')](0x1f4,_0x253f7c[_0xc292('0x17')]));});});}; \ No newline at end of file +var _0xba29=['rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','register','request','info','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','code','message','error','MailInteraction,\x20%s,\x20%s','catch','UpdateMailInteraction','MailInteraction','body','options','raw','where','attributes','limit','then','stringify','AddTagsToMailInteraction','addTags','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0xb9f05f,_0x12edc3){var _0x4a1d34=function(_0x525f75){while(--_0x525f75){_0xb9f05f['push'](_0xb9f05f['shift']());}};_0x4a1d34(++_0x12edc3);}(_0xba29,0x9e));var _0x9ba2=function(_0x5d4421,_0x4ad62a){_0x5d4421=_0x5d4421-0x0;var _0x385c9b=_0xba29[_0x5d4421];return _0x385c9b;};'use strict';var _=require(_0x9ba2('0x0'));var util=require(_0x9ba2('0x1'));var moment=require(_0x9ba2('0x2'));var BPromise=require(_0x9ba2('0x3'));var rs=require(_0x9ba2('0x4'));var fs=require('fs');var Redis=require(_0x9ba2('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x9ba2('0x6'));var config=require(_0x9ba2('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x9ba2('0x8')][_0x9ba2('0x9')]({'port':0x232a});config[_0x9ba2('0xa')]=_[_0x9ba2('0xb')](config[_0x9ba2('0xa')],{'host':_0x9ba2('0xc'),'port':0x18eb});var socket=require(_0x9ba2('0xd'))(new Redis(config[_0x9ba2('0xa')]));require('./mailInteraction.socket')[_0x9ba2('0xe')](socket);function respondWithRpcPromise(_0x392c59,_0x156d4a,_0xe29ef3){return new BPromise(function(_0x110a1d,_0x4ca6a3){return client[_0x9ba2('0xf')](_0x392c59,_0xe29ef3)['then'](function(_0x5d284f){logger[_0x9ba2('0x10')]('MailInteraction,\x20%s,\x20%s',_0x156d4a,_0x9ba2('0x11'));logger[_0x9ba2('0x12')](_0x9ba2('0x13'),_0x156d4a,_0x9ba2('0x11'),JSON['stringify'](_0x5d284f));if(_0x5d284f['error']){if(_0x5d284f['error'][_0x9ba2('0x14')]===0x1f4){logger['error']('MailInteraction,\x20%s,\x20%s',_0x156d4a,_0x5d284f['error']['message']);return _0x4ca6a3(_0x5d284f['error'][_0x9ba2('0x15')]);}logger[_0x9ba2('0x16')](_0x9ba2('0x17'),_0x156d4a,_0x5d284f[_0x9ba2('0x16')][_0x9ba2('0x15')]);return _0x110a1d(_0x5d284f[_0x9ba2('0x16')][_0x9ba2('0x15')]);}else{logger[_0x9ba2('0x10')]('MailInteraction,\x20%s,\x20%s',_0x156d4a,'request\x20sent');_0x110a1d(_0x5d284f['result'][_0x9ba2('0x15')]);}})[_0x9ba2('0x18')](function(_0x23c092){logger[_0x9ba2('0x16')](_0x9ba2('0x17'),_0x156d4a,_0x23c092);_0x4ca6a3(_0x23c092);});});}exports[_0x9ba2('0x19')]=function(_0x213a3a){var _0x3f7000=this;return new Promise(function(_0x5550f9,_0x59adea){return db[_0x9ba2('0x1a')]['update'](_0x213a3a[_0x9ba2('0x1b')],{'raw':_0x213a3a['options']?_0x213a3a[_0x9ba2('0x1c')][_0x9ba2('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x213a3a[_0x9ba2('0x1c')]?_0x213a3a[_0x9ba2('0x1c')][_0x9ba2('0x1e')]||null:null,'attributes':_0x213a3a[_0x9ba2('0x1c')]?_0x213a3a[_0x9ba2('0x1c')][_0x9ba2('0x1f')]||null:null,'limit':_0x213a3a['options']?_0x213a3a['options'][_0x9ba2('0x20')]||null:null})[_0x9ba2('0x21')](function(_0x3eed04){logger[_0x9ba2('0x10')](_0x9ba2('0x19'),_0x213a3a);logger[_0x9ba2('0x12')](_0x9ba2('0x19'),_0x213a3a,JSON[_0x9ba2('0x22')](_0x3eed04));_0x5550f9(_0x3eed04);})['catch'](function(_0x4fecfa){logger[_0x9ba2('0x16')](_0x9ba2('0x19'),_0x4fecfa[_0x9ba2('0x15')],_0x213a3a);_0x59adea(_0x3f7000['error'](0x1f4,_0x4fecfa['message']));});});};exports[_0x9ba2('0x23')]=function(_0x13e3df){return new Promise(function(_0x41fd4a,_0x1a3c8b){return db[_0x9ba2('0x1a')]['find']({'where':_0x13e3df[_0x9ba2('0x1c')]?_0x13e3df[_0x9ba2('0x1c')][_0x9ba2('0x1e')]||null:null})['then'](function(_0x4c1acb){if(_0x4c1acb){return _0x4c1acb[_0x9ba2('0x24')](_0x13e3df[_0x9ba2('0x1b')][_0x9ba2('0x25')],_[_0x9ba2('0x26')](_0x13e3df[_0x9ba2('0x1b')],[_0x9ba2('0x25'),'id'])||{});}})[_0x9ba2('0x27')](function(_0x20a7fc){logger[_0x9ba2('0x10')](_0x9ba2('0x28'),_0x13e3df);logger[_0x9ba2('0x12')](_0x9ba2('0x28'),_0x13e3df,JSON[_0x9ba2('0x22')](_0x20a7fc));_0x41fd4a(_0x20a7fc);})['catch'](function(_0x2d6dd){logger['error'](_0x9ba2('0x28'),_0x2d6dd['message'],_0x13e3df);_0x1a3c8b(_this[_0x9ba2('0x16')](0x1f4,_0x2d6dd[_0x9ba2('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index 70819bc..130d9b0 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 _0x2b45=['update','removeListener','register','length','mailInteraction:','./mailInteraction.events','save','remove'];(function(_0x49c67c,_0x48ca72){var _0x24eaf7=function(_0x51a2e0){while(--_0x51a2e0){_0x49c67c['push'](_0x49c67c['shift']());}};_0x24eaf7(++_0x48ca72);}(_0x2b45,0x19d));var _0x52b4=function(_0x135286,_0x40ff03){_0x135286=_0x135286-0x0;var _0x498f8a=_0x2b45[_0x135286];return _0x498f8a;};'use strict';var MailInteractionEvents=require(_0x52b4('0x0'));var events=[_0x52b4('0x1'),_0x52b4('0x2'),_0x52b4('0x3')];function createListener(_0x2847f7,_0x3876c3){return function(_0x820345){_0x3876c3['emit'](_0x2847f7,_0x820345);};}function removeListener(_0x5d7b32,_0x2320da){return function(){MailInteractionEvents[_0x52b4('0x4')](_0x5d7b32,_0x2320da);};}exports[_0x52b4('0x5')]=function(_0x340afb){for(var _0x534a30=0x0,_0x42cf57=events[_0x52b4('0x6')];_0x534a30<_0x42cf57;_0x534a30++){var _0x3ebb85=events[_0x534a30];var _0x527625=createListener(_0x52b4('0x7')+_0x3ebb85,_0x340afb);MailInteractionEvents['on'](_0x3ebb85,_0x527625);}}; \ No newline at end of file +var _0x4238=['./mailInteraction.events','save','remove','update','emit','register','length','mailInteraction:'];(function(_0x4c8f46,_0x1013c5){var _0x1be068=function(_0x538592){while(--_0x538592){_0x4c8f46['push'](_0x4c8f46['shift']());}};_0x1be068(++_0x1013c5);}(_0x4238,0xf8));var _0x8423=function(_0x4c3070,_0xc2fb4c){_0x4c3070=_0x4c3070-0x0;var _0x536a44=_0x4238[_0x4c3070];return _0x536a44;};'use strict';var MailInteractionEvents=require(_0x8423('0x0'));var events=[_0x8423('0x1'),_0x8423('0x2'),_0x8423('0x3')];function createListener(_0x5344f2,_0x530309){return function(_0x5afe4f){_0x530309[_0x8423('0x4')](_0x5344f2,_0x5afe4f);};}function removeListener(_0x4a2976,_0x6c617f){return function(){MailInteractionEvents['removeListener'](_0x4a2976,_0x6c617f);};}exports[_0x8423('0x5')]=function(_0x5b0315){for(var _0x1c8bab=0x0,_0x2e0b5a=events[_0x8423('0x6')];_0x1c8bab<_0x2e0b5a;_0x1c8bab++){var _0xcbab06=events[_0x1c8bab];var _0xf3b162=createListener(_0x8423('0x7')+_0xcbab06,_0x5b0315);MailInteractionEvents['on'](_0xcbab06,_0xf3b162);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index 5733eba..8bdd4e6 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 _0x7a2b=['put','reject','destroy','exports','multer','util','fs-extra','../../components/interaction/service','../../config/environment','./mailMessage.controller','get','isAuthenticated','index','/describe','/:id','show','download','post','mail','create'];(function(_0x409251,_0x40f525){var _0x216f47=function(_0x517895){while(--_0x517895){_0x409251['push'](_0x409251['shift']());}};_0x216f47(++_0x40f525);}(_0x7a2b,0x7c));var _0xb7a2=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0x7a2b[_0x46aff0];return _0x9d78cf;};'use strict';var multer=require(_0xb7a2('0x0'));var util=require(_0xb7a2('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xb7a2('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0xb7a2('0x3'));var config=require(_0xb7a2('0x4'));var controller=require(_0xb7a2('0x5'));router[_0xb7a2('0x6')]('/',auth[_0xb7a2('0x7')](),controller[_0xb7a2('0x8')]);router[_0xb7a2('0x6')](_0xb7a2('0x9'),auth[_0xb7a2('0x7')](),controller['describe']);router['get'](_0xb7a2('0xa'),auth[_0xb7a2('0x7')](),controller[_0xb7a2('0xb')]);router[_0xb7a2('0x6')]('/:id/download',auth[_0xb7a2('0x7')](),controller[_0xb7a2('0xc')]);router[_0xb7a2('0xd')]('/',auth[_0xb7a2('0x7')](),interaction['tracked'](_0xb7a2('0xe'),'mailmessage:create'),controller[_0xb7a2('0xf')]);router[_0xb7a2('0x10')](_0xb7a2('0xa'),auth[_0xb7a2('0x7')](),controller['update']);router[_0xb7a2('0x10')]('/:id/accept',auth[_0xb7a2('0x7')](),controller['accept']);router[_0xb7a2('0x10')]('/:id/reject',auth['isAuthenticated'](),controller[_0xb7a2('0x11')]);router['delete']('/:id',auth[_0xb7a2('0x7')](),controller[_0xb7a2('0x12')]);module[_0xb7a2('0x13')]=router; \ No newline at end of file +var _0x9d1f=['mailmessage:create','create','update','put','accept','/:id/reject','reject','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./mailMessage.controller','isAuthenticated','index','/describe','describe','/:id','show','download','tracked','mail'];(function(_0x2ebcc4,_0xceed01){var _0x15c04a=function(_0x4ce326){while(--_0x4ce326){_0x2ebcc4['push'](_0x2ebcc4['shift']());}};_0x15c04a(++_0xceed01);}(_0x9d1f,0x1a9));var _0xf9d1=function(_0x26efac,_0x21ab8a){_0x26efac=_0x26efac-0x0;var _0x8482e4=_0x9d1f[_0x26efac];return _0x8482e4;};'use strict';var multer=require(_0xf9d1('0x0'));var util=require('util');var path=require(_0xf9d1('0x1'));var timeout=require(_0xf9d1('0x2'));var express=require(_0xf9d1('0x3'));var router=express['Router']();var fs_extra=require(_0xf9d1('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xf9d1('0x5'));var config=require(_0xf9d1('0x6'));var controller=require(_0xf9d1('0x7'));router['get']('/',auth[_0xf9d1('0x8')](),controller[_0xf9d1('0x9')]);router['get'](_0xf9d1('0xa'),auth[_0xf9d1('0x8')](),controller[_0xf9d1('0xb')]);router['get'](_0xf9d1('0xc'),auth[_0xf9d1('0x8')](),controller[_0xf9d1('0xd')]);router['get']('/:id/download',auth[_0xf9d1('0x8')](),controller[_0xf9d1('0xe')]);router['post']('/',auth['isAuthenticated'](),interaction[_0xf9d1('0xf')](_0xf9d1('0x10'),_0xf9d1('0x11')),controller[_0xf9d1('0x12')]);router['put'](_0xf9d1('0xc'),auth['isAuthenticated'](),controller[_0xf9d1('0x13')]);router[_0xf9d1('0x14')]('/:id/accept',auth[_0xf9d1('0x8')](),controller[_0xf9d1('0x15')]);router[_0xf9d1('0x14')](_0xf9d1('0x16'),auth[_0xf9d1('0x8')](),controller[_0xf9d1('0x17')]);router['delete'](_0xf9d1('0xc'),auth[_0xf9d1('0x8')](),controller[_0xf9d1('0x18')]);module[_0xf9d1('0x19')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index 319cca5..5fb30f4 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 _0x48f6=['ENUM','out','STRING','DATE','INTEGER','Email','Chat','sequelize','lodash','exports','TEXT','long','medium','BOOLEAN'];(function(_0x5b59ff,_0x56a08c){var _0x52c7a4=function(_0x5eba3e){while(--_0x5eba3e){_0x5b59ff['push'](_0x5b59ff['shift']());}};_0x52c7a4(++_0x56a08c);}(_0x48f6,0x1ab));var _0x648f=function(_0x3357ea,_0x1bac0d){_0x3357ea=_0x3357ea-0x0;var _0x594b3d=_0x48f6[_0x3357ea];return _0x594b3d;};'use strict';var Sequelize=require(_0x648f('0x0'));var _=require(_0x648f('0x1'));module[_0x648f('0x2')]={'body':{'type':Sequelize[_0x648f('0x3')](_0x648f('0x4')),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT'](_0x648f('0x5'))},'read':{'type':Sequelize[_0x648f('0x6')],'defaultValue':![]},'direction':{'type':Sequelize[_0x648f('0x7')]('in','out'),'defaultValue':_0x648f('0x8'),'allowNull':![]},'messageId':{'type':Sequelize[_0x648f('0x9')](0x1fe)},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize['TEXT'](_0x648f('0x4'))},'cc':{'type':Sequelize['TEXT']('long')},'bcc':{'type':Sequelize[_0x648f('0x3')]('long')},'subject':{'type':Sequelize[_0x648f('0x3')]},'sentAt':{'type':Sequelize[_0x648f('0xa')]},'attach':{'type':Sequelize[_0x648f('0xb')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x648f('0x6')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x648f('0xa')]},'originTo':{'type':Sequelize[_0x648f('0x3')](_0x648f('0x4'))},'originCc':{'type':Sequelize[_0x648f('0x3')]('long')},'originChannel':{'type':Sequelize['ENUM'](_0x648f('0xc'),_0x648f('0xd')),'defaultValue':'Email','allowNull':![]}}; \ No newline at end of file +var _0x6959=['Chat','Email','sequelize','exports','TEXT','long','BOOLEAN','ENUM','DATE'];(function(_0x34843e,_0x4c4224){var _0x598f7f=function(_0x12a44c){while(--_0x12a44c){_0x34843e['push'](_0x34843e['shift']());}};_0x598f7f(++_0x4c4224);}(_0x6959,0x119));var _0x9695=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x6959[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0x9695('0x0'));var _=require('lodash');module[_0x9695('0x1')]={'body':{'type':Sequelize[_0x9695('0x2')](_0x9695('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x9695('0x2')]('medium')},'read':{'type':Sequelize[_0x9695('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x9695('0x5')]('in','out'),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize['STRING'](0x1fe)},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize['TEXT']('long')},'cc':{'type':Sequelize['TEXT']('long')},'bcc':{'type':Sequelize[_0x9695('0x2')]('long')},'subject':{'type':Sequelize[_0x9695('0x2')]},'sentAt':{'type':Sequelize[_0x9695('0x6')]},'attach':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'secret':{'type':Sequelize[_0x9695('0x4')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x9695('0x6')]},'originTo':{'type':Sequelize[_0x9695('0x2')]('long')},'originCc':{'type':Sequelize[_0x9695('0x2')]('long')},'originChannel':{'type':Sequelize[_0x9695('0x5')]('Email',_0x9695('0x7')),'defaultValue':_0x9695('0x8'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index 1f7d32d..55d3863 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 _0xe4b0=['find','body','describe','create','out','split','MailAccount','MailAccountId','List','CmContact','Contacts','updatedAt','DESC','MailServerOut','Smtp','getSmtpOptions','attachments','join','server/files/attachments','basename','ListId','List\x20not\x20found','SendMail','sendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','accept','mail','readAt','UserId','user','agent','get','MailInteraction','isNil','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','interaction','AcceptMessage','QueryTypes','contact','User','fullname','internal','manual','interface','SIP/%s','channel','event','fromString','EventManager','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','rejectMessage','ContactId','sequelize','Sequelize','email','reject','rejectmessage','download','toString','root','server','files','tmp','message-%s.eml','from','bcc','subject','createdAt','Attachments','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','push','readFileSync','unlinkSync','moment','path','lodash','html-to-text','../../components/parsers/qs','api','mail-interactions','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','html-entities','register','jayson/promise','client','http','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','json','offset','limit','count','set','Content-Range','update','destroy','end','sendStatus','name','send','index','map','MailMessage','rawAttributes','fieldName','type','key','model','keys','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','rows','params','options'];(function(_0x26986a,_0x168f62){var _0x361f12=function(_0x1df5dc){while(--_0x1df5dc){_0x26986a['push'](_0x26986a['shift']());}};_0x361f12(++_0x168f62);}(_0xe4b0,0xe7));var _0x0e4b=function(_0x25efc1,_0x562953){_0x25efc1=_0x25efc1-0x0;var _0x2b55f1=_0xe4b0[_0x25efc1];return _0x2b55f1;};'use strict';var emlformat=require('eml-format');var moment=require(_0x0e4b('0x0'));var BPromise=require('bluebird');var util=require('util');var path=require(_0x0e4b('0x1'));var fs=require('fs');var _=require(_0x0e4b('0x2'));var Redis=require('ioredis');var htmlToText=require(_0x0e4b('0x3'));var qs=require(_0x0e4b('0x4'));var logger=require('../../config/logger')(_0x0e4b('0x5'));var interaction_log=require('../../config/logger')(_0x0e4b('0x6'));var config=require(_0x0e4b('0x7'));var db=require(_0x0e4b('0x8'))['db'];config[_0x0e4b('0x9')]=_[_0x0e4b('0xa')](config[_0x0e4b('0x9')],{'host':_0x0e4b('0xb'),'port':0x18eb});var socket=require(_0x0e4b('0xc'))(new Redis(config[_0x0e4b('0x9')]));var htmlEntities=require(_0x0e4b('0xd'));require('./mailMessage.socket')[_0x0e4b('0xe')](socket);var jayson=require(_0x0e4b('0xf'));var client=jayson[_0x0e4b('0x10')][_0x0e4b('0x11')]({'port':0x232c});var client9003=jayson[_0x0e4b('0x10')][_0x0e4b('0x11')]({'port':0x232b});var client9002=jayson[_0x0e4b('0x10')][_0x0e4b('0x11')]({'port':0x232a});function respondWithRpcPromise(_0xb63c1b,_0xf2bbdc,_0x44e17f,_0x3b33fa){return new BPromise(function(_0x54ddb9,_0xbde01f){var _0x4b8ac3=_0x3b33fa||client;return _0x4b8ac3['request'](_0xb63c1b,_0x44e17f)[_0x0e4b('0x12')](function(_0x12cb2f){logger[_0x0e4b('0x13')](_0x0e4b('0x14'),_0xf2bbdc,_0x0e4b('0x15'));logger[_0x0e4b('0x16')](_0x0e4b('0x17'),_0xf2bbdc,_0x0e4b('0x15'),JSON[_0x0e4b('0x18')](_0x12cb2f));if(_0x12cb2f[_0x0e4b('0x19')]){if(_0x12cb2f[_0x0e4b('0x19')][_0x0e4b('0x1a')]===0x1f4){logger[_0x0e4b('0x19')]('MailMessage,\x20%s,\x20%s',_0xf2bbdc,_0x12cb2f[_0x0e4b('0x19')][_0x0e4b('0x1b')]);return _0xbde01f(_0x12cb2f[_0x0e4b('0x19')]['message']);}logger[_0x0e4b('0x19')](_0x0e4b('0x14'),_0xf2bbdc,_0x12cb2f[_0x0e4b('0x19')][_0x0e4b('0x1b')]);return _0x54ddb9(_0x12cb2f['error'][_0x0e4b('0x1b')]);}else{logger[_0x0e4b('0x13')](_0x0e4b('0x14'),_0xf2bbdc,'request\x20sent');_0x54ddb9(_0x12cb2f[_0x0e4b('0x1c')]['message']);}})[_0x0e4b('0x1d')](function(_0x107cac){logger[_0x0e4b('0x19')]('MailMessage,\x20%s,\x20%s',_0xf2bbdc,_0x107cac);_0xbde01f(_0x107cac);});});}function respondWithResult(_0x48df20,_0x28051e){_0x28051e=_0x28051e||0xc8;return function(_0x250114){if(_0x250114){return _0x48df20[_0x0e4b('0x1e')](_0x28051e)[_0x0e4b('0x1f')](_0x250114);}};}function respondWithFilteredResult(_0x38b72d,_0x5507ca){return function(_0x420d28){if(_0x420d28){var _0xeb0b4d=typeof _0x5507ca[_0x0e4b('0x20')]==='undefined'&&typeof _0x5507ca[_0x0e4b('0x21')]==='undefined';var _0x46e1ab=_0x420d28['count'];var _0x4f092e=_0xeb0b4d?0x0:_0x5507ca['offset'];var _0x4665ee=_0xeb0b4d?_0x420d28[_0x0e4b('0x22')]:_0x5507ca[_0x0e4b('0x20')]+_0x5507ca[_0x0e4b('0x21')];var _0x507cf7;if(_0x4665ee>=_0x46e1ab){_0x4665ee=_0x46e1ab;_0x507cf7=0xc8;}else{_0x507cf7=0xce;}_0x38b72d[_0x0e4b('0x1e')](_0x507cf7);return _0x38b72d[_0x0e4b('0x23')](_0x0e4b('0x24'),_0x4f092e+'-'+_0x4665ee+'/'+_0x46e1ab)[_0x0e4b('0x1f')](_0x420d28);}return null;};}function saveUpdates(_0x396575){return function(_0x3457e6){if(_0x3457e6){return _0x3457e6[_0x0e4b('0x25')](_0x396575)['then'](function(_0x445ea9){return _0x445ea9;});}return null;};}function removeEntity(_0x3a1e30){return function(_0x545d6a){if(_0x545d6a){return _0x545d6a[_0x0e4b('0x26')]()[_0x0e4b('0x12')](function(){_0x3a1e30[_0x0e4b('0x1e')](0xcc)[_0x0e4b('0x27')]();});}};}function handleEntityNotFound(_0x55f828){return function(_0x3e82f2){if(!_0x3e82f2){_0x55f828[_0x0e4b('0x28')](0x194);}return _0x3e82f2;};}function handleError(_0x5246f2,_0x35a55d){_0x35a55d=_0x35a55d||0x1f4;return function(_0x332a6d){logger['error'](_0x332a6d['stack']);if(_0x332a6d[_0x0e4b('0x29')]){delete _0x332a6d['name'];}_0x5246f2[_0x0e4b('0x1e')](_0x35a55d)[_0x0e4b('0x2a')](_0x332a6d);};}exports[_0x0e4b('0x2b')]=function(_0xe926b2,_0x3d8b92){var _0x25d7d3={},_0x41f767={},_0x5d5cb5={'count':0x0,'rows':[]};var _0x44f93d=_[_0x0e4b('0x2c')](db[_0x0e4b('0x2d')][_0x0e4b('0x2e')],function(_0x3caafb){return{'name':_0x3caafb[_0x0e4b('0x2f')],'type':_0x3caafb[_0x0e4b('0x30')][_0x0e4b('0x31')]};});_0x41f767[_0x0e4b('0x32')]=_[_0x0e4b('0x2c')](_0x44f93d,'name');_0x41f767['query']=_[_0x0e4b('0x33')](_0xe926b2[_0x0e4b('0x34')]);_0x41f767['filters']=_[_0x0e4b('0x35')](_0x41f767[_0x0e4b('0x32')],_0x41f767[_0x0e4b('0x34')]);_0x25d7d3['attributes']=_[_0x0e4b('0x35')](_0x41f767[_0x0e4b('0x32')],qs['fields'](_0xe926b2[_0x0e4b('0x34')][_0x0e4b('0x36')]));_0x25d7d3[_0x0e4b('0x37')]=_0x25d7d3[_0x0e4b('0x37')][_0x0e4b('0x38')]?_0x25d7d3[_0x0e4b('0x37')]:_0x41f767['model'];if(!_0xe926b2['query'][_0x0e4b('0x39')](_0x0e4b('0x3a'))){_0x25d7d3['limit']=qs['limit'](_0xe926b2[_0x0e4b('0x34')][_0x0e4b('0x21')]);_0x25d7d3[_0x0e4b('0x20')]=qs[_0x0e4b('0x20')](_0xe926b2[_0x0e4b('0x34')]['offset']);}_0x25d7d3['order']=qs[_0x0e4b('0x3b')](_0xe926b2['query']['sort']);_0x25d7d3[_0x0e4b('0x3c')]=qs[_0x0e4b('0x3d')](_[_0x0e4b('0x3e')](_0xe926b2['query'],_0x41f767[_0x0e4b('0x3d')]),_0x44f93d);if(_0xe926b2[_0x0e4b('0x34')][_0x0e4b('0x3f')]){_0x25d7d3[_0x0e4b('0x3c')]=_[_0x0e4b('0x40')](_0x25d7d3[_0x0e4b('0x3c')],{'$or':_['map'](_0x44f93d,function(_0xc6ac3){if(_0xc6ac3[_0x0e4b('0x30')]!==_0x0e4b('0x41')){var _0x212716={};_0x212716[_0xc6ac3[_0x0e4b('0x29')]]={'$like':'%'+_0xe926b2[_0x0e4b('0x34')][_0x0e4b('0x3f')]+'%'};return _0x212716;}})});}_0x25d7d3=_['merge']({},_0x25d7d3,_0xe926b2['options']);var _0x5fbd6a={'where':_0x25d7d3['where']};return db['MailMessage'][_0x0e4b('0x22')](_0x5fbd6a)[_0x0e4b('0x12')](function(_0x1c204b){_0x5d5cb5['count']=_0x1c204b;if(_0xe926b2[_0x0e4b('0x34')][_0x0e4b('0x42')]){_0x25d7d3[_0x0e4b('0x43')]=[{'all':!![]}];}return db['MailMessage']['findAll'](_0x25d7d3);})[_0x0e4b('0x12')](function(_0x53e3e){_0x5d5cb5[_0x0e4b('0x44')]=_0x53e3e;return _0x5d5cb5;})[_0x0e4b('0x12')](respondWithFilteredResult(_0x3d8b92,_0x25d7d3))[_0x0e4b('0x1d')](handleError(_0x3d8b92,null));};exports['show']=function(_0xe219ab,_0x582811){var _0x205500={'raw':!![],'where':{'id':_0xe219ab[_0x0e4b('0x45')]['id']}},_0x3569d1={};_0x3569d1[_0x0e4b('0x32')]=_[_0x0e4b('0x33')](db['MailMessage'][_0x0e4b('0x2e')]);_0x3569d1[_0x0e4b('0x34')]=_[_0x0e4b('0x33')](_0xe219ab[_0x0e4b('0x34')]);_0x3569d1['filters']=_[_0x0e4b('0x35')](_0x3569d1['model'],_0x3569d1[_0x0e4b('0x34')]);_0x205500[_0x0e4b('0x37')]=_[_0x0e4b('0x35')](_0x3569d1[_0x0e4b('0x32')],qs[_0x0e4b('0x36')](_0xe219ab[_0x0e4b('0x34')][_0x0e4b('0x36')]));_0x205500[_0x0e4b('0x37')]=_0x205500[_0x0e4b('0x37')][_0x0e4b('0x38')]?_0x205500[_0x0e4b('0x37')]:_0x3569d1[_0x0e4b('0x32')];if(_0xe219ab[_0x0e4b('0x34')][_0x0e4b('0x42')]){_0x205500[_0x0e4b('0x43')]=[{'all':!![]}];}_0x205500=_[_0x0e4b('0x40')]({},_0x205500,_0xe219ab[_0x0e4b('0x46')]);return db[_0x0e4b('0x2d')][_0x0e4b('0x47')](_0x205500)[_0x0e4b('0x12')](handleEntityNotFound(_0x582811,null))[_0x0e4b('0x12')](respondWithResult(_0x582811,null))['catch'](handleError(_0x582811,null));};exports['update']=function(_0x3dbc45,_0xfb2c65){if(_0x3dbc45[_0x0e4b('0x48')]['id']){delete _0x3dbc45['body']['id'];}return db[_0x0e4b('0x2d')][_0x0e4b('0x47')]({'where':{'id':_0x3dbc45[_0x0e4b('0x45')]['id']}})['then'](handleEntityNotFound(_0xfb2c65,null))[_0x0e4b('0x12')](saveUpdates(_0x3dbc45['body'],null))[_0x0e4b('0x12')](respondWithResult(_0xfb2c65,null))[_0x0e4b('0x1d')](handleError(_0xfb2c65,null));};exports[_0x0e4b('0x26')]=function(_0x159954,_0x30b23a){return db[_0x0e4b('0x2d')]['find']({'where':{'id':_0x159954['params']['id']}})[_0x0e4b('0x12')](handleEntityNotFound(_0x30b23a,null))[_0x0e4b('0x12')](removeEntity(_0x30b23a,null))['catch'](handleError(_0x30b23a,null));};exports[_0x0e4b('0x49')]=function(_0x2dc7fb,_0x53eaa6){return db['MailMessage'][_0x0e4b('0x49')]()['then'](respondWithResult(_0x53eaa6,null))[_0x0e4b('0x1d')](handleError(_0x53eaa6,null));};exports[_0x0e4b('0x4a')]=function(_0x2e1411,_0x12fffa){return db['MailMessage']['create'](_0x2e1411[_0x0e4b('0x48')])['then'](function(_0x154a80){if(_0x154a80){if(_0x154a80['direction']===_0x0e4b('0x4b')&&!_0x154a80['secret']){var _0xe37e96,_0xbf56ea,_0x2244d5;if(_0x2e1411['body']['to']){_0xbf56ea=_0x2e1411[_0x0e4b('0x48')]['to'][_0x0e4b('0x4c')](',')[0x0];}return db[_0x0e4b('0x4d')]['findOne']({'where':{'id':_0x154a80[_0x0e4b('0x4e')]},'include':[{'model':db['CmList'],'as':_0x0e4b('0x4f'),'include':[{'model':db[_0x0e4b('0x50')],'as':_0x0e4b('0x51'),'where':{'email':_0xbf56ea},'limit':0x1,'order':[[_0x0e4b('0x52'),_0x0e4b('0x53')]]}]},{'model':db[_0x0e4b('0x54')],'as':_0x0e4b('0x55'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':'CloudProvider','raw':!![]}]}]})[_0x0e4b('0x12')](function(_0x33f4c5){_0xe37e96=_0x33f4c5;if(!_0xe37e96||!_0xe37e96[_0x0e4b('0x55')])return;var _0x503b07=_0xe37e96[_0x0e4b('0x56')]();if(_0x2e1411[_0x0e4b('0x48')]['attachments']&&_0x2e1411[_0x0e4b('0x48')][_0x0e4b('0x57')][_0x0e4b('0x38')]){for(var _0x77ae6f=0x0;_0x77ae6f<_0x2e1411['body']['attachments']['length'];_0x77ae6f+=0x1){_0x2e1411[_0x0e4b('0x48')][_0x0e4b('0x57')][_0x77ae6f]={'filename':_0x2e1411['body']['attachments'][_0x77ae6f][_0x0e4b('0x29')],'path':path[_0x0e4b('0x58')](config['root'],_0x0e4b('0x59'),_0x2e1411[_0x0e4b('0x48')][_0x0e4b('0x57')][_0x77ae6f][_0x0e4b('0x5a')])};}}_0x2244d5={'account':_0x503b07,'message':_0x2e1411[_0x0e4b('0x48')]};return;})[_0x0e4b('0x12')](function(){if(_0xe37e96[_0x0e4b('0x4f')]){if(_0xe37e96[_0x0e4b('0x4f')][_0x0e4b('0x51')][_0x0e4b('0x38')]){return _0xe37e96[_0x0e4b('0x4f')][_0x0e4b('0x51')][0x0];}else{return db[_0x0e4b('0x50')][_0x0e4b('0x4a')](_['defaults'](_0x2e1411[_0x0e4b('0x48')],{'firstName':_0x2e1411['body']['to'],'email':_0x2e1411[_0x0e4b('0x48')]['to'],'phone':_0x2e1411['body']['to'],'ListId':_0xe37e96[_0x0e4b('0x5b')]}));}}else{throw new Error(_0x0e4b('0x5c'));}})[_0x0e4b('0x12')](function(){if(_0x2244d5){return respondWithRpcPromise(_0x0e4b('0x5d'),_0x0e4b('0x5e'),_0x2244d5,client9003)['then'](function(_0x20ebf5){return _0x154a80[_0x0e4b('0x25')]({'read':!![],'messageId':_0x20ebf5[_0x0e4b('0x5f')],'sentAt':moment()[_0x0e4b('0x60')](_0x0e4b('0x61'))});})['catch'](function(_0x963fec){logger[_0x0e4b('0x19')]('%s',JSON[_0x0e4b('0x18')](_0x963fec));return _0x154a80;});}return _0x154a80;});}return _0x154a80;}})[_0x0e4b('0x12')](respondWithResult(_0x12fffa,0xc9))['catch'](handleError(_0x12fffa,null));};exports[_0x0e4b('0x62')]=function(_0x11254c,_0x3ffe3d){var _0x237c67={'agent':{},'channel':_0x0e4b('0x63')};if(_0x11254c[_0x0e4b('0x48')]['id']){delete _0x11254c[_0x0e4b('0x48')]['id'];}_0x11254c[_0x0e4b('0x48')]['read']=!![];_0x11254c[_0x0e4b('0x48')][_0x0e4b('0x64')]=moment()[_0x0e4b('0x60')](_0x0e4b('0x61'));_0x11254c[_0x0e4b('0x48')][_0x0e4b('0x65')]=_0x11254c[_0x0e4b('0x48')][_0x0e4b('0x65')]||_0x11254c[_0x0e4b('0x66')]['id'];_0x237c67[_0x0e4b('0x67')]['id']=_0x11254c[_0x0e4b('0x48')]['UserId'];return db['MailMessage'][_0x0e4b('0x47')]({'where':{'id':_0x11254c['params']['id'],'UserId':null}})[_0x0e4b('0x12')](handleEntityNotFound(_0x3ffe3d,null))[_0x0e4b('0x12')](saveUpdates(_0x11254c[_0x0e4b('0x48')],null))[_0x0e4b('0x12')](function(_0x41bba6){if(_0x41bba6){_0x237c67[_0x0e4b('0x1b')]=_0x41bba6[_0x0e4b('0x68')]({'plain':!![]});return db[_0x0e4b('0x69')][_0x0e4b('0x47')]({'where':{'id':_0x41bba6['MailInteractionId']}});}return null;})[_0x0e4b('0x12')](handleEntityNotFound(_0x3ffe3d,null))['then'](function(_0x482f49){if(_0x482f49){return _0x482f49[_0x0e4b('0x25')]({'UserId':_0x11254c[_0x0e4b('0x48')][_0x0e4b('0x65')],'read1stAt':_[_0x0e4b('0x6a')](_0x482f49['read1stAt'])?moment()[_0x0e4b('0x60')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0x8ec165){if(_0x8ec165){_0x237c67['interaction']=_0x8ec165[_0x0e4b('0x68')]({'plain':!![]});interaction_log[_0x0e4b('0x13')](_0x0e4b('0x6b'),_0x11254c[_0x0e4b('0x66')]['id'],_0x11254c[_0x0e4b('0x66')][_0x0e4b('0x29')],_0x11254c[_0x0e4b('0x66')]['role'],_0x237c67[_0x0e4b('0x6c')]['id'],_0x11254c[_0x0e4b('0x48')]?JSON[_0x0e4b('0x18')](_0x11254c[_0x0e4b('0x48')]):'null');return respondWithRpcPromise(_0x0e4b('0x6d'),'acceptMessage',_0x237c67);}return null;})['then'](function(_0x256455){var _0x58d0fc='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x256455['message']['ContactId'];return db['sequelize'][_0x0e4b('0x34')](_0x58d0fc,{'type':db['Sequelize'][_0x0e4b('0x6e')]['SELECT'],'raw':!![]})[_0x0e4b('0x12')](function(_0x546052){return _0x546052;});})[_0x0e4b('0x12')](function(_0x3e517){if(_0x3e517){_0x237c67[_0x0e4b('0x1b')][_0x0e4b('0x6f')]=_0x3e517[0x0];if(!_0x11254c[_0x0e4b('0x48')][_0x0e4b('0x65')])return;return db[_0x0e4b('0x70')][_0x0e4b('0x47')]({'where':{'id':_0x11254c[_0x0e4b('0x48')][_0x0e4b('0x65')],'role':_0x0e4b('0x67')},'attributes':['id','name',_0x0e4b('0x71'),'email',_0x0e4b('0x72')],'raw':!![]});}return null;})[_0x0e4b('0x12')](function(_0x200a05){if(!_0x200a05)return null;_0x237c67[_0x0e4b('0x1b')][_0x0e4b('0x67')]=_0x200a05;return _0x237c67;})[_0x0e4b('0x12')](function(_0x5bdbe2){if(_0x5bdbe2){if(_0x11254c[_0x0e4b('0x48')][_0x0e4b('0x73')]){_0x237c67[_0x0e4b('0x1b')][_0x0e4b('0x74')]=util[_0x0e4b('0x60')](_0x0e4b('0x75'),_0x11254c[_0x0e4b('0x66')]['name']);_0x237c67[_0x0e4b('0x1b')][_0x0e4b('0x76')]=_0x237c67[_0x0e4b('0x76')];_0x237c67['message']['motionChannel']=_0x237c67[_0x0e4b('0x76')];_0x237c67[_0x0e4b('0x1b')][_0x0e4b('0x77')]='accept';_0x237c67['message'][_0x0e4b('0x48')]=htmlToText[_0x0e4b('0x78')](_0x237c67[_0x0e4b('0x1b')][_0x0e4b('0x48')]);return respondWithRpcPromise('EventManager',_0x0e4b('0x79'),{'event':'acceptmessage','message':_0x237c67[_0x0e4b('0x1b')]},client9002)['then'](function(){return _0x237c67;});}return _0x237c67;}return null;})[_0x0e4b('0x12')](respondWithResult(_0x3ffe3d,null))[_0x0e4b('0x1d')](handleError(_0x3ffe3d,null));};exports['reject']=function(_0xa02fda,_0x5d5804){var _0x428b82={'agent':{},'channel':_0x0e4b('0x63')};if(_0xa02fda[_0x0e4b('0x48')]['id']){delete _0xa02fda['body']['id'];}_0xa02fda['body'][_0x0e4b('0x65')]=_0xa02fda[_0x0e4b('0x48')][_0x0e4b('0x65')]||_0xa02fda[_0x0e4b('0x66')]['id'];_0x428b82['agent']['id']=_0xa02fda[_0x0e4b('0x48')]['UserId'];return db[_0x0e4b('0x2d')][_0x0e4b('0x47')]({'where':{'id':_0xa02fda[_0x0e4b('0x45')]['id'],'UserId':null}})[_0x0e4b('0x12')](handleEntityNotFound(_0x5d5804,null))[_0x0e4b('0x12')](function(_0xb7626a){if(_0xb7626a){_0x428b82[_0x0e4b('0x1b')]=_0xb7626a['get']({'plain':!![]});return db[_0x0e4b('0x69')][_0x0e4b('0x47')]({'where':{'id':_0xb7626a['MailInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x5d5804,null))[_0x0e4b('0x12')](function(_0x4ac9ea){if(_0x4ac9ea){_0x428b82['interaction']=_0x4ac9ea[_0x0e4b('0x68')]({'plain':!![]});interaction_log['info'](_0x0e4b('0x7a'),_0xa02fda[_0x0e4b('0x66')]['id'],_0xa02fda['user']['name'],_0xa02fda['user'][_0x0e4b('0x7b')],_0x428b82['interaction']['id'],_0xa02fda[_0x0e4b('0x48')]?JSON[_0x0e4b('0x18')](_0xa02fda[_0x0e4b('0x48')]):_0x0e4b('0x7c'));return respondWithRpcPromise('RejectMessage',_0x0e4b('0x7d'),_0x428b82);}return null;})[_0x0e4b('0x12')](function(_0x4357d9){var _0xc3d5e0='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x4357d9['message'][_0x0e4b('0x7e')];return db[_0x0e4b('0x7f')][_0x0e4b('0x34')](_0xc3d5e0,{'type':db[_0x0e4b('0x80')]['QueryTypes']['SELECT'],'raw':!![]})[_0x0e4b('0x12')](function(_0x96ef66){return _0x96ef66;});})['then'](function(_0x9ab3d6){if(_0x9ab3d6){_0x428b82[_0x0e4b('0x1b')][_0x0e4b('0x6f')]=_0x9ab3d6[0x0];if(!_0xa02fda[_0x0e4b('0x48')]['UserId'])return;return db[_0x0e4b('0x70')]['find']({'where':{'id':_0xa02fda[_0x0e4b('0x48')]['UserId'],'role':_0x0e4b('0x67')},'attributes':['id',_0x0e4b('0x29'),_0x0e4b('0x71'),_0x0e4b('0x81'),_0x0e4b('0x72')],'raw':!![]});}return null;})[_0x0e4b('0x12')](function(_0x5b682f){if(!_0x5b682f)return null;_0x428b82[_0x0e4b('0x1b')][_0x0e4b('0x67')]=_0x5b682f;return _0x428b82;})[_0x0e4b('0x12')](function(_0x147373){if(_0x147373){_0x147373[_0x0e4b('0x1b')][_0x0e4b('0x74')]=util[_0x0e4b('0x60')](_0x0e4b('0x75'),_0xa02fda['user']['name']);_0x147373[_0x0e4b('0x1b')][_0x0e4b('0x76')]=_0x428b82[_0x0e4b('0x76')];_0x147373['message']['motionChannel']=_0x428b82[_0x0e4b('0x76')];_0x147373[_0x0e4b('0x1b')][_0x0e4b('0x77')]=_0x0e4b('0x82');_0x147373[_0x0e4b('0x1b')][_0x0e4b('0x48')]=htmlToText['fromString'](_0x428b82[_0x0e4b('0x1b')]['body']);respondWithRpcPromise(_0x0e4b('0x79'),_0x0e4b('0x79'),{'event':_0x0e4b('0x83'),'message':_0x147373[_0x0e4b('0x1b')]},client9002);return _0x428b82;}return null;})['then'](respondWithResult(_0x5d5804,null))[_0x0e4b('0x1d')](handleError(_0x5d5804,null));};exports[_0x0e4b('0x84')]=function(_0x2466e3,_0x3b9d76){var _0xfb812b=moment()['unix']()[_0x0e4b('0x85')]();var _0x2807b3=path[_0x0e4b('0x58')](config[_0x0e4b('0x86')],_0x0e4b('0x87'),_0x0e4b('0x88'),_0x0e4b('0x89'));var _0x2c425e=path[_0x0e4b('0x58')](config[_0x0e4b('0x86')],_0x0e4b('0x87'),'files',_0x0e4b('0x57'));var _0x36c835=util[_0x0e4b('0x60')](_0x0e4b('0x8a'),_0xfb812b);return db[_0x0e4b('0x2d')][_0x0e4b('0x47')]({'where':{'id':_0x2466e3['params']['id']},'attributes':['id','body',_0x0e4b('0x8b'),'to','cc',_0x0e4b('0x8c'),_0x0e4b('0x8d'),_0x0e4b('0x8e')],'include':_0x2466e3[_0x0e4b('0x34')][_0x0e4b('0x57')]?[{'model':db['Attachment'],'as':_0x0e4b('0x8f')}]:undefined})['then'](handleEntityNotFound(_0x3b9d76,null))[_0x0e4b('0x12')](function(_0x532d4b){if(_0x532d4b){var _0x26c6cf=_0x532d4b;var _0x987488={'from':_0x26c6cf[_0x0e4b('0x8b')],'to':_0x26c6cf['to'],'subject':_0x26c6cf['subject'],'html':htmlEntities[_0x0e4b('0x90')](_0x26c6cf[_0x0e4b('0x48')]),'headers':{'Date':moment(_0x26c6cf['createdAt'])['format'](_0x0e4b('0x91'))},'attachments':[]};if(_0x532d4b['cc']){_0x987488[_0x0e4b('0x92')]['Cc']=_0x532d4b['cc'];}if(_0x532d4b[_0x0e4b('0x8c')]){_0x987488[_0x0e4b('0x92')][_0x0e4b('0x93')]=_0x532d4b[_0x0e4b('0x8c')];}return new BPromise(function(_0x1b0a25,_0x125234){if(_0x532d4b[_0x0e4b('0x8f')]){for(var _0x39eab9=0x0;_0x39eab9<_0x532d4b[_0x0e4b('0x8f')]['length'];_0x39eab9++){var _0x1199d8=_0x532d4b[_0x0e4b('0x8f')][_0x39eab9];var _0xd9db8e=path['join'](_0x2c425e,_0x1199d8[_0x0e4b('0x5a')]);if(fs['existsSync'](_0xd9db8e)){_0x987488[_0x0e4b('0x57')][_0x0e4b('0x94')]({'name':_0x1199d8['name'],'contentType':_0x1199d8['type'],'data':fs[_0x0e4b('0x95')](_0xd9db8e)});}}}emlformat['build'](_0x987488,function(_0x284594,_0x40b667){if(_0x284594)return _0x125234(_0x284594);fs['writeFileSync'](path['join'](_0x2807b3,_0x36c835),_0x40b667);return _0x1b0a25(_0x40b667);});});}})['then'](function(_0x54243a){if(_0x54243a){return _0x3b9d76[_0x0e4b('0x84')](path[_0x0e4b('0x58')](_0x2807b3,_0x36c835),_0x36c835,function(_0x452ee8){if(!_0x452ee8)fs[_0x0e4b('0x96')](path[_0x0e4b('0x58')](_0x2807b3,_0x36c835));});}})[_0x0e4b('0x1d')](handleError(_0x3b9d76,null));}; \ No newline at end of file +var _0xf34a=['moment','util','path','lodash','ioredis','../../config/logger','api','mail-interactions','../../config/environment','../../mysqldb','redis','defaults','localhost','html-entities','./mailMessage.socket','client','http','request','info','MailMessage,\x20%s,\x20%s','request\x20sent','MailMessage,\x20%s,\x20%s,\x20%s','stringify','code','error','message','catch','status','json','offset','undefined','count','limit','set','Content-Range','update','then','end','sendStatus','stack','name','send','MailMessage','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','map','VIRTUAL','options','includeAll','include','findAll','rows','show','body','find','params','destroy','describe','create','direction','secret','split','MailAccount','MailAccountId','List','CmContact','Contacts','updatedAt','DESC','Smtp','attachments','root','server/files/attachments','ListId','List\x20not\x20found','SendMail','sendMail','messageId','format','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','MailInteraction','MailInteractionId','isNil','read1stAt','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','acceptMessage','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','manual','SIP/%s','channel','motionChannel','accept','fromString','EventManager','acceptmessage','reject','mail','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','interface','rejectmessage','download','unix','toString','join','server','files','tmp','from','bcc','createdAt','Attachment','Attachments','subject','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','basename','existsSync','push','readFileSync','build','eml-format'];(function(_0x2fa4f9,_0x306168){var _0x37a651=function(_0x3bc64e){while(--_0x3bc64e){_0x2fa4f9['push'](_0x2fa4f9['shift']());}};_0x37a651(++_0x306168);}(_0xf34a,0x1d6));var _0xaf34=function(_0x698e66,_0x49c43a){_0x698e66=_0x698e66-0x0;var _0x3f4cab=_0xf34a[_0x698e66];return _0x3f4cab;};'use strict';var emlformat=require(_0xaf34('0x0'));var moment=require(_0xaf34('0x1'));var BPromise=require('bluebird');var util=require(_0xaf34('0x2'));var path=require(_0xaf34('0x3'));var fs=require('fs');var _=require(_0xaf34('0x4'));var Redis=require(_0xaf34('0x5'));var htmlToText=require('html-to-text');var qs=require('../../components/parsers/qs');var logger=require(_0xaf34('0x6'))(_0xaf34('0x7'));var interaction_log=require('../../config/logger')(_0xaf34('0x8'));var config=require(_0xaf34('0x9'));var db=require(_0xaf34('0xa'))['db'];config[_0xaf34('0xb')]=_[_0xaf34('0xc')](config['redis'],{'host':_0xaf34('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xaf34('0xb')]));var htmlEntities=require(_0xaf34('0xe'));require(_0xaf34('0xf'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0xaf34('0x10')]['http']({'port':0x232c});var client9003=jayson['client'][_0xaf34('0x11')]({'port':0x232b});var client9002=jayson[_0xaf34('0x10')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3ce481,_0x4b64c8,_0x2d09d2,_0x199bec){return new BPromise(function(_0x217fb5,_0xc09f09){var _0x1071f8=_0x199bec||client;return _0x1071f8[_0xaf34('0x12')](_0x3ce481,_0x2d09d2)['then'](function(_0x4594ab){logger[_0xaf34('0x13')](_0xaf34('0x14'),_0x4b64c8,_0xaf34('0x15'));logger['debug'](_0xaf34('0x16'),_0x4b64c8,_0xaf34('0x15'),JSON[_0xaf34('0x17')](_0x4594ab));if(_0x4594ab['error']){if(_0x4594ab['error'][_0xaf34('0x18')]===0x1f4){logger[_0xaf34('0x19')](_0xaf34('0x14'),_0x4b64c8,_0x4594ab[_0xaf34('0x19')][_0xaf34('0x1a')]);return _0xc09f09(_0x4594ab[_0xaf34('0x19')][_0xaf34('0x1a')]);}logger[_0xaf34('0x19')](_0xaf34('0x14'),_0x4b64c8,_0x4594ab[_0xaf34('0x19')][_0xaf34('0x1a')]);return _0x217fb5(_0x4594ab[_0xaf34('0x19')][_0xaf34('0x1a')]);}else{logger[_0xaf34('0x13')](_0xaf34('0x14'),_0x4b64c8,_0xaf34('0x15'));_0x217fb5(_0x4594ab['result']['message']);}})[_0xaf34('0x1b')](function(_0x45458e){logger[_0xaf34('0x19')](_0xaf34('0x14'),_0x4b64c8,_0x45458e);_0xc09f09(_0x45458e);});});}function respondWithResult(_0x1935d5,_0x570d7d){_0x570d7d=_0x570d7d||0xc8;return function(_0x431968){if(_0x431968){return _0x1935d5[_0xaf34('0x1c')](_0x570d7d)[_0xaf34('0x1d')](_0x431968);}};}function respondWithFilteredResult(_0x1221da,_0x468dea){return function(_0x557563){if(_0x557563){var _0x421efb=typeof _0x468dea[_0xaf34('0x1e')]===_0xaf34('0x1f')&&typeof _0x468dea['limit']===_0xaf34('0x1f');var _0x28ce10=_0x557563[_0xaf34('0x20')];var _0x50f069=_0x421efb?0x0:_0x468dea[_0xaf34('0x1e')];var _0x26a94a=_0x421efb?_0x557563[_0xaf34('0x20')]:_0x468dea[_0xaf34('0x1e')]+_0x468dea[_0xaf34('0x21')];var _0x328cbc;if(_0x26a94a>=_0x28ce10){_0x26a94a=_0x28ce10;_0x328cbc=0xc8;}else{_0x328cbc=0xce;}_0x1221da[_0xaf34('0x1c')](_0x328cbc);return _0x1221da[_0xaf34('0x22')](_0xaf34('0x23'),_0x50f069+'-'+_0x26a94a+'/'+_0x28ce10)[_0xaf34('0x1d')](_0x557563);}return null;};}function saveUpdates(_0x2922ec){return function(_0x4a03d2){if(_0x4a03d2){return _0x4a03d2[_0xaf34('0x24')](_0x2922ec)['then'](function(_0x3b8d65){return _0x3b8d65;});}return null;};}function removeEntity(_0x327b91){return function(_0x2f06f5){if(_0x2f06f5){return _0x2f06f5['destroy']()[_0xaf34('0x25')](function(){_0x327b91['status'](0xcc)[_0xaf34('0x26')]();});}};}function handleEntityNotFound(_0x1bf82c){return function(_0x2a8aa3){if(!_0x2a8aa3){_0x1bf82c[_0xaf34('0x27')](0x194);}return _0x2a8aa3;};}function handleError(_0x43d14d,_0xe4a1ff){_0xe4a1ff=_0xe4a1ff||0x1f4;return function(_0x4832da){logger[_0xaf34('0x19')](_0x4832da[_0xaf34('0x28')]);if(_0x4832da[_0xaf34('0x29')]){delete _0x4832da['name'];}_0x43d14d[_0xaf34('0x1c')](_0xe4a1ff)[_0xaf34('0x2a')](_0x4832da);};}exports['index']=function(_0x293c89,_0x3368f5){var _0x292593={},_0x49b02a={},_0x1d7b0e={'count':0x0,'rows':[]};var _0x537159=_['map'](db[_0xaf34('0x2b')][_0xaf34('0x2c')],function(_0x4dd485){return{'name':_0x4dd485['fieldName'],'type':_0x4dd485[_0xaf34('0x2d')][_0xaf34('0x2e')]};});_0x49b02a[_0xaf34('0x2f')]=_['map'](_0x537159,'name');_0x49b02a[_0xaf34('0x30')]=_[_0xaf34('0x31')](_0x293c89[_0xaf34('0x30')]);_0x49b02a[_0xaf34('0x32')]=_[_0xaf34('0x33')](_0x49b02a['model'],_0x49b02a[_0xaf34('0x30')]);_0x292593[_0xaf34('0x34')]=_[_0xaf34('0x33')](_0x49b02a['model'],qs[_0xaf34('0x35')](_0x293c89['query'][_0xaf34('0x35')]));_0x292593['attributes']=_0x292593[_0xaf34('0x34')][_0xaf34('0x36')]?_0x292593[_0xaf34('0x34')]:_0x49b02a['model'];if(!_0x293c89[_0xaf34('0x30')][_0xaf34('0x37')]('nolimit')){_0x292593[_0xaf34('0x21')]=qs[_0xaf34('0x21')](_0x293c89['query']['limit']);_0x292593['offset']=qs[_0xaf34('0x1e')](_0x293c89[_0xaf34('0x30')][_0xaf34('0x1e')]);}_0x292593['order']=qs[_0xaf34('0x38')](_0x293c89[_0xaf34('0x30')][_0xaf34('0x38')]);_0x292593[_0xaf34('0x39')]=qs['filters'](_[_0xaf34('0x3a')](_0x293c89[_0xaf34('0x30')],_0x49b02a['filters']),_0x537159);if(_0x293c89['query'][_0xaf34('0x3b')]){_0x292593['where']=_[_0xaf34('0x3c')](_0x292593[_0xaf34('0x39')],{'$or':_[_0xaf34('0x3d')](_0x537159,function(_0x22e754){if(_0x22e754[_0xaf34('0x2d')]!==_0xaf34('0x3e')){var _0x37de98={};_0x37de98[_0x22e754['name']]={'$like':'%'+_0x293c89[_0xaf34('0x30')][_0xaf34('0x3b')]+'%'};return _0x37de98;}})});}_0x292593=_[_0xaf34('0x3c')]({},_0x292593,_0x293c89[_0xaf34('0x3f')]);var _0x496cad={'where':_0x292593[_0xaf34('0x39')]};return db['MailMessage']['count'](_0x496cad)[_0xaf34('0x25')](function(_0x3e46bd){_0x1d7b0e[_0xaf34('0x20')]=_0x3e46bd;if(_0x293c89[_0xaf34('0x30')][_0xaf34('0x40')]){_0x292593[_0xaf34('0x41')]=[{'all':!![]}];}return db['MailMessage'][_0xaf34('0x42')](_0x292593);})[_0xaf34('0x25')](function(_0x22afc1){_0x1d7b0e[_0xaf34('0x43')]=_0x22afc1;return _0x1d7b0e;})[_0xaf34('0x25')](respondWithFilteredResult(_0x3368f5,_0x292593))[_0xaf34('0x1b')](handleError(_0x3368f5,null));};exports[_0xaf34('0x44')]=function(_0x17bc8c,_0x560ae1){var _0x3e5bc6={'raw':!![],'where':{'id':_0x17bc8c['params']['id']}},_0x22b980={};_0x22b980[_0xaf34('0x2f')]=_[_0xaf34('0x31')](db[_0xaf34('0x2b')][_0xaf34('0x2c')]);_0x22b980['query']=_[_0xaf34('0x31')](_0x17bc8c['query']);_0x22b980[_0xaf34('0x32')]=_[_0xaf34('0x33')](_0x22b980[_0xaf34('0x2f')],_0x22b980[_0xaf34('0x30')]);_0x3e5bc6[_0xaf34('0x34')]=_['intersection'](_0x22b980[_0xaf34('0x2f')],qs[_0xaf34('0x35')](_0x17bc8c[_0xaf34('0x30')]['fields']));_0x3e5bc6[_0xaf34('0x34')]=_0x3e5bc6[_0xaf34('0x34')][_0xaf34('0x36')]?_0x3e5bc6[_0xaf34('0x34')]:_0x22b980[_0xaf34('0x2f')];if(_0x17bc8c[_0xaf34('0x30')][_0xaf34('0x40')]){_0x3e5bc6['include']=[{'all':!![]}];}_0x3e5bc6=_[_0xaf34('0x3c')]({},_0x3e5bc6,_0x17bc8c[_0xaf34('0x3f')]);return db[_0xaf34('0x2b')]['find'](_0x3e5bc6)['then'](handleEntityNotFound(_0x560ae1,null))['then'](respondWithResult(_0x560ae1,null))['catch'](handleError(_0x560ae1,null));};exports['update']=function(_0x5ad5e0,_0x2a6af1){if(_0x5ad5e0[_0xaf34('0x45')]['id']){delete _0x5ad5e0[_0xaf34('0x45')]['id'];}return db[_0xaf34('0x2b')][_0xaf34('0x46')]({'where':{'id':_0x5ad5e0[_0xaf34('0x47')]['id']}})['then'](handleEntityNotFound(_0x2a6af1,null))[_0xaf34('0x25')](saveUpdates(_0x5ad5e0[_0xaf34('0x45')],null))[_0xaf34('0x25')](respondWithResult(_0x2a6af1,null))[_0xaf34('0x1b')](handleError(_0x2a6af1,null));};exports[_0xaf34('0x48')]=function(_0x1e4b0f,_0x4028b4){return db[_0xaf34('0x2b')][_0xaf34('0x46')]({'where':{'id':_0x1e4b0f['params']['id']}})[_0xaf34('0x25')](handleEntityNotFound(_0x4028b4,null))[_0xaf34('0x25')](removeEntity(_0x4028b4,null))['catch'](handleError(_0x4028b4,null));};exports[_0xaf34('0x49')]=function(_0x593536,_0x28c2d7){return db[_0xaf34('0x2b')][_0xaf34('0x49')]()[_0xaf34('0x25')](respondWithResult(_0x28c2d7,null))['catch'](handleError(_0x28c2d7,null));};exports['create']=function(_0x2d3e3e,_0xd7d929){return db[_0xaf34('0x2b')][_0xaf34('0x4a')](_0x2d3e3e[_0xaf34('0x45')])[_0xaf34('0x25')](function(_0x50eb00){if(_0x50eb00){if(_0x50eb00[_0xaf34('0x4b')]==='out'&&!_0x50eb00[_0xaf34('0x4c')]){var _0x30bed,_0x5ab7bf,_0x3a246c;if(_0x2d3e3e[_0xaf34('0x45')]['to']){_0x5ab7bf=_0x2d3e3e[_0xaf34('0x45')]['to'][_0xaf34('0x4d')](',')[0x0];}return db[_0xaf34('0x4e')]['findOne']({'where':{'id':_0x50eb00[_0xaf34('0x4f')]},'include':[{'model':db['CmList'],'as':_0xaf34('0x50'),'include':[{'model':db[_0xaf34('0x51')],'as':_0xaf34('0x52'),'where':{'email':_0x5ab7bf},'limit':0x1,'order':[[_0xaf34('0x53'),_0xaf34('0x54')]]}]},{'model':db['MailServerOut'],'as':_0xaf34('0x55'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':'CloudProvider','raw':!![]}]}]})['then'](function(_0x22fd0f){_0x30bed=_0x22fd0f;if(!_0x30bed||!_0x30bed[_0xaf34('0x55')])return;var _0x252286=_0x30bed['getSmtpOptions']();if(_0x2d3e3e['body'][_0xaf34('0x56')]&&_0x2d3e3e[_0xaf34('0x45')][_0xaf34('0x56')][_0xaf34('0x36')]){for(var _0x36a5c7=0x0;_0x36a5c7<_0x2d3e3e[_0xaf34('0x45')][_0xaf34('0x56')][_0xaf34('0x36')];_0x36a5c7+=0x1){_0x2d3e3e[_0xaf34('0x45')][_0xaf34('0x56')][_0x36a5c7]={'filename':_0x2d3e3e[_0xaf34('0x45')]['attachments'][_0x36a5c7]['name'],'path':path['join'](config[_0xaf34('0x57')],_0xaf34('0x58'),_0x2d3e3e[_0xaf34('0x45')]['attachments'][_0x36a5c7]['basename'])};}}_0x3a246c={'account':_0x252286,'message':_0x2d3e3e['body']};return;})[_0xaf34('0x25')](function(){if(_0x30bed[_0xaf34('0x50')]){if(_0x30bed['List']['Contacts']['length']){return _0x30bed[_0xaf34('0x50')]['Contacts'][0x0];}else{return db['CmContact'][_0xaf34('0x4a')](_['defaults'](_0x2d3e3e['body'],{'firstName':_0x2d3e3e['body']['to'],'email':_0x2d3e3e[_0xaf34('0x45')]['to'],'phone':_0x2d3e3e[_0xaf34('0x45')]['to'],'ListId':_0x30bed[_0xaf34('0x59')]}));}}else{throw new Error(_0xaf34('0x5a'));}})[_0xaf34('0x25')](function(){if(_0x3a246c){return respondWithRpcPromise(_0xaf34('0x5b'),_0xaf34('0x5c'),_0x3a246c,client9003)['then'](function(_0x49e24c){return _0x50eb00[_0xaf34('0x24')]({'read':!![],'messageId':_0x49e24c[_0xaf34('0x5d')],'sentAt':moment()[_0xaf34('0x5e')]('YYYY-MM-DD\x20HH:mm:ss')});})[_0xaf34('0x1b')](function(_0x1c77e4){logger[_0xaf34('0x19')]('%s',JSON[_0xaf34('0x17')](_0x1c77e4));return _0x50eb00;});}return _0x50eb00;});}return _0x50eb00;}})[_0xaf34('0x25')](respondWithResult(_0xd7d929,0xc9))[_0xaf34('0x1b')](handleError(_0xd7d929,null));};exports['accept']=function(_0x31bb3c,_0x4026c4){var _0x357fb7={'agent':{},'channel':'mail'};if(_0x31bb3c[_0xaf34('0x45')]['id']){delete _0x31bb3c[_0xaf34('0x45')]['id'];}_0x31bb3c['body'][_0xaf34('0x5f')]=!![];_0x31bb3c[_0xaf34('0x45')][_0xaf34('0x60')]=moment()[_0xaf34('0x5e')](_0xaf34('0x61'));_0x31bb3c['body']['UserId']=_0x31bb3c['body'][_0xaf34('0x62')]||_0x31bb3c[_0xaf34('0x63')]['id'];_0x357fb7[_0xaf34('0x64')]['id']=_0x31bb3c[_0xaf34('0x45')][_0xaf34('0x62')];return db[_0xaf34('0x2b')][_0xaf34('0x46')]({'where':{'id':_0x31bb3c[_0xaf34('0x47')]['id'],'UserId':null}})[_0xaf34('0x25')](handleEntityNotFound(_0x4026c4,null))[_0xaf34('0x25')](saveUpdates(_0x31bb3c[_0xaf34('0x45')],null))[_0xaf34('0x25')](function(_0x320594){if(_0x320594){_0x357fb7['message']=_0x320594[_0xaf34('0x65')]({'plain':!![]});return db[_0xaf34('0x66')]['find']({'where':{'id':_0x320594[_0xaf34('0x67')]}});}return null;})[_0xaf34('0x25')](handleEntityNotFound(_0x4026c4,null))[_0xaf34('0x25')](function(_0x1ac3ad){if(_0x1ac3ad){return _0x1ac3ad[_0xaf34('0x24')]({'UserId':_0x31bb3c['body'][_0xaf34('0x62')],'read1stAt':_[_0xaf34('0x68')](_0x1ac3ad[_0xaf34('0x69')])?moment()[_0xaf34('0x5e')](_0xaf34('0x61')):undefined});}return null;})[_0xaf34('0x25')](function(_0x3f8ad4){if(_0x3f8ad4){_0x357fb7[_0xaf34('0x6a')]=_0x3f8ad4[_0xaf34('0x65')]({'plain':!![]});interaction_log[_0xaf34('0x13')](_0xaf34('0x6b'),_0x31bb3c['user']['id'],_0x31bb3c[_0xaf34('0x63')][_0xaf34('0x29')],_0x31bb3c['user']['role'],_0x357fb7['interaction']['id'],_0x31bb3c[_0xaf34('0x45')]?JSON[_0xaf34('0x17')](_0x31bb3c[_0xaf34('0x45')]):_0xaf34('0x6c'));return respondWithRpcPromise('AcceptMessage',_0xaf34('0x6d'),_0x357fb7);}return null;})[_0xaf34('0x25')](function(_0x32b1b3){var _0x5199c2='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x32b1b3[_0xaf34('0x1a')]['ContactId'];return db[_0xaf34('0x6e')][_0xaf34('0x30')](_0x5199c2,{'type':db[_0xaf34('0x6f')][_0xaf34('0x70')][_0xaf34('0x71')],'raw':!![]})[_0xaf34('0x25')](function(_0x54185f){return _0x54185f;});})[_0xaf34('0x25')](function(_0x5687ef){if(_0x5687ef){_0x357fb7['message'][_0xaf34('0x72')]=_0x5687ef[0x0];if(!_0x31bb3c[_0xaf34('0x45')]['UserId'])return;return db[_0xaf34('0x73')]['find']({'where':{'id':_0x31bb3c[_0xaf34('0x45')][_0xaf34('0x62')],'role':_0xaf34('0x64')},'attributes':['id',_0xaf34('0x29'),_0xaf34('0x74'),_0xaf34('0x75'),_0xaf34('0x76')],'raw':!![]});}return null;})[_0xaf34('0x25')](function(_0x18a06b){if(!_0x18a06b)return null;_0x357fb7[_0xaf34('0x1a')][_0xaf34('0x64')]=_0x18a06b;return _0x357fb7;})[_0xaf34('0x25')](function(_0x21225b){if(_0x21225b){if(_0x31bb3c[_0xaf34('0x45')][_0xaf34('0x77')]){_0x357fb7[_0xaf34('0x1a')]['interface']=util[_0xaf34('0x5e')](_0xaf34('0x78'),_0x31bb3c['user']['name']);_0x357fb7[_0xaf34('0x1a')][_0xaf34('0x79')]=_0x357fb7['channel'];_0x357fb7[_0xaf34('0x1a')][_0xaf34('0x7a')]=_0x357fb7[_0xaf34('0x79')];_0x357fb7['message']['event']=_0xaf34('0x7b');_0x357fb7[_0xaf34('0x1a')][_0xaf34('0x45')]=htmlToText[_0xaf34('0x7c')](_0x357fb7[_0xaf34('0x1a')][_0xaf34('0x45')]);return respondWithRpcPromise(_0xaf34('0x7d'),'EventManager',{'event':_0xaf34('0x7e'),'message':_0x357fb7[_0xaf34('0x1a')]},client9002)[_0xaf34('0x25')](function(){return _0x357fb7;});}return _0x357fb7;}return null;})['then'](respondWithResult(_0x4026c4,null))['catch'](handleError(_0x4026c4,null));};exports[_0xaf34('0x7f')]=function(_0x241ee7,_0x3e8912){var _0xfa2ced={'agent':{},'channel':_0xaf34('0x80')};if(_0x241ee7['body']['id']){delete _0x241ee7['body']['id'];}_0x241ee7['body']['UserId']=_0x241ee7[_0xaf34('0x45')]['UserId']||_0x241ee7[_0xaf34('0x63')]['id'];_0xfa2ced['agent']['id']=_0x241ee7[_0xaf34('0x45')][_0xaf34('0x62')];return db[_0xaf34('0x2b')][_0xaf34('0x46')]({'where':{'id':_0x241ee7[_0xaf34('0x47')]['id'],'UserId':null}})[_0xaf34('0x25')](handleEntityNotFound(_0x3e8912,null))[_0xaf34('0x25')](function(_0x241f7d){if(_0x241f7d){_0xfa2ced[_0xaf34('0x1a')]=_0x241f7d['get']({'plain':!![]});return db[_0xaf34('0x66')][_0xaf34('0x46')]({'where':{'id':_0x241f7d[_0xaf34('0x67')]}});}return null;})[_0xaf34('0x25')](handleEntityNotFound(_0x3e8912,null))[_0xaf34('0x25')](function(_0x89cf6f){if(_0x89cf6f){_0xfa2ced[_0xaf34('0x6a')]=_0x89cf6f['get']({'plain':!![]});interaction_log[_0xaf34('0x13')](_0xaf34('0x81'),_0x241ee7[_0xaf34('0x63')]['id'],_0x241ee7['user'][_0xaf34('0x29')],_0x241ee7['user']['role'],_0xfa2ced[_0xaf34('0x6a')]['id'],_0x241ee7[_0xaf34('0x45')]?JSON[_0xaf34('0x17')](_0x241ee7[_0xaf34('0x45')]):_0xaf34('0x6c'));return respondWithRpcPromise(_0xaf34('0x82'),'rejectMessage',_0xfa2ced);}return null;})[_0xaf34('0x25')](function(_0x3c711f){var _0x1be171=_0xaf34('0x83')+_0x3c711f[_0xaf34('0x1a')][_0xaf34('0x84')];return db[_0xaf34('0x6e')][_0xaf34('0x30')](_0x1be171,{'type':db[_0xaf34('0x6f')][_0xaf34('0x70')][_0xaf34('0x71')],'raw':!![]})[_0xaf34('0x25')](function(_0x4a87f7){return _0x4a87f7;});})[_0xaf34('0x25')](function(_0x1773a2){if(_0x1773a2){_0xfa2ced[_0xaf34('0x1a')]['contact']=_0x1773a2[0x0];if(!_0x241ee7['body']['UserId'])return;return db['User']['find']({'where':{'id':_0x241ee7[_0xaf34('0x45')]['UserId'],'role':_0xaf34('0x64')},'attributes':['id',_0xaf34('0x29'),_0xaf34('0x74'),'email',_0xaf34('0x76')],'raw':!![]});}return null;})['then'](function(_0x5b3a42){if(!_0x5b3a42)return null;_0xfa2ced['message'][_0xaf34('0x64')]=_0x5b3a42;return _0xfa2ced;})[_0xaf34('0x25')](function(_0x4e385a){if(_0x4e385a){_0x4e385a[_0xaf34('0x1a')][_0xaf34('0x85')]=util[_0xaf34('0x5e')]('SIP/%s',_0x241ee7[_0xaf34('0x63')][_0xaf34('0x29')]);_0x4e385a['message'][_0xaf34('0x79')]=_0xfa2ced[_0xaf34('0x79')];_0x4e385a[_0xaf34('0x1a')][_0xaf34('0x7a')]=_0xfa2ced['channel'];_0x4e385a[_0xaf34('0x1a')]['event']='reject';_0x4e385a[_0xaf34('0x1a')][_0xaf34('0x45')]=htmlToText[_0xaf34('0x7c')](_0xfa2ced[_0xaf34('0x1a')][_0xaf34('0x45')]);respondWithRpcPromise(_0xaf34('0x7d'),_0xaf34('0x7d'),{'event':_0xaf34('0x86'),'message':_0x4e385a['message']},client9002);return _0xfa2ced;}return null;})[_0xaf34('0x25')](respondWithResult(_0x3e8912,null))[_0xaf34('0x1b')](handleError(_0x3e8912,null));};exports[_0xaf34('0x87')]=function(_0x24180a,_0x310e55){var _0x2e5615=moment()[_0xaf34('0x88')]()[_0xaf34('0x89')]();var _0x2c3b75=path[_0xaf34('0x8a')](config['root'],_0xaf34('0x8b'),_0xaf34('0x8c'),_0xaf34('0x8d'));var _0x3c30da=path['join'](config['root'],'server',_0xaf34('0x8c'),_0xaf34('0x56'));var _0x4dfd52=util['format']('message-%s.eml',_0x2e5615);return db[_0xaf34('0x2b')][_0xaf34('0x46')]({'where':{'id':_0x24180a[_0xaf34('0x47')]['id']},'attributes':['id','body',_0xaf34('0x8e'),'to','cc',_0xaf34('0x8f'),'subject',_0xaf34('0x90')],'include':_0x24180a['query']['attachments']?[{'model':db[_0xaf34('0x91')],'as':_0xaf34('0x92')}]:undefined})['then'](handleEntityNotFound(_0x310e55,null))['then'](function(_0x15c5d9){if(_0x15c5d9){var _0x428415=_0x15c5d9;var _0x5b9756={'from':_0x428415['from'],'to':_0x428415['to'],'subject':_0x428415[_0xaf34('0x93')],'html':htmlEntities[_0xaf34('0x94')](_0x428415['body']),'headers':{'Date':moment(_0x428415['createdAt'])[_0xaf34('0x5e')](_0xaf34('0x95'))},'attachments':[]};if(_0x15c5d9['cc']){_0x5b9756[_0xaf34('0x96')]['Cc']=_0x15c5d9['cc'];}if(_0x15c5d9['bcc']){_0x5b9756[_0xaf34('0x96')][_0xaf34('0x97')]=_0x15c5d9[_0xaf34('0x8f')];}return new BPromise(function(_0x45b738,_0x4a3c82){if(_0x15c5d9[_0xaf34('0x92')]){for(var _0x469aec=0x0;_0x469aec<_0x15c5d9[_0xaf34('0x92')][_0xaf34('0x36')];_0x469aec++){var _0x22c660=_0x15c5d9['Attachments'][_0x469aec];var _0x2bf673=path[_0xaf34('0x8a')](_0x3c30da,_0x22c660[_0xaf34('0x98')]);if(fs[_0xaf34('0x99')](_0x2bf673)){_0x5b9756['attachments'][_0xaf34('0x9a')]({'name':_0x22c660[_0xaf34('0x29')],'contentType':_0x22c660['type'],'data':fs[_0xaf34('0x9b')](_0x2bf673)});}}}emlformat[_0xaf34('0x9c')](_0x5b9756,function(_0x575dd6,_0xd9251f){if(_0x575dd6)return _0x4a3c82(_0x575dd6);fs['writeFileSync'](path[_0xaf34('0x8a')](_0x2c3b75,_0x4dfd52),_0xd9251f);return _0x45b738(_0xd9251f);});});}})[_0xaf34('0x25')](function(_0x531257){if(_0x531257){return _0x310e55[_0xaf34('0x87')](path[_0xaf34('0x8a')](_0x2c3b75,_0x4dfd52),_0x4dfd52,function(_0x123030){if(!_0x123030)fs['unlinkSync'](path['join'](_0x2c3b75,_0x4dfd52));});}})['catch'](handleError(_0x310e55,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index 48e3c41..97a8464 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 _0x5901=['hook','exports','events','../../mysqldb','MailMessage','save','update','remove','emit'];(function(_0x2e30cb,_0x211465){var _0x4469e8=function(_0x23770a){while(--_0x23770a){_0x2e30cb['push'](_0x2e30cb['shift']());}};_0x4469e8(++_0x211465);}(_0x5901,0x9b));var _0x1590=function(_0x22355e,_0x3057ff){_0x22355e=_0x22355e-0x0;var _0x4d2413=_0x5901[_0x22355e];return _0x4d2413;};'use strict';var EventEmitter=require(_0x1590('0x0'));var MailMessage=require(_0x1590('0x1'))['db'][_0x1590('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x1590('0x3'),'afterUpdate':_0x1590('0x4'),'afterDestroy':_0x1590('0x5')};function emitEvent(_0x59f41d){return function(_0x49c47c,_0x1068ea,_0x4f0338){MailMessageEvents['emit'](_0x59f41d+':'+_0x49c47c['id'],_0x49c47c);MailMessageEvents[_0x1590('0x6')](_0x59f41d,_0x49c47c);_0x4f0338(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailMessage[_0x1590('0x7')](e,emitEvent(event));}}module[_0x1590('0x8')]=MailMessageEvents; \ No newline at end of file +var _0x3f20=['events','../../mysqldb','MailMessage','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x3417f6,_0x408357){var _0x4059c9=function(_0xd16ddf){while(--_0xd16ddf){_0x3417f6['push'](_0x3417f6['shift']());}};_0x4059c9(++_0x408357);}(_0x3f20,0x183));var _0x03f2=function(_0x45b1de,_0x1dcb97){_0x45b1de=_0x45b1de-0x0;var _0x4a88fa=_0x3f20[_0x45b1de];return _0x4a88fa;};'use strict';var EventEmitter=require(_0x03f2('0x0'));var MailMessage=require(_0x03f2('0x1'))['db'][_0x03f2('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x03f2('0x3'),'afterUpdate':_0x03f2('0x4'),'afterDestroy':_0x03f2('0x5')};function emitEvent(_0x6dfb45){return function(_0x218b36,_0x5e66aa,_0x110922){MailMessageEvents[_0x03f2('0x6')](_0x6dfb45+':'+_0x218b36['id'],_0x218b36);MailMessageEvents[_0x03f2('0x6')](_0x6dfb45,_0x218b36);_0x110922(null);};}for(var e in events){if(events[_0x03f2('0x7')](e)){var event=events[e];MailMessage[_0x03f2('0x8')](e,emitEvent(event));}}module['exports']=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index e8b0f9d..9b51e51 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 _0x1fa0=['api','moment','request-promise','html-to-text','path','../../config/environment','./mailMessage.attributes','exports','define','MailMessage','mail_messages','messageId','fti_mail_messages','plainBody','subject','FULLTEXT','body','fromString','get','direction','toLowerCase','out','secret','isNil','UserId','MailInteraction','findOne','then','createdAt','catch','utf8mb4','lodash','util'];(function(_0x4676eb,_0x79ea87){var _0x5c3c7e=function(_0x55e1f6){while(--_0x55e1f6){_0x4676eb['push'](_0x4676eb['shift']());}};_0x5c3c7e(++_0x79ea87);}(_0x1fa0,0x1ab));var _0x01fa=function(_0x145dce,_0x37c145){_0x145dce=_0x145dce-0x0;var _0x953e06=_0x1fa0[_0x145dce];return _0x953e06;};'use strict';var _=require(_0x01fa('0x0'));var util=require(_0x01fa('0x1'));var logger=require('../../config/logger')(_0x01fa('0x2'));var moment=require(_0x01fa('0x3'));var BPromise=require('bluebird');var rp=require(_0x01fa('0x4'));var htmlToText=require(_0x01fa('0x5'));var fs=require('fs');var path=require(_0x01fa('0x6'));var rimraf=require('rimraf');var config=require(_0x01fa('0x7'));var attributes=require(_0x01fa('0x8'));module[_0x01fa('0x9')]=function(_0x281a3d,_0x1da04b){return _0x281a3d[_0x01fa('0xa')](_0x01fa('0xb'),attributes,{'tableName':_0x01fa('0xc'),'paranoid':![],'indexes':[{'name':_0x01fa('0xd'),'fields':[_0x01fa('0xd')]},{'name':_0x01fa('0xe'),'fields':[_0x01fa('0xf'),_0x01fa('0x10')],'type':_0x01fa('0x11')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x5b040a,_0x40f9dc,_0x1d35b3){if(_0x5b040a[_0x01fa('0x12')]){_0x5b040a[_0x01fa('0xf')]=htmlToText[_0x01fa('0x13')](_0x5b040a[_0x01fa('0x12')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x1d35b3(null,_0x40f9dc);},'afterCreate':function(_0x352657,_0x295fc5,_0x10c1ac){var _0x492712=_0x281a3d['models'];var _0x34ad88=_0x352657[_0x01fa('0x14')]({'plain':!![]});if(_0x34ad88[_0x01fa('0x15')][_0x01fa('0x16')]()==='in'||_0x34ad88['direction'][_0x01fa('0x16')]()===_0x01fa('0x17')&&!_0x34ad88[_0x01fa('0x18')]&&!_[_0x01fa('0x19')](_0x34ad88[_0x01fa('0x1a')])){_0x492712[_0x01fa('0x1b')][_0x01fa('0x1c')]({'where':{'id':_0x34ad88['MailInteractionId']}})[_0x01fa('0x1d')](function(_0x7e0ecd){if(_0x7e0ecd){_0x7e0ecd['update']({'lastMsgAt':_0x34ad88[_0x01fa('0x1e')],'lastMsgDirection':_0x34ad88[_0x01fa('0x15')][_0x01fa('0x16')]()});}})[_0x01fa('0x1f')](function(_0x18a34c){console['error'](_0x18a34c);});}_0x10c1ac();}},'charset':_0x01fa('0x20'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xb6f8=['update','createdAt','catch','utf8mb4_unicode_ci','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailMessage.attributes','exports','define','MailMessage','mail_messages','messageId','fti_mail_messages','plainBody','FULLTEXT','body','fromString','models','get','direction','toLowerCase','out','secret','isNil','MailInteraction','MailInteractionId','then'];(function(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_0xb6f8,0x1b1));var _0x8b6f=function(_0x50d2db,_0x47481f){_0x50d2db=_0x50d2db-0x0;var _0x1c7e27=_0xb6f8[_0x50d2db];return _0x1c7e27;};'use strict';var _=require(_0x8b6f('0x0'));var util=require(_0x8b6f('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x8b6f('0x2'));var BPromise=require(_0x8b6f('0x3'));var rp=require(_0x8b6f('0x4'));var htmlToText=require('html-to-text');var fs=require('fs');var path=require(_0x8b6f('0x5'));var rimraf=require(_0x8b6f('0x6'));var config=require(_0x8b6f('0x7'));var attributes=require(_0x8b6f('0x8'));module[_0x8b6f('0x9')]=function(_0x355b90,_0x1096bd){return _0x355b90[_0x8b6f('0xa')](_0x8b6f('0xb'),attributes,{'tableName':_0x8b6f('0xc'),'paranoid':![],'indexes':[{'name':_0x8b6f('0xd'),'fields':['messageId']},{'name':_0x8b6f('0xe'),'fields':[_0x8b6f('0xf'),'subject'],'type':_0x8b6f('0x10')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x31984c,_0x1951ab,_0x4e5403){if(_0x31984c[_0x8b6f('0x11')]){_0x31984c['plainBody']=htmlToText[_0x8b6f('0x12')](_0x31984c[_0x8b6f('0x11')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x4e5403(null,_0x1951ab);},'afterCreate':function(_0x40f841,_0x5ad0a4,_0x53b2d1){var _0x7d696e=_0x355b90[_0x8b6f('0x13')];var _0x34bb07=_0x40f841[_0x8b6f('0x14')]({'plain':!![]});if(_0x34bb07[_0x8b6f('0x15')][_0x8b6f('0x16')]()==='in'||_0x34bb07[_0x8b6f('0x15')][_0x8b6f('0x16')]()===_0x8b6f('0x17')&&!_0x34bb07[_0x8b6f('0x18')]&&!_[_0x8b6f('0x19')](_0x34bb07['UserId'])){_0x7d696e[_0x8b6f('0x1a')]['findOne']({'where':{'id':_0x34bb07[_0x8b6f('0x1b')]}})[_0x8b6f('0x1c')](function(_0x3136d0){if(_0x3136d0){_0x3136d0[_0x8b6f('0x1d')]({'lastMsgAt':_0x34bb07[_0x8b6f('0x1e')],'lastMsgDirection':_0x34bb07[_0x8b6f('0x15')][_0x8b6f('0x16')]()});}})[_0x8b6f('0x1f')](function(_0x45a197){console['error'](_0x45a197);});}_0x53b2d1();}},'charset':'utf8mb4','collate':_0x8b6f('0x20')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index 865678f..da615e0 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 _0x84a0=['lodash','util','moment','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','client','http','redis','defaults','socket.io-emitter','./mailMessage.socket','register','request','then','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','MailMessage,\x20%s,\x20%s','message','info','result','catch','CreateMailMessage','MailMessage','create','body','options','raw'];(function(_0x25a02d,_0x43feed){var _0x194f14=function(_0x28568a){while(--_0x28568a){_0x25a02d['push'](_0x25a02d['shift']());}};_0x194f14(++_0x43feed);}(_0x84a0,0x66));var _0x084a=function(_0x28378a,_0x32a231){_0x28378a=_0x28378a-0x0;var _0x35fa9b=_0x84a0[_0x28378a];return _0x35fa9b;};'use strict';var _=require(_0x084a('0x0'));var util=require(_0x084a('0x1'));var moment=require(_0x084a('0x2'));var BPromise=require(_0x084a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x084a('0x4'));var db=require(_0x084a('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x084a('0x6'));var config=require(_0x084a('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x084a('0x8')][_0x084a('0x9')]({'port':0x232a});config[_0x084a('0xa')]=_[_0x084a('0xb')](config[_0x084a('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x084a('0xc'))(new Redis(config[_0x084a('0xa')]));require(_0x084a('0xd'))[_0x084a('0xe')](socket);function respondWithRpcPromise(_0x142127,_0x4c1e29,_0x4dd423){return new BPromise(function(_0x3d9dc6,_0x853df){return client[_0x084a('0xf')](_0x142127,_0x4dd423)[_0x084a('0x10')](function(_0x2d7c90){logger['info']('MailMessage,\x20%s,\x20%s',_0x4c1e29,_0x084a('0x11'));logger[_0x084a('0x12')](_0x084a('0x13'),_0x4c1e29,_0x084a('0x11'),JSON[_0x084a('0x14')](_0x2d7c90));if(_0x2d7c90[_0x084a('0x15')]){if(_0x2d7c90[_0x084a('0x15')][_0x084a('0x16')]===0x1f4){logger['error'](_0x084a('0x17'),_0x4c1e29,_0x2d7c90['error'][_0x084a('0x18')]);return _0x853df(_0x2d7c90[_0x084a('0x15')][_0x084a('0x18')]);}logger[_0x084a('0x15')](_0x084a('0x17'),_0x4c1e29,_0x2d7c90['error'][_0x084a('0x18')]);return _0x3d9dc6(_0x2d7c90['error'][_0x084a('0x18')]);}else{logger[_0x084a('0x19')]('MailMessage,\x20%s,\x20%s',_0x4c1e29,_0x084a('0x11'));_0x3d9dc6(_0x2d7c90[_0x084a('0x1a')][_0x084a('0x18')]);}})[_0x084a('0x1b')](function(_0x33d3a6){logger[_0x084a('0x15')](_0x084a('0x17'),_0x4c1e29,_0x33d3a6);_0x853df(_0x33d3a6);});});}exports[_0x084a('0x1c')]=function(_0x3f60cf){var _0xcb5356=this;return new Promise(function(_0x3c7fd6,_0x279e25){return db[_0x084a('0x1d')][_0x084a('0x1e')](_0x3f60cf[_0x084a('0x1f')],{'raw':_0x3f60cf['options']?_0x3f60cf[_0x084a('0x20')][_0x084a('0x21')]===undefined?!![]:![]:!![]})[_0x084a('0x10')](function(_0x2d62bf){logger[_0x084a('0x19')]('CreateMailMessage',_0x3f60cf);logger[_0x084a('0x12')](_0x084a('0x1c'),_0x3f60cf,JSON[_0x084a('0x14')](_0x2d62bf));_0x3c7fd6(_0x2d62bf);})[_0x084a('0x1b')](function(_0x18b43d){logger[_0x084a('0x15')]('CreateMailMessage',_0x18b43d[_0x084a('0x18')],_0x3f60cf);_0x279e25(_0xcb5356[_0x084a('0x15')](0x1f4,_0x18b43d[_0x084a('0x18')]));});});}; \ No newline at end of file +var _0x958a=['./mailMessage.socket','register','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','CreateMailMessage','MailMessage','create','body','options','raw','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','redis','defaults','localhost'];(function(_0x6bb117,_0x9d9b9e){var _0x447b9b=function(_0x1ba04f){while(--_0x1ba04f){_0x6bb117['push'](_0x6bb117['shift']());}};_0x447b9b(++_0x9d9b9e);}(_0x958a,0x128));var _0xa958=function(_0x48ed09,_0x191b1f){_0x48ed09=_0x48ed09-0x0;var _0x3d3e63=_0x958a[_0x48ed09];return _0x3d3e63;};'use strict';var _=require(_0xa958('0x0'));var util=require(_0xa958('0x1'));var moment=require('moment');var BPromise=require(_0xa958('0x2'));var rs=require(_0xa958('0x3'));var fs=require('fs');var Redis=require(_0xa958('0x4'));var db=require(_0xa958('0x5'))['db'];var utils=require(_0xa958('0x6'));var logger=require('../../config/logger')(_0xa958('0x7'));var config=require('../../config/environment');var jayson=require(_0xa958('0x8'));var client=jayson[_0xa958('0x9')][_0xa958('0xa')]({'port':0x232a});config[_0xa958('0xb')]=_[_0xa958('0xc')](config[_0xa958('0xb')],{'host':_0xa958('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xa958('0xe'))[_0xa958('0xf')](socket);function respondWithRpcPromise(_0x11f090,_0x44b66e,_0x37afa0){return new BPromise(function(_0x94caac,_0xebb1c6){return client[_0xa958('0x10')](_0x11f090,_0x37afa0)[_0xa958('0x11')](function(_0x250999){logger[_0xa958('0x12')](_0xa958('0x13'),_0x44b66e,_0xa958('0x14'));logger['debug']('MailMessage,\x20%s,\x20%s,\x20%s',_0x44b66e,'request\x20sent',JSON[_0xa958('0x15')](_0x250999));if(_0x250999[_0xa958('0x16')]){if(_0x250999[_0xa958('0x16')]['code']===0x1f4){logger[_0xa958('0x16')]('MailMessage,\x20%s,\x20%s',_0x44b66e,_0x250999['error']['message']);return _0xebb1c6(_0x250999[_0xa958('0x16')][_0xa958('0x17')]);}logger[_0xa958('0x16')](_0xa958('0x13'),_0x44b66e,_0x250999[_0xa958('0x16')][_0xa958('0x17')]);return _0x94caac(_0x250999[_0xa958('0x16')][_0xa958('0x17')]);}else{logger['info'](_0xa958('0x13'),_0x44b66e,'request\x20sent');_0x94caac(_0x250999[_0xa958('0x18')][_0xa958('0x17')]);}})['catch'](function(_0xe4129a){logger[_0xa958('0x16')](_0xa958('0x13'),_0x44b66e,_0xe4129a);_0xebb1c6(_0xe4129a);});});}exports[_0xa958('0x19')]=function(_0x2759ad){var _0x1f82aa=this;return new Promise(function(_0x56314b,_0x4a90c2){return db[_0xa958('0x1a')][_0xa958('0x1b')](_0x2759ad[_0xa958('0x1c')],{'raw':_0x2759ad['options']?_0x2759ad[_0xa958('0x1d')][_0xa958('0x1e')]===undefined?!![]:![]:!![]})['then'](function(_0x28cf12){logger[_0xa958('0x12')]('CreateMailMessage',_0x2759ad);logger['debug'](_0xa958('0x19'),_0x2759ad,JSON[_0xa958('0x15')](_0x28cf12));_0x56314b(_0x28cf12);})['catch'](function(_0x25f461){logger[_0xa958('0x16')](_0xa958('0x19'),_0x25f461[_0xa958('0x17')],_0x2759ad);_0x4a90c2(_0x1f82aa[_0xa958('0x16')](0x1f4,_0x25f461[_0xa958('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index aaed152..cd161fd 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 _0xc52f=['./mailMessage.events','save','emit','removeListener','register','length','mailMessage:'];(function(_0xec3464,_0x25a279){var _0x42acd1=function(_0x5ff459){while(--_0x5ff459){_0xec3464['push'](_0xec3464['shift']());}};_0x42acd1(++_0x25a279);}(_0xc52f,0x1e3));var _0xfc52=function(_0x37cdc4,_0x1ece4b){_0x37cdc4=_0x37cdc4-0x0;var _0x592f56=_0xc52f[_0x37cdc4];return _0x592f56;};'use strict';var MailMessageEvents=require(_0xfc52('0x0'));var events=[_0xfc52('0x1'),'remove','update'];function createListener(_0x5b9c7e,_0x456d46){return function(_0x3a87f5){_0x456d46[_0xfc52('0x2')](_0x5b9c7e,_0x3a87f5);};}function removeListener(_0x503940,_0x5e4f8e){return function(){MailMessageEvents[_0xfc52('0x3')](_0x503940,_0x5e4f8e);};}exports[_0xfc52('0x4')]=function(_0x29636f){for(var _0x5cb478=0x0,_0x2854c4=events[_0xfc52('0x5')];_0x5cb478<_0x2854c4;_0x5cb478++){var _0x896e9f=events[_0x5cb478];var _0x275905=createListener(_0xfc52('0x6')+_0x896e9f,_0x29636f);MailMessageEvents['on'](_0x896e9f,_0x275905);}}; \ No newline at end of file +var _0x407c=['./mailMessage.events','remove','update','emit','removeListener','register','length','mailMessage:'];(function(_0x9c21ca,_0x209edd){var _0x1f3e7d=function(_0x22272d){while(--_0x22272d){_0x9c21ca['push'](_0x9c21ca['shift']());}};_0x1f3e7d(++_0x209edd);}(_0x407c,0x68));var _0xc407=function(_0x1bed11,_0x32a62e){_0x1bed11=_0x1bed11-0x0;var _0x4c324d=_0x407c[_0x1bed11];return _0x4c324d;};'use strict';var MailMessageEvents=require(_0xc407('0x0'));var events=['save',_0xc407('0x1'),_0xc407('0x2')];function createListener(_0x36c439,_0xfe243a){return function(_0x323982){_0xfe243a[_0xc407('0x3')](_0x36c439,_0x323982);};}function removeListener(_0x516d5d,_0xc3c51){return function(){MailMessageEvents[_0xc407('0x4')](_0x516d5d,_0xc3c51);};}exports[_0xc407('0x5')]=function(_0x556cf3){for(var _0x470eaa=0x0,_0x4f0cfc=events[_0xc407('0x6')];_0x470eaa<_0x4f0cfc;_0x470eaa++){var _0x54746d=events[_0x470eaa];var _0x5a47dc=createListener(_0xc407('0x7')+_0x54746d,_0x556cf3);MailMessageEvents['on'](_0x54746d,_0x5a47dc);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index 0a43aee..f8c1341 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 _0x03ba=['describe','/:id','show','/:id/members','getMembers','isAuthenticated','getTeams','/:id/users','getAgents','post','create','/:id/teams','addTeams','addAgents','put','update','delete','destroy','removeTeams','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailQueue.controller','get','/describe'];(function(_0x28f7a9,_0x35969b){var _0xe19eab=function(_0x31eb8d){while(--_0x31eb8d){_0x28f7a9['push'](_0x28f7a9['shift']());}};_0xe19eab(++_0x35969b);}(_0x03ba,0x74));var _0xa03b=function(_0x3108c8,_0x34259a){_0x3108c8=_0x3108c8-0x0;var _0x405ff3=_0x03ba[_0x3108c8];return _0x405ff3;};'use strict';var multer=require(_0xa03b('0x0'));var util=require(_0xa03b('0x1'));var path=require(_0xa03b('0x2'));var timeout=require(_0xa03b('0x3'));var express=require(_0xa03b('0x4'));var router=express[_0xa03b('0x5')]();var fs_extra=require(_0xa03b('0x6'));var auth=require(_0xa03b('0x7'));var interaction=require(_0xa03b('0x8'));var config=require('../../config/environment');var controller=require(_0xa03b('0x9'));router[_0xa03b('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0xa03b('0xa')](_0xa03b('0xb'),auth['isAuthenticated'](),controller[_0xa03b('0xc')]);router[_0xa03b('0xa')](_0xa03b('0xd'),auth['isAuthenticated'](),controller[_0xa03b('0xe')]);router[_0xa03b('0xa')](_0xa03b('0xf'),auth['isAuthenticated'](),controller[_0xa03b('0x10')]);router[_0xa03b('0xa')]('/:id/teams',auth[_0xa03b('0x11')](),controller[_0xa03b('0x12')]);router['get'](_0xa03b('0x13'),auth[_0xa03b('0x11')](),controller[_0xa03b('0x14')]);router[_0xa03b('0x15')]('/',auth[_0xa03b('0x11')](),controller[_0xa03b('0x16')]);router[_0xa03b('0x15')](_0xa03b('0x17'),auth[_0xa03b('0x11')](),controller[_0xa03b('0x18')]);router[_0xa03b('0x15')]('/:id/users',auth[_0xa03b('0x11')](),controller[_0xa03b('0x19')]);router[_0xa03b('0x1a')](_0xa03b('0xd'),auth['isAuthenticated'](),controller[_0xa03b('0x1b')]);router[_0xa03b('0x1c')](_0xa03b('0xd'),auth['isAuthenticated'](),controller[_0xa03b('0x1d')]);router[_0xa03b('0x1c')]('/:id/teams',auth[_0xa03b('0x11')](),controller[_0xa03b('0x1e')]);router[_0xa03b('0x1c')]('/:id/users',auth[_0xa03b('0x11')](),controller['removeAgents']);module[_0xa03b('0x1f')]=router; \ No newline at end of file +var _0xa27b=['/:id','show','/:id/members','getMembers','/:id/teams','getTeams','getAgents','post','create','addTeams','/:id/users','addAgents','put','update','delete','removeTeams','util','connect-timeout','Router','fs-extra','./mailQueue.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x1096f4,_0x280cb5){var _0x2aaf97=function(_0x20900a){while(--_0x20900a){_0x1096f4['push'](_0x1096f4['shift']());}};_0x2aaf97(++_0x280cb5);}(_0xa27b,0xac));var _0xba27=function(_0x740688,_0x120a4c){_0x740688=_0x740688-0x0;var _0x274495=_0xa27b[_0x740688];return _0x274495;};'use strict';var multer=require('multer');var util=require(_0xba27('0x0'));var path=require('path');var timeout=require(_0xba27('0x1'));var express=require('express');var router=express[_0xba27('0x2')]();var fs_extra=require(_0xba27('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xba27('0x4'));router[_0xba27('0x5')]('/',auth[_0xba27('0x6')](),controller[_0xba27('0x7')]);router[_0xba27('0x5')](_0xba27('0x8'),auth[_0xba27('0x6')](),controller[_0xba27('0x9')]);router[_0xba27('0x5')](_0xba27('0xa'),auth[_0xba27('0x6')](),controller[_0xba27('0xb')]);router['get'](_0xba27('0xc'),auth[_0xba27('0x6')](),controller[_0xba27('0xd')]);router[_0xba27('0x5')](_0xba27('0xe'),auth[_0xba27('0x6')](),controller[_0xba27('0xf')]);router[_0xba27('0x5')]('/:id/users',auth[_0xba27('0x6')](),controller[_0xba27('0x10')]);router[_0xba27('0x11')]('/',auth[_0xba27('0x6')](),controller[_0xba27('0x12')]);router[_0xba27('0x11')](_0xba27('0xe'),auth[_0xba27('0x6')](),controller[_0xba27('0x13')]);router[_0xba27('0x11')](_0xba27('0x14'),auth[_0xba27('0x6')](),controller[_0xba27('0x15')]);router[_0xba27('0x16')](_0xba27('0xa'),auth[_0xba27('0x6')](),controller[_0xba27('0x17')]);router[_0xba27('0x18')](_0xba27('0xa'),auth[_0xba27('0x6')](),controller['destroy']);router[_0xba27('0x18')]('/:id/teams',auth['isAuthenticated'](),controller[_0xba27('0x19')]);router[_0xba27('0x18')](_0xba27('0x14'),auth['isAuthenticated'](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index 8ab1af1..345b5a5 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 _0x332b=['STRING','name','INTEGER','ENUM','rrmemory','beepall','roundrobin','exports'];(function(_0x3a07c5,_0xd0fbb){var _0x51170d=function(_0x3670ad){while(--_0x3670ad){_0x3a07c5['push'](_0x3a07c5['shift']());}};_0x51170d(++_0xd0fbb);}(_0x332b,0x17f));var _0xb332=function(_0x39e392,_0xe666eb){_0x39e392=_0x39e392-0x0;var _0x7b803a=_0x332b[_0x39e392];return _0x7b803a;};'use strict';var Sequelize=require('sequelize');module[_0xb332('0x0')]={'name':{'type':Sequelize[_0xb332('0x1')],'unique':_0xb332('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xb332('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xb332('0x4')](_0xb332('0x5'),_0xb332('0x6'),_0xb332('0x7'))}}; \ No newline at end of file +var _0x5140=['name','INTEGER','ENUM','beepall','STRING'];(function(_0x2f3ecd,_0x57976b){var _0xffdc44=function(_0xf21bc6){while(--_0xf21bc6){_0x2f3ecd['push'](_0x2f3ecd['shift']());}};_0xffdc44(++_0x57976b);}(_0x5140,0x1b7));var _0x0514=function(_0x48d0ce,_0x3d725e){_0x48d0ce=_0x48d0ce-0x0;var _0x255f6d=_0x5140[_0x48d0ce];return _0x255f6d;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x0514('0x0')],'unique':_0x0514('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x0514('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x0514('0x3')]('rrmemory',_0x0514('0x4'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index 7357817..9d1c5d1 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 _0xd596=['mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','then','destroy','get','UserProfileResource','stack','name','index','MailQueue','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','length','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','MailQueues','find','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','findOne','UserMailQueue','MailQueueId','findAll','User','UserId','agent','mailPause','updatedAt','createdAt','format','%s/%s','SIP','Team','getTeams','addTeams','ids','online','interface','flatMap','sequelize','forEach','emit','removeTeams','Agents','select','from','team_has_mail_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','QueryTypes','SELECT','TeamId','all','value','isEmpty','removeAgents','userMailQueue:remove','addAgents','omit','userMailQueue:save','isArray','getAgents','eml-format','rimraf','fast-json-patch','moment','bluebird'];(function(_0x3bd53e,_0x456399){var _0x42797c=function(_0x284c93){while(--_0x284c93){_0x3bd53e['push'](_0x3bd53e['shift']());}};_0x42797c(++_0x456399);}(_0xd596,0x199));var _0x6d59=function(_0x22f8ab,_0x15d8ff){_0x22f8ab=_0x22f8ab-0x0;var _0x2a70e5=_0xd596[_0x22f8ab];return _0x2a70e5;};'use strict';var emlformat=require(_0x6d59('0x0'));var rimraf=require(_0x6d59('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6d59('0x2'));var rp=require('request-promise');var moment=require(_0x6d59('0x3'));var BPromise=require(_0x6d59('0x4'));var Mustache=require(_0x6d59('0x5'));var util=require(_0x6d59('0x6'));var path=require(_0x6d59('0x7'));var sox=require(_0x6d59('0x8'));var csv=require(_0x6d59('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6d59('0xa'));var squel=require(_0x6d59('0xb'));var crypto=require(_0x6d59('0xc'));var jsforce=require(_0x6d59('0xd'));var deskjs=require(_0x6d59('0xe'));var toCsv=require(_0x6d59('0x9'));var querystring=require(_0x6d59('0xf'));var Papa=require(_0x6d59('0x10'));var Redis=require(_0x6d59('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x6d59('0x12'));var as=require(_0x6d59('0x13'));var hardwareService=require(_0x6d59('0x14'));var logger=require('../../config/logger')(_0x6d59('0x15'));var utils=require(_0x6d59('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x6d59('0x17'));var db=require(_0x6d59('0x18'))['db'];config[_0x6d59('0x19')]=_[_0x6d59('0x1a')](config[_0x6d59('0x19')],{'host':_0x6d59('0x1b'),'port':0x18eb});var socket=require(_0x6d59('0x1c'))(new Redis(config[_0x6d59('0x19')]));require('./mailQueue.socket')['register'](socket);function respondWithStatusCode(_0x4de6c9,_0x20c84b){_0x20c84b=_0x20c84b||0xcc;return function(_0x5e7ed2){if(_0x5e7ed2){return _0x4de6c9[_0x6d59('0x1d')](_0x20c84b);}return _0x4de6c9[_0x6d59('0x1e')](_0x20c84b)[_0x6d59('0x1f')]();};}function respondWithResult(_0x7c743e,_0x3af844){_0x3af844=_0x3af844||0xc8;return function(_0x5a2d37){if(_0x5a2d37){return _0x7c743e['status'](_0x3af844)[_0x6d59('0x20')](_0x5a2d37);}};}function respondWithFilteredResult(_0x2fca74,_0x3fc176){return function(_0x50b4d9){if(_0x50b4d9){var _0x2914ea=typeof _0x3fc176[_0x6d59('0x21')]==='undefined'&&typeof _0x3fc176[_0x6d59('0x22')]===_0x6d59('0x23');var _0x540f93=_0x50b4d9[_0x6d59('0x24')];var _0x1b0648=_0x2914ea?0x0:_0x3fc176[_0x6d59('0x21')];var _0x216a83=_0x2914ea?_0x50b4d9[_0x6d59('0x24')]:_0x3fc176[_0x6d59('0x21')]+_0x3fc176[_0x6d59('0x22')];var _0xb74b02;if(_0x216a83>=_0x540f93){_0x216a83=_0x540f93;_0xb74b02=0xc8;}else{_0xb74b02=0xce;}_0x2fca74[_0x6d59('0x1e')](_0xb74b02);return _0x2fca74[_0x6d59('0x25')](_0x6d59('0x26'),_0x1b0648+'-'+_0x216a83+'/'+_0x540f93)[_0x6d59('0x20')](_0x50b4d9);}return null;};}function patchUpdates(_0x34db7d){return function(_0x52e35d){try{jsonpatch[_0x6d59('0x27')](_0x52e35d,_0x34db7d,!![]);}catch(_0x32995d){return BPromise[_0x6d59('0x28')](_0x32995d);}return _0x52e35d['save']();};}function saveUpdates(_0xd98725,_0xb5e377){return function(_0x4bef63){if(_0x4bef63){return _0x4bef63[_0x6d59('0x29')](_0xd98725)[_0x6d59('0x2a')](function(_0x30814d){return _0x30814d;});}return null;};}function removeEntity(_0x5a1782,_0x474597){return function(_0x19d683){if(_0x19d683){return _0x19d683[_0x6d59('0x2b')]()[_0x6d59('0x2a')](function(){var _0x1d1ec7=_0x19d683[_0x6d59('0x2c')]({'plain':!![]});var _0xfd0948='MailQueues';return db[_0x6d59('0x2d')][_0x6d59('0x2b')]({'where':{'type':_0xfd0948,'resourceId':_0x1d1ec7['id']}})[_0x6d59('0x2a')](function(){return _0x19d683;});})[_0x6d59('0x2a')](function(){_0x5a1782[_0x6d59('0x1e')](0xcc)[_0x6d59('0x1f')]();});}};}function handleEntityNotFound(_0x488dc2,_0x267b00){return function(_0x491d4f){if(!_0x491d4f){_0x488dc2[_0x6d59('0x1d')](0x194);}return _0x491d4f;};}function handleError(_0x204c92,_0x423b97){_0x423b97=_0x423b97||0x1f4;return function(_0x37609f){logger['error'](_0x37609f[_0x6d59('0x2e')]);if(_0x37609f[_0x6d59('0x2f')]){delete _0x37609f['name'];}_0x204c92[_0x6d59('0x1e')](_0x423b97)['send'](_0x37609f);};}exports[_0x6d59('0x30')]=function(_0x4ec179,_0x56671f){var _0x4b57e9={},_0x30e143={},_0x5960f9={'count':0x0,'rows':[]};var _0x598240=_['map'](db[_0x6d59('0x31')][_0x6d59('0x32')],function(_0x44acda){return{'name':_0x44acda[_0x6d59('0x33')],'type':_0x44acda[_0x6d59('0x34')][_0x6d59('0x35')]};});_0x30e143[_0x6d59('0x36')]=_[_0x6d59('0x37')](_0x598240,_0x6d59('0x2f'));_0x30e143[_0x6d59('0x38')]=_[_0x6d59('0x39')](_0x4ec179[_0x6d59('0x38')]);_0x30e143['filters']=_[_0x6d59('0x3a')](_0x30e143[_0x6d59('0x36')],_0x30e143['query']);_0x4b57e9[_0x6d59('0x3b')]=_[_0x6d59('0x3a')](_0x30e143[_0x6d59('0x36')],qs[_0x6d59('0x3c')](_0x4ec179['query'][_0x6d59('0x3c')]));_0x4b57e9[_0x6d59('0x3b')]=_0x4b57e9['attributes']['length']?_0x4b57e9[_0x6d59('0x3b')]:_0x30e143[_0x6d59('0x36')];if(!_0x4ec179[_0x6d59('0x38')][_0x6d59('0x3d')](_0x6d59('0x3e'))){_0x4b57e9[_0x6d59('0x22')]=qs[_0x6d59('0x22')](_0x4ec179[_0x6d59('0x38')][_0x6d59('0x22')]);_0x4b57e9[_0x6d59('0x21')]=qs[_0x6d59('0x21')](_0x4ec179[_0x6d59('0x38')]['offset']);}_0x4b57e9[_0x6d59('0x3f')]=qs[_0x6d59('0x40')](_0x4ec179['query']['sort']);_0x4b57e9[_0x6d59('0x41')]=qs[_0x6d59('0x42')](_[_0x6d59('0x43')](_0x4ec179[_0x6d59('0x38')],_0x30e143[_0x6d59('0x42')]),_0x598240);if(_0x4ec179['query'][_0x6d59('0x44')]){_0x4b57e9[_0x6d59('0x41')]=_[_0x6d59('0x45')](_0x4b57e9[_0x6d59('0x41')],{'$or':_['map'](_0x598240,function(_0x34dec3){if(_0x34dec3[_0x6d59('0x34')]!==_0x6d59('0x46')){var _0x2c53f9={};_0x2c53f9[_0x34dec3[_0x6d59('0x2f')]]={'$like':'%'+_0x4ec179[_0x6d59('0x38')][_0x6d59('0x44')]+'%'};return _0x2c53f9;}})});}_0x4b57e9=_['merge']({},_0x4b57e9,_0x4ec179[_0x6d59('0x47')]);var _0x5d7e77={'where':_0x4b57e9[_0x6d59('0x41')]};return db[_0x6d59('0x31')][_0x6d59('0x24')](_0x5d7e77)['then'](function(_0x27ffa5){_0x5960f9[_0x6d59('0x24')]=_0x27ffa5;if(_0x4ec179[_0x6d59('0x38')][_0x6d59('0x48')]){_0x4b57e9[_0x6d59('0x49')]=[{'all':!![]}];}return db[_0x6d59('0x31')]['findAll'](_0x4b57e9);})[_0x6d59('0x2a')](function(_0x23a1f4){_0x5960f9[_0x6d59('0x4a')]=_0x23a1f4;return _0x5960f9;})[_0x6d59('0x2a')](respondWithFilteredResult(_0x56671f,_0x4b57e9))[_0x6d59('0x4b')](handleError(_0x56671f,null));};exports[_0x6d59('0x4c')]=function(_0xfa45e6,_0x1dd760){var _0x417419={'raw':!![],'where':{'id':_0xfa45e6[_0x6d59('0x4d')]['id']}},_0x4165c7={};_0x4165c7[_0x6d59('0x36')]=_['keys'](db['MailQueue'][_0x6d59('0x32')]);_0x4165c7[_0x6d59('0x38')]=_[_0x6d59('0x39')](_0xfa45e6[_0x6d59('0x38')]);_0x4165c7[_0x6d59('0x42')]=_[_0x6d59('0x3a')](_0x4165c7['model'],_0x4165c7['query']);_0x417419[_0x6d59('0x3b')]=_[_0x6d59('0x3a')](_0x4165c7[_0x6d59('0x36')],qs[_0x6d59('0x3c')](_0xfa45e6[_0x6d59('0x38')][_0x6d59('0x3c')]));_0x417419['attributes']=_0x417419[_0x6d59('0x3b')][_0x6d59('0x4e')]?_0x417419[_0x6d59('0x3b')]:_0x4165c7['model'];if(_0xfa45e6['query'][_0x6d59('0x48')]){_0x417419[_0x6d59('0x49')]=[{'all':!![]}];}_0x417419=_['merge']({},_0x417419,_0xfa45e6[_0x6d59('0x47')]);return db[_0x6d59('0x31')]['find'](_0x417419)[_0x6d59('0x2a')](handleEntityNotFound(_0x1dd760,null))[_0x6d59('0x2a')](respondWithResult(_0x1dd760,null))[_0x6d59('0x4b')](handleError(_0x1dd760,null));};exports[_0x6d59('0x4f')]=function(_0xdf594a,_0x363e9b){return db[_0x6d59('0x31')][_0x6d59('0x4f')](_0xdf594a['body'],{})[_0x6d59('0x2a')](function(_0x358870){var _0x583df8=_0xdf594a[_0x6d59('0x50')][_0x6d59('0x2c')]({'plain':!![]});if(!_0x583df8)throw new Error(_0x6d59('0x51'));if(_0x583df8[_0x6d59('0x52')]===_0x6d59('0x50')){var _0xc9db7b=_0x358870['get']({'plain':!![]});var _0x20801e=_0x6d59('0x53');return db['UserProfileSection'][_0x6d59('0x54')]({'where':{'name':_0x20801e,'userProfileId':_0x583df8[_0x6d59('0x55')]},'raw':!![]})['then'](function(_0x302371){if(_0x302371&&_0x302371['autoAssociation']===0x0){return db[_0x6d59('0x2d')][_0x6d59('0x4f')]({'name':_0xc9db7b['name'],'resourceId':_0xc9db7b['id'],'type':_0x302371[_0x6d59('0x2f')],'sectionId':_0x302371['id']},{})['then'](function(){return _0x358870;});}else{return _0x358870;}})[_0x6d59('0x4b')](function(_0x2b9ed1){logger[_0x6d59('0x56')](_0x6d59('0x57'),_0x2b9ed1);throw _0x2b9ed1;});}return _0x358870;})['then'](respondWithResult(_0x363e9b,0xc9))[_0x6d59('0x4b')](handleError(_0x363e9b,null));};exports[_0x6d59('0x29')]=function(_0x5c0aa1,_0x4a3020){if(_0x5c0aa1[_0x6d59('0x58')]['id']){delete _0x5c0aa1[_0x6d59('0x58')]['id'];}return db[_0x6d59('0x31')][_0x6d59('0x54')]({'where':{'id':_0x5c0aa1['params']['id']}})[_0x6d59('0x2a')](handleEntityNotFound(_0x4a3020,null))[_0x6d59('0x2a')](saveUpdates(_0x5c0aa1['body'],null))[_0x6d59('0x2a')](respondWithResult(_0x4a3020,null))[_0x6d59('0x4b')](handleError(_0x4a3020,null));};exports[_0x6d59('0x2b')]=function(_0x130726,_0x30ee9e){return db[_0x6d59('0x31')][_0x6d59('0x54')]({'where':{'id':_0x130726[_0x6d59('0x4d')]['id']}})[_0x6d59('0x2a')](handleEntityNotFound(_0x30ee9e,null))[_0x6d59('0x2a')](removeEntity(_0x30ee9e,null))[_0x6d59('0x4b')](handleError(_0x30ee9e,null));};exports[_0x6d59('0x59')]=function(_0x4a016f,_0x28ea97){return db['MailQueue'][_0x6d59('0x59')]()[_0x6d59('0x2a')](respondWithResult(_0x28ea97,null))[_0x6d59('0x4b')](handleError(_0x28ea97,null));};exports[_0x6d59('0x5a')]=function(_0x5e9fff,_0xc19474,_0x3b2410){var _0x52939e={'raw':!![],'where':{}},_0x2d3c3d={},_0x318cbf;return db['MailQueue'][_0x6d59('0x5b')]({'where':{'id':_0x5e9fff[_0x6d59('0x4d')]['id']}})['then'](handleEntityNotFound(_0xc19474,null))[_0x6d59('0x2a')](function(_0x5d7a29){if(_0x5d7a29){_0x318cbf=_0x5d7a29[_0x6d59('0x2c')]({'plain':!![]});_0x2d3c3d['model']=_[_0x6d59('0x39')](db[_0x6d59('0x5c')][_0x6d59('0x32')]);_0x2d3c3d[_0x6d59('0x38')]=_[_0x6d59('0x39')](_0x5e9fff[_0x6d59('0x38')]);_0x2d3c3d[_0x6d59('0x42')]=_[_0x6d59('0x3a')](_0x2d3c3d[_0x6d59('0x36')],_0x2d3c3d[_0x6d59('0x38')]);_0x52939e['attributes']=_[_0x6d59('0x3a')](_0x2d3c3d[_0x6d59('0x36')],qs[_0x6d59('0x3c')](_0x5e9fff[_0x6d59('0x38')]['fields']));_0x52939e[_0x6d59('0x3b')]=_0x52939e[_0x6d59('0x3b')][_0x6d59('0x4e')]?_0x52939e[_0x6d59('0x3b')]:_0x2d3c3d[_0x6d59('0x36')];if(!_0x5e9fff[_0x6d59('0x38')]['hasOwnProperty'](_0x6d59('0x3e'))){_0x52939e[_0x6d59('0x22')]=qs[_0x6d59('0x22')](_0x5e9fff[_0x6d59('0x38')][_0x6d59('0x22')]);_0x52939e[_0x6d59('0x21')]=qs['offset'](_0x5e9fff[_0x6d59('0x38')]['offset']);}_0x52939e[_0x6d59('0x3f')]=qs[_0x6d59('0x40')](_0x5e9fff[_0x6d59('0x38')]['sort']);_0x52939e['where']=qs['filters'](_[_0x6d59('0x43')](_0x5e9fff[_0x6d59('0x38')],_0x2d3c3d['filters']));_0x52939e[_0x6d59('0x41')][_0x6d59('0x5d')]=_0x5d7a29['id'];if(_0x5e9fff[_0x6d59('0x38')][_0x6d59('0x44')]){_0x52939e[_0x6d59('0x41')]=_[_0x6d59('0x45')](_0x52939e[_0x6d59('0x41')],{'$or':_[_0x6d59('0x37')](_0x52939e[_0x6d59('0x3b')],function(_0x41a835){var _0x5ee5b9={};_0x5ee5b9[_0x41a835]={'$like':'%'+_0x5e9fff[_0x6d59('0x38')][_0x6d59('0x44')]+'%'};return _0x5ee5b9;})});}_0x52939e=_[_0x6d59('0x45')]({},_0x52939e,_0x5e9fff[_0x6d59('0x47')]);return db[_0x6d59('0x5c')][_0x6d59('0x5e')](_0x52939e);}})[_0x6d59('0x2a')](function(_0x54f143){if(_0x54f143){return db[_0x6d59('0x5f')]['findAndCountAll']({'where':{'id':_['map'](_0x54f143,_0x6d59('0x60')),'role':_0x6d59('0x61')},'attributes':['id',_0x6d59('0x2f'),_0x6d59('0x62'),_0x6d59('0x63'),_0x6d59('0x64')]});}})['then'](function(_0x49cbde){if(_0x49cbde){return{'count':_0x49cbde[_0x6d59('0x24')],'rows':_[_0x6d59('0x37')](_0x49cbde[_0x6d59('0x4a')],function(_0x2b6dc1){return{'membername':_0x2b6dc1[_0x6d59('0x2f')],'UserId':_0x2b6dc1['id'],'queue_name':_0x318cbf[_0x6d59('0x2f')],'MailQueueId':_0x318cbf['id'],'interface':util[_0x6d59('0x65')](_0x6d59('0x66'),_0x6d59('0x67'),_0x2b6dc1[_0x6d59('0x2f')]),'penalty':0x0,'paused':_0x2b6dc1[_0x6d59('0x62')],'createdAt':_0x2b6dc1[_0x6d59('0x64')],'updatedAt':_0x2b6dc1['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x6d59('0x2a')](respondWithFilteredResult(_0xc19474,_0x52939e))[_0x6d59('0x4b')](handleError(_0xc19474,null));};exports['getTeams']=function(_0x2aa94b,_0x2113b7,_0xa59c49){var _0x5cd53c={};var _0x164447={};var _0x498b52;var _0x311637;return db['MailQueue'][_0x6d59('0x5b')]({'where':{'id':_0x2aa94b[_0x6d59('0x4d')]['id']}})[_0x6d59('0x2a')](handleEntityNotFound(_0x2113b7,null))[_0x6d59('0x2a')](function(_0x138bc7){if(_0x138bc7){_0x498b52=_0x138bc7;_0x164447[_0x6d59('0x36')]=_[_0x6d59('0x39')](db[_0x6d59('0x68')][_0x6d59('0x32')]);_0x164447[_0x6d59('0x38')]=_[_0x6d59('0x39')](_0x2aa94b[_0x6d59('0x38')]);_0x164447[_0x6d59('0x42')]=_[_0x6d59('0x3a')](_0x164447[_0x6d59('0x36')],_0x164447[_0x6d59('0x38')]);_0x5cd53c['attributes']=_[_0x6d59('0x3a')](_0x164447[_0x6d59('0x36')],qs['fields'](_0x2aa94b[_0x6d59('0x38')][_0x6d59('0x3c')]));_0x5cd53c[_0x6d59('0x3b')]=_0x5cd53c['attributes'][_0x6d59('0x4e')]?_0x5cd53c[_0x6d59('0x3b')]:_0x164447[_0x6d59('0x36')];_0x5cd53c['order']=qs[_0x6d59('0x40')](_0x2aa94b[_0x6d59('0x38')][_0x6d59('0x40')]);_0x5cd53c[_0x6d59('0x41')]=qs[_0x6d59('0x42')](_['pick'](_0x2aa94b[_0x6d59('0x38')],_0x164447[_0x6d59('0x42')]));if(_0x2aa94b[_0x6d59('0x38')]['filter']){_0x5cd53c[_0x6d59('0x41')]=_[_0x6d59('0x45')](_0x5cd53c[_0x6d59('0x41')],{'$or':_[_0x6d59('0x37')](_0x5cd53c[_0x6d59('0x3b')],function(_0x5b2bd0){var _0x2b17e8={};_0x2b17e8[_0x5b2bd0]={'$like':'%'+_0x2aa94b[_0x6d59('0x38')][_0x6d59('0x44')]+'%'};return _0x2b17e8;})});}_0x5cd53c=_[_0x6d59('0x45')]({},_0x5cd53c,_0x2aa94b['options']);return _0x498b52[_0x6d59('0x69')](_0x5cd53c);}})[_0x6d59('0x2a')](function(_0x2ca4cb){if(_0x2ca4cb){_0x311637=_0x2ca4cb[_0x6d59('0x4e')];if(!_0x2aa94b['query']['hasOwnProperty']('nolimit')){_0x5cd53c[_0x6d59('0x22')]=qs[_0x6d59('0x22')](_0x2aa94b[_0x6d59('0x38')]['limit']);_0x5cd53c['offset']=qs[_0x6d59('0x21')](_0x2aa94b['query'][_0x6d59('0x21')]);}return _0x498b52[_0x6d59('0x69')](_0x5cd53c);}})[_0x6d59('0x2a')](function(_0x2bdde9){if(_0x2bdde9){return _0x2bdde9?{'count':_0x311637,'rows':_0x2bdde9}:null;}})['then'](respondWithResult(_0x2113b7,null))[_0x6d59('0x4b')](handleError(_0x2113b7,null));};exports[_0x6d59('0x6a')]=function(_0x14625f,_0x36fe64,_0x280791){var _0xdd3c4c=_0x14625f[_0x6d59('0x58')][_0x6d59('0x6b')];return db[_0x6d59('0x68')][_0x6d59('0x5e')]({'where':{'id':_0xdd3c4c},'attributes':['id'],'include':[{'model':db[_0x6d59('0x5f')],'as':'Agents','attributes':['id','name',_0x6d59('0x6c'),'voicePause',_0x6d59('0x6d')],'raw':!![]}]})[_0x6d59('0x2a')](function(_0x1923ea){if(_0x1923ea){var _0x341858=_[_0x6d59('0x6e')](_0x1923ea,function(_0x232ba4){var _0x154b18=_0x232ba4[_0x6d59('0x2c')]({'plain':!![]});return _0x154b18['Agents'];});return db['MailQueue'][_0x6d59('0x54')]({'where':{'id':_0x14625f[_0x6d59('0x4d')]['id']}})['then'](function(_0x17841e){return db[_0x6d59('0x6f')]['transaction'](function(_0x143c60){return _0x17841e[_0x6d59('0x6a')](_0xdd3c4c,{'transaction':_0x143c60})[_0x6d59('0x2a')](function(){return BPromise['each'](_0x341858,function(_0x1b7665){return db['UserMailQueue']['findOrCreate']({'where':{'UserId':_0x1b7665['id'],'MailQueueId':_0x14625f[_0x6d59('0x4d')]['id']},'transaction':_0x143c60});});})['then'](function(){_0x341858[_0x6d59('0x70')](function(_0x20b641){socket[_0x6d59('0x71')]('userMailQueue:save',{'UserId':_0x20b641['id'],'MailQueueId':_0x17841e['id']});});});});});}})[_0x6d59('0x2a')](respondWithStatusCode(_0x36fe64,null))[_0x6d59('0x4b')](handleError(_0x36fe64,null));};exports[_0x6d59('0x72')]=function(_0x280697,_0x1f9b87,_0x3e23f9){return db[_0x6d59('0x68')][_0x6d59('0x5e')]({'where':{'id':_0x280697[_0x6d59('0x38')][_0x6d59('0x6b')]},'attributes':['id'],'include':[{'model':db[_0x6d59('0x5f')],'as':_0x6d59('0x73'),'attributes':['id'],'raw':!![]}]})[_0x6d59('0x2a')](handleEntityNotFound(_0x1f9b87,null))[_0x6d59('0x2a')](function(_0x48818f){var _0x2675a2=_[_0x6d59('0x37')](_0x48818f,'id');var _0x100fe9=[];var _0x34f0dd=[];var _0x535761=squel[_0x6d59('0x74')]();_0x535761['field']('tq.TeamId')[_0x6d59('0x75')](_0x6d59('0x76'),'tq')[_0x6d59('0x77')](_0x6d59('0x78'),'ut',_0x6d59('0x79'))[_0x6d59('0x41')]('MailQueueId\x20=\x20?',_0x280697[_0x6d59('0x4d')]['id']);for(var _0x2a31d7=0x0;_0x2a31d7<_0x48818f[_0x6d59('0x4e')];_0x2a31d7+=0x1){let _0x57b55f=_0x48818f[_0x2a31d7];for(var _0x1ddc4e=0x0;_0x1ddc4e<_0x57b55f[_0x6d59('0x73')][_0x6d59('0x4e')];_0x1ddc4e+=0x1){let _0x11247e=_0x57b55f[_0x6d59('0x73')][_0x1ddc4e];var _0x5cb75a=_0x535761[_0x6d59('0x7a')]();_0x5cb75a[_0x6d59('0x41')](_0x6d59('0x7b'),_0x11247e['id']);_0x34f0dd[_0x6d59('0x7c')](db['sequelize'][_0x6d59('0x38')](_0x5cb75a['toString'](),{'type':db['sequelize'][_0x6d59('0x7d')][_0x6d59('0x7e')]})['then'](function(_0x16da23){if(_0x16da23[_0x6d59('0x4e')]===0x1){return _0x11247e['id'];}else{var _0x5db252=_['every'](_['map'](_0x16da23,_0x6d59('0x7f')),function(_0x51448e){return _['includes'](_0x2675a2,_0x51448e);});if(_0x5db252){return _0x11247e['id'];}}}));}}return BPromise[_0x6d59('0x80')](_0x34f0dd)['then'](function(_0x3b7fa5){_0x100fe9=_(_0x100fe9)['union'](_0x3b7fa5)['compact']()[_0x6d59('0x81')]();return db[_0x6d59('0x31')][_0x6d59('0x54')]({'where':{'id':_0x280697[_0x6d59('0x4d')]['id']}})[_0x6d59('0x2a')](function(_0x16d744){return db['sequelize']['transaction'](function(_0xebb3b7){return _0x16d744[_0x6d59('0x72')](_0x280697[_0x6d59('0x38')][_0x6d59('0x6b')],{'transaction':_0xebb3b7})[_0x6d59('0x2a')](function(){if(!_[_0x6d59('0x82')](_0x100fe9)){return _0x16d744[_0x6d59('0x83')](_0x100fe9,{'transaction':_0xebb3b7});}})[_0x6d59('0x2a')](function(){_0x100fe9[_0x6d59('0x70')](function(_0x4beb53){socket[_0x6d59('0x71')](_0x6d59('0x84'),{'UserId':_0x4beb53,'MailQueueId':_0x16d744['id']});});});});});});})[_0x6d59('0x2a')](respondWithStatusCode(_0x1f9b87,null))[_0x6d59('0x4b')](handleError(_0x1f9b87,null));};exports['addAgents']=function(_0x17897a,_0x50ab10,_0x29bb90){return db[_0x6d59('0x31')][_0x6d59('0x54')]({'where':{'id':_0x17897a[_0x6d59('0x4d')]['id']}})[_0x6d59('0x2a')](handleEntityNotFound(_0x50ab10,null))[_0x6d59('0x2a')](function(_0x687751){if(_0x687751){return _0x687751[_0x6d59('0x85')](_0x17897a['body'][_0x6d59('0x6b')],_[_0x6d59('0x86')](_0x17897a['body'],[_0x6d59('0x6b'),'id'])||{})['spread'](function(_0x17f444){for(var _0x1865cd=0x0;_0x1865cd<_0x17897a[_0x6d59('0x58')][_0x6d59('0x6b')][_0x6d59('0x4e')];_0x1865cd+=0x1){socket['emit'](_0x6d59('0x87'),{'UserId':Number(_0x17897a[_0x6d59('0x58')]['ids'][_0x1865cd]),'MailQueueId':Number(_0x17897a[_0x6d59('0x4d')]['id'])});}return _0x17f444;});}})[_0x6d59('0x2a')](respondWithResult(_0x50ab10,null))[_0x6d59('0x4b')](handleError(_0x50ab10,null));};exports[_0x6d59('0x83')]=function(_0x2fffcd,_0x5c30ef,_0x1f5079){return db[_0x6d59('0x31')][_0x6d59('0x54')]({'where':{'id':_0x2fffcd[_0x6d59('0x4d')]['id']}})[_0x6d59('0x2a')](handleEntityNotFound(_0x5c30ef,null))['then'](function(_0x59d902){if(_0x59d902){return _0x59d902[_0x6d59('0x83')](_0x2fffcd[_0x6d59('0x38')][_0x6d59('0x6b')])[_0x6d59('0x2a')](function(){if(_[_0x6d59('0x88')](_0x2fffcd['query'][_0x6d59('0x6b')])){for(var _0x478ccc=0x0;_0x478ccc<_0x2fffcd[_0x6d59('0x38')]['ids'][_0x6d59('0x4e')];_0x478ccc+=0x1){socket[_0x6d59('0x71')](_0x6d59('0x84'),{'UserId':Number(_0x2fffcd[_0x6d59('0x38')]['ids'][_0x478ccc]),'MailQueueId':Number(_0x2fffcd[_0x6d59('0x4d')]['id'])});}}else{socket[_0x6d59('0x71')](_0x6d59('0x84'),{'UserId':Number(_0x2fffcd[_0x6d59('0x38')][_0x6d59('0x6b')]),'MailQueueId':Number(_0x2fffcd[_0x6d59('0x4d')]['id'])});}});}})['then'](respondWithStatusCode(_0x5c30ef,null))[_0x6d59('0x4b')](handleError(_0x5c30ef,null));};exports[_0x6d59('0x89')]=function(_0xf2e6d0,_0x241b35,_0x364d64){var _0x5083be={};var _0x4ebcd1={};var _0x3d3d4b;var _0x3e6951;return db['MailQueue'][_0x6d59('0x5b')]({'where':{'id':_0xf2e6d0['params']['id']}})[_0x6d59('0x2a')](handleEntityNotFound(_0x241b35,null))[_0x6d59('0x2a')](function(_0x8ce6b6){if(_0x8ce6b6){_0x3d3d4b=_0x8ce6b6;_0x4ebcd1[_0x6d59('0x36')]=_[_0x6d59('0x39')](db[_0x6d59('0x5f')][_0x6d59('0x32')]);_0x4ebcd1[_0x6d59('0x38')]=_[_0x6d59('0x39')](_0xf2e6d0['query']);_0x4ebcd1['filters']=_['intersection'](_0x4ebcd1[_0x6d59('0x36')],_0x4ebcd1[_0x6d59('0x38')]);_0x5083be[_0x6d59('0x3b')]=_[_0x6d59('0x3a')](_0x4ebcd1[_0x6d59('0x36')],qs['fields'](_0xf2e6d0[_0x6d59('0x38')][_0x6d59('0x3c')]));_0x5083be['attributes']=_0x5083be[_0x6d59('0x3b')]['length']?_0x5083be[_0x6d59('0x3b')]:_0x4ebcd1['model'];_0x5083be['order']=qs['sort'](_0xf2e6d0[_0x6d59('0x38')][_0x6d59('0x40')]);_0x5083be[_0x6d59('0x41')]=qs['filters'](_[_0x6d59('0x43')](_0xf2e6d0[_0x6d59('0x38')],_0x4ebcd1['filters']));if(_0xf2e6d0['query'][_0x6d59('0x44')]){_0x5083be['where']=_['merge'](_0x5083be[_0x6d59('0x41')],{'$or':_[_0x6d59('0x37')](_0x5083be[_0x6d59('0x3b')],function(_0x48f098){var _0x55f9a4={};_0x55f9a4[_0x48f098]={'$like':'%'+_0xf2e6d0[_0x6d59('0x38')]['filter']+'%'};return _0x55f9a4;})});}_0x5083be=_[_0x6d59('0x45')]({},_0x5083be,_0xf2e6d0['options']);return _0x3d3d4b[_0x6d59('0x89')](_0x5083be);}})[_0x6d59('0x2a')](function(_0x114b0d){if(_0x114b0d){_0x3e6951=_0x114b0d[_0x6d59('0x4e')];if(!_0xf2e6d0[_0x6d59('0x38')][_0x6d59('0x3d')]('nolimit')){_0x5083be[_0x6d59('0x22')]=qs['limit'](_0xf2e6d0['query']['limit']);_0x5083be[_0x6d59('0x21')]=qs[_0x6d59('0x21')](_0xf2e6d0[_0x6d59('0x38')][_0x6d59('0x21')]);}return _0x3d3d4b[_0x6d59('0x89')](_0x5083be);}})['then'](function(_0x2ef7ad){if(_0x2ef7ad){return _0x2ef7ad?{'count':_0x3e6951,'rows':_0x2ef7ad}:null;}})[_0x6d59('0x2a')](respondWithResult(_0x241b35,null))['catch'](handleError(_0x241b35,null));}; \ No newline at end of file +var _0x587e=['userMailQueue:save','removeTeams','select','field','tq.TeamId','team_has_mail_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','SELECT','all','union','value','ids','isEmpty','removeAgents','forEach','userMailQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','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','./mailQueue.socket','register','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','save','update','then','get','MailQueues','UserProfileResource','destroy','error','name','send','MailQueue','rawAttributes','type','map','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','count','includeAll','include','findAll','rows','catch','show','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','describe','findOne','UserMailQueue','MailQueueId','User','findAndCountAll','UserId','format','%s/%s','mailPause','createdAt','updatedAt','getTeams','Team','addTeams','Agents','online','interface','sequelize','transaction','emit'];(function(_0x592a98,_0x59e997){var _0x55bece=function(_0xf60e1a){while(--_0xf60e1a){_0x592a98['push'](_0x592a98['shift']());}};_0x55bece(++_0x59e997);}(_0x587e,0xa3));var _0xe587=function(_0x4af0e5,_0x1870c4){_0x4af0e5=_0x4af0e5-0x0;var _0x3b131f=_0x587e[_0x4af0e5];return _0x3b131f;};'use strict';var emlformat=require(_0xe587('0x0'));var rimraf=require(_0xe587('0x1'));var zipdir=require(_0xe587('0x2'));var jsonpatch=require(_0xe587('0x3'));var rp=require(_0xe587('0x4'));var moment=require(_0xe587('0x5'));var BPromise=require(_0xe587('0x6'));var Mustache=require(_0xe587('0x7'));var util=require('util');var path=require(_0xe587('0x8'));var sox=require(_0xe587('0x9'));var csv=require(_0xe587('0xa'));var ejs=require(_0xe587('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe587('0xc'));var squel=require(_0xe587('0xd'));var crypto=require(_0xe587('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xe587('0xf'));var Papa=require('papaparse');var Redis=require(_0xe587('0x10'));var authService=require(_0xe587('0x11'));var qs=require(_0xe587('0x12'));var as=require(_0xe587('0x13'));var hardwareService=require(_0xe587('0x14'));var logger=require(_0xe587('0x15'))('api');var utils=require('../../config/utils');var config=require(_0xe587('0x16'));var licenseUtil=require(_0xe587('0x17'));var db=require(_0xe587('0x18'))['db'];config[_0xe587('0x19')]=_[_0xe587('0x1a')](config['redis'],{'host':_0xe587('0x1b'),'port':0x18eb});var socket=require(_0xe587('0x1c'))(new Redis(config[_0xe587('0x19')]));require(_0xe587('0x1d'))[_0xe587('0x1e')](socket);function respondWithStatusCode(_0x386353,_0x41bb72){_0x41bb72=_0x41bb72||0xcc;return function(_0x220bf9){if(_0x220bf9){return _0x386353[_0xe587('0x1f')](_0x41bb72);}return _0x386353[_0xe587('0x20')](_0x41bb72)[_0xe587('0x21')]();};}function respondWithResult(_0x293eb6,_0x3f2f12){_0x3f2f12=_0x3f2f12||0xc8;return function(_0x42a137){if(_0x42a137){return _0x293eb6[_0xe587('0x20')](_0x3f2f12)[_0xe587('0x22')](_0x42a137);}};}function respondWithFilteredResult(_0x19ef01,_0x5ab4ab){return function(_0x123638){if(_0x123638){var _0x257be5=typeof _0x5ab4ab[_0xe587('0x23')]===_0xe587('0x24')&&typeof _0x5ab4ab['limit']===_0xe587('0x24');var _0x3b413a=_0x123638['count'];var _0x502f0a=_0x257be5?0x0:_0x5ab4ab[_0xe587('0x23')];var _0x287440=_0x257be5?_0x123638['count']:_0x5ab4ab['offset']+_0x5ab4ab[_0xe587('0x25')];var _0x545aae;if(_0x287440>=_0x3b413a){_0x287440=_0x3b413a;_0x545aae=0xc8;}else{_0x545aae=0xce;}_0x19ef01[_0xe587('0x20')](_0x545aae);return _0x19ef01[_0xe587('0x26')](_0xe587('0x27'),_0x502f0a+'-'+_0x287440+'/'+_0x3b413a)[_0xe587('0x22')](_0x123638);}return null;};}function patchUpdates(_0x5d108a){return function(_0x1c569d){try{jsonpatch['apply'](_0x1c569d,_0x5d108a,!![]);}catch(_0x2a488d){return BPromise['reject'](_0x2a488d);}return _0x1c569d[_0xe587('0x28')]();};}function saveUpdates(_0x523b24,_0xfb9066){return function(_0x5a39ea){if(_0x5a39ea){return _0x5a39ea[_0xe587('0x29')](_0x523b24)[_0xe587('0x2a')](function(_0x19fb99){return _0x19fb99;});}return null;};}function removeEntity(_0x360ae5,_0x2fbddf){return function(_0x16fd21){if(_0x16fd21){return _0x16fd21['destroy']()[_0xe587('0x2a')](function(){var _0x4a863c=_0x16fd21[_0xe587('0x2b')]({'plain':!![]});var _0x3034f5=_0xe587('0x2c');return db[_0xe587('0x2d')][_0xe587('0x2e')]({'where':{'type':_0x3034f5,'resourceId':_0x4a863c['id']}})[_0xe587('0x2a')](function(){return _0x16fd21;});})[_0xe587('0x2a')](function(){_0x360ae5[_0xe587('0x20')](0xcc)[_0xe587('0x21')]();});}};}function handleEntityNotFound(_0x530288,_0x482e47){return function(_0x44cf21){if(!_0x44cf21){_0x530288[_0xe587('0x1f')](0x194);}return _0x44cf21;};}function handleError(_0x1a4cc1,_0x204b72){_0x204b72=_0x204b72||0x1f4;return function(_0x38b450){logger[_0xe587('0x2f')](_0x38b450['stack']);if(_0x38b450['name']){delete _0x38b450[_0xe587('0x30')];}_0x1a4cc1[_0xe587('0x20')](_0x204b72)[_0xe587('0x31')](_0x38b450);};}exports['index']=function(_0x190b18,_0x4d6109){var _0x4e3565={},_0x158761={},_0x580d95={'count':0x0,'rows':[]};var _0x75de5d=_['map'](db[_0xe587('0x32')][_0xe587('0x33')],function(_0x1496aa){return{'name':_0x1496aa['fieldName'],'type':_0x1496aa[_0xe587('0x34')]['key']};});_0x158761['model']=_[_0xe587('0x35')](_0x75de5d,_0xe587('0x30'));_0x158761[_0xe587('0x36')]=_[_0xe587('0x37')](_0x190b18[_0xe587('0x36')]);_0x158761['filters']=_[_0xe587('0x38')](_0x158761[_0xe587('0x39')],_0x158761[_0xe587('0x36')]);_0x4e3565[_0xe587('0x3a')]=_[_0xe587('0x38')](_0x158761['model'],qs[_0xe587('0x3b')](_0x190b18[_0xe587('0x36')]['fields']));_0x4e3565[_0xe587('0x3a')]=_0x4e3565[_0xe587('0x3a')][_0xe587('0x3c')]?_0x4e3565[_0xe587('0x3a')]:_0x158761[_0xe587('0x39')];if(!_0x190b18[_0xe587('0x36')][_0xe587('0x3d')](_0xe587('0x3e'))){_0x4e3565['limit']=qs[_0xe587('0x25')](_0x190b18[_0xe587('0x36')][_0xe587('0x25')]);_0x4e3565[_0xe587('0x23')]=qs[_0xe587('0x23')](_0x190b18['query'][_0xe587('0x23')]);}_0x4e3565[_0xe587('0x3f')]=qs[_0xe587('0x40')](_0x190b18[_0xe587('0x36')][_0xe587('0x40')]);_0x4e3565[_0xe587('0x41')]=qs[_0xe587('0x42')](_[_0xe587('0x43')](_0x190b18[_0xe587('0x36')],_0x158761[_0xe587('0x42')]),_0x75de5d);if(_0x190b18['query'][_0xe587('0x44')]){_0x4e3565[_0xe587('0x41')]=_['merge'](_0x4e3565[_0xe587('0x41')],{'$or':_[_0xe587('0x35')](_0x75de5d,function(_0x1b6bb2){if(_0x1b6bb2['type']!=='VIRTUAL'){var _0x1f33ed={};_0x1f33ed[_0x1b6bb2['name']]={'$like':'%'+_0x190b18[_0xe587('0x36')][_0xe587('0x44')]+'%'};return _0x1f33ed;}})});}_0x4e3565=_[_0xe587('0x45')]({},_0x4e3565,_0x190b18[_0xe587('0x46')]);var _0x59979d={'where':_0x4e3565[_0xe587('0x41')]};return db[_0xe587('0x32')][_0xe587('0x47')](_0x59979d)[_0xe587('0x2a')](function(_0x3ef189){_0x580d95[_0xe587('0x47')]=_0x3ef189;if(_0x190b18[_0xe587('0x36')][_0xe587('0x48')]){_0x4e3565[_0xe587('0x49')]=[{'all':!![]}];}return db['MailQueue'][_0xe587('0x4a')](_0x4e3565);})[_0xe587('0x2a')](function(_0xa9b2d1){_0x580d95[_0xe587('0x4b')]=_0xa9b2d1;return _0x580d95;})[_0xe587('0x2a')](respondWithFilteredResult(_0x4d6109,_0x4e3565))[_0xe587('0x4c')](handleError(_0x4d6109,null));};exports[_0xe587('0x4d')]=function(_0x2e71ea,_0x549f4e){var _0x2b4b3f={'raw':!![],'where':{'id':_0x2e71ea[_0xe587('0x4e')]['id']}},_0x3b7c3b={};_0x3b7c3b['model']=_['keys'](db[_0xe587('0x32')][_0xe587('0x33')]);_0x3b7c3b[_0xe587('0x36')]=_[_0xe587('0x37')](_0x2e71ea['query']);_0x3b7c3b['filters']=_[_0xe587('0x38')](_0x3b7c3b['model'],_0x3b7c3b['query']);_0x2b4b3f[_0xe587('0x3a')]=_[_0xe587('0x38')](_0x3b7c3b[_0xe587('0x39')],qs['fields'](_0x2e71ea['query'][_0xe587('0x3b')]));_0x2b4b3f[_0xe587('0x3a')]=_0x2b4b3f[_0xe587('0x3a')][_0xe587('0x3c')]?_0x2b4b3f[_0xe587('0x3a')]:_0x3b7c3b['model'];if(_0x2e71ea[_0xe587('0x36')][_0xe587('0x48')]){_0x2b4b3f[_0xe587('0x49')]=[{'all':!![]}];}_0x2b4b3f=_[_0xe587('0x45')]({},_0x2b4b3f,_0x2e71ea[_0xe587('0x46')]);return db[_0xe587('0x32')]['find'](_0x2b4b3f)[_0xe587('0x2a')](handleEntityNotFound(_0x549f4e,null))[_0xe587('0x2a')](respondWithResult(_0x549f4e,null))[_0xe587('0x4c')](handleError(_0x549f4e,null));};exports[_0xe587('0x4f')]=function(_0x2c4a9e,_0x26d8ec){return db[_0xe587('0x32')][_0xe587('0x4f')](_0x2c4a9e[_0xe587('0x50')],{})[_0xe587('0x2a')](function(_0x570cbb){var _0x56b326=_0x2c4a9e[_0xe587('0x51')][_0xe587('0x2b')]({'plain':!![]});if(!_0x56b326)throw new Error(_0xe587('0x52'));if(_0x56b326[_0xe587('0x53')]==='user'){var _0x271826=_0x570cbb[_0xe587('0x2b')]({'plain':!![]});var _0x1f4b9a=_0xe587('0x2c');return db[_0xe587('0x54')][_0xe587('0x55')]({'where':{'name':_0x1f4b9a,'userProfileId':_0x56b326[_0xe587('0x56')]},'raw':!![]})['then'](function(_0x5ed4ea){if(_0x5ed4ea&&_0x5ed4ea[_0xe587('0x57')]===0x0){return db['UserProfileResource'][_0xe587('0x4f')]({'name':_0x271826[_0xe587('0x30')],'resourceId':_0x271826['id'],'type':_0x5ed4ea[_0xe587('0x30')],'sectionId':_0x5ed4ea['id']},{})['then'](function(){return _0x570cbb;});}else{return _0x570cbb;}})[_0xe587('0x4c')](function(_0x57a72a){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x57a72a);throw _0x57a72a;});}return _0x570cbb;})[_0xe587('0x2a')](respondWithResult(_0x26d8ec,0xc9))[_0xe587('0x4c')](handleError(_0x26d8ec,null));};exports[_0xe587('0x29')]=function(_0x250441,_0x5998a5){if(_0x250441['body']['id']){delete _0x250441['body']['id'];}return db[_0xe587('0x32')][_0xe587('0x55')]({'where':{'id':_0x250441[_0xe587('0x4e')]['id']}})['then'](handleEntityNotFound(_0x5998a5,null))[_0xe587('0x2a')](saveUpdates(_0x250441[_0xe587('0x50')],null))['then'](respondWithResult(_0x5998a5,null))[_0xe587('0x4c')](handleError(_0x5998a5,null));};exports[_0xe587('0x2e')]=function(_0x58eb81,_0x905e40){return db[_0xe587('0x32')][_0xe587('0x55')]({'where':{'id':_0x58eb81[_0xe587('0x4e')]['id']}})['then'](handleEntityNotFound(_0x905e40,null))[_0xe587('0x2a')](removeEntity(_0x905e40,null))['catch'](handleError(_0x905e40,null));};exports[_0xe587('0x58')]=function(_0x49a475,_0x58dfea){return db[_0xe587('0x32')][_0xe587('0x58')]()[_0xe587('0x2a')](respondWithResult(_0x58dfea,null))[_0xe587('0x4c')](handleError(_0x58dfea,null));};exports['getMembers']=function(_0x3f9bac,_0x39cb76,_0x4afe41){var _0x19559e={'raw':!![],'where':{}},_0x3db649={},_0x3ee1e3;return db[_0xe587('0x32')][_0xe587('0x59')]({'where':{'id':_0x3f9bac['params']['id']}})[_0xe587('0x2a')](handleEntityNotFound(_0x39cb76,null))[_0xe587('0x2a')](function(_0x33329e){if(_0x33329e){_0x3ee1e3=_0x33329e[_0xe587('0x2b')]({'plain':!![]});_0x3db649[_0xe587('0x39')]=_[_0xe587('0x37')](db[_0xe587('0x5a')]['rawAttributes']);_0x3db649[_0xe587('0x36')]=_[_0xe587('0x37')](_0x3f9bac[_0xe587('0x36')]);_0x3db649[_0xe587('0x42')]=_[_0xe587('0x38')](_0x3db649[_0xe587('0x39')],_0x3db649[_0xe587('0x36')]);_0x19559e['attributes']=_[_0xe587('0x38')](_0x3db649[_0xe587('0x39')],qs[_0xe587('0x3b')](_0x3f9bac[_0xe587('0x36')][_0xe587('0x3b')]));_0x19559e[_0xe587('0x3a')]=_0x19559e[_0xe587('0x3a')][_0xe587('0x3c')]?_0x19559e['attributes']:_0x3db649[_0xe587('0x39')];if(!_0x3f9bac[_0xe587('0x36')][_0xe587('0x3d')]('nolimit')){_0x19559e[_0xe587('0x25')]=qs['limit'](_0x3f9bac['query']['limit']);_0x19559e['offset']=qs[_0xe587('0x23')](_0x3f9bac['query']['offset']);}_0x19559e[_0xe587('0x3f')]=qs[_0xe587('0x40')](_0x3f9bac[_0xe587('0x36')][_0xe587('0x40')]);_0x19559e['where']=qs[_0xe587('0x42')](_[_0xe587('0x43')](_0x3f9bac['query'],_0x3db649[_0xe587('0x42')]));_0x19559e[_0xe587('0x41')][_0xe587('0x5b')]=_0x33329e['id'];if(_0x3f9bac[_0xe587('0x36')][_0xe587('0x44')]){_0x19559e['where']=_[_0xe587('0x45')](_0x19559e[_0xe587('0x41')],{'$or':_['map'](_0x19559e[_0xe587('0x3a')],function(_0x4643f4){var _0x2bd35a={};_0x2bd35a[_0x4643f4]={'$like':'%'+_0x3f9bac[_0xe587('0x36')][_0xe587('0x44')]+'%'};return _0x2bd35a;})});}_0x19559e=_['merge']({},_0x19559e,_0x3f9bac[_0xe587('0x46')]);return db[_0xe587('0x5a')]['findAll'](_0x19559e);}})[_0xe587('0x2a')](function(_0x518a4c){if(_0x518a4c){return db[_0xe587('0x5c')][_0xe587('0x5d')]({'where':{'id':_[_0xe587('0x35')](_0x518a4c,_0xe587('0x5e')),'role':'agent'},'attributes':['id','name','mailPause','updatedAt','createdAt']});}})[_0xe587('0x2a')](function(_0x4fde44){if(_0x4fde44){return{'count':_0x4fde44[_0xe587('0x47')],'rows':_[_0xe587('0x35')](_0x4fde44[_0xe587('0x4b')],function(_0x3f5c06){return{'membername':_0x3f5c06[_0xe587('0x30')],'UserId':_0x3f5c06['id'],'queue_name':_0x3ee1e3['name'],'MailQueueId':_0x3ee1e3['id'],'interface':util[_0xe587('0x5f')](_0xe587('0x60'),'SIP',_0x3f5c06[_0xe587('0x30')]),'penalty':0x0,'paused':_0x3f5c06[_0xe587('0x61')],'createdAt':_0x3f5c06[_0xe587('0x62')],'updatedAt':_0x3f5c06[_0xe587('0x63')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xe587('0x2a')](respondWithFilteredResult(_0x39cb76,_0x19559e))[_0xe587('0x4c')](handleError(_0x39cb76,null));};exports[_0xe587('0x64')]=function(_0x2331c2,_0x1c215b,_0x1d271a){var _0x1c5364={};var _0x12bfec={};var _0x4e67f4;var _0x297ca1;return db['MailQueue'][_0xe587('0x59')]({'where':{'id':_0x2331c2[_0xe587('0x4e')]['id']}})[_0xe587('0x2a')](handleEntityNotFound(_0x1c215b,null))['then'](function(_0x5a5825){if(_0x5a5825){_0x4e67f4=_0x5a5825;_0x12bfec[_0xe587('0x39')]=_[_0xe587('0x37')](db[_0xe587('0x65')][_0xe587('0x33')]);_0x12bfec['query']=_[_0xe587('0x37')](_0x2331c2[_0xe587('0x36')]);_0x12bfec[_0xe587('0x42')]=_[_0xe587('0x38')](_0x12bfec[_0xe587('0x39')],_0x12bfec[_0xe587('0x36')]);_0x1c5364['attributes']=_['intersection'](_0x12bfec[_0xe587('0x39')],qs['fields'](_0x2331c2[_0xe587('0x36')]['fields']));_0x1c5364[_0xe587('0x3a')]=_0x1c5364[_0xe587('0x3a')][_0xe587('0x3c')]?_0x1c5364['attributes']:_0x12bfec['model'];_0x1c5364[_0xe587('0x3f')]=qs['sort'](_0x2331c2[_0xe587('0x36')][_0xe587('0x40')]);_0x1c5364['where']=qs[_0xe587('0x42')](_['pick'](_0x2331c2[_0xe587('0x36')],_0x12bfec['filters']));if(_0x2331c2[_0xe587('0x36')][_0xe587('0x44')]){_0x1c5364[_0xe587('0x41')]=_['merge'](_0x1c5364[_0xe587('0x41')],{'$or':_[_0xe587('0x35')](_0x1c5364['attributes'],function(_0x876700){var _0x44935d={};_0x44935d[_0x876700]={'$like':'%'+_0x2331c2['query'][_0xe587('0x44')]+'%'};return _0x44935d;})});}_0x1c5364=_[_0xe587('0x45')]({},_0x1c5364,_0x2331c2['options']);return _0x4e67f4[_0xe587('0x64')](_0x1c5364);}})[_0xe587('0x2a')](function(_0x4fc890){if(_0x4fc890){_0x297ca1=_0x4fc890[_0xe587('0x3c')];if(!_0x2331c2['query']['hasOwnProperty'](_0xe587('0x3e'))){_0x1c5364[_0xe587('0x25')]=qs[_0xe587('0x25')](_0x2331c2['query']['limit']);_0x1c5364[_0xe587('0x23')]=qs[_0xe587('0x23')](_0x2331c2['query']['offset']);}return _0x4e67f4[_0xe587('0x64')](_0x1c5364);}})[_0xe587('0x2a')](function(_0x4bc716){if(_0x4bc716){return _0x4bc716?{'count':_0x297ca1,'rows':_0x4bc716}:null;}})[_0xe587('0x2a')](respondWithResult(_0x1c215b,null))['catch'](handleError(_0x1c215b,null));};exports[_0xe587('0x66')]=function(_0x1c9777,_0x3d4423,_0x30b8e9){var _0xf0e42e=_0x1c9777['body']['ids'];return db[_0xe587('0x65')]['findAll']({'where':{'id':_0xf0e42e},'attributes':['id'],'include':[{'model':db[_0xe587('0x5c')],'as':_0xe587('0x67'),'attributes':['id','name',_0xe587('0x68'),'voicePause',_0xe587('0x69')],'raw':!![]}]})[_0xe587('0x2a')](function(_0x4c62d5){if(_0x4c62d5){var _0x487197=_['flatMap'](_0x4c62d5,function(_0x231b40){var _0x11a11b=_0x231b40[_0xe587('0x2b')]({'plain':!![]});return _0x11a11b[_0xe587('0x67')];});return db[_0xe587('0x32')][_0xe587('0x55')]({'where':{'id':_0x1c9777[_0xe587('0x4e')]['id']}})['then'](function(_0x3cd446){return db[_0xe587('0x6a')][_0xe587('0x6b')](function(_0x17566a){return _0x3cd446['addTeams'](_0xf0e42e,{'transaction':_0x17566a})['then'](function(){return BPromise['each'](_0x487197,function(_0x1f8972){return db[_0xe587('0x5a')]['findOrCreate']({'where':{'UserId':_0x1f8972['id'],'MailQueueId':_0x1c9777[_0xe587('0x4e')]['id']},'transaction':_0x17566a});});})[_0xe587('0x2a')](function(){_0x487197['forEach'](function(_0x33a5c5){socket[_0xe587('0x6c')](_0xe587('0x6d'),{'UserId':_0x33a5c5['id'],'MailQueueId':_0x3cd446['id']});});});});});}})[_0xe587('0x2a')](respondWithStatusCode(_0x3d4423,null))['catch'](handleError(_0x3d4423,null));};exports[_0xe587('0x6e')]=function(_0xba4d96,_0x1108e9,_0x517948){return db[_0xe587('0x65')]['findAll']({'where':{'id':_0xba4d96[_0xe587('0x36')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xe587('0x2a')](handleEntityNotFound(_0x1108e9,null))['then'](function(_0x5549b1){var _0x11ba2a=_[_0xe587('0x35')](_0x5549b1,'id');var _0x363151=[];var _0x382305=[];var _0x51601d=squel[_0xe587('0x6f')]();_0x51601d[_0xe587('0x70')](_0xe587('0x71'))['from'](_0xe587('0x72'),'tq')[_0xe587('0x73')](_0xe587('0x74'),'ut',_0xe587('0x75'))[_0xe587('0x41')](_0xe587('0x76'),_0xba4d96['params']['id']);for(var _0x4f97c=0x0;_0x4f97c<_0x5549b1[_0xe587('0x3c')];_0x4f97c+=0x1){let _0x40c9dc=_0x5549b1[_0x4f97c];for(var _0x7faabb=0x0;_0x7faabb<_0x40c9dc[_0xe587('0x67')][_0xe587('0x3c')];_0x7faabb+=0x1){let _0x58cea3=_0x40c9dc[_0xe587('0x67')][_0x7faabb];var _0x109972=_0x51601d['clone']();_0x109972[_0xe587('0x41')](_0xe587('0x77'),_0x58cea3['id']);_0x382305[_0xe587('0x78')](db[_0xe587('0x6a')][_0xe587('0x36')](_0x109972[_0xe587('0x79')](),{'type':db['sequelize']['QueryTypes'][_0xe587('0x7a')]})[_0xe587('0x2a')](function(_0x453592){if(_0x453592['length']===0x1){return _0x58cea3['id'];}else{var _0xdbc33e=_['every'](_[_0xe587('0x35')](_0x453592,'TeamId'),function(_0xa477b3){return _['includes'](_0x11ba2a,_0xa477b3);});if(_0xdbc33e){return _0x58cea3['id'];}}}));}}return BPromise[_0xe587('0x7b')](_0x382305)['then'](function(_0x334d46){_0x363151=_(_0x363151)[_0xe587('0x7c')](_0x334d46)['compact']()[_0xe587('0x7d')]();return db[_0xe587('0x32')][_0xe587('0x55')]({'where':{'id':_0xba4d96[_0xe587('0x4e')]['id']}})['then'](function(_0x50a9fd){return db[_0xe587('0x6a')][_0xe587('0x6b')](function(_0x4e8be7){return _0x50a9fd[_0xe587('0x6e')](_0xba4d96[_0xe587('0x36')][_0xe587('0x7e')],{'transaction':_0x4e8be7})['then'](function(){if(!_[_0xe587('0x7f')](_0x363151)){return _0x50a9fd[_0xe587('0x80')](_0x363151,{'transaction':_0x4e8be7});}})[_0xe587('0x2a')](function(){_0x363151[_0xe587('0x81')](function(_0x259e57){socket[_0xe587('0x6c')](_0xe587('0x82'),{'UserId':_0x259e57,'MailQueueId':_0x50a9fd['id']});});});});});});})[_0xe587('0x2a')](respondWithStatusCode(_0x1108e9,null))[_0xe587('0x4c')](handleError(_0x1108e9,null));};exports[_0xe587('0x83')]=function(_0x3cf017,_0x9de197,_0x1b124a){return db[_0xe587('0x32')][_0xe587('0x55')]({'where':{'id':_0x3cf017['params']['id']}})['then'](handleEntityNotFound(_0x9de197,null))[_0xe587('0x2a')](function(_0x5a8b49){if(_0x5a8b49){return _0x5a8b49[_0xe587('0x83')](_0x3cf017['body'][_0xe587('0x7e')],_[_0xe587('0x84')](_0x3cf017[_0xe587('0x50')],[_0xe587('0x7e'),'id'])||{})[_0xe587('0x85')](function(_0x438603){for(var _0x502d85=0x0;_0x502d85<_0x3cf017[_0xe587('0x50')][_0xe587('0x7e')][_0xe587('0x3c')];_0x502d85+=0x1){socket['emit'](_0xe587('0x6d'),{'UserId':Number(_0x3cf017['body'][_0xe587('0x7e')][_0x502d85]),'MailQueueId':Number(_0x3cf017[_0xe587('0x4e')]['id'])});}return _0x438603;});}})[_0xe587('0x2a')](respondWithResult(_0x9de197,null))[_0xe587('0x4c')](handleError(_0x9de197,null));};exports[_0xe587('0x80')]=function(_0x25ba9c,_0x5dc989,_0x99a5a9){return db[_0xe587('0x32')][_0xe587('0x55')]({'where':{'id':_0x25ba9c[_0xe587('0x4e')]['id']}})['then'](handleEntityNotFound(_0x5dc989,null))[_0xe587('0x2a')](function(_0x22a993){if(_0x22a993){return _0x22a993[_0xe587('0x80')](_0x25ba9c[_0xe587('0x36')][_0xe587('0x7e')])[_0xe587('0x2a')](function(){if(_[_0xe587('0x86')](_0x25ba9c[_0xe587('0x36')]['ids'])){for(var _0x583700=0x0;_0x583700<_0x25ba9c[_0xe587('0x36')][_0xe587('0x7e')][_0xe587('0x3c')];_0x583700+=0x1){socket['emit'](_0xe587('0x82'),{'UserId':Number(_0x25ba9c['query'][_0xe587('0x7e')][_0x583700]),'MailQueueId':Number(_0x25ba9c['params']['id'])});}}else{socket[_0xe587('0x6c')]('userMailQueue:remove',{'UserId':Number(_0x25ba9c['query']['ids']),'MailQueueId':Number(_0x25ba9c[_0xe587('0x4e')]['id'])});}});}})[_0xe587('0x2a')](respondWithStatusCode(_0x5dc989,null))[_0xe587('0x4c')](handleError(_0x5dc989,null));};exports['getAgents']=function(_0x3dc06e,_0x51da60,_0x4aaffe){var _0x3fb68d={};var _0x11c82a={};var _0xdf0bc1;var _0x54f88d;return db['MailQueue'][_0xe587('0x59')]({'where':{'id':_0x3dc06e[_0xe587('0x4e')]['id']}})['then'](handleEntityNotFound(_0x51da60,null))[_0xe587('0x2a')](function(_0x4fd4b5){if(_0x4fd4b5){_0xdf0bc1=_0x4fd4b5;_0x11c82a[_0xe587('0x39')]=_[_0xe587('0x37')](db[_0xe587('0x5c')]['rawAttributes']);_0x11c82a[_0xe587('0x36')]=_[_0xe587('0x37')](_0x3dc06e[_0xe587('0x36')]);_0x11c82a[_0xe587('0x42')]=_['intersection'](_0x11c82a[_0xe587('0x39')],_0x11c82a[_0xe587('0x36')]);_0x3fb68d['attributes']=_[_0xe587('0x38')](_0x11c82a[_0xe587('0x39')],qs['fields'](_0x3dc06e[_0xe587('0x36')][_0xe587('0x3b')]));_0x3fb68d[_0xe587('0x3a')]=_0x3fb68d['attributes'][_0xe587('0x3c')]?_0x3fb68d[_0xe587('0x3a')]:_0x11c82a[_0xe587('0x39')];_0x3fb68d['order']=qs[_0xe587('0x40')](_0x3dc06e[_0xe587('0x36')][_0xe587('0x40')]);_0x3fb68d[_0xe587('0x41')]=qs[_0xe587('0x42')](_['pick'](_0x3dc06e[_0xe587('0x36')],_0x11c82a['filters']));if(_0x3dc06e['query'][_0xe587('0x44')]){_0x3fb68d[_0xe587('0x41')]=_[_0xe587('0x45')](_0x3fb68d[_0xe587('0x41')],{'$or':_[_0xe587('0x35')](_0x3fb68d['attributes'],function(_0x45593c){var _0x2422df={};_0x2422df[_0x45593c]={'$like':'%'+_0x3dc06e[_0xe587('0x36')][_0xe587('0x44')]+'%'};return _0x2422df;})});}_0x3fb68d=_[_0xe587('0x45')]({},_0x3fb68d,_0x3dc06e['options']);return _0xdf0bc1[_0xe587('0x87')](_0x3fb68d);}})[_0xe587('0x2a')](function(_0x4ecc88){if(_0x4ecc88){_0x54f88d=_0x4ecc88[_0xe587('0x3c')];if(!_0x3dc06e[_0xe587('0x36')][_0xe587('0x3d')](_0xe587('0x3e'))){_0x3fb68d[_0xe587('0x25')]=qs['limit'](_0x3dc06e['query'][_0xe587('0x25')]);_0x3fb68d[_0xe587('0x23')]=qs[_0xe587('0x23')](_0x3dc06e[_0xe587('0x36')]['offset']);}return _0xdf0bc1[_0xe587('0x87')](_0x3fb68d);}})[_0xe587('0x2a')](function(_0x2c8abb){if(_0x2c8abb){return _0x2c8abb?{'count':_0x54f88d,'rows':_0x2c8abb}:null;}})[_0xe587('0x2a')](respondWithResult(_0x51da60,null))[_0xe587('0x4c')](handleError(_0x51da60,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index eafa6ed..9552ee9 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 _0xc869=['hasOwnProperty','hook','exports','events','MailQueue','setMaxListeners','save','update','remove','emit'];(function(_0xc73697,_0x118170){var _0x402216=function(_0x549455){while(--_0x549455){_0xc73697['push'](_0xc73697['shift']());}};_0x402216(++_0x118170);}(_0xc869,0x1e3));var _0x9c86=function(_0x223f42,_0xf9851c){_0x223f42=_0x223f42-0x0;var _0xc89bf=_0xc869[_0x223f42];return _0xc89bf;};'use strict';var EventEmitter=require(_0x9c86('0x0'));var MailQueue=require('../../mysqldb')['db'][_0x9c86('0x1')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x9c86('0x2')](0x0);var events={'afterCreate':_0x9c86('0x3'),'afterUpdate':_0x9c86('0x4'),'afterDestroy':_0x9c86('0x5')};function emitEvent(_0x515a45){return function(_0x5ca458,_0x44138f,_0x12d292){MailQueueEvents[_0x9c86('0x6')](_0x515a45+':'+_0x5ca458['id'],_0x5ca458);MailQueueEvents[_0x9c86('0x6')](_0x515a45,_0x5ca458);_0x12d292(null);};}for(var e in events){if(events[_0x9c86('0x7')](e)){var event=events[e];MailQueue[_0x9c86('0x8')](e,emitEvent(event));}}module[_0x9c86('0x9')]=MailQueueEvents; \ No newline at end of file +var _0x9ce7=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','MailQueue','setMaxListeners','save','update'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x9ce7,0x186));var _0x79ce=function(_0x550b0f,_0x4970bd){_0x550b0f=_0x550b0f-0x0;var _0x1304d7=_0x9ce7[_0x550b0f];return _0x1304d7;};'use strict';var EventEmitter=require(_0x79ce('0x0'));var MailQueue=require(_0x79ce('0x1'))['db'][_0x79ce('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x79ce('0x3')](0x0);var events={'afterCreate':_0x79ce('0x4'),'afterUpdate':_0x79ce('0x5'),'afterDestroy':_0x79ce('0x6')};function emitEvent(_0x2f6307){return function(_0x4af3c4,_0x187d44,_0x545bb9){MailQueueEvents[_0x79ce('0x7')](_0x2f6307+':'+_0x4af3c4['id'],_0x4af3c4);MailQueueEvents[_0x79ce('0x7')](_0x2f6307,_0x4af3c4);_0x545bb9(null);};}for(var e in events){if(events[_0x79ce('0x8')](e)){var event=events[e];MailQueue[_0x79ce('0x9')](e,emitEvent(event));}}module[_0x79ce('0xa')]=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index fceea09..a67e514 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 _0x6b14=['rimraf','./mailQueue.attributes','define','lodash','util','moment','bluebird','path'];(function(_0x1bf943,_0x4a700b){var _0x34d4a6=function(_0x2f7ff4){while(--_0x2f7ff4){_0x1bf943['push'](_0x1bf943['shift']());}};_0x34d4a6(++_0x4a700b);}(_0x6b14,0xbb));var _0x46b1=function(_0x5b1436,_0x32ff1f){_0x5b1436=_0x5b1436-0x0;var _0x4af849=_0x6b14[_0x5b1436];return _0x4af849;};'use strict';var _=require(_0x46b1('0x0'));var util=require(_0x46b1('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x46b1('0x2'));var BPromise=require(_0x46b1('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x46b1('0x4'));var rimraf=require(_0x46b1('0x5'));var config=require('../../config/environment');var attributes=require(_0x46b1('0x6'));module['exports']=function(_0x14d3d8,_0x37b47b){return _0x14d3d8[_0x46b1('0x7')]('MailQueue',attributes,{'tableName':'mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1721=['exports','define','MailQueue','mail_queues','lodash','util','moment','bluebird','path','../../config/environment','./mailQueue.attributes'];(function(_0x137d1d,_0x35c663){var _0x485108=function(_0x108a2a){while(--_0x108a2a){_0x137d1d['push'](_0x137d1d['shift']());}};_0x485108(++_0x35c663);}(_0x1721,0x138));var _0x1172=function(_0x496626,_0x29961d){_0x496626=_0x496626-0x0;var _0x13b364=_0x1721[_0x496626];return _0x13b364;};'use strict';var _=require(_0x1172('0x0'));var util=require(_0x1172('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x1172('0x2'));var BPromise=require(_0x1172('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1172('0x4'));var rimraf=require('rimraf');var config=require(_0x1172('0x5'));var attributes=require(_0x1172('0x6'));module[_0x1172('0x7')]=function(_0x43a5d9,_0xd32b01){return _0x43a5d9[_0x1172('0x8')](_0x1172('0x9'),attributes,{'tableName':_0x1172('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.rpc.js b/server/api/mailQueue/mailQueue.rpc.js index d476076..318e068 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 _0xc961=['socket.io-emitter','./mailQueue.socket','register','request','then','info','MailQueue,\x20%s,\x20%s','debug','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','findAll','options','raw','where','attributes','include','map','model','GetMailQueue','catch','ShowMailQueue','MailQueue','find','lodash','util','moment','bluebird','randomstring','ioredis','rpc','jayson/promise','http','redis','defaults','localhost'];(function(_0x19442e,_0x1fbe25){var _0x8ef84b=function(_0x2427c4){while(--_0x2427c4){_0x19442e['push'](_0x19442e['shift']());}};_0x8ef84b(++_0x1fbe25);}(_0xc961,0x17a));var _0x1c96=function(_0x8e1e89,_0x396be9){_0x8e1e89=_0x8e1e89-0x0;var _0x411cbd=_0xc961[_0x8e1e89];return _0x411cbd;};'use strict';var _=require(_0x1c96('0x0'));var util=require(_0x1c96('0x1'));var moment=require(_0x1c96('0x2'));var BPromise=require(_0x1c96('0x3'));var rs=require(_0x1c96('0x4'));var fs=require('fs');var Redis=require(_0x1c96('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x1c96('0x6'));var config=require('../../config/environment');var jayson=require(_0x1c96('0x7'));var client=jayson['client'][_0x1c96('0x8')]({'port':0x232a});config[_0x1c96('0x9')]=_[_0x1c96('0xa')](config[_0x1c96('0x9')],{'host':_0x1c96('0xb'),'port':0x18eb});var socket=require(_0x1c96('0xc'))(new Redis(config['redis']));require(_0x1c96('0xd'))[_0x1c96('0xe')](socket);function respondWithRpcPromise(_0x691a95,_0x34497e,_0x11a521){return new BPromise(function(_0x14ae4a,_0x435739){return client[_0x1c96('0xf')](_0x691a95,_0x11a521)[_0x1c96('0x10')](function(_0x273773){logger[_0x1c96('0x11')](_0x1c96('0x12'),_0x34497e,'request\x20sent');logger[_0x1c96('0x13')](_0x1c96('0x14'),_0x34497e,'request\x20sent',JSON[_0x1c96('0x15')](_0x273773));if(_0x273773[_0x1c96('0x16')]){if(_0x273773[_0x1c96('0x16')][_0x1c96('0x17')]===0x1f4){logger[_0x1c96('0x16')](_0x1c96('0x12'),_0x34497e,_0x273773[_0x1c96('0x16')][_0x1c96('0x18')]);return _0x435739(_0x273773[_0x1c96('0x16')][_0x1c96('0x18')]);}logger[_0x1c96('0x16')](_0x1c96('0x12'),_0x34497e,_0x273773[_0x1c96('0x16')]['message']);return _0x14ae4a(_0x273773[_0x1c96('0x16')]['message']);}else{logger[_0x1c96('0x11')](_0x1c96('0x12'),_0x34497e,'request\x20sent');_0x14ae4a(_0x273773[_0x1c96('0x19')]['message']);}})['catch'](function(_0x15b1de){logger[_0x1c96('0x16')](_0x1c96('0x12'),_0x34497e,_0x15b1de);_0x435739(_0x15b1de);});});}exports['GetMailQueue']=function(_0x383a49){var _0x5a5506=this;return new Promise(function(_0xe15ca8,_0x174ebf){return db['MailQueue'][_0x1c96('0x1a')]({'raw':_0x383a49['options']?_0x383a49[_0x1c96('0x1b')][_0x1c96('0x1c')]===undefined?!![]:![]:!![],'where':_0x383a49[_0x1c96('0x1b')]?_0x383a49[_0x1c96('0x1b')][_0x1c96('0x1d')]||null:null,'attributes':_0x383a49[_0x1c96('0x1b')]?_0x383a49[_0x1c96('0x1b')][_0x1c96('0x1e')]||null:null,'limit':_0x383a49[_0x1c96('0x1b')]?_0x383a49[_0x1c96('0x1b')]['limit']||null:null,'include':_0x383a49[_0x1c96('0x1b')]?_0x383a49[_0x1c96('0x1b')][_0x1c96('0x1f')]?_['map'](_0x383a49['options'][_0x1c96('0x1f')],function(_0xd57e1b){return{'model':db[_0xd57e1b['model']],'as':_0xd57e1b['as'],'attributes':_0xd57e1b[_0x1c96('0x1e')],'include':_0xd57e1b[_0x1c96('0x1f')]?_[_0x1c96('0x20')](_0xd57e1b['include'],function(_0x4d588d){return{'model':db[_0x4d588d[_0x1c96('0x21')]],'as':_0x4d588d['as'],'attributes':_0x4d588d[_0x1c96('0x1e')],'include':_0x4d588d['include']?_[_0x1c96('0x20')](_0x4d588d[_0x1c96('0x1f')],function(_0x3212f3){return{'model':db[_0x3212f3[_0x1c96('0x21')]],'as':_0x3212f3['as'],'attributes':_0x3212f3['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x3466e6){logger['info'](_0x1c96('0x22'),_0x383a49);logger['debug']('GetMailQueue',_0x383a49,JSON[_0x1c96('0x15')](_0x3466e6));_0xe15ca8(_0x3466e6);})[_0x1c96('0x23')](function(_0x104b15){logger[_0x1c96('0x16')](_0x1c96('0x22'),_0x104b15[_0x1c96('0x18')],_0x383a49);_0x174ebf(_0x5a5506['error'](0x1f4,_0x104b15['message']));});});};exports[_0x1c96('0x24')]=function(_0x25b92f){var _0x423ba9=this;return new Promise(function(_0x85a6e3,_0x36840a){return db[_0x1c96('0x25')][_0x1c96('0x26')]({'raw':_0x25b92f[_0x1c96('0x1b')]?_0x25b92f[_0x1c96('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x25b92f[_0x1c96('0x1b')]?_0x25b92f[_0x1c96('0x1b')][_0x1c96('0x1d')]||null:null,'attributes':_0x25b92f[_0x1c96('0x1b')]?_0x25b92f[_0x1c96('0x1b')][_0x1c96('0x1e')]||null:null,'include':_0x25b92f['options']?_0x25b92f[_0x1c96('0x1b')][_0x1c96('0x1f')]?_['map'](_0x25b92f[_0x1c96('0x1b')][_0x1c96('0x1f')],function(_0x18a364){return{'model':db[_0x18a364[_0x1c96('0x21')]],'as':_0x18a364['as'],'attributes':_0x18a364[_0x1c96('0x1e')],'include':_0x18a364[_0x1c96('0x1f')]?_[_0x1c96('0x20')](_0x18a364['include'],function(_0x5c47d3){return{'model':db[_0x5c47d3[_0x1c96('0x21')]],'as':_0x5c47d3['as'],'attributes':_0x5c47d3[_0x1c96('0x1e')],'include':_0x5c47d3['include']?_[_0x1c96('0x20')](_0x5c47d3['include'],function(_0x2adcb3){return{'model':db[_0x2adcb3[_0x1c96('0x21')]],'as':_0x2adcb3['as'],'attributes':_0x2adcb3['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0xb723b2){logger[_0x1c96('0x11')](_0x1c96('0x24'),_0x25b92f);logger[_0x1c96('0x13')](_0x1c96('0x24'),_0x25b92f,JSON[_0x1c96('0x15')](_0xb723b2));_0x85a6e3(_0xb723b2);})[_0x1c96('0x23')](function(_0x584b3e){logger[_0x1c96('0x16')](_0x1c96('0x24'),_0x584b3e['message'],_0x25b92f);_0x36840a(_0x423ba9[_0x1c96('0x16')](0x1f4,_0x584b3e['message']));});});}; \ No newline at end of file +var _0x3cac=['../../config/utils','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','register','then','MailQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','GetMailQueue','findAll','options','raw','limit','include','map','model','attributes','ShowMailQueue','find','where','lodash','util','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x100e28,_0x14a38e){var _0x11213e=function(_0x55659a){while(--_0x55659a){_0x100e28['push'](_0x100e28['shift']());}};_0x11213e(++_0x14a38e);}(_0x3cac,0x176));var _0xc3ca=function(_0x457df2,_0x48c083){_0x457df2=_0x457df2-0x0;var _0x39b7e4=_0x3cac[_0x457df2];return _0x39b7e4;};'use strict';var _=require(_0xc3ca('0x0'));var util=require(_0xc3ca('0x1'));var moment=require('moment');var BPromise=require(_0xc3ca('0x2'));var rs=require(_0xc3ca('0x3'));var fs=require('fs');var Redis=require(_0xc3ca('0x4'));var db=require(_0xc3ca('0x5'))['db'];var utils=require(_0xc3ca('0x6'));var logger=require('../../config/logger')(_0xc3ca('0x7'));var config=require(_0xc3ca('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xc3ca('0x9')][_0xc3ca('0xa')]({'port':0x232a});config[_0xc3ca('0xb')]=_[_0xc3ca('0xc')](config[_0xc3ca('0xb')],{'host':_0xc3ca('0xd'),'port':0x18eb});var socket=require(_0xc3ca('0xe'))(new Redis(config[_0xc3ca('0xb')]));require('./mailQueue.socket')[_0xc3ca('0xf')](socket);function respondWithRpcPromise(_0x2e52f5,_0x347579,_0x30d4ae){return new BPromise(function(_0x1d2ba2,_0x1c5642){return client['request'](_0x2e52f5,_0x30d4ae)[_0xc3ca('0x10')](function(_0x51609f){logger['info'](_0xc3ca('0x11'),_0x347579,_0xc3ca('0x12'));logger[_0xc3ca('0x13')]('MailQueue,\x20%s,\x20%s,\x20%s',_0x347579,_0xc3ca('0x12'),JSON[_0xc3ca('0x14')](_0x51609f));if(_0x51609f[_0xc3ca('0x15')]){if(_0x51609f[_0xc3ca('0x15')][_0xc3ca('0x16')]===0x1f4){logger['error'](_0xc3ca('0x11'),_0x347579,_0x51609f[_0xc3ca('0x15')][_0xc3ca('0x17')]);return _0x1c5642(_0x51609f[_0xc3ca('0x15')]['message']);}logger[_0xc3ca('0x15')](_0xc3ca('0x11'),_0x347579,_0x51609f[_0xc3ca('0x15')][_0xc3ca('0x17')]);return _0x1d2ba2(_0x51609f[_0xc3ca('0x15')]['message']);}else{logger[_0xc3ca('0x18')]('MailQueue,\x20%s,\x20%s',_0x347579,'request\x20sent');_0x1d2ba2(_0x51609f['result']['message']);}})[_0xc3ca('0x19')](function(_0x1ef387){logger['error']('MailQueue,\x20%s,\x20%s',_0x347579,_0x1ef387);_0x1c5642(_0x1ef387);});});}exports[_0xc3ca('0x1a')]=function(_0x4ae316){var _0x47d7aa=this;return new Promise(function(_0x6c7512,_0x55569e){return db['MailQueue'][_0xc3ca('0x1b')]({'raw':_0x4ae316[_0xc3ca('0x1c')]?_0x4ae316[_0xc3ca('0x1c')][_0xc3ca('0x1d')]===undefined?!![]:![]:!![],'where':_0x4ae316[_0xc3ca('0x1c')]?_0x4ae316[_0xc3ca('0x1c')]['where']||null:null,'attributes':_0x4ae316[_0xc3ca('0x1c')]?_0x4ae316[_0xc3ca('0x1c')]['attributes']||null:null,'limit':_0x4ae316[_0xc3ca('0x1c')]?_0x4ae316[_0xc3ca('0x1c')][_0xc3ca('0x1e')]||null:null,'include':_0x4ae316['options']?_0x4ae316[_0xc3ca('0x1c')][_0xc3ca('0x1f')]?_[_0xc3ca('0x20')](_0x4ae316['options']['include'],function(_0x5e27f7){return{'model':db[_0x5e27f7[_0xc3ca('0x21')]],'as':_0x5e27f7['as'],'attributes':_0x5e27f7['attributes'],'include':_0x5e27f7['include']?_[_0xc3ca('0x20')](_0x5e27f7[_0xc3ca('0x1f')],function(_0x1b4b57){return{'model':db[_0x1b4b57[_0xc3ca('0x21')]],'as':_0x1b4b57['as'],'attributes':_0x1b4b57[_0xc3ca('0x22')],'include':_0x1b4b57[_0xc3ca('0x1f')]?_['map'](_0x1b4b57[_0xc3ca('0x1f')],function(_0x27cf48){return{'model':db[_0x27cf48[_0xc3ca('0x21')]],'as':_0x27cf48['as'],'attributes':_0x27cf48[_0xc3ca('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x505967){logger['info']('GetMailQueue',_0x4ae316);logger[_0xc3ca('0x13')](_0xc3ca('0x1a'),_0x4ae316,JSON['stringify'](_0x505967));_0x6c7512(_0x505967);})[_0xc3ca('0x19')](function(_0x4c8e5b){logger['error'](_0xc3ca('0x1a'),_0x4c8e5b[_0xc3ca('0x17')],_0x4ae316);_0x55569e(_0x47d7aa['error'](0x1f4,_0x4c8e5b['message']));});});};exports[_0xc3ca('0x23')]=function(_0x242bb9){var _0x4bc385=this;return new Promise(function(_0x4cdbe1,_0x28112f){return db['MailQueue'][_0xc3ca('0x24')]({'raw':_0x242bb9[_0xc3ca('0x1c')]?_0x242bb9[_0xc3ca('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x242bb9[_0xc3ca('0x1c')]?_0x242bb9[_0xc3ca('0x1c')][_0xc3ca('0x25')]||null:null,'attributes':_0x242bb9[_0xc3ca('0x1c')]?_0x242bb9[_0xc3ca('0x1c')][_0xc3ca('0x22')]||null:null,'include':_0x242bb9['options']?_0x242bb9[_0xc3ca('0x1c')][_0xc3ca('0x1f')]?_[_0xc3ca('0x20')](_0x242bb9[_0xc3ca('0x1c')]['include'],function(_0x21c175){return{'model':db[_0x21c175[_0xc3ca('0x21')]],'as':_0x21c175['as'],'attributes':_0x21c175[_0xc3ca('0x22')],'include':_0x21c175[_0xc3ca('0x1f')]?_[_0xc3ca('0x20')](_0x21c175[_0xc3ca('0x1f')],function(_0x2b0fae){return{'model':db[_0x2b0fae[_0xc3ca('0x21')]],'as':_0x2b0fae['as'],'attributes':_0x2b0fae[_0xc3ca('0x22')],'include':_0x2b0fae[_0xc3ca('0x1f')]?_[_0xc3ca('0x20')](_0x2b0fae[_0xc3ca('0x1f')],function(_0x3a835a){return{'model':db[_0x3a835a[_0xc3ca('0x21')]],'as':_0x3a835a['as'],'attributes':_0x3a835a[_0xc3ca('0x22')]};}):[]};}):[]};}):[]:[]})[_0xc3ca('0x10')](function(_0x25c098){logger[_0xc3ca('0x18')]('ShowMailQueue',_0x242bb9);logger[_0xc3ca('0x13')](_0xc3ca('0x23'),_0x242bb9,JSON['stringify'](_0x25c098));_0x4cdbe1(_0x25c098);})[_0xc3ca('0x19')](function(_0x40e89e){logger[_0xc3ca('0x15')](_0xc3ca('0x23'),_0x40e89e[_0xc3ca('0x17')],_0x242bb9);_0x28112f(_0x4bc385['error'](0x1f4,_0x40e89e[_0xc3ca('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index 4591aba..b2e169b 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 _0xb98e=['./mailQueue.events','save','removeListener','mailQueue:'];(function(_0x228d54,_0x1af4af){var _0x12c3bc=function(_0x3fbf70){while(--_0x3fbf70){_0x228d54['push'](_0x228d54['shift']());}};_0x12c3bc(++_0x1af4af);}(_0xb98e,0x184));var _0xeb98=function(_0x3747ed,_0x4c5a0e){_0x3747ed=_0x3747ed-0x0;var _0x4aa3f7=_0xb98e[_0x3747ed];return _0x4aa3f7;};'use strict';var MailQueueEvents=require(_0xeb98('0x0'));var events=[_0xeb98('0x1'),'remove','update'];function createListener(_0x23d6b7,_0x38aea4){return function(_0xd4c1d6){_0x38aea4['emit'](_0x23d6b7,_0xd4c1d6);};}function removeListener(_0x2f6eb1,_0x329ec1){return function(){MailQueueEvents[_0xeb98('0x2')](_0x2f6eb1,_0x329ec1);};}exports['register']=function(_0x33a16e){for(var _0x5d12df=0x0,_0x4a7e79=events['length'];_0x5d12df<_0x4a7e79;_0x5d12df++){var _0x41309a=events[_0x5d12df];var _0x16a195=createListener(_0xeb98('0x3')+_0x41309a,_0x33a16e);MailQueueEvents['on'](_0x41309a,_0x16a195);}}; \ No newline at end of file +var _0x957f=['length','mailQueue:','./mailQueue.events','save','remove','update','emit','removeListener'];(function(_0x25bccb,_0x185a40){var _0x18e34a=function(_0x3563a4){while(--_0x3563a4){_0x25bccb['push'](_0x25bccb['shift']());}};_0x18e34a(++_0x185a40);}(_0x957f,0xaa));var _0xf957=function(_0x57d0dc,_0x387f3e){_0x57d0dc=_0x57d0dc-0x0;var _0x177765=_0x957f[_0x57d0dc];return _0x177765;};'use strict';var MailQueueEvents=require(_0xf957('0x0'));var events=[_0xf957('0x1'),_0xf957('0x2'),_0xf957('0x3')];function createListener(_0x20e964,_0x338f83){return function(_0x2896d1){_0x338f83[_0xf957('0x4')](_0x20e964,_0x2896d1);};}function removeListener(_0x519d94,_0xdbe22a){return function(){MailQueueEvents[_0xf957('0x5')](_0x519d94,_0xdbe22a);};}exports['register']=function(_0x23d8ad){for(var _0x1dd4b7=0x0,_0x437ffb=events[_0xf957('0x6')];_0x1dd4b7<_0x437ffb;_0x1dd4b7++){var _0x109ff1=events[_0x1dd4b7];var _0x5089b3=createListener(_0xf957('0x7')+_0x109ff1,_0x23d8ad);MailQueueEvents['on'](_0x109ff1,_0x5089b3);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 16b3b5a..46c2a4a 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 _0x4a5d=['path','connect-timeout','express','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id','show','post','update','destroy','exports','multer'];(function(_0xc807ef,_0x49b4f1){var _0x1fdcae=function(_0x9e9bb2){while(--_0x9e9bb2){_0xc807ef['push'](_0xc807ef['shift']());}};_0x1fdcae(++_0x49b4f1);}(_0x4a5d,0x9f));var _0xd4a5=function(_0x15ea09,_0x2f30ab){_0x15ea09=_0x15ea09-0x0;var _0x3e9c78=_0x4a5d[_0x15ea09];return _0x3e9c78;};'use strict';var multer=require(_0xd4a5('0x0'));var util=require('util');var path=require(_0xd4a5('0x1'));var timeout=require(_0xd4a5('0x2'));var express=require(_0xd4a5('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xd4a5('0x4'));var config=require(_0xd4a5('0x5'));var controller=require('./mailQueueReport.controller');router[_0xd4a5('0x6')]('/',auth[_0xd4a5('0x7')](),controller[_0xd4a5('0x8')]);router[_0xd4a5('0x6')]('/describe',auth[_0xd4a5('0x7')](),controller[_0xd4a5('0x9')]);router[_0xd4a5('0x6')](_0xd4a5('0xa'),auth[_0xd4a5('0x7')](),controller[_0xd4a5('0xb')]);router[_0xd4a5('0xc')]('/',auth[_0xd4a5('0x7')](),controller['create']);router['put'](_0xd4a5('0xa'),auth[_0xd4a5('0x7')](),controller[_0xd4a5('0xd')]);router['delete']('/:id',auth[_0xd4a5('0x7')](),controller[_0xd4a5('0xe')]);module[_0xd4a5('0xf')]=router; \ No newline at end of file +var _0xcee5=['path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./mailQueueReport.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete','destroy','exports','multer','util'];(function(_0xa77d2d,_0x39ce58){var _0x182197=function(_0x39ec8c){while(--_0x39ec8c){_0xa77d2d['push'](_0xa77d2d['shift']());}};_0x182197(++_0x39ce58);}(_0xcee5,0x76));var _0x5cee=function(_0x31ccfd,_0xc5f61d){_0x31ccfd=_0x31ccfd-0x0;var _0x4cf3b1=_0xcee5[_0x31ccfd];return _0x4cf3b1;};'use strict';var multer=require(_0x5cee('0x0'));var util=require(_0x5cee('0x1'));var path=require(_0x5cee('0x2'));var timeout=require(_0x5cee('0x3'));var express=require(_0x5cee('0x4'));var router=express['Router']();var fs_extra=require(_0x5cee('0x5'));var auth=require(_0x5cee('0x6'));var interaction=require(_0x5cee('0x7'));var config=require('../../config/environment');var controller=require(_0x5cee('0x8'));router[_0x5cee('0x9')]('/',auth[_0x5cee('0xa')](),controller[_0x5cee('0xb')]);router[_0x5cee('0x9')]('/describe',auth['isAuthenticated'](),controller['describe']);router['get'](_0x5cee('0xc'),auth['isAuthenticated'](),controller[_0x5cee('0xd')]);router[_0x5cee('0xe')]('/',auth[_0x5cee('0xa')](),controller['create']);router[_0x5cee('0xf')](_0x5cee('0xc'),auth[_0x5cee('0xa')](),controller[_0x5cee('0x10')]);router[_0x5cee('0x11')]('/:id',auth[_0x5cee('0xa')](),controller[_0x5cee('0x12')]);module[_0x5cee('0x13')]=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index 44461d3..b1b092f 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 _0x8feb=['DATE','moment','STRING'];(function(_0x5ae884,_0x158218){var _0x2bcd03=function(_0x4799de){while(--_0x4799de){_0x5ae884['push'](_0x5ae884['shift']());}};_0x2bcd03(++_0x158218);}(_0x8feb,0xa9));var _0xb8fe=function(_0x305dce,_0x3416e1){_0x305dce=_0x305dce-0x0;var _0x479ffb=_0x8feb[_0x305dce];return _0x479ffb;};'use strict';var moment=require(_0xb8fe('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0xb8fe('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0xb8fe('0x1')]},'joinAt':{'type':Sequelize[_0xb8fe('0x2')]},'leaveAt':{'type':Sequelize[_0xb8fe('0x2')]},'acceptAt':{'type':Sequelize[_0xb8fe('0x2')]},'exitAt':{'type':Sequelize[_0xb8fe('0x2')]},'reason':{'type':Sequelize[_0xb8fe('0x1')]}}; \ No newline at end of file +var _0x11db=['sequelize','exports','STRING','DATE'];(function(_0x1a36a5,_0x746928){var _0x746243=function(_0x481966){while(--_0x481966){_0x1a36a5['push'](_0x1a36a5['shift']());}};_0x746243(++_0x746928);}(_0x11db,0x94));var _0xb11d=function(_0x30f07a,_0x98341){_0x30f07a=_0x30f07a-0x0;var _0xb38461=_0x11db[_0x30f07a];return _0xb38461;};'use strict';var moment=require('moment');var Sequelize=require(_0xb11d('0x0'));module[_0xb11d('0x1')]={'uniqueid':{'type':Sequelize[_0xb11d('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xb11d('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xb11d('0x3')]},'exitAt':{'type':Sequelize[_0xb11d('0x3')]},'reason':{'type':Sequelize[_0xb11d('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index 762d568..af01f0f 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 _0xf2e3=['zip-dir','fast-json-patch','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/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','error','stack','name','send','index','MailQueueReport','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','map','VIRTUAL','then','includeAll','include','rows','catch','show','params','create','body','update','destroy','find','describe','eml-format'];(function(_0x2945c0,_0x1aee55){var _0x284c27=function(_0x4296b6){while(--_0x4296b6){_0x2945c0['push'](_0x2945c0['shift']());}};_0x284c27(++_0x1aee55);}(_0xf2e3,0x9b));var _0x3f2e=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0xf2e3[_0x2be8c2];return _0x97f531;};'use strict';var emlformat=require(_0x3f2e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3f2e('0x1'));var jsonpatch=require(_0x3f2e('0x2'));var rp=require(_0x3f2e('0x3'));var moment=require(_0x3f2e('0x4'));var BPromise=require(_0x3f2e('0x5'));var Mustache=require(_0x3f2e('0x6'));var util=require(_0x3f2e('0x7'));var path=require(_0x3f2e('0x8'));var sox=require(_0x3f2e('0x9'));var csv=require('to-csv');var ejs=require(_0x3f2e('0xa'));var fs=require('fs');var fs_extra=require(_0x3f2e('0xb'));var _=require(_0x3f2e('0xc'));var squel=require(_0x3f2e('0xd'));var crypto=require(_0x3f2e('0xe'));var jsforce=require(_0x3f2e('0xf'));var deskjs=require(_0x3f2e('0x10'));var toCsv=require(_0x3f2e('0x11'));var querystring=require(_0x3f2e('0x12'));var Papa=require(_0x3f2e('0x13'));var Redis=require(_0x3f2e('0x14'));var authService=require(_0x3f2e('0x15'));var qs=require(_0x3f2e('0x16'));var as=require(_0x3f2e('0x17'));var hardwareService=require(_0x3f2e('0x18'));var logger=require(_0x3f2e('0x19'))(_0x3f2e('0x1a'));var utils=require(_0x3f2e('0x1b'));var config=require(_0x3f2e('0x1c'));var licenseUtil=require('../../config/license/util');var db=require(_0x3f2e('0x1d'))['db'];function respondWithStatusCode(_0xaa6ef5,_0x5471f9){_0x5471f9=_0x5471f9||0xcc;return function(_0xe83663){if(_0xe83663){return _0xaa6ef5[_0x3f2e('0x1e')](_0x5471f9);}return _0xaa6ef5[_0x3f2e('0x1f')](_0x5471f9)[_0x3f2e('0x20')]();};}function respondWithResult(_0x3d20d1,_0x57cba7){_0x57cba7=_0x57cba7||0xc8;return function(_0x298080){if(_0x298080){return _0x3d20d1[_0x3f2e('0x1f')](_0x57cba7)[_0x3f2e('0x21')](_0x298080);}};}function respondWithFilteredResult(_0x4f2e38,_0x43f69e){return function(_0x218b44){if(_0x218b44){var _0x17ef58=typeof _0x43f69e[_0x3f2e('0x22')]===_0x3f2e('0x23')&&typeof _0x43f69e[_0x3f2e('0x24')]===_0x3f2e('0x23');var _0x155411=_0x218b44[_0x3f2e('0x25')];var _0xc00add=_0x17ef58?0x0:_0x43f69e[_0x3f2e('0x22')];var _0x5b9989=_0x17ef58?_0x218b44[_0x3f2e('0x25')]:_0x43f69e[_0x3f2e('0x22')]+_0x43f69e[_0x3f2e('0x24')];var _0xbe899c;if(_0x5b9989>=_0x155411){_0x5b9989=_0x155411;_0xbe899c=0xc8;}else{_0xbe899c=0xce;}_0x4f2e38[_0x3f2e('0x1f')](_0xbe899c);return _0x4f2e38['set']('Content-Range',_0xc00add+'-'+_0x5b9989+'/'+_0x155411)[_0x3f2e('0x21')](_0x218b44);}return null;};}function patchUpdates(_0x11f84c){return function(_0x38bbae){try{jsonpatch[_0x3f2e('0x26')](_0x38bbae,_0x11f84c,!![]);}catch(_0x4381e5){return BPromise[_0x3f2e('0x27')](_0x4381e5);}return _0x38bbae['save']();};}function saveUpdates(_0x5a7047,_0xf81165){return function(_0x37dab2){if(_0x37dab2){return _0x37dab2['update'](_0x5a7047)['then'](function(_0x46bb1c){return _0x46bb1c;});}return null;};}function removeEntity(_0x5646f5,_0x1b8c67){return function(_0x401ed9){if(_0x401ed9){return _0x401ed9['destroy']()['then'](function(){_0x5646f5['status'](0xcc)[_0x3f2e('0x20')]();});}};}function handleEntityNotFound(_0x3d7631,_0x4c61d9){return function(_0x11a7cc){if(!_0x11a7cc){_0x3d7631['sendStatus'](0x194);}return _0x11a7cc;};}function handleError(_0x1ad875,_0x598541){_0x598541=_0x598541||0x1f4;return function(_0x2806d0){logger[_0x3f2e('0x28')](_0x2806d0[_0x3f2e('0x29')]);if(_0x2806d0[_0x3f2e('0x2a')]){delete _0x2806d0[_0x3f2e('0x2a')];}_0x1ad875['status'](_0x598541)[_0x3f2e('0x2b')](_0x2806d0);};}exports[_0x3f2e('0x2c')]=function(_0x5eab38,_0x528063){var _0x2b9fda={},_0x1e5db4={},_0x35f421={'count':0x0,'rows':[]};var _0x22e6ad=_['map'](db[_0x3f2e('0x2d')][_0x3f2e('0x2e')],function(_0x37ddfe){return{'name':_0x37ddfe['fieldName'],'type':_0x37ddfe[_0x3f2e('0x2f')][_0x3f2e('0x30')]};});_0x1e5db4[_0x3f2e('0x31')]=_['map'](_0x22e6ad,_0x3f2e('0x2a'));_0x1e5db4[_0x3f2e('0x32')]=_[_0x3f2e('0x33')](_0x5eab38[_0x3f2e('0x32')]);_0x1e5db4[_0x3f2e('0x34')]=_[_0x3f2e('0x35')](_0x1e5db4['model'],_0x1e5db4[_0x3f2e('0x32')]);_0x2b9fda[_0x3f2e('0x36')]=_[_0x3f2e('0x35')](_0x1e5db4[_0x3f2e('0x31')],qs[_0x3f2e('0x37')](_0x5eab38[_0x3f2e('0x32')][_0x3f2e('0x37')]));_0x2b9fda['attributes']=_0x2b9fda[_0x3f2e('0x36')][_0x3f2e('0x38')]?_0x2b9fda[_0x3f2e('0x36')]:_0x1e5db4[_0x3f2e('0x31')];if(!_0x5eab38['query']['hasOwnProperty'](_0x3f2e('0x39'))){_0x2b9fda[_0x3f2e('0x24')]=qs[_0x3f2e('0x24')](_0x5eab38[_0x3f2e('0x32')][_0x3f2e('0x24')]);_0x2b9fda[_0x3f2e('0x22')]=qs[_0x3f2e('0x22')](_0x5eab38[_0x3f2e('0x32')][_0x3f2e('0x22')]);}_0x2b9fda[_0x3f2e('0x3a')]=qs['sort'](_0x5eab38[_0x3f2e('0x32')][_0x3f2e('0x3b')]);_0x2b9fda[_0x3f2e('0x3c')]=qs[_0x3f2e('0x34')](_['pick'](_0x5eab38[_0x3f2e('0x32')],_0x1e5db4[_0x3f2e('0x34')]),_0x22e6ad);if(_0x5eab38[_0x3f2e('0x32')][_0x3f2e('0x3d')]){_0x2b9fda[_0x3f2e('0x3c')]=_[_0x3f2e('0x3e')](_0x2b9fda[_0x3f2e('0x3c')],{'$or':_[_0x3f2e('0x3f')](_0x22e6ad,function(_0x4c5ac2){if(_0x4c5ac2[_0x3f2e('0x2f')]!==_0x3f2e('0x40')){var _0x238b6b={};_0x238b6b[_0x4c5ac2[_0x3f2e('0x2a')]]={'$like':'%'+_0x5eab38['query'][_0x3f2e('0x3d')]+'%'};return _0x238b6b;}})});}_0x2b9fda=_[_0x3f2e('0x3e')]({},_0x2b9fda,_0x5eab38['options']);var _0x3fc694={'where':_0x2b9fda[_0x3f2e('0x3c')]};return db['MailQueueReport'][_0x3f2e('0x25')](_0x3fc694)[_0x3f2e('0x41')](function(_0x849236){_0x35f421[_0x3f2e('0x25')]=_0x849236;if(_0x5eab38['query'][_0x3f2e('0x42')]){_0x2b9fda[_0x3f2e('0x43')]=[{'all':!![]}];}return db['MailQueueReport']['findAll'](_0x2b9fda);})[_0x3f2e('0x41')](function(_0x23de01){_0x35f421[_0x3f2e('0x44')]=_0x23de01;return _0x35f421;})['then'](respondWithFilteredResult(_0x528063,_0x2b9fda))[_0x3f2e('0x45')](handleError(_0x528063,null));};exports[_0x3f2e('0x46')]=function(_0x43b35a,_0xe9000a){var _0x24df56={'raw':!![],'where':{'id':_0x43b35a[_0x3f2e('0x47')]['id']}},_0x3668dc={};_0x3668dc[_0x3f2e('0x31')]=_[_0x3f2e('0x33')](db[_0x3f2e('0x2d')]['rawAttributes']);_0x3668dc['query']=_[_0x3f2e('0x33')](_0x43b35a[_0x3f2e('0x32')]);_0x3668dc['filters']=_['intersection'](_0x3668dc[_0x3f2e('0x31')],_0x3668dc[_0x3f2e('0x32')]);_0x24df56[_0x3f2e('0x36')]=_['intersection'](_0x3668dc[_0x3f2e('0x31')],qs[_0x3f2e('0x37')](_0x43b35a[_0x3f2e('0x32')]['fields']));_0x24df56[_0x3f2e('0x36')]=_0x24df56[_0x3f2e('0x36')][_0x3f2e('0x38')]?_0x24df56['attributes']:_0x3668dc[_0x3f2e('0x31')];if(_0x43b35a[_0x3f2e('0x32')][_0x3f2e('0x42')]){_0x24df56['include']=[{'all':!![]}];}_0x24df56=_[_0x3f2e('0x3e')]({},_0x24df56,_0x43b35a['options']);return db[_0x3f2e('0x2d')]['find'](_0x24df56)['then'](handleEntityNotFound(_0xe9000a,null))[_0x3f2e('0x41')](respondWithResult(_0xe9000a,null))[_0x3f2e('0x45')](handleError(_0xe9000a,null));};exports[_0x3f2e('0x48')]=function(_0x3d6fd2,_0x3e7fac){return db['MailQueueReport']['create'](_0x3d6fd2[_0x3f2e('0x49')],{})[_0x3f2e('0x41')](respondWithResult(_0x3e7fac,0xc9))[_0x3f2e('0x45')](handleError(_0x3e7fac,null));};exports[_0x3f2e('0x4a')]=function(_0x39dbd1,_0xb891b2){if(_0x39dbd1[_0x3f2e('0x49')]['id']){delete _0x39dbd1[_0x3f2e('0x49')]['id'];}return db[_0x3f2e('0x2d')]['find']({'where':{'id':_0x39dbd1['params']['id']}})[_0x3f2e('0x41')](handleEntityNotFound(_0xb891b2,null))['then'](saveUpdates(_0x39dbd1[_0x3f2e('0x49')],null))[_0x3f2e('0x41')](respondWithResult(_0xb891b2,null))[_0x3f2e('0x45')](handleError(_0xb891b2,null));};exports[_0x3f2e('0x4b')]=function(_0x4b6950,_0xd871da){return db['MailQueueReport'][_0x3f2e('0x4c')]({'where':{'id':_0x4b6950[_0x3f2e('0x47')]['id']}})['then'](handleEntityNotFound(_0xd871da,null))[_0x3f2e('0x41')](removeEntity(_0xd871da,null))['catch'](handleError(_0xd871da,null));};exports[_0x3f2e('0x4d')]=function(_0x336003,_0x9ccf3b){return db['MailQueueReport'][_0x3f2e('0x4d')]()[_0x3f2e('0x41')](respondWithResult(_0x9ccf3b,null))[_0x3f2e('0x45')](handleError(_0x9ccf3b,null));}; \ No newline at end of file +var _0xf61e=['where','filter','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','find','create','update','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','count','limit','set','Content-Range','apply','destroy','then','status','error','stack','name','send','index','map','MailQueueReport','rawAttributes','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order'];(function(_0x4baa6a,_0x1b5317){var _0x2dde1d=function(_0x134727){while(--_0x134727){_0x4baa6a['push'](_0x4baa6a['shift']());}};_0x2dde1d(++_0x1b5317);}(_0xf61e,0x191));var _0xef61=function(_0x5a2440,_0x45e736){_0x5a2440=_0x5a2440-0x0;var _0x5a9bcf=_0xf61e[_0x5a2440];return _0x5a9bcf;};'use strict';var emlformat=require(_0xef61('0x0'));var rimraf=require(_0xef61('0x1'));var zipdir=require(_0xef61('0x2'));var jsonpatch=require(_0xef61('0x3'));var rp=require(_0xef61('0x4'));var moment=require(_0xef61('0x5'));var BPromise=require(_0xef61('0x6'));var Mustache=require(_0xef61('0x7'));var util=require(_0xef61('0x8'));var path=require(_0xef61('0x9'));var sox=require(_0xef61('0xa'));var csv=require(_0xef61('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xef61('0xc'));var _=require(_0xef61('0xd'));var squel=require('squel');var crypto=require(_0xef61('0xe'));var jsforce=require(_0xef61('0xf'));var deskjs=require(_0xef61('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xef61('0x11'));var Redis=require(_0xef61('0x12'));var authService=require(_0xef61('0x13'));var qs=require(_0xef61('0x14'));var as=require(_0xef61('0x15'));var hardwareService=require(_0xef61('0x16'));var logger=require(_0xef61('0x17'))(_0xef61('0x18'));var utils=require(_0xef61('0x19'));var config=require(_0xef61('0x1a'));var licenseUtil=require(_0xef61('0x1b'));var db=require(_0xef61('0x1c'))['db'];function respondWithStatusCode(_0x114e1f,_0x318f1c){_0x318f1c=_0x318f1c||0xcc;return function(_0x5de159){if(_0x5de159){return _0x114e1f[_0xef61('0x1d')](_0x318f1c);}return _0x114e1f['status'](_0x318f1c)[_0xef61('0x1e')]();};}function respondWithResult(_0x1db2a9,_0x370ee0){_0x370ee0=_0x370ee0||0xc8;return function(_0x76ef9b){if(_0x76ef9b){return _0x1db2a9['status'](_0x370ee0)[_0xef61('0x1f')](_0x76ef9b);}};}function respondWithFilteredResult(_0x435beb,_0x1224c2){return function(_0x78ff22){if(_0x78ff22){var _0x588a61=typeof _0x1224c2[_0xef61('0x20')]===_0xef61('0x21')&&typeof _0x1224c2['limit']===_0xef61('0x21');var _0x408541=_0x78ff22[_0xef61('0x22')];var _0x22dc1b=_0x588a61?0x0:_0x1224c2[_0xef61('0x20')];var _0x28315a=_0x588a61?_0x78ff22[_0xef61('0x22')]:_0x1224c2['offset']+_0x1224c2[_0xef61('0x23')];var _0x2c8dad;if(_0x28315a>=_0x408541){_0x28315a=_0x408541;_0x2c8dad=0xc8;}else{_0x2c8dad=0xce;}_0x435beb['status'](_0x2c8dad);return _0x435beb[_0xef61('0x24')](_0xef61('0x25'),_0x22dc1b+'-'+_0x28315a+'/'+_0x408541)[_0xef61('0x1f')](_0x78ff22);}return null;};}function patchUpdates(_0x26cf42){return function(_0xb0d7a4){try{jsonpatch[_0xef61('0x26')](_0xb0d7a4,_0x26cf42,!![]);}catch(_0x92ea33){return BPromise['reject'](_0x92ea33);}return _0xb0d7a4['save']();};}function saveUpdates(_0x3d31c1,_0x58bd7d){return function(_0x389d6d){if(_0x389d6d){return _0x389d6d['update'](_0x3d31c1)['then'](function(_0x2f0569){return _0x2f0569;});}return null;};}function removeEntity(_0x5ce99d,_0x53181b){return function(_0xfbee94){if(_0xfbee94){return _0xfbee94[_0xef61('0x27')]()[_0xef61('0x28')](function(){_0x5ce99d[_0xef61('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x16b144,_0x4e738f){return function(_0x2a6832){if(!_0x2a6832){_0x16b144[_0xef61('0x1d')](0x194);}return _0x2a6832;};}function handleError(_0x2419a9,_0xf4c7c9){_0xf4c7c9=_0xf4c7c9||0x1f4;return function(_0x2155f1){logger[_0xef61('0x2a')](_0x2155f1[_0xef61('0x2b')]);if(_0x2155f1[_0xef61('0x2c')]){delete _0x2155f1[_0xef61('0x2c')];}_0x2419a9[_0xef61('0x29')](_0xf4c7c9)[_0xef61('0x2d')](_0x2155f1);};}exports[_0xef61('0x2e')]=function(_0xeb9a62,_0x63edd4){var _0x1f3572={},_0x85978={},_0x39c15e={'count':0x0,'rows':[]};var _0x393ea9=_[_0xef61('0x2f')](db[_0xef61('0x30')][_0xef61('0x31')],function(_0x53fa3b){return{'name':_0x53fa3b['fieldName'],'type':_0x53fa3b['type'][_0xef61('0x32')]};});_0x85978[_0xef61('0x33')]=_[_0xef61('0x2f')](_0x393ea9,'name');_0x85978[_0xef61('0x34')]=_[_0xef61('0x35')](_0xeb9a62['query']);_0x85978[_0xef61('0x36')]=_['intersection'](_0x85978['model'],_0x85978[_0xef61('0x34')]);_0x1f3572['attributes']=_[_0xef61('0x37')](_0x85978['model'],qs[_0xef61('0x38')](_0xeb9a62[_0xef61('0x34')][_0xef61('0x38')]));_0x1f3572[_0xef61('0x39')]=_0x1f3572[_0xef61('0x39')][_0xef61('0x3a')]?_0x1f3572[_0xef61('0x39')]:_0x85978[_0xef61('0x33')];if(!_0xeb9a62[_0xef61('0x34')][_0xef61('0x3b')]('nolimit')){_0x1f3572[_0xef61('0x23')]=qs[_0xef61('0x23')](_0xeb9a62[_0xef61('0x34')][_0xef61('0x23')]);_0x1f3572[_0xef61('0x20')]=qs['offset'](_0xeb9a62[_0xef61('0x34')][_0xef61('0x20')]);}_0x1f3572[_0xef61('0x3c')]=qs['sort'](_0xeb9a62['query']['sort']);_0x1f3572[_0xef61('0x3d')]=qs['filters'](_['pick'](_0xeb9a62['query'],_0x85978[_0xef61('0x36')]),_0x393ea9);if(_0xeb9a62[_0xef61('0x34')][_0xef61('0x3e')]){_0x1f3572['where']=_['merge'](_0x1f3572['where'],{'$or':_[_0xef61('0x2f')](_0x393ea9,function(_0x32ad44){if(_0x32ad44['type']!==_0xef61('0x3f')){var _0x12f442={};_0x12f442[_0x32ad44[_0xef61('0x2c')]]={'$like':'%'+_0xeb9a62[_0xef61('0x34')]['filter']+'%'};return _0x12f442;}})});}_0x1f3572=_[_0xef61('0x40')]({},_0x1f3572,_0xeb9a62[_0xef61('0x41')]);var _0x3103d4={'where':_0x1f3572[_0xef61('0x3d')]};return db['MailQueueReport']['count'](_0x3103d4)[_0xef61('0x28')](function(_0x462972){_0x39c15e[_0xef61('0x22')]=_0x462972;if(_0xeb9a62['query'][_0xef61('0x42')]){_0x1f3572[_0xef61('0x43')]=[{'all':!![]}];}return db[_0xef61('0x30')][_0xef61('0x44')](_0x1f3572);})['then'](function(_0x545597){_0x39c15e['rows']=_0x545597;return _0x39c15e;})[_0xef61('0x28')](respondWithFilteredResult(_0x63edd4,_0x1f3572))[_0xef61('0x45')](handleError(_0x63edd4,null));};exports[_0xef61('0x46')]=function(_0xe40d,_0x3f81a1){var _0x272143={'raw':!![],'where':{'id':_0xe40d['params']['id']}},_0xc9b467={};_0xc9b467[_0xef61('0x33')]=_[_0xef61('0x35')](db[_0xef61('0x30')][_0xef61('0x31')]);_0xc9b467['query']=_[_0xef61('0x35')](_0xe40d[_0xef61('0x34')]);_0xc9b467[_0xef61('0x36')]=_[_0xef61('0x37')](_0xc9b467[_0xef61('0x33')],_0xc9b467[_0xef61('0x34')]);_0x272143['attributes']=_[_0xef61('0x37')](_0xc9b467[_0xef61('0x33')],qs[_0xef61('0x38')](_0xe40d['query'][_0xef61('0x38')]));_0x272143[_0xef61('0x39')]=_0x272143[_0xef61('0x39')][_0xef61('0x3a')]?_0x272143[_0xef61('0x39')]:_0xc9b467[_0xef61('0x33')];if(_0xe40d['query'][_0xef61('0x42')]){_0x272143[_0xef61('0x43')]=[{'all':!![]}];}_0x272143=_['merge']({},_0x272143,_0xe40d[_0xef61('0x41')]);return db[_0xef61('0x30')][_0xef61('0x47')](_0x272143)[_0xef61('0x28')](handleEntityNotFound(_0x3f81a1,null))['then'](respondWithResult(_0x3f81a1,null))[_0xef61('0x45')](handleError(_0x3f81a1,null));};exports[_0xef61('0x48')]=function(_0x5e614b,_0x47b09d){return db[_0xef61('0x30')][_0xef61('0x48')](_0x5e614b['body'],{})[_0xef61('0x28')](respondWithResult(_0x47b09d,0xc9))[_0xef61('0x45')](handleError(_0x47b09d,null));};exports[_0xef61('0x49')]=function(_0x2904e0,_0x13bb20){if(_0x2904e0[_0xef61('0x4a')]['id']){delete _0x2904e0[_0xef61('0x4a')]['id'];}return db['MailQueueReport'][_0xef61('0x47')]({'where':{'id':_0x2904e0['params']['id']}})[_0xef61('0x28')](handleEntityNotFound(_0x13bb20,null))[_0xef61('0x28')](saveUpdates(_0x2904e0[_0xef61('0x4a')],null))[_0xef61('0x28')](respondWithResult(_0x13bb20,null))[_0xef61('0x45')](handleError(_0x13bb20,null));};exports[_0xef61('0x27')]=function(_0x3e23eb,_0x1565c7){return db[_0xef61('0x30')]['find']({'where':{'id':_0x3e23eb[_0xef61('0x4b')]['id']}})[_0xef61('0x28')](handleEntityNotFound(_0x1565c7,null))['then'](removeEntity(_0x1565c7,null))['catch'](handleError(_0x1565c7,null));};exports[_0xef61('0x4c')]=function(_0x1ce127,_0x504389){return db[_0xef61('0x30')]['describe']()[_0xef61('0x28')](respondWithResult(_0x504389,null))[_0xef61('0x45')](handleError(_0x504389,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index 12a3783..5959eaa 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 _0x090e=['lodash','../../config/logger','api','moment','path','rimraf','exports','define','report_mail_queue','uniqueid'];(function(_0x490513,_0x409e1e){var _0x5ff97=function(_0x7d6434){while(--_0x7d6434){_0x490513['push'](_0x490513['shift']());}};_0x5ff97(++_0x409e1e);}(_0x090e,0x154));var _0xe090=function(_0x1f5873,_0x1497be){_0x1f5873=_0x1f5873-0x0;var _0x2a75d9=_0x090e[_0x1f5873];return _0x2a75d9;};'use strict';var _=require(_0xe090('0x0'));var util=require('util');var logger=require(_0xe090('0x1'))(_0xe090('0x2'));var moment=require(_0xe090('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xe090('0x4'));var rimraf=require(_0xe090('0x5'));var config=require('../../config/environment');var attributes=require('./mailQueueReport.attributes');module[_0xe090('0x6')]=function(_0x5ca798,_0x5e88fb){return _0x5ca798[_0xe090('0x7')]('MailQueueReport',attributes,{'tableName':_0xe090('0x8'),'paranoid':![],'indexes':[{'name':_0xe090('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x7527=['bluebird','request-promise','path','rimraf','../../config/environment','./mailQueueReport.attributes','MailQueueReport','report_mail_queue','uniqueid','util','../../config/logger','api','moment'];(function(_0x23e4f9,_0x442d34){var _0x19a0d5=function(_0x588cf5){while(--_0x588cf5){_0x23e4f9['push'](_0x23e4f9['shift']());}};_0x19a0d5(++_0x442d34);}(_0x7527,0x1a9));var _0x7752=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7527[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x7752('0x0'));var logger=require(_0x7752('0x1'))(_0x7752('0x2'));var moment=require(_0x7752('0x3'));var BPromise=require(_0x7752('0x4'));var rp=require(_0x7752('0x5'));var fs=require('fs');var path=require(_0x7752('0x6'));var rimraf=require(_0x7752('0x7'));var config=require(_0x7752('0x8'));var attributes=require(_0x7752('0x9'));module['exports']=function(_0x52075,_0x160cac){return _0x52075['define'](_0x7752('0xa'),attributes,{'tableName':_0x7752('0xb'),'paranoid':![],'indexes':[{'name':_0x7752('0xc'),'fields':[_0x7752('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 fbdb0d7..3ed259d 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 _0xdb28=['UpdateMailQueueReport','MailQueueReport','update','raw','where','limit','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','CreateMailQueueReport','create','body','options'];(function(_0x371485,_0x589744){var _0x3f6b22=function(_0x5dbb2e){while(--_0x5dbb2e){_0x371485['push'](_0x371485['shift']());}};_0x3f6b22(++_0x589744);}(_0xdb28,0x106));var _0x8db2=function(_0x446509,_0x269c75){_0x446509=_0x446509-0x0;var _0x56f4bb=_0xdb28[_0x446509];return _0x56f4bb;};'use strict';var _=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var moment=require(_0x8db2('0x2'));var BPromise=require(_0x8db2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8db2('0x4'));var db=require(_0x8db2('0x5'))['db'];var utils=require(_0x8db2('0x6'));var logger=require(_0x8db2('0x7'))(_0x8db2('0x8'));var config=require('../../config/environment');var jayson=require(_0x8db2('0x9'));var client=jayson[_0x8db2('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x494b40,_0x477f50,_0x46932f){return new BPromise(function(_0x131537,_0x29f698){return client[_0x8db2('0xb')](_0x494b40,_0x46932f)[_0x8db2('0xc')](function(_0x126c78){logger['info'](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));logger[_0x8db2('0xf')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x477f50,_0x8db2('0xe'),JSON[_0x8db2('0x10')](_0x126c78));if(_0x126c78['error']){if(_0x126c78[_0x8db2('0x11')][_0x8db2('0x12')]===0x1f4){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')]['message']);return _0x29f698(_0x126c78['error'][_0x8db2('0x13')]);}logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);return _0x131537(_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);}else{logger[_0x8db2('0x14')](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));_0x131537(_0x126c78['result'][_0x8db2('0x13')]);}})[_0x8db2('0x15')](function(_0x48101e){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x48101e);_0x29f698(_0x48101e);});});}exports[_0x8db2('0x16')]=function(_0x3fddc2){var _0x2efd06=this;return new Promise(function(_0x46ce14,_0x51d60d){return db['MailQueueReport'][_0x8db2('0x17')](_0x3fddc2[_0x8db2('0x18')],{'raw':_0x3fddc2[_0x8db2('0x19')]?_0x3fddc2[_0x8db2('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x8db2('0xc')](function(_0x36a9ff){logger[_0x8db2('0x14')](_0x8db2('0x16'),_0x3fddc2);logger[_0x8db2('0xf')]('CreateMailQueueReport',_0x3fddc2,JSON[_0x8db2('0x10')](_0x36a9ff));_0x46ce14(_0x36a9ff);})[_0x8db2('0x15')](function(_0x18f69c){logger[_0x8db2('0x11')](_0x8db2('0x16'),_0x18f69c[_0x8db2('0x13')],_0x3fddc2);_0x51d60d(_0x2efd06[_0x8db2('0x11')](0x1f4,_0x18f69c['message']));});});};exports[_0x8db2('0x1a')]=function(_0x4f6516){var _0x5725f0=this;return new Promise(function(_0x52a9ca,_0x4d923c){return db[_0x8db2('0x1b')][_0x8db2('0x1c')](_0x4f6516[_0x8db2('0x18')],{'raw':_0x4f6516[_0x8db2('0x19')]?_0x4f6516[_0x8db2('0x19')][_0x8db2('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4f6516['options']?_0x4f6516[_0x8db2('0x19')][_0x8db2('0x1e')]||null:null,'attributes':_0x4f6516[_0x8db2('0x19')]?_0x4f6516[_0x8db2('0x19')]['attributes']||null:null,'limit':_0x4f6516[_0x8db2('0x19')]?_0x4f6516[_0x8db2('0x19')][_0x8db2('0x1f')]||null:null})[_0x8db2('0xc')](function(_0xbe5ece){logger[_0x8db2('0x14')](_0x8db2('0x1a'),_0x4f6516);logger[_0x8db2('0xf')](_0x8db2('0x1a'),_0x4f6516,JSON['stringify'](_0xbe5ece));_0x52a9ca(_0xbe5ece);})[_0x8db2('0x15')](function(_0x50b28d){logger['error'](_0x8db2('0x1a'),_0x50b28d[_0x8db2('0x13')],_0x4f6516);_0x4d923c(_0x5725f0[_0x8db2('0x11')](0x1f4,_0x50b28d['message']));});});}; \ No newline at end of file +var _0x1261=['../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','MailQueueReport,\x20%s,\x20%s','request\x20sent','MailQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','CreateMailQueueReport','body','options','raw','stringify','MailQueueReport','update','where','UpdateMailQueueReport','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x3133f5,_0x54c138){var _0x1619ad=function(_0x2cf6d3){while(--_0x2cf6d3){_0x3133f5['push'](_0x3133f5['shift']());}};_0x1619ad(++_0x54c138);}(_0x1261,0x144));var _0x1126=function(_0x47f8cb,_0x44459e){_0x47f8cb=_0x47f8cb-0x0;var _0x24a7d6=_0x1261[_0x47f8cb];return _0x24a7d6;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var moment=require(_0x1126('0x1'));var BPromise=require(_0x1126('0x2'));var rs=require(_0x1126('0x3'));var fs=require('fs');var Redis=require(_0x1126('0x4'));var db=require(_0x1126('0x5'))['db'];var utils=require(_0x1126('0x6'));var logger=require(_0x1126('0x7'))(_0x1126('0x8'));var config=require(_0x1126('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1126('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x907180,_0x4f239c,_0x17e5f0){return new BPromise(function(_0x28772d,_0x245be9){return client[_0x1126('0xb')](_0x907180,_0x17e5f0)[_0x1126('0xc')](function(_0x59cfa1){logger[_0x1126('0xd')](_0x1126('0xe'),_0x4f239c,_0x1126('0xf'));logger['debug'](_0x1126('0x10'),_0x4f239c,'request\x20sent',JSON['stringify'](_0x59cfa1));if(_0x59cfa1[_0x1126('0x11')]){if(_0x59cfa1['error'][_0x1126('0x12')]===0x1f4){logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);return _0x245be9(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1['error']['message']);return _0x28772d(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}else{logger[_0x1126('0xd')]('MailQueueReport,\x20%s,\x20%s',_0x4f239c,_0x1126('0xf'));_0x28772d(_0x59cfa1['result'][_0x1126('0x13')]);}})[_0x1126('0x14')](function(_0x257b5f){logger['error'](_0x1126('0xe'),_0x4f239c,_0x257b5f);_0x245be9(_0x257b5f);});});}exports[_0x1126('0x15')]=function(_0x4a7b49){var _0x4d2b38=this;return new Promise(function(_0x22ae0b,_0x2b2487){return db['MailQueueReport']['create'](_0x4a7b49[_0x1126('0x16')],{'raw':_0x4a7b49['options']?_0x4a7b49[_0x1126('0x17')][_0x1126('0x18')]===undefined?!![]:![]:!![]})[_0x1126('0xc')](function(_0x54400a){logger[_0x1126('0xd')]('CreateMailQueueReport',_0x4a7b49);logger['debug'](_0x1126('0x15'),_0x4a7b49,JSON[_0x1126('0x19')](_0x54400a));_0x22ae0b(_0x54400a);})[_0x1126('0x14')](function(_0x36d254){logger['error'](_0x1126('0x15'),_0x36d254[_0x1126('0x13')],_0x4a7b49);_0x2b2487(_0x4d2b38['error'](0x1f4,_0x36d254[_0x1126('0x13')]));});});};exports['UpdateMailQueueReport']=function(_0x529dd9){var _0x4b57ab=this;return new Promise(function(_0x2199d9,_0x15bcc3){return db[_0x1126('0x1a')][_0x1126('0x1b')](_0x529dd9[_0x1126('0x16')],{'raw':_0x529dd9[_0x1126('0x17')]?_0x529dd9[_0x1126('0x17')][_0x1126('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x529dd9['options']?_0x529dd9[_0x1126('0x17')][_0x1126('0x1c')]||null:null,'attributes':_0x529dd9[_0x1126('0x17')]?_0x529dd9['options']['attributes']||null:null,'limit':_0x529dd9[_0x1126('0x17')]?_0x529dd9[_0x1126('0x17')]['limit']||null:null})[_0x1126('0xc')](function(_0x23d2bc){logger['info'](_0x1126('0x1d'),_0x529dd9);logger['debug'](_0x1126('0x1d'),_0x529dd9,JSON['stringify'](_0x23d2bc));_0x2199d9(_0x23d2bc);})[_0x1126('0x14')](function(_0x583ce6){logger[_0x1126('0x11')]('UpdateMailQueueReport',_0x583ce6['message'],_0x529dd9);_0x15bcc3(_0x4b57ab['error'](0x1f4,_0x583ce6[_0x1126('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index d0a8c82..6ca7ef5 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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x112ebc,_0x3189f2){var _0x4505f8=function(_0x58815e){while(--_0x58815e){_0x112ebc['push'](_0x112ebc['shift']());}};_0x4505f8(++_0x3189f2);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x4e39ba,_0x49dcf8){var _0x12c4e3=function(_0x7878d2){while(--_0x7878d2){_0x4e39ba['push'](_0x4e39ba['shift']());}};_0x12c4e3(++_0x49dcf8);}(_0x70e0,0x17b));var _0x070e=function(_0x3240ab,_0x2bb8c0){_0x3240ab=_0x3240ab-0x0;var _0x131097=_0x70e0[_0x3240ab];return _0x131097;};'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/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index ff122c1..5a611c9 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 _0xa9fd=['sequelize','exports','STRING','BOOLEAN','INBOX'];(function(_0x1175b7,_0x9e7910){var _0x52797e=function(_0x386ff1){while(--_0x386ff1){_0x1175b7['push'](_0x1175b7['shift']());}};_0x52797e(++_0x9e7910);}(_0xa9fd,0x91));var _0xda9f=function(_0x135157,_0x14cf20){_0x135157=_0x135157-0x0;var _0x430b61=_0xa9fd[_0x135157];return _0x430b61;};'use strict';var Sequelize=require(_0xda9f('0x0'));module[_0xda9f('0x1')]={'description':{'type':Sequelize[_0xda9f('0x2')]},'host':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0xda9f('0x3')],'defaultValue':!![]},'user':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0xda9f('0x2')]},'port':{'type':Sequelize['INTEGER']},'tls':{'type':Sequelize[_0xda9f('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize['STRING'],'defaultValue':_0xda9f('0x4')},'connTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'authTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'service':{'type':Sequelize['STRING']},'modernAuthentication':{'type':Sequelize[_0xda9f('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x7c27=['INTEGER','INBOX','STRING','BOOLEAN'];(function(_0x5e0042,_0x4b8f2d){var _0x24be57=function(_0x3c8c42){while(--_0x3c8c42){_0x5e0042['push'](_0x5e0042['shift']());}};_0x24be57(++_0x4b8f2d);}(_0x7c27,0x14a));var _0x77c2=function(_0x119e91,_0x31db75){_0x119e91=_0x119e91-0x0;var _0x4da145=_0x7c27[_0x119e91];return _0x4da145;};'use strict';var Sequelize=require('sequelize');module['exports']={'description':{'type':Sequelize[_0x77c2('0x0')]},'host':{'type':Sequelize[_0x77c2('0x0')]},'authentication':{'type':Sequelize[_0x77c2('0x1')],'defaultValue':!![]},'user':{'type':Sequelize[_0x77c2('0x0')]},'password':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x77c2('0x2')]},'tls':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x77c2('0x0')],'defaultValue':_0x77c2('0x3')},'connTimeout':{'type':Sequelize[_0x77c2('0x2')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x77c2('0x2')],'defaultValue':0x5},'service':{'type':Sequelize['STRING']},'modernAuthentication':{'type':Sequelize[_0x77c2('0x1')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index 31e24f3..4186d28 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 _0x143b=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','MailServerIn','mail_servers_in','lodash','util'];(function(_0x16d10f,_0x2ba2d5){var _0x50c823=function(_0x44e43f){while(--_0x44e43f){_0x16d10f['push'](_0x16d10f['shift']());}};_0x50c823(++_0x2ba2d5);}(_0x143b,0xb4));var _0xb143=function(_0x3207e7,_0x5ebfef){_0x3207e7=_0x3207e7-0x0;var _0x2f19bb=_0x143b[_0x3207e7];return _0x2f19bb;};'use strict';var _=require(_0xb143('0x0'));var util=require(_0xb143('0x1'));var logger=require(_0xb143('0x2'))(_0xb143('0x3'));var moment=require(_0xb143('0x4'));var BPromise=require(_0xb143('0x5'));var rp=require(_0xb143('0x6'));var fs=require('fs');var path=require(_0xb143('0x7'));var rimraf=require(_0xb143('0x8'));var config=require(_0xb143('0x9'));var attributes=require('./mailServerIn.attributes');module[_0xb143('0xa')]=function(_0xde9e33,_0x2ffd8e){return _0xde9e33[_0xb143('0xb')](_0xb143('0xc'),attributes,{'tableName':_0xb143('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfb20=['bluebird','path','rimraf','../../config/environment','./mailServerIn.attributes','exports','define','MailServerIn','mail_servers_in','lodash','util','../../config/logger','api','moment'];(function(_0x113887,_0x52d91c){var _0x43e1c8=function(_0x2b0d5a){while(--_0x2b0d5a){_0x113887['push'](_0x113887['shift']());}};_0x43e1c8(++_0x52d91c);}(_0xfb20,0x175));var _0x0fb2=function(_0x2b152a,_0x3dd988){_0x2b152a=_0x2b152a-0x0;var _0x2ad4c7=_0xfb20[_0x2b152a];return _0x2ad4c7;};'use strict';var _=require(_0x0fb2('0x0'));var util=require(_0x0fb2('0x1'));var logger=require(_0x0fb2('0x2'))(_0x0fb2('0x3'));var moment=require(_0x0fb2('0x4'));var BPromise=require(_0x0fb2('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0fb2('0x6'));var rimraf=require(_0x0fb2('0x7'));var config=require(_0x0fb2('0x8'));var attributes=require(_0x0fb2('0x9'));module[_0x0fb2('0xa')]=function(_0x29aad5,_0x5f781f){return _0x29aad5[_0x0fb2('0xb')](_0x0fb2('0xc'),attributes,{'tableName':_0x0fb2('0xd'),'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 d00683a..a8ceca8 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 _0x8145=['result','GetMailServerIn','MailServerIn','options','where','attributes','include','map','model','stringify','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','error','code','message','MailServerIn,\x20%s,\x20%s','info'];(function(_0x5d4f12,_0x11e67c){var _0x4eb577=function(_0x4d7a2d){while(--_0x4d7a2d){_0x5d4f12['push'](_0x5d4f12['shift']());}};_0x4eb577(++_0x11e67c);}(_0x8145,0xb8));var _0x5814=function(_0x21f931,_0x598b2d){_0x21f931=_0x21f931-0x0;var _0x3f083c=_0x8145[_0x21f931];return _0x3f083c;};'use strict';var _=require(_0x5814('0x0'));var util=require(_0x5814('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5814('0x2'));var fs=require('fs');var Redis=require(_0x5814('0x3'));var db=require(_0x5814('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x5814('0x5'))('rpc');var config=require(_0x5814('0x6'));var jayson=require(_0x5814('0x7'));var client=jayson[_0x5814('0x8')][_0x5814('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x35f284,_0x4739ae,_0x2a8717){return new BPromise(function(_0x1920be,_0x3ea1b0){return client[_0x5814('0xa')](_0x35f284,_0x2a8717)[_0x5814('0xb')](function(_0x8cbc38){logger['info']('MailServerIn,\x20%s,\x20%s',_0x4739ae,_0x5814('0xc'));logger[_0x5814('0xd')]('MailServerIn,\x20%s,\x20%s,\x20%s',_0x4739ae,_0x5814('0xc'),JSON['stringify'](_0x8cbc38));if(_0x8cbc38[_0x5814('0xe')]){if(_0x8cbc38['error'][_0x5814('0xf')]===0x1f4){logger[_0x5814('0xe')]('MailServerIn,\x20%s,\x20%s',_0x4739ae,_0x8cbc38[_0x5814('0xe')]['message']);return _0x3ea1b0(_0x8cbc38[_0x5814('0xe')][_0x5814('0x10')]);}logger[_0x5814('0xe')](_0x5814('0x11'),_0x4739ae,_0x8cbc38[_0x5814('0xe')]['message']);return _0x1920be(_0x8cbc38[_0x5814('0xe')][_0x5814('0x10')]);}else{logger[_0x5814('0x12')]('MailServerIn,\x20%s,\x20%s',_0x4739ae,_0x5814('0xc'));_0x1920be(_0x8cbc38[_0x5814('0x13')]['message']);}})['catch'](function(_0x3ad4c8){logger['error']('MailServerIn,\x20%s,\x20%s',_0x4739ae,_0x3ad4c8);_0x3ea1b0(_0x3ad4c8);});});}exports[_0x5814('0x14')]=function(_0xcf49e6){var _0x5d46e9=this;return new Promise(function(_0xab381c,_0x5e6e63){return db[_0x5814('0x15')]['findAll']({'raw':_0xcf49e6[_0x5814('0x16')]?_0xcf49e6[_0x5814('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0xcf49e6[_0x5814('0x16')]?_0xcf49e6[_0x5814('0x16')][_0x5814('0x17')]||null:null,'attributes':_0xcf49e6[_0x5814('0x16')]?_0xcf49e6[_0x5814('0x16')][_0x5814('0x18')]||null:null,'limit':_0xcf49e6[_0x5814('0x16')]?_0xcf49e6[_0x5814('0x16')]['limit']||null:null,'include':_0xcf49e6[_0x5814('0x16')]?_0xcf49e6[_0x5814('0x16')][_0x5814('0x19')]?_[_0x5814('0x1a')](_0xcf49e6[_0x5814('0x16')]['include'],function(_0x4764da){return{'model':db[_0x4764da[_0x5814('0x1b')]],'as':_0x4764da['as'],'attributes':_0x4764da[_0x5814('0x18')],'include':_0x4764da[_0x5814('0x19')]?_[_0x5814('0x1a')](_0x4764da[_0x5814('0x19')],function(_0x4d7755){return{'model':db[_0x4d7755[_0x5814('0x1b')]],'as':_0x4d7755['as'],'attributes':_0x4d7755[_0x5814('0x18')],'include':_0x4d7755['include']?_[_0x5814('0x1a')](_0x4d7755[_0x5814('0x19')],function(_0x4df952){return{'model':db[_0x4df952[_0x5814('0x1b')]],'as':_0x4df952['as'],'attributes':_0x4df952[_0x5814('0x18')]};}):[]};}):[]};}):[]:[]})[_0x5814('0xb')](function(_0xff4fb){logger[_0x5814('0x12')]('GetMailServerIn',_0xcf49e6);logger[_0x5814('0xd')](_0x5814('0x14'),_0xcf49e6,JSON[_0x5814('0x1c')](_0xff4fb));_0xab381c(_0xff4fb);})['catch'](function(_0xc87644){logger['error'](_0x5814('0x14'),_0xc87644[_0x5814('0x10')],_0xcf49e6);_0x5e6e63(_0x5d46e9[_0x5814('0xe')](0x1f4,_0xc87644[_0x5814('0x10')]));});});}; \ No newline at end of file +var _0x22fb=['request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','code','message','error','result','catch','MailServerIn','findAll','options','where','limit','include','map','attributes','model','GetMailServerIn','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','MailServerIn,\x20%s,\x20%s'];(function(_0x52a933,_0x3d69b9){var _0xc43140=function(_0x23df96){while(--_0x23df96){_0x52a933['push'](_0x52a933['shift']());}};_0xc43140(++_0x3d69b9);}(_0x22fb,0x192));var _0xb22f=function(_0x1c6c82,_0x311ed0){_0x1c6c82=_0x1c6c82-0x0;var _0x3e50cf=_0x22fb[_0x1c6c82];return _0x3e50cf;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xb22f('0x0'));var BPromise=require('bluebird');var rs=require(_0xb22f('0x1'));var fs=require('fs');var Redis=require(_0xb22f('0x2'));var db=require(_0xb22f('0x3'))['db'];var utils=require(_0xb22f('0x4'));var logger=require(_0xb22f('0x5'))('rpc');var config=require(_0xb22f('0x6'));var jayson=require(_0xb22f('0x7'));var client=jayson[_0xb22f('0x8')][_0xb22f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x412a95,_0x367d4b,_0x47f61a){return new BPromise(function(_0x34433b,_0x22c509){return client[_0xb22f('0xa')](_0x412a95,_0x47f61a)[_0xb22f('0xb')](function(_0x1a3aae){logger[_0xb22f('0xc')](_0xb22f('0xd'),_0x367d4b,_0xb22f('0xe'));logger[_0xb22f('0xf')](_0xb22f('0x10'),_0x367d4b,_0xb22f('0xe'),JSON['stringify'](_0x1a3aae));if(_0x1a3aae['error']){if(_0x1a3aae['error'][_0xb22f('0x11')]===0x1f4){logger['error']('MailServerIn,\x20%s,\x20%s',_0x367d4b,_0x1a3aae['error'][_0xb22f('0x12')]);return _0x22c509(_0x1a3aae[_0xb22f('0x13')][_0xb22f('0x12')]);}logger[_0xb22f('0x13')](_0xb22f('0xd'),_0x367d4b,_0x1a3aae[_0xb22f('0x13')]['message']);return _0x34433b(_0x1a3aae[_0xb22f('0x13')]['message']);}else{logger[_0xb22f('0xc')]('MailServerIn,\x20%s,\x20%s',_0x367d4b,_0xb22f('0xe'));_0x34433b(_0x1a3aae[_0xb22f('0x14')][_0xb22f('0x12')]);}})[_0xb22f('0x15')](function(_0x447eaf){logger['error'](_0xb22f('0xd'),_0x367d4b,_0x447eaf);_0x22c509(_0x447eaf);});});}exports['GetMailServerIn']=function(_0x252742){var _0x35caec=this;return new Promise(function(_0x2aaec4,_0x1f515d){return db[_0xb22f('0x16')][_0xb22f('0x17')]({'raw':_0x252742['options']?_0x252742[_0xb22f('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x252742[_0xb22f('0x18')]?_0x252742[_0xb22f('0x18')][_0xb22f('0x19')]||null:null,'attributes':_0x252742[_0xb22f('0x18')]?_0x252742[_0xb22f('0x18')]['attributes']||null:null,'limit':_0x252742['options']?_0x252742[_0xb22f('0x18')][_0xb22f('0x1a')]||null:null,'include':_0x252742[_0xb22f('0x18')]?_0x252742[_0xb22f('0x18')][_0xb22f('0x1b')]?_[_0xb22f('0x1c')](_0x252742[_0xb22f('0x18')][_0xb22f('0x1b')],function(_0x583fbe){return{'model':db[_0x583fbe['model']],'as':_0x583fbe['as'],'attributes':_0x583fbe[_0xb22f('0x1d')],'include':_0x583fbe[_0xb22f('0x1b')]?_['map'](_0x583fbe[_0xb22f('0x1b')],function(_0x4364f5){return{'model':db[_0x4364f5['model']],'as':_0x4364f5['as'],'attributes':_0x4364f5[_0xb22f('0x1d')],'include':_0x4364f5[_0xb22f('0x1b')]?_['map'](_0x4364f5[_0xb22f('0x1b')],function(_0x2c4a9e){return{'model':db[_0x2c4a9e[_0xb22f('0x1e')]],'as':_0x2c4a9e['as'],'attributes':_0x2c4a9e[_0xb22f('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xb22f('0xb')](function(_0x246a0c){logger[_0xb22f('0xc')](_0xb22f('0x1f'),_0x252742);logger['debug']('GetMailServerIn',_0x252742,JSON['stringify'](_0x246a0c));_0x2aaec4(_0x246a0c);})[_0xb22f('0x15')](function(_0x557d96){logger[_0xb22f('0x13')](_0xb22f('0x1f'),_0x557d96[_0xb22f('0x12')],_0x252742);_0x1f515d(_0x35caec[_0xb22f('0x13')](0x1f4,_0x557d96[_0xb22f('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index c4bee6e..4ad317b 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(_0x491a7f,_0x28bb80){var _0x3d8f44=function(_0xdaa716){while(--_0xdaa716){_0x491a7f['push'](_0x491a7f['shift']());}};_0x3d8f44(++_0x28bb80);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'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 _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(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_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 diff --git a/server/api/mailServerOut/mailServerOut.attributes.js b/server/api/mailServerOut/mailServerOut.attributes.js index b5432ab..796af9d 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 _0x44a3=['sequelize','exports','STRING','INTEGER','BOOLEAN'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x44a3,0x1a9));var _0x344a=function(_0x2a1185,_0x2740c5){_0x2a1185=_0x2a1185-0x0;var _0x5588d9=_0x44a3[_0x2a1185];return _0x5588d9;};'use strict';var Sequelize=require(_0x344a('0x0'));module[_0x344a('0x1')]={'description':{'type':Sequelize[_0x344a('0x2')]},'host':{'type':Sequelize[_0x344a('0x2')]},'user':{'type':Sequelize[_0x344a('0x2')]},'pass':{'type':Sequelize[_0x344a('0x2')]},'port':{'type':Sequelize[_0x344a('0x3')]},'secure':{'type':Sequelize[_0x344a('0x4')],'defaultValue':![]},'service':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0x344a('0x4')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0x344a('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0xe2cf=['BOOLEAN','exports','STRING','INTEGER'];(function(_0x2f958d,_0x234018){var _0x4de744=function(_0x3b1cf0){while(--_0x3b1cf0){_0x2f958d['push'](_0x2f958d['shift']());}};_0x4de744(++_0x234018);}(_0xe2cf,0x1a1));var _0xfe2c=function(_0x58d5ac,_0x11c4bc){_0x58d5ac=_0x58d5ac-0x0;var _0x37985c=_0xe2cf[_0x58d5ac];return _0x37985c;};'use strict';var Sequelize=require('sequelize');module[_0xfe2c('0x0')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0xfe2c('0x1')]},'user':{'type':Sequelize['STRING']},'pass':{'type':Sequelize[_0xfe2c('0x1')]},'port':{'type':Sequelize[_0xfe2c('0x2')]},'secure':{'type':Sequelize[_0xfe2c('0x3')],'defaultValue':![]},'service':{'type':Sequelize[_0xfe2c('0x1')]},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0xfe2c('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index 76dfdb6..5aaaa2b 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 _0x83f4=['length','query','order','sort','where','merge','map','type','VIRTUAL','MailServerOut','includeAll','findAll','rows','catch','show','keys','include','create','body','find','params','destroy','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','set','apply','reject','update','then','name','rawAttributes','fieldName','filters','attributes','intersection','model','fields'];(function(_0x20a59e,_0x4fcc34){var _0x5922f7=function(_0x330828){while(--_0x330828){_0x20a59e['push'](_0x20a59e['shift']());}};_0x5922f7(++_0x4fcc34);}(_0x83f4,0x1c6));var _0x483f=function(_0x5602f5,_0x1208e6){_0x5602f5=_0x5602f5-0x0;var _0x34b14a=_0x83f4[_0x5602f5];return _0x34b14a;};'use strict';var emlformat=require(_0x483f('0x0'));var rimraf=require(_0x483f('0x1'));var zipdir=require(_0x483f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x483f('0x3'));var moment=require(_0x483f('0x4'));var BPromise=require(_0x483f('0x5'));var Mustache=require(_0x483f('0x6'));var util=require(_0x483f('0x7'));var path=require(_0x483f('0x8'));var sox=require(_0x483f('0x9'));var csv=require(_0x483f('0xa'));var ejs=require(_0x483f('0xb'));var fs=require('fs');var fs_extra=require(_0x483f('0xc'));var _=require(_0x483f('0xd'));var squel=require(_0x483f('0xe'));var crypto=require(_0x483f('0xf'));var jsforce=require(_0x483f('0x10'));var deskjs=require(_0x483f('0x11'));var toCsv=require(_0x483f('0xa'));var querystring=require(_0x483f('0x12'));var Papa=require(_0x483f('0x13'));var Redis=require(_0x483f('0x14'));var authService=require(_0x483f('0x15'));var qs=require(_0x483f('0x16'));var as=require(_0x483f('0x17'));var hardwareService=require(_0x483f('0x18'));var logger=require('../../config/logger')(_0x483f('0x19'));var utils=require(_0x483f('0x1a'));var config=require('../../config/environment');var licenseUtil=require(_0x483f('0x1b'));var db=require(_0x483f('0x1c'))['db'];function respondWithStatusCode(_0x4e3b2f,_0x37c851){_0x37c851=_0x37c851||0xcc;return function(_0x33f6ac){if(_0x33f6ac){return _0x4e3b2f[_0x483f('0x1d')](_0x37c851);}return _0x4e3b2f['status'](_0x37c851)[_0x483f('0x1e')]();};}function respondWithResult(_0x9f47c7,_0x4b3063){_0x4b3063=_0x4b3063||0xc8;return function(_0x3184c3){if(_0x3184c3){return _0x9f47c7[_0x483f('0x1f')](_0x4b3063)[_0x483f('0x20')](_0x3184c3);}};}function respondWithFilteredResult(_0x490464,_0x26579d){return function(_0x3e5b10){if(_0x3e5b10){var _0x5bf010=typeof _0x26579d[_0x483f('0x21')]===_0x483f('0x22')&&typeof _0x26579d['limit']===_0x483f('0x22');var _0x283d81=_0x3e5b10[_0x483f('0x23')];var _0x131596=_0x5bf010?0x0:_0x26579d[_0x483f('0x21')];var _0x1e3ee5=_0x5bf010?_0x3e5b10['count']:_0x26579d[_0x483f('0x21')]+_0x26579d[_0x483f('0x24')];var _0x28afb3;if(_0x1e3ee5>=_0x283d81){_0x1e3ee5=_0x283d81;_0x28afb3=0xc8;}else{_0x28afb3=0xce;}_0x490464[_0x483f('0x1f')](_0x28afb3);return _0x490464[_0x483f('0x25')]('Content-Range',_0x131596+'-'+_0x1e3ee5+'/'+_0x283d81)[_0x483f('0x20')](_0x3e5b10);}return null;};}function patchUpdates(_0x33bbdb){return function(_0x3f18f1){try{jsonpatch[_0x483f('0x26')](_0x3f18f1,_0x33bbdb,!![]);}catch(_0x30a9fb){return BPromise[_0x483f('0x27')](_0x30a9fb);}return _0x3f18f1['save']();};}function saveUpdates(_0x48537e,_0x1c8350){return function(_0x441843){if(_0x441843){return _0x441843[_0x483f('0x28')](_0x48537e)[_0x483f('0x29')](function(_0x173a91){return _0x173a91;});}return null;};}function removeEntity(_0x4b76df,_0x4f66c8){return function(_0x187bcc){if(_0x187bcc){return _0x187bcc['destroy']()[_0x483f('0x29')](function(){_0x4b76df[_0x483f('0x1f')](0xcc)[_0x483f('0x1e')]();});}};}function handleEntityNotFound(_0xe3d430,_0x285816){return function(_0x1e661c){if(!_0x1e661c){_0xe3d430[_0x483f('0x1d')](0x194);}return _0x1e661c;};}function handleError(_0x1b065c,_0x3bc3dd){_0x3bc3dd=_0x3bc3dd||0x1f4;return function(_0x25171e){logger['error'](_0x25171e['stack']);if(_0x25171e[_0x483f('0x2a')]){delete _0x25171e[_0x483f('0x2a')];}_0x1b065c[_0x483f('0x1f')](_0x3bc3dd)['send'](_0x25171e);};}exports['index']=function(_0x4410e8,_0x5c406f){var _0x52e0cb={},_0x3a6e2b={},_0x4d9798={'count':0x0,'rows':[]};var _0x27dd39=_['map'](db['MailServerOut'][_0x483f('0x2b')],function(_0x5d345e){return{'name':_0x5d345e[_0x483f('0x2c')],'type':_0x5d345e['type']['key']};});_0x3a6e2b['model']=_['map'](_0x27dd39,_0x483f('0x2a'));_0x3a6e2b['query']=_['keys'](_0x4410e8['query']);_0x3a6e2b[_0x483f('0x2d')]=_['intersection'](_0x3a6e2b['model'],_0x3a6e2b['query']);_0x52e0cb[_0x483f('0x2e')]=_[_0x483f('0x2f')](_0x3a6e2b[_0x483f('0x30')],qs[_0x483f('0x31')](_0x4410e8['query']['fields']));_0x52e0cb[_0x483f('0x2e')]=_0x52e0cb['attributes'][_0x483f('0x32')]?_0x52e0cb['attributes']:_0x3a6e2b['model'];if(!_0x4410e8[_0x483f('0x33')]['hasOwnProperty']('nolimit')){_0x52e0cb[_0x483f('0x24')]=qs[_0x483f('0x24')](_0x4410e8['query'][_0x483f('0x24')]);_0x52e0cb[_0x483f('0x21')]=qs['offset'](_0x4410e8[_0x483f('0x33')][_0x483f('0x21')]);}_0x52e0cb[_0x483f('0x34')]=qs[_0x483f('0x35')](_0x4410e8['query']['sort']);_0x52e0cb['where']=qs['filters'](_['pick'](_0x4410e8[_0x483f('0x33')],_0x3a6e2b[_0x483f('0x2d')]),_0x27dd39);if(_0x4410e8[_0x483f('0x33')]['filter']){_0x52e0cb[_0x483f('0x36')]=_[_0x483f('0x37')](_0x52e0cb[_0x483f('0x36')],{'$or':_[_0x483f('0x38')](_0x27dd39,function(_0x513f31){if(_0x513f31[_0x483f('0x39')]!==_0x483f('0x3a')){var _0x21d8a3={};_0x21d8a3[_0x513f31[_0x483f('0x2a')]]={'$like':'%'+_0x4410e8[_0x483f('0x33')]['filter']+'%'};return _0x21d8a3;}})});}_0x52e0cb=_[_0x483f('0x37')]({},_0x52e0cb,_0x4410e8['options']);var _0x48e3ac={'where':_0x52e0cb[_0x483f('0x36')]};return db[_0x483f('0x3b')][_0x483f('0x23')](_0x48e3ac)[_0x483f('0x29')](function(_0x156a99){_0x4d9798[_0x483f('0x23')]=_0x156a99;if(_0x4410e8[_0x483f('0x33')][_0x483f('0x3c')]){_0x52e0cb['include']=[{'all':!![]}];}return db['MailServerOut'][_0x483f('0x3d')](_0x52e0cb);})[_0x483f('0x29')](function(_0x4bb110){_0x4d9798[_0x483f('0x3e')]=_0x4bb110;return _0x4d9798;})[_0x483f('0x29')](respondWithFilteredResult(_0x5c406f,_0x52e0cb))[_0x483f('0x3f')](handleError(_0x5c406f,null));};exports[_0x483f('0x40')]=function(_0x4e6b6c,_0xa48f3e){var _0x4df23c={'raw':!![],'where':{'id':_0x4e6b6c['params']['id']}},_0x5891a={};_0x5891a['model']=_['keys'](db[_0x483f('0x3b')][_0x483f('0x2b')]);_0x5891a[_0x483f('0x33')]=_[_0x483f('0x41')](_0x4e6b6c['query']);_0x5891a[_0x483f('0x2d')]=_[_0x483f('0x2f')](_0x5891a[_0x483f('0x30')],_0x5891a[_0x483f('0x33')]);_0x4df23c[_0x483f('0x2e')]=_[_0x483f('0x2f')](_0x5891a[_0x483f('0x30')],qs['fields'](_0x4e6b6c[_0x483f('0x33')][_0x483f('0x31')]));_0x4df23c[_0x483f('0x2e')]=_0x4df23c[_0x483f('0x2e')][_0x483f('0x32')]?_0x4df23c[_0x483f('0x2e')]:_0x5891a[_0x483f('0x30')];if(_0x4e6b6c[_0x483f('0x33')][_0x483f('0x3c')]){_0x4df23c[_0x483f('0x42')]=[{'all':!![]}];}_0x4df23c=_[_0x483f('0x37')]({},_0x4df23c,_0x4e6b6c['options']);return db[_0x483f('0x3b')]['find'](_0x4df23c)[_0x483f('0x29')](handleEntityNotFound(_0xa48f3e,null))[_0x483f('0x29')](respondWithResult(_0xa48f3e,null))['catch'](handleError(_0xa48f3e,null));};exports['create']=function(_0x5e4ee7,_0x51720c){return db[_0x483f('0x3b')][_0x483f('0x43')](_0x5e4ee7[_0x483f('0x44')],{})[_0x483f('0x29')](respondWithResult(_0x51720c,0xc9))[_0x483f('0x3f')](handleError(_0x51720c,null));};exports[_0x483f('0x28')]=function(_0xe2ea93,_0x279301){if(_0xe2ea93[_0x483f('0x44')]['id']){delete _0xe2ea93['body']['id'];}return db['MailServerOut'][_0x483f('0x45')]({'where':{'id':_0xe2ea93[_0x483f('0x46')]['id']}})[_0x483f('0x29')](handleEntityNotFound(_0x279301,null))[_0x483f('0x29')](saveUpdates(_0xe2ea93[_0x483f('0x44')],null))[_0x483f('0x29')](respondWithResult(_0x279301,null))[_0x483f('0x3f')](handleError(_0x279301,null));};exports[_0x483f('0x47')]=function(_0x4bfbe9,_0x5a7a6b){return db[_0x483f('0x3b')][_0x483f('0x45')]({'where':{'id':_0x4bfbe9['params']['id']}})[_0x483f('0x29')](handleEntityNotFound(_0x5a7a6b,null))[_0x483f('0x29')](removeEntity(_0x5a7a6b,null))[_0x483f('0x3f')](handleError(_0x5a7a6b,null));}; \ No newline at end of file +var _0xa1cb=['mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','status','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','destroy','end','error','name','map','MailServerOut','rawAttributes','key','model','keys','filters','query','intersection','fields','attributes','sort','pick','merge','type','VIRTUAL','options','where','includeAll','include','findAll','rows','catch','show','find','create','body','params','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0x28f9a3,_0x894f6){var _0x5d9b59=function(_0xdfc3c4){while(--_0xdfc3c4){_0x28f9a3['push'](_0x28f9a3['shift']());}};_0x5d9b59(++_0x894f6);}(_0xa1cb,0x18d));var _0xba1c=function(_0x41ea22,_0x3b31f4){_0x41ea22=_0x41ea22-0x0;var _0x9694d3=_0xa1cb[_0x41ea22];return _0x9694d3;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xba1c('0x0'));var jsonpatch=require(_0xba1c('0x1'));var rp=require(_0xba1c('0x2'));var moment=require(_0xba1c('0x3'));var BPromise=require(_0xba1c('0x4'));var Mustache=require(_0xba1c('0x5'));var util=require(_0xba1c('0x6'));var path=require(_0xba1c('0x7'));var sox=require(_0xba1c('0x8'));var csv=require(_0xba1c('0x9'));var ejs=require(_0xba1c('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xba1c('0xb'));var squel=require('squel');var crypto=require(_0xba1c('0xc'));var jsforce=require(_0xba1c('0xd'));var deskjs=require(_0xba1c('0xe'));var toCsv=require(_0xba1c('0x9'));var querystring=require('querystring');var Papa=require(_0xba1c('0xf'));var Redis=require('ioredis');var authService=require(_0xba1c('0x10'));var qs=require(_0xba1c('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xba1c('0x12'));var logger=require(_0xba1c('0x13'))(_0xba1c('0x14'));var utils=require('../../config/utils');var config=require(_0xba1c('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xba1c('0x16'))['db'];function respondWithStatusCode(_0x4e9810,_0x179d04){_0x179d04=_0x179d04||0xcc;return function(_0x34ce03){if(_0x34ce03){return _0x4e9810['sendStatus'](_0x179d04);}return _0x4e9810[_0xba1c('0x17')](_0x179d04)['end']();};}function respondWithResult(_0x1086c5,_0x4ecb05){_0x4ecb05=_0x4ecb05||0xc8;return function(_0x57f024){if(_0x57f024){return _0x1086c5['status'](_0x4ecb05)[_0xba1c('0x18')](_0x57f024);}};}function respondWithFilteredResult(_0x31d094,_0x50ec11){return function(_0xd5f61e){if(_0xd5f61e){var _0x13c4bb=typeof _0x50ec11[_0xba1c('0x19')]==='undefined'&&typeof _0x50ec11[_0xba1c('0x1a')]===_0xba1c('0x1b');var _0x23bd2c=_0xd5f61e[_0xba1c('0x1c')];var _0x3b7598=_0x13c4bb?0x0:_0x50ec11[_0xba1c('0x19')];var _0x3be4ab=_0x13c4bb?_0xd5f61e[_0xba1c('0x1c')]:_0x50ec11[_0xba1c('0x19')]+_0x50ec11[_0xba1c('0x1a')];var _0x71580c;if(_0x3be4ab>=_0x23bd2c){_0x3be4ab=_0x23bd2c;_0x71580c=0xc8;}else{_0x71580c=0xce;}_0x31d094['status'](_0x71580c);return _0x31d094['set'](_0xba1c('0x1d'),_0x3b7598+'-'+_0x3be4ab+'/'+_0x23bd2c)[_0xba1c('0x18')](_0xd5f61e);}return null;};}function patchUpdates(_0x457d99){return function(_0x3daad2){try{jsonpatch[_0xba1c('0x1e')](_0x3daad2,_0x457d99,!![]);}catch(_0x5d9ce1){return BPromise[_0xba1c('0x1f')](_0x5d9ce1);}return _0x3daad2[_0xba1c('0x20')]();};}function saveUpdates(_0xe0f384,_0x329695){return function(_0xd59e3a){if(_0xd59e3a){return _0xd59e3a[_0xba1c('0x21')](_0xe0f384)[_0xba1c('0x22')](function(_0x45bf92){return _0x45bf92;});}return null;};}function removeEntity(_0x1092a9,_0x42c492){return function(_0x4e20df){if(_0x4e20df){return _0x4e20df[_0xba1c('0x23')]()['then'](function(){_0x1092a9['status'](0xcc)[_0xba1c('0x24')]();});}};}function handleEntityNotFound(_0x51d570,_0x178a4f){return function(_0x2ef7b1){if(!_0x2ef7b1){_0x51d570['sendStatus'](0x194);}return _0x2ef7b1;};}function handleError(_0x4db566,_0x4ffc7b){_0x4ffc7b=_0x4ffc7b||0x1f4;return function(_0xecd3f4){logger[_0xba1c('0x25')](_0xecd3f4['stack']);if(_0xecd3f4[_0xba1c('0x26')]){delete _0xecd3f4[_0xba1c('0x26')];}_0x4db566[_0xba1c('0x17')](_0x4ffc7b)['send'](_0xecd3f4);};}exports['index']=function(_0x335d7d,_0x4c7f6b){var _0x1d35e8={},_0x3840e3={},_0x33aa0b={'count':0x0,'rows':[]};var _0x5e3c2a=_[_0xba1c('0x27')](db[_0xba1c('0x28')][_0xba1c('0x29')],function(_0x180f0f){return{'name':_0x180f0f['fieldName'],'type':_0x180f0f['type'][_0xba1c('0x2a')]};});_0x3840e3[_0xba1c('0x2b')]=_[_0xba1c('0x27')](_0x5e3c2a,'name');_0x3840e3['query']=_[_0xba1c('0x2c')](_0x335d7d['query']);_0x3840e3[_0xba1c('0x2d')]=_['intersection'](_0x3840e3[_0xba1c('0x2b')],_0x3840e3[_0xba1c('0x2e')]);_0x1d35e8['attributes']=_[_0xba1c('0x2f')](_0x3840e3['model'],qs[_0xba1c('0x30')](_0x335d7d[_0xba1c('0x2e')][_0xba1c('0x30')]));_0x1d35e8[_0xba1c('0x31')]=_0x1d35e8['attributes']['length']?_0x1d35e8[_0xba1c('0x31')]:_0x3840e3['model'];if(!_0x335d7d[_0xba1c('0x2e')]['hasOwnProperty']('nolimit')){_0x1d35e8[_0xba1c('0x1a')]=qs[_0xba1c('0x1a')](_0x335d7d[_0xba1c('0x2e')][_0xba1c('0x1a')]);_0x1d35e8['offset']=qs[_0xba1c('0x19')](_0x335d7d[_0xba1c('0x2e')][_0xba1c('0x19')]);}_0x1d35e8['order']=qs[_0xba1c('0x32')](_0x335d7d[_0xba1c('0x2e')][_0xba1c('0x32')]);_0x1d35e8['where']=qs['filters'](_[_0xba1c('0x33')](_0x335d7d[_0xba1c('0x2e')],_0x3840e3[_0xba1c('0x2d')]),_0x5e3c2a);if(_0x335d7d[_0xba1c('0x2e')]['filter']){_0x1d35e8['where']=_[_0xba1c('0x34')](_0x1d35e8['where'],{'$or':_[_0xba1c('0x27')](_0x5e3c2a,function(_0x35477d){if(_0x35477d[_0xba1c('0x35')]!==_0xba1c('0x36')){var _0x4aa796={};_0x4aa796[_0x35477d['name']]={'$like':'%'+_0x335d7d[_0xba1c('0x2e')]['filter']+'%'};return _0x4aa796;}})});}_0x1d35e8=_['merge']({},_0x1d35e8,_0x335d7d[_0xba1c('0x37')]);var _0x131a45={'where':_0x1d35e8[_0xba1c('0x38')]};return db['MailServerOut'][_0xba1c('0x1c')](_0x131a45)[_0xba1c('0x22')](function(_0x993558){_0x33aa0b['count']=_0x993558;if(_0x335d7d['query'][_0xba1c('0x39')]){_0x1d35e8[_0xba1c('0x3a')]=[{'all':!![]}];}return db['MailServerOut'][_0xba1c('0x3b')](_0x1d35e8);})[_0xba1c('0x22')](function(_0x4d3a17){_0x33aa0b[_0xba1c('0x3c')]=_0x4d3a17;return _0x33aa0b;})[_0xba1c('0x22')](respondWithFilteredResult(_0x4c7f6b,_0x1d35e8))[_0xba1c('0x3d')](handleError(_0x4c7f6b,null));};exports[_0xba1c('0x3e')]=function(_0x2f8e41,_0xefc44b){var _0x4b5942={'raw':!![],'where':{'id':_0x2f8e41['params']['id']}},_0x232d06={};_0x232d06[_0xba1c('0x2b')]=_[_0xba1c('0x2c')](db[_0xba1c('0x28')]['rawAttributes']);_0x232d06['query']=_[_0xba1c('0x2c')](_0x2f8e41[_0xba1c('0x2e')]);_0x232d06[_0xba1c('0x2d')]=_[_0xba1c('0x2f')](_0x232d06[_0xba1c('0x2b')],_0x232d06[_0xba1c('0x2e')]);_0x4b5942[_0xba1c('0x31')]=_[_0xba1c('0x2f')](_0x232d06['model'],qs['fields'](_0x2f8e41[_0xba1c('0x2e')][_0xba1c('0x30')]));_0x4b5942['attributes']=_0x4b5942['attributes']['length']?_0x4b5942['attributes']:_0x232d06[_0xba1c('0x2b')];if(_0x2f8e41[_0xba1c('0x2e')][_0xba1c('0x39')]){_0x4b5942[_0xba1c('0x3a')]=[{'all':!![]}];}_0x4b5942=_[_0xba1c('0x34')]({},_0x4b5942,_0x2f8e41[_0xba1c('0x37')]);return db[_0xba1c('0x28')][_0xba1c('0x3f')](_0x4b5942)[_0xba1c('0x22')](handleEntityNotFound(_0xefc44b,null))[_0xba1c('0x22')](respondWithResult(_0xefc44b,null))[_0xba1c('0x3d')](handleError(_0xefc44b,null));};exports[_0xba1c('0x40')]=function(_0x1c81b4,_0x12ac8a){return db[_0xba1c('0x28')][_0xba1c('0x40')](_0x1c81b4[_0xba1c('0x41')],{})[_0xba1c('0x22')](respondWithResult(_0x12ac8a,0xc9))['catch'](handleError(_0x12ac8a,null));};exports[_0xba1c('0x21')]=function(_0x428455,_0x13085f){if(_0x428455[_0xba1c('0x41')]['id']){delete _0x428455[_0xba1c('0x41')]['id'];}return db[_0xba1c('0x28')][_0xba1c('0x3f')]({'where':{'id':_0x428455[_0xba1c('0x42')]['id']}})[_0xba1c('0x22')](handleEntityNotFound(_0x13085f,null))[_0xba1c('0x22')](saveUpdates(_0x428455[_0xba1c('0x41')],null))['then'](respondWithResult(_0x13085f,null))['catch'](handleError(_0x13085f,null));};exports[_0xba1c('0x23')]=function(_0x391df0,_0x9d0127){return db[_0xba1c('0x28')]['find']({'where':{'id':_0x391df0['params']['id']}})['then'](handleEntityNotFound(_0x9d0127,null))['then'](removeEntity(_0x9d0127,null))['catch'](handleError(_0x9d0127,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index 4a7abf8..3f8015f 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 _0xb845=['exports','define','MailServerOut','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailServerOut.attributes'];(function(_0x2c7c18,_0x4900be){var _0x4b2df4=function(_0x250b64){while(--_0x250b64){_0x2c7c18['push'](_0x2c7c18['shift']());}};_0x4b2df4(++_0x4900be);}(_0xb845,0x114));var _0x5b84=function(_0x50f469,_0x1439fc){_0x50f469=_0x50f469-0x0;var _0x4af9d4=_0xb845[_0x50f469];return _0x4af9d4;};'use strict';var _=require(_0x5b84('0x0'));var util=require('util');var logger=require(_0x5b84('0x1'))(_0x5b84('0x2'));var moment=require(_0x5b84('0x3'));var BPromise=require(_0x5b84('0x4'));var rp=require(_0x5b84('0x5'));var fs=require('fs');var path=require(_0x5b84('0x6'));var rimraf=require(_0x5b84('0x7'));var config=require(_0x5b84('0x8'));var attributes=require(_0x5b84('0x9'));module[_0x5b84('0xa')]=function(_0x59b069,_0x1517f8){return _0x59b069[_0x5b84('0xb')](_0x5b84('0xc'),attributes,{'tableName':'mail_servers_out','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9462=['api','moment','bluebird','request-promise','path','../../config/environment','./mailServerOut.attributes','exports','define','MailServerOut','lodash','util','../../config/logger'];(function(_0xbb1b4a,_0x31eaab){var _0x13292e=function(_0x38e08b){while(--_0x38e08b){_0xbb1b4a['push'](_0xbb1b4a['shift']());}};_0x13292e(++_0x31eaab);}(_0x9462,0x1c4));var _0x2946=function(_0x4df5d2,_0x148d3c){_0x4df5d2=_0x4df5d2-0x0;var _0x27806f=_0x9462[_0x4df5d2];return _0x27806f;};'use strict';var _=require(_0x2946('0x0'));var util=require(_0x2946('0x1'));var logger=require(_0x2946('0x2'))(_0x2946('0x3'));var moment=require(_0x2946('0x4'));var BPromise=require(_0x2946('0x5'));var rp=require(_0x2946('0x6'));var fs=require('fs');var path=require(_0x2946('0x7'));var rimraf=require('rimraf');var config=require(_0x2946('0x8'));var attributes=require(_0x2946('0x9'));module[_0x2946('0xa')]=function(_0x1ba02b,_0x1c93a8){return _0x1ba02b[_0x2946('0xb')](_0x2946('0xc'),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 97ee8dc..b95bbc2 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 _0x5f2f=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','MailServerOut,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch'];(function(_0x1a3dfb,_0x1496d3){var _0x2e881c=function(_0x5d3cba){while(--_0x5d3cba){_0x1a3dfb['push'](_0x1a3dfb['shift']());}};_0x2e881c(++_0x1496d3);}(_0x5f2f,0x73));var _0xf5f2=function(_0x3813da,_0x253dac){_0x3813da=_0x3813da-0x0;var _0x488a52=_0x5f2f[_0x3813da];return _0x488a52;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3133bc,_0x473100,_0x5907aa){return new BPromise(function(_0x466882,_0x46cd9c){return client[_0xf5f2('0xc')](_0x3133bc,_0x5907aa)['then'](function(_0x375da4){logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,'request\x20sent');logger[_0xf5f2('0xf')]('MailServerOut,\x20%s,\x20%s,\x20%s',_0x473100,'request\x20sent',JSON[_0xf5f2('0x10')](_0x375da4));if(_0x375da4[_0xf5f2('0x11')]){if(_0x375da4['error'][_0xf5f2('0x12')]===0x1f4){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x46cd9c(_0x375da4[_0xf5f2('0x11')]['message']);}logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x466882(_0x375da4[_0xf5f2('0x11')]['message']);}else{logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,_0xf5f2('0x14'));_0x466882(_0x375da4[_0xf5f2('0x15')][_0xf5f2('0x13')]);}})[_0xf5f2('0x16')](function(_0xdb61b3){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0xdb61b3);_0x46cd9c(_0xdb61b3);});});} \ No newline at end of file +var _0x7a54=['info','MailServerOut,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x7a54,0x106));var _0x47a5=function(_0x58e1e0,_0x1a653b){_0x58e1e0=_0x58e1e0-0x0;var _0x43f383=_0x7a54[_0x58e1e0];return _0x43f383;};'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')]('MailServerOut,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index a0d989a..30a5a44 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 _0x7c71=['get','isAuthenticated','index','describe','/:id','show','post','create','put','delete','destroy','exports','multer','util','express','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x3a8763,_0x46d367){var _0x127f62=function(_0x3d714c){while(--_0x3d714c){_0x3a8763['push'](_0x3a8763['shift']());}};_0x127f62(++_0x46d367);}(_0x7c71,0xd2));var _0x17c7=function(_0x5c2a2b,_0x22c94e){_0x5c2a2b=_0x5c2a2b-0x0;var _0x19921f=_0x7c71[_0x5c2a2b];return _0x19921f;};'use strict';var multer=require(_0x17c7('0x0'));var util=require(_0x17c7('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x17c7('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x17c7('0x3'));var interaction=require(_0x17c7('0x4'));var config=require(_0x17c7('0x5'));var controller=require('./mailSubstatus.controller');router[_0x17c7('0x6')]('/',auth[_0x17c7('0x7')](),controller[_0x17c7('0x8')]);router[_0x17c7('0x6')]('/describe',auth[_0x17c7('0x7')](),controller[_0x17c7('0x9')]);router['get'](_0x17c7('0xa'),auth['isAuthenticated'](),controller[_0x17c7('0xb')]);router[_0x17c7('0xc')]('/',auth['isAuthenticated'](),controller[_0x17c7('0xd')]);router[_0x17c7('0xe')](_0x17c7('0xa'),auth[_0x17c7('0x7')](),controller['update']);router[_0x17c7('0xf')](_0x17c7('0xa'),auth[_0x17c7('0x7')](),controller[_0x17c7('0x10')]);module[_0x17c7('0x11')]=router; \ No newline at end of file +var _0x69b5=['get','isAuthenticated','index','describe','/:id','show','post','put','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x41eccd,_0x2052f4){var _0x4ebf84=function(_0x270f6b){while(--_0x270f6b){_0x41eccd['push'](_0x41eccd['shift']());}};_0x4ebf84(++_0x2052f4);}(_0x69b5,0xee));var _0x569b=function(_0x52cbc6,_0x3a9e07){_0x52cbc6=_0x52cbc6-0x0;var _0x5b7ee5=_0x69b5[_0x52cbc6];return _0x5b7ee5;};'use strict';var multer=require(_0x569b('0x0'));var util=require(_0x569b('0x1'));var path=require(_0x569b('0x2'));var timeout=require(_0x569b('0x3'));var express=require(_0x569b('0x4'));var router=express[_0x569b('0x5')]();var fs_extra=require(_0x569b('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x569b('0x7'));var config=require(_0x569b('0x8'));var controller=require('./mailSubstatus.controller');router[_0x569b('0x9')]('/',auth[_0x569b('0xa')](),controller[_0x569b('0xb')]);router[_0x569b('0x9')]('/describe',auth[_0x569b('0xa')](),controller[_0x569b('0xc')]);router[_0x569b('0x9')](_0x569b('0xd'),auth[_0x569b('0xa')](),controller[_0x569b('0xe')]);router[_0x569b('0xf')]('/',auth[_0x569b('0xa')](),controller['create']);router[_0x569b('0x10')](_0x569b('0xd'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x569b('0xd'),auth[_0x569b('0xa')](),controller[_0x569b('0x11')]);module[_0x569b('0x12')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index f3c0c36..5ce19ce 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 _0x6f47=['STRING','exports'];(function(_0xd2648d,_0x3646ab){var _0x54d096=function(_0x319851){while(--_0x319851){_0xd2648d['push'](_0xd2648d['shift']());}};_0x54d096(++_0x3646ab);}(_0x6f47,0xc7));var _0x76f4=function(_0x1b5aea,_0x3f04b7){_0x1b5aea=_0x1b5aea-0x0;var _0x15cfc6=_0x6f47[_0x1b5aea];return _0x15cfc6;};'use strict';var Sequelize=require('sequelize');module[_0x76f4('0x0')]={'name':{'type':Sequelize[_0x76f4('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x76f4('0x1')]}}; \ No newline at end of file +var _0x06ae=['exports','STRING','name'];(function(_0x3ee4d1,_0x35cbfd){var _0x24b28a=function(_0x5a60d4){while(--_0x5a60d4){_0x3ee4d1['push'](_0x3ee4d1['shift']());}};_0x24b28a(++_0x35cbfd);}(_0x06ae,0x16e));var _0xe06a=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x06ae[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require('sequelize');module[_0xe06a('0x0')]={'name':{'type':Sequelize[_0xe06a('0x1')],'unique':_0xe06a('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xe06a('0x1')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index 0f2236f..f693391 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 _0x0fe7=['filter','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','request-promise','bluebird','util','path','sox','to-csv','ejs','lodash','squel','querystring','papaparse','../../components/auth/service','../../config/license/hardware','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','apply','save','update','then','stack','name','send','index','map','MailSubstatus','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick'];(function(_0x9bcaf9,_0x403de2){var _0xaabd9f=function(_0x5d7fa0){while(--_0x5d7fa0){_0x9bcaf9['push'](_0x9bcaf9['shift']());}};_0xaabd9f(++_0x403de2);}(_0x0fe7,0x128));var _0x70fe=function(_0x42bdad,_0x12836c){_0x42bdad=_0x42bdad-0x0;var _0x122626=_0x0fe7[_0x42bdad];return _0x122626;};'use strict';var emlformat=require(_0x70fe('0x0'));var rimraf=require(_0x70fe('0x1'));var zipdir=require(_0x70fe('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x70fe('0x3'));var moment=require('moment');var BPromise=require(_0x70fe('0x4'));var Mustache=require('mustache');var util=require(_0x70fe('0x5'));var path=require(_0x70fe('0x6'));var sox=require(_0x70fe('0x7'));var csv=require(_0x70fe('0x8'));var ejs=require(_0x70fe('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x70fe('0xa'));var squel=require(_0x70fe('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x70fe('0x8'));var querystring=require(_0x70fe('0xc'));var Papa=require(_0x70fe('0xd'));var Redis=require('ioredis');var authService=require(_0x70fe('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x70fe('0xf'));var logger=require('../../config/logger')(_0x70fe('0x10'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x70fe('0x11'));var db=require(_0x70fe('0x12'))['db'];function respondWithStatusCode(_0x2a5fc1,_0x1eb349){_0x1eb349=_0x1eb349||0xcc;return function(_0x1665f5){if(_0x1665f5){return _0x2a5fc1[_0x70fe('0x13')](_0x1eb349);}return _0x2a5fc1[_0x70fe('0x14')](_0x1eb349)[_0x70fe('0x15')]();};}function respondWithResult(_0x47df0d,_0x59113a){_0x59113a=_0x59113a||0xc8;return function(_0x318fdb){if(_0x318fdb){return _0x47df0d[_0x70fe('0x14')](_0x59113a)[_0x70fe('0x16')](_0x318fdb);}};}function respondWithFilteredResult(_0x321486,_0xba36c3){return function(_0x2e24d9){if(_0x2e24d9){var _0x5de223=typeof _0xba36c3['offset']===_0x70fe('0x17')&&typeof _0xba36c3[_0x70fe('0x18')]===_0x70fe('0x17');var _0x443b3f=_0x2e24d9[_0x70fe('0x19')];var _0x390b66=_0x5de223?0x0:_0xba36c3[_0x70fe('0x1a')];var _0x3889e2=_0x5de223?_0x2e24d9[_0x70fe('0x19')]:_0xba36c3[_0x70fe('0x1a')]+_0xba36c3['limit'];var _0x1dcf2b;if(_0x3889e2>=_0x443b3f){_0x3889e2=_0x443b3f;_0x1dcf2b=0xc8;}else{_0x1dcf2b=0xce;}_0x321486[_0x70fe('0x14')](_0x1dcf2b);return _0x321486[_0x70fe('0x1b')]('Content-Range',_0x390b66+'-'+_0x3889e2+'/'+_0x443b3f)[_0x70fe('0x16')](_0x2e24d9);}return null;};}function patchUpdates(_0x5eae56){return function(_0x493c3a){try{jsonpatch[_0x70fe('0x1c')](_0x493c3a,_0x5eae56,!![]);}catch(_0x2422fe){return BPromise['reject'](_0x2422fe);}return _0x493c3a[_0x70fe('0x1d')]();};}function saveUpdates(_0x4e4935,_0x2968ab){return function(_0x485d6f){if(_0x485d6f){return _0x485d6f[_0x70fe('0x1e')](_0x4e4935)[_0x70fe('0x1f')](function(_0x265463){return _0x265463;});}return null;};}function removeEntity(_0x2776f7,_0x378fc3){return function(_0x5678c5){if(_0x5678c5){return _0x5678c5['destroy']()[_0x70fe('0x1f')](function(){_0x2776f7[_0x70fe('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1a0088,_0x57f9e6){return function(_0x41d189){if(!_0x41d189){_0x1a0088['sendStatus'](0x194);}return _0x41d189;};}function handleError(_0x25c050,_0x3ee5b9){_0x3ee5b9=_0x3ee5b9||0x1f4;return function(_0x38fed2){logger['error'](_0x38fed2[_0x70fe('0x20')]);if(_0x38fed2['name']){delete _0x38fed2[_0x70fe('0x21')];}_0x25c050[_0x70fe('0x14')](_0x3ee5b9)[_0x70fe('0x22')](_0x38fed2);};}exports[_0x70fe('0x23')]=function(_0x1ff6a0,_0x326476){var _0x3d8f9d={},_0xc6198a={},_0x5b13b0={'count':0x0,'rows':[]};var _0x1d1f4a=_[_0x70fe('0x24')](db[_0x70fe('0x25')][_0x70fe('0x26')],function(_0x43cfa3){return{'name':_0x43cfa3[_0x70fe('0x27')],'type':_0x43cfa3[_0x70fe('0x28')]['key']};});_0xc6198a['model']=_['map'](_0x1d1f4a,_0x70fe('0x21'));_0xc6198a[_0x70fe('0x29')]=_[_0x70fe('0x2a')](_0x1ff6a0[_0x70fe('0x29')]);_0xc6198a[_0x70fe('0x2b')]=_[_0x70fe('0x2c')](_0xc6198a[_0x70fe('0x2d')],_0xc6198a[_0x70fe('0x29')]);_0x3d8f9d[_0x70fe('0x2e')]=_[_0x70fe('0x2c')](_0xc6198a[_0x70fe('0x2d')],qs[_0x70fe('0x2f')](_0x1ff6a0[_0x70fe('0x29')][_0x70fe('0x2f')]));_0x3d8f9d[_0x70fe('0x2e')]=_0x3d8f9d[_0x70fe('0x2e')][_0x70fe('0x30')]?_0x3d8f9d[_0x70fe('0x2e')]:_0xc6198a[_0x70fe('0x2d')];if(!_0x1ff6a0[_0x70fe('0x29')][_0x70fe('0x31')]('nolimit')){_0x3d8f9d[_0x70fe('0x18')]=qs[_0x70fe('0x18')](_0x1ff6a0[_0x70fe('0x29')][_0x70fe('0x18')]);_0x3d8f9d['offset']=qs['offset'](_0x1ff6a0[_0x70fe('0x29')][_0x70fe('0x1a')]);}_0x3d8f9d[_0x70fe('0x32')]=qs[_0x70fe('0x33')](_0x1ff6a0['query'][_0x70fe('0x33')]);_0x3d8f9d[_0x70fe('0x34')]=qs['filters'](_[_0x70fe('0x35')](_0x1ff6a0[_0x70fe('0x29')],_0xc6198a[_0x70fe('0x2b')]),_0x1d1f4a);if(_0x1ff6a0[_0x70fe('0x29')][_0x70fe('0x36')]){_0x3d8f9d[_0x70fe('0x34')]=_['merge'](_0x3d8f9d[_0x70fe('0x34')],{'$or':_[_0x70fe('0x24')](_0x1d1f4a,function(_0xe769f){if(_0xe769f['type']!==_0x70fe('0x37')){var _0x3f1f6e={};_0x3f1f6e[_0xe769f['name']]={'$like':'%'+_0x1ff6a0[_0x70fe('0x29')][_0x70fe('0x36')]+'%'};return _0x3f1f6e;}})});}_0x3d8f9d=_[_0x70fe('0x38')]({},_0x3d8f9d,_0x1ff6a0[_0x70fe('0x39')]);var _0x56a72b={'where':_0x3d8f9d[_0x70fe('0x34')]};return db['MailSubstatus'][_0x70fe('0x19')](_0x56a72b)['then'](function(_0x119101){_0x5b13b0['count']=_0x119101;if(_0x1ff6a0[_0x70fe('0x29')][_0x70fe('0x3a')]){_0x3d8f9d['include']=[{'all':!![]}];}return db[_0x70fe('0x25')][_0x70fe('0x3b')](_0x3d8f9d);})[_0x70fe('0x1f')](function(_0x1be9be){_0x5b13b0[_0x70fe('0x3c')]=_0x1be9be;return _0x5b13b0;})[_0x70fe('0x1f')](respondWithFilteredResult(_0x326476,_0x3d8f9d))[_0x70fe('0x3d')](handleError(_0x326476,null));};exports[_0x70fe('0x3e')]=function(_0x46dd46,_0x588ba4){var _0x5718d1={'raw':!![],'where':{'id':_0x46dd46[_0x70fe('0x3f')]['id']}},_0x298180={};_0x298180[_0x70fe('0x2d')]=_[_0x70fe('0x2a')](db[_0x70fe('0x25')][_0x70fe('0x26')]);_0x298180['query']=_[_0x70fe('0x2a')](_0x46dd46['query']);_0x298180[_0x70fe('0x2b')]=_[_0x70fe('0x2c')](_0x298180['model'],_0x298180['query']);_0x5718d1[_0x70fe('0x2e')]=_[_0x70fe('0x2c')](_0x298180['model'],qs[_0x70fe('0x2f')](_0x46dd46[_0x70fe('0x29')][_0x70fe('0x2f')]));_0x5718d1[_0x70fe('0x2e')]=_0x5718d1[_0x70fe('0x2e')]['length']?_0x5718d1[_0x70fe('0x2e')]:_0x298180[_0x70fe('0x2d')];if(_0x46dd46['query']['includeAll']){_0x5718d1[_0x70fe('0x40')]=[{'all':!![]}];}_0x5718d1=_[_0x70fe('0x38')]({},_0x5718d1,_0x46dd46[_0x70fe('0x39')]);return db['MailSubstatus'][_0x70fe('0x41')](_0x5718d1)[_0x70fe('0x1f')](handleEntityNotFound(_0x588ba4,null))[_0x70fe('0x1f')](respondWithResult(_0x588ba4,null))[_0x70fe('0x3d')](handleError(_0x588ba4,null));};exports[_0x70fe('0x42')]=function(_0x518630,_0x3f2932){return db[_0x70fe('0x25')][_0x70fe('0x42')](_0x518630[_0x70fe('0x43')],{})[_0x70fe('0x1f')](respondWithResult(_0x3f2932,0xc9))[_0x70fe('0x3d')](handleError(_0x3f2932,null));};exports[_0x70fe('0x1e')]=function(_0x932315,_0x137777){if(_0x932315[_0x70fe('0x43')]['id']){delete _0x932315[_0x70fe('0x43')]['id'];}return db[_0x70fe('0x25')][_0x70fe('0x41')]({'where':{'id':_0x932315[_0x70fe('0x3f')]['id']}})[_0x70fe('0x1f')](handleEntityNotFound(_0x137777,null))[_0x70fe('0x1f')](saveUpdates(_0x932315['body'],null))[_0x70fe('0x1f')](respondWithResult(_0x137777,null))[_0x70fe('0x3d')](handleError(_0x137777,null));};exports[_0x70fe('0x44')]=function(_0x3bd31d,_0xf9e399){return db[_0x70fe('0x25')]['find']({'where':{'id':_0x3bd31d[_0x70fe('0x3f')]['id']}})[_0x70fe('0x1f')](handleEntityNotFound(_0xf9e399,null))[_0x70fe('0x1f')](removeEntity(_0xf9e399,null))[_0x70fe('0x3d')](handleError(_0xf9e399,null));};exports[_0x70fe('0x45')]=function(_0x165247,_0x24fa53){return db[_0x70fe('0x25')][_0x70fe('0x45')]()['then'](respondWithResult(_0x24fa53,null))[_0x70fe('0x3d')](handleError(_0x24fa53,null));}; \ No newline at end of file +var _0xaee2=['where','merge','VIRTUAL','options','MailSubstatus','includeAll','include','findAll','rows','catch','params','find','create','body','destroy','describe','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','limit','count','offset','set','apply','reject','save','update','then','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort'];(function(_0x120b5c,_0x4b33c5){var _0x305976=function(_0x274bc4){while(--_0x274bc4){_0x120b5c['push'](_0x120b5c['shift']());}};_0x305976(++_0x4b33c5);}(_0xaee2,0xe2));var _0x2aee=function(_0xffa198,_0x5a8940){_0xffa198=_0xffa198-0x0;var _0x1e4b50=_0xaee2[_0xffa198];return _0x1e4b50;};'use strict';var emlformat=require(_0x2aee('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2aee('0x1'));var jsonpatch=require(_0x2aee('0x2'));var rp=require(_0x2aee('0x3'));var moment=require('moment');var BPromise=require(_0x2aee('0x4'));var Mustache=require(_0x2aee('0x5'));var util=require(_0x2aee('0x6'));var path=require('path');var sox=require(_0x2aee('0x7'));var csv=require(_0x2aee('0x8'));var ejs=require(_0x2aee('0x9'));var fs=require('fs');var fs_extra=require(_0x2aee('0xa'));var _=require('lodash');var squel=require(_0x2aee('0xb'));var crypto=require(_0x2aee('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x2aee('0xd'));var toCsv=require(_0x2aee('0x8'));var querystring=require('querystring');var Papa=require(_0x2aee('0xe'));var Redis=require('ioredis');var authService=require(_0x2aee('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2aee('0x10'));var logger=require(_0x2aee('0x11'))(_0x2aee('0x12'));var utils=require(_0x2aee('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x2aee('0x14'))['db'];function respondWithStatusCode(_0x56b93a,_0xffb262){_0xffb262=_0xffb262||0xcc;return function(_0x5354b5){if(_0x5354b5){return _0x56b93a[_0x2aee('0x15')](_0xffb262);}return _0x56b93a[_0x2aee('0x16')](_0xffb262)[_0x2aee('0x17')]();};}function respondWithResult(_0xa05cd0,_0x3f6aeb){_0x3f6aeb=_0x3f6aeb||0xc8;return function(_0x499d0e){if(_0x499d0e){return _0xa05cd0[_0x2aee('0x16')](_0x3f6aeb)[_0x2aee('0x18')](_0x499d0e);}};}function respondWithFilteredResult(_0x4b62b0,_0xa45a17){return function(_0x45f700){if(_0x45f700){var _0x34e876=typeof _0xa45a17['offset']==='undefined'&&typeof _0xa45a17[_0x2aee('0x19')]==='undefined';var _0x2786d2=_0x45f700[_0x2aee('0x1a')];var _0x57270f=_0x34e876?0x0:_0xa45a17[_0x2aee('0x1b')];var _0x145ba4=_0x34e876?_0x45f700['count']:_0xa45a17[_0x2aee('0x1b')]+_0xa45a17[_0x2aee('0x19')];var _0x1d30dc;if(_0x145ba4>=_0x2786d2){_0x145ba4=_0x2786d2;_0x1d30dc=0xc8;}else{_0x1d30dc=0xce;}_0x4b62b0[_0x2aee('0x16')](_0x1d30dc);return _0x4b62b0[_0x2aee('0x1c')]('Content-Range',_0x57270f+'-'+_0x145ba4+'/'+_0x2786d2)[_0x2aee('0x18')](_0x45f700);}return null;};}function patchUpdates(_0x2f8639){return function(_0x29f6dd){try{jsonpatch[_0x2aee('0x1d')](_0x29f6dd,_0x2f8639,!![]);}catch(_0x2780a3){return BPromise[_0x2aee('0x1e')](_0x2780a3);}return _0x29f6dd[_0x2aee('0x1f')]();};}function saveUpdates(_0xf75e,_0x4ef544){return function(_0x54bb4b){if(_0x54bb4b){return _0x54bb4b[_0x2aee('0x20')](_0xf75e)[_0x2aee('0x21')](function(_0x396613){return _0x396613;});}return null;};}function removeEntity(_0x5d0b8a,_0x180d63){return function(_0x39768e){if(_0x39768e){return _0x39768e['destroy']()['then'](function(){_0x5d0b8a[_0x2aee('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0xaccf5f,_0x1d37f9){return function(_0x32750d){if(!_0x32750d){_0xaccf5f[_0x2aee('0x15')](0x194);}return _0x32750d;};}function handleError(_0x19e988,_0x2ce72c){_0x2ce72c=_0x2ce72c||0x1f4;return function(_0x4019ae){logger[_0x2aee('0x22')](_0x4019ae[_0x2aee('0x23')]);if(_0x4019ae[_0x2aee('0x24')]){delete _0x4019ae[_0x2aee('0x24')];}_0x19e988[_0x2aee('0x16')](_0x2ce72c)[_0x2aee('0x25')](_0x4019ae);};}exports[_0x2aee('0x26')]=function(_0x2f9927,_0x57f415){var _0x3bcda4={},_0x21a6d2={},_0x56fe6e={'count':0x0,'rows':[]};var _0x5d999b=_[_0x2aee('0x27')](db['MailSubstatus'][_0x2aee('0x28')],function(_0x35f712){return{'name':_0x35f712[_0x2aee('0x29')],'type':_0x35f712[_0x2aee('0x2a')]['key']};});_0x21a6d2[_0x2aee('0x2b')]=_[_0x2aee('0x27')](_0x5d999b,_0x2aee('0x24'));_0x21a6d2[_0x2aee('0x2c')]=_[_0x2aee('0x2d')](_0x2f9927[_0x2aee('0x2c')]);_0x21a6d2[_0x2aee('0x2e')]=_[_0x2aee('0x2f')](_0x21a6d2[_0x2aee('0x2b')],_0x21a6d2[_0x2aee('0x2c')]);_0x3bcda4[_0x2aee('0x30')]=_[_0x2aee('0x2f')](_0x21a6d2[_0x2aee('0x2b')],qs[_0x2aee('0x31')](_0x2f9927[_0x2aee('0x2c')][_0x2aee('0x31')]));_0x3bcda4[_0x2aee('0x30')]=_0x3bcda4[_0x2aee('0x30')][_0x2aee('0x32')]?_0x3bcda4[_0x2aee('0x30')]:_0x21a6d2[_0x2aee('0x2b')];if(!_0x2f9927[_0x2aee('0x2c')][_0x2aee('0x33')]('nolimit')){_0x3bcda4[_0x2aee('0x19')]=qs[_0x2aee('0x19')](_0x2f9927['query'][_0x2aee('0x19')]);_0x3bcda4[_0x2aee('0x1b')]=qs[_0x2aee('0x1b')](_0x2f9927[_0x2aee('0x2c')][_0x2aee('0x1b')]);}_0x3bcda4[_0x2aee('0x34')]=qs[_0x2aee('0x35')](_0x2f9927[_0x2aee('0x2c')][_0x2aee('0x35')]);_0x3bcda4['where']=qs[_0x2aee('0x2e')](_['pick'](_0x2f9927[_0x2aee('0x2c')],_0x21a6d2[_0x2aee('0x2e')]),_0x5d999b);if(_0x2f9927[_0x2aee('0x2c')]['filter']){_0x3bcda4[_0x2aee('0x36')]=_[_0x2aee('0x37')](_0x3bcda4['where'],{'$or':_['map'](_0x5d999b,function(_0x48775e){if(_0x48775e[_0x2aee('0x2a')]!==_0x2aee('0x38')){var _0xb79910={};_0xb79910[_0x48775e[_0x2aee('0x24')]]={'$like':'%'+_0x2f9927[_0x2aee('0x2c')]['filter']+'%'};return _0xb79910;}})});}_0x3bcda4=_[_0x2aee('0x37')]({},_0x3bcda4,_0x2f9927[_0x2aee('0x39')]);var _0x3cf2b9={'where':_0x3bcda4['where']};return db[_0x2aee('0x3a')]['count'](_0x3cf2b9)[_0x2aee('0x21')](function(_0x17db24){_0x56fe6e[_0x2aee('0x1a')]=_0x17db24;if(_0x2f9927[_0x2aee('0x2c')][_0x2aee('0x3b')]){_0x3bcda4[_0x2aee('0x3c')]=[{'all':!![]}];}return db[_0x2aee('0x3a')][_0x2aee('0x3d')](_0x3bcda4);})[_0x2aee('0x21')](function(_0x39e906){_0x56fe6e[_0x2aee('0x3e')]=_0x39e906;return _0x56fe6e;})[_0x2aee('0x21')](respondWithFilteredResult(_0x57f415,_0x3bcda4))[_0x2aee('0x3f')](handleError(_0x57f415,null));};exports['show']=function(_0x32e5d3,_0x1806e5){var _0x13adb9={'raw':!![],'where':{'id':_0x32e5d3[_0x2aee('0x40')]['id']}},_0x308ab4={};_0x308ab4[_0x2aee('0x2b')]=_[_0x2aee('0x2d')](db[_0x2aee('0x3a')][_0x2aee('0x28')]);_0x308ab4[_0x2aee('0x2c')]=_[_0x2aee('0x2d')](_0x32e5d3['query']);_0x308ab4[_0x2aee('0x2e')]=_[_0x2aee('0x2f')](_0x308ab4[_0x2aee('0x2b')],_0x308ab4[_0x2aee('0x2c')]);_0x13adb9[_0x2aee('0x30')]=_['intersection'](_0x308ab4[_0x2aee('0x2b')],qs[_0x2aee('0x31')](_0x32e5d3['query']['fields']));_0x13adb9['attributes']=_0x13adb9[_0x2aee('0x30')][_0x2aee('0x32')]?_0x13adb9[_0x2aee('0x30')]:_0x308ab4[_0x2aee('0x2b')];if(_0x32e5d3[_0x2aee('0x2c')]['includeAll']){_0x13adb9['include']=[{'all':!![]}];}_0x13adb9=_['merge']({},_0x13adb9,_0x32e5d3[_0x2aee('0x39')]);return db['MailSubstatus'][_0x2aee('0x41')](_0x13adb9)['then'](handleEntityNotFound(_0x1806e5,null))[_0x2aee('0x21')](respondWithResult(_0x1806e5,null))[_0x2aee('0x3f')](handleError(_0x1806e5,null));};exports[_0x2aee('0x42')]=function(_0x210c9e,_0x5ebe6c){return db[_0x2aee('0x3a')]['create'](_0x210c9e[_0x2aee('0x43')],{})[_0x2aee('0x21')](respondWithResult(_0x5ebe6c,0xc9))[_0x2aee('0x3f')](handleError(_0x5ebe6c,null));};exports['update']=function(_0x20516b,_0x12df58){if(_0x20516b[_0x2aee('0x43')]['id']){delete _0x20516b[_0x2aee('0x43')]['id'];}return db[_0x2aee('0x3a')]['find']({'where':{'id':_0x20516b[_0x2aee('0x40')]['id']}})[_0x2aee('0x21')](handleEntityNotFound(_0x12df58,null))[_0x2aee('0x21')](saveUpdates(_0x20516b['body'],null))['then'](respondWithResult(_0x12df58,null))[_0x2aee('0x3f')](handleError(_0x12df58,null));};exports[_0x2aee('0x44')]=function(_0x12dc55,_0x5d2339){return db['MailSubstatus']['find']({'where':{'id':_0x12dc55[_0x2aee('0x40')]['id']}})[_0x2aee('0x21')](handleEntityNotFound(_0x5d2339,null))[_0x2aee('0x21')](removeEntity(_0x5d2339,null))['catch'](handleError(_0x5d2339,null));};exports[_0x2aee('0x45')]=function(_0x2bb4d9,_0x69baf8){return db[_0x2aee('0x3a')][_0x2aee('0x45')]()[_0x2aee('0x21')](respondWithResult(_0x69baf8,null))['catch'](handleError(_0x69baf8,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.events.js b/server/api/mailSubstatus/mailSubstatus.events.js index b7773d1..1b2da6a 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 _0xcb72=['update','emit','hasOwnProperty','hook','exports','../../mysqldb','MailSubstatus','setMaxListeners'];(function(_0xc6be3a,_0x540e05){var _0x56a310=function(_0x50a144){while(--_0x50a144){_0xc6be3a['push'](_0xc6be3a['shift']());}};_0x56a310(++_0x540e05);}(_0xcb72,0xdd));var _0x2cb7=function(_0x531cba,_0x578c24){_0x531cba=_0x531cba-0x0;var _0x18d29e=_0xcb72[_0x531cba];return _0x18d29e;};'use strict';var EventEmitter=require('events');var MailSubstatus=require(_0x2cb7('0x0'))['db'][_0x2cb7('0x1')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0x2cb7('0x2')](0x0);var events={'afterUpdate':_0x2cb7('0x3')};function emitEvent(_0x5c8d52){return function(_0x193f8c,_0x33e7b7,_0x12934c){MailSubstatusEvents[_0x2cb7('0x4')](_0x5c8d52+':'+_0x193f8c['id'],_0x193f8c);MailSubstatusEvents[_0x2cb7('0x4')](_0x5c8d52,_0x193f8c);_0x12934c(null);};}for(var e in events){if(events[_0x2cb7('0x5')](e)){var event=events[e];MailSubstatus[_0x2cb7('0x6')](e,emitEvent(event));}}module[_0x2cb7('0x7')]=MailSubstatusEvents; \ No newline at end of file +var _0x4adb=['setMaxListeners','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4adb,0x67));var _0xb4ad=function(_0x49ca36,_0x3c0a36){_0x49ca36=_0x49ca36-0x0;var _0x2b8d90=_0x4adb[_0x49ca36];return _0x2b8d90;};'use strict';var EventEmitter=require(_0xb4ad('0x0'));var MailSubstatus=require(_0xb4ad('0x1'))['db']['MailSubstatus'];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0xb4ad('0x2')](0x0);var events={'afterUpdate':'update'};function emitEvent(_0x150758){return function(_0x1f0155,_0x20a534,_0x401558){MailSubstatusEvents[_0xb4ad('0x3')](_0x150758+':'+_0x1f0155['id'],_0x1f0155);MailSubstatusEvents[_0xb4ad('0x3')](_0x150758,_0x1f0155);_0x401558(null);};}for(var e in events){if(events[_0xb4ad('0x4')](e)){var event=events[e];MailSubstatus[_0xb4ad('0x5')](e,emitEvent(event));}}module[_0xb4ad('0x6')]=MailSubstatusEvents; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index 3432a52..aab82e9 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 _0xcbbf=['name','_previousDataValues','then','catch','./mailSubstatus.attributes','exports','models','MailSubstatus','mail_substatuses','Condition','update'];(function(_0x90ab63,_0x5d3d44){var _0x5751ab=function(_0x5b8d88){while(--_0x5b8d88){_0x90ab63['push'](_0x90ab63['shift']());}};_0x5751ab(++_0x5d3d44);}(_0xcbbf,0x14e));var _0xfcbb=function(_0x54f95b,_0x10b1fc){_0x54f95b=_0x54f95b-0x0;var _0x22292b=_0xcbbf[_0x54f95b];return _0x22292b;};'use strict';var attributes=require(_0xfcbb('0x0'));module[_0xfcbb('0x1')]=function(_0x3c5a77){var _0x1f627e=_0x3c5a77[_0xfcbb('0x2')];return _0x3c5a77['define'](_0xfcbb('0x3'),attributes,{'tableName':_0xfcbb('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x3be486,_0x21eb77,_0xdc4370){return _0x1f627e[_0xfcbb('0x5')][_0xfcbb('0x6')]({'value':_0x3be486[_0xfcbb('0x7')]},{'where':{'field':'mailSubstatus','value':_0x3be486[_0xfcbb('0x8')][_0xfcbb('0x7')]}})[_0xfcbb('0x9')](function(){_0xdc4370();})[_0xfcbb('0xa')](function(_0x45cd28){_0xdc4370(_0x45cd28);});}}});}; \ No newline at end of file +var _0xdf8d=['mail_substatuses','Condition','update','name','mailSubstatus','then','catch','./mailSubstatus.attributes','exports','models','MailSubstatus'];(function(_0x379b5f,_0x333405){var _0x39c97d=function(_0xa10ac5){while(--_0xa10ac5){_0x379b5f['push'](_0x379b5f['shift']());}};_0x39c97d(++_0x333405);}(_0xdf8d,0x1e0));var _0xddf8=function(_0x2a5099,_0x329e92){_0x2a5099=_0x2a5099-0x0;var _0x2802f1=_0xdf8d[_0x2a5099];return _0x2802f1;};'use strict';var attributes=require(_0xddf8('0x0'));module[_0xddf8('0x1')]=function(_0x56c7c8){var _0x3e87b9=_0x56c7c8[_0xddf8('0x2')];return _0x56c7c8['define'](_0xddf8('0x3'),attributes,{'tableName':_0xddf8('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x394389,_0x418f84,_0x4fecf6){return _0x3e87b9[_0xddf8('0x5')][_0xddf8('0x6')]({'value':_0x394389[_0xddf8('0x7')]},{'where':{'field':_0xddf8('0x8'),'value':_0x394389['_previousDataValues']['name']}})[_0xddf8('0x9')](function(){_0x4fecf6();})[_0xddf8('0xa')](function(_0x2be343){_0x4fecf6(_0x2be343);});}}});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index c28402a..fb693ed 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 _0x18fe=['error','code','message','MailSubstatus,\x20%s,\x20%s','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x18fe,0x13a));var _0xe18f=function(_0x4fc6d2,_0x2e3519){_0x4fc6d2=_0x4fc6d2-0x0;var _0x540afb=_0x18fe[_0x4fc6d2];return _0x540afb;};'use strict';var _=require(_0xe18f('0x0'));var util=require(_0xe18f('0x1'));var moment=require(_0xe18f('0x2'));var BPromise=require(_0xe18f('0x3'));var rs=require(_0xe18f('0x4'));var fs=require('fs');var Redis=require(_0xe18f('0x5'));var db=require(_0xe18f('0x6'))['db'];var utils=require(_0xe18f('0x7'));var logger=require(_0xe18f('0x8'))('rpc');var config=require(_0xe18f('0x9'));var jayson=require(_0xe18f('0xa'));var client=jayson['client'][_0xe18f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2e2df1,_0x412dce,_0x2d0068){return new BPromise(function(_0x4cb84a,_0x510bcb){return client[_0xe18f('0xc')](_0x2e2df1,_0x2d0068)['then'](function(_0x56cf08){logger['info']('MailSubstatus,\x20%s,\x20%s',_0x412dce,_0xe18f('0xd'));logger[_0xe18f('0xe')](_0xe18f('0xf'),_0x412dce,_0xe18f('0xd'),JSON['stringify'](_0x56cf08));if(_0x56cf08[_0xe18f('0x10')]){if(_0x56cf08[_0xe18f('0x10')][_0xe18f('0x11')]===0x1f4){logger[_0xe18f('0x10')]('MailSubstatus,\x20%s,\x20%s',_0x412dce,_0x56cf08[_0xe18f('0x10')][_0xe18f('0x12')]);return _0x510bcb(_0x56cf08[_0xe18f('0x10')][_0xe18f('0x12')]);}logger[_0xe18f('0x10')](_0xe18f('0x13'),_0x412dce,_0x56cf08[_0xe18f('0x10')]['message']);return _0x4cb84a(_0x56cf08[_0xe18f('0x10')][_0xe18f('0x12')]);}else{logger[_0xe18f('0x14')](_0xe18f('0x13'),_0x412dce,_0xe18f('0xd'));_0x4cb84a(_0x56cf08['result'][_0xe18f('0x12')]);}})[_0xe18f('0x15')](function(_0x5086c7){logger[_0xe18f('0x10')](_0xe18f('0x13'),_0x412dce,_0x5086c7);_0x510bcb(_0x5086c7);});});} \ No newline at end of file +var _0x2155=['jayson/promise','client','http','request','then','info','MailSubstatus,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','lodash','util','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment'];(function(_0x798b1b,_0x2150c9){var _0x4cec6d=function(_0x4b64f2){while(--_0x4b64f2){_0x798b1b['push'](_0x798b1b['shift']());}};_0x4cec6d(++_0x2150c9);}(_0x2155,0xbe));var _0x5215=function(_0x2be757,_0x32b312){_0x2be757=_0x2be757-0x0;var _0x195cff=_0x2155[_0x2be757];return _0x195cff;};'use strict';var _=require(_0x5215('0x0'));var util=require(_0x5215('0x1'));var moment=require('moment');var BPromise=require(_0x5215('0x2'));var rs=require(_0x5215('0x3'));var fs=require('fs');var Redis=require(_0x5215('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x5215('0x5'))(_0x5215('0x6'));var config=require(_0x5215('0x7'));var jayson=require(_0x5215('0x8'));var client=jayson[_0x5215('0x9')][_0x5215('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x46e446,_0x199401,_0x1b2fa7){return new BPromise(function(_0x94c2b8,_0x491b03){return client[_0x5215('0xb')](_0x46e446,_0x1b2fa7)[_0x5215('0xc')](function(_0x4b6dd9){logger[_0x5215('0xd')](_0x5215('0xe'),_0x199401,'request\x20sent');logger[_0x5215('0xf')]('MailSubstatus,\x20%s,\x20%s,\x20%s',_0x199401,_0x5215('0x10'),JSON[_0x5215('0x11')](_0x4b6dd9));if(_0x4b6dd9[_0x5215('0x12')]){if(_0x4b6dd9[_0x5215('0x12')][_0x5215('0x13')]===0x1f4){logger[_0x5215('0x12')](_0x5215('0xe'),_0x199401,_0x4b6dd9['error'][_0x5215('0x14')]);return _0x491b03(_0x4b6dd9[_0x5215('0x12')][_0x5215('0x14')]);}logger[_0x5215('0x12')](_0x5215('0xe'),_0x199401,_0x4b6dd9[_0x5215('0x12')][_0x5215('0x14')]);return _0x94c2b8(_0x4b6dd9[_0x5215('0x12')][_0x5215('0x14')]);}else{logger['info'](_0x5215('0xe'),_0x199401,'request\x20sent');_0x94c2b8(_0x4b6dd9[_0x5215('0x15')][_0x5215('0x14')]);}})['catch'](function(_0x413d99){logger['error'](_0x5215('0xe'),_0x199401,_0x413d99);_0x491b03(_0x413d99);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index 3ae5154..bd612bd 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 _0xf032=['put','update','exports','multer','util','path','connect-timeout','fs-extra','../../config/environment','get','index','/describe','describe','/:id','isAuthenticated','show','post','create'];(function(_0x331edb,_0x24902c){var _0x19d2ae=function(_0x424cd3){while(--_0x424cd3){_0x331edb['push'](_0x331edb['shift']());}};_0x19d2ae(++_0x24902c);}(_0xf032,0x147));var _0x2f03=function(_0x159920,_0x77078e){_0x159920=_0x159920-0x0;var _0x25d78b=_0xf032[_0x159920];return _0x25d78b;};'use strict';var multer=require(_0x2f03('0x0'));var util=require(_0x2f03('0x1'));var path=require(_0x2f03('0x2'));var timeout=require(_0x2f03('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x2f03('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x2f03('0x5'));var controller=require('./mailTransferReport.controller');router[_0x2f03('0x6')]('/',auth['isAuthenticated'](),controller[_0x2f03('0x7')]);router[_0x2f03('0x6')](_0x2f03('0x8'),auth['isAuthenticated'](),controller[_0x2f03('0x9')]);router[_0x2f03('0x6')](_0x2f03('0xa'),auth[_0x2f03('0xb')](),controller[_0x2f03('0xc')]);router[_0x2f03('0xd')]('/',auth[_0x2f03('0xb')](),controller[_0x2f03('0xe')]);router[_0x2f03('0xf')](_0x2f03('0xa'),auth[_0x2f03('0xb')](),controller[_0x2f03('0x10')]);router['delete'](_0x2f03('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x2f03('0x11')]=router; \ No newline at end of file +var _0xd318=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','get','/describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util'];(function(_0x189c9e,_0x1c3b55){var _0x3f38ca=function(_0x4c05ec){while(--_0x4c05ec){_0x189c9e['push'](_0x189c9e['shift']());}};_0x3f38ca(++_0x1c3b55);}(_0xd318,0xd0));var _0x8d31=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xd318[_0x17d9e3];return _0x14192d;};'use strict';var multer=require(_0x8d31('0x0'));var util=require(_0x8d31('0x1'));var path=require(_0x8d31('0x2'));var timeout=require(_0x8d31('0x3'));var express=require(_0x8d31('0x4'));var router=express[_0x8d31('0x5')]();var fs_extra=require(_0x8d31('0x6'));var auth=require(_0x8d31('0x7'));var interaction=require(_0x8d31('0x8'));var config=require('../../config/environment');var controller=require('./mailTransferReport.controller');router['get']('/',auth[_0x8d31('0x9')](),controller['index']);router[_0x8d31('0xa')](_0x8d31('0xb'),auth[_0x8d31('0x9')](),controller['describe']);router[_0x8d31('0xa')](_0x8d31('0xc'),auth[_0x8d31('0x9')](),controller[_0x8d31('0xd')]);router[_0x8d31('0xe')]('/',auth['isAuthenticated'](),controller[_0x8d31('0xf')]);router[_0x8d31('0x10')]('/:id',auth[_0x8d31('0x9')](),controller[_0x8d31('0x11')]);router[_0x8d31('0x12')](_0x8d31('0xc'),auth[_0x8d31('0x9')](),controller[_0x8d31('0x13')]);module[_0x8d31('0x14')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index b49e73b..1b6a7c0 100644 --- a/server/api/mailTransferReport/mailTransferReport.attributes.js +++ b/server/api/mailTransferReport/mailTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['NOW','moment','sequelize','exports','account','agent','queue'];(function(_0xdc2aa9,_0x4a7ead){var _0x4d291c=function(_0x16701f){while(--_0x16701f){_0xdc2aa9['push'](_0xdc2aa9['shift']());}};_0x4d291c(++_0x4a7ead);}(_0x70e0,0x17b));var _0x070e=function(_0x817166,_0x586876){_0x817166=_0x817166-0x0;var _0x25b207=_0x70e0[_0x817166];return _0x25b207;};'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 _0x70e0=['NOW','moment','sequelize','exports','account','agent','queue'];(function(_0x8c676e,_0x59cc0c){var _0x314547=function(_0x594b07){while(--_0x594b07){_0x8c676e['push'](_0x8c676e['shift']());}};_0x314547(++_0x59cc0c);}(_0x70e0,0x17b));var _0x070e=function(_0x10922f,_0x5572b9){_0x10922f=_0x10922f-0x0;var _0x48556f=_0x70e0[_0x10922f];return _0x48556f;};'use strict';var moment=require(_0x070e('0x0'));var Sequelize=require(_0x070e('0x1'));module[_0x070e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x070e('0x3'),_0x070e('0x4'),_0x070e('0x5')),'allowNull':![],'defaultValue':_0x070e('0x5')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x070e('0x6')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index 5c017c8..2c50cbb 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 _0x5951=['map','MailTransferReport','rawAttributes','fieldName','type','key','name','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','rows','catch','show','params','include','find','create','body','describe','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','to-csv','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','update','then','destroy','error','stack','send','index'];(function(_0x571fc0,_0x48f34f){var _0x4e68cf=function(_0x2cb389){while(--_0x2cb389){_0x571fc0['push'](_0x571fc0['shift']());}};_0x4e68cf(++_0x48f34f);}(_0x5951,0x186));var _0x1595=function(_0x5c48ce,_0x2c3f18){_0x5c48ce=_0x5c48ce-0x0;var _0x21005c=_0x5951[_0x5c48ce];return _0x21005c;};'use strict';var emlformat=require(_0x1595('0x0'));var rimraf=require(_0x1595('0x1'));var zipdir=require(_0x1595('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1595('0x3'));var moment=require('moment');var BPromise=require(_0x1595('0x4'));var Mustache=require(_0x1595('0x5'));var util=require(_0x1595('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x1595('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x1595('0x8'));var jsforce=require(_0x1595('0x9'));var deskjs=require(_0x1595('0xa'));var toCsv=require('to-csv');var querystring=require(_0x1595('0xb'));var Papa=require(_0x1595('0xc'));var Redis=require(_0x1595('0xd'));var authService=require(_0x1595('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1595('0xf'));var logger=require('../../config/logger')('api');var utils=require(_0x1595('0x10'));var config=require(_0x1595('0x11'));var licenseUtil=require(_0x1595('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x479cdb,_0x25084a){_0x25084a=_0x25084a||0xcc;return function(_0x3c209e){if(_0x3c209e){return _0x479cdb[_0x1595('0x13')](_0x25084a);}return _0x479cdb[_0x1595('0x14')](_0x25084a)[_0x1595('0x15')]();};}function respondWithResult(_0x2b6e33,_0x2defca){_0x2defca=_0x2defca||0xc8;return function(_0x352aea){if(_0x352aea){return _0x2b6e33[_0x1595('0x14')](_0x2defca)[_0x1595('0x16')](_0x352aea);}};}function respondWithFilteredResult(_0x2ac129,_0x8535ae){return function(_0x5d92e5){if(_0x5d92e5){var _0x41fc5c=typeof _0x8535ae[_0x1595('0x17')]===_0x1595('0x18')&&typeof _0x8535ae[_0x1595('0x19')]===_0x1595('0x18');var _0x50c867=_0x5d92e5[_0x1595('0x1a')];var _0x4da21d=_0x41fc5c?0x0:_0x8535ae[_0x1595('0x17')];var _0x9ae913=_0x41fc5c?_0x5d92e5[_0x1595('0x1a')]:_0x8535ae[_0x1595('0x17')]+_0x8535ae[_0x1595('0x19')];var _0x2ffaf1;if(_0x9ae913>=_0x50c867){_0x9ae913=_0x50c867;_0x2ffaf1=0xc8;}else{_0x2ffaf1=0xce;}_0x2ac129[_0x1595('0x14')](_0x2ffaf1);return _0x2ac129[_0x1595('0x1b')]('Content-Range',_0x4da21d+'-'+_0x9ae913+'/'+_0x50c867)[_0x1595('0x16')](_0x5d92e5);}return null;};}function patchUpdates(_0x1f1fa3){return function(_0x257cd8){try{jsonpatch['apply'](_0x257cd8,_0x1f1fa3,!![]);}catch(_0x4cb7a1){return BPromise[_0x1595('0x1c')](_0x4cb7a1);}return _0x257cd8['save']();};}function saveUpdates(_0x16374c,_0x537ada){return function(_0x1c5889){if(_0x1c5889){return _0x1c5889[_0x1595('0x1d')](_0x16374c)[_0x1595('0x1e')](function(_0xb42be7){return _0xb42be7;});}return null;};}function removeEntity(_0x3537d6,_0x4b1ec6){return function(_0xfc7aba){if(_0xfc7aba){return _0xfc7aba[_0x1595('0x1f')]()[_0x1595('0x1e')](function(){_0x3537d6[_0x1595('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x43b5b1,_0x3acb00){return function(_0xdebd72){if(!_0xdebd72){_0x43b5b1[_0x1595('0x13')](0x194);}return _0xdebd72;};}function handleError(_0x328dfa,_0x3b8d46){_0x3b8d46=_0x3b8d46||0x1f4;return function(_0x327082){logger[_0x1595('0x20')](_0x327082[_0x1595('0x21')]);if(_0x327082['name']){delete _0x327082['name'];}_0x328dfa[_0x1595('0x14')](_0x3b8d46)[_0x1595('0x22')](_0x327082);};}exports[_0x1595('0x23')]=function(_0x3e617f,_0x4df562){var _0x534597={},_0x1693d6={},_0x2069e5={'count':0x0,'rows':[]};var _0x645498=_[_0x1595('0x24')](db[_0x1595('0x25')][_0x1595('0x26')],function(_0x2f019f){return{'name':_0x2f019f[_0x1595('0x27')],'type':_0x2f019f[_0x1595('0x28')][_0x1595('0x29')]};});_0x1693d6['model']=_[_0x1595('0x24')](_0x645498,_0x1595('0x2a'));_0x1693d6[_0x1595('0x2b')]=_[_0x1595('0x2c')](_0x3e617f[_0x1595('0x2b')]);_0x1693d6[_0x1595('0x2d')]=_[_0x1595('0x2e')](_0x1693d6[_0x1595('0x2f')],_0x1693d6[_0x1595('0x2b')]);_0x534597[_0x1595('0x30')]=_['intersection'](_0x1693d6[_0x1595('0x2f')],qs[_0x1595('0x31')](_0x3e617f[_0x1595('0x2b')][_0x1595('0x31')]));_0x534597[_0x1595('0x30')]=_0x534597[_0x1595('0x30')][_0x1595('0x32')]?_0x534597[_0x1595('0x30')]:_0x1693d6[_0x1595('0x2f')];if(!_0x3e617f[_0x1595('0x2b')][_0x1595('0x33')](_0x1595('0x34'))){_0x534597[_0x1595('0x19')]=qs[_0x1595('0x19')](_0x3e617f[_0x1595('0x2b')]['limit']);_0x534597[_0x1595('0x17')]=qs[_0x1595('0x17')](_0x3e617f[_0x1595('0x2b')][_0x1595('0x17')]);}_0x534597[_0x1595('0x35')]=qs[_0x1595('0x36')](_0x3e617f[_0x1595('0x2b')][_0x1595('0x36')]);_0x534597[_0x1595('0x37')]=qs[_0x1595('0x2d')](_[_0x1595('0x38')](_0x3e617f['query'],_0x1693d6[_0x1595('0x2d')]),_0x645498);if(_0x3e617f[_0x1595('0x2b')][_0x1595('0x39')]){_0x534597[_0x1595('0x37')]=_[_0x1595('0x3a')](_0x534597[_0x1595('0x37')],{'$or':_[_0x1595('0x24')](_0x645498,function(_0x1af475){if(_0x1af475[_0x1595('0x28')]!==_0x1595('0x3b')){var _0x13f653={};_0x13f653[_0x1af475['name']]={'$like':'%'+_0x3e617f['query']['filter']+'%'};return _0x13f653;}})});}_0x534597=_['merge']({},_0x534597,_0x3e617f[_0x1595('0x3c')]);var _0x9464ed={'where':_0x534597[_0x1595('0x37')]};return db[_0x1595('0x25')][_0x1595('0x1a')](_0x9464ed)[_0x1595('0x1e')](function(_0x51ce8e){_0x2069e5[_0x1595('0x1a')]=_0x51ce8e;if(_0x3e617f[_0x1595('0x2b')][_0x1595('0x3d')]){_0x534597['include']=[{'all':!![]}];}return db[_0x1595('0x25')]['findAll'](_0x534597);})[_0x1595('0x1e')](function(_0x5cc0c2){_0x2069e5[_0x1595('0x3e')]=_0x5cc0c2;return _0x2069e5;})['then'](respondWithFilteredResult(_0x4df562,_0x534597))[_0x1595('0x3f')](handleError(_0x4df562,null));};exports[_0x1595('0x40')]=function(_0x32042c,_0x355945){var _0x15d7a4={'raw':!![],'where':{'id':_0x32042c[_0x1595('0x41')]['id']}},_0x1e4194={};_0x1e4194[_0x1595('0x2f')]=_[_0x1595('0x2c')](db['MailTransferReport'][_0x1595('0x26')]);_0x1e4194[_0x1595('0x2b')]=_['keys'](_0x32042c[_0x1595('0x2b')]);_0x1e4194[_0x1595('0x2d')]=_[_0x1595('0x2e')](_0x1e4194[_0x1595('0x2f')],_0x1e4194[_0x1595('0x2b')]);_0x15d7a4[_0x1595('0x30')]=_['intersection'](_0x1e4194['model'],qs['fields'](_0x32042c[_0x1595('0x2b')][_0x1595('0x31')]));_0x15d7a4['attributes']=_0x15d7a4[_0x1595('0x30')][_0x1595('0x32')]?_0x15d7a4[_0x1595('0x30')]:_0x1e4194['model'];if(_0x32042c['query'][_0x1595('0x3d')]){_0x15d7a4[_0x1595('0x42')]=[{'all':!![]}];}_0x15d7a4=_[_0x1595('0x3a')]({},_0x15d7a4,_0x32042c['options']);return db[_0x1595('0x25')][_0x1595('0x43')](_0x15d7a4)['then'](handleEntityNotFound(_0x355945,null))[_0x1595('0x1e')](respondWithResult(_0x355945,null))[_0x1595('0x3f')](handleError(_0x355945,null));};exports['create']=function(_0x2aab04,_0x925bfa){return db[_0x1595('0x25')][_0x1595('0x44')](_0x2aab04[_0x1595('0x45')],{})[_0x1595('0x1e')](respondWithResult(_0x925bfa,0xc9))[_0x1595('0x3f')](handleError(_0x925bfa,null));};exports[_0x1595('0x1d')]=function(_0xd123a7,_0x428bb8){if(_0xd123a7[_0x1595('0x45')]['id']){delete _0xd123a7[_0x1595('0x45')]['id'];}return db[_0x1595('0x25')][_0x1595('0x43')]({'where':{'id':_0xd123a7['params']['id']}})[_0x1595('0x1e')](handleEntityNotFound(_0x428bb8,null))[_0x1595('0x1e')](saveUpdates(_0xd123a7['body'],null))['then'](respondWithResult(_0x428bb8,null))['catch'](handleError(_0x428bb8,null));};exports[_0x1595('0x1f')]=function(_0x165485,_0x448f37){return db[_0x1595('0x25')][_0x1595('0x43')]({'where':{'id':_0x165485['params']['id']}})[_0x1595('0x1e')](handleEntityNotFound(_0x448f37,null))[_0x1595('0x1e')](removeEntity(_0x448f37,null))[_0x1595('0x3f')](handleError(_0x448f37,null));};exports[_0x1595('0x46')]=function(_0x236062,_0x49ee58){return db[_0x1595('0x25')][_0x1595('0x46')]()[_0x1595('0x1e')](respondWithResult(_0x49ee58,null))[_0x1595('0x3f')](handleError(_0x49ee58,null));}; \ No newline at end of file +var _0x14a9=['apply','reject','save','update','then','error','stack','name','send','index','map','MailTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','where','pick','filter','merge','include','findAll','rows','catch','params','includeAll','options','find','body','destroy','describe','eml-format','zip-dir','bluebird','util','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','end','undefined','count','offset','set','Content-Range','json'];(function(_0x31ca7f,_0x4ff2ff){var _0x2a2388=function(_0x4f2325){while(--_0x4f2325){_0x31ca7f['push'](_0x31ca7f['shift']());}};_0x2a2388(++_0x4ff2ff);}(_0x14a9,0x76));var _0x914a=function(_0x168dab,_0x4abfce){_0x168dab=_0x168dab-0x0;var _0x166a20=_0x14a9[_0x168dab];return _0x166a20;};'use strict';var emlformat=require(_0x914a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x914a('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x914a('0x2'));var Mustache=require('mustache');var util=require(_0x914a('0x3'));var path=require('path');var sox=require(_0x914a('0x4'));var csv=require(_0x914a('0x5'));var ejs=require(_0x914a('0x6'));var fs=require('fs');var fs_extra=require(_0x914a('0x7'));var _=require('lodash');var squel=require(_0x914a('0x8'));var crypto=require(_0x914a('0x9'));var jsforce=require(_0x914a('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x914a('0x5'));var querystring=require(_0x914a('0xb'));var Papa=require(_0x914a('0xc'));var Redis=require(_0x914a('0xd'));var authService=require(_0x914a('0xe'));var qs=require(_0x914a('0xf'));var as=require(_0x914a('0x10'));var hardwareService=require(_0x914a('0x11'));var logger=require(_0x914a('0x12'))(_0x914a('0x13'));var utils=require(_0x914a('0x14'));var config=require(_0x914a('0x15'));var licenseUtil=require(_0x914a('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x211c11,_0x2a8865){_0x2a8865=_0x2a8865||0xcc;return function(_0x21cff9){if(_0x21cff9){return _0x211c11[_0x914a('0x17')](_0x2a8865);}return _0x211c11[_0x914a('0x18')](_0x2a8865)[_0x914a('0x19')]();};}function respondWithResult(_0x19faa9,_0x1dc4b2){_0x1dc4b2=_0x1dc4b2||0xc8;return function(_0x4f546b){if(_0x4f546b){return _0x19faa9[_0x914a('0x18')](_0x1dc4b2)['json'](_0x4f546b);}};}function respondWithFilteredResult(_0x3b9661,_0x1e2386){return function(_0x21fc0f){if(_0x21fc0f){var _0x32da36=typeof _0x1e2386['offset']===_0x914a('0x1a')&&typeof _0x1e2386['limit']===_0x914a('0x1a');var _0xaa3179=_0x21fc0f[_0x914a('0x1b')];var _0x5f037b=_0x32da36?0x0:_0x1e2386[_0x914a('0x1c')];var _0x5871cf=_0x32da36?_0x21fc0f[_0x914a('0x1b')]:_0x1e2386[_0x914a('0x1c')]+_0x1e2386['limit'];var _0x435a5;if(_0x5871cf>=_0xaa3179){_0x5871cf=_0xaa3179;_0x435a5=0xc8;}else{_0x435a5=0xce;}_0x3b9661[_0x914a('0x18')](_0x435a5);return _0x3b9661[_0x914a('0x1d')](_0x914a('0x1e'),_0x5f037b+'-'+_0x5871cf+'/'+_0xaa3179)[_0x914a('0x1f')](_0x21fc0f);}return null;};}function patchUpdates(_0x477acb){return function(_0x9e96c8){try{jsonpatch[_0x914a('0x20')](_0x9e96c8,_0x477acb,!![]);}catch(_0x59d71b){return BPromise[_0x914a('0x21')](_0x59d71b);}return _0x9e96c8[_0x914a('0x22')]();};}function saveUpdates(_0x59b871,_0x3a7acc){return function(_0x26099f){if(_0x26099f){return _0x26099f[_0x914a('0x23')](_0x59b871)['then'](function(_0xb011c0){return _0xb011c0;});}return null;};}function removeEntity(_0x41a26d,_0x2f04d2){return function(_0xbb78d0){if(_0xbb78d0){return _0xbb78d0['destroy']()[_0x914a('0x24')](function(){_0x41a26d[_0x914a('0x18')](0xcc)[_0x914a('0x19')]();});}};}function handleEntityNotFound(_0x33750c,_0x31ab40){return function(_0x2cd27){if(!_0x2cd27){_0x33750c[_0x914a('0x17')](0x194);}return _0x2cd27;};}function handleError(_0x260c0d,_0xa8de1d){_0xa8de1d=_0xa8de1d||0x1f4;return function(_0x40c850){logger[_0x914a('0x25')](_0x40c850[_0x914a('0x26')]);if(_0x40c850[_0x914a('0x27')]){delete _0x40c850[_0x914a('0x27')];}_0x260c0d['status'](_0xa8de1d)[_0x914a('0x28')](_0x40c850);};}exports[_0x914a('0x29')]=function(_0x233e7e,_0x1ef498){var _0x38a1b2={},_0x35519b={},_0x3fd927={'count':0x0,'rows':[]};var _0x16f2a5=_[_0x914a('0x2a')](db[_0x914a('0x2b')][_0x914a('0x2c')],function(_0x4eed45){return{'name':_0x4eed45[_0x914a('0x2d')],'type':_0x4eed45[_0x914a('0x2e')][_0x914a('0x2f')]};});_0x35519b[_0x914a('0x30')]=_[_0x914a('0x2a')](_0x16f2a5,_0x914a('0x27'));_0x35519b[_0x914a('0x31')]=_[_0x914a('0x32')](_0x233e7e[_0x914a('0x31')]);_0x35519b[_0x914a('0x33')]=_[_0x914a('0x34')](_0x35519b['model'],_0x35519b['query']);_0x38a1b2[_0x914a('0x35')]=_[_0x914a('0x34')](_0x35519b['model'],qs[_0x914a('0x36')](_0x233e7e[_0x914a('0x31')][_0x914a('0x36')]));_0x38a1b2[_0x914a('0x35')]=_0x38a1b2[_0x914a('0x35')][_0x914a('0x37')]?_0x38a1b2['attributes']:_0x35519b[_0x914a('0x30')];if(!_0x233e7e[_0x914a('0x31')][_0x914a('0x38')]('nolimit')){_0x38a1b2[_0x914a('0x39')]=qs[_0x914a('0x39')](_0x233e7e[_0x914a('0x31')][_0x914a('0x39')]);_0x38a1b2[_0x914a('0x1c')]=qs[_0x914a('0x1c')](_0x233e7e['query'][_0x914a('0x1c')]);}_0x38a1b2[_0x914a('0x3a')]=qs['sort'](_0x233e7e['query'][_0x914a('0x3b')]);_0x38a1b2[_0x914a('0x3c')]=qs[_0x914a('0x33')](_[_0x914a('0x3d')](_0x233e7e[_0x914a('0x31')],_0x35519b[_0x914a('0x33')]),_0x16f2a5);if(_0x233e7e[_0x914a('0x31')][_0x914a('0x3e')]){_0x38a1b2[_0x914a('0x3c')]=_['merge'](_0x38a1b2[_0x914a('0x3c')],{'$or':_[_0x914a('0x2a')](_0x16f2a5,function(_0x24ea56){if(_0x24ea56[_0x914a('0x2e')]!=='VIRTUAL'){var _0x47614b={};_0x47614b[_0x24ea56[_0x914a('0x27')]]={'$like':'%'+_0x233e7e[_0x914a('0x31')][_0x914a('0x3e')]+'%'};return _0x47614b;}})});}_0x38a1b2=_[_0x914a('0x3f')]({},_0x38a1b2,_0x233e7e['options']);var _0x122765={'where':_0x38a1b2[_0x914a('0x3c')]};return db['MailTransferReport'][_0x914a('0x1b')](_0x122765)[_0x914a('0x24')](function(_0x33042d){_0x3fd927['count']=_0x33042d;if(_0x233e7e[_0x914a('0x31')]['includeAll']){_0x38a1b2[_0x914a('0x40')]=[{'all':!![]}];}return db[_0x914a('0x2b')][_0x914a('0x41')](_0x38a1b2);})['then'](function(_0x109232){_0x3fd927[_0x914a('0x42')]=_0x109232;return _0x3fd927;})[_0x914a('0x24')](respondWithFilteredResult(_0x1ef498,_0x38a1b2))[_0x914a('0x43')](handleError(_0x1ef498,null));};exports['show']=function(_0x587caf,_0x4e5c7e){var _0x175dda={'raw':!![],'where':{'id':_0x587caf[_0x914a('0x44')]['id']}},_0x574ce1={};_0x574ce1[_0x914a('0x30')]=_['keys'](db['MailTransferReport'][_0x914a('0x2c')]);_0x574ce1[_0x914a('0x31')]=_['keys'](_0x587caf[_0x914a('0x31')]);_0x574ce1[_0x914a('0x33')]=_[_0x914a('0x34')](_0x574ce1[_0x914a('0x30')],_0x574ce1[_0x914a('0x31')]);_0x175dda[_0x914a('0x35')]=_['intersection'](_0x574ce1[_0x914a('0x30')],qs['fields'](_0x587caf[_0x914a('0x31')][_0x914a('0x36')]));_0x175dda[_0x914a('0x35')]=_0x175dda[_0x914a('0x35')][_0x914a('0x37')]?_0x175dda[_0x914a('0x35')]:_0x574ce1[_0x914a('0x30')];if(_0x587caf[_0x914a('0x31')][_0x914a('0x45')]){_0x175dda['include']=[{'all':!![]}];}_0x175dda=_[_0x914a('0x3f')]({},_0x175dda,_0x587caf[_0x914a('0x46')]);return db[_0x914a('0x2b')][_0x914a('0x47')](_0x175dda)['then'](handleEntityNotFound(_0x4e5c7e,null))['then'](respondWithResult(_0x4e5c7e,null))[_0x914a('0x43')](handleError(_0x4e5c7e,null));};exports['create']=function(_0x5a7b00,_0x57e62c){return db[_0x914a('0x2b')]['create'](_0x5a7b00[_0x914a('0x48')],{})[_0x914a('0x24')](respondWithResult(_0x57e62c,0xc9))[_0x914a('0x43')](handleError(_0x57e62c,null));};exports[_0x914a('0x23')]=function(_0xe34e8a,_0x26cc54){if(_0xe34e8a[_0x914a('0x48')]['id']){delete _0xe34e8a['body']['id'];}return db[_0x914a('0x2b')][_0x914a('0x47')]({'where':{'id':_0xe34e8a[_0x914a('0x44')]['id']}})[_0x914a('0x24')](handleEntityNotFound(_0x26cc54,null))[_0x914a('0x24')](saveUpdates(_0xe34e8a[_0x914a('0x48')],null))[_0x914a('0x24')](respondWithResult(_0x26cc54,null))[_0x914a('0x43')](handleError(_0x26cc54,null));};exports[_0x914a('0x49')]=function(_0x51db59,_0x1c4e02){return db[_0x914a('0x2b')][_0x914a('0x47')]({'where':{'id':_0x51db59[_0x914a('0x44')]['id']}})['then'](handleEntityNotFound(_0x1c4e02,null))[_0x914a('0x24')](removeEntity(_0x1c4e02,null))['catch'](handleError(_0x1c4e02,null));};exports[_0x914a('0x4a')]=function(_0x5b02d4,_0x596a52){return db[_0x914a('0x2b')][_0x914a('0x4a')]()[_0x914a('0x24')](respondWithResult(_0x596a52,null))[_0x914a('0x43')](handleError(_0x596a52,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index 4059606..197ff81 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 _0x6d65=['exports','MailTransferReport','uniqueid','lodash','util','api','bluebird','request-promise','rimraf','../../config/environment','./mailTransferReport.attributes'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x6d65,0x100));var _0x56d6=function(_0x329508,_0x55f03f){_0x329508=_0x329508-0x0;var _0x5864b0=_0x6d65[_0x329508];return _0x5864b0;};'use strict';var _=require(_0x56d6('0x0'));var util=require(_0x56d6('0x1'));var logger=require('../../config/logger')(_0x56d6('0x2'));var moment=require('moment');var BPromise=require(_0x56d6('0x3'));var rp=require(_0x56d6('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x56d6('0x5'));var config=require(_0x56d6('0x6'));var attributes=require(_0x56d6('0x7'));module[_0x56d6('0x8')]=function(_0x17f94d,_0x2febbb){return _0x17f94d['define'](_0x56d6('0x9'),attributes,{'tableName':'report_mail_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x56d6('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xdc0d=['rimraf','../../config/environment','./mailTransferReport.attributes','exports','MailTransferReport','report_mail_transfer','uniqueid','lodash','util','api','bluebird','request-promise','path'];(function(_0x23ea86,_0x3dfd6b){var _0x34f82f=function(_0x2faa22){while(--_0x2faa22){_0x23ea86['push'](_0x23ea86['shift']());}};_0x34f82f(++_0x3dfd6b);}(_0xdc0d,0x1db));var _0xddc0=function(_0x5590e8,_0x577789){_0x5590e8=_0x5590e8-0x0;var _0x1ed1bc=_0xdc0d[_0x5590e8];return _0x1ed1bc;};'use strict';var _=require(_0xddc0('0x0'));var util=require(_0xddc0('0x1'));var logger=require('../../config/logger')(_0xddc0('0x2'));var moment=require('moment');var BPromise=require(_0xddc0('0x3'));var rp=require(_0xddc0('0x4'));var fs=require('fs');var path=require(_0xddc0('0x5'));var rimraf=require(_0xddc0('0x6'));var config=require(_0xddc0('0x7'));var attributes=require(_0xddc0('0x8'));module[_0xddc0('0x9')]=function(_0x39a8da,_0x20f5a9){return _0x39a8da['define'](_0xddc0('0xa'),attributes,{'tableName':_0xddc0('0xb'),'paranoid':![],'indexes':[{'name':_0xddc0('0xc'),'fields':[_0xddc0('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index b1defe0..ce1020b 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 _0x5861=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','MailTransferReport,\x20%s,\x20%s','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','catch','lodash','util','moment'];(function(_0x2aab65,_0x3da432){var _0x25a005=function(_0x1806ef){while(--_0x1806ef){_0x2aab65['push'](_0x2aab65['shift']());}};_0x25a005(++_0x3da432);}(_0x5861,0x1f1));var _0x1586=function(_0x331ad2,_0x379f62){_0x331ad2=_0x331ad2-0x0;var _0x53800a=_0x5861[_0x331ad2];return _0x53800a;};'use strict';var _=require(_0x1586('0x0'));var util=require(_0x1586('0x1'));var moment=require(_0x1586('0x2'));var BPromise=require(_0x1586('0x3'));var rs=require(_0x1586('0x4'));var fs=require('fs');var Redis=require(_0x1586('0x5'));var db=require(_0x1586('0x6'))['db'];var utils=require(_0x1586('0x7'));var logger=require(_0x1586('0x8'))(_0x1586('0x9'));var config=require('../../config/environment');var jayson=require(_0x1586('0xa'));var client=jayson[_0x1586('0xb')][_0x1586('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x457425,_0x15bad6,_0x35afc5){return new BPromise(function(_0x263dfd,_0x31575e){return client[_0x1586('0xd')](_0x457425,_0x35afc5)[_0x1586('0xe')](function(_0x398142){logger['info'](_0x1586('0xf'),_0x15bad6,'request\x20sent');logger[_0x1586('0x10')](_0x1586('0x11'),_0x15bad6,'request\x20sent',JSON[_0x1586('0x12')](_0x398142));if(_0x398142[_0x1586('0x13')]){if(_0x398142[_0x1586('0x13')][_0x1586('0x14')]===0x1f4){logger[_0x1586('0x13')](_0x1586('0xf'),_0x15bad6,_0x398142['error'][_0x1586('0x15')]);return _0x31575e(_0x398142['error'][_0x1586('0x15')]);}logger[_0x1586('0x13')]('MailTransferReport,\x20%s,\x20%s',_0x15bad6,_0x398142[_0x1586('0x13')][_0x1586('0x15')]);return _0x263dfd(_0x398142[_0x1586('0x13')][_0x1586('0x15')]);}else{logger[_0x1586('0x16')](_0x1586('0xf'),_0x15bad6,_0x1586('0x17'));_0x263dfd(_0x398142['result'][_0x1586('0x15')]);}})[_0x1586('0x18')](function(_0x41f5a8){logger[_0x1586('0x13')](_0x1586('0xf'),_0x15bad6,_0x41f5a8);_0x31575e(_0x41f5a8);});});} \ No newline at end of file +var _0x4982=['message','result','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','error'];(function(_0x1272ab,_0x2e0972){var _0x3f8ced=function(_0x39f7ad){while(--_0x39f7ad){_0x1272ab['push'](_0x1272ab['shift']());}};_0x3f8ced(++_0x2e0972);}(_0x4982,0x18e));var _0x2498=function(_0x3d2fe5,_0x2f9c71){_0x3d2fe5=_0x3d2fe5-0x0;var _0x48de9d=_0x4982[_0x3d2fe5];return _0x48de9d;};'use strict';var _=require(_0x2498('0x0'));var util=require(_0x2498('0x1'));var moment=require(_0x2498('0x2'));var BPromise=require(_0x2498('0x3'));var rs=require(_0x2498('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x2498('0x5'));var logger=require(_0x2498('0x6'))(_0x2498('0x7'));var config=require(_0x2498('0x8'));var jayson=require(_0x2498('0x9'));var client=jayson[_0x2498('0xa')][_0x2498('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x88e57,_0x1542af,_0x20fef3){return new BPromise(function(_0x1c0f06,_0x49a2fc){return client[_0x2498('0xc')](_0x88e57,_0x20fef3)[_0x2498('0xd')](function(_0x27f1fb){logger[_0x2498('0xe')](_0x2498('0xf'),_0x1542af,_0x2498('0x10'));logger[_0x2498('0x11')](_0x2498('0x12'),_0x1542af,'request\x20sent',JSON['stringify'](_0x27f1fb));if(_0x27f1fb['error']){if(_0x27f1fb[_0x2498('0x13')]['code']===0x1f4){logger[_0x2498('0x13')](_0x2498('0xf'),_0x1542af,_0x27f1fb['error'][_0x2498('0x14')]);return _0x49a2fc(_0x27f1fb[_0x2498('0x13')][_0x2498('0x14')]);}logger['error'](_0x2498('0xf'),_0x1542af,_0x27f1fb[_0x2498('0x13')][_0x2498('0x14')]);return _0x1c0f06(_0x27f1fb[_0x2498('0x13')][_0x2498('0x14')]);}else{logger[_0x2498('0xe')]('MailTransferReport,\x20%s,\x20%s',_0x1542af,_0x2498('0x10'));_0x1c0f06(_0x27f1fb[_0x2498('0x15')][_0x2498('0x14')]);}})['catch'](function(_0x2e0a77){logger[_0x2498('0x13')](_0x2498('0xf'),_0x1542af,_0x2e0a77);_0x49a2fc(_0x2e0a77);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index 737b495..dc6d264 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 _0x7fef=['/describe','isAuthenticated','/:id','show','post','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./memberReport.controller','get','index'];(function(_0x345c3d,_0x5366ec){var _0x100018=function(_0xe89319){while(--_0xe89319){_0x345c3d['push'](_0x345c3d['shift']());}};_0x100018(++_0x5366ec);}(_0x7fef,0x1ed));var _0xf7fe=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7fef[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xf7fe('0x0'));var util=require(_0xf7fe('0x1'));var path=require(_0xf7fe('0x2'));var timeout=require(_0xf7fe('0x3'));var express=require(_0xf7fe('0x4'));var router=express[_0xf7fe('0x5')]();var fs_extra=require(_0xf7fe('0x6'));var auth=require(_0xf7fe('0x7'));var interaction=require(_0xf7fe('0x8'));var config=require(_0xf7fe('0x9'));var controller=require(_0xf7fe('0xa'));router[_0xf7fe('0xb')]('/',auth['isAuthenticated'](),controller[_0xf7fe('0xc')]);router[_0xf7fe('0xb')](_0xf7fe('0xd'),auth[_0xf7fe('0xe')](),controller['describe']);router['get'](_0xf7fe('0xf'),auth[_0xf7fe('0xe')](),controller[_0xf7fe('0x10')]);router[_0xf7fe('0x11')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xf7fe('0xf'),auth['isAuthenticated'](),controller[_0xf7fe('0x12')]);router[_0xf7fe('0x13')](_0xf7fe('0xf'),auth[_0xf7fe('0xe')](),controller[_0xf7fe('0x14')]);module[_0xf7fe('0x15')]=router; \ No newline at end of file +var _0x0f8d=['get','isAuthenticated','index','describe','show','post','create','/:id','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./memberReport.controller'];(function(_0x2c2390,_0x37ef1c){var _0x478b7e=function(_0x2ea947){while(--_0x2ea947){_0x2c2390['push'](_0x2c2390['shift']());}};_0x478b7e(++_0x37ef1c);}(_0x0f8d,0x7d));var _0xd0f8=function(_0x14f30b,_0x4ac7ca){_0x14f30b=_0x14f30b-0x0;var _0x248b2e=_0x0f8d[_0x14f30b];return _0x248b2e;};'use strict';var multer=require(_0xd0f8('0x0'));var util=require(_0xd0f8('0x1'));var path=require(_0xd0f8('0x2'));var timeout=require(_0xd0f8('0x3'));var express=require(_0xd0f8('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xd0f8('0x5'));var interaction=require(_0xd0f8('0x6'));var config=require('../../config/environment');var controller=require(_0xd0f8('0x7'));router[_0xd0f8('0x8')]('/',auth[_0xd0f8('0x9')](),controller[_0xd0f8('0xa')]);router[_0xd0f8('0x8')]('/describe',auth[_0xd0f8('0x9')](),controller[_0xd0f8('0xb')]);router[_0xd0f8('0x8')]('/:id',auth[_0xd0f8('0x9')](),controller[_0xd0f8('0xc')]);router[_0xd0f8('0xd')]('/',auth[_0xd0f8('0x9')](),controller[_0xd0f8('0xe')]);router['put'](_0xd0f8('0xf'),auth[_0xd0f8('0x9')](),controller['update']);router[_0xd0f8('0x10')](_0xd0f8('0xf'),auth['isAuthenticated'](),controller[_0xd0f8('0x11')]);module[_0xd0f8('0x12')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index 67d598b..7e05a3b 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 _0xf3be=['exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue','diff','seconds','setDataValue','exitAt','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','sequelize','moment'];(function(_0x394773,_0x59a39b){var _0x502a71=function(_0x4abfd6){while(--_0x4abfd6){_0x394773['push'](_0x394773['shift']());}};_0x502a71(++_0x59a39b);}(_0xf3be,0x178));var _0xef3b=function(_0x449196,_0x2de520){_0x449196=_0x449196-0x0;var _0x472dcd=_0xf3be[_0x449196];return _0x472dcd;};'use strict';var Sequelize=require(_0xef3b('0x0'));var moment=require(_0xef3b('0x1'));module[_0xef3b('0x2')]={'channel':{'type':Sequelize[_0xef3b('0x3')]},'membername':{'type':Sequelize[_0xef3b('0x3')]},'interface':{'type':Sequelize[_0xef3b('0x3')]},'type':{'type':Sequelize[_0xef3b('0x3')],'defaultValue':_0xef3b('0x4'),'comment':_0xef3b('0x5')},'duration':{'type':Sequelize[_0xef3b('0x6')]},'enterAt':{'type':Sequelize[_0xef3b('0x7')]},'exitAt':{'type':Sequelize[_0xef3b('0x7')],'set':function(_0xb704d5){var _0x1b887c=moment(_0xb704d5);var _0x39a6c4=moment(this[_0xef3b('0x8')]('enterAt'));var _0x4e48be=_0x1b887c[_0xef3b('0x9')](_0x39a6c4,_0xef3b('0xa'));this[_0xef3b('0xb')](_0xef3b('0xc'),_0xb704d5);this[_0xef3b('0xb')](_0xef3b('0xd'),_0x4e48be>=0x0?_0x4e48be:null);}},'data1':{'type':Sequelize[_0xef3b('0x3')],'comment':_0xef3b('0xe')},'data2':{'type':Sequelize[_0xef3b('0x3')],'comment':'talk:[start]'},'data3':{'type':Sequelize[_0xef3b('0x3')],'comment':_0xef3b('0xf')},'data4':{'type':Sequelize[_0xef3b('0x3')],'comment':_0xef3b('0x10')},'data5':{'type':Sequelize[_0xef3b('0x3')],'comment':_0xef3b('0x11')},'role':{'type':Sequelize[_0xef3b('0x3')]},'internal':{'type':Sequelize[_0xef3b('0x6')]},'uniqueid':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x4940=['INTEGER','sequelize','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','DATE','getDataValue','enterAt','diff','setDataValue','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[dial\x20string]','talk:[queue]'];(function(_0x46ab3e,_0x30ba86){var _0x183117=function(_0x1fabf9){while(--_0x1fabf9){_0x46ab3e['push'](_0x46ab3e['shift']());}};_0x183117(++_0x30ba86);}(_0x4940,0x1d1));var _0x0494=function(_0x279d37,_0x14de3f){_0x279d37=_0x279d37-0x0;var _0x530173=_0x4940[_0x279d37];return _0x530173;};'use strict';var Sequelize=require(_0x0494('0x0'));var moment=require('moment');module[_0x0494('0x1')]={'channel':{'type':Sequelize[_0x0494('0x2')]},'membername':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x0494('0x2')]},'type':{'type':Sequelize[_0x0494('0x2')],'defaultValue':_0x0494('0x3'),'comment':_0x0494('0x4')},'duration':{'type':Sequelize['INTEGER']},'enterAt':{'type':Sequelize[_0x0494('0x5')]},'exitAt':{'type':Sequelize[_0x0494('0x5')],'set':function(_0x42c612){var _0x58a3ae=moment(_0x42c612);var _0x401112=moment(this[_0x0494('0x6')](_0x0494('0x7')));var _0xf85af=_0x58a3ae[_0x0494('0x8')](_0x401112,'seconds');this[_0x0494('0x9')]('exitAt',_0x42c612);this['setDataValue']('duration',_0xf85af>=0x0?_0xf85af:null);}},'data1':{'type':Sequelize[_0x0494('0x2')],'comment':_0x0494('0xa')},'data2':{'type':Sequelize[_0x0494('0x2')],'comment':_0x0494('0xb')},'data3':{'type':Sequelize[_0x0494('0x2')],'comment':_0x0494('0xc')},'data4':{'type':Sequelize[_0x0494('0x2')],'comment':_0x0494('0xd')},'data5':{'type':Sequelize[_0x0494('0x2')],'comment':_0x0494('0xe')},'role':{'type':Sequelize[_0x0494('0x2')]},'internal':{'type':Sequelize[_0x0494('0xf')]},'uniqueid':{'type':Sequelize[_0x0494('0x2')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index 4649816..6544d2e 100644 --- a/server/api/memberReport/memberReport.controller.js +++ b/server/api/memberReport/memberReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['catch','params','find','create','body','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','sendStatus','stack','name','send','index','map','MemberReport','rawAttributes','fieldName','type','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','then','includeAll','include','findAll','rows'];(function(_0x2a0840,_0x4d93f9){var _0x1c4768=function(_0x68510){while(--_0x68510){_0x2a0840['push'](_0x2a0840['shift']());}};_0x1c4768(++_0x4d93f9);}(_0x9c44,0x178));var _0x49c4=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x9c44[_0x8c43de];return _0xa6591b;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x49c4('0x0'));var jsonpatch=require(_0x49c4('0x1'));var rp=require(_0x49c4('0x2'));var moment=require(_0x49c4('0x3'));var BPromise=require(_0x49c4('0x4'));var Mustache=require(_0x49c4('0x5'));var util=require('util');var path=require('path');var sox=require(_0x49c4('0x6'));var csv=require('to-csv');var ejs=require(_0x49c4('0x7'));var fs=require('fs');var fs_extra=require(_0x49c4('0x8'));var _=require(_0x49c4('0x9'));var squel=require(_0x49c4('0xa'));var crypto=require(_0x49c4('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x49c4('0xc'));var toCsv=require(_0x49c4('0xd'));var querystring=require(_0x49c4('0xe'));var Papa=require(_0x49c4('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x49c4('0x10'));var as=require(_0x49c4('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x49c4('0x12'))(_0x49c4('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x49c4('0x14'));var db=require(_0x49c4('0x15'))['db'];function respondWithStatusCode(_0x5487cd,_0x7df3a9){_0x7df3a9=_0x7df3a9||0xcc;return function(_0x403bfb){if(_0x403bfb){return _0x5487cd['sendStatus'](_0x7df3a9);}return _0x5487cd[_0x49c4('0x16')](_0x7df3a9)[_0x49c4('0x17')]();};}function respondWithResult(_0x21f15a,_0x2decee){_0x2decee=_0x2decee||0xc8;return function(_0x12777c){if(_0x12777c){return _0x21f15a[_0x49c4('0x16')](_0x2decee)[_0x49c4('0x18')](_0x12777c);}};}function respondWithFilteredResult(_0x3de397,_0x58d177){return function(_0x3acd06){if(_0x3acd06){var _0x141003=typeof _0x58d177[_0x49c4('0x19')]===_0x49c4('0x1a')&&typeof _0x58d177[_0x49c4('0x1b')]==='undefined';var _0x44e607=_0x3acd06[_0x49c4('0x1c')];var _0x4c3253=_0x141003?0x0:_0x58d177['offset'];var _0x3c782d=_0x141003?_0x3acd06[_0x49c4('0x1c')]:_0x58d177[_0x49c4('0x19')]+_0x58d177['limit'];var _0x24856d;if(_0x3c782d>=_0x44e607){_0x3c782d=_0x44e607;_0x24856d=0xc8;}else{_0x24856d=0xce;}_0x3de397['status'](_0x24856d);return _0x3de397[_0x49c4('0x1d')](_0x49c4('0x1e'),_0x4c3253+'-'+_0x3c782d+'/'+_0x44e607)[_0x49c4('0x18')](_0x3acd06);}return null;};}function patchUpdates(_0x291526){return function(_0x382040){try{jsonpatch[_0x49c4('0x1f')](_0x382040,_0x291526,!![]);}catch(_0x280893){return BPromise[_0x49c4('0x20')](_0x280893);}return _0x382040[_0x49c4('0x21')]();};}function saveUpdates(_0x578447,_0x527126){return function(_0x57f502){if(_0x57f502){return _0x57f502[_0x49c4('0x22')](_0x578447)['then'](function(_0x592bb8){return _0x592bb8;});}return null;};}function removeEntity(_0x2263ae,_0x15581b){return function(_0x26c640){if(_0x26c640){return _0x26c640[_0x49c4('0x23')]()['then'](function(){_0x2263ae['status'](0xcc)[_0x49c4('0x17')]();});}};}function handleEntityNotFound(_0x9cb797,_0x565423){return function(_0x207358){if(!_0x207358){_0x9cb797[_0x49c4('0x24')](0x194);}return _0x207358;};}function handleError(_0x210159,_0xa7a826){_0xa7a826=_0xa7a826||0x1f4;return function(_0x531d92){logger['error'](_0x531d92[_0x49c4('0x25')]);if(_0x531d92['name']){delete _0x531d92[_0x49c4('0x26')];}_0x210159[_0x49c4('0x16')](_0xa7a826)[_0x49c4('0x27')](_0x531d92);};}exports[_0x49c4('0x28')]=function(_0x5987ae,_0x889909){var _0x2b2793={},_0x46e04d={},_0x4f28a2={'count':0x0,'rows':[]};var _0x6329b3=_[_0x49c4('0x29')](db[_0x49c4('0x2a')][_0x49c4('0x2b')],function(_0x17b50f){return{'name':_0x17b50f[_0x49c4('0x2c')],'type':_0x17b50f[_0x49c4('0x2d')]['key']};});_0x46e04d['model']=_['map'](_0x6329b3,_0x49c4('0x26'));_0x46e04d[_0x49c4('0x2e')]=_[_0x49c4('0x2f')](_0x5987ae[_0x49c4('0x2e')]);_0x46e04d[_0x49c4('0x30')]=_['intersection'](_0x46e04d[_0x49c4('0x31')],_0x46e04d[_0x49c4('0x2e')]);_0x2b2793[_0x49c4('0x32')]=_[_0x49c4('0x33')](_0x46e04d['model'],qs['fields'](_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x34')]));_0x2b2793[_0x49c4('0x32')]=_0x2b2793[_0x49c4('0x32')][_0x49c4('0x35')]?_0x2b2793['attributes']:_0x46e04d[_0x49c4('0x31')];if(!_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x36')]('nolimit')){_0x2b2793['limit']=qs[_0x49c4('0x1b')](_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x1b')]);_0x2b2793[_0x49c4('0x19')]=qs[_0x49c4('0x19')](_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x19')]);}_0x2b2793[_0x49c4('0x37')]=qs[_0x49c4('0x38')](_0x5987ae['query'][_0x49c4('0x38')]);_0x2b2793['where']=qs[_0x49c4('0x30')](_[_0x49c4('0x39')](_0x5987ae[_0x49c4('0x2e')],_0x46e04d[_0x49c4('0x30')]),_0x6329b3);if(_0x5987ae['query'][_0x49c4('0x3a')]){_0x2b2793[_0x49c4('0x3b')]=_[_0x49c4('0x3c')](_0x2b2793['where'],{'$or':_[_0x49c4('0x29')](_0x6329b3,function(_0x21d8c7){if(_0x21d8c7[_0x49c4('0x2d')]!==_0x49c4('0x3d')){var _0x1ba7a0={};_0x1ba7a0[_0x21d8c7[_0x49c4('0x26')]]={'$like':'%'+_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x3a')]+'%'};return _0x1ba7a0;}})});}_0x2b2793=_[_0x49c4('0x3c')]({},_0x2b2793,_0x5987ae[_0x49c4('0x3e')]);var _0x1e506a={'where':_0x2b2793['where']};return db[_0x49c4('0x2a')][_0x49c4('0x1c')](_0x1e506a)[_0x49c4('0x3f')](function(_0x23aa32){_0x4f28a2[_0x49c4('0x1c')]=_0x23aa32;if(_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x40')]){_0x2b2793[_0x49c4('0x41')]=[{'all':!![]}];}return db[_0x49c4('0x2a')][_0x49c4('0x42')](_0x2b2793);})[_0x49c4('0x3f')](function(_0xa3d59e){_0x4f28a2[_0x49c4('0x43')]=_0xa3d59e;return _0x4f28a2;})['then'](respondWithFilteredResult(_0x889909,_0x2b2793))[_0x49c4('0x44')](handleError(_0x889909,null));};exports['show']=function(_0x104efb,_0x4915bc){var _0x28d4fb={'raw':!![],'where':{'id':_0x104efb[_0x49c4('0x45')]['id']}},_0x1480da={};_0x1480da[_0x49c4('0x31')]=_['keys'](db['MemberReport'][_0x49c4('0x2b')]);_0x1480da[_0x49c4('0x2e')]=_[_0x49c4('0x2f')](_0x104efb[_0x49c4('0x2e')]);_0x1480da['filters']=_[_0x49c4('0x33')](_0x1480da[_0x49c4('0x31')],_0x1480da[_0x49c4('0x2e')]);_0x28d4fb[_0x49c4('0x32')]=_[_0x49c4('0x33')](_0x1480da[_0x49c4('0x31')],qs[_0x49c4('0x34')](_0x104efb[_0x49c4('0x2e')][_0x49c4('0x34')]));_0x28d4fb['attributes']=_0x28d4fb[_0x49c4('0x32')]['length']?_0x28d4fb[_0x49c4('0x32')]:_0x1480da[_0x49c4('0x31')];if(_0x104efb[_0x49c4('0x2e')][_0x49c4('0x40')]){_0x28d4fb[_0x49c4('0x41')]=[{'all':!![]}];}_0x28d4fb=_['merge']({},_0x28d4fb,_0x104efb[_0x49c4('0x3e')]);return db[_0x49c4('0x2a')][_0x49c4('0x46')](_0x28d4fb)[_0x49c4('0x3f')](handleEntityNotFound(_0x4915bc,null))[_0x49c4('0x3f')](respondWithResult(_0x4915bc,null))[_0x49c4('0x44')](handleError(_0x4915bc,null));};exports[_0x49c4('0x47')]=function(_0x4d89e0,_0x3bac1b){return db['MemberReport'][_0x49c4('0x47')](_0x4d89e0[_0x49c4('0x48')],{})[_0x49c4('0x3f')](respondWithResult(_0x3bac1b,0xc9))[_0x49c4('0x44')](handleError(_0x3bac1b,null));};exports[_0x49c4('0x22')]=function(_0x30bea5,_0x2c6be1){if(_0x30bea5['body']['id']){delete _0x30bea5[_0x49c4('0x48')]['id'];}return db[_0x49c4('0x2a')]['find']({'where':{'id':_0x30bea5[_0x49c4('0x45')]['id']}})[_0x49c4('0x3f')](handleEntityNotFound(_0x2c6be1,null))[_0x49c4('0x3f')](saveUpdates(_0x30bea5[_0x49c4('0x48')],null))['then'](respondWithResult(_0x2c6be1,null))['catch'](handleError(_0x2c6be1,null));};exports[_0x49c4('0x23')]=function(_0x4e8221,_0x4597c3){return db[_0x49c4('0x2a')][_0x49c4('0x46')]({'where':{'id':_0x4e8221[_0x49c4('0x45')]['id']}})[_0x49c4('0x3f')](handleEntityNotFound(_0x4597c3,null))[_0x49c4('0x3f')](removeEntity(_0x4597c3,null))[_0x49c4('0x44')](handleError(_0x4597c3,null));};exports['describe']=function(_0x1f26c2,_0x1550ce){return db[_0x49c4('0x2a')][_0x49c4('0x49')]()[_0x49c4('0x3f')](respondWithResult(_0x1550ce,null))[_0x49c4('0x44')](handleError(_0x1550ce,null));}; \ No newline at end of file +var _0x34e8=['path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','map','MemberReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','options','includeAll','catch','show','params','keys','include','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util'];(function(_0x4dbaad,_0x730318){var _0x226c72=function(_0x501972){while(--_0x501972){_0x4dbaad['push'](_0x4dbaad['shift']());}};_0x226c72(++_0x730318);}(_0x34e8,0x12c));var _0x834e=function(_0x308cf2,_0x1c6a34){_0x308cf2=_0x308cf2-0x0;var _0x5701f0=_0x34e8[_0x308cf2];return _0x5701f0;};'use strict';var emlformat=require(_0x834e('0x0'));var rimraf=require(_0x834e('0x1'));var zipdir=require(_0x834e('0x2'));var jsonpatch=require(_0x834e('0x3'));var rp=require('request-promise');var moment=require(_0x834e('0x4'));var BPromise=require(_0x834e('0x5'));var Mustache=require(_0x834e('0x6'));var util=require(_0x834e('0x7'));var path=require(_0x834e('0x8'));var sox=require(_0x834e('0x9'));var csv=require(_0x834e('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x834e('0xb'));var _=require('lodash');var squel=require(_0x834e('0xc'));var crypto=require(_0x834e('0xd'));var jsforce=require(_0x834e('0xe'));var deskjs=require(_0x834e('0xf'));var toCsv=require(_0x834e('0xa'));var querystring=require(_0x834e('0x10'));var Papa=require(_0x834e('0x11'));var Redis=require(_0x834e('0x12'));var authService=require(_0x834e('0x13'));var qs=require(_0x834e('0x14'));var as=require(_0x834e('0x15'));var hardwareService=require(_0x834e('0x16'));var logger=require(_0x834e('0x17'))(_0x834e('0x18'));var utils=require(_0x834e('0x19'));var config=require(_0x834e('0x1a'));var licenseUtil=require(_0x834e('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5e5b6d,_0x6cd9b9){_0x6cd9b9=_0x6cd9b9||0xcc;return function(_0x58a27e){if(_0x58a27e){return _0x5e5b6d[_0x834e('0x1c')](_0x6cd9b9);}return _0x5e5b6d[_0x834e('0x1d')](_0x6cd9b9)[_0x834e('0x1e')]();};}function respondWithResult(_0x21cc0a,_0x50e860){_0x50e860=_0x50e860||0xc8;return function(_0x43156c){if(_0x43156c){return _0x21cc0a[_0x834e('0x1d')](_0x50e860)['json'](_0x43156c);}};}function respondWithFilteredResult(_0x316205,_0x4a9cdc){return function(_0x38a8cd){if(_0x38a8cd){var _0x36d443=typeof _0x4a9cdc['offset']===_0x834e('0x1f')&&typeof _0x4a9cdc[_0x834e('0x20')]===_0x834e('0x1f');var _0x50b3f6=_0x38a8cd[_0x834e('0x21')];var _0x211e9a=_0x36d443?0x0:_0x4a9cdc[_0x834e('0x22')];var _0xb993a1=_0x36d443?_0x38a8cd[_0x834e('0x21')]:_0x4a9cdc[_0x834e('0x22')]+_0x4a9cdc[_0x834e('0x20')];var _0x595515;if(_0xb993a1>=_0x50b3f6){_0xb993a1=_0x50b3f6;_0x595515=0xc8;}else{_0x595515=0xce;}_0x316205[_0x834e('0x1d')](_0x595515);return _0x316205[_0x834e('0x23')](_0x834e('0x24'),_0x211e9a+'-'+_0xb993a1+'/'+_0x50b3f6)[_0x834e('0x25')](_0x38a8cd);}return null;};}function patchUpdates(_0x4ab05d){return function(_0x45a630){try{jsonpatch[_0x834e('0x26')](_0x45a630,_0x4ab05d,!![]);}catch(_0x5a05c0){return BPromise[_0x834e('0x27')](_0x5a05c0);}return _0x45a630[_0x834e('0x28')]();};}function saveUpdates(_0x8d406e,_0x5c55ca){return function(_0x4e3f48){if(_0x4e3f48){return _0x4e3f48[_0x834e('0x29')](_0x8d406e)[_0x834e('0x2a')](function(_0x589dde){return _0x589dde;});}return null;};}function removeEntity(_0x25ee1d,_0x1dc1e0){return function(_0x58f4fd){if(_0x58f4fd){return _0x58f4fd[_0x834e('0x2b')]()[_0x834e('0x2a')](function(){_0x25ee1d[_0x834e('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x24fcf7,_0x3e310f){return function(_0x5e1cc5){if(!_0x5e1cc5){_0x24fcf7['sendStatus'](0x194);}return _0x5e1cc5;};}function handleError(_0x1e713a,_0x508a1d){_0x508a1d=_0x508a1d||0x1f4;return function(_0x2826ec){logger[_0x834e('0x2c')](_0x2826ec[_0x834e('0x2d')]);if(_0x2826ec[_0x834e('0x2e')]){delete _0x2826ec[_0x834e('0x2e')];}_0x1e713a[_0x834e('0x1d')](_0x508a1d)['send'](_0x2826ec);};}exports['index']=function(_0x4dc64a,_0x58c1d7){var _0x2c7a8d={},_0x567cea={},_0x106d6a={'count':0x0,'rows':[]};var _0x5dacc1=_[_0x834e('0x2f')](db[_0x834e('0x30')][_0x834e('0x31')],function(_0x1e026a){return{'name':_0x1e026a[_0x834e('0x32')],'type':_0x1e026a[_0x834e('0x33')][_0x834e('0x34')]};});_0x567cea[_0x834e('0x35')]=_[_0x834e('0x2f')](_0x5dacc1,'name');_0x567cea[_0x834e('0x36')]=_['keys'](_0x4dc64a[_0x834e('0x36')]);_0x567cea[_0x834e('0x37')]=_[_0x834e('0x38')](_0x567cea[_0x834e('0x35')],_0x567cea[_0x834e('0x36')]);_0x2c7a8d[_0x834e('0x39')]=_[_0x834e('0x38')](_0x567cea[_0x834e('0x35')],qs[_0x834e('0x3a')](_0x4dc64a[_0x834e('0x36')]['fields']));_0x2c7a8d[_0x834e('0x39')]=_0x2c7a8d[_0x834e('0x39')][_0x834e('0x3b')]?_0x2c7a8d[_0x834e('0x39')]:_0x567cea['model'];if(!_0x4dc64a[_0x834e('0x36')][_0x834e('0x3c')]('nolimit')){_0x2c7a8d['limit']=qs['limit'](_0x4dc64a[_0x834e('0x36')][_0x834e('0x20')]);_0x2c7a8d[_0x834e('0x22')]=qs[_0x834e('0x22')](_0x4dc64a[_0x834e('0x36')][_0x834e('0x22')]);}_0x2c7a8d['order']=qs[_0x834e('0x3d')](_0x4dc64a['query'][_0x834e('0x3d')]);_0x2c7a8d[_0x834e('0x3e')]=qs['filters'](_[_0x834e('0x3f')](_0x4dc64a[_0x834e('0x36')],_0x567cea['filters']),_0x5dacc1);if(_0x4dc64a['query'][_0x834e('0x40')]){_0x2c7a8d[_0x834e('0x3e')]=_[_0x834e('0x41')](_0x2c7a8d[_0x834e('0x3e')],{'$or':_[_0x834e('0x2f')](_0x5dacc1,function(_0x4ca43c){if(_0x4ca43c[_0x834e('0x33')]!=='VIRTUAL'){var _0x50c243={};_0x50c243[_0x4ca43c[_0x834e('0x2e')]]={'$like':'%'+_0x4dc64a['query'][_0x834e('0x40')]+'%'};return _0x50c243;}})});}_0x2c7a8d=_[_0x834e('0x41')]({},_0x2c7a8d,_0x4dc64a[_0x834e('0x42')]);var _0x3c59af={'where':_0x2c7a8d[_0x834e('0x3e')]};return db['MemberReport'][_0x834e('0x21')](_0x3c59af)[_0x834e('0x2a')](function(_0x38f266){_0x106d6a['count']=_0x38f266;if(_0x4dc64a[_0x834e('0x36')][_0x834e('0x43')]){_0x2c7a8d['include']=[{'all':!![]}];}return db[_0x834e('0x30')]['findAll'](_0x2c7a8d);})[_0x834e('0x2a')](function(_0x585335){_0x106d6a['rows']=_0x585335;return _0x106d6a;})['then'](respondWithFilteredResult(_0x58c1d7,_0x2c7a8d))[_0x834e('0x44')](handleError(_0x58c1d7,null));};exports[_0x834e('0x45')]=function(_0x3bcbf4,_0xbc1571){var _0x8ad264={'raw':!![],'where':{'id':_0x3bcbf4[_0x834e('0x46')]['id']}},_0x23feea={};_0x23feea['model']=_[_0x834e('0x47')](db['MemberReport'][_0x834e('0x31')]);_0x23feea['query']=_[_0x834e('0x47')](_0x3bcbf4['query']);_0x23feea[_0x834e('0x37')]=_[_0x834e('0x38')](_0x23feea['model'],_0x23feea[_0x834e('0x36')]);_0x8ad264[_0x834e('0x39')]=_[_0x834e('0x38')](_0x23feea[_0x834e('0x35')],qs[_0x834e('0x3a')](_0x3bcbf4[_0x834e('0x36')][_0x834e('0x3a')]));_0x8ad264[_0x834e('0x39')]=_0x8ad264[_0x834e('0x39')][_0x834e('0x3b')]?_0x8ad264['attributes']:_0x23feea[_0x834e('0x35')];if(_0x3bcbf4[_0x834e('0x36')]['includeAll']){_0x8ad264[_0x834e('0x48')]=[{'all':!![]}];}_0x8ad264=_[_0x834e('0x41')]({},_0x8ad264,_0x3bcbf4[_0x834e('0x42')]);return db[_0x834e('0x30')][_0x834e('0x49')](_0x8ad264)[_0x834e('0x2a')](handleEntityNotFound(_0xbc1571,null))['then'](respondWithResult(_0xbc1571,null))['catch'](handleError(_0xbc1571,null));};exports[_0x834e('0x4a')]=function(_0x1a5444,_0x30568e){return db[_0x834e('0x30')][_0x834e('0x4a')](_0x1a5444[_0x834e('0x4b')],{})[_0x834e('0x2a')](respondWithResult(_0x30568e,0xc9))[_0x834e('0x44')](handleError(_0x30568e,null));};exports[_0x834e('0x29')]=function(_0x390c45,_0xf02f0d){if(_0x390c45[_0x834e('0x4b')]['id']){delete _0x390c45[_0x834e('0x4b')]['id'];}return db[_0x834e('0x30')][_0x834e('0x49')]({'where':{'id':_0x390c45[_0x834e('0x46')]['id']}})[_0x834e('0x2a')](handleEntityNotFound(_0xf02f0d,null))[_0x834e('0x2a')](saveUpdates(_0x390c45[_0x834e('0x4b')],null))[_0x834e('0x2a')](respondWithResult(_0xf02f0d,null))['catch'](handleError(_0xf02f0d,null));};exports[_0x834e('0x2b')]=function(_0x1f08b9,_0x4e73e0){return db[_0x834e('0x30')][_0x834e('0x49')]({'where':{'id':_0x1f08b9['params']['id']}})[_0x834e('0x2a')](handleEntityNotFound(_0x4e73e0,null))[_0x834e('0x2a')](removeEntity(_0x4e73e0,null))[_0x834e('0x44')](handleError(_0x4e73e0,null));};exports[_0x834e('0x4c')]=function(_0x4288e4,_0xb77aab){return db[_0x834e('0x30')]['describe']()[_0x834e('0x2a')](respondWithResult(_0xb77aab,null))[_0x834e('0x44')](handleError(_0xb77aab,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index 1685a34..ceee2f0 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 _0x6a2f=['report_member','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./memberReport.attributes','define','MemberReport'];(function(_0x3dae40,_0x5ac8fb){var _0x4a3858=function(_0x346163){while(--_0x346163){_0x3dae40['push'](_0x3dae40['shift']());}};_0x4a3858(++_0x5ac8fb);}(_0x6a2f,0xc1));var _0xf6a2=function(_0x51bda1,_0x44f80d){_0x51bda1=_0x51bda1-0x0;var _0x1ce08c=_0x6a2f[_0x51bda1];return _0x1ce08c;};'use strict';var _=require('lodash');var util=require(_0xf6a2('0x0'));var logger=require(_0xf6a2('0x1'))(_0xf6a2('0x2'));var moment=require(_0xf6a2('0x3'));var BPromise=require(_0xf6a2('0x4'));var rp=require(_0xf6a2('0x5'));var fs=require('fs');var path=require(_0xf6a2('0x6'));var rimraf=require(_0xf6a2('0x7'));var config=require('../../config/environment');var attributes=require(_0xf6a2('0x8'));module['exports']=function(_0x582569,_0x2c1723){return _0x582569[_0xf6a2('0x9')](_0xf6a2('0xa'),attributes,{'tableName':_0xf6a2('0xb'),'paranoid':![],'indexes':[{'name':'membername_interface','fields':['membername','interface']}],'timestamps':!![]});}; \ No newline at end of file +var _0xe396=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./memberReport.attributes','exports','define','MemberReport','membername','interface','lodash','util'];(function(_0x337006,_0x1e391b){var _0x16b372=function(_0x16be98){while(--_0x16be98){_0x337006['push'](_0x337006['shift']());}};_0x16b372(++_0x1e391b);}(_0xe396,0xa3));var _0x6e39=function(_0x50bde1,_0x20e6eb){_0x50bde1=_0x50bde1-0x0;var _0xa19836=_0xe396[_0x50bde1];return _0xa19836;};'use strict';var _=require(_0x6e39('0x0'));var util=require(_0x6e39('0x1'));var logger=require(_0x6e39('0x2'))(_0x6e39('0x3'));var moment=require(_0x6e39('0x4'));var BPromise=require(_0x6e39('0x5'));var rp=require(_0x6e39('0x6'));var fs=require('fs');var path=require(_0x6e39('0x7'));var rimraf=require(_0x6e39('0x8'));var config=require('../../config/environment');var attributes=require(_0x6e39('0x9'));module[_0x6e39('0xa')]=function(_0x470d84,_0xe72a84){return _0x470d84[_0x6e39('0xb')](_0x6e39('0xc'),attributes,{'tableName':'report_member','paranoid':![],'indexes':[{'name':'membername_interface','fields':[_0x6e39('0xd'),_0x6e39('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index 669b6e0..5bd13d6 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 _0xd9c8=['MemberReport','options','where','attributes','include','map','model','debug','CreateMemberReport','create','body','raw','UpdateMemberReport','update','limit','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','request','then','info','MemberReport,\x20%s,\x20%s','request\x20sent','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetMemberReport'];(function(_0x32d457,_0x1a39c9){var _0x338386=function(_0x199d7a){while(--_0x199d7a){_0x32d457['push'](_0x32d457['shift']());}};_0x338386(++_0x1a39c9);}(_0xd9c8,0x15c));var _0x8d9c=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0xd9c8[_0xefd519];return _0x4bb882;};'use strict';var _=require(_0x8d9c('0x0'));var util=require(_0x8d9c('0x1'));var moment=require('moment');var BPromise=require(_0x8d9c('0x2'));var rs=require(_0x8d9c('0x3'));var fs=require('fs');var Redis=require(_0x8d9c('0x4'));var db=require(_0x8d9c('0x5'))['db'];var utils=require(_0x8d9c('0x6'));var logger=require(_0x8d9c('0x7'))(_0x8d9c('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x8d9c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1ebb5a,_0x475edd,_0x49c96f){return new BPromise(function(_0x3790f6,_0x3de357){return client[_0x8d9c('0xa')](_0x1ebb5a,_0x49c96f)[_0x8d9c('0xb')](function(_0x2db4b3){logger[_0x8d9c('0xc')](_0x8d9c('0xd'),_0x475edd,_0x8d9c('0xe'));logger['debug'](_0x8d9c('0xf'),_0x475edd,'request\x20sent',JSON[_0x8d9c('0x10')](_0x2db4b3));if(_0x2db4b3['error']){if(_0x2db4b3[_0x8d9c('0x11')]['code']===0x1f4){logger['error'](_0x8d9c('0xd'),_0x475edd,_0x2db4b3['error'][_0x8d9c('0x12')]);return _0x3de357(_0x2db4b3[_0x8d9c('0x11')][_0x8d9c('0x12')]);}logger[_0x8d9c('0x11')](_0x8d9c('0xd'),_0x475edd,_0x2db4b3[_0x8d9c('0x11')][_0x8d9c('0x12')]);return _0x3790f6(_0x2db4b3[_0x8d9c('0x11')][_0x8d9c('0x12')]);}else{logger[_0x8d9c('0xc')]('MemberReport,\x20%s,\x20%s',_0x475edd,_0x8d9c('0xe'));_0x3790f6(_0x2db4b3[_0x8d9c('0x13')][_0x8d9c('0x12')]);}})[_0x8d9c('0x14')](function(_0x1a071d){logger[_0x8d9c('0x11')](_0x8d9c('0xd'),_0x475edd,_0x1a071d);_0x3de357(_0x1a071d);});});}exports[_0x8d9c('0x15')]=function(_0x1ed27d){var _0x44896d=this;return new Promise(function(_0x48fffd,_0x105952){return db[_0x8d9c('0x16')]['findAll']({'raw':_0x1ed27d[_0x8d9c('0x17')]?_0x1ed27d[_0x8d9c('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x1ed27d[_0x8d9c('0x17')]?_0x1ed27d[_0x8d9c('0x17')][_0x8d9c('0x18')]||null:null,'attributes':_0x1ed27d[_0x8d9c('0x17')]?_0x1ed27d['options'][_0x8d9c('0x19')]||null:null,'limit':_0x1ed27d[_0x8d9c('0x17')]?_0x1ed27d['options']['limit']||null:null,'include':_0x1ed27d[_0x8d9c('0x17')]?_0x1ed27d[_0x8d9c('0x17')][_0x8d9c('0x1a')]?_[_0x8d9c('0x1b')](_0x1ed27d[_0x8d9c('0x17')][_0x8d9c('0x1a')],function(_0x14dd83){return{'model':db[_0x14dd83['model']],'as':_0x14dd83['as'],'attributes':_0x14dd83[_0x8d9c('0x19')],'include':_0x14dd83['include']?_[_0x8d9c('0x1b')](_0x14dd83[_0x8d9c('0x1a')],function(_0x416a80){return{'model':db[_0x416a80[_0x8d9c('0x1c')]],'as':_0x416a80['as'],'attributes':_0x416a80[_0x8d9c('0x19')],'include':_0x416a80[_0x8d9c('0x1a')]?_[_0x8d9c('0x1b')](_0x416a80['include'],function(_0x57be56){return{'model':db[_0x57be56['model']],'as':_0x57be56['as'],'attributes':_0x57be56['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x1a78b1){logger[_0x8d9c('0xc')](_0x8d9c('0x15'),_0x1ed27d);logger[_0x8d9c('0x1d')]('GetMemberReport',_0x1ed27d,JSON[_0x8d9c('0x10')](_0x1a78b1));_0x48fffd(_0x1a78b1);})[_0x8d9c('0x14')](function(_0x59e24b){logger['error'](_0x8d9c('0x15'),_0x59e24b['message'],_0x1ed27d);_0x105952(_0x44896d[_0x8d9c('0x11')](0x1f4,_0x59e24b[_0x8d9c('0x12')]));});});};exports[_0x8d9c('0x1e')]=function(_0x582485){var _0x5eaa3e=this;return new Promise(function(_0x3ddf0c,_0x1e8c44){return db[_0x8d9c('0x16')][_0x8d9c('0x1f')](_0x582485[_0x8d9c('0x20')],{'raw':_0x582485['options']?_0x582485['options'][_0x8d9c('0x21')]===undefined?!![]:![]:!![]})['then'](function(_0x299030){logger[_0x8d9c('0xc')]('CreateMemberReport',_0x582485);logger[_0x8d9c('0x1d')](_0x8d9c('0x1e'),_0x582485,JSON[_0x8d9c('0x10')](_0x299030));_0x3ddf0c(_0x299030);})[_0x8d9c('0x14')](function(_0x35c124){logger[_0x8d9c('0x11')](_0x8d9c('0x1e'),_0x35c124[_0x8d9c('0x12')],_0x582485);_0x1e8c44(_0x5eaa3e[_0x8d9c('0x11')](0x1f4,_0x35c124[_0x8d9c('0x12')]));});});};exports[_0x8d9c('0x22')]=function(_0x3ec24){var _0x1d230f=this;return new Promise(function(_0x54c4e6,_0x5f330e){return db[_0x8d9c('0x16')][_0x8d9c('0x23')](_0x3ec24[_0x8d9c('0x20')],{'raw':_0x3ec24['options']?_0x3ec24[_0x8d9c('0x17')][_0x8d9c('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3ec24[_0x8d9c('0x17')]?_0x3ec24[_0x8d9c('0x17')][_0x8d9c('0x18')]||null:null,'attributes':_0x3ec24[_0x8d9c('0x17')]?_0x3ec24[_0x8d9c('0x17')]['attributes']||null:null,'limit':_0x3ec24[_0x8d9c('0x17')]?_0x3ec24['options'][_0x8d9c('0x24')]||null:null})['then'](function(_0x5cc87c){logger[_0x8d9c('0xc')](_0x8d9c('0x22'),_0x3ec24);logger[_0x8d9c('0x1d')](_0x8d9c('0x22'),_0x3ec24,JSON[_0x8d9c('0x10')](_0x5cc87c));_0x54c4e6(_0x5cc87c);})['catch'](function(_0x533e8a){logger[_0x8d9c('0x11')](_0x8d9c('0x22'),_0x533e8a[_0x8d9c('0x12')],_0x3ec24);_0x5f330e(_0x1d230f[_0x8d9c('0x11')](0x1f4,_0x533e8a[_0x8d9c('0x12')]));});});}; \ No newline at end of file +var _0xdfa0=['lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','then','info','request\x20sent','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','code','MemberReport,\x20%s,\x20%s','message','result','catch','GetMemberReport','findAll','options','raw','attributes','include','map','model','debug','CreateMemberReport','MemberReport','create','body','UpdateMemberReport','where'];(function(_0x1c97d8,_0x4413bc){var _0x1b0be5=function(_0x4fe142){while(--_0x4fe142){_0x1c97d8['push'](_0x1c97d8['shift']());}};_0x1b0be5(++_0x4413bc);}(_0xdfa0,0x69));var _0x0dfa=function(_0x2da09e,_0x5c8df6){_0x2da09e=_0x2da09e-0x0;var _0x1e1327=_0xdfa0[_0x2da09e];return _0x1e1327;};'use strict';var _=require(_0x0dfa('0x0'));var util=require('util');var moment=require(_0x0dfa('0x1'));var BPromise=require(_0x0dfa('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0dfa('0x3'));var db=require(_0x0dfa('0x4'))['db'];var utils=require(_0x0dfa('0x5'));var logger=require('../../config/logger')(_0x0dfa('0x6'));var config=require('../../config/environment');var jayson=require(_0x0dfa('0x7'));var client=jayson[_0x0dfa('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x417f7a,_0x29ca78,_0x32280b){return new BPromise(function(_0x16070c,_0x3b6881){return client['request'](_0x417f7a,_0x32280b)[_0x0dfa('0x9')](function(_0x2f813e){logger[_0x0dfa('0xa')]('MemberReport,\x20%s,\x20%s',_0x29ca78,_0x0dfa('0xb'));logger['debug'](_0x0dfa('0xc'),_0x29ca78,_0x0dfa('0xb'),JSON[_0x0dfa('0xd')](_0x2f813e));if(_0x2f813e['error']){if(_0x2f813e[_0x0dfa('0xe')][_0x0dfa('0xf')]===0x1f4){logger['error'](_0x0dfa('0x10'),_0x29ca78,_0x2f813e[_0x0dfa('0xe')]['message']);return _0x3b6881(_0x2f813e[_0x0dfa('0xe')][_0x0dfa('0x11')]);}logger[_0x0dfa('0xe')](_0x0dfa('0x10'),_0x29ca78,_0x2f813e[_0x0dfa('0xe')][_0x0dfa('0x11')]);return _0x16070c(_0x2f813e['error'][_0x0dfa('0x11')]);}else{logger[_0x0dfa('0xa')](_0x0dfa('0x10'),_0x29ca78,_0x0dfa('0xb'));_0x16070c(_0x2f813e[_0x0dfa('0x12')][_0x0dfa('0x11')]);}})[_0x0dfa('0x13')](function(_0x3c79f0){logger[_0x0dfa('0xe')](_0x0dfa('0x10'),_0x29ca78,_0x3c79f0);_0x3b6881(_0x3c79f0);});});}exports[_0x0dfa('0x14')]=function(_0x1d3576){var _0x166107=this;return new Promise(function(_0x208c0b,_0x24e3ee){return db['MemberReport'][_0x0dfa('0x15')]({'raw':_0x1d3576[_0x0dfa('0x16')]?_0x1d3576[_0x0dfa('0x16')][_0x0dfa('0x17')]===undefined?!![]:![]:!![],'where':_0x1d3576[_0x0dfa('0x16')]?_0x1d3576['options']['where']||null:null,'attributes':_0x1d3576[_0x0dfa('0x16')]?_0x1d3576[_0x0dfa('0x16')][_0x0dfa('0x18')]||null:null,'limit':_0x1d3576['options']?_0x1d3576[_0x0dfa('0x16')]['limit']||null:null,'include':_0x1d3576[_0x0dfa('0x16')]?_0x1d3576['options'][_0x0dfa('0x19')]?_[_0x0dfa('0x1a')](_0x1d3576[_0x0dfa('0x16')]['include'],function(_0x2e1566){return{'model':db[_0x2e1566[_0x0dfa('0x1b')]],'as':_0x2e1566['as'],'attributes':_0x2e1566[_0x0dfa('0x18')],'include':_0x2e1566[_0x0dfa('0x19')]?_[_0x0dfa('0x1a')](_0x2e1566[_0x0dfa('0x19')],function(_0x13005a){return{'model':db[_0x13005a[_0x0dfa('0x1b')]],'as':_0x13005a['as'],'attributes':_0x13005a[_0x0dfa('0x18')],'include':_0x13005a[_0x0dfa('0x19')]?_['map'](_0x13005a['include'],function(_0x4084c6){return{'model':db[_0x4084c6[_0x0dfa('0x1b')]],'as':_0x4084c6['as'],'attributes':_0x4084c6['attributes']};}):[]};}):[]};}):[]:[]})[_0x0dfa('0x9')](function(_0x3be821){logger[_0x0dfa('0xa')]('GetMemberReport',_0x1d3576);logger[_0x0dfa('0x1c')](_0x0dfa('0x14'),_0x1d3576,JSON[_0x0dfa('0xd')](_0x3be821));_0x208c0b(_0x3be821);})[_0x0dfa('0x13')](function(_0x194790){logger[_0x0dfa('0xe')]('GetMemberReport',_0x194790[_0x0dfa('0x11')],_0x1d3576);_0x24e3ee(_0x166107[_0x0dfa('0xe')](0x1f4,_0x194790['message']));});});};exports[_0x0dfa('0x1d')]=function(_0x37e050){var _0x239230=this;return new Promise(function(_0xd03108,_0x5a8375){return db[_0x0dfa('0x1e')][_0x0dfa('0x1f')](_0x37e050[_0x0dfa('0x20')],{'raw':_0x37e050['options']?_0x37e050['options'][_0x0dfa('0x17')]===undefined?!![]:![]:!![]})[_0x0dfa('0x9')](function(_0x5c491d){logger['info']('CreateMemberReport',_0x37e050);logger[_0x0dfa('0x1c')](_0x0dfa('0x1d'),_0x37e050,JSON[_0x0dfa('0xd')](_0x5c491d));_0xd03108(_0x5c491d);})[_0x0dfa('0x13')](function(_0x49bfbb){logger[_0x0dfa('0xe')](_0x0dfa('0x1d'),_0x49bfbb[_0x0dfa('0x11')],_0x37e050);_0x5a8375(_0x239230[_0x0dfa('0xe')](0x1f4,_0x49bfbb[_0x0dfa('0x11')]));});});};exports[_0x0dfa('0x21')]=function(_0x44e15c){var _0x301e88=this;return new Promise(function(_0x10b105,_0x833090){return db['MemberReport']['update'](_0x44e15c[_0x0dfa('0x20')],{'raw':_0x44e15c[_0x0dfa('0x16')]?_0x44e15c[_0x0dfa('0x16')][_0x0dfa('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x44e15c[_0x0dfa('0x16')]?_0x44e15c['options'][_0x0dfa('0x22')]||null:null,'attributes':_0x44e15c['options']?_0x44e15c[_0x0dfa('0x16')][_0x0dfa('0x18')]||null:null,'limit':_0x44e15c[_0x0dfa('0x16')]?_0x44e15c['options']['limit']||null:null})[_0x0dfa('0x9')](function(_0x2be829){logger[_0x0dfa('0xa')]('UpdateMemberReport',_0x44e15c);logger[_0x0dfa('0x1c')]('UpdateMemberReport',_0x44e15c,JSON[_0x0dfa('0xd')](_0x2be829));_0x10b105(_0x2be829);})[_0x0dfa('0x13')](function(_0x51c560){logger[_0x0dfa('0xe')](_0x0dfa('0x21'),_0x51c560[_0x0dfa('0x11')],_0x44e15c);_0x833090(_0x301e88[_0x0dfa('0xe')](0x1f4,_0x51c560[_0x0dfa('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index a6a1e9a..7e51483 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 _0xa32d=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','multer','util','path','connect-timeout','Router','fs-extra'];(function(_0x834bb6,_0x1c5e35){var _0xa35d00=function(_0x14aeb3){while(--_0x14aeb3){_0x834bb6['push'](_0x834bb6['shift']());}};_0xa35d00(++_0x1c5e35);}(_0xa32d,0x1c8));var _0xda32=function(_0x1d8119,_0xc98f17){_0x1d8119=_0x1d8119-0x0;var _0x3e30f6=_0xa32d[_0x1d8119];return _0x3e30f6;};'use strict';var multer=require(_0xda32('0x0'));var util=require(_0xda32('0x1'));var path=require(_0xda32('0x2'));var timeout=require(_0xda32('0x3'));var express=require('express');var router=express[_0xda32('0x4')]();var fs_extra=require(_0xda32('0x5'));var auth=require(_0xda32('0x6'));var interaction=require(_0xda32('0x7'));var config=require(_0xda32('0x8'));var controller=require('./migration.controller');router[_0xda32('0x9')]('/',controller[_0xda32('0xa')]);module['exports']=router; \ No newline at end of file +var _0xe79c=['get','index','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./migration.controller'];(function(_0x201f77,_0x2e31ac){var _0x369d70=function(_0x3ce32e){while(--_0x3ce32e){_0x201f77['push'](_0x201f77['shift']());}};_0x369d70(++_0x2e31ac);}(_0xe79c,0x9f));var _0xce79=function(_0x2be6f1,_0x4e4f3a){_0x2be6f1=_0x2be6f1-0x0;var _0x2c63d6=_0xe79c[_0x2be6f1];return _0x2c63d6;};'use strict';var multer=require(_0xce79('0x0'));var util=require('util');var path=require(_0xce79('0x1'));var timeout=require(_0xce79('0x2'));var express=require(_0xce79('0x3'));var router=express[_0xce79('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xce79('0x5'));var interaction=require(_0xce79('0x6'));var config=require(_0xce79('0x7'));var controller=require(_0xce79('0x8'));router[_0xce79('0x9')]('/',controller[_0xce79('0xa')]);module[_0xce79('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 c8185a1..8c071bf 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 _0x0e29=['version','exports','STRING'];(function(_0x364a01,_0x524024){var _0x2e612b=function(_0x31322a){while(--_0x31322a){_0x364a01['push'](_0x364a01['shift']());}};_0x2e612b(++_0x524024);}(_0x0e29,0x142));var _0x90e2=function(_0xca81d8,_0x54b18c){_0xca81d8=_0xca81d8-0x0;var _0x2b281a=_0x0e29[_0xca81d8];return _0x2b281a;};'use strict';var Sequelize=require('sequelize');module[_0x90e2('0x0')]={'version':{'type':Sequelize[_0x90e2('0x1')],'unique':_0x90e2('0x2')}}; \ No newline at end of file +var _0xbad5=['exports','STRING','version'];(function(_0x19bf5f,_0x1ca6b9){var _0x237efa=function(_0x18f2a3){while(--_0x18f2a3){_0x19bf5f['push'](_0x19bf5f['shift']());}};_0x237efa(++_0x1ca6b9);}(_0xbad5,0x1b0));var _0x5bad=function(_0x55451f,_0x1dfecb){_0x55451f=_0x55451f-0x0;var _0x4118b6=_0xbad5[_0x55451f];return _0x4118b6;};'use strict';var Sequelize=require('sequelize');module[_0x5bad('0x0')]={'version':{'type':Sequelize[_0x5bad('0x1')],'unique':_0x5bad('0x2')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index eab020a..31922db 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 _0xda3a=['to-csv','fs-extra','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','send','index','map','Migration','fieldName','type','key','model','name','keys','intersection','attributes','query','fields','hasOwnProperty','nolimit','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','moment','bluebird','mustache','util','path','sox'];(function(_0x2f4a5f,_0x145cfe){var _0x19d478=function(_0x1e052b){while(--_0x1e052b){_0x2f4a5f['push'](_0x2f4a5f['shift']());}};_0x19d478(++_0x145cfe);}(_0xda3a,0xba));var _0xada3=function(_0x5eb0fa,_0x1d2233){_0x5eb0fa=_0x5eb0fa-0x0;var _0x4c8839=_0xda3a[_0x5eb0fa];return _0x4c8839;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xada3('0x0'));var BPromise=require(_0xada3('0x1'));var Mustache=require(_0xada3('0x2'));var util=require(_0xada3('0x3'));var path=require(_0xada3('0x4'));var sox=require(_0xada3('0x5'));var csv=require(_0xada3('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xada3('0x7'));var _=require('lodash');var squel=require(_0xada3('0x8'));var crypto=require('crypto');var jsforce=require(_0xada3('0x9'));var deskjs=require('desk.js');var toCsv=require(_0xada3('0x6'));var querystring=require('querystring');var Papa=require(_0xada3('0xa'));var Redis=require(_0xada3('0xb'));var authService=require(_0xada3('0xc'));var qs=require(_0xada3('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xada3('0xe'));var logger=require(_0xada3('0xf'))(_0xada3('0x10'));var utils=require('../../config/utils');var config=require(_0xada3('0x11'));var licenseUtil=require(_0xada3('0x12'));var db=require(_0xada3('0x13'))['db'];function respondWithStatusCode(_0x54d27c,_0x4be80e){_0x4be80e=_0x4be80e||0xcc;return function(_0x9ddb4e){if(_0x9ddb4e){return _0x54d27c[_0xada3('0x14')](_0x4be80e);}return _0x54d27c[_0xada3('0x15')](_0x4be80e)[_0xada3('0x16')]();};}function respondWithResult(_0x229810,_0x2825ac){_0x2825ac=_0x2825ac||0xc8;return function(_0x219946){if(_0x219946){return _0x229810[_0xada3('0x15')](_0x2825ac)[_0xada3('0x17')](_0x219946);}};}function respondWithFilteredResult(_0x4b72cb,_0x272335){return function(_0x44f425){if(_0x44f425){var _0x45d807=typeof _0x272335[_0xada3('0x18')]==='undefined'&&typeof _0x272335[_0xada3('0x19')]===_0xada3('0x1a');var _0x1d2240=_0x44f425[_0xada3('0x1b')];var _0x17b95d=_0x45d807?0x0:_0x272335['offset'];var _0x7fbcc0=_0x45d807?_0x44f425[_0xada3('0x1b')]:_0x272335[_0xada3('0x18')]+_0x272335[_0xada3('0x19')];var _0x5bb748;if(_0x7fbcc0>=_0x1d2240){_0x7fbcc0=_0x1d2240;_0x5bb748=0xc8;}else{_0x5bb748=0xce;}_0x4b72cb[_0xada3('0x15')](_0x5bb748);return _0x4b72cb[_0xada3('0x1c')](_0xada3('0x1d'),_0x17b95d+'-'+_0x7fbcc0+'/'+_0x1d2240)[_0xada3('0x17')](_0x44f425);}return null;};}function patchUpdates(_0x159df6){return function(_0x3b1b02){try{jsonpatch[_0xada3('0x1e')](_0x3b1b02,_0x159df6,!![]);}catch(_0x518db9){return BPromise[_0xada3('0x1f')](_0x518db9);}return _0x3b1b02[_0xada3('0x20')]();};}function saveUpdates(_0x8fb8ed,_0x11e515){return function(_0x3a27e9){if(_0x3a27e9){return _0x3a27e9[_0xada3('0x21')](_0x8fb8ed)[_0xada3('0x22')](function(_0x12ff1b){return _0x12ff1b;});}return null;};}function removeEntity(_0x10d143,_0x1dccd0){return function(_0x3b134c){if(_0x3b134c){return _0x3b134c[_0xada3('0x23')]()[_0xada3('0x22')](function(){_0x10d143[_0xada3('0x15')](0xcc)[_0xada3('0x16')]();});}};}function handleEntityNotFound(_0x52b7f0,_0x5d7493){return function(_0x4461a5){if(!_0x4461a5){_0x52b7f0[_0xada3('0x14')](0x194);}return _0x4461a5;};}function handleError(_0xdd4807,_0x51c681){_0x51c681=_0x51c681||0x1f4;return function(_0x4f5fd0){logger[_0xada3('0x24')](_0x4f5fd0[_0xada3('0x25')]);if(_0x4f5fd0['name']){delete _0x4f5fd0['name'];}_0xdd4807[_0xada3('0x15')](_0x51c681)[_0xada3('0x26')](_0x4f5fd0);};}exports[_0xada3('0x27')]=function(_0x375258,_0x548617){var _0x4d48ef={},_0x2e06bd={},_0x51797d={'count':0x0,'rows':[]};var _0x37db11=_[_0xada3('0x28')](db[_0xada3('0x29')]['rawAttributes'],function(_0x12dc33){return{'name':_0x12dc33[_0xada3('0x2a')],'type':_0x12dc33[_0xada3('0x2b')][_0xada3('0x2c')]};});_0x2e06bd[_0xada3('0x2d')]=_[_0xada3('0x28')](_0x37db11,_0xada3('0x2e'));_0x2e06bd['query']=_[_0xada3('0x2f')](_0x375258['query']);_0x2e06bd['filters']=_[_0xada3('0x30')](_0x2e06bd[_0xada3('0x2d')],_0x2e06bd['query']);_0x4d48ef[_0xada3('0x31')]=_['intersection'](_0x2e06bd['model'],qs['fields'](_0x375258[_0xada3('0x32')][_0xada3('0x33')]));_0x4d48ef[_0xada3('0x31')]=_0x4d48ef[_0xada3('0x31')]['length']?_0x4d48ef['attributes']:_0x2e06bd[_0xada3('0x2d')];if(!_0x375258['query'][_0xada3('0x34')](_0xada3('0x35'))){_0x4d48ef[_0xada3('0x19')]=qs[_0xada3('0x19')](_0x375258[_0xada3('0x32')]['limit']);_0x4d48ef['offset']=qs['offset'](_0x375258['query'][_0xada3('0x18')]);}_0x4d48ef['order']=qs['sort'](_0x375258[_0xada3('0x32')]['sort']);_0x4d48ef[_0xada3('0x36')]=qs[_0xada3('0x37')](_[_0xada3('0x38')](_0x375258[_0xada3('0x32')],_0x2e06bd[_0xada3('0x37')]),_0x37db11);if(_0x375258[_0xada3('0x32')][_0xada3('0x39')]){_0x4d48ef[_0xada3('0x36')]=_[_0xada3('0x3a')](_0x4d48ef['where'],{'$or':_[_0xada3('0x28')](_0x37db11,function(_0x1658b6){if(_0x1658b6['type']!==_0xada3('0x3b')){var _0x40e425={};_0x40e425[_0x1658b6['name']]={'$like':'%'+_0x375258[_0xada3('0x32')][_0xada3('0x39')]+'%'};return _0x40e425;}})});}_0x4d48ef=_['merge']({},_0x4d48ef,_0x375258[_0xada3('0x3c')]);var _0x3da742={'where':_0x4d48ef['where']};return db['Migration']['count'](_0x3da742)[_0xada3('0x22')](function(_0x59bbe4){_0x51797d[_0xada3('0x1b')]=_0x59bbe4;if(_0x375258[_0xada3('0x32')][_0xada3('0x3d')]){_0x4d48ef[_0xada3('0x3e')]=[{'all':!![]}];}return db['Migration'][_0xada3('0x3f')](_0x4d48ef);})[_0xada3('0x22')](function(_0x138aa7){_0x51797d['rows']=_0x138aa7;return _0x51797d;})[_0xada3('0x22')](respondWithFilteredResult(_0x548617,_0x4d48ef))['catch'](handleError(_0x548617,null));}; \ No newline at end of file +var _0xb730=['update','then','destroy','error','stack','name','map','Migration','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','includeAll','include','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','reject','save'];(function(_0x263f9d,_0x3d854e){var _0x4c4efa=function(_0x48d506){while(--_0x48d506){_0x263f9d['push'](_0x263f9d['shift']());}};_0x4c4efa(++_0x3d854e);}(_0xb730,0x12d));var _0x0b73=function(_0x2c65c5,_0x1400e8){_0x2c65c5=_0x2c65c5-0x0;var _0x38682a=_0xb730[_0x2c65c5];return _0x38682a;};'use strict';var emlformat=require(_0x0b73('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x0b73('0x1'));var rp=require(_0x0b73('0x2'));var moment=require(_0x0b73('0x3'));var BPromise=require(_0x0b73('0x4'));var Mustache=require(_0x0b73('0x5'));var util=require(_0x0b73('0x6'));var path=require(_0x0b73('0x7'));var sox=require(_0x0b73('0x8'));var csv=require('to-csv');var ejs=require(_0x0b73('0x9'));var fs=require('fs');var fs_extra=require(_0x0b73('0xa'));var _=require('lodash');var squel=require(_0x0b73('0xb'));var crypto=require(_0x0b73('0xc'));var jsforce=require(_0x0b73('0xd'));var deskjs=require(_0x0b73('0xe'));var toCsv=require(_0x0b73('0xf'));var querystring=require(_0x0b73('0x10'));var Papa=require(_0x0b73('0x11'));var Redis=require(_0x0b73('0x12'));var authService=require(_0x0b73('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x0b73('0x14'));var hardwareService=require(_0x0b73('0x15'));var logger=require(_0x0b73('0x16'))(_0x0b73('0x17'));var utils=require(_0x0b73('0x18'));var config=require(_0x0b73('0x19'));var licenseUtil=require(_0x0b73('0x1a'));var db=require(_0x0b73('0x1b'))['db'];function respondWithStatusCode(_0x2ba59f,_0x2bd8a6){_0x2bd8a6=_0x2bd8a6||0xcc;return function(_0x504a42){if(_0x504a42){return _0x2ba59f[_0x0b73('0x1c')](_0x2bd8a6);}return _0x2ba59f[_0x0b73('0x1d')](_0x2bd8a6)[_0x0b73('0x1e')]();};}function respondWithResult(_0x2755ac,_0x17eee6){_0x17eee6=_0x17eee6||0xc8;return function(_0x1f9930){if(_0x1f9930){return _0x2755ac['status'](_0x17eee6)[_0x0b73('0x1f')](_0x1f9930);}};}function respondWithFilteredResult(_0x43cf78,_0x163567){return function(_0x4b4172){if(_0x4b4172){var _0x2ae2bf=typeof _0x163567['offset']===_0x0b73('0x20')&&typeof _0x163567['limit']===_0x0b73('0x20');var _0x183399=_0x4b4172[_0x0b73('0x21')];var _0x2db333=_0x2ae2bf?0x0:_0x163567[_0x0b73('0x22')];var _0x87eefc=_0x2ae2bf?_0x4b4172['count']:_0x163567[_0x0b73('0x22')]+_0x163567[_0x0b73('0x23')];var _0xc0880e;if(_0x87eefc>=_0x183399){_0x87eefc=_0x183399;_0xc0880e=0xc8;}else{_0xc0880e=0xce;}_0x43cf78[_0x0b73('0x1d')](_0xc0880e);return _0x43cf78[_0x0b73('0x24')]('Content-Range',_0x2db333+'-'+_0x87eefc+'/'+_0x183399)[_0x0b73('0x1f')](_0x4b4172);}return null;};}function patchUpdates(_0x5cdc64){return function(_0x3a4831){try{jsonpatch['apply'](_0x3a4831,_0x5cdc64,!![]);}catch(_0x266276){return BPromise[_0x0b73('0x25')](_0x266276);}return _0x3a4831[_0x0b73('0x26')]();};}function saveUpdates(_0x459587,_0x4a8294){return function(_0x138c7b){if(_0x138c7b){return _0x138c7b[_0x0b73('0x27')](_0x459587)[_0x0b73('0x28')](function(_0x5ce326){return _0x5ce326;});}return null;};}function removeEntity(_0x4666ff,_0xe831d8){return function(_0x310e4a){if(_0x310e4a){return _0x310e4a[_0x0b73('0x29')]()[_0x0b73('0x28')](function(){_0x4666ff[_0x0b73('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x137b3f,_0x6deec0){return function(_0x5b1c9d){if(!_0x5b1c9d){_0x137b3f[_0x0b73('0x1c')](0x194);}return _0x5b1c9d;};}function handleError(_0x194b87,_0x25e62d){_0x25e62d=_0x25e62d||0x1f4;return function(_0x563f9c){logger[_0x0b73('0x2a')](_0x563f9c[_0x0b73('0x2b')]);if(_0x563f9c['name']){delete _0x563f9c[_0x0b73('0x2c')];}_0x194b87['status'](_0x25e62d)['send'](_0x563f9c);};}exports['index']=function(_0x3bcd10,_0x416faa){var _0x379482={},_0x4f4f15={},_0x5c5a5a={'count':0x0,'rows':[]};var _0x33792f=_[_0x0b73('0x2d')](db[_0x0b73('0x2e')][_0x0b73('0x2f')],function(_0x5bf90d){return{'name':_0x5bf90d[_0x0b73('0x30')],'type':_0x5bf90d[_0x0b73('0x31')]['key']};});_0x4f4f15[_0x0b73('0x32')]=_[_0x0b73('0x2d')](_0x33792f,_0x0b73('0x2c'));_0x4f4f15[_0x0b73('0x33')]=_[_0x0b73('0x34')](_0x3bcd10[_0x0b73('0x33')]);_0x4f4f15['filters']=_[_0x0b73('0x35')](_0x4f4f15['model'],_0x4f4f15[_0x0b73('0x33')]);_0x379482[_0x0b73('0x36')]=_[_0x0b73('0x35')](_0x4f4f15[_0x0b73('0x32')],qs[_0x0b73('0x37')](_0x3bcd10['query'][_0x0b73('0x37')]));_0x379482[_0x0b73('0x36')]=_0x379482['attributes'][_0x0b73('0x38')]?_0x379482[_0x0b73('0x36')]:_0x4f4f15[_0x0b73('0x32')];if(!_0x3bcd10[_0x0b73('0x33')][_0x0b73('0x39')](_0x0b73('0x3a'))){_0x379482[_0x0b73('0x23')]=qs[_0x0b73('0x23')](_0x3bcd10['query'][_0x0b73('0x23')]);_0x379482[_0x0b73('0x22')]=qs[_0x0b73('0x22')](_0x3bcd10[_0x0b73('0x33')][_0x0b73('0x22')]);}_0x379482[_0x0b73('0x3b')]=qs['sort'](_0x3bcd10[_0x0b73('0x33')][_0x0b73('0x3c')]);_0x379482[_0x0b73('0x3d')]=qs[_0x0b73('0x3e')](_['pick'](_0x3bcd10[_0x0b73('0x33')],_0x4f4f15['filters']),_0x33792f);if(_0x3bcd10[_0x0b73('0x33')][_0x0b73('0x3f')]){_0x379482['where']=_[_0x0b73('0x40')](_0x379482['where'],{'$or':_[_0x0b73('0x2d')](_0x33792f,function(_0x4201eb){if(_0x4201eb[_0x0b73('0x31')]!==_0x0b73('0x41')){var _0x2f37b5={};_0x2f37b5[_0x4201eb[_0x0b73('0x2c')]]={'$like':'%'+_0x3bcd10['query'][_0x0b73('0x3f')]+'%'};return _0x2f37b5;}})});}_0x379482=_['merge']({},_0x379482,_0x3bcd10['options']);var _0x84412f={'where':_0x379482[_0x0b73('0x3d')]};return db[_0x0b73('0x2e')][_0x0b73('0x21')](_0x84412f)[_0x0b73('0x28')](function(_0x4b3fc){_0x5c5a5a[_0x0b73('0x21')]=_0x4b3fc;if(_0x3bcd10[_0x0b73('0x33')][_0x0b73('0x42')]){_0x379482[_0x0b73('0x43')]=[{'all':!![]}];}return db[_0x0b73('0x2e')]['findAll'](_0x379482);})[_0x0b73('0x28')](function(_0x139c82){_0x5c5a5a['rows']=_0x139c82;return _0x5c5a5a;})[_0x0b73('0x28')](respondWithFilteredResult(_0x416faa,_0x379482))['catch'](handleError(_0x416faa,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index 34d915a..381e1dd 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 _0x494f=['request-promise','path','rimraf','../../config/environment','./migration.attributes','define','Migration','migrations','lodash','../../config/logger','api','moment','bluebird'];(function(_0x1596fa,_0x214b61){var _0xbae5d1=function(_0x542697){while(--_0x542697){_0x1596fa['push'](_0x1596fa['shift']());}};_0xbae5d1(++_0x214b61);}(_0x494f,0x126));var _0xf494=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x494f[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0xf494('0x0'));var util=require('util');var logger=require(_0xf494('0x1'))(_0xf494('0x2'));var moment=require(_0xf494('0x3'));var BPromise=require(_0xf494('0x4'));var rp=require(_0xf494('0x5'));var fs=require('fs');var path=require(_0xf494('0x6'));var rimraf=require(_0xf494('0x7'));var config=require(_0xf494('0x8'));var attributes=require(_0xf494('0x9'));module['exports']=function(_0x5009ab,_0x3da0bf){return _0x5009ab[_0xf494('0xa')](_0xf494('0xb'),attributes,{'tableName':_0xf494('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe533=['util','api','moment','bluebird','request-promise','path','../../config/environment','./migration.attributes','exports','define','Migration','migrations','lodash'];(function(_0x57a8b0,_0x3d0d9c){var _0xa28c82=function(_0x9c0ef4){while(--_0x9c0ef4){_0x57a8b0['push'](_0x57a8b0['shift']());}};_0xa28c82(++_0x3d0d9c);}(_0xe533,0x178));var _0x3e53=function(_0x536142,_0x47a4c8){_0x536142=_0x536142-0x0;var _0x1d63c9=_0xe533[_0x536142];return _0x1d63c9;};'use strict';var _=require(_0x3e53('0x0'));var util=require(_0x3e53('0x1'));var logger=require('../../config/logger')(_0x3e53('0x2'));var moment=require(_0x3e53('0x3'));var BPromise=require(_0x3e53('0x4'));var rp=require(_0x3e53('0x5'));var fs=require('fs');var path=require(_0x3e53('0x6'));var rimraf=require('rimraf');var config=require(_0x3e53('0x7'));var attributes=require(_0x3e53('0x8'));module[_0x3e53('0x9')]=function(_0x4fa48a,_0x179f97){return _0x4fa48a[_0x3e53('0xa')](_0x3e53('0xb'),attributes,{'tableName':_0x3e53('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/migration/migration.rpc.js b/server/api/migration/migration.rpc.js index d1f7f8f..4087c76 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 _0x8ec7=['error','message','result','lodash','util','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','Migration,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0x8ec7,0x1f1));var _0x78ec=function(_0x3eb630,_0x552586){_0x3eb630=_0x3eb630-0x0;var _0x1b840d=_0x8ec7[_0x3eb630];return _0x1b840d;};'use strict';var _=require(_0x78ec('0x0'));var util=require(_0x78ec('0x1'));var moment=require('moment');var BPromise=require(_0x78ec('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x78ec('0x3'))['db'];var utils=require(_0x78ec('0x4'));var logger=require('../../config/logger')(_0x78ec('0x5'));var config=require(_0x78ec('0x6'));var jayson=require(_0x78ec('0x7'));var client=jayson[_0x78ec('0x8')][_0x78ec('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5d2780,_0x21e3f7,_0x4ca55e){return new BPromise(function(_0x372108,_0x268c50){return client[_0x78ec('0xa')](_0x5d2780,_0x4ca55e)['then'](function(_0x367c80){logger[_0x78ec('0xb')](_0x78ec('0xc'),_0x21e3f7,_0x78ec('0xd'));logger[_0x78ec('0xe')]('Migration,\x20%s,\x20%s,\x20%s',_0x21e3f7,'request\x20sent',JSON[_0x78ec('0xf')](_0x367c80));if(_0x367c80[_0x78ec('0x10')]){if(_0x367c80[_0x78ec('0x10')]['code']===0x1f4){logger[_0x78ec('0x10')](_0x78ec('0xc'),_0x21e3f7,_0x367c80[_0x78ec('0x10')][_0x78ec('0x11')]);return _0x268c50(_0x367c80[_0x78ec('0x10')][_0x78ec('0x11')]);}logger[_0x78ec('0x10')](_0x78ec('0xc'),_0x21e3f7,_0x367c80[_0x78ec('0x10')][_0x78ec('0x11')]);return _0x372108(_0x367c80[_0x78ec('0x10')]['message']);}else{logger[_0x78ec('0xb')](_0x78ec('0xc'),_0x21e3f7,_0x78ec('0xd'));_0x372108(_0x367c80[_0x78ec('0x12')][_0x78ec('0x11')]);}})['catch'](function(_0x4f9ffd){logger['error']('Migration,\x20%s,\x20%s',_0x21e3f7,_0x4f9ffd);_0x268c50(_0x4f9ffd);});});} \ No newline at end of file +var _0xfb5d=['request','then','info','Migration,\x20%s,\x20%s','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','jayson/promise'];(function(_0x2df0f1,_0x271453){var _0x365f53=function(_0x4248ea){while(--_0x4248ea){_0x2df0f1['push'](_0x2df0f1['shift']());}};_0x365f53(++_0x271453);}(_0xfb5d,0x11a));var _0xdfb5=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xfb5d[_0x21a9d9];return _0x46adce;};'use strict';var _=require(_0xdfb5('0x0'));var util=require(_0xdfb5('0x1'));var moment=require(_0xdfb5('0x2'));var BPromise=require(_0xdfb5('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdfb5('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xdfb5('0x5'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2d6086,_0x1955dd,_0x164eb2){return new BPromise(function(_0x5c410c,_0x4d2dce){return client[_0xdfb5('0x6')](_0x2d6086,_0x164eb2)[_0xdfb5('0x7')](function(_0x2589d8){logger[_0xdfb5('0x8')](_0xdfb5('0x9'),_0x1955dd,_0xdfb5('0xa'));logger[_0xdfb5('0xb')](_0xdfb5('0xc'),_0x1955dd,'request\x20sent',JSON['stringify'](_0x2589d8));if(_0x2589d8[_0xdfb5('0xd')]){if(_0x2589d8[_0xdfb5('0xd')][_0xdfb5('0xe')]===0x1f4){logger[_0xdfb5('0xd')](_0xdfb5('0x9'),_0x1955dd,_0x2589d8['error'][_0xdfb5('0xf')]);return _0x4d2dce(_0x2589d8[_0xdfb5('0xd')]['message']);}logger[_0xdfb5('0xd')](_0xdfb5('0x9'),_0x1955dd,_0x2589d8[_0xdfb5('0xd')][_0xdfb5('0xf')]);return _0x5c410c(_0x2589d8[_0xdfb5('0xd')]['message']);}else{logger['info'](_0xdfb5('0x9'),_0x1955dd,'request\x20sent');_0x5c410c(_0x2589d8[_0xdfb5('0x10')][_0xdfb5('0xf')]);}})[_0xdfb5('0x11')](function(_0x637cba){logger[_0xdfb5('0xd')](_0xdfb5('0x9'),_0x1955dd,_0x637cba);_0x4d2dce(_0x637cba);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index 777af68..b03344a 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 _0x1173=['show','create','put','delete','destroy','exports','util','path','Router','fs-extra','../../components/auth/service','../../config/environment','./network.controller','get','isAuthenticated','index','/:id'];(function(_0xdd827a,_0x482ad2){var _0x2f46f1=function(_0x221046){while(--_0x221046){_0xdd827a['push'](_0xdd827a['shift']());}};_0x2f46f1(++_0x482ad2);}(_0x1173,0x138));var _0x3117=function(_0x2eb897,_0x5ac819){_0x2eb897=_0x2eb897-0x0;var _0x2b019f=_0x1173[_0x2eb897];return _0x2b019f;};'use strict';var multer=require('multer');var util=require(_0x3117('0x0'));var path=require(_0x3117('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x3117('0x2')]();var fs_extra=require(_0x3117('0x3'));var auth=require(_0x3117('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x3117('0x5'));var controller=require(_0x3117('0x6'));router[_0x3117('0x7')]('/',auth[_0x3117('0x8')](),controller[_0x3117('0x9')]);router[_0x3117('0x7')](_0x3117('0xa'),auth[_0x3117('0x8')](),controller[_0x3117('0xb')]);router['post']('/',auth[_0x3117('0x8')](),controller[_0x3117('0xc')]);router[_0x3117('0xd')](_0x3117('0xa'),auth[_0x3117('0x8')](),controller['update']);router[_0x3117('0xe')](_0x3117('0xa'),auth[_0x3117('0x8')](),controller[_0x3117('0xf')]);module[_0x3117('0x10')]=router; \ No newline at end of file +var _0x090a=['exports','multer','util','connect-timeout','express','../../components/auth/service','../../config/environment','./network.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','destroy'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x090a,0x133));var _0xa090=function(_0x404f8b,_0x43ccba){_0x404f8b=_0x404f8b-0x0;var _0x16b4ea=_0x090a[_0x404f8b];return _0x16b4ea;};'use strict';var multer=require(_0xa090('0x0'));var util=require(_0xa090('0x1'));var path=require('path');var timeout=require(_0xa090('0x2'));var express=require(_0xa090('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xa090('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xa090('0x5'));var controller=require(_0xa090('0x6'));router[_0xa090('0x7')]('/',auth[_0xa090('0x8')](),controller[_0xa090('0x9')]);router[_0xa090('0x7')](_0xa090('0xa'),auth[_0xa090('0x8')](),controller[_0xa090('0xb')]);router[_0xa090('0xc')]('/',auth[_0xa090('0x8')](),controller[_0xa090('0xd')]);router[_0xa090('0xe')](_0xa090('0xa'),auth[_0xa090('0x8')](),controller[_0xa090('0xf')]);router['delete'](_0xa090('0xa'),auth['isAuthenticated'](),controller[_0xa090('0x10')]);module[_0xa090('0x11')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index 143ecb2..83fd0b2 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 _0xf90c=['sequelize','ENUM','externip','stun','STRING'];(function(_0xe357c5,_0x3da1ff){var _0x5c85cf=function(_0x112765){while(--_0x112765){_0xe357c5['push'](_0xe357c5['shift']());}};_0x5c85cf(++_0x3da1ff);}(_0xf90c,0x1c2));var _0xcf90=function(_0x1150f7,_0x5d05b0){_0x1150f7=_0x1150f7-0x0;var _0x2f22dd=_0xf90c[_0x1150f7];return _0x2f22dd;};'use strict';var Sequelize=require(_0xcf90('0x0'));module['exports']={'type':{'type':Sequelize[_0xcf90('0x1')]('localnet',_0xcf90('0x2'),_0xcf90('0x3'),'turn')},'value':{'type':Sequelize[_0xcf90('0x4')]},'username':{'type':Sequelize[_0xcf90('0x4')]},'password':{'type':Sequelize[_0xcf90('0x4')]}}; \ No newline at end of file +var _0x2574=['stun','turn','STRING','localnet','externip'];(function(_0x7496fd,_0x1bd4d1){var _0x1ebf0a=function(_0x3a3f38){while(--_0x3a3f38){_0x7496fd['push'](_0x7496fd['shift']());}};_0x1ebf0a(++_0x1bd4d1);}(_0x2574,0x1e3));var _0x4257=function(_0x4bf2c1,_0x5aa7f3){_0x4bf2c1=_0x4bf2c1-0x0;var _0x5c9bfe=_0x2574[_0x4bf2c1];return _0x5c9bfe;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize['ENUM'](_0x4257('0x0'),_0x4257('0x1'),_0x4257('0x2'),_0x4257('0x3'))},'value':{'type':Sequelize[_0x4257('0x4')]},'username':{'type':Sequelize[_0x4257('0x4')]},'password':{'type':Sequelize[_0x4257('0x4')]}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index 876f11c..4873a45 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 _0xdf45=['Reload','server/files/templates/network.ejs','utf8','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','chan_sip.so','params','/etc/asterisk/stun_xcally.conf','TURN','destroy','util','path','lodash','../../components/parsers/qs','../../config/logger','../../mysqldb','jayson/promise','client','http','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','status','json','offset','undefined','limit','count','set','Content-Range','update','end','sendStatus','stack','name','send','Network','rawAttributes','fieldName','key','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','type','merge','options','includeAll','include','findAll','rows','catch','show','keys','length','find','create','body','toUpperCase','STUN','join','root','server/files/templates/stun_multiple.ejs','res_stun_monitor.so','readFileSync','server/files/templates/turn_multiple.ejs','render','writeFileSync','/etc/asterisk/turn_xcally.conf'];(function(_0x1667df,_0x266940){var _0x341abf=function(_0x123c3f){while(--_0x123c3f){_0x1667df['push'](_0x1667df['shift']());}};_0x341abf(++_0x266940);}(_0xdf45,0xb9));var _0x5df4=function(_0xd839e7,_0x4209e9){_0xd839e7=_0xd839e7-0x0;var _0xc3cf23=_0xdf45[_0xd839e7];return _0xc3cf23;};'use strict';var util=require(_0x5df4('0x0'));var path=require(_0x5df4('0x1'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x5df4('0x2'));var qs=require(_0x5df4('0x3'));var logger=require(_0x5df4('0x4'))('api');var config=require('../../config/environment');var db=require(_0x5df4('0x5'))['db'];var jayson=require(_0x5df4('0x6'));var client=jayson[_0x5df4('0x7')][_0x5df4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x43f368,_0xd1b586,_0x1d8707,_0x52211e){return new Promise(function(_0x14896e,_0x1cfa32){var _0x2ff579=_0x52211e||client;return _0x2ff579['request'](_0x43f368,_0x1d8707)[_0x5df4('0x9')](function(_0x4f3132){logger[_0x5df4('0xa')](_0x5df4('0xb'),_0xd1b586,_0x5df4('0xc'));logger[_0x5df4('0xd')]('Network,\x20%s,\x20%s,\x20%s',_0xd1b586,_0x5df4('0xc'),JSON[_0x5df4('0xe')](_0x4f3132));if(_0x4f3132[_0x5df4('0xf')]){if(_0x4f3132[_0x5df4('0xf')][_0x5df4('0x10')]===0x1f4){logger[_0x5df4('0xf')]('Network,\x20%s,\x20%s',_0xd1b586,_0x4f3132[_0x5df4('0xf')]['message']);return _0x1cfa32(_0x4f3132[_0x5df4('0xf')][_0x5df4('0x11')]);}logger[_0x5df4('0xf')]('Network,\x20%s,\x20%s',_0xd1b586,_0x4f3132[_0x5df4('0xf')][_0x5df4('0x11')]);return _0x14896e(_0x4f3132[_0x5df4('0xf')][_0x5df4('0x11')]);}else{logger[_0x5df4('0xa')](_0x5df4('0xb'),_0xd1b586,_0x5df4('0xc'));_0x14896e(_0x4f3132[_0x5df4('0x12')][_0x5df4('0x11')]);}})['catch'](function(_0x5ed765){logger[_0x5df4('0xf')]('Network,\x20%s,\x20%s',_0xd1b586,_0x5ed765);_0x1cfa32(_0x5ed765);});});}function respondWithResult(_0x2757da,_0x1907ec){_0x1907ec=_0x1907ec||0xc8;return function(_0x1b4c87){if(_0x1b4c87){return _0x2757da[_0x5df4('0x13')](_0x1907ec)[_0x5df4('0x14')](_0x1b4c87);}};}function respondWithFilteredResult(_0x97800f,_0x10d6de){return function(_0x298d32){if(_0x298d32){var _0x23853b=typeof _0x10d6de[_0x5df4('0x15')]===_0x5df4('0x16')&&typeof _0x10d6de[_0x5df4('0x17')]===_0x5df4('0x16');var _0x842371=_0x298d32[_0x5df4('0x18')];var _0xc2c038=_0x23853b?0x0:_0x10d6de[_0x5df4('0x15')];var _0x316056=_0x23853b?_0x298d32[_0x5df4('0x18')]:_0x10d6de['offset']+_0x10d6de[_0x5df4('0x17')];var _0x565973;if(_0x316056>=_0x842371){_0x316056=_0x842371;_0x565973=0xc8;}else{_0x565973=0xce;}_0x97800f[_0x5df4('0x13')](_0x565973);return _0x97800f[_0x5df4('0x19')](_0x5df4('0x1a'),_0xc2c038+'-'+_0x316056+'/'+_0x842371)[_0x5df4('0x14')](_0x298d32);}return null;};}function saveUpdates(_0x36707b){return function(_0x22deaa){if(_0x22deaa){return _0x22deaa[_0x5df4('0x1b')](_0x36707b)[_0x5df4('0x9')](function(_0xdfdd91){return _0xdfdd91;});}return null;};}function removeEntity(_0x62498f){return function(_0x3166f5){if(_0x3166f5){return _0x3166f5['destroy']()[_0x5df4('0x9')](function(){_0x62498f[_0x5df4('0x13')](0xcc)[_0x5df4('0x1c')]();});}};}function handleEntityNotFound(_0xace986){return function(_0x2feb9e){if(!_0x2feb9e){_0xace986[_0x5df4('0x1d')](0x194);}return _0x2feb9e;};}function handleError(_0x38db95,_0x64a3ab){_0x64a3ab=_0x64a3ab||0x1f4;return function(_0x28c95e){logger[_0x5df4('0xf')](_0x28c95e[_0x5df4('0x1e')]);if(_0x28c95e['name']){delete _0x28c95e[_0x5df4('0x1f')];}_0x38db95[_0x5df4('0x13')](_0x64a3ab)[_0x5df4('0x20')](_0x28c95e);};}exports['index']=function(_0x59f25e,_0x6fdbcd){var _0x14f768={},_0x1acdc5={},_0x507116={'count':0x0,'rows':[]};var _0x35cc8f=_['map'](db[_0x5df4('0x21')][_0x5df4('0x22')],function(_0x4c8828){return{'name':_0x4c8828[_0x5df4('0x23')],'type':_0x4c8828['type'][_0x5df4('0x24')]};});_0x1acdc5[_0x5df4('0x25')]=_[_0x5df4('0x26')](_0x35cc8f,_0x5df4('0x1f'));_0x1acdc5[_0x5df4('0x27')]=_['keys'](_0x59f25e[_0x5df4('0x27')]);_0x1acdc5[_0x5df4('0x28')]=_[_0x5df4('0x29')](_0x1acdc5[_0x5df4('0x25')],_0x1acdc5[_0x5df4('0x27')]);_0x14f768[_0x5df4('0x2a')]=_['intersection'](_0x1acdc5['model'],qs[_0x5df4('0x2b')](_0x59f25e[_0x5df4('0x27')][_0x5df4('0x2b')]));_0x14f768[_0x5df4('0x2a')]=_0x14f768[_0x5df4('0x2a')]['length']?_0x14f768[_0x5df4('0x2a')]:_0x1acdc5[_0x5df4('0x25')];if(!_0x59f25e[_0x5df4('0x27')][_0x5df4('0x2c')](_0x5df4('0x2d'))){_0x14f768[_0x5df4('0x17')]=qs[_0x5df4('0x17')](_0x59f25e[_0x5df4('0x27')][_0x5df4('0x17')]);_0x14f768[_0x5df4('0x15')]=qs[_0x5df4('0x15')](_0x59f25e[_0x5df4('0x27')][_0x5df4('0x15')]);}_0x14f768[_0x5df4('0x2e')]=qs[_0x5df4('0x2f')](_0x59f25e[_0x5df4('0x27')]['sort']);_0x14f768['where']=qs[_0x5df4('0x28')](_[_0x5df4('0x30')](_0x59f25e[_0x5df4('0x27')],_0x1acdc5['filters']),_0x35cc8f);if(_0x59f25e[_0x5df4('0x27')][_0x5df4('0x31')]){_0x14f768[_0x5df4('0x32')]=_['merge'](_0x14f768[_0x5df4('0x32')],{'$or':_[_0x5df4('0x26')](_0x35cc8f,function(_0x1873e7){if(_0x1873e7[_0x5df4('0x33')]!=='VIRTUAL'){var _0x3a6310={};_0x3a6310[_0x1873e7[_0x5df4('0x1f')]]={'$like':'%'+_0x59f25e[_0x5df4('0x27')][_0x5df4('0x31')]+'%'};return _0x3a6310;}})});}_0x14f768=_[_0x5df4('0x34')]({},_0x14f768,_0x59f25e[_0x5df4('0x35')]);var _0x358e13={'where':_0x14f768[_0x5df4('0x32')]};return db['Network']['count'](_0x358e13)[_0x5df4('0x9')](function(_0x33ee2a){_0x507116['count']=_0x33ee2a;if(_0x59f25e[_0x5df4('0x27')][_0x5df4('0x36')]){_0x14f768[_0x5df4('0x37')]=[{'all':!![]}];}return db[_0x5df4('0x21')][_0x5df4('0x38')](_0x14f768);})[_0x5df4('0x9')](function(_0x3c5043){_0x507116[_0x5df4('0x39')]=_0x3c5043;return _0x507116;})[_0x5df4('0x9')](respondWithFilteredResult(_0x6fdbcd,_0x14f768))[_0x5df4('0x3a')](handleError(_0x6fdbcd,null));};exports[_0x5df4('0x3b')]=function(_0x3cf3eb,_0x3973a6){var _0x525f0f={'raw':!![],'where':{'id':_0x3cf3eb['params']['id']}},_0x26820e={};_0x26820e[_0x5df4('0x25')]=_[_0x5df4('0x3c')](db[_0x5df4('0x21')]['rawAttributes']);_0x26820e[_0x5df4('0x27')]=_[_0x5df4('0x3c')](_0x3cf3eb[_0x5df4('0x27')]);_0x26820e[_0x5df4('0x28')]=_[_0x5df4('0x29')](_0x26820e[_0x5df4('0x25')],_0x26820e['query']);_0x525f0f[_0x5df4('0x2a')]=_[_0x5df4('0x29')](_0x26820e[_0x5df4('0x25')],qs[_0x5df4('0x2b')](_0x3cf3eb[_0x5df4('0x27')][_0x5df4('0x2b')]));_0x525f0f[_0x5df4('0x2a')]=_0x525f0f[_0x5df4('0x2a')][_0x5df4('0x3d')]?_0x525f0f[_0x5df4('0x2a')]:_0x26820e[_0x5df4('0x25')];if(_0x3cf3eb[_0x5df4('0x27')][_0x5df4('0x36')]){_0x525f0f[_0x5df4('0x37')]=[{'all':!![]}];}_0x525f0f=_['merge']({},_0x525f0f,_0x3cf3eb[_0x5df4('0x35')]);return db[_0x5df4('0x21')][_0x5df4('0x3e')](_0x525f0f)['then'](handleEntityNotFound(_0x3973a6,null))[_0x5df4('0x9')](respondWithResult(_0x3973a6,null))['catch'](handleError(_0x3973a6,null));};exports[_0x5df4('0x3f')]=function(_0x104eb6,_0x2a3d86){var _0xaa8b94;return db[_0x5df4('0x21')][_0x5df4('0x3f')](_0x104eb6[_0x5df4('0x40')],{'raw':!![]})[_0x5df4('0x9')](function(_0x38ab2e){_0xaa8b94=_0x38ab2e;return db[_0x5df4('0x21')][_0x5df4('0x38')]({'where':{'type':_0x104eb6['body'][_0x5df4('0x33')]},'raw':!![]});})['then'](function(_0x452907){if(_0xaa8b94[_0x5df4('0x33')][_0x5df4('0x41')]()==_0x5df4('0x42')){var _0x150cd7=fs['readFileSync'](path[_0x5df4('0x43')](config[_0x5df4('0x44')],_0x5df4('0x45')),'utf8');var _0x5c4335=ejs['render'](_0x150cd7,{'networks':_0x452907||[]});fs['writeFileSync']('/etc/asterisk/stun_xcally.conf',_0x5c4335);return respondWithRpcPromise('Reload',_0x5df4('0x3f'),{'module':_0x5df4('0x46')});}else if(_0xaa8b94[_0x5df4('0x33')]['toUpperCase']()=='TURN'){var _0x56fb40=fs[_0x5df4('0x47')](path[_0x5df4('0x43')](config['root'],_0x5df4('0x48')),'utf8');var _0x27b621=ejs[_0x5df4('0x49')](_0x56fb40,{'networks':_0x452907||[]});fs[_0x5df4('0x4a')](_0x5df4('0x4b'),_0x27b621);return respondWithRpcPromise(_0x5df4('0x4c'),_0x5df4('0x3f'),{'module':_0x5df4('0x46')});}else{var _0x24ad76=fs[_0x5df4('0x47')](path[_0x5df4('0x43')](config[_0x5df4('0x44')],_0x5df4('0x4d')),_0x5df4('0x4e'));var _0x5cf293=ejs[_0x5df4('0x49')](_0x24ad76,{'networks':_0x452907||[]});fs[_0x5df4('0x4a')](util[_0x5df4('0x4f')](_0x5df4('0x50'),_0x104eb6[_0x5df4('0x40')][_0x5df4('0x33')][_0x5df4('0x51')]()),_0x5cf293);return respondWithRpcPromise(_0x5df4('0x4c'),_0x5df4('0x3f'),{'module':_0x5df4('0x52')});}})[_0x5df4('0x9')](function(){return _0xaa8b94;})[_0x5df4('0x9')](respondWithResult(_0x2a3d86,0xc9))[_0x5df4('0x3a')](handleError(_0x2a3d86,null));};exports['update']=function(_0x29e0e8,_0xdbabb9){var _0x368ee9;return db[_0x5df4('0x21')]['find']({'where':{'id':_0x29e0e8[_0x5df4('0x53')]['id']}})[_0x5df4('0x9')](handleEntityNotFound(_0xdbabb9,null))[_0x5df4('0x9')](saveUpdates(_0x29e0e8['body'],null))[_0x5df4('0x9')](function(_0x6d5376){if(_0x6d5376){_0x368ee9=_0x6d5376;return db[_0x5df4('0x21')]['findAll']({'where':{'type':_0x368ee9[_0x5df4('0x33')]},'raw':!![]});}return null;})[_0x5df4('0x9')](function(_0x47eb64){if(_0x368ee9[_0x5df4('0x33')][_0x5df4('0x41')]()==_0x5df4('0x42')){var _0x58f0bf=fs[_0x5df4('0x47')](path[_0x5df4('0x43')](config[_0x5df4('0x44')],'server/files/templates/stun_multiple.ejs'),_0x5df4('0x4e'));var _0x4cbbb5=ejs[_0x5df4('0x49')](_0x58f0bf,{'networks':_0x47eb64||[]});fs[_0x5df4('0x4a')](_0x5df4('0x54'),_0x4cbbb5);return respondWithRpcPromise('Reload',_0x5df4('0x1b'),{'module':_0x5df4('0x46')});}else if(_0x368ee9['type']['toUpperCase']()==_0x5df4('0x55')){var _0x38dfcf=fs[_0x5df4('0x47')](path[_0x5df4('0x43')](config[_0x5df4('0x44')],_0x5df4('0x48')),_0x5df4('0x4e'));var _0x63e9ed=ejs[_0x5df4('0x49')](_0x38dfcf,{'networks':_0x47eb64||[]});fs['writeFileSync'](_0x5df4('0x4b'),_0x63e9ed);return respondWithRpcPromise('Reload',_0x5df4('0x1b'),{'module':'res_stun_monitor.so'});}else{var _0x328fe4=fs[_0x5df4('0x47')](path[_0x5df4('0x43')](config[_0x5df4('0x44')],_0x5df4('0x4d')),_0x5df4('0x4e'));var _0x3ecdca=ejs[_0x5df4('0x49')](_0x328fe4,{'networks':_0x47eb64||[]});fs[_0x5df4('0x4a')](util['format'](_0x5df4('0x50'),_0x29e0e8[_0x5df4('0x40')][_0x5df4('0x33')][_0x5df4('0x51')]()),_0x3ecdca);return respondWithRpcPromise(_0x5df4('0x4c'),'update',{'module':_0x5df4('0x52')});}})['then'](function(_0x53d9e7){if(_0x53d9e7){return _0x368ee9;}return null;})['then'](respondWithResult(_0xdbabb9,null))[_0x5df4('0x3a')](handleError(_0xdbabb9,null));};exports[_0x5df4('0x56')]=function(_0x4cef28,_0x337473){var _0x3e6c9d;return db['Network'][_0x5df4('0x3e')]({'where':{'id':_0x4cef28[_0x5df4('0x53')]['id']}})[_0x5df4('0x9')](function(_0x2fd634){_0x3e6c9d=_0x2fd634;return _0x2fd634;})[_0x5df4('0x9')](handleEntityNotFound(_0x337473,null))[_0x5df4('0x9')](removeEntity(_0x337473,null))[_0x5df4('0x9')](function(){if(_0x3e6c9d){return db['Network'][_0x5df4('0x38')]({'where':{'type':_0x3e6c9d[_0x5df4('0x33')]},'raw':!![]});}})[_0x5df4('0x9')](function(_0x1202db){if(_0x3e6c9d[_0x5df4('0x33')][_0x5df4('0x41')]()=='STUN'){var _0x15a9c8=fs[_0x5df4('0x47')](path['join'](config[_0x5df4('0x44')],_0x5df4('0x45')),_0x5df4('0x4e'));var _0x106444=ejs[_0x5df4('0x49')](_0x15a9c8,{'networks':_0x1202db||[]});fs['writeFileSync'](_0x5df4('0x54'),_0x106444);return respondWithRpcPromise(_0x5df4('0x4c'),_0x5df4('0x56'),{'module':'res_stun_monitor.so'});}else if(_0x3e6c9d[_0x5df4('0x33')][_0x5df4('0x41')]()=='TURN'){var _0x44e37e=fs[_0x5df4('0x47')](path[_0x5df4('0x43')](config[_0x5df4('0x44')],_0x5df4('0x48')),'utf8');var _0x19dfbf=ejs[_0x5df4('0x49')](_0x44e37e,{'networks':_0x1202db||[]});fs[_0x5df4('0x4a')](_0x5df4('0x4b'),_0x19dfbf);return respondWithRpcPromise(_0x5df4('0x4c'),'destroy',{'module':'res_stun_monitor.so'});}else{var _0xfeec30=fs['readFileSync'](path[_0x5df4('0x43')](config[_0x5df4('0x44')],_0x5df4('0x4d')),_0x5df4('0x4e'));var _0x50e8de=ejs[_0x5df4('0x49')](_0xfeec30,{'networks':_0x1202db||[]});fs['writeFileSync'](util[_0x5df4('0x4f')](_0x5df4('0x50'),_0x3e6c9d[_0x5df4('0x33')][_0x5df4('0x51')]()),_0x50e8de);return respondWithRpcPromise(_0x5df4('0x4c'),_0x5df4('0x56'),{'module':_0x5df4('0x52')});}})[_0x5df4('0x3a')](handleError(_0x337473,null));}; \ No newline at end of file +var _0x09fc=['/etc/asterisk/stun_xcally.conf','util','path','ejs','lodash','../../config/logger','../../config/environment','../../mysqldb','jayson/promise','http','request','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','status','json','offset','undefined','limit','count','set','Content-Range','update','destroy','sendStatus','stack','name','send','index','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','Network','includeAll','include','findAll','rows','params','keys','length','catch','create','body','STUN','join','root','server/files/templates/stun_multiple.ejs','utf8','render','toUpperCase','TURN','readFileSync','server/files/templates/turn_multiple.ejs','Reload','res_stun_monitor.so','server/files/templates/network.ejs','format','toLowerCase','chan_sip.so','find','writeFileSync','/etc/asterisk/turn_xcally.conf','/etc/asterisk/sip_xcally_%s.conf'];(function(_0x106c6c,_0x41f495){var _0x5d3165=function(_0x34adc5){while(--_0x34adc5){_0x106c6c['push'](_0x106c6c['shift']());}};_0x5d3165(++_0x41f495);}(_0x09fc,0xaf));var _0xc09f=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0x09fc[_0x21549c];return _0x426cbd;};'use strict';var util=require(_0xc09f('0x0'));var path=require(_0xc09f('0x1'));var ejs=require(_0xc09f('0x2'));var fs=require('fs');var _=require(_0xc09f('0x3'));var qs=require('../../components/parsers/qs');var logger=require(_0xc09f('0x4'))('api');var config=require(_0xc09f('0x5'));var db=require(_0xc09f('0x6'))['db'];var jayson=require(_0xc09f('0x7'));var client=jayson['client'][_0xc09f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x52bc3e,_0x2c1180,_0x1423cf,_0x4e3651){return new Promise(function(_0x795628,_0x25b403){var _0x2fe281=_0x4e3651||client;return _0x2fe281[_0xc09f('0x9')](_0x52bc3e,_0x1423cf)[_0xc09f('0xa')](function(_0x5afb2b){logger[_0xc09f('0xb')](_0xc09f('0xc'),_0x2c1180,_0xc09f('0xd'));logger[_0xc09f('0xe')](_0xc09f('0xf'),_0x2c1180,_0xc09f('0xd'),JSON[_0xc09f('0x10')](_0x5afb2b));if(_0x5afb2b[_0xc09f('0x11')]){if(_0x5afb2b[_0xc09f('0x11')][_0xc09f('0x12')]===0x1f4){logger[_0xc09f('0x11')]('Network,\x20%s,\x20%s',_0x2c1180,_0x5afb2b[_0xc09f('0x11')][_0xc09f('0x13')]);return _0x25b403(_0x5afb2b[_0xc09f('0x11')]['message']);}logger['error'](_0xc09f('0xc'),_0x2c1180,_0x5afb2b[_0xc09f('0x11')][_0xc09f('0x13')]);return _0x795628(_0x5afb2b[_0xc09f('0x11')]['message']);}else{logger['info']('Network,\x20%s,\x20%s',_0x2c1180,_0xc09f('0xd'));_0x795628(_0x5afb2b[_0xc09f('0x14')][_0xc09f('0x13')]);}})['catch'](function(_0x40441f){logger['error'](_0xc09f('0xc'),_0x2c1180,_0x40441f);_0x25b403(_0x40441f);});});}function respondWithResult(_0x302f14,_0x365de9){_0x365de9=_0x365de9||0xc8;return function(_0x8bba42){if(_0x8bba42){return _0x302f14[_0xc09f('0x15')](_0x365de9)[_0xc09f('0x16')](_0x8bba42);}};}function respondWithFilteredResult(_0x1c5ec0,_0x26050c){return function(_0x4e6c5f){if(_0x4e6c5f){var _0x341c88=typeof _0x26050c[_0xc09f('0x17')]===_0xc09f('0x18')&&typeof _0x26050c[_0xc09f('0x19')]===_0xc09f('0x18');var _0x54c89d=_0x4e6c5f[_0xc09f('0x1a')];var _0x1dd300=_0x341c88?0x0:_0x26050c[_0xc09f('0x17')];var _0x20a8b2=_0x341c88?_0x4e6c5f[_0xc09f('0x1a')]:_0x26050c['offset']+_0x26050c[_0xc09f('0x19')];var _0x3e80f4;if(_0x20a8b2>=_0x54c89d){_0x20a8b2=_0x54c89d;_0x3e80f4=0xc8;}else{_0x3e80f4=0xce;}_0x1c5ec0[_0xc09f('0x15')](_0x3e80f4);return _0x1c5ec0[_0xc09f('0x1b')](_0xc09f('0x1c'),_0x1dd300+'-'+_0x20a8b2+'/'+_0x54c89d)[_0xc09f('0x16')](_0x4e6c5f);}return null;};}function saveUpdates(_0x3abdd5){return function(_0x14dd31){if(_0x14dd31){return _0x14dd31[_0xc09f('0x1d')](_0x3abdd5)['then'](function(_0x569d9c){return _0x569d9c;});}return null;};}function removeEntity(_0x188a9a){return function(_0x2678e1){if(_0x2678e1){return _0x2678e1[_0xc09f('0x1e')]()['then'](function(){_0x188a9a[_0xc09f('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x58be69){return function(_0x5d2186){if(!_0x5d2186){_0x58be69[_0xc09f('0x1f')](0x194);}return _0x5d2186;};}function handleError(_0x1edb64,_0x3eddc6){_0x3eddc6=_0x3eddc6||0x1f4;return function(_0x230eed){logger[_0xc09f('0x11')](_0x230eed[_0xc09f('0x20')]);if(_0x230eed[_0xc09f('0x21')]){delete _0x230eed[_0xc09f('0x21')];}_0x1edb64['status'](_0x3eddc6)[_0xc09f('0x22')](_0x230eed);};}exports[_0xc09f('0x23')]=function(_0x2de15f,_0x21e41b){var _0x1b4902={},_0x272dd8={},_0x17d8bf={'count':0x0,'rows':[]};var _0x27751f=_['map'](db['Network'][_0xc09f('0x24')],function(_0x2a682c){return{'name':_0x2a682c[_0xc09f('0x25')],'type':_0x2a682c[_0xc09f('0x26')][_0xc09f('0x27')]};});_0x272dd8[_0xc09f('0x28')]=_['map'](_0x27751f,_0xc09f('0x21'));_0x272dd8['query']=_['keys'](_0x2de15f[_0xc09f('0x29')]);_0x272dd8[_0xc09f('0x2a')]=_['intersection'](_0x272dd8[_0xc09f('0x28')],_0x272dd8['query']);_0x1b4902[_0xc09f('0x2b')]=_[_0xc09f('0x2c')](_0x272dd8[_0xc09f('0x28')],qs[_0xc09f('0x2d')](_0x2de15f['query']['fields']));_0x1b4902['attributes']=_0x1b4902[_0xc09f('0x2b')]['length']?_0x1b4902['attributes']:_0x272dd8[_0xc09f('0x28')];if(!_0x2de15f['query']['hasOwnProperty'](_0xc09f('0x2e'))){_0x1b4902[_0xc09f('0x19')]=qs[_0xc09f('0x19')](_0x2de15f[_0xc09f('0x29')][_0xc09f('0x19')]);_0x1b4902[_0xc09f('0x17')]=qs[_0xc09f('0x17')](_0x2de15f['query'][_0xc09f('0x17')]);}_0x1b4902[_0xc09f('0x2f')]=qs[_0xc09f('0x30')](_0x2de15f['query']['sort']);_0x1b4902[_0xc09f('0x31')]=qs[_0xc09f('0x2a')](_[_0xc09f('0x32')](_0x2de15f[_0xc09f('0x29')],_0x272dd8[_0xc09f('0x2a')]),_0x27751f);if(_0x2de15f[_0xc09f('0x29')]['filter']){_0x1b4902[_0xc09f('0x31')]=_['merge'](_0x1b4902[_0xc09f('0x31')],{'$or':_['map'](_0x27751f,function(_0x205546){if(_0x205546['type']!==_0xc09f('0x33')){var _0x38d29c={};_0x38d29c[_0x205546[_0xc09f('0x21')]]={'$like':'%'+_0x2de15f['query'][_0xc09f('0x34')]+'%'};return _0x38d29c;}})});}_0x1b4902=_[_0xc09f('0x35')]({},_0x1b4902,_0x2de15f[_0xc09f('0x36')]);var _0x36255f={'where':_0x1b4902[_0xc09f('0x31')]};return db[_0xc09f('0x37')][_0xc09f('0x1a')](_0x36255f)[_0xc09f('0xa')](function(_0x4c79a8){_0x17d8bf[_0xc09f('0x1a')]=_0x4c79a8;if(_0x2de15f['query'][_0xc09f('0x38')]){_0x1b4902[_0xc09f('0x39')]=[{'all':!![]}];}return db[_0xc09f('0x37')][_0xc09f('0x3a')](_0x1b4902);})['then'](function(_0x564a92){_0x17d8bf[_0xc09f('0x3b')]=_0x564a92;return _0x17d8bf;})[_0xc09f('0xa')](respondWithFilteredResult(_0x21e41b,_0x1b4902))['catch'](handleError(_0x21e41b,null));};exports['show']=function(_0x55d687,_0x2196e9){var _0x447fa9={'raw':!![],'where':{'id':_0x55d687[_0xc09f('0x3c')]['id']}},_0x59205b={};_0x59205b['model']=_[_0xc09f('0x3d')](db[_0xc09f('0x37')][_0xc09f('0x24')]);_0x59205b[_0xc09f('0x29')]=_[_0xc09f('0x3d')](_0x55d687['query']);_0x59205b[_0xc09f('0x2a')]=_[_0xc09f('0x2c')](_0x59205b[_0xc09f('0x28')],_0x59205b[_0xc09f('0x29')]);_0x447fa9[_0xc09f('0x2b')]=_[_0xc09f('0x2c')](_0x59205b[_0xc09f('0x28')],qs[_0xc09f('0x2d')](_0x55d687[_0xc09f('0x29')]['fields']));_0x447fa9[_0xc09f('0x2b')]=_0x447fa9['attributes'][_0xc09f('0x3e')]?_0x447fa9[_0xc09f('0x2b')]:_0x59205b[_0xc09f('0x28')];if(_0x55d687[_0xc09f('0x29')][_0xc09f('0x38')]){_0x447fa9[_0xc09f('0x39')]=[{'all':!![]}];}_0x447fa9=_[_0xc09f('0x35')]({},_0x447fa9,_0x55d687['options']);return db[_0xc09f('0x37')]['find'](_0x447fa9)['then'](handleEntityNotFound(_0x2196e9,null))[_0xc09f('0xa')](respondWithResult(_0x2196e9,null))[_0xc09f('0x3f')](handleError(_0x2196e9,null));};exports[_0xc09f('0x40')]=function(_0x2a0c4a,_0x43dae2){var _0x5d2b96;return db[_0xc09f('0x37')][_0xc09f('0x40')](_0x2a0c4a[_0xc09f('0x41')],{'raw':!![]})[_0xc09f('0xa')](function(_0x22a536){_0x5d2b96=_0x22a536;return db[_0xc09f('0x37')][_0xc09f('0x3a')]({'where':{'type':_0x2a0c4a[_0xc09f('0x41')][_0xc09f('0x26')]},'raw':!![]});})[_0xc09f('0xa')](function(_0x3ae16b){if(_0x5d2b96[_0xc09f('0x26')]['toUpperCase']()==_0xc09f('0x42')){var _0x18b69b=fs['readFileSync'](path[_0xc09f('0x43')](config[_0xc09f('0x44')],_0xc09f('0x45')),_0xc09f('0x46'));var _0xa8468d=ejs[_0xc09f('0x47')](_0x18b69b,{'networks':_0x3ae16b||[]});fs['writeFileSync']('/etc/asterisk/stun_xcally.conf',_0xa8468d);return respondWithRpcPromise('Reload',_0xc09f('0x40'),{'module':'res_stun_monitor.so'});}else if(_0x5d2b96[_0xc09f('0x26')][_0xc09f('0x48')]()==_0xc09f('0x49')){var _0x134261=fs[_0xc09f('0x4a')](path[_0xc09f('0x43')](config[_0xc09f('0x44')],_0xc09f('0x4b')),_0xc09f('0x46'));var _0x3131d5=ejs[_0xc09f('0x47')](_0x134261,{'networks':_0x3ae16b||[]});fs['writeFileSync']('/etc/asterisk/turn_xcally.conf',_0x3131d5);return respondWithRpcPromise(_0xc09f('0x4c'),_0xc09f('0x40'),{'module':_0xc09f('0x4d')});}else{var _0xe8921f=fs[_0xc09f('0x4a')](path['join'](config[_0xc09f('0x44')],_0xc09f('0x4e')),_0xc09f('0x46'));var _0x51a040=ejs[_0xc09f('0x47')](_0xe8921f,{'networks':_0x3ae16b||[]});fs['writeFileSync'](util[_0xc09f('0x4f')]('/etc/asterisk/sip_xcally_%s.conf',_0x2a0c4a[_0xc09f('0x41')][_0xc09f('0x26')][_0xc09f('0x50')]()),_0x51a040);return respondWithRpcPromise('Reload','create',{'module':_0xc09f('0x51')});}})[_0xc09f('0xa')](function(){return _0x5d2b96;})[_0xc09f('0xa')](respondWithResult(_0x43dae2,0xc9))[_0xc09f('0x3f')](handleError(_0x43dae2,null));};exports[_0xc09f('0x1d')]=function(_0x5d8f3b,_0x3873df){var _0x16f7c3;return db['Network'][_0xc09f('0x52')]({'where':{'id':_0x5d8f3b[_0xc09f('0x3c')]['id']}})[_0xc09f('0xa')](handleEntityNotFound(_0x3873df,null))[_0xc09f('0xa')](saveUpdates(_0x5d8f3b['body'],null))[_0xc09f('0xa')](function(_0x359c02){if(_0x359c02){_0x16f7c3=_0x359c02;return db[_0xc09f('0x37')][_0xc09f('0x3a')]({'where':{'type':_0x16f7c3['type']},'raw':!![]});}return null;})[_0xc09f('0xa')](function(_0x5bdd5f){if(_0x16f7c3[_0xc09f('0x26')]['toUpperCase']()==_0xc09f('0x42')){var _0x55ac14=fs[_0xc09f('0x4a')](path[_0xc09f('0x43')](config['root'],_0xc09f('0x45')),_0xc09f('0x46'));var _0x1bedd8=ejs['render'](_0x55ac14,{'networks':_0x5bdd5f||[]});fs[_0xc09f('0x53')]('/etc/asterisk/stun_xcally.conf',_0x1bedd8);return respondWithRpcPromise(_0xc09f('0x4c'),'update',{'module':_0xc09f('0x4d')});}else if(_0x16f7c3['type']['toUpperCase']()==_0xc09f('0x49')){var _0x379ba8=fs[_0xc09f('0x4a')](path['join'](config[_0xc09f('0x44')],_0xc09f('0x4b')),_0xc09f('0x46'));var _0x144894=ejs[_0xc09f('0x47')](_0x379ba8,{'networks':_0x5bdd5f||[]});fs['writeFileSync'](_0xc09f('0x54'),_0x144894);return respondWithRpcPromise(_0xc09f('0x4c'),_0xc09f('0x1d'),{'module':_0xc09f('0x4d')});}else{var _0x2062b6=fs[_0xc09f('0x4a')](path[_0xc09f('0x43')](config[_0xc09f('0x44')],_0xc09f('0x4e')),'utf8');var _0x23679b=ejs[_0xc09f('0x47')](_0x2062b6,{'networks':_0x5bdd5f||[]});fs[_0xc09f('0x53')](util[_0xc09f('0x4f')](_0xc09f('0x55'),_0x5d8f3b[_0xc09f('0x41')][_0xc09f('0x26')]['toLowerCase']()),_0x23679b);return respondWithRpcPromise('Reload',_0xc09f('0x1d'),{'module':'chan_sip.so'});}})[_0xc09f('0xa')](function(_0x3d4ed5){if(_0x3d4ed5){return _0x16f7c3;}return null;})[_0xc09f('0xa')](respondWithResult(_0x3873df,null))[_0xc09f('0x3f')](handleError(_0x3873df,null));};exports[_0xc09f('0x1e')]=function(_0x3e4df5,_0x2b38ac){var _0x5be30d;return db[_0xc09f('0x37')][_0xc09f('0x52')]({'where':{'id':_0x3e4df5['params']['id']}})[_0xc09f('0xa')](function(_0x2468e0){_0x5be30d=_0x2468e0;return _0x2468e0;})[_0xc09f('0xa')](handleEntityNotFound(_0x2b38ac,null))[_0xc09f('0xa')](removeEntity(_0x2b38ac,null))[_0xc09f('0xa')](function(){if(_0x5be30d){return db[_0xc09f('0x37')][_0xc09f('0x3a')]({'where':{'type':_0x5be30d['type']},'raw':!![]});}})[_0xc09f('0xa')](function(_0x545a34){if(_0x5be30d['type'][_0xc09f('0x48')]()=='STUN'){var _0x3b495f=fs[_0xc09f('0x4a')](path[_0xc09f('0x43')](config[_0xc09f('0x44')],_0xc09f('0x45')),_0xc09f('0x46'));var _0x1d28fa=ejs['render'](_0x3b495f,{'networks':_0x545a34||[]});fs[_0xc09f('0x53')](_0xc09f('0x56'),_0x1d28fa);return respondWithRpcPromise('Reload','destroy',{'module':_0xc09f('0x4d')});}else if(_0x5be30d[_0xc09f('0x26')]['toUpperCase']()==_0xc09f('0x49')){var _0x52eafc=fs[_0xc09f('0x4a')](path['join'](config[_0xc09f('0x44')],_0xc09f('0x4b')),_0xc09f('0x46'));var _0x1a9f9c=ejs[_0xc09f('0x47')](_0x52eafc,{'networks':_0x545a34||[]});fs[_0xc09f('0x53')](_0xc09f('0x54'),_0x1a9f9c);return respondWithRpcPromise(_0xc09f('0x4c'),_0xc09f('0x1e'),{'module':_0xc09f('0x4d')});}else{var _0x45bedc=fs[_0xc09f('0x4a')](path[_0xc09f('0x43')](config[_0xc09f('0x44')],_0xc09f('0x4e')),_0xc09f('0x46'));var _0x1b1a47=ejs['render'](_0x45bedc,{'networks':_0x545a34||[]});fs[_0xc09f('0x53')](util[_0xc09f('0x4f')](_0xc09f('0x55'),_0x5be30d['type'][_0xc09f('0x50')]()),_0x1b1a47);return respondWithRpcPromise('Reload',_0xc09f('0x1e'),{'module':_0xc09f('0x51')});}})['catch'](handleError(_0x2b38ac,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index 9b72461..7ee90d7 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 _0xd139=['rimraf','../../config/environment','./network.attributes','Network','lodash','util','moment','bluebird','request-promise','path'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xd139,0x14e));var _0x9d13=function(_0xf4666e,_0x571140){_0xf4666e=_0xf4666e-0x0;var _0x1853f1=_0xd139[_0xf4666e];return _0x1853f1;};'use strict';var _=require(_0x9d13('0x0'));var util=require(_0x9d13('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x9d13('0x2'));var BPromise=require(_0x9d13('0x3'));var rp=require(_0x9d13('0x4'));var fs=require('fs');var path=require(_0x9d13('0x5'));var rimraf=require(_0x9d13('0x6'));var config=require(_0x9d13('0x7'));var attributes=require(_0x9d13('0x8'));module['exports']=function(_0x4c8e60,_0x2918eb){return _0x4c8e60['define'](_0x9d13('0x9'),attributes,{'tableName':'network','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb688=['exports','Network','network','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./network.attributes'];(function(_0x2c028e,_0x520fd7){var _0x1709a6=function(_0x413fa4){while(--_0x413fa4){_0x2c028e['push'](_0x2c028e['shift']());}};_0x1709a6(++_0x520fd7);}(_0xb688,0xcf));var _0x8b68=function(_0xc60e43,_0x2720f2){_0xc60e43=_0xc60e43-0x0;var _0x4fb45e=_0xb688[_0xc60e43];return _0x4fb45e;};'use strict';var _=require('lodash');var util=require(_0x8b68('0x0'));var logger=require(_0x8b68('0x1'))(_0x8b68('0x2'));var moment=require(_0x8b68('0x3'));var BPromise=require(_0x8b68('0x4'));var rp=require(_0x8b68('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8b68('0x6'));var config=require(_0x8b68('0x7'));var attributes=require(_0x8b68('0x8'));module[_0x8b68('0x9')]=function(_0x583d16,_0x34314e){return _0x583d16['define'](_0x8b68('0xa'),attributes,{'tableName':_0x8b68('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/network/network.rpc.js b/server/api/network/network.rpc.js index 8539a73..d3865b1 100644 --- a/server/api/network/network.rpc.js +++ b/server/api/network/network.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['info','Network,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x7a54,0x106));var _0x47a5=function(_0x15a047,_0x441015){_0x15a047=_0x15a047-0x0;var _0x31a909=_0x7a54[_0x15a047];return _0x31a909;};'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(_0x56d7e8,_0x1ddb7f){var _0x244db4=function(_0x550f91){while(--_0x550f91){_0x56d7e8['push'](_0x56d7e8['shift']());}};_0x244db4(++_0x1ddb7f);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('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 93e7ffc..d6c5f16 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 _0x0bea=['addApplications','/:id/users','/:id/send','/:id','update','delete','removeAnswers','removeAgents','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','getApplications','/:id/interactions','getInteractions','getAgents','create','post','addDisposition','addAnswer','/:id/notify','/:id/applications'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0bea,0x155));var _0xa0be=function(_0x113a6c,_0x10df30){_0x113a6c=_0x113a6c-0x0;var _0x1ac632=_0x0bea[_0x113a6c];return _0x1ac632;};'use strict';var multer=require(_0xa0be('0x0'));var util=require(_0xa0be('0x1'));var path=require('path');var timeout=require(_0xa0be('0x2'));var express=require(_0xa0be('0x3'));var router=express[_0xa0be('0x4')]();var fs_extra=require(_0xa0be('0x5'));var auth=require(_0xa0be('0x6'));var interaction=require(_0xa0be('0x7'));var config=require(_0xa0be('0x8'));var controller=require('./openchannelAccount.controller');router[_0xa0be('0x9')]('/',auth['isAuthenticated'](),controller[_0xa0be('0xa')]);router[_0xa0be('0x9')](_0xa0be('0xb'),auth[_0xa0be('0xc')](),controller[_0xa0be('0xd')]);router[_0xa0be('0x9')]('/:id',auth[_0xa0be('0xc')](),controller[_0xa0be('0xe')]);router[_0xa0be('0x9')](_0xa0be('0xf'),auth[_0xa0be('0xc')](),controller[_0xa0be('0x10')]);router[_0xa0be('0x9')](_0xa0be('0x11'),auth[_0xa0be('0xc')](),controller[_0xa0be('0x12')]);router['get']('/:id/applications',auth[_0xa0be('0xc')](),controller[_0xa0be('0x13')]);router[_0xa0be('0x9')](_0xa0be('0x14'),auth[_0xa0be('0xc')](),controller[_0xa0be('0x15')]);router[_0xa0be('0x9')]('/:id/users',auth[_0xa0be('0xc')](),controller[_0xa0be('0x16')]);router['post']('/',auth[_0xa0be('0xc')](),controller[_0xa0be('0x17')]);router[_0xa0be('0x18')](_0xa0be('0xf'),auth[_0xa0be('0xc')](),controller[_0xa0be('0x19')]);router[_0xa0be('0x18')]('/:id/canned_answers',auth[_0xa0be('0xc')](),controller[_0xa0be('0x1a')]);router[_0xa0be('0x18')](_0xa0be('0x1b'),controller['notify']);router[_0xa0be('0x18')](_0xa0be('0x1c'),auth[_0xa0be('0xc')](),controller[_0xa0be('0x1d')]);router[_0xa0be('0x18')](_0xa0be('0x1e'),auth[_0xa0be('0xc')](),controller['addAgents']);router[_0xa0be('0x18')](_0xa0be('0x1f'),auth[_0xa0be('0xc')](),controller['send']);router['put'](_0xa0be('0x20'),auth[_0xa0be('0xc')](),controller[_0xa0be('0x21')]);router[_0xa0be('0x22')](_0xa0be('0x20'),auth[_0xa0be('0xc')](),controller['destroy']);router['delete'](_0xa0be('0xf'),auth[_0xa0be('0xc')](),controller['removeDispositions']);router[_0xa0be('0x22')](_0xa0be('0x11'),auth['isAuthenticated'](),controller[_0xa0be('0x23')]);router['delete'](_0xa0be('0x1e'),auth[_0xa0be('0xc')](),controller[_0xa0be('0x24')]);module['exports']=router; \ No newline at end of file +var _0x5464=['addApplications','/:id/users','addAgents','/:id/send','send','put','/:id','destroy','delete','exports','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelAccount.controller','get','isAuthenticated','index','describe','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','getInteractions','create','post','addAnswer','/:id/notify','notify'];(function(_0x564992,_0x2ca814){var _0x1012ab=function(_0xd1db1c){while(--_0xd1db1c){_0x564992['push'](_0x564992['shift']());}};_0x1012ab(++_0x2ca814);}(_0x5464,0xf1));var _0x4546=function(_0x3dc6f5,_0xdb5a50){_0x3dc6f5=_0x3dc6f5-0x0;var _0x471f25=_0x5464[_0x3dc6f5];return _0x471f25;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x4546('0x0'));var express=require(_0x4546('0x1'));var router=express[_0x4546('0x2')]();var fs_extra=require(_0x4546('0x3'));var auth=require(_0x4546('0x4'));var interaction=require(_0x4546('0x5'));var config=require(_0x4546('0x6'));var controller=require(_0x4546('0x7'));router[_0x4546('0x8')]('/',auth[_0x4546('0x9')](),controller[_0x4546('0xa')]);router[_0x4546('0x8')]('/describe',auth[_0x4546('0x9')](),controller[_0x4546('0xb')]);router[_0x4546('0x8')]('/:id',auth[_0x4546('0x9')](),controller['show']);router[_0x4546('0x8')]('/:id/dispositions',auth[_0x4546('0x9')](),controller[_0x4546('0xc')]);router[_0x4546('0x8')](_0x4546('0xd'),auth['isAuthenticated'](),controller[_0x4546('0xe')]);router[_0x4546('0x8')](_0x4546('0xf'),auth['isAuthenticated'](),controller[_0x4546('0x10')]);router[_0x4546('0x8')]('/:id/interactions',auth[_0x4546('0x9')](),controller[_0x4546('0x11')]);router[_0x4546('0x8')]('/:id/users',auth[_0x4546('0x9')](),controller['getAgents']);router['post']('/',auth[_0x4546('0x9')](),controller[_0x4546('0x12')]);router[_0x4546('0x13')]('/:id/dispositions',auth[_0x4546('0x9')](),controller['addDisposition']);router[_0x4546('0x13')](_0x4546('0xd'),auth['isAuthenticated'](),controller[_0x4546('0x14')]);router['post'](_0x4546('0x15'),controller[_0x4546('0x16')]);router[_0x4546('0x13')](_0x4546('0xf'),auth[_0x4546('0x9')](),controller[_0x4546('0x17')]);router['post'](_0x4546('0x18'),auth['isAuthenticated'](),controller[_0x4546('0x19')]);router[_0x4546('0x13')](_0x4546('0x1a'),auth[_0x4546('0x9')](),controller[_0x4546('0x1b')]);router[_0x4546('0x1c')](_0x4546('0x1d'),auth[_0x4546('0x9')](),controller['update']);router['delete'](_0x4546('0x1d'),auth[_0x4546('0x9')](),controller[_0x4546('0x1e')]);router[_0x4546('0x1f')]('/:id/dispositions',auth[_0x4546('0x9')](),controller['removeDispositions']);router['delete'](_0x4546('0xd'),auth[_0x4546('0x9')](),controller['removeAnswers']);router[_0x4546('0x1f')]('/:id/users',auth[_0x4546('0x9')](),controller['removeAgents']);module[_0x4546('0x20')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index 3248b12..223253a 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 _0xd67b=['mandatoryDispositionPauseId','sequelize','randomstring','exports','name','STRING','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'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd67b,0x7f));var _0xbd67=function(_0x29482e,_0x39152b){_0x29482e=_0x29482e-0x0;var _0x5de0fa=_0xd67b[_0x29482e];return _0x5de0fa;};'use strict';var Sequelize=require(_0xbd67('0x0'));var rs=require(_0xbd67('0x1'));module[_0xbd67('0x2')]={'name':{'type':Sequelize['STRING'],'unique':_0xbd67('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0xbd67('0x4')]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0xbd67('0x5')]();}},'replyUri':{'type':Sequelize[_0xbd67('0x4')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xbd67('0x6')],'defaultValue':function(){return _0xbd67('0x7');}},'notificationSound':{'type':Sequelize[_0xbd67('0x8')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xbd67('0x8')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xbd67('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xbd67('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0xbd67('0x4')]},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xbd67('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xbd67('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xbd67('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xbd67('0x9')],'allowNull':!![],'defaultValue':null,'comment':_0xbd67('0xa')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xbd67('0xb'),'set':function(_0x19eed7){if(!_0x19eed7)this[_0xbd67('0xc')](_0xbd67('0xd'),null);this['setDataValue']('mandatoryDisposition',_0x19eed7);}}}; \ No newline at end of file +var _0xb5c5=['mandatoryDisposition','sequelize','randomstring','exports','name','STRING','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'];(function(_0x5cd2cd,_0x3f8e62){var _0x4260a1=function(_0x9b060e){while(--_0x9b060e){_0x5cd2cd['push'](_0x5cd2cd['shift']());}};_0x4260a1(++_0x3f8e62);}(_0xb5c5,0x153));var _0x5b5c=function(_0x1d6dfa,_0x201b6e){_0x1d6dfa=_0x1d6dfa-0x0;var _0x1b9042=_0xb5c5[_0x1d6dfa];return _0x1b9042;};'use strict';var Sequelize=require(_0x5b5c('0x0'));var rs=require(_0x5b5c('0x1'));module[_0x5b5c('0x2')]={'name':{'type':Sequelize['STRING'],'unique':_0x5b5c('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x5b5c('0x4')]},'token':{'type':Sequelize[_0x5b5c('0x4')],'defaultValue':function(){return rs['generate']();}},'replyUri':{'type':Sequelize[_0x5b5c('0x4')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x5b5c('0x4')],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x5b5c('0x5');}},'notificationSound':{'type':Sequelize[_0x5b5c('0x6')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x5b5c('0x6')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x5b5c('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x5b5c('0x4')]},'queueTransfer':{'type':Sequelize[_0x5b5c('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x5b5c('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x5b5c('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x5b5c('0x7')],'allowNull':!![],'defaultValue':null,'comment':_0x5b5c('0x8')},'mandatoryDisposition':{'type':Sequelize[_0x5b5c('0x6')],'defaultValue':![],'comment':_0x5b5c('0x9'),'set':function(_0x2489f9){if(!_0x2489f9)this[_0x5b5c('0xa')](_0x5b5c('0xb'),null);this[_0x5b5c('0xa')](_0x5b5c('0xc'),_0x2489f9);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index 5baf9cc..92e33a3 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 _0x782e=['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','redis','localhost','socket.io-emitter','./openchannelAccount.socket','register','client','http','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','update','destroy','get','OpenchannelAccounts','UserProfileResource','name','Pause','mandatoryDispositionPause','map','OpenchannelAccount','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','keys','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addDisposition','OpenchannelAccountId','Disposition','getDispositions','findOne','rawAttributes','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','notify','openchannel','CmContact','describe','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','List','Contacts','Applications','account','applications','orderBy','asc','defaults','from','firstName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','contact','lastName','messageId','interaction','created','push','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','User','UserId','agent','waitForTheAssignedAgent','forcedOwnership','queueId','OpenchannelQueue','unshift','queue','waitForTheAssignedQueue','startRouting','EventManager','addApplications','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','OpenchannelApplication','bulkCreate','findAndCountAll','priority','stack','getApplications','getInteractions','Contact','Owner','internal','Tags','tag','addAgents','omit','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','CmList','out','Messages','dataValues','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','fs-extra','crypto'];(function(_0x3d9565,_0x5db973){var _0x546f66=function(_0x137352){while(--_0x137352){_0x3d9565['push'](_0x3d9565['shift']());}};_0x546f66(++_0x5db973);}(_0x782e,0xb9));var _0xe782=function(_0x35334e,_0x204c24){_0x35334e=_0x35334e-0x0;var _0x44c95d=_0x782e[_0x35334e];return _0x44c95d;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe782('0x0'));var jsonpatch=require(_0xe782('0x1'));var rp=require('request-promise');var moment=require(_0xe782('0x2'));var BPromise=require(_0xe782('0x3'));var Mustache=require('mustache');var util=require(_0xe782('0x4'));var path=require(_0xe782('0x5'));var sox=require(_0xe782('0x6'));var csv=require(_0xe782('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe782('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xe782('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xe782('0xa'));var toCsv=require(_0xe782('0x7'));var querystring=require(_0xe782('0xb'));var Papa=require(_0xe782('0xc'));var Redis=require(_0xe782('0xd'));var authService=require(_0xe782('0xe'));var qs=require(_0xe782('0xf'));var as=require(_0xe782('0x10'));var hardwareService=require(_0xe782('0x11'));var logger=require(_0xe782('0x12'))(_0xe782('0x13'));var utils=require(_0xe782('0x14'));var config=require(_0xe782('0x15'));var licenseUtil=require(_0xe782('0x16'));var db=require('../../mysqldb')['db'];config[_0xe782('0x17')]=_['defaults'](config[_0xe782('0x17')],{'host':_0xe782('0x18'),'port':0x18eb});var socket=require(_0xe782('0x19'))(new Redis(config[_0xe782('0x17')]));require(_0xe782('0x1a'))[_0xe782('0x1b')](socket);var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0xe782('0x1c')][_0xe782('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x4ef209,_0x23cdc6,_0x35170a,_0x23c3c9){return new BPromise(function(_0x1a7c8e,_0x430bc3){var _0x35fef7=_0x23c3c9||client;return _0x35fef7[_0xe782('0x1e')](_0x4ef209,_0x35170a)[_0xe782('0x1f')](function(_0x30877e){logger[_0xe782('0x20')](_0xe782('0x21'),_0x23cdc6,_0xe782('0x22'));logger['debug'](_0xe782('0x23'),_0x23cdc6,_0xe782('0x22'),JSON[_0xe782('0x24')](_0x30877e));if(_0x30877e['error']){if(_0x30877e[_0xe782('0x25')]['code']===0x1f4){logger[_0xe782('0x25')]('OpenchannelAccount,\x20%s,\x20%s',_0x23cdc6,_0x30877e[_0xe782('0x25')][_0xe782('0x26')]);return _0x430bc3(_0x30877e[_0xe782('0x25')]['message']);}logger[_0xe782('0x25')](_0xe782('0x21'),_0x23cdc6,_0x30877e[_0xe782('0x25')][_0xe782('0x26')]);return _0x1a7c8e(_0x30877e['error'][_0xe782('0x26')]);}else{logger['info'](_0xe782('0x21'),_0x23cdc6,_0xe782('0x22'));_0x1a7c8e(_0x30877e[_0xe782('0x27')][_0xe782('0x26')]);}})[_0xe782('0x28')](function(_0x16bcb6){logger[_0xe782('0x25')](_0xe782('0x21'),_0x23cdc6,_0x16bcb6);_0x430bc3(_0x16bcb6);});});}function respondWithStatusCode(_0x250d4e,_0x2fb1c1){_0x2fb1c1=_0x2fb1c1||0xcc;return function(_0x477b5d){if(_0x477b5d){return _0x250d4e[_0xe782('0x29')](_0x2fb1c1);}return _0x250d4e[_0xe782('0x2a')](_0x2fb1c1)[_0xe782('0x2b')]();};}function respondWithResult(_0x5f45bb,_0x294c37){_0x294c37=_0x294c37||0xc8;return function(_0x359745){if(_0x359745){return _0x5f45bb[_0xe782('0x2a')](_0x294c37)['json'](_0x359745);}};}function respondWithFilteredResult(_0x49073f,_0x3dff){return function(_0x5b7e93){if(_0x5b7e93){var _0x534db5=typeof _0x3dff[_0xe782('0x2c')]===_0xe782('0x2d')&&typeof _0x3dff['limit']===_0xe782('0x2d');var _0x14bf9c=_0x5b7e93[_0xe782('0x2e')];var _0x3688f6=_0x534db5?0x0:_0x3dff[_0xe782('0x2c')];var _0x3d9b57=_0x534db5?_0x5b7e93[_0xe782('0x2e')]:_0x3dff[_0xe782('0x2c')]+_0x3dff[_0xe782('0x2f')];var _0x18f608;if(_0x3d9b57>=_0x14bf9c){_0x3d9b57=_0x14bf9c;_0x18f608=0xc8;}else{_0x18f608=0xce;}_0x49073f[_0xe782('0x2a')](_0x18f608);return _0x49073f[_0xe782('0x30')](_0xe782('0x31'),_0x3688f6+'-'+_0x3d9b57+'/'+_0x14bf9c)[_0xe782('0x32')](_0x5b7e93);}return null;};}function patchUpdates(_0xa21026){return function(_0x296742){try{jsonpatch[_0xe782('0x33')](_0x296742,_0xa21026,!![]);}catch(_0x36bada){return BPromise[_0xe782('0x34')](_0x36bada);}return _0x296742[_0xe782('0x35')]();};}function saveUpdates(_0x16ee77,_0x3f997c){return function(_0x44ded4){if(_0x44ded4){return _0x44ded4[_0xe782('0x36')](_0x16ee77)[_0xe782('0x1f')](function(_0x3fe268){return _0x3fe268;});}return null;};}function removeEntity(_0x58f06c,_0x414c15){return function(_0x3307da){if(_0x3307da){return _0x3307da[_0xe782('0x37')]()[_0xe782('0x1f')](function(){var _0x5c6770=_0x3307da[_0xe782('0x38')]({'plain':!![]});var _0x413b09=_0xe782('0x39');return db[_0xe782('0x3a')][_0xe782('0x37')]({'where':{'type':_0x413b09,'resourceId':_0x5c6770['id']}})[_0xe782('0x1f')](function(){return _0x3307da;});})[_0xe782('0x1f')](function(){_0x58f06c[_0xe782('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1c42b1,_0x116ac5){return function(_0x84f771){if(!_0x84f771){_0x1c42b1[_0xe782('0x29')](0x194);}return _0x84f771;};}function handleError(_0x316a8b,_0xa71e27){_0xa71e27=_0xa71e27||0x1f4;return function(_0x573956){logger[_0xe782('0x25')](_0x573956['stack']);if(_0x573956[_0xe782('0x3b')]){delete _0x573956[_0xe782('0x3b')];}_0x316a8b[_0xe782('0x2a')](_0xa71e27)['send'](_0x573956);};}exports['index']=function(_0x4ae0ca,_0x4eaada){var _0x1c2c67={'include':[{'model':db[_0xe782('0x3c')],'as':_0xe782('0x3d')}]},_0x3b7c93={},_0x3314f7={'count':0x0,'rows':[]};var _0x1be00d=_[_0xe782('0x3e')](db[_0xe782('0x3f')]['rawAttributes'],function(_0xefa9aa){return{'name':_0xefa9aa[_0xe782('0x40')],'type':_0xefa9aa[_0xe782('0x41')][_0xe782('0x42')]};});_0x3b7c93[_0xe782('0x43')]=_['map'](_0x1be00d,_0xe782('0x3b'));_0x3b7c93[_0xe782('0x44')]=_['keys'](_0x4ae0ca[_0xe782('0x44')]);_0x3b7c93[_0xe782('0x45')]=_[_0xe782('0x46')](_0x3b7c93[_0xe782('0x43')],_0x3b7c93[_0xe782('0x44')]);_0x1c2c67['attributes']=_['intersection'](_0x3b7c93[_0xe782('0x43')],qs[_0xe782('0x47')](_0x4ae0ca[_0xe782('0x44')][_0xe782('0x47')]));_0x1c2c67[_0xe782('0x48')]=_0x1c2c67[_0xe782('0x48')][_0xe782('0x49')]?_0x1c2c67[_0xe782('0x48')]:_0x3b7c93[_0xe782('0x43')];if(!_0x4ae0ca['query'][_0xe782('0x4a')](_0xe782('0x4b'))){_0x1c2c67[_0xe782('0x2f')]=qs['limit'](_0x4ae0ca[_0xe782('0x44')][_0xe782('0x2f')]);_0x1c2c67[_0xe782('0x2c')]=qs[_0xe782('0x2c')](_0x4ae0ca[_0xe782('0x44')][_0xe782('0x2c')]);}_0x1c2c67[_0xe782('0x4c')]=qs['sort'](_0x4ae0ca[_0xe782('0x44')][_0xe782('0x4d')]);_0x1c2c67[_0xe782('0x4e')]=qs[_0xe782('0x45')](_[_0xe782('0x4f')](_0x4ae0ca[_0xe782('0x44')],_0x3b7c93[_0xe782('0x45')]),_0x1be00d);if(_0x4ae0ca[_0xe782('0x44')]['filter']){_0x1c2c67[_0xe782('0x4e')]=_[_0xe782('0x50')](_0x1c2c67[_0xe782('0x4e')],{'$or':_[_0xe782('0x3e')](_0x1be00d,function(_0xb08a00){if(_0xb08a00[_0xe782('0x41')]!==_0xe782('0x51')){var _0x273651={};_0x273651[_0xb08a00[_0xe782('0x3b')]]={'$like':'%'+_0x4ae0ca[_0xe782('0x44')][_0xe782('0x52')]+'%'};return _0x273651;}})});}_0x1c2c67=_[_0xe782('0x50')]({},_0x1c2c67,_0x4ae0ca[_0xe782('0x53')]);var _0x50fbd2={'where':_0x1c2c67[_0xe782('0x4e')]};return db[_0xe782('0x3f')][_0xe782('0x2e')](_0x50fbd2)['then'](function(_0x583021){_0x3314f7['count']=_0x583021;if(_0x4ae0ca['query'][_0xe782('0x54')]){_0x1c2c67[_0xe782('0x55')]=[{'all':!![]}];}return db[_0xe782('0x3f')][_0xe782('0x56')](_0x1c2c67);})['then'](function(_0x1d4ab3){_0x3314f7[_0xe782('0x57')]=_0x1d4ab3;return _0x3314f7;})['then'](respondWithFilteredResult(_0x4eaada,_0x1c2c67))[_0xe782('0x28')](handleError(_0x4eaada,null));};exports[_0xe782('0x58')]=function(_0x54775e,_0x26b852){var _0x3852ce={'raw':![],'where':{'id':_0x54775e[_0xe782('0x59')]['id']},'include':[{'model':db[_0xe782('0x3c')],'as':_0xe782('0x3d')}]},_0x337cb2={};_0x337cb2['model']=_[_0xe782('0x5a')](db[_0xe782('0x3f')]['rawAttributes']);_0x337cb2[_0xe782('0x44')]=_[_0xe782('0x5a')](_0x54775e[_0xe782('0x44')]);_0x337cb2['filters']=_['intersection'](_0x337cb2[_0xe782('0x43')],_0x337cb2['query']);_0x3852ce['attributes']=_[_0xe782('0x46')](_0x337cb2[_0xe782('0x43')],qs['fields'](_0x54775e['query'][_0xe782('0x47')]));_0x3852ce[_0xe782('0x48')]=_0x3852ce[_0xe782('0x48')][_0xe782('0x49')]?_0x3852ce[_0xe782('0x48')]:_0x337cb2[_0xe782('0x43')];if(_0x54775e[_0xe782('0x44')][_0xe782('0x54')]){_0x3852ce[_0xe782('0x55')]=[{'all':!![]}];}_0x3852ce=_['merge']({},_0x3852ce,_0x54775e[_0xe782('0x53')]);return db[_0xe782('0x3f')][_0xe782('0x5b')](_0x3852ce)[_0xe782('0x1f')](handleEntityNotFound(_0x26b852,null))['then'](respondWithResult(_0x26b852,null))[_0xe782('0x28')](handleError(_0x26b852,null));};exports['create']=function(_0x4d61b2,_0xf2332c){return db['OpenchannelAccount'][_0xe782('0x5c')](_0x4d61b2[_0xe782('0x5d')],{})[_0xe782('0x1f')](function(_0xda2aac){var _0x48f1d7=_0x4d61b2[_0xe782('0x5e')][_0xe782('0x38')]({'plain':!![]});if(!_0x48f1d7)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x48f1d7[_0xe782('0x5f')]==='user'){var _0x35f5ab=_0xda2aac[_0xe782('0x38')]({'plain':!![]});var _0x29033a=_0xe782('0x39');return db[_0xe782('0x60')][_0xe782('0x5b')]({'where':{'name':_0x29033a,'userProfileId':_0x48f1d7[_0xe782('0x61')]},'raw':!![]})[_0xe782('0x1f')](function(_0xb8aa8a){if(_0xb8aa8a&&_0xb8aa8a[_0xe782('0x62')]===0x0){return db[_0xe782('0x3a')][_0xe782('0x5c')]({'name':_0x35f5ab[_0xe782('0x3b')],'resourceId':_0x35f5ab['id'],'type':_0xb8aa8a[_0xe782('0x3b')],'sectionId':_0xb8aa8a['id']},{})[_0xe782('0x1f')](function(){return _0xda2aac;});}else{return _0xda2aac;}})[_0xe782('0x28')](function(_0x283e94){logger[_0xe782('0x25')](_0xe782('0x63'),_0x283e94);throw _0x283e94;});}return _0xda2aac;})['then'](respondWithResult(_0xf2332c,0xc9))[_0xe782('0x28')](handleError(_0xf2332c,null));};exports[_0xe782('0x36')]=function(_0x15325f,_0x3678d4){if(_0x15325f[_0xe782('0x5d')]['id']){delete _0x15325f['body']['id'];}return db['OpenchannelAccount'][_0xe782('0x5b')]({'where':{'id':_0x15325f[_0xe782('0x59')]['id']},'include':[{'model':db[_0xe782('0x3c')],'as':_0xe782('0x3d')}]})[_0xe782('0x1f')](handleEntityNotFound(_0x3678d4,null))[_0xe782('0x1f')](saveUpdates(_0x15325f[_0xe782('0x5d')],null))[_0xe782('0x1f')](respondWithResult(_0x3678d4,null))[_0xe782('0x28')](handleError(_0x3678d4,null));};exports[_0xe782('0x37')]=function(_0x448ebb,_0x4a20a2){return db[_0xe782('0x3f')][_0xe782('0x5b')]({'where':{'id':_0x448ebb[_0xe782('0x59')]['id']}})['then'](handleEntityNotFound(_0x4a20a2,null))[_0xe782('0x1f')](removeEntity(_0x4a20a2,null))[_0xe782('0x28')](handleError(_0x4a20a2,null));};exports['describe']=function(_0x2f90b4,_0x5185e4){return db['OpenchannelAccount']['describe']()[_0xe782('0x1f')](respondWithResult(_0x5185e4,null))['catch'](handleError(_0x5185e4,null));};exports[_0xe782('0x64')]=function(_0x4a402a,_0x2db935,_0x33e11a){if(_0x4a402a['body']['id']){delete _0x4a402a[_0xe782('0x5d')]['id'];}return db['OpenchannelAccount'][_0xe782('0x5b')]({'where':{'id':_0x4a402a[_0xe782('0x59')]['id']}})[_0xe782('0x1f')](handleEntityNotFound(_0x2db935,null))[_0xe782('0x1f')](function(_0x17621d){if(_0x17621d){_0x4a402a[_0xe782('0x5d')][_0xe782('0x65')]=_0x17621d['id'];return db[_0xe782('0x66')][_0xe782('0x5c')](_0x4a402a[_0xe782('0x5d')]);}})[_0xe782('0x1f')](respondWithResult(_0x2db935,null))[_0xe782('0x28')](handleError(_0x2db935,null));};exports[_0xe782('0x67')]=function(_0x1e16a9,_0x2f0e8a,_0x11a1d4){var _0x1a420d={'raw':![],'where':{}};var _0x52bb3c={};var _0x382ba2={'count':0x0,'rows':[]};return db[_0xe782('0x3f')][_0xe782('0x68')]({'where':{'id':_0x1e16a9['params']['id']}})[_0xe782('0x1f')](handleEntityNotFound(_0x2f0e8a,null))['then'](function(_0x5fd89){if(_0x5fd89){_0x52bb3c['model']=_[_0xe782('0x5a')](db[_0xe782('0x66')][_0xe782('0x69')]);_0x52bb3c[_0xe782('0x44')]=_[_0xe782('0x5a')](_0x1e16a9[_0xe782('0x44')]);_0x52bb3c[_0xe782('0x45')]=_['intersection'](_0x52bb3c[_0xe782('0x43')],_0x52bb3c[_0xe782('0x44')]);_0x1a420d[_0xe782('0x48')]=_[_0xe782('0x46')](_0x52bb3c[_0xe782('0x43')],qs['fields'](_0x1e16a9[_0xe782('0x44')]['fields']));_0x1a420d['attributes']=_0x1a420d[_0xe782('0x48')]['length']?_0x1a420d[_0xe782('0x48')]:_0x52bb3c[_0xe782('0x43')];if(!_0x1e16a9[_0xe782('0x44')][_0xe782('0x4a')]('nolimit')){_0x1a420d[_0xe782('0x2f')]=qs[_0xe782('0x2f')](_0x1e16a9[_0xe782('0x44')][_0xe782('0x2f')]);_0x1a420d[_0xe782('0x2c')]=qs[_0xe782('0x2c')](_0x1e16a9[_0xe782('0x44')][_0xe782('0x2c')]);}_0x1a420d['order']=qs[_0xe782('0x4d')](_0x1e16a9['query']['sort']);_0x1a420d[_0xe782('0x4e')]=qs[_0xe782('0x45')](_['pick'](_0x1e16a9[_0xe782('0x44')],_0x52bb3c['filters']));_0x1a420d[_0xe782('0x4e')][_0xe782('0x65')]=_0x5fd89['id'];if(_0x1e16a9[_0xe782('0x44')][_0xe782('0x52')]){_0x1a420d[_0xe782('0x4e')]=_[_0xe782('0x50')](_0x1a420d[_0xe782('0x4e')],{'$or':_['map'](_0x1a420d[_0xe782('0x48')],function(_0x496ede){var _0x23a192={};_0x23a192[_0x496ede]={'$like':'%'+_0x1e16a9['query'][_0xe782('0x52')]+'%'};return _0x23a192;})});}_0x1a420d=_[_0xe782('0x50')]({},_0x1a420d,_0x1e16a9['options']);return db[_0xe782('0x66')]['count']({'where':_0x1a420d[_0xe782('0x4e')]})['then'](function(_0x59111c){_0x382ba2[_0xe782('0x2e')]=_0x59111c;if(_0x1e16a9['query'][_0xe782('0x54')]){_0x1a420d[_0xe782('0x55')]=[{'all':!![]}];}return db['Disposition'][_0xe782('0x56')](_0x1a420d);})[_0xe782('0x1f')](function(_0x4e95d7){_0x382ba2[_0xe782('0x57')]=_0x4e95d7;return _0x382ba2;});}})[_0xe782('0x1f')](respondWithFilteredResult(_0x2f0e8a,_0x1a420d))[_0xe782('0x28')](handleError(_0x2f0e8a,null));};exports[_0xe782('0x6a')]=function(_0x3a1fbd,_0x10d9f5,_0x50daf6){return db[_0xe782('0x3f')]['find']({'where':{'id':_0x3a1fbd['params']['id']}})[_0xe782('0x1f')](handleEntityNotFound(_0x10d9f5,null))[_0xe782('0x1f')](function(_0x378563){if(_0x378563){return _0x378563[_0xe782('0x6a')](_0x3a1fbd[_0xe782('0x44')][_0xe782('0x6b')]);}})['then'](respondWithStatusCode(_0x10d9f5,null))['catch'](handleError(_0x10d9f5,null));};exports[_0xe782('0x6c')]=function(_0x4af62f,_0x32d947,_0x178781){if(_0x4af62f[_0xe782('0x5d')]['id']){delete _0x4af62f[_0xe782('0x5d')]['id'];}return db[_0xe782('0x3f')]['find']({'where':{'id':_0x4af62f[_0xe782('0x59')]['id']}})['then'](handleEntityNotFound(_0x32d947,null))[_0xe782('0x1f')](function(_0x5776fd){if(_0x5776fd){_0x4af62f[_0xe782('0x5d')]['OpenchannelAccountId']=_0x5776fd['id'];return db[_0xe782('0x6d')][_0xe782('0x5c')](_0x4af62f['body']);}})[_0xe782('0x1f')](respondWithResult(_0x32d947,null))[_0xe782('0x28')](handleError(_0x32d947,null));};exports['getAnswers']=function(_0x28db2f,_0x34fc3f,_0x4748ca){var _0x44d936={'raw':![],'where':{}};var _0x1f21b8={};var _0x2d403d={'count':0x0,'rows':[]};return db[_0xe782('0x3f')][_0xe782('0x68')]({'where':{'id':_0x28db2f['params']['id']}})[_0xe782('0x1f')](handleEntityNotFound(_0x34fc3f,null))[_0xe782('0x1f')](function(_0x313ce3){if(_0x313ce3){_0x1f21b8['model']=_[_0xe782('0x5a')](db['CannedAnswer'][_0xe782('0x69')]);_0x1f21b8['query']=_[_0xe782('0x5a')](_0x28db2f[_0xe782('0x44')]);_0x1f21b8[_0xe782('0x45')]=_[_0xe782('0x46')](_0x1f21b8[_0xe782('0x43')],_0x1f21b8[_0xe782('0x44')]);_0x44d936[_0xe782('0x48')]=_[_0xe782('0x46')](_0x1f21b8[_0xe782('0x43')],qs['fields'](_0x28db2f[_0xe782('0x44')]['fields']));_0x44d936[_0xe782('0x48')]=_0x44d936[_0xe782('0x48')]['length']?_0x44d936[_0xe782('0x48')]:_0x1f21b8[_0xe782('0x43')];if(!_0x28db2f[_0xe782('0x44')]['hasOwnProperty'](_0xe782('0x4b'))){_0x44d936[_0xe782('0x2f')]=qs[_0xe782('0x2f')](_0x28db2f[_0xe782('0x44')][_0xe782('0x2f')]);_0x44d936[_0xe782('0x2c')]=qs[_0xe782('0x2c')](_0x28db2f[_0xe782('0x44')][_0xe782('0x2c')]);}_0x44d936[_0xe782('0x4c')]=qs[_0xe782('0x4d')](_0x28db2f['query'][_0xe782('0x4d')]);_0x44d936[_0xe782('0x4e')]=qs[_0xe782('0x45')](_[_0xe782('0x4f')](_0x28db2f[_0xe782('0x44')],_0x1f21b8['filters']));_0x44d936['where'][_0xe782('0x65')]=_0x313ce3['id'];if(_0x28db2f['query']['filter']){_0x44d936[_0xe782('0x4e')]=_['merge'](_0x44d936['where'],{'$or':_['map'](_0x44d936[_0xe782('0x48')],function(_0x520809){var _0x34302f={};_0x34302f[_0x520809]={'$like':'%'+_0x28db2f['query']['filter']+'%'};return _0x34302f;})});}_0x44d936=_['merge']({},_0x44d936,_0x28db2f['options']);return db[_0xe782('0x6d')][_0xe782('0x2e')]({'where':_0x44d936['where']})['then'](function(_0x2274bd){_0x2d403d[_0xe782('0x2e')]=_0x2274bd;if(_0x28db2f[_0xe782('0x44')]['includeAll']){_0x44d936[_0xe782('0x55')]=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x44d936);})[_0xe782('0x1f')](function(_0x1a0398){_0x2d403d[_0xe782('0x57')]=_0x1a0398;return _0x2d403d;});}})['then'](respondWithFilteredResult(_0x34fc3f,_0x44d936))[_0xe782('0x28')](handleError(_0x34fc3f,null));};exports[_0xe782('0x6e')]=function(_0x2b81a7,_0x48535e,_0x3a05b9){return db[_0xe782('0x3f')]['find']({'where':{'id':_0x2b81a7['params']['id']}})[_0xe782('0x1f')](handleEntityNotFound(_0x48535e,null))[_0xe782('0x1f')](function(_0x320ae0){if(_0x320ae0){return _0x320ae0[_0xe782('0x6e')](_0x2b81a7[_0xe782('0x44')]['ids']);}})[_0xe782('0x1f')](respondWithStatusCode(_0x48535e,null))[_0xe782('0x28')](handleError(_0x48535e,null));};exports[_0xe782('0x6f')]=function(_0x32a679,_0x29f448,_0x3c758b){var _0x20b8e1={'body':_0x32a679[_0xe782('0x5d')],'channel':_0xe782('0x70')};var _0x2c237e=[];var _0x55871b=[];var _0x5a9d12={};var _0xcc2abd=![];return db[_0xe782('0x71')][_0xe782('0x72')]()['then'](function(_0x1d871e){if(!_0x1d871e){throw new db[(_0xe782('0x73'))][(_0xe782('0x74'))](_0xe782('0x75'));}_0x2c237e=_[_0xe782('0x76')](_[_0xe782('0x5a')](_0x1d871e),[_0xe782('0x77'),_0xe782('0x78')]);_0x55871b=_[_0xe782('0x76')](_[_0xe782('0x5a')](_0x1d871e),[_0xe782('0x77'),_0xe782('0x78'),_0xe782('0x79'),_0xe782('0x7a')]);if(_0x32a679[_0xe782('0x5d')]['id']){delete _0x32a679[_0xe782('0x5d')]['id'];}if(_[_0xe782('0x7b')](_0x32a679[_0xe782('0x5d')]['from'])){throw new db[(_0xe782('0x73'))]['ValidationError'](_0xe782('0x7c'));}if(_[_0xe782('0x7b')](_0x32a679['body']['body'])||_0x32a679[_0xe782('0x5d')][_0xe782('0x5d')]===''){throw new db[(_0xe782('0x73'))][(_0xe782('0x74'))](_0xe782('0x7d'));}if(_[_0xe782('0x7b')](_0x32a679[_0xe782('0x5d')][_0xe782('0x7e')])){throw new db[(_0xe782('0x73'))][(_0xe782('0x74'))](_0xe782('0x7f')+_0x55871b);}if(!_['includes'](_0x55871b,_0x32a679[_0xe782('0x5d')][_0xe782('0x7e')])){throw new db[(_0xe782('0x73'))][(_0xe782('0x74'))](_0xe782('0x80')+_0x55871b);}_0x5a9d12[_0x32a679[_0xe782('0x5d')][_0xe782('0x7e')]]=_0x32a679['body']['from'];})[_0xe782('0x1f')](function(){return db[_0xe782('0x3f')][_0xe782('0x5b')]({'where':{'id':_0x32a679[_0xe782('0x59')]['id']},'include':[{'model':db['CmList'],'as':_0xe782('0x81'),'include':[{'model':db[_0xe782('0x71')],'as':_0xe782('0x82'),'where':_0x5a9d12,'limit':0x1,'order':[[_0xe782('0x78'),'DESC']]}]},{'model':db['OpenchannelApplication'],'as':_0xe782('0x83')}]});})['then'](handleEntityNotFound(_0x29f448,null))[_0xe782('0x1f')](function(_0x17d9f5){if(_0x17d9f5&&_0x17d9f5[_0xe782('0x81')]){_0x20b8e1[_0xe782('0x84')]=_0x17d9f5;_0x20b8e1[_0xe782('0x85')]=_0x17d9f5[_0xe782('0x83')];_0x20b8e1['list']=_0x17d9f5[_0xe782('0x81')];_0x20b8e1[_0xe782('0x85')]=_[_0xe782('0x86')](_0x20b8e1['applications'],['priority'],[_0xe782('0x87')]);if(_0x20b8e1[_0xe782('0x84')][_0xe782('0x83')]){delete _0x20b8e1[_0xe782('0x84')]['Applications'];}if(_0x20b8e1['account'][_0xe782('0x81')]&&_0x20b8e1['account'][_0xe782('0x81')][_0xe782('0x82')][_0xe782('0x49')]){return _0x20b8e1['account']['List'][_0xe782('0x82')][0x0];}var _0x327bdb=_[_0xe782('0x88')](_0x32a679[_0xe782('0x5d')],{'firstName':_0x32a679[_0xe782('0x5d')][_0xe782('0x89')],'ListId':_0x17d9f5[_0xe782('0x7a')]});_0x327bdb[_0x32a679[_0xe782('0x5d')]['mapKey']]=_0x32a679[_0xe782('0x5d')][_0xe782('0x89')];return db['CmContact'][_0xe782('0x5c')](_0x327bdb,{'fields':_0x2c237e,'raw':!![]});}})[_0xe782('0x1f')](handleEntityNotFound(_0x29f448,null))[_0xe782('0x1f')](function(_0xdc1717){_0x20b8e1['contact']=_0xdc1717;if(_0xdc1717){var _0x819110={'ContactId':_0xdc1717['id'],'OpenchannelAccountId':_0x32a679[_0xe782('0x59')]['id'],'from':(_0xdc1717[_0xe782('0x8a')]||'')+'\x20'+(_0xdc1717['lastName']||'')};var _0xa0e805={'OpenchannelAccountId':_0x32a679[_0xe782('0x59')]['id'],'closed':![]};if(_0x32a679['body'][_0xe782('0x8b')]){_0xa0e805['threadId']=_0x32a679['body'][_0xe782('0x8b')];return db[_0xe782('0x8c')]['find']({'where':_0xa0e805})[_0xe782('0x1f')](function(_0x2c8c86){if(_0x2c8c86){return[_0x2c8c86,![]];}_0x819110[_0xe782('0x8b')]=_0x32a679[_0xe782('0x5d')][_0xe782('0x8b')];_0x819110[_0xe782('0x8d')]=_0x32a679[_0xe782('0x5d')][_0xe782('0x8d')];return db['OpenchannelInteraction'][_0xe782('0x5c')](_0x819110)['then'](function(_0x3fb5ec){return[_0x3fb5ec,!![]];});});}else{_0xa0e805[_0xe782('0x8b')]=null;}_0xa0e805[_0xe782('0x8e')]=_0xdc1717['id'];return db[_0xe782('0x8c')]['find']({'where':_0xa0e805})[_0xe782('0x1f')](function(_0x374379){if(_0x374379){return[_0x374379,![]];}return db[_0xe782('0x8c')]['create'](_0x819110)[_0xe782('0x1f')](function(_0x36aa51){return[_0x36aa51,!![]];});});}})[_0xe782('0x8f')](function(_0x191aa2,_0x26f848){if(_0x191aa2){_0xcc2abd=_0x26f848;if(!_0x26f848){var _0x35225b={'from':(_0x20b8e1[_0xe782('0x90')][_0xe782('0x8a')]||'')+'\x20'+(_0x20b8e1['contact'][_0xe782('0x91')]||'')};if(_0x32a679['body'][_0xe782('0x8b')]&&_0x32a679[_0xe782('0x5d')][_0xe782('0x92')]&&_0x32a679[_0xe782('0x5d')][_0xe782('0x8b')]!=_0x32a679[_0xe782('0x5d')][_0xe782('0x92')]){_0x35225b['threadId']=_0x32a679[_0xe782('0x5d')]['messageId'];}return _0x191aa2[_0xe782('0x36')](_0x35225b);}else{return _0x191aa2;}}})[_0xe782('0x1f')](function(_0x1c0dcb){_0x20b8e1['interaction']=_0x1c0dcb['get']({'plain':!![]});_0x20b8e1[_0xe782('0x93')][_0xe782('0x94')]=_0xcc2abd;if(_0x20b8e1['interaction'][_0xe782('0x94')]){if(_0x20b8e1[_0xe782('0x84')]['autoclose']){_0x20b8e1[_0xe782('0x85')][_0xe782('0x95')]({'id':0x0,'priority':_0x20b8e1[_0xe782('0x85')][_0xe782('0x49')]+0x1,'app':'close','appdata':_0xe782('0x96'),'interval':_0xe782('0x97')});}}return db[_0xe782('0x98')][_0xe782('0x5c')]({'body':_0x32a679[_0xe782('0x5d')]['body'],'OpenchannelAccountId':_0x32a679['params']['id'],'OpenchannelInteractionId':_0x1c0dcb['id'],'direction':'in','ContactId':_0x20b8e1[_0xe782('0x90')]['id'],'AttachmentId':_0x32a679[_0xe782('0x5d')][_0xe782('0x99')]});})[_0xe782('0x1f')](function(_0x9185e5){_0x20b8e1[_0xe782('0x26')]=_0x9185e5;if(!_0x20b8e1[_0xe782('0x93')]['UserId'])return;return db[_0xe782('0x9a')]['find']({'attributes':['id',_0xe782('0x3b')],'where':{'id':_0x20b8e1[_0xe782('0x93')][_0xe782('0x9b')]}});})[_0xe782('0x1f')](function(_0x4afe54){if(_0x4afe54){_0x20b8e1['applications']['unshift']({'id':0x0,'priority':0x0,'app':_0xe782('0x9c'),'appdata':_0x4afe54[_0xe782('0x3b')]+','+(_0x20b8e1[_0xe782('0x84')][_0xe782('0x9d')]||0xa),'interval':_0xe782('0x97')});_0x20b8e1[_0xe782('0x9e')]=!![];}if(!_0x20b8e1[_0xe782('0x93')][_0xe782('0x9f')])return;return db[_0xe782('0xa0')][_0xe782('0x5b')]({'attributes':['id',_0xe782('0x3b')],'where':{'id':_0x20b8e1[_0xe782('0x93')][_0xe782('0x9f')]}});})[_0xe782('0x1f')](function(_0x5d69c4){if(_0x5d69c4){_0x20b8e1[_0xe782('0x85')][_0xe782('0xa1')]({'id':0x0,'priority':0x1,'app':_0xe782('0xa2'),'appdata':_0x5d69c4[_0xe782('0x3b')]+','+(_0x20b8e1[_0xe782('0x84')][_0xe782('0xa3')]||0x12c),'interval':_0xe782('0x97')});}return respondWithRpcPromise('Start',_0xe782('0xa4'),_0x20b8e1);})[_0xe782('0x1f')](function(_0x1890ba){respondWithRpcPromise('EventManager',_0xe782('0xa5'),{'event':_0xe782('0x6f'),'message':_0x1890ba},client9002);return _0x1890ba;})[_0xe782('0x1f')](respondWithResult(_0x29f448,null))[_0xe782('0x28')](handleError(_0x29f448,null));};exports[_0xe782('0xa6')]=function(_0x40662f,_0x212397){var _0x45d008=_0x40662f[_0xe782('0x59')]['id'];var _0x211bd1=_0x40662f['body'];var _0x471b5c=0xc8;var _0x26f8d9=null;return db[_0xe782('0xa7')]['transaction']({'isolationLevel':db[_0xe782('0xa7')][_0xe782('0xa8')][_0xe782('0xa9')][_0xe782('0xaa')]},function(_0x495e13){return db[_0xe782('0x3f')][_0xe782('0x68')]({'where':{'id':_0x45d008},'transaction':_0x495e13})['then'](function(_0x1047a7){if(_0x1047a7){return db[_0xe782('0xab')][_0xe782('0x37')]({'where':{'OpenchannelAccountId':_0x45d008},'transaction':_0x495e13})[_0xe782('0x1f')](function(){var _0x4eb2e9=_['map'](_0x211bd1,function(_0x102ca6){_0x102ca6[_0xe782('0x65')]=_0x45d008;return _0x102ca6;});return db[_0xe782('0xab')][_0xe782('0xac')](_0x4eb2e9,{'transaction':_0x495e13});});}else{_0x471b5c=0x194;_0x26f8d9=[];}});})[_0xe782('0x1f')](function(){if(_0x471b5c!==0x194){return db['OpenchannelApplication'][_0xe782('0xad')]({'where':{'OpenchannelAccountId':_0x45d008},'order':_0xe782('0xae')})[_0xe782('0x1f')](function(_0x184fc4){_0x26f8d9=_0x184fc4;});}})['catch'](function(_0x8d5f58){_0x471b5c=0x1f4;logger['error'](_0x8d5f58[_0xe782('0xaf')]);if(_0x8d5f58[_0xe782('0x3b')]){delete _0x8d5f58['name'];}_0x26f8d9=_0x8d5f58;})['finally'](function(){if(_0x26f8d9===null){_0x212397[_0xe782('0x29')](_0x471b5c);}else{if(_0x471b5c===0x1f4){_0x212397['status'](_0x471b5c)['send'](_0x26f8d9);}else{_0x212397[_0xe782('0x2a')](_0x471b5c)[_0xe782('0x32')](_0x26f8d9);}}});};exports[_0xe782('0xb0')]=function(_0x428365,_0x5392a1,_0x1d3bbc){var _0x2547f9={};var _0x4ec65f={};var _0x356b78;var _0x3d9a0a;return db[_0xe782('0x3f')][_0xe782('0x68')]({'where':{'id':_0x428365[_0xe782('0x59')]['id']}})[_0xe782('0x1f')](handleEntityNotFound(_0x5392a1,null))[_0xe782('0x1f')](function(_0x3c538b){if(_0x3c538b){_0x356b78=_0x3c538b;_0x4ec65f[_0xe782('0x43')]=_[_0xe782('0x5a')](db[_0xe782('0xab')]['rawAttributes']);_0x4ec65f[_0xe782('0x44')]=_[_0xe782('0x5a')](_0x428365[_0xe782('0x44')]);_0x4ec65f[_0xe782('0x45')]=_[_0xe782('0x46')](_0x4ec65f[_0xe782('0x43')],_0x4ec65f[_0xe782('0x44')]);_0x2547f9['attributes']=_[_0xe782('0x46')](_0x4ec65f[_0xe782('0x43')],qs[_0xe782('0x47')](_0x428365['query'][_0xe782('0x47')]));_0x2547f9[_0xe782('0x48')]=_0x2547f9[_0xe782('0x48')][_0xe782('0x49')]?_0x2547f9[_0xe782('0x48')]:_0x4ec65f[_0xe782('0x43')];_0x2547f9[_0xe782('0x4c')]=qs[_0xe782('0x4d')](_0x428365['query'][_0xe782('0x4d')]);_0x2547f9[_0xe782('0x4e')]=qs[_0xe782('0x45')](_[_0xe782('0x4f')](_0x428365['query'],_0x4ec65f[_0xe782('0x45')]));if(_0x428365['query'][_0xe782('0x52')]){_0x2547f9[_0xe782('0x4e')]=_[_0xe782('0x50')](_0x2547f9[_0xe782('0x4e')],{'$or':_[_0xe782('0x3e')](_0x2547f9['attributes'],function(_0x1d71e4){var _0x3999a3={};_0x3999a3[_0x1d71e4]={'$like':'%'+_0x428365[_0xe782('0x44')][_0xe782('0x52')]+'%'};return _0x3999a3;})});}_0x2547f9=_[_0xe782('0x50')]({},_0x2547f9,_0x428365[_0xe782('0x53')]);return _0x356b78['getApplications'](_0x2547f9);}})[_0xe782('0x1f')](function(_0x34b181){if(_0x34b181){_0x3d9a0a=_0x34b181[_0xe782('0x49')];if(!_0x428365[_0xe782('0x44')][_0xe782('0x4a')](_0xe782('0x4b'))){_0x2547f9['limit']=qs[_0xe782('0x2f')](_0x428365[_0xe782('0x44')][_0xe782('0x2f')]);_0x2547f9[_0xe782('0x2c')]=qs[_0xe782('0x2c')](_0x428365['query'][_0xe782('0x2c')]);}return _0x356b78[_0xe782('0xb0')](_0x2547f9);}})[_0xe782('0x1f')](function(_0x25636d){if(_0x25636d){return _0x25636d?{'count':_0x3d9a0a,'rows':_0x25636d}:null;}})[_0xe782('0x1f')](respondWithResult(_0x5392a1,null))['catch'](handleError(_0x5392a1,null));};exports[_0xe782('0xb1')]=function(_0x4d6634,_0x5e6967,_0x4f5025){var _0x5df7e9={'raw':![],'where':{}};var _0x614a12={};var _0x3ebb6a={'count':0x0,'rows':[]};return db[_0xe782('0x3f')][_0xe782('0x68')]({'where':{'id':_0x4d6634['params']['id']}})[_0xe782('0x1f')](handleEntityNotFound(_0x5e6967,null))[_0xe782('0x1f')](function(_0x229287){if(_0x229287){_0x614a12['model']=_[_0xe782('0x5a')](db[_0xe782('0x8c')][_0xe782('0x69')]);_0x614a12['query']=_['keys'](_0x4d6634[_0xe782('0x44')]);_0x614a12[_0xe782('0x45')]=_['intersection'](_0x614a12[_0xe782('0x43')],_0x614a12['query']);_0x5df7e9['attributes']=_['intersection'](_0x614a12[_0xe782('0x43')],qs[_0xe782('0x47')](_0x4d6634[_0xe782('0x44')][_0xe782('0x47')]));_0x5df7e9[_0xe782('0x48')]=_0x5df7e9[_0xe782('0x48')][_0xe782('0x49')]?_0x5df7e9['attributes']:_0x614a12[_0xe782('0x43')];if(!_0x4d6634['query'][_0xe782('0x4a')]('nolimit')){_0x5df7e9[_0xe782('0x2f')]=qs[_0xe782('0x2f')](_0x4d6634[_0xe782('0x44')]['limit']);_0x5df7e9[_0xe782('0x2c')]=qs[_0xe782('0x2c')](_0x4d6634[_0xe782('0x44')]['offset']);}_0x5df7e9[_0xe782('0x4c')]=qs[_0xe782('0x4d')](_0x4d6634[_0xe782('0x44')][_0xe782('0x4d')]);_0x5df7e9[_0xe782('0x4e')]=qs['filters'](_[_0xe782('0x4f')](_0x4d6634['query'],_0x614a12[_0xe782('0x45')]));_0x5df7e9[_0xe782('0x4e')][_0xe782('0x65')]=_0x229287['id'];if(_0x4d6634['query'][_0xe782('0x52')]){_0x5df7e9[_0xe782('0x4e')]=_[_0xe782('0x50')](_0x5df7e9['where'],{'$or':_[_0xe782('0x3e')](_0x5df7e9['attributes'],function(_0x12f6c1){var _0x14272f={};_0x14272f[_0x12f6c1]={'$like':'%'+_0x4d6634['query'][_0xe782('0x52')]+'%'};return _0x14272f;})});}_0x5df7e9=_['merge']({},_0x5df7e9,_0x4d6634[_0xe782('0x53')]);return db[_0xe782('0x8c')][_0xe782('0x2e')]({'where':_0x5df7e9[_0xe782('0x4e')]})[_0xe782('0x1f')](function(_0x348af1){_0x3ebb6a[_0xe782('0x2e')]=_0x348af1;if(_0x4d6634[_0xe782('0x44')][_0xe782('0x54')]){_0x5df7e9[_0xe782('0x55')]=[{'model':db[_0xe782('0x71')],'as':_0xe782('0xb2'),'required':![]},{'model':db[_0xe782('0x9a')],'as':_0xe782('0xb3'),'attributes':[_0xe782('0x3b'),'fullname',_0xe782('0xb4')],'required':![]},{'model':db['Tag'],'as':_0xe782('0xb5'),'attributes':['id',_0xe782('0x3b'),'color'],'where':_0x4d6634[_0xe782('0x44')]['tag']?{'id':_0x4d6634[_0xe782('0x44')][_0xe782('0xb6')]}:undefined,'required':_0x4d6634['query'][_0xe782('0xb6')]?!![]:![]}];}return db[_0xe782('0x8c')][_0xe782('0x56')](_0x5df7e9);})[_0xe782('0x1f')](function(_0x29619d){_0x3ebb6a[_0xe782('0x57')]=_0x29619d;return _0x3ebb6a;});}})[_0xe782('0x1f')](respondWithFilteredResult(_0x5e6967,_0x5df7e9))[_0xe782('0x28')](handleError(_0x5e6967,null));};exports[_0xe782('0xb7')]=function(_0x59ccb5,_0x2fea5a,_0x1f2b06){return db[_0xe782('0x3f')][_0xe782('0x5b')]({'where':{'id':_0x59ccb5[_0xe782('0x59')]['id']}})['then'](handleEntityNotFound(_0x2fea5a,null))[_0xe782('0x1f')](function(_0x1ecff4){if(_0x1ecff4){return _0x1ecff4[_0xe782('0xb7')](_0x59ccb5['body'][_0xe782('0x6b')],_[_0xe782('0xb8')](_0x59ccb5[_0xe782('0x5d')],[_0xe782('0x6b'),'id'])||{})[_0xe782('0x8f')](function(_0x3c254f){for(var _0xd0bcef=0x0;_0xd0bcef<_0x59ccb5[_0xe782('0x5d')][_0xe782('0x6b')]['length'];_0xd0bcef+=0x1){socket[_0xe782('0xb9')](_0xe782('0xba'),{'UserId':Number(_0x59ccb5['body'][_0xe782('0x6b')][_0xd0bcef]),'OpenchannelAccountId':Number(_0x59ccb5[_0xe782('0x59')]['id'])});}return _0x3c254f;});}})[_0xe782('0x1f')](respondWithResult(_0x2fea5a,null))[_0xe782('0x28')](handleError(_0x2fea5a,null));};exports[_0xe782('0xbb')]=function(_0x3ab631,_0x1893bb,_0x1dade9){return db[_0xe782('0x3f')][_0xe782('0x5b')]({'where':{'id':_0x3ab631[_0xe782('0x59')]['id']}})[_0xe782('0x1f')](handleEntityNotFound(_0x1893bb,null))[_0xe782('0x1f')](function(_0x4e7c66){if(_0x4e7c66){return _0x4e7c66[_0xe782('0xbb')](_0x3ab631['query'][_0xe782('0x6b')])[_0xe782('0x1f')](function(){if(_[_0xe782('0xbc')](_0x3ab631['query'][_0xe782('0x6b')])){for(var _0x319279=0x0;_0x319279<_0x3ab631[_0xe782('0x44')][_0xe782('0x6b')][_0xe782('0x49')];_0x319279+=0x1){socket[_0xe782('0xb9')](_0xe782('0xbd'),{'UserId':Number(_0x3ab631['query'][_0xe782('0x6b')][_0x319279]),'OpenchannelAccountId':Number(_0x3ab631[_0xe782('0x59')]['id'])});}}else{socket['emit']('userOpenchannelAccount:remove',{'UserId':Number(_0x3ab631['query']['ids']),'OpenchannelAccountId':Number(_0x3ab631[_0xe782('0x59')]['id'])});}});}})[_0xe782('0x1f')](respondWithStatusCode(_0x1893bb,null))[_0xe782('0x28')](handleError(_0x1893bb,null));};exports[_0xe782('0xbe')]=function(_0x136e76,_0x4c16f0,_0x50238d){var _0x3c73d2={};var _0x51dcc9={};var _0x477261;var _0x2fe1e0;return db[_0xe782('0x3f')]['findOne']({'where':{'id':_0x136e76[_0xe782('0x59')]['id']}})[_0xe782('0x1f')](handleEntityNotFound(_0x4c16f0,null))['then'](function(_0x5a5c0c){if(_0x5a5c0c){_0x477261=_0x5a5c0c;_0x51dcc9[_0xe782('0x43')]=_['keys'](db[_0xe782('0x9a')][_0xe782('0x69')]);_0x51dcc9[_0xe782('0x44')]=_[_0xe782('0x5a')](_0x136e76['query']);_0x51dcc9['filters']=_['intersection'](_0x51dcc9['model'],_0x51dcc9[_0xe782('0x44')]);_0x3c73d2[_0xe782('0x48')]=_[_0xe782('0x46')](_0x51dcc9['model'],qs[_0xe782('0x47')](_0x136e76[_0xe782('0x44')]['fields']));_0x3c73d2[_0xe782('0x48')]=_0x3c73d2[_0xe782('0x48')]['length']?_0x3c73d2[_0xe782('0x48')]:_0x51dcc9['model'];_0x3c73d2[_0xe782('0x4c')]=qs[_0xe782('0x4d')](_0x136e76[_0xe782('0x44')][_0xe782('0x4d')]);_0x3c73d2[_0xe782('0x4e')]=qs[_0xe782('0x45')](_[_0xe782('0x4f')](_0x136e76[_0xe782('0x44')],_0x51dcc9['filters']));if(_0x136e76['query'][_0xe782('0x52')]){_0x3c73d2[_0xe782('0x4e')]=_['merge'](_0x3c73d2[_0xe782('0x4e')],{'$or':_[_0xe782('0x3e')](_0x3c73d2['attributes'],function(_0x1ffd82){var _0x51e3ce={};_0x51e3ce[_0x1ffd82]={'$like':'%'+_0x136e76[_0xe782('0x44')][_0xe782('0x52')]+'%'};return _0x51e3ce;})});}_0x3c73d2=_[_0xe782('0x50')]({},_0x3c73d2,_0x136e76['options']);return _0x477261[_0xe782('0xbe')](_0x3c73d2);}})[_0xe782('0x1f')](function(_0x162cb2){if(_0x162cb2){_0x2fe1e0=_0x162cb2[_0xe782('0x49')];if(!_0x136e76[_0xe782('0x44')]['hasOwnProperty'](_0xe782('0x4b'))){_0x3c73d2[_0xe782('0x2f')]=qs[_0xe782('0x2f')](_0x136e76[_0xe782('0x44')][_0xe782('0x2f')]);_0x3c73d2[_0xe782('0x2c')]=qs[_0xe782('0x2c')](_0x136e76[_0xe782('0x44')][_0xe782('0x2c')]);}return _0x477261[_0xe782('0xbe')](_0x3c73d2);}})[_0xe782('0x1f')](function(_0x4a8007){if(_0x4a8007){return _0x4a8007?{'count':_0x2fe1e0,'rows':_0x4a8007}:null;}})['then'](respondWithResult(_0x4c16f0,null))[_0xe782('0x28')](handleError(_0x4c16f0,null));};exports['send']=function(_0x2ad5dc,_0x4b1371,_0x5b79d1){var _0x4cdc5,_0x4f4b60,_0x540847;if(_[_0xe782('0x7b')](_0x2ad5dc['body'][_0xe782('0x5d')])||_0x2ad5dc[_0xe782('0x5d')]['body']===''){throw new db[(_0xe782('0x73'))]['ValidationError'](_0xe782('0x7d'));}if(_[_0xe782('0x7b')](_0x2ad5dc[_0xe782('0x5d')]['to'])){}_0x4cdc5=_0x2ad5dc[_0xe782('0x5d')]['to'];return db[_0xe782('0x3f')][_0xe782('0x68')]({'where':{'id':_0x2ad5dc[_0xe782('0x59')]['id']}})[_0xe782('0x1f')](handleEntityNotFound(_0x4b1371,null))[_0xe782('0x1f')](function(_0x544e31){if(_0x544e31){return db[_0xe782('0x3f')][_0xe782('0x5b')]({'where':{'id':_0x544e31['id']},'include':[{'model':db[_0xe782('0xbf')],'as':_0xe782('0x81'),'include':[{'model':db[_0xe782('0x71')],'as':_0xe782('0x82'),'where':{[_0x544e31[_0xe782('0x7e')]]:_0x4cdc5},'limit':0x1,'order':[[_0xe782('0x78'),'DESC']]}]}]})[_0xe782('0x1f')](handleEntityNotFound(_0x4b1371,null))[_0xe782('0x1f')](function(_0x5370cc){if(_0x5370cc&&_0x5370cc[_0xe782('0x81')]){_0x4f4b60=_0x5370cc['get']({'plain':!![]});if(_0x4f4b60['List']&&_0x4f4b60[_0xe782('0x81')]['Contacts']['length']){return _0x4f4b60[_0xe782('0x81')][_0xe782('0x82')][0x0];}return db[_0xe782('0x71')]['create'](_[_0xe782('0x88')](_0x2ad5dc['body'],{'firstName':_0x4cdc5,[_0x5370cc[_0xe782('0x7e')]]:_0x4cdc5,'phone':_0x4cdc5,'ListId':_0x4f4b60['ListId']}));}})[_0xe782('0x1f')](handleEntityNotFound(_0x4b1371,null))[_0xe782('0x1f')](function(_0x57d22d){if(_0x57d22d){_0x540847=_0x57d22d;return db[_0xe782('0x8c')][_0xe782('0x5b')]({'where':{'ContactId':_0x540847['id'],'closed':![],'OpenchannelAccountId':_0x4f4b60['id']}})['then'](function(_0x39cb54){if(_0x39cb54){return[_0x39cb54,![]];}return db[_0xe782('0x8c')][_0xe782('0x5c')]({'UserId':_0x2ad5dc[_0xe782('0x5e')]['id'],'ContactId':_0x540847['id'],'OpenchannelAccountId':_0x4f4b60['id'],'lastMsgDirection':_0xe782('0xc0'),'firstMsgDirection':'out','Messages':[_['merge'](_0x2ad5dc[_0xe782('0x5d')],{'read':![],'body':_0x2ad5dc[_0xe782('0x5d')][_0xe782('0x5d')],'OpenchannelAccountId':_0x4f4b60['id'],'UserId':_0x2ad5dc[_0xe782('0x5e')]['id'],'ContactId':_0x540847['id']})]},{'include':[{'model':db[_0xe782('0x98')],'as':_0xe782('0xc1')}]})[_0xe782('0x1f')](function(_0x326b99){return[_0x326b99,!![]];});});}})[_0xe782('0x8f')](function(_0x5cdf98,_0x3a7b2a){if(_0x3a7b2a){return _0x5cdf98;}return db[_0xe782('0x98')][_0xe782('0x5c')](_['merge'](_0x2ad5dc[_0xe782('0x5d')],{'read':![],'body':_0x2ad5dc[_0xe782('0x5d')][_0xe782('0x5d')],'OpenchannelAccountId':_0x4f4b60['id'],'OpenchannelInteractionId':_0x5cdf98['id'],'UserId':_0x2ad5dc[_0xe782('0x5e')]['id'],'ContactId':_0x540847['id']}))[_0xe782('0x1f')](function(_0x56900f){_0x5cdf98[_0xe782('0xc2')][_0xe782('0xc1')]=[];_0x5cdf98[_0xe782('0xc2')]['Messages'][_0xe782('0x95')](_0x56900f[_0xe782('0xc2')]);return _0x5cdf98;});});}})['then'](respondWithResult(_0x4b1371,null))[_0xe782('0x28')](handleError(_0x4b1371,null));}; \ No newline at end of file +var _0x3f49=['autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','OpenchannelAccountId','Disposition','getDispositions','findOne','includeAll','rows','removeDispositions','addAnswer','CannedAnswer','removeAnswers','openchannel','CmContact','ValidationError','difference','createdAt','updatedAt','ListId','isNil','from','Sequelize','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','DESC','OpenchannelApplication','Applications','account','applications','list','orderBy','priority','contact','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','lastName','messageId','interaction','created','push','unmanaged','*,*,*,*','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','forcedOwnership','queueId','OpenchannelQueue','queue','Start','startRouting','EventManager','notify','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','finally','getApplications','options','Contact','Owner','fullname','internal','Tag','color','tag','addAgents','ids','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','out','OpenchannelMessage','dataValues','Messages','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./openchannelAccount.socket','register','jayson/promise','client','http','then','info','OpenchannelAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','OpenchannelAccount,\x20%s,\x20%s','message','catch','sendStatus','status','end','json','offset','limit','undefined','set','Content-Range','apply','reject','save','update','get','OpenchannelAccounts','UserProfileResource','destroy','stack','name','send','index','Pause','mandatoryDispositionPause','map','OpenchannelAccount','rawAttributes','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','count','include','findAll','show','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection'];(function(_0x44e016,_0x2a4ac3){var _0x5bc0a0=function(_0x2e3b13){while(--_0x2e3b13){_0x44e016['push'](_0x44e016['shift']());}};_0x5bc0a0(++_0x2a4ac3);}(_0x3f49,0x11f));var _0x93f4=function(_0x13d1db,_0x19016f){_0x13d1db=_0x13d1db-0x0;var _0x128ce2=_0x3f49[_0x13d1db];return _0x128ce2;};'use strict';var emlformat=require(_0x93f4('0x0'));var rimraf=require(_0x93f4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x93f4('0x2'));var rp=require(_0x93f4('0x3'));var moment=require(_0x93f4('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x93f4('0x5'));var util=require(_0x93f4('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x93f4('0x7'));var ejs=require(_0x93f4('0x8'));var fs=require('fs');var fs_extra=require(_0x93f4('0x9'));var _=require('lodash');var squel=require(_0x93f4('0xa'));var crypto=require('crypto');var jsforce=require(_0x93f4('0xb'));var deskjs=require(_0x93f4('0xc'));var toCsv=require(_0x93f4('0x7'));var querystring=require(_0x93f4('0xd'));var Papa=require(_0x93f4('0xe'));var Redis=require(_0x93f4('0xf'));var authService=require(_0x93f4('0x10'));var qs=require(_0x93f4('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x93f4('0x12'))(_0x93f4('0x13'));var utils=require(_0x93f4('0x14'));var config=require(_0x93f4('0x15'));var licenseUtil=require(_0x93f4('0x16'));var db=require(_0x93f4('0x17'))['db'];config[_0x93f4('0x18')]=_[_0x93f4('0x19')](config['redis'],{'host':_0x93f4('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x93f4('0x1b'))[_0x93f4('0x1c')](socket);var jayson=require(_0x93f4('0x1d'));var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0x93f4('0x1e')][_0x93f4('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x3fdf23,_0x5e4e32,_0x33dfb3,_0x7e36d5){return new BPromise(function(_0x53151e,_0x29a322){var _0x4d5a48=_0x7e36d5||client;return _0x4d5a48['request'](_0x3fdf23,_0x33dfb3)[_0x93f4('0x20')](function(_0x5b6488){logger[_0x93f4('0x21')]('OpenchannelAccount,\x20%s,\x20%s',_0x5e4e32,'request\x20sent');logger['debug'](_0x93f4('0x22'),_0x5e4e32,_0x93f4('0x23'),JSON['stringify'](_0x5b6488));if(_0x5b6488[_0x93f4('0x24')]){if(_0x5b6488['error'][_0x93f4('0x25')]===0x1f4){logger[_0x93f4('0x24')](_0x93f4('0x26'),_0x5e4e32,_0x5b6488[_0x93f4('0x24')]['message']);return _0x29a322(_0x5b6488['error'][_0x93f4('0x27')]);}logger[_0x93f4('0x24')]('OpenchannelAccount,\x20%s,\x20%s',_0x5e4e32,_0x5b6488['error']['message']);return _0x53151e(_0x5b6488[_0x93f4('0x24')][_0x93f4('0x27')]);}else{logger[_0x93f4('0x21')]('OpenchannelAccount,\x20%s,\x20%s',_0x5e4e32,_0x93f4('0x23'));_0x53151e(_0x5b6488['result'][_0x93f4('0x27')]);}})[_0x93f4('0x28')](function(_0x5afabf){logger[_0x93f4('0x24')](_0x93f4('0x26'),_0x5e4e32,_0x5afabf);_0x29a322(_0x5afabf);});});}function respondWithStatusCode(_0x186b3f,_0x2cbaaf){_0x2cbaaf=_0x2cbaaf||0xcc;return function(_0x5cf6be){if(_0x5cf6be){return _0x186b3f[_0x93f4('0x29')](_0x2cbaaf);}return _0x186b3f[_0x93f4('0x2a')](_0x2cbaaf)[_0x93f4('0x2b')]();};}function respondWithResult(_0x353ab7,_0x590d52){_0x590d52=_0x590d52||0xc8;return function(_0x2dfef0){if(_0x2dfef0){return _0x353ab7[_0x93f4('0x2a')](_0x590d52)[_0x93f4('0x2c')](_0x2dfef0);}};}function respondWithFilteredResult(_0x7f57d6,_0x3d57c1){return function(_0x275203){if(_0x275203){var _0x47776e=typeof _0x3d57c1[_0x93f4('0x2d')]==='undefined'&&typeof _0x3d57c1[_0x93f4('0x2e')]===_0x93f4('0x2f');var _0x5268ba=_0x275203['count'];var _0xd27b64=_0x47776e?0x0:_0x3d57c1['offset'];var _0x40ae22=_0x47776e?_0x275203['count']:_0x3d57c1[_0x93f4('0x2d')]+_0x3d57c1['limit'];var _0x4963c1;if(_0x40ae22>=_0x5268ba){_0x40ae22=_0x5268ba;_0x4963c1=0xc8;}else{_0x4963c1=0xce;}_0x7f57d6[_0x93f4('0x2a')](_0x4963c1);return _0x7f57d6[_0x93f4('0x30')](_0x93f4('0x31'),_0xd27b64+'-'+_0x40ae22+'/'+_0x5268ba)['json'](_0x275203);}return null;};}function patchUpdates(_0x22666f){return function(_0x9958f7){try{jsonpatch[_0x93f4('0x32')](_0x9958f7,_0x22666f,!![]);}catch(_0x21c323){return BPromise[_0x93f4('0x33')](_0x21c323);}return _0x9958f7[_0x93f4('0x34')]();};}function saveUpdates(_0x273060,_0x3272ce){return function(_0x52ff31){if(_0x52ff31){return _0x52ff31[_0x93f4('0x35')](_0x273060)[_0x93f4('0x20')](function(_0x5abf30){return _0x5abf30;});}return null;};}function removeEntity(_0x3e436a,_0x43a1b2){return function(_0x5441df){if(_0x5441df){return _0x5441df['destroy']()[_0x93f4('0x20')](function(){var _0xdf6461=_0x5441df[_0x93f4('0x36')]({'plain':!![]});var _0x422c3a=_0x93f4('0x37');return db[_0x93f4('0x38')][_0x93f4('0x39')]({'where':{'type':_0x422c3a,'resourceId':_0xdf6461['id']}})[_0x93f4('0x20')](function(){return _0x5441df;});})[_0x93f4('0x20')](function(){_0x3e436a[_0x93f4('0x2a')](0xcc)[_0x93f4('0x2b')]();});}};}function handleEntityNotFound(_0x7c50ed,_0x43ebb8){return function(_0x3491de){if(!_0x3491de){_0x7c50ed[_0x93f4('0x29')](0x194);}return _0x3491de;};}function handleError(_0x3c133b,_0x2275d9){_0x2275d9=_0x2275d9||0x1f4;return function(_0x31468d){logger['error'](_0x31468d[_0x93f4('0x3a')]);if(_0x31468d['name']){delete _0x31468d[_0x93f4('0x3b')];}_0x3c133b[_0x93f4('0x2a')](_0x2275d9)[_0x93f4('0x3c')](_0x31468d);};}exports[_0x93f4('0x3d')]=function(_0x44c9a5,_0xeb97a6){var _0x3dd7b3={'include':[{'model':db[_0x93f4('0x3e')],'as':_0x93f4('0x3f')}]},_0x1ac544={},_0x12007e={'count':0x0,'rows':[]};var _0x1cff88=_[_0x93f4('0x40')](db[_0x93f4('0x41')][_0x93f4('0x42')],function(_0x5c90b3){return{'name':_0x5c90b3['fieldName'],'type':_0x5c90b3['type'][_0x93f4('0x43')]};});_0x1ac544[_0x93f4('0x44')]=_[_0x93f4('0x40')](_0x1cff88,_0x93f4('0x3b'));_0x1ac544['query']=_[_0x93f4('0x45')](_0x44c9a5[_0x93f4('0x46')]);_0x1ac544[_0x93f4('0x47')]=_[_0x93f4('0x48')](_0x1ac544[_0x93f4('0x44')],_0x1ac544[_0x93f4('0x46')]);_0x3dd7b3[_0x93f4('0x49')]=_[_0x93f4('0x48')](_0x1ac544[_0x93f4('0x44')],qs[_0x93f4('0x4a')](_0x44c9a5['query'][_0x93f4('0x4a')]));_0x3dd7b3['attributes']=_0x3dd7b3[_0x93f4('0x49')][_0x93f4('0x4b')]?_0x3dd7b3[_0x93f4('0x49')]:_0x1ac544['model'];if(!_0x44c9a5[_0x93f4('0x46')][_0x93f4('0x4c')](_0x93f4('0x4d'))){_0x3dd7b3[_0x93f4('0x2e')]=qs['limit'](_0x44c9a5[_0x93f4('0x46')][_0x93f4('0x2e')]);_0x3dd7b3[_0x93f4('0x2d')]=qs['offset'](_0x44c9a5[_0x93f4('0x46')][_0x93f4('0x2d')]);}_0x3dd7b3[_0x93f4('0x4e')]=qs[_0x93f4('0x4f')](_0x44c9a5[_0x93f4('0x46')][_0x93f4('0x4f')]);_0x3dd7b3[_0x93f4('0x50')]=qs[_0x93f4('0x47')](_[_0x93f4('0x51')](_0x44c9a5[_0x93f4('0x46')],_0x1ac544[_0x93f4('0x47')]),_0x1cff88);if(_0x44c9a5[_0x93f4('0x46')][_0x93f4('0x52')]){_0x3dd7b3[_0x93f4('0x50')]=_[_0x93f4('0x53')](_0x3dd7b3['where'],{'$or':_[_0x93f4('0x40')](_0x1cff88,function(_0x1e4524){if(_0x1e4524[_0x93f4('0x54')]!==_0x93f4('0x55')){var _0x248bdf={};_0x248bdf[_0x1e4524[_0x93f4('0x3b')]]={'$like':'%'+_0x44c9a5['query'][_0x93f4('0x52')]+'%'};return _0x248bdf;}})});}_0x3dd7b3=_[_0x93f4('0x53')]({},_0x3dd7b3,_0x44c9a5['options']);var _0x171439={'where':_0x3dd7b3[_0x93f4('0x50')]};return db[_0x93f4('0x41')][_0x93f4('0x56')](_0x171439)['then'](function(_0x14eeea){_0x12007e[_0x93f4('0x56')]=_0x14eeea;if(_0x44c9a5[_0x93f4('0x46')]['includeAll']){_0x3dd7b3[_0x93f4('0x57')]=[{'all':!![]}];}return db[_0x93f4('0x41')][_0x93f4('0x58')](_0x3dd7b3);})[_0x93f4('0x20')](function(_0x501808){_0x12007e['rows']=_0x501808;return _0x12007e;})[_0x93f4('0x20')](respondWithFilteredResult(_0xeb97a6,_0x3dd7b3))[_0x93f4('0x28')](handleError(_0xeb97a6,null));};exports[_0x93f4('0x59')]=function(_0x3247cf,_0x71939d){var _0x15b5fd={'raw':![],'where':{'id':_0x3247cf['params']['id']},'include':[{'model':db[_0x93f4('0x3e')],'as':_0x93f4('0x3f')}]},_0x340f19={};_0x340f19[_0x93f4('0x44')]=_[_0x93f4('0x45')](db[_0x93f4('0x41')][_0x93f4('0x42')]);_0x340f19[_0x93f4('0x46')]=_[_0x93f4('0x45')](_0x3247cf['query']);_0x340f19['filters']=_['intersection'](_0x340f19[_0x93f4('0x44')],_0x340f19[_0x93f4('0x46')]);_0x15b5fd[_0x93f4('0x49')]=_[_0x93f4('0x48')](_0x340f19['model'],qs[_0x93f4('0x4a')](_0x3247cf[_0x93f4('0x46')][_0x93f4('0x4a')]));_0x15b5fd[_0x93f4('0x49')]=_0x15b5fd[_0x93f4('0x49')]['length']?_0x15b5fd[_0x93f4('0x49')]:_0x340f19[_0x93f4('0x44')];if(_0x3247cf[_0x93f4('0x46')]['includeAll']){_0x15b5fd['include']=[{'all':!![]}];}_0x15b5fd=_[_0x93f4('0x53')]({},_0x15b5fd,_0x3247cf['options']);return db[_0x93f4('0x41')][_0x93f4('0x5a')](_0x15b5fd)[_0x93f4('0x20')](handleEntityNotFound(_0x71939d,null))[_0x93f4('0x20')](respondWithResult(_0x71939d,null))[_0x93f4('0x28')](handleError(_0x71939d,null));};exports[_0x93f4('0x5b')]=function(_0x1b75c4,_0x291162){return db[_0x93f4('0x41')][_0x93f4('0x5b')](_0x1b75c4[_0x93f4('0x5c')],{})[_0x93f4('0x20')](function(_0x3d32bd){var _0x1bcfd5=_0x1b75c4[_0x93f4('0x5d')]['get']({'plain':!![]});if(!_0x1bcfd5)throw new Error(_0x93f4('0x5e'));if(_0x1bcfd5[_0x93f4('0x5f')]===_0x93f4('0x5d')){var _0x22e96d=_0x3d32bd[_0x93f4('0x36')]({'plain':!![]});var _0xeedeed=_0x93f4('0x37');return db[_0x93f4('0x60')][_0x93f4('0x5a')]({'where':{'name':_0xeedeed,'userProfileId':_0x1bcfd5['userProfileId']},'raw':!![]})[_0x93f4('0x20')](function(_0x10a0aa){if(_0x10a0aa&&_0x10a0aa[_0x93f4('0x61')]===0x0){return db[_0x93f4('0x38')][_0x93f4('0x5b')]({'name':_0x22e96d[_0x93f4('0x3b')],'resourceId':_0x22e96d['id'],'type':_0x10a0aa[_0x93f4('0x3b')],'sectionId':_0x10a0aa['id']},{})[_0x93f4('0x20')](function(){return _0x3d32bd;});}else{return _0x3d32bd;}})[_0x93f4('0x28')](function(_0x3066d2){logger[_0x93f4('0x24')](_0x93f4('0x62'),_0x3066d2);throw _0x3066d2;});}return _0x3d32bd;})[_0x93f4('0x20')](respondWithResult(_0x291162,0xc9))[_0x93f4('0x28')](handleError(_0x291162,null));};exports[_0x93f4('0x35')]=function(_0x10e867,_0x2c6133){if(_0x10e867[_0x93f4('0x5c')]['id']){delete _0x10e867[_0x93f4('0x5c')]['id'];}return db['OpenchannelAccount'][_0x93f4('0x5a')]({'where':{'id':_0x10e867[_0x93f4('0x63')]['id']},'include':[{'model':db[_0x93f4('0x3e')],'as':_0x93f4('0x3f')}]})['then'](handleEntityNotFound(_0x2c6133,null))[_0x93f4('0x20')](saveUpdates(_0x10e867[_0x93f4('0x5c')],null))[_0x93f4('0x20')](respondWithResult(_0x2c6133,null))[_0x93f4('0x28')](handleError(_0x2c6133,null));};exports[_0x93f4('0x39')]=function(_0x39f0e6,_0x400893){return db[_0x93f4('0x41')][_0x93f4('0x5a')]({'where':{'id':_0x39f0e6[_0x93f4('0x63')]['id']}})[_0x93f4('0x20')](handleEntityNotFound(_0x400893,null))[_0x93f4('0x20')](removeEntity(_0x400893,null))[_0x93f4('0x28')](handleError(_0x400893,null));};exports[_0x93f4('0x64')]=function(_0x91d125,_0x4360ab){return db[_0x93f4('0x41')]['describe']()[_0x93f4('0x20')](respondWithResult(_0x4360ab,null))[_0x93f4('0x28')](handleError(_0x4360ab,null));};exports['addDisposition']=function(_0x17ac20,_0x2e92b8,_0x308fe4){if(_0x17ac20[_0x93f4('0x5c')]['id']){delete _0x17ac20['body']['id'];}return db['OpenchannelAccount'][_0x93f4('0x5a')]({'where':{'id':_0x17ac20[_0x93f4('0x63')]['id']}})[_0x93f4('0x20')](handleEntityNotFound(_0x2e92b8,null))['then'](function(_0x4ff24b){if(_0x4ff24b){_0x17ac20['body'][_0x93f4('0x65')]=_0x4ff24b['id'];return db[_0x93f4('0x66')][_0x93f4('0x5b')](_0x17ac20[_0x93f4('0x5c')]);}})[_0x93f4('0x20')](respondWithResult(_0x2e92b8,null))[_0x93f4('0x28')](handleError(_0x2e92b8,null));};exports[_0x93f4('0x67')]=function(_0x2de2c4,_0x5e8289,_0x230e63){var _0x55d751={'raw':![],'where':{}};var _0x224520={};var _0x2a02d2={'count':0x0,'rows':[]};return db[_0x93f4('0x41')][_0x93f4('0x68')]({'where':{'id':_0x2de2c4[_0x93f4('0x63')]['id']}})[_0x93f4('0x20')](handleEntityNotFound(_0x5e8289,null))[_0x93f4('0x20')](function(_0xc56381){if(_0xc56381){_0x224520[_0x93f4('0x44')]=_[_0x93f4('0x45')](db[_0x93f4('0x66')][_0x93f4('0x42')]);_0x224520[_0x93f4('0x46')]=_[_0x93f4('0x45')](_0x2de2c4['query']);_0x224520[_0x93f4('0x47')]=_['intersection'](_0x224520[_0x93f4('0x44')],_0x224520[_0x93f4('0x46')]);_0x55d751[_0x93f4('0x49')]=_[_0x93f4('0x48')](_0x224520[_0x93f4('0x44')],qs['fields'](_0x2de2c4['query'][_0x93f4('0x4a')]));_0x55d751[_0x93f4('0x49')]=_0x55d751[_0x93f4('0x49')]['length']?_0x55d751[_0x93f4('0x49')]:_0x224520[_0x93f4('0x44')];if(!_0x2de2c4['query'][_0x93f4('0x4c')](_0x93f4('0x4d'))){_0x55d751['limit']=qs[_0x93f4('0x2e')](_0x2de2c4['query'][_0x93f4('0x2e')]);_0x55d751[_0x93f4('0x2d')]=qs['offset'](_0x2de2c4[_0x93f4('0x46')][_0x93f4('0x2d')]);}_0x55d751['order']=qs[_0x93f4('0x4f')](_0x2de2c4[_0x93f4('0x46')]['sort']);_0x55d751[_0x93f4('0x50')]=qs[_0x93f4('0x47')](_[_0x93f4('0x51')](_0x2de2c4['query'],_0x224520[_0x93f4('0x47')]));_0x55d751[_0x93f4('0x50')][_0x93f4('0x65')]=_0xc56381['id'];if(_0x2de2c4['query'][_0x93f4('0x52')]){_0x55d751[_0x93f4('0x50')]=_[_0x93f4('0x53')](_0x55d751['where'],{'$or':_['map'](_0x55d751[_0x93f4('0x49')],function(_0x16df63){var _0x16c0c7={};_0x16c0c7[_0x16df63]={'$like':'%'+_0x2de2c4[_0x93f4('0x46')][_0x93f4('0x52')]+'%'};return _0x16c0c7;})});}_0x55d751=_[_0x93f4('0x53')]({},_0x55d751,_0x2de2c4['options']);return db[_0x93f4('0x66')]['count']({'where':_0x55d751[_0x93f4('0x50')]})[_0x93f4('0x20')](function(_0xe720c2){_0x2a02d2['count']=_0xe720c2;if(_0x2de2c4[_0x93f4('0x46')][_0x93f4('0x69')]){_0x55d751[_0x93f4('0x57')]=[{'all':!![]}];}return db[_0x93f4('0x66')][_0x93f4('0x58')](_0x55d751);})[_0x93f4('0x20')](function(_0x1b1682){_0x2a02d2[_0x93f4('0x6a')]=_0x1b1682;return _0x2a02d2;});}})[_0x93f4('0x20')](respondWithFilteredResult(_0x5e8289,_0x55d751))[_0x93f4('0x28')](handleError(_0x5e8289,null));};exports[_0x93f4('0x6b')]=function(_0xe7103c,_0x593c92,_0x1e1b6a){return db['OpenchannelAccount']['find']({'where':{'id':_0xe7103c[_0x93f4('0x63')]['id']}})[_0x93f4('0x20')](handleEntityNotFound(_0x593c92,null))[_0x93f4('0x20')](function(_0x49dfa3){if(_0x49dfa3){return _0x49dfa3[_0x93f4('0x6b')](_0xe7103c[_0x93f4('0x46')]['ids']);}})[_0x93f4('0x20')](respondWithStatusCode(_0x593c92,null))[_0x93f4('0x28')](handleError(_0x593c92,null));};exports[_0x93f4('0x6c')]=function(_0x53290e,_0x2ca4c5,_0x1fb632){if(_0x53290e['body']['id']){delete _0x53290e[_0x93f4('0x5c')]['id'];}return db[_0x93f4('0x41')][_0x93f4('0x5a')]({'where':{'id':_0x53290e[_0x93f4('0x63')]['id']}})['then'](handleEntityNotFound(_0x2ca4c5,null))[_0x93f4('0x20')](function(_0x188882){if(_0x188882){_0x53290e[_0x93f4('0x5c')][_0x93f4('0x65')]=_0x188882['id'];return db['CannedAnswer'][_0x93f4('0x5b')](_0x53290e[_0x93f4('0x5c')]);}})[_0x93f4('0x20')](respondWithResult(_0x2ca4c5,null))['catch'](handleError(_0x2ca4c5,null));};exports['getAnswers']=function(_0x3837e2,_0x4a1a56,_0x309aa6){var _0x2e2a87={'raw':![],'where':{}};var _0x29f416={};var _0x1e27ba={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0x93f4('0x68')]({'where':{'id':_0x3837e2[_0x93f4('0x63')]['id']}})[_0x93f4('0x20')](handleEntityNotFound(_0x4a1a56,null))[_0x93f4('0x20')](function(_0x4ff16e){if(_0x4ff16e){_0x29f416['model']=_[_0x93f4('0x45')](db['CannedAnswer']['rawAttributes']);_0x29f416[_0x93f4('0x46')]=_[_0x93f4('0x45')](_0x3837e2[_0x93f4('0x46')]);_0x29f416[_0x93f4('0x47')]=_[_0x93f4('0x48')](_0x29f416[_0x93f4('0x44')],_0x29f416[_0x93f4('0x46')]);_0x2e2a87[_0x93f4('0x49')]=_['intersection'](_0x29f416[_0x93f4('0x44')],qs[_0x93f4('0x4a')](_0x3837e2[_0x93f4('0x46')][_0x93f4('0x4a')]));_0x2e2a87[_0x93f4('0x49')]=_0x2e2a87['attributes'][_0x93f4('0x4b')]?_0x2e2a87[_0x93f4('0x49')]:_0x29f416['model'];if(!_0x3837e2['query'][_0x93f4('0x4c')](_0x93f4('0x4d'))){_0x2e2a87[_0x93f4('0x2e')]=qs[_0x93f4('0x2e')](_0x3837e2[_0x93f4('0x46')][_0x93f4('0x2e')]);_0x2e2a87[_0x93f4('0x2d')]=qs[_0x93f4('0x2d')](_0x3837e2[_0x93f4('0x46')][_0x93f4('0x2d')]);}_0x2e2a87['order']=qs[_0x93f4('0x4f')](_0x3837e2[_0x93f4('0x46')][_0x93f4('0x4f')]);_0x2e2a87[_0x93f4('0x50')]=qs['filters'](_['pick'](_0x3837e2[_0x93f4('0x46')],_0x29f416['filters']));_0x2e2a87[_0x93f4('0x50')][_0x93f4('0x65')]=_0x4ff16e['id'];if(_0x3837e2[_0x93f4('0x46')][_0x93f4('0x52')]){_0x2e2a87[_0x93f4('0x50')]=_[_0x93f4('0x53')](_0x2e2a87[_0x93f4('0x50')],{'$or':_['map'](_0x2e2a87[_0x93f4('0x49')],function(_0x2e63dd){var _0xb5acc4={};_0xb5acc4[_0x2e63dd]={'$like':'%'+_0x3837e2[_0x93f4('0x46')][_0x93f4('0x52')]+'%'};return _0xb5acc4;})});}_0x2e2a87=_[_0x93f4('0x53')]({},_0x2e2a87,_0x3837e2['options']);return db[_0x93f4('0x6d')][_0x93f4('0x56')]({'where':_0x2e2a87[_0x93f4('0x50')]})[_0x93f4('0x20')](function(_0x4664f0){_0x1e27ba[_0x93f4('0x56')]=_0x4664f0;if(_0x3837e2[_0x93f4('0x46')]['includeAll']){_0x2e2a87[_0x93f4('0x57')]=[{'all':!![]}];}return db[_0x93f4('0x6d')][_0x93f4('0x58')](_0x2e2a87);})[_0x93f4('0x20')](function(_0x3cc13e){_0x1e27ba[_0x93f4('0x6a')]=_0x3cc13e;return _0x1e27ba;});}})[_0x93f4('0x20')](respondWithFilteredResult(_0x4a1a56,_0x2e2a87))['catch'](handleError(_0x4a1a56,null));};exports[_0x93f4('0x6e')]=function(_0x49d388,_0x41107a,_0x5dad92){return db[_0x93f4('0x41')]['find']({'where':{'id':_0x49d388['params']['id']}})[_0x93f4('0x20')](handleEntityNotFound(_0x41107a,null))[_0x93f4('0x20')](function(_0x506824){if(_0x506824){return _0x506824[_0x93f4('0x6e')](_0x49d388['query']['ids']);}})[_0x93f4('0x20')](respondWithStatusCode(_0x41107a,null))[_0x93f4('0x28')](handleError(_0x41107a,null));};exports['notify']=function(_0x26f4b9,_0x5da8de,_0x26771e){var _0x103659={'body':_0x26f4b9['body'],'channel':_0x93f4('0x6f')};var _0x238f7a=[];var _0x5b2134=[];var _0x3250e8={};var _0x27e7a4=![];return db[_0x93f4('0x70')][_0x93f4('0x64')]()[_0x93f4('0x20')](function(_0x2173a5){if(!_0x2173a5){throw new db['Sequelize'][(_0x93f4('0x71'))]('no\x20available\x20attributes');}_0x238f7a=_[_0x93f4('0x72')](_[_0x93f4('0x45')](_0x2173a5),[_0x93f4('0x73'),_0x93f4('0x74')]);_0x5b2134=_['difference'](_[_0x93f4('0x45')](_0x2173a5),[_0x93f4('0x73'),_0x93f4('0x74'),'CompanyId',_0x93f4('0x75')]);if(_0x26f4b9[_0x93f4('0x5c')]['id']){delete _0x26f4b9[_0x93f4('0x5c')]['id'];}if(_[_0x93f4('0x76')](_0x26f4b9[_0x93f4('0x5c')][_0x93f4('0x77')])){throw new db[(_0x93f4('0x78'))][(_0x93f4('0x71'))](_0x93f4('0x79'));}if(_[_0x93f4('0x76')](_0x26f4b9['body']['body'])||_0x26f4b9[_0x93f4('0x5c')]['body']===''){throw new db['Sequelize'][(_0x93f4('0x71'))](_0x93f4('0x7a'));}if(_['isNil'](_0x26f4b9['body'][_0x93f4('0x7b')])){throw new db[(_0x93f4('0x78'))][(_0x93f4('0x71'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x5b2134);}if(!_['includes'](_0x5b2134,_0x26f4b9['body'][_0x93f4('0x7b')])){throw new db[(_0x93f4('0x78'))][(_0x93f4('0x71'))](_0x93f4('0x7c')+_0x5b2134);}_0x3250e8[_0x26f4b9[_0x93f4('0x5c')][_0x93f4('0x7b')]]=_0x26f4b9[_0x93f4('0x5c')]['from'];})[_0x93f4('0x20')](function(){return db[_0x93f4('0x41')][_0x93f4('0x5a')]({'where':{'id':_0x26f4b9[_0x93f4('0x63')]['id']},'include':[{'model':db[_0x93f4('0x7d')],'as':_0x93f4('0x7e'),'include':[{'model':db[_0x93f4('0x70')],'as':_0x93f4('0x7f'),'where':_0x3250e8,'limit':0x1,'order':[[_0x93f4('0x74'),_0x93f4('0x80')]]}]},{'model':db[_0x93f4('0x81')],'as':_0x93f4('0x82')}]});})[_0x93f4('0x20')](handleEntityNotFound(_0x5da8de,null))[_0x93f4('0x20')](function(_0x1e826b){if(_0x1e826b&&_0x1e826b[_0x93f4('0x7e')]){_0x103659[_0x93f4('0x83')]=_0x1e826b;_0x103659[_0x93f4('0x84')]=_0x1e826b[_0x93f4('0x82')];_0x103659[_0x93f4('0x85')]=_0x1e826b[_0x93f4('0x7e')];_0x103659[_0x93f4('0x84')]=_[_0x93f4('0x86')](_0x103659[_0x93f4('0x84')],[_0x93f4('0x87')],['asc']);if(_0x103659[_0x93f4('0x83')][_0x93f4('0x82')]){delete _0x103659[_0x93f4('0x83')][_0x93f4('0x82')];}if(_0x103659[_0x93f4('0x83')][_0x93f4('0x7e')]&&_0x103659[_0x93f4('0x83')]['List'][_0x93f4('0x7f')][_0x93f4('0x4b')]){return _0x103659[_0x93f4('0x83')]['List']['Contacts'][0x0];}var _0x2323cb=_['defaults'](_0x26f4b9[_0x93f4('0x5c')],{'firstName':_0x26f4b9[_0x93f4('0x5c')][_0x93f4('0x77')],'ListId':_0x1e826b[_0x93f4('0x75')]});_0x2323cb[_0x26f4b9['body']['mapKey']]=_0x26f4b9['body'][_0x93f4('0x77')];return db[_0x93f4('0x70')][_0x93f4('0x5b')](_0x2323cb,{'fields':_0x238f7a,'raw':!![]});}})[_0x93f4('0x20')](handleEntityNotFound(_0x5da8de,null))[_0x93f4('0x20')](function(_0x24644d){_0x103659[_0x93f4('0x88')]=_0x24644d;if(_0x24644d){var _0x271694={'ContactId':_0x24644d['id'],'OpenchannelAccountId':_0x26f4b9[_0x93f4('0x63')]['id'],'from':(_0x24644d['firstName']||'')+'\x20'+(_0x24644d['lastName']||'')};var _0x2d4bdd={'OpenchannelAccountId':_0x26f4b9[_0x93f4('0x63')]['id'],'closed':![]};if(_0x26f4b9[_0x93f4('0x5c')][_0x93f4('0x89')]){_0x2d4bdd[_0x93f4('0x89')]=_0x26f4b9['body']['threadId'];return db[_0x93f4('0x8a')][_0x93f4('0x5a')]({'where':_0x2d4bdd})['then'](function(_0x371e4f){if(_0x371e4f){return[_0x371e4f,![]];}_0x271694['threadId']=_0x26f4b9[_0x93f4('0x5c')][_0x93f4('0x89')];_0x271694[_0x93f4('0x8b')]=_0x26f4b9[_0x93f4('0x5c')][_0x93f4('0x8b')];return db[_0x93f4('0x8a')][_0x93f4('0x5b')](_0x271694)['then'](function(_0x2c0146){return[_0x2c0146,!![]];});});}else{_0x2d4bdd[_0x93f4('0x89')]=null;}_0x2d4bdd[_0x93f4('0x8c')]=_0x24644d['id'];return db[_0x93f4('0x8a')][_0x93f4('0x5a')]({'where':_0x2d4bdd})[_0x93f4('0x20')](function(_0x22386b){if(_0x22386b){return[_0x22386b,![]];}return db[_0x93f4('0x8a')][_0x93f4('0x5b')](_0x271694)[_0x93f4('0x20')](function(_0x4966b1){return[_0x4966b1,!![]];});});}})[_0x93f4('0x8d')](function(_0x5e21f9,_0x571f70){if(_0x5e21f9){_0x27e7a4=_0x571f70;if(!_0x571f70){var _0x22bc2d={'from':(_0x103659[_0x93f4('0x88')]['firstName']||'')+'\x20'+(_0x103659['contact'][_0x93f4('0x8e')]||'')};if(_0x26f4b9['body'][_0x93f4('0x89')]&&_0x26f4b9['body']['messageId']&&_0x26f4b9[_0x93f4('0x5c')][_0x93f4('0x89')]!=_0x26f4b9[_0x93f4('0x5c')][_0x93f4('0x8f')]){_0x22bc2d[_0x93f4('0x89')]=_0x26f4b9[_0x93f4('0x5c')][_0x93f4('0x8f')];}return _0x5e21f9['update'](_0x22bc2d);}else{return _0x5e21f9;}}})['then'](function(_0x1e08e4){_0x103659['interaction']=_0x1e08e4[_0x93f4('0x36')]({'plain':!![]});_0x103659[_0x93f4('0x90')][_0x93f4('0x91')]=_0x27e7a4;if(_0x103659['interaction'][_0x93f4('0x91')]){if(_0x103659[_0x93f4('0x83')]['autoclose']){_0x103659[_0x93f4('0x84')][_0x93f4('0x92')]({'id':0x0,'priority':_0x103659[_0x93f4('0x84')][_0x93f4('0x4b')]+0x1,'app':'close','appdata':_0x93f4('0x93'),'interval':_0x93f4('0x94')});}}return db['OpenchannelMessage'][_0x93f4('0x5b')]({'body':_0x26f4b9['body'][_0x93f4('0x5c')],'OpenchannelAccountId':_0x26f4b9['params']['id'],'OpenchannelInteractionId':_0x1e08e4['id'],'direction':'in','ContactId':_0x103659[_0x93f4('0x88')]['id'],'AttachmentId':_0x26f4b9['body'][_0x93f4('0x95')]});})[_0x93f4('0x20')](function(_0x5ca3b3){_0x103659[_0x93f4('0x27')]=_0x5ca3b3;if(!_0x103659[_0x93f4('0x90')][_0x93f4('0x96')])return;return db[_0x93f4('0x97')]['find']({'attributes':['id','name'],'where':{'id':_0x103659[_0x93f4('0x90')]['UserId']}});})[_0x93f4('0x20')](function(_0x53d62f){if(_0x53d62f){_0x103659[_0x93f4('0x84')][_0x93f4('0x98')]({'id':0x0,'priority':0x0,'app':_0x93f4('0x99'),'appdata':_0x53d62f[_0x93f4('0x3b')]+','+(_0x103659[_0x93f4('0x83')][_0x93f4('0x9a')]||0xa),'interval':_0x93f4('0x94')});_0x103659[_0x93f4('0x9b')]=!![];}if(!_0x103659['interaction'][_0x93f4('0x9c')])return;return db[_0x93f4('0x9d')][_0x93f4('0x5a')]({'attributes':['id',_0x93f4('0x3b')],'where':{'id':_0x103659[_0x93f4('0x90')][_0x93f4('0x9c')]}});})[_0x93f4('0x20')](function(_0x180e64){if(_0x180e64){_0x103659['applications'][_0x93f4('0x98')]({'id':0x0,'priority':0x1,'app':_0x93f4('0x9e'),'appdata':_0x180e64['name']+','+(_0x103659[_0x93f4('0x83')]['waitForTheAssignedQueue']||0x12c),'interval':_0x93f4('0x94')});}return respondWithRpcPromise(_0x93f4('0x9f'),_0x93f4('0xa0'),_0x103659);})[_0x93f4('0x20')](function(_0x1f906a){respondWithRpcPromise(_0x93f4('0xa1'),'EventManager',{'event':_0x93f4('0xa2'),'message':_0x1f906a},client9002);return _0x1f906a;})['then'](respondWithResult(_0x5da8de,null))['catch'](handleError(_0x5da8de,null));};exports[_0x93f4('0xa3')]=function(_0x4cce85,_0x4880e9){var _0x5c4ed6=_0x4cce85[_0x93f4('0x63')]['id'];var _0x55c839=_0x4cce85[_0x93f4('0x5c')];var _0x511a70=0xc8;var _0x310465=null;return db[_0x93f4('0xa4')][_0x93f4('0xa5')]({'isolationLevel':db[_0x93f4('0xa4')][_0x93f4('0xa6')][_0x93f4('0xa7')][_0x93f4('0xa8')]},function(_0xb58149){return db[_0x93f4('0x41')]['findOne']({'where':{'id':_0x5c4ed6},'transaction':_0xb58149})[_0x93f4('0x20')](function(_0x3730fd){if(_0x3730fd){return db[_0x93f4('0x81')]['destroy']({'where':{'OpenchannelAccountId':_0x5c4ed6},'transaction':_0xb58149})[_0x93f4('0x20')](function(){var _0x22ac9a=_[_0x93f4('0x40')](_0x55c839,function(_0x31873e){_0x31873e['OpenchannelAccountId']=_0x5c4ed6;return _0x31873e;});return db['OpenchannelApplication'][_0x93f4('0xa9')](_0x22ac9a,{'transaction':_0xb58149});});}else{_0x511a70=0x194;_0x310465=[];}});})[_0x93f4('0x20')](function(){if(_0x511a70!==0x194){return db[_0x93f4('0x81')]['findAndCountAll']({'where':{'OpenchannelAccountId':_0x5c4ed6},'order':_0x93f4('0x87')})[_0x93f4('0x20')](function(_0x3b2467){_0x310465=_0x3b2467;});}})[_0x93f4('0x28')](function(_0x39fd16){_0x511a70=0x1f4;logger[_0x93f4('0x24')](_0x39fd16[_0x93f4('0x3a')]);if(_0x39fd16['name']){delete _0x39fd16['name'];}_0x310465=_0x39fd16;})[_0x93f4('0xaa')](function(){if(_0x310465===null){_0x4880e9['sendStatus'](_0x511a70);}else{if(_0x511a70===0x1f4){_0x4880e9[_0x93f4('0x2a')](_0x511a70)['send'](_0x310465);}else{_0x4880e9[_0x93f4('0x2a')](_0x511a70)[_0x93f4('0x2c')](_0x310465);}}});};exports[_0x93f4('0xab')]=function(_0xeb064,_0x5beaee,_0x37647f){var _0x2cae36={};var _0x103b24={};var _0x247140;var _0x30666a;return db[_0x93f4('0x41')][_0x93f4('0x68')]({'where':{'id':_0xeb064[_0x93f4('0x63')]['id']}})[_0x93f4('0x20')](handleEntityNotFound(_0x5beaee,null))['then'](function(_0xe5937b){if(_0xe5937b){_0x247140=_0xe5937b;_0x103b24[_0x93f4('0x44')]=_[_0x93f4('0x45')](db[_0x93f4('0x81')][_0x93f4('0x42')]);_0x103b24[_0x93f4('0x46')]=_[_0x93f4('0x45')](_0xeb064[_0x93f4('0x46')]);_0x103b24[_0x93f4('0x47')]=_[_0x93f4('0x48')](_0x103b24['model'],_0x103b24[_0x93f4('0x46')]);_0x2cae36[_0x93f4('0x49')]=_[_0x93f4('0x48')](_0x103b24[_0x93f4('0x44')],qs[_0x93f4('0x4a')](_0xeb064[_0x93f4('0x46')][_0x93f4('0x4a')]));_0x2cae36[_0x93f4('0x49')]=_0x2cae36[_0x93f4('0x49')][_0x93f4('0x4b')]?_0x2cae36[_0x93f4('0x49')]:_0x103b24[_0x93f4('0x44')];_0x2cae36[_0x93f4('0x4e')]=qs[_0x93f4('0x4f')](_0xeb064[_0x93f4('0x46')][_0x93f4('0x4f')]);_0x2cae36[_0x93f4('0x50')]=qs['filters'](_['pick'](_0xeb064[_0x93f4('0x46')],_0x103b24[_0x93f4('0x47')]));if(_0xeb064['query']['filter']){_0x2cae36['where']=_[_0x93f4('0x53')](_0x2cae36[_0x93f4('0x50')],{'$or':_[_0x93f4('0x40')](_0x2cae36[_0x93f4('0x49')],function(_0x5dcc4f){var _0x4a5161={};_0x4a5161[_0x5dcc4f]={'$like':'%'+_0xeb064[_0x93f4('0x46')][_0x93f4('0x52')]+'%'};return _0x4a5161;})});}_0x2cae36=_['merge']({},_0x2cae36,_0xeb064[_0x93f4('0xac')]);return _0x247140[_0x93f4('0xab')](_0x2cae36);}})[_0x93f4('0x20')](function(_0x549e8d){if(_0x549e8d){_0x30666a=_0x549e8d['length'];if(!_0xeb064[_0x93f4('0x46')][_0x93f4('0x4c')](_0x93f4('0x4d'))){_0x2cae36[_0x93f4('0x2e')]=qs['limit'](_0xeb064[_0x93f4('0x46')][_0x93f4('0x2e')]);_0x2cae36[_0x93f4('0x2d')]=qs[_0x93f4('0x2d')](_0xeb064[_0x93f4('0x46')][_0x93f4('0x2d')]);}return _0x247140[_0x93f4('0xab')](_0x2cae36);}})[_0x93f4('0x20')](function(_0x5e2528){if(_0x5e2528){return _0x5e2528?{'count':_0x30666a,'rows':_0x5e2528}:null;}})[_0x93f4('0x20')](respondWithResult(_0x5beaee,null))[_0x93f4('0x28')](handleError(_0x5beaee,null));};exports['getInteractions']=function(_0x293478,_0xe0e17d,_0x228d3a){var _0x53069c={'raw':![],'where':{}};var _0x5a3f6c={};var _0xe0d07d={'count':0x0,'rows':[]};return db[_0x93f4('0x41')][_0x93f4('0x68')]({'where':{'id':_0x293478[_0x93f4('0x63')]['id']}})[_0x93f4('0x20')](handleEntityNotFound(_0xe0e17d,null))[_0x93f4('0x20')](function(_0x3c9438){if(_0x3c9438){_0x5a3f6c[_0x93f4('0x44')]=_[_0x93f4('0x45')](db[_0x93f4('0x8a')][_0x93f4('0x42')]);_0x5a3f6c[_0x93f4('0x46')]=_[_0x93f4('0x45')](_0x293478[_0x93f4('0x46')]);_0x5a3f6c['filters']=_[_0x93f4('0x48')](_0x5a3f6c['model'],_0x5a3f6c['query']);_0x53069c['attributes']=_[_0x93f4('0x48')](_0x5a3f6c[_0x93f4('0x44')],qs[_0x93f4('0x4a')](_0x293478[_0x93f4('0x46')][_0x93f4('0x4a')]));_0x53069c[_0x93f4('0x49')]=_0x53069c[_0x93f4('0x49')][_0x93f4('0x4b')]?_0x53069c[_0x93f4('0x49')]:_0x5a3f6c[_0x93f4('0x44')];if(!_0x293478[_0x93f4('0x46')]['hasOwnProperty'](_0x93f4('0x4d'))){_0x53069c[_0x93f4('0x2e')]=qs[_0x93f4('0x2e')](_0x293478['query'][_0x93f4('0x2e')]);_0x53069c['offset']=qs['offset'](_0x293478['query'][_0x93f4('0x2d')]);}_0x53069c['order']=qs[_0x93f4('0x4f')](_0x293478[_0x93f4('0x46')][_0x93f4('0x4f')]);_0x53069c[_0x93f4('0x50')]=qs['filters'](_['pick'](_0x293478[_0x93f4('0x46')],_0x5a3f6c['filters']));_0x53069c[_0x93f4('0x50')][_0x93f4('0x65')]=_0x3c9438['id'];if(_0x293478[_0x93f4('0x46')][_0x93f4('0x52')]){_0x53069c['where']=_[_0x93f4('0x53')](_0x53069c['where'],{'$or':_[_0x93f4('0x40')](_0x53069c[_0x93f4('0x49')],function(_0x348f96){var _0x25f4fc={};_0x25f4fc[_0x348f96]={'$like':'%'+_0x293478['query']['filter']+'%'};return _0x25f4fc;})});}_0x53069c=_[_0x93f4('0x53')]({},_0x53069c,_0x293478[_0x93f4('0xac')]);return db[_0x93f4('0x8a')][_0x93f4('0x56')]({'where':_0x53069c[_0x93f4('0x50')]})[_0x93f4('0x20')](function(_0x346960){_0xe0d07d[_0x93f4('0x56')]=_0x346960;if(_0x293478[_0x93f4('0x46')][_0x93f4('0x69')]){_0x53069c[_0x93f4('0x57')]=[{'model':db['CmContact'],'as':_0x93f4('0xad'),'required':![]},{'model':db[_0x93f4('0x97')],'as':_0x93f4('0xae'),'attributes':['name',_0x93f4('0xaf'),_0x93f4('0xb0')],'required':![]},{'model':db[_0x93f4('0xb1')],'as':'Tags','attributes':['id',_0x93f4('0x3b'),_0x93f4('0xb2')],'where':_0x293478[_0x93f4('0x46')][_0x93f4('0xb3')]?{'id':_0x293478[_0x93f4('0x46')][_0x93f4('0xb3')]}:undefined,'required':_0x293478[_0x93f4('0x46')][_0x93f4('0xb3')]?!![]:![]}];}return db[_0x93f4('0x8a')][_0x93f4('0x58')](_0x53069c);})['then'](function(_0xc222bd){_0xe0d07d['rows']=_0xc222bd;return _0xe0d07d;});}})['then'](respondWithFilteredResult(_0xe0e17d,_0x53069c))['catch'](handleError(_0xe0e17d,null));};exports[_0x93f4('0xb4')]=function(_0x5d5ea3,_0x52a7d4,_0x383bd2){return db['OpenchannelAccount'][_0x93f4('0x5a')]({'where':{'id':_0x5d5ea3[_0x93f4('0x63')]['id']}})[_0x93f4('0x20')](handleEntityNotFound(_0x52a7d4,null))[_0x93f4('0x20')](function(_0x3fc0f4){if(_0x3fc0f4){return _0x3fc0f4[_0x93f4('0xb4')](_0x5d5ea3['body'][_0x93f4('0xb5')],_['omit'](_0x5d5ea3[_0x93f4('0x5c')],[_0x93f4('0xb5'),'id'])||{})['spread'](function(_0x2a3573){for(var _0x89b47=0x0;_0x89b47<_0x5d5ea3[_0x93f4('0x5c')]['ids']['length'];_0x89b47+=0x1){socket[_0x93f4('0xb6')](_0x93f4('0xb7'),{'UserId':Number(_0x5d5ea3[_0x93f4('0x5c')][_0x93f4('0xb5')][_0x89b47]),'OpenchannelAccountId':Number(_0x5d5ea3[_0x93f4('0x63')]['id'])});}return _0x2a3573;});}})['then'](respondWithResult(_0x52a7d4,null))[_0x93f4('0x28')](handleError(_0x52a7d4,null));};exports[_0x93f4('0xb8')]=function(_0x94d634,_0x108cf1,_0x4d0505){return db['OpenchannelAccount'][_0x93f4('0x5a')]({'where':{'id':_0x94d634[_0x93f4('0x63')]['id']}})['then'](handleEntityNotFound(_0x108cf1,null))['then'](function(_0x13a99f){if(_0x13a99f){return _0x13a99f[_0x93f4('0xb8')](_0x94d634['query'][_0x93f4('0xb5')])[_0x93f4('0x20')](function(){if(_[_0x93f4('0xb9')](_0x94d634[_0x93f4('0x46')][_0x93f4('0xb5')])){for(var _0x1c74e3=0x0;_0x1c74e3<_0x94d634[_0x93f4('0x46')][_0x93f4('0xb5')][_0x93f4('0x4b')];_0x1c74e3+=0x1){socket[_0x93f4('0xb6')](_0x93f4('0xba'),{'UserId':Number(_0x94d634[_0x93f4('0x46')]['ids'][_0x1c74e3]),'OpenchannelAccountId':Number(_0x94d634['params']['id'])});}}else{socket[_0x93f4('0xb6')](_0x93f4('0xba'),{'UserId':Number(_0x94d634[_0x93f4('0x46')][_0x93f4('0xb5')]),'OpenchannelAccountId':Number(_0x94d634[_0x93f4('0x63')]['id'])});}});}})[_0x93f4('0x20')](respondWithStatusCode(_0x108cf1,null))['catch'](handleError(_0x108cf1,null));};exports[_0x93f4('0xbb')]=function(_0x464e75,_0x55ea66,_0x162294){var _0x3d9f30={};var _0x4464da={};var _0x517ed9;var _0x14cfe3;return db[_0x93f4('0x41')]['findOne']({'where':{'id':_0x464e75[_0x93f4('0x63')]['id']}})[_0x93f4('0x20')](handleEntityNotFound(_0x55ea66,null))['then'](function(_0x4c3c54){if(_0x4c3c54){_0x517ed9=_0x4c3c54;_0x4464da[_0x93f4('0x44')]=_[_0x93f4('0x45')](db[_0x93f4('0x97')]['rawAttributes']);_0x4464da[_0x93f4('0x46')]=_['keys'](_0x464e75[_0x93f4('0x46')]);_0x4464da[_0x93f4('0x47')]=_[_0x93f4('0x48')](_0x4464da['model'],_0x4464da[_0x93f4('0x46')]);_0x3d9f30[_0x93f4('0x49')]=_[_0x93f4('0x48')](_0x4464da[_0x93f4('0x44')],qs[_0x93f4('0x4a')](_0x464e75[_0x93f4('0x46')][_0x93f4('0x4a')]));_0x3d9f30[_0x93f4('0x49')]=_0x3d9f30['attributes']['length']?_0x3d9f30[_0x93f4('0x49')]:_0x4464da[_0x93f4('0x44')];_0x3d9f30[_0x93f4('0x4e')]=qs[_0x93f4('0x4f')](_0x464e75['query'][_0x93f4('0x4f')]);_0x3d9f30['where']=qs['filters'](_[_0x93f4('0x51')](_0x464e75[_0x93f4('0x46')],_0x4464da[_0x93f4('0x47')]));if(_0x464e75[_0x93f4('0x46')][_0x93f4('0x52')]){_0x3d9f30[_0x93f4('0x50')]=_[_0x93f4('0x53')](_0x3d9f30[_0x93f4('0x50')],{'$or':_[_0x93f4('0x40')](_0x3d9f30[_0x93f4('0x49')],function(_0x14681a){var _0x9d6e78={};_0x9d6e78[_0x14681a]={'$like':'%'+_0x464e75[_0x93f4('0x46')]['filter']+'%'};return _0x9d6e78;})});}_0x3d9f30=_[_0x93f4('0x53')]({},_0x3d9f30,_0x464e75[_0x93f4('0xac')]);return _0x517ed9[_0x93f4('0xbb')](_0x3d9f30);}})['then'](function(_0x44c395){if(_0x44c395){_0x14cfe3=_0x44c395[_0x93f4('0x4b')];if(!_0x464e75['query'][_0x93f4('0x4c')](_0x93f4('0x4d'))){_0x3d9f30[_0x93f4('0x2e')]=qs[_0x93f4('0x2e')](_0x464e75[_0x93f4('0x46')]['limit']);_0x3d9f30[_0x93f4('0x2d')]=qs['offset'](_0x464e75[_0x93f4('0x46')][_0x93f4('0x2d')]);}return _0x517ed9[_0x93f4('0xbb')](_0x3d9f30);}})['then'](function(_0x33fbb6){if(_0x33fbb6){return _0x33fbb6?{'count':_0x14cfe3,'rows':_0x33fbb6}:null;}})[_0x93f4('0x20')](respondWithResult(_0x55ea66,null))['catch'](handleError(_0x55ea66,null));};exports[_0x93f4('0x3c')]=function(_0x5cc00d,_0x45c833,_0x2bf232){var _0x3f66e0,_0x5b11e8,_0x5efd29;if(_[_0x93f4('0x76')](_0x5cc00d[_0x93f4('0x5c')][_0x93f4('0x5c')])||_0x5cc00d[_0x93f4('0x5c')][_0x93f4('0x5c')]===''){throw new db[(_0x93f4('0x78'))]['ValidationError'](_0x93f4('0x7a'));}if(_[_0x93f4('0x76')](_0x5cc00d[_0x93f4('0x5c')]['to'])){}_0x3f66e0=_0x5cc00d[_0x93f4('0x5c')]['to'];return db['OpenchannelAccount'][_0x93f4('0x68')]({'where':{'id':_0x5cc00d[_0x93f4('0x63')]['id']}})['then'](handleEntityNotFound(_0x45c833,null))['then'](function(_0x4d6f0e){if(_0x4d6f0e){return db['OpenchannelAccount'][_0x93f4('0x5a')]({'where':{'id':_0x4d6f0e['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0x93f4('0x70')],'as':_0x93f4('0x7f'),'where':{[_0x4d6f0e['mapKey']]:_0x3f66e0},'limit':0x1,'order':[[_0x93f4('0x74'),'DESC']]}]}]})['then'](handleEntityNotFound(_0x45c833,null))[_0x93f4('0x20')](function(_0x4d24aa){if(_0x4d24aa&&_0x4d24aa[_0x93f4('0x7e')]){_0x5b11e8=_0x4d24aa[_0x93f4('0x36')]({'plain':!![]});if(_0x5b11e8['List']&&_0x5b11e8[_0x93f4('0x7e')][_0x93f4('0x7f')][_0x93f4('0x4b')]){return _0x5b11e8[_0x93f4('0x7e')][_0x93f4('0x7f')][0x0];}return db[_0x93f4('0x70')]['create'](_['defaults'](_0x5cc00d[_0x93f4('0x5c')],{'firstName':_0x3f66e0,[_0x4d24aa[_0x93f4('0x7b')]]:_0x3f66e0,'phone':_0x3f66e0,'ListId':_0x5b11e8[_0x93f4('0x75')]}));}})[_0x93f4('0x20')](handleEntityNotFound(_0x45c833,null))['then'](function(_0x401383){if(_0x401383){_0x5efd29=_0x401383;return db['OpenchannelInteraction'][_0x93f4('0x5a')]({'where':{'ContactId':_0x5efd29['id'],'closed':![],'OpenchannelAccountId':_0x5b11e8['id']}})['then'](function(_0x35fae9){if(_0x35fae9){return[_0x35fae9,![]];}return db[_0x93f4('0x8a')][_0x93f4('0x5b')]({'UserId':_0x5cc00d[_0x93f4('0x5d')]['id'],'ContactId':_0x5efd29['id'],'OpenchannelAccountId':_0x5b11e8['id'],'lastMsgDirection':_0x93f4('0xbc'),'firstMsgDirection':'out','Messages':[_[_0x93f4('0x53')](_0x5cc00d[_0x93f4('0x5c')],{'read':![],'body':_0x5cc00d['body'][_0x93f4('0x5c')],'OpenchannelAccountId':_0x5b11e8['id'],'UserId':_0x5cc00d[_0x93f4('0x5d')]['id'],'ContactId':_0x5efd29['id']})]},{'include':[{'model':db[_0x93f4('0xbd')],'as':'Messages'}]})[_0x93f4('0x20')](function(_0x481352){return[_0x481352,!![]];});});}})[_0x93f4('0x8d')](function(_0x33083a,_0x200e10){if(_0x200e10){return _0x33083a;}return db[_0x93f4('0xbd')][_0x93f4('0x5b')](_['merge'](_0x5cc00d[_0x93f4('0x5c')],{'read':![],'body':_0x5cc00d[_0x93f4('0x5c')][_0x93f4('0x5c')],'OpenchannelAccountId':_0x5b11e8['id'],'OpenchannelInteractionId':_0x33083a['id'],'UserId':_0x5cc00d[_0x93f4('0x5d')]['id'],'ContactId':_0x5efd29['id']}))[_0x93f4('0x20')](function(_0x415340){_0x33083a[_0x93f4('0xbe')]['Messages']=[];_0x33083a[_0x93f4('0xbe')][_0x93f4('0xbf')][_0x93f4('0x92')](_0x415340[_0x93f4('0xbe')]);return _0x33083a;});});}})['then'](respondWithResult(_0x45c833,null))[_0x93f4('0x28')](handleError(_0x45c833,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index 111607b..e604751 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 _0xb688=['../../mysqldb','OpenchannelAccount','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports'];(function(_0x16972f,_0x24951d){var _0x3e2509=function(_0x52339a){while(--_0x52339a){_0x16972f['push'](_0x16972f['shift']());}};_0x3e2509(++_0x24951d);}(_0xb688,0xcf));var _0x8b68=function(_0x50f476,_0x477175){_0x50f476=_0x50f476-0x0;var _0x1eff39=_0xb688[_0x50f476];return _0x1eff39;};'use strict';var EventEmitter=require('events');var OpenchannelAccount=require(_0x8b68('0x0'))['db'][_0x8b68('0x1')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x8b68('0x2')](0x0);var events={'afterCreate':_0x8b68('0x3'),'afterUpdate':_0x8b68('0x4'),'afterDestroy':_0x8b68('0x5')};function emitEvent(_0x4e281c){return function(_0x41030e,_0x27925d,_0x30f33d){OpenchannelAccountEvents[_0x8b68('0x6')](_0x4e281c+':'+_0x41030e['id'],_0x41030e);OpenchannelAccountEvents['emit'](_0x4e281c,_0x41030e);_0x30f33d(null);};}for(var e in events){if(events[_0x8b68('0x7')](e)){var event=events[e];OpenchannelAccount['hook'](e,emitEvent(event));}}module[_0x8b68('0x8')]=OpenchannelAccountEvents; \ No newline at end of file +var _0x22fb=['hook','exports','OpenchannelAccount','save','update','remove','emit','hasOwnProperty'];(function(_0x2211ed,_0x1bca0b){var _0x4d78cc=function(_0x467b59){while(--_0x467b59){_0x2211ed['push'](_0x2211ed['shift']());}};_0x4d78cc(++_0x1bca0b);}(_0x22fb,0x192));var _0xb22f=function(_0x14b762,_0x2f142e){_0x14b762=_0x14b762-0x0;var _0x58a31c=_0x22fb[_0x14b762];return _0x58a31c;};'use strict';var EventEmitter=require('events');var OpenchannelAccount=require('../../mysqldb')['db'][_0xb22f('0x0')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xb22f('0x1'),'afterUpdate':_0xb22f('0x2'),'afterDestroy':_0xb22f('0x3')};function emitEvent(_0x10d2c4){return function(_0x201512,_0x50cdab,_0x44717d){OpenchannelAccountEvents[_0xb22f('0x4')](_0x10d2c4+':'+_0x201512['id'],_0x201512);OpenchannelAccountEvents[_0xb22f('0x4')](_0x10d2c4,_0x201512);_0x44717d(null);};}for(var e in events){if(events[_0xb22f('0x5')](e)){var event=events[e];OpenchannelAccount[_0xb22f('0x6')](e,emitEvent(event));}}module[_0xb22f('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 9deeddf..4c051ae 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(_0x2749b0,_0x4c506e){var _0x57e273=function(_0x37a5b7){while(--_0x37a5b7){_0x2749b0['push'](_0x2749b0['shift']());}};_0x57e273(++_0x4c506e);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbe200f,_0x4b50eb){_0xbe200f=_0xbe200f-0x0;var _0x192597=_0xa9e0[_0xbe200f];return _0x192597;};'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(_0x463fb1,_0x536b2b){var _0x30ac77=function(_0x5c1e58){while(--_0x5c1e58){_0x463fb1['push'](_0x463fb1['shift']());}};_0x30ac77(++_0x536b2b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x387777,_0x356171){_0x387777=_0x387777-0x0;var _0x3f84c0=_0xa9e0[_0x387777];return _0x3f84c0;};'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 7632d48..3b0f907 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 _0x6ae2=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','register','request','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelAccount,\x20%s,\x20%s','message','info','result','catch'];(function(_0x60a491,_0x4d75c3){var _0x221290=function(_0x11e829){while(--_0x11e829){_0x60a491['push'](_0x60a491['shift']());}};_0x221290(++_0x4d75c3);}(_0x6ae2,0x1ed));var _0x26ae=function(_0xca9703,_0x5203b3){_0xca9703=_0xca9703-0x0;var _0x55386d=_0x6ae2[_0xca9703];return _0x55386d;};'use strict';var _=require(_0x26ae('0x0'));var util=require(_0x26ae('0x1'));var moment=require(_0x26ae('0x2'));var BPromise=require(_0x26ae('0x3'));var rs=require(_0x26ae('0x4'));var fs=require('fs');var Redis=require(_0x26ae('0x5'));var db=require(_0x26ae('0x6'))['db'];var utils=require(_0x26ae('0x7'));var logger=require(_0x26ae('0x8'))('rpc');var config=require(_0x26ae('0x9'));var jayson=require(_0x26ae('0xa'));var client=jayson['client']['http']({'port':0x232a});config[_0x26ae('0xb')]=_[_0x26ae('0xc')](config[_0x26ae('0xb')],{'host':_0x26ae('0xd'),'port':0x18eb});var socket=require(_0x26ae('0xe'))(new Redis(config[_0x26ae('0xb')]));require(_0x26ae('0xf'))[_0x26ae('0x10')](socket);function respondWithRpcPromise(_0x3d165a,_0x18baac,_0x1f8dff){return new BPromise(function(_0x4061ad,_0x5b2c57){return client[_0x26ae('0x11')](_0x3d165a,_0x1f8dff)['then'](function(_0x3a3db9){logger['info']('OpenchannelAccount,\x20%s,\x20%s',_0x18baac,_0x26ae('0x12'));logger[_0x26ae('0x13')](_0x26ae('0x14'),_0x18baac,_0x26ae('0x12'),JSON[_0x26ae('0x15')](_0x3a3db9));if(_0x3a3db9[_0x26ae('0x16')]){if(_0x3a3db9[_0x26ae('0x16')][_0x26ae('0x17')]===0x1f4){logger[_0x26ae('0x16')](_0x26ae('0x18'),_0x18baac,_0x3a3db9[_0x26ae('0x16')][_0x26ae('0x19')]);return _0x5b2c57(_0x3a3db9['error'][_0x26ae('0x19')]);}logger[_0x26ae('0x16')]('OpenchannelAccount,\x20%s,\x20%s',_0x18baac,_0x3a3db9[_0x26ae('0x16')][_0x26ae('0x19')]);return _0x4061ad(_0x3a3db9[_0x26ae('0x16')][_0x26ae('0x19')]);}else{logger[_0x26ae('0x1a')](_0x26ae('0x18'),_0x18baac,_0x26ae('0x12'));_0x4061ad(_0x3a3db9[_0x26ae('0x1b')][_0x26ae('0x19')]);}})[_0x26ae('0x1c')](function(_0x1e5cf5){logger[_0x26ae('0x16')](_0x26ae('0x18'),_0x18baac,_0x1e5cf5);_0x5b2c57(_0x1e5cf5);});});} \ No newline at end of file +var _0x263f=['../../config/utils','../../config/logger','rpc','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./openchannelAccount.socket','register','then','info','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','OpenchannelAccount,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x263f,0x182));var _0xf263=function(_0x3c7e9d,_0x204c2e){_0x3c7e9d=_0x3c7e9d-0x0;var _0xca738c=_0x263f[_0x3c7e9d];return _0xca738c;};'use strict';var _=require(_0xf263('0x0'));var util=require(_0xf263('0x1'));var moment=require(_0xf263('0x2'));var BPromise=require(_0xf263('0x3'));var rs=require(_0xf263('0x4'));var fs=require('fs');var Redis=require(_0xf263('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xf263('0x6'));var logger=require(_0xf263('0x7'))(_0xf263('0x8'));var config=require('../../config/environment');var jayson=require(_0xf263('0x9'));var client=jayson[_0xf263('0xa')]['http']({'port':0x232a});config['redis']=_[_0xf263('0xb')](config[_0xf263('0xc')],{'host':_0xf263('0xd'),'port':0x18eb});var socket=require(_0xf263('0xe'))(new Redis(config['redis']));require(_0xf263('0xf'))[_0xf263('0x10')](socket);function respondWithRpcPromise(_0x3d8092,_0x34c634,_0xb9fb31){return new BPromise(function(_0x4fc090,_0x1e9057){return client['request'](_0x3d8092,_0xb9fb31)[_0xf263('0x11')](function(_0x48e586){logger[_0xf263('0x12')]('OpenchannelAccount,\x20%s,\x20%s',_0x34c634,'request\x20sent');logger[_0xf263('0x13')](_0xf263('0x14'),_0x34c634,_0xf263('0x15'),JSON[_0xf263('0x16')](_0x48e586));if(_0x48e586[_0xf263('0x17')]){if(_0x48e586[_0xf263('0x17')][_0xf263('0x18')]===0x1f4){logger['error'](_0xf263('0x19'),_0x34c634,_0x48e586['error'][_0xf263('0x1a')]);return _0x1e9057(_0x48e586[_0xf263('0x17')][_0xf263('0x1a')]);}logger[_0xf263('0x17')](_0xf263('0x19'),_0x34c634,_0x48e586[_0xf263('0x17')][_0xf263('0x1a')]);return _0x4fc090(_0x48e586['error']['message']);}else{logger[_0xf263('0x12')](_0xf263('0x19'),_0x34c634,_0xf263('0x15'));_0x4fc090(_0x48e586[_0xf263('0x1b')][_0xf263('0x1a')]);}})['catch'](function(_0x1adb66){logger['error'](_0xf263('0x19'),_0x34c634,_0x1adb66);_0x1e9057(_0x1adb66);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 8518ee1..48c1ea1 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 _0x340c=['update','emit','removeListener','register','openchannelAccount:','./openchannelAccount.events','save','remove'];(function(_0x5b3a35,_0x312e9b){var _0x4383df=function(_0x1fd2d8){while(--_0x1fd2d8){_0x5b3a35['push'](_0x5b3a35['shift']());}};_0x4383df(++_0x312e9b);}(_0x340c,0xe5));var _0xc340=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x340c[_0x3dd15e];return _0x231fd0;};'use strict';var OpenchannelAccountEvents=require(_0xc340('0x0'));var events=[_0xc340('0x1'),_0xc340('0x2'),_0xc340('0x3')];function createListener(_0x5b80c5,_0x44a3d4){return function(_0x13c907){_0x44a3d4[_0xc340('0x4')](_0x5b80c5,_0x13c907);};}function removeListener(_0x43c651,_0x577d30){return function(){OpenchannelAccountEvents[_0xc340('0x5')](_0x43c651,_0x577d30);};}exports[_0xc340('0x6')]=function(_0x337a1f){for(var _0xb55d36=0x0,_0x35b8e6=events['length'];_0xb55d36<_0x35b8e6;_0xb55d36++){var _0x4c33db=events[_0xb55d36];var _0x59a213=createListener(_0xc340('0x7')+_0x4c33db,_0x337a1f);OpenchannelAccountEvents['on'](_0x4c33db,_0x59a213);}}; \ No newline at end of file +var _0xd246=['update','emit','register','length','openchannelAccount:','./openchannelAccount.events','save','remove'];(function(_0x24575e,_0x149c95){var _0x553e44=function(_0x1ba28c){while(--_0x1ba28c){_0x24575e['push'](_0x24575e['shift']());}};_0x553e44(++_0x149c95);}(_0xd246,0xf5));var _0x6d24=function(_0xe5530b,_0x4477ea){_0xe5530b=_0xe5530b-0x0;var _0x549c66=_0xd246[_0xe5530b];return _0x549c66;};'use strict';var OpenchannelAccountEvents=require(_0x6d24('0x0'));var events=[_0x6d24('0x1'),_0x6d24('0x2'),_0x6d24('0x3')];function createListener(_0x3e2217,_0x20310f){return function(_0x1d0589){_0x20310f[_0x6d24('0x4')](_0x3e2217,_0x1d0589);};}function removeListener(_0x4e76e1,_0xfa68f3){return function(){OpenchannelAccountEvents['removeListener'](_0x4e76e1,_0xfa68f3);};}exports[_0x6d24('0x5')]=function(_0x536c95){for(var _0xa72e6e=0x0,_0x7f6dfa=events[_0x6d24('0x6')];_0xa72e6e<_0x7f6dfa;_0xa72e6e++){var _0x358a65=events[_0xa72e6e];var _0x38e1eb=createListener(_0x6d24('0x7')+_0x358a65,_0x536c95);OpenchannelAccountEvents['on'](_0x358a65,_0x38e1eb);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index 12aac18..28ae3c8 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 _0xa896=['destroy','exports','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','isAuthenticated','index','/:id','show','create','put','update','delete'];(function(_0xf71120,_0x25b7f9){var _0xbe2fd3=function(_0x1acbdd){while(--_0x1acbdd){_0xf71120['push'](_0xf71120['shift']());}};_0xbe2fd3(++_0x25b7f9);}(_0xa896,0x1b2));var _0x6a89=function(_0x105321,_0x289894){_0x105321=_0x105321-0x0;var _0x5a14ce=_0xa896[_0x105321];return _0x5a14ce;};'use strict';var multer=require('multer');var util=require(_0x6a89('0x0'));var path=require(_0x6a89('0x1'));var timeout=require(_0x6a89('0x2'));var express=require(_0x6a89('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x6a89('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x6a89('0x5'));var controller=require('./openchannelApplication.controller');router['get']('/',auth[_0x6a89('0x6')](),controller[_0x6a89('0x7')]);router['get'](_0x6a89('0x8'),auth[_0x6a89('0x6')](),controller[_0x6a89('0x9')]);router['post']('/',auth[_0x6a89('0x6')](),controller[_0x6a89('0xa')]);router[_0x6a89('0xb')](_0x6a89('0x8'),auth[_0x6a89('0x6')](),controller[_0x6a89('0xc')]);router[_0x6a89('0xd')](_0x6a89('0x8'),auth[_0x6a89('0x6')](),controller[_0x6a89('0xe')]);module[_0x6a89('0xf')]=router; \ No newline at end of file +var _0xaa95=['fs-extra','../../config/environment','./openchannelApplication.controller','/:id','isAuthenticated','show','post','create','put','delete','exports','multer','util'];(function(_0x2235bf,_0x3a06a7){var _0x4c3a64=function(_0x3b3bb6){while(--_0x3b3bb6){_0x2235bf['push'](_0x2235bf['shift']());}};_0x4c3a64(++_0x3a06a7);}(_0xaa95,0x177));var _0x5aa9=function(_0x486dd7,_0xd6a844){_0x486dd7=_0x486dd7-0x0;var _0x4b2f33=_0xaa95[_0x486dd7];return _0x4b2f33;};'use strict';var multer=require(_0x5aa9('0x0'));var util=require(_0x5aa9('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x5aa9('0x2'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x5aa9('0x3'));var controller=require(_0x5aa9('0x4'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x5aa9('0x5'),auth[_0x5aa9('0x6')](),controller[_0x5aa9('0x7')]);router[_0x5aa9('0x8')]('/',auth[_0x5aa9('0x6')](),controller[_0x5aa9('0x9')]);router[_0x5aa9('0xa')]('/:id',auth[_0x5aa9('0x6')](),controller['update']);router[_0x5aa9('0xb')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x5aa9('0xc')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index 7b0d804..d4de2fb 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 _0x8848=['STRING','noop','TEXT','*,*,*,*','sequelize'];(function(_0x28888e,_0x291aae){var _0x120907=function(_0x41bcd0){while(--_0x41bcd0){_0x28888e['push'](_0x28888e['shift']());}};_0x120907(++_0x291aae);}(_0x8848,0x1b2));var _0x8884=function(_0x725b8e,_0xc22b48){_0x725b8e=_0x725b8e-0x0;var _0x43ac45=_0x8848[_0x725b8e];return _0x43ac45;};'use strict';var Sequelize=require(_0x8884('0x0'));module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x8884('0x1')],'allowNull':![],'defaultValue':_0x8884('0x2')},'appdata':{'type':Sequelize[_0x8884('0x3')]()},'description':{'type':Sequelize[_0x8884('0x1')]},'interval':{'type':Sequelize[_0x8884('0x1')],'defaultValue':_0x8884('0x4')}}; \ No newline at end of file +var _0x472a=['STRING','noop','*,*,*,*','sequelize'];(function(_0x2fc012,_0x503e5b){var _0x2891f9=function(_0x295f5e){while(--_0x295f5e){_0x2fc012['push'](_0x2fc012['shift']());}};_0x2891f9(++_0x503e5b);}(_0x472a,0x1d3));var _0xa472=function(_0x45c61e,_0x59694d){_0x45c61e=_0x45c61e-0x0;var _0x19033c=_0x472a[_0x45c61e];return _0x19033c;};'use strict';var Sequelize=require(_0xa472('0x0'));module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xa472('0x1')],'allowNull':![],'defaultValue':_0xa472('0x2')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xa472('0x1')]},'interval':{'type':Sequelize[_0xa472('0x1')],'defaultValue':_0xa472('0x3')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index e14d022..beb5294 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 _0xa412=['squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','end','error','name','send','map','OpenchannelApplication','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','options','include','findAll','rows','catch','params','rawAttributes','includeAll','find','create','body','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash'];(function(_0x565c49,_0x54acd0){var _0x20ca34=function(_0x42f7e1){while(--_0x42f7e1){_0x565c49['push'](_0x565c49['shift']());}};_0x20ca34(++_0x54acd0);}(_0xa412,0x124));var _0x2a41=function(_0x5a0987,_0x1037b6){_0x5a0987=_0x5a0987-0x0;var _0x75c06e=_0xa412[_0x5a0987];return _0x75c06e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2a41('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2a41('0x1'));var rp=require('request-promise');var moment=require(_0x2a41('0x2'));var BPromise=require(_0x2a41('0x3'));var Mustache=require(_0x2a41('0x4'));var util=require(_0x2a41('0x5'));var path=require(_0x2a41('0x6'));var sox=require(_0x2a41('0x7'));var csv=require(_0x2a41('0x8'));var ejs=require(_0x2a41('0x9'));var fs=require('fs');var fs_extra=require(_0x2a41('0xa'));var _=require(_0x2a41('0xb'));var squel=require(_0x2a41('0xc'));var crypto=require(_0x2a41('0xd'));var jsforce=require(_0x2a41('0xe'));var deskjs=require(_0x2a41('0xf'));var toCsv=require(_0x2a41('0x8'));var querystring=require(_0x2a41('0x10'));var Papa=require(_0x2a41('0x11'));var Redis=require('ioredis');var authService=require(_0x2a41('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x2a41('0x13'));var hardwareService=require(_0x2a41('0x14'));var logger=require(_0x2a41('0x15'))(_0x2a41('0x16'));var utils=require(_0x2a41('0x17'));var config=require(_0x2a41('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x2a41('0x19'))['db'];function respondWithStatusCode(_0x560b97,_0x2d3c98){_0x2d3c98=_0x2d3c98||0xcc;return function(_0x3b8f3a){if(_0x3b8f3a){return _0x560b97[_0x2a41('0x1a')](_0x2d3c98);}return _0x560b97[_0x2a41('0x1b')](_0x2d3c98)['end']();};}function respondWithResult(_0x235b4e,_0x4d34ca){_0x4d34ca=_0x4d34ca||0xc8;return function(_0x2f3e4c){if(_0x2f3e4c){return _0x235b4e[_0x2a41('0x1b')](_0x4d34ca)[_0x2a41('0x1c')](_0x2f3e4c);}};}function respondWithFilteredResult(_0x3e62a8,_0x6cc436){return function(_0x56ad14){if(_0x56ad14){var _0x3ebc64=typeof _0x6cc436[_0x2a41('0x1d')]==='undefined'&&typeof _0x6cc436[_0x2a41('0x1e')]===_0x2a41('0x1f');var _0x2f7e39=_0x56ad14[_0x2a41('0x20')];var _0x30627c=_0x3ebc64?0x0:_0x6cc436[_0x2a41('0x1d')];var _0x436f82=_0x3ebc64?_0x56ad14[_0x2a41('0x20')]:_0x6cc436[_0x2a41('0x1d')]+_0x6cc436[_0x2a41('0x1e')];var _0x48c414;if(_0x436f82>=_0x2f7e39){_0x436f82=_0x2f7e39;_0x48c414=0xc8;}else{_0x48c414=0xce;}_0x3e62a8['status'](_0x48c414);return _0x3e62a8[_0x2a41('0x21')](_0x2a41('0x22'),_0x30627c+'-'+_0x436f82+'/'+_0x2f7e39)['json'](_0x56ad14);}return null;};}function patchUpdates(_0x36ebf2){return function(_0x1ca740){try{jsonpatch[_0x2a41('0x23')](_0x1ca740,_0x36ebf2,!![]);}catch(_0x2d4ca7){return BPromise[_0x2a41('0x24')](_0x2d4ca7);}return _0x1ca740[_0x2a41('0x25')]();};}function saveUpdates(_0x130d69,_0x20ea30){return function(_0x12b404){if(_0x12b404){return _0x12b404[_0x2a41('0x26')](_0x130d69)[_0x2a41('0x27')](function(_0x37d4bb){return _0x37d4bb;});}return null;};}function removeEntity(_0x1335de,_0x3a8dc7){return function(_0x587109){if(_0x587109){return _0x587109[_0x2a41('0x28')]()[_0x2a41('0x27')](function(){_0x1335de[_0x2a41('0x1b')](0xcc)[_0x2a41('0x29')]();});}};}function handleEntityNotFound(_0x13e9e9,_0x348e8c){return function(_0x5d6be0){if(!_0x5d6be0){_0x13e9e9['sendStatus'](0x194);}return _0x5d6be0;};}function handleError(_0x4e5932,_0x3d4689){_0x3d4689=_0x3d4689||0x1f4;return function(_0x552956){logger[_0x2a41('0x2a')](_0x552956['stack']);if(_0x552956[_0x2a41('0x2b')]){delete _0x552956[_0x2a41('0x2b')];}_0x4e5932[_0x2a41('0x1b')](_0x3d4689)[_0x2a41('0x2c')](_0x552956);};}exports['index']=function(_0x46700d,_0x2e523c){var _0x28533b={},_0x2c1d0b={},_0xa436a4={'count':0x0,'rows':[]};var _0x30a61f=_[_0x2a41('0x2d')](db[_0x2a41('0x2e')]['rawAttributes'],function(_0x1cb411){return{'name':_0x1cb411[_0x2a41('0x2f')],'type':_0x1cb411[_0x2a41('0x30')][_0x2a41('0x31')]};});_0x2c1d0b[_0x2a41('0x32')]=_[_0x2a41('0x2d')](_0x30a61f,_0x2a41('0x2b'));_0x2c1d0b[_0x2a41('0x33')]=_[_0x2a41('0x34')](_0x46700d[_0x2a41('0x33')]);_0x2c1d0b[_0x2a41('0x35')]=_['intersection'](_0x2c1d0b[_0x2a41('0x32')],_0x2c1d0b[_0x2a41('0x33')]);_0x28533b[_0x2a41('0x36')]=_[_0x2a41('0x37')](_0x2c1d0b[_0x2a41('0x32')],qs['fields'](_0x46700d[_0x2a41('0x33')][_0x2a41('0x38')]));_0x28533b[_0x2a41('0x36')]=_0x28533b[_0x2a41('0x36')][_0x2a41('0x39')]?_0x28533b['attributes']:_0x2c1d0b[_0x2a41('0x32')];if(!_0x46700d[_0x2a41('0x33')][_0x2a41('0x3a')](_0x2a41('0x3b'))){_0x28533b['limit']=qs[_0x2a41('0x1e')](_0x46700d[_0x2a41('0x33')][_0x2a41('0x1e')]);_0x28533b[_0x2a41('0x1d')]=qs[_0x2a41('0x1d')](_0x46700d[_0x2a41('0x33')]['offset']);}_0x28533b[_0x2a41('0x3c')]=qs[_0x2a41('0x3d')](_0x46700d[_0x2a41('0x33')][_0x2a41('0x3d')]);_0x28533b['where']=qs[_0x2a41('0x35')](_[_0x2a41('0x3e')](_0x46700d[_0x2a41('0x33')],_0x2c1d0b[_0x2a41('0x35')]),_0x30a61f);if(_0x46700d[_0x2a41('0x33')]['filter']){_0x28533b[_0x2a41('0x3f')]=_[_0x2a41('0x40')](_0x28533b['where'],{'$or':_[_0x2a41('0x2d')](_0x30a61f,function(_0x1b0df2){if(_0x1b0df2[_0x2a41('0x30')]!=='VIRTUAL'){var _0x180582={};_0x180582[_0x1b0df2['name']]={'$like':'%'+_0x46700d[_0x2a41('0x33')]['filter']+'%'};return _0x180582;}})});}_0x28533b=_['merge']({},_0x28533b,_0x46700d[_0x2a41('0x41')]);var _0x5d10d2={'where':_0x28533b[_0x2a41('0x3f')]};return db['OpenchannelApplication']['count'](_0x5d10d2)[_0x2a41('0x27')](function(_0x5632d0){_0xa436a4['count']=_0x5632d0;if(_0x46700d['query']['includeAll']){_0x28533b[_0x2a41('0x42')]=[{'all':!![]}];}return db['OpenchannelApplication'][_0x2a41('0x43')](_0x28533b);})[_0x2a41('0x27')](function(_0xac1fe6){_0xa436a4[_0x2a41('0x44')]=_0xac1fe6;return _0xa436a4;})[_0x2a41('0x27')](respondWithFilteredResult(_0x2e523c,_0x28533b))[_0x2a41('0x45')](handleError(_0x2e523c,null));};exports['show']=function(_0x2780f4,_0x320df8){var _0x2f06c1={'raw':!![],'where':{'id':_0x2780f4[_0x2a41('0x46')]['id']}},_0x2af1d0={};_0x2af1d0[_0x2a41('0x32')]=_[_0x2a41('0x34')](db[_0x2a41('0x2e')][_0x2a41('0x47')]);_0x2af1d0[_0x2a41('0x33')]=_[_0x2a41('0x34')](_0x2780f4[_0x2a41('0x33')]);_0x2af1d0['filters']=_['intersection'](_0x2af1d0['model'],_0x2af1d0[_0x2a41('0x33')]);_0x2f06c1[_0x2a41('0x36')]=_[_0x2a41('0x37')](_0x2af1d0[_0x2a41('0x32')],qs[_0x2a41('0x38')](_0x2780f4[_0x2a41('0x33')][_0x2a41('0x38')]));_0x2f06c1['attributes']=_0x2f06c1[_0x2a41('0x36')][_0x2a41('0x39')]?_0x2f06c1['attributes']:_0x2af1d0[_0x2a41('0x32')];if(_0x2780f4[_0x2a41('0x33')][_0x2a41('0x48')]){_0x2f06c1['include']=[{'all':!![]}];}_0x2f06c1=_[_0x2a41('0x40')]({},_0x2f06c1,_0x2780f4['options']);return db[_0x2a41('0x2e')][_0x2a41('0x49')](_0x2f06c1)['then'](handleEntityNotFound(_0x320df8,null))[_0x2a41('0x27')](respondWithResult(_0x320df8,null))[_0x2a41('0x45')](handleError(_0x320df8,null));};exports['create']=function(_0x378dd9,_0x471341){return db[_0x2a41('0x2e')][_0x2a41('0x4a')](_0x378dd9['body'],{})['then'](respondWithResult(_0x471341,0xc9))['catch'](handleError(_0x471341,null));};exports[_0x2a41('0x26')]=function(_0x261e8f,_0x5076d6){if(_0x261e8f[_0x2a41('0x4b')]['id']){delete _0x261e8f[_0x2a41('0x4b')]['id'];}return db['OpenchannelApplication']['find']({'where':{'id':_0x261e8f[_0x2a41('0x46')]['id']}})[_0x2a41('0x27')](handleEntityNotFound(_0x5076d6,null))[_0x2a41('0x27')](saveUpdates(_0x261e8f[_0x2a41('0x4b')],null))[_0x2a41('0x27')](respondWithResult(_0x5076d6,null))[_0x2a41('0x45')](handleError(_0x5076d6,null));};exports['destroy']=function(_0x177379,_0x40d6dc){return db['OpenchannelApplication'][_0x2a41('0x49')]({'where':{'id':_0x177379['params']['id']}})['then'](handleEntityNotFound(_0x40d6dc,null))[_0x2a41('0x27')](removeEntity(_0x40d6dc,null))['catch'](handleError(_0x40d6dc,null));}; \ No newline at end of file +var _0x7584=['filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/environment','../../mysqldb','sendStatus','end','offset','undefined','limit','count','status','set','Content-Range','json','apply','reject','update','then','error','stack','name','send','index','map','OpenchannelApplication','rawAttributes','fieldName','type','key','query','keys'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x7584,0x142));var _0x4758=function(_0x44d11f,_0x14b429){_0x44d11f=_0x44d11f-0x0;var _0x4f3035=_0x7584[_0x44d11f];return _0x4f3035;};'use strict';var emlformat=require(_0x4758('0x0'));var rimraf=require(_0x4758('0x1'));var zipdir=require(_0x4758('0x2'));var jsonpatch=require(_0x4758('0x3'));var rp=require(_0x4758('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x4758('0x5'));var sox=require(_0x4758('0x6'));var csv=require(_0x4758('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4758('0x8'));var _=require(_0x4758('0x9'));var squel=require(_0x4758('0xa'));var crypto=require(_0x4758('0xb'));var jsforce=require(_0x4758('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x4758('0x7'));var querystring=require(_0x4758('0xd'));var Papa=require(_0x4758('0xe'));var Redis=require(_0x4758('0xf'));var authService=require(_0x4758('0x10'));var qs=require(_0x4758('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4758('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x4758('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x4758('0x14'))['db'];function respondWithStatusCode(_0x1ea0fd,_0x2d79b5){_0x2d79b5=_0x2d79b5||0xcc;return function(_0xcbcdb9){if(_0xcbcdb9){return _0x1ea0fd[_0x4758('0x15')](_0x2d79b5);}return _0x1ea0fd['status'](_0x2d79b5)[_0x4758('0x16')]();};}function respondWithResult(_0x4ffb4b,_0x406611){_0x406611=_0x406611||0xc8;return function(_0x2567fa){if(_0x2567fa){return _0x4ffb4b['status'](_0x406611)['json'](_0x2567fa);}};}function respondWithFilteredResult(_0x528a27,_0x47c720){return function(_0x13f620){if(_0x13f620){var _0x37a070=typeof _0x47c720[_0x4758('0x17')]===_0x4758('0x18')&&typeof _0x47c720[_0x4758('0x19')]===_0x4758('0x18');var _0x52638b=_0x13f620[_0x4758('0x1a')];var _0x41547a=_0x37a070?0x0:_0x47c720['offset'];var _0x2205a2=_0x37a070?_0x13f620[_0x4758('0x1a')]:_0x47c720[_0x4758('0x17')]+_0x47c720[_0x4758('0x19')];var _0x4b44fc;if(_0x2205a2>=_0x52638b){_0x2205a2=_0x52638b;_0x4b44fc=0xc8;}else{_0x4b44fc=0xce;}_0x528a27[_0x4758('0x1b')](_0x4b44fc);return _0x528a27[_0x4758('0x1c')](_0x4758('0x1d'),_0x41547a+'-'+_0x2205a2+'/'+_0x52638b)[_0x4758('0x1e')](_0x13f620);}return null;};}function patchUpdates(_0x55f926){return function(_0x2364bc){try{jsonpatch[_0x4758('0x1f')](_0x2364bc,_0x55f926,!![]);}catch(_0x50b02b){return BPromise[_0x4758('0x20')](_0x50b02b);}return _0x2364bc['save']();};}function saveUpdates(_0x3064ce,_0xfc284b){return function(_0x3b5814){if(_0x3b5814){return _0x3b5814[_0x4758('0x21')](_0x3064ce)[_0x4758('0x22')](function(_0x114f08){return _0x114f08;});}return null;};}function removeEntity(_0x4c5760,_0x109895){return function(_0x25d284){if(_0x25d284){return _0x25d284['destroy']()[_0x4758('0x22')](function(){_0x4c5760[_0x4758('0x1b')](0xcc)[_0x4758('0x16')]();});}};}function handleEntityNotFound(_0xc3d8e6,_0x52582a){return function(_0x1796b1){if(!_0x1796b1){_0xc3d8e6['sendStatus'](0x194);}return _0x1796b1;};}function handleError(_0x4cfeba,_0x11a6f9){_0x11a6f9=_0x11a6f9||0x1f4;return function(_0x1f8aeb){logger[_0x4758('0x23')](_0x1f8aeb[_0x4758('0x24')]);if(_0x1f8aeb[_0x4758('0x25')]){delete _0x1f8aeb[_0x4758('0x25')];}_0x4cfeba[_0x4758('0x1b')](_0x11a6f9)[_0x4758('0x26')](_0x1f8aeb);};}exports[_0x4758('0x27')]=function(_0x4683fc,_0x3f9b50){var _0x588322={},_0x5170d4={},_0x369b95={'count':0x0,'rows':[]};var _0x4a5f5e=_[_0x4758('0x28')](db[_0x4758('0x29')][_0x4758('0x2a')],function(_0x29b71e){return{'name':_0x29b71e[_0x4758('0x2b')],'type':_0x29b71e[_0x4758('0x2c')][_0x4758('0x2d')]};});_0x5170d4['model']=_[_0x4758('0x28')](_0x4a5f5e,_0x4758('0x25'));_0x5170d4[_0x4758('0x2e')]=_[_0x4758('0x2f')](_0x4683fc[_0x4758('0x2e')]);_0x5170d4[_0x4758('0x30')]=_['intersection'](_0x5170d4[_0x4758('0x31')],_0x5170d4[_0x4758('0x2e')]);_0x588322[_0x4758('0x32')]=_[_0x4758('0x33')](_0x5170d4[_0x4758('0x31')],qs[_0x4758('0x34')](_0x4683fc['query']['fields']));_0x588322[_0x4758('0x32')]=_0x588322[_0x4758('0x32')][_0x4758('0x35')]?_0x588322['attributes']:_0x5170d4[_0x4758('0x31')];if(!_0x4683fc[_0x4758('0x2e')][_0x4758('0x36')](_0x4758('0x37'))){_0x588322[_0x4758('0x19')]=qs[_0x4758('0x19')](_0x4683fc[_0x4758('0x2e')][_0x4758('0x19')]);_0x588322[_0x4758('0x17')]=qs[_0x4758('0x17')](_0x4683fc[_0x4758('0x2e')]['offset']);}_0x588322[_0x4758('0x38')]=qs[_0x4758('0x39')](_0x4683fc['query'][_0x4758('0x39')]);_0x588322[_0x4758('0x3a')]=qs[_0x4758('0x30')](_[_0x4758('0x3b')](_0x4683fc[_0x4758('0x2e')],_0x5170d4[_0x4758('0x30')]),_0x4a5f5e);if(_0x4683fc[_0x4758('0x2e')][_0x4758('0x3c')]){_0x588322[_0x4758('0x3a')]=_['merge'](_0x588322[_0x4758('0x3a')],{'$or':_[_0x4758('0x28')](_0x4a5f5e,function(_0x190b83){if(_0x190b83[_0x4758('0x2c')]!==_0x4758('0x3d')){var _0x5be357={};_0x5be357[_0x190b83[_0x4758('0x25')]]={'$like':'%'+_0x4683fc[_0x4758('0x2e')][_0x4758('0x3c')]+'%'};return _0x5be357;}})});}_0x588322=_[_0x4758('0x3e')]({},_0x588322,_0x4683fc[_0x4758('0x3f')]);var _0x30084a={'where':_0x588322[_0x4758('0x3a')]};return db[_0x4758('0x29')][_0x4758('0x1a')](_0x30084a)[_0x4758('0x22')](function(_0x60c3c0){_0x369b95[_0x4758('0x1a')]=_0x60c3c0;if(_0x4683fc['query'][_0x4758('0x40')]){_0x588322[_0x4758('0x41')]=[{'all':!![]}];}return db[_0x4758('0x29')][_0x4758('0x42')](_0x588322);})[_0x4758('0x22')](function(_0x122e2c){_0x369b95[_0x4758('0x43')]=_0x122e2c;return _0x369b95;})[_0x4758('0x22')](respondWithFilteredResult(_0x3f9b50,_0x588322))[_0x4758('0x44')](handleError(_0x3f9b50,null));};exports[_0x4758('0x45')]=function(_0x2e7403,_0x2d76b8){var _0x35572e={'raw':!![],'where':{'id':_0x2e7403['params']['id']}},_0x567087={};_0x567087[_0x4758('0x31')]=_[_0x4758('0x2f')](db[_0x4758('0x29')][_0x4758('0x2a')]);_0x567087['query']=_['keys'](_0x2e7403[_0x4758('0x2e')]);_0x567087['filters']=_[_0x4758('0x33')](_0x567087[_0x4758('0x31')],_0x567087[_0x4758('0x2e')]);_0x35572e['attributes']=_[_0x4758('0x33')](_0x567087[_0x4758('0x31')],qs[_0x4758('0x34')](_0x2e7403['query'][_0x4758('0x34')]));_0x35572e['attributes']=_0x35572e[_0x4758('0x32')][_0x4758('0x35')]?_0x35572e[_0x4758('0x32')]:_0x567087['model'];if(_0x2e7403[_0x4758('0x2e')][_0x4758('0x40')]){_0x35572e[_0x4758('0x41')]=[{'all':!![]}];}_0x35572e=_['merge']({},_0x35572e,_0x2e7403[_0x4758('0x3f')]);return db[_0x4758('0x29')][_0x4758('0x46')](_0x35572e)[_0x4758('0x22')](handleEntityNotFound(_0x2d76b8,null))[_0x4758('0x22')](respondWithResult(_0x2d76b8,null))['catch'](handleError(_0x2d76b8,null));};exports[_0x4758('0x47')]=function(_0x50b322,_0x453e34){return db[_0x4758('0x29')]['create'](_0x50b322[_0x4758('0x48')],{})[_0x4758('0x22')](respondWithResult(_0x453e34,0xc9))[_0x4758('0x44')](handleError(_0x453e34,null));};exports['update']=function(_0x3022e3,_0x540981){if(_0x3022e3['body']['id']){delete _0x3022e3[_0x4758('0x48')]['id'];}return db[_0x4758('0x29')]['find']({'where':{'id':_0x3022e3[_0x4758('0x49')]['id']}})[_0x4758('0x22')](handleEntityNotFound(_0x540981,null))[_0x4758('0x22')](saveUpdates(_0x3022e3[_0x4758('0x48')],null))[_0x4758('0x22')](respondWithResult(_0x540981,null))[_0x4758('0x44')](handleError(_0x540981,null));};exports['destroy']=function(_0x4c2c1c,_0x20e867){return db[_0x4758('0x29')][_0x4758('0x46')]({'where':{'id':_0x4c2c1c[_0x4758('0x49')]['id']}})[_0x4758('0x22')](handleEntityNotFound(_0x20e867,null))[_0x4758('0x22')](removeEntity(_0x20e867,null))['catch'](handleError(_0x20e867,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index f0e1109..9573409 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 _0x9656=['utf8mb4','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelApplication.attributes','exports','define','openchannel_applications'];(function(_0x4393cb,_0x4af68f){var _0x215428=function(_0x57c55f){while(--_0x57c55f){_0x4393cb['push'](_0x4393cb['shift']());}};_0x215428(++_0x4af68f);}(_0x9656,0xe5));var _0x6965=function(_0x43acb1,_0x38e4b8){_0x43acb1=_0x43acb1-0x0;var _0xad1024=_0x9656[_0x43acb1];return _0xad1024;};'use strict';var _=require('lodash');var util=require(_0x6965('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x6965('0x1'));var BPromise=require(_0x6965('0x2'));var rp=require(_0x6965('0x3'));var fs=require('fs');var path=require(_0x6965('0x4'));var rimraf=require(_0x6965('0x5'));var config=require(_0x6965('0x6'));var attributes=require(_0x6965('0x7'));module[_0x6965('0x8')]=function(_0x3978d3,_0x42dea9){return _0x3978d3[_0x6965('0x9')]('OpenchannelApplication',attributes,{'tableName':_0x6965('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x6965('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x3fa4=['api','moment','bluebird','rimraf','exports','define','OpenchannelApplication','utf8mb4','lodash','util','../../config/logger'];(function(_0x4b2436,_0x452299){var _0x4f5ab2=function(_0x5c6679){while(--_0x5c6679){_0x4b2436['push'](_0x4b2436['shift']());}};_0x4f5ab2(++_0x452299);}(_0x3fa4,0xa2));var _0x43fa=function(_0x124090,_0x276ec1){_0x124090=_0x124090-0x0;var _0x526118=_0x3fa4[_0x124090];return _0x526118;};'use strict';var _=require(_0x43fa('0x0'));var util=require(_0x43fa('0x1'));var logger=require(_0x43fa('0x2'))(_0x43fa('0x3'));var moment=require(_0x43fa('0x4'));var BPromise=require(_0x43fa('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x43fa('0x6'));var config=require('../../config/environment');var attributes=require('./openchannelApplication.attributes');module[_0x43fa('0x7')]=function(_0xb3febf,_0x53381a){return _0xb3febf[_0x43fa('0x8')](_0x43fa('0x9'),attributes,{'tableName':'openchannel_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x43fa('0xa'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index e90335d..cf910ca 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 _0x3df6=['lodash','util','moment','randomstring','../../config/utils','rpc','../../config/environment','client','http','then','request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','OpenchannelApplication,\x20%s,\x20%s','message','info','result','catch','OpenchannelApplication','update','body','options','raw','where','limit','UpdateOpenchannelApplication'];(function(_0x42883f,_0x4be8ce){var _0x36a5ec=function(_0x23841c){while(--_0x23841c){_0x42883f['push'](_0x42883f['shift']());}};_0x36a5ec(++_0x4be8ce);}(_0x3df6,0xa8));var _0x63df=function(_0x159714,_0xd4cebd){_0x159714=_0x159714-0x0;var _0xeb4da6=_0x3df6[_0x159714];return _0xeb4da6;};'use strict';var _=require(_0x63df('0x0'));var util=require(_0x63df('0x1'));var moment=require(_0x63df('0x2'));var BPromise=require('bluebird');var rs=require(_0x63df('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x63df('0x4'));var logger=require('../../config/logger')(_0x63df('0x5'));var config=require(_0x63df('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x63df('0x7')][_0x63df('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x39cfc3,_0x39d0d2,_0x3937ac){return new BPromise(function(_0x2ae194,_0x2223c7){return client['request'](_0x39cfc3,_0x3937ac)[_0x63df('0x9')](function(_0xcc0826){logger['info']('OpenchannelApplication,\x20%s,\x20%s',_0x39d0d2,_0x63df('0xa'));logger[_0x63df('0xb')](_0x63df('0xc'),_0x39d0d2,'request\x20sent',JSON[_0x63df('0xd')](_0xcc0826));if(_0xcc0826[_0x63df('0xe')]){if(_0xcc0826[_0x63df('0xe')]['code']===0x1f4){logger[_0x63df('0xe')](_0x63df('0xf'),_0x39d0d2,_0xcc0826[_0x63df('0xe')]['message']);return _0x2223c7(_0xcc0826[_0x63df('0xe')][_0x63df('0x10')]);}logger[_0x63df('0xe')]('OpenchannelApplication,\x20%s,\x20%s',_0x39d0d2,_0xcc0826[_0x63df('0xe')][_0x63df('0x10')]);return _0x2ae194(_0xcc0826[_0x63df('0xe')][_0x63df('0x10')]);}else{logger[_0x63df('0x11')]('OpenchannelApplication,\x20%s,\x20%s',_0x39d0d2,_0x63df('0xa'));_0x2ae194(_0xcc0826[_0x63df('0x12')][_0x63df('0x10')]);}})[_0x63df('0x13')](function(_0x2b49ac){logger[_0x63df('0xe')](_0x63df('0xf'),_0x39d0d2,_0x2b49ac);_0x2223c7(_0x2b49ac);});});}exports['UpdateOpenchannelApplication']=function(_0x3e6f95){var _0x5d6d99=this;return new Promise(function(_0x53ac1b,_0x3f5915){return db[_0x63df('0x14')][_0x63df('0x15')](_0x3e6f95[_0x63df('0x16')],{'raw':_0x3e6f95['options']?_0x3e6f95[_0x63df('0x17')][_0x63df('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3e6f95[_0x63df('0x17')]?_0x3e6f95['options'][_0x63df('0x19')]||null:null,'attributes':_0x3e6f95[_0x63df('0x17')]?_0x3e6f95[_0x63df('0x17')]['attributes']||null:null,'limit':_0x3e6f95['options']?_0x3e6f95[_0x63df('0x17')][_0x63df('0x1a')]||null:null})[_0x63df('0x9')](function(_0x4a41cf){logger['info'](_0x63df('0x1b'),_0x3e6f95);logger['debug'](_0x63df('0x1b'),_0x3e6f95,JSON[_0x63df('0xd')](_0x4a41cf));_0x53ac1b(_0x4a41cf);})[_0x63df('0x13')](function(_0x1fab41){logger[_0x63df('0xe')]('UpdateOpenchannelApplication',_0x1fab41[_0x63df('0x10')],_0x3e6f95);_0x3f5915(_0x5d6d99[_0x63df('0xe')](0x1f4,_0x1fab41[_0x63df('0x10')]));});});}; \ No newline at end of file +var _0x9eac=['body','options','raw','where','attributes','catch','lodash','util','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','error','code','OpenchannelApplication,\x20%s,\x20%s','message','result','UpdateOpenchannelApplication','OpenchannelApplication'];(function(_0x1a0523,_0x25c3c7){var _0x59d63f=function(_0x565743){while(--_0x565743){_0x1a0523['push'](_0x1a0523['shift']());}};_0x59d63f(++_0x25c3c7);}(_0x9eac,0x7a));var _0xc9ea=function(_0x4063a4,_0x19d730){_0x4063a4=_0x4063a4-0x0;var _0x17908d=_0x9eac[_0x4063a4];return _0x17908d;};'use strict';var _=require(_0xc9ea('0x0'));var util=require(_0xc9ea('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xc9ea('0x2'));var fs=require('fs');var Redis=require(_0xc9ea('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xc9ea('0x4'));var logger=require('../../config/logger')(_0xc9ea('0x5'));var config=require(_0xc9ea('0x6'));var jayson=require(_0xc9ea('0x7'));var client=jayson[_0xc9ea('0x8')][_0xc9ea('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xcb657f,_0x171c93,_0xbb96ac){return new BPromise(function(_0xa7eb64,_0x1f9a19){return client[_0xc9ea('0xa')](_0xcb657f,_0xbb96ac)[_0xc9ea('0xb')](function(_0x4c8e0d){logger[_0xc9ea('0xc')]('OpenchannelApplication,\x20%s,\x20%s',_0x171c93,_0xc9ea('0xd'));logger[_0xc9ea('0xe')](_0xc9ea('0xf'),_0x171c93,_0xc9ea('0xd'),JSON['stringify'](_0x4c8e0d));if(_0x4c8e0d[_0xc9ea('0x10')]){if(_0x4c8e0d[_0xc9ea('0x10')][_0xc9ea('0x11')]===0x1f4){logger[_0xc9ea('0x10')](_0xc9ea('0x12'),_0x171c93,_0x4c8e0d[_0xc9ea('0x10')][_0xc9ea('0x13')]);return _0x1f9a19(_0x4c8e0d[_0xc9ea('0x10')][_0xc9ea('0x13')]);}logger[_0xc9ea('0x10')](_0xc9ea('0x12'),_0x171c93,_0x4c8e0d['error']['message']);return _0xa7eb64(_0x4c8e0d['error']['message']);}else{logger[_0xc9ea('0xc')](_0xc9ea('0x12'),_0x171c93,_0xc9ea('0xd'));_0xa7eb64(_0x4c8e0d[_0xc9ea('0x14')]['message']);}})['catch'](function(_0x1447e4){logger[_0xc9ea('0x10')](_0xc9ea('0x12'),_0x171c93,_0x1447e4);_0x1f9a19(_0x1447e4);});});}exports[_0xc9ea('0x15')]=function(_0x546421){var _0x505d99=this;return new Promise(function(_0x2e15d7,_0x4f1de5){return db[_0xc9ea('0x16')]['update'](_0x546421[_0xc9ea('0x17')],{'raw':_0x546421[_0xc9ea('0x18')]?_0x546421[_0xc9ea('0x18')][_0xc9ea('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x546421['options']?_0x546421[_0xc9ea('0x18')][_0xc9ea('0x1a')]||null:null,'attributes':_0x546421[_0xc9ea('0x18')]?_0x546421[_0xc9ea('0x18')][_0xc9ea('0x1b')]||null:null,'limit':_0x546421[_0xc9ea('0x18')]?_0x546421['options']['limit']||null:null})[_0xc9ea('0xb')](function(_0x4c449d){logger['info'](_0xc9ea('0x15'),_0x546421);logger[_0xc9ea('0xe')](_0xc9ea('0x15'),_0x546421,JSON['stringify'](_0x4c449d));_0x2e15d7(_0x4c449d);})[_0xc9ea('0x1c')](function(_0x319acb){logger[_0xc9ea('0x10')](_0xc9ea('0x15'),_0x319acb['message'],_0x546421);_0x4f1de5(_0x505d99['error'](0x1f4,_0x319acb[_0xc9ea('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index f614172..b0dfb2f 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 _0xcea6=['connect-timeout','express','../../config/environment','./openchannelInteraction.controller','get','isAuthenticated','index','describe','/:id','/:id/messages','getMessages','/:id/download','post','create','addMessage','/:id/tags','tracked','openchannel','openchannelinteraction:addtags','addTags','put','update','delete','openchannelinteraction:destroy','destroy','removeTags','exports','multer','util','path'];(function(_0x1073ad,_0x44bf0b){var _0x528474=function(_0x3450f7){while(--_0x3450f7){_0x1073ad['push'](_0x1073ad['shift']());}};_0x528474(++_0x44bf0b);}(_0xcea6,0x93));var _0x6cea=function(_0xcbdab4,_0x56ae94){_0xcbdab4=_0xcbdab4-0x0;var _0x466290=_0xcea6[_0xcbdab4];return _0x466290;};'use strict';var multer=require(_0x6cea('0x0'));var util=require(_0x6cea('0x1'));var path=require(_0x6cea('0x2'));var timeout=require(_0x6cea('0x3'));var express=require(_0x6cea('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x6cea('0x5'));var controller=require(_0x6cea('0x6'));router[_0x6cea('0x7')]('/',auth[_0x6cea('0x8')](),controller[_0x6cea('0x9')]);router[_0x6cea('0x7')]('/describe',auth[_0x6cea('0x8')](),controller[_0x6cea('0xa')]);router['get'](_0x6cea('0xb'),auth[_0x6cea('0x8')](),controller['show']);router[_0x6cea('0x7')](_0x6cea('0xc'),auth[_0x6cea('0x8')](),controller[_0x6cea('0xd')]);router[_0x6cea('0x7')](_0x6cea('0xe'),auth[_0x6cea('0x8')](),controller['download']);router[_0x6cea('0xf')]('/',auth['isAuthenticated'](),controller[_0x6cea('0x10')]);router[_0x6cea('0xf')](_0x6cea('0xc'),auth[_0x6cea('0x8')](),controller[_0x6cea('0x11')]);router[_0x6cea('0xf')](_0x6cea('0x12'),auth['isAuthenticated'](),interaction[_0x6cea('0x13')](_0x6cea('0x14'),_0x6cea('0x15')),controller[_0x6cea('0x16')]);router[_0x6cea('0x17')](_0x6cea('0xb'),auth[_0x6cea('0x8')](),interaction['tracked'](_0x6cea('0x14'),'openchannelinteraction:update'),controller[_0x6cea('0x18')]);router[_0x6cea('0x19')]('/:id',auth[_0x6cea('0x8')](),interaction[_0x6cea('0x13')](_0x6cea('0x14'),_0x6cea('0x1a')),controller[_0x6cea('0x1b')]);router[_0x6cea('0x19')](_0x6cea('0x12'),auth['isAuthenticated'](),controller[_0x6cea('0x1c')]);module[_0x6cea('0x1d')]=router; \ No newline at end of file +var _0xed9a=['openchannelinteraction:update','update','delete','removeTags','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./openchannelInteraction.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/messages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','addTags','put','openchannel'];(function(_0x3c2a69,_0x4c8b41){var _0x596bc8=function(_0x1b4b7c){while(--_0x1b4b7c){_0x3c2a69['push'](_0x3c2a69['shift']());}};_0x596bc8(++_0x4c8b41);}(_0xed9a,0x198));var _0xaed9=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0xed9a[_0x2be8c2];return _0x97f531;};'use strict';var multer=require(_0xaed9('0x0'));var util=require(_0xaed9('0x1'));var path=require(_0xaed9('0x2'));var timeout=require(_0xaed9('0x3'));var express=require('express');var router=express[_0xaed9('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xaed9('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xaed9('0x6'));var controller=require(_0xaed9('0x7'));router['get']('/',auth[_0xaed9('0x8')](),controller[_0xaed9('0x9')]);router[_0xaed9('0xa')](_0xaed9('0xb'),auth[_0xaed9('0x8')](),controller[_0xaed9('0xc')]);router[_0xaed9('0xa')](_0xaed9('0xd'),auth[_0xaed9('0x8')](),controller[_0xaed9('0xe')]);router[_0xaed9('0xa')](_0xaed9('0xf'),auth['isAuthenticated'](),controller['getMessages']);router[_0xaed9('0xa')](_0xaed9('0x10'),auth[_0xaed9('0x8')](),controller[_0xaed9('0x11')]);router[_0xaed9('0x12')]('/',auth['isAuthenticated'](),controller[_0xaed9('0x13')]);router[_0xaed9('0x12')](_0xaed9('0xf'),auth[_0xaed9('0x8')](),controller[_0xaed9('0x14')]);router[_0xaed9('0x12')](_0xaed9('0x15'),auth[_0xaed9('0x8')](),interaction[_0xaed9('0x16')]('openchannel','openchannelinteraction:addtags'),controller[_0xaed9('0x17')]);router[_0xaed9('0x18')](_0xaed9('0xd'),auth[_0xaed9('0x8')](),interaction[_0xaed9('0x16')](_0xaed9('0x19'),_0xaed9('0x1a')),controller[_0xaed9('0x1b')]);router[_0xaed9('0x1c')](_0xaed9('0xd'),auth[_0xaed9('0x8')](),interaction[_0xaed9('0x16')](_0xaed9('0x19'),'openchannelinteraction:destroy'),controller['destroy']);router[_0xaed9('0x1c')](_0xaed9('0x15'),auth[_0xaed9('0x8')](),controller[_0xaed9('0x1d')]);module[_0xaed9('0x1e')]=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index 0802175..47e8c7d 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 _0x48ae=['out','INTEGER','sequelize','exports','BOOLEAN','DATE','STRING','ENUM'];(function(_0x427b8d,_0x107eaa){var _0x643bf2=function(_0x420b0c){while(--_0x420b0c){_0x427b8d['push'](_0x427b8d['shift']());}};_0x643bf2(++_0x107eaa);}(_0x48ae,0xd2));var _0xe48a=function(_0x434b93,_0x561579){_0x434b93=_0x434b93-0x0;var _0x31759e=_0x48ae[_0x434b93];return _0x31759e;};'use strict';var Sequelize=require(_0xe48a('0x0'));module[_0xe48a('0x1')]={'closed':{'type':Sequelize[_0xe48a('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xe48a('0x3')]},'disposition':{'type':Sequelize[_0xe48a('0x4')]},'secondDisposition':{'type':Sequelize[_0xe48a('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xe48a('0x4')]},'read1stAt':{'type':Sequelize[_0xe48a('0x3')]},'threadId':{'type':Sequelize[_0xe48a('0x4')]},'externalUrl':{'type':Sequelize['STRING']},'lastMsgAt':{'type':Sequelize[_0xe48a('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xe48a('0x5')]('in',_0xe48a('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0xe48a('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize['STRING']},'autoreplyExecuted':{'type':Sequelize[_0xe48a('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize[_0xe48a('0x7')]}}; \ No newline at end of file +var _0x22a4=['ENUM','out','INTEGER','sequelize','exports','BOOLEAN','DATE','STRING'];(function(_0x578ead,_0x51e8f7){var _0x55dec9=function(_0x14dfd3){while(--_0x14dfd3){_0x578ead['push'](_0x578ead['shift']());}};_0x55dec9(++_0x51e8f7);}(_0x22a4,0x1cb));var _0x422a=function(_0x225bf6,_0x22e5f2){_0x225bf6=_0x225bf6-0x0;var _0x2922f4=_0x22a4[_0x225bf6];return _0x2922f4;};'use strict';var Sequelize=require(_0x422a('0x0'));module[_0x422a('0x1')]={'closed':{'type':Sequelize[_0x422a('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x422a('0x3')]},'disposition':{'type':Sequelize[_0x422a('0x4')]},'secondDisposition':{'type':Sequelize[_0x422a('0x4')]},'thirdDisposition':{'type':Sequelize[_0x422a('0x4')]},'note':{'type':Sequelize[_0x422a('0x4')]},'read1stAt':{'type':Sequelize['DATE']},'threadId':{'type':Sequelize[_0x422a('0x4')]},'externalUrl':{'type':Sequelize[_0x422a('0x4')]},'lastMsgAt':{'type':Sequelize[_0x422a('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x422a('0x5')]('in',_0x422a('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x422a('0x6')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x422a('0x4')]},'autoreplyExecuted':{'type':Sequelize[_0x422a('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x422a('0x7')]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index 725acba..fa295ef 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 _0xc2e3=['OpenchannelInteraction','rawAttributes','getOptions','findAll','openchannel','query','catch','show','type','from','params','keys','filters','intersection','attributes','model','fields','length','includeAll','include','find','create','body','update','describe','addMessage','OpenchannelMessage','ids','omit','findOne','hasOwnProperty','nolimit','sort','where','pick','OpenchannelInteractionId','filter','merge','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','setTags','spread','Tag','emit','openchannelInteractionTags:save','removeTags','download','unix','toString','join','tmp','root','server','files','attachments','User','fullname','CmContact','Contact','firstName','lastName','Attachment','Messages','createdAt','secret','read','push','OpenchannelAccount','Owner','mkdirSync','Account','N.A.','closedAt','disposition','threadId','Private','basename','createReadStream','createWriteStream','direction','System','out','views','downloadInteraction.ejs','transcript-','Openchannel','createPdfFromHTML','Unable\x20to\x20delete\x20zip\x20file','unlinkSync','rimraf','zip-dir','moment','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','status','end','offset','undefined','limit','count','set','Content-Range','json','then','destroy','error','stack','name','send','index','map'];(function(_0x57bb3a,_0x237ede){var _0x5decaa=function(_0x262a8f){while(--_0x262a8f){_0x57bb3a['push'](_0x57bb3a['shift']());}};_0x5decaa(++_0x237ede);}(_0xc2e3,0x161));var _0x3c2e=function(_0x4dfe89,_0x10808e){_0x4dfe89=_0x4dfe89-0x0;var _0x5c4906=_0xc2e3[_0x4dfe89];return _0x5c4906;};'use strict';var rimraf=require(_0x3c2e('0x0'));var zipdir=require(_0x3c2e('0x1'));var moment=require(_0x3c2e('0x2'));var util=require(_0x3c2e('0x3'));var path=require(_0x3c2e('0x4'));var ejs=require(_0x3c2e('0x5'));var fs=require('fs');var _=require(_0x3c2e('0x6'));var Redis=require('ioredis');var interaction=require(_0x3c2e('0x7'));var qs=require(_0x3c2e('0x8'));var pdf=require(_0x3c2e('0x9'));var logger=require(_0x3c2e('0xa'))('api');var config=require(_0x3c2e('0xb'));var db=require(_0x3c2e('0xc'))['db'];config[_0x3c2e('0xd')]=_[_0x3c2e('0xe')](config[_0x3c2e('0xd')],{'host':_0x3c2e('0xf'),'port':0x18eb});var socket=require(_0x3c2e('0x10'))(new Redis(config[_0x3c2e('0xd')]));require(_0x3c2e('0x11'))[_0x3c2e('0x12')](socket);function respondWithStatusCode(_0xf4a026,_0x4145df){_0x4145df=_0x4145df||0xcc;return function(_0xea1de3){if(_0xea1de3){return _0xf4a026[_0x3c2e('0x13')](_0x4145df);}return _0xf4a026[_0x3c2e('0x14')](_0x4145df)[_0x3c2e('0x15')]();};}function respondWithResult(_0x4450db,_0x5f2f35){_0x5f2f35=_0x5f2f35||0xc8;return function(_0x4fafc9){if(_0x4fafc9){return _0x4450db[_0x3c2e('0x14')](_0x5f2f35)['json'](_0x4fafc9);}};}function respondWithFilteredResult(_0x5755d6,_0x487cd8){return function(_0x1fd358){if(_0x1fd358){var _0x411f8c=typeof _0x487cd8[_0x3c2e('0x16')]===_0x3c2e('0x17')&&typeof _0x487cd8[_0x3c2e('0x18')]==='undefined';var _0x42f584=_0x1fd358[_0x3c2e('0x19')];var _0x26647d=_0x411f8c?0x0:_0x487cd8[_0x3c2e('0x16')];var _0x329997=_0x411f8c?_0x1fd358[_0x3c2e('0x19')]:_0x487cd8[_0x3c2e('0x16')]+_0x487cd8['limit'];var _0x36e320;if(_0x329997>=_0x42f584){_0x329997=_0x42f584;_0x36e320=0xc8;}else{_0x36e320=0xce;}_0x5755d6['status'](_0x36e320);return _0x5755d6[_0x3c2e('0x1a')](_0x3c2e('0x1b'),_0x26647d+'-'+_0x329997+'/'+_0x42f584)[_0x3c2e('0x1c')](_0x1fd358);}return null;};}function saveUpdates(_0x54da28){return function(_0x1b052b){if(_0x1b052b){return _0x1b052b['update'](_0x54da28)[_0x3c2e('0x1d')](function(_0x2e5e6c){return _0x2e5e6c;});}return null;};}function removeEntity(_0x538bee){return function(_0x5c6147){if(_0x5c6147){return _0x5c6147[_0x3c2e('0x1e')]()[_0x3c2e('0x1d')](function(){_0x538bee[_0x3c2e('0x14')](0xcc)[_0x3c2e('0x15')]();});}};}function handleEntityNotFound(_0x1eb3f6){return function(_0x443468){if(!_0x443468){_0x1eb3f6['sendStatus'](0x194);}return _0x443468;};}function handleError(_0x208c9b,_0x4f0f90){_0x4f0f90=_0x4f0f90||0x1f4;return function(_0x479c4b){logger[_0x3c2e('0x1f')](_0x479c4b[_0x3c2e('0x20')]);if(_0x479c4b['name']){delete _0x479c4b[_0x3c2e('0x21')];}_0x208c9b['status'](_0x4f0f90)[_0x3c2e('0x22')](_0x479c4b);};}exports[_0x3c2e('0x23')]=function(_0x55a979,_0x2c2e9a){var _0x123994={};var _0x1a4fe=_[_0x3c2e('0x24')](db[_0x3c2e('0x25')][_0x3c2e('0x26')],function(_0x27aaf6){return{'name':_0x27aaf6['fieldName'],'type':_0x27aaf6['type']['key']};});_0x123994=qs[_0x3c2e('0x27')](_0x1a4fe,_0x55a979);return interaction[_0x3c2e('0x28')](_0x3c2e('0x29'),_0x55a979[_0x3c2e('0x2a')],_0x55a979['user'],_0x123994,_0x1a4fe)['then'](respondWithFilteredResult(_0x2c2e9a,_0x123994))[_0x3c2e('0x2b')](handleError(_0x2c2e9a,null));};exports[_0x3c2e('0x2c')]=function(_0x451258,_0x3f0db4){var _0xc10b8={};if(_0x451258['query'][_0x3c2e('0x2d')]&&_0x451258[_0x3c2e('0x2a')][_0x3c2e('0x2d')]===_0x3c2e('0x2e')){_0xc10b8['from']=_0x451258[_0x3c2e('0x2f')]['id'];}else{_0xc10b8['id']=_0x451258['params']['id'];}var _0xde698b={'raw':![],'where':_0xc10b8},_0x495229={};_0x495229['model']=_[_0x3c2e('0x30')](db[_0x3c2e('0x25')]['rawAttributes']);_0x495229[_0x3c2e('0x2a')]=_[_0x3c2e('0x30')](_0x451258['query']);_0x495229[_0x3c2e('0x31')]=_[_0x3c2e('0x32')](_0x495229['model'],_0x495229[_0x3c2e('0x2a')]);_0xde698b[_0x3c2e('0x33')]=_['intersection'](_0x495229[_0x3c2e('0x34')],qs[_0x3c2e('0x35')](_0x451258[_0x3c2e('0x2a')][_0x3c2e('0x35')]));_0xde698b[_0x3c2e('0x33')]=_0xde698b[_0x3c2e('0x33')][_0x3c2e('0x36')]?_0xde698b['attributes']:_0x495229[_0x3c2e('0x34')];if(_0x451258['query'][_0x3c2e('0x37')]){_0xde698b[_0x3c2e('0x38')]=[{'all':!![]}];}_0xde698b=_['merge']({},_0xde698b,_0x451258['options']);return db[_0x3c2e('0x25')][_0x3c2e('0x39')](_0xde698b)['then'](handleEntityNotFound(_0x3f0db4,null))[_0x3c2e('0x1d')](respondWithResult(_0x3f0db4,null))[_0x3c2e('0x2b')](handleError(_0x3f0db4,null));};exports['create']=function(_0x131937,_0x17c345){return db[_0x3c2e('0x25')][_0x3c2e('0x3a')](_0x131937[_0x3c2e('0x3b')],{})[_0x3c2e('0x1d')](respondWithResult(_0x17c345,0xc9))[_0x3c2e('0x2b')](handleError(_0x17c345,null));};exports[_0x3c2e('0x3c')]=function(_0x3b85eb,_0x2cba92){if(_0x3b85eb['body']['id']){delete _0x3b85eb[_0x3c2e('0x3b')]['id'];}return db[_0x3c2e('0x25')][_0x3c2e('0x39')]({'where':{'id':_0x3b85eb['params']['id']}})[_0x3c2e('0x1d')](handleEntityNotFound(_0x2cba92,null))['then'](saveUpdates(_0x3b85eb[_0x3c2e('0x3b')],null))['then'](respondWithResult(_0x2cba92,null))[_0x3c2e('0x2b')](handleError(_0x2cba92,null));};exports[_0x3c2e('0x1e')]=function(_0x59846a,_0x12b8c2){return db[_0x3c2e('0x25')]['find']({'where':{'id':_0x59846a[_0x3c2e('0x2f')]['id']}})['then'](handleEntityNotFound(_0x12b8c2,null))[_0x3c2e('0x1d')](removeEntity(_0x12b8c2,null))[_0x3c2e('0x2b')](handleError(_0x12b8c2,null));};exports[_0x3c2e('0x3d')]=function(_0x473232,_0x3e6205){return db[_0x3c2e('0x25')][_0x3c2e('0x3d')]()[_0x3c2e('0x1d')](respondWithResult(_0x3e6205,null))[_0x3c2e('0x2b')](handleError(_0x3e6205,null));};exports[_0x3c2e('0x3e')]=function(_0x158048,_0x2c610f){return db[_0x3c2e('0x3f')][_0x3c2e('0x39')]({'where':{'id':_0x158048[_0x3c2e('0x2f')]['id']}})[_0x3c2e('0x1d')](handleEntityNotFound(_0x2c610f,null))['then'](function(_0x6188fa){if(_0x6188fa){return _0x6188fa[_0x3c2e('0x3e')](_0x158048['body'][_0x3c2e('0x40')],_[_0x3c2e('0x41')](_0x158048[_0x3c2e('0x3b')],['ids','id'])||{});}})[_0x3c2e('0x1d')](respondWithResult(_0x2c610f,null))[_0x3c2e('0x2b')](handleError(_0x2c610f,null));};exports['getMessages']=function(_0x4fd57c,_0x1419e7){var _0x179e2d={'raw':![],'where':{}};var _0x172fff={};var _0x2cbec5={'count':0x0,'rows':[]};return db['OpenchannelInteraction'][_0x3c2e('0x42')]({'where':{'id':_0x4fd57c[_0x3c2e('0x2f')]['id']}})['then'](handleEntityNotFound(_0x1419e7,null))['then'](function(_0x55b56d){if(_0x55b56d){_0x172fff[_0x3c2e('0x34')]=_[_0x3c2e('0x30')](db[_0x3c2e('0x3f')]['rawAttributes']);_0x172fff['query']=_[_0x3c2e('0x30')](_0x4fd57c[_0x3c2e('0x2a')]);_0x172fff[_0x3c2e('0x31')]=_[_0x3c2e('0x32')](_0x172fff[_0x3c2e('0x34')],_0x172fff['query']);_0x179e2d[_0x3c2e('0x33')]=_[_0x3c2e('0x32')](_0x172fff[_0x3c2e('0x34')],qs[_0x3c2e('0x35')](_0x4fd57c[_0x3c2e('0x2a')][_0x3c2e('0x35')]));_0x179e2d[_0x3c2e('0x33')]=_0x179e2d['attributes']['length']?_0x179e2d[_0x3c2e('0x33')]:_0x172fff['model'];if(!_0x4fd57c['query'][_0x3c2e('0x43')](_0x3c2e('0x44'))){_0x179e2d[_0x3c2e('0x18')]=qs[_0x3c2e('0x18')](_0x4fd57c['query'][_0x3c2e('0x18')]);_0x179e2d['offset']=qs['offset'](_0x4fd57c['query'][_0x3c2e('0x16')]);}_0x179e2d['order']=qs[_0x3c2e('0x45')](_0x4fd57c['query'][_0x3c2e('0x45')]);_0x179e2d[_0x3c2e('0x46')]=qs['filters'](_[_0x3c2e('0x47')](_0x4fd57c[_0x3c2e('0x2a')],_0x172fff[_0x3c2e('0x31')]));_0x179e2d[_0x3c2e('0x46')][_0x3c2e('0x48')]=_0x55b56d['id'];if(_0x4fd57c[_0x3c2e('0x2a')][_0x3c2e('0x49')]){_0x179e2d[_0x3c2e('0x46')]=_[_0x3c2e('0x4a')](_0x179e2d[_0x3c2e('0x46')],{'$or':_[_0x3c2e('0x24')](_0x179e2d[_0x3c2e('0x33')],function(_0x2d8d5d){var _0x213a8b={};_0x213a8b[_0x2d8d5d]={'$like':'%'+_0x4fd57c[_0x3c2e('0x2a')][_0x3c2e('0x49')]+'%'};return _0x213a8b;})});}if(_0x4fd57c['query'][_0x3c2e('0x4b')]){var _0x2a7b84=_0x4fd57c[_0x3c2e('0x2a')][_0x3c2e('0x4b')][_0x3c2e('0x4c')](',');var _0x2e1054={};_0x2e1054[_0x2a7b84[0x0]]={'$gte':moment(_0x2a7b84[0x1])[_0x3c2e('0x4d')](_0x3c2e('0x4e'))};_0x179e2d['where']=_['merge'](_0x179e2d[_0x3c2e('0x46')],_0x2e1054);}_0x179e2d=_[_0x3c2e('0x4a')]({},_0x179e2d,_0x4fd57c['options']);return db[_0x3c2e('0x3f')][_0x3c2e('0x19')]({'where':_0x179e2d[_0x3c2e('0x46')]})[_0x3c2e('0x1d')](function(_0x12e118){_0x2cbec5[_0x3c2e('0x19')]=_0x12e118;if(_0x4fd57c[_0x3c2e('0x2a')]['includeAll']){_0x179e2d[_0x3c2e('0x38')]=[{'all':!![]}];}return db['OpenchannelMessage'][_0x3c2e('0x28')](_0x179e2d);})['then'](function(_0x6dcc05){_0x2cbec5[_0x3c2e('0x4f')]=_0x6dcc05;return _0x2cbec5;});}})['then'](respondWithFilteredResult(_0x1419e7,_0x179e2d))['catch'](handleError(_0x1419e7,null));};exports[_0x3c2e('0x50')]=function(_0x41b906,_0x3523fc){return db[_0x3c2e('0x25')]['find']({'where':{'id':_0x41b906['params']['id']}})[_0x3c2e('0x1d')](handleEntityNotFound(_0x3523fc,null))[_0x3c2e('0x1d')](function(_0x48e84a){if(_0x48e84a){return _0x48e84a[_0x3c2e('0x51')](_0x41b906[_0x3c2e('0x3b')]['ids'],_[_0x3c2e('0x41')](_0x41b906[_0x3c2e('0x3b')],['ids','id'])||{})[_0x3c2e('0x52')](function(){return db[_0x3c2e('0x53')]['findAll']({'attributes':['id',_0x3c2e('0x21'),'color'],'where':{'id':_0x41b906[_0x3c2e('0x3b')]['ids']}});})[_0x3c2e('0x1d')](function(_0x4760d2){socket[_0x3c2e('0x54')](_0x3c2e('0x55'),{'id':Number(_0x41b906[_0x3c2e('0x2f')]['id']),'tags':_0x4760d2||[]});return{'id':Number(_0x41b906['params']['id']),'tags':_0x4760d2||[]};});}})[_0x3c2e('0x1d')](respondWithResult(_0x3523fc,null))[_0x3c2e('0x2b')](handleError(_0x3523fc,null));};exports[_0x3c2e('0x56')]=function(_0x1df598,_0x26f0c8){return db[_0x3c2e('0x25')]['find']({'where':{'id':_0x1df598['params']['id']}})[_0x3c2e('0x1d')](handleEntityNotFound(_0x26f0c8,null))[_0x3c2e('0x1d')](function(_0x3ac5b4){if(_0x3ac5b4){return _0x3ac5b4['removeTags'](_0x1df598[_0x3c2e('0x2a')][_0x3c2e('0x40')]);}})[_0x3c2e('0x1d')](respondWithStatusCode(_0x26f0c8,null))[_0x3c2e('0x2b')](handleError(_0x26f0c8,null));};exports[_0x3c2e('0x57')]=function(_0x58c0dd,_0x5c1115){var _0xa80955=moment()[_0x3c2e('0x58')]()[_0x3c2e('0x59')]();var _0x82d6a4=path[_0x3c2e('0x5a')](config['root'],'server','files',_0x3c2e('0x5b'));var _0x2286d3=path[_0x3c2e('0x5a')](config[_0x3c2e('0x5c')],_0x3c2e('0x5d'),_0x3c2e('0x5e'),_0x3c2e('0x5f'));var _0x420cf9=path[_0x3c2e('0x5a')](_0x82d6a4,_0xa80955);var _0x4e3ee3=util[_0x3c2e('0x4d')]('transcript-%d-%s.zip',_0x58c0dd[_0x3c2e('0x2f')]['id'],_0xa80955);var _0x48dc23=path[_0x3c2e('0x5a')](_0x82d6a4,_0x4e3ee3);var _0x36701c=[];_0x36701c['push']({'model':db[_0x3c2e('0x60')],'as':_0x3c2e('0x60'),'attributes':['id',_0x3c2e('0x61')],'raw':!![]});_0x36701c['push']({'model':db[_0x3c2e('0x62')],'as':_0x3c2e('0x63'),'attributes':['id',_0x3c2e('0x64'),_0x3c2e('0x65')],'raw':!![]});if(_0x58c0dd[_0x3c2e('0x2a')]['attachments']){_0x36701c['push']({'model':db['Attachment'],'as':_0x3c2e('0x66'),'raw':!![]});}var _0x240c53=[{'model':db[_0x3c2e('0x3f')],'as':_0x3c2e('0x67'),'attributes':['id','body',_0x3c2e('0x68'),'direction',_0x3c2e('0x69'),_0x3c2e('0x6a')],'include':_0x36701c}];_0x240c53[_0x3c2e('0x6b')]({'model':db[_0x3c2e('0x6c')],'as':'Account','attributes':['id',_0x3c2e('0x21')]});_0x240c53[_0x3c2e('0x6b')]({'model':db[_0x3c2e('0x60')],'as':_0x3c2e('0x6d'),'attributes':['id',_0x3c2e('0x61')]});return db['OpenchannelInteraction'][_0x3c2e('0x39')]({'where':{'id':_0x58c0dd[_0x3c2e('0x2f')]['id']},'include':_0x240c53})[_0x3c2e('0x1d')](handleEntityNotFound(_0x5c1115,null))[_0x3c2e('0x1d')](function(_0x4c3203){if(_0x4c3203){var _0x41ad2d=_0x4c3203['get']({'plain':!![]});fs[_0x3c2e('0x6e')](_0x420cf9);var _0x67c922={'channel':'Openchannel','account':_0x41ad2d[_0x3c2e('0x6f')][_0x3c2e('0x21')],'agent':_0x41ad2d[_0x3c2e('0x6d')]?_0x41ad2d[_0x3c2e('0x6d')][_0x3c2e('0x61')]:_0x3c2e('0x70'),'createdAt':moment(_0x41ad2d['createdAt'])[_0x3c2e('0x4d')](_0x3c2e('0x4e'))[_0x3c2e('0x59')](),'closedAt':_0x41ad2d['closed']?moment(_0x41ad2d[_0x3c2e('0x71')])['format'](_0x3c2e('0x4e'))[_0x3c2e('0x59')]():'','disposition':_0x41ad2d[_0x3c2e('0x72')],'visibility':_0x41ad2d[_0x3c2e('0x73')]?'Public':_0x3c2e('0x74'),'messages':_(_0x41ad2d[_0x3c2e('0x67')])[_0x3c2e('0x49')]({'secret':![]})[_0x3c2e('0x24')](function(_0x4dedbd){if(_0x4dedbd[_0x3c2e('0x66')]){var _0x29ff6b=path['join'](_0x2286d3,_0x4dedbd[_0x3c2e('0x66')][_0x3c2e('0x75')]);if(fs['existsSync'](_0x29ff6b)){fs[_0x3c2e('0x76')](_0x29ff6b)['pipe'](fs[_0x3c2e('0x77')](path[_0x3c2e('0x5a')](_0x420cf9,_0x4dedbd[_0x3c2e('0x66')][_0x3c2e('0x75')])));}}return{'date':moment(_0x4dedbd[_0x3c2e('0x68')])['format'](_0x3c2e('0x4e'))[_0x3c2e('0x59')](),'sender':_0x4dedbd[_0x3c2e('0x78')]==='out'?_0x4dedbd[_0x3c2e('0x60')]?_0x4dedbd['User'][_0x3c2e('0x61')]:_0x3c2e('0x79'):_0x4dedbd[_0x3c2e('0x63')][_0x3c2e('0x64')]+(_0x4dedbd[_0x3c2e('0x63')]['lastName']?'\x20'+_0x4dedbd[_0x3c2e('0x63')]['lastName']:''),'body':_0x4dedbd[_0x3c2e('0x66')]?_0x4dedbd[_0x3c2e('0x66')]['basename']:_0x4dedbd[_0x3c2e('0x3b')],'direction':_0x4dedbd['direction']===_0x3c2e('0x7a')?'A':'C','secret':_0x4dedbd[_0x3c2e('0x69')],'read':_0x4dedbd[_0x3c2e('0x6a')],'attachment':_0x4dedbd[_0x3c2e('0x66')]};})['value']()};return ejs['renderFile'](path['join'](config[_0x3c2e('0x5c')],_0x3c2e('0x5d'),_0x3c2e('0x7b'),_0x3c2e('0x7c')),{'interaction':_0x67c922})['then'](function(_0x598f27){var _0x3a23ad=path[_0x3c2e('0x5a')](_0x420cf9,_0x3c2e('0x7d')+_0x41ad2d['id']+'-'+_0xa80955+'.pdf');var _0x6a836a={'path':_0x3a23ad,'channel':_0x3c2e('0x7e'),'interactionId':_0x41ad2d['id']};return pdf[_0x3c2e('0x7f')](_0x598f27,_0x6a836a);})[_0x3c2e('0x1d')](function(){return new Promise(function(_0x555fa3,_0x40c2e9){zipdir(_0x420cf9,{'saveTo':_0x48dc23},function(_0x7514f9,_0xda9693){if(_0x7514f9)return _0x40c2e9(_0x7514f9);return _0x555fa3(_0xda9693);});})['then'](function(){return new Promise(function(_0x1450c4,_0x391b74){rimraf(_0x420cf9,function(_0x2b54d3){if(_0x2b54d3)_0x391b74(_0x2b54d3);return _0x1450c4();});});})[_0x3c2e('0x1d')](function(){return _0x5c1115[_0x3c2e('0x57')](_0x48dc23,_0x4e3ee3,function(_0x106daa){if(_0x106daa){logger[_0x3c2e('0x1f')](_0x3c2e('0x80'),_0x106daa);}else{fs[_0x3c2e('0x81')](_0x48dc23);}});});});}else{return _0x5c1115['sendStatus'](0xc8);}})[_0x3c2e('0x2b')](handleError(_0x5c1115,null));}; \ No newline at end of file +var _0x57aa=['join','server','files','root','transcript-%d-%s.zip','push','User','fullname','CmContact','lastName','attachments','Attachment','Messages','createdAt','direction','secret','Account','Owner','get','mkdirSync','Openchannel','N.A.','closed','closedAt','disposition','Public','Private','basename','existsSync','pipe','createWriteStream','out','System','Contact','firstName','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','download','Unable\x20to\x20delete\x20zip\x20file','unlinkSync','rimraf','zip-dir','moment','util','path','lodash','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./openchannelInteraction.socket','status','end','json','undefined','limit','count','offset','set','Content-Range','update','then','sendStatus','error','stack','name','send','map','OpenchannelInteraction','rawAttributes','fieldName','key','query','catch','type','from','params','model','keys','filters','intersection','attributes','fields','includeAll','options','find','create','body','destroy','describe','addMessage','OpenchannelMessage','ids','getMessages','findOne','nolimit','order','sort','pick','where','OpenchannelInteractionId','filter','merge','split','format','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','omit','spread','findAll','color','emit','openchannelInteractionTags:save','removeTags','toString'];(function(_0x443efb,_0x4f8513){var _0x3fc28a=function(_0x57816e){while(--_0x57816e){_0x443efb['push'](_0x443efb['shift']());}};_0x3fc28a(++_0x4f8513);}(_0x57aa,0xa9));var _0xa57a=function(_0x34dd23,_0x50ce42){_0x34dd23=_0x34dd23-0x0;var _0x18a648=_0x57aa[_0x34dd23];return _0x18a648;};'use strict';var rimraf=require(_0xa57a('0x0'));var zipdir=require(_0xa57a('0x1'));var moment=require(_0xa57a('0x2'));var util=require(_0xa57a('0x3'));var path=require(_0xa57a('0x4'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xa57a('0x5'));var Redis=require('ioredis');var interaction=require(_0xa57a('0x6'));var qs=require(_0xa57a('0x7'));var pdf=require(_0xa57a('0x8'));var logger=require(_0xa57a('0x9'))('api');var config=require('../../config/environment');var db=require(_0xa57a('0xa'))['db'];config['redis']=_[_0xa57a('0xb')](config[_0xa57a('0xc')],{'host':_0xa57a('0xd'),'port':0x18eb});var socket=require(_0xa57a('0xe'))(new Redis(config[_0xa57a('0xc')]));require(_0xa57a('0xf'))['register'](socket);function respondWithStatusCode(_0x158cc1,_0x1e7b65){_0x1e7b65=_0x1e7b65||0xcc;return function(_0x53f7fc){if(_0x53f7fc){return _0x158cc1['sendStatus'](_0x1e7b65);}return _0x158cc1[_0xa57a('0x10')](_0x1e7b65)[_0xa57a('0x11')]();};}function respondWithResult(_0x5b3c4f,_0x4010eb){_0x4010eb=_0x4010eb||0xc8;return function(_0x557151){if(_0x557151){return _0x5b3c4f[_0xa57a('0x10')](_0x4010eb)[_0xa57a('0x12')](_0x557151);}};}function respondWithFilteredResult(_0x375dfc,_0x4ed2cd){return function(_0x18a39d){if(_0x18a39d){var _0x5d1861=typeof _0x4ed2cd['offset']===_0xa57a('0x13')&&typeof _0x4ed2cd[_0xa57a('0x14')]===_0xa57a('0x13');var _0x5ba12e=_0x18a39d[_0xa57a('0x15')];var _0x9e3d19=_0x5d1861?0x0:_0x4ed2cd[_0xa57a('0x16')];var _0x5c71a4=_0x5d1861?_0x18a39d[_0xa57a('0x15')]:_0x4ed2cd[_0xa57a('0x16')]+_0x4ed2cd[_0xa57a('0x14')];var _0x21dc65;if(_0x5c71a4>=_0x5ba12e){_0x5c71a4=_0x5ba12e;_0x21dc65=0xc8;}else{_0x21dc65=0xce;}_0x375dfc[_0xa57a('0x10')](_0x21dc65);return _0x375dfc[_0xa57a('0x17')](_0xa57a('0x18'),_0x9e3d19+'-'+_0x5c71a4+'/'+_0x5ba12e)[_0xa57a('0x12')](_0x18a39d);}return null;};}function saveUpdates(_0x330588){return function(_0x4f39eb){if(_0x4f39eb){return _0x4f39eb[_0xa57a('0x19')](_0x330588)[_0xa57a('0x1a')](function(_0x231f63){return _0x231f63;});}return null;};}function removeEntity(_0x42fca4){return function(_0x167928){if(_0x167928){return _0x167928['destroy']()['then'](function(){_0x42fca4['status'](0xcc)[_0xa57a('0x11')]();});}};}function handleEntityNotFound(_0x2a0f0e){return function(_0x487b15){if(!_0x487b15){_0x2a0f0e[_0xa57a('0x1b')](0x194);}return _0x487b15;};}function handleError(_0x292d6f,_0x2c6a84){_0x2c6a84=_0x2c6a84||0x1f4;return function(_0xcf929a){logger[_0xa57a('0x1c')](_0xcf929a[_0xa57a('0x1d')]);if(_0xcf929a[_0xa57a('0x1e')]){delete _0xcf929a[_0xa57a('0x1e')];}_0x292d6f[_0xa57a('0x10')](_0x2c6a84)[_0xa57a('0x1f')](_0xcf929a);};}exports['index']=function(_0xad711,_0x5bc6b9){var _0x394781={};var _0x3215d3=_[_0xa57a('0x20')](db[_0xa57a('0x21')][_0xa57a('0x22')],function(_0x2ba0ad){return{'name':_0x2ba0ad[_0xa57a('0x23')],'type':_0x2ba0ad['type'][_0xa57a('0x24')]};});_0x394781=qs['getOptions'](_0x3215d3,_0xad711);return interaction['findAll']('openchannel',_0xad711[_0xa57a('0x25')],_0xad711['user'],_0x394781,_0x3215d3)['then'](respondWithFilteredResult(_0x5bc6b9,_0x394781))[_0xa57a('0x26')](handleError(_0x5bc6b9,null));};exports['show']=function(_0x3388ab,_0x15df22){var _0xbf2e9d={};if(_0x3388ab[_0xa57a('0x25')]['type']&&_0x3388ab[_0xa57a('0x25')][_0xa57a('0x27')]===_0xa57a('0x28')){_0xbf2e9d[_0xa57a('0x28')]=_0x3388ab[_0xa57a('0x29')]['id'];}else{_0xbf2e9d['id']=_0x3388ab[_0xa57a('0x29')]['id'];}var _0x2b63f8={'raw':![],'where':_0xbf2e9d},_0x39effc={};_0x39effc[_0xa57a('0x2a')]=_[_0xa57a('0x2b')](db['OpenchannelInteraction'][_0xa57a('0x22')]);_0x39effc['query']=_[_0xa57a('0x2b')](_0x3388ab[_0xa57a('0x25')]);_0x39effc[_0xa57a('0x2c')]=_[_0xa57a('0x2d')](_0x39effc[_0xa57a('0x2a')],_0x39effc[_0xa57a('0x25')]);_0x2b63f8[_0xa57a('0x2e')]=_[_0xa57a('0x2d')](_0x39effc['model'],qs[_0xa57a('0x2f')](_0x3388ab[_0xa57a('0x25')]['fields']));_0x2b63f8[_0xa57a('0x2e')]=_0x2b63f8[_0xa57a('0x2e')]['length']?_0x2b63f8[_0xa57a('0x2e')]:_0x39effc[_0xa57a('0x2a')];if(_0x3388ab[_0xa57a('0x25')][_0xa57a('0x30')]){_0x2b63f8['include']=[{'all':!![]}];}_0x2b63f8=_['merge']({},_0x2b63f8,_0x3388ab[_0xa57a('0x31')]);return db[_0xa57a('0x21')][_0xa57a('0x32')](_0x2b63f8)['then'](handleEntityNotFound(_0x15df22,null))[_0xa57a('0x1a')](respondWithResult(_0x15df22,null))[_0xa57a('0x26')](handleError(_0x15df22,null));};exports[_0xa57a('0x33')]=function(_0x5f47ca,_0x451e61){return db[_0xa57a('0x21')]['create'](_0x5f47ca[_0xa57a('0x34')],{})[_0xa57a('0x1a')](respondWithResult(_0x451e61,0xc9))['catch'](handleError(_0x451e61,null));};exports[_0xa57a('0x19')]=function(_0x28e3b9,_0x165611){if(_0x28e3b9[_0xa57a('0x34')]['id']){delete _0x28e3b9[_0xa57a('0x34')]['id'];}return db[_0xa57a('0x21')][_0xa57a('0x32')]({'where':{'id':_0x28e3b9[_0xa57a('0x29')]['id']}})['then'](handleEntityNotFound(_0x165611,null))[_0xa57a('0x1a')](saveUpdates(_0x28e3b9[_0xa57a('0x34')],null))['then'](respondWithResult(_0x165611,null))[_0xa57a('0x26')](handleError(_0x165611,null));};exports[_0xa57a('0x35')]=function(_0x558c9e,_0x158b8b){return db[_0xa57a('0x21')][_0xa57a('0x32')]({'where':{'id':_0x558c9e[_0xa57a('0x29')]['id']}})[_0xa57a('0x1a')](handleEntityNotFound(_0x158b8b,null))[_0xa57a('0x1a')](removeEntity(_0x158b8b,null))[_0xa57a('0x26')](handleError(_0x158b8b,null));};exports[_0xa57a('0x36')]=function(_0x31ce5f,_0x34e3af){return db['OpenchannelInteraction'][_0xa57a('0x36')]()[_0xa57a('0x1a')](respondWithResult(_0x34e3af,null))['catch'](handleError(_0x34e3af,null));};exports[_0xa57a('0x37')]=function(_0x388262,_0xdb696a){return db[_0xa57a('0x38')][_0xa57a('0x32')]({'where':{'id':_0x388262[_0xa57a('0x29')]['id']}})[_0xa57a('0x1a')](handleEntityNotFound(_0xdb696a,null))[_0xa57a('0x1a')](function(_0x4448db){if(_0x4448db){return _0x4448db[_0xa57a('0x37')](_0x388262[_0xa57a('0x34')]['ids'],_['omit'](_0x388262[_0xa57a('0x34')],[_0xa57a('0x39'),'id'])||{});}})[_0xa57a('0x1a')](respondWithResult(_0xdb696a,null))['catch'](handleError(_0xdb696a,null));};exports[_0xa57a('0x3a')]=function(_0x1d4f73,_0x25f5a6){var _0x2d793f={'raw':![],'where':{}};var _0x2e655d={};var _0x5ae4b7={'count':0x0,'rows':[]};return db[_0xa57a('0x21')][_0xa57a('0x3b')]({'where':{'id':_0x1d4f73[_0xa57a('0x29')]['id']}})['then'](handleEntityNotFound(_0x25f5a6,null))[_0xa57a('0x1a')](function(_0x371ad5){if(_0x371ad5){_0x2e655d[_0xa57a('0x2a')]=_[_0xa57a('0x2b')](db[_0xa57a('0x38')][_0xa57a('0x22')]);_0x2e655d['query']=_['keys'](_0x1d4f73['query']);_0x2e655d[_0xa57a('0x2c')]=_[_0xa57a('0x2d')](_0x2e655d[_0xa57a('0x2a')],_0x2e655d[_0xa57a('0x25')]);_0x2d793f[_0xa57a('0x2e')]=_[_0xa57a('0x2d')](_0x2e655d[_0xa57a('0x2a')],qs[_0xa57a('0x2f')](_0x1d4f73[_0xa57a('0x25')]['fields']));_0x2d793f[_0xa57a('0x2e')]=_0x2d793f[_0xa57a('0x2e')]['length']?_0x2d793f[_0xa57a('0x2e')]:_0x2e655d[_0xa57a('0x2a')];if(!_0x1d4f73['query']['hasOwnProperty'](_0xa57a('0x3c'))){_0x2d793f['limit']=qs['limit'](_0x1d4f73[_0xa57a('0x25')][_0xa57a('0x14')]);_0x2d793f['offset']=qs['offset'](_0x1d4f73[_0xa57a('0x25')]['offset']);}_0x2d793f[_0xa57a('0x3d')]=qs[_0xa57a('0x3e')](_0x1d4f73[_0xa57a('0x25')][_0xa57a('0x3e')]);_0x2d793f['where']=qs[_0xa57a('0x2c')](_[_0xa57a('0x3f')](_0x1d4f73[_0xa57a('0x25')],_0x2e655d[_0xa57a('0x2c')]));_0x2d793f[_0xa57a('0x40')][_0xa57a('0x41')]=_0x371ad5['id'];if(_0x1d4f73[_0xa57a('0x25')][_0xa57a('0x42')]){_0x2d793f[_0xa57a('0x40')]=_[_0xa57a('0x43')](_0x2d793f['where'],{'$or':_[_0xa57a('0x20')](_0x2d793f['attributes'],function(_0x3017d3){var _0x18beac={};_0x18beac[_0x3017d3]={'$like':'%'+_0x1d4f73['query']['filter']+'%'};return _0x18beac;})});}if(_0x1d4f73['query']['$gte']){var _0x139224=_0x1d4f73[_0xa57a('0x25')]['$gte'][_0xa57a('0x44')](',');var _0x1f1b33={};_0x1f1b33[_0x139224[0x0]]={'$gte':moment(_0x139224[0x1])[_0xa57a('0x45')](_0xa57a('0x46'))};_0x2d793f['where']=_[_0xa57a('0x43')](_0x2d793f[_0xa57a('0x40')],_0x1f1b33);}_0x2d793f=_[_0xa57a('0x43')]({},_0x2d793f,_0x1d4f73[_0xa57a('0x31')]);return db[_0xa57a('0x38')][_0xa57a('0x15')]({'where':_0x2d793f[_0xa57a('0x40')]})[_0xa57a('0x1a')](function(_0x4b7a6b){_0x5ae4b7[_0xa57a('0x15')]=_0x4b7a6b;if(_0x1d4f73[_0xa57a('0x25')][_0xa57a('0x30')]){_0x2d793f['include']=[{'all':!![]}];}return db[_0xa57a('0x38')]['findAll'](_0x2d793f);})[_0xa57a('0x1a')](function(_0x5df881){_0x5ae4b7[_0xa57a('0x47')]=_0x5df881;return _0x5ae4b7;});}})[_0xa57a('0x1a')](respondWithFilteredResult(_0x25f5a6,_0x2d793f))[_0xa57a('0x26')](handleError(_0x25f5a6,null));};exports[_0xa57a('0x48')]=function(_0x517725,_0x2136a9){return db['OpenchannelInteraction'][_0xa57a('0x32')]({'where':{'id':_0x517725[_0xa57a('0x29')]['id']}})['then'](handleEntityNotFound(_0x2136a9,null))[_0xa57a('0x1a')](function(_0x39bb91){if(_0x39bb91){return _0x39bb91['setTags'](_0x517725[_0xa57a('0x34')][_0xa57a('0x39')],_[_0xa57a('0x49')](_0x517725['body'],[_0xa57a('0x39'),'id'])||{})[_0xa57a('0x4a')](function(){return db['Tag'][_0xa57a('0x4b')]({'attributes':['id','name',_0xa57a('0x4c')],'where':{'id':_0x517725[_0xa57a('0x34')]['ids']}});})[_0xa57a('0x1a')](function(_0x2729a5){socket[_0xa57a('0x4d')](_0xa57a('0x4e'),{'id':Number(_0x517725[_0xa57a('0x29')]['id']),'tags':_0x2729a5||[]});return{'id':Number(_0x517725[_0xa57a('0x29')]['id']),'tags':_0x2729a5||[]};});}})['then'](respondWithResult(_0x2136a9,null))['catch'](handleError(_0x2136a9,null));};exports[_0xa57a('0x4f')]=function(_0x398037,_0x406d2f){return db[_0xa57a('0x21')][_0xa57a('0x32')]({'where':{'id':_0x398037[_0xa57a('0x29')]['id']}})['then'](handleEntityNotFound(_0x406d2f,null))[_0xa57a('0x1a')](function(_0x19df3c){if(_0x19df3c){return _0x19df3c['removeTags'](_0x398037[_0xa57a('0x25')][_0xa57a('0x39')]);}})['then'](respondWithStatusCode(_0x406d2f,null))[_0xa57a('0x26')](handleError(_0x406d2f,null));};exports['download']=function(_0x52f061,_0x15ff8b){var _0x4014ff=moment()['unix']()[_0xa57a('0x50')]();var _0x2a971d=path[_0xa57a('0x51')](config['root'],_0xa57a('0x52'),_0xa57a('0x53'),'tmp');var _0x565122=path['join'](config[_0xa57a('0x54')],_0xa57a('0x52'),_0xa57a('0x53'),'attachments');var _0x5c1ec3=path[_0xa57a('0x51')](_0x2a971d,_0x4014ff);var _0x1f36cf=util[_0xa57a('0x45')](_0xa57a('0x55'),_0x52f061[_0xa57a('0x29')]['id'],_0x4014ff);var _0x74f4ae=path[_0xa57a('0x51')](_0x2a971d,_0x1f36cf);var _0x5c6ffc=[];_0x5c6ffc[_0xa57a('0x56')]({'model':db[_0xa57a('0x57')],'as':'User','attributes':['id',_0xa57a('0x58')],'raw':!![]});_0x5c6ffc['push']({'model':db[_0xa57a('0x59')],'as':'Contact','attributes':['id','firstName',_0xa57a('0x5a')],'raw':!![]});if(_0x52f061[_0xa57a('0x25')][_0xa57a('0x5b')]){_0x5c6ffc[_0xa57a('0x56')]({'model':db[_0xa57a('0x5c')],'as':_0xa57a('0x5c'),'raw':!![]});}var _0x225436=[{'model':db[_0xa57a('0x38')],'as':_0xa57a('0x5d'),'attributes':['id',_0xa57a('0x34'),_0xa57a('0x5e'),_0xa57a('0x5f'),_0xa57a('0x60'),'read'],'include':_0x5c6ffc}];_0x225436['push']({'model':db['OpenchannelAccount'],'as':_0xa57a('0x61'),'attributes':['id',_0xa57a('0x1e')]});_0x225436['push']({'model':db[_0xa57a('0x57')],'as':_0xa57a('0x62'),'attributes':['id','fullname']});return db['OpenchannelInteraction'][_0xa57a('0x32')]({'where':{'id':_0x52f061[_0xa57a('0x29')]['id']},'include':_0x225436})[_0xa57a('0x1a')](handleEntityNotFound(_0x15ff8b,null))[_0xa57a('0x1a')](function(_0x2a1df9){if(_0x2a1df9){var _0x13aef1=_0x2a1df9[_0xa57a('0x63')]({'plain':!![]});fs[_0xa57a('0x64')](_0x5c1ec3);var _0x241fd6={'channel':_0xa57a('0x65'),'account':_0x13aef1['Account'][_0xa57a('0x1e')],'agent':_0x13aef1[_0xa57a('0x62')]?_0x13aef1[_0xa57a('0x62')]['fullname']:_0xa57a('0x66'),'createdAt':moment(_0x13aef1['createdAt'])[_0xa57a('0x45')](_0xa57a('0x46'))['toString'](),'closedAt':_0x13aef1[_0xa57a('0x67')]?moment(_0x13aef1[_0xa57a('0x68')])[_0xa57a('0x45')]('YYYY-MM-DD\x20HH:mm:ss')[_0xa57a('0x50')]():'','disposition':_0x13aef1[_0xa57a('0x69')],'visibility':_0x13aef1['threadId']?_0xa57a('0x6a'):_0xa57a('0x6b'),'messages':_(_0x13aef1[_0xa57a('0x5d')])[_0xa57a('0x42')]({'secret':![]})[_0xa57a('0x20')](function(_0x336a8c){if(_0x336a8c[_0xa57a('0x5c')]){var _0x510de9=path[_0xa57a('0x51')](_0x565122,_0x336a8c[_0xa57a('0x5c')][_0xa57a('0x6c')]);if(fs[_0xa57a('0x6d')](_0x510de9)){fs['createReadStream'](_0x510de9)[_0xa57a('0x6e')](fs[_0xa57a('0x6f')](path[_0xa57a('0x51')](_0x5c1ec3,_0x336a8c['Attachment'][_0xa57a('0x6c')])));}}return{'date':moment(_0x336a8c[_0xa57a('0x5e')])[_0xa57a('0x45')]('YYYY-MM-DD\x20HH:mm:ss')[_0xa57a('0x50')](),'sender':_0x336a8c[_0xa57a('0x5f')]===_0xa57a('0x70')?_0x336a8c['User']?_0x336a8c[_0xa57a('0x57')][_0xa57a('0x58')]:_0xa57a('0x71'):_0x336a8c[_0xa57a('0x72')][_0xa57a('0x73')]+(_0x336a8c[_0xa57a('0x72')]['lastName']?'\x20'+_0x336a8c[_0xa57a('0x72')][_0xa57a('0x5a')]:''),'body':_0x336a8c[_0xa57a('0x5c')]?_0x336a8c[_0xa57a('0x5c')]['basename']:_0x336a8c[_0xa57a('0x34')],'direction':_0x336a8c[_0xa57a('0x5f')]==='out'?'A':'C','secret':_0x336a8c['secret'],'read':_0x336a8c['read'],'attachment':_0x336a8c[_0xa57a('0x5c')]};})['value']()};return ejs[_0xa57a('0x74')](path['join'](config['root'],_0xa57a('0x52'),_0xa57a('0x75'),_0xa57a('0x76')),{'interaction':_0x241fd6})[_0xa57a('0x1a')](function(_0xeccbd3){var _0x5e2e97=path[_0xa57a('0x51')](_0x5c1ec3,_0xa57a('0x77')+_0x13aef1['id']+'-'+_0x4014ff+_0xa57a('0x78'));var _0x2d5aa7={'path':_0x5e2e97,'channel':'Openchannel','interactionId':_0x13aef1['id']};return pdf[_0xa57a('0x79')](_0xeccbd3,_0x2d5aa7);})[_0xa57a('0x1a')](function(){return new Promise(function(_0x7e7fd4,_0x3f7db8){zipdir(_0x5c1ec3,{'saveTo':_0x74f4ae},function(_0x51041f,_0x47f743){if(_0x51041f)return _0x3f7db8(_0x51041f);return _0x7e7fd4(_0x47f743);});})[_0xa57a('0x1a')](function(){return new Promise(function(_0x46cbfe,_0xd2db20){rimraf(_0x5c1ec3,function(_0x1f53e8){if(_0x1f53e8)_0xd2db20(_0x1f53e8);return _0x46cbfe();});});})[_0xa57a('0x1a')](function(){return _0x15ff8b[_0xa57a('0x7a')](_0x74f4ae,_0x1f36cf,function(_0x590a41){if(_0x590a41){logger[_0xa57a('0x1c')](_0xa57a('0x7b'),_0x590a41);}else{fs[_0xa57a('0x7c')](_0x74f4ae);}});});});}else{return _0x15ff8b[_0xa57a('0x1b')](0xc8);}})[_0xa57a('0x26')](handleError(_0x15ff8b,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index 2ebd120..9bd27c0 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 _0x29a7=['setDataValue','unreadMessages','length','emit','catch','hook','exports','events','../../mysqldb','OpenchannelInteraction','setMaxListeners','save','update','remove','getUsers','Users','map','findAll','then'];(function(_0xf4d226,_0x535ac3){var _0x4a484b=function(_0x60e144){while(--_0x60e144){_0xf4d226['push'](_0xf4d226['shift']());}};_0x4a484b(++_0x535ac3);}(_0x29a7,0x79));var _0x729a=function(_0x51b66f,_0x23c9b0){_0x51b66f=_0x51b66f-0x0;var _0x545f8f=_0x29a7[_0x51b66f];return _0x545f8f;};'use strict';var EventEmitter=require(_0x729a('0x0'));var OpenchannelInteraction=require(_0x729a('0x1'))['db'][_0x729a('0x2')];var OpenchannelMessage=require('../../mysqldb')['db']['OpenchannelMessage'];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x729a('0x3')](0x0);var events={'afterCreate':_0x729a('0x4'),'afterUpdate':_0x729a('0x5'),'afterDestroy':_0x729a('0x6')};function emitEvent(_0x2564bb){return function(_0x28a593,_0xf0d91b,_0x3b0932){_0x28a593[_0x729a('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x50ef8){_0x28a593['setDataValue'](_0x729a('0x8'),_0x50ef8[_0x729a('0x9')](function(_0x501df9){return{'id':_0x501df9['id']};}));return OpenchannelMessage[_0x729a('0xa')]({'where':{'OpenchannelInteractionId':_0x28a593['id'],'direction':'in','read':![]},'raw':!![]});})[_0x729a('0xb')](function(_0x595bef){_0x28a593[_0x729a('0xc')](_0x729a('0xd'),_0x595bef[_0x729a('0xe')]);OpenchannelInteractionEvents[_0x729a('0xf')](_0x2564bb+':'+_0x28a593['id'],_0x28a593);OpenchannelInteractionEvents['emit'](_0x2564bb,_0x28a593);_0x3b0932(null);})[_0x729a('0x10')](_0x3b0932(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelInteraction[_0x729a('0x11')](e,emitEvent(event));}}module[_0x729a('0x12')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0x69ed=['OpenchannelInteraction','OpenchannelMessage','setMaxListeners','save','remove','getUsers','then','Users','map','findAll','setDataValue','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x524f01,_0x3089d4){var _0x1a6eaf=function(_0x358898){while(--_0x358898){_0x524f01['push'](_0x524f01['shift']());}};_0x1a6eaf(++_0x3089d4);}(_0x69ed,0x1b6));var _0xd69e=function(_0x49ae54,_0x141cb3){_0x49ae54=_0x49ae54-0x0;var _0x173dea=_0x69ed[_0x49ae54];return _0x173dea;};'use strict';var EventEmitter=require(_0xd69e('0x0'));var OpenchannelInteraction=require(_0xd69e('0x1'))['db'][_0xd69e('0x2')];var OpenchannelMessage=require(_0xd69e('0x1'))['db'][_0xd69e('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0xd69e('0x4')](0x0);var events={'afterCreate':_0xd69e('0x5'),'afterUpdate':'update','afterDestroy':_0xd69e('0x6')};function emitEvent(_0x509890){return function(_0x2c199f,_0x3c7ba1,_0x43f81a){_0x2c199f[_0xd69e('0x7')]({'attributes':['id'],'raw':!![]})[_0xd69e('0x8')](function(_0x38d5ff){_0x2c199f['setDataValue'](_0xd69e('0x9'),_0x38d5ff[_0xd69e('0xa')](function(_0x35fa0a){return{'id':_0x35fa0a['id']};}));return OpenchannelMessage[_0xd69e('0xb')]({'where':{'OpenchannelInteractionId':_0x2c199f['id'],'direction':'in','read':![]},'raw':!![]});})[_0xd69e('0x8')](function(_0xbea638){_0x2c199f[_0xd69e('0xc')](_0xd69e('0xd'),_0xbea638[_0xd69e('0xe')]);OpenchannelInteractionEvents[_0xd69e('0xf')](_0x509890+':'+_0x2c199f['id'],_0x2c199f);OpenchannelInteractionEvents[_0xd69e('0xf')](_0x509890,_0x2c199f);_0x43f81a(null);})[_0xd69e('0x10')](_0x43f81a(null));};}for(var e in events){if(events[_0xd69e('0x11')](e)){var event=events[e];OpenchannelInteraction[_0xd69e('0x12')](e,emitEvent(event));}}module[_0xd69e('0x13')]=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index 1fea9e7..aa17114 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 _0x4ffd=['lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment','./openchannelInteraction.attributes','exports','define','OpenchannelInteraction','openchannel_interactions','utf8mb4','utf8mb4_unicode_ci','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x462992,_0x1f07dd){var _0x5ca986=function(_0x490019){while(--_0x490019){_0x462992['push'](_0x462992['shift']());}};_0x5ca986(++_0x1f07dd);}(_0x4ffd,0x78));var _0xd4ff=function(_0x3e531a,_0x28a82a){_0x3e531a=_0x3e531a-0x0;var _0x3c2574=_0x4ffd[_0x3e531a];return _0x3c2574;};'use strict';var _=require(_0xd4ff('0x0'));var util=require(_0xd4ff('0x1'));var logger=require(_0xd4ff('0x2'))(_0xd4ff('0x3'));var moment=require(_0xd4ff('0x4'));var BPromise=require(_0xd4ff('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd4ff('0x6'));var rimraf=require('rimraf');var config=require(_0xd4ff('0x7'));var attributes=require(_0xd4ff('0x8'));module[_0xd4ff('0x9')]=function(_0x49bf8c,_0x320018){return _0x49bf8c[_0xd4ff('0xa')](_0xd4ff('0xb'),attributes,{'tableName':_0xd4ff('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xd4ff('0xd'),'collate':_0xd4ff('0xe'),'hooks':{'beforeUpdate':function(_0x1b19ef,_0x1f9368,_0x42f058){if(_0x1b19ef[_0xd4ff('0xf')](_0xd4ff('0x10'))){_0x1b19ef[_0xd4ff('0x11')]=moment()[_0xd4ff('0x12')](_0xd4ff('0x13'));}_0x42f058(null,_0x1b19ef);}}});}; \ No newline at end of file +var _0xb19a=['request-promise','path','rimraf','../../config/environment','define','OpenchannelInteraction','utf8mb4','changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0xb19a,0x12c));var _0xab19=function(_0x4b93b4,_0x5c5b92){_0x4b93b4=_0x4b93b4-0x0;var _0x26e8a8=_0xb19a[_0x4b93b4];return _0x26e8a8;};'use strict';var _=require(_0xab19('0x0'));var util=require(_0xab19('0x1'));var logger=require(_0xab19('0x2'))(_0xab19('0x3'));var moment=require(_0xab19('0x4'));var BPromise=require(_0xab19('0x5'));var rp=require(_0xab19('0x6'));var fs=require('fs');var path=require(_0xab19('0x7'));var rimraf=require(_0xab19('0x8'));var config=require(_0xab19('0x9'));var attributes=require('./openchannelInteraction.attributes');module['exports']=function(_0x143aeb,_0x4b3ce8){return _0x143aeb[_0xab19('0xa')](_0xab19('0xb'),attributes,{'tableName':'openchannel_interactions','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xab19('0xc'),'collate':'utf8mb4_unicode_ci','hooks':{'beforeUpdate':function(_0x2e55cc,_0x146b49,_0x51cedc){if(_0x2e55cc[_0xab19('0xd')]('closed')){_0x2e55cc[_0xab19('0xe')]=moment()[_0xab19('0xf')](_0xab19('0x10'));}_0x51cedc(null,_0x2e55cc);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index 567aa7f..d580c41 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 _0x5836=['request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','error','message','result','UpdateOpenchannelInteraction','update','options','raw','attributes','limit','stringify','catch','AddTagsToOpenchannelInteraction','OpenchannelInteraction','find','addTags','body','omit','ids','spread','AddTags','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','./openchannelInteraction.socket','register','request','then','info','OpenchannelInteraction,\x20%s,\x20%s'];(function(_0x25e54d,_0x2507b9){var _0x4422b5=function(_0x5484fc){while(--_0x5484fc){_0x25e54d['push'](_0x25e54d['shift']());}};_0x4422b5(++_0x2507b9);}(_0x5836,0x167));var _0x6583=function(_0xa7662e,_0x22304d){_0xa7662e=_0xa7662e-0x0;var _0x425053=_0x5836[_0xa7662e];return _0x425053;};'use strict';var _=require(_0x6583('0x0'));var util=require(_0x6583('0x1'));var moment=require('moment');var BPromise=require(_0x6583('0x2'));var rs=require(_0x6583('0x3'));var fs=require('fs');var Redis=require(_0x6583('0x4'));var db=require(_0x6583('0x5'))['db'];var utils=require(_0x6583('0x6'));var logger=require(_0x6583('0x7'))('rpc');var config=require(_0x6583('0x8'));var jayson=require(_0x6583('0x9'));var client=jayson['client'][_0x6583('0xa')]({'port':0x232a});config[_0x6583('0xb')]=_[_0x6583('0xc')](config[_0x6583('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6583('0xb')]));require(_0x6583('0xd'))[_0x6583('0xe')](socket);function respondWithRpcPromise(_0x39838c,_0x5baeba,_0xbb4ac6){return new BPromise(function(_0x372e62,_0x4734bd){return client[_0x6583('0xf')](_0x39838c,_0xbb4ac6)[_0x6583('0x10')](function(_0x24ea7f){logger[_0x6583('0x11')](_0x6583('0x12'),_0x5baeba,_0x6583('0x13'));logger[_0x6583('0x14')](_0x6583('0x15'),_0x5baeba,'request\x20sent',JSON['stringify'](_0x24ea7f));if(_0x24ea7f[_0x6583('0x16')]){if(_0x24ea7f[_0x6583('0x16')]['code']===0x1f4){logger[_0x6583('0x16')]('OpenchannelInteraction,\x20%s,\x20%s',_0x5baeba,_0x24ea7f[_0x6583('0x16')]['message']);return _0x4734bd(_0x24ea7f['error'][_0x6583('0x17')]);}logger[_0x6583('0x16')](_0x6583('0x12'),_0x5baeba,_0x24ea7f[_0x6583('0x16')][_0x6583('0x17')]);return _0x372e62(_0x24ea7f[_0x6583('0x16')][_0x6583('0x17')]);}else{logger['info'](_0x6583('0x12'),_0x5baeba,_0x6583('0x13'));_0x372e62(_0x24ea7f[_0x6583('0x18')][_0x6583('0x17')]);}})['catch'](function(_0xc68c11){logger[_0x6583('0x16')](_0x6583('0x12'),_0x5baeba,_0xc68c11);_0x4734bd(_0xc68c11);});});}exports[_0x6583('0x19')]=function(_0x4aa522){var _0xc3ddac=this;return new Promise(function(_0x32c912,_0x24b736){return db['OpenchannelInteraction'][_0x6583('0x1a')](_0x4aa522['body'],{'raw':_0x4aa522[_0x6583('0x1b')]?_0x4aa522[_0x6583('0x1b')][_0x6583('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4aa522[_0x6583('0x1b')]?_0x4aa522[_0x6583('0x1b')]['where']||null:null,'attributes':_0x4aa522[_0x6583('0x1b')]?_0x4aa522[_0x6583('0x1b')][_0x6583('0x1d')]||null:null,'limit':_0x4aa522[_0x6583('0x1b')]?_0x4aa522[_0x6583('0x1b')][_0x6583('0x1e')]||null:null})['then'](function(_0x2c59b5){logger[_0x6583('0x11')]('UpdateOpenchannelInteraction',_0x4aa522);logger[_0x6583('0x14')](_0x6583('0x19'),_0x4aa522,JSON[_0x6583('0x1f')](_0x2c59b5));_0x32c912(_0x2c59b5);})[_0x6583('0x20')](function(_0x31e4c2){logger[_0x6583('0x16')](_0x6583('0x19'),_0x31e4c2[_0x6583('0x17')],_0x4aa522);_0x24b736(_0xc3ddac[_0x6583('0x16')](0x1f4,_0x31e4c2[_0x6583('0x17')]));});});};exports[_0x6583('0x21')]=function(_0x305cd8){return new Promise(function(_0x3fb130,_0x5869e7){return db[_0x6583('0x22')][_0x6583('0x23')]({'where':_0x305cd8['options']?_0x305cd8[_0x6583('0x1b')]['where']||null:null})[_0x6583('0x10')](function(_0x54d3da){if(_0x54d3da){return _0x54d3da[_0x6583('0x24')](_0x305cd8[_0x6583('0x25')]['ids'],_[_0x6583('0x26')](_0x305cd8['body'],[_0x6583('0x27'),'id'])||{});}})[_0x6583('0x28')](function(_0x9c45ba){logger['info']('AddTags',_0x305cd8);logger[_0x6583('0x14')](_0x6583('0x29'),_0x305cd8,JSON[_0x6583('0x1f')](_0x9c45ba));_0x3fb130(_0x9c45ba);})['catch'](function(_0x4d3aeb){logger['error'](_0x6583('0x29'),_0x4d3aeb[_0x6583('0x17')],_0x305cd8);_0x5869e7(_this[_0x6583('0x16')](0x1f4,_0x4d3aeb[_0x6583('0x17')]));});});}; \ No newline at end of file +var _0xef42=['info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','code','error','message','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','body','options','raw','where','attributes','limit','AddTagsToOpenchannelInteraction','find','addTags','ids','omit','spread','AddTags','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','socket.io-emitter','./openchannelInteraction.socket','register','request','then'];(function(_0x51b1a0,_0xdd7248){var _0x22c981=function(_0x3c2137){while(--_0x3c2137){_0x51b1a0['push'](_0x51b1a0['shift']());}};_0x22c981(++_0xdd7248);}(_0xef42,0x193));var _0x2ef4=function(_0x55daf2,_0x1b48de){_0x55daf2=_0x55daf2-0x0;var _0x1c8500=_0xef42[_0x55daf2];return _0x1c8500;};'use strict';var _=require(_0x2ef4('0x0'));var util=require('util');var moment=require(_0x2ef4('0x1'));var BPromise=require(_0x2ef4('0x2'));var rs=require(_0x2ef4('0x3'));var fs=require('fs');var Redis=require(_0x2ef4('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2ef4('0x5'));var logger=require(_0x2ef4('0x6'))(_0x2ef4('0x7'));var config=require(_0x2ef4('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x2ef4('0x9')][_0x2ef4('0xa')]({'port':0x232a});config['redis']=_['defaults'](config[_0x2ef4('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x2ef4('0xc'))(new Redis(config['redis']));require(_0x2ef4('0xd'))[_0x2ef4('0xe')](socket);function respondWithRpcPromise(_0x12aca7,_0x5d0272,_0x546c8d){return new BPromise(function(_0x54d05a,_0x36c0db){return client[_0x2ef4('0xf')](_0x12aca7,_0x546c8d)[_0x2ef4('0x10')](function(_0x3848ce){logger[_0x2ef4('0x11')](_0x2ef4('0x12'),_0x5d0272,_0x2ef4('0x13'));logger[_0x2ef4('0x14')](_0x2ef4('0x15'),_0x5d0272,'request\x20sent',JSON[_0x2ef4('0x16')](_0x3848ce));if(_0x3848ce['error']){if(_0x3848ce['error'][_0x2ef4('0x17')]===0x1f4){logger[_0x2ef4('0x18')](_0x2ef4('0x12'),_0x5d0272,_0x3848ce['error'][_0x2ef4('0x19')]);return _0x36c0db(_0x3848ce['error'][_0x2ef4('0x19')]);}logger['error'](_0x2ef4('0x12'),_0x5d0272,_0x3848ce[_0x2ef4('0x18')][_0x2ef4('0x19')]);return _0x54d05a(_0x3848ce['error']['message']);}else{logger[_0x2ef4('0x11')](_0x2ef4('0x12'),_0x5d0272,_0x2ef4('0x13'));_0x54d05a(_0x3848ce['result'][_0x2ef4('0x19')]);}})[_0x2ef4('0x1a')](function(_0x455496){logger[_0x2ef4('0x18')](_0x2ef4('0x12'),_0x5d0272,_0x455496);_0x36c0db(_0x455496);});});}exports[_0x2ef4('0x1b')]=function(_0x39602d){var _0x4d0ea5=this;return new Promise(function(_0x18c516,_0x3e9692){return db[_0x2ef4('0x1c')]['update'](_0x39602d[_0x2ef4('0x1d')],{'raw':_0x39602d[_0x2ef4('0x1e')]?_0x39602d[_0x2ef4('0x1e')][_0x2ef4('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x39602d[_0x2ef4('0x1e')]?_0x39602d[_0x2ef4('0x1e')][_0x2ef4('0x20')]||null:null,'attributes':_0x39602d[_0x2ef4('0x1e')]?_0x39602d['options'][_0x2ef4('0x21')]||null:null,'limit':_0x39602d[_0x2ef4('0x1e')]?_0x39602d[_0x2ef4('0x1e')][_0x2ef4('0x22')]||null:null})[_0x2ef4('0x10')](function(_0x1c7884){logger[_0x2ef4('0x11')](_0x2ef4('0x1b'),_0x39602d);logger[_0x2ef4('0x14')]('UpdateOpenchannelInteraction',_0x39602d,JSON['stringify'](_0x1c7884));_0x18c516(_0x1c7884);})[_0x2ef4('0x1a')](function(_0x3fbbee){logger[_0x2ef4('0x18')]('UpdateOpenchannelInteraction',_0x3fbbee[_0x2ef4('0x19')],_0x39602d);_0x3e9692(_0x4d0ea5['error'](0x1f4,_0x3fbbee['message']));});});};exports[_0x2ef4('0x23')]=function(_0x49063a){return new Promise(function(_0x54619e,_0x756a0a){return db['OpenchannelInteraction'][_0x2ef4('0x24')]({'where':_0x49063a['options']?_0x49063a[_0x2ef4('0x1e')][_0x2ef4('0x20')]||null:null})[_0x2ef4('0x10')](function(_0x58df97){if(_0x58df97){return _0x58df97[_0x2ef4('0x25')](_0x49063a[_0x2ef4('0x1d')][_0x2ef4('0x26')],_[_0x2ef4('0x27')](_0x49063a['body'],[_0x2ef4('0x26'),'id'])||{});}})[_0x2ef4('0x28')](function(_0x14e413){logger[_0x2ef4('0x11')](_0x2ef4('0x29'),_0x49063a);logger[_0x2ef4('0x14')](_0x2ef4('0x29'),_0x49063a,JSON[_0x2ef4('0x16')](_0x14e413));_0x54619e(_0x14e413);})[_0x2ef4('0x1a')](function(_0x5dde2c){logger[_0x2ef4('0x18')](_0x2ef4('0x29'),_0x5dde2c[_0x2ef4('0x19')],_0x49063a);_0x756a0a(_this[_0x2ef4('0x18')](0x1f4,_0x5dde2c[_0x2ef4('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index 8bb7a17..2d54b73 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 _0xda41=['emit','removeListener','length','openchannelInteraction:','./openchannelInteraction.events','remove','update'];(function(_0xbeb87b,_0x33f51a){var _0x31b236=function(_0x4d0797){while(--_0x4d0797){_0xbeb87b['push'](_0xbeb87b['shift']());}};_0x31b236(++_0x33f51a);}(_0xda41,0x185));var _0x1da4=function(_0x4d941c,_0x4d17e8){_0x4d941c=_0x4d941c-0x0;var _0x3ac66e=_0xda41[_0x4d941c];return _0x3ac66e;};'use strict';var OpenchannelInteractionEvents=require(_0x1da4('0x0'));var events=['save',_0x1da4('0x1'),_0x1da4('0x2')];function createListener(_0x39c306,_0x4a9822){return function(_0x329743){_0x4a9822[_0x1da4('0x3')](_0x39c306,_0x329743);};}function removeListener(_0x55ef8c,_0x598913){return function(){OpenchannelInteractionEvents[_0x1da4('0x4')](_0x55ef8c,_0x598913);};}exports['register']=function(_0x504c7a){for(var _0x4d4092=0x0,_0x17ba3f=events[_0x1da4('0x5')];_0x4d4092<_0x17ba3f;_0x4d4092++){var _0x3a1de4=events[_0x4d4092];var _0x17b3de=createListener(_0x1da4('0x6')+_0x3a1de4,_0x504c7a);OpenchannelInteractionEvents['on'](_0x3a1de4,_0x17b3de);}}; \ No newline at end of file +var _0x0b86=['update','emit','removeListener','register','length','openchannelInteraction:','./openchannelInteraction.events','save','remove'];(function(_0x24eb27,_0x5ad6f5){var _0x5cebc2=function(_0x85d37d){while(--_0x85d37d){_0x24eb27['push'](_0x24eb27['shift']());}};_0x5cebc2(++_0x5ad6f5);}(_0x0b86,0xd5));var _0x60b8=function(_0x35f15b,_0x387db3){_0x35f15b=_0x35f15b-0x0;var _0x262619=_0x0b86[_0x35f15b];return _0x262619;};'use strict';var OpenchannelInteractionEvents=require(_0x60b8('0x0'));var events=[_0x60b8('0x1'),_0x60b8('0x2'),_0x60b8('0x3')];function createListener(_0x459a1c,_0x464b3a){return function(_0x2bc578){_0x464b3a[_0x60b8('0x4')](_0x459a1c,_0x2bc578);};}function removeListener(_0x2168d5,_0x3f4244){return function(){OpenchannelInteractionEvents[_0x60b8('0x5')](_0x2168d5,_0x3f4244);};}exports[_0x60b8('0x6')]=function(_0x3a9159){for(var _0x490d31=0x0,_0x18482b=events[_0x60b8('0x7')];_0x490d31<_0x18482b;_0x490d31++){var _0x1e8f25=events[_0x490d31];var _0x5716ce=createListener(_0x60b8('0x8')+_0x1e8f25,_0x3a9159);OpenchannelInteractionEvents['on'](_0x1e8f25,_0x5716ce);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index 5f58147..d1b2ee3 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(_0x5c22d3,_0xb597f){var _0x3a5664=function(_0x478ab4){while(--_0x478ab4){_0x5c22d3['push'](_0x5c22d3['shift']());}};_0x3a5664(++_0xb597f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0xa9e0[_0x55f8b4];return _0x2475f9;};'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(_0xf36f94,_0x4131ea){var _0x165ef7=function(_0x116420){while(--_0x116420){_0xf36f94['push'](_0xf36f94['shift']());}};_0x165ef7(++_0x4131ea);}(_0xe706,0xa3));var _0x6e70=function(_0x3b1705,_0x17bf2e){_0x3b1705=_0x3b1705-0x0;var _0x5157a3=_0xe706[_0x3b1705];return _0x5157a3;};'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 52fd500..01e4e5c 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 _0x453b=['BOOLEAN','ENUM','out','DATE','STRING','sequelize','exports','TEXT','medium'];(function(_0x3cc340,_0x30face){var _0x18e0a0=function(_0x580579){while(--_0x580579){_0x3cc340['push'](_0x3cc340['shift']());}};_0x18e0a0(++_0x30face);}(_0x453b,0x164));var _0xb453=function(_0x1fa760,_0x1bf063){_0x1fa760=_0x1fa760-0x0;var _0xd8eda1=_0x453b[_0x1fa760];return _0xd8eda1;};'use strict';var Sequelize=require(_0xb453('0x0'));module[_0xb453('0x1')]={'body':{'type':Sequelize[_0xb453('0x2')](_0xb453('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xb453('0x4')],'defaultValue':![]},'secret':{'type':Sequelize[_0xb453('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xb453('0x5')]('in',_0xb453('0x6')),'defaultValue':_0xb453('0x6'),'allowNull':![]},'readAt':{'type':Sequelize[_0xb453('0x7')]},'providerName':{'type':Sequelize[_0xb453('0x8')]},'providerResponse':{'type':Sequelize[_0xb453('0x2')]}}; \ No newline at end of file +var _0x4b0f=['out','DATE','STRING','exports','TEXT','medium','BOOLEAN','ENUM'];(function(_0x3eb8a2,_0x212a08){var _0x1ffdca=function(_0x3e4cff){while(--_0x3e4cff){_0x3eb8a2['push'](_0x3eb8a2['shift']());}};_0x1ffdca(++_0x212a08);}(_0x4b0f,0xa3));var _0xf4b0=function(_0x2d21af,_0x3bcd20){_0x2d21af=_0x2d21af-0x0;var _0x3767fe=_0x4b0f[_0x2d21af];return _0x3767fe;};'use strict';var Sequelize=require('sequelize');module[_0xf4b0('0x0')]={'body':{'type':Sequelize[_0xf4b0('0x1')](_0xf4b0('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0xf4b0('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xf4b0('0x4')]('in',_0xf4b0('0x5')),'defaultValue':_0xf4b0('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0xf4b0('0x6')]},'providerName':{'type':Sequelize[_0xf4b0('0x7')]},'providerResponse':{'type':Sequelize[_0xf4b0('0x1')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index b7d5d12..fa6beaf 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 _0xcc21=['filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','count','include','findAll','show','params','OpenchannelMessage','includeAll','find','create','body','describe','accept','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','OpenchannelInteractionId','isNil','read1stAt','format','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','QueryTypes','SELECT','contact','User','agent','fullname','email','internal','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','openchannel-interactions','openchannel','OpenchannelInteraction','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','ContactId','rejectmessage','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','squel','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','localhost','socket.io-emitter','register','jayson/promise','client','http','then','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','error','message','info','catch','sendStatus','end','status','offset','limit','undefined','set','Content-Range','json','apply','reject','save','update','destroy','name','send','index','rawAttributes','fieldName','type','key','model','map','query','keys'];(function(_0xbacfad,_0x52a356){var _0x32c2f9=function(_0x4fabec){while(--_0x4fabec){_0xbacfad['push'](_0xbacfad['shift']());}};_0x32c2f9(++_0x52a356);}(_0xcc21,0xc7));var _0x1cc2=function(_0x23f19e,_0x4d583b){_0x23f19e=_0x23f19e-0x0;var _0x2a95d4=_0xcc21[_0x23f19e];return _0x2a95d4;};'use strict';var emlformat=require(_0x1cc2('0x0'));var rimraf=require(_0x1cc2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1cc2('0x2'));var rp=require(_0x1cc2('0x3'));var moment=require(_0x1cc2('0x4'));var BPromise=require(_0x1cc2('0x5'));var Mustache=require(_0x1cc2('0x6'));var util=require('util');var path=require(_0x1cc2('0x7'));var sox=require(_0x1cc2('0x8'));var csv=require(_0x1cc2('0x9'));var ejs=require(_0x1cc2('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x1cc2('0xb'));var crypto=require('crypto');var jsforce=require(_0x1cc2('0xc'));var deskjs=require(_0x1cc2('0xd'));var toCsv=require(_0x1cc2('0x9'));var querystring=require('querystring');var Papa=require(_0x1cc2('0xe'));var Redis=require(_0x1cc2('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x1cc2('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1cc2('0x11'));var logger=require(_0x1cc2('0x12'))(_0x1cc2('0x13'));var utils=require(_0x1cc2('0x14'));var config=require(_0x1cc2('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x1cc2('0x16')]=_['defaults'](config[_0x1cc2('0x16')],{'host':_0x1cc2('0x17'),'port':0x18eb});var socket=require(_0x1cc2('0x18'))(new Redis(config[_0x1cc2('0x16')]));require('./openchannelMessage.socket')[_0x1cc2('0x19')](socket);var jayson=require(_0x1cc2('0x1a'));var client=jayson[_0x1cc2('0x1b')][_0x1cc2('0x1c')]({'port':0x232c});var client9002=jayson[_0x1cc2('0x1b')][_0x1cc2('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x20b901,_0x42bec0,_0x298973,_0x49cdeb){return new BPromise(function(_0x1a3212,_0x5b09f9){var _0x44ee56=_0x49cdeb||client;return _0x44ee56['request'](_0x20b901,_0x298973)[_0x1cc2('0x1d')](function(_0x4ba25c){logger['info'](_0x1cc2('0x1e'),_0x42bec0,_0x1cc2('0x1f'));logger['debug']('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x42bec0,_0x1cc2('0x1f'),JSON['stringify'](_0x4ba25c));if(_0x4ba25c['error']){if(_0x4ba25c[_0x1cc2('0x20')]['code']===0x1f4){logger[_0x1cc2('0x20')]('OpenchannelMessage,\x20%s,\x20%s',_0x42bec0,_0x4ba25c[_0x1cc2('0x20')][_0x1cc2('0x21')]);return _0x5b09f9(_0x4ba25c['error'][_0x1cc2('0x21')]);}logger[_0x1cc2('0x20')]('OpenchannelMessage,\x20%s,\x20%s',_0x42bec0,_0x4ba25c[_0x1cc2('0x20')][_0x1cc2('0x21')]);return _0x1a3212(_0x4ba25c['error']['message']);}else{logger[_0x1cc2('0x22')]('OpenchannelMessage,\x20%s,\x20%s',_0x42bec0,'request\x20sent');_0x1a3212(_0x4ba25c['result'][_0x1cc2('0x21')]);}})[_0x1cc2('0x23')](function(_0x42ea7d){logger[_0x1cc2('0x20')](_0x1cc2('0x1e'),_0x42bec0,_0x42ea7d);_0x5b09f9(_0x42ea7d);});});}function respondWithStatusCode(_0x42d86d,_0x416d94){_0x416d94=_0x416d94||0xcc;return function(_0xa2cefb){if(_0xa2cefb){return _0x42d86d[_0x1cc2('0x24')](_0x416d94);}return _0x42d86d['status'](_0x416d94)[_0x1cc2('0x25')]();};}function respondWithResult(_0x54eaa4,_0x42c318){_0x42c318=_0x42c318||0xc8;return function(_0x355862){if(_0x355862){return _0x54eaa4[_0x1cc2('0x26')](_0x42c318)['json'](_0x355862);}};}function respondWithFilteredResult(_0x17b067,_0x564848){return function(_0x45a3b2){if(_0x45a3b2){var _0x23e865=typeof _0x564848[_0x1cc2('0x27')]==='undefined'&&typeof _0x564848[_0x1cc2('0x28')]===_0x1cc2('0x29');var _0x1f1816=_0x45a3b2['count'];var _0x5c107d=_0x23e865?0x0:_0x564848[_0x1cc2('0x27')];var _0x95ff84=_0x23e865?_0x45a3b2['count']:_0x564848['offset']+_0x564848[_0x1cc2('0x28')];var _0xd8703c;if(_0x95ff84>=_0x1f1816){_0x95ff84=_0x1f1816;_0xd8703c=0xc8;}else{_0xd8703c=0xce;}_0x17b067['status'](_0xd8703c);return _0x17b067[_0x1cc2('0x2a')](_0x1cc2('0x2b'),_0x5c107d+'-'+_0x95ff84+'/'+_0x1f1816)[_0x1cc2('0x2c')](_0x45a3b2);}return null;};}function patchUpdates(_0x4f6bf9){return function(_0x2e17d6){try{jsonpatch[_0x1cc2('0x2d')](_0x2e17d6,_0x4f6bf9,!![]);}catch(_0xdd3450){return BPromise[_0x1cc2('0x2e')](_0xdd3450);}return _0x2e17d6[_0x1cc2('0x2f')]();};}function saveUpdates(_0x59c409,_0x147744){return function(_0x18635b){if(_0x18635b){return _0x18635b[_0x1cc2('0x30')](_0x59c409)[_0x1cc2('0x1d')](function(_0x3aab0b){return _0x3aab0b;});}return null;};}function removeEntity(_0x449258,_0x12fdad){return function(_0x10d762){if(_0x10d762){return _0x10d762[_0x1cc2('0x31')]()[_0x1cc2('0x1d')](function(){_0x449258[_0x1cc2('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x420523,_0x15f96a){return function(_0x2203ed){if(!_0x2203ed){_0x420523['sendStatus'](0x194);}return _0x2203ed;};}function handleError(_0x3d67bc,_0x3174bd){_0x3174bd=_0x3174bd||0x1f4;return function(_0x2d1be1){logger[_0x1cc2('0x20')](_0x2d1be1['stack']);if(_0x2d1be1[_0x1cc2('0x32')]){delete _0x2d1be1[_0x1cc2('0x32')];}_0x3d67bc['status'](_0x3174bd)[_0x1cc2('0x33')](_0x2d1be1);};}exports[_0x1cc2('0x34')]=function(_0x5b930f,_0x2efa4d){var _0x4ba107={},_0xe48f6f={},_0x85efde={'count':0x0,'rows':[]};var _0x3f5d15=_['map'](db['OpenchannelMessage'][_0x1cc2('0x35')],function(_0x4dab02){return{'name':_0x4dab02[_0x1cc2('0x36')],'type':_0x4dab02[_0x1cc2('0x37')][_0x1cc2('0x38')]};});_0xe48f6f[_0x1cc2('0x39')]=_[_0x1cc2('0x3a')](_0x3f5d15,'name');_0xe48f6f[_0x1cc2('0x3b')]=_[_0x1cc2('0x3c')](_0x5b930f[_0x1cc2('0x3b')]);_0xe48f6f[_0x1cc2('0x3d')]=_[_0x1cc2('0x3e')](_0xe48f6f['model'],_0xe48f6f[_0x1cc2('0x3b')]);_0x4ba107[_0x1cc2('0x3f')]=_[_0x1cc2('0x3e')](_0xe48f6f[_0x1cc2('0x39')],qs['fields'](_0x5b930f['query'][_0x1cc2('0x40')]));_0x4ba107['attributes']=_0x4ba107[_0x1cc2('0x3f')][_0x1cc2('0x41')]?_0x4ba107[_0x1cc2('0x3f')]:_0xe48f6f['model'];if(!_0x5b930f[_0x1cc2('0x3b')][_0x1cc2('0x42')](_0x1cc2('0x43'))){_0x4ba107['limit']=qs[_0x1cc2('0x28')](_0x5b930f[_0x1cc2('0x3b')][_0x1cc2('0x28')]);_0x4ba107[_0x1cc2('0x27')]=qs[_0x1cc2('0x27')](_0x5b930f[_0x1cc2('0x3b')][_0x1cc2('0x27')]);}_0x4ba107[_0x1cc2('0x44')]=qs[_0x1cc2('0x45')](_0x5b930f[_0x1cc2('0x3b')][_0x1cc2('0x45')]);_0x4ba107[_0x1cc2('0x46')]=qs['filters'](_['pick'](_0x5b930f[_0x1cc2('0x3b')],_0xe48f6f[_0x1cc2('0x3d')]),_0x3f5d15);if(_0x5b930f['query'][_0x1cc2('0x47')]){_0x4ba107['where']=_[_0x1cc2('0x48')](_0x4ba107[_0x1cc2('0x46')],{'$or':_[_0x1cc2('0x3a')](_0x3f5d15,function(_0x2b0b50){if(_0x2b0b50['type']!==_0x1cc2('0x49')){var _0x511401={};_0x511401[_0x2b0b50[_0x1cc2('0x32')]]={'$like':'%'+_0x5b930f['query']['filter']+'%'};return _0x511401;}})});}_0x4ba107=_[_0x1cc2('0x48')]({},_0x4ba107,_0x5b930f[_0x1cc2('0x4a')]);var _0x11f721={'where':_0x4ba107[_0x1cc2('0x46')]};return db['OpenchannelMessage'][_0x1cc2('0x4b')](_0x11f721)[_0x1cc2('0x1d')](function(_0x1209a1){_0x85efde[_0x1cc2('0x4b')]=_0x1209a1;if(_0x5b930f[_0x1cc2('0x3b')]['includeAll']){_0x4ba107[_0x1cc2('0x4c')]=[{'all':!![]}];}return db['OpenchannelMessage'][_0x1cc2('0x4d')](_0x4ba107);})[_0x1cc2('0x1d')](function(_0x50573e){_0x85efde['rows']=_0x50573e;return _0x85efde;})[_0x1cc2('0x1d')](respondWithFilteredResult(_0x2efa4d,_0x4ba107))['catch'](handleError(_0x2efa4d,null));};exports[_0x1cc2('0x4e')]=function(_0xb63cff,_0x1d0020){var _0x5859b2={'raw':!![],'where':{'id':_0xb63cff[_0x1cc2('0x4f')]['id']}},_0x2f21d7={};_0x2f21d7[_0x1cc2('0x39')]=_['keys'](db[_0x1cc2('0x50')][_0x1cc2('0x35')]);_0x2f21d7[_0x1cc2('0x3b')]=_['keys'](_0xb63cff['query']);_0x2f21d7[_0x1cc2('0x3d')]=_[_0x1cc2('0x3e')](_0x2f21d7['model'],_0x2f21d7[_0x1cc2('0x3b')]);_0x5859b2['attributes']=_[_0x1cc2('0x3e')](_0x2f21d7[_0x1cc2('0x39')],qs[_0x1cc2('0x40')](_0xb63cff[_0x1cc2('0x3b')]['fields']));_0x5859b2['attributes']=_0x5859b2['attributes'][_0x1cc2('0x41')]?_0x5859b2['attributes']:_0x2f21d7[_0x1cc2('0x39')];if(_0xb63cff[_0x1cc2('0x3b')][_0x1cc2('0x51')]){_0x5859b2[_0x1cc2('0x4c')]=[{'all':!![]}];}_0x5859b2=_[_0x1cc2('0x48')]({},_0x5859b2,_0xb63cff[_0x1cc2('0x4a')]);return db[_0x1cc2('0x50')][_0x1cc2('0x52')](_0x5859b2)['then'](handleEntityNotFound(_0x1d0020,null))[_0x1cc2('0x1d')](respondWithResult(_0x1d0020,null))[_0x1cc2('0x23')](handleError(_0x1d0020,null));};exports[_0x1cc2('0x53')]=function(_0x1a4d85,_0x5a9678){return db[_0x1cc2('0x50')][_0x1cc2('0x53')](_0x1a4d85[_0x1cc2('0x54')],{})[_0x1cc2('0x1d')](respondWithResult(_0x5a9678,0xc9))['catch'](handleError(_0x5a9678,null));};exports[_0x1cc2('0x30')]=function(_0x2f561e,_0x52868a){if(_0x2f561e[_0x1cc2('0x54')]['id']){delete _0x2f561e[_0x1cc2('0x54')]['id'];}return db['OpenchannelMessage'][_0x1cc2('0x52')]({'where':{'id':_0x2f561e['params']['id']}})[_0x1cc2('0x1d')](handleEntityNotFound(_0x52868a,null))[_0x1cc2('0x1d')](saveUpdates(_0x2f561e[_0x1cc2('0x54')],null))[_0x1cc2('0x1d')](respondWithResult(_0x52868a,null))[_0x1cc2('0x23')](handleError(_0x52868a,null));};exports[_0x1cc2('0x31')]=function(_0x4091fc,_0x480fec){return db['OpenchannelMessage'][_0x1cc2('0x52')]({'where':{'id':_0x4091fc[_0x1cc2('0x4f')]['id']}})[_0x1cc2('0x1d')](handleEntityNotFound(_0x480fec,null))[_0x1cc2('0x1d')](removeEntity(_0x480fec,null))[_0x1cc2('0x23')](handleError(_0x480fec,null));};exports[_0x1cc2('0x55')]=function(_0x11f2b7,_0x56d6a2){return db[_0x1cc2('0x50')][_0x1cc2('0x55')]()['then'](respondWithResult(_0x56d6a2,null))[_0x1cc2('0x23')](handleError(_0x56d6a2,null));};var interaction_log=require(_0x1cc2('0x12'))('openchannel-interactions');exports[_0x1cc2('0x56')]=function(_0x4e8142,_0x403a16,_0x18d03f){var _0x50ff7c={'agent':{},'channel':'openchannel'};if(_0x4e8142[_0x1cc2('0x54')]['id']){delete _0x4e8142[_0x1cc2('0x54')]['id'];}_0x4e8142[_0x1cc2('0x54')][_0x1cc2('0x57')]=!![];_0x4e8142[_0x1cc2('0x54')][_0x1cc2('0x58')]=moment()['format'](_0x1cc2('0x59'));_0x4e8142[_0x1cc2('0x54')]['UserId']=_0x4e8142[_0x1cc2('0x54')][_0x1cc2('0x5a')]||_0x4e8142[_0x1cc2('0x5b')]['id'];_0x50ff7c['agent']['id']=_0x4e8142[_0x1cc2('0x54')][_0x1cc2('0x5a')];return db[_0x1cc2('0x50')][_0x1cc2('0x52')]({'where':{'id':_0x4e8142[_0x1cc2('0x4f')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x403a16,null))['then'](saveUpdates(_0x4e8142[_0x1cc2('0x54')],null))[_0x1cc2('0x1d')](function(_0x43fb09){if(_0x43fb09){_0x50ff7c['message']=_0x43fb09[_0x1cc2('0x5c')]({'plain':!![]});return db['OpenchannelInteraction'][_0x1cc2('0x52')]({'where':{'id':_0x43fb09[_0x1cc2('0x5d')]}});}return null;})[_0x1cc2('0x1d')](handleEntityNotFound(_0x403a16,null))[_0x1cc2('0x1d')](function(_0x56f6f4){if(_0x56f6f4){return _0x56f6f4['update']({'UserId':_0x4e8142['body']['UserId'],'read1stAt':_[_0x1cc2('0x5e')](_0x56f6f4[_0x1cc2('0x5f')])?moment()[_0x1cc2('0x60')](_0x1cc2('0x59')):undefined});}return null;})[_0x1cc2('0x1d')](function(_0x14c0d5){if(_0x14c0d5){_0x50ff7c[_0x1cc2('0x61')]=_0x14c0d5[_0x1cc2('0x5c')]({'plain':!![]});interaction_log[_0x1cc2('0x22')](_0x1cc2('0x62'),_0x4e8142['user']['id'],_0x4e8142[_0x1cc2('0x5b')][_0x1cc2('0x32')],_0x4e8142[_0x1cc2('0x5b')][_0x1cc2('0x63')],_0x50ff7c['interaction']['id'],_0x4e8142[_0x1cc2('0x54')]?JSON[_0x1cc2('0x64')](_0x4e8142['body']):'null');return respondWithRpcPromise(_0x1cc2('0x65'),_0x1cc2('0x66'),_0x50ff7c);}return null;})[_0x1cc2('0x1d')](function(_0x11561d){var _0x363960=_0x1cc2('0x67')+_0x11561d[_0x1cc2('0x21')]['ContactId'];return db[_0x1cc2('0x68')]['query'](_0x363960,{'type':db[_0x1cc2('0x69')][_0x1cc2('0x6a')][_0x1cc2('0x6b')],'raw':!![]})[_0x1cc2('0x1d')](function(_0x1d7a9e){return _0x1d7a9e;});})[_0x1cc2('0x1d')](function(_0x5d1440){if(_0x5d1440){_0x50ff7c[_0x1cc2('0x21')][_0x1cc2('0x6c')]=_0x5d1440[0x0];if(!_0x4e8142[_0x1cc2('0x54')][_0x1cc2('0x5a')])return;return db[_0x1cc2('0x6d')]['find']({'where':{'id':_0x4e8142[_0x1cc2('0x54')][_0x1cc2('0x5a')],'role':_0x1cc2('0x6e')},'attributes':['id','name',_0x1cc2('0x6f'),_0x1cc2('0x70'),_0x1cc2('0x71')],'raw':!![]});}return null;})[_0x1cc2('0x1d')](function(_0x393859){if(!_0x393859)return null;_0x50ff7c[_0x1cc2('0x21')]['agent']=_0x393859;return _0x50ff7c;})[_0x1cc2('0x1d')](function(_0x52f5c1){if(_0x52f5c1){if(_0x4e8142[_0x1cc2('0x54')]['manual']){_0x50ff7c['message'][_0x1cc2('0x72')]=util[_0x1cc2('0x60')](_0x1cc2('0x73'),_0x4e8142[_0x1cc2('0x5b')][_0x1cc2('0x32')]);_0x50ff7c[_0x1cc2('0x21')][_0x1cc2('0x74')]=_0x50ff7c[_0x1cc2('0x74')];_0x50ff7c[_0x1cc2('0x21')][_0x1cc2('0x75')]=_0x50ff7c['channel'];_0x50ff7c[_0x1cc2('0x21')][_0x1cc2('0x76')]=_0x1cc2('0x56');return respondWithRpcPromise('EventManager',_0x1cc2('0x77'),{'event':_0x1cc2('0x78'),'message':_0x50ff7c[_0x1cc2('0x21')]},client9002)[_0x1cc2('0x1d')](function(){return _0x50ff7c;});}return _0x50ff7c;}return null;})[_0x1cc2('0x1d')](respondWithResult(_0x403a16,null))[_0x1cc2('0x23')](handleError(_0x403a16,null));};var interaction_log=require(_0x1cc2('0x12'))(_0x1cc2('0x79'));exports[_0x1cc2('0x2e')]=function(_0x1b5a0e,_0x77f7ad,_0x76154b){var _0x32bfba={'agent':{},'channel':_0x1cc2('0x7a')};if(_0x1b5a0e[_0x1cc2('0x54')]['id']){delete _0x1b5a0e[_0x1cc2('0x54')]['id'];}_0x1b5a0e[_0x1cc2('0x54')][_0x1cc2('0x5a')]=_0x1b5a0e[_0x1cc2('0x54')][_0x1cc2('0x5a')]||_0x1b5a0e[_0x1cc2('0x5b')]['id'];_0x32bfba[_0x1cc2('0x6e')]['id']=_0x1b5a0e[_0x1cc2('0x54')]['UserId'];return db['OpenchannelMessage'][_0x1cc2('0x52')]({'where':{'id':_0x1b5a0e[_0x1cc2('0x4f')]['id'],'UserId':null}})[_0x1cc2('0x1d')](handleEntityNotFound(_0x77f7ad,null))[_0x1cc2('0x1d')](function(_0x3887c9){if(_0x3887c9){_0x32bfba[_0x1cc2('0x21')]=_0x3887c9[_0x1cc2('0x5c')]({'plain':!![]});return db[_0x1cc2('0x7b')]['find']({'where':{'id':_0x3887c9[_0x1cc2('0x5d')]}});}return null;})[_0x1cc2('0x1d')](handleEntityNotFound(_0x77f7ad,null))[_0x1cc2('0x1d')](function(_0x55152b){if(_0x55152b){_0x32bfba[_0x1cc2('0x61')]=_0x55152b[_0x1cc2('0x5c')]({'plain':!![]});interaction_log[_0x1cc2('0x22')](_0x1cc2('0x7c'),_0x1b5a0e[_0x1cc2('0x5b')]['id'],_0x1b5a0e['user'][_0x1cc2('0x32')],_0x1b5a0e[_0x1cc2('0x5b')]['role'],_0x32bfba['interaction']['id'],_0x1b5a0e[_0x1cc2('0x54')]?JSON[_0x1cc2('0x64')](_0x1b5a0e['body']):_0x1cc2('0x7d'));return respondWithRpcPromise(_0x1cc2('0x7e'),_0x1cc2('0x7f'),_0x32bfba);}return null;})['then'](function(_0x186b51){var _0x558fab=_0x1cc2('0x67')+_0x186b51[_0x1cc2('0x21')][_0x1cc2('0x80')];return db['sequelize'][_0x1cc2('0x3b')](_0x558fab,{'type':db[_0x1cc2('0x69')]['QueryTypes']['SELECT'],'raw':!![]})[_0x1cc2('0x1d')](function(_0xeaf956){return _0xeaf956;});})[_0x1cc2('0x1d')](function(_0x4d6d6f){if(_0x4d6d6f){_0x32bfba[_0x1cc2('0x21')][_0x1cc2('0x6c')]=_0x4d6d6f[0x0];if(!_0x1b5a0e[_0x1cc2('0x54')]['UserId'])return;return db['User'][_0x1cc2('0x52')]({'where':{'id':_0x1b5a0e[_0x1cc2('0x54')][_0x1cc2('0x5a')],'role':_0x1cc2('0x6e')},'attributes':['id',_0x1cc2('0x32'),_0x1cc2('0x6f'),_0x1cc2('0x70'),_0x1cc2('0x71')],'raw':!![]});}return null;})[_0x1cc2('0x1d')](function(_0x38a64d){if(!_0x38a64d)return null;_0x32bfba[_0x1cc2('0x21')]['agent']=_0x38a64d;return _0x32bfba;})[_0x1cc2('0x1d')](function(_0x165aad){if(_0x165aad){_0x165aad[_0x1cc2('0x21')][_0x1cc2('0x72')]=util[_0x1cc2('0x60')]('SIP/%s',_0x1b5a0e[_0x1cc2('0x5b')][_0x1cc2('0x32')]);_0x165aad[_0x1cc2('0x21')][_0x1cc2('0x74')]=_0x32bfba['channel'];_0x165aad[_0x1cc2('0x21')]['motionChannel']=_0x32bfba[_0x1cc2('0x74')];_0x165aad[_0x1cc2('0x21')]['event']='reject';respondWithRpcPromise('EventManager',_0x1cc2('0x77'),{'event':_0x1cc2('0x81'),'message':_0x165aad[_0x1cc2('0x21')]},client9002);return _0x32bfba;}return null;})[_0x1cc2('0x1d')](respondWithResult(_0x77f7ad,null))[_0x1cc2('0x23')](handleError(_0x77f7ad,null));}; \ No newline at end of file +var _0x3657=['fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','find','create','body','describe','openchannel-interactions','accept','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','OpenchannelInteraction','OpenchannelInteractionId','isNil','read1stAt','format','interaction','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','SELECT','contact','User','internal','manual','interface','SIP/%s','channel','motionChannel','EventManager','acceptmessage','openchannel','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','sequelize','QueryTypes','fullname','email','event','rejectmessage','rimraf','zip-dir','request-promise','moment','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','register','jayson/promise','http','client','then','info','OpenchannelMessage,\x20%s,\x20%s','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','end','status','offset','limit','undefined','count','set','Content-Range','json','reject','save','update','destroy','name','send','index','map','OpenchannelMessage','rawAttributes'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x3657,0xcd));var _0x7365=function(_0x34bc6c,_0x10d089){_0x34bc6c=_0x34bc6c-0x0;var _0x168820=_0x3657[_0x34bc6c];return _0x168820;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7365('0x0'));var zipdir=require(_0x7365('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7365('0x2'));var moment=require(_0x7365('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x7365('0x4'));var sox=require(_0x7365('0x5'));var csv=require(_0x7365('0x6'));var ejs=require(_0x7365('0x7'));var fs=require('fs');var fs_extra=require(_0x7365('0x8'));var _=require(_0x7365('0x9'));var squel=require(_0x7365('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x7365('0xb'));var toCsv=require(_0x7365('0x6'));var querystring=require(_0x7365('0xc'));var Papa=require(_0x7365('0xd'));var Redis=require(_0x7365('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x7365('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7365('0x10'));var logger=require(_0x7365('0x11'))(_0x7365('0x12'));var utils=require(_0x7365('0x13'));var config=require(_0x7365('0x14'));var licenseUtil=require(_0x7365('0x15'));var db=require(_0x7365('0x16'))['db'];config[_0x7365('0x17')]=_[_0x7365('0x18')](config[_0x7365('0x17')],{'host':_0x7365('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7365('0x17')]));require('./openchannelMessage.socket')[_0x7365('0x1a')](socket);var jayson=require(_0x7365('0x1b'));var client=jayson['client'][_0x7365('0x1c')]({'port':0x232c});var client9002=jayson[_0x7365('0x1d')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1481a0,_0x2d0251,_0x1c3b45,_0xd9ec6c){return new BPromise(function(_0x5a81d8,_0x4af180){var _0x42d5ef=_0xd9ec6c||client;return _0x42d5ef['request'](_0x1481a0,_0x1c3b45)[_0x7365('0x1e')](function(_0x39ec6b){logger[_0x7365('0x1f')](_0x7365('0x20'),_0x2d0251,'request\x20sent');logger[_0x7365('0x21')](_0x7365('0x22'),_0x2d0251,_0x7365('0x23'),JSON[_0x7365('0x24')](_0x39ec6b));if(_0x39ec6b[_0x7365('0x25')]){if(_0x39ec6b[_0x7365('0x25')]['code']===0x1f4){logger[_0x7365('0x25')]('OpenchannelMessage,\x20%s,\x20%s',_0x2d0251,_0x39ec6b[_0x7365('0x25')][_0x7365('0x26')]);return _0x4af180(_0x39ec6b['error'][_0x7365('0x26')]);}logger['error'](_0x7365('0x20'),_0x2d0251,_0x39ec6b['error'][_0x7365('0x26')]);return _0x5a81d8(_0x39ec6b[_0x7365('0x25')][_0x7365('0x26')]);}else{logger[_0x7365('0x1f')](_0x7365('0x20'),_0x2d0251,_0x7365('0x23'));_0x5a81d8(_0x39ec6b['result'][_0x7365('0x26')]);}})[_0x7365('0x27')](function(_0x416f20){logger[_0x7365('0x25')](_0x7365('0x20'),_0x2d0251,_0x416f20);_0x4af180(_0x416f20);});});}function respondWithStatusCode(_0x1d752e,_0x1777d8){_0x1777d8=_0x1777d8||0xcc;return function(_0x45d282){if(_0x45d282){return _0x1d752e['sendStatus'](_0x1777d8);}return _0x1d752e['status'](_0x1777d8)[_0x7365('0x28')]();};}function respondWithResult(_0x342dd8,_0xc35e4d){_0xc35e4d=_0xc35e4d||0xc8;return function(_0x1aa364){if(_0x1aa364){return _0x342dd8[_0x7365('0x29')](_0xc35e4d)['json'](_0x1aa364);}};}function respondWithFilteredResult(_0x5eda72,_0x50e8a0){return function(_0x44eb71){if(_0x44eb71){var _0x103976=typeof _0x50e8a0[_0x7365('0x2a')]==='undefined'&&typeof _0x50e8a0[_0x7365('0x2b')]===_0x7365('0x2c');var _0x2608c5=_0x44eb71[_0x7365('0x2d')];var _0x23ecba=_0x103976?0x0:_0x50e8a0['offset'];var _0x2faef5=_0x103976?_0x44eb71[_0x7365('0x2d')]:_0x50e8a0['offset']+_0x50e8a0[_0x7365('0x2b')];var _0xcd26cc;if(_0x2faef5>=_0x2608c5){_0x2faef5=_0x2608c5;_0xcd26cc=0xc8;}else{_0xcd26cc=0xce;}_0x5eda72[_0x7365('0x29')](_0xcd26cc);return _0x5eda72[_0x7365('0x2e')](_0x7365('0x2f'),_0x23ecba+'-'+_0x2faef5+'/'+_0x2608c5)[_0x7365('0x30')](_0x44eb71);}return null;};}function patchUpdates(_0x35cccc){return function(_0x5ba2fc){try{jsonpatch['apply'](_0x5ba2fc,_0x35cccc,!![]);}catch(_0x3f47ba){return BPromise[_0x7365('0x31')](_0x3f47ba);}return _0x5ba2fc[_0x7365('0x32')]();};}function saveUpdates(_0x337ed0,_0x57c472){return function(_0xbfcfaa){if(_0xbfcfaa){return _0xbfcfaa[_0x7365('0x33')](_0x337ed0)['then'](function(_0x27540d){return _0x27540d;});}return null;};}function removeEntity(_0x4fb451,_0x5b3eb7){return function(_0x7a8e82){if(_0x7a8e82){return _0x7a8e82[_0x7365('0x34')]()[_0x7365('0x1e')](function(){_0x4fb451[_0x7365('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x7b2ae7,_0x12edef){return function(_0x264273){if(!_0x264273){_0x7b2ae7['sendStatus'](0x194);}return _0x264273;};}function handleError(_0x1be626,_0x5d2823){_0x5d2823=_0x5d2823||0x1f4;return function(_0x52b3ad){logger['error'](_0x52b3ad['stack']);if(_0x52b3ad[_0x7365('0x35')]){delete _0x52b3ad[_0x7365('0x35')];}_0x1be626['status'](_0x5d2823)[_0x7365('0x36')](_0x52b3ad);};}exports[_0x7365('0x37')]=function(_0x3ba89f,_0x5572de){var _0x2189f0={},_0x5ef182={},_0x2a5e32={'count':0x0,'rows':[]};var _0x200e30=_[_0x7365('0x38')](db[_0x7365('0x39')][_0x7365('0x3a')],function(_0x3fa842){return{'name':_0x3fa842[_0x7365('0x3b')],'type':_0x3fa842[_0x7365('0x3c')][_0x7365('0x3d')]};});_0x5ef182[_0x7365('0x3e')]=_[_0x7365('0x38')](_0x200e30,'name');_0x5ef182[_0x7365('0x3f')]=_[_0x7365('0x40')](_0x3ba89f[_0x7365('0x3f')]);_0x5ef182[_0x7365('0x41')]=_[_0x7365('0x42')](_0x5ef182[_0x7365('0x3e')],_0x5ef182[_0x7365('0x3f')]);_0x2189f0['attributes']=_[_0x7365('0x42')](_0x5ef182['model'],qs[_0x7365('0x43')](_0x3ba89f[_0x7365('0x3f')][_0x7365('0x43')]));_0x2189f0['attributes']=_0x2189f0[_0x7365('0x44')][_0x7365('0x45')]?_0x2189f0['attributes']:_0x5ef182[_0x7365('0x3e')];if(!_0x3ba89f[_0x7365('0x3f')]['hasOwnProperty'](_0x7365('0x46'))){_0x2189f0[_0x7365('0x2b')]=qs['limit'](_0x3ba89f[_0x7365('0x3f')]['limit']);_0x2189f0['offset']=qs[_0x7365('0x2a')](_0x3ba89f[_0x7365('0x3f')][_0x7365('0x2a')]);}_0x2189f0[_0x7365('0x47')]=qs[_0x7365('0x48')](_0x3ba89f[_0x7365('0x3f')][_0x7365('0x48')]);_0x2189f0[_0x7365('0x49')]=qs[_0x7365('0x41')](_[_0x7365('0x4a')](_0x3ba89f['query'],_0x5ef182[_0x7365('0x41')]),_0x200e30);if(_0x3ba89f['query'][_0x7365('0x4b')]){_0x2189f0[_0x7365('0x49')]=_['merge'](_0x2189f0[_0x7365('0x49')],{'$or':_[_0x7365('0x38')](_0x200e30,function(_0x4925a0){if(_0x4925a0[_0x7365('0x3c')]!==_0x7365('0x4c')){var _0x32ed38={};_0x32ed38[_0x4925a0[_0x7365('0x35')]]={'$like':'%'+_0x3ba89f['query'][_0x7365('0x4b')]+'%'};return _0x32ed38;}})});}_0x2189f0=_[_0x7365('0x4d')]({},_0x2189f0,_0x3ba89f[_0x7365('0x4e')]);var _0x7529b6={'where':_0x2189f0[_0x7365('0x49')]};return db[_0x7365('0x39')][_0x7365('0x2d')](_0x7529b6)['then'](function(_0x3844e9){_0x2a5e32[_0x7365('0x2d')]=_0x3844e9;if(_0x3ba89f['query'][_0x7365('0x4f')]){_0x2189f0[_0x7365('0x50')]=[{'all':!![]}];}return db[_0x7365('0x39')][_0x7365('0x51')](_0x2189f0);})[_0x7365('0x1e')](function(_0x4677c1){_0x2a5e32[_0x7365('0x52')]=_0x4677c1;return _0x2a5e32;})[_0x7365('0x1e')](respondWithFilteredResult(_0x5572de,_0x2189f0))[_0x7365('0x27')](handleError(_0x5572de,null));};exports[_0x7365('0x53')]=function(_0x1f2e4a,_0x53aa2d){var _0x16134c={'raw':!![],'where':{'id':_0x1f2e4a[_0x7365('0x54')]['id']}},_0x1b25c7={};_0x1b25c7[_0x7365('0x3e')]=_[_0x7365('0x40')](db[_0x7365('0x39')][_0x7365('0x3a')]);_0x1b25c7[_0x7365('0x3f')]=_['keys'](_0x1f2e4a[_0x7365('0x3f')]);_0x1b25c7[_0x7365('0x41')]=_[_0x7365('0x42')](_0x1b25c7[_0x7365('0x3e')],_0x1b25c7['query']);_0x16134c[_0x7365('0x44')]=_[_0x7365('0x42')](_0x1b25c7['model'],qs[_0x7365('0x43')](_0x1f2e4a[_0x7365('0x3f')][_0x7365('0x43')]));_0x16134c[_0x7365('0x44')]=_0x16134c['attributes'][_0x7365('0x45')]?_0x16134c[_0x7365('0x44')]:_0x1b25c7[_0x7365('0x3e')];if(_0x1f2e4a[_0x7365('0x3f')][_0x7365('0x4f')]){_0x16134c[_0x7365('0x50')]=[{'all':!![]}];}_0x16134c=_[_0x7365('0x4d')]({},_0x16134c,_0x1f2e4a[_0x7365('0x4e')]);return db['OpenchannelMessage'][_0x7365('0x55')](_0x16134c)[_0x7365('0x1e')](handleEntityNotFound(_0x53aa2d,null))[_0x7365('0x1e')](respondWithResult(_0x53aa2d,null))['catch'](handleError(_0x53aa2d,null));};exports[_0x7365('0x56')]=function(_0x55e776,_0x3ed1){return db['OpenchannelMessage'][_0x7365('0x56')](_0x55e776['body'],{})[_0x7365('0x1e')](respondWithResult(_0x3ed1,0xc9))[_0x7365('0x27')](handleError(_0x3ed1,null));};exports['update']=function(_0x22d6c9,_0x3c399c){if(_0x22d6c9[_0x7365('0x57')]['id']){delete _0x22d6c9[_0x7365('0x57')]['id'];}return db[_0x7365('0x39')][_0x7365('0x55')]({'where':{'id':_0x22d6c9['params']['id']}})[_0x7365('0x1e')](handleEntityNotFound(_0x3c399c,null))[_0x7365('0x1e')](saveUpdates(_0x22d6c9[_0x7365('0x57')],null))[_0x7365('0x1e')](respondWithResult(_0x3c399c,null))[_0x7365('0x27')](handleError(_0x3c399c,null));};exports[_0x7365('0x34')]=function(_0x4ca86f,_0x22a00e){return db[_0x7365('0x39')]['find']({'where':{'id':_0x4ca86f[_0x7365('0x54')]['id']}})[_0x7365('0x1e')](handleEntityNotFound(_0x22a00e,null))[_0x7365('0x1e')](removeEntity(_0x22a00e,null))['catch'](handleError(_0x22a00e,null));};exports['describe']=function(_0x1a0c84,_0x2b713c){return db['OpenchannelMessage'][_0x7365('0x58')]()[_0x7365('0x1e')](respondWithResult(_0x2b713c,null))['catch'](handleError(_0x2b713c,null));};var interaction_log=require(_0x7365('0x11'))(_0x7365('0x59'));exports[_0x7365('0x5a')]=function(_0x3586ab,_0x2efef4,_0xe6ee2f){var _0x588389={'agent':{},'channel':'openchannel'};if(_0x3586ab[_0x7365('0x57')]['id']){delete _0x3586ab[_0x7365('0x57')]['id'];}_0x3586ab['body'][_0x7365('0x5b')]=!![];_0x3586ab[_0x7365('0x57')][_0x7365('0x5c')]=moment()['format'](_0x7365('0x5d'));_0x3586ab[_0x7365('0x57')][_0x7365('0x5e')]=_0x3586ab[_0x7365('0x57')]['UserId']||_0x3586ab[_0x7365('0x5f')]['id'];_0x588389[_0x7365('0x60')]['id']=_0x3586ab['body'][_0x7365('0x5e')];return db[_0x7365('0x39')][_0x7365('0x55')]({'where':{'id':_0x3586ab[_0x7365('0x54')]['id'],'UserId':null}})[_0x7365('0x1e')](handleEntityNotFound(_0x2efef4,null))['then'](saveUpdates(_0x3586ab['body'],null))['then'](function(_0x117d8a){if(_0x117d8a){_0x588389['message']=_0x117d8a[_0x7365('0x61')]({'plain':!![]});return db[_0x7365('0x62')][_0x7365('0x55')]({'where':{'id':_0x117d8a[_0x7365('0x63')]}});}return null;})['then'](handleEntityNotFound(_0x2efef4,null))['then'](function(_0x4e8494){if(_0x4e8494){return _0x4e8494[_0x7365('0x33')]({'UserId':_0x3586ab[_0x7365('0x57')][_0x7365('0x5e')],'read1stAt':_[_0x7365('0x64')](_0x4e8494[_0x7365('0x65')])?moment()[_0x7365('0x66')](_0x7365('0x5d')):undefined});}return null;})[_0x7365('0x1e')](function(_0x19f23a){if(_0x19f23a){_0x588389[_0x7365('0x67')]=_0x19f23a[_0x7365('0x61')]({'plain':!![]});interaction_log[_0x7365('0x1f')]('[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x3586ab[_0x7365('0x5f')]['id'],_0x3586ab[_0x7365('0x5f')]['name'],_0x3586ab[_0x7365('0x5f')][_0x7365('0x68')],_0x588389[_0x7365('0x67')]['id'],_0x3586ab['body']?JSON[_0x7365('0x24')](_0x3586ab[_0x7365('0x57')]):_0x7365('0x69'));return respondWithRpcPromise(_0x7365('0x6a'),_0x7365('0x6b'),_0x588389);}return null;})[_0x7365('0x1e')](function(_0x32ee3f){var _0x5ec07a=_0x7365('0x6c')+_0x32ee3f[_0x7365('0x26')][_0x7365('0x6d')];return db['sequelize'][_0x7365('0x3f')](_0x5ec07a,{'type':db[_0x7365('0x6e')]['QueryTypes'][_0x7365('0x6f')],'raw':!![]})['then'](function(_0x58ad14){return _0x58ad14;});})[_0x7365('0x1e')](function(_0x13e483){if(_0x13e483){_0x588389['message'][_0x7365('0x70')]=_0x13e483[0x0];if(!_0x3586ab[_0x7365('0x57')][_0x7365('0x5e')])return;return db[_0x7365('0x71')][_0x7365('0x55')]({'where':{'id':_0x3586ab['body'][_0x7365('0x5e')],'role':'agent'},'attributes':['id',_0x7365('0x35'),'fullname','email',_0x7365('0x72')],'raw':!![]});}return null;})[_0x7365('0x1e')](function(_0x139721){if(!_0x139721)return null;_0x588389['message']['agent']=_0x139721;return _0x588389;})[_0x7365('0x1e')](function(_0x586ee6){if(_0x586ee6){if(_0x3586ab[_0x7365('0x57')][_0x7365('0x73')]){_0x588389[_0x7365('0x26')][_0x7365('0x74')]=util['format'](_0x7365('0x75'),_0x3586ab[_0x7365('0x5f')][_0x7365('0x35')]);_0x588389[_0x7365('0x26')][_0x7365('0x76')]=_0x588389[_0x7365('0x76')];_0x588389[_0x7365('0x26')][_0x7365('0x77')]=_0x588389['channel'];_0x588389[_0x7365('0x26')]['event']=_0x7365('0x5a');return respondWithRpcPromise(_0x7365('0x78'),_0x7365('0x78'),{'event':_0x7365('0x79'),'message':_0x588389[_0x7365('0x26')]},client9002)[_0x7365('0x1e')](function(){return _0x588389;});}return _0x588389;}return null;})[_0x7365('0x1e')](respondWithResult(_0x2efef4,null))[_0x7365('0x27')](handleError(_0x2efef4,null));};var interaction_log=require(_0x7365('0x11'))(_0x7365('0x59'));exports[_0x7365('0x31')]=function(_0x1e3547,_0x23f133,_0x47467f){var _0x115491={'agent':{},'channel':_0x7365('0x7a')};if(_0x1e3547[_0x7365('0x57')]['id']){delete _0x1e3547[_0x7365('0x57')]['id'];}_0x1e3547[_0x7365('0x57')]['UserId']=_0x1e3547[_0x7365('0x57')][_0x7365('0x5e')]||_0x1e3547['user']['id'];_0x115491[_0x7365('0x60')]['id']=_0x1e3547[_0x7365('0x57')][_0x7365('0x5e')];return db['OpenchannelMessage']['find']({'where':{'id':_0x1e3547[_0x7365('0x54')]['id'],'UserId':null}})[_0x7365('0x1e')](handleEntityNotFound(_0x23f133,null))[_0x7365('0x1e')](function(_0x6e19f4){if(_0x6e19f4){_0x115491['message']=_0x6e19f4[_0x7365('0x61')]({'plain':!![]});return db['OpenchannelInteraction']['find']({'where':{'id':_0x6e19f4[_0x7365('0x63')]}});}return null;})[_0x7365('0x1e')](handleEntityNotFound(_0x23f133,null))[_0x7365('0x1e')](function(_0x16ea46){if(_0x16ea46){_0x115491['interaction']=_0x16ea46[_0x7365('0x61')]({'plain':!![]});interaction_log[_0x7365('0x1f')](_0x7365('0x7b'),_0x1e3547['user']['id'],_0x1e3547[_0x7365('0x5f')]['name'],_0x1e3547['user']['role'],_0x115491['interaction']['id'],_0x1e3547['body']?JSON[_0x7365('0x24')](_0x1e3547[_0x7365('0x57')]):_0x7365('0x69'));return respondWithRpcPromise(_0x7365('0x7c'),_0x7365('0x7d'),_0x115491);}return null;})[_0x7365('0x1e')](function(_0x43ff32){var _0x4a4d56=_0x7365('0x6c')+_0x43ff32['message'][_0x7365('0x6d')];return db[_0x7365('0x7e')][_0x7365('0x3f')](_0x4a4d56,{'type':db[_0x7365('0x6e')][_0x7365('0x7f')]['SELECT'],'raw':!![]})[_0x7365('0x1e')](function(_0x4b32e7){return _0x4b32e7;});})[_0x7365('0x1e')](function(_0x330a22){if(_0x330a22){_0x115491[_0x7365('0x26')][_0x7365('0x70')]=_0x330a22[0x0];if(!_0x1e3547[_0x7365('0x57')][_0x7365('0x5e')])return;return db['User'][_0x7365('0x55')]({'where':{'id':_0x1e3547[_0x7365('0x57')][_0x7365('0x5e')],'role':_0x7365('0x60')},'attributes':['id','name',_0x7365('0x80'),_0x7365('0x81'),_0x7365('0x72')],'raw':!![]});}return null;})['then'](function(_0x327c85){if(!_0x327c85)return null;_0x115491['message']['agent']=_0x327c85;return _0x115491;})[_0x7365('0x1e')](function(_0x1567c1){if(_0x1567c1){_0x1567c1[_0x7365('0x26')]['interface']=util['format'](_0x7365('0x75'),_0x1e3547[_0x7365('0x5f')][_0x7365('0x35')]);_0x1567c1[_0x7365('0x26')][_0x7365('0x76')]=_0x115491[_0x7365('0x76')];_0x1567c1[_0x7365('0x26')][_0x7365('0x77')]=_0x115491[_0x7365('0x76')];_0x1567c1[_0x7365('0x26')][_0x7365('0x82')]=_0x7365('0x31');respondWithRpcPromise(_0x7365('0x78'),_0x7365('0x78'),{'event':_0x7365('0x83'),'message':_0x1567c1[_0x7365('0x26')]},client9002);return _0x115491;}return null;})[_0x7365('0x1e')](respondWithResult(_0x23f133,null))['catch'](handleError(_0x23f133,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index 5afa0ad..98f3a45 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 _0xe3ca=['exports','events','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x27d37d,_0x4a1563){var _0x325a6a=function(_0x39094b){while(--_0x39094b){_0x27d37d['push'](_0x27d37d['shift']());}};_0x325a6a(++_0x4a1563);}(_0xe3ca,0x1d5));var _0xae3c=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xe3ca[_0x20a584];return _0x4b41a8;};'use strict';var EventEmitter=require(_0xae3c('0x0'));var OpenchannelMessage=require('../../mysqldb')['db']['OpenchannelMessage'];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0xae3c('0x1')](0x0);var events={'afterCreate':_0xae3c('0x2'),'afterUpdate':_0xae3c('0x3'),'afterDestroy':_0xae3c('0x4')};function emitEvent(_0x4cc2a6){return function(_0x5d8628,_0x24371e,_0x4f6a2a){OpenchannelMessageEvents[_0xae3c('0x5')](_0x4cc2a6+':'+_0x5d8628['id'],_0x5d8628);OpenchannelMessageEvents['emit'](_0x4cc2a6,_0x5d8628);_0x4f6a2a(null);};}for(var e in events){if(events[_0xae3c('0x6')](e)){var event=events[e];OpenchannelMessage[_0xae3c('0x7')](e,emitEvent(event));}}module[_0xae3c('0x8')]=OpenchannelMessageEvents; \ No newline at end of file +var _0xbf60=['../../mysqldb','update','hasOwnProperty','events'];(function(_0x49fa22,_0x3a8ccb){var _0x4af7a1=function(_0x5010c3){while(--_0x5010c3){_0x49fa22['push'](_0x49fa22['shift']());}};_0x4af7a1(++_0x3a8ccb);}(_0xbf60,0x127));var _0x0bf6=function(_0x13b7fd,_0x4eaf7f){_0x13b7fd=_0x13b7fd-0x0;var _0x32a74a=_0xbf60[_0x13b7fd];return _0x32a74a;};'use strict';var EventEmitter=require(_0x0bf6('0x0'));var OpenchannelMessage=require(_0x0bf6('0x1'))['db']['OpenchannelMessage'];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x0bf6('0x2'),'afterDestroy':'remove'};function emitEvent(_0x1cc908){return function(_0x297a38,_0x55c494,_0x531e29){OpenchannelMessageEvents['emit'](_0x1cc908+':'+_0x297a38['id'],_0x297a38);OpenchannelMessageEvents['emit'](_0x1cc908,_0x297a38);_0x531e29(null);};}for(var e in events){if(events[_0x0bf6('0x3')](e)){var event=events[e];OpenchannelMessage['hook'](e,emitEvent(event));}}module['exports']=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index 1c07e02..da6b0d1 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 _0x17d3=['OpenchannelInteraction','OpenchannelInteractionId','update','catch','error','CmContact','OpenchannelAccount','find','OpenchannelAccountId','Interactions','Contact','then','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','format','length','Interaction','method','GET','POST','threadId','inspect','finally','utf8mb4_unicode_ci','util','../../config/logger','api','moment','path','rimraf','../../config/environment','./openchannelMessage.attributes','exports','define','openchannel_messages','fti_openchannel_messages','body','FULLTEXT','models','get','toLowerCase','direction','out','secret','isNil'];(function(_0x22da96,_0xfc5108){var _0x5a35dd=function(_0x19f9bc){while(--_0x19f9bc){_0x22da96['push'](_0x22da96['shift']());}};_0x5a35dd(++_0xfc5108);}(_0x17d3,0x1c1));var _0x317d=function(_0x9f1809,_0x32f07e){_0x9f1809=_0x9f1809-0x0;var _0x23a67b=_0x17d3[_0x9f1809];return _0x23a67b;};'use strict';var _=require('lodash');var util=require(_0x317d('0x0'));var logger=require(_0x317d('0x1'))(_0x317d('0x2'));var moment=require(_0x317d('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x317d('0x4'));var rimraf=require(_0x317d('0x5'));var config=require(_0x317d('0x6'));var attributes=require(_0x317d('0x7'));module[_0x317d('0x8')]=function(_0x4edf74,_0x2c3767){return _0x4edf74[_0x317d('0x9')]('OpenchannelMessage',attributes,{'tableName':_0x317d('0xa'),'paranoid':![],'indexes':[{'name':_0x317d('0xb'),'fields':[_0x317d('0xc')],'type':_0x317d('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x56fd19,_0x4e9edf,_0x91c504){var _0x1acf28=_0x4edf74[_0x317d('0xe')];var _0x26a3b=_0x56fd19[_0x317d('0xf')]({'plain':!![]});if(_0x26a3b['direction'][_0x317d('0x10')]()==='in'||_0x26a3b[_0x317d('0x11')][_0x317d('0x10')]()===_0x317d('0x12')&&!_0x26a3b[_0x317d('0x13')]&&!_[_0x317d('0x14')](_0x26a3b['UserId'])){_0x1acf28[_0x317d('0x15')]['findOne']({'where':{'id':_0x26a3b[_0x317d('0x16')]}})['then'](function(_0x32dc85){if(_0x32dc85){_0x32dc85[_0x317d('0x17')]({'lastMsgAt':_0x26a3b['createdAt'],'lastMsgDirection':_0x26a3b[_0x317d('0x11')][_0x317d('0x10')]()});}})[_0x317d('0x18')](function(_0x1d650a){console[_0x317d('0x19')](_0x1d650a);});}if(_0x26a3b[_0x317d('0x11')]==='out'&&!_0x26a3b['secret']){var _0x195691;_0x1acf28[_0x317d('0x1a')]['describe']()['then'](function(_0x2fcf7c){return _0x1acf28[_0x317d('0x1b')][_0x317d('0x1c')]({'where':{'id':_0x26a3b[_0x317d('0x1d')]},'include':[{'model':_0x1acf28[_0x317d('0x15')],'as':_0x317d('0x1e'),'where':{'id':_0x26a3b[_0x317d('0x16')]},'limit':0x1,'include':[{'model':_0x1acf28['CmContact'],'as':_0x317d('0x1f'),'attributes':_['keys'](_0x2fcf7c)}]}]});})[_0x317d('0x20')](function(_0x5d01b9){_0x195691=_0x5d01b9[_0x317d('0xf')]({'plain':!![]});if(_0x195691&&_0x195691[_0x317d('0x21')]){logger[_0x317d('0x22')](_0x317d('0x23'),_0x317d('0x24'),util[_0x317d('0x25')]('Forwarding\x20message\x20%d\x20to\x20%s',_0x26a3b['id'],_0x195691['replyUri']));if(_0x195691['Interactions']&&_0x195691[_0x317d('0x1e')][_0x317d('0x26')]){_0x26a3b[_0x317d('0x27')]=_['omit'](_0x195691[_0x317d('0x1e')][0x0],_0x317d('0x1f'));_0x26a3b[_0x317d('0x1f')]=_0x195691['Interactions'][0x0][_0x317d('0x1f')];}var _0x4e9edf={'method':'POST','uri':encodeURI(_0x195691[_0x317d('0x21')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x4e9edf[_0x317d('0x28')]){case _0x317d('0x29'):_0x4e9edf['qs']=_0x26a3b;break;case _0x317d('0x2a'):_0x4e9edf[_0x317d('0xc')]=_0x26a3b;break;}return rp(_0x4e9edf)[_0x317d('0x20')](function(_0x1a58a6){logger['info']('OpenchannelMessage,\x20%s,\x20%s',_0x317d('0x24'),util['format']('Message\x20%d\x20forwarded\x20to\x20%s',_0x26a3b['id'],_0x195691['replyUri']));if(_0x1a58a6[_0x317d('0xc')]['threadId']&&_0x1a58a6[_0x317d('0xc')][_0x317d('0x2b')]!=_0x26a3b[_0x317d('0x27')][_0x317d('0x2b')]){return _0x1acf28[_0x317d('0x15')][_0x317d('0x17')]({'threadId':_0x1a58a6[_0x317d('0xc')]['threadId']},{'where':{'id':_0x26a3b[_0x317d('0x27')]['id']}});}else{return;}})[_0x317d('0x20')](function(){return _0x56fd19['update']({'read':!![]});})['catch'](function(_0x57fe22){logger[_0x317d('0x19')](_0x317d('0x23'),'afterCreate',util[_0x317d('0x2c')](_0x57fe22,{'showHidden':![],'depth':null}));_0x91c504();});}else{_0x91c504();}})[_0x317d('0x2d')](function(){_0x91c504();});}else{_0x91c504();}}},'charset':'utf8mb4','collate':_0x317d('0x2e')});}; \ No newline at end of file +var _0x0386=['lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./openchannelMessage.attributes','exports','define','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','OpenchannelInteraction','findOne','then','update','catch','OpenchannelAccount','find','OpenchannelAccountId','Interactions','OpenchannelInteractionId','CmContact','Contact','keys','replyUri','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','length','Interaction','omit','GET','POST','body','info','OpenchannelMessage,\x20%s,\x20%s','threadId','error','inspect','finally','utf8mb4','utf8mb4_unicode_ci'];(function(_0x434b03,_0x3971aa){var _0x5189a5=function(_0x41bfcb){while(--_0x41bfcb){_0x434b03['push'](_0x434b03['shift']());}};_0x5189a5(++_0x3971aa);}(_0x0386,0x6a));var _0x6038=function(_0x281110,_0x4b80ef){_0x281110=_0x281110-0x0;var _0x3d4622=_0x0386[_0x281110];return _0x3d4622;};'use strict';var _=require(_0x6038('0x0'));var util=require('util');var logger=require(_0x6038('0x1'))(_0x6038('0x2'));var moment=require(_0x6038('0x3'));var BPromise=require(_0x6038('0x4'));var rp=require(_0x6038('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6038('0x6'));var config=require(_0x6038('0x7'));var attributes=require(_0x6038('0x8'));module[_0x6038('0x9')]=function(_0x4b383f,_0x3348c5){return _0x4b383f[_0x6038('0xa')](_0x6038('0xb'),attributes,{'tableName':_0x6038('0xc'),'paranoid':![],'indexes':[{'name':_0x6038('0xd'),'fields':['body'],'type':_0x6038('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x55e7d7,_0x2178ef,_0x5ac36e){var _0x389bc6=_0x4b383f[_0x6038('0xf')];var _0x2b9a92=_0x55e7d7[_0x6038('0x10')]({'plain':!![]});if(_0x2b9a92[_0x6038('0x11')]['toLowerCase']()==='in'||_0x2b9a92[_0x6038('0x11')][_0x6038('0x12')]()===_0x6038('0x13')&&!_0x2b9a92[_0x6038('0x14')]&&!_[_0x6038('0x15')](_0x2b9a92['UserId'])){_0x389bc6[_0x6038('0x16')][_0x6038('0x17')]({'where':{'id':_0x2b9a92['OpenchannelInteractionId']}})[_0x6038('0x18')](function(_0x45925a){if(_0x45925a){_0x45925a[_0x6038('0x19')]({'lastMsgAt':_0x2b9a92['createdAt'],'lastMsgDirection':_0x2b9a92['direction'][_0x6038('0x12')]()});}})[_0x6038('0x1a')](function(_0x3c6d7d){console['error'](_0x3c6d7d);});}if(_0x2b9a92[_0x6038('0x11')]===_0x6038('0x13')&&!_0x2b9a92[_0x6038('0x14')]){var _0xa44c7a;_0x389bc6['CmContact']['describe']()[_0x6038('0x18')](function(_0x30f5d2){return _0x389bc6[_0x6038('0x1b')][_0x6038('0x1c')]({'where':{'id':_0x2b9a92[_0x6038('0x1d')]},'include':[{'model':_0x389bc6[_0x6038('0x16')],'as':_0x6038('0x1e'),'where':{'id':_0x2b9a92[_0x6038('0x1f')]},'limit':0x1,'include':[{'model':_0x389bc6[_0x6038('0x20')],'as':_0x6038('0x21'),'attributes':_[_0x6038('0x22')](_0x30f5d2)}]}]});})[_0x6038('0x18')](function(_0x25c5fc){_0xa44c7a=_0x25c5fc[_0x6038('0x10')]({'plain':!![]});if(_0xa44c7a&&_0xa44c7a[_0x6038('0x23')]){logger['info']('OpenchannelMessage,\x20%s,\x20%s',_0x6038('0x24'),util[_0x6038('0x25')](_0x6038('0x26'),_0x2b9a92['id'],_0xa44c7a[_0x6038('0x23')]));if(_0xa44c7a[_0x6038('0x1e')]&&_0xa44c7a[_0x6038('0x1e')][_0x6038('0x27')]){_0x2b9a92[_0x6038('0x28')]=_[_0x6038('0x29')](_0xa44c7a[_0x6038('0x1e')][0x0],_0x6038('0x21'));_0x2b9a92[_0x6038('0x21')]=_0xa44c7a['Interactions'][0x0][_0x6038('0x21')];}var _0x2178ef={'method':'POST','uri':encodeURI(_0xa44c7a[_0x6038('0x23')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x2178ef['method']){case _0x6038('0x2a'):_0x2178ef['qs']=_0x2b9a92;break;case _0x6038('0x2b'):_0x2178ef[_0x6038('0x2c')]=_0x2b9a92;break;}return rp(_0x2178ef)['then'](function(_0x4df398){logger[_0x6038('0x2d')](_0x6038('0x2e'),'afterCreate',util['format']('Message\x20%d\x20forwarded\x20to\x20%s',_0x2b9a92['id'],_0xa44c7a[_0x6038('0x23')]));if(_0x4df398[_0x6038('0x2c')][_0x6038('0x2f')]&&_0x4df398[_0x6038('0x2c')][_0x6038('0x2f')]!=_0x2b9a92[_0x6038('0x28')][_0x6038('0x2f')]){return _0x389bc6['OpenchannelInteraction'][_0x6038('0x19')]({'threadId':_0x4df398[_0x6038('0x2c')]['threadId']},{'where':{'id':_0x2b9a92[_0x6038('0x28')]['id']}});}else{return;}})[_0x6038('0x18')](function(){return _0x55e7d7['update']({'read':!![]});})[_0x6038('0x1a')](function(_0x17081f){logger[_0x6038('0x30')](_0x6038('0x2e'),_0x6038('0x24'),util[_0x6038('0x31')](_0x17081f,{'showHidden':![],'depth':null}));_0x5ac36e();});}else{_0x5ac36e();}})[_0x6038('0x32')](function(){_0x5ac36e();});}else{_0x5ac36e();}}},'charset':_0x6038('0x33'),'collate':_0x6038('0x34')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index 94d6eed..bb2e2f9 100644 --- a/server/api/openchannelMessage/openchannelMessage.rpc.js +++ b/server/api/openchannelMessage/openchannelMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['../../config/environment','jayson/promise','http','defaults','redis','socket.io-emitter','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateOpenchannelMessage','OpenchannelMessage','body','options','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x17e84d,_0x48d555){var _0x5ac2dd=function(_0x45c408){while(--_0x45c408){_0x17e84d['push'](_0x17e84d['shift']());}};_0x5ac2dd(++_0x48d555);}(_0x7a54,0x106));var _0x47a5=function(_0x4bf4b4,_0x1e0769){_0x4bf4b4=_0x4bf4b4-0x0;var _0x40846f=_0x7a54[_0x4bf4b4];return _0x40846f;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});config['redis']=_[_0x47a5('0xb')](config[_0x47a5('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x47a5('0xd'))(new Redis(config['redis']));require('./openchannelMessage.socket')['register'](socket);function respondWithRpcPromise(_0x2a0e98,_0x2baee7,_0x5e31dd){return new BPromise(function(_0x2eb0dd,_0x49e844){return client['request'](_0x2a0e98,_0x5e31dd)[_0x47a5('0xe')](function(_0x69e4d4){logger[_0x47a5('0xf')](_0x47a5('0x10'),_0x2baee7,_0x47a5('0x11'));logger[_0x47a5('0x12')](_0x47a5('0x13'),_0x2baee7,'request\x20sent',JSON[_0x47a5('0x14')](_0x69e4d4));if(_0x69e4d4[_0x47a5('0x15')]){if(_0x69e4d4[_0x47a5('0x15')][_0x47a5('0x16')]===0x1f4){logger[_0x47a5('0x15')](_0x47a5('0x10'),_0x2baee7,_0x69e4d4[_0x47a5('0x15')][_0x47a5('0x17')]);return _0x49e844(_0x69e4d4['error'][_0x47a5('0x17')]);}logger[_0x47a5('0x15')](_0x47a5('0x10'),_0x2baee7,_0x69e4d4[_0x47a5('0x15')][_0x47a5('0x17')]);return _0x2eb0dd(_0x69e4d4['error']['message']);}else{logger[_0x47a5('0xf')]('OpenchannelMessage,\x20%s,\x20%s',_0x2baee7,'request\x20sent');_0x2eb0dd(_0x69e4d4[_0x47a5('0x18')][_0x47a5('0x17')]);}})[_0x47a5('0x19')](function(_0x1ef371){logger[_0x47a5('0x15')](_0x47a5('0x10'),_0x2baee7,_0x1ef371);_0x49e844(_0x1ef371);});});}exports[_0x47a5('0x1a')]=function(_0xe3c618){var _0x3aed38=this;return new Promise(function(_0x4a9fcb,_0x1570bc){return db[_0x47a5('0x1b')]['create'](_0xe3c618[_0x47a5('0x1c')],{'raw':_0xe3c618[_0x47a5('0x1d')]?_0xe3c618[_0x47a5('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0x47a5('0xe')](function(_0x2f142b){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xe3c618);logger['debug'](_0x47a5('0x1a'),_0xe3c618,JSON[_0x47a5('0x14')](_0x2f142b));_0x4a9fcb(_0x2f142b);})['catch'](function(_0x28747d){logger[_0x47a5('0x15')](_0x47a5('0x1a'),_0x28747d[_0x47a5('0x17')],_0xe3c618);_0x1570bc(_0x3aed38[_0x47a5('0x15')](0x1f4,_0x28747d['message']));});});}; \ No newline at end of file +var _0x5f2f=['OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','OpenchannelMessage','create','options','raw','CreateOpenchannelMessage','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','then','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x1cd600,_0x4caf37){var _0x38c7f6=function(_0x4aa3bc){while(--_0x4aa3bc){_0x1cd600['push'](_0x1cd600['shift']());}};_0x38c7f6(++_0x4caf37);}(_0x5f2f,0x73));var _0xf5f2=function(_0x1f5102,_0x601f96){_0x1f5102=_0x1f5102-0x0;var _0x4f5545=_0x5f2f[_0x1f5102];return _0x4f5545;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});config[_0xf5f2('0xc')]=_[_0xf5f2('0xd')](config['redis'],{'host':_0xf5f2('0xe'),'port':0x18eb});var socket=require(_0xf5f2('0xf'))(new Redis(config[_0xf5f2('0xc')]));require('./openchannelMessage.socket')[_0xf5f2('0x10')](socket);function respondWithRpcPromise(_0x15dd7c,_0x218ae3,_0x4e0e6b){return new BPromise(function(_0x977a59,_0x4ebbbe){return client['request'](_0x15dd7c,_0x4e0e6b)[_0xf5f2('0x11')](function(_0x151aba){logger['info'](_0xf5f2('0x12'),_0x218ae3,_0xf5f2('0x13'));logger[_0xf5f2('0x14')](_0xf5f2('0x15'),_0x218ae3,_0xf5f2('0x13'),JSON[_0xf5f2('0x16')](_0x151aba));if(_0x151aba['error']){if(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x18')]===0x1f4){logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x151aba[_0xf5f2('0x17')]['message']);return _0x4ebbbe(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);}logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);return _0x977a59(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);}else{logger[_0xf5f2('0x1a')](_0xf5f2('0x12'),_0x218ae3,_0xf5f2('0x13'));_0x977a59(_0x151aba[_0xf5f2('0x1b')][_0xf5f2('0x19')]);}})[_0xf5f2('0x1c')](function(_0x3cf5ea){logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x3cf5ea);_0x4ebbbe(_0x3cf5ea);});});}exports['CreateOpenchannelMessage']=function(_0x34706d){var _0x47101e=this;return new Promise(function(_0x49dac2,_0x47acfc){return db[_0xf5f2('0x1d')][_0xf5f2('0x1e')](_0x34706d['body'],{'raw':_0x34706d[_0xf5f2('0x1f')]?_0x34706d[_0xf5f2('0x1f')][_0xf5f2('0x20')]===undefined?!![]:![]:!![]})[_0xf5f2('0x11')](function(_0x36f1cb){logger['info'](_0xf5f2('0x21'),_0x34706d);logger[_0xf5f2('0x14')](_0xf5f2('0x21'),_0x34706d,JSON[_0xf5f2('0x16')](_0x36f1cb));_0x49dac2(_0x36f1cb);})[_0xf5f2('0x1c')](function(_0x5bdf4a){logger['error'](_0xf5f2('0x21'),_0x5bdf4a[_0xf5f2('0x19')],_0x34706d);_0x47acfc(_0x47101e[_0xf5f2('0x17')](0x1f4,_0x5bdf4a[_0xf5f2('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index 6b94691..92a491b 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 _0x41d7=['removeListener','register','length','openchannelMessage:','save','remove','update','emit'];(function(_0x1e8ed1,_0x117474){var _0x7db831=function(_0x892fbc){while(--_0x892fbc){_0x1e8ed1['push'](_0x1e8ed1['shift']());}};_0x7db831(++_0x117474);}(_0x41d7,0x194));var _0x741d=function(_0x40a29f,_0x5d8f72){_0x40a29f=_0x40a29f-0x0;var _0x431d96=_0x41d7[_0x40a29f];return _0x431d96;};'use strict';var OpenchannelMessageEvents=require('./openchannelMessage.events');var events=[_0x741d('0x0'),_0x741d('0x1'),_0x741d('0x2')];function createListener(_0x2c94e0,_0x1373f1){return function(_0x2ba484){_0x1373f1[_0x741d('0x3')](_0x2c94e0,_0x2ba484);};}function removeListener(_0x545c74,_0x54b196){return function(){OpenchannelMessageEvents[_0x741d('0x4')](_0x545c74,_0x54b196);};}exports[_0x741d('0x5')]=function(_0x56ef68){for(var _0x3aa439=0x0,_0xe97c62=events[_0x741d('0x6')];_0x3aa439<_0xe97c62;_0x3aa439++){var _0x4c50e8=events[_0x3aa439];var _0x6ea7a1=createListener(_0x741d('0x7')+_0x4c50e8,_0x56ef68);OpenchannelMessageEvents['on'](_0x4c50e8,_0x6ea7a1);}}; \ No newline at end of file +var _0x0eab=['save','remove','update','emit','register','length','./openchannelMessage.events'];(function(_0x3c02dc,_0x25590d){var _0xbf19df=function(_0x3a7480){while(--_0x3a7480){_0x3c02dc['push'](_0x3c02dc['shift']());}};_0xbf19df(++_0x25590d);}(_0x0eab,0x1d4));var _0xb0ea=function(_0x28ba4e,_0x3f9461){_0x28ba4e=_0x28ba4e-0x0;var _0x40ac64=_0x0eab[_0x28ba4e];return _0x40ac64;};'use strict';var OpenchannelMessageEvents=require(_0xb0ea('0x0'));var events=[_0xb0ea('0x1'),_0xb0ea('0x2'),_0xb0ea('0x3')];function createListener(_0x419942,_0x32fc0f){return function(_0x2b4b1c){_0x32fc0f[_0xb0ea('0x4')](_0x419942,_0x2b4b1c);};}function removeListener(_0x24a827,_0x663143){return function(){OpenchannelMessageEvents['removeListener'](_0x24a827,_0x663143);};}exports[_0xb0ea('0x5')]=function(_0x721c00){for(var _0x251758=0x0,_0x136b87=events[_0xb0ea('0x6')];_0x251758<_0x136b87;_0x251758++){var _0x5d3174=events[_0x251758];var _0x1d045f=createListener('openchannelMessage:'+_0x5d3174,_0x721c00);OpenchannelMessageEvents['on'](_0x5d3174,_0x1d045f);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index 91e9e0d..0887d88 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 _0x815e=['connect-timeout','express','../../components/auth/service','../../components/interaction/service','./openchannelQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','create','post','addTeams','put','update','delete','removeTeams','exports','multer','util'];(function(_0x7497ff,_0x19e4b9){var _0x14879e=function(_0x1ea72){while(--_0x1ea72){_0x7497ff['push'](_0x7497ff['shift']());}};_0x14879e(++_0x19e4b9);}(_0x815e,0x186));var _0xe815=function(_0x509069,_0x110708){_0x509069=_0x509069-0x0;var _0x4f0c84=_0x815e[_0x509069];return _0x4f0c84;};'use strict';var multer=require(_0xe815('0x0'));var util=require(_0xe815('0x1'));var path=require('path');var timeout=require(_0xe815('0x2'));var express=require(_0xe815('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xe815('0x4'));var interaction=require(_0xe815('0x5'));var config=require('../../config/environment');var controller=require(_0xe815('0x6'));router[_0xe815('0x7')]('/',auth[_0xe815('0x8')](),controller[_0xe815('0x9')]);router['get'](_0xe815('0xa'),auth[_0xe815('0x8')](),controller[_0xe815('0xb')]);router[_0xe815('0x7')](_0xe815('0xc'),auth[_0xe815('0x8')](),controller[_0xe815('0xd')]);router[_0xe815('0x7')](_0xe815('0xe'),auth[_0xe815('0x8')](),controller[_0xe815('0xf')]);router[_0xe815('0x7')](_0xe815('0x10'),auth[_0xe815('0x8')](),controller[_0xe815('0x11')]);router[_0xe815('0x7')](_0xe815('0x12'),auth[_0xe815('0x8')](),controller[_0xe815('0x13')]);router['post']('/',auth[_0xe815('0x8')](),controller[_0xe815('0x14')]);router[_0xe815('0x15')]('/:id/teams',auth['isAuthenticated'](),controller[_0xe815('0x16')]);router[_0xe815('0x15')](_0xe815('0x12'),auth[_0xe815('0x8')](),controller['addAgents']);router[_0xe815('0x17')]('/:id',auth[_0xe815('0x8')](),controller[_0xe815('0x18')]);router[_0xe815('0x19')](_0xe815('0xc'),auth['isAuthenticated'](),controller['destroy']);router['delete'](_0xe815('0x10'),auth['isAuthenticated'](),controller[_0xe815('0x1a')]);router[_0xe815('0x19')]('/:id/users',auth[_0xe815('0x8')](),controller['removeAgents']);module[_0xe815('0x1b')]=router; \ No newline at end of file +var _0x1429=['/:id/teams','addTeams','/:id/users','addAgents','put','update','delete','destroy','removeAgents','exports','multer','util','connect-timeout','fs-extra','../../components/interaction/service','get','describe','/:id','isAuthenticated','show','/:id/members','getMembers','getTeams','getAgents','post','create'];(function(_0x478beb,_0x1ce761){var _0x51c17b=function(_0xc4cb4c){while(--_0xc4cb4c){_0x478beb['push'](_0x478beb['shift']());}};_0x51c17b(++_0x1ce761);}(_0x1429,0x190));var _0x9142=function(_0x1bfcb1,_0x58889e){_0x1bfcb1=_0x1bfcb1-0x0;var _0x115bd1=_0x1429[_0x1bfcb1];return _0x115bd1;};'use strict';var multer=require(_0x9142('0x0'));var util=require(_0x9142('0x1'));var path=require('path');var timeout=require(_0x9142('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x9142('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x9142('0x4'));var config=require('../../config/environment');var controller=require('./openchannelQueue.controller');router[_0x9142('0x5')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/describe',auth['isAuthenticated'](),controller[_0x9142('0x6')]);router[_0x9142('0x5')](_0x9142('0x7'),auth[_0x9142('0x8')](),controller[_0x9142('0x9')]);router[_0x9142('0x5')](_0x9142('0xa'),auth['isAuthenticated'](),controller[_0x9142('0xb')]);router[_0x9142('0x5')]('/:id/teams',auth[_0x9142('0x8')](),controller[_0x9142('0xc')]);router[_0x9142('0x5')]('/:id/users',auth['isAuthenticated'](),controller[_0x9142('0xd')]);router[_0x9142('0xe')]('/',auth['isAuthenticated'](),controller[_0x9142('0xf')]);router[_0x9142('0xe')](_0x9142('0x10'),auth['isAuthenticated'](),controller[_0x9142('0x11')]);router[_0x9142('0xe')](_0x9142('0x12'),auth['isAuthenticated'](),controller[_0x9142('0x13')]);router[_0x9142('0x14')](_0x9142('0x7'),auth[_0x9142('0x8')](),controller[_0x9142('0x15')]);router[_0x9142('0x16')](_0x9142('0x7'),auth[_0x9142('0x8')](),controller[_0x9142('0x17')]);router[_0x9142('0x16')](_0x9142('0x10'),auth[_0x9142('0x8')](),controller['removeTeams']);router[_0x9142('0x16')]('/:id/users',auth[_0x9142('0x8')](),controller[_0x9142('0x18')]);module[_0x9142('0x19')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index 8e6df71..3032b3a 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 _0x6e6e=['ENUM','rrmemory','beepall','sequelize','STRING','name','INTEGER'];(function(_0x16de85,_0x5b0595){var _0x28f2ea=function(_0x414b97){while(--_0x414b97){_0x16de85['push'](_0x16de85['shift']());}};_0x28f2ea(++_0x5b0595);}(_0x6e6e,0x96));var _0xe6e6=function(_0x5b4126,_0x18f064){_0x5b4126=_0x5b4126-0x0;var _0xe47d45=_0x6e6e[_0x5b4126];return _0xe47d45;};'use strict';var Sequelize=require(_0xe6e6('0x0'));module['exports']={'name':{'type':Sequelize[_0xe6e6('0x1')],'unique':_0xe6e6('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xe6e6('0x1')]},'timeout':{'type':Sequelize[_0xe6e6('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xe6e6('0x4')](_0xe6e6('0x5'),_0xe6e6('0x6'),'roundrobin')}}; \ No newline at end of file +var _0x7b02=['sequelize','exports','name','INTEGER','ENUM','beepall','roundrobin'];(function(_0x6b14b,_0x305e37){var _0x5e4a62=function(_0x6a0d93){while(--_0x6a0d93){_0x6b14b['push'](_0x6b14b['shift']());}};_0x5e4a62(++_0x305e37);}(_0x7b02,0xb6));var _0x27b0=function(_0x41c242,_0x32e375){_0x41c242=_0x41c242-0x0;var _0x4de595=_0x7b02[_0x41c242];return _0x4de595;};'use strict';var Sequelize=require(_0x27b0('0x0'));module[_0x27b0('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x27b0('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x27b0('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x27b0('0x4')]('rrmemory',_0x27b0('0x5'),_0x27b0('0x6'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index 00c4afa..855e3a0 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 _0x2154=['../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','UserProfileResource','sendStatus','stack','name','index','OpenchannelQueue','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','params','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','OpenchannelQueues','UserProfileSection','userProfileId','destroy','describe','findOne','get','UserOpenchannelQueue','User','findAndCountAll','updatedAt','createdAt','format','%s/%s','SIP','openchannelPause','getTeams','Team','ids','Agents','online','interface','flatMap','sequelize','transaction','findOrCreate','forEach','userOpenchannelQueue:save','findAll','field','tq.TeamId','team_has_openchannel_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','includes','compact','isEmpty','removeAgents','userOpenchannelQueue:remove','addAgents','omit','spread','isArray','emit','getAgents','rimraf','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x2154,0x70));var _0x4215=function(_0x3ea913,_0x255df2){_0x3ea913=_0x3ea913-0x0;var _0x2b4f28=_0x2154[_0x3ea913];return _0x2b4f28;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4215('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4215('0x1'));var rp=require('request-promise');var moment=require(_0x4215('0x2'));var BPromise=require(_0x4215('0x3'));var Mustache=require('mustache');var util=require(_0x4215('0x4'));var path=require(_0x4215('0x5'));var sox=require(_0x4215('0x6'));var csv=require(_0x4215('0x7'));var ejs=require(_0x4215('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4215('0x9'));var squel=require(_0x4215('0xa'));var crypto=require('crypto');var jsforce=require(_0x4215('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x4215('0x7'));var querystring=require('querystring');var Papa=require(_0x4215('0xc'));var Redis=require(_0x4215('0xd'));var authService=require(_0x4215('0xe'));var qs=require(_0x4215('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4215('0x10'));var logger=require(_0x4215('0x11'))(_0x4215('0x12'));var utils=require('../../config/utils');var config=require(_0x4215('0x13'));var licenseUtil=require(_0x4215('0x14'));var db=require('../../mysqldb')['db'];config[_0x4215('0x15')]=_[_0x4215('0x16')](config[_0x4215('0x15')],{'host':_0x4215('0x17'),'port':0x18eb});var socket=require(_0x4215('0x18'))(new Redis(config[_0x4215('0x15')]));require(_0x4215('0x19'))[_0x4215('0x1a')](socket);function respondWithStatusCode(_0x320e50,_0x2576e8){_0x2576e8=_0x2576e8||0xcc;return function(_0x477688){if(_0x477688){return _0x320e50['sendStatus'](_0x2576e8);}return _0x320e50[_0x4215('0x1b')](_0x2576e8)[_0x4215('0x1c')]();};}function respondWithResult(_0xfaef51,_0x211033){_0x211033=_0x211033||0xc8;return function(_0x1fd08a){if(_0x1fd08a){return _0xfaef51[_0x4215('0x1b')](_0x211033)[_0x4215('0x1d')](_0x1fd08a);}};}function respondWithFilteredResult(_0x58f9c7,_0x5070ba){return function(_0xf31593){if(_0xf31593){var _0x1f6abd=typeof _0x5070ba[_0x4215('0x1e')]==='undefined'&&typeof _0x5070ba[_0x4215('0x1f')]===_0x4215('0x20');var _0x1e089c=_0xf31593[_0x4215('0x21')];var _0x572fe6=_0x1f6abd?0x0:_0x5070ba[_0x4215('0x1e')];var _0x5a4a04=_0x1f6abd?_0xf31593['count']:_0x5070ba[_0x4215('0x1e')]+_0x5070ba['limit'];var _0x2e9c0d;if(_0x5a4a04>=_0x1e089c){_0x5a4a04=_0x1e089c;_0x2e9c0d=0xc8;}else{_0x2e9c0d=0xce;}_0x58f9c7[_0x4215('0x1b')](_0x2e9c0d);return _0x58f9c7[_0x4215('0x22')](_0x4215('0x23'),_0x572fe6+'-'+_0x5a4a04+'/'+_0x1e089c)[_0x4215('0x1d')](_0xf31593);}return null;};}function patchUpdates(_0x23960d){return function(_0x4a0ad5){try{jsonpatch[_0x4215('0x24')](_0x4a0ad5,_0x23960d,!![]);}catch(_0xf241a8){return BPromise[_0x4215('0x25')](_0xf241a8);}return _0x4a0ad5[_0x4215('0x26')]();};}function saveUpdates(_0x48bb14,_0x47f0eb){return function(_0x29b41e){if(_0x29b41e){return _0x29b41e[_0x4215('0x27')](_0x48bb14)[_0x4215('0x28')](function(_0x4f35f8){return _0x4f35f8;});}return null;};}function removeEntity(_0x4e9e75,_0x596c58){return function(_0x17820f){if(_0x17820f){return _0x17820f['destroy']()[_0x4215('0x28')](function(){var _0x4299f2=_0x17820f['get']({'plain':!![]});var _0x56b3b8='OpenchannelQueues';return db[_0x4215('0x29')]['destroy']({'where':{'type':_0x56b3b8,'resourceId':_0x4299f2['id']}})[_0x4215('0x28')](function(){return _0x17820f;});})[_0x4215('0x28')](function(){_0x4e9e75[_0x4215('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3a088c,_0x5b8fe5){return function(_0x1a5d24){if(!_0x1a5d24){_0x3a088c[_0x4215('0x2a')](0x194);}return _0x1a5d24;};}function handleError(_0x3a8202,_0x12d5cd){_0x12d5cd=_0x12d5cd||0x1f4;return function(_0x240c48){logger['error'](_0x240c48[_0x4215('0x2b')]);if(_0x240c48[_0x4215('0x2c')]){delete _0x240c48[_0x4215('0x2c')];}_0x3a8202['status'](_0x12d5cd)['send'](_0x240c48);};}exports[_0x4215('0x2d')]=function(_0x4694d6,_0x527752){var _0x3f60c3={},_0x2dba6e={},_0x2aabab={'count':0x0,'rows':[]};var _0x400f81=_['map'](db[_0x4215('0x2e')][_0x4215('0x2f')],function(_0x5bbb86){return{'name':_0x5bbb86[_0x4215('0x30')],'type':_0x5bbb86[_0x4215('0x31')][_0x4215('0x32')]};});_0x2dba6e[_0x4215('0x33')]=_[_0x4215('0x34')](_0x400f81,'name');_0x2dba6e[_0x4215('0x35')]=_[_0x4215('0x36')](_0x4694d6['query']);_0x2dba6e['filters']=_[_0x4215('0x37')](_0x2dba6e['model'],_0x2dba6e[_0x4215('0x35')]);_0x3f60c3['attributes']=_[_0x4215('0x37')](_0x2dba6e[_0x4215('0x33')],qs[_0x4215('0x38')](_0x4694d6[_0x4215('0x35')][_0x4215('0x38')]));_0x3f60c3[_0x4215('0x39')]=_0x3f60c3[_0x4215('0x39')][_0x4215('0x3a')]?_0x3f60c3[_0x4215('0x39')]:_0x2dba6e[_0x4215('0x33')];if(!_0x4694d6['query'][_0x4215('0x3b')](_0x4215('0x3c'))){_0x3f60c3[_0x4215('0x1f')]=qs['limit'](_0x4694d6[_0x4215('0x35')][_0x4215('0x1f')]);_0x3f60c3[_0x4215('0x1e')]=qs['offset'](_0x4694d6[_0x4215('0x35')]['offset']);}_0x3f60c3[_0x4215('0x3d')]=qs[_0x4215('0x3e')](_0x4694d6[_0x4215('0x35')][_0x4215('0x3e')]);_0x3f60c3[_0x4215('0x3f')]=qs[_0x4215('0x40')](_[_0x4215('0x41')](_0x4694d6[_0x4215('0x35')],_0x2dba6e['filters']),_0x400f81);if(_0x4694d6[_0x4215('0x35')][_0x4215('0x42')]){_0x3f60c3[_0x4215('0x3f')]=_[_0x4215('0x43')](_0x3f60c3['where'],{'$or':_['map'](_0x400f81,function(_0x3e921e){if(_0x3e921e[_0x4215('0x31')]!==_0x4215('0x44')){var _0x18a656={};_0x18a656[_0x3e921e['name']]={'$like':'%'+_0x4694d6['query'][_0x4215('0x42')]+'%'};return _0x18a656;}})});}_0x3f60c3=_[_0x4215('0x43')]({},_0x3f60c3,_0x4694d6[_0x4215('0x45')]);var _0x3e9bce={'where':_0x3f60c3[_0x4215('0x3f')]};return db[_0x4215('0x2e')][_0x4215('0x21')](_0x3e9bce)[_0x4215('0x28')](function(_0x90b349){_0x2aabab['count']=_0x90b349;if(_0x4694d6[_0x4215('0x35')][_0x4215('0x46')]){_0x3f60c3[_0x4215('0x47')]=[{'all':!![]}];}return db[_0x4215('0x2e')]['findAll'](_0x3f60c3);})[_0x4215('0x28')](function(_0x195b4c){_0x2aabab[_0x4215('0x48')]=_0x195b4c;return _0x2aabab;})[_0x4215('0x28')](respondWithFilteredResult(_0x527752,_0x3f60c3))[_0x4215('0x49')](handleError(_0x527752,null));};exports['show']=function(_0x1590d5,_0x5183e4){var _0x12b69b={'raw':!![],'where':{'id':_0x1590d5[_0x4215('0x4a')]['id']}},_0x1b2ed2={};_0x1b2ed2[_0x4215('0x33')]=_[_0x4215('0x36')](db['OpenchannelQueue'][_0x4215('0x2f')]);_0x1b2ed2['query']=_[_0x4215('0x36')](_0x1590d5['query']);_0x1b2ed2[_0x4215('0x40')]=_[_0x4215('0x37')](_0x1b2ed2['model'],_0x1b2ed2[_0x4215('0x35')]);_0x12b69b[_0x4215('0x39')]=_['intersection'](_0x1b2ed2[_0x4215('0x33')],qs[_0x4215('0x38')](_0x1590d5[_0x4215('0x35')][_0x4215('0x38')]));_0x12b69b[_0x4215('0x39')]=_0x12b69b[_0x4215('0x39')][_0x4215('0x3a')]?_0x12b69b['attributes']:_0x1b2ed2[_0x4215('0x33')];if(_0x1590d5[_0x4215('0x35')]['includeAll']){_0x12b69b[_0x4215('0x47')]=[{'all':!![]}];}_0x12b69b=_[_0x4215('0x43')]({},_0x12b69b,_0x1590d5[_0x4215('0x45')]);return db[_0x4215('0x2e')][_0x4215('0x4b')](_0x12b69b)['then'](handleEntityNotFound(_0x5183e4,null))[_0x4215('0x28')](respondWithResult(_0x5183e4,null))[_0x4215('0x49')](handleError(_0x5183e4,null));};exports[_0x4215('0x4c')]=function(_0x575e82,_0x402d0e){return db[_0x4215('0x2e')][_0x4215('0x4c')](_0x575e82[_0x4215('0x4d')],{})['then'](function(_0x19295a){var _0xcd59e=_0x575e82['user']['get']({'plain':!![]});if(!_0xcd59e)throw new Error(_0x4215('0x4e'));if(_0xcd59e['role']==='user'){var _0x10be9c=_0x19295a['get']({'plain':!![]});var _0x2e8acc=_0x4215('0x4f');return db[_0x4215('0x50')][_0x4215('0x4b')]({'where':{'name':_0x2e8acc,'userProfileId':_0xcd59e[_0x4215('0x51')]},'raw':!![]})[_0x4215('0x28')](function(_0x42a66f){if(_0x42a66f&&_0x42a66f['autoAssociation']===0x0){return db['UserProfileResource'][_0x4215('0x4c')]({'name':_0x10be9c['name'],'resourceId':_0x10be9c['id'],'type':_0x42a66f[_0x4215('0x2c')],'sectionId':_0x42a66f['id']},{})[_0x4215('0x28')](function(){return _0x19295a;});}else{return _0x19295a;}})[_0x4215('0x49')](function(_0x21cc22){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x21cc22);throw _0x21cc22;});}return _0x19295a;})[_0x4215('0x28')](respondWithResult(_0x402d0e,0xc9))[_0x4215('0x49')](handleError(_0x402d0e,null));};exports['update']=function(_0x9cdf46,_0x3fed97){if(_0x9cdf46[_0x4215('0x4d')]['id']){delete _0x9cdf46[_0x4215('0x4d')]['id'];}return db[_0x4215('0x2e')][_0x4215('0x4b')]({'where':{'id':_0x9cdf46[_0x4215('0x4a')]['id']}})[_0x4215('0x28')](handleEntityNotFound(_0x3fed97,null))[_0x4215('0x28')](saveUpdates(_0x9cdf46[_0x4215('0x4d')],null))[_0x4215('0x28')](respondWithResult(_0x3fed97,null))[_0x4215('0x49')](handleError(_0x3fed97,null));};exports[_0x4215('0x52')]=function(_0x9b2659,_0x5d6cdd){return db[_0x4215('0x2e')][_0x4215('0x4b')]({'where':{'id':_0x9b2659[_0x4215('0x4a')]['id']}})[_0x4215('0x28')](handleEntityNotFound(_0x5d6cdd,null))[_0x4215('0x28')](removeEntity(_0x5d6cdd,null))[_0x4215('0x49')](handleError(_0x5d6cdd,null));};exports[_0x4215('0x53')]=function(_0x1aa677,_0x1b7d1b){return db[_0x4215('0x2e')][_0x4215('0x53')]()[_0x4215('0x28')](respondWithResult(_0x1b7d1b,null))[_0x4215('0x49')](handleError(_0x1b7d1b,null));};exports['getMembers']=function(_0x47b911,_0x4eb5ff,_0x456148){var _0x3bf72c={'raw':!![],'where':{}},_0x2ef9ad={},_0x95b8f8;return db[_0x4215('0x2e')][_0x4215('0x54')]({'where':{'id':_0x47b911[_0x4215('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4eb5ff,null))['then'](function(_0x422f34){if(_0x422f34){_0x95b8f8=_0x422f34[_0x4215('0x55')]({'plain':!![]});_0x2ef9ad[_0x4215('0x33')]=_[_0x4215('0x36')](db[_0x4215('0x56')][_0x4215('0x2f')]);_0x2ef9ad[_0x4215('0x35')]=_['keys'](_0x47b911[_0x4215('0x35')]);_0x2ef9ad[_0x4215('0x40')]=_[_0x4215('0x37')](_0x2ef9ad[_0x4215('0x33')],_0x2ef9ad[_0x4215('0x35')]);_0x3bf72c['attributes']=_[_0x4215('0x37')](_0x2ef9ad[_0x4215('0x33')],qs[_0x4215('0x38')](_0x47b911[_0x4215('0x35')][_0x4215('0x38')]));_0x3bf72c['attributes']=_0x3bf72c[_0x4215('0x39')]['length']?_0x3bf72c[_0x4215('0x39')]:_0x2ef9ad[_0x4215('0x33')];if(!_0x47b911[_0x4215('0x35')][_0x4215('0x3b')](_0x4215('0x3c'))){_0x3bf72c[_0x4215('0x1f')]=qs['limit'](_0x47b911['query']['limit']);_0x3bf72c['offset']=qs[_0x4215('0x1e')](_0x47b911[_0x4215('0x35')][_0x4215('0x1e')]);}_0x3bf72c[_0x4215('0x3d')]=qs[_0x4215('0x3e')](_0x47b911[_0x4215('0x35')][_0x4215('0x3e')]);_0x3bf72c['where']=qs[_0x4215('0x40')](_[_0x4215('0x41')](_0x47b911['query'],_0x2ef9ad[_0x4215('0x40')]));_0x3bf72c[_0x4215('0x3f')]['OpenchannelQueueId']=_0x422f34['id'];if(_0x47b911[_0x4215('0x35')][_0x4215('0x42')]){_0x3bf72c[_0x4215('0x3f')]=_['merge'](_0x3bf72c[_0x4215('0x3f')],{'$or':_['map'](_0x3bf72c[_0x4215('0x39')],function(_0x3a280f){var _0x195fe1={};_0x195fe1[_0x3a280f]={'$like':'%'+_0x47b911[_0x4215('0x35')]['filter']+'%'};return _0x195fe1;})});}_0x3bf72c=_[_0x4215('0x43')]({},_0x3bf72c,_0x47b911[_0x4215('0x45')]);return db[_0x4215('0x56')]['findAll'](_0x3bf72c);}})['then'](function(_0x306ce2){if(_0x306ce2){return db[_0x4215('0x57')][_0x4215('0x58')]({'where':{'id':_[_0x4215('0x34')](_0x306ce2,'UserId'),'role':'agent'},'attributes':['id','name','openchannelPause',_0x4215('0x59'),_0x4215('0x5a')]});}})[_0x4215('0x28')](function(_0x18f97d){if(_0x18f97d){return{'count':_0x18f97d[_0x4215('0x21')],'rows':_['map'](_0x18f97d[_0x4215('0x48')],function(_0x523241){return{'membername':_0x523241[_0x4215('0x2c')],'UserId':_0x523241['id'],'queue_name':_0x95b8f8[_0x4215('0x2c')],'OpenchannelQueueId':_0x95b8f8['id'],'interface':util[_0x4215('0x5b')](_0x4215('0x5c'),_0x4215('0x5d'),_0x523241[_0x4215('0x2c')]),'penalty':0x0,'paused':_0x523241[_0x4215('0x5e')],'createdAt':_0x523241[_0x4215('0x5a')],'updatedAt':_0x523241[_0x4215('0x59')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x4eb5ff,_0x3bf72c))[_0x4215('0x49')](handleError(_0x4eb5ff,null));};exports[_0x4215('0x5f')]=function(_0x675dd0,_0xab6a49,_0x12874e){var _0x212a1c={};var _0x4946f0={};var _0x3db905;var _0x48fe79;return db[_0x4215('0x2e')][_0x4215('0x54')]({'where':{'id':_0x675dd0['params']['id']}})[_0x4215('0x28')](handleEntityNotFound(_0xab6a49,null))[_0x4215('0x28')](function(_0x18f1aa){if(_0x18f1aa){_0x3db905=_0x18f1aa;_0x4946f0[_0x4215('0x33')]=_[_0x4215('0x36')](db[_0x4215('0x60')][_0x4215('0x2f')]);_0x4946f0[_0x4215('0x35')]=_[_0x4215('0x36')](_0x675dd0['query']);_0x4946f0['filters']=_[_0x4215('0x37')](_0x4946f0[_0x4215('0x33')],_0x4946f0[_0x4215('0x35')]);_0x212a1c[_0x4215('0x39')]=_[_0x4215('0x37')](_0x4946f0['model'],qs[_0x4215('0x38')](_0x675dd0[_0x4215('0x35')]['fields']));_0x212a1c[_0x4215('0x39')]=_0x212a1c[_0x4215('0x39')][_0x4215('0x3a')]?_0x212a1c['attributes']:_0x4946f0[_0x4215('0x33')];_0x212a1c[_0x4215('0x3d')]=qs[_0x4215('0x3e')](_0x675dd0['query'][_0x4215('0x3e')]);_0x212a1c[_0x4215('0x3f')]=qs[_0x4215('0x40')](_[_0x4215('0x41')](_0x675dd0[_0x4215('0x35')],_0x4946f0[_0x4215('0x40')]));if(_0x675dd0[_0x4215('0x35')][_0x4215('0x42')]){_0x212a1c[_0x4215('0x3f')]=_[_0x4215('0x43')](_0x212a1c[_0x4215('0x3f')],{'$or':_[_0x4215('0x34')](_0x212a1c[_0x4215('0x39')],function(_0x3d408c){var _0x8822e4={};_0x8822e4[_0x3d408c]={'$like':'%'+_0x675dd0[_0x4215('0x35')][_0x4215('0x42')]+'%'};return _0x8822e4;})});}_0x212a1c=_[_0x4215('0x43')]({},_0x212a1c,_0x675dd0[_0x4215('0x45')]);return _0x3db905[_0x4215('0x5f')](_0x212a1c);}})[_0x4215('0x28')](function(_0x3fd68e){if(_0x3fd68e){_0x48fe79=_0x3fd68e['length'];if(!_0x675dd0[_0x4215('0x35')][_0x4215('0x3b')]('nolimit')){_0x212a1c[_0x4215('0x1f')]=qs['limit'](_0x675dd0[_0x4215('0x35')][_0x4215('0x1f')]);_0x212a1c[_0x4215('0x1e')]=qs[_0x4215('0x1e')](_0x675dd0[_0x4215('0x35')]['offset']);}return _0x3db905['getTeams'](_0x212a1c);}})['then'](function(_0xad9201){if(_0xad9201){return _0xad9201?{'count':_0x48fe79,'rows':_0xad9201}:null;}})['then'](respondWithResult(_0xab6a49,null))['catch'](handleError(_0xab6a49,null));};exports['addTeams']=function(_0x2b9f55,_0xc17d29,_0xf5ed34){var _0x5a437b=_0x2b9f55['body'][_0x4215('0x61')];return db[_0x4215('0x60')]['findAll']({'where':{'id':_0x5a437b},'attributes':['id'],'include':[{'model':db['User'],'as':_0x4215('0x62'),'attributes':['id','name',_0x4215('0x63'),'voicePause',_0x4215('0x64')],'raw':!![]}]})[_0x4215('0x28')](function(_0x16ec48){if(_0x16ec48){var _0x4deb41=_[_0x4215('0x65')](_0x16ec48,function(_0x1d92ee){var _0xfdc806=_0x1d92ee[_0x4215('0x55')]({'plain':!![]});return _0xfdc806[_0x4215('0x62')];});return db[_0x4215('0x2e')][_0x4215('0x4b')]({'where':{'id':_0x2b9f55['params']['id']}})[_0x4215('0x28')](function(_0xd14c3a){return db[_0x4215('0x66')][_0x4215('0x67')](function(_0x5026cc){return _0xd14c3a['addTeams'](_0x5a437b,{'transaction':_0x5026cc})['then'](function(){return BPromise['each'](_0x4deb41,function(_0x41a2ae){return db['UserOpenchannelQueue'][_0x4215('0x68')]({'where':{'UserId':_0x41a2ae['id'],'OpenchannelQueueId':_0x2b9f55['params']['id']},'transaction':_0x5026cc});});})[_0x4215('0x28')](function(){_0x4deb41[_0x4215('0x69')](function(_0x191217){socket['emit'](_0x4215('0x6a'),{'UserId':_0x191217['id'],'OpenchannelQueueId':_0xd14c3a['id']});});});});});}})[_0x4215('0x28')](respondWithStatusCode(_0xc17d29,null))['catch'](handleError(_0xc17d29,null));};exports['removeTeams']=function(_0x44eb94,_0x17f032,_0x249e46){return db[_0x4215('0x60')][_0x4215('0x6b')]({'where':{'id':_0x44eb94[_0x4215('0x35')][_0x4215('0x61')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x4215('0x62'),'attributes':['id'],'raw':!![]}]})[_0x4215('0x28')](handleEntityNotFound(_0x17f032,null))[_0x4215('0x28')](function(_0x521038){var _0x4b5dbb=_[_0x4215('0x34')](_0x521038,'id');var _0x53e182=[];var _0x3bbd0c=[];var _0x2af252=squel['select']();_0x2af252[_0x4215('0x6c')](_0x4215('0x6d'))['from'](_0x4215('0x6e'),'tq')[_0x4215('0x6f')](_0x4215('0x70'),'ut',_0x4215('0x71'))[_0x4215('0x3f')](_0x4215('0x72'),_0x44eb94[_0x4215('0x4a')]['id']);for(var _0x1796e7=0x0;_0x1796e7<_0x521038[_0x4215('0x3a')];_0x1796e7+=0x1){let _0x282ae8=_0x521038[_0x1796e7];for(var _0x4d5f67=0x0;_0x4d5f67<_0x282ae8[_0x4215('0x62')][_0x4215('0x3a')];_0x4d5f67+=0x1){let _0x297769=_0x282ae8[_0x4215('0x62')][_0x4d5f67];var _0x9c9a8c=_0x2af252['clone']();_0x9c9a8c['where'](_0x4215('0x73'),_0x297769['id']);_0x3bbd0c[_0x4215('0x74')](db[_0x4215('0x66')][_0x4215('0x35')](_0x9c9a8c[_0x4215('0x75')](),{'type':db['sequelize'][_0x4215('0x76')][_0x4215('0x77')]})[_0x4215('0x28')](function(_0x2f8087){if(_0x2f8087[_0x4215('0x3a')]===0x1){return _0x297769['id'];}else{var _0x53fbed=_['every'](_[_0x4215('0x34')](_0x2f8087,'TeamId'),function(_0x2a389a){return _[_0x4215('0x78')](_0x4b5dbb,_0x2a389a);});if(_0x53fbed){return _0x297769['id'];}}}));}}return BPromise['all'](_0x3bbd0c)['then'](function(_0x1775f0){_0x53e182=_(_0x53e182)['union'](_0x1775f0)[_0x4215('0x79')]()['value']();return db[_0x4215('0x2e')][_0x4215('0x4b')]({'where':{'id':_0x44eb94[_0x4215('0x4a')]['id']}})[_0x4215('0x28')](function(_0x590f0f){return db['sequelize'][_0x4215('0x67')](function(_0x55e30b){return _0x590f0f['removeTeams'](_0x44eb94['query']['ids'],{'transaction':_0x55e30b})[_0x4215('0x28')](function(){if(!_[_0x4215('0x7a')](_0x53e182)){return _0x590f0f[_0x4215('0x7b')](_0x53e182,{'transaction':_0x55e30b});}})[_0x4215('0x28')](function(){_0x53e182[_0x4215('0x69')](function(_0x47b440){socket['emit'](_0x4215('0x7c'),{'UserId':_0x47b440,'OpenchannelQueueId':_0x590f0f['id']});});});});});});})['then'](respondWithStatusCode(_0x17f032,null))['catch'](handleError(_0x17f032,null));};exports[_0x4215('0x7d')]=function(_0x1eefd5,_0x1aef7b,_0x7d8414){return db['OpenchannelQueue'][_0x4215('0x4b')]({'where':{'id':_0x1eefd5[_0x4215('0x4a')]['id']}})[_0x4215('0x28')](handleEntityNotFound(_0x1aef7b,null))['then'](function(_0x30aceb){if(_0x30aceb){return _0x30aceb[_0x4215('0x7d')](_0x1eefd5[_0x4215('0x4d')][_0x4215('0x61')],_[_0x4215('0x7e')](_0x1eefd5[_0x4215('0x4d')],[_0x4215('0x61'),'id'])||{})[_0x4215('0x7f')](function(_0x53bccf){for(var _0x434959=0x0;_0x434959<_0x1eefd5[_0x4215('0x4d')][_0x4215('0x61')][_0x4215('0x3a')];_0x434959+=0x1){socket['emit']('userOpenchannelQueue:save',{'UserId':Number(_0x1eefd5['body'][_0x4215('0x61')][_0x434959]),'OpenchannelQueueId':Number(_0x1eefd5[_0x4215('0x4a')]['id'])});}return _0x53bccf;});}})[_0x4215('0x28')](respondWithResult(_0x1aef7b,null))[_0x4215('0x49')](handleError(_0x1aef7b,null));};exports[_0x4215('0x7b')]=function(_0x3d7723,_0x4eec28,_0x38ed7f){return db[_0x4215('0x2e')]['find']({'where':{'id':_0x3d7723[_0x4215('0x4a')]['id']}})[_0x4215('0x28')](handleEntityNotFound(_0x4eec28,null))[_0x4215('0x28')](function(_0xa5d3d4){if(_0xa5d3d4){return _0xa5d3d4[_0x4215('0x7b')](_0x3d7723[_0x4215('0x35')]['ids'])[_0x4215('0x28')](function(){if(_[_0x4215('0x80')](_0x3d7723['query'][_0x4215('0x61')])){for(var _0x3747ec=0x0;_0x3747ec<_0x3d7723[_0x4215('0x35')][_0x4215('0x61')][_0x4215('0x3a')];_0x3747ec+=0x1){socket[_0x4215('0x81')](_0x4215('0x7c'),{'UserId':Number(_0x3d7723[_0x4215('0x35')][_0x4215('0x61')][_0x3747ec]),'OpenchannelQueueId':Number(_0x3d7723[_0x4215('0x4a')]['id'])});}}else{socket[_0x4215('0x81')](_0x4215('0x7c'),{'UserId':Number(_0x3d7723[_0x4215('0x35')][_0x4215('0x61')]),'OpenchannelQueueId':Number(_0x3d7723['params']['id'])});}});}})[_0x4215('0x28')](respondWithStatusCode(_0x4eec28,null))[_0x4215('0x49')](handleError(_0x4eec28,null));};exports['getAgents']=function(_0x3b7a4a,_0x191568,_0x448686){var _0x3fe586={};var _0x467723={};var _0x34c018;var _0x47f388;return db['OpenchannelQueue']['findOne']({'where':{'id':_0x3b7a4a['params']['id']}})['then'](handleEntityNotFound(_0x191568,null))['then'](function(_0x7a45b0){if(_0x7a45b0){_0x34c018=_0x7a45b0;_0x467723[_0x4215('0x33')]=_[_0x4215('0x36')](db['User'][_0x4215('0x2f')]);_0x467723[_0x4215('0x35')]=_['keys'](_0x3b7a4a[_0x4215('0x35')]);_0x467723[_0x4215('0x40')]=_[_0x4215('0x37')](_0x467723[_0x4215('0x33')],_0x467723[_0x4215('0x35')]);_0x3fe586[_0x4215('0x39')]=_[_0x4215('0x37')](_0x467723[_0x4215('0x33')],qs[_0x4215('0x38')](_0x3b7a4a[_0x4215('0x35')][_0x4215('0x38')]));_0x3fe586[_0x4215('0x39')]=_0x3fe586[_0x4215('0x39')][_0x4215('0x3a')]?_0x3fe586[_0x4215('0x39')]:_0x467723[_0x4215('0x33')];_0x3fe586[_0x4215('0x3d')]=qs[_0x4215('0x3e')](_0x3b7a4a[_0x4215('0x35')][_0x4215('0x3e')]);_0x3fe586[_0x4215('0x3f')]=qs['filters'](_[_0x4215('0x41')](_0x3b7a4a['query'],_0x467723[_0x4215('0x40')]));if(_0x3b7a4a['query'][_0x4215('0x42')]){_0x3fe586['where']=_[_0x4215('0x43')](_0x3fe586[_0x4215('0x3f')],{'$or':_[_0x4215('0x34')](_0x3fe586[_0x4215('0x39')],function(_0x5cbe88){var _0x3dc6aa={};_0x3dc6aa[_0x5cbe88]={'$like':'%'+_0x3b7a4a[_0x4215('0x35')]['filter']+'%'};return _0x3dc6aa;})});}_0x3fe586=_['merge']({},_0x3fe586,_0x3b7a4a[_0x4215('0x45')]);return _0x34c018[_0x4215('0x82')](_0x3fe586);}})['then'](function(_0x59b3cc){if(_0x59b3cc){_0x47f388=_0x59b3cc[_0x4215('0x3a')];if(!_0x3b7a4a['query'][_0x4215('0x3b')](_0x4215('0x3c'))){_0x3fe586[_0x4215('0x1f')]=qs[_0x4215('0x1f')](_0x3b7a4a[_0x4215('0x35')][_0x4215('0x1f')]);_0x3fe586[_0x4215('0x1e')]=qs[_0x4215('0x1e')](_0x3b7a4a[_0x4215('0x35')]['offset']);}return _0x34c018[_0x4215('0x82')](_0x3fe586);}})[_0x4215('0x28')](function(_0x3db76d){if(_0x3db76d){return _0x3db76d?{'count':_0x47f388,'rows':_0x3db76d}:null;}})[_0x4215('0x28')](respondWithResult(_0x191568,null))['catch'](handleError(_0x191568,null));}; \ No newline at end of file +var _0x63ce=['Team','ids','findAll','User','Agents','online','voicePause','interface','flatMap','sequelize','transaction','addTeams','each','findOrCreate','removeTeams','field','tq.TeamId','from','team_has_openchannel_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','push','toString','QueryTypes','every','TeamId','includes','all','union','value','isEmpty','removeAgents','forEach','emit','addAgents','omit','spread','isArray','userOpenchannelQueue:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','redis','localhost','./openchannelQueue.socket','sendStatus','status','end','json','limit','undefined','count','offset','Content-Range','reject','update','then','destroy','get','OpenchannelQueues','error','name','send','index','OpenchannelQueue','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','where','merge','VIRTUAL','filter','options','includeAll','include','rows','show','params','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','findOne','UserOpenchannelQueue','order','sort','pick','OpenchannelQueueId','findAndCountAll','agent','openchannelPause','updatedAt','format','%s/%s','SIP','createdAt','getTeams'];(function(_0xb654e1,_0xb696a1){var _0x2b4f8a=function(_0x168592){while(--_0x168592){_0xb654e1['push'](_0xb654e1['shift']());}};_0x2b4f8a(++_0xb696a1);}(_0x63ce,0x1d8));var _0xe63c=function(_0x2136d5,_0x4b0479){_0x2136d5=_0x2136d5-0x0;var _0x3bee2e=_0x63ce[_0x2136d5];return _0x3bee2e;};'use strict';var emlformat=require(_0xe63c('0x0'));var rimraf=require(_0xe63c('0x1'));var zipdir=require(_0xe63c('0x2'));var jsonpatch=require(_0xe63c('0x3'));var rp=require(_0xe63c('0x4'));var moment=require(_0xe63c('0x5'));var BPromise=require(_0xe63c('0x6'));var Mustache=require(_0xe63c('0x7'));var util=require(_0xe63c('0x8'));var path=require(_0xe63c('0x9'));var sox=require(_0xe63c('0xa'));var csv=require(_0xe63c('0xb'));var ejs=require(_0xe63c('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe63c('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe63c('0xe'));var deskjs=require(_0xe63c('0xf'));var toCsv=require(_0xe63c('0xb'));var querystring=require(_0xe63c('0x10'));var Papa=require('papaparse');var Redis=require(_0xe63c('0x11'));var authService=require(_0xe63c('0x12'));var qs=require(_0xe63c('0x13'));var as=require(_0xe63c('0x14'));var hardwareService=require(_0xe63c('0x15'));var logger=require(_0xe63c('0x16'))('api');var utils=require(_0xe63c('0x17'));var config=require(_0xe63c('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xe63c('0x19')]=_['defaults'](config[_0xe63c('0x19')],{'host':_0xe63c('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe63c('0x19')]));require(_0xe63c('0x1b'))['register'](socket);function respondWithStatusCode(_0x31bf3d,_0x5581a2){_0x5581a2=_0x5581a2||0xcc;return function(_0x2a17ab){if(_0x2a17ab){return _0x31bf3d[_0xe63c('0x1c')](_0x5581a2);}return _0x31bf3d[_0xe63c('0x1d')](_0x5581a2)[_0xe63c('0x1e')]();};}function respondWithResult(_0x51cfd5,_0x3dd53b){_0x3dd53b=_0x3dd53b||0xc8;return function(_0x2c4bda){if(_0x2c4bda){return _0x51cfd5[_0xe63c('0x1d')](_0x3dd53b)[_0xe63c('0x1f')](_0x2c4bda);}};}function respondWithFilteredResult(_0x1f719e,_0x30210a){return function(_0x588348){if(_0x588348){var _0x375a9f=typeof _0x30210a['offset']==='undefined'&&typeof _0x30210a[_0xe63c('0x20')]===_0xe63c('0x21');var _0x3439ae=_0x588348['count'];var _0x73872e=_0x375a9f?0x0:_0x30210a['offset'];var _0x526526=_0x375a9f?_0x588348[_0xe63c('0x22')]:_0x30210a[_0xe63c('0x23')]+_0x30210a[_0xe63c('0x20')];var _0x32decd;if(_0x526526>=_0x3439ae){_0x526526=_0x3439ae;_0x32decd=0xc8;}else{_0x32decd=0xce;}_0x1f719e[_0xe63c('0x1d')](_0x32decd);return _0x1f719e['set'](_0xe63c('0x24'),_0x73872e+'-'+_0x526526+'/'+_0x3439ae)[_0xe63c('0x1f')](_0x588348);}return null;};}function patchUpdates(_0xdf46b4){return function(_0x30a3b8){try{jsonpatch['apply'](_0x30a3b8,_0xdf46b4,!![]);}catch(_0x1a4ff7){return BPromise[_0xe63c('0x25')](_0x1a4ff7);}return _0x30a3b8['save']();};}function saveUpdates(_0x2a78f6,_0x33eadc){return function(_0x5c7911){if(_0x5c7911){return _0x5c7911[_0xe63c('0x26')](_0x2a78f6)[_0xe63c('0x27')](function(_0x580c20){return _0x580c20;});}return null;};}function removeEntity(_0x3b7e2e,_0x3d4bd8){return function(_0x2e5f89){if(_0x2e5f89){return _0x2e5f89[_0xe63c('0x28')]()[_0xe63c('0x27')](function(){var _0x54d22a=_0x2e5f89[_0xe63c('0x29')]({'plain':!![]});var _0x1ff3fa=_0xe63c('0x2a');return db['UserProfileResource']['destroy']({'where':{'type':_0x1ff3fa,'resourceId':_0x54d22a['id']}})[_0xe63c('0x27')](function(){return _0x2e5f89;});})[_0xe63c('0x27')](function(){_0x3b7e2e[_0xe63c('0x1d')](0xcc)[_0xe63c('0x1e')]();});}};}function handleEntityNotFound(_0x1897c8,_0x1fc317){return function(_0x4d9ffb){if(!_0x4d9ffb){_0x1897c8[_0xe63c('0x1c')](0x194);}return _0x4d9ffb;};}function handleError(_0x3c3933,_0x4dabfc){_0x4dabfc=_0x4dabfc||0x1f4;return function(_0x5d506d){logger[_0xe63c('0x2b')](_0x5d506d['stack']);if(_0x5d506d['name']){delete _0x5d506d[_0xe63c('0x2c')];}_0x3c3933['status'](_0x4dabfc)[_0xe63c('0x2d')](_0x5d506d);};}exports[_0xe63c('0x2e')]=function(_0x342924,_0x53343c){var _0x15868f={},_0x4c69eb={},_0x1ef31d={'count':0x0,'rows':[]};var _0x4a27f9=_['map'](db[_0xe63c('0x2f')][_0xe63c('0x30')],function(_0x1696d1){return{'name':_0x1696d1[_0xe63c('0x31')],'type':_0x1696d1[_0xe63c('0x32')][_0xe63c('0x33')]};});_0x4c69eb[_0xe63c('0x34')]=_[_0xe63c('0x35')](_0x4a27f9,_0xe63c('0x2c'));_0x4c69eb['query']=_[_0xe63c('0x36')](_0x342924[_0xe63c('0x37')]);_0x4c69eb[_0xe63c('0x38')]=_[_0xe63c('0x39')](_0x4c69eb['model'],_0x4c69eb['query']);_0x15868f[_0xe63c('0x3a')]=_[_0xe63c('0x39')](_0x4c69eb[_0xe63c('0x34')],qs['fields'](_0x342924[_0xe63c('0x37')][_0xe63c('0x3b')]));_0x15868f[_0xe63c('0x3a')]=_0x15868f[_0xe63c('0x3a')][_0xe63c('0x3c')]?_0x15868f['attributes']:_0x4c69eb[_0xe63c('0x34')];if(!_0x342924[_0xe63c('0x37')][_0xe63c('0x3d')](_0xe63c('0x3e'))){_0x15868f['limit']=qs['limit'](_0x342924[_0xe63c('0x37')][_0xe63c('0x20')]);_0x15868f[_0xe63c('0x23')]=qs[_0xe63c('0x23')](_0x342924['query'][_0xe63c('0x23')]);}_0x15868f['order']=qs['sort'](_0x342924[_0xe63c('0x37')]['sort']);_0x15868f[_0xe63c('0x3f')]=qs[_0xe63c('0x38')](_['pick'](_0x342924['query'],_0x4c69eb[_0xe63c('0x38')]),_0x4a27f9);if(_0x342924[_0xe63c('0x37')]['filter']){_0x15868f['where']=_[_0xe63c('0x40')](_0x15868f[_0xe63c('0x3f')],{'$or':_[_0xe63c('0x35')](_0x4a27f9,function(_0x63aa1c){if(_0x63aa1c[_0xe63c('0x32')]!==_0xe63c('0x41')){var _0x4485e2={};_0x4485e2[_0x63aa1c[_0xe63c('0x2c')]]={'$like':'%'+_0x342924[_0xe63c('0x37')][_0xe63c('0x42')]+'%'};return _0x4485e2;}})});}_0x15868f=_[_0xe63c('0x40')]({},_0x15868f,_0x342924[_0xe63c('0x43')]);var _0x3228f3={'where':_0x15868f[_0xe63c('0x3f')]};return db[_0xe63c('0x2f')][_0xe63c('0x22')](_0x3228f3)['then'](function(_0x10ac17){_0x1ef31d[_0xe63c('0x22')]=_0x10ac17;if(_0x342924[_0xe63c('0x37')][_0xe63c('0x44')]){_0x15868f[_0xe63c('0x45')]=[{'all':!![]}];}return db[_0xe63c('0x2f')]['findAll'](_0x15868f);})[_0xe63c('0x27')](function(_0x3527d4){_0x1ef31d[_0xe63c('0x46')]=_0x3527d4;return _0x1ef31d;})[_0xe63c('0x27')](respondWithFilteredResult(_0x53343c,_0x15868f))['catch'](handleError(_0x53343c,null));};exports[_0xe63c('0x47')]=function(_0x447d41,_0x3d79c2){var _0x149661={'raw':!![],'where':{'id':_0x447d41[_0xe63c('0x48')]['id']}},_0x3654e5={};_0x3654e5['model']=_[_0xe63c('0x36')](db['OpenchannelQueue'][_0xe63c('0x30')]);_0x3654e5['query']=_[_0xe63c('0x36')](_0x447d41[_0xe63c('0x37')]);_0x3654e5[_0xe63c('0x38')]=_[_0xe63c('0x39')](_0x3654e5['model'],_0x3654e5[_0xe63c('0x37')]);_0x149661['attributes']=_[_0xe63c('0x39')](_0x3654e5[_0xe63c('0x34')],qs['fields'](_0x447d41[_0xe63c('0x37')][_0xe63c('0x3b')]));_0x149661['attributes']=_0x149661['attributes'][_0xe63c('0x3c')]?_0x149661[_0xe63c('0x3a')]:_0x3654e5['model'];if(_0x447d41['query'][_0xe63c('0x44')]){_0x149661['include']=[{'all':!![]}];}_0x149661=_[_0xe63c('0x40')]({},_0x149661,_0x447d41[_0xe63c('0x43')]);return db[_0xe63c('0x2f')]['find'](_0x149661)[_0xe63c('0x27')](handleEntityNotFound(_0x3d79c2,null))[_0xe63c('0x27')](respondWithResult(_0x3d79c2,null))[_0xe63c('0x49')](handleError(_0x3d79c2,null));};exports['create']=function(_0x3639b7,_0x4f8a7f){return db[_0xe63c('0x2f')][_0xe63c('0x4a')](_0x3639b7[_0xe63c('0x4b')],{})['then'](function(_0x3e36d1){var _0x1bcb33=_0x3639b7['user'][_0xe63c('0x29')]({'plain':!![]});if(!_0x1bcb33)throw new Error(_0xe63c('0x4c'));if(_0x1bcb33[_0xe63c('0x4d')]===_0xe63c('0x4e')){var _0x4f28c0=_0x3e36d1['get']({'plain':!![]});var _0x472234=_0xe63c('0x2a');return db[_0xe63c('0x4f')][_0xe63c('0x50')]({'where':{'name':_0x472234,'userProfileId':_0x1bcb33[_0xe63c('0x51')]},'raw':!![]})['then'](function(_0x11f9be){if(_0x11f9be&&_0x11f9be['autoAssociation']===0x0){return db[_0xe63c('0x52')][_0xe63c('0x4a')]({'name':_0x4f28c0[_0xe63c('0x2c')],'resourceId':_0x4f28c0['id'],'type':_0x11f9be[_0xe63c('0x2c')],'sectionId':_0x11f9be['id']},{})['then'](function(){return _0x3e36d1;});}else{return _0x3e36d1;}})[_0xe63c('0x49')](function(_0x5085a3){logger[_0xe63c('0x2b')](_0xe63c('0x53'),_0x5085a3);throw _0x5085a3;});}return _0x3e36d1;})[_0xe63c('0x27')](respondWithResult(_0x4f8a7f,0xc9))[_0xe63c('0x49')](handleError(_0x4f8a7f,null));};exports[_0xe63c('0x26')]=function(_0x2ba303,_0x313e19){if(_0x2ba303[_0xe63c('0x4b')]['id']){delete _0x2ba303[_0xe63c('0x4b')]['id'];}return db['OpenchannelQueue']['find']({'where':{'id':_0x2ba303[_0xe63c('0x48')]['id']}})[_0xe63c('0x27')](handleEntityNotFound(_0x313e19,null))[_0xe63c('0x27')](saveUpdates(_0x2ba303[_0xe63c('0x4b')],null))[_0xe63c('0x27')](respondWithResult(_0x313e19,null))[_0xe63c('0x49')](handleError(_0x313e19,null));};exports['destroy']=function(_0x75956f,_0x6d465f){return db[_0xe63c('0x2f')][_0xe63c('0x50')]({'where':{'id':_0x75956f[_0xe63c('0x48')]['id']}})[_0xe63c('0x27')](handleEntityNotFound(_0x6d465f,null))[_0xe63c('0x27')](removeEntity(_0x6d465f,null))[_0xe63c('0x49')](handleError(_0x6d465f,null));};exports['describe']=function(_0x572dec,_0x487ad0){return db[_0xe63c('0x2f')][_0xe63c('0x54')]()['then'](respondWithResult(_0x487ad0,null))['catch'](handleError(_0x487ad0,null));};exports['getMembers']=function(_0x329443,_0x1c5aa5,_0x171cd5){var _0x3b6e2c={'raw':!![],'where':{}},_0x7cf8d6={},_0x4cc337;return db[_0xe63c('0x2f')][_0xe63c('0x55')]({'where':{'id':_0x329443['params']['id']}})[_0xe63c('0x27')](handleEntityNotFound(_0x1c5aa5,null))[_0xe63c('0x27')](function(_0x485af5){if(_0x485af5){_0x4cc337=_0x485af5[_0xe63c('0x29')]({'plain':!![]});_0x7cf8d6[_0xe63c('0x34')]=_[_0xe63c('0x36')](db[_0xe63c('0x56')][_0xe63c('0x30')]);_0x7cf8d6[_0xe63c('0x37')]=_[_0xe63c('0x36')](_0x329443[_0xe63c('0x37')]);_0x7cf8d6[_0xe63c('0x38')]=_[_0xe63c('0x39')](_0x7cf8d6[_0xe63c('0x34')],_0x7cf8d6[_0xe63c('0x37')]);_0x3b6e2c[_0xe63c('0x3a')]=_[_0xe63c('0x39')](_0x7cf8d6['model'],qs['fields'](_0x329443[_0xe63c('0x37')][_0xe63c('0x3b')]));_0x3b6e2c['attributes']=_0x3b6e2c[_0xe63c('0x3a')][_0xe63c('0x3c')]?_0x3b6e2c[_0xe63c('0x3a')]:_0x7cf8d6[_0xe63c('0x34')];if(!_0x329443[_0xe63c('0x37')][_0xe63c('0x3d')](_0xe63c('0x3e'))){_0x3b6e2c[_0xe63c('0x20')]=qs[_0xe63c('0x20')](_0x329443[_0xe63c('0x37')][_0xe63c('0x20')]);_0x3b6e2c[_0xe63c('0x23')]=qs['offset'](_0x329443[_0xe63c('0x37')]['offset']);}_0x3b6e2c[_0xe63c('0x57')]=qs[_0xe63c('0x58')](_0x329443[_0xe63c('0x37')][_0xe63c('0x58')]);_0x3b6e2c[_0xe63c('0x3f')]=qs['filters'](_[_0xe63c('0x59')](_0x329443[_0xe63c('0x37')],_0x7cf8d6['filters']));_0x3b6e2c[_0xe63c('0x3f')][_0xe63c('0x5a')]=_0x485af5['id'];if(_0x329443[_0xe63c('0x37')][_0xe63c('0x42')]){_0x3b6e2c['where']=_[_0xe63c('0x40')](_0x3b6e2c[_0xe63c('0x3f')],{'$or':_[_0xe63c('0x35')](_0x3b6e2c[_0xe63c('0x3a')],function(_0xd4013b){var _0x52f832={};_0x52f832[_0xd4013b]={'$like':'%'+_0x329443[_0xe63c('0x37')][_0xe63c('0x42')]+'%'};return _0x52f832;})});}_0x3b6e2c=_['merge']({},_0x3b6e2c,_0x329443[_0xe63c('0x43')]);return db['UserOpenchannelQueue']['findAll'](_0x3b6e2c);}})[_0xe63c('0x27')](function(_0xb72561){if(_0xb72561){return db['User'][_0xe63c('0x5b')]({'where':{'id':_[_0xe63c('0x35')](_0xb72561,'UserId'),'role':_0xe63c('0x5c')},'attributes':['id','name',_0xe63c('0x5d'),_0xe63c('0x5e'),'createdAt']});}})['then'](function(_0x5b9fec){if(_0x5b9fec){return{'count':_0x5b9fec[_0xe63c('0x22')],'rows':_[_0xe63c('0x35')](_0x5b9fec[_0xe63c('0x46')],function(_0x14d47c){return{'membername':_0x14d47c['name'],'UserId':_0x14d47c['id'],'queue_name':_0x4cc337[_0xe63c('0x2c')],'OpenchannelQueueId':_0x4cc337['id'],'interface':util[_0xe63c('0x5f')](_0xe63c('0x60'),_0xe63c('0x61'),_0x14d47c[_0xe63c('0x2c')]),'penalty':0x0,'paused':_0x14d47c[_0xe63c('0x5d')],'createdAt':_0x14d47c[_0xe63c('0x62')],'updatedAt':_0x14d47c[_0xe63c('0x5e')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xe63c('0x27')](respondWithFilteredResult(_0x1c5aa5,_0x3b6e2c))[_0xe63c('0x49')](handleError(_0x1c5aa5,null));};exports[_0xe63c('0x63')]=function(_0x397eae,_0x566661,_0x10b816){var _0x22b4e1={};var _0x5426f7={};var _0x309707;var _0x3b5995;return db[_0xe63c('0x2f')][_0xe63c('0x55')]({'where':{'id':_0x397eae[_0xe63c('0x48')]['id']}})[_0xe63c('0x27')](handleEntityNotFound(_0x566661,null))[_0xe63c('0x27')](function(_0x208687){if(_0x208687){_0x309707=_0x208687;_0x5426f7[_0xe63c('0x34')]=_[_0xe63c('0x36')](db[_0xe63c('0x64')][_0xe63c('0x30')]);_0x5426f7[_0xe63c('0x37')]=_[_0xe63c('0x36')](_0x397eae[_0xe63c('0x37')]);_0x5426f7[_0xe63c('0x38')]=_['intersection'](_0x5426f7[_0xe63c('0x34')],_0x5426f7['query']);_0x22b4e1[_0xe63c('0x3a')]=_[_0xe63c('0x39')](_0x5426f7[_0xe63c('0x34')],qs[_0xe63c('0x3b')](_0x397eae[_0xe63c('0x37')]['fields']));_0x22b4e1[_0xe63c('0x3a')]=_0x22b4e1[_0xe63c('0x3a')][_0xe63c('0x3c')]?_0x22b4e1[_0xe63c('0x3a')]:_0x5426f7[_0xe63c('0x34')];_0x22b4e1[_0xe63c('0x57')]=qs[_0xe63c('0x58')](_0x397eae['query'][_0xe63c('0x58')]);_0x22b4e1['where']=qs[_0xe63c('0x38')](_[_0xe63c('0x59')](_0x397eae[_0xe63c('0x37')],_0x5426f7[_0xe63c('0x38')]));if(_0x397eae[_0xe63c('0x37')][_0xe63c('0x42')]){_0x22b4e1[_0xe63c('0x3f')]=_[_0xe63c('0x40')](_0x22b4e1[_0xe63c('0x3f')],{'$or':_['map'](_0x22b4e1[_0xe63c('0x3a')],function(_0x501329){var _0x14110a={};_0x14110a[_0x501329]={'$like':'%'+_0x397eae[_0xe63c('0x37')]['filter']+'%'};return _0x14110a;})});}_0x22b4e1=_[_0xe63c('0x40')]({},_0x22b4e1,_0x397eae[_0xe63c('0x43')]);return _0x309707['getTeams'](_0x22b4e1);}})['then'](function(_0x5eaf4b){if(_0x5eaf4b){_0x3b5995=_0x5eaf4b['length'];if(!_0x397eae[_0xe63c('0x37')][_0xe63c('0x3d')](_0xe63c('0x3e'))){_0x22b4e1[_0xe63c('0x20')]=qs['limit'](_0x397eae[_0xe63c('0x37')][_0xe63c('0x20')]);_0x22b4e1['offset']=qs[_0xe63c('0x23')](_0x397eae[_0xe63c('0x37')][_0xe63c('0x23')]);}return _0x309707[_0xe63c('0x63')](_0x22b4e1);}})[_0xe63c('0x27')](function(_0x5051b3){if(_0x5051b3){return _0x5051b3?{'count':_0x3b5995,'rows':_0x5051b3}:null;}})[_0xe63c('0x27')](respondWithResult(_0x566661,null))[_0xe63c('0x49')](handleError(_0x566661,null));};exports['addTeams']=function(_0x169ec0,_0xf7ce94,_0x18116f){var _0x5c7f78=_0x169ec0[_0xe63c('0x4b')][_0xe63c('0x65')];return db['Team'][_0xe63c('0x66')]({'where':{'id':_0x5c7f78},'attributes':['id'],'include':[{'model':db[_0xe63c('0x67')],'as':_0xe63c('0x68'),'attributes':['id','name',_0xe63c('0x69'),_0xe63c('0x6a'),_0xe63c('0x6b')],'raw':!![]}]})[_0xe63c('0x27')](function(_0x3183e7){if(_0x3183e7){var _0x56769a=_[_0xe63c('0x6c')](_0x3183e7,function(_0x1f25b5){var _0x29c491=_0x1f25b5[_0xe63c('0x29')]({'plain':!![]});return _0x29c491['Agents'];});return db[_0xe63c('0x2f')]['find']({'where':{'id':_0x169ec0['params']['id']}})[_0xe63c('0x27')](function(_0x38dec5){return db[_0xe63c('0x6d')][_0xe63c('0x6e')](function(_0x107d80){return _0x38dec5[_0xe63c('0x6f')](_0x5c7f78,{'transaction':_0x107d80})[_0xe63c('0x27')](function(){return BPromise[_0xe63c('0x70')](_0x56769a,function(_0x34a849){return db[_0xe63c('0x56')][_0xe63c('0x71')]({'where':{'UserId':_0x34a849['id'],'OpenchannelQueueId':_0x169ec0[_0xe63c('0x48')]['id']},'transaction':_0x107d80});});})[_0xe63c('0x27')](function(){_0x56769a['forEach'](function(_0x18d857){socket['emit']('userOpenchannelQueue:save',{'UserId':_0x18d857['id'],'OpenchannelQueueId':_0x38dec5['id']});});});});});}})['then'](respondWithStatusCode(_0xf7ce94,null))['catch'](handleError(_0xf7ce94,null));};exports[_0xe63c('0x72')]=function(_0x3ab8d1,_0x32424c,_0x46c545){return db[_0xe63c('0x64')][_0xe63c('0x66')]({'where':{'id':_0x3ab8d1['query'][_0xe63c('0x65')]},'attributes':['id'],'include':[{'model':db[_0xe63c('0x67')],'as':_0xe63c('0x68'),'attributes':['id'],'raw':!![]}]})[_0xe63c('0x27')](handleEntityNotFound(_0x32424c,null))[_0xe63c('0x27')](function(_0x50a034){var _0x9b7ea2=_[_0xe63c('0x35')](_0x50a034,'id');var _0xc7a710=[];var _0x59065c=[];var _0x2622ff=squel['select']();_0x2622ff[_0xe63c('0x73')](_0xe63c('0x74'))[_0xe63c('0x75')](_0xe63c('0x76'),'tq')[_0xe63c('0x77')](_0xe63c('0x78'),'ut',_0xe63c('0x79'))[_0xe63c('0x3f')](_0xe63c('0x7a'),_0x3ab8d1[_0xe63c('0x48')]['id']);for(var _0x2f326c=0x0;_0x2f326c<_0x50a034[_0xe63c('0x3c')];_0x2f326c+=0x1){let _0x2faad1=_0x50a034[_0x2f326c];for(var _0x26b3d1=0x0;_0x26b3d1<_0x2faad1[_0xe63c('0x68')][_0xe63c('0x3c')];_0x26b3d1+=0x1){let _0x5f5326=_0x2faad1[_0xe63c('0x68')][_0x26b3d1];var _0x46ee74=_0x2622ff[_0xe63c('0x7b')]();_0x46ee74['where']('ut.UserId\x20=\x20?',_0x5f5326['id']);_0x59065c[_0xe63c('0x7c')](db[_0xe63c('0x6d')][_0xe63c('0x37')](_0x46ee74[_0xe63c('0x7d')](),{'type':db[_0xe63c('0x6d')][_0xe63c('0x7e')]['SELECT']})[_0xe63c('0x27')](function(_0x3dc3ba){if(_0x3dc3ba[_0xe63c('0x3c')]===0x1){return _0x5f5326['id'];}else{var _0x144c61=_[_0xe63c('0x7f')](_[_0xe63c('0x35')](_0x3dc3ba,_0xe63c('0x80')),function(_0x2bed92){return _[_0xe63c('0x81')](_0x9b7ea2,_0x2bed92);});if(_0x144c61){return _0x5f5326['id'];}}}));}}return BPromise[_0xe63c('0x82')](_0x59065c)['then'](function(_0x1b11ff){_0xc7a710=_(_0xc7a710)[_0xe63c('0x83')](_0x1b11ff)['compact']()[_0xe63c('0x84')]();return db['OpenchannelQueue'][_0xe63c('0x50')]({'where':{'id':_0x3ab8d1['params']['id']}})[_0xe63c('0x27')](function(_0x555061){return db[_0xe63c('0x6d')][_0xe63c('0x6e')](function(_0x3367e9){return _0x555061['removeTeams'](_0x3ab8d1[_0xe63c('0x37')][_0xe63c('0x65')],{'transaction':_0x3367e9})[_0xe63c('0x27')](function(){if(!_[_0xe63c('0x85')](_0xc7a710)){return _0x555061[_0xe63c('0x86')](_0xc7a710,{'transaction':_0x3367e9});}})[_0xe63c('0x27')](function(){_0xc7a710[_0xe63c('0x87')](function(_0x359360){socket[_0xe63c('0x88')]('userOpenchannelQueue:remove',{'UserId':_0x359360,'OpenchannelQueueId':_0x555061['id']});});});});});});})[_0xe63c('0x27')](respondWithStatusCode(_0x32424c,null))[_0xe63c('0x49')](handleError(_0x32424c,null));};exports[_0xe63c('0x89')]=function(_0xffd16c,_0x339006,_0x4ebcc8){return db[_0xe63c('0x2f')]['find']({'where':{'id':_0xffd16c[_0xe63c('0x48')]['id']}})['then'](handleEntityNotFound(_0x339006,null))['then'](function(_0x3a2d67){if(_0x3a2d67){return _0x3a2d67[_0xe63c('0x89')](_0xffd16c['body']['ids'],_[_0xe63c('0x8a')](_0xffd16c[_0xe63c('0x4b')],[_0xe63c('0x65'),'id'])||{})[_0xe63c('0x8b')](function(_0x288d58){for(var _0x284d40=0x0;_0x284d40<_0xffd16c['body'][_0xe63c('0x65')]['length'];_0x284d40+=0x1){socket['emit']('userOpenchannelQueue:save',{'UserId':Number(_0xffd16c[_0xe63c('0x4b')][_0xe63c('0x65')][_0x284d40]),'OpenchannelQueueId':Number(_0xffd16c[_0xe63c('0x48')]['id'])});}return _0x288d58;});}})[_0xe63c('0x27')](respondWithResult(_0x339006,null))['catch'](handleError(_0x339006,null));};exports['removeAgents']=function(_0x48ac31,_0x114ae8,_0x54e7b6){return db[_0xe63c('0x2f')][_0xe63c('0x50')]({'where':{'id':_0x48ac31[_0xe63c('0x48')]['id']}})[_0xe63c('0x27')](handleEntityNotFound(_0x114ae8,null))[_0xe63c('0x27')](function(_0x59841f){if(_0x59841f){return _0x59841f['removeAgents'](_0x48ac31[_0xe63c('0x37')][_0xe63c('0x65')])[_0xe63c('0x27')](function(){if(_[_0xe63c('0x8c')](_0x48ac31[_0xe63c('0x37')][_0xe63c('0x65')])){for(var _0x322008=0x0;_0x322008<_0x48ac31[_0xe63c('0x37')][_0xe63c('0x65')]['length'];_0x322008+=0x1){socket[_0xe63c('0x88')](_0xe63c('0x8d'),{'UserId':Number(_0x48ac31['query'][_0xe63c('0x65')][_0x322008]),'OpenchannelQueueId':Number(_0x48ac31['params']['id'])});}}else{socket['emit']('userOpenchannelQueue:remove',{'UserId':Number(_0x48ac31[_0xe63c('0x37')]['ids']),'OpenchannelQueueId':Number(_0x48ac31['params']['id'])});}});}})[_0xe63c('0x27')](respondWithStatusCode(_0x114ae8,null))[_0xe63c('0x49')](handleError(_0x114ae8,null));};exports[_0xe63c('0x8e')]=function(_0x4a27fa,_0xf0267b,_0x641c7d){var _0x403735={};var _0x5a1037={};var _0x33482d;var _0x37a186;return db[_0xe63c('0x2f')][_0xe63c('0x55')]({'where':{'id':_0x4a27fa[_0xe63c('0x48')]['id']}})['then'](handleEntityNotFound(_0xf0267b,null))[_0xe63c('0x27')](function(_0x22efae){if(_0x22efae){_0x33482d=_0x22efae;_0x5a1037[_0xe63c('0x34')]=_[_0xe63c('0x36')](db[_0xe63c('0x67')][_0xe63c('0x30')]);_0x5a1037['query']=_[_0xe63c('0x36')](_0x4a27fa[_0xe63c('0x37')]);_0x5a1037['filters']=_[_0xe63c('0x39')](_0x5a1037[_0xe63c('0x34')],_0x5a1037[_0xe63c('0x37')]);_0x403735[_0xe63c('0x3a')]=_[_0xe63c('0x39')](_0x5a1037['model'],qs[_0xe63c('0x3b')](_0x4a27fa[_0xe63c('0x37')][_0xe63c('0x3b')]));_0x403735[_0xe63c('0x3a')]=_0x403735[_0xe63c('0x3a')][_0xe63c('0x3c')]?_0x403735[_0xe63c('0x3a')]:_0x5a1037[_0xe63c('0x34')];_0x403735[_0xe63c('0x57')]=qs[_0xe63c('0x58')](_0x4a27fa[_0xe63c('0x37')]['sort']);_0x403735[_0xe63c('0x3f')]=qs['filters'](_['pick'](_0x4a27fa[_0xe63c('0x37')],_0x5a1037[_0xe63c('0x38')]));if(_0x4a27fa['query'][_0xe63c('0x42')]){_0x403735[_0xe63c('0x3f')]=_[_0xe63c('0x40')](_0x403735['where'],{'$or':_['map'](_0x403735[_0xe63c('0x3a')],function(_0xb38c4e){var _0x1baa0f={};_0x1baa0f[_0xb38c4e]={'$like':'%'+_0x4a27fa[_0xe63c('0x37')][_0xe63c('0x42')]+'%'};return _0x1baa0f;})});}_0x403735=_[_0xe63c('0x40')]({},_0x403735,_0x4a27fa['options']);return _0x33482d[_0xe63c('0x8e')](_0x403735);}})[_0xe63c('0x27')](function(_0x2598ed){if(_0x2598ed){_0x37a186=_0x2598ed[_0xe63c('0x3c')];if(!_0x4a27fa['query'][_0xe63c('0x3d')](_0xe63c('0x3e'))){_0x403735[_0xe63c('0x20')]=qs[_0xe63c('0x20')](_0x4a27fa[_0xe63c('0x37')][_0xe63c('0x20')]);_0x403735[_0xe63c('0x23')]=qs[_0xe63c('0x23')](_0x4a27fa[_0xe63c('0x37')][_0xe63c('0x23')]);}return _0x33482d[_0xe63c('0x8e')](_0x403735);}})['then'](function(_0x1840bb){if(_0x1840bb){return _0x1840bb?{'count':_0x37a186,'rows':_0x1840bb}:null;}})[_0xe63c('0x27')](respondWithResult(_0xf0267b,null))['catch'](handleError(_0xf0267b,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index 1250e32..d5528ec 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 _0x073d=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save'];(function(_0x54ce10,_0x429544){var _0x4b958e=function(_0xf9c02){while(--_0xf9c02){_0x54ce10['push'](_0x54ce10['shift']());}};_0x4b958e(++_0x429544);}(_0x073d,0xc2));var _0xd073=function(_0x1722bf,_0x2fa7f4){_0x1722bf=_0x1722bf-0x0;var _0x58c607=_0x073d[_0x1722bf];return _0x58c607;};'use strict';var EventEmitter=require(_0xd073('0x0'));var OpenchannelQueue=require(_0xd073('0x1'))['db']['OpenchannelQueue'];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0xd073('0x2')](0x0);var events={'afterCreate':_0xd073('0x3'),'afterUpdate':'update','afterDestroy':_0xd073('0x4')};function emitEvent(_0x331633){return function(_0x4e31fa,_0x2627ee,_0x52ef0a){OpenchannelQueueEvents['emit'](_0x331633+':'+_0x4e31fa['id'],_0x4e31fa);OpenchannelQueueEvents[_0xd073('0x5')](_0x331633,_0x4e31fa);_0x52ef0a(null);};}for(var e in events){if(events[_0xd073('0x6')](e)){var event=events[e];OpenchannelQueue[_0xd073('0x7')](e,emitEvent(event));}}module[_0xd073('0x8')]=OpenchannelQueueEvents; \ No newline at end of file +var _0x76f0=['OpenchannelQueue','save','remove','hasOwnProperty','hook','exports','events'];(function(_0xa1f14c,_0x596721){var _0x4648f0=function(_0xe57825){while(--_0xe57825){_0xa1f14c['push'](_0xa1f14c['shift']());}};_0x4648f0(++_0x596721);}(_0x76f0,0x7d));var _0x076f=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x76f0[_0x42cae2];return _0x5f256f;};'use strict';var EventEmitter=require(_0x076f('0x0'));var OpenchannelQueue=require('../../mysqldb')['db'][_0x076f('0x1')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x076f('0x2'),'afterUpdate':'update','afterDestroy':_0x076f('0x3')};function emitEvent(_0x1b738a){return function(_0x996a8c,_0x4c5fcf,_0x5f55bf){OpenchannelQueueEvents['emit'](_0x1b738a+':'+_0x996a8c['id'],_0x996a8c);OpenchannelQueueEvents['emit'](_0x1b738a,_0x996a8c);_0x5f55bf(null);};}for(var e in events){if(events[_0x076f('0x4')](e)){var event=events[e];OpenchannelQueue[_0x076f('0x5')](e,emitEvent(event));}}module[_0x076f('0x6')]=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index e085b6d..71c374d 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 _0x6a07=['moment','bluebird','path','./openchannelQueue.attributes','exports','define','OpenchannelQueue','openchannel_queues','lodash','util','../../config/logger','api'];(function(_0x107c34,_0x92d2cc){var _0x2098fc=function(_0x46a41c){while(--_0x46a41c){_0x107c34['push'](_0x107c34['shift']());}};_0x2098fc(++_0x92d2cc);}(_0x6a07,0x14c));var _0x76a0=function(_0x1abb11,_0xd68915){_0x1abb11=_0x1abb11-0x0;var _0x149a9f=_0x6a07[_0x1abb11];return _0x149a9f;};'use strict';var _=require(_0x76a0('0x0'));var util=require(_0x76a0('0x1'));var logger=require(_0x76a0('0x2'))(_0x76a0('0x3'));var moment=require(_0x76a0('0x4'));var BPromise=require(_0x76a0('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x76a0('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x76a0('0x7'));module[_0x76a0('0x8')]=function(_0x39e0a2,_0x151da3){return _0x39e0a2[_0x76a0('0x9')](_0x76a0('0xa'),attributes,{'tableName':_0x76a0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6512=['define','OpenchannelQueue','openchannel_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./openchannelQueue.attributes','exports'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x6512,0x1ed));var _0x2651=function(_0x4ddf82,_0x54124b){_0x4ddf82=_0x4ddf82-0x0;var _0x5a7575=_0x6512[_0x4ddf82];return _0x5a7575;};'use strict';var _=require(_0x2651('0x0'));var util=require(_0x2651('0x1'));var logger=require(_0x2651('0x2'))(_0x2651('0x3'));var moment=require(_0x2651('0x4'));var BPromise=require(_0x2651('0x5'));var rp=require(_0x2651('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2651('0x7'));var config=require(_0x2651('0x8'));var attributes=require(_0x2651('0x9'));module[_0x2651('0xa')]=function(_0x1eb793,_0x290645){return _0x1eb793[_0x2651('0xb')](_0x2651('0xc'),attributes,{'tableName':_0x2651('0xd'),'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 382f313..94e7cd5 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 _0xf5ee=['result','catch','OpenchannelQueue','findAll','options','raw','where','attributes','limit','include','map','model','GetOpenchannelQueue','ShowOpenchannelQueue','find','stringify','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','defaults','socket.io-emitter','./openchannelQueue.socket','register','request','then','request\x20sent','debug','code','error','OpenchannelQueue,\x20%s,\x20%s','message','info'];(function(_0x4280b2,_0x14d9b7){var _0x36fc36=function(_0x51d164){while(--_0x51d164){_0x4280b2['push'](_0x4280b2['shift']());}};_0x36fc36(++_0x14d9b7);}(_0xf5ee,0x1f0));var _0xef5e=function(_0x4cd7bd,_0x33b3e1){_0x4cd7bd=_0x4cd7bd-0x0;var _0x3833b7=_0xf5ee[_0x4cd7bd];return _0x3833b7;};'use strict';var _=require(_0xef5e('0x0'));var util=require(_0xef5e('0x1'));var moment=require('moment');var BPromise=require(_0xef5e('0x2'));var rs=require(_0xef5e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xef5e('0x4'))['db'];var utils=require(_0xef5e('0x5'));var logger=require(_0xef5e('0x6'))(_0xef5e('0x7'));var config=require('../../config/environment');var jayson=require(_0xef5e('0x8'));var client=jayson['client'][_0xef5e('0x9')]({'port':0x232a});config[_0xef5e('0xa')]=_[_0xef5e('0xb')](config[_0xef5e('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xef5e('0xc'))(new Redis(config[_0xef5e('0xa')]));require(_0xef5e('0xd'))[_0xef5e('0xe')](socket);function respondWithRpcPromise(_0x2c988a,_0x578c1a,_0x43c880){return new BPromise(function(_0x4a8ef1,_0x4c83d3){return client[_0xef5e('0xf')](_0x2c988a,_0x43c880)[_0xef5e('0x10')](function(_0x167ddf){logger['info']('OpenchannelQueue,\x20%s,\x20%s',_0x578c1a,_0xef5e('0x11'));logger[_0xef5e('0x12')]('OpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x578c1a,'request\x20sent',JSON['stringify'](_0x167ddf));if(_0x167ddf['error']){if(_0x167ddf['error'][_0xef5e('0x13')]===0x1f4){logger[_0xef5e('0x14')](_0xef5e('0x15'),_0x578c1a,_0x167ddf['error'][_0xef5e('0x16')]);return _0x4c83d3(_0x167ddf[_0xef5e('0x14')][_0xef5e('0x16')]);}logger[_0xef5e('0x14')](_0xef5e('0x15'),_0x578c1a,_0x167ddf[_0xef5e('0x14')][_0xef5e('0x16')]);return _0x4a8ef1(_0x167ddf[_0xef5e('0x14')][_0xef5e('0x16')]);}else{logger[_0xef5e('0x17')]('OpenchannelQueue,\x20%s,\x20%s',_0x578c1a,'request\x20sent');_0x4a8ef1(_0x167ddf[_0xef5e('0x18')][_0xef5e('0x16')]);}})[_0xef5e('0x19')](function(_0x46ade8){logger['error'](_0xef5e('0x15'),_0x578c1a,_0x46ade8);_0x4c83d3(_0x46ade8);});});}exports['GetOpenchannelQueue']=function(_0x209841){var _0x55814d=this;return new Promise(function(_0x28704a,_0x1bbf08){return db[_0xef5e('0x1a')][_0xef5e('0x1b')]({'raw':_0x209841[_0xef5e('0x1c')]?_0x209841[_0xef5e('0x1c')][_0xef5e('0x1d')]===undefined?!![]:![]:!![],'where':_0x209841['options']?_0x209841[_0xef5e('0x1c')][_0xef5e('0x1e')]||null:null,'attributes':_0x209841[_0xef5e('0x1c')]?_0x209841['options'][_0xef5e('0x1f')]||null:null,'limit':_0x209841[_0xef5e('0x1c')]?_0x209841[_0xef5e('0x1c')][_0xef5e('0x20')]||null:null,'include':_0x209841['options']?_0x209841['options'][_0xef5e('0x21')]?_[_0xef5e('0x22')](_0x209841[_0xef5e('0x1c')][_0xef5e('0x21')],function(_0x468803){return{'model':db[_0x468803[_0xef5e('0x23')]],'as':_0x468803['as'],'attributes':_0x468803[_0xef5e('0x1f')],'include':_0x468803[_0xef5e('0x21')]?_[_0xef5e('0x22')](_0x468803[_0xef5e('0x21')],function(_0x107e35){return{'model':db[_0x107e35['model']],'as':_0x107e35['as'],'attributes':_0x107e35[_0xef5e('0x1f')],'include':_0x107e35[_0xef5e('0x21')]?_['map'](_0x107e35['include'],function(_0x4d3025){return{'model':db[_0x4d3025[_0xef5e('0x23')]],'as':_0x4d3025['as'],'attributes':_0x4d3025[_0xef5e('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xef5e('0x10')](function(_0x5b8345){logger[_0xef5e('0x17')](_0xef5e('0x24'),_0x209841);logger[_0xef5e('0x12')](_0xef5e('0x24'),_0x209841,JSON['stringify'](_0x5b8345));_0x28704a(_0x5b8345);})[_0xef5e('0x19')](function(_0x58a7ce){logger[_0xef5e('0x14')](_0xef5e('0x24'),_0x58a7ce[_0xef5e('0x16')],_0x209841);_0x1bbf08(_0x55814d[_0xef5e('0x14')](0x1f4,_0x58a7ce[_0xef5e('0x16')]));});});};exports[_0xef5e('0x25')]=function(_0x23c4a0){var _0x31dc66=this;return new Promise(function(_0x3bde61,_0x1b9980){return db['OpenchannelQueue'][_0xef5e('0x26')]({'raw':_0x23c4a0['options']?_0x23c4a0['options'][_0xef5e('0x1d')]===undefined?!![]:![]:!![],'where':_0x23c4a0[_0xef5e('0x1c')]?_0x23c4a0[_0xef5e('0x1c')][_0xef5e('0x1e')]||null:null,'attributes':_0x23c4a0[_0xef5e('0x1c')]?_0x23c4a0['options'][_0xef5e('0x1f')]||null:null,'include':_0x23c4a0['options']?_0x23c4a0['options']['include']?_[_0xef5e('0x22')](_0x23c4a0[_0xef5e('0x1c')]['include'],function(_0x1ac6dd){return{'model':db[_0x1ac6dd[_0xef5e('0x23')]],'as':_0x1ac6dd['as'],'attributes':_0x1ac6dd['attributes'],'include':_0x1ac6dd[_0xef5e('0x21')]?_[_0xef5e('0x22')](_0x1ac6dd[_0xef5e('0x21')],function(_0x5dc199){return{'model':db[_0x5dc199[_0xef5e('0x23')]],'as':_0x5dc199['as'],'attributes':_0x5dc199['attributes'],'include':_0x5dc199[_0xef5e('0x21')]?_['map'](_0x5dc199[_0xef5e('0x21')],function(_0xe83804){return{'model':db[_0xe83804[_0xef5e('0x23')]],'as':_0xe83804['as'],'attributes':_0xe83804[_0xef5e('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xef5e('0x10')](function(_0x15c268){logger['info']('ShowOpenchannelQueue',_0x23c4a0);logger['debug'](_0xef5e('0x25'),_0x23c4a0,JSON[_0xef5e('0x27')](_0x15c268));_0x3bde61(_0x15c268);})[_0xef5e('0x19')](function(_0x2d2c0c){logger[_0xef5e('0x14')](_0xef5e('0x25'),_0x2d2c0c[_0xef5e('0x16')],_0x23c4a0);_0x1b9980(_0x31dc66['error'](0x1f4,_0x2d2c0c[_0xef5e('0x16')]));});});}; \ No newline at end of file +var _0x8618=['catch','GetOpenchannelQueue','findAll','options','raw','limit','include','attributes','map','model','OpenchannelQueue','find','ShowOpenchannelQueue','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','http','redis','./openchannelQueue.socket','request','then','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result'];(function(_0x3f3053,_0x907307){var _0x3c107c=function(_0xf8b4c3){while(--_0xf8b4c3){_0x3f3053['push'](_0x3f3053['shift']());}};_0x3c107c(++_0x907307);}(_0x8618,0x79));var _0x8861=function(_0x35b803,_0x42b7bf){_0x35b803=_0x35b803-0x0;var _0x11378d=_0x8618[_0x35b803];return _0x11378d;};'use strict';var _=require(_0x8861('0x0'));var util=require(_0x8861('0x1'));var moment=require(_0x8861('0x2'));var BPromise=require(_0x8861('0x3'));var rs=require(_0x8861('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x8861('0x5'));var logger=require(_0x8861('0x6'))('rpc');var config=require(_0x8861('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8861('0x8')]({'port':0x232a});config[_0x8861('0x9')]=_['defaults'](config[_0x8861('0x9')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8861('0x9')]));require(_0x8861('0xa'))['register'](socket);function respondWithRpcPromise(_0x67ffee,_0x550efe,_0x4e8a66){return new BPromise(function(_0x1ee165,_0xc4d1b){return client[_0x8861('0xb')](_0x67ffee,_0x4e8a66)[_0x8861('0xc')](function(_0x2f9ee8){logger['info'](_0x8861('0xd'),_0x550efe,_0x8861('0xe'));logger[_0x8861('0xf')](_0x8861('0x10'),_0x550efe,_0x8861('0xe'),JSON[_0x8861('0x11')](_0x2f9ee8));if(_0x2f9ee8['error']){if(_0x2f9ee8[_0x8861('0x12')][_0x8861('0x13')]===0x1f4){logger[_0x8861('0x12')]('OpenchannelQueue,\x20%s,\x20%s',_0x550efe,_0x2f9ee8[_0x8861('0x12')]['message']);return _0xc4d1b(_0x2f9ee8[_0x8861('0x12')][_0x8861('0x14')]);}logger[_0x8861('0x12')](_0x8861('0xd'),_0x550efe,_0x2f9ee8[_0x8861('0x12')]['message']);return _0x1ee165(_0x2f9ee8[_0x8861('0x12')][_0x8861('0x14')]);}else{logger[_0x8861('0x15')](_0x8861('0xd'),_0x550efe,_0x8861('0xe'));_0x1ee165(_0x2f9ee8[_0x8861('0x16')][_0x8861('0x14')]);}})[_0x8861('0x17')](function(_0x494bb4){logger[_0x8861('0x12')](_0x8861('0xd'),_0x550efe,_0x494bb4);_0xc4d1b(_0x494bb4);});});}exports[_0x8861('0x18')]=function(_0x597a8d){var _0x3197eb=this;return new Promise(function(_0x240aeb,_0x5c0bdd){return db['OpenchannelQueue'][_0x8861('0x19')]({'raw':_0x597a8d['options']?_0x597a8d[_0x8861('0x1a')][_0x8861('0x1b')]===undefined?!![]:![]:!![],'where':_0x597a8d['options']?_0x597a8d['options']['where']||null:null,'attributes':_0x597a8d[_0x8861('0x1a')]?_0x597a8d[_0x8861('0x1a')]['attributes']||null:null,'limit':_0x597a8d[_0x8861('0x1a')]?_0x597a8d[_0x8861('0x1a')][_0x8861('0x1c')]||null:null,'include':_0x597a8d['options']?_0x597a8d['options'][_0x8861('0x1d')]?_['map'](_0x597a8d[_0x8861('0x1a')][_0x8861('0x1d')],function(_0x450a4d){return{'model':db[_0x450a4d['model']],'as':_0x450a4d['as'],'attributes':_0x450a4d[_0x8861('0x1e')],'include':_0x450a4d[_0x8861('0x1d')]?_[_0x8861('0x1f')](_0x450a4d['include'],function(_0xc9aff4){return{'model':db[_0xc9aff4[_0x8861('0x20')]],'as':_0xc9aff4['as'],'attributes':_0xc9aff4[_0x8861('0x1e')],'include':_0xc9aff4[_0x8861('0x1d')]?_[_0x8861('0x1f')](_0xc9aff4['include'],function(_0x3ac002){return{'model':db[_0x3ac002[_0x8861('0x20')]],'as':_0x3ac002['as'],'attributes':_0x3ac002[_0x8861('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x8861('0xc')](function(_0x5baa42){logger['info'](_0x8861('0x18'),_0x597a8d);logger['debug'](_0x8861('0x18'),_0x597a8d,JSON[_0x8861('0x11')](_0x5baa42));_0x240aeb(_0x5baa42);})['catch'](function(_0x7c05a0){logger[_0x8861('0x12')](_0x8861('0x18'),_0x7c05a0[_0x8861('0x14')],_0x597a8d);_0x5c0bdd(_0x3197eb[_0x8861('0x12')](0x1f4,_0x7c05a0[_0x8861('0x14')]));});});};exports['ShowOpenchannelQueue']=function(_0x291cad){var _0x2a63be=this;return new Promise(function(_0x588ab8,_0x5e5916){return db[_0x8861('0x21')][_0x8861('0x22')]({'raw':_0x291cad['options']?_0x291cad[_0x8861('0x1a')][_0x8861('0x1b')]===undefined?!![]:![]:!![],'where':_0x291cad[_0x8861('0x1a')]?_0x291cad[_0x8861('0x1a')]['where']||null:null,'attributes':_0x291cad[_0x8861('0x1a')]?_0x291cad[_0x8861('0x1a')]['attributes']||null:null,'include':_0x291cad['options']?_0x291cad[_0x8861('0x1a')][_0x8861('0x1d')]?_[_0x8861('0x1f')](_0x291cad[_0x8861('0x1a')]['include'],function(_0x25c9d4){return{'model':db[_0x25c9d4[_0x8861('0x20')]],'as':_0x25c9d4['as'],'attributes':_0x25c9d4['attributes'],'include':_0x25c9d4[_0x8861('0x1d')]?_['map'](_0x25c9d4[_0x8861('0x1d')],function(_0x5edf7d){return{'model':db[_0x5edf7d[_0x8861('0x20')]],'as':_0x5edf7d['as'],'attributes':_0x5edf7d['attributes'],'include':_0x5edf7d[_0x8861('0x1d')]?_[_0x8861('0x1f')](_0x5edf7d['include'],function(_0x52c91c){return{'model':db[_0x52c91c[_0x8861('0x20')]],'as':_0x52c91c['as'],'attributes':_0x52c91c[_0x8861('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x8861('0xc')](function(_0x38c186){logger[_0x8861('0x15')]('ShowOpenchannelQueue',_0x291cad);logger['debug']('ShowOpenchannelQueue',_0x291cad,JSON['stringify'](_0x38c186));_0x588ab8(_0x38c186);})[_0x8861('0x17')](function(_0x3d1cca){logger['error'](_0x8861('0x23'),_0x3d1cca[_0x8861('0x14')],_0x291cad);_0x5e5916(_0x2a63be['error'](0x1f4,_0x3d1cca[_0x8861('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index 78da939..324f94f 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 _0x2df1=['openchannelQueue:','./openchannelQueue.events','save','remove','update','emit','removeListener','register'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x2df1,0x151));var _0x12df=function(_0x345c6f,_0x1d6743){_0x345c6f=_0x345c6f-0x0;var _0x11613c=_0x2df1[_0x345c6f];return _0x11613c;};'use strict';var OpenchannelQueueEvents=require(_0x12df('0x0'));var events=[_0x12df('0x1'),_0x12df('0x2'),_0x12df('0x3')];function createListener(_0x329463,_0x518bba){return function(_0xdf40d1){_0x518bba[_0x12df('0x4')](_0x329463,_0xdf40d1);};}function removeListener(_0x3d7cae,_0x973ef4){return function(){OpenchannelQueueEvents[_0x12df('0x5')](_0x3d7cae,_0x973ef4);};}exports[_0x12df('0x6')]=function(_0x640346){for(var _0x40fbb2=0x0,_0x518f34=events['length'];_0x40fbb2<_0x518f34;_0x40fbb2++){var _0x1427cb=events[_0x40fbb2];var _0x42ed87=createListener(_0x12df('0x7')+_0x1427cb,_0x640346);OpenchannelQueueEvents['on'](_0x1427cb,_0x42ed87);}}; \ No newline at end of file +var _0x8df0=['openchannelQueue:','./openchannelQueue.events','save','remove','update','removeListener','register','length'];(function(_0xb06a94,_0x163422){var _0x43569d=function(_0x263ec3){while(--_0x263ec3){_0xb06a94['push'](_0xb06a94['shift']());}};_0x43569d(++_0x163422);}(_0x8df0,0x1b9));var _0x08df=function(_0x56e26a,_0x1436c7){_0x56e26a=_0x56e26a-0x0;var _0x514667=_0x8df0[_0x56e26a];return _0x514667;};'use strict';var OpenchannelQueueEvents=require(_0x08df('0x0'));var events=[_0x08df('0x1'),_0x08df('0x2'),_0x08df('0x3')];function createListener(_0x506c40,_0x57bceb){return function(_0x5a73d2){_0x57bceb['emit'](_0x506c40,_0x5a73d2);};}function removeListener(_0x1e7e0b,_0x30db7d){return function(){OpenchannelQueueEvents[_0x08df('0x4')](_0x1e7e0b,_0x30db7d);};}exports[_0x08df('0x5')]=function(_0xabf768){for(var _0x493abf=0x0,_0x36e3ce=events[_0x08df('0x6')];_0x493abf<_0x36e3ce;_0x493abf++){var _0x60b502=events[_0x493abf];var _0x1ad266=createListener(_0x08df('0x7')+_0x60b502,_0xabf768);OpenchannelQueueEvents['on'](_0x60b502,_0x1ad266);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index afd1a72..f2198ee 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 _0x1275=['../../components/auth/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','post','create','update','delete','exports','util','connect-timeout','fs-extra'];(function(_0x59ee41,_0xaf7db8){var _0x3ecd3e=function(_0x2f9291){while(--_0x2f9291){_0x59ee41['push'](_0x59ee41['shift']());}};_0x3ecd3e(++_0xaf7db8);}(_0x1275,0xfd));var _0x5127=function(_0x3dc30f,_0x519ee9){_0x3dc30f=_0x3dc30f-0x0;var _0x24d7fc=_0x1275[_0x3dc30f];return _0x24d7fc;};'use strict';var multer=require('multer');var util=require(_0x5127('0x0'));var path=require('path');var timeout=require(_0x5127('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x5127('0x2'));var auth=require(_0x5127('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x5127('0x4'));var controller=require('./openchannelQueueReport.controller');router[_0x5127('0x5')]('/',auth[_0x5127('0x6')](),controller['index']);router[_0x5127('0x5')](_0x5127('0x7'),auth[_0x5127('0x6')](),controller[_0x5127('0x8')]);router['get'](_0x5127('0x9'),auth[_0x5127('0x6')](),controller[_0x5127('0xa')]);router[_0x5127('0xb')]('/',auth[_0x5127('0x6')](),controller[_0x5127('0xc')]);router['put'](_0x5127('0x9'),auth['isAuthenticated'](),controller[_0x5127('0xd')]);router[_0x5127('0xe')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x5127('0xf')]=router; \ No newline at end of file +var _0x8195=['isAuthenticated','/describe','show','post','create','put','/:id','delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','get'];(function(_0x1eb837,_0x4a6abe){var _0x12bc91=function(_0x4170a0){while(--_0x4170a0){_0x1eb837['push'](_0x1eb837['shift']());}};_0x12bc91(++_0x4a6abe);}(_0x8195,0x6e));var _0x5819=function(_0x264fca,_0x453890){_0x264fca=_0x264fca-0x0;var _0x12e2e8=_0x8195[_0x264fca];return _0x12e2e8;};'use strict';var multer=require(_0x5819('0x0'));var util=require('util');var path=require(_0x5819('0x1'));var timeout=require(_0x5819('0x2'));var express=require('express');var router=express[_0x5819('0x3')]();var fs_extra=require(_0x5819('0x4'));var auth=require(_0x5819('0x5'));var interaction=require(_0x5819('0x6'));var config=require(_0x5819('0x7'));var controller=require(_0x5819('0x8'));router[_0x5819('0x9')]('/',auth[_0x5819('0xa')](),controller['index']);router['get'](_0x5819('0xb'),auth[_0x5819('0xa')](),controller['describe']);router[_0x5819('0x9')]('/:id',auth[_0x5819('0xa')](),controller[_0x5819('0xc')]);router[_0x5819('0xd')]('/',auth[_0x5819('0xa')](),controller[_0x5819('0xe')]);router[_0x5819('0xf')](_0x5819('0x10'),auth[_0x5819('0xa')](),controller['update']);router[_0x5819('0x11')](_0x5819('0x10'),auth[_0x5819('0xa')](),controller[_0x5819('0x12')]);module[_0x5819('0x13')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index 0725adf..ba2c5f8 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 _0x510e=['exports','STRING','DATE','moment','sequelize'];(function(_0x515afd,_0x1a1e91){var _0x536d53=function(_0x1d3a89){while(--_0x1d3a89){_0x515afd['push'](_0x515afd['shift']());}};_0x536d53(++_0x1a1e91);}(_0x510e,0x1ed));var _0xe510=function(_0x24061a,_0x1c9f4d){_0x24061a=_0x24061a-0x0;var _0x82054e=_0x510e[_0x24061a];return _0x82054e;};'use strict';var moment=require(_0xe510('0x0'));var Sequelize=require(_0xe510('0x1'));module[_0xe510('0x2')]={'uniqueid':{'type':Sequelize[_0xe510('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xe510('0x3')]},'joinAt':{'type':Sequelize[_0xe510('0x4')]},'leaveAt':{'type':Sequelize[_0xe510('0x4')]},'acceptAt':{'type':Sequelize[_0xe510('0x4')]},'exitAt':{'type':Sequelize[_0xe510('0x4')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xa252=['STRING','DATE','moment','exports'];(function(_0x1defc3,_0x24a805){var _0x1781e6=function(_0x43e46b){while(--_0x43e46b){_0x1defc3['push'](_0x1defc3['shift']());}};_0x1781e6(++_0x24a805);}(_0xa252,0x166));var _0x2a25=function(_0x29bb17,_0x3e4210){_0x29bb17=_0x29bb17-0x0;var _0x32c8b2=_0xa252[_0x29bb17];return _0x32c8b2;};'use strict';var moment=require(_0x2a25('0x0'));var Sequelize=require('sequelize');module[_0x2a25('0x1')]={'uniqueid':{'type':Sequelize[_0x2a25('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x2a25('0x2')]},'joinAt':{'type':Sequelize[_0x2a25('0x3')]},'leaveAt':{'type':Sequelize[_0x2a25('0x3')]},'acceptAt':{'type':Sequelize[_0x2a25('0x3')]},'exitAt':{'type':Sequelize[_0x2a25('0x3')]},'reason':{'type':Sequelize[_0x2a25('0x2')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index 368acea..b7fa43f 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 _0xce4d=['error','name','send','index','map','OpenchannelQueueReport','rawAttributes','fieldName','type','query','keys','intersection','model','fields','attributes','hasOwnProperty','limit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','findAll','rows','catch','params','length','includeAll','find','create','body','describe','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','sendStatus','status','offset','undefined','count','set','json','apply','reject','save','update','then','destroy'];(function(_0x497b1e,_0x586379){var _0x3f72e1=function(_0x4c227d){while(--_0x4c227d){_0x497b1e['push'](_0x497b1e['shift']());}};_0x3f72e1(++_0x586379);}(_0xce4d,0xf9));var _0xdce4=function(_0x5ea398,_0x54479f){_0x5ea398=_0x5ea398-0x0;var _0x39e3e7=_0xce4d[_0x5ea398];return _0x39e3e7;};'use strict';var emlformat=require(_0xdce4('0x0'));var rimraf=require(_0xdce4('0x1'));var zipdir=require(_0xdce4('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xdce4('0x3'));var moment=require('moment');var BPromise=require(_0xdce4('0x4'));var Mustache=require(_0xdce4('0x5'));var util=require('util');var path=require(_0xdce4('0x6'));var sox=require(_0xdce4('0x7'));var csv=require('to-csv');var ejs=require(_0xdce4('0x8'));var fs=require('fs');var fs_extra=require(_0xdce4('0x9'));var _=require(_0xdce4('0xa'));var squel=require(_0xdce4('0xb'));var crypto=require(_0xdce4('0xc'));var jsforce=require(_0xdce4('0xd'));var deskjs=require(_0xdce4('0xe'));var toCsv=require(_0xdce4('0xf'));var querystring=require(_0xdce4('0x10'));var Papa=require(_0xdce4('0x11'));var Redis=require(_0xdce4('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xdce4('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xdce4('0x14'))('api');var utils=require('../../config/utils');var config=require(_0xdce4('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x272c8c,_0x41ae66){_0x41ae66=_0x41ae66||0xcc;return function(_0x422313){if(_0x422313){return _0x272c8c[_0xdce4('0x16')](_0x41ae66);}return _0x272c8c[_0xdce4('0x17')](_0x41ae66)['end']();};}function respondWithResult(_0x555275,_0x326c59){_0x326c59=_0x326c59||0xc8;return function(_0x4e2d5f){if(_0x4e2d5f){return _0x555275['status'](_0x326c59)['json'](_0x4e2d5f);}};}function respondWithFilteredResult(_0x4d5b2f,_0x5f49d7){return function(_0x12e924){if(_0x12e924){var _0xa3b7e5=typeof _0x5f49d7[_0xdce4('0x18')]===_0xdce4('0x19')&&typeof _0x5f49d7['limit']===_0xdce4('0x19');var _0x434992=_0x12e924[_0xdce4('0x1a')];var _0x4ce05e=_0xa3b7e5?0x0:_0x5f49d7[_0xdce4('0x18')];var _0x95e643=_0xa3b7e5?_0x12e924['count']:_0x5f49d7[_0xdce4('0x18')]+_0x5f49d7['limit'];var _0x5bfb1e;if(_0x95e643>=_0x434992){_0x95e643=_0x434992;_0x5bfb1e=0xc8;}else{_0x5bfb1e=0xce;}_0x4d5b2f[_0xdce4('0x17')](_0x5bfb1e);return _0x4d5b2f[_0xdce4('0x1b')]('Content-Range',_0x4ce05e+'-'+_0x95e643+'/'+_0x434992)[_0xdce4('0x1c')](_0x12e924);}return null;};}function patchUpdates(_0x1a3953){return function(_0x151e06){try{jsonpatch[_0xdce4('0x1d')](_0x151e06,_0x1a3953,!![]);}catch(_0x4d535e){return BPromise[_0xdce4('0x1e')](_0x4d535e);}return _0x151e06[_0xdce4('0x1f')]();};}function saveUpdates(_0x5da13e,_0x3c1107){return function(_0x2115a){if(_0x2115a){return _0x2115a[_0xdce4('0x20')](_0x5da13e)[_0xdce4('0x21')](function(_0x4e7bba){return _0x4e7bba;});}return null;};}function removeEntity(_0x395439,_0x6fe0e4){return function(_0x380abe){if(_0x380abe){return _0x380abe[_0xdce4('0x22')]()[_0xdce4('0x21')](function(){_0x395439[_0xdce4('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x33a7d1,_0x255091){return function(_0x6f6d47){if(!_0x6f6d47){_0x33a7d1['sendStatus'](0x194);}return _0x6f6d47;};}function handleError(_0x291166,_0x543866){_0x543866=_0x543866||0x1f4;return function(_0x589bb1){logger[_0xdce4('0x23')](_0x589bb1['stack']);if(_0x589bb1[_0xdce4('0x24')]){delete _0x589bb1['name'];}_0x291166[_0xdce4('0x17')](_0x543866)[_0xdce4('0x25')](_0x589bb1);};}exports[_0xdce4('0x26')]=function(_0xcff94b,_0xfa8c8){var _0x483beb={},_0x3bc29c={},_0x1001d5={'count':0x0,'rows':[]};var _0x1f37da=_[_0xdce4('0x27')](db[_0xdce4('0x28')][_0xdce4('0x29')],function(_0x11ec0e){return{'name':_0x11ec0e[_0xdce4('0x2a')],'type':_0x11ec0e[_0xdce4('0x2b')]['key']};});_0x3bc29c['model']=_[_0xdce4('0x27')](_0x1f37da,_0xdce4('0x24'));_0x3bc29c[_0xdce4('0x2c')]=_[_0xdce4('0x2d')](_0xcff94b[_0xdce4('0x2c')]);_0x3bc29c['filters']=_[_0xdce4('0x2e')](_0x3bc29c[_0xdce4('0x2f')],_0x3bc29c[_0xdce4('0x2c')]);_0x483beb['attributes']=_['intersection'](_0x3bc29c[_0xdce4('0x2f')],qs[_0xdce4('0x30')](_0xcff94b['query'][_0xdce4('0x30')]));_0x483beb[_0xdce4('0x31')]=_0x483beb['attributes']['length']?_0x483beb[_0xdce4('0x31')]:_0x3bc29c['model'];if(!_0xcff94b[_0xdce4('0x2c')][_0xdce4('0x32')]('nolimit')){_0x483beb['limit']=qs[_0xdce4('0x33')](_0xcff94b[_0xdce4('0x2c')][_0xdce4('0x33')]);_0x483beb[_0xdce4('0x18')]=qs['offset'](_0xcff94b[_0xdce4('0x2c')][_0xdce4('0x18')]);}_0x483beb[_0xdce4('0x34')]=qs[_0xdce4('0x35')](_0xcff94b['query'][_0xdce4('0x35')]);_0x483beb[_0xdce4('0x36')]=qs[_0xdce4('0x37')](_[_0xdce4('0x38')](_0xcff94b['query'],_0x3bc29c[_0xdce4('0x37')]),_0x1f37da);if(_0xcff94b[_0xdce4('0x2c')]['filter']){_0x483beb[_0xdce4('0x36')]=_[_0xdce4('0x39')](_0x483beb[_0xdce4('0x36')],{'$or':_[_0xdce4('0x27')](_0x1f37da,function(_0x1fb0af){if(_0x1fb0af['type']!==_0xdce4('0x3a')){var _0x16ab3e={};_0x16ab3e[_0x1fb0af[_0xdce4('0x24')]]={'$like':'%'+_0xcff94b[_0xdce4('0x2c')][_0xdce4('0x3b')]+'%'};return _0x16ab3e;}})});}_0x483beb=_[_0xdce4('0x39')]({},_0x483beb,_0xcff94b[_0xdce4('0x3c')]);var _0x5354dc={'where':_0x483beb[_0xdce4('0x36')]};return db[_0xdce4('0x28')]['count'](_0x5354dc)[_0xdce4('0x21')](function(_0x26f25e){_0x1001d5[_0xdce4('0x1a')]=_0x26f25e;if(_0xcff94b['query']['includeAll']){_0x483beb['include']=[{'all':!![]}];}return db['OpenchannelQueueReport'][_0xdce4('0x3d')](_0x483beb);})[_0xdce4('0x21')](function(_0x70aac7){_0x1001d5[_0xdce4('0x3e')]=_0x70aac7;return _0x1001d5;})[_0xdce4('0x21')](respondWithFilteredResult(_0xfa8c8,_0x483beb))[_0xdce4('0x3f')](handleError(_0xfa8c8,null));};exports['show']=function(_0xf54260,_0xe6d4ba){var _0x1fe606={'raw':!![],'where':{'id':_0xf54260[_0xdce4('0x40')]['id']}},_0x5dfb87={};_0x5dfb87[_0xdce4('0x2f')]=_[_0xdce4('0x2d')](db[_0xdce4('0x28')][_0xdce4('0x29')]);_0x5dfb87[_0xdce4('0x2c')]=_[_0xdce4('0x2d')](_0xf54260[_0xdce4('0x2c')]);_0x5dfb87[_0xdce4('0x37')]=_[_0xdce4('0x2e')](_0x5dfb87[_0xdce4('0x2f')],_0x5dfb87[_0xdce4('0x2c')]);_0x1fe606[_0xdce4('0x31')]=_[_0xdce4('0x2e')](_0x5dfb87['model'],qs['fields'](_0xf54260['query']['fields']));_0x1fe606[_0xdce4('0x31')]=_0x1fe606[_0xdce4('0x31')][_0xdce4('0x41')]?_0x1fe606[_0xdce4('0x31')]:_0x5dfb87['model'];if(_0xf54260[_0xdce4('0x2c')][_0xdce4('0x42')]){_0x1fe606['include']=[{'all':!![]}];}_0x1fe606=_[_0xdce4('0x39')]({},_0x1fe606,_0xf54260[_0xdce4('0x3c')]);return db[_0xdce4('0x28')][_0xdce4('0x43')](_0x1fe606)[_0xdce4('0x21')](handleEntityNotFound(_0xe6d4ba,null))[_0xdce4('0x21')](respondWithResult(_0xe6d4ba,null))['catch'](handleError(_0xe6d4ba,null));};exports[_0xdce4('0x44')]=function(_0x3b55b3,_0x581c4e){return db[_0xdce4('0x28')][_0xdce4('0x44')](_0x3b55b3[_0xdce4('0x45')],{})['then'](respondWithResult(_0x581c4e,0xc9))[_0xdce4('0x3f')](handleError(_0x581c4e,null));};exports[_0xdce4('0x20')]=function(_0x4c4f60,_0x5f8eac){if(_0x4c4f60[_0xdce4('0x45')]['id']){delete _0x4c4f60['body']['id'];}return db[_0xdce4('0x28')][_0xdce4('0x43')]({'where':{'id':_0x4c4f60[_0xdce4('0x40')]['id']}})[_0xdce4('0x21')](handleEntityNotFound(_0x5f8eac,null))[_0xdce4('0x21')](saveUpdates(_0x4c4f60[_0xdce4('0x45')],null))[_0xdce4('0x21')](respondWithResult(_0x5f8eac,null))[_0xdce4('0x3f')](handleError(_0x5f8eac,null));};exports[_0xdce4('0x22')]=function(_0x5bb576,_0x46a7e6){return db[_0xdce4('0x28')]['find']({'where':{'id':_0x5bb576['params']['id']}})[_0xdce4('0x21')](handleEntityNotFound(_0x46a7e6,null))[_0xdce4('0x21')](removeEntity(_0x46a7e6,null))['catch'](handleError(_0x46a7e6,null));};exports[_0xdce4('0x46')]=function(_0x385dca,_0x50f94a){return db['OpenchannelQueueReport'][_0xdce4('0x46')]()[_0xdce4('0x21')](respondWithResult(_0x50f94a,null))[_0xdce4('0x3f')](handleError(_0x50f94a,null));}; \ No newline at end of file +var _0xa025=['nolimit','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','rows','show','params','keys','options','find','catch','body','describe','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','save','update','then','destroy','error','stack','name','index','OpenchannelQueueReport','rawAttributes','model','map','query','filters','intersection','fields','attributes','length','hasOwnProperty'];(function(_0x922102,_0x49d141){var _0x4adaf7=function(_0x76dfcd){while(--_0x76dfcd){_0x922102['push'](_0x922102['shift']());}};_0x4adaf7(++_0x49d141);}(_0xa025,0xe5));var _0x5a02=function(_0x1af05b,_0x5134b5){_0x1af05b=_0x1af05b-0x0;var _0x5be7cc=_0xa025[_0x1af05b];return _0x5be7cc;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x5a02('0x0'));var rp=require(_0x5a02('0x1'));var moment=require(_0x5a02('0x2'));var BPromise=require(_0x5a02('0x3'));var Mustache=require(_0x5a02('0x4'));var util=require('util');var path=require(_0x5a02('0x5'));var sox=require(_0x5a02('0x6'));var csv=require(_0x5a02('0x7'));var ejs=require(_0x5a02('0x8'));var fs=require('fs');var fs_extra=require(_0x5a02('0x9'));var _=require(_0x5a02('0xa'));var squel=require('squel');var crypto=require(_0x5a02('0xb'));var jsforce=require(_0x5a02('0xc'));var deskjs=require(_0x5a02('0xd'));var toCsv=require('to-csv');var querystring=require(_0x5a02('0xe'));var Papa=require(_0x5a02('0xf'));var Redis=require(_0x5a02('0x10'));var authService=require(_0x5a02('0x11'));var qs=require(_0x5a02('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5a02('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x5a02('0x14'));var config=require(_0x5a02('0x15'));var licenseUtil=require(_0x5a02('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4e9295,_0x1ccc99){_0x1ccc99=_0x1ccc99||0xcc;return function(_0x368d40){if(_0x368d40){return _0x4e9295[_0x5a02('0x17')](_0x1ccc99);}return _0x4e9295[_0x5a02('0x18')](_0x1ccc99)[_0x5a02('0x19')]();};}function respondWithResult(_0x5f17a5,_0x4364c4){_0x4364c4=_0x4364c4||0xc8;return function(_0x2e0913){if(_0x2e0913){return _0x5f17a5[_0x5a02('0x18')](_0x4364c4)[_0x5a02('0x1a')](_0x2e0913);}};}function respondWithFilteredResult(_0x4f04e9,_0x453d43){return function(_0x4fae96){if(_0x4fae96){var _0x4c65bc=typeof _0x453d43[_0x5a02('0x1b')]===_0x5a02('0x1c')&&typeof _0x453d43[_0x5a02('0x1d')]==='undefined';var _0x5125a4=_0x4fae96[_0x5a02('0x1e')];var _0x58c680=_0x4c65bc?0x0:_0x453d43[_0x5a02('0x1b')];var _0x59f6b1=_0x4c65bc?_0x4fae96[_0x5a02('0x1e')]:_0x453d43[_0x5a02('0x1b')]+_0x453d43['limit'];var _0x5621bd;if(_0x59f6b1>=_0x5125a4){_0x59f6b1=_0x5125a4;_0x5621bd=0xc8;}else{_0x5621bd=0xce;}_0x4f04e9[_0x5a02('0x18')](_0x5621bd);return _0x4f04e9[_0x5a02('0x1f')]('Content-Range',_0x58c680+'-'+_0x59f6b1+'/'+_0x5125a4)['json'](_0x4fae96);}return null;};}function patchUpdates(_0x2bc162){return function(_0x4f8229){try{jsonpatch['apply'](_0x4f8229,_0x2bc162,!![]);}catch(_0x1be2ef){return BPromise['reject'](_0x1be2ef);}return _0x4f8229[_0x5a02('0x20')]();};}function saveUpdates(_0x55e985,_0x2d9ce7){return function(_0x12567b){if(_0x12567b){return _0x12567b[_0x5a02('0x21')](_0x55e985)[_0x5a02('0x22')](function(_0x318455){return _0x318455;});}return null;};}function removeEntity(_0x515482,_0x306b90){return function(_0x4f519a){if(_0x4f519a){return _0x4f519a[_0x5a02('0x23')]()[_0x5a02('0x22')](function(){_0x515482[_0x5a02('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0xd6209b,_0x509484){return function(_0x2c93ef){if(!_0x2c93ef){_0xd6209b[_0x5a02('0x17')](0x194);}return _0x2c93ef;};}function handleError(_0x1168c0,_0x257c17){_0x257c17=_0x257c17||0x1f4;return function(_0x4503c4){logger[_0x5a02('0x24')](_0x4503c4[_0x5a02('0x25')]);if(_0x4503c4[_0x5a02('0x26')]){delete _0x4503c4[_0x5a02('0x26')];}_0x1168c0[_0x5a02('0x18')](_0x257c17)['send'](_0x4503c4);};}exports[_0x5a02('0x27')]=function(_0x13d7bd,_0x49dd6b){var _0x2dd149={},_0x4a5ae3={},_0x4f0067={'count':0x0,'rows':[]};var _0x32efa4=_['map'](db[_0x5a02('0x28')][_0x5a02('0x29')],function(_0x796bee){return{'name':_0x796bee['fieldName'],'type':_0x796bee['type']['key']};});_0x4a5ae3[_0x5a02('0x2a')]=_[_0x5a02('0x2b')](_0x32efa4,_0x5a02('0x26'));_0x4a5ae3[_0x5a02('0x2c')]=_['keys'](_0x13d7bd[_0x5a02('0x2c')]);_0x4a5ae3[_0x5a02('0x2d')]=_[_0x5a02('0x2e')](_0x4a5ae3[_0x5a02('0x2a')],_0x4a5ae3[_0x5a02('0x2c')]);_0x2dd149['attributes']=_[_0x5a02('0x2e')](_0x4a5ae3[_0x5a02('0x2a')],qs[_0x5a02('0x2f')](_0x13d7bd['query'][_0x5a02('0x2f')]));_0x2dd149[_0x5a02('0x30')]=_0x2dd149['attributes'][_0x5a02('0x31')]?_0x2dd149['attributes']:_0x4a5ae3[_0x5a02('0x2a')];if(!_0x13d7bd[_0x5a02('0x2c')][_0x5a02('0x32')](_0x5a02('0x33'))){_0x2dd149['limit']=qs[_0x5a02('0x1d')](_0x13d7bd[_0x5a02('0x2c')]['limit']);_0x2dd149[_0x5a02('0x1b')]=qs[_0x5a02('0x1b')](_0x13d7bd['query'][_0x5a02('0x1b')]);}_0x2dd149['order']=qs[_0x5a02('0x34')](_0x13d7bd[_0x5a02('0x2c')][_0x5a02('0x34')]);_0x2dd149[_0x5a02('0x35')]=qs[_0x5a02('0x2d')](_[_0x5a02('0x36')](_0x13d7bd[_0x5a02('0x2c')],_0x4a5ae3['filters']),_0x32efa4);if(_0x13d7bd[_0x5a02('0x2c')][_0x5a02('0x37')]){_0x2dd149[_0x5a02('0x35')]=_[_0x5a02('0x38')](_0x2dd149[_0x5a02('0x35')],{'$or':_[_0x5a02('0x2b')](_0x32efa4,function(_0x1f6876){if(_0x1f6876[_0x5a02('0x39')]!==_0x5a02('0x3a')){var _0x221960={};_0x221960[_0x1f6876[_0x5a02('0x26')]]={'$like':'%'+_0x13d7bd['query'][_0x5a02('0x37')]+'%'};return _0x221960;}})});}_0x2dd149=_[_0x5a02('0x38')]({},_0x2dd149,_0x13d7bd['options']);var _0x1ef27b={'where':_0x2dd149[_0x5a02('0x35')]};return db[_0x5a02('0x28')][_0x5a02('0x1e')](_0x1ef27b)['then'](function(_0x47eefb){_0x4f0067[_0x5a02('0x1e')]=_0x47eefb;if(_0x13d7bd[_0x5a02('0x2c')][_0x5a02('0x3b')]){_0x2dd149[_0x5a02('0x3c')]=[{'all':!![]}];}return db['OpenchannelQueueReport']['findAll'](_0x2dd149);})[_0x5a02('0x22')](function(_0x27da3e){_0x4f0067[_0x5a02('0x3d')]=_0x27da3e;return _0x4f0067;})['then'](respondWithFilteredResult(_0x49dd6b,_0x2dd149))['catch'](handleError(_0x49dd6b,null));};exports[_0x5a02('0x3e')]=function(_0x1a1140,_0x398034){var _0x532845={'raw':!![],'where':{'id':_0x1a1140[_0x5a02('0x3f')]['id']}},_0xf62ef5={};_0xf62ef5[_0x5a02('0x2a')]=_[_0x5a02('0x40')](db[_0x5a02('0x28')][_0x5a02('0x29')]);_0xf62ef5['query']=_['keys'](_0x1a1140[_0x5a02('0x2c')]);_0xf62ef5[_0x5a02('0x2d')]=_[_0x5a02('0x2e')](_0xf62ef5[_0x5a02('0x2a')],_0xf62ef5[_0x5a02('0x2c')]);_0x532845['attributes']=_['intersection'](_0xf62ef5[_0x5a02('0x2a')],qs[_0x5a02('0x2f')](_0x1a1140[_0x5a02('0x2c')][_0x5a02('0x2f')]));_0x532845['attributes']=_0x532845[_0x5a02('0x30')]['length']?_0x532845[_0x5a02('0x30')]:_0xf62ef5[_0x5a02('0x2a')];if(_0x1a1140['query'][_0x5a02('0x3b')]){_0x532845[_0x5a02('0x3c')]=[{'all':!![]}];}_0x532845=_[_0x5a02('0x38')]({},_0x532845,_0x1a1140[_0x5a02('0x41')]);return db[_0x5a02('0x28')][_0x5a02('0x42')](_0x532845)[_0x5a02('0x22')](handleEntityNotFound(_0x398034,null))[_0x5a02('0x22')](respondWithResult(_0x398034,null))[_0x5a02('0x43')](handleError(_0x398034,null));};exports['create']=function(_0x75e9ae,_0x3a2ac9){return db[_0x5a02('0x28')]['create'](_0x75e9ae['body'],{})[_0x5a02('0x22')](respondWithResult(_0x3a2ac9,0xc9))[_0x5a02('0x43')](handleError(_0x3a2ac9,null));};exports[_0x5a02('0x21')]=function(_0x3ee074,_0x3d910f){if(_0x3ee074[_0x5a02('0x44')]['id']){delete _0x3ee074[_0x5a02('0x44')]['id'];}return db['OpenchannelQueueReport'][_0x5a02('0x42')]({'where':{'id':_0x3ee074[_0x5a02('0x3f')]['id']}})[_0x5a02('0x22')](handleEntityNotFound(_0x3d910f,null))[_0x5a02('0x22')](saveUpdates(_0x3ee074[_0x5a02('0x44')],null))[_0x5a02('0x22')](respondWithResult(_0x3d910f,null))[_0x5a02('0x43')](handleError(_0x3d910f,null));};exports[_0x5a02('0x23')]=function(_0x10f71b,_0xc43aa7){return db[_0x5a02('0x28')]['find']({'where':{'id':_0x10f71b['params']['id']}})[_0x5a02('0x22')](handleEntityNotFound(_0xc43aa7,null))[_0x5a02('0x22')](removeEntity(_0xc43aa7,null))['catch'](handleError(_0xc43aa7,null));};exports['describe']=function(_0x58f4d5,_0x1a9f4b){return db[_0x5a02('0x28')][_0x5a02('0x45')]()[_0x5a02('0x22')](respondWithResult(_0x1a9f4b,null))[_0x5a02('0x43')](handleError(_0x1a9f4b,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index ce6a9a2..d4e67c1 100644 --- a/server/api/openchannelQueueReport/openchannelQueueReport.model.js +++ b/server/api/openchannelQueueReport/openchannelQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2ef3=['define','OpenchannelQueueReport','report_openchannel_queue','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./openchannelQueueReport.attributes','exports'];(function(_0x33c232,_0xf9c32f){var _0x7e926a=function(_0x2786e2){while(--_0x2786e2){_0x33c232['push'](_0x33c232['shift']());}};_0x7e926a(++_0xf9c32f);}(_0x2ef3,0xba));var _0x32ef=function(_0x295ce6,_0x5f8029){_0x295ce6=_0x295ce6-0x0;var _0x3e21af=_0x2ef3[_0x295ce6];return _0x3e21af;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var logger=require(_0x32ef('0x2'))(_0x32ef('0x3'));var moment=require(_0x32ef('0x4'));var BPromise=require(_0x32ef('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x32ef('0x6'));var rimraf=require(_0x32ef('0x7'));var config=require('../../config/environment');var attributes=require(_0x32ef('0x8'));module[_0x32ef('0x9')]=function(_0x4c8104,_0x5dfa09){return _0x4c8104[_0x32ef('0xa')](_0x32ef('0xb'),attributes,{'tableName':_0x32ef('0xc'),'paranoid':![],'indexes':[{'name':_0x32ef('0xd'),'fields':[_0x32ef('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1261=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','define','report_openchannel_queue','uniqueid','util'];(function(_0x3679e6,_0x4c12f9){var _0x2b18b5=function(_0x3fc31a){while(--_0x3fc31a){_0x3679e6['push'](_0x3679e6['shift']());}};_0x2b18b5(++_0x4c12f9);}(_0x1261,0x144));var _0x1126=function(_0x2f1ac4,_0x236a72){_0x2f1ac4=_0x2f1ac4-0x0;var _0x18e1a5=_0x1261[_0x2f1ac4];return _0x18e1a5;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var logger=require(_0x1126('0x1'))(_0x1126('0x2'));var moment=require(_0x1126('0x3'));var BPromise=require(_0x1126('0x4'));var rp=require(_0x1126('0x5'));var fs=require('fs');var path=require(_0x1126('0x6'));var rimraf=require(_0x1126('0x7'));var config=require(_0x1126('0x8'));var attributes=require(_0x1126('0x9'));module['exports']=function(_0x5c68c8,_0x40ba58){return _0x5c68c8[_0x1126('0xa')]('OpenchannelQueueReport',attributes,{'tableName':_0x1126('0xb'),'paranoid':![],'indexes':[{'name':_0x1126('0xc'),'fields':[_0x1126('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index 8957231..0339c0e 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 _0xd5fc=['rpc','jayson/promise','http','then','OpenchannelQueueReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','info','result','catch','create','body','options','CreateOpenchannelQueueReport','OpenchannelQueueReport','update','raw','where','attributes','limit','UpdateOpenchannelQueueReport','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0xd5fc,0xae));var _0xcd5f=function(_0x1e96b0,_0x5a7778){_0x1e96b0=_0x1e96b0-0x0;var _0x4b161b=_0xd5fc[_0x1e96b0];return _0x4b161b;};'use strict';var _=require(_0xcd5f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xcd5f('0x1'));var fs=require('fs');var Redis=require(_0xcd5f('0x2'));var db=require(_0xcd5f('0x3'))['db'];var utils=require(_0xcd5f('0x4'));var logger=require(_0xcd5f('0x5'))(_0xcd5f('0x6'));var config=require('../../config/environment');var jayson=require(_0xcd5f('0x7'));var client=jayson['client'][_0xcd5f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x159b3f,_0x5af696,_0x58d65d){return new BPromise(function(_0x4e668e,_0x102ce9){return client['request'](_0x159b3f,_0x58d65d)[_0xcd5f('0x9')](function(_0x3e63d4){logger['info'](_0xcd5f('0xa'),_0x5af696,'request\x20sent');logger[_0xcd5f('0xb')]('OpenchannelQueueReport,\x20%s,\x20%s,\x20%s',_0x5af696,_0xcd5f('0xc'),JSON[_0xcd5f('0xd')](_0x3e63d4));if(_0x3e63d4[_0xcd5f('0xe')]){if(_0x3e63d4[_0xcd5f('0xe')]['code']===0x1f4){logger[_0xcd5f('0xe')](_0xcd5f('0xa'),_0x5af696,_0x3e63d4['error'][_0xcd5f('0xf')]);return _0x102ce9(_0x3e63d4[_0xcd5f('0xe')][_0xcd5f('0xf')]);}logger[_0xcd5f('0xe')](_0xcd5f('0xa'),_0x5af696,_0x3e63d4['error'][_0xcd5f('0xf')]);return _0x4e668e(_0x3e63d4[_0xcd5f('0xe')][_0xcd5f('0xf')]);}else{logger[_0xcd5f('0x10')](_0xcd5f('0xa'),_0x5af696,_0xcd5f('0xc'));_0x4e668e(_0x3e63d4[_0xcd5f('0x11')]['message']);}})[_0xcd5f('0x12')](function(_0x33ab1a){logger[_0xcd5f('0xe')](_0xcd5f('0xa'),_0x5af696,_0x33ab1a);_0x102ce9(_0x33ab1a);});});}exports['CreateOpenchannelQueueReport']=function(_0x1a4cb6){var _0x56a874=this;return new Promise(function(_0xb23761,_0x36c60c){return db['OpenchannelQueueReport'][_0xcd5f('0x13')](_0x1a4cb6[_0xcd5f('0x14')],{'raw':_0x1a4cb6['options']?_0x1a4cb6[_0xcd5f('0x15')]['raw']===undefined?!![]:![]:!![]})[_0xcd5f('0x9')](function(_0x5c3c9f){logger['info'](_0xcd5f('0x16'),_0x1a4cb6);logger['debug']('CreateOpenchannelQueueReport',_0x1a4cb6,JSON['stringify'](_0x5c3c9f));_0xb23761(_0x5c3c9f);})[_0xcd5f('0x12')](function(_0x5c03b9){logger[_0xcd5f('0xe')](_0xcd5f('0x16'),_0x5c03b9[_0xcd5f('0xf')],_0x1a4cb6);_0x36c60c(_0x56a874[_0xcd5f('0xe')](0x1f4,_0x5c03b9[_0xcd5f('0xf')]));});});};exports['UpdateOpenchannelQueueReport']=function(_0x388290){var _0x41015c=this;return new Promise(function(_0x4dc7ab,_0xba8e2e){return db[_0xcd5f('0x17')][_0xcd5f('0x18')](_0x388290[_0xcd5f('0x14')],{'raw':_0x388290[_0xcd5f('0x15')]?_0x388290[_0xcd5f('0x15')][_0xcd5f('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x388290[_0xcd5f('0x15')]?_0x388290[_0xcd5f('0x15')][_0xcd5f('0x1a')]||null:null,'attributes':_0x388290[_0xcd5f('0x15')]?_0x388290[_0xcd5f('0x15')][_0xcd5f('0x1b')]||null:null,'limit':_0x388290[_0xcd5f('0x15')]?_0x388290['options'][_0xcd5f('0x1c')]||null:null})[_0xcd5f('0x9')](function(_0x561414){logger[_0xcd5f('0x10')]('UpdateOpenchannelQueueReport',_0x388290);logger[_0xcd5f('0xb')](_0xcd5f('0x1d'),_0x388290,JSON[_0xcd5f('0xd')](_0x561414));_0x4dc7ab(_0x561414);})[_0xcd5f('0x12')](function(_0xb56143){logger[_0xcd5f('0xe')]('UpdateOpenchannelQueueReport',_0xb56143['message'],_0x388290);_0xba8e2e(_0x41015c[_0xcd5f('0xe')](0x1f4,_0xb56143[_0xcd5f('0xf')]));});});}; \ No newline at end of file +var _0x02a7=['raw','UpdateOpenchannelQueueReport','OpenchannelQueueReport','where','attributes','then','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','info','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelQueueReport,\x20%s,\x20%s','message','result','catch','CreateOpenchannelQueueReport','create','body','options'];(function(_0x3cf053,_0x7a9947){var _0x3b55a0=function(_0x2a99cc){while(--_0x2a99cc){_0x3cf053['push'](_0x3cf053['shift']());}};_0x3b55a0(++_0x7a9947);}(_0x02a7,0x1a6));var _0x702a=function(_0x5ca67c,_0x31642e){_0x5ca67c=_0x5ca67c-0x0;var _0xfe684a=_0x02a7[_0x5ca67c];return _0xfe684a;};'use strict';var _=require('lodash');var util=require(_0x702a('0x0'));var moment=require(_0x702a('0x1'));var BPromise=require(_0x702a('0x2'));var rs=require(_0x702a('0x3'));var fs=require('fs');var Redis=require(_0x702a('0x4'));var db=require(_0x702a('0x5'))['db'];var utils=require(_0x702a('0x6'));var logger=require(_0x702a('0x7'))(_0x702a('0x8'));var config=require(_0x702a('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x702a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4b6736,_0x27bfc7,_0x3f5ff8){return new BPromise(function(_0x51bf52,_0x562fdb){return client['request'](_0x4b6736,_0x3f5ff8)['then'](function(_0x3cb569){logger[_0x702a('0xb')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x27bfc7,_0x702a('0xc'));logger[_0x702a('0xd')](_0x702a('0xe'),_0x27bfc7,_0x702a('0xc'),JSON[_0x702a('0xf')](_0x3cb569));if(_0x3cb569[_0x702a('0x10')]){if(_0x3cb569[_0x702a('0x10')][_0x702a('0x11')]===0x1f4){logger['error'](_0x702a('0x12'),_0x27bfc7,_0x3cb569[_0x702a('0x10')][_0x702a('0x13')]);return _0x562fdb(_0x3cb569[_0x702a('0x10')]['message']);}logger[_0x702a('0x10')](_0x702a('0x12'),_0x27bfc7,_0x3cb569[_0x702a('0x10')][_0x702a('0x13')]);return _0x51bf52(_0x3cb569[_0x702a('0x10')]['message']);}else{logger[_0x702a('0xb')](_0x702a('0x12'),_0x27bfc7,_0x702a('0xc'));_0x51bf52(_0x3cb569[_0x702a('0x14')][_0x702a('0x13')]);}})[_0x702a('0x15')](function(_0x451881){logger['error']('OpenchannelQueueReport,\x20%s,\x20%s',_0x27bfc7,_0x451881);_0x562fdb(_0x451881);});});}exports[_0x702a('0x16')]=function(_0x340dc2){var _0x2071ad=this;return new Promise(function(_0x3d1550,_0x1885eb){return db['OpenchannelQueueReport'][_0x702a('0x17')](_0x340dc2[_0x702a('0x18')],{'raw':_0x340dc2[_0x702a('0x19')]?_0x340dc2[_0x702a('0x19')][_0x702a('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x5b2998){logger['info'](_0x702a('0x16'),_0x340dc2);logger['debug'](_0x702a('0x16'),_0x340dc2,JSON[_0x702a('0xf')](_0x5b2998));_0x3d1550(_0x5b2998);})['catch'](function(_0x2ca064){logger[_0x702a('0x10')](_0x702a('0x16'),_0x2ca064[_0x702a('0x13')],_0x340dc2);_0x1885eb(_0x2071ad[_0x702a('0x10')](0x1f4,_0x2ca064['message']));});});};exports[_0x702a('0x1b')]=function(_0x544be5){var _0x5e6cce=this;return new Promise(function(_0x57d897,_0xa2be1d){return db[_0x702a('0x1c')]['update'](_0x544be5[_0x702a('0x18')],{'raw':_0x544be5[_0x702a('0x19')]?_0x544be5[_0x702a('0x19')][_0x702a('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x544be5[_0x702a('0x19')]?_0x544be5[_0x702a('0x19')][_0x702a('0x1d')]||null:null,'attributes':_0x544be5[_0x702a('0x19')]?_0x544be5[_0x702a('0x19')][_0x702a('0x1e')]||null:null,'limit':_0x544be5['options']?_0x544be5[_0x702a('0x19')]['limit']||null:null})[_0x702a('0x1f')](function(_0x51867d){logger[_0x702a('0xb')](_0x702a('0x1b'),_0x544be5);logger[_0x702a('0xd')]('UpdateOpenchannelQueueReport',_0x544be5,JSON[_0x702a('0xf')](_0x51867d));_0x57d897(_0x51867d);})[_0x702a('0x15')](function(_0x26e1d1){logger['error'](_0x702a('0x1b'),_0x26e1d1['message'],_0x544be5);_0xa2be1d(_0x5e6cce[_0x702a('0x10')](0x1f4,_0x26e1d1[_0x702a('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index 29a9b36..a43ee8b 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 _0x3220=['show','post','create','delete','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','isAuthenticated','index','get','/describe','describe','/:id'];(function(_0x5c6a78,_0x5c0503){var _0x236c5e=function(_0x44ef45){while(--_0x44ef45){_0x5c6a78['push'](_0x5c6a78['shift']());}};_0x236c5e(++_0x5c0503);}(_0x3220,0x1ae));var _0x0322=function(_0x21e4ef,_0x1220a9){_0x21e4ef=_0x21e4ef-0x0;var _0xe5a03f=_0x3220[_0x21e4ef];return _0xe5a03f;};'use strict';var multer=require(_0x0322('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x0322('0x1'));var express=require(_0x0322('0x2'));var router=express[_0x0322('0x3')]();var fs_extra=require(_0x0322('0x4'));var auth=require(_0x0322('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./openchannelTransferReport.controller');router['get']('/',auth[_0x0322('0x6')](),controller[_0x0322('0x7')]);router[_0x0322('0x8')](_0x0322('0x9'),auth[_0x0322('0x6')](),controller[_0x0322('0xa')]);router[_0x0322('0x8')](_0x0322('0xb'),auth['isAuthenticated'](),controller[_0x0322('0xc')]);router[_0x0322('0xd')]('/',auth[_0x0322('0x6')](),controller[_0x0322('0xe')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0x0322('0xf')](_0x0322('0xb'),auth[_0x0322('0x6')](),controller['destroy']);module[_0x0322('0x10')]=router; \ No newline at end of file +var _0x7bf3=['index','/describe','isAuthenticated','describe','/:id','show','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller','get'];(function(_0x2685cf,_0x30e87f){var _0x2012a8=function(_0x37eaa0){while(--_0x37eaa0){_0x2685cf['push'](_0x2685cf['shift']());}};_0x2012a8(++_0x30e87f);}(_0x7bf3,0x1aa));var _0x37bf=function(_0x36914a,_0x5b4c44){_0x36914a=_0x36914a-0x0;var _0x3f5a6c=_0x7bf3[_0x36914a];return _0x3f5a6c;};'use strict';var multer=require(_0x37bf('0x0'));var util=require(_0x37bf('0x1'));var path=require(_0x37bf('0x2'));var timeout=require(_0x37bf('0x3'));var express=require('express');var router=express[_0x37bf('0x4')]();var fs_extra=require(_0x37bf('0x5'));var auth=require(_0x37bf('0x6'));var interaction=require(_0x37bf('0x7'));var config=require(_0x37bf('0x8'));var controller=require(_0x37bf('0x9'));router[_0x37bf('0xa')]('/',auth['isAuthenticated'](),controller[_0x37bf('0xb')]);router[_0x37bf('0xa')](_0x37bf('0xc'),auth[_0x37bf('0xd')](),controller[_0x37bf('0xe')]);router[_0x37bf('0xa')](_0x37bf('0xf'),auth[_0x37bf('0xd')](),controller[_0x37bf('0x10')]);router['post']('/',auth[_0x37bf('0xd')](),controller[_0x37bf('0x11')]);router[_0x37bf('0x12')](_0x37bf('0xf'),auth[_0x37bf('0xd')](),controller[_0x37bf('0x13')]);router[_0x37bf('0x14')](_0x37bf('0xf'),auth[_0x37bf('0xd')](),controller[_0x37bf('0x15')]);module[_0x37bf('0x16')]=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index 920667b..db466b3 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(_0x15a0fe,_0x1ff601){var _0x830aa6=function(_0x65c68c){while(--_0x65c68c){_0x15a0fe['push'](_0x15a0fe['shift']());}};_0x830aa6(++_0x1ff601);}(_0xa9e0,0x123));var _0x0a9e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa9e0[_0x14add3];return _0x4a174f;};'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 _0x9c44=['ENUM','account','agent','queue','NOW','exports','STRING'];(function(_0x53767b,_0x3aa30b){var _0x29f67b=function(_0xd1d3e8){while(--_0xd1d3e8){_0x53767b['push'](_0x53767b['shift']());}};_0x29f67b(++_0x3aa30b);}(_0x9c44,0x178));var _0x49c4=function(_0x2b7764,_0x2606f1){_0x2b7764=_0x2b7764-0x0;var _0x848dcb=_0x9c44[_0x2b7764];return _0x848dcb;};'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/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index 9012ef6..9bb5d55 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 _0x79aa=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','apply','reject','save','then','error','name','send','index','map','rawAttributes','type','key','model','query','keys','filters','attributes','fields','nolimit','order','sort','where','pick','merge','VIRTUAL','options','OpenchannelTransferReport','includeAll','include','findAll','rows','show','params','intersection','length','find','catch','create','update','body','destroy','describe','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0xfc53fc,_0x4204d6){var _0x423828=function(_0x44e877){while(--_0x44e877){_0xfc53fc['push'](_0xfc53fc['shift']());}};_0x423828(++_0x4204d6);}(_0x79aa,0x121));var _0xa79a=function(_0x22e173,_0x5af528){_0x22e173=_0x22e173-0x0;var _0x3a3912=_0x79aa[_0x22e173];return _0x3a3912;};'use strict';var emlformat=require(_0xa79a('0x0'));var rimraf=require(_0xa79a('0x1'));var zipdir=require(_0xa79a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa79a('0x3'));var moment=require('moment');var BPromise=require(_0xa79a('0x4'));var Mustache=require(_0xa79a('0x5'));var util=require('util');var path=require(_0xa79a('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xa79a('0x7'));var fs=require('fs');var fs_extra=require(_0xa79a('0x8'));var _=require(_0xa79a('0x9'));var squel=require(_0xa79a('0xa'));var crypto=require(_0xa79a('0xb'));var jsforce=require(_0xa79a('0xc'));var deskjs=require(_0xa79a('0xd'));var toCsv=require(_0xa79a('0xe'));var querystring=require(_0xa79a('0xf'));var Papa=require(_0xa79a('0x10'));var Redis=require(_0xa79a('0x11'));var authService=require(_0xa79a('0x12'));var qs=require(_0xa79a('0x13'));var as=require(_0xa79a('0x14'));var hardwareService=require(_0xa79a('0x15'));var logger=require(_0xa79a('0x16'))(_0xa79a('0x17'));var utils=require('../../config/utils');var config=require(_0xa79a('0x18'));var licenseUtil=require(_0xa79a('0x19'));var db=require(_0xa79a('0x1a'))['db'];function respondWithStatusCode(_0x45ab68,_0x8824af){_0x8824af=_0x8824af||0xcc;return function(_0x340922){if(_0x340922){return _0x45ab68[_0xa79a('0x1b')](_0x8824af);}return _0x45ab68[_0xa79a('0x1c')](_0x8824af)[_0xa79a('0x1d')]();};}function respondWithResult(_0x354a52,_0x276b84){_0x276b84=_0x276b84||0xc8;return function(_0x481373){if(_0x481373){return _0x354a52[_0xa79a('0x1c')](_0x276b84)['json'](_0x481373);}};}function respondWithFilteredResult(_0x54c9ef,_0x47b2e7){return function(_0x2ce807){if(_0x2ce807){var _0x358e89=typeof _0x47b2e7[_0xa79a('0x1e')]===_0xa79a('0x1f')&&typeof _0x47b2e7[_0xa79a('0x20')]==='undefined';var _0x1b72b9=_0x2ce807[_0xa79a('0x21')];var _0x220149=_0x358e89?0x0:_0x47b2e7[_0xa79a('0x1e')];var _0x4e412b=_0x358e89?_0x2ce807[_0xa79a('0x21')]:_0x47b2e7[_0xa79a('0x1e')]+_0x47b2e7[_0xa79a('0x20')];var _0x3e3614;if(_0x4e412b>=_0x1b72b9){_0x4e412b=_0x1b72b9;_0x3e3614=0xc8;}else{_0x3e3614=0xce;}_0x54c9ef['status'](_0x3e3614);return _0x54c9ef['set'](_0xa79a('0x22'),_0x220149+'-'+_0x4e412b+'/'+_0x1b72b9)['json'](_0x2ce807);}return null;};}function patchUpdates(_0x25c2c6){return function(_0x273678){try{jsonpatch[_0xa79a('0x23')](_0x273678,_0x25c2c6,!![]);}catch(_0x2dba5f){return BPromise[_0xa79a('0x24')](_0x2dba5f);}return _0x273678[_0xa79a('0x25')]();};}function saveUpdates(_0x233634,_0x386ab9){return function(_0x40b1d9){if(_0x40b1d9){return _0x40b1d9['update'](_0x233634)[_0xa79a('0x26')](function(_0x4cc3dc){return _0x4cc3dc;});}return null;};}function removeEntity(_0x1999f4,_0x47b3df){return function(_0x4aebda){if(_0x4aebda){return _0x4aebda['destroy']()['then'](function(){_0x1999f4[_0xa79a('0x1c')](0xcc)[_0xa79a('0x1d')]();});}};}function handleEntityNotFound(_0x430118,_0x1fa8d9){return function(_0x52b955){if(!_0x52b955){_0x430118[_0xa79a('0x1b')](0x194);}return _0x52b955;};}function handleError(_0x262207,_0x5d0b6f){_0x5d0b6f=_0x5d0b6f||0x1f4;return function(_0x2107db){logger[_0xa79a('0x27')](_0x2107db['stack']);if(_0x2107db[_0xa79a('0x28')]){delete _0x2107db[_0xa79a('0x28')];}_0x262207['status'](_0x5d0b6f)[_0xa79a('0x29')](_0x2107db);};}exports[_0xa79a('0x2a')]=function(_0x327259,_0x4c87d6){var _0x53bbdf={},_0x40990c={},_0x159b1f={'count':0x0,'rows':[]};var _0x4645ac=_[_0xa79a('0x2b')](db['OpenchannelTransferReport'][_0xa79a('0x2c')],function(_0x35028f){return{'name':_0x35028f['fieldName'],'type':_0x35028f[_0xa79a('0x2d')][_0xa79a('0x2e')]};});_0x40990c[_0xa79a('0x2f')]=_[_0xa79a('0x2b')](_0x4645ac,_0xa79a('0x28'));_0x40990c[_0xa79a('0x30')]=_[_0xa79a('0x31')](_0x327259[_0xa79a('0x30')]);_0x40990c[_0xa79a('0x32')]=_['intersection'](_0x40990c[_0xa79a('0x2f')],_0x40990c[_0xa79a('0x30')]);_0x53bbdf[_0xa79a('0x33')]=_['intersection'](_0x40990c[_0xa79a('0x2f')],qs[_0xa79a('0x34')](_0x327259[_0xa79a('0x30')][_0xa79a('0x34')]));_0x53bbdf[_0xa79a('0x33')]=_0x53bbdf['attributes']['length']?_0x53bbdf[_0xa79a('0x33')]:_0x40990c[_0xa79a('0x2f')];if(!_0x327259['query']['hasOwnProperty'](_0xa79a('0x35'))){_0x53bbdf[_0xa79a('0x20')]=qs[_0xa79a('0x20')](_0x327259[_0xa79a('0x30')][_0xa79a('0x20')]);_0x53bbdf[_0xa79a('0x1e')]=qs[_0xa79a('0x1e')](_0x327259[_0xa79a('0x30')][_0xa79a('0x1e')]);}_0x53bbdf[_0xa79a('0x36')]=qs[_0xa79a('0x37')](_0x327259[_0xa79a('0x30')][_0xa79a('0x37')]);_0x53bbdf[_0xa79a('0x38')]=qs[_0xa79a('0x32')](_[_0xa79a('0x39')](_0x327259[_0xa79a('0x30')],_0x40990c[_0xa79a('0x32')]),_0x4645ac);if(_0x327259[_0xa79a('0x30')]['filter']){_0x53bbdf[_0xa79a('0x38')]=_[_0xa79a('0x3a')](_0x53bbdf['where'],{'$or':_[_0xa79a('0x2b')](_0x4645ac,function(_0x140ca2){if(_0x140ca2['type']!==_0xa79a('0x3b')){var _0x13da6d={};_0x13da6d[_0x140ca2[_0xa79a('0x28')]]={'$like':'%'+_0x327259[_0xa79a('0x30')]['filter']+'%'};return _0x13da6d;}})});}_0x53bbdf=_[_0xa79a('0x3a')]({},_0x53bbdf,_0x327259[_0xa79a('0x3c')]);var _0xbe1218={'where':_0x53bbdf[_0xa79a('0x38')]};return db[_0xa79a('0x3d')][_0xa79a('0x21')](_0xbe1218)[_0xa79a('0x26')](function(_0xdf29fb){_0x159b1f[_0xa79a('0x21')]=_0xdf29fb;if(_0x327259[_0xa79a('0x30')][_0xa79a('0x3e')]){_0x53bbdf[_0xa79a('0x3f')]=[{'all':!![]}];}return db[_0xa79a('0x3d')][_0xa79a('0x40')](_0x53bbdf);})[_0xa79a('0x26')](function(_0x429931){_0x159b1f[_0xa79a('0x41')]=_0x429931;return _0x159b1f;})['then'](respondWithFilteredResult(_0x4c87d6,_0x53bbdf))['catch'](handleError(_0x4c87d6,null));};exports[_0xa79a('0x42')]=function(_0x1db8eb,_0x40a65b){var _0x18c060={'raw':!![],'where':{'id':_0x1db8eb[_0xa79a('0x43')]['id']}},_0x3434b2={};_0x3434b2[_0xa79a('0x2f')]=_['keys'](db[_0xa79a('0x3d')][_0xa79a('0x2c')]);_0x3434b2[_0xa79a('0x30')]=_[_0xa79a('0x31')](_0x1db8eb[_0xa79a('0x30')]);_0x3434b2[_0xa79a('0x32')]=_[_0xa79a('0x44')](_0x3434b2['model'],_0x3434b2[_0xa79a('0x30')]);_0x18c060['attributes']=_[_0xa79a('0x44')](_0x3434b2[_0xa79a('0x2f')],qs[_0xa79a('0x34')](_0x1db8eb[_0xa79a('0x30')][_0xa79a('0x34')]));_0x18c060[_0xa79a('0x33')]=_0x18c060[_0xa79a('0x33')][_0xa79a('0x45')]?_0x18c060[_0xa79a('0x33')]:_0x3434b2[_0xa79a('0x2f')];if(_0x1db8eb['query'][_0xa79a('0x3e')]){_0x18c060['include']=[{'all':!![]}];}_0x18c060=_[_0xa79a('0x3a')]({},_0x18c060,_0x1db8eb['options']);return db[_0xa79a('0x3d')][_0xa79a('0x46')](_0x18c060)[_0xa79a('0x26')](handleEntityNotFound(_0x40a65b,null))[_0xa79a('0x26')](respondWithResult(_0x40a65b,null))[_0xa79a('0x47')](handleError(_0x40a65b,null));};exports[_0xa79a('0x48')]=function(_0x176e14,_0x1b0543){return db['OpenchannelTransferReport']['create'](_0x176e14['body'],{})[_0xa79a('0x26')](respondWithResult(_0x1b0543,0xc9))['catch'](handleError(_0x1b0543,null));};exports[_0xa79a('0x49')]=function(_0x5d22f2,_0x5d761f){if(_0x5d22f2[_0xa79a('0x4a')]['id']){delete _0x5d22f2['body']['id'];}return db[_0xa79a('0x3d')][_0xa79a('0x46')]({'where':{'id':_0x5d22f2[_0xa79a('0x43')]['id']}})[_0xa79a('0x26')](handleEntityNotFound(_0x5d761f,null))[_0xa79a('0x26')](saveUpdates(_0x5d22f2[_0xa79a('0x4a')],null))[_0xa79a('0x26')](respondWithResult(_0x5d761f,null))[_0xa79a('0x47')](handleError(_0x5d761f,null));};exports[_0xa79a('0x4b')]=function(_0x3157b9,_0x182e46){return db[_0xa79a('0x3d')]['find']({'where':{'id':_0x3157b9['params']['id']}})[_0xa79a('0x26')](handleEntityNotFound(_0x182e46,null))[_0xa79a('0x26')](removeEntity(_0x182e46,null))[_0xa79a('0x47')](handleError(_0x182e46,null));};exports[_0xa79a('0x4c')]=function(_0x33782e,_0x1eac00){return db[_0xa79a('0x3d')][_0xa79a('0x4c')]()[_0xa79a('0x26')](respondWithResult(_0x1eac00,null))[_0xa79a('0x47')](handleError(_0x1eac00,null));}; \ No newline at end of file +var _0x4a05=['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','limit','Content-Range','apply','reject','save','update','then','destroy','map','OpenchannelTransferReport','rawAttributes','type','model','name','query','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','count','include','rows','catch','show','params','keys','includeAll','find','create','body','describe','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra'];(function(_0x3d4137,_0x47e032){var _0x313cc1=function(_0x35b414){while(--_0x35b414){_0x3d4137['push'](_0x3d4137['shift']());}};_0x313cc1(++_0x47e032);}(_0x4a05,0x112));var _0x54a0=function(_0x3020ea,_0x2c71f6){_0x3020ea=_0x3020ea-0x0;var _0x2a8cc0=_0x4a05[_0x3020ea];return _0x2a8cc0;};'use strict';var emlformat=require(_0x54a0('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x54a0('0x1'));var rp=require(_0x54a0('0x2'));var moment=require(_0x54a0('0x3'));var BPromise=require(_0x54a0('0x4'));var Mustache=require(_0x54a0('0x5'));var util=require('util');var path=require(_0x54a0('0x6'));var sox=require(_0x54a0('0x7'));var csv=require(_0x54a0('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x54a0('0x9'));var _=require('lodash');var squel=require(_0x54a0('0xa'));var crypto=require(_0x54a0('0xb'));var jsforce=require(_0x54a0('0xc'));var deskjs=require(_0x54a0('0xd'));var toCsv=require('to-csv');var querystring=require(_0x54a0('0xe'));var Papa=require(_0x54a0('0xf'));var Redis=require(_0x54a0('0x10'));var authService=require(_0x54a0('0x11'));var qs=require(_0x54a0('0x12'));var as=require(_0x54a0('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x54a0('0x14'))('api');var utils=require(_0x54a0('0x15'));var config=require(_0x54a0('0x16'));var licenseUtil=require(_0x54a0('0x17'));var db=require(_0x54a0('0x18'))['db'];function respondWithStatusCode(_0x4af15b,_0x487cea){_0x487cea=_0x487cea||0xcc;return function(_0x5e3f88){if(_0x5e3f88){return _0x4af15b[_0x54a0('0x19')](_0x487cea);}return _0x4af15b[_0x54a0('0x1a')](_0x487cea)[_0x54a0('0x1b')]();};}function respondWithResult(_0x2aeb5a,_0x140bda){_0x140bda=_0x140bda||0xc8;return function(_0x3a9cc8){if(_0x3a9cc8){return _0x2aeb5a[_0x54a0('0x1a')](_0x140bda)[_0x54a0('0x1c')](_0x3a9cc8);}};}function respondWithFilteredResult(_0x549166,_0x17dff0){return function(_0x1e89a2){if(_0x1e89a2){var _0x441f96=typeof _0x17dff0[_0x54a0('0x1d')]==='undefined'&&typeof _0x17dff0[_0x54a0('0x1e')]==='undefined';var _0x4a1200=_0x1e89a2['count'];var _0x405b2e=_0x441f96?0x0:_0x17dff0[_0x54a0('0x1d')];var _0x2834f7=_0x441f96?_0x1e89a2['count']:_0x17dff0[_0x54a0('0x1d')]+_0x17dff0['limit'];var _0x1cc950;if(_0x2834f7>=_0x4a1200){_0x2834f7=_0x4a1200;_0x1cc950=0xc8;}else{_0x1cc950=0xce;}_0x549166[_0x54a0('0x1a')](_0x1cc950);return _0x549166['set'](_0x54a0('0x1f'),_0x405b2e+'-'+_0x2834f7+'/'+_0x4a1200)['json'](_0x1e89a2);}return null;};}function patchUpdates(_0x28ed20){return function(_0x3d6731){try{jsonpatch[_0x54a0('0x20')](_0x3d6731,_0x28ed20,!![]);}catch(_0x29c02b){return BPromise[_0x54a0('0x21')](_0x29c02b);}return _0x3d6731[_0x54a0('0x22')]();};}function saveUpdates(_0x353ff0,_0x16a486){return function(_0x2c2eb2){if(_0x2c2eb2){return _0x2c2eb2[_0x54a0('0x23')](_0x353ff0)[_0x54a0('0x24')](function(_0x44c81){return _0x44c81;});}return null;};}function removeEntity(_0x212036,_0x163b7c){return function(_0x3eb514){if(_0x3eb514){return _0x3eb514[_0x54a0('0x25')]()[_0x54a0('0x24')](function(){_0x212036[_0x54a0('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x50db81,_0x113975){return function(_0x1ba25f){if(!_0x1ba25f){_0x50db81[_0x54a0('0x19')](0x194);}return _0x1ba25f;};}function handleError(_0x4f0ad3,_0x32c769){_0x32c769=_0x32c769||0x1f4;return function(_0x2c1737){logger['error'](_0x2c1737['stack']);if(_0x2c1737['name']){delete _0x2c1737['name'];}_0x4f0ad3[_0x54a0('0x1a')](_0x32c769)['send'](_0x2c1737);};}exports['index']=function(_0x2709c4,_0x3a98a7){var _0x422281={},_0x640020={},_0x205fa3={'count':0x0,'rows':[]};var _0xdc6ef3=_[_0x54a0('0x26')](db[_0x54a0('0x27')][_0x54a0('0x28')],function(_0x5b67f0){return{'name':_0x5b67f0['fieldName'],'type':_0x5b67f0[_0x54a0('0x29')]['key']};});_0x640020[_0x54a0('0x2a')]=_[_0x54a0('0x26')](_0xdc6ef3,_0x54a0('0x2b'));_0x640020[_0x54a0('0x2c')]=_['keys'](_0x2709c4[_0x54a0('0x2c')]);_0x640020['filters']=_['intersection'](_0x640020[_0x54a0('0x2a')],_0x640020[_0x54a0('0x2c')]);_0x422281[_0x54a0('0x2d')]=_[_0x54a0('0x2e')](_0x640020['model'],qs['fields'](_0x2709c4[_0x54a0('0x2c')][_0x54a0('0x2f')]));_0x422281[_0x54a0('0x2d')]=_0x422281[_0x54a0('0x2d')][_0x54a0('0x30')]?_0x422281['attributes']:_0x640020['model'];if(!_0x2709c4['query']['hasOwnProperty'](_0x54a0('0x31'))){_0x422281['limit']=qs[_0x54a0('0x1e')](_0x2709c4['query'][_0x54a0('0x1e')]);_0x422281['offset']=qs[_0x54a0('0x1d')](_0x2709c4[_0x54a0('0x2c')][_0x54a0('0x1d')]);}_0x422281[_0x54a0('0x32')]=qs[_0x54a0('0x33')](_0x2709c4[_0x54a0('0x2c')][_0x54a0('0x33')]);_0x422281[_0x54a0('0x34')]=qs['filters'](_[_0x54a0('0x35')](_0x2709c4['query'],_0x640020[_0x54a0('0x36')]),_0xdc6ef3);if(_0x2709c4[_0x54a0('0x2c')][_0x54a0('0x37')]){_0x422281[_0x54a0('0x34')]=_[_0x54a0('0x38')](_0x422281[_0x54a0('0x34')],{'$or':_[_0x54a0('0x26')](_0xdc6ef3,function(_0x4c2be3){if(_0x4c2be3['type']!==_0x54a0('0x39')){var _0x166e71={};_0x166e71[_0x4c2be3['name']]={'$like':'%'+_0x2709c4[_0x54a0('0x2c')][_0x54a0('0x37')]+'%'};return _0x166e71;}})});}_0x422281=_[_0x54a0('0x38')]({},_0x422281,_0x2709c4[_0x54a0('0x3a')]);var _0x1c08fe={'where':_0x422281['where']};return db[_0x54a0('0x27')][_0x54a0('0x3b')](_0x1c08fe)[_0x54a0('0x24')](function(_0x31aa2b){_0x205fa3[_0x54a0('0x3b')]=_0x31aa2b;if(_0x2709c4[_0x54a0('0x2c')]['includeAll']){_0x422281[_0x54a0('0x3c')]=[{'all':!![]}];}return db[_0x54a0('0x27')]['findAll'](_0x422281);})['then'](function(_0x15712d){_0x205fa3[_0x54a0('0x3d')]=_0x15712d;return _0x205fa3;})['then'](respondWithFilteredResult(_0x3a98a7,_0x422281))[_0x54a0('0x3e')](handleError(_0x3a98a7,null));};exports[_0x54a0('0x3f')]=function(_0x1775b3,_0x1c000e){var _0x5a1dcb={'raw':!![],'where':{'id':_0x1775b3[_0x54a0('0x40')]['id']}},_0x42be4d={};_0x42be4d['model']=_[_0x54a0('0x41')](db[_0x54a0('0x27')]['rawAttributes']);_0x42be4d[_0x54a0('0x2c')]=_[_0x54a0('0x41')](_0x1775b3[_0x54a0('0x2c')]);_0x42be4d[_0x54a0('0x36')]=_[_0x54a0('0x2e')](_0x42be4d[_0x54a0('0x2a')],_0x42be4d[_0x54a0('0x2c')]);_0x5a1dcb[_0x54a0('0x2d')]=_[_0x54a0('0x2e')](_0x42be4d[_0x54a0('0x2a')],qs[_0x54a0('0x2f')](_0x1775b3[_0x54a0('0x2c')][_0x54a0('0x2f')]));_0x5a1dcb['attributes']=_0x5a1dcb['attributes'][_0x54a0('0x30')]?_0x5a1dcb[_0x54a0('0x2d')]:_0x42be4d['model'];if(_0x1775b3[_0x54a0('0x2c')][_0x54a0('0x42')]){_0x5a1dcb['include']=[{'all':!![]}];}_0x5a1dcb=_[_0x54a0('0x38')]({},_0x5a1dcb,_0x1775b3['options']);return db[_0x54a0('0x27')][_0x54a0('0x43')](_0x5a1dcb)['then'](handleEntityNotFound(_0x1c000e,null))[_0x54a0('0x24')](respondWithResult(_0x1c000e,null))[_0x54a0('0x3e')](handleError(_0x1c000e,null));};exports[_0x54a0('0x44')]=function(_0x4e06e4,_0x5dd14a){return db[_0x54a0('0x27')][_0x54a0('0x44')](_0x4e06e4[_0x54a0('0x45')],{})['then'](respondWithResult(_0x5dd14a,0xc9))['catch'](handleError(_0x5dd14a,null));};exports[_0x54a0('0x23')]=function(_0x9b0471,_0x57f3a3){if(_0x9b0471[_0x54a0('0x45')]['id']){delete _0x9b0471[_0x54a0('0x45')]['id'];}return db[_0x54a0('0x27')]['find']({'where':{'id':_0x9b0471[_0x54a0('0x40')]['id']}})[_0x54a0('0x24')](handleEntityNotFound(_0x57f3a3,null))['then'](saveUpdates(_0x9b0471['body'],null))[_0x54a0('0x24')](respondWithResult(_0x57f3a3,null))[_0x54a0('0x3e')](handleError(_0x57f3a3,null));};exports['destroy']=function(_0x326c5c,_0x591e6d){return db[_0x54a0('0x27')]['find']({'where':{'id':_0x326c5c[_0x54a0('0x40')]['id']}})[_0x54a0('0x24')](handleEntityNotFound(_0x591e6d,null))['then'](removeEntity(_0x591e6d,null))[_0x54a0('0x3e')](handleError(_0x591e6d,null));};exports[_0x54a0('0x46')]=function(_0xc476e3,_0x5909ec){return db[_0x54a0('0x27')][_0x54a0('0x46')]()[_0x54a0('0x24')](respondWithResult(_0x5909ec,null))[_0x54a0('0x3e')](handleError(_0x5909ec,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index 7d9a2aa..69e3946 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 _0x9251=['bluebird','request-promise','rimraf','./openchannelTransferReport.attributes','exports','define','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','util','../../config/logger','moment'];(function(_0x3de13e,_0x588de8){var _0x2e530a=function(_0x13c9ea){while(--_0x13c9ea){_0x3de13e['push'](_0x3de13e['shift']());}};_0x2e530a(++_0x588de8);}(_0x9251,0x1e9));var _0x1925=function(_0x5e36d1,_0x471178){_0x5e36d1=_0x5e36d1-0x0;var _0x950b9e=_0x9251[_0x5e36d1];return _0x950b9e;};'use strict';var _=require('lodash');var util=require(_0x1925('0x0'));var logger=require(_0x1925('0x1'))('api');var moment=require(_0x1925('0x2'));var BPromise=require(_0x1925('0x3'));var rp=require(_0x1925('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1925('0x5'));var config=require('../../config/environment');var attributes=require(_0x1925('0x6'));module[_0x1925('0x7')]=function(_0x41b564,_0x5e63bd){return _0x41b564[_0x1925('0x8')](_0x1925('0x9'),attributes,{'tableName':_0x1925('0xa'),'paranoid':![],'indexes':[{'name':_0x1925('0xb'),'fields':[_0x1925('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x52a3=['uniqueid','lodash','util','../../config/logger','api','moment','rimraf','../../config/environment','define','report_openchannel_transfer'];(function(_0x180a10,_0x286b74){var _0x18737f=function(_0x5b8a48){while(--_0x5b8a48){_0x180a10['push'](_0x180a10['shift']());}};_0x18737f(++_0x286b74);}(_0x52a3,0x187));var _0x352a=function(_0x3db302,_0xe8be0f){_0x3db302=_0x3db302-0x0;var _0x4eff8a=_0x52a3[_0x3db302];return _0x4eff8a;};'use strict';var _=require(_0x352a('0x0'));var util=require(_0x352a('0x1'));var logger=require(_0x352a('0x2'))(_0x352a('0x3'));var moment=require(_0x352a('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x352a('0x5'));var config=require(_0x352a('0x6'));var attributes=require('./openchannelTransferReport.attributes');module['exports']=function(_0x16c182,_0x4d92a5){return _0x16c182[_0x352a('0x7')]('OpenchannelTransferReport',attributes,{'tableName':_0x352a('0x8'),'paranoid':![],'indexes':[{'name':_0x352a('0x9'),'fields':[_0x352a('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index 21d31ac..967fe23 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 _0x0bde=['../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','moment','bluebird','ioredis'];(function(_0x1146f7,_0x475356){var _0x2e5725=function(_0x44f2a2){while(--_0x44f2a2){_0x1146f7['push'](_0x1146f7['shift']());}};_0x2e5725(++_0x475356);}(_0x0bde,0x110));var _0xe0bd=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x0bde[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0xe0bd('0x0'));var util=require('util');var moment=require(_0xe0bd('0x1'));var BPromise=require(_0xe0bd('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe0bd('0x3'));var db=require(_0xe0bd('0x4'))['db'];var utils=require(_0xe0bd('0x5'));var logger=require('../../config/logger')(_0xe0bd('0x6'));var config=require(_0xe0bd('0x7'));var jayson=require(_0xe0bd('0x8'));var client=jayson[_0xe0bd('0x9')][_0xe0bd('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1c8892,_0x29faee,_0x1b75c1){return new BPromise(function(_0xf790d6,_0x54d27f){return client[_0xe0bd('0xb')](_0x1c8892,_0x1b75c1)[_0xe0bd('0xc')](function(_0x12a5f1){logger['info'](_0xe0bd('0xd'),_0x29faee,_0xe0bd('0xe'));logger['debug'](_0xe0bd('0xf'),_0x29faee,'request\x20sent',JSON[_0xe0bd('0x10')](_0x12a5f1));if(_0x12a5f1[_0xe0bd('0x11')]){if(_0x12a5f1[_0xe0bd('0x11')][_0xe0bd('0x12')]===0x1f4){logger[_0xe0bd('0x11')](_0xe0bd('0xd'),_0x29faee,_0x12a5f1[_0xe0bd('0x11')]['message']);return _0x54d27f(_0x12a5f1[_0xe0bd('0x11')][_0xe0bd('0x13')]);}logger[_0xe0bd('0x11')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x29faee,_0x12a5f1[_0xe0bd('0x11')]['message']);return _0xf790d6(_0x12a5f1[_0xe0bd('0x11')][_0xe0bd('0x13')]);}else{logger[_0xe0bd('0x14')](_0xe0bd('0xd'),_0x29faee,_0xe0bd('0xe'));_0xf790d6(_0x12a5f1[_0xe0bd('0x15')][_0xe0bd('0x13')]);}})[_0xe0bd('0x16')](function(_0x4ea791){logger['error'](_0xe0bd('0xd'),_0x29faee,_0x4ea791);_0x54d27f(_0x4ea791);});});} \ No newline at end of file +var _0x79a8=['message','result','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x79a8,0x1d0));var _0x879a=function(_0x1b1ce5,_0x508743){_0x1b1ce5=_0x1b1ce5-0x0;var _0x432ff6=_0x79a8[_0x1b1ce5];return _0x432ff6;};'use strict';var _=require(_0x879a('0x0'));var util=require('util');var moment=require(_0x879a('0x1'));var BPromise=require(_0x879a('0x2'));var rs=require(_0x879a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x879a('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x879a('0x5'))(_0x879a('0x6'));var config=require(_0x879a('0x7'));var jayson=require(_0x879a('0x8'));var client=jayson[_0x879a('0x9')][_0x879a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1d353e,_0x2427bf,_0x4bf3ab){return new BPromise(function(_0xe27fe6,_0x5cb5c9){return client[_0x879a('0xb')](_0x1d353e,_0x4bf3ab)[_0x879a('0xc')](function(_0x5eba04){logger[_0x879a('0xd')](_0x879a('0xe'),_0x2427bf,_0x879a('0xf'));logger['debug'](_0x879a('0x10'),_0x2427bf,_0x879a('0xf'),JSON['stringify'](_0x5eba04));if(_0x5eba04['error']){if(_0x5eba04[_0x879a('0x11')][_0x879a('0x12')]===0x1f4){logger[_0x879a('0x11')](_0x879a('0xe'),_0x2427bf,_0x5eba04['error'][_0x879a('0x13')]);return _0x5cb5c9(_0x5eba04[_0x879a('0x11')][_0x879a('0x13')]);}logger[_0x879a('0x11')](_0x879a('0xe'),_0x2427bf,_0x5eba04[_0x879a('0x11')][_0x879a('0x13')]);return _0xe27fe6(_0x5eba04[_0x879a('0x11')][_0x879a('0x13')]);}else{logger[_0x879a('0xd')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x2427bf,'request\x20sent');_0xe27fe6(_0x5eba04[_0x879a('0x14')][_0x879a('0x13')]);}})['catch'](function(_0x119260){logger[_0x879a('0x11')](_0x879a('0xe'),_0x2427bf,_0x119260);_0x5cb5c9(_0x119260);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index 50d951a..888fda0 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 _0x18f2=['../../components/auth/service','../../config/environment','./pause.controller','get','isAuthenticated','index','/:id','show','post','create','put','delete','exports','multer','util','connect-timeout','express','Router','fs-extra'];(function(_0x26b5ff,_0x92009a){var _0x58603e=function(_0x4454ff){while(--_0x4454ff){_0x26b5ff['push'](_0x26b5ff['shift']());}};_0x58603e(++_0x92009a);}(_0x18f2,0x13d));var _0x218f=function(_0x17a200,_0x5a654a){_0x17a200=_0x17a200-0x0;var _0x5588c5=_0x18f2[_0x17a200];return _0x5588c5;};'use strict';var multer=require(_0x218f('0x0'));var util=require(_0x218f('0x1'));var path=require('path');var timeout=require(_0x218f('0x2'));var express=require(_0x218f('0x3'));var router=express[_0x218f('0x4')]();var fs_extra=require(_0x218f('0x5'));var auth=require(_0x218f('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x218f('0x7'));var controller=require(_0x218f('0x8'));router[_0x218f('0x9')]('/',auth[_0x218f('0xa')](),controller[_0x218f('0xb')]);router[_0x218f('0x9')](_0x218f('0xc'),auth[_0x218f('0xa')](),controller[_0x218f('0xd')]);router[_0x218f('0xe')]('/',auth[_0x218f('0xa')](),controller[_0x218f('0xf')]);router[_0x218f('0x10')](_0x218f('0xc'),auth[_0x218f('0xa')](),controller['update']);router[_0x218f('0x11')](_0x218f('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x218f('0x12')]=router; \ No newline at end of file +var _0xc4c1=['../../components/interaction/service','../../config/environment','./pause.controller','get','isAuthenticated','index','/:id','show','create','update','delete','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x35845a,_0x28786d){var _0x2a0c35=function(_0x52dd5d){while(--_0x52dd5d){_0x35845a['push'](_0x35845a['shift']());}};_0x2a0c35(++_0x28786d);}(_0xc4c1,0x175));var _0x1c4c=function(_0x3ec822,_0x59a9c2){_0x3ec822=_0x3ec822-0x0;var _0x5927c6=_0xc4c1[_0x3ec822];return _0x5927c6;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1c4c('0x0'));var timeout=require(_0x1c4c('0x1'));var express=require(_0x1c4c('0x2'));var router=express[_0x1c4c('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1c4c('0x4'));var interaction=require(_0x1c4c('0x5'));var config=require(_0x1c4c('0x6'));var controller=require(_0x1c4c('0x7'));router[_0x1c4c('0x8')]('/',auth[_0x1c4c('0x9')](),controller[_0x1c4c('0xa')]);router[_0x1c4c('0x8')](_0x1c4c('0xb'),auth['isAuthenticated'](),controller[_0x1c4c('0xc')]);router['post']('/',auth[_0x1c4c('0x9')](),controller[_0x1c4c('0xd')]);router['put'](_0x1c4c('0xb'),auth[_0x1c4c('0x9')](),controller[_0x1c4c('0xe')]);router[_0x1c4c('0xf')](_0x1c4c('0xb'),auth[_0x1c4c('0x9')](),controller[_0x1c4c('0x10')]);module[_0x1c4c('0x11')]=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index 5a413f9..b88e20f 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 _0xe677=['sequelize','exports','STRING','name'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xe677,0x198));var _0x7e67=function(_0x5ad771,_0x34186f){_0x5ad771=_0x5ad771-0x0;var _0x5b5dce=_0xe677[_0x5ad771];return _0x5b5dce;};'use strict';var Sequelize=require(_0x7e67('0x0'));module[_0x7e67('0x1')]={'name':{'type':Sequelize[_0x7e67('0x2')],'unique':_0x7e67('0x3'),'allowNull':![]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x79b9=['name','exports','STRING'];(function(_0x17475c,_0x24405c){var _0x3e9158=function(_0x3df902){while(--_0x3df902){_0x17475c['push'](_0x17475c['shift']());}};_0x3e9158(++_0x24405c);}(_0x79b9,0x1b1));var _0x979b=function(_0x2173ae,_0x1a0ead){_0x2173ae=_0x2173ae-0x0;var _0x16ffe6=_0x79b9[_0x2173ae];return _0x16ffe6;};'use strict';var Sequelize=require('sequelize');module[_0x979b('0x0')]={'name':{'type':Sequelize[_0x979b('0x1')],'unique':_0x979b('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x979b('0x1')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index 0a7faf0..5b9cf01 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 _0x93e7=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','save','update','then','destroy','error','stack','name','send','index','map','Pause','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','pick','filter','merge','where','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','rawAttributes','include','find','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce'];(function(_0x10fe8d,_0x252230){var _0x16260b=function(_0x376b7e){while(--_0x376b7e){_0x10fe8d['push'](_0x10fe8d['shift']());}};_0x16260b(++_0x252230);}(_0x93e7,0x9d));var _0x793e=function(_0x170b20,_0x49fc52){_0x170b20=_0x170b20-0x0;var _0xbe0395=_0x93e7[_0x170b20];return _0xbe0395;};'use strict';var emlformat=require(_0x793e('0x0'));var rimraf=require(_0x793e('0x1'));var zipdir=require(_0x793e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x793e('0x3'));var moment=require(_0x793e('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x793e('0x5'));var util=require(_0x793e('0x6'));var path=require(_0x793e('0x7'));var sox=require(_0x793e('0x8'));var csv=require(_0x793e('0x9'));var ejs=require(_0x793e('0xa'));var fs=require('fs');var fs_extra=require(_0x793e('0xb'));var _=require(_0x793e('0xc'));var squel=require('squel');var crypto=require(_0x793e('0xd'));var jsforce=require(_0x793e('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x793e('0x9'));var querystring=require(_0x793e('0xf'));var Papa=require(_0x793e('0x10'));var Redis=require(_0x793e('0x11'));var authService=require(_0x793e('0x12'));var qs=require(_0x793e('0x13'));var as=require(_0x793e('0x14'));var hardwareService=require(_0x793e('0x15'));var logger=require(_0x793e('0x16'))(_0x793e('0x17'));var utils=require(_0x793e('0x18'));var config=require(_0x793e('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3d4333,_0x4daf90){_0x4daf90=_0x4daf90||0xcc;return function(_0x11ea2d){if(_0x11ea2d){return _0x3d4333[_0x793e('0x1a')](_0x4daf90);}return _0x3d4333[_0x793e('0x1b')](_0x4daf90)[_0x793e('0x1c')]();};}function respondWithResult(_0x4c26dc,_0x372028){_0x372028=_0x372028||0xc8;return function(_0x389fa3){if(_0x389fa3){return _0x4c26dc[_0x793e('0x1b')](_0x372028)['json'](_0x389fa3);}};}function respondWithFilteredResult(_0x1b57b1,_0x109f6c){return function(_0x42b863){if(_0x42b863){var _0x50ea19=typeof _0x109f6c[_0x793e('0x1d')]===_0x793e('0x1e')&&typeof _0x109f6c['limit']===_0x793e('0x1e');var _0x3aadbb=_0x42b863[_0x793e('0x1f')];var _0x960a8c=_0x50ea19?0x0:_0x109f6c[_0x793e('0x1d')];var _0x47afcf=_0x50ea19?_0x42b863[_0x793e('0x1f')]:_0x109f6c[_0x793e('0x1d')]+_0x109f6c[_0x793e('0x20')];var _0x297eff;if(_0x47afcf>=_0x3aadbb){_0x47afcf=_0x3aadbb;_0x297eff=0xc8;}else{_0x297eff=0xce;}_0x1b57b1['status'](_0x297eff);return _0x1b57b1[_0x793e('0x21')](_0x793e('0x22'),_0x960a8c+'-'+_0x47afcf+'/'+_0x3aadbb)[_0x793e('0x23')](_0x42b863);}return null;};}function patchUpdates(_0x217257){return function(_0x3b96c1){try{jsonpatch[_0x793e('0x24')](_0x3b96c1,_0x217257,!![]);}catch(_0x59f4be){return BPromise['reject'](_0x59f4be);}return _0x3b96c1[_0x793e('0x25')]();};}function saveUpdates(_0x150865,_0x3a0012){return function(_0x3937d1){if(_0x3937d1){return _0x3937d1[_0x793e('0x26')](_0x150865)[_0x793e('0x27')](function(_0x2820bc){return _0x2820bc;});}return null;};}function removeEntity(_0x2c5ea2,_0x27d2c8){return function(_0x39bf0a){if(_0x39bf0a){return _0x39bf0a[_0x793e('0x28')]()['then'](function(){var _0x4fb435=_0x39bf0a['get']({'plain':!![]});var _0x13a5ae='Pauses';return db['UserProfileResource'][_0x793e('0x28')]({'where':{'type':_0x13a5ae,'resourceId':_0x4fb435['id']}})[_0x793e('0x27')](function(){return _0x39bf0a;});})['then'](function(){_0x2c5ea2[_0x793e('0x1b')](0xcc)[_0x793e('0x1c')]();});}};}function handleEntityNotFound(_0x1dda8c,_0x504662){return function(_0x4741cd){if(!_0x4741cd){_0x1dda8c[_0x793e('0x1a')](0x194);}return _0x4741cd;};}function handleError(_0x262581,_0x428fa1){_0x428fa1=_0x428fa1||0x1f4;return function(_0x1b2372){logger[_0x793e('0x29')](_0x1b2372[_0x793e('0x2a')]);if(_0x1b2372[_0x793e('0x2b')]){delete _0x1b2372['name'];}_0x262581['status'](_0x428fa1)[_0x793e('0x2c')](_0x1b2372);};}exports[_0x793e('0x2d')]=function(_0x18245d,_0x35338e){var _0x3d0350={},_0x71c709={},_0x31d0f5={'count':0x0,'rows':[]};var _0x3cc920=_[_0x793e('0x2e')](db[_0x793e('0x2f')]['rawAttributes'],function(_0x414d71){return{'name':_0x414d71[_0x793e('0x30')],'type':_0x414d71['type'][_0x793e('0x31')]};});_0x71c709[_0x793e('0x32')]=_['map'](_0x3cc920,_0x793e('0x2b'));_0x71c709[_0x793e('0x33')]=_[_0x793e('0x34')](_0x18245d[_0x793e('0x33')]);_0x71c709[_0x793e('0x35')]=_['intersection'](_0x71c709['model'],_0x71c709['query']);_0x3d0350[_0x793e('0x36')]=_[_0x793e('0x37')](_0x71c709[_0x793e('0x32')],qs[_0x793e('0x38')](_0x18245d[_0x793e('0x33')]['fields']));_0x3d0350[_0x793e('0x36')]=_0x3d0350[_0x793e('0x36')][_0x793e('0x39')]?_0x3d0350[_0x793e('0x36')]:_0x71c709[_0x793e('0x32')];if(!_0x18245d[_0x793e('0x33')][_0x793e('0x3a')]('nolimit')){_0x3d0350[_0x793e('0x20')]=qs[_0x793e('0x20')](_0x18245d[_0x793e('0x33')]['limit']);_0x3d0350[_0x793e('0x1d')]=qs[_0x793e('0x1d')](_0x18245d['query']['offset']);}_0x3d0350[_0x793e('0x3b')]=qs[_0x793e('0x3c')](_0x18245d[_0x793e('0x33')]['sort']);_0x3d0350['where']=qs[_0x793e('0x35')](_[_0x793e('0x3d')](_0x18245d[_0x793e('0x33')],_0x71c709[_0x793e('0x35')]),_0x3cc920);if(_0x18245d[_0x793e('0x33')][_0x793e('0x3e')]){_0x3d0350['where']=_[_0x793e('0x3f')](_0x3d0350[_0x793e('0x40')],{'$or':_['map'](_0x3cc920,function(_0x2dbc75){if(_0x2dbc75['type']!==_0x793e('0x41')){var _0x32484a={};_0x32484a[_0x2dbc75[_0x793e('0x2b')]]={'$like':'%'+_0x18245d[_0x793e('0x33')][_0x793e('0x3e')]+'%'};return _0x32484a;}})});}_0x3d0350=_[_0x793e('0x3f')]({},_0x3d0350,_0x18245d[_0x793e('0x42')]);var _0x2fa1de={'where':_0x3d0350['where']};return db[_0x793e('0x2f')][_0x793e('0x1f')](_0x2fa1de)[_0x793e('0x27')](function(_0x1e9570){_0x31d0f5[_0x793e('0x1f')]=_0x1e9570;if(_0x18245d[_0x793e('0x33')][_0x793e('0x43')]){_0x3d0350['include']=[{'all':!![]}];}return db[_0x793e('0x2f')][_0x793e('0x44')](_0x3d0350);})['then'](function(_0x116ec9){_0x31d0f5[_0x793e('0x45')]=_0x116ec9;return _0x31d0f5;})[_0x793e('0x27')](respondWithFilteredResult(_0x35338e,_0x3d0350))[_0x793e('0x46')](handleError(_0x35338e,null));};exports[_0x793e('0x47')]=function(_0xc08dd2,_0x306182){var _0x11406b={'raw':!![],'where':{'id':_0xc08dd2[_0x793e('0x48')]['id']}},_0x53a738={};_0x53a738[_0x793e('0x32')]=_[_0x793e('0x34')](db['Pause'][_0x793e('0x49')]);_0x53a738['query']=_[_0x793e('0x34')](_0xc08dd2[_0x793e('0x33')]);_0x53a738['filters']=_[_0x793e('0x37')](_0x53a738[_0x793e('0x32')],_0x53a738[_0x793e('0x33')]);_0x11406b[_0x793e('0x36')]=_[_0x793e('0x37')](_0x53a738['model'],qs['fields'](_0xc08dd2['query'][_0x793e('0x38')]));_0x11406b[_0x793e('0x36')]=_0x11406b[_0x793e('0x36')]['length']?_0x11406b[_0x793e('0x36')]:_0x53a738[_0x793e('0x32')];if(_0xc08dd2[_0x793e('0x33')][_0x793e('0x43')]){_0x11406b[_0x793e('0x4a')]=[{'all':!![]}];}_0x11406b=_[_0x793e('0x3f')]({},_0x11406b,_0xc08dd2[_0x793e('0x42')]);return db[_0x793e('0x2f')][_0x793e('0x4b')](_0x11406b)[_0x793e('0x27')](handleEntityNotFound(_0x306182,null))['then'](respondWithResult(_0x306182,null))[_0x793e('0x46')](handleError(_0x306182,null));};exports['create']=function(_0x300859,_0x4fc514){return db[_0x793e('0x2f')]['create'](_0x300859[_0x793e('0x4c')],{})['then'](function(_0x456a89){var _0x3960c1=_0x300859[_0x793e('0x4d')][_0x793e('0x4e')]({'plain':!![]});if(!_0x3960c1)throw new Error(_0x793e('0x4f'));if(_0x3960c1[_0x793e('0x50')]===_0x793e('0x4d')){var _0x3a748b=_0x456a89['get']({'plain':!![]});var _0x97f6ac='Pauses';return db['UserProfileSection'][_0x793e('0x4b')]({'where':{'name':_0x97f6ac,'userProfileId':_0x3960c1[_0x793e('0x51')]},'raw':!![]})[_0x793e('0x27')](function(_0x351a77){if(_0x351a77&&_0x351a77[_0x793e('0x52')]===0x0){return db[_0x793e('0x53')][_0x793e('0x54')]({'name':_0x3a748b['name'],'resourceId':_0x3a748b['id'],'type':_0x351a77[_0x793e('0x2b')],'sectionId':_0x351a77['id']},{})[_0x793e('0x27')](function(){return _0x456a89;});}else{return _0x456a89;}})[_0x793e('0x46')](function(_0x23a07f){logger[_0x793e('0x29')](_0x793e('0x55'),_0x23a07f);throw _0x23a07f;});}return _0x456a89;})[_0x793e('0x27')](respondWithResult(_0x4fc514,0xc9))[_0x793e('0x46')](handleError(_0x4fc514,null));};exports[_0x793e('0x26')]=function(_0x160f5c,_0x2c9b68){if(_0x160f5c['body']['id']){delete _0x160f5c['body']['id'];}return db[_0x793e('0x2f')][_0x793e('0x4b')]({'where':{'id':_0x160f5c[_0x793e('0x48')]['id']}})[_0x793e('0x27')](handleEntityNotFound(_0x2c9b68,null))['then'](saveUpdates(_0x160f5c[_0x793e('0x4c')],null))[_0x793e('0x27')](respondWithResult(_0x2c9b68,null))[_0x793e('0x46')](handleError(_0x2c9b68,null));};exports['destroy']=function(_0x389a45,_0x47d689){return db['Pause'][_0x793e('0x4b')]({'where':{'id':_0x389a45[_0x793e('0x48')]['id']}})[_0x793e('0x27')](handleEntityNotFound(_0x47d689,null))[_0x793e('0x27')](removeEntity(_0x47d689,null))['catch'](handleError(_0x47d689,null));}; \ No newline at end of file +var _0x3f88=['UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','get','Pauses','UserProfileResource','error','stack','name','send','index','Pause','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','fields','attributes','nolimit','order','sort','where','pick','filter','VIRTUAL','options','includeAll','findAll','rows','catch','params','length','include','merge','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role'];(function(_0x13c121,_0x2fe7f2){var _0x2d9000=function(_0x566196){while(--_0x566196){_0x13c121['push'](_0x13c121['shift']());}};_0x2d9000(++_0x2fe7f2);}(_0x3f88,0xae));var _0x83f8=function(_0x21e82f,_0x1e6aa){_0x21e82f=_0x21e82f-0x0;var _0x47e639=_0x3f88[_0x21e82f];return _0x47e639;};'use strict';var emlformat=require(_0x83f8('0x0'));var rimraf=require(_0x83f8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x83f8('0x2'));var rp=require('request-promise');var moment=require(_0x83f8('0x3'));var BPromise=require(_0x83f8('0x4'));var Mustache=require(_0x83f8('0x5'));var util=require(_0x83f8('0x6'));var path=require(_0x83f8('0x7'));var sox=require('sox');var csv=require(_0x83f8('0x8'));var ejs=require(_0x83f8('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x83f8('0xa'));var crypto=require(_0x83f8('0xb'));var jsforce=require(_0x83f8('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x83f8('0xd'));var Papa=require(_0x83f8('0xe'));var Redis=require('ioredis');var authService=require(_0x83f8('0xf'));var qs=require(_0x83f8('0x10'));var as=require(_0x83f8('0x11'));var hardwareService=require(_0x83f8('0x12'));var logger=require('../../config/logger')(_0x83f8('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x83f8('0x14'));var db=require(_0x83f8('0x15'))['db'];function respondWithStatusCode(_0x58a8fb,_0x2bdff6){_0x2bdff6=_0x2bdff6||0xcc;return function(_0x4af8ed){if(_0x4af8ed){return _0x58a8fb[_0x83f8('0x16')](_0x2bdff6);}return _0x58a8fb['status'](_0x2bdff6)[_0x83f8('0x17')]();};}function respondWithResult(_0x19b321,_0x81a35c){_0x81a35c=_0x81a35c||0xc8;return function(_0xfee28f){if(_0xfee28f){return _0x19b321[_0x83f8('0x18')](_0x81a35c)['json'](_0xfee28f);}};}function respondWithFilteredResult(_0x344eed,_0x38ece9){return function(_0x2f1990){if(_0x2f1990){var _0x2c56fc=typeof _0x38ece9[_0x83f8('0x19')]===_0x83f8('0x1a')&&typeof _0x38ece9['limit']==='undefined';var _0x24dacf=_0x2f1990[_0x83f8('0x1b')];var _0x587305=_0x2c56fc?0x0:_0x38ece9['offset'];var _0xde2a81=_0x2c56fc?_0x2f1990[_0x83f8('0x1b')]:_0x38ece9[_0x83f8('0x19')]+_0x38ece9[_0x83f8('0x1c')];var _0x2fd2df;if(_0xde2a81>=_0x24dacf){_0xde2a81=_0x24dacf;_0x2fd2df=0xc8;}else{_0x2fd2df=0xce;}_0x344eed[_0x83f8('0x18')](_0x2fd2df);return _0x344eed[_0x83f8('0x1d')](_0x83f8('0x1e'),_0x587305+'-'+_0xde2a81+'/'+_0x24dacf)[_0x83f8('0x1f')](_0x2f1990);}return null;};}function patchUpdates(_0x2a89c9){return function(_0x188879){try{jsonpatch[_0x83f8('0x20')](_0x188879,_0x2a89c9,!![]);}catch(_0x5c8a5e){return BPromise[_0x83f8('0x21')](_0x5c8a5e);}return _0x188879[_0x83f8('0x22')]();};}function saveUpdates(_0x2ca7b1,_0x33fa61){return function(_0x2a14a2){if(_0x2a14a2){return _0x2a14a2[_0x83f8('0x23')](_0x2ca7b1)[_0x83f8('0x24')](function(_0x1704c6){return _0x1704c6;});}return null;};}function removeEntity(_0x3ea6ff,_0x377001){return function(_0x2e0ddf){if(_0x2e0ddf){return _0x2e0ddf[_0x83f8('0x25')]()['then'](function(){var _0x4a2a85=_0x2e0ddf[_0x83f8('0x26')]({'plain':!![]});var _0x3c80ce=_0x83f8('0x27');return db[_0x83f8('0x28')]['destroy']({'where':{'type':_0x3c80ce,'resourceId':_0x4a2a85['id']}})['then'](function(){return _0x2e0ddf;});})[_0x83f8('0x24')](function(){_0x3ea6ff[_0x83f8('0x18')](0xcc)[_0x83f8('0x17')]();});}};}function handleEntityNotFound(_0x167141,_0x4cb9e2){return function(_0x132a02){if(!_0x132a02){_0x167141['sendStatus'](0x194);}return _0x132a02;};}function handleError(_0x4ea56d,_0x22b330){_0x22b330=_0x22b330||0x1f4;return function(_0x2c83f2){logger[_0x83f8('0x29')](_0x2c83f2[_0x83f8('0x2a')]);if(_0x2c83f2['name']){delete _0x2c83f2[_0x83f8('0x2b')];}_0x4ea56d[_0x83f8('0x18')](_0x22b330)[_0x83f8('0x2c')](_0x2c83f2);};}exports[_0x83f8('0x2d')]=function(_0x1b13d3,_0x131bff){var _0x5853cf={},_0x2d43f5={},_0x316201={'count':0x0,'rows':[]};var _0x4d8b24=_['map'](db[_0x83f8('0x2e')][_0x83f8('0x2f')],function(_0x52ee05){return{'name':_0x52ee05[_0x83f8('0x30')],'type':_0x52ee05[_0x83f8('0x31')][_0x83f8('0x32')]};});_0x2d43f5[_0x83f8('0x33')]=_[_0x83f8('0x34')](_0x4d8b24,_0x83f8('0x2b'));_0x2d43f5['query']=_[_0x83f8('0x35')](_0x1b13d3[_0x83f8('0x36')]);_0x2d43f5[_0x83f8('0x37')]=_[_0x83f8('0x38')](_0x2d43f5['model'],_0x2d43f5[_0x83f8('0x36')]);_0x5853cf['attributes']=_['intersection'](_0x2d43f5[_0x83f8('0x33')],qs[_0x83f8('0x39')](_0x1b13d3[_0x83f8('0x36')][_0x83f8('0x39')]));_0x5853cf['attributes']=_0x5853cf[_0x83f8('0x3a')]['length']?_0x5853cf[_0x83f8('0x3a')]:_0x2d43f5[_0x83f8('0x33')];if(!_0x1b13d3[_0x83f8('0x36')]['hasOwnProperty'](_0x83f8('0x3b'))){_0x5853cf['limit']=qs[_0x83f8('0x1c')](_0x1b13d3[_0x83f8('0x36')]['limit']);_0x5853cf[_0x83f8('0x19')]=qs[_0x83f8('0x19')](_0x1b13d3[_0x83f8('0x36')][_0x83f8('0x19')]);}_0x5853cf[_0x83f8('0x3c')]=qs[_0x83f8('0x3d')](_0x1b13d3[_0x83f8('0x36')]['sort']);_0x5853cf[_0x83f8('0x3e')]=qs[_0x83f8('0x37')](_[_0x83f8('0x3f')](_0x1b13d3[_0x83f8('0x36')],_0x2d43f5[_0x83f8('0x37')]),_0x4d8b24);if(_0x1b13d3[_0x83f8('0x36')][_0x83f8('0x40')]){_0x5853cf[_0x83f8('0x3e')]=_['merge'](_0x5853cf['where'],{'$or':_[_0x83f8('0x34')](_0x4d8b24,function(_0xae89b3){if(_0xae89b3['type']!==_0x83f8('0x41')){var _0x1e67f2={};_0x1e67f2[_0xae89b3[_0x83f8('0x2b')]]={'$like':'%'+_0x1b13d3[_0x83f8('0x36')][_0x83f8('0x40')]+'%'};return _0x1e67f2;}})});}_0x5853cf=_['merge']({},_0x5853cf,_0x1b13d3[_0x83f8('0x42')]);var _0x248c9f={'where':_0x5853cf['where']};return db[_0x83f8('0x2e')][_0x83f8('0x1b')](_0x248c9f)[_0x83f8('0x24')](function(_0x4dc52d){_0x316201[_0x83f8('0x1b')]=_0x4dc52d;if(_0x1b13d3[_0x83f8('0x36')][_0x83f8('0x43')]){_0x5853cf['include']=[{'all':!![]}];}return db[_0x83f8('0x2e')][_0x83f8('0x44')](_0x5853cf);})['then'](function(_0x484f90){_0x316201[_0x83f8('0x45')]=_0x484f90;return _0x316201;})[_0x83f8('0x24')](respondWithFilteredResult(_0x131bff,_0x5853cf))[_0x83f8('0x46')](handleError(_0x131bff,null));};exports['show']=function(_0x232ab0,_0x305dbb){var _0xf388={'raw':!![],'where':{'id':_0x232ab0[_0x83f8('0x47')]['id']}},_0x30d9d5={};_0x30d9d5[_0x83f8('0x33')]=_[_0x83f8('0x35')](db[_0x83f8('0x2e')][_0x83f8('0x2f')]);_0x30d9d5['query']=_[_0x83f8('0x35')](_0x232ab0[_0x83f8('0x36')]);_0x30d9d5[_0x83f8('0x37')]=_[_0x83f8('0x38')](_0x30d9d5[_0x83f8('0x33')],_0x30d9d5[_0x83f8('0x36')]);_0xf388[_0x83f8('0x3a')]=_[_0x83f8('0x38')](_0x30d9d5['model'],qs[_0x83f8('0x39')](_0x232ab0[_0x83f8('0x36')][_0x83f8('0x39')]));_0xf388['attributes']=_0xf388[_0x83f8('0x3a')][_0x83f8('0x48')]?_0xf388[_0x83f8('0x3a')]:_0x30d9d5['model'];if(_0x232ab0['query'][_0x83f8('0x43')]){_0xf388[_0x83f8('0x49')]=[{'all':!![]}];}_0xf388=_[_0x83f8('0x4a')]({},_0xf388,_0x232ab0['options']);return db[_0x83f8('0x2e')][_0x83f8('0x4b')](_0xf388)[_0x83f8('0x24')](handleEntityNotFound(_0x305dbb,null))[_0x83f8('0x24')](respondWithResult(_0x305dbb,null))[_0x83f8('0x46')](handleError(_0x305dbb,null));};exports[_0x83f8('0x4c')]=function(_0x2e1379,_0x3bf868){return db['Pause'][_0x83f8('0x4c')](_0x2e1379[_0x83f8('0x4d')],{})[_0x83f8('0x24')](function(_0xcc3714){var _0x13a4e8=_0x2e1379[_0x83f8('0x4e')]['get']({'plain':!![]});if(!_0x13a4e8)throw new Error(_0x83f8('0x4f'));if(_0x13a4e8[_0x83f8('0x50')]==='user'){var _0xa0eb05=_0xcc3714[_0x83f8('0x26')]({'plain':!![]});var _0x52c0c5='Pauses';return db[_0x83f8('0x51')][_0x83f8('0x4b')]({'where':{'name':_0x52c0c5,'userProfileId':_0x13a4e8[_0x83f8('0x52')]},'raw':!![]})[_0x83f8('0x24')](function(_0x39ceba){if(_0x39ceba&&_0x39ceba[_0x83f8('0x53')]===0x0){return db[_0x83f8('0x28')][_0x83f8('0x4c')]({'name':_0xa0eb05[_0x83f8('0x2b')],'resourceId':_0xa0eb05['id'],'type':_0x39ceba[_0x83f8('0x2b')],'sectionId':_0x39ceba['id']},{})[_0x83f8('0x24')](function(){return _0xcc3714;});}else{return _0xcc3714;}})[_0x83f8('0x46')](function(_0x292579){logger['error'](_0x83f8('0x54'),_0x292579);throw _0x292579;});}return _0xcc3714;})[_0x83f8('0x24')](respondWithResult(_0x3bf868,0xc9))[_0x83f8('0x46')](handleError(_0x3bf868,null));};exports[_0x83f8('0x23')]=function(_0x310278,_0x2cf8a1){if(_0x310278[_0x83f8('0x4d')]['id']){delete _0x310278[_0x83f8('0x4d')]['id'];}return db[_0x83f8('0x2e')][_0x83f8('0x4b')]({'where':{'id':_0x310278[_0x83f8('0x47')]['id']}})['then'](handleEntityNotFound(_0x2cf8a1,null))[_0x83f8('0x24')](saveUpdates(_0x310278[_0x83f8('0x4d')],null))[_0x83f8('0x24')](respondWithResult(_0x2cf8a1,null))[_0x83f8('0x46')](handleError(_0x2cf8a1,null));};exports[_0x83f8('0x25')]=function(_0x3a4c32,_0x201c8e){return db[_0x83f8('0x2e')][_0x83f8('0x4b')]({'where':{'id':_0x3a4c32[_0x83f8('0x47')]['id']}})[_0x83f8('0x24')](handleEntityNotFound(_0x201c8e,null))['then'](removeEntity(_0x201c8e,null))['catch'](handleError(_0x201c8e,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index 5e3c708..68a4dfa 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 _0x9957=['exports','define','Pause','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./pause.attributes'];(function(_0x22b68a,_0x2bffc3){var _0x1ac67a=function(_0x25f9d5){while(--_0x25f9d5){_0x22b68a['push'](_0x22b68a['shift']());}};_0x1ac67a(++_0x2bffc3);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'tools_pauses','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(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x3d42d8,_0x4cffaa){_0x3d42d8=_0x3d42d8-0x0;var _0x27fc41=_0xc4aa[_0x3d42d8];return _0x27fc41;};'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 9abae29..f79c700 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(_0x4bf63a,_0x56ee3e){var _0x410642=function(_0x2a8475){while(--_0x2a8475){_0x4bf63a['push'](_0x4bf63a['shift']());}};_0x410642(++_0x56ee3e);}(_0xb10b,0x12a));var _0xbb10=function(_0x4e5d67,_0x54dffc){_0x4e5d67=_0x4e5d67-0x0;var _0x4acdf3=_0xb10b[_0x4e5d67];return _0x4acdf3;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')]({'raw':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8[_0xbb10('0x18')]?_0x378da8['options'][_0xbb10('0x1b')]||null:null,'include':_0x378da8[_0xbb10('0x18')]?_0x378da8['options']['include']?_[_0xbb10('0x1c')](_0x378da8[_0xbb10('0x18')][_0xbb10('0x1d')],function(_0x317da4){return{'model':db[_0x317da4[_0xbb10('0x1e')]],'as':_0x317da4['as'],'attributes':_0x317da4[_0xbb10('0x1b')],'include':_0x317da4[_0xbb10('0x1d')]?_[_0xbb10('0x1c')](_0x317da4[_0xbb10('0x1d')],function(_0x395404){return{'model':db[_0x395404[_0xbb10('0x1e')]],'as':_0x395404['as'],'attributes':_0x395404[_0xbb10('0x1b')],'include':_0x395404['include']?_['map'](_0x395404['include'],function(_0xc93a04){return{'model':db[_0xc93a04[_0xbb10('0x1e')]],'as':_0xc93a04['as'],'attributes':_0xc93a04[_0xbb10('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2fdde9){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1f')](_0xbb10('0x15'),_0x378da8,JSON[_0xbb10('0x11')](_0x2fdde9));_0x575cca(_0x2fdde9);})[_0xbb10('0x20')](function(_0x4aabb9){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x4aabb9[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x4aabb9[_0xbb10('0x13')]));});});}; \ No newline at end of file +var _0xb10b=['catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Pause,\x20%s,\x20%s','Pause,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','ShowPause','Pause','find','options','raw','where','attributes','map','include','model','debug'];(function(_0x39309d,_0x1ad83c){var _0x352d16=function(_0x33c6f5){while(--_0x33c6f5){_0x39309d['push'](_0x39309d['shift']());}};_0x352d16(++_0x1ad83c);}(_0xb10b,0x12a));var _0xbb10=function(_0x10d73b,_0xb2bc5){_0x10d73b=_0x10d73b-0x0;var _0x22f7c2=_0xb10b[_0x10d73b];return _0x22f7c2;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')]({'raw':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8[_0xbb10('0x18')]?_0x378da8['options'][_0xbb10('0x1b')]||null:null,'include':_0x378da8[_0xbb10('0x18')]?_0x378da8['options']['include']?_[_0xbb10('0x1c')](_0x378da8[_0xbb10('0x18')][_0xbb10('0x1d')],function(_0x317da4){return{'model':db[_0x317da4[_0xbb10('0x1e')]],'as':_0x317da4['as'],'attributes':_0x317da4[_0xbb10('0x1b')],'include':_0x317da4[_0xbb10('0x1d')]?_[_0xbb10('0x1c')](_0x317da4[_0xbb10('0x1d')],function(_0x395404){return{'model':db[_0x395404[_0xbb10('0x1e')]],'as':_0x395404['as'],'attributes':_0x395404[_0xbb10('0x1b')],'include':_0x395404['include']?_['map'](_0x395404['include'],function(_0xc93a04){return{'model':db[_0xc93a04[_0xbb10('0x1e')]],'as':_0xc93a04['as'],'attributes':_0xc93a04[_0xbb10('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2fdde9){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1f')](_0xbb10('0x15'),_0x378da8,JSON[_0xbb10('0x11')](_0x2fdde9));_0x575cca(_0x2fdde9);})[_0xbb10('0x20')](function(_0x4aabb9){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x4aabb9[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x4aabb9[_0xbb10('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/index.js b/server/api/plugin/index.js index 60209cb..2a29b07 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 _0x5ad3=['webhookGet','/:id','show','download','root','server/files/plugins','replace','format','%s-%s%s','originalname','extname','now','post','single','file','/webhook','webhookPost','put','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./plugin.controller','get','isAuthenticated','index'];(function(_0x5ac2c1,_0x142a24){var _0x2911e6=function(_0x471307){while(--_0x471307){_0x5ac2c1['push'](_0x5ac2c1['shift']());}};_0x2911e6(++_0x142a24);}(_0x5ad3,0x1e2));var _0x35ad=function(_0x1dd532,_0x36e81c){_0x1dd532=_0x1dd532-0x0;var _0x3732aa=_0x5ad3[_0x1dd532];return _0x3732aa;};'use strict';var multer=require(_0x35ad('0x0'));var util=require(_0x35ad('0x1'));var path=require(_0x35ad('0x2'));var timeout=require(_0x35ad('0x3'));var express=require('express');var router=express[_0x35ad('0x4')]();var fs_extra=require(_0x35ad('0x5'));var auth=require(_0x35ad('0x6'));var interaction=require(_0x35ad('0x7'));var config=require(_0x35ad('0x8'));var controller=require(_0x35ad('0x9'));router[_0x35ad('0xa')]('/',auth[_0x35ad('0xb')](),controller[_0x35ad('0xc')]);router[_0x35ad('0xa')]('/webhook',controller[_0x35ad('0xd')]);router[_0x35ad('0xa')](_0x35ad('0xe'),auth['isAuthenticated'](),controller[_0x35ad('0xf')]);router['get']('/:id/download',auth[_0x35ad('0xb')](),controller[_0x35ad('0x10')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x34c2cb,_0x3a70a9,_0x4ad760){_0x4ad760(null,path['join'](config[_0x35ad('0x11')],_0x35ad('0x12')));},'filename':function(_0x4cf6bd,_0x3c4dd5,_0x33e2ec){_0x3c4dd5['originalname']=_0x3c4dd5['originalname'][_0x35ad('0x13')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x33e2ec(null,util[_0x35ad('0x14')](_0x35ad('0x15'),path['basename'](_0x3c4dd5[_0x35ad('0x16')],path[_0x35ad('0x17')](_0x3c4dd5['originalname'])),Date[_0x35ad('0x18')](),path['extname'](_0x3c4dd5['originalname'])));}})});router[_0x35ad('0x19')]('/',upload[_0x35ad('0x1a')](_0x35ad('0x1b')),controller['upload']);router[_0x35ad('0x19')](_0x35ad('0x1c'),controller[_0x35ad('0x1d')]);router[_0x35ad('0x1e')](_0x35ad('0xe'),auth[_0x35ad('0xb')](),controller['update']);router[_0x35ad('0x1f')](_0x35ad('0xe'),auth['isAuthenticated'](),controller['delete']);module[_0x35ad('0x20')]=router; \ No newline at end of file +var _0x4d9e=['upload','webhookPost','put','delete','multer','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./plugin.controller','get','isAuthenticated','index','/webhook','/:id','show','/:id/download','download','diskStorage','join','root','%s-%s%s','basename','originalname','now','extname','single','file'];(function(_0x4f3c9b,_0x28e078){var _0x84e58a=function(_0x37bf49){while(--_0x37bf49){_0x4f3c9b['push'](_0x4f3c9b['shift']());}};_0x84e58a(++_0x28e078);}(_0x4d9e,0x18c));var _0xe4d9=function(_0x50d217,_0x56c100){_0x50d217=_0x50d217-0x0;var _0x532270=_0x4d9e[_0x50d217];return _0x532270;};'use strict';var multer=require(_0xe4d9('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xe4d9('0x1'));var express=require('express');var router=express[_0xe4d9('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xe4d9('0x3'));var interaction=require(_0xe4d9('0x4'));var config=require('../../config/environment');var controller=require(_0xe4d9('0x5'));router[_0xe4d9('0x6')]('/',auth[_0xe4d9('0x7')](),controller[_0xe4d9('0x8')]);router[_0xe4d9('0x6')](_0xe4d9('0x9'),controller['webhookGet']);router[_0xe4d9('0x6')](_0xe4d9('0xa'),auth[_0xe4d9('0x7')](),controller[_0xe4d9('0xb')]);router[_0xe4d9('0x6')](_0xe4d9('0xc'),auth['isAuthenticated'](),controller[_0xe4d9('0xd')]);var upload=multer({'storage':multer[_0xe4d9('0xe')]({'destination':function(_0x32eb8a,_0x3575ac,_0xddd1fb){_0xddd1fb(null,path[_0xe4d9('0xf')](config[_0xe4d9('0x10')],'server/files/plugins'));},'filename':function(_0x5ee099,_0x580c50,_0x4e0d15){_0x580c50['originalname']=_0x580c50['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x4e0d15(null,util['format'](_0xe4d9('0x11'),path[_0xe4d9('0x12')](_0x580c50[_0xe4d9('0x13')],path['extname'](_0x580c50[_0xe4d9('0x13')])),Date[_0xe4d9('0x14')](),path[_0xe4d9('0x15')](_0x580c50[_0xe4d9('0x13')])));}})});router['post']('/',upload[_0xe4d9('0x16')](_0xe4d9('0x17')),controller[_0xe4d9('0x18')]);router['post']('/webhook',controller[_0xe4d9('0x19')]);router[_0xe4d9('0x1a')]('/:id',auth[_0xe4d9('0x7')](),controller['update']);router[_0xe4d9('0x1b')](_0xe4d9('0xa'),auth[_0xe4d9('0x7')](),controller[_0xe4d9('0x1b')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index 732bdef..9ae59ed 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 _0x8a2e=['agentOnly','always','sequelize','STRING','html','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly'];(function(_0x5aaec5,_0x2cf6cc){var _0x8ec821=function(_0x1d31c5){while(--_0x1d31c5){_0x5aaec5['push'](_0x5aaec5['shift']());}};_0x8ec821(++_0x2cf6cc);}(_0x8a2e,0x119));var _0xe8a2=function(_0x22fadf,_0x5dc146){_0x22fadf=_0x22fadf-0x0;var _0x114c05=_0x8a2e[_0x22fadf];return _0x114c05;};'use strict';var Sequelize=require(_0xe8a2('0x0'));module['exports']={'name':{'type':Sequelize[_0xe8a2('0x1')]},'type':{'type':Sequelize['ENUM'](_0xe8a2('0x2'),'script')},'description':{'type':Sequelize[_0xe8a2('0x3')]},'version':{'type':Sequelize['TEXT']},'path':{'type':Sequelize['STRING'],'comment':_0xe8a2('0x4')},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0xe8a2('0x5')},'sidebar':{'type':Sequelize['ENUM'](_0xe8a2('0x6'),_0xe8a2('0x7'),_0xe8a2('0x8'),'never'),'defaultValue':_0xe8a2('0x8'),'comment':'Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.'},'icon':{'type':Sequelize[_0xe8a2('0x1')]},'adminUrl':{'type':Sequelize[_0xe8a2('0x1')]},'agentUrl':{'type':Sequelize[_0xe8a2('0x1')]},'scriptName':{'type':Sequelize[_0xe8a2('0x1')]},'scriptPath':{'type':Sequelize[_0xe8a2('0x1')]}}; \ No newline at end of file +var _0x3a82=['Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','STRING','sequelize','ENUM','html','script','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN'];(function(_0x1b20ab,_0xd2feb6){var _0x382e6d=function(_0x5149c2){while(--_0x5149c2){_0x1b20ab['push'](_0x1b20ab['shift']());}};_0x382e6d(++_0xd2feb6);}(_0x3a82,0x172));var _0x23a8=function(_0x5ced7d,_0xc4587d){_0x5ced7d=_0x5ced7d-0x0;var _0x1c3abb=_0x3a82[_0x5ced7d];return _0x1c3abb;};'use strict';var Sequelize=require(_0x23a8('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x23a8('0x1')](_0x23a8('0x2'),_0x23a8('0x3'))},'description':{'type':Sequelize[_0x23a8('0x4')]},'version':{'type':Sequelize['TEXT']},'path':{'type':Sequelize['STRING'],'comment':_0x23a8('0x5')},'active':{'type':Sequelize[_0x23a8('0x6')],'defaultValue':0x0,'comment':_0x23a8('0x7')},'sidebar':{'type':Sequelize[_0x23a8('0x1')](_0x23a8('0x8'),'agentOnly',_0x23a8('0x9'),_0x23a8('0xa')),'defaultValue':_0x23a8('0x9'),'comment':_0x23a8('0xb')},'icon':{'type':Sequelize['STRING']},'adminUrl':{'type':Sequelize[_0x23a8('0xc')]},'agentUrl':{'type':Sequelize[_0x23a8('0xc')]},'scriptName':{'type':Sequelize['STRING']},'scriptPath':{'type':Sequelize[_0x23a8('0xc')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index f9d504f..87b52f4 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 _0xa1ac=['Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','**/*','server/files/plugins','dirname','node_modules/**/*','attachments/**/*','finalize','close','existsSync','%s.zip','info','Download\x20completed','Temporary\x20file\x20removed','file','extname','filename','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','0777','readdirSync','Invalid\x20plugin\x20structure','isFile','isDirectory','Plugin\x20manifest\x20missing','manifest.json','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','views','Invalid\x20manifest:\x20views\x20missing','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','sidebar','always','icon','icon-apps','html','test','plugins','script','create','role','userProfileId','user','UserProfileSection','autoAssociation','unlinkSync','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','delete','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','method','%s%s','headers','content-length','content-type','set','body','endsWith','statusCode','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','extract-zip','archiver','../../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','./plugin.socket','register','sendStatus','end','json','undefined','limit','count','offset','status','Content-Range','apply','reject','save','update','then','destroy','get','Plugins','UserProfileResource','name','send','index','map','Plugin','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','findAll','catch','show','params','find','download','join','root','format','basename','zip','ENOENT','error'];(function(_0x2e95f8,_0x2a6a5c){var _0x28c4c0=function(_0x10a1fe){while(--_0x10a1fe){_0x2e95f8['push'](_0x2e95f8['shift']());}};_0x28c4c0(++_0x2a6a5c);}(_0xa1ac,0xf6));var _0xca1a=function(_0xd101ca,_0x2c1c6a){_0xd101ca=_0xd101ca-0x0;var _0x568110=_0xa1ac[_0xd101ca];return _0x568110;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xca1a('0x0'));var rp=require(_0xca1a('0x1'));var moment=require(_0xca1a('0x2'));var BPromise=require(_0xca1a('0x3'));var Mustache=require(_0xca1a('0x4'));var util=require(_0xca1a('0x5'));var path=require(_0xca1a('0x6'));var sox=require('sox');var csv=require(_0xca1a('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xca1a('0x8'));var _=require(_0xca1a('0x9'));var squel=require('squel');var crypto=require(_0xca1a('0xa'));var jsforce=require(_0xca1a('0xb'));var deskjs=require(_0xca1a('0xc'));var toCsv=require('to-csv');var querystring=require(_0xca1a('0xd'));var Papa=require('papaparse');var extract=require(_0xca1a('0xe'));var rimraf=require('rimraf');var archiver=require(_0xca1a('0xf'));var Redis=require('ioredis');var authService=require(_0xca1a('0x10'));var qs=require(_0xca1a('0x11'));var as=require(_0xca1a('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xca1a('0x13'))(_0xca1a('0x14'));var utils=require(_0xca1a('0x15'));var config=require(_0xca1a('0x16'));var licenseUtil=require(_0xca1a('0x17'));var db=require(_0xca1a('0x18'))['db'];config[_0xca1a('0x19')]=_[_0xca1a('0x1a')](config[_0xca1a('0x19')],{'host':_0xca1a('0x1b'),'port':0x18eb});var socket=require(_0xca1a('0x1c'))(new Redis(config['redis']));require(_0xca1a('0x1d'))[_0xca1a('0x1e')](socket);function respondWithStatusCode(_0x470680,_0x343458){_0x343458=_0x343458||0xcc;return function(_0x156cc4){if(_0x156cc4){return _0x470680[_0xca1a('0x1f')](_0x343458);}return _0x470680['status'](_0x343458)[_0xca1a('0x20')]();};}function respondWithResult(_0x4b772f,_0x3d695c){_0x3d695c=_0x3d695c||0xc8;return function(_0x52265f){if(_0x52265f){return _0x4b772f['status'](_0x3d695c)[_0xca1a('0x21')](_0x52265f);}};}function respondWithFilteredResult(_0x54048a,_0x28e757){return function(_0x5005f0){if(_0x5005f0){var _0x248faf=typeof _0x28e757['offset']===_0xca1a('0x22')&&typeof _0x28e757[_0xca1a('0x23')]===_0xca1a('0x22');var _0x25a7f2=_0x5005f0[_0xca1a('0x24')];var _0x1a98bb=_0x248faf?0x0:_0x28e757['offset'];var _0x2b854b=_0x248faf?_0x5005f0[_0xca1a('0x24')]:_0x28e757[_0xca1a('0x25')]+_0x28e757[_0xca1a('0x23')];var _0x589bf7;if(_0x2b854b>=_0x25a7f2){_0x2b854b=_0x25a7f2;_0x589bf7=0xc8;}else{_0x589bf7=0xce;}_0x54048a[_0xca1a('0x26')](_0x589bf7);return _0x54048a['set'](_0xca1a('0x27'),_0x1a98bb+'-'+_0x2b854b+'/'+_0x25a7f2)[_0xca1a('0x21')](_0x5005f0);}return null;};}function patchUpdates(_0x42d2b2){return function(_0x5cc6a1){try{jsonpatch[_0xca1a('0x28')](_0x5cc6a1,_0x42d2b2,!![]);}catch(_0x2d0cab){return BPromise[_0xca1a('0x29')](_0x2d0cab);}return _0x5cc6a1[_0xca1a('0x2a')]();};}function saveUpdates(_0x15b2f0,_0x4f861c){return function(_0x5d7a72){if(_0x5d7a72){return _0x5d7a72[_0xca1a('0x2b')](_0x15b2f0)[_0xca1a('0x2c')](function(_0x576eb0){return _0x576eb0;});}return null;};}function removeEntity(_0x3693b5,_0x2b63fc){return function(_0x34af6a){if(_0x34af6a){return _0x34af6a[_0xca1a('0x2d')]()['then'](function(){var _0x113a4d=_0x34af6a[_0xca1a('0x2e')]({'plain':!![]});var _0x4f5523=_0xca1a('0x2f');return db[_0xca1a('0x30')][_0xca1a('0x2d')]({'where':{'type':_0x4f5523,'resourceId':_0x113a4d['id']}})[_0xca1a('0x2c')](function(){return _0x34af6a;});})[_0xca1a('0x2c')](function(){_0x3693b5[_0xca1a('0x26')](0xcc)[_0xca1a('0x20')]();});}};}function handleEntityNotFound(_0x306fd3,_0x2eba0a){return function(_0x3fa781){if(!_0x3fa781){_0x306fd3[_0xca1a('0x1f')](0x194);}return _0x3fa781;};}function handleError(_0x12bb4e,_0x12920a){_0x12920a=_0x12920a||0x1f4;return function(_0x311263){logger['error'](_0x311263['stack']);if(_0x311263[_0xca1a('0x31')]){delete _0x311263[_0xca1a('0x31')];}_0x12bb4e[_0xca1a('0x26')](_0x12920a)[_0xca1a('0x32')](_0x311263);};}exports[_0xca1a('0x33')]=function(_0x814f61,_0x327c10){var _0x59c389={},_0x5a8108={},_0x1d0204={'count':0x0,'rows':[]};var _0x325322=_[_0xca1a('0x34')](db[_0xca1a('0x35')][_0xca1a('0x36')],function(_0x5013bf){return{'name':_0x5013bf[_0xca1a('0x37')],'type':_0x5013bf[_0xca1a('0x38')][_0xca1a('0x39')]};});_0x5a8108[_0xca1a('0x3a')]=_[_0xca1a('0x34')](_0x325322,'name');_0x5a8108['query']=_[_0xca1a('0x3b')](_0x814f61[_0xca1a('0x3c')]);_0x5a8108[_0xca1a('0x3d')]=_[_0xca1a('0x3e')](_0x5a8108[_0xca1a('0x3a')],_0x5a8108[_0xca1a('0x3c')]);_0x59c389[_0xca1a('0x3f')]=_[_0xca1a('0x3e')](_0x5a8108[_0xca1a('0x3a')],qs['fields'](_0x814f61['query'][_0xca1a('0x40')]));_0x59c389[_0xca1a('0x3f')]=_0x59c389[_0xca1a('0x3f')][_0xca1a('0x41')]?_0x59c389[_0xca1a('0x3f')]:_0x5a8108[_0xca1a('0x3a')];if(!_0x814f61[_0xca1a('0x3c')]['hasOwnProperty'](_0xca1a('0x42'))){_0x59c389['limit']=qs[_0xca1a('0x23')](_0x814f61['query'][_0xca1a('0x23')]);_0x59c389[_0xca1a('0x25')]=qs['offset'](_0x814f61[_0xca1a('0x3c')][_0xca1a('0x25')]);}_0x59c389[_0xca1a('0x43')]=qs[_0xca1a('0x44')](_0x814f61[_0xca1a('0x3c')]['sort']);_0x59c389[_0xca1a('0x45')]=qs[_0xca1a('0x3d')](_[_0xca1a('0x46')](_0x814f61[_0xca1a('0x3c')],_0x5a8108[_0xca1a('0x3d')]),_0x325322);if(_0x814f61[_0xca1a('0x3c')][_0xca1a('0x47')]){_0x59c389[_0xca1a('0x45')]=_[_0xca1a('0x48')](_0x59c389[_0xca1a('0x45')],{'$or':_[_0xca1a('0x34')](_0x325322,function(_0x17d9b5){if(_0x17d9b5[_0xca1a('0x38')]!==_0xca1a('0x49')){var _0x57d001={};_0x57d001[_0x17d9b5[_0xca1a('0x31')]]={'$like':'%'+_0x814f61[_0xca1a('0x3c')][_0xca1a('0x47')]+'%'};return _0x57d001;}})});}_0x59c389=_[_0xca1a('0x48')]({},_0x59c389,_0x814f61[_0xca1a('0x4a')]);var _0x5df9c8={'where':_0x59c389[_0xca1a('0x45')]};return db[_0xca1a('0x35')][_0xca1a('0x24')](_0x5df9c8)['then'](function(_0x26ca3c){_0x1d0204[_0xca1a('0x24')]=_0x26ca3c;if(_0x814f61[_0xca1a('0x3c')]['includeAll']){_0x59c389['include']=[{'all':!![]}];}return db[_0xca1a('0x35')][_0xca1a('0x4b')](_0x59c389);})[_0xca1a('0x2c')](function(_0x30451e){_0x1d0204['rows']=_0x30451e;return _0x1d0204;})['then'](respondWithFilteredResult(_0x327c10,_0x59c389))[_0xca1a('0x4c')](handleError(_0x327c10,null));};exports[_0xca1a('0x4d')]=function(_0x59dd41,_0x48c78f){var _0x12282d={'raw':!![],'where':{'id':_0x59dd41[_0xca1a('0x4e')]['id']}},_0x4e338d={};_0x4e338d['model']=_['keys'](db[_0xca1a('0x35')][_0xca1a('0x36')]);_0x4e338d['query']=_[_0xca1a('0x3b')](_0x59dd41[_0xca1a('0x3c')]);_0x4e338d[_0xca1a('0x3d')]=_[_0xca1a('0x3e')](_0x4e338d[_0xca1a('0x3a')],_0x4e338d[_0xca1a('0x3c')]);_0x12282d['attributes']=_[_0xca1a('0x3e')](_0x4e338d[_0xca1a('0x3a')],qs[_0xca1a('0x40')](_0x59dd41[_0xca1a('0x3c')][_0xca1a('0x40')]));_0x12282d[_0xca1a('0x3f')]=_0x12282d[_0xca1a('0x3f')][_0xca1a('0x41')]?_0x12282d[_0xca1a('0x3f')]:_0x4e338d[_0xca1a('0x3a')];if(_0x59dd41[_0xca1a('0x3c')]['includeAll']){_0x12282d['include']=[{'all':!![]}];}_0x12282d=_[_0xca1a('0x48')]({},_0x12282d,_0x59dd41['options']);return db[_0xca1a('0x35')][_0xca1a('0x4f')](_0x12282d)['then'](handleEntityNotFound(_0x48c78f,null))['then'](respondWithResult(_0x48c78f,null))['catch'](handleError(_0x48c78f,null));};exports[_0xca1a('0x50')]=function(_0x49b244,_0x594341,_0x22ac3f){return db[_0xca1a('0x35')][_0xca1a('0x4f')]({'where':{'id':_0x49b244['params']['id']},'attributes':['name',_0xca1a('0x6')],'raw':!![]})[_0xca1a('0x2c')](handleEntityNotFound(_0x594341,null))[_0xca1a('0x2c')](function(_0x4d0bc6){if(_0x4d0bc6){var _0x3e8a46=path[_0xca1a('0x51')](config[_0xca1a('0x52')],'server/files/plugins',util[_0xca1a('0x53')]('%s.zip',path[_0xca1a('0x54')](_0x4d0bc6[_0xca1a('0x6')])));var _0x5a9c5a=fs['createWriteStream'](_0x3e8a46);var _0x3c6101=archiver(_0xca1a('0x55'),{'zlib':{'level':0x9}});_0x3c6101['on']('warning',function(_0x22d86c){if(_0x22d86c['code']===_0xca1a('0x56')){logger[_0xca1a('0x57')](_0x22d86c);}else{throw new db[(_0xca1a('0x58'))][(_0xca1a('0x59'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');}});_0x3c6101['on']('error',function(_0x50d2b4){throw new db[(_0xca1a('0x58'))][(_0xca1a('0x59'))](_0xca1a('0x5a'));});_0x3c6101[_0xca1a('0x5b')](_0x5a9c5a);_0x3c6101[_0xca1a('0x5c')](_0xca1a('0x5d'),{'cwd':path[_0xca1a('0x51')](config[_0xca1a('0x52')],_0xca1a('0x5e'),path[_0xca1a('0x5f')](_0x4d0bc6[_0xca1a('0x6')])),'ignore':[path[_0xca1a('0x51')](path[_0xca1a('0x54')](_0x4d0bc6[_0xca1a('0x6')]),_0xca1a('0x60')),path[_0xca1a('0x51')](path[_0xca1a('0x54')](_0x4d0bc6[_0xca1a('0x6')]),_0xca1a('0x61'))],'nodir':!![]})[_0xca1a('0x62')]();_0x5a9c5a['on'](_0xca1a('0x63'),function(){if(!fs[_0xca1a('0x64')](_0x3e8a46)){throw new db[(_0xca1a('0x58'))]['Error']('Plugin\x20not\x20found');}return _0x594341[_0xca1a('0x50')](_0x3e8a46,util[_0xca1a('0x53')](_0xca1a('0x65'),path[_0xca1a('0x54')](_0x4d0bc6[_0xca1a('0x6')])),function(_0x38d6f6){if(_0x38d6f6){throw new db[(_0xca1a('0x58'))][(_0xca1a('0x59'))]('Error\x20while\x20downloading\x20the\x20plugin');}fs['unlinkSync'](_0x3e8a46);logger[_0xca1a('0x66')](_0xca1a('0x67'));logger[_0xca1a('0x66')](_0xca1a('0x68'));});});}return null;})['catch'](handleError(_0x594341,null));};exports['upload']=function(_0x4bb245,_0x202496,_0x11d929){var _0x9f4bc7=path[_0xca1a('0x54')](_0x4bb245[_0xca1a('0x69')]['filename'],path[_0xca1a('0x6a')](_0x4bb245[_0xca1a('0x69')][_0xca1a('0x6b')]));var _0x423fd8=path['join'](config[_0xca1a('0x52')],_0xca1a('0x5e'),_0x4bb245[_0xca1a('0x69')]['filename']);var _0x3554f3=path['join'](config[_0xca1a('0x52')],_0xca1a('0x5e'),_0x9f4bc7);logger[_0xca1a('0x66')](_0xca1a('0x6c'),_0x423fd8);logger['info'](_0xca1a('0x6d'),_0x3554f3);try{fs['chmodSync'](_0x423fd8,parseInt(_0xca1a('0x6e'),0x8));extract(_0x423fd8,{'dir':_0x3554f3},function(_0x19b1ac){if(_0x19b1ac){logger[_0xca1a('0x57')](_0x19b1ac);handleError(_0x19b1ac,!![]);};var _0x29485c=fs[_0xca1a('0x6f')](_0x3554f3);if(_0x29485c[_0xca1a('0x41')]>0x1){removeReferences(_0x423fd8,_0x3554f3);logger[_0xca1a('0x57')](_0xca1a('0x70'));return _0x11d929(new Error('Invalid\x20plugin\x20structure'));}var _0x4bd26c=fs['lstatSync'](path[_0xca1a('0x51')](_0x3554f3,_0x29485c[0x0]));if(_0x4bd26c[_0xca1a('0x71')]()){removeReferences(_0x423fd8,_0x3554f3);logger[_0xca1a('0x57')](_0xca1a('0x70'));return _0x11d929(new Error('Invalid\x20plugin\x20structure'));}if(_0x4bd26c[_0xca1a('0x72')]()){var _0x5dd24f=fs['readdirSync'](path[_0xca1a('0x51')](_0x3554f3,_0x29485c[0x0]));if(_0x5dd24f[_0xca1a('0x41')]===0x0){removeReferences(_0x423fd8,_0x3554f3);logger[_0xca1a('0x57')](_0xca1a('0x70'));return _0x11d929(new Error('Invalid\x20plugin\x20structure'));}var _0x5392ef=_0x5dd24f['some'](function(_0x1d1f5f){return _0x1d1f5f==='manifest.json';});if(!_0x5392ef){return _0x11d929(new Error(_0xca1a('0x73')));}var _0x79395a=fs['readFileSync'](path[_0xca1a('0x51')](_0x3554f3,_0x29485c[0x0],_0xca1a('0x74')));var _0x339145=JSON['parse'](_0x79395a);if(_0xca1a('0x22')==typeof _0x339145[_0xca1a('0x31')]){return _0x11d929(new Error(_0xca1a('0x75')));}if(_0xca1a('0x22')==typeof _0x339145[_0xca1a('0x38')]){return _0x11d929(new Error(_0xca1a('0x76')));}if(_0xca1a('0x22')==typeof _0x339145[_0xca1a('0x77')]){return _0x11d929(new Error(_0xca1a('0x78')));}if(_0xca1a('0x22')==typeof _0x339145[_0xca1a('0x79')]){return _0x11d929(new Error(_0xca1a('0x7a')));}if(_0x339145['type']==='html'){if(_0xca1a('0x22')==typeof _0x339145['parameters'][_0xca1a('0x7b')]){return _0x11d929(new Error(_0xca1a('0x7c')));}if(_0xca1a('0x22')==typeof _0x339145[_0xca1a('0x79')][_0xca1a('0x7b')][_0xca1a('0x7d')]&&_0xca1a('0x22')==typeof _0x339145[_0xca1a('0x79')][_0xca1a('0x7b')][_0xca1a('0x7e')]){return _0x11d929(new Error(_0xca1a('0x7f')));}}else if(_0x339145[_0xca1a('0x38')]==='script'){if(_0xca1a('0x22')==typeof _0x339145[_0xca1a('0x79')][_0xca1a('0x80')]){return _0x11d929(new Error(_0xca1a('0x81')));}if('undefined'==typeof _0x339145[_0xca1a('0x79')][_0xca1a('0x82')]){return _0x11d929(new Error(_0xca1a('0x83')));}}else{return _0x11d929(new Error('Invalid\x20manifest:\x20invalid\x20type'));}var _0x5ce316=_0x339145[_0xca1a('0x31')];var _0xac6262=_0x339145['description'];var _0x132340=_0x339145['type'];var _0x1e5559=_0x339145[_0xca1a('0x84')]?_0x339145[_0xca1a('0x84')]:_0xca1a('0x85');var _0x21b510=_0x339145[_0xca1a('0x86')]?_0x339145['icon']:_0xca1a('0x87');var _0x3a3154='';var _0x41d8c3='';var _0x294cfa='';var _0x5605a1='';var _0x4ff9cb=_0x339145[_0xca1a('0x77')];if(_0x132340===_0xca1a('0x88')){if(_0xca1a('0x22')!=typeof _0x339145[_0xca1a('0x79')][_0xca1a('0x7b')][_0xca1a('0x7d')]){var _0x8a0c2d=_0x339145[_0xca1a('0x79')]['views'][_0xca1a('0x7d')];if(!/^(f|ht)tps?:\/\//i[_0xca1a('0x89')](_0x8a0c2d)){_0x3a3154=path[_0xca1a('0x51')]('plugins',_0x9f4bc7,_0x29485c[0x0],_0x8a0c2d);}else{_0x3a3154=_0x8a0c2d;}}else{logger[_0xca1a('0x66')]('Warning:\x20admin\x20view\x20not\x20specified');}if(_0xca1a('0x22')!=typeof _0x339145[_0xca1a('0x79')]['views'][_0xca1a('0x7e')]){var _0x392f43=_0x339145[_0xca1a('0x79')]['views'][_0xca1a('0x7e')];if(!/^(f|ht)tps?:\/\//i['test'](_0x392f43)){_0x41d8c3=path['join'](_0xca1a('0x8a'),_0x9f4bc7,_0x29485c[0x0],_0x392f43);}else{_0x41d8c3=_0x392f43;}}else{logger[_0xca1a('0x66')]('Warning:\x20agent\x20view\x20not\x20specified');}}else if(_0x132340===_0xca1a('0x8b')){_0x294cfa=_0x339145[_0xca1a('0x79')]['scriptName'];_0x5605a1=_0x339145['parameters'][_0xca1a('0x82')];if('undefined'!=typeof _0x339145[_0xca1a('0x79')][_0xca1a('0x7b')]){if('undefined'!=typeof _0x339145[_0xca1a('0x79')][_0xca1a('0x7b')][_0xca1a('0x7d')]){var _0x8a0c2d=_0x339145[_0xca1a('0x79')][_0xca1a('0x7b')][_0xca1a('0x7d')];if(!/^(f|ht)tps?:\/\//i[_0xca1a('0x89')](_0x8a0c2d)){_0x3a3154=path[_0xca1a('0x51')](_0xca1a('0x8a'),_0x9f4bc7,_0x29485c[0x0],_0x8a0c2d);}else{_0x3a3154=_0x8a0c2d;}}if(_0xca1a('0x22')!=typeof _0x339145['parameters'][_0xca1a('0x7b')][_0xca1a('0x7e')]){var _0x392f43=_0x339145[_0xca1a('0x79')][_0xca1a('0x7b')][_0xca1a('0x7e')];if(!/^(f|ht)tps?:\/\//i['test'](_0x392f43)){_0x41d8c3=path['join'](_0xca1a('0x8a'),_0x9f4bc7,_0x29485c[0x0],_0x392f43);}else{_0x41d8c3=_0x392f43;}}}}var _0x210885={'name':_0x5ce316,'description':_0xac6262,'path':path['join'](_0x9f4bc7,_0x29485c[0x0]),'type':_0x132340,'sidebar':_0x1e5559,'icon':_0x21b510,'adminUrl':_0x3a3154,'agentUrl':_0x41d8c3,'scriptName':_0x294cfa,'scriptPath':_0x5605a1,'version':_0x4ff9cb};removeReferences(_0x423fd8,null);return db[_0xca1a('0x35')][_0xca1a('0x8c')](_0x210885)[_0xca1a('0x2c')](function(_0x382935){var _0x17b336={'role':_0x4bb245['body'][_0xca1a('0x8d')],'userProfileId':_0x4bb245['body'][_0xca1a('0x8e')]};if(!_0x17b336)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x17b336[_0xca1a('0x8d')]===_0xca1a('0x8f')){var _0xae11ac=_0x382935[_0xca1a('0x2e')]({'plain':!![]});return db[_0xca1a('0x90')][_0xca1a('0x4f')]({'where':{'name':'Plugins','userProfileId':_0x17b336[_0xca1a('0x8e')]},'raw':!![]})[_0xca1a('0x2c')](function(_0xc07206){if(_0xc07206&&_0xc07206[_0xca1a('0x91')]===0x0){return db['UserProfileResource']['create']({'name':_0xae11ac[_0xca1a('0x31')],'resourceId':_0xae11ac['id'],'type':_0xc07206[_0xca1a('0x31')],'sectionId':_0xc07206['id']},{})[_0xca1a('0x2c')](function(){return _0x382935;});}else{return _0x382935;}})['catch'](function(_0x3232de){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3232de);throw _0x3232de;});}return _0x382935;})[_0xca1a('0x2c')](respondWithResult(_0x202496,null))[_0xca1a('0x4c')](handleError(_0x202496,null));}});}catch(_0x11b16c){_0x202496[_0xca1a('0x26')](0x1f4)[_0xca1a('0x32')](_0x11b16c);}};function removeReferences(_0x3e496a,_0x515802){try{if(_0x3e496a){fs[_0xca1a('0x92')](_0x3e496a);logger[_0xca1a('0x66')](_0xca1a('0x93'));}if(_0x515802){rimraf(_0x515802,function(){});logger[_0xca1a('0x66')](_0xca1a('0x94'));}}catch(_0xa00601){logger[_0xca1a('0x57')](_0xa00601);}}exports[_0xca1a('0x2b')]=function(_0x592ea0,_0x2fe3fa,_0x1611f0){return db[_0xca1a('0x35')][_0xca1a('0x4f')]({'where':{'id':_0x592ea0[_0xca1a('0x4e')]['id']}})[_0xca1a('0x2c')](handleEntityNotFound(_0x2fe3fa,null))[_0xca1a('0x2c')](saveUpdates(_0x592ea0['body'],null))[_0xca1a('0x2c')](respondWithResult(_0x2fe3fa,null))[_0xca1a('0x4c')](handleError(_0x2fe3fa,null));};exports[_0xca1a('0x95')]=function(_0x4f868e,_0x48d69a,_0x595432){return db[_0xca1a('0x35')][_0xca1a('0x4f')]({'where':{'id':_0x4f868e[_0xca1a('0x4e')]['id']}})[_0xca1a('0x2c')](function(_0x11493d){if(_0x11493d){return _0x11493d[_0xca1a('0x2d')]();}})[_0xca1a('0x2c')](function(_0x14314c){rimraf(path[_0xca1a('0x51')](config[_0xca1a('0x52')],_0xca1a('0x5e'),path[_0xca1a('0x5f')](_0x14314c[_0xca1a('0x6')])),function(){});return _0x14314c;})[_0xca1a('0x2c')](handleEntityNotFound(_0x48d69a,null))[_0xca1a('0x2c')](respondWithStatusCode(_0x48d69a,null))[_0xca1a('0x4c')](handleError(_0x48d69a,null));};exports[_0xca1a('0x96')]=function(_0x526225,_0x1dee17,_0x35e6a4){return BPromise[_0xca1a('0x97')]()[_0xca1a('0x2c')](function(){if(!_0x526225[_0xca1a('0x3c')][_0xca1a('0x6')]){throw new Error(_0xca1a('0x98'));}if(!_0x526225['query'][_0xca1a('0x99')]){throw new Error(_0xca1a('0x9a'));}var _0x4f349=_0x526225[_0xca1a('0x3c')][_0xca1a('0x9b')]?_0x526225[_0xca1a('0x3c')][_0xca1a('0x9b')]+':'+_0x526225[_0xca1a('0x3c')][_0xca1a('0x99')]:_0xca1a('0x9c')+_0x526225[_0xca1a('0x3c')]['port'];var _0x4ef33e=_0x526225[_0xca1a('0x3c')]['json']?_0x526225[_0xca1a('0x3c')][_0xca1a('0x21')]:!![];var _0x5ead80=_0x526225['query'][_0xca1a('0x9d')]?_0x526225[_0xca1a('0x3c')][_0xca1a('0x9d')]:null;var _0x1799c6={'method':_0x526225[_0xca1a('0x9e')],'uri':util['format'](_0xca1a('0x9f'),_0x4f349,_0x526225[_0xca1a('0x3c')][_0xca1a('0x6')]),'json':_0x4ef33e,'resolveWithFullResponse':!![],'encoding':_0x5ead80,'qs':_0x526225['query']};if(_0x526225['headers']){_0x1799c6[_0xca1a('0xa0')]=_0x526225[_0xca1a('0xa0')];if(_0x1799c6['headers']['content-length']){delete _0x1799c6[_0xca1a('0xa0')][_0xca1a('0xa1')];}}if(_0x1799c6['headers'][_0xca1a('0xa2')]){delete _0x1799c6[_0xca1a('0xa0')][_0xca1a('0xa2')];}return rp(_0x1799c6);})['then'](function(_0x155b6d){if(_0x155b6d){_0x1dee17[_0xca1a('0xa3')](_0x155b6d[_0xca1a('0xa0')]);logger[_0xca1a('0x66')](_0x155b6d[_0xca1a('0xa4')]);if(_[_0xca1a('0xa5')](_0x526225[_0xca1a('0x3c')]['path'],_0xca1a('0x50'))&&_0x155b6d[_0xca1a('0xa6')]==0x1f4){return _0x1dee17[_0xca1a('0x1f')](_0x155b6d[_0xca1a('0xa6')]);}else{return _0x1dee17[_0xca1a('0x26')](_0x155b6d['statusCode'])[_0xca1a('0x32')](_0x155b6d['body']);}}else{return _0x1dee17[_0xca1a('0x1f')](0xc8);}})[_0xca1a('0x4c')](handleError(_0x1dee17,null));};exports['webhookPost']=function(_0x586d14,_0x223169,_0x39669a){return BPromise[_0xca1a('0x97')]()[_0xca1a('0x2c')](function(){if(!_0x586d14[_0xca1a('0x3c')]['path']){throw new Error(_0xca1a('0x98'));}if(!_0x586d14[_0xca1a('0x3c')]['port']){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x198d33=_0x586d14['query'][_0xca1a('0x9b')]?_0x586d14[_0xca1a('0x3c')][_0xca1a('0x9b')]+':'+_0x586d14[_0xca1a('0x3c')][_0xca1a('0x99')]:_0xca1a('0x9c')+_0x586d14[_0xca1a('0x3c')][_0xca1a('0x99')];var _0x519642=_0x586d14['query'][_0xca1a('0x21')]?_0x586d14[_0xca1a('0x3c')][_0xca1a('0x21')]:!![];var _0x21e451=_0x586d14[_0xca1a('0x3c')]['encoding']?_0x586d14['query'][_0xca1a('0x9d')]:null;var _0x413b60={'method':_0x586d14[_0xca1a('0x9e')],'uri':util[_0xca1a('0x53')]('%s%s',_0x198d33,_0x586d14[_0xca1a('0x3c')][_0xca1a('0x6')]),'json':_0x519642,'resolveWithFullResponse':!![],'encoding':_0x21e451,'body':_0x586d14['body']};if(_0x586d14[_0xca1a('0xa0')]){_0x413b60[_0xca1a('0xa0')]=_0x586d14[_0xca1a('0xa0')];if(_0x413b60[_0xca1a('0xa0')]['content-length']){delete _0x413b60[_0xca1a('0xa0')][_0xca1a('0xa1')];}}if(_0x413b60[_0xca1a('0xa0')][_0xca1a('0xa2')]){delete _0x413b60['headers'][_0xca1a('0xa2')];}return rp(_0x413b60);})['then'](function(_0x2fd490){if(_0x2fd490){_0x223169[_0xca1a('0xa3')](_0x2fd490[_0xca1a('0xa0')]);logger[_0xca1a('0x66')](_0x2fd490[_0xca1a('0xa4')]);return _0x223169[_0xca1a('0x26')](_0x2fd490[_0xca1a('0xa6')])[_0xca1a('0x32')](_0x2fd490[_0xca1a('0xa4')]);}else{return _0x223169[_0xca1a('0x1f')](0xc8);}})[_0xca1a('0x4c')](handleError(_0x223169,null));}; \ No newline at end of file +var _0xd049=['zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','extract-zip','rimraf','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','redis','localhost','./plugin.socket','sendStatus','status','end','json','offset','undefined','set','Content-Range','apply','reject','save','update','then','destroy','get','Plugins','UserProfileResource','stack','name','send','index','map','Plugin','fieldName','type','key','model','query','keys','filters','attributes','fields','length','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','rows','params','rawAttributes','intersection','find','catch','download','join','root','server/files/plugins','format','basename','createWriteStream','zip','warning','ENOENT','error','Sequelize','Error','pipe','glob','**/*','dirname','node_modules/**/*','attachments/**/*','finalize','close','Plugin\x20not\x20found','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Download\x20completed','upload','file','extname','filename','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','some','manifest.json','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','views','Invalid\x20manifest:\x20views\x20missing','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','sidebar','always','icon','icon-apps','plugins','Warning:\x20admin\x20view\x20not\x20specified','test','Warning:\x20agent\x20view\x20not\x20specified','scriptName','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','delete','port','hostname','http://localhost:','encoding','%s%s','headers','content-type','endsWith','statusCode','webhookPost','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','\x27PORT\x27\x20parameter\x20not\x20specified','method','eml-format'];(function(_0x3f43ce,_0x38bdd1){var _0x29f618=function(_0xc82263){while(--_0xc82263){_0x3f43ce['push'](_0x3f43ce['shift']());}};_0x29f618(++_0x38bdd1);}(_0xd049,0xa8));var _0x9d04=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0xd049[_0x46698a];return _0x356db0;};'use strict';var emlformat=require(_0x9d04('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9d04('0x1'));var jsonpatch=require(_0x9d04('0x2'));var rp=require('request-promise');var moment=require(_0x9d04('0x3'));var BPromise=require(_0x9d04('0x4'));var Mustache=require(_0x9d04('0x5'));var util=require(_0x9d04('0x6'));var path=require(_0x9d04('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9d04('0x8'));var _=require(_0x9d04('0x9'));var squel=require(_0x9d04('0xa'));var crypto=require(_0x9d04('0xb'));var jsforce=require(_0x9d04('0xc'));var deskjs=require(_0x9d04('0xd'));var toCsv=require(_0x9d04('0xe'));var querystring=require(_0x9d04('0xf'));var Papa=require(_0x9d04('0x10'));var extract=require(_0x9d04('0x11'));var rimraf=require(_0x9d04('0x12'));var archiver=require('archiver');var Redis=require(_0x9d04('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x9d04('0x14'));var as=require(_0x9d04('0x15'));var hardwareService=require(_0x9d04('0x16'));var logger=require(_0x9d04('0x17'))('api');var utils=require(_0x9d04('0x18'));var config=require(_0x9d04('0x19'));var licenseUtil=require(_0x9d04('0x1a'));var db=require('../../mysqldb')['db'];config[_0x9d04('0x1b')]=_['defaults'](config[_0x9d04('0x1b')],{'host':_0x9d04('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9d04('0x1b')]));require(_0x9d04('0x1d'))['register'](socket);function respondWithStatusCode(_0x2d5a11,_0x398ace){_0x398ace=_0x398ace||0xcc;return function(_0x556781){if(_0x556781){return _0x2d5a11[_0x9d04('0x1e')](_0x398ace);}return _0x2d5a11[_0x9d04('0x1f')](_0x398ace)[_0x9d04('0x20')]();};}function respondWithResult(_0x4776df,_0x4df2f4){_0x4df2f4=_0x4df2f4||0xc8;return function(_0x88d834){if(_0x88d834){return _0x4776df[_0x9d04('0x1f')](_0x4df2f4)[_0x9d04('0x21')](_0x88d834);}};}function respondWithFilteredResult(_0x1aa265,_0x51f747){return function(_0x25ae2a){if(_0x25ae2a){var _0x8bdc0=typeof _0x51f747[_0x9d04('0x22')]==='undefined'&&typeof _0x51f747['limit']===_0x9d04('0x23');var _0x373cf0=_0x25ae2a['count'];var _0x2480e6=_0x8bdc0?0x0:_0x51f747[_0x9d04('0x22')];var _0x4b4e71=_0x8bdc0?_0x25ae2a['count']:_0x51f747['offset']+_0x51f747['limit'];var _0x3720f2;if(_0x4b4e71>=_0x373cf0){_0x4b4e71=_0x373cf0;_0x3720f2=0xc8;}else{_0x3720f2=0xce;}_0x1aa265['status'](_0x3720f2);return _0x1aa265[_0x9d04('0x24')](_0x9d04('0x25'),_0x2480e6+'-'+_0x4b4e71+'/'+_0x373cf0)[_0x9d04('0x21')](_0x25ae2a);}return null;};}function patchUpdates(_0x48fbd6){return function(_0x31823c){try{jsonpatch[_0x9d04('0x26')](_0x31823c,_0x48fbd6,!![]);}catch(_0x257c45){return BPromise[_0x9d04('0x27')](_0x257c45);}return _0x31823c[_0x9d04('0x28')]();};}function saveUpdates(_0x250281,_0x4bc91e){return function(_0x21af11){if(_0x21af11){return _0x21af11[_0x9d04('0x29')](_0x250281)[_0x9d04('0x2a')](function(_0x946bf2){return _0x946bf2;});}return null;};}function removeEntity(_0x579411,_0x59df23){return function(_0x33113a){if(_0x33113a){return _0x33113a[_0x9d04('0x2b')]()[_0x9d04('0x2a')](function(){var _0x22b002=_0x33113a[_0x9d04('0x2c')]({'plain':!![]});var _0xd3b073=_0x9d04('0x2d');return db[_0x9d04('0x2e')][_0x9d04('0x2b')]({'where':{'type':_0xd3b073,'resourceId':_0x22b002['id']}})['then'](function(){return _0x33113a;});})[_0x9d04('0x2a')](function(){_0x579411['status'](0xcc)[_0x9d04('0x20')]();});}};}function handleEntityNotFound(_0x44edf3,_0x4d5443){return function(_0x45c951){if(!_0x45c951){_0x44edf3['sendStatus'](0x194);}return _0x45c951;};}function handleError(_0x27e137,_0x529ffe){_0x529ffe=_0x529ffe||0x1f4;return function(_0x181d7d){logger['error'](_0x181d7d[_0x9d04('0x2f')]);if(_0x181d7d[_0x9d04('0x30')]){delete _0x181d7d[_0x9d04('0x30')];}_0x27e137[_0x9d04('0x1f')](_0x529ffe)[_0x9d04('0x31')](_0x181d7d);};}exports[_0x9d04('0x32')]=function(_0xab932e,_0x206e29){var _0x413e45={},_0x3d1ea7={},_0x3af831={'count':0x0,'rows':[]};var _0x42fa2f=_[_0x9d04('0x33')](db[_0x9d04('0x34')]['rawAttributes'],function(_0x10355f){return{'name':_0x10355f[_0x9d04('0x35')],'type':_0x10355f[_0x9d04('0x36')][_0x9d04('0x37')]};});_0x3d1ea7[_0x9d04('0x38')]=_[_0x9d04('0x33')](_0x42fa2f,'name');_0x3d1ea7[_0x9d04('0x39')]=_[_0x9d04('0x3a')](_0xab932e[_0x9d04('0x39')]);_0x3d1ea7[_0x9d04('0x3b')]=_['intersection'](_0x3d1ea7[_0x9d04('0x38')],_0x3d1ea7['query']);_0x413e45[_0x9d04('0x3c')]=_['intersection'](_0x3d1ea7['model'],qs['fields'](_0xab932e[_0x9d04('0x39')][_0x9d04('0x3d')]));_0x413e45[_0x9d04('0x3c')]=_0x413e45[_0x9d04('0x3c')][_0x9d04('0x3e')]?_0x413e45[_0x9d04('0x3c')]:_0x3d1ea7['model'];if(!_0xab932e[_0x9d04('0x39')]['hasOwnProperty'](_0x9d04('0x3f'))){_0x413e45[_0x9d04('0x40')]=qs['limit'](_0xab932e[_0x9d04('0x39')][_0x9d04('0x40')]);_0x413e45['offset']=qs['offset'](_0xab932e[_0x9d04('0x39')][_0x9d04('0x22')]);}_0x413e45[_0x9d04('0x41')]=qs[_0x9d04('0x42')](_0xab932e[_0x9d04('0x39')][_0x9d04('0x42')]);_0x413e45[_0x9d04('0x43')]=qs[_0x9d04('0x3b')](_[_0x9d04('0x44')](_0xab932e[_0x9d04('0x39')],_0x3d1ea7['filters']),_0x42fa2f);if(_0xab932e[_0x9d04('0x39')][_0x9d04('0x45')]){_0x413e45[_0x9d04('0x43')]=_[_0x9d04('0x46')](_0x413e45[_0x9d04('0x43')],{'$or':_[_0x9d04('0x33')](_0x42fa2f,function(_0xeb4bac){if(_0xeb4bac[_0x9d04('0x36')]!==_0x9d04('0x47')){var _0x5d1bfd={};_0x5d1bfd[_0xeb4bac[_0x9d04('0x30')]]={'$like':'%'+_0xab932e[_0x9d04('0x39')][_0x9d04('0x45')]+'%'};return _0x5d1bfd;}})});}_0x413e45=_[_0x9d04('0x46')]({},_0x413e45,_0xab932e[_0x9d04('0x48')]);var _0x2d5218={'where':_0x413e45[_0x9d04('0x43')]};return db['Plugin']['count'](_0x2d5218)[_0x9d04('0x2a')](function(_0x28c42e){_0x3af831[_0x9d04('0x49')]=_0x28c42e;if(_0xab932e['query'][_0x9d04('0x4a')]){_0x413e45[_0x9d04('0x4b')]=[{'all':!![]}];}return db[_0x9d04('0x34')]['findAll'](_0x413e45);})[_0x9d04('0x2a')](function(_0x327b0a){_0x3af831[_0x9d04('0x4c')]=_0x327b0a;return _0x3af831;})['then'](respondWithFilteredResult(_0x206e29,_0x413e45))['catch'](handleError(_0x206e29,null));};exports['show']=function(_0x1804bd,_0x37f242){var _0x1fb880={'raw':!![],'where':{'id':_0x1804bd[_0x9d04('0x4d')]['id']}},_0x576e04={};_0x576e04[_0x9d04('0x38')]=_[_0x9d04('0x3a')](db[_0x9d04('0x34')][_0x9d04('0x4e')]);_0x576e04['query']=_[_0x9d04('0x3a')](_0x1804bd[_0x9d04('0x39')]);_0x576e04[_0x9d04('0x3b')]=_[_0x9d04('0x4f')](_0x576e04['model'],_0x576e04[_0x9d04('0x39')]);_0x1fb880[_0x9d04('0x3c')]=_['intersection'](_0x576e04[_0x9d04('0x38')],qs[_0x9d04('0x3d')](_0x1804bd[_0x9d04('0x39')][_0x9d04('0x3d')]));_0x1fb880[_0x9d04('0x3c')]=_0x1fb880['attributes']['length']?_0x1fb880[_0x9d04('0x3c')]:_0x576e04['model'];if(_0x1804bd[_0x9d04('0x39')]['includeAll']){_0x1fb880[_0x9d04('0x4b')]=[{'all':!![]}];}_0x1fb880=_[_0x9d04('0x46')]({},_0x1fb880,_0x1804bd['options']);return db[_0x9d04('0x34')][_0x9d04('0x50')](_0x1fb880)[_0x9d04('0x2a')](handleEntityNotFound(_0x37f242,null))[_0x9d04('0x2a')](respondWithResult(_0x37f242,null))[_0x9d04('0x51')](handleError(_0x37f242,null));};exports[_0x9d04('0x52')]=function(_0x595888,_0x5ccab2,_0x510ba8){return db['Plugin'][_0x9d04('0x50')]({'where':{'id':_0x595888[_0x9d04('0x4d')]['id']},'attributes':[_0x9d04('0x30'),_0x9d04('0x7')],'raw':!![]})['then'](handleEntityNotFound(_0x5ccab2,null))[_0x9d04('0x2a')](function(_0x305061){if(_0x305061){var _0x35048b=path[_0x9d04('0x53')](config[_0x9d04('0x54')],_0x9d04('0x55'),util[_0x9d04('0x56')]('%s.zip',path[_0x9d04('0x57')](_0x305061['path'])));var _0x40278e=fs[_0x9d04('0x58')](_0x35048b);var _0x403e32=archiver(_0x9d04('0x59'),{'zlib':{'level':0x9}});_0x403e32['on'](_0x9d04('0x5a'),function(_0xc2db2f){if(_0xc2db2f['code']===_0x9d04('0x5b')){logger[_0x9d04('0x5c')](_0xc2db2f);}else{throw new db[(_0x9d04('0x5d'))][(_0x9d04('0x5e'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');}});_0x403e32['on'](_0x9d04('0x5c'),function(_0x440841){throw new db[(_0x9d04('0x5d'))][(_0x9d04('0x5e'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');});_0x403e32[_0x9d04('0x5f')](_0x40278e);_0x403e32[_0x9d04('0x60')](_0x9d04('0x61'),{'cwd':path[_0x9d04('0x53')](config[_0x9d04('0x54')],_0x9d04('0x55'),path[_0x9d04('0x62')](_0x305061[_0x9d04('0x7')])),'ignore':[path[_0x9d04('0x53')](path['basename'](_0x305061['path']),_0x9d04('0x63')),path[_0x9d04('0x53')](path['basename'](_0x305061[_0x9d04('0x7')]),_0x9d04('0x64'))],'nodir':!![]})[_0x9d04('0x65')]();_0x40278e['on'](_0x9d04('0x66'),function(){if(!fs['existsSync'](_0x35048b)){throw new db['Sequelize']['Error'](_0x9d04('0x67'));}return _0x5ccab2[_0x9d04('0x52')](_0x35048b,util[_0x9d04('0x56')]('%s.zip',path[_0x9d04('0x57')](_0x305061[_0x9d04('0x7')])),function(_0x14f622){if(_0x14f622){throw new db['Sequelize']['Error'](_0x9d04('0x68'));}fs[_0x9d04('0x69')](_0x35048b);logger[_0x9d04('0x6a')](_0x9d04('0x6b'));logger[_0x9d04('0x6a')]('Temporary\x20file\x20removed');});});}return null;})[_0x9d04('0x51')](handleError(_0x5ccab2,null));};exports[_0x9d04('0x6c')]=function(_0x19261b,_0x364a91,_0x160308){var _0x157114=path[_0x9d04('0x57')](_0x19261b[_0x9d04('0x6d')]['filename'],path[_0x9d04('0x6e')](_0x19261b[_0x9d04('0x6d')][_0x9d04('0x6f')]));var _0x4df361=path[_0x9d04('0x53')](config['root'],_0x9d04('0x55'),_0x19261b[_0x9d04('0x6d')][_0x9d04('0x6f')]);var _0x5413b1=path['join'](config['root'],_0x9d04('0x55'),_0x157114);logger['info'](_0x9d04('0x70'),_0x4df361);logger['info'](_0x9d04('0x71'),_0x5413b1);try{fs[_0x9d04('0x72')](_0x4df361,parseInt('0777',0x8));extract(_0x4df361,{'dir':_0x5413b1},function(_0x302879){if(_0x302879){logger[_0x9d04('0x5c')](_0x302879);handleError(_0x302879,!![]);};var _0x942f0d=fs[_0x9d04('0x73')](_0x5413b1);if(_0x942f0d[_0x9d04('0x3e')]>0x1){removeReferences(_0x4df361,_0x5413b1);logger['error'](_0x9d04('0x74'));return _0x160308(new Error(_0x9d04('0x74')));}var _0x546fe9=fs[_0x9d04('0x75')](path[_0x9d04('0x53')](_0x5413b1,_0x942f0d[0x0]));if(_0x546fe9[_0x9d04('0x76')]()){removeReferences(_0x4df361,_0x5413b1);logger['error'](_0x9d04('0x74'));return _0x160308(new Error(_0x9d04('0x74')));}if(_0x546fe9[_0x9d04('0x77')]()){var _0x1cfefd=fs[_0x9d04('0x73')](path['join'](_0x5413b1,_0x942f0d[0x0]));if(_0x1cfefd[_0x9d04('0x3e')]===0x0){removeReferences(_0x4df361,_0x5413b1);logger[_0x9d04('0x5c')]('Invalid\x20plugin\x20structure');return _0x160308(new Error('Invalid\x20plugin\x20structure'));}var _0x1fc7a6=_0x1cfefd[_0x9d04('0x78')](function(_0x4bea30){return _0x4bea30==='manifest.json';});if(!_0x1fc7a6){return _0x160308(new Error('Plugin\x20manifest\x20missing'));}var _0x3d6b43=fs['readFileSync'](path[_0x9d04('0x53')](_0x5413b1,_0x942f0d[0x0],_0x9d04('0x79')));var _0x4ab725=JSON['parse'](_0x3d6b43);if(_0x9d04('0x23')==typeof _0x4ab725[_0x9d04('0x30')]){return _0x160308(new Error('Invalid\x20manifest:\x20name\x20missing'));}if(_0x9d04('0x23')==typeof _0x4ab725[_0x9d04('0x36')]){return _0x160308(new Error('Invalid\x20manifest:\x20type\x20missing'));}if(_0x9d04('0x23')==typeof _0x4ab725[_0x9d04('0x7a')]){return _0x160308(new Error(_0x9d04('0x7b')));}if(_0x9d04('0x23')==typeof _0x4ab725[_0x9d04('0x7c')]){return _0x160308(new Error(_0x9d04('0x7d')));}if(_0x4ab725['type']==='html'){if(_0x9d04('0x23')==typeof _0x4ab725[_0x9d04('0x7c')][_0x9d04('0x7e')]){return _0x160308(new Error(_0x9d04('0x7f')));}if(_0x9d04('0x23')==typeof _0x4ab725[_0x9d04('0x7c')][_0x9d04('0x7e')][_0x9d04('0x80')]&&'undefined'==typeof _0x4ab725[_0x9d04('0x7c')][_0x9d04('0x7e')][_0x9d04('0x81')]){return _0x160308(new Error(_0x9d04('0x82')));}}else if(_0x4ab725[_0x9d04('0x36')]===_0x9d04('0x83')){if(_0x9d04('0x23')==typeof _0x4ab725[_0x9d04('0x7c')]['scriptName']){return _0x160308(new Error(_0x9d04('0x84')));}if(_0x9d04('0x23')==typeof _0x4ab725['parameters'][_0x9d04('0x85')]){return _0x160308(new Error(_0x9d04('0x86')));}}else{return _0x160308(new Error(_0x9d04('0x87')));}var _0xa6c1d2=_0x4ab725[_0x9d04('0x30')];var _0x1b0e24=_0x4ab725['description'];var _0x2a9d19=_0x4ab725[_0x9d04('0x36')];var _0x2d6f86=_0x4ab725['sidebar']?_0x4ab725[_0x9d04('0x88')]:_0x9d04('0x89');var _0x17eb4c=_0x4ab725[_0x9d04('0x8a')]?_0x4ab725['icon']:_0x9d04('0x8b');var _0x25a2c7='';var _0x55b643='';var _0x4ba0ea='';var _0x2dbeaa='';var _0x5cbf96=_0x4ab725[_0x9d04('0x7a')];if(_0x2a9d19==='html'){if(_0x9d04('0x23')!=typeof _0x4ab725['parameters']['views'][_0x9d04('0x80')]){var _0x566a0c=_0x4ab725[_0x9d04('0x7c')]['views'][_0x9d04('0x80')];if(!/^(f|ht)tps?:\/\//i['test'](_0x566a0c)){_0x25a2c7=path[_0x9d04('0x53')](_0x9d04('0x8c'),_0x157114,_0x942f0d[0x0],_0x566a0c);}else{_0x25a2c7=_0x566a0c;}}else{logger['info'](_0x9d04('0x8d'));}if(_0x9d04('0x23')!=typeof _0x4ab725[_0x9d04('0x7c')]['views'][_0x9d04('0x81')]){var _0x58faea=_0x4ab725['parameters']['views']['agent'];if(!/^(f|ht)tps?:\/\//i[_0x9d04('0x8e')](_0x58faea)){_0x55b643=path[_0x9d04('0x53')](_0x9d04('0x8c'),_0x157114,_0x942f0d[0x0],_0x58faea);}else{_0x55b643=_0x58faea;}}else{logger['info'](_0x9d04('0x8f'));}}else if(_0x2a9d19===_0x9d04('0x83')){_0x4ba0ea=_0x4ab725['parameters'][_0x9d04('0x90')];_0x2dbeaa=_0x4ab725[_0x9d04('0x7c')][_0x9d04('0x85')];if('undefined'!=typeof _0x4ab725['parameters'][_0x9d04('0x7e')]){if(_0x9d04('0x23')!=typeof _0x4ab725['parameters']['views'][_0x9d04('0x80')]){var _0x566a0c=_0x4ab725['parameters']['views']['admin'];if(!/^(f|ht)tps?:\/\//i[_0x9d04('0x8e')](_0x566a0c)){_0x25a2c7=path[_0x9d04('0x53')]('plugins',_0x157114,_0x942f0d[0x0],_0x566a0c);}else{_0x25a2c7=_0x566a0c;}}if(_0x9d04('0x23')!=typeof _0x4ab725[_0x9d04('0x7c')]['views'][_0x9d04('0x81')]){var _0x58faea=_0x4ab725[_0x9d04('0x7c')][_0x9d04('0x7e')][_0x9d04('0x81')];if(!/^(f|ht)tps?:\/\//i[_0x9d04('0x8e')](_0x58faea)){_0x55b643=path[_0x9d04('0x53')](_0x9d04('0x8c'),_0x157114,_0x942f0d[0x0],_0x58faea);}else{_0x55b643=_0x58faea;}}}}var _0x1a7943={'name':_0xa6c1d2,'description':_0x1b0e24,'path':path[_0x9d04('0x53')](_0x157114,_0x942f0d[0x0]),'type':_0x2a9d19,'sidebar':_0x2d6f86,'icon':_0x17eb4c,'adminUrl':_0x25a2c7,'agentUrl':_0x55b643,'scriptName':_0x4ba0ea,'scriptPath':_0x2dbeaa,'version':_0x5cbf96};removeReferences(_0x4df361,null);return db['Plugin']['create'](_0x1a7943)['then'](function(_0x94784a){var _0x44e78a={'role':_0x19261b[_0x9d04('0x91')]['role'],'userProfileId':_0x19261b[_0x9d04('0x91')][_0x9d04('0x92')]};if(!_0x44e78a)throw new Error(_0x9d04('0x93'));if(_0x44e78a[_0x9d04('0x94')]===_0x9d04('0x95')){var _0x455d17=_0x94784a[_0x9d04('0x2c')]({'plain':!![]});return db[_0x9d04('0x96')]['find']({'where':{'name':_0x9d04('0x2d'),'userProfileId':_0x44e78a[_0x9d04('0x92')]},'raw':!![]})['then'](function(_0x2c28f8){if(_0x2c28f8&&_0x2c28f8[_0x9d04('0x97')]===0x0){return db[_0x9d04('0x2e')][_0x9d04('0x98')]({'name':_0x455d17[_0x9d04('0x30')],'resourceId':_0x455d17['id'],'type':_0x2c28f8[_0x9d04('0x30')],'sectionId':_0x2c28f8['id']},{})[_0x9d04('0x2a')](function(){return _0x94784a;});}else{return _0x94784a;}})[_0x9d04('0x51')](function(_0x39f2dc){logger['error'](_0x9d04('0x99'),_0x39f2dc);throw _0x39f2dc;});}return _0x94784a;})[_0x9d04('0x2a')](respondWithResult(_0x364a91,null))[_0x9d04('0x51')](handleError(_0x364a91,null));}});}catch(_0x2e3f27){_0x364a91[_0x9d04('0x1f')](0x1f4)[_0x9d04('0x31')](_0x2e3f27);}};function removeReferences(_0x48ffc1,_0x110c97){try{if(_0x48ffc1){fs[_0x9d04('0x69')](_0x48ffc1);logger[_0x9d04('0x6a')]('Zip\x20archive\x20removed');}if(_0x110c97){rimraf(_0x110c97,function(){});logger['info']('Extracted\x20folder\x20removed');}}catch(_0x110ad3){logger['error'](_0x110ad3);}}exports['update']=function(_0x37e43d,_0x461d79,_0x49b1a5){return db['Plugin'][_0x9d04('0x50')]({'where':{'id':_0x37e43d[_0x9d04('0x4d')]['id']}})['then'](handleEntityNotFound(_0x461d79,null))[_0x9d04('0x2a')](saveUpdates(_0x37e43d[_0x9d04('0x91')],null))['then'](respondWithResult(_0x461d79,null))[_0x9d04('0x51')](handleError(_0x461d79,null));};exports[_0x9d04('0x9a')]=function(_0x4b597f,_0x161c7d,_0x5df6f9){return db['Plugin'][_0x9d04('0x50')]({'where':{'id':_0x4b597f[_0x9d04('0x4d')]['id']}})[_0x9d04('0x2a')](function(_0x53e40d){if(_0x53e40d){return _0x53e40d[_0x9d04('0x2b')]();}})[_0x9d04('0x2a')](function(_0x4282ad){rimraf(path[_0x9d04('0x53')](config[_0x9d04('0x54')],_0x9d04('0x55'),path['dirname'](_0x4282ad[_0x9d04('0x7')])),function(){});return _0x4282ad;})[_0x9d04('0x2a')](handleEntityNotFound(_0x161c7d,null))[_0x9d04('0x2a')](respondWithStatusCode(_0x161c7d,null))['catch'](handleError(_0x161c7d,null));};exports['webhookGet']=function(_0x2c9f36,_0x5b1aa7,_0x4b0a05){return BPromise['resolve']()[_0x9d04('0x2a')](function(){if(!_0x2c9f36[_0x9d04('0x39')][_0x9d04('0x7')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x2c9f36[_0x9d04('0x39')][_0x9d04('0x9b')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x554e4e=_0x2c9f36['query'][_0x9d04('0x9c')]?_0x2c9f36['query'][_0x9d04('0x9c')]+':'+_0x2c9f36[_0x9d04('0x39')][_0x9d04('0x9b')]:_0x9d04('0x9d')+_0x2c9f36[_0x9d04('0x39')]['port'];var _0x19f735=_0x2c9f36[_0x9d04('0x39')][_0x9d04('0x21')]?_0x2c9f36[_0x9d04('0x39')][_0x9d04('0x21')]:!![];var _0x464adf=_0x2c9f36['query']['encoding']?_0x2c9f36[_0x9d04('0x39')][_0x9d04('0x9e')]:null;var _0x145db2={'method':_0x2c9f36['method'],'uri':util['format'](_0x9d04('0x9f'),_0x554e4e,_0x2c9f36['query'][_0x9d04('0x7')]),'json':_0x19f735,'resolveWithFullResponse':!![],'encoding':_0x464adf,'qs':_0x2c9f36[_0x9d04('0x39')]};if(_0x2c9f36[_0x9d04('0xa0')]){_0x145db2[_0x9d04('0xa0')]=_0x2c9f36[_0x9d04('0xa0')];if(_0x145db2[_0x9d04('0xa0')]['content-length']){delete _0x145db2['headers']['content-length'];}}if(_0x145db2[_0x9d04('0xa0')][_0x9d04('0xa1')]){delete _0x145db2[_0x9d04('0xa0')]['content-type'];}return rp(_0x145db2);})[_0x9d04('0x2a')](function(_0x42b731){if(_0x42b731){_0x5b1aa7[_0x9d04('0x24')](_0x42b731[_0x9d04('0xa0')]);logger[_0x9d04('0x6a')](_0x42b731[_0x9d04('0x91')]);if(_[_0x9d04('0xa2')](_0x2c9f36[_0x9d04('0x39')][_0x9d04('0x7')],_0x9d04('0x52'))&&_0x42b731[_0x9d04('0xa3')]==0x1f4){return _0x5b1aa7[_0x9d04('0x1e')](_0x42b731[_0x9d04('0xa3')]);}else{return _0x5b1aa7['status'](_0x42b731[_0x9d04('0xa3')])['send'](_0x42b731[_0x9d04('0x91')]);}}else{return _0x5b1aa7[_0x9d04('0x1e')](0xc8);}})[_0x9d04('0x51')](handleError(_0x5b1aa7,null));};exports[_0x9d04('0xa4')]=function(_0xbbec0f,_0x54bd12,_0x3bd867){return BPromise[_0x9d04('0xa5')]()[_0x9d04('0x2a')](function(){if(!_0xbbec0f[_0x9d04('0x39')][_0x9d04('0x7')]){throw new Error(_0x9d04('0xa6'));}if(!_0xbbec0f['query'][_0x9d04('0x9b')]){throw new Error(_0x9d04('0xa7'));}var _0x1082b7=_0xbbec0f[_0x9d04('0x39')]['hostname']?_0xbbec0f[_0x9d04('0x39')]['hostname']+':'+_0xbbec0f[_0x9d04('0x39')]['port']:_0x9d04('0x9d')+_0xbbec0f[_0x9d04('0x39')]['port'];var _0x39551a=_0xbbec0f['query'][_0x9d04('0x21')]?_0xbbec0f[_0x9d04('0x39')]['json']:!![];var _0x324524=_0xbbec0f[_0x9d04('0x39')][_0x9d04('0x9e')]?_0xbbec0f['query']['encoding']:null;var _0x295478={'method':_0xbbec0f[_0x9d04('0xa8')],'uri':util[_0x9d04('0x56')](_0x9d04('0x9f'),_0x1082b7,_0xbbec0f[_0x9d04('0x39')]['path']),'json':_0x39551a,'resolveWithFullResponse':!![],'encoding':_0x324524,'body':_0xbbec0f[_0x9d04('0x91')]};if(_0xbbec0f['headers']){_0x295478[_0x9d04('0xa0')]=_0xbbec0f[_0x9d04('0xa0')];if(_0x295478['headers']['content-length']){delete _0x295478[_0x9d04('0xa0')]['content-length'];}}if(_0x295478['headers'][_0x9d04('0xa1')]){delete _0x295478[_0x9d04('0xa0')][_0x9d04('0xa1')];}return rp(_0x295478);})[_0x9d04('0x2a')](function(_0x371711){if(_0x371711){_0x54bd12[_0x9d04('0x24')](_0x371711[_0x9d04('0xa0')]);logger['info'](_0x371711['body']);return _0x54bd12[_0x9d04('0x1f')](_0x371711[_0x9d04('0xa3')])[_0x9d04('0x31')](_0x371711[_0x9d04('0x91')]);}else{return _0x54bd12[_0x9d04('0x1e')](0xc8);}})[_0x9d04('0x51')](handleError(_0x54bd12,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index 55dacd2..40e3742 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 _0x4af9=['hasOwnProperty','hook','exports','events','../../mysqldb','save','update','remove','emit'];(function(_0x1ccc24,_0x4115cb){var _0x2684c3=function(_0x2ba13f){while(--_0x2ba13f){_0x1ccc24['push'](_0x1ccc24['shift']());}};_0x2684c3(++_0x4115cb);}(_0x4af9,0x12c));var _0x94af=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x4af9[_0x397e5f];return _0x5302b8;};'use strict';var EventEmitter=require(_0x94af('0x0'));var Plugin=require(_0x94af('0x1'))['db']['Plugin'];var PluginEvents=new EventEmitter();PluginEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x94af('0x2'),'afterUpdate':_0x94af('0x3'),'afterDestroy':_0x94af('0x4')};function emitEvent(_0x2a6642){return function(_0x1362cc,_0x14d407,_0x1a548e){PluginEvents['emit'](_0x2a6642+':'+_0x1362cc['id'],_0x1362cc);PluginEvents[_0x94af('0x5')](_0x2a6642,_0x1362cc);_0x1a548e(null);};}for(var e in events){if(events[_0x94af('0x6')](e)){var event=events[e];Plugin[_0x94af('0x7')](e,emitEvent(event));}}module[_0x94af('0x8')]=PluginEvents; \ No newline at end of file +var _0x66c7=['Plugin','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x529167,_0x426891){var _0x1adee1=function(_0x2017bb){while(--_0x2017bb){_0x529167['push'](_0x529167['shift']());}};_0x1adee1(++_0x426891);}(_0x66c7,0x15c));var _0x766c=function(_0xf82ec,_0x5a1db4){_0xf82ec=_0xf82ec-0x0;var _0x1ad7b0=_0x66c7[_0xf82ec];return _0x1ad7b0;};'use strict';var EventEmitter=require(_0x766c('0x0'));var Plugin=require(_0x766c('0x1'))['db'][_0x766c('0x2')];var PluginEvents=new EventEmitter();PluginEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x766c('0x3'),'afterUpdate':_0x766c('0x4'),'afterDestroy':_0x766c('0x5')};function emitEvent(_0x1cf5c1){return function(_0x1b2a8e,_0x2b4c75,_0x4fa5e4){PluginEvents[_0x766c('0x6')](_0x1cf5c1+':'+_0x1b2a8e['id'],_0x1b2a8e);PluginEvents[_0x766c('0x6')](_0x1cf5c1,_0x1b2a8e);_0x4fa5e4(null);};}for(var e in events){if(events[_0x766c('0x7')](e)){var event=events[e];Plugin[_0x766c('0x8')](e,emitEvent(event));}}module[_0x766c('0x9')]=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index 3fb25f1..4c50bde 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 _0x891b=['path','rimraf','./plugin.attributes','exports','plugins','lodash','util','../../config/logger','api','bluebird'];(function(_0x2c0e48,_0xe0dbb9){var _0x8b4ab6=function(_0x46660c){while(--_0x46660c){_0x2c0e48['push'](_0x2c0e48['shift']());}};_0x8b4ab6(++_0xe0dbb9);}(_0x891b,0x131));var _0xb891=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x891b[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xb891('0x0'));var util=require(_0xb891('0x1'));var logger=require(_0xb891('0x2'))(_0xb891('0x3'));var moment=require('moment');var BPromise=require(_0xb891('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb891('0x5'));var rimraf=require(_0xb891('0x6'));var config=require('../../config/environment');var attributes=require(_0xb891('0x7'));module[_0xb891('0x8')]=function(_0x2dd21a,_0x5cb1f5){return _0x2dd21a['define']('Plugin',attributes,{'tableName':_0xb891('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1e65=['request-promise','rimraf','exports','define','Plugin','plugins','lodash','util','api','moment','bluebird'];(function(_0x284b22,_0x1e0f2c){var _0x261e08=function(_0x167b12){while(--_0x167b12){_0x284b22['push'](_0x284b22['shift']());}};_0x261e08(++_0x1e0f2c);}(_0x1e65,0xed));var _0x51e6=function(_0x38b7ce,_0xc4d93){_0x38b7ce=_0x38b7ce-0x0;var _0x49b2bf=_0x1e65[_0x38b7ce];return _0x49b2bf;};'use strict';var _=require(_0x51e6('0x0'));var util=require(_0x51e6('0x1'));var logger=require('../../config/logger')(_0x51e6('0x2'));var moment=require(_0x51e6('0x3'));var BPromise=require(_0x51e6('0x4'));var rp=require(_0x51e6('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x51e6('0x6'));var config=require('../../config/environment');var attributes=require('./plugin.attributes');module[_0x51e6('0x7')]=function(_0x2ae41a,_0x2dad16){return _0x2ae41a[_0x51e6('0x8')](_0x51e6('0x9'),attributes,{'tableName':_0x51e6('0xa'),'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 617caf1..64c8e88 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 _0x5bc2=['util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','redis','defaults','localhost','socket.io-emitter','./plugin.socket','request','then','Plugin,\x20%s,\x20%s','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','CreatePlugin','create','body','options','raw','catch','lodash'];(function(_0x3e77b6,_0x4bfbf2){var _0x2598f8=function(_0x1987e8){while(--_0x1987e8){_0x3e77b6['push'](_0x3e77b6['shift']());}};_0x2598f8(++_0x4bfbf2);}(_0x5bc2,0x1bf));var _0x25bc=function(_0x500785,_0x15e5ff){_0x500785=_0x500785-0x0;var _0x1f8bcc=_0x5bc2[_0x500785];return _0x1f8bcc;};'use strict';var _=require(_0x25bc('0x0'));var util=require(_0x25bc('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x25bc('0x2'));var fs=require('fs');var Redis=require(_0x25bc('0x3'));var db=require(_0x25bc('0x4'))['db'];var utils=require(_0x25bc('0x5'));var logger=require(_0x25bc('0x6'))(_0x25bc('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x25bc('0x8')]['http']({'port':0x232a});config[_0x25bc('0x9')]=_[_0x25bc('0xa')](config[_0x25bc('0x9')],{'host':_0x25bc('0xb'),'port':0x18eb});var socket=require(_0x25bc('0xc'))(new Redis(config[_0x25bc('0x9')]));require(_0x25bc('0xd'))['register'](socket);function respondWithRpcPromise(_0x3ddcca,_0x43c041,_0x166c91){return new BPromise(function(_0x2b4527,_0x25b478){return client[_0x25bc('0xe')](_0x3ddcca,_0x166c91)[_0x25bc('0xf')](function(_0x33f090){logger['info'](_0x25bc('0x10'),_0x43c041,_0x25bc('0x11'));logger[_0x25bc('0x12')](_0x25bc('0x13'),_0x43c041,_0x25bc('0x11'),JSON[_0x25bc('0x14')](_0x33f090));if(_0x33f090[_0x25bc('0x15')]){if(_0x33f090[_0x25bc('0x15')][_0x25bc('0x16')]===0x1f4){logger['error'](_0x25bc('0x10'),_0x43c041,_0x33f090[_0x25bc('0x15')]['message']);return _0x25b478(_0x33f090['error']['message']);}logger[_0x25bc('0x15')]('Plugin,\x20%s,\x20%s',_0x43c041,_0x33f090[_0x25bc('0x15')][_0x25bc('0x17')]);return _0x2b4527(_0x33f090[_0x25bc('0x15')][_0x25bc('0x17')]);}else{logger[_0x25bc('0x18')]('Plugin,\x20%s,\x20%s',_0x43c041,_0x25bc('0x11'));_0x2b4527(_0x33f090[_0x25bc('0x19')][_0x25bc('0x17')]);}})['catch'](function(_0x4771f4){logger[_0x25bc('0x15')](_0x25bc('0x10'),_0x43c041,_0x4771f4);_0x25b478(_0x4771f4);});});}exports[_0x25bc('0x1a')]=function(_0x13b3d2){var _0x28f644=this;return new Promise(function(_0x20e4a9,_0x209141){return db['Plugin'][_0x25bc('0x1b')](_0x13b3d2[_0x25bc('0x1c')],{'raw':_0x13b3d2[_0x25bc('0x1d')]?_0x13b3d2[_0x25bc('0x1d')][_0x25bc('0x1e')]===undefined?!![]:![]:!![]})[_0x25bc('0xf')](function(_0x42984a){logger[_0x25bc('0x18')](_0x25bc('0x1a'),_0x13b3d2);logger[_0x25bc('0x12')]('CreatePlugin',_0x13b3d2,JSON[_0x25bc('0x14')](_0x42984a));_0x20e4a9(_0x42984a);})[_0x25bc('0x1f')](function(_0x21882b){logger[_0x25bc('0x15')](_0x25bc('0x1a'),_0x21882b[_0x25bc('0x17')],_0x13b3d2);_0x209141(_0x28f644['error'](0x1f4,_0x21882b['message']));});});}; \ No newline at end of file +var _0x8581=['then','info','Plugin,\x20%s,\x20%s','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','error','message','result','catch','CreatePlugin','body','options','stringify','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./plugin.socket','request'];(function(_0x3d3156,_0x4f54ac){var _0x227cac=function(_0x28956b){while(--_0x28956b){_0x3d3156['push'](_0x3d3156['shift']());}};_0x227cac(++_0x4f54ac);}(_0x8581,0x163));var _0x1858=function(_0xf5541e,_0x53a22f){_0xf5541e=_0xf5541e-0x0;var _0x3aed8e=_0x8581[_0xf5541e];return _0x3aed8e;};'use strict';var _=require('lodash');var util=require(_0x1858('0x0'));var moment=require(_0x1858('0x1'));var BPromise=require('bluebird');var rs=require(_0x1858('0x2'));var fs=require('fs');var Redis=require(_0x1858('0x3'));var db=require(_0x1858('0x4'))['db'];var utils=require(_0x1858('0x5'));var logger=require(_0x1858('0x6'))(_0x1858('0x7'));var config=require(_0x1858('0x8'));var jayson=require(_0x1858('0x9'));var client=jayson[_0x1858('0xa')][_0x1858('0xb')]({'port':0x232a});config[_0x1858('0xc')]=_[_0x1858('0xd')](config[_0x1858('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x1858('0xe'))(new Redis(config[_0x1858('0xc')]));require(_0x1858('0xf'))['register'](socket);function respondWithRpcPromise(_0x5e63a9,_0x42c6f4,_0x5e1e07){return new BPromise(function(_0x4b1577,_0x3d1566){return client[_0x1858('0x10')](_0x5e63a9,_0x5e1e07)[_0x1858('0x11')](function(_0x54399a){logger[_0x1858('0x12')](_0x1858('0x13'),_0x42c6f4,_0x1858('0x14'));logger[_0x1858('0x15')](_0x1858('0x16'),_0x42c6f4,_0x1858('0x14'),JSON['stringify'](_0x54399a));if(_0x54399a['error']){if(_0x54399a['error']['code']===0x1f4){logger['error']('Plugin,\x20%s,\x20%s',_0x42c6f4,_0x54399a[_0x1858('0x17')]['message']);return _0x3d1566(_0x54399a['error']['message']);}logger[_0x1858('0x17')](_0x1858('0x13'),_0x42c6f4,_0x54399a[_0x1858('0x17')][_0x1858('0x18')]);return _0x4b1577(_0x54399a[_0x1858('0x17')][_0x1858('0x18')]);}else{logger['info'](_0x1858('0x13'),_0x42c6f4,_0x1858('0x14'));_0x4b1577(_0x54399a[_0x1858('0x19')][_0x1858('0x18')]);}})[_0x1858('0x1a')](function(_0x4d5034){logger['error'](_0x1858('0x13'),_0x42c6f4,_0x4d5034);_0x3d1566(_0x4d5034);});});}exports[_0x1858('0x1b')]=function(_0x9ab594){var _0x2cb4f2=this;return new Promise(function(_0x699cd8,_0x52cc41){return db['Plugin']['create'](_0x9ab594[_0x1858('0x1c')],{'raw':_0x9ab594[_0x1858('0x1d')]?_0x9ab594[_0x1858('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0x1858('0x11')](function(_0x7d4486){logger[_0x1858('0x12')](_0x1858('0x1b'),_0x9ab594);logger[_0x1858('0x15')]('CreatePlugin',_0x9ab594,JSON[_0x1858('0x1e')](_0x7d4486));_0x699cd8(_0x7d4486);})[_0x1858('0x1a')](function(_0x3f3b8c){logger[_0x1858('0x17')]('CreatePlugin',_0x3f3b8c[_0x1858('0x18')],_0x9ab594);_0x52cc41(_0x2cb4f2['error'](0x1f4,_0x3f3b8c['message']));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index febe515..c2170f3 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 _0x7cca=['plugin:','./plugin.events','save','remove','update','emit','removeListener','register','length'];(function(_0x1ab180,_0x382b2c){var _0xfb2c2d=function(_0x1c5fd3){while(--_0x1c5fd3){_0x1ab180['push'](_0x1ab180['shift']());}};_0xfb2c2d(++_0x382b2c);}(_0x7cca,0xac));var _0xa7cc=function(_0x22abb4,_0x4d186a){_0x22abb4=_0x22abb4-0x0;var _0x319351=_0x7cca[_0x22abb4];return _0x319351;};'use strict';var PluginEvents=require(_0xa7cc('0x0'));var events=[_0xa7cc('0x1'),_0xa7cc('0x2'),_0xa7cc('0x3')];function createListener(_0x44eaca,_0x514334){return function(_0x228f40){_0x514334[_0xa7cc('0x4')](_0x44eaca,_0x228f40);};}function removeListener(_0x24d11d,_0x340975){return function(){PluginEvents[_0xa7cc('0x5')](_0x24d11d,_0x340975);};}exports[_0xa7cc('0x6')]=function(_0x173e85){for(var _0x39faff=0x0,_0x5e8541=events[_0xa7cc('0x7')];_0x39faff<_0x5e8541;_0x39faff++){var _0x33f066=events[_0x39faff];var _0x5d3580=createListener(_0xa7cc('0x8')+_0x33f066,_0x173e85);PluginEvents['on'](_0x33f066,_0x5d3580);}}; \ No newline at end of file +var _0x1e05=['remove','emit','register','length','./plugin.events','save'];(function(_0x1caf6a,_0x26a5bf){var _0x1bf493=function(_0x3982f5){while(--_0x3982f5){_0x1caf6a['push'](_0x1caf6a['shift']());}};_0x1bf493(++_0x26a5bf);}(_0x1e05,0x13c));var _0x51e0=function(_0x261522,_0x1adc1f){_0x261522=_0x261522-0x0;var _0x98a25a=_0x1e05[_0x261522];return _0x98a25a;};'use strict';var PluginEvents=require(_0x51e0('0x0'));var events=[_0x51e0('0x1'),_0x51e0('0x2'),'update'];function createListener(_0x861b37,_0x4d83df){return function(_0x2565c5){_0x4d83df[_0x51e0('0x3')](_0x861b37,_0x2565c5);};}function removeListener(_0x54edcc,_0x2b7c5a){return function(){PluginEvents['removeListener'](_0x54edcc,_0x2b7c5a);};}exports[_0x51e0('0x4')]=function(_0x28ef29){for(var _0x1f09ab=0x0,_0xd6f2e4=events[_0x51e0('0x5')];_0x1f09ab<_0xd6f2e4;_0x1f09ab++){var _0x3f151e=events[_0x1f09ab];var _0x3f9d6e=createListener('plugin:'+_0x3f151e,_0x28ef29);PluginEvents['on'](_0x3f151e,_0x3f9d6e);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index e4676c3..36aae5a 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(_0x27b6e3,_0x3445d1){var _0x3b2f1a=function(_0x371b01){while(--_0x371b01){_0x27b6e3['push'](_0x27b6e3['shift']());}};_0x3b2f1a(++_0x3445d1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0xa9e0[_0x38a7ac];return _0x53061a;};'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(_0x20e42c,_0x123711){var _0x2e0c81=function(_0x458a30){while(--_0x458a30){_0x20e42c['push'](_0x20e42c['shift']());}};_0x2e0c81(++_0x123711);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3e112d,_0x2bb132){_0x3e112d=_0x3e112d-0x0;var _0x531c31=_0xa9e0[_0x3e112d];return _0x531c31;};'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 0da6cf2..5e5069c 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 _0xb43b=['stack','name','send','npm\x20install','info','index','list','express','then','describe','catch','create','body','script','join','chdir','dirname','start','Missing\x20name\x20and/or\x20path','update','restart','stop','hasOwnProperty','params','Unknown\x20status','Unknown\x20id','lodash','../../config/pm2','api','path','child_process','bluebird','status','json'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xb43b,0x1b2));var _0xbb43=function(_0x7911f0,_0x107d07){_0x7911f0=_0x7911f0-0x0;var _0x5909f8=_0xb43b[_0x7911f0];return _0x5909f8;};'use strict';var _=require(_0xbb43('0x0'));var pm2=require(_0xbb43('0x1'));var logger=require('../../config/logger')(_0xbb43('0x2'));var path=require(_0xbb43('0x3'));var exec=require(_0xbb43('0x4'))['exec'];var BPromise=require(_0xbb43('0x5'));function handleEntityNotFound(_0x41aff6,_0x351254){return function(_0x16432a){if(!_0x16432a){_0x41aff6['sendStatus'](0x194);;}return _0x16432a;};}function respondWithResult(_0x491fb9,_0x378df5){_0x378df5=_0x378df5||0xc8;return function(_0x553520){if(_0x553520){return _0x491fb9[_0xbb43('0x6')](_0x378df5)[_0xbb43('0x7')](_0x553520);}return null;};}function handleError(_0x2a2f11,_0x29ae1a){_0x29ae1a=_0x29ae1a||0x1f4;return function(_0x364718){logger['error'](_0x364718[_0xbb43('0x8')]);if(_0x364718[_0xbb43('0x9')]){delete _0x364718['name'];}_0x2a2f11[_0xbb43('0x6')](_0x29ae1a)[_0xbb43('0xa')](_0x364718);};}function execChildProcess(){return new BPromise(function(_0xd37cdf,_0x5e3611){exec(_0xbb43('0xb'),function(_0x2bef86,_0x480cc2,_0x36a473){logger[_0xbb43('0xc')](_0x480cc2);logger['info'](_0x36a473);if(_0x2bef86){logger['error'](_0x2bef86);return _0x5e3611(_0x2bef86);}return _0xd37cdf(_0x480cc2);});});}exports[_0xbb43('0xd')]=function(_0x4a3714,_0x593d0b){return pm2[_0xbb43('0xe')]()['then'](function(_0x68d45d){if(_0x68d45d){var _0x43021d=_['reject'](_0x68d45d,function(_0x4a6e18){return _0x4a6e18['name']===_0xbb43('0xf')||_0x4a6e18[_0xbb43('0x9')]==='motion2';});return{'rows':_0x43021d,'count':_0x43021d['length']};}return null;})[_0xbb43('0x10')](respondWithResult(_0x593d0b,null))['catch'](handleError(_0x593d0b,null));};exports['show']=function(_0x2b0797,_0x8242ab){return pm2[_0xbb43('0x11')](_0x2b0797['params']['id'])[_0xbb43('0x10')](respondWithResult(_0x8242ab,null))['then'](handleEntityNotFound(_0x8242ab,null))[_0xbb43('0x12')](handleError(_0x8242ab,null));};exports[_0xbb43('0x13')]=function(_0x4dfc54,_0x5d765b){if(_0x4dfc54[_0xbb43('0x14')][_0xbb43('0x9')]&&_0x4dfc54[_0xbb43('0x14')][_0xbb43('0x15')]){var _0x5bcce7=path[_0xbb43('0x16')](__dirname,'../../files/plugins',_0x4dfc54[_0xbb43('0x14')]['script']);var _0x2f5e31=process['cwd']();process[_0xbb43('0x17')](path[_0xbb43('0x18')](_0x5bcce7));return execChildProcess()['then'](function(_0x1d0768){process['chdir'](_0x2f5e31);return pm2[_0xbb43('0x19')]({'name':_0x4dfc54[_0xbb43('0x14')][_0xbb43('0x9')],'script':_0x5bcce7});})['then'](function(_0x53f0d5){pm2['dump']();return _0x53f0d5[0x0];})[_0xbb43('0x10')](respondWithResult(_0x5d765b,0xc9))[_0xbb43('0x12')](handleError(_0x5d765b,null));}else{return _0x5d765b['status'](0x1f4)[_0xbb43('0xa')]({'message':_0xbb43('0x1a')});}};exports[_0xbb43('0x1b')]=function(_0x3874fb,_0x4ed43f){if(_0x3874fb['body']['id']){delete _0x3874fb[_0xbb43('0x14')]['id'];}var _0x42800f={'online':_0xbb43('0x1c'),'stopped':_0xbb43('0x1d')};if(_0x42800f[_0xbb43('0x1e')](_0x3874fb[_0xbb43('0x14')][_0xbb43('0x6')])){return pm2[_0x42800f[_0x3874fb[_0xbb43('0x14')]['status']]](_0x3874fb[_0xbb43('0x1f')]['id'])['then'](respondWithResult(_0x4ed43f,0xc8))[_0xbb43('0x12')](handleError(_0x4ed43f,null));}else{return _0x4ed43f[_0xbb43('0x6')](0x1f4)[_0xbb43('0xa')]({'message':_0xbb43('0x20')});}};exports['destroy']=function(_0x157d62,_0x547a6f){if(_0x157d62['body']['id']){delete _0x157d62['body']['id'];}if(_0x157d62[_0xbb43('0x1f')]['id']){return pm2['delete'](_0x157d62[_0xbb43('0x1f')]['id'])[_0xbb43('0x10')](function(_0xc577ac){pm2['dump']();return _0xc577ac[0x0];})[_0xbb43('0x10')](respondWithResult(_0x547a6f,null))[_0xbb43('0x12')](handleError(_0x547a6f,null));}else{return _0x547a6f[_0xbb43('0x6')](0x1f4)[_0xbb43('0xa')]({'message':_0xbb43('0x21')});}}; \ No newline at end of file +var _0x41bb=['restart','stop','hasOwnProperty','Unknown\x20status','delete','dump','Unknown\x20id','lodash','../../config/pm2','api','child_process','exec','bluebird','sendStatus','json','error','stack','name','status','send','info','index','list','then','express','motion2','catch','show','describe','params','create','body','join','../../files/plugins','script','dirname','start','update'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x41bb,0xc5));var _0xb41b=function(_0x254695,_0x3c58b2){_0x254695=_0x254695-0x0;var _0x303c7d=_0x41bb[_0x254695];return _0x303c7d;};'use strict';var _=require(_0xb41b('0x0'));var pm2=require(_0xb41b('0x1'));var logger=require('../../config/logger')(_0xb41b('0x2'));var path=require('path');var exec=require(_0xb41b('0x3'))[_0xb41b('0x4')];var BPromise=require(_0xb41b('0x5'));function handleEntityNotFound(_0x448c8e,_0x4ee21b){return function(_0x12cea3){if(!_0x12cea3){_0x448c8e[_0xb41b('0x6')](0x194);;}return _0x12cea3;};}function respondWithResult(_0x2dbaa3,_0x50bc62){_0x50bc62=_0x50bc62||0xc8;return function(_0x5455ce){if(_0x5455ce){return _0x2dbaa3['status'](_0x50bc62)[_0xb41b('0x7')](_0x5455ce);}return null;};}function handleError(_0x29c30d,_0x53722a){_0x53722a=_0x53722a||0x1f4;return function(_0x13d44e){logger[_0xb41b('0x8')](_0x13d44e[_0xb41b('0x9')]);if(_0x13d44e[_0xb41b('0xa')]){delete _0x13d44e[_0xb41b('0xa')];}_0x29c30d[_0xb41b('0xb')](_0x53722a)[_0xb41b('0xc')](_0x13d44e);};}function execChildProcess(){return new BPromise(function(_0x4baa03,_0x1a9e2c){exec('npm\x20install',function(_0x2e906c,_0xb02d60,_0x1e1c82){logger[_0xb41b('0xd')](_0xb02d60);logger[_0xb41b('0xd')](_0x1e1c82);if(_0x2e906c){logger['error'](_0x2e906c);return _0x1a9e2c(_0x2e906c);}return _0x4baa03(_0xb02d60);});});}exports[_0xb41b('0xe')]=function(_0x2d947a,_0x33d1b5){return pm2[_0xb41b('0xf')]()[_0xb41b('0x10')](function(_0x4e8603){if(_0x4e8603){var _0x4e7f11=_['reject'](_0x4e8603,function(_0x1a09ec){return _0x1a09ec[_0xb41b('0xa')]===_0xb41b('0x11')||_0x1a09ec[_0xb41b('0xa')]===_0xb41b('0x12');});return{'rows':_0x4e7f11,'count':_0x4e7f11['length']};}return null;})[_0xb41b('0x10')](respondWithResult(_0x33d1b5,null))[_0xb41b('0x13')](handleError(_0x33d1b5,null));};exports[_0xb41b('0x14')]=function(_0xcf0728,_0x43f4ea){return pm2[_0xb41b('0x15')](_0xcf0728[_0xb41b('0x16')]['id'])['then'](respondWithResult(_0x43f4ea,null))['then'](handleEntityNotFound(_0x43f4ea,null))['catch'](handleError(_0x43f4ea,null));};exports[_0xb41b('0x17')]=function(_0x503e86,_0x307633){if(_0x503e86[_0xb41b('0x18')][_0xb41b('0xa')]&&_0x503e86['body']['script']){var _0x1a1386=path[_0xb41b('0x19')](__dirname,_0xb41b('0x1a'),_0x503e86[_0xb41b('0x18')][_0xb41b('0x1b')]);var _0x42dccb=process['cwd']();process['chdir'](path[_0xb41b('0x1c')](_0x1a1386));return execChildProcess()[_0xb41b('0x10')](function(_0x871b35){process['chdir'](_0x42dccb);return pm2[_0xb41b('0x1d')]({'name':_0x503e86[_0xb41b('0x18')]['name'],'script':_0x1a1386});})[_0xb41b('0x10')](function(_0x34f908){pm2['dump']();return _0x34f908[0x0];})[_0xb41b('0x10')](respondWithResult(_0x307633,0xc9))['catch'](handleError(_0x307633,null));}else{return _0x307633[_0xb41b('0xb')](0x1f4)[_0xb41b('0xc')]({'message':'Missing\x20name\x20and/or\x20path'});}};exports[_0xb41b('0x1e')]=function(_0x4265b8,_0x583099){if(_0x4265b8['body']['id']){delete _0x4265b8[_0xb41b('0x18')]['id'];}var _0x46aecf={'online':_0xb41b('0x1f'),'stopped':_0xb41b('0x20')};if(_0x46aecf[_0xb41b('0x21')](_0x4265b8[_0xb41b('0x18')][_0xb41b('0xb')])){return pm2[_0x46aecf[_0x4265b8['body'][_0xb41b('0xb')]]](_0x4265b8[_0xb41b('0x16')]['id'])['then'](respondWithResult(_0x583099,0xc8))[_0xb41b('0x13')](handleError(_0x583099,null));}else{return _0x583099['status'](0x1f4)[_0xb41b('0xc')]({'message':_0xb41b('0x22')});}};exports['destroy']=function(_0x23a6ed,_0x4a95e7){if(_0x23a6ed[_0xb41b('0x18')]['id']){delete _0x23a6ed[_0xb41b('0x18')]['id'];}if(_0x23a6ed['params']['id']){return pm2[_0xb41b('0x23')](_0x23a6ed[_0xb41b('0x16')]['id'])[_0xb41b('0x10')](function(_0x4503cf){pm2[_0xb41b('0x24')]();return _0x4503cf[0x0];})[_0xb41b('0x10')](respondWithResult(_0x4a95e7,null))[_0xb41b('0x13')](handleError(_0x4a95e7,null));}else{return _0x4a95e7[_0xb41b('0xb')](0x1f4)[_0xb41b('0xc')]({'message':_0xb41b('0x25')});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index ac0f5fa..8730030 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 _0xfa15=['isAuthenticated','getAgents','getQueues','exports','Router','./realtime.controller','get','/agents'];(function(_0x3135b9,_0x42d157){var _0x226f4d=function(_0xc364a6){while(--_0xc364a6){_0x3135b9['push'](_0x3135b9['shift']());}};_0x226f4d(++_0x42d157);}(_0xfa15,0x144));var _0x5fa1=function(_0xd8d663,_0x2b6b31){_0xd8d663=_0xd8d663-0x0;var _0x4f8a07=_0xfa15[_0xd8d663];return _0x4f8a07;};'use strict';var express=require('express');var router=express[_0x5fa1('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x5fa1('0x1'));router[_0x5fa1('0x2')](_0x5fa1('0x3'),auth[_0x5fa1('0x4')](),controller[_0x5fa1('0x5')]);router['get']('/queues',auth[_0x5fa1('0x4')](),controller[_0x5fa1('0x6')]);module[_0x5fa1('0x7')]=router; \ No newline at end of file +var _0xb8d0=['Router','../../components/auth/service','./realtime.controller','get','/agents','isAuthenticated','getAgents','/queues','getQueues','exports'];(function(_0x11bd85,_0x1827fc){var _0x5662ca=function(_0x14c759){while(--_0x14c759){_0x11bd85['push'](_0x11bd85['shift']());}};_0x5662ca(++_0x1827fc);}(_0xb8d0,0x136));var _0x0b8d=function(_0x1383f6,_0x3b53f8){_0x1383f6=_0x1383f6-0x0;var _0x238aa7=_0xb8d0[_0x1383f6];return _0x238aa7;};'use strict';var express=require('express');var router=express[_0x0b8d('0x0')]();var auth=require(_0x0b8d('0x1'));var controller=require(_0x0b8d('0x2'));router[_0x0b8d('0x3')](_0x0b8d('0x4'),auth[_0x0b8d('0x5')](),controller[_0x0b8d('0x6')]);router[_0x0b8d('0x3')](_0x0b8d('0x7'),auth[_0x0b8d('0x5')](),controller[_0x0b8d('0x8')]);module[_0x0b8d('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 ec15b03..f093e4e 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 _0x731b=['getQueues','isValidChannel','format','toLowerCase','Queue','rawAttributes','outbound','startCase','Queues','initializeQueues','lodash','util','../../components/realtime/queues','../../components/parsers/qs','../../config/utils','../../mysqldb','../../errors/api','APIBadRequestError','handleError','offset','undefined','count','limit','status','set','Content-Range','json','getAgents','globalQueueFilter','globalStatusFilter','pauseTypeFilter','pause','*pause','resolve','then','channel','Channel\x20parameter\x20%s\x20is\x20invalid','query','sort','globalStatus','validateSortParameter','getUpdatedSortOptions','fields','join','order','getSortedAgentsIdsByStatus','length','fieldName','type','agent','getOptions','raw','push','sequelize','literal','FIELD(id,','forEach','Pause','where','merge','user','role','userProfileId','extraQueryConditions','assign','UserProfile','getResources','rows','map','find','filterAgentAttributes','getAgentStatus','includes','voice','voiceStatus','talking','Status','pick','catch'];(function(_0xb3bb8f,_0x11b982){var _0x43f1b8=function(_0x76bef3){while(--_0x76bef3){_0xb3bb8f['push'](_0xb3bb8f['shift']());}};_0x43f1b8(++_0x11b982);}(_0x731b,0xf7));var _0xb731=function(_0x5a6df4,_0xa5010){_0x5a6df4=_0x5a6df4-0x0;var _0x265717=_0x731b[_0x5a6df4];return _0x265717;};'use strict';var _=require(_0xb731('0x0'));var util=require(_0xb731('0x1'));var rta=require('../../components/realtime/agents');var rtq=require(_0xb731('0x2'));var qs=require(_0xb731('0x3'));var utils=require(_0xb731('0x4'));var db=require(_0xb731('0x5'))['db'];var APIBadRequestError=require(_0xb731('0x6'))[_0xb731('0x7')];var APIHandleError=require('../../errors/api')[_0xb731('0x8')];function respondWithFilteredResult(_0x4fc47b,_0x40b673){return function(_0xd6b442){if(_0xd6b442){var _0x12c59b=typeof _0x40b673[_0xb731('0x9')]===_0xb731('0xa')&&typeof _0x40b673['limit']===_0xb731('0xa');var _0xfd6c16=_0xd6b442[_0xb731('0xb')];var _0x26488c=_0x12c59b?0x0:_0x40b673[_0xb731('0x9')];var _0x2f9d04=_0x12c59b?_0xd6b442[_0xb731('0xb')]:_0x40b673[_0xb731('0x9')]+_0x40b673[_0xb731('0xc')];var _0x2bb336;if(_0x2f9d04>=_0xfd6c16){_0x2f9d04=_0xfd6c16;_0x2bb336=0xc8;}else{_0x2bb336=0xce;}_0x4fc47b[_0xb731('0xd')](_0x2bb336);return _0x4fc47b[_0xb731('0xe')](_0xb731('0xf'),_0x26488c+'-'+_0x2f9d04+'/'+_0xfd6c16)[_0xb731('0x10')](_0xd6b442);}return null;};}exports[_0xb731('0x11')]=function(_0x5899e0,_0x36bac7){var _0x5f4f12={'count':0x0,'rows':[]};var _0x180a92={};var _0x1b670e;var _0x31fba7=utils['getChannels']();var _0x12d9c6;var _0x4b433a;var _0x524c0d=_0x5899e0['query'][_0xb731('0x12')];var _0x29cb36=_0x5899e0['query'][_0xb731('0x13')];var _0x15c596=_0x5899e0['query'][_0xb731('0x14')];var _0x205adf=_0x29cb36===_0xb731('0x15')||_0x29cb36===_0xb731('0x16')?!![]:![];var _0x4e0c6d=[];var _0x162a9b;var _0x1eaaf7;Promise[_0xb731('0x17')]()[_0xb731('0x18')](function(){if(_0x5899e0['query'][_0xb731('0x19')]){if(!utils['isValidChannel'](_0x5899e0['query'][_0xb731('0x19')])){throw new APIBadRequestError(util['format'](_0xb731('0x1a'),_0x5899e0[_0xb731('0x1b')][_0xb731('0x19')]));}_0x1b670e=_0x5899e0[_0xb731('0x1b')][_0xb731('0x19')]['toLowerCase']();}if(!_0x5899e0['query'][_0xb731('0x1c')]||!_0x5899e0[_0xb731('0x1b')]['sort']['includes'](_0xb731('0x1d'))){_0x5899e0['query'][_0xb731('0x1c')]=rta[_0xb731('0x1e')](_0x5899e0['query'][_0xb731('0x1c')]);return;}var _0x1a812b=rta[_0xb731('0x1f')](_0x5899e0[_0xb731('0x1b')]['sort']);_0x5899e0[_0xb731('0x1b')][_0xb731('0x1c')]=_0x1a812b[_0xb731('0x20')][_0xb731('0x21')](',');_0x162a9b=_0x1a812b[_0xb731('0x22')];})['then'](function(){if(!_0x524c0d){return[];}return rta['getAgentIdsByQueues'](_0x524c0d,_0x1b670e);})[_0xb731('0x18')](function(_0x3519c8){_0x4e0c6d=_0x3519c8;return rta['getRealtimeAgents']();})['then'](function(_0x26abc9){_0x4b433a=_0x26abc9['rows'];if((!_0x29cb36||_0x205adf)&&!_0x162a9b){return _0x4e0c6d;}if(_0x162a9b&&!_0x29cb36){return rta[_0xb731('0x23')](_0x4b433a,_0x4e0c6d,_0x162a9b);}else{return rta['getAgentIdsByStatus'](_0x4b433a,_0x4e0c6d,_0x29cb36);}})[_0xb731('0x18')](function(_0x32a863){_0x4e0c6d=_0x32a863;var _0xc14f79=![];if(_0x4e0c6d[_0xb731('0x24')]===0x0){if(_0x524c0d||_0x29cb36){_0xc14f79=!![];}if(_0x205adf){_0xc14f79=![];}}if(_0xc14f79){return _0x5f4f12;}var _0x77678f=_['map'](db['User']['rawAttributes'],function(_0x4c0a33){return{'name':_0x4c0a33[_0xb731('0x25')],'type':_0x4c0a33[_0xb731('0x26')]['key']};});_0x5899e0[_0xb731('0x1b')]['role']=_0xb731('0x27');_0x5899e0[_0xb731('0x1b')]['online']=!![];_0x180a92=qs[_0xb731('0x28')](_0x77678f,_0x5899e0);_0x180a92[_0xb731('0x29')]=!![];var _0x596ebd=[];if(_0x4e0c6d[_0xb731('0x24')]>0x0){_0x596ebd[_0xb731('0x2a')]({'id':{'$in':_0x4e0c6d}});if(_0x162a9b&&!_0x29cb36){_0x1eaaf7=[db[_0xb731('0x2b')][_0xb731('0x2c')](_0xb731('0x2d')+_0x4e0c6d+')')];_0x180a92[_0xb731('0x22')]=_0x1eaaf7;}}if(_0x205adf){_0x31fba7[_0xb731('0x2e')](function(_0x5cf2a1){var _0x45f9d2=!![];if(_0x29cb36===_0xb731('0x16')&&_0x1b670e!==_0x5cf2a1){_0x45f9d2=![];}_0x596ebd[_0xb731('0x2a')]({[_0x5cf2a1+_0xb731('0x2f')]:_0x45f9d2});});if(_0x15c596){_0x596ebd[_0xb731('0x2a')]({'pauseType':_0x15c596});}}else if(_0x29cb36){_0x31fba7[_0xb731('0x2e')](function(_0x2c767b){_0x596ebd[_0xb731('0x2a')]({[_0x2c767b+_0xb731('0x2f')]:![]});});}_0x180a92[_0xb731('0x30')]=_[_0xb731('0x31')](_0x180a92[_0xb731('0x30')],{'$and':_0x596ebd});if(_0x5899e0[_0xb731('0x32')][_0xb731('0x33')]===_0xb731('0x32')){var _0x14500d={'params':{'id':_0x5899e0[_0xb731('0x32')][_0xb731('0x34')]},'query':{'section':'Agents','role':_0xb731('0x27'),'online':!![],'raw':!![],'ids':_0x4e0c6d,'customSorting':_0x1eaaf7}};if(_0x205adf){_0x14500d['query'][_0xb731('0x35')]=_0x596ebd;}_0x14500d[_0xb731('0x1b')]=Object[_0xb731('0x36')](_0x14500d['query'],_0x5899e0['query']);delete _0x14500d[_0xb731('0x1b')]['id'];return db[_0xb731('0x37')][_0xb731('0x38')](_0x14500d);}return db['User']['findAndCountAll'](_0x180a92);})['then'](function(_0x3187fe){_0x5f4f12[_0xb731('0xb')]=_0x3187fe[_0xb731('0xb')];_0x12d9c6=_0x3187fe[_0xb731('0x39')];return _0x12d9c6[_0xb731('0x3a')](function(_0x186c72){var _0x41a709=_[_0xb731('0x3b')](_0x4b433a,['id',_0x186c72['id']]);if(_0x41a709){var _0x350a4d=rta[_0xb731('0x3c')](_0x41a709);_[_0xb731('0x31')](_0x186c72,_0x350a4d);}_0x186c72[_0xb731('0x1d')]=rta[_0xb731('0x3d')](_0x186c72);if(_0x186c72[_0xb731('0x1d')][_0xb731('0x3e')](_0xb731('0x15'))){_0x31fba7[_0xb731('0x2e')](function(_0x3eb22f){if(_0x186c72[_0x3eb22f+_0xb731('0x2f')]){if(_0x3eb22f===_0xb731('0x3f')){if(_0x186c72[_0xb731('0x40')]!==_0xb731('0x41')){_0x186c72[_0xb731('0x40')]='pause';}}else{_0x186c72[_0x3eb22f+_0xb731('0x42')]=_0xb731('0x15');}}});}return _0x186c72;});})[_0xb731('0x18')](function(_0x2078d1){if(!_0x162a9b||_0x1eaaf7){return _0x2078d1;}return rta['sortAgentsByStatus'](_0x2078d1,_0x162a9b);})['then'](function(_0x2f75d5){var _0x381fdb=null;if(_0x5899e0[_0xb731('0x1b')][_0xb731('0x20')]){var _0x132a97=_0x5899e0[_0xb731('0x1b')][_0xb731('0x20')]['split'](',');_0x381fdb=_0x2f75d5[_0xb731('0x3a')](function(_0x3a4edf){return _[_0xb731('0x43')](_0x3a4edf,_0x132a97);});}_0x5f4f12['rows']=_0x381fdb||_0x2f75d5;return _0x5f4f12;})[_0xb731('0x18')](respondWithFilteredResult(_0x36bac7,_0x180a92))[_0xb731('0x44')](APIHandleError(_0x36bac7));};exports[_0xb731('0x45')]=function(_0x1019d0,_0x401a9c){var _0xbdc0fb={'count':0x0,'rows':[]};var _0x35d516={};var _0x4436eb;var _0x332123;var _0x5d1e3d;Promise['resolve']()[_0xb731('0x18')](function(){if(_0x1019d0[_0xb731('0x1b')][_0xb731('0x19')]){if(!utils[_0xb731('0x46')](_0x1019d0[_0xb731('0x1b')][_0xb731('0x19')])){throw new APIBadRequestError(util[_0xb731('0x47')](_0xb731('0x1a'),_0x1019d0['query']['channel']));}_0x4436eb=_0x1019d0[_0xb731('0x1b')][_0xb731('0x19')][_0xb731('0x48')]();}var _0x1a9e06=_['startCase'](_0x4436eb)+_0xb731('0x49');var _0x530c56=_[_0xb731('0x3a')](db[_0x1a9e06][_0xb731('0x4a')],function(_0x493f70){return{'name':_0x493f70['fieldName'],'type':_0x493f70[_0xb731('0x26')]['key']};});if(!_0x1019d0[_0xb731('0x1b')][_0xb731('0x20')]){var _0xb699d=['id','name'];if(_0x4436eb===_0xb731('0x3f')){_0xb699d[_0xb731('0x2a')](_0xb731('0x26'));if(_0x1019d0[_0xb731('0x1b')][_0xb731('0x26')]==='outbound'){_0xb699d[_0xb731('0x2a')](['dialActive','dialMethod']);}}_0x1019d0[_0xb731('0x1b')][_0xb731('0x20')]=_0xb699d[_0xb731('0x21')](',');}_0x35d516=qs[_0xb731('0x28')](_0x530c56,_0x1019d0);if(_0x1019d0[_0xb731('0x32')][_0xb731('0x33')]===_0xb731('0x32')){var _0x532670={'params':{'id':_0x1019d0[_0xb731('0x32')][_0xb731('0x34')]},'query':{'section':_0x4436eb===_0xb731('0x3f')&&_0x1019d0['query']['type']===_0xb731('0x4b')?'QueueCampaigns':_[_0xb731('0x4c')](_0x4436eb)+_0xb731('0x4d'),'type':_0x1019d0[_0xb731('0x1b')][_0xb731('0x26')],'nolimit':!![],'sort':'name','filter':_0x1019d0[_0xb731('0x1b')]['filter']}};_0x532670['query']=Object[_0xb731('0x36')](_0x532670[_0xb731('0x1b')],_0x1019d0[_0xb731('0x1b')]);delete _0x532670[_0xb731('0x1b')]['id'];return db[_0xb731('0x37')][_0xb731('0x38')](_0x532670);}return db[_0x1a9e06]['findAndCountAll'](_0x35d516);})[_0xb731('0x18')](function(_0x1fa078){_0xbdc0fb[_0xb731('0xb')]=_0x1fa078[_0xb731('0xb')];_0x332123=_0x1fa078[_0xb731('0x39')];return rtq['getRealtimeQueues'](_0x1019d0,_0x4436eb);})['then'](function(_0x393145){_0x5d1e3d=_0x393145[_0xb731('0x39')];return rtq[_0xb731('0x4e')](_0x332123,_0x5d1e3d,_0x4436eb,_0x1019d0[_0xb731('0x1b')][_0xb731('0x26')]);})[_0xb731('0x18')](function(_0x4c4132){_0xbdc0fb[_0xb731('0x39')]=_0x4c4132;return _0xbdc0fb;})[_0xb731('0x18')](respondWithFilteredResult(_0x401a9c,_0x35d516))[_0xb731('0x44')](APIHandleError(_0x401a9c));}; \ No newline at end of file +var _0x23fc=['key','role','agent','online','raw','push','sequelize','literal','FIELD(id,','order','forEach','Pause','where','merge','user','userProfileId','Agents','extraQueryConditions','assign','getResources','getAgentStatus','includes','voice','voiceStatus','talking','Status','sortAgentsByStatus','getQueues','startCase','Queue','name','dialMethod','outbound','QueueCampaigns','filter','UserProfile','getRealtimeQueues','catch','util','../../components/realtime/queues','../../components/parsers/qs','../../config/utils','APIBadRequestError','../../errors/api','handleError','count','offset','limit','status','set','json','getAgents','getChannels','query','globalStatusFilter','pauseTypeFilter','pause','resolve','then','isValidChannel','channel','format','sort','globalStatus','validateSortParameter','getUpdatedSortOptions','fields','join','getAgentIdsByQueues','rows','getAgentIdsByStatus','length','map','User','rawAttributes','fieldName','type'];(function(_0x42b041,_0x6c803a){var _0x3d7322=function(_0x265aba){while(--_0x265aba){_0x42b041['push'](_0x42b041['shift']());}};_0x3d7322(++_0x6c803a);}(_0x23fc,0x10d));var _0xc23f=function(_0x491cbe,_0x45c8ba){_0x491cbe=_0x491cbe-0x0;var _0x59449d=_0x23fc[_0x491cbe];return _0x59449d;};'use strict';var _=require('lodash');var util=require(_0xc23f('0x0'));var rta=require('../../components/realtime/agents');var rtq=require(_0xc23f('0x1'));var qs=require(_0xc23f('0x2'));var utils=require(_0xc23f('0x3'));var db=require('../../mysqldb')['db'];var APIBadRequestError=require('../../errors/api')[_0xc23f('0x4')];var APIHandleError=require(_0xc23f('0x5'))[_0xc23f('0x6')];function respondWithFilteredResult(_0x507cc6,_0x373a9d){return function(_0x59bcb6){if(_0x59bcb6){var _0x1dc3f3=typeof _0x373a9d['offset']==='undefined'&&typeof _0x373a9d['limit']==='undefined';var _0x45852e=_0x59bcb6[_0xc23f('0x7')];var _0x3986e5=_0x1dc3f3?0x0:_0x373a9d[_0xc23f('0x8')];var _0x5af922=_0x1dc3f3?_0x59bcb6[_0xc23f('0x7')]:_0x373a9d[_0xc23f('0x8')]+_0x373a9d[_0xc23f('0x9')];var _0x370751;if(_0x5af922>=_0x45852e){_0x5af922=_0x45852e;_0x370751=0xc8;}else{_0x370751=0xce;}_0x507cc6[_0xc23f('0xa')](_0x370751);return _0x507cc6[_0xc23f('0xb')]('Content-Range',_0x3986e5+'-'+_0x5af922+'/'+_0x45852e)[_0xc23f('0xc')](_0x59bcb6);}return null;};}exports[_0xc23f('0xd')]=function(_0x4985ce,_0x4eb322){var _0x5463e7={'count':0x0,'rows':[]};var _0x592cd9={};var _0x5f2f22;var _0x49e969=utils[_0xc23f('0xe')]();var _0x56f47f;var _0x2dbe8a;var _0x39e213=_0x4985ce[_0xc23f('0xf')]['globalQueueFilter'];var _0x368979=_0x4985ce[_0xc23f('0xf')][_0xc23f('0x10')];var _0x43e00d=_0x4985ce[_0xc23f('0xf')][_0xc23f('0x11')];var _0x3b2060=_0x368979===_0xc23f('0x12')||_0x368979==='*pause'?!![]:![];var _0x249b0a=[];var _0x55cd24;var _0x4e07b5;Promise[_0xc23f('0x13')]()[_0xc23f('0x14')](function(){if(_0x4985ce[_0xc23f('0xf')]['channel']){if(!utils[_0xc23f('0x15')](_0x4985ce[_0xc23f('0xf')][_0xc23f('0x16')])){throw new APIBadRequestError(util[_0xc23f('0x17')]('Channel\x20parameter\x20%s\x20is\x20invalid',_0x4985ce[_0xc23f('0xf')][_0xc23f('0x16')]));}_0x5f2f22=_0x4985ce['query'][_0xc23f('0x16')]['toLowerCase']();}if(!_0x4985ce[_0xc23f('0xf')][_0xc23f('0x18')]||!_0x4985ce['query'][_0xc23f('0x18')]['includes'](_0xc23f('0x19'))){_0x4985ce[_0xc23f('0xf')][_0xc23f('0x18')]=rta[_0xc23f('0x1a')](_0x4985ce['query']['sort']);return;}var _0x20d7a6=rta[_0xc23f('0x1b')](_0x4985ce['query']['sort']);_0x4985ce['query'][_0xc23f('0x18')]=_0x20d7a6[_0xc23f('0x1c')][_0xc23f('0x1d')](',');_0x55cd24=_0x20d7a6['order'];})[_0xc23f('0x14')](function(){if(!_0x39e213){return[];}return rta[_0xc23f('0x1e')](_0x39e213,_0x5f2f22);})[_0xc23f('0x14')](function(_0x5aeb8e){_0x249b0a=_0x5aeb8e;return rta['getRealtimeAgents']();})['then'](function(_0x36f206){_0x2dbe8a=_0x36f206[_0xc23f('0x1f')];if((!_0x368979||_0x3b2060)&&!_0x55cd24){return _0x249b0a;}if(_0x55cd24&&!_0x368979){return rta['getSortedAgentsIdsByStatus'](_0x2dbe8a,_0x249b0a,_0x55cd24);}else{return rta[_0xc23f('0x20')](_0x2dbe8a,_0x249b0a,_0x368979);}})[_0xc23f('0x14')](function(_0x4b86dc){_0x249b0a=_0x4b86dc;var _0x2460ff=![];if(_0x249b0a[_0xc23f('0x21')]===0x0){if(_0x39e213||_0x368979){_0x2460ff=!![];}if(_0x3b2060){_0x2460ff=![];}}if(_0x2460ff){return _0x5463e7;}var _0x36c8df=_[_0xc23f('0x22')](db[_0xc23f('0x23')][_0xc23f('0x24')],function(_0x1b1484){return{'name':_0x1b1484[_0xc23f('0x25')],'type':_0x1b1484[_0xc23f('0x26')][_0xc23f('0x27')]};});_0x4985ce['query'][_0xc23f('0x28')]=_0xc23f('0x29');_0x4985ce[_0xc23f('0xf')][_0xc23f('0x2a')]=!![];_0x592cd9=qs['getOptions'](_0x36c8df,_0x4985ce);_0x592cd9[_0xc23f('0x2b')]=!![];var _0x16225b=[];if(_0x249b0a[_0xc23f('0x21')]>0x0){_0x16225b[_0xc23f('0x2c')]({'id':{'$in':_0x249b0a}});if(_0x55cd24&&!_0x368979){_0x4e07b5=[db[_0xc23f('0x2d')][_0xc23f('0x2e')](_0xc23f('0x2f')+_0x249b0a+')')];_0x592cd9[_0xc23f('0x30')]=_0x4e07b5;}}if(_0x3b2060){_0x49e969[_0xc23f('0x31')](function(_0x457fd2){var _0x2ac48b=!![];if(_0x368979==='*pause'&&_0x5f2f22!==_0x457fd2){_0x2ac48b=![];}_0x16225b[_0xc23f('0x2c')]({[_0x457fd2+'Pause']:_0x2ac48b});});if(_0x43e00d){_0x16225b['push']({'pauseType':_0x43e00d});}}else if(_0x368979){_0x49e969[_0xc23f('0x31')](function(_0x456fb4){_0x16225b[_0xc23f('0x2c')]({[_0x456fb4+_0xc23f('0x32')]:![]});});}_0x592cd9[_0xc23f('0x33')]=_[_0xc23f('0x34')](_0x592cd9['where'],{'$and':_0x16225b});if(_0x4985ce[_0xc23f('0x35')]['role']===_0xc23f('0x35')){var _0x3e27af={'params':{'id':_0x4985ce[_0xc23f('0x35')][_0xc23f('0x36')]},'query':{'section':_0xc23f('0x37'),'role':'agent','online':!![],'raw':!![],'ids':_0x249b0a,'customSorting':_0x4e07b5}};if(_0x3b2060){_0x3e27af[_0xc23f('0xf')][_0xc23f('0x38')]=_0x16225b;}_0x3e27af[_0xc23f('0xf')]=Object[_0xc23f('0x39')](_0x3e27af['query'],_0x4985ce['query']);delete _0x3e27af['query']['id'];return db['UserProfile'][_0xc23f('0x3a')](_0x3e27af);}return db[_0xc23f('0x23')]['findAndCountAll'](_0x592cd9);})[_0xc23f('0x14')](function(_0x5ca456){_0x5463e7[_0xc23f('0x7')]=_0x5ca456[_0xc23f('0x7')];_0x56f47f=_0x5ca456[_0xc23f('0x1f')];return _0x56f47f[_0xc23f('0x22')](function(_0x50ea12){var _0x36a7eb=_['find'](_0x2dbe8a,['id',_0x50ea12['id']]);if(_0x36a7eb){var _0x21f2aa=rta['filterAgentAttributes'](_0x36a7eb);_[_0xc23f('0x34')](_0x50ea12,_0x21f2aa);}_0x50ea12['globalStatus']=rta[_0xc23f('0x3b')](_0x50ea12);if(_0x50ea12[_0xc23f('0x19')][_0xc23f('0x3c')]('pause')){_0x49e969['forEach'](function(_0xf85f26){if(_0x50ea12[_0xf85f26+'Pause']){if(_0xf85f26===_0xc23f('0x3d')){if(_0x50ea12[_0xc23f('0x3e')]!==_0xc23f('0x3f')){_0x50ea12[_0xc23f('0x3e')]='pause';}}else{_0x50ea12[_0xf85f26+_0xc23f('0x40')]=_0xc23f('0x12');}}});}return _0x50ea12;});})[_0xc23f('0x14')](function(_0x47570c){if(!_0x55cd24||_0x4e07b5){return _0x47570c;}return rta[_0xc23f('0x41')](_0x47570c,_0x55cd24);})[_0xc23f('0x14')](function(_0x41a585){var _0x43ac13=null;if(_0x4985ce[_0xc23f('0xf')][_0xc23f('0x1c')]){var _0x3be26f=_0x4985ce['query'][_0xc23f('0x1c')]['split'](',');_0x43ac13=_0x41a585[_0xc23f('0x22')](function(_0xbcf2fd){return _['pick'](_0xbcf2fd,_0x3be26f);});}_0x5463e7[_0xc23f('0x1f')]=_0x43ac13||_0x41a585;return _0x5463e7;})['then'](respondWithFilteredResult(_0x4eb322,_0x592cd9))['catch'](APIHandleError(_0x4eb322));};exports[_0xc23f('0x42')]=function(_0x385c32,_0x180bdc){var _0x25635b={'count':0x0,'rows':[]};var _0x310420={};var _0x255240;var _0x1e6a6d;var _0x571bc;Promise[_0xc23f('0x13')]()['then'](function(){if(_0x385c32['query']['channel']){if(!utils[_0xc23f('0x15')](_0x385c32['query']['channel'])){throw new APIBadRequestError(util[_0xc23f('0x17')]('Channel\x20parameter\x20%s\x20is\x20invalid',_0x385c32[_0xc23f('0xf')][_0xc23f('0x16')]));}_0x255240=_0x385c32[_0xc23f('0xf')][_0xc23f('0x16')]['toLowerCase']();}var _0x3ba5d8=_[_0xc23f('0x43')](_0x255240)+_0xc23f('0x44');var _0x4abb3b=_[_0xc23f('0x22')](db[_0x3ba5d8][_0xc23f('0x24')],function(_0x510ad0){return{'name':_0x510ad0[_0xc23f('0x25')],'type':_0x510ad0['type']['key']};});if(!_0x385c32[_0xc23f('0xf')][_0xc23f('0x1c')]){var _0x451324=['id',_0xc23f('0x45')];if(_0x255240===_0xc23f('0x3d')){_0x451324[_0xc23f('0x2c')]('type');if(_0x385c32[_0xc23f('0xf')][_0xc23f('0x26')]==='outbound'){_0x451324[_0xc23f('0x2c')](['dialActive',_0xc23f('0x46')]);}}_0x385c32[_0xc23f('0xf')][_0xc23f('0x1c')]=_0x451324[_0xc23f('0x1d')](',');}_0x310420=qs['getOptions'](_0x4abb3b,_0x385c32);if(_0x385c32[_0xc23f('0x35')][_0xc23f('0x28')]===_0xc23f('0x35')){var _0x684bea={'params':{'id':_0x385c32[_0xc23f('0x35')][_0xc23f('0x36')]},'query':{'section':_0x255240===_0xc23f('0x3d')&&_0x385c32[_0xc23f('0xf')][_0xc23f('0x26')]===_0xc23f('0x47')?_0xc23f('0x48'):_['startCase'](_0x255240)+'Queues','type':_0x385c32[_0xc23f('0xf')][_0xc23f('0x26')],'nolimit':!![],'sort':_0xc23f('0x45'),'filter':_0x385c32[_0xc23f('0xf')][_0xc23f('0x49')]}};_0x684bea[_0xc23f('0xf')]=Object[_0xc23f('0x39')](_0x684bea[_0xc23f('0xf')],_0x385c32[_0xc23f('0xf')]);delete _0x684bea[_0xc23f('0xf')]['id'];return db[_0xc23f('0x4a')]['getResources'](_0x684bea);}return db[_0x3ba5d8]['findAndCountAll'](_0x310420);})[_0xc23f('0x14')](function(_0x9f9a3a){_0x25635b[_0xc23f('0x7')]=_0x9f9a3a[_0xc23f('0x7')];_0x1e6a6d=_0x9f9a3a[_0xc23f('0x1f')];return rtq[_0xc23f('0x4b')](_0x385c32,_0x255240);})[_0xc23f('0x14')](function(_0x16a6ba){_0x571bc=_0x16a6ba[_0xc23f('0x1f')];return rtq['initializeQueues'](_0x1e6a6d,_0x571bc,_0x255240,_0x385c32[_0xc23f('0xf')][_0xc23f('0x26')]);})[_0xc23f('0x14')](function(_0x33aa21){_0x25635b['rows']=_0x33aa21;return _0x25635b;})[_0xc23f('0x14')](respondWithFilteredResult(_0x180bdc,_0x310420))[_0xc23f('0x4c')](APIHandleError(_0x180bdc));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index 2702342..caca099 100644 --- a/server/api/reportAgentPreview/index.js +++ b/server/api/reportAgentPreview/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x156e6c,_0x460990){var _0x27fb67=function(_0x76e320){while(--_0x76e320){_0x156e6c['push'](_0x156e6c['shift']());}};_0x27fb67(++_0x460990);}(_0xedd9,0xfc));var _0x9edd=function(_0x26b6b1,_0x5ef06f){_0x26b6b1=_0x26b6b1-0x0;var _0x51086d=_0xedd9[_0x26b6b1];return _0x51086d;};'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(_0x286303,_0x4b7d32){var _0x113593=function(_0x146304){while(--_0x146304){_0x286303['push'](_0x286303['shift']());}};_0x113593(++_0x4b7d32);}(_0x70e0,0x17b));var _0x070e=function(_0x4dd901,_0x5811c9){_0x4dd901=_0x4dd901-0x0;var _0x49ea44=_0x70e0[_0x4dd901];return _0x49ea44;};'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/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index e527845..46f2018 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 _0x9e54=['sequelize','exports','STRING','DATE'];(function(_0x3114c0,_0x37089a){var _0x3a123d=function(_0x3f1238){while(--_0x3f1238){_0x3114c0['push'](_0x3114c0['shift']());}};_0x3a123d(++_0x37089a);}(_0x9e54,0x88));var _0x49e5=function(_0x27ebc2,_0x5a63d3){_0x27ebc2=_0x27ebc2-0x0;var _0x5aba33=_0x9e54[_0x27ebc2];return _0x5aba33;};'use strict';var Sequelize=require(_0x49e5('0x0'));module[_0x49e5('0x1')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize['DATE']},'uniqueid':{'type':Sequelize[_0x49e5('0x2')]},'starttime':{'type':Sequelize[_0x49e5('0x3')]},'responsetime':{'type':Sequelize[_0x49e5('0x3')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x49e5('0x2')]},'campaigntype':{'type':Sequelize[_0x49e5('0x2')]},'membername':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x9c5a=['INTEGER','sequelize','exports','STRING','DATE'];(function(_0x5cc8b9,_0x20e3c3){var _0x58892e=function(_0x87457a){while(--_0x87457a){_0x5cc8b9['push'](_0x5cc8b9['shift']());}};_0x58892e(++_0x20e3c3);}(_0x9c5a,0x1c3));var _0xa9c5=function(_0x16bd10,_0x575b65){_0x16bd10=_0x16bd10-0x0;var _0x4f866f=_0x9c5a[_0x16bd10];return _0x4f866f;};'use strict';var Sequelize=require(_0xa9c5('0x0'));module[_0xa9c5('0x1')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0xa9c5('0x2')]},'scheduledat':{'type':Sequelize[_0xa9c5('0x3')]},'uniqueid':{'type':Sequelize[_0xa9c5('0x2')]},'starttime':{'type':Sequelize[_0xa9c5('0x3')]},'responsetime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0xa9c5('0x4')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0xa9c5('0x2')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xa9c5('0x2')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index ce2186f..cb155eb 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 _0xac98=['../../config/environment','./reportAgentPreview.attributes','exports','define','ReportAgentPreview','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xac98,0x1a7));var _0x8ac9=function(_0x38f1eb,_0xc3ae40){_0x38f1eb=_0x38f1eb-0x0;var _0x535598=_0xac98[_0x38f1eb];return _0x535598;};'use strict';var _=require(_0x8ac9('0x0'));var util=require(_0x8ac9('0x1'));var logger=require(_0x8ac9('0x2'))(_0x8ac9('0x3'));var moment=require(_0x8ac9('0x4'));var BPromise=require(_0x8ac9('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x8ac9('0x6'));var attributes=require(_0x8ac9('0x7'));module[_0x8ac9('0x8')]=function(_0x550af7,_0x58d86f){return _0x550af7[_0x8ac9('0x9')](_0x8ac9('0xa'),attributes,{'tableName':'report_agent_preview','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3b68=['bluebird','request-promise','path','rimraf','./reportAgentPreview.attributes','exports','ReportAgentPreview','moment'];(function(_0x55f8c3,_0x24f1b0){var _0x202e94=function(_0x3bc58c){while(--_0x3bc58c){_0x55f8c3['push'](_0x55f8c3['shift']());}};_0x202e94(++_0x24f1b0);}(_0x3b68,0x1b7));var _0x83b6=function(_0xd85997,_0x1228fb){_0xd85997=_0xd85997-0x0;var _0x58a5d0=_0x3b68[_0xd85997];return _0x58a5d0;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x83b6('0x0'));var BPromise=require(_0x83b6('0x1'));var rp=require(_0x83b6('0x2'));var fs=require('fs');var path=require(_0x83b6('0x3'));var rimraf=require(_0x83b6('0x4'));var config=require('../../config/environment');var attributes=require(_0x83b6('0x5'));module[_0x83b6('0x6')]=function(_0x534615,_0x5db315){return _0x534615['define'](_0x83b6('0x7'),attributes,{'tableName':'report_agent_preview','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.rpc.js b/server/api/reportAgentPreview/reportAgentPreview.rpc.js index 936c278..22c768b 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 _0x432b=['bluebird','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','client','http','request','then','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','CreateReportAgentPreview','ReportAgentPreview','body','options','lodash','util','moment'];(function(_0x137da3,_0xa6277a){var _0x1ac46c=function(_0x49e68b){while(--_0x49e68b){_0x137da3['push'](_0x137da3['shift']());}};_0x1ac46c(++_0xa6277a);}(_0x432b,0x183));var _0xb432=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x432b[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xb432('0x0'));var util=require(_0xb432('0x1'));var moment=require(_0xb432('0x2'));var BPromise=require(_0xb432('0x3'));var rs=require(_0xb432('0x4'));var fs=require('fs');var Redis=require(_0xb432('0x5'));var db=require(_0xb432('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xb432('0x7'));var config=require('../../config/environment');var jayson=require(_0xb432('0x8'));var client=jayson[_0xb432('0x9')][_0xb432('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x485839,_0x50c191,_0x2b9b5d){return new BPromise(function(_0x4a7518,_0x3ae2ae){return client[_0xb432('0xb')](_0x485839,_0x2b9b5d)[_0xb432('0xc')](function(_0x533f99){logger[_0xb432('0xd')](_0xb432('0xe'),_0x50c191,_0xb432('0xf'));logger[_0xb432('0x10')]('ReportAgentPreview,\x20%s,\x20%s,\x20%s',_0x50c191,'request\x20sent',JSON[_0xb432('0x11')](_0x533f99));if(_0x533f99[_0xb432('0x12')]){if(_0x533f99['error'][_0xb432('0x13')]===0x1f4){logger[_0xb432('0x12')](_0xb432('0xe'),_0x50c191,_0x533f99[_0xb432('0x12')]['message']);return _0x3ae2ae(_0x533f99['error'][_0xb432('0x14')]);}logger[_0xb432('0x12')](_0xb432('0xe'),_0x50c191,_0x533f99[_0xb432('0x12')]['message']);return _0x4a7518(_0x533f99[_0xb432('0x12')][_0xb432('0x14')]);}else{logger[_0xb432('0xd')](_0xb432('0xe'),_0x50c191,'request\x20sent');_0x4a7518(_0x533f99['result'][_0xb432('0x14')]);}})[_0xb432('0x15')](function(_0x39fa72){logger[_0xb432('0x12')](_0xb432('0xe'),_0x50c191,_0x39fa72);_0x3ae2ae(_0x39fa72);});});}exports[_0xb432('0x16')]=function(_0x52a9ee){var _0x5482a6=this;return new Promise(function(_0x399cb0,_0x596d4c){return db[_0xb432('0x17')]['create'](_0x52a9ee[_0xb432('0x18')],{'raw':_0x52a9ee[_0xb432('0x19')]?_0x52a9ee[_0xb432('0x19')]['raw']===undefined?!![]:![]:!![]})[_0xb432('0xc')](function(_0x4017b5){logger[_0xb432('0xd')](_0xb432('0x16'),_0x52a9ee);logger['debug'](_0xb432('0x16'),_0x52a9ee,JSON[_0xb432('0x11')](_0x4017b5));_0x399cb0(_0x4017b5);})['catch'](function(_0x4c4325){logger[_0xb432('0x12')]('CreateReportAgentPreview',_0x4c4325[_0xb432('0x14')],_0x52a9ee);_0x596d4c(_0x5482a6[_0xb432('0x12')](0x1f4,_0x4c4325[_0xb432('0x14')]));});});}; \ No newline at end of file +var _0x80c9=['ReportAgentPreview','create','body','options','raw','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','code','message','CreateReportAgentPreview'];(function(_0x36d955,_0x2a6d31){var _0x1a9a6b=function(_0x3189d5){while(--_0x3189d5){_0x36d955['push'](_0x36d955['shift']());}};_0x1a9a6b(++_0x2a6d31);}(_0x80c9,0xba));var _0x980c=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x80c9[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x980c('0x0'));var util=require(_0x980c('0x1'));var moment=require(_0x980c('0x2'));var BPromise=require(_0x980c('0x3'));var rs=require(_0x980c('0x4'));var fs=require('fs');var Redis=require(_0x980c('0x5'));var db=require(_0x980c('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x980c('0x7'))(_0x980c('0x8'));var config=require(_0x980c('0x9'));var jayson=require(_0x980c('0xa'));var client=jayson[_0x980c('0xb')][_0x980c('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x562864,_0x4b064d,_0x32feda){return new BPromise(function(_0x52273c,_0x8279c2){return client['request'](_0x562864,_0x32feda)[_0x980c('0xd')](function(_0x99e4f0){logger[_0x980c('0xe')](_0x980c('0xf'),_0x4b064d,_0x980c('0x10'));logger[_0x980c('0x11')](_0x980c('0x12'),_0x4b064d,_0x980c('0x10'),JSON[_0x980c('0x13')](_0x99e4f0));if(_0x99e4f0[_0x980c('0x14')]){if(_0x99e4f0[_0x980c('0x14')][_0x980c('0x15')]===0x1f4){logger['error'](_0x980c('0xf'),_0x4b064d,_0x99e4f0['error']['message']);return _0x8279c2(_0x99e4f0[_0x980c('0x14')][_0x980c('0x16')]);}logger['error'](_0x980c('0xf'),_0x4b064d,_0x99e4f0[_0x980c('0x14')][_0x980c('0x16')]);return _0x52273c(_0x99e4f0[_0x980c('0x14')][_0x980c('0x16')]);}else{logger['info'](_0x980c('0xf'),_0x4b064d,_0x980c('0x10'));_0x52273c(_0x99e4f0['result'][_0x980c('0x16')]);}})['catch'](function(_0xe6e110){logger[_0x980c('0x14')]('ReportAgentPreview,\x20%s,\x20%s',_0x4b064d,_0xe6e110);_0x8279c2(_0xe6e110);});});}exports[_0x980c('0x17')]=function(_0x1450be){var _0x206103=this;return new Promise(function(_0x4f423b,_0x2f1a3d){return db[_0x980c('0x18')][_0x980c('0x19')](_0x1450be[_0x980c('0x1a')],{'raw':_0x1450be[_0x980c('0x1b')]?_0x1450be[_0x980c('0x1b')][_0x980c('0x1c')]===undefined?!![]:![]:!![]})[_0x980c('0xd')](function(_0x19bf74){logger['info'](_0x980c('0x17'),_0x1450be);logger[_0x980c('0x11')](_0x980c('0x17'),_0x1450be,JSON['stringify'](_0x19bf74));_0x4f423b(_0x19bf74);})[_0x980c('0x1d')](function(_0x397d78){logger[_0x980c('0x14')](_0x980c('0x17'),_0x397d78[_0x980c('0x16')],_0x1450be);_0x2f1a3d(_0x206103['error'](0x1f4,_0x397d78[_0x980c('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index 97ff38c..dc0bc49 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 _0xb3f4=['/mail/queues/:id/notify','queueNotify','/mail/queues/:id','showMailQueues','post','/chat/queues/:id/notify','chat','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','fax','/fax/queues/:id','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','/sms/queues/:id/notify','sms','whatsapp','/sms/queues/:id','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','agentNotify','exports','multer','util','path','express','Router','../../components/auth/service','./rpc.controller','get','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','/chat/queues','/mail/queues','mailQueues','/mail/accounts','mailAccounts','/openchannel/queues','openchannelQueues','/sms/queues','smsQueues','/fax/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','put','updateVoiceQueue','/outbound','outboundChannels','/agents/:id/capacity','telephones','/trunks','trunks','campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','/mail/queues/waitinginteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','/fax/queues/waitinginteractions'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb3f4,0x69));var _0x4b3f=function(_0x1f1209,_0x1ae8db){_0x1f1209=_0x1f1209-0x0;var _0x415d28=_0xb3f4[_0x1f1209];return _0x415d28;};'use strict';var multer=require(_0x4b3f('0x0'));var util=require(_0x4b3f('0x1'));var path=require(_0x4b3f('0x2'));var express=require(_0x4b3f('0x3'));var router=express[_0x4b3f('0x4')]();var auth=require(_0x4b3f('0x5'));var controller=require(_0x4b3f('0x6'));router[_0x4b3f('0x7')]('/voice/channels',auth[_0x4b3f('0x8')](),controller[_0x4b3f('0x9')]);router[_0x4b3f('0x7')](_0x4b3f('0xa'),auth[_0x4b3f('0x8')](),controller[_0x4b3f('0xb')]);router[_0x4b3f('0x7')](_0x4b3f('0xc'),auth[_0x4b3f('0x8')](),controller[_0x4b3f('0xd')]);router[_0x4b3f('0x7')](_0x4b3f('0xe'),auth[_0x4b3f('0x8')](),controller['voiceQueues']);router[_0x4b3f('0x7')](_0x4b3f('0xf'),auth['isAuthenticated'](),controller['chatQueues']);router['get'](_0x4b3f('0x10'),auth[_0x4b3f('0x8')](),controller[_0x4b3f('0x11')]);router[_0x4b3f('0x7')](_0x4b3f('0x12'),auth[_0x4b3f('0x8')](),controller[_0x4b3f('0x13')]);router[_0x4b3f('0x7')](_0x4b3f('0x14'),auth[_0x4b3f('0x8')](),controller[_0x4b3f('0x15')]);router[_0x4b3f('0x7')](_0x4b3f('0x16'),auth['isAuthenticated'](),controller[_0x4b3f('0x17')]);router[_0x4b3f('0x7')]('/whatsapp/queues',auth['isAuthenticated'](),controller['whatsappQueues']);router[_0x4b3f('0x7')](_0x4b3f('0x18'),auth[_0x4b3f('0x8')](),controller[_0x4b3f('0x19')]);router[_0x4b3f('0x7')](_0x4b3f('0x1a'),auth[_0x4b3f('0x8')](),controller[_0x4b3f('0x1b')]);router[_0x4b3f('0x7')](_0x4b3f('0x1c'),auth[_0x4b3f('0x8')](),controller[_0x4b3f('0x1d')]);router[_0x4b3f('0x7')](_0x4b3f('0x1e'),auth[_0x4b3f('0x8')](),controller[_0x4b3f('0x1f')]);router[_0x4b3f('0x7')](_0x4b3f('0x20'),auth[_0x4b3f('0x8')](),controller[_0x4b3f('0x21')]);router[_0x4b3f('0x7')](_0x4b3f('0x22'),auth['isAuthenticated'](),controller[_0x4b3f('0x23')]);router['get'](_0x4b3f('0x24'),auth[_0x4b3f('0x8')](),controller[_0x4b3f('0x25')]);router[_0x4b3f('0x26')](_0x4b3f('0x24'),auth['isAuthenticated'](),controller[_0x4b3f('0x27')]);router[_0x4b3f('0x7')](_0x4b3f('0x28'),auth[_0x4b3f('0x8')](),controller['outbound']);router[_0x4b3f('0x7')]('/outbound/channels',auth[_0x4b3f('0x8')](),controller[_0x4b3f('0x29')]);router[_0x4b3f('0x7')]('/agents',auth[_0x4b3f('0x8')](),controller['agents']);router['put'](_0x4b3f('0x2a'),auth[_0x4b3f('0x8')](),controller['agentCapacity']);router[_0x4b3f('0x7')]('/telephones',auth[_0x4b3f('0x8')](),controller[_0x4b3f('0x2b')]);router[_0x4b3f('0x7')](_0x4b3f('0x2c'),auth[_0x4b3f('0x8')](),controller[_0x4b3f('0x2d')]);router[_0x4b3f('0x7')]('/campaigns',auth['isAuthenticated'](),controller[_0x4b3f('0x2e')]);router[_0x4b3f('0x7')](_0x4b3f('0x2f'),auth['isAuthenticated'](),controller[_0x4b3f('0x30')]);router[_0x4b3f('0x7')](_0x4b3f('0x31'),auth[_0x4b3f('0x8')](),controller['chatQueuesWaitingInteractions']);router[_0x4b3f('0x7')](_0x4b3f('0x32'),auth[_0x4b3f('0x8')](),controller['mailQueuesWaitingInteractions']);router[_0x4b3f('0x7')](_0x4b3f('0x33'),auth[_0x4b3f('0x8')](),controller[_0x4b3f('0x34')]);router[_0x4b3f('0x7')](_0x4b3f('0x35'),auth[_0x4b3f('0x8')](),controller['openchannelQueuesIdWaitingInteractions']);router['get']('/sms/queues/waitinginteractions',auth[_0x4b3f('0x8')](),controller[_0x4b3f('0x36')]);router['get'](_0x4b3f('0x37'),auth[_0x4b3f('0x8')](),controller['whatsappQueuesWaitingInteractions']);router['get'](_0x4b3f('0x38'),auth[_0x4b3f('0x8')](),controller['faxQueuesWaitingInteractions']);router['post'](_0x4b3f('0x39'),auth[_0x4b3f('0x8')](),controller[_0x4b3f('0x3a')]('mail'));router['get'](_0x4b3f('0x3b'),auth[_0x4b3f('0x8')](),controller[_0x4b3f('0x3c')]);router[_0x4b3f('0x3d')](_0x4b3f('0x3e'),auth[_0x4b3f('0x8')](),controller['queueNotify'](_0x4b3f('0x3f')));router[_0x4b3f('0x7')](_0x4b3f('0x40'),auth[_0x4b3f('0x8')](),controller[_0x4b3f('0x41')]);router[_0x4b3f('0x3d')](_0x4b3f('0x42'),auth[_0x4b3f('0x8')](),controller[_0x4b3f('0x3a')](_0x4b3f('0x43')));router[_0x4b3f('0x7')](_0x4b3f('0x44'),auth['isAuthenticated'](),controller['showFaxQueues']);router['post'](_0x4b3f('0x45'),auth[_0x4b3f('0x8')](),controller[_0x4b3f('0x3a')](_0x4b3f('0x46')));router[_0x4b3f('0x7')](_0x4b3f('0x47'),auth[_0x4b3f('0x8')](),controller['showOpenchannelQueues']);router['post'](_0x4b3f('0x48'),auth['isAuthenticated'](),controller[_0x4b3f('0x3a')](_0x4b3f('0x49')));router[_0x4b3f('0x3d')]('/whatsapp/queues/:id/notify',auth[_0x4b3f('0x8')](),controller['queueNotify'](_0x4b3f('0x4a')));router[_0x4b3f('0x7')](_0x4b3f('0x4b'),auth[_0x4b3f('0x8')](),controller['showSmsQueues']);router[_0x4b3f('0x7')](_0x4b3f('0x4c'),auth[_0x4b3f('0x8')](),controller[_0x4b3f('0x4d')]);router[_0x4b3f('0x3d')](_0x4b3f('0x4e'),auth[_0x4b3f('0x8')](),controller[_0x4b3f('0x4f')]);module[_0x4b3f('0x50')]=router; \ No newline at end of file +var _0x7b8f=['showWhatsappQueues','/agents/:id/notify','agentNotify','multer','util','path','express','Router','../../components/auth/service','./rpc.controller','get','/voice/channels','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','/chat/queues','chatQueues','/mail/accounts','whatsappQueues','/fax/queues','voiceQueuesPreview','/voice/queues/channels','/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','/telephones','telephones','/trunks','trunks','/campaigns','campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','post','queueNotify','/chat/queues/:id/notify','chat','showChatQueues','/fax/queues/:id/notify','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id'];(function(_0x65170b,_0x1f68c2){var _0x2d918b=function(_0xd95454){while(--_0xd95454){_0x65170b['push'](_0x65170b['shift']());}};_0x2d918b(++_0x1f68c2);}(_0x7b8f,0x1cb));var _0xf7b8=function(_0x2f8aa5,_0x2cf56a){_0x2f8aa5=_0x2f8aa5-0x0;var _0x5800c=_0x7b8f[_0x2f8aa5];return _0x5800c;};'use strict';var multer=require(_0xf7b8('0x0'));var util=require(_0xf7b8('0x1'));var path=require(_0xf7b8('0x2'));var express=require(_0xf7b8('0x3'));var router=express[_0xf7b8('0x4')]();var auth=require(_0xf7b8('0x5'));var controller=require(_0xf7b8('0x6'));router[_0xf7b8('0x7')](_0xf7b8('0x8'),auth[_0xf7b8('0x9')](),controller[_0xf7b8('0xa')]);router[_0xf7b8('0x7')](_0xf7b8('0xb'),auth[_0xf7b8('0x9')](),controller['voiceChannelMixMonitor']);router[_0xf7b8('0x7')](_0xf7b8('0xc'),auth[_0xf7b8('0x9')](),controller[_0xf7b8('0xd')]);router[_0xf7b8('0x7')](_0xf7b8('0xe'),auth[_0xf7b8('0x9')](),controller[_0xf7b8('0xf')]);router[_0xf7b8('0x7')](_0xf7b8('0x10'),auth[_0xf7b8('0x9')](),controller[_0xf7b8('0x11')]);router[_0xf7b8('0x7')]('/mail/queues',auth[_0xf7b8('0x9')](),controller['mailQueues']);router[_0xf7b8('0x7')](_0xf7b8('0x12'),auth[_0xf7b8('0x9')](),controller['mailAccounts']);router['get']('/openchannel/queues',auth['isAuthenticated'](),controller['openchannelQueues']);router[_0xf7b8('0x7')]('/sms/queues',auth[_0xf7b8('0x9')](),controller['smsQueues']);router[_0xf7b8('0x7')]('/whatsapp/queues',auth[_0xf7b8('0x9')](),controller[_0xf7b8('0x13')]);router[_0xf7b8('0x7')](_0xf7b8('0x14'),auth[_0xf7b8('0x9')](),controller['faxQueues']);router[_0xf7b8('0x7')]('/voice/queues/preview/:id',auth[_0xf7b8('0x9')](),controller[_0xf7b8('0x15')]);router['get'](_0xf7b8('0x16'),auth['isAuthenticated'](),controller['voiceQueuesChannels']);router['get'](_0xf7b8('0x17'),auth[_0xf7b8('0x9')](),controller[_0xf7b8('0x18')]);router['get'](_0xf7b8('0x19'),auth[_0xf7b8('0x9')](),controller['voiceQueuesChannelHangup']);router['get'](_0xf7b8('0x1a'),auth['isAuthenticated'](),controller['voiceQueuesChannelRedirect']);router[_0xf7b8('0x7')](_0xf7b8('0x1b'),auth[_0xf7b8('0x9')](),controller[_0xf7b8('0x1c')]);router[_0xf7b8('0x1d')](_0xf7b8('0x1b'),auth[_0xf7b8('0x9')](),controller[_0xf7b8('0x1e')]);router[_0xf7b8('0x7')](_0xf7b8('0x1f'),auth[_0xf7b8('0x9')](),controller[_0xf7b8('0x20')]);router[_0xf7b8('0x7')](_0xf7b8('0x21'),auth['isAuthenticated'](),controller[_0xf7b8('0x22')]);router[_0xf7b8('0x7')](_0xf7b8('0x23'),auth['isAuthenticated'](),controller[_0xf7b8('0x24')]);router['put'](_0xf7b8('0x25'),auth[_0xf7b8('0x9')](),controller['agentCapacity']);router['get'](_0xf7b8('0x26'),auth['isAuthenticated'](),controller[_0xf7b8('0x27')]);router['get'](_0xf7b8('0x28'),auth['isAuthenticated'](),controller[_0xf7b8('0x29')]);router[_0xf7b8('0x7')](_0xf7b8('0x2a'),auth[_0xf7b8('0x9')](),controller[_0xf7b8('0x2b')]);router['get'](_0xf7b8('0x2c'),auth[_0xf7b8('0x9')](),controller[_0xf7b8('0x2d')]);router[_0xf7b8('0x7')](_0xf7b8('0x2e'),auth[_0xf7b8('0x9')](),controller[_0xf7b8('0x2f')]);router[_0xf7b8('0x7')]('/mail/queues/waitinginteractions',auth[_0xf7b8('0x9')](),controller[_0xf7b8('0x30')]);router[_0xf7b8('0x7')](_0xf7b8('0x31'),auth['isAuthenticated'](),controller['openchannelQueuesWaitingInteractions']);router[_0xf7b8('0x7')](_0xf7b8('0x32'),auth[_0xf7b8('0x9')](),controller[_0xf7b8('0x33')]);router[_0xf7b8('0x7')](_0xf7b8('0x34'),auth['isAuthenticated'](),controller[_0xf7b8('0x35')]);router['get'](_0xf7b8('0x36'),auth[_0xf7b8('0x9')](),controller[_0xf7b8('0x37')]);router[_0xf7b8('0x7')](_0xf7b8('0x38'),auth[_0xf7b8('0x9')](),controller['faxQueuesWaitingInteractions']);router[_0xf7b8('0x39')]('/mail/queues/:id/notify',auth['isAuthenticated'](),controller[_0xf7b8('0x3a')]('mail'));router[_0xf7b8('0x7')]('/mail/queues/:id',auth[_0xf7b8('0x9')](),controller['showMailQueues']);router['post'](_0xf7b8('0x3b'),auth[_0xf7b8('0x9')](),controller[_0xf7b8('0x3a')](_0xf7b8('0x3c')));router[_0xf7b8('0x7')]('/chat/queues/:id',auth[_0xf7b8('0x9')](),controller[_0xf7b8('0x3d')]);router[_0xf7b8('0x39')](_0xf7b8('0x3e'),auth[_0xf7b8('0x9')](),controller['queueNotify']('fax'));router['get'](_0xf7b8('0x3f'),auth['isAuthenticated'](),controller[_0xf7b8('0x40')]);router[_0xf7b8('0x39')](_0xf7b8('0x41'),auth[_0xf7b8('0x9')](),controller[_0xf7b8('0x3a')](_0xf7b8('0x42')));router[_0xf7b8('0x7')](_0xf7b8('0x43'),auth[_0xf7b8('0x9')](),controller['showOpenchannelQueues']);router['post'](_0xf7b8('0x44'),auth[_0xf7b8('0x9')](),controller[_0xf7b8('0x3a')](_0xf7b8('0x45')));router[_0xf7b8('0x39')](_0xf7b8('0x46'),auth[_0xf7b8('0x9')](),controller[_0xf7b8('0x3a')](_0xf7b8('0x47')));router[_0xf7b8('0x7')](_0xf7b8('0x48'),auth[_0xf7b8('0x9')](),controller['showSmsQueues']);router[_0xf7b8('0x7')]('/whatsapp/queues/:id',auth['isAuthenticated'](),controller[_0xf7b8('0x49')]);router[_0xf7b8('0x39')](_0xf7b8('0x4a'),auth[_0xf7b8('0x9')](),controller[_0xf7b8('0x4b')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index 34196fe..795ef17 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 _0x28f4=['YYYY-MM-DD\x20HH:mm:ss','updateAttributes','findOrCreate','INTERACTION','interface','SIP/%s','agent','internal','AgentCapacity','capacity','telephones','trunks','Trunks','campaigns','chatQueues','ChatQueues','showChatQueues','mailQueues','MailQueues','showMailQueues','MailAccounts','showOpenchannelQueues','OpenchannelQueues','smsQueues','showSmsQueues','SmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','faxQueues','FaxQueues','showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','map','queue_id','uniq','value','indexOf','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','chat','Website','Account','Queue','findOne','\x20Queue\x20not\x20found','messageId','Interaction','\x20Message\x20not\x20found','queue','MessageId','From','QueueId','TransferReport','create','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','User','Message','update','InteractionId','Start','agentTransferTimeout','bluebird','moment','lodash','util','api','jayson/promise','client','http','then','error','message','result','catch','json','sendStatus','stack','name','status','send','isNil','find','rows','voiceChannels','VoiceChannelMixMonitor','query','voiceChannelStopMixMonitor','merge','params','voiceQueues','showVoiceQueues','VoiceQueues','updateVoiceQueue','body','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelRedirect','Outbound','outboundChannels','OutboundChannels','Agents','agentCapacity','interaction','user','hasOwnProperty','MemberReport','length','format'];(function(_0x5654ed,_0x4514fa){var _0x2331c1=function(_0x822516){while(--_0x822516){_0x5654ed['push'](_0x5654ed['shift']());}};_0x2331c1(++_0x4514fa);}(_0x28f4,0xcf));var _0x428f=function(_0x49514a,_0x434404){_0x49514a=_0x49514a-0x0;var _0x1ba7f6=_0x28f4[_0x49514a];return _0x1ba7f6;};'use strict';var BPromise=require(_0x428f('0x0'));var moment=require(_0x428f('0x1'));var _=require(_0x428f('0x2'));var util=require(_0x428f('0x3'));var db=require('../../mysqldb')['db'];var logger=require('../../config/logger')(_0x428f('0x4'));var jayson=require(_0x428f('0x5'));var amiClient=jayson[_0x428f('0x6')]['http']({'port':0x232a});var mailClient=jayson[_0x428f('0x6')][_0x428f('0x7')]({'port':0x232b});var routingClient=jayson[_0x428f('0x6')]['http']({'port':0x232c});function respondWithRpcPromise(_0x100150,_0x25a5d3,_0x58d839){return new BPromise(function(_0x47babe,_0x1b570e){var _0x2deb26=_0x58d839?_0x58d839:amiClient;return _0x2deb26['request'](_0x100150,_0x25a5d3)[_0x428f('0x8')](function(_0x24d11c){if(_0x24d11c[_0x428f('0x9')]){if(_0x24d11c['error']['code']===0x1f4){return _0x1b570e(_0x24d11c['error'][_0x428f('0xa')]);}return _0x47babe(_0x24d11c[_0x428f('0x9')][_0x428f('0xa')]);}else{_0x47babe(_0x24d11c[_0x428f('0xb')]);}})[_0x428f('0xc')](function(_0x131f08){_0x1b570e(_0x131f08);});});}function respondWithResult(_0x371813,_0x59ed06){_0x59ed06=_0x59ed06||0xc8;return function(_0x415ebb){if(_0x415ebb){return _0x371813['status'](_0x59ed06)[_0x428f('0xd')](_0x415ebb);}return _0x371813[_0x428f('0xe')](0x194);};}function handleError(_0x4dcedc,_0xe95317){_0xe95317=_0xe95317||0x1f4;return function(_0x582d93){logger[_0x428f('0x9')](_0x582d93[_0x428f('0xf')]);if(_0x582d93[_0x428f('0x10')]){delete _0x582d93[_0x428f('0x10')];}_0x4dcedc[_0x428f('0x11')](_0xe95317)[_0x428f('0x12')](_0x582d93);};}function findById(_0x4ff24c){return function(_0x559098){if(!_[_0x428f('0x13')](_0x4ff24c)&&!_['isNil'](_0x559098)&&!_['isNil'](_0x559098['rows'])){return _[_0x428f('0x14')](_0x559098[_0x428f('0x15')],function(_0x367d20){return _0x367d20['id']==_0x4ff24c;});}return null;};}exports[_0x428f('0x16')]=function(_0x4f5802,_0x5e2905){return respondWithRpcPromise('VoiceChannels',_0x4f5802['query'])[_0x428f('0x8')](respondWithResult(_0x5e2905,null))[_0x428f('0xc')](handleError(_0x5e2905,null));};exports['voiceChannelMixMonitor']=function(_0x295d6c,_0x4773a4){return respondWithRpcPromise(_0x428f('0x17'),_['merge'](_0x295d6c[_0x428f('0x18')],_0x295d6c['params']))[_0x428f('0x8')](respondWithResult(_0x4773a4,null))[_0x428f('0xc')](handleError(_0x4773a4,null));};exports[_0x428f('0x19')]=function(_0x1227bb,_0x1d910e){return respondWithRpcPromise('VoiceChannelStopMixMonitor',_[_0x428f('0x1a')](_0x1227bb[_0x428f('0x18')],_0x1227bb[_0x428f('0x1b')]))['then'](respondWithResult(_0x1d910e,null))[_0x428f('0xc')](handleError(_0x1d910e,null));};exports[_0x428f('0x1c')]=function(_0x5719fc,_0x33227d){return respondWithRpcPromise('VoiceQueues',_0x5719fc['query'])[_0x428f('0x8')](respondWithResult(_0x33227d,null))[_0x428f('0xc')](handleError(_0x33227d,null));};exports[_0x428f('0x1d')]=function(_0x38c069,_0x4c7ba2){return respondWithRpcPromise(_0x428f('0x1e'),_0x38c069[_0x428f('0x18')])['then'](findById(_0x38c069[_0x428f('0x1b')]['id']))[_0x428f('0x8')](respondWithResult(_0x4c7ba2,null))[_0x428f('0xc')](handleError(_0x4c7ba2,null));};exports[_0x428f('0x1f')]=function(_0x160204,_0x353112){return respondWithRpcPromise('UpdateVoiceQueue',_[_0x428f('0x1a')](_0x160204[_0x428f('0x20')],_0x160204[_0x428f('0x1b')]))[_0x428f('0x8')](respondWithResult(_0x353112,null))['catch'](handleError(_0x353112,null));};exports['voiceQueuesPreview']=function(_0x2482e3,_0x5725ca){return respondWithRpcPromise(_0x428f('0x21'),_[_0x428f('0x1a')](_0x2482e3[_0x428f('0x18')],_0x2482e3[_0x428f('0x1b')]))[_0x428f('0x8')](respondWithResult(_0x5725ca,null))['catch'](handleError(_0x5725ca,null));};exports[_0x428f('0x22')]=function(_0x4f5119,_0x5ca1ec){return respondWithRpcPromise(_0x428f('0x23'),_0x4f5119['query'])['then'](respondWithResult(_0x5ca1ec,null))[_0x428f('0xc')](handleError(_0x5ca1ec,null));};exports[_0x428f('0x24')]=function(_0x117d5b,_0x3a4f87){return respondWithRpcPromise(_0x428f('0x25'),_[_0x428f('0x1a')](_0x117d5b[_0x428f('0x18')],_0x117d5b[_0x428f('0x1b')]))['then'](respondWithResult(_0x3a4f87,null))[_0x428f('0xc')](handleError(_0x3a4f87,null));};exports[_0x428f('0x26')]=function(_0x2900d6,_0x13f8d8){return respondWithRpcPromise('VoiceQueuesChannelHangup',_[_0x428f('0x1a')](_0x2900d6[_0x428f('0x18')],_0x2900d6['params']))[_0x428f('0x8')](respondWithResult(_0x13f8d8,null))[_0x428f('0xc')](handleError(_0x13f8d8,null));};exports['voiceQueuesChannelRedirect']=function(_0x356b4c,_0xdac43c){return respondWithRpcPromise(_0x428f('0x27'),_[_0x428f('0x1a')](_0x356b4c[_0x428f('0x18')],_0x356b4c['params']))[_0x428f('0x8')](respondWithResult(_0xdac43c,null))[_0x428f('0xc')](handleError(_0xdac43c,null));};exports['outbound']=function(_0x59682e,_0x58f358){return respondWithRpcPromise(_0x428f('0x28'),_0x59682e[_0x428f('0x18')])[_0x428f('0x8')](respondWithResult(_0x58f358,null))['catch'](handleError(_0x58f358,null));};exports[_0x428f('0x29')]=function(_0xa4407f,_0x284abc){return respondWithRpcPromise(_0x428f('0x2a'),_0xa4407f[_0x428f('0x18')])['then'](respondWithResult(_0x284abc,null))[_0x428f('0xc')](handleError(_0x284abc,null));};exports['agents']=function(_0x464585,_0x2d59a0){var _0x5d7115;return respondWithRpcPromise(_0x428f('0x2b'),_0x464585['query'])['then'](function(_0xd4675a){_0x5d7115=_0xd4675a;return respondWithRpcPromise(_0x428f('0x2b'),_0x464585['query'],routingClient);})[_0x428f('0x8')](function(_0x55ae7d){return _[_0x428f('0x1a')]({},_0x55ae7d,_0x5d7115);})[_0x428f('0x8')](respondWithResult(_0x2d59a0,null))['catch'](handleError(_0x2d59a0,null));};exports[_0x428f('0x2c')]=function(_0x392167,_0x451cfc){if(_0x392167['body']&&_0x392167[_0x428f('0x20')][_0x428f('0x2d')]&&_0x392167[_0x428f('0x2e')]&&_0x392167[_0x428f('0x2e')][_0x428f('0x10')]){for(var _0x31ec2f in _0x392167['body'][_0x428f('0x2d')]){if(_0x392167[_0x428f('0x20')]['interaction'][_0x428f('0x2f')](_0x31ec2f)){db[_0x428f('0x30')]['findAll']({'where':{'channel':_0x31ec2f,'membername':_0x392167[_0x428f('0x2e')][_0x428f('0x10')],'type':'INTERACTION','exitAt':null,'uniqueid':_0x392167[_0x428f('0x20')]['interaction'][_0x31ec2f]&&_0x392167[_0x428f('0x20')]['interaction'][_0x31ec2f][_0x428f('0x31')]?{'$notIn':_0x392167[_0x428f('0x20')][_0x428f('0x2d')][_0x31ec2f]}:{'$ne':null}}})[_0x428f('0x8')](function(_0x1727db){var _0xc6bfa5=moment()[_0x428f('0x32')](_0x428f('0x33'));for(var _0x3cf2d8=0x0,_0x18a263=_0x1727db[_0x428f('0x31')];_0x3cf2d8<_0x18a263;_0x3cf2d8+=0x1){_0x1727db[_0x3cf2d8][_0x428f('0x34')]({'exitAt':_0xc6bfa5});}});for(var _0x1b9390=0x0;_0x1b9390<_0x392167[_0x428f('0x20')][_0x428f('0x2d')][_0x31ec2f][_0x428f('0x31')];_0x1b9390+=0x1){db['MemberReport'][_0x428f('0x35')]({'where':{'channel':_0x31ec2f,'membername':_0x392167[_0x428f('0x2e')][_0x428f('0x10')],'type':_0x428f('0x36'),'uniqueid':_0x392167[_0x428f('0x20')][_0x428f('0x2d')][_0x31ec2f][_0x1b9390],'exitAt':null},'defaults':{'channel':_0x31ec2f,'membername':_0x392167['user'][_0x428f('0x10')],'interface':_['isNil'](_0x392167[_0x428f('0x2e')][_0x428f('0x37')])?util[_0x428f('0x32')](_0x428f('0x38'),_0x392167[_0x428f('0x2e')][_0x428f('0x10')]):_0x392167['user'][_0x428f('0x37')],'type':'INTERACTION','enterAt':moment()[_0x428f('0x32')](_0x428f('0x33')),'role':_0x428f('0x39'),'internal':_0x392167['user'][_0x428f('0x3a')],'uniqueid':_0x392167[_0x428f('0x20')][_0x428f('0x2d')][_0x31ec2f][_0x1b9390]}});}}}}return respondWithRpcPromise(_0x428f('0x3b'),{'id':_0x392167[_0x428f('0x1b')]['id'],'capacity':_0x392167[_0x428f('0x20')][_0x428f('0x3c')]},routingClient)[_0x428f('0x8')](respondWithResult(_0x451cfc,null))[_0x428f('0xc')](handleError(_0x451cfc,null));};exports[_0x428f('0x3d')]=function(_0xd1ccf9,_0x48afb3){return respondWithRpcPromise('Telephones',_0xd1ccf9[_0x428f('0x18')])[_0x428f('0x8')](respondWithResult(_0x48afb3,null))[_0x428f('0xc')](handleError(_0x48afb3,null));};exports[_0x428f('0x3e')]=function(_0x3751a7,_0x3bf4e4){return respondWithRpcPromise(_0x428f('0x3f'),_0x3751a7[_0x428f('0x18')])['then'](respondWithResult(_0x3bf4e4,null))[_0x428f('0xc')](handleError(_0x3bf4e4,null));};exports[_0x428f('0x40')]=function(_0x4718ff,_0x3187e1){return respondWithRpcPromise('Campaigns',_0x4718ff[_0x428f('0x18')])[_0x428f('0x8')](respondWithResult(_0x3187e1,null))['catch'](handleError(_0x3187e1,null));};exports[_0x428f('0x41')]=function(_0x3ab345,_0x4df9d8){return respondWithRpcPromise(_0x428f('0x42'),_0x3ab345['query'],routingClient)['then'](respondWithResult(_0x4df9d8,null))[_0x428f('0xc')](handleError(_0x4df9d8,null));};exports[_0x428f('0x43')]=function(_0x57e611,_0x136524){return respondWithRpcPromise(_0x428f('0x42'),_0x57e611[_0x428f('0x18')],routingClient)[_0x428f('0x8')](findById(_0x57e611[_0x428f('0x1b')]['id']))['then'](respondWithResult(_0x136524,null))[_0x428f('0xc')](handleError(_0x136524,null));};exports[_0x428f('0x44')]=function(_0x58bdf5,_0x61a358){return respondWithRpcPromise(_0x428f('0x45'),_0x58bdf5[_0x428f('0x18')],routingClient)[_0x428f('0x8')](respondWithResult(_0x61a358,null))[_0x428f('0xc')](handleError(_0x61a358,null));};exports[_0x428f('0x46')]=function(_0x22bde2,_0x1f8641){return respondWithRpcPromise(_0x428f('0x45'),_0x22bde2[_0x428f('0x18')],routingClient)[_0x428f('0x8')](findById(_0x22bde2[_0x428f('0x1b')]['id']))[_0x428f('0x8')](respondWithResult(_0x1f8641,null))[_0x428f('0xc')](handleError(_0x1f8641,null));};exports['mailAccounts']=function(_0x2b1928,_0x19d1b1){return respondWithRpcPromise(_0x428f('0x47'),_0x2b1928['query'],mailClient)[_0x428f('0x8')](respondWithResult(_0x19d1b1,null))[_0x428f('0xc')](handleError(_0x19d1b1,null));};exports['openchannelQueues']=function(_0x2532fd,_0x2b8219){return respondWithRpcPromise('OpenchannelQueues',_0x2532fd[_0x428f('0x18')],routingClient)[_0x428f('0x8')](respondWithResult(_0x2b8219,null))['catch'](handleError(_0x2b8219,null));};exports[_0x428f('0x48')]=function(_0x122129,_0x1039dc){return respondWithRpcPromise(_0x428f('0x49'),_0x122129[_0x428f('0x18')],routingClient)[_0x428f('0x8')](findById(_0x122129[_0x428f('0x1b')]['id']))[_0x428f('0x8')](respondWithResult(_0x1039dc,null))[_0x428f('0xc')](handleError(_0x1039dc,null));};exports[_0x428f('0x4a')]=function(_0x497f15,_0x16ebfc){return respondWithRpcPromise('SmsQueues',_0x497f15[_0x428f('0x18')],routingClient)[_0x428f('0x8')](respondWithResult(_0x16ebfc,null))['catch'](handleError(_0x16ebfc,null));};exports[_0x428f('0x4b')]=function(_0x1d1a49,_0x6f6c2a){return respondWithRpcPromise(_0x428f('0x4c'),_0x1d1a49[_0x428f('0x18')],routingClient)[_0x428f('0x8')](findById(_0x1d1a49[_0x428f('0x1b')]['id']))[_0x428f('0x8')](respondWithResult(_0x6f6c2a,null))[_0x428f('0xc')](handleError(_0x6f6c2a,null));};exports[_0x428f('0x4d')]=function(_0x5c2fec,_0x14107f){return respondWithRpcPromise(_0x428f('0x4e'),_0x5c2fec['query'],routingClient)[_0x428f('0x8')](respondWithResult(_0x14107f,null))[_0x428f('0xc')](handleError(_0x14107f,null));};exports[_0x428f('0x4f')]=function(_0x2c752f,_0xb93e5a){return respondWithRpcPromise('WhatsappQueues',_0x2c752f['query'],routingClient)[_0x428f('0x8')](findById(_0x2c752f[_0x428f('0x1b')]['id']))[_0x428f('0x8')](respondWithResult(_0xb93e5a,null))[_0x428f('0xc')](handleError(_0xb93e5a,null));};exports[_0x428f('0x50')]=function(_0x4353f5,_0x5fd881){return respondWithRpcPromise(_0x428f('0x51'),_0x4353f5[_0x428f('0x18')],routingClient)['then'](respondWithResult(_0x5fd881,null))[_0x428f('0xc')](handleError(_0x5fd881,null));};exports[_0x428f('0x52')]=function(_0x2e7762,_0x5ace21){return respondWithRpcPromise(_0x428f('0x51'),_0x2e7762['query'],routingClient)[_0x428f('0x8')](findById(_0x2e7762[_0x428f('0x1b')]['id']))[_0x428f('0x8')](respondWithResult(_0x5ace21,null))[_0x428f('0xc')](handleError(_0x5ace21,null));};exports[_0x428f('0x53')]=function(_0x4c2cf3,_0x5cdbe4){return respondWithRpcPromise(_0x428f('0x54'),_0x4c2cf3[_0x428f('0x18')])[_0x428f('0x8')](respondWithResult(_0x5cdbe4,null))['catch'](handleError(_0x5cdbe4,null));};exports[_0x428f('0x55')]=function(_0x419db5,_0x164b21){return respondWithRpcPromise('ChatQueuesWaitingInteractions',_0x419db5[_0x428f('0x18')],routingClient)[_0x428f('0x8')](respondWithResult(_0x164b21,null))[_0x428f('0xc')](handleError(_0x164b21,null));};exports[_0x428f('0x56')]=function(_0x3f64aa,_0x25e804){return respondWithRpcPromise(_0x428f('0x57'),_0x3f64aa['query'],routingClient)[_0x428f('0x8')](respondWithResult(_0x25e804,null))[_0x428f('0xc')](handleError(_0x25e804,null));};exports[_0x428f('0x58')]=function(_0x24e536,_0x1ba275){return respondWithRpcPromise(_0x428f('0x59'),_0x24e536[_0x428f('0x18')],routingClient)['then'](respondWithResult(_0x1ba275,null))[_0x428f('0xc')](handleError(_0x1ba275,null));};exports[_0x428f('0x5a')]=function(_0x5b2ab3,_0x1b4f1e){return respondWithRpcPromise(_0x428f('0x59'),_0x5b2ab3['query'],routingClient)[_0x428f('0x8')](function(_0x1069f3){if(_0x5b2ab3[_0x428f('0x18')][_0x428f('0x5b')]!==undefined){var _0x18735a=_(_0x1069f3[_0x428f('0x15')])['filter']([_0x5b2ab3[_0x428f('0x18')][_0x428f('0x5b')],_0x5b2ab3[_0x428f('0x1b')]['id']])[_0x428f('0x5c')](_0x428f('0x5d'))[_0x428f('0x5e')]()[_0x428f('0x5f')]();return _0x1069f3[_0x428f('0x15')]['filter'](function(_0x20255a){return _0x18735a[_0x428f('0x60')](_0x20255a[_0x428f('0x5d')])>-0x1;});}else{return _0x1069f3[_0x428f('0x15')]['filter'](function(_0x2f7792){return _0x2f7792[_0x428f('0x5d')]===parseInt(_0x5b2ab3['params']['id']);});}})[_0x428f('0x8')](respondWithResult(_0x1b4f1e,null))[_0x428f('0xc')](handleError(_0x1b4f1e,null));};exports[_0x428f('0x61')]=function(_0x258813,_0x5454bc){return respondWithRpcPromise(_0x428f('0x62'),_0x258813['query'],routingClient)[_0x428f('0x8')](respondWithResult(_0x5454bc,null))[_0x428f('0xc')](handleError(_0x5454bc,null));};exports[_0x428f('0x63')]=function(_0x2c7ab5,_0x13c0aa){return respondWithRpcPromise('WhatsappQueuesWaitingInteractions',_0x2c7ab5['query'],routingClient)['then'](respondWithResult(_0x13c0aa,null))[_0x428f('0xc')](handleError(_0x13c0aa,null));};exports[_0x428f('0x64')]=function(_0x5df2d6,_0x2c3a86){return respondWithRpcPromise(_0x428f('0x65'),_0x5df2d6[_0x428f('0x18')],routingClient)[_0x428f('0x8')](respondWithResult(_0x2c3a86,null))[_0x428f('0xc')](handleError(_0x2c3a86,null));};exports[_0x428f('0x66')]=function(_0x185564){return function(_0x31fd5b,_0xc9e0c6){var _0x5cfb7a,_0x51f255;var _0x553123=_[_0x428f('0x67')](_0x185564);var _0x77db7e=_0x185564===_0x428f('0x68')?_0x428f('0x69'):_0x428f('0x6a');return db[_0x553123+_0x428f('0x6b')][_0x428f('0x6c')]({'raw':!![],'where':{'id':_0x31fd5b[_0x428f('0x1b')]['id']}})[_0x428f('0x8')](function(_0x54c1d2){if(_['isNil'](_0x54c1d2)){throw new Error(_0x553123+_0x428f('0x6d'));}_0x5cfb7a=_0x54c1d2;return db[_0x553123+'Message'][_0x428f('0x6c')]({'where':{'id':_0x31fd5b[_0x428f('0x20')][_0x428f('0x6e')]},'include':[{'model':db[_0x553123+_0x428f('0x6f')],'as':'Interaction'},{'model':db[_0x553123+_0x77db7e],'as':_0x428f('0x6a')}]});})['then'](function(_0x49a772){if(_[_0x428f('0x13')](_0x49a772)){throw new Error(_0x553123+_0x428f('0x70'));}_0x51f255=_0x49a772;return _0x49a772['update']({'read':0x0,'readAt':null,'UserId':null});})[_0x428f('0x8')](function(){var _0x15a215={'uniqueid':_0x185564+'.'+_0x51f255['id']+'.'+_0x51f255[_0x428f('0x6f')]['id'],'FromUserId':_0x31fd5b[_0x428f('0x2e')]['id'],'type':_0x428f('0x71')};_0x15a215[_0x553123+_0x428f('0x72')]=_0x51f255['id'];_0x15a215[_0x553123+'InteractionId']=_0x51f255[_0x428f('0x6f')]['id'];_0x15a215[_0x428f('0x73')+_0x553123+_0x77db7e+'Id']=_0x51f255[_0x428f('0x6a')]['id'];_0x15a215['To'+_0x553123+_0x428f('0x74')]=_0x5cfb7a['id'];return db[_0x553123+_0x428f('0x75')][_0x428f('0x76')](_0x15a215);})[_0x428f('0x8')](function(){return respondWithRpcPromise('Start',{'channel':_0x185564,'interaction':_0x51f255[_0x428f('0x6f')],'message':_0x51f255,'account':_0x51f255[_0x428f('0x6a')],'applications':[{'id':0x0,'priority':0x1,'app':_0x428f('0x71'),'appdata':_0x5cfb7a[_0x428f('0x10')]+','+(_0x51f255[_0x428f('0x6a')]['queueTransferTimeout']||0x12c),'interval':_0x428f('0x77')}]},routingClient);})[_0x428f('0x8')](respondWithResult(_0xc9e0c6,null))[_0x428f('0xc')](handleError(_0xc9e0c6,null));};};exports[_0x428f('0x78')]=function(_0x4e7985,_0x27b8df){var _0x39545b,_0x97691b;if(_['isNil'](_0x4e7985[_0x428f('0x20')][_0x428f('0x79')])){throw new Error(_0x428f('0x7a'));}var _0x531dd7=_0x4e7985[_0x428f('0x20')][_0x428f('0x79')];var _0x942750=_[_0x428f('0x67')](_0x531dd7);var _0x1d6e98=_0x531dd7==='chat'?_0x428f('0x69'):_0x428f('0x6a');return db[_0x428f('0x7b')][_0x428f('0x6c')]({'raw':!![],'where':{'id':_0x4e7985[_0x428f('0x1b')]['id'],'role':_0x428f('0x39')}})[_0x428f('0x8')](function(_0x1d83e3){if(_[_0x428f('0x13')](_0x1d83e3)){throw new Error('Agent\x20not\x20found');}_0x39545b=_0x1d83e3;return db[_0x942750+_0x428f('0x7c')][_0x428f('0x6c')]({'where':{'id':_0x4e7985[_0x428f('0x20')][_0x428f('0x6e')]},'include':[{'model':db[_0x942750+_0x428f('0x6f')],'as':'Interaction'},{'model':db[_0x942750+_0x1d6e98],'as':'Account'}]});})['then'](function(_0x2cd599){if(_[_0x428f('0x13')](_0x2cd599)){throw new Error(_0x942750+_0x428f('0x70'));}_0x97691b=_0x2cd599;return _0x2cd599[_0x428f('0x7d')]({'read':0x0,'readAt':null,'UserId':null});})[_0x428f('0x8')](function(){var _0x5f117d={'uniqueid':_0x531dd7+'.'+_0x97691b['id']+'.'+_0x97691b[_0x428f('0x6f')]['id'],'FromUserId':_0x4e7985[_0x428f('0x2e')]['id'],'type':_0x428f('0x39'),'ToUserId':_0x39545b['id']};_0x5f117d[_0x942750+_0x428f('0x72')]=_0x97691b['id'];_0x5f117d[_0x942750+_0x428f('0x7e')]=_0x97691b[_0x428f('0x6f')]['id'];_0x5f117d[_0x428f('0x73')+_0x942750+_0x1d6e98+'Id']=_0x97691b[_0x428f('0x6a')]['id'];return db[_0x942750+_0x428f('0x75')][_0x428f('0x76')](_0x5f117d);})[_0x428f('0x8')](function(){return respondWithRpcPromise(_0x428f('0x7f'),{'channel':_0x531dd7,'interaction':_0x97691b[_0x428f('0x6f')],'message':_0x97691b,'account':_0x97691b[_0x428f('0x6a')],'applications':[{'id':0x0,'priority':0x1,'app':_0x428f('0x39'),'appdata':_0x39545b[_0x428f('0x10')]+','+(_0x97691b[_0x428f('0x6a')][_0x428f('0x80')]||0x12c),'interval':_0x428f('0x77')}]},routingClient);})[_0x428f('0x8')](respondWithResult(_0x27b8df,null))[_0x428f('0xc')](handleError(_0x27b8df,null));}; \ No newline at end of file +var _0x4396=['openchannelQueues','OpenchannelQueues','smsQueues','SmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','faxQueues','FaxQueues','showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','type','filter','map','uniq','value','indexOf','queue_id','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','FaxQueuesWaitingInteractions','capitalize','chat','Website','Account','Queue','findOne','\x20Queue\x20not\x20found','messageId','Interaction','update','queue','MessageId','InteractionId','QueueId','TransferReport','Start','queueTransferTimeout','agentNotify','channel','Channel\x20field\x20is\x20mandatory','User','agent','Agent\x20not\x20found','\x20Message\x20not\x20found','agentTransferTimeout','*,*,*,*','bluebird','lodash','util','../../mysqldb','../../config/logger','api','jayson/promise','client','http','request','error','code','message','result','sendStatus','stack','name','status','isNil','rows','voiceChannels','VoiceChannels','query','then','VoiceChannelMixMonitor','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','params','VoiceQueues','catch','showVoiceQueues','updateVoiceQueue','UpdateVoiceQueue','merge','body','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelRedirect','Outbound','outboundChannels','OutboundChannels','Agents','agentCapacity','interaction','user','hasOwnProperty','MemberReport','findAll','INTERACTION','length','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','findOrCreate','interface','format','SIP/%s','AgentCapacity','capacity','telephones','Telephones','trunks','Trunks','campaigns','Campaigns','ChatQueues','mailQueues','MailQueues','MailAccounts'];(function(_0xf7bb65,_0x3d5d2f){var _0x4eb91c=function(_0x3bc7ec){while(--_0x3bc7ec){_0xf7bb65['push'](_0xf7bb65['shift']());}};_0x4eb91c(++_0x3d5d2f);}(_0x4396,0x134));var _0x6439=function(_0x1da811,_0x2e30db){_0x1da811=_0x1da811-0x0;var _0x53858b=_0x4396[_0x1da811];return _0x53858b;};'use strict';var BPromise=require(_0x6439('0x0'));var moment=require('moment');var _=require(_0x6439('0x1'));var util=require(_0x6439('0x2'));var db=require(_0x6439('0x3'))['db'];var logger=require(_0x6439('0x4'))(_0x6439('0x5'));var jayson=require(_0x6439('0x6'));var amiClient=jayson[_0x6439('0x7')][_0x6439('0x8')]({'port':0x232a});var mailClient=jayson[_0x6439('0x7')][_0x6439('0x8')]({'port':0x232b});var routingClient=jayson[_0x6439('0x7')][_0x6439('0x8')]({'port':0x232c});function respondWithRpcPromise(_0xc6a78a,_0x27227a,_0x3cbdc9){return new BPromise(function(_0x21a66a,_0x50f123){var _0x1ed149=_0x3cbdc9?_0x3cbdc9:amiClient;return _0x1ed149[_0x6439('0x9')](_0xc6a78a,_0x27227a)['then'](function(_0x49ba1d){if(_0x49ba1d[_0x6439('0xa')]){if(_0x49ba1d[_0x6439('0xa')][_0x6439('0xb')]===0x1f4){return _0x50f123(_0x49ba1d['error'][_0x6439('0xc')]);}return _0x21a66a(_0x49ba1d[_0x6439('0xa')]['message']);}else{_0x21a66a(_0x49ba1d[_0x6439('0xd')]);}})['catch'](function(_0x3ee606){_0x50f123(_0x3ee606);});});}function respondWithResult(_0x301561,_0x584a6c){_0x584a6c=_0x584a6c||0xc8;return function(_0x48e1f5){if(_0x48e1f5){return _0x301561['status'](_0x584a6c)['json'](_0x48e1f5);}return _0x301561[_0x6439('0xe')](0x194);};}function handleError(_0x2301aa,_0x1cbc24){_0x1cbc24=_0x1cbc24||0x1f4;return function(_0x5d20eb){logger[_0x6439('0xa')](_0x5d20eb[_0x6439('0xf')]);if(_0x5d20eb['name']){delete _0x5d20eb[_0x6439('0x10')];}_0x2301aa[_0x6439('0x11')](_0x1cbc24)['send'](_0x5d20eb);};}function findById(_0x387907){return function(_0x18eaab){if(!_[_0x6439('0x12')](_0x387907)&&!_[_0x6439('0x12')](_0x18eaab)&&!_[_0x6439('0x12')](_0x18eaab[_0x6439('0x13')])){return _['find'](_0x18eaab[_0x6439('0x13')],function(_0x49f373){return _0x49f373['id']==_0x387907;});}return null;};}exports[_0x6439('0x14')]=function(_0x33123f,_0x4240a6){return respondWithRpcPromise(_0x6439('0x15'),_0x33123f[_0x6439('0x16')])[_0x6439('0x17')](respondWithResult(_0x4240a6,null))['catch'](handleError(_0x4240a6,null));};exports['voiceChannelMixMonitor']=function(_0x5cad77,_0x226453){return respondWithRpcPromise(_0x6439('0x18'),_['merge'](_0x5cad77[_0x6439('0x16')],_0x5cad77['params']))[_0x6439('0x17')](respondWithResult(_0x226453,null))['catch'](handleError(_0x226453,null));};exports[_0x6439('0x19')]=function(_0x3f8f19,_0x2d8091){return respondWithRpcPromise(_0x6439('0x1a'),_['merge'](_0x3f8f19[_0x6439('0x16')],_0x3f8f19[_0x6439('0x1b')]))[_0x6439('0x17')](respondWithResult(_0x2d8091,null))['catch'](handleError(_0x2d8091,null));};exports['voiceQueues']=function(_0x4c7803,_0x588b90){return respondWithRpcPromise(_0x6439('0x1c'),_0x4c7803[_0x6439('0x16')])[_0x6439('0x17')](respondWithResult(_0x588b90,null))[_0x6439('0x1d')](handleError(_0x588b90,null));};exports[_0x6439('0x1e')]=function(_0x12b22c,_0x395ddf){return respondWithRpcPromise(_0x6439('0x1c'),_0x12b22c['query'])[_0x6439('0x17')](findById(_0x12b22c['params']['id']))['then'](respondWithResult(_0x395ddf,null))[_0x6439('0x1d')](handleError(_0x395ddf,null));};exports[_0x6439('0x1f')]=function(_0x2ef45a,_0x1ec1d2){return respondWithRpcPromise(_0x6439('0x20'),_[_0x6439('0x21')](_0x2ef45a[_0x6439('0x22')],_0x2ef45a[_0x6439('0x1b')]))[_0x6439('0x17')](respondWithResult(_0x1ec1d2,null))[_0x6439('0x1d')](handleError(_0x1ec1d2,null));};exports[_0x6439('0x23')]=function(_0x283888,_0xd5b5de){return respondWithRpcPromise(_0x6439('0x24'),_[_0x6439('0x21')](_0x283888[_0x6439('0x16')],_0x283888[_0x6439('0x1b')]))[_0x6439('0x17')](respondWithResult(_0xd5b5de,null))[_0x6439('0x1d')](handleError(_0xd5b5de,null));};exports[_0x6439('0x25')]=function(_0x13625b,_0x435b4f){return respondWithRpcPromise(_0x6439('0x26'),_0x13625b[_0x6439('0x16')])[_0x6439('0x17')](respondWithResult(_0x435b4f,null))[_0x6439('0x1d')](handleError(_0x435b4f,null));};exports[_0x6439('0x27')]=function(_0x1d9871,_0x3bdf17){return respondWithRpcPromise(_0x6439('0x28'),_[_0x6439('0x21')](_0x1d9871['query'],_0x1d9871[_0x6439('0x1b')]))[_0x6439('0x17')](respondWithResult(_0x3bdf17,null))[_0x6439('0x1d')](handleError(_0x3bdf17,null));};exports[_0x6439('0x29')]=function(_0x3d6d64,_0x2ad622){return respondWithRpcPromise('VoiceQueuesChannelHangup',_[_0x6439('0x21')](_0x3d6d64[_0x6439('0x16')],_0x3d6d64['params']))[_0x6439('0x17')](respondWithResult(_0x2ad622,null))[_0x6439('0x1d')](handleError(_0x2ad622,null));};exports['voiceQueuesChannelRedirect']=function(_0x5d9276,_0x5baec1){return respondWithRpcPromise(_0x6439('0x2a'),_['merge'](_0x5d9276[_0x6439('0x16')],_0x5d9276[_0x6439('0x1b')]))[_0x6439('0x17')](respondWithResult(_0x5baec1,null))[_0x6439('0x1d')](handleError(_0x5baec1,null));};exports['outbound']=function(_0x8270ef,_0x3174ff){return respondWithRpcPromise(_0x6439('0x2b'),_0x8270ef[_0x6439('0x16')])[_0x6439('0x17')](respondWithResult(_0x3174ff,null))[_0x6439('0x1d')](handleError(_0x3174ff,null));};exports[_0x6439('0x2c')]=function(_0xd96bcd,_0x327b0c){return respondWithRpcPromise(_0x6439('0x2d'),_0xd96bcd['query'])[_0x6439('0x17')](respondWithResult(_0x327b0c,null))['catch'](handleError(_0x327b0c,null));};exports['agents']=function(_0x40be13,_0x59b4c5){var _0x2b3320;return respondWithRpcPromise(_0x6439('0x2e'),_0x40be13['query'])[_0x6439('0x17')](function(_0x3052bb){_0x2b3320=_0x3052bb;return respondWithRpcPromise(_0x6439('0x2e'),_0x40be13[_0x6439('0x16')],routingClient);})[_0x6439('0x17')](function(_0x4a6f87){return _[_0x6439('0x21')]({},_0x4a6f87,_0x2b3320);})[_0x6439('0x17')](respondWithResult(_0x59b4c5,null))[_0x6439('0x1d')](handleError(_0x59b4c5,null));};exports[_0x6439('0x2f')]=function(_0x777366,_0xbf946a){if(_0x777366[_0x6439('0x22')]&&_0x777366[_0x6439('0x22')][_0x6439('0x30')]&&_0x777366[_0x6439('0x31')]&&_0x777366[_0x6439('0x31')][_0x6439('0x10')]){for(var _0x28235a in _0x777366[_0x6439('0x22')][_0x6439('0x30')]){if(_0x777366[_0x6439('0x22')]['interaction'][_0x6439('0x32')](_0x28235a)){db[_0x6439('0x33')][_0x6439('0x34')]({'where':{'channel':_0x28235a,'membername':_0x777366['user'][_0x6439('0x10')],'type':_0x6439('0x35'),'exitAt':null,'uniqueid':_0x777366[_0x6439('0x22')][_0x6439('0x30')][_0x28235a]&&_0x777366[_0x6439('0x22')][_0x6439('0x30')][_0x28235a][_0x6439('0x36')]?{'$notIn':_0x777366['body'][_0x6439('0x30')][_0x28235a]}:{'$ne':null}}})[_0x6439('0x17')](function(_0x327b15){var _0x385c44=moment()['format'](_0x6439('0x37'));for(var _0x10a83e=0x0,_0x1a0d7e=_0x327b15['length'];_0x10a83e<_0x1a0d7e;_0x10a83e+=0x1){_0x327b15[_0x10a83e][_0x6439('0x38')]({'exitAt':_0x385c44});}});for(var _0x323cf9=0x0;_0x323cf9<_0x777366[_0x6439('0x22')][_0x6439('0x30')][_0x28235a]['length'];_0x323cf9+=0x1){db['MemberReport'][_0x6439('0x39')]({'where':{'channel':_0x28235a,'membername':_0x777366[_0x6439('0x31')]['name'],'type':_0x6439('0x35'),'uniqueid':_0x777366['body']['interaction'][_0x28235a][_0x323cf9],'exitAt':null},'defaults':{'channel':_0x28235a,'membername':_0x777366['user']['name'],'interface':_['isNil'](_0x777366[_0x6439('0x31')][_0x6439('0x3a')])?util[_0x6439('0x3b')](_0x6439('0x3c'),_0x777366[_0x6439('0x31')][_0x6439('0x10')]):_0x777366[_0x6439('0x31')][_0x6439('0x3a')],'type':_0x6439('0x35'),'enterAt':moment()[_0x6439('0x3b')]('YYYY-MM-DD\x20HH:mm:ss'),'role':'agent','internal':_0x777366[_0x6439('0x31')]['internal'],'uniqueid':_0x777366[_0x6439('0x22')][_0x6439('0x30')][_0x28235a][_0x323cf9]}});}}}}return respondWithRpcPromise(_0x6439('0x3d'),{'id':_0x777366['params']['id'],'capacity':_0x777366[_0x6439('0x22')][_0x6439('0x3e')]},routingClient)[_0x6439('0x17')](respondWithResult(_0xbf946a,null))[_0x6439('0x1d')](handleError(_0xbf946a,null));};exports[_0x6439('0x3f')]=function(_0x13e40f,_0x3243ed){return respondWithRpcPromise(_0x6439('0x40'),_0x13e40f[_0x6439('0x16')])[_0x6439('0x17')](respondWithResult(_0x3243ed,null))[_0x6439('0x1d')](handleError(_0x3243ed,null));};exports[_0x6439('0x41')]=function(_0x4c57e2,_0x1abb02){return respondWithRpcPromise(_0x6439('0x42'),_0x4c57e2[_0x6439('0x16')])[_0x6439('0x17')](respondWithResult(_0x1abb02,null))[_0x6439('0x1d')](handleError(_0x1abb02,null));};exports[_0x6439('0x43')]=function(_0x510ea8,_0x312386){return respondWithRpcPromise(_0x6439('0x44'),_0x510ea8[_0x6439('0x16')])[_0x6439('0x17')](respondWithResult(_0x312386,null))['catch'](handleError(_0x312386,null));};exports['chatQueues']=function(_0x508d0b,_0x56e600){return respondWithRpcPromise(_0x6439('0x45'),_0x508d0b[_0x6439('0x16')],routingClient)[_0x6439('0x17')](respondWithResult(_0x56e600,null))[_0x6439('0x1d')](handleError(_0x56e600,null));};exports['showChatQueues']=function(_0x194d45,_0x59c4f4){return respondWithRpcPromise('ChatQueues',_0x194d45[_0x6439('0x16')],routingClient)[_0x6439('0x17')](findById(_0x194d45[_0x6439('0x1b')]['id']))[_0x6439('0x17')](respondWithResult(_0x59c4f4,null))['catch'](handleError(_0x59c4f4,null));};exports[_0x6439('0x46')]=function(_0x119bb8,_0x502dd0){return respondWithRpcPromise('MailQueues',_0x119bb8[_0x6439('0x16')],routingClient)[_0x6439('0x17')](respondWithResult(_0x502dd0,null))[_0x6439('0x1d')](handleError(_0x502dd0,null));};exports['showMailQueues']=function(_0xa2f46a,_0x3450d1){return respondWithRpcPromise(_0x6439('0x47'),_0xa2f46a[_0x6439('0x16')],routingClient)[_0x6439('0x17')](findById(_0xa2f46a[_0x6439('0x1b')]['id']))[_0x6439('0x17')](respondWithResult(_0x3450d1,null))['catch'](handleError(_0x3450d1,null));};exports['mailAccounts']=function(_0x35bc5f,_0x2fdca1){return respondWithRpcPromise(_0x6439('0x48'),_0x35bc5f[_0x6439('0x16')],mailClient)[_0x6439('0x17')](respondWithResult(_0x2fdca1,null))[_0x6439('0x1d')](handleError(_0x2fdca1,null));};exports[_0x6439('0x49')]=function(_0x5a8a0b,_0x63280){return respondWithRpcPromise(_0x6439('0x4a'),_0x5a8a0b['query'],routingClient)['then'](respondWithResult(_0x63280,null))[_0x6439('0x1d')](handleError(_0x63280,null));};exports['showOpenchannelQueues']=function(_0x307577,_0x2e959f){return respondWithRpcPromise(_0x6439('0x4a'),_0x307577[_0x6439('0x16')],routingClient)[_0x6439('0x17')](findById(_0x307577['params']['id']))[_0x6439('0x17')](respondWithResult(_0x2e959f,null))[_0x6439('0x1d')](handleError(_0x2e959f,null));};exports[_0x6439('0x4b')]=function(_0x139242,_0x1a7550){return respondWithRpcPromise(_0x6439('0x4c'),_0x139242['query'],routingClient)[_0x6439('0x17')](respondWithResult(_0x1a7550,null))[_0x6439('0x1d')](handleError(_0x1a7550,null));};exports['showSmsQueues']=function(_0x52548e,_0x50a809){return respondWithRpcPromise(_0x6439('0x4c'),_0x52548e[_0x6439('0x16')],routingClient)[_0x6439('0x17')](findById(_0x52548e[_0x6439('0x1b')]['id']))[_0x6439('0x17')](respondWithResult(_0x50a809,null))[_0x6439('0x1d')](handleError(_0x50a809,null));};exports[_0x6439('0x4d')]=function(_0x2d846d,_0x159f76){return respondWithRpcPromise(_0x6439('0x4e'),_0x2d846d[_0x6439('0x16')],routingClient)[_0x6439('0x17')](respondWithResult(_0x159f76,null))[_0x6439('0x1d')](handleError(_0x159f76,null));};exports[_0x6439('0x4f')]=function(_0x5ce147,_0x6aba4f){return respondWithRpcPromise('WhatsappQueues',_0x5ce147[_0x6439('0x16')],routingClient)[_0x6439('0x17')](findById(_0x5ce147[_0x6439('0x1b')]['id']))[_0x6439('0x17')](respondWithResult(_0x6aba4f,null))[_0x6439('0x1d')](handleError(_0x6aba4f,null));};exports[_0x6439('0x50')]=function(_0x48db71,_0x38a04b){return respondWithRpcPromise(_0x6439('0x51'),_0x48db71[_0x6439('0x16')],routingClient)[_0x6439('0x17')](respondWithResult(_0x38a04b,null))[_0x6439('0x1d')](handleError(_0x38a04b,null));};exports[_0x6439('0x52')]=function(_0x4112fc,_0x29ac4f){return respondWithRpcPromise(_0x6439('0x51'),_0x4112fc['query'],routingClient)[_0x6439('0x17')](findById(_0x4112fc['params']['id']))['then'](respondWithResult(_0x29ac4f,null))[_0x6439('0x1d')](handleError(_0x29ac4f,null));};exports[_0x6439('0x53')]=function(_0x2f5eb2,_0x43a1d6){return respondWithRpcPromise(_0x6439('0x54'),_0x2f5eb2[_0x6439('0x16')])[_0x6439('0x17')](respondWithResult(_0x43a1d6,null))['catch'](handleError(_0x43a1d6,null));};exports[_0x6439('0x55')]=function(_0x8aefa9,_0x4c493f){return respondWithRpcPromise(_0x6439('0x56'),_0x8aefa9[_0x6439('0x16')],routingClient)[_0x6439('0x17')](respondWithResult(_0x4c493f,null))[_0x6439('0x1d')](handleError(_0x4c493f,null));};exports['mailQueuesWaitingInteractions']=function(_0x430325,_0x41e260){return respondWithRpcPromise(_0x6439('0x57'),_0x430325[_0x6439('0x16')],routingClient)[_0x6439('0x17')](respondWithResult(_0x41e260,null))[_0x6439('0x1d')](handleError(_0x41e260,null));};exports[_0x6439('0x58')]=function(_0x5e96b0,_0x4cdfc2){return respondWithRpcPromise(_0x6439('0x59'),_0x5e96b0[_0x6439('0x16')],routingClient)['then'](respondWithResult(_0x4cdfc2,null))[_0x6439('0x1d')](handleError(_0x4cdfc2,null));};exports['openchannelQueuesIdWaitingInteractions']=function(_0x34c4d2,_0x50034b){return respondWithRpcPromise(_0x6439('0x59'),_0x34c4d2[_0x6439('0x16')],routingClient)['then'](function(_0x339ee0){if(_0x34c4d2[_0x6439('0x16')][_0x6439('0x5a')]!==undefined){var _0x59c4a9=_(_0x339ee0[_0x6439('0x13')])[_0x6439('0x5b')]([_0x34c4d2[_0x6439('0x16')][_0x6439('0x5a')],_0x34c4d2[_0x6439('0x1b')]['id']])[_0x6439('0x5c')]('queue_id')[_0x6439('0x5d')]()[_0x6439('0x5e')]();return _0x339ee0[_0x6439('0x13')][_0x6439('0x5b')](function(_0xe85f05){return _0x59c4a9[_0x6439('0x5f')](_0xe85f05[_0x6439('0x60')])>-0x1;});}else{return _0x339ee0[_0x6439('0x13')][_0x6439('0x5b')](function(_0x5e02db){return _0x5e02db[_0x6439('0x60')]===parseInt(_0x34c4d2[_0x6439('0x1b')]['id']);});}})['then'](respondWithResult(_0x50034b,null))[_0x6439('0x1d')](handleError(_0x50034b,null));};exports['smsQueuesWaitingInteractions']=function(_0x491ddb,_0x232845){return respondWithRpcPromise(_0x6439('0x61'),_0x491ddb[_0x6439('0x16')],routingClient)[_0x6439('0x17')](respondWithResult(_0x232845,null))['catch'](handleError(_0x232845,null));};exports[_0x6439('0x62')]=function(_0x13c55c,_0x402461){return respondWithRpcPromise(_0x6439('0x63'),_0x13c55c['query'],routingClient)[_0x6439('0x17')](respondWithResult(_0x402461,null))[_0x6439('0x1d')](handleError(_0x402461,null));};exports['faxQueuesWaitingInteractions']=function(_0x2e03ae,_0x259f70){return respondWithRpcPromise(_0x6439('0x64'),_0x2e03ae['query'],routingClient)[_0x6439('0x17')](respondWithResult(_0x259f70,null))[_0x6439('0x1d')](handleError(_0x259f70,null));};exports['queueNotify']=function(_0x4571ba){return function(_0x4583d5,_0x2926fc){var _0x4edd7f,_0x54411e;var _0x1c7e27=_[_0x6439('0x65')](_0x4571ba);var _0x304152=_0x4571ba===_0x6439('0x66')?_0x6439('0x67'):_0x6439('0x68');return db[_0x1c7e27+_0x6439('0x69')][_0x6439('0x6a')]({'raw':!![],'where':{'id':_0x4583d5[_0x6439('0x1b')]['id']}})['then'](function(_0xad3253){if(_[_0x6439('0x12')](_0xad3253)){throw new Error(_0x1c7e27+_0x6439('0x6b'));}_0x4edd7f=_0xad3253;return db[_0x1c7e27+'Message'][_0x6439('0x6a')]({'where':{'id':_0x4583d5[_0x6439('0x22')][_0x6439('0x6c')]},'include':[{'model':db[_0x1c7e27+_0x6439('0x6d')],'as':_0x6439('0x6d')},{'model':db[_0x1c7e27+_0x304152],'as':'Account'}]});})[_0x6439('0x17')](function(_0x2cbf74){if(_[_0x6439('0x12')](_0x2cbf74)){throw new Error(_0x1c7e27+'\x20Message\x20not\x20found');}_0x54411e=_0x2cbf74;return _0x2cbf74[_0x6439('0x6e')]({'read':0x0,'readAt':null,'UserId':null});})[_0x6439('0x17')](function(){var _0x1dcf23={'uniqueid':_0x4571ba+'.'+_0x54411e['id']+'.'+_0x54411e['Interaction']['id'],'FromUserId':_0x4583d5[_0x6439('0x31')]['id'],'type':_0x6439('0x6f')};_0x1dcf23[_0x1c7e27+_0x6439('0x70')]=_0x54411e['id'];_0x1dcf23[_0x1c7e27+_0x6439('0x71')]=_0x54411e['Interaction']['id'];_0x1dcf23['From'+_0x1c7e27+_0x304152+'Id']=_0x54411e[_0x6439('0x68')]['id'];_0x1dcf23['To'+_0x1c7e27+_0x6439('0x72')]=_0x4edd7f['id'];return db[_0x1c7e27+_0x6439('0x73')]['create'](_0x1dcf23);})[_0x6439('0x17')](function(){return respondWithRpcPromise(_0x6439('0x74'),{'channel':_0x4571ba,'interaction':_0x54411e[_0x6439('0x6d')],'message':_0x54411e,'account':_0x54411e[_0x6439('0x68')],'applications':[{'id':0x0,'priority':0x1,'app':'queue','appdata':_0x4edd7f[_0x6439('0x10')]+','+(_0x54411e[_0x6439('0x68')][_0x6439('0x75')]||0x12c),'interval':'*,*,*,*'}]},routingClient);})['then'](respondWithResult(_0x2926fc,null))[_0x6439('0x1d')](handleError(_0x2926fc,null));};};exports[_0x6439('0x76')]=function(_0x2fdd31,_0x1454c2){var _0x2ef715,_0x112317;if(_['isNil'](_0x2fdd31[_0x6439('0x22')][_0x6439('0x77')])){throw new Error(_0x6439('0x78'));}var _0x3dd64=_0x2fdd31[_0x6439('0x22')][_0x6439('0x77')];var _0x2ec8e7=_[_0x6439('0x65')](_0x3dd64);var _0xa5cb56=_0x3dd64===_0x6439('0x66')?_0x6439('0x67'):'Account';return db[_0x6439('0x79')]['findOne']({'raw':!![],'where':{'id':_0x2fdd31['params']['id'],'role':_0x6439('0x7a')}})[_0x6439('0x17')](function(_0x30025c){if(_[_0x6439('0x12')](_0x30025c)){throw new Error(_0x6439('0x7b'));}_0x2ef715=_0x30025c;return db[_0x2ec8e7+'Message'][_0x6439('0x6a')]({'where':{'id':_0x2fdd31[_0x6439('0x22')][_0x6439('0x6c')]},'include':[{'model':db[_0x2ec8e7+_0x6439('0x6d')],'as':_0x6439('0x6d')},{'model':db[_0x2ec8e7+_0xa5cb56],'as':_0x6439('0x68')}]});})[_0x6439('0x17')](function(_0xb4ed79){if(_['isNil'](_0xb4ed79)){throw new Error(_0x2ec8e7+_0x6439('0x7c'));}_0x112317=_0xb4ed79;return _0xb4ed79[_0x6439('0x6e')]({'read':0x0,'readAt':null,'UserId':null});})[_0x6439('0x17')](function(){var _0x1ea7fe={'uniqueid':_0x3dd64+'.'+_0x112317['id']+'.'+_0x112317['Interaction']['id'],'FromUserId':_0x2fdd31['user']['id'],'type':'agent','ToUserId':_0x2ef715['id']};_0x1ea7fe[_0x2ec8e7+_0x6439('0x70')]=_0x112317['id'];_0x1ea7fe[_0x2ec8e7+_0x6439('0x71')]=_0x112317[_0x6439('0x6d')]['id'];_0x1ea7fe['From'+_0x2ec8e7+_0xa5cb56+'Id']=_0x112317[_0x6439('0x68')]['id'];return db[_0x2ec8e7+_0x6439('0x73')]['create'](_0x1ea7fe);})[_0x6439('0x17')](function(){return respondWithRpcPromise(_0x6439('0x74'),{'channel':_0x3dd64,'interaction':_0x112317['Interaction'],'message':_0x112317,'account':_0x112317[_0x6439('0x68')],'applications':[{'id':0x0,'priority':0x1,'app':_0x6439('0x7a'),'appdata':_0x2ef715[_0x6439('0x10')]+','+(_0x112317[_0x6439('0x68')][_0x6439('0x7d')]||0x12c),'interval':_0x6439('0x7e')}]},routingClient);})['then'](respondWithResult(_0x1454c2,null))[_0x6439('0x1d')](handleError(_0x1454c2,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index 1314a11..06800f7 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 _0x8d55=['../../config/environment','./schedule.controller','get','/:id','isAuthenticated','show','/:id/run','run','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x22254e,_0x152070){var _0xd1292e=function(_0x1cd75e){while(--_0x1cd75e){_0x22254e['push'](_0x22254e['shift']());}};_0xd1292e(++_0x152070);}(_0x8d55,0xdf));var _0x58d5=function(_0x21cfd7,_0x568b42){_0x21cfd7=_0x21cfd7-0x0;var _0x2bc488=_0x8d55[_0x21cfd7];return _0x2bc488;};'use strict';var multer=require(_0x58d5('0x0'));var util=require(_0x58d5('0x1'));var path=require(_0x58d5('0x2'));var timeout=require('connect-timeout');var express=require(_0x58d5('0x3'));var router=express[_0x58d5('0x4')]();var fs_extra=require(_0x58d5('0x5'));var auth=require(_0x58d5('0x6'));var interaction=require(_0x58d5('0x7'));var config=require(_0x58d5('0x8'));var controller=require(_0x58d5('0x9'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x58d5('0xa')](_0x58d5('0xb'),auth[_0x58d5('0xc')](),controller[_0x58d5('0xd')]);router['get'](_0x58d5('0xe'),auth['isAuthenticated'](),controller[_0x58d5('0xf')]);router['post']('/',auth[_0x58d5('0xc')](),controller['create']);router[_0x58d5('0x10')](_0x58d5('0xb'),auth[_0x58d5('0xc')](),controller[_0x58d5('0x11')]);router[_0x58d5('0x12')](_0x58d5('0xb'),auth[_0x58d5('0xc')](),controller[_0x58d5('0x13')]);module[_0x58d5('0x14')]=router; \ No newline at end of file +var _0x5c79=['get','isAuthenticated','/:id','/:id/run','run','post','create','put','update','delete','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./schedule.controller'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x5c79,0x14c));var _0x95c7=function(_0xd93b26,_0x12bbf2){_0xd93b26=_0xd93b26-0x0;var _0x25f668=_0x5c79[_0xd93b26];return _0x25f668;};'use strict';var multer=require('multer');var util=require(_0x95c7('0x0'));var path=require('path');var timeout=require(_0x95c7('0x1'));var express=require(_0x95c7('0x2'));var router=express[_0x95c7('0x3')]();var fs_extra=require(_0x95c7('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x95c7('0x5'));var config=require(_0x95c7('0x6'));var controller=require(_0x95c7('0x7'));router[_0x95c7('0x8')]('/',auth[_0x95c7('0x9')](),controller['index']);router[_0x95c7('0x8')](_0x95c7('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x95c7('0x8')](_0x95c7('0xb'),auth['isAuthenticated'](),controller[_0x95c7('0xc')]);router[_0x95c7('0xd')]('/',auth[_0x95c7('0x9')](),controller[_0x95c7('0xe')]);router[_0x95c7('0xf')]('/:id',auth[_0x95c7('0x9')](),controller[_0x95c7('0x10')]);router[_0x95c7('0x11')](_0x95c7('0xa'),auth[_0x95c7('0x9')](),controller[_0x95c7('0x12')]);module[_0x95c7('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 e322a65..f7adab7 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 _0x41e8=['ENUM','quarters','months','weeks','days','hours','csv','xlsx','custom','default','TEXT','exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER'];(function(_0xfe7ce3,_0x394ba8){var _0x108672=function(_0x4000b5){while(--_0x4000b5){_0xfe7ce3['push'](_0xfe7ce3['shift']());}};_0x108672(++_0x394ba8);}(_0x41e8,0xe8));var _0x841e=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0x41e8[_0x484e36];return _0xafc85d;};'use strict';var Sequelize=require('sequelize');module[_0x841e('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x841e('0x1')]},'active':{'type':Sequelize[_0x841e('0x2')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x841e('0x1')],'allowNull':![],'defaultValue':_0x841e('0x3')},'startAt':{'type':Sequelize[_0x841e('0x4')],'allowNull':![]},'endAt':{'type':Sequelize[_0x841e('0x4')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x841e('0x5')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x841e('0x6')]('years',_0x841e('0x7'),_0x841e('0x8'),_0x841e('0x9'),_0x841e('0xa'),_0x841e('0xb'),'minutes'),'allowNull':![],'defaultValue':_0x841e('0xa')},'output':{'type':Sequelize[_0x841e('0x6')](_0x841e('0xc'),'pdf',_0x841e('0xd')),'allowNull':![],'defaultValue':_0x841e('0xc')},'type':{'type':Sequelize[_0x841e('0x6')](_0x841e('0xe'),_0x841e('0xf')),'allowNull':![],'defaultValue':_0x841e('0xe')},'sendMail':{'type':Sequelize[_0x841e('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0x841e('0x1')]},'cc':{'type':Sequelize[_0x841e('0x10')]},'bcc':{'type':Sequelize[_0x841e('0x10')]},'sendIfEmpty':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0x5223=['DATE','INTEGER','ENUM','years','quarters','months','weeks','days','hours','csv','pdf','xlsx','custom','TEXT','sequelize','exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*'];(function(_0x156117,_0x1042ae){var _0x4c9421=function(_0x3167d3){while(--_0x3167d3){_0x156117['push'](_0x156117['shift']());}};_0x4c9421(++_0x1042ae);}(_0x5223,0xdf));var _0x3522=function(_0x2b922d,_0x3736b3){_0x2b922d=_0x2b922d-0x0;var _0x2127c9=_0x5223[_0x2b922d];return _0x2127c9;};'use strict';var Sequelize=require(_0x3522('0x0'));module[_0x3522('0x1')]={'name':{'type':Sequelize[_0x3522('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x3522('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x3522('0x2')],'allowNull':![],'defaultValue':_0x3522('0x4')},'startAt':{'type':Sequelize[_0x3522('0x5')],'allowNull':![]},'endAt':{'type':Sequelize[_0x3522('0x5')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x3522('0x6')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x3522('0x7')](_0x3522('0x8'),_0x3522('0x9'),_0x3522('0xa'),_0x3522('0xb'),_0x3522('0xc'),_0x3522('0xd'),'minutes'),'allowNull':![],'defaultValue':_0x3522('0xc')},'output':{'type':Sequelize[_0x3522('0x7')](_0x3522('0xe'),_0x3522('0xf'),_0x3522('0x10')),'allowNull':![],'defaultValue':_0x3522('0xe')},'type':{'type':Sequelize[_0x3522('0x7')](_0x3522('0x11'),'default'),'allowNull':![],'defaultValue':_0x3522('0x11')},'sendMail':{'type':Sequelize[_0x3522('0x3')],'defaultValue':![]},'email':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x3522('0x12')]},'bcc':{'type':Sequelize[_0x3522('0x12')]},'sendIfEmpty':{'type':Sequelize[_0x3522('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index 76637c7..993b6cb 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 _0x9bb2=['fast-json-patch','request-promise','mustache','util','sox','to-csv','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','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','apply','reject','then','destroy','Scheduler','UserProfileResource','stack','name','send','map','Schedule','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','count','include','findAll','rows','catch','show','options','find','create','user','get','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','params','run','../../config/schedule','eml-format','rimraf','zip-dir'];(function(_0x831f0,_0x8c01cd){var _0x14b1bb=function(_0xb40dd1){while(--_0xb40dd1){_0x831f0['push'](_0x831f0['shift']());}};_0x14b1bb(++_0x8c01cd);}(_0x9bb2,0x1ab));var _0x29bb=function(_0x54ba35,_0x389ba6){_0x54ba35=_0x54ba35-0x0;var _0x4d4ce9=_0x9bb2[_0x54ba35];return _0x4d4ce9;};'use strict';var emlformat=require(_0x29bb('0x0'));var rimraf=require(_0x29bb('0x1'));var zipdir=require(_0x29bb('0x2'));var jsonpatch=require(_0x29bb('0x3'));var rp=require(_0x29bb('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x29bb('0x5'));var util=require(_0x29bb('0x6'));var path=require('path');var sox=require(_0x29bb('0x7'));var csv=require(_0x29bb('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x29bb('0x9'));var _=require(_0x29bb('0xa'));var squel=require(_0x29bb('0xb'));var crypto=require(_0x29bb('0xc'));var jsforce=require(_0x29bb('0xd'));var deskjs=require(_0x29bb('0xe'));var toCsv=require('to-csv');var querystring=require(_0x29bb('0xf'));var Papa=require(_0x29bb('0x10'));var Redis=require(_0x29bb('0x11'));var authService=require(_0x29bb('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x29bb('0x13'));var logger=require(_0x29bb('0x14'))(_0x29bb('0x15'));var utils=require(_0x29bb('0x16'));var config=require(_0x29bb('0x17'));var licenseUtil=require(_0x29bb('0x18'));var db=require(_0x29bb('0x19'))['db'];function respondWithStatusCode(_0x5bc000,_0x5cb847){_0x5cb847=_0x5cb847||0xcc;return function(_0x4c5ede){if(_0x4c5ede){return _0x5bc000[_0x29bb('0x1a')](_0x5cb847);}return _0x5bc000[_0x29bb('0x1b')](_0x5cb847)[_0x29bb('0x1c')]();};}function respondWithResult(_0x3726cf,_0x50e2cb){_0x50e2cb=_0x50e2cb||0xc8;return function(_0x34b36c){if(_0x34b36c){return _0x3726cf[_0x29bb('0x1b')](_0x50e2cb)[_0x29bb('0x1d')](_0x34b36c);}};}function respondWithFilteredResult(_0x1b5145,_0x548fc4){return function(_0x4f285c){if(_0x4f285c){var _0x68a8c4=typeof _0x548fc4[_0x29bb('0x1e')]===_0x29bb('0x1f')&&typeof _0x548fc4[_0x29bb('0x20')]===_0x29bb('0x1f');var _0x585368=_0x4f285c['count'];var _0xe598e0=_0x68a8c4?0x0:_0x548fc4[_0x29bb('0x1e')];var _0x480727=_0x68a8c4?_0x4f285c['count']:_0x548fc4[_0x29bb('0x1e')]+_0x548fc4[_0x29bb('0x20')];var _0x10d549;if(_0x480727>=_0x585368){_0x480727=_0x585368;_0x10d549=0xc8;}else{_0x10d549=0xce;}_0x1b5145[_0x29bb('0x1b')](_0x10d549);return _0x1b5145[_0x29bb('0x21')]('Content-Range',_0xe598e0+'-'+_0x480727+'/'+_0x585368)['json'](_0x4f285c);}return null;};}function patchUpdates(_0x5c471d){return function(_0x5e48fa){try{jsonpatch[_0x29bb('0x22')](_0x5e48fa,_0x5c471d,!![]);}catch(_0x5f1d37){return BPromise[_0x29bb('0x23')](_0x5f1d37);}return _0x5e48fa['save']();};}function saveUpdates(_0x1cffcd,_0x5d2594){return function(_0x278614){if(_0x278614){return _0x278614['update'](_0x1cffcd)[_0x29bb('0x24')](function(_0x1bf57c){return _0x1bf57c;});}return null;};}function removeEntity(_0x578636,_0x1ee0e5){return function(_0x3f904d){if(_0x3f904d){return _0x3f904d[_0x29bb('0x25')]()['then'](function(){var _0x17f0aa=_0x3f904d['get']({'plain':!![]});var _0x55647f=_0x29bb('0x26');return db[_0x29bb('0x27')][_0x29bb('0x25')]({'where':{'type':_0x55647f,'resourceId':_0x17f0aa['id']}})[_0x29bb('0x24')](function(){return _0x3f904d;});})[_0x29bb('0x24')](function(){_0x578636[_0x29bb('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x200098,_0x2ff643){return function(_0x3d2374){if(!_0x3d2374){_0x200098[_0x29bb('0x1a')](0x194);}return _0x3d2374;};}function handleError(_0x58c8fe,_0x32edf9){_0x32edf9=_0x32edf9||0x1f4;return function(_0x11a1b8){logger['error'](_0x11a1b8[_0x29bb('0x28')]);if(_0x11a1b8[_0x29bb('0x29')]){delete _0x11a1b8[_0x29bb('0x29')];}_0x58c8fe[_0x29bb('0x1b')](_0x32edf9)[_0x29bb('0x2a')](_0x11a1b8);};}exports['index']=function(_0x4c2a7d,_0x250ba0){var _0x49f9f1={},_0x391484={},_0x4a0616={'count':0x0,'rows':[]};var _0x266a1c=_[_0x29bb('0x2b')](db[_0x29bb('0x2c')][_0x29bb('0x2d')],function(_0xf47751){return{'name':_0xf47751['fieldName'],'type':_0xf47751[_0x29bb('0x2e')][_0x29bb('0x2f')]};});_0x391484[_0x29bb('0x30')]=_[_0x29bb('0x2b')](_0x266a1c,_0x29bb('0x29'));_0x391484[_0x29bb('0x31')]=_[_0x29bb('0x32')](_0x4c2a7d['query']);_0x391484[_0x29bb('0x33')]=_['intersection'](_0x391484[_0x29bb('0x30')],_0x391484[_0x29bb('0x31')]);_0x49f9f1['attributes']=_[_0x29bb('0x34')](_0x391484['model'],qs[_0x29bb('0x35')](_0x4c2a7d['query'][_0x29bb('0x35')]));_0x49f9f1[_0x29bb('0x36')]=_0x49f9f1[_0x29bb('0x36')][_0x29bb('0x37')]?_0x49f9f1['attributes']:_0x391484['model'];if(!_0x4c2a7d['query'][_0x29bb('0x38')]('nolimit')){_0x49f9f1[_0x29bb('0x20')]=qs[_0x29bb('0x20')](_0x4c2a7d[_0x29bb('0x31')][_0x29bb('0x20')]);_0x49f9f1[_0x29bb('0x1e')]=qs[_0x29bb('0x1e')](_0x4c2a7d[_0x29bb('0x31')][_0x29bb('0x1e')]);}_0x49f9f1[_0x29bb('0x39')]=qs[_0x29bb('0x3a')](_0x4c2a7d['query'][_0x29bb('0x3a')]);_0x49f9f1[_0x29bb('0x3b')]=qs[_0x29bb('0x33')](_[_0x29bb('0x3c')](_0x4c2a7d[_0x29bb('0x31')],_0x391484[_0x29bb('0x33')]),_0x266a1c);if(_0x4c2a7d['query']['filter']){_0x49f9f1[_0x29bb('0x3b')]=_[_0x29bb('0x3d')](_0x49f9f1[_0x29bb('0x3b')],{'$or':_[_0x29bb('0x2b')](_0x266a1c,function(_0x43d9e0){if(_0x43d9e0[_0x29bb('0x2e')]!==_0x29bb('0x3e')){var _0x3dc66d={};_0x3dc66d[_0x43d9e0[_0x29bb('0x29')]]={'$like':'%'+_0x4c2a7d[_0x29bb('0x31')][_0x29bb('0x3f')]+'%'};return _0x3dc66d;}})});}_0x49f9f1=_[_0x29bb('0x3d')]({},_0x49f9f1,_0x4c2a7d['options']);var _0x1d9c07={'where':_0x49f9f1[_0x29bb('0x3b')]};return db['Schedule'][_0x29bb('0x40')](_0x1d9c07)['then'](function(_0x2e075c){_0x4a0616[_0x29bb('0x40')]=_0x2e075c;if(_0x4c2a7d[_0x29bb('0x31')]['includeAll']){_0x49f9f1[_0x29bb('0x41')]=[{'all':!![]}];}return db[_0x29bb('0x2c')][_0x29bb('0x42')](_0x49f9f1);})[_0x29bb('0x24')](function(_0x6885f9){_0x4a0616[_0x29bb('0x43')]=_0x6885f9;return _0x4a0616;})[_0x29bb('0x24')](respondWithFilteredResult(_0x250ba0,_0x49f9f1))[_0x29bb('0x44')](handleError(_0x250ba0,null));};exports[_0x29bb('0x45')]=function(_0x378274,_0x37ade2){var _0x4db78a={'raw':![],'where':{'id':_0x378274['params']['id']}},_0x1ae73b={};_0x1ae73b['model']=_[_0x29bb('0x32')](db[_0x29bb('0x2c')][_0x29bb('0x2d')]);_0x1ae73b[_0x29bb('0x31')]=_[_0x29bb('0x32')](_0x378274[_0x29bb('0x31')]);_0x1ae73b[_0x29bb('0x33')]=_['intersection'](_0x1ae73b[_0x29bb('0x30')],_0x1ae73b[_0x29bb('0x31')]);_0x4db78a['attributes']=_[_0x29bb('0x34')](_0x1ae73b[_0x29bb('0x30')],qs['fields'](_0x378274[_0x29bb('0x31')][_0x29bb('0x35')]));_0x4db78a[_0x29bb('0x36')]=_0x4db78a[_0x29bb('0x36')]['length']?_0x4db78a[_0x29bb('0x36')]:_0x1ae73b['model'];if(_0x378274[_0x29bb('0x31')]['includeAll']){_0x4db78a[_0x29bb('0x41')]=[{'all':!![]}];}_0x4db78a=_[_0x29bb('0x3d')]({},_0x4db78a,_0x378274[_0x29bb('0x46')]);return db[_0x29bb('0x2c')][_0x29bb('0x47')](_0x4db78a)[_0x29bb('0x24')](handleEntityNotFound(_0x37ade2,null))['then'](respondWithResult(_0x37ade2,null))['catch'](handleError(_0x37ade2,null));};exports[_0x29bb('0x48')]=function(_0x566c0b,_0x4100a2){return db[_0x29bb('0x2c')]['create'](_0x566c0b['body'],{})[_0x29bb('0x24')](function(_0x2b8c8e){var _0x13416e=_0x566c0b[_0x29bb('0x49')][_0x29bb('0x4a')]({'plain':!![]});if(!_0x13416e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x13416e[_0x29bb('0x4b')]===_0x29bb('0x49')){var _0x2fa090=_0x2b8c8e[_0x29bb('0x4a')]({'plain':!![]});var _0x34174a=_0x29bb('0x26');return db[_0x29bb('0x4c')][_0x29bb('0x47')]({'where':{'name':_0x34174a,'userProfileId':_0x13416e[_0x29bb('0x4d')]},'raw':!![]})['then'](function(_0x33d3f8){if(_0x33d3f8&&_0x33d3f8[_0x29bb('0x4e')]===0x0){return db[_0x29bb('0x27')][_0x29bb('0x48')]({'name':_0x2fa090[_0x29bb('0x29')],'resourceId':_0x2fa090['id'],'type':_0x33d3f8['name'],'sectionId':_0x33d3f8['id']},{})[_0x29bb('0x24')](function(){return _0x2b8c8e;});}else{return _0x2b8c8e;}})[_0x29bb('0x44')](function(_0x59422a){logger[_0x29bb('0x4f')](_0x29bb('0x50'),_0x59422a);throw _0x59422a;});}return _0x2b8c8e;})[_0x29bb('0x24')](respondWithResult(_0x4100a2,0xc9))[_0x29bb('0x44')](handleError(_0x4100a2,null));};exports[_0x29bb('0x51')]=function(_0x19771a,_0x4049c3){if(_0x19771a[_0x29bb('0x52')]['id']){delete _0x19771a[_0x29bb('0x52')]['id'];}return db[_0x29bb('0x2c')]['find']({'where':{'id':_0x19771a[_0x29bb('0x53')]['id']}})[_0x29bb('0x24')](handleEntityNotFound(_0x4049c3,null))[_0x29bb('0x24')](saveUpdates(_0x19771a['body'],null))[_0x29bb('0x24')](respondWithResult(_0x4049c3,null))[_0x29bb('0x44')](handleError(_0x4049c3,null));};exports['destroy']=function(_0x95162a,_0x1f9b4a){return db[_0x29bb('0x2c')]['find']({'where':{'id':_0x95162a[_0x29bb('0x53')]['id']}})[_0x29bb('0x24')](handleEntityNotFound(_0x1f9b4a,null))[_0x29bb('0x24')](removeEntity(_0x1f9b4a,null))[_0x29bb('0x44')](handleError(_0x1f9b4a,null));};exports[_0x29bb('0x54')]=function(_0x3112e7,_0x53552b,_0x4d553a){var _0xbf5dfb=require(_0x29bb('0x55'));return db['Schedule']['find']({'where':{'id':_0x3112e7[_0x29bb('0x53')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x53552b,null))[_0x29bb('0x24')](function(){_0xbf5dfb['run'](_0x3112e7[_0x29bb('0x53')]['id']);})[_0x29bb('0x24')](respondWithStatusCode(_0x53552b,null))['catch'](handleError(_0x53552b,null));}; \ No newline at end of file +var _0x26df=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','save','update','then','destroy','get','Scheduler','UserProfileResource','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','options','Schedule','includeAll','include','catch','params','find','create','user','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','run','../../config/schedule','eml-format','rimraf','zip-dir','moment','bluebird','mustache','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service'];(function(_0x571729,_0x5d03e2){var _0x38820e=function(_0x9ba9cd){while(--_0x9ba9cd){_0x571729['push'](_0x571729['shift']());}};_0x38820e(++_0x5d03e2);}(_0x26df,0x8f));var _0xf26d=function(_0x387dc1,_0x3ba649){_0x387dc1=_0x387dc1-0x0;var _0x17567c=_0x26df[_0x387dc1];return _0x17567c;};'use strict';var emlformat=require(_0xf26d('0x0'));var rimraf=require(_0xf26d('0x1'));var zipdir=require(_0xf26d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xf26d('0x3'));var BPromise=require(_0xf26d('0x4'));var Mustache=require(_0xf26d('0x5'));var util=require('util');var path=require(_0xf26d('0x6'));var sox=require('sox');var csv=require(_0xf26d('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf26d('0x8'));var _=require(_0xf26d('0x9'));var squel=require(_0xf26d('0xa'));var crypto=require(_0xf26d('0xb'));var jsforce=require(_0xf26d('0xc'));var deskjs=require(_0xf26d('0xd'));var toCsv=require(_0xf26d('0x7'));var querystring=require(_0xf26d('0xe'));var Papa=require('papaparse');var Redis=require(_0xf26d('0xf'));var authService=require(_0xf26d('0x10'));var qs=require(_0xf26d('0x11'));var as=require(_0xf26d('0x12'));var hardwareService=require(_0xf26d('0x13'));var logger=require(_0xf26d('0x14'))('api');var utils=require('../../config/utils');var config=require(_0xf26d('0x15'));var licenseUtil=require(_0xf26d('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xa61a17,_0x3b272d){_0x3b272d=_0x3b272d||0xcc;return function(_0x584fdc){if(_0x584fdc){return _0xa61a17[_0xf26d('0x17')](_0x3b272d);}return _0xa61a17[_0xf26d('0x18')](_0x3b272d)[_0xf26d('0x19')]();};}function respondWithResult(_0x3d978c,_0x51adef){_0x51adef=_0x51adef||0xc8;return function(_0x130119){if(_0x130119){return _0x3d978c[_0xf26d('0x18')](_0x51adef)[_0xf26d('0x1a')](_0x130119);}};}function respondWithFilteredResult(_0x46c79d,_0x56ca9c){return function(_0x1e33a3){if(_0x1e33a3){var _0xc990dd=typeof _0x56ca9c[_0xf26d('0x1b')]===_0xf26d('0x1c')&&typeof _0x56ca9c[_0xf26d('0x1d')]===_0xf26d('0x1c');var _0x1a1f34=_0x1e33a3[_0xf26d('0x1e')];var _0x2c4844=_0xc990dd?0x0:_0x56ca9c[_0xf26d('0x1b')];var _0x58afbf=_0xc990dd?_0x1e33a3[_0xf26d('0x1e')]:_0x56ca9c['offset']+_0x56ca9c['limit'];var _0x872f52;if(_0x58afbf>=_0x1a1f34){_0x58afbf=_0x1a1f34;_0x872f52=0xc8;}else{_0x872f52=0xce;}_0x46c79d[_0xf26d('0x18')](_0x872f52);return _0x46c79d[_0xf26d('0x1f')]('Content-Range',_0x2c4844+'-'+_0x58afbf+'/'+_0x1a1f34)[_0xf26d('0x1a')](_0x1e33a3);}return null;};}function patchUpdates(_0x3a629e){return function(_0x1760e5){try{jsonpatch['apply'](_0x1760e5,_0x3a629e,!![]);}catch(_0x2ca033){return BPromise[_0xf26d('0x20')](_0x2ca033);}return _0x1760e5[_0xf26d('0x21')]();};}function saveUpdates(_0x1c199e,_0x52afe0){return function(_0x1856bb){if(_0x1856bb){return _0x1856bb[_0xf26d('0x22')](_0x1c199e)[_0xf26d('0x23')](function(_0xa9f8fe){return _0xa9f8fe;});}return null;};}function removeEntity(_0x53bc99,_0x35297e){return function(_0x582324){if(_0x582324){return _0x582324[_0xf26d('0x24')]()[_0xf26d('0x23')](function(){var _0x5b6d9f=_0x582324[_0xf26d('0x25')]({'plain':!![]});var _0x223e26=_0xf26d('0x26');return db[_0xf26d('0x27')][_0xf26d('0x24')]({'where':{'type':_0x223e26,'resourceId':_0x5b6d9f['id']}})[_0xf26d('0x23')](function(){return _0x582324;});})[_0xf26d('0x23')](function(){_0x53bc99['status'](0xcc)[_0xf26d('0x19')]();});}};}function handleEntityNotFound(_0x4f7e3b,_0xdbb24){return function(_0x286382){if(!_0x286382){_0x4f7e3b[_0xf26d('0x17')](0x194);}return _0x286382;};}function handleError(_0x3bb7d6,_0x3ce6a6){_0x3ce6a6=_0x3ce6a6||0x1f4;return function(_0x54aa2d){logger['error'](_0x54aa2d['stack']);if(_0x54aa2d[_0xf26d('0x28')]){delete _0x54aa2d[_0xf26d('0x28')];}_0x3bb7d6[_0xf26d('0x18')](_0x3ce6a6)[_0xf26d('0x29')](_0x54aa2d);};}exports[_0xf26d('0x2a')]=function(_0x363c92,_0x208b6f){var _0x42b595={},_0x324e92={},_0x46a97e={'count':0x0,'rows':[]};var _0x946d55=_[_0xf26d('0x2b')](db['Schedule'][_0xf26d('0x2c')],function(_0x41f708){return{'name':_0x41f708[_0xf26d('0x2d')],'type':_0x41f708[_0xf26d('0x2e')][_0xf26d('0x2f')]};});_0x324e92[_0xf26d('0x30')]=_[_0xf26d('0x2b')](_0x946d55,'name');_0x324e92[_0xf26d('0x31')]=_[_0xf26d('0x32')](_0x363c92[_0xf26d('0x31')]);_0x324e92[_0xf26d('0x33')]=_['intersection'](_0x324e92[_0xf26d('0x30')],_0x324e92[_0xf26d('0x31')]);_0x42b595[_0xf26d('0x34')]=_[_0xf26d('0x35')](_0x324e92[_0xf26d('0x30')],qs[_0xf26d('0x36')](_0x363c92[_0xf26d('0x31')][_0xf26d('0x36')]));_0x42b595[_0xf26d('0x34')]=_0x42b595[_0xf26d('0x34')][_0xf26d('0x37')]?_0x42b595[_0xf26d('0x34')]:_0x324e92[_0xf26d('0x30')];if(!_0x363c92['query'][_0xf26d('0x38')]('nolimit')){_0x42b595[_0xf26d('0x1d')]=qs[_0xf26d('0x1d')](_0x363c92[_0xf26d('0x31')][_0xf26d('0x1d')]);_0x42b595[_0xf26d('0x1b')]=qs['offset'](_0x363c92[_0xf26d('0x31')][_0xf26d('0x1b')]);}_0x42b595[_0xf26d('0x39')]=qs[_0xf26d('0x3a')](_0x363c92[_0xf26d('0x31')]['sort']);_0x42b595[_0xf26d('0x3b')]=qs[_0xf26d('0x33')](_[_0xf26d('0x3c')](_0x363c92['query'],_0x324e92[_0xf26d('0x33')]),_0x946d55);if(_0x363c92[_0xf26d('0x31')][_0xf26d('0x3d')]){_0x42b595['where']=_['merge'](_0x42b595[_0xf26d('0x3b')],{'$or':_[_0xf26d('0x2b')](_0x946d55,function(_0x1c0eaf){if(_0x1c0eaf[_0xf26d('0x2e')]!==_0xf26d('0x3e')){var _0x48e8f9={};_0x48e8f9[_0x1c0eaf[_0xf26d('0x28')]]={'$like':'%'+_0x363c92[_0xf26d('0x31')][_0xf26d('0x3d')]+'%'};return _0x48e8f9;}})});}_0x42b595=_[_0xf26d('0x3f')]({},_0x42b595,_0x363c92[_0xf26d('0x40')]);var _0x398fd9={'where':_0x42b595[_0xf26d('0x3b')]};return db[_0xf26d('0x41')][_0xf26d('0x1e')](_0x398fd9)['then'](function(_0x2ecfde){_0x46a97e['count']=_0x2ecfde;if(_0x363c92[_0xf26d('0x31')][_0xf26d('0x42')]){_0x42b595[_0xf26d('0x43')]=[{'all':!![]}];}return db[_0xf26d('0x41')]['findAll'](_0x42b595);})[_0xf26d('0x23')](function(_0x5e60f0){_0x46a97e['rows']=_0x5e60f0;return _0x46a97e;})['then'](respondWithFilteredResult(_0x208b6f,_0x42b595))[_0xf26d('0x44')](handleError(_0x208b6f,null));};exports['show']=function(_0x17a2d8,_0x3310fd){var _0x126f28={'raw':![],'where':{'id':_0x17a2d8[_0xf26d('0x45')]['id']}},_0x16099c={};_0x16099c[_0xf26d('0x30')]=_[_0xf26d('0x32')](db[_0xf26d('0x41')][_0xf26d('0x2c')]);_0x16099c[_0xf26d('0x31')]=_[_0xf26d('0x32')](_0x17a2d8['query']);_0x16099c[_0xf26d('0x33')]=_['intersection'](_0x16099c[_0xf26d('0x30')],_0x16099c[_0xf26d('0x31')]);_0x126f28[_0xf26d('0x34')]=_[_0xf26d('0x35')](_0x16099c['model'],qs['fields'](_0x17a2d8[_0xf26d('0x31')][_0xf26d('0x36')]));_0x126f28[_0xf26d('0x34')]=_0x126f28[_0xf26d('0x34')][_0xf26d('0x37')]?_0x126f28[_0xf26d('0x34')]:_0x16099c['model'];if(_0x17a2d8['query'][_0xf26d('0x42')]){_0x126f28['include']=[{'all':!![]}];}_0x126f28=_['merge']({},_0x126f28,_0x17a2d8[_0xf26d('0x40')]);return db[_0xf26d('0x41')][_0xf26d('0x46')](_0x126f28)[_0xf26d('0x23')](handleEntityNotFound(_0x3310fd,null))[_0xf26d('0x23')](respondWithResult(_0x3310fd,null))[_0xf26d('0x44')](handleError(_0x3310fd,null));};exports[_0xf26d('0x47')]=function(_0xe993f,_0x539667){return db[_0xf26d('0x41')][_0xf26d('0x47')](_0xe993f['body'],{})[_0xf26d('0x23')](function(_0x3dd2df){var _0xf5c9ad=_0xe993f[_0xf26d('0x48')][_0xf26d('0x25')]({'plain':!![]});if(!_0xf5c9ad)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xf5c9ad['role']===_0xf26d('0x48')){var _0x5b6d81=_0x3dd2df['get']({'plain':!![]});var _0x47773e=_0xf26d('0x26');return db[_0xf26d('0x49')][_0xf26d('0x46')]({'where':{'name':_0x47773e,'userProfileId':_0xf5c9ad[_0xf26d('0x4a')]},'raw':!![]})[_0xf26d('0x23')](function(_0x168efb){if(_0x168efb&&_0x168efb['autoAssociation']===0x0){return db[_0xf26d('0x27')][_0xf26d('0x47')]({'name':_0x5b6d81[_0xf26d('0x28')],'resourceId':_0x5b6d81['id'],'type':_0x168efb['name'],'sectionId':_0x168efb['id']},{})[_0xf26d('0x23')](function(){return _0x3dd2df;});}else{return _0x3dd2df;}})[_0xf26d('0x44')](function(_0x9d1d35){logger[_0xf26d('0x4b')](_0xf26d('0x4c'),_0x9d1d35);throw _0x9d1d35;});}return _0x3dd2df;})[_0xf26d('0x23')](respondWithResult(_0x539667,0xc9))['catch'](handleError(_0x539667,null));};exports[_0xf26d('0x22')]=function(_0x37df3b,_0x167166){if(_0x37df3b[_0xf26d('0x4d')]['id']){delete _0x37df3b[_0xf26d('0x4d')]['id'];}return db[_0xf26d('0x41')]['find']({'where':{'id':_0x37df3b['params']['id']}})[_0xf26d('0x23')](handleEntityNotFound(_0x167166,null))[_0xf26d('0x23')](saveUpdates(_0x37df3b[_0xf26d('0x4d')],null))[_0xf26d('0x23')](respondWithResult(_0x167166,null))[_0xf26d('0x44')](handleError(_0x167166,null));};exports[_0xf26d('0x24')]=function(_0x942ca4,_0x4dbc3f){return db[_0xf26d('0x41')]['find']({'where':{'id':_0x942ca4[_0xf26d('0x45')]['id']}})[_0xf26d('0x23')](handleEntityNotFound(_0x4dbc3f,null))[_0xf26d('0x23')](removeEntity(_0x4dbc3f,null))['catch'](handleError(_0x4dbc3f,null));};exports[_0xf26d('0x4e')]=function(_0x2a1151,_0x246f61,_0x20c4a3){var _0x33016b=require(_0xf26d('0x4f'));return db[_0xf26d('0x41')]['find']({'where':{'id':_0x2a1151[_0xf26d('0x45')]['id']},'raw':!![]})[_0xf26d('0x23')](handleEntityNotFound(_0x246f61,null))[_0xf26d('0x23')](function(){_0x33016b['run'](_0x2a1151['params']['id']);})[_0xf26d('0x23')](respondWithStatusCode(_0x246f61,null))['catch'](handleError(_0x246f61,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index fa86537..0f5fb55 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 _0xecab=['../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./schedule.attributes','exports','Schedule','util'];(function(_0x1619c1,_0x21b9fd){var _0x424d3f=function(_0x388463){while(--_0x388463){_0x1619c1['push'](_0x1619c1['shift']());}};_0x424d3f(++_0x21b9fd);}(_0xecab,0x135));var _0xbeca=function(_0x2ad0bb,_0x2b069b){_0x2ad0bb=_0x2ad0bb-0x0;var _0x2631f4=_0xecab[_0x2ad0bb];return _0x2631f4;};'use strict';var _=require('lodash');var util=require(_0xbeca('0x0'));var logger=require(_0xbeca('0x1'))(_0xbeca('0x2'));var moment=require(_0xbeca('0x3'));var BPromise=require('bluebird');var rp=require(_0xbeca('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbeca('0x5'));var config=require(_0xbeca('0x6'));var attributes=require(_0xbeca('0x7'));module[_0xbeca('0x8')]=function(_0x3d1a08,_0x84f6e1){return _0x3d1a08['define'](_0xbeca('0x9'),attributes,{'tableName':'tools_schedules','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4ec3=['rimraf','../../config/environment','./schedule.attributes','exports','define','Schedule','tools_schedules','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x5cbd7b,_0x207439){var _0x3fdfb8=function(_0x4eb12e){while(--_0x4eb12e){_0x5cbd7b['push'](_0x5cbd7b['shift']());}};_0x3fdfb8(++_0x207439);}(_0x4ec3,0x118));var _0x34ec=function(_0x3da707,_0x30c36d){_0x3da707=_0x3da707-0x0;var _0x342ee7=_0x4ec3[_0x3da707];return _0x342ee7;};'use strict';var _=require(_0x34ec('0x0'));var util=require(_0x34ec('0x1'));var logger=require(_0x34ec('0x2'))(_0x34ec('0x3'));var moment=require(_0x34ec('0x4'));var BPromise=require('bluebird');var rp=require(_0x34ec('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x34ec('0x6'));var config=require(_0x34ec('0x7'));var attributes=require(_0x34ec('0x8'));module[_0x34ec('0x9')]=function(_0x405048,_0x3caee7){return _0x405048[_0x34ec('0xa')](_0x34ec('0xb'),attributes,{'tableName':_0x34ec('0xc'),'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 dc1d5be..687bac6 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 _0xb0e8=['stringify','error','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Schedule,\x20%s,\x20%s','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xb0e8,0x9e));var _0x8b0e=function(_0x5cbb32,_0x233ace){_0x5cbb32=_0x5cbb32-0x0;var _0x49363c=_0xb0e8[_0x5cbb32];return _0x49363c;};'use strict';var _=require(_0x8b0e('0x0'));var util=require(_0x8b0e('0x1'));var moment=require(_0x8b0e('0x2'));var BPromise=require(_0x8b0e('0x3'));var rs=require(_0x8b0e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8b0e('0x5'))['db'];var utils=require(_0x8b0e('0x6'));var logger=require(_0x8b0e('0x7'))('rpc');var config=require(_0x8b0e('0x8'));var jayson=require(_0x8b0e('0x9'));var client=jayson[_0x8b0e('0xa')][_0x8b0e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1df74d,_0x306374,_0x4815a9){return new BPromise(function(_0x4565fa,_0x4f9a57){return client['request'](_0x1df74d,_0x4815a9)[_0x8b0e('0xc')](function(_0x5b5028){logger[_0x8b0e('0xd')](_0x8b0e('0xe'),_0x306374,_0x8b0e('0xf'));logger[_0x8b0e('0x10')](_0x8b0e('0x11'),_0x306374,_0x8b0e('0xf'),JSON[_0x8b0e('0x12')](_0x5b5028));if(_0x5b5028[_0x8b0e('0x13')]){if(_0x5b5028[_0x8b0e('0x13')]['code']===0x1f4){logger[_0x8b0e('0x13')](_0x8b0e('0xe'),_0x306374,_0x5b5028['error'][_0x8b0e('0x14')]);return _0x4f9a57(_0x5b5028['error'][_0x8b0e('0x14')]);}logger['error'](_0x8b0e('0xe'),_0x306374,_0x5b5028[_0x8b0e('0x13')][_0x8b0e('0x14')]);return _0x4565fa(_0x5b5028[_0x8b0e('0x13')][_0x8b0e('0x14')]);}else{logger['info'](_0x8b0e('0xe'),_0x306374,_0x8b0e('0xf'));_0x4565fa(_0x5b5028['result'][_0x8b0e('0x14')]);}})[_0x8b0e('0x15')](function(_0x20dda4){logger['error'](_0x8b0e('0xe'),_0x306374,_0x20dda4);_0x4f9a57(_0x20dda4);});});} \ No newline at end of file +var _0x355c=['../../config/environment','jayson/promise','client','http','then','Schedule,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x3a1bad,_0x4bbd1b){var _0x3c8345=function(_0x32e21d){while(--_0x32e21d){_0x3a1bad['push'](_0x3a1bad['shift']());}};_0x3c8345(++_0x4bbd1b);}(_0x355c,0x19c));var _0xc355=function(_0x5887ec,_0x504c12){_0x5887ec=_0x5887ec-0x0;var _0x23b637=_0x355c[_0x5887ec];return _0x23b637;};'use strict';var _=require('lodash');var util=require(_0xc355('0x0'));var moment=require(_0xc355('0x1'));var BPromise=require(_0xc355('0x2'));var rs=require(_0xc355('0x3'));var fs=require('fs');var Redis=require(_0xc355('0x4'));var db=require(_0xc355('0x5'))['db'];var utils=require(_0xc355('0x6'));var logger=require('../../config/logger')(_0xc355('0x7'));var config=require(_0xc355('0x8'));var jayson=require(_0xc355('0x9'));var client=jayson[_0xc355('0xa')][_0xc355('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x58b5c9,_0x58d144,_0x26d820){return new BPromise(function(_0xf3ac5d,_0x351146){return client['request'](_0x58b5c9,_0x26d820)[_0xc355('0xc')](function(_0x22c102){logger['info'](_0xc355('0xd'),_0x58d144,_0xc355('0xe'));logger['debug']('Schedule,\x20%s,\x20%s,\x20%s',_0x58d144,_0xc355('0xe'),JSON[_0xc355('0xf')](_0x22c102));if(_0x22c102[_0xc355('0x10')]){if(_0x22c102['error']['code']===0x1f4){logger[_0xc355('0x10')]('Schedule,\x20%s,\x20%s',_0x58d144,_0x22c102[_0xc355('0x10')]['message']);return _0x351146(_0x22c102[_0xc355('0x10')]['message']);}logger[_0xc355('0x10')](_0xc355('0xd'),_0x58d144,_0x22c102[_0xc355('0x10')][_0xc355('0x11')]);return _0xf3ac5d(_0x22c102[_0xc355('0x10')][_0xc355('0x11')]);}else{logger[_0xc355('0x12')](_0xc355('0xd'),_0x58d144,_0xc355('0xe'));_0xf3ac5d(_0x22c102[_0xc355('0x13')][_0xc355('0x11')]);}})[_0xc355('0x14')](function(_0x41a85e){logger['error'](_0xc355('0xd'),_0x58d144,_0x41a85e);_0x351146(_0x41a85e);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index d066395..b48391e 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 _0x7f50=['post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./screenRecording.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/download'];(function(_0x267c52,_0x3c0df3){var _0x46c47b=function(_0x3c3740){while(--_0x3c3740){_0x267c52['push'](_0x267c52['shift']());}};_0x46c47b(++_0x3c0df3);}(_0x7f50,0x1b6));var _0x07f5=function(_0xa47f15,_0x3fd900){_0xa47f15=_0xa47f15-0x0;var _0xd900c5=_0x7f50[_0xa47f15];return _0xd900c5;};'use strict';var multer=require(_0x07f5('0x0'));var util=require(_0x07f5('0x1'));var path=require(_0x07f5('0x2'));var timeout=require(_0x07f5('0x3'));var express=require(_0x07f5('0x4'));var router=express[_0x07f5('0x5')]();var fs_extra=require(_0x07f5('0x6'));var auth=require(_0x07f5('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x07f5('0x8'));var controller=require(_0x07f5('0x9'));router[_0x07f5('0xa')]('/',auth['isAuthenticated'](),controller[_0x07f5('0xb')]);router[_0x07f5('0xa')](_0x07f5('0xc'),auth[_0x07f5('0xd')](),controller[_0x07f5('0xe')]);router[_0x07f5('0xa')](_0x07f5('0xf'),auth[_0x07f5('0xd')](),controller[_0x07f5('0x10')]);router[_0x07f5('0xa')](_0x07f5('0x11'),auth['isAuthenticated'](),controller['download']);router[_0x07f5('0x12')]('/',auth['isAuthenticated'](),controller[_0x07f5('0x13')]);router[_0x07f5('0x14')](_0x07f5('0xf'),auth[_0x07f5('0xd')](),controller[_0x07f5('0x15')]);router[_0x07f5('0x16')]('/:id',auth[_0x07f5('0xd')](),controller[_0x07f5('0x17')]);module['exports']=router; \ No newline at end of file +var _0x531a=['index','/describe','describe','isAuthenticated','download','post','create','put','/:id','update','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./screenRecording.controller','get'];(function(_0x59342a,_0x16827b){var _0x17abc9=function(_0x2f7bfc){while(--_0x2f7bfc){_0x59342a['push'](_0x59342a['shift']());}};_0x17abc9(++_0x16827b);}(_0x531a,0xf3));var _0xa531=function(_0x1515c9,_0x3db945){_0x1515c9=_0x1515c9-0x0;var _0x3e9c59=_0x531a[_0x1515c9];return _0x3e9c59;};'use strict';var multer=require('multer');var util=require(_0xa531('0x0'));var path=require('path');var timeout=require(_0xa531('0x1'));var express=require(_0xa531('0x2'));var router=express[_0xa531('0x3')]();var fs_extra=require(_0xa531('0x4'));var auth=require(_0xa531('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xa531('0x6'));var controller=require(_0xa531('0x7'));router[_0xa531('0x8')]('/',auth['isAuthenticated'](),controller[_0xa531('0x9')]);router[_0xa531('0x8')](_0xa531('0xa'),auth['isAuthenticated'](),controller[_0xa531('0xb')]);router[_0xa531('0x8')]('/:id',auth[_0xa531('0xc')](),controller['show']);router[_0xa531('0x8')]('/:id/download',auth[_0xa531('0xc')](),controller[_0xa531('0xd')]);router[_0xa531('0xe')]('/',auth[_0xa531('0xc')](),controller[_0xa531('0xf')]);router[_0xa531('0x10')](_0xa531('0x11'),auth['isAuthenticated'](),controller[_0xa531('0x12')]);router['delete'](_0xa531('0x11'),auth[_0xa531('0xc')](),controller[_0xa531('0x13')]);module[_0xa531('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 1a3e1a1..caee9a2 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 _0xe2cf=['../../config/environment','VIRTUAL','getDataValue','value','extname','STRING','INTEGER','startedAt','subtract','closedAt','setDataValue','duration','DATE','format','toString','createdAt','updatedAt','MM-DD-YYYY\x20HH:mm','moment'];(function(_0x47dba8,_0x58eab0){var _0x7d9c4b=function(_0x15203d){while(--_0x15203d){_0x47dba8['push'](_0x47dba8['shift']());}};_0x7d9c4b(++_0x58eab0);}(_0xe2cf,0x1a1));var _0xfe2c=function(_0x2e8775,_0x310049){_0x2e8775=_0x2e8775-0x0;var _0x4cbf35=_0xe2cf[_0x2e8775];return _0x4cbf35;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xfe2c('0x0'));var path=require('path');var config=require(_0xfe2c('0x1'));module['exports']={'format':{'type':Sequelize[_0xfe2c('0x2')],'get':function(){return this[_0xfe2c('0x3')](_0xfe2c('0x4'))?path[_0xfe2c('0x5')](this['getDataValue'](_0xfe2c('0x4'))):undefined;}},'interactionid':{'type':Sequelize[_0xfe2c('0x6')]},'channel':{'type':Sequelize['STRING']},'value':{'type':Sequelize['STRING'],'set':function(_0x4e0b97){var _0x417bc4=_0x4e0b97['replace'](/\\/g,'/');this['setDataValue'](_0xfe2c('0x4'),_0x417bc4);}},'rating':{'type':Sequelize[_0xfe2c('0x7')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0xfe2c('0x7')],'set':function(_0x562414){this['setDataValue'](_0xfe2c('0x8'),moment()[_0xfe2c('0x9')](_0x562414,'ms'));this['setDataValue'](_0xfe2c('0xa'),moment());this[_0xfe2c('0xb')](_0xfe2c('0xc'),_0x562414);}},'startedAt':{'type':Sequelize[_0xfe2c('0xd')],'get':function(){return moment(this[_0xfe2c('0x3')](_0xfe2c('0x8')))[_0xfe2c('0xe')]('MM-DD-YYYY\x20HH:mm')['toString']();}},'closedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this['getDataValue'](_0xfe2c('0xa')))['format']('MM-DD-YYYY\x20HH:mm')[_0xfe2c('0xf')]();}},'createdAt':{'type':Sequelize[_0xfe2c('0xd')],'get':function(){return moment(this[_0xfe2c('0x3')](_0xfe2c('0x10')))['format']('MM-DD-YYYY\x20HH:mm')[_0xfe2c('0xf')]();}},'updatedAt':{'type':Sequelize[_0xfe2c('0xd')],'get':function(){return moment(this[_0xfe2c('0x3')](_0xfe2c('0x11')))['format'](_0xfe2c('0x12'))[_0xfe2c('0xf')]();}}}; \ No newline at end of file +var _0x46cb=['sequelize','moment','path','../../config/environment','VIRTUAL','getDataValue','value','extname','STRING','replace','setDataValue','INTEGER','startedAt','subtract','duration','DATE','format','MM-DD-YYYY\x20HH:mm','toString','closedAt','createdAt','updatedAt'];(function(_0x116f38,_0x31d8a1){var _0x3dc58b=function(_0x2cd7e1){while(--_0x2cd7e1){_0x116f38['push'](_0x116f38['shift']());}};_0x3dc58b(++_0x31d8a1);}(_0x46cb,0x84));var _0xb46c=function(_0x1d0458,_0x4ed6d4){_0x1d0458=_0x1d0458-0x0;var _0x2fad3c=_0x46cb[_0x1d0458];return _0x2fad3c;};'use strict';var Sequelize=require(_0xb46c('0x0'));var moment=require(_0xb46c('0x1'));var path=require(_0xb46c('0x2'));var config=require(_0xb46c('0x3'));module['exports']={'format':{'type':Sequelize[_0xb46c('0x4')],'get':function(){return this[_0xb46c('0x5')](_0xb46c('0x6'))?path[_0xb46c('0x7')](this['getDataValue'](_0xb46c('0x6'))):undefined;}},'interactionid':{'type':Sequelize[_0xb46c('0x8')]},'channel':{'type':Sequelize[_0xb46c('0x8')]},'value':{'type':Sequelize['STRING'],'set':function(_0x16554f){var _0x595776=_0x16554f[_0xb46c('0x9')](/\\/g,'/');this[_0xb46c('0xa')]('value',_0x595776);}},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0xb46c('0xb')],'set':function(_0x12a113){this[_0xb46c('0xa')](_0xb46c('0xc'),moment()[_0xb46c('0xd')](_0x12a113,'ms'));this[_0xb46c('0xa')]('closedAt',moment());this[_0xb46c('0xa')](_0xb46c('0xe'),_0x12a113);}},'startedAt':{'type':Sequelize[_0xb46c('0xf')],'get':function(){return moment(this[_0xb46c('0x5')]('startedAt'))[_0xb46c('0x10')](_0xb46c('0x11'))[_0xb46c('0x12')]();}},'closedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0xb46c('0x5')](_0xb46c('0x13')))['format'](_0xb46c('0x11'))[_0xb46c('0x12')]();}},'createdAt':{'type':Sequelize[_0xb46c('0xf')],'get':function(){return moment(this[_0xb46c('0x5')](_0xb46c('0x14')))[_0xb46c('0x10')](_0xb46c('0x11'))['toString']();}},'updatedAt':{'type':Sequelize[_0xb46c('0xf')],'get':function(){return moment(this[_0xb46c('0x5')](_0xb46c('0x15')))[_0xb46c('0x10')](_0xb46c('0x11'))[_0xb46c('0x12')]();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index 330f5c2..a81ee80 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 _0x3eea=['filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','options','includeAll','include','rows','catch','show','params','merge','find','create','body','createdAt','closedAt','value','describe','../../components/encryptor','uniqueid','join','format','existsSync','decryptFile','secrets','recording','server/files/screen_recordings','Sequelize','ValidationError','ScreenRecording\x20not\x20found','download','filename','extname','Not\x20found','isNil','root','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','ScreenRecording','rawAttributes','fieldName','type','key','model','differenceBy','query','keys'];(function(_0x2e8c1c,_0x376d2f){var _0x286834=function(_0x4e12e0){while(--_0x4e12e0){_0x2e8c1c['push'](_0x2e8c1c['shift']());}};_0x286834(++_0x376d2f);}(_0x3eea,0x1ca));var _0xa3ee=function(_0x57598d,_0xc8f374){_0x57598d=_0x57598d-0x0;var _0x25f9fd=_0x3eea[_0x57598d];return _0x25f9fd;};'use strict';var emlformat=require(_0xa3ee('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa3ee('0x1'));var jsonpatch=require(_0xa3ee('0x2'));var rp=require(_0xa3ee('0x3'));var moment=require(_0xa3ee('0x4'));var BPromise=require(_0xa3ee('0x5'));var Mustache=require(_0xa3ee('0x6'));var util=require(_0xa3ee('0x7'));var path=require(_0xa3ee('0x8'));var sox=require(_0xa3ee('0x9'));var csv=require(_0xa3ee('0xa'));var ejs=require(_0xa3ee('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xa3ee('0xc'));var crypto=require('crypto');var jsforce=require(_0xa3ee('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xa3ee('0xa'));var querystring=require('querystring');var Papa=require(_0xa3ee('0xe'));var Redis=require('ioredis');var authService=require(_0xa3ee('0xf'));var qs=require(_0xa3ee('0x10'));var as=require(_0xa3ee('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa3ee('0x12'))(_0xa3ee('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xa3ee('0x14'));var db=require(_0xa3ee('0x15'))['db'];function respondWithStatusCode(_0x403518,_0x4363d1){_0x4363d1=_0x4363d1||0xcc;return function(_0x594c88){if(_0x594c88){return _0x403518[_0xa3ee('0x16')](_0x4363d1);}return _0x403518['status'](_0x4363d1)[_0xa3ee('0x17')]();};}function respondWithResult(_0x20535f,_0x2c34cf){_0x2c34cf=_0x2c34cf||0xc8;return function(_0x150e20){if(_0x150e20){return _0x20535f['status'](_0x2c34cf)[_0xa3ee('0x18')](_0x150e20);}};}function respondWithFilteredResult(_0x23df7d,_0x5da681){return function(_0x5358aa){if(_0x5358aa){var _0x4b2c66=typeof _0x5da681[_0xa3ee('0x19')]===_0xa3ee('0x1a')&&typeof _0x5da681[_0xa3ee('0x1b')]===_0xa3ee('0x1a');var _0x4cc8bb=_0x5358aa[_0xa3ee('0x1c')];var _0x40ffdb=_0x4b2c66?0x0:_0x5da681[_0xa3ee('0x19')];var _0x299b1e=_0x4b2c66?_0x5358aa[_0xa3ee('0x1c')]:_0x5da681['offset']+_0x5da681[_0xa3ee('0x1b')];var _0x18b738;if(_0x299b1e>=_0x4cc8bb){_0x299b1e=_0x4cc8bb;_0x18b738=0xc8;}else{_0x18b738=0xce;}_0x23df7d[_0xa3ee('0x1d')](_0x18b738);return _0x23df7d[_0xa3ee('0x1e')](_0xa3ee('0x1f'),_0x40ffdb+'-'+_0x299b1e+'/'+_0x4cc8bb)[_0xa3ee('0x18')](_0x5358aa);}return null;};}function patchUpdates(_0x4f8c56){return function(_0x3f5d70){try{jsonpatch[_0xa3ee('0x20')](_0x3f5d70,_0x4f8c56,!![]);}catch(_0x4b8445){return BPromise[_0xa3ee('0x21')](_0x4b8445);}return _0x3f5d70['save']();};}function saveUpdates(_0x2fab5,_0x29df43){return function(_0x1d3022){if(_0x1d3022){return _0x1d3022[_0xa3ee('0x22')](_0x2fab5)[_0xa3ee('0x23')](function(_0x47108f){return _0x47108f;});}return null;};}function removeEntity(_0x3ce61b,_0x12108e){return function(_0x5ae0a1){if(_0x5ae0a1){return _0x5ae0a1[_0xa3ee('0x24')]()['then'](function(){_0x3ce61b[_0xa3ee('0x1d')](0xcc)[_0xa3ee('0x17')]();});}};}function handleEntityNotFound(_0x157071,_0x1fe4b4){return function(_0x2c48db){if(!_0x2c48db){_0x157071['sendStatus'](0x194);}return _0x2c48db;};}function handleError(_0x3c68f9,_0x1b766e){_0x1b766e=_0x1b766e||0x1f4;return function(_0x146493){logger[_0xa3ee('0x25')](_0x146493[_0xa3ee('0x26')]);if(_0x146493[_0xa3ee('0x27')]){delete _0x146493[_0xa3ee('0x27')];}_0x3c68f9[_0xa3ee('0x1d')](_0x1b766e)[_0xa3ee('0x28')](_0x146493);};}exports[_0xa3ee('0x29')]=function(_0x59c6f9,_0x5ba571){var _0x4abf49={},_0x78e581={},_0x481358={'count':0x0,'rows':[]};var _0x3fa094=_[_0xa3ee('0x2a')](db[_0xa3ee('0x2b')][_0xa3ee('0x2c')],function(_0x26b222){return{'name':_0x26b222[_0xa3ee('0x2d')],'type':_0x26b222[_0xa3ee('0x2e')][_0xa3ee('0x2f')]};});_0x78e581[_0xa3ee('0x30')]=_[_0xa3ee('0x31')](_['map'](_0x3fa094,_0xa3ee('0x27')),['format']);_0x78e581[_0xa3ee('0x32')]=_[_0xa3ee('0x33')](_0x59c6f9['query']);_0x78e581[_0xa3ee('0x34')]=_['intersection'](_0x78e581[_0xa3ee('0x30')],_0x78e581['query']);_0x4abf49[_0xa3ee('0x35')]=_[_0xa3ee('0x36')](_0x78e581[_0xa3ee('0x30')],qs[_0xa3ee('0x37')](_0x59c6f9[_0xa3ee('0x32')]['fields']));_0x4abf49[_0xa3ee('0x35')]=_0x4abf49[_0xa3ee('0x35')][_0xa3ee('0x38')]?_0x4abf49['attributes']:_0x78e581[_0xa3ee('0x30')];if(!_0x59c6f9['query'][_0xa3ee('0x39')]('nolimit')){_0x4abf49[_0xa3ee('0x1b')]=qs['limit'](_0x59c6f9[_0xa3ee('0x32')][_0xa3ee('0x1b')]);_0x4abf49[_0xa3ee('0x19')]=qs[_0xa3ee('0x19')](_0x59c6f9[_0xa3ee('0x32')][_0xa3ee('0x19')]);}_0x4abf49[_0xa3ee('0x3a')]=qs[_0xa3ee('0x3b')](_0x59c6f9[_0xa3ee('0x32')][_0xa3ee('0x3b')]);_0x4abf49[_0xa3ee('0x3c')]=qs[_0xa3ee('0x34')](_[_0xa3ee('0x3d')](_0x59c6f9['query'],_0x78e581[_0xa3ee('0x34')]),_0x3fa094);if(_0x59c6f9[_0xa3ee('0x32')][_0xa3ee('0x3e')]){_0x4abf49[_0xa3ee('0x3c')]=_['merge'](_0x4abf49[_0xa3ee('0x3c')],{'$or':_[_0xa3ee('0x2a')](_0x3fa094,function(_0x1a9b63){if(_0x1a9b63['type']!==_0xa3ee('0x3f')){var _0x3554eb={};_0x3554eb[_0x1a9b63['name']]={'$like':'%'+_0x59c6f9[_0xa3ee('0x32')][_0xa3ee('0x3e')]+'%'};return _0x3554eb;}})});}_0x4abf49=_['merge']({},_0x4abf49,_0x59c6f9[_0xa3ee('0x40')]);var _0x6dd235={'where':_0x4abf49[_0xa3ee('0x3c')]};return db[_0xa3ee('0x2b')][_0xa3ee('0x1c')](_0x6dd235)[_0xa3ee('0x23')](function(_0x2ca04f){_0x481358[_0xa3ee('0x1c')]=_0x2ca04f;if(_0x59c6f9[_0xa3ee('0x32')][_0xa3ee('0x41')]){_0x4abf49[_0xa3ee('0x42')]=[{'all':!![]}];}return db['ScreenRecording']['findAll'](_0x4abf49);})['then'](function(_0x45aeec){_0x481358[_0xa3ee('0x43')]=_0x45aeec;return _0x481358;})['then'](respondWithFilteredResult(_0x5ba571,_0x4abf49))[_0xa3ee('0x44')](handleError(_0x5ba571,null));};exports[_0xa3ee('0x45')]=function(_0x279834,_0x55f47f){var _0x1af10b={'raw':![],'where':{'id':_0x279834[_0xa3ee('0x46')]['id']}},_0x559cc1={};_0x559cc1[_0xa3ee('0x30')]=_[_0xa3ee('0x33')](db[_0xa3ee('0x2b')][_0xa3ee('0x2c')]);_0x559cc1[_0xa3ee('0x32')]=_[_0xa3ee('0x33')](_0x279834[_0xa3ee('0x32')]);_0x559cc1[_0xa3ee('0x34')]=_[_0xa3ee('0x36')](_0x559cc1[_0xa3ee('0x30')],_0x559cc1[_0xa3ee('0x32')]);_0x1af10b[_0xa3ee('0x35')]=_[_0xa3ee('0x36')](_0x559cc1[_0xa3ee('0x30')],qs[_0xa3ee('0x37')](_0x279834[_0xa3ee('0x32')][_0xa3ee('0x37')]));_0x1af10b['attributes']=_0x1af10b[_0xa3ee('0x35')][_0xa3ee('0x38')]?_0x1af10b[_0xa3ee('0x35')]:_0x559cc1[_0xa3ee('0x30')];if(_0x279834['query'][_0xa3ee('0x41')]){_0x1af10b['include']=[{'all':!![]}];}_0x1af10b=_[_0xa3ee('0x47')]({},_0x1af10b,_0x279834[_0xa3ee('0x40')]);return db[_0xa3ee('0x2b')][_0xa3ee('0x48')](_0x1af10b)[_0xa3ee('0x23')](handleEntityNotFound(_0x55f47f,null))[_0xa3ee('0x23')](respondWithResult(_0x55f47f,null))[_0xa3ee('0x44')](handleError(_0x55f47f,null));};exports[_0xa3ee('0x49')]=function(_0x3c3677,_0xd6160e){return db['ScreenRecording'][_0xa3ee('0x49')](_0x3c3677['body'],{})['then'](respondWithResult(_0xd6160e,0xc9))[_0xa3ee('0x44')](handleError(_0xd6160e,null));};exports[_0xa3ee('0x22')]=function(_0x45029f,_0x1ec479){if(_0x45029f[_0xa3ee('0x4a')]['id']){delete _0x45029f[_0xa3ee('0x4a')]['id'];}delete _0x45029f[_0xa3ee('0x4a')]['duration'];delete _0x45029f[_0xa3ee('0x4a')][_0xa3ee('0x4b')];delete _0x45029f['body'][_0xa3ee('0x4c')];delete _0x45029f[_0xa3ee('0x4a')][_0xa3ee('0x4d')];return db['ScreenRecording']['find']({'where':{'id':_0x45029f[_0xa3ee('0x46')]['id']}})[_0xa3ee('0x23')](handleEntityNotFound(_0x1ec479,null))[_0xa3ee('0x23')](saveUpdates(_0x45029f[_0xa3ee('0x4a')],null))[_0xa3ee('0x23')](respondWithResult(_0x1ec479,null))['catch'](handleError(_0x1ec479,null));};exports['describe']=function(_0x15b55e,_0x441b23){return db['ScreenRecording'][_0xa3ee('0x4e')]()[_0xa3ee('0x23')](respondWithResult(_0x441b23,null))[_0xa3ee('0x44')](handleError(_0x441b23,null));};exports['download']=function(_0x505444,_0x2388f7,_0x49057c){var _0x172a73=require(_0xa3ee('0x4f'));var _0x5b8e79=![];var _0x4232e0={};if(_0x505444[_0xa3ee('0x32')][_0xa3ee('0x2e')]&&_0x505444['query'][_0xa3ee('0x2e')]===_0xa3ee('0x50')){_0x4232e0['uniqueid']=_0x505444[_0xa3ee('0x46')]['id'];}else{_0x4232e0['id']=_0x505444[_0xa3ee('0x46')]['id'];}return db[_0xa3ee('0x2b')]['find']({'where':_0x4232e0,'attributes':['id','value'],'raw':!![]})[_0xa3ee('0x23')](handleEntityNotFound(_0x2388f7,null))[_0xa3ee('0x23')](function(_0x4a1a2f){if(_0x4a1a2f){var _0x1f9913=path[_0xa3ee('0x51')](config['root'],'server/files/screen_recordings',_0x4a1a2f[_0xa3ee('0x4d')]);var _0x659491=util[_0xa3ee('0x52')]('%s.cypher',_0x1f9913);if(fs[_0xa3ee('0x53')](_0x659491)){_0x5b8e79=!![];return _0x172a73[_0xa3ee('0x54')](_0x659491,_0x1f9913,config[_0xa3ee('0x55')][_0xa3ee('0x56')])[_0xa3ee('0x23')](function(){return _0x4a1a2f;});}return _0x4a1a2f;}})[_0xa3ee('0x23')](function(_0x497be4){if(_0x497be4){var _0x10f508=path[_0xa3ee('0x51')](config['root'],_0xa3ee('0x57'),_0x497be4[_0xa3ee('0x4d')]);if(!fs[_0xa3ee('0x53')](_0x10f508)){throw new db[(_0xa3ee('0x58'))][(_0xa3ee('0x59'))](_0xa3ee('0x5a'));}if(_0x497be4['filename']){return _0x2388f7[_0xa3ee('0x5b')](_0x10f508,_0x497be4[_0xa3ee('0x5c')]+path[_0xa3ee('0x5d')](_0x10f508),function(){if(_0x5b8e79){fs['unlink'](_0x10f508);}});}else{return _0x2388f7[_0xa3ee('0x5b')](_0x10f508,function(_0x13b81b){if(_0x5b8e79){fs['unlink'](_0x10f508);}});}}})['catch'](function(_0x4df186){if(_0x4df186['message']===_0xa3ee('0x5a')){_0x2388f7[_0xa3ee('0x1d')](0x194)[_0xa3ee('0x28')](_0xa3ee('0x5e'));}else{return handleError(_0x2388f7,null);}});};exports[_0xa3ee('0x24')]=function(_0x18a164,_0x4000ee){return db['ScreenRecording'][_0xa3ee('0x48')]({'where':{'id':_0x18a164[_0xa3ee('0x46')]['id']}})[_0xa3ee('0x23')](function(_0xaff641){if(_[_0xa3ee('0x5f')](_0xaff641)){throw new ReferenceError('Entity\x20not\x20found');}return _0xaff641;})['then'](function(_0x7b1e97){var _0x303b71=path[_0xa3ee('0x51')](config[_0xa3ee('0x60')],_0xa3ee('0x57'),_0x7b1e97[_0xa3ee('0x4d')]);logger[_0xa3ee('0x61')](_0xa3ee('0x62'),_0x303b71);if(!_[_0xa3ee('0x5f')](_0x7b1e97[_0xa3ee('0x4d')])&&fs[_0xa3ee('0x53')](_0x303b71)){logger[_0xa3ee('0x61')](_0xa3ee('0x63')+_0x303b71+_0xa3ee('0x64'));fs[_0xa3ee('0x65')](_0x303b71);}_0x303b71=_0x303b71+'.cypher';if(!_[_0xa3ee('0x5f')](_0x7b1e97['value'])&&fs['existsSync'](_0x303b71)){logger[_0xa3ee('0x61')]('File:\x20\x22'+_0x303b71+_0xa3ee('0x64'));fs[_0xa3ee('0x65')](_0x303b71);}return _0x7b1e97;})[_0xa3ee('0x23')](function(_0x221deb){if(!_0x221deb)throw new InternalError();return _0x221deb['destroy']();})[_0xa3ee('0x23')](function(){_0x4000ee[_0xa3ee('0x1d')](0xcc)[_0xa3ee('0x17')]();})[_0xa3ee('0x44')](handleError(_0x4000ee,null));}; \ No newline at end of file +var _0x9c5a=['ScreenRecording','includeAll','findAll','rows','catch','params','include','find','create','body','duration','createdAt','closedAt','value','describe','download','uniqueid','join','root','server/files/screen_recordings','%s.cypher','decryptFile','recording','existsSync','Sequelize','ScreenRecording\x20not\x20found','filename','unlink','message','Not\x20found','destroy','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','save','update','then','stack','name','send','map','rawAttributes','fieldName','key','model','format','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','options'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9c5a,0x1c3));var _0xa9c5=function(_0x4c1fd2,_0x22f209){_0x4c1fd2=_0x4c1fd2-0x0;var _0x1f6f94=_0x9c5a[_0x4c1fd2];return _0x1f6f94;};'use strict';var emlformat=require(_0xa9c5('0x0'));var rimraf=require(_0xa9c5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa9c5('0x2'));var rp=require(_0xa9c5('0x3'));var moment=require(_0xa9c5('0x4'));var BPromise=require(_0xa9c5('0x5'));var Mustache=require('mustache');var util=require(_0xa9c5('0x6'));var path=require(_0xa9c5('0x7'));var sox=require('sox');var csv=require(_0xa9c5('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa9c5('0x9'));var _=require(_0xa9c5('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xa9c5('0xb'));var deskjs=require(_0xa9c5('0xc'));var toCsv=require('to-csv');var querystring=require(_0xa9c5('0xd'));var Papa=require(_0xa9c5('0xe'));var Redis=require('ioredis');var authService=require(_0xa9c5('0xf'));var qs=require(_0xa9c5('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xa9c5('0x11'))(_0xa9c5('0x12'));var utils=require(_0xa9c5('0x13'));var config=require(_0xa9c5('0x14'));var licenseUtil=require(_0xa9c5('0x15'));var db=require(_0xa9c5('0x16'))['db'];function respondWithStatusCode(_0x51c8d,_0x42d5cf){_0x42d5cf=_0x42d5cf||0xcc;return function(_0x3c5ac7){if(_0x3c5ac7){return _0x51c8d[_0xa9c5('0x17')](_0x42d5cf);}return _0x51c8d['status'](_0x42d5cf)[_0xa9c5('0x18')]();};}function respondWithResult(_0x1276d2,_0x7df76d){_0x7df76d=_0x7df76d||0xc8;return function(_0x3806c4){if(_0x3806c4){return _0x1276d2[_0xa9c5('0x19')](_0x7df76d)[_0xa9c5('0x1a')](_0x3806c4);}};}function respondWithFilteredResult(_0x251099,_0x40b001){return function(_0x19a43e){if(_0x19a43e){var _0xcf13f2=typeof _0x40b001['offset']===_0xa9c5('0x1b')&&typeof _0x40b001[_0xa9c5('0x1c')]===_0xa9c5('0x1b');var _0x55cce5=_0x19a43e[_0xa9c5('0x1d')];var _0x1142d9=_0xcf13f2?0x0:_0x40b001[_0xa9c5('0x1e')];var _0x3b8cf7=_0xcf13f2?_0x19a43e[_0xa9c5('0x1d')]:_0x40b001[_0xa9c5('0x1e')]+_0x40b001[_0xa9c5('0x1c')];var _0x1e5ce6;if(_0x3b8cf7>=_0x55cce5){_0x3b8cf7=_0x55cce5;_0x1e5ce6=0xc8;}else{_0x1e5ce6=0xce;}_0x251099[_0xa9c5('0x19')](_0x1e5ce6);return _0x251099[_0xa9c5('0x1f')](_0xa9c5('0x20'),_0x1142d9+'-'+_0x3b8cf7+'/'+_0x55cce5)[_0xa9c5('0x1a')](_0x19a43e);}return null;};}function patchUpdates(_0x54f8b9){return function(_0x1115ad){try{jsonpatch[_0xa9c5('0x21')](_0x1115ad,_0x54f8b9,!![]);}catch(_0x541c77){return BPromise['reject'](_0x541c77);}return _0x1115ad[_0xa9c5('0x22')]();};}function saveUpdates(_0x366f5c,_0x10b208){return function(_0x3b497a){if(_0x3b497a){return _0x3b497a[_0xa9c5('0x23')](_0x366f5c)[_0xa9c5('0x24')](function(_0x48e2cb){return _0x48e2cb;});}return null;};}function removeEntity(_0x4fa280,_0x3d4e1b){return function(_0x11d395){if(_0x11d395){return _0x11d395['destroy']()[_0xa9c5('0x24')](function(){_0x4fa280[_0xa9c5('0x19')](0xcc)[_0xa9c5('0x18')]();});}};}function handleEntityNotFound(_0x32fc7d,_0x4cbba1){return function(_0x40f08b){if(!_0x40f08b){_0x32fc7d[_0xa9c5('0x17')](0x194);}return _0x40f08b;};}function handleError(_0x51b64a,_0x4e8a7f){_0x4e8a7f=_0x4e8a7f||0x1f4;return function(_0x242771){logger['error'](_0x242771[_0xa9c5('0x25')]);if(_0x242771[_0xa9c5('0x26')]){delete _0x242771['name'];}_0x51b64a[_0xa9c5('0x19')](_0x4e8a7f)[_0xa9c5('0x27')](_0x242771);};}exports['index']=function(_0x413edf,_0x32baf9){var _0x198cdf={},_0x185eb8={},_0x325c65={'count':0x0,'rows':[]};var _0x4f6e70=_[_0xa9c5('0x28')](db['ScreenRecording'][_0xa9c5('0x29')],function(_0x1ef388){return{'name':_0x1ef388[_0xa9c5('0x2a')],'type':_0x1ef388['type'][_0xa9c5('0x2b')]};});_0x185eb8[_0xa9c5('0x2c')]=_['differenceBy'](_[_0xa9c5('0x28')](_0x4f6e70,_0xa9c5('0x26')),[_0xa9c5('0x2d')]);_0x185eb8[_0xa9c5('0x2e')]=_[_0xa9c5('0x2f')](_0x413edf[_0xa9c5('0x2e')]);_0x185eb8[_0xa9c5('0x30')]=_['intersection'](_0x185eb8[_0xa9c5('0x2c')],_0x185eb8[_0xa9c5('0x2e')]);_0x198cdf[_0xa9c5('0x31')]=_[_0xa9c5('0x32')](_0x185eb8[_0xa9c5('0x2c')],qs[_0xa9c5('0x33')](_0x413edf[_0xa9c5('0x2e')][_0xa9c5('0x33')]));_0x198cdf['attributes']=_0x198cdf['attributes'][_0xa9c5('0x34')]?_0x198cdf[_0xa9c5('0x31')]:_0x185eb8[_0xa9c5('0x2c')];if(!_0x413edf[_0xa9c5('0x2e')][_0xa9c5('0x35')](_0xa9c5('0x36'))){_0x198cdf['limit']=qs['limit'](_0x413edf['query'][_0xa9c5('0x1c')]);_0x198cdf[_0xa9c5('0x1e')]=qs['offset'](_0x413edf[_0xa9c5('0x2e')]['offset']);}_0x198cdf[_0xa9c5('0x37')]=qs[_0xa9c5('0x38')](_0x413edf[_0xa9c5('0x2e')][_0xa9c5('0x38')]);_0x198cdf['where']=qs[_0xa9c5('0x30')](_[_0xa9c5('0x39')](_0x413edf[_0xa9c5('0x2e')],_0x185eb8[_0xa9c5('0x30')]),_0x4f6e70);if(_0x413edf[_0xa9c5('0x2e')][_0xa9c5('0x3a')]){_0x198cdf[_0xa9c5('0x3b')]=_[_0xa9c5('0x3c')](_0x198cdf['where'],{'$or':_[_0xa9c5('0x28')](_0x4f6e70,function(_0x46e5d2){if(_0x46e5d2[_0xa9c5('0x3d')]!==_0xa9c5('0x3e')){var _0x1132e0={};_0x1132e0[_0x46e5d2[_0xa9c5('0x26')]]={'$like':'%'+_0x413edf['query'][_0xa9c5('0x3a')]+'%'};return _0x1132e0;}})});}_0x198cdf=_['merge']({},_0x198cdf,_0x413edf[_0xa9c5('0x3f')]);var _0x5c89e7={'where':_0x198cdf[_0xa9c5('0x3b')]};return db[_0xa9c5('0x40')][_0xa9c5('0x1d')](_0x5c89e7)['then'](function(_0x12e19c){_0x325c65[_0xa9c5('0x1d')]=_0x12e19c;if(_0x413edf[_0xa9c5('0x2e')][_0xa9c5('0x41')]){_0x198cdf['include']=[{'all':!![]}];}return db[_0xa9c5('0x40')][_0xa9c5('0x42')](_0x198cdf);})[_0xa9c5('0x24')](function(_0x45668e){_0x325c65[_0xa9c5('0x43')]=_0x45668e;return _0x325c65;})['then'](respondWithFilteredResult(_0x32baf9,_0x198cdf))[_0xa9c5('0x44')](handleError(_0x32baf9,null));};exports['show']=function(_0x1de605,_0x397614){var _0x2998ad={'raw':![],'where':{'id':_0x1de605[_0xa9c5('0x45')]['id']}},_0xc8fca4={};_0xc8fca4[_0xa9c5('0x2c')]=_[_0xa9c5('0x2f')](db[_0xa9c5('0x40')][_0xa9c5('0x29')]);_0xc8fca4[_0xa9c5('0x2e')]=_['keys'](_0x1de605[_0xa9c5('0x2e')]);_0xc8fca4[_0xa9c5('0x30')]=_[_0xa9c5('0x32')](_0xc8fca4[_0xa9c5('0x2c')],_0xc8fca4[_0xa9c5('0x2e')]);_0x2998ad[_0xa9c5('0x31')]=_['intersection'](_0xc8fca4[_0xa9c5('0x2c')],qs[_0xa9c5('0x33')](_0x1de605['query']['fields']));_0x2998ad['attributes']=_0x2998ad['attributes']['length']?_0x2998ad[_0xa9c5('0x31')]:_0xc8fca4[_0xa9c5('0x2c')];if(_0x1de605[_0xa9c5('0x2e')][_0xa9c5('0x41')]){_0x2998ad[_0xa9c5('0x46')]=[{'all':!![]}];}_0x2998ad=_[_0xa9c5('0x3c')]({},_0x2998ad,_0x1de605[_0xa9c5('0x3f')]);return db[_0xa9c5('0x40')][_0xa9c5('0x47')](_0x2998ad)[_0xa9c5('0x24')](handleEntityNotFound(_0x397614,null))[_0xa9c5('0x24')](respondWithResult(_0x397614,null))[_0xa9c5('0x44')](handleError(_0x397614,null));};exports[_0xa9c5('0x48')]=function(_0x4bf8b4,_0x1108f0){return db['ScreenRecording'][_0xa9c5('0x48')](_0x4bf8b4[_0xa9c5('0x49')],{})['then'](respondWithResult(_0x1108f0,0xc9))['catch'](handleError(_0x1108f0,null));};exports[_0xa9c5('0x23')]=function(_0x32e64a,_0xeb0720){if(_0x32e64a['body']['id']){delete _0x32e64a['body']['id'];}delete _0x32e64a[_0xa9c5('0x49')][_0xa9c5('0x4a')];delete _0x32e64a['body'][_0xa9c5('0x4b')];delete _0x32e64a[_0xa9c5('0x49')][_0xa9c5('0x4c')];delete _0x32e64a[_0xa9c5('0x49')][_0xa9c5('0x4d')];return db[_0xa9c5('0x40')]['find']({'where':{'id':_0x32e64a['params']['id']}})['then'](handleEntityNotFound(_0xeb0720,null))[_0xa9c5('0x24')](saveUpdates(_0x32e64a[_0xa9c5('0x49')],null))[_0xa9c5('0x24')](respondWithResult(_0xeb0720,null))[_0xa9c5('0x44')](handleError(_0xeb0720,null));};exports[_0xa9c5('0x4e')]=function(_0x15d044,_0x56bc1d){return db[_0xa9c5('0x40')][_0xa9c5('0x4e')]()[_0xa9c5('0x24')](respondWithResult(_0x56bc1d,null))[_0xa9c5('0x44')](handleError(_0x56bc1d,null));};exports[_0xa9c5('0x4f')]=function(_0x242e8a,_0x547654,_0x4fcc44){var _0x10ff6b=require('../../components/encryptor');var _0x1b158f=![];var _0x5ea9b0={};if(_0x242e8a[_0xa9c5('0x2e')][_0xa9c5('0x3d')]&&_0x242e8a[_0xa9c5('0x2e')]['type']===_0xa9c5('0x50')){_0x5ea9b0[_0xa9c5('0x50')]=_0x242e8a[_0xa9c5('0x45')]['id'];}else{_0x5ea9b0['id']=_0x242e8a[_0xa9c5('0x45')]['id'];}return db['ScreenRecording']['find']({'where':_0x5ea9b0,'attributes':['id',_0xa9c5('0x4d')],'raw':!![]})[_0xa9c5('0x24')](handleEntityNotFound(_0x547654,null))[_0xa9c5('0x24')](function(_0x5b4323){if(_0x5b4323){var _0x31e12e=path[_0xa9c5('0x51')](config[_0xa9c5('0x52')],_0xa9c5('0x53'),_0x5b4323[_0xa9c5('0x4d')]);var _0x29b198=util[_0xa9c5('0x2d')](_0xa9c5('0x54'),_0x31e12e);if(fs['existsSync'](_0x29b198)){_0x1b158f=!![];return _0x10ff6b[_0xa9c5('0x55')](_0x29b198,_0x31e12e,config['secrets'][_0xa9c5('0x56')])[_0xa9c5('0x24')](function(){return _0x5b4323;});}return _0x5b4323;}})[_0xa9c5('0x24')](function(_0x4dfe3a){if(_0x4dfe3a){var _0x4d475a=path[_0xa9c5('0x51')](config['root'],_0xa9c5('0x53'),_0x4dfe3a[_0xa9c5('0x4d')]);if(!fs[_0xa9c5('0x57')](_0x4d475a)){throw new db[(_0xa9c5('0x58'))]['ValidationError'](_0xa9c5('0x59'));}if(_0x4dfe3a[_0xa9c5('0x5a')]){return _0x547654[_0xa9c5('0x4f')](_0x4d475a,_0x4dfe3a[_0xa9c5('0x5a')]+path['extname'](_0x4d475a),function(){if(_0x1b158f){fs['unlink'](_0x4d475a);}});}else{return _0x547654[_0xa9c5('0x4f')](_0x4d475a,function(_0x3deb64){if(_0x1b158f){fs[_0xa9c5('0x5b')](_0x4d475a);}});}}})[_0xa9c5('0x44')](function(_0x279a26){if(_0x279a26[_0xa9c5('0x5c')]==='ScreenRecording\x20not\x20found'){_0x547654[_0xa9c5('0x19')](0x194)[_0xa9c5('0x27')](_0xa9c5('0x5d'));}else{return handleError(_0x547654,null);}});};exports[_0xa9c5('0x5e')]=function(_0x2b8575,_0x372ab9){return db[_0xa9c5('0x40')][_0xa9c5('0x47')]({'where':{'id':_0x2b8575[_0xa9c5('0x45')]['id']}})[_0xa9c5('0x24')](function(_0x50d438){if(_['isNil'](_0x50d438)){throw new ReferenceError(_0xa9c5('0x5f'));}return _0x50d438;})[_0xa9c5('0x24')](function(_0x3322cc){var _0x47afaa=path['join'](config[_0xa9c5('0x52')],'server/files/screen_recordings',_0x3322cc[_0xa9c5('0x4d')]);logger[_0xa9c5('0x60')](_0xa9c5('0x61'),_0x47afaa);if(!_[_0xa9c5('0x62')](_0x3322cc[_0xa9c5('0x4d')])&&fs[_0xa9c5('0x57')](_0x47afaa)){logger[_0xa9c5('0x60')](_0xa9c5('0x63')+_0x47afaa+_0xa9c5('0x64'));fs[_0xa9c5('0x65')](_0x47afaa);}_0x47afaa=_0x47afaa+_0xa9c5('0x66');if(!_[_0xa9c5('0x62')](_0x3322cc['value'])&&fs[_0xa9c5('0x57')](_0x47afaa)){logger[_0xa9c5('0x60')](_0xa9c5('0x63')+_0x47afaa+_0xa9c5('0x64'));fs[_0xa9c5('0x65')](_0x47afaa);}return _0x3322cc;})[_0xa9c5('0x24')](function(_0x28ba54){if(!_0x28ba54)throw new InternalError();return _0x28ba54['destroy']();})['then'](function(){_0x372ab9[_0xa9c5('0x19')](0xcc)['end']();})[_0xa9c5('0x44')](handleError(_0x372ab9,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index fecd14f..99513a5 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 _0x3831=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports','define','ScreenRecording','interactionid','lodash'];(function(_0x486f24,_0x154583){var _0x4b75f7=function(_0x24b6a0){while(--_0x24b6a0){_0x486f24['push'](_0x486f24['shift']());}};_0x4b75f7(++_0x154583);}(_0x3831,0x15e));var _0x1383=function(_0x397157,_0x495686){_0x397157=_0x397157-0x0;var _0x5a038e=_0x3831[_0x397157];return _0x5a038e;};'use strict';var _=require(_0x1383('0x0'));var util=require(_0x1383('0x1'));var logger=require(_0x1383('0x2'))(_0x1383('0x3'));var moment=require(_0x1383('0x4'));var BPromise=require(_0x1383('0x5'));var rp=require(_0x1383('0x6'));var fs=require('fs');var path=require(_0x1383('0x7'));var rimraf=require(_0x1383('0x8'));var config=require('../../config/environment');var attributes=require('./screenRecording.attributes');module[_0x1383('0x9')]=function(_0x5c58b5,_0x2feb51){return _0x5c58b5[_0x1383('0xa')](_0x1383('0xb'),attributes,{'tableName':'screen_recordings','paranoid':![],'indexes':[{'name':'interactionid','fields':[_0x1383('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc316=['request-promise','path','rimraf','./screenRecording.attributes','exports','define','screen_recordings','interactionid','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0xc316,0x1ba));var _0x6c31=function(_0x1d30fc,_0x3ab679){_0x1d30fc=_0x1d30fc-0x0;var _0x3c27e3=_0xc316[_0x1d30fc];return _0x3c27e3;};'use strict';var _=require(_0x6c31('0x0'));var util=require(_0x6c31('0x1'));var logger=require(_0x6c31('0x2'))(_0x6c31('0x3'));var moment=require(_0x6c31('0x4'));var BPromise=require(_0x6c31('0x5'));var rp=require(_0x6c31('0x6'));var fs=require('fs');var path=require(_0x6c31('0x7'));var rimraf=require(_0x6c31('0x8'));var config=require('../../config/environment');var attributes=require(_0x6c31('0x9'));module[_0x6c31('0xa')]=function(_0x419afc,_0x4674f7){return _0x419afc[_0x6c31('0xb')]('ScreenRecording',attributes,{'tableName':_0x6c31('0xc'),'paranoid':![],'indexes':[{'name':_0x6c31('0xd'),'fields':[_0x6c31('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index aae3336..c616a0f 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 _0x218a=['../../config/utils','../../config/logger','jayson/promise','client','http','request','then','ScreenRecording,\x20%s,\x20%s','request\x20sent','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','lodash','util','moment','ioredis','../../mysqldb'];(function(_0x461e42,_0x4d40be){var _0x5d8b74=function(_0x5d3996){while(--_0x5d3996){_0x461e42['push'](_0x461e42['shift']());}};_0x5d8b74(++_0x4d40be);}(_0x218a,0x119));var _0xa218=function(_0x456c2c,_0x1030cb){_0x456c2c=_0x456c2c-0x0;var _0x440260=_0x218a[_0x456c2c];return _0x440260;};'use strict';var _=require(_0xa218('0x0'));var util=require(_0xa218('0x1'));var moment=require(_0xa218('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa218('0x3'));var db=require(_0xa218('0x4'))['db'];var utils=require(_0xa218('0x5'));var logger=require(_0xa218('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xa218('0x7'));var client=jayson[_0xa218('0x8')][_0xa218('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1e160f,_0x1a13e7,_0x1eda58){return new BPromise(function(_0x4989d0,_0x22ca79){return client[_0xa218('0xa')](_0x1e160f,_0x1eda58)[_0xa218('0xb')](function(_0x4c2479){logger['info'](_0xa218('0xc'),_0x1a13e7,_0xa218('0xd'));logger[_0xa218('0xe')](_0xa218('0xf'),_0x1a13e7,_0xa218('0xd'),JSON[_0xa218('0x10')](_0x4c2479));if(_0x4c2479[_0xa218('0x11')]){if(_0x4c2479[_0xa218('0x11')]['code']===0x1f4){logger[_0xa218('0x11')](_0xa218('0xc'),_0x1a13e7,_0x4c2479[_0xa218('0x11')]['message']);return _0x22ca79(_0x4c2479[_0xa218('0x11')][_0xa218('0x12')]);}logger[_0xa218('0x11')](_0xa218('0xc'),_0x1a13e7,_0x4c2479['error']['message']);return _0x4989d0(_0x4c2479['error']['message']);}else{logger[_0xa218('0x13')](_0xa218('0xc'),_0x1a13e7,_0xa218('0xd'));_0x4989d0(_0x4c2479[_0xa218('0x14')][_0xa218('0x12')]);}})[_0xa218('0x15')](function(_0x5311b7){logger['error'](_0xa218('0xc'),_0x1a13e7,_0x5311b7);_0x22ca79(_0x5311b7);});});} \ No newline at end of file +var _0x9dfb=['ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','request','then','info','request\x20sent','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','stringify','error','ScreenRecording,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x9dfb,0xee));var _0xb9df=function(_0x388da1,_0x47ef1f){_0x388da1=_0x388da1-0x0;var _0x2be219=_0x9dfb[_0x388da1];return _0x2be219;};'use strict';var _=require(_0xb9df('0x0'));var util=require('util');var moment=require(_0xb9df('0x1'));var BPromise=require(_0xb9df('0x2'));var rs=require(_0xb9df('0x3'));var fs=require('fs');var Redis=require(_0xb9df('0x4'));var db=require(_0xb9df('0x5'))['db'];var utils=require(_0xb9df('0x6'));var logger=require(_0xb9df('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xb9df('0x8'));var client=jayson[_0xb9df('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x24ec02,_0x3d6da4,_0x24a461){return new BPromise(function(_0x4be021,_0x4cc6ee){return client[_0xb9df('0xa')](_0x24ec02,_0x24a461)[_0xb9df('0xb')](function(_0x3d2076){logger[_0xb9df('0xc')]('ScreenRecording,\x20%s,\x20%s',_0x3d6da4,_0xb9df('0xd'));logger[_0xb9df('0xe')](_0xb9df('0xf'),_0x3d6da4,'request\x20sent',JSON[_0xb9df('0x10')](_0x3d2076));if(_0x3d2076[_0xb9df('0x11')]){if(_0x3d2076[_0xb9df('0x11')]['code']===0x1f4){logger[_0xb9df('0x11')](_0xb9df('0x12'),_0x3d6da4,_0x3d2076[_0xb9df('0x11')][_0xb9df('0x13')]);return _0x4cc6ee(_0x3d2076[_0xb9df('0x11')][_0xb9df('0x13')]);}logger['error'](_0xb9df('0x12'),_0x3d6da4,_0x3d2076[_0xb9df('0x11')]['message']);return _0x4be021(_0x3d2076['error']['message']);}else{logger[_0xb9df('0xc')]('ScreenRecording,\x20%s,\x20%s',_0x3d6da4,_0xb9df('0xd'));_0x4be021(_0x3d2076[_0xb9df('0x14')][_0xb9df('0x13')]);}})[_0xb9df('0x15')](function(_0x12fa29){logger[_0xb9df('0x11')]('ScreenRecording,\x20%s,\x20%s',_0x3d6da4,_0x12fa29);_0x4cc6ee(_0x12fa29);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index 901ab88..a80f041 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 _0x52e2=['getLogoLogin','gdpr','/:id/preferred','/:id/favicon','getFavicon','diskStorage','join','server/files/images/logos/','format','%s%s','extname','originalname','post','/:id/logo','single','file','addLogo','root','logologin','/:id/logo_login','addLogoLogin','preferred','addPreferred','favicon','addFavicon','put','update','multer','path','Router','fs-extra','../../components/auth/service','./setting.controller','get','isAuthenticated','index','getDate','/:id','show','getLogo'];(function(_0x191597,_0x19a93f){var _0x416078=function(_0xdfec9f){while(--_0xdfec9f){_0x191597['push'](_0x191597['shift']());}};_0x416078(++_0x19a93f);}(_0x52e2,0x6b));var _0x252e=function(_0x472f25,_0xe8b449){_0x472f25=_0x472f25-0x0;var _0x571434=_0x52e2[_0x472f25];return _0x571434;};'use strict';var multer=require(_0x252e('0x0'));var util=require('util');var path=require(_0x252e('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x252e('0x2')]();var fs_extra=require(_0x252e('0x3'));var auth=require(_0x252e('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x252e('0x5'));router[_0x252e('0x6')]('/',auth[_0x252e('0x7')](),controller[_0x252e('0x8')]);router['get']('/now',controller[_0x252e('0x9')]);router['get'](_0x252e('0xa'),controller[_0x252e('0xb')]);router[_0x252e('0x6')]('/:id/logo',controller[_0x252e('0xc')]);router['get']('/:id/logo_login',controller[_0x252e('0xd')]);router['get']('/:id/gdpr',controller[_0x252e('0xe')]);router[_0x252e('0x6')](_0x252e('0xf'),controller['getPreferred']);router['get'](_0x252e('0x10'),controller[_0x252e('0x11')]);var upload=multer({'storage':multer[_0x252e('0x12')]({'destination':function(_0xfa8460,_0x1f4c1f,_0x550121){_0x550121(null,path[_0x252e('0x13')](config['root'],_0x252e('0x14')));},'filename':function(_0x57ca59,_0xad7512,_0x42fdd6){_0x42fdd6(null,util[_0x252e('0x15')](_0x252e('0x16'),'logo',path[_0x252e('0x17')](_0xad7512[_0x252e('0x18')])));}})});router[_0x252e('0x19')](_0x252e('0x1a'),upload[_0x252e('0x1b')](_0x252e('0x1c')),controller[_0x252e('0x1d')]);var upload=multer({'storage':multer[_0x252e('0x12')]({'destination':function(_0x336895,_0x4c646d,_0x38e6cb){_0x38e6cb(null,path[_0x252e('0x13')](config[_0x252e('0x1e')],_0x252e('0x14')));},'filename':function(_0x19ea91,_0x46d70b,_0xf06c18){_0xf06c18(null,util[_0x252e('0x15')](_0x252e('0x16'),_0x252e('0x1f'),path['extname'](_0x46d70b[_0x252e('0x18')])));}})});router[_0x252e('0x19')](_0x252e('0x20'),upload[_0x252e('0x1b')](_0x252e('0x1c')),controller[_0x252e('0x21')]);var upload=multer({'storage':multer[_0x252e('0x12')]({'destination':function(_0x272d68,_0x31e5f8,_0x1dffbf){_0x1dffbf(null,path[_0x252e('0x13')](config[_0x252e('0x1e')],_0x252e('0x14')));},'filename':function(_0x5862df,_0xe0dd25,_0x24bbb1){_0x24bbb1(null,util[_0x252e('0x15')](_0x252e('0x16'),_0x252e('0x22'),path[_0x252e('0x17')](_0xe0dd25[_0x252e('0x18')])));}})});router[_0x252e('0x19')](_0x252e('0xf'),upload[_0x252e('0x1b')]('file'),controller[_0x252e('0x23')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1bf0a7,_0x3b983e,_0x15b9a4){_0x15b9a4(null,path[_0x252e('0x13')](config[_0x252e('0x1e')],_0x252e('0x14')));},'filename':function(_0x1712a5,_0x313ab7,_0x2eaae0){_0x2eaae0(null,util[_0x252e('0x15')](_0x252e('0x16'),_0x252e('0x24'),path[_0x252e('0x17')](_0x313ab7[_0x252e('0x18')])));}})});router['post'](_0x252e('0x10'),upload[_0x252e('0x1b')]('file'),controller[_0x252e('0x25')]);router[_0x252e('0x26')](_0x252e('0xa'),auth[_0x252e('0x7')](),controller[_0x252e('0x27')]);module['exports']=router; \ No newline at end of file +var _0xb742=['join','root','server/files/images/logos/','format','%s%s','originalname','post','single','file','addLogo','diskStorage','extname','/:id/logo_login','addLogoLogin','favicon','addFavicon','put','update','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/now','getDate','/:id','show','/:id/logo','getLogo','getLogoLogin','gdpr','/:id/preferred','getPreferred','/:id/favicon','getFavicon'];(function(_0x3216f8,_0xece599){var _0x1ce666=function(_0x5b1f37){while(--_0x5b1f37){_0x3216f8['push'](_0x3216f8['shift']());}};_0x1ce666(++_0xece599);}(_0xb742,0xe4));var _0x2b74=function(_0x4668a6,_0x4e8a1f){_0x4668a6=_0x4668a6-0x0;var _0x23215d=_0xb742[_0x4668a6];return _0x23215d;};'use strict';var multer=require(_0x2b74('0x0'));var util=require(_0x2b74('0x1'));var path=require(_0x2b74('0x2'));var timeout=require(_0x2b74('0x3'));var express=require(_0x2b74('0x4'));var router=express[_0x2b74('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x2b74('0x6'));var interaction=require(_0x2b74('0x7'));var config=require(_0x2b74('0x8'));var controller=require('./setting.controller');router[_0x2b74('0x9')]('/',auth[_0x2b74('0xa')](),controller[_0x2b74('0xb')]);router['get'](_0x2b74('0xc'),controller[_0x2b74('0xd')]);router['get'](_0x2b74('0xe'),controller[_0x2b74('0xf')]);router[_0x2b74('0x9')](_0x2b74('0x10'),controller[_0x2b74('0x11')]);router['get']('/:id/logo_login',controller[_0x2b74('0x12')]);router[_0x2b74('0x9')]('/:id/gdpr',controller[_0x2b74('0x13')]);router[_0x2b74('0x9')](_0x2b74('0x14'),controller[_0x2b74('0x15')]);router[_0x2b74('0x9')](_0x2b74('0x16'),controller[_0x2b74('0x17')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x10c970,_0x5eccdf,_0x6be55d){_0x6be55d(null,path[_0x2b74('0x18')](config[_0x2b74('0x19')],_0x2b74('0x1a')));},'filename':function(_0x95a7d5,_0x59501e,_0x237628){_0x237628(null,util[_0x2b74('0x1b')](_0x2b74('0x1c'),'logo',path['extname'](_0x59501e[_0x2b74('0x1d')])));}})});router[_0x2b74('0x1e')](_0x2b74('0x10'),upload[_0x2b74('0x1f')](_0x2b74('0x20')),controller[_0x2b74('0x21')]);var upload=multer({'storage':multer[_0x2b74('0x22')]({'destination':function(_0x46dade,_0x5c4066,_0x464484){_0x464484(null,path['join'](config['root'],_0x2b74('0x1a')));},'filename':function(_0x5edda4,_0x3c4d2a,_0x505b2f){_0x505b2f(null,util[_0x2b74('0x1b')]('%s%s','logologin',path[_0x2b74('0x23')](_0x3c4d2a['originalname'])));}})});router[_0x2b74('0x1e')](_0x2b74('0x24'),upload[_0x2b74('0x1f')](_0x2b74('0x20')),controller[_0x2b74('0x25')]);var upload=multer({'storage':multer[_0x2b74('0x22')]({'destination':function(_0xa989a0,_0x2d09fc,_0x5da23d){_0x5da23d(null,path[_0x2b74('0x18')](config['root'],_0x2b74('0x1a')));},'filename':function(_0x1c934d,_0x19de7e,_0x32a290){_0x32a290(null,util[_0x2b74('0x1b')](_0x2b74('0x1c'),'preferred',path['extname'](_0x19de7e[_0x2b74('0x1d')])));}})});router[_0x2b74('0x1e')]('/:id/preferred',upload[_0x2b74('0x1f')](_0x2b74('0x20')),controller['addPreferred']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x35c2e3,_0x58c378,_0x2d5006){_0x2d5006(null,path[_0x2b74('0x18')](config[_0x2b74('0x19')],_0x2b74('0x1a')));},'filename':function(_0x765fec,_0xb3df89,_0x23f30d){_0x23f30d(null,util[_0x2b74('0x1b')](_0x2b74('0x1c'),_0x2b74('0x26'),path[_0x2b74('0x23')](_0xb3df89[_0x2b74('0x1d')])));}})});router[_0x2b74('0x1e')](_0x2b74('0x16'),upload['single'](_0x2b74('0x20')),controller[_0x2b74('0x27')]);router[_0x2b74('0x28')](_0x2b74('0xe'),auth[_0x2b74('0xa')](),controller[_0x2b74('0x29')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index 69ffbeb..21cfb4a 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(_0x2cdacb,_0x3b9180){var _0x3324e6=function(_0x258982){while(--_0x258982){_0x2cdacb['push'](_0x2cdacb['shift']());}};_0x3324e6(++_0x3b9180);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1b828b,_0x344400){_0x1b828b=_0x1b828b-0x0;var _0x98da1a=_0xa9e0[_0x1b828b];return _0x98da1a;};'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(_0x5d20a0,_0x105c65){var _0x3f70d5=function(_0x22f7eb){while(--_0x22f7eb){_0x5d20a0['push'](_0x5d20a0['shift']());}};_0x3f70d5(++_0x105c65);}(_0xa9e0,0x123));var _0x0a9e=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0xa9e0[_0x30ae5e];return _0x1f2e93;};'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 6efa961..b034b2c 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 _0x48fb=['where','filter','merge','VIRTUAL','findAll','rows','show','keys','length','includeAll','include','options','find','body','params','addLogo','file','filename','logo','loginLogo','getLogo','server/files/images/logos','defaultLoginLogo','defaultFavicon','join','toLower','default_logo.svg','default','upperFirst','custom','Sequelize','download','getLogoLogin','favicon','defaultLogo','defaultPreferred','root','default_loginLogo.svg','existsSync','ValidationError','\x20not\x20found','securePassword','addPreferred','preferred','getPreferred','getLicense','default_preferred.png','addFavicon','default_favicon.ico','utcOffset','now','YYYY-MM-DD\x20HH:mm:ss:SSS','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','fs-extra','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','client','http','request','info','Setting,\x20%s,\x20%s','debug','Setting,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy','then','name','send','map','Setting','rawAttributes','type','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','sort'];(function(_0x28aea5,_0x3bb12e){var _0x6a55f9=function(_0xf6ece8){while(--_0xf6ece8){_0x28aea5['push'](_0x28aea5['shift']());}};_0x6a55f9(++_0x3bb12e);}(_0x48fb,0xad));var _0xb48f=function(_0x1e1d0d,_0x47e3fa){_0x1e1d0d=_0x1e1d0d-0x0;var _0xc367b8=_0x48fb[_0x1e1d0d];return _0xc367b8;};'use strict';var emlformat=require(_0xb48f('0x0'));var rimraf=require(_0xb48f('0x1'));var zipdir=require(_0xb48f('0x2'));var jsonpatch=require(_0xb48f('0x3'));var rp=require(_0xb48f('0x4'));var moment=require(_0xb48f('0x5'));var BPromise=require(_0xb48f('0x6'));var Mustache=require(_0xb48f('0x7'));var util=require('util');var path=require('path');var sox=require(_0xb48f('0x8'));var csv=require(_0xb48f('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb48f('0xa'));var _=require('lodash');var squel=require(_0xb48f('0xb'));var crypto=require(_0xb48f('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xb48f('0xd'));var toCsv=require('to-csv');var querystring=require(_0xb48f('0xe'));var Papa=require('papaparse');var Redis=require(_0xb48f('0xf'));var authService=require(_0xb48f('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xb48f('0x11'));var hardwareService=require(_0xb48f('0x12'));var logger=require(_0xb48f('0x13'))(_0xb48f('0x14'));var utils=require(_0xb48f('0x15'));var config=require(_0xb48f('0x16'));var licenseUtil=require(_0xb48f('0x17'));var db=require(_0xb48f('0x18'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xb48f('0x19')][_0xb48f('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x1f2665,_0x37cc5a,_0x30799e,_0x24322a){return new BPromise(function(_0x320f21,_0x10de1c){var _0x50b9cf=_0x24322a||client;return _0x50b9cf[_0xb48f('0x1b')](_0x1f2665,_0x30799e)['then'](function(_0x83353f){logger[_0xb48f('0x1c')](_0xb48f('0x1d'),_0x37cc5a,'request\x20sent');logger[_0xb48f('0x1e')](_0xb48f('0x1f'),_0x37cc5a,_0xb48f('0x20'),JSON[_0xb48f('0x21')](_0x83353f));if(_0x83353f[_0xb48f('0x22')]){if(_0x83353f[_0xb48f('0x22')][_0xb48f('0x23')]===0x1f4){logger[_0xb48f('0x22')]('Setting,\x20%s,\x20%s',_0x37cc5a,_0x83353f[_0xb48f('0x22')]['message']);return _0x10de1c(_0x83353f[_0xb48f('0x22')][_0xb48f('0x24')]);}logger[_0xb48f('0x22')](_0xb48f('0x1d'),_0x37cc5a,_0x83353f[_0xb48f('0x22')]['message']);return _0x320f21(_0x83353f[_0xb48f('0x22')]['message']);}else{logger['info'](_0xb48f('0x1d'),_0x37cc5a,'request\x20sent');_0x320f21(_0x83353f[_0xb48f('0x25')]['message']);}})[_0xb48f('0x26')](function(_0x59547e){logger[_0xb48f('0x22')](_0xb48f('0x1d'),_0x37cc5a,_0x59547e);_0x10de1c(_0x59547e);});});}function respondWithStatusCode(_0x5b3e5e,_0x3af7e9){_0x3af7e9=_0x3af7e9||0xcc;return function(_0x267352){if(_0x267352){return _0x5b3e5e[_0xb48f('0x27')](_0x3af7e9);}return _0x5b3e5e[_0xb48f('0x28')](_0x3af7e9)[_0xb48f('0x29')]();};}function respondWithResult(_0x375a61,_0x1c88e9){_0x1c88e9=_0x1c88e9||0xc8;return function(_0x3f8f4f){if(_0x3f8f4f){return _0x375a61[_0xb48f('0x28')](_0x1c88e9)[_0xb48f('0x2a')](_0x3f8f4f);}};}function respondWithFilteredResult(_0x1cd167,_0x4afc87){return function(_0xa9f3c0){if(_0xa9f3c0){var _0x4f6295=typeof _0x4afc87[_0xb48f('0x2b')]===_0xb48f('0x2c')&&typeof _0x4afc87[_0xb48f('0x2d')]===_0xb48f('0x2c');var _0x33565f=_0xa9f3c0[_0xb48f('0x2e')];var _0xd1588c=_0x4f6295?0x0:_0x4afc87['offset'];var _0x843d0b=_0x4f6295?_0xa9f3c0['count']:_0x4afc87['offset']+_0x4afc87[_0xb48f('0x2d')];var _0x4fc248;if(_0x843d0b>=_0x33565f){_0x843d0b=_0x33565f;_0x4fc248=0xc8;}else{_0x4fc248=0xce;}_0x1cd167[_0xb48f('0x28')](_0x4fc248);return _0x1cd167[_0xb48f('0x2f')](_0xb48f('0x30'),_0xd1588c+'-'+_0x843d0b+'/'+_0x33565f)[_0xb48f('0x2a')](_0xa9f3c0);}return null;};}function patchUpdates(_0x5d5df1){return function(_0x8ce74c){try{jsonpatch[_0xb48f('0x31')](_0x8ce74c,_0x5d5df1,!![]);}catch(_0x108e2b){return BPromise['reject'](_0x108e2b);}return _0x8ce74c[_0xb48f('0x32')]();};}function saveUpdates(_0x395282,_0x5e8a76){return function(_0xe54ca5){if(_0xe54ca5){return _0xe54ca5[_0xb48f('0x33')](_0x395282)['then'](function(_0x150828){return _0x150828;});}return null;};}function removeEntity(_0x289c8e,_0x57fe12){return function(_0xf06944){if(_0xf06944){return _0xf06944[_0xb48f('0x34')]()[_0xb48f('0x35')](function(){_0x289c8e['status'](0xcc)[_0xb48f('0x29')]();});}};}function handleEntityNotFound(_0x679be9,_0x2ae3ff){return function(_0x13e5bd){if(!_0x13e5bd){_0x679be9[_0xb48f('0x27')](0x194);}return _0x13e5bd;};}function handleError(_0x35c47b,_0x2aa952){_0x2aa952=_0x2aa952||0x1f4;return function(_0x3f8100){logger[_0xb48f('0x22')](_0x3f8100['stack']);if(_0x3f8100['name']){delete _0x3f8100[_0xb48f('0x36')];}_0x35c47b[_0xb48f('0x28')](_0x2aa952)[_0xb48f('0x37')](_0x3f8100);};}exports['index']=function(_0x19d551,_0x23bad4){var _0x27da32={},_0x8d17fe={},_0x1f0734={'count':0x0,'rows':[]};var _0x6e9bbc=_[_0xb48f('0x38')](db[_0xb48f('0x39')][_0xb48f('0x3a')],function(_0x426077){return{'name':_0x426077['fieldName'],'type':_0x426077[_0xb48f('0x3b')][_0xb48f('0x3c')]};});_0x8d17fe[_0xb48f('0x3d')]=_['map'](_0x6e9bbc,'name');_0x8d17fe[_0xb48f('0x3e')]=_['keys'](_0x19d551[_0xb48f('0x3e')]);_0x8d17fe[_0xb48f('0x3f')]=_[_0xb48f('0x40')](_0x8d17fe[_0xb48f('0x3d')],_0x8d17fe[_0xb48f('0x3e')]);_0x27da32['attributes']=_[_0xb48f('0x40')](_0x8d17fe['model'],qs[_0xb48f('0x41')](_0x19d551[_0xb48f('0x3e')][_0xb48f('0x41')]));_0x27da32['attributes']=_0x27da32['attributes']['length']?_0x27da32[_0xb48f('0x42')]:_0x8d17fe[_0xb48f('0x3d')];if(!_0x19d551[_0xb48f('0x3e')][_0xb48f('0x43')]('nolimit')){_0x27da32[_0xb48f('0x2d')]=qs[_0xb48f('0x2d')](_0x19d551[_0xb48f('0x3e')][_0xb48f('0x2d')]);_0x27da32[_0xb48f('0x2b')]=qs[_0xb48f('0x2b')](_0x19d551[_0xb48f('0x3e')]['offset']);}_0x27da32['order']=qs[_0xb48f('0x44')](_0x19d551['query'][_0xb48f('0x44')]);_0x27da32[_0xb48f('0x45')]=qs['filters'](_['pick'](_0x19d551[_0xb48f('0x3e')],_0x8d17fe[_0xb48f('0x3f')]),_0x6e9bbc);if(_0x19d551[_0xb48f('0x3e')][_0xb48f('0x46')]){_0x27da32[_0xb48f('0x45')]=_[_0xb48f('0x47')](_0x27da32[_0xb48f('0x45')],{'$or':_[_0xb48f('0x38')](_0x6e9bbc,function(_0x14a51a){if(_0x14a51a[_0xb48f('0x3b')]!==_0xb48f('0x48')){var _0x185913={};_0x185913[_0x14a51a[_0xb48f('0x36')]]={'$like':'%'+_0x19d551[_0xb48f('0x3e')]['filter']+'%'};return _0x185913;}})});}_0x27da32=_[_0xb48f('0x47')]({},_0x27da32,_0x19d551['options']);var _0x3dc3df={'where':_0x27da32[_0xb48f('0x45')]};return db[_0xb48f('0x39')][_0xb48f('0x2e')](_0x3dc3df)[_0xb48f('0x35')](function(_0x420d4b){_0x1f0734[_0xb48f('0x2e')]=_0x420d4b;if(_0x19d551[_0xb48f('0x3e')]['includeAll']){_0x27da32['include']=[{'all':!![]}];}return db['Setting'][_0xb48f('0x49')](_0x27da32);})[_0xb48f('0x35')](function(_0x143e6b){_0x1f0734[_0xb48f('0x4a')]=_0x143e6b;return _0x1f0734;})[_0xb48f('0x35')](respondWithFilteredResult(_0x23bad4,_0x27da32))[_0xb48f('0x26')](handleError(_0x23bad4,null));};exports[_0xb48f('0x4b')]=function(_0x18752b,_0x5f294c){var _0x18d5cb={'raw':![],'where':{'id':_0x18752b['params']['id']}},_0x328303={};_0x328303[_0xb48f('0x3d')]=_['keys'](db[_0xb48f('0x39')][_0xb48f('0x3a')]);_0x328303[_0xb48f('0x3e')]=_[_0xb48f('0x4c')](_0x18752b['query']);_0x328303[_0xb48f('0x3f')]=_[_0xb48f('0x40')](_0x328303[_0xb48f('0x3d')],_0x328303[_0xb48f('0x3e')]);_0x18d5cb[_0xb48f('0x42')]=_['intersection'](_0x328303[_0xb48f('0x3d')],qs['fields'](_0x18752b[_0xb48f('0x3e')][_0xb48f('0x41')]));_0x18d5cb[_0xb48f('0x42')]=_0x18d5cb[_0xb48f('0x42')][_0xb48f('0x4d')]?_0x18d5cb[_0xb48f('0x42')]:_0x328303[_0xb48f('0x3d')];if(_0x18752b['query'][_0xb48f('0x4e')]){_0x18d5cb[_0xb48f('0x4f')]=[{'all':!![]}];}_0x18d5cb=_[_0xb48f('0x47')]({},_0x18d5cb,_0x18752b[_0xb48f('0x50')]);return db[_0xb48f('0x39')][_0xb48f('0x51')](_0x18d5cb)[_0xb48f('0x35')](handleEntityNotFound(_0x5f294c,null))[_0xb48f('0x35')](respondWithResult(_0x5f294c,null))[_0xb48f('0x26')](handleError(_0x5f294c,null));};exports['update']=function(_0xb70e6d,_0x23f2d4){if(_0xb70e6d[_0xb48f('0x52')]['id']){delete _0xb70e6d['body']['id'];}return db[_0xb48f('0x39')]['find']({'where':{'id':_0xb70e6d[_0xb48f('0x53')]['id']}})[_0xb48f('0x35')](handleEntityNotFound(_0x23f2d4,null))[_0xb48f('0x35')](saveUpdates(_0xb70e6d['body'],null))['then'](respondWithResult(_0x23f2d4,null))[_0xb48f('0x26')](handleError(_0x23f2d4,null));};exports[_0xb48f('0x54')]=function(_0x4a9908,_0x3d489a,_0x2a0add){if(_0x4a9908[_0xb48f('0x55')]&&_0x4a9908['file'][_0xb48f('0x56')]){_0x4a9908[_0xb48f('0x52')][_0xb48f('0x57')]=_0x4a9908[_0xb48f('0x55')][_0xb48f('0x56')];}return db[_0xb48f('0x39')][_0xb48f('0x51')]({'where':{'id':_0x4a9908['params']['id']}})[_0xb48f('0x35')](handleEntityNotFound(_0x3d489a,null))[_0xb48f('0x35')](saveUpdates(_0x4a9908[_0xb48f('0x52')],null))[_0xb48f('0x35')](respondWithResult(_0x3d489a,null))[_0xb48f('0x26')](handleError(_0x3d489a,null));};exports['addLogoLogin']=function(_0x1af386,_0xcbbf18,_0x39dc03){if(_0x1af386[_0xb48f('0x55')]&&_0x1af386[_0xb48f('0x55')][_0xb48f('0x56')]){_0x1af386[_0xb48f('0x52')][_0xb48f('0x58')]=_0x1af386['file'][_0xb48f('0x56')];}return db[_0xb48f('0x39')]['find']({'where':{'id':_0x1af386['params']['id']}})[_0xb48f('0x35')](handleEntityNotFound(_0xcbbf18,null))[_0xb48f('0x35')](saveUpdates(_0x1af386['body'],null))[_0xb48f('0x35')](respondWithResult(_0xcbbf18,null))['catch'](handleError(_0xcbbf18,null));};var utilLicense=require(_0xb48f('0x17'));exports[_0xb48f('0x59')]=function(_0x1116e6,_0x4d51b4,_0x344f85){var _0x997afb=_0xb48f('0x5a');var _0x1b9b7a={'custom':![]};return utilLicense['getLicense']()['then'](function(_0x5d2162){if(_0x5d2162){_0x1b9b7a=_0x5d2162;}return db[_0xb48f('0x39')][_0xb48f('0x51')]({'where':{'id':_0x1116e6[_0xb48f('0x53')]['id']},'attributes':[_0xb48f('0x57'),_0xb48f('0x58'),'preferred','favicon','defaultLogo',_0xb48f('0x5b'),'defaultPreferred',_0xb48f('0x5c')],'raw':!![]});})[_0xb48f('0x35')](handleEntityNotFound(_0x4d51b4,null))[_0xb48f('0x35')](function(_0x134156){if(_0x134156){var _0x538991=_0x134156['logo']&&fs['existsSync'](path[_0xb48f('0x5d')](config['root'],_0x997afb,_[_0xb48f('0x5e')](_0x134156[_0xb48f('0x57')])))?path[_0xb48f('0x5d')](config['root'],_0x997afb,_['toLower'](_0x134156[_0xb48f('0x57')])):path[_0xb48f('0x5d')](config['root'],_0x997afb,_[_0xb48f('0x5e')](_0xb48f('0x5f')));var _0x1024f6=_0xb48f('0x60')+_[_0xb48f('0x61')]('logo');if(_0x134156[_0x1024f6]||!_0x1b9b7a[_0xb48f('0x62')]){_0x538991=path[_0xb48f('0x5d')](config['root'],_0x997afb,_[_0xb48f('0x5e')](_0xb48f('0x5f')));}if(!fs['existsSync'](_0x538991)){throw new db[(_0xb48f('0x63'))]['ValidationError'](_[_0xb48f('0x61')]('logo')+'\x20not\x20found');}return _0x4d51b4[_0xb48f('0x64')](_0x538991);}})[_0xb48f('0x26')](handleError(_0x4d51b4,null));};var utilLicense=require(_0xb48f('0x17'));exports[_0xb48f('0x65')]=function(_0x4fd0c4,_0x296605,_0x272aec){var _0xea2b48=_0xb48f('0x5a');var _0x4b3408={'custom':![]};return utilLicense['getLicense']()['then'](function(_0x210cdb){if(_0x210cdb){_0x4b3408=_0x210cdb;}return db[_0xb48f('0x39')][_0xb48f('0x51')]({'where':{'id':_0x4fd0c4['params']['id']},'attributes':[_0xb48f('0x57'),'loginLogo','preferred',_0xb48f('0x66'),_0xb48f('0x67'),_0xb48f('0x5b'),_0xb48f('0x68'),'defaultFavicon'],'raw':!![]});})['then'](handleEntityNotFound(_0x296605,null))[_0xb48f('0x35')](function(_0x26408b){if(_0x26408b){var _0x46904b=_0x26408b[_0xb48f('0x58')]&&fs['existsSync'](path[_0xb48f('0x5d')](config[_0xb48f('0x69')],_0xea2b48,_[_0xb48f('0x5e')](_0x26408b[_0xb48f('0x58')])))?path[_0xb48f('0x5d')](config[_0xb48f('0x69')],_0xea2b48,_[_0xb48f('0x5e')](_0x26408b[_0xb48f('0x58')])):path[_0xb48f('0x5d')](config['root'],_0xea2b48,_[_0xb48f('0x5e')](_0xb48f('0x6a')));var _0x43b5e3='default'+_[_0xb48f('0x61')]('loginLogo');if(_0x26408b[_0x43b5e3]||!_0x4b3408['custom']){_0x46904b=path['join'](config['root'],_0xea2b48,_[_0xb48f('0x5e')](_0xb48f('0x6a')));}if(!fs[_0xb48f('0x6b')](_0x46904b)){throw new db[(_0xb48f('0x63'))][(_0xb48f('0x6c'))](_[_0xb48f('0x61')]('loginLogo')+_0xb48f('0x6d'));}return _0x296605[_0xb48f('0x64')](_0x46904b);}})[_0xb48f('0x26')](handleError(_0x296605,null));};exports['gdpr']=function(_0x216e12,_0x4f4dc8){return db[_0xb48f('0x39')][_0xb48f('0x51')]({'where':{'id':_0x216e12['params']['id']},'attributes':[_0xb48f('0x6e')]})[_0xb48f('0x35')](respondWithResult(_0x4f4dc8,null))['catch'](handleError(_0x4f4dc8,null));};exports[_0xb48f('0x6f')]=function(_0x18a40d,_0x1c6caf,_0x26872f){if(_0x18a40d[_0xb48f('0x55')]&&_0x18a40d['file']['filename']){_0x18a40d['body'][_0xb48f('0x70')]=_0x18a40d[_0xb48f('0x55')][_0xb48f('0x56')];}return db[_0xb48f('0x39')][_0xb48f('0x51')]({'where':{'id':_0x18a40d[_0xb48f('0x53')]['id']}})[_0xb48f('0x35')](handleEntityNotFound(_0x1c6caf,null))[_0xb48f('0x35')](saveUpdates(_0x18a40d[_0xb48f('0x52')],null))[_0xb48f('0x35')](respondWithResult(_0x1c6caf,null))[_0xb48f('0x26')](handleError(_0x1c6caf,null));};var utilLicense=require(_0xb48f('0x17'));exports[_0xb48f('0x71')]=function(_0x3ee154,_0xbd45be,_0x3887ee){var _0x2c2c26=_0xb48f('0x5a');var _0x1cfbb9={'custom':![]};return utilLicense[_0xb48f('0x72')]()[_0xb48f('0x35')](function(_0x26eeba){if(_0x26eeba){_0x1cfbb9=_0x26eeba;}return db[_0xb48f('0x39')][_0xb48f('0x51')]({'where':{'id':_0x3ee154[_0xb48f('0x53')]['id']},'attributes':[_0xb48f('0x57'),_0xb48f('0x58'),_0xb48f('0x70'),_0xb48f('0x66'),_0xb48f('0x67'),'defaultLoginLogo',_0xb48f('0x68'),_0xb48f('0x5c')],'raw':!![]});})[_0xb48f('0x35')](handleEntityNotFound(_0xbd45be,null))[_0xb48f('0x35')](function(_0x1c2448){if(_0x1c2448){var _0xd353a4=_0x1c2448['preferred']&&fs['existsSync'](path['join'](config['root'],_0x2c2c26,_[_0xb48f('0x5e')](_0x1c2448['preferred'])))?path[_0xb48f('0x5d')](config[_0xb48f('0x69')],_0x2c2c26,_[_0xb48f('0x5e')](_0x1c2448[_0xb48f('0x70')])):path[_0xb48f('0x5d')](config[_0xb48f('0x69')],_0x2c2c26,_[_0xb48f('0x5e')](_0xb48f('0x73')));var _0x1a370f=_0xb48f('0x60')+_['upperFirst'](_0xb48f('0x70'));if(_0x1c2448[_0x1a370f]||!_0x1cfbb9[_0xb48f('0x62')]||!_0x1cfbb9['preferred']){_0xd353a4=path[_0xb48f('0x5d')](config['root'],_0x2c2c26,_[_0xb48f('0x5e')](_0xb48f('0x73')));}if(!fs[_0xb48f('0x6b')](_0xd353a4)){throw new db[(_0xb48f('0x63'))][(_0xb48f('0x6c'))](_[_0xb48f('0x61')](_0xb48f('0x70'))+'\x20not\x20found');}return _0xbd45be['download'](_0xd353a4);}})[_0xb48f('0x26')](handleError(_0xbd45be,null));};exports[_0xb48f('0x74')]=function(_0x2d6eb8,_0x12f11c,_0x15f83b){if(_0x2d6eb8[_0xb48f('0x55')]&&_0x2d6eb8[_0xb48f('0x55')]['filename']){_0x2d6eb8[_0xb48f('0x52')][_0xb48f('0x66')]=_0x2d6eb8[_0xb48f('0x55')]['filename'];}return db[_0xb48f('0x39')][_0xb48f('0x51')]({'where':{'id':_0x2d6eb8['params']['id']}})['then'](handleEntityNotFound(_0x12f11c,null))[_0xb48f('0x35')](saveUpdates(_0x2d6eb8[_0xb48f('0x52')],null))[_0xb48f('0x35')](respondWithResult(_0x12f11c,null))[_0xb48f('0x26')](handleError(_0x12f11c,null));};var utilLicense=require('../../config/license/util');exports['getFavicon']=function(_0x2b8b3e,_0x595403,_0x2bb12c){var _0x59f8e1='server/files/images/logos';var _0x2b8f6c={'custom':![]};return utilLicense[_0xb48f('0x72')]()[_0xb48f('0x35')](function(_0x425fde){if(_0x425fde){_0x2b8f6c=_0x425fde;}return db['Setting'][_0xb48f('0x51')]({'where':{'id':_0x2b8b3e['params']['id']},'attributes':[_0xb48f('0x57'),_0xb48f('0x58'),'preferred',_0xb48f('0x66'),'defaultLogo',_0xb48f('0x5b'),_0xb48f('0x68'),'defaultFavicon'],'raw':!![]});})['then'](handleEntityNotFound(_0x595403,null))['then'](function(_0x4d6299){if(_0x4d6299){var _0x5e051c=_0x4d6299['favicon']&&fs[_0xb48f('0x6b')](path[_0xb48f('0x5d')](config['root'],_0x59f8e1,_['toLower'](_0x4d6299[_0xb48f('0x66')])))?path[_0xb48f('0x5d')](config['root'],_0x59f8e1,_[_0xb48f('0x5e')](_0x4d6299[_0xb48f('0x66')])):path[_0xb48f('0x5d')](config['root'],_0x59f8e1,_['toLower'](_0xb48f('0x75')));var _0x35b271=_0xb48f('0x60')+_[_0xb48f('0x61')](_0xb48f('0x66'));if(_0x4d6299[_0x35b271]||!_0x2b8f6c[_0xb48f('0x62')]){_0x5e051c=path[_0xb48f('0x5d')](config['root'],_0x59f8e1,_['toLower'](_0xb48f('0x75')));}if(!fs[_0xb48f('0x6b')](_0x5e051c)){throw new db[(_0xb48f('0x63'))][(_0xb48f('0x6c'))](_['upperFirst']('favicon')+_0xb48f('0x6d'));}return _0x595403['download'](_0x5e051c);}})['catch'](handleError(_0x595403,null));};exports['getDate']=function(_0x5d75cc,_0x595ab4){var _0x33e71c={'offset':moment()[_0xb48f('0x76')]()};_0x33e71c[_0xb48f('0x77')]=moment()[_0xb48f('0x76')](_0x33e71c[_0xb48f('0x2b')])['format'](_0xb48f('0x78'));return _0x595ab4[_0xb48f('0x28')](0xc8)[_0xb48f('0x37')](_0x33e71c);}; \ No newline at end of file +var _0x897d=['getDate','utcOffset','now','format','YYYY-MM-DD\x20HH:mm:ss:SSS','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','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','jayson/promise','http','info','Setting,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','reject','update','then','destroy','name','send','index','map','Setting','fieldName','query','filters','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','options','show','keys','rawAttributes','includeAll','include','find','body','params','addLogo','file','filename','logo','loginLogo','server/files/images/logos','preferred','favicon','defaultLogo','defaultPreferred','defaultFavicon','join','root','toLower','default_logo.svg','default','upperFirst','custom','existsSync','Sequelize','ValidationError','download','getLogoLogin','getLicense','defaultLoginLogo','default_loginLogo.svg','\x20not\x20found','gdpr','addPreferred','getPreferred','addFavicon','getFavicon'];(function(_0x37e941,_0x28508f){var _0x1fc6ce=function(_0x356864){while(--_0x356864){_0x37e941['push'](_0x37e941['shift']());}};_0x1fc6ce(++_0x28508f);}(_0x897d,0x80));var _0xd897=function(_0x22790b,_0x22a1a0){_0x22790b=_0x22790b-0x0;var _0x397700=_0x897d[_0x22790b];return _0x397700;};'use strict';var emlformat=require(_0xd897('0x0'));var rimraf=require(_0xd897('0x1'));var zipdir=require(_0xd897('0x2'));var jsonpatch=require(_0xd897('0x3'));var rp=require(_0xd897('0x4'));var moment=require(_0xd897('0x5'));var BPromise=require(_0xd897('0x6'));var Mustache=require(_0xd897('0x7'));var util=require(_0xd897('0x8'));var path=require(_0xd897('0x9'));var sox=require(_0xd897('0xa'));var csv=require(_0xd897('0xb'));var ejs=require(_0xd897('0xc'));var fs=require('fs');var fs_extra=require(_0xd897('0xd'));var _=require(_0xd897('0xe'));var squel=require(_0xd897('0xf'));var crypto=require(_0xd897('0x10'));var jsforce=require(_0xd897('0x11'));var deskjs=require(_0xd897('0x12'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xd897('0x13'));var Redis=require(_0xd897('0x14'));var authService=require('../../components/auth/service');var qs=require(_0xd897('0x15'));var as=require(_0xd897('0x16'));var hardwareService=require(_0xd897('0x17'));var logger=require(_0xd897('0x18'))(_0xd897('0x19'));var utils=require(_0xd897('0x1a'));var config=require('../../config/environment');var licenseUtil=require(_0xd897('0x1b'));var db=require(_0xd897('0x1c'))['db'];var jayson=require(_0xd897('0x1d'));var client=jayson['client'][_0xd897('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x43010a,_0x5b1628,_0x3bb1cc,_0x2a72b4){return new BPromise(function(_0x2bfff9,_0x362be4){var _0x3330af=_0x2a72b4||client;return _0x3330af['request'](_0x43010a,_0x3bb1cc)['then'](function(_0xda21fa){logger[_0xd897('0x1f')](_0xd897('0x20'),_0x5b1628,_0xd897('0x21'));logger[_0xd897('0x22')]('Setting,\x20%s,\x20%s,\x20%s',_0x5b1628,_0xd897('0x21'),JSON['stringify'](_0xda21fa));if(_0xda21fa[_0xd897('0x23')]){if(_0xda21fa[_0xd897('0x23')][_0xd897('0x24')]===0x1f4){logger[_0xd897('0x23')](_0xd897('0x20'),_0x5b1628,_0xda21fa['error']['message']);return _0x362be4(_0xda21fa[_0xd897('0x23')][_0xd897('0x25')]);}logger[_0xd897('0x23')](_0xd897('0x20'),_0x5b1628,_0xda21fa[_0xd897('0x23')][_0xd897('0x25')]);return _0x2bfff9(_0xda21fa[_0xd897('0x23')][_0xd897('0x25')]);}else{logger[_0xd897('0x1f')](_0xd897('0x20'),_0x5b1628,'request\x20sent');_0x2bfff9(_0xda21fa[_0xd897('0x26')]['message']);}})[_0xd897('0x27')](function(_0xa5dfa7){logger[_0xd897('0x23')]('Setting,\x20%s,\x20%s',_0x5b1628,_0xa5dfa7);_0x362be4(_0xa5dfa7);});});}function respondWithStatusCode(_0x4e5ab8,_0x54855b){_0x54855b=_0x54855b||0xcc;return function(_0x11237e){if(_0x11237e){return _0x4e5ab8[_0xd897('0x28')](_0x54855b);}return _0x4e5ab8[_0xd897('0x29')](_0x54855b)[_0xd897('0x2a')]();};}function respondWithResult(_0x4b8d52,_0x252fa7){_0x252fa7=_0x252fa7||0xc8;return function(_0x172568){if(_0x172568){return _0x4b8d52[_0xd897('0x29')](_0x252fa7)[_0xd897('0x2b')](_0x172568);}};}function respondWithFilteredResult(_0x5c3867,_0x54ced8){return function(_0x4ef0a5){if(_0x4ef0a5){var _0x212d19=typeof _0x54ced8[_0xd897('0x2c')]==='undefined'&&typeof _0x54ced8[_0xd897('0x2d')]==='undefined';var _0x3d3550=_0x4ef0a5[_0xd897('0x2e')];var _0x29f019=_0x212d19?0x0:_0x54ced8['offset'];var _0x2b6f6f=_0x212d19?_0x4ef0a5[_0xd897('0x2e')]:_0x54ced8[_0xd897('0x2c')]+_0x54ced8[_0xd897('0x2d')];var _0x54614f;if(_0x2b6f6f>=_0x3d3550){_0x2b6f6f=_0x3d3550;_0x54614f=0xc8;}else{_0x54614f=0xce;}_0x5c3867[_0xd897('0x29')](_0x54614f);return _0x5c3867[_0xd897('0x2f')](_0xd897('0x30'),_0x29f019+'-'+_0x2b6f6f+'/'+_0x3d3550)['json'](_0x4ef0a5);}return null;};}function patchUpdates(_0x3362e6){return function(_0x48531a){try{jsonpatch[_0xd897('0x31')](_0x48531a,_0x3362e6,!![]);}catch(_0x1e3527){return BPromise[_0xd897('0x32')](_0x1e3527);}return _0x48531a['save']();};}function saveUpdates(_0x12a8f9,_0x56f40d){return function(_0xa5faaa){if(_0xa5faaa){return _0xa5faaa[_0xd897('0x33')](_0x12a8f9)[_0xd897('0x34')](function(_0x54178a){return _0x54178a;});}return null;};}function removeEntity(_0x5b16ed,_0x2f0f1f){return function(_0xde28a2){if(_0xde28a2){return _0xde28a2[_0xd897('0x35')]()['then'](function(){_0x5b16ed['status'](0xcc)[_0xd897('0x2a')]();});}};}function handleEntityNotFound(_0x1e70a5,_0xf61f75){return function(_0x39431d){if(!_0x39431d){_0x1e70a5[_0xd897('0x28')](0x194);}return _0x39431d;};}function handleError(_0x18a336,_0x1a96a5){_0x1a96a5=_0x1a96a5||0x1f4;return function(_0x13a3f9){logger[_0xd897('0x23')](_0x13a3f9['stack']);if(_0x13a3f9['name']){delete _0x13a3f9[_0xd897('0x36')];}_0x18a336[_0xd897('0x29')](_0x1a96a5)[_0xd897('0x37')](_0x13a3f9);};}exports[_0xd897('0x38')]=function(_0x7405b7,_0x4f2cd1){var _0x5a90c5={},_0x52ca58={},_0x19f362={'count':0x0,'rows':[]};var _0x415241=_[_0xd897('0x39')](db[_0xd897('0x3a')]['rawAttributes'],function(_0x1ebf4b){return{'name':_0x1ebf4b[_0xd897('0x3b')],'type':_0x1ebf4b['type']['key']};});_0x52ca58['model']=_['map'](_0x415241,'name');_0x52ca58[_0xd897('0x3c')]=_['keys'](_0x7405b7['query']);_0x52ca58[_0xd897('0x3d')]=_[_0xd897('0x3e')](_0x52ca58['model'],_0x52ca58['query']);_0x5a90c5[_0xd897('0x3f')]=_['intersection'](_0x52ca58['model'],qs[_0xd897('0x40')](_0x7405b7[_0xd897('0x3c')][_0xd897('0x40')]));_0x5a90c5[_0xd897('0x3f')]=_0x5a90c5[_0xd897('0x3f')][_0xd897('0x41')]?_0x5a90c5[_0xd897('0x3f')]:_0x52ca58[_0xd897('0x42')];if(!_0x7405b7[_0xd897('0x3c')][_0xd897('0x43')](_0xd897('0x44'))){_0x5a90c5[_0xd897('0x2d')]=qs[_0xd897('0x2d')](_0x7405b7[_0xd897('0x3c')][_0xd897('0x2d')]);_0x5a90c5['offset']=qs['offset'](_0x7405b7[_0xd897('0x3c')][_0xd897('0x2c')]);}_0x5a90c5[_0xd897('0x45')]=qs[_0xd897('0x46')](_0x7405b7[_0xd897('0x3c')][_0xd897('0x46')]);_0x5a90c5[_0xd897('0x47')]=qs[_0xd897('0x3d')](_[_0xd897('0x48')](_0x7405b7[_0xd897('0x3c')],_0x52ca58[_0xd897('0x3d')]),_0x415241);if(_0x7405b7[_0xd897('0x3c')]['filter']){_0x5a90c5['where']=_[_0xd897('0x49')](_0x5a90c5['where'],{'$or':_['map'](_0x415241,function(_0x43e4bc){if(_0x43e4bc[_0xd897('0x4a')]!==_0xd897('0x4b')){var _0x5a95d8={};_0x5a95d8[_0x43e4bc['name']]={'$like':'%'+_0x7405b7[_0xd897('0x3c')][_0xd897('0x4c')]+'%'};return _0x5a95d8;}})});}_0x5a90c5=_[_0xd897('0x49')]({},_0x5a90c5,_0x7405b7[_0xd897('0x4d')]);var _0x470f41={'where':_0x5a90c5[_0xd897('0x47')]};return db['Setting']['count'](_0x470f41)[_0xd897('0x34')](function(_0x55c4be){_0x19f362['count']=_0x55c4be;if(_0x7405b7['query']['includeAll']){_0x5a90c5['include']=[{'all':!![]}];}return db[_0xd897('0x3a')]['findAll'](_0x5a90c5);})[_0xd897('0x34')](function(_0x1f8663){_0x19f362['rows']=_0x1f8663;return _0x19f362;})['then'](respondWithFilteredResult(_0x4f2cd1,_0x5a90c5))[_0xd897('0x27')](handleError(_0x4f2cd1,null));};exports[_0xd897('0x4e')]=function(_0x115213,_0x33ddc0){var _0x93b9b0={'raw':![],'where':{'id':_0x115213['params']['id']}},_0x2bbff3={};_0x2bbff3['model']=_[_0xd897('0x4f')](db[_0xd897('0x3a')][_0xd897('0x50')]);_0x2bbff3['query']=_[_0xd897('0x4f')](_0x115213[_0xd897('0x3c')]);_0x2bbff3['filters']=_[_0xd897('0x3e')](_0x2bbff3[_0xd897('0x42')],_0x2bbff3['query']);_0x93b9b0[_0xd897('0x3f')]=_[_0xd897('0x3e')](_0x2bbff3[_0xd897('0x42')],qs[_0xd897('0x40')](_0x115213[_0xd897('0x3c')]['fields']));_0x93b9b0[_0xd897('0x3f')]=_0x93b9b0[_0xd897('0x3f')][_0xd897('0x41')]?_0x93b9b0['attributes']:_0x2bbff3[_0xd897('0x42')];if(_0x115213[_0xd897('0x3c')][_0xd897('0x51')]){_0x93b9b0[_0xd897('0x52')]=[{'all':!![]}];}_0x93b9b0=_[_0xd897('0x49')]({},_0x93b9b0,_0x115213[_0xd897('0x4d')]);return db[_0xd897('0x3a')][_0xd897('0x53')](_0x93b9b0)[_0xd897('0x34')](handleEntityNotFound(_0x33ddc0,null))[_0xd897('0x34')](respondWithResult(_0x33ddc0,null))['catch'](handleError(_0x33ddc0,null));};exports[_0xd897('0x33')]=function(_0x4b422d,_0x319a2f){if(_0x4b422d[_0xd897('0x54')]['id']){delete _0x4b422d[_0xd897('0x54')]['id'];}return db[_0xd897('0x3a')][_0xd897('0x53')]({'where':{'id':_0x4b422d[_0xd897('0x55')]['id']}})[_0xd897('0x34')](handleEntityNotFound(_0x319a2f,null))['then'](saveUpdates(_0x4b422d[_0xd897('0x54')],null))['then'](respondWithResult(_0x319a2f,null))[_0xd897('0x27')](handleError(_0x319a2f,null));};exports[_0xd897('0x56')]=function(_0x520114,_0x5e183d,_0x44830a){if(_0x520114[_0xd897('0x57')]&&_0x520114['file'][_0xd897('0x58')]){_0x520114['body'][_0xd897('0x59')]=_0x520114[_0xd897('0x57')][_0xd897('0x58')];}return db[_0xd897('0x3a')][_0xd897('0x53')]({'where':{'id':_0x520114['params']['id']}})[_0xd897('0x34')](handleEntityNotFound(_0x5e183d,null))[_0xd897('0x34')](saveUpdates(_0x520114[_0xd897('0x54')],null))['then'](respondWithResult(_0x5e183d,null))[_0xd897('0x27')](handleError(_0x5e183d,null));};exports['addLogoLogin']=function(_0x4a25d7,_0x5833d1,_0x43cbd5){if(_0x4a25d7[_0xd897('0x57')]&&_0x4a25d7[_0xd897('0x57')][_0xd897('0x58')]){_0x4a25d7[_0xd897('0x54')][_0xd897('0x5a')]=_0x4a25d7[_0xd897('0x57')][_0xd897('0x58')];}return db[_0xd897('0x3a')][_0xd897('0x53')]({'where':{'id':_0x4a25d7[_0xd897('0x55')]['id']}})[_0xd897('0x34')](handleEntityNotFound(_0x5833d1,null))[_0xd897('0x34')](saveUpdates(_0x4a25d7['body'],null))[_0xd897('0x34')](respondWithResult(_0x5833d1,null))[_0xd897('0x27')](handleError(_0x5833d1,null));};var utilLicense=require(_0xd897('0x1b'));exports['getLogo']=function(_0x535201,_0x45b8e7,_0x517e79){var _0x26de28=_0xd897('0x5b');var _0x1d4653={'custom':![]};return utilLicense['getLicense']()['then'](function(_0x1e6d72){if(_0x1e6d72){_0x1d4653=_0x1e6d72;}return db['Setting'][_0xd897('0x53')]({'where':{'id':_0x535201[_0xd897('0x55')]['id']},'attributes':[_0xd897('0x59'),_0xd897('0x5a'),_0xd897('0x5c'),_0xd897('0x5d'),_0xd897('0x5e'),'defaultLoginLogo',_0xd897('0x5f'),_0xd897('0x60')],'raw':!![]});})[_0xd897('0x34')](handleEntityNotFound(_0x45b8e7,null))[_0xd897('0x34')](function(_0x252644){if(_0x252644){var _0x45b876=_0x252644[_0xd897('0x59')]&&fs['existsSync'](path[_0xd897('0x61')](config['root'],_0x26de28,_['toLower'](_0x252644[_0xd897('0x59')])))?path['join'](config[_0xd897('0x62')],_0x26de28,_[_0xd897('0x63')](_0x252644[_0xd897('0x59')])):path[_0xd897('0x61')](config[_0xd897('0x62')],_0x26de28,_[_0xd897('0x63')](_0xd897('0x64')));var _0x4c4448=_0xd897('0x65')+_[_0xd897('0x66')](_0xd897('0x59'));if(_0x252644[_0x4c4448]||!_0x1d4653[_0xd897('0x67')]){_0x45b876=path['join'](config['root'],_0x26de28,_['toLower']('default_logo.svg'));}if(!fs[_0xd897('0x68')](_0x45b876)){throw new db[(_0xd897('0x69'))][(_0xd897('0x6a'))](_[_0xd897('0x66')](_0xd897('0x59'))+'\x20not\x20found');}return _0x45b8e7[_0xd897('0x6b')](_0x45b876);}})[_0xd897('0x27')](handleError(_0x45b8e7,null));};var utilLicense=require(_0xd897('0x1b'));exports[_0xd897('0x6c')]=function(_0x5b587e,_0x34ccba,_0x5b55e4){var _0x1d7fba=_0xd897('0x5b');var _0x4634fc={'custom':![]};return utilLicense[_0xd897('0x6d')]()[_0xd897('0x34')](function(_0x3dea34){if(_0x3dea34){_0x4634fc=_0x3dea34;}return db['Setting'][_0xd897('0x53')]({'where':{'id':_0x5b587e[_0xd897('0x55')]['id']},'attributes':[_0xd897('0x59'),_0xd897('0x5a'),_0xd897('0x5c'),_0xd897('0x5d'),_0xd897('0x5e'),_0xd897('0x6e'),_0xd897('0x5f'),'defaultFavicon'],'raw':!![]});})[_0xd897('0x34')](handleEntityNotFound(_0x34ccba,null))[_0xd897('0x34')](function(_0x263586){if(_0x263586){var _0x432038=_0x263586['loginLogo']&&fs[_0xd897('0x68')](path['join'](config[_0xd897('0x62')],_0x1d7fba,_[_0xd897('0x63')](_0x263586['loginLogo'])))?path[_0xd897('0x61')](config[_0xd897('0x62')],_0x1d7fba,_[_0xd897('0x63')](_0x263586['loginLogo'])):path[_0xd897('0x61')](config[_0xd897('0x62')],_0x1d7fba,_['toLower'](_0xd897('0x6f')));var _0x24ccef='default'+_['upperFirst'](_0xd897('0x5a'));if(_0x263586[_0x24ccef]||!_0x4634fc[_0xd897('0x67')]){_0x432038=path['join'](config[_0xd897('0x62')],_0x1d7fba,_['toLower']('default_loginLogo.svg'));}if(!fs[_0xd897('0x68')](_0x432038)){throw new db['Sequelize']['ValidationError'](_[_0xd897('0x66')]('loginLogo')+_0xd897('0x70'));}return _0x34ccba[_0xd897('0x6b')](_0x432038);}})[_0xd897('0x27')](handleError(_0x34ccba,null));};exports[_0xd897('0x71')]=function(_0x1cd797,_0x45f11e){return db[_0xd897('0x3a')][_0xd897('0x53')]({'where':{'id':_0x1cd797[_0xd897('0x55')]['id']},'attributes':['securePassword']})[_0xd897('0x34')](respondWithResult(_0x45f11e,null))['catch'](handleError(_0x45f11e,null));};exports[_0xd897('0x72')]=function(_0x2f01b3,_0x206518,_0x59748b){if(_0x2f01b3['file']&&_0x2f01b3[_0xd897('0x57')][_0xd897('0x58')]){_0x2f01b3[_0xd897('0x54')][_0xd897('0x5c')]=_0x2f01b3[_0xd897('0x57')][_0xd897('0x58')];}return db[_0xd897('0x3a')]['find']({'where':{'id':_0x2f01b3[_0xd897('0x55')]['id']}})[_0xd897('0x34')](handleEntityNotFound(_0x206518,null))[_0xd897('0x34')](saveUpdates(_0x2f01b3[_0xd897('0x54')],null))[_0xd897('0x34')](respondWithResult(_0x206518,null))[_0xd897('0x27')](handleError(_0x206518,null));};var utilLicense=require(_0xd897('0x1b'));exports[_0xd897('0x73')]=function(_0x20ecce,_0x4e5d72,_0x595d2d){var _0x34afdf='server/files/images/logos';var _0x441540={'custom':![]};return utilLicense[_0xd897('0x6d')]()[_0xd897('0x34')](function(_0x113445){if(_0x113445){_0x441540=_0x113445;}return db['Setting']['find']({'where':{'id':_0x20ecce[_0xd897('0x55')]['id']},'attributes':[_0xd897('0x59'),_0xd897('0x5a'),_0xd897('0x5c'),'favicon',_0xd897('0x5e'),_0xd897('0x6e'),'defaultPreferred',_0xd897('0x60')],'raw':!![]});})[_0xd897('0x34')](handleEntityNotFound(_0x4e5d72,null))[_0xd897('0x34')](function(_0x3f24e4){if(_0x3f24e4){var _0xb0fae6=_0x3f24e4[_0xd897('0x5c')]&&fs[_0xd897('0x68')](path[_0xd897('0x61')](config[_0xd897('0x62')],_0x34afdf,_[_0xd897('0x63')](_0x3f24e4[_0xd897('0x5c')])))?path['join'](config[_0xd897('0x62')],_0x34afdf,_['toLower'](_0x3f24e4[_0xd897('0x5c')])):path[_0xd897('0x61')](config[_0xd897('0x62')],_0x34afdf,_[_0xd897('0x63')]('default_preferred.png'));var _0x9facd4=_0xd897('0x65')+_[_0xd897('0x66')](_0xd897('0x5c'));if(_0x3f24e4[_0x9facd4]||!_0x441540[_0xd897('0x67')]||!_0x441540[_0xd897('0x5c')]){_0xb0fae6=path[_0xd897('0x61')](config[_0xd897('0x62')],_0x34afdf,_[_0xd897('0x63')]('default_preferred.png'));}if(!fs[_0xd897('0x68')](_0xb0fae6)){throw new db[(_0xd897('0x69'))][(_0xd897('0x6a'))](_[_0xd897('0x66')]('preferred')+_0xd897('0x70'));}return _0x4e5d72[_0xd897('0x6b')](_0xb0fae6);}})[_0xd897('0x27')](handleError(_0x4e5d72,null));};exports[_0xd897('0x74')]=function(_0x279d7e,_0x3644d0,_0x20d47d){if(_0x279d7e[_0xd897('0x57')]&&_0x279d7e[_0xd897('0x57')][_0xd897('0x58')]){_0x279d7e[_0xd897('0x54')][_0xd897('0x5d')]=_0x279d7e[_0xd897('0x57')][_0xd897('0x58')];}return db[_0xd897('0x3a')][_0xd897('0x53')]({'where':{'id':_0x279d7e[_0xd897('0x55')]['id']}})[_0xd897('0x34')](handleEntityNotFound(_0x3644d0,null))[_0xd897('0x34')](saveUpdates(_0x279d7e[_0xd897('0x54')],null))['then'](respondWithResult(_0x3644d0,null))[_0xd897('0x27')](handleError(_0x3644d0,null));};var utilLicense=require(_0xd897('0x1b'));exports[_0xd897('0x75')]=function(_0x25b8b8,_0x287815,_0x133329){var _0x14a2dc=_0xd897('0x5b');var _0x1eaafe={'custom':![]};return utilLicense['getLicense']()[_0xd897('0x34')](function(_0x41d76e){if(_0x41d76e){_0x1eaafe=_0x41d76e;}return db['Setting']['find']({'where':{'id':_0x25b8b8['params']['id']},'attributes':[_0xd897('0x59'),_0xd897('0x5a'),_0xd897('0x5c'),_0xd897('0x5d'),_0xd897('0x5e'),_0xd897('0x6e'),_0xd897('0x5f'),_0xd897('0x60')],'raw':!![]});})['then'](handleEntityNotFound(_0x287815,null))[_0xd897('0x34')](function(_0x742bcd){if(_0x742bcd){var _0x4eab83=_0x742bcd[_0xd897('0x5d')]&&fs[_0xd897('0x68')](path[_0xd897('0x61')](config[_0xd897('0x62')],_0x14a2dc,_[_0xd897('0x63')](_0x742bcd['favicon'])))?path[_0xd897('0x61')](config[_0xd897('0x62')],_0x14a2dc,_['toLower'](_0x742bcd['favicon'])):path['join'](config[_0xd897('0x62')],_0x14a2dc,_[_0xd897('0x63')]('default_favicon.ico'));var _0x337865=_0xd897('0x65')+_[_0xd897('0x66')]('favicon');if(_0x742bcd[_0x337865]||!_0x1eaafe[_0xd897('0x67')]){_0x4eab83=path[_0xd897('0x61')](config['root'],_0x14a2dc,_[_0xd897('0x63')]('default_favicon.ico'));}if(!fs[_0xd897('0x68')](_0x4eab83)){throw new db['Sequelize'][(_0xd897('0x6a'))](_[_0xd897('0x66')](_0xd897('0x5d'))+_0xd897('0x70'));}return _0x287815[_0xd897('0x6b')](_0x4eab83);}})[_0xd897('0x27')](handleError(_0x287815,null));};exports[_0xd897('0x76')]=function(_0x18459b,_0x2136df){var _0xe0c50f={'offset':moment()[_0xd897('0x77')]()};_0xe0c50f[_0xd897('0x78')]=moment()['utcOffset'](_0xe0c50f[_0xd897('0x2c')])[_0xd897('0x79')](_0xd897('0x7a'));return _0x2136df[_0xd897('0x29')](0xc8)[_0xd897('0x37')](_0xe0c50f);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index fc339b0..c17f91a 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(_0x316b3e,_0x47b154){var _0x45ba95=function(_0x5e68c4){while(--_0x5e68c4){_0x316b3e['push'](_0x316b3e['shift']());}};_0x45ba95(++_0x47b154);}(_0x3e74,0x175));var _0x43e7=function(_0x392175,_0x49a30f){_0x392175=_0x392175-0x0;var _0x32d94c=_0x3e74[_0x392175];return _0x32d94c;};'use strict';var _=require(_0x43e7('0x0'));var util=require('util');var logger=require(_0x43e7('0x1'))(_0x43e7('0x2'));var moment=require(_0x43e7('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x43e7('0x4'));var rimraf=require('rimraf');var config=require(_0x43e7('0x5'));var attributes=require(_0x43e7('0x6'));module[_0x43e7('0x7')]=function(_0x1c503b,_0xc98b9c){return _0x1c503b['define'](_0x43e7('0x8'),attributes,{'tableName':_0x43e7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3e74=['exports','Setting','settings','lodash','../../config/logger','api','moment','path','../../config/environment','./setting.attributes'];(function(_0x588a56,_0x4adb69){var _0x5666ea=function(_0x36b175){while(--_0x36b175){_0x588a56['push'](_0x588a56['shift']());}};_0x5666ea(++_0x4adb69);}(_0x3e74,0x175));var _0x43e7=function(_0x17f8e6,_0x53070d){_0x17f8e6=_0x17f8e6-0x0;var _0x10b5dd=_0x3e74[_0x17f8e6];return _0x10b5dd;};'use strict';var _=require(_0x43e7('0x0'));var util=require('util');var logger=require(_0x43e7('0x1'))(_0x43e7('0x2'));var moment=require(_0x43e7('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x43e7('0x4'));var rimraf=require('rimraf');var config=require(_0x43e7('0x5'));var attributes=require(_0x43e7('0x6'));module[_0x43e7('0x7')]=function(_0x1c503b,_0xc98b9c){return _0x1c503b['define'](_0x43e7('0x8'),attributes,{'tableName':_0x43e7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index fcec22c..31f47ab 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 _0x49ee=['moment','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','request','then','info','Setting,\x20%s,\x20%s','Setting,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','ShowSetting','Setting','options','raw','where','attributes','include','map','model','stringify','util'];(function(_0xd62658,_0x4aae0b){var _0xd35dfd=function(_0x3df31f){while(--_0x3df31f){_0xd62658['push'](_0xd62658['shift']());}};_0xd35dfd(++_0x4aae0b);}(_0x49ee,0x1bf));var _0xe49e=function(_0x2bf517,_0x2ecd35){_0x2bf517=_0x2bf517-0x0;var _0x5eadba=_0x49ee[_0x2bf517];return _0x5eadba;};'use strict';var _=require('lodash');var util=require(_0xe49e('0x0'));var moment=require(_0xe49e('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe49e('0x2'))['db'];var utils=require(_0xe49e('0x3'));var logger=require('../../config/logger')('rpc');var config=require(_0xe49e('0x4'));var jayson=require(_0xe49e('0x5'));var client=jayson['client'][_0xe49e('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x4e59d5,_0x5adcf6,_0x1315cd){return new BPromise(function(_0xa3911c,_0x51f380){return client[_0xe49e('0x7')](_0x4e59d5,_0x1315cd)[_0xe49e('0x8')](function(_0x36e726){logger[_0xe49e('0x9')](_0xe49e('0xa'),_0x5adcf6,'request\x20sent');logger['debug'](_0xe49e('0xb'),_0x5adcf6,_0xe49e('0xc'),JSON['stringify'](_0x36e726));if(_0x36e726[_0xe49e('0xd')]){if(_0x36e726[_0xe49e('0xd')][_0xe49e('0xe')]===0x1f4){logger[_0xe49e('0xd')](_0xe49e('0xa'),_0x5adcf6,_0x36e726[_0xe49e('0xd')][_0xe49e('0xf')]);return _0x51f380(_0x36e726['error'][_0xe49e('0xf')]);}logger['error'](_0xe49e('0xa'),_0x5adcf6,_0x36e726[_0xe49e('0xd')][_0xe49e('0xf')]);return _0xa3911c(_0x36e726[_0xe49e('0xd')][_0xe49e('0xf')]);}else{logger[_0xe49e('0x9')](_0xe49e('0xa'),_0x5adcf6,'request\x20sent');_0xa3911c(_0x36e726[_0xe49e('0x10')][_0xe49e('0xf')]);}})[_0xe49e('0x11')](function(_0x3dd0c3){logger['error'](_0xe49e('0xa'),_0x5adcf6,_0x3dd0c3);_0x51f380(_0x3dd0c3);});});}exports[_0xe49e('0x12')]=function(_0x5a2fad){var _0x22bf24=this;return new Promise(function(_0x5cabc9,_0xd5cbb4){return db[_0xe49e('0x13')]['find']({'raw':_0x5a2fad[_0xe49e('0x14')]?_0x5a2fad[_0xe49e('0x14')][_0xe49e('0x15')]===undefined?!![]:![]:!![],'where':_0x5a2fad[_0xe49e('0x14')]?_0x5a2fad[_0xe49e('0x14')][_0xe49e('0x16')]||null:null,'attributes':_0x5a2fad['options']?_0x5a2fad[_0xe49e('0x14')][_0xe49e('0x17')]||null:null,'include':_0x5a2fad[_0xe49e('0x14')]?_0x5a2fad[_0xe49e('0x14')][_0xe49e('0x18')]?_[_0xe49e('0x19')](_0x5a2fad[_0xe49e('0x14')]['include'],function(_0x30127d){return{'model':db[_0x30127d[_0xe49e('0x1a')]],'as':_0x30127d['as'],'attributes':_0x30127d[_0xe49e('0x17')],'include':_0x30127d[_0xe49e('0x18')]?_[_0xe49e('0x19')](_0x30127d['include'],function(_0x2974e0){return{'model':db[_0x2974e0[_0xe49e('0x1a')]],'as':_0x2974e0['as'],'attributes':_0x2974e0[_0xe49e('0x17')],'include':_0x2974e0[_0xe49e('0x18')]?_[_0xe49e('0x19')](_0x2974e0[_0xe49e('0x18')],function(_0x1152c0){return{'model':db[_0x1152c0[_0xe49e('0x1a')]],'as':_0x1152c0['as'],'attributes':_0x1152c0['attributes']};}):[]};}):[]};}):[]:[]})[_0xe49e('0x8')](function(_0x15781a){logger[_0xe49e('0x9')](_0xe49e('0x12'),_0x5a2fad);logger['debug'](_0xe49e('0x12'),_0x5a2fad,JSON[_0xe49e('0x1b')](_0x15781a));_0x5cabc9(_0x15781a);})['catch'](function(_0x27b4a7){logger[_0xe49e('0xd')](_0xe49e('0x12'),_0x27b4a7[_0xe49e('0xf')],_0x5a2fad);_0xd5cbb4(_0x22bf24[_0xe49e('0xd')](0x1f4,_0x27b4a7[_0xe49e('0xf')]));});});}; \ No newline at end of file +var _0x9950=['catch','ShowSetting','Setting','find','options','raw','where','attributes','include','map','model','debug','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Setting,\x20%s,\x20%s','request\x20sent','Setting,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result'];(function(_0x1d1026,_0x446868){var _0x458eb8=function(_0xfa1623){while(--_0xfa1623){_0x1d1026['push'](_0x1d1026['shift']());}};_0x458eb8(++_0x446868);}(_0x9950,0xd8));var _0x0995=function(_0xa6f35,_0x3cb483){_0xa6f35=_0xa6f35-0x0;var _0x51276c=_0x9950[_0xa6f35];return _0x51276c;};'use strict';var _=require(_0x0995('0x0'));var util=require(_0x0995('0x1'));var moment=require(_0x0995('0x2'));var BPromise=require(_0x0995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0995('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x0995('0x5'));var logger=require(_0x0995('0x6'))(_0x0995('0x7'));var config=require(_0x0995('0x8'));var jayson=require(_0x0995('0x9'));var client=jayson[_0x0995('0xa')][_0x0995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1de6b2,_0x96c223,_0x37771c){return new BPromise(function(_0x56858e,_0x167d33){return client[_0x0995('0xc')](_0x1de6b2,_0x37771c)[_0x0995('0xd')](function(_0x127b94){logger['info'](_0x0995('0xe'),_0x96c223,_0x0995('0xf'));logger['debug'](_0x0995('0x10'),_0x96c223,_0x0995('0xf'),JSON[_0x0995('0x11')](_0x127b94));if(_0x127b94[_0x0995('0x12')]){if(_0x127b94[_0x0995('0x12')]['code']===0x1f4){logger[_0x0995('0x12')](_0x0995('0xe'),_0x96c223,_0x127b94[_0x0995('0x12')]['message']);return _0x167d33(_0x127b94[_0x0995('0x12')][_0x0995('0x13')]);}logger[_0x0995('0x12')](_0x0995('0xe'),_0x96c223,_0x127b94[_0x0995('0x12')][_0x0995('0x13')]);return _0x56858e(_0x127b94['error'][_0x0995('0x13')]);}else{logger[_0x0995('0x14')]('Setting,\x20%s,\x20%s',_0x96c223,_0x0995('0xf'));_0x56858e(_0x127b94[_0x0995('0x15')][_0x0995('0x13')]);}})[_0x0995('0x16')](function(_0xf333ca){logger[_0x0995('0x12')](_0x0995('0xe'),_0x96c223,_0xf333ca);_0x167d33(_0xf333ca);});});}exports[_0x0995('0x17')]=function(_0x30d9ba){var _0x24769b=this;return new Promise(function(_0x505932,_0x4ed455){return db[_0x0995('0x18')][_0x0995('0x19')]({'raw':_0x30d9ba['options']?_0x30d9ba[_0x0995('0x1a')][_0x0995('0x1b')]===undefined?!![]:![]:!![],'where':_0x30d9ba[_0x0995('0x1a')]?_0x30d9ba[_0x0995('0x1a')][_0x0995('0x1c')]||null:null,'attributes':_0x30d9ba[_0x0995('0x1a')]?_0x30d9ba['options'][_0x0995('0x1d')]||null:null,'include':_0x30d9ba['options']?_0x30d9ba[_0x0995('0x1a')][_0x0995('0x1e')]?_[_0x0995('0x1f')](_0x30d9ba[_0x0995('0x1a')][_0x0995('0x1e')],function(_0x29da78){return{'model':db[_0x29da78[_0x0995('0x20')]],'as':_0x29da78['as'],'attributes':_0x29da78[_0x0995('0x1d')],'include':_0x29da78[_0x0995('0x1e')]?_[_0x0995('0x1f')](_0x29da78[_0x0995('0x1e')],function(_0x47eda5){return{'model':db[_0x47eda5[_0x0995('0x20')]],'as':_0x47eda5['as'],'attributes':_0x47eda5[_0x0995('0x1d')],'include':_0x47eda5['include']?_[_0x0995('0x1f')](_0x47eda5[_0x0995('0x1e')],function(_0x1ea42c){return{'model':db[_0x1ea42c[_0x0995('0x20')]],'as':_0x1ea42c['as'],'attributes':_0x1ea42c['attributes']};}):[]};}):[]};}):[]:[]})[_0x0995('0xd')](function(_0x22879a){logger[_0x0995('0x14')](_0x0995('0x17'),_0x30d9ba);logger[_0x0995('0x21')](_0x0995('0x17'),_0x30d9ba,JSON[_0x0995('0x11')](_0x22879a));_0x505932(_0x22879a);})[_0x0995('0x16')](function(_0x2b6c17){logger[_0x0995('0x12')](_0x0995('0x17'),_0x2b6c17[_0x0995('0x13')],_0x30d9ba);_0x4ed455(_0x24769b[_0x0995('0x12')](0x1f4,_0x2b6c17[_0x0995('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index 210fd30..2b8131a 100644 --- a/server/api/smsAccount/index.js +++ b/server/api/smsAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['getInteractions','/:id/status','statusGet','/:id/users','post','create','addAnswer','/:id/notify','notify','addApplications','send','status','addAgents','put','/:id','update','delete','destroy','/:id/canned_answers','removeAnswers','removeAgents','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','index','/describe','isAuthenticated','/:id/dispositions','getDispositions','getAnswers','/:id/applications','getApplications'];(function(_0x578def,_0x452c52){var _0x1e0d22=function(_0x56d452){while(--_0x56d452){_0x578def['push'](_0x578def['shift']());}};_0x1e0d22(++_0x452c52);}(_0x7a54,0x106));var _0x47a5=function(_0x207aad,_0x1be103){_0x207aad=_0x207aad-0x0;var _0x34b80b=_0x7a54[_0x207aad];return _0x34b80b;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['describe']);router[_0x47a5('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x47a5('0x9')](_0x47a5('0xd'),auth['isAuthenticated'](),controller[_0x47a5('0xe')]);router['get']('/:id/canned_answers',auth[_0x47a5('0xc')](),controller[_0x47a5('0xf')]);router[_0x47a5('0x9')](_0x47a5('0x10'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x11')]);router[_0x47a5('0x9')]('/:id/interactions',auth[_0x47a5('0xc')](),controller[_0x47a5('0x12')]);router[_0x47a5('0x9')](_0x47a5('0x13'),controller[_0x47a5('0x14')]);router[_0x47a5('0x9')](_0x47a5('0x15'),auth[_0x47a5('0xc')](),controller['getAgents']);router[_0x47a5('0x16')]('/',auth[_0x47a5('0xc')](),controller[_0x47a5('0x17')]);router[_0x47a5('0x16')](_0x47a5('0xd'),auth['isAuthenticated'](),controller['addDisposition']);router[_0x47a5('0x16')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x47a5('0x18')]);router[_0x47a5('0x16')](_0x47a5('0x19'),controller[_0x47a5('0x1a')]);router[_0x47a5('0x16')](_0x47a5('0x10'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x1b')]);router[_0x47a5('0x16')]('/:id/send',auth[_0x47a5('0xc')](),controller[_0x47a5('0x1c')]);router['post'](_0x47a5('0x13'),controller[_0x47a5('0x1d')]);router[_0x47a5('0x16')]('/:id/users',auth[_0x47a5('0xc')](),controller[_0x47a5('0x1e')]);router[_0x47a5('0x1f')](_0x47a5('0x20'),auth['isAuthenticated'](),controller[_0x47a5('0x21')]);router[_0x47a5('0x22')]('/:id',auth[_0x47a5('0xc')](),controller[_0x47a5('0x23')]);router[_0x47a5('0x22')](_0x47a5('0xd'),auth[_0x47a5('0xc')](),controller['removeDispositions']);router['delete'](_0x47a5('0x24'),auth['isAuthenticated'](),controller[_0x47a5('0x25')]);router['delete'](_0x47a5('0x15'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x26')]);module[_0x47a5('0x27')]=router; \ No newline at end of file +var _0x7a54=['getInteractions','/:id/status','statusGet','/:id/users','post','create','addAnswer','/:id/notify','notify','addApplications','send','status','addAgents','put','/:id','update','delete','destroy','/:id/canned_answers','removeAnswers','removeAgents','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','index','/describe','isAuthenticated','/:id/dispositions','getDispositions','getAnswers','/:id/applications','getApplications'];(function(_0x24f63d,_0x2f4607){var _0x46152c=function(_0x5107b4){while(--_0x5107b4){_0x24f63d['push'](_0x24f63d['shift']());}};_0x46152c(++_0x2f4607);}(_0x7a54,0x106));var _0x47a5=function(_0x3836c7,_0x3f7f54){_0x3836c7=_0x3836c7-0x0;var _0x50c8e6=_0x7a54[_0x3836c7];return _0x50c8e6;};'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 01d8bce..de49789 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 _0x8c2c=['exports','STRING','name','ENUM','connectel','clicksend','plivo','clickatell','csc','infobip','intelepeer','BOOLEAN','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','sequelize'];(function(_0x2e6dbf,_0x57dd06){var _0x2680e5=function(_0x4018f4){while(--_0x4018f4){_0x2e6dbf['push'](_0x2e6dbf['shift']());}};_0x2680e5(++_0x57dd06);}(_0x8c2c,0x18e));var _0xc8c2=function(_0x3eaa83,_0x3404e1){_0x3eaa83=_0x3eaa83-0x0;var _0x309449=_0x8c2c[_0x3eaa83];return _0x309449;};'use strict';var Sequelize=require(_0xc8c2('0x0'));var rs=require('randomstring');module[_0xc8c2('0x1')]={'name':{'type':Sequelize[_0xc8c2('0x2')],'unique':_0xc8c2('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0xc8c2('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0xc8c2('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0xc8c2('0x2')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0xc8c2('0x2')]},'type':{'type':Sequelize[_0xc8c2('0x4')]('twilio','skebby',_0xc8c2('0x5'),_0xc8c2('0x6'),_0xc8c2('0x7'),_0xc8c2('0x8'),'bandwidth',_0xc8c2('0x9'),_0xc8c2('0xa'),_0xc8c2('0xb'))},'accountSid':{'type':Sequelize[_0xc8c2('0x2')]},'authId':{'type':Sequelize[_0xc8c2('0x2')]},'authToken':{'type':Sequelize['STRING']},'smsMethod':{'type':Sequelize['ENUM']('SI','TI','GP')},'username':{'type':Sequelize[_0xc8c2('0x2')]},'password':{'type':Sequelize[_0xc8c2('0x2')]},'apiKey':{'type':Sequelize[_0xc8c2('0x2')]},'applicationId':{'type':Sequelize[_0xc8c2('0x2')]},'accountId':{'type':Sequelize[_0xc8c2('0x2')]},'senderString':{'type':Sequelize[_0xc8c2('0x2')]},'deliveryReport':{'type':Sequelize[_0xc8c2('0xc')],'defaultValue':![]},'description':{'type':Sequelize[_0xc8c2('0x2')]},'notificationTemplate':{'type':Sequelize[_0xc8c2('0xd')],'defaultValue':function(){return _0xc8c2('0xe');}},'notificationSound':{'type':Sequelize[_0xc8c2('0xc')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xc8c2('0xc')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xc8c2('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xc8c2('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xc8c2('0xc')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xc8c2('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0xc8c2('0x2')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xc8c2('0xf')],'comment':_0xc8c2('0x10')},'mandatoryDisposition':{'type':Sequelize[_0xc8c2('0xc')],'defaultValue':![],'comment':_0xc8c2('0x11'),'set':function(_0x530ded){if(!_0x530ded)this['setDataValue'](_0xc8c2('0x12'),null);this[_0xc8c2('0x13')](_0xc8c2('0x14'),_0x530ded);}}}; \ No newline at end of file +var _0x1a5a=['INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','STRING','name','generate','ENUM','twilio','skebby','connectel','clicksend','plivo','clickatell','bandwidth','csc','infobip','intelepeer','BOOLEAN','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}'];(function(_0xf67711,_0x58f57e){var _0x1b7a22=function(_0x2883c7){while(--_0x2883c7){_0xf67711['push'](_0xf67711['shift']());}};_0x1b7a22(++_0x58f57e);}(_0x1a5a,0x1e9));var _0xa1a5=function(_0x27a611,_0xe00621){_0x27a611=_0x27a611-0x0;var _0x39c5de=_0x1a5a[_0x27a611];return _0x39c5de;};'use strict';var Sequelize=require(_0xa1a5('0x0'));var rs=require('randomstring');module['exports']={'name':{'type':Sequelize[_0xa1a5('0x1')],'unique':_0xa1a5('0x2'),'allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize[_0xa1a5('0x1')],'allowNull':![]},'token':{'type':Sequelize[_0xa1a5('0x1')],'defaultValue':function(){return rs[_0xa1a5('0x3')]();}},'phone':{'type':Sequelize[_0xa1a5('0x1')]},'type':{'type':Sequelize[_0xa1a5('0x4')](_0xa1a5('0x5'),_0xa1a5('0x6'),_0xa1a5('0x7'),_0xa1a5('0x8'),_0xa1a5('0x9'),_0xa1a5('0xa'),_0xa1a5('0xb'),_0xa1a5('0xc'),_0xa1a5('0xd'),_0xa1a5('0xe'))},'accountSid':{'type':Sequelize[_0xa1a5('0x1')]},'authId':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0xa1a5('0x1')]},'smsMethod':{'type':Sequelize['ENUM']('SI','TI','GP')},'username':{'type':Sequelize[_0xa1a5('0x1')]},'password':{'type':Sequelize['STRING']},'apiKey':{'type':Sequelize['STRING']},'applicationId':{'type':Sequelize[_0xa1a5('0x1')]},'accountId':{'type':Sequelize['STRING']},'senderString':{'type':Sequelize[_0xa1a5('0x1')]},'deliveryReport':{'type':Sequelize[_0xa1a5('0xf')],'defaultValue':![]},'description':{'type':Sequelize[_0xa1a5('0x1')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xa1a5('0x10');}},'notificationSound':{'type':Sequelize[_0xa1a5('0xf')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xa1a5('0xf')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xa1a5('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xa1a5('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xa1a5('0xf')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0xa1a5('0x1')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xa1a5('0x11')],'comment':_0xa1a5('0x12')},'mandatoryDisposition':{'type':Sequelize[_0xa1a5('0xf')],'defaultValue':![],'comment':_0xa1a5('0x13'),'set':function(_0x39204e){if(!_0x39204e)this[_0xa1a5('0x14')](_0xa1a5('0x15'),null);this['setDataValue'](_0xa1a5('0x16'),_0x39204e);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index 4ca99a3..fc73373 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 _0xf895=['../../config/license/util','defaults','redis','localhost','socket.io-emitter','register','jayson/promise','client','http','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','end','offset','undefined','limit','count','Content-Range','reject','save','update','get','SmsAccounts','UserProfileResource','destroy','stack','name','send','Pause','mandatoryDispositionPause','fieldName','type','model','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','map','VIRTUAL','merge','options','SmsAccount','includeAll','include','rows','show','params','rawAttributes','keys','length','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','Disposition','getDispositions','findOne','nolimit','SmsAccountId','findAll','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','removeAnswers','notify','sms','SmsApplication','Applications','account','orderBy','priority','asc','CmContact','Sequelize','ValidationError','difference','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','from','From','Body','messageId','sender','text','connectel','clicksend','message_id','plivo','MessageUUID','results','originatingAddress','clickatell','fromNumber','replyMessageId','bandwidth','intelepeer','refid','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','contact','SmsInteraction','spread','interaction','autoclose','applications','close','unmanaged','*,*,*,*','created','AttachmentId','unshift','agent','queueId','SmsQueue','queue','waitForTheAssignedQueue','Start','startRouting','receiveMessage','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','set','Content-Type','json','sequelize','ISOLATION_LEVELS','bulkCreate','finally','sendStatus','getApplications','getInteractions','User','Owner','internal','Tags','color','tag','to\x20is\x20mandatory','List','out','SmsMessage','dataValues','inspect','skebby','skebby_dispatch_id','requestid','statusInt','status_code','infobip','groupName','redif','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','message-delivered','DELIVRD','statusGet','csc','message-id','state','addAgents','emit','isArray','userSmsAccount:remove','getAgents','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment'];(function(_0x48ce80,_0x31830f){var _0x3a8d32=function(_0x273a0f){while(--_0x273a0f){_0x48ce80['push'](_0x48ce80['shift']());}};_0x3a8d32(++_0x31830f);}(_0xf895,0x1a8));var _0x5f89=function(_0x2c39d8,_0x5ee67e){_0x2c39d8=_0x2c39d8-0x0;var _0x57f1a7=_0xf895[_0x2c39d8];return _0x57f1a7;};'use strict';var emlformat=require(_0x5f89('0x0'));var rimraf=require(_0x5f89('0x1'));var zipdir=require(_0x5f89('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5f89('0x3'));var moment=require('moment');var BPromise=require(_0x5f89('0x4'));var Mustache=require(_0x5f89('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x5f89('0x6'));var ejs=require(_0x5f89('0x7'));var fs=require('fs');var fs_extra=require(_0x5f89('0x8'));var _=require(_0x5f89('0x9'));var squel=require(_0x5f89('0xa'));var crypto=require(_0x5f89('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x5f89('0xc'));var toCsv=require(_0x5f89('0x6'));var querystring=require(_0x5f89('0xd'));var Papa=require(_0x5f89('0xe'));var Redis=require('ioredis');var authService=require(_0x5f89('0xf'));var qs=require(_0x5f89('0x10'));var as=require(_0x5f89('0x11'));var hardwareService=require(_0x5f89('0x12'));var logger=require('../../config/logger')(_0x5f89('0x13'));var utils=require(_0x5f89('0x14'));var config=require(_0x5f89('0x15'));var licenseUtil=require(_0x5f89('0x16'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x5f89('0x17')](config[_0x5f89('0x18')],{'host':_0x5f89('0x19'),'port':0x18eb});var socket=require(_0x5f89('0x1a'))(new Redis(config[_0x5f89('0x18')]));require('./smsAccount.socket')[_0x5f89('0x1b')](socket);var jayson=require(_0x5f89('0x1c'));var client=jayson[_0x5f89('0x1d')][_0x5f89('0x1e')]({'port':0x232c});function respondWithRpcPromise(_0x3d0240,_0x3045a0,_0x262246,_0x5a9826){return new BPromise(function(_0x432a9a,_0xbe068){var _0x872bb3=_0x5a9826||client;return _0x872bb3['request'](_0x3d0240,_0x262246)[_0x5f89('0x1f')](function(_0x34d2a6){logger[_0x5f89('0x20')](_0x5f89('0x21'),_0x3045a0,_0x5f89('0x22'));logger[_0x5f89('0x23')](_0x5f89('0x24'),_0x3045a0,_0x5f89('0x22'),JSON[_0x5f89('0x25')](_0x34d2a6));if(_0x34d2a6[_0x5f89('0x26')]){if(_0x34d2a6[_0x5f89('0x26')][_0x5f89('0x27')]===0x1f4){logger[_0x5f89('0x26')](_0x5f89('0x21'),_0x3045a0,_0x34d2a6[_0x5f89('0x26')][_0x5f89('0x28')]);return _0xbe068(_0x34d2a6['error'][_0x5f89('0x28')]);}logger['error'](_0x5f89('0x21'),_0x3045a0,_0x34d2a6[_0x5f89('0x26')][_0x5f89('0x28')]);return _0x432a9a(_0x34d2a6[_0x5f89('0x26')][_0x5f89('0x28')]);}else{logger[_0x5f89('0x20')](_0x5f89('0x21'),_0x3045a0,_0x5f89('0x22'));_0x432a9a(_0x34d2a6[_0x5f89('0x29')][_0x5f89('0x28')]);}})[_0x5f89('0x2a')](function(_0x254566){logger['error']('SmsAccount,\x20%s,\x20%s',_0x3045a0,_0x254566);_0xbe068(_0x254566);});});}function respondWithStatusCode(_0x40e67f,_0xe3e9df){_0xe3e9df=_0xe3e9df||0xcc;return function(_0x3cf9f3){if(_0x3cf9f3){return _0x40e67f['sendStatus'](_0xe3e9df);}return _0x40e67f[_0x5f89('0x2b')](_0xe3e9df)[_0x5f89('0x2c')]();};}function respondWithResult(_0x3dd8f7,_0x4820bf){_0x4820bf=_0x4820bf||0xc8;return function(_0x51e09c){if(_0x51e09c){return _0x3dd8f7[_0x5f89('0x2b')](_0x4820bf)['json'](_0x51e09c);}};}function respondWithFilteredResult(_0x4f2573,_0x26248c){return function(_0x1f1c9c){if(_0x1f1c9c){var _0x46eaf6=typeof _0x26248c[_0x5f89('0x2d')]===_0x5f89('0x2e')&&typeof _0x26248c[_0x5f89('0x2f')]===_0x5f89('0x2e');var _0x58da75=_0x1f1c9c[_0x5f89('0x30')];var _0x391c60=_0x46eaf6?0x0:_0x26248c[_0x5f89('0x2d')];var _0x4b6f18=_0x46eaf6?_0x1f1c9c['count']:_0x26248c['offset']+_0x26248c[_0x5f89('0x2f')];var _0x1b2583;if(_0x4b6f18>=_0x58da75){_0x4b6f18=_0x58da75;_0x1b2583=0xc8;}else{_0x1b2583=0xce;}_0x4f2573[_0x5f89('0x2b')](_0x1b2583);return _0x4f2573['set'](_0x5f89('0x31'),_0x391c60+'-'+_0x4b6f18+'/'+_0x58da75)['json'](_0x1f1c9c);}return null;};}function patchUpdates(_0x166ede){return function(_0x33e2f2){try{jsonpatch['apply'](_0x33e2f2,_0x166ede,!![]);}catch(_0x63ee12){return BPromise[_0x5f89('0x32')](_0x63ee12);}return _0x33e2f2[_0x5f89('0x33')]();};}function saveUpdates(_0x541c6c,_0x10b11a){return function(_0x2362d9){if(_0x2362d9){return _0x2362d9[_0x5f89('0x34')](_0x541c6c)['then'](function(_0x5aeb67){return _0x5aeb67;});}return null;};}function removeEntity(_0x4e98df,_0x4a6087){return function(_0xca6255){if(_0xca6255){return _0xca6255['destroy']()[_0x5f89('0x1f')](function(){var _0x2f609b=_0xca6255[_0x5f89('0x35')]({'plain':!![]});var _0x5316d1=_0x5f89('0x36');return db[_0x5f89('0x37')][_0x5f89('0x38')]({'where':{'type':_0x5316d1,'resourceId':_0x2f609b['id']}})[_0x5f89('0x1f')](function(){return _0xca6255;});})['then'](function(){_0x4e98df['status'](0xcc)[_0x5f89('0x2c')]();});}};}function handleEntityNotFound(_0x387efb,_0x5dec33){return function(_0x1fd1c8){if(!_0x1fd1c8){_0x387efb['sendStatus'](0x194);}return _0x1fd1c8;};}function handleError(_0x22babd,_0x237859){_0x237859=_0x237859||0x1f4;return function(_0x476db6){logger['error'](_0x476db6[_0x5f89('0x39')]);if(_0x476db6[_0x5f89('0x3a')]){delete _0x476db6[_0x5f89('0x3a')];}_0x22babd[_0x5f89('0x2b')](_0x237859)[_0x5f89('0x3b')](_0x476db6);};}exports['index']=function(_0x196b53,_0x2ca4dc){var _0x40fa36={'include':[{'model':db[_0x5f89('0x3c')],'as':_0x5f89('0x3d')}]},_0xffa6dc={},_0x593e13={'count':0x0,'rows':[]};var _0x23a2e2=_['map'](db['SmsAccount']['rawAttributes'],function(_0x131ab3){return{'name':_0x131ab3[_0x5f89('0x3e')],'type':_0x131ab3[_0x5f89('0x3f')]['key']};});_0xffa6dc[_0x5f89('0x40')]=_['map'](_0x23a2e2,_0x5f89('0x3a'));_0xffa6dc[_0x5f89('0x41')]=_['keys'](_0x196b53['query']);_0xffa6dc[_0x5f89('0x42')]=_[_0x5f89('0x43')](_0xffa6dc[_0x5f89('0x40')],_0xffa6dc['query']);_0x40fa36[_0x5f89('0x44')]=_[_0x5f89('0x43')](_0xffa6dc[_0x5f89('0x40')],qs[_0x5f89('0x45')](_0x196b53[_0x5f89('0x41')][_0x5f89('0x45')]));_0x40fa36[_0x5f89('0x44')]=_0x40fa36[_0x5f89('0x44')]['length']?_0x40fa36[_0x5f89('0x44')]:_0xffa6dc[_0x5f89('0x40')];if(!_0x196b53['query'][_0x5f89('0x46')]('nolimit')){_0x40fa36[_0x5f89('0x2f')]=qs[_0x5f89('0x2f')](_0x196b53[_0x5f89('0x41')][_0x5f89('0x2f')]);_0x40fa36[_0x5f89('0x2d')]=qs[_0x5f89('0x2d')](_0x196b53[_0x5f89('0x41')][_0x5f89('0x2d')]);}_0x40fa36[_0x5f89('0x47')]=qs[_0x5f89('0x48')](_0x196b53[_0x5f89('0x41')]['sort']);_0x40fa36[_0x5f89('0x49')]=qs[_0x5f89('0x42')](_[_0x5f89('0x4a')](_0x196b53[_0x5f89('0x41')],_0xffa6dc[_0x5f89('0x42')]),_0x23a2e2);if(_0x196b53[_0x5f89('0x41')][_0x5f89('0x4b')]){_0x40fa36['where']=_['merge'](_0x40fa36[_0x5f89('0x49')],{'$or':_[_0x5f89('0x4c')](_0x23a2e2,function(_0x176909){if(_0x176909[_0x5f89('0x3f')]!==_0x5f89('0x4d')){var _0x1160c8={};_0x1160c8[_0x176909['name']]={'$like':'%'+_0x196b53[_0x5f89('0x41')][_0x5f89('0x4b')]+'%'};return _0x1160c8;}})});}_0x40fa36=_[_0x5f89('0x4e')]({},_0x40fa36,_0x196b53[_0x5f89('0x4f')]);var _0x810436={'where':_0x40fa36['where']};return db[_0x5f89('0x50')][_0x5f89('0x30')](_0x810436)['then'](function(_0x1f8346){_0x593e13[_0x5f89('0x30')]=_0x1f8346;if(_0x196b53[_0x5f89('0x41')][_0x5f89('0x51')]){_0x40fa36[_0x5f89('0x52')]=[{'all':!![]}];}return db[_0x5f89('0x50')]['findAll'](_0x40fa36);})[_0x5f89('0x1f')](function(_0x512ad4){_0x593e13[_0x5f89('0x53')]=_0x512ad4;return _0x593e13;})[_0x5f89('0x1f')](respondWithFilteredResult(_0x2ca4dc,_0x40fa36))[_0x5f89('0x2a')](handleError(_0x2ca4dc,null));};exports[_0x5f89('0x54')]=function(_0x4211e1,_0x10a192){var _0x1574cc={'raw':![],'where':{'id':_0x4211e1[_0x5f89('0x55')]['id']},'include':[{'model':db[_0x5f89('0x3c')],'as':_0x5f89('0x3d')}]},_0x5b5976={};_0x5b5976[_0x5f89('0x40')]=_['keys'](db[_0x5f89('0x50')][_0x5f89('0x56')]);_0x5b5976['query']=_[_0x5f89('0x57')](_0x4211e1[_0x5f89('0x41')]);_0x5b5976['filters']=_[_0x5f89('0x43')](_0x5b5976[_0x5f89('0x40')],_0x5b5976[_0x5f89('0x41')]);_0x1574cc[_0x5f89('0x44')]=_[_0x5f89('0x43')](_0x5b5976[_0x5f89('0x40')],qs[_0x5f89('0x45')](_0x4211e1[_0x5f89('0x41')][_0x5f89('0x45')]));_0x1574cc[_0x5f89('0x44')]=_0x1574cc[_0x5f89('0x44')][_0x5f89('0x58')]?_0x1574cc['attributes']:_0x5b5976[_0x5f89('0x40')];if(_0x4211e1[_0x5f89('0x41')]['includeAll']){_0x1574cc['include']=[{'all':!![]}];}_0x1574cc=_[_0x5f89('0x4e')]({},_0x1574cc,_0x4211e1['options']);return db['SmsAccount'][_0x5f89('0x59')](_0x1574cc)[_0x5f89('0x1f')](handleEntityNotFound(_0x10a192,null))[_0x5f89('0x1f')](respondWithResult(_0x10a192,null))[_0x5f89('0x2a')](handleError(_0x10a192,null));};exports['create']=function(_0x1a2d1d,_0x4b9de8){return db['SmsAccount'][_0x5f89('0x5a')](_0x1a2d1d[_0x5f89('0x5b')],{})[_0x5f89('0x1f')](function(_0xdb5b5e){var _0x422465=_0x1a2d1d[_0x5f89('0x5c')][_0x5f89('0x35')]({'plain':!![]});if(!_0x422465)throw new Error(_0x5f89('0x5d'));if(_0x422465[_0x5f89('0x5e')]===_0x5f89('0x5c')){var _0x3b51ae=_0xdb5b5e['get']({'plain':!![]});var _0x1bcac9='SmsAccounts';return db['UserProfileSection'][_0x5f89('0x59')]({'where':{'name':_0x1bcac9,'userProfileId':_0x422465[_0x5f89('0x5f')]},'raw':!![]})[_0x5f89('0x1f')](function(_0x3b4616){if(_0x3b4616&&_0x3b4616[_0x5f89('0x60')]===0x0){return db[_0x5f89('0x37')][_0x5f89('0x5a')]({'name':_0x3b51ae[_0x5f89('0x3a')],'resourceId':_0x3b51ae['id'],'type':_0x3b4616[_0x5f89('0x3a')],'sectionId':_0x3b4616['id']},{})[_0x5f89('0x1f')](function(){return _0xdb5b5e;});}else{return _0xdb5b5e;}})[_0x5f89('0x2a')](function(_0x1e1259){logger[_0x5f89('0x26')](_0x5f89('0x61'),_0x1e1259);throw _0x1e1259;});}return _0xdb5b5e;})[_0x5f89('0x1f')](respondWithResult(_0x4b9de8,0xc9))[_0x5f89('0x2a')](handleError(_0x4b9de8,null));};exports[_0x5f89('0x34')]=function(_0x30326c,_0x807fa2){if(_0x30326c['body']['id']){delete _0x30326c[_0x5f89('0x5b')]['id'];}return db['SmsAccount'][_0x5f89('0x59')]({'where':{'id':_0x30326c[_0x5f89('0x55')]['id']},'include':[{'model':db[_0x5f89('0x3c')],'as':_0x5f89('0x3d')}]})[_0x5f89('0x1f')](handleEntityNotFound(_0x807fa2,null))[_0x5f89('0x1f')](saveUpdates(_0x30326c['body'],null))[_0x5f89('0x1f')](respondWithResult(_0x807fa2,null))[_0x5f89('0x2a')](handleError(_0x807fa2,null));};exports[_0x5f89('0x38')]=function(_0x3e96bb,_0x573ebe){return db[_0x5f89('0x50')][_0x5f89('0x59')]({'where':{'id':_0x3e96bb[_0x5f89('0x55')]['id']}})[_0x5f89('0x1f')](handleEntityNotFound(_0x573ebe,null))[_0x5f89('0x1f')](removeEntity(_0x573ebe,null))[_0x5f89('0x2a')](handleError(_0x573ebe,null));};exports[_0x5f89('0x62')]=function(_0x1f6719,_0x662acc){return db[_0x5f89('0x50')][_0x5f89('0x62')]()[_0x5f89('0x1f')](respondWithResult(_0x662acc,null))[_0x5f89('0x2a')](handleError(_0x662acc,null));};exports['addDisposition']=function(_0x35b150,_0x29fe59,_0x47ec66){if(_0x35b150['body']['id']){delete _0x35b150[_0x5f89('0x5b')]['id'];}return db[_0x5f89('0x50')][_0x5f89('0x59')]({'where':{'id':_0x35b150[_0x5f89('0x55')]['id']}})[_0x5f89('0x1f')](handleEntityNotFound(_0x29fe59,null))[_0x5f89('0x1f')](function(_0x28ecc7){if(_0x28ecc7){_0x35b150[_0x5f89('0x5b')]['SmsAccountId']=_0x28ecc7['id'];return db[_0x5f89('0x63')][_0x5f89('0x5a')](_0x35b150['body']);}})[_0x5f89('0x1f')](respondWithResult(_0x29fe59,null))[_0x5f89('0x2a')](handleError(_0x29fe59,null));};exports[_0x5f89('0x64')]=function(_0x326373,_0x99c2f0,_0x41bd0b){var _0x204ff9={'raw':![],'where':{}};var _0x49b38a={};var _0x5daf13={'count':0x0,'rows':[]};return db[_0x5f89('0x50')][_0x5f89('0x65')]({'where':{'id':_0x326373[_0x5f89('0x55')]['id']}})[_0x5f89('0x1f')](handleEntityNotFound(_0x99c2f0,null))[_0x5f89('0x1f')](function(_0x5290a5){if(_0x5290a5){_0x49b38a[_0x5f89('0x40')]=_[_0x5f89('0x57')](db[_0x5f89('0x63')][_0x5f89('0x56')]);_0x49b38a[_0x5f89('0x41')]=_[_0x5f89('0x57')](_0x326373[_0x5f89('0x41')]);_0x49b38a[_0x5f89('0x42')]=_[_0x5f89('0x43')](_0x49b38a[_0x5f89('0x40')],_0x49b38a[_0x5f89('0x41')]);_0x204ff9[_0x5f89('0x44')]=_[_0x5f89('0x43')](_0x49b38a['model'],qs[_0x5f89('0x45')](_0x326373[_0x5f89('0x41')][_0x5f89('0x45')]));_0x204ff9[_0x5f89('0x44')]=_0x204ff9[_0x5f89('0x44')]['length']?_0x204ff9['attributes']:_0x49b38a['model'];if(!_0x326373[_0x5f89('0x41')][_0x5f89('0x46')](_0x5f89('0x66'))){_0x204ff9['limit']=qs[_0x5f89('0x2f')](_0x326373[_0x5f89('0x41')][_0x5f89('0x2f')]);_0x204ff9['offset']=qs[_0x5f89('0x2d')](_0x326373[_0x5f89('0x41')][_0x5f89('0x2d')]);}_0x204ff9[_0x5f89('0x47')]=qs[_0x5f89('0x48')](_0x326373[_0x5f89('0x41')][_0x5f89('0x48')]);_0x204ff9[_0x5f89('0x49')]=qs['filters'](_[_0x5f89('0x4a')](_0x326373[_0x5f89('0x41')],_0x49b38a['filters']));_0x204ff9[_0x5f89('0x49')][_0x5f89('0x67')]=_0x5290a5['id'];if(_0x326373[_0x5f89('0x41')][_0x5f89('0x4b')]){_0x204ff9[_0x5f89('0x49')]=_[_0x5f89('0x4e')](_0x204ff9[_0x5f89('0x49')],{'$or':_['map'](_0x204ff9['attributes'],function(_0x34cdcb){var _0x56e2ef={};_0x56e2ef[_0x34cdcb]={'$like':'%'+_0x326373[_0x5f89('0x41')][_0x5f89('0x4b')]+'%'};return _0x56e2ef;})});}_0x204ff9=_[_0x5f89('0x4e')]({},_0x204ff9,_0x326373[_0x5f89('0x4f')]);return db['Disposition']['count']({'where':_0x204ff9['where']})[_0x5f89('0x1f')](function(_0x75cdae){_0x5daf13[_0x5f89('0x30')]=_0x75cdae;if(_0x326373[_0x5f89('0x41')][_0x5f89('0x51')]){_0x204ff9[_0x5f89('0x52')]=[{'all':!![]}];}return db[_0x5f89('0x63')][_0x5f89('0x68')](_0x204ff9);})[_0x5f89('0x1f')](function(_0x90762d){_0x5daf13[_0x5f89('0x53')]=_0x90762d;return _0x5daf13;});}})[_0x5f89('0x1f')](respondWithFilteredResult(_0x99c2f0,_0x204ff9))[_0x5f89('0x2a')](handleError(_0x99c2f0,null));};exports[_0x5f89('0x69')]=function(_0x1826d8,_0x2274b3,_0x54560a){return db[_0x5f89('0x50')]['find']({'where':{'id':_0x1826d8[_0x5f89('0x55')]['id']}})[_0x5f89('0x1f')](handleEntityNotFound(_0x2274b3,null))['then'](function(_0x5102b1){if(_0x5102b1){return _0x5102b1[_0x5f89('0x69')](_0x1826d8[_0x5f89('0x41')][_0x5f89('0x6a')]);}})[_0x5f89('0x1f')](respondWithStatusCode(_0x2274b3,null))[_0x5f89('0x2a')](handleError(_0x2274b3,null));};exports[_0x5f89('0x6b')]=function(_0x480360,_0x9a58db,_0x5d51e9){if(_0x480360[_0x5f89('0x5b')]['id']){delete _0x480360[_0x5f89('0x5b')]['id'];}return db['SmsAccount'][_0x5f89('0x59')]({'where':{'id':_0x480360[_0x5f89('0x55')]['id']}})[_0x5f89('0x1f')](handleEntityNotFound(_0x9a58db,null))[_0x5f89('0x1f')](function(_0x13040b){if(_0x13040b){_0x480360[_0x5f89('0x5b')]['SmsAccountId']=_0x13040b['id'];return db['CannedAnswer'][_0x5f89('0x5a')](_0x480360[_0x5f89('0x5b')]);}})[_0x5f89('0x1f')](respondWithResult(_0x9a58db,null))[_0x5f89('0x2a')](handleError(_0x9a58db,null));};exports[_0x5f89('0x6c')]=function(_0x136648,_0x55fb0d,_0x4c7067){var _0x7b102c={'raw':![],'where':{}};var _0xfc6faf={};var _0xf6e440={'count':0x0,'rows':[]};return db[_0x5f89('0x50')][_0x5f89('0x65')]({'where':{'id':_0x136648[_0x5f89('0x55')]['id']}})[_0x5f89('0x1f')](handleEntityNotFound(_0x55fb0d,null))[_0x5f89('0x1f')](function(_0x67c7ad){if(_0x67c7ad){_0xfc6faf[_0x5f89('0x40')]=_[_0x5f89('0x57')](db[_0x5f89('0x6d')][_0x5f89('0x56')]);_0xfc6faf[_0x5f89('0x41')]=_[_0x5f89('0x57')](_0x136648[_0x5f89('0x41')]);_0xfc6faf[_0x5f89('0x42')]=_[_0x5f89('0x43')](_0xfc6faf[_0x5f89('0x40')],_0xfc6faf[_0x5f89('0x41')]);_0x7b102c[_0x5f89('0x44')]=_[_0x5f89('0x43')](_0xfc6faf[_0x5f89('0x40')],qs[_0x5f89('0x45')](_0x136648[_0x5f89('0x41')]['fields']));_0x7b102c['attributes']=_0x7b102c[_0x5f89('0x44')][_0x5f89('0x58')]?_0x7b102c[_0x5f89('0x44')]:_0xfc6faf[_0x5f89('0x40')];if(!_0x136648[_0x5f89('0x41')][_0x5f89('0x46')](_0x5f89('0x66'))){_0x7b102c[_0x5f89('0x2f')]=qs[_0x5f89('0x2f')](_0x136648[_0x5f89('0x41')][_0x5f89('0x2f')]);_0x7b102c[_0x5f89('0x2d')]=qs[_0x5f89('0x2d')](_0x136648[_0x5f89('0x41')][_0x5f89('0x2d')]);}_0x7b102c[_0x5f89('0x47')]=qs['sort'](_0x136648[_0x5f89('0x41')]['sort']);_0x7b102c[_0x5f89('0x49')]=qs['filters'](_[_0x5f89('0x4a')](_0x136648[_0x5f89('0x41')],_0xfc6faf[_0x5f89('0x42')]));_0x7b102c[_0x5f89('0x49')]['SmsAccountId']=_0x67c7ad['id'];if(_0x136648[_0x5f89('0x41')][_0x5f89('0x4b')]){_0x7b102c[_0x5f89('0x49')]=_[_0x5f89('0x4e')](_0x7b102c[_0x5f89('0x49')],{'$or':_[_0x5f89('0x4c')](_0x7b102c['attributes'],function(_0x52ed39){var _0x655450={};_0x655450[_0x52ed39]={'$like':'%'+_0x136648['query'][_0x5f89('0x4b')]+'%'};return _0x655450;})});}_0x7b102c=_[_0x5f89('0x4e')]({},_0x7b102c,_0x136648[_0x5f89('0x4f')]);return db[_0x5f89('0x6d')][_0x5f89('0x30')]({'where':_0x7b102c['where']})[_0x5f89('0x1f')](function(_0x2b6eb){_0xf6e440[_0x5f89('0x30')]=_0x2b6eb;if(_0x136648[_0x5f89('0x41')]['includeAll']){_0x7b102c[_0x5f89('0x52')]=[{'all':!![]}];}return db[_0x5f89('0x6d')]['findAll'](_0x7b102c);})[_0x5f89('0x1f')](function(_0x388962){_0xf6e440[_0x5f89('0x53')]=_0x388962;return _0xf6e440;});}})[_0x5f89('0x1f')](respondWithFilteredResult(_0x55fb0d,_0x7b102c))[_0x5f89('0x2a')](handleError(_0x55fb0d,null));};exports[_0x5f89('0x6e')]=function(_0x4c4236,_0x506bee,_0xaec02c){return db['SmsAccount'][_0x5f89('0x59')]({'where':{'id':_0x4c4236[_0x5f89('0x55')]['id']}})[_0x5f89('0x1f')](handleEntityNotFound(_0x506bee,null))[_0x5f89('0x1f')](function(_0x23bb57){if(_0x23bb57){return _0x23bb57[_0x5f89('0x6e')](_0x4c4236['query']['ids']);}})[_0x5f89('0x1f')](respondWithStatusCode(_0x506bee,null))[_0x5f89('0x2a')](handleError(_0x506bee,null));};exports[_0x5f89('0x6f')]=function(_0x568b96,_0x1d1cfa,_0x47d7d4){var _0x1e4daa={'channel':_0x5f89('0x70')};var _0x5558aa=[];var _0x30de1d=[];var _0x56bf45={};return db[_0x5f89('0x50')][_0x5f89('0x59')]({'where':{'id':_0x568b96[_0x5f89('0x55')]['id']},'include':[{'model':db[_0x5f89('0x71')],'as':_0x5f89('0x72')}]})[_0x5f89('0x1f')](handleEntityNotFound(_0x1d1cfa,null))[_0x5f89('0x1f')](function(_0x36db55){_0x1e4daa[_0x5f89('0x73')]=_0x36db55;_0x1e4daa['applications']=_[_0x5f89('0x74')](_0x36db55['Applications'],[_0x5f89('0x75')],[_0x5f89('0x76')]);if(_0x1e4daa[_0x5f89('0x73')][_0x5f89('0x72')]){delete _0x1e4daa['account']['Applications'];}return db[_0x5f89('0x77')][_0x5f89('0x62')]();})['then'](function(_0x18317c){if(!_0x18317c){throw new db[(_0x5f89('0x78'))][(_0x5f89('0x79'))]('no\x20available\x20attributes');}_0x5558aa=_[_0x5f89('0x7a')](_[_0x5f89('0x57')](_0x18317c),[_0x5f89('0x7b'),_0x5f89('0x7c')]);_0x30de1d=_[_0x5f89('0x7a')](_[_0x5f89('0x57')](_0x18317c),[_0x5f89('0x7b'),_0x5f89('0x7c'),_0x5f89('0x7d'),_0x5f89('0x7e')]);_0x1e4daa[_0x5f89('0x5b')]={'mapKey':_0x5f89('0x7f')};if(_0x1e4daa[_0x5f89('0x73')][_0x5f89('0x3f')]){switch(_0x1e4daa[_0x5f89('0x73')][_0x5f89('0x3f')]){case _0x5f89('0x80'):_0x1e4daa[_0x5f89('0x5b')][_0x5f89('0x81')]=_0x568b96[_0x5f89('0x5b')][_0x5f89('0x82')];_0x1e4daa[_0x5f89('0x5b')][_0x5f89('0x5b')]=_0x568b96[_0x5f89('0x5b')][_0x5f89('0x83')];_0x1e4daa[_0x5f89('0x5b')][_0x5f89('0x84')]=_0x568b96['body']['MessageSid'];break;case'skebby':_0x1e4daa[_0x5f89('0x5b')][_0x5f89('0x81')]='+'+_0x568b96[_0x5f89('0x5b')][_0x5f89('0x85')];_0x1e4daa[_0x5f89('0x5b')][_0x5f89('0x5b')]=_0x568b96[_0x5f89('0x5b')][_0x5f89('0x86')];break;case _0x5f89('0x87'):_0x1e4daa['body'][_0x5f89('0x81')]=_0x568b96[_0x5f89('0x5b')][_0x5f89('0x81')];_0x1e4daa[_0x5f89('0x5b')][_0x5f89('0x5b')]=_0x568b96[_0x5f89('0x5b')]['message'];break;case _0x5f89('0x88'):_0x1e4daa['body'][_0x5f89('0x81')]=_0x568b96['body'][_0x5f89('0x81')];_0x1e4daa[_0x5f89('0x5b')][_0x5f89('0x5b')]=_0x568b96[_0x5f89('0x5b')]['body'];_0x1e4daa['body'][_0x5f89('0x84')]=_0x568b96[_0x5f89('0x5b')][_0x5f89('0x89')];break;case _0x5f89('0x8a'):_0x1e4daa[_0x5f89('0x5b')][_0x5f89('0x81')]=_0x568b96[_0x5f89('0x5b')]['From'];_0x1e4daa['body'][_0x5f89('0x5b')]=_0x568b96[_0x5f89('0x5b')]['Text'];_0x1e4daa[_0x5f89('0x5b')][_0x5f89('0x84')]=_0x568b96[_0x5f89('0x5b')][_0x5f89('0x8b')];break;case'infobip':_0x1e4daa[_0x5f89('0x5b')]['from']='+'+_0x568b96[_0x5f89('0x5b')][_0x5f89('0x8c')][0x0][_0x5f89('0x81')];_0x1e4daa[_0x5f89('0x5b')][_0x5f89('0x5b')]=_0x568b96[_0x5f89('0x5b')]['results'][0x0]['text'];_0x1e4daa[_0x5f89('0x5b')][_0x5f89('0x84')]=_0x568b96['body'][_0x5f89('0x8c')][0x0][_0x5f89('0x84')];break;case'csc':_0x1e4daa[_0x5f89('0x5b')][_0x5f89('0x81')]=_0x568b96['body'][_0x5f89('0x8d')];_0x1e4daa[_0x5f89('0x5b')][_0x5f89('0x5b')]=_0x568b96['body']['segmentedMessage'][_0x5f89('0x28')];break;case _0x5f89('0x8e'):_0x1e4daa[_0x5f89('0x5b')][_0x5f89('0x81')]=_0x568b96[_0x5f89('0x5b')][_0x5f89('0x8f')];_0x1e4daa[_0x5f89('0x5b')]['body']=_0x568b96[_0x5f89('0x5b')][_0x5f89('0x86')];_0x1e4daa[_0x5f89('0x5b')]['messageId']=_0x568b96[_0x5f89('0x5b')][_0x5f89('0x90')];break;case _0x5f89('0x91'):_0x1e4daa[_0x5f89('0x5b')][_0x5f89('0x84')]=_0x568b96[_0x5f89('0x5b')][0x0]['message']['id'];_0x1e4daa[_0x5f89('0x5b')][_0x5f89('0x81')]=_0x568b96[_0x5f89('0x5b')][0x0][_0x5f89('0x28')][_0x5f89('0x81')];_0x1e4daa[_0x5f89('0x5b')]['body']=_0x568b96[_0x5f89('0x5b')][0x0][_0x5f89('0x28')][_0x5f89('0x86')];break;case _0x5f89('0x92'):_0x1e4daa['body']['from']=_0x568b96[_0x5f89('0x5b')]['from'];_0x1e4daa[_0x5f89('0x5b')]['body']=_0x568b96[_0x5f89('0x5b')][_0x5f89('0x28')];_0x1e4daa[_0x5f89('0x5b')][_0x5f89('0x84')]=_0x568b96[_0x5f89('0x5b')][_0x5f89('0x93')];break;}}if(_0x1e4daa[_0x5f89('0x5b')]['id']){delete _0x1e4daa['body']['id'];}if(_[_0x5f89('0x94')](_0x1e4daa[_0x5f89('0x5b')][_0x5f89('0x81')])){throw new db[(_0x5f89('0x78'))]['ValidationError'](_0x5f89('0x95'));}if(_['isNil'](_0x1e4daa['body'][_0x5f89('0x5b')])||_0x1e4daa['body']['body']===''){throw new db[(_0x5f89('0x78'))]['ValidationError'](_0x5f89('0x96'));}if(_['isNil'](_0x1e4daa[_0x5f89('0x5b')][_0x5f89('0x97')])){throw new db[(_0x5f89('0x78'))][(_0x5f89('0x79'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x30de1d);}if(!_[_0x5f89('0x98')](_0x30de1d,_0x1e4daa[_0x5f89('0x5b')][_0x5f89('0x97')])){throw new db['Sequelize']['ValidationError'](_0x5f89('0x99')+_0x30de1d);}_0x56bf45[_0x1e4daa[_0x5f89('0x5b')]['mapKey']]=_0x1e4daa[_0x5f89('0x5b')]['from'];return db[_0x5f89('0x9a')][_0x5f89('0x59')]({'where':{'id':_0x1e4daa[_0x5f89('0x73')]['ListId']},'include':[{'model':db[_0x5f89('0x77')],'as':_0x5f89('0x9b'),'where':_0x56bf45,'limit':0x1,'order':[['updatedAt',_0x5f89('0x9c')]]}]});})['then'](handleEntityNotFound(_0x1d1cfa,null))[_0x5f89('0x1f')](function(_0x4d921d){if(_0x4d921d){_0x1e4daa['list']=_['omit'](_0x4d921d,[_0x5f89('0x9b')]);if(_0x4d921d['Contacts']['length']){return _0x4d921d[_0x5f89('0x9b')][0x0];}var _0x4efab2=_[_0x5f89('0x17')](_0x1e4daa[_0x5f89('0x5b')],{'firstName':_0x1e4daa['body'][_0x5f89('0x81')],'ListId':_0x4d921d['id']});_0x4efab2[_0x1e4daa['body'][_0x5f89('0x97')]]=_0x1e4daa[_0x5f89('0x5b')][_0x5f89('0x81')];return db['CmContact'][_0x5f89('0x5a')](_0x4efab2,{'fields':_0x5558aa,'raw':!![]});}})[_0x5f89('0x1f')](handleEntityNotFound(_0x1d1cfa,null))[_0x5f89('0x1f')](function(_0xe0dacd){if(_0xe0dacd){_0x1e4daa[_0x5f89('0x9d')]=_0xe0dacd;var _0x4b88ea={'ContactId':_0xe0dacd['id'],'phone':_0x1e4daa[_0x5f89('0x5b')][_0x5f89('0x81')],'SmsAccountId':_0x568b96[_0x5f89('0x55')]['id']};var _0x550a58={'ContactId':_0xe0dacd['id'],'SmsAccountId':_0x568b96[_0x5f89('0x55')]['id'],'closed':![]};return db[_0x5f89('0x9e')]['find']({'where':_0x550a58})[_0x5f89('0x1f')](function(_0x4060e3){if(_0x4060e3){return[_0x4060e3,![]];}return db[_0x5f89('0x9e')][_0x5f89('0x5a')](_0x4b88ea)[_0x5f89('0x1f')](function(_0x41f401){return[_0x41f401,!![]];});});}})[_0x5f89('0x9f')](function(_0x2ad1b7,_0x60c51){_0x1e4daa[_0x5f89('0xa0')]=_0x2ad1b7[_0x5f89('0x35')]({'plain':!![]});_0x1e4daa[_0x5f89('0xa0')]['created']=![];if(_0x60c51){if(_0x1e4daa[_0x5f89('0x73')][_0x5f89('0xa1')]){_0x1e4daa[_0x5f89('0xa2')]['push']({'id':0x0,'priority':_0x1e4daa[_0x5f89('0xa2')][_0x5f89('0x58')]+0x1,'app':_0x5f89('0xa3'),'appdata':_0x5f89('0xa4'),'interval':_0x5f89('0xa5')});}_0x1e4daa[_0x5f89('0xa0')][_0x5f89('0xa6')]=!![];}return db['SmsMessage'][_0x5f89('0x5a')]({'phone':_0x1e4daa['body']['from'],'messageId':_0x1e4daa[_0x5f89('0x5b')][_0x5f89('0x84')],'body':_0x1e4daa[_0x5f89('0x5b')][_0x5f89('0x5b')],'SmsAccountId':_0x568b96['params']['id'],'SmsInteractionId':_0x2ad1b7['id'],'direction':'in','ContactId':_0x2ad1b7['ContactId'],'AttachmentId':_0x1e4daa[_0x5f89('0x5b')][_0x5f89('0xa7')]});})[_0x5f89('0x1f')](function(_0x25afd7){_0x1e4daa['message']=_0x25afd7;if(!_0x1e4daa[_0x5f89('0xa0')]['UserId'])return;return db['User']['find']({'attributes':['id',_0x5f89('0x3a')],'where':{'id':_0x1e4daa[_0x5f89('0xa0')]['UserId']}});})['then'](function(_0xaad7a8){if(_0xaad7a8){_0x1e4daa[_0x5f89('0xa2')][_0x5f89('0xa8')]({'id':0x0,'priority':0x0,'app':_0x5f89('0xa9'),'appdata':_0xaad7a8[_0x5f89('0x3a')]+','+(_0x1e4daa['account']['waitForTheAssignedAgent']||0xa),'interval':'*,*,*,*'});}if(!_0x1e4daa[_0x5f89('0xa0')][_0x5f89('0xaa')])return;return db[_0x5f89('0xab')][_0x5f89('0x59')]({'attributes':['id',_0x5f89('0x3a')],'where':{'id':_0x1e4daa[_0x5f89('0xa0')]['queueId']}});})[_0x5f89('0x1f')](function(_0x454a00){if(_0x454a00){_0x1e4daa['applications'][_0x5f89('0xa8')]({'id':0x0,'priority':0x1,'app':_0x5f89('0xac'),'appdata':_0x454a00[_0x5f89('0x3a')]+','+(_0x1e4daa[_0x5f89('0x73')][_0x5f89('0xad')]||0x12c),'interval':_0x5f89('0xa5')});}return respondWithRpcPromise(_0x5f89('0xae'),_0x5f89('0xaf'),_0x1e4daa);})[_0x5f89('0x1f')](function(_0x34ef5d){if(_0x34ef5d){var _0x190ab0=0xc8;var _0x10f566=_0x5f89('0xb0');logger[_0x5f89('0x20')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x10f566,_0x190ab0,_0x5f89('0xb1'));logger[_0x5f89('0x23')](_0x5f89('0xb2'),_0x10f566,_0x190ab0,_0x5f89('0xb1'),JSON[_0x5f89('0x25')](_0x34ef5d));if(_0x1e4daa['account'][_0x5f89('0x3f')]===_0x5f89('0x80')){return _0x1d1cfa[_0x5f89('0x2b')](_0x190ab0)[_0x5f89('0xb3')](_0x5f89('0xb4'),'text/xml')[_0x5f89('0x3b')]('\x0a');}else{return _0x1d1cfa['status'](_0x190ab0)[_0x5f89('0xb5')](_0x34ef5d);}}})[_0x5f89('0x2a')](handleError(_0x1d1cfa,null));};exports['addApplications']=function(_0x3fd285,_0x273096){var _0x4fabbb=_0x3fd285[_0x5f89('0x55')]['id'];var _0x3e7d0a=_0x3fd285[_0x5f89('0x5b')];var _0x458d92=0xc8;var _0x5270fe=null;return db[_0x5f89('0xb6')]['transaction']({'isolationLevel':db[_0x5f89('0xb6')]['Transaction'][_0x5f89('0xb7')]['READ_COMMITTED']},function(_0x3e5a06){return db['SmsAccount'][_0x5f89('0x65')]({'where':{'id':_0x4fabbb},'transaction':_0x3e5a06})[_0x5f89('0x1f')](function(_0x33cd08){if(_0x33cd08){return db[_0x5f89('0x71')][_0x5f89('0x38')]({'where':{'SmsAccountId':_0x4fabbb},'transaction':_0x3e5a06})[_0x5f89('0x1f')](function(){var _0x1dc9cb=_[_0x5f89('0x4c')](_0x3e7d0a,function(_0x2e187a){_0x2e187a[_0x5f89('0x67')]=_0x4fabbb;return _0x2e187a;});return db[_0x5f89('0x71')][_0x5f89('0xb8')](_0x1dc9cb,{'transaction':_0x3e5a06});});}else{_0x458d92=0x194;_0x5270fe=[];}});})[_0x5f89('0x1f')](function(){if(_0x458d92!==0x194){return db['SmsApplication']['findAndCountAll']({'where':{'SmsAccountId':_0x4fabbb},'order':_0x5f89('0x75')})[_0x5f89('0x1f')](function(_0x306856){_0x5270fe=_0x306856;});}})[_0x5f89('0x2a')](function(_0x1822fb){_0x458d92=0x1f4;logger[_0x5f89('0x26')](_0x1822fb['stack']);if(_0x1822fb[_0x5f89('0x3a')]){delete _0x1822fb[_0x5f89('0x3a')];}_0x5270fe=_0x1822fb;})[_0x5f89('0xb9')](function(){if(_0x5270fe===null){_0x273096[_0x5f89('0xba')](_0x458d92);}else{if(_0x458d92===0x1f4){_0x273096['status'](_0x458d92)[_0x5f89('0x3b')](_0x5270fe);}else{_0x273096[_0x5f89('0x2b')](_0x458d92)[_0x5f89('0xb5')](_0x5270fe);}}});};exports[_0x5f89('0xbb')]=function(_0x1cf5cd,_0x5e0c47,_0x2d4714){var _0x3849c5={};var _0x1ec839={};var _0x1a1288;var _0x3218fb;return db[_0x5f89('0x50')][_0x5f89('0x65')]({'where':{'id':_0x1cf5cd[_0x5f89('0x55')]['id']}})[_0x5f89('0x1f')](handleEntityNotFound(_0x5e0c47,null))[_0x5f89('0x1f')](function(_0x476d82){if(_0x476d82){_0x1a1288=_0x476d82;_0x1ec839['model']=_[_0x5f89('0x57')](db['SmsApplication'][_0x5f89('0x56')]);_0x1ec839[_0x5f89('0x41')]=_[_0x5f89('0x57')](_0x1cf5cd[_0x5f89('0x41')]);_0x1ec839[_0x5f89('0x42')]=_[_0x5f89('0x43')](_0x1ec839[_0x5f89('0x40')],_0x1ec839[_0x5f89('0x41')]);_0x3849c5['attributes']=_[_0x5f89('0x43')](_0x1ec839[_0x5f89('0x40')],qs['fields'](_0x1cf5cd['query'][_0x5f89('0x45')]));_0x3849c5[_0x5f89('0x44')]=_0x3849c5[_0x5f89('0x44')][_0x5f89('0x58')]?_0x3849c5['attributes']:_0x1ec839[_0x5f89('0x40')];_0x3849c5[_0x5f89('0x47')]=qs[_0x5f89('0x48')](_0x1cf5cd[_0x5f89('0x41')][_0x5f89('0x48')]);_0x3849c5[_0x5f89('0x49')]=qs[_0x5f89('0x42')](_['pick'](_0x1cf5cd[_0x5f89('0x41')],_0x1ec839[_0x5f89('0x42')]));if(_0x1cf5cd[_0x5f89('0x41')][_0x5f89('0x4b')]){_0x3849c5[_0x5f89('0x49')]=_['merge'](_0x3849c5['where'],{'$or':_['map'](_0x3849c5[_0x5f89('0x44')],function(_0x53afc1){var _0xb1b880={};_0xb1b880[_0x53afc1]={'$like':'%'+_0x1cf5cd[_0x5f89('0x41')][_0x5f89('0x4b')]+'%'};return _0xb1b880;})});}_0x3849c5=_[_0x5f89('0x4e')]({},_0x3849c5,_0x1cf5cd['options']);return _0x1a1288[_0x5f89('0xbb')](_0x3849c5);}})[_0x5f89('0x1f')](function(_0x217157){if(_0x217157){_0x3218fb=_0x217157[_0x5f89('0x58')];if(!_0x1cf5cd[_0x5f89('0x41')][_0x5f89('0x46')](_0x5f89('0x66'))){_0x3849c5[_0x5f89('0x2f')]=qs[_0x5f89('0x2f')](_0x1cf5cd[_0x5f89('0x41')]['limit']);_0x3849c5['offset']=qs[_0x5f89('0x2d')](_0x1cf5cd[_0x5f89('0x41')][_0x5f89('0x2d')]);}return _0x1a1288['getApplications'](_0x3849c5);}})[_0x5f89('0x1f')](function(_0x5aabe8){if(_0x5aabe8){return _0x5aabe8?{'count':_0x3218fb,'rows':_0x5aabe8}:null;}})[_0x5f89('0x1f')](respondWithResult(_0x5e0c47,null))[_0x5f89('0x2a')](handleError(_0x5e0c47,null));};exports[_0x5f89('0xbc')]=function(_0x253bca,_0x546bcc,_0x57853e){var _0x3cffd3={'raw':![],'where':{}};var _0x1b7c8f={};var _0x2c217f={'count':0x0,'rows':[]};return db[_0x5f89('0x50')][_0x5f89('0x65')]({'where':{'id':_0x253bca['params']['id']}})[_0x5f89('0x1f')](handleEntityNotFound(_0x546bcc,null))['then'](function(_0x22043a){if(_0x22043a){_0x1b7c8f[_0x5f89('0x40')]=_[_0x5f89('0x57')](db[_0x5f89('0x9e')][_0x5f89('0x56')]);_0x1b7c8f[_0x5f89('0x41')]=_['keys'](_0x253bca[_0x5f89('0x41')]);_0x1b7c8f[_0x5f89('0x42')]=_[_0x5f89('0x43')](_0x1b7c8f['model'],_0x1b7c8f[_0x5f89('0x41')]);_0x3cffd3[_0x5f89('0x44')]=_[_0x5f89('0x43')](_0x1b7c8f['model'],qs[_0x5f89('0x45')](_0x253bca[_0x5f89('0x41')][_0x5f89('0x45')]));_0x3cffd3[_0x5f89('0x44')]=_0x3cffd3[_0x5f89('0x44')][_0x5f89('0x58')]?_0x3cffd3['attributes']:_0x1b7c8f[_0x5f89('0x40')];if(!_0x253bca[_0x5f89('0x41')]['hasOwnProperty'](_0x5f89('0x66'))){_0x3cffd3['limit']=qs[_0x5f89('0x2f')](_0x253bca[_0x5f89('0x41')][_0x5f89('0x2f')]);_0x3cffd3['offset']=qs[_0x5f89('0x2d')](_0x253bca[_0x5f89('0x41')][_0x5f89('0x2d')]);}_0x3cffd3[_0x5f89('0x47')]=qs[_0x5f89('0x48')](_0x253bca[_0x5f89('0x41')]['sort']);_0x3cffd3[_0x5f89('0x49')]=qs[_0x5f89('0x42')](_[_0x5f89('0x4a')](_0x253bca[_0x5f89('0x41')],_0x1b7c8f[_0x5f89('0x42')]));_0x3cffd3[_0x5f89('0x49')]['SmsAccountId']=_0x22043a['id'];if(_0x253bca[_0x5f89('0x41')][_0x5f89('0x4b')]){_0x3cffd3[_0x5f89('0x49')]=_[_0x5f89('0x4e')](_0x3cffd3[_0x5f89('0x49')],{'$or':_['map'](_0x3cffd3[_0x5f89('0x44')],function(_0x93e914){var _0x3687c4={};_0x3687c4[_0x93e914]={'$like':'%'+_0x253bca[_0x5f89('0x41')]['filter']+'%'};return _0x3687c4;})});}_0x3cffd3=_[_0x5f89('0x4e')]({},_0x3cffd3,_0x253bca[_0x5f89('0x4f')]);return db[_0x5f89('0x9e')][_0x5f89('0x30')]({'where':_0x3cffd3[_0x5f89('0x49')]})[_0x5f89('0x1f')](function(_0x4a0b51){_0x2c217f['count']=_0x4a0b51;if(_0x253bca[_0x5f89('0x41')]['includeAll']){_0x3cffd3['include']=[{'model':db['CmContact'],'as':'Contact','required':![]},{'model':db[_0x5f89('0xbd')],'as':_0x5f89('0xbe'),'attributes':[_0x5f89('0x3a'),'fullname',_0x5f89('0xbf')],'required':![]},{'model':db['Tag'],'as':_0x5f89('0xc0'),'attributes':['id',_0x5f89('0x3a'),_0x5f89('0xc1')],'where':_0x253bca[_0x5f89('0x41')][_0x5f89('0xc2')]?{'id':_0x253bca[_0x5f89('0x41')]['tag']}:undefined,'required':_0x253bca[_0x5f89('0x41')][_0x5f89('0xc2')]?!![]:![]}];}return db[_0x5f89('0x9e')]['findAll'](_0x3cffd3);})[_0x5f89('0x1f')](function(_0x571247){_0x2c217f[_0x5f89('0x53')]=_0x571247;return _0x2c217f;});}})[_0x5f89('0x1f')](respondWithFilteredResult(_0x546bcc,_0x3cffd3))[_0x5f89('0x2a')](handleError(_0x546bcc,null));};exports['send']=function(_0xe67692,_0x3ef2f8,_0x157d32){var _0x16a051,_0x203cc1,_0x1a660e;if(_[_0x5f89('0x94')](_0xe67692[_0x5f89('0x5b')][_0x5f89('0x5b')])||_0xe67692[_0x5f89('0x5b')][_0x5f89('0x5b')]===''){throw new db[(_0x5f89('0x78'))]['ValidationError'](_0x5f89('0x96'));}if(_[_0x5f89('0x94')](_0xe67692[_0x5f89('0x5b')]['to'])){throw new db[(_0x5f89('0x78'))][(_0x5f89('0x79'))](_0x5f89('0xc3'));}_0x16a051=_0xe67692[_0x5f89('0x5b')]['to'];return db['SmsAccount'][_0x5f89('0x59')]({'where':{'id':_0xe67692[_0x5f89('0x55')]['id']},'include':[{'model':db[_0x5f89('0x9a')],'as':_0x5f89('0xc4'),'include':[{'model':db[_0x5f89('0x77')],'as':_0x5f89('0x9b'),'where':{'mobile':_0x16a051},'limit':0x1,'order':[[_0x5f89('0x7c'),_0x5f89('0x9c')]]}]}]})[_0x5f89('0x1f')](handleEntityNotFound(_0x3ef2f8,null))[_0x5f89('0x1f')](function(_0x4c9a3f){if(_0x4c9a3f&&_0x4c9a3f[_0x5f89('0xc4')]){_0x203cc1=_0x4c9a3f[_0x5f89('0x35')]({'plain':!![]});if(_0x203cc1[_0x5f89('0xc4')]&&_0x203cc1[_0x5f89('0xc4')][_0x5f89('0x9b')][_0x5f89('0x58')]){return _0x203cc1[_0x5f89('0xc4')][_0x5f89('0x9b')][0x0];}return db[_0x5f89('0x77')][_0x5f89('0x5a')](_[_0x5f89('0x17')](_0xe67692['body'],{'firstName':_0x16a051,'mobile':_0x16a051,'phone':_0x16a051,'ListId':_0x203cc1[_0x5f89('0x7e')]}));}})['then'](handleEntityNotFound(_0x3ef2f8,null))['then'](function(_0x5ec1d7){if(_0x5ec1d7){_0x1a660e=_0x5ec1d7;return db[_0x5f89('0x9e')]['find']({'where':{'ContactId':_0x1a660e['id'],'closed':![],'SmsAccountId':_0x203cc1['id']}})['then'](function(_0x509c08){if(_0x509c08){return[_0x509c08,![]];}return db['SmsInteraction']['create']({'UserId':_0xe67692[_0x5f89('0x5c')]['id'],'ContactId':_0x1a660e['id'],'SmsAccountId':_0x203cc1['id'],'phone':_0x16a051,'firstMsgDirection':_0x5f89('0xc5'),'Messages':[_[_0x5f89('0x4e')](_0xe67692[_0x5f89('0x5b')],{'read':![],'body':_0xe67692[_0x5f89('0x5b')][_0x5f89('0x5b')],'phone':_0x16a051,'SmsAccountId':_0x203cc1['id'],'UserId':_0xe67692['user']['id'],'ContactId':_0x1a660e['id']})]},{'include':[{'model':db[_0x5f89('0xc6')],'as':'Messages'}]})[_0x5f89('0x1f')](function(_0x120bc4){return[_0x120bc4,!![]];});});}})['spread'](function(_0x56a040,_0x50067c){if(_0x50067c){return _0x56a040;}return db[_0x5f89('0xc6')][_0x5f89('0x5a')](_[_0x5f89('0x4e')](_0xe67692[_0x5f89('0x5b')],{'read':![],'body':_0xe67692['body']['body'],'phone':_0x16a051,'SmsAccountId':_0x203cc1['id'],'SmsInteractionId':_0x56a040['id'],'UserId':_0xe67692['user']['id'],'ContactId':_0x1a660e['id']}))[_0x5f89('0x1f')](function(_0xaeb14c){_0x56a040[_0x5f89('0xc7')]['Messages']=[];_0x56a040[_0x5f89('0xc7')]['Messages']['push'](_0xaeb14c[_0x5f89('0xc7')]);return _0x56a040;});})[_0x5f89('0x1f')](respondWithResult(_0x3ef2f8,null))[_0x5f89('0x2a')](handleError(_0x3ef2f8,null));};exports['status']=function(_0x5ef092,_0x13e495,_0x39225a){if(_0x5ef092['body']['id']){delete _0x5ef092['body']['id'];}var _0x2c913b,_0x1bef39,_0x181f0f;return db[_0x5f89('0x50')]['find']({'where':{'id':_0x5ef092[_0x5f89('0x55')]['id']}})['then'](handleEntityNotFound(_0x13e495,null))['then'](function(_0xe7b8d6){if(_0xe7b8d6){_0x181f0f=_0xe7b8d6;logger[_0x5f89('0x23')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x5f89('0x2b'),'received\x20delivery\x20report\x20from',_0xe7b8d6[_0x5f89('0x3f')],util[_0x5f89('0xc8')](_0x5ef092['body'],{'showHidden':![],'depth':null}));switch(_0xe7b8d6['type']){case _0x5f89('0xc9'):if(_0x5ef092['body'][_0x5f89('0xca')]&&_0x5ef092['body'][_0x5f89('0x2b')]){_0x1bef39=_0x5ef092['body'][_0x5f89('0x2b')];return db[_0x5f89('0xc6')][_0x5f89('0x59')]({'where':{'messageId':_0x5ef092[_0x5f89('0x5b')]['skebby_dispatch_id']}});}break;case _0x5f89('0x87'):if(_0x5ef092[_0x5f89('0x5b')][_0x5f89('0xcb')]&&_0x5ef092[_0x5f89('0x5b')]['statusInt']){_0x1bef39=_0x5ef092[_0x5f89('0x5b')][_0x5f89('0xcc')];return db[_0x5f89('0xc6')]['find']({'where':{'messageId':_0x5ef092[_0x5f89('0x5b')][_0x5f89('0xcb')]}});}break;case'clicksend':if(_0x5ef092[_0x5f89('0x5b')][_0x5f89('0x89')]&&_0x5ef092[_0x5f89('0x5b')][_0x5f89('0xcd')]){_0x1bef39=_0x5ef092[_0x5f89('0x5b')][_0x5f89('0xcd')];return db['SmsMessage'][_0x5f89('0x59')]({'where':{'messageId':_0x5ef092[_0x5f89('0x5b')][_0x5f89('0x89')]}});}break;case _0x5f89('0xce'):var _0x15fefb=_0x5ef092[_0x5f89('0x5b')]['results'][0x0];if(_0x15fefb['messageId']&&_0x15fefb[_0x5f89('0x2b')][_0x5f89('0xcf')]==='DELIVERED'){_0x1bef39=_0x15fefb['status'][_0x5f89('0xcf')];return db['SmsMessage'][_0x5f89('0x59')]({'where':{'messageId':_0x15fefb[_0x5f89('0x84')]}});}break;case'clickatell':if(_0x5ef092[_0x5f89('0x5b')][_0x5f89('0x84')]&&_0x5ef092[_0x5f89('0x5b')][_0x5f89('0x2b')]){_0x1bef39=_0x5ef092[_0x5f89('0x5b')][_0x5f89('0x2b')];return db[_0x5f89('0xc6')][_0x5f89('0x59')]({'where':{'messageId':_0x5ef092['body'][_0x5f89('0x84')]}});}break;case _0x5f89('0x91'):if(_0x5ef092['body'][0x0][_0x5f89('0x28')]['id']){_0x1bef39=_0x5ef092[_0x5f89('0x5b')][0x0][_0x5f89('0x3f')];return db[_0x5f89('0xc6')][_0x5f89('0x59')]({'where':{'messageId':_0x5ef092[_0x5f89('0x5b')][0x0][_0x5f89('0x28')]['id']}});}break;case _0x5f89('0x92'):if(_0x5ef092['body'][_0x5f89('0xd0')]&&_0x5ef092['body'][_0x5f89('0x2b')]){_0x1bef39=_0x5ef092[_0x5f89('0x5b')][_0x5f89('0x2b')];return db[_0x5f89('0xc6')][_0x5f89('0x59')]({'where':{'messageId':_0x5ef092[_0x5f89('0x5b')][_0x5f89('0xd0')]}});}break;}}})[_0x5f89('0x1f')](handleEntityNotFound(_0x13e495,null))[_0x5f89('0x1f')](function(_0x486aac){if(_0x486aac){_0x2c913b=_0x486aac;switch(_0x181f0f[_0x5f89('0x3f')]){case _0x5f89('0xc9'):if(_0x1bef39==='DELIVERED'){return _0x2c913b[_0x5f89('0x34')]({'read':!![]});}else{logger[_0x5f89('0x26')](_0x5f89('0x24'),_0x5f89('0x2b'),_0x5f89('0xc9'),util['inspect'](_0x5ef092[_0x5f89('0x5b')],{'showHidden':![],'depth':null}));}break;case _0x5f89('0x87'):if(_0x1bef39==='1'){return _0x2c913b[_0x5f89('0x34')]({'read':!![]});}else{logger[_0x5f89('0x26')](_0x5f89('0x24'),_0x5f89('0x2b'),'skebby',util[_0x5f89('0xc8')](_0x5ef092[_0x5f89('0x5b')],{'showHidden':![],'depth':null}));}break;case _0x5f89('0x88'):if(!_0x5ef092[_0x5f89('0x5b')][_0x5f89('0xd1')]&&_0x1bef39>=0xc8&&_0x1bef39<=0xce){return _0x2c913b[_0x5f89('0x34')]({'read':!![]});}else{logger[_0x5f89('0x26')](_0x5f89('0x24'),_0x5f89('0x2b'),_0x5f89('0x88'),util[_0x5f89('0xc8')](_0x5ef092[_0x5f89('0x5b')],{'showHidden':![],'depth':null}));}break;case _0x5f89('0xce'):var _0x3d137c=_0x5ef092[_0x5f89('0x5b')]['results'][0x0];if(_0x3d137c[_0x5f89('0x2b')][_0x5f89('0xcf')]==='DELIVERED'){return _0x2c913b[_0x5f89('0x34')]({'read':!![]});}else{logger[_0x5f89('0x26')](_0x5f89('0x24'),_0x5f89('0x2b'),_0x5f89('0xce'),util[_0x5f89('0xc8')](_0x5ef092[_0x5f89('0x5b')],{'showHidden':![],'depth':null}));}break;case _0x5f89('0x8e'):if(_0x1bef39==_0x5f89('0xd2')||_0x1bef39==_0x5f89('0xd3')){return _0x2c913b['update']({'read':!![]});}else{logger['error'](_0x5f89('0x24'),_0x5f89('0x2b'),_0x5f89('0x8e'),util[_0x5f89('0xc8')](_0x5ef092[_0x5f89('0x5b')],{'showHidden':![],'depth':null}));}break;case'bandwidth':if(_0x1bef39==_0x5f89('0xd4')){return _0x2c913b['update']({'read':!![]});}else{logger[_0x5f89('0x26')](_0x5f89('0x24'),'status','bandwidth',util['inspect'](_0x5ef092[_0x5f89('0x5b')],{'showHidden':![],'depth':null}));}break;case'intelepeer':if(_0x1bef39===_0x5f89('0xd5')||_0x1bef39==='ACCEPTD'){return _0x2c913b[_0x5f89('0x34')]({'read':!![]});}else{logger[_0x5f89('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x5f89('0x2b'),_0x5f89('0x92'),util[_0x5f89('0xc8')](_0x5ef092[_0x5f89('0x5b')],{'showHidden':![],'depth':null}));}break;}return _0x2c913b;}})['then'](respondWithResult(_0x13e495,null))[_0x5f89('0x2a')](handleError(_0x13e495,null));};exports[_0x5f89('0xd6')]=function(_0x1b9fd2,_0x23cdde,_0x4035a3){var _0x4d701d,_0x5f1c02,_0x21123f;return db[_0x5f89('0x50')][_0x5f89('0x59')]({'where':{'id':_0x1b9fd2['params']['id']}})[_0x5f89('0x1f')](handleEntityNotFound(_0x23cdde,null))[_0x5f89('0x1f')](function(_0x531e72){if(_0x531e72){_0x21123f=_0x531e72;logger[_0x5f89('0x23')]('SmsAccount,\x20%s,\x20%s,\x20%s','status','received\x20delivery\x20report\x20from',_0x531e72['type'],util[_0x5f89('0xc8')](_0x1b9fd2[_0x5f89('0x41')],{'showHidden':![],'depth':null}));switch(_0x531e72['type']){case _0x5f89('0xd7'):if(_0x1b9fd2[_0x5f89('0x41')][_0x5f89('0xd8')]&&_0x1b9fd2[_0x5f89('0x41')]['state']){_0x5f1c02=_0x1b9fd2[_0x5f89('0x41')][_0x5f89('0xd9')];return db[_0x5f89('0xc6')][_0x5f89('0x59')]({'where':{'messageId':_0x1b9fd2[_0x5f89('0x41')][_0x5f89('0xd8')]}});}break;}}})[_0x5f89('0x1f')](handleEntityNotFound(_0x23cdde,null))[_0x5f89('0x1f')](function(_0xd7ff60){if(_0xd7ff60){_0x4d701d=_0xd7ff60;switch(_0x21123f[_0x5f89('0x3f')]){case _0x5f89('0xd7'):if(_0x5f1c02==='2'||_0x5f1c02==='6'){return _0x4d701d['update']({'read':!![]});}else{logger['error'](_0x5f89('0x24'),_0x5f89('0x2b'),_0x5f89('0xd7'),util['inspect'](_0x1b9fd2[_0x5f89('0x41')],{'showHidden':![],'depth':null}));};break;}return _0x4d701d;}})[_0x5f89('0x1f')](respondWithResult(_0x23cdde,null))[_0x5f89('0x2a')](handleError(_0x23cdde,null));};exports[_0x5f89('0xda')]=function(_0x7b6df1,_0x56d909,_0x5c0899){return db[_0x5f89('0x50')][_0x5f89('0x59')]({'where':{'id':_0x7b6df1[_0x5f89('0x55')]['id']}})[_0x5f89('0x1f')](handleEntityNotFound(_0x56d909,null))['then'](function(_0x59c604){if(_0x59c604){return _0x59c604[_0x5f89('0xda')](_0x7b6df1[_0x5f89('0x5b')]['ids'],_['omit'](_0x7b6df1['body'],['ids','id'])||{})[_0x5f89('0x9f')](function(_0x46e778){for(var _0xf5d715=0x0;_0xf5d715<_0x7b6df1[_0x5f89('0x5b')][_0x5f89('0x6a')]['length'];_0xf5d715+=0x1){socket[_0x5f89('0xdb')]('userSmsAccount:save',{'UserId':Number(_0x7b6df1['body'][_0x5f89('0x6a')][_0xf5d715]),'SmsAccountId':Number(_0x7b6df1[_0x5f89('0x55')]['id'])});}return _0x46e778;});}})[_0x5f89('0x1f')](respondWithResult(_0x56d909,null))[_0x5f89('0x2a')](handleError(_0x56d909,null));};exports['removeAgents']=function(_0x28c4e7,_0x194ec8,_0x369e6d){return db['SmsAccount'][_0x5f89('0x59')]({'where':{'id':_0x28c4e7['params']['id']}})[_0x5f89('0x1f')](handleEntityNotFound(_0x194ec8,null))[_0x5f89('0x1f')](function(_0x2539a6){if(_0x2539a6){return _0x2539a6['removeAgents'](_0x28c4e7[_0x5f89('0x41')]['ids'])[_0x5f89('0x1f')](function(){if(_[_0x5f89('0xdc')](_0x28c4e7[_0x5f89('0x41')]['ids'])){for(var _0x1637eb=0x0;_0x1637eb<_0x28c4e7[_0x5f89('0x41')][_0x5f89('0x6a')]['length'];_0x1637eb+=0x1){socket[_0x5f89('0xdb')](_0x5f89('0xdd'),{'UserId':Number(_0x28c4e7[_0x5f89('0x41')]['ids'][_0x1637eb]),'SmsAccountId':Number(_0x28c4e7[_0x5f89('0x55')]['id'])});}}else{socket['emit']('userSmsAccount:remove',{'UserId':Number(_0x28c4e7['query'][_0x5f89('0x6a')]),'SmsAccountId':Number(_0x28c4e7[_0x5f89('0x55')]['id'])});}});}})[_0x5f89('0x1f')](respondWithStatusCode(_0x194ec8,null))[_0x5f89('0x2a')](handleError(_0x194ec8,null));};exports[_0x5f89('0xde')]=function(_0x1953a2,_0x3a33a2,_0x368561){var _0x52de1b={};var _0x7c2dcc={};var _0x2cc819;var _0x309ba5;return db[_0x5f89('0x50')]['findOne']({'where':{'id':_0x1953a2[_0x5f89('0x55')]['id']}})[_0x5f89('0x1f')](handleEntityNotFound(_0x3a33a2,null))[_0x5f89('0x1f')](function(_0xcaf313){if(_0xcaf313){_0x2cc819=_0xcaf313;_0x7c2dcc['model']=_[_0x5f89('0x57')](db['User'][_0x5f89('0x56')]);_0x7c2dcc['query']=_['keys'](_0x1953a2[_0x5f89('0x41')]);_0x7c2dcc[_0x5f89('0x42')]=_[_0x5f89('0x43')](_0x7c2dcc[_0x5f89('0x40')],_0x7c2dcc[_0x5f89('0x41')]);_0x52de1b[_0x5f89('0x44')]=_[_0x5f89('0x43')](_0x7c2dcc[_0x5f89('0x40')],qs['fields'](_0x1953a2[_0x5f89('0x41')][_0x5f89('0x45')]));_0x52de1b[_0x5f89('0x44')]=_0x52de1b[_0x5f89('0x44')]['length']?_0x52de1b[_0x5f89('0x44')]:_0x7c2dcc[_0x5f89('0x40')];_0x52de1b[_0x5f89('0x47')]=qs[_0x5f89('0x48')](_0x1953a2[_0x5f89('0x41')]['sort']);_0x52de1b[_0x5f89('0x49')]=qs['filters'](_['pick'](_0x1953a2[_0x5f89('0x41')],_0x7c2dcc[_0x5f89('0x42')]));if(_0x1953a2[_0x5f89('0x41')][_0x5f89('0x4b')]){_0x52de1b['where']=_[_0x5f89('0x4e')](_0x52de1b[_0x5f89('0x49')],{'$or':_['map'](_0x52de1b['attributes'],function(_0xfa610e){var _0x3340bc={};_0x3340bc[_0xfa610e]={'$like':'%'+_0x1953a2['query'][_0x5f89('0x4b')]+'%'};return _0x3340bc;})});}_0x52de1b=_[_0x5f89('0x4e')]({},_0x52de1b,_0x1953a2['options']);return _0x2cc819[_0x5f89('0xde')](_0x52de1b);}})[_0x5f89('0x1f')](function(_0x508c13){if(_0x508c13){_0x309ba5=_0x508c13[_0x5f89('0x58')];if(!_0x1953a2[_0x5f89('0x41')][_0x5f89('0x46')]('nolimit')){_0x52de1b['limit']=qs['limit'](_0x1953a2[_0x5f89('0x41')]['limit']);_0x52de1b[_0x5f89('0x2d')]=qs[_0x5f89('0x2d')](_0x1953a2[_0x5f89('0x41')][_0x5f89('0x2d')]);}return _0x2cc819[_0x5f89('0xde')](_0x52de1b);}})[_0x5f89('0x1f')](function(_0x2a3438){if(_0x2a3438){return _0x2a3438?{'count':_0x309ba5,'rows':_0x2a3438}:null;}})[_0x5f89('0x1f')](respondWithResult(_0x3a33a2,null))[_0x5f89('0x2a')](handleError(_0x3a33a2,null));}; \ No newline at end of file +var _0xbbb0=['connectel','clicksend','message_id','plivo','Text','MessageUUID','infobip','results','csc','originatingAddress','segmentedMessage','fromNumber','replyMessageId','intelepeer','refid','Sequelize','from\x20is\x20mandatory','isNil','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','updatedAt','DESC','list','omit','contact','spread','interaction','applications','close','unmanaged','*,*,*,*','created','SmsMessage','ContactId','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','queueId','SmsQueue','queue','waitForTheAssignedQueue','Start','startRouting','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','stringify','set','Content-Type','text/xml','\x0a','sequelize','ISOLATION_LEVELS','READ_COMMITTED','SmsApplication','getApplications','hasOwnProperty','getInteractions','SmsInteraction','Owner','internal','Tag','Tags','tag','List','Messages','dataValues','push','skebby_dispatch_id','requestid','statusInt','status_code','groupName','DELIVERED','bandwidth','redif','inspect','clickatell','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','ACCEPTD','statusGet','received\x20delivery\x20report\x20from','state','addAgents','emit','removeAgents','isArray','userSmsAccount:remove','getAgents','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','register','jayson/promise','client','http','request','info','SmsAccount,\x20%s,\x20%s','debug','SmsAccount,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','catch','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','destroy','get','then','stack','name','send','index','Pause','map','SmsAccount','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','includeAll','include','findAll','show','params','mandatoryDispositionPause','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','SmsAccountId','findOne','pick','options','Disposition','rows','removeDispositions','ids','CannedAnswer','removeAnswers','notify','sms','Applications','account','orderBy','priority','asc','CmContact','ValidationError','no\x20available\x20attributes','createdAt','difference','CompanyId','ListId','mobile','from','From','messageId','MessageSid','skebby','sender','text'];(function(_0x205c11,_0x941d3d){var _0x550e7b=function(_0x8b0263){while(--_0x8b0263){_0x205c11['push'](_0x205c11['shift']());}};_0x550e7b(++_0x941d3d);}(_0xbbb0,0x140));var _0x0bbb=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0xbbb0[_0x2d8fc2];return _0x3a9e53;};'use strict';var emlformat=require(_0x0bbb('0x0'));var rimraf=require(_0x0bbb('0x1'));var zipdir=require(_0x0bbb('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0bbb('0x3'));var moment=require(_0x0bbb('0x4'));var BPromise=require(_0x0bbb('0x5'));var Mustache=require('mustache');var util=require(_0x0bbb('0x6'));var path=require(_0x0bbb('0x7'));var sox=require('sox');var csv=require(_0x0bbb('0x8'));var ejs=require(_0x0bbb('0x9'));var fs=require('fs');var fs_extra=require(_0x0bbb('0xa'));var _=require('lodash');var squel=require(_0x0bbb('0xb'));var crypto=require(_0x0bbb('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x0bbb('0xd'));var toCsv=require(_0x0bbb('0x8'));var querystring=require(_0x0bbb('0xe'));var Papa=require(_0x0bbb('0xf'));var Redis=require('ioredis');var authService=require(_0x0bbb('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0bbb('0x11'));var logger=require('../../config/logger')(_0x0bbb('0x12'));var utils=require(_0x0bbb('0x13'));var config=require(_0x0bbb('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x0bbb('0x15'))['db'];config['redis']=_[_0x0bbb('0x16')](config[_0x0bbb('0x17')],{'host':_0x0bbb('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0bbb('0x17')]));require('./smsAccount.socket')[_0x0bbb('0x19')](socket);var jayson=require(_0x0bbb('0x1a'));var client=jayson[_0x0bbb('0x1b')][_0x0bbb('0x1c')]({'port':0x232c});function respondWithRpcPromise(_0x4ec23f,_0x328179,_0x213890,_0x319d01){return new BPromise(function(_0x5688fb,_0x36e15f){var _0x2d0b16=_0x319d01||client;return _0x2d0b16[_0x0bbb('0x1d')](_0x4ec23f,_0x213890)['then'](function(_0x40fd34){logger[_0x0bbb('0x1e')](_0x0bbb('0x1f'),_0x328179,'request\x20sent');logger[_0x0bbb('0x20')](_0x0bbb('0x21'),_0x328179,'request\x20sent',JSON['stringify'](_0x40fd34));if(_0x40fd34[_0x0bbb('0x22')]){if(_0x40fd34['error'][_0x0bbb('0x23')]===0x1f4){logger[_0x0bbb('0x22')](_0x0bbb('0x1f'),_0x328179,_0x40fd34[_0x0bbb('0x22')][_0x0bbb('0x24')]);return _0x36e15f(_0x40fd34[_0x0bbb('0x22')][_0x0bbb('0x24')]);}logger[_0x0bbb('0x22')]('SmsAccount,\x20%s,\x20%s',_0x328179,_0x40fd34['error'][_0x0bbb('0x24')]);return _0x5688fb(_0x40fd34[_0x0bbb('0x22')]['message']);}else{logger['info'](_0x0bbb('0x1f'),_0x328179,_0x0bbb('0x25'));_0x5688fb(_0x40fd34['result'][_0x0bbb('0x24')]);}})[_0x0bbb('0x26')](function(_0x45077e){logger['error'](_0x0bbb('0x1f'),_0x328179,_0x45077e);_0x36e15f(_0x45077e);});});}function respondWithStatusCode(_0x385b17,_0x5348f3){_0x5348f3=_0x5348f3||0xcc;return function(_0x19e0ca){if(_0x19e0ca){return _0x385b17[_0x0bbb('0x27')](_0x5348f3);}return _0x385b17[_0x0bbb('0x28')](_0x5348f3)[_0x0bbb('0x29')]();};}function respondWithResult(_0x1e58eb,_0x46439b){_0x46439b=_0x46439b||0xc8;return function(_0x345e52){if(_0x345e52){return _0x1e58eb['status'](_0x46439b)[_0x0bbb('0x2a')](_0x345e52);}};}function respondWithFilteredResult(_0x1e0a36,_0x51b889){return function(_0x323959){if(_0x323959){var _0x35c06d=typeof _0x51b889[_0x0bbb('0x2b')]===_0x0bbb('0x2c')&&typeof _0x51b889[_0x0bbb('0x2d')]===_0x0bbb('0x2c');var _0x2eda31=_0x323959[_0x0bbb('0x2e')];var _0x580c61=_0x35c06d?0x0:_0x51b889[_0x0bbb('0x2b')];var _0x4521bf=_0x35c06d?_0x323959[_0x0bbb('0x2e')]:_0x51b889[_0x0bbb('0x2b')]+_0x51b889[_0x0bbb('0x2d')];var _0x3fca3f;if(_0x4521bf>=_0x2eda31){_0x4521bf=_0x2eda31;_0x3fca3f=0xc8;}else{_0x3fca3f=0xce;}_0x1e0a36['status'](_0x3fca3f);return _0x1e0a36['set'](_0x0bbb('0x2f'),_0x580c61+'-'+_0x4521bf+'/'+_0x2eda31)['json'](_0x323959);}return null;};}function patchUpdates(_0x362c4f){return function(_0x5e93c6){try{jsonpatch[_0x0bbb('0x30')](_0x5e93c6,_0x362c4f,!![]);}catch(_0x2fd12c){return BPromise[_0x0bbb('0x31')](_0x2fd12c);}return _0x5e93c6[_0x0bbb('0x32')]();};}function saveUpdates(_0x8423ca,_0xcb325){return function(_0x3bb9b5){if(_0x3bb9b5){return _0x3bb9b5[_0x0bbb('0x33')](_0x8423ca)['then'](function(_0x149488){return _0x149488;});}return null;};}function removeEntity(_0x2b38af,_0x5d6020){return function(_0x56e6c5){if(_0x56e6c5){return _0x56e6c5[_0x0bbb('0x34')]()['then'](function(){var _0x34f2bd=_0x56e6c5[_0x0bbb('0x35')]({'plain':!![]});var _0x2c994c='SmsAccounts';return db['UserProfileResource'][_0x0bbb('0x34')]({'where':{'type':_0x2c994c,'resourceId':_0x34f2bd['id']}})[_0x0bbb('0x36')](function(){return _0x56e6c5;});})['then'](function(){_0x2b38af[_0x0bbb('0x28')](0xcc)[_0x0bbb('0x29')]();});}};}function handleEntityNotFound(_0x371ca0,_0x8e5182){return function(_0x1a12cf){if(!_0x1a12cf){_0x371ca0[_0x0bbb('0x27')](0x194);}return _0x1a12cf;};}function handleError(_0x172dd9,_0x51a01d){_0x51a01d=_0x51a01d||0x1f4;return function(_0x312cc0){logger[_0x0bbb('0x22')](_0x312cc0[_0x0bbb('0x37')]);if(_0x312cc0[_0x0bbb('0x38')]){delete _0x312cc0[_0x0bbb('0x38')];}_0x172dd9[_0x0bbb('0x28')](_0x51a01d)[_0x0bbb('0x39')](_0x312cc0);};}exports[_0x0bbb('0x3a')]=function(_0x172e6a,_0x180f1b){var _0x293ef1={'include':[{'model':db[_0x0bbb('0x3b')],'as':'mandatoryDispositionPause'}]},_0x6d8e4f={},_0x29d1e0={'count':0x0,'rows':[]};var _0x47333c=_[_0x0bbb('0x3c')](db[_0x0bbb('0x3d')][_0x0bbb('0x3e')],function(_0x25a1f5){return{'name':_0x25a1f5[_0x0bbb('0x3f')],'type':_0x25a1f5[_0x0bbb('0x40')][_0x0bbb('0x41')]};});_0x6d8e4f[_0x0bbb('0x42')]=_['map'](_0x47333c,_0x0bbb('0x38'));_0x6d8e4f[_0x0bbb('0x43')]=_[_0x0bbb('0x44')](_0x172e6a[_0x0bbb('0x43')]);_0x6d8e4f['filters']=_[_0x0bbb('0x45')](_0x6d8e4f[_0x0bbb('0x42')],_0x6d8e4f[_0x0bbb('0x43')]);_0x293ef1[_0x0bbb('0x46')]=_[_0x0bbb('0x45')](_0x6d8e4f[_0x0bbb('0x42')],qs['fields'](_0x172e6a['query'][_0x0bbb('0x47')]));_0x293ef1[_0x0bbb('0x46')]=_0x293ef1['attributes'][_0x0bbb('0x48')]?_0x293ef1[_0x0bbb('0x46')]:_0x6d8e4f[_0x0bbb('0x42')];if(!_0x172e6a[_0x0bbb('0x43')]['hasOwnProperty'](_0x0bbb('0x49'))){_0x293ef1[_0x0bbb('0x2d')]=qs[_0x0bbb('0x2d')](_0x172e6a[_0x0bbb('0x43')][_0x0bbb('0x2d')]);_0x293ef1[_0x0bbb('0x2b')]=qs['offset'](_0x172e6a['query'][_0x0bbb('0x2b')]);}_0x293ef1[_0x0bbb('0x4a')]=qs[_0x0bbb('0x4b')](_0x172e6a[_0x0bbb('0x43')][_0x0bbb('0x4b')]);_0x293ef1[_0x0bbb('0x4c')]=qs[_0x0bbb('0x4d')](_['pick'](_0x172e6a['query'],_0x6d8e4f['filters']),_0x47333c);if(_0x172e6a[_0x0bbb('0x43')][_0x0bbb('0x4e')]){_0x293ef1[_0x0bbb('0x4c')]=_[_0x0bbb('0x4f')](_0x293ef1['where'],{'$or':_[_0x0bbb('0x3c')](_0x47333c,function(_0x563848){if(_0x563848[_0x0bbb('0x40')]!==_0x0bbb('0x50')){var _0x32a38c={};_0x32a38c[_0x563848['name']]={'$like':'%'+_0x172e6a[_0x0bbb('0x43')][_0x0bbb('0x4e')]+'%'};return _0x32a38c;}})});}_0x293ef1=_['merge']({},_0x293ef1,_0x172e6a['options']);var _0x44646f={'where':_0x293ef1[_0x0bbb('0x4c')]};return db['SmsAccount'][_0x0bbb('0x2e')](_0x44646f)['then'](function(_0x446c12){_0x29d1e0[_0x0bbb('0x2e')]=_0x446c12;if(_0x172e6a['query'][_0x0bbb('0x51')]){_0x293ef1[_0x0bbb('0x52')]=[{'all':!![]}];}return db[_0x0bbb('0x3d')][_0x0bbb('0x53')](_0x293ef1);})['then'](function(_0x458253){_0x29d1e0['rows']=_0x458253;return _0x29d1e0;})[_0x0bbb('0x36')](respondWithFilteredResult(_0x180f1b,_0x293ef1))[_0x0bbb('0x26')](handleError(_0x180f1b,null));};exports[_0x0bbb('0x54')]=function(_0x1dded2,_0x3b34c0){var _0x2a7aeb={'raw':![],'where':{'id':_0x1dded2[_0x0bbb('0x55')]['id']},'include':[{'model':db['Pause'],'as':_0x0bbb('0x56')}]},_0xd9b0d5={};_0xd9b0d5[_0x0bbb('0x42')]=_['keys'](db[_0x0bbb('0x3d')][_0x0bbb('0x3e')]);_0xd9b0d5[_0x0bbb('0x43')]=_[_0x0bbb('0x44')](_0x1dded2[_0x0bbb('0x43')]);_0xd9b0d5['filters']=_[_0x0bbb('0x45')](_0xd9b0d5[_0x0bbb('0x42')],_0xd9b0d5[_0x0bbb('0x43')]);_0x2a7aeb['attributes']=_[_0x0bbb('0x45')](_0xd9b0d5[_0x0bbb('0x42')],qs['fields'](_0x1dded2[_0x0bbb('0x43')][_0x0bbb('0x47')]));_0x2a7aeb['attributes']=_0x2a7aeb[_0x0bbb('0x46')][_0x0bbb('0x48')]?_0x2a7aeb[_0x0bbb('0x46')]:_0xd9b0d5[_0x0bbb('0x42')];if(_0x1dded2[_0x0bbb('0x43')][_0x0bbb('0x51')]){_0x2a7aeb[_0x0bbb('0x52')]=[{'all':!![]}];}_0x2a7aeb=_[_0x0bbb('0x4f')]({},_0x2a7aeb,_0x1dded2['options']);return db[_0x0bbb('0x3d')][_0x0bbb('0x57')](_0x2a7aeb)['then'](handleEntityNotFound(_0x3b34c0,null))[_0x0bbb('0x36')](respondWithResult(_0x3b34c0,null))[_0x0bbb('0x26')](handleError(_0x3b34c0,null));};exports['create']=function(_0x17e1ac,_0x32a180){return db[_0x0bbb('0x3d')][_0x0bbb('0x58')](_0x17e1ac[_0x0bbb('0x59')],{})[_0x0bbb('0x36')](function(_0x3ae34d){var _0x532b0f=_0x17e1ac['user'][_0x0bbb('0x35')]({'plain':!![]});if(!_0x532b0f)throw new Error(_0x0bbb('0x5a'));if(_0x532b0f[_0x0bbb('0x5b')]===_0x0bbb('0x5c')){var _0x3bc1df=_0x3ae34d[_0x0bbb('0x35')]({'plain':!![]});var _0x47831e='SmsAccounts';return db[_0x0bbb('0x5d')]['find']({'where':{'name':_0x47831e,'userProfileId':_0x532b0f[_0x0bbb('0x5e')]},'raw':!![]})[_0x0bbb('0x36')](function(_0x399833){if(_0x399833&&_0x399833['autoAssociation']===0x0){return db[_0x0bbb('0x5f')][_0x0bbb('0x58')]({'name':_0x3bc1df[_0x0bbb('0x38')],'resourceId':_0x3bc1df['id'],'type':_0x399833[_0x0bbb('0x38')],'sectionId':_0x399833['id']},{})['then'](function(){return _0x3ae34d;});}else{return _0x3ae34d;}})[_0x0bbb('0x26')](function(_0x3cb8ff){logger[_0x0bbb('0x22')](_0x0bbb('0x60'),_0x3cb8ff);throw _0x3cb8ff;});}return _0x3ae34d;})[_0x0bbb('0x36')](respondWithResult(_0x32a180,0xc9))[_0x0bbb('0x26')](handleError(_0x32a180,null));};exports[_0x0bbb('0x33')]=function(_0x4558a3,_0x231d3a){if(_0x4558a3[_0x0bbb('0x59')]['id']){delete _0x4558a3[_0x0bbb('0x59')]['id'];}return db[_0x0bbb('0x3d')][_0x0bbb('0x57')]({'where':{'id':_0x4558a3[_0x0bbb('0x55')]['id']},'include':[{'model':db[_0x0bbb('0x3b')],'as':_0x0bbb('0x56')}]})[_0x0bbb('0x36')](handleEntityNotFound(_0x231d3a,null))['then'](saveUpdates(_0x4558a3['body'],null))[_0x0bbb('0x36')](respondWithResult(_0x231d3a,null))['catch'](handleError(_0x231d3a,null));};exports[_0x0bbb('0x34')]=function(_0x4d64fe,_0x2d5efe){return db[_0x0bbb('0x3d')][_0x0bbb('0x57')]({'where':{'id':_0x4d64fe['params']['id']}})[_0x0bbb('0x36')](handleEntityNotFound(_0x2d5efe,null))[_0x0bbb('0x36')](removeEntity(_0x2d5efe,null))[_0x0bbb('0x26')](handleError(_0x2d5efe,null));};exports[_0x0bbb('0x61')]=function(_0xc1ad5b,_0x108cb2){return db[_0x0bbb('0x3d')][_0x0bbb('0x61')]()[_0x0bbb('0x36')](respondWithResult(_0x108cb2,null))[_0x0bbb('0x26')](handleError(_0x108cb2,null));};exports['addDisposition']=function(_0x445d4f,_0x412924,_0x16edca){if(_0x445d4f[_0x0bbb('0x59')]['id']){delete _0x445d4f['body']['id'];}return db[_0x0bbb('0x3d')]['find']({'where':{'id':_0x445d4f[_0x0bbb('0x55')]['id']}})[_0x0bbb('0x36')](handleEntityNotFound(_0x412924,null))['then'](function(_0x4c4a1a){if(_0x4c4a1a){_0x445d4f[_0x0bbb('0x59')][_0x0bbb('0x62')]=_0x4c4a1a['id'];return db['Disposition'][_0x0bbb('0x58')](_0x445d4f[_0x0bbb('0x59')]);}})['then'](respondWithResult(_0x412924,null))[_0x0bbb('0x26')](handleError(_0x412924,null));};exports['getDispositions']=function(_0x5e7333,_0x36adc6,_0x4abf3f){var _0x33650f={'raw':![],'where':{}};var _0xa689dd={};var _0x1955c6={'count':0x0,'rows':[]};return db['SmsAccount'][_0x0bbb('0x63')]({'where':{'id':_0x5e7333[_0x0bbb('0x55')]['id']}})[_0x0bbb('0x36')](handleEntityNotFound(_0x36adc6,null))[_0x0bbb('0x36')](function(_0x2101ae){if(_0x2101ae){_0xa689dd[_0x0bbb('0x42')]=_['keys'](db['Disposition'][_0x0bbb('0x3e')]);_0xa689dd[_0x0bbb('0x43')]=_[_0x0bbb('0x44')](_0x5e7333['query']);_0xa689dd[_0x0bbb('0x4d')]=_['intersection'](_0xa689dd['model'],_0xa689dd['query']);_0x33650f['attributes']=_[_0x0bbb('0x45')](_0xa689dd['model'],qs['fields'](_0x5e7333['query'][_0x0bbb('0x47')]));_0x33650f[_0x0bbb('0x46')]=_0x33650f['attributes'][_0x0bbb('0x48')]?_0x33650f['attributes']:_0xa689dd[_0x0bbb('0x42')];if(!_0x5e7333[_0x0bbb('0x43')]['hasOwnProperty'](_0x0bbb('0x49'))){_0x33650f[_0x0bbb('0x2d')]=qs[_0x0bbb('0x2d')](_0x5e7333[_0x0bbb('0x43')][_0x0bbb('0x2d')]);_0x33650f[_0x0bbb('0x2b')]=qs[_0x0bbb('0x2b')](_0x5e7333[_0x0bbb('0x43')][_0x0bbb('0x2b')]);}_0x33650f[_0x0bbb('0x4a')]=qs[_0x0bbb('0x4b')](_0x5e7333['query'][_0x0bbb('0x4b')]);_0x33650f[_0x0bbb('0x4c')]=qs['filters'](_[_0x0bbb('0x64')](_0x5e7333['query'],_0xa689dd['filters']));_0x33650f[_0x0bbb('0x4c')][_0x0bbb('0x62')]=_0x2101ae['id'];if(_0x5e7333['query']['filter']){_0x33650f[_0x0bbb('0x4c')]=_[_0x0bbb('0x4f')](_0x33650f[_0x0bbb('0x4c')],{'$or':_[_0x0bbb('0x3c')](_0x33650f[_0x0bbb('0x46')],function(_0x882c1d){var _0x51ae2b={};_0x51ae2b[_0x882c1d]={'$like':'%'+_0x5e7333[_0x0bbb('0x43')][_0x0bbb('0x4e')]+'%'};return _0x51ae2b;})});}_0x33650f=_[_0x0bbb('0x4f')]({},_0x33650f,_0x5e7333[_0x0bbb('0x65')]);return db[_0x0bbb('0x66')][_0x0bbb('0x2e')]({'where':_0x33650f[_0x0bbb('0x4c')]})[_0x0bbb('0x36')](function(_0x5f45e5){_0x1955c6['count']=_0x5f45e5;if(_0x5e7333['query'][_0x0bbb('0x51')]){_0x33650f[_0x0bbb('0x52')]=[{'all':!![]}];}return db[_0x0bbb('0x66')]['findAll'](_0x33650f);})['then'](function(_0x2fa05c){_0x1955c6[_0x0bbb('0x67')]=_0x2fa05c;return _0x1955c6;});}})[_0x0bbb('0x36')](respondWithFilteredResult(_0x36adc6,_0x33650f))[_0x0bbb('0x26')](handleError(_0x36adc6,null));};exports[_0x0bbb('0x68')]=function(_0x583c1f,_0x2e8dc5,_0x31dcd6){return db[_0x0bbb('0x3d')][_0x0bbb('0x57')]({'where':{'id':_0x583c1f[_0x0bbb('0x55')]['id']}})[_0x0bbb('0x36')](handleEntityNotFound(_0x2e8dc5,null))[_0x0bbb('0x36')](function(_0x3b80c8){if(_0x3b80c8){return _0x3b80c8[_0x0bbb('0x68')](_0x583c1f['query'][_0x0bbb('0x69')]);}})[_0x0bbb('0x36')](respondWithStatusCode(_0x2e8dc5,null))['catch'](handleError(_0x2e8dc5,null));};exports['addAnswer']=function(_0x10a7a1,_0x472233,_0x28138a){if(_0x10a7a1[_0x0bbb('0x59')]['id']){delete _0x10a7a1[_0x0bbb('0x59')]['id'];}return db[_0x0bbb('0x3d')]['find']({'where':{'id':_0x10a7a1[_0x0bbb('0x55')]['id']}})[_0x0bbb('0x36')](handleEntityNotFound(_0x472233,null))[_0x0bbb('0x36')](function(_0x55c392){if(_0x55c392){_0x10a7a1[_0x0bbb('0x59')]['SmsAccountId']=_0x55c392['id'];return db[_0x0bbb('0x6a')][_0x0bbb('0x58')](_0x10a7a1[_0x0bbb('0x59')]);}})[_0x0bbb('0x36')](respondWithResult(_0x472233,null))[_0x0bbb('0x26')](handleError(_0x472233,null));};exports['getAnswers']=function(_0x15665a,_0x45c1ed,_0x1707a4){var _0x5cacea={'raw':![],'where':{}};var _0x109699={};var _0x3b85fb={'count':0x0,'rows':[]};return db[_0x0bbb('0x3d')][_0x0bbb('0x63')]({'where':{'id':_0x15665a['params']['id']}})[_0x0bbb('0x36')](handleEntityNotFound(_0x45c1ed,null))['then'](function(_0x16a29d){if(_0x16a29d){_0x109699[_0x0bbb('0x42')]=_[_0x0bbb('0x44')](db[_0x0bbb('0x6a')][_0x0bbb('0x3e')]);_0x109699[_0x0bbb('0x43')]=_[_0x0bbb('0x44')](_0x15665a[_0x0bbb('0x43')]);_0x109699['filters']=_[_0x0bbb('0x45')](_0x109699[_0x0bbb('0x42')],_0x109699[_0x0bbb('0x43')]);_0x5cacea[_0x0bbb('0x46')]=_['intersection'](_0x109699[_0x0bbb('0x42')],qs[_0x0bbb('0x47')](_0x15665a[_0x0bbb('0x43')][_0x0bbb('0x47')]));_0x5cacea[_0x0bbb('0x46')]=_0x5cacea[_0x0bbb('0x46')][_0x0bbb('0x48')]?_0x5cacea[_0x0bbb('0x46')]:_0x109699['model'];if(!_0x15665a['query']['hasOwnProperty'](_0x0bbb('0x49'))){_0x5cacea[_0x0bbb('0x2d')]=qs[_0x0bbb('0x2d')](_0x15665a[_0x0bbb('0x43')][_0x0bbb('0x2d')]);_0x5cacea[_0x0bbb('0x2b')]=qs[_0x0bbb('0x2b')](_0x15665a[_0x0bbb('0x43')][_0x0bbb('0x2b')]);}_0x5cacea[_0x0bbb('0x4a')]=qs[_0x0bbb('0x4b')](_0x15665a['query'][_0x0bbb('0x4b')]);_0x5cacea[_0x0bbb('0x4c')]=qs['filters'](_[_0x0bbb('0x64')](_0x15665a[_0x0bbb('0x43')],_0x109699[_0x0bbb('0x4d')]));_0x5cacea['where'][_0x0bbb('0x62')]=_0x16a29d['id'];if(_0x15665a[_0x0bbb('0x43')][_0x0bbb('0x4e')]){_0x5cacea['where']=_[_0x0bbb('0x4f')](_0x5cacea[_0x0bbb('0x4c')],{'$or':_[_0x0bbb('0x3c')](_0x5cacea['attributes'],function(_0x41dfc2){var _0x4da439={};_0x4da439[_0x41dfc2]={'$like':'%'+_0x15665a['query']['filter']+'%'};return _0x4da439;})});}_0x5cacea=_[_0x0bbb('0x4f')]({},_0x5cacea,_0x15665a['options']);return db[_0x0bbb('0x6a')][_0x0bbb('0x2e')]({'where':_0x5cacea[_0x0bbb('0x4c')]})[_0x0bbb('0x36')](function(_0x5918ec){_0x3b85fb[_0x0bbb('0x2e')]=_0x5918ec;if(_0x15665a[_0x0bbb('0x43')]['includeAll']){_0x5cacea[_0x0bbb('0x52')]=[{'all':!![]}];}return db[_0x0bbb('0x6a')][_0x0bbb('0x53')](_0x5cacea);})[_0x0bbb('0x36')](function(_0x35d9c9){_0x3b85fb[_0x0bbb('0x67')]=_0x35d9c9;return _0x3b85fb;});}})[_0x0bbb('0x36')](respondWithFilteredResult(_0x45c1ed,_0x5cacea))[_0x0bbb('0x26')](handleError(_0x45c1ed,null));};exports[_0x0bbb('0x6b')]=function(_0x191410,_0x4b42c0,_0x1786c8){return db[_0x0bbb('0x3d')][_0x0bbb('0x57')]({'where':{'id':_0x191410[_0x0bbb('0x55')]['id']}})[_0x0bbb('0x36')](handleEntityNotFound(_0x4b42c0,null))[_0x0bbb('0x36')](function(_0x6b70b5){if(_0x6b70b5){return _0x6b70b5[_0x0bbb('0x6b')](_0x191410[_0x0bbb('0x43')][_0x0bbb('0x69')]);}})['then'](respondWithStatusCode(_0x4b42c0,null))[_0x0bbb('0x26')](handleError(_0x4b42c0,null));};exports[_0x0bbb('0x6c')]=function(_0x15dc2d,_0x5477dd,_0xdfffee){var _0x20e62f={'channel':_0x0bbb('0x6d')};var _0x3752ab=[];var _0x5bdbf8=[];var _0x55fa8a={};return db['SmsAccount']['find']({'where':{'id':_0x15dc2d[_0x0bbb('0x55')]['id']},'include':[{'model':db['SmsApplication'],'as':_0x0bbb('0x6e')}]})['then'](handleEntityNotFound(_0x5477dd,null))[_0x0bbb('0x36')](function(_0x3d1c10){_0x20e62f[_0x0bbb('0x6f')]=_0x3d1c10;_0x20e62f['applications']=_[_0x0bbb('0x70')](_0x3d1c10[_0x0bbb('0x6e')],[_0x0bbb('0x71')],[_0x0bbb('0x72')]);if(_0x20e62f[_0x0bbb('0x6f')]['Applications']){delete _0x20e62f[_0x0bbb('0x6f')][_0x0bbb('0x6e')];}return db[_0x0bbb('0x73')]['describe']();})[_0x0bbb('0x36')](function(_0x260111){if(!_0x260111){throw new db['Sequelize'][(_0x0bbb('0x74'))](_0x0bbb('0x75'));}_0x3752ab=_['difference'](_[_0x0bbb('0x44')](_0x260111),[_0x0bbb('0x76'),'updatedAt']);_0x5bdbf8=_[_0x0bbb('0x77')](_[_0x0bbb('0x44')](_0x260111),[_0x0bbb('0x76'),'updatedAt',_0x0bbb('0x78'),_0x0bbb('0x79')]);_0x20e62f['body']={'mapKey':_0x0bbb('0x7a')};if(_0x20e62f[_0x0bbb('0x6f')]['type']){switch(_0x20e62f[_0x0bbb('0x6f')][_0x0bbb('0x40')]){case'twilio':_0x20e62f[_0x0bbb('0x59')][_0x0bbb('0x7b')]=_0x15dc2d[_0x0bbb('0x59')][_0x0bbb('0x7c')];_0x20e62f[_0x0bbb('0x59')][_0x0bbb('0x59')]=_0x15dc2d['body']['Body'];_0x20e62f[_0x0bbb('0x59')][_0x0bbb('0x7d')]=_0x15dc2d[_0x0bbb('0x59')][_0x0bbb('0x7e')];break;case _0x0bbb('0x7f'):_0x20e62f[_0x0bbb('0x59')]['from']='+'+_0x15dc2d[_0x0bbb('0x59')][_0x0bbb('0x80')];_0x20e62f[_0x0bbb('0x59')]['body']=_0x15dc2d[_0x0bbb('0x59')][_0x0bbb('0x81')];break;case _0x0bbb('0x82'):_0x20e62f[_0x0bbb('0x59')][_0x0bbb('0x7b')]=_0x15dc2d['body'][_0x0bbb('0x7b')];_0x20e62f[_0x0bbb('0x59')]['body']=_0x15dc2d['body']['message'];break;case _0x0bbb('0x83'):_0x20e62f[_0x0bbb('0x59')][_0x0bbb('0x7b')]=_0x15dc2d[_0x0bbb('0x59')][_0x0bbb('0x7b')];_0x20e62f[_0x0bbb('0x59')][_0x0bbb('0x59')]=_0x15dc2d[_0x0bbb('0x59')][_0x0bbb('0x59')];_0x20e62f['body'][_0x0bbb('0x7d')]=_0x15dc2d[_0x0bbb('0x59')][_0x0bbb('0x84')];break;case _0x0bbb('0x85'):_0x20e62f[_0x0bbb('0x59')]['from']=_0x15dc2d['body']['From'];_0x20e62f[_0x0bbb('0x59')][_0x0bbb('0x59')]=_0x15dc2d[_0x0bbb('0x59')][_0x0bbb('0x86')];_0x20e62f[_0x0bbb('0x59')]['messageId']=_0x15dc2d[_0x0bbb('0x59')][_0x0bbb('0x87')];break;case _0x0bbb('0x88'):_0x20e62f['body'][_0x0bbb('0x7b')]='+'+_0x15dc2d[_0x0bbb('0x59')][_0x0bbb('0x89')][0x0][_0x0bbb('0x7b')];_0x20e62f[_0x0bbb('0x59')][_0x0bbb('0x59')]=_0x15dc2d[_0x0bbb('0x59')][_0x0bbb('0x89')][0x0][_0x0bbb('0x81')];_0x20e62f[_0x0bbb('0x59')][_0x0bbb('0x7d')]=_0x15dc2d[_0x0bbb('0x59')]['results'][0x0][_0x0bbb('0x7d')];break;case _0x0bbb('0x8a'):_0x20e62f[_0x0bbb('0x59')][_0x0bbb('0x7b')]=_0x15dc2d[_0x0bbb('0x59')][_0x0bbb('0x8b')];_0x20e62f[_0x0bbb('0x59')]['body']=_0x15dc2d[_0x0bbb('0x59')][_0x0bbb('0x8c')][_0x0bbb('0x24')];break;case'clickatell':_0x20e62f['body'][_0x0bbb('0x7b')]=_0x15dc2d[_0x0bbb('0x59')][_0x0bbb('0x8d')];_0x20e62f[_0x0bbb('0x59')]['body']=_0x15dc2d[_0x0bbb('0x59')][_0x0bbb('0x81')];_0x20e62f[_0x0bbb('0x59')]['messageId']=_0x15dc2d[_0x0bbb('0x59')][_0x0bbb('0x8e')];break;case'bandwidth':_0x20e62f[_0x0bbb('0x59')][_0x0bbb('0x7d')]=_0x15dc2d['body'][0x0][_0x0bbb('0x24')]['id'];_0x20e62f[_0x0bbb('0x59')][_0x0bbb('0x7b')]=_0x15dc2d['body'][0x0][_0x0bbb('0x24')][_0x0bbb('0x7b')];_0x20e62f[_0x0bbb('0x59')]['body']=_0x15dc2d[_0x0bbb('0x59')][0x0][_0x0bbb('0x24')][_0x0bbb('0x81')];break;case _0x0bbb('0x8f'):_0x20e62f[_0x0bbb('0x59')][_0x0bbb('0x7b')]=_0x15dc2d[_0x0bbb('0x59')][_0x0bbb('0x7b')];_0x20e62f[_0x0bbb('0x59')][_0x0bbb('0x59')]=_0x15dc2d[_0x0bbb('0x59')][_0x0bbb('0x24')];_0x20e62f[_0x0bbb('0x59')][_0x0bbb('0x7d')]=_0x15dc2d[_0x0bbb('0x59')][_0x0bbb('0x90')];break;}}if(_0x20e62f[_0x0bbb('0x59')]['id']){delete _0x20e62f[_0x0bbb('0x59')]['id'];}if(_['isNil'](_0x20e62f['body'][_0x0bbb('0x7b')])){throw new db[(_0x0bbb('0x91'))][(_0x0bbb('0x74'))](_0x0bbb('0x92'));}if(_[_0x0bbb('0x93')](_0x20e62f[_0x0bbb('0x59')][_0x0bbb('0x59')])||_0x20e62f[_0x0bbb('0x59')][_0x0bbb('0x59')]===''){throw new db[(_0x0bbb('0x91'))][(_0x0bbb('0x74'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x0bbb('0x93')](_0x20e62f[_0x0bbb('0x59')][_0x0bbb('0x94')])){throw new db[(_0x0bbb('0x91'))][(_0x0bbb('0x74'))](_0x0bbb('0x95')+_0x5bdbf8);}if(!_['includes'](_0x5bdbf8,_0x20e62f[_0x0bbb('0x59')][_0x0bbb('0x94')])){throw new db[(_0x0bbb('0x91'))][(_0x0bbb('0x74'))](_0x0bbb('0x96')+_0x5bdbf8);}_0x55fa8a[_0x20e62f[_0x0bbb('0x59')][_0x0bbb('0x94')]]=_0x20e62f['body'][_0x0bbb('0x7b')];return db[_0x0bbb('0x97')][_0x0bbb('0x57')]({'where':{'id':_0x20e62f[_0x0bbb('0x6f')][_0x0bbb('0x79')]},'include':[{'model':db[_0x0bbb('0x73')],'as':_0x0bbb('0x98'),'where':_0x55fa8a,'limit':0x1,'order':[[_0x0bbb('0x99'),_0x0bbb('0x9a')]]}]});})[_0x0bbb('0x36')](handleEntityNotFound(_0x5477dd,null))[_0x0bbb('0x36')](function(_0x2f78dd){if(_0x2f78dd){_0x20e62f[_0x0bbb('0x9b')]=_[_0x0bbb('0x9c')](_0x2f78dd,[_0x0bbb('0x98')]);if(_0x2f78dd[_0x0bbb('0x98')][_0x0bbb('0x48')]){return _0x2f78dd[_0x0bbb('0x98')][0x0];}var _0x39e5ee=_['defaults'](_0x20e62f[_0x0bbb('0x59')],{'firstName':_0x20e62f[_0x0bbb('0x59')]['from'],'ListId':_0x2f78dd['id']});_0x39e5ee[_0x20e62f[_0x0bbb('0x59')][_0x0bbb('0x94')]]=_0x20e62f[_0x0bbb('0x59')]['from'];return db[_0x0bbb('0x73')][_0x0bbb('0x58')](_0x39e5ee,{'fields':_0x3752ab,'raw':!![]});}})['then'](handleEntityNotFound(_0x5477dd,null))[_0x0bbb('0x36')](function(_0x404cf2){if(_0x404cf2){_0x20e62f[_0x0bbb('0x9d')]=_0x404cf2;var _0x29a2af={'ContactId':_0x404cf2['id'],'phone':_0x20e62f[_0x0bbb('0x59')][_0x0bbb('0x7b')],'SmsAccountId':_0x15dc2d[_0x0bbb('0x55')]['id']};var _0x4f9bfd={'ContactId':_0x404cf2['id'],'SmsAccountId':_0x15dc2d[_0x0bbb('0x55')]['id'],'closed':![]};return db['SmsInteraction'][_0x0bbb('0x57')]({'where':_0x4f9bfd})[_0x0bbb('0x36')](function(_0x1cd107){if(_0x1cd107){return[_0x1cd107,![]];}return db['SmsInteraction'][_0x0bbb('0x58')](_0x29a2af)['then'](function(_0x279392){return[_0x279392,!![]];});});}})[_0x0bbb('0x9e')](function(_0x24427b,_0x493e8b){_0x20e62f[_0x0bbb('0x9f')]=_0x24427b[_0x0bbb('0x35')]({'plain':!![]});_0x20e62f[_0x0bbb('0x9f')]['created']=![];if(_0x493e8b){if(_0x20e62f[_0x0bbb('0x6f')]['autoclose']){_0x20e62f[_0x0bbb('0xa0')]['push']({'id':0x0,'priority':_0x20e62f['applications'][_0x0bbb('0x48')]+0x1,'app':_0x0bbb('0xa1'),'appdata':_0x0bbb('0xa2'),'interval':_0x0bbb('0xa3')});}_0x20e62f[_0x0bbb('0x9f')][_0x0bbb('0xa4')]=!![];}return db[_0x0bbb('0xa5')][_0x0bbb('0x58')]({'phone':_0x20e62f[_0x0bbb('0x59')][_0x0bbb('0x7b')],'messageId':_0x20e62f['body'][_0x0bbb('0x7d')],'body':_0x20e62f['body']['body'],'SmsAccountId':_0x15dc2d[_0x0bbb('0x55')]['id'],'SmsInteractionId':_0x24427b['id'],'direction':'in','ContactId':_0x24427b[_0x0bbb('0xa6')],'AttachmentId':_0x20e62f['body'][_0x0bbb('0xa7')]});})[_0x0bbb('0x36')](function(_0x3effa4){_0x20e62f[_0x0bbb('0x24')]=_0x3effa4;if(!_0x20e62f['interaction'][_0x0bbb('0xa8')])return;return db[_0x0bbb('0xa9')]['find']({'attributes':['id',_0x0bbb('0x38')],'where':{'id':_0x20e62f[_0x0bbb('0x9f')][_0x0bbb('0xa8')]}});})['then'](function(_0x5d7ce7){if(_0x5d7ce7){_0x20e62f[_0x0bbb('0xa0')][_0x0bbb('0xaa')]({'id':0x0,'priority':0x0,'app':_0x0bbb('0xab'),'appdata':_0x5d7ce7[_0x0bbb('0x38')]+','+(_0x20e62f[_0x0bbb('0x6f')][_0x0bbb('0xac')]||0xa),'interval':'*,*,*,*'});}if(!_0x20e62f[_0x0bbb('0x9f')][_0x0bbb('0xad')])return;return db[_0x0bbb('0xae')][_0x0bbb('0x57')]({'attributes':['id','name'],'where':{'id':_0x20e62f[_0x0bbb('0x9f')][_0x0bbb('0xad')]}});})[_0x0bbb('0x36')](function(_0xe07c05){if(_0xe07c05){_0x20e62f[_0x0bbb('0xa0')][_0x0bbb('0xaa')]({'id':0x0,'priority':0x1,'app':_0x0bbb('0xaf'),'appdata':_0xe07c05['name']+','+(_0x20e62f[_0x0bbb('0x6f')][_0x0bbb('0xb0')]||0x12c),'interval':_0x0bbb('0xa3')});}return respondWithRpcPromise(_0x0bbb('0xb1'),_0x0bbb('0xb2'),_0x20e62f);})[_0x0bbb('0x36')](function(_0x7e57fe){if(_0x7e57fe){var _0x4f8ae7=0xc8;var _0x5f49f3='receiveMessage';logger[_0x0bbb('0x1e')](_0x0bbb('0x21'),_0x5f49f3,_0x4f8ae7,_0x0bbb('0xb3'));logger['debug'](_0x0bbb('0xb4'),_0x5f49f3,_0x4f8ae7,_0x0bbb('0xb3'),JSON[_0x0bbb('0xb5')](_0x7e57fe));if(_0x20e62f[_0x0bbb('0x6f')][_0x0bbb('0x40')]==='twilio'){return _0x5477dd[_0x0bbb('0x28')](_0x4f8ae7)[_0x0bbb('0xb6')](_0x0bbb('0xb7'),_0x0bbb('0xb8'))[_0x0bbb('0x39')](_0x0bbb('0xb9'));}else{return _0x5477dd[_0x0bbb('0x28')](_0x4f8ae7)[_0x0bbb('0x2a')](_0x7e57fe);}}})['catch'](handleError(_0x5477dd,null));};exports['addApplications']=function(_0x4ef2e8,_0x390654){var _0x5c61ef=_0x4ef2e8[_0x0bbb('0x55')]['id'];var _0xd8ee=_0x4ef2e8['body'];var _0x4a2076=0xc8;var _0x3c6a1e=null;return db[_0x0bbb('0xba')]['transaction']({'isolationLevel':db[_0x0bbb('0xba')]['Transaction'][_0x0bbb('0xbb')][_0x0bbb('0xbc')]},function(_0x5623af){return db['SmsAccount'][_0x0bbb('0x63')]({'where':{'id':_0x5c61ef},'transaction':_0x5623af})[_0x0bbb('0x36')](function(_0x289f3e){if(_0x289f3e){return db[_0x0bbb('0xbd')][_0x0bbb('0x34')]({'where':{'SmsAccountId':_0x5c61ef},'transaction':_0x5623af})['then'](function(){var _0x357ea7=_[_0x0bbb('0x3c')](_0xd8ee,function(_0x5f492e){_0x5f492e[_0x0bbb('0x62')]=_0x5c61ef;return _0x5f492e;});return db[_0x0bbb('0xbd')]['bulkCreate'](_0x357ea7,{'transaction':_0x5623af});});}else{_0x4a2076=0x194;_0x3c6a1e=[];}});})[_0x0bbb('0x36')](function(){if(_0x4a2076!==0x194){return db[_0x0bbb('0xbd')]['findAndCountAll']({'where':{'SmsAccountId':_0x5c61ef},'order':_0x0bbb('0x71')})['then'](function(_0x31028e){_0x3c6a1e=_0x31028e;});}})[_0x0bbb('0x26')](function(_0x4e1f04){_0x4a2076=0x1f4;logger[_0x0bbb('0x22')](_0x4e1f04[_0x0bbb('0x37')]);if(_0x4e1f04['name']){delete _0x4e1f04[_0x0bbb('0x38')];}_0x3c6a1e=_0x4e1f04;})['finally'](function(){if(_0x3c6a1e===null){_0x390654[_0x0bbb('0x27')](_0x4a2076);}else{if(_0x4a2076===0x1f4){_0x390654[_0x0bbb('0x28')](_0x4a2076)[_0x0bbb('0x39')](_0x3c6a1e);}else{_0x390654[_0x0bbb('0x28')](_0x4a2076)[_0x0bbb('0x2a')](_0x3c6a1e);}}});};exports[_0x0bbb('0xbe')]=function(_0x4ee7fe,_0x27f626,_0x1f43a2){var _0x1b4954={};var _0x27250f={};var _0x642935;var _0x264524;return db['SmsAccount'][_0x0bbb('0x63')]({'where':{'id':_0x4ee7fe[_0x0bbb('0x55')]['id']}})[_0x0bbb('0x36')](handleEntityNotFound(_0x27f626,null))[_0x0bbb('0x36')](function(_0x594edf){if(_0x594edf){_0x642935=_0x594edf;_0x27250f[_0x0bbb('0x42')]=_['keys'](db[_0x0bbb('0xbd')][_0x0bbb('0x3e')]);_0x27250f[_0x0bbb('0x43')]=_['keys'](_0x4ee7fe['query']);_0x27250f[_0x0bbb('0x4d')]=_['intersection'](_0x27250f['model'],_0x27250f[_0x0bbb('0x43')]);_0x1b4954['attributes']=_[_0x0bbb('0x45')](_0x27250f['model'],qs[_0x0bbb('0x47')](_0x4ee7fe[_0x0bbb('0x43')][_0x0bbb('0x47')]));_0x1b4954[_0x0bbb('0x46')]=_0x1b4954[_0x0bbb('0x46')]['length']?_0x1b4954[_0x0bbb('0x46')]:_0x27250f['model'];_0x1b4954[_0x0bbb('0x4a')]=qs[_0x0bbb('0x4b')](_0x4ee7fe[_0x0bbb('0x43')][_0x0bbb('0x4b')]);_0x1b4954[_0x0bbb('0x4c')]=qs['filters'](_[_0x0bbb('0x64')](_0x4ee7fe['query'],_0x27250f[_0x0bbb('0x4d')]));if(_0x4ee7fe[_0x0bbb('0x43')]['filter']){_0x1b4954[_0x0bbb('0x4c')]=_[_0x0bbb('0x4f')](_0x1b4954['where'],{'$or':_[_0x0bbb('0x3c')](_0x1b4954[_0x0bbb('0x46')],function(_0x1e5392){var _0x2f3861={};_0x2f3861[_0x1e5392]={'$like':'%'+_0x4ee7fe[_0x0bbb('0x43')][_0x0bbb('0x4e')]+'%'};return _0x2f3861;})});}_0x1b4954=_[_0x0bbb('0x4f')]({},_0x1b4954,_0x4ee7fe[_0x0bbb('0x65')]);return _0x642935[_0x0bbb('0xbe')](_0x1b4954);}})[_0x0bbb('0x36')](function(_0x260ab8){if(_0x260ab8){_0x264524=_0x260ab8[_0x0bbb('0x48')];if(!_0x4ee7fe[_0x0bbb('0x43')][_0x0bbb('0xbf')](_0x0bbb('0x49'))){_0x1b4954[_0x0bbb('0x2d')]=qs['limit'](_0x4ee7fe[_0x0bbb('0x43')]['limit']);_0x1b4954[_0x0bbb('0x2b')]=qs['offset'](_0x4ee7fe['query']['offset']);}return _0x642935['getApplications'](_0x1b4954);}})['then'](function(_0x3cb699){if(_0x3cb699){return _0x3cb699?{'count':_0x264524,'rows':_0x3cb699}:null;}})[_0x0bbb('0x36')](respondWithResult(_0x27f626,null))[_0x0bbb('0x26')](handleError(_0x27f626,null));};exports[_0x0bbb('0xc0')]=function(_0x30f1c7,_0x2979b1,_0x4c07e8){var _0x52ea81={'raw':![],'where':{}};var _0x398ad7={};var _0x44fe13={'count':0x0,'rows':[]};return db[_0x0bbb('0x3d')][_0x0bbb('0x63')]({'where':{'id':_0x30f1c7[_0x0bbb('0x55')]['id']}})[_0x0bbb('0x36')](handleEntityNotFound(_0x2979b1,null))[_0x0bbb('0x36')](function(_0x133540){if(_0x133540){_0x398ad7['model']=_[_0x0bbb('0x44')](db[_0x0bbb('0xc1')]['rawAttributes']);_0x398ad7[_0x0bbb('0x43')]=_[_0x0bbb('0x44')](_0x30f1c7[_0x0bbb('0x43')]);_0x398ad7[_0x0bbb('0x4d')]=_[_0x0bbb('0x45')](_0x398ad7[_0x0bbb('0x42')],_0x398ad7[_0x0bbb('0x43')]);_0x52ea81['attributes']=_[_0x0bbb('0x45')](_0x398ad7[_0x0bbb('0x42')],qs[_0x0bbb('0x47')](_0x30f1c7[_0x0bbb('0x43')][_0x0bbb('0x47')]));_0x52ea81[_0x0bbb('0x46')]=_0x52ea81[_0x0bbb('0x46')][_0x0bbb('0x48')]?_0x52ea81[_0x0bbb('0x46')]:_0x398ad7[_0x0bbb('0x42')];if(!_0x30f1c7[_0x0bbb('0x43')][_0x0bbb('0xbf')](_0x0bbb('0x49'))){_0x52ea81['limit']=qs['limit'](_0x30f1c7[_0x0bbb('0x43')][_0x0bbb('0x2d')]);_0x52ea81[_0x0bbb('0x2b')]=qs[_0x0bbb('0x2b')](_0x30f1c7['query']['offset']);}_0x52ea81[_0x0bbb('0x4a')]=qs['sort'](_0x30f1c7[_0x0bbb('0x43')][_0x0bbb('0x4b')]);_0x52ea81['where']=qs['filters'](_[_0x0bbb('0x64')](_0x30f1c7[_0x0bbb('0x43')],_0x398ad7[_0x0bbb('0x4d')]));_0x52ea81['where'][_0x0bbb('0x62')]=_0x133540['id'];if(_0x30f1c7[_0x0bbb('0x43')][_0x0bbb('0x4e')]){_0x52ea81['where']=_[_0x0bbb('0x4f')](_0x52ea81[_0x0bbb('0x4c')],{'$or':_[_0x0bbb('0x3c')](_0x52ea81[_0x0bbb('0x46')],function(_0xee229e){var _0x26a066={};_0x26a066[_0xee229e]={'$like':'%'+_0x30f1c7[_0x0bbb('0x43')][_0x0bbb('0x4e')]+'%'};return _0x26a066;})});}_0x52ea81=_[_0x0bbb('0x4f')]({},_0x52ea81,_0x30f1c7['options']);return db[_0x0bbb('0xc1')]['count']({'where':_0x52ea81[_0x0bbb('0x4c')]})[_0x0bbb('0x36')](function(_0x3d7637){_0x44fe13['count']=_0x3d7637;if(_0x30f1c7[_0x0bbb('0x43')]['includeAll']){_0x52ea81[_0x0bbb('0x52')]=[{'model':db[_0x0bbb('0x73')],'as':'Contact','required':![]},{'model':db['User'],'as':_0x0bbb('0xc2'),'attributes':[_0x0bbb('0x38'),'fullname',_0x0bbb('0xc3')],'required':![]},{'model':db[_0x0bbb('0xc4')],'as':_0x0bbb('0xc5'),'attributes':['id',_0x0bbb('0x38'),'color'],'where':_0x30f1c7[_0x0bbb('0x43')][_0x0bbb('0xc6')]?{'id':_0x30f1c7[_0x0bbb('0x43')][_0x0bbb('0xc6')]}:undefined,'required':_0x30f1c7['query'][_0x0bbb('0xc6')]?!![]:![]}];}return db['SmsInteraction'][_0x0bbb('0x53')](_0x52ea81);})[_0x0bbb('0x36')](function(_0x368392){_0x44fe13['rows']=_0x368392;return _0x44fe13;});}})[_0x0bbb('0x36')](respondWithFilteredResult(_0x2979b1,_0x52ea81))[_0x0bbb('0x26')](handleError(_0x2979b1,null));};exports['send']=function(_0x49c7d1,_0x107644,_0x4b6ef7){var _0x915c7a,_0x2721ba,_0x4975f8;if(_[_0x0bbb('0x93')](_0x49c7d1['body'][_0x0bbb('0x59')])||_0x49c7d1['body'][_0x0bbb('0x59')]===''){throw new db[(_0x0bbb('0x91'))][(_0x0bbb('0x74'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x0bbb('0x93')](_0x49c7d1[_0x0bbb('0x59')]['to'])){throw new db[(_0x0bbb('0x91'))][(_0x0bbb('0x74'))]('to\x20is\x20mandatory');}_0x915c7a=_0x49c7d1[_0x0bbb('0x59')]['to'];return db['SmsAccount'][_0x0bbb('0x57')]({'where':{'id':_0x49c7d1[_0x0bbb('0x55')]['id']},'include':[{'model':db[_0x0bbb('0x97')],'as':'List','include':[{'model':db[_0x0bbb('0x73')],'as':_0x0bbb('0x98'),'where':{'mobile':_0x915c7a},'limit':0x1,'order':[[_0x0bbb('0x99'),_0x0bbb('0x9a')]]}]}]})['then'](handleEntityNotFound(_0x107644,null))['then'](function(_0x2a9ab7){if(_0x2a9ab7&&_0x2a9ab7[_0x0bbb('0xc7')]){_0x2721ba=_0x2a9ab7['get']({'plain':!![]});if(_0x2721ba[_0x0bbb('0xc7')]&&_0x2721ba[_0x0bbb('0xc7')]['Contacts'][_0x0bbb('0x48')]){return _0x2721ba[_0x0bbb('0xc7')]['Contacts'][0x0];}return db[_0x0bbb('0x73')][_0x0bbb('0x58')](_[_0x0bbb('0x16')](_0x49c7d1[_0x0bbb('0x59')],{'firstName':_0x915c7a,'mobile':_0x915c7a,'phone':_0x915c7a,'ListId':_0x2721ba[_0x0bbb('0x79')]}));}})['then'](handleEntityNotFound(_0x107644,null))['then'](function(_0x21c62f){if(_0x21c62f){_0x4975f8=_0x21c62f;return db[_0x0bbb('0xc1')][_0x0bbb('0x57')]({'where':{'ContactId':_0x4975f8['id'],'closed':![],'SmsAccountId':_0x2721ba['id']}})[_0x0bbb('0x36')](function(_0x8813e){if(_0x8813e){return[_0x8813e,![]];}return db[_0x0bbb('0xc1')][_0x0bbb('0x58')]({'UserId':_0x49c7d1['user']['id'],'ContactId':_0x4975f8['id'],'SmsAccountId':_0x2721ba['id'],'phone':_0x915c7a,'firstMsgDirection':'out','Messages':[_[_0x0bbb('0x4f')](_0x49c7d1[_0x0bbb('0x59')],{'read':![],'body':_0x49c7d1[_0x0bbb('0x59')][_0x0bbb('0x59')],'phone':_0x915c7a,'SmsAccountId':_0x2721ba['id'],'UserId':_0x49c7d1[_0x0bbb('0x5c')]['id'],'ContactId':_0x4975f8['id']})]},{'include':[{'model':db['SmsMessage'],'as':_0x0bbb('0xc8')}]})[_0x0bbb('0x36')](function(_0x3e691f){return[_0x3e691f,!![]];});});}})[_0x0bbb('0x9e')](function(_0x400e79,_0x42b5c9){if(_0x42b5c9){return _0x400e79;}return db[_0x0bbb('0xa5')][_0x0bbb('0x58')](_[_0x0bbb('0x4f')](_0x49c7d1[_0x0bbb('0x59')],{'read':![],'body':_0x49c7d1[_0x0bbb('0x59')]['body'],'phone':_0x915c7a,'SmsAccountId':_0x2721ba['id'],'SmsInteractionId':_0x400e79['id'],'UserId':_0x49c7d1[_0x0bbb('0x5c')]['id'],'ContactId':_0x4975f8['id']}))[_0x0bbb('0x36')](function(_0x240113){_0x400e79[_0x0bbb('0xc9')][_0x0bbb('0xc8')]=[];_0x400e79['dataValues'][_0x0bbb('0xc8')][_0x0bbb('0xca')](_0x240113['dataValues']);return _0x400e79;});})[_0x0bbb('0x36')](respondWithResult(_0x107644,null))[_0x0bbb('0x26')](handleError(_0x107644,null));};exports['status']=function(_0x3f6518,_0x64f948,_0x458d4c){if(_0x3f6518[_0x0bbb('0x59')]['id']){delete _0x3f6518[_0x0bbb('0x59')]['id'];}var _0x4d72b4,_0x45e0b0,_0x25843a;return db[_0x0bbb('0x3d')][_0x0bbb('0x57')]({'where':{'id':_0x3f6518[_0x0bbb('0x55')]['id']}})[_0x0bbb('0x36')](handleEntityNotFound(_0x64f948,null))[_0x0bbb('0x36')](function(_0x1a3ed7){if(_0x1a3ed7){_0x25843a=_0x1a3ed7;logger['debug'](_0x0bbb('0x21'),_0x0bbb('0x28'),'received\x20delivery\x20report\x20from',_0x1a3ed7['type'],util['inspect'](_0x3f6518[_0x0bbb('0x59')],{'showHidden':![],'depth':null}));switch(_0x1a3ed7[_0x0bbb('0x40')]){case _0x0bbb('0x7f'):if(_0x3f6518[_0x0bbb('0x59')][_0x0bbb('0xcb')]&&_0x3f6518[_0x0bbb('0x59')][_0x0bbb('0x28')]){_0x45e0b0=_0x3f6518['body'][_0x0bbb('0x28')];return db[_0x0bbb('0xa5')]['find']({'where':{'messageId':_0x3f6518[_0x0bbb('0x59')][_0x0bbb('0xcb')]}});}break;case _0x0bbb('0x82'):if(_0x3f6518[_0x0bbb('0x59')][_0x0bbb('0xcc')]&&_0x3f6518[_0x0bbb('0x59')][_0x0bbb('0xcd')]){_0x45e0b0=_0x3f6518[_0x0bbb('0x59')][_0x0bbb('0xcd')];return db['SmsMessage'][_0x0bbb('0x57')]({'where':{'messageId':_0x3f6518[_0x0bbb('0x59')][_0x0bbb('0xcc')]}});}break;case _0x0bbb('0x83'):if(_0x3f6518[_0x0bbb('0x59')]['message_id']&&_0x3f6518[_0x0bbb('0x59')][_0x0bbb('0xce')]){_0x45e0b0=_0x3f6518[_0x0bbb('0x59')][_0x0bbb('0xce')];return db[_0x0bbb('0xa5')][_0x0bbb('0x57')]({'where':{'messageId':_0x3f6518[_0x0bbb('0x59')][_0x0bbb('0x84')]}});}break;case _0x0bbb('0x88'):var _0x253e75=_0x3f6518[_0x0bbb('0x59')][_0x0bbb('0x89')][0x0];if(_0x253e75[_0x0bbb('0x7d')]&&_0x253e75['status'][_0x0bbb('0xcf')]===_0x0bbb('0xd0')){_0x45e0b0=_0x253e75[_0x0bbb('0x28')][_0x0bbb('0xcf')];return db[_0x0bbb('0xa5')]['find']({'where':{'messageId':_0x253e75[_0x0bbb('0x7d')]}});}break;case'clickatell':if(_0x3f6518[_0x0bbb('0x59')]['messageId']&&_0x3f6518[_0x0bbb('0x59')][_0x0bbb('0x28')]){_0x45e0b0=_0x3f6518[_0x0bbb('0x59')][_0x0bbb('0x28')];return db[_0x0bbb('0xa5')][_0x0bbb('0x57')]({'where':{'messageId':_0x3f6518[_0x0bbb('0x59')][_0x0bbb('0x7d')]}});}break;case _0x0bbb('0xd1'):if(_0x3f6518[_0x0bbb('0x59')][0x0][_0x0bbb('0x24')]['id']){_0x45e0b0=_0x3f6518['body'][0x0][_0x0bbb('0x40')];return db[_0x0bbb('0xa5')][_0x0bbb('0x57')]({'where':{'messageId':_0x3f6518['body'][0x0][_0x0bbb('0x24')]['id']}});}break;case _0x0bbb('0x8f'):if(_0x3f6518['body'][_0x0bbb('0xd2')]&&_0x3f6518[_0x0bbb('0x59')][_0x0bbb('0x28')]){_0x45e0b0=_0x3f6518[_0x0bbb('0x59')][_0x0bbb('0x28')];return db['SmsMessage'][_0x0bbb('0x57')]({'where':{'messageId':_0x3f6518[_0x0bbb('0x59')][_0x0bbb('0xd2')]}});}break;}}})[_0x0bbb('0x36')](handleEntityNotFound(_0x64f948,null))[_0x0bbb('0x36')](function(_0x438918){if(_0x438918){_0x4d72b4=_0x438918;switch(_0x25843a[_0x0bbb('0x40')]){case _0x0bbb('0x7f'):if(_0x45e0b0===_0x0bbb('0xd0')){return _0x4d72b4[_0x0bbb('0x33')]({'read':!![]});}else{logger[_0x0bbb('0x22')](_0x0bbb('0x21'),_0x0bbb('0x28'),_0x0bbb('0x7f'),util[_0x0bbb('0xd3')](_0x3f6518[_0x0bbb('0x59')],{'showHidden':![],'depth':null}));}break;case _0x0bbb('0x82'):if(_0x45e0b0==='1'){return _0x4d72b4[_0x0bbb('0x33')]({'read':!![]});}else{logger[_0x0bbb('0x22')](_0x0bbb('0x21'),_0x0bbb('0x28'),_0x0bbb('0x7f'),util['inspect'](_0x3f6518[_0x0bbb('0x59')],{'showHidden':![],'depth':null}));}break;case'clicksend':if(!_0x3f6518['body']['error_code']&&_0x45e0b0>=0xc8&&_0x45e0b0<=0xce){return _0x4d72b4[_0x0bbb('0x33')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x0bbb('0x28'),_0x0bbb('0x83'),util[_0x0bbb('0xd3')](_0x3f6518['body'],{'showHidden':![],'depth':null}));}break;case _0x0bbb('0x88'):var _0x482c1a=_0x3f6518[_0x0bbb('0x59')][_0x0bbb('0x89')][0x0];if(_0x482c1a['status'][_0x0bbb('0xcf')]===_0x0bbb('0xd0')){return _0x4d72b4['update']({'read':!![]});}else{logger['error'](_0x0bbb('0x21'),_0x0bbb('0x28'),_0x0bbb('0x88'),util[_0x0bbb('0xd3')](_0x3f6518['body'],{'showHidden':![],'depth':null}));}break;case _0x0bbb('0xd4'):if(_0x45e0b0==_0x0bbb('0xd5')||_0x45e0b0==_0x0bbb('0xd6')){return _0x4d72b4[_0x0bbb('0x33')]({'read':!![]});}else{logger[_0x0bbb('0x22')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x0bbb('0xd4'),util[_0x0bbb('0xd3')](_0x3f6518['body'],{'showHidden':![],'depth':null}));}break;case _0x0bbb('0xd1'):if(_0x45e0b0=='message-delivered'){return _0x4d72b4['update']({'read':!![]});}else{logger[_0x0bbb('0x22')](_0x0bbb('0x21'),_0x0bbb('0x28'),'bandwidth',util[_0x0bbb('0xd3')](_0x3f6518[_0x0bbb('0x59')],{'showHidden':![],'depth':null}));}break;case'intelepeer':if(_0x45e0b0==='DELIVRD'||_0x45e0b0===_0x0bbb('0xd7')){return _0x4d72b4[_0x0bbb('0x33')]({'read':!![]});}else{logger[_0x0bbb('0x22')](_0x0bbb('0x21'),_0x0bbb('0x28'),_0x0bbb('0x8f'),util[_0x0bbb('0xd3')](_0x3f6518[_0x0bbb('0x59')],{'showHidden':![],'depth':null}));}break;}return _0x4d72b4;}})[_0x0bbb('0x36')](respondWithResult(_0x64f948,null))[_0x0bbb('0x26')](handleError(_0x64f948,null));};exports[_0x0bbb('0xd8')]=function(_0x3ff5a7,_0x27523e,_0xb7b8a6){var _0x4ae484,_0x5e88fd,_0x49b5ef;return db[_0x0bbb('0x3d')][_0x0bbb('0x57')]({'where':{'id':_0x3ff5a7['params']['id']}})[_0x0bbb('0x36')](handleEntityNotFound(_0x27523e,null))[_0x0bbb('0x36')](function(_0x20f18e){if(_0x20f18e){_0x49b5ef=_0x20f18e;logger[_0x0bbb('0x20')](_0x0bbb('0x21'),'status',_0x0bbb('0xd9'),_0x20f18e['type'],util[_0x0bbb('0xd3')](_0x3ff5a7[_0x0bbb('0x43')],{'showHidden':![],'depth':null}));switch(_0x20f18e[_0x0bbb('0x40')]){case'csc':if(_0x3ff5a7[_0x0bbb('0x43')]['message-id']&&_0x3ff5a7['query'][_0x0bbb('0xda')]){_0x5e88fd=_0x3ff5a7['query'][_0x0bbb('0xda')];return db['SmsMessage'][_0x0bbb('0x57')]({'where':{'messageId':_0x3ff5a7[_0x0bbb('0x43')]['message-id']}});}break;}}})[_0x0bbb('0x36')](handleEntityNotFound(_0x27523e,null))[_0x0bbb('0x36')](function(_0x3e6e4b){if(_0x3e6e4b){_0x4ae484=_0x3e6e4b;switch(_0x49b5ef['type']){case'csc':if(_0x5e88fd==='2'||_0x5e88fd==='6'){return _0x4ae484[_0x0bbb('0x33')]({'read':!![]});}else{logger[_0x0bbb('0x22')](_0x0bbb('0x21'),_0x0bbb('0x28'),_0x0bbb('0x8a'),util[_0x0bbb('0xd3')](_0x3ff5a7[_0x0bbb('0x43')],{'showHidden':![],'depth':null}));};break;}return _0x4ae484;}})[_0x0bbb('0x36')](respondWithResult(_0x27523e,null))[_0x0bbb('0x26')](handleError(_0x27523e,null));};exports[_0x0bbb('0xdb')]=function(_0x18cfb0,_0x34218c,_0x10c4b9){return db[_0x0bbb('0x3d')][_0x0bbb('0x57')]({'where':{'id':_0x18cfb0[_0x0bbb('0x55')]['id']}})[_0x0bbb('0x36')](handleEntityNotFound(_0x34218c,null))[_0x0bbb('0x36')](function(_0x48eb61){if(_0x48eb61){return _0x48eb61[_0x0bbb('0xdb')](_0x18cfb0[_0x0bbb('0x59')][_0x0bbb('0x69')],_[_0x0bbb('0x9c')](_0x18cfb0[_0x0bbb('0x59')],[_0x0bbb('0x69'),'id'])||{})['spread'](function(_0x4b99ee){for(var _0x35546b=0x0;_0x35546b<_0x18cfb0[_0x0bbb('0x59')][_0x0bbb('0x69')][_0x0bbb('0x48')];_0x35546b+=0x1){socket[_0x0bbb('0xdc')]('userSmsAccount:save',{'UserId':Number(_0x18cfb0[_0x0bbb('0x59')][_0x0bbb('0x69')][_0x35546b]),'SmsAccountId':Number(_0x18cfb0['params']['id'])});}return _0x4b99ee;});}})['then'](respondWithResult(_0x34218c,null))[_0x0bbb('0x26')](handleError(_0x34218c,null));};exports[_0x0bbb('0xdd')]=function(_0x2d8188,_0x46ced8,_0xdfb140){return db['SmsAccount'][_0x0bbb('0x57')]({'where':{'id':_0x2d8188[_0x0bbb('0x55')]['id']}})[_0x0bbb('0x36')](handleEntityNotFound(_0x46ced8,null))['then'](function(_0x304cf0){if(_0x304cf0){return _0x304cf0[_0x0bbb('0xdd')](_0x2d8188[_0x0bbb('0x43')]['ids'])[_0x0bbb('0x36')](function(){if(_[_0x0bbb('0xde')](_0x2d8188['query'][_0x0bbb('0x69')])){for(var _0x3e33a4=0x0;_0x3e33a4<_0x2d8188['query'][_0x0bbb('0x69')][_0x0bbb('0x48')];_0x3e33a4+=0x1){socket[_0x0bbb('0xdc')](_0x0bbb('0xdf'),{'UserId':Number(_0x2d8188[_0x0bbb('0x43')][_0x0bbb('0x69')][_0x3e33a4]),'SmsAccountId':Number(_0x2d8188['params']['id'])});}}else{socket['emit'](_0x0bbb('0xdf'),{'UserId':Number(_0x2d8188[_0x0bbb('0x43')]['ids']),'SmsAccountId':Number(_0x2d8188[_0x0bbb('0x55')]['id'])});}});}})[_0x0bbb('0x36')](respondWithStatusCode(_0x46ced8,null))[_0x0bbb('0x26')](handleError(_0x46ced8,null));};exports['getAgents']=function(_0x136d68,_0xfcfa1a,_0x75501d){var _0x1b2c13={};var _0x2eb3d6={};var _0x2fdfde;var _0x4afd59;return db[_0x0bbb('0x3d')][_0x0bbb('0x63')]({'where':{'id':_0x136d68[_0x0bbb('0x55')]['id']}})['then'](handleEntityNotFound(_0xfcfa1a,null))[_0x0bbb('0x36')](function(_0x1c71f1){if(_0x1c71f1){_0x2fdfde=_0x1c71f1;_0x2eb3d6['model']=_[_0x0bbb('0x44')](db[_0x0bbb('0xa9')][_0x0bbb('0x3e')]);_0x2eb3d6[_0x0bbb('0x43')]=_['keys'](_0x136d68['query']);_0x2eb3d6[_0x0bbb('0x4d')]=_['intersection'](_0x2eb3d6[_0x0bbb('0x42')],_0x2eb3d6[_0x0bbb('0x43')]);_0x1b2c13[_0x0bbb('0x46')]=_[_0x0bbb('0x45')](_0x2eb3d6['model'],qs[_0x0bbb('0x47')](_0x136d68[_0x0bbb('0x43')]['fields']));_0x1b2c13[_0x0bbb('0x46')]=_0x1b2c13[_0x0bbb('0x46')][_0x0bbb('0x48')]?_0x1b2c13[_0x0bbb('0x46')]:_0x2eb3d6[_0x0bbb('0x42')];_0x1b2c13['order']=qs[_0x0bbb('0x4b')](_0x136d68[_0x0bbb('0x43')][_0x0bbb('0x4b')]);_0x1b2c13[_0x0bbb('0x4c')]=qs[_0x0bbb('0x4d')](_['pick'](_0x136d68[_0x0bbb('0x43')],_0x2eb3d6['filters']));if(_0x136d68[_0x0bbb('0x43')][_0x0bbb('0x4e')]){_0x1b2c13[_0x0bbb('0x4c')]=_[_0x0bbb('0x4f')](_0x1b2c13[_0x0bbb('0x4c')],{'$or':_[_0x0bbb('0x3c')](_0x1b2c13['attributes'],function(_0x1376f0){var _0x3ee9a7={};_0x3ee9a7[_0x1376f0]={'$like':'%'+_0x136d68['query'][_0x0bbb('0x4e')]+'%'};return _0x3ee9a7;})});}_0x1b2c13=_[_0x0bbb('0x4f')]({},_0x1b2c13,_0x136d68['options']);return _0x2fdfde['getAgents'](_0x1b2c13);}})[_0x0bbb('0x36')](function(_0x5a58b4){if(_0x5a58b4){_0x4afd59=_0x5a58b4['length'];if(!_0x136d68[_0x0bbb('0x43')][_0x0bbb('0xbf')](_0x0bbb('0x49'))){_0x1b2c13[_0x0bbb('0x2d')]=qs[_0x0bbb('0x2d')](_0x136d68[_0x0bbb('0x43')][_0x0bbb('0x2d')]);_0x1b2c13[_0x0bbb('0x2b')]=qs[_0x0bbb('0x2b')](_0x136d68[_0x0bbb('0x43')][_0x0bbb('0x2b')]);}return _0x2fdfde[_0x0bbb('0xe0')](_0x1b2c13);}})['then'](function(_0x15f476){if(_0x15f476){return _0x15f476?{'count':_0x4afd59,'rows':_0x15f476}:null;}})[_0x0bbb('0x36')](respondWithResult(_0xfcfa1a,null))[_0x0bbb('0x26')](handleError(_0xfcfa1a,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index 9c3c264..a261791 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 _0xe9d5=['events','../../mysqldb','SmsAccount','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports'];(function(_0x199bc4,_0x338105){var _0x136ffb=function(_0x3e7ced){while(--_0x3e7ced){_0x199bc4['push'](_0x199bc4['shift']());}};_0x136ffb(++_0x338105);}(_0xe9d5,0xbe));var _0x5e9d=function(_0x188a93,_0xaf57db){_0x188a93=_0x188a93-0x0;var _0x23b40d=_0xe9d5[_0x188a93];return _0x23b40d;};'use strict';var EventEmitter=require(_0x5e9d('0x0'));var SmsAccount=require(_0x5e9d('0x1'))['db'][_0x5e9d('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x5e9d('0x3')](0x0);var events={'afterCreate':_0x5e9d('0x4'),'afterUpdate':_0x5e9d('0x5'),'afterDestroy':'remove'};function emitEvent(_0x5748d8){return function(_0x39f483,_0x397b34,_0x2aecc7){SmsAccountEvents[_0x5e9d('0x6')](_0x5748d8+':'+_0x39f483['id'],_0x39f483);SmsAccountEvents['emit'](_0x5748d8,_0x39f483);_0x2aecc7(null);};}for(var e in events){if(events[_0x5e9d('0x7')](e)){var event=events[e];SmsAccount[_0x5e9d('0x8')](e,emitEvent(event));}}module[_0x5e9d('0x9')]=SmsAccountEvents; \ No newline at end of file +var _0xe28a=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x3be82b,_0x3ef4fb){var _0x293c0e=function(_0x6af388){while(--_0x6af388){_0x3be82b['push'](_0x3be82b['shift']());}};_0x293c0e(++_0x3ef4fb);}(_0xe28a,0x18e));var _0xae28=function(_0x43bea5,_0x3aa49f){_0x43bea5=_0x43bea5-0x0;var _0x37f65=_0xe28a[_0x43bea5];return _0x37f65;};'use strict';var EventEmitter=require(_0xae28('0x0'));var SmsAccount=require(_0xae28('0x1'))['db']['SmsAccount'];var SmsAccountEvents=new EventEmitter();SmsAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xae28('0x2'),'afterDestroy':_0xae28('0x3')};function emitEvent(_0x4967d0){return function(_0x236133,_0x5c8f0c,_0x522200){SmsAccountEvents[_0xae28('0x4')](_0x4967d0+':'+_0x236133['id'],_0x236133);SmsAccountEvents[_0xae28('0x4')](_0x4967d0,_0x236133);_0x522200(null);};}for(var e in events){if(events[_0xae28('0x5')](e)){var event=events[e];SmsAccount[_0xae28('0x6')](e,emitEvent(event));}}module[_0xae28('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 8df5f8b..3da96e4 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 _0xd370=['api','bluebird','request-promise','path','rimraf','./smsAccount.attributes','exports','SmsAccount','sms_accounts','lodash','util','../../config/logger'];(function(_0x5b24e7,_0x171047){var _0x5f20cb=function(_0x5b5103){while(--_0x5b5103){_0x5b24e7['push'](_0x5b24e7['shift']());}};_0x5f20cb(++_0x171047);}(_0xd370,0xd5));var _0x0d37=function(_0x5e9396,_0x161fdd){_0x5e9396=_0x5e9396-0x0;var _0x4172e3=_0xd370[_0x5e9396];return _0x4172e3;};'use strict';var _=require(_0x0d37('0x0'));var util=require(_0x0d37('0x1'));var logger=require(_0x0d37('0x2'))(_0x0d37('0x3'));var moment=require('moment');var BPromise=require(_0x0d37('0x4'));var rp=require(_0x0d37('0x5'));var fs=require('fs');var path=require(_0x0d37('0x6'));var rimraf=require(_0x0d37('0x7'));var config=require('../../config/environment');var attributes=require(_0x0d37('0x8'));module[_0x0d37('0x9')]=function(_0x4bff61,_0x63e014){return _0x4bff61['define'](_0x0d37('0xa'),attributes,{'tableName':_0x0d37('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0561=['path','../../config/environment','./smsAccount.attributes','exports','define','SmsAccount','sms_accounts','lodash','util','api','moment','bluebird'];(function(_0x341e0f,_0x4a09d0){var _0x59555a=function(_0x4343a8){while(--_0x4343a8){_0x341e0f['push'](_0x341e0f['shift']());}};_0x59555a(++_0x4a09d0);}(_0x0561,0x1cf));var _0x1056=function(_0x41bebc,_0x270354){_0x41bebc=_0x41bebc-0x0;var _0x2453fd=_0x0561[_0x41bebc];return _0x2453fd;};'use strict';var _=require(_0x1056('0x0'));var util=require(_0x1056('0x1'));var logger=require('../../config/logger')(_0x1056('0x2'));var moment=require(_0x1056('0x3'));var BPromise=require(_0x1056('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1056('0x5'));var rimraf=require('rimraf');var config=require(_0x1056('0x6'));var attributes=require(_0x1056('0x7'));module[_0x1056('0x8')]=function(_0x352314,_0x45159c){return _0x352314[_0x1056('0x9')](_0x1056('0xa'),attributes,{'tableName':_0x1056('0xb'),'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 ecf82c8..b58ba06 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 _0xee7e=['socket.io-emitter','./smsAccount.socket','register','request','info','request\x20sent','debug','error','code','message','SmsAccount,\x20%s,\x20%s','catch','SmsAccount','find','options','raw','map','model','attributes','include','ShowSmsAccount','stringify','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','redis','localhost'];(function(_0x4c49da,_0x5bf4a5){var _0x165067=function(_0xd559f1){while(--_0xd559f1){_0x4c49da['push'](_0x4c49da['shift']());}};_0x165067(++_0x5bf4a5);}(_0xee7e,0x12e));var _0xeee7=function(_0xeccbfe,_0x46c617){_0xeccbfe=_0xeccbfe-0x0;var _0x5835e8=_0xee7e[_0xeccbfe];return _0x5835e8;};'use strict';var _=require(_0xeee7('0x0'));var util=require(_0xeee7('0x1'));var moment=require(_0xeee7('0x2'));var BPromise=require(_0xeee7('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xeee7('0x4'));var db=require(_0xeee7('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xeee7('0x6'))(_0xeee7('0x7'));var config=require(_0xeee7('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xeee7('0x9')][_0xeee7('0xa')]({'port':0x232a});config[_0xeee7('0xb')]=_['defaults'](config[_0xeee7('0xb')],{'host':_0xeee7('0xc'),'port':0x18eb});var socket=require(_0xeee7('0xd'))(new Redis(config[_0xeee7('0xb')]));require(_0xeee7('0xe'))[_0xeee7('0xf')](socket);function respondWithRpcPromise(_0x469d1f,_0x421356,_0x159aaf){return new BPromise(function(_0x41ee25,_0x34852f){return client[_0xeee7('0x10')](_0x469d1f,_0x159aaf)['then'](function(_0x407ed9){logger[_0xeee7('0x11')]('SmsAccount,\x20%s,\x20%s',_0x421356,_0xeee7('0x12'));logger[_0xeee7('0x13')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x421356,_0xeee7('0x12'),JSON['stringify'](_0x407ed9));if(_0x407ed9['error']){if(_0x407ed9[_0xeee7('0x14')][_0xeee7('0x15')]===0x1f4){logger[_0xeee7('0x14')]('SmsAccount,\x20%s,\x20%s',_0x421356,_0x407ed9[_0xeee7('0x14')][_0xeee7('0x16')]);return _0x34852f(_0x407ed9[_0xeee7('0x14')][_0xeee7('0x16')]);}logger[_0xeee7('0x14')](_0xeee7('0x17'),_0x421356,_0x407ed9[_0xeee7('0x14')][_0xeee7('0x16')]);return _0x41ee25(_0x407ed9[_0xeee7('0x14')]['message']);}else{logger[_0xeee7('0x11')]('SmsAccount,\x20%s,\x20%s',_0x421356,'request\x20sent');_0x41ee25(_0x407ed9['result']['message']);}})[_0xeee7('0x18')](function(_0x50275a){logger['error'](_0xeee7('0x17'),_0x421356,_0x50275a);_0x34852f(_0x50275a);});});}exports['ShowSmsAccount']=function(_0x104abe){var _0x45c430=this;return new Promise(function(_0x913d87,_0x6c1af4){return db[_0xeee7('0x19')][_0xeee7('0x1a')]({'raw':_0x104abe[_0xeee7('0x1b')]?_0x104abe[_0xeee7('0x1b')][_0xeee7('0x1c')]===undefined?!![]:![]:!![],'where':_0x104abe['options']?_0x104abe[_0xeee7('0x1b')]['where']||null:null,'attributes':_0x104abe[_0xeee7('0x1b')]?_0x104abe['options']['attributes']||null:null,'include':_0x104abe['options']?_0x104abe['options']['include']?_[_0xeee7('0x1d')](_0x104abe[_0xeee7('0x1b')]['include'],function(_0x4e911a){return{'model':db[_0x4e911a[_0xeee7('0x1e')]],'as':_0x4e911a['as'],'attributes':_0x4e911a[_0xeee7('0x1f')],'include':_0x4e911a[_0xeee7('0x20')]?_['map'](_0x4e911a[_0xeee7('0x20')],function(_0x350edd){return{'model':db[_0x350edd['model']],'as':_0x350edd['as'],'attributes':_0x350edd[_0xeee7('0x1f')],'include':_0x350edd[_0xeee7('0x20')]?_['map'](_0x350edd[_0xeee7('0x20')],function(_0x2cb7a0){return{'model':db[_0x2cb7a0[_0xeee7('0x1e')]],'as':_0x2cb7a0['as'],'attributes':_0x2cb7a0[_0xeee7('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x51504b){logger[_0xeee7('0x11')](_0xeee7('0x21'),_0x104abe);logger[_0xeee7('0x13')](_0xeee7('0x21'),_0x104abe,JSON[_0xeee7('0x22')](_0x51504b));_0x913d87(_0x51504b);})[_0xeee7('0x18')](function(_0x2b9996){logger[_0xeee7('0x14')]('ShowSmsAccount',_0x2b9996[_0xeee7('0x16')],_0x104abe);_0x6c1af4(_0x45c430['error'](0x1f4,_0x2b9996[_0xeee7('0x16')]));});});}; \ No newline at end of file +var _0x0474=['result','SmsAccount','find','options','where','include','model','attributes','ShowSmsAccount','debug','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','register','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0xc4001c,_0x1bf8f0){var _0x49f7bc=function(_0x1059b8){while(--_0x1059b8){_0xc4001c['push'](_0xc4001c['shift']());}};_0x49f7bc(++_0x1bf8f0);}(_0x0474,0x1d9));var _0x4047=function(_0x49e975,_0x333536){_0x49e975=_0x49e975-0x0;var _0x2df4f8=_0x0474[_0x49e975];return _0x2df4f8;};'use strict';var _=require('lodash');var util=require(_0x4047('0x0'));var moment=require(_0x4047('0x1'));var BPromise=require(_0x4047('0x2'));var rs=require(_0x4047('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4047('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x4047('0x5'))('rpc');var config=require(_0x4047('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x4047('0x7')]['http']({'port':0x232a});config[_0x4047('0x8')]=_[_0x4047('0x9')](config['redis'],{'host':_0x4047('0xa'),'port':0x18eb});var socket=require(_0x4047('0xb'))(new Redis(config[_0x4047('0x8')]));require('./smsAccount.socket')[_0x4047('0xc')](socket);function respondWithRpcPromise(_0x17ec1d,_0x546492,_0x1e7cd5){return new BPromise(function(_0x57da2e,_0xc7bf0b){return client[_0x4047('0xd')](_0x17ec1d,_0x1e7cd5)[_0x4047('0xe')](function(_0x58ad84){logger[_0x4047('0xf')](_0x4047('0x10'),_0x546492,'request\x20sent');logger['debug']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x546492,_0x4047('0x11'),JSON[_0x4047('0x12')](_0x58ad84));if(_0x58ad84['error']){if(_0x58ad84[_0x4047('0x13')][_0x4047('0x14')]===0x1f4){logger['error'](_0x4047('0x10'),_0x546492,_0x58ad84['error'][_0x4047('0x15')]);return _0xc7bf0b(_0x58ad84[_0x4047('0x13')][_0x4047('0x15')]);}logger[_0x4047('0x13')](_0x4047('0x10'),_0x546492,_0x58ad84[_0x4047('0x13')][_0x4047('0x15')]);return _0x57da2e(_0x58ad84[_0x4047('0x13')][_0x4047('0x15')]);}else{logger['info'](_0x4047('0x10'),_0x546492,'request\x20sent');_0x57da2e(_0x58ad84[_0x4047('0x16')][_0x4047('0x15')]);}})['catch'](function(_0x393626){logger[_0x4047('0x13')](_0x4047('0x10'),_0x546492,_0x393626);_0xc7bf0b(_0x393626);});});}exports['ShowSmsAccount']=function(_0x5bf353){var _0x393767=this;return new Promise(function(_0x1f4af5,_0x438a58){return db[_0x4047('0x17')][_0x4047('0x18')]({'raw':_0x5bf353['options']?_0x5bf353['options']['raw']===undefined?!![]:![]:!![],'where':_0x5bf353[_0x4047('0x19')]?_0x5bf353[_0x4047('0x19')][_0x4047('0x1a')]||null:null,'attributes':_0x5bf353[_0x4047('0x19')]?_0x5bf353[_0x4047('0x19')]['attributes']||null:null,'include':_0x5bf353[_0x4047('0x19')]?_0x5bf353['options']['include']?_['map'](_0x5bf353[_0x4047('0x19')][_0x4047('0x1b')],function(_0x1a2fb5){return{'model':db[_0x1a2fb5[_0x4047('0x1c')]],'as':_0x1a2fb5['as'],'attributes':_0x1a2fb5['attributes'],'include':_0x1a2fb5['include']?_['map'](_0x1a2fb5[_0x4047('0x1b')],function(_0x4c0569){return{'model':db[_0x4c0569['model']],'as':_0x4c0569['as'],'attributes':_0x4c0569[_0x4047('0x1d')],'include':_0x4c0569['include']?_['map'](_0x4c0569[_0x4047('0x1b')],function(_0x3a1a39){return{'model':db[_0x3a1a39[_0x4047('0x1c')]],'as':_0x3a1a39['as'],'attributes':_0x3a1a39[_0x4047('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x4047('0xe')](function(_0x16881b){logger[_0x4047('0xf')](_0x4047('0x1e'),_0x5bf353);logger[_0x4047('0x1f')](_0x4047('0x1e'),_0x5bf353,JSON['stringify'](_0x16881b));_0x1f4af5(_0x16881b);})[_0x4047('0x20')](function(_0x56c2bd){logger[_0x4047('0x13')](_0x4047('0x1e'),_0x56c2bd['message'],_0x5bf353);_0x438a58(_0x393767['error'](0x1f4,_0x56c2bd[_0x4047('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 9d49f00..bf899a1 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(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xa9e0[_0x24237f];return _0x48298e;};'use strict';var SmsAccountEvents=require(_0x0a9e('0x0'));var events=[_0x0a9e('0x1'),_0x0a9e('0x2'),'update'];function createListener(_0x550fbc,_0x18d5c9){return function(_0x4ce2f1){_0x18d5c9[_0x0a9e('0x3')](_0x550fbc,_0x4ce2f1);};}function removeListener(_0x432180,_0x2ab90b){return function(){SmsAccountEvents[_0x0a9e('0x4')](_0x432180,_0x2ab90b);};}exports[_0x0a9e('0x5')]=function(_0x57b080){for(var _0x219af0=0x0,_0x441e3a=events[_0x0a9e('0x6')];_0x219af0<_0x441e3a;_0x219af0++){var _0x5f41ea=events[_0x219af0];var _0x503809=createListener(_0x0a9e('0x7')+_0x5f41ea,_0x57b080);SmsAccountEvents['on'](_0x5f41ea,_0x503809);}}; \ No newline at end of file +var _0xa9e0=['register','length','smsAccount:','./smsAccount.events','save','remove','emit','removeListener'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0xa9e0[_0x5c351c];return _0x26f3b3;};'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 64e136d..e9eaf63 100644 --- a/server/api/smsApplication/index.js +++ b/server/api/smsApplication/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3e74=['path','connect-timeout','express','../../components/auth/service','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete','exports','multer'];(function(_0x6dce5e,_0x1fcf30){var _0x380732=function(_0x33bdd9){while(--_0x33bdd9){_0x6dce5e['push'](_0x6dce5e['shift']());}};_0x380732(++_0x1fcf30);}(_0x3e74,0x175));var _0x43e7=function(_0x210fc8,_0x390b04){_0x210fc8=_0x210fc8-0x0;var _0x4e9b53=_0x3e74[_0x210fc8];return _0x4e9b53;};'use strict';var multer=require(_0x43e7('0x0'));var util=require('util');var path=require(_0x43e7('0x1'));var timeout=require(_0x43e7('0x2'));var express=require(_0x43e7('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x43e7('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x43e7('0x5'));var controller=require(_0x43e7('0x6'));router[_0x43e7('0x7')]('/',auth[_0x43e7('0x8')](),controller[_0x43e7('0x9')]);router['get'](_0x43e7('0xa'),auth[_0x43e7('0x8')](),controller[_0x43e7('0xb')]);router[_0x43e7('0xc')]('/',auth[_0x43e7('0x8')](),controller['create']);router[_0x43e7('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x43e7('0xe')]);router[_0x43e7('0xf')]('/:id',auth[_0x43e7('0x8')](),controller['destroy']);module[_0x43e7('0x10')]=router; \ No newline at end of file +var _0x3e74=['path','connect-timeout','express','../../components/auth/service','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete','exports','multer'];(function(_0x1eac9b,_0x24bf2f){var _0x33dfd6=function(_0x5ba3bc){while(--_0x5ba3bc){_0x1eac9b['push'](_0x1eac9b['shift']());}};_0x33dfd6(++_0x24bf2f);}(_0x3e74,0x175));var _0x43e7=function(_0x2e962c,_0x3351d0){_0x2e962c=_0x2e962c-0x0;var _0x5775e9=_0x3e74[_0x2e962c];return _0x5775e9;};'use strict';var multer=require(_0x43e7('0x0'));var util=require('util');var path=require(_0x43e7('0x1'));var timeout=require(_0x43e7('0x2'));var express=require(_0x43e7('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x43e7('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x43e7('0x5'));var controller=require(_0x43e7('0x6'));router[_0x43e7('0x7')]('/',auth[_0x43e7('0x8')](),controller[_0x43e7('0x9')]);router['get'](_0x43e7('0xa'),auth[_0x43e7('0x8')](),controller[_0x43e7('0xb')]);router[_0x43e7('0xc')]('/',auth[_0x43e7('0x8')](),controller['create']);router[_0x43e7('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x43e7('0xe')]);router[_0x43e7('0xf')]('/:id',auth[_0x43e7('0x8')](),controller['destroy']);module[_0x43e7('0x10')]=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index 6e80169..3758c23 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 _0xd95b=['sequelize','exports','STRING','noop','TEXT','*,*,*,*'];(function(_0x42c8e0,_0x1c74f0){var _0x4b2aa6=function(_0x434445){while(--_0x434445){_0x42c8e0['push'](_0x42c8e0['shift']());}};_0x4b2aa6(++_0x1c74f0);}(_0xd95b,0x174));var _0xbd95=function(_0x144387,_0x531220){_0x144387=_0x144387-0x0;var _0x560f6b=_0xd95b[_0x144387];return _0x560f6b;};'use strict';var Sequelize=require(_0xbd95('0x0'));module[_0xbd95('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xbd95('0x2')],'allowNull':![],'defaultValue':_0xbd95('0x3')},'appdata':{'type':Sequelize[_0xbd95('0x4')]()},'description':{'type':Sequelize[_0xbd95('0x2')]},'interval':{'type':Sequelize[_0xbd95('0x2')],'defaultValue':_0xbd95('0x5')}}; \ No newline at end of file +var _0x004b=['STRING','noop','TEXT','*,*,*,*','sequelize','exports'];(function(_0x56a061,_0x53fb1b){var _0x105fa0=function(_0x164d08){while(--_0x164d08){_0x56a061['push'](_0x56a061['shift']());}};_0x105fa0(++_0x53fb1b);}(_0x004b,0xca));var _0xb004=function(_0x5f1bf3,_0x23afe3){_0x5f1bf3=_0x5f1bf3-0x0;var _0x209b70=_0x004b[_0x5f1bf3];return _0x209b70;};'use strict';var Sequelize=require(_0xb004('0x0'));module[_0xb004('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xb004('0x2')],'allowNull':![],'defaultValue':_0xb004('0x3')},'appdata':{'type':Sequelize[_0xb004('0x4')]()},'description':{'type':Sequelize[_0xb004('0x2')]},'interval':{'type':Sequelize[_0xb004('0x2')],'defaultValue':_0xb004('0x5')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index d08937b..e239d18 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 _0x0a03=['hasOwnProperty','limit','order','sort','filter','where','type','merge','options','includeAll','include','findAll','catch','show','params','find','create','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','reject','save','update','then','destroy','stack','name','send','index','map','SmsApplication','rawAttributes','fieldName','key','model','keys','query','filters','intersection','fields','attributes','length'];(function(_0x58bf27,_0x30815a){var _0x100cc8=function(_0x10aeeb){while(--_0x10aeeb){_0x58bf27['push'](_0x58bf27['shift']());}};_0x100cc8(++_0x30815a);}(_0x0a03,0x189));var _0x30a0=function(_0x234140,_0x43a512){_0x234140=_0x234140-0x0;var _0x561958=_0x0a03[_0x234140];return _0x561958;};'use strict';var emlformat=require(_0x30a0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x30a0('0x1'));var jsonpatch=require(_0x30a0('0x2'));var rp=require(_0x30a0('0x3'));var moment=require(_0x30a0('0x4'));var BPromise=require(_0x30a0('0x5'));var Mustache=require(_0x30a0('0x6'));var util=require(_0x30a0('0x7'));var path=require(_0x30a0('0x8'));var sox=require(_0x30a0('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x30a0('0xa'));var _=require('lodash');var squel=require(_0x30a0('0xb'));var crypto=require(_0x30a0('0xc'));var jsforce=require(_0x30a0('0xd'));var deskjs=require(_0x30a0('0xe'));var toCsv=require(_0x30a0('0xf'));var querystring=require(_0x30a0('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x30a0('0x11'));var qs=require(_0x30a0('0x12'));var as=require(_0x30a0('0x13'));var hardwareService=require(_0x30a0('0x14'));var logger=require(_0x30a0('0x15'))(_0x30a0('0x16'));var utils=require(_0x30a0('0x17'));var config=require(_0x30a0('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x30a0('0x19'))['db'];function respondWithStatusCode(_0x4efc52,_0x54295c){_0x54295c=_0x54295c||0xcc;return function(_0x30706d){if(_0x30706d){return _0x4efc52[_0x30a0('0x1a')](_0x54295c);}return _0x4efc52[_0x30a0('0x1b')](_0x54295c)[_0x30a0('0x1c')]();};}function respondWithResult(_0x56ca81,_0x3589c0){_0x3589c0=_0x3589c0||0xc8;return function(_0x43ee63){if(_0x43ee63){return _0x56ca81[_0x30a0('0x1b')](_0x3589c0)[_0x30a0('0x1d')](_0x43ee63);}};}function respondWithFilteredResult(_0x52196e,_0x133291){return function(_0xd55505){if(_0xd55505){var _0x537a06=typeof _0x133291[_0x30a0('0x1e')]===_0x30a0('0x1f')&&typeof _0x133291['limit']===_0x30a0('0x1f');var _0x320fc7=_0xd55505[_0x30a0('0x20')];var _0x545a7b=_0x537a06?0x0:_0x133291['offset'];var _0x4552a0=_0x537a06?_0xd55505[_0x30a0('0x20')]:_0x133291[_0x30a0('0x1e')]+_0x133291['limit'];var _0x52b51f;if(_0x4552a0>=_0x320fc7){_0x4552a0=_0x320fc7;_0x52b51f=0xc8;}else{_0x52b51f=0xce;}_0x52196e['status'](_0x52b51f);return _0x52196e[_0x30a0('0x21')](_0x30a0('0x22'),_0x545a7b+'-'+_0x4552a0+'/'+_0x320fc7)[_0x30a0('0x1d')](_0xd55505);}return null;};}function patchUpdates(_0x4146a4){return function(_0x1b74e1){try{jsonpatch['apply'](_0x1b74e1,_0x4146a4,!![]);}catch(_0x580a97){return BPromise[_0x30a0('0x23')](_0x580a97);}return _0x1b74e1[_0x30a0('0x24')]();};}function saveUpdates(_0x49046a,_0x2bec68){return function(_0x17a6d3){if(_0x17a6d3){return _0x17a6d3[_0x30a0('0x25')](_0x49046a)[_0x30a0('0x26')](function(_0x4c1b62){return _0x4c1b62;});}return null;};}function removeEntity(_0x2c39fe,_0x5c605f){return function(_0x975bcb){if(_0x975bcb){return _0x975bcb[_0x30a0('0x27')]()[_0x30a0('0x26')](function(){_0x2c39fe[_0x30a0('0x1b')](0xcc)[_0x30a0('0x1c')]();});}};}function handleEntityNotFound(_0x307a74,_0x896d75){return function(_0xec94c0){if(!_0xec94c0){_0x307a74[_0x30a0('0x1a')](0x194);}return _0xec94c0;};}function handleError(_0xf58085,_0x40aa15){_0x40aa15=_0x40aa15||0x1f4;return function(_0x1dd8e0){logger['error'](_0x1dd8e0[_0x30a0('0x28')]);if(_0x1dd8e0[_0x30a0('0x29')]){delete _0x1dd8e0[_0x30a0('0x29')];}_0xf58085['status'](_0x40aa15)[_0x30a0('0x2a')](_0x1dd8e0);};}exports[_0x30a0('0x2b')]=function(_0x28232a,_0x524d89){var _0x16d6c7={},_0x282a6d={},_0x5dc6bb={'count':0x0,'rows':[]};var _0x39141c=_[_0x30a0('0x2c')](db[_0x30a0('0x2d')][_0x30a0('0x2e')],function(_0x316dd2){return{'name':_0x316dd2[_0x30a0('0x2f')],'type':_0x316dd2['type'][_0x30a0('0x30')]};});_0x282a6d[_0x30a0('0x31')]=_[_0x30a0('0x2c')](_0x39141c,_0x30a0('0x29'));_0x282a6d['query']=_[_0x30a0('0x32')](_0x28232a[_0x30a0('0x33')]);_0x282a6d[_0x30a0('0x34')]=_[_0x30a0('0x35')](_0x282a6d[_0x30a0('0x31')],_0x282a6d['query']);_0x16d6c7['attributes']=_[_0x30a0('0x35')](_0x282a6d[_0x30a0('0x31')],qs[_0x30a0('0x36')](_0x28232a[_0x30a0('0x33')][_0x30a0('0x36')]));_0x16d6c7[_0x30a0('0x37')]=_0x16d6c7[_0x30a0('0x37')][_0x30a0('0x38')]?_0x16d6c7[_0x30a0('0x37')]:_0x282a6d[_0x30a0('0x31')];if(!_0x28232a[_0x30a0('0x33')][_0x30a0('0x39')]('nolimit')){_0x16d6c7[_0x30a0('0x3a')]=qs[_0x30a0('0x3a')](_0x28232a[_0x30a0('0x33')][_0x30a0('0x3a')]);_0x16d6c7[_0x30a0('0x1e')]=qs[_0x30a0('0x1e')](_0x28232a['query'][_0x30a0('0x1e')]);}_0x16d6c7[_0x30a0('0x3b')]=qs[_0x30a0('0x3c')](_0x28232a[_0x30a0('0x33')][_0x30a0('0x3c')]);_0x16d6c7['where']=qs[_0x30a0('0x34')](_['pick'](_0x28232a[_0x30a0('0x33')],_0x282a6d[_0x30a0('0x34')]),_0x39141c);if(_0x28232a[_0x30a0('0x33')][_0x30a0('0x3d')]){_0x16d6c7[_0x30a0('0x3e')]=_['merge'](_0x16d6c7['where'],{'$or':_[_0x30a0('0x2c')](_0x39141c,function(_0x17c52e){if(_0x17c52e[_0x30a0('0x3f')]!=='VIRTUAL'){var _0x5d59bd={};_0x5d59bd[_0x17c52e['name']]={'$like':'%'+_0x28232a[_0x30a0('0x33')][_0x30a0('0x3d')]+'%'};return _0x5d59bd;}})});}_0x16d6c7=_[_0x30a0('0x40')]({},_0x16d6c7,_0x28232a[_0x30a0('0x41')]);var _0x48f1dc={'where':_0x16d6c7[_0x30a0('0x3e')]};return db[_0x30a0('0x2d')][_0x30a0('0x20')](_0x48f1dc)['then'](function(_0x3c8a19){_0x5dc6bb[_0x30a0('0x20')]=_0x3c8a19;if(_0x28232a[_0x30a0('0x33')][_0x30a0('0x42')]){_0x16d6c7[_0x30a0('0x43')]=[{'all':!![]}];}return db[_0x30a0('0x2d')][_0x30a0('0x44')](_0x16d6c7);})[_0x30a0('0x26')](function(_0x51c0ff){_0x5dc6bb['rows']=_0x51c0ff;return _0x5dc6bb;})[_0x30a0('0x26')](respondWithFilteredResult(_0x524d89,_0x16d6c7))[_0x30a0('0x45')](handleError(_0x524d89,null));};exports[_0x30a0('0x46')]=function(_0xf54923,_0x25dde9){var _0x8c8e73={'raw':!![],'where':{'id':_0xf54923[_0x30a0('0x47')]['id']}},_0x13f72d={};_0x13f72d[_0x30a0('0x31')]=_['keys'](db[_0x30a0('0x2d')][_0x30a0('0x2e')]);_0x13f72d['query']=_['keys'](_0xf54923[_0x30a0('0x33')]);_0x13f72d[_0x30a0('0x34')]=_[_0x30a0('0x35')](_0x13f72d[_0x30a0('0x31')],_0x13f72d[_0x30a0('0x33')]);_0x8c8e73[_0x30a0('0x37')]=_[_0x30a0('0x35')](_0x13f72d[_0x30a0('0x31')],qs[_0x30a0('0x36')](_0xf54923[_0x30a0('0x33')][_0x30a0('0x36')]));_0x8c8e73[_0x30a0('0x37')]=_0x8c8e73[_0x30a0('0x37')][_0x30a0('0x38')]?_0x8c8e73[_0x30a0('0x37')]:_0x13f72d[_0x30a0('0x31')];if(_0xf54923[_0x30a0('0x33')][_0x30a0('0x42')]){_0x8c8e73[_0x30a0('0x43')]=[{'all':!![]}];}_0x8c8e73=_['merge']({},_0x8c8e73,_0xf54923[_0x30a0('0x41')]);return db[_0x30a0('0x2d')][_0x30a0('0x48')](_0x8c8e73)['then'](handleEntityNotFound(_0x25dde9,null))[_0x30a0('0x26')](respondWithResult(_0x25dde9,null))['catch'](handleError(_0x25dde9,null));};exports[_0x30a0('0x49')]=function(_0x36618e,_0x50b1f8){return db[_0x30a0('0x2d')][_0x30a0('0x49')](_0x36618e[_0x30a0('0x4a')],{})['then'](respondWithResult(_0x50b1f8,0xc9))['catch'](handleError(_0x50b1f8,null));};exports['update']=function(_0x9f597c,_0x316095){if(_0x9f597c[_0x30a0('0x4a')]['id']){delete _0x9f597c[_0x30a0('0x4a')]['id'];}return db['SmsApplication'][_0x30a0('0x48')]({'where':{'id':_0x9f597c[_0x30a0('0x47')]['id']}})['then'](handleEntityNotFound(_0x316095,null))[_0x30a0('0x26')](saveUpdates(_0x9f597c[_0x30a0('0x4a')],null))[_0x30a0('0x26')](respondWithResult(_0x316095,null))['catch'](handleError(_0x316095,null));};exports[_0x30a0('0x27')]=function(_0x4af733,_0x7b16a0){return db[_0x30a0('0x2d')][_0x30a0('0x48')]({'where':{'id':_0x4af733[_0x30a0('0x47')]['id']}})[_0x30a0('0x26')](handleEntityNotFound(_0x7b16a0,null))[_0x30a0('0x26')](removeEntity(_0x7b16a0,null))[_0x30a0('0x45')](handleError(_0x7b16a0,null));}; \ No newline at end of file +var _0x2309=['eml-format','rimraf','zip-dir','request-promise','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/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','error','name','index','SmsApplication','rawAttributes','fieldName','type','model','map','keys','query','intersection','fields','attributes','length','order','sort','filters','filter','where','VIRTUAL','merge','include','findAll','rows','catch','show','params','find','create','body','update'];(function(_0x3f22e8,_0x37732a){var _0x368a7e=function(_0x35f538){while(--_0x35f538){_0x3f22e8['push'](_0x3f22e8['shift']());}};_0x368a7e(++_0x37732a);}(_0x2309,0x1a4));var _0x9230=function(_0x4019e3,_0x3e7ce5){_0x4019e3=_0x4019e3-0x0;var _0x1a8c81=_0x2309[_0x4019e3];return _0x1a8c81;};'use strict';var emlformat=require(_0x9230('0x0'));var rimraf=require(_0x9230('0x1'));var zipdir=require(_0x9230('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9230('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x9230('0x4'));var path=require(_0x9230('0x5'));var sox=require(_0x9230('0x6'));var csv=require(_0x9230('0x7'));var ejs=require(_0x9230('0x8'));var fs=require('fs');var fs_extra=require(_0x9230('0x9'));var _=require(_0x9230('0xa'));var squel=require(_0x9230('0xb'));var crypto=require(_0x9230('0xc'));var jsforce=require(_0x9230('0xd'));var deskjs=require(_0x9230('0xe'));var toCsv=require('to-csv');var querystring=require(_0x9230('0xf'));var Papa=require(_0x9230('0x10'));var Redis=require(_0x9230('0x11'));var authService=require(_0x9230('0x12'));var qs=require(_0x9230('0x13'));var as=require(_0x9230('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9230('0x15'))(_0x9230('0x16'));var utils=require('../../config/utils');var config=require(_0x9230('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x9230('0x18'))['db'];function respondWithStatusCode(_0x56ee79,_0x569e14){_0x569e14=_0x569e14||0xcc;return function(_0x5e3b37){if(_0x5e3b37){return _0x56ee79[_0x9230('0x19')](_0x569e14);}return _0x56ee79[_0x9230('0x1a')](_0x569e14)[_0x9230('0x1b')]();};}function respondWithResult(_0x6dd0f9,_0x2a0f56){_0x2a0f56=_0x2a0f56||0xc8;return function(_0x5cbb59){if(_0x5cbb59){return _0x6dd0f9[_0x9230('0x1a')](_0x2a0f56)[_0x9230('0x1c')](_0x5cbb59);}};}function respondWithFilteredResult(_0x5a30c7,_0x4e282d){return function(_0x3a32e5){if(_0x3a32e5){var _0x5f368b=typeof _0x4e282d[_0x9230('0x1d')]===_0x9230('0x1e')&&typeof _0x4e282d[_0x9230('0x1f')]==='undefined';var _0x569f5a=_0x3a32e5[_0x9230('0x20')];var _0x1db1ea=_0x5f368b?0x0:_0x4e282d[_0x9230('0x1d')];var _0x8bceb=_0x5f368b?_0x3a32e5[_0x9230('0x20')]:_0x4e282d[_0x9230('0x1d')]+_0x4e282d[_0x9230('0x1f')];var _0x3afe64;if(_0x8bceb>=_0x569f5a){_0x8bceb=_0x569f5a;_0x3afe64=0xc8;}else{_0x3afe64=0xce;}_0x5a30c7[_0x9230('0x1a')](_0x3afe64);return _0x5a30c7[_0x9230('0x21')](_0x9230('0x22'),_0x1db1ea+'-'+_0x8bceb+'/'+_0x569f5a)[_0x9230('0x1c')](_0x3a32e5);}return null;};}function patchUpdates(_0x375fa0){return function(_0x48952c){try{jsonpatch[_0x9230('0x23')](_0x48952c,_0x375fa0,!![]);}catch(_0x5f157e){return BPromise['reject'](_0x5f157e);}return _0x48952c[_0x9230('0x24')]();};}function saveUpdates(_0x2057d4,_0x281181){return function(_0x20953c){if(_0x20953c){return _0x20953c['update'](_0x2057d4)[_0x9230('0x25')](function(_0x2b9544){return _0x2b9544;});}return null;};}function removeEntity(_0x35e3a1,_0x126b03){return function(_0x311e40){if(_0x311e40){return _0x311e40['destroy']()[_0x9230('0x25')](function(){_0x35e3a1[_0x9230('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x246606,_0x2e9114){return function(_0xe78c86){if(!_0xe78c86){_0x246606['sendStatus'](0x194);}return _0xe78c86;};}function handleError(_0xcf590a,_0x3852a3){_0x3852a3=_0x3852a3||0x1f4;return function(_0x2e427c){logger[_0x9230('0x26')](_0x2e427c['stack']);if(_0x2e427c[_0x9230('0x27')]){delete _0x2e427c[_0x9230('0x27')];}_0xcf590a['status'](_0x3852a3)['send'](_0x2e427c);};}exports[_0x9230('0x28')]=function(_0x7b8713,_0x56c751){var _0x3dd44f={},_0x30b451={},_0x319e1d={'count':0x0,'rows':[]};var _0x1d87c9=_['map'](db[_0x9230('0x29')][_0x9230('0x2a')],function(_0x1e731a){return{'name':_0x1e731a[_0x9230('0x2b')],'type':_0x1e731a[_0x9230('0x2c')]['key']};});_0x30b451[_0x9230('0x2d')]=_[_0x9230('0x2e')](_0x1d87c9,_0x9230('0x27'));_0x30b451['query']=_[_0x9230('0x2f')](_0x7b8713[_0x9230('0x30')]);_0x30b451['filters']=_[_0x9230('0x31')](_0x30b451['model'],_0x30b451[_0x9230('0x30')]);_0x3dd44f['attributes']=_['intersection'](_0x30b451[_0x9230('0x2d')],qs[_0x9230('0x32')](_0x7b8713[_0x9230('0x30')]['fields']));_0x3dd44f[_0x9230('0x33')]=_0x3dd44f['attributes'][_0x9230('0x34')]?_0x3dd44f[_0x9230('0x33')]:_0x30b451[_0x9230('0x2d')];if(!_0x7b8713['query']['hasOwnProperty']('nolimit')){_0x3dd44f['limit']=qs[_0x9230('0x1f')](_0x7b8713['query'][_0x9230('0x1f')]);_0x3dd44f[_0x9230('0x1d')]=qs[_0x9230('0x1d')](_0x7b8713['query'][_0x9230('0x1d')]);}_0x3dd44f[_0x9230('0x35')]=qs[_0x9230('0x36')](_0x7b8713[_0x9230('0x30')][_0x9230('0x36')]);_0x3dd44f['where']=qs['filters'](_['pick'](_0x7b8713[_0x9230('0x30')],_0x30b451[_0x9230('0x37')]),_0x1d87c9);if(_0x7b8713[_0x9230('0x30')][_0x9230('0x38')]){_0x3dd44f['where']=_['merge'](_0x3dd44f[_0x9230('0x39')],{'$or':_[_0x9230('0x2e')](_0x1d87c9,function(_0x194ad7){if(_0x194ad7['type']!==_0x9230('0x3a')){var _0x3d160f={};_0x3d160f[_0x194ad7['name']]={'$like':'%'+_0x7b8713['query'][_0x9230('0x38')]+'%'};return _0x3d160f;}})});}_0x3dd44f=_[_0x9230('0x3b')]({},_0x3dd44f,_0x7b8713['options']);var _0x4014fa={'where':_0x3dd44f[_0x9230('0x39')]};return db[_0x9230('0x29')]['count'](_0x4014fa)['then'](function(_0x1ff6c7){_0x319e1d[_0x9230('0x20')]=_0x1ff6c7;if(_0x7b8713['query']['includeAll']){_0x3dd44f[_0x9230('0x3c')]=[{'all':!![]}];}return db[_0x9230('0x29')][_0x9230('0x3d')](_0x3dd44f);})[_0x9230('0x25')](function(_0x1868ea){_0x319e1d[_0x9230('0x3e')]=_0x1868ea;return _0x319e1d;})[_0x9230('0x25')](respondWithFilteredResult(_0x56c751,_0x3dd44f))[_0x9230('0x3f')](handleError(_0x56c751,null));};exports[_0x9230('0x40')]=function(_0x1b574b,_0x18d14f){var _0xa0c1d1={'raw':!![],'where':{'id':_0x1b574b[_0x9230('0x41')]['id']}},_0x57f274={};_0x57f274[_0x9230('0x2d')]=_['keys'](db[_0x9230('0x29')][_0x9230('0x2a')]);_0x57f274[_0x9230('0x30')]=_[_0x9230('0x2f')](_0x1b574b[_0x9230('0x30')]);_0x57f274[_0x9230('0x37')]=_[_0x9230('0x31')](_0x57f274['model'],_0x57f274[_0x9230('0x30')]);_0xa0c1d1['attributes']=_[_0x9230('0x31')](_0x57f274['model'],qs[_0x9230('0x32')](_0x1b574b[_0x9230('0x30')]['fields']));_0xa0c1d1[_0x9230('0x33')]=_0xa0c1d1[_0x9230('0x33')]['length']?_0xa0c1d1[_0x9230('0x33')]:_0x57f274[_0x9230('0x2d')];if(_0x1b574b[_0x9230('0x30')]['includeAll']){_0xa0c1d1[_0x9230('0x3c')]=[{'all':!![]}];}_0xa0c1d1=_[_0x9230('0x3b')]({},_0xa0c1d1,_0x1b574b['options']);return db[_0x9230('0x29')][_0x9230('0x42')](_0xa0c1d1)[_0x9230('0x25')](handleEntityNotFound(_0x18d14f,null))[_0x9230('0x25')](respondWithResult(_0x18d14f,null))[_0x9230('0x3f')](handleError(_0x18d14f,null));};exports['create']=function(_0x381319,_0xeb8634){return db[_0x9230('0x29')][_0x9230('0x43')](_0x381319[_0x9230('0x44')],{})['then'](respondWithResult(_0xeb8634,0xc9))['catch'](handleError(_0xeb8634,null));};exports[_0x9230('0x45')]=function(_0x41d3b9,_0x2c5533){if(_0x41d3b9[_0x9230('0x44')]['id']){delete _0x41d3b9[_0x9230('0x44')]['id'];}return db['SmsApplication'][_0x9230('0x42')]({'where':{'id':_0x41d3b9[_0x9230('0x41')]['id']}})[_0x9230('0x25')](handleEntityNotFound(_0x2c5533,null))['then'](saveUpdates(_0x41d3b9[_0x9230('0x44')],null))[_0x9230('0x25')](respondWithResult(_0x2c5533,null))[_0x9230('0x3f')](handleError(_0x2c5533,null));};exports['destroy']=function(_0x235785,_0x1eb3e2){return db[_0x9230('0x29')][_0x9230('0x42')]({'where':{'id':_0x235785['params']['id']}})['then'](handleEntityNotFound(_0x1eb3e2,null))['then'](removeEntity(_0x1eb3e2,null))[_0x9230('0x3f')](handleError(_0x1eb3e2,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index 17a8c5d..113be39 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 _0x2d8d=['exports','define','SmsApplication','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment'];(function(_0x122b6f,_0x21250c){var _0x140d60=function(_0xe8e07b){while(--_0xe8e07b){_0x122b6f['push'](_0x122b6f['shift']());}};_0x140d60(++_0x21250c);}(_0x2d8d,0x154));var _0xd2d8=function(_0x5c38cd,_0x5a6b4e){_0x5c38cd=_0x5c38cd-0x0;var _0xc985ef=_0x2d8d[_0x5c38cd];return _0xc985ef;};'use strict';var _=require(_0xd2d8('0x0'));var util=require(_0xd2d8('0x1'));var logger=require(_0xd2d8('0x2'))(_0xd2d8('0x3'));var moment=require(_0xd2d8('0x4'));var BPromise=require(_0xd2d8('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xd2d8('0x6'));var config=require(_0xd2d8('0x7'));var attributes=require('./smsApplication.attributes');module[_0xd2d8('0x8')]=function(_0x209b47,_0x32d63a){return _0x209b47[_0xd2d8('0x9')](_0xd2d8('0xa'),attributes,{'tableName':'sms_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xd2d8('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x11fb=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsApplication.attributes','define','lodash','util'];(function(_0x425716,_0x3e9d1c){var _0x2d39af=function(_0x1febc1){while(--_0x1febc1){_0x425716['push'](_0x425716['shift']());}};_0x2d39af(++_0x3e9d1c);}(_0x11fb,0xcf));var _0xb11f=function(_0x169432,_0x130a1b){_0x169432=_0x169432-0x0;var _0x3bf91c=_0x11fb[_0x169432];return _0x3bf91c;};'use strict';var _=require(_0xb11f('0x0'));var util=require(_0xb11f('0x1'));var logger=require(_0xb11f('0x2'))('api');var moment=require(_0xb11f('0x3'));var BPromise=require(_0xb11f('0x4'));var rp=require(_0xb11f('0x5'));var fs=require('fs');var path=require(_0xb11f('0x6'));var rimraf=require(_0xb11f('0x7'));var config=require(_0xb11f('0x8'));var attributes=require(_0xb11f('0x9'));module['exports']=function(_0xc8cf6,_0x873f33){return _0xc8cf6[_0xb11f('0xa')]('SmsApplication',attributes,{'tableName':'sms_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index fd371fb..fd140e9 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 _0xb94c=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','SmsApplication,\x20%s,\x20%s','debug','SmsApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','bluebird','randomstring'];(function(_0x151334,_0x1e11ac){var _0x3d03da=function(_0x2099cf){while(--_0x2099cf){_0x151334['push'](_0x151334['shift']());}};_0x3d03da(++_0x1e11ac);}(_0xb94c,0x176));var _0xcb94=function(_0x513c6d,_0x247e41){_0x513c6d=_0x513c6d-0x0;var _0x2750cb=_0xb94c[_0x513c6d];return _0x2750cb;};'use strict';var _=require(_0xcb94('0x0'));var util=require(_0xcb94('0x1'));var moment=require('moment');var BPromise=require(_0xcb94('0x2'));var rs=require(_0xcb94('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcb94('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xcb94('0x5'))(_0xcb94('0x6'));var config=require(_0xcb94('0x7'));var jayson=require(_0xcb94('0x8'));var client=jayson[_0xcb94('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3ab328,_0x27441c,_0x20f879){return new BPromise(function(_0x22cac1,_0x16288f){return client['request'](_0x3ab328,_0x20f879)[_0xcb94('0xa')](function(_0x3305c9){logger[_0xcb94('0xb')](_0xcb94('0xc'),_0x27441c,'request\x20sent');logger[_0xcb94('0xd')](_0xcb94('0xe'),_0x27441c,_0xcb94('0xf'),JSON[_0xcb94('0x10')](_0x3305c9));if(_0x3305c9[_0xcb94('0x11')]){if(_0x3305c9[_0xcb94('0x11')][_0xcb94('0x12')]===0x1f4){logger[_0xcb94('0x11')](_0xcb94('0xc'),_0x27441c,_0x3305c9[_0xcb94('0x11')]['message']);return _0x16288f(_0x3305c9[_0xcb94('0x11')][_0xcb94('0x13')]);}logger['error']('SmsApplication,\x20%s,\x20%s',_0x27441c,_0x3305c9['error']['message']);return _0x22cac1(_0x3305c9[_0xcb94('0x11')][_0xcb94('0x13')]);}else{logger[_0xcb94('0xb')]('SmsApplication,\x20%s,\x20%s',_0x27441c,_0xcb94('0xf'));_0x22cac1(_0x3305c9['result'][_0xcb94('0x13')]);}})[_0xcb94('0x14')](function(_0x3dbfbb){logger[_0xcb94('0x11')](_0xcb94('0xc'),_0x27441c,_0x3dbfbb);_0x16288f(_0x3dbfbb);});});} \ No newline at end of file +var _0x6f3e=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','info','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util'];(function(_0x2cef9a,_0x353be0){var _0x28bedd=function(_0x1045a4){while(--_0x1045a4){_0x2cef9a['push'](_0x2cef9a['shift']());}};_0x28bedd(++_0x353be0);}(_0x6f3e,0x9f));var _0xe6f3=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x6f3e[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xe6f3('0x0'));var util=require(_0xe6f3('0x1'));var moment=require(_0xe6f3('0x2'));var BPromise=require(_0xe6f3('0x3'));var rs=require(_0xe6f3('0x4'));var fs=require('fs');var Redis=require(_0xe6f3('0x5'));var db=require(_0xe6f3('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xe6f3('0x7'))(_0xe6f3('0x8'));var config=require('../../config/environment');var jayson=require(_0xe6f3('0x9'));var client=jayson[_0xe6f3('0xa')][_0xe6f3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5b59eb,_0x44cedc,_0x17242d){return new BPromise(function(_0x53d62d,_0x4ba888){return client[_0xe6f3('0xc')](_0x5b59eb,_0x17242d)['then'](function(_0x331856){logger[_0xe6f3('0xd')](_0xe6f3('0xe'),_0x44cedc,_0xe6f3('0xf'));logger[_0xe6f3('0x10')](_0xe6f3('0x11'),_0x44cedc,'request\x20sent',JSON[_0xe6f3('0x12')](_0x331856));if(_0x331856['error']){if(_0x331856[_0xe6f3('0x13')][_0xe6f3('0x14')]===0x1f4){logger[_0xe6f3('0x13')](_0xe6f3('0xe'),_0x44cedc,_0x331856['error'][_0xe6f3('0x15')]);return _0x4ba888(_0x331856[_0xe6f3('0x13')][_0xe6f3('0x15')]);}logger[_0xe6f3('0x13')](_0xe6f3('0xe'),_0x44cedc,_0x331856[_0xe6f3('0x13')][_0xe6f3('0x15')]);return _0x53d62d(_0x331856['error'][_0xe6f3('0x15')]);}else{logger[_0xe6f3('0xd')](_0xe6f3('0xe'),_0x44cedc,_0xe6f3('0xf'));_0x53d62d(_0x331856[_0xe6f3('0x16')]['message']);}})['catch'](function(_0x410177){logger[_0xe6f3('0x13')](_0xe6f3('0xe'),_0x44cedc,_0x410177);_0x4ba888(_0x410177);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 846196a..d2d80d1 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 _0xe605=['./smsInteraction.controller','get','isAuthenticated','index','show','/:id/messages','getMessages','/:id/download','download','post','addMessage','/:id/tags','tracked','sms','smsinteraction:addtags','addTags','/:id','update','delete','smsinteraction:destroy','removeTags','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x405554,_0x47437c){var _0x5149e8=function(_0x49e2b1){while(--_0x49e2b1){_0x405554['push'](_0x405554['shift']());}};_0x5149e8(++_0x47437c);}(_0xe605,0x92));var _0x5e60=function(_0x114582,_0x5642d0){_0x114582=_0x114582-0x0;var _0x3cd9fa=_0xe605[_0x114582];return _0x3cd9fa;};'use strict';var multer=require(_0x5e60('0x0'));var util=require(_0x5e60('0x1'));var path=require('path');var timeout=require(_0x5e60('0x2'));var express=require(_0x5e60('0x3'));var router=express[_0x5e60('0x4')]();var fs_extra=require(_0x5e60('0x5'));var auth=require(_0x5e60('0x6'));var interaction=require(_0x5e60('0x7'));var config=require(_0x5e60('0x8'));var controller=require(_0x5e60('0x9'));router[_0x5e60('0xa')]('/',auth[_0x5e60('0xb')](),controller[_0x5e60('0xc')]);router[_0x5e60('0xa')]('/describe',auth[_0x5e60('0xb')](),controller['describe']);router['get']('/:id',auth[_0x5e60('0xb')](),controller[_0x5e60('0xd')]);router[_0x5e60('0xa')](_0x5e60('0xe'),auth[_0x5e60('0xb')](),controller[_0x5e60('0xf')]);router['get'](_0x5e60('0x10'),auth['isAuthenticated'](),controller[_0x5e60('0x11')]);router[_0x5e60('0x12')]('/',auth[_0x5e60('0xb')](),controller['create']);router[_0x5e60('0x12')](_0x5e60('0xe'),auth[_0x5e60('0xb')](),controller[_0x5e60('0x13')]);router[_0x5e60('0x12')](_0x5e60('0x14'),auth['isAuthenticated'](),interaction[_0x5e60('0x15')](_0x5e60('0x16'),_0x5e60('0x17')),controller[_0x5e60('0x18')]);router['put'](_0x5e60('0x19'),auth['isAuthenticated'](),interaction[_0x5e60('0x15')](_0x5e60('0x16'),'smsinteraction:update'),controller[_0x5e60('0x1a')]);router[_0x5e60('0x1b')](_0x5e60('0x19'),auth[_0x5e60('0xb')](),interaction['tracked'](_0x5e60('0x16'),_0x5e60('0x1c')),controller['destroy']);router[_0x5e60('0x1b')](_0x5e60('0x14'),auth[_0x5e60('0xb')](),controller[_0x5e60('0x1d')]);module[_0x5e60('0x1e')]=router; \ No newline at end of file +var _0xd4a2=['isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','getMessages','download','create','post','addMessage','/:id/tags','sms','addTags','put','update','tracked','removeTags','exports','multer','connect-timeout','Router','../../components/auth/service','../../config/environment','./smsInteraction.controller','get'];(function(_0x367787,_0x402687){var _0x165412=function(_0x37b95f){while(--_0x37b95f){_0x367787['push'](_0x367787['shift']());}};_0x165412(++_0x402687);}(_0xd4a2,0x173));var _0x2d4a=function(_0x197a01,_0x12981c){_0x197a01=_0x197a01-0x0;var _0x24cbcd=_0xd4a2[_0x197a01];return _0x24cbcd;};'use strict';var multer=require(_0x2d4a('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x2d4a('0x1'));var express=require('express');var router=express[_0x2d4a('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x2d4a('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x2d4a('0x4'));var controller=require(_0x2d4a('0x5'));router[_0x2d4a('0x6')]('/',auth[_0x2d4a('0x7')](),controller[_0x2d4a('0x8')]);router['get'](_0x2d4a('0x9'),auth[_0x2d4a('0x7')](),controller[_0x2d4a('0xa')]);router[_0x2d4a('0x6')](_0x2d4a('0xb'),auth[_0x2d4a('0x7')](),controller[_0x2d4a('0xc')]);router[_0x2d4a('0x6')](_0x2d4a('0xd'),auth[_0x2d4a('0x7')](),controller[_0x2d4a('0xe')]);router[_0x2d4a('0x6')]('/:id/download',auth['isAuthenticated'](),controller[_0x2d4a('0xf')]);router['post']('/',auth[_0x2d4a('0x7')](),controller[_0x2d4a('0x10')]);router[_0x2d4a('0x11')](_0x2d4a('0xd'),auth[_0x2d4a('0x7')](),controller[_0x2d4a('0x12')]);router[_0x2d4a('0x11')](_0x2d4a('0x13'),auth['isAuthenticated'](),interaction['tracked'](_0x2d4a('0x14'),'smsinteraction:addtags'),controller[_0x2d4a('0x15')]);router[_0x2d4a('0x16')](_0x2d4a('0xb'),auth[_0x2d4a('0x7')](),interaction['tracked'](_0x2d4a('0x14'),'smsinteraction:update'),controller[_0x2d4a('0x17')]);router['delete'](_0x2d4a('0xb'),auth[_0x2d4a('0x7')](),interaction[_0x2d4a('0x18')](_0x2d4a('0x14'),'smsinteraction:destroy'),controller['destroy']);router['delete'](_0x2d4a('0x13'),auth[_0x2d4a('0x7')](),controller[_0x2d4a('0x19')]);module[_0x2d4a('0x1a')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index 048d5c8..54239f2 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 _0xc5b3=['moment','exports','BOOLEAN','DATE','STRING','out','ENUM','INTEGER','sequelize'];(function(_0x6e51f1,_0x11371a){var _0x141b4c=function(_0x2e85e7){while(--_0x2e85e7){_0x6e51f1['push'](_0x6e51f1['shift']());}};_0x141b4c(++_0x11371a);}(_0xc5b3,0x1ee));var _0x3c5b=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0xc5b3[_0x13e741];return _0x3f8bb3;};'use strict';var Sequelize=require(_0x3c5b('0x0'));var moment=require(_0x3c5b('0x1'));module[_0x3c5b('0x2')]={'closed':{'type':Sequelize[_0x3c5b('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x3c5b('0x4')]},'disposition':{'type':Sequelize[_0x3c5b('0x5')]},'secondDisposition':{'type':Sequelize[_0x3c5b('0x5')]},'thirdDisposition':{'type':Sequelize[_0x3c5b('0x5')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x3c5b('0x5')]},'read1stAt':{'type':Sequelize[_0x3c5b('0x4')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x3c5b('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x3c5b('0x7')]('in',_0x3c5b('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x3c5b('0x3')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x3c5b('0x8')]}}; \ No newline at end of file +var _0xf603=['INTEGER','sequelize','moment','exports','DATE','STRING','ENUM','out','BOOLEAN'];(function(_0x385c4e,_0x427f54){var _0x52265e=function(_0x3fb288){while(--_0x3fb288){_0x385c4e['push'](_0x385c4e['shift']());}};_0x52265e(++_0x427f54);}(_0xf603,0xeb));var _0x3f60=function(_0x12ddce,_0x2eb2bf){_0x12ddce=_0x12ddce-0x0;var _0x2ee03b=_0xf603[_0x12ddce];return _0x2ee03b;};'use strict';var Sequelize=require(_0x3f60('0x0'));var moment=require(_0x3f60('0x1'));module[_0x3f60('0x2')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x3f60('0x3')]},'disposition':{'type':Sequelize[_0x3f60('0x4')]},'secondDisposition':{'type':Sequelize[_0x3f60('0x4')]},'thirdDisposition':{'type':Sequelize[_0x3f60('0x4')]},'note':{'type':Sequelize[_0x3f60('0x4')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x3f60('0x3')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x3f60('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x3f60('0x5')]('in',_0x3f60('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x3f60('0x7')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x3f60('0x8')]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index a4ec042..f0b4ca4 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 _0x8f8b=['intersection','fields','length','includeAll','options','find','create','body','describe','addMessage','SmsMessage','ids','omit','getMessages','hasOwnProperty','nolimit','order','sort','filters','pick','where','SmsInteractionId','filter','merge','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','include','rows','addTags','setTags','spread','emit','smsInteractionTags:save','download','unix','toString','join','root','files','tmp','transcript-%d-%s.zip','push','User','fullname','CmContact','Contact','lastName','createdAt','read','SmsAccount','Account','Owner','get','mkdirSync','Sms','N.A.','closed','closedAt','disposition','Messages','map','direction','out','System','secret','value','renderFile','server','views','createPdfFromHTML','log','err','unlinkSync','rimraf','zip-dir','moment','bluebird','path','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','../../config/environment','redis','localhost','./smsInteraction.socket','register','sendStatus','end','status','json','undefined','limit','count','offset','Content-Range','update','then','destroy','error','stack','name','send','index','SmsInteraction','rawAttributes','type','key','getOptions','findAll','sms','query','user','catch','show','params','model','keys','attributes'];(function(_0x22047d,_0x1891c2){var _0x140c4e=function(_0x1d8a43){while(--_0x1d8a43){_0x22047d['push'](_0x22047d['shift']());}};_0x140c4e(++_0x1891c2);}(_0x8f8b,0x1b9));var _0xb8f8=function(_0x16c384,_0x5c1436){_0x16c384=_0x16c384-0x0;var _0x101ba9=_0x8f8b[_0x16c384];return _0x101ba9;};'use strict';var rimraf=require(_0xb8f8('0x0'));var zipdir=require(_0xb8f8('0x1'));var moment=require(_0xb8f8('0x2'));var BPromise=require(_0xb8f8('0x3'));var util=require('util');var path=require(_0xb8f8('0x4'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xb8f8('0x5'));var Redis=require(_0xb8f8('0x6'));var interaction=require(_0xb8f8('0x7'));var qs=require(_0xb8f8('0x8'));var pdf=require('../../components/export/pdf');var logger=require(_0xb8f8('0x9'))('api');var config=require(_0xb8f8('0xa'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0xb8f8('0xb')],{'host':_0xb8f8('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xb8f8('0xd'))[_0xb8f8('0xe')](socket);function respondWithStatusCode(_0x185d8a,_0x399ca7){_0x399ca7=_0x399ca7||0xcc;return function(_0x51ac5c){if(_0x51ac5c){return _0x185d8a[_0xb8f8('0xf')](_0x399ca7);}return _0x185d8a['status'](_0x399ca7)[_0xb8f8('0x10')]();};}function respondWithResult(_0x38046f,_0xb93f5b){_0xb93f5b=_0xb93f5b||0xc8;return function(_0x529832){if(_0x529832){return _0x38046f[_0xb8f8('0x11')](_0xb93f5b)[_0xb8f8('0x12')](_0x529832);}};}function respondWithFilteredResult(_0x485e6b,_0x5565b8){return function(_0x324f43){if(_0x324f43){var _0x5ad2a1=typeof _0x5565b8['offset']===_0xb8f8('0x13')&&typeof _0x5565b8[_0xb8f8('0x14')]===_0xb8f8('0x13');var _0xc51392=_0x324f43['count'];var _0x4a05aa=_0x5ad2a1?0x0:_0x5565b8['offset'];var _0x58ca00=_0x5ad2a1?_0x324f43[_0xb8f8('0x15')]:_0x5565b8[_0xb8f8('0x16')]+_0x5565b8['limit'];var _0x559af6;if(_0x58ca00>=_0xc51392){_0x58ca00=_0xc51392;_0x559af6=0xc8;}else{_0x559af6=0xce;}_0x485e6b[_0xb8f8('0x11')](_0x559af6);return _0x485e6b['set'](_0xb8f8('0x17'),_0x4a05aa+'-'+_0x58ca00+'/'+_0xc51392)[_0xb8f8('0x12')](_0x324f43);}return null;};}function saveUpdates(_0x428873){return function(_0x419cd2){if(_0x419cd2){return _0x419cd2[_0xb8f8('0x18')](_0x428873)[_0xb8f8('0x19')](function(_0x1aa432){return _0x1aa432;});}return null;};}function removeEntity(_0x2798ae){return function(_0x10feb8){if(_0x10feb8){return _0x10feb8[_0xb8f8('0x1a')]()[_0xb8f8('0x19')](function(){_0x2798ae[_0xb8f8('0x11')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2a2bfe){return function(_0x309174){if(!_0x309174){_0x2a2bfe['sendStatus'](0x194);}return _0x309174;};}function handleError(_0x2368a9,_0x5b017a){_0x5b017a=_0x5b017a||0x1f4;return function(_0x32b305){logger[_0xb8f8('0x1b')](_0x32b305[_0xb8f8('0x1c')]);if(_0x32b305[_0xb8f8('0x1d')]){delete _0x32b305[_0xb8f8('0x1d')];}_0x2368a9[_0xb8f8('0x11')](_0x5b017a)[_0xb8f8('0x1e')](_0x32b305);};}exports[_0xb8f8('0x1f')]=function(_0x281d52,_0x2efa99){var _0x1fd17d={};var _0x10432b=_['map'](db[_0xb8f8('0x20')][_0xb8f8('0x21')],function(_0xd30cde){return{'name':_0xd30cde['fieldName'],'type':_0xd30cde[_0xb8f8('0x22')][_0xb8f8('0x23')]};});_0x1fd17d=qs[_0xb8f8('0x24')](_0x10432b,_0x281d52);return interaction[_0xb8f8('0x25')](_0xb8f8('0x26'),_0x281d52[_0xb8f8('0x27')],_0x281d52[_0xb8f8('0x28')],_0x1fd17d,_0x10432b)[_0xb8f8('0x19')](respondWithFilteredResult(_0x2efa99,_0x1fd17d))[_0xb8f8('0x29')](handleError(_0x2efa99,null));};exports[_0xb8f8('0x2a')]=function(_0x14147e,_0x3409a0){var _0x1f2519={'raw':![],'where':{'id':_0x14147e[_0xb8f8('0x2b')]['id']}},_0x4e458c={};_0x4e458c[_0xb8f8('0x2c')]=_[_0xb8f8('0x2d')](db['SmsInteraction'][_0xb8f8('0x21')]);_0x4e458c[_0xb8f8('0x27')]=_['keys'](_0x14147e[_0xb8f8('0x27')]);_0x4e458c['filters']=_['intersection'](_0x4e458c[_0xb8f8('0x2c')],_0x4e458c[_0xb8f8('0x27')]);_0x1f2519[_0xb8f8('0x2e')]=_[_0xb8f8('0x2f')](_0x4e458c[_0xb8f8('0x2c')],qs[_0xb8f8('0x30')](_0x14147e[_0xb8f8('0x27')][_0xb8f8('0x30')]));_0x1f2519['attributes']=_0x1f2519['attributes'][_0xb8f8('0x31')]?_0x1f2519[_0xb8f8('0x2e')]:_0x4e458c[_0xb8f8('0x2c')];if(_0x14147e['query'][_0xb8f8('0x32')]){_0x1f2519['include']=[{'all':!![]}];}_0x1f2519=_['merge']({},_0x1f2519,_0x14147e[_0xb8f8('0x33')]);return db[_0xb8f8('0x20')][_0xb8f8('0x34')](_0x1f2519)[_0xb8f8('0x19')](handleEntityNotFound(_0x3409a0,null))[_0xb8f8('0x19')](respondWithResult(_0x3409a0,null))[_0xb8f8('0x29')](handleError(_0x3409a0,null));};exports['create']=function(_0x5c79ef,_0x4b4226){return db[_0xb8f8('0x20')][_0xb8f8('0x35')](_0x5c79ef[_0xb8f8('0x36')],{})[_0xb8f8('0x19')](respondWithResult(_0x4b4226,0xc9))[_0xb8f8('0x29')](handleError(_0x4b4226,null));};exports['update']=function(_0x50333f,_0x444389){if(_0x50333f[_0xb8f8('0x36')]['id']){delete _0x50333f[_0xb8f8('0x36')]['id'];}return db[_0xb8f8('0x20')][_0xb8f8('0x34')]({'where':{'id':_0x50333f[_0xb8f8('0x2b')]['id']}})['then'](handleEntityNotFound(_0x444389,null))[_0xb8f8('0x19')](saveUpdates(_0x50333f['body'],null))['then'](respondWithResult(_0x444389,null))[_0xb8f8('0x29')](handleError(_0x444389,null));};exports[_0xb8f8('0x1a')]=function(_0x3c6531,_0x395e0){return db[_0xb8f8('0x20')][_0xb8f8('0x34')]({'where':{'id':_0x3c6531['params']['id']}})[_0xb8f8('0x19')](handleEntityNotFound(_0x395e0,null))[_0xb8f8('0x19')](removeEntity(_0x395e0,null))[_0xb8f8('0x29')](handleError(_0x395e0,null));};exports[_0xb8f8('0x37')]=function(_0x5be484,_0x6c8635){return db[_0xb8f8('0x20')][_0xb8f8('0x37')]()[_0xb8f8('0x19')](respondWithResult(_0x6c8635,null))[_0xb8f8('0x29')](handleError(_0x6c8635,null));};exports[_0xb8f8('0x38')]=function(_0xb80504,_0x53a208){return db[_0xb8f8('0x39')]['find']({'where':{'id':_0xb80504[_0xb8f8('0x2b')]['id']}})['then'](handleEntityNotFound(_0x53a208,null))[_0xb8f8('0x19')](function(_0x8e0882){if(_0x8e0882){return _0x8e0882[_0xb8f8('0x38')](_0xb80504['body'][_0xb8f8('0x3a')],_[_0xb8f8('0x3b')](_0xb80504[_0xb8f8('0x36')],[_0xb8f8('0x3a'),'id'])||{});}})[_0xb8f8('0x19')](respondWithResult(_0x53a208,null))[_0xb8f8('0x29')](handleError(_0x53a208,null));};exports[_0xb8f8('0x3c')]=function(_0x430397,_0x131938){var _0x380446={'raw':![],'where':{}};var _0x3142a7={};var _0x265a51={'count':0x0,'rows':[]};return db[_0xb8f8('0x20')]['findOne']({'where':{'id':_0x430397[_0xb8f8('0x2b')]['id']}})['then'](handleEntityNotFound(_0x131938,null))['then'](function(_0x16f715){if(_0x16f715){_0x3142a7['model']=_[_0xb8f8('0x2d')](db[_0xb8f8('0x39')][_0xb8f8('0x21')]);_0x3142a7['query']=_[_0xb8f8('0x2d')](_0x430397[_0xb8f8('0x27')]);_0x3142a7['filters']=_[_0xb8f8('0x2f')](_0x3142a7['model'],_0x3142a7['query']);_0x380446['attributes']=_[_0xb8f8('0x2f')](_0x3142a7[_0xb8f8('0x2c')],qs[_0xb8f8('0x30')](_0x430397['query'][_0xb8f8('0x30')]));_0x380446[_0xb8f8('0x2e')]=_0x380446[_0xb8f8('0x2e')][_0xb8f8('0x31')]?_0x380446[_0xb8f8('0x2e')]:_0x3142a7[_0xb8f8('0x2c')];if(!_0x430397[_0xb8f8('0x27')][_0xb8f8('0x3d')](_0xb8f8('0x3e'))){_0x380446[_0xb8f8('0x14')]=qs['limit'](_0x430397[_0xb8f8('0x27')]['limit']);_0x380446['offset']=qs[_0xb8f8('0x16')](_0x430397[_0xb8f8('0x27')]['offset']);}_0x380446[_0xb8f8('0x3f')]=qs[_0xb8f8('0x40')](_0x430397[_0xb8f8('0x27')][_0xb8f8('0x40')]);_0x380446['where']=qs[_0xb8f8('0x41')](_[_0xb8f8('0x42')](_0x430397['query'],_0x3142a7[_0xb8f8('0x41')]));_0x380446[_0xb8f8('0x43')][_0xb8f8('0x44')]=_0x16f715['id'];if(_0x430397['query'][_0xb8f8('0x45')]){_0x380446['where']=_[_0xb8f8('0x46')](_0x380446[_0xb8f8('0x43')],{'$or':_['map'](_0x380446['attributes'],function(_0x5d3a31){var _0x210cd2={};_0x210cd2[_0x5d3a31]={'$like':'%'+_0x430397[_0xb8f8('0x27')]['filter']+'%'};return _0x210cd2;})});}if(_0x430397['query'][_0xb8f8('0x47')]){var _0x439a82=_0x430397[_0xb8f8('0x27')]['$gte'][_0xb8f8('0x48')](',');var _0x4afaa1={};_0x4afaa1[_0x439a82[0x0]]={'$gte':moment(_0x439a82[0x1])[_0xb8f8('0x49')](_0xb8f8('0x4a'))};_0x380446[_0xb8f8('0x43')]=_[_0xb8f8('0x46')](_0x380446[_0xb8f8('0x43')],_0x4afaa1);}_0x380446=_[_0xb8f8('0x46')]({},_0x380446,_0x430397[_0xb8f8('0x33')]);return db[_0xb8f8('0x39')][_0xb8f8('0x15')]({'where':_0x380446[_0xb8f8('0x43')]})['then'](function(_0x471da2){_0x265a51[_0xb8f8('0x15')]=_0x471da2;if(_0x430397[_0xb8f8('0x27')][_0xb8f8('0x32')]){_0x380446[_0xb8f8('0x4b')]=[{'all':!![]}];}return db[_0xb8f8('0x39')][_0xb8f8('0x25')](_0x380446);})[_0xb8f8('0x19')](function(_0x17679e){_0x265a51[_0xb8f8('0x4c')]=_0x17679e;return _0x265a51;});}})['then'](respondWithFilteredResult(_0x131938,_0x380446))[_0xb8f8('0x29')](handleError(_0x131938,null));};exports[_0xb8f8('0x4d')]=function(_0x2c637d,_0x474c81){return db[_0xb8f8('0x20')][_0xb8f8('0x34')]({'where':{'id':_0x2c637d[_0xb8f8('0x2b')]['id']}})['then'](handleEntityNotFound(_0x474c81,null))['then'](function(_0x1a407b){if(_0x1a407b){return _0x1a407b[_0xb8f8('0x4e')](_0x2c637d['body'][_0xb8f8('0x3a')],_[_0xb8f8('0x3b')](_0x2c637d[_0xb8f8('0x36')],[_0xb8f8('0x3a'),'id'])||{})[_0xb8f8('0x4f')](function(){return db['Tag'][_0xb8f8('0x25')]({'attributes':['id','name','color'],'where':{'id':_0x2c637d[_0xb8f8('0x36')][_0xb8f8('0x3a')]}});})['then'](function(_0x2eaa5d){socket[_0xb8f8('0x50')](_0xb8f8('0x51'),{'id':Number(_0x2c637d[_0xb8f8('0x2b')]['id']),'tags':_0x2eaa5d||[]});return{'id':Number(_0x2c637d['params']['id']),'tags':_0x2eaa5d||[]};});}})[_0xb8f8('0x19')](respondWithResult(_0x474c81,null))[_0xb8f8('0x29')](handleError(_0x474c81,null));};exports['removeTags']=function(_0x23a21c,_0x2ea671){return db[_0xb8f8('0x20')][_0xb8f8('0x34')]({'where':{'id':_0x23a21c[_0xb8f8('0x2b')]['id']}})['then'](handleEntityNotFound(_0x2ea671,null))[_0xb8f8('0x19')](function(_0x46df88){if(_0x46df88){return _0x46df88['removeTags'](_0x23a21c[_0xb8f8('0x27')][_0xb8f8('0x3a')]);}})[_0xb8f8('0x19')](respondWithStatusCode(_0x2ea671,null))[_0xb8f8('0x29')](handleError(_0x2ea671,null));};exports[_0xb8f8('0x52')]=function(_0x55fcfa,_0xc5ab48){var _0x3d1ac4=moment()[_0xb8f8('0x53')]()[_0xb8f8('0x54')]();var _0x146298=path[_0xb8f8('0x55')](config[_0xb8f8('0x56')],'server',_0xb8f8('0x57'),_0xb8f8('0x58'));var _0x9e4c82=path[_0xb8f8('0x55')](_0x146298,_0x3d1ac4);var _0x57d28d=util['format'](_0xb8f8('0x59'),_0x55fcfa['params']['id'],_0x3d1ac4);var _0x10e4ec=path[_0xb8f8('0x55')](_0x146298,_0x57d28d);var _0xd7833a=[];_0xd7833a[_0xb8f8('0x5a')]({'model':db[_0xb8f8('0x5b')],'as':'User','attributes':['id',_0xb8f8('0x5c')],'raw':!![]});_0xd7833a['push']({'model':db[_0xb8f8('0x5d')],'as':_0xb8f8('0x5e'),'attributes':['id','firstName',_0xb8f8('0x5f')],'raw':!![]});var _0x5071ef=[{'model':db['SmsMessage'],'as':'Messages','attributes':['id',_0xb8f8('0x36'),_0xb8f8('0x60'),'direction','secret',_0xb8f8('0x61')],'include':_0xd7833a}];_0x5071ef['push']({'model':db[_0xb8f8('0x62')],'as':_0xb8f8('0x63'),'attributes':['id',_0xb8f8('0x1d')]});_0x5071ef[_0xb8f8('0x5a')]({'model':db[_0xb8f8('0x5b')],'as':_0xb8f8('0x64'),'attributes':['id','fullname']});return db[_0xb8f8('0x20')][_0xb8f8('0x34')]({'where':{'id':_0x55fcfa['params']['id']},'include':_0x5071ef})[_0xb8f8('0x19')](handleEntityNotFound(_0xc5ab48,null))[_0xb8f8('0x19')](function(_0x345d40){if(_0x345d40){var _0x6bf42a=_0x345d40[_0xb8f8('0x65')]({'plain':!![]});fs[_0xb8f8('0x66')](_0x9e4c82);var _0x162905={'channel':_0xb8f8('0x67'),'account':_0x6bf42a['Account']['name'],'agent':_0x6bf42a[_0xb8f8('0x64')]?_0x6bf42a[_0xb8f8('0x64')][_0xb8f8('0x5c')]:_0xb8f8('0x68'),'createdAt':moment(_0x6bf42a['createdAt'])[_0xb8f8('0x49')](_0xb8f8('0x4a'))['toString'](),'closedAt':_0x6bf42a[_0xb8f8('0x69')]?moment(_0x6bf42a[_0xb8f8('0x6a')])[_0xb8f8('0x49')](_0xb8f8('0x4a'))[_0xb8f8('0x54')]():'','disposition':_0x6bf42a[_0xb8f8('0x6b')],'messages':_(_0x6bf42a[_0xb8f8('0x6c')])[_0xb8f8('0x45')]({'secret':![]})[_0xb8f8('0x6d')](function(_0x2fa3c4){return{'date':moment(_0x2fa3c4[_0xb8f8('0x60')])['format'](_0xb8f8('0x4a'))['toString'](),'sender':_0x2fa3c4[_0xb8f8('0x6e')]===_0xb8f8('0x6f')?_0x2fa3c4['User']?_0x2fa3c4[_0xb8f8('0x5b')][_0xb8f8('0x5c')]:_0xb8f8('0x70'):_0x2fa3c4[_0xb8f8('0x5e')]['firstName']+(_0x2fa3c4['Contact'][_0xb8f8('0x5f')]?'\x20'+_0x2fa3c4[_0xb8f8('0x5e')][_0xb8f8('0x5f')]:''),'body':_0x2fa3c4[_0xb8f8('0x36')],'direction':_0x2fa3c4[_0xb8f8('0x6e')]===_0xb8f8('0x6f')?'A':'C','secret':_0x2fa3c4[_0xb8f8('0x71')],'read':_0x2fa3c4[_0xb8f8('0x61')]};})[_0xb8f8('0x72')]()};return ejs[_0xb8f8('0x73')](path[_0xb8f8('0x55')](config[_0xb8f8('0x56')],_0xb8f8('0x74'),_0xb8f8('0x75'),'downloadInteraction.ejs'),{'interaction':_0x162905})['then'](function(_0x16746c){var _0x16e846=path[_0xb8f8('0x55')](_0x9e4c82,'transcript-'+_0x6bf42a['id']+'-'+_0x3d1ac4+'.pdf');var _0x52f5a9={'path':_0x16e846,'channel':_0xb8f8('0x67'),'interactionId':_0x6bf42a['id']};return pdf[_0xb8f8('0x76')](_0x16746c,_0x52f5a9);})[_0xb8f8('0x19')](function(){return new BPromise(function(_0x5ecdec,_0x4d9272){zipdir(_0x9e4c82,{'saveTo':_0x10e4ec},function(_0x1259d9,_0x4e3cc2){if(_0x1259d9)return _0x4d9272(_0x1259d9);return _0x5ecdec(_0x4e3cc2);});})[_0xb8f8('0x19')](function(){return new BPromise(function(_0x4bdfbe,_0x1be2a0){rimraf(_0x9e4c82,function(_0x564421){if(_0x564421)_0x1be2a0(_0x564421);return _0x4bdfbe();});});})[_0xb8f8('0x19')](function(){return _0xc5ab48[_0xb8f8('0x52')](_0x10e4ec,_0x57d28d,function(_0x28e25e){if(_0x28e25e){console[_0xb8f8('0x77')](_0xb8f8('0x78'),_0x28e25e);}else{fs[_0xb8f8('0x79')](_0x10e4ec);}});});});}else{return _0xc5ab48[_0xb8f8('0xf')](0xc8);}})[_0xb8f8('0x29')](handleError(_0xc5ab48,null));}; \ No newline at end of file +var _0x7035=['N.A.','closed','closedAt','map','System','secret','value','renderFile','views','transcript-','.pdf','download','log','zip-dir','bluebird','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','redis','localhost','socket.io-emitter','./smsInteraction.socket','register','sendStatus','status','end','json','limit','undefined','count','set','Content-Range','then','destroy','error','stack','name','send','index','SmsInteraction','rawAttributes','fieldName','type','key','findAll','sms','query','catch','show','model','keys','intersection','attributes','fields','includeAll','merge','options','find','create','update','body','params','describe','addMessage','SmsMessage','ids','omit','getMessages','findOne','filters','hasOwnProperty','nolimit','offset','order','sort','where','SmsInteractionId','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','include','setTags','spread','Tag','color','smsInteractionTags:save','removeTags','unix','toString','join','root','server','tmp','format','transcript-%d-%s.zip','push','User','CmContact','Contact','firstName','lastName','Messages','createdAt','direction','read','Account','Owner','mkdirSync','Sms','fullname'];(function(_0x120e59,_0x443649){var _0x53ff80=function(_0x5a642e){while(--_0x5a642e){_0x120e59['push'](_0x120e59['shift']());}};_0x53ff80(++_0x443649);}(_0x7035,0xf5));var _0x5703=function(_0x3ad2d7,_0x46112b){_0x3ad2d7=_0x3ad2d7-0x0;var _0x5e01bf=_0x7035[_0x3ad2d7];return _0x5e01bf;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0x5703('0x0'));var moment=require('moment');var BPromise=require(_0x5703('0x1'));var util=require('util');var path=require(_0x5703('0x2'));var ejs=require(_0x5703('0x3'));var fs=require('fs');var _=require(_0x5703('0x4'));var Redis=require(_0x5703('0x5'));var interaction=require(_0x5703('0x6'));var qs=require(_0x5703('0x7'));var pdf=require('../../components/export/pdf');var logger=require(_0x5703('0x8'))(_0x5703('0x9'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0x5703('0xa')],{'host':_0x5703('0xb'),'port':0x18eb});var socket=require(_0x5703('0xc'))(new Redis(config[_0x5703('0xa')]));require(_0x5703('0xd'))[_0x5703('0xe')](socket);function respondWithStatusCode(_0x2361cb,_0x2ca6fd){_0x2ca6fd=_0x2ca6fd||0xcc;return function(_0x5a7621){if(_0x5a7621){return _0x2361cb[_0x5703('0xf')](_0x2ca6fd);}return _0x2361cb[_0x5703('0x10')](_0x2ca6fd)[_0x5703('0x11')]();};}function respondWithResult(_0xc0551f,_0x5e0a5c){_0x5e0a5c=_0x5e0a5c||0xc8;return function(_0x43a650){if(_0x43a650){return _0xc0551f[_0x5703('0x10')](_0x5e0a5c)[_0x5703('0x12')](_0x43a650);}};}function respondWithFilteredResult(_0x54cedf,_0x52f6b8){return function(_0x3daf62){if(_0x3daf62){var _0x527fd3=typeof _0x52f6b8['offset']==='undefined'&&typeof _0x52f6b8[_0x5703('0x13')]===_0x5703('0x14');var _0x421cf0=_0x3daf62['count'];var _0x33a43e=_0x527fd3?0x0:_0x52f6b8['offset'];var _0x541467=_0x527fd3?_0x3daf62[_0x5703('0x15')]:_0x52f6b8['offset']+_0x52f6b8[_0x5703('0x13')];var _0x512f8f;if(_0x541467>=_0x421cf0){_0x541467=_0x421cf0;_0x512f8f=0xc8;}else{_0x512f8f=0xce;}_0x54cedf[_0x5703('0x10')](_0x512f8f);return _0x54cedf[_0x5703('0x16')](_0x5703('0x17'),_0x33a43e+'-'+_0x541467+'/'+_0x421cf0)[_0x5703('0x12')](_0x3daf62);}return null;};}function saveUpdates(_0xea594c){return function(_0x44a127){if(_0x44a127){return _0x44a127['update'](_0xea594c)[_0x5703('0x18')](function(_0x18abe1){return _0x18abe1;});}return null;};}function removeEntity(_0x3850f2){return function(_0x53ee32){if(_0x53ee32){return _0x53ee32[_0x5703('0x19')]()[_0x5703('0x18')](function(){_0x3850f2[_0x5703('0x10')](0xcc)[_0x5703('0x11')]();});}};}function handleEntityNotFound(_0x55f980){return function(_0x185f21){if(!_0x185f21){_0x55f980[_0x5703('0xf')](0x194);}return _0x185f21;};}function handleError(_0x5d6883,_0x441cb8){_0x441cb8=_0x441cb8||0x1f4;return function(_0xfea6c8){logger[_0x5703('0x1a')](_0xfea6c8[_0x5703('0x1b')]);if(_0xfea6c8[_0x5703('0x1c')]){delete _0xfea6c8[_0x5703('0x1c')];}_0x5d6883[_0x5703('0x10')](_0x441cb8)[_0x5703('0x1d')](_0xfea6c8);};}exports[_0x5703('0x1e')]=function(_0x3a1883,_0x360ab8){var _0x1e75ed={};var _0x5b1931=_['map'](db[_0x5703('0x1f')][_0x5703('0x20')],function(_0x5e872d){return{'name':_0x5e872d[_0x5703('0x21')],'type':_0x5e872d[_0x5703('0x22')][_0x5703('0x23')]};});_0x1e75ed=qs['getOptions'](_0x5b1931,_0x3a1883);return interaction[_0x5703('0x24')](_0x5703('0x25'),_0x3a1883[_0x5703('0x26')],_0x3a1883['user'],_0x1e75ed,_0x5b1931)[_0x5703('0x18')](respondWithFilteredResult(_0x360ab8,_0x1e75ed))[_0x5703('0x27')](handleError(_0x360ab8,null));};exports[_0x5703('0x28')]=function(_0x173521,_0x293f2e){var _0x2dd998={'raw':![],'where':{'id':_0x173521['params']['id']}},_0x5a6d0e={};_0x5a6d0e[_0x5703('0x29')]=_[_0x5703('0x2a')](db[_0x5703('0x1f')]['rawAttributes']);_0x5a6d0e[_0x5703('0x26')]=_[_0x5703('0x2a')](_0x173521['query']);_0x5a6d0e['filters']=_[_0x5703('0x2b')](_0x5a6d0e[_0x5703('0x29')],_0x5a6d0e[_0x5703('0x26')]);_0x2dd998[_0x5703('0x2c')]=_[_0x5703('0x2b')](_0x5a6d0e[_0x5703('0x29')],qs[_0x5703('0x2d')](_0x173521[_0x5703('0x26')][_0x5703('0x2d')]));_0x2dd998['attributes']=_0x2dd998[_0x5703('0x2c')]['length']?_0x2dd998[_0x5703('0x2c')]:_0x5a6d0e[_0x5703('0x29')];if(_0x173521['query'][_0x5703('0x2e')]){_0x2dd998['include']=[{'all':!![]}];}_0x2dd998=_[_0x5703('0x2f')]({},_0x2dd998,_0x173521[_0x5703('0x30')]);return db['SmsInteraction'][_0x5703('0x31')](_0x2dd998)[_0x5703('0x18')](handleEntityNotFound(_0x293f2e,null))[_0x5703('0x18')](respondWithResult(_0x293f2e,null))[_0x5703('0x27')](handleError(_0x293f2e,null));};exports[_0x5703('0x32')]=function(_0x1d8734,_0x1cc67f){return db[_0x5703('0x1f')]['create'](_0x1d8734['body'],{})[_0x5703('0x18')](respondWithResult(_0x1cc67f,0xc9))[_0x5703('0x27')](handleError(_0x1cc67f,null));};exports[_0x5703('0x33')]=function(_0x12e417,_0x590a49){if(_0x12e417[_0x5703('0x34')]['id']){delete _0x12e417[_0x5703('0x34')]['id'];}return db[_0x5703('0x1f')]['find']({'where':{'id':_0x12e417[_0x5703('0x35')]['id']}})[_0x5703('0x18')](handleEntityNotFound(_0x590a49,null))['then'](saveUpdates(_0x12e417[_0x5703('0x34')],null))[_0x5703('0x18')](respondWithResult(_0x590a49,null))[_0x5703('0x27')](handleError(_0x590a49,null));};exports[_0x5703('0x19')]=function(_0x1235df,_0x4057f0){return db[_0x5703('0x1f')]['find']({'where':{'id':_0x1235df[_0x5703('0x35')]['id']}})[_0x5703('0x18')](handleEntityNotFound(_0x4057f0,null))[_0x5703('0x18')](removeEntity(_0x4057f0,null))['catch'](handleError(_0x4057f0,null));};exports[_0x5703('0x36')]=function(_0x32f4fd,_0x48de3b){return db[_0x5703('0x1f')][_0x5703('0x36')]()['then'](respondWithResult(_0x48de3b,null))[_0x5703('0x27')](handleError(_0x48de3b,null));};exports[_0x5703('0x37')]=function(_0x79ba25,_0x442b43){return db[_0x5703('0x38')]['find']({'where':{'id':_0x79ba25['params']['id']}})[_0x5703('0x18')](handleEntityNotFound(_0x442b43,null))[_0x5703('0x18')](function(_0x57bbdb){if(_0x57bbdb){return _0x57bbdb[_0x5703('0x37')](_0x79ba25[_0x5703('0x34')][_0x5703('0x39')],_[_0x5703('0x3a')](_0x79ba25['body'],[_0x5703('0x39'),'id'])||{});}})[_0x5703('0x18')](respondWithResult(_0x442b43,null))[_0x5703('0x27')](handleError(_0x442b43,null));};exports[_0x5703('0x3b')]=function(_0x3cc975,_0x460dd3){var _0x4007e5={'raw':![],'where':{}};var _0x2939c5={};var _0x58b66e={'count':0x0,'rows':[]};return db[_0x5703('0x1f')][_0x5703('0x3c')]({'where':{'id':_0x3cc975[_0x5703('0x35')]['id']}})['then'](handleEntityNotFound(_0x460dd3,null))[_0x5703('0x18')](function(_0x1773dd){if(_0x1773dd){_0x2939c5['model']=_[_0x5703('0x2a')](db['SmsMessage'][_0x5703('0x20')]);_0x2939c5[_0x5703('0x26')]=_['keys'](_0x3cc975[_0x5703('0x26')]);_0x2939c5[_0x5703('0x3d')]=_[_0x5703('0x2b')](_0x2939c5[_0x5703('0x29')],_0x2939c5['query']);_0x4007e5[_0x5703('0x2c')]=_['intersection'](_0x2939c5[_0x5703('0x29')],qs['fields'](_0x3cc975[_0x5703('0x26')][_0x5703('0x2d')]));_0x4007e5[_0x5703('0x2c')]=_0x4007e5[_0x5703('0x2c')]['length']?_0x4007e5[_0x5703('0x2c')]:_0x2939c5[_0x5703('0x29')];if(!_0x3cc975[_0x5703('0x26')][_0x5703('0x3e')](_0x5703('0x3f'))){_0x4007e5[_0x5703('0x13')]=qs[_0x5703('0x13')](_0x3cc975[_0x5703('0x26')][_0x5703('0x13')]);_0x4007e5['offset']=qs['offset'](_0x3cc975[_0x5703('0x26')][_0x5703('0x40')]);}_0x4007e5[_0x5703('0x41')]=qs[_0x5703('0x42')](_0x3cc975[_0x5703('0x26')][_0x5703('0x42')]);_0x4007e5[_0x5703('0x43')]=qs[_0x5703('0x3d')](_['pick'](_0x3cc975['query'],_0x2939c5[_0x5703('0x3d')]));_0x4007e5['where'][_0x5703('0x44')]=_0x1773dd['id'];if(_0x3cc975[_0x5703('0x26')][_0x5703('0x45')]){_0x4007e5[_0x5703('0x43')]=_[_0x5703('0x2f')](_0x4007e5[_0x5703('0x43')],{'$or':_['map'](_0x4007e5[_0x5703('0x2c')],function(_0x23bb07){var _0x37e420={};_0x37e420[_0x23bb07]={'$like':'%'+_0x3cc975[_0x5703('0x26')][_0x5703('0x45')]+'%'};return _0x37e420;})});}if(_0x3cc975[_0x5703('0x26')][_0x5703('0x46')]){var _0x34c9fe=_0x3cc975[_0x5703('0x26')][_0x5703('0x46')][_0x5703('0x47')](',');var _0x4b5197={};_0x4b5197[_0x34c9fe[0x0]]={'$gte':moment(_0x34c9fe[0x1])['format'](_0x5703('0x48'))};_0x4007e5[_0x5703('0x43')]=_['merge'](_0x4007e5[_0x5703('0x43')],_0x4b5197);}_0x4007e5=_[_0x5703('0x2f')]({},_0x4007e5,_0x3cc975[_0x5703('0x30')]);return db['SmsMessage'][_0x5703('0x15')]({'where':_0x4007e5[_0x5703('0x43')]})[_0x5703('0x18')](function(_0x559eda){_0x58b66e[_0x5703('0x15')]=_0x559eda;if(_0x3cc975[_0x5703('0x26')][_0x5703('0x2e')]){_0x4007e5[_0x5703('0x49')]=[{'all':!![]}];}return db[_0x5703('0x38')][_0x5703('0x24')](_0x4007e5);})[_0x5703('0x18')](function(_0x54eb26){_0x58b66e['rows']=_0x54eb26;return _0x58b66e;});}})[_0x5703('0x18')](respondWithFilteredResult(_0x460dd3,_0x4007e5))['catch'](handleError(_0x460dd3,null));};exports['addTags']=function(_0x4de7c0,_0x36a05e){return db[_0x5703('0x1f')][_0x5703('0x31')]({'where':{'id':_0x4de7c0[_0x5703('0x35')]['id']}})['then'](handleEntityNotFound(_0x36a05e,null))['then'](function(_0x31fb6c){if(_0x31fb6c){return _0x31fb6c[_0x5703('0x4a')](_0x4de7c0[_0x5703('0x34')][_0x5703('0x39')],_[_0x5703('0x3a')](_0x4de7c0[_0x5703('0x34')],[_0x5703('0x39'),'id'])||{})[_0x5703('0x4b')](function(){return db[_0x5703('0x4c')][_0x5703('0x24')]({'attributes':['id',_0x5703('0x1c'),_0x5703('0x4d')],'where':{'id':_0x4de7c0[_0x5703('0x34')][_0x5703('0x39')]}});})['then'](function(_0x3ad441){socket['emit'](_0x5703('0x4e'),{'id':Number(_0x4de7c0[_0x5703('0x35')]['id']),'tags':_0x3ad441||[]});return{'id':Number(_0x4de7c0[_0x5703('0x35')]['id']),'tags':_0x3ad441||[]};});}})['then'](respondWithResult(_0x36a05e,null))[_0x5703('0x27')](handleError(_0x36a05e,null));};exports[_0x5703('0x4f')]=function(_0x108a2a,_0x9a4f51){return db[_0x5703('0x1f')][_0x5703('0x31')]({'where':{'id':_0x108a2a[_0x5703('0x35')]['id']}})[_0x5703('0x18')](handleEntityNotFound(_0x9a4f51,null))[_0x5703('0x18')](function(_0x49c970){if(_0x49c970){return _0x49c970[_0x5703('0x4f')](_0x108a2a[_0x5703('0x26')]['ids']);}})['then'](respondWithStatusCode(_0x9a4f51,null))[_0x5703('0x27')](handleError(_0x9a4f51,null));};exports['download']=function(_0x44e53e,_0x383bb1){var _0x49db10=moment()[_0x5703('0x50')]()[_0x5703('0x51')]();var _0x172319=path[_0x5703('0x52')](config[_0x5703('0x53')],_0x5703('0x54'),'files',_0x5703('0x55'));var _0x56b34d=path[_0x5703('0x52')](_0x172319,_0x49db10);var _0x552a21=util[_0x5703('0x56')](_0x5703('0x57'),_0x44e53e['params']['id'],_0x49db10);var _0x578836=path[_0x5703('0x52')](_0x172319,_0x552a21);var _0x48827a=[];_0x48827a[_0x5703('0x58')]({'model':db[_0x5703('0x59')],'as':_0x5703('0x59'),'attributes':['id','fullname'],'raw':!![]});_0x48827a[_0x5703('0x58')]({'model':db[_0x5703('0x5a')],'as':_0x5703('0x5b'),'attributes':['id',_0x5703('0x5c'),_0x5703('0x5d')],'raw':!![]});var _0x18d36b=[{'model':db[_0x5703('0x38')],'as':_0x5703('0x5e'),'attributes':['id',_0x5703('0x34'),_0x5703('0x5f'),_0x5703('0x60'),'secret',_0x5703('0x61')],'include':_0x48827a}];_0x18d36b[_0x5703('0x58')]({'model':db['SmsAccount'],'as':_0x5703('0x62'),'attributes':['id',_0x5703('0x1c')]});_0x18d36b[_0x5703('0x58')]({'model':db[_0x5703('0x59')],'as':_0x5703('0x63'),'attributes':['id','fullname']});return db[_0x5703('0x1f')][_0x5703('0x31')]({'where':{'id':_0x44e53e[_0x5703('0x35')]['id']},'include':_0x18d36b})[_0x5703('0x18')](handleEntityNotFound(_0x383bb1,null))['then'](function(_0x514feb){if(_0x514feb){var _0x3a8f58=_0x514feb['get']({'plain':!![]});fs[_0x5703('0x64')](_0x56b34d);var _0x5885d6={'channel':_0x5703('0x65'),'account':_0x3a8f58[_0x5703('0x62')]['name'],'agent':_0x3a8f58[_0x5703('0x63')]?_0x3a8f58[_0x5703('0x63')][_0x5703('0x66')]:_0x5703('0x67'),'createdAt':moment(_0x3a8f58[_0x5703('0x5f')])[_0x5703('0x56')]('YYYY-MM-DD\x20HH:mm:ss')[_0x5703('0x51')](),'closedAt':_0x3a8f58[_0x5703('0x68')]?moment(_0x3a8f58[_0x5703('0x69')])[_0x5703('0x56')](_0x5703('0x48'))[_0x5703('0x51')]():'','disposition':_0x3a8f58['disposition'],'messages':_(_0x3a8f58[_0x5703('0x5e')])[_0x5703('0x45')]({'secret':![]})[_0x5703('0x6a')](function(_0x139695){return{'date':moment(_0x139695['createdAt'])[_0x5703('0x56')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'sender':_0x139695['direction']==='out'?_0x139695[_0x5703('0x59')]?_0x139695['User'][_0x5703('0x66')]:_0x5703('0x6b'):_0x139695[_0x5703('0x5b')][_0x5703('0x5c')]+(_0x139695[_0x5703('0x5b')][_0x5703('0x5d')]?'\x20'+_0x139695[_0x5703('0x5b')][_0x5703('0x5d')]:''),'body':_0x139695[_0x5703('0x34')],'direction':_0x139695[_0x5703('0x60')]==='out'?'A':'C','secret':_0x139695[_0x5703('0x6c')],'read':_0x139695[_0x5703('0x61')]};})[_0x5703('0x6d')]()};return ejs[_0x5703('0x6e')](path['join'](config[_0x5703('0x53')],_0x5703('0x54'),_0x5703('0x6f'),'downloadInteraction.ejs'),{'interaction':_0x5885d6})[_0x5703('0x18')](function(_0x3d9a03){var _0x1aa462=path['join'](_0x56b34d,_0x5703('0x70')+_0x3a8f58['id']+'-'+_0x49db10+_0x5703('0x71'));var _0x41b8b1={'path':_0x1aa462,'channel':_0x5703('0x65'),'interactionId':_0x3a8f58['id']};return pdf['createPdfFromHTML'](_0x3d9a03,_0x41b8b1);})[_0x5703('0x18')](function(){return new BPromise(function(_0x23d4c4,_0x5a10cd){zipdir(_0x56b34d,{'saveTo':_0x578836},function(_0x2da6e3,_0x589403){if(_0x2da6e3)return _0x5a10cd(_0x2da6e3);return _0x23d4c4(_0x589403);});})[_0x5703('0x18')](function(){return new BPromise(function(_0xf5c453,_0xf93c2d){rimraf(_0x56b34d,function(_0x28f8e3){if(_0x28f8e3)_0xf93c2d(_0x28f8e3);return _0xf5c453();});});})[_0x5703('0x18')](function(){return _0x383bb1[_0x5703('0x72')](_0x578836,_0x552a21,function(_0x1bcb49){if(_0x1bcb49){console[_0x5703('0x73')]('err',_0x1bcb49);}else{fs['unlinkSync'](_0x578836);}});});});}else{return _0x383bb1['sendStatus'](0xc8);}})['catch'](handleError(_0x383bb1,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index 401cf73..996fca1 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 _0xcf2f=['setDataValue','Users','map','unreadMessages','emit','catch','hasOwnProperty','events','../../mysqldb','SmsInteraction','SmsMessage','save','update','remove','getUsers','then'];(function(_0x4e4f0e,_0x1c3892){var _0x1a7219=function(_0x3821ad){while(--_0x3821ad){_0x4e4f0e['push'](_0x4e4f0e['shift']());}};_0x1a7219(++_0x1c3892);}(_0xcf2f,0xa7));var _0xfcf2=function(_0x3759d5,_0xc554b7){_0x3759d5=_0x3759d5-0x0;var _0xab5f42=_0xcf2f[_0x3759d5];return _0xab5f42;};'use strict';var EventEmitter=require(_0xfcf2('0x0'));var SmsInteraction=require(_0xfcf2('0x1'))['db'][_0xfcf2('0x2')];var SmsMessage=require(_0xfcf2('0x1'))['db'][_0xfcf2('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xfcf2('0x4'),'afterUpdate':_0xfcf2('0x5'),'afterDestroy':_0xfcf2('0x6')};function emitEvent(_0x34bcaf){return function(_0x179e60,_0x167a77,_0x1e6d99){_0x179e60[_0xfcf2('0x7')]({'attributes':['id'],'raw':!![]})[_0xfcf2('0x8')](function(_0x157f48){_0x179e60[_0xfcf2('0x9')](_0xfcf2('0xa'),_0x157f48[_0xfcf2('0xb')](function(_0x13ce18){return{'id':_0x13ce18['id']};}));return SmsMessage['findAll']({'where':{'SmsInteractionId':_0x179e60['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x4d6fc9){_0x179e60[_0xfcf2('0x9')](_0xfcf2('0xc'),_0x4d6fc9['length']);SmsInteractionEvents[_0xfcf2('0xd')](_0x34bcaf+':'+_0x179e60['id'],_0x179e60);SmsInteractionEvents[_0xfcf2('0xd')](_0x34bcaf,_0x179e60);_0x1e6d99(null);})[_0xfcf2('0xe')](_0x1e6d99(null));};}for(var e in events){if(events[_0xfcf2('0xf')](e)){var event=events[e];SmsInteraction['hook'](e,emitEvent(event));}}module['exports']=SmsInteractionEvents; \ No newline at end of file +var _0xea28=['Users','map','findAll','unreadMessages','emit','catch','hasOwnProperty','exports','events','../../mysqldb','SmsInteraction','SmsMessage','setMaxListeners','save','update','getUsers','then','setDataValue'];(function(_0x4e9628,_0x250573){var _0x27bc8c=function(_0xb3b7ae){while(--_0xb3b7ae){_0x4e9628['push'](_0x4e9628['shift']());}};_0x27bc8c(++_0x250573);}(_0xea28,0x13a));var _0x8ea2=function(_0x343f37,_0x5bf8df){_0x343f37=_0x343f37-0x0;var _0x2d903f=_0xea28[_0x343f37];return _0x2d903f;};'use strict';var EventEmitter=require(_0x8ea2('0x0'));var SmsInteraction=require(_0x8ea2('0x1'))['db'][_0x8ea2('0x2')];var SmsMessage=require(_0x8ea2('0x1'))['db'][_0x8ea2('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x8ea2('0x4')](0x0);var events={'afterCreate':_0x8ea2('0x5'),'afterUpdate':_0x8ea2('0x6'),'afterDestroy':'remove'};function emitEvent(_0x9b45ab){return function(_0x23aaf1,_0x1ccf12,_0x513a0d){_0x23aaf1[_0x8ea2('0x7')]({'attributes':['id'],'raw':!![]})[_0x8ea2('0x8')](function(_0xb7f278){_0x23aaf1[_0x8ea2('0x9')](_0x8ea2('0xa'),_0xb7f278[_0x8ea2('0xb')](function(_0x19bd6c){return{'id':_0x19bd6c['id']};}));return SmsMessage[_0x8ea2('0xc')]({'where':{'SmsInteractionId':_0x23aaf1['id'],'direction':'in','read':![]},'raw':!![]});})[_0x8ea2('0x8')](function(_0x3000f9){_0x23aaf1[_0x8ea2('0x9')](_0x8ea2('0xd'),_0x3000f9['length']);SmsInteractionEvents['emit'](_0x9b45ab+':'+_0x23aaf1['id'],_0x23aaf1);SmsInteractionEvents[_0x8ea2('0xe')](_0x9b45ab,_0x23aaf1);_0x513a0d(null);})[_0x8ea2('0xf')](_0x513a0d(null));};}for(var e in events){if(events[_0x8ea2('0x10')](e)){var event=events[e];SmsInteraction['hook'](e,emitEvent(event));}}module[_0x8ea2('0x11')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index 9c9dd1c..a455aa0 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 _0x475a=['rimraf','../../config/environment','./smsInteraction.attributes','define','sms_interactions','changed','closed','format','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x2fd9ef,_0x25c789){var _0x13211f=function(_0x4c7509){while(--_0x4c7509){_0x2fd9ef['push'](_0x2fd9ef['shift']());}};_0x13211f(++_0x25c789);}(_0x475a,0xa2));var _0xa475=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x475a[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0xa475('0x0'));var util=require(_0xa475('0x1'));var logger=require(_0xa475('0x2'))(_0xa475('0x3'));var moment=require(_0xa475('0x4'));var BPromise=require('bluebird');var rp=require(_0xa475('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa475('0x6'));var config=require(_0xa475('0x7'));var attributes=require(_0xa475('0x8'));module['exports']=function(_0x31454c,_0x3be861){return _0x31454c[_0xa475('0x9')]('SmsInteraction',attributes,{'tableName':_0xa475('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1b36c6,_0x2eb08d,_0x555499){if(_0x1b36c6[_0xa475('0xb')](_0xa475('0xc'))){_0x1b36c6['closedAt']=moment()[_0xa475('0xd')]('YYYY-MM-DD\x20HH:mm:ss');}_0x555499(null,_0x1b36c6);}}});}; \ No newline at end of file +var _0xb536=['SmsInteraction','sms_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird','../../config/environment','exports','define'];(function(_0x20e882,_0x16185c){var _0x3e0dbe=function(_0x3d0129){while(--_0x3d0129){_0x20e882['push'](_0x20e882['shift']());}};_0x3e0dbe(++_0x16185c);}(_0xb536,0x87));var _0x6b53=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb536[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x6b53('0x0'));var util=require(_0x6b53('0x1'));var logger=require(_0x6b53('0x2'))(_0x6b53('0x3'));var moment=require(_0x6b53('0x4'));var BPromise=require(_0x6b53('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x6b53('0x6'));var attributes=require('./smsInteraction.attributes');module[_0x6b53('0x7')]=function(_0x420108,_0x22920a){return _0x420108[_0x6b53('0x8')](_0x6b53('0x9'),attributes,{'tableName':_0x6b53('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3764e7,_0x2b9b25,_0x159b79){if(_0x3764e7[_0x6b53('0xb')](_0x6b53('0xc'))){_0x3764e7[_0x6b53('0xd')]=moment()[_0x6b53('0xe')](_0x6b53('0xf'));}_0x159b79(null,_0x3764e7);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index 76533da..4604861 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 _0xa7a6=['attributes','limit','AddTagsToSmsInteraction','find','addTags','body','omit','ids','spread','AddTags','lodash','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','redis','localhost','./smsInteraction.socket','then','info','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','UpdateSmsInteraction','SmsInteraction','options','raw','where'];(function(_0x42cc1f,_0xe9eb20){var _0x175df5=function(_0x2f3e22){while(--_0x2f3e22){_0x42cc1f['push'](_0x42cc1f['shift']());}};_0x175df5(++_0xe9eb20);}(_0xa7a6,0x196));var _0x6a7a=function(_0x1878db,_0x18d9f6){_0x1878db=_0x1878db-0x0;var _0x1ae242=_0xa7a6[_0x1878db];return _0x1ae242;};'use strict';var _=require(_0x6a7a('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x6a7a('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6a7a('0x2'));var db=require(_0x6a7a('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x6a7a('0x4'))(_0x6a7a('0x5'));var config=require('../../config/environment');var jayson=require(_0x6a7a('0x6'));var client=jayson['client']['http']({'port':0x232a});config[_0x6a7a('0x7')]=_['defaults'](config[_0x6a7a('0x7')],{'host':_0x6a7a('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6a7a('0x7')]));require(_0x6a7a('0x9'))['register'](socket);function respondWithRpcPromise(_0x4ae507,_0x3b5710,_0x393fd0){return new BPromise(function(_0x476d62,_0x13fed1){return client['request'](_0x4ae507,_0x393fd0)[_0x6a7a('0xa')](function(_0x42df46){logger[_0x6a7a('0xb')](_0x6a7a('0xc'),_0x3b5710,_0x6a7a('0xd'));logger[_0x6a7a('0xe')](_0x6a7a('0xf'),_0x3b5710,_0x6a7a('0xd'),JSON[_0x6a7a('0x10')](_0x42df46));if(_0x42df46[_0x6a7a('0x11')]){if(_0x42df46['error'][_0x6a7a('0x12')]===0x1f4){logger[_0x6a7a('0x11')](_0x6a7a('0xc'),_0x3b5710,_0x42df46[_0x6a7a('0x11')]['message']);return _0x13fed1(_0x42df46[_0x6a7a('0x11')][_0x6a7a('0x13')]);}logger[_0x6a7a('0x11')](_0x6a7a('0xc'),_0x3b5710,_0x42df46[_0x6a7a('0x11')][_0x6a7a('0x13')]);return _0x476d62(_0x42df46[_0x6a7a('0x11')][_0x6a7a('0x13')]);}else{logger[_0x6a7a('0xb')]('SmsInteraction,\x20%s,\x20%s',_0x3b5710,_0x6a7a('0xd'));_0x476d62(_0x42df46[_0x6a7a('0x14')]['message']);}})['catch'](function(_0x548124){logger[_0x6a7a('0x11')]('SmsInteraction,\x20%s,\x20%s',_0x3b5710,_0x548124);_0x13fed1(_0x548124);});});}exports[_0x6a7a('0x15')]=function(_0x14b0cd){var _0x519bd6=this;return new Promise(function(_0x14825c,_0x1ea6a2){return db[_0x6a7a('0x16')]['update'](_0x14b0cd['body'],{'raw':_0x14b0cd['options']?_0x14b0cd[_0x6a7a('0x17')][_0x6a7a('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x14b0cd[_0x6a7a('0x17')]?_0x14b0cd[_0x6a7a('0x17')][_0x6a7a('0x19')]||null:null,'attributes':_0x14b0cd[_0x6a7a('0x17')]?_0x14b0cd[_0x6a7a('0x17')][_0x6a7a('0x1a')]||null:null,'limit':_0x14b0cd['options']?_0x14b0cd[_0x6a7a('0x17')][_0x6a7a('0x1b')]||null:null})['then'](function(_0x3d2967){logger[_0x6a7a('0xb')](_0x6a7a('0x15'),_0x14b0cd);logger['debug'](_0x6a7a('0x15'),_0x14b0cd,JSON['stringify'](_0x3d2967));_0x14825c(_0x3d2967);})['catch'](function(_0xae5aee){logger['error'](_0x6a7a('0x15'),_0xae5aee[_0x6a7a('0x13')],_0x14b0cd);_0x1ea6a2(_0x519bd6[_0x6a7a('0x11')](0x1f4,_0xae5aee['message']));});});};exports[_0x6a7a('0x1c')]=function(_0x473a9d){return new Promise(function(_0x4a0079,_0x394ee6){return db[_0x6a7a('0x16')][_0x6a7a('0x1d')]({'where':_0x473a9d['options']?_0x473a9d[_0x6a7a('0x17')][_0x6a7a('0x19')]||null:null})[_0x6a7a('0xa')](function(_0x34e76c){if(_0x34e76c){return _0x34e76c[_0x6a7a('0x1e')](_0x473a9d[_0x6a7a('0x1f')]['ids'],_[_0x6a7a('0x20')](_0x473a9d[_0x6a7a('0x1f')],[_0x6a7a('0x21'),'id'])||{});}})[_0x6a7a('0x22')](function(_0x53bbbb){logger[_0x6a7a('0xb')](_0x6a7a('0x23'),_0x473a9d);logger['debug'](_0x6a7a('0x23'),_0x473a9d,JSON['stringify'](_0x53bbbb));_0x4a0079(_0x53bbbb);})['catch'](function(_0x2a54fd){logger['error']('AddTags',_0x2a54fd[_0x6a7a('0x13')],_0x473a9d);_0x394ee6(_this['error'](0x1f4,_0x2a54fd[_0x6a7a('0x13')]));});});}; \ No newline at end of file +var _0x09b9=['body','options','raw','attributes','limit','catch','AddTagsToSmsInteraction','find','where','addTags','ids','omit','spread','AddTags','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','request','then','info','SmsInteraction,\x20%s,\x20%s','request\x20sent','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','UpdateSmsInteraction','SmsInteraction','update'];(function(_0x1f3208,_0x5dbed4){var _0x101880=function(_0x246215){while(--_0x246215){_0x1f3208['push'](_0x1f3208['shift']());}};_0x101880(++_0x5dbed4);}(_0x09b9,0x17f));var _0x909b=function(_0x3cbf83,_0x4a4cfc){_0x3cbf83=_0x3cbf83-0x0;var _0x44ebfd=_0x09b9[_0x3cbf83];return _0x44ebfd;};'use strict';var _=require(_0x909b('0x0'));var util=require(_0x909b('0x1'));var moment=require(_0x909b('0x2'));var BPromise=require(_0x909b('0x3'));var rs=require(_0x909b('0x4'));var fs=require('fs');var Redis=require(_0x909b('0x5'));var db=require(_0x909b('0x6'))['db'];var utils=require(_0x909b('0x7'));var logger=require(_0x909b('0x8'))('rpc');var config=require(_0x909b('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x909b('0xa')][_0x909b('0xb')]({'port':0x232a});config[_0x909b('0xc')]=_[_0x909b('0xd')](config[_0x909b('0xc')],{'host':_0x909b('0xe'),'port':0x18eb});var socket=require(_0x909b('0xf'))(new Redis(config[_0x909b('0xc')]));require(_0x909b('0x10'))['register'](socket);function respondWithRpcPromise(_0xa07ed4,_0x5243f5,_0x112da8){return new BPromise(function(_0x431b7d,_0x5bf00b){return client[_0x909b('0x11')](_0xa07ed4,_0x112da8)[_0x909b('0x12')](function(_0x4b15c2){logger[_0x909b('0x13')](_0x909b('0x14'),_0x5243f5,_0x909b('0x15'));logger['debug'](_0x909b('0x16'),_0x5243f5,'request\x20sent',JSON[_0x909b('0x17')](_0x4b15c2));if(_0x4b15c2[_0x909b('0x18')]){if(_0x4b15c2[_0x909b('0x18')][_0x909b('0x19')]===0x1f4){logger['error'](_0x909b('0x14'),_0x5243f5,_0x4b15c2[_0x909b('0x18')][_0x909b('0x1a')]);return _0x5bf00b(_0x4b15c2['error'][_0x909b('0x1a')]);}logger[_0x909b('0x18')](_0x909b('0x14'),_0x5243f5,_0x4b15c2[_0x909b('0x18')][_0x909b('0x1a')]);return _0x431b7d(_0x4b15c2[_0x909b('0x18')][_0x909b('0x1a')]);}else{logger[_0x909b('0x13')](_0x909b('0x14'),_0x5243f5,_0x909b('0x15'));_0x431b7d(_0x4b15c2[_0x909b('0x1b')][_0x909b('0x1a')]);}})['catch'](function(_0x481f22){logger[_0x909b('0x18')](_0x909b('0x14'),_0x5243f5,_0x481f22);_0x5bf00b(_0x481f22);});});}exports[_0x909b('0x1c')]=function(_0xb273b1){var _0x25cacd=this;return new Promise(function(_0xcd1fbc,_0x1b838c){return db[_0x909b('0x1d')][_0x909b('0x1e')](_0xb273b1[_0x909b('0x1f')],{'raw':_0xb273b1[_0x909b('0x20')]?_0xb273b1[_0x909b('0x20')][_0x909b('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xb273b1[_0x909b('0x20')]?_0xb273b1[_0x909b('0x20')]['where']||null:null,'attributes':_0xb273b1[_0x909b('0x20')]?_0xb273b1['options'][_0x909b('0x22')]||null:null,'limit':_0xb273b1[_0x909b('0x20')]?_0xb273b1['options'][_0x909b('0x23')]||null:null})[_0x909b('0x12')](function(_0x4f6541){logger[_0x909b('0x13')](_0x909b('0x1c'),_0xb273b1);logger['debug'](_0x909b('0x1c'),_0xb273b1,JSON[_0x909b('0x17')](_0x4f6541));_0xcd1fbc(_0x4f6541);})[_0x909b('0x24')](function(_0x159954){logger[_0x909b('0x18')](_0x909b('0x1c'),_0x159954[_0x909b('0x1a')],_0xb273b1);_0x1b838c(_0x25cacd[_0x909b('0x18')](0x1f4,_0x159954[_0x909b('0x1a')]));});});};exports[_0x909b('0x25')]=function(_0x267627){return new Promise(function(_0x571939,_0x1e0421){return db['SmsInteraction'][_0x909b('0x26')]({'where':_0x267627[_0x909b('0x20')]?_0x267627[_0x909b('0x20')][_0x909b('0x27')]||null:null})[_0x909b('0x12')](function(_0x12266b){if(_0x12266b){return _0x12266b[_0x909b('0x28')](_0x267627[_0x909b('0x1f')][_0x909b('0x29')],_[_0x909b('0x2a')](_0x267627[_0x909b('0x1f')],[_0x909b('0x29'),'id'])||{});}})[_0x909b('0x2b')](function(_0x5a77b0){logger['info'](_0x909b('0x2c'),_0x267627);logger[_0x909b('0x2d')](_0x909b('0x2c'),_0x267627,JSON['stringify'](_0x5a77b0));_0x571939(_0x5a77b0);})[_0x909b('0x24')](function(_0x59c15b){logger[_0x909b('0x18')](_0x909b('0x2c'),_0x59c15b['message'],_0x267627);_0x1e0421(_this[_0x909b('0x18')](0x1f4,_0x59c15b[_0x909b('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index afedf3f..946c07a 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 _0xed57=['smsInteraction:','save','remove','emit','removeListener','length'];(function(_0x497197,_0xa36190){var _0x42edfa=function(_0x38c253){while(--_0x38c253){_0x497197['push'](_0x497197['shift']());}};_0x42edfa(++_0xa36190);}(_0xed57,0xb5));var _0x7ed5=function(_0x319d9f,_0x1f798c){_0x319d9f=_0x319d9f-0x0;var _0x54e320=_0xed57[_0x319d9f];return _0x54e320;};'use strict';var SmsInteractionEvents=require('./smsInteraction.events');var events=[_0x7ed5('0x0'),_0x7ed5('0x1'),'update'];function createListener(_0x1b5c80,_0x5f1c3b){return function(_0x38708a){_0x5f1c3b[_0x7ed5('0x2')](_0x1b5c80,_0x38708a);};}function removeListener(_0x17cbb0,_0x2bbd80){return function(){SmsInteractionEvents[_0x7ed5('0x3')](_0x17cbb0,_0x2bbd80);};}exports['register']=function(_0x228076){for(var _0x265a24=0x0,_0x1598b7=events[_0x7ed5('0x4')];_0x265a24<_0x1598b7;_0x265a24++){var _0x2d978d=events[_0x265a24];var _0x4360bb=createListener(_0x7ed5('0x5')+_0x2d978d,_0x228076);SmsInteractionEvents['on'](_0x2d978d,_0x4360bb);}}; \ No newline at end of file +var _0x0f39=['emit','removeListener','register','length','./smsInteraction.events','remove'];(function(_0x30cdd4,_0x19e09f){var _0x562799=function(_0xaf55fe){while(--_0xaf55fe){_0x30cdd4['push'](_0x30cdd4['shift']());}};_0x562799(++_0x19e09f);}(_0x0f39,0x1d8));var _0x90f3=function(_0x17ef4d,_0x3b95a7){_0x17ef4d=_0x17ef4d-0x0;var _0x41ba9d=_0x0f39[_0x17ef4d];return _0x41ba9d;};'use strict';var SmsInteractionEvents=require(_0x90f3('0x0'));var events=['save',_0x90f3('0x1'),'update'];function createListener(_0x1ce544,_0x2357d3){return function(_0x468633){_0x2357d3[_0x90f3('0x2')](_0x1ce544,_0x468633);};}function removeListener(_0x8a6ac4,_0x313e1b){return function(){SmsInteractionEvents[_0x90f3('0x3')](_0x8a6ac4,_0x313e1b);};}exports[_0x90f3('0x4')]=function(_0x264404){for(var _0x17e1fa=0x0,_0x1edfa2=events[_0x90f3('0x5')];_0x17e1fa<_0x1edfa2;_0x17e1fa++){var _0x360b3e=events[_0x17e1fa];var _0x2b42f3=createListener('smsInteraction:'+_0x360b3e,_0x264404);SmsInteractionEvents['on'](_0x360b3e,_0x2b42f3);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index 6b3e3c9..0506920 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 _0x5926=['reject','delete','exports','multer','util','path','express','Router','../../config/environment','./smsMessage.controller','get','isAuthenticated','describe','/:id','post','tracked','sms','create','status','update','put','/:id/accept','accept','/:id/reject'];(function(_0x4e6fb2,_0x3cf23e){var _0x2f1636=function(_0x53c7eb){while(--_0x53c7eb){_0x4e6fb2['push'](_0x4e6fb2['shift']());}};_0x2f1636(++_0x3cf23e);}(_0x5926,0xdb));var _0x6592=function(_0x25950a,_0x360c8b){_0x25950a=_0x25950a-0x0;var _0x55271e=_0x5926[_0x25950a];return _0x55271e;};'use strict';var multer=require(_0x6592('0x0'));var util=require(_0x6592('0x1'));var path=require(_0x6592('0x2'));var timeout=require('connect-timeout');var express=require(_0x6592('0x3'));var router=express[_0x6592('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x6592('0x5'));var controller=require(_0x6592('0x6'));router[_0x6592('0x7')]('/',auth[_0x6592('0x8')](),controller['index']);router[_0x6592('0x7')]('/describe',auth[_0x6592('0x8')](),controller[_0x6592('0x9')]);router[_0x6592('0x7')](_0x6592('0xa'),auth[_0x6592('0x8')](),controller['show']);router[_0x6592('0xb')]('/',auth[_0x6592('0x8')](),interaction[_0x6592('0xc')](_0x6592('0xd'),'smsmessage:create'),controller[_0x6592('0xe')]);router[_0x6592('0xb')]('/:id/status',controller[_0x6592('0xf')]);router['put']('/:id',auth[_0x6592('0x8')](),controller[_0x6592('0x10')]);router[_0x6592('0x11')](_0x6592('0x12'),auth[_0x6592('0x8')](),controller[_0x6592('0x13')]);router[_0x6592('0x11')](_0x6592('0x14'),auth[_0x6592('0x8')](),controller[_0x6592('0x15')]);router[_0x6592('0x16')](_0x6592('0xa'),auth[_0x6592('0x8')](),controller['destroy']);module[_0x6592('0x17')]=router; \ No newline at end of file +var _0x980f=['../../components/interaction/service','./smsMessage.controller','get','isAuthenticated','index','/:id','show','post','tracked','smsmessage:create','create','status','put','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer','connect-timeout','Router','../../components/auth/service'];(function(_0xa3400,_0x3a980a){var _0x33dba2=function(_0x5e988b){while(--_0x5e988b){_0xa3400['push'](_0xa3400['shift']());}};_0x33dba2(++_0x3a980a);}(_0x980f,0x104));var _0xf980=function(_0x3dac2c,_0x2ad312){_0x3dac2c=_0x3dac2c-0x0;var _0x23f73a=_0x980f[_0x3dac2c];return _0x23f73a;};'use strict';var multer=require(_0xf980('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xf980('0x1'));var express=require('express');var router=express[_0xf980('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xf980('0x3'));var interaction=require(_0xf980('0x4'));var config=require('../../config/environment');var controller=require(_0xf980('0x5'));router[_0xf980('0x6')]('/',auth[_0xf980('0x7')](),controller[_0xf980('0x8')]);router[_0xf980('0x6')]('/describe',auth[_0xf980('0x7')](),controller['describe']);router[_0xf980('0x6')](_0xf980('0x9'),auth[_0xf980('0x7')](),controller[_0xf980('0xa')]);router[_0xf980('0xb')]('/',auth['isAuthenticated'](),interaction[_0xf980('0xc')]('sms',_0xf980('0xd')),controller[_0xf980('0xe')]);router['post']('/:id/status',controller[_0xf980('0xf')]);router[_0xf980('0x10')](_0xf980('0x9'),auth[_0xf980('0x7')](),controller['update']);router['put'](_0xf980('0x11'),auth[_0xf980('0x7')](),controller[_0xf980('0x12')]);router[_0xf980('0x10')](_0xf980('0x13'),auth[_0xf980('0x7')](),controller[_0xf980('0x14')]);router[_0xf980('0x15')](_0xf980('0x9'),auth[_0xf980('0x7')](),controller[_0xf980('0x16')]);module[_0xf980('0x17')]=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index 9a01d7b..321e64c 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 _0x94c8=['BOOLEAN','TEXT','sequelize','exports','medium','ENUM','out','STRING'];(function(_0x49097c,_0x58f038){var _0x23fa66=function(_0x3a2192){while(--_0x3a2192){_0x49097c['push'](_0x49097c['shift']());}};_0x23fa66(++_0x58f038);}(_0x94c8,0x92));var _0x894c=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x94c8[_0x2641f9];return _0x585741;};'use strict';var Sequelize=require(_0x894c('0x0'));module[_0x894c('0x1')]={'body':{'type':Sequelize['TEXT'](_0x894c('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x894c('0x3')]('in',_0x894c('0x4')),'defaultValue':_0x894c('0x4'),'allowNull':![]},'messageId':{'type':Sequelize[_0x894c('0x5')](0xbe)},'phone':{'type':Sequelize[_0x894c('0x5')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0x894c('0x6')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x894c('0x5')]},'providerResponse':{'type':Sequelize[_0x894c('0x7')]}}; \ No newline at end of file +var _0xadd2=['out','STRING','DATE','TEXT','BOOLEAN','ENUM'];(function(_0x46466d,_0x15478d){var _0x2fba31=function(_0x23ea61){while(--_0x23ea61){_0x46466d['push'](_0x46466d['shift']());}};_0x2fba31(++_0x15478d);}(_0xadd2,0xa5));var _0x2add=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0xadd2[_0x27af45];return _0x18df21;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize[_0x2add('0x0')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x2add('0x1')],'defaultValue':![]},'direction':{'type':Sequelize[_0x2add('0x2')]('in',_0x2add('0x3')),'defaultValue':_0x2add('0x3'),'allowNull':![]},'messageId':{'type':Sequelize[_0x2add('0x4')](0xbe)},'phone':{'type':Sequelize[_0x2add('0x4')]},'readAt':{'type':Sequelize[_0x2add('0x5')]},'secret':{'type':Sequelize[_0x2add('0x1')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x2add('0x4')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index 5ed1c15..31f8458 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 _0x9bb3=['Sequelize','contact','rejectmessage','SmsAccount','debug','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','sent','delivered','Status','plivio','results','groupName','infobip','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','defaults','redis','localhost','socket.io-emitter','./smsMessage.socket','register','http','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','end','status','json','offset','undefined','count','limit','set','Content-Range','reject','destroy','stack','name','send','index','map','SmsMessage','rawAttributes','type','key','model','query','fields','attributes','length','hasOwnProperty','order','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','include','rows','show','params','keys','filters','intersection','find','create','body','update','describe','accept','sms','read','readAt','UserId','user','agent','get','SmsInteraction','SmsInteractionId','read1stAt','format','YYYY-MM-DD\x20HH:mm:ss','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','null','acceptMessage','sequelize','QueryTypes','SELECT','User','fullname','email','manual','interface','SIP/%s','channel','EventManager','acceptmessage','sms-interactions','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId'];(function(_0x4b6a42,_0x4f4faf){var _0x481270=function(_0xbdd6c8){while(--_0xbdd6c8){_0x4b6a42['push'](_0x4b6a42['shift']());}};_0x481270(++_0x4f4faf);}(_0x9bb3,0x134));var _0x39bb=function(_0x45cf5d,_0x51bdb6){_0x45cf5d=_0x45cf5d-0x0;var _0x207ed3=_0x9bb3[_0x45cf5d];return _0x207ed3;};'use strict';var emlformat=require(_0x39bb('0x0'));var rimraf=require(_0x39bb('0x1'));var zipdir=require(_0x39bb('0x2'));var jsonpatch=require(_0x39bb('0x3'));var rp=require(_0x39bb('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x39bb('0x5'));var util=require(_0x39bb('0x6'));var path=require(_0x39bb('0x7'));var sox=require(_0x39bb('0x8'));var csv=require(_0x39bb('0x9'));var ejs=require(_0x39bb('0xa'));var fs=require('fs');var fs_extra=require(_0x39bb('0xb'));var _=require(_0x39bb('0xc'));var squel=require(_0x39bb('0xd'));var crypto=require(_0x39bb('0xe'));var jsforce=require(_0x39bb('0xf'));var deskjs=require(_0x39bb('0x10'));var toCsv=require(_0x39bb('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x39bb('0x11'));var authService=require(_0x39bb('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x39bb('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x39bb('0x14'))(_0x39bb('0x15'));var utils=require(_0x39bb('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x39bb('0x17'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x39bb('0x18')](config[_0x39bb('0x19')],{'host':_0x39bb('0x1a'),'port':0x18eb});var socket=require(_0x39bb('0x1b'))(new Redis(config[_0x39bb('0x19')]));require(_0x39bb('0x1c'))[_0x39bb('0x1d')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x39bb('0x1e')]({'port':0x232c});var client9002=jayson['client'][_0x39bb('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x40ee8f,_0x34c794,_0x240e20,_0x2a81d9){return new BPromise(function(_0x138879,_0x3a567e){var _0x27fa0f=_0x2a81d9||client;return _0x27fa0f[_0x39bb('0x1f')](_0x40ee8f,_0x240e20)[_0x39bb('0x20')](function(_0x51ebdb){logger[_0x39bb('0x21')](_0x39bb('0x22'),_0x34c794,_0x39bb('0x23'));logger['debug'](_0x39bb('0x24'),_0x34c794,_0x39bb('0x23'),JSON[_0x39bb('0x25')](_0x51ebdb));if(_0x51ebdb[_0x39bb('0x26')]){if(_0x51ebdb[_0x39bb('0x26')][_0x39bb('0x27')]===0x1f4){logger[_0x39bb('0x26')](_0x39bb('0x22'),_0x34c794,_0x51ebdb['error'][_0x39bb('0x28')]);return _0x3a567e(_0x51ebdb['error']['message']);}logger[_0x39bb('0x26')](_0x39bb('0x22'),_0x34c794,_0x51ebdb['error']['message']);return _0x138879(_0x51ebdb[_0x39bb('0x26')][_0x39bb('0x28')]);}else{logger['info'](_0x39bb('0x22'),_0x34c794,_0x39bb('0x23'));_0x138879(_0x51ebdb[_0x39bb('0x29')]['message']);}})[_0x39bb('0x2a')](function(_0x492eb6){logger[_0x39bb('0x26')](_0x39bb('0x22'),_0x34c794,_0x492eb6);_0x3a567e(_0x492eb6);});});}function respondWithStatusCode(_0x1ea4b7,_0x3ed6f2){_0x3ed6f2=_0x3ed6f2||0xcc;return function(_0x91916f){if(_0x91916f){return _0x1ea4b7['sendStatus'](_0x3ed6f2);}return _0x1ea4b7['status'](_0x3ed6f2)[_0x39bb('0x2b')]();};}function respondWithResult(_0x41acf4,_0x5841f9){_0x5841f9=_0x5841f9||0xc8;return function(_0x5d4427){if(_0x5d4427){return _0x41acf4[_0x39bb('0x2c')](_0x5841f9)[_0x39bb('0x2d')](_0x5d4427);}};}function respondWithFilteredResult(_0x14440b,_0x55af04){return function(_0x68025){if(_0x68025){var _0x512573=typeof _0x55af04[_0x39bb('0x2e')]===_0x39bb('0x2f')&&typeof _0x55af04['limit']===_0x39bb('0x2f');var _0x229dd6=_0x68025[_0x39bb('0x30')];var _0x28cb9b=_0x512573?0x0:_0x55af04[_0x39bb('0x2e')];var _0x5b17c8=_0x512573?_0x68025[_0x39bb('0x30')]:_0x55af04[_0x39bb('0x2e')]+_0x55af04[_0x39bb('0x31')];var _0x42ba84;if(_0x5b17c8>=_0x229dd6){_0x5b17c8=_0x229dd6;_0x42ba84=0xc8;}else{_0x42ba84=0xce;}_0x14440b[_0x39bb('0x2c')](_0x42ba84);return _0x14440b[_0x39bb('0x32')](_0x39bb('0x33'),_0x28cb9b+'-'+_0x5b17c8+'/'+_0x229dd6)['json'](_0x68025);}return null;};}function patchUpdates(_0x182460){return function(_0x411646){try{jsonpatch['apply'](_0x411646,_0x182460,!![]);}catch(_0x2f6bdd){return BPromise[_0x39bb('0x34')](_0x2f6bdd);}return _0x411646['save']();};}function saveUpdates(_0x33f7b4,_0x2c9070){return function(_0x45b620){if(_0x45b620){return _0x45b620['update'](_0x33f7b4)['then'](function(_0x48a003){return _0x48a003;});}return null;};}function removeEntity(_0x201caa,_0x3e76ce){return function(_0x348aac){if(_0x348aac){return _0x348aac[_0x39bb('0x35')]()['then'](function(){_0x201caa[_0x39bb('0x2c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3ffbb1,_0x502139){return function(_0x4cdf9d){if(!_0x4cdf9d){_0x3ffbb1['sendStatus'](0x194);}return _0x4cdf9d;};}function handleError(_0x4bc0ea,_0x16e8ea){_0x16e8ea=_0x16e8ea||0x1f4;return function(_0x409c22){logger['error'](_0x409c22[_0x39bb('0x36')]);if(_0x409c22[_0x39bb('0x37')]){delete _0x409c22['name'];}_0x4bc0ea['status'](_0x16e8ea)[_0x39bb('0x38')](_0x409c22);};}exports[_0x39bb('0x39')]=function(_0x322959,_0x119ac7){var _0x38bc96={},_0x100ab4={},_0x3f2d61={'count':0x0,'rows':[]};var _0x3f70ec=_[_0x39bb('0x3a')](db[_0x39bb('0x3b')][_0x39bb('0x3c')],function(_0x5cbab9){return{'name':_0x5cbab9['fieldName'],'type':_0x5cbab9[_0x39bb('0x3d')][_0x39bb('0x3e')]};});_0x100ab4[_0x39bb('0x3f')]=_[_0x39bb('0x3a')](_0x3f70ec,_0x39bb('0x37'));_0x100ab4['query']=_['keys'](_0x322959['query']);_0x100ab4['filters']=_['intersection'](_0x100ab4['model'],_0x100ab4[_0x39bb('0x40')]);_0x38bc96['attributes']=_['intersection'](_0x100ab4[_0x39bb('0x3f')],qs['fields'](_0x322959['query'][_0x39bb('0x41')]));_0x38bc96[_0x39bb('0x42')]=_0x38bc96[_0x39bb('0x42')][_0x39bb('0x43')]?_0x38bc96[_0x39bb('0x42')]:_0x100ab4[_0x39bb('0x3f')];if(!_0x322959[_0x39bb('0x40')][_0x39bb('0x44')]('nolimit')){_0x38bc96['limit']=qs[_0x39bb('0x31')](_0x322959[_0x39bb('0x40')][_0x39bb('0x31')]);_0x38bc96[_0x39bb('0x2e')]=qs[_0x39bb('0x2e')](_0x322959[_0x39bb('0x40')][_0x39bb('0x2e')]);}_0x38bc96[_0x39bb('0x45')]=qs[_0x39bb('0x46')](_0x322959['query'][_0x39bb('0x46')]);_0x38bc96['where']=qs['filters'](_[_0x39bb('0x47')](_0x322959[_0x39bb('0x40')],_0x100ab4['filters']),_0x3f70ec);if(_0x322959[_0x39bb('0x40')][_0x39bb('0x48')]){_0x38bc96[_0x39bb('0x49')]=_['merge'](_0x38bc96[_0x39bb('0x49')],{'$or':_[_0x39bb('0x3a')](_0x3f70ec,function(_0x2b325b){if(_0x2b325b[_0x39bb('0x3d')]!==_0x39bb('0x4a')){var _0x3bd836={};_0x3bd836[_0x2b325b[_0x39bb('0x37')]]={'$like':'%'+_0x322959[_0x39bb('0x40')][_0x39bb('0x48')]+'%'};return _0x3bd836;}})});}_0x38bc96=_[_0x39bb('0x4b')]({},_0x38bc96,_0x322959[_0x39bb('0x4c')]);var _0x30d132={'where':_0x38bc96[_0x39bb('0x49')]};return db[_0x39bb('0x3b')][_0x39bb('0x30')](_0x30d132)['then'](function(_0x27b27b){_0x3f2d61[_0x39bb('0x30')]=_0x27b27b;if(_0x322959[_0x39bb('0x40')][_0x39bb('0x4d')]){_0x38bc96[_0x39bb('0x4e')]=[{'all':!![]}];}return db['SmsMessage']['findAll'](_0x38bc96);})[_0x39bb('0x20')](function(_0x5eb57a){_0x3f2d61[_0x39bb('0x4f')]=_0x5eb57a;return _0x3f2d61;})[_0x39bb('0x20')](respondWithFilteredResult(_0x119ac7,_0x38bc96))[_0x39bb('0x2a')](handleError(_0x119ac7,null));};exports[_0x39bb('0x50')]=function(_0x3e9b4d,_0x523a3b){var _0x2f2e96={'raw':!![],'where':{'id':_0x3e9b4d[_0x39bb('0x51')]['id']}},_0x6a8458={};_0x6a8458[_0x39bb('0x3f')]=_[_0x39bb('0x52')](db[_0x39bb('0x3b')][_0x39bb('0x3c')]);_0x6a8458[_0x39bb('0x40')]=_[_0x39bb('0x52')](_0x3e9b4d[_0x39bb('0x40')]);_0x6a8458[_0x39bb('0x53')]=_['intersection'](_0x6a8458[_0x39bb('0x3f')],_0x6a8458[_0x39bb('0x40')]);_0x2f2e96[_0x39bb('0x42')]=_[_0x39bb('0x54')](_0x6a8458[_0x39bb('0x3f')],qs[_0x39bb('0x41')](_0x3e9b4d[_0x39bb('0x40')][_0x39bb('0x41')]));_0x2f2e96['attributes']=_0x2f2e96['attributes'][_0x39bb('0x43')]?_0x2f2e96[_0x39bb('0x42')]:_0x6a8458[_0x39bb('0x3f')];if(_0x3e9b4d['query'][_0x39bb('0x4d')]){_0x2f2e96[_0x39bb('0x4e')]=[{'all':!![]}];}_0x2f2e96=_[_0x39bb('0x4b')]({},_0x2f2e96,_0x3e9b4d['options']);return db[_0x39bb('0x3b')][_0x39bb('0x55')](_0x2f2e96)[_0x39bb('0x20')](handleEntityNotFound(_0x523a3b,null))['then'](respondWithResult(_0x523a3b,null))[_0x39bb('0x2a')](handleError(_0x523a3b,null));};exports[_0x39bb('0x56')]=function(_0x129f4f,_0x20593d){return db[_0x39bb('0x3b')]['create'](_0x129f4f[_0x39bb('0x57')],{})[_0x39bb('0x20')](respondWithResult(_0x20593d,0xc9))['catch'](handleError(_0x20593d,null));};exports[_0x39bb('0x58')]=function(_0x39eed3,_0x11bc08){if(_0x39eed3['body']['id']){delete _0x39eed3[_0x39bb('0x57')]['id'];}return db[_0x39bb('0x3b')][_0x39bb('0x55')]({'where':{'id':_0x39eed3['params']['id']}})[_0x39bb('0x20')](handleEntityNotFound(_0x11bc08,null))[_0x39bb('0x20')](saveUpdates(_0x39eed3[_0x39bb('0x57')],null))[_0x39bb('0x20')](respondWithResult(_0x11bc08,null))[_0x39bb('0x2a')](handleError(_0x11bc08,null));};exports[_0x39bb('0x35')]=function(_0x21073a,_0x5c4717){return db[_0x39bb('0x3b')][_0x39bb('0x55')]({'where':{'id':_0x21073a['params']['id']}})['then'](handleEntityNotFound(_0x5c4717,null))[_0x39bb('0x20')](removeEntity(_0x5c4717,null))[_0x39bb('0x2a')](handleError(_0x5c4717,null));};exports[_0x39bb('0x59')]=function(_0x343051,_0x5a7a08){return db['SmsMessage']['describe']()[_0x39bb('0x20')](respondWithResult(_0x5a7a08,null))[_0x39bb('0x2a')](handleError(_0x5a7a08,null));};var interaction_log=require(_0x39bb('0x14'))('sms-interactions');exports[_0x39bb('0x5a')]=function(_0x114a9f,_0x4cfc55,_0x5804ed){var _0x544649={'agent':{},'channel':_0x39bb('0x5b')};if(_0x114a9f[_0x39bb('0x57')]['id']){delete _0x114a9f[_0x39bb('0x57')]['id'];}_0x114a9f['body'][_0x39bb('0x5c')]=!![];_0x114a9f[_0x39bb('0x57')][_0x39bb('0x5d')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x114a9f[_0x39bb('0x57')]['UserId']=_0x114a9f[_0x39bb('0x57')][_0x39bb('0x5e')]||_0x114a9f[_0x39bb('0x5f')]['id'];_0x544649[_0x39bb('0x60')]['id']=_0x114a9f[_0x39bb('0x57')][_0x39bb('0x5e')];return db['SmsMessage'][_0x39bb('0x55')]({'where':{'id':_0x114a9f['params']['id'],'UserId':null}})[_0x39bb('0x20')](handleEntityNotFound(_0x4cfc55,null))['then'](saveUpdates(_0x114a9f[_0x39bb('0x57')],null))['then'](function(_0x1cb41c){if(_0x1cb41c){_0x544649[_0x39bb('0x28')]=_0x1cb41c[_0x39bb('0x61')]({'plain':!![]});return db[_0x39bb('0x62')]['find']({'where':{'id':_0x1cb41c[_0x39bb('0x63')]}});}return null;})[_0x39bb('0x20')](handleEntityNotFound(_0x4cfc55,null))['then'](function(_0x31cf19){if(_0x31cf19){return _0x31cf19[_0x39bb('0x58')]({'UserId':_0x114a9f[_0x39bb('0x57')][_0x39bb('0x5e')],'read1stAt':_['isNil'](_0x31cf19[_0x39bb('0x64')])?moment()[_0x39bb('0x65')](_0x39bb('0x66')):undefined});}return null;})['then'](function(_0x43c5c2){if(_0x43c5c2){_0x544649['interaction']=_0x43c5c2[_0x39bb('0x61')]({'plain':!![]});interaction_log[_0x39bb('0x21')](_0x39bb('0x67'),_0x114a9f[_0x39bb('0x5f')]['id'],_0x114a9f[_0x39bb('0x5f')][_0x39bb('0x37')],_0x114a9f[_0x39bb('0x5f')][_0x39bb('0x68')],_0x544649[_0x39bb('0x69')]['id'],_0x114a9f[_0x39bb('0x57')]?JSON[_0x39bb('0x25')](_0x114a9f[_0x39bb('0x57')]):_0x39bb('0x6a'));return respondWithRpcPromise('AcceptMessage',_0x39bb('0x6b'),_0x544649);}return null;})[_0x39bb('0x20')](function(_0x2c4010){var _0x970841='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x2c4010[_0x39bb('0x28')]['ContactId'];return db[_0x39bb('0x6c')][_0x39bb('0x40')](_0x970841,{'type':db['Sequelize'][_0x39bb('0x6d')][_0x39bb('0x6e')],'raw':!![]})['then'](function(_0x59e857){return _0x59e857;});})[_0x39bb('0x20')](function(_0x25b366){if(_0x25b366){_0x544649['message']['contact']=_0x25b366[0x0];if(!_0x114a9f[_0x39bb('0x57')][_0x39bb('0x5e')])return;return db[_0x39bb('0x6f')]['find']({'where':{'id':_0x114a9f['body'][_0x39bb('0x5e')],'role':'agent'},'attributes':['id','name',_0x39bb('0x70'),_0x39bb('0x71'),'internal'],'raw':!![]});}return null;})[_0x39bb('0x20')](function(_0x56bfab){if(!_0x56bfab)return null;_0x544649[_0x39bb('0x28')]['agent']=_0x56bfab;return _0x544649;})[_0x39bb('0x20')](function(_0x209e31){if(_0x209e31){if(_0x114a9f[_0x39bb('0x57')][_0x39bb('0x72')]){_0x544649['message'][_0x39bb('0x73')]=util['format'](_0x39bb('0x74'),_0x114a9f['user']['name']);_0x544649['message'][_0x39bb('0x75')]=_0x544649[_0x39bb('0x75')];_0x544649[_0x39bb('0x28')]['motionChannel']=_0x544649[_0x39bb('0x75')];_0x544649['message']['event']=_0x39bb('0x5a');return respondWithRpcPromise(_0x39bb('0x76'),_0x39bb('0x76'),{'event':_0x39bb('0x77'),'message':_0x544649[_0x39bb('0x28')]},client9002)['then'](function(){return _0x544649;});}return _0x544649;}return null;})[_0x39bb('0x20')](respondWithResult(_0x4cfc55,null))['catch'](handleError(_0x4cfc55,null));};var interaction_log=require(_0x39bb('0x14'))(_0x39bb('0x78'));exports['reject']=function(_0xd41e57,_0x402206,_0x50a56d){var _0x39979a={'agent':{},'channel':_0x39bb('0x5b')};if(_0xd41e57[_0x39bb('0x57')]['id']){delete _0xd41e57['body']['id'];}_0xd41e57[_0x39bb('0x57')]['UserId']=_0xd41e57[_0x39bb('0x57')][_0x39bb('0x5e')]||_0xd41e57[_0x39bb('0x5f')]['id'];_0x39979a[_0x39bb('0x60')]['id']=_0xd41e57[_0x39bb('0x57')][_0x39bb('0x5e')];return db[_0x39bb('0x3b')]['find']({'where':{'id':_0xd41e57[_0x39bb('0x51')]['id'],'UserId':null}})[_0x39bb('0x20')](handleEntityNotFound(_0x402206,null))['then'](function(_0x5ca153){if(_0x5ca153){_0x39979a[_0x39bb('0x28')]=_0x5ca153[_0x39bb('0x61')]({'plain':!![]});return db[_0x39bb('0x62')][_0x39bb('0x55')]({'where':{'id':_0x5ca153[_0x39bb('0x63')]}});}return null;})['then'](handleEntityNotFound(_0x402206,null))['then'](function(_0x3b385f){if(_0x3b385f){_0x39979a[_0x39bb('0x69')]=_0x3b385f[_0x39bb('0x61')]({'plain':!![]});interaction_log['info']('[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0xd41e57[_0x39bb('0x5f')]['id'],_0xd41e57[_0x39bb('0x5f')][_0x39bb('0x37')],_0xd41e57['user'][_0x39bb('0x68')],_0x39979a['interaction']['id'],_0xd41e57['body']?JSON['stringify'](_0xd41e57['body']):_0x39bb('0x6a'));return respondWithRpcPromise('RejectMessage',_0x39bb('0x79'),_0x39979a);}return null;})[_0x39bb('0x20')](function(_0x62635){var _0x386e24=_0x39bb('0x7a')+_0x62635[_0x39bb('0x28')][_0x39bb('0x7b')];return db[_0x39bb('0x6c')]['query'](_0x386e24,{'type':db[_0x39bb('0x7c')][_0x39bb('0x6d')][_0x39bb('0x6e')],'raw':!![]})[_0x39bb('0x20')](function(_0x14a72f){return _0x14a72f;});})[_0x39bb('0x20')](function(_0x4c914d){if(_0x4c914d){_0x39979a[_0x39bb('0x28')][_0x39bb('0x7d')]=_0x4c914d[0x0];if(!_0xd41e57[_0x39bb('0x57')][_0x39bb('0x5e')])return;return db[_0x39bb('0x6f')][_0x39bb('0x55')]({'where':{'id':_0xd41e57[_0x39bb('0x57')][_0x39bb('0x5e')],'role':'agent'},'attributes':['id',_0x39bb('0x37'),_0x39bb('0x70'),_0x39bb('0x71'),'internal'],'raw':!![]});}return null;})['then'](function(_0x179807){if(!_0x179807)return null;_0x39979a[_0x39bb('0x28')][_0x39bb('0x60')]=_0x179807;return _0x39979a;})['then'](function(_0x4f676f){if(_0x4f676f){_0x4f676f[_0x39bb('0x28')][_0x39bb('0x73')]=util['format'](_0x39bb('0x74'),_0xd41e57[_0x39bb('0x5f')][_0x39bb('0x37')]);_0x4f676f[_0x39bb('0x28')]['channel']=_0x39979a[_0x39bb('0x75')];_0x4f676f[_0x39bb('0x28')]['motionChannel']=_0x39979a[_0x39bb('0x75')];_0x4f676f[_0x39bb('0x28')]['event']=_0x39bb('0x34');respondWithRpcPromise(_0x39bb('0x76'),_0x39bb('0x76'),{'event':_0x39bb('0x7e'),'message':_0x4f676f[_0x39bb('0x28')]},client9002);return _0x39979a;}return null;})['then'](respondWithResult(_0x402206,null))[_0x39bb('0x2a')](handleError(_0x402206,null));};exports[_0x39bb('0x2c')]=function(_0x2b886f,_0x865aed,_0x48d6f8){if(_0x2b886f['body']['id']){delete _0x2b886f[_0x39bb('0x57')]['id'];}var _0x5c5577;return db[_0x39bb('0x3b')]['find']({'where':{'id':_0x2b886f[_0x39bb('0x51')]['id']}})['then'](handleEntityNotFound(_0x865aed,null))[_0x39bb('0x20')](function(_0x1097a4){if(_0x1097a4){_0x5c5577=_0x1097a4;return db[_0x39bb('0x7f')][_0x39bb('0x55')]({'where':{'id':_0x1097a4['SmsAccountId']}});}})[_0x39bb('0x20')](handleEntityNotFound(_0x865aed,null))[_0x39bb('0x20')](function(_0x512790){if(_0x512790){logger[_0x39bb('0x80')](_0x39bb('0x24'),_0x39bb('0x2c'),_0x39bb('0x81'),_0x512790[_0x39bb('0x3d')],util[_0x39bb('0x82')](_0x2b886f[_0x39bb('0x57')],{'showHidden':![],'depth':null}));switch(_0x512790[_0x39bb('0x3d')]){case _0x39bb('0x83'):if(_0x2b886f['body'][_0x39bb('0x84')]&&_0x2b886f[_0x39bb('0x57')][_0x39bb('0x84')]===_0x5c5577[_0x39bb('0x85')]){return _0x5c5577[_0x39bb('0x58')]({'read':!![]});}else{logger[_0x39bb('0x26')](_0x39bb('0x86'),_0x39bb('0x2c'),'twilio',util[_0x39bb('0x82')](_0x2b886f[_0x39bb('0x57')],{'showHidden':![],'depth':null}));}break;case _0x39bb('0x87'):if(_0x2b886f['body'][_0x39bb('0x88')]&&_0x2b886f[_0x39bb('0x57')]['MessageUUID']===_0x5c5577[_0x39bb('0x85')]&&_['indexOf']([_0x39bb('0x89'),_0x39bb('0x8a')],_0x2b886f['body'][_0x39bb('0x8b')])>=0x0){return _0x5c5577[_0x39bb('0x58')]({'read':!![]});}else{logger[_0x39bb('0x26')](_0x39bb('0x86'),'status',_0x39bb('0x8c'),util['inspect'](_0x2b886f[_0x39bb('0x57')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x139488=_0x2b886f[_0x39bb('0x57')][_0x39bb('0x8d')][0x0];if(_0x139488['status'][_0x39bb('0x8e')]==='DELIVERED'){return _0x5c5577[_0x39bb('0x58')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x39bb('0x2c'),_0x39bb('0x8f'),util['inspect'](_0x2b886f[_0x39bb('0x57')],{'showHidden':![],'depth':null}));}break;}return _0x5c5577;}})[_0x39bb('0x20')](respondWithResult(_0x865aed,null))[_0x39bb('0x2a')](handleError(_0x865aed,null));}; \ No newline at end of file +var _0x6829=['QueryTypes','SELECT','contact','User','fullname','email','internal','manual','interface','format','channel','motionChannel','event','EventManager','SmsInteractionId','null','RejectMessage','rejectMessage','SIP/%s','rejectmessage','SmsAccount','SmsAccountId','received\x20delivery\x20report\x20from','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','inspect','plivo','MessageUUID','indexOf','sent','delivered','plivio','infobip','results','groupName','DELIVERED','eml-format','rimraf','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','redis','socket.io-emitter','./smsMessage.socket','register','jayson/promise','client','http','then','info','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','SmsMessage,\x20%s,\x20%s','catch','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','reject','save','update','stack','name','index','map','SmsMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','intersection','find','create','body','destroy','describe','sms-interactions','accept','sms','read','YYYY-MM-DD\x20HH:mm:ss','user','agent','UserId','get','SmsInteraction','isNil','read1stAt','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize'];(function(_0x52f1e6,_0xf70489){var _0x21f104=function(_0xb89f9e){while(--_0xb89f9e){_0x52f1e6['push'](_0x52f1e6['shift']());}};_0x21f104(++_0xf70489);}(_0x6829,0x14c));var _0x9682=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x6829[_0x17d9e3];return _0x14192d;};'use strict';var emlformat=require(_0x9682('0x0'));var rimraf=require(_0x9682('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x9682('0x2'));var BPromise=require(_0x9682('0x3'));var Mustache=require(_0x9682('0x4'));var util=require(_0x9682('0x5'));var path=require(_0x9682('0x6'));var sox=require(_0x9682('0x7'));var csv=require(_0x9682('0x8'));var ejs=require(_0x9682('0x9'));var fs=require('fs');var fs_extra=require(_0x9682('0xa'));var _=require(_0x9682('0xb'));var squel=require(_0x9682('0xc'));var crypto=require(_0x9682('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x9682('0xe'));var Papa=require(_0x9682('0xf'));var Redis=require('ioredis');var authService=require(_0x9682('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x9682('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9682('0x12'))(_0x9682('0x13'));var utils=require(_0x9682('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x9682('0x15'))['db'];config[_0x9682('0x16')]=_['defaults'](config[_0x9682('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0x9682('0x17'))(new Redis(config[_0x9682('0x16')]));require(_0x9682('0x18'))[_0x9682('0x19')](socket);var jayson=require(_0x9682('0x1a'));var client=jayson[_0x9682('0x1b')][_0x9682('0x1c')]({'port':0x232c});var client9002=jayson[_0x9682('0x1b')][_0x9682('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x13a1a9,_0x526391,_0x3935c2,_0x567127){return new BPromise(function(_0x23eef6,_0x426468){var _0x1f4971=_0x567127||client;return _0x1f4971['request'](_0x13a1a9,_0x3935c2)[_0x9682('0x1d')](function(_0x4e0dfb){logger[_0x9682('0x1e')]('SmsMessage,\x20%s,\x20%s',_0x526391,_0x9682('0x1f'));logger[_0x9682('0x20')](_0x9682('0x21'),_0x526391,_0x9682('0x1f'),JSON[_0x9682('0x22')](_0x4e0dfb));if(_0x4e0dfb['error']){if(_0x4e0dfb['error']['code']===0x1f4){logger[_0x9682('0x23')]('SmsMessage,\x20%s,\x20%s',_0x526391,_0x4e0dfb[_0x9682('0x23')][_0x9682('0x24')]);return _0x426468(_0x4e0dfb['error'][_0x9682('0x24')]);}logger[_0x9682('0x23')](_0x9682('0x25'),_0x526391,_0x4e0dfb[_0x9682('0x23')][_0x9682('0x24')]);return _0x23eef6(_0x4e0dfb[_0x9682('0x23')][_0x9682('0x24')]);}else{logger[_0x9682('0x1e')](_0x9682('0x25'),_0x526391,_0x9682('0x1f'));_0x23eef6(_0x4e0dfb['result'][_0x9682('0x24')]);}})[_0x9682('0x26')](function(_0x88419f){logger[_0x9682('0x23')](_0x9682('0x25'),_0x526391,_0x88419f);_0x426468(_0x88419f);});});}function respondWithStatusCode(_0x5319f2,_0x756fea){_0x756fea=_0x756fea||0xcc;return function(_0x1dbf57){if(_0x1dbf57){return _0x5319f2[_0x9682('0x27')](_0x756fea);}return _0x5319f2[_0x9682('0x28')](_0x756fea)[_0x9682('0x29')]();};}function respondWithResult(_0x46bb89,_0x48e821){_0x48e821=_0x48e821||0xc8;return function(_0x2a62ba){if(_0x2a62ba){return _0x46bb89[_0x9682('0x28')](_0x48e821)[_0x9682('0x2a')](_0x2a62ba);}};}function respondWithFilteredResult(_0x1d827e,_0x9e3d59){return function(_0x1fdb4d){if(_0x1fdb4d){var _0x176624=typeof _0x9e3d59[_0x9682('0x2b')]==='undefined'&&typeof _0x9e3d59[_0x9682('0x2c')]==='undefined';var _0x2a765c=_0x1fdb4d[_0x9682('0x2d')];var _0x598248=_0x176624?0x0:_0x9e3d59['offset'];var _0x4b4c5d=_0x176624?_0x1fdb4d['count']:_0x9e3d59[_0x9682('0x2b')]+_0x9e3d59['limit'];var _0x1b4b1e;if(_0x4b4c5d>=_0x2a765c){_0x4b4c5d=_0x2a765c;_0x1b4b1e=0xc8;}else{_0x1b4b1e=0xce;}_0x1d827e[_0x9682('0x28')](_0x1b4b1e);return _0x1d827e[_0x9682('0x2e')](_0x9682('0x2f'),_0x598248+'-'+_0x4b4c5d+'/'+_0x2a765c)['json'](_0x1fdb4d);}return null;};}function patchUpdates(_0x593289){return function(_0x45272a){try{jsonpatch[_0x9682('0x30')](_0x45272a,_0x593289,!![]);}catch(_0x2abbe5){return BPromise[_0x9682('0x31')](_0x2abbe5);}return _0x45272a[_0x9682('0x32')]();};}function saveUpdates(_0x52a953,_0x48ea6a){return function(_0x36b673){if(_0x36b673){return _0x36b673[_0x9682('0x33')](_0x52a953)[_0x9682('0x1d')](function(_0x2a081e){return _0x2a081e;});}return null;};}function removeEntity(_0x3cafac,_0x250aa4){return function(_0x268a8b){if(_0x268a8b){return _0x268a8b['destroy']()[_0x9682('0x1d')](function(){_0x3cafac[_0x9682('0x28')](0xcc)[_0x9682('0x29')]();});}};}function handleEntityNotFound(_0x141bcb,_0x33d4f8){return function(_0x550fb0){if(!_0x550fb0){_0x141bcb[_0x9682('0x27')](0x194);}return _0x550fb0;};}function handleError(_0x4f414e,_0x2b0961){_0x2b0961=_0x2b0961||0x1f4;return function(_0x12b838){logger[_0x9682('0x23')](_0x12b838[_0x9682('0x34')]);if(_0x12b838[_0x9682('0x35')]){delete _0x12b838[_0x9682('0x35')];}_0x4f414e[_0x9682('0x28')](_0x2b0961)['send'](_0x12b838);};}exports[_0x9682('0x36')]=function(_0x555634,_0xe194aa){var _0x4b5a61={},_0x309715={},_0x1c5408={'count':0x0,'rows':[]};var _0x2f83d2=_[_0x9682('0x37')](db[_0x9682('0x38')][_0x9682('0x39')],function(_0x123367){return{'name':_0x123367[_0x9682('0x3a')],'type':_0x123367[_0x9682('0x3b')][_0x9682('0x3c')]};});_0x309715[_0x9682('0x3d')]=_['map'](_0x2f83d2,_0x9682('0x35'));_0x309715[_0x9682('0x3e')]=_[_0x9682('0x3f')](_0x555634[_0x9682('0x3e')]);_0x309715[_0x9682('0x40')]=_['intersection'](_0x309715[_0x9682('0x3d')],_0x309715[_0x9682('0x3e')]);_0x4b5a61[_0x9682('0x41')]=_['intersection'](_0x309715[_0x9682('0x3d')],qs[_0x9682('0x42')](_0x555634[_0x9682('0x3e')][_0x9682('0x42')]));_0x4b5a61[_0x9682('0x41')]=_0x4b5a61[_0x9682('0x41')][_0x9682('0x43')]?_0x4b5a61[_0x9682('0x41')]:_0x309715[_0x9682('0x3d')];if(!_0x555634[_0x9682('0x3e')][_0x9682('0x44')](_0x9682('0x45'))){_0x4b5a61[_0x9682('0x2c')]=qs[_0x9682('0x2c')](_0x555634[_0x9682('0x3e')][_0x9682('0x2c')]);_0x4b5a61['offset']=qs[_0x9682('0x2b')](_0x555634['query'][_0x9682('0x2b')]);}_0x4b5a61[_0x9682('0x46')]=qs[_0x9682('0x47')](_0x555634['query']['sort']);_0x4b5a61[_0x9682('0x48')]=qs[_0x9682('0x40')](_[_0x9682('0x49')](_0x555634[_0x9682('0x3e')],_0x309715[_0x9682('0x40')]),_0x2f83d2);if(_0x555634[_0x9682('0x3e')][_0x9682('0x4a')]){_0x4b5a61['where']=_[_0x9682('0x4b')](_0x4b5a61['where'],{'$or':_[_0x9682('0x37')](_0x2f83d2,function(_0x3e514a){if(_0x3e514a[_0x9682('0x3b')]!==_0x9682('0x4c')){var _0x2dc51c={};_0x2dc51c[_0x3e514a[_0x9682('0x35')]]={'$like':'%'+_0x555634[_0x9682('0x3e')][_0x9682('0x4a')]+'%'};return _0x2dc51c;}})});}_0x4b5a61=_['merge']({},_0x4b5a61,_0x555634[_0x9682('0x4d')]);var _0x11e79b={'where':_0x4b5a61[_0x9682('0x48')]};return db[_0x9682('0x38')][_0x9682('0x2d')](_0x11e79b)[_0x9682('0x1d')](function(_0x536945){_0x1c5408[_0x9682('0x2d')]=_0x536945;if(_0x555634[_0x9682('0x3e')][_0x9682('0x4e')]){_0x4b5a61[_0x9682('0x4f')]=[{'all':!![]}];}return db[_0x9682('0x38')][_0x9682('0x50')](_0x4b5a61);})[_0x9682('0x1d')](function(_0x14b4df){_0x1c5408[_0x9682('0x51')]=_0x14b4df;return _0x1c5408;})[_0x9682('0x1d')](respondWithFilteredResult(_0xe194aa,_0x4b5a61))['catch'](handleError(_0xe194aa,null));};exports['show']=function(_0x47b5e5,_0x49d948){var _0x520538={'raw':!![],'where':{'id':_0x47b5e5[_0x9682('0x52')]['id']}},_0x2a1d97={};_0x2a1d97[_0x9682('0x3d')]=_['keys'](db[_0x9682('0x38')][_0x9682('0x39')]);_0x2a1d97[_0x9682('0x3e')]=_['keys'](_0x47b5e5[_0x9682('0x3e')]);_0x2a1d97[_0x9682('0x40')]=_[_0x9682('0x53')](_0x2a1d97[_0x9682('0x3d')],_0x2a1d97[_0x9682('0x3e')]);_0x520538[_0x9682('0x41')]=_[_0x9682('0x53')](_0x2a1d97['model'],qs[_0x9682('0x42')](_0x47b5e5[_0x9682('0x3e')][_0x9682('0x42')]));_0x520538[_0x9682('0x41')]=_0x520538[_0x9682('0x41')][_0x9682('0x43')]?_0x520538[_0x9682('0x41')]:_0x2a1d97['model'];if(_0x47b5e5['query'][_0x9682('0x4e')]){_0x520538[_0x9682('0x4f')]=[{'all':!![]}];}_0x520538=_['merge']({},_0x520538,_0x47b5e5[_0x9682('0x4d')]);return db[_0x9682('0x38')][_0x9682('0x54')](_0x520538)[_0x9682('0x1d')](handleEntityNotFound(_0x49d948,null))[_0x9682('0x1d')](respondWithResult(_0x49d948,null))['catch'](handleError(_0x49d948,null));};exports[_0x9682('0x55')]=function(_0x1fb8f3,_0x305304){return db[_0x9682('0x38')][_0x9682('0x55')](_0x1fb8f3[_0x9682('0x56')],{})['then'](respondWithResult(_0x305304,0xc9))[_0x9682('0x26')](handleError(_0x305304,null));};exports[_0x9682('0x33')]=function(_0xd26e70,_0x23c2a1){if(_0xd26e70[_0x9682('0x56')]['id']){delete _0xd26e70[_0x9682('0x56')]['id'];}return db[_0x9682('0x38')][_0x9682('0x54')]({'where':{'id':_0xd26e70[_0x9682('0x52')]['id']}})[_0x9682('0x1d')](handleEntityNotFound(_0x23c2a1,null))[_0x9682('0x1d')](saveUpdates(_0xd26e70[_0x9682('0x56')],null))['then'](respondWithResult(_0x23c2a1,null))[_0x9682('0x26')](handleError(_0x23c2a1,null));};exports[_0x9682('0x57')]=function(_0x29b69b,_0x44ecc4){return db[_0x9682('0x38')]['find']({'where':{'id':_0x29b69b['params']['id']}})[_0x9682('0x1d')](handleEntityNotFound(_0x44ecc4,null))[_0x9682('0x1d')](removeEntity(_0x44ecc4,null))[_0x9682('0x26')](handleError(_0x44ecc4,null));};exports[_0x9682('0x58')]=function(_0x320057,_0x528fa2){return db[_0x9682('0x38')]['describe']()[_0x9682('0x1d')](respondWithResult(_0x528fa2,null))[_0x9682('0x26')](handleError(_0x528fa2,null));};var interaction_log=require('../../config/logger')(_0x9682('0x59'));exports[_0x9682('0x5a')]=function(_0x3d1fea,_0x1aed62,_0x4ac365){var _0x648744={'agent':{},'channel':_0x9682('0x5b')};if(_0x3d1fea[_0x9682('0x56')]['id']){delete _0x3d1fea[_0x9682('0x56')]['id'];}_0x3d1fea[_0x9682('0x56')][_0x9682('0x5c')]=!![];_0x3d1fea['body']['readAt']=moment()['format'](_0x9682('0x5d'));_0x3d1fea[_0x9682('0x56')]['UserId']=_0x3d1fea[_0x9682('0x56')]['UserId']||_0x3d1fea[_0x9682('0x5e')]['id'];_0x648744[_0x9682('0x5f')]['id']=_0x3d1fea[_0x9682('0x56')][_0x9682('0x60')];return db[_0x9682('0x38')][_0x9682('0x54')]({'where':{'id':_0x3d1fea[_0x9682('0x52')]['id'],'UserId':null}})[_0x9682('0x1d')](handleEntityNotFound(_0x1aed62,null))[_0x9682('0x1d')](saveUpdates(_0x3d1fea['body'],null))[_0x9682('0x1d')](function(_0x21dad4){if(_0x21dad4){_0x648744[_0x9682('0x24')]=_0x21dad4[_0x9682('0x61')]({'plain':!![]});return db[_0x9682('0x62')][_0x9682('0x54')]({'where':{'id':_0x21dad4['SmsInteractionId']}});}return null;})[_0x9682('0x1d')](handleEntityNotFound(_0x1aed62,null))[_0x9682('0x1d')](function(_0x33d3da){if(_0x33d3da){return _0x33d3da[_0x9682('0x33')]({'UserId':_0x3d1fea[_0x9682('0x56')][_0x9682('0x60')],'read1stAt':_[_0x9682('0x63')](_0x33d3da[_0x9682('0x64')])?moment()['format'](_0x9682('0x5d')):undefined});}return null;})['then'](function(_0x60066c){if(_0x60066c){_0x648744['interaction']=_0x60066c[_0x9682('0x61')]({'plain':!![]});interaction_log[_0x9682('0x1e')](_0x9682('0x65'),_0x3d1fea[_0x9682('0x5e')]['id'],_0x3d1fea[_0x9682('0x5e')][_0x9682('0x35')],_0x3d1fea['user'][_0x9682('0x66')],_0x648744[_0x9682('0x67')]['id'],_0x3d1fea[_0x9682('0x56')]?JSON[_0x9682('0x22')](_0x3d1fea[_0x9682('0x56')]):'null');return respondWithRpcPromise(_0x9682('0x68'),'acceptMessage',_0x648744);}return null;})['then'](function(_0x5f4e84){var _0x5a5359=_0x9682('0x69')+_0x5f4e84[_0x9682('0x24')][_0x9682('0x6a')];return db[_0x9682('0x6b')][_0x9682('0x3e')](_0x5a5359,{'type':db[_0x9682('0x6c')][_0x9682('0x6d')][_0x9682('0x6e')],'raw':!![]})[_0x9682('0x1d')](function(_0x1fb0fc){return _0x1fb0fc;});})['then'](function(_0x581553){if(_0x581553){_0x648744[_0x9682('0x24')][_0x9682('0x6f')]=_0x581553[0x0];if(!_0x3d1fea['body']['UserId'])return;return db[_0x9682('0x70')][_0x9682('0x54')]({'where':{'id':_0x3d1fea[_0x9682('0x56')][_0x9682('0x60')],'role':_0x9682('0x5f')},'attributes':['id',_0x9682('0x35'),_0x9682('0x71'),_0x9682('0x72'),_0x9682('0x73')],'raw':!![]});}return null;})[_0x9682('0x1d')](function(_0x210b22){if(!_0x210b22)return null;_0x648744[_0x9682('0x24')][_0x9682('0x5f')]=_0x210b22;return _0x648744;})[_0x9682('0x1d')](function(_0x322726){if(_0x322726){if(_0x3d1fea[_0x9682('0x56')][_0x9682('0x74')]){_0x648744[_0x9682('0x24')][_0x9682('0x75')]=util[_0x9682('0x76')]('SIP/%s',_0x3d1fea[_0x9682('0x5e')][_0x9682('0x35')]);_0x648744['message'][_0x9682('0x77')]=_0x648744[_0x9682('0x77')];_0x648744[_0x9682('0x24')][_0x9682('0x78')]=_0x648744[_0x9682('0x77')];_0x648744[_0x9682('0x24')][_0x9682('0x79')]='accept';return respondWithRpcPromise(_0x9682('0x7a'),_0x9682('0x7a'),{'event':'acceptmessage','message':_0x648744[_0x9682('0x24')]},client9002)[_0x9682('0x1d')](function(){return _0x648744;});}return _0x648744;}return null;})[_0x9682('0x1d')](respondWithResult(_0x1aed62,null))[_0x9682('0x26')](handleError(_0x1aed62,null));};var interaction_log=require(_0x9682('0x12'))('sms-interactions');exports[_0x9682('0x31')]=function(_0x3e5d4d,_0x56f4e7,_0x45bd63){var _0x23063e={'agent':{},'channel':_0x9682('0x5b')};if(_0x3e5d4d[_0x9682('0x56')]['id']){delete _0x3e5d4d[_0x9682('0x56')]['id'];}_0x3e5d4d[_0x9682('0x56')]['UserId']=_0x3e5d4d[_0x9682('0x56')][_0x9682('0x60')]||_0x3e5d4d[_0x9682('0x5e')]['id'];_0x23063e[_0x9682('0x5f')]['id']=_0x3e5d4d['body'][_0x9682('0x60')];return db[_0x9682('0x38')]['find']({'where':{'id':_0x3e5d4d[_0x9682('0x52')]['id'],'UserId':null}})[_0x9682('0x1d')](handleEntityNotFound(_0x56f4e7,null))['then'](function(_0x1792f0){if(_0x1792f0){_0x23063e['message']=_0x1792f0['get']({'plain':!![]});return db[_0x9682('0x62')][_0x9682('0x54')]({'where':{'id':_0x1792f0[_0x9682('0x7b')]}});}return null;})[_0x9682('0x1d')](handleEntityNotFound(_0x56f4e7,null))['then'](function(_0xf6c9c8){if(_0xf6c9c8){_0x23063e['interaction']=_0xf6c9c8['get']({'plain':!![]});interaction_log[_0x9682('0x1e')]('[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x3e5d4d[_0x9682('0x5e')]['id'],_0x3e5d4d[_0x9682('0x5e')]['name'],_0x3e5d4d[_0x9682('0x5e')][_0x9682('0x66')],_0x23063e[_0x9682('0x67')]['id'],_0x3e5d4d[_0x9682('0x56')]?JSON[_0x9682('0x22')](_0x3e5d4d[_0x9682('0x56')]):_0x9682('0x7c'));return respondWithRpcPromise(_0x9682('0x7d'),_0x9682('0x7e'),_0x23063e);}return null;})['then'](function(_0x4eca01){var _0x4075fe=_0x9682('0x69')+_0x4eca01['message'][_0x9682('0x6a')];return db[_0x9682('0x6b')]['query'](_0x4075fe,{'type':db[_0x9682('0x6c')][_0x9682('0x6d')][_0x9682('0x6e')],'raw':!![]})['then'](function(_0x10c16a){return _0x10c16a;});})[_0x9682('0x1d')](function(_0x13f967){if(_0x13f967){_0x23063e[_0x9682('0x24')][_0x9682('0x6f')]=_0x13f967[0x0];if(!_0x3e5d4d['body'][_0x9682('0x60')])return;return db[_0x9682('0x70')][_0x9682('0x54')]({'where':{'id':_0x3e5d4d[_0x9682('0x56')][_0x9682('0x60')],'role':_0x9682('0x5f')},'attributes':['id','name',_0x9682('0x71'),_0x9682('0x72'),'internal'],'raw':!![]});}return null;})[_0x9682('0x1d')](function(_0x1c4ac5){if(!_0x1c4ac5)return null;_0x23063e[_0x9682('0x24')][_0x9682('0x5f')]=_0x1c4ac5;return _0x23063e;})[_0x9682('0x1d')](function(_0x206933){if(_0x206933){_0x206933[_0x9682('0x24')][_0x9682('0x75')]=util[_0x9682('0x76')](_0x9682('0x7f'),_0x3e5d4d[_0x9682('0x5e')][_0x9682('0x35')]);_0x206933[_0x9682('0x24')]['channel']=_0x23063e[_0x9682('0x77')];_0x206933[_0x9682('0x24')][_0x9682('0x78')]=_0x23063e[_0x9682('0x77')];_0x206933[_0x9682('0x24')][_0x9682('0x79')]=_0x9682('0x31');respondWithRpcPromise('EventManager',_0x9682('0x7a'),{'event':_0x9682('0x80'),'message':_0x206933['message']},client9002);return _0x23063e;}return null;})[_0x9682('0x1d')](respondWithResult(_0x56f4e7,null))[_0x9682('0x26')](handleError(_0x56f4e7,null));};exports['status']=function(_0x5243de,_0x4ffcf6,_0x14544b){if(_0x5243de['body']['id']){delete _0x5243de[_0x9682('0x56')]['id'];}var _0x4bc8b9;return db['SmsMessage'][_0x9682('0x54')]({'where':{'id':_0x5243de[_0x9682('0x52')]['id']}})[_0x9682('0x1d')](handleEntityNotFound(_0x4ffcf6,null))['then'](function(_0x56e684){if(_0x56e684){_0x4bc8b9=_0x56e684;return db[_0x9682('0x81')][_0x9682('0x54')]({'where':{'id':_0x56e684[_0x9682('0x82')]}});}})[_0x9682('0x1d')](handleEntityNotFound(_0x4ffcf6,null))[_0x9682('0x1d')](function(_0x24a3d6){if(_0x24a3d6){logger[_0x9682('0x20')](_0x9682('0x21'),'status',_0x9682('0x83'),_0x24a3d6['type'],util['inspect'](_0x5243de[_0x9682('0x56')],{'showHidden':![],'depth':null}));switch(_0x24a3d6['type']){case _0x9682('0x84'):if(_0x5243de[_0x9682('0x56')][_0x9682('0x85')]&&_0x5243de['body'][_0x9682('0x85')]===_0x4bc8b9[_0x9682('0x86')]){return _0x4bc8b9[_0x9682('0x33')]({'read':!![]});}else{logger['error'](_0x9682('0x87'),_0x9682('0x28'),_0x9682('0x84'),util[_0x9682('0x88')](_0x5243de[_0x9682('0x56')],{'showHidden':![],'depth':null}));}break;case _0x9682('0x89'):if(_0x5243de[_0x9682('0x56')][_0x9682('0x8a')]&&_0x5243de['body'][_0x9682('0x8a')]===_0x4bc8b9[_0x9682('0x86')]&&_[_0x9682('0x8b')]([_0x9682('0x8c'),_0x9682('0x8d')],_0x5243de[_0x9682('0x56')]['Status'])>=0x0){return _0x4bc8b9[_0x9682('0x33')]({'read':!![]});}else{logger[_0x9682('0x23')](_0x9682('0x87'),'status',_0x9682('0x8e'),util[_0x9682('0x88')](_0x5243de[_0x9682('0x56')],{'showHidden':![],'depth':null}));}break;case _0x9682('0x8f'):var _0x3f1d7a=_0x5243de[_0x9682('0x56')][_0x9682('0x90')][0x0];if(_0x3f1d7a[_0x9682('0x28')][_0x9682('0x91')]===_0x9682('0x92')){return _0x4bc8b9[_0x9682('0x33')]({'read':!![]});}else{logger[_0x9682('0x23')](_0x9682('0x87'),_0x9682('0x28'),_0x9682('0x8f'),util[_0x9682('0x88')](_0x5243de[_0x9682('0x56')],{'showHidden':![],'depth':null}));}break;}return _0x4bc8b9;}})[_0x9682('0x1d')](respondWithResult(_0x4ffcf6,null))[_0x9682('0x26')](handleError(_0x4ffcf6,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index 7b3bac9..1d7f6ea 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 _0xb046=['update','remove','emit','hasOwnProperty','exports','SmsMessage','save'];(function(_0xabf5b4,_0x58753c){var _0x391f64=function(_0x1a909d){while(--_0x1a909d){_0xabf5b4['push'](_0xabf5b4['shift']());}};_0x391f64(++_0x58753c);}(_0xb046,0x101));var _0x6b04=function(_0x57643b,_0x1706fe){_0x57643b=_0x57643b-0x0;var _0x53a35b=_0xb046[_0x57643b];return _0x53a35b;};'use strict';var EventEmitter=require('events');var SmsMessage=require('../../mysqldb')['db'][_0x6b04('0x0')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x6b04('0x1'),'afterUpdate':_0x6b04('0x2'),'afterDestroy':_0x6b04('0x3')};function emitEvent(_0x217126){return function(_0x508520,_0x1ee4bd,_0x1d1bbe){SmsMessageEvents[_0x6b04('0x4')](_0x217126+':'+_0x508520['id'],_0x508520);SmsMessageEvents[_0x6b04('0x4')](_0x217126,_0x508520);_0x1d1bbe(null);};}for(var e in events){if(events[_0x6b04('0x5')](e)){var event=events[e];SmsMessage['hook'](e,emitEvent(event));}}module[_0x6b04('0x6')]=SmsMessageEvents; \ No newline at end of file +var _0x381d=['update','emit','hasOwnProperty','hook','exports','events','../../mysqldb','SmsMessage','save'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x381d,0x1c7));var _0xd381=function(_0x1df7b8,_0x2fe5e5){_0x1df7b8=_0x1df7b8-0x0;var _0x29d911=_0x381d[_0x1df7b8];return _0x29d911;};'use strict';var EventEmitter=require(_0xd381('0x0'));var SmsMessage=require(_0xd381('0x1'))['db'][_0xd381('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xd381('0x3'),'afterUpdate':_0xd381('0x4'),'afterDestroy':'remove'};function emitEvent(_0x4f139d){return function(_0x3cd874,_0x46db6b,_0x578c6e){SmsMessageEvents[_0xd381('0x5')](_0x4f139d+':'+_0x3cd874['id'],_0x3cd874);SmsMessageEvents[_0xd381('0x5')](_0x4f139d,_0x3cd874);_0x578c6e(null);};}for(var e in events){if(events[_0xd381('0x6')](e)){var event=events[e];SmsMessage[_0xd381('0x7')](e,emitEvent(event));}}module[_0xd381('0x8')]=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index c1c5355..0b2c5fa 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 _0xbd08=['twilio','authToken','phone','create','body','remote','token','then','sid','update','catch','afterCreate','SmsMessage,\x20%s,\x20%s,\x20%s','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','sender','login?username=','&password=','GET','sms','POST','session_key','total_sent','internal_order_id','read','skebby','inspect','Missing\x20parameters:\x20username,\x20password','connectel','senderString','https://smsapi.connectel.se/api/v2/send/','requestid','deliveryReport','clicksend','xCALLY\x20Motion','%s:%s','format','Basic\x20%s','toString','base64','http_code','data','queued_count','head','messages','message_id','clickSend','plivo','/api/sms/messages/','/status?token=','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','csc','crypto','apiKey','login','text','timestamp','keys','createHash','md5','digest','hex','signature=','/external/get/send.php?','id_sms','Missing\x20parameters:\x20apiKey','clickatell','uuid','UTF-8','bandwidth','https://messaging.bandwidth.com/api/v2/users/','accountId','/messages','applicationId','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','code','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','message','intelepeer','finally','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','SmsMessage','sms_messages','messageId','fti_sms_messages','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','SmsInteractionId','SmsInteraction','findOne','createdAt','error','SmsAccount','find','type'];(function(_0x5c6244,_0x112ab8){var _0x5800ce=function(_0x304e3d){while(--_0x304e3d){_0x5c6244['push'](_0x5c6244['shift']());}};_0x5800ce(++_0x112ab8);}(_0xbd08,0x1df));var _0x8bd0=function(_0x12fc8d,_0x19ee33){_0x12fc8d=_0x12fc8d-0x0;var _0x3f9d04=_0xbd08[_0x12fc8d];return _0x3f9d04;};'use strict';var _=require(_0x8bd0('0x0'));var util=require(_0x8bd0('0x1'));var logger=require(_0x8bd0('0x2'))(_0x8bd0('0x3'));var moment=require(_0x8bd0('0x4'));var BPromise=require(_0x8bd0('0x5'));var rp=require(_0x8bd0('0x6'));var fs=require('fs');var path=require(_0x8bd0('0x7'));var rimraf=require(_0x8bd0('0x8'));var config=require(_0x8bd0('0x9'));var attributes=require('./smsMessage.attributes');module[_0x8bd0('0xa')]=function(_0x516dc2,_0x48b16a){return _0x516dc2[_0x8bd0('0xb')](_0x8bd0('0xc'),attributes,{'tableName':_0x8bd0('0xd'),'paranoid':![],'indexes':[{'name':_0x8bd0('0xe'),'fields':[_0x8bd0('0xe')]},{'name':_0x8bd0('0xf'),'fields':['body'],'type':_0x8bd0('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4d1a34,_0x25bb87,_0x4c2e8e){var _0x5655ac=_0x516dc2[_0x8bd0('0x11')];var _0x5c89f7=_0x4d1a34[_0x8bd0('0x12')]({'plain':!![]});if(_0x5c89f7[_0x8bd0('0x13')][_0x8bd0('0x14')]()==='in'||_0x5c89f7[_0x8bd0('0x13')][_0x8bd0('0x14')]()===_0x8bd0('0x15')&&!_0x5c89f7[_0x8bd0('0x16')]&&!_[_0x8bd0('0x17')](_0x5c89f7[_0x8bd0('0x18')])&&!_['isNil'](_0x5c89f7[_0x8bd0('0x19')])){_0x5655ac[_0x8bd0('0x1a')][_0x8bd0('0x1b')]({'where':{'id':_0x5c89f7[_0x8bd0('0x19')]}})['then'](function(_0x499ad3){if(_0x499ad3){_0x499ad3['update']({'lastMsgAt':_0x5c89f7[_0x8bd0('0x1c')],'lastMsgDirection':_0x5c89f7['direction'][_0x8bd0('0x14')]()});}})['catch'](function(_0x397c90){console[_0x8bd0('0x1d')](_0x397c90);});}if(_0x5c89f7['direction']===_0x8bd0('0x15')&&!_0x5c89f7[_0x8bd0('0x16')]){var _0x409c31;_0x5655ac[_0x8bd0('0x1e')][_0x8bd0('0x1f')]({'where':{'id':_0x5c89f7['SmsAccountId']},'raw':!![]})['then'](function(_0x553cac){_0x409c31=_0x553cac;if(_0x409c31&&_0x409c31[_0x8bd0('0x20')]){switch(_0x409c31[_0x8bd0('0x20')]){case _0x8bd0('0x21'):var _0x5c465c=require('twilio');if(_0x409c31['accountSid']&&_0x409c31[_0x8bd0('0x22')]&&_0x409c31[_0x8bd0('0x23')]){var _0x310de2=new _0x5c465c(_0x409c31['accountSid'],_0x409c31[_0x8bd0('0x22')]);_0x310de2['messages'][_0x8bd0('0x24')]({'body':_0x5c89f7[_0x8bd0('0x25')],'to':_0x5c89f7[_0x8bd0('0x23')],'from':_0x409c31[_0x8bd0('0x23')],'statusCallback':_0x409c31[_0x8bd0('0x26')]+'/api/sms/messages/'+_0x5c89f7['id']+'/status?token='+_0x409c31[_0x8bd0('0x27')]})[_0x8bd0('0x28')](function(_0x324dce){if(_0x324dce[_0x8bd0('0x29')]){return _0x4d1a34[_0x8bd0('0x2a')]({'messageId':_0x324dce[_0x8bd0('0x29')]});}})[_0x8bd0('0x2b')](function(_0x512948){logger[_0x8bd0('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x8bd0('0x2c'),_0x8bd0('0x21'),util['inspect'](_0x512948,{'showHidden':![],'depth':null}));});}else{logger[_0x8bd0('0x1d')](_0x8bd0('0x2d'),_0x8bd0('0x2c'),_0x8bd0('0x21'),_0x8bd0('0x2e'));}break;case'skebby':var _0x1d2f57=_0x8bd0('0x2f');if(_0x409c31[_0x8bd0('0x30')]&&_0x409c31[_0x8bd0('0x31')]){var _0x398391={'recipient':[_0x5c89f7['phone']],'message':_0x5c89f7['body'],'message_type':_0x409c31[_0x8bd0('0x32')]};if(_0x409c31[_0x8bd0('0x32')]&&_0x409c31[_0x8bd0('0x32')]!=='SI'){_0x398391[_0x8bd0('0x33')]=_0x409c31[_0x8bd0('0x23')];}var _0x44bae7={'url':_0x1d2f57+_0x8bd0('0x34')+_0x409c31[_0x8bd0('0x30')]+_0x8bd0('0x35')+_0x409c31['password'],'method':_0x8bd0('0x36')};rp(_0x44bae7)['then'](function(_0x1c566f){var _0x5b9dc6=_0x1c566f['split'](';');var _0x904a41={'user_key':_0x5b9dc6[0x0],'session_key':_0x5b9dc6[0x1]};_0x44bae7={'url':_0x1d2f57+_0x8bd0('0x37'),'method':_0x8bd0('0x38'),'headers':{'user_key':_0x904a41['user_key'],'Session_key':_0x904a41[_0x8bd0('0x39')]},'json':!![],'body':_0x398391};return rp(_0x44bae7);})[_0x8bd0('0x28')](function(_0x1a5914){if(_0x1a5914[_0x8bd0('0x3a')]>=0x1){var _0x5bab7d={'messageId':_0x1a5914[_0x8bd0('0x3b')]};if(_0x409c31[_0x8bd0('0x32')]!=='GP'||!_0x409c31['deliveryReport']){_0x5bab7d[_0x8bd0('0x3c')]=!![];}return _0x4d1a34[_0x8bd0('0x2a')](_0x5bab7d);}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x8bd0('0x2c'),_0x8bd0('0x3d'),util[_0x8bd0('0x3e')](_0x1a5914,{'showHidden':![],'depth':null}));}})[_0x8bd0('0x2b')](function(_0x1ce879){return logger[_0x8bd0('0x1d')](_0x8bd0('0x2d'),_0x8bd0('0x2c'),_0x8bd0('0x3d'),util['inspect'](_0x1ce879,{'showHidden':![],'depth':null}));});}else{logger[_0x8bd0('0x1d')](_0x8bd0('0x2d'),'afterCreate',_0x8bd0('0x3d'),_0x8bd0('0x3f'));}break;case _0x8bd0('0x40'):if(_0x409c31[_0x8bd0('0x22')]){var _0x19343e={'recipient':_0x5c89f7[_0x8bd0('0x23')],'message':_0x5c89f7[_0x8bd0('0x25')],'sender':_0x409c31[_0x8bd0('0x41')]||_0x409c31[_0x8bd0('0x23')],'authorization':_0x409c31[_0x8bd0('0x22')]};var _0x25bb87={'method':_0x8bd0('0x38'),'uri':_0x8bd0('0x42'),'body':_0x19343e,'json':!![]};rp(_0x25bb87)[_0x8bd0('0x28')](function(_0x247c56){var _0xd0faa4={'messageId':_0x247c56[_0x8bd0('0x43')]};if(!_0x409c31[_0x8bd0('0x44')]){_0xd0faa4[_0x8bd0('0x3c')]=!![];}return _0x4d1a34[_0x8bd0('0x2a')](_0xd0faa4);})[_0x8bd0('0x2b')](function(_0x1cfeed){logger['error'](_0x8bd0('0x2d'),_0x8bd0('0x2c'),_0x8bd0('0x40'),util[_0x8bd0('0x3e')](_0x1cfeed,{'showHidden':![],'depth':null}));});}else{logger[_0x8bd0('0x1d')](_0x8bd0('0x2d'),_0x8bd0('0x2c'),_0x8bd0('0x40'),'Missing\x20parameters:\x20authToken');}break;case _0x8bd0('0x45'):if(_0x409c31['username']&&_0x409c31[_0x8bd0('0x31')]){var _0x19343e={'messages':[{'source':_0x8bd0('0x46'),'to':_0x5c89f7[_0x8bd0('0x23')],'body':_0x5c89f7[_0x8bd0('0x25')],'from':_0x409c31[_0x8bd0('0x41')]||_0x409c31[_0x8bd0('0x23')]}]};var _0xddc92e=util['format'](_0x8bd0('0x47'),_0x409c31[_0x8bd0('0x30')],_0x409c31[_0x8bd0('0x31')]);var _0x25bb87={'method':_0x8bd0('0x38'),'uri':'https://rest.clicksend.com/v3/sms/send','body':_0x19343e,'headers':{'Authorization':util[_0x8bd0('0x48')](_0x8bd0('0x49'),new Buffer(_0xddc92e)[_0x8bd0('0x4a')](_0x8bd0('0x4b')))},'json':!![]};rp(_0x25bb87)[_0x8bd0('0x28')](function(_0x329785){if(_0x329785[_0x8bd0('0x4c')]>=0xc8&&_0x329785[_0x8bd0('0x4c')]<=0xce){if(_0x329785[_0x8bd0('0x4d')]&&_0x329785[_0x8bd0('0x4d')][_0x8bd0('0x4e')]>0x0){var _0x3e691f=_[_0x8bd0('0x4f')](_0x329785[_0x8bd0('0x4d')][_0x8bd0('0x50')]);var _0x43ad7b={'messageId':_0x3e691f[_0x8bd0('0x51')]};if(!_0x409c31[_0x8bd0('0x44')]){_0x43ad7b['read']=!![];}return _0x4d1a34[_0x8bd0('0x2a')](_0x43ad7b);}else{logger[_0x8bd0('0x1d')](_0x8bd0('0x2d'),_0x8bd0('0x2c'),_0x8bd0('0x52'),util['inspect'](_0x329785,{'showHidden':![],'depth':null}));}}else{logger[_0x8bd0('0x1d')](_0x8bd0('0x2d'),'afterCreate',_0x8bd0('0x52'),util[_0x8bd0('0x3e')](_0x329785,{'showHidden':![],'depth':null}));}})[_0x8bd0('0x2b')](function(_0x2af02c){logger[_0x8bd0('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x8bd0('0x2c'),'clickSend',util[_0x8bd0('0x3e')](_0x2af02c,{'showHidden':![],'depth':null}));});}else{logger[_0x8bd0('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x8bd0('0x2c'),_0x8bd0('0x52'),'Missing\x20parameters:\x20username,\x20password');}break;case _0x8bd0('0x53'):if(_0x409c31['authId']&&_0x409c31[_0x8bd0('0x22')]){var _0x19343e={'dst':_0x5c89f7[_0x8bd0('0x23')],'text':_0x5c89f7[_0x8bd0('0x25')],'src':_0x409c31[_0x8bd0('0x41')]||_0x409c31[_0x8bd0('0x23')],'url':_0x409c31[_0x8bd0('0x26')]+_0x8bd0('0x54')+_0x5c89f7['id']+_0x8bd0('0x55')+_0x409c31[_0x8bd0('0x27')]};var _0xddc92e=util[_0x8bd0('0x48')](_0x8bd0('0x47'),_0x409c31[_0x8bd0('0x56')],_0x409c31[_0x8bd0('0x22')]);var _0x25bb87={'method':_0x8bd0('0x38'),'uri':util[_0x8bd0('0x48')](_0x8bd0('0x57'),_0x409c31[_0x8bd0('0x56')]),'body':_0x19343e,'headers':{'Authorization':util[_0x8bd0('0x48')](_0x8bd0('0x49'),new Buffer(_0xddc92e)[_0x8bd0('0x4a')](_0x8bd0('0x4b')))},'json':!![]};rp(_0x25bb87)[_0x8bd0('0x28')](function(_0x4522ef){var _0x195a36={'messageId':_0x4522ef[_0x8bd0('0x58')][0x0]};return _0x4d1a34[_0x8bd0('0x2a')](_0x195a36);})[_0x8bd0('0x2b')](function(_0x4bc646){logger[_0x8bd0('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x8bd0('0x2c'),_0x8bd0('0x53'),util[_0x8bd0('0x3e')](_0x4bc646,{'showHidden':![],'depth':null}));});}else{logger[_0x8bd0('0x1d')](_0x8bd0('0x2d'),_0x8bd0('0x2c'),_0x8bd0('0x53'),_0x8bd0('0x59'));}break;case _0x8bd0('0x5a'):if(_0x409c31[_0x8bd0('0x30')]&&_0x409c31['password']){if(_0x409c31[_0x8bd0('0x5b')]){var _0x3da4f8={'method':'POST','uri':_0x409c31['baseUrl']+_0x8bd0('0x5c'),'body':{'username':_0x409c31['username'],'password':_0x409c31[_0x8bd0('0x31')]},'json':!![]};return rp(_0x3da4f8)[_0x8bd0('0x28')](function(_0x5e8533){var _0x142aa4={'method':'POST','uri':_0x409c31[_0x8bd0('0x5b')]+_0x8bd0('0x5d'),'body':{'messages':[{'from':_0x409c31[_0x8bd0('0x23')],'destinations':[{'to':_0x5c89f7[_0x8bd0('0x23')]}],'text':_0x5c89f7[_0x8bd0('0x25')],'notifyUrl':_0x409c31[_0x8bd0('0x26')]+_0x8bd0('0x54')+_0x5c89f7['id']+'/status?token='+_0x409c31[_0x8bd0('0x27')],'notifyContentType':_0x8bd0('0x5e'),'callbackData':_0x409c31['phone']+';'+_0x5c89f7[_0x8bd0('0x25')]}]},'headers':{'Authorization':_0x8bd0('0x5f')+_0x5e8533[_0x8bd0('0x27')]},'json':!![]};return rp(_0x142aa4)['then'](function(_0x5ee076){if(_0x5ee076['messages']){var _0xd23503={'messageId':_0x5ee076[_0x8bd0('0x50')][0x0][_0x8bd0('0xe')]};if(!_0x409c31['deliveryReport']){_0xd23503[_0x8bd0('0x3c')]=!![];}return _0x4d1a34[_0x8bd0('0x2a')](_0xd23503);}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x8bd0('0x5a'),util['inspect'](_0x5ee076,{'showHidden':![],'depth':null}));}});})[_0x8bd0('0x2b')](function(_0x10fdfa){return logger[_0x8bd0('0x1d')](_0x8bd0('0x2d'),_0x8bd0('0x2c'),_0x8bd0('0x5a'),util[_0x8bd0('0x3e')](_0x10fdfa,{'showHidden':![],'depth':null}));});}else{logger[_0x8bd0('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x8bd0('0x2c'),_0x8bd0('0x5a'),'Missing\x20parameters:\x20base_url');}}else{logger[_0x8bd0('0x1d')](_0x8bd0('0x2d'),_0x8bd0('0x2c'),_0x8bd0('0x5a'),'Missing\x20parameters:\x20username,\x20password');}break;case _0x8bd0('0x60'):var _0x35ba44=require(_0x8bd0('0x61'));if(_0x409c31[_0x8bd0('0x62')]){var _0x5e6e08={};_0x5e6e08[_0x8bd0('0x63')]=_0x409c31[_0x8bd0('0x30')];_0x5e6e08[_0x8bd0('0x23')]=_0x5c89f7[_0x8bd0('0x23')];_0x5e6e08[_0x8bd0('0x33')]=_0x409c31[_0x8bd0('0x23')];_0x5e6e08[_0x8bd0('0x64')]=_0x5c89f7[_0x8bd0('0x25')];_0x5e6e08[_0x8bd0('0x65')]=+new Date();var _0x3d6bfb='';var _0xae9b7c='';var _0x349f9f=Object[_0x8bd0('0x66')](_0x5e6e08);_0x349f9f['sort']();for(var _0x510ed7=0x0;_0x510ed7<_0x349f9f['length'];_0x510ed7++){if(_0x3d6bfb!=''){_0x3d6bfb+='&';}_0x3d6bfb+=_0x349f9f[_0x510ed7]+'='+encodeURIComponent(_0x5e6e08[_0x349f9f[_0x510ed7]]);_0xae9b7c+=_0x5e6e08[_0x349f9f[_0x510ed7]];}_0xae9b7c+=_0x409c31[_0x8bd0('0x62')];_0xae9b7c=_0x35ba44[_0x8bd0('0x67')](_0x8bd0('0x68'))[_0x8bd0('0x2a')](_0xae9b7c)[_0x8bd0('0x69')](_0x8bd0('0x6a'));if(_0x3d6bfb!==''){_0x3d6bfb+='&';}_0x3d6bfb+=_0x8bd0('0x6b')+_0xae9b7c;var _0x44bae7={'method':_0x8bd0('0x36'),'uri':_0x409c31['baseUrl']+_0x8bd0('0x6c')+_0x3d6bfb,'json':!![]};return rp(_0x44bae7)['then'](function(_0x45d24f){var _0x20ec26=Object[_0x8bd0('0x66')](_0x45d24f);if(_0x45d24f[_0x20ec26[0x0]][_0x8bd0('0x1d')]&&parseInt(_0x45d24f[_0x20ec26[0x0]][_0x8bd0('0x1d')])===0x0){var _0x45a4cc={'messageId':_0x45d24f[_0x20ec26[0x0]][_0x8bd0('0x6d')]};if(!_0x409c31[_0x8bd0('0x44')]){_0x45a4cc['read']=!![];}return _0x4d1a34['update'](_0x45a4cc);}else{return logger[_0x8bd0('0x1d')](_0x8bd0('0x2d'),_0x8bd0('0x2c'),'csc',util[_0x8bd0('0x3e')](_0x45d24f[_0x8bd0('0x1d')],{'showHidden':![],'depth':null}));}})[_0x8bd0('0x2b')](function(_0x5138f1){return logger['error'](_0x8bd0('0x2d'),_0x8bd0('0x2c'),'csc',util['inspect'](_0x5138f1,{'showHidden':![],'depth':null}));});}else{logger[_0x8bd0('0x1d')](_0x8bd0('0x2d'),_0x8bd0('0x2c'),_0x8bd0('0x60'),_0x8bd0('0x6e'));}break;case _0x8bd0('0x6f'):if(_0x409c31['apiKey']){var _0x2b9e8c={'method':_0x8bd0('0x38'),'uri':'https://platform.clickatell.com/messages','headers':{'Authorization':_0x409c31[_0x8bd0('0x62')]},'body':{'content':_0x5c89f7[_0x8bd0('0x25')],'to':[_0x5c89f7[_0x8bd0('0x23')]],'from':_0x409c31['phone'],'binary':![],'clientMessageId':_0x8bd0('0x70'),'charset':_0x8bd0('0x71')},'json':!![]};rp(_0x2b9e8c)[_0x8bd0('0x28')](function(_0x397cee){if(!_0x397cee[_0x8bd0('0x1d')]){var _0x1e16a8={'messageId':_0x397cee[_0x8bd0('0x50')][0x0]['apiMessageId']};if(!_0x409c31[_0x8bd0('0x44')]){_0x1e16a8[_0x8bd0('0x3c')]=!![];}return _0x4d1a34['update'](_0x1e16a8);}else{return logger[_0x8bd0('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x8bd0('0x2c'),_0x8bd0('0x6f'),util[_0x8bd0('0x3e')](_0x397cee['error'],{'showHidden':![],'depth':null}));}})[_0x8bd0('0x2b')](function(_0x1c11bb){return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x8bd0('0x2c'),_0x8bd0('0x6f'),util[_0x8bd0('0x3e')](_0x1c11bb,{'showHidden':![],'depth':null}));});}else{logger[_0x8bd0('0x1d')](_0x8bd0('0x2d'),_0x8bd0('0x2c'),_0x8bd0('0x6f'),'Missing\x20parameters:\x20apiKey');}break;case _0x8bd0('0x72'):if(_0x409c31['username']&&_0x409c31[_0x8bd0('0x31')]){var _0xddc92e=util[_0x8bd0('0x48')](_0x8bd0('0x47'),_0x409c31[_0x8bd0('0x30')],_0x409c31[_0x8bd0('0x31')]);var _0x25bb87={'method':_0x8bd0('0x38'),'uri':_0x8bd0('0x73')+_0x409c31[_0x8bd0('0x74')]+_0x8bd0('0x75'),'body':{'to':[_0x5c89f7['phone']],'text':_0x5c89f7[_0x8bd0('0x25')],'from':_0x409c31[_0x8bd0('0x23')],'applicationId':_0x409c31[_0x8bd0('0x76')]},'headers':{'Authorization':util[_0x8bd0('0x48')]('Basic\x20%s',new Buffer(_0xddc92e)[_0x8bd0('0x4a')]('base64'))},'json':!![]};rp(_0x25bb87)['then'](function(_0x21a9f6){if(_0x21a9f6['id']){var _0x1caed5={'messageId':_0x21a9f6['id']};return _0x4d1a34[_0x8bd0('0x2a')](_0x1caed5);}else{logger[_0x8bd0('0x1d')](_0x8bd0('0x2d'),'afterCreate',_0x8bd0('0x72'),util[_0x8bd0('0x3e')](_0x21a9f6,{'showHidden':![],'depth':null}));}})[_0x8bd0('0x2b')](function(_0x21e997){logger[_0x8bd0('0x1d')](_0x8bd0('0x2d'),_0x8bd0('0x2c'),_0x8bd0('0x72'),util[_0x8bd0('0x3e')](_0x21e997,{'showHidden':![],'depth':null}));});}else{logger[_0x8bd0('0x1d')](_0x8bd0('0x2d'),_0x8bd0('0x2c'),_0x8bd0('0x72'),_0x8bd0('0x3f'));}break;case'intelepeer':if(_0x409c31[_0x8bd0('0x62')]){var _0x4fcf6b={};var _0x44bae7={'method':'POST','uri':_0x8bd0('0x77'),'headers':{'Authorization':_0x8bd0('0x78')+_0x409c31[_0x8bd0('0x62')],'Content-Type':_0x8bd0('0x5e')},'body':{'from':_0x409c31[_0x8bd0('0x23')],'to':_0x5c89f7['phone'],'text':_0x5c89f7['body']},'json':!![]};return rp(_0x44bae7)[_0x8bd0('0x28')](function(_0xc04e37){if(_0xc04e37[_0x8bd0('0x79')]==0xca){_0x4fcf6b['message']=_0xc04e37;var _0x5f3f8d={'method':_0x8bd0('0x38'),'uri':_0x8bd0('0x7a'),'headers':{'Authorization':_0x8bd0('0x78')+_0x409c31[_0x8bd0('0x62')],'Content-Type':_0x8bd0('0x5e')},'body':{'refid':_0x4fcf6b['message'][_0x8bd0('0x7b')]},'json':!![]};return rp(_0x5f3f8d)[_0x8bd0('0x28')](function(_0x367199){_0x4fcf6b['status']=_0x367199;var _0x569223={'messageId':_0x4fcf6b[_0x8bd0('0x7c')][_0x8bd0('0x7b')],'read':!![]};return _0x4d1a34['update'](_0x569223);});}else{return logger[_0x8bd0('0x1d')](_0x8bd0('0x2d'),_0x8bd0('0x2c'),'intelepeer',util[_0x8bd0('0x3e')](_0xc04e37,{'showHidden':![],'depth':null}));}})[_0x8bd0('0x2b')](function(_0x419538){return logger[_0x8bd0('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x8bd0('0x2c'),_0x8bd0('0x7d'),util[_0x8bd0('0x3e')](_0x419538,{'showHidden':![],'depth':null}));});}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x8bd0('0x7d'),'Token\x20not\x20received');}break;}}})[_0x8bd0('0x7e')](function(){_0x4c2e8e();});}else{_0x4c2e8e();}}},'charset':_0x8bd0('0x7f'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xdb56=['smsMethod','sender','username','&password=','GET','sms','POST','user_key','session_key','total_sent','internal_order_id','read','Missing\x20parameters:\x20username,\x20password','connectel','senderString','https://smsapi.connectel.se/api/v2/send/','requestid','deliveryReport','Missing\x20parameters:\x20authToken','clicksend','https://rest.clicksend.com/v3/sms/send','toString','base64','http_code','data','queued_count','head','message_id','clickSend','plivo','authId','token','%s:%s','format','https://api.plivo.com/v1/Account/%s/Message/','Basic\x20%s','message_uuid','baseUrl','/sms/2/text/advanced','/api/sms/messages/','application/json','infobip','Missing\x20parameters:\x20base_url','csc','crypto','text','timestamp','keys','sort','length','apiKey','createHash','md5','digest','hex','signature=','/external/get/send.php?','id_sms','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','uuid','apiMessageId','bandwidth','https://messaging.bandwidth.com/api/v2/users/','accountId','/messages','applicationId','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','status','intelepeer','finally','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','path','rimraf','./smsMessage.attributes','exports','SmsMessage','sms_messages','messageId','FULLTEXT','get','toLowerCase','isNil','SmsInteraction','SmsInteractionId','direction','catch','out','secret','SmsAccount','find','SmsAccountId','then','type','twilio','phone','accountSid','authToken','messages','body','remote','/status?token=','sid','update','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'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0xdb56,0x1c3));var _0x6db5=function(_0x9d2d2,_0x1c1c2c){_0x9d2d2=_0x9d2d2-0x0;var _0x488242=_0xdb56[_0x9d2d2];return _0x488242;};'use strict';var _=require('lodash');var util=require(_0x6db5('0x0'));var logger=require(_0x6db5('0x1'))(_0x6db5('0x2'));var moment=require(_0x6db5('0x3'));var BPromise=require(_0x6db5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6db5('0x5'));var rimraf=require(_0x6db5('0x6'));var config=require('../../config/environment');var attributes=require(_0x6db5('0x7'));module[_0x6db5('0x8')]=function(_0x17f2c2,_0x14dcaa){return _0x17f2c2['define'](_0x6db5('0x9'),attributes,{'tableName':_0x6db5('0xa'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0x6db5('0xb')]},{'name':'fti_sms_messages','fields':['body'],'type':_0x6db5('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x34ba8f,_0x28d439,_0x21251f){var _0x3797ce=_0x17f2c2['models'];var _0x1fb4bb=_0x34ba8f[_0x6db5('0xd')]({'plain':!![]});if(_0x1fb4bb['direction'][_0x6db5('0xe')]()==='in'||_0x1fb4bb['direction']['toLowerCase']()==='out'&&!_0x1fb4bb['secret']&&!_['isNil'](_0x1fb4bb['UserId'])&&!_[_0x6db5('0xf')](_0x1fb4bb['SmsInteractionId'])){_0x3797ce[_0x6db5('0x10')]['findOne']({'where':{'id':_0x1fb4bb[_0x6db5('0x11')]}})['then'](function(_0x101d03){if(_0x101d03){_0x101d03['update']({'lastMsgAt':_0x1fb4bb['createdAt'],'lastMsgDirection':_0x1fb4bb[_0x6db5('0x12')]['toLowerCase']()});}})[_0x6db5('0x13')](function(_0x36b4d7){console['error'](_0x36b4d7);});}if(_0x1fb4bb[_0x6db5('0x12')]===_0x6db5('0x14')&&!_0x1fb4bb[_0x6db5('0x15')]){var _0x3cb9a4;_0x3797ce[_0x6db5('0x16')][_0x6db5('0x17')]({'where':{'id':_0x1fb4bb[_0x6db5('0x18')]},'raw':!![]})[_0x6db5('0x19')](function(_0x2b1284){_0x3cb9a4=_0x2b1284;if(_0x3cb9a4&&_0x3cb9a4[_0x6db5('0x1a')]){switch(_0x3cb9a4[_0x6db5('0x1a')]){case _0x6db5('0x1b'):var _0x15aaaf=require(_0x6db5('0x1b'));if(_0x3cb9a4['accountSid']&&_0x3cb9a4['authToken']&&_0x3cb9a4[_0x6db5('0x1c')]){var _0x324941=new _0x15aaaf(_0x3cb9a4[_0x6db5('0x1d')],_0x3cb9a4[_0x6db5('0x1e')]);_0x324941[_0x6db5('0x1f')]['create']({'body':_0x1fb4bb[_0x6db5('0x20')],'to':_0x1fb4bb[_0x6db5('0x1c')],'from':_0x3cb9a4[_0x6db5('0x1c')],'statusCallback':_0x3cb9a4[_0x6db5('0x21')]+'/api/sms/messages/'+_0x1fb4bb['id']+_0x6db5('0x22')+_0x3cb9a4['token']})['then'](function(_0x1abb45){if(_0x1abb45[_0x6db5('0x23')]){return _0x34ba8f[_0x6db5('0x24')]({'messageId':_0x1abb45[_0x6db5('0x23')]});}})[_0x6db5('0x13')](function(_0x570396){logger[_0x6db5('0x25')](_0x6db5('0x26'),_0x6db5('0x27'),_0x6db5('0x1b'),util[_0x6db5('0x28')](_0x570396,{'showHidden':![],'depth':null}));});}else{logger[_0x6db5('0x25')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x6db5('0x27'),_0x6db5('0x1b'),_0x6db5('0x29'));}break;case _0x6db5('0x2a'):var _0x165cbe=_0x6db5('0x2b');if(_0x3cb9a4['username']&&_0x3cb9a4[_0x6db5('0x2c')]){var _0x40cdb6={'recipient':[_0x1fb4bb[_0x6db5('0x1c')]],'message':_0x1fb4bb['body'],'message_type':_0x3cb9a4[_0x6db5('0x2d')]};if(_0x3cb9a4[_0x6db5('0x2d')]&&_0x3cb9a4['smsMethod']!=='SI'){_0x40cdb6[_0x6db5('0x2e')]=_0x3cb9a4[_0x6db5('0x1c')];}var _0x102b2d={'url':_0x165cbe+'login?username='+_0x3cb9a4[_0x6db5('0x2f')]+_0x6db5('0x30')+_0x3cb9a4[_0x6db5('0x2c')],'method':_0x6db5('0x31')};rp(_0x102b2d)[_0x6db5('0x19')](function(_0x2d3812){var _0x59bc46=_0x2d3812['split'](';');var _0x214dcd={'user_key':_0x59bc46[0x0],'session_key':_0x59bc46[0x1]};_0x102b2d={'url':_0x165cbe+_0x6db5('0x32'),'method':_0x6db5('0x33'),'headers':{'user_key':_0x214dcd[_0x6db5('0x34')],'Session_key':_0x214dcd[_0x6db5('0x35')]},'json':!![],'body':_0x40cdb6};return rp(_0x102b2d);})['then'](function(_0x224594){if(_0x224594[_0x6db5('0x36')]>=0x1){var _0x55a36e={'messageId':_0x224594[_0x6db5('0x37')]};if(_0x3cb9a4[_0x6db5('0x2d')]!=='GP'||!_0x3cb9a4['deliveryReport']){_0x55a36e[_0x6db5('0x38')]=!![];}return _0x34ba8f['update'](_0x55a36e);}else{return logger[_0x6db5('0x25')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x6db5('0x27'),_0x6db5('0x2a'),util[_0x6db5('0x28')](_0x224594,{'showHidden':![],'depth':null}));}})[_0x6db5('0x13')](function(_0x32c2c1){return logger[_0x6db5('0x25')](_0x6db5('0x26'),_0x6db5('0x27'),_0x6db5('0x2a'),util[_0x6db5('0x28')](_0x32c2c1,{'showHidden':![],'depth':null}));});}else{logger[_0x6db5('0x25')](_0x6db5('0x26'),_0x6db5('0x27'),'skebby',_0x6db5('0x39'));}break;case _0x6db5('0x3a'):if(_0x3cb9a4['authToken']){var _0x584884={'recipient':_0x1fb4bb[_0x6db5('0x1c')],'message':_0x1fb4bb['body'],'sender':_0x3cb9a4[_0x6db5('0x3b')]||_0x3cb9a4[_0x6db5('0x1c')],'authorization':_0x3cb9a4[_0x6db5('0x1e')]};var _0x28d439={'method':_0x6db5('0x33'),'uri':_0x6db5('0x3c'),'body':_0x584884,'json':!![]};rp(_0x28d439)[_0x6db5('0x19')](function(_0x144504){var _0x1f06cd={'messageId':_0x144504[_0x6db5('0x3d')]};if(!_0x3cb9a4[_0x6db5('0x3e')]){_0x1f06cd['read']=!![];}return _0x34ba8f[_0x6db5('0x24')](_0x1f06cd);})['catch'](function(_0x1d9032){logger['error'](_0x6db5('0x26'),_0x6db5('0x27'),_0x6db5('0x3a'),util[_0x6db5('0x28')](_0x1d9032,{'showHidden':![],'depth':null}));});}else{logger[_0x6db5('0x25')](_0x6db5('0x26'),_0x6db5('0x27'),_0x6db5('0x3a'),_0x6db5('0x3f'));}break;case _0x6db5('0x40'):if(_0x3cb9a4[_0x6db5('0x2f')]&&_0x3cb9a4['password']){var _0x584884={'messages':[{'source':'xCALLY\x20Motion','to':_0x1fb4bb[_0x6db5('0x1c')],'body':_0x1fb4bb['body'],'from':_0x3cb9a4[_0x6db5('0x3b')]||_0x3cb9a4[_0x6db5('0x1c')]}]};var _0x1918e7=util['format']('%s:%s',_0x3cb9a4[_0x6db5('0x2f')],_0x3cb9a4['password']);var _0x28d439={'method':_0x6db5('0x33'),'uri':_0x6db5('0x41'),'body':_0x584884,'headers':{'Authorization':util['format']('Basic\x20%s',new Buffer(_0x1918e7)[_0x6db5('0x42')](_0x6db5('0x43')))},'json':!![]};rp(_0x28d439)[_0x6db5('0x19')](function(_0x59b08d){if(_0x59b08d[_0x6db5('0x44')]>=0xc8&&_0x59b08d[_0x6db5('0x44')]<=0xce){if(_0x59b08d[_0x6db5('0x45')]&&_0x59b08d[_0x6db5('0x45')][_0x6db5('0x46')]>0x0){var _0x2a58fd=_[_0x6db5('0x47')](_0x59b08d['data'][_0x6db5('0x1f')]);var _0x3c8c22={'messageId':_0x2a58fd[_0x6db5('0x48')]};if(!_0x3cb9a4[_0x6db5('0x3e')]){_0x3c8c22[_0x6db5('0x38')]=!![];}return _0x34ba8f[_0x6db5('0x24')](_0x3c8c22);}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x6db5('0x27'),'clickSend',util['inspect'](_0x59b08d,{'showHidden':![],'depth':null}));}}else{logger[_0x6db5('0x25')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x6db5('0x27'),_0x6db5('0x49'),util[_0x6db5('0x28')](_0x59b08d,{'showHidden':![],'depth':null}));}})[_0x6db5('0x13')](function(_0x488d36){logger[_0x6db5('0x25')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x6db5('0x27'),'clickSend',util[_0x6db5('0x28')](_0x488d36,{'showHidden':![],'depth':null}));});}else{logger[_0x6db5('0x25')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x6db5('0x49'),_0x6db5('0x39'));}break;case _0x6db5('0x4a'):if(_0x3cb9a4[_0x6db5('0x4b')]&&_0x3cb9a4[_0x6db5('0x1e')]){var _0x584884={'dst':_0x1fb4bb[_0x6db5('0x1c')],'text':_0x1fb4bb[_0x6db5('0x20')],'src':_0x3cb9a4[_0x6db5('0x3b')]||_0x3cb9a4['phone'],'url':_0x3cb9a4[_0x6db5('0x21')]+'/api/sms/messages/'+_0x1fb4bb['id']+_0x6db5('0x22')+_0x3cb9a4[_0x6db5('0x4c')]};var _0x1918e7=util['format'](_0x6db5('0x4d'),_0x3cb9a4[_0x6db5('0x4b')],_0x3cb9a4[_0x6db5('0x1e')]);var _0x28d439={'method':_0x6db5('0x33'),'uri':util[_0x6db5('0x4e')](_0x6db5('0x4f'),_0x3cb9a4[_0x6db5('0x4b')]),'body':_0x584884,'headers':{'Authorization':util[_0x6db5('0x4e')](_0x6db5('0x50'),new Buffer(_0x1918e7)[_0x6db5('0x42')](_0x6db5('0x43')))},'json':!![]};rp(_0x28d439)[_0x6db5('0x19')](function(_0xa78380){var _0x4cfca1={'messageId':_0xa78380[_0x6db5('0x51')][0x0]};return _0x34ba8f[_0x6db5('0x24')](_0x4cfca1);})[_0x6db5('0x13')](function(_0x3c83fa){logger[_0x6db5('0x25')](_0x6db5('0x26'),_0x6db5('0x27'),_0x6db5('0x4a'),util[_0x6db5('0x28')](_0x3c83fa,{'showHidden':![],'depth':null}));});}else{logger[_0x6db5('0x25')](_0x6db5('0x26'),'afterCreate',_0x6db5('0x4a'),'Missing\x20parameters:\x20authId,\x20authToken');}break;case'infobip':if(_0x3cb9a4[_0x6db5('0x2f')]&&_0x3cb9a4['password']){if(_0x3cb9a4[_0x6db5('0x52')]){var _0x90c56c={'method':_0x6db5('0x33'),'uri':_0x3cb9a4['baseUrl']+'/auth/1/session','body':{'username':_0x3cb9a4[_0x6db5('0x2f')],'password':_0x3cb9a4[_0x6db5('0x2c')]},'json':!![]};return rp(_0x90c56c)['then'](function(_0x3f2282){var _0x112a75={'method':_0x6db5('0x33'),'uri':_0x3cb9a4[_0x6db5('0x52')]+_0x6db5('0x53'),'body':{'messages':[{'from':_0x3cb9a4[_0x6db5('0x1c')],'destinations':[{'to':_0x1fb4bb[_0x6db5('0x1c')]}],'text':_0x1fb4bb[_0x6db5('0x20')],'notifyUrl':_0x3cb9a4[_0x6db5('0x21')]+_0x6db5('0x54')+_0x1fb4bb['id']+_0x6db5('0x22')+_0x3cb9a4['token'],'notifyContentType':_0x6db5('0x55'),'callbackData':_0x3cb9a4[_0x6db5('0x1c')]+';'+_0x1fb4bb[_0x6db5('0x20')]}]},'headers':{'Authorization':'IBSSO\x20'+_0x3f2282[_0x6db5('0x4c')]},'json':!![]};return rp(_0x112a75)['then'](function(_0x448ecb){if(_0x448ecb['messages']){var _0xd91aba={'messageId':_0x448ecb['messages'][0x0][_0x6db5('0xb')]};if(!_0x3cb9a4[_0x6db5('0x3e')]){_0xd91aba[_0x6db5('0x38')]=!![];}return _0x34ba8f[_0x6db5('0x24')](_0xd91aba);}else{return logger[_0x6db5('0x25')](_0x6db5('0x26'),_0x6db5('0x27'),_0x6db5('0x56'),util[_0x6db5('0x28')](_0x448ecb,{'showHidden':![],'depth':null}));}});})[_0x6db5('0x13')](function(_0x166b2b){return logger[_0x6db5('0x25')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x6db5('0x27'),'infobip',util[_0x6db5('0x28')](_0x166b2b,{'showHidden':![],'depth':null}));});}else{logger[_0x6db5('0x25')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x6db5('0x27'),_0x6db5('0x56'),_0x6db5('0x57'));}}else{logger['error'](_0x6db5('0x26'),_0x6db5('0x27'),'infobip',_0x6db5('0x39'));}break;case _0x6db5('0x58'):var _0x14a17e=require(_0x6db5('0x59'));if(_0x3cb9a4['apiKey']){var _0x5f1ced={};_0x5f1ced['login']=_0x3cb9a4[_0x6db5('0x2f')];_0x5f1ced['phone']=_0x1fb4bb[_0x6db5('0x1c')];_0x5f1ced[_0x6db5('0x2e')]=_0x3cb9a4[_0x6db5('0x1c')];_0x5f1ced[_0x6db5('0x5a')]=_0x1fb4bb['body'];_0x5f1ced[_0x6db5('0x5b')]=+new Date();var _0x4baf50='';var _0xdf30bc='';var _0x2884e5=Object[_0x6db5('0x5c')](_0x5f1ced);_0x2884e5[_0x6db5('0x5d')]();for(var _0x54d5c1=0x0;_0x54d5c1<_0x2884e5[_0x6db5('0x5e')];_0x54d5c1++){if(_0x4baf50!=''){_0x4baf50+='&';}_0x4baf50+=_0x2884e5[_0x54d5c1]+'='+encodeURIComponent(_0x5f1ced[_0x2884e5[_0x54d5c1]]);_0xdf30bc+=_0x5f1ced[_0x2884e5[_0x54d5c1]];}_0xdf30bc+=_0x3cb9a4[_0x6db5('0x5f')];_0xdf30bc=_0x14a17e[_0x6db5('0x60')](_0x6db5('0x61'))[_0x6db5('0x24')](_0xdf30bc)[_0x6db5('0x62')](_0x6db5('0x63'));if(_0x4baf50!==''){_0x4baf50+='&';}_0x4baf50+=_0x6db5('0x64')+_0xdf30bc;var _0x102b2d={'method':_0x6db5('0x31'),'uri':_0x3cb9a4[_0x6db5('0x52')]+_0x6db5('0x65')+_0x4baf50,'json':!![]};return rp(_0x102b2d)[_0x6db5('0x19')](function(_0x5bdda1){var _0x3d1716=Object[_0x6db5('0x5c')](_0x5bdda1);if(_0x5bdda1[_0x3d1716[0x0]][_0x6db5('0x25')]&&parseInt(_0x5bdda1[_0x3d1716[0x0]][_0x6db5('0x25')])===0x0){var _0x52a2bd={'messageId':_0x5bdda1[_0x3d1716[0x0]][_0x6db5('0x66')]};if(!_0x3cb9a4['deliveryReport']){_0x52a2bd[_0x6db5('0x38')]=!![];}return _0x34ba8f[_0x6db5('0x24')](_0x52a2bd);}else{return logger['error'](_0x6db5('0x26'),'afterCreate',_0x6db5('0x58'),util[_0x6db5('0x28')](_0x5bdda1[_0x6db5('0x25')],{'showHidden':![],'depth':null}));}})[_0x6db5('0x13')](function(_0x562eee){return logger[_0x6db5('0x25')](_0x6db5('0x26'),_0x6db5('0x27'),_0x6db5('0x58'),util['inspect'](_0x562eee,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x6db5('0x26'),_0x6db5('0x27'),_0x6db5('0x58'),_0x6db5('0x67'));}break;case _0x6db5('0x68'):if(_0x3cb9a4[_0x6db5('0x5f')]){var _0x39c0a6={'method':'POST','uri':_0x6db5('0x69'),'headers':{'Authorization':_0x3cb9a4[_0x6db5('0x5f')]},'body':{'content':_0x1fb4bb['body'],'to':[_0x1fb4bb[_0x6db5('0x1c')]],'from':_0x3cb9a4[_0x6db5('0x1c')],'binary':![],'clientMessageId':_0x6db5('0x6a'),'charset':'UTF-8'},'json':!![]};rp(_0x39c0a6)[_0x6db5('0x19')](function(_0x2847fb){if(!_0x2847fb[_0x6db5('0x25')]){var _0x577dfa={'messageId':_0x2847fb[_0x6db5('0x1f')][0x0][_0x6db5('0x6b')]};if(!_0x3cb9a4['deliveryReport']){_0x577dfa[_0x6db5('0x38')]=!![];}return _0x34ba8f['update'](_0x577dfa);}else{return logger[_0x6db5('0x25')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x6db5('0x27'),'clickatell',util[_0x6db5('0x28')](_0x2847fb[_0x6db5('0x25')],{'showHidden':![],'depth':null}));}})[_0x6db5('0x13')](function(_0x2c12e4){return logger[_0x6db5('0x25')](_0x6db5('0x26'),'afterCreate',_0x6db5('0x68'),util[_0x6db5('0x28')](_0x2c12e4,{'showHidden':![],'depth':null}));});}else{logger[_0x6db5('0x25')](_0x6db5('0x26'),'afterCreate',_0x6db5('0x68'),_0x6db5('0x67'));}break;case _0x6db5('0x6c'):if(_0x3cb9a4['username']&&_0x3cb9a4[_0x6db5('0x2c')]){var _0x1918e7=util[_0x6db5('0x4e')](_0x6db5('0x4d'),_0x3cb9a4[_0x6db5('0x2f')],_0x3cb9a4[_0x6db5('0x2c')]);var _0x28d439={'method':_0x6db5('0x33'),'uri':_0x6db5('0x6d')+_0x3cb9a4[_0x6db5('0x6e')]+_0x6db5('0x6f'),'body':{'to':[_0x1fb4bb[_0x6db5('0x1c')]],'text':_0x1fb4bb[_0x6db5('0x20')],'from':_0x3cb9a4[_0x6db5('0x1c')],'applicationId':_0x3cb9a4[_0x6db5('0x70')]},'headers':{'Authorization':util[_0x6db5('0x4e')]('Basic\x20%s',new Buffer(_0x1918e7)['toString'](_0x6db5('0x43')))},'json':!![]};rp(_0x28d439)[_0x6db5('0x19')](function(_0x5380e6){if(_0x5380e6['id']){var _0x1f3667={'messageId':_0x5380e6['id']};return _0x34ba8f[_0x6db5('0x24')](_0x1f3667);}else{logger['error'](_0x6db5('0x26'),_0x6db5('0x27'),'bandwidth',util[_0x6db5('0x28')](_0x5380e6,{'showHidden':![],'depth':null}));}})[_0x6db5('0x13')](function(_0x46abef){logger[_0x6db5('0x25')](_0x6db5('0x26'),_0x6db5('0x27'),_0x6db5('0x6c'),util[_0x6db5('0x28')](_0x46abef,{'showHidden':![],'depth':null}));});}else{logger[_0x6db5('0x25')](_0x6db5('0x26'),_0x6db5('0x27'),_0x6db5('0x6c'),_0x6db5('0x39'));}break;case'intelepeer':if(_0x3cb9a4[_0x6db5('0x5f')]){var _0x20e869={};var _0x102b2d={'method':'POST','uri':_0x6db5('0x71'),'headers':{'Authorization':_0x6db5('0x72')+_0x3cb9a4[_0x6db5('0x5f')],'Content-Type':_0x6db5('0x55')},'body':{'from':_0x3cb9a4[_0x6db5('0x1c')],'to':_0x1fb4bb[_0x6db5('0x1c')],'text':_0x1fb4bb[_0x6db5('0x20')]},'json':!![]};return rp(_0x102b2d)[_0x6db5('0x19')](function(_0x2fed42){if(_0x2fed42[_0x6db5('0x73')]==0xca){_0x20e869[_0x6db5('0x74')]=_0x2fed42;var _0x12da06={'method':_0x6db5('0x33'),'uri':_0x6db5('0x75'),'headers':{'Authorization':_0x6db5('0x72')+_0x3cb9a4[_0x6db5('0x5f')],'Content-Type':_0x6db5('0x55')},'body':{'refid':_0x20e869[_0x6db5('0x74')][_0x6db5('0x76')]},'json':!![]};return rp(_0x12da06)[_0x6db5('0x19')](function(_0x3a6226){_0x20e869[_0x6db5('0x77')]=_0x3a6226;var _0x42f536={'messageId':_0x20e869[_0x6db5('0x74')]['refid'],'read':!![]};return _0x34ba8f[_0x6db5('0x24')](_0x42f536);});}else{return logger[_0x6db5('0x25')](_0x6db5('0x26'),_0x6db5('0x27'),_0x6db5('0x78'),util[_0x6db5('0x28')](_0x2fed42,{'showHidden':![],'depth':null}));}})[_0x6db5('0x13')](function(_0x38e623){return logger[_0x6db5('0x25')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x6db5('0x27'),_0x6db5('0x78'),util[_0x6db5('0x28')](_0x38e623,{'showHidden':![],'depth':null}));});}else{return logger['error'](_0x6db5('0x26'),_0x6db5('0x27'),_0x6db5('0x78'),'Token\x20not\x20received');}break;}}})[_0x6db5('0x79')](function(){_0x21251f();});}else{_0x21251f();}}},'charset':_0x6db5('0x7a'),'collate':_0x6db5('0x7b')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index d6999aa..a63d192 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 _0xb984=['request','then','info','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsMessage,\x20%s,\x20%s','message','result','catch','CreateSmsMessage','SmsMessage','options','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./smsMessage.socket','register'];(function(_0x4f3f71,_0x1e35ce){var _0x559c25=function(_0x1d874e){while(--_0x1d874e){_0x4f3f71['push'](_0x4f3f71['shift']());}};_0x559c25(++_0x1e35ce);}(_0xb984,0xca));var _0x4b98=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0xb984[_0x187ee1];return _0x388160;};'use strict';var _=require(_0x4b98('0x0'));var util=require(_0x4b98('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x4b98('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4b98('0x3'))['db'];var utils=require(_0x4b98('0x4'));var logger=require(_0x4b98('0x5'))('rpc');var config=require(_0x4b98('0x6'));var jayson=require(_0x4b98('0x7'));var client=jayson[_0x4b98('0x8')][_0x4b98('0x9')]({'port':0x232a});config[_0x4b98('0xa')]=_[_0x4b98('0xb')](config['redis'],{'host':_0x4b98('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x4b98('0xd'))[_0x4b98('0xe')](socket);function respondWithRpcPromise(_0x23c109,_0x3860d6,_0x5e0fc7){return new BPromise(function(_0x36e940,_0x3a89d5){return client[_0x4b98('0xf')](_0x23c109,_0x5e0fc7)[_0x4b98('0x10')](function(_0x46ddda){logger[_0x4b98('0x11')]('SmsMessage,\x20%s,\x20%s',_0x3860d6,_0x4b98('0x12'));logger[_0x4b98('0x13')](_0x4b98('0x14'),_0x3860d6,_0x4b98('0x12'),JSON[_0x4b98('0x15')](_0x46ddda));if(_0x46ddda[_0x4b98('0x16')]){if(_0x46ddda[_0x4b98('0x16')][_0x4b98('0x17')]===0x1f4){logger[_0x4b98('0x16')](_0x4b98('0x18'),_0x3860d6,_0x46ddda['error'][_0x4b98('0x19')]);return _0x3a89d5(_0x46ddda[_0x4b98('0x16')][_0x4b98('0x19')]);}logger[_0x4b98('0x16')](_0x4b98('0x18'),_0x3860d6,_0x46ddda[_0x4b98('0x16')][_0x4b98('0x19')]);return _0x36e940(_0x46ddda[_0x4b98('0x16')][_0x4b98('0x19')]);}else{logger['info'](_0x4b98('0x18'),_0x3860d6,_0x4b98('0x12'));_0x36e940(_0x46ddda[_0x4b98('0x1a')]['message']);}})[_0x4b98('0x1b')](function(_0x3faefa){logger['error'](_0x4b98('0x18'),_0x3860d6,_0x3faefa);_0x3a89d5(_0x3faefa);});});}exports[_0x4b98('0x1c')]=function(_0x3b3476){var _0x122a86=this;return new Promise(function(_0x2fba74,_0xeff60b){return db[_0x4b98('0x1d')]['create'](_0x3b3476['body'],{'raw':_0x3b3476[_0x4b98('0x1e')]?_0x3b3476[_0x4b98('0x1e')]['raw']===undefined?!![]:![]:!![]})[_0x4b98('0x10')](function(_0x322fc1){logger[_0x4b98('0x11')](_0x4b98('0x1c'),_0x3b3476);logger[_0x4b98('0x13')](_0x4b98('0x1c'),_0x3b3476,JSON[_0x4b98('0x15')](_0x322fc1));_0x2fba74(_0x322fc1);})[_0x4b98('0x1b')](function(_0x9f65b1){logger['error'](_0x4b98('0x1c'),_0x9f65b1['message'],_0x3b3476);_0xeff60b(_0x122a86[_0x4b98('0x16')](0x1f4,_0x9f65b1[_0x4b98('0x19')]));});});}; \ No newline at end of file +var _0xd8b6=['../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./smsMessage.socket','register','request','then','SmsMessage,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','CreateSmsMessage','create','body','options','raw','debug','lodash','util','moment','bluebird','../../config/utils','../../config/logger','rpc'];(function(_0x4955e8,_0x9002c3){var _0x21a681=function(_0x253841){while(--_0x253841){_0x4955e8['push'](_0x4955e8['shift']());}};_0x21a681(++_0x9002c3);}(_0xd8b6,0x1b9));var _0x6d8b=function(_0x43eecb,_0x4727aa){_0x43eecb=_0x43eecb-0x0;var _0x3a27af=_0xd8b6[_0x43eecb];return _0x3a27af;};'use strict';var _=require(_0x6d8b('0x0'));var util=require(_0x6d8b('0x1'));var moment=require(_0x6d8b('0x2'));var BPromise=require(_0x6d8b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x6d8b('0x4'));var logger=require(_0x6d8b('0x5'))(_0x6d8b('0x6'));var config=require(_0x6d8b('0x7'));var jayson=require(_0x6d8b('0x8'));var client=jayson[_0x6d8b('0x9')][_0x6d8b('0xa')]({'port':0x232a});config[_0x6d8b('0xb')]=_[_0x6d8b('0xc')](config['redis'],{'host':_0x6d8b('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6d8b('0xb')]));require(_0x6d8b('0xe'))[_0x6d8b('0xf')](socket);function respondWithRpcPromise(_0x411abd,_0x25de92,_0xf10bcc){return new BPromise(function(_0x58cfc3,_0x3230f6){return client[_0x6d8b('0x10')](_0x411abd,_0xf10bcc)[_0x6d8b('0x11')](function(_0x4970c7){logger['info'](_0x6d8b('0x12'),_0x25de92,_0x6d8b('0x13'));logger['debug']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x25de92,_0x6d8b('0x13'),JSON[_0x6d8b('0x14')](_0x4970c7));if(_0x4970c7[_0x6d8b('0x15')]){if(_0x4970c7['error']['code']===0x1f4){logger['error']('SmsMessage,\x20%s,\x20%s',_0x25de92,_0x4970c7[_0x6d8b('0x15')][_0x6d8b('0x16')]);return _0x3230f6(_0x4970c7[_0x6d8b('0x15')]['message']);}logger[_0x6d8b('0x15')](_0x6d8b('0x12'),_0x25de92,_0x4970c7[_0x6d8b('0x15')][_0x6d8b('0x16')]);return _0x58cfc3(_0x4970c7[_0x6d8b('0x15')][_0x6d8b('0x16')]);}else{logger[_0x6d8b('0x17')](_0x6d8b('0x12'),_0x25de92,'request\x20sent');_0x58cfc3(_0x4970c7[_0x6d8b('0x18')]['message']);}})[_0x6d8b('0x19')](function(_0x13cb64){logger['error']('SmsMessage,\x20%s,\x20%s',_0x25de92,_0x13cb64);_0x3230f6(_0x13cb64);});});}exports[_0x6d8b('0x1a')]=function(_0x50d0b0){var _0x1d3b28=this;return new Promise(function(_0x1987fb,_0x4b4b27){return db['SmsMessage'][_0x6d8b('0x1b')](_0x50d0b0[_0x6d8b('0x1c')],{'raw':_0x50d0b0[_0x6d8b('0x1d')]?_0x50d0b0[_0x6d8b('0x1d')][_0x6d8b('0x1e')]===undefined?!![]:![]:!![]})[_0x6d8b('0x11')](function(_0x1ee432){logger['info'](_0x6d8b('0x1a'),_0x50d0b0);logger[_0x6d8b('0x1f')](_0x6d8b('0x1a'),_0x50d0b0,JSON['stringify'](_0x1ee432));_0x1987fb(_0x1ee432);})[_0x6d8b('0x19')](function(_0x28f789){logger[_0x6d8b('0x15')](_0x6d8b('0x1a'),_0x28f789[_0x6d8b('0x16')],_0x50d0b0);_0x4b4b27(_0x1d3b28[_0x6d8b('0x15')](0x1f4,_0x28f789[_0x6d8b('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index beb6d6d..990f603 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 _0x00a1=['save','remove','update','register','length','smsMessage:','./smsMessage.events'];(function(_0x443acf,_0x5b5274){var _0x46877e=function(_0x3eb192){while(--_0x3eb192){_0x443acf['push'](_0x443acf['shift']());}};_0x46877e(++_0x5b5274);}(_0x00a1,0x1bf));var _0x100a=function(_0x181080,_0x544018){_0x181080=_0x181080-0x0;var _0x3ae061=_0x00a1[_0x181080];return _0x3ae061;};'use strict';var SmsMessageEvents=require(_0x100a('0x0'));var events=[_0x100a('0x1'),_0x100a('0x2'),_0x100a('0x3')];function createListener(_0x2c58ff,_0x1d2b7f){return function(_0x2b8c02){_0x1d2b7f['emit'](_0x2c58ff,_0x2b8c02);};}function removeListener(_0x11b194,_0x23d163){return function(){SmsMessageEvents['removeListener'](_0x11b194,_0x23d163);};}exports[_0x100a('0x4')]=function(_0x1e12b3){for(var _0x222946=0x0,_0x391e33=events[_0x100a('0x5')];_0x222946<_0x391e33;_0x222946++){var _0x5c2f33=events[_0x222946];var _0xdff0ba=createListener(_0x100a('0x6')+_0x5c2f33,_0x1e12b3);SmsMessageEvents['on'](_0x5c2f33,_0xdff0ba);}}; \ No newline at end of file +var _0x657d=['removeListener','register','length','smsMessage:','./smsMessage.events','save','remove','update','emit'];(function(_0x3a96b9,_0x1c1881){var _0x175e80=function(_0x1cdb49){while(--_0x1cdb49){_0x3a96b9['push'](_0x3a96b9['shift']());}};_0x175e80(++_0x1c1881);}(_0x657d,0x1ab));var _0xd657=function(_0x4fe19c,_0x45d0fe){_0x4fe19c=_0x4fe19c-0x0;var _0x952ac7=_0x657d[_0x4fe19c];return _0x952ac7;};'use strict';var SmsMessageEvents=require(_0xd657('0x0'));var events=[_0xd657('0x1'),_0xd657('0x2'),_0xd657('0x3')];function createListener(_0x48ba28,_0x199e5a){return function(_0x4887c7){_0x199e5a[_0xd657('0x4')](_0x48ba28,_0x4887c7);};}function removeListener(_0x5109a4,_0x506045){return function(){SmsMessageEvents[_0xd657('0x5')](_0x5109a4,_0x506045);};}exports[_0xd657('0x6')]=function(_0x24cc1c){for(var _0x1feb19=0x0,_0x48ed23=events[_0xd657('0x7')];_0x1feb19<_0x48ed23;_0x1feb19++){var _0x51d4f7=events[_0x1feb19];var _0x227741=createListener(_0xd657('0x8')+_0x51d4f7,_0x24cc1c);SmsMessageEvents['on'](_0x51d4f7,_0x227741);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index 18ea72f..c245283 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 _0x7b93=['/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','post','create','put','update','destroy','removeAgents','multer','util','path','connect-timeout','Router','../../components/auth/service','./smsQueue.controller','get','/describe','isAuthenticated','describe'];(function(_0x3b20c2,_0x888661){var _0x5b4482=function(_0x15b274){while(--_0x15b274){_0x3b20c2['push'](_0x3b20c2['shift']());}};_0x5b4482(++_0x888661);}(_0x7b93,0x1bd));var _0x37b9=function(_0x4c6b93,_0x19880d){_0x4c6b93=_0x4c6b93-0x0;var _0x119770=_0x7b93[_0x4c6b93];return _0x119770;};'use strict';var multer=require(_0x37b9('0x0'));var util=require(_0x37b9('0x1'));var path=require(_0x37b9('0x2'));var timeout=require(_0x37b9('0x3'));var express=require('express');var router=express[_0x37b9('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x37b9('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x37b9('0x6'));router[_0x37b9('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x37b9('0x7')](_0x37b9('0x8'),auth[_0x37b9('0x9')](),controller[_0x37b9('0xa')]);router[_0x37b9('0x7')](_0x37b9('0xb'),auth[_0x37b9('0x9')](),controller[_0x37b9('0xc')]);router[_0x37b9('0x7')](_0x37b9('0xd'),auth[_0x37b9('0x9')](),controller[_0x37b9('0xe')]);router['get'](_0x37b9('0xf'),auth['isAuthenticated'](),controller[_0x37b9('0x10')]);router[_0x37b9('0x7')](_0x37b9('0x11'),auth[_0x37b9('0x9')](),controller['getAgents']);router[_0x37b9('0x12')]('/',auth[_0x37b9('0x9')](),controller[_0x37b9('0x13')]);router[_0x37b9('0x12')](_0x37b9('0xf'),auth[_0x37b9('0x9')](),controller['addTeams']);router['post'](_0x37b9('0x11'),auth['isAuthenticated'](),controller['addAgents']);router[_0x37b9('0x14')](_0x37b9('0xb'),auth['isAuthenticated'](),controller[_0x37b9('0x15')]);router['delete'](_0x37b9('0xb'),auth['isAuthenticated'](),controller[_0x37b9('0x16')]);router['delete'](_0x37b9('0xf'),auth['isAuthenticated'](),controller['removeTeams']);router['delete'](_0x37b9('0x11'),auth[_0x37b9('0x9')](),controller[_0x37b9('0x17')]);module['exports']=router; \ No newline at end of file +var _0x0d4c=['Router','../../components/auth/service','../../config/environment','./smsQueue.controller','get','index','/describe','isAuthenticated','/:id','show','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','update','delete','destroy','removeTeams','removeAgents','exports','util','path','connect-timeout'];(function(_0x191d67,_0x17fe35){var _0x5e2fec=function(_0x43ecf2){while(--_0x43ecf2){_0x191d67['push'](_0x191d67['shift']());}};_0x5e2fec(++_0x17fe35);}(_0x0d4c,0x102));var _0xc0d4=function(_0x19d75b,_0x1352bf){_0x19d75b=_0x19d75b-0x0;var _0x1d27a2=_0x0d4c[_0x19d75b];return _0x1d27a2;};'use strict';var multer=require('multer');var util=require(_0xc0d4('0x0'));var path=require(_0xc0d4('0x1'));var timeout=require(_0xc0d4('0x2'));var express=require('express');var router=express[_0xc0d4('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xc0d4('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xc0d4('0x5'));var controller=require(_0xc0d4('0x6'));router[_0xc0d4('0x7')]('/',auth['isAuthenticated'](),controller[_0xc0d4('0x8')]);router[_0xc0d4('0x7')](_0xc0d4('0x9'),auth[_0xc0d4('0xa')](),controller['describe']);router[_0xc0d4('0x7')](_0xc0d4('0xb'),auth[_0xc0d4('0xa')](),controller[_0xc0d4('0xc')]);router['get']('/:id/members',auth[_0xc0d4('0xa')](),controller[_0xc0d4('0xd')]);router['get'](_0xc0d4('0xe'),auth[_0xc0d4('0xa')](),controller[_0xc0d4('0xf')]);router[_0xc0d4('0x7')](_0xc0d4('0x10'),auth[_0xc0d4('0xa')](),controller[_0xc0d4('0x11')]);router[_0xc0d4('0x12')]('/',auth[_0xc0d4('0xa')](),controller[_0xc0d4('0x13')]);router['post'](_0xc0d4('0xe'),auth[_0xc0d4('0xa')](),controller[_0xc0d4('0x14')]);router[_0xc0d4('0x12')](_0xc0d4('0x10'),auth['isAuthenticated'](),controller[_0xc0d4('0x15')]);router[_0xc0d4('0x16')](_0xc0d4('0xb'),auth[_0xc0d4('0xa')](),controller[_0xc0d4('0x17')]);router[_0xc0d4('0x18')](_0xc0d4('0xb'),auth[_0xc0d4('0xa')](),controller[_0xc0d4('0x19')]);router[_0xc0d4('0x18')](_0xc0d4('0xe'),auth[_0xc0d4('0xa')](),controller[_0xc0d4('0x1a')]);router[_0xc0d4('0x18')](_0xc0d4('0x10'),auth[_0xc0d4('0xa')](),controller[_0xc0d4('0x1b')]);module[_0xc0d4('0x1c')]=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index 782cdf6..5bb350c 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 _0x0a61=['rrmemory','beepall','exports','STRING','name','INTEGER','ENUM'];(function(_0x888385,_0x9cdc66){var _0x22d5c2=function(_0x3b1599){while(--_0x3b1599){_0x888385['push'](_0x888385['shift']());}};_0x22d5c2(++_0x9cdc66);}(_0x0a61,0x19f));var _0x10a6=function(_0x5b1d40,_0x4c610e){_0x5b1d40=_0x5b1d40-0x0;var _0x34c015=_0x0a61[_0x5b1d40];return _0x34c015;};'use strict';var Sequelize=require('sequelize');module[_0x10a6('0x0')]={'name':{'type':Sequelize[_0x10a6('0x1')],'unique':_0x10a6('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x10a6('0x1')]},'timeout':{'type':Sequelize[_0x10a6('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x10a6('0x4')](_0x10a6('0x5'),_0x10a6('0x6'),'roundrobin')}}; \ No newline at end of file +var _0x1c98=['rrmemory','roundrobin','sequelize','exports','name','STRING','INTEGER'];(function(_0x30a31e,_0x31f766){var _0x170879=function(_0x313ee7){while(--_0x313ee7){_0x30a31e['push'](_0x30a31e['shift']());}};_0x170879(++_0x31f766);}(_0x1c98,0xaa));var _0x81c9=function(_0x1a6f70,_0x14ac6e){_0x1a6f70=_0x1a6f70-0x0;var _0x78ccb9=_0x1c98[_0x1a6f70];return _0x78ccb9;};'use strict';var Sequelize=require(_0x81c9('0x0'));module[_0x81c9('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x81c9('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x81c9('0x3')]},'timeout':{'type':Sequelize[_0x81c9('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x81c9('0x5'),'beepall',_0x81c9('0x6'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index f9c0f0d..1e1fa6c 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 _0x2e72=['reject','save','update','get','SmsQueues','UserProfileResource','destroy','then','sendStatus','error','stack','name','send','index','SmsQueue','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','options','includeAll','findAll','rows','catch','show','filters','include','merge','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','params','describe','getMembers','findOne','nolimit','SmsQueueId','User','findAndCountAll','UserId','agent','smsPause','updatedAt','format','%s/%s','SIP','createdAt','getTeams','Team','online','voicePause','interface','Agents','transaction','addTeams','each','UserSmsQueue','findOrCreate','forEach','emit','removeTeams','ids','select','tq.TeamId','team_has_sms_queues','join','ut.TeamId\x20=\x20tq.TeamId','clone','push','sequelize','QueryTypes','TeamId','includes','compact','value','isEmpty','addAgents','omit','spread','userSmsQueue:save','removeAgents','isArray','userSmsQueue:remove','getAgents','eml-format','rimraf','request-promise','moment','bluebird','util','path','sox','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','end','status','offset','undefined','limit','count','json','apply'];(function(_0x192f74,_0x4f2a71){var _0x1056d1=function(_0x4acf3a){while(--_0x4acf3a){_0x192f74['push'](_0x192f74['shift']());}};_0x1056d1(++_0x4f2a71);}(_0x2e72,0x68));var _0x22e7=function(_0x152aa1,_0x307718){_0x152aa1=_0x152aa1-0x0;var _0x1bc01a=_0x2e72[_0x152aa1];return _0x1bc01a;};'use strict';var emlformat=require(_0x22e7('0x0'));var rimraf=require(_0x22e7('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x22e7('0x2'));var moment=require(_0x22e7('0x3'));var BPromise=require(_0x22e7('0x4'));var Mustache=require('mustache');var util=require(_0x22e7('0x5'));var path=require(_0x22e7('0x6'));var sox=require(_0x22e7('0x7'));var csv=require('to-csv');var ejs=require(_0x22e7('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x22e7('0x9'));var squel=require(_0x22e7('0xa'));var crypto=require(_0x22e7('0xb'));var jsforce=require(_0x22e7('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x22e7('0xd'));var querystring=require(_0x22e7('0xe'));var Papa=require(_0x22e7('0xf'));var Redis=require(_0x22e7('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x22e7('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x22e7('0x12'))('api');var utils=require(_0x22e7('0x13'));var config=require(_0x22e7('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x22e7('0x15'))['db'];config[_0x22e7('0x16')]=_[_0x22e7('0x17')](config[_0x22e7('0x16')],{'host':_0x22e7('0x18'),'port':0x18eb});var socket=require(_0x22e7('0x19'))(new Redis(config[_0x22e7('0x16')]));require(_0x22e7('0x1a'))['register'](socket);function respondWithStatusCode(_0x3a8fb2,_0x2bc759){_0x2bc759=_0x2bc759||0xcc;return function(_0x111420){if(_0x111420){return _0x3a8fb2['sendStatus'](_0x2bc759);}return _0x3a8fb2['status'](_0x2bc759)[_0x22e7('0x1b')]();};}function respondWithResult(_0x2520a2,_0x2482a1){_0x2482a1=_0x2482a1||0xc8;return function(_0x5af385){if(_0x5af385){return _0x2520a2[_0x22e7('0x1c')](_0x2482a1)['json'](_0x5af385);}};}function respondWithFilteredResult(_0x25d3bf,_0x4b187b){return function(_0x1a5f1c){if(_0x1a5f1c){var _0x3c694d=typeof _0x4b187b[_0x22e7('0x1d')]===_0x22e7('0x1e')&&typeof _0x4b187b[_0x22e7('0x1f')]===_0x22e7('0x1e');var _0x5ccc45=_0x1a5f1c[_0x22e7('0x20')];var _0x30d5d0=_0x3c694d?0x0:_0x4b187b[_0x22e7('0x1d')];var _0x22d862=_0x3c694d?_0x1a5f1c[_0x22e7('0x20')]:_0x4b187b[_0x22e7('0x1d')]+_0x4b187b[_0x22e7('0x1f')];var _0x464891;if(_0x22d862>=_0x5ccc45){_0x22d862=_0x5ccc45;_0x464891=0xc8;}else{_0x464891=0xce;}_0x25d3bf[_0x22e7('0x1c')](_0x464891);return _0x25d3bf['set']('Content-Range',_0x30d5d0+'-'+_0x22d862+'/'+_0x5ccc45)[_0x22e7('0x21')](_0x1a5f1c);}return null;};}function patchUpdates(_0xd9dc6){return function(_0x300639){try{jsonpatch[_0x22e7('0x22')](_0x300639,_0xd9dc6,!![]);}catch(_0x340714){return BPromise[_0x22e7('0x23')](_0x340714);}return _0x300639[_0x22e7('0x24')]();};}function saveUpdates(_0x27b23b,_0x8df1d0){return function(_0x2226f5){if(_0x2226f5){return _0x2226f5[_0x22e7('0x25')](_0x27b23b)['then'](function(_0x4077d4){return _0x4077d4;});}return null;};}function removeEntity(_0x9025c3,_0x240fb5){return function(_0x470ea8){if(_0x470ea8){return _0x470ea8['destroy']()['then'](function(){var _0x285333=_0x470ea8[_0x22e7('0x26')]({'plain':!![]});var _0x26a5c3=_0x22e7('0x27');return db[_0x22e7('0x28')][_0x22e7('0x29')]({'where':{'type':_0x26a5c3,'resourceId':_0x285333['id']}})[_0x22e7('0x2a')](function(){return _0x470ea8;});})[_0x22e7('0x2a')](function(){_0x9025c3[_0x22e7('0x1c')](0xcc)[_0x22e7('0x1b')]();});}};}function handleEntityNotFound(_0x4a69e7,_0x11e3e9){return function(_0x3f4edc){if(!_0x3f4edc){_0x4a69e7[_0x22e7('0x2b')](0x194);}return _0x3f4edc;};}function handleError(_0x517d51,_0x175cc0){_0x175cc0=_0x175cc0||0x1f4;return function(_0x282f04){logger[_0x22e7('0x2c')](_0x282f04[_0x22e7('0x2d')]);if(_0x282f04['name']){delete _0x282f04[_0x22e7('0x2e')];}_0x517d51[_0x22e7('0x1c')](_0x175cc0)[_0x22e7('0x2f')](_0x282f04);};}exports[_0x22e7('0x30')]=function(_0xd413d6,_0xafdd05){var _0x591e2d={},_0xecce96={},_0x12ea6f={'count':0x0,'rows':[]};var _0x1ad05b=_['map'](db[_0x22e7('0x31')][_0x22e7('0x32')],function(_0xe00c02){return{'name':_0xe00c02[_0x22e7('0x33')],'type':_0xe00c02[_0x22e7('0x34')][_0x22e7('0x35')]};});_0xecce96[_0x22e7('0x36')]=_[_0x22e7('0x37')](_0x1ad05b,'name');_0xecce96[_0x22e7('0x38')]=_[_0x22e7('0x39')](_0xd413d6[_0x22e7('0x38')]);_0xecce96['filters']=_[_0x22e7('0x3a')](_0xecce96['model'],_0xecce96[_0x22e7('0x38')]);_0x591e2d[_0x22e7('0x3b')]=_[_0x22e7('0x3a')](_0xecce96[_0x22e7('0x36')],qs[_0x22e7('0x3c')](_0xd413d6[_0x22e7('0x38')][_0x22e7('0x3c')]));_0x591e2d[_0x22e7('0x3b')]=_0x591e2d[_0x22e7('0x3b')][_0x22e7('0x3d')]?_0x591e2d[_0x22e7('0x3b')]:_0xecce96[_0x22e7('0x36')];if(!_0xd413d6['query'][_0x22e7('0x3e')]('nolimit')){_0x591e2d[_0x22e7('0x1f')]=qs[_0x22e7('0x1f')](_0xd413d6['query']['limit']);_0x591e2d['offset']=qs[_0x22e7('0x1d')](_0xd413d6[_0x22e7('0x38')]['offset']);}_0x591e2d[_0x22e7('0x3f')]=qs[_0x22e7('0x40')](_0xd413d6[_0x22e7('0x38')][_0x22e7('0x40')]);_0x591e2d[_0x22e7('0x41')]=qs['filters'](_[_0x22e7('0x42')](_0xd413d6['query'],_0xecce96['filters']),_0x1ad05b);if(_0xd413d6[_0x22e7('0x38')][_0x22e7('0x43')]){_0x591e2d['where']=_['merge'](_0x591e2d[_0x22e7('0x41')],{'$or':_[_0x22e7('0x37')](_0x1ad05b,function(_0x315029){if(_0x315029[_0x22e7('0x34')]!==_0x22e7('0x44')){var _0x488fbf={};_0x488fbf[_0x315029[_0x22e7('0x2e')]]={'$like':'%'+_0xd413d6[_0x22e7('0x38')]['filter']+'%'};return _0x488fbf;}})});}_0x591e2d=_['merge']({},_0x591e2d,_0xd413d6[_0x22e7('0x45')]);var _0x1db09e={'where':_0x591e2d[_0x22e7('0x41')]};return db[_0x22e7('0x31')][_0x22e7('0x20')](_0x1db09e)[_0x22e7('0x2a')](function(_0xb097c2){_0x12ea6f[_0x22e7('0x20')]=_0xb097c2;if(_0xd413d6[_0x22e7('0x38')][_0x22e7('0x46')]){_0x591e2d['include']=[{'all':!![]}];}return db[_0x22e7('0x31')][_0x22e7('0x47')](_0x591e2d);})[_0x22e7('0x2a')](function(_0x4f9d67){_0x12ea6f[_0x22e7('0x48')]=_0x4f9d67;return _0x12ea6f;})[_0x22e7('0x2a')](respondWithFilteredResult(_0xafdd05,_0x591e2d))[_0x22e7('0x49')](handleError(_0xafdd05,null));};exports[_0x22e7('0x4a')]=function(_0x1abb2e,_0x306881){var _0xf931e4={'raw':!![],'where':{'id':_0x1abb2e['params']['id']}},_0x537c46={};_0x537c46['model']=_['keys'](db[_0x22e7('0x31')][_0x22e7('0x32')]);_0x537c46[_0x22e7('0x38')]=_[_0x22e7('0x39')](_0x1abb2e[_0x22e7('0x38')]);_0x537c46[_0x22e7('0x4b')]=_[_0x22e7('0x3a')](_0x537c46[_0x22e7('0x36')],_0x537c46[_0x22e7('0x38')]);_0xf931e4[_0x22e7('0x3b')]=_['intersection'](_0x537c46[_0x22e7('0x36')],qs[_0x22e7('0x3c')](_0x1abb2e[_0x22e7('0x38')][_0x22e7('0x3c')]));_0xf931e4[_0x22e7('0x3b')]=_0xf931e4[_0x22e7('0x3b')]['length']?_0xf931e4[_0x22e7('0x3b')]:_0x537c46[_0x22e7('0x36')];if(_0x1abb2e[_0x22e7('0x38')][_0x22e7('0x46')]){_0xf931e4[_0x22e7('0x4c')]=[{'all':!![]}];}_0xf931e4=_[_0x22e7('0x4d')]({},_0xf931e4,_0x1abb2e[_0x22e7('0x45')]);return db['SmsQueue'][_0x22e7('0x4e')](_0xf931e4)[_0x22e7('0x2a')](handleEntityNotFound(_0x306881,null))[_0x22e7('0x2a')](respondWithResult(_0x306881,null))[_0x22e7('0x49')](handleError(_0x306881,null));};exports[_0x22e7('0x4f')]=function(_0x766c5e,_0x49bc74){return db[_0x22e7('0x31')][_0x22e7('0x4f')](_0x766c5e[_0x22e7('0x50')],{})[_0x22e7('0x2a')](function(_0x1aa861){var _0x379d5c=_0x766c5e[_0x22e7('0x51')][_0x22e7('0x26')]({'plain':!![]});if(!_0x379d5c)throw new Error(_0x22e7('0x52'));if(_0x379d5c[_0x22e7('0x53')]===_0x22e7('0x51')){var _0x60a004=_0x1aa861[_0x22e7('0x26')]({'plain':!![]});var _0x28175f=_0x22e7('0x27');return db['UserProfileSection']['find']({'where':{'name':_0x28175f,'userProfileId':_0x379d5c[_0x22e7('0x54')]},'raw':!![]})[_0x22e7('0x2a')](function(_0x2471ba){if(_0x2471ba&&_0x2471ba[_0x22e7('0x55')]===0x0){return db[_0x22e7('0x28')][_0x22e7('0x4f')]({'name':_0x60a004[_0x22e7('0x2e')],'resourceId':_0x60a004['id'],'type':_0x2471ba[_0x22e7('0x2e')],'sectionId':_0x2471ba['id']},{})[_0x22e7('0x2a')](function(){return _0x1aa861;});}else{return _0x1aa861;}})[_0x22e7('0x49')](function(_0x364ace){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x364ace);throw _0x364ace;});}return _0x1aa861;})[_0x22e7('0x2a')](respondWithResult(_0x49bc74,0xc9))['catch'](handleError(_0x49bc74,null));};exports[_0x22e7('0x25')]=function(_0x29906c,_0x593933){if(_0x29906c[_0x22e7('0x50')]['id']){delete _0x29906c['body']['id'];}return db[_0x22e7('0x31')][_0x22e7('0x4e')]({'where':{'id':_0x29906c[_0x22e7('0x56')]['id']}})[_0x22e7('0x2a')](handleEntityNotFound(_0x593933,null))['then'](saveUpdates(_0x29906c['body'],null))[_0x22e7('0x2a')](respondWithResult(_0x593933,null))[_0x22e7('0x49')](handleError(_0x593933,null));};exports[_0x22e7('0x29')]=function(_0x1fd09d,_0x1214b2){return db[_0x22e7('0x31')][_0x22e7('0x4e')]({'where':{'id':_0x1fd09d[_0x22e7('0x56')]['id']}})[_0x22e7('0x2a')](handleEntityNotFound(_0x1214b2,null))[_0x22e7('0x2a')](removeEntity(_0x1214b2,null))[_0x22e7('0x49')](handleError(_0x1214b2,null));};exports[_0x22e7('0x57')]=function(_0xb1d756,_0x2637a3){return db[_0x22e7('0x31')][_0x22e7('0x57')]()[_0x22e7('0x2a')](respondWithResult(_0x2637a3,null))['catch'](handleError(_0x2637a3,null));};exports[_0x22e7('0x58')]=function(_0x4efbf6,_0x25306f,_0x26655f){var _0xf878c6={'raw':!![],'where':{}},_0x5a51bf={},_0x543a5d;return db[_0x22e7('0x31')][_0x22e7('0x59')]({'where':{'id':_0x4efbf6[_0x22e7('0x56')]['id']}})[_0x22e7('0x2a')](handleEntityNotFound(_0x25306f,null))[_0x22e7('0x2a')](function(_0x55ba69){if(_0x55ba69){_0x543a5d=_0x55ba69['get']({'plain':!![]});_0x5a51bf[_0x22e7('0x36')]=_[_0x22e7('0x39')](db['UserSmsQueue'][_0x22e7('0x32')]);_0x5a51bf[_0x22e7('0x38')]=_['keys'](_0x4efbf6[_0x22e7('0x38')]);_0x5a51bf[_0x22e7('0x4b')]=_[_0x22e7('0x3a')](_0x5a51bf[_0x22e7('0x36')],_0x5a51bf[_0x22e7('0x38')]);_0xf878c6[_0x22e7('0x3b')]=_['intersection'](_0x5a51bf['model'],qs[_0x22e7('0x3c')](_0x4efbf6[_0x22e7('0x38')][_0x22e7('0x3c')]));_0xf878c6[_0x22e7('0x3b')]=_0xf878c6[_0x22e7('0x3b')]['length']?_0xf878c6[_0x22e7('0x3b')]:_0x5a51bf['model'];if(!_0x4efbf6['query'][_0x22e7('0x3e')](_0x22e7('0x5a'))){_0xf878c6[_0x22e7('0x1f')]=qs['limit'](_0x4efbf6[_0x22e7('0x38')][_0x22e7('0x1f')]);_0xf878c6[_0x22e7('0x1d')]=qs[_0x22e7('0x1d')](_0x4efbf6[_0x22e7('0x38')][_0x22e7('0x1d')]);}_0xf878c6[_0x22e7('0x3f')]=qs[_0x22e7('0x40')](_0x4efbf6['query'][_0x22e7('0x40')]);_0xf878c6[_0x22e7('0x41')]=qs['filters'](_[_0x22e7('0x42')](_0x4efbf6[_0x22e7('0x38')],_0x5a51bf[_0x22e7('0x4b')]));_0xf878c6[_0x22e7('0x41')][_0x22e7('0x5b')]=_0x55ba69['id'];if(_0x4efbf6[_0x22e7('0x38')]['filter']){_0xf878c6['where']=_[_0x22e7('0x4d')](_0xf878c6[_0x22e7('0x41')],{'$or':_['map'](_0xf878c6[_0x22e7('0x3b')],function(_0x3ddfb8){var _0x32858a={};_0x32858a[_0x3ddfb8]={'$like':'%'+_0x4efbf6[_0x22e7('0x38')][_0x22e7('0x43')]+'%'};return _0x32858a;})});}_0xf878c6=_[_0x22e7('0x4d')]({},_0xf878c6,_0x4efbf6[_0x22e7('0x45')]);return db['UserSmsQueue'][_0x22e7('0x47')](_0xf878c6);}})[_0x22e7('0x2a')](function(_0x34b702){if(_0x34b702){return db[_0x22e7('0x5c')][_0x22e7('0x5d')]({'where':{'id':_[_0x22e7('0x37')](_0x34b702,_0x22e7('0x5e')),'role':_0x22e7('0x5f')},'attributes':['id',_0x22e7('0x2e'),_0x22e7('0x60'),_0x22e7('0x61'),'createdAt']});}})['then'](function(_0x1ba945){if(_0x1ba945){return{'count':_0x1ba945['count'],'rows':_[_0x22e7('0x37')](_0x1ba945[_0x22e7('0x48')],function(_0x2daf4c){return{'membername':_0x2daf4c[_0x22e7('0x2e')],'UserId':_0x2daf4c['id'],'queue_name':_0x543a5d[_0x22e7('0x2e')],'SmsQueueId':_0x543a5d['id'],'interface':util[_0x22e7('0x62')](_0x22e7('0x63'),_0x22e7('0x64'),_0x2daf4c['name']),'penalty':0x0,'paused':_0x2daf4c['smsPause'],'createdAt':_0x2daf4c[_0x22e7('0x65')],'updatedAt':_0x2daf4c[_0x22e7('0x61')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x22e7('0x2a')](respondWithFilteredResult(_0x25306f,_0xf878c6))['catch'](handleError(_0x25306f,null));};exports[_0x22e7('0x66')]=function(_0x503da2,_0x4198f2,_0x4af3a1){var _0x56a6bb={};var _0x135f40={};var _0x30cc8d;var _0x4bf3da;return db['SmsQueue'][_0x22e7('0x59')]({'where':{'id':_0x503da2[_0x22e7('0x56')]['id']}})['then'](handleEntityNotFound(_0x4198f2,null))[_0x22e7('0x2a')](function(_0x3cc6cf){if(_0x3cc6cf){_0x30cc8d=_0x3cc6cf;_0x135f40[_0x22e7('0x36')]=_[_0x22e7('0x39')](db[_0x22e7('0x67')][_0x22e7('0x32')]);_0x135f40[_0x22e7('0x38')]=_[_0x22e7('0x39')](_0x503da2[_0x22e7('0x38')]);_0x135f40[_0x22e7('0x4b')]=_[_0x22e7('0x3a')](_0x135f40['model'],_0x135f40[_0x22e7('0x38')]);_0x56a6bb[_0x22e7('0x3b')]=_[_0x22e7('0x3a')](_0x135f40[_0x22e7('0x36')],qs['fields'](_0x503da2[_0x22e7('0x38')][_0x22e7('0x3c')]));_0x56a6bb[_0x22e7('0x3b')]=_0x56a6bb[_0x22e7('0x3b')][_0x22e7('0x3d')]?_0x56a6bb['attributes']:_0x135f40[_0x22e7('0x36')];_0x56a6bb[_0x22e7('0x3f')]=qs[_0x22e7('0x40')](_0x503da2[_0x22e7('0x38')][_0x22e7('0x40')]);_0x56a6bb[_0x22e7('0x41')]=qs[_0x22e7('0x4b')](_['pick'](_0x503da2[_0x22e7('0x38')],_0x135f40['filters']));if(_0x503da2[_0x22e7('0x38')][_0x22e7('0x43')]){_0x56a6bb['where']=_['merge'](_0x56a6bb[_0x22e7('0x41')],{'$or':_['map'](_0x56a6bb['attributes'],function(_0x4aa4e5){var _0x37a158={};_0x37a158[_0x4aa4e5]={'$like':'%'+_0x503da2[_0x22e7('0x38')][_0x22e7('0x43')]+'%'};return _0x37a158;})});}_0x56a6bb=_[_0x22e7('0x4d')]({},_0x56a6bb,_0x503da2[_0x22e7('0x45')]);return _0x30cc8d[_0x22e7('0x66')](_0x56a6bb);}})[_0x22e7('0x2a')](function(_0x336fe5){if(_0x336fe5){_0x4bf3da=_0x336fe5[_0x22e7('0x3d')];if(!_0x503da2['query'][_0x22e7('0x3e')](_0x22e7('0x5a'))){_0x56a6bb[_0x22e7('0x1f')]=qs[_0x22e7('0x1f')](_0x503da2[_0x22e7('0x38')][_0x22e7('0x1f')]);_0x56a6bb[_0x22e7('0x1d')]=qs[_0x22e7('0x1d')](_0x503da2[_0x22e7('0x38')]['offset']);}return _0x30cc8d['getTeams'](_0x56a6bb);}})[_0x22e7('0x2a')](function(_0x4c50d7){if(_0x4c50d7){return _0x4c50d7?{'count':_0x4bf3da,'rows':_0x4c50d7}:null;}})[_0x22e7('0x2a')](respondWithResult(_0x4198f2,null))[_0x22e7('0x49')](handleError(_0x4198f2,null));};exports['addTeams']=function(_0x44425c,_0x12ff3d,_0xc4c24c){var _0x3c6723=_0x44425c[_0x22e7('0x50')]['ids'];return db[_0x22e7('0x67')][_0x22e7('0x47')]({'where':{'id':_0x3c6723},'attributes':['id'],'include':[{'model':db[_0x22e7('0x5c')],'as':'Agents','attributes':['id',_0x22e7('0x2e'),_0x22e7('0x68'),_0x22e7('0x69'),_0x22e7('0x6a')],'raw':!![]}]})[_0x22e7('0x2a')](function(_0x3c649e){if(_0x3c649e){var _0x477236=_['flatMap'](_0x3c649e,function(_0x49d37b){var _0x4eaf5a=_0x49d37b[_0x22e7('0x26')]({'plain':!![]});return _0x4eaf5a[_0x22e7('0x6b')];});return db[_0x22e7('0x31')][_0x22e7('0x4e')]({'where':{'id':_0x44425c[_0x22e7('0x56')]['id']}})[_0x22e7('0x2a')](function(_0x5736bd){return db['sequelize'][_0x22e7('0x6c')](function(_0x40de91){return _0x5736bd[_0x22e7('0x6d')](_0x3c6723,{'transaction':_0x40de91})[_0x22e7('0x2a')](function(){return BPromise[_0x22e7('0x6e')](_0x477236,function(_0x1c513f){return db[_0x22e7('0x6f')][_0x22e7('0x70')]({'where':{'UserId':_0x1c513f['id'],'SmsQueueId':_0x44425c[_0x22e7('0x56')]['id']},'transaction':_0x40de91});});})[_0x22e7('0x2a')](function(){_0x477236[_0x22e7('0x71')](function(_0xd645dc){socket[_0x22e7('0x72')]('userSmsQueue:save',{'UserId':_0xd645dc['id'],'SmsQueueId':_0x5736bd['id']});});});});});}})[_0x22e7('0x2a')](respondWithStatusCode(_0x12ff3d,null))[_0x22e7('0x49')](handleError(_0x12ff3d,null));};exports[_0x22e7('0x73')]=function(_0x575c16,_0x2e65cb,_0x202381){return db[_0x22e7('0x67')][_0x22e7('0x47')]({'where':{'id':_0x575c16[_0x22e7('0x38')][_0x22e7('0x74')]},'attributes':['id'],'include':[{'model':db[_0x22e7('0x5c')],'as':_0x22e7('0x6b'),'attributes':['id'],'raw':!![]}]})[_0x22e7('0x2a')](handleEntityNotFound(_0x2e65cb,null))[_0x22e7('0x2a')](function(_0x4e13a7){var _0x212b12=_[_0x22e7('0x37')](_0x4e13a7,'id');var _0x22625d=[];var _0x10138f=[];var _0x1c747c=squel[_0x22e7('0x75')]();_0x1c747c['field'](_0x22e7('0x76'))['from'](_0x22e7('0x77'),'tq')[_0x22e7('0x78')]('user_has_teams','ut',_0x22e7('0x79'))[_0x22e7('0x41')]('SmsQueueId\x20=\x20?',_0x575c16[_0x22e7('0x56')]['id']);for(var _0x116650=0x0;_0x116650<_0x4e13a7[_0x22e7('0x3d')];_0x116650+=0x1){let _0x340200=_0x4e13a7[_0x116650];for(var _0x106f41=0x0;_0x106f41<_0x340200[_0x22e7('0x6b')][_0x22e7('0x3d')];_0x106f41+=0x1){let _0x4ddda3=_0x340200[_0x22e7('0x6b')][_0x106f41];var _0xfbc8a8=_0x1c747c[_0x22e7('0x7a')]();_0xfbc8a8[_0x22e7('0x41')]('ut.UserId\x20=\x20?',_0x4ddda3['id']);_0x10138f[_0x22e7('0x7b')](db[_0x22e7('0x7c')][_0x22e7('0x38')](_0xfbc8a8['toString'](),{'type':db['sequelize'][_0x22e7('0x7d')]['SELECT']})[_0x22e7('0x2a')](function(_0x37cbfc){if(_0x37cbfc[_0x22e7('0x3d')]===0x1){return _0x4ddda3['id'];}else{var _0x18d92e=_['every'](_[_0x22e7('0x37')](_0x37cbfc,_0x22e7('0x7e')),function(_0x2c3bcf){return _[_0x22e7('0x7f')](_0x212b12,_0x2c3bcf);});if(_0x18d92e){return _0x4ddda3['id'];}}}));}}return BPromise['all'](_0x10138f)[_0x22e7('0x2a')](function(_0x31188f){_0x22625d=_(_0x22625d)['union'](_0x31188f)[_0x22e7('0x80')]()[_0x22e7('0x81')]();return db['SmsQueue']['find']({'where':{'id':_0x575c16[_0x22e7('0x56')]['id']}})[_0x22e7('0x2a')](function(_0x18cc94){return db[_0x22e7('0x7c')][_0x22e7('0x6c')](function(_0x18319a){return _0x18cc94[_0x22e7('0x73')](_0x575c16[_0x22e7('0x38')][_0x22e7('0x74')],{'transaction':_0x18319a})[_0x22e7('0x2a')](function(){if(!_[_0x22e7('0x82')](_0x22625d)){return _0x18cc94['removeAgents'](_0x22625d,{'transaction':_0x18319a});}})[_0x22e7('0x2a')](function(){_0x22625d[_0x22e7('0x71')](function(_0x2f7709){socket[_0x22e7('0x72')]('userSmsQueue:remove',{'UserId':_0x2f7709,'SmsQueueId':_0x18cc94['id']});});});});});});})[_0x22e7('0x2a')](respondWithStatusCode(_0x2e65cb,null))['catch'](handleError(_0x2e65cb,null));};exports[_0x22e7('0x83')]=function(_0x3ede89,_0x18610e,_0x3eb544){return db[_0x22e7('0x31')]['find']({'where':{'id':_0x3ede89[_0x22e7('0x56')]['id']}})[_0x22e7('0x2a')](handleEntityNotFound(_0x18610e,null))[_0x22e7('0x2a')](function(_0x328786){if(_0x328786){return _0x328786[_0x22e7('0x83')](_0x3ede89[_0x22e7('0x50')]['ids'],_[_0x22e7('0x84')](_0x3ede89['body'],[_0x22e7('0x74'),'id'])||{})[_0x22e7('0x85')](function(_0x1c2745){for(var _0x509f07=0x0;_0x509f07<_0x3ede89[_0x22e7('0x50')][_0x22e7('0x74')]['length'];_0x509f07+=0x1){socket[_0x22e7('0x72')](_0x22e7('0x86'),{'UserId':Number(_0x3ede89[_0x22e7('0x50')][_0x22e7('0x74')][_0x509f07]),'SmsQueueId':Number(_0x3ede89['params']['id'])});}return _0x1c2745;});}})[_0x22e7('0x2a')](respondWithResult(_0x18610e,null))[_0x22e7('0x49')](handleError(_0x18610e,null));};exports[_0x22e7('0x87')]=function(_0x15948f,_0x4fa16b,_0x20940f){return db['SmsQueue']['find']({'where':{'id':_0x15948f[_0x22e7('0x56')]['id']}})[_0x22e7('0x2a')](handleEntityNotFound(_0x4fa16b,null))['then'](function(_0xc9166d){if(_0xc9166d){return _0xc9166d[_0x22e7('0x87')](_0x15948f[_0x22e7('0x38')][_0x22e7('0x74')])[_0x22e7('0x2a')](function(){if(_[_0x22e7('0x88')](_0x15948f[_0x22e7('0x38')]['ids'])){for(var _0x1ac426=0x0;_0x1ac426<_0x15948f[_0x22e7('0x38')][_0x22e7('0x74')][_0x22e7('0x3d')];_0x1ac426+=0x1){socket['emit'](_0x22e7('0x89'),{'UserId':Number(_0x15948f[_0x22e7('0x38')]['ids'][_0x1ac426]),'SmsQueueId':Number(_0x15948f[_0x22e7('0x56')]['id'])});}}else{socket['emit'](_0x22e7('0x89'),{'UserId':Number(_0x15948f['query'][_0x22e7('0x74')]),'SmsQueueId':Number(_0x15948f['params']['id'])});}});}})[_0x22e7('0x2a')](respondWithStatusCode(_0x4fa16b,null))['catch'](handleError(_0x4fa16b,null));};exports[_0x22e7('0x8a')]=function(_0x34ffc4,_0x59c16f,_0x4ead05){var _0x11ecee={};var _0x250292={};var _0x28a309;var _0x415185;return db[_0x22e7('0x31')]['findOne']({'where':{'id':_0x34ffc4[_0x22e7('0x56')]['id']}})[_0x22e7('0x2a')](handleEntityNotFound(_0x59c16f,null))['then'](function(_0x2774e9){if(_0x2774e9){_0x28a309=_0x2774e9;_0x250292[_0x22e7('0x36')]=_[_0x22e7('0x39')](db['User'][_0x22e7('0x32')]);_0x250292[_0x22e7('0x38')]=_[_0x22e7('0x39')](_0x34ffc4[_0x22e7('0x38')]);_0x250292[_0x22e7('0x4b')]=_[_0x22e7('0x3a')](_0x250292['model'],_0x250292[_0x22e7('0x38')]);_0x11ecee[_0x22e7('0x3b')]=_[_0x22e7('0x3a')](_0x250292[_0x22e7('0x36')],qs[_0x22e7('0x3c')](_0x34ffc4[_0x22e7('0x38')][_0x22e7('0x3c')]));_0x11ecee[_0x22e7('0x3b')]=_0x11ecee[_0x22e7('0x3b')][_0x22e7('0x3d')]?_0x11ecee[_0x22e7('0x3b')]:_0x250292[_0x22e7('0x36')];_0x11ecee[_0x22e7('0x3f')]=qs['sort'](_0x34ffc4[_0x22e7('0x38')]['sort']);_0x11ecee[_0x22e7('0x41')]=qs[_0x22e7('0x4b')](_[_0x22e7('0x42')](_0x34ffc4[_0x22e7('0x38')],_0x250292[_0x22e7('0x4b')]));if(_0x34ffc4[_0x22e7('0x38')][_0x22e7('0x43')]){_0x11ecee[_0x22e7('0x41')]=_[_0x22e7('0x4d')](_0x11ecee[_0x22e7('0x41')],{'$or':_['map'](_0x11ecee['attributes'],function(_0x458df5){var _0x37607c={};_0x37607c[_0x458df5]={'$like':'%'+_0x34ffc4[_0x22e7('0x38')][_0x22e7('0x43')]+'%'};return _0x37607c;})});}_0x11ecee=_[_0x22e7('0x4d')]({},_0x11ecee,_0x34ffc4[_0x22e7('0x45')]);return _0x28a309[_0x22e7('0x8a')](_0x11ecee);}})[_0x22e7('0x2a')](function(_0x5e494d){if(_0x5e494d){_0x415185=_0x5e494d['length'];if(!_0x34ffc4[_0x22e7('0x38')][_0x22e7('0x3e')](_0x22e7('0x5a'))){_0x11ecee[_0x22e7('0x1f')]=qs[_0x22e7('0x1f')](_0x34ffc4[_0x22e7('0x38')][_0x22e7('0x1f')]);_0x11ecee['offset']=qs[_0x22e7('0x1d')](_0x34ffc4[_0x22e7('0x38')][_0x22e7('0x1d')]);}return _0x28a309['getAgents'](_0x11ecee);}})[_0x22e7('0x2a')](function(_0x1fa780){if(_0x1fa780){return _0x1fa780?{'count':_0x415185,'rows':_0x1fa780}:null;}})[_0x22e7('0x2a')](respondWithResult(_0x59c16f,null))['catch'](handleError(_0x59c16f,null));}; \ No newline at end of file +var _0x6dc0=['body','describe','findOne','UserSmsQueue','hasOwnProperty','SmsQueueId','findAndCountAll','agent','smsPause','format','%s/%s','createdAt','updatedAt','Team','getTeams','User','online','voicePause','interface','flatMap','Agents','sequelize','transaction','addTeams','findOrCreate','forEach','emit','removeTeams','ids','select','field','team_has_sms_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','clone','toString','QueryTypes','SELECT','every','includes','compact','removeAgents','userSmsQueue:remove','addAgents','omit','userSmsQueue:save','isArray','getAgents','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','localhost','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','SmsQueues','destroy','error','name','send','index','SmsQueue','rawAttributes','fieldName','type','model','map','keys','query','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','rows','catch','params','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update'];(function(_0x1a36a5,_0x746928){var _0x746243=function(_0x481966){while(--_0x481966){_0x1a36a5['push'](_0x1a36a5['shift']());}};_0x746243(++_0x746928);}(_0x6dc0,0xb6));var _0x06dc=function(_0x18b55d,_0x4d9a83){_0x18b55d=_0x18b55d-0x0;var _0x4496dd=_0x6dc0[_0x18b55d];return _0x4496dd;};'use strict';var emlformat=require(_0x06dc('0x0'));var rimraf=require(_0x06dc('0x1'));var zipdir=require(_0x06dc('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x06dc('0x3'));var moment=require(_0x06dc('0x4'));var BPromise=require(_0x06dc('0x5'));var Mustache=require(_0x06dc('0x6'));var util=require('util');var path=require(_0x06dc('0x7'));var sox=require(_0x06dc('0x8'));var csv=require('to-csv');var ejs=require(_0x06dc('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x06dc('0xa'));var squel=require(_0x06dc('0xb'));var crypto=require(_0x06dc('0xc'));var jsforce=require(_0x06dc('0xd'));var deskjs=require(_0x06dc('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x06dc('0xf'));var authService=require(_0x06dc('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x06dc('0x11'));var hardwareService=require(_0x06dc('0x12'));var logger=require(_0x06dc('0x13'))(_0x06dc('0x14'));var utils=require('../../config/utils');var config=require(_0x06dc('0x15'));var licenseUtil=require(_0x06dc('0x16'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config['redis'],{'host':_0x06dc('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./smsQueue.socket')[_0x06dc('0x18')](socket);function respondWithStatusCode(_0x47753d,_0x165d1e){_0x165d1e=_0x165d1e||0xcc;return function(_0x4fa866){if(_0x4fa866){return _0x47753d[_0x06dc('0x19')](_0x165d1e);}return _0x47753d[_0x06dc('0x1a')](_0x165d1e)[_0x06dc('0x1b')]();};}function respondWithResult(_0x3da2c5,_0x58dc33){_0x58dc33=_0x58dc33||0xc8;return function(_0x17411e){if(_0x17411e){return _0x3da2c5[_0x06dc('0x1a')](_0x58dc33)[_0x06dc('0x1c')](_0x17411e);}};}function respondWithFilteredResult(_0x2478b9,_0x21d87a){return function(_0x51df31){if(_0x51df31){var _0x1daaa8=typeof _0x21d87a[_0x06dc('0x1d')]===_0x06dc('0x1e')&&typeof _0x21d87a[_0x06dc('0x1f')]===_0x06dc('0x1e');var _0x152ed2=_0x51df31['count'];var _0x55c932=_0x1daaa8?0x0:_0x21d87a[_0x06dc('0x1d')];var _0x4bdbd0=_0x1daaa8?_0x51df31[_0x06dc('0x20')]:_0x21d87a['offset']+_0x21d87a[_0x06dc('0x1f')];var _0x369c60;if(_0x4bdbd0>=_0x152ed2){_0x4bdbd0=_0x152ed2;_0x369c60=0xc8;}else{_0x369c60=0xce;}_0x2478b9[_0x06dc('0x1a')](_0x369c60);return _0x2478b9[_0x06dc('0x21')](_0x06dc('0x22'),_0x55c932+'-'+_0x4bdbd0+'/'+_0x152ed2)[_0x06dc('0x1c')](_0x51df31);}return null;};}function patchUpdates(_0x577284){return function(_0x4ada7d){try{jsonpatch[_0x06dc('0x23')](_0x4ada7d,_0x577284,!![]);}catch(_0x426260){return BPromise['reject'](_0x426260);}return _0x4ada7d[_0x06dc('0x24')]();};}function saveUpdates(_0x5eab9b,_0x5e8be8){return function(_0x4e6071){if(_0x4e6071){return _0x4e6071['update'](_0x5eab9b)['then'](function(_0xd3e42b){return _0xd3e42b;});}return null;};}function removeEntity(_0x5edc7b,_0xfa043e){return function(_0x56819b){if(_0x56819b){return _0x56819b['destroy']()[_0x06dc('0x25')](function(){var _0x26bbfe=_0x56819b['get']({'plain':!![]});var _0x5f420b=_0x06dc('0x26');return db['UserProfileResource'][_0x06dc('0x27')]({'where':{'type':_0x5f420b,'resourceId':_0x26bbfe['id']}})[_0x06dc('0x25')](function(){return _0x56819b;});})[_0x06dc('0x25')](function(){_0x5edc7b[_0x06dc('0x1a')](0xcc)[_0x06dc('0x1b')]();});}};}function handleEntityNotFound(_0x31f5cd,_0x164554){return function(_0x33ff4c){if(!_0x33ff4c){_0x31f5cd[_0x06dc('0x19')](0x194);}return _0x33ff4c;};}function handleError(_0x11e65f,_0xad5ae9){_0xad5ae9=_0xad5ae9||0x1f4;return function(_0x285bb4){logger[_0x06dc('0x28')](_0x285bb4['stack']);if(_0x285bb4['name']){delete _0x285bb4[_0x06dc('0x29')];}_0x11e65f[_0x06dc('0x1a')](_0xad5ae9)[_0x06dc('0x2a')](_0x285bb4);};}exports[_0x06dc('0x2b')]=function(_0x289861,_0x1c4e90){var _0x1c1eb7={},_0x12cb89={},_0xbd4857={'count':0x0,'rows':[]};var _0x389198=_['map'](db[_0x06dc('0x2c')][_0x06dc('0x2d')],function(_0x260cdb){return{'name':_0x260cdb[_0x06dc('0x2e')],'type':_0x260cdb[_0x06dc('0x2f')]['key']};});_0x12cb89[_0x06dc('0x30')]=_[_0x06dc('0x31')](_0x389198,_0x06dc('0x29'));_0x12cb89['query']=_[_0x06dc('0x32')](_0x289861[_0x06dc('0x33')]);_0x12cb89['filters']=_[_0x06dc('0x34')](_0x12cb89[_0x06dc('0x30')],_0x12cb89['query']);_0x1c1eb7[_0x06dc('0x35')]=_[_0x06dc('0x34')](_0x12cb89[_0x06dc('0x30')],qs[_0x06dc('0x36')](_0x289861[_0x06dc('0x33')][_0x06dc('0x36')]));_0x1c1eb7[_0x06dc('0x35')]=_0x1c1eb7[_0x06dc('0x35')][_0x06dc('0x37')]?_0x1c1eb7[_0x06dc('0x35')]:_0x12cb89['model'];if(!_0x289861['query']['hasOwnProperty'](_0x06dc('0x38'))){_0x1c1eb7[_0x06dc('0x1f')]=qs[_0x06dc('0x1f')](_0x289861[_0x06dc('0x33')]['limit']);_0x1c1eb7['offset']=qs[_0x06dc('0x1d')](_0x289861[_0x06dc('0x33')][_0x06dc('0x1d')]);}_0x1c1eb7[_0x06dc('0x39')]=qs[_0x06dc('0x3a')](_0x289861[_0x06dc('0x33')][_0x06dc('0x3a')]);_0x1c1eb7[_0x06dc('0x3b')]=qs[_0x06dc('0x3c')](_[_0x06dc('0x3d')](_0x289861[_0x06dc('0x33')],_0x12cb89[_0x06dc('0x3c')]),_0x389198);if(_0x289861[_0x06dc('0x33')][_0x06dc('0x3e')]){_0x1c1eb7[_0x06dc('0x3b')]=_[_0x06dc('0x3f')](_0x1c1eb7[_0x06dc('0x3b')],{'$or':_[_0x06dc('0x31')](_0x389198,function(_0x2413bc){if(_0x2413bc[_0x06dc('0x2f')]!=='VIRTUAL'){var _0x4e5780={};_0x4e5780[_0x2413bc[_0x06dc('0x29')]]={'$like':'%'+_0x289861[_0x06dc('0x33')][_0x06dc('0x3e')]+'%'};return _0x4e5780;}})});}_0x1c1eb7=_[_0x06dc('0x3f')]({},_0x1c1eb7,_0x289861[_0x06dc('0x40')]);var _0x5c8dd5={'where':_0x1c1eb7[_0x06dc('0x3b')]};return db[_0x06dc('0x2c')][_0x06dc('0x20')](_0x5c8dd5)['then'](function(_0x164684){_0xbd4857[_0x06dc('0x20')]=_0x164684;if(_0x289861['query'][_0x06dc('0x41')]){_0x1c1eb7[_0x06dc('0x42')]=[{'all':!![]}];}return db[_0x06dc('0x2c')][_0x06dc('0x43')](_0x1c1eb7);})['then'](function(_0x4f7c03){_0xbd4857[_0x06dc('0x44')]=_0x4f7c03;return _0xbd4857;})[_0x06dc('0x25')](respondWithFilteredResult(_0x1c4e90,_0x1c1eb7))[_0x06dc('0x45')](handleError(_0x1c4e90,null));};exports['show']=function(_0x27814c,_0x3aea61){var _0x2529ed={'raw':!![],'where':{'id':_0x27814c[_0x06dc('0x46')]['id']}},_0x316185={};_0x316185['model']=_[_0x06dc('0x32')](db['SmsQueue']['rawAttributes']);_0x316185[_0x06dc('0x33')]=_[_0x06dc('0x32')](_0x27814c[_0x06dc('0x33')]);_0x316185[_0x06dc('0x3c')]=_[_0x06dc('0x34')](_0x316185['model'],_0x316185[_0x06dc('0x33')]);_0x2529ed[_0x06dc('0x35')]=_[_0x06dc('0x34')](_0x316185[_0x06dc('0x30')],qs[_0x06dc('0x36')](_0x27814c[_0x06dc('0x33')][_0x06dc('0x36')]));_0x2529ed[_0x06dc('0x35')]=_0x2529ed[_0x06dc('0x35')][_0x06dc('0x37')]?_0x2529ed[_0x06dc('0x35')]:_0x316185['model'];if(_0x27814c[_0x06dc('0x33')][_0x06dc('0x41')]){_0x2529ed['include']=[{'all':!![]}];}_0x2529ed=_[_0x06dc('0x3f')]({},_0x2529ed,_0x27814c[_0x06dc('0x40')]);return db[_0x06dc('0x2c')]['find'](_0x2529ed)[_0x06dc('0x25')](handleEntityNotFound(_0x3aea61,null))[_0x06dc('0x25')](respondWithResult(_0x3aea61,null))['catch'](handleError(_0x3aea61,null));};exports['create']=function(_0x5a7b20,_0x65fd04){return db[_0x06dc('0x2c')][_0x06dc('0x47')](_0x5a7b20['body'],{})['then'](function(_0x1d759b){var _0x1a8b1c=_0x5a7b20[_0x06dc('0x48')][_0x06dc('0x49')]({'plain':!![]});if(!_0x1a8b1c)throw new Error(_0x06dc('0x4a'));if(_0x1a8b1c['role']===_0x06dc('0x48')){var _0x1a2048=_0x1d759b[_0x06dc('0x49')]({'plain':!![]});var _0x5c911f=_0x06dc('0x26');return db[_0x06dc('0x4b')][_0x06dc('0x4c')]({'where':{'name':_0x5c911f,'userProfileId':_0x1a8b1c[_0x06dc('0x4d')]},'raw':!![]})[_0x06dc('0x25')](function(_0xb960a5){if(_0xb960a5&&_0xb960a5[_0x06dc('0x4e')]===0x0){return db[_0x06dc('0x4f')]['create']({'name':_0x1a2048[_0x06dc('0x29')],'resourceId':_0x1a2048['id'],'type':_0xb960a5['name'],'sectionId':_0xb960a5['id']},{})[_0x06dc('0x25')](function(){return _0x1d759b;});}else{return _0x1d759b;}})['catch'](function(_0x2f0bd4){logger['error'](_0x06dc('0x50'),_0x2f0bd4);throw _0x2f0bd4;});}return _0x1d759b;})[_0x06dc('0x25')](respondWithResult(_0x65fd04,0xc9))[_0x06dc('0x45')](handleError(_0x65fd04,null));};exports[_0x06dc('0x51')]=function(_0x1b1e33,_0x2a10af){if(_0x1b1e33[_0x06dc('0x52')]['id']){delete _0x1b1e33['body']['id'];}return db[_0x06dc('0x2c')][_0x06dc('0x4c')]({'where':{'id':_0x1b1e33[_0x06dc('0x46')]['id']}})['then'](handleEntityNotFound(_0x2a10af,null))['then'](saveUpdates(_0x1b1e33[_0x06dc('0x52')],null))[_0x06dc('0x25')](respondWithResult(_0x2a10af,null))[_0x06dc('0x45')](handleError(_0x2a10af,null));};exports['destroy']=function(_0x120a47,_0x717c7c){return db[_0x06dc('0x2c')][_0x06dc('0x4c')]({'where':{'id':_0x120a47['params']['id']}})[_0x06dc('0x25')](handleEntityNotFound(_0x717c7c,null))[_0x06dc('0x25')](removeEntity(_0x717c7c,null))[_0x06dc('0x45')](handleError(_0x717c7c,null));};exports[_0x06dc('0x53')]=function(_0x304042,_0x1cf3f5){return db[_0x06dc('0x2c')][_0x06dc('0x53')]()[_0x06dc('0x25')](respondWithResult(_0x1cf3f5,null))[_0x06dc('0x45')](handleError(_0x1cf3f5,null));};exports['getMembers']=function(_0x1ee820,_0x90cf5a,_0x447613){var _0x562882={'raw':!![],'where':{}},_0x5336d2={},_0x1cfacd;return db[_0x06dc('0x2c')][_0x06dc('0x54')]({'where':{'id':_0x1ee820[_0x06dc('0x46')]['id']}})[_0x06dc('0x25')](handleEntityNotFound(_0x90cf5a,null))[_0x06dc('0x25')](function(_0x3e9354){if(_0x3e9354){_0x1cfacd=_0x3e9354[_0x06dc('0x49')]({'plain':!![]});_0x5336d2[_0x06dc('0x30')]=_[_0x06dc('0x32')](db[_0x06dc('0x55')][_0x06dc('0x2d')]);_0x5336d2[_0x06dc('0x33')]=_['keys'](_0x1ee820['query']);_0x5336d2[_0x06dc('0x3c')]=_['intersection'](_0x5336d2[_0x06dc('0x30')],_0x5336d2[_0x06dc('0x33')]);_0x562882[_0x06dc('0x35')]=_['intersection'](_0x5336d2[_0x06dc('0x30')],qs[_0x06dc('0x36')](_0x1ee820[_0x06dc('0x33')][_0x06dc('0x36')]));_0x562882[_0x06dc('0x35')]=_0x562882[_0x06dc('0x35')][_0x06dc('0x37')]?_0x562882['attributes']:_0x5336d2[_0x06dc('0x30')];if(!_0x1ee820['query'][_0x06dc('0x56')]('nolimit')){_0x562882[_0x06dc('0x1f')]=qs[_0x06dc('0x1f')](_0x1ee820['query'][_0x06dc('0x1f')]);_0x562882['offset']=qs[_0x06dc('0x1d')](_0x1ee820['query']['offset']);}_0x562882[_0x06dc('0x39')]=qs['sort'](_0x1ee820[_0x06dc('0x33')][_0x06dc('0x3a')]);_0x562882[_0x06dc('0x3b')]=qs[_0x06dc('0x3c')](_[_0x06dc('0x3d')](_0x1ee820['query'],_0x5336d2[_0x06dc('0x3c')]));_0x562882[_0x06dc('0x3b')][_0x06dc('0x57')]=_0x3e9354['id'];if(_0x1ee820[_0x06dc('0x33')][_0x06dc('0x3e')]){_0x562882[_0x06dc('0x3b')]=_[_0x06dc('0x3f')](_0x562882['where'],{'$or':_[_0x06dc('0x31')](_0x562882[_0x06dc('0x35')],function(_0x1ba617){var _0x503750={};_0x503750[_0x1ba617]={'$like':'%'+_0x1ee820[_0x06dc('0x33')][_0x06dc('0x3e')]+'%'};return _0x503750;})});}_0x562882=_[_0x06dc('0x3f')]({},_0x562882,_0x1ee820['options']);return db[_0x06dc('0x55')]['findAll'](_0x562882);}})[_0x06dc('0x25')](function(_0x5a5674){if(_0x5a5674){return db['User'][_0x06dc('0x58')]({'where':{'id':_['map'](_0x5a5674,'UserId'),'role':_0x06dc('0x59')},'attributes':['id','name',_0x06dc('0x5a'),'updatedAt','createdAt']});}})[_0x06dc('0x25')](function(_0x376f34){if(_0x376f34){return{'count':_0x376f34[_0x06dc('0x20')],'rows':_[_0x06dc('0x31')](_0x376f34['rows'],function(_0x41dc6c){return{'membername':_0x41dc6c['name'],'UserId':_0x41dc6c['id'],'queue_name':_0x1cfacd[_0x06dc('0x29')],'SmsQueueId':_0x1cfacd['id'],'interface':util[_0x06dc('0x5b')](_0x06dc('0x5c'),'SIP',_0x41dc6c[_0x06dc('0x29')]),'penalty':0x0,'paused':_0x41dc6c['smsPause'],'createdAt':_0x41dc6c[_0x06dc('0x5d')],'updatedAt':_0x41dc6c[_0x06dc('0x5e')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x06dc('0x25')](respondWithFilteredResult(_0x90cf5a,_0x562882))[_0x06dc('0x45')](handleError(_0x90cf5a,null));};exports['getTeams']=function(_0x236b72,_0x11dab2,_0x11337d){var _0x4a040a={};var _0x11ac29={};var _0x2b4d62;var _0xe3f515;return db[_0x06dc('0x2c')][_0x06dc('0x54')]({'where':{'id':_0x236b72[_0x06dc('0x46')]['id']}})[_0x06dc('0x25')](handleEntityNotFound(_0x11dab2,null))[_0x06dc('0x25')](function(_0x11fb28){if(_0x11fb28){_0x2b4d62=_0x11fb28;_0x11ac29[_0x06dc('0x30')]=_['keys'](db[_0x06dc('0x5f')][_0x06dc('0x2d')]);_0x11ac29[_0x06dc('0x33')]=_[_0x06dc('0x32')](_0x236b72[_0x06dc('0x33')]);_0x11ac29[_0x06dc('0x3c')]=_[_0x06dc('0x34')](_0x11ac29[_0x06dc('0x30')],_0x11ac29[_0x06dc('0x33')]);_0x4a040a[_0x06dc('0x35')]=_[_0x06dc('0x34')](_0x11ac29[_0x06dc('0x30')],qs[_0x06dc('0x36')](_0x236b72[_0x06dc('0x33')][_0x06dc('0x36')]));_0x4a040a[_0x06dc('0x35')]=_0x4a040a[_0x06dc('0x35')][_0x06dc('0x37')]?_0x4a040a[_0x06dc('0x35')]:_0x11ac29[_0x06dc('0x30')];_0x4a040a[_0x06dc('0x39')]=qs[_0x06dc('0x3a')](_0x236b72['query']['sort']);_0x4a040a['where']=qs[_0x06dc('0x3c')](_[_0x06dc('0x3d')](_0x236b72[_0x06dc('0x33')],_0x11ac29['filters']));if(_0x236b72[_0x06dc('0x33')][_0x06dc('0x3e')]){_0x4a040a[_0x06dc('0x3b')]=_[_0x06dc('0x3f')](_0x4a040a[_0x06dc('0x3b')],{'$or':_['map'](_0x4a040a[_0x06dc('0x35')],function(_0x20277d){var _0x237122={};_0x237122[_0x20277d]={'$like':'%'+_0x236b72[_0x06dc('0x33')][_0x06dc('0x3e')]+'%'};return _0x237122;})});}_0x4a040a=_[_0x06dc('0x3f')]({},_0x4a040a,_0x236b72[_0x06dc('0x40')]);return _0x2b4d62[_0x06dc('0x60')](_0x4a040a);}})[_0x06dc('0x25')](function(_0x6b841c){if(_0x6b841c){_0xe3f515=_0x6b841c[_0x06dc('0x37')];if(!_0x236b72[_0x06dc('0x33')]['hasOwnProperty'](_0x06dc('0x38'))){_0x4a040a['limit']=qs[_0x06dc('0x1f')](_0x236b72[_0x06dc('0x33')][_0x06dc('0x1f')]);_0x4a040a[_0x06dc('0x1d')]=qs['offset'](_0x236b72[_0x06dc('0x33')][_0x06dc('0x1d')]);}return _0x2b4d62[_0x06dc('0x60')](_0x4a040a);}})['then'](function(_0x589d98){if(_0x589d98){return _0x589d98?{'count':_0xe3f515,'rows':_0x589d98}:null;}})[_0x06dc('0x25')](respondWithResult(_0x11dab2,null))[_0x06dc('0x45')](handleError(_0x11dab2,null));};exports['addTeams']=function(_0x33b292,_0x4308f5,_0x10ae85){var _0x510c34=_0x33b292[_0x06dc('0x52')]['ids'];return db[_0x06dc('0x5f')][_0x06dc('0x43')]({'where':{'id':_0x510c34},'attributes':['id'],'include':[{'model':db[_0x06dc('0x61')],'as':'Agents','attributes':['id',_0x06dc('0x29'),_0x06dc('0x62'),_0x06dc('0x63'),_0x06dc('0x64')],'raw':!![]}]})[_0x06dc('0x25')](function(_0x56a2cd){if(_0x56a2cd){var _0x291a5a=_[_0x06dc('0x65')](_0x56a2cd,function(_0xc3bc4d){var _0x5632f1=_0xc3bc4d[_0x06dc('0x49')]({'plain':!![]});return _0x5632f1[_0x06dc('0x66')];});return db[_0x06dc('0x2c')][_0x06dc('0x4c')]({'where':{'id':_0x33b292[_0x06dc('0x46')]['id']}})[_0x06dc('0x25')](function(_0x1a8198){return db[_0x06dc('0x67')][_0x06dc('0x68')](function(_0x4a1f27){return _0x1a8198[_0x06dc('0x69')](_0x510c34,{'transaction':_0x4a1f27})['then'](function(){return BPromise['each'](_0x291a5a,function(_0x4cc473){return db[_0x06dc('0x55')][_0x06dc('0x6a')]({'where':{'UserId':_0x4cc473['id'],'SmsQueueId':_0x33b292['params']['id']},'transaction':_0x4a1f27});});})['then'](function(){_0x291a5a[_0x06dc('0x6b')](function(_0x45d6c4){socket[_0x06dc('0x6c')]('userSmsQueue:save',{'UserId':_0x45d6c4['id'],'SmsQueueId':_0x1a8198['id']});});});});});}})['then'](respondWithStatusCode(_0x4308f5,null))[_0x06dc('0x45')](handleError(_0x4308f5,null));};exports[_0x06dc('0x6d')]=function(_0x430a26,_0x54f3d4,_0x3f6dfa){return db[_0x06dc('0x5f')][_0x06dc('0x43')]({'where':{'id':_0x430a26['query'][_0x06dc('0x6e')]},'attributes':['id'],'include':[{'model':db[_0x06dc('0x61')],'as':_0x06dc('0x66'),'attributes':['id'],'raw':!![]}]})[_0x06dc('0x25')](handleEntityNotFound(_0x54f3d4,null))[_0x06dc('0x25')](function(_0x149657){var _0x3e55e4=_[_0x06dc('0x31')](_0x149657,'id');var _0x4b179b=[];var _0x2deacb=[];var _0x584a4c=squel[_0x06dc('0x6f')]();_0x584a4c[_0x06dc('0x70')]('tq.TeamId')['from'](_0x06dc('0x71'),'tq')[_0x06dc('0x72')](_0x06dc('0x73'),'ut',_0x06dc('0x74'))['where'](_0x06dc('0x75'),_0x430a26[_0x06dc('0x46')]['id']);for(var _0x253a7a=0x0;_0x253a7a<_0x149657['length'];_0x253a7a+=0x1){let _0xb04541=_0x149657[_0x253a7a];for(var _0x5cbe9c=0x0;_0x5cbe9c<_0xb04541[_0x06dc('0x66')][_0x06dc('0x37')];_0x5cbe9c+=0x1){let _0x14525a=_0xb04541[_0x06dc('0x66')][_0x5cbe9c];var _0x596832=_0x584a4c[_0x06dc('0x76')]();_0x596832['where']('ut.UserId\x20=\x20?',_0x14525a['id']);_0x2deacb['push'](db['sequelize'][_0x06dc('0x33')](_0x596832[_0x06dc('0x77')](),{'type':db[_0x06dc('0x67')][_0x06dc('0x78')][_0x06dc('0x79')]})[_0x06dc('0x25')](function(_0x339a06){if(_0x339a06[_0x06dc('0x37')]===0x1){return _0x14525a['id'];}else{var _0x5e3869=_[_0x06dc('0x7a')](_[_0x06dc('0x31')](_0x339a06,'TeamId'),function(_0x125c7e){return _[_0x06dc('0x7b')](_0x3e55e4,_0x125c7e);});if(_0x5e3869){return _0x14525a['id'];}}}));}}return BPromise['all'](_0x2deacb)['then'](function(_0x3915eb){_0x4b179b=_(_0x4b179b)['union'](_0x3915eb)[_0x06dc('0x7c')]()['value']();return db[_0x06dc('0x2c')][_0x06dc('0x4c')]({'where':{'id':_0x430a26['params']['id']}})[_0x06dc('0x25')](function(_0x237d67){return db['sequelize'][_0x06dc('0x68')](function(_0x41c15a){return _0x237d67[_0x06dc('0x6d')](_0x430a26[_0x06dc('0x33')][_0x06dc('0x6e')],{'transaction':_0x41c15a})[_0x06dc('0x25')](function(){if(!_['isEmpty'](_0x4b179b)){return _0x237d67[_0x06dc('0x7d')](_0x4b179b,{'transaction':_0x41c15a});}})['then'](function(){_0x4b179b[_0x06dc('0x6b')](function(_0x20fa4e){socket['emit'](_0x06dc('0x7e'),{'UserId':_0x20fa4e,'SmsQueueId':_0x237d67['id']});});});});});});})[_0x06dc('0x25')](respondWithStatusCode(_0x54f3d4,null))[_0x06dc('0x45')](handleError(_0x54f3d4,null));};exports[_0x06dc('0x7f')]=function(_0x323c3d,_0x54c94c,_0x5c05c3){return db[_0x06dc('0x2c')]['find']({'where':{'id':_0x323c3d[_0x06dc('0x46')]['id']}})['then'](handleEntityNotFound(_0x54c94c,null))[_0x06dc('0x25')](function(_0x41692f){if(_0x41692f){return _0x41692f['addAgents'](_0x323c3d[_0x06dc('0x52')][_0x06dc('0x6e')],_[_0x06dc('0x80')](_0x323c3d[_0x06dc('0x52')],[_0x06dc('0x6e'),'id'])||{})['spread'](function(_0x3c24ae){for(var _0xef5944=0x0;_0xef5944<_0x323c3d['body'][_0x06dc('0x6e')][_0x06dc('0x37')];_0xef5944+=0x1){socket[_0x06dc('0x6c')](_0x06dc('0x81'),{'UserId':Number(_0x323c3d[_0x06dc('0x52')][_0x06dc('0x6e')][_0xef5944]),'SmsQueueId':Number(_0x323c3d['params']['id'])});}return _0x3c24ae;});}})[_0x06dc('0x25')](respondWithResult(_0x54c94c,null))[_0x06dc('0x45')](handleError(_0x54c94c,null));};exports[_0x06dc('0x7d')]=function(_0x8ebeaf,_0x433350,_0x3dc772){return db[_0x06dc('0x2c')][_0x06dc('0x4c')]({'where':{'id':_0x8ebeaf['params']['id']}})[_0x06dc('0x25')](handleEntityNotFound(_0x433350,null))['then'](function(_0x566be2){if(_0x566be2){return _0x566be2[_0x06dc('0x7d')](_0x8ebeaf[_0x06dc('0x33')]['ids'])[_0x06dc('0x25')](function(){if(_[_0x06dc('0x82')](_0x8ebeaf['query'][_0x06dc('0x6e')])){for(var _0x3fc5d8=0x0;_0x3fc5d8<_0x8ebeaf[_0x06dc('0x33')][_0x06dc('0x6e')][_0x06dc('0x37')];_0x3fc5d8+=0x1){socket['emit']('userSmsQueue:remove',{'UserId':Number(_0x8ebeaf['query'][_0x06dc('0x6e')][_0x3fc5d8]),'SmsQueueId':Number(_0x8ebeaf[_0x06dc('0x46')]['id'])});}}else{socket[_0x06dc('0x6c')]('userSmsQueue:remove',{'UserId':Number(_0x8ebeaf[_0x06dc('0x33')][_0x06dc('0x6e')]),'SmsQueueId':Number(_0x8ebeaf[_0x06dc('0x46')]['id'])});}});}})[_0x06dc('0x25')](respondWithStatusCode(_0x433350,null))[_0x06dc('0x45')](handleError(_0x433350,null));};exports[_0x06dc('0x83')]=function(_0x4cd38d,_0x565ff6,_0xe58b5e){var _0x302b1b={};var _0x462d93={};var _0x4b4f86;var _0x29f8eb;return db[_0x06dc('0x2c')][_0x06dc('0x54')]({'where':{'id':_0x4cd38d[_0x06dc('0x46')]['id']}})[_0x06dc('0x25')](handleEntityNotFound(_0x565ff6,null))[_0x06dc('0x25')](function(_0x210f06){if(_0x210f06){_0x4b4f86=_0x210f06;_0x462d93[_0x06dc('0x30')]=_[_0x06dc('0x32')](db[_0x06dc('0x61')]['rawAttributes']);_0x462d93['query']=_[_0x06dc('0x32')](_0x4cd38d[_0x06dc('0x33')]);_0x462d93['filters']=_[_0x06dc('0x34')](_0x462d93[_0x06dc('0x30')],_0x462d93[_0x06dc('0x33')]);_0x302b1b[_0x06dc('0x35')]=_['intersection'](_0x462d93[_0x06dc('0x30')],qs['fields'](_0x4cd38d[_0x06dc('0x33')][_0x06dc('0x36')]));_0x302b1b[_0x06dc('0x35')]=_0x302b1b[_0x06dc('0x35')][_0x06dc('0x37')]?_0x302b1b[_0x06dc('0x35')]:_0x462d93[_0x06dc('0x30')];_0x302b1b[_0x06dc('0x39')]=qs[_0x06dc('0x3a')](_0x4cd38d[_0x06dc('0x33')][_0x06dc('0x3a')]);_0x302b1b['where']=qs['filters'](_[_0x06dc('0x3d')](_0x4cd38d[_0x06dc('0x33')],_0x462d93[_0x06dc('0x3c')]));if(_0x4cd38d[_0x06dc('0x33')][_0x06dc('0x3e')]){_0x302b1b[_0x06dc('0x3b')]=_[_0x06dc('0x3f')](_0x302b1b[_0x06dc('0x3b')],{'$or':_[_0x06dc('0x31')](_0x302b1b[_0x06dc('0x35')],function(_0x2bd5b8){var _0x4e9c37={};_0x4e9c37[_0x2bd5b8]={'$like':'%'+_0x4cd38d['query'][_0x06dc('0x3e')]+'%'};return _0x4e9c37;})});}_0x302b1b=_[_0x06dc('0x3f')]({},_0x302b1b,_0x4cd38d[_0x06dc('0x40')]);return _0x4b4f86[_0x06dc('0x83')](_0x302b1b);}})[_0x06dc('0x25')](function(_0x296f95){if(_0x296f95){_0x29f8eb=_0x296f95[_0x06dc('0x37')];if(!_0x4cd38d[_0x06dc('0x33')][_0x06dc('0x56')](_0x06dc('0x38'))){_0x302b1b[_0x06dc('0x1f')]=qs[_0x06dc('0x1f')](_0x4cd38d[_0x06dc('0x33')][_0x06dc('0x1f')]);_0x302b1b[_0x06dc('0x1d')]=qs[_0x06dc('0x1d')](_0x4cd38d[_0x06dc('0x33')][_0x06dc('0x1d')]);}return _0x4b4f86['getAgents'](_0x302b1b);}})[_0x06dc('0x25')](function(_0x522b46){if(_0x522b46){return _0x522b46?{'count':_0x29f8eb,'rows':_0x522b46}:null;}})[_0x06dc('0x25')](respondWithResult(_0x565ff6,null))[_0x06dc('0x45')](handleError(_0x565ff6,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index 773da24..8bbc539 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 _0x0015=['hook','events','../../mysqldb','SmsQueue','save','update','remove','emit','hasOwnProperty'];(function(_0x4ce509,_0x271db8){var _0x20e7f2=function(_0x2b71db){while(--_0x2b71db){_0x4ce509['push'](_0x4ce509['shift']());}};_0x20e7f2(++_0x271db8);}(_0x0015,0x6d));var _0x5001=function(_0x5b09c4,_0x2b5e4c){_0x5b09c4=_0x5b09c4-0x0;var _0x18af6b=_0x0015[_0x5b09c4];return _0x18af6b;};'use strict';var EventEmitter=require(_0x5001('0x0'));var SmsQueue=require(_0x5001('0x1'))['db'][_0x5001('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x5001('0x3'),'afterUpdate':_0x5001('0x4'),'afterDestroy':_0x5001('0x5')};function emitEvent(_0x5a6cd9){return function(_0x1fb25a,_0x401732,_0x587492){SmsQueueEvents['emit'](_0x5a6cd9+':'+_0x1fb25a['id'],_0x1fb25a);SmsQueueEvents[_0x5001('0x6')](_0x5a6cd9,_0x1fb25a);_0x587492(null);};}for(var e in events){if(events[_0x5001('0x7')](e)){var event=events[e];SmsQueue[_0x5001('0x8')](e,emitEvent(event));}}module['exports']=SmsQueueEvents; \ No newline at end of file +var _0x258e=['remove','emit','hasOwnProperty','hook','events','../../mysqldb','SmsQueue','setMaxListeners','save','update'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x258e,0x1c6));var _0xe258=function(_0x2e9da8,_0x202957){_0x2e9da8=_0x2e9da8-0x0;var _0x19c673=_0x258e[_0x2e9da8];return _0x19c673;};'use strict';var EventEmitter=require(_0xe258('0x0'));var SmsQueue=require(_0xe258('0x1'))['db'][_0xe258('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0xe258('0x3')](0x0);var events={'afterCreate':_0xe258('0x4'),'afterUpdate':_0xe258('0x5'),'afterDestroy':_0xe258('0x6')};function emitEvent(_0x365117){return function(_0x4fdead,_0xfff31a,_0xcbe347){SmsQueueEvents[_0xe258('0x7')](_0x365117+':'+_0x4fdead['id'],_0x4fdead);SmsQueueEvents[_0xe258('0x7')](_0x365117,_0x4fdead);_0xcbe347(null);};}for(var e in events){if(events[_0xe258('0x8')](e)){var event=events[e];SmsQueue[_0xe258('0x9')](e,emitEvent(event));}}module['exports']=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index 601f67c..cea38c6 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 _0xd31f=['request-promise','path','rimraf','./smsQueue.attributes','exports','sms_queues','lodash','util','api','bluebird'];(function(_0x47f317,_0x310b64){var _0x58ae51=function(_0x38fb59){while(--_0x38fb59){_0x47f317['push'](_0x47f317['shift']());}};_0x58ae51(++_0x310b64);}(_0xd31f,0x182));var _0xfd31=function(_0x3b17c1,_0x2fd4e4){_0x3b17c1=_0x3b17c1-0x0;var _0x4c2640=_0xd31f[_0x3b17c1];return _0x4c2640;};'use strict';var _=require(_0xfd31('0x0'));var util=require(_0xfd31('0x1'));var logger=require('../../config/logger')(_0xfd31('0x2'));var moment=require('moment');var BPromise=require(_0xfd31('0x3'));var rp=require(_0xfd31('0x4'));var fs=require('fs');var path=require(_0xfd31('0x5'));var rimraf=require(_0xfd31('0x6'));var config=require('../../config/environment');var attributes=require(_0xfd31('0x7'));module[_0xfd31('0x8')]=function(_0x11693d,_0x29a9eb){return _0x11693d['define']('SmsQueue',attributes,{'tableName':_0xfd31('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd990=['../../config/environment','./smsQueue.attributes','exports','define','SmsQueue','sms_queues','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0xbc927a,_0x16ed02){var _0x1ed299=function(_0x48d891){while(--_0x48d891){_0xbc927a['push'](_0xbc927a['shift']());}};_0x1ed299(++_0x16ed02);}(_0xd990,0xf4));var _0x0d99=function(_0x5b545c,_0xf20df1){_0x5b545c=_0x5b545c-0x0;var _0x182d72=_0xd990[_0x5b545c];return _0x182d72;};'use strict';var _=require('lodash');var util=require(_0x0d99('0x0'));var logger=require(_0x0d99('0x1'))(_0x0d99('0x2'));var moment=require(_0x0d99('0x3'));var BPromise=require(_0x0d99('0x4'));var rp=require(_0x0d99('0x5'));var fs=require('fs');var path=require(_0x0d99('0x6'));var rimraf=require(_0x0d99('0x7'));var config=require(_0x0d99('0x8'));var attributes=require(_0x0d99('0x9'));module[_0x0d99('0xa')]=function(_0xb21c35,_0x49da2f){return _0xb21c35[_0x0d99('0xb')](_0x0d99('0xc'),attributes,{'tableName':_0x0d99('0xd'),'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 e58d36b..c3dfc39 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 _0xbb71=['include','map','attributes','model','GetSmsQueue','ShowSmsQueue','find','catch','moment','randomstring','../../mysqldb','../../config/logger','rpc','client','redis','defaults','localhost','socket.io-emitter','register','request','then','info','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','SmsQueue','findAll','options','raw','where','limit'];(function(_0x1b9739,_0xcea49b){var _0x94c357=function(_0x1ba06b){while(--_0x1ba06b){_0x1b9739['push'](_0x1b9739['shift']());}};_0x94c357(++_0xcea49b);}(_0xbb71,0x9c));var _0x1bb7=function(_0x36884e,_0x48008f){_0x36884e=_0x36884e-0x0;var _0x1cc367=_0xbb71[_0x36884e];return _0x1cc367;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1bb7('0x0'));var BPromise=require('bluebird');var rs=require(_0x1bb7('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1bb7('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x1bb7('0x3'))(_0x1bb7('0x4'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x1bb7('0x5')]['http']({'port':0x232a});config[_0x1bb7('0x6')]=_[_0x1bb7('0x7')](config[_0x1bb7('0x6')],{'host':_0x1bb7('0x8'),'port':0x18eb});var socket=require(_0x1bb7('0x9'))(new Redis(config[_0x1bb7('0x6')]));require('./smsQueue.socket')[_0x1bb7('0xa')](socket);function respondWithRpcPromise(_0x4169ed,_0x26b7a7,_0x3c30b2){return new BPromise(function(_0x4a857e,_0x39417e){return client[_0x1bb7('0xb')](_0x4169ed,_0x3c30b2)[_0x1bb7('0xc')](function(_0x10d6a8){logger[_0x1bb7('0xd')](_0x1bb7('0xe'),_0x26b7a7,_0x1bb7('0xf'));logger[_0x1bb7('0x10')](_0x1bb7('0x11'),_0x26b7a7,'request\x20sent',JSON[_0x1bb7('0x12')](_0x10d6a8));if(_0x10d6a8[_0x1bb7('0x13')]){if(_0x10d6a8['error'][_0x1bb7('0x14')]===0x1f4){logger[_0x1bb7('0x13')](_0x1bb7('0xe'),_0x26b7a7,_0x10d6a8[_0x1bb7('0x13')][_0x1bb7('0x15')]);return _0x39417e(_0x10d6a8[_0x1bb7('0x13')][_0x1bb7('0x15')]);}logger[_0x1bb7('0x13')](_0x1bb7('0xe'),_0x26b7a7,_0x10d6a8[_0x1bb7('0x13')][_0x1bb7('0x15')]);return _0x4a857e(_0x10d6a8[_0x1bb7('0x13')][_0x1bb7('0x15')]);}else{logger['info']('SmsQueue,\x20%s,\x20%s',_0x26b7a7,_0x1bb7('0xf'));_0x4a857e(_0x10d6a8[_0x1bb7('0x16')]['message']);}})['catch'](function(_0x27d33d){logger[_0x1bb7('0x13')](_0x1bb7('0xe'),_0x26b7a7,_0x27d33d);_0x39417e(_0x27d33d);});});}exports['GetSmsQueue']=function(_0x306b50){var _0x53e1c5=this;return new Promise(function(_0x512642,_0x5c5496){return db[_0x1bb7('0x17')][_0x1bb7('0x18')]({'raw':_0x306b50[_0x1bb7('0x19')]?_0x306b50[_0x1bb7('0x19')][_0x1bb7('0x1a')]===undefined?!![]:![]:!![],'where':_0x306b50[_0x1bb7('0x19')]?_0x306b50[_0x1bb7('0x19')][_0x1bb7('0x1b')]||null:null,'attributes':_0x306b50['options']?_0x306b50[_0x1bb7('0x19')]['attributes']||null:null,'limit':_0x306b50['options']?_0x306b50[_0x1bb7('0x19')][_0x1bb7('0x1c')]||null:null,'include':_0x306b50[_0x1bb7('0x19')]?_0x306b50[_0x1bb7('0x19')][_0x1bb7('0x1d')]?_[_0x1bb7('0x1e')](_0x306b50[_0x1bb7('0x19')][_0x1bb7('0x1d')],function(_0x10aa13){return{'model':db[_0x10aa13['model']],'as':_0x10aa13['as'],'attributes':_0x10aa13[_0x1bb7('0x1f')],'include':_0x10aa13[_0x1bb7('0x1d')]?_[_0x1bb7('0x1e')](_0x10aa13[_0x1bb7('0x1d')],function(_0x52d002){return{'model':db[_0x52d002[_0x1bb7('0x20')]],'as':_0x52d002['as'],'attributes':_0x52d002[_0x1bb7('0x1f')],'include':_0x52d002[_0x1bb7('0x1d')]?_[_0x1bb7('0x1e')](_0x52d002[_0x1bb7('0x1d')],function(_0x27b5f9){return{'model':db[_0x27b5f9['model']],'as':_0x27b5f9['as'],'attributes':_0x27b5f9[_0x1bb7('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x1bb7('0xc')](function(_0x5d5e2e){logger[_0x1bb7('0xd')](_0x1bb7('0x21'),_0x306b50);logger[_0x1bb7('0x10')]('GetSmsQueue',_0x306b50,JSON['stringify'](_0x5d5e2e));_0x512642(_0x5d5e2e);})['catch'](function(_0x5030fa){logger[_0x1bb7('0x13')](_0x1bb7('0x21'),_0x5030fa['message'],_0x306b50);_0x5c5496(_0x53e1c5[_0x1bb7('0x13')](0x1f4,_0x5030fa[_0x1bb7('0x15')]));});});};exports[_0x1bb7('0x22')]=function(_0x3d32af){var _0xcdabf0=this;return new Promise(function(_0xddb5d3,_0xf3ada0){return db[_0x1bb7('0x17')][_0x1bb7('0x23')]({'raw':_0x3d32af[_0x1bb7('0x19')]?_0x3d32af[_0x1bb7('0x19')][_0x1bb7('0x1a')]===undefined?!![]:![]:!![],'where':_0x3d32af[_0x1bb7('0x19')]?_0x3d32af[_0x1bb7('0x19')][_0x1bb7('0x1b')]||null:null,'attributes':_0x3d32af[_0x1bb7('0x19')]?_0x3d32af[_0x1bb7('0x19')]['attributes']||null:null,'include':_0x3d32af['options']?_0x3d32af['options'][_0x1bb7('0x1d')]?_[_0x1bb7('0x1e')](_0x3d32af[_0x1bb7('0x19')][_0x1bb7('0x1d')],function(_0x1210c1){return{'model':db[_0x1210c1[_0x1bb7('0x20')]],'as':_0x1210c1['as'],'attributes':_0x1210c1[_0x1bb7('0x1f')],'include':_0x1210c1['include']?_[_0x1bb7('0x1e')](_0x1210c1['include'],function(_0x1691b1){return{'model':db[_0x1691b1['model']],'as':_0x1691b1['as'],'attributes':_0x1691b1[_0x1bb7('0x1f')],'include':_0x1691b1['include']?_[_0x1bb7('0x1e')](_0x1691b1[_0x1bb7('0x1d')],function(_0xadf846){return{'model':db[_0xadf846[_0x1bb7('0x20')]],'as':_0xadf846['as'],'attributes':_0xadf846[_0x1bb7('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x1bb7('0xc')](function(_0x1235f1){logger[_0x1bb7('0xd')](_0x1bb7('0x22'),_0x3d32af);logger[_0x1bb7('0x10')](_0x1bb7('0x22'),_0x3d32af,JSON[_0x1bb7('0x12')](_0x1235f1));_0xddb5d3(_0x1235f1);})[_0x1bb7('0x24')](function(_0x57bb8c){logger['error']('ShowSmsQueue',_0x57bb8c[_0x1bb7('0x15')],_0x3d32af);_0xf3ada0(_0xcdabf0['error'](0x1f4,_0x57bb8c['message']));});});}; \ No newline at end of file +var _0x2995=['moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','socket.io-emitter','register','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','GetSmsQueue','findAll','options','raw','where','attributes','limit','include','model','map','then','SmsQueue','find','ShowSmsQueue','lodash'];(function(_0xe39bf0,_0x1efae8){var _0x4e80ba=function(_0x44e4d9){while(--_0x44e4d9){_0xe39bf0['push'](_0xe39bf0['shift']());}};_0x4e80ba(++_0x1efae8);}(_0x2995,0x93));var _0x5299=function(_0x4451f7,_0x1ac4f6){_0x4451f7=_0x4451f7-0x0;var _0x51c1e5=_0x2995[_0x4451f7];return _0x51c1e5;};'use strict';var _=require(_0x5299('0x0'));var util=require('util');var moment=require(_0x5299('0x1'));var BPromise=require(_0x5299('0x2'));var rs=require(_0x5299('0x3'));var fs=require('fs');var Redis=require(_0x5299('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x5299('0x5'));var logger=require(_0x5299('0x6'))(_0x5299('0x7'));var config=require(_0x5299('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x5299('0x9')]['http']({'port':0x232a});config[_0x5299('0xa')]=_['defaults'](config[_0x5299('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x5299('0xb'))(new Redis(config[_0x5299('0xa')]));require('./smsQueue.socket')[_0x5299('0xc')](socket);function respondWithRpcPromise(_0x4f3281,_0x2e85d8,_0x3a528b){return new BPromise(function(_0x17759a,_0x5d90ff){return client['request'](_0x4f3281,_0x3a528b)['then'](function(_0x46668b){logger['info'](_0x5299('0xd'),_0x2e85d8,_0x5299('0xe'));logger[_0x5299('0xf')](_0x5299('0x10'),_0x2e85d8,_0x5299('0xe'),JSON['stringify'](_0x46668b));if(_0x46668b[_0x5299('0x11')]){if(_0x46668b[_0x5299('0x11')][_0x5299('0x12')]===0x1f4){logger[_0x5299('0x11')](_0x5299('0xd'),_0x2e85d8,_0x46668b['error'][_0x5299('0x13')]);return _0x5d90ff(_0x46668b['error'][_0x5299('0x13')]);}logger['error']('SmsQueue,\x20%s,\x20%s',_0x2e85d8,_0x46668b[_0x5299('0x11')][_0x5299('0x13')]);return _0x17759a(_0x46668b[_0x5299('0x11')][_0x5299('0x13')]);}else{logger[_0x5299('0x14')](_0x5299('0xd'),_0x2e85d8,_0x5299('0xe'));_0x17759a(_0x46668b[_0x5299('0x15')]['message']);}})[_0x5299('0x16')](function(_0x3fac4e){logger[_0x5299('0x11')](_0x5299('0xd'),_0x2e85d8,_0x3fac4e);_0x5d90ff(_0x3fac4e);});});}exports[_0x5299('0x17')]=function(_0x53b0ec){var _0x28152d=this;return new Promise(function(_0x572e09,_0x351cc6){return db['SmsQueue'][_0x5299('0x18')]({'raw':_0x53b0ec[_0x5299('0x19')]?_0x53b0ec['options'][_0x5299('0x1a')]===undefined?!![]:![]:!![],'where':_0x53b0ec['options']?_0x53b0ec[_0x5299('0x19')][_0x5299('0x1b')]||null:null,'attributes':_0x53b0ec['options']?_0x53b0ec[_0x5299('0x19')][_0x5299('0x1c')]||null:null,'limit':_0x53b0ec['options']?_0x53b0ec[_0x5299('0x19')][_0x5299('0x1d')]||null:null,'include':_0x53b0ec[_0x5299('0x19')]?_0x53b0ec['options'][_0x5299('0x1e')]?_['map'](_0x53b0ec[_0x5299('0x19')][_0x5299('0x1e')],function(_0x2fe20d){return{'model':db[_0x2fe20d[_0x5299('0x1f')]],'as':_0x2fe20d['as'],'attributes':_0x2fe20d[_0x5299('0x1c')],'include':_0x2fe20d['include']?_[_0x5299('0x20')](_0x2fe20d[_0x5299('0x1e')],function(_0x5472c2){return{'model':db[_0x5472c2[_0x5299('0x1f')]],'as':_0x5472c2['as'],'attributes':_0x5472c2['attributes'],'include':_0x5472c2[_0x5299('0x1e')]?_['map'](_0x5472c2['include'],function(_0x17f721){return{'model':db[_0x17f721[_0x5299('0x1f')]],'as':_0x17f721['as'],'attributes':_0x17f721['attributes']};}):[]};}):[]};}):[]:[]})[_0x5299('0x21')](function(_0x4b9434){logger['info'](_0x5299('0x17'),_0x53b0ec);logger[_0x5299('0xf')](_0x5299('0x17'),_0x53b0ec,JSON['stringify'](_0x4b9434));_0x572e09(_0x4b9434);})['catch'](function(_0x2a34f9){logger[_0x5299('0x11')]('GetSmsQueue',_0x2a34f9[_0x5299('0x13')],_0x53b0ec);_0x351cc6(_0x28152d['error'](0x1f4,_0x2a34f9['message']));});});};exports['ShowSmsQueue']=function(_0x1dabb4){var _0x1c12f5=this;return new Promise(function(_0x4c039e,_0x2feefc){return db[_0x5299('0x22')][_0x5299('0x23')]({'raw':_0x1dabb4[_0x5299('0x19')]?_0x1dabb4[_0x5299('0x19')][_0x5299('0x1a')]===undefined?!![]:![]:!![],'where':_0x1dabb4[_0x5299('0x19')]?_0x1dabb4['options'][_0x5299('0x1b')]||null:null,'attributes':_0x1dabb4[_0x5299('0x19')]?_0x1dabb4['options'][_0x5299('0x1c')]||null:null,'include':_0x1dabb4[_0x5299('0x19')]?_0x1dabb4[_0x5299('0x19')][_0x5299('0x1e')]?_[_0x5299('0x20')](_0x1dabb4[_0x5299('0x19')][_0x5299('0x1e')],function(_0x2013aa){return{'model':db[_0x2013aa[_0x5299('0x1f')]],'as':_0x2013aa['as'],'attributes':_0x2013aa[_0x5299('0x1c')],'include':_0x2013aa['include']?_[_0x5299('0x20')](_0x2013aa[_0x5299('0x1e')],function(_0x2ef3f1){return{'model':db[_0x2ef3f1[_0x5299('0x1f')]],'as':_0x2ef3f1['as'],'attributes':_0x2ef3f1[_0x5299('0x1c')],'include':_0x2ef3f1[_0x5299('0x1e')]?_[_0x5299('0x20')](_0x2ef3f1[_0x5299('0x1e')],function(_0x2398aa){return{'model':db[_0x2398aa['model']],'as':_0x2398aa['as'],'attributes':_0x2398aa[_0x5299('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x5299('0x21')](function(_0x4b97b3){logger[_0x5299('0x14')](_0x5299('0x24'),_0x1dabb4);logger[_0x5299('0xf')](_0x5299('0x24'),_0x1dabb4,JSON['stringify'](_0x4b97b3));_0x4c039e(_0x4b97b3);})['catch'](function(_0x204c56){logger[_0x5299('0x11')](_0x5299('0x24'),_0x204c56[_0x5299('0x13')],_0x1dabb4);_0x2feefc(_0x1c12f5[_0x5299('0x11')](0x1f4,_0x204c56[_0x5299('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index f854177..6d53248 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 _0xb1e8=['emit','removeListener','register','smsQueue:','./smsQueue.events','update'];(function(_0x2288c3,_0x192bc1){var _0x41c55=function(_0x3a7dc0){while(--_0x3a7dc0){_0x2288c3['push'](_0x2288c3['shift']());}};_0x41c55(++_0x192bc1);}(_0xb1e8,0x1cc));var _0x8b1e=function(_0x2b305c,_0x5ae303){_0x2b305c=_0x2b305c-0x0;var _0x5d8c85=_0xb1e8[_0x2b305c];return _0x5d8c85;};'use strict';var SmsQueueEvents=require(_0x8b1e('0x0'));var events=['save','remove',_0x8b1e('0x1')];function createListener(_0x579fda,_0x38e93d){return function(_0x467ef9){_0x38e93d[_0x8b1e('0x2')](_0x579fda,_0x467ef9);};}function removeListener(_0x162de0,_0x33e72f){return function(){SmsQueueEvents[_0x8b1e('0x3')](_0x162de0,_0x33e72f);};}exports[_0x8b1e('0x4')]=function(_0x1e6cad){for(var _0x2e2ab5=0x0,_0x24a5a6=events['length'];_0x2e2ab5<_0x24a5a6;_0x2e2ab5++){var _0x48738e=events[_0x2e2ab5];var _0x4b682a=createListener(_0x8b1e('0x5')+_0x48738e,_0x1e6cad);SmsQueueEvents['on'](_0x48738e,_0x4b682a);}}; \ No newline at end of file +var _0xbb6b=['register','length','./smsQueue.events','save','remove','update','emit','removeListener'];(function(_0x22342c,_0x218835){var _0xd3b434=function(_0x45b259){while(--_0x45b259){_0x22342c['push'](_0x22342c['shift']());}};_0xd3b434(++_0x218835);}(_0xbb6b,0x1f2));var _0xbbb6=function(_0x34ddc1,_0x853f0){_0x34ddc1=_0x34ddc1-0x0;var _0x913f4e=_0xbb6b[_0x34ddc1];return _0x913f4e;};'use strict';var SmsQueueEvents=require(_0xbbb6('0x0'));var events=[_0xbbb6('0x1'),_0xbbb6('0x2'),_0xbbb6('0x3')];function createListener(_0x375765,_0x41f9be){return function(_0x36667c){_0x41f9be[_0xbbb6('0x4')](_0x375765,_0x36667c);};}function removeListener(_0x229f28,_0xafc7da){return function(){SmsQueueEvents[_0xbbb6('0x5')](_0x229f28,_0xafc7da);};}exports[_0xbbb6('0x6')]=function(_0x3301ff){for(var _0x3fdc6c=0x0,_0x4d9831=events[_0xbbb6('0x7')];_0x3fdc6c<_0x4d9831;_0x3fdc6c++){var _0x5efa1e=events[_0x3fdc6c];var _0x148b7a=createListener('smsQueue:'+_0x5efa1e,_0x3301ff);SmsQueueEvents['on'](_0x5efa1e,_0x148b7a);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index 4f38a78..ad1fa9d 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 _0x51a8=['isAuthenticated','/describe','describe','/:id','create','put','update','delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','get'];(function(_0x20b0a7,_0x42229d){var _0x26f29b=function(_0x42258a){while(--_0x42258a){_0x20b0a7['push'](_0x20b0a7['shift']());}};_0x26f29b(++_0x42229d);}(_0x51a8,0x186));var _0x851a=function(_0x123a7d,_0xb26d5){_0x123a7d=_0x123a7d-0x0;var _0x1f18a5=_0x51a8[_0x123a7d];return _0x1f18a5;};'use strict';var multer=require(_0x851a('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x851a('0x1'));var express=require(_0x851a('0x2'));var router=express[_0x851a('0x3')]();var fs_extra=require(_0x851a('0x4'));var auth=require(_0x851a('0x5'));var interaction=require(_0x851a('0x6'));var config=require(_0x851a('0x7'));var controller=require(_0x851a('0x8'));router[_0x851a('0x9')]('/',auth[_0x851a('0xa')](),controller['index']);router['get'](_0x851a('0xb'),auth[_0x851a('0xa')](),controller[_0x851a('0xc')]);router['get'](_0x851a('0xd'),auth[_0x851a('0xa')](),controller['show']);router['post']('/',auth[_0x851a('0xa')](),controller[_0x851a('0xe')]);router[_0x851a('0xf')](_0x851a('0xd'),auth[_0x851a('0xa')](),controller[_0x851a('0x10')]);router[_0x851a('0x11')](_0x851a('0xd'),auth[_0x851a('0xa')](),controller[_0x851a('0x12')]);module[_0x851a('0x13')]=router; \ No newline at end of file +var _0xfafb=['destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','get','isAuthenticated','describe','/:id','show','put','update','delete'];(function(_0x186376,_0x5d988a){var _0x2dbdd9=function(_0x96908e){while(--_0x96908e){_0x186376['push'](_0x186376['shift']());}};_0x2dbdd9(++_0x5d988a);}(_0xfafb,0xf2));var _0xbfaf=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfafb[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xbfaf('0x0'));var util=require('util');var path=require(_0xbfaf('0x1'));var timeout=require(_0xbfaf('0x2'));var express=require(_0xbfaf('0x3'));var router=express[_0xbfaf('0x4')]();var fs_extra=require(_0xbfaf('0x5'));var auth=require(_0xbfaf('0x6'));var interaction=require(_0xbfaf('0x7'));var config=require(_0xbfaf('0x8'));var controller=require(_0xbfaf('0x9'));router[_0xbfaf('0xa')]('/',auth[_0xbfaf('0xb')](),controller['index']);router[_0xbfaf('0xa')]('/describe',auth[_0xbfaf('0xb')](),controller[_0xbfaf('0xc')]);router[_0xbfaf('0xa')](_0xbfaf('0xd'),auth[_0xbfaf('0xb')](),controller[_0xbfaf('0xe')]);router['post']('/',auth[_0xbfaf('0xb')](),controller['create']);router[_0xbfaf('0xf')]('/:id',auth[_0xbfaf('0xb')](),controller[_0xbfaf('0x10')]);router[_0xbfaf('0x11')](_0xbfaf('0xd'),auth[_0xbfaf('0xb')](),controller[_0xbfaf('0x12')]);module[_0xbfaf('0x13')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index 7115647..08cb3ec 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 _0xf984=['DATE','moment','sequelize','exports','STRING'];(function(_0x521f0c,_0x1630af){var _0x4772ab=function(_0x4bf4a3){while(--_0x4bf4a3){_0x521f0c['push'](_0x521f0c['shift']());}};_0x4772ab(++_0x1630af);}(_0xf984,0x1d2));var _0x4f98=function(_0x1386a3,_0x13087c){_0x1386a3=_0x1386a3-0x0;var _0x3ba3c9=_0xf984[_0x1386a3];return _0x3ba3c9;};'use strict';var moment=require(_0x4f98('0x0'));var Sequelize=require(_0x4f98('0x1'));module[_0x4f98('0x2')]={'uniqueid':{'type':Sequelize[_0x4f98('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x4f98('0x4')]},'leaveAt':{'type':Sequelize[_0x4f98('0x4')]},'acceptAt':{'type':Sequelize[_0x4f98('0x4')]},'exitAt':{'type':Sequelize[_0x4f98('0x4')]},'reason':{'type':Sequelize[_0x4f98('0x3')]}}; \ No newline at end of file +var _0xf029=['STRING','DATE','moment','sequelize','exports'];(function(_0x5b9b02,_0x42640a){var _0x108b34=function(_0x2c0366){while(--_0x2c0366){_0x5b9b02['push'](_0x5b9b02['shift']());}};_0x108b34(++_0x42640a);}(_0xf029,0x16f));var _0x9f02=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0xf029[_0x1cc8fe];return _0x230054;};'use strict';var moment=require(_0x9f02('0x0'));var Sequelize=require(_0x9f02('0x1'));module[_0x9f02('0x2')]={'uniqueid':{'type':Sequelize[_0x9f02('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x9f02('0x3')]},'joinAt':{'type':Sequelize[_0x9f02('0x4')]},'leaveAt':{'type':Sequelize[_0x9f02('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index 47d1ee9..2d0009f 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 _0xb6f8=['params','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','status','end','json','offset','undefined','limit','count','reject','update','destroy','error','stack','name','index','SmsQueueReport','rawAttributes','fieldName','type','model','map','keys','filters','intersection','query','attributes','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','include','then','rows','catch','show'];(function(_0x318b3e,_0xffb4da){var _0x430078=function(_0x23f6d3){while(--_0x23f6d3){_0x318b3e['push'](_0x318b3e['shift']());}};_0x430078(++_0xffb4da);}(_0xb6f8,0x93));var _0x8b6f=function(_0x4f39fd,_0x36d85f){_0x4f39fd=_0x4f39fd-0x0;var _0x4ef809=_0xb6f8[_0x4f39fd];return _0x4ef809;};'use strict';var emlformat=require(_0x8b6f('0x0'));var rimraf=require(_0x8b6f('0x1'));var zipdir=require(_0x8b6f('0x2'));var jsonpatch=require(_0x8b6f('0x3'));var rp=require(_0x8b6f('0x4'));var moment=require(_0x8b6f('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x8b6f('0x6'));var util=require(_0x8b6f('0x7'));var path=require(_0x8b6f('0x8'));var sox=require(_0x8b6f('0x9'));var csv=require(_0x8b6f('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8b6f('0xb'));var _=require(_0x8b6f('0xc'));var squel=require(_0x8b6f('0xd'));var crypto=require(_0x8b6f('0xe'));var jsforce=require(_0x8b6f('0xf'));var deskjs=require(_0x8b6f('0x10'));var toCsv=require(_0x8b6f('0xa'));var querystring=require(_0x8b6f('0x11'));var Papa=require(_0x8b6f('0x12'));var Redis=require(_0x8b6f('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x8b6f('0x14'));var as=require(_0x8b6f('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8b6f('0x16'))(_0x8b6f('0x17'));var utils=require(_0x8b6f('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x8b6f('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x557c58,_0x2a06c9){_0x2a06c9=_0x2a06c9||0xcc;return function(_0x1f3f4f){if(_0x1f3f4f){return _0x557c58['sendStatus'](_0x2a06c9);}return _0x557c58[_0x8b6f('0x1a')](_0x2a06c9)[_0x8b6f('0x1b')]();};}function respondWithResult(_0x225a51,_0x7ae99a){_0x7ae99a=_0x7ae99a||0xc8;return function(_0x1a65c8){if(_0x1a65c8){return _0x225a51[_0x8b6f('0x1a')](_0x7ae99a)[_0x8b6f('0x1c')](_0x1a65c8);}};}function respondWithFilteredResult(_0xa27e7d,_0x2b092d){return function(_0x524ec4){if(_0x524ec4){var _0x41b25f=typeof _0x2b092d[_0x8b6f('0x1d')]===_0x8b6f('0x1e')&&typeof _0x2b092d[_0x8b6f('0x1f')]===_0x8b6f('0x1e');var _0x113b52=_0x524ec4['count'];var _0x276817=_0x41b25f?0x0:_0x2b092d['offset'];var _0x3b6b44=_0x41b25f?_0x524ec4[_0x8b6f('0x20')]:_0x2b092d[_0x8b6f('0x1d')]+_0x2b092d[_0x8b6f('0x1f')];var _0x2cd608;if(_0x3b6b44>=_0x113b52){_0x3b6b44=_0x113b52;_0x2cd608=0xc8;}else{_0x2cd608=0xce;}_0xa27e7d['status'](_0x2cd608);return _0xa27e7d['set']('Content-Range',_0x276817+'-'+_0x3b6b44+'/'+_0x113b52)['json'](_0x524ec4);}return null;};}function patchUpdates(_0x572a80){return function(_0x56e1d5){try{jsonpatch['apply'](_0x56e1d5,_0x572a80,!![]);}catch(_0x458d5f){return BPromise[_0x8b6f('0x21')](_0x458d5f);}return _0x56e1d5['save']();};}function saveUpdates(_0x34584a,_0x3ab227){return function(_0x3b5628){if(_0x3b5628){return _0x3b5628[_0x8b6f('0x22')](_0x34584a)['then'](function(_0x42dcb1){return _0x42dcb1;});}return null;};}function removeEntity(_0x28f0dc,_0x1ab1db){return function(_0x5a1ec3){if(_0x5a1ec3){return _0x5a1ec3[_0x8b6f('0x23')]()['then'](function(){_0x28f0dc[_0x8b6f('0x1a')](0xcc)[_0x8b6f('0x1b')]();});}};}function handleEntityNotFound(_0x24a816,_0x3b738d){return function(_0x5e3d4e){if(!_0x5e3d4e){_0x24a816['sendStatus'](0x194);}return _0x5e3d4e;};}function handleError(_0x33484e,_0x2ac6aa){_0x2ac6aa=_0x2ac6aa||0x1f4;return function(_0xa292c2){logger[_0x8b6f('0x24')](_0xa292c2[_0x8b6f('0x25')]);if(_0xa292c2[_0x8b6f('0x26')]){delete _0xa292c2[_0x8b6f('0x26')];}_0x33484e[_0x8b6f('0x1a')](_0x2ac6aa)['send'](_0xa292c2);};}exports[_0x8b6f('0x27')]=function(_0x51a7eb,_0xc5bc75){var _0x3c493a={},_0x262083={},_0x24382e={'count':0x0,'rows':[]};var _0x39db89=_['map'](db[_0x8b6f('0x28')][_0x8b6f('0x29')],function(_0x263e8c){return{'name':_0x263e8c[_0x8b6f('0x2a')],'type':_0x263e8c[_0x8b6f('0x2b')]['key']};});_0x262083[_0x8b6f('0x2c')]=_[_0x8b6f('0x2d')](_0x39db89,_0x8b6f('0x26'));_0x262083['query']=_[_0x8b6f('0x2e')](_0x51a7eb['query']);_0x262083[_0x8b6f('0x2f')]=_[_0x8b6f('0x30')](_0x262083[_0x8b6f('0x2c')],_0x262083[_0x8b6f('0x31')]);_0x3c493a[_0x8b6f('0x32')]=_[_0x8b6f('0x30')](_0x262083[_0x8b6f('0x2c')],qs[_0x8b6f('0x33')](_0x51a7eb[_0x8b6f('0x31')]['fields']));_0x3c493a[_0x8b6f('0x32')]=_0x3c493a['attributes'][_0x8b6f('0x34')]?_0x3c493a[_0x8b6f('0x32')]:_0x262083[_0x8b6f('0x2c')];if(!_0x51a7eb['query']['hasOwnProperty'](_0x8b6f('0x35'))){_0x3c493a[_0x8b6f('0x1f')]=qs[_0x8b6f('0x1f')](_0x51a7eb['query'][_0x8b6f('0x1f')]);_0x3c493a['offset']=qs['offset'](_0x51a7eb['query']['offset']);}_0x3c493a[_0x8b6f('0x36')]=qs[_0x8b6f('0x37')](_0x51a7eb[_0x8b6f('0x31')][_0x8b6f('0x37')]);_0x3c493a[_0x8b6f('0x38')]=qs[_0x8b6f('0x2f')](_['pick'](_0x51a7eb[_0x8b6f('0x31')],_0x262083[_0x8b6f('0x2f')]),_0x39db89);if(_0x51a7eb[_0x8b6f('0x31')][_0x8b6f('0x39')]){_0x3c493a[_0x8b6f('0x38')]=_[_0x8b6f('0x3a')](_0x3c493a[_0x8b6f('0x38')],{'$or':_[_0x8b6f('0x2d')](_0x39db89,function(_0x2e4baa){if(_0x2e4baa[_0x8b6f('0x2b')]!==_0x8b6f('0x3b')){var _0x208c2e={};_0x208c2e[_0x2e4baa[_0x8b6f('0x26')]]={'$like':'%'+_0x51a7eb[_0x8b6f('0x31')]['filter']+'%'};return _0x208c2e;}})});}_0x3c493a=_[_0x8b6f('0x3a')]({},_0x3c493a,_0x51a7eb[_0x8b6f('0x3c')]);var _0x567402={'where':_0x3c493a[_0x8b6f('0x38')]};return db['SmsQueueReport'][_0x8b6f('0x20')](_0x567402)['then'](function(_0xcf4da8){_0x24382e['count']=_0xcf4da8;if(_0x51a7eb[_0x8b6f('0x31')]['includeAll']){_0x3c493a[_0x8b6f('0x3d')]=[{'all':!![]}];}return db[_0x8b6f('0x28')]['findAll'](_0x3c493a);})[_0x8b6f('0x3e')](function(_0x187d07){_0x24382e[_0x8b6f('0x3f')]=_0x187d07;return _0x24382e;})[_0x8b6f('0x3e')](respondWithFilteredResult(_0xc5bc75,_0x3c493a))[_0x8b6f('0x40')](handleError(_0xc5bc75,null));};exports[_0x8b6f('0x41')]=function(_0x7e4f09,_0x45ae7d){var _0x12a3e9={'raw':!![],'where':{'id':_0x7e4f09[_0x8b6f('0x42')]['id']}},_0x31f86c={};_0x31f86c['model']=_[_0x8b6f('0x2e')](db[_0x8b6f('0x28')][_0x8b6f('0x29')]);_0x31f86c[_0x8b6f('0x31')]=_[_0x8b6f('0x2e')](_0x7e4f09['query']);_0x31f86c['filters']=_[_0x8b6f('0x30')](_0x31f86c[_0x8b6f('0x2c')],_0x31f86c[_0x8b6f('0x31')]);_0x12a3e9['attributes']=_[_0x8b6f('0x30')](_0x31f86c[_0x8b6f('0x2c')],qs[_0x8b6f('0x33')](_0x7e4f09['query']['fields']));_0x12a3e9['attributes']=_0x12a3e9[_0x8b6f('0x32')]['length']?_0x12a3e9['attributes']:_0x31f86c['model'];if(_0x7e4f09[_0x8b6f('0x31')]['includeAll']){_0x12a3e9[_0x8b6f('0x3d')]=[{'all':!![]}];}_0x12a3e9=_['merge']({},_0x12a3e9,_0x7e4f09[_0x8b6f('0x3c')]);return db[_0x8b6f('0x28')][_0x8b6f('0x43')](_0x12a3e9)[_0x8b6f('0x3e')](handleEntityNotFound(_0x45ae7d,null))[_0x8b6f('0x3e')](respondWithResult(_0x45ae7d,null))[_0x8b6f('0x40')](handleError(_0x45ae7d,null));};exports[_0x8b6f('0x44')]=function(_0x511a25,_0x285177){return db[_0x8b6f('0x28')][_0x8b6f('0x44')](_0x511a25[_0x8b6f('0x45')],{})['then'](respondWithResult(_0x285177,0xc9))[_0x8b6f('0x40')](handleError(_0x285177,null));};exports[_0x8b6f('0x22')]=function(_0x1f22e4,_0x5cbd7f){if(_0x1f22e4[_0x8b6f('0x45')]['id']){delete _0x1f22e4['body']['id'];}return db[_0x8b6f('0x28')][_0x8b6f('0x43')]({'where':{'id':_0x1f22e4[_0x8b6f('0x42')]['id']}})[_0x8b6f('0x3e')](handleEntityNotFound(_0x5cbd7f,null))['then'](saveUpdates(_0x1f22e4[_0x8b6f('0x45')],null))[_0x8b6f('0x3e')](respondWithResult(_0x5cbd7f,null))[_0x8b6f('0x40')](handleError(_0x5cbd7f,null));};exports['destroy']=function(_0x38100e,_0x4c9477){return db[_0x8b6f('0x28')][_0x8b6f('0x43')]({'where':{'id':_0x38100e['params']['id']}})[_0x8b6f('0x3e')](handleEntityNotFound(_0x4c9477,null))[_0x8b6f('0x3e')](removeEntity(_0x4c9477,null))['catch'](handleError(_0x4c9477,null));};exports[_0x8b6f('0x46')]=function(_0x23f57f,_0x2f6670){return db[_0x8b6f('0x28')]['describe']()[_0x8b6f('0x3e')](respondWithResult(_0x2f6670,null))[_0x8b6f('0x40')](handleError(_0x2f6670,null));}; \ No newline at end of file +var _0xbfed=['fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','type','VIRTUAL','count','includeAll','findAll','rows','catch','show','params','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','fs-extra','lodash','squel','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','offset','undefined','limit','set','Content-Range','apply','reject','update','destroy','then','error','stack','name','index','SmsQueueReport','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes'];(function(_0x1b4732,_0x12ddb4){var _0x49d549=function(_0x571f41){while(--_0x571f41){_0x1b4732['push'](_0x1b4732['shift']());}};_0x49d549(++_0x12ddb4);}(_0xbfed,0x1c6));var _0xdbfe=function(_0x2aefb6,_0x1bd384){_0x2aefb6=_0x2aefb6-0x0;var _0x202772=_0xbfed[_0x2aefb6];return _0x202772;};'use strict';var emlformat=require(_0xdbfe('0x0'));var rimraf=require(_0xdbfe('0x1'));var zipdir=require(_0xdbfe('0x2'));var jsonpatch=require(_0xdbfe('0x3'));var rp=require(_0xdbfe('0x4'));var moment=require(_0xdbfe('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xdbfe('0x6'));var path=require(_0xdbfe('0x7'));var sox=require(_0xdbfe('0x8'));var csv=require(_0xdbfe('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xdbfe('0xa'));var _=require(_0xdbfe('0xb'));var squel=require(_0xdbfe('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xdbfe('0x9'));var querystring=require(_0xdbfe('0xd'));var Papa=require(_0xdbfe('0xe'));var Redis=require(_0xdbfe('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xdbfe('0x10'));var as=require(_0xdbfe('0x11'));var hardwareService=require(_0xdbfe('0x12'));var logger=require(_0xdbfe('0x13'))('api');var utils=require(_0xdbfe('0x14'));var config=require(_0xdbfe('0x15'));var licenseUtil=require(_0xdbfe('0x16'));var db=require(_0xdbfe('0x17'))['db'];function respondWithStatusCode(_0x4ae880,_0x543ae6){_0x543ae6=_0x543ae6||0xcc;return function(_0x554dd1){if(_0x554dd1){return _0x4ae880['sendStatus'](_0x543ae6);}return _0x4ae880[_0xdbfe('0x18')](_0x543ae6)['end']();};}function respondWithResult(_0x5b28a3,_0x3d5912){_0x3d5912=_0x3d5912||0xc8;return function(_0x229272){if(_0x229272){return _0x5b28a3[_0xdbfe('0x18')](_0x3d5912)['json'](_0x229272);}};}function respondWithFilteredResult(_0xf413e,_0x3024de){return function(_0x14451a){if(_0x14451a){var _0x46448f=typeof _0x3024de[_0xdbfe('0x19')]===_0xdbfe('0x1a')&&typeof _0x3024de[_0xdbfe('0x1b')]==='undefined';var _0x20fd2e=_0x14451a['count'];var _0x2d97cc=_0x46448f?0x0:_0x3024de['offset'];var _0x1ea463=_0x46448f?_0x14451a['count']:_0x3024de['offset']+_0x3024de[_0xdbfe('0x1b')];var _0x4c579d;if(_0x1ea463>=_0x20fd2e){_0x1ea463=_0x20fd2e;_0x4c579d=0xc8;}else{_0x4c579d=0xce;}_0xf413e[_0xdbfe('0x18')](_0x4c579d);return _0xf413e[_0xdbfe('0x1c')](_0xdbfe('0x1d'),_0x2d97cc+'-'+_0x1ea463+'/'+_0x20fd2e)['json'](_0x14451a);}return null;};}function patchUpdates(_0x882dbf){return function(_0xd4dcef){try{jsonpatch[_0xdbfe('0x1e')](_0xd4dcef,_0x882dbf,!![]);}catch(_0x832bff){return BPromise[_0xdbfe('0x1f')](_0x832bff);}return _0xd4dcef['save']();};}function saveUpdates(_0xe43d77,_0x444d4c){return function(_0x4b4aaa){if(_0x4b4aaa){return _0x4b4aaa[_0xdbfe('0x20')](_0xe43d77)['then'](function(_0x5cad50){return _0x5cad50;});}return null;};}function removeEntity(_0x5c97c3,_0x1d6b19){return function(_0x577baf){if(_0x577baf){return _0x577baf[_0xdbfe('0x21')]()[_0xdbfe('0x22')](function(){_0x5c97c3[_0xdbfe('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1311ac,_0x16ecd5){return function(_0x41c371){if(!_0x41c371){_0x1311ac['sendStatus'](0x194);}return _0x41c371;};}function handleError(_0x5d4a12,_0x5a0dd3){_0x5a0dd3=_0x5a0dd3||0x1f4;return function(_0x214445){logger[_0xdbfe('0x23')](_0x214445[_0xdbfe('0x24')]);if(_0x214445[_0xdbfe('0x25')]){delete _0x214445['name'];}_0x5d4a12[_0xdbfe('0x18')](_0x5a0dd3)['send'](_0x214445);};}exports[_0xdbfe('0x26')]=function(_0x3f3d25,_0xf14cb2){var _0x3c0594={},_0x128998={},_0x1942b8={'count':0x0,'rows':[]};var _0x1d14dd=_['map'](db[_0xdbfe('0x27')][_0xdbfe('0x28')],function(_0x361e6f){return{'name':_0x361e6f[_0xdbfe('0x29')],'type':_0x361e6f['type'][_0xdbfe('0x2a')]};});_0x128998[_0xdbfe('0x2b')]=_[_0xdbfe('0x2c')](_0x1d14dd,'name');_0x128998[_0xdbfe('0x2d')]=_[_0xdbfe('0x2e')](_0x3f3d25[_0xdbfe('0x2d')]);_0x128998[_0xdbfe('0x2f')]=_[_0xdbfe('0x30')](_0x128998['model'],_0x128998[_0xdbfe('0x2d')]);_0x3c0594[_0xdbfe('0x31')]=_[_0xdbfe('0x30')](_0x128998[_0xdbfe('0x2b')],qs[_0xdbfe('0x32')](_0x3f3d25[_0xdbfe('0x2d')][_0xdbfe('0x32')]));_0x3c0594[_0xdbfe('0x31')]=_0x3c0594[_0xdbfe('0x31')][_0xdbfe('0x33')]?_0x3c0594[_0xdbfe('0x31')]:_0x128998[_0xdbfe('0x2b')];if(!_0x3f3d25['query'][_0xdbfe('0x34')](_0xdbfe('0x35'))){_0x3c0594[_0xdbfe('0x1b')]=qs['limit'](_0x3f3d25[_0xdbfe('0x2d')][_0xdbfe('0x1b')]);_0x3c0594[_0xdbfe('0x19')]=qs[_0xdbfe('0x19')](_0x3f3d25['query'][_0xdbfe('0x19')]);}_0x3c0594[_0xdbfe('0x36')]=qs['sort'](_0x3f3d25['query'][_0xdbfe('0x37')]);_0x3c0594['where']=qs[_0xdbfe('0x2f')](_['pick'](_0x3f3d25[_0xdbfe('0x2d')],_0x128998['filters']),_0x1d14dd);if(_0x3f3d25[_0xdbfe('0x2d')][_0xdbfe('0x38')]){_0x3c0594[_0xdbfe('0x39')]=_[_0xdbfe('0x3a')](_0x3c0594[_0xdbfe('0x39')],{'$or':_[_0xdbfe('0x2c')](_0x1d14dd,function(_0xd3716c){if(_0xd3716c[_0xdbfe('0x3b')]!==_0xdbfe('0x3c')){var _0x32a6a9={};_0x32a6a9[_0xd3716c[_0xdbfe('0x25')]]={'$like':'%'+_0x3f3d25['query'][_0xdbfe('0x38')]+'%'};return _0x32a6a9;}})});}_0x3c0594=_[_0xdbfe('0x3a')]({},_0x3c0594,_0x3f3d25['options']);var _0x4f4ede={'where':_0x3c0594['where']};return db[_0xdbfe('0x27')][_0xdbfe('0x3d')](_0x4f4ede)['then'](function(_0x210a5a){_0x1942b8[_0xdbfe('0x3d')]=_0x210a5a;if(_0x3f3d25[_0xdbfe('0x2d')][_0xdbfe('0x3e')]){_0x3c0594['include']=[{'all':!![]}];}return db[_0xdbfe('0x27')][_0xdbfe('0x3f')](_0x3c0594);})[_0xdbfe('0x22')](function(_0x2184dd){_0x1942b8[_0xdbfe('0x40')]=_0x2184dd;return _0x1942b8;})[_0xdbfe('0x22')](respondWithFilteredResult(_0xf14cb2,_0x3c0594))[_0xdbfe('0x41')](handleError(_0xf14cb2,null));};exports[_0xdbfe('0x42')]=function(_0xc1d2bb,_0x4ece43){var _0x131ece={'raw':!![],'where':{'id':_0xc1d2bb[_0xdbfe('0x43')]['id']}},_0x54451f={};_0x54451f[_0xdbfe('0x2b')]=_[_0xdbfe('0x2e')](db['SmsQueueReport'][_0xdbfe('0x28')]);_0x54451f[_0xdbfe('0x2d')]=_[_0xdbfe('0x2e')](_0xc1d2bb['query']);_0x54451f['filters']=_[_0xdbfe('0x30')](_0x54451f[_0xdbfe('0x2b')],_0x54451f[_0xdbfe('0x2d')]);_0x131ece[_0xdbfe('0x31')]=_[_0xdbfe('0x30')](_0x54451f['model'],qs[_0xdbfe('0x32')](_0xc1d2bb['query'][_0xdbfe('0x32')]));_0x131ece[_0xdbfe('0x31')]=_0x131ece[_0xdbfe('0x31')][_0xdbfe('0x33')]?_0x131ece[_0xdbfe('0x31')]:_0x54451f['model'];if(_0xc1d2bb[_0xdbfe('0x2d')]['includeAll']){_0x131ece['include']=[{'all':!![]}];}_0x131ece=_['merge']({},_0x131ece,_0xc1d2bb['options']);return db[_0xdbfe('0x27')][_0xdbfe('0x44')](_0x131ece)[_0xdbfe('0x22')](handleEntityNotFound(_0x4ece43,null))[_0xdbfe('0x22')](respondWithResult(_0x4ece43,null))[_0xdbfe('0x41')](handleError(_0x4ece43,null));};exports['create']=function(_0x23f81f,_0x5ed8dd){return db[_0xdbfe('0x27')][_0xdbfe('0x45')](_0x23f81f[_0xdbfe('0x46')],{})[_0xdbfe('0x22')](respondWithResult(_0x5ed8dd,0xc9))[_0xdbfe('0x41')](handleError(_0x5ed8dd,null));};exports[_0xdbfe('0x20')]=function(_0x589208,_0x1a510c){if(_0x589208[_0xdbfe('0x46')]['id']){delete _0x589208['body']['id'];}return db[_0xdbfe('0x27')][_0xdbfe('0x44')]({'where':{'id':_0x589208['params']['id']}})[_0xdbfe('0x22')](handleEntityNotFound(_0x1a510c,null))[_0xdbfe('0x22')](saveUpdates(_0x589208[_0xdbfe('0x46')],null))['then'](respondWithResult(_0x1a510c,null))[_0xdbfe('0x41')](handleError(_0x1a510c,null));};exports[_0xdbfe('0x21')]=function(_0x2a9167,_0x219c98){return db['SmsQueueReport'][_0xdbfe('0x44')]({'where':{'id':_0x2a9167[_0xdbfe('0x43')]['id']}})[_0xdbfe('0x22')](handleEntityNotFound(_0x219c98,null))['then'](removeEntity(_0x219c98,null))[_0xdbfe('0x41')](handleError(_0x219c98,null));};exports[_0xdbfe('0x47')]=function(_0x38f136,_0x1e2230){return db[_0xdbfe('0x27')][_0xdbfe('0x47')]()[_0xdbfe('0x22')](respondWithResult(_0x1e2230,null))['catch'](handleError(_0x1e2230,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index c9e571e..7b06243 100644 --- a/server/api/smsQueueReport/smsQueueReport.model.js +++ b/server/api/smsQueueReport/smsQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./smsQueueReport.attributes','exports','define','SmsQueueReport','report_sms_queue','uniqueid'];(function(_0x460666,_0x24bfa0){var _0x555cbf=function(_0x3b4743){while(--_0x3b4743){_0x460666['push'](_0x460666['shift']());}};_0x555cbf(++_0x24bfa0);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3071('0x0'))(_0x3071('0x1'));var moment=require(_0x3071('0x2'));var BPromise=require(_0x3071('0x3'));var rp=require(_0x3071('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var attributes=require(_0x3071('0x7'));module[_0x3071('0x8')]=function(_0xabd7b6,_0x41cf76){return _0xabd7b6[_0x3071('0x9')](_0x3071('0xa'),attributes,{'tableName':_0x3071('0xb'),'paranoid':![],'indexes':[{'name':_0x3071('0xc'),'fields':[_0x3071('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb7e7=['../../config/logger','moment','request-promise','rimraf','../../config/environment','./smsQueueReport.attributes','define','SmsQueueReport','uniqueid','lodash'];(function(_0x57f725,_0x57a743){var _0x10a7fc=function(_0x5d0b67){while(--_0x5d0b67){_0x57f725['push'](_0x57f725['shift']());}};_0x10a7fc(++_0x57a743);}(_0xb7e7,0x121));var _0x7b7e=function(_0x2f1762,_0xab43df){_0x2f1762=_0x2f1762-0x0;var _0x8ab21=_0xb7e7[_0x2f1762];return _0x8ab21;};'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_sms_queue','paranoid':![],'indexes':[{'name':_0x7b7e('0x9'),'fields':[_0x7b7e('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index 7f1fdf1..16c2404 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 _0x42dc=['raw','debug','catch','UpdateSmsQueueReport','body','where','attributes','limit','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','CreateSmsQueueReport','SmsQueueReport','create','options'];(function(_0x39bcdf,_0x57a1d0){var _0x56e8a2=function(_0x544e50){while(--_0x544e50){_0x39bcdf['push'](_0x39bcdf['shift']());}};_0x56e8a2(++_0x57a1d0);}(_0x42dc,0x173));var _0xc42d=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x42dc[_0xbca1b1];return _0x4e1686;};'use strict';var _=require('lodash');var util=require(_0xc42d('0x0'));var moment=require(_0xc42d('0x1'));var BPromise=require(_0xc42d('0x2'));var rs=require(_0xc42d('0x3'));var fs=require('fs');var Redis=require(_0xc42d('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xc42d('0x5'));var logger=require(_0xc42d('0x6'))(_0xc42d('0x7'));var config=require(_0xc42d('0x8'));var jayson=require(_0xc42d('0x9'));var client=jayson[_0xc42d('0xa')][_0xc42d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x28ca21,_0x31bffb,_0x2495ef){return new BPromise(function(_0x433632,_0x3423ba){return client[_0xc42d('0xc')](_0x28ca21,_0x2495ef)[_0xc42d('0xd')](function(_0x53c727){logger[_0xc42d('0xe')](_0xc42d('0xf'),_0x31bffb,_0xc42d('0x10'));logger['debug']('SmsQueueReport,\x20%s,\x20%s,\x20%s',_0x31bffb,'request\x20sent',JSON[_0xc42d('0x11')](_0x53c727));if(_0x53c727[_0xc42d('0x12')]){if(_0x53c727[_0xc42d('0x12')]['code']===0x1f4){logger[_0xc42d('0x12')](_0xc42d('0xf'),_0x31bffb,_0x53c727[_0xc42d('0x12')][_0xc42d('0x13')]);return _0x3423ba(_0x53c727[_0xc42d('0x12')][_0xc42d('0x13')]);}logger[_0xc42d('0x12')]('SmsQueueReport,\x20%s,\x20%s',_0x31bffb,_0x53c727['error'][_0xc42d('0x13')]);return _0x433632(_0x53c727[_0xc42d('0x12')][_0xc42d('0x13')]);}else{logger[_0xc42d('0xe')]('SmsQueueReport,\x20%s,\x20%s',_0x31bffb,_0xc42d('0x10'));_0x433632(_0x53c727[_0xc42d('0x14')]['message']);}})['catch'](function(_0x167570){logger[_0xc42d('0x12')](_0xc42d('0xf'),_0x31bffb,_0x167570);_0x3423ba(_0x167570);});});}exports[_0xc42d('0x15')]=function(_0x576db7){var _0x699639=this;return new Promise(function(_0x189da8,_0x3a2cd3){return db[_0xc42d('0x16')][_0xc42d('0x17')](_0x576db7['body'],{'raw':_0x576db7[_0xc42d('0x18')]?_0x576db7['options'][_0xc42d('0x19')]===undefined?!![]:![]:!![]})[_0xc42d('0xd')](function(_0x4f10ee){logger[_0xc42d('0xe')](_0xc42d('0x15'),_0x576db7);logger[_0xc42d('0x1a')](_0xc42d('0x15'),_0x576db7,JSON['stringify'](_0x4f10ee));_0x189da8(_0x4f10ee);})[_0xc42d('0x1b')](function(_0xd37b50){logger[_0xc42d('0x12')](_0xc42d('0x15'),_0xd37b50[_0xc42d('0x13')],_0x576db7);_0x3a2cd3(_0x699639[_0xc42d('0x12')](0x1f4,_0xd37b50[_0xc42d('0x13')]));});});};exports[_0xc42d('0x1c')]=function(_0x577820){var _0x450097=this;return new Promise(function(_0x3e2550,_0x59a3da){return db[_0xc42d('0x16')]['update'](_0x577820[_0xc42d('0x1d')],{'raw':_0x577820['options']?_0x577820['options'][_0xc42d('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x577820[_0xc42d('0x18')]?_0x577820[_0xc42d('0x18')][_0xc42d('0x1e')]||null:null,'attributes':_0x577820['options']?_0x577820[_0xc42d('0x18')][_0xc42d('0x1f')]||null:null,'limit':_0x577820[_0xc42d('0x18')]?_0x577820['options'][_0xc42d('0x20')]||null:null})['then'](function(_0x1930cf){logger[_0xc42d('0xe')](_0xc42d('0x1c'),_0x577820);logger[_0xc42d('0x1a')](_0xc42d('0x1c'),_0x577820,JSON[_0xc42d('0x11')](_0x1930cf));_0x3e2550(_0x1930cf);})[_0xc42d('0x1b')](function(_0x408d24){logger['error'](_0xc42d('0x1c'),_0x408d24[_0xc42d('0x13')],_0x577820);_0x59a3da(_0x450097['error'](0x1f4,_0x408d24['message']));});});}; \ No newline at end of file +var _0x9fb2=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','error','message','catch','CreateSmsQueueReport','create','body','options','then','UpdateSmsQueueReport','SmsQueueReport','update','raw','attributes','stringify','lodash','util'];(function(_0x504ee4,_0x5e09fe){var _0x380b09=function(_0x201bc4){while(--_0x201bc4){_0x504ee4['push'](_0x504ee4['shift']());}};_0x380b09(++_0x5e09fe);}(_0x9fb2,0xd0));var _0x29fb=function(_0x483a68,_0x2acc85){_0x483a68=_0x483a68-0x0;var _0x5d8176=_0x9fb2[_0x483a68];return _0x5d8176;};'use strict';var _=require(_0x29fb('0x0'));var util=require(_0x29fb('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x29fb('0x2'));var fs=require('fs');var Redis=require(_0x29fb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x29fb('0x4'));var logger=require(_0x29fb('0x5'))(_0x29fb('0x6'));var config=require(_0x29fb('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x29fb('0x8')][_0x29fb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3d066d,_0x39ffe5,_0x17673d){return new BPromise(function(_0x21ca2a,_0x445283){return client[_0x29fb('0xa')](_0x3d066d,_0x17673d)['then'](function(_0x319d5c){logger[_0x29fb('0xb')](_0x29fb('0xc'),_0x39ffe5,_0x29fb('0xd'));logger[_0x29fb('0xe')](_0x29fb('0xf'),_0x39ffe5,_0x29fb('0xd'),JSON['stringify'](_0x319d5c));if(_0x319d5c[_0x29fb('0x10')]){if(_0x319d5c['error']['code']===0x1f4){logger[_0x29fb('0x10')](_0x29fb('0xc'),_0x39ffe5,_0x319d5c[_0x29fb('0x10')][_0x29fb('0x11')]);return _0x445283(_0x319d5c['error'][_0x29fb('0x11')]);}logger[_0x29fb('0x10')]('SmsQueueReport,\x20%s,\x20%s',_0x39ffe5,_0x319d5c[_0x29fb('0x10')][_0x29fb('0x11')]);return _0x21ca2a(_0x319d5c[_0x29fb('0x10')][_0x29fb('0x11')]);}else{logger[_0x29fb('0xb')](_0x29fb('0xc'),_0x39ffe5,_0x29fb('0xd'));_0x21ca2a(_0x319d5c['result'][_0x29fb('0x11')]);}})[_0x29fb('0x12')](function(_0x2342e1){logger[_0x29fb('0x10')](_0x29fb('0xc'),_0x39ffe5,_0x2342e1);_0x445283(_0x2342e1);});});}exports[_0x29fb('0x13')]=function(_0xa8903d){var _0x371474=this;return new Promise(function(_0x5b9f44,_0x136c52){return db['SmsQueueReport'][_0x29fb('0x14')](_0xa8903d[_0x29fb('0x15')],{'raw':_0xa8903d['options']?_0xa8903d[_0x29fb('0x16')]['raw']===undefined?!![]:![]:!![]})[_0x29fb('0x17')](function(_0xaef698){logger[_0x29fb('0xb')](_0x29fb('0x13'),_0xa8903d);logger['debug'](_0x29fb('0x13'),_0xa8903d,JSON['stringify'](_0xaef698));_0x5b9f44(_0xaef698);})[_0x29fb('0x12')](function(_0xbba100){logger[_0x29fb('0x10')](_0x29fb('0x13'),_0xbba100[_0x29fb('0x11')],_0xa8903d);_0x136c52(_0x371474['error'](0x1f4,_0xbba100[_0x29fb('0x11')]));});});};exports[_0x29fb('0x18')]=function(_0x1dc33f){var _0x5f5159=this;return new Promise(function(_0x24768d,_0x506a3c){return db[_0x29fb('0x19')][_0x29fb('0x1a')](_0x1dc33f[_0x29fb('0x15')],{'raw':_0x1dc33f[_0x29fb('0x16')]?_0x1dc33f[_0x29fb('0x16')][_0x29fb('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1dc33f[_0x29fb('0x16')]?_0x1dc33f[_0x29fb('0x16')]['where']||null:null,'attributes':_0x1dc33f['options']?_0x1dc33f[_0x29fb('0x16')][_0x29fb('0x1c')]||null:null,'limit':_0x1dc33f['options']?_0x1dc33f['options']['limit']||null:null})[_0x29fb('0x17')](function(_0x512743){logger[_0x29fb('0xb')](_0x29fb('0x18'),_0x1dc33f);logger[_0x29fb('0xe')](_0x29fb('0x18'),_0x1dc33f,JSON[_0x29fb('0x1d')](_0x512743));_0x24768d(_0x512743);})['catch'](function(_0x15cc9a){logger[_0x29fb('0x10')]('UpdateSmsQueueReport',_0x15cc9a[_0x29fb('0x11')],_0x1dc33f);_0x506a3c(_0x5f5159[_0x29fb('0x10')](0x1f4,_0x15cc9a[_0x29fb('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index 6987e46..5ca11ba 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 _0x6075=['/:id','post','create','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe'];(function(_0x5ecadc,_0x1cf9f1){var _0x565037=function(_0x22908b){while(--_0x22908b){_0x5ecadc['push'](_0x5ecadc['shift']());}};_0x565037(++_0x1cf9f1);}(_0x6075,0x191));var _0x5607=function(_0x28d591,_0x188a4f){_0x28d591=_0x28d591-0x0;var _0x2f733f=_0x6075[_0x28d591];return _0x2f733f;};'use strict';var multer=require('multer');var util=require(_0x5607('0x0'));var path=require(_0x5607('0x1'));var timeout=require(_0x5607('0x2'));var express=require(_0x5607('0x3'));var router=express[_0x5607('0x4')]();var fs_extra=require(_0x5607('0x5'));var auth=require(_0x5607('0x6'));var interaction=require(_0x5607('0x7'));var config=require(_0x5607('0x8'));var controller=require('./smsTransferReport.controller');router[_0x5607('0x9')]('/',auth[_0x5607('0xa')](),controller[_0x5607('0xb')]);router['get']('/describe',auth[_0x5607('0xa')](),controller[_0x5607('0xc')]);router[_0x5607('0x9')](_0x5607('0xd'),auth[_0x5607('0xa')](),controller['show']);router[_0x5607('0xe')]('/',auth[_0x5607('0xa')](),controller[_0x5607('0xf')]);router['put'](_0x5607('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x5607('0x10')](_0x5607('0xd'),auth[_0x5607('0xa')](),controller['destroy']);module[_0x5607('0x11')]=router; \ No newline at end of file +var _0x6075=['/:id','post','create','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x6075,0x191));var _0x5607=function(_0x355582,_0x190b70){_0x355582=_0x355582-0x0;var _0x5f386b=_0x6075[_0x355582];return _0x5f386b;};'use strict';var multer=require('multer');var util=require(_0x5607('0x0'));var path=require(_0x5607('0x1'));var timeout=require(_0x5607('0x2'));var express=require(_0x5607('0x3'));var router=express[_0x5607('0x4')]();var fs_extra=require(_0x5607('0x5'));var auth=require(_0x5607('0x6'));var interaction=require(_0x5607('0x7'));var config=require(_0x5607('0x8'));var controller=require('./smsTransferReport.controller');router[_0x5607('0x9')]('/',auth[_0x5607('0xa')](),controller[_0x5607('0xb')]);router['get']('/describe',auth[_0x5607('0xa')](),controller[_0x5607('0xc')]);router[_0x5607('0x9')](_0x5607('0xd'),auth[_0x5607('0xa')](),controller['show']);router[_0x5607('0xe')]('/',auth[_0x5607('0xa')](),controller[_0x5607('0xf')]);router['put'](_0x5607('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x5607('0x10')](_0x5607('0xd'),auth[_0x5607('0xa')](),controller['destroy']);module[_0x5607('0x11')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index 51f72a8..46dc99c 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 _0xb43b=['DATE','NOW','moment','sequelize','STRING','ENUM','account','queue'];(function(_0x4d180c,_0x45c68e){var _0x49b57e=function(_0x264741){while(--_0x264741){_0x4d180c['push'](_0x4d180c['shift']());}};_0x49b57e(++_0x45c68e);}(_0xb43b,0x1b2));var _0xbb43=function(_0x379c17,_0x1b5790){_0x379c17=_0x379c17-0x0;var _0x56a95e=_0xb43b[_0x379c17];return _0x56a95e;};'use strict';var moment=require(_0xbb43('0x0'));var Sequelize=require(_0xbb43('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xbb43('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xbb43('0x3')](_0xbb43('0x4'),'agent',_0xbb43('0x5')),'allowNull':![],'defaultValue':_0xbb43('0x5')},'transferredAt':{'type':Sequelize[_0xbb43('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xbb43('0x7')]}}; \ No newline at end of file +var _0x008c=['ENUM','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x4a752b,_0x1a8b9a){var _0x4696a4=function(_0x7bfe56){while(--_0x7bfe56){_0x4a752b['push'](_0x4a752b['shift']());}};_0x4696a4(++_0x1a8b9a);}(_0x008c,0x188));var _0xc008=function(_0x26c26c,_0x39f9cf){_0x26c26c=_0x26c26c-0x0;var _0x153b04=_0x008c[_0x26c26c];return _0x153b04;};'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/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index e4ec1c6..bef0b91 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 _0x0d50=['attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','SmsTransferReport','count','includeAll','findAll','rows','catch','show','include','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','Content-Range','reject','save','update','then','destroy','end','error','stack','name','send','rawAttributes','type','key','model','map','keys','query','filters','intersection','fields'];(function(_0x197a7b,_0x2785cd){var _0x2f853c=function(_0x50d160){while(--_0x50d160){_0x197a7b['push'](_0x197a7b['shift']());}};_0x2f853c(++_0x2785cd);}(_0x0d50,0x140));var _0x00d5=function(_0x1a48f2,_0x5d2109){_0x1a48f2=_0x1a48f2-0x0;var _0x2b46c6=_0x0d50[_0x1a48f2];return _0x2b46c6;};'use strict';var emlformat=require(_0x00d5('0x0'));var rimraf=require(_0x00d5('0x1'));var zipdir=require(_0x00d5('0x2'));var jsonpatch=require(_0x00d5('0x3'));var rp=require('request-promise');var moment=require(_0x00d5('0x4'));var BPromise=require(_0x00d5('0x5'));var Mustache=require(_0x00d5('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x00d5('0x7'));var ejs=require(_0x00d5('0x8'));var fs=require('fs');var fs_extra=require(_0x00d5('0x9'));var _=require(_0x00d5('0xa'));var squel=require(_0x00d5('0xb'));var crypto=require(_0x00d5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x00d5('0xd'));var toCsv=require('to-csv');var querystring=require(_0x00d5('0xe'));var Papa=require(_0x00d5('0xf'));var Redis=require('ioredis');var authService=require(_0x00d5('0x10'));var qs=require(_0x00d5('0x11'));var as=require(_0x00d5('0x12'));var hardwareService=require(_0x00d5('0x13'));var logger=require(_0x00d5('0x14'))('api');var utils=require(_0x00d5('0x15'));var config=require(_0x00d5('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x00d5('0x17'))['db'];function respondWithStatusCode(_0x1899a3,_0x18c522){_0x18c522=_0x18c522||0xcc;return function(_0xe2497d){if(_0xe2497d){return _0x1899a3[_0x00d5('0x18')](_0x18c522);}return _0x1899a3[_0x00d5('0x19')](_0x18c522)['end']();};}function respondWithResult(_0x47fa3b,_0x113c49){_0x113c49=_0x113c49||0xc8;return function(_0x3ef106){if(_0x3ef106){return _0x47fa3b['status'](_0x113c49)[_0x00d5('0x1a')](_0x3ef106);}};}function respondWithFilteredResult(_0x4e19ce,_0x229386){return function(_0x35cd16){if(_0x35cd16){var _0x28669e=typeof _0x229386['offset']==='undefined'&&typeof _0x229386['limit']==='undefined';var _0x44e1b3=_0x35cd16['count'];var _0x116476=_0x28669e?0x0:_0x229386[_0x00d5('0x1b')];var _0x8e6b0a=_0x28669e?_0x35cd16['count']:_0x229386[_0x00d5('0x1b')]+_0x229386[_0x00d5('0x1c')];var _0x3634c0;if(_0x8e6b0a>=_0x44e1b3){_0x8e6b0a=_0x44e1b3;_0x3634c0=0xc8;}else{_0x3634c0=0xce;}_0x4e19ce['status'](_0x3634c0);return _0x4e19ce['set'](_0x00d5('0x1d'),_0x116476+'-'+_0x8e6b0a+'/'+_0x44e1b3)[_0x00d5('0x1a')](_0x35cd16);}return null;};}function patchUpdates(_0x5a3855){return function(_0x4ecc57){try{jsonpatch['apply'](_0x4ecc57,_0x5a3855,!![]);}catch(_0x481ee3){return BPromise[_0x00d5('0x1e')](_0x481ee3);}return _0x4ecc57[_0x00d5('0x1f')]();};}function saveUpdates(_0x55a46d,_0x4a0abd){return function(_0x590ce9){if(_0x590ce9){return _0x590ce9[_0x00d5('0x20')](_0x55a46d)[_0x00d5('0x21')](function(_0x36e164){return _0x36e164;});}return null;};}function removeEntity(_0x20168e,_0xd5760f){return function(_0x1c1634){if(_0x1c1634){return _0x1c1634[_0x00d5('0x22')]()[_0x00d5('0x21')](function(){_0x20168e[_0x00d5('0x19')](0xcc)[_0x00d5('0x23')]();});}};}function handleEntityNotFound(_0x58f732,_0x23c3e2){return function(_0x20c178){if(!_0x20c178){_0x58f732[_0x00d5('0x18')](0x194);}return _0x20c178;};}function handleError(_0x4839aa,_0x139112){_0x139112=_0x139112||0x1f4;return function(_0xc1a02a){logger[_0x00d5('0x24')](_0xc1a02a[_0x00d5('0x25')]);if(_0xc1a02a[_0x00d5('0x26')]){delete _0xc1a02a[_0x00d5('0x26')];}_0x4839aa['status'](_0x139112)[_0x00d5('0x27')](_0xc1a02a);};}exports['index']=function(_0x499417,_0x375a88){var _0xf4dc2d={},_0x577ab0={},_0x474ae7={'count':0x0,'rows':[]};var _0x35a0a0=_['map'](db['SmsTransferReport'][_0x00d5('0x28')],function(_0xdab83d){return{'name':_0xdab83d['fieldName'],'type':_0xdab83d[_0x00d5('0x29')][_0x00d5('0x2a')]};});_0x577ab0[_0x00d5('0x2b')]=_[_0x00d5('0x2c')](_0x35a0a0,'name');_0x577ab0['query']=_[_0x00d5('0x2d')](_0x499417[_0x00d5('0x2e')]);_0x577ab0[_0x00d5('0x2f')]=_[_0x00d5('0x30')](_0x577ab0[_0x00d5('0x2b')],_0x577ab0['query']);_0xf4dc2d['attributes']=_[_0x00d5('0x30')](_0x577ab0[_0x00d5('0x2b')],qs[_0x00d5('0x31')](_0x499417[_0x00d5('0x2e')]['fields']));_0xf4dc2d[_0x00d5('0x32')]=_0xf4dc2d[_0x00d5('0x32')][_0x00d5('0x33')]?_0xf4dc2d['attributes']:_0x577ab0[_0x00d5('0x2b')];if(!_0x499417[_0x00d5('0x2e')][_0x00d5('0x34')](_0x00d5('0x35'))){_0xf4dc2d[_0x00d5('0x1c')]=qs[_0x00d5('0x1c')](_0x499417[_0x00d5('0x2e')][_0x00d5('0x1c')]);_0xf4dc2d['offset']=qs['offset'](_0x499417[_0x00d5('0x2e')][_0x00d5('0x1b')]);}_0xf4dc2d[_0x00d5('0x36')]=qs['sort'](_0x499417['query'][_0x00d5('0x37')]);_0xf4dc2d[_0x00d5('0x38')]=qs[_0x00d5('0x2f')](_[_0x00d5('0x39')](_0x499417[_0x00d5('0x2e')],_0x577ab0['filters']),_0x35a0a0);if(_0x499417['query'][_0x00d5('0x3a')]){_0xf4dc2d['where']=_[_0x00d5('0x3b')](_0xf4dc2d['where'],{'$or':_[_0x00d5('0x2c')](_0x35a0a0,function(_0xb48a21){if(_0xb48a21[_0x00d5('0x29')]!==_0x00d5('0x3c')){var _0x509938={};_0x509938[_0xb48a21[_0x00d5('0x26')]]={'$like':'%'+_0x499417[_0x00d5('0x2e')]['filter']+'%'};return _0x509938;}})});}_0xf4dc2d=_[_0x00d5('0x3b')]({},_0xf4dc2d,_0x499417[_0x00d5('0x3d')]);var _0x8ec7e6={'where':_0xf4dc2d['where']};return db[_0x00d5('0x3e')][_0x00d5('0x3f')](_0x8ec7e6)[_0x00d5('0x21')](function(_0x331638){_0x474ae7[_0x00d5('0x3f')]=_0x331638;if(_0x499417[_0x00d5('0x2e')][_0x00d5('0x40')]){_0xf4dc2d['include']=[{'all':!![]}];}return db[_0x00d5('0x3e')][_0x00d5('0x41')](_0xf4dc2d);})[_0x00d5('0x21')](function(_0x1e9646){_0x474ae7[_0x00d5('0x42')]=_0x1e9646;return _0x474ae7;})['then'](respondWithFilteredResult(_0x375a88,_0xf4dc2d))[_0x00d5('0x43')](handleError(_0x375a88,null));};exports[_0x00d5('0x44')]=function(_0xe6b690,_0x32bb66){var _0x3d8849={'raw':!![],'where':{'id':_0xe6b690['params']['id']}},_0x1e66a5={};_0x1e66a5[_0x00d5('0x2b')]=_['keys'](db[_0x00d5('0x3e')]['rawAttributes']);_0x1e66a5['query']=_['keys'](_0xe6b690['query']);_0x1e66a5[_0x00d5('0x2f')]=_['intersection'](_0x1e66a5[_0x00d5('0x2b')],_0x1e66a5[_0x00d5('0x2e')]);_0x3d8849[_0x00d5('0x32')]=_[_0x00d5('0x30')](_0x1e66a5[_0x00d5('0x2b')],qs[_0x00d5('0x31')](_0xe6b690[_0x00d5('0x2e')][_0x00d5('0x31')]));_0x3d8849[_0x00d5('0x32')]=_0x3d8849[_0x00d5('0x32')][_0x00d5('0x33')]?_0x3d8849[_0x00d5('0x32')]:_0x1e66a5[_0x00d5('0x2b')];if(_0xe6b690[_0x00d5('0x2e')][_0x00d5('0x40')]){_0x3d8849[_0x00d5('0x45')]=[{'all':!![]}];}_0x3d8849=_[_0x00d5('0x3b')]({},_0x3d8849,_0xe6b690[_0x00d5('0x3d')]);return db[_0x00d5('0x3e')]['find'](_0x3d8849)[_0x00d5('0x21')](handleEntityNotFound(_0x32bb66,null))[_0x00d5('0x21')](respondWithResult(_0x32bb66,null))[_0x00d5('0x43')](handleError(_0x32bb66,null));};exports[_0x00d5('0x46')]=function(_0x32f08b,_0x5dcfb0){return db[_0x00d5('0x3e')]['create'](_0x32f08b[_0x00d5('0x47')],{})[_0x00d5('0x21')](respondWithResult(_0x5dcfb0,0xc9))[_0x00d5('0x43')](handleError(_0x5dcfb0,null));};exports[_0x00d5('0x20')]=function(_0x223e79,_0x434785){if(_0x223e79[_0x00d5('0x47')]['id']){delete _0x223e79['body']['id'];}return db[_0x00d5('0x3e')]['find']({'where':{'id':_0x223e79['params']['id']}})[_0x00d5('0x21')](handleEntityNotFound(_0x434785,null))[_0x00d5('0x21')](saveUpdates(_0x223e79[_0x00d5('0x47')],null))['then'](respondWithResult(_0x434785,null))['catch'](handleError(_0x434785,null));};exports[_0x00d5('0x22')]=function(_0x35035f,_0x102213){return db['SmsTransferReport'][_0x00d5('0x48')]({'where':{'id':_0x35035f['params']['id']}})[_0x00d5('0x21')](handleEntityNotFound(_0x102213,null))[_0x00d5('0x21')](removeEntity(_0x102213,null))[_0x00d5('0x43')](handleError(_0x102213,null));};exports[_0x00d5('0x49')]=function(_0x5418c4,_0x4e7acb){return db[_0x00d5('0x3e')][_0x00d5('0x49')]()['then'](respondWithResult(_0x4e7acb,null))[_0x00d5('0x43')](handleError(_0x4e7acb,null));}; \ No newline at end of file +var _0x8deb=['rawAttributes','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','filter','options','SmsTransferReport','includeAll','catch','show','include','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','json','apply','reject','save','update','then','destroy','sendStatus','error','name'];(function(_0x15fa77,_0x93eaff){var _0x1385ff=function(_0x165e02){while(--_0x165e02){_0x15fa77['push'](_0x15fa77['shift']());}};_0x1385ff(++_0x93eaff);}(_0x8deb,0x187));var _0xb8de=function(_0x141b7b,_0x5b1c34){_0x141b7b=_0x141b7b-0x0;var _0x1bbf2f=_0x8deb[_0x141b7b];return _0x1bbf2f;};'use strict';var emlformat=require(_0xb8de('0x0'));var rimraf=require(_0xb8de('0x1'));var zipdir=require(_0xb8de('0x2'));var jsonpatch=require(_0xb8de('0x3'));var rp=require(_0xb8de('0x4'));var moment=require(_0xb8de('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xb8de('0x6'));var sox=require(_0xb8de('0x7'));var csv=require('to-csv');var ejs=require(_0xb8de('0x8'));var fs=require('fs');var fs_extra=require(_0xb8de('0x9'));var _=require(_0xb8de('0xa'));var squel=require(_0xb8de('0xb'));var crypto=require(_0xb8de('0xc'));var jsforce=require(_0xb8de('0xd'));var deskjs=require(_0xb8de('0xe'));var toCsv=require(_0xb8de('0xf'));var querystring=require('querystring');var Papa=require(_0xb8de('0x10'));var Redis=require(_0xb8de('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xb8de('0x12'));var as=require(_0xb8de('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb8de('0x14'))(_0xb8de('0x15'));var utils=require(_0xb8de('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xb8de('0x17'));var db=require(_0xb8de('0x18'))['db'];function respondWithStatusCode(_0x4c0705,_0x1f99db){_0x1f99db=_0x1f99db||0xcc;return function(_0x101372){if(_0x101372){return _0x4c0705['sendStatus'](_0x1f99db);}return _0x4c0705[_0xb8de('0x19')](_0x1f99db)[_0xb8de('0x1a')]();};}function respondWithResult(_0x193866,_0x421632){_0x421632=_0x421632||0xc8;return function(_0x19fad4){if(_0x19fad4){return _0x193866['status'](_0x421632)['json'](_0x19fad4);}};}function respondWithFilteredResult(_0x42f18a,_0x4f2070){return function(_0x2eab0a){if(_0x2eab0a){var _0x5d6354=typeof _0x4f2070[_0xb8de('0x1b')]===_0xb8de('0x1c')&&typeof _0x4f2070[_0xb8de('0x1d')]===_0xb8de('0x1c');var _0x36b029=_0x2eab0a[_0xb8de('0x1e')];var _0x54ce58=_0x5d6354?0x0:_0x4f2070[_0xb8de('0x1b')];var _0x39cc3d=_0x5d6354?_0x2eab0a['count']:_0x4f2070[_0xb8de('0x1b')]+_0x4f2070[_0xb8de('0x1d')];var _0x3c0413;if(_0x39cc3d>=_0x36b029){_0x39cc3d=_0x36b029;_0x3c0413=0xc8;}else{_0x3c0413=0xce;}_0x42f18a[_0xb8de('0x19')](_0x3c0413);return _0x42f18a['set']('Content-Range',_0x54ce58+'-'+_0x39cc3d+'/'+_0x36b029)[_0xb8de('0x1f')](_0x2eab0a);}return null;};}function patchUpdates(_0x178d5b){return function(_0x4dee45){try{jsonpatch[_0xb8de('0x20')](_0x4dee45,_0x178d5b,!![]);}catch(_0xca946){return BPromise[_0xb8de('0x21')](_0xca946);}return _0x4dee45[_0xb8de('0x22')]();};}function saveUpdates(_0x495945,_0x124736){return function(_0x53313b){if(_0x53313b){return _0x53313b[_0xb8de('0x23')](_0x495945)[_0xb8de('0x24')](function(_0x5c6a8d){return _0x5c6a8d;});}return null;};}function removeEntity(_0x3c4994,_0x481e08){return function(_0x1ab25b){if(_0x1ab25b){return _0x1ab25b[_0xb8de('0x25')]()[_0xb8de('0x24')](function(){_0x3c4994[_0xb8de('0x19')](0xcc)[_0xb8de('0x1a')]();});}};}function handleEntityNotFound(_0x56f718,_0x3967f2){return function(_0x1c1341){if(!_0x1c1341){_0x56f718[_0xb8de('0x26')](0x194);}return _0x1c1341;};}function handleError(_0xcc3b45,_0xb26e67){_0xb26e67=_0xb26e67||0x1f4;return function(_0x336785){logger[_0xb8de('0x27')](_0x336785['stack']);if(_0x336785[_0xb8de('0x28')]){delete _0x336785[_0xb8de('0x28')];}_0xcc3b45[_0xb8de('0x19')](_0xb26e67)['send'](_0x336785);};}exports['index']=function(_0x3e3ad0,_0x545a26){var _0xd059fd={},_0x25160a={},_0x43bb0a={'count':0x0,'rows':[]};var _0x4d00e9=_['map'](db['SmsTransferReport'][_0xb8de('0x29')],function(_0x13901d){return{'name':_0x13901d[_0xb8de('0x2a')],'type':_0x13901d[_0xb8de('0x2b')][_0xb8de('0x2c')]};});_0x25160a[_0xb8de('0x2d')]=_[_0xb8de('0x2e')](_0x4d00e9,_0xb8de('0x28'));_0x25160a[_0xb8de('0x2f')]=_[_0xb8de('0x30')](_0x3e3ad0['query']);_0x25160a['filters']=_[_0xb8de('0x31')](_0x25160a[_0xb8de('0x2d')],_0x25160a['query']);_0xd059fd[_0xb8de('0x32')]=_[_0xb8de('0x31')](_0x25160a[_0xb8de('0x2d')],qs[_0xb8de('0x33')](_0x3e3ad0['query'][_0xb8de('0x33')]));_0xd059fd[_0xb8de('0x32')]=_0xd059fd[_0xb8de('0x32')]['length']?_0xd059fd['attributes']:_0x25160a[_0xb8de('0x2d')];if(!_0x3e3ad0[_0xb8de('0x2f')][_0xb8de('0x34')](_0xb8de('0x35'))){_0xd059fd[_0xb8de('0x1d')]=qs[_0xb8de('0x1d')](_0x3e3ad0['query'][_0xb8de('0x1d')]);_0xd059fd[_0xb8de('0x1b')]=qs[_0xb8de('0x1b')](_0x3e3ad0[_0xb8de('0x2f')][_0xb8de('0x1b')]);}_0xd059fd[_0xb8de('0x36')]=qs['sort'](_0x3e3ad0[_0xb8de('0x2f')][_0xb8de('0x37')]);_0xd059fd[_0xb8de('0x38')]=qs[_0xb8de('0x39')](_[_0xb8de('0x3a')](_0x3e3ad0[_0xb8de('0x2f')],_0x25160a[_0xb8de('0x39')]),_0x4d00e9);if(_0x3e3ad0[_0xb8de('0x2f')]['filter']){_0xd059fd[_0xb8de('0x38')]=_[_0xb8de('0x3b')](_0xd059fd[_0xb8de('0x38')],{'$or':_[_0xb8de('0x2e')](_0x4d00e9,function(_0x3b315e){if(_0x3b315e[_0xb8de('0x2b')]!=='VIRTUAL'){var _0x457252={};_0x457252[_0x3b315e['name']]={'$like':'%'+_0x3e3ad0['query'][_0xb8de('0x3c')]+'%'};return _0x457252;}})});}_0xd059fd=_['merge']({},_0xd059fd,_0x3e3ad0[_0xb8de('0x3d')]);var _0x3491c8={'where':_0xd059fd[_0xb8de('0x38')]};return db[_0xb8de('0x3e')][_0xb8de('0x1e')](_0x3491c8)[_0xb8de('0x24')](function(_0x45de3c){_0x43bb0a[_0xb8de('0x1e')]=_0x45de3c;if(_0x3e3ad0[_0xb8de('0x2f')][_0xb8de('0x3f')]){_0xd059fd['include']=[{'all':!![]}];}return db['SmsTransferReport']['findAll'](_0xd059fd);})[_0xb8de('0x24')](function(_0x497ae4){_0x43bb0a['rows']=_0x497ae4;return _0x43bb0a;})[_0xb8de('0x24')](respondWithFilteredResult(_0x545a26,_0xd059fd))[_0xb8de('0x40')](handleError(_0x545a26,null));};exports[_0xb8de('0x41')]=function(_0x45fc28,_0x11c04e){var _0x20ee76={'raw':!![],'where':{'id':_0x45fc28['params']['id']}},_0x5d33b5={};_0x5d33b5[_0xb8de('0x2d')]=_['keys'](db[_0xb8de('0x3e')]['rawAttributes']);_0x5d33b5['query']=_[_0xb8de('0x30')](_0x45fc28['query']);_0x5d33b5[_0xb8de('0x39')]=_['intersection'](_0x5d33b5[_0xb8de('0x2d')],_0x5d33b5[_0xb8de('0x2f')]);_0x20ee76[_0xb8de('0x32')]=_[_0xb8de('0x31')](_0x5d33b5[_0xb8de('0x2d')],qs[_0xb8de('0x33')](_0x45fc28[_0xb8de('0x2f')]['fields']));_0x20ee76[_0xb8de('0x32')]=_0x20ee76[_0xb8de('0x32')]['length']?_0x20ee76[_0xb8de('0x32')]:_0x5d33b5['model'];if(_0x45fc28[_0xb8de('0x2f')][_0xb8de('0x3f')]){_0x20ee76[_0xb8de('0x42')]=[{'all':!![]}];}_0x20ee76=_['merge']({},_0x20ee76,_0x45fc28[_0xb8de('0x3d')]);return db[_0xb8de('0x3e')][_0xb8de('0x43')](_0x20ee76)[_0xb8de('0x24')](handleEntityNotFound(_0x11c04e,null))[_0xb8de('0x24')](respondWithResult(_0x11c04e,null))[_0xb8de('0x40')](handleError(_0x11c04e,null));};exports['create']=function(_0x529c23,_0x49a5e8){return db['SmsTransferReport'][_0xb8de('0x44')](_0x529c23[_0xb8de('0x45')],{})[_0xb8de('0x24')](respondWithResult(_0x49a5e8,0xc9))[_0xb8de('0x40')](handleError(_0x49a5e8,null));};exports[_0xb8de('0x23')]=function(_0x166d9a,_0x596693){if(_0x166d9a['body']['id']){delete _0x166d9a[_0xb8de('0x45')]['id'];}return db[_0xb8de('0x3e')][_0xb8de('0x43')]({'where':{'id':_0x166d9a[_0xb8de('0x46')]['id']}})[_0xb8de('0x24')](handleEntityNotFound(_0x596693,null))['then'](saveUpdates(_0x166d9a[_0xb8de('0x45')],null))[_0xb8de('0x24')](respondWithResult(_0x596693,null))[_0xb8de('0x40')](handleError(_0x596693,null));};exports[_0xb8de('0x25')]=function(_0x25494c,_0x322fda){return db['SmsTransferReport']['find']({'where':{'id':_0x25494c[_0xb8de('0x46')]['id']}})[_0xb8de('0x24')](handleEntityNotFound(_0x322fda,null))['then'](removeEntity(_0x322fda,null))[_0xb8de('0x40')](handleError(_0x322fda,null));};exports[_0xb8de('0x47')]=function(_0xf731eb,_0x57bb19){return db[_0xb8de('0x3e')][_0xb8de('0x47')]()[_0xb8de('0x24')](respondWithResult(_0x57bb19,null))[_0xb8de('0x40')](handleError(_0x57bb19,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index b676d96..20b7078 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 _0x5c4d=['SmsTransferReport','report_sms_transfer','uniqueid','lodash','../../config/logger','request-promise','path','rimraf','./smsTransferReport.attributes','exports','define'];(function(_0x3c1099,_0x4cd808){var _0x1ae4bf=function(_0x1406fc){while(--_0x1406fc){_0x3c1099['push'](_0x3c1099['shift']());}};_0x1ae4bf(++_0x4cd808);}(_0x5c4d,0x18f));var _0xd5c4=function(_0x4c340d,_0x4b2902){_0x4c340d=_0x4c340d-0x0;var _0x33a93e=_0x5c4d[_0x4c340d];return _0x33a93e;};'use strict';var _=require(_0xd5c4('0x0'));var util=require('util');var logger=require(_0xd5c4('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xd5c4('0x2'));var fs=require('fs');var path=require(_0xd5c4('0x3'));var rimraf=require(_0xd5c4('0x4'));var config=require('../../config/environment');var attributes=require(_0xd5c4('0x5'));module[_0xd5c4('0x6')]=function(_0x204a6f,_0x422cd8){return _0x204a6f[_0xd5c4('0x7')](_0xd5c4('0x8'),attributes,{'tableName':_0xd5c4('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xd5c4('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xec2f=['define','report_sms_transfer','uniqueid','lodash','util','../../config/logger','moment','bluebird','rimraf','../../config/environment','exports'];(function(_0x156877,_0x1b99b2){var _0x161036=function(_0x5a303b){while(--_0x5a303b){_0x156877['push'](_0x156877['shift']());}};_0x161036(++_0x1b99b2);}(_0xec2f,0xa8));var _0xfec2=function(_0x53b0a3,_0x9b10c1){_0x53b0a3=_0x53b0a3-0x0;var _0x460fa7=_0xec2f[_0x53b0a3];return _0x460fa7;};'use strict';var _=require(_0xfec2('0x0'));var util=require(_0xfec2('0x1'));var logger=require(_0xfec2('0x2'))('api');var moment=require(_0xfec2('0x3'));var BPromise=require(_0xfec2('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xfec2('0x5'));var config=require(_0xfec2('0x6'));var attributes=require('./smsTransferReport.attributes');module[_0xfec2('0x7')]=function(_0x5ab50e,_0x256aa3){return _0x5ab50e[_0xfec2('0x8')]('SmsTransferReport',attributes,{'tableName':_0xfec2('0x9'),'paranoid':![],'indexes':[{'name':_0xfec2('0xa'),'fields':[_0xfec2('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index d5e0f21..8d875df 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 _0x98a7=['http','request','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client'];(function(_0x18a436,_0x1dbe06){var _0x5c2cf8=function(_0x4712d1){while(--_0x4712d1){_0x18a436['push'](_0x18a436['shift']());}};_0x5c2cf8(++_0x1dbe06);}(_0x98a7,0x9e));var _0x798a=function(_0x1a9a47,_0x45ab16){_0x1a9a47=_0x1a9a47-0x0;var _0x26430b=_0x98a7[_0x1a9a47];return _0x26430b;};'use strict';var _=require(_0x798a('0x0'));var util=require(_0x798a('0x1'));var moment=require(_0x798a('0x2'));var BPromise=require(_0x798a('0x3'));var rs=require(_0x798a('0x4'));var fs=require('fs');var Redis=require(_0x798a('0x5'));var db=require(_0x798a('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x798a('0x7'))(_0x798a('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x798a('0x9')][_0x798a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x9645e3,_0x3f17e2,_0x2a5393){return new BPromise(function(_0x8e1e29,_0x3be3d4){return client[_0x798a('0xb')](_0x9645e3,_0x2a5393)['then'](function(_0x1d2225){logger[_0x798a('0xc')](_0x798a('0xd'),_0x3f17e2,_0x798a('0xe'));logger['debug'](_0x798a('0xf'),_0x3f17e2,_0x798a('0xe'),JSON[_0x798a('0x10')](_0x1d2225));if(_0x1d2225[_0x798a('0x11')]){if(_0x1d2225[_0x798a('0x11')][_0x798a('0x12')]===0x1f4){logger['error'](_0x798a('0xd'),_0x3f17e2,_0x1d2225[_0x798a('0x11')][_0x798a('0x13')]);return _0x3be3d4(_0x1d2225[_0x798a('0x11')]['message']);}logger[_0x798a('0x11')](_0x798a('0xd'),_0x3f17e2,_0x1d2225['error'][_0x798a('0x13')]);return _0x8e1e29(_0x1d2225['error'][_0x798a('0x13')]);}else{logger[_0x798a('0xc')](_0x798a('0xd'),_0x3f17e2,_0x798a('0xe'));_0x8e1e29(_0x1d2225['result'][_0x798a('0x13')]);}})[_0x798a('0x14')](function(_0x536617){logger[_0x798a('0x11')](_0x798a('0xd'),_0x3f17e2,_0x536617);_0x3be3d4(_0x536617);});});} \ No newline at end of file +var _0x815b=['randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','http','request','then','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x815b,0xb4));var _0xb815=function(_0x4fecec,_0x5d5eab){_0x4fecec=_0x4fecec-0x0;var _0x190829=_0x815b[_0x4fecec];return _0x190829;};'use strict';var _=require(_0xb815('0x0'));var util=require(_0xb815('0x1'));var moment=require(_0xb815('0x2'));var BPromise=require(_0xb815('0x3'));var rs=require(_0xb815('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb815('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xb815('0x6'));var config=require(_0xb815('0x7'));var jayson=require(_0xb815('0x8'));var client=jayson['client'][_0xb815('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3f7a40,_0x4930f6,_0xeba45d){return new BPromise(function(_0x479b09,_0x4d0873){return client[_0xb815('0xa')](_0x3f7a40,_0xeba45d)[_0xb815('0xb')](function(_0x3f8c27){logger[_0xb815('0xc')](_0xb815('0xd'),_0x4930f6,_0xb815('0xe'));logger[_0xb815('0xf')](_0xb815('0x10'),_0x4930f6,'request\x20sent',JSON[_0xb815('0x11')](_0x3f8c27));if(_0x3f8c27[_0xb815('0x12')]){if(_0x3f8c27[_0xb815('0x12')][_0xb815('0x13')]===0x1f4){logger[_0xb815('0x12')](_0xb815('0xd'),_0x4930f6,_0x3f8c27[_0xb815('0x12')]['message']);return _0x4d0873(_0x3f8c27['error'][_0xb815('0x14')]);}logger[_0xb815('0x12')](_0xb815('0xd'),_0x4930f6,_0x3f8c27[_0xb815('0x12')][_0xb815('0x14')]);return _0x479b09(_0x3f8c27[_0xb815('0x12')][_0xb815('0x14')]);}else{logger[_0xb815('0xc')](_0xb815('0xd'),_0x4930f6,_0xb815('0xe'));_0x479b09(_0x3f8c27[_0xb815('0x15')][_0xb815('0x14')]);}})[_0xb815('0x16')](function(_0x52d8dd){logger['error'](_0xb815('0xd'),_0x4930f6,_0x52d8dd);_0x4d0873(_0x52d8dd);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index 9d4cde4..183e69e 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 _0xb9f7=['join','root','server/files/sounds/original/','originalname','replace','format','%s-%s%s','basename','extname','now','post','single','create','put','update','delete','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./sound.controller','get','index','/:id','show','/:id/download','isAuthenticated','diskStorage'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb9f7,0x1df));var _0x7b9f=function(_0x340380,_0x4bd2a8){_0x340380=_0x340380-0x0;var _0x49ce1c=_0xb9f7[_0x340380];return _0x49ce1c;};'use strict';var multer=require(_0x7b9f('0x0'));var util=require('util');var path=require(_0x7b9f('0x1'));var timeout=require(_0x7b9f('0x2'));var express=require('express');var router=express[_0x7b9f('0x3')]();var fs_extra=require(_0x7b9f('0x4'));var auth=require(_0x7b9f('0x5'));var interaction=require(_0x7b9f('0x6'));var config=require(_0x7b9f('0x7'));var controller=require(_0x7b9f('0x8'));router[_0x7b9f('0x9')]('/',auth['isAuthenticated'](),controller[_0x7b9f('0xa')]);router[_0x7b9f('0x9')](_0x7b9f('0xb'),auth['isAuthenticated'](),controller[_0x7b9f('0xc')]);router['get'](_0x7b9f('0xd'),auth[_0x7b9f('0xe')](),controller['download']);var upload=multer({'storage':multer[_0x7b9f('0xf')]({'destination':function(_0x30be7a,_0x42f479,_0x9ca384){_0x9ca384(null,path[_0x7b9f('0x10')](config[_0x7b9f('0x11')],_0x7b9f('0x12')));},'filename':function(_0x4b37ea,_0x3b5f13,_0x167827){_0x3b5f13[_0x7b9f('0x13')]=_0x3b5f13[_0x7b9f('0x13')][_0x7b9f('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x167827(null,util[_0x7b9f('0x15')](_0x7b9f('0x16'),path[_0x7b9f('0x17')](_0x3b5f13[_0x7b9f('0x13')],path[_0x7b9f('0x18')](_0x3b5f13[_0x7b9f('0x13')])),Date[_0x7b9f('0x19')](),path[_0x7b9f('0x18')](_0x3b5f13[_0x7b9f('0x13')])));}})});router[_0x7b9f('0x1a')]('/',upload[_0x7b9f('0x1b')]('file'),controller[_0x7b9f('0x1c')]);router[_0x7b9f('0x1d')](_0x7b9f('0xb'),auth[_0x7b9f('0xe')](),controller[_0x7b9f('0x1e')]);router[_0x7b9f('0x1f')]('/:id',auth[_0x7b9f('0xe')](),controller[_0x7b9f('0x1f')]);module[_0x7b9f('0x20')]=router; \ No newline at end of file +var _0x9a09=['now','extname','post','create','put','update','delete','exports','multer','util','path','connect-timeout','../../components/auth/service','../../config/environment','./sound.controller','get','isAuthenticated','index','/:id','show','/:id/download','diskStorage','root','server/files/sounds/original/','originalname','replace','format','%s-%s%s','basename'];(function(_0x34ed48,_0x2cc995){var _0x37da5c=function(_0x5b6e16){while(--_0x5b6e16){_0x34ed48['push'](_0x34ed48['shift']());}};_0x37da5c(++_0x2cc995);}(_0x9a09,0x147));var _0x99a0=function(_0x1f1ac6,_0x41e5a7){_0x1f1ac6=_0x1f1ac6-0x0;var _0x431433=_0x9a09[_0x1f1ac6];return _0x431433;};'use strict';var multer=require(_0x99a0('0x0'));var util=require(_0x99a0('0x1'));var path=require(_0x99a0('0x2'));var timeout=require(_0x99a0('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x99a0('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x99a0('0x5'));var controller=require(_0x99a0('0x6'));router[_0x99a0('0x7')]('/',auth[_0x99a0('0x8')](),controller[_0x99a0('0x9')]);router[_0x99a0('0x7')](_0x99a0('0xa'),auth[_0x99a0('0x8')](),controller[_0x99a0('0xb')]);router['get'](_0x99a0('0xc'),auth[_0x99a0('0x8')](),controller['download']);var upload=multer({'storage':multer[_0x99a0('0xd')]({'destination':function(_0x5cde30,_0x304f80,_0x177221){_0x177221(null,path['join'](config[_0x99a0('0xe')],_0x99a0('0xf')));},'filename':function(_0x14f402,_0xad73cf,_0x56c51e){_0xad73cf[_0x99a0('0x10')]=_0xad73cf[_0x99a0('0x10')][_0x99a0('0x11')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x56c51e(null,util[_0x99a0('0x12')](_0x99a0('0x13'),path[_0x99a0('0x14')](_0xad73cf['originalname'],path['extname'](_0xad73cf['originalname'])),Date[_0x99a0('0x15')](),path[_0x99a0('0x16')](_0xad73cf[_0x99a0('0x10')])));}})});router[_0x99a0('0x17')]('/',upload['single']('file'),controller[_0x99a0('0x18')]);router[_0x99a0('0x19')](_0x99a0('0xa'),auth['isAuthenticated'](),controller[_0x99a0('0x1a')]);router[_0x99a0('0x1b')](_0x99a0('0xa'),auth[_0x99a0('0x8')](),controller['delete']);module[_0x99a0('0x1c')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index 0aca4af..87d0eb4 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 _0x8e3c=['STRING','name','FLOAT','BIGINT','INTEGER','sequelize','exports'];(function(_0x1dfaf9,_0x31039e){var _0x2d309a=function(_0x289d21){while(--_0x289d21){_0x1dfaf9['push'](_0x1dfaf9['shift']());}};_0x2d309a(++_0x31039e);}(_0x8e3c,0x14e));var _0xc8e3=function(_0x82db7a,_0x1b9129){_0x82db7a=_0x82db7a-0x0;var _0x76f85=_0x8e3c[_0x82db7a];return _0x76f85;};'use strict';var Sequelize=require(_0xc8e3('0x0'));module[_0xc8e3('0x1')]={'name':{'type':Sequelize[_0xc8e3('0x2')],'unique':_0xc8e3('0x3'),'allowNull':![]},'save_name':{'type':Sequelize['STRING']},'display_name':{'type':Sequelize[_0xc8e3('0x2')],'defaultValue':''},'description':{'type':Sequelize[_0xc8e3('0x2')]},'original_format':{'type':Sequelize[_0xc8e3('0x2')]},'original_duration':{'type':Sequelize[_0xc8e3('0x4')]},'original_sampleCount':{'type':Sequelize[_0xc8e3('0x5')]},'original_channelCount':{'type':Sequelize[_0xc8e3('0x6')]},'original_bitRate':{'type':Sequelize[_0xc8e3('0x5')]},'original_sampleRate':{'type':Sequelize[_0xc8e3('0x6')]},'converted_format':{'type':Sequelize[_0xc8e3('0x2')]},'converted_duration':{'type':Sequelize[_0xc8e3('0x4')]},'converted_sampleCount':{'type':Sequelize[_0xc8e3('0x5')]},'converted_channelCount':{'type':Sequelize['INTEGER']},'converted_bitRate':{'type':Sequelize[_0xc8e3('0x5')]},'converted_sampleRate':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x1864=['INTEGER','sequelize','exports','name','STRING','FLOAT','BIGINT'];(function(_0x3027c2,_0xf038b5){var _0x9aa9ae=function(_0x14a001){while(--_0x14a001){_0x3027c2['push'](_0x3027c2['shift']());}};_0x9aa9ae(++_0xf038b5);}(_0x1864,0x17b));var _0x4186=function(_0xf2c1dc,_0x5844a0){_0xf2c1dc=_0xf2c1dc-0x0;var _0xffc9da=_0x1864[_0xf2c1dc];return _0xffc9da;};'use strict';var Sequelize=require(_0x4186('0x0'));module[_0x4186('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x4186('0x2'),'allowNull':![]},'save_name':{'type':Sequelize[_0x4186('0x3')]},'display_name':{'type':Sequelize['STRING'],'defaultValue':''},'description':{'type':Sequelize[_0x4186('0x3')]},'original_format':{'type':Sequelize[_0x4186('0x3')]},'original_duration':{'type':Sequelize[_0x4186('0x4')]},'original_sampleCount':{'type':Sequelize['BIGINT']},'original_channelCount':{'type':Sequelize['INTEGER']},'original_bitRate':{'type':Sequelize[_0x4186('0x5')]},'original_sampleRate':{'type':Sequelize[_0x4186('0x6')]},'converted_format':{'type':Sequelize[_0x4186('0x3')]},'converted_duration':{'type':Sequelize[_0x4186('0x4')]},'converted_sampleCount':{'type':Sequelize['BIGINT']},'converted_channelCount':{'type':Sequelize['INTEGER']},'converted_bitRate':{'type':Sequelize[_0x4186('0x5')]},'converted_sampleRate':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index cc1a316..5ac2a5d 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 _0x91c8=['nolimit','order','sort','filters','pick','where','VIRTUAL','filter','merge','options','includeAll','include','findAll','catch','params','find','download','save_name','converted_format','join','root','server/files/sounds/converted','Sequelize','ValidationError','format','%s.%s','create','originalname','extname','file','filename','substring','server/files/sounds/original','basename','info','Sound\x20upload\x20filepath:\x20%s','chmodSync','0777','transcode','wav','src','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_channelCount','converted_bitRate','bitRate','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','description','delete','original_format','unlinkSync','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','ejs','fs-extra','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','offset','undefined','limit','count','set','json','save','update','then','get','Sounds','UserProfileResource','end','sendStatus','error','stack','name','send','index','map','Sound','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty'];(function(_0x27c261,_0x5a36fa){var _0x4a8379=function(_0x462b61){while(--_0x462b61){_0x27c261['push'](_0x27c261['shift']());}};_0x4a8379(++_0x5a36fa);}(_0x91c8,0x1b9));var _0x891c=function(_0x26d5cb,_0x590d1d){_0x26d5cb=_0x26d5cb-0x0;var _0x3bb06c=_0x91c8[_0x26d5cb];return _0x3bb06c;};'use strict';var emlformat=require(_0x891c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x891c('0x1'));var jsonpatch=require(_0x891c('0x2'));var rp=require(_0x891c('0x3'));var moment=require(_0x891c('0x4'));var BPromise=require(_0x891c('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x891c('0x6'));var sox=require(_0x891c('0x7'));var csv=require('to-csv');var ejs=require(_0x891c('0x8'));var fs=require('fs');var fs_extra=require(_0x891c('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x891c('0xa'));var jsforce=require(_0x891c('0xb'));var deskjs=require(_0x891c('0xc'));var toCsv=require(_0x891c('0xd'));var querystring=require('querystring');var Papa=require(_0x891c('0xe'));var Redis=require(_0x891c('0xf'));var authService=require(_0x891c('0x10'));var qs=require(_0x891c('0x11'));var as=require(_0x891c('0x12'));var hardwareService=require(_0x891c('0x13'));var logger=require(_0x891c('0x14'))(_0x891c('0x15'));var utils=require(_0x891c('0x16'));var config=require(_0x891c('0x17'));var licenseUtil=require(_0x891c('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x334ed6,_0x589d7b){_0x589d7b=_0x589d7b||0xcc;return function(_0x469d48){if(_0x469d48){return _0x334ed6['sendStatus'](_0x589d7b);}return _0x334ed6['status'](_0x589d7b)['end']();};}function respondWithResult(_0x48a990,_0x4096c7){_0x4096c7=_0x4096c7||0xc8;return function(_0x160b1b){if(_0x160b1b){return _0x48a990[_0x891c('0x19')](_0x4096c7)['json'](_0x160b1b);}};}function respondWithFilteredResult(_0xb82b16,_0x33196e){return function(_0x81c140){if(_0x81c140){var _0x14b990=typeof _0x33196e[_0x891c('0x1a')]===_0x891c('0x1b')&&typeof _0x33196e[_0x891c('0x1c')]===_0x891c('0x1b');var _0x5c81a2=_0x81c140[_0x891c('0x1d')];var _0x4b478e=_0x14b990?0x0:_0x33196e[_0x891c('0x1a')];var _0x3fdfd9=_0x14b990?_0x81c140[_0x891c('0x1d')]:_0x33196e[_0x891c('0x1a')]+_0x33196e[_0x891c('0x1c')];var _0x595c4f;if(_0x3fdfd9>=_0x5c81a2){_0x3fdfd9=_0x5c81a2;_0x595c4f=0xc8;}else{_0x595c4f=0xce;}_0xb82b16[_0x891c('0x19')](_0x595c4f);return _0xb82b16[_0x891c('0x1e')]('Content-Range',_0x4b478e+'-'+_0x3fdfd9+'/'+_0x5c81a2)[_0x891c('0x1f')](_0x81c140);}return null;};}function patchUpdates(_0x4f1b12){return function(_0x4fc974){try{jsonpatch['apply'](_0x4fc974,_0x4f1b12,!![]);}catch(_0x283a31){return BPromise['reject'](_0x283a31);}return _0x4fc974[_0x891c('0x20')]();};}function saveUpdates(_0x5590ed,_0x4553e5){return function(_0x4ce957){if(_0x4ce957){return _0x4ce957[_0x891c('0x21')](_0x5590ed)[_0x891c('0x22')](function(_0x3a0423){return _0x3a0423;});}return null;};}function removeEntity(_0x2bb4e0,_0x45f159){return function(_0x2b532c){if(_0x2b532c){return _0x2b532c['destroy']()[_0x891c('0x22')](function(){var _0x220792=_0x2b532c[_0x891c('0x23')]({'plain':!![]});var _0xddab62=_0x891c('0x24');return db[_0x891c('0x25')]['destroy']({'where':{'type':_0xddab62,'resourceId':_0x220792['id']}})[_0x891c('0x22')](function(){return _0x2b532c;});})[_0x891c('0x22')](function(){_0x2bb4e0[_0x891c('0x19')](0xcc)[_0x891c('0x26')]();});}};}function handleEntityNotFound(_0x2f3d25,_0x2bf928){return function(_0x5f3009){if(!_0x5f3009){_0x2f3d25[_0x891c('0x27')](0x194);}return _0x5f3009;};}function handleError(_0x2f0cca,_0x4352e3){_0x4352e3=_0x4352e3||0x1f4;return function(_0x1c319f){logger[_0x891c('0x28')](_0x1c319f[_0x891c('0x29')]);if(_0x1c319f['name']){delete _0x1c319f[_0x891c('0x2a')];}_0x2f0cca['status'](_0x4352e3)[_0x891c('0x2b')](_0x1c319f);};}exports[_0x891c('0x2c')]=function(_0xcab835,_0x4f7599){var _0x1d08e8={},_0x5a6f7f={},_0x1ec286={'count':0x0,'rows':[]};var _0x21d137=_[_0x891c('0x2d')](db[_0x891c('0x2e')][_0x891c('0x2f')],function(_0x4be2a7){return{'name':_0x4be2a7[_0x891c('0x30')],'type':_0x4be2a7[_0x891c('0x31')][_0x891c('0x32')]};});_0x5a6f7f[_0x891c('0x33')]=_[_0x891c('0x2d')](_0x21d137,_0x891c('0x2a'));_0x5a6f7f[_0x891c('0x34')]=_[_0x891c('0x35')](_0xcab835[_0x891c('0x34')]);_0x5a6f7f['filters']=_[_0x891c('0x36')](_0x5a6f7f[_0x891c('0x33')],_0x5a6f7f[_0x891c('0x34')]);_0x1d08e8[_0x891c('0x37')]=_[_0x891c('0x36')](_0x5a6f7f[_0x891c('0x33')],qs[_0x891c('0x38')](_0xcab835[_0x891c('0x34')][_0x891c('0x38')]));_0x1d08e8[_0x891c('0x37')]=_0x1d08e8[_0x891c('0x37')][_0x891c('0x39')]?_0x1d08e8['attributes']:_0x5a6f7f[_0x891c('0x33')];if(!_0xcab835['query'][_0x891c('0x3a')](_0x891c('0x3b'))){_0x1d08e8['limit']=qs['limit'](_0xcab835[_0x891c('0x34')][_0x891c('0x1c')]);_0x1d08e8[_0x891c('0x1a')]=qs[_0x891c('0x1a')](_0xcab835[_0x891c('0x34')]['offset']);}_0x1d08e8[_0x891c('0x3c')]=qs['sort'](_0xcab835[_0x891c('0x34')][_0x891c('0x3d')]);_0x1d08e8['where']=qs[_0x891c('0x3e')](_[_0x891c('0x3f')](_0xcab835[_0x891c('0x34')],_0x5a6f7f[_0x891c('0x3e')]),_0x21d137);if(_0xcab835['query']['filter']){_0x1d08e8['where']=_['merge'](_0x1d08e8[_0x891c('0x40')],{'$or':_['map'](_0x21d137,function(_0x4d7f07){if(_0x4d7f07[_0x891c('0x31')]!==_0x891c('0x41')){var _0x222047={};_0x222047[_0x4d7f07['name']]={'$like':'%'+_0xcab835[_0x891c('0x34')][_0x891c('0x42')]+'%'};return _0x222047;}})});}_0x1d08e8=_[_0x891c('0x43')]({},_0x1d08e8,_0xcab835[_0x891c('0x44')]);var _0x4ca6b0={'where':_0x1d08e8[_0x891c('0x40')]};return db[_0x891c('0x2e')][_0x891c('0x1d')](_0x4ca6b0)[_0x891c('0x22')](function(_0x5481bb){_0x1ec286[_0x891c('0x1d')]=_0x5481bb;if(_0xcab835[_0x891c('0x34')][_0x891c('0x45')]){_0x1d08e8[_0x891c('0x46')]=[{'all':!![]}];}return db[_0x891c('0x2e')][_0x891c('0x47')](_0x1d08e8);})['then'](function(_0x8f0ab6){_0x1ec286['rows']=_0x8f0ab6;return _0x1ec286;})[_0x891c('0x22')](respondWithFilteredResult(_0x4f7599,_0x1d08e8))[_0x891c('0x48')](handleError(_0x4f7599,null));};exports['show']=function(_0x594010,_0x21a644){var _0x5162ef={'raw':!![],'where':{'id':_0x594010[_0x891c('0x49')]['id']}},_0x169427={};_0x169427[_0x891c('0x33')]=_['keys'](db[_0x891c('0x2e')]['rawAttributes']);_0x169427[_0x891c('0x34')]=_['keys'](_0x594010[_0x891c('0x34')]);_0x169427[_0x891c('0x3e')]=_['intersection'](_0x169427[_0x891c('0x33')],_0x169427[_0x891c('0x34')]);_0x5162ef[_0x891c('0x37')]=_['intersection'](_0x169427[_0x891c('0x33')],qs['fields'](_0x594010[_0x891c('0x34')][_0x891c('0x38')]));_0x5162ef['attributes']=_0x5162ef[_0x891c('0x37')][_0x891c('0x39')]?_0x5162ef['attributes']:_0x169427[_0x891c('0x33')];if(_0x594010[_0x891c('0x34')][_0x891c('0x45')]){_0x5162ef[_0x891c('0x46')]=[{'all':!![]}];}_0x5162ef=_[_0x891c('0x43')]({},_0x5162ef,_0x594010[_0x891c('0x44')]);return db[_0x891c('0x2e')][_0x891c('0x4a')](_0x5162ef)['then'](handleEntityNotFound(_0x21a644,null))[_0x891c('0x22')](respondWithResult(_0x21a644,null))[_0x891c('0x48')](handleError(_0x21a644,null));};exports[_0x891c('0x4b')]=function(_0x332dd9,_0x1ba438,_0x8fa85e){return db['Sound'][_0x891c('0x4a')]({'where':{'id':_0x332dd9[_0x891c('0x49')]['id']},'attributes':[_0x891c('0x2a'),_0x891c('0x4c'),_0x891c('0x4d')],'raw':!![]})[_0x891c('0x22')](handleEntityNotFound(_0x1ba438,null))[_0x891c('0x22')](function(_0x358b39){if(_0x358b39){if(!fs['existsSync'](path[_0x891c('0x4e')](config[_0x891c('0x4f')],_0x891c('0x50'),_0x358b39[_0x891c('0x4c')]+'.'+_0x358b39[_0x891c('0x4d')]))){throw new db[(_0x891c('0x51'))][(_0x891c('0x52'))]('Sound\x20not\x20found');}return _0x1ba438[_0x891c('0x4b')](path[_0x891c('0x4e')](config[_0x891c('0x4f')],_0x891c('0x50'),util[_0x891c('0x53')](_0x891c('0x54'),_0x358b39['save_name'],_0x358b39[_0x891c('0x4d')])),util[_0x891c('0x53')](_0x891c('0x54'),_0x358b39['name'],_0x358b39[_0x891c('0x4d')]));}return null;})[_0x891c('0x48')](handleError(_0x1ba438,null));};exports[_0x891c('0x55')]=function(_0x34fcdb,_0x408945,_0x12e307){var _0x2996ea={'name':path['basename'](_0x34fcdb['file'][_0x891c('0x56')],path[_0x891c('0x57')](_0x34fcdb[_0x891c('0x58')][_0x891c('0x56')])),'save_name':path['basename'](_0x34fcdb[_0x891c('0x58')]['filename'],path['extname'](_0x34fcdb[_0x891c('0x58')][_0x891c('0x59')])),'original_format':path['extname'](_0x34fcdb[_0x891c('0x58')]['originalname'])[_0x891c('0x5a')](0x1),'converted_format':'wav'};var _0x18009c=path[_0x891c('0x4e')](config[_0x891c('0x4f')],_0x891c('0x5b'),_0x34fcdb[_0x891c('0x58')]['filename']);var _0x54552=path['join'](config['root'],_0x891c('0x50'),util[_0x891c('0x53')](_0x891c('0x54'),path[_0x891c('0x5c')](_0x34fcdb[_0x891c('0x58')][_0x891c('0x59')],path[_0x891c('0x57')](_0x34fcdb[_0x891c('0x58')]['filename'])),_0x2996ea[_0x891c('0x4d')]));logger[_0x891c('0x5d')](_0x891c('0x5e'),_0x18009c);logger[_0x891c('0x5d')]('Sound\x20upload\x20destination:\x20%s',_0x54552);try{fs[_0x891c('0x5f')](_0x18009c,parseInt(_0x891c('0x60'),0x8));var _0x36540f=sox[_0x891c('0x61')](_0x18009c,_0x54552,{'sampleRate':0x1f40,'format':_0x891c('0x62'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x36540f['on'](_0x891c('0x28'),function(_0x39a50a){fs['unlinkSync'](_0x18009c);_0x408945[_0x891c('0x19')](0x1f4)[_0x891c('0x2b')](_0x39a50a);});_0x36540f['on'](_0x891c('0x63'),function(_0x157ff9){_0x2996ea[_0x891c('0x64')]=isNaN(_0x157ff9[_0x891c('0x65')])?null:_0x157ff9['duration']*0x3e8;_0x2996ea[_0x891c('0x66')]=isNaN(_0x157ff9[_0x891c('0x67')])?null:_0x157ff9[_0x891c('0x67')];_0x2996ea[_0x891c('0x68')]=isNaN(_0x157ff9['channelCount'])?null:_0x157ff9[_0x891c('0x69')];_0x2996ea[_0x891c('0x6a')]=isNaN(_0x157ff9['bitRate'])?null:_0x157ff9['bitRate'];_0x2996ea[_0x891c('0x6b')]=isNaN(_0x157ff9['sampleRate'])?null:_0x157ff9[_0x891c('0x6c')];});_0x36540f['on'](_0x891c('0x6d'),function(_0xa2fb87){_0x2996ea[_0x891c('0x6e')]=isNaN(_0xa2fb87[_0x891c('0x65')])?null:_0xa2fb87[_0x891c('0x65')]*0x3e8;_0x2996ea[_0x891c('0x6f')]=isNaN(_0xa2fb87[_0x891c('0x67')])?null:_0xa2fb87[_0x891c('0x67')];_0x2996ea[_0x891c('0x70')]=isNaN(_0xa2fb87[_0x891c('0x69')])?null:_0xa2fb87[_0x891c('0x69')];_0x2996ea[_0x891c('0x71')]=isNaN(_0xa2fb87['bitRate'])?null:_0xa2fb87[_0x891c('0x72')];_0x2996ea['converted_sampleRate']=isNaN(_0xa2fb87[_0x891c('0x6c')])?null:_0xa2fb87[_0x891c('0x6c')];});_0x36540f['on'](_0x891c('0x26'),function(){fs[_0x891c('0x5f')](_0x54552,parseInt(_0x891c('0x60'),0x8));return db[_0x891c('0x2e')][_0x891c('0x55')](_0x2996ea)[_0x891c('0x22')](function(_0x26a14e){var _0x3a3c1b={'role':_0x34fcdb['body']['role'],'userProfileId':_0x34fcdb[_0x891c('0x73')]['userProfileId']};if(!_0x3a3c1b)throw new Error(_0x891c('0x74'));if(_0x3a3c1b[_0x891c('0x75')]===_0x891c('0x76')){var _0x4bb503=_0x26a14e[_0x891c('0x23')]({'plain':!![]});return db['UserProfileSection'][_0x891c('0x4a')]({'where':{'name':'Sounds','userProfileId':_0x3a3c1b['userProfileId']},'raw':!![]})[_0x891c('0x22')](function(_0x30e985){if(_0x30e985&&_0x30e985['autoAssociation']===0x0){return db[_0x891c('0x25')][_0x891c('0x55')]({'name':_0x4bb503[_0x891c('0x2a')],'resourceId':_0x4bb503['id'],'type':_0x30e985['name'],'sectionId':_0x30e985['id']},{})[_0x891c('0x22')](function(){return _0x26a14e;});}else{return _0x26a14e;}})['catch'](function(_0x1c6c24){logger[_0x891c('0x28')](_0x891c('0x77'),_0x1c6c24);throw _0x1c6c24;});}return _0x26a14e;})[_0x891c('0x22')](respondWithResult(_0x408945,null))[_0x891c('0x48')](handleError(_0x408945,null));});_0x36540f[_0x891c('0x78')]();}catch(_0x16b1d3){_0x408945[_0x891c('0x19')](0x1f4)[_0x891c('0x2b')](_0x16b1d3);}};exports[_0x891c('0x21')]=function(_0x251845,_0x293112,_0x57dec7){return db[_0x891c('0x2e')]['find']({'where':{'id':_0x251845[_0x891c('0x49')]['id']}})['then'](handleEntityNotFound(_0x293112,null))['then'](saveUpdates(_[_0x891c('0x3f')](_0x251845[_0x891c('0x73')],[_0x891c('0x2a'),_0x891c('0x79')]),null))[_0x891c('0x22')](respondWithResult(_0x293112,null))[_0x891c('0x48')](handleError(_0x293112,null));};exports[_0x891c('0x7a')]=function(_0x25b81f,_0x2c1bab,_0x4b049a){return db[_0x891c('0x2e')][_0x891c('0x4a')]({'where':{'id':_0x25b81f['params']['id']}})['then'](function(_0x50bc3a){if(_0x50bc3a){return _0x50bc3a['destroy']();}})['then'](function(_0x25fa4c){var _0x41f318=path[_0x891c('0x4e')](config[_0x891c('0x4f')],_0x891c('0x5b'),util[_0x891c('0x53')]('%s.%s',_0x25fa4c['save_name'],_0x25fa4c[_0x891c('0x7b')]));var _0x4e0a72=path['join'](config['root'],_0x891c('0x50'),util[_0x891c('0x53')](_0x891c('0x54'),_0x25fa4c['save_name'],_0x25fa4c['converted_format']));fs[_0x891c('0x7c')](_0x41f318);fs[_0x891c('0x7c')](_0x4e0a72);return _0x25fa4c;})['then'](function(_0x34ba71){if(_0x34ba71){return _0x2c1bab[_0x891c('0x19')](0xcc)[_0x891c('0x26')]();}})[_0x891c('0x22')](handleEntityNotFound(_0x2c1bab,null))[_0x891c('0x48')](handleError(_0x2c1bab,null));}; \ No newline at end of file +var _0x42b7=['include','findAll','rows','catch','show','params','rawAttributes','find','download','save_name','converted_format','existsSync','join','Sequelize','ValidationError','Sound\x20not\x20found','server/files/sounds/converted','format','%s.%s','create','basename','file','originalname','extname','filename','substring','wav','root','server/files/sounds/original','info','Sound\x20upload\x20filepath:\x20%s','chmodSync','0777','transcode','src','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_sampleCount','converted_bitRate','converted_sampleRate','body','role','userProfileId','UserProfileSection','start','delete','original_format','unlinkSync','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','limit','count','offset','set','Content-Range','reject','save','update','get','Sounds','UserProfileResource','then','error','stack','send','index','map','Sound','fieldName','type','key','model','name','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','includeAll'];(function(_0x5e9e82,_0x3294d1){var _0x1ba951=function(_0x1fffcd){while(--_0x1fffcd){_0x5e9e82['push'](_0x5e9e82['shift']());}};_0x1ba951(++_0x3294d1);}(_0x42b7,0x1b8));var _0x742b=function(_0x512f85,_0x52eff7){_0x512f85=_0x512f85-0x0;var _0x56e56e=_0x42b7[_0x512f85];return _0x56e56e;};'use strict';var emlformat=require(_0x742b('0x0'));var rimraf=require(_0x742b('0x1'));var zipdir=require(_0x742b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x742b('0x3'));var moment=require(_0x742b('0x4'));var BPromise=require(_0x742b('0x5'));var Mustache=require(_0x742b('0x6'));var util=require(_0x742b('0x7'));var path=require(_0x742b('0x8'));var sox=require(_0x742b('0x9'));var csv=require('to-csv');var ejs=require(_0x742b('0xa'));var fs=require('fs');var fs_extra=require(_0x742b('0xb'));var _=require('lodash');var squel=require(_0x742b('0xc'));var crypto=require(_0x742b('0xd'));var jsforce=require(_0x742b('0xe'));var deskjs=require(_0x742b('0xf'));var toCsv=require(_0x742b('0x10'));var querystring=require(_0x742b('0x11'));var Papa=require(_0x742b('0x12'));var Redis=require(_0x742b('0x13'));var authService=require(_0x742b('0x14'));var qs=require(_0x742b('0x15'));var as=require(_0x742b('0x16'));var hardwareService=require(_0x742b('0x17'));var logger=require(_0x742b('0x18'))(_0x742b('0x19'));var utils=require(_0x742b('0x1a'));var config=require(_0x742b('0x1b'));var licenseUtil=require(_0x742b('0x1c'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1e6d69,_0xc61003){_0xc61003=_0xc61003||0xcc;return function(_0x4a487e){if(_0x4a487e){return _0x1e6d69['sendStatus'](_0xc61003);}return _0x1e6d69[_0x742b('0x1d')](_0xc61003)[_0x742b('0x1e')]();};}function respondWithResult(_0x43422b,_0x5531a1){_0x5531a1=_0x5531a1||0xc8;return function(_0x5b1bb7){if(_0x5b1bb7){return _0x43422b[_0x742b('0x1d')](_0x5531a1)[_0x742b('0x1f')](_0x5b1bb7);}};}function respondWithFilteredResult(_0x23c9af,_0x204dea){return function(_0x461028){if(_0x461028){var _0x49a0f5=typeof _0x204dea['offset']==='undefined'&&typeof _0x204dea[_0x742b('0x20')]==='undefined';var _0x4a7281=_0x461028[_0x742b('0x21')];var _0x1c390f=_0x49a0f5?0x0:_0x204dea['offset'];var _0x2f6196=_0x49a0f5?_0x461028['count']:_0x204dea[_0x742b('0x22')]+_0x204dea[_0x742b('0x20')];var _0x3659f3;if(_0x2f6196>=_0x4a7281){_0x2f6196=_0x4a7281;_0x3659f3=0xc8;}else{_0x3659f3=0xce;}_0x23c9af['status'](_0x3659f3);return _0x23c9af[_0x742b('0x23')](_0x742b('0x24'),_0x1c390f+'-'+_0x2f6196+'/'+_0x4a7281)['json'](_0x461028);}return null;};}function patchUpdates(_0x1d9b4e){return function(_0x46f15a){try{jsonpatch['apply'](_0x46f15a,_0x1d9b4e,!![]);}catch(_0x48a3cd){return BPromise[_0x742b('0x25')](_0x48a3cd);}return _0x46f15a[_0x742b('0x26')]();};}function saveUpdates(_0x1e61c9,_0x277817){return function(_0x2ff7d8){if(_0x2ff7d8){return _0x2ff7d8[_0x742b('0x27')](_0x1e61c9)['then'](function(_0x5476a6){return _0x5476a6;});}return null;};}function removeEntity(_0x1e7412,_0x5c3733){return function(_0x32881c){if(_0x32881c){return _0x32881c['destroy']()['then'](function(){var _0x46c84a=_0x32881c[_0x742b('0x28')]({'plain':!![]});var _0x3cc14b=_0x742b('0x29');return db[_0x742b('0x2a')]['destroy']({'where':{'type':_0x3cc14b,'resourceId':_0x46c84a['id']}})[_0x742b('0x2b')](function(){return _0x32881c;});})['then'](function(){_0x1e7412[_0x742b('0x1d')](0xcc)[_0x742b('0x1e')]();});}};}function handleEntityNotFound(_0x3d902f,_0x1e2046){return function(_0x131eda){if(!_0x131eda){_0x3d902f['sendStatus'](0x194);}return _0x131eda;};}function handleError(_0x1e3943,_0x4455cf){_0x4455cf=_0x4455cf||0x1f4;return function(_0x29e9f9){logger[_0x742b('0x2c')](_0x29e9f9[_0x742b('0x2d')]);if(_0x29e9f9['name']){delete _0x29e9f9['name'];}_0x1e3943[_0x742b('0x1d')](_0x4455cf)[_0x742b('0x2e')](_0x29e9f9);};}exports[_0x742b('0x2f')]=function(_0x149d1f,_0x28ce5c){var _0x1e15be={},_0x15768e={},_0x2eaf7d={'count':0x0,'rows':[]};var _0x248ef6=_[_0x742b('0x30')](db[_0x742b('0x31')]['rawAttributes'],function(_0x4cf121){return{'name':_0x4cf121[_0x742b('0x32')],'type':_0x4cf121[_0x742b('0x33')][_0x742b('0x34')]};});_0x15768e[_0x742b('0x35')]=_[_0x742b('0x30')](_0x248ef6,_0x742b('0x36'));_0x15768e[_0x742b('0x37')]=_[_0x742b('0x38')](_0x149d1f[_0x742b('0x37')]);_0x15768e[_0x742b('0x39')]=_[_0x742b('0x3a')](_0x15768e[_0x742b('0x35')],_0x15768e[_0x742b('0x37')]);_0x1e15be[_0x742b('0x3b')]=_[_0x742b('0x3a')](_0x15768e[_0x742b('0x35')],qs[_0x742b('0x3c')](_0x149d1f[_0x742b('0x37')]['fields']));_0x1e15be[_0x742b('0x3b')]=_0x1e15be[_0x742b('0x3b')]['length']?_0x1e15be[_0x742b('0x3b')]:_0x15768e[_0x742b('0x35')];if(!_0x149d1f[_0x742b('0x37')][_0x742b('0x3d')](_0x742b('0x3e'))){_0x1e15be[_0x742b('0x20')]=qs[_0x742b('0x20')](_0x149d1f[_0x742b('0x37')][_0x742b('0x20')]);_0x1e15be[_0x742b('0x22')]=qs[_0x742b('0x22')](_0x149d1f['query'][_0x742b('0x22')]);}_0x1e15be[_0x742b('0x3f')]=qs[_0x742b('0x40')](_0x149d1f['query'][_0x742b('0x40')]);_0x1e15be['where']=qs['filters'](_[_0x742b('0x41')](_0x149d1f[_0x742b('0x37')],_0x15768e[_0x742b('0x39')]),_0x248ef6);if(_0x149d1f['query'][_0x742b('0x42')]){_0x1e15be[_0x742b('0x43')]=_['merge'](_0x1e15be[_0x742b('0x43')],{'$or':_[_0x742b('0x30')](_0x248ef6,function(_0x9acdd){if(_0x9acdd[_0x742b('0x33')]!==_0x742b('0x44')){var _0x476c72={};_0x476c72[_0x9acdd[_0x742b('0x36')]]={'$like':'%'+_0x149d1f[_0x742b('0x37')][_0x742b('0x42')]+'%'};return _0x476c72;}})});}_0x1e15be=_[_0x742b('0x45')]({},_0x1e15be,_0x149d1f[_0x742b('0x46')]);var _0x3e1004={'where':_0x1e15be[_0x742b('0x43')]};return db['Sound'][_0x742b('0x21')](_0x3e1004)[_0x742b('0x2b')](function(_0x4a64b){_0x2eaf7d[_0x742b('0x21')]=_0x4a64b;if(_0x149d1f['query'][_0x742b('0x47')]){_0x1e15be[_0x742b('0x48')]=[{'all':!![]}];}return db['Sound'][_0x742b('0x49')](_0x1e15be);})[_0x742b('0x2b')](function(_0x4545f9){_0x2eaf7d[_0x742b('0x4a')]=_0x4545f9;return _0x2eaf7d;})['then'](respondWithFilteredResult(_0x28ce5c,_0x1e15be))[_0x742b('0x4b')](handleError(_0x28ce5c,null));};exports[_0x742b('0x4c')]=function(_0x218689,_0x4e3176){var _0x4251d3={'raw':!![],'where':{'id':_0x218689[_0x742b('0x4d')]['id']}},_0x3e738e={};_0x3e738e['model']=_[_0x742b('0x38')](db['Sound'][_0x742b('0x4e')]);_0x3e738e['query']=_[_0x742b('0x38')](_0x218689[_0x742b('0x37')]);_0x3e738e[_0x742b('0x39')]=_[_0x742b('0x3a')](_0x3e738e['model'],_0x3e738e['query']);_0x4251d3[_0x742b('0x3b')]=_[_0x742b('0x3a')](_0x3e738e[_0x742b('0x35')],qs['fields'](_0x218689['query'][_0x742b('0x3c')]));_0x4251d3['attributes']=_0x4251d3[_0x742b('0x3b')]['length']?_0x4251d3[_0x742b('0x3b')]:_0x3e738e[_0x742b('0x35')];if(_0x218689[_0x742b('0x37')][_0x742b('0x47')]){_0x4251d3[_0x742b('0x48')]=[{'all':!![]}];}_0x4251d3=_['merge']({},_0x4251d3,_0x218689[_0x742b('0x46')]);return db['Sound'][_0x742b('0x4f')](_0x4251d3)['then'](handleEntityNotFound(_0x4e3176,null))[_0x742b('0x2b')](respondWithResult(_0x4e3176,null))['catch'](handleError(_0x4e3176,null));};exports[_0x742b('0x50')]=function(_0x59902f,_0x2f600d,_0x18d3de){return db[_0x742b('0x31')][_0x742b('0x4f')]({'where':{'id':_0x59902f[_0x742b('0x4d')]['id']},'attributes':[_0x742b('0x36'),_0x742b('0x51'),_0x742b('0x52')],'raw':!![]})[_0x742b('0x2b')](handleEntityNotFound(_0x2f600d,null))[_0x742b('0x2b')](function(_0x14a50b){if(_0x14a50b){if(!fs[_0x742b('0x53')](path[_0x742b('0x54')](config['root'],'server/files/sounds/converted',_0x14a50b[_0x742b('0x51')]+'.'+_0x14a50b[_0x742b('0x52')]))){throw new db[(_0x742b('0x55'))][(_0x742b('0x56'))](_0x742b('0x57'));}return _0x2f600d['download'](path[_0x742b('0x54')](config['root'],_0x742b('0x58'),util[_0x742b('0x59')](_0x742b('0x5a'),_0x14a50b[_0x742b('0x51')],_0x14a50b[_0x742b('0x52')])),util[_0x742b('0x59')](_0x742b('0x5a'),_0x14a50b[_0x742b('0x36')],_0x14a50b['converted_format']));}return null;})[_0x742b('0x4b')](handleError(_0x2f600d,null));};exports[_0x742b('0x5b')]=function(_0xf0e54,_0x526d2d,_0x49f8c7){var _0x48def3={'name':path[_0x742b('0x5c')](_0xf0e54[_0x742b('0x5d')][_0x742b('0x5e')],path[_0x742b('0x5f')](_0xf0e54[_0x742b('0x5d')][_0x742b('0x5e')])),'save_name':path['basename'](_0xf0e54[_0x742b('0x5d')]['filename'],path[_0x742b('0x5f')](_0xf0e54[_0x742b('0x5d')][_0x742b('0x60')])),'original_format':path['extname'](_0xf0e54[_0x742b('0x5d')][_0x742b('0x5e')])[_0x742b('0x61')](0x1),'converted_format':_0x742b('0x62')};var _0x49e4ac=path[_0x742b('0x54')](config[_0x742b('0x63')],_0x742b('0x64'),_0xf0e54[_0x742b('0x5d')][_0x742b('0x60')]);var _0xa7ae17=path[_0x742b('0x54')](config[_0x742b('0x63')],_0x742b('0x58'),util[_0x742b('0x59')](_0x742b('0x5a'),path[_0x742b('0x5c')](_0xf0e54[_0x742b('0x5d')][_0x742b('0x60')],path['extname'](_0xf0e54[_0x742b('0x5d')][_0x742b('0x60')])),_0x48def3[_0x742b('0x52')]));logger[_0x742b('0x65')](_0x742b('0x66'),_0x49e4ac);logger[_0x742b('0x65')]('Sound\x20upload\x20destination:\x20%s',_0xa7ae17);try{fs[_0x742b('0x67')](_0x49e4ac,parseInt(_0x742b('0x68'),0x8));var _0x27f263=sox[_0x742b('0x69')](_0x49e4ac,_0xa7ae17,{'sampleRate':0x1f40,'format':_0x742b('0x62'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x27f263['on'](_0x742b('0x2c'),function(_0x102d09){fs['unlinkSync'](_0x49e4ac);_0x526d2d[_0x742b('0x1d')](0x1f4)[_0x742b('0x2e')](_0x102d09);});_0x27f263['on'](_0x742b('0x6a'),function(_0x153867){_0x48def3['original_duration']=isNaN(_0x153867[_0x742b('0x6b')])?null:_0x153867[_0x742b('0x6b')]*0x3e8;_0x48def3[_0x742b('0x6c')]=isNaN(_0x153867[_0x742b('0x6d')])?null:_0x153867[_0x742b('0x6d')];_0x48def3[_0x742b('0x6e')]=isNaN(_0x153867[_0x742b('0x6f')])?null:_0x153867[_0x742b('0x6f')];_0x48def3[_0x742b('0x70')]=isNaN(_0x153867[_0x742b('0x71')])?null:_0x153867[_0x742b('0x71')];_0x48def3[_0x742b('0x72')]=isNaN(_0x153867[_0x742b('0x73')])?null:_0x153867['sampleRate'];});_0x27f263['on'](_0x742b('0x74'),function(_0x411636){_0x48def3['converted_duration']=isNaN(_0x411636['duration'])?null:_0x411636[_0x742b('0x6b')]*0x3e8;_0x48def3[_0x742b('0x75')]=isNaN(_0x411636['sampleCount'])?null:_0x411636[_0x742b('0x6d')];_0x48def3['converted_channelCount']=isNaN(_0x411636[_0x742b('0x6f')])?null:_0x411636['channelCount'];_0x48def3[_0x742b('0x76')]=isNaN(_0x411636[_0x742b('0x71')])?null:_0x411636[_0x742b('0x71')];_0x48def3[_0x742b('0x77')]=isNaN(_0x411636[_0x742b('0x73')])?null:_0x411636['sampleRate'];});_0x27f263['on']('end',function(){fs[_0x742b('0x67')](_0xa7ae17,parseInt(_0x742b('0x68'),0x8));return db[_0x742b('0x31')][_0x742b('0x5b')](_0x48def3)[_0x742b('0x2b')](function(_0x49e0b9){var _0x2d4add={'role':_0xf0e54[_0x742b('0x78')][_0x742b('0x79')],'userProfileId':_0xf0e54[_0x742b('0x78')][_0x742b('0x7a')]};if(!_0x2d4add)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2d4add[_0x742b('0x79')]==='user'){var _0x3d3ad6=_0x49e0b9['get']({'plain':!![]});return db[_0x742b('0x7b')][_0x742b('0x4f')]({'where':{'name':_0x742b('0x29'),'userProfileId':_0x2d4add[_0x742b('0x7a')]},'raw':!![]})['then'](function(_0x31089c){if(_0x31089c&&_0x31089c['autoAssociation']===0x0){return db['UserProfileResource'][_0x742b('0x5b')]({'name':_0x3d3ad6[_0x742b('0x36')],'resourceId':_0x3d3ad6['id'],'type':_0x31089c[_0x742b('0x36')],'sectionId':_0x31089c['id']},{})[_0x742b('0x2b')](function(){return _0x49e0b9;});}else{return _0x49e0b9;}})[_0x742b('0x4b')](function(_0x31f8a5){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x31f8a5);throw _0x31f8a5;});}return _0x49e0b9;})[_0x742b('0x2b')](respondWithResult(_0x526d2d,null))['catch'](handleError(_0x526d2d,null));});_0x27f263[_0x742b('0x7c')]();}catch(_0x1833c6){_0x526d2d['status'](0x1f4)[_0x742b('0x2e')](_0x1833c6);}};exports[_0x742b('0x27')]=function(_0x42fe6a,_0x422334,_0xb2744){return db[_0x742b('0x31')][_0x742b('0x4f')]({'where':{'id':_0x42fe6a[_0x742b('0x4d')]['id']}})[_0x742b('0x2b')](handleEntityNotFound(_0x422334,null))[_0x742b('0x2b')](saveUpdates(_[_0x742b('0x41')](_0x42fe6a[_0x742b('0x78')],[_0x742b('0x36'),'description']),null))[_0x742b('0x2b')](respondWithResult(_0x422334,null))[_0x742b('0x4b')](handleError(_0x422334,null));};exports[_0x742b('0x7d')]=function(_0x1ba051,_0x39845c,_0x436119){return db['Sound'][_0x742b('0x4f')]({'where':{'id':_0x1ba051[_0x742b('0x4d')]['id']}})[_0x742b('0x2b')](function(_0x38fc36){if(_0x38fc36){return _0x38fc36['destroy']();}})['then'](function(_0x5db923){var _0x1410a4=path[_0x742b('0x54')](config[_0x742b('0x63')],_0x742b('0x64'),util['format'](_0x742b('0x5a'),_0x5db923[_0x742b('0x51')],_0x5db923[_0x742b('0x7e')]));var _0x381365=path[_0x742b('0x54')](config[_0x742b('0x63')],_0x742b('0x58'),util[_0x742b('0x59')](_0x742b('0x5a'),_0x5db923['save_name'],_0x5db923[_0x742b('0x52')]));fs[_0x742b('0x7f')](_0x1410a4);fs[_0x742b('0x7f')](_0x381365);return _0x5db923;})[_0x742b('0x2b')](function(_0x322e12){if(_0x322e12){return _0x39845c[_0x742b('0x1d')](0xcc)[_0x742b('0x1e')]();}})[_0x742b('0x2b')](handleEntityNotFound(_0x39845c,null))['catch'](handleError(_0x39845c,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index ec2e4ef..fa9ec4c 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 _0xab77=['path','rimraf','../../config/environment','./sound.attributes','exports','define','Sound','lodash','util','api','moment'];(function(_0x21d807,_0x275269){var _0x332877=function(_0x3b362b){while(--_0x3b362b){_0x21d807['push'](_0x21d807['shift']());}};_0x332877(++_0x275269);}(_0xab77,0x19e));var _0x7ab7=function(_0x260d3f,_0x5c0c51){_0x260d3f=_0x260d3f-0x0;var _0x1bbb43=_0xab77[_0x260d3f];return _0x1bbb43;};'use strict';var _=require(_0x7ab7('0x0'));var util=require(_0x7ab7('0x1'));var logger=require('../../config/logger')(_0x7ab7('0x2'));var moment=require(_0x7ab7('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x7ab7('0x4'));var rimraf=require(_0x7ab7('0x5'));var config=require(_0x7ab7('0x6'));var attributes=require(_0x7ab7('0x7'));module[_0x7ab7('0x8')]=function(_0xc10698,_0x532a49){return _0xc10698[_0x7ab7('0x9')](_0x7ab7('0xa'),attributes,{'tableName':'tools_sounds','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x319b=['moment','bluebird','path','rimraf','./sound.attributes','exports','Sound','tools_sounds','lodash'];(function(_0x4c4ef,_0x31bbf7){var _0x1540cc=function(_0x7c5cd){while(--_0x7c5cd){_0x4c4ef['push'](_0x4c4ef['shift']());}};_0x1540cc(++_0x31bbf7);}(_0x319b,0x1a6));var _0xb319=function(_0x5a7e90,_0x5df83d){_0x5a7e90=_0x5a7e90-0x0;var _0x1c23b0=_0x319b[_0x5a7e90];return _0x1c23b0;};'use strict';var _=require(_0xb319('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xb319('0x1'));var BPromise=require(_0xb319('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb319('0x3'));var rimraf=require(_0xb319('0x4'));var config=require('../../config/environment');var attributes=require(_0xb319('0x5'));module[_0xb319('0x6')]=function(_0x409381,_0x2ab199){return _0x409381['define'](_0xb319('0x7'),attributes,{'tableName':_0xb319('0x8'),'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 6a983d8..ec64973 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 _0x2355=['client','http','request','then','info','Sound,\x20%s,\x20%s','request\x20sent','error','code','message','catch','ShowSound','Sound','find','raw','options','where','attributes','map','include','model','lodash','util','moment','bluebird','ioredis','rpc','../../config/environment','jayson/promise'];(function(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0x2355,0xc3));var _0x5235=function(_0x1e26eb,_0x13dbba){_0x1e26eb=_0x1e26eb-0x0;var _0x4a797e=_0x2355[_0x1e26eb];return _0x4a797e;};'use strict';var _=require(_0x5235('0x0'));var util=require(_0x5235('0x1'));var moment=require(_0x5235('0x2'));var BPromise=require(_0x5235('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5235('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x5235('0x5'));var config=require(_0x5235('0x6'));var jayson=require(_0x5235('0x7'));var client=jayson[_0x5235('0x8')][_0x5235('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1443ad,_0x92abe9,_0x33bfa2){return new BPromise(function(_0x9be27d,_0x35e478){return client[_0x5235('0xa')](_0x1443ad,_0x33bfa2)[_0x5235('0xb')](function(_0x4ba310){logger[_0x5235('0xc')](_0x5235('0xd'),_0x92abe9,_0x5235('0xe'));logger['debug']('Sound,\x20%s,\x20%s,\x20%s',_0x92abe9,_0x5235('0xe'),JSON['stringify'](_0x4ba310));if(_0x4ba310[_0x5235('0xf')]){if(_0x4ba310[_0x5235('0xf')][_0x5235('0x10')]===0x1f4){logger[_0x5235('0xf')](_0x5235('0xd'),_0x92abe9,_0x4ba310[_0x5235('0xf')]['message']);return _0x35e478(_0x4ba310[_0x5235('0xf')][_0x5235('0x11')]);}logger[_0x5235('0xf')](_0x5235('0xd'),_0x92abe9,_0x4ba310['error'][_0x5235('0x11')]);return _0x9be27d(_0x4ba310[_0x5235('0xf')][_0x5235('0x11')]);}else{logger[_0x5235('0xc')](_0x5235('0xd'),_0x92abe9,_0x5235('0xe'));_0x9be27d(_0x4ba310['result'][_0x5235('0x11')]);}})[_0x5235('0x12')](function(_0x292d4d){logger[_0x5235('0xf')](_0x5235('0xd'),_0x92abe9,_0x292d4d);_0x35e478(_0x292d4d);});});}exports[_0x5235('0x13')]=function(_0x480280){var _0x1dd4e3=this;return new Promise(function(_0xfb4661,_0x359a17){return db[_0x5235('0x14')][_0x5235('0x15')]({'raw':_0x480280['options']?_0x480280['options'][_0x5235('0x16')]===undefined?!![]:![]:!![],'where':_0x480280[_0x5235('0x17')]?_0x480280['options'][_0x5235('0x18')]||null:null,'attributes':_0x480280[_0x5235('0x17')]?_0x480280[_0x5235('0x17')][_0x5235('0x19')]||null:null,'include':_0x480280[_0x5235('0x17')]?_0x480280[_0x5235('0x17')]['include']?_[_0x5235('0x1a')](_0x480280[_0x5235('0x17')][_0x5235('0x1b')],function(_0x4cac68){return{'model':db[_0x4cac68['model']],'as':_0x4cac68['as'],'attributes':_0x4cac68[_0x5235('0x19')],'include':_0x4cac68[_0x5235('0x1b')]?_[_0x5235('0x1a')](_0x4cac68[_0x5235('0x1b')],function(_0x597686){return{'model':db[_0x597686[_0x5235('0x1c')]],'as':_0x597686['as'],'attributes':_0x597686[_0x5235('0x19')],'include':_0x597686[_0x5235('0x1b')]?_['map'](_0x597686[_0x5235('0x1b')],function(_0x21d279){return{'model':db[_0x21d279['model']],'as':_0x21d279['as'],'attributes':_0x21d279[_0x5235('0x19')]};}):[]};}):[]};}):[]:[]})[_0x5235('0xb')](function(_0x1c2071){logger[_0x5235('0xc')](_0x5235('0x13'),_0x480280);logger['debug'](_0x5235('0x13'),_0x480280,JSON['stringify'](_0x1c2071));_0xfb4661(_0x1c2071);})[_0x5235('0x12')](function(_0x133f26){logger[_0x5235('0xf')](_0x5235('0x13'),_0x133f26[_0x5235('0x11')],_0x480280);_0x359a17(_0x1dd4e3[_0x5235('0xf')](0x1f4,_0x133f26[_0x5235('0x11')]));});});}; \ No newline at end of file +var _0x17bd=['raw','where','attributes','include','map','model','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','Sound,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','catch','ShowSound','options'];(function(_0x38ee5f,_0x361566){var _0x31cc9c=function(_0x41289e){while(--_0x41289e){_0x38ee5f['push'](_0x38ee5f['shift']());}};_0x31cc9c(++_0x361566);}(_0x17bd,0xd1));var _0xd17b=function(_0x306b6f,_0x50d2c9){_0x306b6f=_0x306b6f-0x0;var _0x4a78e9=_0x17bd[_0x306b6f];return _0x4a78e9;};'use strict';var _=require(_0xd17b('0x0'));var util=require(_0xd17b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xd17b('0x2'));var fs=require('fs');var Redis=require(_0xd17b('0x3'));var db=require(_0xd17b('0x4'))['db'];var utils=require(_0xd17b('0x5'));var logger=require(_0xd17b('0x6'))('rpc');var config=require(_0xd17b('0x7'));var jayson=require(_0xd17b('0x8'));var client=jayson['client'][_0xd17b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xd39637,_0x3c6ab0,_0x1acaac){return new BPromise(function(_0x5d429f,_0x77c6fa){return client[_0xd17b('0xa')](_0xd39637,_0x1acaac)[_0xd17b('0xb')](function(_0x4b8fa4){logger[_0xd17b('0xc')](_0xd17b('0xd'),_0x3c6ab0,'request\x20sent');logger[_0xd17b('0xe')]('Sound,\x20%s,\x20%s,\x20%s',_0x3c6ab0,_0xd17b('0xf'),JSON[_0xd17b('0x10')](_0x4b8fa4));if(_0x4b8fa4[_0xd17b('0x11')]){if(_0x4b8fa4[_0xd17b('0x11')][_0xd17b('0x12')]===0x1f4){logger['error']('Sound,\x20%s,\x20%s',_0x3c6ab0,_0x4b8fa4[_0xd17b('0x11')]['message']);return _0x77c6fa(_0x4b8fa4['error'][_0xd17b('0x13')]);}logger[_0xd17b('0x11')](_0xd17b('0xd'),_0x3c6ab0,_0x4b8fa4['error'][_0xd17b('0x13')]);return _0x5d429f(_0x4b8fa4[_0xd17b('0x11')]['message']);}else{logger[_0xd17b('0xc')](_0xd17b('0xd'),_0x3c6ab0,_0xd17b('0xf'));_0x5d429f(_0x4b8fa4['result'][_0xd17b('0x13')]);}})[_0xd17b('0x14')](function(_0x229d5b){logger[_0xd17b('0x11')](_0xd17b('0xd'),_0x3c6ab0,_0x229d5b);_0x77c6fa(_0x229d5b);});});}exports[_0xd17b('0x15')]=function(_0x436cbd){var _0x1050e9=this;return new Promise(function(_0xda442b,_0x372e96){return db['Sound']['find']({'raw':_0x436cbd[_0xd17b('0x16')]?_0x436cbd[_0xd17b('0x16')][_0xd17b('0x17')]===undefined?!![]:![]:!![],'where':_0x436cbd[_0xd17b('0x16')]?_0x436cbd[_0xd17b('0x16')][_0xd17b('0x18')]||null:null,'attributes':_0x436cbd[_0xd17b('0x16')]?_0x436cbd['options'][_0xd17b('0x19')]||null:null,'include':_0x436cbd[_0xd17b('0x16')]?_0x436cbd['options'][_0xd17b('0x1a')]?_['map'](_0x436cbd[_0xd17b('0x16')][_0xd17b('0x1a')],function(_0x719ef){return{'model':db[_0x719ef['model']],'as':_0x719ef['as'],'attributes':_0x719ef[_0xd17b('0x19')],'include':_0x719ef[_0xd17b('0x1a')]?_[_0xd17b('0x1b')](_0x719ef['include'],function(_0x51efe4){return{'model':db[_0x51efe4['model']],'as':_0x51efe4['as'],'attributes':_0x51efe4['attributes'],'include':_0x51efe4[_0xd17b('0x1a')]?_['map'](_0x51efe4['include'],function(_0xeec128){return{'model':db[_0xeec128[_0xd17b('0x1c')]],'as':_0xeec128['as'],'attributes':_0xeec128['attributes']};}):[]};}):[]};}):[]:[]})[_0xd17b('0xb')](function(_0x4288dc){logger[_0xd17b('0xc')](_0xd17b('0x15'),_0x436cbd);logger['debug'](_0xd17b('0x15'),_0x436cbd,JSON[_0xd17b('0x10')](_0x4288dc));_0xda442b(_0x4288dc);})[_0xd17b('0x14')](function(_0x387e93){logger[_0xd17b('0x11')](_0xd17b('0x15'),_0x387e93[_0xd17b('0x13')],_0x436cbd);_0x372e96(_0x1050e9['error'](0x1f4,_0x387e93['message']));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index 98c8daa..3ffbdf3 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 _0x14a0=['get','isAuthenticated','/:id','show','create','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./squareMessage.controller'];(function(_0x23d96f,_0x1153b7){var _0x2db681=function(_0x14167c){while(--_0x14167c){_0x23d96f['push'](_0x23d96f['shift']());}};_0x2db681(++_0x1153b7);}(_0x14a0,0x8e));var _0x014a=function(_0x1dc913,_0x222a97){_0x1dc913=_0x1dc913-0x0;var _0x55cd13=_0x14a0[_0x1dc913];return _0x55cd13;};'use strict';var multer=require('multer');var util=require(_0x014a('0x0'));var path=require(_0x014a('0x1'));var timeout=require(_0x014a('0x2'));var express=require(_0x014a('0x3'));var router=express[_0x014a('0x4')]();var fs_extra=require(_0x014a('0x5'));var auth=require(_0x014a('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x014a('0x7'));router[_0x014a('0x8')]('/',auth[_0x014a('0x9')](),controller['index']);router['get'](_0x014a('0xa'),auth[_0x014a('0x9')](),controller[_0x014a('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0x014a('0xc')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0x014a('0xd')]('/:id',auth[_0x014a('0x9')](),controller[_0x014a('0xe')]);module['exports']=router; \ No newline at end of file +var _0x14a0=['get','isAuthenticated','/:id','show','create','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./squareMessage.controller'];(function(_0x2fd69a,_0x5ecb47){var _0xbbaadd=function(_0x44f235){while(--_0x44f235){_0x2fd69a['push'](_0x2fd69a['shift']());}};_0xbbaadd(++_0x5ecb47);}(_0x14a0,0x8e));var _0x014a=function(_0x4361af,_0x4abb08){_0x4361af=_0x4361af-0x0;var _0x4790e0=_0x14a0[_0x4361af];return _0x4790e0;};'use strict';var multer=require('multer');var util=require(_0x014a('0x0'));var path=require(_0x014a('0x1'));var timeout=require(_0x014a('0x2'));var express=require(_0x014a('0x3'));var router=express[_0x014a('0x4')]();var fs_extra=require(_0x014a('0x5'));var auth=require(_0x014a('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x014a('0x7'));router[_0x014a('0x8')]('/',auth[_0x014a('0x9')](),controller['index']);router['get'](_0x014a('0xa'),auth[_0x014a('0x9')](),controller[_0x014a('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0x014a('0xc')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0x014a('0xd')]('/:id',auth[_0x014a('0x9')](),controller[_0x014a('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index ca36c2b..cf4d6f1 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 _0x4255=['TEXT','medium','ENUM','out','sequelize','exports','STRING'];(function(_0x595604,_0x2cc998){var _0x1466f3=function(_0x4e1d9b){while(--_0x4e1d9b){_0x595604['push'](_0x595604['shift']());}};_0x1466f3(++_0x2cc998);}(_0x4255,0x115));var _0x5425=function(_0xf79bae,_0x263b2a){_0xf79bae=_0xf79bae-0x0;var _0x5d2cb7=_0x4255[_0xf79bae];return _0x5d2cb7;};'use strict';var Sequelize=require(_0x5425('0x0'));module[_0x5425('0x1')]={'uniqueid':{'type':Sequelize[_0x5425('0x2')]},'body':{'type':Sequelize[_0x5425('0x3')](_0x5425('0x4')),'allowNull':![]},'direction':{'type':Sequelize[_0x5425('0x5')]('in',_0x5425('0x6')),'defaultValue':'out','allowNull':![]},'providerName':{'type':Sequelize[_0x5425('0x2')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x2c75=['medium','out','STRING','sequelize','TEXT'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x2c75,0x10c));var _0x52c7=function(_0x5b78e8,_0x55096b){_0x5b78e8=_0x5b78e8-0x0;var _0xf2c321=_0x2c75[_0x5b78e8];return _0xf2c321;};'use strict';var Sequelize=require(_0x52c7('0x0'));module['exports']={'uniqueid':{'type':Sequelize['STRING']},'body':{'type':Sequelize[_0x52c7('0x1')](_0x52c7('0x2')),'allowNull':![]},'direction':{'type':Sequelize['ENUM']('in',_0x52c7('0x3')),'defaultValue':_0x52c7('0x3'),'allowNull':![]},'providerName':{'type':Sequelize[_0x52c7('0x4')]},'providerResponse':{'type':Sequelize[_0x52c7('0x1')]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index ded9ca2..024f939 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 _0xb459=['keys','length','include','options','find','create','body','destroy','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','end','json','undefined','limit','count','status','set','apply','save','update','then','sendStatus','error','name','send','index','map','SquareMessage','rawAttributes','fieldName','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','type','VIRTUAL','merge','includeAll','rows','catch','show','params'];(function(_0x2fa2d6,_0x5d7dc8){var _0x3eb8ab=function(_0x23081f){while(--_0x23081f){_0x2fa2d6['push'](_0x2fa2d6['shift']());}};_0x3eb8ab(++_0x5d7dc8);}(_0xb459,0x1ca));var _0x9b45=function(_0x3598bb,_0x24befa){_0x3598bb=_0x3598bb-0x0;var _0x13c837=_0xb459[_0x3598bb];return _0x13c837;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9b45('0x0'));var zipdir=require(_0x9b45('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9b45('0x2'));var moment=require(_0x9b45('0x3'));var BPromise=require(_0x9b45('0x4'));var Mustache=require(_0x9b45('0x5'));var util=require(_0x9b45('0x6'));var path=require(_0x9b45('0x7'));var sox=require(_0x9b45('0x8'));var csv=require(_0x9b45('0x9'));var ejs=require(_0x9b45('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9b45('0xb'));var squel=require(_0x9b45('0xc'));var crypto=require(_0x9b45('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x9b45('0xe'));var toCsv=require(_0x9b45('0x9'));var querystring=require(_0x9b45('0xf'));var Papa=require(_0x9b45('0x10'));var Redis=require('ioredis');var authService=require(_0x9b45('0x11'));var qs=require(_0x9b45('0x12'));var as=require(_0x9b45('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9b45('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x9b45('0x15'));var licenseUtil=require(_0x9b45('0x16'));var db=require(_0x9b45('0x17'))['db'];function respondWithStatusCode(_0x4ce5a3,_0x4b0853){_0x4b0853=_0x4b0853||0xcc;return function(_0x569acf){if(_0x569acf){return _0x4ce5a3['sendStatus'](_0x4b0853);}return _0x4ce5a3['status'](_0x4b0853)[_0x9b45('0x18')]();};}function respondWithResult(_0x24332f,_0x54116d){_0x54116d=_0x54116d||0xc8;return function(_0xfcd0ae){if(_0xfcd0ae){return _0x24332f['status'](_0x54116d)[_0x9b45('0x19')](_0xfcd0ae);}};}function respondWithFilteredResult(_0x343cb0,_0x2f1afc){return function(_0x23cd81){if(_0x23cd81){var _0x5f5146=typeof _0x2f1afc['offset']===_0x9b45('0x1a')&&typeof _0x2f1afc[_0x9b45('0x1b')]===_0x9b45('0x1a');var _0x30c16e=_0x23cd81[_0x9b45('0x1c')];var _0x35bfbf=_0x5f5146?0x0:_0x2f1afc['offset'];var _0x3fea58=_0x5f5146?_0x23cd81[_0x9b45('0x1c')]:_0x2f1afc['offset']+_0x2f1afc['limit'];var _0x21e243;if(_0x3fea58>=_0x30c16e){_0x3fea58=_0x30c16e;_0x21e243=0xc8;}else{_0x21e243=0xce;}_0x343cb0[_0x9b45('0x1d')](_0x21e243);return _0x343cb0[_0x9b45('0x1e')]('Content-Range',_0x35bfbf+'-'+_0x3fea58+'/'+_0x30c16e)[_0x9b45('0x19')](_0x23cd81);}return null;};}function patchUpdates(_0x541b94){return function(_0x5ca087){try{jsonpatch[_0x9b45('0x1f')](_0x5ca087,_0x541b94,!![]);}catch(_0x5e0d32){return BPromise['reject'](_0x5e0d32);}return _0x5ca087[_0x9b45('0x20')]();};}function saveUpdates(_0x440587,_0x5dc9c9){return function(_0x190bc6){if(_0x190bc6){return _0x190bc6[_0x9b45('0x21')](_0x440587)[_0x9b45('0x22')](function(_0x318557){return _0x318557;});}return null;};}function removeEntity(_0x525d3b,_0x2d04d3){return function(_0x4c8b1f){if(_0x4c8b1f){return _0x4c8b1f['destroy']()['then'](function(){_0x525d3b[_0x9b45('0x1d')](0xcc)[_0x9b45('0x18')]();});}};}function handleEntityNotFound(_0x479c63,_0x2dddbc){return function(_0x5ca843){if(!_0x5ca843){_0x479c63[_0x9b45('0x23')](0x194);}return _0x5ca843;};}function handleError(_0x24e37d,_0x4bc5ed){_0x4bc5ed=_0x4bc5ed||0x1f4;return function(_0x4fb0ca){logger[_0x9b45('0x24')](_0x4fb0ca['stack']);if(_0x4fb0ca[_0x9b45('0x25')]){delete _0x4fb0ca[_0x9b45('0x25')];}_0x24e37d[_0x9b45('0x1d')](_0x4bc5ed)[_0x9b45('0x26')](_0x4fb0ca);};}exports[_0x9b45('0x27')]=function(_0x1fb06d,_0x40c1e8){var _0x129a0b={},_0xa1c520={},_0x2eee35={'count':0x0,'rows':[]};var _0x172f0c=_[_0x9b45('0x28')](db[_0x9b45('0x29')][_0x9b45('0x2a')],function(_0x500ac9){return{'name':_0x500ac9[_0x9b45('0x2b')],'type':_0x500ac9['type'][_0x9b45('0x2c')]};});_0xa1c520[_0x9b45('0x2d')]=_[_0x9b45('0x28')](_0x172f0c,'name');_0xa1c520[_0x9b45('0x2e')]=_['keys'](_0x1fb06d[_0x9b45('0x2e')]);_0xa1c520[_0x9b45('0x2f')]=_[_0x9b45('0x30')](_0xa1c520[_0x9b45('0x2d')],_0xa1c520[_0x9b45('0x2e')]);_0x129a0b['attributes']=_[_0x9b45('0x30')](_0xa1c520[_0x9b45('0x2d')],qs[_0x9b45('0x31')](_0x1fb06d[_0x9b45('0x2e')][_0x9b45('0x31')]));_0x129a0b['attributes']=_0x129a0b['attributes']['length']?_0x129a0b[_0x9b45('0x32')]:_0xa1c520['model'];if(!_0x1fb06d['query'][_0x9b45('0x33')](_0x9b45('0x34'))){_0x129a0b[_0x9b45('0x1b')]=qs[_0x9b45('0x1b')](_0x1fb06d[_0x9b45('0x2e')]['limit']);_0x129a0b[_0x9b45('0x35')]=qs[_0x9b45('0x35')](_0x1fb06d['query'][_0x9b45('0x35')]);}_0x129a0b[_0x9b45('0x36')]=qs[_0x9b45('0x37')](_0x1fb06d[_0x9b45('0x2e')][_0x9b45('0x37')]);_0x129a0b[_0x9b45('0x38')]=qs[_0x9b45('0x2f')](_[_0x9b45('0x39')](_0x1fb06d['query'],_0xa1c520[_0x9b45('0x2f')]),_0x172f0c);if(_0x1fb06d[_0x9b45('0x2e')][_0x9b45('0x3a')]){_0x129a0b['where']=_['merge'](_0x129a0b[_0x9b45('0x38')],{'$or':_[_0x9b45('0x28')](_0x172f0c,function(_0x2fafe5){if(_0x2fafe5[_0x9b45('0x3b')]!==_0x9b45('0x3c')){var _0x159c3e={};_0x159c3e[_0x2fafe5[_0x9b45('0x25')]]={'$like':'%'+_0x1fb06d[_0x9b45('0x2e')][_0x9b45('0x3a')]+'%'};return _0x159c3e;}})});}_0x129a0b=_[_0x9b45('0x3d')]({},_0x129a0b,_0x1fb06d['options']);var _0x5d2532={'where':_0x129a0b[_0x9b45('0x38')]};return db[_0x9b45('0x29')][_0x9b45('0x1c')](_0x5d2532)[_0x9b45('0x22')](function(_0x16adfe){_0x2eee35[_0x9b45('0x1c')]=_0x16adfe;if(_0x1fb06d[_0x9b45('0x2e')][_0x9b45('0x3e')]){_0x129a0b['include']=[{'all':!![]}];}return db[_0x9b45('0x29')]['findAll'](_0x129a0b);})[_0x9b45('0x22')](function(_0x24aa74){_0x2eee35[_0x9b45('0x3f')]=_0x24aa74;return _0x2eee35;})['then'](respondWithFilteredResult(_0x40c1e8,_0x129a0b))[_0x9b45('0x40')](handleError(_0x40c1e8,null));};exports[_0x9b45('0x41')]=function(_0x2fdddc,_0x259fc0){var _0x3ece5c={'raw':!![],'where':{'id':_0x2fdddc[_0x9b45('0x42')]['id']}},_0x139592={};_0x139592[_0x9b45('0x2d')]=_[_0x9b45('0x43')](db[_0x9b45('0x29')][_0x9b45('0x2a')]);_0x139592[_0x9b45('0x2e')]=_['keys'](_0x2fdddc[_0x9b45('0x2e')]);_0x139592[_0x9b45('0x2f')]=_[_0x9b45('0x30')](_0x139592['model'],_0x139592[_0x9b45('0x2e')]);_0x3ece5c['attributes']=_[_0x9b45('0x30')](_0x139592['model'],qs[_0x9b45('0x31')](_0x2fdddc[_0x9b45('0x2e')][_0x9b45('0x31')]));_0x3ece5c['attributes']=_0x3ece5c[_0x9b45('0x32')][_0x9b45('0x44')]?_0x3ece5c[_0x9b45('0x32')]:_0x139592['model'];if(_0x2fdddc[_0x9b45('0x2e')][_0x9b45('0x3e')]){_0x3ece5c[_0x9b45('0x45')]=[{'all':!![]}];}_0x3ece5c=_[_0x9b45('0x3d')]({},_0x3ece5c,_0x2fdddc[_0x9b45('0x46')]);return db[_0x9b45('0x29')][_0x9b45('0x47')](_0x3ece5c)[_0x9b45('0x22')](handleEntityNotFound(_0x259fc0,null))[_0x9b45('0x22')](respondWithResult(_0x259fc0,null))[_0x9b45('0x40')](handleError(_0x259fc0,null));};exports['create']=function(_0x5aee8d,_0x94456f){return db['SquareMessage'][_0x9b45('0x48')](_0x5aee8d[_0x9b45('0x49')],{})[_0x9b45('0x22')](respondWithResult(_0x94456f,0xc9))[_0x9b45('0x40')](handleError(_0x94456f,null));};exports[_0x9b45('0x21')]=function(_0x43abdc,_0x1cc0fe){if(_0x43abdc[_0x9b45('0x49')]['id']){delete _0x43abdc[_0x9b45('0x49')]['id'];}return db[_0x9b45('0x29')][_0x9b45('0x47')]({'where':{'id':_0x43abdc[_0x9b45('0x42')]['id']}})[_0x9b45('0x22')](handleEntityNotFound(_0x1cc0fe,null))[_0x9b45('0x22')](saveUpdates(_0x43abdc[_0x9b45('0x49')],null))[_0x9b45('0x22')](respondWithResult(_0x1cc0fe,null))[_0x9b45('0x40')](handleError(_0x1cc0fe,null));};exports[_0x9b45('0x4a')]=function(_0x1d19c6,_0x283843){return db[_0x9b45('0x29')][_0x9b45('0x47')]({'where':{'id':_0x1d19c6[_0x9b45('0x42')]['id']}})[_0x9b45('0x22')](handleEntityNotFound(_0x283843,null))['then'](removeEntity(_0x283843,null))['catch'](handleError(_0x283843,null));}; \ No newline at end of file +var _0xd89b=['../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','save','update','then','error','stack','name','send','map','rawAttributes','fieldName','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','type','VIRTUAL','options','where','includeAll','include','findAll','rows','show','merge','SquareMessage','catch','create','body','find','params','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x108db1,_0x89896d){var _0x16848d=function(_0x2726f6){while(--_0x2726f6){_0x108db1['push'](_0x108db1['shift']());}};_0x16848d(++_0x89896d);}(_0xd89b,0xca));var _0xbd89=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xd89b[_0x4b369d];return _0x571a98;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbd89('0x0'));var zipdir=require(_0xbd89('0x1'));var jsonpatch=require(_0xbd89('0x2'));var rp=require(_0xbd89('0x3'));var moment=require(_0xbd89('0x4'));var BPromise=require(_0xbd89('0x5'));var Mustache=require(_0xbd89('0x6'));var util=require(_0xbd89('0x7'));var path=require(_0xbd89('0x8'));var sox=require('sox');var csv=require(_0xbd89('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xbd89('0xa'));var crypto=require(_0xbd89('0xb'));var jsforce=require(_0xbd89('0xc'));var deskjs=require(_0xbd89('0xd'));var toCsv=require(_0xbd89('0x9'));var querystring=require(_0xbd89('0xe'));var Papa=require(_0xbd89('0xf'));var Redis=require(_0xbd89('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xbd89('0x11'));var as=require(_0xbd89('0x12'));var hardwareService=require(_0xbd89('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xbd89('0x14'));var config=require(_0xbd89('0x15'));var licenseUtil=require(_0xbd89('0x16'));var db=require(_0xbd89('0x17'))['db'];function respondWithStatusCode(_0x11e035,_0x5d362e){_0x5d362e=_0x5d362e||0xcc;return function(_0x1ac068){if(_0x1ac068){return _0x11e035[_0xbd89('0x18')](_0x5d362e);}return _0x11e035[_0xbd89('0x19')](_0x5d362e)[_0xbd89('0x1a')]();};}function respondWithResult(_0x2e3c1f,_0x5e080d){_0x5e080d=_0x5e080d||0xc8;return function(_0x221c66){if(_0x221c66){return _0x2e3c1f['status'](_0x5e080d)[_0xbd89('0x1b')](_0x221c66);}};}function respondWithFilteredResult(_0x12fc65,_0x1ba0f5){return function(_0x1a6b59){if(_0x1a6b59){var _0x1e516c=typeof _0x1ba0f5['offset']===_0xbd89('0x1c')&&typeof _0x1ba0f5[_0xbd89('0x1d')]===_0xbd89('0x1c');var _0x3d4786=_0x1a6b59[_0xbd89('0x1e')];var _0x2e0c7a=_0x1e516c?0x0:_0x1ba0f5['offset'];var _0x190bcc=_0x1e516c?_0x1a6b59[_0xbd89('0x1e')]:_0x1ba0f5[_0xbd89('0x1f')]+_0x1ba0f5['limit'];var _0x5814ca;if(_0x190bcc>=_0x3d4786){_0x190bcc=_0x3d4786;_0x5814ca=0xc8;}else{_0x5814ca=0xce;}_0x12fc65[_0xbd89('0x19')](_0x5814ca);return _0x12fc65['set'](_0xbd89('0x20'),_0x2e0c7a+'-'+_0x190bcc+'/'+_0x3d4786)[_0xbd89('0x1b')](_0x1a6b59);}return null;};}function patchUpdates(_0x2af25e){return function(_0x4963bb){try{jsonpatch[_0xbd89('0x21')](_0x4963bb,_0x2af25e,!![]);}catch(_0x507fee){return BPromise[_0xbd89('0x22')](_0x507fee);}return _0x4963bb[_0xbd89('0x23')]();};}function saveUpdates(_0x314bf3,_0x2f9a1e){return function(_0x56cc6a){if(_0x56cc6a){return _0x56cc6a[_0xbd89('0x24')](_0x314bf3)['then'](function(_0x4f5323){return _0x4f5323;});}return null;};}function removeEntity(_0x591616,_0xec6fed){return function(_0x1a23a0){if(_0x1a23a0){return _0x1a23a0['destroy']()[_0xbd89('0x25')](function(){_0x591616[_0xbd89('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0xd7a0ac,_0x5a5847){return function(_0xdd08d9){if(!_0xdd08d9){_0xd7a0ac[_0xbd89('0x18')](0x194);}return _0xdd08d9;};}function handleError(_0x5337aa,_0x4787e6){_0x4787e6=_0x4787e6||0x1f4;return function(_0x3b151a){logger[_0xbd89('0x26')](_0x3b151a[_0xbd89('0x27')]);if(_0x3b151a[_0xbd89('0x28')]){delete _0x3b151a[_0xbd89('0x28')];}_0x5337aa[_0xbd89('0x19')](_0x4787e6)[_0xbd89('0x29')](_0x3b151a);};}exports['index']=function(_0x360b54,_0x5afaeb){var _0x2c1460={},_0x2bc3bc={},_0x1b9479={'count':0x0,'rows':[]};var _0x1aec91=_[_0xbd89('0x2a')](db['SquareMessage'][_0xbd89('0x2b')],function(_0x2f70dc){return{'name':_0x2f70dc[_0xbd89('0x2c')],'type':_0x2f70dc['type'][_0xbd89('0x2d')]};});_0x2bc3bc[_0xbd89('0x2e')]=_[_0xbd89('0x2a')](_0x1aec91,_0xbd89('0x28'));_0x2bc3bc['query']=_[_0xbd89('0x2f')](_0x360b54['query']);_0x2bc3bc[_0xbd89('0x30')]=_[_0xbd89('0x31')](_0x2bc3bc[_0xbd89('0x2e')],_0x2bc3bc[_0xbd89('0x32')]);_0x2c1460[_0xbd89('0x33')]=_[_0xbd89('0x31')](_0x2bc3bc[_0xbd89('0x2e')],qs[_0xbd89('0x34')](_0x360b54['query'][_0xbd89('0x34')]));_0x2c1460[_0xbd89('0x33')]=_0x2c1460[_0xbd89('0x33')][_0xbd89('0x35')]?_0x2c1460[_0xbd89('0x33')]:_0x2bc3bc[_0xbd89('0x2e')];if(!_0x360b54[_0xbd89('0x32')][_0xbd89('0x36')]('nolimit')){_0x2c1460[_0xbd89('0x1d')]=qs[_0xbd89('0x1d')](_0x360b54[_0xbd89('0x32')][_0xbd89('0x1d')]);_0x2c1460[_0xbd89('0x1f')]=qs['offset'](_0x360b54[_0xbd89('0x32')]['offset']);}_0x2c1460[_0xbd89('0x37')]=qs[_0xbd89('0x38')](_0x360b54[_0xbd89('0x32')][_0xbd89('0x38')]);_0x2c1460['where']=qs['filters'](_[_0xbd89('0x39')](_0x360b54['query'],_0x2bc3bc['filters']),_0x1aec91);if(_0x360b54[_0xbd89('0x32')][_0xbd89('0x3a')]){_0x2c1460['where']=_['merge'](_0x2c1460['where'],{'$or':_[_0xbd89('0x2a')](_0x1aec91,function(_0x47b490){if(_0x47b490[_0xbd89('0x3b')]!==_0xbd89('0x3c')){var _0x12d2dd={};_0x12d2dd[_0x47b490[_0xbd89('0x28')]]={'$like':'%'+_0x360b54[_0xbd89('0x32')]['filter']+'%'};return _0x12d2dd;}})});}_0x2c1460=_['merge']({},_0x2c1460,_0x360b54[_0xbd89('0x3d')]);var _0x2c0522={'where':_0x2c1460[_0xbd89('0x3e')]};return db['SquareMessage'][_0xbd89('0x1e')](_0x2c0522)[_0xbd89('0x25')](function(_0x38223a){_0x1b9479[_0xbd89('0x1e')]=_0x38223a;if(_0x360b54[_0xbd89('0x32')][_0xbd89('0x3f')]){_0x2c1460[_0xbd89('0x40')]=[{'all':!![]}];}return db['SquareMessage'][_0xbd89('0x41')](_0x2c1460);})[_0xbd89('0x25')](function(_0x2116e0){_0x1b9479[_0xbd89('0x42')]=_0x2116e0;return _0x1b9479;})[_0xbd89('0x25')](respondWithFilteredResult(_0x5afaeb,_0x2c1460))['catch'](handleError(_0x5afaeb,null));};exports[_0xbd89('0x43')]=function(_0x262a4b,_0x6e1797){var _0x3e4b1a={'raw':!![],'where':{'id':_0x262a4b['params']['id']}},_0x2556b7={};_0x2556b7[_0xbd89('0x2e')]=_[_0xbd89('0x2f')](db['SquareMessage'][_0xbd89('0x2b')]);_0x2556b7[_0xbd89('0x32')]=_[_0xbd89('0x2f')](_0x262a4b[_0xbd89('0x32')]);_0x2556b7[_0xbd89('0x30')]=_[_0xbd89('0x31')](_0x2556b7[_0xbd89('0x2e')],_0x2556b7[_0xbd89('0x32')]);_0x3e4b1a[_0xbd89('0x33')]=_['intersection'](_0x2556b7[_0xbd89('0x2e')],qs['fields'](_0x262a4b[_0xbd89('0x32')][_0xbd89('0x34')]));_0x3e4b1a[_0xbd89('0x33')]=_0x3e4b1a[_0xbd89('0x33')][_0xbd89('0x35')]?_0x3e4b1a['attributes']:_0x2556b7[_0xbd89('0x2e')];if(_0x262a4b[_0xbd89('0x32')][_0xbd89('0x3f')]){_0x3e4b1a['include']=[{'all':!![]}];}_0x3e4b1a=_[_0xbd89('0x44')]({},_0x3e4b1a,_0x262a4b['options']);return db[_0xbd89('0x45')]['find'](_0x3e4b1a)[_0xbd89('0x25')](handleEntityNotFound(_0x6e1797,null))[_0xbd89('0x25')](respondWithResult(_0x6e1797,null))[_0xbd89('0x46')](handleError(_0x6e1797,null));};exports[_0xbd89('0x47')]=function(_0x4abff6,_0x5d62e5){return db[_0xbd89('0x45')][_0xbd89('0x47')](_0x4abff6[_0xbd89('0x48')],{})[_0xbd89('0x25')](respondWithResult(_0x5d62e5,0xc9))[_0xbd89('0x46')](handleError(_0x5d62e5,null));};exports[_0xbd89('0x24')]=function(_0x308b82,_0xbea75d){if(_0x308b82[_0xbd89('0x48')]['id']){delete _0x308b82[_0xbd89('0x48')]['id'];}return db['SquareMessage'][_0xbd89('0x49')]({'where':{'id':_0x308b82[_0xbd89('0x4a')]['id']}})[_0xbd89('0x25')](handleEntityNotFound(_0xbea75d,null))[_0xbd89('0x25')](saveUpdates(_0x308b82['body'],null))[_0xbd89('0x25')](respondWithResult(_0xbea75d,null))[_0xbd89('0x46')](handleError(_0xbea75d,null));};exports['destroy']=function(_0x33dce9,_0x121381){return db[_0xbd89('0x45')][_0xbd89('0x49')]({'where':{'id':_0x33dce9[_0xbd89('0x4a')]['id']}})['then'](handleEntityNotFound(_0x121381,null))['then'](removeEntity(_0x121381,null))[_0xbd89('0x46')](handleError(_0x121381,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index f69a1aa..c68c69c 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 _0xa47a=['exports','square_messages','lodash','util','api','moment','bluebird','request-promise','../../config/environment','./squareMessage.attributes'];(function(_0x2c944e,_0x26f659){var _0x2cc529=function(_0x3fbc4b){while(--_0x3fbc4b){_0x2c944e['push'](_0x2c944e['shift']());}};_0x2cc529(++_0x26f659);}(_0xa47a,0xde));var _0xaa47=function(_0x5da335,_0xcd7987){_0x5da335=_0x5da335-0x0;var _0x59cf54=_0xa47a[_0x5da335];return _0x59cf54;};'use strict';var _=require(_0xaa47('0x0'));var util=require(_0xaa47('0x1'));var logger=require('../../config/logger')(_0xaa47('0x2'));var moment=require(_0xaa47('0x3'));var BPromise=require(_0xaa47('0x4'));var rp=require(_0xaa47('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xaa47('0x6'));var attributes=require(_0xaa47('0x7'));module[_0xaa47('0x8')]=function(_0x1a258f,_0x4628b8){return _0x1a258f['define']('SquareMessage',attributes,{'tableName':_0xaa47('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x76bd=['bluebird','path','../../config/environment','./squareMessage.attributes','exports','define','SquareMessage','square_messages','lodash','util','../../config/logger','moment'];(function(_0x4b2863,_0x494899){var _0x567d67=function(_0x751f03){while(--_0x751f03){_0x4b2863['push'](_0x4b2863['shift']());}};_0x567d67(++_0x494899);}(_0x76bd,0x1c4));var _0xd76b=function(_0x294f92,_0x37758d){_0x294f92=_0x294f92-0x0;var _0x1bb812=_0x76bd[_0x294f92];return _0x1bb812;};'use strict';var _=require(_0xd76b('0x0'));var util=require(_0xd76b('0x1'));var logger=require(_0xd76b('0x2'))('api');var moment=require(_0xd76b('0x3'));var BPromise=require(_0xd76b('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd76b('0x5'));var rimraf=require('rimraf');var config=require(_0xd76b('0x6'));var attributes=require(_0xd76b('0x7'));module[_0xd76b('0x8')]=function(_0x472720,_0x5527b8){return _0x472720[_0xd76b('0x9')](_0xd76b('0xa'),attributes,{'tableName':_0xd76b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.rpc.js b/server/api/squareMessage/squareMessage.rpc.js index 617cc1c..ae71209 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 _0xacfb=['SquareMessage,\x20%s,\x20%s','message','result','create','body','options','raw','CreateSquareMessage','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','request','then','info','debug','SquareMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x29026d,_0x20af15){var _0xe04cfd=function(_0x1d4d4b){while(--_0x1d4d4b){_0x29026d['push'](_0x29026d['shift']());}};_0xe04cfd(++_0x20af15);}(_0xacfb,0x117));var _0xbacf=function(_0x462e6f,_0x2dd3e8){_0x462e6f=_0x462e6f-0x0;var _0x567ed5=_0xacfb[_0x462e6f];return _0x567ed5;};'use strict';var _=require(_0xbacf('0x0'));var util=require('util');var moment=require(_0xbacf('0x1'));var BPromise=require(_0xbacf('0x2'));var rs=require(_0xbacf('0x3'));var fs=require('fs');var Redis=require(_0xbacf('0x4'));var db=require(_0xbacf('0x5'))['db'];var utils=require(_0xbacf('0x6'));var logger=require('../../config/logger')(_0xbacf('0x7'));var config=require(_0xbacf('0x8'));var jayson=require(_0xbacf('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x104106,_0x40f8e5,_0x25e1b7){return new BPromise(function(_0x392384,_0x448dff){return client[_0xbacf('0xa')](_0x104106,_0x25e1b7)[_0xbacf('0xb')](function(_0x17bc38){logger[_0xbacf('0xc')]('SquareMessage,\x20%s,\x20%s',_0x40f8e5,'request\x20sent');logger[_0xbacf('0xd')](_0xbacf('0xe'),_0x40f8e5,_0xbacf('0xf'),JSON[_0xbacf('0x10')](_0x17bc38));if(_0x17bc38[_0xbacf('0x11')]){if(_0x17bc38[_0xbacf('0x11')]['code']===0x1f4){logger['error'](_0xbacf('0x12'),_0x40f8e5,_0x17bc38['error']['message']);return _0x448dff(_0x17bc38[_0xbacf('0x11')]['message']);}logger[_0xbacf('0x11')](_0xbacf('0x12'),_0x40f8e5,_0x17bc38[_0xbacf('0x11')][_0xbacf('0x13')]);return _0x392384(_0x17bc38[_0xbacf('0x11')][_0xbacf('0x13')]);}else{logger[_0xbacf('0xc')]('SquareMessage,\x20%s,\x20%s',_0x40f8e5,_0xbacf('0xf'));_0x392384(_0x17bc38[_0xbacf('0x14')][_0xbacf('0x13')]);}})['catch'](function(_0x2956e2){logger[_0xbacf('0x11')](_0xbacf('0x12'),_0x40f8e5,_0x2956e2);_0x448dff(_0x2956e2);});});}exports['CreateSquareMessage']=function(_0x11bc13){var _0x480c1c=this;return new Promise(function(_0x3a0a84,_0x1501a0){return db['SquareMessage'][_0xbacf('0x15')](_0x11bc13[_0xbacf('0x16')],{'raw':_0x11bc13['options']?_0x11bc13[_0xbacf('0x17')][_0xbacf('0x18')]===undefined?!![]:![]:!![]})[_0xbacf('0xb')](function(_0x180922){logger[_0xbacf('0xc')](_0xbacf('0x19'),_0x11bc13);logger[_0xbacf('0xd')](_0xbacf('0x19'),_0x11bc13,JSON[_0xbacf('0x10')](_0x180922));_0x3a0a84(_0x180922);})[_0xbacf('0x1a')](function(_0x362cab){logger[_0xbacf('0x11')](_0xbacf('0x19'),_0x362cab['message'],_0x11bc13);_0x1501a0(_0x480c1c[_0xbacf('0x11')](0x1f4,_0x362cab[_0xbacf('0x13')]));});});}; \ No newline at end of file +var _0xb71c=['request','then','info','debug','SquareMessage,\x20%s,\x20%s,\x20%s','request\x20sent','code','SquareMessage,\x20%s,\x20%s','error','message','result','CreateSquareMessage','raw','stringify','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x3cbe1c,_0x4bcabd){var _0x5ee08b=function(_0x5c53e6){while(--_0x5c53e6){_0x3cbe1c['push'](_0x3cbe1c['shift']());}};_0x5ee08b(++_0x4bcabd);}(_0xb71c,0x1bf));var _0xcb71=function(_0x4e309b,_0xcc6eea){_0x4e309b=_0x4e309b-0x0;var _0x358d51=_0xb71c[_0x4e309b];return _0x358d51;};'use strict';var _=require(_0xcb71('0x0'));var util=require(_0xcb71('0x1'));var moment=require('moment');var BPromise=require(_0xcb71('0x2'));var rs=require(_0xcb71('0x3'));var fs=require('fs');var Redis=require(_0xcb71('0x4'));var db=require(_0xcb71('0x5'))['db'];var utils=require(_0xcb71('0x6'));var logger=require(_0xcb71('0x7'))(_0xcb71('0x8'));var config=require(_0xcb71('0x9'));var jayson=require(_0xcb71('0xa'));var client=jayson[_0xcb71('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1768f5,_0x24a6aa,_0x591cad){return new BPromise(function(_0x305328,_0x28ba70){return client[_0xcb71('0xc')](_0x1768f5,_0x591cad)[_0xcb71('0xd')](function(_0x502e9e){logger[_0xcb71('0xe')]('SquareMessage,\x20%s,\x20%s',_0x24a6aa,'request\x20sent');logger[_0xcb71('0xf')](_0xcb71('0x10'),_0x24a6aa,_0xcb71('0x11'),JSON['stringify'](_0x502e9e));if(_0x502e9e['error']){if(_0x502e9e['error'][_0xcb71('0x12')]===0x1f4){logger['error'](_0xcb71('0x13'),_0x24a6aa,_0x502e9e[_0xcb71('0x14')][_0xcb71('0x15')]);return _0x28ba70(_0x502e9e['error'][_0xcb71('0x15')]);}logger[_0xcb71('0x14')](_0xcb71('0x13'),_0x24a6aa,_0x502e9e[_0xcb71('0x14')][_0xcb71('0x15')]);return _0x305328(_0x502e9e[_0xcb71('0x14')][_0xcb71('0x15')]);}else{logger[_0xcb71('0xe')](_0xcb71('0x13'),_0x24a6aa,_0xcb71('0x11'));_0x305328(_0x502e9e[_0xcb71('0x16')]['message']);}})['catch'](function(_0x1a3503){logger[_0xcb71('0x14')]('SquareMessage,\x20%s,\x20%s',_0x24a6aa,_0x1a3503);_0x28ba70(_0x1a3503);});});}exports[_0xcb71('0x17')]=function(_0x158e32){var _0xc35fdd=this;return new Promise(function(_0x5ec160,_0x318016){return db['SquareMessage']['create'](_0x158e32['body'],{'raw':_0x158e32['options']?_0x158e32['options'][_0xcb71('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x33d173){logger[_0xcb71('0xe')](_0xcb71('0x17'),_0x158e32);logger[_0xcb71('0xf')](_0xcb71('0x17'),_0x158e32,JSON[_0xcb71('0x19')](_0x33d173));_0x5ec160(_0x33d173);})[_0xcb71('0x1a')](function(_0x47234d){logger[_0xcb71('0x14')]('CreateSquareMessage',_0x47234d[_0xcb71('0x15')],_0x158e32);_0x318016(_0xc35fdd[_0xcb71('0x14')](0x1f4,_0x47234d[_0xcb71('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index f8b26cc..482b0f0 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 _0x7499=['isAuthenticated','/:id/test','15s','test','post','create','put','update','/:id','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareOdbc.controller','get'];(function(_0x1a0145,_0x4cbc1e){var _0xd3a095=function(_0xd94985){while(--_0xd94985){_0x1a0145['push'](_0x1a0145['shift']());}};_0xd3a095(++_0x4cbc1e);}(_0x7499,0x146));var _0x9749=function(_0x4b49c9,_0x290d55){_0x4b49c9=_0x4b49c9-0x0;var _0xab2d67=_0x7499[_0x4b49c9];return _0xab2d67;};'use strict';var multer=require('multer');var util=require(_0x9749('0x0'));var path=require(_0x9749('0x1'));var timeout=require(_0x9749('0x2'));var express=require(_0x9749('0x3'));var router=express[_0x9749('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x9749('0x5'));var interaction=require(_0x9749('0x6'));var config=require(_0x9749('0x7'));var controller=require(_0x9749('0x8'));router[_0x9749('0x9')]('/',auth[_0x9749('0xa')](),controller['index']);router[_0x9749('0x9')]('/:id',auth[_0x9749('0xa')](),controller['show']);router['get'](_0x9749('0xb'),auth[_0x9749('0xa')](),timeout(_0x9749('0xc')),controller[_0x9749('0xd')]);router[_0x9749('0xe')]('/',auth[_0x9749('0xa')](),controller[_0x9749('0xf')]);router[_0x9749('0x10')]('/:id',auth[_0x9749('0xa')](),controller[_0x9749('0x11')]);router['delete'](_0x9749('0x12'),auth[_0x9749('0xa')](),controller[_0x9749('0x13')]);module[_0x9749('0x14')]=router; \ No newline at end of file +var _0x7e7e=['destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareOdbc.controller','get','isAuthenticated','index','/:id','show','/:id/test','15s','test','create','put','update','delete'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x7e7e,0xf2));var _0xe7e7=function(_0x54bfab,_0x30fa8b){_0x54bfab=_0x54bfab-0x0;var _0x1a36a2=_0x7e7e[_0x54bfab];return _0x1a36a2;};'use strict';var multer=require(_0xe7e7('0x0'));var util=require(_0xe7e7('0x1'));var path=require(_0xe7e7('0x2'));var timeout=require(_0xe7e7('0x3'));var express=require(_0xe7e7('0x4'));var router=express[_0xe7e7('0x5')]();var fs_extra=require(_0xe7e7('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xe7e7('0x7'));var config=require(_0xe7e7('0x8'));var controller=require(_0xe7e7('0x9'));router[_0xe7e7('0xa')]('/',auth[_0xe7e7('0xb')](),controller[_0xe7e7('0xc')]);router[_0xe7e7('0xa')](_0xe7e7('0xd'),auth['isAuthenticated'](),controller[_0xe7e7('0xe')]);router[_0xe7e7('0xa')](_0xe7e7('0xf'),auth[_0xe7e7('0xb')](),timeout(_0xe7e7('0x10')),controller[_0xe7e7('0x11')]);router['post']('/',auth['isAuthenticated'](),controller[_0xe7e7('0x12')]);router[_0xe7e7('0x13')](_0xe7e7('0xd'),auth['isAuthenticated'](),controller[_0xe7e7('0x14')]);router[_0xe7e7('0x15')](_0xe7e7('0xd'),auth[_0xe7e7('0xb')](),controller[_0xe7e7('0x16')]);module[_0xe7e7('0x17')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index ee247bf..7e2ce19 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 _0x12e6=['exports','name','STRING','sequelize'];(function(_0x15f3fd,_0x1edb3d){var _0x4457a3=function(_0x284986){while(--_0x284986){_0x15f3fd['push'](_0x15f3fd['shift']());}};_0x4457a3(++_0x1edb3d);}(_0x12e6,0x9b));var _0x612e=function(_0x5f2ad7,_0x6b9c59){_0x5f2ad7=_0x5f2ad7-0x0;var _0x4263b2=_0x12e6[_0x5f2ad7];return _0x4263b2;};'use strict';var Sequelize=require(_0x612e('0x0'));module[_0x612e('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x612e('0x2'),'allowNull':![]},'dsn':{'type':Sequelize[_0x612e('0x3')]},'description':{'type':Sequelize[_0x612e('0x3')]}}; \ No newline at end of file +var _0xcb82=['name','sequelize','STRING'];(function(_0x4f2c98,_0x1648ab){var _0x4df815=function(_0x28f0e5){while(--_0x28f0e5){_0x4f2c98['push'](_0x4f2c98['shift']());}};_0x4df815(++_0x1648ab);}(_0xcb82,0x11b));var _0x2cb8=function(_0x571977,_0x93e567){_0x571977=_0x571977-0x0;var _0x217f4=_0xcb82[_0x571977];return _0x217f4;};'use strict';var Sequelize=require(_0x2cb8('0x0'));module['exports']={'name':{'type':Sequelize[_0x2cb8('0x1')],'unique':_0x2cb8('0x2'),'allowNull':![]},'dsn':{'type':Sequelize[_0x2cb8('0x1')]},'description':{'type':Sequelize[_0x2cb8('0x1')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index b3d3c4d..c5e3511 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 _0x7ef5=['merge','type','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','length','options','find','create','body','user','role','ODBC','UserProfileSection','userProfileId','autoAssociation','test','odbc','openSync','closeSync','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','get','UserProfileResource','destroy','error','stack','name','index','map','SquareOdbc','fieldName','key','keys','intersection','model','query','attributes','fields','hasOwnProperty','nolimit','sort','where','filters','pick','filter'];(function(_0x9681c2,_0x42cb22){var _0x177f77=function(_0x2c2f9e){while(--_0x2c2f9e){_0x9681c2['push'](_0x9681c2['shift']());}};_0x177f77(++_0x42cb22);}(_0x7ef5,0x179));var _0x57ef=function(_0x35f62b,_0x17bd60){_0x35f62b=_0x35f62b-0x0;var _0x1c91fa=_0x7ef5[_0x35f62b];return _0x1c91fa;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x57ef('0x0'));var zipdir=require(_0x57ef('0x1'));var jsonpatch=require(_0x57ef('0x2'));var rp=require(_0x57ef('0x3'));var moment=require(_0x57ef('0x4'));var BPromise=require(_0x57ef('0x5'));var Mustache=require(_0x57ef('0x6'));var util=require(_0x57ef('0x7'));var path=require(_0x57ef('0x8'));var sox=require(_0x57ef('0x9'));var csv=require(_0x57ef('0xa'));var ejs=require(_0x57ef('0xb'));var fs=require('fs');var fs_extra=require(_0x57ef('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x57ef('0xd'));var jsforce=require(_0x57ef('0xe'));var deskjs=require(_0x57ef('0xf'));var toCsv=require(_0x57ef('0xa'));var querystring=require(_0x57ef('0x10'));var Papa=require('papaparse');var Redis=require(_0x57ef('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x57ef('0x12'));var as=require(_0x57ef('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x57ef('0x14'))(_0x57ef('0x15'));var utils=require(_0x57ef('0x16'));var config=require(_0x57ef('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x57ef('0x18'))['db'];function respondWithStatusCode(_0x2d0a43,_0x2f59ae){_0x2f59ae=_0x2f59ae||0xcc;return function(_0x55830d){if(_0x55830d){return _0x2d0a43[_0x57ef('0x19')](_0x2f59ae);}return _0x2d0a43[_0x57ef('0x1a')](_0x2f59ae)[_0x57ef('0x1b')]();};}function respondWithResult(_0x12a83f,_0x33cdd5){_0x33cdd5=_0x33cdd5||0xc8;return function(_0x349df1){if(_0x349df1){return _0x12a83f[_0x57ef('0x1a')](_0x33cdd5)[_0x57ef('0x1c')](_0x349df1);}};}function respondWithFilteredResult(_0x3847d7,_0x5d9aa5){return function(_0x42176c){if(_0x42176c){var _0x3a3057=typeof _0x5d9aa5[_0x57ef('0x1d')]===_0x57ef('0x1e')&&typeof _0x5d9aa5[_0x57ef('0x1f')]===_0x57ef('0x1e');var _0x212a4d=_0x42176c[_0x57ef('0x20')];var _0x5af581=_0x3a3057?0x0:_0x5d9aa5[_0x57ef('0x1d')];var _0x3b0343=_0x3a3057?_0x42176c[_0x57ef('0x20')]:_0x5d9aa5[_0x57ef('0x1d')]+_0x5d9aa5['limit'];var _0x39f4f5;if(_0x3b0343>=_0x212a4d){_0x3b0343=_0x212a4d;_0x39f4f5=0xc8;}else{_0x39f4f5=0xce;}_0x3847d7['status'](_0x39f4f5);return _0x3847d7[_0x57ef('0x21')](_0x57ef('0x22'),_0x5af581+'-'+_0x3b0343+'/'+_0x212a4d)[_0x57ef('0x1c')](_0x42176c);}return null;};}function patchUpdates(_0x519ffe){return function(_0x527710){try{jsonpatch[_0x57ef('0x23')](_0x527710,_0x519ffe,!![]);}catch(_0xaff0){return BPromise[_0x57ef('0x24')](_0xaff0);}return _0x527710['save']();};}function saveUpdates(_0x4bb6be,_0x256be3){return function(_0x52fe60){if(_0x52fe60){return _0x52fe60[_0x57ef('0x25')](_0x4bb6be)[_0x57ef('0x26')](function(_0x7651ba){return _0x7651ba;});}return null;};}function removeEntity(_0x33452f,_0x257101){return function(_0x3ae7cc){if(_0x3ae7cc){return _0x3ae7cc['destroy']()[_0x57ef('0x26')](function(){var _0x28c020=_0x3ae7cc[_0x57ef('0x27')]({'plain':!![]});var _0x393eee='ODBC';return db[_0x57ef('0x28')][_0x57ef('0x29')]({'where':{'type':_0x393eee,'resourceId':_0x28c020['id']}})[_0x57ef('0x26')](function(){return _0x3ae7cc;});})['then'](function(){_0x33452f['status'](0xcc)[_0x57ef('0x1b')]();});}};}function handleEntityNotFound(_0x249fbb,_0x8ec6c0){return function(_0x541044){if(!_0x541044){_0x249fbb[_0x57ef('0x19')](0x194);}return _0x541044;};}function handleError(_0x35bb9d,_0x1baff4){_0x1baff4=_0x1baff4||0x1f4;return function(_0x69c19e){logger[_0x57ef('0x2a')](_0x69c19e[_0x57ef('0x2b')]);if(_0x69c19e[_0x57ef('0x2c')]){delete _0x69c19e[_0x57ef('0x2c')];}_0x35bb9d[_0x57ef('0x1a')](_0x1baff4)['send'](_0x69c19e);};}exports[_0x57ef('0x2d')]=function(_0x32bbeb,_0x462e76){var _0x527c05={},_0x135194={},_0xb3fbbf={'count':0x0,'rows':[]};var _0x3bc57a=_[_0x57ef('0x2e')](db[_0x57ef('0x2f')]['rawAttributes'],function(_0x376937){return{'name':_0x376937[_0x57ef('0x30')],'type':_0x376937['type'][_0x57ef('0x31')]};});_0x135194['model']=_['map'](_0x3bc57a,_0x57ef('0x2c'));_0x135194['query']=_[_0x57ef('0x32')](_0x32bbeb['query']);_0x135194['filters']=_[_0x57ef('0x33')](_0x135194[_0x57ef('0x34')],_0x135194[_0x57ef('0x35')]);_0x527c05[_0x57ef('0x36')]=_['intersection'](_0x135194[_0x57ef('0x34')],qs[_0x57ef('0x37')](_0x32bbeb[_0x57ef('0x35')][_0x57ef('0x37')]));_0x527c05[_0x57ef('0x36')]=_0x527c05[_0x57ef('0x36')]['length']?_0x527c05[_0x57ef('0x36')]:_0x135194['model'];if(!_0x32bbeb[_0x57ef('0x35')][_0x57ef('0x38')](_0x57ef('0x39'))){_0x527c05[_0x57ef('0x1f')]=qs[_0x57ef('0x1f')](_0x32bbeb[_0x57ef('0x35')]['limit']);_0x527c05[_0x57ef('0x1d')]=qs[_0x57ef('0x1d')](_0x32bbeb[_0x57ef('0x35')]['offset']);}_0x527c05['order']=qs[_0x57ef('0x3a')](_0x32bbeb[_0x57ef('0x35')][_0x57ef('0x3a')]);_0x527c05[_0x57ef('0x3b')]=qs[_0x57ef('0x3c')](_[_0x57ef('0x3d')](_0x32bbeb['query'],_0x135194[_0x57ef('0x3c')]),_0x3bc57a);if(_0x32bbeb[_0x57ef('0x35')][_0x57ef('0x3e')]){_0x527c05[_0x57ef('0x3b')]=_[_0x57ef('0x3f')](_0x527c05[_0x57ef('0x3b')],{'$or':_[_0x57ef('0x2e')](_0x3bc57a,function(_0x2d7b2a){if(_0x2d7b2a[_0x57ef('0x40')]!==_0x57ef('0x41')){var _0x5d7971={};_0x5d7971[_0x2d7b2a[_0x57ef('0x2c')]]={'$like':'%'+_0x32bbeb[_0x57ef('0x35')][_0x57ef('0x3e')]+'%'};return _0x5d7971;}})});}_0x527c05=_[_0x57ef('0x3f')]({},_0x527c05,_0x32bbeb['options']);var _0x161040={'where':_0x527c05[_0x57ef('0x3b')]};return db['SquareOdbc'][_0x57ef('0x20')](_0x161040)[_0x57ef('0x26')](function(_0x50a74d){_0xb3fbbf[_0x57ef('0x20')]=_0x50a74d;if(_0x32bbeb['query'][_0x57ef('0x42')]){_0x527c05[_0x57ef('0x43')]=[{'all':!![]}];}return db[_0x57ef('0x2f')][_0x57ef('0x44')](_0x527c05);})[_0x57ef('0x26')](function(_0x5e5cea){_0xb3fbbf[_0x57ef('0x45')]=_0x5e5cea;return _0xb3fbbf;})['then'](respondWithFilteredResult(_0x462e76,_0x527c05))[_0x57ef('0x46')](handleError(_0x462e76,null));};exports[_0x57ef('0x47')]=function(_0x69dfd1,_0x37d6c6){var _0x130499={'raw':!![],'where':{'id':_0x69dfd1[_0x57ef('0x48')]['id']}},_0x5e885f={};_0x5e885f[_0x57ef('0x34')]=_['keys'](db[_0x57ef('0x2f')]['rawAttributes']);_0x5e885f['query']=_['keys'](_0x69dfd1['query']);_0x5e885f['filters']=_[_0x57ef('0x33')](_0x5e885f[_0x57ef('0x34')],_0x5e885f['query']);_0x130499[_0x57ef('0x36')]=_['intersection'](_0x5e885f[_0x57ef('0x34')],qs[_0x57ef('0x37')](_0x69dfd1[_0x57ef('0x35')][_0x57ef('0x37')]));_0x130499[_0x57ef('0x36')]=_0x130499['attributes'][_0x57ef('0x49')]?_0x130499[_0x57ef('0x36')]:_0x5e885f[_0x57ef('0x34')];if(_0x69dfd1[_0x57ef('0x35')]['includeAll']){_0x130499[_0x57ef('0x43')]=[{'all':!![]}];}_0x130499=_[_0x57ef('0x3f')]({},_0x130499,_0x69dfd1[_0x57ef('0x4a')]);return db[_0x57ef('0x2f')][_0x57ef('0x4b')](_0x130499)[_0x57ef('0x26')](handleEntityNotFound(_0x37d6c6,null))[_0x57ef('0x26')](respondWithResult(_0x37d6c6,null))[_0x57ef('0x46')](handleError(_0x37d6c6,null));};exports[_0x57ef('0x4c')]=function(_0x2f381f,_0x85d164){return db[_0x57ef('0x2f')][_0x57ef('0x4c')](_0x2f381f[_0x57ef('0x4d')],{})[_0x57ef('0x26')](function(_0x39f9e7){var _0x2e6d35=_0x2f381f[_0x57ef('0x4e')][_0x57ef('0x27')]({'plain':!![]});if(!_0x2e6d35)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2e6d35[_0x57ef('0x4f')]===_0x57ef('0x4e')){var _0x1dcd6b=_0x39f9e7['get']({'plain':!![]});var _0x48a94e=_0x57ef('0x50');return db[_0x57ef('0x51')][_0x57ef('0x4b')]({'where':{'name':_0x48a94e,'userProfileId':_0x2e6d35[_0x57ef('0x52')]},'raw':!![]})[_0x57ef('0x26')](function(_0x141440){if(_0x141440&&_0x141440[_0x57ef('0x53')]===0x0){return db[_0x57ef('0x28')][_0x57ef('0x4c')]({'name':_0x1dcd6b[_0x57ef('0x2c')],'resourceId':_0x1dcd6b['id'],'type':_0x141440[_0x57ef('0x2c')],'sectionId':_0x141440['id']},{})[_0x57ef('0x26')](function(){return _0x39f9e7;});}else{return _0x39f9e7;}})['catch'](function(_0x526abc){logger[_0x57ef('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x526abc);throw _0x526abc;});}return _0x39f9e7;})[_0x57ef('0x26')](respondWithResult(_0x85d164,0xc9))[_0x57ef('0x46')](handleError(_0x85d164,null));};exports[_0x57ef('0x25')]=function(_0x3a1660,_0x947145){if(_0x3a1660['body']['id']){delete _0x3a1660['body']['id'];}return db[_0x57ef('0x2f')][_0x57ef('0x4b')]({'where':{'id':_0x3a1660[_0x57ef('0x48')]['id']}})[_0x57ef('0x26')](handleEntityNotFound(_0x947145,null))[_0x57ef('0x26')](saveUpdates(_0x3a1660[_0x57ef('0x4d')],null))[_0x57ef('0x26')](respondWithResult(_0x947145,null))['catch'](handleError(_0x947145,null));};exports[_0x57ef('0x29')]=function(_0x326332,_0x33f76e){return db[_0x57ef('0x2f')][_0x57ef('0x4b')]({'where':{'id':_0x326332[_0x57ef('0x48')]['id']}})[_0x57ef('0x26')](handleEntityNotFound(_0x33f76e,null))['then'](removeEntity(_0x33f76e,null))[_0x57ef('0x46')](handleError(_0x33f76e,null));};exports[_0x57ef('0x54')]=function(_0x4994e4,_0x456ac7,_0x4de0fb){var _0x55b56c;return db[_0x57ef('0x2f')][_0x57ef('0x4b')]({'where':{'id':_0x4994e4[_0x57ef('0x48')]['id']},'attributes':['id','dsn']})[_0x57ef('0x26')](handleEntityNotFound(_0x456ac7,null))[_0x57ef('0x26')](function(_0x410cd8){if(_0x410cd8){var _0x3df2ee=require(_0x57ef('0x55'))();_0x3df2ee[_0x57ef('0x56')](_0x410cd8['dsn']);_0x3df2ee[_0x57ef('0x57')]();return _0x410cd8;}})[_0x57ef('0x26')](respondWithResult(_0x456ac7,null))[_0x57ef('0x46')](handleError(_0x456ac7,null));}; \ No newline at end of file +var _0x8331=['../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','get','UserProfileResource','destroy','error','stack','name','send','index','map','SquareOdbc','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','test','dsn','odbc','openSync','closeSync','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch'];(function(_0x1432a0,_0x248731){var _0x21b9f5=function(_0x2fdb43){while(--_0x2fdb43){_0x1432a0['push'](_0x1432a0['shift']());}};_0x21b9f5(++_0x248731);}(_0x8331,0xf3));var _0x1833=function(_0xc8a931,_0x260690){_0xc8a931=_0xc8a931-0x0;var _0x28bd27=_0x8331[_0xc8a931];return _0x28bd27;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1833('0x0'));var zipdir=require(_0x1833('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1833('0x2'));var moment=require(_0x1833('0x3'));var BPromise=require(_0x1833('0x4'));var Mustache=require(_0x1833('0x5'));var util=require('util');var path=require(_0x1833('0x6'));var sox=require(_0x1833('0x7'));var csv=require(_0x1833('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1833('0x9'));var _=require('lodash');var squel=require(_0x1833('0xa'));var crypto=require(_0x1833('0xb'));var jsforce=require(_0x1833('0xc'));var deskjs=require(_0x1833('0xd'));var toCsv=require(_0x1833('0x8'));var querystring=require('querystring');var Papa=require(_0x1833('0xe'));var Redis=require(_0x1833('0xf'));var authService=require(_0x1833('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x1833('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1833('0x12'))('api');var utils=require('../../config/utils');var config=require(_0x1833('0x13'));var licenseUtil=require(_0x1833('0x14'));var db=require(_0x1833('0x15'))['db'];function respondWithStatusCode(_0x3187a7,_0x31c194){_0x31c194=_0x31c194||0xcc;return function(_0xb15265){if(_0xb15265){return _0x3187a7[_0x1833('0x16')](_0x31c194);}return _0x3187a7[_0x1833('0x17')](_0x31c194)[_0x1833('0x18')]();};}function respondWithResult(_0x4c00f4,_0x46a493){_0x46a493=_0x46a493||0xc8;return function(_0x246d99){if(_0x246d99){return _0x4c00f4['status'](_0x46a493)[_0x1833('0x19')](_0x246d99);}};}function respondWithFilteredResult(_0x57001f,_0x231645){return function(_0x1eb87b){if(_0x1eb87b){var _0x51eab0=typeof _0x231645[_0x1833('0x1a')]===_0x1833('0x1b')&&typeof _0x231645['limit']===_0x1833('0x1b');var _0x29a42b=_0x1eb87b[_0x1833('0x1c')];var _0xb472bf=_0x51eab0?0x0:_0x231645['offset'];var _0x1600ef=_0x51eab0?_0x1eb87b[_0x1833('0x1c')]:_0x231645[_0x1833('0x1a')]+_0x231645[_0x1833('0x1d')];var _0x3ae904;if(_0x1600ef>=_0x29a42b){_0x1600ef=_0x29a42b;_0x3ae904=0xc8;}else{_0x3ae904=0xce;}_0x57001f[_0x1833('0x17')](_0x3ae904);return _0x57001f[_0x1833('0x1e')](_0x1833('0x1f'),_0xb472bf+'-'+_0x1600ef+'/'+_0x29a42b)['json'](_0x1eb87b);}return null;};}function patchUpdates(_0x127f47){return function(_0x4c019b){try{jsonpatch[_0x1833('0x20')](_0x4c019b,_0x127f47,!![]);}catch(_0x39cc87){return BPromise[_0x1833('0x21')](_0x39cc87);}return _0x4c019b[_0x1833('0x22')]();};}function saveUpdates(_0x4648b6,_0x5355f6){return function(_0x4f784f){if(_0x4f784f){return _0x4f784f[_0x1833('0x23')](_0x4648b6)[_0x1833('0x24')](function(_0x24c0b0){return _0x24c0b0;});}return null;};}function removeEntity(_0x4a1e60,_0x741de6){return function(_0x3206b5){if(_0x3206b5){return _0x3206b5['destroy']()['then'](function(){var _0x3e507d=_0x3206b5[_0x1833('0x25')]({'plain':!![]});var _0x3f6d39='ODBC';return db[_0x1833('0x26')][_0x1833('0x27')]({'where':{'type':_0x3f6d39,'resourceId':_0x3e507d['id']}})[_0x1833('0x24')](function(){return _0x3206b5;});})[_0x1833('0x24')](function(){_0x4a1e60[_0x1833('0x17')](0xcc)[_0x1833('0x18')]();});}};}function handleEntityNotFound(_0x2c94f1,_0x6ef36c){return function(_0x31e7dd){if(!_0x31e7dd){_0x2c94f1['sendStatus'](0x194);}return _0x31e7dd;};}function handleError(_0x30657c,_0x1b50f1){_0x1b50f1=_0x1b50f1||0x1f4;return function(_0x846159){logger[_0x1833('0x28')](_0x846159[_0x1833('0x29')]);if(_0x846159[_0x1833('0x2a')]){delete _0x846159[_0x1833('0x2a')];}_0x30657c[_0x1833('0x17')](_0x1b50f1)[_0x1833('0x2b')](_0x846159);};}exports[_0x1833('0x2c')]=function(_0x5ee4d5,_0x10f30b){var _0x4d868c={},_0x56aecf={},_0x4a94df={'count':0x0,'rows':[]};var _0x1d7122=_[_0x1833('0x2d')](db[_0x1833('0x2e')]['rawAttributes'],function(_0x1246d9){return{'name':_0x1246d9[_0x1833('0x2f')],'type':_0x1246d9[_0x1833('0x30')][_0x1833('0x31')]};});_0x56aecf[_0x1833('0x32')]=_[_0x1833('0x2d')](_0x1d7122,_0x1833('0x2a'));_0x56aecf[_0x1833('0x33')]=_[_0x1833('0x34')](_0x5ee4d5[_0x1833('0x33')]);_0x56aecf[_0x1833('0x35')]=_['intersection'](_0x56aecf[_0x1833('0x32')],_0x56aecf[_0x1833('0x33')]);_0x4d868c[_0x1833('0x36')]=_[_0x1833('0x37')](_0x56aecf[_0x1833('0x32')],qs[_0x1833('0x38')](_0x5ee4d5[_0x1833('0x33')][_0x1833('0x38')]));_0x4d868c['attributes']=_0x4d868c[_0x1833('0x36')][_0x1833('0x39')]?_0x4d868c[_0x1833('0x36')]:_0x56aecf['model'];if(!_0x5ee4d5[_0x1833('0x33')][_0x1833('0x3a')](_0x1833('0x3b'))){_0x4d868c[_0x1833('0x1d')]=qs['limit'](_0x5ee4d5[_0x1833('0x33')][_0x1833('0x1d')]);_0x4d868c[_0x1833('0x1a')]=qs[_0x1833('0x1a')](_0x5ee4d5['query'][_0x1833('0x1a')]);}_0x4d868c[_0x1833('0x3c')]=qs[_0x1833('0x3d')](_0x5ee4d5[_0x1833('0x33')][_0x1833('0x3d')]);_0x4d868c[_0x1833('0x3e')]=qs['filters'](_[_0x1833('0x3f')](_0x5ee4d5[_0x1833('0x33')],_0x56aecf[_0x1833('0x35')]),_0x1d7122);if(_0x5ee4d5[_0x1833('0x33')]['filter']){_0x4d868c[_0x1833('0x3e')]=_['merge'](_0x4d868c[_0x1833('0x3e')],{'$or':_['map'](_0x1d7122,function(_0x58e3e7){if(_0x58e3e7[_0x1833('0x30')]!=='VIRTUAL'){var _0x312d66={};_0x312d66[_0x58e3e7['name']]={'$like':'%'+_0x5ee4d5[_0x1833('0x33')][_0x1833('0x40')]+'%'};return _0x312d66;}})});}_0x4d868c=_[_0x1833('0x41')]({},_0x4d868c,_0x5ee4d5[_0x1833('0x42')]);var _0x112ce4={'where':_0x4d868c[_0x1833('0x3e')]};return db[_0x1833('0x2e')][_0x1833('0x1c')](_0x112ce4)[_0x1833('0x24')](function(_0x5171ab){_0x4a94df['count']=_0x5171ab;if(_0x5ee4d5[_0x1833('0x33')][_0x1833('0x43')]){_0x4d868c[_0x1833('0x44')]=[{'all':!![]}];}return db[_0x1833('0x2e')][_0x1833('0x45')](_0x4d868c);})[_0x1833('0x24')](function(_0x1d40eb){_0x4a94df[_0x1833('0x46')]=_0x1d40eb;return _0x4a94df;})[_0x1833('0x24')](respondWithFilteredResult(_0x10f30b,_0x4d868c))[_0x1833('0x47')](handleError(_0x10f30b,null));};exports[_0x1833('0x48')]=function(_0x13c5b6,_0xcecd64){var _0x54f1ac={'raw':!![],'where':{'id':_0x13c5b6[_0x1833('0x49')]['id']}},_0x20605f={};_0x20605f[_0x1833('0x32')]=_['keys'](db[_0x1833('0x2e')]['rawAttributes']);_0x20605f[_0x1833('0x33')]=_[_0x1833('0x34')](_0x13c5b6[_0x1833('0x33')]);_0x20605f[_0x1833('0x35')]=_[_0x1833('0x37')](_0x20605f[_0x1833('0x32')],_0x20605f[_0x1833('0x33')]);_0x54f1ac[_0x1833('0x36')]=_['intersection'](_0x20605f[_0x1833('0x32')],qs[_0x1833('0x38')](_0x13c5b6['query'][_0x1833('0x38')]));_0x54f1ac['attributes']=_0x54f1ac['attributes'][_0x1833('0x39')]?_0x54f1ac[_0x1833('0x36')]:_0x20605f[_0x1833('0x32')];if(_0x13c5b6[_0x1833('0x33')][_0x1833('0x43')]){_0x54f1ac[_0x1833('0x44')]=[{'all':!![]}];}_0x54f1ac=_[_0x1833('0x41')]({},_0x54f1ac,_0x13c5b6['options']);return db[_0x1833('0x2e')][_0x1833('0x4a')](_0x54f1ac)[_0x1833('0x24')](handleEntityNotFound(_0xcecd64,null))[_0x1833('0x24')](respondWithResult(_0xcecd64,null))[_0x1833('0x47')](handleError(_0xcecd64,null));};exports['create']=function(_0x23a400,_0x43b713){return db[_0x1833('0x2e')]['create'](_0x23a400[_0x1833('0x4b')],{})[_0x1833('0x24')](function(_0xbf88c8){var _0x5bd608=_0x23a400[_0x1833('0x4c')][_0x1833('0x25')]({'plain':!![]});if(!_0x5bd608)throw new Error(_0x1833('0x4d'));if(_0x5bd608[_0x1833('0x4e')]===_0x1833('0x4c')){var _0x275524=_0xbf88c8[_0x1833('0x25')]({'plain':!![]});var _0x45ddab='ODBC';return db[_0x1833('0x4f')][_0x1833('0x4a')]({'where':{'name':_0x45ddab,'userProfileId':_0x5bd608[_0x1833('0x50')]},'raw':!![]})[_0x1833('0x24')](function(_0xf9ea12){if(_0xf9ea12&&_0xf9ea12[_0x1833('0x51')]===0x0){return db[_0x1833('0x26')]['create']({'name':_0x275524[_0x1833('0x2a')],'resourceId':_0x275524['id'],'type':_0xf9ea12[_0x1833('0x2a')],'sectionId':_0xf9ea12['id']},{})['then'](function(){return _0xbf88c8;});}else{return _0xbf88c8;}})[_0x1833('0x47')](function(_0xe939d4){logger[_0x1833('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xe939d4);throw _0xe939d4;});}return _0xbf88c8;})['then'](respondWithResult(_0x43b713,0xc9))[_0x1833('0x47')](handleError(_0x43b713,null));};exports[_0x1833('0x23')]=function(_0x3ad4a8,_0x311ed1){if(_0x3ad4a8[_0x1833('0x4b')]['id']){delete _0x3ad4a8['body']['id'];}return db['SquareOdbc']['find']({'where':{'id':_0x3ad4a8[_0x1833('0x49')]['id']}})[_0x1833('0x24')](handleEntityNotFound(_0x311ed1,null))[_0x1833('0x24')](saveUpdates(_0x3ad4a8['body'],null))['then'](respondWithResult(_0x311ed1,null))[_0x1833('0x47')](handleError(_0x311ed1,null));};exports['destroy']=function(_0x368d82,_0xc3b4b8){return db['SquareOdbc'][_0x1833('0x4a')]({'where':{'id':_0x368d82[_0x1833('0x49')]['id']}})['then'](handleEntityNotFound(_0xc3b4b8,null))[_0x1833('0x24')](removeEntity(_0xc3b4b8,null))['catch'](handleError(_0xc3b4b8,null));};exports[_0x1833('0x52')]=function(_0x4381e5,_0x37f462,_0x4729c4){var _0xe65787;return db[_0x1833('0x2e')][_0x1833('0x4a')]({'where':{'id':_0x4381e5['params']['id']},'attributes':['id',_0x1833('0x53')]})['then'](handleEntityNotFound(_0x37f462,null))[_0x1833('0x24')](function(_0x518dda){if(_0x518dda){var _0x83d19d=require(_0x1833('0x54'))();_0x83d19d[_0x1833('0x55')](_0x518dda[_0x1833('0x53')]);_0x83d19d[_0x1833('0x56')]();return _0x518dda;}})[_0x1833('0x24')](respondWithResult(_0x37f462,null))['catch'](handleError(_0x37f462,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index ec03dbd..0853809 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 _0xa0f5=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareOdbc.attributes','exports','define','SquareOdbc','square_odbc','lodash'];(function(_0x4e9628,_0x250573){var _0x27bc8c=function(_0xb3b7ae){while(--_0xb3b7ae){_0x4e9628['push'](_0x4e9628['shift']());}};_0x27bc8c(++_0x250573);}(_0xa0f5,0x149));var _0x5a0f=function(_0x1662ec,_0x2efb15){_0x1662ec=_0x1662ec-0x0;var _0x1ced19=_0xa0f5[_0x1662ec];return _0x1ced19;};'use strict';var _=require(_0x5a0f('0x0'));var util=require(_0x5a0f('0x1'));var logger=require(_0x5a0f('0x2'))(_0x5a0f('0x3'));var moment=require(_0x5a0f('0x4'));var BPromise=require(_0x5a0f('0x5'));var rp=require(_0x5a0f('0x6'));var fs=require('fs');var path=require(_0x5a0f('0x7'));var rimraf=require(_0x5a0f('0x8'));var config=require(_0x5a0f('0x9'));var attributes=require(_0x5a0f('0xa'));module[_0x5a0f('0xb')]=function(_0x108d39,_0x1988b2){return _0x108d39[_0x5a0f('0xc')](_0x5a0f('0xd'),attributes,{'tableName':_0x5a0f('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x791a=['lodash','../../config/logger','api','bluebird','rimraf','../../config/environment','./squareOdbc.attributes','exports','define','SquareOdbc','square_odbc'];(function(_0x635e28,_0x4eecc1){var _0x5bb9dc=function(_0x4e4486){while(--_0x4e4486){_0x635e28['push'](_0x635e28['shift']());}};_0x5bb9dc(++_0x4eecc1);}(_0x791a,0x6e));var _0xa791=function(_0x21de19,_0x5e0a16){_0x21de19=_0x21de19-0x0;var _0x15aa70=_0x791a[_0x21de19];return _0x15aa70;};'use strict';var _=require(_0xa791('0x0'));var util=require('util');var logger=require(_0xa791('0x1'))(_0xa791('0x2'));var moment=require('moment');var BPromise=require(_0xa791('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xa791('0x4'));var config=require(_0xa791('0x5'));var attributes=require(_0xa791('0x6'));module[_0xa791('0x7')]=function(_0x222065,_0x439e08){return _0x222065[_0xa791('0x8')](_0xa791('0x9'),attributes,{'tableName':_0xa791('0xa'),'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 498fe5a..214fe50 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 _0xe891=['find','options','raw','where','attributes','include','map','model','stringify','catch','lodash','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','error','code','SquareOdbc,\x20%s,\x20%s','message','result','ShowSquareOdbc'];(function(_0x3ff442,_0x1c603b){var _0x1c42d0=function(_0x5c23cb){while(--_0x5c23cb){_0x3ff442['push'](_0x3ff442['shift']());}};_0x1c42d0(++_0x1c603b);}(_0xe891,0x118));var _0x1e89=function(_0x327d76,_0x3f5331){_0x327d76=_0x327d76-0x0;var _0x2d0b18=_0xe891[_0x327d76];return _0x2d0b18;};'use strict';var _=require(_0x1e89('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x1e89('0x1'));var fs=require('fs');var Redis=require(_0x1e89('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x1e89('0x3'));var logger=require('../../config/logger')(_0x1e89('0x4'));var config=require(_0x1e89('0x5'));var jayson=require(_0x1e89('0x6'));var client=jayson['client'][_0x1e89('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x22fb7e,_0x3192ab,_0x4527c3){return new BPromise(function(_0x161c85,_0x179311){return client[_0x1e89('0x8')](_0x22fb7e,_0x4527c3)[_0x1e89('0x9')](function(_0x41a7f1){logger[_0x1e89('0xa')]('SquareOdbc,\x20%s,\x20%s',_0x3192ab,_0x1e89('0xb'));logger[_0x1e89('0xc')](_0x1e89('0xd'),_0x3192ab,_0x1e89('0xb'),JSON['stringify'](_0x41a7f1));if(_0x41a7f1[_0x1e89('0xe')]){if(_0x41a7f1[_0x1e89('0xe')][_0x1e89('0xf')]===0x1f4){logger[_0x1e89('0xe')](_0x1e89('0x10'),_0x3192ab,_0x41a7f1['error'][_0x1e89('0x11')]);return _0x179311(_0x41a7f1['error'][_0x1e89('0x11')]);}logger[_0x1e89('0xe')](_0x1e89('0x10'),_0x3192ab,_0x41a7f1[_0x1e89('0xe')][_0x1e89('0x11')]);return _0x161c85(_0x41a7f1[_0x1e89('0xe')][_0x1e89('0x11')]);}else{logger[_0x1e89('0xa')](_0x1e89('0x10'),_0x3192ab,_0x1e89('0xb'));_0x161c85(_0x41a7f1[_0x1e89('0x12')][_0x1e89('0x11')]);}})['catch'](function(_0x44c400){logger[_0x1e89('0xe')](_0x1e89('0x10'),_0x3192ab,_0x44c400);_0x179311(_0x44c400);});});}exports[_0x1e89('0x13')]=function(_0x9dc38){var _0x2bc055=this;return new Promise(function(_0x231479,_0x31bedf){return db['SquareOdbc'][_0x1e89('0x14')]({'raw':_0x9dc38[_0x1e89('0x15')]?_0x9dc38['options'][_0x1e89('0x16')]===undefined?!![]:![]:!![],'where':_0x9dc38[_0x1e89('0x15')]?_0x9dc38['options'][_0x1e89('0x17')]||null:null,'attributes':_0x9dc38['options']?_0x9dc38[_0x1e89('0x15')][_0x1e89('0x18')]||null:null,'include':_0x9dc38[_0x1e89('0x15')]?_0x9dc38[_0x1e89('0x15')][_0x1e89('0x19')]?_[_0x1e89('0x1a')](_0x9dc38[_0x1e89('0x15')][_0x1e89('0x19')],function(_0x54738a){return{'model':db[_0x54738a[_0x1e89('0x1b')]],'as':_0x54738a['as'],'attributes':_0x54738a[_0x1e89('0x18')],'include':_0x54738a[_0x1e89('0x19')]?_[_0x1e89('0x1a')](_0x54738a[_0x1e89('0x19')],function(_0x47103c){return{'model':db[_0x47103c['model']],'as':_0x47103c['as'],'attributes':_0x47103c[_0x1e89('0x18')],'include':_0x47103c[_0x1e89('0x19')]?_[_0x1e89('0x1a')](_0x47103c[_0x1e89('0x19')],function(_0x1b6d5a){return{'model':db[_0x1b6d5a[_0x1e89('0x1b')]],'as':_0x1b6d5a['as'],'attributes':_0x1b6d5a[_0x1e89('0x18')]};}):[]};}):[]};}):[]:[]})[_0x1e89('0x9')](function(_0x2bab34){logger['info'](_0x1e89('0x13'),_0x9dc38);logger['debug'](_0x1e89('0x13'),_0x9dc38,JSON[_0x1e89('0x1c')](_0x2bab34));_0x231479(_0x2bab34);})[_0x1e89('0x1d')](function(_0x5d1f41){logger['error'](_0x1e89('0x13'),_0x5d1f41['message'],_0x9dc38);_0x31bedf(_0x2bc055[_0x1e89('0xe')](0x1f4,_0x5d1f41[_0x1e89('0x11')]));});});}; \ No newline at end of file +var _0xee34=['client','http','request','then','info','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','error','code','message','result','ShowSquareOdbc','SquareOdbc','find','options','attributes','include','map','model','stringify','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger'];(function(_0x555ab9,_0xc7d197){var _0x5ab2ab=function(_0x4a57a3){while(--_0x4a57a3){_0x555ab9['push'](_0x555ab9['shift']());}};_0x5ab2ab(++_0xc7d197);}(_0xee34,0xad));var _0x4ee3=function(_0x163866,_0x1bdc76){_0x163866=_0x163866-0x0;var _0x21b38a=_0xee34[_0x163866];return _0x21b38a;};'use strict';var _=require(_0x4ee3('0x0'));var util=require(_0x4ee3('0x1'));var moment=require(_0x4ee3('0x2'));var BPromise=require(_0x4ee3('0x3'));var rs=require(_0x4ee3('0x4'));var fs=require('fs');var Redis=require(_0x4ee3('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x4ee3('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4ee3('0x7')][_0x4ee3('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3b5a01,_0x5c44cd,_0x545c44){return new BPromise(function(_0x4b2fa3,_0x277f05){return client[_0x4ee3('0x9')](_0x3b5a01,_0x545c44)[_0x4ee3('0xa')](function(_0x375872){logger[_0x4ee3('0xb')](_0x4ee3('0xc'),_0x5c44cd,_0x4ee3('0xd'));logger[_0x4ee3('0xe')](_0x4ee3('0xf'),_0x5c44cd,'request\x20sent',JSON['stringify'](_0x375872));if(_0x375872[_0x4ee3('0x10')]){if(_0x375872['error'][_0x4ee3('0x11')]===0x1f4){logger[_0x4ee3('0x10')](_0x4ee3('0xc'),_0x5c44cd,_0x375872[_0x4ee3('0x10')][_0x4ee3('0x12')]);return _0x277f05(_0x375872['error'][_0x4ee3('0x12')]);}logger[_0x4ee3('0x10')](_0x4ee3('0xc'),_0x5c44cd,_0x375872[_0x4ee3('0x10')][_0x4ee3('0x12')]);return _0x4b2fa3(_0x375872['error'][_0x4ee3('0x12')]);}else{logger['info'](_0x4ee3('0xc'),_0x5c44cd,_0x4ee3('0xd'));_0x4b2fa3(_0x375872[_0x4ee3('0x13')][_0x4ee3('0x12')]);}})['catch'](function(_0x43773e){logger[_0x4ee3('0x10')]('SquareOdbc,\x20%s,\x20%s',_0x5c44cd,_0x43773e);_0x277f05(_0x43773e);});});}exports[_0x4ee3('0x14')]=function(_0x5510be){var _0x4c1a8f=this;return new Promise(function(_0x55bbcc,_0x215563){return db[_0x4ee3('0x15')][_0x4ee3('0x16')]({'raw':_0x5510be['options']?_0x5510be['options']['raw']===undefined?!![]:![]:!![],'where':_0x5510be[_0x4ee3('0x17')]?_0x5510be['options']['where']||null:null,'attributes':_0x5510be[_0x4ee3('0x17')]?_0x5510be[_0x4ee3('0x17')][_0x4ee3('0x18')]||null:null,'include':_0x5510be['options']?_0x5510be[_0x4ee3('0x17')][_0x4ee3('0x19')]?_[_0x4ee3('0x1a')](_0x5510be[_0x4ee3('0x17')][_0x4ee3('0x19')],function(_0x1ad2b5){return{'model':db[_0x1ad2b5[_0x4ee3('0x1b')]],'as':_0x1ad2b5['as'],'attributes':_0x1ad2b5[_0x4ee3('0x18')],'include':_0x1ad2b5[_0x4ee3('0x19')]?_[_0x4ee3('0x1a')](_0x1ad2b5['include'],function(_0x1a2be1){return{'model':db[_0x1a2be1[_0x4ee3('0x1b')]],'as':_0x1a2be1['as'],'attributes':_0x1a2be1[_0x4ee3('0x18')],'include':_0x1a2be1[_0x4ee3('0x19')]?_[_0x4ee3('0x1a')](_0x1a2be1[_0x4ee3('0x19')],function(_0x211f07){return{'model':db[_0x211f07[_0x4ee3('0x1b')]],'as':_0x211f07['as'],'attributes':_0x211f07[_0x4ee3('0x18')]};}):[]};}):[]};}):[]:[]})[_0x4ee3('0xa')](function(_0x2c7c35){logger[_0x4ee3('0xb')](_0x4ee3('0x14'),_0x5510be);logger[_0x4ee3('0xe')](_0x4ee3('0x14'),_0x5510be,JSON[_0x4ee3('0x1c')](_0x2c7c35));_0x55bbcc(_0x2c7c35);})[_0x4ee3('0x1d')](function(_0x11231a){logger[_0x4ee3('0x10')]('ShowSquareOdbc',_0x11231a[_0x4ee3('0x12')],_0x5510be);_0x215563(_0x4c1a8f[_0x4ee3('0x10')](0x1f4,_0x11231a[_0x4ee3('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index 266cf91..87549a9 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 _0xcd56=['destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareProject.controller','get','isAuthenticated','index','/:id','show','create','put','update','delete'];(function(_0x1df099,_0x353123){var _0x35f53f=function(_0x7d55fd){while(--_0x7d55fd){_0x1df099['push'](_0x1df099['shift']());}};_0x35f53f(++_0x353123);}(_0xcd56,0x9a));var _0x6cd5=function(_0x2deea2,_0x5c8ff9){_0x2deea2=_0x2deea2-0x0;var _0x19cda0=_0xcd56[_0x2deea2];return _0x19cda0;};'use strict';var multer=require(_0x6cd5('0x0'));var util=require(_0x6cd5('0x1'));var path=require(_0x6cd5('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x6cd5('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x6cd5('0x4'));var interaction=require(_0x6cd5('0x5'));var config=require(_0x6cd5('0x6'));var controller=require(_0x6cd5('0x7'));router[_0x6cd5('0x8')]('/',auth[_0x6cd5('0x9')](),controller[_0x6cd5('0xa')]);router[_0x6cd5('0x8')](_0x6cd5('0xb'),auth['isAuthenticated'](),controller[_0x6cd5('0xc')]);router['post']('/',auth[_0x6cd5('0x9')](),controller[_0x6cd5('0xd')]);router[_0x6cd5('0xe')](_0x6cd5('0xb'),auth[_0x6cd5('0x9')](),controller[_0x6cd5('0xf')]);router[_0x6cd5('0x10')](_0x6cd5('0xb'),auth[_0x6cd5('0x9')](),controller[_0x6cd5('0x11')]);module[_0x6cd5('0x12')]=router; \ No newline at end of file +var _0xac0e=['delete','destroy','exports','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareProject.controller','get','isAuthenticated','index','/:id','show','post','create','update'];(function(_0x359e4d,_0x1b0c7e){var _0x2a27e9=function(_0x312f97){while(--_0x312f97){_0x359e4d['push'](_0x359e4d['shift']());}};_0x2a27e9(++_0x1b0c7e);}(_0xac0e,0xfa));var _0xeac0=function(_0x481634,_0x26922b){_0x481634=_0x481634-0x0;var _0x3ff8fe=_0xac0e[_0x481634];return _0x3ff8fe;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xeac0('0x0'));var timeout=require(_0xeac0('0x1'));var express=require(_0xeac0('0x2'));var router=express['Router']();var fs_extra=require(_0xeac0('0x3'));var auth=require(_0xeac0('0x4'));var interaction=require(_0xeac0('0x5'));var config=require(_0xeac0('0x6'));var controller=require(_0xeac0('0x7'));router[_0xeac0('0x8')]('/',auth[_0xeac0('0x9')](),controller[_0xeac0('0xa')]);router['get'](_0xeac0('0xb'),auth[_0xeac0('0x9')](),controller[_0xeac0('0xc')]);router[_0xeac0('0xd')]('/',auth[_0xeac0('0x9')](),controller[_0xeac0('0xe')]);router['put'](_0xeac0('0xb'),auth['isAuthenticated'](),controller[_0xeac0('0xf')]);router[_0xeac0('0x10')](_0xeac0('0xb'),auth[_0xeac0('0x9')](),controller[_0xeac0('0x11')]);module[_0xeac0('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index c226bcb..56a6cce 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 _0xb6a2=['TEXT','BLOB','getDataValue','preproduction','toString','long','production','DATE','STRING','name'];(function(_0x491a7f,_0x28bb80){var _0x3d8f44=function(_0xdaa716){while(--_0xdaa716){_0x491a7f['push'](_0x491a7f['shift']());}};_0x3d8f44(++_0x28bb80);}(_0xb6a2,0x170));var _0x2b6a=function(_0x35b288,_0xac9d64){_0x35b288=_0x35b288-0x0;var _0x467501=_0xb6a2[_0x35b288];return _0x467501;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x2b6a('0x0')],'unique':_0x2b6a('0x1'),'allowNull':![]},'description':{'type':Sequelize[_0x2b6a('0x0')]},'notes':{'type':Sequelize[_0x2b6a('0x2')]},'preproduction':{'type':Sequelize[_0x2b6a('0x3')]('long'),'get':function(){if(this[_0x2b6a('0x4')](_0x2b6a('0x5'))){return this[_0x2b6a('0x4')](_0x2b6a('0x5'))[_0x2b6a('0x6')]('utf8');}}},'production':{'type':Sequelize[_0x2b6a('0x3')](_0x2b6a('0x7')),'get':function(){if(this[_0x2b6a('0x4')](_0x2b6a('0x8'))){return this[_0x2b6a('0x4')](_0x2b6a('0x8'))[_0x2b6a('0x6')]('utf8');}}},'savedAt':{'type':Sequelize[_0x2b6a('0x9')]},'publishedAt':{'type':Sequelize[_0x2b6a('0x9')]}}; \ No newline at end of file +var _0x2630=['DATE','sequelize','exports','STRING','TEXT','BLOB','long','getDataValue','preproduction','toString','utf8','production'];(function(_0x54b11f,_0x1f97ff){var _0x42beb6=function(_0x5d3fee){while(--_0x5d3fee){_0x54b11f['push'](_0x54b11f['shift']());}};_0x42beb6(++_0x1f97ff);}(_0x2630,0x79));var _0x0263=function(_0x369b28,_0x5241f6){_0x369b28=_0x369b28-0x0;var _0x10e865=_0x2630[_0x369b28];return _0x10e865;};'use strict';var Sequelize=require(_0x0263('0x0'));module[_0x0263('0x1')]={'name':{'type':Sequelize[_0x0263('0x2')],'unique':'name','allowNull':![]},'description':{'type':Sequelize['STRING']},'notes':{'type':Sequelize[_0x0263('0x3')]},'preproduction':{'type':Sequelize[_0x0263('0x4')](_0x0263('0x5')),'get':function(){if(this[_0x0263('0x6')](_0x0263('0x7'))){return this[_0x0263('0x6')]('preproduction')[_0x0263('0x8')](_0x0263('0x9'));}}},'production':{'type':Sequelize['BLOB'](_0x0263('0x5')),'get':function(){if(this[_0x0263('0x6')](_0x0263('0xa'))){return this[_0x0263('0x6')](_0x0263('0xa'))['toString'](_0x0263('0x9'));}}},'savedAt':{'type':Sequelize[_0x0263('0xb')]},'publishedAt':{'type':Sequelize[_0x0263('0xb')]}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index ce81d36..e3dca01 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 _0x63f9=['rawAttributes','length','options','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','autoAssociation','production','lodash','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','localhost','socket.io-emitter','./squareProject.socket','register','status','json','offset','undefined','limit','count','set','Content-Range','update','destroy','then','SquareProjects','UserProfileResource','publish','agi','stringify','end','stack','name','send','index','SquareProject','fieldName','type','key','map','query','filters','intersection','model','attributes','fields','nolimit','order','sort','where','pick','filter','merge','includeAll','include','findAll','catch','params','keys'];(function(_0x2028ce,_0x524b9e){var _0x5821bd=function(_0x3c5c41){while(--_0x3c5c41){_0x2028ce['push'](_0x2028ce['shift']());}};_0x5821bd(++_0x524b9e);}(_0x63f9,0x161));var _0x963f=function(_0xc060ce,_0x527e5d){_0xc060ce=_0xc060ce-0x0;var _0x2352dc=_0x63f9[_0xc060ce];return _0x2352dc;};'use strict';var _=require(_0x963f('0x0'));var Redis=require('ioredis');var qs=require(_0x963f('0x1'));var logger=require(_0x963f('0x2'))(_0x963f('0x3'));var config=require('../../config/environment');var db=require(_0x963f('0x4'))['db'];config['redis']=_['defaults'](config[_0x963f('0x5')],{'host':_0x963f('0x6'),'port':0x18eb});var socket=require(_0x963f('0x7'))(new Redis(config[_0x963f('0x5')]));require(_0x963f('0x8'))[_0x963f('0x9')](socket);function respondWithResult(_0x78eca7,_0x57725e){_0x57725e=_0x57725e||0xc8;return function(_0xff9ee4){if(_0xff9ee4){return _0x78eca7[_0x963f('0xa')](_0x57725e)[_0x963f('0xb')](_0xff9ee4);}};}function respondWithFilteredResult(_0x416889,_0x37be2e){return function(_0x42394e){if(_0x42394e){var _0x4c85cb=typeof _0x37be2e[_0x963f('0xc')]===_0x963f('0xd')&&typeof _0x37be2e[_0x963f('0xe')]===_0x963f('0xd');var _0x10c592=_0x42394e['count'];var _0x4238a2=_0x4c85cb?0x0:_0x37be2e[_0x963f('0xc')];var _0x510b48=_0x4c85cb?_0x42394e[_0x963f('0xf')]:_0x37be2e['offset']+_0x37be2e[_0x963f('0xe')];var _0x2e6e80;if(_0x510b48>=_0x10c592){_0x510b48=_0x10c592;_0x2e6e80=0xc8;}else{_0x2e6e80=0xce;}_0x416889['status'](_0x2e6e80);return _0x416889[_0x963f('0x10')](_0x963f('0x11'),_0x4238a2+'-'+_0x510b48+'/'+_0x10c592)[_0x963f('0xb')](_0x42394e);}return null;};}function saveUpdates(_0x5515ba){return function(_0x152fd8){if(_0x152fd8){return _0x152fd8[_0x963f('0x12')](_0x5515ba)['then'](function(_0x3a193a){return _0x3a193a;});}return null;};}function removeEntity(_0x862fe6){return function(_0x5970bb){if(_0x5970bb){return _0x5970bb[_0x963f('0x13')]()[_0x963f('0x14')](function(){var _0x1e5fb7=_0x5970bb['get']({'plain':!![]});var _0x928ef=_0x963f('0x15');return db[_0x963f('0x16')][_0x963f('0x13')]({'where':{'type':_0x928ef,'resourceId':_0x1e5fb7['id']}})[_0x963f('0x14')](function(){return _0x5970bb;});})[_0x963f('0x14')](function(){var _0x45dbb7=new Redis(config[_0x963f('0x5')]);_0x45dbb7[_0x963f('0x17')](_0x963f('0x18'),JSON[_0x963f('0x19')]({'id':_0x5970bb['id'],'deleted':!![]}));})['then'](function(){_0x862fe6[_0x963f('0xa')](0xcc)[_0x963f('0x1a')]();});}};}function handleEntityNotFound(_0x57ab25){return function(_0x4b2d4f){if(!_0x4b2d4f){_0x57ab25['sendStatus'](0x194);}return _0x4b2d4f;};}function handleError(_0x3b7663,_0x4de2f8){_0x4de2f8=_0x4de2f8||0x1f4;return function(_0x4e9974){logger['error'](_0x4e9974[_0x963f('0x1b')]);if(_0x4e9974[_0x963f('0x1c')]){delete _0x4e9974[_0x963f('0x1c')];}_0x3b7663[_0x963f('0xa')](_0x4de2f8)[_0x963f('0x1d')](_0x4e9974);};}exports[_0x963f('0x1e')]=function(_0x2256bd,_0x3e597c){var _0x2169cd={},_0x3955ca={},_0x1ada6b={'count':0x0,'rows':[]};var _0xc95eb3=_['map'](db[_0x963f('0x1f')]['rawAttributes'],function(_0x70a441){return{'name':_0x70a441[_0x963f('0x20')],'type':_0x70a441[_0x963f('0x21')][_0x963f('0x22')]};});_0x3955ca['model']=_[_0x963f('0x23')](_0xc95eb3,_0x963f('0x1c'));_0x3955ca['query']=_['keys'](_0x2256bd[_0x963f('0x24')]);_0x3955ca[_0x963f('0x25')]=_[_0x963f('0x26')](_0x3955ca[_0x963f('0x27')],_0x3955ca['query']);_0x2169cd[_0x963f('0x28')]=_[_0x963f('0x26')](_0x3955ca['model'],qs[_0x963f('0x29')](_0x2256bd['query'][_0x963f('0x29')]));_0x2169cd[_0x963f('0x28')]=_0x2169cd['attributes']['length']?_0x2169cd[_0x963f('0x28')]:_0x3955ca[_0x963f('0x27')];if(!_0x2256bd[_0x963f('0x24')]['hasOwnProperty'](_0x963f('0x2a'))){_0x2169cd[_0x963f('0xe')]=qs[_0x963f('0xe')](_0x2256bd[_0x963f('0x24')][_0x963f('0xe')]);_0x2169cd[_0x963f('0xc')]=qs[_0x963f('0xc')](_0x2256bd[_0x963f('0x24')][_0x963f('0xc')]);}_0x2169cd[_0x963f('0x2b')]=qs['sort'](_0x2256bd[_0x963f('0x24')][_0x963f('0x2c')]);_0x2169cd[_0x963f('0x2d')]=qs[_0x963f('0x25')](_[_0x963f('0x2e')](_0x2256bd['query'],_0x3955ca['filters']),_0xc95eb3);if(_0x2256bd['query'][_0x963f('0x2f')]){_0x2169cd[_0x963f('0x2d')]=_[_0x963f('0x30')](_0x2169cd[_0x963f('0x2d')],{'$or':_[_0x963f('0x23')](_0xc95eb3,function(_0x4b558f){if(_0x4b558f['type']!=='VIRTUAL'){var _0x1d47a6={};_0x1d47a6[_0x4b558f[_0x963f('0x1c')]]={'$like':'%'+_0x2256bd['query'][_0x963f('0x2f')]+'%'};return _0x1d47a6;}})});}_0x2169cd=_[_0x963f('0x30')]({},_0x2169cd,_0x2256bd['options']);var _0x18e297={'where':_0x2169cd[_0x963f('0x2d')]};return db['SquareProject'][_0x963f('0xf')](_0x18e297)['then'](function(_0x12acdd){_0x1ada6b['count']=_0x12acdd;if(_0x2256bd[_0x963f('0x24')][_0x963f('0x31')]){_0x2169cd[_0x963f('0x32')]=[{'all':!![]}];}return db[_0x963f('0x1f')][_0x963f('0x33')](_0x2169cd);})[_0x963f('0x14')](function(_0x44f544){_0x1ada6b['rows']=_0x44f544;return _0x1ada6b;})[_0x963f('0x14')](respondWithFilteredResult(_0x3e597c,_0x2169cd))[_0x963f('0x34')](handleError(_0x3e597c,null));};exports['show']=function(_0x400d9a,_0x2d3c1d){var _0x379686={'raw':![],'where':{'id':_0x400d9a[_0x963f('0x35')]['id']}},_0x4b5bef={};_0x4b5bef[_0x963f('0x27')]=_[_0x963f('0x36')](db[_0x963f('0x1f')][_0x963f('0x37')]);_0x4b5bef[_0x963f('0x24')]=_[_0x963f('0x36')](_0x400d9a[_0x963f('0x24')]);_0x4b5bef[_0x963f('0x25')]=_['intersection'](_0x4b5bef['model'],_0x4b5bef[_0x963f('0x24')]);_0x379686[_0x963f('0x28')]=_['intersection'](_0x4b5bef[_0x963f('0x27')],qs[_0x963f('0x29')](_0x400d9a[_0x963f('0x24')][_0x963f('0x29')]));_0x379686[_0x963f('0x28')]=_0x379686['attributes'][_0x963f('0x38')]?_0x379686[_0x963f('0x28')]:_0x4b5bef[_0x963f('0x27')];if(_0x400d9a[_0x963f('0x24')][_0x963f('0x31')]){_0x379686['include']=[{'all':!![]}];}_0x379686=_[_0x963f('0x30')]({},_0x379686,_0x400d9a[_0x963f('0x39')]);return db[_0x963f('0x1f')]['find'](_0x379686)[_0x963f('0x14')](handleEntityNotFound(_0x2d3c1d,null))[_0x963f('0x14')](respondWithResult(_0x2d3c1d,null))[_0x963f('0x34')](handleError(_0x2d3c1d,null));};exports['create']=function(_0x151458,_0x23d987){return db[_0x963f('0x1f')][_0x963f('0x3a')](_0x151458[_0x963f('0x3b')],{})[_0x963f('0x14')](function(_0x53561d){var _0x4c85f2=_0x151458[_0x963f('0x3c')][_0x963f('0x3d')]({'plain':!![]});if(!_0x4c85f2)throw new Error(_0x963f('0x3e'));if(_0x4c85f2[_0x963f('0x3f')]===_0x963f('0x3c')){var _0x17b251=_0x53561d[_0x963f('0x3d')]({'plain':!![]});var _0x1247f4=_0x963f('0x15');return db[_0x963f('0x40')][_0x963f('0x41')]({'where':{'name':_0x1247f4,'userProfileId':_0x4c85f2['userProfileId']},'raw':!![]})['then'](function(_0x32b1d5){if(_0x32b1d5&&_0x32b1d5[_0x963f('0x42')]===0x0){return db[_0x963f('0x16')][_0x963f('0x3a')]({'name':_0x17b251[_0x963f('0x1c')],'resourceId':_0x17b251['id'],'type':_0x32b1d5[_0x963f('0x1c')],'sectionId':_0x32b1d5['id']},{})[_0x963f('0x14')](function(){return _0x53561d;});}else{return _0x53561d;}})[_0x963f('0x34')](function(_0x1c8529){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1c8529);throw _0x1c8529;});}return _0x53561d;})[_0x963f('0x14')](respondWithResult(_0x23d987,0xc9))[_0x963f('0x34')](handleError(_0x23d987,null));};exports[_0x963f('0x12')]=function(_0x498a79,_0x200c2a){if(_0x498a79['body']['id']){delete _0x498a79[_0x963f('0x3b')]['id'];}return db[_0x963f('0x1f')]['find']({'where':{'id':_0x498a79[_0x963f('0x35')]['id']}})[_0x963f('0x14')](handleEntityNotFound(_0x200c2a,null))['then'](saveUpdates(_0x498a79[_0x963f('0x3b')],null))[_0x963f('0x14')](function(_0x1ab9a3){if(!_0x1ab9a3)return;var _0x1baa19=_0x1ab9a3[_0x963f('0x3d')]({'plain':!![]});return _0x1baa19;})[_0x963f('0x14')](function(_0x23004f){var _0x29c099=new Redis(config[_0x963f('0x5')]);_0x29c099[_0x963f('0x17')]('agi',JSON['stringify'](_['pick'](_0x23004f,['id',_0x963f('0x1c'),_0x963f('0x43')])));return _0x23004f;})['then'](respondWithResult(_0x200c2a,null))[_0x963f('0x34')](handleError(_0x200c2a,null));};exports[_0x963f('0x13')]=function(_0xb1cf6a,_0x30b4ef){return db[_0x963f('0x1f')][_0x963f('0x41')]({'where':{'id':_0xb1cf6a[_0x963f('0x35')]['id']}})[_0x963f('0x14')](handleEntityNotFound(_0x30b4ef,null))[_0x963f('0x14')](removeEntity(_0x30b4ef,null))[_0x963f('0x34')](handleError(_0x30b4ef,null));}; \ No newline at end of file +var _0x6541=['localhost','./squareProject.socket','register','status','json','offset','undefined','limit','count','Content-Range','update','then','destroy','SquareProjects','publish','agi','stringify','end','sendStatus','error','name','send','index','SquareProject','fieldName','type','key','model','map','keys','query','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','params','rawAttributes','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','production','ioredis','../../config/logger','api','../../mysqldb','redis','defaults'];(function(_0x11a422,_0x5907a5){var _0x547177=function(_0x55ec90){while(--_0x55ec90){_0x11a422['push'](_0x11a422['shift']());}};_0x547177(++_0x5907a5);}(_0x6541,0xc6));var _0x1654=function(_0x5db3bd,_0x8d4eb2){_0x5db3bd=_0x5db3bd-0x0;var _0x129de2=_0x6541[_0x5db3bd];return _0x129de2;};'use strict';var _=require('lodash');var Redis=require(_0x1654('0x0'));var qs=require('../../components/parsers/qs');var logger=require(_0x1654('0x1'))(_0x1654('0x2'));var config=require('../../config/environment');var db=require(_0x1654('0x3'))['db'];config[_0x1654('0x4')]=_[_0x1654('0x5')](config[_0x1654('0x4')],{'host':_0x1654('0x6'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x1654('0x7'))[_0x1654('0x8')](socket);function respondWithResult(_0x42c640,_0x57796f){_0x57796f=_0x57796f||0xc8;return function(_0x2633a2){if(_0x2633a2){return _0x42c640[_0x1654('0x9')](_0x57796f)[_0x1654('0xa')](_0x2633a2);}};}function respondWithFilteredResult(_0x56ff6e,_0x588f8e){return function(_0x3e8e9c){if(_0x3e8e9c){var _0x3dd85e=typeof _0x588f8e[_0x1654('0xb')]===_0x1654('0xc')&&typeof _0x588f8e[_0x1654('0xd')]===_0x1654('0xc');var _0x4e6999=_0x3e8e9c[_0x1654('0xe')];var _0x5b93bb=_0x3dd85e?0x0:_0x588f8e[_0x1654('0xb')];var _0x495f75=_0x3dd85e?_0x3e8e9c[_0x1654('0xe')]:_0x588f8e['offset']+_0x588f8e[_0x1654('0xd')];var _0x4e25f5;if(_0x495f75>=_0x4e6999){_0x495f75=_0x4e6999;_0x4e25f5=0xc8;}else{_0x4e25f5=0xce;}_0x56ff6e[_0x1654('0x9')](_0x4e25f5);return _0x56ff6e['set'](_0x1654('0xf'),_0x5b93bb+'-'+_0x495f75+'/'+_0x4e6999)['json'](_0x3e8e9c);}return null;};}function saveUpdates(_0x51c9c6){return function(_0x41f1b4){if(_0x41f1b4){return _0x41f1b4[_0x1654('0x10')](_0x51c9c6)[_0x1654('0x11')](function(_0x42b786){return _0x42b786;});}return null;};}function removeEntity(_0x2edde9){return function(_0x44d2a3){if(_0x44d2a3){return _0x44d2a3[_0x1654('0x12')]()[_0x1654('0x11')](function(){var _0x5787d3=_0x44d2a3['get']({'plain':!![]});var _0xd313b9=_0x1654('0x13');return db['UserProfileResource'][_0x1654('0x12')]({'where':{'type':_0xd313b9,'resourceId':_0x5787d3['id']}})[_0x1654('0x11')](function(){return _0x44d2a3;});})['then'](function(){var _0x49f2bf=new Redis(config['redis']);_0x49f2bf[_0x1654('0x14')](_0x1654('0x15'),JSON[_0x1654('0x16')]({'id':_0x44d2a3['id'],'deleted':!![]}));})[_0x1654('0x11')](function(){_0x2edde9[_0x1654('0x9')](0xcc)[_0x1654('0x17')]();});}};}function handleEntityNotFound(_0x27baf1){return function(_0x38b8cc){if(!_0x38b8cc){_0x27baf1[_0x1654('0x18')](0x194);}return _0x38b8cc;};}function handleError(_0x425d71,_0xf05f07){_0xf05f07=_0xf05f07||0x1f4;return function(_0x1cf766){logger[_0x1654('0x19')](_0x1cf766['stack']);if(_0x1cf766['name']){delete _0x1cf766[_0x1654('0x1a')];}_0x425d71[_0x1654('0x9')](_0xf05f07)[_0x1654('0x1b')](_0x1cf766);};}exports[_0x1654('0x1c')]=function(_0xb32398,_0x47f600){var _0x260127={},_0x14343b={},_0x4ed00f={'count':0x0,'rows':[]};var _0x38fbd9=_['map'](db[_0x1654('0x1d')]['rawAttributes'],function(_0x17f890){return{'name':_0x17f890[_0x1654('0x1e')],'type':_0x17f890[_0x1654('0x1f')][_0x1654('0x20')]};});_0x14343b[_0x1654('0x21')]=_[_0x1654('0x22')](_0x38fbd9,_0x1654('0x1a'));_0x14343b['query']=_[_0x1654('0x23')](_0xb32398[_0x1654('0x24')]);_0x14343b['filters']=_[_0x1654('0x25')](_0x14343b[_0x1654('0x21')],_0x14343b[_0x1654('0x24')]);_0x260127[_0x1654('0x26')]=_['intersection'](_0x14343b[_0x1654('0x21')],qs[_0x1654('0x27')](_0xb32398[_0x1654('0x24')][_0x1654('0x27')]));_0x260127[_0x1654('0x26')]=_0x260127['attributes'][_0x1654('0x28')]?_0x260127['attributes']:_0x14343b['model'];if(!_0xb32398[_0x1654('0x24')]['hasOwnProperty'](_0x1654('0x29'))){_0x260127['limit']=qs[_0x1654('0xd')](_0xb32398[_0x1654('0x24')]['limit']);_0x260127[_0x1654('0xb')]=qs[_0x1654('0xb')](_0xb32398[_0x1654('0x24')][_0x1654('0xb')]);}_0x260127[_0x1654('0x2a')]=qs[_0x1654('0x2b')](_0xb32398['query'][_0x1654('0x2b')]);_0x260127[_0x1654('0x2c')]=qs[_0x1654('0x2d')](_[_0x1654('0x2e')](_0xb32398['query'],_0x14343b['filters']),_0x38fbd9);if(_0xb32398[_0x1654('0x24')][_0x1654('0x2f')]){_0x260127[_0x1654('0x2c')]=_[_0x1654('0x30')](_0x260127[_0x1654('0x2c')],{'$or':_[_0x1654('0x22')](_0x38fbd9,function(_0x116730){if(_0x116730[_0x1654('0x1f')]!==_0x1654('0x31')){var _0x4f5ed8={};_0x4f5ed8[_0x116730[_0x1654('0x1a')]]={'$like':'%'+_0xb32398[_0x1654('0x24')][_0x1654('0x2f')]+'%'};return _0x4f5ed8;}})});}_0x260127=_[_0x1654('0x30')]({},_0x260127,_0xb32398[_0x1654('0x32')]);var _0x338c3d={'where':_0x260127[_0x1654('0x2c')]};return db[_0x1654('0x1d')][_0x1654('0xe')](_0x338c3d)[_0x1654('0x11')](function(_0x275a4a){_0x4ed00f[_0x1654('0xe')]=_0x275a4a;if(_0xb32398['query'][_0x1654('0x33')]){_0x260127[_0x1654('0x34')]=[{'all':!![]}];}return db['SquareProject'][_0x1654('0x35')](_0x260127);})[_0x1654('0x11')](function(_0x394237){_0x4ed00f['rows']=_0x394237;return _0x4ed00f;})[_0x1654('0x11')](respondWithFilteredResult(_0x47f600,_0x260127))[_0x1654('0x36')](handleError(_0x47f600,null));};exports['show']=function(_0xfdeb29,_0x125a0d){var _0x3be826={'raw':![],'where':{'id':_0xfdeb29[_0x1654('0x37')]['id']}},_0x36ca3e={};_0x36ca3e[_0x1654('0x21')]=_[_0x1654('0x23')](db[_0x1654('0x1d')][_0x1654('0x38')]);_0x36ca3e[_0x1654('0x24')]=_[_0x1654('0x23')](_0xfdeb29[_0x1654('0x24')]);_0x36ca3e[_0x1654('0x2d')]=_[_0x1654('0x25')](_0x36ca3e[_0x1654('0x21')],_0x36ca3e['query']);_0x3be826[_0x1654('0x26')]=_[_0x1654('0x25')](_0x36ca3e[_0x1654('0x21')],qs[_0x1654('0x27')](_0xfdeb29['query'][_0x1654('0x27')]));_0x3be826['attributes']=_0x3be826[_0x1654('0x26')][_0x1654('0x28')]?_0x3be826[_0x1654('0x26')]:_0x36ca3e[_0x1654('0x21')];if(_0xfdeb29['query'][_0x1654('0x33')]){_0x3be826[_0x1654('0x34')]=[{'all':!![]}];}_0x3be826=_[_0x1654('0x30')]({},_0x3be826,_0xfdeb29[_0x1654('0x32')]);return db['SquareProject'][_0x1654('0x39')](_0x3be826)[_0x1654('0x11')](handleEntityNotFound(_0x125a0d,null))[_0x1654('0x11')](respondWithResult(_0x125a0d,null))[_0x1654('0x36')](handleError(_0x125a0d,null));};exports[_0x1654('0x3a')]=function(_0x1d11f2,_0x24f42c){return db[_0x1654('0x1d')]['create'](_0x1d11f2['body'],{})[_0x1654('0x11')](function(_0x5cc0a8){var _0x1ad9ce=_0x1d11f2[_0x1654('0x3b')][_0x1654('0x3c')]({'plain':!![]});if(!_0x1ad9ce)throw new Error(_0x1654('0x3d'));if(_0x1ad9ce['role']===_0x1654('0x3b')){var _0x1632e9=_0x5cc0a8['get']({'plain':!![]});var _0x2210ff='SquareProjects';return db[_0x1654('0x3e')][_0x1654('0x39')]({'where':{'name':_0x2210ff,'userProfileId':_0x1ad9ce[_0x1654('0x3f')]},'raw':!![]})[_0x1654('0x11')](function(_0x31476a){if(_0x31476a&&_0x31476a[_0x1654('0x40')]===0x0){return db['UserProfileResource']['create']({'name':_0x1632e9[_0x1654('0x1a')],'resourceId':_0x1632e9['id'],'type':_0x31476a[_0x1654('0x1a')],'sectionId':_0x31476a['id']},{})[_0x1654('0x11')](function(){return _0x5cc0a8;});}else{return _0x5cc0a8;}})['catch'](function(_0x236e97){logger[_0x1654('0x19')](_0x1654('0x41'),_0x236e97);throw _0x236e97;});}return _0x5cc0a8;})[_0x1654('0x11')](respondWithResult(_0x24f42c,0xc9))[_0x1654('0x36')](handleError(_0x24f42c,null));};exports[_0x1654('0x10')]=function(_0x4bdc69,_0x551839){if(_0x4bdc69['body']['id']){delete _0x4bdc69[_0x1654('0x42')]['id'];}return db[_0x1654('0x1d')][_0x1654('0x39')]({'where':{'id':_0x4bdc69[_0x1654('0x37')]['id']}})[_0x1654('0x11')](handleEntityNotFound(_0x551839,null))[_0x1654('0x11')](saveUpdates(_0x4bdc69['body'],null))[_0x1654('0x11')](function(_0x22a96e){if(!_0x22a96e)return;var _0x4d083a=_0x22a96e[_0x1654('0x3c')]({'plain':!![]});return _0x4d083a;})[_0x1654('0x11')](function(_0x46c201){var _0x15efe6=new Redis(config[_0x1654('0x4')]);_0x15efe6['publish']('agi',JSON[_0x1654('0x16')](_[_0x1654('0x2e')](_0x46c201,['id','name',_0x1654('0x43')])));return _0x46c201;})[_0x1654('0x11')](respondWithResult(_0x551839,null))[_0x1654('0x36')](handleError(_0x551839,null));};exports['destroy']=function(_0x2ddf44,_0x2f2cc2){return db[_0x1654('0x1d')][_0x1654('0x39')]({'where':{'id':_0x2ddf44[_0x1654('0x37')]['id']}})['then'](handleEntityNotFound(_0x2f2cc2,null))[_0x1654('0x11')](removeEntity(_0x2f2cc2,null))[_0x1654('0x36')](handleError(_0x2f2cc2,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index b77c583..9c27e91 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 _0x06e0=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','SquareProject'];(function(_0x9ffbee,_0x270040){var _0x1ccf16=function(_0x4c8b36){while(--_0x4c8b36){_0x9ffbee['push'](_0x9ffbee['shift']());}};_0x1ccf16(++_0x270040);}(_0x06e0,0x1b5));var _0x006e=function(_0x72493a,_0x158721){_0x72493a=_0x72493a-0x0;var _0x4c6027=_0x06e0[_0x72493a];return _0x4c6027;};'use strict';var EventEmitter=require(_0x006e('0x0'));var SquareProject=require(_0x006e('0x1'))['db'][_0x006e('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x006e('0x3')](0x0);var events={'afterCreate':_0x006e('0x4'),'afterUpdate':_0x006e('0x5'),'afterDestroy':_0x006e('0x6')};function emitEvent(_0x23f65b){return function(_0x21bbb3,_0x10fa1e,_0x4e5e44){SquareProjectEvents[_0x006e('0x7')](_0x23f65b+':'+_0x21bbb3['id'],_0x21bbb3);SquareProjectEvents[_0x006e('0x7')](_0x23f65b,_0x21bbb3);_0x4e5e44(null);};}for(var e in events){if(events[_0x006e('0x8')](e)){var event=events[e];SquareProject[_0x006e('0x9')](e,emitEvent(event));}}module[_0x006e('0xa')]=SquareProjectEvents; \ No newline at end of file +var _0xccc6=['emit','hasOwnProperty','exports','../../mysqldb','SquareProject','setMaxListeners','save','update','remove'];(function(_0x49f037,_0x5cd60e){var _0x51228a=function(_0x3d7ab0){while(--_0x3d7ab0){_0x49f037['push'](_0x49f037['shift']());}};_0x51228a(++_0x5cd60e);}(_0xccc6,0xdb));var _0x6ccc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xccc6[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require('events');var SquareProject=require(_0x6ccc('0x0'))['db'][_0x6ccc('0x1')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x6ccc('0x2')](0x0);var events={'afterCreate':_0x6ccc('0x3'),'afterUpdate':_0x6ccc('0x4'),'afterDestroy':_0x6ccc('0x5')};function emitEvent(_0x47f00c){return function(_0x3255a4,_0x3159f6,_0x47f547){SquareProjectEvents[_0x6ccc('0x6')](_0x47f00c+':'+_0x3255a4['id'],_0x3255a4);SquareProjectEvents[_0x6ccc('0x6')](_0x47f00c,_0x3255a4);_0x47f547(null);};}for(var e in events){if(events[_0x6ccc('0x7')](e)){var event=events[e];SquareProject['hook'](e,emitEvent(event));}}module[_0x6ccc('0x8')]=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index 6de65bf..5d5eb66 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 _0xccf4=['api','moment','bluebird','path','rimraf','./squareProject.attributes','define','square_projects','changed','production','publishedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util'];(function(_0x196647,_0x2613b3){var _0x2dbff4=function(_0x4dea24){while(--_0x4dea24){_0x196647['push'](_0x196647['shift']());}};_0x2dbff4(++_0x2613b3);}(_0xccf4,0x1a2));var _0x4ccf=function(_0x1a0d98,_0x5b7852){_0x1a0d98=_0x1a0d98-0x0;var _0x4bc727=_0xccf4[_0x1a0d98];return _0x4bc727;};'use strict';var _=require(_0x4ccf('0x0'));var util=require(_0x4ccf('0x1'));var logger=require('../../config/logger')(_0x4ccf('0x2'));var moment=require(_0x4ccf('0x3'));var BPromise=require(_0x4ccf('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4ccf('0x5'));var rimraf=require(_0x4ccf('0x6'));var config=require('../../config/environment');var attributes=require(_0x4ccf('0x7'));module['exports']=function(_0x25417,_0x276187){return _0x25417[_0x4ccf('0x8')]('SquareProject',attributes,{'tableName':_0x4ccf('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3ae431,_0x424ce6,_0x35b612){if(_0x3ae431[_0x4ccf('0xa')]('preproduction')){_0x3ae431['savedAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}if(_0x3ae431[_0x4ccf('0xa')](_0x4ccf('0xb'))){_0x3ae431[_0x4ccf('0xc')]=moment()[_0x4ccf('0xd')](_0x4ccf('0xe'));}_0x35b612(null,_0x3ae431);}}});}; \ No newline at end of file +var _0x08f5=['production','publishedAt','lodash','util','moment','bluebird','rimraf','../../config/environment','./squareProject.attributes','exports','SquareProject','square_projects','changed','savedAt','format'];(function(_0x2ee365,_0x10ae02){var _0x26e632=function(_0x3f0b1e){while(--_0x3f0b1e){_0x2ee365['push'](_0x2ee365['shift']());}};_0x26e632(++_0x10ae02);}(_0x08f5,0x197));var _0x508f=function(_0x56a061,_0x53fb1b){_0x56a061=_0x56a061-0x0;var _0x105fa0=_0x08f5[_0x56a061];return _0x105fa0;};'use strict';var _=require(_0x508f('0x0'));var util=require(_0x508f('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x508f('0x2'));var BPromise=require(_0x508f('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x508f('0x4'));var config=require(_0x508f('0x5'));var attributes=require(_0x508f('0x6'));module[_0x508f('0x7')]=function(_0x5b966e,_0x21c6b9){return _0x5b966e['define'](_0x508f('0x8'),attributes,{'tableName':_0x508f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4b98f7,_0x479e99,_0x3b16af){if(_0x4b98f7[_0x508f('0xa')]('preproduction')){_0x4b98f7[_0x508f('0xb')]=moment()[_0x508f('0xc')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x4b98f7['changed'](_0x508f('0xd'))){_0x4b98f7[_0x508f('0xe')]=moment()[_0x508f('0xc')]('YYYY-MM-DD\x20HH:mm:ss');}_0x3b16af(null,_0x4b98f7);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index 6c629c0..3f4099d 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 _0x9c7e=['find','where','ShowSquareProject','lodash','ioredis','../../mysqldb','../../config/logger','rpc','defaults','redis','socket.io-emitter','register','GetSquareProjects','SquareProject','findAll','options','raw','attributes','limit','map','model','include','then','info','debug','stringify','catch','error','message'];(function(_0xf60cd8,_0x37dc45){var _0x245dde=function(_0x1e4215){while(--_0x1e4215){_0xf60cd8['push'](_0xf60cd8['shift']());}};_0x245dde(++_0x37dc45);}(_0x9c7e,0x108));var _0xe9c7=function(_0x499e7d,_0x25f19e){_0x499e7d=_0x499e7d-0x0;var _0x4c40fd=_0x9c7e[_0x499e7d];return _0x4c40fd;};'use strict';var _=require(_0xe9c7('0x0'));var Redis=require(_0xe9c7('0x1'));var db=require(_0xe9c7('0x2'))['db'];var logger=require(_0xe9c7('0x3'))(_0xe9c7('0x4'));var config=require('../../config/environment');config['redis']=_[_0xe9c7('0x5')](config[_0xe9c7('0x6')],{'host':'localhost','port':0x18eb});var socket=require(_0xe9c7('0x7'))(new Redis(config[_0xe9c7('0x6')]));require('./squareProject.socket')[_0xe9c7('0x8')](socket);exports[_0xe9c7('0x9')]=function(_0x523248){var _0x3f8773=this;return new Promise(function(_0x19ce8b,_0x388993){return db[_0xe9c7('0xa')][_0xe9c7('0xb')]({'raw':_0x523248['options']?_0x523248[_0xe9c7('0xc')][_0xe9c7('0xd')]===undefined?!![]:![]:!![],'where':_0x523248[_0xe9c7('0xc')]?_0x523248[_0xe9c7('0xc')]['where']||null:null,'attributes':_0x523248[_0xe9c7('0xc')]?_0x523248[_0xe9c7('0xc')][_0xe9c7('0xe')]||null:null,'limit':_0x523248[_0xe9c7('0xc')]?_0x523248['options'][_0xe9c7('0xf')]||null:null,'include':_0x523248[_0xe9c7('0xc')]?_0x523248[_0xe9c7('0xc')]['include']?_[_0xe9c7('0x10')](_0x523248[_0xe9c7('0xc')]['include'],function(_0x391be7){return{'model':db[_0x391be7[_0xe9c7('0x11')]],'as':_0x391be7['as'],'attributes':_0x391be7['attributes'],'include':_0x391be7[_0xe9c7('0x12')]?_[_0xe9c7('0x10')](_0x391be7['include'],function(_0x151ee1){return{'model':db[_0x151ee1[_0xe9c7('0x11')]],'as':_0x151ee1['as'],'attributes':_0x151ee1[_0xe9c7('0xe')],'include':_0x151ee1[_0xe9c7('0x12')]?_[_0xe9c7('0x10')](_0x151ee1[_0xe9c7('0x12')],function(_0x4b6b4e){return{'model':db[_0x4b6b4e[_0xe9c7('0x11')]],'as':_0x4b6b4e['as'],'attributes':_0x4b6b4e['attributes']};}):[]};}):[]};}):[]:[]})[_0xe9c7('0x13')](function(_0xf10d6){logger[_0xe9c7('0x14')]('GetSquareProjects',_0x523248);logger[_0xe9c7('0x15')](_0xe9c7('0x9'),_0x523248,JSON[_0xe9c7('0x16')](_0xf10d6));_0x19ce8b(_0xf10d6);})[_0xe9c7('0x17')](function(_0x26a186){logger[_0xe9c7('0x18')](_0xe9c7('0x9'),_0x26a186['message'],_0x523248);_0x388993(_0x3f8773[_0xe9c7('0x18')](0x1f4,_0x26a186[_0xe9c7('0x19')]));});});};exports['ShowSquareProject']=function(_0x5c9387){var _0x9c8a76=this;return new Promise(function(_0x19f82c,_0x17cb66){return db[_0xe9c7('0xa')][_0xe9c7('0x1a')]({'raw':_0x5c9387['options']?_0x5c9387[_0xe9c7('0xc')][_0xe9c7('0xd')]===undefined?!![]:![]:!![],'where':_0x5c9387[_0xe9c7('0xc')]?_0x5c9387[_0xe9c7('0xc')][_0xe9c7('0x1b')]||null:null,'attributes':_0x5c9387[_0xe9c7('0xc')]?_0x5c9387[_0xe9c7('0xc')]['attributes']||null:null,'include':_0x5c9387['options']?_0x5c9387[_0xe9c7('0xc')][_0xe9c7('0x12')]?_[_0xe9c7('0x10')](_0x5c9387[_0xe9c7('0xc')][_0xe9c7('0x12')],function(_0x1db538){return{'model':db[_0x1db538[_0xe9c7('0x11')]],'as':_0x1db538['as'],'attributes':_0x1db538[_0xe9c7('0xe')],'include':_0x1db538[_0xe9c7('0x12')]?_[_0xe9c7('0x10')](_0x1db538[_0xe9c7('0x12')],function(_0x1da5dd){return{'model':db[_0x1da5dd[_0xe9c7('0x11')]],'as':_0x1da5dd['as'],'attributes':_0x1da5dd['attributes'],'include':_0x1da5dd[_0xe9c7('0x12')]?_[_0xe9c7('0x10')](_0x1da5dd[_0xe9c7('0x12')],function(_0x5427ae){return{'model':db[_0x5427ae[_0xe9c7('0x11')]],'as':_0x5427ae['as'],'attributes':_0x5427ae[_0xe9c7('0xe')]};}):[]};}):[]};}):[]:[]})[_0xe9c7('0x13')](function(_0x5529a7){logger['info'](_0xe9c7('0x1c'),_0x5c9387);logger['debug']('ShowSquareProject',_0x5c9387,JSON['stringify'](_0x5529a7));_0x19f82c(_0x5529a7);})['catch'](function(_0x20da0f){logger[_0xe9c7('0x18')](_0xe9c7('0x1c'),_0x20da0f[_0xe9c7('0x19')],_0x5c9387);_0x17cb66(_0x9c8a76['error'](0x1f4,_0x20da0f[_0xe9c7('0x19')]));});});}; \ No newline at end of file +var _0x7b08=['catch','message','ShowSquareProject','find','raw','error','lodash','ioredis','../../config/logger','rpc','../../config/environment','redis','defaults','localhost','./squareProject.socket','GetSquareProjects','SquareProject','findAll','options','where','attributes','include','map','model','then','info','debug','stringify'];(function(_0x12d44c,_0xf11296){var _0x4fde20=function(_0x3c1ad6){while(--_0x3c1ad6){_0x12d44c['push'](_0x12d44c['shift']());}};_0x4fde20(++_0xf11296);}(_0x7b08,0x13a));var _0x87b0=function(_0x45082c,_0x14883a){_0x45082c=_0x45082c-0x0;var _0x1b1eae=_0x7b08[_0x45082c];return _0x1b1eae;};'use strict';var _=require(_0x87b0('0x0'));var Redis=require(_0x87b0('0x1'));var db=require('../../mysqldb')['db'];var logger=require(_0x87b0('0x2'))(_0x87b0('0x3'));var config=require(_0x87b0('0x4'));config[_0x87b0('0x5')]=_[_0x87b0('0x6')](config['redis'],{'host':_0x87b0('0x7'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x87b0('0x5')]));require(_0x87b0('0x8'))['register'](socket);exports[_0x87b0('0x9')]=function(_0x205bbb){var _0x127b12=this;return new Promise(function(_0x4865f1,_0x3b5a30){return db[_0x87b0('0xa')][_0x87b0('0xb')]({'raw':_0x205bbb['options']?_0x205bbb[_0x87b0('0xc')]['raw']===undefined?!![]:![]:!![],'where':_0x205bbb[_0x87b0('0xc')]?_0x205bbb[_0x87b0('0xc')][_0x87b0('0xd')]||null:null,'attributes':_0x205bbb[_0x87b0('0xc')]?_0x205bbb[_0x87b0('0xc')][_0x87b0('0xe')]||null:null,'limit':_0x205bbb[_0x87b0('0xc')]?_0x205bbb[_0x87b0('0xc')]['limit']||null:null,'include':_0x205bbb['options']?_0x205bbb['options'][_0x87b0('0xf')]?_[_0x87b0('0x10')](_0x205bbb[_0x87b0('0xc')][_0x87b0('0xf')],function(_0x213317){return{'model':db[_0x213317[_0x87b0('0x11')]],'as':_0x213317['as'],'attributes':_0x213317[_0x87b0('0xe')],'include':_0x213317[_0x87b0('0xf')]?_[_0x87b0('0x10')](_0x213317['include'],function(_0xaded35){return{'model':db[_0xaded35[_0x87b0('0x11')]],'as':_0xaded35['as'],'attributes':_0xaded35[_0x87b0('0xe')],'include':_0xaded35[_0x87b0('0xf')]?_[_0x87b0('0x10')](_0xaded35[_0x87b0('0xf')],function(_0x317b6a){return{'model':db[_0x317b6a[_0x87b0('0x11')]],'as':_0x317b6a['as'],'attributes':_0x317b6a[_0x87b0('0xe')]};}):[]};}):[]};}):[]:[]})[_0x87b0('0x12')](function(_0x2ad02f){logger[_0x87b0('0x13')]('GetSquareProjects',_0x205bbb);logger[_0x87b0('0x14')](_0x87b0('0x9'),_0x205bbb,JSON[_0x87b0('0x15')](_0x2ad02f));_0x4865f1(_0x2ad02f);})[_0x87b0('0x16')](function(_0xd637dc){logger['error'](_0x87b0('0x9'),_0xd637dc[_0x87b0('0x17')],_0x205bbb);_0x3b5a30(_0x127b12['error'](0x1f4,_0xd637dc[_0x87b0('0x17')]));});});};exports[_0x87b0('0x18')]=function(_0x4c4cc4){var _0x43c95d=this;return new Promise(function(_0x415ea7,_0x334e71){return db[_0x87b0('0xa')][_0x87b0('0x19')]({'raw':_0x4c4cc4[_0x87b0('0xc')]?_0x4c4cc4['options'][_0x87b0('0x1a')]===undefined?!![]:![]:!![],'where':_0x4c4cc4['options']?_0x4c4cc4[_0x87b0('0xc')]['where']||null:null,'attributes':_0x4c4cc4['options']?_0x4c4cc4[_0x87b0('0xc')][_0x87b0('0xe')]||null:null,'include':_0x4c4cc4[_0x87b0('0xc')]?_0x4c4cc4[_0x87b0('0xc')][_0x87b0('0xf')]?_['map'](_0x4c4cc4[_0x87b0('0xc')][_0x87b0('0xf')],function(_0x3a18cc){return{'model':db[_0x3a18cc[_0x87b0('0x11')]],'as':_0x3a18cc['as'],'attributes':_0x3a18cc[_0x87b0('0xe')],'include':_0x3a18cc[_0x87b0('0xf')]?_[_0x87b0('0x10')](_0x3a18cc[_0x87b0('0xf')],function(_0x2e4c4e){return{'model':db[_0x2e4c4e['model']],'as':_0x2e4c4e['as'],'attributes':_0x2e4c4e['attributes'],'include':_0x2e4c4e[_0x87b0('0xf')]?_['map'](_0x2e4c4e['include'],function(_0x4b5bfe){return{'model':db[_0x4b5bfe[_0x87b0('0x11')]],'as':_0x4b5bfe['as'],'attributes':_0x4b5bfe[_0x87b0('0xe')]};}):[]};}):[]};}):[]:[]})[_0x87b0('0x12')](function(_0x3825b0){logger[_0x87b0('0x13')](_0x87b0('0x18'),_0x4c4cc4);logger['debug'](_0x87b0('0x18'),_0x4c4cc4,JSON[_0x87b0('0x15')](_0x3825b0));_0x415ea7(_0x3825b0);})['catch'](function(_0x4699ed){logger[_0x87b0('0x1b')]('ShowSquareProject',_0x4699ed['message'],_0x4c4cc4);_0x334e71(_0x43c95d[_0x87b0('0x1b')](0x1f4,_0x4699ed[_0x87b0('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index 9dcec3b..f5025c0 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 _0xc30b=['save','update','emit','removeListener','register','length','squareProject:','./squareProject.events'];(function(_0x4a0f16,_0x21ba18){var _0x45d653=function(_0x137e2c){while(--_0x137e2c){_0x4a0f16['push'](_0x4a0f16['shift']());}};_0x45d653(++_0x21ba18);}(_0xc30b,0xa7));var _0xbc30=function(_0x576170,_0x1712ae){_0x576170=_0x576170-0x0;var _0x397c70=_0xc30b[_0x576170];return _0x397c70;};'use strict';var SquareProjectEvents=require(_0xbc30('0x0'));var events=[_0xbc30('0x1'),'remove',_0xbc30('0x2')];function createListener(_0x16368b,_0x9e05cf){return function(_0x2743bc){_0x9e05cf[_0xbc30('0x3')](_0x16368b,_0x2743bc);};}function removeListener(_0x304b02,_0x226637){return function(){SquareProjectEvents[_0xbc30('0x4')](_0x304b02,_0x226637);};}exports[_0xbc30('0x5')]=function(_0x50acf3){for(var _0x22f437=0x0,_0x5e74ea=events[_0xbc30('0x6')];_0x22f437<_0x5e74ea;_0x22f437++){var _0x1a8b1c=events[_0x22f437];var _0x78bbaa=createListener(_0xbc30('0x7')+_0x1a8b1c,_0x50acf3);SquareProjectEvents['on'](_0x1a8b1c,_0x78bbaa);}}; \ No newline at end of file +var _0xacdd=['squareProject:','./squareProject.events','save','remove','update','emit','removeListener'];(function(_0x576d8a,_0x2d7bde){var _0x3dc3ef=function(_0xc76758){while(--_0xc76758){_0x576d8a['push'](_0x576d8a['shift']());}};_0x3dc3ef(++_0x2d7bde);}(_0xacdd,0x158));var _0xdacd=function(_0x31c3be,_0x5e540f){_0x31c3be=_0x31c3be-0x0;var _0x48314d=_0xacdd[_0x31c3be];return _0x48314d;};'use strict';var SquareProjectEvents=require(_0xdacd('0x0'));var events=[_0xdacd('0x1'),_0xdacd('0x2'),_0xdacd('0x3')];function createListener(_0xba62ff,_0x465573){return function(_0x5e275e){_0x465573[_0xdacd('0x4')](_0xba62ff,_0x5e275e);};}function removeListener(_0x50b056,_0x2ff8bb){return function(){SquareProjectEvents[_0xdacd('0x5')](_0x50b056,_0x2ff8bb);};}exports['register']=function(_0x343c3a){for(var _0x18cf4f=0x0,_0x31e208=events['length'];_0x18cf4f<_0x31e208;_0x18cf4f++){var _0x54c31b=events[_0x18cf4f];var _0x53a0ee=createListener(_0xdacd('0x6')+_0x54c31b,_0x343c3a);SquareProjectEvents['on'](_0x54c31b,_0x53a0ee);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index fa7e55e..870b2c5 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 _0x1261=['isAuthenticated','show','/:id/download','post','create','/:id','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','index','get'];(function(_0x294775,_0x5b9421){var _0x47df93=function(_0x274ea6){while(--_0x274ea6){_0x294775['push'](_0x294775['shift']());}};_0x47df93(++_0x5b9421);}(_0x1261,0x144));var _0x1126=function(_0x2c3458,_0x1f7efd){_0x2c3458=_0x2c3458-0x0;var _0x3f7e02=_0x1261[_0x2c3458];return _0x3f7e02;};'use strict';var multer=require('multer');var util=require(_0x1126('0x0'));var path=require(_0x1126('0x1'));var timeout=require(_0x1126('0x2'));var express=require(_0x1126('0x3'));var router=express[_0x1126('0x4')]();var fs_extra=require(_0x1126('0x5'));var auth=require(_0x1126('0x6'));var interaction=require(_0x1126('0x7'));var config=require(_0x1126('0x8'));var controller=require(_0x1126('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x1126('0xa')]);router[_0x1126('0xb')]('/:id',auth[_0x1126('0xc')](),controller[_0x1126('0xd')]);router[_0x1126('0xb')](_0x1126('0xe'),auth[_0x1126('0xc')](),controller['download']);router[_0x1126('0xf')]('/',auth[_0x1126('0xc')](),controller[_0x1126('0x10')]);router['put'](_0x1126('0x11'),auth['isAuthenticated'](),controller['update']);router[_0x1126('0x12')]('/:id',auth[_0x1126('0xc')](),controller[_0x1126('0x13')]);module[_0x1126('0x14')]=router; \ No newline at end of file +var _0xabce=['util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','show','download','post','create','put','/:id','update','delete','destroy','exports','multer'];(function(_0x1b0bc2,_0x149636){var _0x478893=function(_0x49b2ad){while(--_0x49b2ad){_0x1b0bc2['push'](_0x1b0bc2['shift']());}};_0x478893(++_0x149636);}(_0xabce,0x103));var _0xeabc=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xabce[_0x3bf83f];return _0x22c4a9;};'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('./squareRecording.controller');router['get']('/',auth[_0xeabc('0x8')](),controller['index']);router[_0xeabc('0x9')]('/:id',auth[_0xeabc('0x8')](),controller[_0xeabc('0xa')]);router[_0xeabc('0x9')]('/:id/download',auth[_0xeabc('0x8')](),controller[_0xeabc('0xb')]);router[_0xeabc('0xc')]('/',auth[_0xeabc('0x8')](),controller[_0xeabc('0xd')]);router[_0xeabc('0xe')](_0xeabc('0xf'),auth[_0xeabc('0x8')](),controller[_0xeabc('0x10')]);router[_0xeabc('0x11')](_0xeabc('0xf'),auth[_0xeabc('0x8')](),controller[_0xeabc('0x12')]);module[_0xeabc('0x13')]=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index bffa753..c160c0e 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 _0x038b=['lastIndexOf','exports','STRING','VIRTUAL','substring'];(function(_0x139efb,_0x5ae2fb){var _0x59839f=function(_0x390a3b){while(--_0x390a3b){_0x139efb['push'](_0x139efb['shift']());}};_0x59839f(++_0x5ae2fb);}(_0x038b,0x114));var _0xb038=function(_0x3d85e0,_0x40cb29){_0x3d85e0=_0x3d85e0-0x0;var _0x2f40f8=_0x038b[_0x3d85e0];return _0x2f40f8;};'use strict';var Sequelize=require('sequelize');module[_0xb038('0x0')]={'uniqueid':{'type':Sequelize[_0xb038('0x1')]},'callerid':{'type':Sequelize[_0xb038('0x1')]},'calleridname':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xb038('0x1')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xb038('0x1')]},'accountcode':{'type':Sequelize[_0xb038('0x1')]},'dnid':{'type':Sequelize['STRING']},'projectName':{'type':Sequelize[_0xb038('0x1')]},'saveName':{'type':Sequelize[_0xb038('0x1')]},'filename':{'type':Sequelize['STRING']},'savePath':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0xb038('0x2')],'get':function(){var _0x1b077a='';var _0x1534a9=this['getDataValue']('savePath');if(_0x1534a9){_0x1b077a=_0x1534a9[_0xb038('0x3')](_0x1534a9[_0xb038('0x4')]('.'));}return _0x1b077a;}}}; \ No newline at end of file +var _0x2675=['getDataValue','savePath','lastIndexOf','sequelize','STRING','VIRTUAL'];(function(_0x483cbe,_0x1832da){var _0x191c71=function(_0x2f812f){while(--_0x2f812f){_0x483cbe['push'](_0x483cbe['shift']());}};_0x191c71(++_0x1832da);}(_0x2675,0x75));var _0x5267=function(_0x15c73b,_0x4337f3){_0x15c73b=_0x15c73b-0x0;var _0x27e8e9=_0x2675[_0x15c73b];return _0x27e8e9;};'use strict';var Sequelize=require(_0x5267('0x0'));module['exports']={'uniqueid':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x5267('0x1')]},'context':{'type':Sequelize[_0x5267('0x1')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x5267('0x1')]},'accountcode':{'type':Sequelize[_0x5267('0x1')]},'dnid':{'type':Sequelize['STRING']},'projectName':{'type':Sequelize[_0x5267('0x1')]},'saveName':{'type':Sequelize[_0x5267('0x1')]},'filename':{'type':Sequelize[_0x5267('0x1')]},'savePath':{'type':Sequelize[_0x5267('0x1')]},'format':{'type':Sequelize[_0x5267('0x2')],'get':function(){var _0xc56cd5='';var _0x527c16=this[_0x5267('0x3')](_0x5267('0x4'));if(_0x527c16){_0xc56cd5=_0x527c16['substring'](_0x527c16[_0x5267('0x5')]('.'));}return _0xc56cd5;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index 3370f09..01ff05c 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 _0xb20a=['includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','download','uniqueid','savePath','filename','format','%s.cypher','existsSync','decryptFile','secrets','Sequelize','SquareRecording\x20not\x20found','extname','unlink','message','Not\x20found','destroy','isNil','Entity\x20not\x20found','info','File:\x20\x22','unlinkSync','.cypher','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','stack','name','send','index','map','fieldName','type','model','keys','query','attributes','intersection','fields','length','nolimit','sort','filters','pick','filter','where','merge','VIRTUAL','options','SquareRecording'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xb20a,0x84));var _0xab20=function(_0x2ec461,_0x5f588a){_0x2ec461=_0x2ec461-0x0;var _0x28603d=_0xb20a[_0x2ec461];return _0x28603d;};'use strict';var emlformat=require(_0xab20('0x0'));var rimraf=require(_0xab20('0x1'));var zipdir=require(_0xab20('0x2'));var jsonpatch=require(_0xab20('0x3'));var rp=require(_0xab20('0x4'));var moment=require('moment');var BPromise=require(_0xab20('0x5'));var Mustache=require(_0xab20('0x6'));var util=require(_0xab20('0x7'));var path=require(_0xab20('0x8'));var sox=require(_0xab20('0x9'));var csv=require('to-csv');var ejs=require(_0xab20('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xab20('0xb'));var squel=require(_0xab20('0xc'));var crypto=require(_0xab20('0xd'));var jsforce=require(_0xab20('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xab20('0xf'));var Redis=require(_0xab20('0x10'));var authService=require(_0xab20('0x11'));var qs=require(_0xab20('0x12'));var as=require(_0xab20('0x13'));var hardwareService=require(_0xab20('0x14'));var logger=require(_0xab20('0x15'))(_0xab20('0x16'));var utils=require('../../config/utils');var config=require(_0xab20('0x17'));var licenseUtil=require(_0xab20('0x18'));var db=require(_0xab20('0x19'))['db'];function respondWithStatusCode(_0x356b1e,_0x5f198b){_0x5f198b=_0x5f198b||0xcc;return function(_0x3356f9){if(_0x3356f9){return _0x356b1e[_0xab20('0x1a')](_0x5f198b);}return _0x356b1e[_0xab20('0x1b')](_0x5f198b)[_0xab20('0x1c')]();};}function respondWithResult(_0x32dfee,_0x11cd65){_0x11cd65=_0x11cd65||0xc8;return function(_0x356604){if(_0x356604){return _0x32dfee[_0xab20('0x1b')](_0x11cd65)[_0xab20('0x1d')](_0x356604);}};}function respondWithFilteredResult(_0x4cf2f2,_0x231033){return function(_0x5e99e1){if(_0x5e99e1){var _0xcaa897=typeof _0x231033[_0xab20('0x1e')]===_0xab20('0x1f')&&typeof _0x231033[_0xab20('0x20')]===_0xab20('0x1f');var _0x428cd7=_0x5e99e1[_0xab20('0x21')];var _0x548252=_0xcaa897?0x0:_0x231033[_0xab20('0x1e')];var _0xce0bb=_0xcaa897?_0x5e99e1['count']:_0x231033['offset']+_0x231033['limit'];var _0x277b68;if(_0xce0bb>=_0x428cd7){_0xce0bb=_0x428cd7;_0x277b68=0xc8;}else{_0x277b68=0xce;}_0x4cf2f2[_0xab20('0x1b')](_0x277b68);return _0x4cf2f2[_0xab20('0x22')](_0xab20('0x23'),_0x548252+'-'+_0xce0bb+'/'+_0x428cd7)[_0xab20('0x1d')](_0x5e99e1);}return null;};}function patchUpdates(_0x4c85ed){return function(_0xdcce50){try{jsonpatch['apply'](_0xdcce50,_0x4c85ed,!![]);}catch(_0x8e6940){return BPromise[_0xab20('0x24')](_0x8e6940);}return _0xdcce50[_0xab20('0x25')]();};}function saveUpdates(_0x2c79a9,_0x230de7){return function(_0x5e7251){if(_0x5e7251){return _0x5e7251[_0xab20('0x26')](_0x2c79a9)[_0xab20('0x27')](function(_0x5babde){return _0x5babde;});}return null;};}function removeEntity(_0x1227e1,_0x47015c){return function(_0x13e615){if(_0x13e615){return _0x13e615['destroy']()[_0xab20('0x27')](function(){_0x1227e1[_0xab20('0x1b')](0xcc)[_0xab20('0x1c')]();});}};}function handleEntityNotFound(_0x1f5a27,_0x206b75){return function(_0x49fcec){if(!_0x49fcec){_0x1f5a27[_0xab20('0x1a')](0x194);}return _0x49fcec;};}function handleError(_0x5074b8,_0x2fb12c){_0x2fb12c=_0x2fb12c||0x1f4;return function(_0x4acb04){logger['error'](_0x4acb04[_0xab20('0x28')]);if(_0x4acb04[_0xab20('0x29')]){delete _0x4acb04[_0xab20('0x29')];}_0x5074b8[_0xab20('0x1b')](_0x2fb12c)[_0xab20('0x2a')](_0x4acb04);};}exports[_0xab20('0x2b')]=function(_0x279d70,_0xbc65ec){var _0x50f1b1={},_0x5d84d7={},_0x46161b={'count':0x0,'rows':[]};var _0x3adadc=_[_0xab20('0x2c')](db['SquareRecording']['rawAttributes'],function(_0x507f27){return{'name':_0x507f27[_0xab20('0x2d')],'type':_0x507f27[_0xab20('0x2e')]['key']};});_0x5d84d7[_0xab20('0x2f')]=_[_0xab20('0x2c')](_0x3adadc,_0xab20('0x29'));_0x5d84d7['query']=_[_0xab20('0x30')](_0x279d70[_0xab20('0x31')]);_0x5d84d7['filters']=_['intersection'](_0x5d84d7[_0xab20('0x2f')],_0x5d84d7[_0xab20('0x31')]);_0x50f1b1[_0xab20('0x32')]=_[_0xab20('0x33')](_0x5d84d7[_0xab20('0x2f')],qs[_0xab20('0x34')](_0x279d70['query']['fields']));_0x50f1b1[_0xab20('0x32')]=_0x50f1b1[_0xab20('0x32')][_0xab20('0x35')]?_0x50f1b1[_0xab20('0x32')]:_0x5d84d7[_0xab20('0x2f')];if(!_0x279d70['query']['hasOwnProperty'](_0xab20('0x36'))){_0x50f1b1[_0xab20('0x20')]=qs[_0xab20('0x20')](_0x279d70[_0xab20('0x31')][_0xab20('0x20')]);_0x50f1b1['offset']=qs[_0xab20('0x1e')](_0x279d70[_0xab20('0x31')][_0xab20('0x1e')]);}_0x50f1b1['order']=qs[_0xab20('0x37')](_0x279d70[_0xab20('0x31')][_0xab20('0x37')]);_0x50f1b1['where']=qs[_0xab20('0x38')](_[_0xab20('0x39')](_0x279d70['query'],_0x5d84d7[_0xab20('0x38')]),_0x3adadc);if(_0x279d70[_0xab20('0x31')][_0xab20('0x3a')]){_0x50f1b1[_0xab20('0x3b')]=_[_0xab20('0x3c')](_0x50f1b1[_0xab20('0x3b')],{'$or':_[_0xab20('0x2c')](_0x3adadc,function(_0x596c5a){if(_0x596c5a['type']!==_0xab20('0x3d')){var _0x46e5f5={};_0x46e5f5[_0x596c5a[_0xab20('0x29')]]={'$like':'%'+_0x279d70[_0xab20('0x31')]['filter']+'%'};return _0x46e5f5;}})});}_0x50f1b1=_[_0xab20('0x3c')]({},_0x50f1b1,_0x279d70[_0xab20('0x3e')]);var _0x35949b={'where':_0x50f1b1[_0xab20('0x3b')]};return db[_0xab20('0x3f')]['count'](_0x35949b)[_0xab20('0x27')](function(_0x1b9cef){_0x46161b[_0xab20('0x21')]=_0x1b9cef;if(_0x279d70[_0xab20('0x31')][_0xab20('0x40')]){_0x50f1b1[_0xab20('0x41')]=[{'all':!![]}];}return db[_0xab20('0x3f')][_0xab20('0x42')](_0x50f1b1);})[_0xab20('0x27')](function(_0x3dbe89){_0x46161b[_0xab20('0x43')]=_0x3dbe89;return _0x46161b;})[_0xab20('0x27')](respondWithFilteredResult(_0xbc65ec,_0x50f1b1))[_0xab20('0x44')](handleError(_0xbc65ec,null));};exports[_0xab20('0x45')]=function(_0x33b6d7,_0x56d387){var _0x1f88f8={'raw':!![],'where':{'id':_0x33b6d7[_0xab20('0x46')]['id']}},_0x4ceb18={};_0x4ceb18[_0xab20('0x2f')]=_['keys'](db['SquareRecording'][_0xab20('0x47')]);_0x4ceb18['query']=_[_0xab20('0x30')](_0x33b6d7['query']);_0x4ceb18[_0xab20('0x38')]=_[_0xab20('0x33')](_0x4ceb18[_0xab20('0x2f')],_0x4ceb18[_0xab20('0x31')]);_0x1f88f8[_0xab20('0x32')]=_[_0xab20('0x33')](_0x4ceb18[_0xab20('0x2f')],qs[_0xab20('0x34')](_0x33b6d7['query'][_0xab20('0x34')]));_0x1f88f8['attributes']=_0x1f88f8['attributes'][_0xab20('0x35')]?_0x1f88f8['attributes']:_0x4ceb18[_0xab20('0x2f')];if(_0x33b6d7[_0xab20('0x31')][_0xab20('0x40')]){_0x1f88f8[_0xab20('0x41')]=[{'all':!![]}];}_0x1f88f8=_[_0xab20('0x3c')]({},_0x1f88f8,_0x33b6d7[_0xab20('0x3e')]);return db['SquareRecording'][_0xab20('0x48')](_0x1f88f8)[_0xab20('0x27')](handleEntityNotFound(_0x56d387,null))['then'](respondWithResult(_0x56d387,null))[_0xab20('0x44')](handleError(_0x56d387,null));};exports['create']=function(_0xa1192e,_0x54f545){return db[_0xab20('0x3f')][_0xab20('0x49')](_0xa1192e[_0xab20('0x4a')],{})['then'](respondWithResult(_0x54f545,0xc9))[_0xab20('0x44')](handleError(_0x54f545,null));};exports[_0xab20('0x26')]=function(_0x20d676,_0x4ebc42){if(_0x20d676[_0xab20('0x4a')]['id']){delete _0x20d676[_0xab20('0x4a')]['id'];}return db['SquareRecording'][_0xab20('0x48')]({'where':{'id':_0x20d676[_0xab20('0x46')]['id']}})[_0xab20('0x27')](handleEntityNotFound(_0x4ebc42,null))[_0xab20('0x27')](saveUpdates(_0x20d676[_0xab20('0x4a')],null))['then'](respondWithResult(_0x4ebc42,null))[_0xab20('0x44')](handleError(_0x4ebc42,null));};exports[_0xab20('0x4b')]=function(_0x4b5968,_0x347eca,_0x2bc420){var _0x279e2d=require('../../components/encryptor');var _0x38c211=![];var _0x18495f={};if(_0x4b5968[_0xab20('0x31')]['type']&&_0x4b5968[_0xab20('0x31')][_0xab20('0x2e')]==='uniqueid'){_0x18495f[_0xab20('0x4c')]=_0x4b5968[_0xab20('0x46')]['id'];}else{_0x18495f['id']=_0x4b5968[_0xab20('0x46')]['id'];}return db[_0xab20('0x3f')]['find']({'where':_0x18495f,'attributes':['id',_0xab20('0x4d'),_0xab20('0x4e')],'raw':!![]})['then'](handleEntityNotFound(_0x347eca,null))[_0xab20('0x27')](function(_0x175dd8){if(_0x175dd8){var _0x3f26ce=_0x175dd8[_0xab20('0x4d')];var _0x1000a6=util[_0xab20('0x4f')](_0xab20('0x50'),_0x3f26ce);if(fs[_0xab20('0x51')](_0x1000a6)){_0x38c211=!![];return _0x279e2d[_0xab20('0x52')](_0x1000a6,_0x3f26ce,config[_0xab20('0x53')]['recording'])[_0xab20('0x27')](function(){return _0x175dd8;});}return _0x175dd8;}})[_0xab20('0x27')](function(_0x5e299a){if(_0x5e299a){var _0x5baa3b=_0x5e299a['savePath'];if(!fs[_0xab20('0x51')](_0x5baa3b)){throw new db[(_0xab20('0x54'))]['ValidationError'](_0xab20('0x55'));}if(_0x5e299a['filename']){return _0x347eca[_0xab20('0x4b')](_0x5baa3b,_0x5e299a[_0xab20('0x4e')]+path[_0xab20('0x56')](_0x5baa3b),function(){if(_0x38c211){fs['unlink'](_0x5baa3b);}});}else{return _0x347eca['download'](_0x5baa3b,function(_0x58419c){if(_0x38c211){fs[_0xab20('0x57')](_0x5baa3b);}});}}})[_0xab20('0x44')](function(_0x4180a7){if(_0x4180a7[_0xab20('0x58')]===_0xab20('0x55')){_0x347eca[_0xab20('0x1b')](0x194)[_0xab20('0x2a')](_0xab20('0x59'));}else{return handleError(_0x347eca,null);}});};exports[_0xab20('0x5a')]=function(_0x2b38c9,_0x15df0d){return db[_0xab20('0x3f')][_0xab20('0x48')]({'where':{'id':_0x2b38c9[_0xab20('0x46')]['id']}})[_0xab20('0x27')](function(_0x1c4d19){if(_[_0xab20('0x5b')](_0x1c4d19)){throw new ReferenceError(_0xab20('0x5c'));}return _0x1c4d19;})[_0xab20('0x27')](function(_0x3a9cf4){var _0x419b5e=_0x3a9cf4[_0xab20('0x4d')];logger[_0xab20('0x5d')]('cancellazione\x20fisica\x20documento\x20%s',_0x419b5e);if(!_['isNil'](_0x3a9cf4[_0xab20('0x4d')])&&fs[_0xab20('0x51')](_0x419b5e)){logger['info'](_0xab20('0x5e')+_0x419b5e+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xab20('0x5f')](_0x419b5e);}_0x419b5e=_0x419b5e+_0xab20('0x60');if(!_[_0xab20('0x5b')](_0x3a9cf4['savePath'])&&fs[_0xab20('0x51')](_0x419b5e)){logger[_0xab20('0x5d')]('File:\x20\x22'+_0x419b5e+_0xab20('0x61'));fs[_0xab20('0x5f')](_0x419b5e);}return _0x3a9cf4;})['then'](function(_0x4dc605){if(!_0x4dc605)throw new InternalError();return _0x4dc605[_0xab20('0x5a')]();})['then'](function(){_0x15df0d['status'](0xcc)[_0xab20('0x1c')]();})['catch'](handleError(_0x15df0d,null));}; \ No newline at end of file +var _0x33d0=['../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','undefined','limit','offset','count','set','Content-Range','json','apply','reject','update','then','destroy','stack','name','send','SquareRecording','fieldName','type','model','map','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','show','params','rawAttributes','filters','length','find','catch','body','download','../../components/encryptor','uniqueid','savePath','filename','%s.cypher','existsSync','decryptFile','secrets','SquareRecording\x20not\x20found','extname','unlink','isNil','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','jsforce','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0xda0672,_0x20d61a){var _0x368b3a=function(_0x5a8b0d){while(--_0x5a8b0d){_0xda0672['push'](_0xda0672['shift']());}};_0x368b3a(++_0x20d61a);}(_0x33d0,0x158));var _0x033d=function(_0x62e87e,_0x386237){_0x62e87e=_0x62e87e-0x0;var _0x5bed70=_0x33d0[_0x62e87e];return _0x5bed70;};'use strict';var emlformat=require(_0x033d('0x0'));var rimraf=require(_0x033d('0x1'));var zipdir=require(_0x033d('0x2'));var jsonpatch=require(_0x033d('0x3'));var rp=require(_0x033d('0x4'));var moment=require(_0x033d('0x5'));var BPromise=require(_0x033d('0x6'));var Mustache=require(_0x033d('0x7'));var util=require(_0x033d('0x8'));var path=require(_0x033d('0x9'));var sox=require('sox');var csv=require(_0x033d('0xa'));var ejs=require(_0x033d('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x033d('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x033d('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x033d('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x033d('0xf'));var as=require(_0x033d('0x10'));var hardwareService=require(_0x033d('0x11'));var logger=require(_0x033d('0x12'))(_0x033d('0x13'));var utils=require(_0x033d('0x14'));var config=require(_0x033d('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x033d('0x16'))['db'];function respondWithStatusCode(_0x1f4a11,_0x126603){_0x126603=_0x126603||0xcc;return function(_0x3169d6){if(_0x3169d6){return _0x1f4a11[_0x033d('0x17')](_0x126603);}return _0x1f4a11[_0x033d('0x18')](_0x126603)[_0x033d('0x19')]();};}function respondWithResult(_0x390c49,_0x26ae4b){_0x26ae4b=_0x26ae4b||0xc8;return function(_0x14bdb1){if(_0x14bdb1){return _0x390c49[_0x033d('0x18')](_0x26ae4b)['json'](_0x14bdb1);}};}function respondWithFilteredResult(_0x1dcc78,_0x57ae6e){return function(_0x4e181d){if(_0x4e181d){var _0x51900a=typeof _0x57ae6e['offset']===_0x033d('0x1a')&&typeof _0x57ae6e[_0x033d('0x1b')]===_0x033d('0x1a');var _0xca084e=_0x4e181d['count'];var _0x16e04c=_0x51900a?0x0:_0x57ae6e[_0x033d('0x1c')];var _0x21aced=_0x51900a?_0x4e181d[_0x033d('0x1d')]:_0x57ae6e['offset']+_0x57ae6e[_0x033d('0x1b')];var _0x179081;if(_0x21aced>=_0xca084e){_0x21aced=_0xca084e;_0x179081=0xc8;}else{_0x179081=0xce;}_0x1dcc78[_0x033d('0x18')](_0x179081);return _0x1dcc78[_0x033d('0x1e')](_0x033d('0x1f'),_0x16e04c+'-'+_0x21aced+'/'+_0xca084e)[_0x033d('0x20')](_0x4e181d);}return null;};}function patchUpdates(_0x20a1ba){return function(_0x46a851){try{jsonpatch[_0x033d('0x21')](_0x46a851,_0x20a1ba,!![]);}catch(_0xd5fe7b){return BPromise[_0x033d('0x22')](_0xd5fe7b);}return _0x46a851['save']();};}function saveUpdates(_0x588fa6,_0x966a6c){return function(_0x3ce363){if(_0x3ce363){return _0x3ce363[_0x033d('0x23')](_0x588fa6)[_0x033d('0x24')](function(_0x31b4fe){return _0x31b4fe;});}return null;};}function removeEntity(_0x31fe86,_0xb34235){return function(_0x1a7887){if(_0x1a7887){return _0x1a7887[_0x033d('0x25')]()[_0x033d('0x24')](function(){_0x31fe86[_0x033d('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0xb6a284,_0x9ed210){return function(_0x116cdc){if(!_0x116cdc){_0xb6a284[_0x033d('0x17')](0x194);}return _0x116cdc;};}function handleError(_0x12f3c2,_0x1c948e){_0x1c948e=_0x1c948e||0x1f4;return function(_0x41e806){logger['error'](_0x41e806[_0x033d('0x26')]);if(_0x41e806['name']){delete _0x41e806[_0x033d('0x27')];}_0x12f3c2[_0x033d('0x18')](_0x1c948e)[_0x033d('0x28')](_0x41e806);};}exports['index']=function(_0x2611c7,_0x3eb318){var _0x2d5f33={},_0x19270f={},_0x2a680e={'count':0x0,'rows':[]};var _0x56bf0b=_['map'](db[_0x033d('0x29')]['rawAttributes'],function(_0x37e8d2){return{'name':_0x37e8d2[_0x033d('0x2a')],'type':_0x37e8d2[_0x033d('0x2b')]['key']};});_0x19270f[_0x033d('0x2c')]=_[_0x033d('0x2d')](_0x56bf0b,'name');_0x19270f[_0x033d('0x2e')]=_[_0x033d('0x2f')](_0x2611c7[_0x033d('0x2e')]);_0x19270f['filters']=_[_0x033d('0x30')](_0x19270f[_0x033d('0x2c')],_0x19270f[_0x033d('0x2e')]);_0x2d5f33[_0x033d('0x31')]=_[_0x033d('0x30')](_0x19270f[_0x033d('0x2c')],qs[_0x033d('0x32')](_0x2611c7[_0x033d('0x2e')][_0x033d('0x32')]));_0x2d5f33[_0x033d('0x31')]=_0x2d5f33[_0x033d('0x31')]['length']?_0x2d5f33[_0x033d('0x31')]:_0x19270f[_0x033d('0x2c')];if(!_0x2611c7[_0x033d('0x2e')][_0x033d('0x33')](_0x033d('0x34'))){_0x2d5f33[_0x033d('0x1b')]=qs[_0x033d('0x1b')](_0x2611c7[_0x033d('0x2e')][_0x033d('0x1b')]);_0x2d5f33[_0x033d('0x1c')]=qs[_0x033d('0x1c')](_0x2611c7[_0x033d('0x2e')][_0x033d('0x1c')]);}_0x2d5f33[_0x033d('0x35')]=qs[_0x033d('0x36')](_0x2611c7[_0x033d('0x2e')][_0x033d('0x36')]);_0x2d5f33[_0x033d('0x37')]=qs['filters'](_[_0x033d('0x38')](_0x2611c7[_0x033d('0x2e')],_0x19270f['filters']),_0x56bf0b);if(_0x2611c7['query'][_0x033d('0x39')]){_0x2d5f33[_0x033d('0x37')]=_[_0x033d('0x3a')](_0x2d5f33['where'],{'$or':_['map'](_0x56bf0b,function(_0x24a508){if(_0x24a508['type']!==_0x033d('0x3b')){var _0x54c25f={};_0x54c25f[_0x24a508[_0x033d('0x27')]]={'$like':'%'+_0x2611c7[_0x033d('0x2e')][_0x033d('0x39')]+'%'};return _0x54c25f;}})});}_0x2d5f33=_[_0x033d('0x3a')]({},_0x2d5f33,_0x2611c7[_0x033d('0x3c')]);var _0x52ee99={'where':_0x2d5f33[_0x033d('0x37')]};return db['SquareRecording'][_0x033d('0x1d')](_0x52ee99)[_0x033d('0x24')](function(_0x1e0f92){_0x2a680e[_0x033d('0x1d')]=_0x1e0f92;if(_0x2611c7[_0x033d('0x2e')]['includeAll']){_0x2d5f33[_0x033d('0x3d')]=[{'all':!![]}];}return db[_0x033d('0x29')][_0x033d('0x3e')](_0x2d5f33);})['then'](function(_0x4df457){_0x2a680e['rows']=_0x4df457;return _0x2a680e;})[_0x033d('0x24')](respondWithFilteredResult(_0x3eb318,_0x2d5f33))['catch'](handleError(_0x3eb318,null));};exports[_0x033d('0x3f')]=function(_0x169480,_0x1649dd){var _0x17f783={'raw':!![],'where':{'id':_0x169480[_0x033d('0x40')]['id']}},_0x42b906={};_0x42b906[_0x033d('0x2c')]=_[_0x033d('0x2f')](db[_0x033d('0x29')][_0x033d('0x41')]);_0x42b906[_0x033d('0x2e')]=_[_0x033d('0x2f')](_0x169480[_0x033d('0x2e')]);_0x42b906[_0x033d('0x42')]=_[_0x033d('0x30')](_0x42b906[_0x033d('0x2c')],_0x42b906[_0x033d('0x2e')]);_0x17f783[_0x033d('0x31')]=_['intersection'](_0x42b906[_0x033d('0x2c')],qs[_0x033d('0x32')](_0x169480[_0x033d('0x2e')][_0x033d('0x32')]));_0x17f783['attributes']=_0x17f783[_0x033d('0x31')][_0x033d('0x43')]?_0x17f783[_0x033d('0x31')]:_0x42b906[_0x033d('0x2c')];if(_0x169480[_0x033d('0x2e')]['includeAll']){_0x17f783[_0x033d('0x3d')]=[{'all':!![]}];}_0x17f783=_['merge']({},_0x17f783,_0x169480['options']);return db[_0x033d('0x29')][_0x033d('0x44')](_0x17f783)[_0x033d('0x24')](handleEntityNotFound(_0x1649dd,null))['then'](respondWithResult(_0x1649dd,null))[_0x033d('0x45')](handleError(_0x1649dd,null));};exports['create']=function(_0x532ae0,_0x334739){return db[_0x033d('0x29')]['create'](_0x532ae0[_0x033d('0x46')],{})['then'](respondWithResult(_0x334739,0xc9))[_0x033d('0x45')](handleError(_0x334739,null));};exports[_0x033d('0x23')]=function(_0x3b9938,_0x4c2bc6){if(_0x3b9938[_0x033d('0x46')]['id']){delete _0x3b9938['body']['id'];}return db[_0x033d('0x29')][_0x033d('0x44')]({'where':{'id':_0x3b9938[_0x033d('0x40')]['id']}})[_0x033d('0x24')](handleEntityNotFound(_0x4c2bc6,null))[_0x033d('0x24')](saveUpdates(_0x3b9938[_0x033d('0x46')],null))[_0x033d('0x24')](respondWithResult(_0x4c2bc6,null))[_0x033d('0x45')](handleError(_0x4c2bc6,null));};exports[_0x033d('0x47')]=function(_0x1c1983,_0x10f266,_0x558bea){var _0x298c6c=require(_0x033d('0x48'));var _0x5d5f49=![];var _0x3fea85={};if(_0x1c1983['query'][_0x033d('0x2b')]&&_0x1c1983[_0x033d('0x2e')]['type']===_0x033d('0x49')){_0x3fea85[_0x033d('0x49')]=_0x1c1983[_0x033d('0x40')]['id'];}else{_0x3fea85['id']=_0x1c1983[_0x033d('0x40')]['id'];}return db[_0x033d('0x29')]['find']({'where':_0x3fea85,'attributes':['id',_0x033d('0x4a'),_0x033d('0x4b')],'raw':!![]})[_0x033d('0x24')](handleEntityNotFound(_0x10f266,null))[_0x033d('0x24')](function(_0x4b167a){if(_0x4b167a){var _0x4b9a45=_0x4b167a['savePath'];var _0x4b1bd7=util['format'](_0x033d('0x4c'),_0x4b9a45);if(fs[_0x033d('0x4d')](_0x4b1bd7)){_0x5d5f49=!![];return _0x298c6c[_0x033d('0x4e')](_0x4b1bd7,_0x4b9a45,config[_0x033d('0x4f')]['recording'])[_0x033d('0x24')](function(){return _0x4b167a;});}return _0x4b167a;}})['then'](function(_0x444be6){if(_0x444be6){var _0x2baa09=_0x444be6['savePath'];if(!fs['existsSync'](_0x2baa09)){throw new db['Sequelize']['ValidationError'](_0x033d('0x50'));}if(_0x444be6[_0x033d('0x4b')]){return _0x10f266['download'](_0x2baa09,_0x444be6[_0x033d('0x4b')]+path[_0x033d('0x51')](_0x2baa09),function(){if(_0x5d5f49){fs[_0x033d('0x52')](_0x2baa09);}});}else{return _0x10f266[_0x033d('0x47')](_0x2baa09,function(_0x4d1bbc){if(_0x5d5f49){fs[_0x033d('0x52')](_0x2baa09);}});}}})[_0x033d('0x45')](function(_0x92b9a8){if(_0x92b9a8['message']===_0x033d('0x50')){_0x10f266['status'](0x194)[_0x033d('0x28')]('Not\x20found');}else{return handleError(_0x10f266,null);}});};exports[_0x033d('0x25')]=function(_0x4607a1,_0x2bccd8){return db[_0x033d('0x29')]['find']({'where':{'id':_0x4607a1['params']['id']}})[_0x033d('0x24')](function(_0x2ba815){if(_[_0x033d('0x53')](_0x2ba815)){throw new ReferenceError(_0x033d('0x54'));}return _0x2ba815;})[_0x033d('0x24')](function(_0x140ef8){var _0x21dd92=_0x140ef8['savePath'];logger['info'](_0x033d('0x55'),_0x21dd92);if(!_[_0x033d('0x53')](_0x140ef8[_0x033d('0x4a')])&&fs[_0x033d('0x4d')](_0x21dd92)){logger[_0x033d('0x56')](_0x033d('0x57')+_0x21dd92+_0x033d('0x58'));fs['unlinkSync'](_0x21dd92);}_0x21dd92=_0x21dd92+_0x033d('0x59');if(!_[_0x033d('0x53')](_0x140ef8[_0x033d('0x4a')])&&fs['existsSync'](_0x21dd92)){logger[_0x033d('0x56')](_0x033d('0x57')+_0x21dd92+_0x033d('0x58'));fs[_0x033d('0x5a')](_0x21dd92);}return _0x140ef8;})['then'](function(_0x18d9f0){if(!_0x18d9f0)throw new InternalError();return _0x18d9f0[_0x033d('0x25')]();})[_0x033d('0x24')](function(){_0x2bccd8[_0x033d('0x18')](0xcc)[_0x033d('0x19')]();})['catch'](handleError(_0x2bccd8,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index 6b461af..32e2bc6 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 _0x44c2=['../../config/environment','./squareRecording.attributes','SquareRecording','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x1486e5,_0x39684f){var _0x29d89b=function(_0x4a0a80){while(--_0x4a0a80){_0x1486e5['push'](_0x1486e5['shift']());}};_0x29d89b(++_0x39684f);}(_0x44c2,0x100));var _0x244c=function(_0x2ec2bf,_0x64e983){_0x2ec2bf=_0x2ec2bf-0x0;var _0x2c279c=_0x44c2[_0x2ec2bf];return _0x2c279c;};'use strict';var _=require(_0x244c('0x0'));var util=require(_0x244c('0x1'));var logger=require(_0x244c('0x2'))(_0x244c('0x3'));var moment=require('moment');var BPromise=require(_0x244c('0x4'));var rp=require(_0x244c('0x5'));var fs=require('fs');var path=require(_0x244c('0x6'));var rimraf=require(_0x244c('0x7'));var config=require(_0x244c('0x8'));var attributes=require(_0x244c('0x9'));module['exports']=function(_0x5b6f9a,_0x446a4c){return _0x5b6f9a['define'](_0x244c('0xa'),attributes,{'tableName':'square_recordings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1e82=['moment','bluebird','path','rimraf','./squareRecording.attributes','define','SquareRecording','lodash','util','../../config/logger','api'];(function(_0x55cf09,_0x5c4d87){var _0x539c00=function(_0x26f728){while(--_0x26f728){_0x55cf09['push'](_0x55cf09['shift']());}};_0x539c00(++_0x5c4d87);}(_0x1e82,0x8b));var _0x21e8=function(_0x480a7c,_0x4c5c38){_0x480a7c=_0x480a7c-0x0;var _0x294ac6=_0x1e82[_0x480a7c];return _0x294ac6;};'use strict';var _=require(_0x21e8('0x0'));var util=require(_0x21e8('0x1'));var logger=require(_0x21e8('0x2'))(_0x21e8('0x3'));var moment=require(_0x21e8('0x4'));var BPromise=require(_0x21e8('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x21e8('0x6'));var rimraf=require(_0x21e8('0x7'));var config=require('../../config/environment');var attributes=require(_0x21e8('0x8'));module['exports']=function(_0x35a33a,_0x11e388){return _0x35a33a[_0x21e8('0x9')](_0x21e8('0xa'),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 750667d..41fa390 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 _0xdc0f=['error','code','message','result','catch','SquareRecording','options','raw','CreateSquareRecording','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','client','http','request','then','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x2c6f38,_0x3c0af5){var _0x3b0cd4=function(_0x33f8cb){while(--_0x33f8cb){_0x2c6f38['push'](_0x2c6f38['shift']());}};_0x3b0cd4(++_0x3c0af5);}(_0xdc0f,0x90));var _0xfdc0=function(_0x3458b5,_0x25b314){_0x3458b5=_0x3458b5-0x0;var _0x53bfd1=_0xdc0f[_0x3458b5];return _0x53bfd1;};'use strict';var _=require(_0xfdc0('0x0'));var util=require(_0xfdc0('0x1'));var moment=require(_0xfdc0('0x2'));var BPromise=require(_0xfdc0('0x3'));var rs=require(_0xfdc0('0x4'));var fs=require('fs');var Redis=require(_0xfdc0('0x5'));var db=require(_0xfdc0('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xfdc0('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xfdc0('0x8')][_0xfdc0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3fc12d,_0x3aface,_0x3a480d){return new BPromise(function(_0x499a68,_0x5de5b0){return client[_0xfdc0('0xa')](_0x3fc12d,_0x3a480d)[_0xfdc0('0xb')](function(_0x1fa68f){logger[_0xfdc0('0xc')](_0xfdc0('0xd'),_0x3aface,_0xfdc0('0xe'));logger[_0xfdc0('0xf')](_0xfdc0('0x10'),_0x3aface,_0xfdc0('0xe'),JSON[_0xfdc0('0x11')](_0x1fa68f));if(_0x1fa68f[_0xfdc0('0x12')]){if(_0x1fa68f[_0xfdc0('0x12')][_0xfdc0('0x13')]===0x1f4){logger[_0xfdc0('0x12')]('SquareRecording,\x20%s,\x20%s',_0x3aface,_0x1fa68f[_0xfdc0('0x12')]['message']);return _0x5de5b0(_0x1fa68f[_0xfdc0('0x12')][_0xfdc0('0x14')]);}logger[_0xfdc0('0x12')](_0xfdc0('0xd'),_0x3aface,_0x1fa68f[_0xfdc0('0x12')][_0xfdc0('0x14')]);return _0x499a68(_0x1fa68f[_0xfdc0('0x12')][_0xfdc0('0x14')]);}else{logger[_0xfdc0('0xc')](_0xfdc0('0xd'),_0x3aface,_0xfdc0('0xe'));_0x499a68(_0x1fa68f[_0xfdc0('0x15')][_0xfdc0('0x14')]);}})[_0xfdc0('0x16')](function(_0x248486){logger[_0xfdc0('0x12')](_0xfdc0('0xd'),_0x3aface,_0x248486);_0x5de5b0(_0x248486);});});}exports['CreateSquareRecording']=function(_0x540185){var _0x5aff1b=this;return new Promise(function(_0x495031,_0x445618){return db[_0xfdc0('0x17')]['create'](_0x540185['body'],{'raw':_0x540185[_0xfdc0('0x18')]?_0x540185[_0xfdc0('0x18')][_0xfdc0('0x19')]===undefined?!![]:![]:!![]})[_0xfdc0('0xb')](function(_0x31275c){logger[_0xfdc0('0xc')]('CreateSquareRecording',_0x540185);logger[_0xfdc0('0xf')](_0xfdc0('0x1a'),_0x540185,JSON[_0xfdc0('0x11')](_0x31275c));_0x495031(_0x31275c);})['catch'](function(_0x13c4bb){logger['error'](_0xfdc0('0x1a'),_0x13c4bb[_0xfdc0('0x14')],_0x540185);_0x445618(_0x5aff1b[_0xfdc0('0x12')](0x1f4,_0x13c4bb[_0xfdc0('0x14')]));});});}; \ No newline at end of file +var _0x891d=['request\x20sent','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','SquareRecording','body','options','raw','CreateSquareRecording','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','SquareRecording,\x20%s,\x20%s'];(function(_0x419560,_0x16a92c){var _0x52a0a9=function(_0x1cdc67){while(--_0x1cdc67){_0x419560['push'](_0x419560['shift']());}};_0x52a0a9(++_0x16a92c);}(_0x891d,0x1a4));var _0xd891=function(_0x5de255,_0x2bd804){_0x5de255=_0x5de255-0x0;var _0x440d42=_0x891d[_0x5de255];return _0x440d42;};'use strict';var _=require(_0xd891('0x0'));var util=require(_0xd891('0x1'));var moment=require(_0xd891('0x2'));var BPromise=require(_0xd891('0x3'));var rs=require(_0xd891('0x4'));var fs=require('fs');var Redis=require(_0xd891('0x5'));var db=require(_0xd891('0x6'))['db'];var utils=require(_0xd891('0x7'));var logger=require(_0xd891('0x8'))('rpc');var config=require(_0xd891('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xd891('0xa')][_0xd891('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x906826,_0x2e5998,_0x1d16f3){return new BPromise(function(_0x1e1085,_0x55b35a){return client[_0xd891('0xc')](_0x906826,_0x1d16f3)[_0xd891('0xd')](function(_0x3168ec){logger['info'](_0xd891('0xe'),_0x2e5998,_0xd891('0xf'));logger['debug'](_0xd891('0x10'),_0x2e5998,_0xd891('0xf'),JSON[_0xd891('0x11')](_0x3168ec));if(_0x3168ec[_0xd891('0x12')]){if(_0x3168ec[_0xd891('0x12')][_0xd891('0x13')]===0x1f4){logger['error'](_0xd891('0xe'),_0x2e5998,_0x3168ec[_0xd891('0x12')]['message']);return _0x55b35a(_0x3168ec['error']['message']);}logger[_0xd891('0x12')]('SquareRecording,\x20%s,\x20%s',_0x2e5998,_0x3168ec[_0xd891('0x12')]['message']);return _0x1e1085(_0x3168ec[_0xd891('0x12')][_0xd891('0x14')]);}else{logger[_0xd891('0x15')](_0xd891('0xe'),_0x2e5998,'request\x20sent');_0x1e1085(_0x3168ec['result']['message']);}})[_0xd891('0x16')](function(_0xe28afd){logger[_0xd891('0x12')](_0xd891('0xe'),_0x2e5998,_0xe28afd);_0x55b35a(_0xe28afd);});});}exports['CreateSquareRecording']=function(_0xf76be0){var _0x2fce55=this;return new Promise(function(_0x1546d3,_0x5034fa){return db[_0xd891('0x17')]['create'](_0xf76be0[_0xd891('0x18')],{'raw':_0xf76be0[_0xd891('0x19')]?_0xf76be0[_0xd891('0x19')][_0xd891('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0xdfa9f3){logger[_0xd891('0x15')](_0xd891('0x1b'),_0xf76be0);logger[_0xd891('0x1c')](_0xd891('0x1b'),_0xf76be0,JSON[_0xd891('0x11')](_0xdfa9f3));_0x1546d3(_0xdfa9f3);})[_0xd891('0x16')](function(_0x161014){logger['error'](_0xd891('0x1b'),_0x161014[_0xd891('0x14')],_0xf76be0);_0x5034fa(_0x2fce55['error'](0x1f4,_0x161014[_0xd891('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index a6facfd..588aaf1 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(_0x9ae32f,_0x522356){var _0x3667a0=function(_0x4974c9){while(--_0x4974c9){_0x9ae32f['push'](_0x9ae32f['shift']());}};_0x3667a0(++_0x522356);}(_0xbaf0,0x12a));var _0x0baf=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xbaf0[_0x6131cd];return _0x47e916;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var fs_extra=require(_0x0baf('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var controller=require(_0x0baf('0x8'));router[_0x0baf('0x9')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xb')]);router[_0x0baf('0x9')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller['describe']);router[_0x0baf('0x9')]('/:id',auth[_0x0baf('0xa')](),controller[_0x0baf('0xd')]);router[_0x0baf('0xe')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xf')]);router[_0x0baf('0x10')](_0x0baf('0x11'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x12')]);router[_0x0baf('0x13')](_0x0baf('0x11'),auth['isAuthenticated'](),controller['destroy']);module[_0x0baf('0x14')]=router; \ No newline at end of file +var _0xbaf0=['/:id','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareReport.controller','get','isAuthenticated','index','/describe','show','post','create','put'];(function(_0x4cab0c,_0x307228){var _0x108108=function(_0x122fe4){while(--_0x122fe4){_0x4cab0c['push'](_0x4cab0c['shift']());}};_0x108108(++_0x307228);}(_0xbaf0,0x12a));var _0x0baf=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xbaf0[_0x4cf98e];return _0x1623ac;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var fs_extra=require(_0x0baf('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var controller=require(_0x0baf('0x8'));router[_0x0baf('0x9')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xb')]);router[_0x0baf('0x9')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller['describe']);router[_0x0baf('0x9')]('/:id',auth[_0x0baf('0xa')](),controller[_0x0baf('0xd')]);router[_0x0baf('0xe')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xf')]);router[_0x0baf('0x10')](_0x0baf('0x11'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x12')]);router[_0x0baf('0x13')](_0x0baf('0x11'),auth['isAuthenticated'](),controller['destroy']);module[_0x0baf('0x14')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index 9053c8b..2dd7dbc 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 _0x9fd6=['DATE','BOOLEAN','sequelize','STRING'];(function(_0x243a4e,_0x9d5cb){var _0x5dcc61=function(_0x24ee88){while(--_0x24ee88){_0x243a4e['push'](_0x243a4e['shift']());}};_0x5dcc61(++_0x9d5cb);}(_0x9fd6,0xb6));var _0x69fd=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x9fd6[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0x69fd('0x0'));module['exports']={'network':{'type':Sequelize['STRING']},'network_script':{'type':Sequelize[_0x69fd('0x1')]},'request':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x69fd('0x1')]},'language':{'type':Sequelize[_0x69fd('0x1')]},'type':{'type':Sequelize[_0x69fd('0x1')]},'uniqueid':{'type':Sequelize[_0x69fd('0x1')]},'version':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x69fd('0x1')]},'calleridname':{'type':Sequelize['STRING']},'callingpres':{'type':Sequelize[_0x69fd('0x1')]},'callingani2':{'type':Sequelize[_0x69fd('0x1')]},'callington':{'type':Sequelize['STRING']},'callingtns':{'type':Sequelize[_0x69fd('0x1')]},'dnid':{'type':Sequelize['STRING']},'rdnis':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x69fd('0x1')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['STRING']},'enhanced':{'type':Sequelize[_0x69fd('0x1')]},'accountcode':{'type':Sequelize[_0x69fd('0x1')]},'threadid':{'type':Sequelize[_0x69fd('0x1')]},'project_name':{'type':Sequelize[_0x69fd('0x1')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x69fd('0x2')]},'bot':{'type':Sequelize[_0x69fd('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xe900=['BOOLEAN','sequelize','STRING','DATE'];(function(_0xc8a931,_0x260690){var _0x28bd27=function(_0x591b9f){while(--_0x591b9f){_0xc8a931['push'](_0xc8a931['shift']());}};_0x28bd27(++_0x260690);}(_0xe900,0x89));var _0x0e90=function(_0xe02f9,_0x3c0123){_0xe02f9=_0xe02f9-0x0;var _0x3d432e=_0xe900[_0xe02f9];return _0x3d432e;};'use strict';var Sequelize=require(_0x0e90('0x0'));module['exports']={'network':{'type':Sequelize[_0x0e90('0x1')]},'network_script':{'type':Sequelize[_0x0e90('0x1')]},'request':{'type':Sequelize[_0x0e90('0x1')]},'channel':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x0e90('0x1')]},'type':{'type':Sequelize[_0x0e90('0x1')]},'uniqueid':{'type':Sequelize['STRING']},'version':{'type':Sequelize[_0x0e90('0x1')]},'callerid':{'type':Sequelize[_0x0e90('0x1')]},'calleridname':{'type':Sequelize[_0x0e90('0x1')]},'callingpres':{'type':Sequelize[_0x0e90('0x1')]},'callingani2':{'type':Sequelize[_0x0e90('0x1')]},'callington':{'type':Sequelize[_0x0e90('0x1')]},'callingtns':{'type':Sequelize[_0x0e90('0x1')]},'dnid':{'type':Sequelize[_0x0e90('0x1')]},'rdnis':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x0e90('0x1')]},'extension':{'type':Sequelize[_0x0e90('0x1')]},'priority':{'type':Sequelize[_0x0e90('0x1')]},'enhanced':{'type':Sequelize[_0x0e90('0x1')]},'accountcode':{'type':Sequelize[_0x0e90('0x1')]},'threadid':{'type':Sequelize[_0x0e90('0x1')]},'project_name':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x0e90('0x2')]},'leaveAt':{'type':Sequelize[_0x0e90('0x2')]},'bot':{'type':Sequelize[_0x0e90('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index a736169..0db94e3 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 _0x97fe=['offset','limit','undefined','count','set','Content-Range','apply','reject','save','destroy','then','error','stack','name','index','SquareReport','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','catch','show','params','find','create','update','body','describe','rimraf','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json'];(function(_0x50ab14,_0x554b27){var _0x35822e=function(_0x55ffc8){while(--_0x55ffc8){_0x50ab14['push'](_0x50ab14['shift']());}};_0x35822e(++_0x554b27);}(_0x97fe,0xce));var _0xe97f=function(_0x3c9e07,_0x4566a0){_0x3c9e07=_0x3c9e07-0x0;var _0x551585=_0x97fe[_0x3c9e07];return _0x551585;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe97f('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xe97f('0x1'));var moment=require(_0xe97f('0x2'));var BPromise=require(_0xe97f('0x3'));var Mustache=require('mustache');var util=require(_0xe97f('0x4'));var path=require(_0xe97f('0x5'));var sox=require(_0xe97f('0x6'));var csv=require(_0xe97f('0x7'));var ejs=require(_0xe97f('0x8'));var fs=require('fs');var fs_extra=require(_0xe97f('0x9'));var _=require(_0xe97f('0xa'));var squel=require(_0xe97f('0xb'));var crypto=require(_0xe97f('0xc'));var jsforce=require(_0xe97f('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xe97f('0x7'));var querystring=require(_0xe97f('0xe'));var Papa=require(_0xe97f('0xf'));var Redis=require(_0xe97f('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe97f('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe97f('0x12'))(_0xe97f('0x13'));var utils=require(_0xe97f('0x14'));var config=require(_0xe97f('0x15'));var licenseUtil=require(_0xe97f('0x16'));var db=require(_0xe97f('0x17'))['db'];function respondWithStatusCode(_0x391f41,_0x4a669b){_0x4a669b=_0x4a669b||0xcc;return function(_0x5a750b){if(_0x5a750b){return _0x391f41[_0xe97f('0x18')](_0x4a669b);}return _0x391f41[_0xe97f('0x19')](_0x4a669b)[_0xe97f('0x1a')]();};}function respondWithResult(_0x37571d,_0x436eff){_0x436eff=_0x436eff||0xc8;return function(_0x38a9fb){if(_0x38a9fb){return _0x37571d[_0xe97f('0x19')](_0x436eff)[_0xe97f('0x1b')](_0x38a9fb);}};}function respondWithFilteredResult(_0x200ba9,_0xe97c23){return function(_0x4b7101){if(_0x4b7101){var _0x496835=typeof _0xe97c23[_0xe97f('0x1c')]==='undefined'&&typeof _0xe97c23[_0xe97f('0x1d')]===_0xe97f('0x1e');var _0x12bdce=_0x4b7101[_0xe97f('0x1f')];var _0x6e6913=_0x496835?0x0:_0xe97c23['offset'];var _0x304992=_0x496835?_0x4b7101[_0xe97f('0x1f')]:_0xe97c23[_0xe97f('0x1c')]+_0xe97c23[_0xe97f('0x1d')];var _0x203d83;if(_0x304992>=_0x12bdce){_0x304992=_0x12bdce;_0x203d83=0xc8;}else{_0x203d83=0xce;}_0x200ba9['status'](_0x203d83);return _0x200ba9[_0xe97f('0x20')](_0xe97f('0x21'),_0x6e6913+'-'+_0x304992+'/'+_0x12bdce)[_0xe97f('0x1b')](_0x4b7101);}return null;};}function patchUpdates(_0x18c547){return function(_0x28ad62){try{jsonpatch[_0xe97f('0x22')](_0x28ad62,_0x18c547,!![]);}catch(_0x5b76f2){return BPromise[_0xe97f('0x23')](_0x5b76f2);}return _0x28ad62[_0xe97f('0x24')]();};}function saveUpdates(_0x31062b,_0x547620){return function(_0x3f3e13){if(_0x3f3e13){return _0x3f3e13['update'](_0x31062b)['then'](function(_0x6fe0a6){return _0x6fe0a6;});}return null;};}function removeEntity(_0x1e7e04,_0x5427ef){return function(_0x78f924){if(_0x78f924){return _0x78f924[_0xe97f('0x25')]()[_0xe97f('0x26')](function(){_0x1e7e04[_0xe97f('0x19')](0xcc)[_0xe97f('0x1a')]();});}};}function handleEntityNotFound(_0x386030,_0x5813ce){return function(_0x1b76f7){if(!_0x1b76f7){_0x386030[_0xe97f('0x18')](0x194);}return _0x1b76f7;};}function handleError(_0x1f6be9,_0x31b3ee){_0x31b3ee=_0x31b3ee||0x1f4;return function(_0x5ee67c){logger[_0xe97f('0x27')](_0x5ee67c[_0xe97f('0x28')]);if(_0x5ee67c[_0xe97f('0x29')]){delete _0x5ee67c[_0xe97f('0x29')];}_0x1f6be9[_0xe97f('0x19')](_0x31b3ee)['send'](_0x5ee67c);};}exports[_0xe97f('0x2a')]=function(_0x2816c5,_0x39d996){var _0x48ecfd={},_0x19ffbe={},_0x446c46={'count':0x0,'rows':[]};var _0x13b52a=_['map'](db[_0xe97f('0x2b')][_0xe97f('0x2c')],function(_0xee94d4){return{'name':_0xee94d4[_0xe97f('0x2d')],'type':_0xee94d4[_0xe97f('0x2e')][_0xe97f('0x2f')]};});_0x19ffbe[_0xe97f('0x30')]=_[_0xe97f('0x31')](_0x13b52a,_0xe97f('0x29'));_0x19ffbe[_0xe97f('0x32')]=_[_0xe97f('0x33')](_0x2816c5[_0xe97f('0x32')]);_0x19ffbe['filters']=_[_0xe97f('0x34')](_0x19ffbe[_0xe97f('0x30')],_0x19ffbe[_0xe97f('0x32')]);_0x48ecfd[_0xe97f('0x35')]=_[_0xe97f('0x34')](_0x19ffbe['model'],qs[_0xe97f('0x36')](_0x2816c5[_0xe97f('0x32')]['fields']));_0x48ecfd[_0xe97f('0x35')]=_0x48ecfd[_0xe97f('0x35')][_0xe97f('0x37')]?_0x48ecfd[_0xe97f('0x35')]:_0x19ffbe[_0xe97f('0x30')];if(!_0x2816c5[_0xe97f('0x32')][_0xe97f('0x38')](_0xe97f('0x39'))){_0x48ecfd[_0xe97f('0x1d')]=qs['limit'](_0x2816c5[_0xe97f('0x32')][_0xe97f('0x1d')]);_0x48ecfd['offset']=qs['offset'](_0x2816c5[_0xe97f('0x32')][_0xe97f('0x1c')]);}_0x48ecfd[_0xe97f('0x3a')]=qs['sort'](_0x2816c5[_0xe97f('0x32')][_0xe97f('0x3b')]);_0x48ecfd[_0xe97f('0x3c')]=qs[_0xe97f('0x3d')](_[_0xe97f('0x3e')](_0x2816c5[_0xe97f('0x32')],_0x19ffbe['filters']),_0x13b52a);if(_0x2816c5['query']['filter']){_0x48ecfd[_0xe97f('0x3c')]=_[_0xe97f('0x3f')](_0x48ecfd['where'],{'$or':_[_0xe97f('0x31')](_0x13b52a,function(_0x120d8b){if(_0x120d8b['type']!==_0xe97f('0x40')){var _0x46b56d={};_0x46b56d[_0x120d8b[_0xe97f('0x29')]]={'$like':'%'+_0x2816c5[_0xe97f('0x32')][_0xe97f('0x41')]+'%'};return _0x46b56d;}})});}_0x48ecfd=_[_0xe97f('0x3f')]({},_0x48ecfd,_0x2816c5[_0xe97f('0x42')]);var _0x19787b={'where':_0x48ecfd[_0xe97f('0x3c')]};return db[_0xe97f('0x2b')][_0xe97f('0x1f')](_0x19787b)['then'](function(_0x4ed18c){_0x446c46[_0xe97f('0x1f')]=_0x4ed18c;if(_0x2816c5[_0xe97f('0x32')][_0xe97f('0x43')]){_0x48ecfd[_0xe97f('0x44')]=[{'all':!![]}];}return db[_0xe97f('0x2b')][_0xe97f('0x45')](_0x48ecfd);})[_0xe97f('0x26')](function(_0x5557fb){_0x446c46['rows']=_0x5557fb;return _0x446c46;})[_0xe97f('0x26')](respondWithFilteredResult(_0x39d996,_0x48ecfd))[_0xe97f('0x46')](handleError(_0x39d996,null));};exports[_0xe97f('0x47')]=function(_0x590edb,_0x127338){var _0x3407b7={'raw':!![],'where':{'id':_0x590edb[_0xe97f('0x48')]['id']}},_0x483c29={};_0x483c29['model']=_['keys'](db['SquareReport']['rawAttributes']);_0x483c29['query']=_[_0xe97f('0x33')](_0x590edb[_0xe97f('0x32')]);_0x483c29[_0xe97f('0x3d')]=_['intersection'](_0x483c29[_0xe97f('0x30')],_0x483c29[_0xe97f('0x32')]);_0x3407b7[_0xe97f('0x35')]=_[_0xe97f('0x34')](_0x483c29[_0xe97f('0x30')],qs['fields'](_0x590edb[_0xe97f('0x32')]['fields']));_0x3407b7['attributes']=_0x3407b7['attributes'][_0xe97f('0x37')]?_0x3407b7['attributes']:_0x483c29[_0xe97f('0x30')];if(_0x590edb[_0xe97f('0x32')][_0xe97f('0x43')]){_0x3407b7['include']=[{'all':!![]}];}_0x3407b7=_[_0xe97f('0x3f')]({},_0x3407b7,_0x590edb[_0xe97f('0x42')]);return db['SquareReport'][_0xe97f('0x49')](_0x3407b7)[_0xe97f('0x26')](handleEntityNotFound(_0x127338,null))[_0xe97f('0x26')](respondWithResult(_0x127338,null))['catch'](handleError(_0x127338,null));};exports[_0xe97f('0x4a')]=function(_0x5a1bbd,_0x2cc8ce){return db['SquareReport'][_0xe97f('0x4a')](_0x5a1bbd['body'],{})[_0xe97f('0x26')](respondWithResult(_0x2cc8ce,0xc9))['catch'](handleError(_0x2cc8ce,null));};exports[_0xe97f('0x4b')]=function(_0x27523a,_0x19d944){if(_0x27523a['body']['id']){delete _0x27523a[_0xe97f('0x4c')]['id'];}return db['SquareReport'][_0xe97f('0x49')]({'where':{'id':_0x27523a[_0xe97f('0x48')]['id']}})['then'](handleEntityNotFound(_0x19d944,null))[_0xe97f('0x26')](saveUpdates(_0x27523a[_0xe97f('0x4c')],null))[_0xe97f('0x26')](respondWithResult(_0x19d944,null))['catch'](handleError(_0x19d944,null));};exports[_0xe97f('0x25')]=function(_0x429eb5,_0x49ec27){return db[_0xe97f('0x2b')][_0xe97f('0x49')]({'where':{'id':_0x429eb5['params']['id']}})[_0xe97f('0x26')](handleEntityNotFound(_0x49ec27,null))[_0xe97f('0x26')](removeEntity(_0x49ec27,null))[_0xe97f('0x46')](handleError(_0x49ec27,null));};exports[_0xe97f('0x4d')]=function(_0x13c415,_0x20bace){return db[_0xe97f('0x2b')][_0xe97f('0x4d')]()[_0xe97f('0x26')](respondWithResult(_0x20bace,null))[_0xe97f('0x46')](handleError(_0x20bace,null));}; \ No newline at end of file +var _0x4400=['../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map','SquareReport','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','options','count','include','rows','show','params','rawAttributes','find','create','body','catch','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment'];(function(_0x5d5315,_0x174f28){var _0x3b9091=function(_0x411652){while(--_0x411652){_0x5d5315['push'](_0x5d5315['shift']());}};_0x3b9091(++_0x174f28);}(_0x4400,0x1a5));var _0x0440=function(_0x6d3400,_0x4b1467){_0x6d3400=_0x6d3400-0x0;var _0x2c437c=_0x4400[_0x6d3400];return _0x2c437c;};'use strict';var emlformat=require(_0x0440('0x0'));var rimraf=require(_0x0440('0x1'));var zipdir=require(_0x0440('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0440('0x3'));var moment=require(_0x0440('0x4'));var BPromise=require(_0x0440('0x5'));var Mustache=require('mustache');var util=require(_0x0440('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x0440('0x7'));var ejs=require(_0x0440('0x8'));var fs=require('fs');var fs_extra=require(_0x0440('0x9'));var _=require(_0x0440('0xa'));var squel=require(_0x0440('0xb'));var crypto=require(_0x0440('0xc'));var jsforce=require(_0x0440('0xd'));var deskjs=require(_0x0440('0xe'));var toCsv=require(_0x0440('0x7'));var querystring=require(_0x0440('0xf'));var Papa=require(_0x0440('0x10'));var Redis=require('ioredis');var authService=require(_0x0440('0x11'));var qs=require(_0x0440('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0440('0x13'));var logger=require('../../config/logger')(_0x0440('0x14'));var utils=require(_0x0440('0x15'));var config=require(_0x0440('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x0440('0x17'))['db'];function respondWithStatusCode(_0x229bb1,_0x53bc67){_0x53bc67=_0x53bc67||0xcc;return function(_0x1ca9c0){if(_0x1ca9c0){return _0x229bb1[_0x0440('0x18')](_0x53bc67);}return _0x229bb1['status'](_0x53bc67)[_0x0440('0x19')]();};}function respondWithResult(_0xc57247,_0x297273){_0x297273=_0x297273||0xc8;return function(_0x18c489){if(_0x18c489){return _0xc57247[_0x0440('0x1a')](_0x297273)[_0x0440('0x1b')](_0x18c489);}};}function respondWithFilteredResult(_0x323c04,_0x2a3ea9){return function(_0x5a9729){if(_0x5a9729){var _0x5e680d=typeof _0x2a3ea9[_0x0440('0x1c')]===_0x0440('0x1d')&&typeof _0x2a3ea9[_0x0440('0x1e')]==='undefined';var _0x430fc5=_0x5a9729['count'];var _0x2f81ad=_0x5e680d?0x0:_0x2a3ea9['offset'];var _0x12cb6f=_0x5e680d?_0x5a9729['count']:_0x2a3ea9[_0x0440('0x1c')]+_0x2a3ea9[_0x0440('0x1e')];var _0x5c78a5;if(_0x12cb6f>=_0x430fc5){_0x12cb6f=_0x430fc5;_0x5c78a5=0xc8;}else{_0x5c78a5=0xce;}_0x323c04[_0x0440('0x1a')](_0x5c78a5);return _0x323c04['set'](_0x0440('0x1f'),_0x2f81ad+'-'+_0x12cb6f+'/'+_0x430fc5)['json'](_0x5a9729);}return null;};}function patchUpdates(_0x57915){return function(_0x5f3c2f){try{jsonpatch[_0x0440('0x20')](_0x5f3c2f,_0x57915,!![]);}catch(_0x33ebee){return BPromise[_0x0440('0x21')](_0x33ebee);}return _0x5f3c2f[_0x0440('0x22')]();};}function saveUpdates(_0x2a1b44,_0x25b651){return function(_0x1d497b){if(_0x1d497b){return _0x1d497b[_0x0440('0x23')](_0x2a1b44)[_0x0440('0x24')](function(_0x79a28){return _0x79a28;});}return null;};}function removeEntity(_0x11ab9e,_0x1e5efe){return function(_0x5d6d78){if(_0x5d6d78){return _0x5d6d78[_0x0440('0x25')]()[_0x0440('0x24')](function(){_0x11ab9e[_0x0440('0x1a')](0xcc)[_0x0440('0x19')]();});}};}function handleEntityNotFound(_0x2464e9,_0x2f995d){return function(_0x125b91){if(!_0x125b91){_0x2464e9[_0x0440('0x18')](0x194);}return _0x125b91;};}function handleError(_0x4a6762,_0x56a62b){_0x56a62b=_0x56a62b||0x1f4;return function(_0x33dde1){logger[_0x0440('0x26')](_0x33dde1['stack']);if(_0x33dde1[_0x0440('0x27')]){delete _0x33dde1[_0x0440('0x27')];}_0x4a6762[_0x0440('0x1a')](_0x56a62b)[_0x0440('0x28')](_0x33dde1);};}exports[_0x0440('0x29')]=function(_0x4a2b3b,_0x17d883){var _0x5b72eb={},_0x20cc5a={},_0x452bc1={'count':0x0,'rows':[]};var _0x2dff3a=_[_0x0440('0x2a')](db[_0x0440('0x2b')]['rawAttributes'],function(_0x40db42){return{'name':_0x40db42['fieldName'],'type':_0x40db42['type'][_0x0440('0x2c')]};});_0x20cc5a[_0x0440('0x2d')]=_[_0x0440('0x2a')](_0x2dff3a,_0x0440('0x27'));_0x20cc5a[_0x0440('0x2e')]=_[_0x0440('0x2f')](_0x4a2b3b[_0x0440('0x2e')]);_0x20cc5a[_0x0440('0x30')]=_[_0x0440('0x31')](_0x20cc5a[_0x0440('0x2d')],_0x20cc5a['query']);_0x5b72eb[_0x0440('0x32')]=_[_0x0440('0x31')](_0x20cc5a[_0x0440('0x2d')],qs[_0x0440('0x33')](_0x4a2b3b['query'][_0x0440('0x33')]));_0x5b72eb[_0x0440('0x32')]=_0x5b72eb[_0x0440('0x32')][_0x0440('0x34')]?_0x5b72eb['attributes']:_0x20cc5a[_0x0440('0x2d')];if(!_0x4a2b3b['query'][_0x0440('0x35')]('nolimit')){_0x5b72eb[_0x0440('0x1e')]=qs[_0x0440('0x1e')](_0x4a2b3b[_0x0440('0x2e')][_0x0440('0x1e')]);_0x5b72eb[_0x0440('0x1c')]=qs[_0x0440('0x1c')](_0x4a2b3b[_0x0440('0x2e')][_0x0440('0x1c')]);}_0x5b72eb[_0x0440('0x36')]=qs['sort'](_0x4a2b3b[_0x0440('0x2e')][_0x0440('0x37')]);_0x5b72eb[_0x0440('0x38')]=qs[_0x0440('0x30')](_[_0x0440('0x39')](_0x4a2b3b[_0x0440('0x2e')],_0x20cc5a[_0x0440('0x30')]),_0x2dff3a);if(_0x4a2b3b[_0x0440('0x2e')][_0x0440('0x3a')]){_0x5b72eb[_0x0440('0x38')]=_[_0x0440('0x3b')](_0x5b72eb['where'],{'$or':_[_0x0440('0x2a')](_0x2dff3a,function(_0x1d029b){if(_0x1d029b[_0x0440('0x3c')]!==_0x0440('0x3d')){var _0x466de4={};_0x466de4[_0x1d029b[_0x0440('0x27')]]={'$like':'%'+_0x4a2b3b[_0x0440('0x2e')][_0x0440('0x3a')]+'%'};return _0x466de4;}})});}_0x5b72eb=_[_0x0440('0x3b')]({},_0x5b72eb,_0x4a2b3b[_0x0440('0x3e')]);var _0x3f3b65={'where':_0x5b72eb[_0x0440('0x38')]};return db[_0x0440('0x2b')]['count'](_0x3f3b65)['then'](function(_0x4163cc){_0x452bc1[_0x0440('0x3f')]=_0x4163cc;if(_0x4a2b3b[_0x0440('0x2e')]['includeAll']){_0x5b72eb[_0x0440('0x40')]=[{'all':!![]}];}return db[_0x0440('0x2b')]['findAll'](_0x5b72eb);})[_0x0440('0x24')](function(_0x2c3ece){_0x452bc1[_0x0440('0x41')]=_0x2c3ece;return _0x452bc1;})['then'](respondWithFilteredResult(_0x17d883,_0x5b72eb))['catch'](handleError(_0x17d883,null));};exports[_0x0440('0x42')]=function(_0x5cb2d0,_0x3efa6a){var _0xbf95d6={'raw':!![],'where':{'id':_0x5cb2d0[_0x0440('0x43')]['id']}},_0x2450b2={};_0x2450b2[_0x0440('0x2d')]=_['keys'](db[_0x0440('0x2b')][_0x0440('0x44')]);_0x2450b2[_0x0440('0x2e')]=_[_0x0440('0x2f')](_0x5cb2d0[_0x0440('0x2e')]);_0x2450b2[_0x0440('0x30')]=_[_0x0440('0x31')](_0x2450b2[_0x0440('0x2d')],_0x2450b2['query']);_0xbf95d6['attributes']=_[_0x0440('0x31')](_0x2450b2[_0x0440('0x2d')],qs[_0x0440('0x33')](_0x5cb2d0[_0x0440('0x2e')][_0x0440('0x33')]));_0xbf95d6[_0x0440('0x32')]=_0xbf95d6['attributes']['length']?_0xbf95d6[_0x0440('0x32')]:_0x2450b2[_0x0440('0x2d')];if(_0x5cb2d0[_0x0440('0x2e')]['includeAll']){_0xbf95d6[_0x0440('0x40')]=[{'all':!![]}];}_0xbf95d6=_['merge']({},_0xbf95d6,_0x5cb2d0[_0x0440('0x3e')]);return db[_0x0440('0x2b')][_0x0440('0x45')](_0xbf95d6)[_0x0440('0x24')](handleEntityNotFound(_0x3efa6a,null))['then'](respondWithResult(_0x3efa6a,null))['catch'](handleError(_0x3efa6a,null));};exports['create']=function(_0x4f06b7,_0x4634d4){return db[_0x0440('0x2b')][_0x0440('0x46')](_0x4f06b7[_0x0440('0x47')],{})[_0x0440('0x24')](respondWithResult(_0x4634d4,0xc9))[_0x0440('0x48')](handleError(_0x4634d4,null));};exports[_0x0440('0x23')]=function(_0x3ce46e,_0x1184eb){if(_0x3ce46e['body']['id']){delete _0x3ce46e[_0x0440('0x47')]['id'];}return db[_0x0440('0x2b')]['find']({'where':{'id':_0x3ce46e[_0x0440('0x43')]['id']}})[_0x0440('0x24')](handleEntityNotFound(_0x1184eb,null))[_0x0440('0x24')](saveUpdates(_0x3ce46e[_0x0440('0x47')],null))[_0x0440('0x24')](respondWithResult(_0x1184eb,null))[_0x0440('0x48')](handleError(_0x1184eb,null));};exports['destroy']=function(_0x2cce81,_0x3b704c){return db[_0x0440('0x2b')]['find']({'where':{'id':_0x2cce81[_0x0440('0x43')]['id']}})[_0x0440('0x24')](handleEntityNotFound(_0x3b704c,null))[_0x0440('0x24')](removeEntity(_0x3b704c,null))[_0x0440('0x48')](handleError(_0x3b704c,null));};exports[_0x0440('0x49')]=function(_0x5c9f99,_0x3fbd2b){return db[_0x0440('0x2b')][_0x0440('0x49')]()['then'](respondWithResult(_0x3fbd2b,null))[_0x0440('0x48')](handleError(_0x3fbd2b,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index c018d3d..a9dc02e 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 _0x5de5=['leaveAt','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment','./squareReport.attributes','exports','define','SquareReport','report_square','uid_pname','uniqueid','project_name'];(function(_0x4c69a,_0x5eb4be){var _0x629b86=function(_0x361656){while(--_0x361656){_0x4c69a['push'](_0x4c69a['shift']());}};_0x629b86(++_0x5eb4be);}(_0x5de5,0x133));var _0x55de=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x5de5[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x55de('0x0'));var util=require(_0x55de('0x1'));var logger=require(_0x55de('0x2'))(_0x55de('0x3'));var moment=require(_0x55de('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x55de('0x5'));var rimraf=require(_0x55de('0x6'));var config=require(_0x55de('0x7'));var attributes=require(_0x55de('0x8'));module[_0x55de('0x9')]=function(_0x361944,_0x4fbaf8){return _0x361944[_0x55de('0xa')](_0x55de('0xb'),attributes,{'tableName':_0x55de('0xc'),'paranoid':![],'indexes':[{'name':_0x55de('0xd'),'fields':[_0x55de('0xe'),_0x55de('0xf')]},{'name':_0x55de('0x10'),'fields':[_0x55de('0x10')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x34a6=['../../config/logger','api','bluebird','path','./squareReport.attributes','exports','define','report_square','uniqueid','leaveAt','lodash','util'];(function(_0xfc9bb7,_0x3926f9){var _0x77b459=function(_0x47ec36){while(--_0x47ec36){_0xfc9bb7['push'](_0xfc9bb7['shift']());}};_0x77b459(++_0x3926f9);}(_0x34a6,0x106));var _0x634a=function(_0x51b99c,_0x2896b8){_0x51b99c=_0x51b99c-0x0;var _0x368b13=_0x34a6[_0x51b99c];return _0x368b13;};'use strict';var _=require(_0x634a('0x0'));var util=require(_0x634a('0x1'));var logger=require(_0x634a('0x2'))(_0x634a('0x3'));var moment=require('moment');var BPromise=require(_0x634a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x634a('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x634a('0x6'));module[_0x634a('0x7')]=function(_0x2126f7,_0x34ddbe){return _0x2126f7[_0x634a('0x8')]('SquareReport',attributes,{'tableName':_0x634a('0x9'),'paranoid':![],'indexes':[{'name':'uid_pname','fields':[_0x634a('0xa'),'project_name']},{'name':_0x634a('0xb'),'fields':[_0x634a('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index a8398cc..97314e9 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 _0x662e=['CreateSquareReport','SquareReport','create','options','update','body','raw','where','limit','UpdateSquareReport','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','SquareReport,\x20%s,\x20%s','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x662e,0x14a));var _0xe662=function(_0x3e5347,_0x27354a){_0x3e5347=_0x3e5347-0x0;var _0x23d77b=_0x662e[_0x3e5347];return _0x23d77b;};'use strict';var _=require(_0xe662('0x0'));var util=require(_0xe662('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xe662('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe662('0x3'))['db'];var utils=require(_0xe662('0x4'));var logger=require(_0xe662('0x5'))(_0xe662('0x6'));var config=require('../../config/environment');var jayson=require(_0xe662('0x7'));var client=jayson[_0xe662('0x8')][_0xe662('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5640a0,_0x480a14,_0x31852e){return new BPromise(function(_0x19fb3b,_0x4ac0d1){return client['request'](_0x5640a0,_0x31852e)[_0xe662('0xa')](function(_0x5ceb6c){logger[_0xe662('0xb')](_0xe662('0xc'),_0x480a14,_0xe662('0xd'));logger[_0xe662('0xe')](_0xe662('0xf'),_0x480a14,_0xe662('0xd'),JSON[_0xe662('0x10')](_0x5ceb6c));if(_0x5ceb6c[_0xe662('0x11')]){if(_0x5ceb6c[_0xe662('0x11')][_0xe662('0x12')]===0x1f4){logger[_0xe662('0x11')](_0xe662('0xc'),_0x480a14,_0x5ceb6c[_0xe662('0x11')][_0xe662('0x13')]);return _0x4ac0d1(_0x5ceb6c[_0xe662('0x11')]['message']);}logger['error']('SquareReport,\x20%s,\x20%s',_0x480a14,_0x5ceb6c['error']['message']);return _0x19fb3b(_0x5ceb6c[_0xe662('0x11')][_0xe662('0x13')]);}else{logger[_0xe662('0xb')](_0xe662('0xc'),_0x480a14,_0xe662('0xd'));_0x19fb3b(_0x5ceb6c[_0xe662('0x14')][_0xe662('0x13')]);}})[_0xe662('0x15')](function(_0x4f76ce){logger[_0xe662('0x11')](_0xe662('0xc'),_0x480a14,_0x4f76ce);_0x4ac0d1(_0x4f76ce);});});}exports[_0xe662('0x16')]=function(_0x46f035){var _0x142f31=this;return new Promise(function(_0x515155,_0x4e4244){return db[_0xe662('0x17')][_0xe662('0x18')](_0x46f035['body'],{'raw':_0x46f035[_0xe662('0x19')]?_0x46f035[_0xe662('0x19')]['raw']===undefined?!![]:![]:!![]})[_0xe662('0xa')](function(_0x53a4a4){logger[_0xe662('0xb')](_0xe662('0x16'),_0x46f035);logger['debug'](_0xe662('0x16'),_0x46f035,JSON[_0xe662('0x10')](_0x53a4a4));_0x515155(_0x53a4a4);})[_0xe662('0x15')](function(_0x26e680){logger[_0xe662('0x11')](_0xe662('0x16'),_0x26e680['message'],_0x46f035);_0x4e4244(_0x142f31['error'](0x1f4,_0x26e680[_0xe662('0x13')]));});});};exports['UpdateSquareReport']=function(_0x187009){var _0x51c639=this;return new Promise(function(_0x4da6ea,_0x5261c6){return db['SquareReport'][_0xe662('0x1a')](_0x187009[_0xe662('0x1b')],{'raw':_0x187009[_0xe662('0x19')]?_0x187009[_0xe662('0x19')][_0xe662('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x187009['options']?_0x187009[_0xe662('0x19')][_0xe662('0x1d')]||null:null,'attributes':_0x187009[_0xe662('0x19')]?_0x187009['options']['attributes']||null:null,'limit':_0x187009[_0xe662('0x19')]?_0x187009[_0xe662('0x19')][_0xe662('0x1e')]||null:null})[_0xe662('0xa')](function(_0x506012){logger['info'](_0xe662('0x1f'),_0x187009);logger['debug'](_0xe662('0x1f'),_0x187009,JSON[_0xe662('0x10')](_0x506012));_0x4da6ea(_0x506012);})[_0xe662('0x15')](function(_0x19812d){logger[_0xe662('0x11')]('UpdateSquareReport',_0x19812d['message'],_0x187009);_0x5261c6(_0x51c639['error'](0x1f4,_0x19812d[_0xe662('0x13')]));});});}; \ No newline at end of file +var _0x6dbb=['message','SquareReport','create','body','options','raw','CreateSquareReport','catch','UpdateSquareReport','update','where','attributes','limit','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','SquareReport,\x20%s,\x20%s','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','stringify','code','error'];(function(_0x2cdd34,_0xd136ee){var _0x47ed84=function(_0x326476){while(--_0x326476){_0x2cdd34['push'](_0x2cdd34['shift']());}};_0x47ed84(++_0xd136ee);}(_0x6dbb,0x11d));var _0xb6db=function(_0x20028f,_0x30820b){_0x20028f=_0x20028f-0x0;var _0x241393=_0x6dbb[_0x20028f];return _0x241393;};'use strict';var _=require(_0xb6db('0x0'));var util=require('util');var moment=require(_0xb6db('0x1'));var BPromise=require('bluebird');var rs=require(_0xb6db('0x2'));var fs=require('fs');var Redis=require(_0xb6db('0x3'));var db=require(_0xb6db('0x4'))['db'];var utils=require(_0xb6db('0x5'));var logger=require(_0xb6db('0x6'))(_0xb6db('0x7'));var config=require(_0xb6db('0x8'));var jayson=require(_0xb6db('0x9'));var client=jayson['client'][_0xb6db('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x253d07,_0x3b9bcb,_0x303cd5){return new BPromise(function(_0x53dbc2,_0x1de1f6){return client[_0xb6db('0xb')](_0x253d07,_0x303cd5)[_0xb6db('0xc')](function(_0x1a8d42){logger[_0xb6db('0xd')](_0xb6db('0xe'),_0x3b9bcb,_0xb6db('0xf'));logger[_0xb6db('0x10')](_0xb6db('0x11'),_0x3b9bcb,_0xb6db('0xf'),JSON[_0xb6db('0x12')](_0x1a8d42));if(_0x1a8d42['error']){if(_0x1a8d42['error'][_0xb6db('0x13')]===0x1f4){logger['error']('SquareReport,\x20%s,\x20%s',_0x3b9bcb,_0x1a8d42[_0xb6db('0x14')][_0xb6db('0x15')]);return _0x1de1f6(_0x1a8d42[_0xb6db('0x14')][_0xb6db('0x15')]);}logger['error'](_0xb6db('0xe'),_0x3b9bcb,_0x1a8d42[_0xb6db('0x14')][_0xb6db('0x15')]);return _0x53dbc2(_0x1a8d42['error'][_0xb6db('0x15')]);}else{logger['info']('SquareReport,\x20%s,\x20%s',_0x3b9bcb,_0xb6db('0xf'));_0x53dbc2(_0x1a8d42['result'][_0xb6db('0x15')]);}})['catch'](function(_0x4d6fee){logger[_0xb6db('0x14')](_0xb6db('0xe'),_0x3b9bcb,_0x4d6fee);_0x1de1f6(_0x4d6fee);});});}exports['CreateSquareReport']=function(_0x266155){var _0x4034a0=this;return new Promise(function(_0x2b7ccd,_0x1e5816){return db[_0xb6db('0x16')][_0xb6db('0x17')](_0x266155[_0xb6db('0x18')],{'raw':_0x266155['options']?_0x266155[_0xb6db('0x19')][_0xb6db('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x40db25){logger['info'](_0xb6db('0x1b'),_0x266155);logger[_0xb6db('0x10')]('CreateSquareReport',_0x266155,JSON[_0xb6db('0x12')](_0x40db25));_0x2b7ccd(_0x40db25);})[_0xb6db('0x1c')](function(_0x521224){logger[_0xb6db('0x14')](_0xb6db('0x1b'),_0x521224[_0xb6db('0x15')],_0x266155);_0x1e5816(_0x4034a0[_0xb6db('0x14')](0x1f4,_0x521224[_0xb6db('0x15')]));});});};exports[_0xb6db('0x1d')]=function(_0x2f4024){var _0x306c08=this;return new Promise(function(_0x745442,_0x2c38b8){return db[_0xb6db('0x16')][_0xb6db('0x1e')](_0x2f4024[_0xb6db('0x18')],{'raw':_0x2f4024[_0xb6db('0x19')]?_0x2f4024[_0xb6db('0x19')][_0xb6db('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2f4024[_0xb6db('0x19')]?_0x2f4024[_0xb6db('0x19')][_0xb6db('0x1f')]||null:null,'attributes':_0x2f4024[_0xb6db('0x19')]?_0x2f4024[_0xb6db('0x19')][_0xb6db('0x20')]||null:null,'limit':_0x2f4024['options']?_0x2f4024[_0xb6db('0x19')][_0xb6db('0x21')]||null:null})[_0xb6db('0xc')](function(_0x27f4fb){logger[_0xb6db('0xd')]('UpdateSquareReport',_0x2f4024);logger[_0xb6db('0x10')](_0xb6db('0x1d'),_0x2f4024,JSON['stringify'](_0x27f4fb));_0x745442(_0x27f4fb);})['catch'](function(_0x3f1ff1){logger[_0xb6db('0x14')](_0xb6db('0x1d'),_0x3f1ff1[_0xb6db('0x15')],_0x2f4024);_0x2c38b8(_0x306c08[_0xb6db('0x14')](0x1f4,_0x3f1ff1[_0xb6db('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index a702c9d..c6570fb 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 _0x30a0=['/describe','describe','/:id','show','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','get','isAuthenticated','index'];(function(_0x27ec70,_0x2bc6a5){var _0xa5795a=function(_0x453f42){while(--_0x453f42){_0x27ec70['push'](_0x27ec70['shift']());}};_0xa5795a(++_0x2bc6a5);}(_0x30a0,0x17a));var _0x030a=function(_0x48b69a,_0x5ebd1e){_0x48b69a=_0x48b69a-0x0;var _0x426b3e=_0x30a0[_0x48b69a];return _0x426b3e;};'use strict';var multer=require(_0x030a('0x0'));var util=require(_0x030a('0x1'));var path=require(_0x030a('0x2'));var timeout=require(_0x030a('0x3'));var express=require(_0x030a('0x4'));var router=express[_0x030a('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x030a('0x6'));var interaction=require(_0x030a('0x7'));var config=require(_0x030a('0x8'));var controller=require(_0x030a('0x9'));router[_0x030a('0xa')]('/',auth[_0x030a('0xb')](),controller[_0x030a('0xc')]);router[_0x030a('0xa')](_0x030a('0xd'),auth['isAuthenticated'](),controller[_0x030a('0xe')]);router[_0x030a('0xa')](_0x030a('0xf'),auth[_0x030a('0xb')](),controller[_0x030a('0x10')]);router['post']('/',auth[_0x030a('0xb')](),controller[_0x030a('0x11')]);router[_0x030a('0x12')](_0x030a('0xf'),auth[_0x030a('0xb')](),controller[_0x030a('0x13')]);router[_0x030a('0x14')](_0x030a('0xf'),auth[_0x030a('0xb')](),controller[_0x030a('0x15')]);module[_0x030a('0x16')]=router; \ No newline at end of file +var _0xb959=['./squareReportDetail.controller','get','isAuthenticated','index','/describe','describe','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x5c4e5a,_0x268a10){var _0x165f20=function(_0x1d93d0){while(--_0x1d93d0){_0x5c4e5a['push'](_0x5c4e5a['shift']());}};_0x165f20(++_0x268a10);}(_0xb959,0xd3));var _0x9b95=function(_0x2d92ad,_0x1a58ce){_0x2d92ad=_0x2d92ad-0x0;var _0x1bf326=_0xb959[_0x2d92ad];return _0x1bf326;};'use strict';var multer=require(_0x9b95('0x0'));var util=require(_0x9b95('0x1'));var path=require(_0x9b95('0x2'));var timeout=require(_0x9b95('0x3'));var express=require(_0x9b95('0x4'));var router=express[_0x9b95('0x5')]();var fs_extra=require(_0x9b95('0x6'));var auth=require(_0x9b95('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x9b95('0x8'));var controller=require(_0x9b95('0x9'));router[_0x9b95('0xa')]('/',auth[_0x9b95('0xb')](),controller[_0x9b95('0xc')]);router['get'](_0x9b95('0xd'),auth['isAuthenticated'](),controller[_0x9b95('0xe')]);router[_0x9b95('0xa')]('/:id',auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x9b95('0xb')](),controller['create']);router[_0x9b95('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x9b95('0x10')]);router[_0x9b95('0x11')]('/:id',auth[_0x9b95('0xb')](),controller[_0x9b95('0x12')]);module[_0x9b95('0x13')]=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index c6c8a42..b96cd81 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 _0x6f09=['STRING','TEXT','sequelize'];(function(_0x4b33c5,_0x3bc025){var _0x326c51=function(_0x3367df){while(--_0x3367df){_0x4b33c5['push'](_0x4b33c5['shift']());}};_0x326c51(++_0x3bc025);}(_0x6f09,0x1ac));var _0x96f0=function(_0x50dde7,_0x385ea1){_0x50dde7=_0x50dde7-0x0;var _0x201b35=_0x6f09[_0x50dde7];return _0x201b35;};'use strict';var Sequelize=require(_0x96f0('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x96f0('0x1')]},'node':{'type':Sequelize[_0x96f0('0x1')]},'application':{'type':Sequelize['STRING']},'data':{'type':Sequelize[_0x96f0('0x2')]},'project_name':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x4612=['STRING','exports'];(function(_0x18775f,_0xf618d3){var _0x458153=function(_0x1f0fcc){while(--_0x1f0fcc){_0x18775f['push'](_0x18775f['shift']());}};_0x458153(++_0xf618d3);}(_0x4612,0x1ad));var _0x2461=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x4612[_0x2b4411];return _0x8e41ef;};'use strict';var Sequelize=require('sequelize');module[_0x2461('0x0')]={'uniqueid':{'type':Sequelize['STRING']},'node':{'type':Sequelize[_0x2461('0x1')]},'application':{'type':Sequelize[_0x2461('0x1')]},'data':{'type':Sequelize['TEXT']},'project_name':{'type':Sequelize[_0x2461('0x1')]},'callerid':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index 389dfbe..4db870a 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 _0x2cae=['create','body','describe','eml-format','rimraf','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','squel','jsforce','desk.js','to-csv','querystring','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','limit','count','set','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','map','SquareDetailsReport','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','VIRTUAL','options','includeAll','findAll','show','params','merge','find','catch'];(function(_0x44585b,_0x5c43fc){var _0x173bf9=function(_0x21787c){while(--_0x21787c){_0x44585b['push'](_0x44585b['shift']());}};_0x173bf9(++_0x5c43fc);}(_0x2cae,0x16b));var _0xe2ca=function(_0x5275b8,_0x51e5dd){_0x5275b8=_0x5275b8-0x0;var _0x568a9b=_0x2cae[_0x5275b8];return _0x568a9b;};'use strict';var emlformat=require(_0xe2ca('0x0'));var rimraf=require(_0xe2ca('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xe2ca('0x2'));var moment=require(_0xe2ca('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xe2ca('0x4'));var util=require(_0xe2ca('0x5'));var path=require(_0xe2ca('0x6'));var sox=require(_0xe2ca('0x7'));var csv=require('to-csv');var ejs=require(_0xe2ca('0x8'));var fs=require('fs');var fs_extra=require(_0xe2ca('0x9'));var _=require('lodash');var squel=require(_0xe2ca('0xa'));var crypto=require('crypto');var jsforce=require(_0xe2ca('0xb'));var deskjs=require(_0xe2ca('0xc'));var toCsv=require(_0xe2ca('0xd'));var querystring=require(_0xe2ca('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe2ca('0xf'));var hardwareService=require(_0xe2ca('0x10'));var logger=require(_0xe2ca('0x11'))(_0xe2ca('0x12'));var utils=require(_0xe2ca('0x13'));var config=require(_0xe2ca('0x14'));var licenseUtil=require(_0xe2ca('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1138ee,_0x2773cc){_0x2773cc=_0x2773cc||0xcc;return function(_0x199237){if(_0x199237){return _0x1138ee[_0xe2ca('0x16')](_0x2773cc);}return _0x1138ee[_0xe2ca('0x17')](_0x2773cc)['end']();};}function respondWithResult(_0x31f283,_0x3cfcc9){_0x3cfcc9=_0x3cfcc9||0xc8;return function(_0x27c3ad){if(_0x27c3ad){return _0x31f283[_0xe2ca('0x17')](_0x3cfcc9)[_0xe2ca('0x18')](_0x27c3ad);}};}function respondWithFilteredResult(_0x3a9612,_0x1c1514){return function(_0x29cdcf){if(_0x29cdcf){var _0x326340=typeof _0x1c1514[_0xe2ca('0x19')]==='undefined'&&typeof _0x1c1514[_0xe2ca('0x1a')]==='undefined';var _0x4ca8fd=_0x29cdcf[_0xe2ca('0x1b')];var _0x18cd42=_0x326340?0x0:_0x1c1514['offset'];var _0x393c23=_0x326340?_0x29cdcf[_0xe2ca('0x1b')]:_0x1c1514[_0xe2ca('0x19')]+_0x1c1514['limit'];var _0x4380fb;if(_0x393c23>=_0x4ca8fd){_0x393c23=_0x4ca8fd;_0x4380fb=0xc8;}else{_0x4380fb=0xce;}_0x3a9612[_0xe2ca('0x17')](_0x4380fb);return _0x3a9612[_0xe2ca('0x1c')]('Content-Range',_0x18cd42+'-'+_0x393c23+'/'+_0x4ca8fd)[_0xe2ca('0x18')](_0x29cdcf);}return null;};}function patchUpdates(_0x56b574){return function(_0x16f418){try{jsonpatch[_0xe2ca('0x1d')](_0x16f418,_0x56b574,!![]);}catch(_0x60d8e8){return BPromise[_0xe2ca('0x1e')](_0x60d8e8);}return _0x16f418[_0xe2ca('0x1f')]();};}function saveUpdates(_0x1b98d8,_0x50af69){return function(_0x1a1522){if(_0x1a1522){return _0x1a1522[_0xe2ca('0x20')](_0x1b98d8)[_0xe2ca('0x21')](function(_0x2ca129){return _0x2ca129;});}return null;};}function removeEntity(_0x18a6c6,_0x2772b5){return function(_0xa1fa2b){if(_0xa1fa2b){return _0xa1fa2b[_0xe2ca('0x22')]()[_0xe2ca('0x21')](function(){_0x18a6c6['status'](0xcc)[_0xe2ca('0x23')]();});}};}function handleEntityNotFound(_0x272bb3,_0x3f3d6e){return function(_0xc52f5e){if(!_0xc52f5e){_0x272bb3[_0xe2ca('0x16')](0x194);}return _0xc52f5e;};}function handleError(_0x4b2a2e,_0x524b6c){_0x524b6c=_0x524b6c||0x1f4;return function(_0x20ac37){logger[_0xe2ca('0x24')](_0x20ac37[_0xe2ca('0x25')]);if(_0x20ac37[_0xe2ca('0x26')]){delete _0x20ac37[_0xe2ca('0x26')];}_0x4b2a2e[_0xe2ca('0x17')](_0x524b6c)[_0xe2ca('0x27')](_0x20ac37);};}exports[_0xe2ca('0x28')]=function(_0x565e9b,_0x5df46f){var _0x333665={},_0x300d0e={},_0x43a0dd={'count':0x0,'rows':[]};var _0x44ae8a=_[_0xe2ca('0x29')](db[_0xe2ca('0x2a')][_0xe2ca('0x2b')],function(_0x2476fe){return{'name':_0x2476fe[_0xe2ca('0x2c')],'type':_0x2476fe[_0xe2ca('0x2d')][_0xe2ca('0x2e')]};});_0x300d0e[_0xe2ca('0x2f')]=_[_0xe2ca('0x29')](_0x44ae8a,_0xe2ca('0x26'));_0x300d0e['query']=_[_0xe2ca('0x30')](_0x565e9b[_0xe2ca('0x31')]);_0x300d0e[_0xe2ca('0x32')]=_[_0xe2ca('0x33')](_0x300d0e[_0xe2ca('0x2f')],_0x300d0e[_0xe2ca('0x31')]);_0x333665[_0xe2ca('0x34')]=_['intersection'](_0x300d0e['model'],qs['fields'](_0x565e9b[_0xe2ca('0x31')][_0xe2ca('0x35')]));_0x333665[_0xe2ca('0x34')]=_0x333665[_0xe2ca('0x34')][_0xe2ca('0x36')]?_0x333665['attributes']:_0x300d0e[_0xe2ca('0x2f')];if(!_0x565e9b[_0xe2ca('0x31')]['hasOwnProperty'](_0xe2ca('0x37'))){_0x333665[_0xe2ca('0x1a')]=qs[_0xe2ca('0x1a')](_0x565e9b['query'][_0xe2ca('0x1a')]);_0x333665[_0xe2ca('0x19')]=qs[_0xe2ca('0x19')](_0x565e9b['query'][_0xe2ca('0x19')]);}_0x333665['order']=qs[_0xe2ca('0x38')](_0x565e9b['query']['sort']);_0x333665[_0xe2ca('0x39')]=qs[_0xe2ca('0x32')](_[_0xe2ca('0x3a')](_0x565e9b['query'],_0x300d0e[_0xe2ca('0x32')]),_0x44ae8a);if(_0x565e9b[_0xe2ca('0x31')][_0xe2ca('0x3b')]){_0x333665[_0xe2ca('0x39')]=_['merge'](_0x333665['where'],{'$or':_[_0xe2ca('0x29')](_0x44ae8a,function(_0x18b58d){if(_0x18b58d['type']!==_0xe2ca('0x3c')){var _0x14aa19={};_0x14aa19[_0x18b58d['name']]={'$like':'%'+_0x565e9b['query']['filter']+'%'};return _0x14aa19;}})});}_0x333665=_['merge']({},_0x333665,_0x565e9b[_0xe2ca('0x3d')]);var _0x580ca9={'where':_0x333665[_0xe2ca('0x39')]};return db[_0xe2ca('0x2a')][_0xe2ca('0x1b')](_0x580ca9)['then'](function(_0x529417){_0x43a0dd[_0xe2ca('0x1b')]=_0x529417;if(_0x565e9b[_0xe2ca('0x31')][_0xe2ca('0x3e')]){_0x333665['include']=[{'all':!![]}];}return db[_0xe2ca('0x2a')][_0xe2ca('0x3f')](_0x333665);})[_0xe2ca('0x21')](function(_0x405e0c){_0x43a0dd['rows']=_0x405e0c;return _0x43a0dd;})['then'](respondWithFilteredResult(_0x5df46f,_0x333665))['catch'](handleError(_0x5df46f,null));};exports[_0xe2ca('0x40')]=function(_0xb5ac02,_0x3a776c){var _0x3fefb0={'raw':!![],'where':{'id':_0xb5ac02[_0xe2ca('0x41')]['id']}},_0x4ef600={};_0x4ef600[_0xe2ca('0x2f')]=_[_0xe2ca('0x30')](db['SquareDetailsReport'][_0xe2ca('0x2b')]);_0x4ef600[_0xe2ca('0x31')]=_[_0xe2ca('0x30')](_0xb5ac02[_0xe2ca('0x31')]);_0x4ef600[_0xe2ca('0x32')]=_[_0xe2ca('0x33')](_0x4ef600[_0xe2ca('0x2f')],_0x4ef600[_0xe2ca('0x31')]);_0x3fefb0[_0xe2ca('0x34')]=_[_0xe2ca('0x33')](_0x4ef600[_0xe2ca('0x2f')],qs[_0xe2ca('0x35')](_0xb5ac02['query'][_0xe2ca('0x35')]));_0x3fefb0[_0xe2ca('0x34')]=_0x3fefb0[_0xe2ca('0x34')][_0xe2ca('0x36')]?_0x3fefb0['attributes']:_0x4ef600[_0xe2ca('0x2f')];if(_0xb5ac02[_0xe2ca('0x31')][_0xe2ca('0x3e')]){_0x3fefb0['include']=[{'all':!![]}];}_0x3fefb0=_[_0xe2ca('0x42')]({},_0x3fefb0,_0xb5ac02[_0xe2ca('0x3d')]);return db[_0xe2ca('0x2a')][_0xe2ca('0x43')](_0x3fefb0)[_0xe2ca('0x21')](handleEntityNotFound(_0x3a776c,null))[_0xe2ca('0x21')](respondWithResult(_0x3a776c,null))[_0xe2ca('0x44')](handleError(_0x3a776c,null));};exports['create']=function(_0x290b90,_0x203a6f){return db[_0xe2ca('0x2a')][_0xe2ca('0x45')](_0x290b90[_0xe2ca('0x46')],{})['then'](respondWithResult(_0x203a6f,0xc9))[_0xe2ca('0x44')](handleError(_0x203a6f,null));};exports['update']=function(_0x16f99d,_0x24f195){if(_0x16f99d[_0xe2ca('0x46')]['id']){delete _0x16f99d[_0xe2ca('0x46')]['id'];}return db[_0xe2ca('0x2a')][_0xe2ca('0x43')]({'where':{'id':_0x16f99d[_0xe2ca('0x41')]['id']}})[_0xe2ca('0x21')](handleEntityNotFound(_0x24f195,null))[_0xe2ca('0x21')](saveUpdates(_0x16f99d[_0xe2ca('0x46')],null))[_0xe2ca('0x21')](respondWithResult(_0x24f195,null))[_0xe2ca('0x44')](handleError(_0x24f195,null));};exports[_0xe2ca('0x22')]=function(_0x598e25,_0x312dad){return db[_0xe2ca('0x2a')]['find']({'where':{'id':_0x598e25['params']['id']}})[_0xe2ca('0x21')](handleEntityNotFound(_0x312dad,null))[_0xe2ca('0x21')](removeEntity(_0x312dad,null))[_0xe2ca('0x44')](handleError(_0x312dad,null));};exports['describe']=function(_0x15bf8a,_0x32cc82){return db[_0xe2ca('0x2a')][_0xe2ca('0x47')]()['then'](respondWithResult(_0x32cc82,null))[_0xe2ca('0x44')](handleError(_0x32cc82,null));}; \ No newline at end of file +var _0x65c8=['type','VIRTUAL','options','SquareDetailsReport','includeAll','include','rows','show','find','create','body','catch','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','map','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge'];(function(_0x386cd0,_0xd35ee3){var _0x41135f=function(_0x2afef6){while(--_0x2afef6){_0x386cd0['push'](_0x386cd0['shift']());}};_0x41135f(++_0xd35ee3);}(_0x65c8,0xef));var _0x865c=function(_0x4a6d48,_0x5f4687){_0x4a6d48=_0x4a6d48-0x0;var _0x537824=_0x65c8[_0x4a6d48];return _0x537824;};'use strict';var emlformat=require(_0x865c('0x0'));var rimraf=require(_0x865c('0x1'));var zipdir=require(_0x865c('0x2'));var jsonpatch=require(_0x865c('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x865c('0x4'));var util=require(_0x865c('0x5'));var path=require(_0x865c('0x6'));var sox=require(_0x865c('0x7'));var csv=require(_0x865c('0x8'));var ejs=require(_0x865c('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x865c('0xa'));var squel=require(_0x865c('0xb'));var crypto=require('crypto');var jsforce=require(_0x865c('0xc'));var deskjs=require(_0x865c('0xd'));var toCsv=require(_0x865c('0x8'));var querystring=require(_0x865c('0xe'));var Papa=require(_0x865c('0xf'));var Redis=require(_0x865c('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x865c('0x11'));var as=require(_0x865c('0x12'));var hardwareService=require(_0x865c('0x13'));var logger=require(_0x865c('0x14'))('api');var utils=require(_0x865c('0x15'));var config=require(_0x865c('0x16'));var licenseUtil=require(_0x865c('0x17'));var db=require(_0x865c('0x18'))['db'];function respondWithStatusCode(_0x3dc709,_0x175eb7){_0x175eb7=_0x175eb7||0xcc;return function(_0x5a1645){if(_0x5a1645){return _0x3dc709['sendStatus'](_0x175eb7);}return _0x3dc709['status'](_0x175eb7)[_0x865c('0x19')]();};}function respondWithResult(_0x5b81af,_0x5599a5){_0x5599a5=_0x5599a5||0xc8;return function(_0x187946){if(_0x187946){return _0x5b81af[_0x865c('0x1a')](_0x5599a5)[_0x865c('0x1b')](_0x187946);}};}function respondWithFilteredResult(_0x122182,_0x1d52d1){return function(_0x3cfd90){if(_0x3cfd90){var _0x589c98=typeof _0x1d52d1[_0x865c('0x1c')]===_0x865c('0x1d')&&typeof _0x1d52d1[_0x865c('0x1e')]===_0x865c('0x1d');var _0xcf1e50=_0x3cfd90['count'];var _0xa88a77=_0x589c98?0x0:_0x1d52d1['offset'];var _0x46bbf2=_0x589c98?_0x3cfd90[_0x865c('0x1f')]:_0x1d52d1[_0x865c('0x1c')]+_0x1d52d1[_0x865c('0x1e')];var _0x449f5f;if(_0x46bbf2>=_0xcf1e50){_0x46bbf2=_0xcf1e50;_0x449f5f=0xc8;}else{_0x449f5f=0xce;}_0x122182['status'](_0x449f5f);return _0x122182[_0x865c('0x20')](_0x865c('0x21'),_0xa88a77+'-'+_0x46bbf2+'/'+_0xcf1e50)[_0x865c('0x1b')](_0x3cfd90);}return null;};}function patchUpdates(_0x232094){return function(_0x2cd706){try{jsonpatch[_0x865c('0x22')](_0x2cd706,_0x232094,!![]);}catch(_0x1bd569){return BPromise[_0x865c('0x23')](_0x1bd569);}return _0x2cd706[_0x865c('0x24')]();};}function saveUpdates(_0x7eea05,_0x3bed8f){return function(_0x134ec0){if(_0x134ec0){return _0x134ec0[_0x865c('0x25')](_0x7eea05)[_0x865c('0x26')](function(_0x247f3b){return _0x247f3b;});}return null;};}function removeEntity(_0x38520d,_0x42d171){return function(_0x1711d8){if(_0x1711d8){return _0x1711d8[_0x865c('0x27')]()['then'](function(){_0x38520d[_0x865c('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1e6e64,_0x47e809){return function(_0xe1809b){if(!_0xe1809b){_0x1e6e64['sendStatus'](0x194);}return _0xe1809b;};}function handleError(_0x4cea25,_0x5727b0){_0x5727b0=_0x5727b0||0x1f4;return function(_0xa573ca){logger[_0x865c('0x28')](_0xa573ca['stack']);if(_0xa573ca[_0x865c('0x29')]){delete _0xa573ca[_0x865c('0x29')];}_0x4cea25[_0x865c('0x1a')](_0x5727b0)[_0x865c('0x2a')](_0xa573ca);};}exports['index']=function(_0x5af577,_0x55c763){var _0x5baa36={},_0x19e61a={},_0x274029={'count':0x0,'rows':[]};var _0x5add24=_[_0x865c('0x2b')](db['SquareDetailsReport']['rawAttributes'],function(_0x2ef49b){return{'name':_0x2ef49b[_0x865c('0x2c')],'type':_0x2ef49b['type'][_0x865c('0x2d')]};});_0x19e61a[_0x865c('0x2e')]=_[_0x865c('0x2b')](_0x5add24,_0x865c('0x29'));_0x19e61a[_0x865c('0x2f')]=_[_0x865c('0x30')](_0x5af577[_0x865c('0x2f')]);_0x19e61a[_0x865c('0x31')]=_[_0x865c('0x32')](_0x19e61a[_0x865c('0x2e')],_0x19e61a['query']);_0x5baa36['attributes']=_[_0x865c('0x32')](_0x19e61a[_0x865c('0x2e')],qs[_0x865c('0x33')](_0x5af577[_0x865c('0x2f')][_0x865c('0x33')]));_0x5baa36[_0x865c('0x34')]=_0x5baa36[_0x865c('0x34')][_0x865c('0x35')]?_0x5baa36[_0x865c('0x34')]:_0x19e61a[_0x865c('0x2e')];if(!_0x5af577[_0x865c('0x2f')][_0x865c('0x36')](_0x865c('0x37'))){_0x5baa36[_0x865c('0x1e')]=qs[_0x865c('0x1e')](_0x5af577[_0x865c('0x2f')][_0x865c('0x1e')]);_0x5baa36[_0x865c('0x1c')]=qs[_0x865c('0x1c')](_0x5af577[_0x865c('0x2f')][_0x865c('0x1c')]);}_0x5baa36[_0x865c('0x38')]=qs[_0x865c('0x39')](_0x5af577[_0x865c('0x2f')][_0x865c('0x39')]);_0x5baa36[_0x865c('0x3a')]=qs[_0x865c('0x31')](_['pick'](_0x5af577[_0x865c('0x2f')],_0x19e61a[_0x865c('0x31')]),_0x5add24);if(_0x5af577[_0x865c('0x2f')][_0x865c('0x3b')]){_0x5baa36[_0x865c('0x3a')]=_[_0x865c('0x3c')](_0x5baa36['where'],{'$or':_[_0x865c('0x2b')](_0x5add24,function(_0x5b26b9){if(_0x5b26b9[_0x865c('0x3d')]!==_0x865c('0x3e')){var _0xedfcd={};_0xedfcd[_0x5b26b9[_0x865c('0x29')]]={'$like':'%'+_0x5af577['query']['filter']+'%'};return _0xedfcd;}})});}_0x5baa36=_[_0x865c('0x3c')]({},_0x5baa36,_0x5af577[_0x865c('0x3f')]);var _0x258300={'where':_0x5baa36[_0x865c('0x3a')]};return db[_0x865c('0x40')][_0x865c('0x1f')](_0x258300)[_0x865c('0x26')](function(_0x1d1588){_0x274029['count']=_0x1d1588;if(_0x5af577['query'][_0x865c('0x41')]){_0x5baa36[_0x865c('0x42')]=[{'all':!![]}];}return db[_0x865c('0x40')]['findAll'](_0x5baa36);})[_0x865c('0x26')](function(_0x7bc700){_0x274029[_0x865c('0x43')]=_0x7bc700;return _0x274029;})[_0x865c('0x26')](respondWithFilteredResult(_0x55c763,_0x5baa36))['catch'](handleError(_0x55c763,null));};exports[_0x865c('0x44')]=function(_0x2f69aa,_0x2c5b69){var _0x4c85fc={'raw':!![],'where':{'id':_0x2f69aa['params']['id']}},_0x53750b={};_0x53750b[_0x865c('0x2e')]=_[_0x865c('0x30')](db[_0x865c('0x40')]['rawAttributes']);_0x53750b['query']=_[_0x865c('0x30')](_0x2f69aa[_0x865c('0x2f')]);_0x53750b['filters']=_[_0x865c('0x32')](_0x53750b[_0x865c('0x2e')],_0x53750b['query']);_0x4c85fc[_0x865c('0x34')]=_[_0x865c('0x32')](_0x53750b['model'],qs[_0x865c('0x33')](_0x2f69aa['query'][_0x865c('0x33')]));_0x4c85fc[_0x865c('0x34')]=_0x4c85fc[_0x865c('0x34')]['length']?_0x4c85fc[_0x865c('0x34')]:_0x53750b['model'];if(_0x2f69aa[_0x865c('0x2f')]['includeAll']){_0x4c85fc[_0x865c('0x42')]=[{'all':!![]}];}_0x4c85fc=_[_0x865c('0x3c')]({},_0x4c85fc,_0x2f69aa[_0x865c('0x3f')]);return db['SquareDetailsReport'][_0x865c('0x45')](_0x4c85fc)[_0x865c('0x26')](handleEntityNotFound(_0x2c5b69,null))[_0x865c('0x26')](respondWithResult(_0x2c5b69,null))['catch'](handleError(_0x2c5b69,null));};exports[_0x865c('0x46')]=function(_0x392e77,_0x59a321){return db[_0x865c('0x40')]['create'](_0x392e77[_0x865c('0x47')],{})[_0x865c('0x26')](respondWithResult(_0x59a321,0xc9))[_0x865c('0x48')](handleError(_0x59a321,null));};exports[_0x865c('0x25')]=function(_0x301799,_0x3a34da){if(_0x301799[_0x865c('0x47')]['id']){delete _0x301799[_0x865c('0x47')]['id'];}return db[_0x865c('0x40')]['find']({'where':{'id':_0x301799[_0x865c('0x49')]['id']}})['then'](handleEntityNotFound(_0x3a34da,null))[_0x865c('0x26')](saveUpdates(_0x301799['body'],null))[_0x865c('0x26')](respondWithResult(_0x3a34da,null))['catch'](handleError(_0x3a34da,null));};exports[_0x865c('0x27')]=function(_0x3b04a2,_0x564b8f){return db[_0x865c('0x40')][_0x865c('0x45')]({'where':{'id':_0x3b04a2[_0x865c('0x49')]['id']}})['then'](handleEntityNotFound(_0x564b8f,null))[_0x865c('0x26')](removeEntity(_0x564b8f,null))[_0x865c('0x48')](handleError(_0x564b8f,null));};exports[_0x865c('0x4a')]=function(_0x1a9ca8,_0x574b49){return db['SquareDetailsReport']['describe']()[_0x865c('0x26')](respondWithResult(_0x574b49,null))[_0x865c('0x48')](handleError(_0x574b49,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index 976a385..35a13e9 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 _0x33d2=['lodash','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./squareReportDetail.attributes','exports','define','SquareDetailsReport','report_square_details'];(function(_0x1b2cd4,_0x220d18){var _0x3e2ff5=function(_0x5ef59c){while(--_0x5ef59c){_0x1b2cd4['push'](_0x1b2cd4['shift']());}};_0x3e2ff5(++_0x220d18);}(_0x33d2,0x168));var _0x233d=function(_0xbc256d,_0x2a5cc6){_0xbc256d=_0xbc256d-0x0;var _0x3d74c9=_0x33d2[_0xbc256d];return _0x3d74c9;};'use strict';var _=require(_0x233d('0x0'));var util=require(_0x233d('0x1'));var logger=require(_0x233d('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x233d('0x3'));var fs=require('fs');var path=require(_0x233d('0x4'));var rimraf=require(_0x233d('0x5'));var config=require(_0x233d('0x6'));var attributes=require(_0x233d('0x7'));module[_0x233d('0x8')]=function(_0x5f3e93,_0x5946df){return _0x5f3e93[_0x233d('0x9')](_0x233d('0xa'),attributes,{'tableName':_0x233d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x69c6=['./squareReportDetail.attributes','exports','define','SquareDetailsReport','report_square_details','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x3a0ebd,_0x47f368){var _0x51a660=function(_0x4023e6){while(--_0x4023e6){_0x3a0ebd['push'](_0x3a0ebd['shift']());}};_0x51a660(++_0x47f368);}(_0x69c6,0xf3));var _0x669c=function(_0x50fc6b,_0x493a12){_0x50fc6b=_0x50fc6b-0x0;var _0x1a3f61=_0x69c6[_0x50fc6b];return _0x1a3f61;};'use strict';var _=require(_0x669c('0x0'));var util=require(_0x669c('0x1'));var logger=require(_0x669c('0x2'))(_0x669c('0x3'));var moment=require(_0x669c('0x4'));var BPromise=require(_0x669c('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x669c('0x6'));var rimraf=require(_0x669c('0x7'));var config=require(_0x669c('0x8'));var attributes=require(_0x669c('0x9'));module[_0x669c('0xa')]=function(_0x123e8b,_0x4701d4){return _0x123e8b[_0x669c('0xb')](_0x669c('0xc'),attributes,{'tableName':_0x669c('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.rpc.js b/server/api/squareReportDetail/squareReportDetail.rpc.js index 8305935..23a9287 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 _0x3de3=['../../config/logger','../../config/environment','jayson/promise','http','request','then','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','CreateSquareDetailsReport','create','options','raw','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x442d76,_0xda8124){var _0x4e144b=function(_0x1e0002){while(--_0x1e0002){_0x442d76['push'](_0x442d76['shift']());}};_0x4e144b(++_0xda8124);}(_0x3de3,0x1ce));var _0x33de=function(_0x1fb041,_0x36958d){_0x1fb041=_0x1fb041-0x0;var _0x578c3f=_0x3de3[_0x1fb041];return _0x578c3f;};'use strict';var _=require(_0x33de('0x0'));var util=require('util');var moment=require(_0x33de('0x1'));var BPromise=require(_0x33de('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x33de('0x3'));var db=require(_0x33de('0x4'))['db'];var utils=require(_0x33de('0x5'));var logger=require(_0x33de('0x6'))('rpc');var config=require(_0x33de('0x7'));var jayson=require(_0x33de('0x8'));var client=jayson['client'][_0x33de('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x587be8,_0x13afea,_0x35ee93){return new BPromise(function(_0x7ceca6,_0x486ab6){return client[_0x33de('0xa')](_0x587be8,_0x35ee93)[_0x33de('0xb')](function(_0x2e0419){logger['info'](_0x33de('0xc'),_0x13afea,_0x33de('0xd'));logger[_0x33de('0xe')](_0x33de('0xf'),_0x13afea,_0x33de('0xd'),JSON[_0x33de('0x10')](_0x2e0419));if(_0x2e0419[_0x33de('0x11')]){if(_0x2e0419[_0x33de('0x11')][_0x33de('0x12')]===0x1f4){logger[_0x33de('0x11')](_0x33de('0xc'),_0x13afea,_0x2e0419['error'][_0x33de('0x13')]);return _0x486ab6(_0x2e0419[_0x33de('0x11')]['message']);}logger['error'](_0x33de('0xc'),_0x13afea,_0x2e0419[_0x33de('0x11')][_0x33de('0x13')]);return _0x7ceca6(_0x2e0419[_0x33de('0x11')]['message']);}else{logger[_0x33de('0x14')](_0x33de('0xc'),_0x13afea,'request\x20sent');_0x7ceca6(_0x2e0419['result'][_0x33de('0x13')]);}})[_0x33de('0x15')](function(_0x13e832){logger['error'](_0x33de('0xc'),_0x13afea,_0x13e832);_0x486ab6(_0x13e832);});});}exports[_0x33de('0x16')]=function(_0x52cfa0){var _0x2815a7=this;return new Promise(function(_0x201ff3,_0x482667){return db['SquareDetailsReport'][_0x33de('0x17')](_0x52cfa0['body'],{'raw':_0x52cfa0[_0x33de('0x18')]?_0x52cfa0[_0x33de('0x18')][_0x33de('0x19')]===undefined?!![]:![]:!![]})[_0x33de('0xb')](function(_0xc4f1a4){logger[_0x33de('0x14')](_0x33de('0x16'),_0x52cfa0);logger['debug']('CreateSquareDetailsReport',_0x52cfa0,JSON[_0x33de('0x10')](_0xc4f1a4));_0x201ff3(_0xc4f1a4);})['catch'](function(_0x8acd8d){logger['error'](_0x33de('0x16'),_0x8acd8d[_0x33de('0x13')],_0x52cfa0);_0x482667(_0x2815a7['error'](0x1f4,_0x8acd8d[_0x33de('0x13')]));});});}; \ No newline at end of file +var _0x15b8=['options','raw','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateSquareDetailsReport','SquareDetailsReport','create'];(function(_0x262102,_0x2947d4){var _0x2e5416=function(_0x1f87ef){while(--_0x1f87ef){_0x262102['push'](_0x262102['shift']());}};_0x2e5416(++_0x2947d4);}(_0x15b8,0xcd));var _0x815b=function(_0x1d9aa0,_0x272488){_0x1d9aa0=_0x1d9aa0-0x0;var _0x226868=_0x15b8[_0x1d9aa0];return _0x226868;};'use strict';var _=require('lodash');var util=require(_0x815b('0x0'));var moment=require(_0x815b('0x1'));var BPromise=require(_0x815b('0x2'));var rs=require(_0x815b('0x3'));var fs=require('fs');var Redis=require(_0x815b('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x815b('0x5'));var logger=require(_0x815b('0x6'))(_0x815b('0x7'));var config=require(_0x815b('0x8'));var jayson=require(_0x815b('0x9'));var client=jayson[_0x815b('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1e9fc0,_0xdfdf6,_0x26119a){return new BPromise(function(_0x175053,_0x2170c5){return client[_0x815b('0xb')](_0x1e9fc0,_0x26119a)[_0x815b('0xc')](function(_0x221ce4){logger[_0x815b('0xd')](_0x815b('0xe'),_0xdfdf6,_0x815b('0xf'));logger[_0x815b('0x10')](_0x815b('0x11'),_0xdfdf6,_0x815b('0xf'),JSON[_0x815b('0x12')](_0x221ce4));if(_0x221ce4[_0x815b('0x13')]){if(_0x221ce4[_0x815b('0x13')][_0x815b('0x14')]===0x1f4){logger['error']('SquareDetailsReport,\x20%s,\x20%s',_0xdfdf6,_0x221ce4[_0x815b('0x13')][_0x815b('0x15')]);return _0x2170c5(_0x221ce4['error']['message']);}logger['error'](_0x815b('0xe'),_0xdfdf6,_0x221ce4['error']['message']);return _0x175053(_0x221ce4[_0x815b('0x13')][_0x815b('0x15')]);}else{logger[_0x815b('0xd')]('SquareDetailsReport,\x20%s,\x20%s',_0xdfdf6,'request\x20sent');_0x175053(_0x221ce4[_0x815b('0x16')][_0x815b('0x15')]);}})[_0x815b('0x17')](function(_0x4078db){logger[_0x815b('0x13')](_0x815b('0xe'),_0xdfdf6,_0x4078db);_0x2170c5(_0x4078db);});});}exports[_0x815b('0x18')]=function(_0x92d86a){var _0x26a8a3=this;return new Promise(function(_0x2fa2bd,_0x2ade43){return db[_0x815b('0x19')][_0x815b('0x1a')](_0x92d86a['body'],{'raw':_0x92d86a[_0x815b('0x1b')]?_0x92d86a[_0x815b('0x1b')][_0x815b('0x1c')]===undefined?!![]:![]:!![]})[_0x815b('0xc')](function(_0x3f710c){logger['info'](_0x815b('0x18'),_0x92d86a);logger[_0x815b('0x10')](_0x815b('0x18'),_0x92d86a,JSON['stringify'](_0x3f710c));_0x2fa2bd(_0x3f710c);})['catch'](function(_0x3ffdb7){logger[_0x815b('0x13')](_0x815b('0x18'),_0x3ffdb7[_0x815b('0x15')],_0x92d86a);_0x2ade43(_0x26a8a3[_0x815b('0x13')](0x1f4,_0x3ffdb7[_0x815b('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index 1ca7a24..06b786f 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 _0xcc22=['express','Router','../../components/auth/service','get','isAuthenticated','index','exports'];(function(_0x2bb6c4,_0x1fa3e5){var _0x2a8f8d=function(_0x34df6e){while(--_0x34df6e){_0x2bb6c4['push'](_0x2bb6c4['shift']());}};_0x2a8f8d(++_0x1fa3e5);}(_0xcc22,0xbd));var _0x2cc2=function(_0x3078b2,_0x1c363c){_0x3078b2=_0x3078b2-0x0;var _0x1bbeb1=_0xcc22[_0x3078b2];return _0x1bbeb1;};'use strict';var express=require(_0x2cc2('0x0'));var router=express[_0x2cc2('0x1')]();var auth=require(_0x2cc2('0x2'));var controller=require('./system.controller');router[_0x2cc2('0x3')]('/',auth[_0x2cc2('0x4')](),controller[_0x2cc2('0x5')]);router[_0x2cc2('0x3')]('/process/:pid/kill',auth[_0x2cc2('0x4')](),controller['killProcess']);module[_0x2cc2('0x6')]=router; \ No newline at end of file +var _0xa0d8=['exports','Router','./system.controller','get','isAuthenticated','index','/process/:pid/kill','killProcess'];(function(_0x38baea,_0x1bec83){var _0x20cde5=function(_0x7116c3){while(--_0x7116c3){_0x38baea['push'](_0x38baea['shift']());}};_0x20cde5(++_0x1bec83);}(_0xa0d8,0x161));var _0x8a0d=function(_0xe841d7,_0x1ac997){_0xe841d7=_0xe841d7-0x0;var _0xbce405=_0xa0d8[_0xe841d7];return _0xbce405;};'use strict';var express=require('express');var router=express[_0x8a0d('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x8a0d('0x1'));router[_0x8a0d('0x2')]('/',auth[_0x8a0d('0x3')](),controller[_0x8a0d('0x4')]);router[_0x8a0d('0x2')](_0x8a0d('0x5'),auth[_0x8a0d('0x3')](),controller[_0x8a0d('0x6')]);module[_0x8a0d('0x7')]=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index c9a1fc8..1a81a05 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 _0x3730=['exec','../../config/logger','api','bluebird','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','status','send','index','getAllData','then','json','catch','components/import/cm','format','params','split','length','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','kill','pid','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','killProcess','child_process'];(function(_0x56482c,_0x16118d){var _0x5aae7a=function(_0x52512f){while(--_0x52512f){_0x56482c['push'](_0x56482c['shift']());}};_0x5aae7a(++_0x16118d);}(_0x3730,0x1b2));var _0x0373=function(_0xd19bfb,_0x50533c){_0xd19bfb=_0xd19bfb-0x0;var _0x10208b=_0x3730[_0xd19bfb];return _0x10208b;};'use strict';var info=require('systeminformation');var exec=require(_0x0373('0x0'))[_0x0373('0x1')];var logger=require(_0x0373('0x2'))(_0x0373('0x3'));var util=require('util');var BPromise=require(_0x0373('0x4'));var _=require(_0x0373('0x5'));function handleError(_0x42cd5c,_0x58a503,_0x18aa58){_0x58a503=_0x58a503||0x1f4;return function(_0xde1bc2){logger[_0x0373('0x6')](_0x0373('0x7'),_0x18aa58,_0x58a503,util[_0x0373('0x8')](_0xde1bc2,{'showHidden':![],'depth':null}));delete _0xde1bc2[_0x0373('0x9')];_0x42cd5c[_0x0373('0xa')](_0x58a503)[_0x0373('0xb')](_0xde1bc2);};}exports[_0x0373('0xc')]=function(_0x5113a9,_0x434c46){return info[_0x0373('0xd')]()[_0x0373('0xe')](function(_0x4d8f33){return _0x434c46[_0x0373('0xa')](0xc8)[_0x0373('0xf')](_0x4d8f33);})[_0x0373('0x10')](function(_0x3babdb){return _0x434c46[_0x0373('0xa')](0x1f4)[_0x0373('0xf')](_0x3babdb);});};exports['killProcess']=function(_0x53ce2f,_0x2df71a){var _0xf4463b=[_0x0373('0x11')];return new BPromise(function(_0x3e7c4b,_0x14a21f){return exec(util[_0x0373('0x12')]('ps\x20-p\x20%s\x20-ww\x20-o\x20args',_0x53ce2f[_0x0373('0x13')]['pid']),function(_0x39afe1,_0x41e707,_0x5962f3){if(_0x39afe1){return _0x14a21f(_0x39afe1);}return _0x3e7c4b(_0x41e707);});})[_0x0373('0xe')](function(_0x134150){var _0x4f40d1=![];var _0x403dbf=_0x134150[_0x0373('0x14')](/\n/);for(var _0x2bb51d=0x0,_0x354a75=_0xf4463b[_0x0373('0x15')];_0x2bb51d<_0x354a75,_0x4f40d1===![];_0x2bb51d+=0x1){if(_0x134150[_0x0373('0x16')](_0xf4463b[_0x2bb51d])>=0x0){_0x4f40d1=!![];}}if(!_0x4f40d1){throw new Error(util[_0x0373('0x12')](_0x0373('0x17'),_0x53ce2f['params']['pid']));}process[_0x0373('0x18')](_0x53ce2f['params'][_0x0373('0x19')],_0x0373('0x1a'));return _0x2df71a[_0x0373('0xa')](0xc8)['json']({'message':util['format'](_0x0373('0x1b'),_0x53ce2f[_0x0373('0x13')]['pid'])});})[_0x0373('0x10')](handleError(_0x2df71a,null,_0x0373('0x1c')));}; \ No newline at end of file +var _0x350a=['name','status','send','index','getAllData','then','json','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','split','length','Process\x20with\x20pid\x20%s\x20not\x20found!','kill','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','catch','killProcess','systeminformation','child_process','api','util','bluebird','error'];(function(_0x55daf2,_0x1b48de){var _0x1c8500=function(_0x4686b5){while(--_0x4686b5){_0x55daf2['push'](_0x55daf2['shift']());}};_0x1c8500(++_0x1b48de);}(_0x350a,0x132));var _0xa350=function(_0x34232c,_0x18e61d){_0x34232c=_0x34232c-0x0;var _0x4d4f4e=_0x350a[_0x34232c];return _0x4d4f4e;};'use strict';var info=require(_0xa350('0x0'));var exec=require(_0xa350('0x1'))['exec'];var logger=require('../../config/logger')(_0xa350('0x2'));var util=require(_0xa350('0x3'));var BPromise=require(_0xa350('0x4'));var _=require('lodash');function handleError(_0x2bca04,_0x5f294e,_0x15a91b){_0x5f294e=_0x5f294e||0x1f4;return function(_0x56cc33){logger[_0xa350('0x5')]('<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s',_0x15a91b,_0x5f294e,util['inspect'](_0x56cc33,{'showHidden':![],'depth':null}));delete _0x56cc33[_0xa350('0x6')];_0x2bca04[_0xa350('0x7')](_0x5f294e)[_0xa350('0x8')](_0x56cc33);};}exports[_0xa350('0x9')]=function(_0x4cbaa5,_0x304999){return info[_0xa350('0xa')]()[_0xa350('0xb')](function(_0x57f980){return _0x304999[_0xa350('0x7')](0xc8)['json'](_0x57f980);})['catch'](function(_0x323a1b){return _0x304999[_0xa350('0x7')](0x1f4)[_0xa350('0xc')](_0x323a1b);});};exports['killProcess']=function(_0x4229a1,_0x10cfe5){var _0x1abe6b=[_0xa350('0xd')];return new BPromise(function(_0x34a1dd,_0x57939d){return exec(util[_0xa350('0xe')](_0xa350('0xf'),_0x4229a1[_0xa350('0x10')][_0xa350('0x11')]),function(_0x54ee2b,_0x1952eb,_0x423fbf){if(_0x54ee2b){return _0x57939d(_0x54ee2b);}return _0x34a1dd(_0x1952eb);});})['then'](function(_0x4a88f9){var _0x4482c3=![];var _0x57e43e=_0x4a88f9[_0xa350('0x12')](/\n/);for(var _0x44b7c6=0x0,_0x1cebd8=_0x1abe6b[_0xa350('0x13')];_0x44b7c6<_0x1cebd8,_0x4482c3===![];_0x44b7c6+=0x1){if(_0x4a88f9['indexOf'](_0x1abe6b[_0x44b7c6])>=0x0){_0x4482c3=!![];}}if(!_0x4482c3){throw new Error(util[_0xa350('0xe')](_0xa350('0x14'),_0x4229a1[_0xa350('0x10')][_0xa350('0x11')]));}process[_0xa350('0x15')](_0x4229a1['params'][_0xa350('0x11')],_0xa350('0x16'));return _0x10cfe5[_0xa350('0x7')](0xc8)[_0xa350('0xc')]({'message':util['format'](_0xa350('0x17'),_0x4229a1[_0xa350('0x10')]['pid'])});})[_0xa350('0x18')](handleError(_0x10cfe5,null,_0xa350('0x19')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index 4e4b106..a4a020b 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 _0xeeeb=['./tag.controller','get','isAuthenticated','/:id','show','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x529b35,_0xadab0f){var _0x15b399=function(_0x41b720){while(--_0x41b720){_0x529b35['push'](_0x529b35['shift']());}};_0x15b399(++_0xadab0f);}(_0xeeeb,0x1d9));var _0xbeee=function(_0x24ce37,_0x3ea2c5){_0x24ce37=_0x24ce37-0x0;var _0x4a6c0c=_0xeeeb[_0x24ce37];return _0x4a6c0c;};'use strict';var multer=require(_0xbeee('0x0'));var util=require(_0xbeee('0x1'));var path=require(_0xbeee('0x2'));var timeout=require(_0xbeee('0x3'));var express=require(_0xbeee('0x4'));var router=express[_0xbeee('0x5')]();var fs_extra=require(_0xbeee('0x6'));var auth=require(_0xbeee('0x7'));var interaction=require(_0xbeee('0x8'));var config=require(_0xbeee('0x9'));var controller=require(_0xbeee('0xa'));router[_0xbeee('0xb')]('/',auth[_0xbeee('0xc')](),controller['index']);router['get'](_0xbeee('0xd'),auth[_0xbeee('0xc')](),controller[_0xbeee('0xe')]);router[_0xbeee('0xf')]('/',auth[_0xbeee('0xc')](),controller['create']);router[_0xbeee('0x10')](_0xbeee('0xd'),auth[_0xbeee('0xc')](),controller[_0xbeee('0x11')]);router[_0xbeee('0x12')](_0xbeee('0xd'),auth[_0xbeee('0xc')](),controller[_0xbeee('0x13')]);module[_0xbeee('0x14')]=router; \ No newline at end of file +var _0x8e79=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express'];(function(_0x1fd324,_0x11e063){var _0x63450d=function(_0x3d6bd5){while(--_0x3d6bd5){_0x1fd324['push'](_0x1fd324['shift']());}};_0x63450d(++_0x11e063);}(_0x8e79,0x150));var _0x98e7=function(_0x2dddcf,_0x4c7274){_0x2dddcf=_0x2dddcf-0x0;var _0x557012=_0x8e79[_0x2dddcf];return _0x557012;};'use strict';var multer=require(_0x98e7('0x0'));var util=require('util');var path=require(_0x98e7('0x1'));var timeout=require(_0x98e7('0x2'));var express=require(_0x98e7('0x3'));var router=express[_0x98e7('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x98e7('0x5'));var interaction=require(_0x98e7('0x6'));var config=require(_0x98e7('0x7'));var controller=require('./tag.controller');router[_0x98e7('0x8')]('/',auth[_0x98e7('0x9')](),controller[_0x98e7('0xa')]);router[_0x98e7('0x8')](_0x98e7('0xb'),auth[_0x98e7('0x9')](),controller[_0x98e7('0xc')]);router[_0x98e7('0xd')]('/',auth[_0x98e7('0x9')](),controller[_0x98e7('0xe')]);router[_0x98e7('0xf')](_0x98e7('0xb'),auth['isAuthenticated'](),controller[_0x98e7('0x10')]);router[_0x98e7('0x11')](_0x98e7('0xb'),auth[_0x98e7('0x9')](),controller[_0x98e7('0x12')]);module[_0x98e7('0x13')]=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index 5ccf29e..75061eb 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 _0x390a=['#0091EA','sequelize','exports','STRING','name'];(function(_0x46e1b0,_0x145a6d){var _0x31520a=function(_0x12b7bd){while(--_0x12b7bd){_0x46e1b0['push'](_0x46e1b0['shift']());}};_0x31520a(++_0x145a6d);}(_0x390a,0xc9));var _0xa390=function(_0x38cf07,_0x2a8598){_0x38cf07=_0x38cf07-0x0;var _0x5147b1=_0x390a[_0x38cf07];return _0x5147b1;};'use strict';var Sequelize=require(_0xa390('0x0'));module[_0xa390('0x1')]={'name':{'type':Sequelize[_0xa390('0x2')],'unique':_0xa390('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize['STRING'],'defaultValue':_0xa390('0x4')},'description':{'type':Sequelize[_0xa390('0x2')]}}; \ No newline at end of file +var _0x0c19=['sequelize','exports','STRING','name','#0091EA'];(function(_0x2027ec,_0x12f62b){var _0x50e211=function(_0x347f7d){while(--_0x347f7d){_0x2027ec['push'](_0x2027ec['shift']());}};_0x50e211(++_0x12f62b);}(_0x0c19,0xf5));var _0x90c1=function(_0x3812dd,_0x2f777e){_0x3812dd=_0x3812dd-0x0;var _0x2497b2=_0x0c19[_0x3812dd];return _0x2497b2;};'use strict';var Sequelize=require(_0x90c1('0x0'));module[_0x90c1('0x1')]={'name':{'type':Sequelize[_0x90c1('0x2')],'unique':_0x90c1('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x90c1('0x2')],'defaultValue':_0x90c1('0x4')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index 2846e89..007e2fc 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 _0x9567=['save','update','then','get','Tags','UserProfileResource','error','stack','name','send','index','map','Tag','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','include','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','sox','ejs','lodash','squel','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../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'];(function(_0x338248,_0x409be9){var _0x5d1b83=function(_0x4e5900){while(--_0x4e5900){_0x338248['push'](_0x338248['shift']());}};_0x5d1b83(++_0x409be9);}(_0x9567,0xdc));var _0x7956=function(_0xde9d12,_0x4a6e20){_0xde9d12=_0xde9d12-0x0;var _0x57fae9=_0x9567[_0xde9d12];return _0x57fae9;};'use strict';var emlformat=require(_0x7956('0x0'));var rimraf=require(_0x7956('0x1'));var zipdir=require(_0x7956('0x2'));var jsonpatch=require(_0x7956('0x3'));var rp=require(_0x7956('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x7956('0x5'));var util=require(_0x7956('0x6'));var path=require('path');var sox=require(_0x7956('0x7'));var csv=require('to-csv');var ejs=require(_0x7956('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7956('0x9'));var squel=require(_0x7956('0xa'));var crypto=require('crypto');var jsforce=require(_0x7956('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x7956('0xc'));var querystring=require(_0x7956('0xd'));var Papa=require('papaparse');var Redis=require(_0x7956('0xe'));var authService=require(_0x7956('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x7956('0x10'));var hardwareService=require(_0x7956('0x11'));var logger=require(_0x7956('0x12'))('api');var utils=require(_0x7956('0x13'));var config=require(_0x7956('0x14'));var licenseUtil=require(_0x7956('0x15'));var db=require(_0x7956('0x16'))['db'];function respondWithStatusCode(_0x5b3531,_0x1d2e5d){_0x1d2e5d=_0x1d2e5d||0xcc;return function(_0x9d985e){if(_0x9d985e){return _0x5b3531[_0x7956('0x17')](_0x1d2e5d);}return _0x5b3531['status'](_0x1d2e5d)[_0x7956('0x18')]();};}function respondWithResult(_0x43c7f6,_0x248b79){_0x248b79=_0x248b79||0xc8;return function(_0x3a408a){if(_0x3a408a){return _0x43c7f6[_0x7956('0x19')](_0x248b79)[_0x7956('0x1a')](_0x3a408a);}};}function respondWithFilteredResult(_0x197360,_0x436573){return function(_0x24ea8d){if(_0x24ea8d){var _0x6a6d78=typeof _0x436573[_0x7956('0x1b')]===_0x7956('0x1c')&&typeof _0x436573[_0x7956('0x1d')]===_0x7956('0x1c');var _0x1e8040=_0x24ea8d[_0x7956('0x1e')];var _0x5e6b90=_0x6a6d78?0x0:_0x436573['offset'];var _0x10b29c=_0x6a6d78?_0x24ea8d[_0x7956('0x1e')]:_0x436573['offset']+_0x436573[_0x7956('0x1d')];var _0x584922;if(_0x10b29c>=_0x1e8040){_0x10b29c=_0x1e8040;_0x584922=0xc8;}else{_0x584922=0xce;}_0x197360[_0x7956('0x19')](_0x584922);return _0x197360[_0x7956('0x1f')]('Content-Range',_0x5e6b90+'-'+_0x10b29c+'/'+_0x1e8040)[_0x7956('0x1a')](_0x24ea8d);}return null;};}function patchUpdates(_0x2e31cd){return function(_0xc500bd){try{jsonpatch['apply'](_0xc500bd,_0x2e31cd,!![]);}catch(_0x8a58ea){return BPromise['reject'](_0x8a58ea);}return _0xc500bd[_0x7956('0x20')]();};}function saveUpdates(_0x5100d8,_0x427500){return function(_0x8a7165){if(_0x8a7165){return _0x8a7165[_0x7956('0x21')](_0x5100d8)[_0x7956('0x22')](function(_0x4d4d95){return _0x4d4d95;});}return null;};}function removeEntity(_0x19c033,_0x3f13b7){return function(_0x432a2d){if(_0x432a2d){return _0x432a2d['destroy']()['then'](function(){var _0x45f866=_0x432a2d[_0x7956('0x23')]({'plain':!![]});var _0x40d2d6=_0x7956('0x24');return db[_0x7956('0x25')]['destroy']({'where':{'type':_0x40d2d6,'resourceId':_0x45f866['id']}})[_0x7956('0x22')](function(){return _0x432a2d;});})[_0x7956('0x22')](function(){_0x19c033[_0x7956('0x19')](0xcc)[_0x7956('0x18')]();});}};}function handleEntityNotFound(_0x16d978,_0x30392c){return function(_0x4821d7){if(!_0x4821d7){_0x16d978[_0x7956('0x17')](0x194);}return _0x4821d7;};}function handleError(_0x33401e,_0x377261){_0x377261=_0x377261||0x1f4;return function(_0x3de345){logger[_0x7956('0x26')](_0x3de345[_0x7956('0x27')]);if(_0x3de345[_0x7956('0x28')]){delete _0x3de345[_0x7956('0x28')];}_0x33401e[_0x7956('0x19')](_0x377261)[_0x7956('0x29')](_0x3de345);};}exports[_0x7956('0x2a')]=function(_0xe64c4f,_0x21fb1b){var _0x2a00c1={},_0x3de2b5={},_0x378e31={'count':0x0,'rows':[]};var _0x305e30=_[_0x7956('0x2b')](db[_0x7956('0x2c')][_0x7956('0x2d')],function(_0x5bb0f1){return{'name':_0x5bb0f1[_0x7956('0x2e')],'type':_0x5bb0f1[_0x7956('0x2f')][_0x7956('0x30')]};});_0x3de2b5[_0x7956('0x31')]=_[_0x7956('0x2b')](_0x305e30,_0x7956('0x28'));_0x3de2b5['query']=_[_0x7956('0x32')](_0xe64c4f[_0x7956('0x33')]);_0x3de2b5['filters']=_[_0x7956('0x34')](_0x3de2b5[_0x7956('0x31')],_0x3de2b5[_0x7956('0x33')]);_0x2a00c1[_0x7956('0x35')]=_[_0x7956('0x34')](_0x3de2b5[_0x7956('0x31')],qs[_0x7956('0x36')](_0xe64c4f[_0x7956('0x33')][_0x7956('0x36')]));_0x2a00c1[_0x7956('0x35')]=_0x2a00c1[_0x7956('0x35')][_0x7956('0x37')]?_0x2a00c1[_0x7956('0x35')]:_0x3de2b5[_0x7956('0x31')];if(!_0xe64c4f[_0x7956('0x33')][_0x7956('0x38')]('nolimit')){_0x2a00c1[_0x7956('0x1d')]=qs[_0x7956('0x1d')](_0xe64c4f['query'][_0x7956('0x1d')]);_0x2a00c1['offset']=qs[_0x7956('0x1b')](_0xe64c4f['query']['offset']);}_0x2a00c1[_0x7956('0x39')]=qs['sort'](_0xe64c4f[_0x7956('0x33')][_0x7956('0x3a')]);_0x2a00c1[_0x7956('0x3b')]=qs[_0x7956('0x3c')](_[_0x7956('0x3d')](_0xe64c4f[_0x7956('0x33')],_0x3de2b5[_0x7956('0x3c')]),_0x305e30);if(_0xe64c4f[_0x7956('0x33')][_0x7956('0x3e')]){_0x2a00c1['where']=_[_0x7956('0x3f')](_0x2a00c1['where'],{'$or':_[_0x7956('0x2b')](_0x305e30,function(_0x14b2b2){if(_0x14b2b2[_0x7956('0x2f')]!==_0x7956('0x40')){var _0x4fd0fc={};_0x4fd0fc[_0x14b2b2[_0x7956('0x28')]]={'$like':'%'+_0xe64c4f[_0x7956('0x33')]['filter']+'%'};return _0x4fd0fc;}})});}_0x2a00c1=_['merge']({},_0x2a00c1,_0xe64c4f[_0x7956('0x41')]);var _0x4e9279={'where':_0x2a00c1[_0x7956('0x3b')]};return db[_0x7956('0x2c')][_0x7956('0x1e')](_0x4e9279)['then'](function(_0x387237){_0x378e31[_0x7956('0x1e')]=_0x387237;if(_0xe64c4f['query'][_0x7956('0x42')]){_0x2a00c1['include']=[{'all':!![]}];}return db[_0x7956('0x2c')][_0x7956('0x43')](_0x2a00c1);})[_0x7956('0x22')](function(_0x31cea9){_0x378e31[_0x7956('0x44')]=_0x31cea9;return _0x378e31;})['then'](respondWithFilteredResult(_0x21fb1b,_0x2a00c1))['catch'](handleError(_0x21fb1b,null));};exports[_0x7956('0x45')]=function(_0x475c42,_0x20d5fa){var _0x21fd73={'raw':!![],'where':{'id':_0x475c42[_0x7956('0x46')]['id']}},_0x23472d={};_0x23472d['model']=_[_0x7956('0x32')](db[_0x7956('0x2c')][_0x7956('0x2d')]);_0x23472d[_0x7956('0x33')]=_[_0x7956('0x32')](_0x475c42[_0x7956('0x33')]);_0x23472d[_0x7956('0x3c')]=_[_0x7956('0x34')](_0x23472d[_0x7956('0x31')],_0x23472d[_0x7956('0x33')]);_0x21fd73[_0x7956('0x35')]=_[_0x7956('0x34')](_0x23472d[_0x7956('0x31')],qs[_0x7956('0x36')](_0x475c42[_0x7956('0x33')]['fields']));_0x21fd73[_0x7956('0x35')]=_0x21fd73['attributes']['length']?_0x21fd73[_0x7956('0x35')]:_0x23472d[_0x7956('0x31')];if(_0x475c42[_0x7956('0x33')][_0x7956('0x42')]){_0x21fd73[_0x7956('0x47')]=[{'all':!![]}];}_0x21fd73=_[_0x7956('0x3f')]({},_0x21fd73,_0x475c42[_0x7956('0x41')]);return db[_0x7956('0x2c')][_0x7956('0x48')](_0x21fd73)[_0x7956('0x22')](handleEntityNotFound(_0x20d5fa,null))[_0x7956('0x22')](respondWithResult(_0x20d5fa,null))[_0x7956('0x49')](handleError(_0x20d5fa,null));};exports[_0x7956('0x4a')]=function(_0x2ba635,_0x3158aa){return db[_0x7956('0x2c')][_0x7956('0x4a')](_0x2ba635[_0x7956('0x4b')],{})[_0x7956('0x22')](function(_0x2c8b8f){var _0x3b0c2e=_0x2ba635[_0x7956('0x4c')]['get']({'plain':!![]});if(!_0x3b0c2e)throw new Error(_0x7956('0x4d'));if(_0x3b0c2e[_0x7956('0x4e')]===_0x7956('0x4c')){var _0x493092=_0x2c8b8f[_0x7956('0x23')]({'plain':!![]});var _0x583766=_0x7956('0x24');return db[_0x7956('0x4f')]['find']({'where':{'name':_0x583766,'userProfileId':_0x3b0c2e[_0x7956('0x50')]},'raw':!![]})[_0x7956('0x22')](function(_0x5cc4d3){if(_0x5cc4d3&&_0x5cc4d3[_0x7956('0x51')]===0x0){return db[_0x7956('0x25')]['create']({'name':_0x493092[_0x7956('0x28')],'resourceId':_0x493092['id'],'type':_0x5cc4d3[_0x7956('0x28')],'sectionId':_0x5cc4d3['id']},{})[_0x7956('0x22')](function(){return _0x2c8b8f;});}else{return _0x2c8b8f;}})[_0x7956('0x49')](function(_0x3c592a){logger[_0x7956('0x26')](_0x7956('0x52'),_0x3c592a);throw _0x3c592a;});}return _0x2c8b8f;})['then'](respondWithResult(_0x3158aa,0xc9))[_0x7956('0x49')](handleError(_0x3158aa,null));};exports[_0x7956('0x21')]=function(_0x1b69d1,_0x43e920){if(_0x1b69d1['body']['id']){delete _0x1b69d1[_0x7956('0x4b')]['id'];}return db[_0x7956('0x2c')][_0x7956('0x48')]({'where':{'id':_0x1b69d1[_0x7956('0x46')]['id']}})[_0x7956('0x22')](handleEntityNotFound(_0x43e920,null))[_0x7956('0x22')](saveUpdates(_0x1b69d1[_0x7956('0x4b')],null))[_0x7956('0x22')](respondWithResult(_0x43e920,null))[_0x7956('0x49')](handleError(_0x43e920,null));};exports[_0x7956('0x53')]=function(_0x29a005,_0x1d2af8){return db[_0x7956('0x2c')][_0x7956('0x48')]({'where':{'id':_0x29a005['params']['id']}})[_0x7956('0x22')](handleEntityNotFound(_0x1d2af8,null))[_0x7956('0x22')](removeEntity(_0x1d2af8,null))[_0x7956('0x49')](handleError(_0x1d2af8,null));}; \ No newline at end of file +var _0xad95=['Tag','rawAttributes','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','map','type','VIRTUAL','includeAll','include','show','params','options','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','error','body','eml-format','rimraf','zip-dir','moment','bluebird','path','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','Content-Range','reject','save','update','destroy','then','get','Tags','UserProfileResource','end','stack','name','send','index'];(function(_0x4ca288,_0x254dd8){var _0x2362c1=function(_0x5504d8){while(--_0x5504d8){_0x4ca288['push'](_0x4ca288['shift']());}};_0x2362c1(++_0x254dd8);}(_0xad95,0x70));var _0x5ad9=function(_0x511a27,_0x5d61b8){_0x511a27=_0x511a27-0x0;var _0x1a195d=_0xad95[_0x511a27];return _0x1a195d;};'use strict';var emlformat=require(_0x5ad9('0x0'));var rimraf=require(_0x5ad9('0x1'));var zipdir=require(_0x5ad9('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x5ad9('0x3'));var BPromise=require(_0x5ad9('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x5ad9('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5ad9('0x6'));var squel=require(_0x5ad9('0x7'));var crypto=require(_0x5ad9('0x8'));var jsforce=require(_0x5ad9('0x9'));var deskjs=require(_0x5ad9('0xa'));var toCsv=require('to-csv');var querystring=require(_0x5ad9('0xb'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x5ad9('0xc'));var qs=require(_0x5ad9('0xd'));var as=require(_0x5ad9('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5ad9('0xf'))(_0x5ad9('0x10'));var utils=require('../../config/utils');var config=require(_0x5ad9('0x11'));var licenseUtil=require(_0x5ad9('0x12'));var db=require(_0x5ad9('0x13'))['db'];function respondWithStatusCode(_0x3b2718,_0x262ce4){_0x262ce4=_0x262ce4||0xcc;return function(_0xc7e5e9){if(_0xc7e5e9){return _0x3b2718['sendStatus'](_0x262ce4);}return _0x3b2718['status'](_0x262ce4)['end']();};}function respondWithResult(_0x431358,_0x4519ad){_0x4519ad=_0x4519ad||0xc8;return function(_0x52cb37){if(_0x52cb37){return _0x431358[_0x5ad9('0x14')](_0x4519ad)[_0x5ad9('0x15')](_0x52cb37);}};}function respondWithFilteredResult(_0x3f16ef,_0x543743){return function(_0x3da125){if(_0x3da125){var _0x32b0bd=typeof _0x543743[_0x5ad9('0x16')]===_0x5ad9('0x17')&&typeof _0x543743[_0x5ad9('0x18')]===_0x5ad9('0x17');var _0x521cc3=_0x3da125[_0x5ad9('0x19')];var _0x54f392=_0x32b0bd?0x0:_0x543743[_0x5ad9('0x16')];var _0x28682f=_0x32b0bd?_0x3da125[_0x5ad9('0x19')]:_0x543743[_0x5ad9('0x16')]+_0x543743[_0x5ad9('0x18')];var _0x2ba5c0;if(_0x28682f>=_0x521cc3){_0x28682f=_0x521cc3;_0x2ba5c0=0xc8;}else{_0x2ba5c0=0xce;}_0x3f16ef[_0x5ad9('0x14')](_0x2ba5c0);return _0x3f16ef['set'](_0x5ad9('0x1a'),_0x54f392+'-'+_0x28682f+'/'+_0x521cc3)['json'](_0x3da125);}return null;};}function patchUpdates(_0x49363b){return function(_0x3356e5){try{jsonpatch['apply'](_0x3356e5,_0x49363b,!![]);}catch(_0xded166){return BPromise[_0x5ad9('0x1b')](_0xded166);}return _0x3356e5[_0x5ad9('0x1c')]();};}function saveUpdates(_0xebbe63,_0x1274f7){return function(_0x57b2ba){if(_0x57b2ba){return _0x57b2ba[_0x5ad9('0x1d')](_0xebbe63)['then'](function(_0x807b05){return _0x807b05;});}return null;};}function removeEntity(_0x5b816d,_0x570d3c){return function(_0x524249){if(_0x524249){return _0x524249[_0x5ad9('0x1e')]()[_0x5ad9('0x1f')](function(){var _0x39a124=_0x524249[_0x5ad9('0x20')]({'plain':!![]});var _0x1252e6=_0x5ad9('0x21');return db[_0x5ad9('0x22')]['destroy']({'where':{'type':_0x1252e6,'resourceId':_0x39a124['id']}})['then'](function(){return _0x524249;});})[_0x5ad9('0x1f')](function(){_0x5b816d['status'](0xcc)[_0x5ad9('0x23')]();});}};}function handleEntityNotFound(_0x584de3,_0x346f35){return function(_0x55a0e4){if(!_0x55a0e4){_0x584de3['sendStatus'](0x194);}return _0x55a0e4;};}function handleError(_0x243f82,_0x46d565){_0x46d565=_0x46d565||0x1f4;return function(_0x49b3df){logger['error'](_0x49b3df[_0x5ad9('0x24')]);if(_0x49b3df[_0x5ad9('0x25')]){delete _0x49b3df[_0x5ad9('0x25')];}_0x243f82[_0x5ad9('0x14')](_0x46d565)[_0x5ad9('0x26')](_0x49b3df);};}exports[_0x5ad9('0x27')]=function(_0x5e5656,_0x132ec6){var _0x12867b={},_0x2d4f72={},_0x4118a7={'count':0x0,'rows':[]};var _0x5517c8=_['map'](db[_0x5ad9('0x28')][_0x5ad9('0x29')],function(_0x4afceb){return{'name':_0x4afceb['fieldName'],'type':_0x4afceb['type'][_0x5ad9('0x2a')]};});_0x2d4f72[_0x5ad9('0x2b')]=_['map'](_0x5517c8,_0x5ad9('0x25'));_0x2d4f72[_0x5ad9('0x2c')]=_[_0x5ad9('0x2d')](_0x5e5656[_0x5ad9('0x2c')]);_0x2d4f72['filters']=_['intersection'](_0x2d4f72[_0x5ad9('0x2b')],_0x2d4f72[_0x5ad9('0x2c')]);_0x12867b[_0x5ad9('0x2e')]=_[_0x5ad9('0x2f')](_0x2d4f72[_0x5ad9('0x2b')],qs['fields'](_0x5e5656[_0x5ad9('0x2c')][_0x5ad9('0x30')]));_0x12867b[_0x5ad9('0x2e')]=_0x12867b[_0x5ad9('0x2e')][_0x5ad9('0x31')]?_0x12867b[_0x5ad9('0x2e')]:_0x2d4f72['model'];if(!_0x5e5656[_0x5ad9('0x2c')][_0x5ad9('0x32')]('nolimit')){_0x12867b[_0x5ad9('0x18')]=qs[_0x5ad9('0x18')](_0x5e5656['query'][_0x5ad9('0x18')]);_0x12867b[_0x5ad9('0x16')]=qs[_0x5ad9('0x16')](_0x5e5656['query'][_0x5ad9('0x16')]);}_0x12867b[_0x5ad9('0x33')]=qs[_0x5ad9('0x34')](_0x5e5656[_0x5ad9('0x2c')]['sort']);_0x12867b[_0x5ad9('0x35')]=qs[_0x5ad9('0x36')](_[_0x5ad9('0x37')](_0x5e5656[_0x5ad9('0x2c')],_0x2d4f72[_0x5ad9('0x36')]),_0x5517c8);if(_0x5e5656[_0x5ad9('0x2c')][_0x5ad9('0x38')]){_0x12867b[_0x5ad9('0x35')]=_[_0x5ad9('0x39')](_0x12867b['where'],{'$or':_[_0x5ad9('0x3a')](_0x5517c8,function(_0x39563f){if(_0x39563f[_0x5ad9('0x3b')]!==_0x5ad9('0x3c')){var _0x2a9e3b={};_0x2a9e3b[_0x39563f['name']]={'$like':'%'+_0x5e5656[_0x5ad9('0x2c')][_0x5ad9('0x38')]+'%'};return _0x2a9e3b;}})});}_0x12867b=_[_0x5ad9('0x39')]({},_0x12867b,_0x5e5656['options']);var _0x3d027a={'where':_0x12867b[_0x5ad9('0x35')]};return db[_0x5ad9('0x28')]['count'](_0x3d027a)[_0x5ad9('0x1f')](function(_0x5cfe5b){_0x4118a7['count']=_0x5cfe5b;if(_0x5e5656[_0x5ad9('0x2c')][_0x5ad9('0x3d')]){_0x12867b[_0x5ad9('0x3e')]=[{'all':!![]}];}return db[_0x5ad9('0x28')]['findAll'](_0x12867b);})['then'](function(_0x552c39){_0x4118a7['rows']=_0x552c39;return _0x4118a7;})[_0x5ad9('0x1f')](respondWithFilteredResult(_0x132ec6,_0x12867b))['catch'](handleError(_0x132ec6,null));};exports[_0x5ad9('0x3f')]=function(_0x5c5a7a,_0x21dfd1){var _0x1c04c3={'raw':!![],'where':{'id':_0x5c5a7a[_0x5ad9('0x40')]['id']}},_0x6b2fa7={};_0x6b2fa7[_0x5ad9('0x2b')]=_[_0x5ad9('0x2d')](db[_0x5ad9('0x28')][_0x5ad9('0x29')]);_0x6b2fa7[_0x5ad9('0x2c')]=_['keys'](_0x5c5a7a[_0x5ad9('0x2c')]);_0x6b2fa7[_0x5ad9('0x36')]=_[_0x5ad9('0x2f')](_0x6b2fa7[_0x5ad9('0x2b')],_0x6b2fa7[_0x5ad9('0x2c')]);_0x1c04c3['attributes']=_[_0x5ad9('0x2f')](_0x6b2fa7['model'],qs['fields'](_0x5c5a7a['query'][_0x5ad9('0x30')]));_0x1c04c3[_0x5ad9('0x2e')]=_0x1c04c3[_0x5ad9('0x2e')]['length']?_0x1c04c3[_0x5ad9('0x2e')]:_0x6b2fa7[_0x5ad9('0x2b')];if(_0x5c5a7a[_0x5ad9('0x2c')][_0x5ad9('0x3d')]){_0x1c04c3['include']=[{'all':!![]}];}_0x1c04c3=_[_0x5ad9('0x39')]({},_0x1c04c3,_0x5c5a7a[_0x5ad9('0x41')]);return db[_0x5ad9('0x28')][_0x5ad9('0x42')](_0x1c04c3)['then'](handleEntityNotFound(_0x21dfd1,null))[_0x5ad9('0x1f')](respondWithResult(_0x21dfd1,null))[_0x5ad9('0x43')](handleError(_0x21dfd1,null));};exports[_0x5ad9('0x44')]=function(_0x1e03f,_0x479bbc){return db[_0x5ad9('0x28')][_0x5ad9('0x44')](_0x1e03f['body'],{})[_0x5ad9('0x1f')](function(_0x5d8a5f){var _0x42a662=_0x1e03f[_0x5ad9('0x45')][_0x5ad9('0x20')]({'plain':!![]});if(!_0x42a662)throw new Error(_0x5ad9('0x46'));if(_0x42a662[_0x5ad9('0x47')]===_0x5ad9('0x45')){var _0xa0f426=_0x5d8a5f[_0x5ad9('0x20')]({'plain':!![]});var _0x307dd9=_0x5ad9('0x21');return db[_0x5ad9('0x48')][_0x5ad9('0x42')]({'where':{'name':_0x307dd9,'userProfileId':_0x42a662[_0x5ad9('0x49')]},'raw':!![]})[_0x5ad9('0x1f')](function(_0x251b65){if(_0x251b65&&_0x251b65['autoAssociation']===0x0){return db[_0x5ad9('0x22')][_0x5ad9('0x44')]({'name':_0xa0f426[_0x5ad9('0x25')],'resourceId':_0xa0f426['id'],'type':_0x251b65[_0x5ad9('0x25')],'sectionId':_0x251b65['id']},{})[_0x5ad9('0x1f')](function(){return _0x5d8a5f;});}else{return _0x5d8a5f;}})[_0x5ad9('0x43')](function(_0xb5222e){logger[_0x5ad9('0x4a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xb5222e);throw _0xb5222e;});}return _0x5d8a5f;})[_0x5ad9('0x1f')](respondWithResult(_0x479bbc,0xc9))['catch'](handleError(_0x479bbc,null));};exports[_0x5ad9('0x1d')]=function(_0x3445b6,_0x469b19){if(_0x3445b6['body']['id']){delete _0x3445b6[_0x5ad9('0x4b')]['id'];}return db[_0x5ad9('0x28')][_0x5ad9('0x42')]({'where':{'id':_0x3445b6['params']['id']}})[_0x5ad9('0x1f')](handleEntityNotFound(_0x469b19,null))['then'](saveUpdates(_0x3445b6['body'],null))[_0x5ad9('0x1f')](respondWithResult(_0x469b19,null))[_0x5ad9('0x43')](handleError(_0x469b19,null));};exports['destroy']=function(_0x5c6627,_0xbda89a){return db[_0x5ad9('0x28')][_0x5ad9('0x42')]({'where':{'id':_0x5c6627[_0x5ad9('0x40')]['id']}})[_0x5ad9('0x1f')](handleEntityNotFound(_0xbda89a,null))[_0x5ad9('0x1f')](removeEntity(_0xbda89a,null))[_0x5ad9('0x43')](handleError(_0xbda89a,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index 68c7e66..d9db705 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 _0x30d2=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./tag.attributes','exports','define','Tag','lodash','../../config/logger','api'];(function(_0x5a8fec,_0x14d3b2){var _0x1bc3d7=function(_0x34a7e3){while(--_0x34a7e3){_0x5a8fec['push'](_0x5a8fec['shift']());}};_0x1bc3d7(++_0x14d3b2);}(_0x30d2,0x190));var _0x230d=function(_0x568496,_0x565afd){_0x568496=_0x568496-0x0;var _0x26c5c1=_0x30d2[_0x568496];return _0x26c5c1;};'use strict';var _=require(_0x230d('0x0'));var util=require('util');var logger=require(_0x230d('0x1'))(_0x230d('0x2'));var moment=require(_0x230d('0x3'));var BPromise=require(_0x230d('0x4'));var rp=require(_0x230d('0x5'));var fs=require('fs');var path=require(_0x230d('0x6'));var rimraf=require(_0x230d('0x7'));var config=require(_0x230d('0x8'));var attributes=require(_0x230d('0x9'));module[_0x230d('0xa')]=function(_0x469a0c,_0x3b550c){return _0x469a0c[_0x230d('0xb')](_0x230d('0xc'),attributes,{'tableName':'tools_tags','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xef72=['define','Tag','tools_tags','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports'];(function(_0x228058,_0x8058a3){var _0x1519b9=function(_0x144688){while(--_0x144688){_0x228058['push'](_0x228058['shift']());}};_0x1519b9(++_0x8058a3);}(_0xef72,0x9f));var _0x2ef7=function(_0x425051,_0x3c1854){_0x425051=_0x425051-0x0;var _0x126b92=_0xef72[_0x425051];return _0x126b92;};'use strict';var _=require('lodash');var util=require(_0x2ef7('0x0'));var logger=require(_0x2ef7('0x1'))(_0x2ef7('0x2'));var moment=require(_0x2ef7('0x3'));var BPromise=require(_0x2ef7('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2ef7('0x5'));var rimraf=require(_0x2ef7('0x6'));var config=require(_0x2ef7('0x7'));var attributes=require('./tag.attributes');module[_0x2ef7('0x8')]=function(_0x2c20c7,_0x426f4c){return _0x2c20c7[_0x2ef7('0x9')](_0x2ef7('0xa'),attributes,{'tableName':_0x2ef7('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/tag/tag.rpc.js b/server/api/tag/tag.rpc.js index c431fbb..992258d 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 _0x826a=['debug','error','code','message','result','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','Tag,\x20%s,\x20%s','request\x20sent'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x826a,0x1aa));var _0xa826=function(_0x3a92a9,_0x2940ff){_0x3a92a9=_0x3a92a9-0x0;var _0x1e4374=_0x826a[_0x3a92a9];return _0x1e4374;};'use strict';var _=require('lodash');var util=require(_0xa826('0x0'));var moment=require('moment');var BPromise=require(_0xa826('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa826('0x2'));var db=require(_0xa826('0x3'))['db'];var utils=require(_0xa826('0x4'));var logger=require(_0xa826('0x5'))('rpc');var config=require(_0xa826('0x6'));var jayson=require(_0xa826('0x7'));var client=jayson[_0xa826('0x8')][_0xa826('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x45154f,_0x4124f5,_0x4339f9){return new BPromise(function(_0x14c2ba,_0xc348d2){return client[_0xa826('0xa')](_0x45154f,_0x4339f9)[_0xa826('0xb')](function(_0x1005e6){logger[_0xa826('0xc')](_0xa826('0xd'),_0x4124f5,_0xa826('0xe'));logger[_0xa826('0xf')]('Tag,\x20%s,\x20%s,\x20%s',_0x4124f5,_0xa826('0xe'),JSON['stringify'](_0x1005e6));if(_0x1005e6[_0xa826('0x10')]){if(_0x1005e6[_0xa826('0x10')][_0xa826('0x11')]===0x1f4){logger[_0xa826('0x10')](_0xa826('0xd'),_0x4124f5,_0x1005e6[_0xa826('0x10')][_0xa826('0x12')]);return _0xc348d2(_0x1005e6['error'][_0xa826('0x12')]);}logger['error'](_0xa826('0xd'),_0x4124f5,_0x1005e6[_0xa826('0x10')]['message']);return _0x14c2ba(_0x1005e6['error']['message']);}else{logger[_0xa826('0xc')]('Tag,\x20%s,\x20%s',_0x4124f5,'request\x20sent');_0x14c2ba(_0x1005e6[_0xa826('0x13')][_0xa826('0x12')]);}})[_0xa826('0x14')](function(_0x5832b9){logger[_0xa826('0x10')](_0xa826('0xd'),_0x4124f5,_0x5832b9);_0xc348d2(_0x5832b9);});});} \ No newline at end of file +var _0xd691=['jayson/promise','client','http','request','then','Tag,\x20%s,\x20%s','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x1fe937,_0x5a5a63){var _0x2a6f0d=function(_0x181d31){while(--_0x181d31){_0x1fe937['push'](_0x1fe937['shift']());}};_0x2a6f0d(++_0x5a5a63);}(_0xd691,0xe6));var _0x1d69=function(_0x5276f1,_0x1fcf3f){_0x5276f1=_0x5276f1-0x0;var _0xa2d451=_0xd691[_0x5276f1];return _0xa2d451;};'use strict';var _=require(_0x1d69('0x0'));var util=require(_0x1d69('0x1'));var moment=require(_0x1d69('0x2'));var BPromise=require('bluebird');var rs=require(_0x1d69('0x3'));var fs=require('fs');var Redis=require(_0x1d69('0x4'));var db=require(_0x1d69('0x5'))['db'];var utils=require(_0x1d69('0x6'));var logger=require(_0x1d69('0x7'))(_0x1d69('0x8'));var config=require(_0x1d69('0x9'));var jayson=require(_0x1d69('0xa'));var client=jayson[_0x1d69('0xb')][_0x1d69('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5a5b0c,_0x520acb,_0x267da3){return new BPromise(function(_0x49f008,_0x369d44){return client[_0x1d69('0xd')](_0x5a5b0c,_0x267da3)[_0x1d69('0xe')](function(_0x364061){logger['info'](_0x1d69('0xf'),_0x520acb,_0x1d69('0x10'));logger[_0x1d69('0x11')](_0x1d69('0x12'),_0x520acb,_0x1d69('0x10'),JSON['stringify'](_0x364061));if(_0x364061['error']){if(_0x364061[_0x1d69('0x13')][_0x1d69('0x14')]===0x1f4){logger[_0x1d69('0x13')](_0x1d69('0xf'),_0x520acb,_0x364061[_0x1d69('0x13')][_0x1d69('0x15')]);return _0x369d44(_0x364061[_0x1d69('0x13')][_0x1d69('0x15')]);}logger[_0x1d69('0x13')](_0x1d69('0xf'),_0x520acb,_0x364061[_0x1d69('0x13')][_0x1d69('0x15')]);return _0x49f008(_0x364061[_0x1d69('0x13')]['message']);}else{logger['info'](_0x1d69('0xf'),_0x520acb,_0x1d69('0x10'));_0x49f008(_0x364061[_0x1d69('0x16')][_0x1d69('0x15')]);}})[_0x1d69('0x17')](function(_0x383771){logger['error'](_0x1d69('0xf'),_0x520acb,_0x383771);_0x369d44(_0x383771);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index f9b9738..3f2e615 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(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_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/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(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0xa9e0[_0x4154a6];return _0x3b2786;};'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 4a95467..8f0109f 100644 --- a/server/api/team/team.attributes.js +++ b/server/api/team/team.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbaf0=['name','exports','STRING'];(function(_0x545bed,_0x221e96){var _0x16c79c=function(_0x465346){while(--_0x465346){_0x545bed['push'](_0x545bed['shift']());}};_0x16c79c(++_0x221e96);}(_0xbaf0,0x12a));var _0x0baf=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xbaf0[_0x6c993a];return _0x27f547;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'name':{'type':Sequelize[_0x0baf('0x1')],'allowNull':![],'unique':_0x0baf('0x2')},'description':{'type':Sequelize[_0x0baf('0x1')]}}; \ No newline at end of file +var _0xe706=['STRING','sequelize','exports'];(function(_0x56482c,_0x16118d){var _0x5aae7a=function(_0x52512f){while(--_0x52512f){_0x56482c['push'](_0x56482c['shift']());}};_0x5aae7a(++_0x16118d);}(_0xe706,0xa3));var _0x6e70=function(_0x566438,_0x3abb6a){_0x566438=_0x566438-0x0;var _0x2d8c26=_0xe706[_0x566438];return _0x2d8c26;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'name':{'type':Sequelize[_0x6e70('0x2')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize[_0x6e70('0x2')]}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index 2e02ec9..451e269 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 _0x0cae=['UserOpenchannelQueue','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','WhatsappQueueId','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','findOne','channel','isValidChannel','ValidationError','capitalize','Queue','toLowerCase','Queues','addQueues','Unknown\x20channel','add','ids','removeQueues','isArray','Voice','Chat','Sms','Fax','Openchannel','Whatsapp','transaction','penalty','QueueId','TeamVoiceQueue','User','findOrCreate','Queue:save','findAll','online','upsert','isNil','interface','format','voicePause','all','addAgents','removeAgents','Mail','emit','pick','getAgents','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./team.socket','register','sendStatus','status','end','offset','undefined','limit','set','Content-Range','json','apply','reject','then','error','stack','name','send','index','map','Team','rawAttributes','fieldName','type','key','model','filters','query','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','count','includeAll','include','catch','params','keys','intersection','length','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','Teams','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','sequelize','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','Sequelize','QueryTypes','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','SELECT','VoiceQueueId','UserVoiceQueue','destroy','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','MailQueueId','SmsQueueId','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','UserChatQueue','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','FaxQueueId','UserFaxQueue','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20'];(function(_0x5fff40,_0x26fb14){var _0x3aa453=function(_0x1bc5f2){while(--_0x1bc5f2){_0x5fff40['push'](_0x5fff40['shift']());}};_0x3aa453(++_0x26fb14);}(_0x0cae,0xc2));var _0xe0ca=function(_0x52b91d,_0x3d1a72){_0x52b91d=_0x52b91d-0x0;var _0x1c2dde=_0x0cae[_0x52b91d];return _0x1c2dde;};'use strict';var emlformat=require(_0xe0ca('0x0'));var rimraf=require(_0xe0ca('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe0ca('0x2'));var rp=require(_0xe0ca('0x3'));var moment=require(_0xe0ca('0x4'));var BPromise=require(_0xe0ca('0x5'));var Mustache=require('mustache');var util=require(_0xe0ca('0x6'));var path=require(_0xe0ca('0x7'));var sox=require(_0xe0ca('0x8'));var csv=require(_0xe0ca('0x9'));var ejs=require(_0xe0ca('0xa'));var fs=require('fs');var fs_extra=require(_0xe0ca('0xb'));var _=require('lodash');var squel=require(_0xe0ca('0xc'));var crypto=require(_0xe0ca('0xd'));var jsforce=require(_0xe0ca('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xe0ca('0x9'));var querystring=require(_0xe0ca('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xe0ca('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xe0ca('0x11'));var hardwareService=require(_0xe0ca('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xe0ca('0x13'));var licenseUtil=require(_0xe0ca('0x14'));var db=require('../../mysqldb')['db'];config[_0xe0ca('0x15')]=_[_0xe0ca('0x16')](config[_0xe0ca('0x15')],{'host':_0xe0ca('0x17'),'port':0x18eb});var socket=require(_0xe0ca('0x18'))(new Redis(config[_0xe0ca('0x15')]));require(_0xe0ca('0x19'))[_0xe0ca('0x1a')](socket);function respondWithStatusCode(_0xfb51f4,_0x436224){_0x436224=_0x436224||0xcc;return function(_0x26ee2b){if(_0x26ee2b){return _0xfb51f4[_0xe0ca('0x1b')](_0x436224);}return _0xfb51f4[_0xe0ca('0x1c')](_0x436224)[_0xe0ca('0x1d')]();};}function respondWithResult(_0xebeafa,_0x3a09a8){_0x3a09a8=_0x3a09a8||0xc8;return function(_0x27124b){if(_0x27124b){return _0xebeafa[_0xe0ca('0x1c')](_0x3a09a8)['json'](_0x27124b);}};}function respondWithFilteredResult(_0x9ea176,_0x324213){return function(_0x5f2b95){if(_0x5f2b95){var _0x43c9f7=typeof _0x324213[_0xe0ca('0x1e')]===_0xe0ca('0x1f')&&typeof _0x324213['limit']===_0xe0ca('0x1f');var _0x3514e7=_0x5f2b95['count'];var _0x3d12e0=_0x43c9f7?0x0:_0x324213[_0xe0ca('0x1e')];var _0x40e1b1=_0x43c9f7?_0x5f2b95['count']:_0x324213[_0xe0ca('0x1e')]+_0x324213[_0xe0ca('0x20')];var _0x434831;if(_0x40e1b1>=_0x3514e7){_0x40e1b1=_0x3514e7;_0x434831=0xc8;}else{_0x434831=0xce;}_0x9ea176[_0xe0ca('0x1c')](_0x434831);return _0x9ea176[_0xe0ca('0x21')](_0xe0ca('0x22'),_0x3d12e0+'-'+_0x40e1b1+'/'+_0x3514e7)[_0xe0ca('0x23')](_0x5f2b95);}return null;};}function patchUpdates(_0x3dcc8b){return function(_0x5ec0a7){try{jsonpatch[_0xe0ca('0x24')](_0x5ec0a7,_0x3dcc8b,!![]);}catch(_0x575906){return BPromise[_0xe0ca('0x25')](_0x575906);}return _0x5ec0a7['save']();};}function saveUpdates(_0x15c67f,_0x8bfa7){return function(_0xf3e595){if(_0xf3e595){return _0xf3e595['update'](_0x15c67f)[_0xe0ca('0x26')](function(_0x4fe380){return _0x4fe380;});}return null;};}function handleEntityNotFound(_0x52851b,_0x54660f){return function(_0x1561d9){if(!_0x1561d9){_0x52851b['sendStatus'](0x194);}return _0x1561d9;};}function handleError(_0x49ebd0,_0x4bd18e){_0x4bd18e=_0x4bd18e||0x1f4;return function(_0x36f36c){logger[_0xe0ca('0x27')](_0x36f36c[_0xe0ca('0x28')]);if(_0x36f36c[_0xe0ca('0x29')]){delete _0x36f36c[_0xe0ca('0x29')];}_0x49ebd0[_0xe0ca('0x1c')](_0x4bd18e)[_0xe0ca('0x2a')](_0x36f36c);};}exports[_0xe0ca('0x2b')]=function(_0x4d1409,_0x49f77a){var _0xe77bb1={},_0x218b77={},_0x474f83={'count':0x0,'rows':[]};var _0x1fbe08=_[_0xe0ca('0x2c')](db[_0xe0ca('0x2d')][_0xe0ca('0x2e')],function(_0x48362b){return{'name':_0x48362b[_0xe0ca('0x2f')],'type':_0x48362b[_0xe0ca('0x30')][_0xe0ca('0x31')]};});_0x218b77[_0xe0ca('0x32')]=_[_0xe0ca('0x2c')](_0x1fbe08,_0xe0ca('0x29'));_0x218b77['query']=_['keys'](_0x4d1409['query']);_0x218b77[_0xe0ca('0x33')]=_['intersection'](_0x218b77[_0xe0ca('0x32')],_0x218b77[_0xe0ca('0x34')]);_0xe77bb1['attributes']=_['intersection'](_0x218b77[_0xe0ca('0x32')],qs[_0xe0ca('0x35')](_0x4d1409[_0xe0ca('0x34')][_0xe0ca('0x35')]));_0xe77bb1[_0xe0ca('0x36')]=_0xe77bb1[_0xe0ca('0x36')]['length']?_0xe77bb1[_0xe0ca('0x36')]:_0x218b77['model'];if(!_0x4d1409['query'][_0xe0ca('0x37')](_0xe0ca('0x38'))){_0xe77bb1[_0xe0ca('0x20')]=qs[_0xe0ca('0x20')](_0x4d1409[_0xe0ca('0x34')][_0xe0ca('0x20')]);_0xe77bb1[_0xe0ca('0x1e')]=qs[_0xe0ca('0x1e')](_0x4d1409[_0xe0ca('0x34')][_0xe0ca('0x1e')]);}_0xe77bb1[_0xe0ca('0x39')]=qs[_0xe0ca('0x3a')](_0x4d1409[_0xe0ca('0x34')][_0xe0ca('0x3a')]);_0xe77bb1[_0xe0ca('0x3b')]=qs[_0xe0ca('0x33')](_['pick'](_0x4d1409[_0xe0ca('0x34')],_0x218b77[_0xe0ca('0x33')]),_0x1fbe08);if(_0x4d1409['query'][_0xe0ca('0x3c')]){_0xe77bb1[_0xe0ca('0x3b')]=_[_0xe0ca('0x3d')](_0xe77bb1['where'],{'$or':_[_0xe0ca('0x2c')](_0x1fbe08,function(_0x598d23){if(_0x598d23['type']!=='VIRTUAL'){var _0x4aa182={};_0x4aa182[_0x598d23['name']]={'$like':'%'+_0x4d1409[_0xe0ca('0x34')]['filter']+'%'};return _0x4aa182;}})});}_0xe77bb1=_[_0xe0ca('0x3d')]({},_0xe77bb1,_0x4d1409[_0xe0ca('0x3e')]);var _0x48e3c6={'where':_0xe77bb1[_0xe0ca('0x3b')]};return db[_0xe0ca('0x2d')]['count'](_0x48e3c6)[_0xe0ca('0x26')](function(_0x67d050){_0x474f83[_0xe0ca('0x3f')]=_0x67d050;if(_0x4d1409[_0xe0ca('0x34')][_0xe0ca('0x40')]){_0xe77bb1[_0xe0ca('0x41')]=[{'all':!![]}];}return db[_0xe0ca('0x2d')]['findAll'](_0xe77bb1);})['then'](function(_0x4b5da3){_0x474f83['rows']=_0x4b5da3;return _0x474f83;})[_0xe0ca('0x26')](respondWithFilteredResult(_0x49f77a,_0xe77bb1))[_0xe0ca('0x42')](handleError(_0x49f77a,null));};exports['show']=function(_0xe62bb7,_0x25bb79){var _0x843da4={'raw':![],'where':{'id':_0xe62bb7[_0xe0ca('0x43')]['id']}},_0x3340b2={};_0x3340b2[_0xe0ca('0x32')]=_['keys'](db[_0xe0ca('0x2d')]['rawAttributes']);_0x3340b2[_0xe0ca('0x34')]=_[_0xe0ca('0x44')](_0xe62bb7[_0xe0ca('0x34')]);_0x3340b2[_0xe0ca('0x33')]=_[_0xe0ca('0x45')](_0x3340b2[_0xe0ca('0x32')],_0x3340b2[_0xe0ca('0x34')]);_0x843da4[_0xe0ca('0x36')]=_['intersection'](_0x3340b2[_0xe0ca('0x32')],qs[_0xe0ca('0x35')](_0xe62bb7[_0xe0ca('0x34')][_0xe0ca('0x35')]));_0x843da4[_0xe0ca('0x36')]=_0x843da4[_0xe0ca('0x36')][_0xe0ca('0x46')]?_0x843da4[_0xe0ca('0x36')]:_0x3340b2[_0xe0ca('0x32')];if(_0xe62bb7[_0xe0ca('0x34')][_0xe0ca('0x40')]){_0x843da4['include']=[{'all':!![]}];}_0x843da4=_[_0xe0ca('0x3d')]({},_0x843da4,_0xe62bb7[_0xe0ca('0x3e')]);return db[_0xe0ca('0x2d')][_0xe0ca('0x47')](_0x843da4)[_0xe0ca('0x26')](handleEntityNotFound(_0x25bb79,null))[_0xe0ca('0x26')](respondWithResult(_0x25bb79,null))['catch'](handleError(_0x25bb79,null));};exports[_0xe0ca('0x48')]=function(_0x179b4a,_0x49f991){return db['Team']['create'](_0x179b4a[_0xe0ca('0x49')],{})[_0xe0ca('0x26')](function(_0x2f8056){var _0x536eb5=_0x179b4a['user'][_0xe0ca('0x4a')]({'plain':!![]});if(!_0x536eb5)throw new Error(_0xe0ca('0x4b'));if(_0x536eb5['role']===_0xe0ca('0x4c')){var _0x2557be=_0x2f8056[_0xe0ca('0x4a')]({'plain':!![]});var _0x4571a8=_0xe0ca('0x4d');return db[_0xe0ca('0x4e')]['find']({'where':{'name':_0x4571a8,'userProfileId':_0x536eb5[_0xe0ca('0x4f')]},'raw':!![]})[_0xe0ca('0x26')](function(_0x21a0da){if(_0x21a0da&&_0x21a0da['autoAssociation']===0x0){return db[_0xe0ca('0x50')][_0xe0ca('0x48')]({'name':_0x2557be[_0xe0ca('0x29')],'resourceId':_0x2557be['id'],'type':_0x21a0da['name'],'sectionId':_0x21a0da['id']},{})[_0xe0ca('0x26')](function(){return _0x2f8056;});}else{return _0x2f8056;}})[_0xe0ca('0x42')](function(_0x57d13d){logger[_0xe0ca('0x27')](_0xe0ca('0x51'),_0x57d13d);throw _0x57d13d;});}return _0x2f8056;})[_0xe0ca('0x26')](respondWithResult(_0x49f991,0xc9))[_0xe0ca('0x42')](handleError(_0x49f991,null));};exports['update']=function(_0x4f93a9,_0x255705){if(_0x4f93a9[_0xe0ca('0x49')]['id']){delete _0x4f93a9['body']['id'];}return db[_0xe0ca('0x2d')][_0xe0ca('0x47')]({'where':{'id':_0x4f93a9[_0xe0ca('0x43')]['id']}})['then'](handleEntityNotFound(_0x255705,null))[_0xe0ca('0x26')](saveUpdates(_0x4f93a9['body'],null))[_0xe0ca('0x26')](respondWithResult(_0x255705,null))['catch'](handleError(_0x255705,null));};exports['destroy']=function(_0x19b85e,_0x363c52){var _0x280c90=_0x19b85e[_0xe0ca('0x43')]['id'];var _0x58259f=[];return db[_0xe0ca('0x52')]['transaction'](function(_0x101f4a){var _0x22540d=_0xe0ca('0x53')+_0x280c90;return db[_0xe0ca('0x52')][_0xe0ca('0x34')](_0x22540d,{'type':db[_0xe0ca('0x54')][_0xe0ca('0x55')]['SELECT'],'raw':!![],'transaction':_0x101f4a})[_0xe0ca('0x26')](function(_0x8d4252){_0x58259f=_[_0xe0ca('0x2c')](_0x8d4252,function(_0x35ef95){return Number(_0x35ef95['UserId']);});})[_0xe0ca('0x26')](function(){var _0x40945c=_0xe0ca('0x56')+_0x280c90;return db[_0xe0ca('0x52')]['query'](_0x40945c,{'type':db[_0xe0ca('0x54')][_0xe0ca('0x55')][_0xe0ca('0x57')],'raw':!![],'transaction':_0x101f4a});})[_0xe0ca('0x26')](function(_0x4b0abb){var _0x330bc2=_[_0xe0ca('0x2c')](_0x4b0abb,function(_0x50556f){return Number(_0x50556f[_0xe0ca('0x58')]);});return db[_0xe0ca('0x59')][_0xe0ca('0x5a')]({'where':{'UserId':{'$in':_0x58259f},'VoiceQueueId':{'$in':_0x330bc2}},'transaction':_0x101f4a});})['then'](function(){var _0x20d24f=_0xe0ca('0x5b')+_0x280c90;return db[_0xe0ca('0x52')][_0xe0ca('0x34')](_0x20d24f,{'type':db[_0xe0ca('0x54')]['QueryTypes'][_0xe0ca('0x57')],'raw':!![],'transaction':_0x101f4a});})['then'](function(_0x4c0deb){var _0x35e6ba=_[_0xe0ca('0x2c')](_0x4c0deb,function(_0x2f208f){return Number(_0x2f208f[_0xe0ca('0x5c')]);});return db['UserMailQueue'][_0xe0ca('0x5a')]({'where':{'UserId':{'$in':_0x58259f},'MailQueueId':{'$in':_0x35e6ba}},'transaction':_0x101f4a});})[_0xe0ca('0x26')](function(){var _0xe7fdc1='SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20'+_0x280c90;return db['sequelize'][_0xe0ca('0x34')](_0xe7fdc1,{'type':db[_0xe0ca('0x54')][_0xe0ca('0x55')][_0xe0ca('0x57')],'raw':!![],'transaction':_0x101f4a});})['then'](function(_0x395769){var _0x7d4d9f=_['map'](_0x395769,function(_0x18ac31){return Number(_0x18ac31[_0xe0ca('0x5d')]);});return db['UserSmsQueue'][_0xe0ca('0x5a')]({'where':{'UserId':{'$in':_0x58259f},'SmsQueueId':{'$in':_0x7d4d9f}},'transaction':_0x101f4a});})[_0xe0ca('0x26')](function(){var _0x4da390=_0xe0ca('0x5e')+_0x280c90;return db[_0xe0ca('0x52')][_0xe0ca('0x34')](_0x4da390,{'type':db[_0xe0ca('0x54')]['QueryTypes'][_0xe0ca('0x57')],'raw':!![],'transaction':_0x101f4a});})['then'](function(_0x2768d7){var _0x58cd68=_[_0xe0ca('0x2c')](_0x2768d7,function(_0x491337){return Number(_0x491337['ChatQueueId']);});return db[_0xe0ca('0x5f')][_0xe0ca('0x5a')]({'where':{'UserId':{'$in':_0x58259f},'ChatQueueId':{'$in':_0x58cd68}},'transaction':_0x101f4a});})[_0xe0ca('0x26')](function(){var _0x48ec14=_0xe0ca('0x60')+_0x280c90;return db[_0xe0ca('0x52')][_0xe0ca('0x34')](_0x48ec14,{'type':db[_0xe0ca('0x54')][_0xe0ca('0x55')][_0xe0ca('0x57')],'raw':!![],'transaction':_0x101f4a});})[_0xe0ca('0x26')](function(_0xbd3f7){var _0x764239=_[_0xe0ca('0x2c')](_0xbd3f7,function(_0x1459d6){return Number(_0x1459d6[_0xe0ca('0x61')]);});return db[_0xe0ca('0x62')][_0xe0ca('0x5a')]({'where':{'UserId':{'$in':_0x58259f},'FaxQueueId':{'$in':_0x764239}},'transaction':_0x101f4a});})[_0xe0ca('0x26')](function(){var _0x4e8a9e=_0xe0ca('0x63')+_0x280c90;return db[_0xe0ca('0x52')][_0xe0ca('0x34')](_0x4e8a9e,{'type':db['Sequelize'][_0xe0ca('0x55')][_0xe0ca('0x57')],'raw':!![],'transaction':_0x101f4a});})[_0xe0ca('0x26')](function(_0x10fc92){var _0x157964=_[_0xe0ca('0x2c')](_0x10fc92,function(_0x82af2f){return Number(_0x82af2f['OpenchannelQueueId']);});return db[_0xe0ca('0x64')]['destroy']({'where':{'UserId':{'$in':_0x58259f},'OpenchannelQueueId':{'$in':_0x157964}},'transaction':_0x101f4a});})[_0xe0ca('0x26')](function(){var _0x3d5f15=_0xe0ca('0x65')+_0x280c90;return db[_0xe0ca('0x52')]['query'](_0x3d5f15,{'type':db['Sequelize'][_0xe0ca('0x55')][_0xe0ca('0x57')],'raw':!![],'transaction':_0x101f4a});})[_0xe0ca('0x26')](function(_0x2b8acc){var _0x318f06=_[_0xe0ca('0x2c')](_0x2b8acc,function(_0x58f5df){return Number(_0x58f5df[_0xe0ca('0x66')]);});return db['UserWhatsappQueue'][_0xe0ca('0x5a')]({'where':{'UserId':{'$in':_0x58259f},'WhatsappQueueId':{'$in':_0x318f06}},'transaction':_0x101f4a});})[_0xe0ca('0x26')](function(){return db[_0xe0ca('0x67')]['find']({'where':{'TeamId':_0x280c90}});})[_0xe0ca('0x26')](function(_0x1966f2){if(_0x1966f2===null){return;}return db[_0xe0ca('0x68')][_0xe0ca('0x5a')]({'where':{'UserId':{'$in':_0x58259f},'VoicePrefixId':_0x1966f2[_0xe0ca('0x69')]},'transaction':_0x101f4a});})['then'](function(){return db[_0xe0ca('0x2d')][_0xe0ca('0x5a')]({'where':{'id':_0x280c90},'cascade':!![],'transaction':_0x101f4a});})[_0xe0ca('0x26')](function(_0x61df89){if(_0x61df89===0x0){_0x363c52[_0xe0ca('0x1b')](0x194);}else{return db['UserProfileResource'][_0xe0ca('0x5a')]({'where':{'type':_0xe0ca('0x4d'),'resourceId':_0x280c90},'cascade':!![],'transaction':_0x101f4a})[_0xe0ca('0x26')](function(){_0x363c52[_0xe0ca('0x1c')](0xcc)[_0xe0ca('0x1d')]();});}})[_0xe0ca('0x42')](function(_0x4645e4){_0x363c52[_0xe0ca('0x1c')](0x1f4)[_0xe0ca('0x2a')](_0x4645e4);});});};exports['getQueues']=function(_0x551fc7,_0x20dae7,_0x295504){return db[_0xe0ca('0x2d')][_0xe0ca('0x6a')]({'where':{'id':_0x551fc7[_0xe0ca('0x43')]['id']}})[_0xe0ca('0x26')](handleEntityNotFound(_0x20dae7,null))['then'](function(_0xecbaa8){if(!_0x551fc7[_0xe0ca('0x34')][_0xe0ca('0x6b')]||!utils[_0xe0ca('0x6c')](_0x551fc7[_0xe0ca('0x34')][_0xe0ca('0x6b')])){throw new db[(_0xe0ca('0x54'))][(_0xe0ca('0x6d'))]('Unknown\x20channel');}var _0x4de4ff={};var _0x1e790c={};_0x1e790c['model']=_[_0xe0ca('0x44')](db[_[_0xe0ca('0x6e')](_0x551fc7[_0xe0ca('0x34')]['channel']['toLowerCase']())+_0xe0ca('0x6f')][_0xe0ca('0x2e')]);_0x1e790c['query']=_['keys'](_0x551fc7[_0xe0ca('0x34')]);_0x1e790c[_0xe0ca('0x33')]=_[_0xe0ca('0x45')](_0x1e790c['model'],_0x1e790c[_0xe0ca('0x34')]);_0x4de4ff['attributes']=_[_0xe0ca('0x45')](_0x1e790c['model'],qs['fields'](_0x551fc7[_0xe0ca('0x34')][_0xe0ca('0x35')]));_0x4de4ff[_0xe0ca('0x36')]=_0x4de4ff[_0xe0ca('0x36')][_0xe0ca('0x46')]?_0x4de4ff[_0xe0ca('0x36')]:_0x1e790c[_0xe0ca('0x32')];_0x4de4ff[_0xe0ca('0x20')]=qs[_0xe0ca('0x20')](_0x551fc7['query']['limit']);_0x4de4ff[_0xe0ca('0x1e')]=qs[_0xe0ca('0x1e')](_0x551fc7['query'][_0xe0ca('0x1e')]);_0x4de4ff[_0xe0ca('0x39')]=qs[_0xe0ca('0x3a')](_0x551fc7['query'][_0xe0ca('0x3a')]);_0x4de4ff[_0xe0ca('0x3b')]=qs['filters'](_['pick'](_0x551fc7[_0xe0ca('0x34')],_0x1e790c[_0xe0ca('0x33')]));_0x4de4ff=_[_0xe0ca('0x3d')]({},_0x4de4ff,_0x551fc7[_0xe0ca('0x3e')]);return _0xecbaa8[_0xe0ca('0x4a')+_[_0xe0ca('0x6e')](_0x551fc7['query'][_0xe0ca('0x6b')][_0xe0ca('0x70')]())+_0xe0ca('0x71')](_0x4de4ff);})[_0xe0ca('0x26')](respondWithResult(_0x20dae7,null))[_0xe0ca('0x42')](handleError(_0x20dae7,null));};exports[_0xe0ca('0x72')]=function(_0xe45abd,_0x360c36,_0xfc0a46){return db[_0xe0ca('0x2d')][_0xe0ca('0x6a')]({'where':{'id':_0xe45abd['params']['id']}})['then'](function(_0x386d08){if(_0x386d08){if(!_0xe45abd[_0xe0ca('0x49')][_0xe0ca('0x6b')]||!utils[_0xe0ca('0x6c')](_0xe45abd[_0xe0ca('0x49')][_0xe0ca('0x6b')])){throw new db[(_0xe0ca('0x54'))][(_0xe0ca('0x6d'))](_0xe0ca('0x73'));}return _0x386d08[_0xe0ca('0x74')+_['capitalize'](_0xe45abd[_0xe0ca('0x49')][_0xe0ca('0x6b')][_0xe0ca('0x70')]())+_0xe0ca('0x71')](_0xe45abd[_0xe0ca('0x49')][_0xe0ca('0x75')]);}return null;})[_0xe0ca('0x26')](handleEntityNotFound(_0x360c36,null))['then'](respondWithStatusCode(_0x360c36,null))[_0xe0ca('0x42')](handleError(_0x360c36,null));};exports[_0xe0ca('0x76')]=function(_0x819ee,_0x295090,_0x4112d8){return db['Team'][_0xe0ca('0x6a')]({'where':{'id':_0x819ee['params']['id']}})['then'](function(_0x17e7fb){if(_0x17e7fb){if(!_0x819ee[_0xe0ca('0x34')]['channel']||!utils[_0xe0ca('0x6c')](_0x819ee[_0xe0ca('0x34')]['channel'])){throw new db[(_0xe0ca('0x54'))]['ValidationError']('Unknown\x20channel');}return _0x17e7fb['remove'+_['capitalize'](_0x819ee[_0xe0ca('0x34')]['channel'][_0xe0ca('0x70')]())+_0xe0ca('0x71')](_0x819ee[_0xe0ca('0x34')]['ids']);}return null;})[_0xe0ca('0x26')](handleEntityNotFound(_0x295090,null))[_0xe0ca('0x26')](respondWithStatusCode(_0x295090,null))[_0xe0ca('0x42')](handleError(_0x295090,null));};exports['addAgents']=function(_0x45433a,_0x2c4a49){var _0x3141a5=_[_0xe0ca('0x77')](_0x45433a[_0xe0ca('0x49')][_0xe0ca('0x75')])?_0x45433a['body'][_0xe0ca('0x75')]:[_0x45433a[_0xe0ca('0x49')]['ids']];var _0x4e4111=_0x45433a[_0xe0ca('0x43')]['id'];return db['Team']['find']({'where':{'id':_0x4e4111}})[_0xe0ca('0x26')](handleEntityNotFound(_0x2c4a49,null))[_0xe0ca('0x26')](function(_0x567f6b){if(_0x567f6b){var _0x9a0071=[_0xe0ca('0x78'),_0xe0ca('0x79'),'Mail',_0xe0ca('0x7a'),_0xe0ca('0x7b'),_0xe0ca('0x7c'),_0xe0ca('0x7d')];return db['sequelize'][_0xe0ca('0x7e')](function(_0x2fd57c){var _0x52e45b=_[_0xe0ca('0x2c')](_0x9a0071,function(_0x1a1380){var _0x47513b={'attributes':['id',_0xe0ca('0x29')]};if(_0x1a1380==='Voice'){_0x47513b['through']={'attributes':[_0xe0ca('0x7f')]};}return _0x567f6b[_0xe0ca('0x4a')+_0x1a1380+_0xe0ca('0x71')](_0x47513b)[_0xe0ca('0x26')](function(_0x371e6f){var _0x234e4a=_[_0xe0ca('0x2c')](_0x371e6f,function(_0x11a23e){var _0x206376=_['map'](_0x3141a5,function(_0x4e79aa){var _0x44963e={'where':{'UserId':_0x4e79aa,[_0x1a1380+_0xe0ca('0x80')]:_0x11a23e['id']},'transaction':_0x2fd57c};if(_0x1a1380===_0xe0ca('0x78')){_0x44963e['defaults']={'penalty':_0x11a23e[_0xe0ca('0x81')]['penalty']};}return db[_0xe0ca('0x82')+_0x1a1380+_0xe0ca('0x6f')][_0xe0ca('0x83')](_0x44963e)['then'](function(){socket['emit'](_0xe0ca('0x4c')+_0x1a1380+_0xe0ca('0x84'),{'UserId':_0x4e79aa,[_0x1a1380+'QueueId']:_0x11a23e['id']});if(_0x1a1380!==_0xe0ca('0x78')){return;}return db[_0xe0ca('0x82')][_0xe0ca('0x85')]({'where':{'id':_0x3141a5,'online':0x1},'attributes':['id',_0xe0ca('0x29'),_0xe0ca('0x86'),'voicePause','interface'],'raw':!![]})['then'](function(_0x13ec1d){var _0x2cb38d=_[_0xe0ca('0x2c')](_0x13ec1d,function(_0xc3f58e){return db['UserVoiceQueueRt'][_0xe0ca('0x87')]({'membername':_0xc3f58e[_0xe0ca('0x29')],'UserId':_0xc3f58e['id'],'queue_name':_0x11a23e['name'],'VoiceQueueId':_0x11a23e['id'],'interface':_[_0xe0ca('0x88')](_0xc3f58e[_0xe0ca('0x89')])?util[_0xe0ca('0x8a')]('SIP/%s',_0xc3f58e[_0xe0ca('0x29')]):_0xc3f58e[_0xe0ca('0x89')],'paused':_0xc3f58e[_0xe0ca('0x8b')]||![],'penalty':_0x11a23e[_0xe0ca('0x81')]['penalty']},{'transaction':_0x2fd57c});});return Promise['all'](_0x2cb38d);});});});return Promise['all'](_0x206376);});return Promise[_0xe0ca('0x8c')](_0x234e4a);})[_0xe0ca('0x26')](function(){return db[_0xe0ca('0x67')][_0xe0ca('0x6a')]({'where':{'teamId':_0x4e4111}})[_0xe0ca('0x26')](function(_0x315022){if(_0x315022){var _0xbe7c6a=_[_0xe0ca('0x2c')](_0x3141a5,function(_0x43ec8c){db[_0xe0ca('0x68')]['upsert']({'UserId':_0x43ec8c,'VoicePrefixId':_0x315022[_0xe0ca('0x69')]});});return Promise[_0xe0ca('0x8c')](_0xbe7c6a);}});});});return Promise['all'](_0x52e45b)[_0xe0ca('0x26')](function(){return _0x567f6b[_0xe0ca('0x8d')](_0x3141a5,{'transaction':_0x2fd57c})['spread'](function(_0x27d8b8){return _0x27d8b8;});});});}})[_0xe0ca('0x26')](respondWithResult(_0x2c4a49,null))[_0xe0ca('0x42')](handleError(_0x2c4a49,null));};exports[_0xe0ca('0x8e')]=function(_0xb13b83,_0x301d18){var _0x2e30e9=_[_0xe0ca('0x77')](_0xb13b83[_0xe0ca('0x34')]['ids'])?_0xb13b83[_0xe0ca('0x34')][_0xe0ca('0x75')]:[_0xb13b83[_0xe0ca('0x34')][_0xe0ca('0x75')]];var _0x430cb1=_0xb13b83[_0xe0ca('0x43')]['id'];return db['Team']['find']({'where':{'id':_0x430cb1}})[_0xe0ca('0x26')](handleEntityNotFound(_0x301d18,null))[_0xe0ca('0x26')](function(_0x4752fd){if(_0x4752fd){var _0x469116=[_0xe0ca('0x78'),_0xe0ca('0x79'),_0xe0ca('0x8f'),'Sms','Fax','Openchannel',_0xe0ca('0x7d')];return db['sequelize'][_0xe0ca('0x7e')](function(_0x4bb9bc){var _0x23c224=_[_0xe0ca('0x2c')](_0x469116,function(_0x15a66c){var _0x50f094={'attributes':['id',_0xe0ca('0x29')]};return _0x4752fd[_0xe0ca('0x4a')+_0x15a66c+'Queues'](_0x50f094)['then'](function(_0x5169fe){var _0xe5cc77=_[_0xe0ca('0x2c')](_0x5169fe,function(_0x24f97e){return _0x24f97e[_0xe0ca('0x8e')](_0x2e30e9,{'transaction':_0x4bb9bc})['then'](function(){var _0x249a53=_[_0xe0ca('0x2c')](_0x2e30e9,function(_0x29f1dd){socket[_0xe0ca('0x90')](_0xe0ca('0x4c')+_0x15a66c+'Queue:remove',{'UserId':Number(_0x29f1dd),[_0x15a66c+_0xe0ca('0x80')]:_0x24f97e['id']});if(_0x15a66c!==_0xe0ca('0x78')){return;}return db['UserVoiceQueueRt']['destroy']({'where':{'VoiceQueueId':_0x24f97e['id'],'UserId':_0x29f1dd},'transaction':_0x4bb9bc});});return Promise['all'](_0x249a53);});});return Promise[_0xe0ca('0x8c')](_0xe5cc77);});});return Promise['all'](_0x23c224)[_0xe0ca('0x26')](function(){return _0x4752fd['removeAgents'](_0x2e30e9,{'transaction':_0x4bb9bc});})[_0xe0ca('0x26')](function(){return db[_0xe0ca('0x67')][_0xe0ca('0x6a')]({'where':{'teamId':_0x430cb1}})[_0xe0ca('0x26')](function(_0x1fb30b){if(_0x1fb30b){var _0x9a1e84=_['map'](_0x2e30e9,function(_0x4cf0d0){db[_0xe0ca('0x68')][_0xe0ca('0x5a')]({'where':{'UserId':_0x4cf0d0,'VoicePrefixId':_0x1fb30b[_0xe0ca('0x69')]}});});return Promise[_0xe0ca('0x8c')](_0x9a1e84);}});});});}})[_0xe0ca('0x26')](respondWithStatusCode(_0x301d18,null))[_0xe0ca('0x42')](handleError(_0x301d18,null));};exports['getAgents']=function(_0xeede3d,_0x360e99,_0x2a5e6c){var _0x1fded0={};var _0x363249={};var _0x1c7161;var _0x1bd641;return db['Team'][_0xe0ca('0x6a')]({'where':{'id':_0xeede3d[_0xe0ca('0x43')]['id']}})[_0xe0ca('0x26')](handleEntityNotFound(_0x360e99,null))[_0xe0ca('0x26')](function(_0x27245b){if(_0x27245b){_0x1c7161=_0x27245b;_0x363249['model']=_[_0xe0ca('0x44')](db[_0xe0ca('0x82')][_0xe0ca('0x2e')]);_0x363249['query']=_[_0xe0ca('0x44')](_0xeede3d[_0xe0ca('0x34')]);_0x363249[_0xe0ca('0x33')]=_[_0xe0ca('0x45')](_0x363249[_0xe0ca('0x32')],_0x363249[_0xe0ca('0x34')]);_0x1fded0[_0xe0ca('0x36')]=_[_0xe0ca('0x45')](_0x363249[_0xe0ca('0x32')],qs['fields'](_0xeede3d['query'][_0xe0ca('0x35')]));_0x1fded0[_0xe0ca('0x36')]=_0x1fded0[_0xe0ca('0x36')][_0xe0ca('0x46')]?_0x1fded0[_0xe0ca('0x36')]:_0x363249[_0xe0ca('0x32')];_0x1fded0['order']=qs['sort'](_0xeede3d[_0xe0ca('0x34')][_0xe0ca('0x3a')]);_0x1fded0['where']=qs[_0xe0ca('0x33')](_[_0xe0ca('0x91')](_0xeede3d[_0xe0ca('0x34')],_0x363249[_0xe0ca('0x33')]));if(_0xeede3d[_0xe0ca('0x34')][_0xe0ca('0x3c')]){_0x1fded0['where']=_[_0xe0ca('0x3d')](_0x1fded0['where'],{'$or':_[_0xe0ca('0x2c')](_0x1fded0[_0xe0ca('0x36')],function(_0x150795){var _0x1a4d2e={};_0x1a4d2e[_0x150795]={'$like':'%'+_0xeede3d[_0xe0ca('0x34')]['filter']+'%'};return _0x1a4d2e;})});}_0x1fded0=_[_0xe0ca('0x3d')]({},_0x1fded0,_0xeede3d[_0xe0ca('0x3e')]);return _0x1c7161['getAgents'](_0x1fded0);}})[_0xe0ca('0x26')](function(_0x19532a){if(_0x19532a){_0x1bd641=_0x19532a[_0xe0ca('0x46')];if(!_0xeede3d['query'][_0xe0ca('0x37')](_0xe0ca('0x38'))){_0x1fded0[_0xe0ca('0x20')]=qs[_0xe0ca('0x20')](_0xeede3d['query'][_0xe0ca('0x20')]);_0x1fded0[_0xe0ca('0x1e')]=qs[_0xe0ca('0x1e')](_0xeede3d[_0xe0ca('0x34')][_0xe0ca('0x1e')]);}return _0x1c7161[_0xe0ca('0x92')](_0x1fded0);}})[_0xe0ca('0x26')](function(_0x2165a9){if(_0x2165a9){return _0x2165a9?{'count':_0x1bd641,'rows':_0x2165a9}:null;}})[_0xe0ca('0x26')](respondWithResult(_0x360e99,null))['catch'](handleError(_0x360e99,null));}; \ No newline at end of file +var _0xf108=['fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./team.socket','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','stack','name','send','index','Team','rawAttributes','fieldName','type','model','map','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','findAll','then','rows','show','params','includeAll','include','catch','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Teams','find','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','destroy','sequelize','transaction','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','Sequelize','QueryTypes','SELECT','UserId','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','VoiceQueueId','UserVoiceQueue','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','MailQueueId','UserMailQueue','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','SmsQueueId','UserSmsQueue','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','ChatQueueId','UserChatQueue','FaxQueueId','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','OpenchannelQueueId','UserOpenchannelQueue','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','WhatsappQueueId','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','getQueues','findOne','isValidChannel','channel','Unknown\x20channel','capitalize','Queues','ValidationError','add','removeQueues','toLowerCase','ids','addAgents','isArray','Mail','Sms','Openchannel','Voice','through','penalty','QueueId','TeamVoiceQueue','findOrCreate','emit','Queue:save','User','voicePause','interface','UserVoiceQueueRt','upsert','isNil','format','all','spread','removeAgents','Chat','Fax','getAgents','hasOwnProperty','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv'];(function(_0x2417f9,_0x803ba4){var _0x142d82=function(_0xd430d1){while(--_0xd430d1){_0x2417f9['push'](_0x2417f9['shift']());}};_0x142d82(++_0x803ba4);}(_0xf108,0x133));var _0x8f10=function(_0x418ead,_0x128144){_0x418ead=_0x418ead-0x0;var _0x579d83=_0xf108[_0x418ead];return _0x579d83;};'use strict';var emlformat=require(_0x8f10('0x0'));var rimraf=require(_0x8f10('0x1'));var zipdir=require(_0x8f10('0x2'));var jsonpatch=require(_0x8f10('0x3'));var rp=require(_0x8f10('0x4'));var moment=require(_0x8f10('0x5'));var BPromise=require(_0x8f10('0x6'));var Mustache=require(_0x8f10('0x7'));var util=require(_0x8f10('0x8'));var path=require(_0x8f10('0x9'));var sox=require('sox');var csv=require(_0x8f10('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8f10('0xb'));var _=require(_0x8f10('0xc'));var squel=require(_0x8f10('0xd'));var crypto=require('crypto');var jsforce=require(_0x8f10('0xe'));var deskjs=require(_0x8f10('0xf'));var toCsv=require(_0x8f10('0xa'));var querystring=require(_0x8f10('0x10'));var Papa=require(_0x8f10('0x11'));var Redis=require(_0x8f10('0x12'));var authService=require(_0x8f10('0x13'));var qs=require(_0x8f10('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8f10('0x15'));var logger=require('../../config/logger')(_0x8f10('0x16'));var utils=require(_0x8f10('0x17'));var config=require(_0x8f10('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x8f10('0x19')]=_[_0x8f10('0x1a')](config[_0x8f10('0x19')],{'host':_0x8f10('0x1b'),'port':0x18eb});var socket=require(_0x8f10('0x1c'))(new Redis(config['redis']));require(_0x8f10('0x1d'))['register'](socket);function respondWithStatusCode(_0x9bbd7c,_0x33973c){_0x33973c=_0x33973c||0xcc;return function(_0x30569b){if(_0x30569b){return _0x9bbd7c[_0x8f10('0x1e')](_0x33973c);}return _0x9bbd7c['status'](_0x33973c)[_0x8f10('0x1f')]();};}function respondWithResult(_0x3f9702,_0x556124){_0x556124=_0x556124||0xc8;return function(_0x3d403f){if(_0x3d403f){return _0x3f9702[_0x8f10('0x20')](_0x556124)[_0x8f10('0x21')](_0x3d403f);}};}function respondWithFilteredResult(_0x179b88,_0x436d0a){return function(_0x3ca809){if(_0x3ca809){var _0x850710=typeof _0x436d0a[_0x8f10('0x22')]===_0x8f10('0x23')&&typeof _0x436d0a[_0x8f10('0x24')]==='undefined';var _0x268a66=_0x3ca809[_0x8f10('0x25')];var _0x1f52b5=_0x850710?0x0:_0x436d0a[_0x8f10('0x22')];var _0x453d5e=_0x850710?_0x3ca809[_0x8f10('0x25')]:_0x436d0a['offset']+_0x436d0a['limit'];var _0x502b06;if(_0x453d5e>=_0x268a66){_0x453d5e=_0x268a66;_0x502b06=0xc8;}else{_0x502b06=0xce;}_0x179b88[_0x8f10('0x20')](_0x502b06);return _0x179b88[_0x8f10('0x26')](_0x8f10('0x27'),_0x1f52b5+'-'+_0x453d5e+'/'+_0x268a66)[_0x8f10('0x21')](_0x3ca809);}return null;};}function patchUpdates(_0xd83bdc){return function(_0x50c7a6){try{jsonpatch[_0x8f10('0x28')](_0x50c7a6,_0xd83bdc,!![]);}catch(_0x578eef){return BPromise[_0x8f10('0x29')](_0x578eef);}return _0x50c7a6[_0x8f10('0x2a')]();};}function saveUpdates(_0x3f3eff,_0x139907){return function(_0x123918){if(_0x123918){return _0x123918[_0x8f10('0x2b')](_0x3f3eff)['then'](function(_0x4bc7a4){return _0x4bc7a4;});}return null;};}function handleEntityNotFound(_0xe34fc7,_0xd90e41){return function(_0xd44b08){if(!_0xd44b08){_0xe34fc7[_0x8f10('0x1e')](0x194);}return _0xd44b08;};}function handleError(_0x19ab3a,_0x132fdf){_0x132fdf=_0x132fdf||0x1f4;return function(_0x4ddbc5){logger['error'](_0x4ddbc5[_0x8f10('0x2c')]);if(_0x4ddbc5[_0x8f10('0x2d')]){delete _0x4ddbc5['name'];}_0x19ab3a[_0x8f10('0x20')](_0x132fdf)[_0x8f10('0x2e')](_0x4ddbc5);};}exports[_0x8f10('0x2f')]=function(_0x218bea,_0x3d907a){var _0xa23b22={},_0x391d1c={},_0x5ede2d={'count':0x0,'rows':[]};var _0x17cf71=_['map'](db[_0x8f10('0x30')][_0x8f10('0x31')],function(_0x265ece){return{'name':_0x265ece[_0x8f10('0x32')],'type':_0x265ece[_0x8f10('0x33')]['key']};});_0x391d1c[_0x8f10('0x34')]=_[_0x8f10('0x35')](_0x17cf71,_0x8f10('0x2d'));_0x391d1c[_0x8f10('0x36')]=_[_0x8f10('0x37')](_0x218bea['query']);_0x391d1c['filters']=_[_0x8f10('0x38')](_0x391d1c[_0x8f10('0x34')],_0x391d1c[_0x8f10('0x36')]);_0xa23b22[_0x8f10('0x39')]=_[_0x8f10('0x38')](_0x391d1c[_0x8f10('0x34')],qs[_0x8f10('0x3a')](_0x218bea[_0x8f10('0x36')]['fields']));_0xa23b22[_0x8f10('0x39')]=_0xa23b22['attributes'][_0x8f10('0x3b')]?_0xa23b22[_0x8f10('0x39')]:_0x391d1c[_0x8f10('0x34')];if(!_0x218bea[_0x8f10('0x36')]['hasOwnProperty'](_0x8f10('0x3c'))){_0xa23b22[_0x8f10('0x24')]=qs[_0x8f10('0x24')](_0x218bea[_0x8f10('0x36')][_0x8f10('0x24')]);_0xa23b22[_0x8f10('0x22')]=qs[_0x8f10('0x22')](_0x218bea[_0x8f10('0x36')][_0x8f10('0x22')]);}_0xa23b22[_0x8f10('0x3d')]=qs[_0x8f10('0x3e')](_0x218bea[_0x8f10('0x36')][_0x8f10('0x3e')]);_0xa23b22[_0x8f10('0x3f')]=qs[_0x8f10('0x40')](_[_0x8f10('0x41')](_0x218bea['query'],_0x391d1c[_0x8f10('0x40')]),_0x17cf71);if(_0x218bea['query'][_0x8f10('0x42')]){_0xa23b22[_0x8f10('0x3f')]=_[_0x8f10('0x43')](_0xa23b22['where'],{'$or':_['map'](_0x17cf71,function(_0x2b858a){if(_0x2b858a['type']!==_0x8f10('0x44')){var _0x2e37f2={};_0x2e37f2[_0x2b858a[_0x8f10('0x2d')]]={'$like':'%'+_0x218bea[_0x8f10('0x36')]['filter']+'%'};return _0x2e37f2;}})});}_0xa23b22=_[_0x8f10('0x43')]({},_0xa23b22,_0x218bea[_0x8f10('0x45')]);var _0x252c9b={'where':_0xa23b22[_0x8f10('0x3f')]};return db[_0x8f10('0x30')][_0x8f10('0x25')](_0x252c9b)['then'](function(_0xc74154){_0x5ede2d[_0x8f10('0x25')]=_0xc74154;if(_0x218bea['query']['includeAll']){_0xa23b22['include']=[{'all':!![]}];}return db[_0x8f10('0x30')][_0x8f10('0x46')](_0xa23b22);})[_0x8f10('0x47')](function(_0x2bb061){_0x5ede2d[_0x8f10('0x48')]=_0x2bb061;return _0x5ede2d;})[_0x8f10('0x47')](respondWithFilteredResult(_0x3d907a,_0xa23b22))['catch'](handleError(_0x3d907a,null));};exports[_0x8f10('0x49')]=function(_0x2431d3,_0x3ed53b){var _0x5c8499={'raw':![],'where':{'id':_0x2431d3[_0x8f10('0x4a')]['id']}},_0x1c9b42={};_0x1c9b42[_0x8f10('0x34')]=_[_0x8f10('0x37')](db[_0x8f10('0x30')][_0x8f10('0x31')]);_0x1c9b42[_0x8f10('0x36')]=_['keys'](_0x2431d3['query']);_0x1c9b42[_0x8f10('0x40')]=_['intersection'](_0x1c9b42[_0x8f10('0x34')],_0x1c9b42['query']);_0x5c8499[_0x8f10('0x39')]=_[_0x8f10('0x38')](_0x1c9b42[_0x8f10('0x34')],qs[_0x8f10('0x3a')](_0x2431d3['query']['fields']));_0x5c8499[_0x8f10('0x39')]=_0x5c8499[_0x8f10('0x39')][_0x8f10('0x3b')]?_0x5c8499['attributes']:_0x1c9b42[_0x8f10('0x34')];if(_0x2431d3['query'][_0x8f10('0x4b')]){_0x5c8499[_0x8f10('0x4c')]=[{'all':!![]}];}_0x5c8499=_[_0x8f10('0x43')]({},_0x5c8499,_0x2431d3[_0x8f10('0x45')]);return db[_0x8f10('0x30')]['find'](_0x5c8499)[_0x8f10('0x47')](handleEntityNotFound(_0x3ed53b,null))[_0x8f10('0x47')](respondWithResult(_0x3ed53b,null))[_0x8f10('0x4d')](handleError(_0x3ed53b,null));};exports[_0x8f10('0x4e')]=function(_0x128898,_0x1e871c){return db[_0x8f10('0x30')]['create'](_0x128898['body'],{})[_0x8f10('0x47')](function(_0x3b17e7){var _0x2936f5=_0x128898[_0x8f10('0x4f')][_0x8f10('0x50')]({'plain':!![]});if(!_0x2936f5)throw new Error(_0x8f10('0x51'));if(_0x2936f5[_0x8f10('0x52')]==='user'){var _0x44ded7=_0x3b17e7['get']({'plain':!![]});var _0x4b305e=_0x8f10('0x53');return db['UserProfileSection'][_0x8f10('0x54')]({'where':{'name':_0x4b305e,'userProfileId':_0x2936f5[_0x8f10('0x55')]},'raw':!![]})[_0x8f10('0x47')](function(_0x4bf7a2){if(_0x4bf7a2&&_0x4bf7a2[_0x8f10('0x56')]===0x0){return db[_0x8f10('0x57')]['create']({'name':_0x44ded7[_0x8f10('0x2d')],'resourceId':_0x44ded7['id'],'type':_0x4bf7a2['name'],'sectionId':_0x4bf7a2['id']},{})[_0x8f10('0x47')](function(){return _0x3b17e7;});}else{return _0x3b17e7;}})[_0x8f10('0x4d')](function(_0x19db51){logger[_0x8f10('0x58')](_0x8f10('0x59'),_0x19db51);throw _0x19db51;});}return _0x3b17e7;})[_0x8f10('0x47')](respondWithResult(_0x1e871c,0xc9))[_0x8f10('0x4d')](handleError(_0x1e871c,null));};exports[_0x8f10('0x2b')]=function(_0x52bf2c,_0x48ed03){if(_0x52bf2c[_0x8f10('0x5a')]['id']){delete _0x52bf2c['body']['id'];}return db[_0x8f10('0x30')][_0x8f10('0x54')]({'where':{'id':_0x52bf2c[_0x8f10('0x4a')]['id']}})[_0x8f10('0x47')](handleEntityNotFound(_0x48ed03,null))[_0x8f10('0x47')](saveUpdates(_0x52bf2c[_0x8f10('0x5a')],null))['then'](respondWithResult(_0x48ed03,null))[_0x8f10('0x4d')](handleError(_0x48ed03,null));};exports[_0x8f10('0x5b')]=function(_0xdfe686,_0x416ea5){var _0x27d8c3=_0xdfe686['params']['id'];var _0x39483b=[];return db[_0x8f10('0x5c')][_0x8f10('0x5d')](function(_0x48f30e){var _0x597e78=_0x8f10('0x5e')+_0x27d8c3;return db[_0x8f10('0x5c')][_0x8f10('0x36')](_0x597e78,{'type':db[_0x8f10('0x5f')][_0x8f10('0x60')][_0x8f10('0x61')],'raw':!![],'transaction':_0x48f30e})[_0x8f10('0x47')](function(_0x3f970b){_0x39483b=_[_0x8f10('0x35')](_0x3f970b,function(_0x2dafdb){return Number(_0x2dafdb[_0x8f10('0x62')]);});})['then'](function(){var _0x2f863d=_0x8f10('0x63')+_0x27d8c3;return db['sequelize'][_0x8f10('0x36')](_0x2f863d,{'type':db['Sequelize'][_0x8f10('0x60')][_0x8f10('0x61')],'raw':!![],'transaction':_0x48f30e});})['then'](function(_0x3bf276){var _0x11b212=_[_0x8f10('0x35')](_0x3bf276,function(_0xfa748f){return Number(_0xfa748f[_0x8f10('0x64')]);});return db[_0x8f10('0x65')][_0x8f10('0x5b')]({'where':{'UserId':{'$in':_0x39483b},'VoiceQueueId':{'$in':_0x11b212}},'transaction':_0x48f30e});})[_0x8f10('0x47')](function(){var _0x5040cf=_0x8f10('0x66')+_0x27d8c3;return db['sequelize']['query'](_0x5040cf,{'type':db[_0x8f10('0x5f')][_0x8f10('0x60')][_0x8f10('0x61')],'raw':!![],'transaction':_0x48f30e});})[_0x8f10('0x47')](function(_0x5c43d1){var _0x480126=_[_0x8f10('0x35')](_0x5c43d1,function(_0x19c018){return Number(_0x19c018[_0x8f10('0x67')]);});return db[_0x8f10('0x68')][_0x8f10('0x5b')]({'where':{'UserId':{'$in':_0x39483b},'MailQueueId':{'$in':_0x480126}},'transaction':_0x48f30e});})['then'](function(){var _0x5d1b4a=_0x8f10('0x69')+_0x27d8c3;return db[_0x8f10('0x5c')][_0x8f10('0x36')](_0x5d1b4a,{'type':db[_0x8f10('0x5f')][_0x8f10('0x60')][_0x8f10('0x61')],'raw':!![],'transaction':_0x48f30e});})['then'](function(_0x2d9ede){var _0x3eccdf=_[_0x8f10('0x35')](_0x2d9ede,function(_0x3d67f6){return Number(_0x3d67f6[_0x8f10('0x6a')]);});return db[_0x8f10('0x6b')][_0x8f10('0x5b')]({'where':{'UserId':{'$in':_0x39483b},'SmsQueueId':{'$in':_0x3eccdf}},'transaction':_0x48f30e});})[_0x8f10('0x47')](function(){var _0xf0d4d6=_0x8f10('0x6c')+_0x27d8c3;return db[_0x8f10('0x5c')][_0x8f10('0x36')](_0xf0d4d6,{'type':db[_0x8f10('0x5f')][_0x8f10('0x60')][_0x8f10('0x61')],'raw':!![],'transaction':_0x48f30e});})['then'](function(_0x314fa6){var _0x36e3f3=_['map'](_0x314fa6,function(_0x247647){return Number(_0x247647[_0x8f10('0x6d')]);});return db[_0x8f10('0x6e')][_0x8f10('0x5b')]({'where':{'UserId':{'$in':_0x39483b},'ChatQueueId':{'$in':_0x36e3f3}},'transaction':_0x48f30e});})[_0x8f10('0x47')](function(){var _0x26d86b='SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20'+_0x27d8c3;return db[_0x8f10('0x5c')][_0x8f10('0x36')](_0x26d86b,{'type':db[_0x8f10('0x5f')]['QueryTypes'][_0x8f10('0x61')],'raw':!![],'transaction':_0x48f30e});})[_0x8f10('0x47')](function(_0x28543f){var _0x2a4bfe=_[_0x8f10('0x35')](_0x28543f,function(_0x4bd837){return Number(_0x4bd837[_0x8f10('0x6f')]);});return db['UserFaxQueue'][_0x8f10('0x5b')]({'where':{'UserId':{'$in':_0x39483b},'FaxQueueId':{'$in':_0x2a4bfe}},'transaction':_0x48f30e});})[_0x8f10('0x47')](function(){var _0x329878=_0x8f10('0x70')+_0x27d8c3;return db[_0x8f10('0x5c')][_0x8f10('0x36')](_0x329878,{'type':db[_0x8f10('0x5f')]['QueryTypes'][_0x8f10('0x61')],'raw':!![],'transaction':_0x48f30e});})[_0x8f10('0x47')](function(_0x11fa04){var _0x4ba993=_[_0x8f10('0x35')](_0x11fa04,function(_0x2bc29a){return Number(_0x2bc29a[_0x8f10('0x71')]);});return db[_0x8f10('0x72')]['destroy']({'where':{'UserId':{'$in':_0x39483b},'OpenchannelQueueId':{'$in':_0x4ba993}},'transaction':_0x48f30e});})[_0x8f10('0x47')](function(){var _0x275b48=_0x8f10('0x73')+_0x27d8c3;return db[_0x8f10('0x5c')][_0x8f10('0x36')](_0x275b48,{'type':db[_0x8f10('0x5f')]['QueryTypes'][_0x8f10('0x61')],'raw':!![],'transaction':_0x48f30e});})[_0x8f10('0x47')](function(_0x2540f1){var _0x2bcdbb=_[_0x8f10('0x35')](_0x2540f1,function(_0x3d6c37){return Number(_0x3d6c37[_0x8f10('0x74')]);});return db['UserWhatsappQueue'][_0x8f10('0x5b')]({'where':{'UserId':{'$in':_0x39483b},'WhatsappQueueId':{'$in':_0x2bcdbb}},'transaction':_0x48f30e});})[_0x8f10('0x47')](function(){return db[_0x8f10('0x75')]['find']({'where':{'TeamId':_0x27d8c3}});})[_0x8f10('0x47')](function(_0x25b7e5){if(_0x25b7e5===null){return;}return db[_0x8f10('0x76')][_0x8f10('0x5b')]({'where':{'UserId':{'$in':_0x39483b},'VoicePrefixId':_0x25b7e5[_0x8f10('0x77')]},'transaction':_0x48f30e});})[_0x8f10('0x47')](function(){return db[_0x8f10('0x30')][_0x8f10('0x5b')]({'where':{'id':_0x27d8c3},'cascade':!![],'transaction':_0x48f30e});})[_0x8f10('0x47')](function(_0x4ab41a){if(_0x4ab41a===0x0){_0x416ea5['sendStatus'](0x194);}else{return db[_0x8f10('0x57')][_0x8f10('0x5b')]({'where':{'type':'Teams','resourceId':_0x27d8c3},'cascade':!![],'transaction':_0x48f30e})[_0x8f10('0x47')](function(){_0x416ea5[_0x8f10('0x20')](0xcc)[_0x8f10('0x1f')]();});}})[_0x8f10('0x4d')](function(_0x39e35f){_0x416ea5['status'](0x1f4)[_0x8f10('0x2e')](_0x39e35f);});});};exports[_0x8f10('0x78')]=function(_0x39ca9,_0x4864ce,_0x3c1351){return db[_0x8f10('0x30')][_0x8f10('0x79')]({'where':{'id':_0x39ca9[_0x8f10('0x4a')]['id']}})[_0x8f10('0x47')](handleEntityNotFound(_0x4864ce,null))['then'](function(_0x43dcff){if(!_0x39ca9[_0x8f10('0x36')]['channel']||!utils[_0x8f10('0x7a')](_0x39ca9[_0x8f10('0x36')][_0x8f10('0x7b')])){throw new db[(_0x8f10('0x5f'))]['ValidationError'](_0x8f10('0x7c'));}var _0x42f94b={};var _0x121745={};_0x121745[_0x8f10('0x34')]=_['keys'](db[_[_0x8f10('0x7d')](_0x39ca9['query'][_0x8f10('0x7b')]['toLowerCase']())+'Queue'][_0x8f10('0x31')]);_0x121745['query']=_[_0x8f10('0x37')](_0x39ca9[_0x8f10('0x36')]);_0x121745['filters']=_[_0x8f10('0x38')](_0x121745[_0x8f10('0x34')],_0x121745[_0x8f10('0x36')]);_0x42f94b[_0x8f10('0x39')]=_[_0x8f10('0x38')](_0x121745[_0x8f10('0x34')],qs[_0x8f10('0x3a')](_0x39ca9[_0x8f10('0x36')]['fields']));_0x42f94b[_0x8f10('0x39')]=_0x42f94b[_0x8f10('0x39')][_0x8f10('0x3b')]?_0x42f94b['attributes']:_0x121745['model'];_0x42f94b[_0x8f10('0x24')]=qs[_0x8f10('0x24')](_0x39ca9[_0x8f10('0x36')]['limit']);_0x42f94b[_0x8f10('0x22')]=qs[_0x8f10('0x22')](_0x39ca9[_0x8f10('0x36')][_0x8f10('0x22')]);_0x42f94b[_0x8f10('0x3d')]=qs['sort'](_0x39ca9[_0x8f10('0x36')][_0x8f10('0x3e')]);_0x42f94b[_0x8f10('0x3f')]=qs['filters'](_[_0x8f10('0x41')](_0x39ca9[_0x8f10('0x36')],_0x121745[_0x8f10('0x40')]));_0x42f94b=_[_0x8f10('0x43')]({},_0x42f94b,_0x39ca9[_0x8f10('0x45')]);return _0x43dcff[_0x8f10('0x50')+_[_0x8f10('0x7d')](_0x39ca9[_0x8f10('0x36')][_0x8f10('0x7b')]['toLowerCase']())+_0x8f10('0x7e')](_0x42f94b);})[_0x8f10('0x47')](respondWithResult(_0x4864ce,null))[_0x8f10('0x4d')](handleError(_0x4864ce,null));};exports['addQueues']=function(_0x11ed56,_0x320671,_0x51c3d5){return db[_0x8f10('0x30')][_0x8f10('0x79')]({'where':{'id':_0x11ed56[_0x8f10('0x4a')]['id']}})[_0x8f10('0x47')](function(_0x3d8a4c){if(_0x3d8a4c){if(!_0x11ed56[_0x8f10('0x5a')]['channel']||!utils[_0x8f10('0x7a')](_0x11ed56[_0x8f10('0x5a')][_0x8f10('0x7b')])){throw new db[(_0x8f10('0x5f'))][(_0x8f10('0x7f'))](_0x8f10('0x7c'));}return _0x3d8a4c[_0x8f10('0x80')+_[_0x8f10('0x7d')](_0x11ed56[_0x8f10('0x5a')][_0x8f10('0x7b')]['toLowerCase']())+_0x8f10('0x7e')](_0x11ed56[_0x8f10('0x5a')]['ids']);}return null;})[_0x8f10('0x47')](handleEntityNotFound(_0x320671,null))[_0x8f10('0x47')](respondWithStatusCode(_0x320671,null))[_0x8f10('0x4d')](handleError(_0x320671,null));};exports[_0x8f10('0x81')]=function(_0x28f491,_0x39232d,_0x217c8b){return db[_0x8f10('0x30')]['findOne']({'where':{'id':_0x28f491[_0x8f10('0x4a')]['id']}})['then'](function(_0x571175){if(_0x571175){if(!_0x28f491[_0x8f10('0x36')][_0x8f10('0x7b')]||!utils[_0x8f10('0x7a')](_0x28f491['query'][_0x8f10('0x7b')])){throw new db[(_0x8f10('0x5f'))][(_0x8f10('0x7f'))](_0x8f10('0x7c'));}return _0x571175['remove'+_[_0x8f10('0x7d')](_0x28f491['query'][_0x8f10('0x7b')][_0x8f10('0x82')]())+_0x8f10('0x7e')](_0x28f491[_0x8f10('0x36')][_0x8f10('0x83')]);}return null;})[_0x8f10('0x47')](handleEntityNotFound(_0x39232d,null))[_0x8f10('0x47')](respondWithStatusCode(_0x39232d,null))[_0x8f10('0x4d')](handleError(_0x39232d,null));};exports[_0x8f10('0x84')]=function(_0x3fbc30,_0x143c72){var _0x5103cc=_[_0x8f10('0x85')](_0x3fbc30['body'][_0x8f10('0x83')])?_0x3fbc30[_0x8f10('0x5a')][_0x8f10('0x83')]:[_0x3fbc30['body'][_0x8f10('0x83')]];var _0x23097f=_0x3fbc30[_0x8f10('0x4a')]['id'];return db[_0x8f10('0x30')][_0x8f10('0x54')]({'where':{'id':_0x23097f}})[_0x8f10('0x47')](handleEntityNotFound(_0x143c72,null))[_0x8f10('0x47')](function(_0x2ea8ae){if(_0x2ea8ae){var _0x5ce225=['Voice','Chat',_0x8f10('0x86'),_0x8f10('0x87'),'Fax',_0x8f10('0x88'),'Whatsapp'];return db[_0x8f10('0x5c')][_0x8f10('0x5d')](function(_0x3ac2f8){var _0x135423=_['map'](_0x5ce225,function(_0x2f3672){var _0x2c58ef={'attributes':['id','name']};if(_0x2f3672===_0x8f10('0x89')){_0x2c58ef[_0x8f10('0x8a')]={'attributes':[_0x8f10('0x8b')]};}return _0x2ea8ae[_0x8f10('0x50')+_0x2f3672+'Queues'](_0x2c58ef)[_0x8f10('0x47')](function(_0x29e79){var _0x121bb2=_[_0x8f10('0x35')](_0x29e79,function(_0x2a8a54){var _0x3ca20c=_[_0x8f10('0x35')](_0x5103cc,function(_0x4134d9){var _0x135e0d={'where':{'UserId':_0x4134d9,[_0x2f3672+_0x8f10('0x8c')]:_0x2a8a54['id']},'transaction':_0x3ac2f8};if(_0x2f3672===_0x8f10('0x89')){_0x135e0d[_0x8f10('0x1a')]={'penalty':_0x2a8a54[_0x8f10('0x8d')]['penalty']};}return db['User'+_0x2f3672+'Queue'][_0x8f10('0x8e')](_0x135e0d)[_0x8f10('0x47')](function(){socket[_0x8f10('0x8f')](_0x8f10('0x4f')+_0x2f3672+_0x8f10('0x90'),{'UserId':_0x4134d9,[_0x2f3672+_0x8f10('0x8c')]:_0x2a8a54['id']});if(_0x2f3672!==_0x8f10('0x89')){return;}return db[_0x8f10('0x91')][_0x8f10('0x46')]({'where':{'id':_0x5103cc,'online':0x1},'attributes':['id',_0x8f10('0x2d'),'online',_0x8f10('0x92'),_0x8f10('0x93')],'raw':!![]})[_0x8f10('0x47')](function(_0x4ce6c8){var _0x39aad3=_[_0x8f10('0x35')](_0x4ce6c8,function(_0x5cde39){return db[_0x8f10('0x94')][_0x8f10('0x95')]({'membername':_0x5cde39[_0x8f10('0x2d')],'UserId':_0x5cde39['id'],'queue_name':_0x2a8a54[_0x8f10('0x2d')],'VoiceQueueId':_0x2a8a54['id'],'interface':_[_0x8f10('0x96')](_0x5cde39[_0x8f10('0x93')])?util[_0x8f10('0x97')]('SIP/%s',_0x5cde39[_0x8f10('0x2d')]):_0x5cde39[_0x8f10('0x93')],'paused':_0x5cde39[_0x8f10('0x92')]||![],'penalty':_0x2a8a54[_0x8f10('0x8d')][_0x8f10('0x8b')]},{'transaction':_0x3ac2f8});});return Promise[_0x8f10('0x98')](_0x39aad3);});});});return Promise[_0x8f10('0x98')](_0x3ca20c);});return Promise[_0x8f10('0x98')](_0x121bb2);})[_0x8f10('0x47')](function(){return db[_0x8f10('0x75')]['findOne']({'where':{'teamId':_0x23097f}})['then'](function(_0x46fcf3){if(_0x46fcf3){var _0x319f8b=_[_0x8f10('0x35')](_0x5103cc,function(_0x3c8f3f){db[_0x8f10('0x76')][_0x8f10('0x95')]({'UserId':_0x3c8f3f,'VoicePrefixId':_0x46fcf3[_0x8f10('0x77')]});});return Promise[_0x8f10('0x98')](_0x319f8b);}});});});return Promise[_0x8f10('0x98')](_0x135423)[_0x8f10('0x47')](function(){return _0x2ea8ae[_0x8f10('0x84')](_0x5103cc,{'transaction':_0x3ac2f8})[_0x8f10('0x99')](function(_0x2f8a85){return _0x2f8a85;});});});}})[_0x8f10('0x47')](respondWithResult(_0x143c72,null))[_0x8f10('0x4d')](handleError(_0x143c72,null));};exports[_0x8f10('0x9a')]=function(_0xb8563f,_0xf35cfb){var _0x323f82=_[_0x8f10('0x85')](_0xb8563f[_0x8f10('0x36')][_0x8f10('0x83')])?_0xb8563f[_0x8f10('0x36')][_0x8f10('0x83')]:[_0xb8563f[_0x8f10('0x36')][_0x8f10('0x83')]];var _0x480298=_0xb8563f['params']['id'];return db['Team'][_0x8f10('0x54')]({'where':{'id':_0x480298}})['then'](handleEntityNotFound(_0xf35cfb,null))[_0x8f10('0x47')](function(_0x23d90f){if(_0x23d90f){var _0x48f56e=[_0x8f10('0x89'),_0x8f10('0x9b'),_0x8f10('0x86'),_0x8f10('0x87'),_0x8f10('0x9c'),'Openchannel','Whatsapp'];return db['sequelize']['transaction'](function(_0x287d6c){var _0x1c62e0=_['map'](_0x48f56e,function(_0xdb53ca){var _0x40e0cd={'attributes':['id',_0x8f10('0x2d')]};return _0x23d90f[_0x8f10('0x50')+_0xdb53ca+'Queues'](_0x40e0cd)[_0x8f10('0x47')](function(_0x16a25e){var _0x5776b6=_[_0x8f10('0x35')](_0x16a25e,function(_0x30256b){return _0x30256b[_0x8f10('0x9a')](_0x323f82,{'transaction':_0x287d6c})[_0x8f10('0x47')](function(){var _0x24083f=_['map'](_0x323f82,function(_0x3c917d){socket[_0x8f10('0x8f')](_0x8f10('0x4f')+_0xdb53ca+'Queue:remove',{'UserId':Number(_0x3c917d),[_0xdb53ca+_0x8f10('0x8c')]:_0x30256b['id']});if(_0xdb53ca!==_0x8f10('0x89')){return;}return db[_0x8f10('0x94')][_0x8f10('0x5b')]({'where':{'VoiceQueueId':_0x30256b['id'],'UserId':_0x3c917d},'transaction':_0x287d6c});});return Promise[_0x8f10('0x98')](_0x24083f);});});return Promise[_0x8f10('0x98')](_0x5776b6);});});return Promise[_0x8f10('0x98')](_0x1c62e0)[_0x8f10('0x47')](function(){return _0x23d90f[_0x8f10('0x9a')](_0x323f82,{'transaction':_0x287d6c});})[_0x8f10('0x47')](function(){return db[_0x8f10('0x75')]['findOne']({'where':{'teamId':_0x480298}})[_0x8f10('0x47')](function(_0x5c8e55){if(_0x5c8e55){var _0x9588e4=_[_0x8f10('0x35')](_0x323f82,function(_0x2bfc39){db[_0x8f10('0x76')][_0x8f10('0x5b')]({'where':{'UserId':_0x2bfc39,'VoicePrefixId':_0x5c8e55[_0x8f10('0x77')]}});});return Promise['all'](_0x9588e4);}});});});}})['then'](respondWithStatusCode(_0xf35cfb,null))[_0x8f10('0x4d')](handleError(_0xf35cfb,null));};exports[_0x8f10('0x9d')]=function(_0x3c4ddf,_0x4586cc,_0x16e371){var _0x1cfd0a={};var _0x2ac25f={};var _0x198eb4;var _0x1dd1f6;return db[_0x8f10('0x30')][_0x8f10('0x79')]({'where':{'id':_0x3c4ddf[_0x8f10('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4586cc,null))[_0x8f10('0x47')](function(_0x540c30){if(_0x540c30){_0x198eb4=_0x540c30;_0x2ac25f['model']=_['keys'](db[_0x8f10('0x91')][_0x8f10('0x31')]);_0x2ac25f[_0x8f10('0x36')]=_['keys'](_0x3c4ddf[_0x8f10('0x36')]);_0x2ac25f[_0x8f10('0x40')]=_[_0x8f10('0x38')](_0x2ac25f[_0x8f10('0x34')],_0x2ac25f['query']);_0x1cfd0a[_0x8f10('0x39')]=_[_0x8f10('0x38')](_0x2ac25f[_0x8f10('0x34')],qs[_0x8f10('0x3a')](_0x3c4ddf[_0x8f10('0x36')]['fields']));_0x1cfd0a[_0x8f10('0x39')]=_0x1cfd0a[_0x8f10('0x39')]['length']?_0x1cfd0a['attributes']:_0x2ac25f[_0x8f10('0x34')];_0x1cfd0a[_0x8f10('0x3d')]=qs[_0x8f10('0x3e')](_0x3c4ddf[_0x8f10('0x36')]['sort']);_0x1cfd0a[_0x8f10('0x3f')]=qs[_0x8f10('0x40')](_[_0x8f10('0x41')](_0x3c4ddf[_0x8f10('0x36')],_0x2ac25f[_0x8f10('0x40')]));if(_0x3c4ddf[_0x8f10('0x36')][_0x8f10('0x42')]){_0x1cfd0a[_0x8f10('0x3f')]=_[_0x8f10('0x43')](_0x1cfd0a['where'],{'$or':_['map'](_0x1cfd0a[_0x8f10('0x39')],function(_0xe5a979){var _0x6b16b={};_0x6b16b[_0xe5a979]={'$like':'%'+_0x3c4ddf['query']['filter']+'%'};return _0x6b16b;})});}_0x1cfd0a=_[_0x8f10('0x43')]({},_0x1cfd0a,_0x3c4ddf[_0x8f10('0x45')]);return _0x198eb4['getAgents'](_0x1cfd0a);}})[_0x8f10('0x47')](function(_0x5c4054){if(_0x5c4054){_0x1dd1f6=_0x5c4054[_0x8f10('0x3b')];if(!_0x3c4ddf[_0x8f10('0x36')][_0x8f10('0x9e')]('nolimit')){_0x1cfd0a[_0x8f10('0x24')]=qs[_0x8f10('0x24')](_0x3c4ddf['query'][_0x8f10('0x24')]);_0x1cfd0a[_0x8f10('0x22')]=qs['offset'](_0x3c4ddf[_0x8f10('0x36')][_0x8f10('0x22')]);}return _0x198eb4[_0x8f10('0x9d')](_0x1cfd0a);}})[_0x8f10('0x47')](function(_0xf4c4f8){if(_0xf4c4f8){return _0xf4c4f8?{'count':_0x1dd1f6,'rows':_0xf4c4f8}:null;}})[_0x8f10('0x47')](respondWithResult(_0x4586cc,null))[_0x8f10('0x4d')](handleError(_0x4586cc,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index 5c116af..ac80560 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 _0xf0de=['Team','save','update','emit','hasOwnProperty','hook','exports','../../mysqldb'];(function(_0x10bcef,_0x5222ac){var _0x66fb2a=function(_0x273ef8){while(--_0x273ef8){_0x10bcef['push'](_0x10bcef['shift']());}};_0x66fb2a(++_0x5222ac);}(_0xf0de,0x11f));var _0xef0d=function(_0x17f099,_0x2f5155){_0x17f099=_0x17f099-0x0;var _0x22c951=_0xf0de[_0x17f099];return _0x22c951;};'use strict';var EventEmitter=require('events');var Team=require(_0xef0d('0x0'))['db'][_0xef0d('0x1')];var TeamEvents=new EventEmitter();TeamEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xef0d('0x2'),'afterUpdate':_0xef0d('0x3'),'afterDestroy':'remove'};function emitEvent(_0x28fcfd){return function(_0x55d8d6,_0x1fdb07,_0x319262){TeamEvents[_0xef0d('0x4')](_0x28fcfd+':'+_0x55d8d6['id'],_0x55d8d6);TeamEvents[_0xef0d('0x4')](_0x28fcfd,_0x55d8d6);_0x319262(null);};}for(var e in events){if(events[_0xef0d('0x5')](e)){var event=events[e];Team[_0xef0d('0x6')](e,emitEvent(event));}}module[_0xef0d('0x7')]=TeamEvents; \ No newline at end of file +var _0x221f=['save','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners'];(function(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_0x221f,0xba));var _0xf221=function(_0x373096,_0x4d37aa){_0x373096=_0x373096-0x0;var _0x14a6d0=_0x221f[_0x373096];return _0x14a6d0;};'use strict';var EventEmitter=require(_0xf221('0x0'));var Team=require(_0xf221('0x1'))['db']['Team'];var TeamEvents=new EventEmitter();TeamEvents[_0xf221('0x2')](0x0);var events={'afterCreate':_0xf221('0x3'),'afterUpdate':_0xf221('0x4'),'afterDestroy':'remove'};function emitEvent(_0x14d218){return function(_0x2ca860,_0x3c8536,_0x16173a){TeamEvents[_0xf221('0x5')](_0x14d218+':'+_0x2ca860['id'],_0x2ca860);TeamEvents['emit'](_0x14d218,_0x2ca860);_0x16173a(null);};}for(var e in events){if(events[_0xf221('0x6')](e)){var event=events[e];Team[_0xf221('0x7')](e,emitEvent(event));}}module[_0xf221('0x8')]=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index 8661164..1117dba 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 _0xca30=['catch','exports','teams','Chat','Fax','Mail','Openchannel','Sms','Voice','Whatsapp','resolve','all','./team.attributes','get','Queues','then','map','setDataValue'];(function(_0xb42873,_0x2fa857){var _0x5b237a=function(_0x273cc1){while(--_0x273cc1){_0xb42873['push'](_0xb42873['shift']());}};_0x5b237a(++_0x2fa857);}(_0xca30,0x12c));var _0x0ca3=function(_0x231e16,_0x67347b){_0x231e16=_0x231e16-0x0;var _0x570a7c=_0xca30[_0x231e16];return _0x570a7c;};'use strict';var _=require('lodash');var attributes=require(_0x0ca3('0x0'));function getQueuesByChannel(_0x2a985d,_0x4cc97a){var _0x35c30a=_0x0ca3('0x1')+_0x4cc97a+_0x0ca3('0x2');return _0x2a985d[_0x35c30a]()[_0x0ca3('0x3')](function(_0x52d5ce){return _[_0x0ca3('0x4')](_0x52d5ce,function(_0x41faf5){_0x41faf5[_0x0ca3('0x5')]('channel',_0x4cc97a);return _0x41faf5;});})[_0x0ca3('0x6')](function(_0x44cd56){throw _0x44cd56;});}module[_0x0ca3('0x7')]=function(_0x593e70){return _0x593e70['define']('Team',attributes,{'tableName':_0x0ca3('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x2192a0=this;var _0x304c60=[_0x0ca3('0x9'),_0x0ca3('0xa'),_0x0ca3('0xb'),_0x0ca3('0xc'),_0x0ca3('0xd'),_0x0ca3('0xe'),_0x0ca3('0xf')];return Promise[_0x0ca3('0x10')]()[_0x0ca3('0x3')](function(){var _0x114f4f=_[_0x0ca3('0x4')](_0x304c60,function(_0x2db1d5){return getQueuesByChannel(_0x2192a0,_0x2db1d5);});return Promise[_0x0ca3('0x11')](_0x114f4f);})['catch'](function(_0x3eb68c){throw _0x3eb68c;});}}});}; \ No newline at end of file +var _0x69b6=['exports','define','Team','teams','Chat','Fax','Openchannel','Sms','Voice','resolve','all','./team.attributes','get','Queues','then','map','setDataValue','channel','catch'];(function(_0x5135f1,_0xf4d1b){var _0x1ad043=function(_0x2f8eb9){while(--_0x2f8eb9){_0x5135f1['push'](_0x5135f1['shift']());}};_0x1ad043(++_0xf4d1b);}(_0x69b6,0xdc));var _0x669b=function(_0x24c14e,_0x55fc09){_0x24c14e=_0x24c14e-0x0;var _0x589035=_0x69b6[_0x24c14e];return _0x589035;};'use strict';var _=require('lodash');var attributes=require(_0x669b('0x0'));function getQueuesByChannel(_0x33fff5,_0x2d3438){var _0x5898b5=_0x669b('0x1')+_0x2d3438+_0x669b('0x2');return _0x33fff5[_0x5898b5]()[_0x669b('0x3')](function(_0x3746b3){return _[_0x669b('0x4')](_0x3746b3,function(_0x1faf8b){_0x1faf8b[_0x669b('0x5')](_0x669b('0x6'),_0x2d3438);return _0x1faf8b;});})[_0x669b('0x7')](function(_0x56cade){throw _0x56cade;});}module[_0x669b('0x8')]=function(_0x319de5){return _0x319de5[_0x669b('0x9')](_0x669b('0xa'),attributes,{'tableName':_0x669b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0xf9abc7=this;var _0x2dc233=[_0x669b('0xc'),_0x669b('0xd'),'Mail',_0x669b('0xe'),_0x669b('0xf'),_0x669b('0x10'),'Whatsapp'];return Promise[_0x669b('0x11')]()[_0x669b('0x3')](function(){var _0x4c47e3=_[_0x669b('0x4')](_0x2dc233,function(_0x32e972){return getQueuesByChannel(_0xf9abc7,_0x32e972);});return Promise[_0x669b('0x12')](_0x4c47e3);})[_0x669b('0x7')](function(_0x871c42){throw _0x871c42;});}}});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index cd25b93..b625990 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 _0x0f88=['result','catch','lodash','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','localhost','redis','./team.socket','request','then','info','Team,\x20%s,\x20%s','debug','Team,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0f88,0xb1));var _0x80f8=function(_0xaff1bd,_0x5380c4){_0xaff1bd=_0xaff1bd-0x0;var _0x52ad89=_0x0f88[_0xaff1bd];return _0x52ad89;};'use strict';var _=require(_0x80f8('0x0'));var util=require('util');var moment=require(_0x80f8('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x80f8('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x80f8('0x3'));var logger=require(_0x80f8('0x4'))(_0x80f8('0x5'));var config=require(_0x80f8('0x6'));var jayson=require(_0x80f8('0x7'));var client=jayson[_0x80f8('0x8')][_0x80f8('0x9')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0x80f8('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x80f8('0xb')]));require(_0x80f8('0xc'))['register'](socket);function respondWithRpcPromise(_0x1e8501,_0x1e9ff6,_0x39e184){return new BPromise(function(_0x1cc6a8,_0x42c5f1){return client[_0x80f8('0xd')](_0x1e8501,_0x39e184)[_0x80f8('0xe')](function(_0x141b3b){logger[_0x80f8('0xf')](_0x80f8('0x10'),_0x1e9ff6,'request\x20sent');logger[_0x80f8('0x11')](_0x80f8('0x12'),_0x1e9ff6,_0x80f8('0x13'),JSON['stringify'](_0x141b3b));if(_0x141b3b[_0x80f8('0x14')]){if(_0x141b3b[_0x80f8('0x14')][_0x80f8('0x15')]===0x1f4){logger['error']('Team,\x20%s,\x20%s',_0x1e9ff6,_0x141b3b['error'][_0x80f8('0x16')]);return _0x42c5f1(_0x141b3b['error'][_0x80f8('0x16')]);}logger['error']('Team,\x20%s,\x20%s',_0x1e9ff6,_0x141b3b[_0x80f8('0x14')]['message']);return _0x1cc6a8(_0x141b3b[_0x80f8('0x14')][_0x80f8('0x16')]);}else{logger['info']('Team,\x20%s,\x20%s',_0x1e9ff6,'request\x20sent');_0x1cc6a8(_0x141b3b[_0x80f8('0x17')][_0x80f8('0x16')]);}})[_0x80f8('0x18')](function(_0x19faa9){logger[_0x80f8('0x14')](_0x80f8('0x10'),_0x1e9ff6,_0x19faa9);_0x42c5f1(_0x19faa9);});});} \ No newline at end of file +var _0x72c3=['stringify','error','code','message','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./team.socket','register','request','then','info','Team,\x20%s,\x20%s','request\x20sent'];(function(_0x39758d,_0x346423){var _0x44ac11=function(_0x175008){while(--_0x175008){_0x39758d['push'](_0x39758d['shift']());}};_0x44ac11(++_0x346423);}(_0x72c3,0xee));var _0x372c=function(_0x1c3656,_0x199592){_0x1c3656=_0x1c3656-0x0;var _0x1b373f=_0x72c3[_0x1c3656];return _0x1b373f;};'use strict';var _=require(_0x372c('0x0'));var util=require(_0x372c('0x1'));var moment=require(_0x372c('0x2'));var BPromise=require(_0x372c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x372c('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x372c('0x5'));var logger=require(_0x372c('0x6'))(_0x372c('0x7'));var config=require(_0x372c('0x8'));var jayson=require(_0x372c('0x9'));var client=jayson[_0x372c('0xa')]['http']({'port':0x232a});config[_0x372c('0xb')]=_[_0x372c('0xc')](config[_0x372c('0xb')],{'host':_0x372c('0xd'),'port':0x18eb});var socket=require(_0x372c('0xe'))(new Redis(config[_0x372c('0xb')]));require(_0x372c('0xf'))[_0x372c('0x10')](socket);function respondWithRpcPromise(_0x27ed96,_0x7314c0,_0x26e5f6){return new BPromise(function(_0x30b560,_0x2cf01f){return client[_0x372c('0x11')](_0x27ed96,_0x26e5f6)[_0x372c('0x12')](function(_0x15557d){logger[_0x372c('0x13')](_0x372c('0x14'),_0x7314c0,'request\x20sent');logger['debug']('Team,\x20%s,\x20%s,\x20%s',_0x7314c0,_0x372c('0x15'),JSON[_0x372c('0x16')](_0x15557d));if(_0x15557d[_0x372c('0x17')]){if(_0x15557d['error'][_0x372c('0x18')]===0x1f4){logger[_0x372c('0x17')](_0x372c('0x14'),_0x7314c0,_0x15557d['error']['message']);return _0x2cf01f(_0x15557d[_0x372c('0x17')][_0x372c('0x19')]);}logger[_0x372c('0x17')](_0x372c('0x14'),_0x7314c0,_0x15557d['error']['message']);return _0x30b560(_0x15557d[_0x372c('0x17')][_0x372c('0x19')]);}else{logger[_0x372c('0x13')](_0x372c('0x14'),_0x7314c0,_0x372c('0x15'));_0x30b560(_0x15557d['result'][_0x372c('0x19')]);}})['catch'](function(_0x376ba9){logger[_0x372c('0x17')](_0x372c('0x14'),_0x7314c0,_0x376ba9);_0x2cf01f(_0x376ba9);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index a119950..77adfa7 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 _0x8b09=['update','emit','removeListener','register','length','team:','./team.events','save','remove'];(function(_0x432723,_0x31e971){var _0x4f4991=function(_0x26e6cc){while(--_0x26e6cc){_0x432723['push'](_0x432723['shift']());}};_0x4f4991(++_0x31e971);}(_0x8b09,0x153));var _0x98b0=function(_0x57107e,_0x1f62aa){_0x57107e=_0x57107e-0x0;var _0x42c270=_0x8b09[_0x57107e];return _0x42c270;};'use strict';var TeamEvents=require(_0x98b0('0x0'));var events=[_0x98b0('0x1'),_0x98b0('0x2'),_0x98b0('0x3')];function createListener(_0x5e301b,_0x2e757a){return function(_0x4f0140){_0x2e757a[_0x98b0('0x4')](_0x5e301b,_0x4f0140);};}function removeListener(_0x54c6e7,_0x26e39d){return function(){TeamEvents[_0x98b0('0x5')](_0x54c6e7,_0x26e39d);};}exports[_0x98b0('0x6')]=function(_0x2c83d7){for(var _0x3ca831=0x0,_0x277011=events[_0x98b0('0x7')];_0x3ca831<_0x277011;_0x3ca831++){var _0xec2038=events[_0x3ca831];var _0x4ca573=createListener(_0x98b0('0x8')+_0xec2038,_0x2c83d7);TeamEvents['on'](_0xec2038,_0x4ca573);}}; \ No newline at end of file +var _0xef35=['remove','register','length','./team.events','save'];(function(_0x667081,_0x1d02b8){var _0x1c1e88=function(_0x4231c2){while(--_0x4231c2){_0x667081['push'](_0x667081['shift']());}};_0x1c1e88(++_0x1d02b8);}(_0xef35,0xa8));var _0x5ef3=function(_0x5400a1,_0x2275aa){_0x5400a1=_0x5400a1-0x0;var _0x4006c7=_0xef35[_0x5400a1];return _0x4006c7;};'use strict';var TeamEvents=require(_0x5ef3('0x0'));var events=[_0x5ef3('0x1'),_0x5ef3('0x2'),'update'];function createListener(_0x453729,_0x46f76c){return function(_0x52e34f){_0x46f76c['emit'](_0x453729,_0x52e34f);};}function removeListener(_0x4be930,_0x2c7e86){return function(){TeamEvents['removeListener'](_0x4be930,_0x2c7e86);};}exports[_0x5ef3('0x3')]=function(_0x2337b4){for(var _0xffaa70=0x0,_0x4b3014=events[_0x5ef3('0x4')];_0xffaa70<_0x4b3014;_0xffaa70++){var _0x528e8b=events[_0xffaa70];var _0x5e5366=createListener('team:'+_0x528e8b,_0x2337b4);TeamEvents['on'](_0x528e8b,_0x5e5366);}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js index 24ff946..d3ecf7c 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 _0x10d8=['INTEGER','sequelize','exports'];(function(_0x503950,_0x5022eb){var _0x1657a9=function(_0x4c1e8f){while(--_0x4c1e8f){_0x503950['push'](_0x503950['shift']());}};_0x1657a9(++_0x5022eb);}(_0x10d8,0xee));var _0x810d=function(_0x19e571,_0x5ef946){_0x19e571=_0x19e571-0x0;var _0x58bc9d=_0x10d8[_0x19e571];return _0x58bc9d;};'use strict';var Sequelize=require(_0x810d('0x0'));module[_0x810d('0x1')]={'TeamId':{'type':Sequelize[_0x810d('0x2')]},'VoicePrefixId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xe5fb=['exports','INTEGER','sequelize'];(function(_0x15bc81,_0x4d4f77){var _0x59440e=function(_0x1b60f2){while(--_0x1b60f2){_0x15bc81['push'](_0x15bc81['shift']());}};_0x59440e(++_0x4d4f77);}(_0xe5fb,0xce));var _0xbe5f=function(_0x34f545,_0x2bd2ee){_0x34f545=_0x34f545-0x0;var _0x1ff6b8=_0xe5fb[_0x34f545];return _0x1ff6b8;};'use strict';var Sequelize=require(_0xbe5f('0x0'));module[_0xbe5f('0x1')]={'TeamId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize[_0xbe5f('0x2')]}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.model.js b/server/api/teamVoicePrefix/teamVoicePrefix.model.js index ddf3339..3dce160 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 _0x5bc5=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./teamVoicePrefix.attributes','exports','define','TeamVoicePrefix','team_has_voice_prefixes','lodash','util'];(function(_0x15bdf7,_0xf4d9ec){var _0x27dced=function(_0xae169b){while(--_0xae169b){_0x15bdf7['push'](_0x15bdf7['shift']());}};_0x27dced(++_0xf4d9ec);}(_0x5bc5,0xb2));var _0x55bc=function(_0x3e5f6d,_0x121db6){_0x3e5f6d=_0x3e5f6d-0x0;var _0x1bea6e=_0x5bc5[_0x3e5f6d];return _0x1bea6e;};'use strict';var _=require(_0x55bc('0x0'));var util=require(_0x55bc('0x1'));var logger=require(_0x55bc('0x2'))(_0x55bc('0x3'));var moment=require(_0x55bc('0x4'));var BPromise=require(_0x55bc('0x5'));var rp=require(_0x55bc('0x6'));var fs=require('fs');var path=require(_0x55bc('0x7'));var rimraf=require(_0x55bc('0x8'));var config=require(_0x55bc('0x9'));var attributes=require(_0x55bc('0xa'));module[_0x55bc('0xb')]=function(_0x188eb6,_0x5d5f1d){return _0x188eb6[_0x55bc('0xc')](_0x55bc('0xd'),attributes,{'tableName':_0x55bc('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc0d6=['util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./teamVoicePrefix.attributes','exports','team_has_voice_prefixes'];(function(_0x275b7e,_0x2b9d42){var _0xae97c2=function(_0xfb66c7){while(--_0xfb66c7){_0x275b7e['push'](_0x275b7e['shift']());}};_0xae97c2(++_0x2b9d42);}(_0xc0d6,0x1ce));var _0x6c0d=function(_0x2131c4,_0x111841){_0x2131c4=_0x2131c4-0x0;var _0x2d4f9a=_0xc0d6[_0x2131c4];return _0x2d4f9a;};'use strict';var _=require('lodash');var util=require(_0x6c0d('0x0'));var logger=require('../../config/logger')(_0x6c0d('0x1'));var moment=require(_0x6c0d('0x2'));var BPromise=require(_0x6c0d('0x3'));var rp=require(_0x6c0d('0x4'));var fs=require('fs');var path=require(_0x6c0d('0x5'));var rimraf=require(_0x6c0d('0x6'));var config=require(_0x6c0d('0x7'));var attributes=require(_0x6c0d('0x8'));module[_0x6c0d('0x9')]=function(_0x32cbb6,_0x4caa83){return _0x32cbb6['define']('TeamVoicePrefix',attributes,{'tableName':_0x6c0d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/index.js b/server/api/teamVoiceQueue/index.js index 0c23c14..6c930b3 100644 --- a/server/api/teamVoiceQueue/index.js +++ b/server/api/teamVoiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x328f97,_0x1d5876){var _0x4b27bc=function(_0x38e592){while(--_0x38e592){_0x328f97['push'](_0x328f97['shift']());}};_0x4b27bc(++_0x1d5876);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x543670,_0x4d26b5){var _0x1e1c2d=function(_0x1dc07c){while(--_0x1dc07c){_0x543670['push'](_0x543670['shift']());}};_0x1e1c2d(++_0x4d26b5);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index fc90f7a..408e2a7 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 _0x6b45=['exports','INTEGER','sequelize'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x6b45,0xb0));var _0x56b4=function(_0x21c7d2,_0x76da0f){_0x21c7d2=_0x21c7d2-0x0;var _0x425c73=_0x6b45[_0x21c7d2];return _0x425c73;};'use strict';var Sequelize=require(_0x56b4('0x0'));module[_0x56b4('0x1')]={'penalty':{'type':Sequelize[_0x56b4('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x910c=['INTEGER','sequelize','exports'];(function(_0x3e41a2,_0x2cb766){var _0x19fe77=function(_0x13ec61){while(--_0x13ec61){_0x3e41a2['push'](_0x3e41a2['shift']());}};_0x19fe77(++_0x2cb766);}(_0x910c,0x12d));var _0xc910=function(_0x382c73,_0x199cab){_0x382c73=_0x382c73-0x0;var _0x1dd0bf=_0x910c[_0x382c73];return _0x1dd0bf;};'use strict';var Sequelize=require(_0xc910('0x0'));module[_0xc910('0x1')]={'penalty':{'type':Sequelize[_0xc910('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.model.js b/server/api/teamVoiceQueue/teamVoiceQueue.model.js index 543f98f..8614823 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 _0x24a6=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./teamVoiceQueue.attributes','exports','define','TeamVoiceQueue','team_has_voice_queues','lodash'];(function(_0x9b5c02,_0x5e6e0b){var _0x259a35=function(_0x22050b){while(--_0x22050b){_0x9b5c02['push'](_0x9b5c02['shift']());}};_0x259a35(++_0x5e6e0b);}(_0x24a6,0x14f));var _0x624a=function(_0x5a45cc,_0x4da97c){_0x5a45cc=_0x5a45cc-0x0;var _0x235c38=_0x24a6[_0x5a45cc];return _0x235c38;};'use strict';var _=require(_0x624a('0x0'));var util=require('util');var logger=require(_0x624a('0x1'))(_0x624a('0x2'));var moment=require(_0x624a('0x3'));var BPromise=require(_0x624a('0x4'));var rp=require(_0x624a('0x5'));var fs=require('fs');var path=require(_0x624a('0x6'));var rimraf=require(_0x624a('0x7'));var config=require(_0x624a('0x8'));var attributes=require(_0x624a('0x9'));module[_0x624a('0xa')]=function(_0x14fc3e,_0x325aea){return _0x14fc3e[_0x624a('0xb')](_0x624a('0xc'),attributes,{'tableName':_0x624a('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x165d=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','define'];(function(_0x36003d,_0x7ce312){var _0x69598d=function(_0x38c029){while(--_0x38c029){_0x36003d['push'](_0x36003d['shift']());}};_0x69598d(++_0x7ce312);}(_0x165d,0x14a));var _0xd165=function(_0x3f00a7,_0x317213){_0x3f00a7=_0x3f00a7-0x0;var _0x58ad99=_0x165d[_0x3f00a7];return _0x58ad99;};'use strict';var _=require(_0xd165('0x0'));var util=require(_0xd165('0x1'));var logger=require(_0xd165('0x2'))(_0xd165('0x3'));var moment=require(_0xd165('0x4'));var BPromise=require(_0xd165('0x5'));var rp=require(_0xd165('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd165('0x7'));var config=require(_0xd165('0x8'));var attributes=require('./teamVoiceQueue.attributes');module['exports']=function(_0x5435f9,_0x42d256){return _0x5435f9[_0xd165('0x9')]('TeamVoiceQueue',attributes,{'tableName':'team_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js b/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js index 52bc51b..a222a92 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 _0x128d=['message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','http','then','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x3fed77,_0xb3cddf){var _0x284013=function(_0x111220){while(--_0x111220){_0x3fed77['push'](_0x3fed77['shift']());}};_0x284013(++_0xb3cddf);}(_0x128d,0x179));var _0xd128=function(_0x544d19,_0x3bf184){_0x544d19=_0x544d19-0x0;var _0x1ea63e=_0x128d[_0x544d19];return _0x1ea63e;};'use strict';var _=require(_0xd128('0x0'));var util=require(_0xd128('0x1'));var moment=require(_0xd128('0x2'));var BPromise=require(_0xd128('0x3'));var rs=require(_0xd128('0x4'));var fs=require('fs');var Redis=require(_0xd128('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xd128('0x6'));var logger=require('../../config/logger')(_0xd128('0x7'));var config=require(_0xd128('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd128('0x9')][_0xd128('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x998c88,_0x5afe60,_0x1bec22){return new BPromise(function(_0x282e1d,_0x18372e){return client['request'](_0x998c88,_0x1bec22)[_0xd128('0xb')](function(_0x2113ba){logger['info'](_0xd128('0xc'),_0x5afe60,_0xd128('0xd'));logger[_0xd128('0xe')](_0xd128('0xf'),_0x5afe60,_0xd128('0xd'),JSON[_0xd128('0x10')](_0x2113ba));if(_0x2113ba[_0xd128('0x11')]){if(_0x2113ba['error'][_0xd128('0x12')]===0x1f4){logger[_0xd128('0x11')](_0xd128('0xc'),_0x5afe60,_0x2113ba['error'][_0xd128('0x13')]);return _0x18372e(_0x2113ba[_0xd128('0x11')][_0xd128('0x13')]);}logger[_0xd128('0x11')](_0xd128('0xc'),_0x5afe60,_0x2113ba[_0xd128('0x11')][_0xd128('0x13')]);return _0x282e1d(_0x2113ba[_0xd128('0x11')][_0xd128('0x13')]);}else{logger['info'](_0xd128('0xc'),_0x5afe60,_0xd128('0xd'));_0x282e1d(_0x2113ba[_0xd128('0x14')][_0xd128('0x13')]);}})[_0xd128('0x15')](function(_0x1a6307){logger[_0xd128('0x11')](_0xd128('0xc'),_0x5afe60,_0x1a6307);_0x18372e(_0x1a6307);});});} \ No newline at end of file +var _0xbf65=['jayson/promise','client','http','then','info','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x481b8f,_0x504fd2){var _0x4061ba=function(_0x5516ad){while(--_0x5516ad){_0x481b8f['push'](_0x481b8f['shift']());}};_0x4061ba(++_0x504fd2);}(_0xbf65,0x158));var _0x5bf6=function(_0x42f1e6,_0x372465){_0x42f1e6=_0x42f1e6-0x0;var _0xea2816=_0xbf65[_0x42f1e6];return _0xea2816;};'use strict';var _=require(_0x5bf6('0x0'));var util=require(_0x5bf6('0x1'));var moment=require('moment');var BPromise=require(_0x5bf6('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5bf6('0x3'));var db=require(_0x5bf6('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x5bf6('0x5'))(_0x5bf6('0x6'));var config=require(_0x5bf6('0x7'));var jayson=require(_0x5bf6('0x8'));var client=jayson[_0x5bf6('0x9')][_0x5bf6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x196305,_0x3e7a05,_0x32191a){return new BPromise(function(_0x5cd491,_0x27c1c6){return client['request'](_0x196305,_0x32191a)[_0x5bf6('0xb')](function(_0x47083e){logger[_0x5bf6('0xc')](_0x5bf6('0xd'),_0x3e7a05,_0x5bf6('0xe'));logger[_0x5bf6('0xf')](_0x5bf6('0x10'),_0x3e7a05,_0x5bf6('0xe'),JSON[_0x5bf6('0x11')](_0x47083e));if(_0x47083e['error']){if(_0x47083e[_0x5bf6('0x12')]['code']===0x1f4){logger[_0x5bf6('0x12')](_0x5bf6('0xd'),_0x3e7a05,_0x47083e[_0x5bf6('0x12')][_0x5bf6('0x13')]);return _0x27c1c6(_0x47083e[_0x5bf6('0x12')]['message']);}logger[_0x5bf6('0x12')](_0x5bf6('0xd'),_0x3e7a05,_0x47083e[_0x5bf6('0x12')][_0x5bf6('0x13')]);return _0x5cd491(_0x47083e[_0x5bf6('0x12')][_0x5bf6('0x13')]);}else{logger[_0x5bf6('0xc')](_0x5bf6('0xd'),_0x3e7a05,_0x5bf6('0xe'));_0x5cd491(_0x47083e[_0x5bf6('0x14')][_0x5bf6('0x13')]);}})[_0x5bf6('0x15')](function(_0x26bd08){logger['error']('TeamVoiceQueue,\x20%s,\x20%s',_0x3e7a05,_0x26bd08);_0x27c1c6(_0x26bd08);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index af567a9..380adb4 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 _0x2ebd=['multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./template.controller','index','get','/:id','isAuthenticated','show','create','update','delete','destroy','exports'];(function(_0x794207,_0x54a989){var _0x4ee1c9=function(_0x136ea4){while(--_0x136ea4){_0x794207['push'](_0x794207['shift']());}};_0x4ee1c9(++_0x54a989);}(_0x2ebd,0x1c8));var _0xd2eb=function(_0x51167d,_0x208fdf){_0x51167d=_0x51167d-0x0;var _0x59203b=_0x2ebd[_0x51167d];return _0x59203b;};'use strict';var multer=require(_0xd2eb('0x0'));var util=require(_0xd2eb('0x1'));var path=require(_0xd2eb('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xd2eb('0x3')]();var fs_extra=require(_0xd2eb('0x4'));var auth=require(_0xd2eb('0x5'));var interaction=require(_0xd2eb('0x6'));var config=require(_0xd2eb('0x7'));var controller=require(_0xd2eb('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xd2eb('0x9')]);router[_0xd2eb('0xa')](_0xd2eb('0xb'),auth[_0xd2eb('0xc')](),controller[_0xd2eb('0xd')]);router['post']('/',auth[_0xd2eb('0xc')](),controller[_0xd2eb('0xe')]);router['put']('/:id',auth[_0xd2eb('0xc')](),controller[_0xd2eb('0xf')]);router[_0xd2eb('0x10')](_0xd2eb('0xb'),auth[_0xd2eb('0xc')](),controller[_0xd2eb('0x11')]);module[_0xd2eb('0x12')]=router; \ No newline at end of file +var _0x7f59=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated','show','post','delete','destroy','exports','multer','util','connect-timeout','express'];(function(_0x33032e,_0x31411a){var _0x13316b=function(_0x2fb049){while(--_0x2fb049){_0x33032e['push'](_0x33032e['shift']());}};_0x13316b(++_0x31411a);}(_0x7f59,0x12e));var _0x97f5=function(_0xe2c378,_0x22a18a){_0xe2c378=_0xe2c378-0x0;var _0x4870de=_0x7f59[_0xe2c378];return _0x4870de;};'use strict';var multer=require(_0x97f5('0x0'));var util=require(_0x97f5('0x1'));var path=require('path');var timeout=require(_0x97f5('0x2'));var express=require(_0x97f5('0x3'));var router=express[_0x97f5('0x4')]();var fs_extra=require(_0x97f5('0x5'));var auth=require(_0x97f5('0x6'));var interaction=require(_0x97f5('0x7'));var config=require(_0x97f5('0x8'));var controller=require('./template.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x97f5('0x9')](_0x97f5('0xa'),auth[_0x97f5('0xb')](),controller[_0x97f5('0xc')]);router[_0x97f5('0xd')]('/',auth[_0x97f5('0xb')](),controller['create']);router['put']('/:id',auth[_0x97f5('0xb')](),controller['update']);router[_0x97f5('0xe')](_0x97f5('0xa'),auth['isAuthenticated'](),controller[_0x97f5('0xf')]);module[_0x97f5('0x10')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index 9db4fde..ebe33e5 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 _0xcfb8=['TEXT','exports','STRING'];(function(_0x165c96,_0x5069d0){var _0x588015=function(_0x5062c9){while(--_0x5062c9){_0x165c96['push'](_0x165c96['shift']());}};_0x588015(++_0x5069d0);}(_0xcfb8,0x7f));var _0x8cfb=function(_0x519477,_0x4ca44b){_0x519477=_0x519477-0x0;var _0x5e3b52=_0xcfb8[_0x519477];return _0x5e3b52;};'use strict';var Sequelize=require('sequelize');module[_0x8cfb('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x8cfb('0x1')]},'html':{'type':Sequelize[_0x8cfb('0x2')]}}; \ No newline at end of file +var _0x76bc=['exports','STRING','TEXT','sequelize'];(function(_0x401093,_0x2621f4){var _0x3358ac=function(_0x5adb37){while(--_0x5adb37){_0x401093['push'](_0x401093['shift']());}};_0x3358ac(++_0x2621f4);}(_0x76bc,0xc3));var _0xc76b=function(_0x2440fe,_0x281a11){_0x2440fe=_0x2440fe-0x0;var _0x5cf734=_0x76bc[_0x2440fe];return _0x5cf734;};'use strict';var Sequelize=require(_0xc76b('0x0'));module[_0xc76b('0x1')]={'name':{'type':Sequelize[_0xc76b('0x2')]},'description':{'type':Sequelize[_0xc76b('0x2')]},'html':{'type':Sequelize[_0xc76b('0x3')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index b8a0de3..bce25a1 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 _0xb1ec=['role','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','get','Templates','destroy','error','stack','name','send','index','Template','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','order','sort','where','merge','map','filter','includeAll','include','findAll','rows','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xb1ec,0xfc));var _0xcb1e=function(_0x1255d1,_0x508ded){_0x1255d1=_0x1255d1-0x0;var _0x3c419a=_0xb1ec[_0x1255d1];return _0x3c419a;};'use strict';var emlformat=require(_0xcb1e('0x0'));var rimraf=require(_0xcb1e('0x1'));var zipdir=require(_0xcb1e('0x2'));var jsonpatch=require(_0xcb1e('0x3'));var rp=require(_0xcb1e('0x4'));var moment=require(_0xcb1e('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xcb1e('0x6'));var util=require(_0xcb1e('0x7'));var path=require(_0xcb1e('0x8'));var sox=require('sox');var csv=require(_0xcb1e('0x9'));var ejs=require(_0xcb1e('0xa'));var fs=require('fs');var fs_extra=require(_0xcb1e('0xb'));var _=require('lodash');var squel=require(_0xcb1e('0xc'));var crypto=require(_0xcb1e('0xd'));var jsforce=require(_0xcb1e('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xcb1e('0xf'));var Redis=require(_0xcb1e('0x10'));var authService=require(_0xcb1e('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xcb1e('0x12'));var hardwareService=require(_0xcb1e('0x13'));var logger=require(_0xcb1e('0x14'))('api');var utils=require('../../config/utils');var config=require(_0xcb1e('0x15'));var licenseUtil=require(_0xcb1e('0x16'));var db=require(_0xcb1e('0x17'))['db'];function respondWithStatusCode(_0x25bf37,_0x504da6){_0x504da6=_0x504da6||0xcc;return function(_0x12479d){if(_0x12479d){return _0x25bf37[_0xcb1e('0x18')](_0x504da6);}return _0x25bf37['status'](_0x504da6)[_0xcb1e('0x19')]();};}function respondWithResult(_0xef0d61,_0x527313){_0x527313=_0x527313||0xc8;return function(_0x1ad5ba){if(_0x1ad5ba){return _0xef0d61[_0xcb1e('0x1a')](_0x527313)[_0xcb1e('0x1b')](_0x1ad5ba);}};}function respondWithFilteredResult(_0x2f1361,_0x50c3ae){return function(_0x427cea){if(_0x427cea){var _0x111056=typeof _0x50c3ae['offset']===_0xcb1e('0x1c')&&typeof _0x50c3ae[_0xcb1e('0x1d')]===_0xcb1e('0x1c');var _0x5b3f5e=_0x427cea[_0xcb1e('0x1e')];var _0x324663=_0x111056?0x0:_0x50c3ae[_0xcb1e('0x1f')];var _0x4b5d45=_0x111056?_0x427cea[_0xcb1e('0x1e')]:_0x50c3ae[_0xcb1e('0x1f')]+_0x50c3ae[_0xcb1e('0x1d')];var _0xdb5ad9;if(_0x4b5d45>=_0x5b3f5e){_0x4b5d45=_0x5b3f5e;_0xdb5ad9=0xc8;}else{_0xdb5ad9=0xce;}_0x2f1361['status'](_0xdb5ad9);return _0x2f1361[_0xcb1e('0x20')](_0xcb1e('0x21'),_0x324663+'-'+_0x4b5d45+'/'+_0x5b3f5e)[_0xcb1e('0x1b')](_0x427cea);}return null;};}function patchUpdates(_0x4df568){return function(_0x1e99c2){try{jsonpatch[_0xcb1e('0x22')](_0x1e99c2,_0x4df568,!![]);}catch(_0x5843e3){return BPromise[_0xcb1e('0x23')](_0x5843e3);}return _0x1e99c2['save']();};}function saveUpdates(_0x56c6bb,_0x5cc6d8){return function(_0x2da9f8){if(_0x2da9f8){return _0x2da9f8[_0xcb1e('0x24')](_0x56c6bb)[_0xcb1e('0x25')](function(_0x269336){return _0x269336;});}return null;};}function removeEntity(_0x316d5c,_0x4a00a0){return function(_0x1a9138){if(_0x1a9138){return _0x1a9138['destroy']()[_0xcb1e('0x25')](function(){var _0x2417f6=_0x1a9138[_0xcb1e('0x26')]({'plain':!![]});var _0x5a8bd0=_0xcb1e('0x27');return db['UserProfileResource'][_0xcb1e('0x28')]({'where':{'type':_0x5a8bd0,'resourceId':_0x2417f6['id']}})['then'](function(){return _0x1a9138;});})[_0xcb1e('0x25')](function(){_0x316d5c[_0xcb1e('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4bd6d1,_0x54a1b8){return function(_0x58c116){if(!_0x58c116){_0x4bd6d1[_0xcb1e('0x18')](0x194);}return _0x58c116;};}function handleError(_0x199aa8,_0xe29226){_0xe29226=_0xe29226||0x1f4;return function(_0x1bdea2){logger[_0xcb1e('0x29')](_0x1bdea2[_0xcb1e('0x2a')]);if(_0x1bdea2[_0xcb1e('0x2b')]){delete _0x1bdea2[_0xcb1e('0x2b')];}_0x199aa8[_0xcb1e('0x1a')](_0xe29226)[_0xcb1e('0x2c')](_0x1bdea2);};}exports[_0xcb1e('0x2d')]=function(_0x35158c,_0x54f7af){var _0x111983={},_0x2313e5={},_0x3ddea0={'count':0x0,'rows':[]};var _0x1af61c=_['map'](db[_0xcb1e('0x2e')][_0xcb1e('0x2f')],function(_0x4355d0){return{'name':_0x4355d0[_0xcb1e('0x30')],'type':_0x4355d0[_0xcb1e('0x31')]['key']};});_0x2313e5[_0xcb1e('0x32')]=_['map'](_0x1af61c,'name');_0x2313e5[_0xcb1e('0x33')]=_[_0xcb1e('0x34')](_0x35158c[_0xcb1e('0x33')]);_0x2313e5[_0xcb1e('0x35')]=_['intersection'](_0x2313e5[_0xcb1e('0x32')],_0x2313e5[_0xcb1e('0x33')]);_0x111983['attributes']=_[_0xcb1e('0x36')](_0x2313e5[_0xcb1e('0x32')],qs['fields'](_0x35158c[_0xcb1e('0x33')][_0xcb1e('0x37')]));_0x111983[_0xcb1e('0x38')]=_0x111983[_0xcb1e('0x38')][_0xcb1e('0x39')]?_0x111983[_0xcb1e('0x38')]:_0x2313e5[_0xcb1e('0x32')];if(!_0x35158c[_0xcb1e('0x33')]['hasOwnProperty']('nolimit')){_0x111983[_0xcb1e('0x1d')]=qs[_0xcb1e('0x1d')](_0x35158c[_0xcb1e('0x33')]['limit']);_0x111983[_0xcb1e('0x1f')]=qs['offset'](_0x35158c[_0xcb1e('0x33')][_0xcb1e('0x1f')]);}_0x111983[_0xcb1e('0x3a')]=qs['sort'](_0x35158c[_0xcb1e('0x33')][_0xcb1e('0x3b')]);_0x111983[_0xcb1e('0x3c')]=qs['filters'](_['pick'](_0x35158c['query'],_0x2313e5[_0xcb1e('0x35')]),_0x1af61c);if(_0x35158c['query']['filter']){_0x111983[_0xcb1e('0x3c')]=_[_0xcb1e('0x3d')](_0x111983['where'],{'$or':_[_0xcb1e('0x3e')](_0x1af61c,function(_0x1ec78b){if(_0x1ec78b[_0xcb1e('0x31')]!=='VIRTUAL'){var _0x26a937={};_0x26a937[_0x1ec78b[_0xcb1e('0x2b')]]={'$like':'%'+_0x35158c['query'][_0xcb1e('0x3f')]+'%'};return _0x26a937;}})});}_0x111983=_[_0xcb1e('0x3d')]({},_0x111983,_0x35158c['options']);var _0x5a7dd1={'where':_0x111983[_0xcb1e('0x3c')]};return db[_0xcb1e('0x2e')]['count'](_0x5a7dd1)[_0xcb1e('0x25')](function(_0x4a8995){_0x3ddea0[_0xcb1e('0x1e')]=_0x4a8995;if(_0x35158c['query'][_0xcb1e('0x40')]){_0x111983[_0xcb1e('0x41')]=[{'all':!![]}];}return db[_0xcb1e('0x2e')][_0xcb1e('0x42')](_0x111983);})[_0xcb1e('0x25')](function(_0x384217){_0x3ddea0[_0xcb1e('0x43')]=_0x384217;return _0x3ddea0;})['then'](respondWithFilteredResult(_0x54f7af,_0x111983))[_0xcb1e('0x44')](handleError(_0x54f7af,null));};exports['show']=function(_0x380ae8,_0x5de766){var _0x2452b1={'raw':!![],'where':{'id':_0x380ae8['params']['id']}},_0x471846={};_0x471846[_0xcb1e('0x32')]=_[_0xcb1e('0x34')](db['Template']['rawAttributes']);_0x471846[_0xcb1e('0x33')]=_[_0xcb1e('0x34')](_0x380ae8[_0xcb1e('0x33')]);_0x471846[_0xcb1e('0x35')]=_[_0xcb1e('0x36')](_0x471846[_0xcb1e('0x32')],_0x471846['query']);_0x2452b1[_0xcb1e('0x38')]=_['intersection'](_0x471846[_0xcb1e('0x32')],qs[_0xcb1e('0x37')](_0x380ae8[_0xcb1e('0x33')][_0xcb1e('0x37')]));_0x2452b1[_0xcb1e('0x38')]=_0x2452b1[_0xcb1e('0x38')]['length']?_0x2452b1[_0xcb1e('0x38')]:_0x471846[_0xcb1e('0x32')];if(_0x380ae8[_0xcb1e('0x33')][_0xcb1e('0x40')]){_0x2452b1[_0xcb1e('0x41')]=[{'all':!![]}];}_0x2452b1=_['merge']({},_0x2452b1,_0x380ae8['options']);return db[_0xcb1e('0x2e')]['find'](_0x2452b1)[_0xcb1e('0x25')](handleEntityNotFound(_0x5de766,null))['then'](respondWithResult(_0x5de766,null))['catch'](handleError(_0x5de766,null));};exports[_0xcb1e('0x45')]=function(_0x4d5873,_0x54a1c3){return db[_0xcb1e('0x2e')][_0xcb1e('0x45')](_0x4d5873['body'],{})[_0xcb1e('0x25')](function(_0x108526){var _0x343deb=_0x4d5873[_0xcb1e('0x46')]['get']({'plain':!![]});if(!_0x343deb)throw new Error(_0xcb1e('0x47'));if(_0x343deb[_0xcb1e('0x48')]===_0xcb1e('0x46')){var _0x479ab6=_0x108526['get']({'plain':!![]});var _0x1e58b4=_0xcb1e('0x27');return db[_0xcb1e('0x49')][_0xcb1e('0x4a')]({'where':{'name':_0x1e58b4,'userProfileId':_0x343deb[_0xcb1e('0x4b')]},'raw':!![]})[_0xcb1e('0x25')](function(_0xcd8d0f){if(_0xcd8d0f&&_0xcd8d0f[_0xcb1e('0x4c')]===0x0){return db[_0xcb1e('0x4d')][_0xcb1e('0x45')]({'name':_0x479ab6[_0xcb1e('0x2b')],'resourceId':_0x479ab6['id'],'type':_0xcd8d0f[_0xcb1e('0x2b')],'sectionId':_0xcd8d0f['id']},{})['then'](function(){return _0x108526;});}else{return _0x108526;}})[_0xcb1e('0x44')](function(_0x382159){logger[_0xcb1e('0x29')](_0xcb1e('0x4e'),_0x382159);throw _0x382159;});}return _0x108526;})[_0xcb1e('0x25')](respondWithResult(_0x54a1c3,0xc9))[_0xcb1e('0x44')](handleError(_0x54a1c3,null));};exports[_0xcb1e('0x24')]=function(_0x32295f,_0x3fedd0){if(_0x32295f[_0xcb1e('0x4f')]['id']){delete _0x32295f[_0xcb1e('0x4f')]['id'];}return db[_0xcb1e('0x2e')]['find']({'where':{'id':_0x32295f[_0xcb1e('0x50')]['id']}})[_0xcb1e('0x25')](handleEntityNotFound(_0x3fedd0,null))[_0xcb1e('0x25')](saveUpdates(_0x32295f['body'],null))[_0xcb1e('0x25')](respondWithResult(_0x3fedd0,null))['catch'](handleError(_0x3fedd0,null));};exports['destroy']=function(_0x3bab46,_0x3c564c){return db[_0xcb1e('0x2e')]['find']({'where':{'id':_0x3bab46[_0xcb1e('0x50')]['id']}})[_0xcb1e('0x25')](handleEntityNotFound(_0x3c564c,null))[_0xcb1e('0x25')](removeEntity(_0x3c564c,null))[_0xcb1e('0x44')](handleError(_0x3c564c,null));}; \ No newline at end of file +var _0xd7db=['destroy','get','error','stack','name','index','Template','rawAttributes','fieldName','type','model','keys','filters','query','attributes','nolimit','sort','where','filter','merge','map','VIRTUAL','options','includeAll','rows','catch','show','params','intersection','fields','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Templates','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','json','apply','reject','save','then'];(function(_0x37897a,_0x1a355a){var _0x2701fb=function(_0x545c7e){while(--_0x545c7e){_0x37897a['push'](_0x37897a['shift']());}};_0x2701fb(++_0x1a355a);}(_0xd7db,0xd8));var _0xbd7d=function(_0xca9dbd,_0xe68b3e){_0xca9dbd=_0xca9dbd-0x0;var _0x478de=_0xd7db[_0xca9dbd];return _0x478de;};'use strict';var emlformat=require(_0xbd7d('0x0'));var rimraf=require(_0xbd7d('0x1'));var zipdir=require(_0xbd7d('0x2'));var jsonpatch=require(_0xbd7d('0x3'));var rp=require(_0xbd7d('0x4'));var moment=require(_0xbd7d('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xbd7d('0x6'));var util=require(_0xbd7d('0x7'));var path=require(_0xbd7d('0x8'));var sox=require(_0xbd7d('0x9'));var csv=require(_0xbd7d('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbd7d('0xb'));var _=require(_0xbd7d('0xc'));var squel=require(_0xbd7d('0xd'));var crypto=require(_0xbd7d('0xe'));var jsforce=require(_0xbd7d('0xf'));var deskjs=require(_0xbd7d('0x10'));var toCsv=require(_0xbd7d('0xa'));var querystring=require(_0xbd7d('0x11'));var Papa=require(_0xbd7d('0x12'));var Redis=require(_0xbd7d('0x13'));var authService=require(_0xbd7d('0x14'));var qs=require(_0xbd7d('0x15'));var as=require(_0xbd7d('0x16'));var hardwareService=require(_0xbd7d('0x17'));var logger=require('../../config/logger')(_0xbd7d('0x18'));var utils=require(_0xbd7d('0x19'));var config=require(_0xbd7d('0x1a'));var licenseUtil=require(_0xbd7d('0x1b'));var db=require(_0xbd7d('0x1c'))['db'];function respondWithStatusCode(_0x45dc01,_0xb28bf0){_0xb28bf0=_0xb28bf0||0xcc;return function(_0x4f7cd0){if(_0x4f7cd0){return _0x45dc01[_0xbd7d('0x1d')](_0xb28bf0);}return _0x45dc01[_0xbd7d('0x1e')](_0xb28bf0)[_0xbd7d('0x1f')]();};}function respondWithResult(_0x321e74,_0x36d0b3){_0x36d0b3=_0x36d0b3||0xc8;return function(_0x138ac1){if(_0x138ac1){return _0x321e74[_0xbd7d('0x1e')](_0x36d0b3)['json'](_0x138ac1);}};}function respondWithFilteredResult(_0x2a4458,_0x2c1d27){return function(_0x2b4e99){if(_0x2b4e99){var _0x449d7d=typeof _0x2c1d27[_0xbd7d('0x20')]===_0xbd7d('0x21')&&typeof _0x2c1d27['limit']===_0xbd7d('0x21');var _0x1b2dea=_0x2b4e99[_0xbd7d('0x22')];var _0x7f7345=_0x449d7d?0x0:_0x2c1d27[_0xbd7d('0x20')];var _0xc6b96f=_0x449d7d?_0x2b4e99[_0xbd7d('0x22')]:_0x2c1d27[_0xbd7d('0x20')]+_0x2c1d27[_0xbd7d('0x23')];var _0xf896a4;if(_0xc6b96f>=_0x1b2dea){_0xc6b96f=_0x1b2dea;_0xf896a4=0xc8;}else{_0xf896a4=0xce;}_0x2a4458[_0xbd7d('0x1e')](_0xf896a4);return _0x2a4458[_0xbd7d('0x24')]('Content-Range',_0x7f7345+'-'+_0xc6b96f+'/'+_0x1b2dea)[_0xbd7d('0x25')](_0x2b4e99);}return null;};}function patchUpdates(_0x2c436c){return function(_0xe95276){try{jsonpatch[_0xbd7d('0x26')](_0xe95276,_0x2c436c,!![]);}catch(_0x5043b1){return BPromise[_0xbd7d('0x27')](_0x5043b1);}return _0xe95276[_0xbd7d('0x28')]();};}function saveUpdates(_0x3e9408,_0x43102f){return function(_0x29193d){if(_0x29193d){return _0x29193d['update'](_0x3e9408)[_0xbd7d('0x29')](function(_0x5986ed){return _0x5986ed;});}return null;};}function removeEntity(_0xd83cf1,_0x13d6b8){return function(_0x375e4c){if(_0x375e4c){return _0x375e4c[_0xbd7d('0x2a')]()['then'](function(){var _0xe84f1a=_0x375e4c[_0xbd7d('0x2b')]({'plain':!![]});var _0x29e3ff='Templates';return db['UserProfileResource']['destroy']({'where':{'type':_0x29e3ff,'resourceId':_0xe84f1a['id']}})['then'](function(){return _0x375e4c;});})[_0xbd7d('0x29')](function(){_0xd83cf1[_0xbd7d('0x1e')](0xcc)[_0xbd7d('0x1f')]();});}};}function handleEntityNotFound(_0x22c2e2,_0x4c1951){return function(_0x4101bf){if(!_0x4101bf){_0x22c2e2[_0xbd7d('0x1d')](0x194);}return _0x4101bf;};}function handleError(_0x283bec,_0x1a702a){_0x1a702a=_0x1a702a||0x1f4;return function(_0xda29c5){logger[_0xbd7d('0x2c')](_0xda29c5[_0xbd7d('0x2d')]);if(_0xda29c5[_0xbd7d('0x2e')]){delete _0xda29c5['name'];}_0x283bec[_0xbd7d('0x1e')](_0x1a702a)['send'](_0xda29c5);};}exports[_0xbd7d('0x2f')]=function(_0x165da0,_0x1ca7df){var _0x32d500={},_0x431a03={},_0x1dd276={'count':0x0,'rows':[]};var _0x4a6bc8=_['map'](db[_0xbd7d('0x30')][_0xbd7d('0x31')],function(_0xcfdba6){return{'name':_0xcfdba6[_0xbd7d('0x32')],'type':_0xcfdba6[_0xbd7d('0x33')]['key']};});_0x431a03[_0xbd7d('0x34')]=_['map'](_0x4a6bc8,'name');_0x431a03['query']=_[_0xbd7d('0x35')](_0x165da0['query']);_0x431a03[_0xbd7d('0x36')]=_['intersection'](_0x431a03['model'],_0x431a03[_0xbd7d('0x37')]);_0x32d500[_0xbd7d('0x38')]=_['intersection'](_0x431a03[_0xbd7d('0x34')],qs['fields'](_0x165da0['query']['fields']));_0x32d500[_0xbd7d('0x38')]=_0x32d500[_0xbd7d('0x38')]['length']?_0x32d500[_0xbd7d('0x38')]:_0x431a03[_0xbd7d('0x34')];if(!_0x165da0[_0xbd7d('0x37')]['hasOwnProperty'](_0xbd7d('0x39'))){_0x32d500['limit']=qs[_0xbd7d('0x23')](_0x165da0[_0xbd7d('0x37')]['limit']);_0x32d500[_0xbd7d('0x20')]=qs[_0xbd7d('0x20')](_0x165da0['query'][_0xbd7d('0x20')]);}_0x32d500['order']=qs[_0xbd7d('0x3a')](_0x165da0[_0xbd7d('0x37')]['sort']);_0x32d500[_0xbd7d('0x3b')]=qs['filters'](_['pick'](_0x165da0[_0xbd7d('0x37')],_0x431a03[_0xbd7d('0x36')]),_0x4a6bc8);if(_0x165da0[_0xbd7d('0x37')][_0xbd7d('0x3c')]){_0x32d500['where']=_[_0xbd7d('0x3d')](_0x32d500[_0xbd7d('0x3b')],{'$or':_[_0xbd7d('0x3e')](_0x4a6bc8,function(_0x5d089f){if(_0x5d089f[_0xbd7d('0x33')]!==_0xbd7d('0x3f')){var _0x67a54e={};_0x67a54e[_0x5d089f[_0xbd7d('0x2e')]]={'$like':'%'+_0x165da0[_0xbd7d('0x37')][_0xbd7d('0x3c')]+'%'};return _0x67a54e;}})});}_0x32d500=_['merge']({},_0x32d500,_0x165da0[_0xbd7d('0x40')]);var _0x575b04={'where':_0x32d500[_0xbd7d('0x3b')]};return db[_0xbd7d('0x30')][_0xbd7d('0x22')](_0x575b04)[_0xbd7d('0x29')](function(_0x12c03d){_0x1dd276['count']=_0x12c03d;if(_0x165da0[_0xbd7d('0x37')][_0xbd7d('0x41')]){_0x32d500['include']=[{'all':!![]}];}return db[_0xbd7d('0x30')]['findAll'](_0x32d500);})[_0xbd7d('0x29')](function(_0x42d150){_0x1dd276[_0xbd7d('0x42')]=_0x42d150;return _0x1dd276;})['then'](respondWithFilteredResult(_0x1ca7df,_0x32d500))[_0xbd7d('0x43')](handleError(_0x1ca7df,null));};exports[_0xbd7d('0x44')]=function(_0x4f4094,_0x5e116c){var _0x7c5cb0={'raw':!![],'where':{'id':_0x4f4094[_0xbd7d('0x45')]['id']}},_0x2218ad={};_0x2218ad[_0xbd7d('0x34')]=_[_0xbd7d('0x35')](db[_0xbd7d('0x30')]['rawAttributes']);_0x2218ad[_0xbd7d('0x37')]=_[_0xbd7d('0x35')](_0x4f4094[_0xbd7d('0x37')]);_0x2218ad[_0xbd7d('0x36')]=_['intersection'](_0x2218ad[_0xbd7d('0x34')],_0x2218ad['query']);_0x7c5cb0[_0xbd7d('0x38')]=_[_0xbd7d('0x46')](_0x2218ad[_0xbd7d('0x34')],qs[_0xbd7d('0x47')](_0x4f4094[_0xbd7d('0x37')]['fields']));_0x7c5cb0[_0xbd7d('0x38')]=_0x7c5cb0[_0xbd7d('0x38')]['length']?_0x7c5cb0[_0xbd7d('0x38')]:_0x2218ad[_0xbd7d('0x34')];if(_0x4f4094['query'][_0xbd7d('0x41')]){_0x7c5cb0[_0xbd7d('0x48')]=[{'all':!![]}];}_0x7c5cb0=_[_0xbd7d('0x3d')]({},_0x7c5cb0,_0x4f4094[_0xbd7d('0x40')]);return db[_0xbd7d('0x30')][_0xbd7d('0x49')](_0x7c5cb0)[_0xbd7d('0x29')](handleEntityNotFound(_0x5e116c,null))['then'](respondWithResult(_0x5e116c,null))[_0xbd7d('0x43')](handleError(_0x5e116c,null));};exports['create']=function(_0x10e682,_0x3dd0f6){return db[_0xbd7d('0x30')][_0xbd7d('0x4a')](_0x10e682['body'],{})[_0xbd7d('0x29')](function(_0x278aad){var _0x529127=_0x10e682[_0xbd7d('0x4b')][_0xbd7d('0x2b')]({'plain':!![]});if(!_0x529127)throw new Error(_0xbd7d('0x4c'));if(_0x529127[_0xbd7d('0x4d')]===_0xbd7d('0x4b')){var _0x2eca62=_0x278aad['get']({'plain':!![]});var _0x198d40=_0xbd7d('0x4e');return db[_0xbd7d('0x4f')][_0xbd7d('0x49')]({'where':{'name':_0x198d40,'userProfileId':_0x529127[_0xbd7d('0x50')]},'raw':!![]})[_0xbd7d('0x29')](function(_0x4bd34c){if(_0x4bd34c&&_0x4bd34c[_0xbd7d('0x51')]===0x0){return db[_0xbd7d('0x52')][_0xbd7d('0x4a')]({'name':_0x2eca62[_0xbd7d('0x2e')],'resourceId':_0x2eca62['id'],'type':_0x4bd34c[_0xbd7d('0x2e')],'sectionId':_0x4bd34c['id']},{})[_0xbd7d('0x29')](function(){return _0x278aad;});}else{return _0x278aad;}})['catch'](function(_0x19a951){logger[_0xbd7d('0x2c')](_0xbd7d('0x53'),_0x19a951);throw _0x19a951;});}return _0x278aad;})[_0xbd7d('0x29')](respondWithResult(_0x3dd0f6,0xc9))[_0xbd7d('0x43')](handleError(_0x3dd0f6,null));};exports[_0xbd7d('0x54')]=function(_0x2a7ad1,_0x42c9c8){if(_0x2a7ad1[_0xbd7d('0x55')]['id']){delete _0x2a7ad1[_0xbd7d('0x55')]['id'];}return db[_0xbd7d('0x30')][_0xbd7d('0x49')]({'where':{'id':_0x2a7ad1[_0xbd7d('0x45')]['id']}})[_0xbd7d('0x29')](handleEntityNotFound(_0x42c9c8,null))[_0xbd7d('0x29')](saveUpdates(_0x2a7ad1[_0xbd7d('0x55')],null))[_0xbd7d('0x29')](respondWithResult(_0x42c9c8,null))['catch'](handleError(_0x42c9c8,null));};exports[_0xbd7d('0x2a')]=function(_0x37f6fa,_0x3ba756){return db[_0xbd7d('0x30')][_0xbd7d('0x49')]({'where':{'id':_0x37f6fa['params']['id']}})[_0xbd7d('0x29')](handleEntityNotFound(_0x3ba756,null))[_0xbd7d('0x29')](removeEntity(_0x3ba756,null))[_0xbd7d('0x43')](handleError(_0x3ba756,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index 4f9549c..9546847 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 _0xd603=['Template','tools_templates','util','request-promise','path','../../config/environment','./template.attributes','exports'];(function(_0x209941,_0x5c9988){var _0x1e8729=function(_0x51a9b8){while(--_0x51a9b8){_0x209941['push'](_0x209941['shift']());}};_0x1e8729(++_0x5c9988);}(_0xd603,0x1ea));var _0x3d60=function(_0x5de1bc,_0x434be1){_0x5de1bc=_0x5de1bc-0x0;var _0x19f4b8=_0xd603[_0x5de1bc];return _0x19f4b8;};'use strict';var _=require('lodash');var util=require(_0x3d60('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x3d60('0x1'));var fs=require('fs');var path=require(_0x3d60('0x2'));var rimraf=require('rimraf');var config=require(_0x3d60('0x3'));var attributes=require(_0x3d60('0x4'));module[_0x3d60('0x5')]=function(_0x3b97e1,_0x27916e){return _0x3b97e1['define'](_0x3d60('0x6'),attributes,{'tableName':_0x3d60('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb9cc=['../../config/logger','api','moment','path','exports','define','tools_templates','lodash','util'];(function(_0x1f5259,_0x1517b8){var _0x223746=function(_0xd07da5){while(--_0xd07da5){_0x1f5259['push'](_0x1f5259['shift']());}};_0x223746(++_0x1517b8);}(_0xb9cc,0x115));var _0xcb9c=function(_0x33cc51,_0x6499){_0x33cc51=_0x33cc51-0x0;var _0x134f0e=_0xb9cc[_0x33cc51];return _0x134f0e;};'use strict';var _=require(_0xcb9c('0x0'));var util=require(_0xcb9c('0x1'));var logger=require(_0xcb9c('0x2'))(_0xcb9c('0x3'));var moment=require(_0xcb9c('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xcb9c('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./template.attributes');module[_0xcb9c('0x6')]=function(_0x20b1ac,_0x39c781){return _0x20b1ac[_0xcb9c('0x7')]('Template',attributes,{'tableName':_0xcb9c('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/template/template.rpc.js b/server/api/template/template.rpc.js index 0f3d567..9d74cc0 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 _0xae8c=['jayson/promise','http','request','info','Template,\x20%s,\x20%s','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','error','message','Template','options','raw','where','attributes','limit','map','model','include','then','GetTemplate','stringify','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x152fe3,_0x12b0c8){var _0xc5bb39=function(_0x1fde42){while(--_0x1fde42){_0x152fe3['push'](_0x152fe3['shift']());}};_0xc5bb39(++_0x12b0c8);}(_0xae8c,0x14c));var _0xcae8=function(_0x22aee9,_0x333143){_0x22aee9=_0x22aee9-0x0;var _0x2eacfb=_0xae8c[_0x22aee9];return _0x2eacfb;};'use strict';var _=require('lodash');var util=require(_0xcae8('0x0'));var moment=require(_0xcae8('0x1'));var BPromise=require(_0xcae8('0x2'));var rs=require(_0xcae8('0x3'));var fs=require('fs');var Redis=require(_0xcae8('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xcae8('0x5'));var logger=require(_0xcae8('0x6'))(_0xcae8('0x7'));var config=require(_0xcae8('0x8'));var jayson=require(_0xcae8('0x9'));var client=jayson['client'][_0xcae8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5df252,_0xb45b7e,_0x45ad3b){return new BPromise(function(_0x211418,_0x5b2985){return client[_0xcae8('0xb')](_0x5df252,_0x45ad3b)['then'](function(_0x2e2a55){logger[_0xcae8('0xc')](_0xcae8('0xd'),_0xb45b7e,_0xcae8('0xe'));logger[_0xcae8('0xf')](_0xcae8('0x10'),_0xb45b7e,_0xcae8('0xe'),JSON['stringify'](_0x2e2a55));if(_0x2e2a55[_0xcae8('0x11')]){if(_0x2e2a55['error']['code']===0x1f4){logger[_0xcae8('0x11')](_0xcae8('0xd'),_0xb45b7e,_0x2e2a55['error']['message']);return _0x5b2985(_0x2e2a55[_0xcae8('0x11')][_0xcae8('0x12')]);}logger['error'](_0xcae8('0xd'),_0xb45b7e,_0x2e2a55[_0xcae8('0x11')]['message']);return _0x211418(_0x2e2a55[_0xcae8('0x11')]['message']);}else{logger[_0xcae8('0xc')](_0xcae8('0xd'),_0xb45b7e,_0xcae8('0xe'));_0x211418(_0x2e2a55['result'][_0xcae8('0x12')]);}})['catch'](function(_0x5da15a){logger[_0xcae8('0x11')]('Template,\x20%s,\x20%s',_0xb45b7e,_0x5da15a);_0x5b2985(_0x5da15a);});});}exports['GetTemplate']=function(_0x926615){var _0x32d36b=this;return new Promise(function(_0x1bbe35,_0x31ae49){return db[_0xcae8('0x13')]['findAll']({'raw':_0x926615[_0xcae8('0x14')]?_0x926615[_0xcae8('0x14')][_0xcae8('0x15')]===undefined?!![]:![]:!![],'where':_0x926615[_0xcae8('0x14')]?_0x926615[_0xcae8('0x14')][_0xcae8('0x16')]||null:null,'attributes':_0x926615['options']?_0x926615['options'][_0xcae8('0x17')]||null:null,'limit':_0x926615[_0xcae8('0x14')]?_0x926615[_0xcae8('0x14')][_0xcae8('0x18')]||null:null,'include':_0x926615[_0xcae8('0x14')]?_0x926615[_0xcae8('0x14')]['include']?_[_0xcae8('0x19')](_0x926615[_0xcae8('0x14')]['include'],function(_0x536eb0){return{'model':db[_0x536eb0[_0xcae8('0x1a')]],'as':_0x536eb0['as'],'attributes':_0x536eb0[_0xcae8('0x17')],'include':_0x536eb0[_0xcae8('0x1b')]?_[_0xcae8('0x19')](_0x536eb0[_0xcae8('0x1b')],function(_0x1111c6){return{'model':db[_0x1111c6[_0xcae8('0x1a')]],'as':_0x1111c6['as'],'attributes':_0x1111c6[_0xcae8('0x17')],'include':_0x1111c6[_0xcae8('0x1b')]?_[_0xcae8('0x19')](_0x1111c6[_0xcae8('0x1b')],function(_0x5be47d){return{'model':db[_0x5be47d[_0xcae8('0x1a')]],'as':_0x5be47d['as'],'attributes':_0x5be47d[_0xcae8('0x17')]};}):[]};}):[]};}):[]:[]})[_0xcae8('0x1c')](function(_0x2cc3f8){logger[_0xcae8('0xc')](_0xcae8('0x1d'),_0x926615);logger[_0xcae8('0xf')](_0xcae8('0x1d'),_0x926615,JSON[_0xcae8('0x1e')](_0x2cc3f8));_0x1bbe35(_0x2cc3f8);})['catch'](function(_0x9406ce){logger['error'](_0xcae8('0x1d'),_0x9406ce[_0xcae8('0x12')],_0x926615);_0x31ae49(_0x32d36b[_0xcae8('0x11')](0x1f4,_0x9406ce[_0xcae8('0x12')]));});});}; \ No newline at end of file +var _0xb6a2=['code','Template,\x20%s,\x20%s','message','result','catch','GetTemplate','Template','findAll','options','raw','where','attributes','limit','include','model','map','debug','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','client','http','then','info','request\x20sent','Template,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x3cd133,_0x222fcb){var _0x2512c8=function(_0x484491){while(--_0x484491){_0x3cd133['push'](_0x3cd133['shift']());}};_0x2512c8(++_0x222fcb);}(_0xb6a2,0x15b));var _0x2b6a=function(_0x5f145c,_0x28ae3d){_0x5f145c=_0x5f145c-0x0;var _0x579817=_0xb6a2[_0x5f145c];return _0x579817;};'use strict';var _=require(_0x2b6a('0x0'));var util=require(_0x2b6a('0x1'));var moment=require('moment');var BPromise=require(_0x2b6a('0x2'));var rs=require(_0x2b6a('0x3'));var fs=require('fs');var Redis=require(_0x2b6a('0x4'));var db=require(_0x2b6a('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x2b6a('0x6'));var config=require('../../config/environment');var jayson=require(_0x2b6a('0x7'));var client=jayson[_0x2b6a('0x8')][_0x2b6a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2a2b68,_0xd5eb08,_0x516ca1){return new BPromise(function(_0x4fd623,_0x229086){return client['request'](_0x2a2b68,_0x516ca1)[_0x2b6a('0xa')](function(_0x12af13){logger[_0x2b6a('0xb')]('Template,\x20%s,\x20%s',_0xd5eb08,_0x2b6a('0xc'));logger['debug'](_0x2b6a('0xd'),_0xd5eb08,_0x2b6a('0xc'),JSON[_0x2b6a('0xe')](_0x12af13));if(_0x12af13['error']){if(_0x12af13[_0x2b6a('0xf')][_0x2b6a('0x10')]===0x1f4){logger[_0x2b6a('0xf')](_0x2b6a('0x11'),_0xd5eb08,_0x12af13[_0x2b6a('0xf')][_0x2b6a('0x12')]);return _0x229086(_0x12af13[_0x2b6a('0xf')][_0x2b6a('0x12')]);}logger[_0x2b6a('0xf')](_0x2b6a('0x11'),_0xd5eb08,_0x12af13[_0x2b6a('0xf')]['message']);return _0x4fd623(_0x12af13['error'][_0x2b6a('0x12')]);}else{logger[_0x2b6a('0xb')]('Template,\x20%s,\x20%s',_0xd5eb08,'request\x20sent');_0x4fd623(_0x12af13[_0x2b6a('0x13')][_0x2b6a('0x12')]);}})[_0x2b6a('0x14')](function(_0x843abe){logger[_0x2b6a('0xf')](_0x2b6a('0x11'),_0xd5eb08,_0x843abe);_0x229086(_0x843abe);});});}exports[_0x2b6a('0x15')]=function(_0x1f5a95){var _0x4f5034=this;return new Promise(function(_0x13bf00,_0x3a2d03){return db[_0x2b6a('0x16')][_0x2b6a('0x17')]({'raw':_0x1f5a95[_0x2b6a('0x18')]?_0x1f5a95[_0x2b6a('0x18')][_0x2b6a('0x19')]===undefined?!![]:![]:!![],'where':_0x1f5a95[_0x2b6a('0x18')]?_0x1f5a95[_0x2b6a('0x18')][_0x2b6a('0x1a')]||null:null,'attributes':_0x1f5a95[_0x2b6a('0x18')]?_0x1f5a95[_0x2b6a('0x18')][_0x2b6a('0x1b')]||null:null,'limit':_0x1f5a95[_0x2b6a('0x18')]?_0x1f5a95[_0x2b6a('0x18')][_0x2b6a('0x1c')]||null:null,'include':_0x1f5a95[_0x2b6a('0x18')]?_0x1f5a95[_0x2b6a('0x18')][_0x2b6a('0x1d')]?_['map'](_0x1f5a95[_0x2b6a('0x18')]['include'],function(_0x2a5596){return{'model':db[_0x2a5596[_0x2b6a('0x1e')]],'as':_0x2a5596['as'],'attributes':_0x2a5596['attributes'],'include':_0x2a5596[_0x2b6a('0x1d')]?_[_0x2b6a('0x1f')](_0x2a5596[_0x2b6a('0x1d')],function(_0x21e5f9){return{'model':db[_0x21e5f9['model']],'as':_0x21e5f9['as'],'attributes':_0x21e5f9['attributes'],'include':_0x21e5f9['include']?_['map'](_0x21e5f9[_0x2b6a('0x1d')],function(_0xaab762){return{'model':db[_0xaab762['model']],'as':_0xaab762['as'],'attributes':_0xaab762[_0x2b6a('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x2b6a('0xa')](function(_0x5bb1ac){logger[_0x2b6a('0xb')](_0x2b6a('0x15'),_0x1f5a95);logger[_0x2b6a('0x20')]('GetTemplate',_0x1f5a95,JSON['stringify'](_0x5bb1ac));_0x13bf00(_0x5bb1ac);})[_0x2b6a('0x14')](function(_0x5a7c92){logger['error'](_0x2b6a('0x15'),_0x5a7c92[_0x2b6a('0x12')],_0x1f5a95);_0x3a2d03(_0x4f5034[_0x2b6a('0xf')](0x1f4,_0x5a7c92[_0x2b6a('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 8b774d7..f46b0e6 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 _0x2899=['/:id/any_conditions','getAnyConditions','/:id/actions','create','post','/:id/all_conditions','addAllCondition','addAnyCondition','addAction','put','update','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','getAllConditions'];(function(_0x110d50,_0xc78b00){var _0x36b015=function(_0x977f8f){while(--_0x977f8f){_0x110d50['push'](_0x110d50['shift']());}};_0x36b015(++_0xc78b00);}(_0x2899,0x15e));var _0x9289=function(_0x15d130,_0x59bae0){_0x15d130=_0x15d130-0x0;var _0x1ed4f5=_0x2899[_0x15d130];return _0x1ed4f5;};'use strict';var multer=require(_0x9289('0x0'));var util=require(_0x9289('0x1'));var path=require(_0x9289('0x2'));var timeout=require('connect-timeout');var express=require(_0x9289('0x3'));var router=express[_0x9289('0x4')]();var fs_extra=require(_0x9289('0x5'));var auth=require(_0x9289('0x6'));var interaction=require(_0x9289('0x7'));var config=require(_0x9289('0x8'));var controller=require('./trigger.controller');router[_0x9289('0x9')]('/',auth[_0x9289('0xa')](),controller[_0x9289('0xb')]);router[_0x9289('0x9')](_0x9289('0xc'),auth[_0x9289('0xa')](),controller['show']);router[_0x9289('0x9')]('/:id/all_conditions',auth[_0x9289('0xa')](),controller[_0x9289('0xd')]);router[_0x9289('0x9')](_0x9289('0xe'),auth[_0x9289('0xa')](),controller[_0x9289('0xf')]);router[_0x9289('0x9')](_0x9289('0x10'),auth['isAuthenticated'](),controller['getActions']);router['post']('/',auth[_0x9289('0xa')](),controller[_0x9289('0x11')]);router[_0x9289('0x12')](_0x9289('0x13'),auth[_0x9289('0xa')](),controller[_0x9289('0x14')]);router[_0x9289('0x12')](_0x9289('0xe'),auth[_0x9289('0xa')](),controller[_0x9289('0x15')]);router['post'](_0x9289('0x10'),auth[_0x9289('0xa')](),controller[_0x9289('0x16')]);router[_0x9289('0x17')]('/:id',auth[_0x9289('0xa')](),controller[_0x9289('0x18')]);router['delete'](_0x9289('0xc'),auth[_0x9289('0xa')](),controller['destroy']);module[_0x9289('0x19')]=router; \ No newline at end of file +var _0xa66e=['../../config/environment','./trigger.controller','isAuthenticated','index','/:id','show','getAllConditions','get','/:id/any_conditions','getAnyConditions','/:id/actions','getActions','post','create','/:id/all_conditions','addAction','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xa66e,0xf4));var _0xea66=function(_0x582250,_0x562062){_0x582250=_0x582250-0x0;var _0x494d98=_0xa66e[_0x582250];return _0x494d98;};'use strict';var multer=require(_0xea66('0x0'));var util=require(_0xea66('0x1'));var path=require(_0xea66('0x2'));var timeout=require(_0xea66('0x3'));var express=require(_0xea66('0x4'));var router=express[_0xea66('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xea66('0x6'));var interaction=require(_0xea66('0x7'));var config=require(_0xea66('0x8'));var controller=require(_0xea66('0x9'));router['get']('/',auth[_0xea66('0xa')](),controller[_0xea66('0xb')]);router['get'](_0xea66('0xc'),auth[_0xea66('0xa')](),controller[_0xea66('0xd')]);router['get']('/:id/all_conditions',auth[_0xea66('0xa')](),controller[_0xea66('0xe')]);router[_0xea66('0xf')](_0xea66('0x10'),auth[_0xea66('0xa')](),controller[_0xea66('0x11')]);router['get'](_0xea66('0x12'),auth['isAuthenticated'](),controller[_0xea66('0x13')]);router[_0xea66('0x14')]('/',auth[_0xea66('0xa')](),controller[_0xea66('0x15')]);router['post'](_0xea66('0x16'),auth[_0xea66('0xa')](),controller['addAllCondition']);router[_0xea66('0x14')](_0xea66('0x10'),auth[_0xea66('0xa')](),controller['addAnyCondition']);router[_0xea66('0x14')](_0xea66('0x12'),auth['isAuthenticated'](),controller[_0xea66('0x17')]);router[_0xea66('0x18')]('/:id',auth[_0xea66('0xa')](),controller[_0xea66('0x19')]);router['delete'](_0xea66('0xc'),auth[_0xea66('0xa')](),controller[_0xea66('0x1a')]);module[_0xea66('0x1b')]=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index ec51479..57307b3 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 _0xc84e=['sequelize','exports','STRING','BOOLEAN'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc84e,0x108));var _0xec84=function(_0x403b50,_0x229c7c){_0x403b50=_0x403b50-0x0;var _0x386e46=_0xc84e[_0x403b50];return _0x386e46;};'use strict';var Sequelize=require(_0xec84('0x0'));module[_0xec84('0x1')]={'name':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xec84('0x2')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0xec84('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x3e86=['STRING','BOOLEAN','sequelize','exports'];(function(_0x622035,_0x1a4b91){var _0x326cf2=function(_0x5c3002){while(--_0x5c3002){_0x622035['push'](_0x622035['shift']());}};_0x326cf2(++_0x1a4b91);}(_0x3e86,0x1c6));var _0x63e8=function(_0x272d99,_0x59b5cb){_0x272d99=_0x272d99-0x0;var _0x339a8e=_0x3e86[_0x272d99];return _0x339a8e;};'use strict';var Sequelize=require(_0x63e8('0x0'));module[_0x63e8('0x1')]={'name':{'type':Sequelize[_0x63e8('0x2')]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x63e8('0x2')]},'status':{'type':Sequelize[_0x63e8('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/trigger/trigger.controller.js b/server/api/trigger/trigger.controller.js index 5d63834..1a7ec9d 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 _0xcd33=['autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','TriggerAllId','Condition','addAnyCondition','TriggerAnyId','getAllConditions','pick','getAnyConditions','findOne','addAction','TriggerId','Action','getActions','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../mysqldb','sendStatus','end','status','json','limit','undefined','count','offset','set','apply','reject','save','update','then','destroy','get','Triggers','UserProfileResource','error','stack','name','index','rawAttributes','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','keys','Trigger','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user'];(function(_0x17387d,_0x1ba7f0){var _0x34bfa0=function(_0x2d5a22){while(--_0x2d5a22){_0x17387d['push'](_0x17387d['shift']());}};_0x34bfa0(++_0x1ba7f0);}(_0xcd33,0xcb));var _0x3cd3=function(_0x308fc1,_0x1a2a22){_0x308fc1=_0x308fc1-0x0;var _0x3b5d24=_0xcd33[_0x308fc1];return _0x3b5d24;};'use strict';var emlformat=require(_0x3cd3('0x0'));var rimraf=require(_0x3cd3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3cd3('0x2'));var rp=require(_0x3cd3('0x3'));var moment=require(_0x3cd3('0x4'));var BPromise=require(_0x3cd3('0x5'));var Mustache=require(_0x3cd3('0x6'));var util=require('util');var path=require(_0x3cd3('0x7'));var sox=require(_0x3cd3('0x8'));var csv=require(_0x3cd3('0x9'));var ejs=require(_0x3cd3('0xa'));var fs=require('fs');var fs_extra=require(_0x3cd3('0xb'));var _=require(_0x3cd3('0xc'));var squel=require('squel');var crypto=require(_0x3cd3('0xd'));var jsforce=require(_0x3cd3('0xe'));var deskjs=require(_0x3cd3('0xf'));var toCsv=require('to-csv');var querystring=require(_0x3cd3('0x10'));var Papa=require(_0x3cd3('0x11'));var Redis=require(_0x3cd3('0x12'));var authService=require(_0x3cd3('0x13'));var qs=require(_0x3cd3('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3cd3('0x15'));var logger=require(_0x3cd3('0x16'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x3cd3('0x17'))['db'];function respondWithStatusCode(_0x5a68e3,_0x1d09de){_0x1d09de=_0x1d09de||0xcc;return function(_0xd24df6){if(_0xd24df6){return _0x5a68e3[_0x3cd3('0x18')](_0x1d09de);}return _0x5a68e3['status'](_0x1d09de)[_0x3cd3('0x19')]();};}function respondWithResult(_0x18c43b,_0x2c0c9a){_0x2c0c9a=_0x2c0c9a||0xc8;return function(_0x2759a6){if(_0x2759a6){return _0x18c43b[_0x3cd3('0x1a')](_0x2c0c9a)[_0x3cd3('0x1b')](_0x2759a6);}};}function respondWithFilteredResult(_0x4876ee,_0x2d075d){return function(_0x4f8545){if(_0x4f8545){var _0x5d18b4=typeof _0x2d075d['offset']==='undefined'&&typeof _0x2d075d[_0x3cd3('0x1c')]===_0x3cd3('0x1d');var _0x178414=_0x4f8545[_0x3cd3('0x1e')];var _0x2b7d1d=_0x5d18b4?0x0:_0x2d075d['offset'];var _0x28a3c6=_0x5d18b4?_0x4f8545[_0x3cd3('0x1e')]:_0x2d075d[_0x3cd3('0x1f')]+_0x2d075d['limit'];var _0x1c31fe;if(_0x28a3c6>=_0x178414){_0x28a3c6=_0x178414;_0x1c31fe=0xc8;}else{_0x1c31fe=0xce;}_0x4876ee[_0x3cd3('0x1a')](_0x1c31fe);return _0x4876ee[_0x3cd3('0x20')]('Content-Range',_0x2b7d1d+'-'+_0x28a3c6+'/'+_0x178414)[_0x3cd3('0x1b')](_0x4f8545);}return null;};}function patchUpdates(_0x25d886){return function(_0x4c447c){try{jsonpatch[_0x3cd3('0x21')](_0x4c447c,_0x25d886,!![]);}catch(_0x5c1926){return BPromise[_0x3cd3('0x22')](_0x5c1926);}return _0x4c447c[_0x3cd3('0x23')]();};}function saveUpdates(_0x271e93,_0x2dd96c){return function(_0x4714c8){if(_0x4714c8){return _0x4714c8[_0x3cd3('0x24')](_0x271e93)[_0x3cd3('0x25')](function(_0xaad948){return _0xaad948;});}return null;};}function removeEntity(_0x198a08,_0x129c39){return function(_0x18458b){if(_0x18458b){return _0x18458b[_0x3cd3('0x26')]()[_0x3cd3('0x25')](function(){var _0x4a0ca9=_0x18458b[_0x3cd3('0x27')]({'plain':!![]});var _0x574923=_0x3cd3('0x28');return db[_0x3cd3('0x29')][_0x3cd3('0x26')]({'where':{'type':_0x574923,'resourceId':_0x4a0ca9['id']}})[_0x3cd3('0x25')](function(){return _0x18458b;});})[_0x3cd3('0x25')](function(){_0x198a08['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xbaffd5,_0x2dd0bd){return function(_0xa9243){if(!_0xa9243){_0xbaffd5[_0x3cd3('0x18')](0x194);}return _0xa9243;};}function handleError(_0xf038f3,_0x5c633a){_0x5c633a=_0x5c633a||0x1f4;return function(_0xd864d2){logger[_0x3cd3('0x2a')](_0xd864d2[_0x3cd3('0x2b')]);if(_0xd864d2[_0x3cd3('0x2c')]){delete _0xd864d2[_0x3cd3('0x2c')];}_0xf038f3[_0x3cd3('0x1a')](_0x5c633a)['send'](_0xd864d2);};}exports[_0x3cd3('0x2d')]=function(_0x3b3644,_0x29c914){var _0x4c4d70={},_0x57f3fd={},_0x1fa142={'count':0x0,'rows':[]};var _0x32154a=_['map'](db['Trigger'][_0x3cd3('0x2e')],function(_0x3704ab){return{'name':_0x3704ab['fieldName'],'type':_0x3704ab['type'][_0x3cd3('0x2f')]};});_0x57f3fd[_0x3cd3('0x30')]=_[_0x3cd3('0x31')](_0x32154a,_0x3cd3('0x2c'));_0x57f3fd[_0x3cd3('0x32')]=_['keys'](_0x3b3644[_0x3cd3('0x32')]);_0x57f3fd[_0x3cd3('0x33')]=_[_0x3cd3('0x34')](_0x57f3fd[_0x3cd3('0x30')],_0x57f3fd[_0x3cd3('0x32')]);_0x4c4d70[_0x3cd3('0x35')]=_['intersection'](_0x57f3fd[_0x3cd3('0x30')],qs[_0x3cd3('0x36')](_0x3b3644[_0x3cd3('0x32')][_0x3cd3('0x36')]));_0x4c4d70[_0x3cd3('0x35')]=_0x4c4d70[_0x3cd3('0x35')][_0x3cd3('0x37')]?_0x4c4d70[_0x3cd3('0x35')]:_0x57f3fd[_0x3cd3('0x30')];if(!_0x3b3644[_0x3cd3('0x32')][_0x3cd3('0x38')](_0x3cd3('0x39'))){_0x4c4d70[_0x3cd3('0x1c')]=qs['limit'](_0x3b3644[_0x3cd3('0x32')]['limit']);_0x4c4d70[_0x3cd3('0x1f')]=qs[_0x3cd3('0x1f')](_0x3b3644[_0x3cd3('0x32')]['offset']);}_0x4c4d70[_0x3cd3('0x3a')]=qs[_0x3cd3('0x3b')](_0x3b3644['query'][_0x3cd3('0x3b')]);_0x4c4d70['where']=qs[_0x3cd3('0x33')](_['pick'](_0x3b3644[_0x3cd3('0x32')],_0x57f3fd['filters']),_0x32154a);if(_0x3b3644[_0x3cd3('0x32')]['filter']){_0x4c4d70[_0x3cd3('0x3c')]=_[_0x3cd3('0x3d')](_0x4c4d70[_0x3cd3('0x3c')],{'$or':_[_0x3cd3('0x31')](_0x32154a,function(_0x3965e2){if(_0x3965e2[_0x3cd3('0x3e')]!==_0x3cd3('0x3f')){var _0x1116f7={};_0x1116f7[_0x3965e2['name']]={'$like':'%'+_0x3b3644[_0x3cd3('0x32')][_0x3cd3('0x40')]+'%'};return _0x1116f7;}})});}_0x4c4d70=_['merge']({},_0x4c4d70,_0x3b3644[_0x3cd3('0x41')]);var _0x4df016={'where':_0x4c4d70['where']};return db['Trigger']['count'](_0x4df016)['then'](function(_0x2e92fa){_0x1fa142[_0x3cd3('0x1e')]=_0x2e92fa;if(_0x3b3644[_0x3cd3('0x32')][_0x3cd3('0x42')]){_0x4c4d70[_0x3cd3('0x43')]=[{'all':!![]}];}return db['Trigger'][_0x3cd3('0x44')](_0x4c4d70);})[_0x3cd3('0x25')](function(_0x2a9e1e){_0x1fa142[_0x3cd3('0x45')]=_0x2a9e1e;return _0x1fa142;})['then'](respondWithFilteredResult(_0x29c914,_0x4c4d70))['catch'](handleError(_0x29c914,null));};exports[_0x3cd3('0x46')]=function(_0x2e70fc,_0x3297df){var _0x52c06b={'raw':![],'where':{'id':_0x2e70fc[_0x3cd3('0x47')]['id']}},_0x58ef5e={};_0x58ef5e[_0x3cd3('0x30')]=_[_0x3cd3('0x48')](db[_0x3cd3('0x49')][_0x3cd3('0x2e')]);_0x58ef5e['query']=_[_0x3cd3('0x48')](_0x2e70fc[_0x3cd3('0x32')]);_0x58ef5e[_0x3cd3('0x33')]=_['intersection'](_0x58ef5e[_0x3cd3('0x30')],_0x58ef5e[_0x3cd3('0x32')]);_0x52c06b[_0x3cd3('0x35')]=_['intersection'](_0x58ef5e[_0x3cd3('0x30')],qs[_0x3cd3('0x36')](_0x2e70fc[_0x3cd3('0x32')][_0x3cd3('0x36')]));_0x52c06b[_0x3cd3('0x35')]=_0x52c06b['attributes'][_0x3cd3('0x37')]?_0x52c06b[_0x3cd3('0x35')]:_0x58ef5e[_0x3cd3('0x30')];if(_0x2e70fc[_0x3cd3('0x32')][_0x3cd3('0x42')]){_0x52c06b[_0x3cd3('0x43')]=[{'all':!![]}];}_0x52c06b=_[_0x3cd3('0x3d')]({},_0x52c06b,_0x2e70fc[_0x3cd3('0x41')]);return db[_0x3cd3('0x49')][_0x3cd3('0x4a')](_0x52c06b)[_0x3cd3('0x25')](handleEntityNotFound(_0x3297df,null))[_0x3cd3('0x25')](respondWithResult(_0x3297df,null))['catch'](handleError(_0x3297df,null));};exports[_0x3cd3('0x4b')]=function(_0x1fd90f,_0x50a7f4){return db['Trigger'][_0x3cd3('0x4b')](_0x1fd90f[_0x3cd3('0x4c')],{})[_0x3cd3('0x25')](function(_0x977829){var _0x472e2a=_0x1fd90f['user'][_0x3cd3('0x27')]({'plain':!![]});if(!_0x472e2a)throw new Error(_0x3cd3('0x4d'));if(_0x472e2a['role']===_0x3cd3('0x4e')){var _0x3c5d2d=_0x977829[_0x3cd3('0x27')]({'plain':!![]});var _0x1d60ad='Triggers';return db['UserProfileSection'][_0x3cd3('0x4a')]({'where':{'name':_0x1d60ad,'userProfileId':_0x472e2a['userProfileId']},'raw':!![]})[_0x3cd3('0x25')](function(_0x4ee714){if(_0x4ee714&&_0x4ee714[_0x3cd3('0x4f')]===0x0){return db['UserProfileResource']['create']({'name':_0x3c5d2d[_0x3cd3('0x2c')],'resourceId':_0x3c5d2d['id'],'type':_0x4ee714[_0x3cd3('0x2c')],'sectionId':_0x4ee714['id']},{})[_0x3cd3('0x25')](function(){return _0x977829;});}else{return _0x977829;}})[_0x3cd3('0x50')](function(_0x35d39c){logger[_0x3cd3('0x2a')](_0x3cd3('0x51'),_0x35d39c);throw _0x35d39c;});}return _0x977829;})[_0x3cd3('0x25')](respondWithResult(_0x50a7f4,0xc9))[_0x3cd3('0x50')](handleError(_0x50a7f4,null));};exports[_0x3cd3('0x24')]=function(_0x2bee77,_0x5ff166){if(_0x2bee77[_0x3cd3('0x4c')]['id']){delete _0x2bee77[_0x3cd3('0x4c')]['id'];}return db['Trigger'][_0x3cd3('0x4a')]({'where':{'id':_0x2bee77[_0x3cd3('0x47')]['id']}})[_0x3cd3('0x25')](handleEntityNotFound(_0x5ff166,null))['then'](saveUpdates(_0x2bee77['body'],null))[_0x3cd3('0x25')](respondWithResult(_0x5ff166,null))[_0x3cd3('0x50')](handleError(_0x5ff166,null));};exports['destroy']=function(_0x4149eb,_0x409f56){return db[_0x3cd3('0x49')]['find']({'where':{'id':_0x4149eb[_0x3cd3('0x47')]['id']}})[_0x3cd3('0x25')](handleEntityNotFound(_0x409f56,null))[_0x3cd3('0x25')](removeEntity(_0x409f56,null))['catch'](handleError(_0x409f56,null));};exports['addAllCondition']=function(_0xbac984,_0x302b9f,_0x440468){if(_0xbac984['body']['id']){delete _0xbac984['body']['id'];}return db['Trigger'][_0x3cd3('0x4a')]({'where':{'id':_0xbac984[_0x3cd3('0x47')]['id']}})[_0x3cd3('0x25')](handleEntityNotFound(_0x302b9f,null))[_0x3cd3('0x25')](function(_0x28ec99){if(_0x28ec99){_0xbac984['body'][_0x3cd3('0x52')]=_0x28ec99['id'];return db[_0x3cd3('0x53')]['create'](_0xbac984[_0x3cd3('0x4c')]);}})[_0x3cd3('0x25')](respondWithResult(_0x302b9f,null))[_0x3cd3('0x50')](handleError(_0x302b9f,null));};exports[_0x3cd3('0x54')]=function(_0x56b540,_0xdbd52d,_0x4ed969){if(_0x56b540['body']['id']){delete _0x56b540['body']['id'];}return db['Trigger']['find']({'where':{'id':_0x56b540[_0x3cd3('0x47')]['id']}})[_0x3cd3('0x25')](handleEntityNotFound(_0xdbd52d,null))[_0x3cd3('0x25')](function(_0x257509){if(_0x257509){_0x56b540[_0x3cd3('0x4c')][_0x3cd3('0x55')]=_0x257509['id'];return db[_0x3cd3('0x53')]['create'](_0x56b540[_0x3cd3('0x4c')]);}})[_0x3cd3('0x25')](respondWithResult(_0xdbd52d,null))[_0x3cd3('0x50')](handleError(_0xdbd52d,null));};exports[_0x3cd3('0x56')]=function(_0x440c32,_0x31dc4c,_0x26c442){var _0x2ce520={};var _0x8a9950={};var _0x54f0c1;var _0x44350c;return db[_0x3cd3('0x49')]['findOne']({'where':{'id':_0x440c32['params']['id']}})[_0x3cd3('0x25')](handleEntityNotFound(_0x31dc4c,null))['then'](function(_0x3750d9){if(_0x3750d9){_0x54f0c1=_0x3750d9;_0x8a9950['model']=_[_0x3cd3('0x48')](db[_0x3cd3('0x53')]['rawAttributes']);_0x8a9950[_0x3cd3('0x32')]=_[_0x3cd3('0x48')](_0x440c32[_0x3cd3('0x32')]);_0x8a9950[_0x3cd3('0x33')]=_[_0x3cd3('0x34')](_0x8a9950[_0x3cd3('0x30')],_0x8a9950[_0x3cd3('0x32')]);_0x2ce520[_0x3cd3('0x35')]=_[_0x3cd3('0x34')](_0x8a9950[_0x3cd3('0x30')],qs['fields'](_0x440c32[_0x3cd3('0x32')][_0x3cd3('0x36')]));_0x2ce520['attributes']=_0x2ce520[_0x3cd3('0x35')][_0x3cd3('0x37')]?_0x2ce520[_0x3cd3('0x35')]:_0x8a9950[_0x3cd3('0x30')];_0x2ce520[_0x3cd3('0x3a')]=qs[_0x3cd3('0x3b')](_0x440c32[_0x3cd3('0x32')][_0x3cd3('0x3b')]);_0x2ce520[_0x3cd3('0x3c')]=qs[_0x3cd3('0x33')](_[_0x3cd3('0x57')](_0x440c32['query'],_0x8a9950[_0x3cd3('0x33')]));if(_0x440c32[_0x3cd3('0x32')][_0x3cd3('0x40')]){_0x2ce520[_0x3cd3('0x3c')]=_[_0x3cd3('0x3d')](_0x2ce520[_0x3cd3('0x3c')],{'$or':_['map'](_0x2ce520['attributes'],function(_0x40735f){var _0x1c6ab5={};_0x1c6ab5[_0x40735f]={'$like':'%'+_0x440c32[_0x3cd3('0x32')][_0x3cd3('0x40')]+'%'};return _0x1c6ab5;})});}_0x2ce520=_[_0x3cd3('0x3d')]({},_0x2ce520,_0x440c32[_0x3cd3('0x41')]);return _0x54f0c1[_0x3cd3('0x56')](_0x2ce520);}})[_0x3cd3('0x25')](function(_0x14476e){if(_0x14476e){_0x44350c=_0x14476e[_0x3cd3('0x37')];if(!_0x440c32[_0x3cd3('0x32')]['hasOwnProperty'](_0x3cd3('0x39'))){_0x2ce520[_0x3cd3('0x1c')]=qs[_0x3cd3('0x1c')](_0x440c32[_0x3cd3('0x32')][_0x3cd3('0x1c')]);_0x2ce520['offset']=qs[_0x3cd3('0x1f')](_0x440c32['query'][_0x3cd3('0x1f')]);}return _0x54f0c1[_0x3cd3('0x56')](_0x2ce520);}})['then'](function(_0x3b9633){if(_0x3b9633){return _0x3b9633?{'count':_0x44350c,'rows':_0x3b9633}:null;}})[_0x3cd3('0x25')](respondWithResult(_0x31dc4c,null))[_0x3cd3('0x50')](handleError(_0x31dc4c,null));};exports[_0x3cd3('0x58')]=function(_0x131a7b,_0x2bcd5d,_0xa6de1a){var _0x412e15={};var _0xed93e6={};var _0x449531;var _0x20fd88;return db[_0x3cd3('0x49')][_0x3cd3('0x59')]({'where':{'id':_0x131a7b[_0x3cd3('0x47')]['id']}})['then'](handleEntityNotFound(_0x2bcd5d,null))[_0x3cd3('0x25')](function(_0x5e6d94){if(_0x5e6d94){_0x449531=_0x5e6d94;_0xed93e6[_0x3cd3('0x30')]=_[_0x3cd3('0x48')](db[_0x3cd3('0x53')]['rawAttributes']);_0xed93e6[_0x3cd3('0x32')]=_[_0x3cd3('0x48')](_0x131a7b[_0x3cd3('0x32')]);_0xed93e6['filters']=_[_0x3cd3('0x34')](_0xed93e6[_0x3cd3('0x30')],_0xed93e6['query']);_0x412e15[_0x3cd3('0x35')]=_[_0x3cd3('0x34')](_0xed93e6[_0x3cd3('0x30')],qs[_0x3cd3('0x36')](_0x131a7b['query']['fields']));_0x412e15[_0x3cd3('0x35')]=_0x412e15[_0x3cd3('0x35')][_0x3cd3('0x37')]?_0x412e15['attributes']:_0xed93e6[_0x3cd3('0x30')];_0x412e15[_0x3cd3('0x3a')]=qs[_0x3cd3('0x3b')](_0x131a7b[_0x3cd3('0x32')][_0x3cd3('0x3b')]);_0x412e15[_0x3cd3('0x3c')]=qs[_0x3cd3('0x33')](_[_0x3cd3('0x57')](_0x131a7b['query'],_0xed93e6[_0x3cd3('0x33')]));if(_0x131a7b[_0x3cd3('0x32')][_0x3cd3('0x40')]){_0x412e15['where']=_[_0x3cd3('0x3d')](_0x412e15[_0x3cd3('0x3c')],{'$or':_['map'](_0x412e15['attributes'],function(_0x458344){var _0x5baded={};_0x5baded[_0x458344]={'$like':'%'+_0x131a7b[_0x3cd3('0x32')][_0x3cd3('0x40')]+'%'};return _0x5baded;})});}_0x412e15=_[_0x3cd3('0x3d')]({},_0x412e15,_0x131a7b['options']);return _0x449531['getAnyConditions'](_0x412e15);}})[_0x3cd3('0x25')](function(_0x4fd5e8){if(_0x4fd5e8){_0x20fd88=_0x4fd5e8[_0x3cd3('0x37')];if(!_0x131a7b[_0x3cd3('0x32')][_0x3cd3('0x38')](_0x3cd3('0x39'))){_0x412e15[_0x3cd3('0x1c')]=qs[_0x3cd3('0x1c')](_0x131a7b['query'][_0x3cd3('0x1c')]);_0x412e15[_0x3cd3('0x1f')]=qs[_0x3cd3('0x1f')](_0x131a7b[_0x3cd3('0x32')]['offset']);}return _0x449531['getAnyConditions'](_0x412e15);}})['then'](function(_0x7814d6){if(_0x7814d6){return _0x7814d6?{'count':_0x20fd88,'rows':_0x7814d6}:null;}})[_0x3cd3('0x25')](respondWithResult(_0x2bcd5d,null))['catch'](handleError(_0x2bcd5d,null));};exports[_0x3cd3('0x5a')]=function(_0x1fd753,_0x533044,_0x224892){if(_0x1fd753[_0x3cd3('0x4c')]['id']){delete _0x1fd753[_0x3cd3('0x4c')]['id'];}return db[_0x3cd3('0x49')][_0x3cd3('0x4a')]({'where':{'id':_0x1fd753['params']['id']}})[_0x3cd3('0x25')](handleEntityNotFound(_0x533044,null))['then'](function(_0x493533){if(_0x493533){_0x1fd753[_0x3cd3('0x4c')][_0x3cd3('0x5b')]=_0x493533['id'];return db[_0x3cd3('0x5c')][_0x3cd3('0x4b')](_0x1fd753[_0x3cd3('0x4c')]);}})[_0x3cd3('0x25')](respondWithResult(_0x533044,null))[_0x3cd3('0x50')](handleError(_0x533044,null));};exports['getActions']=function(_0x59df61,_0x1b326f,_0x11b308){var _0x561363={};var _0x3ef1e1={};var _0x4324c9;var _0x5dba9d;return db[_0x3cd3('0x49')][_0x3cd3('0x59')]({'where':{'id':_0x59df61[_0x3cd3('0x47')]['id']}})[_0x3cd3('0x25')](handleEntityNotFound(_0x1b326f,null))[_0x3cd3('0x25')](function(_0x2ce7c2){if(_0x2ce7c2){_0x4324c9=_0x2ce7c2;_0x3ef1e1[_0x3cd3('0x30')]=_[_0x3cd3('0x48')](db['Action'][_0x3cd3('0x2e')]);_0x3ef1e1[_0x3cd3('0x32')]=_[_0x3cd3('0x48')](_0x59df61[_0x3cd3('0x32')]);_0x3ef1e1[_0x3cd3('0x33')]=_['intersection'](_0x3ef1e1['model'],_0x3ef1e1['query']);_0x561363[_0x3cd3('0x35')]=_[_0x3cd3('0x34')](_0x3ef1e1[_0x3cd3('0x30')],qs[_0x3cd3('0x36')](_0x59df61['query'][_0x3cd3('0x36')]));_0x561363[_0x3cd3('0x35')]=_0x561363[_0x3cd3('0x35')][_0x3cd3('0x37')]?_0x561363['attributes']:_0x3ef1e1[_0x3cd3('0x30')];_0x561363[_0x3cd3('0x3a')]=qs[_0x3cd3('0x3b')](_0x59df61[_0x3cd3('0x32')][_0x3cd3('0x3b')]);_0x561363[_0x3cd3('0x3c')]=qs['filters'](_[_0x3cd3('0x57')](_0x59df61[_0x3cd3('0x32')],_0x3ef1e1[_0x3cd3('0x33')]));if(_0x59df61[_0x3cd3('0x32')][_0x3cd3('0x40')]){_0x561363[_0x3cd3('0x3c')]=_[_0x3cd3('0x3d')](_0x561363['where'],{'$or':_[_0x3cd3('0x31')](_0x561363[_0x3cd3('0x35')],function(_0x3000b3){var _0x5c191a={};_0x5c191a[_0x3000b3]={'$like':'%'+_0x59df61['query']['filter']+'%'};return _0x5c191a;})});}_0x561363=_[_0x3cd3('0x3d')]({},_0x561363,_0x59df61[_0x3cd3('0x41')]);return _0x4324c9[_0x3cd3('0x5d')](_0x561363);}})[_0x3cd3('0x25')](function(_0x274729){if(_0x274729){_0x5dba9d=_0x274729[_0x3cd3('0x37')];if(!_0x59df61[_0x3cd3('0x32')][_0x3cd3('0x38')]('nolimit')){_0x561363['limit']=qs[_0x3cd3('0x1c')](_0x59df61[_0x3cd3('0x32')]['limit']);_0x561363[_0x3cd3('0x1f')]=qs[_0x3cd3('0x1f')](_0x59df61[_0x3cd3('0x32')][_0x3cd3('0x1f')]);}return _0x4324c9['getActions'](_0x561363);}})[_0x3cd3('0x25')](function(_0x4fd4d0){if(_0x4fd4d0){return _0x4fd4d0?{'count':_0x5dba9d,'rows':_0x4fd4d0}:null;}})['then'](respondWithResult(_0x1b326f,null))['catch'](handleError(_0x1b326f,null));}; \ No newline at end of file +var _0x3fac=['Action','getActions','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','json','apply','reject','save','update','then','destroy','get','Triggers','UserProfileResource','end','error','stack','name','send','index','map','Trigger','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','params','rawAttributes','find','create','body','role','user','UserProfileSection','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addAllCondition','Condition','addAnyCondition','TriggerAnyId','findOne','options','getAllConditions','nolimit','getAnyConditions','addAction','TriggerId'];(function(_0x1fb038,_0xc3f69b){var _0x1600dc=function(_0x2a040e){while(--_0x2a040e){_0x1fb038['push'](_0x1fb038['shift']());}};_0x1600dc(++_0xc3f69b);}(_0x3fac,0x17e));var _0xc3fa=function(_0x5b68cd,_0x34d379){_0x5b68cd=_0x5b68cd-0x0;var _0x13b7fd=_0x3fac[_0x5b68cd];return _0x13b7fd;};'use strict';var emlformat=require(_0xc3fa('0x0'));var rimraf=require(_0xc3fa('0x1'));var zipdir=require(_0xc3fa('0x2'));var jsonpatch=require(_0xc3fa('0x3'));var rp=require('request-promise');var moment=require(_0xc3fa('0x4'));var BPromise=require(_0xc3fa('0x5'));var Mustache=require(_0xc3fa('0x6'));var util=require('util');var path=require(_0xc3fa('0x7'));var sox=require(_0xc3fa('0x8'));var csv=require(_0xc3fa('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc3fa('0xa'));var squel=require(_0xc3fa('0xb'));var crypto=require(_0xc3fa('0xc'));var jsforce=require(_0xc3fa('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xc3fa('0x9'));var querystring=require('querystring');var Papa=require(_0xc3fa('0xe'));var Redis=require(_0xc3fa('0xf'));var authService=require(_0xc3fa('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc3fa('0x11'));var logger=require('../../config/logger')(_0xc3fa('0x12'));var utils=require(_0xc3fa('0x13'));var config=require(_0xc3fa('0x14'));var licenseUtil=require(_0xc3fa('0x15'));var db=require(_0xc3fa('0x16'))['db'];function respondWithStatusCode(_0x24ad67,_0x504c27){_0x504c27=_0x504c27||0xcc;return function(_0x394313){if(_0x394313){return _0x24ad67[_0xc3fa('0x17')](_0x504c27);}return _0x24ad67['status'](_0x504c27)['end']();};}function respondWithResult(_0x533672,_0x2e2141){_0x2e2141=_0x2e2141||0xc8;return function(_0x3a460e){if(_0x3a460e){return _0x533672[_0xc3fa('0x18')](_0x2e2141)['json'](_0x3a460e);}};}function respondWithFilteredResult(_0x541538,_0x45eecf){return function(_0x2ad0da){if(_0x2ad0da){var _0x48a63e=typeof _0x45eecf[_0xc3fa('0x19')]===_0xc3fa('0x1a')&&typeof _0x45eecf[_0xc3fa('0x1b')]===_0xc3fa('0x1a');var _0x11f4cc=_0x2ad0da[_0xc3fa('0x1c')];var _0x578196=_0x48a63e?0x0:_0x45eecf[_0xc3fa('0x19')];var _0x4432ec=_0x48a63e?_0x2ad0da[_0xc3fa('0x1c')]:_0x45eecf[_0xc3fa('0x19')]+_0x45eecf[_0xc3fa('0x1b')];var _0x336f6c;if(_0x4432ec>=_0x11f4cc){_0x4432ec=_0x11f4cc;_0x336f6c=0xc8;}else{_0x336f6c=0xce;}_0x541538[_0xc3fa('0x18')](_0x336f6c);return _0x541538[_0xc3fa('0x1d')]('Content-Range',_0x578196+'-'+_0x4432ec+'/'+_0x11f4cc)[_0xc3fa('0x1e')](_0x2ad0da);}return null;};}function patchUpdates(_0x3d5fdc){return function(_0x242685){try{jsonpatch[_0xc3fa('0x1f')](_0x242685,_0x3d5fdc,!![]);}catch(_0x4d54b1){return BPromise[_0xc3fa('0x20')](_0x4d54b1);}return _0x242685[_0xc3fa('0x21')]();};}function saveUpdates(_0x307fed,_0x552595){return function(_0xafdf2f){if(_0xafdf2f){return _0xafdf2f[_0xc3fa('0x22')](_0x307fed)[_0xc3fa('0x23')](function(_0x222c4e){return _0x222c4e;});}return null;};}function removeEntity(_0x19360b,_0x2751a5){return function(_0x416044){if(_0x416044){return _0x416044[_0xc3fa('0x24')]()[_0xc3fa('0x23')](function(){var _0x4b6512=_0x416044[_0xc3fa('0x25')]({'plain':!![]});var _0x1110a8=_0xc3fa('0x26');return db[_0xc3fa('0x27')]['destroy']({'where':{'type':_0x1110a8,'resourceId':_0x4b6512['id']}})['then'](function(){return _0x416044;});})[_0xc3fa('0x23')](function(){_0x19360b[_0xc3fa('0x18')](0xcc)[_0xc3fa('0x28')]();});}};}function handleEntityNotFound(_0x416945,_0x5d0159){return function(_0x230a58){if(!_0x230a58){_0x416945[_0xc3fa('0x17')](0x194);}return _0x230a58;};}function handleError(_0x125e68,_0x2627e1){_0x2627e1=_0x2627e1||0x1f4;return function(_0x33ae00){logger[_0xc3fa('0x29')](_0x33ae00[_0xc3fa('0x2a')]);if(_0x33ae00[_0xc3fa('0x2b')]){delete _0x33ae00[_0xc3fa('0x2b')];}_0x125e68[_0xc3fa('0x18')](_0x2627e1)[_0xc3fa('0x2c')](_0x33ae00);};}exports[_0xc3fa('0x2d')]=function(_0x423396,_0x36a0){var _0x472d3d={},_0x15e530={},_0x4390b8={'count':0x0,'rows':[]};var _0x2eaaa1=_[_0xc3fa('0x2e')](db[_0xc3fa('0x2f')]['rawAttributes'],function(_0xaf8ab0){return{'name':_0xaf8ab0['fieldName'],'type':_0xaf8ab0[_0xc3fa('0x30')][_0xc3fa('0x31')]};});_0x15e530[_0xc3fa('0x32')]=_[_0xc3fa('0x2e')](_0x2eaaa1,_0xc3fa('0x2b'));_0x15e530['query']=_[_0xc3fa('0x33')](_0x423396[_0xc3fa('0x34')]);_0x15e530[_0xc3fa('0x35')]=_[_0xc3fa('0x36')](_0x15e530[_0xc3fa('0x32')],_0x15e530[_0xc3fa('0x34')]);_0x472d3d[_0xc3fa('0x37')]=_[_0xc3fa('0x36')](_0x15e530[_0xc3fa('0x32')],qs[_0xc3fa('0x38')](_0x423396[_0xc3fa('0x34')][_0xc3fa('0x38')]));_0x472d3d[_0xc3fa('0x37')]=_0x472d3d[_0xc3fa('0x37')][_0xc3fa('0x39')]?_0x472d3d[_0xc3fa('0x37')]:_0x15e530[_0xc3fa('0x32')];if(!_0x423396[_0xc3fa('0x34')][_0xc3fa('0x3a')]('nolimit')){_0x472d3d['limit']=qs[_0xc3fa('0x1b')](_0x423396[_0xc3fa('0x34')][_0xc3fa('0x1b')]);_0x472d3d[_0xc3fa('0x19')]=qs[_0xc3fa('0x19')](_0x423396[_0xc3fa('0x34')][_0xc3fa('0x19')]);}_0x472d3d[_0xc3fa('0x3b')]=qs[_0xc3fa('0x3c')](_0x423396[_0xc3fa('0x34')][_0xc3fa('0x3c')]);_0x472d3d[_0xc3fa('0x3d')]=qs[_0xc3fa('0x35')](_[_0xc3fa('0x3e')](_0x423396['query'],_0x15e530[_0xc3fa('0x35')]),_0x2eaaa1);if(_0x423396['query'][_0xc3fa('0x3f')]){_0x472d3d['where']=_[_0xc3fa('0x40')](_0x472d3d['where'],{'$or':_[_0xc3fa('0x2e')](_0x2eaaa1,function(_0xfce67e){if(_0xfce67e[_0xc3fa('0x30')]!==_0xc3fa('0x41')){var _0x27805c={};_0x27805c[_0xfce67e[_0xc3fa('0x2b')]]={'$like':'%'+_0x423396[_0xc3fa('0x34')][_0xc3fa('0x3f')]+'%'};return _0x27805c;}})});}_0x472d3d=_[_0xc3fa('0x40')]({},_0x472d3d,_0x423396['options']);var _0x3760cd={'where':_0x472d3d['where']};return db[_0xc3fa('0x2f')][_0xc3fa('0x1c')](_0x3760cd)[_0xc3fa('0x23')](function(_0x2b3245){_0x4390b8['count']=_0x2b3245;if(_0x423396[_0xc3fa('0x34')][_0xc3fa('0x42')]){_0x472d3d[_0xc3fa('0x43')]=[{'all':!![]}];}return db[_0xc3fa('0x2f')][_0xc3fa('0x44')](_0x472d3d);})[_0xc3fa('0x23')](function(_0x3bced3){_0x4390b8[_0xc3fa('0x45')]=_0x3bced3;return _0x4390b8;})[_0xc3fa('0x23')](respondWithFilteredResult(_0x36a0,_0x472d3d))['catch'](handleError(_0x36a0,null));};exports['show']=function(_0x1e4836,_0x4f9c82){var _0x30997c={'raw':![],'where':{'id':_0x1e4836[_0xc3fa('0x46')]['id']}},_0x47bcc0={};_0x47bcc0[_0xc3fa('0x32')]=_['keys'](db[_0xc3fa('0x2f')][_0xc3fa('0x47')]);_0x47bcc0[_0xc3fa('0x34')]=_[_0xc3fa('0x33')](_0x1e4836[_0xc3fa('0x34')]);_0x47bcc0[_0xc3fa('0x35')]=_[_0xc3fa('0x36')](_0x47bcc0[_0xc3fa('0x32')],_0x47bcc0[_0xc3fa('0x34')]);_0x30997c[_0xc3fa('0x37')]=_['intersection'](_0x47bcc0[_0xc3fa('0x32')],qs[_0xc3fa('0x38')](_0x1e4836['query'][_0xc3fa('0x38')]));_0x30997c['attributes']=_0x30997c[_0xc3fa('0x37')]['length']?_0x30997c[_0xc3fa('0x37')]:_0x47bcc0[_0xc3fa('0x32')];if(_0x1e4836['query'][_0xc3fa('0x42')]){_0x30997c[_0xc3fa('0x43')]=[{'all':!![]}];}_0x30997c=_['merge']({},_0x30997c,_0x1e4836['options']);return db[_0xc3fa('0x2f')][_0xc3fa('0x48')](_0x30997c)[_0xc3fa('0x23')](handleEntityNotFound(_0x4f9c82,null))[_0xc3fa('0x23')](respondWithResult(_0x4f9c82,null))['catch'](handleError(_0x4f9c82,null));};exports[_0xc3fa('0x49')]=function(_0x44b52c,_0x33f4be){return db[_0xc3fa('0x2f')][_0xc3fa('0x49')](_0x44b52c[_0xc3fa('0x4a')],{})[_0xc3fa('0x23')](function(_0x34be73){var _0x2ed941=_0x44b52c['user'][_0xc3fa('0x25')]({'plain':!![]});if(!_0x2ed941)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2ed941[_0xc3fa('0x4b')]===_0xc3fa('0x4c')){var _0x1aa0c9=_0x34be73['get']({'plain':!![]});var _0x170705=_0xc3fa('0x26');return db[_0xc3fa('0x4d')]['find']({'where':{'name':_0x170705,'userProfileId':_0x2ed941[_0xc3fa('0x4e')]},'raw':!![]})['then'](function(_0xcb8d0a){if(_0xcb8d0a&&_0xcb8d0a[_0xc3fa('0x4f')]===0x0){return db[_0xc3fa('0x27')][_0xc3fa('0x49')]({'name':_0x1aa0c9[_0xc3fa('0x2b')],'resourceId':_0x1aa0c9['id'],'type':_0xcb8d0a['name'],'sectionId':_0xcb8d0a['id']},{})[_0xc3fa('0x23')](function(){return _0x34be73;});}else{return _0x34be73;}})[_0xc3fa('0x50')](function(_0x253e6b){logger[_0xc3fa('0x29')](_0xc3fa('0x51'),_0x253e6b);throw _0x253e6b;});}return _0x34be73;})[_0xc3fa('0x23')](respondWithResult(_0x33f4be,0xc9))[_0xc3fa('0x50')](handleError(_0x33f4be,null));};exports['update']=function(_0x124de3,_0x1d1240){if(_0x124de3[_0xc3fa('0x4a')]['id']){delete _0x124de3['body']['id'];}return db[_0xc3fa('0x2f')]['find']({'where':{'id':_0x124de3['params']['id']}})[_0xc3fa('0x23')](handleEntityNotFound(_0x1d1240,null))['then'](saveUpdates(_0x124de3[_0xc3fa('0x4a')],null))[_0xc3fa('0x23')](respondWithResult(_0x1d1240,null))['catch'](handleError(_0x1d1240,null));};exports[_0xc3fa('0x24')]=function(_0x13bf90,_0x18ec89){return db[_0xc3fa('0x2f')]['find']({'where':{'id':_0x13bf90['params']['id']}})[_0xc3fa('0x23')](handleEntityNotFound(_0x18ec89,null))[_0xc3fa('0x23')](removeEntity(_0x18ec89,null))[_0xc3fa('0x50')](handleError(_0x18ec89,null));};exports[_0xc3fa('0x52')]=function(_0x42045c,_0x42fccb,_0x3cb9c0){if(_0x42045c['body']['id']){delete _0x42045c[_0xc3fa('0x4a')]['id'];}return db[_0xc3fa('0x2f')][_0xc3fa('0x48')]({'where':{'id':_0x42045c[_0xc3fa('0x46')]['id']}})[_0xc3fa('0x23')](handleEntityNotFound(_0x42fccb,null))[_0xc3fa('0x23')](function(_0x35580e){if(_0x35580e){_0x42045c[_0xc3fa('0x4a')]['TriggerAllId']=_0x35580e['id'];return db[_0xc3fa('0x53')][_0xc3fa('0x49')](_0x42045c[_0xc3fa('0x4a')]);}})[_0xc3fa('0x23')](respondWithResult(_0x42fccb,null))[_0xc3fa('0x50')](handleError(_0x42fccb,null));};exports[_0xc3fa('0x54')]=function(_0x19f464,_0x152cdf,_0x34fa4a){if(_0x19f464[_0xc3fa('0x4a')]['id']){delete _0x19f464['body']['id'];}return db[_0xc3fa('0x2f')]['find']({'where':{'id':_0x19f464[_0xc3fa('0x46')]['id']}})[_0xc3fa('0x23')](handleEntityNotFound(_0x152cdf,null))[_0xc3fa('0x23')](function(_0xb4f669){if(_0xb4f669){_0x19f464[_0xc3fa('0x4a')][_0xc3fa('0x55')]=_0xb4f669['id'];return db['Condition']['create'](_0x19f464[_0xc3fa('0x4a')]);}})[_0xc3fa('0x23')](respondWithResult(_0x152cdf,null))[_0xc3fa('0x50')](handleError(_0x152cdf,null));};exports['getAllConditions']=function(_0xa60b,_0x1e8b82,_0x5d4249){var _0x46e7c9={};var _0x39ab31={};var _0x3c700e;var _0x495406;return db[_0xc3fa('0x2f')][_0xc3fa('0x56')]({'where':{'id':_0xa60b[_0xc3fa('0x46')]['id']}})[_0xc3fa('0x23')](handleEntityNotFound(_0x1e8b82,null))['then'](function(_0x24f311){if(_0x24f311){_0x3c700e=_0x24f311;_0x39ab31['model']=_[_0xc3fa('0x33')](db[_0xc3fa('0x53')]['rawAttributes']);_0x39ab31[_0xc3fa('0x34')]=_['keys'](_0xa60b[_0xc3fa('0x34')]);_0x39ab31['filters']=_['intersection'](_0x39ab31[_0xc3fa('0x32')],_0x39ab31[_0xc3fa('0x34')]);_0x46e7c9[_0xc3fa('0x37')]=_['intersection'](_0x39ab31[_0xc3fa('0x32')],qs[_0xc3fa('0x38')](_0xa60b['query'][_0xc3fa('0x38')]));_0x46e7c9['attributes']=_0x46e7c9[_0xc3fa('0x37')]['length']?_0x46e7c9[_0xc3fa('0x37')]:_0x39ab31['model'];_0x46e7c9[_0xc3fa('0x3b')]=qs[_0xc3fa('0x3c')](_0xa60b[_0xc3fa('0x34')][_0xc3fa('0x3c')]);_0x46e7c9[_0xc3fa('0x3d')]=qs[_0xc3fa('0x35')](_[_0xc3fa('0x3e')](_0xa60b[_0xc3fa('0x34')],_0x39ab31[_0xc3fa('0x35')]));if(_0xa60b['query'][_0xc3fa('0x3f')]){_0x46e7c9['where']=_[_0xc3fa('0x40')](_0x46e7c9[_0xc3fa('0x3d')],{'$or':_['map'](_0x46e7c9[_0xc3fa('0x37')],function(_0x110b8b){var _0x54c025={};_0x54c025[_0x110b8b]={'$like':'%'+_0xa60b[_0xc3fa('0x34')]['filter']+'%'};return _0x54c025;})});}_0x46e7c9=_[_0xc3fa('0x40')]({},_0x46e7c9,_0xa60b[_0xc3fa('0x57')]);return _0x3c700e[_0xc3fa('0x58')](_0x46e7c9);}})[_0xc3fa('0x23')](function(_0x287a76){if(_0x287a76){_0x495406=_0x287a76[_0xc3fa('0x39')];if(!_0xa60b[_0xc3fa('0x34')][_0xc3fa('0x3a')](_0xc3fa('0x59'))){_0x46e7c9[_0xc3fa('0x1b')]=qs[_0xc3fa('0x1b')](_0xa60b[_0xc3fa('0x34')][_0xc3fa('0x1b')]);_0x46e7c9[_0xc3fa('0x19')]=qs[_0xc3fa('0x19')](_0xa60b[_0xc3fa('0x34')]['offset']);}return _0x3c700e['getAllConditions'](_0x46e7c9);}})[_0xc3fa('0x23')](function(_0x4440d4){if(_0x4440d4){return _0x4440d4?{'count':_0x495406,'rows':_0x4440d4}:null;}})[_0xc3fa('0x23')](respondWithResult(_0x1e8b82,null))[_0xc3fa('0x50')](handleError(_0x1e8b82,null));};exports['getAnyConditions']=function(_0x28609e,_0x2b3d2b,_0x22effa){var _0x5a804e={};var _0xdd8619={};var _0x169a18;var _0x492229;return db['Trigger']['findOne']({'where':{'id':_0x28609e[_0xc3fa('0x46')]['id']}})[_0xc3fa('0x23')](handleEntityNotFound(_0x2b3d2b,null))[_0xc3fa('0x23')](function(_0x3e45b2){if(_0x3e45b2){_0x169a18=_0x3e45b2;_0xdd8619['model']=_[_0xc3fa('0x33')](db[_0xc3fa('0x53')]['rawAttributes']);_0xdd8619[_0xc3fa('0x34')]=_[_0xc3fa('0x33')](_0x28609e[_0xc3fa('0x34')]);_0xdd8619[_0xc3fa('0x35')]=_[_0xc3fa('0x36')](_0xdd8619[_0xc3fa('0x32')],_0xdd8619['query']);_0x5a804e[_0xc3fa('0x37')]=_[_0xc3fa('0x36')](_0xdd8619['model'],qs['fields'](_0x28609e[_0xc3fa('0x34')]['fields']));_0x5a804e['attributes']=_0x5a804e[_0xc3fa('0x37')]['length']?_0x5a804e[_0xc3fa('0x37')]:_0xdd8619[_0xc3fa('0x32')];_0x5a804e[_0xc3fa('0x3b')]=qs[_0xc3fa('0x3c')](_0x28609e[_0xc3fa('0x34')][_0xc3fa('0x3c')]);_0x5a804e['where']=qs[_0xc3fa('0x35')](_[_0xc3fa('0x3e')](_0x28609e[_0xc3fa('0x34')],_0xdd8619['filters']));if(_0x28609e[_0xc3fa('0x34')][_0xc3fa('0x3f')]){_0x5a804e[_0xc3fa('0x3d')]=_['merge'](_0x5a804e[_0xc3fa('0x3d')],{'$or':_[_0xc3fa('0x2e')](_0x5a804e['attributes'],function(_0x1801de){var _0x527892={};_0x527892[_0x1801de]={'$like':'%'+_0x28609e[_0xc3fa('0x34')]['filter']+'%'};return _0x527892;})});}_0x5a804e=_[_0xc3fa('0x40')]({},_0x5a804e,_0x28609e['options']);return _0x169a18['getAnyConditions'](_0x5a804e);}})[_0xc3fa('0x23')](function(_0x5f3f5a){if(_0x5f3f5a){_0x492229=_0x5f3f5a[_0xc3fa('0x39')];if(!_0x28609e['query']['hasOwnProperty'](_0xc3fa('0x59'))){_0x5a804e[_0xc3fa('0x1b')]=qs[_0xc3fa('0x1b')](_0x28609e[_0xc3fa('0x34')][_0xc3fa('0x1b')]);_0x5a804e[_0xc3fa('0x19')]=qs['offset'](_0x28609e[_0xc3fa('0x34')][_0xc3fa('0x19')]);}return _0x169a18[_0xc3fa('0x5a')](_0x5a804e);}})[_0xc3fa('0x23')](function(_0x32f46a){if(_0x32f46a){return _0x32f46a?{'count':_0x492229,'rows':_0x32f46a}:null;}})[_0xc3fa('0x23')](respondWithResult(_0x2b3d2b,null))[_0xc3fa('0x50')](handleError(_0x2b3d2b,null));};exports[_0xc3fa('0x5b')]=function(_0x1d967b,_0x1a7409,_0x29b5e1){if(_0x1d967b[_0xc3fa('0x4a')]['id']){delete _0x1d967b[_0xc3fa('0x4a')]['id'];}return db[_0xc3fa('0x2f')][_0xc3fa('0x48')]({'where':{'id':_0x1d967b['params']['id']}})[_0xc3fa('0x23')](handleEntityNotFound(_0x1a7409,null))[_0xc3fa('0x23')](function(_0x99b62b){if(_0x99b62b){_0x1d967b[_0xc3fa('0x4a')][_0xc3fa('0x5c')]=_0x99b62b['id'];return db[_0xc3fa('0x5d')][_0xc3fa('0x49')](_0x1d967b[_0xc3fa('0x4a')]);}})[_0xc3fa('0x23')](respondWithResult(_0x1a7409,null))[_0xc3fa('0x50')](handleError(_0x1a7409,null));};exports[_0xc3fa('0x5e')]=function(_0x1ad45a,_0x54a1fc,_0x1a61d8){var _0x8a542={};var _0x4cb7f1={};var _0x264fca;var _0x45d868;return db['Trigger']['findOne']({'where':{'id':_0x1ad45a[_0xc3fa('0x46')]['id']}})['then'](handleEntityNotFound(_0x54a1fc,null))[_0xc3fa('0x23')](function(_0x89600b){if(_0x89600b){_0x264fca=_0x89600b;_0x4cb7f1['model']=_[_0xc3fa('0x33')](db[_0xc3fa('0x5d')][_0xc3fa('0x47')]);_0x4cb7f1[_0xc3fa('0x34')]=_[_0xc3fa('0x33')](_0x1ad45a[_0xc3fa('0x34')]);_0x4cb7f1[_0xc3fa('0x35')]=_['intersection'](_0x4cb7f1[_0xc3fa('0x32')],_0x4cb7f1[_0xc3fa('0x34')]);_0x8a542[_0xc3fa('0x37')]=_[_0xc3fa('0x36')](_0x4cb7f1[_0xc3fa('0x32')],qs['fields'](_0x1ad45a[_0xc3fa('0x34')][_0xc3fa('0x38')]));_0x8a542[_0xc3fa('0x37')]=_0x8a542['attributes'][_0xc3fa('0x39')]?_0x8a542[_0xc3fa('0x37')]:_0x4cb7f1[_0xc3fa('0x32')];_0x8a542[_0xc3fa('0x3b')]=qs['sort'](_0x1ad45a['query'][_0xc3fa('0x3c')]);_0x8a542[_0xc3fa('0x3d')]=qs[_0xc3fa('0x35')](_['pick'](_0x1ad45a['query'],_0x4cb7f1[_0xc3fa('0x35')]));if(_0x1ad45a[_0xc3fa('0x34')][_0xc3fa('0x3f')]){_0x8a542[_0xc3fa('0x3d')]=_[_0xc3fa('0x40')](_0x8a542[_0xc3fa('0x3d')],{'$or':_[_0xc3fa('0x2e')](_0x8a542[_0xc3fa('0x37')],function(_0x323b13){var _0x56834d={};_0x56834d[_0x323b13]={'$like':'%'+_0x1ad45a[_0xc3fa('0x34')][_0xc3fa('0x3f')]+'%'};return _0x56834d;})});}_0x8a542=_[_0xc3fa('0x40')]({},_0x8a542,_0x1ad45a['options']);return _0x264fca['getActions'](_0x8a542);}})[_0xc3fa('0x23')](function(_0x37d73a){if(_0x37d73a){_0x45d868=_0x37d73a[_0xc3fa('0x39')];if(!_0x1ad45a['query'][_0xc3fa('0x3a')](_0xc3fa('0x59'))){_0x8a542[_0xc3fa('0x1b')]=qs[_0xc3fa('0x1b')](_0x1ad45a[_0xc3fa('0x34')][_0xc3fa('0x1b')]);_0x8a542[_0xc3fa('0x19')]=qs['offset'](_0x1ad45a[_0xc3fa('0x34')][_0xc3fa('0x19')]);}return _0x264fca[_0xc3fa('0x5e')](_0x8a542);}})['then'](function(_0x46e153){if(_0x46e153){return _0x46e153?{'count':_0x45d868,'rows':_0x46e153}:null;}})[_0xc3fa('0x23')](respondWithResult(_0x54a1fc,null))[_0xc3fa('0x50')](handleError(_0x54a1fc,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index 649de03..e0f5944 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 _0x0e9f=['moment','path','./trigger.attributes','exports','Trigger','tools_triggers','lodash','util'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x0e9f,0x116));var _0xf0e9=function(_0x36e042,_0x3f20bc){_0x36e042=_0x36e042-0x0;var _0x554b5e=_0x0e9f[_0x36e042];return _0x554b5e;};'use strict';var _=require(_0xf0e9('0x0'));var util=require(_0xf0e9('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xf0e9('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xf0e9('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xf0e9('0x4'));module[_0xf0e9('0x5')]=function(_0x59ac7e,_0x2322dc){return _0x59ac7e['define'](_0xf0e9('0x6'),attributes,{'tableName':_0xf0e9('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x76bb=['../../config/logger','api','moment','request-promise','path','../../config/environment','./trigger.attributes','define','Trigger','tools_triggers','util'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x76bb,0x16a));var _0xb76b=function(_0x322bef,_0x4890d4){_0x322bef=_0x322bef-0x0;var _0x229e60=_0x76bb[_0x322bef];return _0x229e60;};'use strict';var _=require('lodash');var util=require(_0xb76b('0x0'));var logger=require(_0xb76b('0x1'))(_0xb76b('0x2'));var moment=require(_0xb76b('0x3'));var BPromise=require('bluebird');var rp=require(_0xb76b('0x4'));var fs=require('fs');var path=require(_0xb76b('0x5'));var rimraf=require('rimraf');var config=require(_0xb76b('0x6'));var attributes=require(_0xb76b('0x7'));module['exports']=function(_0x42254d,_0x361737){return _0x42254d[_0xb76b('0x8')](_0xb76b('0x9'),attributes,{'tableName':_0xb76b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trigger/trigger.rpc.js b/server/api/trigger/trigger.rpc.js index 5f35a7f..639f8dd 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 _0xab40=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','Trigger,\x20%s,\x20%s','request\x20sent','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','code','message','GetTrigger','Trigger','findAll','options','raw','where','attributes','include','map','model','find','debug','ShowTrigger','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x44a0e9,_0x959f63){var _0x3b8e8c=function(_0x11b3e1){while(--_0x11b3e1){_0x44a0e9['push'](_0x44a0e9['shift']());}};_0x3b8e8c(++_0x959f63);}(_0xab40,0x64));var _0x0ab4=function(_0x5524f2,_0x2880b4){_0x5524f2=_0x5524f2-0x0;var _0x551347=_0xab40[_0x5524f2];return _0x551347;};'use strict';var _=require(_0x0ab4('0x0'));var util=require(_0x0ab4('0x1'));var moment=require(_0x0ab4('0x2'));var BPromise=require(_0x0ab4('0x3'));var rs=require(_0x0ab4('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x0ab4('0x5'));var logger=require(_0x0ab4('0x6'))('rpc');var config=require(_0x0ab4('0x7'));var jayson=require(_0x0ab4('0x8'));var client=jayson[_0x0ab4('0x9')][_0x0ab4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x27e4ca,_0x52b72c,_0x950f38){return new BPromise(function(_0x405e34,_0x11f8bf){return client[_0x0ab4('0xb')](_0x27e4ca,_0x950f38)[_0x0ab4('0xc')](function(_0x4e66f8){logger[_0x0ab4('0xd')](_0x0ab4('0xe'),_0x52b72c,_0x0ab4('0xf'));logger['debug'](_0x0ab4('0x10'),_0x52b72c,_0x0ab4('0xf'),JSON[_0x0ab4('0x11')](_0x4e66f8));if(_0x4e66f8['error']){if(_0x4e66f8[_0x0ab4('0x12')][_0x0ab4('0x13')]===0x1f4){logger[_0x0ab4('0x12')]('Trigger,\x20%s,\x20%s',_0x52b72c,_0x4e66f8[_0x0ab4('0x12')][_0x0ab4('0x14')]);return _0x11f8bf(_0x4e66f8[_0x0ab4('0x12')][_0x0ab4('0x14')]);}logger[_0x0ab4('0x12')]('Trigger,\x20%s,\x20%s',_0x52b72c,_0x4e66f8[_0x0ab4('0x12')][_0x0ab4('0x14')]);return _0x405e34(_0x4e66f8[_0x0ab4('0x12')]['message']);}else{logger[_0x0ab4('0xd')]('Trigger,\x20%s,\x20%s',_0x52b72c,_0x0ab4('0xf'));_0x405e34(_0x4e66f8['result']['message']);}})['catch'](function(_0x479541){logger[_0x0ab4('0x12')](_0x0ab4('0xe'),_0x52b72c,_0x479541);_0x11f8bf(_0x479541);});});}exports[_0x0ab4('0x15')]=function(_0x44131b){var _0x3920bb=this;return new Promise(function(_0x4b9f70,_0x1ec04c){return db[_0x0ab4('0x16')][_0x0ab4('0x17')]({'raw':_0x44131b[_0x0ab4('0x18')]?_0x44131b['options'][_0x0ab4('0x19')]===undefined?!![]:![]:!![],'where':_0x44131b[_0x0ab4('0x18')]?_0x44131b[_0x0ab4('0x18')][_0x0ab4('0x1a')]||null:null,'attributes':_0x44131b[_0x0ab4('0x18')]?_0x44131b[_0x0ab4('0x18')][_0x0ab4('0x1b')]||null:null,'limit':_0x44131b[_0x0ab4('0x18')]?_0x44131b[_0x0ab4('0x18')]['limit']||null:null,'include':_0x44131b[_0x0ab4('0x18')]?_0x44131b[_0x0ab4('0x18')][_0x0ab4('0x1c')]?_[_0x0ab4('0x1d')](_0x44131b['options'][_0x0ab4('0x1c')],function(_0x25b97d){return{'model':db[_0x25b97d['model']],'as':_0x25b97d['as'],'attributes':_0x25b97d[_0x0ab4('0x1b')],'include':_0x25b97d[_0x0ab4('0x1c')]?_[_0x0ab4('0x1d')](_0x25b97d[_0x0ab4('0x1c')],function(_0x228c93){return{'model':db[_0x228c93[_0x0ab4('0x1e')]],'as':_0x228c93['as'],'attributes':_0x228c93['attributes'],'include':_0x228c93[_0x0ab4('0x1c')]?_[_0x0ab4('0x1d')](_0x228c93[_0x0ab4('0x1c')],function(_0x357efb){return{'model':db[_0x357efb[_0x0ab4('0x1e')]],'as':_0x357efb['as'],'attributes':_0x357efb['attributes']};}):[]};}):[]};}):[]:[]})[_0x0ab4('0xc')](function(_0x2a566e){logger['info'](_0x0ab4('0x15'),_0x44131b);logger['debug'](_0x0ab4('0x15'),_0x44131b,JSON['stringify'](_0x2a566e));_0x4b9f70(_0x2a566e);})['catch'](function(_0x35047d){logger[_0x0ab4('0x12')]('GetTrigger',_0x35047d['message'],_0x44131b);_0x1ec04c(_0x3920bb[_0x0ab4('0x12')](0x1f4,_0x35047d[_0x0ab4('0x14')]));});});};exports['ShowTrigger']=function(_0x3be80a){var _0x23c233=this;return new Promise(function(_0x30536e,_0x38e9b9){return db[_0x0ab4('0x16')][_0x0ab4('0x1f')]({'raw':_0x3be80a[_0x0ab4('0x18')]?_0x3be80a[_0x0ab4('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x3be80a[_0x0ab4('0x18')]?_0x3be80a[_0x0ab4('0x18')][_0x0ab4('0x1a')]||null:null,'attributes':_0x3be80a[_0x0ab4('0x18')]?_0x3be80a[_0x0ab4('0x18')][_0x0ab4('0x1b')]||null:null,'include':_0x3be80a[_0x0ab4('0x18')]?_0x3be80a[_0x0ab4('0x18')][_0x0ab4('0x1c')]?_[_0x0ab4('0x1d')](_0x3be80a[_0x0ab4('0x18')][_0x0ab4('0x1c')],function(_0x13f847){return{'model':db[_0x13f847[_0x0ab4('0x1e')]],'as':_0x13f847['as'],'attributes':_0x13f847['attributes'],'include':_0x13f847[_0x0ab4('0x1c')]?_[_0x0ab4('0x1d')](_0x13f847[_0x0ab4('0x1c')],function(_0x1c341c){return{'model':db[_0x1c341c[_0x0ab4('0x1e')]],'as':_0x1c341c['as'],'attributes':_0x1c341c[_0x0ab4('0x1b')],'include':_0x1c341c['include']?_[_0x0ab4('0x1d')](_0x1c341c[_0x0ab4('0x1c')],function(_0x5c3895){return{'model':db[_0x5c3895[_0x0ab4('0x1e')]],'as':_0x5c3895['as'],'attributes':_0x5c3895[_0x0ab4('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x0ab4('0xc')](function(_0x5b9538){logger[_0x0ab4('0xd')]('ShowTrigger',_0x3be80a);logger[_0x0ab4('0x20')](_0x0ab4('0x21'),_0x3be80a,JSON[_0x0ab4('0x11')](_0x5b9538));_0x30536e(_0x5b9538);})[_0x0ab4('0x22')](function(_0x4d1057){logger['error']('ShowTrigger',_0x4d1057[_0x0ab4('0x14')],_0x3be80a);_0x38e9b9(_0x23c233[_0x0ab4('0x12')](0x1f4,_0x4d1057[_0x0ab4('0x14')]));});});}; \ No newline at end of file +var _0xc374=['message','info','catch','GetTrigger','Trigger','findAll','options','raw','where','attributes','limit','include','model','map','then','ShowTrigger','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','jayson/promise','http','request','Trigger,\x20%s,\x20%s','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x466f51,_0x1393ed){var _0x2db305=function(_0x126ae3){while(--_0x126ae3){_0x466f51['push'](_0x466f51['shift']());}};_0x2db305(++_0x1393ed);}(_0xc374,0xf0));var _0x4c37=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xc374[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x4c37('0x0'));var util=require(_0x4c37('0x1'));var moment=require(_0x4c37('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4c37('0x3'));var db=require(_0x4c37('0x4'))['db'];var utils=require(_0x4c37('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x4c37('0x6'));var client=jayson['client'][_0x4c37('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5439d9,_0xed5d47,_0x291fa3){return new BPromise(function(_0x35b4fa,_0xb2aff1){return client[_0x4c37('0x8')](_0x5439d9,_0x291fa3)['then'](function(_0x189166){logger['info'](_0x4c37('0x9'),_0xed5d47,_0x4c37('0xa'));logger[_0x4c37('0xb')](_0x4c37('0xc'),_0xed5d47,_0x4c37('0xa'),JSON[_0x4c37('0xd')](_0x189166));if(_0x189166['error']){if(_0x189166[_0x4c37('0xe')][_0x4c37('0xf')]===0x1f4){logger[_0x4c37('0xe')](_0x4c37('0x9'),_0xed5d47,_0x189166[_0x4c37('0xe')][_0x4c37('0x10')]);return _0xb2aff1(_0x189166[_0x4c37('0xe')]['message']);}logger['error'](_0x4c37('0x9'),_0xed5d47,_0x189166['error'][_0x4c37('0x10')]);return _0x35b4fa(_0x189166[_0x4c37('0xe')][_0x4c37('0x10')]);}else{logger[_0x4c37('0x11')]('Trigger,\x20%s,\x20%s',_0xed5d47,_0x4c37('0xa'));_0x35b4fa(_0x189166['result']['message']);}})[_0x4c37('0x12')](function(_0x359aeb){logger[_0x4c37('0xe')](_0x4c37('0x9'),_0xed5d47,_0x359aeb);_0xb2aff1(_0x359aeb);});});}exports[_0x4c37('0x13')]=function(_0x211bfa){var _0x4a784e=this;return new Promise(function(_0x10cb01,_0x4a93ce){return db[_0x4c37('0x14')][_0x4c37('0x15')]({'raw':_0x211bfa[_0x4c37('0x16')]?_0x211bfa['options'][_0x4c37('0x17')]===undefined?!![]:![]:!![],'where':_0x211bfa['options']?_0x211bfa[_0x4c37('0x16')][_0x4c37('0x18')]||null:null,'attributes':_0x211bfa['options']?_0x211bfa[_0x4c37('0x16')][_0x4c37('0x19')]||null:null,'limit':_0x211bfa[_0x4c37('0x16')]?_0x211bfa[_0x4c37('0x16')][_0x4c37('0x1a')]||null:null,'include':_0x211bfa[_0x4c37('0x16')]?_0x211bfa['options'][_0x4c37('0x1b')]?_['map'](_0x211bfa['options'][_0x4c37('0x1b')],function(_0x58952f){return{'model':db[_0x58952f[_0x4c37('0x1c')]],'as':_0x58952f['as'],'attributes':_0x58952f[_0x4c37('0x19')],'include':_0x58952f[_0x4c37('0x1b')]?_['map'](_0x58952f[_0x4c37('0x1b')],function(_0x10ad6c){return{'model':db[_0x10ad6c[_0x4c37('0x1c')]],'as':_0x10ad6c['as'],'attributes':_0x10ad6c[_0x4c37('0x19')],'include':_0x10ad6c[_0x4c37('0x1b')]?_[_0x4c37('0x1d')](_0x10ad6c[_0x4c37('0x1b')],function(_0x57c44a){return{'model':db[_0x57c44a[_0x4c37('0x1c')]],'as':_0x57c44a['as'],'attributes':_0x57c44a[_0x4c37('0x19')]};}):[]};}):[]};}):[]:[]})[_0x4c37('0x1e')](function(_0x3b8396){logger['info'](_0x4c37('0x13'),_0x211bfa);logger[_0x4c37('0xb')](_0x4c37('0x13'),_0x211bfa,JSON[_0x4c37('0xd')](_0x3b8396));_0x10cb01(_0x3b8396);})[_0x4c37('0x12')](function(_0x5b3248){logger['error']('GetTrigger',_0x5b3248[_0x4c37('0x10')],_0x211bfa);_0x4a93ce(_0x4a784e['error'](0x1f4,_0x5b3248[_0x4c37('0x10')]));});});};exports['ShowTrigger']=function(_0x26e980){var _0x45e899=this;return new Promise(function(_0x5eb4fa,_0x4f9b49){return db['Trigger']['find']({'raw':_0x26e980['options']?_0x26e980[_0x4c37('0x16')][_0x4c37('0x17')]===undefined?!![]:![]:!![],'where':_0x26e980['options']?_0x26e980['options'][_0x4c37('0x18')]||null:null,'attributes':_0x26e980[_0x4c37('0x16')]?_0x26e980[_0x4c37('0x16')][_0x4c37('0x19')]||null:null,'include':_0x26e980[_0x4c37('0x16')]?_0x26e980[_0x4c37('0x16')][_0x4c37('0x1b')]?_['map'](_0x26e980[_0x4c37('0x16')][_0x4c37('0x1b')],function(_0x1ac704){return{'model':db[_0x1ac704[_0x4c37('0x1c')]],'as':_0x1ac704['as'],'attributes':_0x1ac704['attributes'],'include':_0x1ac704[_0x4c37('0x1b')]?_[_0x4c37('0x1d')](_0x1ac704[_0x4c37('0x1b')],function(_0xaa6c0a){return{'model':db[_0xaa6c0a['model']],'as':_0xaa6c0a['as'],'attributes':_0xaa6c0a[_0x4c37('0x19')],'include':_0xaa6c0a[_0x4c37('0x1b')]?_[_0x4c37('0x1d')](_0xaa6c0a[_0x4c37('0x1b')],function(_0x51e844){return{'model':db[_0x51e844[_0x4c37('0x1c')]],'as':_0x51e844['as'],'attributes':_0x51e844['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x1e3df0){logger[_0x4c37('0x11')](_0x4c37('0x1f'),_0x26e980);logger[_0x4c37('0xb')](_0x4c37('0x1f'),_0x26e980,JSON[_0x4c37('0xd')](_0x1e3df0));_0x5eb4fa(_0x1e3df0);})[_0x4c37('0x12')](function(_0x3e63a2){logger[_0x4c37('0xe')]('ShowTrigger',_0x3e63a2[_0x4c37('0x10')],_0x26e980);_0x4f9b49(_0x45e899[_0x4c37('0xe')](0x1f4,_0x3e63a2[_0x4c37('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index d46fe5d..c34c44f 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 _0xb6c2=['path','connect-timeout','express','Router','fs-extra','./trunk.controller','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','multer','util'];(function(_0x49fcfb,_0x504dec){var _0x964926=function(_0x327977){while(--_0x327977){_0x49fcfb['push'](_0x49fcfb['shift']());}};_0x964926(++_0x504dec);}(_0xb6c2,0x70));var _0x2b6c=function(_0x623a22,_0x18674e){_0x623a22=_0x623a22-0x0;var _0x534e2e=_0xb6c2[_0x623a22];return _0x534e2e;};'use strict';var multer=require(_0x2b6c('0x0'));var util=require(_0x2b6c('0x1'));var path=require(_0x2b6c('0x2'));var timeout=require(_0x2b6c('0x3'));var express=require(_0x2b6c('0x4'));var router=express[_0x2b6c('0x5')]();var fs_extra=require(_0x2b6c('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x2b6c('0x7'));router['get']('/',auth[_0x2b6c('0x8')](),controller[_0x2b6c('0x9')]);router['get'](_0x2b6c('0xa'),auth[_0x2b6c('0x8')](),controller[_0x2b6c('0xb')]);router[_0x2b6c('0xc')]('/:id/clone',auth['isAuthenticated'](),controller['clone']);router[_0x2b6c('0xc')]('/',auth['isAuthenticated'](),controller[_0x2b6c('0xd')]);router[_0x2b6c('0xe')](_0x2b6c('0xa'),auth[_0x2b6c('0x8')](),controller[_0x2b6c('0xf')]);router[_0x2b6c('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x2b6c('0x11')]);module[_0x2b6c('0x12')]=router; \ No newline at end of file +var _0x01a2=['util','express','fs-extra','../../components/auth/service','./trunk.controller','get','isAuthenticated','index','/:id','show','post','/:id/clone','clone','create','put','update','delete','destroy','exports','multer'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x01a2,0xdb));var _0x201a=function(_0x31ed10,_0x14229d){_0x31ed10=_0x31ed10-0x0;var _0x41d573=_0x01a2[_0x31ed10];return _0x41d573;};'use strict';var multer=require(_0x201a('0x0'));var util=require(_0x201a('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x201a('0x2'));var router=express['Router']();var fs_extra=require(_0x201a('0x3'));var auth=require(_0x201a('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x201a('0x5'));router[_0x201a('0x6')]('/',auth[_0x201a('0x7')](),controller[_0x201a('0x8')]);router['get'](_0x201a('0x9'),auth['isAuthenticated'](),controller[_0x201a('0xa')]);router[_0x201a('0xb')](_0x201a('0xc'),auth[_0x201a('0x7')](),controller[_0x201a('0xd')]);router[_0x201a('0xb')]('/',auth[_0x201a('0x7')](),controller[_0x201a('0xe')]);router[_0x201a('0xf')](_0x201a('0x9'),auth['isAuthenticated'](),controller[_0x201a('0x10')]);router[_0x201a('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x201a('0x12')]);module[_0x201a('0x13')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index d42d391..57c1d9f 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 _0x318c=['refuse','originate','uas','pai','fingerprint','certificate','active','actpass','update,nonat','BOOLEAN','sequelize','exports','name','ENUM','friend','STRING','from-voip-provider','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','PROHIB_PASSED_SCREEN','PROHIB','setDataValue','transport','join','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','inband','auto','nonat','update','outgoing','yes','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','never','INTEGER','\x22\x22\x20<>','accept'];(function(_0x21929f,_0xb96182){var _0x1a6077=function(_0x209786){while(--_0x209786){_0x21929f['push'](_0x21929f['shift']());}};_0x1a6077(++_0xb96182);}(_0x318c,0x1d6));var _0xc318=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x318c[_0x501510];return _0x1e6ee5;};'use strict';var Sequelize=require(_0xc318('0x0'));module[_0xc318('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xc318('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xc318('0x3')]('friend','user','peer'),'allowNull':![],'defaultValue':_0xc318('0x4')},'context':{'type':Sequelize[_0xc318('0x5')],'allowNull':![],'defaultValue':_0xc318('0x6')},'callingpres':{'type':Sequelize['ENUM']('ALLOWED_NOT_SCREENED',_0xc318('0x7'),_0xc318('0x8'),'ALLOWED','PROHIB_NOT_SCREENED',_0xc318('0x9'),'PROHIB_FAILED_SCREEN',_0xc318('0xa'))},'deny':{'type':Sequelize['STRING']},'permit':{'type':Sequelize[_0xc318('0x5')]},'secret':{'type':Sequelize[_0xc318('0x5')]},'md5secret':{'type':Sequelize[_0xc318('0x5')]},'remotesecret':{'type':Sequelize[_0xc318('0x5')]},'transport':{'type':Sequelize[_0xc318('0x5')],'defaultValue':'udp','set':function(_0x1aee1e){this[_0xc318('0xb')](_0xc318('0xc'),_0x1aee1e?_0x1aee1e[_0xc318('0xd')](','):null);},'get':function(){return this['getDataValue'](_0xc318('0xc'))?this[_0xc318('0xe')](_0xc318('0xc'))[_0xc318('0xf')](','):null;},'comment':_0xc318('0x10')},'dtmfmode':{'type':Sequelize[_0xc318('0x3')](_0xc318('0x11'),'info','shortinfo',_0xc318('0x12'),_0xc318('0x13')),'defaultValue':_0xc318('0x11')},'directmedia':{'type':Sequelize[_0xc318('0x3')]('yes','no',_0xc318('0x14'),_0xc318('0x15'),_0xc318('0x16')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xc318('0x3')](_0xc318('0x17'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING']},'directmediadeny':{'type':Sequelize[_0xc318('0x5')]},'nat':{'type':Sequelize[_0xc318('0x5')],'defaultValue':'force_rport,comedia','set':function(_0x5cc9ea){this[_0xc318('0xb')](_0xc318('0x18'),_0x5cc9ea?_0x5cc9ea[_0xc318('0xd')](','):null);},'get':function(){return this[_0xc318('0xe')](_0xc318('0x18'))?this[_0xc318('0xe')](_0xc318('0x18'))['split'](','):null;},'comment':_0xc318('0x19')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xc318('0x5')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xc318('0x5')],'allowNull':!![]},'disallow':{'type':Sequelize[_0xc318('0x5')],'defaultValue':_0xc318('0x1a')},'allow':{'type':Sequelize[_0xc318('0x5')],'allowNull':![],'defaultValue':_0xc318('0x1b'),'set':function(_0x4603dd){this[_0xc318('0xb')](_0xc318('0x1c'),_0x4603dd?_0x4603dd[_0xc318('0xd')](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0xc318('0xe')](_0xc318('0x1c'))?this[_0xc318('0xe')](_0xc318('0x1c'))[_0xc318('0xf')](';'):null;},'comment':_0xc318('0x1d')},'autoframing':{'type':Sequelize['ENUM'](_0xc318('0x17'),'no')},'insecure':{'type':Sequelize['STRING'],'defaultValue':_0xc318('0x1e'),'set':function(_0x493564){this[_0xc318('0xb')]('insecure',_0x493564?_0x493564[_0xc318('0xd')](','):null);},'get':function(){return this[_0xc318('0xe')](_0xc318('0x1f'))?this['getDataValue'](_0xc318('0x1f'))['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0xc318('0x3')]('yes','no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xc318('0x3')]('yes','no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xc318('0x3')](_0xc318('0x17'),'no',_0xc318('0x20'))},'promiscredir':{'type':Sequelize[_0xc318('0x3')](_0xc318('0x17'),'no')},'useclientcode':{'type':Sequelize[_0xc318('0x3')](_0xc318('0x17'),'no')},'accountcode':{'type':Sequelize[_0xc318('0x21')](0xb)},'setvar':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xc318('0x5')],'defaultValue':_0xc318('0x22')},'amaflags':{'type':Sequelize[_0xc318('0x5')]},'callcounter':{'type':Sequelize['ENUM'](_0xc318('0x17'),'no'),'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0xc318('0x21')](0xb)},'allowoverlap':{'type':Sequelize[_0xc318('0x3')](_0xc318('0x17'),'no')},'allowsubscribe':{'type':Sequelize[_0xc318('0x3')](_0xc318('0x17'),'no')},'allowtransfer':{'type':Sequelize[_0xc318('0x3')](_0xc318('0x17'),'no')},'ignoresdpversion':{'type':Sequelize['ENUM'](_0xc318('0x17'),'no')},'subscribecontext':{'type':Sequelize['STRING']},'template':{'type':Sequelize[_0xc318('0x5')]},'videosupport':{'type':Sequelize[_0xc318('0x3')](_0xc318('0x17'),'no','always'),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xc318('0x21')](0xb)},'rfc2833compensate':{'type':Sequelize['ENUM'](_0xc318('0x17'),'no')},'mailbox':{'type':Sequelize[_0xc318('0x5')]},'session_timers':{'type':Sequelize[_0xc318('0x3')](_0xc318('0x23'),_0xc318('0x24'),_0xc318('0x25'))},'session_expires':{'type':Sequelize[_0xc318('0x21')](0xb)},'session_minse':{'type':Sequelize[_0xc318('0x21')](0xb)},'session_refresher':{'type':Sequelize[_0xc318('0x3')]('uac','uas'),'defaultValue':_0xc318('0x26')},'t38pt_usertpsource':{'type':Sequelize[_0xc318('0x5')]},'regexten':{'type':Sequelize[_0xc318('0x5')]},'fromdomain':{'type':Sequelize[_0xc318('0x5')]},'fromuser':{'type':Sequelize[_0xc318('0x5')]},'port':{'type':Sequelize[_0xc318('0x21')](0x5)},'qualify':{'type':Sequelize['ENUM'](_0xc318('0x17'),'no'),'defaultValue':_0xc318('0x17')},'keepalive':{'type':Sequelize[_0xc318('0x21')](0xb)},'defaultip':{'type':Sequelize[_0xc318('0x5')]},'defaultuser':{'type':Sequelize[_0xc318('0x5')]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpholdtimeout':{'type':Sequelize[_0xc318('0x21')](0xb)},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb)},'sendrpid':{'type':Sequelize[_0xc318('0x3')](_0xc318('0x17'),'no',_0xc318('0x27')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xc318('0x5')]},'callbackextension':{'type':Sequelize[_0xc318('0x5')]},'timert1':{'type':Sequelize[_0xc318('0x21')](0xb)},'timerb':{'type':Sequelize['INTEGER'](0xb)},'qualifyfreq':{'type':Sequelize[_0xc318('0x21')](0xb)},'contactpermit':{'type':Sequelize['STRING']},'contactdeny':{'type':Sequelize[_0xc318('0x5')]},'contactacl':{'type':Sequelize[_0xc318('0x5')]},'unsolicited_mailbox':{'type':Sequelize[_0xc318('0x5')]},'use_q850_reason':{'type':Sequelize[_0xc318('0x5')]},'maxforwards':{'type':Sequelize[_0xc318('0x21')](0xb)},'encryption':{'type':Sequelize[_0xc318('0x3')](_0xc318('0x17'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0xc318('0x3')](_0xc318('0x17'),'no')},'force_avp':{'type':Sequelize['ENUM']('yes','no')},'icesupport':{'type':Sequelize[_0xc318('0x3')]('yes','no')},'dtlsenable':{'type':Sequelize[_0xc318('0x3')](_0xc318('0x17'),'no')},'dtlsverify':{'type':Sequelize[_0xc318('0x3')]('yes','no',_0xc318('0x28'),_0xc318('0x29'))},'dtlsrekey':{'type':Sequelize[_0xc318('0x21')](0xb)},'dtlscertfile':{'type':Sequelize['STRING']},'dtlsprivatekey':{'type':Sequelize[_0xc318('0x5')]},'dtlscipher':{'type':Sequelize[_0xc318('0x5')]},'dtlscafile':{'type':Sequelize[_0xc318('0x5')]},'dtlscapath':{'type':Sequelize['STRING']},'dtlssetup':{'type':Sequelize[_0xc318('0x3')](_0xc318('0x2a'),'passive',_0xc318('0x2b')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xc318('0x5')]},'usereqphone':{'type':Sequelize[_0xc318('0x3')](_0xc318('0x17'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xc318('0x5')]},'recordofffeature':{'type':Sequelize['STRING']},'call_limit':{'type':Sequelize[_0xc318('0x21')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize['ENUM']('yes','no')},'subscribemwi':{'type':Sequelize[_0xc318('0x3')](_0xc318('0x17'),'no')},'vmexten':{'type':Sequelize[_0xc318('0x5')]},'mohinterpret':{'type':Sequelize[_0xc318('0x5')]},'mohsuggest':{'type':Sequelize[_0xc318('0x5')]},'parkinglot':{'type':Sequelize[_0xc318('0x5')]},'description':{'type':Sequelize[_0xc318('0x5')]},'host':{'type':Sequelize['STRING'],'defaultValue':'dynamic'},'canreinvite':{'type':Sequelize['ENUM']('yes','no',_0xc318('0x14'),_0xc318('0x15'),_0xc318('0x2c')),'defaultValue':'no'},'registry':{'type':Sequelize[_0xc318('0x5')]},'otherFields':{'type':Sequelize[_0xc318('0x5')]},'active':{'type':Sequelize[_0xc318('0x2d')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0xc318('0x5')],'defaultValue':'no'}}; \ No newline at end of file +var _0x26ec=['auto','nonat','update','outgoing','yes','force_rport,comedia','setDataValue','nat','join','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','never','\x22\x22\x20<>','always','INTEGER','accept','refuse','uas','pai','fingerprint','certificate','active','actpass','dynamic','sequelize','STRING','name','friend','user','peer','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','transport','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','ENUM','rfc2833','info','shortinfo','inband'];(function(_0xf8d929,_0x926905){var _0x1996ca=function(_0x4526fc){while(--_0x4526fc){_0xf8d929['push'](_0xf8d929['shift']());}};_0x1996ca(++_0x926905);}(_0x26ec,0x126));var _0xc26e=function(_0x4c0d17,_0x2d5004){_0x4c0d17=_0x4c0d17-0x0;var _0x21fa76=_0x26ec[_0x4c0d17];return _0x21fa76;};'use strict';var Sequelize=require(_0xc26e('0x0'));module['exports']={'name':{'type':Sequelize[_0xc26e('0x1')],'allowNull':![],'unique':_0xc26e('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0xc26e('0x3'),_0xc26e('0x4'),_0xc26e('0x5')),'allowNull':![],'defaultValue':_0xc26e('0x3')},'context':{'type':Sequelize[_0xc26e('0x1')],'allowNull':![],'defaultValue':_0xc26e('0x6')},'callingpres':{'type':Sequelize['ENUM'](_0xc26e('0x7'),_0xc26e('0x8'),'ALLOWED_FAILED_SCREEN',_0xc26e('0x9'),_0xc26e('0xa'),_0xc26e('0xb'),_0xc26e('0xc'),_0xc26e('0xd'))},'deny':{'type':Sequelize[_0xc26e('0x1')]},'permit':{'type':Sequelize['STRING']},'secret':{'type':Sequelize[_0xc26e('0x1')]},'md5secret':{'type':Sequelize[_0xc26e('0x1')]},'remotesecret':{'type':Sequelize[_0xc26e('0x1')]},'transport':{'type':Sequelize[_0xc26e('0x1')],'defaultValue':_0xc26e('0xe'),'set':function(_0x37abb4){this['setDataValue'](_0xc26e('0xf'),_0x37abb4?_0x37abb4['join'](','):null);},'get':function(){return this[_0xc26e('0x10')]('transport')?this[_0xc26e('0x10')]('transport')[_0xc26e('0x11')](','):null;},'comment':_0xc26e('0x12')},'dtmfmode':{'type':Sequelize[_0xc26e('0x13')](_0xc26e('0x14'),_0xc26e('0x15'),_0xc26e('0x16'),_0xc26e('0x17'),_0xc26e('0x18')),'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0xc26e('0x13')]('yes','no',_0xc26e('0x19'),_0xc26e('0x1a'),_0xc26e('0x1b')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xc26e('0x13')](_0xc26e('0x1c'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xc26e('0x1')]},'directmediadeny':{'type':Sequelize[_0xc26e('0x1')]},'nat':{'type':Sequelize[_0xc26e('0x1')],'defaultValue':_0xc26e('0x1d'),'set':function(_0x615a25){this[_0xc26e('0x1e')](_0xc26e('0x1f'),_0x615a25?_0x615a25[_0xc26e('0x20')](','):null);},'get':function(){return this[_0xc26e('0x10')](_0xc26e('0x1f'))?this[_0xc26e('0x10')](_0xc26e('0x1f'))[_0xc26e('0x11')](','):null;},'comment':_0xc26e('0x21')},'callgroup':{'type':Sequelize[_0xc26e('0x1')]},'namedcallgroup':{'type':Sequelize[_0xc26e('0x1')]},'pickupgroup':{'type':Sequelize[_0xc26e('0x1')]},'namedpickupgroup':{'type':Sequelize[_0xc26e('0x1')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xc26e('0x1')],'allowNull':!![]},'disallow':{'type':Sequelize[_0xc26e('0x1')],'defaultValue':_0xc26e('0x22')},'allow':{'type':Sequelize[_0xc26e('0x1')],'allowNull':![],'defaultValue':_0xc26e('0x23'),'set':function(_0x474abc){this[_0xc26e('0x1e')](_0xc26e('0x24'),_0x474abc?_0x474abc[_0xc26e('0x20')](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0xc26e('0x10')]('allow')?this[_0xc26e('0x10')](_0xc26e('0x24'))[_0xc26e('0x11')](';'):null;},'comment':_0xc26e('0x25')},'autoframing':{'type':Sequelize[_0xc26e('0x13')](_0xc26e('0x1c'),'no')},'insecure':{'type':Sequelize[_0xc26e('0x1')],'defaultValue':_0xc26e('0x26'),'set':function(_0x52277f){this[_0xc26e('0x1e')](_0xc26e('0x27'),_0x52277f?_0x52277f[_0xc26e('0x20')](','):null);},'get':function(){return this[_0xc26e('0x10')](_0xc26e('0x27'))?this[_0xc26e('0x10')](_0xc26e('0x27'))[_0xc26e('0x11')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0xc26e('0x13')]('yes','no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xc26e('0x13')](_0xc26e('0x1c'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xc26e('0x13')](_0xc26e('0x1c'),'no',_0xc26e('0x28'))},'promiscredir':{'type':Sequelize[_0xc26e('0x13')]('yes','no')},'useclientcode':{'type':Sequelize[_0xc26e('0x13')]('yes','no')},'accountcode':{'type':Sequelize['INTEGER'](0xb)},'setvar':{'type':Sequelize[_0xc26e('0x1')]},'callerid':{'type':Sequelize['STRING'],'defaultValue':_0xc26e('0x29')},'amaflags':{'type':Sequelize[_0xc26e('0x1')]},'callcounter':{'type':Sequelize[_0xc26e('0x13')](_0xc26e('0x1c'),'no'),'defaultValue':_0xc26e('0x1c')},'busylevel':{'type':Sequelize['INTEGER'](0xb)},'allowoverlap':{'type':Sequelize[_0xc26e('0x13')](_0xc26e('0x1c'),'no')},'allowsubscribe':{'type':Sequelize['ENUM'](_0xc26e('0x1c'),'no')},'allowtransfer':{'type':Sequelize[_0xc26e('0x13')](_0xc26e('0x1c'),'no')},'ignoresdpversion':{'type':Sequelize[_0xc26e('0x13')]('yes','no')},'subscribecontext':{'type':Sequelize[_0xc26e('0x1')]},'template':{'type':Sequelize['STRING']},'videosupport':{'type':Sequelize[_0xc26e('0x13')](_0xc26e('0x1c'),'no',_0xc26e('0x2a')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xc26e('0x2b')](0xb)},'rfc2833compensate':{'type':Sequelize['ENUM']('yes','no')},'mailbox':{'type':Sequelize[_0xc26e('0x1')]},'session_timers':{'type':Sequelize[_0xc26e('0x13')](_0xc26e('0x2c'),_0xc26e('0x2d'),'originate')},'session_expires':{'type':Sequelize[_0xc26e('0x2b')](0xb)},'session_minse':{'type':Sequelize['INTEGER'](0xb)},'session_refresher':{'type':Sequelize[_0xc26e('0x13')]('uac','uas'),'defaultValue':_0xc26e('0x2e')},'t38pt_usertpsource':{'type':Sequelize[_0xc26e('0x1')]},'regexten':{'type':Sequelize[_0xc26e('0x1')]},'fromdomain':{'type':Sequelize[_0xc26e('0x1')]},'fromuser':{'type':Sequelize[_0xc26e('0x1')]},'port':{'type':Sequelize['INTEGER'](0x5)},'qualify':{'type':Sequelize[_0xc26e('0x13')](_0xc26e('0x1c'),'no'),'defaultValue':_0xc26e('0x1c')},'keepalive':{'type':Sequelize[_0xc26e('0x2b')](0xb)},'defaultip':{'type':Sequelize[_0xc26e('0x1')]},'defaultuser':{'type':Sequelize[_0xc26e('0x1')]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpkeepalive':{'type':Sequelize[_0xc26e('0x2b')](0xb)},'sendrpid':{'type':Sequelize[_0xc26e('0x13')](_0xc26e('0x1c'),'no',_0xc26e('0x2f')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING']},'callbackextension':{'type':Sequelize[_0xc26e('0x1')]},'timert1':{'type':Sequelize[_0xc26e('0x2b')](0xb)},'timerb':{'type':Sequelize[_0xc26e('0x2b')](0xb)},'qualifyfreq':{'type':Sequelize[_0xc26e('0x2b')](0xb)},'contactpermit':{'type':Sequelize[_0xc26e('0x1')]},'contactdeny':{'type':Sequelize[_0xc26e('0x1')]},'contactacl':{'type':Sequelize[_0xc26e('0x1')]},'unsolicited_mailbox':{'type':Sequelize['STRING']},'use_q850_reason':{'type':Sequelize[_0xc26e('0x1')]},'maxforwards':{'type':Sequelize[_0xc26e('0x2b')](0xb)},'encryption':{'type':Sequelize[_0xc26e('0x13')](_0xc26e('0x1c'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0xc26e('0x13')]('yes','no')},'force_avp':{'type':Sequelize['ENUM'](_0xc26e('0x1c'),'no')},'icesupport':{'type':Sequelize['ENUM'](_0xc26e('0x1c'),'no')},'dtlsenable':{'type':Sequelize['ENUM'](_0xc26e('0x1c'),'no')},'dtlsverify':{'type':Sequelize[_0xc26e('0x13')](_0xc26e('0x1c'),'no',_0xc26e('0x30'),_0xc26e('0x31'))},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb)},'dtlscertfile':{'type':Sequelize[_0xc26e('0x1')]},'dtlsprivatekey':{'type':Sequelize[_0xc26e('0x1')]},'dtlscipher':{'type':Sequelize[_0xc26e('0x1')]},'dtlscafile':{'type':Sequelize['STRING']},'dtlscapath':{'type':Sequelize[_0xc26e('0x1')]},'dtlssetup':{'type':Sequelize['ENUM'](_0xc26e('0x32'),'passive',_0xc26e('0x33')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xc26e('0x1')]},'usereqphone':{'type':Sequelize[_0xc26e('0x13')](_0xc26e('0x1c'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xc26e('0x1')]},'recordofffeature':{'type':Sequelize['STRING']},'call_limit':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0xc26e('0x13')](_0xc26e('0x1c'),'no')},'subscribemwi':{'type':Sequelize[_0xc26e('0x13')]('yes','no')},'vmexten':{'type':Sequelize[_0xc26e('0x1')]},'mohinterpret':{'type':Sequelize['STRING']},'mohsuggest':{'type':Sequelize[_0xc26e('0x1')]},'parkinglot':{'type':Sequelize[_0xc26e('0x1')]},'description':{'type':Sequelize[_0xc26e('0x1')]},'host':{'type':Sequelize[_0xc26e('0x1')],'defaultValue':_0xc26e('0x34')},'canreinvite':{'type':Sequelize[_0xc26e('0x13')](_0xc26e('0x1c'),'no',_0xc26e('0x19'),_0xc26e('0x1a'),'update,nonat'),'defaultValue':'no'},'registry':{'type':Sequelize[_0xc26e('0x1')]},'otherFields':{'type':Sequelize['STRING']},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0xc26e('0x1')],'defaultValue':'no'}}; \ No newline at end of file diff --git a/server/api/trunk/trunk.controller.js b/server/api/trunk/trunk.controller.js index dbd9a28..a55e5aa 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 _0x98a8=['../../mysqldb','jayson/promise','client','request','Trunk,\x20%s,\x20%s','debug','request\x20sent','error','code','message','info','catch','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','then','destroy','get','Trunks','UserProfileResource','stack','name','map','fieldName','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','Trunk','include','show','params','keys','rawAttributes','includeAll','clone','find','createdAt','updatedAt','body','omit','create','user','role','UserProfileSection','userProfileId','autoAssociation','findAll','readFileSync','root','server/files/templates/trunk.ejs','join','server/files/templates/registry.ejs','utf8','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','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment'];(function(_0x37cd94,_0x8a0703){var _0x4851f7=function(_0x2dcfd2){while(--_0x2dcfd2){_0x37cd94['push'](_0x37cd94['shift']());}};_0x4851f7(++_0x8a0703);}(_0x98a8,0x12c));var _0x898a=function(_0x49a72d,_0x4449c6){_0x49a72d=_0x49a72d-0x0;var _0x45ef0c=_0x98a8[_0x49a72d];return _0x45ef0c;};'use strict';var emlformat=require(_0x898a('0x0'));var rimraf=require(_0x898a('0x1'));var zipdir=require(_0x898a('0x2'));var jsonpatch=require(_0x898a('0x3'));var rp=require(_0x898a('0x4'));var moment=require(_0x898a('0x5'));var BPromise=require(_0x898a('0x6'));var Mustache=require('mustache');var util=require(_0x898a('0x7'));var path=require(_0x898a('0x8'));var sox=require(_0x898a('0x9'));var csv=require(_0x898a('0xa'));var ejs=require(_0x898a('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x898a('0xc'));var squel=require('squel');var crypto=require(_0x898a('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x898a('0xe'));var toCsv=require(_0x898a('0xa'));var querystring=require(_0x898a('0xf'));var Papa=require(_0x898a('0x10'));var Redis=require(_0x898a('0x11'));var authService=require(_0x898a('0x12'));var qs=require(_0x898a('0x13'));var as=require(_0x898a('0x14'));var hardwareService=require(_0x898a('0x15'));var logger=require('../../config/logger')(_0x898a('0x16'));var utils=require('../../config/utils');var config=require(_0x898a('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x898a('0x18'))['db'];var jayson=require(_0x898a('0x19'));var client=jayson[_0x898a('0x1a')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5bfded,_0x5b5c9c,_0x373d53,_0x1f5be4){return new BPromise(function(_0xb24335,_0x116fbe){var _0x1873e9=_0x1f5be4||client;return _0x1873e9[_0x898a('0x1b')](_0x5bfded,_0x373d53)['then'](function(_0x47033c){logger['info'](_0x898a('0x1c'),_0x5b5c9c,'request\x20sent');logger[_0x898a('0x1d')]('Trunk,\x20%s,\x20%s,\x20%s',_0x5b5c9c,_0x898a('0x1e'),JSON['stringify'](_0x47033c));if(_0x47033c[_0x898a('0x1f')]){if(_0x47033c[_0x898a('0x1f')][_0x898a('0x20')]===0x1f4){logger['error'](_0x898a('0x1c'),_0x5b5c9c,_0x47033c['error']['message']);return _0x116fbe(_0x47033c[_0x898a('0x1f')][_0x898a('0x21')]);}logger['error']('Trunk,\x20%s,\x20%s',_0x5b5c9c,_0x47033c[_0x898a('0x1f')][_0x898a('0x21')]);return _0xb24335(_0x47033c[_0x898a('0x1f')][_0x898a('0x21')]);}else{logger[_0x898a('0x22')](_0x898a('0x1c'),_0x5b5c9c,_0x898a('0x1e'));_0xb24335(_0x47033c['result'][_0x898a('0x21')]);}})[_0x898a('0x23')](function(_0x11cae2){logger[_0x898a('0x1f')](_0x898a('0x1c'),_0x5b5c9c,_0x11cae2);_0x116fbe(_0x11cae2);});});}function respondWithStatusCode(_0x310bfa,_0x4e254d){_0x4e254d=_0x4e254d||0xcc;return function(_0x274cdf){if(_0x274cdf){return _0x310bfa[_0x898a('0x24')](_0x4e254d);}return _0x310bfa[_0x898a('0x25')](_0x4e254d)[_0x898a('0x26')]();};}function respondWithResult(_0x3901ab,_0x1426e3){_0x1426e3=_0x1426e3||0xc8;return function(_0x5b7719){if(_0x5b7719){return _0x3901ab[_0x898a('0x25')](_0x1426e3)['json'](_0x5b7719);}};}function respondWithFilteredResult(_0x513c6b,_0x53ddb2){return function(_0x3678be){if(_0x3678be){var _0x1f4d86=typeof _0x53ddb2[_0x898a('0x27')]===_0x898a('0x28')&&typeof _0x53ddb2[_0x898a('0x29')]===_0x898a('0x28');var _0x398e98=_0x3678be[_0x898a('0x2a')];var _0xd31922=_0x1f4d86?0x0:_0x53ddb2['offset'];var _0x4b3e68=_0x1f4d86?_0x3678be['count']:_0x53ddb2[_0x898a('0x27')]+_0x53ddb2[_0x898a('0x29')];var _0x3b7704;if(_0x4b3e68>=_0x398e98){_0x4b3e68=_0x398e98;_0x3b7704=0xc8;}else{_0x3b7704=0xce;}_0x513c6b[_0x898a('0x25')](_0x3b7704);return _0x513c6b[_0x898a('0x2b')](_0x898a('0x2c'),_0xd31922+'-'+_0x4b3e68+'/'+_0x398e98)[_0x898a('0x2d')](_0x3678be);}return null;};}function patchUpdates(_0xf74645){return function(_0x18773a){try{jsonpatch[_0x898a('0x2e')](_0x18773a,_0xf74645,!![]);}catch(_0x44c5d2){return BPromise[_0x898a('0x2f')](_0x44c5d2);}return _0x18773a['save']();};}function saveUpdates(_0x7a1eb5,_0x17a5f3){return function(_0x26eead){if(_0x26eead){return _0x26eead[_0x898a('0x30')](_0x7a1eb5)[_0x898a('0x31')](function(_0x47af5b){return _0x47af5b;});}return null;};}function removeEntity(_0x48cefb,_0x20a3fe){return function(_0x1e2fd4){if(_0x1e2fd4){return _0x1e2fd4[_0x898a('0x32')]()['then'](function(){var _0x105477=_0x1e2fd4[_0x898a('0x33')]({'plain':!![]});var _0x5eafc7=_0x898a('0x34');return db[_0x898a('0x35')][_0x898a('0x32')]({'where':{'type':_0x5eafc7,'resourceId':_0x105477['id']}})[_0x898a('0x31')](function(){return _0x1e2fd4;});})[_0x898a('0x31')](function(){_0x48cefb['status'](0xcc)[_0x898a('0x26')]();});}};}function handleEntityNotFound(_0x5baf5b,_0x573eb3){return function(_0x14e2dc){if(!_0x14e2dc){_0x5baf5b['sendStatus'](0x194);}return _0x14e2dc;};}function handleError(_0x3c9588,_0x4b3aac){_0x4b3aac=_0x4b3aac||0x1f4;return function(_0x37cb11){logger['error'](_0x37cb11[_0x898a('0x36')]);if(_0x37cb11[_0x898a('0x37')]){delete _0x37cb11[_0x898a('0x37')];}_0x3c9588['status'](_0x4b3aac)['send'](_0x37cb11);};}exports['index']=function(_0x1575d2,_0x429c32){var _0x5a228f={},_0xdd019d={},_0x3d3463={'count':0x0,'rows':[]};var _0xe84f7e=_[_0x898a('0x38')](db['Trunk']['rawAttributes'],function(_0x3aed01){return{'name':_0x3aed01[_0x898a('0x39')],'type':_0x3aed01['type']['key']};});_0xdd019d[_0x898a('0x3a')]=_[_0x898a('0x38')](_0xe84f7e,_0x898a('0x37'));_0xdd019d[_0x898a('0x3b')]=_['keys'](_0x1575d2[_0x898a('0x3b')]);_0xdd019d[_0x898a('0x3c')]=_['intersection'](_0xdd019d['model'],_0xdd019d['query']);_0x5a228f[_0x898a('0x3d')]=_[_0x898a('0x3e')](_0xdd019d[_0x898a('0x3a')],qs[_0x898a('0x3f')](_0x1575d2[_0x898a('0x3b')][_0x898a('0x3f')]));_0x5a228f[_0x898a('0x3d')]=_0x5a228f[_0x898a('0x3d')][_0x898a('0x40')]?_0x5a228f[_0x898a('0x3d')]:_0xdd019d[_0x898a('0x3a')];if(!_0x1575d2[_0x898a('0x3b')][_0x898a('0x41')](_0x898a('0x42'))){_0x5a228f[_0x898a('0x29')]=qs['limit'](_0x1575d2[_0x898a('0x3b')][_0x898a('0x29')]);_0x5a228f[_0x898a('0x27')]=qs['offset'](_0x1575d2[_0x898a('0x3b')][_0x898a('0x27')]);}_0x5a228f[_0x898a('0x43')]=qs[_0x898a('0x44')](_0x1575d2[_0x898a('0x3b')][_0x898a('0x44')]);_0x5a228f[_0x898a('0x45')]=qs[_0x898a('0x3c')](_['pick'](_0x1575d2[_0x898a('0x3b')],_0xdd019d[_0x898a('0x3c')]),_0xe84f7e);if(_0x1575d2[_0x898a('0x3b')][_0x898a('0x46')]){_0x5a228f['where']=_[_0x898a('0x47')](_0x5a228f[_0x898a('0x45')],{'$or':_['map'](_0xe84f7e,function(_0x241677){if(_0x241677['type']!==_0x898a('0x48')){var _0x5137c4={};_0x5137c4[_0x241677['name']]={'$like':'%'+_0x1575d2[_0x898a('0x3b')]['filter']+'%'};return _0x5137c4;}})});}_0x5a228f=_[_0x898a('0x47')]({},_0x5a228f,_0x1575d2[_0x898a('0x49')]);var _0x4d6ac0={'where':_0x5a228f[_0x898a('0x45')]};return db[_0x898a('0x4a')]['count'](_0x4d6ac0)[_0x898a('0x31')](function(_0x199437){_0x3d3463[_0x898a('0x2a')]=_0x199437;if(_0x1575d2[_0x898a('0x3b')]['includeAll']){_0x5a228f[_0x898a('0x4b')]=[{'all':!![]}];}return db[_0x898a('0x4a')]['findAll'](_0x5a228f);})[_0x898a('0x31')](function(_0x1d8c16){_0x3d3463['rows']=_0x1d8c16;return _0x3d3463;})[_0x898a('0x31')](respondWithFilteredResult(_0x429c32,_0x5a228f))['catch'](handleError(_0x429c32,null));};exports[_0x898a('0x4c')]=function(_0x41f291,_0x32ccb9){var _0x50f9e3={'raw':![],'where':{'id':_0x41f291[_0x898a('0x4d')]['id']}},_0x2f6cb3={};_0x2f6cb3[_0x898a('0x3a')]=_[_0x898a('0x4e')](db['Trunk'][_0x898a('0x4f')]);_0x2f6cb3['query']=_[_0x898a('0x4e')](_0x41f291[_0x898a('0x3b')]);_0x2f6cb3[_0x898a('0x3c')]=_['intersection'](_0x2f6cb3[_0x898a('0x3a')],_0x2f6cb3[_0x898a('0x3b')]);_0x50f9e3[_0x898a('0x3d')]=_['intersection'](_0x2f6cb3['model'],qs[_0x898a('0x3f')](_0x41f291[_0x898a('0x3b')][_0x898a('0x3f')]));_0x50f9e3[_0x898a('0x3d')]=_0x50f9e3[_0x898a('0x3d')][_0x898a('0x40')]?_0x50f9e3[_0x898a('0x3d')]:_0x2f6cb3[_0x898a('0x3a')];if(_0x41f291[_0x898a('0x3b')][_0x898a('0x50')]){_0x50f9e3[_0x898a('0x4b')]=[{'all':!![]}];}_0x50f9e3=_['merge']({},_0x50f9e3,_0x41f291[_0x898a('0x49')]);return db[_0x898a('0x4a')]['find'](_0x50f9e3)[_0x898a('0x31')](handleEntityNotFound(_0x32ccb9,null))['then'](respondWithResult(_0x32ccb9,null))['catch'](handleError(_0x32ccb9,null));};exports[_0x898a('0x51')]=function(_0x124f9b,_0x209529){var _0x5bfd61={'where':{'id':_0x124f9b[_0x898a('0x4d')]['id']}},_0x556fd8={};_0x556fd8[_0x898a('0x3a')]=_['keys'](db[_0x898a('0x4a')][_0x898a('0x4f')]);_0x5bfd61['attributes']=_[_0x898a('0x3e')](_0x556fd8[_0x898a('0x3a')],qs[_0x898a('0x3f')](_0x124f9b['query'][_0x898a('0x3f')]));_0x5bfd61[_0x898a('0x3d')]=_0x5bfd61[_0x898a('0x3d')][_0x898a('0x40')]?_0x5bfd61[_0x898a('0x3d')]:_0x556fd8[_0x898a('0x3a')];if(_0x124f9b['query'][_0x898a('0x50')]){_0x5bfd61['include']=[{'all':!![]}];}_0x5bfd61=_[_0x898a('0x47')]({},_0x5bfd61,_0x124f9b[_0x898a('0x49')]);return db[_0x898a('0x4a')][_0x898a('0x52')](_0x5bfd61)[_0x898a('0x31')](handleEntityNotFound(_0x209529,null))[_0x898a('0x31')](function(_0x2486a5){if(_0x2486a5){var _0x75ff57=_0x2486a5[_0x898a('0x33')]({'plain':!![]});_0x75ff57=qs['omit'](_0x75ff57,['id',_0x898a('0x53'),_0x898a('0x54')]);_0x124f9b[_0x898a('0x55')]=_[_0x898a('0x56')](_0x124f9b[_0x898a('0x55')],['id',_0x898a('0x53'),_0x898a('0x54')]);return db[_0x898a('0x4a')][_0x898a('0x57')](_[_0x898a('0x47')](_0x75ff57,_0x124f9b[_0x898a('0x55')]),{'include':_0x124f9b[_0x898a('0x3b')][_0x898a('0x50')]?[{'all':!![]}]:undefined})[_0x898a('0x31')](function(_0x22f9ba){var _0x5f42ae=_0x124f9b[_0x898a('0x58')][_0x898a('0x33')]({'plain':!![]});if(!_0x5f42ae)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5f42ae[_0x898a('0x59')]===_0x898a('0x58')){var _0x5f0944=_0x22f9ba[_0x898a('0x33')]({'plain':!![]});var _0x1daecd=_0x898a('0x34');return db[_0x898a('0x5a')]['find']({'where':{'name':_0x1daecd,'userProfileId':_0x5f42ae[_0x898a('0x5b')]},'raw':!![]})[_0x898a('0x31')](function(_0x137935){if(_0x137935&&_0x137935[_0x898a('0x5c')]===0x0){return db['UserProfileResource'][_0x898a('0x57')]({'name':_0x5f0944[_0x898a('0x37')],'resourceId':_0x5f0944['id'],'type':_0x137935['name'],'sectionId':_0x137935['id']},{})[_0x898a('0x31')](function(){return _0x22f9ba;});}else{return _0x22f9ba;}})[_0x898a('0x23')](function(_0x5b7019){logger[_0x898a('0x1f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5b7019);throw _0x5b7019;});}return _0x22f9ba;});}})[_0x898a('0x31')](respondWithResult(_0x209529,0xc9))['catch'](handleError(_0x209529,null));};exports['create']=function(_0x5ed35e,_0xfdd6d8,_0x473f5c){var _0x3909c5;return db[_0x898a('0x4a')]['create'](_0x5ed35e['body'],{'raw':!![]})[_0x898a('0x31')](function(_0x232be0){_0x3909c5=_0x232be0;return db[_0x898a('0x4a')][_0x898a('0x5d')]({'raw':!![]});})[_0x898a('0x31')](function(_0x41cf94){var _0x30051d=fs[_0x898a('0x5e')](path['join'](config[_0x898a('0x5f')],_0x898a('0x60')),'utf8');var _0x42fda8=fs[_0x898a('0x5e')](path[_0x898a('0x61')](config[_0x898a('0x5f')],_0x898a('0x62')),_0x898a('0x63'));var _0x3bcc3d=ejs[_0x898a('0x64')](_0x30051d,{'trunks':_0x41cf94||[]});fs[_0x898a('0x65')](_0x898a('0x66'),_0x3bcc3d);if(_0x3909c5[_0x898a('0x67')]){var _0x307849=ejs[_0x898a('0x64')](_0x42fda8,{'trunks':_0x41cf94||[]});fs['writeFileSync'](_0x898a('0x68'),_0x307849);}})['then'](function(){return respondWithRpcPromise(_0x898a('0x69'),_0x898a('0x57'),{'module':_0x898a('0x6a')});})['then'](function(){var _0x31102d=_0x5ed35e[_0x898a('0x58')][_0x898a('0x33')]({'plain':!![]});if(!_0x31102d)throw new Error(_0x898a('0x6b'));if(_0x31102d[_0x898a('0x59')]==='user'){var _0x4b9487=_0x3909c5[_0x898a('0x33')]({'plain':!![]});return db[_0x898a('0x5a')][_0x898a('0x52')]({'where':{'name':_0x898a('0x34'),'userProfileId':_0x31102d['userProfileId']},'raw':!![]})[_0x898a('0x31')](function(_0x3d3451){if(_0x3d3451&&_0x3d3451[_0x898a('0x5c')]===0x0){return db[_0x898a('0x35')][_0x898a('0x57')]({'name':_0x4b9487[_0x898a('0x37')],'resourceId':_0x4b9487['id'],'type':_0x3d3451[_0x898a('0x37')],'sectionId':_0x3d3451['id']},{})[_0x898a('0x31')](function(){return _0x3909c5;});}else{return _0x3909c5;}})['catch'](function(_0x32a207){logger[_0x898a('0x1f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x32a207);throw _0x32a207;});}return _0x3909c5;})[_0x898a('0x31')](respondWithResult(_0xfdd6d8,0xc9))['catch'](handleError(_0xfdd6d8,null));};exports[_0x898a('0x30')]=function(_0x4b2575,_0x2471d8,_0x387f2c){var _0x3b07dc;return db[_0x898a('0x4a')][_0x898a('0x52')]({'where':{'id':_0x4b2575[_0x898a('0x4d')]['id']}})[_0x898a('0x31')](handleEntityNotFound(_0x2471d8,null))[_0x898a('0x31')](saveUpdates(_0x4b2575[_0x898a('0x55')],null))['then'](function(_0x3fe54b){if(_0x3fe54b){_0x3b07dc=_0x3fe54b;return db[_0x898a('0x4a')][_0x898a('0x5d')]({'raw':!![]});}})[_0x898a('0x31')](function(_0x290972){if(_0x290972){var _0x1d594b=fs[_0x898a('0x5e')](path[_0x898a('0x61')](config[_0x898a('0x5f')],_0x898a('0x60')),'utf8');var _0x4fad03=fs[_0x898a('0x5e')](path[_0x898a('0x61')](config['root'],'server/files/templates/registry.ejs'),_0x898a('0x63'));var _0x4a79a4=ejs[_0x898a('0x64')](_0x1d594b,{'trunks':_0x290972||[]});fs[_0x898a('0x65')]('/etc/asterisk/sip_xcally_trunks.conf',_0x4a79a4);var _0x3f6815=ejs[_0x898a('0x64')](_0x4fad03,{'trunks':_0x290972||[]});fs[_0x898a('0x65')](_0x898a('0x68'),_0x3f6815);return respondWithRpcPromise(_0x898a('0x69'),_0x898a('0x30'),{'module':_0x898a('0x6a')});}return null;})['then'](function(_0x3237e8){if(_0x3237e8){return _0x3b07dc;}})[_0x898a('0x31')](respondWithResult(_0x2471d8,null))[_0x898a('0x23')](handleError(_0x2471d8,null));};exports['destroy']=function(_0x27560f,_0x61247c,_0x5c6247){var _0x39e917;return db['Trunk']['find']({'where':{'id':_0x27560f['params']['id']}})[_0x898a('0x31')](handleEntityNotFound(_0x61247c,null))[_0x898a('0x31')](removeEntity(_0x61247c,null))[_0x898a('0x31')](function(){return db[_0x898a('0x4a')][_0x898a('0x5d')]({'raw':!![]});})[_0x898a('0x31')](function(_0x12e54b){var _0x50dd52=fs[_0x898a('0x5e')](path['join'](config[_0x898a('0x5f')],_0x898a('0x60')),'utf8');var _0x24670c=fs[_0x898a('0x5e')](path[_0x898a('0x61')](config[_0x898a('0x5f')],_0x898a('0x62')),'utf8');var _0x5847cb=ejs['render'](_0x50dd52,{'trunks':_0x12e54b});var _0x3b8fb5=ejs[_0x898a('0x64')](_0x24670c,{'trunks':_0x12e54b});fs[_0x898a('0x65')]('/etc/asterisk/sip_xcally_trunks.conf',_0x5847cb);fs[_0x898a('0x65')]('/etc/asterisk/sip_xcally_registers.conf',_0x3b8fb5);return respondWithRpcPromise('Reload',_0x898a('0x32'),{'module':_0x898a('0x6a')});})[_0x898a('0x23')](handleError(_0x61247c,null));}; \ No newline at end of file +var _0xd6d6=['sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','destroy','get','Trunks','UserProfileResource','stack','send','index','rawAttributes','fieldName','type','model','map','name','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','VIRTUAL','filter','merge','options','Trunk','includeAll','include','findAll','rows','show','params','find','clone','omit','createdAt','updatedAt','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','create','readFileSync','join','root','server/files/templates/trunk.ejs','utf8','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','role','server/files/templates/registry.ejs','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','jayson/promise','client','http','request','then','Trunk,\x20%s,\x20%s','debug','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch'];(function(_0x18b189,_0xf18e0a){var _0x5dd1ca=function(_0x471b88){while(--_0x471b88){_0x18b189['push'](_0x18b189['shift']());}};_0x5dd1ca(++_0xf18e0a);}(_0xd6d6,0xbe));var _0x6d6d=function(_0x2c12a5,_0x3711ad){_0x2c12a5=_0x2c12a5-0x0;var _0x5a6fd9=_0xd6d6[_0x2c12a5];return _0x5a6fd9;};'use strict';var emlformat=require(_0x6d6d('0x0'));var rimraf=require(_0x6d6d('0x1'));var zipdir=require(_0x6d6d('0x2'));var jsonpatch=require(_0x6d6d('0x3'));var rp=require('request-promise');var moment=require(_0x6d6d('0x4'));var BPromise=require(_0x6d6d('0x5'));var Mustache=require(_0x6d6d('0x6'));var util=require(_0x6d6d('0x7'));var path=require(_0x6d6d('0x8'));var sox=require(_0x6d6d('0x9'));var csv=require(_0x6d6d('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6d6d('0xb'));var _=require(_0x6d6d('0xc'));var squel=require(_0x6d6d('0xd'));var crypto=require(_0x6d6d('0xe'));var jsforce=require(_0x6d6d('0xf'));var deskjs=require(_0x6d6d('0x10'));var toCsv=require(_0x6d6d('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x6d6d('0x11'));var authService=require(_0x6d6d('0x12'));var qs=require(_0x6d6d('0x13'));var as=require(_0x6d6d('0x14'));var hardwareService=require(_0x6d6d('0x15'));var logger=require('../../config/logger')(_0x6d6d('0x16'));var utils=require(_0x6d6d('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x6d6d('0x18'))['db'];var jayson=require(_0x6d6d('0x19'));var client=jayson[_0x6d6d('0x1a')][_0x6d6d('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x2b74ed,_0x41fbdf,_0x19cf50,_0x2cb2dd){return new BPromise(function(_0x5f4154,_0xd09ea7){var _0x3dd4b3=_0x2cb2dd||client;return _0x3dd4b3[_0x6d6d('0x1c')](_0x2b74ed,_0x19cf50)[_0x6d6d('0x1d')](function(_0x29cbd8){logger['info'](_0x6d6d('0x1e'),_0x41fbdf,'request\x20sent');logger[_0x6d6d('0x1f')](_0x6d6d('0x20'),_0x41fbdf,_0x6d6d('0x21'),JSON['stringify'](_0x29cbd8));if(_0x29cbd8['error']){if(_0x29cbd8[_0x6d6d('0x22')][_0x6d6d('0x23')]===0x1f4){logger[_0x6d6d('0x22')](_0x6d6d('0x1e'),_0x41fbdf,_0x29cbd8['error']['message']);return _0xd09ea7(_0x29cbd8[_0x6d6d('0x22')]['message']);}logger[_0x6d6d('0x22')](_0x6d6d('0x1e'),_0x41fbdf,_0x29cbd8[_0x6d6d('0x22')][_0x6d6d('0x24')]);return _0x5f4154(_0x29cbd8[_0x6d6d('0x22')][_0x6d6d('0x24')]);}else{logger[_0x6d6d('0x25')](_0x6d6d('0x1e'),_0x41fbdf,_0x6d6d('0x21'));_0x5f4154(_0x29cbd8[_0x6d6d('0x26')][_0x6d6d('0x24')]);}})[_0x6d6d('0x27')](function(_0x466a29){logger[_0x6d6d('0x22')](_0x6d6d('0x1e'),_0x41fbdf,_0x466a29);_0xd09ea7(_0x466a29);});});}function respondWithStatusCode(_0x25a02e,_0xced622){_0xced622=_0xced622||0xcc;return function(_0x583b10){if(_0x583b10){return _0x25a02e[_0x6d6d('0x28')](_0xced622);}return _0x25a02e[_0x6d6d('0x29')](_0xced622)[_0x6d6d('0x2a')]();};}function respondWithResult(_0x97ec9e,_0xf0df7f){_0xf0df7f=_0xf0df7f||0xc8;return function(_0x12fab2){if(_0x12fab2){return _0x97ec9e['status'](_0xf0df7f)[_0x6d6d('0x2b')](_0x12fab2);}};}function respondWithFilteredResult(_0x2b5e31,_0x235451){return function(_0x126ac8){if(_0x126ac8){var _0x25c121=typeof _0x235451[_0x6d6d('0x2c')]===_0x6d6d('0x2d')&&typeof _0x235451['limit']===_0x6d6d('0x2d');var _0x9595d8=_0x126ac8['count'];var _0x553645=_0x25c121?0x0:_0x235451[_0x6d6d('0x2c')];var _0x5273cd=_0x25c121?_0x126ac8[_0x6d6d('0x2e')]:_0x235451['offset']+_0x235451[_0x6d6d('0x2f')];var _0x20255e;if(_0x5273cd>=_0x9595d8){_0x5273cd=_0x9595d8;_0x20255e=0xc8;}else{_0x20255e=0xce;}_0x2b5e31[_0x6d6d('0x29')](_0x20255e);return _0x2b5e31[_0x6d6d('0x30')](_0x6d6d('0x31'),_0x553645+'-'+_0x5273cd+'/'+_0x9595d8)[_0x6d6d('0x2b')](_0x126ac8);}return null;};}function patchUpdates(_0xdda3f2){return function(_0x359cfd){try{jsonpatch[_0x6d6d('0x32')](_0x359cfd,_0xdda3f2,!![]);}catch(_0x34050a){return BPromise['reject'](_0x34050a);}return _0x359cfd[_0x6d6d('0x33')]();};}function saveUpdates(_0x4f1fc5,_0x18015a){return function(_0x1ea9b2){if(_0x1ea9b2){return _0x1ea9b2[_0x6d6d('0x34')](_0x4f1fc5)[_0x6d6d('0x1d')](function(_0x5c6248){return _0x5c6248;});}return null;};}function removeEntity(_0x182441,_0x4f2f13){return function(_0x3cc702){if(_0x3cc702){return _0x3cc702[_0x6d6d('0x35')]()['then'](function(){var _0x37993f=_0x3cc702[_0x6d6d('0x36')]({'plain':!![]});var _0x37ac94=_0x6d6d('0x37');return db[_0x6d6d('0x38')][_0x6d6d('0x35')]({'where':{'type':_0x37ac94,'resourceId':_0x37993f['id']}})[_0x6d6d('0x1d')](function(){return _0x3cc702;});})[_0x6d6d('0x1d')](function(){_0x182441[_0x6d6d('0x29')](0xcc)[_0x6d6d('0x2a')]();});}};}function handleEntityNotFound(_0x2fcf88,_0x3693da){return function(_0x17d863){if(!_0x17d863){_0x2fcf88[_0x6d6d('0x28')](0x194);}return _0x17d863;};}function handleError(_0x5a2397,_0x1335ef){_0x1335ef=_0x1335ef||0x1f4;return function(_0xf98bfa){logger[_0x6d6d('0x22')](_0xf98bfa[_0x6d6d('0x39')]);if(_0xf98bfa['name']){delete _0xf98bfa['name'];}_0x5a2397[_0x6d6d('0x29')](_0x1335ef)[_0x6d6d('0x3a')](_0xf98bfa);};}exports[_0x6d6d('0x3b')]=function(_0x4d42ff,_0x2a3f67){var _0x2607c1={},_0x23c173={},_0x125d79={'count':0x0,'rows':[]};var _0x52556b=_['map'](db['Trunk'][_0x6d6d('0x3c')],function(_0x4196f0){return{'name':_0x4196f0[_0x6d6d('0x3d')],'type':_0x4196f0[_0x6d6d('0x3e')]['key']};});_0x23c173[_0x6d6d('0x3f')]=_[_0x6d6d('0x40')](_0x52556b,_0x6d6d('0x41'));_0x23c173[_0x6d6d('0x42')]=_[_0x6d6d('0x43')](_0x4d42ff[_0x6d6d('0x42')]);_0x23c173['filters']=_[_0x6d6d('0x44')](_0x23c173[_0x6d6d('0x3f')],_0x23c173[_0x6d6d('0x42')]);_0x2607c1[_0x6d6d('0x45')]=_[_0x6d6d('0x44')](_0x23c173[_0x6d6d('0x3f')],qs[_0x6d6d('0x46')](_0x4d42ff['query'][_0x6d6d('0x46')]));_0x2607c1[_0x6d6d('0x45')]=_0x2607c1[_0x6d6d('0x45')][_0x6d6d('0x47')]?_0x2607c1[_0x6d6d('0x45')]:_0x23c173['model'];if(!_0x4d42ff[_0x6d6d('0x42')][_0x6d6d('0x48')]('nolimit')){_0x2607c1[_0x6d6d('0x2f')]=qs['limit'](_0x4d42ff[_0x6d6d('0x42')][_0x6d6d('0x2f')]);_0x2607c1['offset']=qs[_0x6d6d('0x2c')](_0x4d42ff[_0x6d6d('0x42')][_0x6d6d('0x2c')]);}_0x2607c1[_0x6d6d('0x49')]=qs[_0x6d6d('0x4a')](_0x4d42ff['query']['sort']);_0x2607c1[_0x6d6d('0x4b')]=qs['filters'](_['pick'](_0x4d42ff[_0x6d6d('0x42')],_0x23c173[_0x6d6d('0x4c')]),_0x52556b);if(_0x4d42ff[_0x6d6d('0x42')]['filter']){_0x2607c1[_0x6d6d('0x4b')]=_['merge'](_0x2607c1[_0x6d6d('0x4b')],{'$or':_[_0x6d6d('0x40')](_0x52556b,function(_0x1d3826){if(_0x1d3826[_0x6d6d('0x3e')]!==_0x6d6d('0x4d')){var _0x2669f0={};_0x2669f0[_0x1d3826[_0x6d6d('0x41')]]={'$like':'%'+_0x4d42ff['query'][_0x6d6d('0x4e')]+'%'};return _0x2669f0;}})});}_0x2607c1=_[_0x6d6d('0x4f')]({},_0x2607c1,_0x4d42ff[_0x6d6d('0x50')]);var _0x389e51={'where':_0x2607c1[_0x6d6d('0x4b')]};return db[_0x6d6d('0x51')][_0x6d6d('0x2e')](_0x389e51)[_0x6d6d('0x1d')](function(_0x24cec2){_0x125d79['count']=_0x24cec2;if(_0x4d42ff['query'][_0x6d6d('0x52')]){_0x2607c1[_0x6d6d('0x53')]=[{'all':!![]}];}return db[_0x6d6d('0x51')][_0x6d6d('0x54')](_0x2607c1);})[_0x6d6d('0x1d')](function(_0x492834){_0x125d79[_0x6d6d('0x55')]=_0x492834;return _0x125d79;})[_0x6d6d('0x1d')](respondWithFilteredResult(_0x2a3f67,_0x2607c1))[_0x6d6d('0x27')](handleError(_0x2a3f67,null));};exports[_0x6d6d('0x56')]=function(_0x2ee917,_0x23c2db){var _0x1f7a09={'raw':![],'where':{'id':_0x2ee917[_0x6d6d('0x57')]['id']}},_0x39ec2a={};_0x39ec2a[_0x6d6d('0x3f')]=_[_0x6d6d('0x43')](db[_0x6d6d('0x51')]['rawAttributes']);_0x39ec2a[_0x6d6d('0x42')]=_[_0x6d6d('0x43')](_0x2ee917[_0x6d6d('0x42')]);_0x39ec2a[_0x6d6d('0x4c')]=_[_0x6d6d('0x44')](_0x39ec2a['model'],_0x39ec2a[_0x6d6d('0x42')]);_0x1f7a09[_0x6d6d('0x45')]=_[_0x6d6d('0x44')](_0x39ec2a['model'],qs['fields'](_0x2ee917[_0x6d6d('0x42')]['fields']));_0x1f7a09[_0x6d6d('0x45')]=_0x1f7a09[_0x6d6d('0x45')][_0x6d6d('0x47')]?_0x1f7a09[_0x6d6d('0x45')]:_0x39ec2a[_0x6d6d('0x3f')];if(_0x2ee917[_0x6d6d('0x42')][_0x6d6d('0x52')]){_0x1f7a09[_0x6d6d('0x53')]=[{'all':!![]}];}_0x1f7a09=_[_0x6d6d('0x4f')]({},_0x1f7a09,_0x2ee917[_0x6d6d('0x50')]);return db['Trunk'][_0x6d6d('0x58')](_0x1f7a09)[_0x6d6d('0x1d')](handleEntityNotFound(_0x23c2db,null))[_0x6d6d('0x1d')](respondWithResult(_0x23c2db,null))[_0x6d6d('0x27')](handleError(_0x23c2db,null));};exports[_0x6d6d('0x59')]=function(_0x45f44a,_0x243be3){var _0x5e5ace={'where':{'id':_0x45f44a[_0x6d6d('0x57')]['id']}},_0x5a1cdc={};_0x5a1cdc[_0x6d6d('0x3f')]=_['keys'](db[_0x6d6d('0x51')][_0x6d6d('0x3c')]);_0x5e5ace[_0x6d6d('0x45')]=_[_0x6d6d('0x44')](_0x5a1cdc[_0x6d6d('0x3f')],qs[_0x6d6d('0x46')](_0x45f44a[_0x6d6d('0x42')][_0x6d6d('0x46')]));_0x5e5ace[_0x6d6d('0x45')]=_0x5e5ace[_0x6d6d('0x45')][_0x6d6d('0x47')]?_0x5e5ace[_0x6d6d('0x45')]:_0x5a1cdc[_0x6d6d('0x3f')];if(_0x45f44a[_0x6d6d('0x42')][_0x6d6d('0x52')]){_0x5e5ace['include']=[{'all':!![]}];}_0x5e5ace=_[_0x6d6d('0x4f')]({},_0x5e5ace,_0x45f44a[_0x6d6d('0x50')]);return db['Trunk'][_0x6d6d('0x58')](_0x5e5ace)[_0x6d6d('0x1d')](handleEntityNotFound(_0x243be3,null))[_0x6d6d('0x1d')](function(_0x407357){if(_0x407357){var _0x2d61cc=_0x407357[_0x6d6d('0x36')]({'plain':!![]});_0x2d61cc=qs[_0x6d6d('0x5a')](_0x2d61cc,['id',_0x6d6d('0x5b'),_0x6d6d('0x5c')]);_0x45f44a['body']=_['omit'](_0x45f44a[_0x6d6d('0x5d')],['id',_0x6d6d('0x5b'),_0x6d6d('0x5c')]);return db['Trunk']['create'](_[_0x6d6d('0x4f')](_0x2d61cc,_0x45f44a['body']),{'include':_0x45f44a[_0x6d6d('0x42')]['includeAll']?[{'all':!![]}]:undefined})[_0x6d6d('0x1d')](function(_0x367a6f){var _0x21f14c=_0x45f44a[_0x6d6d('0x5e')][_0x6d6d('0x36')]({'plain':!![]});if(!_0x21f14c)throw new Error(_0x6d6d('0x5f'));if(_0x21f14c['role']===_0x6d6d('0x5e')){var _0x5eb78f=_0x367a6f[_0x6d6d('0x36')]({'plain':!![]});var _0x52d9e7=_0x6d6d('0x37');return db[_0x6d6d('0x60')][_0x6d6d('0x58')]({'where':{'name':_0x52d9e7,'userProfileId':_0x21f14c[_0x6d6d('0x61')]},'raw':!![]})[_0x6d6d('0x1d')](function(_0x163bb7){if(_0x163bb7&&_0x163bb7[_0x6d6d('0x62')]===0x0){return db['UserProfileResource']['create']({'name':_0x5eb78f[_0x6d6d('0x41')],'resourceId':_0x5eb78f['id'],'type':_0x163bb7['name'],'sectionId':_0x163bb7['id']},{})[_0x6d6d('0x1d')](function(){return _0x367a6f;});}else{return _0x367a6f;}})['catch'](function(_0xe19d23){logger[_0x6d6d('0x22')](_0x6d6d('0x63'),_0xe19d23);throw _0xe19d23;});}return _0x367a6f;});}})[_0x6d6d('0x1d')](respondWithResult(_0x243be3,0xc9))[_0x6d6d('0x27')](handleError(_0x243be3,null));};exports[_0x6d6d('0x64')]=function(_0x5dd3b0,_0x3cedc0,_0xbca58e){var _0x3a6d79;return db[_0x6d6d('0x51')][_0x6d6d('0x64')](_0x5dd3b0[_0x6d6d('0x5d')],{'raw':!![]})[_0x6d6d('0x1d')](function(_0x589d64){_0x3a6d79=_0x589d64;return db[_0x6d6d('0x51')][_0x6d6d('0x54')]({'raw':!![]});})[_0x6d6d('0x1d')](function(_0x3bf8a7){var _0x1aa25d=fs[_0x6d6d('0x65')](path[_0x6d6d('0x66')](config[_0x6d6d('0x67')],_0x6d6d('0x68')),_0x6d6d('0x69'));var _0x1efc55=fs['readFileSync'](path['join'](config[_0x6d6d('0x67')],'server/files/templates/registry.ejs'),'utf8');var _0x5b6ca7=ejs[_0x6d6d('0x6a')](_0x1aa25d,{'trunks':_0x3bf8a7||[]});fs[_0x6d6d('0x6b')](_0x6d6d('0x6c'),_0x5b6ca7);if(_0x3a6d79[_0x6d6d('0x6d')]){var _0x2d4a04=ejs[_0x6d6d('0x6a')](_0x1efc55,{'trunks':_0x3bf8a7||[]});fs['writeFileSync']('/etc/asterisk/sip_xcally_registers.conf',_0x2d4a04);}})[_0x6d6d('0x1d')](function(){return respondWithRpcPromise('Reload','create',{'module':'chan_sip.so'});})[_0x6d6d('0x1d')](function(){var _0x5cd494=_0x5dd3b0[_0x6d6d('0x5e')]['get']({'plain':!![]});if(!_0x5cd494)throw new Error(_0x6d6d('0x5f'));if(_0x5cd494[_0x6d6d('0x6e')]==='user'){var _0x52dca9=_0x3a6d79[_0x6d6d('0x36')]({'plain':!![]});return db[_0x6d6d('0x60')][_0x6d6d('0x58')]({'where':{'name':_0x6d6d('0x37'),'userProfileId':_0x5cd494['userProfileId']},'raw':!![]})[_0x6d6d('0x1d')](function(_0x264d24){if(_0x264d24&&_0x264d24[_0x6d6d('0x62')]===0x0){return db[_0x6d6d('0x38')]['create']({'name':_0x52dca9[_0x6d6d('0x41')],'resourceId':_0x52dca9['id'],'type':_0x264d24['name'],'sectionId':_0x264d24['id']},{})['then'](function(){return _0x3a6d79;});}else{return _0x3a6d79;}})['catch'](function(_0x3da125){logger['error'](_0x6d6d('0x63'),_0x3da125);throw _0x3da125;});}return _0x3a6d79;})[_0x6d6d('0x1d')](respondWithResult(_0x3cedc0,0xc9))[_0x6d6d('0x27')](handleError(_0x3cedc0,null));};exports['update']=function(_0x5146a4,_0x55d877,_0xcba8dd){var _0x542386;return db['Trunk'][_0x6d6d('0x58')]({'where':{'id':_0x5146a4[_0x6d6d('0x57')]['id']}})[_0x6d6d('0x1d')](handleEntityNotFound(_0x55d877,null))[_0x6d6d('0x1d')](saveUpdates(_0x5146a4[_0x6d6d('0x5d')],null))[_0x6d6d('0x1d')](function(_0x3f9aad){if(_0x3f9aad){_0x542386=_0x3f9aad;return db['Trunk']['findAll']({'raw':!![]});}})['then'](function(_0x5c20c5){if(_0x5c20c5){var _0x54bdef=fs['readFileSync'](path[_0x6d6d('0x66')](config[_0x6d6d('0x67')],_0x6d6d('0x68')),_0x6d6d('0x69'));var _0x59998e=fs['readFileSync'](path['join'](config[_0x6d6d('0x67')],_0x6d6d('0x6f')),_0x6d6d('0x69'));var _0x1c8d15=ejs['render'](_0x54bdef,{'trunks':_0x5c20c5||[]});fs['writeFileSync'](_0x6d6d('0x6c'),_0x1c8d15);var _0x1e1c4e=ejs['render'](_0x59998e,{'trunks':_0x5c20c5||[]});fs[_0x6d6d('0x6b')](_0x6d6d('0x70'),_0x1e1c4e);return respondWithRpcPromise(_0x6d6d('0x71'),_0x6d6d('0x34'),{'module':_0x6d6d('0x72')});}return null;})['then'](function(_0xf5586f){if(_0xf5586f){return _0x542386;}})['then'](respondWithResult(_0x55d877,null))[_0x6d6d('0x27')](handleError(_0x55d877,null));};exports['destroy']=function(_0x108108,_0x54a5a9,_0x445196){var _0x1bfce6;return db[_0x6d6d('0x51')][_0x6d6d('0x58')]({'where':{'id':_0x108108[_0x6d6d('0x57')]['id']}})[_0x6d6d('0x1d')](handleEntityNotFound(_0x54a5a9,null))[_0x6d6d('0x1d')](removeEntity(_0x54a5a9,null))[_0x6d6d('0x1d')](function(){return db[_0x6d6d('0x51')][_0x6d6d('0x54')]({'raw':!![]});})[_0x6d6d('0x1d')](function(_0xb2940d){var _0x7c1934=fs[_0x6d6d('0x65')](path[_0x6d6d('0x66')](config[_0x6d6d('0x67')],'server/files/templates/trunk.ejs'),'utf8');var _0x139b61=fs['readFileSync'](path[_0x6d6d('0x66')](config[_0x6d6d('0x67')],'server/files/templates/registry.ejs'),'utf8');var _0x1d2668=ejs['render'](_0x7c1934,{'trunks':_0xb2940d});var _0x2ab52f=ejs[_0x6d6d('0x6a')](_0x139b61,{'trunks':_0xb2940d});fs[_0x6d6d('0x6b')](_0x6d6d('0x6c'),_0x1d2668);fs[_0x6d6d('0x6b')](_0x6d6d('0x70'),_0x2ab52f);return respondWithRpcPromise(_0x6d6d('0x71'),_0x6d6d('0x35'),{'module':'chan_sip.so'});})[_0x6d6d('0x27')](handleError(_0x54a5a9,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index 11e9766..e0f8bc0 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 _0x20bf=['./trunk.attributes','exports','define','Trunk','lodash','../../config/logger','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x22d202,_0xfcd670){var _0x3cb212=function(_0xafd594){while(--_0xafd594){_0x22d202['push'](_0x22d202['shift']());}};_0x3cb212(++_0xfcd670);}(_0x20bf,0x16f));var _0xf20b=function(_0x43d293,_0x349bea){_0x43d293=_0x43d293-0x0;var _0x397aa2=_0x20bf[_0x43d293];return _0x397aa2;};'use strict';var _=require(_0xf20b('0x0'));var util=require('util');var logger=require(_0xf20b('0x1'))('api');var moment=require(_0xf20b('0x2'));var BPromise=require('bluebird');var rp=require(_0xf20b('0x3'));var fs=require('fs');var path=require(_0xf20b('0x4'));var rimraf=require(_0xf20b('0x5'));var config=require(_0xf20b('0x6'));var attributes=require(_0xf20b('0x7'));module[_0xf20b('0x8')]=function(_0x38f357,_0x31af84){return _0x38f357[_0xf20b('0x9')](_0xf20b('0xa'),attributes,{'tableName':'tools_trunks','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1ba1=['../../config/environment','exports','define','Trunk','tools_trunks','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x57474e,_0x4178b8){var _0xfaae8c=function(_0x2e34d1){while(--_0x2e34d1){_0x57474e['push'](_0x57474e['shift']());}};_0xfaae8c(++_0x4178b8);}(_0x1ba1,0xae));var _0x11ba=function(_0x218672,_0x332245){_0x218672=_0x218672-0x0;var _0xe380f7=_0x1ba1[_0x218672];return _0xe380f7;};'use strict';var _=require(_0x11ba('0x0'));var util=require(_0x11ba('0x1'));var logger=require(_0x11ba('0x2'))(_0x11ba('0x3'));var moment=require(_0x11ba('0x4'));var BPromise=require(_0x11ba('0x5'));var rp=require(_0x11ba('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x11ba('0x7'));var config=require(_0x11ba('0x8'));var attributes=require('./trunk.attributes');module[_0x11ba('0x9')]=function(_0x3e26ba,_0x1cebac){return _0x3e26ba[_0x11ba('0xa')](_0x11ba('0xb'),attributes,{'tableName':_0x11ba('0xc'),'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 af9d4ca..346cafc 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 _0x4027=['model','catch','ShowTrunk','Trunk','find','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','Trunk,\x20%s,\x20%s','message','result','GetTrunk','options','raw','attributes','limit','include','map'];(function(_0x503ffd,_0x8ecde){var _0x160437=function(_0x2d45dd){while(--_0x2d45dd){_0x503ffd['push'](_0x503ffd['shift']());}};_0x160437(++_0x8ecde);}(_0x4027,0x1a9));var _0x7402=function(_0x10a608,_0x3877fa){_0x10a608=_0x10a608-0x0;var _0x495161=_0x4027[_0x10a608];return _0x495161;};'use strict';var _=require(_0x7402('0x0'));var util=require('util');var moment=require(_0x7402('0x1'));var BPromise=require(_0x7402('0x2'));var rs=require(_0x7402('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7402('0x4'))['db'];var utils=require(_0x7402('0x5'));var logger=require(_0x7402('0x6'))(_0x7402('0x7'));var config=require('../../config/environment');var jayson=require(_0x7402('0x8'));var client=jayson[_0x7402('0x9')][_0x7402('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1919c7,_0x1f2a34,_0x35abfb){return new BPromise(function(_0x1c5624,_0x33bd11){return client[_0x7402('0xb')](_0x1919c7,_0x35abfb)[_0x7402('0xc')](function(_0x2038bb){logger[_0x7402('0xd')]('Trunk,\x20%s,\x20%s',_0x1f2a34,_0x7402('0xe'));logger[_0x7402('0xf')](_0x7402('0x10'),_0x1f2a34,'request\x20sent',JSON[_0x7402('0x11')](_0x2038bb));if(_0x2038bb[_0x7402('0x12')]){if(_0x2038bb['error'][_0x7402('0x13')]===0x1f4){logger['error'](_0x7402('0x14'),_0x1f2a34,_0x2038bb[_0x7402('0x12')][_0x7402('0x15')]);return _0x33bd11(_0x2038bb[_0x7402('0x12')][_0x7402('0x15')]);}logger[_0x7402('0x12')](_0x7402('0x14'),_0x1f2a34,_0x2038bb[_0x7402('0x12')]['message']);return _0x1c5624(_0x2038bb[_0x7402('0x12')][_0x7402('0x15')]);}else{logger[_0x7402('0xd')](_0x7402('0x14'),_0x1f2a34,_0x7402('0xe'));_0x1c5624(_0x2038bb[_0x7402('0x16')][_0x7402('0x15')]);}})['catch'](function(_0x253aeb){logger[_0x7402('0x12')]('Trunk,\x20%s,\x20%s',_0x1f2a34,_0x253aeb);_0x33bd11(_0x253aeb);});});}exports[_0x7402('0x17')]=function(_0x575db7){var _0x186b3e=this;return new Promise(function(_0x4d172a,_0x262ddb){return db['Trunk']['findAll']({'raw':_0x575db7[_0x7402('0x18')]?_0x575db7[_0x7402('0x18')][_0x7402('0x19')]===undefined?!![]:![]:!![],'where':_0x575db7[_0x7402('0x18')]?_0x575db7[_0x7402('0x18')]['where']||null:null,'attributes':_0x575db7[_0x7402('0x18')]?_0x575db7[_0x7402('0x18')][_0x7402('0x1a')]||null:null,'limit':_0x575db7[_0x7402('0x18')]?_0x575db7['options'][_0x7402('0x1b')]||null:null,'include':_0x575db7[_0x7402('0x18')]?_0x575db7[_0x7402('0x18')][_0x7402('0x1c')]?_[_0x7402('0x1d')](_0x575db7[_0x7402('0x18')][_0x7402('0x1c')],function(_0x5761dd){return{'model':db[_0x5761dd['model']],'as':_0x5761dd['as'],'attributes':_0x5761dd['attributes'],'include':_0x5761dd['include']?_[_0x7402('0x1d')](_0x5761dd[_0x7402('0x1c')],function(_0x34de67){return{'model':db[_0x34de67['model']],'as':_0x34de67['as'],'attributes':_0x34de67[_0x7402('0x1a')],'include':_0x34de67['include']?_[_0x7402('0x1d')](_0x34de67[_0x7402('0x1c')],function(_0x35b933){return{'model':db[_0x35b933[_0x7402('0x1e')]],'as':_0x35b933['as'],'attributes':_0x35b933[_0x7402('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x463db4){logger['info'](_0x7402('0x17'),_0x575db7);logger[_0x7402('0xf')](_0x7402('0x17'),_0x575db7,JSON[_0x7402('0x11')](_0x463db4));_0x4d172a(_0x463db4);})[_0x7402('0x1f')](function(_0x5242fe){logger[_0x7402('0x12')](_0x7402('0x17'),_0x5242fe['message'],_0x575db7);_0x262ddb(_0x186b3e[_0x7402('0x12')](0x1f4,_0x5242fe['message']));});});};exports[_0x7402('0x20')]=function(_0x318818){var _0x26f459=this;return new Promise(function(_0x21d933,_0x4c08b1){return db[_0x7402('0x21')][_0x7402('0x22')]({'raw':_0x318818['options']?_0x318818['options'][_0x7402('0x19')]===undefined?!![]:![]:!![],'where':_0x318818[_0x7402('0x18')]?_0x318818[_0x7402('0x18')]['where']||null:null,'attributes':_0x318818[_0x7402('0x18')]?_0x318818[_0x7402('0x18')][_0x7402('0x1a')]||null:null,'include':_0x318818['options']?_0x318818[_0x7402('0x18')]['include']?_[_0x7402('0x1d')](_0x318818[_0x7402('0x18')][_0x7402('0x1c')],function(_0x259b16){return{'model':db[_0x259b16[_0x7402('0x1e')]],'as':_0x259b16['as'],'attributes':_0x259b16['attributes'],'include':_0x259b16['include']?_[_0x7402('0x1d')](_0x259b16[_0x7402('0x1c')],function(_0x1e7c5e){return{'model':db[_0x1e7c5e['model']],'as':_0x1e7c5e['as'],'attributes':_0x1e7c5e['attributes'],'include':_0x1e7c5e[_0x7402('0x1c')]?_[_0x7402('0x1d')](_0x1e7c5e[_0x7402('0x1c')],function(_0x1a75d2){return{'model':db[_0x1a75d2[_0x7402('0x1e')]],'as':_0x1a75d2['as'],'attributes':_0x1a75d2[_0x7402('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x7402('0xc')](function(_0xec4482){logger[_0x7402('0xd')](_0x7402('0x20'),_0x318818);logger[_0x7402('0xf')](_0x7402('0x20'),_0x318818,JSON[_0x7402('0x11')](_0xec4482));_0x21d933(_0xec4482);})[_0x7402('0x1f')](function(_0x2f67ab){logger[_0x7402('0x12')](_0x7402('0x20'),_0x2f67ab['message'],_0x318818);_0x4c08b1(_0x26f459[_0x7402('0x12')](0x1f4,_0x2f67ab[_0x7402('0x15')]));});});}; \ No newline at end of file +var _0xb958=['Trunk,\x20%s,\x20%s','debug','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','catch','GetTrunk','findAll','options','attributes','limit','include','map','model','then','ShowTrunk','Trunk','find','raw','where','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info'];(function(_0x4d35f3,_0x19ba66){var _0x382fea=function(_0x2c2390){while(--_0x2c2390){_0x4d35f3['push'](_0x4d35f3['shift']());}};_0x382fea(++_0x19ba66);}(_0xb958,0xab));var _0x8b95=function(_0x20cb20,_0x256051){_0x20cb20=_0x20cb20-0x0;var _0x2fcf4b=_0xb958[_0x20cb20];return _0x2fcf4b;};'use strict';var _=require(_0x8b95('0x0'));var util=require(_0x8b95('0x1'));var moment=require(_0x8b95('0x2'));var BPromise=require(_0x8b95('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8b95('0x4'));var db=require(_0x8b95('0x5'))['db'];var utils=require(_0x8b95('0x6'));var logger=require(_0x8b95('0x7'))(_0x8b95('0x8'));var config=require(_0x8b95('0x9'));var jayson=require(_0x8b95('0xa'));var client=jayson[_0x8b95('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x114ad8,_0x2a5c31,_0xf07149){return new BPromise(function(_0x137154,_0x23ffa2){return client[_0x8b95('0xc')](_0x114ad8,_0xf07149)['then'](function(_0x3b7e2e){logger[_0x8b95('0xd')](_0x8b95('0xe'),_0x2a5c31,'request\x20sent');logger[_0x8b95('0xf')](_0x8b95('0x10'),_0x2a5c31,_0x8b95('0x11'),JSON[_0x8b95('0x12')](_0x3b7e2e));if(_0x3b7e2e['error']){if(_0x3b7e2e['error'][_0x8b95('0x13')]===0x1f4){logger['error']('Trunk,\x20%s,\x20%s',_0x2a5c31,_0x3b7e2e[_0x8b95('0x14')][_0x8b95('0x15')]);return _0x23ffa2(_0x3b7e2e[_0x8b95('0x14')][_0x8b95('0x15')]);}logger[_0x8b95('0x14')]('Trunk,\x20%s,\x20%s',_0x2a5c31,_0x3b7e2e['error'][_0x8b95('0x15')]);return _0x137154(_0x3b7e2e[_0x8b95('0x14')][_0x8b95('0x15')]);}else{logger[_0x8b95('0xd')]('Trunk,\x20%s,\x20%s',_0x2a5c31,_0x8b95('0x11'));_0x137154(_0x3b7e2e['result']['message']);}})[_0x8b95('0x16')](function(_0x327158){logger['error'](_0x8b95('0xe'),_0x2a5c31,_0x327158);_0x23ffa2(_0x327158);});});}exports[_0x8b95('0x17')]=function(_0x259b66){var _0x41a419=this;return new Promise(function(_0x1dae39,_0x48bb41){return db['Trunk'][_0x8b95('0x18')]({'raw':_0x259b66[_0x8b95('0x19')]?_0x259b66[_0x8b95('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x259b66['options']?_0x259b66[_0x8b95('0x19')]['where']||null:null,'attributes':_0x259b66['options']?_0x259b66[_0x8b95('0x19')][_0x8b95('0x1a')]||null:null,'limit':_0x259b66[_0x8b95('0x19')]?_0x259b66[_0x8b95('0x19')][_0x8b95('0x1b')]||null:null,'include':_0x259b66[_0x8b95('0x19')]?_0x259b66['options'][_0x8b95('0x1c')]?_[_0x8b95('0x1d')](_0x259b66['options'][_0x8b95('0x1c')],function(_0x13e3ff){return{'model':db[_0x13e3ff['model']],'as':_0x13e3ff['as'],'attributes':_0x13e3ff[_0x8b95('0x1a')],'include':_0x13e3ff['include']?_[_0x8b95('0x1d')](_0x13e3ff[_0x8b95('0x1c')],function(_0x55ce83){return{'model':db[_0x55ce83['model']],'as':_0x55ce83['as'],'attributes':_0x55ce83[_0x8b95('0x1a')],'include':_0x55ce83[_0x8b95('0x1c')]?_['map'](_0x55ce83[_0x8b95('0x1c')],function(_0x499d0f){return{'model':db[_0x499d0f[_0x8b95('0x1e')]],'as':_0x499d0f['as'],'attributes':_0x499d0f[_0x8b95('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x8b95('0x1f')](function(_0x1e53fc){logger[_0x8b95('0xd')](_0x8b95('0x17'),_0x259b66);logger[_0x8b95('0xf')](_0x8b95('0x17'),_0x259b66,JSON[_0x8b95('0x12')](_0x1e53fc));_0x1dae39(_0x1e53fc);})[_0x8b95('0x16')](function(_0x5cdf88){logger['error'](_0x8b95('0x17'),_0x5cdf88[_0x8b95('0x15')],_0x259b66);_0x48bb41(_0x41a419[_0x8b95('0x14')](0x1f4,_0x5cdf88[_0x8b95('0x15')]));});});};exports[_0x8b95('0x20')]=function(_0x1f57a3){var _0x45bfd0=this;return new Promise(function(_0x116326,_0x5ef921){return db[_0x8b95('0x21')][_0x8b95('0x22')]({'raw':_0x1f57a3[_0x8b95('0x19')]?_0x1f57a3[_0x8b95('0x19')][_0x8b95('0x23')]===undefined?!![]:![]:!![],'where':_0x1f57a3[_0x8b95('0x19')]?_0x1f57a3[_0x8b95('0x19')][_0x8b95('0x24')]||null:null,'attributes':_0x1f57a3[_0x8b95('0x19')]?_0x1f57a3['options']['attributes']||null:null,'include':_0x1f57a3['options']?_0x1f57a3[_0x8b95('0x19')]['include']?_[_0x8b95('0x1d')](_0x1f57a3[_0x8b95('0x19')][_0x8b95('0x1c')],function(_0xc88ffc){return{'model':db[_0xc88ffc[_0x8b95('0x1e')]],'as':_0xc88ffc['as'],'attributes':_0xc88ffc[_0x8b95('0x1a')],'include':_0xc88ffc['include']?_[_0x8b95('0x1d')](_0xc88ffc['include'],function(_0x13b5a7){return{'model':db[_0x13b5a7['model']],'as':_0x13b5a7['as'],'attributes':_0x13b5a7['attributes'],'include':_0x13b5a7[_0x8b95('0x1c')]?_[_0x8b95('0x1d')](_0x13b5a7[_0x8b95('0x1c')],function(_0x6b37e4){return{'model':db[_0x6b37e4[_0x8b95('0x1e')]],'as':_0x6b37e4['as'],'attributes':_0x6b37e4['attributes']};}):[]};}):[]};}):[]:[]})[_0x8b95('0x1f')](function(_0x334193){logger['info']('ShowTrunk',_0x1f57a3);logger['debug'](_0x8b95('0x20'),_0x1f57a3,JSON['stringify'](_0x334193));_0x116326(_0x334193);})[_0x8b95('0x16')](function(_0x339f0a){logger[_0x8b95('0x14')](_0x8b95('0x20'),_0x339f0a['message'],_0x1f57a3);_0x5ef921(_0x45bfd0[_0x8b95('0x14')](0x1f4,_0x339f0a[_0x8b95('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/user-setting/index.js b/server/api/user-setting/index.js index e61a973..bdf84a3 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 _0xf4d0=['express','./user-setting.controller','put','isAuthenticated','update','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf4d0,0xd2));var _0x0f4d=function(_0x44d2ce,_0x2970aa){_0x44d2ce=_0x44d2ce-0x0;var _0x3465cf=_0xf4d0[_0x44d2ce];return _0x3465cf;};'use strict';var express=require(_0x0f4d('0x0'));var router=express['Router']();var auth=require('../../components/auth/service');var controller=require(_0x0f4d('0x1'));router[_0x0f4d('0x2')]('/:id',auth[_0x0f4d('0x3')](),controller[_0x0f4d('0x4')]);module[_0x0f4d('0x5')]=router; \ No newline at end of file +var _0xe90d=['Router','../../components/auth/service','./user-setting.controller','/:id','update','express'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe90d,0x149));var _0xde90=function(_0x2f798b,_0x21f18d){_0x2f798b=_0x2f798b-0x0;var _0x5d21c8=_0xe90d[_0x2f798b];return _0x5d21c8;};'use strict';var express=require(_0xde90('0x0'));var router=express[_0xde90('0x1')]();var auth=require(_0xde90('0x2'));var controller=require(_0xde90('0x3'));router['put'](_0xde90('0x4'),auth['isAuthenticated'](),controller[_0xde90('0x5')]);module['exports']=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 f51788d..0307b40 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 _0x6be3=['TEXT','DATE','INTEGER','UserId','sequelize','error','warning','info','debug','ENUM','BOOLEAN'];(function(_0x3592c6,_0x4ab3b9){var _0x29396b=function(_0x16653d){while(--_0x16653d){_0x3592c6['push'](_0x3592c6['shift']());}};_0x29396b(++_0x4ab3b9);}(_0x6be3,0x19b));var _0x36be=function(_0x138676,_0x27a8d5){_0x138676=_0x138676-0x0;var _0xf72f74=_0x6be3[_0x138676];return _0xf72f74;};'use strict';var Sequelize=require(_0x36be('0x0'));const CLIENT_SIDE_LOG_LEVELS=[_0x36be('0x1'),_0x36be('0x2'),_0x36be('0x3'),_0x36be('0x4')];module['exports']={'clientSideLoggingLevel':{'type':Sequelize[_0x36be('0x5')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0x36be('0x1'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0x36be('0x6')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0x36be('0x7')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0x36be('0x8')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0x36be('0x9')],'unique':_0x36be('0xa')}}; \ No newline at end of file +var _0xe12f=['INTEGER','UserId','sequelize','error','warning','info','debug','exports','ENUM','BOOLEAN','TEXT','DATE'];(function(_0x47e7cb,_0x4c1b8d){var _0x2a8874=function(_0x36498f){while(--_0x36498f){_0x47e7cb['push'](_0x47e7cb['shift']());}};_0x2a8874(++_0x4c1b8d);}(_0xe12f,0x1be));var _0xfe12=function(_0x441668,_0x2ae87b){_0x441668=_0x441668-0x0;var _0x3cbf26=_0xe12f[_0x441668];return _0x3cbf26;};'use strict';var Sequelize=require(_0xfe12('0x0'));const CLIENT_SIDE_LOG_LEVELS=[_0xfe12('0x1'),_0xfe12('0x2'),_0xfe12('0x3'),_0xfe12('0x4')];module[_0xfe12('0x5')]={'clientSideLoggingLevel':{'type':Sequelize[_0xfe12('0x6')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0xfe12('0x1'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0xfe12('0x7')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0xfe12('0x8')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0xfe12('0x9')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0xfe12('0xa')],'unique':_0xfe12('0xb')}}; \ 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 e41fc29..4042e04 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 _0x7aaf=['user','admin','Unauthorized','params','Invalid\x20user\x20setting\x20id','then','body','catch','lodash','../../config/logger','api','socket.io-emitter','./user-setting.socket','redis','defaults','localhost','json','error','stack','name','status','send','update'];(function(_0x56740a,_0x568894){var _0x257144=function(_0x2b8cc5){while(--_0x2b8cc5){_0x56740a['push'](_0x56740a['shift']());}};_0x257144(++_0x568894);}(_0x7aaf,0x1eb));var _0xf7aa=function(_0x1685b9,_0x3595d5){_0x1685b9=_0x1685b9-0x0;var _0x252ef9=_0x7aaf[_0x1685b9];return _0x252ef9;};'use strict';var _=require(_0xf7aa('0x0'));var Redis=require('ioredis');var logger=require(_0xf7aa('0x1'))(_0xf7aa('0x2'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var socket=require(_0xf7aa('0x3'))(new Redis(config['redis']));require(_0xf7aa('0x4'))['register'](socket);config[_0xf7aa('0x5')]=_[_0xf7aa('0x6')](config[_0xf7aa('0x5')],{'host':_0xf7aa('0x7'),'port':0x18eb});function respondWithResult(_0x47f259,_0x46d632){_0x46d632=_0x46d632||0xc8;return function(_0x5d0495){if(_0x5d0495){return _0x47f259['status'](_0x46d632)[_0xf7aa('0x8')](_0x5d0495);}};}function saveUpdates(_0x6c0332){return function(_0x4d6b4b){if(_0x4d6b4b){return _0x4d6b4b['update'](_0x6c0332)['then'](function(_0x3ee03f){return _0x3ee03f;});}return null;};}function handleEntityNotFound(_0x129eed){return function(_0x115a50){if(!_0x115a50){_0x129eed['sendStatus'](0x194);}return _0x115a50;};}function handleError(_0x1122a3,_0x5a7b21){_0x5a7b21=_0x5a7b21||0x1f4;return function(_0x51573c){logger[_0xf7aa('0x9')](_0x51573c[_0xf7aa('0xa')]);if(_0x51573c[_0xf7aa('0xb')]){delete _0x51573c[_0xf7aa('0xb')];}_0x1122a3[_0xf7aa('0xc')](_0x5a7b21)[_0xf7aa('0xd')](_0x51573c);};}exports[_0xf7aa('0xe')]=function(_0x1aa2d4,_0x23e749){if(_0x1aa2d4[_0xf7aa('0xf')]['role']!==_0xf7aa('0x10'))throw new Error(_0xf7aa('0x11'));if(isNaN(Number(_0x1aa2d4[_0xf7aa('0x12')]['id'])))throw new Error(_0xf7aa('0x13'));return db['UserSetting']['find']({'where':{'id':_0x1aa2d4[_0xf7aa('0x12')]['id']}})['then'](handleEntityNotFound(_0x23e749,null))[_0xf7aa('0x14')](saveUpdates(_0x1aa2d4[_0xf7aa('0x15')],null))[_0xf7aa('0x14')](respondWithResult(_0x23e749,null))[_0xf7aa('0x16')](handleError(_0x23e749,null));}; \ No newline at end of file +var _0x1de4=['../../config/logger','api','../../mysqldb','socket.io-emitter','redis','register','localhost','json','update','then','sendStatus','error','name','status','user','role','admin','Unauthorized','params','Invalid\x20user\x20setting\x20id','UserSetting','find','catch','lodash','ioredis'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x1de4,0x94));var _0x41de=function(_0x31d03c,_0x158cef){_0x31d03c=_0x31d03c-0x0;var _0x420e61=_0x1de4[_0x31d03c];return _0x420e61;};'use strict';var _=require(_0x41de('0x0'));var Redis=require(_0x41de('0x1'));var logger=require(_0x41de('0x2'))(_0x41de('0x3'));var config=require('../../config/environment');var db=require(_0x41de('0x4'))['db'];var socket=require(_0x41de('0x5'))(new Redis(config[_0x41de('0x6')]));require('./user-setting.socket')[_0x41de('0x7')](socket);config[_0x41de('0x6')]=_['defaults'](config[_0x41de('0x6')],{'host':_0x41de('0x8'),'port':0x18eb});function respondWithResult(_0x2f1078,_0x352d9b){_0x352d9b=_0x352d9b||0xc8;return function(_0x50f716){if(_0x50f716){return _0x2f1078['status'](_0x352d9b)[_0x41de('0x9')](_0x50f716);}};}function saveUpdates(_0x301fa7){return function(_0x440015){if(_0x440015){return _0x440015[_0x41de('0xa')](_0x301fa7)[_0x41de('0xb')](function(_0xac4f6c){return _0xac4f6c;});}return null;};}function handleEntityNotFound(_0x5c2eb6){return function(_0x3a923d){if(!_0x3a923d){_0x5c2eb6[_0x41de('0xc')](0x194);}return _0x3a923d;};}function handleError(_0x1de0ed,_0x46bd4c){_0x46bd4c=_0x46bd4c||0x1f4;return function(_0x41e515){logger[_0x41de('0xd')](_0x41e515['stack']);if(_0x41e515[_0x41de('0xe')]){delete _0x41e515[_0x41de('0xe')];}_0x1de0ed[_0x41de('0xf')](_0x46bd4c)['send'](_0x41e515);};}exports[_0x41de('0xa')]=function(_0x33fb46,_0x4e71fa){if(_0x33fb46[_0x41de('0x10')][_0x41de('0x11')]!==_0x41de('0x12'))throw new Error(_0x41de('0x13'));if(isNaN(Number(_0x33fb46[_0x41de('0x14')]['id'])))throw new Error(_0x41de('0x15'));return db[_0x41de('0x16')][_0x41de('0x17')]({'where':{'id':_0x33fb46[_0x41de('0x14')]['id']}})[_0x41de('0xb')](handleEntityNotFound(_0x4e71fa,null))[_0x41de('0xb')](saveUpdates(_0x33fb46['body'],null))[_0x41de('0xb')](respondWithResult(_0x4e71fa,null))[_0x41de('0x18')](handleError(_0x4e71fa,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 e3b62b7..1ac850a 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 _0x3aae=['update','emit','hasOwnProperty','../../mysqldb','UserSetting'];(function(_0x93f997,_0x32199a){var _0xcd266f=function(_0x47a70b){while(--_0x47a70b){_0x93f997['push'](_0x93f997['shift']());}};_0xcd266f(++_0x32199a);}(_0x3aae,0xa3));var _0xe3aa=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x3aae[_0x4565bf];return _0x5610ba;};'use strict';var EventEmitter=require('events');var UserSetting=require(_0xe3aa('0x0'))['db'][_0xe3aa('0x1')];var UserSettingEvents=new EventEmitter();UserSettingEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xe3aa('0x2'),'afterDestroy':'remove'};function emitEvent(_0x271887){return function(_0x192b5b,_0x1f8fdb,_0x48c392){UserSettingEvents['emit'](_0x271887+':'+_0x192b5b['id'],_0x192b5b);UserSettingEvents[_0xe3aa('0x3')](_0x271887,_0x192b5b);_0x48c392(null);};}for(var e in events){if(events[_0xe3aa('0x4')](e)){var event=events[e];UserSetting['hook'](e,emitEvent(event));}}module['exports']=UserSettingEvents; \ No newline at end of file +var _0x14f4=['emit','hasOwnProperty','exports','UserSetting','setMaxListeners','update','remove'];(function(_0x5c2e5e,_0x2bc00e){var _0x46a5da=function(_0xf0fa38){while(--_0xf0fa38){_0x5c2e5e['push'](_0x5c2e5e['shift']());}};_0x46a5da(++_0x2bc00e);}(_0x14f4,0x137));var _0x414f=function(_0x3d66e1,_0x3d15db){_0x3d66e1=_0x3d66e1-0x0;var _0x406ac8=_0x14f4[_0x3d66e1];return _0x406ac8;};'use strict';var EventEmitter=require('events');var UserSetting=require('../../mysqldb')['db'][_0x414f('0x0')];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0x414f('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x414f('0x2'),'afterDestroy':_0x414f('0x3')};function emitEvent(_0x232dd5){return function(_0x489b80,_0x4089dd,_0x109491){UserSettingEvents[_0x414f('0x4')](_0x232dd5+':'+_0x489b80['id'],_0x489b80);UserSettingEvents[_0x414f('0x4')](_0x232dd5,_0x489b80);_0x109491(null);};}for(var e in events){if(events[_0x414f('0x5')](e)){var event=events[e];UserSetting['hook'](e,emitEvent(event));}}module[_0x414f('0x6')]=UserSettingEvents; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.model.js b/server/api/user-setting/user-setting.model.js index 6f21c0c..ecec6d7 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 _0x3f8c=['UserSetting','user_settings','define'];(function(_0x565c49,_0x54acd0){var _0x20ca34=function(_0x42f7e1){while(--_0x42f7e1){_0x565c49['push'](_0x565c49['shift']());}};_0x20ca34(++_0x54acd0);}(_0x3f8c,0x104));var _0xc3f8=function(_0x1413dc,_0x4b8b6e){_0x1413dc=_0x1413dc-0x0;var _0x43145f=_0x3f8c[_0x1413dc];return _0x43145f;};'use strict';var attributes=require('./user-setting.attributes');module['exports']=function(_0x2797b2){return _0x2797b2[_0xc3f8('0x0')](_0xc3f8('0x1'),attributes,{'tableName':_0xc3f8('0x2'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4de1c7){if(!_0x4de1c7['clientSideLoggingEnabled'])_0x4de1c7['clientSideLoggingEnabledSince']=null;else if(_0x4de1c7['clientSideLoggingEnabledSince']===null)_0x4de1c7['clientSideLoggingEnabledSince']=new Date();}}});}; \ No newline at end of file +var _0xd2bf=['clientSideLoggingEnabled','clientSideLoggingEnabledSince','./user-setting.attributes','UserSetting','user_settings'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd2bf,0x1dd));var _0xfd2b=function(_0x81dcac,_0x8ff7db){_0x81dcac=_0x81dcac-0x0;var _0xc7803b=_0xd2bf[_0x81dcac];return _0xc7803b;};'use strict';var attributes=require(_0xfd2b('0x0'));module['exports']=function(_0x4fba3c){return _0x4fba3c['define'](_0xfd2b('0x1'),attributes,{'tableName':_0xfd2b('0x2'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x52ee70){if(!_0x52ee70[_0xfd2b('0x3')])_0x52ee70['clientSideLoggingEnabledSince']=null;else if(_0x52ee70[_0xfd2b('0x4')]===null)_0x52ee70[_0xfd2b('0x4')]=new Date();}}});}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.socket.js b/server/api/user-setting/user-setting.socket.js index b905953..63199b6 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 _0x0276=['save','remove','emit','user-setting:update','UserId','register','user-setting:','./user-setting.events'];(function(_0x40ac5e,_0x2de228){var _0x2839d6=function(_0x123d47){while(--_0x123d47){_0x40ac5e['push'](_0x40ac5e['shift']());}};_0x2839d6(++_0x2de228);}(_0x0276,0x157));var _0x6027=function(_0x3b18e6,_0x35e310){_0x3b18e6=_0x3b18e6-0x0;var _0xaf05b7=_0x0276[_0x3b18e6];return _0xaf05b7;};'use strict';var UserSettingEvents=require(_0x6027('0x0'));var events=[_0x6027('0x1'),_0x6027('0x2'),'update'];function createListener(_0x3f9234,_0x20407d){return function(_0x112e62){_0x20407d[_0x6027('0x3')](_0x3f9234,_0x112e62);if(_0x3f9234===_0x6027('0x4')){_0x20407d['emit']('user-setting:update:user-'+_0x112e62[_0x6027('0x5')],_0x112e62);}};}exports[_0x6027('0x6')]=function(_0x22fe79){for(var _0x56b6b8=0x0,_0x457bdd=events['length'];_0x56b6b8<_0x457bdd;_0x56b6b8++){var _0x45355c=events[_0x56b6b8];var _0x5e2590=createListener(_0x6027('0x7')+_0x45355c,_0x22fe79);UserSettingEvents['on'](_0x45355c,_0x5e2590);}}; \ No newline at end of file +var _0x2a78=['save','update','user-setting:update','emit','user-setting:update:user-','register','user-setting:','./user-setting.events'];(function(_0x49fcfc,_0x104175){var _0x4ab162=function(_0x2fb28b){while(--_0x2fb28b){_0x49fcfc['push'](_0x49fcfc['shift']());}};_0x4ab162(++_0x104175);}(_0x2a78,0x1e7));var _0x82a7=function(_0x49a367,_0x44cf19){_0x49a367=_0x49a367-0x0;var _0xd0fd86=_0x2a78[_0x49a367];return _0xd0fd86;};'use strict';var UserSettingEvents=require(_0x82a7('0x0'));var events=[_0x82a7('0x1'),'remove',_0x82a7('0x2')];function createListener(_0x44a464,_0x4af362){return function(_0x27d8f5){_0x4af362['emit'](_0x44a464,_0x27d8f5);if(_0x44a464===_0x82a7('0x3')){_0x4af362[_0x82a7('0x4')](_0x82a7('0x5')+_0x27d8f5['UserId'],_0x27d8f5);}};}exports[_0x82a7('0x6')]=function(_0x2647b8){for(var _0x43a5e1=0x0,_0x43fbed=events['length'];_0x43a5e1<_0x43fbed;_0x43a5e1++){var _0x56f5b3=events[_0x43a5e1];var _0x470bfe=createListener(_0x82a7('0x7')+_0x56f5b3,_0x2647b8);UserSettingEvents['on'](_0x56f5b3,_0x470bfe);}}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index 244ab75..d5c9295 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 _0x1883=['addFaxInteractions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','addWhatsappInteractions','addFaxAccounts','addMailAccounts','/:id/chat_websites','addChatWebsites','addWhatsappAccounts','put','/:id','update','/:id/password','changePassword','removeQueues','delete','removeTeams','removeChatInteractions','/:id/mail_interactions','removeMailInteractions','removeFaxInteractions','/:id/sms_interactions','removeOpenchannelInteractions','/:id/whatsapp_interactions','removeWhatsappInteractions','removeFaxAccounts','/:id/openchannel_accounts','removeChatWebsites','removeWhatsappAccounts','/:id/api_key','/:id/messengerSoundNotification','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','describe','whoami','getPresence','show','getAvatar','/:id/open_tabs','getOpenTabs','/:id/contacts','getContacts','/:id/queues','getQueues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','getGroups','/:id/recordings','getRecordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','/:id/mail/interactions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','getWhatsappInteractions','/:id/teams','getTeams','getLists','/:id/agents','getAgents','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/scheduled_calls','getScheduledCalls','getApiKey','post','addContacts','create','/create_many','bulkCreate','diskStorage','root','format','%s-%s','now','originalname','/:id/avatar','file','addAvatar','/:id/login','login','logout','/:id/pause','pause','/:id/unpause','unpause','addTeams','/:id/chat_interactions','addChatInteractions','addMailInteractions','/:id/fax_interactions'];(function(_0x5c9db0,_0x49d43c){var _0x146e2e=function(_0x2d1425){while(--_0x2d1425){_0x5c9db0['push'](_0x5c9db0['shift']());}};_0x146e2e(++_0x49d43c);}(_0x1883,0x1e8));var _0x3188=function(_0x3314b0,_0x40f13a){_0x3314b0=_0x3314b0-0x0;var _0x5d7c54=_0x1883[_0x3314b0];return _0x5d7c54;};'use strict';var multer=require(_0x3188('0x0'));var util=require(_0x3188('0x1'));var path=require(_0x3188('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x3188('0x3')]();var fs_extra=require(_0x3188('0x4'));var auth=require(_0x3188('0x5'));var interaction=require(_0x3188('0x6'));var config=require('../../config/environment');var controller=require('./user.controller');router[_0x3188('0x7')]('/',auth[_0x3188('0x8')](),controller[_0x3188('0x9')]);router['get']('/describe',auth[_0x3188('0x8')](),controller[_0x3188('0xa')]);router[_0x3188('0x7')]('/whoami',auth[_0x3188('0x8')](),controller[_0x3188('0xb')]);router[_0x3188('0x7')]('/presence',auth[_0x3188('0x8')](),controller[_0x3188('0xc')]);router[_0x3188('0x7')]('/:id',auth[_0x3188('0x8')](),controller[_0x3188('0xd')]);router['get']('/:id/avatar',controller[_0x3188('0xe')]);router[_0x3188('0x7')](_0x3188('0xf'),auth[_0x3188('0x8')](),controller[_0x3188('0x10')]);router[_0x3188('0x7')](_0x3188('0x11'),auth[_0x3188('0x8')](),controller[_0x3188('0x12')]);router['get'](_0x3188('0x13'),auth['isAuthenticated'](),controller[_0x3188('0x14')]);router[_0x3188('0x7')](_0x3188('0x15'),auth[_0x3188('0x8')](),controller[_0x3188('0x16')]);router[_0x3188('0x7')](_0x3188('0x17'),auth['isAuthenticated'](),controller[_0x3188('0x18')]);router[_0x3188('0x7')](_0x3188('0x19'),auth[_0x3188('0x8')](),controller[_0x3188('0x1a')]);router['get'](_0x3188('0x1b'),auth[_0x3188('0x8')](),controller[_0x3188('0x1c')]);router[_0x3188('0x7')](_0x3188('0x1d'),auth[_0x3188('0x8')](),controller[_0x3188('0x1e')]);router[_0x3188('0x7')](_0x3188('0x1f'),auth[_0x3188('0x8')](),controller['getOpenchannelInteractions']);router[_0x3188('0x7')](_0x3188('0x20'),auth[_0x3188('0x8')](),controller['getMailInteractions']);router['get'](_0x3188('0x21'),auth[_0x3188('0x8')](),controller[_0x3188('0x22')]);router[_0x3188('0x7')](_0x3188('0x23'),auth[_0x3188('0x8')](),controller[_0x3188('0x24')]);router[_0x3188('0x7')]('/:id/whatsapp/interactions',auth[_0x3188('0x8')](),controller[_0x3188('0x25')]);router['get'](_0x3188('0x26'),auth[_0x3188('0x8')](),controller[_0x3188('0x27')]);router[_0x3188('0x7')]('/:id/lists',auth[_0x3188('0x8')](),controller[_0x3188('0x28')]);router['get'](_0x3188('0x29'),auth[_0x3188('0x8')](),controller[_0x3188('0x2a')]);router[_0x3188('0x7')]('/:id/prefixes',auth['isAuthenticated'](),controller[_0x3188('0x2b')]);router[_0x3188('0x7')](_0x3188('0x2c'),auth['isAuthenticated'](),controller[_0x3188('0x2d')]);router['get'](_0x3188('0x2e'),auth[_0x3188('0x8')](),controller['getMailAccounts']);router['get']('/:id/openchannel_accounts',auth['isAuthenticated'](),controller[_0x3188('0x2f')]);router[_0x3188('0x7')](_0x3188('0x30'),auth[_0x3188('0x8')](),controller[_0x3188('0x31')]);router[_0x3188('0x7')]('/:id/chat_websites',auth[_0x3188('0x8')](),controller[_0x3188('0x32')]);router[_0x3188('0x7')](_0x3188('0x33'),auth[_0x3188('0x8')](),controller[_0x3188('0x34')]);router[_0x3188('0x7')](_0x3188('0x35'),auth['isAuthenticated'](),controller[_0x3188('0x36')]);router[_0x3188('0x7')]('/:id/api_key',auth[_0x3188('0x8')](),controller[_0x3188('0x37')]);router[_0x3188('0x38')](_0x3188('0x11'),auth[_0x3188('0x8')](),controller[_0x3188('0x39')]);router[_0x3188('0x38')]('/',auth[_0x3188('0x8')](),controller[_0x3188('0x3a')]);router[_0x3188('0x38')](_0x3188('0x3b'),auth['isAuthenticated'](),controller[_0x3188('0x3c')]);router[_0x3188('0x38')]('/:id/queues',auth[_0x3188('0x8')](),controller['addQueues']);var upload=multer({'storage':multer[_0x3188('0x3d')]({'destination':function(_0x18f7f4,_0x4f926e,_0xe7708d){_0xe7708d(null,path['join'](config[_0x3188('0x3e')],'server/files/images/'));},'filename':function(_0x10885d,_0x5037b7,_0x2ed467){_0x2ed467(null,util[_0x3188('0x3f')](_0x3188('0x40'),Date[_0x3188('0x41')](),_0x5037b7[_0x3188('0x42')]));}})});router[_0x3188('0x38')](_0x3188('0x43'),upload['single'](_0x3188('0x44')),controller[_0x3188('0x45')]);router[_0x3188('0x38')](_0x3188('0x46'),auth[_0x3188('0x8')](),controller[_0x3188('0x47')]);router['post']('/:id/logout',auth[_0x3188('0x8')](),controller[_0x3188('0x48')]);router[_0x3188('0x38')](_0x3188('0x49'),auth['isAuthenticated'](),controller[_0x3188('0x4a')]);router[_0x3188('0x38')](_0x3188('0x4b'),auth['isAuthenticated'](),controller[_0x3188('0x4c')]);router[_0x3188('0x38')](_0x3188('0x26'),auth['isAuthenticated'](),controller[_0x3188('0x4d')]);router['post'](_0x3188('0x4e'),auth[_0x3188('0x8')](),controller[_0x3188('0x4f')]);router[_0x3188('0x38')]('/:id/mail_interactions',auth[_0x3188('0x8')](),controller[_0x3188('0x50')]);router[_0x3188('0x38')](_0x3188('0x51'),auth['isAuthenticated'](),controller[_0x3188('0x52')]);router[_0x3188('0x38')]('/:id/sms_interactions',auth['isAuthenticated'](),controller[_0x3188('0x53')]);router[_0x3188('0x38')](_0x3188('0x54'),auth[_0x3188('0x8')](),controller[_0x3188('0x55')]);router['post']('/:id/whatsapp_interactions',auth[_0x3188('0x8')](),controller[_0x3188('0x56')]);router[_0x3188('0x38')]('/:id/fax_accounts',auth[_0x3188('0x8')](),controller[_0x3188('0x57')]);router[_0x3188('0x38')]('/:id/mail_accounts',auth[_0x3188('0x8')](),controller[_0x3188('0x58')]);router[_0x3188('0x38')]('/:id/openchannel_accounts',auth[_0x3188('0x8')](),controller['addOpenchannelAccounts']);router[_0x3188('0x38')](_0x3188('0x30'),auth[_0x3188('0x8')](),controller['addSmsAccounts']);router[_0x3188('0x38')](_0x3188('0x59'),auth[_0x3188('0x8')](),controller[_0x3188('0x5a')]);router[_0x3188('0x38')](_0x3188('0x33'),auth[_0x3188('0x8')](),controller[_0x3188('0x5b')]);router[_0x3188('0x38')]('/:id/api_key',auth[_0x3188('0x8')](),controller['createApiKey']);router[_0x3188('0x5c')](_0x3188('0x5d'),auth[_0x3188('0x8')](),controller[_0x3188('0x5e')]);router[_0x3188('0x5c')](_0x3188('0x5f'),auth[_0x3188('0x8')](),controller[_0x3188('0x60')]);router['delete']('/:id/queues',auth[_0x3188('0x8')](),controller[_0x3188('0x61')]);router[_0x3188('0x62')](_0x3188('0x26'),auth[_0x3188('0x8')](),controller[_0x3188('0x63')]);router[_0x3188('0x62')](_0x3188('0x5d'),auth['isAuthenticated'](),controller['destroy']);router[_0x3188('0x62')](_0x3188('0x4e'),auth['isAuthenticated'](),controller[_0x3188('0x64')]);router[_0x3188('0x62')](_0x3188('0x65'),auth[_0x3188('0x8')](),controller[_0x3188('0x66')]);router['delete'](_0x3188('0x51'),auth['isAuthenticated'](),controller[_0x3188('0x67')]);router[_0x3188('0x62')](_0x3188('0x68'),auth[_0x3188('0x8')](),controller['removeSmsInteractions']);router['delete'](_0x3188('0x54'),auth['isAuthenticated'](),controller[_0x3188('0x69')]);router[_0x3188('0x62')](_0x3188('0x6a'),auth[_0x3188('0x8')](),controller[_0x3188('0x6b')]);router[_0x3188('0x62')](_0x3188('0x2c'),auth[_0x3188('0x8')](),controller[_0x3188('0x6c')]);router[_0x3188('0x62')](_0x3188('0x2e'),auth[_0x3188('0x8')](),controller['removeMailAccounts']);router[_0x3188('0x62')](_0x3188('0x6d'),auth[_0x3188('0x8')](),controller['removeOpenchannelAccounts']);router[_0x3188('0x62')]('/:id/sms_accounts',auth['isAuthenticated'](),controller['removeSmsAccounts']);router[_0x3188('0x62')]('/:id/chat_websites',auth['isAuthenticated'](),controller[_0x3188('0x6e')]);router['delete'](_0x3188('0x33'),auth[_0x3188('0x8')](),controller[_0x3188('0x6f')]);router[_0x3188('0x62')](_0x3188('0x70'),auth[_0x3188('0x8')](),controller['removeApiKey']);router[_0x3188('0x38')](_0x3188('0x71'),auth[_0x3188('0x8')](),controller['messengerSoundNotification']);module['exports']=router; \ No newline at end of file +var _0x2292=['addMailAccounts','addOpenchannelAccounts','addSmsAccounts','addChatWebsites','/:id/whatsapp_accounts','addWhatsappAccounts','createApiKey','update','put','/:id/password','changePassword','delete','removeQueues','destroy','removeChatInteractions','removeMailInteractions','removeFaxInteractions','removeSmsInteractions','/:id/openchannel_interactions','removeOpenchannelInteractions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeChatWebsites','removeWhatsappAccounts','/:id/api_key','/:id/messengerSoundNotification','messengerSoundNotification','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./user.controller','get','isAuthenticated','/describe','describe','/whoami','whoami','/presence','/:id','show','getAvatar','/:id/open_tabs','getOpenTabs','/:id/contacts','/:id/queues','getGroups','/:id/recordings','getRecordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','getTeams','/:id/lists','/:id/agents','getAgents','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','/:id/scheduled_calls','getScheduledCalls','getApiKey','addContacts','create','post','bulkCreate','diskStorage','join','root','server/files/images/','format','%s-%s','/:id/avatar','single','file','addAvatar','login','/:id/logout','pause','/:id/unpause','unpause','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','/:id/sms_interactions','addSmsInteractions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','addFaxAccounts','/:id/mail_accounts'];(function(_0x8c7792,_0x5e141f){var _0x3ce664=function(_0xe79242){while(--_0xe79242){_0x8c7792['push'](_0x8c7792['shift']());}};_0x3ce664(++_0x5e141f);}(_0x2292,0x91));var _0x2229=function(_0x2f1908,_0x5d837d){_0x2f1908=_0x2f1908-0x0;var _0x357795=_0x2292[_0x2f1908];return _0x357795;};'use strict';var multer=require(_0x2229('0x0'));var util=require('util');var path=require(_0x2229('0x1'));var timeout=require(_0x2229('0x2'));var express=require(_0x2229('0x3'));var router=express[_0x2229('0x4')]();var fs_extra=require(_0x2229('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x2229('0x6'));var config=require(_0x2229('0x7'));var controller=require(_0x2229('0x8'));router[_0x2229('0x9')]('/',auth[_0x2229('0xa')](),controller['index']);router['get'](_0x2229('0xb'),auth['isAuthenticated'](),controller[_0x2229('0xc')]);router[_0x2229('0x9')](_0x2229('0xd'),auth[_0x2229('0xa')](),controller[_0x2229('0xe')]);router[_0x2229('0x9')](_0x2229('0xf'),auth[_0x2229('0xa')](),controller['getPresence']);router[_0x2229('0x9')](_0x2229('0x10'),auth[_0x2229('0xa')](),controller[_0x2229('0x11')]);router['get']('/:id/avatar',controller[_0x2229('0x12')]);router[_0x2229('0x9')](_0x2229('0x13'),auth['isAuthenticated'](),controller[_0x2229('0x14')]);router[_0x2229('0x9')](_0x2229('0x15'),auth['isAuthenticated'](),controller['getContacts']);router['get'](_0x2229('0x16'),auth[_0x2229('0xa')](),controller['getQueues']);router['get']('/:id/queues_rt',auth[_0x2229('0xa')](),controller['getVoiceQueuesRt']);router[_0x2229('0x9')]('/:id/groups',auth[_0x2229('0xa')](),controller[_0x2229('0x17')]);router[_0x2229('0x9')](_0x2229('0x18'),auth['isAuthenticated'](),controller[_0x2229('0x19')]);router[_0x2229('0x9')](_0x2229('0x1a'),auth[_0x2229('0xa')](),controller[_0x2229('0x1b')]);router[_0x2229('0x9')](_0x2229('0x1c'),auth['isAuthenticated'](),controller[_0x2229('0x1d')]);router[_0x2229('0x9')](_0x2229('0x1e'),auth['isAuthenticated'](),controller[_0x2229('0x1f')]);router[_0x2229('0x9')](_0x2229('0x20'),auth[_0x2229('0xa')](),controller['getMailInteractions']);router[_0x2229('0x9')]('/:id/sms/interactions',auth[_0x2229('0xa')](),controller[_0x2229('0x21')]);router[_0x2229('0x9')](_0x2229('0x22'),auth[_0x2229('0xa')](),controller[_0x2229('0x23')]);router[_0x2229('0x9')](_0x2229('0x24'),auth[_0x2229('0xa')](),controller[_0x2229('0x25')]);router[_0x2229('0x9')](_0x2229('0x26'),auth[_0x2229('0xa')](),controller[_0x2229('0x27')]);router[_0x2229('0x9')](_0x2229('0x28'),auth[_0x2229('0xa')](),controller['getLists']);router[_0x2229('0x9')](_0x2229('0x29'),auth[_0x2229('0xa')](),controller[_0x2229('0x2a')]);router[_0x2229('0x9')]('/:id/prefixes',auth[_0x2229('0xa')](),controller[_0x2229('0x2b')]);router[_0x2229('0x9')](_0x2229('0x2c'),auth[_0x2229('0xa')](),controller[_0x2229('0x2d')]);router['get']('/:id/mail_accounts',auth['isAuthenticated'](),controller[_0x2229('0x2e')]);router[_0x2229('0x9')](_0x2229('0x2f'),auth[_0x2229('0xa')](),controller[_0x2229('0x30')]);router[_0x2229('0x9')](_0x2229('0x31'),auth[_0x2229('0xa')](),controller[_0x2229('0x32')]);router['get'](_0x2229('0x33'),auth['isAuthenticated'](),controller[_0x2229('0x34')]);router[_0x2229('0x9')]('/:id/whatsapp_accounts',auth['isAuthenticated'](),controller['getWhatsappAccounts']);router[_0x2229('0x9')](_0x2229('0x35'),auth['isAuthenticated'](),controller[_0x2229('0x36')]);router[_0x2229('0x9')]('/:id/api_key',auth['isAuthenticated'](),controller[_0x2229('0x37')]);router['post'](_0x2229('0x15'),auth['isAuthenticated'](),controller[_0x2229('0x38')]);router['post']('/',auth[_0x2229('0xa')](),controller[_0x2229('0x39')]);router[_0x2229('0x3a')]('/create_many',auth['isAuthenticated'](),controller[_0x2229('0x3b')]);router[_0x2229('0x3a')](_0x2229('0x16'),auth[_0x2229('0xa')](),controller['addQueues']);var upload=multer({'storage':multer[_0x2229('0x3c')]({'destination':function(_0x15eccc,_0x1439cf,_0xdc4f42){_0xdc4f42(null,path[_0x2229('0x3d')](config[_0x2229('0x3e')],_0x2229('0x3f')));},'filename':function(_0x5de599,_0x3dc7ca,_0x545957){_0x545957(null,util[_0x2229('0x40')](_0x2229('0x41'),Date['now'](),_0x3dc7ca['originalname']));}})});router[_0x2229('0x3a')](_0x2229('0x42'),upload[_0x2229('0x43')](_0x2229('0x44')),controller[_0x2229('0x45')]);router[_0x2229('0x3a')]('/:id/login',auth[_0x2229('0xa')](),controller[_0x2229('0x46')]);router['post'](_0x2229('0x47'),auth[_0x2229('0xa')](),controller['logout']);router[_0x2229('0x3a')]('/:id/pause',auth[_0x2229('0xa')](),controller[_0x2229('0x48')]);router[_0x2229('0x3a')](_0x2229('0x49'),auth[_0x2229('0xa')](),controller[_0x2229('0x4a')]);router[_0x2229('0x3a')](_0x2229('0x26'),auth[_0x2229('0xa')](),controller['addTeams']);router[_0x2229('0x3a')](_0x2229('0x4b'),auth['isAuthenticated'](),controller[_0x2229('0x4c')]);router[_0x2229('0x3a')](_0x2229('0x4d'),auth[_0x2229('0xa')](),controller[_0x2229('0x4e')]);router[_0x2229('0x3a')](_0x2229('0x4f'),auth['isAuthenticated'](),controller['addFaxInteractions']);router[_0x2229('0x3a')](_0x2229('0x50'),auth['isAuthenticated'](),controller[_0x2229('0x51')]);router[_0x2229('0x3a')]('/:id/openchannel_interactions',auth[_0x2229('0xa')](),controller[_0x2229('0x52')]);router[_0x2229('0x3a')](_0x2229('0x53'),auth[_0x2229('0xa')](),controller[_0x2229('0x54')]);router['post'](_0x2229('0x2c'),auth[_0x2229('0xa')](),controller[_0x2229('0x55')]);router[_0x2229('0x3a')](_0x2229('0x56'),auth[_0x2229('0xa')](),controller[_0x2229('0x57')]);router[_0x2229('0x3a')]('/:id/openchannel_accounts',auth[_0x2229('0xa')](),controller[_0x2229('0x58')]);router[_0x2229('0x3a')](_0x2229('0x31'),auth['isAuthenticated'](),controller[_0x2229('0x59')]);router['post'](_0x2229('0x33'),auth[_0x2229('0xa')](),controller[_0x2229('0x5a')]);router[_0x2229('0x3a')](_0x2229('0x5b'),auth[_0x2229('0xa')](),controller[_0x2229('0x5c')]);router[_0x2229('0x3a')]('/:id/api_key',auth[_0x2229('0xa')](),controller[_0x2229('0x5d')]);router['put']('/:id',auth[_0x2229('0xa')](),controller[_0x2229('0x5e')]);router[_0x2229('0x5f')](_0x2229('0x60'),auth[_0x2229('0xa')](),controller[_0x2229('0x61')]);router[_0x2229('0x62')](_0x2229('0x16'),auth['isAuthenticated'](),controller[_0x2229('0x63')]);router[_0x2229('0x62')]('/:id/teams',auth[_0x2229('0xa')](),controller['removeTeams']);router[_0x2229('0x62')](_0x2229('0x10'),auth[_0x2229('0xa')](),controller[_0x2229('0x64')]);router[_0x2229('0x62')](_0x2229('0x4b'),auth[_0x2229('0xa')](),controller[_0x2229('0x65')]);router[_0x2229('0x62')](_0x2229('0x4d'),auth[_0x2229('0xa')](),controller[_0x2229('0x66')]);router[_0x2229('0x62')](_0x2229('0x4f'),auth[_0x2229('0xa')](),controller[_0x2229('0x67')]);router[_0x2229('0x62')]('/:id/sms_interactions',auth[_0x2229('0xa')](),controller[_0x2229('0x68')]);router[_0x2229('0x62')](_0x2229('0x69'),auth[_0x2229('0xa')](),controller[_0x2229('0x6a')]);router[_0x2229('0x62')](_0x2229('0x53'),auth['isAuthenticated'](),controller['removeWhatsappInteractions']);router[_0x2229('0x62')](_0x2229('0x2c'),auth[_0x2229('0xa')](),controller[_0x2229('0x6b')]);router[_0x2229('0x62')](_0x2229('0x56'),auth[_0x2229('0xa')](),controller[_0x2229('0x6c')]);router[_0x2229('0x62')]('/:id/openchannel_accounts',auth[_0x2229('0xa')](),controller[_0x2229('0x6d')]);router[_0x2229('0x62')](_0x2229('0x31'),auth[_0x2229('0xa')](),controller['removeSmsAccounts']);router['delete']('/:id/chat_websites',auth[_0x2229('0xa')](),controller[_0x2229('0x6e')]);router[_0x2229('0x62')]('/:id/whatsapp_accounts',auth[_0x2229('0xa')](),controller[_0x2229('0x6f')]);router[_0x2229('0x62')](_0x2229('0x70'),auth[_0x2229('0xa')](),controller['removeApiKey']);router['post'](_0x2229('0x71'),auth[_0x2229('0xa')](),controller[_0x2229('0x72')]);module[_0x2229('0x73')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index 36c7826..22b02b8 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 _0x595f=['insecure','never','\x22\x22\x20<>','accept','refuse','uas','fingerprint','certificate','active','passive','TEXT','showWebBar','get','isArray','udp','wss','encryption','force_avp','dtlsenable','rtcp_mux','icesupport','dtlsverify','dtlssetup','actpass','dtlscertfile','/etc/pki/tls/private/motion.key','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blockedAt','loginAttempts','UNSIGNED','sequelize','moment','exports','STRING','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','fullname','callerid','\x22%s\x22\x20<%s>','getDataValue','internal','email','admin','user','agent','telephone','local','INTEGER','accountcode','format','BOOLEAN','DATE','ENUM','friend','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','PROHIB_PASSED_SCREEN','PROHIB','transport','join','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','yes','nonat','update','outgoing','force_rport,comedia','nat','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'];(function(_0x4d087b,_0x549d0d){var _0x19a262=function(_0x3308b6){while(--_0x3308b6){_0x4d087b['push'](_0x4d087b['shift']());}};_0x19a262(++_0x549d0d);}(_0x595f,0x12a));var _0xf595=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x595f[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xf595('0x0'));var moment=require(_0xf595('0x1'));var util=require('util');var _=require('lodash');module[_0xf595('0x2')]={'name':{'type':Sequelize[_0xf595('0x3')],'allowNull':![],'unique':_0xf595('0x4'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x1883a9){this[_0xf595('0x5')](_0xf595('0x4'),_0x1883a9);this[_0xf595('0x5')](_0xf595('0x6'),_0x1883a9);},'comment':_0xf595('0x7')},'fullname':{'type':Sequelize[_0xf595('0x3')],'allowNull':![],'set':function(_0x37aefd){this[_0xf595('0x5')](_0xf595('0x8'),_0x37aefd);this[_0xf595('0x5')](_0xf595('0x9'),util['format'](_0xf595('0xa'),_0x37aefd,this[_0xf595('0xb')](_0xf595('0xc'))));}},'alias':{'type':Sequelize[_0xf595('0x3')]},'email':{'type':Sequelize[_0xf595('0x3')],'allowNull':![],'unique':_0xf595('0xd'),'validate':{'isEmail':!![]},'set':function(_0x13ee41){if(_0x13ee41){this[_0xf595('0x5')](_0xf595('0xd'),_0x13ee41['toLowerCase']());}}},'role':{'type':Sequelize['ENUM'](_0xf595('0xe'),_0xf595('0xf'),_0xf595('0x10'),_0xf595('0x11')),'allowNull':![]},'password':{'type':Sequelize[_0xf595('0x3')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize['STRING'],'defaultValue':_0xf595('0x12')},'internal':{'type':Sequelize[_0xf595('0x13')](0xb),'allowNull':![],'unique':_0xf595('0xc'),'set':function(_0x1eec77){this[_0xf595('0x5')](_0xf595('0xc'),_0x1eec77);this[_0xf595('0x5')](_0xf595('0x14'),_0x1eec77);this['setDataValue'](_0xf595('0x9'),util[_0xf595('0x15')]('\x22%s\x22\x20<%s>',this['getDataValue'](_0xf595('0x8')),_0x1eec77));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0xf595('0x3')]},'mobile':{'type':Sequelize[_0xf595('0x3')]},'address':{'type':Sequelize['STRING']},'zipcode':{'type':Sequelize[_0xf595('0x3')]},'userpic':{'type':Sequelize[_0xf595('0x3')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize['STRING']},'online':{'type':Sequelize[_0xf595('0x16')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0xf595('0x17')]},'voicePause':{'type':Sequelize[_0xf595('0x16')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0xf595('0x16')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0xf595('0x16')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0xf595('0x16')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0xf595('0x16')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0xf595('0x16')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0xf595('0x16')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0xf595('0x3')],'defaultValue':'DEFAULT\x20PAUSE'},'lastPauseAt':{'type':Sequelize[_0xf595('0x17')]},'chatCapacity':{'type':Sequelize[_0xf595('0x13')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0xf595('0x13')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0xf595('0x13')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0xf595('0x13')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0xf595('0x13')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0xf595('0x16')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0xf595('0x16')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0xf595('0x13')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize['INTEGER'],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0xf595('0x16')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0xf595('0x16')],'defaultValue':![]},'chanspy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0xf595('0x3')],'allowNull':!![]},'host':{'type':Sequelize[_0xf595('0x3')],'allowNull':!![],'defaultValue':'dynamic'},'ipaddr':{'type':Sequelize[_0xf595('0x3')],'allowNull':!![]},'port':{'type':Sequelize[_0xf595('0x13')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0xf595('0x13')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0xf595('0x3')],'allowNull':!![]},'regserver':{'type':Sequelize[_0xf595('0x3')],'allowNull':!![]},'useragent':{'type':Sequelize[_0xf595('0x3')],'allowNull':!![]},'lastms':{'type':Sequelize[_0xf595('0x13')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0xf595('0x18')](_0xf595('0x19'),_0xf595('0xf'),'peer'),'allowNull':!![],'defaultValue':'friend'},'context':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xf595('0x1a')},'callingpres':{'type':Sequelize[_0xf595('0x18')](_0xf595('0x1b'),_0xf595('0x1c'),'ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED',_0xf595('0x1d'),'PROHIB_FAILED_SCREEN',_0xf595('0x1e')),'allowNull':!![]},'deny':{'type':Sequelize['STRING'],'allowNull':!![]},'permit':{'type':Sequelize['STRING'],'allowNull':!![]},'secret':{'type':Sequelize[_0xf595('0x3')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0xf595('0x3')],'allowNull':!![]},'remotesecret':{'type':Sequelize['STRING'],'allowNull':!![]},'transport':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'udp','set':function(_0x3a219d){this['setDataValue'](_0xf595('0x1f'),_0x3a219d?_0x3a219d[_0xf595('0x20')](','):null);},'get':function(){return this['getDataValue'](_0xf595('0x1f'))?this[_0xf595('0xb')]('transport')['split'](','):null;},'comment':_0xf595('0x21')},'dtmfmode':{'type':Sequelize[_0xf595('0x18')](_0xf595('0x22'),_0xf595('0x23'),_0xf595('0x24'),_0xf595('0x25'),'auto'),'allowNull':!![],'defaultValue':_0xf595('0x22')},'directmedia':{'type':Sequelize[_0xf595('0x18')](_0xf595('0x26'),'no',_0xf595('0x27'),_0xf595('0x28'),_0xf595('0x29')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xf595('0x18')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xf595('0x3')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0xf595('0x3')],'allowNull':!![]},'nat':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xf595('0x2a'),'set':function(_0x359c44){this[_0xf595('0x5')](_0xf595('0x2b'),_0x359c44?_0x359c44[_0xf595('0x20')](','):null);},'get':function(){return this['getDataValue'](_0xf595('0x2b'))?this[_0xf595('0xb')]('nat')[_0xf595('0x2c')](','):null;},'comment':_0xf595('0x2d')},'callgroup':{'type':Sequelize[_0xf595('0x3')]},'namedcallgroup':{'type':Sequelize[_0xf595('0x3')]},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0xf595('0x3')]},'language':{'type':Sequelize[_0xf595('0x3')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING']},'disallow':{'type':Sequelize[_0xf595('0x3')],'allowNull':![],'defaultValue':_0xf595('0x2e')},'allow':{'type':Sequelize[_0xf595('0x3')],'allowNull':![],'defaultValue':_0xf595('0x2f'),'set':function(_0x19fac4){this[_0xf595('0x5')]('allow',_0x19fac4?_0x19fac4[_0xf595('0x20')](';'):_0xf595('0x2f'));},'get':function(){return this[_0xf595('0xb')](_0xf595('0x30'))?this['getDataValue'](_0xf595('0x30'))[_0xf595('0x2c')](';'):null;},'comment':_0xf595('0x31')},'autoframing':{'type':Sequelize[_0xf595('0x18')](_0xf595('0x26'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize['STRING'],'allowNull':!![],'set':function(_0x32c12f){this['setDataValue'](_0xf595('0x32'),_0x32c12f?_0x32c12f[_0xf595('0x20')](','):null);},'get':function(){return this['getDataValue'](_0xf595('0x32'))?this[_0xf595('0xb')](_0xf595('0x32'))[_0xf595('0x2c')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0xf595('0x18')](_0xf595('0x26'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xf595('0x18')](_0xf595('0x26'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM'](_0xf595('0x26'),'no',_0xf595('0x33')),'allowNull':!![]},'promiscredir':{'type':Sequelize['ENUM'](_0xf595('0x26'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0xf595('0x18')](_0xf595('0x26'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0xf595('0x3')],'allowNull':!![]},'callerid':{'type':Sequelize[_0xf595('0x3')],'allowNull':!![],'defaultValue':_0xf595('0x34')},'amaflags':{'type':Sequelize[_0xf595('0x3')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0xf595('0x18')](_0xf595('0x26'),'no'),'allowNull':!![],'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0xf595('0x13')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize['ENUM'](_0xf595('0x26'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0xf595('0x18')]('yes','no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0xf595('0x18')](_0xf595('0x26'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize['STRING'],'allowNull':!![]},'template':{'type':Sequelize[_0xf595('0x3')],'allowNull':!![]},'videosupport':{'type':Sequelize['ENUM'](_0xf595('0x26'),'no','always'),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xf595('0x13')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0xf595('0x18')]('yes','no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0xf595('0x3')],'allowNull':!![]},'session_timers':{'type':Sequelize['ENUM'](_0xf595('0x35'),_0xf595('0x36'),'originate'),'allowNull':!![]},'session_expires':{'type':Sequelize[_0xf595('0x13')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0xf595('0x13')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0xf595('0x18')]('uac',_0xf595('0x37')),'allowNull':!![],'defaultValue':_0xf595('0x37')},'t38pt_usertpsource':{'type':Sequelize[_0xf595('0x3')],'allowNull':!![]},'regexten':{'type':Sequelize[_0xf595('0x3')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0xf595('0x3')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0xf595('0x3')],'allowNull':!![]},'qualify':{'type':Sequelize['ENUM'](_0xf595('0x26'),'no'),'allowNull':!![],'defaultValue':_0xf595('0x26')},'keepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0xf595('0x3')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0xf595('0x3')],'allowNull':!![]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0xf595('0x13')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0xf595('0x13')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0xf595('0x18')](_0xf595('0x26'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING'],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0xf595('0x3')],'allowNull':!![]},'timert1':{'type':Sequelize[_0xf595('0x13')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0xf595('0x13')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0xf595('0x13')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0xf595('0x3')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0xf595('0x3')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0xf595('0x3')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0xf595('0x3')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0xf595('0x3')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0xf595('0x13')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize['ENUM'](_0xf595('0x26'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize['ENUM'](_0xf595('0x26'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0xf595('0x18')](_0xf595('0x26'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0xf595('0x18')]('yes','no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize['ENUM'](_0xf595('0x26'),'no',_0xf595('0x38'),_0xf595('0x39')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0xf595('0x3')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0xf595('0x3')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0xf595('0x3')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0xf595('0x3')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0xf595('0x3')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0xf595('0x18')](_0xf595('0x3a'),_0xf595('0x3b'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xf595('0x3')],'allowNull':!![]},'usereqphone':{'type':Sequelize['ENUM'](_0xf595('0x26'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xf595('0x3')],'allowNull':!![]},'recordofffeature':{'type':Sequelize['STRING'],'allowNull':!![]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0xf595('0x18')]('yes','no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize['ENUM'](_0xf595('0x26'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0xf595('0x3')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0xf595('0x3')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0xf595('0x3')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0xf595('0x3')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0xf595('0x18')](_0xf595('0x26'),'no',_0xf595('0x27'),_0xf595('0x28'),'update,nonat'),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0xf595('0x16')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0xf595('0x3')]},'resetPasswordExpires':{'type':Sequelize[_0xf595('0x17')]},'passwordResetAt':{'type':Sequelize[_0xf595('0x17')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0xf595('0x3c')]},'showWebBar':{'type':Sequelize[_0xf595('0x13')],'defaultValue':0x0,'set':function(_0x1d510e){this['setDataValue'](_0xf595('0x3d'),_0x1d510e);var _0x2b852d=this[_0xf595('0x3e')]({'plain':!![]});switch(_0x1d510e){case 0x0:case 0x1:var _0x337618=_0x2b852d['transport']?_[_0xf595('0x3f')](_0x2b852d[_0xf595('0x1f')])?_0x2b852d[_0xf595('0x1f')]['join']():_0x2b852d[_0xf595('0x1f')]:_0xf595('0x40');if(_0x337618===_0xf595('0x41')){_0x337618=_0xf595('0x40');}this['setDataValue'](_0xf595('0x1f'),_0x337618);this[_0xf595('0x5')](_0xf595('0x42'),'no');this[_0xf595('0x5')]('avpf',null);this['setDataValue'](_0xf595('0x43'),null);this[_0xf595('0x5')]('icesupport',null);this['setDataValue'](_0xf595('0x44'),null);this[_0xf595('0x5')]('dtlsverify',null);this[_0xf595('0x5')]('dtlssetup',null);this[_0xf595('0x5')]('dtlscertfile',null);this[_0xf595('0x5')]('dtlsprivatekey',null);this[_0xf595('0x5')](_0xf595('0x45'),'no');break;case 0x2:this[_0xf595('0x5')](_0xf595('0x1f'),_0xf595('0x41'));this[_0xf595('0x5')]('encryption',_0xf595('0x26'));this['setDataValue']('avpf',_0xf595('0x26'));this[_0xf595('0x5')](_0xf595('0x43'),_0xf595('0x26'));this['setDataValue'](_0xf595('0x46'),'yes');this['setDataValue']('dtlsenable',_0xf595('0x26'));this['setDataValue'](_0xf595('0x47'),'no');this[_0xf595('0x5')](_0xf595('0x48'),_0xf595('0x49'));this['setDataValue'](_0xf595('0x4a'),_0x2b852d[_0xf595('0x4a')]||'/etc/pki/tls/certs/motion.crt');this[_0xf595('0x5')]('dtlsprivatekey',_0x2b852d['dtlsprivatekey']||_0xf595('0x4b'));this[_0xf595('0x5')](_0xf595('0x45'),_0xf595('0x26'));break;default:}}},'permissions':{'type':Sequelize[_0xf595('0x3c')],'set':function(_0x401410){this[_0xf595('0x5')](_0xf595('0x4c'),_0x401410?_0x401410[_0xf595('0x20')](','):[]);},'get':function(){return this[_0xf595('0xb')](_0xf595('0x4c'))?_[_0xf595('0x4d')](this[_0xf595('0xb')](_0xf595('0x4c'))[_0xf595('0x2c')](','),function(_0x2bdc04){return parseInt(_0x2bdc04,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0xf595('0x3')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0xf595('0x3')]},'phoneBarBusyNumber':{'type':Sequelize[_0xf595('0x3')]},'phoneBarUnconditional':{'type':Sequelize[_0xf595('0x16')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0xf595('0x16')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0xf595('0x16')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0xf595('0x16')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0xf595('0x16')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0xf595('0x3')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0xf595('0x13')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0xf595('0x18')](_0xf595('0x26'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0xf595('0x16')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0xf595('0x3')]},'phoneBarEnableJaws':{'type':Sequelize[_0xf595('0x16')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0xf595('0x4e')],'get':function(){return this[_0xf595('0xb')](_0xf595('0x4f'))?this[_0xf595('0xb')]('phoneBarEnableScreenRecordingByAgent'):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0xf595('0x16')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0xf595('0x16')],'defaultValue':![]},'hotdesk':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'interface':{'type':Sequelize[_0xf595('0x3')],'defaultValue':null},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0xf595('0x3')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0xf595('0x3')],'allowNull':!![]},'screenrecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x110132){if(typeof _0x110132===_0xf595('0x50')){var _0x1f35c2=_0x110132==='1'?!![]:_0x110132==='0'?![]:_0x110132===_0xf595('0x51')?!![]:_0x110132===_0xf595('0x52')?![]:![];this[_0xf595('0x5')](_0xf595('0x53'),_0x1f35c2);}else{this[_0xf595('0x5')](_0xf595('0x53'),_0x110132);}}},'blocked':{'type':Sequelize[_0xf595('0x16')],'defaultValue':![],'set':function(_0x3385d4){this[_0xf595('0x5')]('blocked',_0x3385d4);if(_0x3385d4===!![]){this[_0xf595('0x5')](_0xf595('0x54'),moment());this['setDataValue'](_0xf595('0x55'),0x0);}else{this[_0xf595('0x5')](_0xf595('0x54'),null);}}},'blockedAt':{'type':Sequelize[_0xf595('0x17')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0xf595('0x13')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0xf595('0x16')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'wssPort':{'type':Sequelize['INTEGER'](0x5)[_0xf595('0x56')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0xf595('0x16')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xf595('0x16')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xf595('0x16')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0xf595('0x16')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0xf595('0x16')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0xf595('0x16')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0xf595('0x16')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize[_0xf595('0x13')],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0xf595('0x13')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0xf595('0x13')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0xf595('0x16')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0xf595('0x16')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0xf595('0x13')],'defaultValue':0x0},'messengerSoundNotification':{'type':Sequelize[_0xf595('0x16')],'defaultValue':![]}}; \ No newline at end of file +var _0xd57e=['user','agent','telephone','INTEGER','accountcode','\x22%s\x22\x20<%s>','BOOLEAN','DATE','DEFAULT\x20PAUSE','friend','peer','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_FAILED_SCREEN','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','udp','join','transport','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','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]','ulaw;alaw;gsm','allow','insecure','never','accept','originate','uac','uas','certificate','active','actpass','TEXT','showWebBar','wss','avpf','dtlsenable','dtlsverify','dtlscertfile','dtlsprivatekey','encryption','icesupport','dtlssetup','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','rtcp_mux','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','screenrecording','blocked','blockedAt','UNSIGNED','sequelize','moment','util','lodash','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','STRING','fullname','getDataValue','internal','email','toLowerCase','ENUM','admin'];(function(_0x19540f,_0x49cc71){var _0x4350d0=function(_0x2b9103){while(--_0x2b9103){_0x19540f['push'](_0x19540f['shift']());}};_0x4350d0(++_0x49cc71);}(_0xd57e,0x1e8));var _0xed57=function(_0x4f4d19,_0x574245){_0x4f4d19=_0x4f4d19-0x0;var _0x27a258=_0xd57e[_0x4f4d19];return _0x27a258;};'use strict';var Sequelize=require(_0xed57('0x0'));var moment=require(_0xed57('0x1'));var util=require(_0xed57('0x2'));var _=require(_0xed57('0x3'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xed57('0x4'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x3f61db){this['setDataValue'](_0xed57('0x4'),_0x3f61db);this[_0xed57('0x5')](_0xed57('0x6'),_0x3f61db);},'comment':_0xed57('0x7')},'fullname':{'type':Sequelize[_0xed57('0x8')],'allowNull':![],'set':function(_0x5f5266){this['setDataValue'](_0xed57('0x9'),_0x5f5266);this['setDataValue']('callerid',util['format']('\x22%s\x22\x20<%s>',_0x5f5266,this[_0xed57('0xa')](_0xed57('0xb'))));}},'alias':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0xed57('0x8')],'allowNull':![],'unique':'email','validate':{'isEmail':!![]},'set':function(_0x4beea5){if(_0x4beea5){this[_0xed57('0x5')](_0xed57('0xc'),_0x4beea5[_0xed57('0xd')]());}}},'role':{'type':Sequelize[_0xed57('0xe')](_0xed57('0xf'),_0xed57('0x10'),_0xed57('0x11'),_0xed57('0x12')),'allowNull':![]},'password':{'type':Sequelize[_0xed57('0x8')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0xed57('0x8')],'defaultValue':'local'},'internal':{'type':Sequelize[_0xed57('0x13')](0xb),'allowNull':![],'unique':_0xed57('0xb'),'set':function(_0x3b0a61){this['setDataValue'](_0xed57('0xb'),_0x3b0a61);this[_0xed57('0x5')](_0xed57('0x14'),_0x3b0a61);this[_0xed57('0x5')]('callerid',util['format'](_0xed57('0x15'),this['getDataValue'](_0xed57('0x9')),_0x3b0a61));}},'salt':{'type':Sequelize[_0xed57('0x8')]},'phone':{'type':Sequelize[_0xed57('0x8')]},'mobile':{'type':Sequelize[_0xed57('0x8')]},'address':{'type':Sequelize['STRING']},'zipcode':{'type':Sequelize['STRING']},'userpic':{'type':Sequelize[_0xed57('0x8')]},'city':{'type':Sequelize[_0xed57('0x8')]},'country':{'type':Sequelize[_0xed57('0x8')]},'online':{'type':Sequelize[_0xed57('0x16')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0xed57('0x17')]},'voicePause':{'type':Sequelize[_0xed57('0x16')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0xed57('0x16')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0xed57('0x16')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0xed57('0x16')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0xed57('0x16')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0xed57('0x16')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0xed57('0x16')],'defaultValue':![]},'pauseType':{'type':Sequelize['STRING'],'defaultValue':_0xed57('0x18')},'lastPauseAt':{'type':Sequelize[_0xed57('0x17')]},'chatCapacity':{'type':Sequelize[_0xed57('0x13')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0xed57('0x13')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0xed57('0x13')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0xed57('0x13')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0xed57('0x16')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0xed57('0x13')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0xed57('0x13')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0xed57('0x16')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chanspy':{'type':Sequelize[_0xed57('0x16')],'defaultValue':![]},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'host':{'type':Sequelize[_0xed57('0x8')],'allowNull':!![],'defaultValue':'dynamic'},'ipaddr':{'type':Sequelize['STRING'],'allowNull':!![]},'port':{'type':Sequelize[_0xed57('0x13')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0xed57('0x8')],'allowNull':!![]},'regserver':{'type':Sequelize[_0xed57('0x8')],'allowNull':!![]},'useragent':{'type':Sequelize[_0xed57('0x8')],'allowNull':!![]},'lastms':{'type':Sequelize[_0xed57('0x13')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0xed57('0xe')](_0xed57('0x19'),_0xed57('0x10'),_0xed57('0x1a')),'allowNull':!![],'defaultValue':_0xed57('0x19')},'context':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xed57('0x1b')},'callingpres':{'type':Sequelize[_0xed57('0xe')](_0xed57('0x1c'),'ALLOWED_PASSED_SCREEN',_0xed57('0x1d'),'ALLOWED',_0xed57('0x1e'),_0xed57('0x1f'),_0xed57('0x20'),'PROHIB'),'allowNull':!![]},'deny':{'type':Sequelize[_0xed57('0x8')],'allowNull':!![]},'permit':{'type':Sequelize['STRING'],'allowNull':!![]},'secret':{'type':Sequelize['STRING'],'allowNull':!![]},'md5secret':{'type':Sequelize[_0xed57('0x8')],'allowNull':!![]},'remotesecret':{'type':Sequelize['STRING'],'allowNull':!![]},'transport':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xed57('0x21'),'set':function(_0x2de398){this[_0xed57('0x5')]('transport',_0x2de398?_0x2de398[_0xed57('0x22')](','):null);},'get':function(){return this[_0xed57('0xa')](_0xed57('0x23'))?this['getDataValue'](_0xed57('0x23'))[_0xed57('0x24')](','):null;},'comment':_0xed57('0x25')},'dtmfmode':{'type':Sequelize[_0xed57('0xe')](_0xed57('0x26'),'info',_0xed57('0x27'),_0xed57('0x28'),_0xed57('0x29')),'allowNull':!![],'defaultValue':_0xed57('0x26')},'directmedia':{'type':Sequelize[_0xed57('0xe')](_0xed57('0x2a'),'no',_0xed57('0x2b'),_0xed57('0x2c'),_0xed57('0x2d')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xed57('0xe')](_0xed57('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xed57('0x8')],'allowNull':!![]},'directmediadeny':{'type':Sequelize['STRING'],'allowNull':!![]},'nat':{'type':Sequelize[_0xed57('0x8')],'allowNull':!![],'defaultValue':_0xed57('0x2e'),'set':function(_0x25d302){this[_0xed57('0x5')](_0xed57('0x2f'),_0x25d302?_0x25d302[_0xed57('0x22')](','):null);},'get':function(){return this[_0xed57('0xa')](_0xed57('0x2f'))?this[_0xed57('0xa')]('nat')[_0xed57('0x24')](','):null;},'comment':_0xed57('0x30')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0xed57('0x8')]},'namedpickupgroup':{'type':Sequelize[_0xed57('0x8')]},'language':{'type':Sequelize[_0xed57('0x8')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xed57('0x8')]},'disallow':{'type':Sequelize[_0xed57('0x8')],'allowNull':![],'defaultValue':'all'},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xed57('0x31'),'set':function(_0x7150aa){this[_0xed57('0x5')](_0xed57('0x32'),_0x7150aa?_0x7150aa['join'](';'):_0xed57('0x31'));},'get':function(){return this[_0xed57('0xa')]('allow')?this[_0xed57('0xa')](_0xed57('0x32'))[_0xed57('0x24')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'},'autoframing':{'type':Sequelize['ENUM'](_0xed57('0x2a'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0xed57('0x8')],'allowNull':!![],'set':function(_0x5c921e){this['setDataValue']('insecure',_0x5c921e?_0x5c921e[_0xed57('0x22')](','):null);},'get':function(){return this[_0xed57('0xa')](_0xed57('0x33'))?this['getDataValue']('insecure')[_0xed57('0x24')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0xed57('0xe')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xed57('0xe')](_0xed57('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xed57('0xe')](_0xed57('0x2a'),'no',_0xed57('0x34')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0xed57('0xe')]('yes','no'),'allowNull':!![]},'useclientcode':{'type':Sequelize['ENUM'](_0xed57('0x2a'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0xed57('0x13')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0xed57('0x8')],'allowNull':!![]},'callerid':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize[_0xed57('0x8')],'allowNull':!![]},'callcounter':{'type':Sequelize['ENUM'](_0xed57('0x2a'),'no'),'allowNull':!![],'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0xed57('0x13')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0xed57('0xe')](_0xed57('0x2a'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0xed57('0xe')](_0xed57('0x2a'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0xed57('0xe')]('yes','no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0xed57('0xe')](_0xed57('0x2a'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0xed57('0x8')],'allowNull':!![]},'template':{'type':Sequelize[_0xed57('0x8')],'allowNull':!![]},'videosupport':{'type':Sequelize['ENUM']('yes','no','always'),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize['ENUM'](_0xed57('0x2a'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0xed57('0x8')],'allowNull':!![]},'session_timers':{'type':Sequelize['ENUM'](_0xed57('0x35'),'refuse',_0xed57('0x36')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0xed57('0x13')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0xed57('0x13')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize['ENUM'](_0xed57('0x37'),_0xed57('0x38')),'allowNull':!![],'defaultValue':_0xed57('0x38')},'t38pt_usertpsource':{'type':Sequelize[_0xed57('0x8')],'allowNull':!![]},'regexten':{'type':Sequelize[_0xed57('0x8')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0xed57('0x8')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0xed57('0x8')],'allowNull':!![]},'qualify':{'type':Sequelize['ENUM'](_0xed57('0x2a'),'no'),'allowNull':!![],'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0xed57('0x13')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0xed57('0x8')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0xed57('0x8')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0xed57('0x13')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0xed57('0x13')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0xed57('0xe')](_0xed57('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xed57('0x8')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0xed57('0x8')],'allowNull':!![]},'timert1':{'type':Sequelize[_0xed57('0x13')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0xed57('0x13')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0xed57('0x8')],'allowNull':!![]},'contactdeny':{'type':Sequelize['STRING'],'allowNull':!![]},'contactacl':{'type':Sequelize[_0xed57('0x8')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0xed57('0x8')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0xed57('0x8')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0xed57('0x13')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0xed57('0xe')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0xed57('0xe')](_0xed57('0x2a'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0xed57('0xe')](_0xed57('0x2a'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0xed57('0xe')]('yes','no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize['ENUM'](_0xed57('0x2a'),'no','fingerprint',_0xed57('0x39')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0xed57('0x13')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0xed57('0x8')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0xed57('0x8')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0xed57('0x8')],'allowNull':!![]},'dtlscapath':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0xed57('0xe')](_0xed57('0x3a'),'passive',_0xed57('0x3b')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xed57('0x8')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0xed57('0xe')](_0xed57('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xed57('0x8')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0xed57('0x8')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0xed57('0x13')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0xed57('0xe')](_0xed57('0x2a'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize['ENUM'](_0xed57('0x2a'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0xed57('0x8')],'allowNull':!![]},'mohinterpret':{'type':Sequelize['STRING'],'allowNull':!![]},'mohsuggest':{'type':Sequelize['STRING'],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0xed57('0x8')],'allowNull':!![]},'canreinvite':{'type':Sequelize['ENUM'](_0xed57('0x2a'),'no',_0xed57('0x2b'),_0xed57('0x2c'),'update,nonat'),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0xed57('0x16')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0xed57('0x8')]},'resetPasswordExpires':{'type':Sequelize[_0xed57('0x17')]},'passwordResetAt':{'type':Sequelize[_0xed57('0x17')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0xed57('0x3c')]},'showWebBar':{'type':Sequelize[_0xed57('0x13')],'defaultValue':0x0,'set':function(_0x591edb){this[_0xed57('0x5')](_0xed57('0x3d'),_0x591edb);var _0x2ae50f=this['get']({'plain':!![]});switch(_0x591edb){case 0x0:case 0x1:var _0x25c2c4=_0x2ae50f[_0xed57('0x23')]?_['isArray'](_0x2ae50f[_0xed57('0x23')])?_0x2ae50f['transport'][_0xed57('0x22')]():_0x2ae50f[_0xed57('0x23')]:_0xed57('0x21');if(_0x25c2c4===_0xed57('0x3e')){_0x25c2c4=_0xed57('0x21');}this[_0xed57('0x5')]('transport',_0x25c2c4);this[_0xed57('0x5')]('encryption','no');this['setDataValue'](_0xed57('0x3f'),null);this[_0xed57('0x5')]('force_avp',null);this[_0xed57('0x5')]('icesupport',null);this[_0xed57('0x5')](_0xed57('0x40'),null);this[_0xed57('0x5')](_0xed57('0x41'),null);this[_0xed57('0x5')]('dtlssetup',null);this[_0xed57('0x5')](_0xed57('0x42'),null);this[_0xed57('0x5')](_0xed57('0x43'),null);this[_0xed57('0x5')]('rtcp_mux','no');break;case 0x2:this[_0xed57('0x5')]('transport',_0xed57('0x3e'));this[_0xed57('0x5')](_0xed57('0x44'),_0xed57('0x2a'));this[_0xed57('0x5')]('avpf',_0xed57('0x2a'));this['setDataValue']('force_avp',_0xed57('0x2a'));this[_0xed57('0x5')](_0xed57('0x45'),_0xed57('0x2a'));this[_0xed57('0x5')](_0xed57('0x40'),'yes');this[_0xed57('0x5')](_0xed57('0x41'),'no');this[_0xed57('0x5')](_0xed57('0x46'),_0xed57('0x3b'));this[_0xed57('0x5')]('dtlscertfile',_0x2ae50f['dtlscertfile']||_0xed57('0x47'));this[_0xed57('0x5')](_0xed57('0x43'),_0x2ae50f['dtlsprivatekey']||_0xed57('0x48'));this[_0xed57('0x5')](_0xed57('0x49'),'yes');break;default:}}},'permissions':{'type':Sequelize[_0xed57('0x3c')],'set':function(_0xaa1174){this['setDataValue'](_0xed57('0x4a'),_0xaa1174?_0xaa1174['join'](','):[]);},'get':function(){return this[_0xed57('0xa')](_0xed57('0x4a'))?_[_0xed57('0x4b')](this[_0xed57('0xa')]('permissions')['split'](','),function(_0x19c288){return parseInt(_0x19c288,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0xed57('0x8')]},'phoneBarNoReplyNumber':{'type':Sequelize['STRING']},'phoneBarBusyNumber':{'type':Sequelize[_0xed57('0x8')]},'phoneBarUnconditional':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0xed57('0x16')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0xed57('0x16')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0xed57('0x16')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0xed57('0x13')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0xed57('0x8')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0xed57('0x13')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0xed57('0xe')](_0xed57('0x2a'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize['STRING']},'phoneBarEnableJaws':{'type':Sequelize[_0xed57('0x16')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0xed57('0x16')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0xed57('0x4c')],'get':function(){return this[_0xed57('0xa')](_0xed57('0x4d'))?this[_0xed57('0xa')]('phoneBarEnableScreenRecordingByAgent'):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0xed57('0x16')],'defaultValue':![]},'hotdesk':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'interface':{'type':Sequelize[_0xed57('0x8')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0xed57('0x16')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize['STRING'],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0xed57('0x8')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0xed57('0x16')],'defaultValue':![],'set':function(_0x3aa007){if(typeof _0x3aa007===_0xed57('0x4e')){var _0x391f3d=_0x3aa007==='1'?!![]:_0x3aa007==='0'?![]:_0x3aa007===_0xed57('0x4f')?!![]:_0x3aa007==='false'?![]:![];this[_0xed57('0x5')]('screenrecording',_0x391f3d);}else{this[_0xed57('0x5')](_0xed57('0x50'),_0x3aa007);}}},'blocked':{'type':Sequelize[_0xed57('0x16')],'defaultValue':![],'set':function(_0x39a8fa){this[_0xed57('0x5')](_0xed57('0x51'),_0x39a8fa);if(_0x39a8fa===!![]){this['setDataValue']('blockedAt',moment());this[_0xed57('0x5')]('loginAttempts',0x0);}else{this['setDataValue'](_0xed57('0x52'),null);}}},'blockedAt':{'type':Sequelize[_0xed57('0x17')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0xed57('0x13')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0xed57('0x16')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0xed57('0x16')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0xed57('0x13')](0x5)[_0xed57('0x53')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0xed57('0x16')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xed57('0x16')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xed57('0x16')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0xed57('0x16')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0xed57('0x16')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0xed57('0x16')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0xed57('0x13')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0xed57('0x16')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize[_0xed57('0x13')],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0xed57('0x16')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0xed57('0x16')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0xed57('0x13')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0xed57('0x13')],'defaultValue':0x0},'messengerSoundNotification':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index 0fe631d..167e31a 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 _0x0cb5=['whatsapp','catch','params','merge','fax','mail','all','body','describe','ids','internal','findById','securePassword','validatePasswordPattern','isNil','min_internal','select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)','sequelize','QueryTypes','from','voicemail','mailbox','VoiceMail','password','fullname','email','permissions','101','102','103','110','104','105','106','108','109','100','111','114','115','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator','checkUserLimits','settingsEnabled','userProfileId','create','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','bulkCreate','Unauthorized','some','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator','telephone','isEmpty','compact','Agents','changePassword','ValidationError','Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword','authenticate','oldPassword','Sequelize','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Invalid\x20body\x20format.\x20Use\x20newPassword','findOne','enforcePasswordHistory','passwordHistoryLimit','newPassword','previousPasswords','validatePasswordHistory','updatePasswordsHistory','addQueues','channel','online','loginInPause','voicePause','interface','isValidChannel','Unknown\x20channel','Queues','penalty','capitalize','toLowerCase','emit','Queue:save','voice','findAll','format','SIP/%s','UserVoiceQueueRt','upsert','remove','QueueId','Queue:remove','userpic','getAvatar','join','root','server/files/images/logos/default_profile.png','download','server/files/images/','getOpenTabs','ChatOpenTabs','CHAT','FaxOpenTabs','createdAt','MAIL','SMS','WhatsappOpenTabs','concat','getContacts','hasOwnProperty','CmList','List','tag','getQueues','keys','Queue','intersection','model','fields','order','sort','filters','pick','options','Unknown\x20role','getVoiceQueuesRt','nolimit','getGroups','getRecordings','VoiceRecording','UserId','ScreenRecording','getChatInteractions','ChatInteraction','getOpenchannelInteractions','OpenchannelInteraction','getMailInteractions','MailInteraction','SmsInteraction','getSmsInteractions','getFaxInteractions','FaxInteraction','getWhatsappInteractions','WhatsappInteraction','login','mobile','LOCAL/%s@from-sip/n','intrf','user:%s','user:forcelogout','headers','x-forwarded-for','connection','remoteAddress','socket','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','UserVoiceQueue.penalty','forEach','getChannels','YYYY-MM-DD\x20HH:mm:ss','LOGIN','device','PAUSE','LOGININPAUSE','MemberReport','isMiddleware','resolve','pause','updateAttributes','DEFAULT\x20PAUSE','unpause','mailPause','faxPause','smsPause','whatsappPause','pauseType','lastPauseAt','getTeams','Team','addTeams','Body\x20parameter\x20\x27ids\x27\x20is\x20required','User\x20with\x20id\x20%s\x20not\x20found','transaction','getAssociatedQueues','flattenDeep','addAgent','getDataValue','Voice','UserVoicePrefix','VoicePrefixId','removeTeams','isArray','Query\x20parameter\x20\x27ids\x27\x20is\x20required','removeAgent','TeamVoicePrefix','getLists','getVoiceQueues','values','send','You\x20can\x27t\x20delete\x20yourself','addChatInteractions','omit','spread','user_has_chat_interactions:save','removeChatInteractions','user_has_chat_interactions:remove','addMailInteractions','user_has_mail_interactions:save','removeMailInteractions','user_has_mail_interactions:remove','addFaxInteractions','user_has_fax_interactions:save','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','user_has_sms_interactions:save','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','removeWhatsappInteractions','getVoicePrefixes','getFaxAccounts','FaxAccount','addFaxAccounts','removeFaxAccounts','getMailAccounts','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','OpenchannelAccount','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','SmsAccount','addSmsAccounts','removeSmsAccounts','getChatWebsites','ChatWebsite','addChatWebsites','getWhatsappAccounts','WhatsappAccount','addWhatsappAccounts','removeWhatsappAccounts','getScheduledCalls','CmHopper','$and','$or','$gt','$gte','$lt','$lte','$not','$notBetween','$in','$notIn','$like','$iLike','$notILike','$overlap','$contained','$any','lastName','phone','CmContact','Contact','dialActive','VoiceQueue','getApiKey','retrieveApiKey','token','No\x20API\x20access\x20key\x20found!','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','generateApiKey','iat','removeApiKey','apiKeyNonce','apiKeyIat','whoami','Unable\x20to\x20retrieve\x20the\x20current\x20user','getUserSetting','getPresence','teams','queues','inbound','getAgents','flatten','lower','toString','asc','desc','substring','uniqBy','orderBy','request','idle','unknown','ringing','voiceStatus','charAt','toUpperCase','slice','SELECT','select','field','ui.','InteractionId','_interactions','OpenTabs','messengerSoundNotification','enabled','util','lodash','squel','ioredis','../../components/auth/service','../../components/contacts','../../config/logger','api','../../config/utils','../../config/environment','APIBadRequestError','../../errors/api','APINotFoundError','../../mysqldb','redis','./user.socket','register','defaults','localhost','client','http','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','role','agent','userNotification:recalc:','get','admin','Users','user','Telephones','filter','ignore','map','value','includes','find','UserProfileResource','destroy','error','stack','name','User','rawAttributes','fieldName','type','key','salt','resetPasswordToken','resetPasswordExpires','md5secret','index','getOptions','where','includeAll','include','query','true','userSetting','attributes','push','rows','openTabs','length','chat','dataValues','sms','openchannel'];(function(_0x5e7e87,_0x4caf6f){var _0x33a3d7=function(_0x55242f){while(--_0x55242f){_0x5e7e87['push'](_0x5e7e87['shift']());}};_0x33a3d7(++_0x4caf6f);}(_0x0cb5,0x13c));var _0x50cb=function(_0x4e1d03,_0x786f3a){_0x4e1d03=_0x4e1d03-0x0;var _0x362d4b=_0x0cb5[_0x4e1d03];return _0x362d4b;};'use strict';var moment=require('moment');var util=require(_0x50cb('0x0'));var path=require('path');var fs=require('fs');var _=require(_0x50cb('0x1'));var squel=require(_0x50cb('0x2'));var jayson=require('jayson/promise');var Redis=require(_0x50cb('0x3'));var authService=require(_0x50cb('0x4'));var contacts=require(_0x50cb('0x5'));var qs=require('../../components/parsers/qs');var logger=require(_0x50cb('0x6'))(_0x50cb('0x7'));var utils=require(_0x50cb('0x8'));var config=require(_0x50cb('0x9'));var licenseUtil=require('../../config/license/util');var APIBadRequestError=require('../../errors/api')[_0x50cb('0xa')];var APINotFoundError=require(_0x50cb('0xb'))[_0x50cb('0xc')];var APIHandleError=require(_0x50cb('0xb'))['handleError'];var db=require(_0x50cb('0xd'))['db'];var socket=require('socket.io-emitter')(new Redis(config[_0x50cb('0xe')]));require(_0x50cb('0xf'))[_0x50cb('0x10')](socket);config[_0x50cb('0xe')]=_[_0x50cb('0x11')](config[_0x50cb('0xe')],{'host':_0x50cb('0x12'),'port':0x18eb});var amiClient=jayson[_0x50cb('0x13')][_0x50cb('0x14')]({'port':0x232a});var values;function respondWithStatusCode(_0x52528d,_0x15b948){_0x15b948=_0x15b948||0xcc;return function(_0x57ec3b){if(_0x57ec3b){return _0x52528d[_0x50cb('0x15')](_0x15b948);}return _0x52528d[_0x50cb('0x16')](_0x15b948)[_0x50cb('0x17')]();};}function respondWithResult(_0xf0767a,_0x198811){_0x198811=_0x198811||0xc8;return function(_0x24d8ab){if(_0x24d8ab){return _0xf0767a['status'](_0x198811)[_0x50cb('0x18')](_0x24d8ab);}};}function respondWithFilteredResult(_0x5eb234,_0x48fb85){return function(_0x44a0ca){if(_0x44a0ca){var _0x321c58=typeof _0x48fb85[_0x50cb('0x19')]===_0x50cb('0x1a')&&typeof _0x48fb85[_0x50cb('0x1b')]==='undefined';var _0x2d2ec1=_0x44a0ca[_0x50cb('0x1c')];var _0x159b04=_0x321c58?0x0:_0x48fb85[_0x50cb('0x19')];var _0x431d3b=_0x321c58?_0x44a0ca[_0x50cb('0x1c')]:_0x48fb85['offset']+_0x48fb85[_0x50cb('0x1b')];var _0x5efa46;if(_0x431d3b>=_0x2d2ec1){_0x431d3b=_0x2d2ec1;_0x5efa46=0xc8;}else{_0x5efa46=0xce;}_0x5eb234[_0x50cb('0x16')](_0x5efa46);return _0x5eb234[_0x50cb('0x1d')](_0x50cb('0x1e'),_0x159b04+'-'+_0x431d3b+'/'+_0x2d2ec1)[_0x50cb('0x18')](_0x44a0ca);}return null;};}function saveUpdates(_0x206b43){return function(_0x176fba){if(_0x176fba){return _0x176fba[_0x50cb('0x1f')](_0x206b43)[_0x50cb('0x20')](function(_0x2a5d1e){if(_0x2a5d1e[_0x50cb('0x21')]===_0x50cb('0x22')){socket['emit'](_0x50cb('0x23')+_0x2a5d1e['id'],_0x2a5d1e);}return _0x2a5d1e;});}return null;};}function removeEntity(_0x546b92){return function(_0x72655c){if(_0x72655c){return _0x72655c['destroy']()['then'](function(){var _0x10499d=_0x72655c[_0x50cb('0x24')]({'plain':!![]});if(_0x10499d[_0x50cb('0x21')]===_0x50cb('0x25'))return;var _0x4e6295=[{'name':_0x50cb('0x26'),'value':_0x50cb('0x27'),'ignore':!![]},{'name':'Agents','value':_0x50cb('0x22'),'ignore':![]},{'name':_0x50cb('0x28'),'value':'telephone','ignore':![]}];var _0x38350b=_(_0x4e6295)[_0x50cb('0x29')](_0x50cb('0x2a'))[_0x50cb('0x2b')](_0x50cb('0x2c'))[_0x50cb('0x2c')]();if(_[_0x50cb('0x2d')](_0x38350b,_0x10499d[_0x50cb('0x21')])){return;}var _0x1ef385=_[_0x50cb('0x2e')](_0x4e6295,[_0x50cb('0x2c'),_0x10499d[_0x50cb('0x21')]])['name'];return db[_0x50cb('0x2f')][_0x50cb('0x30')]({'where':{'type':_0x1ef385,'resourceId':_0x10499d['id']}})[_0x50cb('0x20')](function(){return _0x72655c;});})['then'](function(){_0x546b92[_0x50cb('0x16')](0xcc)[_0x50cb('0x17')]();});}};}function handleEntityNotFound(_0x48c5ff){return function(_0x189ab5){if(!_0x189ab5){_0x48c5ff[_0x50cb('0x15')](0x194);}return _0x189ab5;};}function handleError(_0x1a7422,_0x8099d6){_0x8099d6=_0x8099d6||0x1f4;return function(_0x4893e8){logger[_0x50cb('0x31')](_0x4893e8[_0x50cb('0x32')]);if(_0x4893e8[_0x50cb('0x33')]){delete _0x4893e8[_0x50cb('0x33')];}_0x1a7422['status'](_0x8099d6)['send'](_0x4893e8);};}function getUserAttributes(){return _(db[_0x50cb('0x34')][_0x50cb('0x35')])[_0x50cb('0x2b')](function(_0x5214cf){return{'name':_0x5214cf[_0x50cb('0x36')],'type':_0x5214cf[_0x50cb('0x37')][_0x50cb('0x38')]};})[_0x50cb('0x29')](function(_0x2beaf8){return!['password',_0x50cb('0x39'),'previousPasswords',_0x50cb('0x3a'),_0x50cb('0x3b'),_0x50cb('0x3c')][_0x50cb('0x2d')](_0x2beaf8[_0x50cb('0x33')]);})[_0x50cb('0x2c')]();}exports[_0x50cb('0x3d')]=function(_0x406ad4,_0x18ccb4){var _0x17976e={},_0x5745a9={'count':0x0,'rows':[]};var _0x11dc2b=getUserAttributes();_0x17976e=qs[_0x50cb('0x3e')](_0x11dc2b,_0x406ad4);var _0x318480={'where':_0x17976e[_0x50cb('0x3f')]};return db[_0x50cb('0x34')]['count'](_0x318480)['then'](function(_0x24d476){_0x5745a9[_0x50cb('0x1c')]=_0x24d476;if(_0x406ad4['query'][_0x50cb('0x40')]){_0x17976e[_0x50cb('0x41')]=[{'all':!![]}];}if(_0x406ad4[_0x50cb('0x42')]['userSetting']===_0x50cb('0x43')){_0x17976e[_0x50cb('0x41')]=[{'model':db['UserSetting'],'as':_0x50cb('0x44')}];}if(!_[_0x50cb('0x2d')](_0x17976e[_0x50cb('0x45')],'id')){_0x17976e['attributes'][_0x50cb('0x46')]('id');}return db[_0x50cb('0x34')]['findAll'](_0x17976e);})[_0x50cb('0x20')](function(_0x139a84){_0x5745a9[_0x50cb('0x47')]=_0x139a84;if(_0x406ad4[_0x50cb('0x42')][_0x50cb('0x48')]===_0x50cb('0x43')){var _0x479db4=[];for(var _0x41b3c8=0x0;_0x41b3c8<_0x5745a9['rows'][_0x50cb('0x49')];_0x41b3c8++){_0x479db4[_0x50cb('0x46')](get_open_tabs(_0x50cb('0x4a'),_0x5745a9[_0x50cb('0x47')][_0x41b3c8][_0x50cb('0x4b')]));_0x479db4[_0x50cb('0x46')](get_open_tabs(_0x50cb('0x4c'),_0x5745a9[_0x50cb('0x47')][_0x41b3c8][_0x50cb('0x4b')]));_0x479db4[_0x50cb('0x46')](get_open_tabs('fax',_0x5745a9[_0x50cb('0x47')][_0x41b3c8][_0x50cb('0x4b')]));_0x479db4['push'](get_open_tabs('mail',_0x5745a9['rows'][_0x41b3c8][_0x50cb('0x4b')]));_0x479db4[_0x50cb('0x46')](get_open_tabs(_0x50cb('0x4d'),_0x5745a9[_0x50cb('0x47')][_0x41b3c8]['dataValues']));_0x479db4['push'](get_open_tabs(_0x50cb('0x4e'),_0x5745a9[_0x50cb('0x47')][_0x41b3c8][_0x50cb('0x4b')]));}return Promise['all'](_0x479db4)[_0x50cb('0x20')](function(){return _0x5745a9;});}else{return _0x5745a9;}})[_0x50cb('0x20')](respondWithFilteredResult(_0x18ccb4,_0x17976e))[_0x50cb('0x4f')](handleError(_0x18ccb4,null));};exports['show']=function(_0x4304a9,_0x39b39e){var _0x45fecf=getUserAttributes();_0x4304a9[_0x50cb('0x42')]['id']=_0x4304a9[_0x50cb('0x50')]['id'];var _0x2dc6bb=qs['getOptions'](_0x45fecf,_0x4304a9);if(_0x4304a9['query'][_0x50cb('0x40')]){_0x2dc6bb['include']=[{'all':!![]}];}if(_0x4304a9['query'][_0x50cb('0x44')]===_0x50cb('0x43')){_0x2dc6bb[_0x50cb('0x41')]=[{'model':db['UserSetting'],'as':_0x50cb('0x44')}];}_0x2dc6bb=_[_0x50cb('0x51')]({},_0x2dc6bb,_0x4304a9['options']);if(!_['includes'](_0x2dc6bb[_0x50cb('0x45')],'id')){_0x2dc6bb[_0x50cb('0x45')][_0x50cb('0x46')]('id');}return db[_0x50cb('0x34')][_0x50cb('0x2e')](_0x2dc6bb)[_0x50cb('0x20')](handleEntityNotFound(_0x39b39e,null))['then'](function(_0x59f9b8){var _0x51365e=[];values=_0x59f9b8;if(_0x4304a9[_0x50cb('0x42')]['openTabs']===_0x50cb('0x43')){_0x51365e[_0x50cb('0x46')](get_open_tabs(_0x50cb('0x4a'),_0x59f9b8[_0x50cb('0x4b')]));_0x51365e['push'](get_open_tabs(_0x50cb('0x4c'),_0x59f9b8[_0x50cb('0x4b')]));_0x51365e[_0x50cb('0x46')](get_open_tabs(_0x50cb('0x4d'),_0x59f9b8[_0x50cb('0x4b')]));_0x51365e[_0x50cb('0x46')](get_open_tabs('whatsapp',_0x59f9b8[_0x50cb('0x4b')]));_0x51365e[_0x50cb('0x46')](get_open_tabs(_0x50cb('0x52'),_0x59f9b8['dataValues']));_0x51365e[_0x50cb('0x46')](get_open_tabs(_0x50cb('0x53'),_0x59f9b8[_0x50cb('0x4b')]));return Promise[_0x50cb('0x54')](_0x51365e);}else{return values;}})[_0x50cb('0x20')](function(){return values;})[_0x50cb('0x20')](respondWithResult(_0x39b39e,null))[_0x50cb('0x4f')](handleError(_0x39b39e,null));};exports['update']=function(_0xea9922,_0x2ad0bd){if(_0xea9922[_0x50cb('0x55')]['id']){delete _0xea9922['body']['id'];}delete _0xea9922[_0x50cb('0x55')][_0x50cb('0x21')];return db[_0x50cb('0x34')][_0x50cb('0x2e')]({'where':{'id':_0xea9922[_0x50cb('0x50')]['id']}})[_0x50cb('0x20')](handleEntityNotFound(_0x2ad0bd,null))['then'](saveUpdates(_0xea9922[_0x50cb('0x55')],null))['then'](respondWithResult(_0x2ad0bd,null))[_0x50cb('0x4f')](handleError(_0x2ad0bd,null));};exports[_0x50cb('0x56')]=function(_0x59ba86,_0x1dc7a9){return db['User'][_0x50cb('0x56')]()['then'](respondWithResult(_0x1dc7a9,null))['catch'](handleError(_0x1dc7a9,null));};exports['addContacts']=function(_0x2be935,_0x4c70d5){return db[_0x50cb('0x34')][_0x50cb('0x2e')]({'where':{'id':_0x2be935[_0x50cb('0x50')]['id']}})[_0x50cb('0x20')](handleEntityNotFound(_0x4c70d5,null))[_0x50cb('0x20')](function(_0x4cc5e0){if(_0x4cc5e0){return _0x4cc5e0['addContacts'](_0x2be935[_0x50cb('0x55')][_0x50cb('0x57')],_['omit'](_0x2be935[_0x50cb('0x55')],[_0x50cb('0x57'),'id'])||{});}})[_0x50cb('0x20')](respondWithResult(_0x4c70d5,null))[_0x50cb('0x4f')](handleError(_0x4c70d5,null));};function validateUser(_0x23fe2c){return new Promise(function(_0x477fcb,_0x4d2e8d){if(_0x23fe2c[_0x50cb('0x58')])return _0x477fcb(_0x23fe2c);return db['Setting'][_0x50cb('0x59')](0x1)['then'](function(_0x4cee44){if(_0x4cee44[_0x50cb('0x5a')])authService[_0x50cb('0x5b')](_0x23fe2c['password']);db[_0x50cb('0x34')]['max']('internal')[_0x50cb('0x20')](function(_0x1a803a){if(_[_0x50cb('0x5c')](_0x1a803a)){_0x23fe2c[_0x50cb('0x58')]=_0x4cee44[_0x50cb('0x5d')]||0x1;return;}if(_[_0x50cb('0x5c')](_0x4cee44['min_internal'])||_0x4cee44[_0x50cb('0x5d')]===_0x1a803a){_0x23fe2c['internal']=_0x1a803a+0x1;return;}if(_0x4cee44[_0x50cb('0x5d')]>_0x1a803a){_0x23fe2c[_0x50cb('0x58')]=_0x4cee44['min_internal'];return;}return db['sequelize'][_0x50cb('0x42')](_0x50cb('0x5e'),{'type':db[_0x50cb('0x5f')][_0x50cb('0x60')]['SELECT']})['then'](function(_0x4a8512){if(_0x4a8512&&_0x4a8512[_0x50cb('0x49')]){for(var _0x324c38=0x0,_0x185978=_0x4a8512[_0x50cb('0x49')];_0x324c38<_0x185978&&_[_0x50cb('0x5c')](_0x23fe2c[_0x50cb('0x58')]);_0x324c38++){if(_0x4cee44[_0x50cb('0x5d')]<=_0x4a8512[_0x324c38][_0x50cb('0x61')]){_0x23fe2c['internal']=_0x4a8512[_0x324c38][_0x50cb('0x61')];}else if(_0x4cee44[_0x50cb('0x5d')]>_0x4a8512[_0x324c38]['from']&&_0x4cee44['min_internal']<=_0x4a8512[_0x324c38]['to']){_0x23fe2c['internal']=_0x4cee44[_0x50cb('0x5d')];}}}if(_[_0x50cb('0x5c')](_0x23fe2c[_0x50cb('0x58')])){_0x23fe2c[_0x50cb('0x58')]=_0x1a803a+0x1;}return _0x477fcb(_0x23fe2c);});});})['catch'](function(_0x1c01c2){_0x4d2e8d(_0x1c01c2);});});}function updateUser(_0x26eeb3){return new Promise(function(_0x22d078,_0x2f2383){try{if(_0x26eeb3[_0x50cb('0x62')]){_0x26eeb3[_0x50cb('0x63')]=_0x26eeb3[_0x50cb('0x58')];_0x26eeb3[_0x50cb('0x64')]={'mailbox':_0x26eeb3[_0x50cb('0x58')],'password':_0x26eeb3[_0x50cb('0x65')],'fullname':_0x26eeb3[_0x50cb('0x66')],'email':_0x26eeb3[_0x50cb('0x67')]};}if(_0x26eeb3['role']===_0x50cb('0x22')){if(!_0x26eeb3[_0x50cb('0x68')])_0x26eeb3['permissions']=[_0x50cb('0x69'),_0x50cb('0x6a'),_0x50cb('0x6b'),'113',_0x50cb('0x6c'),_0x50cb('0x6d'),_0x50cb('0x6e'),_0x50cb('0x6f'),'107',_0x50cb('0x70'),_0x50cb('0x71'),_0x50cb('0x72'),_0x50cb('0x73'),_0x50cb('0x74'),_0x50cb('0x75')];}_0x22d078(_0x26eeb3);}catch(_0x55978b){_0x2f2383(_0x55978b);}});}exports['create']=function(_0x240045,_0x487122){if(_0x240045['user']['role']==='agent')throw new Error('Unauthorized');if(_0x240045['body'][_0x50cb('0x21')]===_0x50cb('0x27')&&_0x240045[_0x50cb('0x27')]['role']!==_0x50cb('0x25')){throw new Error(_0x50cb('0x76'));}if(_0x240045[_0x50cb('0x55')][_0x50cb('0x21')]===_0x50cb('0x25')&&_0x240045[_0x50cb('0x27')][_0x50cb('0x21')]!==_0x50cb('0x25')){throw new Error(_0x50cb('0x77'));}return licenseUtil[_0x50cb('0x78')]([_0x240045[_0x50cb('0x55')]])[_0x50cb('0x20')](function(){return validateUser(_0x240045[_0x50cb('0x55')]);})[_0x50cb('0x20')](function(_0xed6841){return updateUser(_0xed6841)['then'](function(_0x28b7fb){if(_0x28b7fb['role']===_0x50cb('0x25')){_0x28b7fb[_0x50cb('0x79')]=_0x240045['user'][_0x50cb('0x79')];delete _0x28b7fb[_0x50cb('0x7a')];}return _0x28b7fb;});})[_0x50cb('0x20')](function(_0x167913){return db[_0x50cb('0x34')][_0x50cb('0x7b')](_0x167913,{'include':[{'model':db[_0x50cb('0x64')],'as':'VoiceMail'}]});})['then'](function(_0xa088cf){if(_0x240045['body']['role']===_0x50cb('0x27'))return _0xa088cf;if(_0x240045['user'][_0x50cb('0x21')]!==_0x50cb('0x27'))return _0xa088cf;return db[_0x50cb('0x7c')][_0x50cb('0x2e')]({'where':{'name':_0xa088cf[_0x50cb('0x21')]===_0x50cb('0x22')?'Agents':_0x50cb('0x28'),'userProfileId':_0x240045[_0x50cb('0x27')][_0x50cb('0x7a')]},'raw':!![]})['then'](function(_0x104b82){if(!_0x104b82||_0x104b82[_0x50cb('0x7d')]!=0x0)return _0xa088cf;return db[_0x50cb('0x2f')]['create']({'name':_0xa088cf[_0x50cb('0x33')],'resourceId':_0xa088cf['id'],'type':_0x104b82[_0x50cb('0x33')],'sectionId':_0x104b82['id']},{})[_0x50cb('0x20')](function(){return _0xa088cf;});})[_0x50cb('0x4f')](function(_0x3c575e){logger['error'](_0x50cb('0x7e'),_0x3c575e);throw _0x3c575e;});})[_0x50cb('0x20')](respondWithResult(_0x487122,0xc9))['catch'](handleError(_0x487122,null));};exports[_0x50cb('0x7f')]=function(_0xf7dd0f,_0x221444){var _0x1b8a99=_0xf7dd0f[_0x50cb('0x55')];var _0x4d6e1c=[];if(_0xf7dd0f[_0x50cb('0x27')][_0x50cb('0x21')]===_0x50cb('0x22'))throw new Error(_0x50cb('0x80'));if(_[_0x50cb('0x81')](_0x1b8a99,['role','user'])&&_0xf7dd0f['user']['role']!==_0x50cb('0x25')){throw new Error(_0x50cb('0x76'));}if(_['some'](_0x1b8a99,[_0x50cb('0x21'),_0x50cb('0x25')])&&_0xf7dd0f[_0x50cb('0x27')][_0x50cb('0x21')]!==_0x50cb('0x25')){throw new Error(_0x50cb('0x82'));}return licenseUtil[_0x50cb('0x78')](_0x1b8a99)[_0x50cb('0x20')](function(){return validateUser(_0x1b8a99[0x0]);})[_0x50cb('0x20')](function(){for(var _0x1cc82f=0x1;_0x1cc82f<_0x1b8a99[_0x50cb('0x49')];_0x1cc82f++){var _0x4619ea=_0x1b8a99[_0x1cc82f-0x1]['internal'];if(!_0x1b8a99[_0x1cc82f]['internal'])_0x1b8a99[_0x1cc82f][_0x50cb('0x58')]=_0x4619ea+0x1;_0x4d6e1c['push'](validateUser(_0x1b8a99[_0x1cc82f]));}return Promise[_0x50cb('0x54')](_0x4d6e1c);})[_0x50cb('0x20')](function(){_0x4d6e1c=[];for(var _0x3a6db6=0x0;_0x3a6db6<_0x1b8a99['length'];_0x3a6db6++){_0x4d6e1c[_0x50cb('0x46')](updateUser(_0x1b8a99[_0x3a6db6]));}return Promise[_0x50cb('0x54')](_0x4d6e1c);})['then'](function(){_0x4d6e1c=_0x1b8a99[_0x50cb('0x2b')](function(_0x50e4bd){return db[_0x50cb('0x34')][_0x50cb('0x7b')](_0x50e4bd,{'include':[{'model':db[_0x50cb('0x64')],'as':'VoiceMail'}]})[_0x50cb('0x20')](function(_0xada8e7){_0x50e4bd['id']=_0xada8e7['id'];return _0x50e4bd;});});return Promise[_0x50cb('0x54')](_0x4d6e1c);})[_0x50cb('0x20')](function(_0x2ab7e0){if(_0xf7dd0f[_0x50cb('0x55')][_0x50cb('0x21')]===_0x50cb('0x27'))return _0x2ab7e0;if(_0xf7dd0f[_0x50cb('0x27')][_0x50cb('0x21')]!==_0x50cb('0x27'))return _0x2ab7e0;var _0x53db73=_[_0x50cb('0x81')](_0x2ab7e0,function(_0x4b1526){return _0x4b1526['role']==='agent'||_0x4b1526['role']===_0x50cb('0x83');});if(!_0x53db73)return _0x2ab7e0;return db[_0x50cb('0x7c')]['findAll']({'where':{'name':{'$or':['Agents',_0x50cb('0x28')]},'userProfileId':_0xf7dd0f[_0x50cb('0x27')][_0x50cb('0x7a')]},'raw':!![]})['then'](function(_0x3d7889){if(_[_0x50cb('0x84')](_0x3d7889)||!_[_0x50cb('0x81')](_0x3d7889,[_0x50cb('0x7d'),0x0]))return _0x2ab7e0;_0x4d6e1c=[];var _0x2b7db9=_(_0x3d7889)[_0x50cb('0x2b')](function(_0x5db247){if(_0x5db247[_0x50cb('0x7d')]===0x1)return;return _0x5db247[_0x50cb('0x33')]==='Agents'?_0x50cb('0x22'):_0x50cb('0x83');})[_0x50cb('0x85')]()[_0x50cb('0x2c')]();for(var _0x511d37=0x0;_0x511d37<_0x2ab7e0['length'];_0x511d37++){if(!_['includes'](_0x2b7db9,_0x2ab7e0[_0x511d37][_0x50cb('0x21')]))return;var _0x4e2560=_0x2ab7e0[_0x511d37]['role']===_0x50cb('0x22')?_0x50cb('0x86'):'Telephones';_0x4d6e1c['push'](db[_0x50cb('0x2f')][_0x50cb('0x7b')]({'name':_0x2ab7e0[_0x511d37][_0x50cb('0x33')],'resourceId':_0x2ab7e0[_0x511d37]['id'],'type':_0x4e2560,'sectionId':_[_0x50cb('0x2e')](_0x3d7889,[_0x50cb('0x33'),_0x4e2560])['id']},{}));}return Promise[_0x50cb('0x54')](_0x4d6e1c);});})[_0x50cb('0x20')](respondWithResult(_0x221444,0xc9))[_0x50cb('0x4f')](handleError(_0x221444,null));};exports[_0x50cb('0x87')]=function(_0x431289,_0x500df1){if(_0x431289[_0x50cb('0x55')]['id']){delete _0x431289[_0x50cb('0x55')]['id'];}return db[_0x50cb('0x34')][_0x50cb('0x2e')]({'where':{'id':_0x431289[_0x50cb('0x50')]['id']}})[_0x50cb('0x20')](function(_0x51a4a6){if(!_0x51a4a6)return null;if(_0x51a4a6['id']===_0x431289[_0x50cb('0x27')]['id']){if(!_0x431289['body']['oldPassword']||!_0x431289[_0x50cb('0x55')]['newPassword']){throw new db['Sequelize'][(_0x50cb('0x88'))](_0x50cb('0x89'));}if(!_0x51a4a6[_0x50cb('0x8a')](_0x431289[_0x50cb('0x55')][_0x50cb('0x8b')])){throw new db[(_0x50cb('0x8c'))][(_0x50cb('0x88'))]('Wrong\x20credentials');}if(_0x431289['body'][_0x50cb('0x8b')]===_0x431289[_0x50cb('0x55')]['newPassword']){throw new db[(_0x50cb('0x8c'))][(_0x50cb('0x88'))](_0x50cb('0x8d'));}}else if(_0x431289[_0x50cb('0x27')]['role']===_0x50cb('0x25')){if(!_0x431289['body']['newPassword']){throw new db[(_0x50cb('0x8c'))]['ValidationError']('Invalid\x20body\x20format.\x20Use\x20newPassword');}}else if(_0x431289[_0x50cb('0x27')][_0x50cb('0x21')]===_0x50cb('0x27')){if(!_0x431289[_0x50cb('0x55')]['newPassword']){throw new db[(_0x50cb('0x8c'))][(_0x50cb('0x88'))](_0x50cb('0x8e'));}if(_0x51a4a6[_0x50cb('0x21')]!==_0x50cb('0x22')){throw new db[(_0x50cb('0x8c'))][(_0x50cb('0x88'))](_0x50cb('0x80'));}}else{throw new db['Sequelize'][(_0x50cb('0x88'))]('Unauthorized');}return _0x51a4a6;})[_0x50cb('0x20')](handleEntityNotFound(_0x500df1,null))[_0x50cb('0x20')](function(_0x26a30d){return db['Setting'][_0x50cb('0x8f')]({'attributes':['id','securePassword',_0x50cb('0x90'),_0x50cb('0x91')]})['then'](function(_0x1f91b2){if(_0x1f91b2[_0x50cb('0x5a')])authService[_0x50cb('0x5b')](_0x431289['body'][_0x50cb('0x92')]);if(!_0x1f91b2[_0x50cb('0x90')]||!_0x26a30d[_0x50cb('0x93')])return _0x26a30d;authService[_0x50cb('0x94')](_0x431289['body']['newPassword'],_0x26a30d[_0x50cb('0x93')],_0x1f91b2[_0x50cb('0x91')]);return _0x26a30d;})['then'](saveUpdates({'password':_0x431289[_0x50cb('0x55')][_0x50cb('0x92')],'passwordResetAt':_0x431289[_0x50cb('0x27')]['id']==_0x431289[_0x50cb('0x50')]['id']?moment():null,'previousPasswords':authService[_0x50cb('0x95')](_0x431289['body'][_0x50cb('0x92')],_0x26a30d['previousPasswords'])},null));})['then'](respondWithResult(_0x500df1,null))[_0x50cb('0x4f')](handleError(_0x500df1,null));};exports[_0x50cb('0x96')]=function(_0x246428,_0x5aeb33){var _0x5e0da1=_0x246428[_0x50cb('0x55')][_0x50cb('0x97')];return db['User'][_0x50cb('0x2e')]({'where':{'id':_0x246428[_0x50cb('0x50')]['id']},'attributes':['id',_0x50cb('0x33'),_0x50cb('0x21'),_0x50cb('0x98'),_0x50cb('0x99'),_0x50cb('0x9a'),_0x50cb('0x9b')]})[_0x50cb('0x20')](handleEntityNotFound(_0x5aeb33,null))['then'](function(_0x3ff5a1){if(_0x3ff5a1){if(!utils[_0x50cb('0x9c')](_0x5e0da1)){throw new db[(_0x50cb('0x8c'))][(_0x50cb('0x88'))](_0x50cb('0x9d'));}return _0x3ff5a1['add'+_['capitalize'](_0x5e0da1['toLowerCase']())+_0x50cb('0x9e')](_0x246428[_0x50cb('0x55')][_0x50cb('0x57')],{'penalty':_0x246428[_0x50cb('0x55')][_0x50cb('0x9f')]||0x0})['spread'](function(_0x3da258){for(var _0x2d76da=0x0;_0x2d76da<_0x246428[_0x50cb('0x55')][_0x50cb('0x57')][_0x50cb('0x49')];_0x2d76da+=0x1){var _0x36ce53={'UserId':Number(_0x246428[_0x50cb('0x50')]['id'])};_0x36ce53[_[_0x50cb('0xa0')](_0x5e0da1[_0x50cb('0xa1')]())+'QueueId']=Number(_0x246428[_0x50cb('0x55')]['ids'][_0x2d76da]);socket[_0x50cb('0xa2')](_0x50cb('0x27')+_[_0x50cb('0xa0')](_0x5e0da1[_0x50cb('0xa1')]())+_0x50cb('0xa3'),_0x36ce53);}return _0x3da258;})[_0x50cb('0x20')](function(){if(_0x5e0da1===_0x50cb('0xa4')){return db['VoiceQueue'][_0x50cb('0xa5')]({'where':{'id':_0x246428['body'][_0x50cb('0x57')]||[]},'raw':!![],'attributes':['id',_0x50cb('0x33')]});}})[_0x50cb('0x20')](function(_0x3e6ff7){var _0xcb025=_0x3ff5a1[_0x50cb('0x24')]({'plain':!![]});var _0x196607=[];if(_0x5e0da1===_0x50cb('0xa4')&&_0xcb025['role']===_0x50cb('0x22')&&_0xcb025[_0x50cb('0x98')]){for(let _0x1bc2c2=0x0;_0x1bc2c2<_0x3e6ff7[_0x50cb('0x49')];_0x1bc2c2+=0x1){_0x196607[_0x50cb('0x46')]({'membername':_0xcb025[_0x50cb('0x33')],'UserId':_0xcb025['id'],'queue_name':_0x3e6ff7[_0x1bc2c2][_0x50cb('0x33')],'VoiceQueueId':_0x3e6ff7[_0x1bc2c2]['id'],'interface':_[_0x50cb('0x5c')](_0xcb025['interface'])?util[_0x50cb('0xa6')](_0x50cb('0xa7'),_0xcb025['name']):_0xcb025[_0x50cb('0x9b')],'paused':_0xcb025[_0x50cb('0x9a')]||![],'penalty':_0x246428[_0x50cb('0x55')][_0x50cb('0x9f')]||0x0});}return Promise[_0x50cb('0x54')](_0x196607['map'](function(_0x4cbdbf){return db[_0x50cb('0xa8')][_0x50cb('0xa9')](_0x4cbdbf);}));}return _0x3ff5a1;});}})[_0x50cb('0x20')](respondWithStatusCode(_0x5aeb33,null))[_0x50cb('0x4f')](handleError(_0x5aeb33,null));};exports['removeQueues']=function(_0x6237cf,_0x4d54e7){var _0xeb973c,_0x2808cd;return db[_0x50cb('0x34')][_0x50cb('0x2e')]({'where':{'id':_0x6237cf[_0x50cb('0x50')]['id']},'attributes':['id',_0x50cb('0x33'),_0x50cb('0x21')]})[_0x50cb('0x20')](handleEntityNotFound(_0x4d54e7,null))[_0x50cb('0x20')](function(_0x3eff3f){if(_0x3eff3f){_0xeb973c=_0x3eff3f;if(!_0x6237cf[_0x50cb('0x42')][_0x50cb('0x97')]||!utils[_0x50cb('0x9c')](_0x6237cf[_0x50cb('0x42')][_0x50cb('0x97')])){throw new db[(_0x50cb('0x8c'))]['ValidationError'](_0x50cb('0x9d'));}return _0x3eff3f[_0x50cb('0xaa')+_[_0x50cb('0xa0')](_0x6237cf[_0x50cb('0x42')][_0x50cb('0x97')][_0x50cb('0xa1')]())+_0x50cb('0x9e')](_0x6237cf['query'][_0x50cb('0x57')]);}})['then'](function(_0x117640){if(_['isArray'](_0x6237cf[_0x50cb('0x42')][_0x50cb('0x57')])){for(var _0x3de6fd=0x0;_0x3de6fd<_0x6237cf['query'][_0x50cb('0x57')][_0x50cb('0x49')];_0x3de6fd+=0x1){_0x2808cd={'UserId':Number(_0x6237cf[_0x50cb('0x50')]['id'])};_0x2808cd[_[_0x50cb('0xa0')](_0x6237cf[_0x50cb('0x42')]['channel'][_0x50cb('0xa1')]())+_0x50cb('0xab')]=Number(_0x6237cf['query']['ids'][_0x3de6fd]);socket['emit'](_0x50cb('0x27')+_['capitalize'](_0x6237cf[_0x50cb('0x42')][_0x50cb('0x97')][_0x50cb('0xa1')]())+_0x50cb('0xac'),_0x2808cd);}}else{_0x2808cd={'UserId':Number(_0x6237cf['params']['id'])};_0x2808cd[_['capitalize'](_0x6237cf[_0x50cb('0x42')]['channel'][_0x50cb('0xa1')]())+_0x50cb('0xab')]=Number(_0x6237cf[_0x50cb('0x42')][_0x50cb('0x57')]);socket[_0x50cb('0xa2')](_0x50cb('0x27')+_['capitalize'](_0x6237cf['query']['channel'][_0x50cb('0xa1')]())+_0x50cb('0xac'),_0x2808cd);}return _0x117640;})[_0x50cb('0x20')](function(){if(_0x6237cf['query'][_0x50cb('0x97')]===_0x50cb('0xa4')){return db['UserVoiceQueueRt']['destroy']({'where':{'UserId':_0x6237cf[_0x50cb('0x50')]['id'],'VoiceQueueId':_0x6237cf['query'][_0x50cb('0x57')]},'individualHooks':!![]})[_0x50cb('0x20')](function(){return _0xeb973c;});}return _0xeb973c;})[_0x50cb('0x20')](respondWithStatusCode(_0x4d54e7,null))[_0x50cb('0x4f')](handleError(_0x4d54e7,null));};exports['addAvatar']=function(_0x346ed6,_0xdae161){_0x346ed6['body'][_0x50cb('0xad')]=_0x346ed6['file']['filename'];return db['User'][_0x50cb('0x2e')]({'where':{'id':_0x346ed6[_0x50cb('0x50')]['id']}})[_0x50cb('0x20')](handleEntityNotFound(_0xdae161,null))[_0x50cb('0x20')](saveUpdates(_0x346ed6[_0x50cb('0x55')],null))[_0x50cb('0x20')](respondWithResult(_0xdae161,null))[_0x50cb('0x4f')](handleError(_0xdae161,null));};exports[_0x50cb('0xae')]=function(_0x24b2f2,_0x48bf2e){var _0x276459=path[_0x50cb('0xaf')](config[_0x50cb('0xb0')],_0x50cb('0xb1'));return db[_0x50cb('0x34')]['find']({'where':{'id':_0x24b2f2['params']['id']},'attributes':['id',_0x50cb('0xad')],'raw':!![]})[_0x50cb('0x20')](handleEntityNotFound(_0x48bf2e,null))[_0x50cb('0x20')](function(_0x51d469){if(_0x51d469){if(_[_0x50cb('0x5c')](_0x51d469[_0x50cb('0xad')])){return _0x48bf2e[_0x50cb('0xb2')](_0x276459);}else{if(!fs['existsSync'](path[_0x50cb('0xaf')](config[_0x50cb('0xb0')],_0x50cb('0xb3'),_0x51d469[_0x50cb('0xad')]))){return _0x48bf2e[_0x50cb('0xb2')](_0x276459);}return _0x48bf2e[_0x50cb('0xb2')](path['join'](config[_0x50cb('0xb0')],_0x50cb('0xb3'),_0x51d469[_0x50cb('0xad')]));}}})['catch'](handleError(_0x48bf2e,null));};exports[_0x50cb('0xb4')]=function(_0x4e4085,_0x1a9397){return db[_0x50cb('0x34')][_0x50cb('0x2e')]({'where':{'id':_0x4e4085[_0x50cb('0x50')]['id']},'attributes':['id']})[_0x50cb('0x20')](handleEntityNotFound(_0x1a9397,null))[_0x50cb('0x20')](function(_0x123430){var _0x1d3244=[];values=_0x123430[_0x50cb('0x4b')];_0x1d3244[_0x50cb('0x46')](get_open_tabs(_0x50cb('0x4a'),_0x123430[_0x50cb('0x4b')]));_0x1d3244[_0x50cb('0x46')](get_open_tabs(_0x50cb('0x4c'),_0x123430[_0x50cb('0x4b')]));_0x1d3244['push'](get_open_tabs(_0x50cb('0x4d'),_0x123430[_0x50cb('0x4b')]));_0x1d3244['push'](get_open_tabs(_0x50cb('0x4e'),_0x123430[_0x50cb('0x4b')]));_0x1d3244[_0x50cb('0x46')](get_open_tabs(_0x50cb('0x52'),_0x123430[_0x50cb('0x4b')]));_0x1d3244[_0x50cb('0x46')](get_open_tabs(_0x50cb('0x53'),_0x123430[_0x50cb('0x4b')]));return Promise[_0x50cb('0x54')](_0x1d3244);})[_0x50cb('0x20')](function(_0x1e3e0a){if(_0x1e3e0a){var _0x4e4db5=_[_0x50cb('0x2b')](values[_0x50cb('0xb5')],function(_0x215595){return{'channel':_0x50cb('0xb6'),'id':_0x215595['id'],'createdAt':_0x215595['createdAt']};});var _0x1a63d4=_[_0x50cb('0x2b')](values[_0x50cb('0xb7')],function(_0x55a7ae){return{'channel':'FAX','id':_0x55a7ae['id'],'createdAt':_0x55a7ae[_0x50cb('0xb8')]};});var _0x3464e3=_['map'](values['OpenchannelOpenTabs'],function(_0x30ac72){return{'channel':'OPENCHANNEL','id':_0x30ac72['id'],'createdAt':_0x30ac72['createdAt']};});var _0xb6a7=_['map'](values['MailOpenTabs'],function(_0xca44a9){return{'channel':_0x50cb('0xb9'),'id':_0xca44a9['id'],'createdAt':_0xca44a9['createdAt']};});var _0x8f1ac8=_[_0x50cb('0x2b')](values['SmsOpenTabs'],function(_0x2fc79e){return{'channel':_0x50cb('0xba'),'id':_0x2fc79e['id'],'createdAt':_0x2fc79e[_0x50cb('0xb8')]};});var _0xa9c1ed=_[_0x50cb('0x2b')](values[_0x50cb('0xbb')],function(_0x3bf8a2){return{'channel':'WHATSAPP','id':_0x3bf8a2['id'],'createdAt':_0x3bf8a2['createdAt']};});var _0xc1187=_[_0x50cb('0xbc')](_0x4e4db5,_0x1a63d4,_0x3464e3,_0xb6a7,_0x8f1ac8,_0xa9c1ed);var _0x48d79c={'count':_0xc1187[_0x50cb('0x49')],'rows':_0xc1187};return _0x48d79c;}else return null;})[_0x50cb('0x20')](respondWithResult(_0x1a9397,null))[_0x50cb('0x4f')](handleError(_0x1a9397,null));};exports[_0x50cb('0xbd')]=function(_0x1051bc,_0x1ba447){var _0x5c6273={};return db[_0x50cb('0x34')][_0x50cb('0x8f')]({'where':{'id':_0x1051bc[_0x50cb('0x50')]['id']}})[_0x50cb('0x20')](function(_0x106220){if(!_0x106220){throw new APINotFoundError(util['format']('User\x20with\x20id\x20%s\x20not\x20found',_0x1051bc[_0x50cb('0x50')]['id']));}return contacts[_0x50cb('0x56')]();})[_0x50cb('0x20')](function(_0x51789f){_0x1051bc[_0x50cb('0x42')]['User']=_0x1051bc['params']['id'];_0x5c6273=qs[_0x50cb('0x3e')](_0x51789f,_0x1051bc);if(_0x1051bc['query'][_0x50cb('0xbe')](_0x50cb('0x40'))){_0x5c6273[_0x50cb('0x41')]=[{'model':db[_0x50cb('0xbf')],'as':_0x50cb('0xc0'),'required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0x50cb('0x33'),'color'],'where':_0x1051bc[_0x50cb('0x42')]['tag']?{'id':_0x1051bc[_0x50cb('0x42')][_0x50cb('0xc1')]}:undefined,'required':_0x1051bc['query'][_0x50cb('0xc1')]?!![]:![]}];}return contacts[_0x50cb('0xa5')](_0x1051bc[_0x50cb('0x42')],_0x1051bc[_0x50cb('0x27')],_0x5c6273,_0x51789f);})['then'](respondWithFilteredResult(_0x1ba447,_0x5c6273))[_0x50cb('0x4f')](APIHandleError(_0x1ba447));};exports[_0x50cb('0xc2')]=function(_0x2dd94f,_0x1944d2){var _0x348053;var _0xe3e4ab={};var _0x1a2015;return db[_0x50cb('0x34')][_0x50cb('0x8f')]({'where':{'id':_0x2dd94f[_0x50cb('0x50')]['id']},'attributes':['id',_0x50cb('0x33'),_0x50cb('0x21')]})[_0x50cb('0x20')](handleEntityNotFound(_0x1944d2,null))[_0x50cb('0x20')](function(_0x308e85){if(!utils[_0x50cb('0x9c')](_0x2dd94f[_0x50cb('0x42')]['channel'])){throw new db[(_0x50cb('0x8c'))][(_0x50cb('0x88'))](_0x50cb('0x9d'));}_0x348053=_0x308e85;var _0x2675b7={};_0x2675b7['model']=_[_0x50cb('0xc3')](db[_['capitalize'](_0x2dd94f['query'][_0x50cb('0x97')])+_0x50cb('0xc4')][_0x50cb('0x35')]);_0x2675b7['query']=_[_0x50cb('0xc3')](_0x2dd94f[_0x50cb('0x42')]);_0x2675b7['filters']=_[_0x50cb('0xc5')](_0x2675b7[_0x50cb('0xc6')],_0x2675b7[_0x50cb('0x42')]);_0xe3e4ab[_0x50cb('0x45')]=_[_0x50cb('0xc5')](_0x2675b7['model'],qs[_0x50cb('0xc7')](_0x2dd94f['query'][_0x50cb('0xc7')]));_0xe3e4ab[_0x50cb('0x45')]=_0xe3e4ab[_0x50cb('0x45')]['length']?_0xe3e4ab[_0x50cb('0x45')]:_0x2675b7['model'];_0xe3e4ab[_0x50cb('0xc8')]=qs[_0x50cb('0xc9')](_0x2dd94f[_0x50cb('0x42')][_0x50cb('0xc9')]);_0xe3e4ab[_0x50cb('0x3f')]=qs[_0x50cb('0xca')](_[_0x50cb('0xcb')](_0x2dd94f[_0x50cb('0x42')],_0x2675b7['filters']));if(_0x2dd94f[_0x50cb('0x42')][_0x50cb('0x29')]){_0xe3e4ab['where']=_[_0x50cb('0x51')](_0xe3e4ab[_0x50cb('0x3f')],{'$or':_[_0x50cb('0x2b')](_0xe3e4ab[_0x50cb('0x45')],function(_0x31651f){var _0x43d306={};_0x43d306[_0x31651f]={'$like':'%'+_0x2dd94f[_0x50cb('0x42')][_0x50cb('0x29')]+'%'};return _0x43d306;})});}_0xe3e4ab=_[_0x50cb('0x51')]({},_0xe3e4ab,_0x2dd94f[_0x50cb('0xcc')]);switch(_0x348053['role']){case _0x50cb('0x25'):return db[_[_0x50cb('0xa0')](_0x2dd94f[_0x50cb('0x42')][_0x50cb('0x97')])+_0x50cb('0xc4')][_0x50cb('0xa5')](_0xe3e4ab);case _0x50cb('0x27'):case'agent':return _0x348053[_0x50cb('0x24')+_['capitalize'](_0x2dd94f[_0x50cb('0x42')]['channel'])+_0x50cb('0x9e')](_0xe3e4ab);default:throw new db[(_0x50cb('0x8c'))][(_0x50cb('0x88'))](_0x50cb('0xcd'));}})['then'](function(_0x314497){_0x1a2015=_0x314497['length'];if(!_0x2dd94f['query'][_0x50cb('0xbe')]('nolimit')){_0xe3e4ab[_0x50cb('0x1b')]=qs[_0x50cb('0x1b')](_0x2dd94f[_0x50cb('0x42')][_0x50cb('0x1b')]);_0xe3e4ab[_0x50cb('0x19')]=qs[_0x50cb('0x19')](_0x2dd94f[_0x50cb('0x42')]['offset']);}switch(_0x348053[_0x50cb('0x21')]){case'admin':return db[_[_0x50cb('0xa0')](_0x2dd94f[_0x50cb('0x42')][_0x50cb('0x97')])+_0x50cb('0xc4')]['findAll'](_0xe3e4ab);case _0x50cb('0x27'):case'agent':return _0x348053[_0x50cb('0x24')+_[_0x50cb('0xa0')](_0x2dd94f['query'][_0x50cb('0x97')])+_0x50cb('0x9e')](_0xe3e4ab);}})[_0x50cb('0x20')](function(_0x250112){return{'count':_0x1a2015,'rows':_0x250112};})[_0x50cb('0x20')](respondWithResult(_0x1944d2,null))[_0x50cb('0x4f')](handleError(_0x1944d2,null));};exports[_0x50cb('0xce')]=function(_0x229612,_0x7a1993){var _0x30e572={};var _0x50b1b1={};var _0x53121d;var _0x516f3c;return db[_0x50cb('0x34')]['findOne']({'where':{'id':_0x229612[_0x50cb('0x50')]['id']}})[_0x50cb('0x20')](handleEntityNotFound(_0x7a1993,null))[_0x50cb('0x20')](function(_0x5d1713){if(_0x5d1713){_0x53121d=_0x5d1713;_0x50b1b1[_0x50cb('0xc6')]=_['keys'](db[_0x50cb('0xa8')][_0x50cb('0x35')]);_0x50b1b1[_0x50cb('0x42')]=_[_0x50cb('0xc3')](_0x229612[_0x50cb('0x42')]);_0x50b1b1['filters']=_[_0x50cb('0xc5')](_0x50b1b1['model'],_0x50b1b1[_0x50cb('0x42')]);_0x30e572['attributes']=_['intersection'](_0x50b1b1[_0x50cb('0xc6')],qs[_0x50cb('0xc7')](_0x229612[_0x50cb('0x42')][_0x50cb('0xc7')]));_0x30e572[_0x50cb('0x45')]=_0x30e572[_0x50cb('0x45')][_0x50cb('0x49')]?_0x30e572[_0x50cb('0x45')]:_0x50b1b1[_0x50cb('0xc6')];_0x30e572[_0x50cb('0xc8')]=qs[_0x50cb('0xc9')](_0x229612[_0x50cb('0x42')][_0x50cb('0xc9')]);_0x30e572[_0x50cb('0x3f')]=qs[_0x50cb('0xca')](_[_0x50cb('0xcb')](_0x229612['query'],_0x50b1b1[_0x50cb('0xca')]));if(_0x229612[_0x50cb('0x42')][_0x50cb('0x29')]){_0x30e572[_0x50cb('0x3f')]=_['merge'](_0x30e572[_0x50cb('0x3f')],{'$or':_[_0x50cb('0x2b')](_0x30e572[_0x50cb('0x45')],function(_0x3d5f41){var _0x1ce7e2={};_0x1ce7e2[_0x3d5f41]={'$like':'%'+_0x229612['query'][_0x50cb('0x29')]+'%'};return _0x1ce7e2;})});}_0x30e572=_[_0x50cb('0x51')]({},_0x30e572,_0x229612['options']);return _0x53121d[_0x50cb('0xce')](_0x30e572);}})[_0x50cb('0x20')](function(_0x24453f){if(_0x24453f){_0x516f3c=_0x24453f[_0x50cb('0x49')];if(!_0x229612['query']['hasOwnProperty'](_0x50cb('0xcf'))){_0x30e572[_0x50cb('0x1b')]=qs['limit'](_0x229612[_0x50cb('0x42')][_0x50cb('0x1b')]);_0x30e572[_0x50cb('0x19')]=qs[_0x50cb('0x19')](_0x229612[_0x50cb('0x42')][_0x50cb('0x19')]);}return _0x53121d['getVoiceQueuesRt'](_0x30e572);}})[_0x50cb('0x20')](function(_0x22e1c1){if(_0x22e1c1){return _0x22e1c1?{'count':_0x516f3c,'rows':_0x22e1c1}:null;}})[_0x50cb('0x20')](respondWithResult(_0x7a1993,null))[_0x50cb('0x4f')](handleError(_0x7a1993,null));};exports['getGroups']=function(_0x1cff71,_0x11f0c8){var _0x35a7e1={};var _0x50d232={};var _0x1b34a8;var _0x7793db;return db[_0x50cb('0x34')]['findOne']({'where':{'id':_0x1cff71[_0x50cb('0x50')]['id']}})['then'](handleEntityNotFound(_0x11f0c8,null))[_0x50cb('0x20')](function(_0x5b7ebb){if(_0x5b7ebb){_0x1b34a8=_0x5b7ebb;_0x50d232[_0x50cb('0xc6')]=_[_0x50cb('0xc3')](db['ChatGroup'][_0x50cb('0x35')]);_0x50d232[_0x50cb('0x42')]=_[_0x50cb('0xc3')](_0x1cff71['query']);_0x50d232['filters']=_[_0x50cb('0xc5')](_0x50d232['model'],_0x50d232[_0x50cb('0x42')]);_0x35a7e1[_0x50cb('0x45')]=_[_0x50cb('0xc5')](_0x50d232['model'],qs[_0x50cb('0xc7')](_0x1cff71['query']['fields']));_0x35a7e1[_0x50cb('0x45')]=_0x35a7e1[_0x50cb('0x45')][_0x50cb('0x49')]?_0x35a7e1['attributes']:_0x50d232[_0x50cb('0xc6')];_0x35a7e1[_0x50cb('0xc8')]=qs[_0x50cb('0xc9')](_0x1cff71[_0x50cb('0x42')][_0x50cb('0xc9')]);_0x35a7e1[_0x50cb('0x3f')]=qs[_0x50cb('0xca')](_[_0x50cb('0xcb')](_0x1cff71[_0x50cb('0x42')],_0x50d232['filters']));if(_0x1cff71['query'][_0x50cb('0x29')]){_0x35a7e1[_0x50cb('0x3f')]=_[_0x50cb('0x51')](_0x35a7e1['where'],{'$or':_[_0x50cb('0x2b')](_0x35a7e1[_0x50cb('0x45')],function(_0x479b81){var _0xfc1534={};_0xfc1534[_0x479b81]={'$like':'%'+_0x1cff71[_0x50cb('0x42')][_0x50cb('0x29')]+'%'};return _0xfc1534;})});}_0x35a7e1=_[_0x50cb('0x51')]({},_0x35a7e1,_0x1cff71[_0x50cb('0xcc')]);return _0x1b34a8[_0x50cb('0xd0')](_0x35a7e1);}})[_0x50cb('0x20')](function(_0xc63492){if(_0xc63492){_0x7793db=_0xc63492[_0x50cb('0x49')];if(!_0x1cff71[_0x50cb('0x42')]['hasOwnProperty']('nolimit')){_0x35a7e1[_0x50cb('0x1b')]=qs[_0x50cb('0x1b')](_0x1cff71['query'][_0x50cb('0x1b')]);_0x35a7e1['offset']=qs[_0x50cb('0x19')](_0x1cff71[_0x50cb('0x42')][_0x50cb('0x19')]);}return _0x1b34a8[_0x50cb('0xd0')](_0x35a7e1);}})['then'](function(_0x24fa67){if(_0x24fa67){return _0x24fa67?{'count':_0x7793db,'rows':_0x24fa67}:null;}})['then'](respondWithResult(_0x11f0c8,null))[_0x50cb('0x4f')](handleError(_0x11f0c8,null));};exports[_0x50cb('0xd1')]=function(_0x4321c6,_0x1aa904){var _0x4344de={'raw':!![],'where':{}};var _0x4c052e={};var _0x5dc2d4={'count':0x0,'rows':[]};return db['User']['findOne']({'where':{'id':_0x4321c6[_0x50cb('0x50')]['id']}})[_0x50cb('0x20')](handleEntityNotFound(_0x1aa904,null))['then'](function(_0x50a258){if(_0x50a258){_0x4c052e[_0x50cb('0xc6')]=_['keys'](db[_0x50cb('0xd2')][_0x50cb('0x35')]);_0x4c052e[_0x50cb('0x42')]=_[_0x50cb('0xc3')](_0x4321c6[_0x50cb('0x42')]);_0x4c052e[_0x50cb('0xca')]=_[_0x50cb('0xc5')](_0x4c052e[_0x50cb('0xc6')],_0x4c052e[_0x50cb('0x42')]);_0x4344de[_0x50cb('0x45')]=_[_0x50cb('0xc5')](_0x4c052e[_0x50cb('0xc6')],qs[_0x50cb('0xc7')](_0x4321c6['query'][_0x50cb('0xc7')]));_0x4344de['attributes']=_0x4344de[_0x50cb('0x45')][_0x50cb('0x49')]?_0x4344de['attributes']:_0x4c052e[_0x50cb('0xc6')];if(!_0x4321c6[_0x50cb('0x42')]['hasOwnProperty'](_0x50cb('0xcf'))){_0x4344de[_0x50cb('0x1b')]=qs['limit'](_0x4321c6[_0x50cb('0x42')]['limit']);_0x4344de[_0x50cb('0x19')]=qs[_0x50cb('0x19')](_0x4321c6[_0x50cb('0x42')][_0x50cb('0x19')]);}_0x4344de['order']=qs['sort'](_0x4321c6[_0x50cb('0x42')][_0x50cb('0xc9')]);_0x4344de[_0x50cb('0x3f')]=qs[_0x50cb('0xca')](_[_0x50cb('0xcb')](_0x4321c6[_0x50cb('0x42')],_0x4c052e[_0x50cb('0xca')]));_0x4344de[_0x50cb('0x3f')][_0x50cb('0xd3')]=_0x50a258['id'];if(_0x4321c6[_0x50cb('0x42')][_0x50cb('0x29')]){_0x4344de[_0x50cb('0x3f')]=_[_0x50cb('0x51')](_0x4344de[_0x50cb('0x3f')],{'$or':_[_0x50cb('0x2b')](_0x4344de['attributes'],function(_0x446c6c){var _0x2a4b4e={};_0x2a4b4e[_0x446c6c]={'$like':'%'+_0x4321c6[_0x50cb('0x42')][_0x50cb('0x29')]+'%'};return _0x2a4b4e;})});}_0x4344de=_[_0x50cb('0x51')]({},_0x4344de,_0x4321c6['options']);return db[_0x50cb('0xd2')][_0x50cb('0x1c')]({'where':_0x4344de[_0x50cb('0x3f')]})['then'](function(_0x1e5163){_0x5dc2d4[_0x50cb('0x1c')]=_0x1e5163;if(_0x4321c6[_0x50cb('0x42')][_0x50cb('0x40')]){_0x4344de[_0x50cb('0x41')]=[{'all':!![]}];}return db[_0x50cb('0xd2')]['findAll'](_0x4344de);})[_0x50cb('0x20')](function(_0x2640ec){_0x5dc2d4['rows']=_0x2640ec;return _0x5dc2d4;});}})['then'](respondWithFilteredResult(_0x1aa904,_0x4344de))[_0x50cb('0x4f')](handleError(_0x1aa904,null));};exports['getScreenRecordings']=function(_0x5c30bc,_0x25448a){var _0x225f1e={'raw':!![],'where':{}};var _0x38532b={};var _0x5b8287={'count':0x0,'rows':[]};return db['User'][_0x50cb('0x8f')]({'where':{'id':_0x5c30bc[_0x50cb('0x50')]['id']}})[_0x50cb('0x20')](handleEntityNotFound(_0x25448a,null))['then'](function(_0x16465b){if(_0x16465b){_0x38532b['model']=_[_0x50cb('0xc3')](db[_0x50cb('0xd4')][_0x50cb('0x35')]);_0x38532b[_0x50cb('0x42')]=_[_0x50cb('0xc3')](_0x5c30bc[_0x50cb('0x42')]);_0x38532b[_0x50cb('0xca')]=_['intersection'](_0x38532b[_0x50cb('0xc6')],_0x38532b[_0x50cb('0x42')]);_0x225f1e[_0x50cb('0x45')]=_[_0x50cb('0xc5')](_0x38532b[_0x50cb('0xc6')],qs[_0x50cb('0xc7')](_0x5c30bc[_0x50cb('0x42')][_0x50cb('0xc7')]));_0x225f1e[_0x50cb('0x45')]=_0x225f1e[_0x50cb('0x45')][_0x50cb('0x49')]?_0x225f1e['attributes']:_0x38532b['model'];if(!_0x5c30bc['query'][_0x50cb('0xbe')]('nolimit')){_0x225f1e[_0x50cb('0x1b')]=qs[_0x50cb('0x1b')](_0x5c30bc[_0x50cb('0x42')][_0x50cb('0x1b')]);_0x225f1e[_0x50cb('0x19')]=qs[_0x50cb('0x19')](_0x5c30bc[_0x50cb('0x42')][_0x50cb('0x19')]);}_0x225f1e[_0x50cb('0xc8')]=qs[_0x50cb('0xc9')](_0x5c30bc[_0x50cb('0x42')][_0x50cb('0xc9')]);_0x225f1e[_0x50cb('0x3f')]=qs[_0x50cb('0xca')](_[_0x50cb('0xcb')](_0x5c30bc[_0x50cb('0x42')],_0x38532b[_0x50cb('0xca')]));_0x225f1e['where'][_0x50cb('0xd3')]=_0x16465b['id'];if(_0x5c30bc[_0x50cb('0x42')][_0x50cb('0x29')]){_0x225f1e[_0x50cb('0x3f')]=_[_0x50cb('0x51')](_0x225f1e[_0x50cb('0x3f')],{'$or':_[_0x50cb('0x2b')](_0x225f1e[_0x50cb('0x45')],function(_0x2d0382){var _0x5b9c8a={};_0x5b9c8a[_0x2d0382]={'$like':'%'+_0x5c30bc[_0x50cb('0x42')][_0x50cb('0x29')]+'%'};return _0x5b9c8a;})});}_0x225f1e=_[_0x50cb('0x51')]({},_0x225f1e,_0x5c30bc['options']);return db['ScreenRecording'][_0x50cb('0x1c')]({'where':_0x225f1e[_0x50cb('0x3f')]})[_0x50cb('0x20')](function(_0x2a8c40){_0x5b8287[_0x50cb('0x1c')]=_0x2a8c40;if(_0x5c30bc[_0x50cb('0x42')][_0x50cb('0x40')]){_0x225f1e[_0x50cb('0x41')]=[{'all':!![]}];}return db[_0x50cb('0xd4')][_0x50cb('0xa5')](_0x225f1e);})[_0x50cb('0x20')](function(_0x1d117f){_0x5b8287['rows']=_0x1d117f;return _0x5b8287;});}})[_0x50cb('0x20')](respondWithFilteredResult(_0x25448a,_0x225f1e))[_0x50cb('0x4f')](handleError(_0x25448a,null));};exports[_0x50cb('0xd5')]=function(_0x40e74c,_0x353f02){var _0x55578c={};var _0x94c22a={};var _0x4116da;var _0x58899f;return db[_0x50cb('0x34')]['findOne']({'where':{'id':_0x40e74c[_0x50cb('0x50')]['id']}})['then'](handleEntityNotFound(_0x353f02,null))[_0x50cb('0x20')](function(_0x19d248){if(_0x19d248){_0x4116da=_0x19d248;_0x94c22a[_0x50cb('0xc6')]=_[_0x50cb('0xc3')](db[_0x50cb('0xd6')]['rawAttributes']);_0x94c22a['query']=_[_0x50cb('0xc3')](_0x40e74c[_0x50cb('0x42')]);_0x94c22a[_0x50cb('0xca')]=_[_0x50cb('0xc5')](_0x94c22a[_0x50cb('0xc6')],_0x94c22a['query']);_0x55578c[_0x50cb('0x45')]=_['intersection'](_0x94c22a['model'],qs[_0x50cb('0xc7')](_0x40e74c[_0x50cb('0x42')]['fields']));_0x55578c[_0x50cb('0x45')]=_0x55578c[_0x50cb('0x45')][_0x50cb('0x49')]?_0x55578c[_0x50cb('0x45')]:_0x94c22a[_0x50cb('0xc6')];_0x55578c[_0x50cb('0xc8')]=qs[_0x50cb('0xc9')](_0x40e74c[_0x50cb('0x42')][_0x50cb('0xc9')]);_0x55578c[_0x50cb('0x3f')]=qs[_0x50cb('0xca')](_[_0x50cb('0xcb')](_0x40e74c[_0x50cb('0x42')],_0x94c22a[_0x50cb('0xca')]));if(_0x40e74c[_0x50cb('0x42')]['filter']){_0x55578c[_0x50cb('0x3f')]=_[_0x50cb('0x51')](_0x55578c[_0x50cb('0x3f')],{'$or':_[_0x50cb('0x2b')](_0x55578c['attributes'],function(_0x49d0be){var _0x598053={};_0x598053[_0x49d0be]={'$like':'%'+_0x40e74c['query']['filter']+'%'};return _0x598053;})});}_0x55578c=_['merge']({},_0x55578c,_0x40e74c[_0x50cb('0xcc')]);return _0x4116da[_0x50cb('0xd5')](_0x55578c);}})[_0x50cb('0x20')](function(_0x512184){if(_0x512184){_0x58899f=_0x512184[_0x50cb('0x49')];if(!_0x40e74c['query']['hasOwnProperty'](_0x50cb('0xcf'))){_0x55578c[_0x50cb('0x1b')]=qs['limit'](_0x40e74c[_0x50cb('0x42')][_0x50cb('0x1b')]);_0x55578c['offset']=qs[_0x50cb('0x19')](_0x40e74c[_0x50cb('0x42')]['offset']);}return _0x4116da[_0x50cb('0xd5')](_0x55578c);}})[_0x50cb('0x20')](function(_0x39abd3){if(_0x39abd3){return _0x39abd3?{'count':_0x58899f,'rows':_0x39abd3}:null;}})[_0x50cb('0x20')](respondWithResult(_0x353f02,null))[_0x50cb('0x4f')](handleError(_0x353f02,null));};exports[_0x50cb('0xd7')]=function(_0x1bf973,_0x4fde88){var _0x255636={};var _0x48935a={};var _0x4513ae;var _0x4c8d00;return db[_0x50cb('0x34')][_0x50cb('0x8f')]({'where':{'id':_0x1bf973[_0x50cb('0x50')]['id']}})[_0x50cb('0x20')](handleEntityNotFound(_0x4fde88,null))[_0x50cb('0x20')](function(_0x3f4cd0){if(_0x3f4cd0){_0x4513ae=_0x3f4cd0;_0x48935a[_0x50cb('0xc6')]=_[_0x50cb('0xc3')](db[_0x50cb('0xd8')][_0x50cb('0x35')]);_0x48935a[_0x50cb('0x42')]=_[_0x50cb('0xc3')](_0x1bf973[_0x50cb('0x42')]);_0x48935a['filters']=_[_0x50cb('0xc5')](_0x48935a[_0x50cb('0xc6')],_0x48935a['query']);_0x255636['attributes']=_['intersection'](_0x48935a[_0x50cb('0xc6')],qs[_0x50cb('0xc7')](_0x1bf973[_0x50cb('0x42')]['fields']));_0x255636['attributes']=_0x255636[_0x50cb('0x45')][_0x50cb('0x49')]?_0x255636['attributes']:_0x48935a[_0x50cb('0xc6')];_0x255636[_0x50cb('0xc8')]=qs[_0x50cb('0xc9')](_0x1bf973[_0x50cb('0x42')][_0x50cb('0xc9')]);_0x255636[_0x50cb('0x3f')]=qs['filters'](_[_0x50cb('0xcb')](_0x1bf973[_0x50cb('0x42')],_0x48935a[_0x50cb('0xca')]));if(_0x1bf973[_0x50cb('0x42')][_0x50cb('0x29')]){_0x255636[_0x50cb('0x3f')]=_[_0x50cb('0x51')](_0x255636[_0x50cb('0x3f')],{'$or':_[_0x50cb('0x2b')](_0x255636[_0x50cb('0x45')],function(_0x295a80){var _0x4bf19a={};_0x4bf19a[_0x295a80]={'$like':'%'+_0x1bf973['query'][_0x50cb('0x29')]+'%'};return _0x4bf19a;})});}_0x255636=_[_0x50cb('0x51')]({},_0x255636,_0x1bf973['options']);return _0x4513ae['getOpenchannelInteractions'](_0x255636);}})[_0x50cb('0x20')](function(_0x1ff95b){if(_0x1ff95b){_0x4c8d00=_0x1ff95b[_0x50cb('0x49')];if(!_0x1bf973['query'][_0x50cb('0xbe')](_0x50cb('0xcf'))){_0x255636[_0x50cb('0x1b')]=qs[_0x50cb('0x1b')](_0x1bf973[_0x50cb('0x42')][_0x50cb('0x1b')]);_0x255636['offset']=qs['offset'](_0x1bf973[_0x50cb('0x42')][_0x50cb('0x19')]);}return _0x4513ae[_0x50cb('0xd7')](_0x255636);}})[_0x50cb('0x20')](function(_0x4c5f24){if(_0x4c5f24){return _0x4c5f24?{'count':_0x4c8d00,'rows':_0x4c5f24}:null;}})[_0x50cb('0x20')](respondWithResult(_0x4fde88,null))[_0x50cb('0x4f')](handleError(_0x4fde88,null));};exports[_0x50cb('0xd9')]=function(_0x462c9f,_0x40b2e4){var _0x1e72d7={'raw':!![],'where':{}};var _0x40fb82={};var _0x47c23f={'count':0x0,'rows':[]};return db[_0x50cb('0x34')]['findOne']({'where':{'id':_0x462c9f[_0x50cb('0x50')]['id']}})[_0x50cb('0x20')](handleEntityNotFound(_0x40b2e4,null))[_0x50cb('0x20')](function(_0x5109d0){if(_0x5109d0){_0x40fb82[_0x50cb('0xc6')]=_[_0x50cb('0xc3')](db[_0x50cb('0xda')][_0x50cb('0x35')]);_0x40fb82[_0x50cb('0x42')]=_[_0x50cb('0xc3')](_0x462c9f[_0x50cb('0x42')]);_0x40fb82[_0x50cb('0xca')]=_[_0x50cb('0xc5')](_0x40fb82[_0x50cb('0xc6')],_0x40fb82[_0x50cb('0x42')]);_0x1e72d7['attributes']=_[_0x50cb('0xc5')](_0x40fb82[_0x50cb('0xc6')],qs[_0x50cb('0xc7')](_0x462c9f['query'][_0x50cb('0xc7')]));_0x1e72d7['attributes']=_0x1e72d7[_0x50cb('0x45')][_0x50cb('0x49')]?_0x1e72d7[_0x50cb('0x45')]:_0x40fb82[_0x50cb('0xc6')];if(!_0x462c9f['query'][_0x50cb('0xbe')](_0x50cb('0xcf'))){_0x1e72d7[_0x50cb('0x1b')]=qs[_0x50cb('0x1b')](_0x462c9f['query'][_0x50cb('0x1b')]);_0x1e72d7['offset']=qs[_0x50cb('0x19')](_0x462c9f[_0x50cb('0x42')][_0x50cb('0x19')]);}_0x1e72d7[_0x50cb('0xc8')]=qs['sort'](_0x462c9f[_0x50cb('0x42')][_0x50cb('0xc9')]);_0x1e72d7[_0x50cb('0x3f')]=qs[_0x50cb('0xca')](_['pick'](_0x462c9f[_0x50cb('0x42')],_0x40fb82[_0x50cb('0xca')]));_0x1e72d7['where'][_0x50cb('0xd3')]=_0x5109d0['id'];if(_0x462c9f[_0x50cb('0x42')][_0x50cb('0x29')]){_0x1e72d7[_0x50cb('0x3f')]=_[_0x50cb('0x51')](_0x1e72d7[_0x50cb('0x3f')],{'$or':_['map'](_0x1e72d7['attributes'],function(_0x3965c0){var _0x46f67b={};_0x46f67b[_0x3965c0]={'$like':'%'+_0x462c9f['query'][_0x50cb('0x29')]+'%'};return _0x46f67b;})});}_0x1e72d7=_[_0x50cb('0x51')]({},_0x1e72d7,_0x462c9f['options']);return db[_0x50cb('0xda')][_0x50cb('0x1c')]({'where':_0x1e72d7['where']})[_0x50cb('0x20')](function(_0x3e95f7){_0x47c23f[_0x50cb('0x1c')]=_0x3e95f7;if(_0x462c9f[_0x50cb('0x42')][_0x50cb('0x40')]){_0x1e72d7['include']=[{'all':!![]}];}return db[_0x50cb('0xda')][_0x50cb('0xa5')](_0x1e72d7);})['then'](function(_0x389396){_0x47c23f['rows']=_0x389396;return _0x47c23f;});}})[_0x50cb('0x20')](respondWithFilteredResult(_0x40b2e4,_0x1e72d7))[_0x50cb('0x4f')](handleError(_0x40b2e4,null));};exports['getSmsInteractions']=function(_0x500481,_0x54dd24){var _0x4884eb={};var _0x54bbe3={};var _0x48f42d;var _0x357a88;return db['User'][_0x50cb('0x8f')]({'where':{'id':_0x500481[_0x50cb('0x50')]['id']}})[_0x50cb('0x20')](handleEntityNotFound(_0x54dd24,null))[_0x50cb('0x20')](function(_0x307ceb){if(_0x307ceb){_0x48f42d=_0x307ceb;_0x54bbe3[_0x50cb('0xc6')]=_[_0x50cb('0xc3')](db[_0x50cb('0xdb')][_0x50cb('0x35')]);_0x54bbe3['query']=_['keys'](_0x500481[_0x50cb('0x42')]);_0x54bbe3[_0x50cb('0xca')]=_[_0x50cb('0xc5')](_0x54bbe3[_0x50cb('0xc6')],_0x54bbe3[_0x50cb('0x42')]);_0x4884eb[_0x50cb('0x45')]=_[_0x50cb('0xc5')](_0x54bbe3[_0x50cb('0xc6')],qs['fields'](_0x500481[_0x50cb('0x42')][_0x50cb('0xc7')]));_0x4884eb['attributes']=_0x4884eb[_0x50cb('0x45')][_0x50cb('0x49')]?_0x4884eb[_0x50cb('0x45')]:_0x54bbe3['model'];_0x4884eb[_0x50cb('0xc8')]=qs['sort'](_0x500481['query'][_0x50cb('0xc9')]);_0x4884eb[_0x50cb('0x3f')]=qs[_0x50cb('0xca')](_['pick'](_0x500481[_0x50cb('0x42')],_0x54bbe3[_0x50cb('0xca')]));if(_0x500481[_0x50cb('0x42')]['filter']){_0x4884eb[_0x50cb('0x3f')]=_[_0x50cb('0x51')](_0x4884eb[_0x50cb('0x3f')],{'$or':_[_0x50cb('0x2b')](_0x4884eb[_0x50cb('0x45')],function(_0x51790f){var _0x3fcc4f={};_0x3fcc4f[_0x51790f]={'$like':'%'+_0x500481[_0x50cb('0x42')][_0x50cb('0x29')]+'%'};return _0x3fcc4f;})});}_0x4884eb=_[_0x50cb('0x51')]({},_0x4884eb,_0x500481[_0x50cb('0xcc')]);return _0x48f42d[_0x50cb('0xdc')](_0x4884eb);}})[_0x50cb('0x20')](function(_0x1c4580){if(_0x1c4580){_0x357a88=_0x1c4580['length'];if(!_0x500481[_0x50cb('0x42')][_0x50cb('0xbe')](_0x50cb('0xcf'))){_0x4884eb[_0x50cb('0x1b')]=qs[_0x50cb('0x1b')](_0x500481[_0x50cb('0x42')][_0x50cb('0x1b')]);_0x4884eb['offset']=qs['offset'](_0x500481[_0x50cb('0x42')]['offset']);}return _0x48f42d[_0x50cb('0xdc')](_0x4884eb);}})['then'](function(_0x299fb1){if(_0x299fb1){return _0x299fb1?{'count':_0x357a88,'rows':_0x299fb1}:null;}})['then'](respondWithResult(_0x54dd24,null))[_0x50cb('0x4f')](handleError(_0x54dd24,null));};exports[_0x50cb('0xdd')]=function(_0x56460b,_0xd56af4){var _0x4859c3={};var _0x583677={};var _0x501ded;var _0x314ce8;return db[_0x50cb('0x34')][_0x50cb('0x8f')]({'where':{'id':_0x56460b[_0x50cb('0x50')]['id']}})['then'](handleEntityNotFound(_0xd56af4,null))[_0x50cb('0x20')](function(_0xa84687){if(_0xa84687){_0x501ded=_0xa84687;_0x583677[_0x50cb('0xc6')]=_[_0x50cb('0xc3')](db[_0x50cb('0xde')][_0x50cb('0x35')]);_0x583677['query']=_['keys'](_0x56460b[_0x50cb('0x42')]);_0x583677[_0x50cb('0xca')]=_[_0x50cb('0xc5')](_0x583677[_0x50cb('0xc6')],_0x583677[_0x50cb('0x42')]);_0x4859c3[_0x50cb('0x45')]=_['intersection'](_0x583677[_0x50cb('0xc6')],qs[_0x50cb('0xc7')](_0x56460b[_0x50cb('0x42')][_0x50cb('0xc7')]));_0x4859c3[_0x50cb('0x45')]=_0x4859c3[_0x50cb('0x45')]['length']?_0x4859c3[_0x50cb('0x45')]:_0x583677[_0x50cb('0xc6')];_0x4859c3[_0x50cb('0xc8')]=qs['sort'](_0x56460b[_0x50cb('0x42')]['sort']);_0x4859c3[_0x50cb('0x3f')]=qs[_0x50cb('0xca')](_['pick'](_0x56460b['query'],_0x583677[_0x50cb('0xca')]));if(_0x56460b['query'][_0x50cb('0x29')]){_0x4859c3[_0x50cb('0x3f')]=_[_0x50cb('0x51')](_0x4859c3[_0x50cb('0x3f')],{'$or':_['map'](_0x4859c3[_0x50cb('0x45')],function(_0x324b80){var _0x4dc1b8={};_0x4dc1b8[_0x324b80]={'$like':'%'+_0x56460b[_0x50cb('0x42')]['filter']+'%'};return _0x4dc1b8;})});}_0x4859c3=_[_0x50cb('0x51')]({},_0x4859c3,_0x56460b[_0x50cb('0xcc')]);return _0x501ded[_0x50cb('0xdd')](_0x4859c3);}})[_0x50cb('0x20')](function(_0x175ea3){if(_0x175ea3){_0x314ce8=_0x175ea3[_0x50cb('0x49')];if(!_0x56460b[_0x50cb('0x42')][_0x50cb('0xbe')](_0x50cb('0xcf'))){_0x4859c3['limit']=qs['limit'](_0x56460b[_0x50cb('0x42')]['limit']);_0x4859c3['offset']=qs[_0x50cb('0x19')](_0x56460b[_0x50cb('0x42')][_0x50cb('0x19')]);}return _0x501ded['getFaxInteractions'](_0x4859c3);}})[_0x50cb('0x20')](function(_0x418498){if(_0x418498){return _0x418498?{'count':_0x314ce8,'rows':_0x418498}:null;}})[_0x50cb('0x20')](respondWithResult(_0xd56af4,null))[_0x50cb('0x4f')](handleError(_0xd56af4,null));};exports[_0x50cb('0xdf')]=function(_0x2a64f3,_0x4a73d7){var _0x1891e3={};var _0x1349a1={};var _0x17f6b0;var _0x797084;return db['User'][_0x50cb('0x8f')]({'where':{'id':_0x2a64f3[_0x50cb('0x50')]['id']}})['then'](handleEntityNotFound(_0x4a73d7,null))[_0x50cb('0x20')](function(_0x147410){if(_0x147410){_0x17f6b0=_0x147410;_0x1349a1[_0x50cb('0xc6')]=_[_0x50cb('0xc3')](db[_0x50cb('0xe0')][_0x50cb('0x35')]);_0x1349a1['query']=_[_0x50cb('0xc3')](_0x2a64f3[_0x50cb('0x42')]);_0x1349a1['filters']=_[_0x50cb('0xc5')](_0x1349a1['model'],_0x1349a1['query']);_0x1891e3[_0x50cb('0x45')]=_['intersection'](_0x1349a1[_0x50cb('0xc6')],qs[_0x50cb('0xc7')](_0x2a64f3[_0x50cb('0x42')][_0x50cb('0xc7')]));_0x1891e3[_0x50cb('0x45')]=_0x1891e3['attributes'][_0x50cb('0x49')]?_0x1891e3[_0x50cb('0x45')]:_0x1349a1[_0x50cb('0xc6')];_0x1891e3[_0x50cb('0xc8')]=qs[_0x50cb('0xc9')](_0x2a64f3[_0x50cb('0x42')]['sort']);_0x1891e3[_0x50cb('0x3f')]=qs[_0x50cb('0xca')](_[_0x50cb('0xcb')](_0x2a64f3[_0x50cb('0x42')],_0x1349a1[_0x50cb('0xca')]));if(_0x2a64f3['query'][_0x50cb('0x29')]){_0x1891e3[_0x50cb('0x3f')]=_[_0x50cb('0x51')](_0x1891e3[_0x50cb('0x3f')],{'$or':_[_0x50cb('0x2b')](_0x1891e3[_0x50cb('0x45')],function(_0x2e7c1f){var _0x2ecb76={};_0x2ecb76[_0x2e7c1f]={'$like':'%'+_0x2a64f3[_0x50cb('0x42')][_0x50cb('0x29')]+'%'};return _0x2ecb76;})});}_0x1891e3=_[_0x50cb('0x51')]({},_0x1891e3,_0x2a64f3['options']);return _0x17f6b0[_0x50cb('0xdf')](_0x1891e3);}})[_0x50cb('0x20')](function(_0x41f8d5){if(_0x41f8d5){_0x797084=_0x41f8d5[_0x50cb('0x49')];if(!_0x2a64f3['query'][_0x50cb('0xbe')](_0x50cb('0xcf'))){_0x1891e3[_0x50cb('0x1b')]=qs['limit'](_0x2a64f3[_0x50cb('0x42')]['limit']);_0x1891e3[_0x50cb('0x19')]=qs[_0x50cb('0x19')](_0x2a64f3['query'][_0x50cb('0x19')]);}return _0x17f6b0[_0x50cb('0xdf')](_0x1891e3);}})['then'](function(_0xe71032){if(_0xe71032){return _0xe71032?{'count':_0x797084,'rows':_0xe71032}:null;}})[_0x50cb('0x20')](respondWithResult(_0x4a73d7,null))['catch'](handleError(_0x4a73d7,null));};exports[_0x50cb('0xe1')]=function(_0x57dad0,_0x481617,_0x3dfa98){var _0xa466a6;var _0x399bd5;var _0x202c67;var _0xd1d514=!_[_0x50cb('0x5c')](_0x57dad0[_0x50cb('0x50')]['id'])?_0x57dad0[_0x50cb('0x50')]['id']:!_['isNil'](_0x57dad0[_0x50cb('0x27')]['id'])?_0x57dad0[_0x50cb('0x27')]['id']:null;return db[_0x50cb('0x34')]['find']({'where':{'id':_0xd1d514,'role':{'$or':[_0x50cb('0x25'),_0x50cb('0x27'),'agent']}},'attributes':['id','name','phone',_0x50cb('0xe2'),'role',_0x50cb('0x58'),_0x50cb('0x99')]})[_0x50cb('0x20')](function(_0x21d2ab){if(_0x21d2ab){if(_0x21d2ab[_0x50cb('0x21')]===_0x50cb('0x22')){_0xa466a6=_0x21d2ab;if(_0x57dad0['body'][_0x50cb('0x9b')]){_0x202c67=util[_0x50cb('0xa6')](_0x50cb('0xe3'),_0xa466a6[_0x57dad0['body']['interface']]);}else if(_0x57dad0[_0x50cb('0x55')]['intrf']){_0x202c67=util[_0x50cb('0xa6')](_0x50cb('0xa7'),_0x57dad0['body'][_0x50cb('0xe4')]);}else{_0x202c67=util['format'](_0x50cb('0xa7'),_0xa466a6[_0x50cb('0x33')]);}socket['to'](util['format'](_0x50cb('0xe5'),_0xa466a6['name']))[_0x50cb('0xa2')](_0x50cb('0xe6'),{'user':{'id':_0xa466a6['id'],'name':_0xa466a6[_0x50cb('0x33')]},'ip':_0x57dad0[_0x50cb('0xe7')][_0x50cb('0xe8')]||_0x57dad0[_0x50cb('0xe9')][_0x50cb('0xea')]||_0x57dad0[_0x50cb('0xeb')][_0x50cb('0xea')]||_0x57dad0['connection']['socket'][_0x50cb('0xea')]});return db[_0x50cb('0xa8')][_0x50cb('0x30')]({'where':{'membername':_0xa466a6['name']},'individualHooks':!![]});}}else{throw new db[(_0x50cb('0x8c'))][(_0x50cb('0x88'))](_0x50cb('0xec'));}})[_0x50cb('0x20')](function(){if(_0xa466a6){return _0xa466a6['getVoiceQueues']({'raw':!![]});}})[_0x50cb('0x20')](function(_0x1886e8){if(_0xa466a6){if(_0x1886e8){_0x399bd5=_0x1886e8;if(_0x399bd5[_0x50cb('0x49')]){var _0x1ad723=_0x399bd5[_0x50cb('0x2b')](function(_0x106ee0){var _0x15f91d={'membername':_0xa466a6[_0x50cb('0x33')],'UserId':_0xa466a6['id'],'queue_name':_0x106ee0[_0x50cb('0x33')],'VoiceQueueId':_0x106ee0['id'],'interface':_0x202c67,'paused':_0xa466a6['loginInPause']||![],'penalty':_0x106ee0[_0x50cb('0xed')]||0x0};return db['UserVoiceQueueRt'][_0x50cb('0xa9')](_0x15f91d);});return Promise[_0x50cb('0x54')](_0x1ad723);}}}})[_0x50cb('0x20')](function(){if(_0xa466a6){return db['MemberReport'][_0x50cb('0xa5')]({'where':{'membername':_0xa466a6['name'],'exitAt':null}});}})[_0x50cb('0x20')](function(_0x256a8d){if(_0xa466a6){var _0x326b2c=[];_0x256a8d[_0x50cb('0xee')](function(_0x3ddd88){_0x326b2c[_0x50cb('0x46')](_0x3ddd88['update']({'exitAt':moment()[_0x50cb('0xa6')]('YYYY-MM-DD\x20HH:mm:ss')}));});return Promise[_0x50cb('0x54')](_0x326b2c);}})[_0x50cb('0x20')](function(){if(_0xa466a6){var _0xc85ad=[];var _0x218ce7=[];var _0xae101c=utils[_0x50cb('0xef')]();var _0x271ec6={'membername':_0xa466a6['name'],'interface':_0x202c67,'enterAt':moment()[_0x50cb('0xa6')](_0x50cb('0xf0')),'role':_0xa466a6['role'],'internal':_0xa466a6['internal']};_0xae101c['forEach'](function(_0x56cc37){_0xc85ad[_0x50cb('0x46')](_[_0x50cb('0x51')]({'channel':_0x56cc37,'type':_0x50cb('0xf1'),'data1':_0x57dad0['body'][_0x50cb('0xf2')],'data2':_0x202c67},_0x271ec6));if(_0xa466a6[_0x50cb('0x99')]){_0x218ce7['push'](_[_0x50cb('0x51')]({'channel':_0x56cc37,'type':_0x50cb('0xf3'),'data1':_0x50cb('0xf4')},_0x271ec6));}});return db[_0x50cb('0xf5')][_0x50cb('0x7f')](_0xc85ad[_0x50cb('0xbc')](_0x218ce7),{'individualHooks':!![]});}})['then'](function(){if(_0xa466a6){return _0xa466a6['update']({'online':!![],'lastLoginAt':moment()[_0x50cb('0xa6')](_0x50cb('0xf0')),'voicePause':_0xa466a6[_0x50cb('0x99')]||![],'mailPause':_0xa466a6['loginInPause']||![],'chatPause':_0xa466a6[_0x50cb('0x99')]||![],'faxPause':_0xa466a6[_0x50cb('0x99')]||![],'smsPause':_0xa466a6[_0x50cb('0x99')]||![],'openchannelPause':_0xa466a6['loginInPause']||![],'whatsappPause':_0xa466a6['loginInPause']||![],'pauseType':_0xa466a6[_0x50cb('0x99')]?'LOGININPAUSE':null,'interface':_0x202c67,'lastPauseAt':moment()[_0x50cb('0xa6')](_0x50cb('0xf0'))});}})[_0x50cb('0x20')](function(_0x3a238a){if(_0x57dad0[_0x50cb('0xf6')]){return _0x3dfa98();}else{return Promise[_0x50cb('0xf7')](_0x3a238a)['then'](respondWithResult(_0x481617,null));}})[_0x50cb('0x4f')](handleError(_0x481617,null));};exports['logout']=function(_0x2e1d27,_0x5ea843){var _0x349681;return db[_0x50cb('0x34')]['find']({'where':{'id':_0x2e1d27[_0x50cb('0x50')]['id'],'role':_0x50cb('0x22')},'attributes':['id','name',_0x50cb('0x21')]})['then'](handleEntityNotFound(_0x5ea843,null))[_0x50cb('0x20')](function(_0x3fee62){if(_0x3fee62){_0x349681=_0x3fee62;return db[_0x50cb('0xa8')][_0x50cb('0x30')]({'where':{'membername':_0x349681[_0x50cb('0x33')]},'individualHooks':!![]});}})[_0x50cb('0x20')](function(){return db['MemberReport'][_0x50cb('0xa5')]({'where':{'membername':_0x349681[_0x50cb('0x33')],'exitAt':null}});})['then'](function(_0x12337f){var _0x7e3d72=[];_0x12337f['forEach'](function(_0x72cbdc){_0x7e3d72['push'](_0x72cbdc[_0x50cb('0x1f')]({'exitAt':moment()[_0x50cb('0xa6')](_0x50cb('0xf0'))}));});return Promise[_0x50cb('0x54')](_0x7e3d72);})[_0x50cb('0x20')](function(){return _0x349681[_0x50cb('0x1f')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x50cb('0x20')](respondWithResult(_0x5ea843,null))[_0x50cb('0x4f')](handleError(_0x5ea843,null));};exports[_0x50cb('0xf8')]=function(_0x5dd58f,_0x5120f6){var _0x2d28ae;return db['UserVoiceQueueRt']['update']({'paused':0x1},{'where':{'UserId':_0x5dd58f[_0x50cb('0x50')]['id']},'individualHooks':!![]})[_0x50cb('0x20')](function(){return db['User']['find']({'where':{'id':_0x5dd58f[_0x50cb('0x50')]['id'],'role':'agent'},'attributes':['id',_0x50cb('0x33'),_0x50cb('0x21'),_0x50cb('0x58'),_0x50cb('0x9b'),_0x50cb('0x98')]});})['then'](handleEntityNotFound(_0x5120f6,null))[_0x50cb('0x20')](function(_0x31ae61){if(_0x31ae61){_0x2d28ae=_0x31ae61;return db[_0x50cb('0xf5')][_0x50cb('0xa5')]({'where':{'membername':_0x2d28ae[_0x50cb('0x33')],'type':_0x50cb('0xf3'),'exitAt':null}});}})['then'](function(_0x460b27){if(_0x460b27['length']){var _0x45e659=moment()[_0x50cb('0xa6')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x4f7d3c=0x0,_0x13e140=_0x460b27['length'];_0x4f7d3c<_0x13e140;_0x4f7d3c++){_0x460b27[_0x4f7d3c][_0x50cb('0xf9')]({'exitAt':_0x45e659});}}})[_0x50cb('0x20')](function(){var _0x1d9b6b=[];var _0x447a8a=utils[_0x50cb('0xef')]();_0x447a8a[_0x50cb('0xee')](function(_0x3ff05f){_0x1d9b6b['push']({'channel':_0x3ff05f,'membername':_0x2d28ae[_0x50cb('0x33')],'interface':_['isNil'](_0x2d28ae[_0x50cb('0x9b')])?util['format'](_0x50cb('0xa7'),_0x2d28ae[_0x50cb('0x33')]):_0x2d28ae['interface'],'type':_0x50cb('0xf3'),'enterAt':moment()[_0x50cb('0xa6')](_0x50cb('0xf0')),'data1':_0x5dd58f[_0x50cb('0x55')][_0x50cb('0x37')]||_0x50cb('0xfa'),'role':_0x2d28ae[_0x50cb('0x21')],'internal':_0x2d28ae[_0x50cb('0x58')]});});return db[_0x50cb('0xf5')][_0x50cb('0x7f')](_0x1d9b6b,{'individualHooks':!![]});})['then'](function(){return _0x2d28ae['update']({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x5dd58f[_0x50cb('0x55')][_0x50cb('0x37')]||_0x50cb('0xfa'),'lastPauseAt':moment()[_0x50cb('0xa6')](_0x50cb('0xf0'))});})[_0x50cb('0x20')](respondWithResult(_0x5120f6,null))[_0x50cb('0x4f')](handleError(_0x5120f6,null));};exports[_0x50cb('0xfb')]=function(_0x43d900,_0x1bfef3){if(_0x43d900[_0x50cb('0x55')][_0x50cb('0x97')]&&!utils[_0x50cb('0x9c')](_0x43d900[_0x50cb('0x55')][_0x50cb('0x97')])){throw new APIBadRequestError(util['format']('Channel\x20parameter\x20%s\x20is\x20invalid',_0x43d900[_0x50cb('0x55')][_0x50cb('0x97')]));}return db[_0x50cb('0x34')][_0x50cb('0x2e')]({'where':{'id':_0x43d900[_0x50cb('0x50')]['id']},'attributes':['id',_0x50cb('0x33'),'role',_0x50cb('0x58'),'interface',_0x50cb('0x98'),_0x50cb('0x9a'),_0x50cb('0xfc'),'chatPause',_0x50cb('0xfd'),'openchannelPause',_0x50cb('0xfe'),_0x50cb('0xff'),_0x50cb('0x100'),_0x50cb('0x101')]})[_0x50cb('0x20')](function(_0x2ec084){if(!_0x2ec084){throw new APINotFoundError(util['format']('User\x20with\x20id\x20%s\x20not\x20found',_0x43d900[_0x50cb('0x50')]['id']));}return _0x2ec084[_0x50cb('0xfb')](_0x43d900[_0x50cb('0x55')]['channel']);})['then'](respondWithResult(_0x1bfef3,null))[_0x50cb('0x4f')](APIHandleError(_0x1bfef3));};exports[_0x50cb('0x102')]=function(_0x512d13,_0xf1e3fc){var _0x4fee43={};var _0x2279ca={};var _0x598cfe;var _0x45e58e;return db['User']['findOne']({'where':{'id':_0x512d13[_0x50cb('0x50')]['id']}})['then'](handleEntityNotFound(_0xf1e3fc,null))[_0x50cb('0x20')](function(_0x534673){if(_0x534673){_0x598cfe=_0x534673;_0x2279ca[_0x50cb('0xc6')]=_[_0x50cb('0xc3')](db[_0x50cb('0x103')][_0x50cb('0x35')]);_0x2279ca[_0x50cb('0x42')]=_[_0x50cb('0xc3')](_0x512d13[_0x50cb('0x42')]);_0x2279ca['filters']=_[_0x50cb('0xc5')](_0x2279ca[_0x50cb('0xc6')],_0x2279ca[_0x50cb('0x42')]);_0x4fee43['attributes']=_[_0x50cb('0xc5')](_0x2279ca[_0x50cb('0xc6')],qs[_0x50cb('0xc7')](_0x512d13[_0x50cb('0x42')][_0x50cb('0xc7')]));_0x4fee43[_0x50cb('0x45')]=_0x4fee43['attributes'][_0x50cb('0x49')]?_0x4fee43[_0x50cb('0x45')]:_0x2279ca[_0x50cb('0xc6')];_0x4fee43['order']=qs[_0x50cb('0xc9')](_0x512d13[_0x50cb('0x42')][_0x50cb('0xc9')]);_0x4fee43[_0x50cb('0x3f')]=qs[_0x50cb('0xca')](_[_0x50cb('0xcb')](_0x512d13['query'],_0x2279ca[_0x50cb('0xca')]));if(_0x512d13[_0x50cb('0x42')][_0x50cb('0x29')]){_0x4fee43[_0x50cb('0x3f')]=_[_0x50cb('0x51')](_0x4fee43[_0x50cb('0x3f')],{'$or':_['map'](_0x4fee43[_0x50cb('0x45')],function(_0xd8ff05){var _0x3422de={};_0x3422de[_0xd8ff05]={'$like':'%'+_0x512d13[_0x50cb('0x42')][_0x50cb('0x29')]+'%'};return _0x3422de;})});}_0x4fee43=_['merge']({},_0x4fee43,_0x512d13[_0x50cb('0xcc')]);return _0x598cfe[_0x50cb('0x102')](_0x4fee43);}})['then'](function(_0x4a9ef6){if(_0x4a9ef6){_0x45e58e=_0x4a9ef6['length'];if(!_0x512d13[_0x50cb('0x42')][_0x50cb('0xbe')](_0x50cb('0xcf'))){_0x4fee43[_0x50cb('0x1b')]=qs[_0x50cb('0x1b')](_0x512d13[_0x50cb('0x42')][_0x50cb('0x1b')]);_0x4fee43[_0x50cb('0x19')]=qs[_0x50cb('0x19')](_0x512d13[_0x50cb('0x42')][_0x50cb('0x19')]);}return _0x598cfe[_0x50cb('0x102')](_0x4fee43);}})[_0x50cb('0x20')](function(_0xef7f39){if(_0xef7f39){return _0xef7f39?{'count':_0x45e58e,'rows':_0xef7f39}:null;}})[_0x50cb('0x20')](respondWithResult(_0xf1e3fc,null))[_0x50cb('0x4f')](handleError(_0xf1e3fc,null));};exports[_0x50cb('0x104')]=function(_0x351b15,_0x3e1efa){var _0x285018=_0x351b15['params']['id'];var _0x661e59=_0x351b15[_0x50cb('0x55')]?_0x351b15[_0x50cb('0x55')][_0x50cb('0x57')]:null;var _0x3e4201=[];return Promise[_0x50cb('0xf7')]()['then'](function(){if(!_0x661e59)throw new APIBadRequestError(_0x50cb('0x105'));})[_0x50cb('0x20')](function(){return db[_0x50cb('0x34')]['findOne']({'where':{'id':_0x285018}});})[_0x50cb('0x20')](function(_0x31d84c){if(!_0x31d84c)throw new APINotFoundError(util[_0x50cb('0xa6')](_0x50cb('0x106'),_0x351b15[_0x50cb('0x50')]['id']));return db[_0x50cb('0x5f')][_0x50cb('0x107')](function(_0x4f2b61){return _0x31d84c['addTeams'](_0x661e59,{'transaction':_0x4f2b61})[_0x50cb('0x20')](function(){return db[_0x50cb('0x103')][_0x50cb('0xa5')]({'where':{'id':{'$in':_0x661e59}}});})['then'](function(_0x396f85){var _0x26874c=_['map'](_0x396f85,function(_0xc79f4f){return _0xc79f4f[_0x50cb('0x108')]();});return Promise[_0x50cb('0x54')](_0x26874c);})[_0x50cb('0x20')](function(_0x43e6a5){_0x3e4201=_[_0x50cb('0x109')](_0x43e6a5);var _0x4581e4=_[_0x50cb('0x2b')](_0x3e4201,function(_0x38034c){return _0x38034c[_0x50cb('0x10a')](_0x31d84c['id'],{'transaction':_0x4f2b61});});return Promise[_0x50cb('0x54')](_0x4581e4);})[_0x50cb('0x20')](function(){if(!_0x31d84c[_0x50cb('0x98')])return;var _0x4a62ff=_[_0x50cb('0x29')](_0x3e4201,function(_0xf2c030){return _0xf2c030[_0x50cb('0x10b')](_0x50cb('0x97'))===_0x50cb('0x10c');});var _0x354726=_['map'](_0x4a62ff,function(_0x2a8007){return db[_0x50cb('0xa8')][_0x50cb('0xa9')]({'membername':_0x31d84c['name'],'UserId':_0x31d84c['id'],'queue_name':_0x2a8007[_0x50cb('0x33')],'VoiceQueueId':_0x2a8007['id'],'interface':_[_0x50cb('0x5c')](_0x31d84c[_0x50cb('0x9b')])?util[_0x50cb('0xa6')](_0x50cb('0xa7'),_0x31d84c[_0x50cb('0x33')]):_0x31d84c['interface'],'paused':_0x31d84c[_0x50cb('0x9a')]||![],'penalty':_0x31d84c['penalty']},{'transaction':_0x4f2b61});});return Promise[_0x50cb('0x54')](_0x354726);})[_0x50cb('0x20')](function(){return db['TeamVoicePrefix'][_0x50cb('0xa5')]({'where':{'teamId':{'$in':_0x661e59}}});})['then'](function(_0x9091ec){var _0x17eaa8=_[_0x50cb('0x2b')](_0x9091ec,function(_0x427a3a){return db[_0x50cb('0x10d')][_0x50cb('0x7b')]({'UserId':_0x31d84c['id'],'VoicePrefixId':_0x427a3a[_0x50cb('0x10e')]},{'transaction':_0x4f2b61});});return Promise[_0x50cb('0x54')](_0x17eaa8);});});})[_0x50cb('0x20')](function(){for(var _0x3fb04f=0x0;_0x3fb04f<_0x3e4201['length'];_0x3fb04f++){var _0x1626c0=_0x3e4201[_0x3fb04f][_0x50cb('0x10b')]('channel');var _0xe5805a=_0x1626c0+_0x50cb('0xab');socket[_0x50cb('0xa2')]('user'+_0x1626c0+'Queue:save',{'UserId':_0x285018,['queueField']:_0x3e4201[_0x3fb04f]['id']});}})[_0x50cb('0x20')](respondWithStatusCode(_0x3e1efa,null))[_0x50cb('0x4f')](APIHandleError(_0x3e1efa));};exports[_0x50cb('0x10f')]=function(_0x43c36d,_0x59549e){var _0x5cddf0=_0x43c36d[_0x50cb('0x50')]['id'];var _0x1f553b=null;if(_0x43c36d[_0x50cb('0x42')][_0x50cb('0x57')]){_0x1f553b=_[_0x50cb('0x110')](_0x43c36d[_0x50cb('0x42')][_0x50cb('0x57')])?_0x43c36d[_0x50cb('0x42')][_0x50cb('0x57')]:[_0x43c36d['query'][_0x50cb('0x57')]];}var _0x4bd080=[];return Promise[_0x50cb('0xf7')]()[_0x50cb('0x20')](function(){if(!_0x1f553b)throw new APIBadRequestError(_0x50cb('0x111'));})[_0x50cb('0x20')](function(){return db[_0x50cb('0x34')][_0x50cb('0x8f')]({'where':{'id':_0x5cddf0}});})['then'](function(_0x3e2b3e){if(!_0x3e2b3e)throw new APINotFoundError(util['format'](_0x50cb('0x106'),_0x43c36d[_0x50cb('0x50')]['id']));return db[_0x50cb('0x5f')][_0x50cb('0x107')](function(_0x2fee34){return _0x3e2b3e[_0x50cb('0x10f')](_0x1f553b,{'transaction':_0x2fee34})['then'](function(){return db['Team'][_0x50cb('0xa5')]({'where':{'id':{'$in':_0x1f553b}}});})[_0x50cb('0x20')](function(_0x97cc5c){var _0x1f72a5=_['map'](_0x97cc5c,function(_0x317fb1){return _0x317fb1[_0x50cb('0x108')]();});return Promise['all'](_0x1f72a5);})[_0x50cb('0x20')](function(_0x62cc5e){_0x4bd080=_[_0x50cb('0x109')](_0x62cc5e);var _0x1ca978=_[_0x50cb('0x2b')](_0x4bd080,function(_0x5564ed){return _0x5564ed[_0x50cb('0x112')](_0x3e2b3e['id'],{'transaction':_0x2fee34});});return Promise['all'](_0x1ca978);})[_0x50cb('0x20')](function(){if(!_0x3e2b3e[_0x50cb('0x98')])return;var _0x3b0146=_['filter'](_0x4bd080,function(_0x57b784){return _0x57b784[_0x50cb('0x10b')](_0x50cb('0x97'))===_0x50cb('0x10c');});var _0x3e837d=_[_0x50cb('0x2b')](_0x3b0146,function(_0x43892f){return db['UserVoiceQueueRt'][_0x50cb('0x30')]({'where':{'VoiceQueueId':_0x43892f['id'],'UserId':_0x3e2b3e['id']},'transaction':_0x2fee34});});return Promise[_0x50cb('0x54')](_0x3e837d);})[_0x50cb('0x20')](function(){return db[_0x50cb('0x113')]['findAll']({'where':{'teamId':{'$in':_0x1f553b}}});})[_0x50cb('0x20')](function(_0x18b1f7){var _0x1cb10=_[_0x50cb('0x2b')](_0x18b1f7,function(_0x17c40e){return db['UserVoicePrefix'][_0x50cb('0x30')]({'where':{'UserId':_0x3e2b3e['id'],'VoicePrefixId':_0x17c40e[_0x50cb('0x10e')]}},{'transaction':_0x2fee34});});return Promise[_0x50cb('0x54')](_0x1cb10);});});})[_0x50cb('0x20')](function(){for(var _0x2fee7e=0x0;_0x2fee7e<_0x4bd080[_0x50cb('0x49')];_0x2fee7e++){var _0x4dfd83=_0x4bd080[_0x2fee7e]['getDataValue'](_0x50cb('0x97'));var _0x30f090=_0x4dfd83+'QueueId';socket['emit'](_0x50cb('0x27')+_0x4dfd83+_0x50cb('0xac'),{'UserId':_0x5cddf0,['queueField']:_0x4bd080[_0x2fee7e]['id']});}})['then'](respondWithStatusCode(_0x59549e,null))[_0x50cb('0x4f')](APIHandleError(_0x59549e));};exports[_0x50cb('0x114')]=function(_0x2b656f,_0x1b2ef2){var _0x8c227={};var _0x4eeaf0={};var _0x471723;var _0x25a6bd;return db[_0x50cb('0x34')]['findOne']({'where':{'id':_0x2b656f['params']['id']}})[_0x50cb('0x20')](handleEntityNotFound(_0x1b2ef2,null))[_0x50cb('0x20')](function(_0x26e7f8){if(_0x26e7f8){_0x471723=_0x26e7f8;_0x4eeaf0[_0x50cb('0xc6')]=_[_0x50cb('0xc3')](db[_0x50cb('0xbf')][_0x50cb('0x35')]);_0x4eeaf0[_0x50cb('0x42')]=_[_0x50cb('0xc3')](_0x2b656f[_0x50cb('0x42')]);_0x4eeaf0['filters']=_[_0x50cb('0xc5')](_0x4eeaf0[_0x50cb('0xc6')],_0x4eeaf0[_0x50cb('0x42')]);_0x8c227[_0x50cb('0x45')]=_[_0x50cb('0xc5')](_0x4eeaf0['model'],qs[_0x50cb('0xc7')](_0x2b656f[_0x50cb('0x42')]['fields']));_0x8c227[_0x50cb('0x45')]=_0x8c227[_0x50cb('0x45')][_0x50cb('0x49')]?_0x8c227[_0x50cb('0x45')]:_0x4eeaf0[_0x50cb('0xc6')];_0x8c227[_0x50cb('0xc8')]=qs['sort'](_0x2b656f[_0x50cb('0x42')][_0x50cb('0xc9')]);_0x8c227[_0x50cb('0x3f')]=qs['filters'](_['pick'](_0x2b656f[_0x50cb('0x42')],_0x4eeaf0['filters']));if(_0x2b656f[_0x50cb('0x42')]['filter']){_0x8c227['where']=_[_0x50cb('0x51')](_0x8c227[_0x50cb('0x3f')],{'$or':_[_0x50cb('0x2b')](_0x8c227[_0x50cb('0x45')],function(_0x2267ac){var _0x4b75f3={};_0x4b75f3[_0x2267ac]={'$like':'%'+_0x2b656f['query'][_0x50cb('0x29')]+'%'};return _0x4b75f3;})});}_0x8c227=_[_0x50cb('0x51')]({},_0x8c227,_0x2b656f[_0x50cb('0xcc')]);return _0x471723[_0x50cb('0x114')](_0x8c227);}})[_0x50cb('0x20')](function(_0xf56d96){if(_0xf56d96){_0x25a6bd=_0xf56d96[_0x50cb('0x49')];if(!_0x2b656f[_0x50cb('0x42')][_0x50cb('0xbe')]('nolimit')){_0x8c227[_0x50cb('0x1b')]=qs[_0x50cb('0x1b')](_0x2b656f['query'][_0x50cb('0x1b')]);_0x8c227[_0x50cb('0x19')]=qs[_0x50cb('0x19')](_0x2b656f[_0x50cb('0x42')][_0x50cb('0x19')]);}return _0x471723[_0x50cb('0x114')](_0x8c227);}})['then'](function(_0x39331f){if(_0x39331f){return _0x39331f?{'count':_0x25a6bd,'rows':_0x39331f}:null;}})[_0x50cb('0x20')](respondWithResult(_0x1b2ef2,null))[_0x50cb('0x4f')](handleError(_0x1b2ef2,null));};exports['getAgents']=function(_0x4857e3,_0x3baf0e){var _0x5a1eea={};var _0x2a1376={};var _0x2d161e;return db[_0x50cb('0x34')][_0x50cb('0x8f')]({'where':{'id':_0x4857e3['params']['id']}})[_0x50cb('0x20')](handleEntityNotFound(_0x3baf0e,null))[_0x50cb('0x20')](function(_0x554447){if(_0x554447){_0x2d161e=_0x554447;_0x2a1376[_0x50cb('0xc6')]=_[_0x50cb('0xc3')](db[_0x50cb('0x34')][_0x50cb('0x35')]);_0x2a1376[_0x50cb('0x42')]=_[_0x50cb('0xc3')](_0x4857e3[_0x50cb('0x42')]);_0x2a1376[_0x50cb('0xca')]=_['intersection'](_0x2a1376[_0x50cb('0xc6')],_0x2a1376[_0x50cb('0x42')]);_0x5a1eea[_0x50cb('0x45')]=_[_0x50cb('0xc5')](_0x2a1376[_0x50cb('0xc6')],qs[_0x50cb('0xc7')](_0x4857e3['query'][_0x50cb('0xc7')]));_0x5a1eea['attributes']=_0x5a1eea[_0x50cb('0x45')][_0x50cb('0x49')]?_0x5a1eea['attributes']:_0x2a1376[_0x50cb('0xc6')];_0x5a1eea[_0x50cb('0xc8')]=qs[_0x50cb('0xc9')](_0x4857e3[_0x50cb('0x42')][_0x50cb('0xc9')]);_0x5a1eea[_0x50cb('0x3f')]=qs[_0x50cb('0xca')](_[_0x50cb('0xcb')](_0x4857e3['query'],_0x2a1376[_0x50cb('0xca')]));if(_0x4857e3[_0x50cb('0x42')]['filter']){_0x5a1eea['where']=_[_0x50cb('0x51')](_0x5a1eea['where'],{'$or':_['map'](_0x5a1eea[_0x50cb('0x45')],function(_0x2a4cb5){var _0x1d1066={};_0x1d1066[_0x2a4cb5]={'$like':'%'+_0x4857e3[_0x50cb('0x42')][_0x50cb('0x29')]+'%'};return _0x1d1066;})});}_0x5a1eea[_0x50cb('0xc6')]=db[_0x50cb('0x34')];_0x5a1eea['as']=_0x50cb('0x86');_0x5a1eea=_[_0x50cb('0x51')]({},_0x5a1eea,_0x4857e3[_0x50cb('0xcc')]);return _0x2d161e[_0x50cb('0x115')]({'include':[_0x5a1eea]});}})[_0x50cb('0x20')](function(_0x441f5b){if(_0x441f5b){var _0x1fff1a={},_0x19ac66=[];for(var _0xee1e5=0x0;_0xee1e5<_0x441f5b[_0x50cb('0x49')];_0xee1e5+=0x1){for(var _0x181953=0x0,_0x1dd70b;_0x181953<_0x441f5b[_0xee1e5][_0x50cb('0x86')][_0x50cb('0x49')];_0x181953+=0x1){_0x1dd70b=_0x441f5b[_0xee1e5][_0x50cb('0x86')][_0x181953][_0x50cb('0x24')]({'plain':!![]});_0x1fff1a[_0x1dd70b['id']]=_0x1dd70b;}}_0x1fff1a=_[_0x50cb('0x116')](_0x1fff1a);for(var _0x7b4400=qs[_0x50cb('0x19')](_0x4857e3[_0x50cb('0x42')][_0x50cb('0x19')]);_0x7b4400<_0x1fff1a['length']&&_0x19ac66['length']=_0x573116){_0x31deeb=_0x573116;_0x42e72b=0xc8;}else{_0x42e72b=0xce;}_0x684f3b['status'](_0x42e72b);return _0x684f3b['set'](_0x55fa('0x1b'),_0x59c117+'-'+_0x31deeb+'/'+_0x573116)[_0x55fa('0x17')](_0x61a0ac);}return null;};}function saveUpdates(_0x1a508f){return function(_0x21b702){if(_0x21b702){return _0x21b702[_0x55fa('0x1c')](_0x1a508f)[_0x55fa('0x1d')](function(_0x145773){if(_0x145773[_0x55fa('0x1e')]==='agent'){socket[_0x55fa('0x1f')](_0x55fa('0x20')+_0x145773['id'],_0x145773);}return _0x145773;});}return null;};}function removeEntity(_0x47a4f6){return function(_0xeef9ec){if(_0xeef9ec){return _0xeef9ec[_0x55fa('0x21')]()[_0x55fa('0x1d')](function(){var _0x246c81=_0xeef9ec['get']({'plain':!![]});if(_0x246c81[_0x55fa('0x1e')]===_0x55fa('0x22'))return;var _0x546511=[{'name':'Users','value':_0x55fa('0x23'),'ignore':!![]},{'name':_0x55fa('0x24'),'value':_0x55fa('0x25'),'ignore':![]},{'name':_0x55fa('0x26'),'value':_0x55fa('0x27'),'ignore':![]}];var _0x14c70a=_(_0x546511)[_0x55fa('0x28')](_0x55fa('0x29'))[_0x55fa('0x2a')](_0x55fa('0x2b'))[_0x55fa('0x2b')]();if(_[_0x55fa('0x2c')](_0x14c70a,_0x246c81[_0x55fa('0x1e')])){return;}var _0x36d1b6=_[_0x55fa('0x2d')](_0x546511,[_0x55fa('0x2b'),_0x246c81['role']])[_0x55fa('0x2e')];return db['UserProfileResource'][_0x55fa('0x21')]({'where':{'type':_0x36d1b6,'resourceId':_0x246c81['id']}})['then'](function(){return _0xeef9ec;});})[_0x55fa('0x1d')](function(){_0x47a4f6[_0x55fa('0x16')](0xcc)[_0x55fa('0x2f')]();});}};}function handleEntityNotFound(_0x52c0f6){return function(_0x2c2405){if(!_0x2c2405){_0x52c0f6[_0x55fa('0x30')](0x194);}return _0x2c2405;};}function handleError(_0x5f2aa2,_0x1805ab){_0x1805ab=_0x1805ab||0x1f4;return function(_0x236a49){logger['error'](_0x236a49['stack']);if(_0x236a49[_0x55fa('0x2e')]){delete _0x236a49[_0x55fa('0x2e')];}_0x5f2aa2[_0x55fa('0x16')](_0x1805ab)[_0x55fa('0x31')](_0x236a49);};}function getUserAttributes(){return _(db[_0x55fa('0x32')]['rawAttributes'])[_0x55fa('0x2a')](function(_0x1ebe7c){return{'name':_0x1ebe7c[_0x55fa('0x33')],'type':_0x1ebe7c['type'][_0x55fa('0x34')]};})[_0x55fa('0x28')](function(_0x2edd69){return![_0x55fa('0x35'),_0x55fa('0x36'),_0x55fa('0x37'),_0x55fa('0x38'),'resetPasswordExpires',_0x55fa('0x39')][_0x55fa('0x2c')](_0x2edd69[_0x55fa('0x2e')]);})[_0x55fa('0x2b')]();}exports[_0x55fa('0x3a')]=function(_0x16bc43,_0x181d6b){var _0x530fb8={},_0xd509f3={'count':0x0,'rows':[]};var _0x4ec9a8=getUserAttributes();_0x530fb8=qs[_0x55fa('0x3b')](_0x4ec9a8,_0x16bc43);var _0x57263f={'where':_0x530fb8['where']};return db['User'][_0x55fa('0x3c')](_0x57263f)['then'](function(_0x43eb3e){_0xd509f3['count']=_0x43eb3e;if(_0x16bc43[_0x55fa('0x3d')][_0x55fa('0x3e')]){_0x530fb8[_0x55fa('0x3f')]=[{'all':!![]}];}if(_0x16bc43[_0x55fa('0x3d')][_0x55fa('0x40')]===_0x55fa('0x41')){_0x530fb8[_0x55fa('0x3f')]=[{'model':db['UserSetting'],'as':'userSetting'}];}if(!_['includes'](_0x530fb8[_0x55fa('0x42')],'id')){_0x530fb8[_0x55fa('0x42')][_0x55fa('0x43')]('id');}return db[_0x55fa('0x32')]['findAll'](_0x530fb8);})[_0x55fa('0x1d')](function(_0x3be205){_0xd509f3['rows']=_0x3be205;if(_0x16bc43[_0x55fa('0x3d')][_0x55fa('0x44')]===_0x55fa('0x41')){var _0x1a5e9e=[];for(var _0x22d59b=0x0;_0x22d59b<_0xd509f3[_0x55fa('0x45')][_0x55fa('0x46')];_0x22d59b++){_0x1a5e9e['push'](get_open_tabs(_0x55fa('0x47'),_0xd509f3[_0x55fa('0x45')][_0x22d59b][_0x55fa('0x48')]));_0x1a5e9e[_0x55fa('0x43')](get_open_tabs(_0x55fa('0x49'),_0xd509f3[_0x55fa('0x45')][_0x22d59b][_0x55fa('0x48')]));_0x1a5e9e[_0x55fa('0x43')](get_open_tabs('fax',_0xd509f3[_0x55fa('0x45')][_0x22d59b]['dataValues']));_0x1a5e9e['push'](get_open_tabs(_0x55fa('0x4a'),_0xd509f3[_0x55fa('0x45')][_0x22d59b][_0x55fa('0x48')]));_0x1a5e9e[_0x55fa('0x43')](get_open_tabs('openchannel',_0xd509f3[_0x55fa('0x45')][_0x22d59b][_0x55fa('0x48')]));_0x1a5e9e['push'](get_open_tabs('whatsapp',_0xd509f3['rows'][_0x22d59b]['dataValues']));}return Promise[_0x55fa('0x4b')](_0x1a5e9e)['then'](function(){return _0xd509f3;});}else{return _0xd509f3;}})[_0x55fa('0x1d')](respondWithFilteredResult(_0x181d6b,_0x530fb8))['catch'](handleError(_0x181d6b,null));};exports[_0x55fa('0x4c')]=function(_0x529581,_0x5a7c9d){var _0x35a442=getUserAttributes();_0x529581[_0x55fa('0x3d')]['id']=_0x529581[_0x55fa('0x4d')]['id'];var _0x3029bf=qs[_0x55fa('0x3b')](_0x35a442,_0x529581);if(_0x529581['query'][_0x55fa('0x3e')]){_0x3029bf[_0x55fa('0x3f')]=[{'all':!![]}];}if(_0x529581[_0x55fa('0x3d')][_0x55fa('0x40')]===_0x55fa('0x41')){_0x3029bf['include']=[{'model':db[_0x55fa('0x4e')],'as':_0x55fa('0x40')}];}_0x3029bf=_[_0x55fa('0x4f')]({},_0x3029bf,_0x529581['options']);if(!_[_0x55fa('0x2c')](_0x3029bf[_0x55fa('0x42')],'id')){_0x3029bf[_0x55fa('0x42')][_0x55fa('0x43')]('id');}return db['User']['find'](_0x3029bf)[_0x55fa('0x1d')](handleEntityNotFound(_0x5a7c9d,null))[_0x55fa('0x1d')](function(_0x580592){var _0x384002=[];values=_0x580592;if(_0x529581[_0x55fa('0x3d')][_0x55fa('0x44')]===_0x55fa('0x41')){_0x384002[_0x55fa('0x43')](get_open_tabs(_0x55fa('0x47'),_0x580592[_0x55fa('0x48')]));_0x384002[_0x55fa('0x43')](get_open_tabs('sms',_0x580592[_0x55fa('0x48')]));_0x384002[_0x55fa('0x43')](get_open_tabs('openchannel',_0x580592[_0x55fa('0x48')]));_0x384002['push'](get_open_tabs(_0x55fa('0x50'),_0x580592[_0x55fa('0x48')]));_0x384002[_0x55fa('0x43')](get_open_tabs(_0x55fa('0x51'),_0x580592[_0x55fa('0x48')]));_0x384002[_0x55fa('0x43')](get_open_tabs(_0x55fa('0x4a'),_0x580592[_0x55fa('0x48')]));return Promise[_0x55fa('0x4b')](_0x384002);}else{return values;}})[_0x55fa('0x1d')](function(){return values;})[_0x55fa('0x1d')](respondWithResult(_0x5a7c9d,null))[_0x55fa('0x52')](handleError(_0x5a7c9d,null));};exports[_0x55fa('0x1c')]=function(_0x43d2de,_0x21f55e){if(_0x43d2de[_0x55fa('0x53')]['id']){delete _0x43d2de[_0x55fa('0x53')]['id'];}delete _0x43d2de['body']['role'];return db['User'][_0x55fa('0x2d')]({'where':{'id':_0x43d2de[_0x55fa('0x4d')]['id']}})[_0x55fa('0x1d')](handleEntityNotFound(_0x21f55e,null))[_0x55fa('0x1d')](saveUpdates(_0x43d2de[_0x55fa('0x53')],null))[_0x55fa('0x1d')](respondWithResult(_0x21f55e,null))[_0x55fa('0x52')](handleError(_0x21f55e,null));};exports[_0x55fa('0x54')]=function(_0x6a6649,_0x31ad98){return db[_0x55fa('0x32')][_0x55fa('0x54')]()[_0x55fa('0x1d')](respondWithResult(_0x31ad98,null))[_0x55fa('0x52')](handleError(_0x31ad98,null));};exports[_0x55fa('0x55')]=function(_0x52d59b,_0x200917){return db[_0x55fa('0x32')][_0x55fa('0x2d')]({'where':{'id':_0x52d59b[_0x55fa('0x4d')]['id']}})[_0x55fa('0x1d')](handleEntityNotFound(_0x200917,null))[_0x55fa('0x1d')](function(_0x25dc86){if(_0x25dc86){return _0x25dc86[_0x55fa('0x55')](_0x52d59b[_0x55fa('0x53')][_0x55fa('0x56')],_[_0x55fa('0x57')](_0x52d59b[_0x55fa('0x53')],[_0x55fa('0x56'),'id'])||{});}})[_0x55fa('0x1d')](respondWithResult(_0x200917,null))[_0x55fa('0x52')](handleError(_0x200917,null));};function validateUser(_0x150752){return new Promise(function(_0x38f7f6,_0x4e29c3){if(_0x150752[_0x55fa('0x58')])return _0x38f7f6(_0x150752);return db[_0x55fa('0x59')]['findById'](0x1)[_0x55fa('0x1d')](function(_0xf59c68){if(_0xf59c68[_0x55fa('0x5a')])authService['validatePasswordPattern'](_0x150752[_0x55fa('0x35')]);db[_0x55fa('0x32')][_0x55fa('0x5b')](_0x55fa('0x58'))[_0x55fa('0x1d')](function(_0x2a5505){if(_['isNil'](_0x2a5505)){_0x150752[_0x55fa('0x58')]=_0xf59c68['min_internal']||0x1;return;}if(_[_0x55fa('0x5c')](_0xf59c68[_0x55fa('0x5d')])||_0xf59c68[_0x55fa('0x5d')]===_0x2a5505){_0x150752[_0x55fa('0x58')]=_0x2a5505+0x1;return;}if(_0xf59c68[_0x55fa('0x5d')]>_0x2a5505){_0x150752[_0x55fa('0x58')]=_0xf59c68['min_internal'];return;}return db[_0x55fa('0x5e')][_0x55fa('0x3d')](_0x55fa('0x5f'),{'type':db[_0x55fa('0x5e')]['QueryTypes'][_0x55fa('0x60')]})[_0x55fa('0x1d')](function(_0x3ab6b1){if(_0x3ab6b1&&_0x3ab6b1[_0x55fa('0x46')]){for(var _0x54219f=0x0,_0x402189=_0x3ab6b1['length'];_0x54219f<_0x402189&&_['isNil'](_0x150752[_0x55fa('0x58')]);_0x54219f++){if(_0xf59c68[_0x55fa('0x5d')]<=_0x3ab6b1[_0x54219f][_0x55fa('0x61')]){_0x150752['internal']=_0x3ab6b1[_0x54219f]['from'];}else if(_0xf59c68[_0x55fa('0x5d')]>_0x3ab6b1[_0x54219f][_0x55fa('0x61')]&&_0xf59c68[_0x55fa('0x5d')]<=_0x3ab6b1[_0x54219f]['to']){_0x150752['internal']=_0xf59c68['min_internal'];}}}if(_['isNil'](_0x150752[_0x55fa('0x58')])){_0x150752[_0x55fa('0x58')]=_0x2a5505+0x1;}return _0x38f7f6(_0x150752);});});})[_0x55fa('0x52')](function(_0x27086c){_0x4e29c3(_0x27086c);});});}function updateUser(_0xdfeb14){return new Promise(function(_0x330663,_0x362dc6){try{if(_0xdfeb14['voicemail']){_0xdfeb14[_0x55fa('0x62')]=_0xdfeb14[_0x55fa('0x58')];_0xdfeb14[_0x55fa('0x63')]={'mailbox':_0xdfeb14[_0x55fa('0x58')],'password':_0xdfeb14[_0x55fa('0x35')],'fullname':_0xdfeb14[_0x55fa('0x64')],'email':_0xdfeb14[_0x55fa('0x65')]};}if(_0xdfeb14[_0x55fa('0x1e')]===_0x55fa('0x25')){if(!_0xdfeb14[_0x55fa('0x66')])_0xdfeb14['permissions']=[_0x55fa('0x67'),_0x55fa('0x68'),'103','113','110',_0x55fa('0x69'),'105',_0x55fa('0x6a'),'107',_0x55fa('0x6b'),_0x55fa('0x6c'),_0x55fa('0x6d'),_0x55fa('0x6e'),_0x55fa('0x6f'),_0x55fa('0x70')];}_0x330663(_0xdfeb14);}catch(_0x3cd480){_0x362dc6(_0x3cd480);}});}exports[_0x55fa('0x71')]=function(_0xccf545,_0x3ac9e4){if(_0xccf545[_0x55fa('0x23')][_0x55fa('0x1e')]===_0x55fa('0x25'))throw new Error(_0x55fa('0x72'));if(_0xccf545[_0x55fa('0x53')][_0x55fa('0x1e')]==='user'&&_0xccf545[_0x55fa('0x23')][_0x55fa('0x1e')]!==_0x55fa('0x22')){throw new Error(_0x55fa('0x73'));}if(_0xccf545[_0x55fa('0x53')]['role']===_0x55fa('0x22')&&_0xccf545[_0x55fa('0x23')][_0x55fa('0x1e')]!==_0x55fa('0x22')){throw new Error(_0x55fa('0x74'));}return licenseUtil[_0x55fa('0x75')]([_0xccf545[_0x55fa('0x53')]])[_0x55fa('0x1d')](function(){return validateUser(_0xccf545[_0x55fa('0x53')]);})['then'](function(_0x3ecec2){return updateUser(_0x3ecec2)[_0x55fa('0x1d')](function(_0x1ed96c){if(_0x1ed96c['role']===_0x55fa('0x22')){_0x1ed96c['settingsEnabled']=_0xccf545[_0x55fa('0x23')][_0x55fa('0x76')];delete _0x1ed96c[_0x55fa('0x77')];}return _0x1ed96c;});})['then'](function(_0x3de64f){return db[_0x55fa('0x32')]['create'](_0x3de64f,{'include':[{'model':db[_0x55fa('0x63')],'as':_0x55fa('0x63')}]});})[_0x55fa('0x1d')](function(_0x2158e4){if(_0xccf545[_0x55fa('0x53')][_0x55fa('0x1e')]==='user')return _0x2158e4;if(_0xccf545[_0x55fa('0x23')][_0x55fa('0x1e')]!=='user')return _0x2158e4;return db['UserProfileSection']['find']({'where':{'name':_0x2158e4['role']===_0x55fa('0x25')?_0x55fa('0x24'):'Telephones','userProfileId':_0xccf545[_0x55fa('0x23')][_0x55fa('0x77')]},'raw':!![]})[_0x55fa('0x1d')](function(_0x18f37a){if(!_0x18f37a||_0x18f37a[_0x55fa('0x78')]!=0x0)return _0x2158e4;return db[_0x55fa('0x79')]['create']({'name':_0x2158e4[_0x55fa('0x2e')],'resourceId':_0x2158e4['id'],'type':_0x18f37a[_0x55fa('0x2e')],'sectionId':_0x18f37a['id']},{})[_0x55fa('0x1d')](function(){return _0x2158e4;});})[_0x55fa('0x52')](function(_0x24f153){logger[_0x55fa('0x7a')](_0x55fa('0x7b'),_0x24f153);throw _0x24f153;});})['then'](respondWithResult(_0x3ac9e4,0xc9))[_0x55fa('0x52')](handleError(_0x3ac9e4,null));};exports['bulkCreate']=function(_0x3fbad3,_0x15584f){var _0x31881c=_0x3fbad3[_0x55fa('0x53')];var _0xe933f3=[];if(_0x3fbad3[_0x55fa('0x23')][_0x55fa('0x1e')]===_0x55fa('0x25'))throw new Error(_0x55fa('0x72'));if(_['some'](_0x31881c,['role',_0x55fa('0x23')])&&_0x3fbad3['user']['role']!=='admin'){throw new Error(_0x55fa('0x73'));}if(_[_0x55fa('0x7c')](_0x31881c,[_0x55fa('0x1e'),_0x55fa('0x22')])&&_0x3fbad3[_0x55fa('0x23')]['role']!==_0x55fa('0x22')){throw new Error(_0x55fa('0x7d'));}return licenseUtil[_0x55fa('0x75')](_0x31881c)[_0x55fa('0x1d')](function(){return validateUser(_0x31881c[0x0]);})[_0x55fa('0x1d')](function(){for(var _0x137b13=0x1;_0x137b13<_0x31881c[_0x55fa('0x46')];_0x137b13++){var _0x90f6a1=_0x31881c[_0x137b13-0x1]['internal'];if(!_0x31881c[_0x137b13][_0x55fa('0x58')])_0x31881c[_0x137b13][_0x55fa('0x58')]=_0x90f6a1+0x1;_0xe933f3[_0x55fa('0x43')](validateUser(_0x31881c[_0x137b13]));}return Promise[_0x55fa('0x4b')](_0xe933f3);})['then'](function(){_0xe933f3=[];for(var _0x126d16=0x0;_0x126d16<_0x31881c['length'];_0x126d16++){_0xe933f3['push'](updateUser(_0x31881c[_0x126d16]));}return Promise[_0x55fa('0x4b')](_0xe933f3);})[_0x55fa('0x1d')](function(){_0xe933f3=_0x31881c['map'](function(_0x5c35bd){return db[_0x55fa('0x32')][_0x55fa('0x71')](_0x5c35bd,{'include':[{'model':db['VoiceMail'],'as':'VoiceMail'}]})[_0x55fa('0x1d')](function(_0x495e80){_0x5c35bd['id']=_0x495e80['id'];return _0x5c35bd;});});return Promise[_0x55fa('0x4b')](_0xe933f3);})[_0x55fa('0x1d')](function(_0x588c96){if(_0x3fbad3[_0x55fa('0x53')][_0x55fa('0x1e')]===_0x55fa('0x23'))return _0x588c96;if(_0x3fbad3['user'][_0x55fa('0x1e')]!=='user')return _0x588c96;var _0x335229=_[_0x55fa('0x7c')](_0x588c96,function(_0xc0a022){return _0xc0a022[_0x55fa('0x1e')]===_0x55fa('0x25')||_0xc0a022[_0x55fa('0x1e')]==='telephone';});if(!_0x335229)return _0x588c96;return db[_0x55fa('0x7e')][_0x55fa('0x7f')]({'where':{'name':{'$or':[_0x55fa('0x24'),_0x55fa('0x26')]},'userProfileId':_0x3fbad3['user'][_0x55fa('0x77')]},'raw':!![]})[_0x55fa('0x1d')](function(_0xfeff3c){if(_['isEmpty'](_0xfeff3c)||!_[_0x55fa('0x7c')](_0xfeff3c,['autoAssociation',0x0]))return _0x588c96;_0xe933f3=[];var _0xc62b2b=_(_0xfeff3c)['map'](function(_0x316ba8){if(_0x316ba8[_0x55fa('0x78')]===0x1)return;return _0x316ba8[_0x55fa('0x2e')]==='Agents'?_0x55fa('0x25'):_0x55fa('0x27');})['compact']()[_0x55fa('0x2b')]();for(var _0x58123e=0x0;_0x58123e<_0x588c96[_0x55fa('0x46')];_0x58123e++){if(!_[_0x55fa('0x2c')](_0xc62b2b,_0x588c96[_0x58123e][_0x55fa('0x1e')]))return;var _0x3e54db=_0x588c96[_0x58123e][_0x55fa('0x1e')]===_0x55fa('0x25')?_0x55fa('0x24'):_0x55fa('0x26');_0xe933f3[_0x55fa('0x43')](db[_0x55fa('0x79')][_0x55fa('0x71')]({'name':_0x588c96[_0x58123e][_0x55fa('0x2e')],'resourceId':_0x588c96[_0x58123e]['id'],'type':_0x3e54db,'sectionId':_['find'](_0xfeff3c,[_0x55fa('0x2e'),_0x3e54db])['id']},{}));}return Promise[_0x55fa('0x4b')](_0xe933f3);});})[_0x55fa('0x1d')](respondWithResult(_0x15584f,0xc9))[_0x55fa('0x52')](handleError(_0x15584f,null));};exports[_0x55fa('0x80')]=function(_0x4637b8,_0x3850c7){if(_0x4637b8[_0x55fa('0x53')]['id']){delete _0x4637b8[_0x55fa('0x53')]['id'];}return db[_0x55fa('0x32')][_0x55fa('0x2d')]({'where':{'id':_0x4637b8[_0x55fa('0x4d')]['id']}})[_0x55fa('0x1d')](function(_0x51cb3f){if(!_0x51cb3f)return null;if(_0x51cb3f['id']===_0x4637b8[_0x55fa('0x23')]['id']){if(!_0x4637b8[_0x55fa('0x53')][_0x55fa('0x81')]||!_0x4637b8[_0x55fa('0x53')]['newPassword']){throw new db[(_0x55fa('0x82'))][(_0x55fa('0x83'))](_0x55fa('0x84'));}if(!_0x51cb3f[_0x55fa('0x85')](_0x4637b8[_0x55fa('0x53')][_0x55fa('0x81')])){throw new db[(_0x55fa('0x82'))][(_0x55fa('0x83'))](_0x55fa('0x86'));}if(_0x4637b8[_0x55fa('0x53')][_0x55fa('0x81')]===_0x4637b8[_0x55fa('0x53')][_0x55fa('0x87')]){throw new db[(_0x55fa('0x82'))]['ValidationError'](_0x55fa('0x88'));}}else if(_0x4637b8[_0x55fa('0x23')][_0x55fa('0x1e')]===_0x55fa('0x22')){if(!_0x4637b8[_0x55fa('0x53')][_0x55fa('0x87')]){throw new db['Sequelize'][(_0x55fa('0x83'))](_0x55fa('0x89'));}}else if(_0x4637b8[_0x55fa('0x23')][_0x55fa('0x1e')]===_0x55fa('0x23')){if(!_0x4637b8[_0x55fa('0x53')][_0x55fa('0x87')]){throw new db[(_0x55fa('0x82'))][(_0x55fa('0x83'))](_0x55fa('0x89'));}if(_0x51cb3f['role']!==_0x55fa('0x25')){throw new db[(_0x55fa('0x82'))]['ValidationError']('Unauthorized');}}else{throw new db[(_0x55fa('0x82'))][(_0x55fa('0x83'))]('Unauthorized');}return _0x51cb3f;})[_0x55fa('0x1d')](handleEntityNotFound(_0x3850c7,null))[_0x55fa('0x1d')](function(_0x496af3){return db[_0x55fa('0x59')][_0x55fa('0x8a')]({'attributes':['id',_0x55fa('0x5a'),_0x55fa('0x8b'),_0x55fa('0x8c')]})[_0x55fa('0x1d')](function(_0x214857){if(_0x214857['securePassword'])authService['validatePasswordPattern'](_0x4637b8[_0x55fa('0x53')][_0x55fa('0x87')]);if(!_0x214857[_0x55fa('0x8b')]||!_0x496af3[_0x55fa('0x37')])return _0x496af3;authService[_0x55fa('0x8d')](_0x4637b8['body']['newPassword'],_0x496af3[_0x55fa('0x37')],_0x214857[_0x55fa('0x8c')]);return _0x496af3;})[_0x55fa('0x1d')](saveUpdates({'password':_0x4637b8['body'][_0x55fa('0x87')],'passwordResetAt':_0x4637b8[_0x55fa('0x23')]['id']==_0x4637b8['params']['id']?moment():null,'previousPasswords':authService[_0x55fa('0x8e')](_0x4637b8[_0x55fa('0x53')][_0x55fa('0x87')],_0x496af3[_0x55fa('0x37')])},null));})[_0x55fa('0x1d')](respondWithResult(_0x3850c7,null))[_0x55fa('0x52')](handleError(_0x3850c7,null));};exports[_0x55fa('0x8f')]=function(_0x2ae361,_0x2dc6aa){var _0xdfd584=_0x2ae361[_0x55fa('0x53')]['channel'];return db[_0x55fa('0x32')][_0x55fa('0x2d')]({'where':{'id':_0x2ae361[_0x55fa('0x4d')]['id']},'attributes':['id',_0x55fa('0x2e'),'role','online',_0x55fa('0x90'),_0x55fa('0x91'),_0x55fa('0x92')]})[_0x55fa('0x1d')](handleEntityNotFound(_0x2dc6aa,null))[_0x55fa('0x1d')](function(_0x2360b3){if(_0x2360b3){if(!utils[_0x55fa('0x93')](_0xdfd584)){throw new db[(_0x55fa('0x82'))][(_0x55fa('0x83'))]('Unknown\x20channel');}return _0x2360b3[_0x55fa('0x94')+_[_0x55fa('0x95')](_0xdfd584['toLowerCase']())+_0x55fa('0x96')](_0x2ae361['body'][_0x55fa('0x56')],{'penalty':_0x2ae361[_0x55fa('0x53')][_0x55fa('0x97')]||0x0})['spread'](function(_0x34110d){for(var _0x7fd7bf=0x0;_0x7fd7bf<_0x2ae361[_0x55fa('0x53')][_0x55fa('0x56')][_0x55fa('0x46')];_0x7fd7bf+=0x1){var _0x5e3860={'UserId':Number(_0x2ae361[_0x55fa('0x4d')]['id'])};_0x5e3860[_['capitalize'](_0xdfd584[_0x55fa('0x98')]())+'QueueId']=Number(_0x2ae361['body'][_0x55fa('0x56')][_0x7fd7bf]);socket['emit'](_0x55fa('0x23')+_['capitalize'](_0xdfd584[_0x55fa('0x98')]())+_0x55fa('0x99'),_0x5e3860);}return _0x34110d;})[_0x55fa('0x1d')](function(){if(_0xdfd584===_0x55fa('0x9a')){return db['VoiceQueue'][_0x55fa('0x7f')]({'where':{'id':_0x2ae361['body'][_0x55fa('0x56')]||[]},'raw':!![],'attributes':['id',_0x55fa('0x2e')]});}})[_0x55fa('0x1d')](function(_0x2576e8){var _0x3abe5a=_0x2360b3[_0x55fa('0x9b')]({'plain':!![]});var _0x1149ce=[];if(_0xdfd584===_0x55fa('0x9a')&&_0x3abe5a[_0x55fa('0x1e')]==='agent'&&_0x3abe5a[_0x55fa('0x9c')]){for(let _0x567dbd=0x0;_0x567dbd<_0x2576e8[_0x55fa('0x46')];_0x567dbd+=0x1){_0x1149ce['push']({'membername':_0x3abe5a[_0x55fa('0x2e')],'UserId':_0x3abe5a['id'],'queue_name':_0x2576e8[_0x567dbd]['name'],'VoiceQueueId':_0x2576e8[_0x567dbd]['id'],'interface':_[_0x55fa('0x5c')](_0x3abe5a[_0x55fa('0x92')])?util[_0x55fa('0x9d')](_0x55fa('0x9e'),_0x3abe5a[_0x55fa('0x2e')]):_0x3abe5a[_0x55fa('0x92')],'paused':_0x3abe5a[_0x55fa('0x91')]||![],'penalty':_0x2ae361[_0x55fa('0x53')]['penalty']||0x0});}return Promise['all'](_0x1149ce[_0x55fa('0x2a')](function(_0x39bccf){return db[_0x55fa('0x9f')][_0x55fa('0xa0')](_0x39bccf);}));}return _0x2360b3;});}})[_0x55fa('0x1d')](respondWithStatusCode(_0x2dc6aa,null))[_0x55fa('0x52')](handleError(_0x2dc6aa,null));};exports[_0x55fa('0xa1')]=function(_0x5cf3d5,_0x4f4aba){var _0x409a09,_0x4491bb;return db['User'][_0x55fa('0x2d')]({'where':{'id':_0x5cf3d5['params']['id']},'attributes':['id','name',_0x55fa('0x1e')]})[_0x55fa('0x1d')](handleEntityNotFound(_0x4f4aba,null))['then'](function(_0x1f8f19){if(_0x1f8f19){_0x409a09=_0x1f8f19;if(!_0x5cf3d5[_0x55fa('0x3d')][_0x55fa('0xa2')]||!utils[_0x55fa('0x93')](_0x5cf3d5['query']['channel'])){throw new db[(_0x55fa('0x82'))][(_0x55fa('0x83'))](_0x55fa('0xa3'));}return _0x1f8f19['remove'+_[_0x55fa('0x95')](_0x5cf3d5[_0x55fa('0x3d')][_0x55fa('0xa2')][_0x55fa('0x98')]())+_0x55fa('0x96')](_0x5cf3d5[_0x55fa('0x3d')][_0x55fa('0x56')]);}})[_0x55fa('0x1d')](function(_0x585308){if(_[_0x55fa('0xa4')](_0x5cf3d5[_0x55fa('0x3d')]['ids'])){for(var _0x49a4f5=0x0;_0x49a4f5<_0x5cf3d5[_0x55fa('0x3d')]['ids']['length'];_0x49a4f5+=0x1){_0x4491bb={'UserId':Number(_0x5cf3d5['params']['id'])};_0x4491bb[_[_0x55fa('0x95')](_0x5cf3d5[_0x55fa('0x3d')][_0x55fa('0xa2')]['toLowerCase']())+_0x55fa('0xa5')]=Number(_0x5cf3d5[_0x55fa('0x3d')][_0x55fa('0x56')][_0x49a4f5]);socket[_0x55fa('0x1f')](_0x55fa('0x23')+_['capitalize'](_0x5cf3d5[_0x55fa('0x3d')][_0x55fa('0xa2')]['toLowerCase']())+'Queue:remove',_0x4491bb);}}else{_0x4491bb={'UserId':Number(_0x5cf3d5[_0x55fa('0x4d')]['id'])};_0x4491bb[_[_0x55fa('0x95')](_0x5cf3d5[_0x55fa('0x3d')][_0x55fa('0xa2')][_0x55fa('0x98')]())+_0x55fa('0xa5')]=Number(_0x5cf3d5['query'][_0x55fa('0x56')]);socket['emit'](_0x55fa('0x23')+_[_0x55fa('0x95')](_0x5cf3d5['query'][_0x55fa('0xa2')][_0x55fa('0x98')]())+_0x55fa('0xa6'),_0x4491bb);}return _0x585308;})[_0x55fa('0x1d')](function(){if(_0x5cf3d5[_0x55fa('0x3d')][_0x55fa('0xa2')]===_0x55fa('0x9a')){return db[_0x55fa('0x9f')][_0x55fa('0x21')]({'where':{'UserId':_0x5cf3d5['params']['id'],'VoiceQueueId':_0x5cf3d5['query'][_0x55fa('0x56')]},'individualHooks':!![]})[_0x55fa('0x1d')](function(){return _0x409a09;});}return _0x409a09;})[_0x55fa('0x1d')](respondWithStatusCode(_0x4f4aba,null))['catch'](handleError(_0x4f4aba,null));};exports[_0x55fa('0xa7')]=function(_0x4ecaeb,_0xe2fe83){_0x4ecaeb[_0x55fa('0x53')][_0x55fa('0xa8')]=_0x4ecaeb[_0x55fa('0xa9')]['filename'];return db[_0x55fa('0x32')][_0x55fa('0x2d')]({'where':{'id':_0x4ecaeb[_0x55fa('0x4d')]['id']}})[_0x55fa('0x1d')](handleEntityNotFound(_0xe2fe83,null))['then'](saveUpdates(_0x4ecaeb[_0x55fa('0x53')],null))[_0x55fa('0x1d')](respondWithResult(_0xe2fe83,null))[_0x55fa('0x52')](handleError(_0xe2fe83,null));};exports['getAvatar']=function(_0x5c8ed2,_0x570e92){var _0x202ec0=path[_0x55fa('0xaa')](config['root'],_0x55fa('0xab'));return db[_0x55fa('0x32')][_0x55fa('0x2d')]({'where':{'id':_0x5c8ed2[_0x55fa('0x4d')]['id']},'attributes':['id',_0x55fa('0xa8')],'raw':!![]})[_0x55fa('0x1d')](handleEntityNotFound(_0x570e92,null))[_0x55fa('0x1d')](function(_0x282ec2){if(_0x282ec2){if(_[_0x55fa('0x5c')](_0x282ec2[_0x55fa('0xa8')])){return _0x570e92[_0x55fa('0xac')](_0x202ec0);}else{if(!fs['existsSync'](path[_0x55fa('0xaa')](config[_0x55fa('0xad')],_0x55fa('0xae'),_0x282ec2[_0x55fa('0xa8')]))){return _0x570e92['download'](_0x202ec0);}return _0x570e92[_0x55fa('0xac')](path['join'](config[_0x55fa('0xad')],_0x55fa('0xae'),_0x282ec2[_0x55fa('0xa8')]));}}})[_0x55fa('0x52')](handleError(_0x570e92,null));};exports[_0x55fa('0xaf')]=function(_0x37bb92,_0x4716b1){return db['User'][_0x55fa('0x2d')]({'where':{'id':_0x37bb92[_0x55fa('0x4d')]['id']},'attributes':['id']})[_0x55fa('0x1d')](handleEntityNotFound(_0x4716b1,null))['then'](function(_0x1a22ef){var _0x391db8=[];values=_0x1a22ef['dataValues'];_0x391db8[_0x55fa('0x43')](get_open_tabs(_0x55fa('0x47'),_0x1a22ef['dataValues']));_0x391db8[_0x55fa('0x43')](get_open_tabs(_0x55fa('0x49'),_0x1a22ef['dataValues']));_0x391db8[_0x55fa('0x43')](get_open_tabs(_0x55fa('0xb0'),_0x1a22ef['dataValues']));_0x391db8[_0x55fa('0x43')](get_open_tabs(_0x55fa('0x50'),_0x1a22ef['dataValues']));_0x391db8[_0x55fa('0x43')](get_open_tabs(_0x55fa('0x51'),_0x1a22ef['dataValues']));_0x391db8[_0x55fa('0x43')](get_open_tabs(_0x55fa('0x4a'),_0x1a22ef['dataValues']));return Promise['all'](_0x391db8);})[_0x55fa('0x1d')](function(_0x19f8ac){if(_0x19f8ac){var _0x2b8ed7=_[_0x55fa('0x2a')](values[_0x55fa('0xb1')],function(_0x47e0ac){return{'channel':_0x55fa('0xb2'),'id':_0x47e0ac['id'],'createdAt':_0x47e0ac[_0x55fa('0xb3')]};});var _0x127296=_[_0x55fa('0x2a')](values[_0x55fa('0xb4')],function(_0x547c36){return{'channel':'FAX','id':_0x547c36['id'],'createdAt':_0x547c36[_0x55fa('0xb3')]};});var _0xa0c26a=_[_0x55fa('0x2a')](values[_0x55fa('0xb5')],function(_0x1afa66){return{'channel':_0x55fa('0xb6'),'id':_0x1afa66['id'],'createdAt':_0x1afa66[_0x55fa('0xb3')]};});var _0x41219d=_[_0x55fa('0x2a')](values['MailOpenTabs'],function(_0x55d019){return{'channel':'MAIL','id':_0x55d019['id'],'createdAt':_0x55d019['createdAt']};});var _0xd3dcc6=_[_0x55fa('0x2a')](values[_0x55fa('0xb7')],function(_0x52bb23){return{'channel':'SMS','id':_0x52bb23['id'],'createdAt':_0x52bb23[_0x55fa('0xb3')]};});var _0xaa2d74=_['map'](values[_0x55fa('0xb8')],function(_0x3388df){return{'channel':_0x55fa('0xb9'),'id':_0x3388df['id'],'createdAt':_0x3388df[_0x55fa('0xb3')]};});var _0x2a48cc=_[_0x55fa('0xba')](_0x2b8ed7,_0x127296,_0xa0c26a,_0x41219d,_0xd3dcc6,_0xaa2d74);var _0x540c17={'count':_0x2a48cc['length'],'rows':_0x2a48cc};return _0x540c17;}else return null;})[_0x55fa('0x1d')](respondWithResult(_0x4716b1,null))[_0x55fa('0x52')](handleError(_0x4716b1,null));};exports[_0x55fa('0xbb')]=function(_0x497267,_0x19b244){var _0x99426e={};return db[_0x55fa('0x32')][_0x55fa('0x8a')]({'where':{'id':_0x497267['params']['id']}})[_0x55fa('0x1d')](function(_0x18f8d5){if(!_0x18f8d5){throw new APINotFoundError(util['format'](_0x55fa('0xbc'),_0x497267[_0x55fa('0x4d')]['id']));}return contacts[_0x55fa('0x54')]();})[_0x55fa('0x1d')](function(_0x6141c2){_0x497267[_0x55fa('0x3d')][_0x55fa('0x32')]=_0x497267[_0x55fa('0x4d')]['id'];_0x99426e=qs[_0x55fa('0x3b')](_0x6141c2,_0x497267);if(_0x497267[_0x55fa('0x3d')][_0x55fa('0xbd')](_0x55fa('0x3e'))){_0x99426e['include']=[{'model':db[_0x55fa('0xbe')],'as':_0x55fa('0xbf'),'required':![]},{'model':db[_0x55fa('0xc0')],'as':_0x55fa('0xc1'),'attributes':['id',_0x55fa('0x2e'),'color'],'where':_0x497267['query'][_0x55fa('0xc2')]?{'id':_0x497267[_0x55fa('0x3d')][_0x55fa('0xc2')]}:undefined,'required':_0x497267[_0x55fa('0x3d')][_0x55fa('0xc2')]?!![]:![]}];}return contacts[_0x55fa('0x7f')](_0x497267[_0x55fa('0x3d')],_0x497267[_0x55fa('0x23')],_0x99426e,_0x6141c2);})[_0x55fa('0x1d')](respondWithFilteredResult(_0x19b244,_0x99426e))[_0x55fa('0x52')](APIHandleError(_0x19b244));};exports[_0x55fa('0xc3')]=function(_0x1eb0ea,_0x4f9d9f){var _0x3cd309;var _0x2f443e={};var _0xfe2bb0;return db[_0x55fa('0x32')][_0x55fa('0x8a')]({'where':{'id':_0x1eb0ea[_0x55fa('0x4d')]['id']},'attributes':['id','name',_0x55fa('0x1e')]})['then'](handleEntityNotFound(_0x4f9d9f,null))[_0x55fa('0x1d')](function(_0x55f4d5){if(!utils['isValidChannel'](_0x1eb0ea[_0x55fa('0x3d')][_0x55fa('0xa2')])){throw new db['Sequelize'][(_0x55fa('0x83'))]('Unknown\x20channel');}_0x3cd309=_0x55f4d5;var _0x4ee9d0={};_0x4ee9d0['model']=_['keys'](db[_[_0x55fa('0x95')](_0x1eb0ea[_0x55fa('0x3d')]['channel'])+_0x55fa('0xc4')][_0x55fa('0xc5')]);_0x4ee9d0['query']=_[_0x55fa('0xc6')](_0x1eb0ea[_0x55fa('0x3d')]);_0x4ee9d0['filters']=_[_0x55fa('0xc7')](_0x4ee9d0[_0x55fa('0xc8')],_0x4ee9d0[_0x55fa('0x3d')]);_0x2f443e[_0x55fa('0x42')]=_[_0x55fa('0xc7')](_0x4ee9d0[_0x55fa('0xc8')],qs[_0x55fa('0xc9')](_0x1eb0ea[_0x55fa('0x3d')][_0x55fa('0xc9')]));_0x2f443e[_0x55fa('0x42')]=_0x2f443e[_0x55fa('0x42')]['length']?_0x2f443e[_0x55fa('0x42')]:_0x4ee9d0[_0x55fa('0xc8')];_0x2f443e[_0x55fa('0xca')]=qs[_0x55fa('0xcb')](_0x1eb0ea['query'][_0x55fa('0xcb')]);_0x2f443e[_0x55fa('0xcc')]=qs[_0x55fa('0xcd')](_[_0x55fa('0xce')](_0x1eb0ea[_0x55fa('0x3d')],_0x4ee9d0[_0x55fa('0xcd')]));if(_0x1eb0ea['query'][_0x55fa('0x28')]){_0x2f443e['where']=_['merge'](_0x2f443e[_0x55fa('0xcc')],{'$or':_[_0x55fa('0x2a')](_0x2f443e[_0x55fa('0x42')],function(_0x77a7c0){var _0x2477f8={};_0x2477f8[_0x77a7c0]={'$like':'%'+_0x1eb0ea[_0x55fa('0x3d')]['filter']+'%'};return _0x2477f8;})});}_0x2f443e=_[_0x55fa('0x4f')]({},_0x2f443e,_0x1eb0ea['options']);switch(_0x3cd309[_0x55fa('0x1e')]){case _0x55fa('0x22'):return db[_['capitalize'](_0x1eb0ea['query'][_0x55fa('0xa2')])+_0x55fa('0xc4')][_0x55fa('0x7f')](_0x2f443e);case _0x55fa('0x23'):case _0x55fa('0x25'):return _0x3cd309[_0x55fa('0x9b')+_[_0x55fa('0x95')](_0x1eb0ea['query']['channel'])+_0x55fa('0x96')](_0x2f443e);default:throw new db[(_0x55fa('0x82'))][(_0x55fa('0x83'))]('Unknown\x20role');}})[_0x55fa('0x1d')](function(_0x5273f6){_0xfe2bb0=_0x5273f6[_0x55fa('0x46')];if(!_0x1eb0ea[_0x55fa('0x3d')]['hasOwnProperty'](_0x55fa('0xcf'))){_0x2f443e[_0x55fa('0x19')]=qs[_0x55fa('0x19')](_0x1eb0ea[_0x55fa('0x3d')][_0x55fa('0x19')]);_0x2f443e[_0x55fa('0x1a')]=qs[_0x55fa('0x1a')](_0x1eb0ea[_0x55fa('0x3d')][_0x55fa('0x1a')]);}switch(_0x3cd309[_0x55fa('0x1e')]){case'admin':return db[_[_0x55fa('0x95')](_0x1eb0ea['query'][_0x55fa('0xa2')])+'Queue'][_0x55fa('0x7f')](_0x2f443e);case _0x55fa('0x23'):case _0x55fa('0x25'):return _0x3cd309[_0x55fa('0x9b')+_['capitalize'](_0x1eb0ea[_0x55fa('0x3d')][_0x55fa('0xa2')])+_0x55fa('0x96')](_0x2f443e);}})['then'](function(_0x3932f5){return{'count':_0xfe2bb0,'rows':_0x3932f5};})[_0x55fa('0x1d')](respondWithResult(_0x4f9d9f,null))[_0x55fa('0x52')](handleError(_0x4f9d9f,null));};exports['getVoiceQueuesRt']=function(_0x460e42,_0x41548a){var _0x43df83={};var _0x384d1d={};var _0x13217f;var _0x318a0b;return db[_0x55fa('0x32')][_0x55fa('0x8a')]({'where':{'id':_0x460e42[_0x55fa('0x4d')]['id']}})[_0x55fa('0x1d')](handleEntityNotFound(_0x41548a,null))['then'](function(_0x19feff){if(_0x19feff){_0x13217f=_0x19feff;_0x384d1d[_0x55fa('0xc8')]=_[_0x55fa('0xc6')](db[_0x55fa('0x9f')][_0x55fa('0xc5')]);_0x384d1d['query']=_['keys'](_0x460e42['query']);_0x384d1d[_0x55fa('0xcd')]=_[_0x55fa('0xc7')](_0x384d1d[_0x55fa('0xc8')],_0x384d1d[_0x55fa('0x3d')]);_0x43df83[_0x55fa('0x42')]=_['intersection'](_0x384d1d[_0x55fa('0xc8')],qs['fields'](_0x460e42[_0x55fa('0x3d')]['fields']));_0x43df83[_0x55fa('0x42')]=_0x43df83[_0x55fa('0x42')]['length']?_0x43df83['attributes']:_0x384d1d[_0x55fa('0xc8')];_0x43df83[_0x55fa('0xca')]=qs[_0x55fa('0xcb')](_0x460e42[_0x55fa('0x3d')][_0x55fa('0xcb')]);_0x43df83[_0x55fa('0xcc')]=qs[_0x55fa('0xcd')](_['pick'](_0x460e42[_0x55fa('0x3d')],_0x384d1d[_0x55fa('0xcd')]));if(_0x460e42[_0x55fa('0x3d')][_0x55fa('0x28')]){_0x43df83[_0x55fa('0xcc')]=_['merge'](_0x43df83['where'],{'$or':_[_0x55fa('0x2a')](_0x43df83[_0x55fa('0x42')],function(_0x432754){var _0x1ab4d0={};_0x1ab4d0[_0x432754]={'$like':'%'+_0x460e42[_0x55fa('0x3d')][_0x55fa('0x28')]+'%'};return _0x1ab4d0;})});}_0x43df83=_[_0x55fa('0x4f')]({},_0x43df83,_0x460e42['options']);return _0x13217f['getVoiceQueuesRt'](_0x43df83);}})[_0x55fa('0x1d')](function(_0x58b746){if(_0x58b746){_0x318a0b=_0x58b746['length'];if(!_0x460e42[_0x55fa('0x3d')]['hasOwnProperty'](_0x55fa('0xcf'))){_0x43df83[_0x55fa('0x19')]=qs[_0x55fa('0x19')](_0x460e42[_0x55fa('0x3d')][_0x55fa('0x19')]);_0x43df83['offset']=qs[_0x55fa('0x1a')](_0x460e42[_0x55fa('0x3d')]['offset']);}return _0x13217f[_0x55fa('0xd0')](_0x43df83);}})['then'](function(_0x436909){if(_0x436909){return _0x436909?{'count':_0x318a0b,'rows':_0x436909}:null;}})['then'](respondWithResult(_0x41548a,null))[_0x55fa('0x52')](handleError(_0x41548a,null));};exports[_0x55fa('0xd1')]=function(_0x3010dc,_0x5aa7bf){var _0xcc945f={};var _0x3af4f5={};var _0xa9790;var _0x227e4f;return db['User'][_0x55fa('0x8a')]({'where':{'id':_0x3010dc[_0x55fa('0x4d')]['id']}})[_0x55fa('0x1d')](handleEntityNotFound(_0x5aa7bf,null))[_0x55fa('0x1d')](function(_0x690bc8){if(_0x690bc8){_0xa9790=_0x690bc8;_0x3af4f5[_0x55fa('0xc8')]=_[_0x55fa('0xc6')](db[_0x55fa('0xd2')]['rawAttributes']);_0x3af4f5[_0x55fa('0x3d')]=_[_0x55fa('0xc6')](_0x3010dc['query']);_0x3af4f5[_0x55fa('0xcd')]=_['intersection'](_0x3af4f5[_0x55fa('0xc8')],_0x3af4f5[_0x55fa('0x3d')]);_0xcc945f['attributes']=_[_0x55fa('0xc7')](_0x3af4f5[_0x55fa('0xc8')],qs['fields'](_0x3010dc[_0x55fa('0x3d')][_0x55fa('0xc9')]));_0xcc945f[_0x55fa('0x42')]=_0xcc945f[_0x55fa('0x42')]['length']?_0xcc945f[_0x55fa('0x42')]:_0x3af4f5['model'];_0xcc945f[_0x55fa('0xca')]=qs[_0x55fa('0xcb')](_0x3010dc[_0x55fa('0x3d')][_0x55fa('0xcb')]);_0xcc945f['where']=qs[_0x55fa('0xcd')](_['pick'](_0x3010dc[_0x55fa('0x3d')],_0x3af4f5[_0x55fa('0xcd')]));if(_0x3010dc[_0x55fa('0x3d')][_0x55fa('0x28')]){_0xcc945f['where']=_[_0x55fa('0x4f')](_0xcc945f[_0x55fa('0xcc')],{'$or':_[_0x55fa('0x2a')](_0xcc945f[_0x55fa('0x42')],function(_0x1ad432){var _0x3b0408={};_0x3b0408[_0x1ad432]={'$like':'%'+_0x3010dc[_0x55fa('0x3d')][_0x55fa('0x28')]+'%'};return _0x3b0408;})});}_0xcc945f=_['merge']({},_0xcc945f,_0x3010dc[_0x55fa('0xd3')]);return _0xa9790[_0x55fa('0xd1')](_0xcc945f);}})['then'](function(_0x3315d4){if(_0x3315d4){_0x227e4f=_0x3315d4[_0x55fa('0x46')];if(!_0x3010dc[_0x55fa('0x3d')]['hasOwnProperty'](_0x55fa('0xcf'))){_0xcc945f[_0x55fa('0x19')]=qs[_0x55fa('0x19')](_0x3010dc['query'][_0x55fa('0x19')]);_0xcc945f[_0x55fa('0x1a')]=qs[_0x55fa('0x1a')](_0x3010dc['query'][_0x55fa('0x1a')]);}return _0xa9790[_0x55fa('0xd1')](_0xcc945f);}})[_0x55fa('0x1d')](function(_0x108687){if(_0x108687){return _0x108687?{'count':_0x227e4f,'rows':_0x108687}:null;}})['then'](respondWithResult(_0x5aa7bf,null))[_0x55fa('0x52')](handleError(_0x5aa7bf,null));};exports[_0x55fa('0xd4')]=function(_0x157230,_0x3395ab){var _0x2f7935={'raw':!![],'where':{}};var _0xc9b83b={};var _0x30b8a0={'count':0x0,'rows':[]};return db['User'][_0x55fa('0x8a')]({'where':{'id':_0x157230[_0x55fa('0x4d')]['id']}})[_0x55fa('0x1d')](handleEntityNotFound(_0x3395ab,null))['then'](function(_0x2ade49){if(_0x2ade49){_0xc9b83b[_0x55fa('0xc8')]=_['keys'](db[_0x55fa('0xd5')][_0x55fa('0xc5')]);_0xc9b83b[_0x55fa('0x3d')]=_[_0x55fa('0xc6')](_0x157230[_0x55fa('0x3d')]);_0xc9b83b[_0x55fa('0xcd')]=_[_0x55fa('0xc7')](_0xc9b83b[_0x55fa('0xc8')],_0xc9b83b['query']);_0x2f7935['attributes']=_[_0x55fa('0xc7')](_0xc9b83b[_0x55fa('0xc8')],qs[_0x55fa('0xc9')](_0x157230[_0x55fa('0x3d')][_0x55fa('0xc9')]));_0x2f7935[_0x55fa('0x42')]=_0x2f7935[_0x55fa('0x42')][_0x55fa('0x46')]?_0x2f7935[_0x55fa('0x42')]:_0xc9b83b[_0x55fa('0xc8')];if(!_0x157230[_0x55fa('0x3d')][_0x55fa('0xbd')]('nolimit')){_0x2f7935[_0x55fa('0x19')]=qs[_0x55fa('0x19')](_0x157230[_0x55fa('0x3d')][_0x55fa('0x19')]);_0x2f7935[_0x55fa('0x1a')]=qs[_0x55fa('0x1a')](_0x157230[_0x55fa('0x3d')][_0x55fa('0x1a')]);}_0x2f7935[_0x55fa('0xca')]=qs[_0x55fa('0xcb')](_0x157230[_0x55fa('0x3d')]['sort']);_0x2f7935[_0x55fa('0xcc')]=qs[_0x55fa('0xcd')](_['pick'](_0x157230[_0x55fa('0x3d')],_0xc9b83b['filters']));_0x2f7935[_0x55fa('0xcc')][_0x55fa('0xd6')]=_0x2ade49['id'];if(_0x157230[_0x55fa('0x3d')][_0x55fa('0x28')]){_0x2f7935['where']=_[_0x55fa('0x4f')](_0x2f7935['where'],{'$or':_[_0x55fa('0x2a')](_0x2f7935['attributes'],function(_0x1ea14f){var _0x30b9ec={};_0x30b9ec[_0x1ea14f]={'$like':'%'+_0x157230[_0x55fa('0x3d')][_0x55fa('0x28')]+'%'};return _0x30b9ec;})});}_0x2f7935=_[_0x55fa('0x4f')]({},_0x2f7935,_0x157230[_0x55fa('0xd3')]);return db['VoiceRecording'][_0x55fa('0x3c')]({'where':_0x2f7935[_0x55fa('0xcc')]})[_0x55fa('0x1d')](function(_0x27eb75){_0x30b8a0['count']=_0x27eb75;if(_0x157230[_0x55fa('0x3d')][_0x55fa('0x3e')]){_0x2f7935['include']=[{'all':!![]}];}return db[_0x55fa('0xd5')]['findAll'](_0x2f7935);})[_0x55fa('0x1d')](function(_0x10332c){_0x30b8a0[_0x55fa('0x45')]=_0x10332c;return _0x30b8a0;});}})['then'](respondWithFilteredResult(_0x3395ab,_0x2f7935))[_0x55fa('0x52')](handleError(_0x3395ab,null));};exports[_0x55fa('0xd7')]=function(_0x4ea53e,_0x4a4c82){var _0x125b41={'raw':!![],'where':{}};var _0x5bcb95={};var _0x54a487={'count':0x0,'rows':[]};return db['User'][_0x55fa('0x8a')]({'where':{'id':_0x4ea53e[_0x55fa('0x4d')]['id']}})[_0x55fa('0x1d')](handleEntityNotFound(_0x4a4c82,null))[_0x55fa('0x1d')](function(_0x107989){if(_0x107989){_0x5bcb95[_0x55fa('0xc8')]=_['keys'](db[_0x55fa('0xd8')][_0x55fa('0xc5')]);_0x5bcb95['query']=_[_0x55fa('0xc6')](_0x4ea53e[_0x55fa('0x3d')]);_0x5bcb95[_0x55fa('0xcd')]=_[_0x55fa('0xc7')](_0x5bcb95[_0x55fa('0xc8')],_0x5bcb95[_0x55fa('0x3d')]);_0x125b41['attributes']=_[_0x55fa('0xc7')](_0x5bcb95[_0x55fa('0xc8')],qs[_0x55fa('0xc9')](_0x4ea53e['query'][_0x55fa('0xc9')]));_0x125b41[_0x55fa('0x42')]=_0x125b41[_0x55fa('0x42')]['length']?_0x125b41[_0x55fa('0x42')]:_0x5bcb95[_0x55fa('0xc8')];if(!_0x4ea53e[_0x55fa('0x3d')][_0x55fa('0xbd')](_0x55fa('0xcf'))){_0x125b41[_0x55fa('0x19')]=qs[_0x55fa('0x19')](_0x4ea53e[_0x55fa('0x3d')][_0x55fa('0x19')]);_0x125b41['offset']=qs['offset'](_0x4ea53e[_0x55fa('0x3d')][_0x55fa('0x1a')]);}_0x125b41[_0x55fa('0xca')]=qs['sort'](_0x4ea53e['query'][_0x55fa('0xcb')]);_0x125b41[_0x55fa('0xcc')]=qs[_0x55fa('0xcd')](_[_0x55fa('0xce')](_0x4ea53e['query'],_0x5bcb95['filters']));_0x125b41[_0x55fa('0xcc')][_0x55fa('0xd6')]=_0x107989['id'];if(_0x4ea53e[_0x55fa('0x3d')][_0x55fa('0x28')]){_0x125b41['where']=_[_0x55fa('0x4f')](_0x125b41[_0x55fa('0xcc')],{'$or':_[_0x55fa('0x2a')](_0x125b41[_0x55fa('0x42')],function(_0x1079da){var _0x25781e={};_0x25781e[_0x1079da]={'$like':'%'+_0x4ea53e['query']['filter']+'%'};return _0x25781e;})});}_0x125b41=_['merge']({},_0x125b41,_0x4ea53e['options']);return db[_0x55fa('0xd8')]['count']({'where':_0x125b41[_0x55fa('0xcc')]})[_0x55fa('0x1d')](function(_0x1406e7){_0x54a487[_0x55fa('0x3c')]=_0x1406e7;if(_0x4ea53e[_0x55fa('0x3d')][_0x55fa('0x3e')]){_0x125b41[_0x55fa('0x3f')]=[{'all':!![]}];}return db[_0x55fa('0xd8')]['findAll'](_0x125b41);})[_0x55fa('0x1d')](function(_0x39c62f){_0x54a487[_0x55fa('0x45')]=_0x39c62f;return _0x54a487;});}})['then'](respondWithFilteredResult(_0x4a4c82,_0x125b41))['catch'](handleError(_0x4a4c82,null));};exports[_0x55fa('0xd9')]=function(_0x29491b,_0x26548b){var _0x259144={};var _0x234845={};var _0xe33581;var _0x14bee5;return db['User'][_0x55fa('0x8a')]({'where':{'id':_0x29491b[_0x55fa('0x4d')]['id']}})[_0x55fa('0x1d')](handleEntityNotFound(_0x26548b,null))[_0x55fa('0x1d')](function(_0x56882d){if(_0x56882d){_0xe33581=_0x56882d;_0x234845[_0x55fa('0xc8')]=_[_0x55fa('0xc6')](db['ChatInteraction'][_0x55fa('0xc5')]);_0x234845['query']=_[_0x55fa('0xc6')](_0x29491b[_0x55fa('0x3d')]);_0x234845[_0x55fa('0xcd')]=_['intersection'](_0x234845[_0x55fa('0xc8')],_0x234845['query']);_0x259144[_0x55fa('0x42')]=_['intersection'](_0x234845[_0x55fa('0xc8')],qs['fields'](_0x29491b[_0x55fa('0x3d')][_0x55fa('0xc9')]));_0x259144['attributes']=_0x259144[_0x55fa('0x42')]['length']?_0x259144['attributes']:_0x234845[_0x55fa('0xc8')];_0x259144[_0x55fa('0xca')]=qs['sort'](_0x29491b[_0x55fa('0x3d')][_0x55fa('0xcb')]);_0x259144[_0x55fa('0xcc')]=qs[_0x55fa('0xcd')](_[_0x55fa('0xce')](_0x29491b[_0x55fa('0x3d')],_0x234845[_0x55fa('0xcd')]));if(_0x29491b[_0x55fa('0x3d')][_0x55fa('0x28')]){_0x259144[_0x55fa('0xcc')]=_[_0x55fa('0x4f')](_0x259144['where'],{'$or':_[_0x55fa('0x2a')](_0x259144[_0x55fa('0x42')],function(_0x5e20ae){var _0x34131c={};_0x34131c[_0x5e20ae]={'$like':'%'+_0x29491b[_0x55fa('0x3d')][_0x55fa('0x28')]+'%'};return _0x34131c;})});}_0x259144=_[_0x55fa('0x4f')]({},_0x259144,_0x29491b[_0x55fa('0xd3')]);return _0xe33581[_0x55fa('0xd9')](_0x259144);}})[_0x55fa('0x1d')](function(_0x4bcd47){if(_0x4bcd47){_0x14bee5=_0x4bcd47[_0x55fa('0x46')];if(!_0x29491b[_0x55fa('0x3d')]['hasOwnProperty'](_0x55fa('0xcf'))){_0x259144[_0x55fa('0x19')]=qs['limit'](_0x29491b[_0x55fa('0x3d')][_0x55fa('0x19')]);_0x259144['offset']=qs[_0x55fa('0x1a')](_0x29491b[_0x55fa('0x3d')][_0x55fa('0x1a')]);}return _0xe33581[_0x55fa('0xd9')](_0x259144);}})[_0x55fa('0x1d')](function(_0x420cfe){if(_0x420cfe){return _0x420cfe?{'count':_0x14bee5,'rows':_0x420cfe}:null;}})[_0x55fa('0x1d')](respondWithResult(_0x26548b,null))[_0x55fa('0x52')](handleError(_0x26548b,null));};exports[_0x55fa('0xda')]=function(_0x6e247,_0x2b01ef){var _0x5d0e04={};var _0x5a6287={};var _0x48a88b;var _0x30790b;return db['User'][_0x55fa('0x8a')]({'where':{'id':_0x6e247[_0x55fa('0x4d')]['id']}})[_0x55fa('0x1d')](handleEntityNotFound(_0x2b01ef,null))[_0x55fa('0x1d')](function(_0x4fdae6){if(_0x4fdae6){_0x48a88b=_0x4fdae6;_0x5a6287['model']=_[_0x55fa('0xc6')](db['OpenchannelInteraction'][_0x55fa('0xc5')]);_0x5a6287[_0x55fa('0x3d')]=_[_0x55fa('0xc6')](_0x6e247[_0x55fa('0x3d')]);_0x5a6287[_0x55fa('0xcd')]=_['intersection'](_0x5a6287['model'],_0x5a6287[_0x55fa('0x3d')]);_0x5d0e04[_0x55fa('0x42')]=_['intersection'](_0x5a6287[_0x55fa('0xc8')],qs[_0x55fa('0xc9')](_0x6e247[_0x55fa('0x3d')][_0x55fa('0xc9')]));_0x5d0e04[_0x55fa('0x42')]=_0x5d0e04['attributes'][_0x55fa('0x46')]?_0x5d0e04['attributes']:_0x5a6287[_0x55fa('0xc8')];_0x5d0e04[_0x55fa('0xca')]=qs[_0x55fa('0xcb')](_0x6e247['query'][_0x55fa('0xcb')]);_0x5d0e04['where']=qs[_0x55fa('0xcd')](_[_0x55fa('0xce')](_0x6e247[_0x55fa('0x3d')],_0x5a6287['filters']));if(_0x6e247[_0x55fa('0x3d')][_0x55fa('0x28')]){_0x5d0e04[_0x55fa('0xcc')]=_['merge'](_0x5d0e04['where'],{'$or':_[_0x55fa('0x2a')](_0x5d0e04[_0x55fa('0x42')],function(_0x5a782a){var _0xc44320={};_0xc44320[_0x5a782a]={'$like':'%'+_0x6e247['query'][_0x55fa('0x28')]+'%'};return _0xc44320;})});}_0x5d0e04=_[_0x55fa('0x4f')]({},_0x5d0e04,_0x6e247['options']);return _0x48a88b['getOpenchannelInteractions'](_0x5d0e04);}})[_0x55fa('0x1d')](function(_0x1d8962){if(_0x1d8962){_0x30790b=_0x1d8962[_0x55fa('0x46')];if(!_0x6e247['query']['hasOwnProperty'](_0x55fa('0xcf'))){_0x5d0e04[_0x55fa('0x19')]=qs[_0x55fa('0x19')](_0x6e247[_0x55fa('0x3d')]['limit']);_0x5d0e04[_0x55fa('0x1a')]=qs[_0x55fa('0x1a')](_0x6e247[_0x55fa('0x3d')][_0x55fa('0x1a')]);}return _0x48a88b['getOpenchannelInteractions'](_0x5d0e04);}})['then'](function(_0x181512){if(_0x181512){return _0x181512?{'count':_0x30790b,'rows':_0x181512}:null;}})[_0x55fa('0x1d')](respondWithResult(_0x2b01ef,null))['catch'](handleError(_0x2b01ef,null));};exports[_0x55fa('0xdb')]=function(_0x4e9784,_0xd46ff7){var _0x3953dc={'raw':!![],'where':{}};var _0x30fbd7={};var _0x1a640e={'count':0x0,'rows':[]};return db['User'][_0x55fa('0x8a')]({'where':{'id':_0x4e9784['params']['id']}})['then'](handleEntityNotFound(_0xd46ff7,null))[_0x55fa('0x1d')](function(_0x211e10){if(_0x211e10){_0x30fbd7[_0x55fa('0xc8')]=_[_0x55fa('0xc6')](db[_0x55fa('0xdc')][_0x55fa('0xc5')]);_0x30fbd7[_0x55fa('0x3d')]=_[_0x55fa('0xc6')](_0x4e9784[_0x55fa('0x3d')]);_0x30fbd7[_0x55fa('0xcd')]=_['intersection'](_0x30fbd7[_0x55fa('0xc8')],_0x30fbd7[_0x55fa('0x3d')]);_0x3953dc['attributes']=_[_0x55fa('0xc7')](_0x30fbd7[_0x55fa('0xc8')],qs[_0x55fa('0xc9')](_0x4e9784[_0x55fa('0x3d')][_0x55fa('0xc9')]));_0x3953dc[_0x55fa('0x42')]=_0x3953dc[_0x55fa('0x42')][_0x55fa('0x46')]?_0x3953dc['attributes']:_0x30fbd7[_0x55fa('0xc8')];if(!_0x4e9784[_0x55fa('0x3d')][_0x55fa('0xbd')](_0x55fa('0xcf'))){_0x3953dc[_0x55fa('0x19')]=qs[_0x55fa('0x19')](_0x4e9784[_0x55fa('0x3d')][_0x55fa('0x19')]);_0x3953dc['offset']=qs[_0x55fa('0x1a')](_0x4e9784[_0x55fa('0x3d')]['offset']);}_0x3953dc[_0x55fa('0xca')]=qs[_0x55fa('0xcb')](_0x4e9784['query']['sort']);_0x3953dc['where']=qs['filters'](_[_0x55fa('0xce')](_0x4e9784[_0x55fa('0x3d')],_0x30fbd7[_0x55fa('0xcd')]));_0x3953dc[_0x55fa('0xcc')][_0x55fa('0xd6')]=_0x211e10['id'];if(_0x4e9784[_0x55fa('0x3d')][_0x55fa('0x28')]){_0x3953dc[_0x55fa('0xcc')]=_[_0x55fa('0x4f')](_0x3953dc[_0x55fa('0xcc')],{'$or':_[_0x55fa('0x2a')](_0x3953dc[_0x55fa('0x42')],function(_0x316ff3){var _0x3aa35e={};_0x3aa35e[_0x316ff3]={'$like':'%'+_0x4e9784[_0x55fa('0x3d')][_0x55fa('0x28')]+'%'};return _0x3aa35e;})});}_0x3953dc=_['merge']({},_0x3953dc,_0x4e9784['options']);return db[_0x55fa('0xdc')][_0x55fa('0x3c')]({'where':_0x3953dc[_0x55fa('0xcc')]})[_0x55fa('0x1d')](function(_0x1adfe4){_0x1a640e[_0x55fa('0x3c')]=_0x1adfe4;if(_0x4e9784[_0x55fa('0x3d')][_0x55fa('0x3e')]){_0x3953dc[_0x55fa('0x3f')]=[{'all':!![]}];}return db['MailInteraction'][_0x55fa('0x7f')](_0x3953dc);})[_0x55fa('0x1d')](function(_0x29ac1f){_0x1a640e[_0x55fa('0x45')]=_0x29ac1f;return _0x1a640e;});}})[_0x55fa('0x1d')](respondWithFilteredResult(_0xd46ff7,_0x3953dc))[_0x55fa('0x52')](handleError(_0xd46ff7,null));};exports[_0x55fa('0xdd')]=function(_0x4624d9,_0x889e60){var _0x1d2994={};var _0x398d98={};var _0x1c65ba;var _0x19f9ab;return db[_0x55fa('0x32')][_0x55fa('0x8a')]({'where':{'id':_0x4624d9['params']['id']}})[_0x55fa('0x1d')](handleEntityNotFound(_0x889e60,null))[_0x55fa('0x1d')](function(_0x584e92){if(_0x584e92){_0x1c65ba=_0x584e92;_0x398d98['model']=_['keys'](db[_0x55fa('0xde')][_0x55fa('0xc5')]);_0x398d98[_0x55fa('0x3d')]=_[_0x55fa('0xc6')](_0x4624d9[_0x55fa('0x3d')]);_0x398d98[_0x55fa('0xcd')]=_[_0x55fa('0xc7')](_0x398d98[_0x55fa('0xc8')],_0x398d98[_0x55fa('0x3d')]);_0x1d2994[_0x55fa('0x42')]=_[_0x55fa('0xc7')](_0x398d98[_0x55fa('0xc8')],qs[_0x55fa('0xc9')](_0x4624d9[_0x55fa('0x3d')]['fields']));_0x1d2994[_0x55fa('0x42')]=_0x1d2994[_0x55fa('0x42')][_0x55fa('0x46')]?_0x1d2994[_0x55fa('0x42')]:_0x398d98[_0x55fa('0xc8')];_0x1d2994[_0x55fa('0xca')]=qs[_0x55fa('0xcb')](_0x4624d9[_0x55fa('0x3d')]['sort']);_0x1d2994[_0x55fa('0xcc')]=qs[_0x55fa('0xcd')](_[_0x55fa('0xce')](_0x4624d9[_0x55fa('0x3d')],_0x398d98['filters']));if(_0x4624d9['query'][_0x55fa('0x28')]){_0x1d2994[_0x55fa('0xcc')]=_['merge'](_0x1d2994[_0x55fa('0xcc')],{'$or':_[_0x55fa('0x2a')](_0x1d2994[_0x55fa('0x42')],function(_0x4abd34){var _0xe945d1={};_0xe945d1[_0x4abd34]={'$like':'%'+_0x4624d9[_0x55fa('0x3d')][_0x55fa('0x28')]+'%'};return _0xe945d1;})});}_0x1d2994=_['merge']({},_0x1d2994,_0x4624d9[_0x55fa('0xd3')]);return _0x1c65ba['getSmsInteractions'](_0x1d2994);}})[_0x55fa('0x1d')](function(_0x14f636){if(_0x14f636){_0x19f9ab=_0x14f636[_0x55fa('0x46')];if(!_0x4624d9[_0x55fa('0x3d')][_0x55fa('0xbd')](_0x55fa('0xcf'))){_0x1d2994[_0x55fa('0x19')]=qs['limit'](_0x4624d9[_0x55fa('0x3d')][_0x55fa('0x19')]);_0x1d2994[_0x55fa('0x1a')]=qs[_0x55fa('0x1a')](_0x4624d9[_0x55fa('0x3d')][_0x55fa('0x1a')]);}return _0x1c65ba[_0x55fa('0xdd')](_0x1d2994);}})['then'](function(_0x4ba83f){if(_0x4ba83f){return _0x4ba83f?{'count':_0x19f9ab,'rows':_0x4ba83f}:null;}})['then'](respondWithResult(_0x889e60,null))[_0x55fa('0x52')](handleError(_0x889e60,null));};exports[_0x55fa('0xdf')]=function(_0x1354ab,_0x440382){var _0x2b67e4={};var _0x5a0f5a={};var _0x43723a;var _0x50f098;return db['User'][_0x55fa('0x8a')]({'where':{'id':_0x1354ab[_0x55fa('0x4d')]['id']}})['then'](handleEntityNotFound(_0x440382,null))[_0x55fa('0x1d')](function(_0x3c8d43){if(_0x3c8d43){_0x43723a=_0x3c8d43;_0x5a0f5a['model']=_[_0x55fa('0xc6')](db[_0x55fa('0xe0')][_0x55fa('0xc5')]);_0x5a0f5a['query']=_[_0x55fa('0xc6')](_0x1354ab['query']);_0x5a0f5a[_0x55fa('0xcd')]=_['intersection'](_0x5a0f5a[_0x55fa('0xc8')],_0x5a0f5a[_0x55fa('0x3d')]);_0x2b67e4[_0x55fa('0x42')]=_['intersection'](_0x5a0f5a[_0x55fa('0xc8')],qs['fields'](_0x1354ab[_0x55fa('0x3d')][_0x55fa('0xc9')]));_0x2b67e4[_0x55fa('0x42')]=_0x2b67e4[_0x55fa('0x42')]['length']?_0x2b67e4[_0x55fa('0x42')]:_0x5a0f5a[_0x55fa('0xc8')];_0x2b67e4['order']=qs[_0x55fa('0xcb')](_0x1354ab[_0x55fa('0x3d')][_0x55fa('0xcb')]);_0x2b67e4[_0x55fa('0xcc')]=qs['filters'](_[_0x55fa('0xce')](_0x1354ab[_0x55fa('0x3d')],_0x5a0f5a['filters']));if(_0x1354ab[_0x55fa('0x3d')]['filter']){_0x2b67e4[_0x55fa('0xcc')]=_[_0x55fa('0x4f')](_0x2b67e4[_0x55fa('0xcc')],{'$or':_[_0x55fa('0x2a')](_0x2b67e4['attributes'],function(_0x2f7f4d){var _0x46c725={};_0x46c725[_0x2f7f4d]={'$like':'%'+_0x1354ab[_0x55fa('0x3d')][_0x55fa('0x28')]+'%'};return _0x46c725;})});}_0x2b67e4=_[_0x55fa('0x4f')]({},_0x2b67e4,_0x1354ab[_0x55fa('0xd3')]);return _0x43723a[_0x55fa('0xdf')](_0x2b67e4);}})[_0x55fa('0x1d')](function(_0x33e6d2){if(_0x33e6d2){_0x50f098=_0x33e6d2[_0x55fa('0x46')];if(!_0x1354ab[_0x55fa('0x3d')][_0x55fa('0xbd')](_0x55fa('0xcf'))){_0x2b67e4[_0x55fa('0x19')]=qs['limit'](_0x1354ab[_0x55fa('0x3d')][_0x55fa('0x19')]);_0x2b67e4[_0x55fa('0x1a')]=qs[_0x55fa('0x1a')](_0x1354ab[_0x55fa('0x3d')][_0x55fa('0x1a')]);}return _0x43723a[_0x55fa('0xdf')](_0x2b67e4);}})[_0x55fa('0x1d')](function(_0x15b138){if(_0x15b138){return _0x15b138?{'count':_0x50f098,'rows':_0x15b138}:null;}})[_0x55fa('0x1d')](respondWithResult(_0x440382,null))[_0x55fa('0x52')](handleError(_0x440382,null));};exports[_0x55fa('0xe1')]=function(_0x52e54e,_0x5e9701){var _0x408cec={};var _0x5e9f1b={};var _0x12c982;var _0x485708;return db[_0x55fa('0x32')]['findOne']({'where':{'id':_0x52e54e[_0x55fa('0x4d')]['id']}})[_0x55fa('0x1d')](handleEntityNotFound(_0x5e9701,null))[_0x55fa('0x1d')](function(_0x49701c){if(_0x49701c){_0x12c982=_0x49701c;_0x5e9f1b[_0x55fa('0xc8')]=_['keys'](db[_0x55fa('0xe2')][_0x55fa('0xc5')]);_0x5e9f1b['query']=_[_0x55fa('0xc6')](_0x52e54e[_0x55fa('0x3d')]);_0x5e9f1b[_0x55fa('0xcd')]=_['intersection'](_0x5e9f1b[_0x55fa('0xc8')],_0x5e9f1b['query']);_0x408cec[_0x55fa('0x42')]=_['intersection'](_0x5e9f1b[_0x55fa('0xc8')],qs[_0x55fa('0xc9')](_0x52e54e['query'][_0x55fa('0xc9')]));_0x408cec[_0x55fa('0x42')]=_0x408cec['attributes']['length']?_0x408cec[_0x55fa('0x42')]:_0x5e9f1b[_0x55fa('0xc8')];_0x408cec['order']=qs[_0x55fa('0xcb')](_0x52e54e[_0x55fa('0x3d')]['sort']);_0x408cec[_0x55fa('0xcc')]=qs['filters'](_['pick'](_0x52e54e[_0x55fa('0x3d')],_0x5e9f1b[_0x55fa('0xcd')]));if(_0x52e54e['query']['filter']){_0x408cec[_0x55fa('0xcc')]=_[_0x55fa('0x4f')](_0x408cec[_0x55fa('0xcc')],{'$or':_[_0x55fa('0x2a')](_0x408cec[_0x55fa('0x42')],function(_0x291534){var _0x27c66c={};_0x27c66c[_0x291534]={'$like':'%'+_0x52e54e[_0x55fa('0x3d')][_0x55fa('0x28')]+'%'};return _0x27c66c;})});}_0x408cec=_[_0x55fa('0x4f')]({},_0x408cec,_0x52e54e[_0x55fa('0xd3')]);return _0x12c982[_0x55fa('0xe1')](_0x408cec);}})[_0x55fa('0x1d')](function(_0x52532c){if(_0x52532c){_0x485708=_0x52532c[_0x55fa('0x46')];if(!_0x52e54e[_0x55fa('0x3d')]['hasOwnProperty'](_0x55fa('0xcf'))){_0x408cec[_0x55fa('0x19')]=qs[_0x55fa('0x19')](_0x52e54e[_0x55fa('0x3d')][_0x55fa('0x19')]);_0x408cec[_0x55fa('0x1a')]=qs[_0x55fa('0x1a')](_0x52e54e[_0x55fa('0x3d')][_0x55fa('0x1a')]);}return _0x12c982[_0x55fa('0xe1')](_0x408cec);}})[_0x55fa('0x1d')](function(_0x452793){if(_0x452793){return _0x452793?{'count':_0x485708,'rows':_0x452793}:null;}})[_0x55fa('0x1d')](respondWithResult(_0x5e9701,null))[_0x55fa('0x52')](handleError(_0x5e9701,null));};exports['login']=function(_0x390652,_0x629365,_0x4af9a8){var _0x14c5d8;var _0x41a75d;var _0x412202;var _0x1f1baf=!_[_0x55fa('0x5c')](_0x390652[_0x55fa('0x4d')]['id'])?_0x390652[_0x55fa('0x4d')]['id']:!_['isNil'](_0x390652[_0x55fa('0x23')]['id'])?_0x390652[_0x55fa('0x23')]['id']:null;return db[_0x55fa('0x32')][_0x55fa('0x2d')]({'where':{'id':_0x1f1baf,'role':{'$or':[_0x55fa('0x22'),_0x55fa('0x23'),_0x55fa('0x25')]}},'attributes':['id',_0x55fa('0x2e'),_0x55fa('0xe3'),_0x55fa('0xe4'),_0x55fa('0x1e'),_0x55fa('0x58'),_0x55fa('0x90')]})['then'](function(_0xd58dc9){if(_0xd58dc9){if(_0xd58dc9[_0x55fa('0x1e')]==='agent'){_0x14c5d8=_0xd58dc9;if(_0x390652[_0x55fa('0x53')][_0x55fa('0x92')]){_0x412202=util['format'](_0x55fa('0xe5'),_0x14c5d8[_0x390652[_0x55fa('0x53')]['interface']]);}else if(_0x390652[_0x55fa('0x53')][_0x55fa('0xe6')]){_0x412202=util['format'](_0x55fa('0x9e'),_0x390652[_0x55fa('0x53')][_0x55fa('0xe6')]);}else{_0x412202=util[_0x55fa('0x9d')]('SIP/%s',_0x14c5d8[_0x55fa('0x2e')]);}socket['to'](util[_0x55fa('0x9d')](_0x55fa('0xe7'),_0x14c5d8[_0x55fa('0x2e')]))[_0x55fa('0x1f')](_0x55fa('0xe8'),{'user':{'id':_0x14c5d8['id'],'name':_0x14c5d8[_0x55fa('0x2e')]},'ip':_0x390652['headers'][_0x55fa('0xe9')]||_0x390652[_0x55fa('0xea')][_0x55fa('0xeb')]||_0x390652[_0x55fa('0xec')][_0x55fa('0xeb')]||_0x390652[_0x55fa('0xea')][_0x55fa('0xec')][_0x55fa('0xeb')]});return db['UserVoiceQueueRt']['destroy']({'where':{'membername':_0x14c5d8['name']},'individualHooks':!![]});}}else{throw new db[(_0x55fa('0x82'))][(_0x55fa('0x83'))](_0x55fa('0xed'));}})[_0x55fa('0x1d')](function(){if(_0x14c5d8){return _0x14c5d8[_0x55fa('0xee')]({'raw':!![]});}})[_0x55fa('0x1d')](function(_0x152396){if(_0x14c5d8){if(_0x152396){_0x41a75d=_0x152396;if(_0x41a75d['length']){var _0x15d8c7=_0x41a75d['map'](function(_0x665fb2){var _0x243d13={'membername':_0x14c5d8['name'],'UserId':_0x14c5d8['id'],'queue_name':_0x665fb2[_0x55fa('0x2e')],'VoiceQueueId':_0x665fb2['id'],'interface':_0x412202,'paused':_0x14c5d8[_0x55fa('0x90')]||![],'penalty':_0x665fb2['UserVoiceQueue.penalty']||0x0};return db['UserVoiceQueueRt'][_0x55fa('0xa0')](_0x243d13);});return Promise[_0x55fa('0x4b')](_0x15d8c7);}}}})[_0x55fa('0x1d')](function(){if(_0x14c5d8){return db[_0x55fa('0xef')][_0x55fa('0x7f')]({'where':{'membername':_0x14c5d8[_0x55fa('0x2e')],'exitAt':null}});}})[_0x55fa('0x1d')](function(_0x2bcc73){if(_0x14c5d8){var _0x1cc574=[];_0x2bcc73[_0x55fa('0xf0')](function(_0x46f544){_0x1cc574[_0x55fa('0x43')](_0x46f544[_0x55fa('0x1c')]({'exitAt':moment()[_0x55fa('0x9d')]('YYYY-MM-DD\x20HH:mm:ss')}));});return Promise[_0x55fa('0x4b')](_0x1cc574);}})[_0x55fa('0x1d')](function(){if(_0x14c5d8){var _0x45b568=[];var _0x578705=[];var _0x29455a=utils['getChannels']();var _0x3ecec6={'membername':_0x14c5d8[_0x55fa('0x2e')],'interface':_0x412202,'enterAt':moment()[_0x55fa('0x9d')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x14c5d8[_0x55fa('0x1e')],'internal':_0x14c5d8['internal']};_0x29455a[_0x55fa('0xf0')](function(_0x4549c5){_0x45b568[_0x55fa('0x43')](_[_0x55fa('0x4f')]({'channel':_0x4549c5,'type':_0x55fa('0xf1'),'data1':_0x390652['body']['device'],'data2':_0x412202},_0x3ecec6));if(_0x14c5d8[_0x55fa('0x90')]){_0x578705[_0x55fa('0x43')](_['merge']({'channel':_0x4549c5,'type':_0x55fa('0xf2'),'data1':_0x55fa('0xf3')},_0x3ecec6));}});return db['MemberReport']['bulkCreate'](_0x45b568[_0x55fa('0xba')](_0x578705),{'individualHooks':!![]});}})[_0x55fa('0x1d')](function(){if(_0x14c5d8){return _0x14c5d8[_0x55fa('0x1c')]({'online':!![],'lastLoginAt':moment()[_0x55fa('0x9d')](_0x55fa('0xf4')),'voicePause':_0x14c5d8['loginInPause']||![],'mailPause':_0x14c5d8['loginInPause']||![],'chatPause':_0x14c5d8['loginInPause']||![],'faxPause':_0x14c5d8[_0x55fa('0x90')]||![],'smsPause':_0x14c5d8[_0x55fa('0x90')]||![],'openchannelPause':_0x14c5d8[_0x55fa('0x90')]||![],'whatsappPause':_0x14c5d8['loginInPause']||![],'pauseType':_0x14c5d8[_0x55fa('0x90')]?_0x55fa('0xf3'):null,'interface':_0x412202,'lastPauseAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')});}})[_0x55fa('0x1d')](function(_0x356554){if(_0x390652[_0x55fa('0xf5')]){return _0x4af9a8();}else{return Promise['resolve'](_0x356554)[_0x55fa('0x1d')](respondWithResult(_0x629365,null));}})[_0x55fa('0x52')](handleError(_0x629365,null));};exports[_0x55fa('0xf6')]=function(_0x3b9b8f,_0x146ab7){var _0x55af9e;return db[_0x55fa('0x32')][_0x55fa('0x2d')]({'where':{'id':_0x3b9b8f[_0x55fa('0x4d')]['id'],'role':_0x55fa('0x25')},'attributes':['id',_0x55fa('0x2e'),_0x55fa('0x1e')]})[_0x55fa('0x1d')](handleEntityNotFound(_0x146ab7,null))['then'](function(_0x119f81){if(_0x119f81){_0x55af9e=_0x119f81;return db[_0x55fa('0x9f')]['destroy']({'where':{'membername':_0x55af9e[_0x55fa('0x2e')]},'individualHooks':!![]});}})[_0x55fa('0x1d')](function(){return db[_0x55fa('0xef')][_0x55fa('0x7f')]({'where':{'membername':_0x55af9e['name'],'exitAt':null}});})[_0x55fa('0x1d')](function(_0x39eef4){var _0x5c5ff8=[];_0x39eef4[_0x55fa('0xf0')](function(_0x4ff026){_0x5c5ff8[_0x55fa('0x43')](_0x4ff026['update']({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')}));});return Promise[_0x55fa('0x4b')](_0x5c5ff8);})[_0x55fa('0x1d')](function(){return _0x55af9e['update']({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x55fa('0x1d')](respondWithResult(_0x146ab7,null))[_0x55fa('0x52')](handleError(_0x146ab7,null));};exports[_0x55fa('0xf7')]=function(_0x34e998,_0x354b9b){var _0x4b68cd;return db[_0x55fa('0x9f')]['update']({'paused':0x1},{'where':{'UserId':_0x34e998[_0x55fa('0x4d')]['id']},'individualHooks':!![]})['then'](function(){return db[_0x55fa('0x32')][_0x55fa('0x2d')]({'where':{'id':_0x34e998[_0x55fa('0x4d')]['id'],'role':'agent'},'attributes':['id',_0x55fa('0x2e'),_0x55fa('0x1e'),_0x55fa('0x58'),_0x55fa('0x92'),'online']});})['then'](handleEntityNotFound(_0x354b9b,null))[_0x55fa('0x1d')](function(_0x192344){if(_0x192344){_0x4b68cd=_0x192344;return db['MemberReport'][_0x55fa('0x7f')]({'where':{'membername':_0x4b68cd['name'],'type':_0x55fa('0xf2'),'exitAt':null}});}})[_0x55fa('0x1d')](function(_0x2f2744){if(_0x2f2744['length']){var _0xe748f9=moment()[_0x55fa('0x9d')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x4814d2=0x0,_0x207179=_0x2f2744[_0x55fa('0x46')];_0x4814d2<_0x207179;_0x4814d2++){_0x2f2744[_0x4814d2][_0x55fa('0xf8')]({'exitAt':_0xe748f9});}}})[_0x55fa('0x1d')](function(){var _0x28c698=[];var _0x16cf78=utils[_0x55fa('0xf9')]();_0x16cf78[_0x55fa('0xf0')](function(_0x3185f9){_0x28c698[_0x55fa('0x43')]({'channel':_0x3185f9,'membername':_0x4b68cd[_0x55fa('0x2e')],'interface':_[_0x55fa('0x5c')](_0x4b68cd[_0x55fa('0x92')])?util['format'](_0x55fa('0x9e'),_0x4b68cd['name']):_0x4b68cd[_0x55fa('0x92')],'type':'PAUSE','enterAt':moment()[_0x55fa('0x9d')](_0x55fa('0xf4')),'data1':_0x34e998['body'][_0x55fa('0xfa')]||'DEFAULT\x20PAUSE','role':_0x4b68cd[_0x55fa('0x1e')],'internal':_0x4b68cd[_0x55fa('0x58')]});});return db[_0x55fa('0xef')]['bulkCreate'](_0x28c698,{'individualHooks':!![]});})[_0x55fa('0x1d')](function(){return _0x4b68cd['update']({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x34e998[_0x55fa('0x53')][_0x55fa('0xfa')]||'DEFAULT\x20PAUSE','lastPauseAt':moment()['format'](_0x55fa('0xf4'))});})[_0x55fa('0x1d')](respondWithResult(_0x354b9b,null))[_0x55fa('0x52')](handleError(_0x354b9b,null));};exports[_0x55fa('0xfb')]=function(_0x512b09,_0x5a872f){if(_0x512b09[_0x55fa('0x53')][_0x55fa('0xa2')]&&!utils['isValidChannel'](_0x512b09[_0x55fa('0x53')][_0x55fa('0xa2')])){throw new APIBadRequestError(util['format']('Channel\x20parameter\x20%s\x20is\x20invalid',_0x512b09[_0x55fa('0x53')][_0x55fa('0xa2')]));}return db['User'][_0x55fa('0x2d')]({'where':{'id':_0x512b09[_0x55fa('0x4d')]['id']},'attributes':['id',_0x55fa('0x2e'),_0x55fa('0x1e'),'internal',_0x55fa('0x92'),_0x55fa('0x9c'),'voicePause','mailPause',_0x55fa('0xfc'),'faxPause',_0x55fa('0xfd'),'smsPause',_0x55fa('0xfe'),_0x55fa('0xff'),_0x55fa('0x100')]})[_0x55fa('0x1d')](function(_0x594807){if(!_0x594807){throw new APINotFoundError(util[_0x55fa('0x9d')]('User\x20with\x20id\x20%s\x20not\x20found',_0x512b09[_0x55fa('0x4d')]['id']));}return _0x594807[_0x55fa('0xfb')](_0x512b09[_0x55fa('0x53')]['channel']);})['then'](respondWithResult(_0x5a872f,null))[_0x55fa('0x52')](APIHandleError(_0x5a872f));};exports[_0x55fa('0x101')]=function(_0x4140f8,_0x1d6558){var _0x111767={};var _0x2728ba={};var _0x239ebc;var _0x58f7cd;return db['User']['findOne']({'where':{'id':_0x4140f8['params']['id']}})['then'](handleEntityNotFound(_0x1d6558,null))['then'](function(_0x152664){if(_0x152664){_0x239ebc=_0x152664;_0x2728ba[_0x55fa('0xc8')]=_[_0x55fa('0xc6')](db[_0x55fa('0x102')]['rawAttributes']);_0x2728ba[_0x55fa('0x3d')]=_[_0x55fa('0xc6')](_0x4140f8['query']);_0x2728ba['filters']=_[_0x55fa('0xc7')](_0x2728ba['model'],_0x2728ba['query']);_0x111767[_0x55fa('0x42')]=_[_0x55fa('0xc7')](_0x2728ba[_0x55fa('0xc8')],qs[_0x55fa('0xc9')](_0x4140f8['query'][_0x55fa('0xc9')]));_0x111767[_0x55fa('0x42')]=_0x111767['attributes']['length']?_0x111767['attributes']:_0x2728ba[_0x55fa('0xc8')];_0x111767[_0x55fa('0xca')]=qs[_0x55fa('0xcb')](_0x4140f8['query']['sort']);_0x111767[_0x55fa('0xcc')]=qs['filters'](_[_0x55fa('0xce')](_0x4140f8['query'],_0x2728ba[_0x55fa('0xcd')]));if(_0x4140f8[_0x55fa('0x3d')][_0x55fa('0x28')]){_0x111767['where']=_[_0x55fa('0x4f')](_0x111767[_0x55fa('0xcc')],{'$or':_[_0x55fa('0x2a')](_0x111767[_0x55fa('0x42')],function(_0x585acd){var _0x5e45b3={};_0x5e45b3[_0x585acd]={'$like':'%'+_0x4140f8[_0x55fa('0x3d')][_0x55fa('0x28')]+'%'};return _0x5e45b3;})});}_0x111767=_['merge']({},_0x111767,_0x4140f8[_0x55fa('0xd3')]);return _0x239ebc[_0x55fa('0x101')](_0x111767);}})[_0x55fa('0x1d')](function(_0x4b5f94){if(_0x4b5f94){_0x58f7cd=_0x4b5f94[_0x55fa('0x46')];if(!_0x4140f8[_0x55fa('0x3d')][_0x55fa('0xbd')](_0x55fa('0xcf'))){_0x111767[_0x55fa('0x19')]=qs[_0x55fa('0x19')](_0x4140f8['query'][_0x55fa('0x19')]);_0x111767['offset']=qs[_0x55fa('0x1a')](_0x4140f8['query'][_0x55fa('0x1a')]);}return _0x239ebc[_0x55fa('0x101')](_0x111767);}})[_0x55fa('0x1d')](function(_0x5874e5){if(_0x5874e5){return _0x5874e5?{'count':_0x58f7cd,'rows':_0x5874e5}:null;}})['then'](respondWithResult(_0x1d6558,null))[_0x55fa('0x52')](handleError(_0x1d6558,null));};exports[_0x55fa('0x103')]=function(_0x14d1c9,_0x2c079c){var _0x4a67d4=_0x14d1c9[_0x55fa('0x4d')]['id'];var _0x27fe6e=_0x14d1c9[_0x55fa('0x53')]?_0x14d1c9[_0x55fa('0x53')][_0x55fa('0x56')]:null;var _0x3e9157=[];return Promise[_0x55fa('0x104')]()['then'](function(){if(!_0x27fe6e)throw new APIBadRequestError('Body\x20parameter\x20\x27ids\x27\x20is\x20required');})[_0x55fa('0x1d')](function(){return db['User']['findOne']({'where':{'id':_0x4a67d4}});})['then'](function(_0x13a646){if(!_0x13a646)throw new APINotFoundError(util[_0x55fa('0x9d')](_0x55fa('0xbc'),_0x14d1c9[_0x55fa('0x4d')]['id']));return db[_0x55fa('0x5e')][_0x55fa('0x105')](function(_0x1d41fa){return _0x13a646[_0x55fa('0x103')](_0x27fe6e,{'transaction':_0x1d41fa})[_0x55fa('0x1d')](function(){return db[_0x55fa('0x102')][_0x55fa('0x7f')]({'where':{'id':{'$in':_0x27fe6e}}});})[_0x55fa('0x1d')](function(_0x57eb1c){var _0x386a1c=_[_0x55fa('0x2a')](_0x57eb1c,function(_0x2d5d7b){return _0x2d5d7b[_0x55fa('0x106')]();});return Promise[_0x55fa('0x4b')](_0x386a1c);})[_0x55fa('0x1d')](function(_0x2d2074){_0x3e9157=_['flattenDeep'](_0x2d2074);var _0x5bdaf5=_['map'](_0x3e9157,function(_0x4b2e12){return _0x4b2e12[_0x55fa('0x107')](_0x13a646['id'],{'transaction':_0x1d41fa});});return Promise[_0x55fa('0x4b')](_0x5bdaf5);})['then'](function(){if(!_0x13a646[_0x55fa('0x9c')])return;var _0x4464d6=_[_0x55fa('0x28')](_0x3e9157,function(_0x4bff5b){return _0x4bff5b[_0x55fa('0x108')]('channel')===_0x55fa('0x109');});var _0x3f27b1=_[_0x55fa('0x2a')](_0x4464d6,function(_0x10159f){return db['UserVoiceQueueRt']['upsert']({'membername':_0x13a646[_0x55fa('0x2e')],'UserId':_0x13a646['id'],'queue_name':_0x10159f[_0x55fa('0x2e')],'VoiceQueueId':_0x10159f['id'],'interface':_['isNil'](_0x13a646[_0x55fa('0x92')])?util[_0x55fa('0x9d')](_0x55fa('0x9e'),_0x13a646[_0x55fa('0x2e')]):_0x13a646[_0x55fa('0x92')],'paused':_0x13a646[_0x55fa('0x91')]||![],'penalty':_0x13a646['penalty']},{'transaction':_0x1d41fa});});return Promise[_0x55fa('0x4b')](_0x3f27b1);})[_0x55fa('0x1d')](function(){return db[_0x55fa('0x10a')]['findAll']({'where':{'teamId':{'$in':_0x27fe6e}}});})[_0x55fa('0x1d')](function(_0xe075fa){var _0xe63f4c=_['map'](_0xe075fa,function(_0x5543b7){return db['UserVoicePrefix'][_0x55fa('0x71')]({'UserId':_0x13a646['id'],'VoicePrefixId':_0x5543b7[_0x55fa('0x10b')]},{'transaction':_0x1d41fa});});return Promise['all'](_0xe63f4c);});});})['then'](function(){for(var _0x4ca9c5=0x0;_0x4ca9c5<_0x3e9157['length'];_0x4ca9c5++){var _0x527770=_0x3e9157[_0x4ca9c5][_0x55fa('0x108')]('channel');var _0x27d26b=_0x527770+_0x55fa('0xa5');socket['emit'](_0x55fa('0x23')+_0x527770+'Queue:save',{'UserId':_0x4a67d4,['queueField']:_0x3e9157[_0x4ca9c5]['id']});}})[_0x55fa('0x1d')](respondWithStatusCode(_0x2c079c,null))['catch'](APIHandleError(_0x2c079c));};exports[_0x55fa('0x10c')]=function(_0x171965,_0x136714){var _0x3e3cf6=_0x171965['params']['id'];var _0x5f42a0=null;if(_0x171965[_0x55fa('0x3d')][_0x55fa('0x56')]){_0x5f42a0=_['isArray'](_0x171965[_0x55fa('0x3d')][_0x55fa('0x56')])?_0x171965[_0x55fa('0x3d')][_0x55fa('0x56')]:[_0x171965['query'][_0x55fa('0x56')]];}var _0x4d133e=[];return Promise['resolve']()['then'](function(){if(!_0x5f42a0)throw new APIBadRequestError(_0x55fa('0x10d'));})['then'](function(){return db[_0x55fa('0x32')][_0x55fa('0x8a')]({'where':{'id':_0x3e3cf6}});})[_0x55fa('0x1d')](function(_0xc2f92c){if(!_0xc2f92c)throw new APINotFoundError(util[_0x55fa('0x9d')](_0x55fa('0xbc'),_0x171965[_0x55fa('0x4d')]['id']));return db['sequelize'][_0x55fa('0x105')](function(_0x2054bb){return _0xc2f92c['removeTeams'](_0x5f42a0,{'transaction':_0x2054bb})[_0x55fa('0x1d')](function(){return db[_0x55fa('0x102')][_0x55fa('0x7f')]({'where':{'id':{'$in':_0x5f42a0}}});})[_0x55fa('0x1d')](function(_0x56702a){var _0x19d56e=_['map'](_0x56702a,function(_0x15dce8){return _0x15dce8[_0x55fa('0x106')]();});return Promise['all'](_0x19d56e);})[_0x55fa('0x1d')](function(_0x9f68f3){_0x4d133e=_[_0x55fa('0x10e')](_0x9f68f3);var _0x10ac90=_[_0x55fa('0x2a')](_0x4d133e,function(_0x9daf9a){return _0x9daf9a[_0x55fa('0x10f')](_0xc2f92c['id'],{'transaction':_0x2054bb});});return Promise[_0x55fa('0x4b')](_0x10ac90);})[_0x55fa('0x1d')](function(){if(!_0xc2f92c[_0x55fa('0x9c')])return;var _0x1f5c3f=_[_0x55fa('0x28')](_0x4d133e,function(_0x3a0382){return _0x3a0382[_0x55fa('0x108')](_0x55fa('0xa2'))===_0x55fa('0x109');});var _0x2a41f3=_[_0x55fa('0x2a')](_0x1f5c3f,function(_0x7e4e23){return db['UserVoiceQueueRt'][_0x55fa('0x21')]({'where':{'VoiceQueueId':_0x7e4e23['id'],'UserId':_0xc2f92c['id']},'transaction':_0x2054bb});});return Promise[_0x55fa('0x4b')](_0x2a41f3);})[_0x55fa('0x1d')](function(){return db['TeamVoicePrefix'][_0x55fa('0x7f')]({'where':{'teamId':{'$in':_0x5f42a0}}});})[_0x55fa('0x1d')](function(_0x1623ad){var _0x1643e0=_[_0x55fa('0x2a')](_0x1623ad,function(_0x57da10){return db[_0x55fa('0x110')][_0x55fa('0x21')]({'where':{'UserId':_0xc2f92c['id'],'VoicePrefixId':_0x57da10[_0x55fa('0x10b')]}},{'transaction':_0x2054bb});});return Promise[_0x55fa('0x4b')](_0x1643e0);});});})['then'](function(){for(var _0xaa6053=0x0;_0xaa6053<_0x4d133e['length'];_0xaa6053++){var _0x2fd277=_0x4d133e[_0xaa6053][_0x55fa('0x108')](_0x55fa('0xa2'));var _0x5e8006=_0x2fd277+'QueueId';socket['emit']('user'+_0x2fd277+_0x55fa('0xa6'),{'UserId':_0x3e3cf6,['queueField']:_0x4d133e[_0xaa6053]['id']});}})[_0x55fa('0x1d')](respondWithStatusCode(_0x136714,null))[_0x55fa('0x52')](APIHandleError(_0x136714));};exports[_0x55fa('0x111')]=function(_0x54b28f,_0x50caf5){var _0x55ed62={};var _0x4b9f2b={};var _0x5821d4;var _0x377e7e;return db['User'][_0x55fa('0x8a')]({'where':{'id':_0x54b28f[_0x55fa('0x4d')]['id']}})[_0x55fa('0x1d')](handleEntityNotFound(_0x50caf5,null))[_0x55fa('0x1d')](function(_0x4bc80d){if(_0x4bc80d){_0x5821d4=_0x4bc80d;_0x4b9f2b[_0x55fa('0xc8')]=_[_0x55fa('0xc6')](db[_0x55fa('0xbe')][_0x55fa('0xc5')]);_0x4b9f2b[_0x55fa('0x3d')]=_['keys'](_0x54b28f[_0x55fa('0x3d')]);_0x4b9f2b[_0x55fa('0xcd')]=_[_0x55fa('0xc7')](_0x4b9f2b[_0x55fa('0xc8')],_0x4b9f2b['query']);_0x55ed62[_0x55fa('0x42')]=_[_0x55fa('0xc7')](_0x4b9f2b[_0x55fa('0xc8')],qs['fields'](_0x54b28f[_0x55fa('0x3d')][_0x55fa('0xc9')]));_0x55ed62['attributes']=_0x55ed62['attributes']['length']?_0x55ed62[_0x55fa('0x42')]:_0x4b9f2b['model'];_0x55ed62['order']=qs[_0x55fa('0xcb')](_0x54b28f['query'][_0x55fa('0xcb')]);_0x55ed62[_0x55fa('0xcc')]=qs[_0x55fa('0xcd')](_[_0x55fa('0xce')](_0x54b28f[_0x55fa('0x3d')],_0x4b9f2b[_0x55fa('0xcd')]));if(_0x54b28f[_0x55fa('0x3d')]['filter']){_0x55ed62[_0x55fa('0xcc')]=_[_0x55fa('0x4f')](_0x55ed62[_0x55fa('0xcc')],{'$or':_[_0x55fa('0x2a')](_0x55ed62['attributes'],function(_0x50af2a){var _0x4d71c4={};_0x4d71c4[_0x50af2a]={'$like':'%'+_0x54b28f[_0x55fa('0x3d')][_0x55fa('0x28')]+'%'};return _0x4d71c4;})});}_0x55ed62=_[_0x55fa('0x4f')]({},_0x55ed62,_0x54b28f[_0x55fa('0xd3')]);return _0x5821d4['getLists'](_0x55ed62);}})[_0x55fa('0x1d')](function(_0x43d597){if(_0x43d597){_0x377e7e=_0x43d597[_0x55fa('0x46')];if(!_0x54b28f[_0x55fa('0x3d')][_0x55fa('0xbd')](_0x55fa('0xcf'))){_0x55ed62[_0x55fa('0x19')]=qs['limit'](_0x54b28f['query'][_0x55fa('0x19')]);_0x55ed62[_0x55fa('0x1a')]=qs[_0x55fa('0x1a')](_0x54b28f['query'][_0x55fa('0x1a')]);}return _0x5821d4['getLists'](_0x55ed62);}})[_0x55fa('0x1d')](function(_0xe8d3cd){if(_0xe8d3cd){return _0xe8d3cd?{'count':_0x377e7e,'rows':_0xe8d3cd}:null;}})[_0x55fa('0x1d')](respondWithResult(_0x50caf5,null))[_0x55fa('0x52')](handleError(_0x50caf5,null));};exports['getAgents']=function(_0x263cf5,_0x512f7c){var _0x261666={};var _0x4856a0={};var _0x4acad6;return db[_0x55fa('0x32')]['findOne']({'where':{'id':_0x263cf5[_0x55fa('0x4d')]['id']}})[_0x55fa('0x1d')](handleEntityNotFound(_0x512f7c,null))[_0x55fa('0x1d')](function(_0x4ebc94){if(_0x4ebc94){_0x4acad6=_0x4ebc94;_0x4856a0[_0x55fa('0xc8')]=_[_0x55fa('0xc6')](db[_0x55fa('0x32')][_0x55fa('0xc5')]);_0x4856a0['query']=_['keys'](_0x263cf5['query']);_0x4856a0[_0x55fa('0xcd')]=_['intersection'](_0x4856a0['model'],_0x4856a0[_0x55fa('0x3d')]);_0x261666[_0x55fa('0x42')]=_[_0x55fa('0xc7')](_0x4856a0['model'],qs[_0x55fa('0xc9')](_0x263cf5['query'][_0x55fa('0xc9')]));_0x261666[_0x55fa('0x42')]=_0x261666[_0x55fa('0x42')][_0x55fa('0x46')]?_0x261666[_0x55fa('0x42')]:_0x4856a0['model'];_0x261666[_0x55fa('0xca')]=qs['sort'](_0x263cf5[_0x55fa('0x3d')][_0x55fa('0xcb')]);_0x261666[_0x55fa('0xcc')]=qs[_0x55fa('0xcd')](_[_0x55fa('0xce')](_0x263cf5[_0x55fa('0x3d')],_0x4856a0[_0x55fa('0xcd')]));if(_0x263cf5[_0x55fa('0x3d')][_0x55fa('0x28')]){_0x261666['where']=_[_0x55fa('0x4f')](_0x261666['where'],{'$or':_[_0x55fa('0x2a')](_0x261666[_0x55fa('0x42')],function(_0x14569c){var _0xb91a95={};_0xb91a95[_0x14569c]={'$like':'%'+_0x263cf5[_0x55fa('0x3d')][_0x55fa('0x28')]+'%'};return _0xb91a95;})});}_0x261666[_0x55fa('0xc8')]=db[_0x55fa('0x32')];_0x261666['as']=_0x55fa('0x24');_0x261666=_[_0x55fa('0x4f')]({},_0x261666,_0x263cf5[_0x55fa('0xd3')]);return _0x4acad6['getVoiceQueues']({'include':[_0x261666]});}})['then'](function(_0x3c8813){if(_0x3c8813){var _0x58480a={},_0x2489e2=[];for(var _0x1b53ee=0x0;_0x1b53ee<_0x3c8813[_0x55fa('0x46')];_0x1b53ee+=0x1){for(var _0x4ead9c=0x0,_0x143e74;_0x4ead9c<_0x3c8813[_0x1b53ee][_0x55fa('0x24')][_0x55fa('0x46')];_0x4ead9c+=0x1){_0x143e74=_0x3c8813[_0x1b53ee][_0x55fa('0x24')][_0x4ead9c][_0x55fa('0x9b')]({'plain':!![]});_0x58480a[_0x143e74['id']]=_0x143e74;}}_0x58480a=_['values'](_0x58480a);for(var _0x2c8229=qs['offset'](_0x263cf5[_0x55fa('0x3d')][_0x55fa('0x1a')]);_0x2c8229<_0x58480a['length']&&_0x2489e2['length']=_0x501625[_0xdcb1('0x4b')]){throw new Error('Maximum\x20login\x20has\x20been\x20reached');}})[_0xdcb1('0x18')](function(){if(_0xb9381c){return db[_0xdcb1('0x42')]['destroy']({'where':{'membername':_0xb9381c['name']},'individualHooks':!![]});}})[_0xdcb1('0x18')](function(){if(_0xb9381c){return _0xb9381c[_0xdcb1('0x4c')]({'raw':!![]});}})[_0xdcb1('0x18')](function(_0x5e8992){if(_0xb9381c){if(_0x5e8992){var _0x266017=[];_0x18b5eb=_0x5e8992;if(_0x18b5eb['length']){for(var _0x486d96=0x0;_0x486d96<_0x18b5eb[_0xdcb1('0x2a')];_0x486d96++){_0x266017['push'](db['UserVoiceQueueRt'][_0xdcb1('0x4d')]({'membername':_0xb9381c['name'],'UserId':_0xb9381c['id'],'queue_name':_0x18b5eb[_0x486d96][_0xdcb1('0x21')],'VoiceQueueId':_0x18b5eb[_0x486d96]['id'],'interface':_0x53c89c,'paused':_0xb9381c[_0xdcb1('0x47')]||![],'penalty':_0x18b5eb[_0x486d96][_0xdcb1('0x4e')]||0x0}));}return BPromise[_0xdcb1('0x4f')](_0x266017);}}}})[_0xdcb1('0x18')](function(){if(_0xb9381c){return db[_0xdcb1('0x28')]['findAll']({'where':{'membername':_0xb9381c[_0xdcb1('0x21')],'exitAt':null}});}})[_0xdcb1('0x18')](function(_0x2094df){if(_0xb9381c){if(_0x2094df&&_0x2094df[_0xdcb1('0x2a')]){var _0x285a65=[];_0x2094df[_0xdcb1('0x50')](function(_0x4274f9){_0x285a65[_0xdcb1('0x2d')](_0x4274f9[_0xdcb1('0x27')]({'exitAt':moment()[_0xdcb1('0x25')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0xdcb1('0x4f')](_0x285a65);}}})['then'](function(){if(_0xb9381c){var _0x16f5e8=[];var _0x375cb0=[];var _0x11340f=utils['getChannels']();var _0x41400d={'membername':_0xb9381c['name'],'interface':_0x53c89c,'enterAt':moment()[_0xdcb1('0x25')](_0xdcb1('0x2b')),'role':_0xb9381c[_0xdcb1('0x22')],'internal':_0xb9381c[_0xdcb1('0x23')]};_0x11340f[_0xdcb1('0x50')](function(_0x5c796f){_0x16f5e8[_0xdcb1('0x2d')](_[_0xdcb1('0x51')]({'channel':_0x5c796f,'type':_0xdcb1('0x52'),'data1':_0xdcb1('0x53'),'data2':_0x53c89c},_0x41400d));if(_0xb9381c[_0xdcb1('0x47')]){_0x375cb0[_0xdcb1('0x2d')](_[_0xdcb1('0x51')]({'channel':_0x5c796f,'type':_0xdcb1('0x29'),'data1':_0xdcb1('0x54')},_0x41400d));}});return db[_0xdcb1('0x28')]['bulkCreate'](_0x16f5e8[_0xdcb1('0x55')](_0x375cb0),{'individualHooks':!![]});}})['then'](function(){if(_0xb9381c){return _0xb9381c[_0xdcb1('0x27')]({'online':!![],'lastLoginAt':moment()[_0xdcb1('0x25')](_0xdcb1('0x2b')),'voicePause':_0xb9381c[_0xdcb1('0x47')]||![],'mailPause':_0xb9381c[_0xdcb1('0x47')]||![],'chatPause':_0xb9381c[_0xdcb1('0x47')]||![],'faxPause':_0xb9381c['loginInPause']||![],'smsPause':_0xb9381c[_0xdcb1('0x47')]||![],'openchannelPause':_0xb9381c[_0xdcb1('0x47')]||![],'pauseType':_0xb9381c[_0xdcb1('0x47')]?'LOGININPAUSE':null,'lastPauseAt':moment()[_0xdcb1('0x25')](_0xdcb1('0x2b')),'interface':_0x53c89c});}})['then'](function(_0x1989c7){_0x5f2adf(_0x1989c7);})[_0xdcb1('0x1a')](function(_0x8fcc31){_0x2ae7f6(_0xa28565[_0xdcb1('0x1b')](0x1f4,_0x8fcc31[_0xdcb1('0x1c')]));});});}; \ No newline at end of file +var _0x8dec=['raw','limit','map','include','model','attributes','then','info','debug','catch','error','message','ShowUser','find','where','stringify','PauseUser','name','internal','format','params','UserVoiceQueueRt','update','MemberReport','PAUSE','length','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','getChannels','push','isNil','interface','body','role','uniqueid','bulkCreate','type','resolve','channel','isValidChannel','Channel\x20parameter\x20%s\x20is\x20invalid','findOne','voicePause','chatPause','faxPause','openchannelPause','smsPause','whatsappPause','pauseType','lastPauseAt','User\x20with\x20id\x20%s\x20not\x20found','unpause','system','LogoutUser','destroy','all','LoginUser','mobile','count','agent','../../config/license/util','getLicense','agents','getVoiceQueues','upsert','loginInPause','UserVoiceQueue.penalty','merge','LOGIN','callysquare','LOGININPAUSE','lodash','util','moment','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','redis','localhost','socket.io-emitter','./user.socket','GetUser','User','findAll','options'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x8dec,0x1a3));var _0xc8de=function(_0x3f0f6f,_0x32d8b9){_0x3f0f6f=_0x3f0f6f-0x0;var _0xb1511b=_0x8dec[_0x3f0f6f];return _0xb1511b;};'use strict';var _=require(_0xc8de('0x0'));var util=require(_0xc8de('0x1'));var moment=require(_0xc8de('0x2'));var BPromise=require(_0xc8de('0x3'));var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xc8de('0x4'));var logger=require(_0xc8de('0x5'))(_0xc8de('0x6'));var config=require(_0xc8de('0x7'));config[_0xc8de('0x8')]=_['defaults'](config['redis'],{'host':_0xc8de('0x9'),'port':0x18eb});var socket=require(_0xc8de('0xa'))(new Redis(config[_0xc8de('0x8')]));require(_0xc8de('0xb'))['register'](socket);exports[_0xc8de('0xc')]=function(_0x455ea0){var _0x272e66=this;return new Promise(function(_0x4849e3,_0x18788e){return db[_0xc8de('0xd')][_0xc8de('0xe')]({'raw':_0x455ea0[_0xc8de('0xf')]?_0x455ea0[_0xc8de('0xf')][_0xc8de('0x10')]===undefined?!![]:![]:!![],'where':_0x455ea0[_0xc8de('0xf')]?_0x455ea0[_0xc8de('0xf')]['where']||null:null,'attributes':_0x455ea0[_0xc8de('0xf')]?_0x455ea0['options']['attributes']||null:null,'limit':_0x455ea0['options']?_0x455ea0[_0xc8de('0xf')][_0xc8de('0x11')]||null:null,'include':_0x455ea0[_0xc8de('0xf')]?_0x455ea0[_0xc8de('0xf')]['include']?_[_0xc8de('0x12')](_0x455ea0['options'][_0xc8de('0x13')],function(_0x29e4a4){return{'model':db[_0x29e4a4[_0xc8de('0x14')]],'as':_0x29e4a4['as'],'attributes':_0x29e4a4[_0xc8de('0x15')],'include':_0x29e4a4[_0xc8de('0x13')]?_[_0xc8de('0x12')](_0x29e4a4[_0xc8de('0x13')],function(_0x47677e){return{'model':db[_0x47677e[_0xc8de('0x14')]],'as':_0x47677e['as'],'attributes':_0x47677e[_0xc8de('0x15')],'include':_0x47677e[_0xc8de('0x13')]?_['map'](_0x47677e[_0xc8de('0x13')],function(_0x15ecd9){return{'model':db[_0x15ecd9[_0xc8de('0x14')]],'as':_0x15ecd9['as'],'attributes':_0x15ecd9['attributes']};}):[]};}):[]};}):[]:[]})[_0xc8de('0x16')](function(_0x48a25a){logger[_0xc8de('0x17')](_0xc8de('0xc'),_0x455ea0);logger[_0xc8de('0x18')](_0xc8de('0xc'),_0x455ea0,JSON['stringify'](_0x48a25a));_0x4849e3(_0x48a25a);})[_0xc8de('0x19')](function(_0x4c8820){logger[_0xc8de('0x1a')]('GetUser',_0x4c8820[_0xc8de('0x1b')],_0x455ea0);_0x18788e(_0x272e66['error'](0x1f4,_0x4c8820['message']));});});};exports[_0xc8de('0x1c')]=function(_0x115d90){var _0x46bd8b=this;return new Promise(function(_0x3af218,_0x4cfc83){return db['User'][_0xc8de('0x1d')]({'raw':_0x115d90['options']?_0x115d90[_0xc8de('0xf')][_0xc8de('0x10')]===undefined?!![]:![]:!![],'where':_0x115d90[_0xc8de('0xf')]?_0x115d90[_0xc8de('0xf')][_0xc8de('0x1e')]||null:null,'attributes':_0x115d90[_0xc8de('0xf')]?_0x115d90[_0xc8de('0xf')]['attributes']||null:null,'include':_0x115d90[_0xc8de('0xf')]?_0x115d90[_0xc8de('0xf')][_0xc8de('0x13')]?_['map'](_0x115d90[_0xc8de('0xf')]['include'],function(_0x5cd5c5){return{'model':db[_0x5cd5c5[_0xc8de('0x14')]],'as':_0x5cd5c5['as'],'attributes':_0x5cd5c5[_0xc8de('0x15')],'include':_0x5cd5c5[_0xc8de('0x13')]?_['map'](_0x5cd5c5[_0xc8de('0x13')],function(_0x31ffa9){return{'model':db[_0x31ffa9['model']],'as':_0x31ffa9['as'],'attributes':_0x31ffa9['attributes'],'include':_0x31ffa9[_0xc8de('0x13')]?_['map'](_0x31ffa9['include'],function(_0x1403a5){return{'model':db[_0x1403a5[_0xc8de('0x14')]],'as':_0x1403a5['as'],'attributes':_0x1403a5[_0xc8de('0x15')]};}):[]};}):[]};}):[]:[]})[_0xc8de('0x16')](function(_0x492193){logger['info'](_0xc8de('0x1c'),_0x115d90);logger[_0xc8de('0x18')](_0xc8de('0x1c'),_0x115d90,JSON[_0xc8de('0x1f')](_0x492193));_0x3af218(_0x492193);})[_0xc8de('0x19')](function(_0x5b869f){logger[_0xc8de('0x1a')](_0xc8de('0x1c'),_0x5b869f['message'],_0x115d90);_0x4cfc83(_0x46bd8b['error'](0x1f4,_0x5b869f[_0xc8de('0x1b')]));});});};exports[_0xc8de('0x20')]=function(_0x339ea6){var _0x1510ea;return db[_0xc8de('0xd')][_0xc8de('0x1d')]({'where':_0x339ea6[_0xc8de('0xf')]['where']||{},'attributes':['id',_0xc8de('0x21'),'role',_0xc8de('0x22'),'interface']})[_0xc8de('0x16')](function(_0xe48e8b){if(!_0xe48e8b){throw new Error(util[_0xc8de('0x23')]('User\x20with\x20id\x20%s\x20not\x20found',_0x339ea6[_0xc8de('0x24')]['id']));}_0x1510ea=_0xe48e8b;return db[_0xc8de('0x25')][_0xc8de('0x26')]({'paused':0x1},{'where':{'UserId':_0x1510ea['id']},'individualHooks':!![]});})[_0xc8de('0x16')](function(){return db[_0xc8de('0x27')]['findAll']({'where':{'membername':_0x1510ea[_0xc8de('0x21')],'type':_0xc8de('0x28'),'exitAt':null}});})[_0xc8de('0x16')](function(_0x503776){if(_0x503776&&_0x503776[_0xc8de('0x29')]){var _0x40a14e=moment()[_0xc8de('0x23')](_0xc8de('0x2a'));for(var _0x32a99f=0x0,_0x19df0e=_0x503776[_0xc8de('0x29')];_0x32a99f<_0x19df0e;_0x32a99f++){_0x503776[_0x32a99f][_0xc8de('0x2b')]({'exitAt':_0x40a14e});}}})['then'](function(){var _0x4294e0=[];var _0x5574e9=utils[_0xc8de('0x2c')]();_0x5574e9['forEach'](function(_0x1100dc){_0x4294e0[_0xc8de('0x2d')]({'channel':_0x1100dc,'membername':_0x1510ea[_0xc8de('0x21')],'interface':_[_0xc8de('0x2e')](_0x1510ea[_0xc8de('0x2f')])?util[_0xc8de('0x23')]('SIP/%s',_0x1510ea['name']):_0x1510ea['interface'],'type':_0xc8de('0x28'),'enterAt':moment()[_0xc8de('0x23')](_0xc8de('0x2a')),'data1':_0x339ea6[_0xc8de('0x30')]['type']||'DEFAULT\x20PAUSE','role':_0x1510ea[_0xc8de('0x31')],'internal':_0x1510ea[_0xc8de('0x22')],'uniqueid':_0x339ea6[_0xc8de('0x30')][_0xc8de('0x32')]||null});});return db[_0xc8de('0x27')][_0xc8de('0x33')](_0x4294e0,{'individualHooks':!![]});})['then'](function(){return _0x1510ea[_0xc8de('0x26')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x339ea6[_0xc8de('0x30')][_0xc8de('0x34')]||'DEFAULT\x20PAUSE','lastPauseAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')});})['catch'](function(_0x4964b3){throw _0x4964b3;});};exports['UnpauseUser']=function(_0x295e1a){return Promise[_0xc8de('0x35')]()[_0xc8de('0x16')](function(){if(_0x295e1a[_0xc8de('0x30')][_0xc8de('0x36')]&&!utils[_0xc8de('0x37')](_0x295e1a['body'][_0xc8de('0x36')])){throw new Error(util[_0xc8de('0x23')](_0xc8de('0x38'),_0x295e1a['body'][_0xc8de('0x36')]));}return db[_0xc8de('0xd')][_0xc8de('0x39')]({'where':_0x295e1a[_0xc8de('0xf')][_0xc8de('0x1e')]||{},'attributes':['id','name',_0xc8de('0x31'),_0xc8de('0x22'),_0xc8de('0x2f'),'online',_0xc8de('0x3a'),'mailPause',_0xc8de('0x3b'),_0xc8de('0x3c'),_0xc8de('0x3d'),_0xc8de('0x3e'),_0xc8de('0x3f'),_0xc8de('0x40'),_0xc8de('0x41')]});})['then'](function(_0x4ef93e){if(!_0x4ef93e){throw new Error(util[_0xc8de('0x23')](_0xc8de('0x42'),_0x295e1a['params']['id']));}return _0x4ef93e[_0xc8de('0x43')](_0x295e1a[_0xc8de('0x30')][_0xc8de('0x36')],_0xc8de('0x44'));})[_0xc8de('0x19')](function(_0x23b352){throw _0x23b352;});};exports[_0xc8de('0x45')]=function(_0xe6900b){var _0x1b792b=this;return new Promise(function(_0x1762b6,_0x3b953e){var _0x4bd782;return db[_0xc8de('0xd')][_0xc8de('0x39')]({'where':_0xe6900b['options'][_0xc8de('0x1e')]||{},'attributes':['id',_0xc8de('0x21')]})[_0xc8de('0x16')](function(_0x5567a7){if(_0x5567a7){_0x4bd782=_0x5567a7;return db[_0xc8de('0x25')][_0xc8de('0x46')]({'where':{'membername':_0x4bd782[_0xc8de('0x21')]},'individualHooks':!![]});}})[_0xc8de('0x16')](function(){if(_0x4bd782){return db[_0xc8de('0x27')][_0xc8de('0xe')]({'where':{'membername':_0x4bd782[_0xc8de('0x21')],'exitAt':null}});}})[_0xc8de('0x16')](function(_0x429654){if(_0x4bd782){if(_0x429654&&_0x429654[_0xc8de('0x29')]){var _0x3933a0=[];_0x429654['forEach'](function(_0x48af17){_0x3933a0[_0xc8de('0x2d')](_0x48af17[_0xc8de('0x26')]({'exitAt':moment()[_0xc8de('0x23')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0xc8de('0x47')](_0x3933a0);}}})[_0xc8de('0x16')](function(){if(_0x4bd782){return _0x4bd782[_0xc8de('0x26')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0xc8de('0x16')](function(_0x4d8710){_0x1762b6(_0x4d8710);})[_0xc8de('0x19')](function(_0x1424d8){_0x3b953e(_0x1b792b[_0xc8de('0x1a')](0x1f4,_0x1424d8[_0xc8de('0x1b')]));});});};exports[_0xc8de('0x48')]=function(_0x1246de){var _0x402487=this;return new Promise(function(_0x33329d,_0x4f24ae){var _0x392b54;var _0x254a34;var _0x4c0464;var _0x3253af;return db[_0xc8de('0xd')][_0xc8de('0x39')]({'where':_0x1246de[_0xc8de('0xf')][_0xc8de('0x1e')]||{},'attributes':['id',_0xc8de('0x21'),_0xc8de('0x31'),_0xc8de('0x49'),'phone','internal','loginInPause',_0xc8de('0x2f')]})[_0xc8de('0x16')](function(_0x56d750){if(_0x56d750){_0x392b54=_0x56d750;_0x3253af=_0x1246de[_0xc8de('0x30')][_0xc8de('0x2f')]?_0x1246de[_0xc8de('0x30')][_0xc8de('0x2f')]:util[_0xc8de('0x23')]('SIP/%s',_0x392b54['name']);return db[_0xc8de('0xd')][_0xc8de('0x4a')]({'where':{'role':_0xc8de('0x4b'),'online':!![],'id':{'$ne':_0x392b54['id']}}});}})[_0xc8de('0x16')](function(_0x50457b){if(_0x50457b){_0x4c0464=_0x50457b;return require(_0xc8de('0x4c'))[_0xc8de('0x4d')]();}})[_0xc8de('0x16')](function(_0x14743d){if(_0x14743d&&_0x14743d[_0xc8de('0x4e')]&&_0x4c0464>=_0x14743d[_0xc8de('0x4e')]){throw new Error('Maximum\x20login\x20has\x20been\x20reached');}})[_0xc8de('0x16')](function(){if(_0x392b54){return db[_0xc8de('0x25')][_0xc8de('0x46')]({'where':{'membername':_0x392b54[_0xc8de('0x21')]},'individualHooks':!![]});}})[_0xc8de('0x16')](function(){if(_0x392b54){return _0x392b54[_0xc8de('0x4f')]({'raw':!![]});}})[_0xc8de('0x16')](function(_0x58fcbb){if(_0x392b54){if(_0x58fcbb){var _0x59beeb=[];_0x254a34=_0x58fcbb;if(_0x254a34['length']){for(var _0x55ca7c=0x0;_0x55ca7c<_0x254a34[_0xc8de('0x29')];_0x55ca7c++){_0x59beeb[_0xc8de('0x2d')](db[_0xc8de('0x25')][_0xc8de('0x50')]({'membername':_0x392b54[_0xc8de('0x21')],'UserId':_0x392b54['id'],'queue_name':_0x254a34[_0x55ca7c]['name'],'VoiceQueueId':_0x254a34[_0x55ca7c]['id'],'interface':_0x3253af,'paused':_0x392b54[_0xc8de('0x51')]||![],'penalty':_0x254a34[_0x55ca7c][_0xc8de('0x52')]||0x0}));}return BPromise[_0xc8de('0x47')](_0x59beeb);}}}})[_0xc8de('0x16')](function(){if(_0x392b54){return db['MemberReport'][_0xc8de('0xe')]({'where':{'membername':_0x392b54[_0xc8de('0x21')],'exitAt':null}});}})['then'](function(_0x5434a2){if(_0x392b54){if(_0x5434a2&&_0x5434a2[_0xc8de('0x29')]){var _0x405377=[];_0x5434a2['forEach'](function(_0x10fc41){_0x405377[_0xc8de('0x2d')](_0x10fc41['update']({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0xc8de('0x47')](_0x405377);}}})[_0xc8de('0x16')](function(){if(_0x392b54){var _0x8c84cf=[];var _0x41fd07=[];var _0x255bc3=utils[_0xc8de('0x2c')]();var _0x18e92f={'membername':_0x392b54[_0xc8de('0x21')],'interface':_0x3253af,'enterAt':moment()[_0xc8de('0x23')](_0xc8de('0x2a')),'role':_0x392b54['role'],'internal':_0x392b54[_0xc8de('0x22')]};_0x255bc3['forEach'](function(_0x30a0e0){_0x8c84cf[_0xc8de('0x2d')](_[_0xc8de('0x53')]({'channel':_0x30a0e0,'type':_0xc8de('0x54'),'data1':_0xc8de('0x55'),'data2':_0x3253af},_0x18e92f));if(_0x392b54[_0xc8de('0x51')]){_0x41fd07[_0xc8de('0x2d')](_[_0xc8de('0x53')]({'channel':_0x30a0e0,'type':_0xc8de('0x28'),'data1':'LOGININPAUSE'},_0x18e92f));}});return db[_0xc8de('0x27')][_0xc8de('0x33')](_0x8c84cf['concat'](_0x41fd07),{'individualHooks':!![]});}})['then'](function(){if(_0x392b54){return _0x392b54[_0xc8de('0x26')]({'online':!![],'lastLoginAt':moment()[_0xc8de('0x23')](_0xc8de('0x2a')),'voicePause':_0x392b54['loginInPause']||![],'mailPause':_0x392b54[_0xc8de('0x51')]||![],'chatPause':_0x392b54[_0xc8de('0x51')]||![],'faxPause':_0x392b54['loginInPause']||![],'smsPause':_0x392b54[_0xc8de('0x51')]||![],'openchannelPause':_0x392b54['loginInPause']||![],'pauseType':_0x392b54[_0xc8de('0x51')]?_0xc8de('0x56'):null,'lastPauseAt':moment()[_0xc8de('0x23')](_0xc8de('0x2a')),'interface':_0x3253af});}})[_0xc8de('0x16')](function(_0x16a685){_0x33329d(_0x16a685);})['catch'](function(_0x4ef5b2){_0x4f24ae(_0x402487[_0xc8de('0x1a')](0x1f4,_0x4ef5b2['message']));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index efe4005..8d0a0cc 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 _0x286b=['emit','register','length','user:','./user.events','save','remove'];(function(_0x349b8a,_0x35b021){var _0x1d5645=function(_0x1deb06){while(--_0x1deb06){_0x349b8a['push'](_0x349b8a['shift']());}};_0x1d5645(++_0x35b021);}(_0x286b,0x1d9));var _0xb286=function(_0x34272b,_0x3f8569){_0x34272b=_0x34272b-0x0;var _0x350547=_0x286b[_0x34272b];return _0x350547;};'use strict';var UserEvents=require(_0xb286('0x0'));var events=[_0xb286('0x1'),_0xb286('0x2'),'update'];function createListener(_0x14823d,_0x175729){return function(_0x2bc399){_0x175729[_0xb286('0x3')](_0x14823d,_0x2bc399);};}function removeListener(_0x23e371,_0x453193){return function(){UserEvents['removeListener'](_0x23e371,_0x453193);};}exports[_0xb286('0x4')]=function(_0x4e561c){for(var _0xf7ef24=0x0,_0x49fd52=events[_0xb286('0x5')];_0xf7ef24<_0x49fd52;_0xf7ef24++){var _0x5dff7b=events[_0xf7ef24];var _0x14e5ab=createListener(_0xb286('0x6')+_0x5dff7b,_0x4e561c);UserEvents['on'](_0x5dff7b,_0x14e5ab);}}; \ No newline at end of file +var _0xbe0c=['register','length','user:','./user.events','save','remove','emit','removeListener'];(function(_0x29284c,_0x4928c3){var _0x5aa949=function(_0x569f04){while(--_0x569f04){_0x29284c['push'](_0x29284c['shift']());}};_0x5aa949(++_0x4928c3);}(_0xbe0c,0x17b));var _0xcbe0=function(_0x5da730,_0x27c81c){_0x5da730=_0x5da730-0x0;var _0x459c62=_0xbe0c[_0x5da730];return _0x459c62;};'use strict';var UserEvents=require(_0xcbe0('0x0'));var events=[_0xcbe0('0x1'),_0xcbe0('0x2'),'update'];function createListener(_0x287c8a,_0x4ac452){return function(_0x4d1b02){_0x4ac452[_0xcbe0('0x3')](_0x287c8a,_0x4d1b02);};}function removeListener(_0x341d55,_0x181e2b){return function(){UserEvents[_0xcbe0('0x4')](_0x341d55,_0x181e2b);};}exports[_0xcbe0('0x5')]=function(_0x2351b5){for(var _0x271fd4=0x0,_0x1536b7=events[_0xcbe0('0x6')];_0x271fd4<_0x1536b7;_0x271fd4++){var _0x5c3365=events[_0x271fd4];var _0x11f0b7=createListener(_0xcbe0('0x7')+_0x5c3365,_0x2351b5);UserEvents['on'](_0x5c3365,_0x11f0b7);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index c626462..13b939f 100644 --- a/server/api/userChatQueue/index.js +++ b/server/api/userChatQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x367057,_0x4d79b2){var _0x56fdc9=function(_0x324a54){while(--_0x324a54){_0x367057['push'](_0x367057['shift']());}};_0x56fdc9(++_0x4d79b2);}(_0xe706,0xa3));var _0x6e70=function(_0x1927d7,_0x4a9be6){_0x1927d7=_0x1927d7-0x0;var _0x2a73f5=_0xe706[_0x1927d7];return _0x2a73f5;};'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(_0x24896c,_0x3d3472){var _0x4dbcf6=function(_0x5f0d66){while(--_0x5f0d66){_0x24896c['push'](_0x24896c['shift']());}};_0x4dbcf6(++_0x3d3472);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index 4802737..e3a5482 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 _0x808d=['INTEGER','exports'];(function(_0x3c070b,_0x238aeb){var _0x23e067=function(_0x4004a4){while(--_0x4004a4){_0x3c070b['push'](_0x3c070b['shift']());}};_0x23e067(++_0x238aeb);}(_0x808d,0x1e3));var _0xd808=function(_0x4c6070,_0x2b2f96){_0x4c6070=_0x4c6070-0x0;var _0x5e4853=_0x808d[_0x4c6070];return _0x5e4853;};'use strict';var Sequelize=require('sequelize');module[_0xd808('0x0')]={'penalty':{'type':Sequelize[_0xd808('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x01c9=['INTEGER','exports'];(function(_0x389640,_0x5dcf62){var _0x45897b=function(_0x440a14){while(--_0x440a14){_0x389640['push'](_0x389640['shift']());}};_0x45897b(++_0x5dcf62);}(_0x01c9,0x1a3));var _0x901c=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x01c9[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require('sequelize');module[_0x901c('0x0')]={'penalty':{'type':Sequelize[_0x901c('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.model.js b/server/api/userChatQueue/userChatQueue.model.js index d25edeb..7e7c1a4 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 _0x8adf=['user_has_chat_queues','lodash','util','moment','bluebird','path','rimraf','./userChatQueue.attributes','define'];(function(_0x2ae2ab,_0x1b6c50){var _0xd968c1=function(_0x46b150){while(--_0x46b150){_0x2ae2ab['push'](_0x2ae2ab['shift']());}};_0xd968c1(++_0x1b6c50);}(_0x8adf,0xf4));var _0xf8ad=function(_0x275ec6,_0x4c30e1){_0x275ec6=_0x275ec6-0x0;var _0x18dbd6=_0x8adf[_0x275ec6];return _0x18dbd6;};'use strict';var _=require(_0xf8ad('0x0'));var util=require(_0xf8ad('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xf8ad('0x2'));var BPromise=require(_0xf8ad('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf8ad('0x4'));var rimraf=require(_0xf8ad('0x5'));var config=require('../../config/environment');var attributes=require(_0xf8ad('0x6'));module['exports']=function(_0x1b33d0,_0x2d6fd7){return _0x1b33d0[_0xf8ad('0x7')]('UserChatQueue',attributes,{'tableName':_0xf8ad('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x098b=['util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports','user_has_chat_queues','lodash'];(function(_0x271ce9,_0x20240c){var _0x12683d=function(_0x3577c4){while(--_0x3577c4){_0x271ce9['push'](_0x271ce9['shift']());}};_0x12683d(++_0x20240c);}(_0x098b,0x1a1));var _0xb098=function(_0x2997f1,_0x4ebc19){_0x2997f1=_0x2997f1-0x0;var _0x33dbea=_0x098b[_0x2997f1];return _0x33dbea;};'use strict';var _=require(_0xb098('0x0'));var util=require(_0xb098('0x1'));var logger=require(_0xb098('0x2'))(_0xb098('0x3'));var moment=require(_0xb098('0x4'));var BPromise=require(_0xb098('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb098('0x6'));var rimraf=require(_0xb098('0x7'));var config=require(_0xb098('0x8'));var attributes=require('./userChatQueue.attributes');module[_0xb098('0x9')]=function(_0x189ec6,_0xbdcba7){return _0x189ec6['define']('UserChatQueue',attributes,{'tableName':_0xb098('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.rpc.js b/server/api/userChatQueue/userChatQueue.rpc.js index 370bf7d..3547e0b 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 _0xdad1=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch'];(function(_0x19c4a4,_0x345a60){var _0x22c39d=function(_0x24845a){while(--_0x24845a){_0x19c4a4['push'](_0x19c4a4['shift']());}};_0x22c39d(++_0x345a60);}(_0xdad1,0x160));var _0x1dad=function(_0x4a8542,_0x41a7d3){_0x4a8542=_0x4a8542-0x0;var _0x364406=_0xdad1[_0x4a8542];return _0x364406;};'use strict';var _=require(_0x1dad('0x0'));var util=require(_0x1dad('0x1'));var moment=require(_0x1dad('0x2'));var BPromise=require(_0x1dad('0x3'));var rs=require(_0x1dad('0x4'));var fs=require('fs');var Redis=require(_0x1dad('0x5'));var db=require(_0x1dad('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x1dad('0x7'))(_0x1dad('0x8'));var config=require(_0x1dad('0x9'));var jayson=require(_0x1dad('0xa'));var client=jayson[_0x1dad('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4641b2,_0x36a567,_0xad8685){return new BPromise(function(_0x28194b,_0x109d5e){return client[_0x1dad('0xc')](_0x4641b2,_0xad8685)['then'](function(_0x36ee90){logger[_0x1dad('0xd')](_0x1dad('0xe'),_0x36a567,_0x1dad('0xf'));logger[_0x1dad('0x10')]('UserChatQueue,\x20%s,\x20%s,\x20%s',_0x36a567,_0x1dad('0xf'),JSON['stringify'](_0x36ee90));if(_0x36ee90['error']){if(_0x36ee90[_0x1dad('0x11')][_0x1dad('0x12')]===0x1f4){logger[_0x1dad('0x11')]('UserChatQueue,\x20%s,\x20%s',_0x36a567,_0x36ee90[_0x1dad('0x11')][_0x1dad('0x13')]);return _0x109d5e(_0x36ee90[_0x1dad('0x11')]['message']);}logger['error'](_0x1dad('0xe'),_0x36a567,_0x36ee90[_0x1dad('0x11')][_0x1dad('0x13')]);return _0x28194b(_0x36ee90[_0x1dad('0x11')][_0x1dad('0x13')]);}else{logger[_0x1dad('0xd')]('UserChatQueue,\x20%s,\x20%s',_0x36a567,_0x1dad('0xf'));_0x28194b(_0x36ee90[_0x1dad('0x14')][_0x1dad('0x13')]);}})[_0x1dad('0x15')](function(_0x2f431c){logger[_0x1dad('0x11')]('UserChatQueue,\x20%s,\x20%s',_0x36a567,_0x2f431c);_0x109d5e(_0x2f431c);});});} \ No newline at end of file +var _0x7e54=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','error','code','message','catch','lodash','util','moment','bluebird','../../mysqldb'];(function(_0x5e88e2,_0x179d10){var _0x31af63=function(_0x1141ff){while(--_0x1141ff){_0x5e88e2['push'](_0x5e88e2['shift']());}};_0x31af63(++_0x179d10);}(_0x7e54,0x1ef));var _0x47e5=function(_0x3eb853,_0x143bdc){_0x3eb853=_0x3eb853-0x0;var _0x1ce6a=_0x7e54[_0x3eb853];return _0x1ce6a;};'use strict';var _=require(_0x47e5('0x0'));var util=require(_0x47e5('0x1'));var moment=require(_0x47e5('0x2'));var BPromise=require(_0x47e5('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x47e5('0x4'))['db'];var utils=require(_0x47e5('0x5'));var logger=require(_0x47e5('0x6'))('rpc');var config=require(_0x47e5('0x7'));var jayson=require(_0x47e5('0x8'));var client=jayson[_0x47e5('0x9')][_0x47e5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x54a589,_0x2821a3,_0x43d553){return new BPromise(function(_0xf17cac,_0x39915c){return client[_0x47e5('0xb')](_0x54a589,_0x43d553)['then'](function(_0x119ebf){logger[_0x47e5('0xc')](_0x47e5('0xd'),_0x2821a3,_0x47e5('0xe'));logger[_0x47e5('0xf')]('UserChatQueue,\x20%s,\x20%s,\x20%s',_0x2821a3,_0x47e5('0xe'),JSON['stringify'](_0x119ebf));if(_0x119ebf[_0x47e5('0x10')]){if(_0x119ebf[_0x47e5('0x10')][_0x47e5('0x11')]===0x1f4){logger[_0x47e5('0x10')](_0x47e5('0xd'),_0x2821a3,_0x119ebf[_0x47e5('0x10')][_0x47e5('0x12')]);return _0x39915c(_0x119ebf['error']['message']);}logger['error'](_0x47e5('0xd'),_0x2821a3,_0x119ebf[_0x47e5('0x10')][_0x47e5('0x12')]);return _0xf17cac(_0x119ebf['error'][_0x47e5('0x12')]);}else{logger['info'](_0x47e5('0xd'),_0x2821a3,'request\x20sent');_0xf17cac(_0x119ebf['result'][_0x47e5('0x12')]);}})[_0x47e5('0x13')](function(_0x1c2ec0){logger[_0x47e5('0x10')]('UserChatQueue,\x20%s,\x20%s',_0x2821a3,_0x1c2ec0);_0x39915c(_0x1c2ec0);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index db48f71..1aeb754 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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0xb38299,_0xf318ce){var _0x42c20a=function(_0x4d7be8){while(--_0x4d7be8){_0xb38299['push'](_0xb38299['shift']());}};_0x42c20a(++_0xf318ce);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x4c9380,_0x2fefc0){_0x4c9380=_0x4c9380-0x0;var _0x49a523=_0xcb91[_0x4c9380];return _0x49a523;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file +var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x47d09f,_0x5811cd){var _0x461fea=function(_0x1855cb){while(--_0x1855cb){_0x47d09f['push'](_0x47d09f['shift']());}};_0x461fea(++_0x5811cd);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x47c5bf,_0x45977e){_0x47c5bf=_0x47c5bf-0x0;var _0x11b779=_0xcb91[_0x47c5bf];return _0x11b779;};'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/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index 9c11b80..8dcfee2 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 _0x039c=['INTEGER','STRING','sequelize'];(function(_0x4c0f14,_0x42fd19){var _0x262968=function(_0x79d1c9){while(--_0x79d1c9){_0x4c0f14['push'](_0x4c0f14['shift']());}};_0x262968(++_0x42fd19);}(_0x039c,0xb9));var _0xc039=function(_0xb121c2,_0x4ac30f){_0xb121c2=_0xb121c2-0x0;var _0x3c83b0=_0x039c[_0xb121c2];return _0x3c83b0;};'use strict';var Sequelize=require(_0xc039('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xc039('0x1')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xc039('0x1')],'defaultValue':0x0},'queue':{'type':Sequelize[_0xc039('0x2')]}}; \ No newline at end of file +var _0x3e71=['sequelize'];(function(_0x938883,_0x8c25d){var _0x1bdae2=function(_0x365680){while(--_0x365680){_0x938883['push'](_0x938883['shift']());}};_0x1bdae2(++_0x8c25d);}(_0x3e71,0x1c1));var _0x13e7=function(_0x588b67,_0x478546){_0x588b67=_0x588b67-0x0;var _0x2aee11=_0x3e71[_0x588b67];return _0x2aee11;};'use strict';var Sequelize=require(_0x13e7('0x0'));module['exports']={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'queue':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index d00cb04..4d42a37 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 _0xc895=['rimraf','../../config/environment','exports','define','UserFaxQueue','user_has_fax_queues','lodash','util','../../config/logger','moment','path'];(function(_0x4ac96c,_0x2785d5){var _0x31b35e=function(_0x390915){while(--_0x390915){_0x4ac96c['push'](_0x4ac96c['shift']());}};_0x31b35e(++_0x2785d5);}(_0xc895,0xab));var _0x5c89=function(_0x14382a,_0x409280){_0x14382a=_0x14382a-0x0;var _0x2d05fb=_0xc895[_0x14382a];return _0x2d05fb;};'use strict';var _=require(_0x5c89('0x0'));var util=require(_0x5c89('0x1'));var logger=require(_0x5c89('0x2'))('api');var moment=require(_0x5c89('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x5c89('0x4'));var rimraf=require(_0x5c89('0x5'));var config=require(_0x5c89('0x6'));var attributes=require('./userFaxQueue.attributes');module[_0x5c89('0x7')]=function(_0x4e3b46,_0x4bac33){return _0x4e3b46[_0x5c89('0x8')](_0x5c89('0x9'),attributes,{'tableName':_0x5c89('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x021c=['UserFaxQueue','user_has_fax_queues','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./userFaxQueue.attributes','define'];(function(_0x1a5cd7,_0x3811e9){var _0x399402=function(_0x2b388c){while(--_0x2b388c){_0x1a5cd7['push'](_0x1a5cd7['shift']());}};_0x399402(++_0x3811e9);}(_0x021c,0xce));var _0xc021=function(_0x546496,_0x51544c){_0x546496=_0x546496-0x0;var _0x3afe5a=_0x021c[_0x546496];return _0x3afe5a;};'use strict';var _=require(_0xc021('0x0'));var util=require(_0xc021('0x1'));var logger=require(_0xc021('0x2'))('api');var moment=require(_0xc021('0x3'));var BPromise=require(_0xc021('0x4'));var rp=require(_0xc021('0x5'));var fs=require('fs');var path=require(_0xc021('0x6'));var rimraf=require(_0xc021('0x7'));var config=require('../../config/environment');var attributes=require(_0xc021('0x8'));module['exports']=function(_0xbf8e68,_0x155040){return _0xbf8e68[_0xc021('0x9')](_0xc021('0xa'),attributes,{'tableName':_0xc021('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.rpc.js b/server/api/userFaxQueue/userFaxQueue.rpc.js index 26d7742..4172958 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 _0x23ef=['catch','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','error','code','UserFaxQueue,\x20%s,\x20%s','message','result'];(function(_0x23e7c1,_0x35110c){var _0x1add43=function(_0x238918){while(--_0x238918){_0x23e7c1['push'](_0x23e7c1['shift']());}};_0x1add43(++_0x35110c);}(_0x23ef,0xd3));var _0xf23e=function(_0x4efb3c,_0x58a7d2){_0x4efb3c=_0x4efb3c-0x0;var _0x443854=_0x23ef[_0x4efb3c];return _0x443854;};'use strict';var _=require('lodash');var util=require(_0xf23e('0x0'));var moment=require('moment');var BPromise=require(_0xf23e('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf23e('0x2'));var db=require(_0xf23e('0x3'))['db'];var utils=require(_0xf23e('0x4'));var logger=require(_0xf23e('0x5'))('rpc');var config=require(_0xf23e('0x6'));var jayson=require(_0xf23e('0x7'));var client=jayson[_0xf23e('0x8')][_0xf23e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3375b1,_0x300e3e,_0x4f4e95){return new BPromise(function(_0x274773,_0x45fc4c){return client[_0xf23e('0xa')](_0x3375b1,_0x4f4e95)['then'](function(_0x58bf6b){logger[_0xf23e('0xb')]('UserFaxQueue,\x20%s,\x20%s',_0x300e3e,_0xf23e('0xc'));logger[_0xf23e('0xd')](_0xf23e('0xe'),_0x300e3e,'request\x20sent',JSON['stringify'](_0x58bf6b));if(_0x58bf6b[_0xf23e('0xf')]){if(_0x58bf6b[_0xf23e('0xf')][_0xf23e('0x10')]===0x1f4){logger[_0xf23e('0xf')](_0xf23e('0x11'),_0x300e3e,_0x58bf6b[_0xf23e('0xf')][_0xf23e('0x12')]);return _0x45fc4c(_0x58bf6b[_0xf23e('0xf')][_0xf23e('0x12')]);}logger['error'](_0xf23e('0x11'),_0x300e3e,_0x58bf6b[_0xf23e('0xf')][_0xf23e('0x12')]);return _0x274773(_0x58bf6b['error'][_0xf23e('0x12')]);}else{logger[_0xf23e('0xb')]('UserFaxQueue,\x20%s,\x20%s',_0x300e3e,_0xf23e('0xc'));_0x274773(_0x58bf6b[_0xf23e('0x13')][_0xf23e('0x12')]);}})[_0xf23e('0x14')](function(_0xc1e678){logger[_0xf23e('0xf')](_0xf23e('0x11'),_0x300e3e,_0xc1e678);_0x45fc4c(_0xc1e678);});});} \ No newline at end of file +var _0xf972=['stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s'];(function(_0xd09668,_0x1435b2){var _0x68726=function(_0x54a030){while(--_0x54a030){_0xd09668['push'](_0xd09668['shift']());}};_0x68726(++_0x1435b2);}(_0xf972,0xbe));var _0x2f97=function(_0x4366ca,_0x13a88f){_0x4366ca=_0x4366ca-0x0;var _0x4d0ec2=_0xf972[_0x4366ca];return _0x4d0ec2;};'use strict';var _=require(_0x2f97('0x0'));var util=require(_0x2f97('0x1'));var moment=require(_0x2f97('0x2'));var BPromise=require(_0x2f97('0x3'));var rs=require(_0x2f97('0x4'));var fs=require('fs');var Redis=require(_0x2f97('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x2f97('0x6'));var logger=require(_0x2f97('0x7'))('rpc');var config=require(_0x2f97('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x2f97('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x33a159,_0x582609,_0x41e25d){return new BPromise(function(_0x3eaea9,_0x140137){return client[_0x2f97('0xa')](_0x33a159,_0x41e25d)[_0x2f97('0xb')](function(_0x1a6a08){logger[_0x2f97('0xc')](_0x2f97('0xd'),_0x582609,_0x2f97('0xe'));logger[_0x2f97('0xf')](_0x2f97('0x10'),_0x582609,_0x2f97('0xe'),JSON[_0x2f97('0x11')](_0x1a6a08));if(_0x1a6a08[_0x2f97('0x12')]){if(_0x1a6a08[_0x2f97('0x12')][_0x2f97('0x13')]===0x1f4){logger['error'](_0x2f97('0xd'),_0x582609,_0x1a6a08['error'][_0x2f97('0x14')]);return _0x140137(_0x1a6a08[_0x2f97('0x12')][_0x2f97('0x14')]);}logger['error'](_0x2f97('0xd'),_0x582609,_0x1a6a08['error'][_0x2f97('0x14')]);return _0x3eaea9(_0x1a6a08[_0x2f97('0x12')][_0x2f97('0x14')]);}else{logger[_0x2f97('0xc')](_0x2f97('0xd'),_0x582609,'request\x20sent');_0x3eaea9(_0x1a6a08[_0x2f97('0x15')][_0x2f97('0x14')]);}})[_0x2f97('0x16')](function(_0x44b645){logger[_0x2f97('0x12')]('UserFaxQueue,\x20%s,\x20%s',_0x582609,_0x44b645);_0x140137(_0x44b645);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index d6c0575..602a9d2 100644 --- a/server/api/userMailQueue/index.js +++ b/server/api/userMailQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x13ccbd,_0x10299b){var _0x3e7cb6=function(_0x10a25e){while(--_0x10a25e){_0x13ccbd['push'](_0x13ccbd['shift']());}};_0x3e7cb6(++_0x10299b);}(_0xe706,0xa3));var _0x6e70=function(_0x50c86a,_0x2fec99){_0x50c86a=_0x50c86a-0x0;var _0x53420a=_0xe706[_0x50c86a];return _0x53420a;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file +var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x424cf8,_0x3803fb){var _0x5b0156=function(_0x1a3a82){while(--_0x1a3a82){_0x424cf8['push'](_0x424cf8['shift']());}};_0x5b0156(++_0x3803fb);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x1ee0a1,_0x51058e){_0x1ee0a1=_0x1ee0a1-0x0;var _0x1d2d5b=_0xcb91[_0x1ee0a1];return _0x1d2d5b;};'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 62bef5e..4066733 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 _0xa81a=['INTEGER','sequelize'];(function(_0x54433c,_0x2d7fbc){var _0x40535e=function(_0x57e47c){while(--_0x57e47c){_0x54433c['push'](_0x54433c['shift']());}};_0x40535e(++_0x2d7fbc);}(_0xa81a,0x1f1));var _0xaa81=function(_0x4fcfda,_0x45099a){_0x4fcfda=_0x4fcfda-0x0;var _0x12c8a5=_0xa81a[_0x4fcfda];return _0x12c8a5;};'use strict';var Sequelize=require(_0xaa81('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xaa81('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xd365=['exports','INTEGER','sequelize'];(function(_0x4baae2,_0x487ab6){var _0x1a2285=function(_0x1cea47){while(--_0x1cea47){_0x4baae2['push'](_0x4baae2['shift']());}};_0x1a2285(++_0x487ab6);}(_0xd365,0x8f));var _0x5d36=function(_0x162038,_0x2eb3a2){_0x162038=_0x162038-0x0;var _0x374f60=_0xd365[_0x162038];return _0x374f60;};'use strict';var Sequelize=require(_0x5d36('0x0'));module[_0x5d36('0x1')]={'penalty':{'type':Sequelize[_0x5d36('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.model.js b/server/api/userMailQueue/userMailQueue.model.js index 1abd690..6ea1e7b 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 _0xe84e=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userMailQueue.attributes','define','UserMailQueue'];(function(_0x4a7c9a,_0x5089a5){var _0x53680d=function(_0x3a6112){while(--_0x3a6112){_0x4a7c9a['push'](_0x4a7c9a['shift']());}};_0x53680d(++_0x5089a5);}(_0xe84e,0x179));var _0xee84=function(_0x2f1172,_0x5f5b26){_0x2f1172=_0x2f1172-0x0;var _0x58e374=_0xe84e[_0x2f1172];return _0x58e374;};'use strict';var _=require(_0xee84('0x0'));var util=require(_0xee84('0x1'));var logger=require(_0xee84('0x2'))(_0xee84('0x3'));var moment=require(_0xee84('0x4'));var BPromise=require(_0xee84('0x5'));var rp=require(_0xee84('0x6'));var fs=require('fs');var path=require(_0xee84('0x7'));var rimraf=require(_0xee84('0x8'));var config=require(_0xee84('0x9'));var attributes=require(_0xee84('0xa'));module['exports']=function(_0x1577a8,_0x1d8b56){return _0x1577a8[_0xee84('0xb')](_0xee84('0xc'),attributes,{'tableName':'user_has_mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xad99=['request-promise','rimraf','../../config/environment','./userMailQueue.attributes','exports','define','lodash','util','../../config/logger','moment','bluebird'];(function(_0x585d81,_0xf6d74f){var _0x1aca0d=function(_0x3782d3){while(--_0x3782d3){_0x585d81['push'](_0x585d81['shift']());}};_0x1aca0d(++_0xf6d74f);}(_0xad99,0x1a8));var _0x9ad9=function(_0x6256ab,_0x231af5){_0x6256ab=_0x6256ab-0x0;var _0x624fd4=_0xad99[_0x6256ab];return _0x624fd4;};'use strict';var _=require(_0x9ad9('0x0'));var util=require(_0x9ad9('0x1'));var logger=require(_0x9ad9('0x2'))('api');var moment=require(_0x9ad9('0x3'));var BPromise=require(_0x9ad9('0x4'));var rp=require(_0x9ad9('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9ad9('0x6'));var config=require(_0x9ad9('0x7'));var attributes=require(_0x9ad9('0x8'));module[_0x9ad9('0x9')]=function(_0x345100,_0x8ae0d5){return _0x345100[_0x9ad9('0xa')]('UserMailQueue',attributes,{'tableName':'user_has_mail_queues','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 4d05d59..39812d0 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 _0xe14b=['../../config/environment','jayson/promise','client','http','then','info','UserMailQueue,\x20%s,\x20%s','UserMailQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','randomstring','ioredis','../../config/utils'];(function(_0x5f4153,_0x3e35b5){var _0x2f1cf9=function(_0x12bdae){while(--_0x12bdae){_0x5f4153['push'](_0x5f4153['shift']());}};_0x2f1cf9(++_0x3e35b5);}(_0xe14b,0x93));var _0xbe14=function(_0x25c650,_0x1d4aee){_0x25c650=_0x25c650-0x0;var _0x3373ff=_0xe14b[_0x25c650];return _0x3373ff;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xbe14('0x2'));var fs=require('fs');var Redis=require(_0xbe14('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xbe14('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xbe14('0x5'));var jayson=require(_0xbe14('0x6'));var client=jayson[_0xbe14('0x7')][_0xbe14('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1d9ade,_0x39387e,_0x196fca){return new BPromise(function(_0x566ae7,_0x50f909){return client['request'](_0x1d9ade,_0x196fca)[_0xbe14('0x9')](function(_0x6fceff){logger[_0xbe14('0xa')](_0xbe14('0xb'),_0x39387e,'request\x20sent');logger['debug'](_0xbe14('0xc'),_0x39387e,_0xbe14('0xd'),JSON['stringify'](_0x6fceff));if(_0x6fceff[_0xbe14('0xe')]){if(_0x6fceff[_0xbe14('0xe')][_0xbe14('0xf')]===0x1f4){logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);return _0x50f909(_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);}logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);return _0x566ae7(_0x6fceff['error']['message']);}else{logger[_0xbe14('0xa')](_0xbe14('0xb'),_0x39387e,_0xbe14('0xd'));_0x566ae7(_0x6fceff[_0xbe14('0x11')]['message']);}})[_0xbe14('0x12')](function(_0xe9c3ec){logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0xe9c3ec);_0x50f909(_0xe9c3ec);});});} \ No newline at end of file +var _0x3e74=['rpc','../../config/environment','jayson/promise','client','http','request','request\x20sent','debug','error','UserMailQueue,\x20%s,\x20%s','message','info','catch','lodash','moment','bluebird','randomstring','../../config/utils'];(function(_0x22ce9b,_0x2d7921){var _0x150d97=function(_0x45ab75){while(--_0x45ab75){_0x22ce9b['push'](_0x22ce9b['shift']());}};_0x150d97(++_0x2d7921);}(_0x3e74,0x175));var _0x43e7=function(_0x434031,_0x30b8cd){_0x434031=_0x434031-0x0;var _0x2ce277=_0x3e74[_0x434031];return _0x2ce277;};'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']('UserMailQueue,\x20%s,\x20%s',_0x45a0d1,_0x43e7('0xb'));logger[_0x43e7('0xc')]('UserMailQueue,\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')]('UserMailQueue,\x20%s,\x20%s',_0x45a0d1,_0x264575);_0x8528fc(_0x264575);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index 9be5a65..cae532b 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 _0x009b=['post','isAuthenticated','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x4d3d14,_0x13dca5){var _0x1eee05=function(_0x5c3d77){while(--_0x5c3d77){_0x4d3d14['push'](_0x4d3d14['shift']());}};_0x1eee05(++_0x13dca5);}(_0x009b,0x110));var _0xb009=function(_0x6d9b39,_0x125a03){_0x6d9b39=_0x6d9b39-0x0;var _0x46e90c=_0x009b[_0x6d9b39];return _0x46e90c;};'use strict';var multer=require(_0xb009('0x0'));var util=require(_0xb009('0x1'));var path=require(_0xb009('0x2'));var timeout=require(_0xb009('0x3'));var express=require('express');var router=express[_0xb009('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xb009('0x5'));var interaction=require(_0xb009('0x6'));var config=require(_0xb009('0x7'));var controller=require('./userNotification.controller');router[_0xb009('0x8')]('/',auth[_0xb009('0x9')](),controller['sendUserNotification']);module['exports']=router; \ No newline at end of file +var _0x25b7=['path','connect-timeout','Router','../../components/auth/service','../../config/environment','./userNotification.controller','post','isAuthenticated','sendUserNotification','multer'];(function(_0x3931d7,_0x34c702){var _0x2ec3f3=function(_0x2c1507){while(--_0x2c1507){_0x3931d7['push'](_0x3931d7['shift']());}};_0x2ec3f3(++_0x34c702);}(_0x25b7,0xdb));var _0x725b=function(_0x343d38,_0x24d91c){_0x343d38=_0x343d38-0x0;var _0x36fcd3=_0x25b7[_0x343d38];return _0x36fcd3;};'use strict';var multer=require(_0x725b('0x0'));var util=require('util');var path=require(_0x725b('0x1'));var timeout=require(_0x725b('0x2'));var express=require('express');var router=express[_0x725b('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x725b('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x725b('0x5'));var controller=require(_0x725b('0x6'));router[_0x725b('0x7')]('/',auth[_0x725b('0x8')](),controller[_0x725b('0x9')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index 7b6fe73..ca7324f 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 _0x25cd=['sequelize','exports','TEXT','STRING','BOOLEAN'];(function(_0x2555d0,_0x4150a6){var _0x3bb486=function(_0x1eb89f){while(--_0x1eb89f){_0x2555d0['push'](_0x2555d0['shift']());}};_0x3bb486(++_0x4150a6);}(_0x25cd,0x15e));var _0xd25c=function(_0x53a167,_0x4bf6c7){_0x53a167=_0x53a167-0x0;var _0x150263=_0x25cd[_0x53a167];return _0x150263;};'use strict';var Sequelize=require(_0xd25c('0x0'));module[_0xd25c('0x1')]={'body':{'type':Sequelize['TEXT']},'senderName':{'type':Sequelize['STRING']},'recipientsId':{'type':Sequelize[_0xd25c('0x2')]},'recipientsDescription':{'type':Sequelize[_0xd25c('0x3')]},'beep':{'type':Sequelize[_0xd25c('0x4')]}}; \ No newline at end of file +var _0xd7ba=['exports','TEXT','STRING','BOOLEAN'];(function(_0x54efd2,_0x2445bd){var _0x48630a=function(_0xd19b57){while(--_0xd19b57){_0x54efd2['push'](_0x54efd2['shift']());}};_0x48630a(++_0x2445bd);}(_0xd7ba,0x164));var _0xad7b=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0xd7ba[_0x138adb];return _0x1b27f2;};'use strict';var Sequelize=require('sequelize');module[_0xad7b('0x0')]={'body':{'type':Sequelize[_0xad7b('0x1')]},'senderName':{'type':Sequelize[_0xad7b('0x2')]},'recipientsId':{'type':Sequelize['TEXT']},'recipientsDescription':{'type':Sequelize[_0xad7b('0x2')]},'beep':{'type':Sequelize[_0xad7b('0x3')]}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index c823dac..0f29633 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 _0xa018=['sox','to-csv','ejs','fs-extra','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','register','end','limit','count','offset','set','json','apply','reject','save','then','status','sendStatus','error','stack','name','send','sendUserNotification','body','text','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','faxqueue','mailqueue','openchannelqueue','smsqueue','voicequeue','whatsappqueue','team','user','some','includes','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','recipientsDescription','isEmpty','beep','SenderId','recipientsId','sortBy','join','UserNotification','create','forEach','recipient','emit','userNotification:send','catch','Template','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','startCase','User','union','ids','Queue','push','getAgents','map','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','path'];(function(_0x477f1b,_0x55a292){var _0x244d35=function(_0x2af917){while(--_0x2af917){_0x477f1b['push'](_0x477f1b['shift']());}};_0x244d35(++_0x55a292);}(_0xa018,0x116));var _0x8a01=function(_0x4fa0ea,_0x2cd534){_0x4fa0ea=_0x4fa0ea-0x0;var _0x51d027=_0xa018[_0x4fa0ea];return _0x51d027;};'use strict';var emlformat=require(_0x8a01('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8a01('0x1'));var jsonpatch=require(_0x8a01('0x2'));var rp=require('request-promise');var moment=require(_0x8a01('0x3'));var BPromise=require(_0x8a01('0x4'));var Mustache=require(_0x8a01('0x5'));var util=require('util');var path=require(_0x8a01('0x6'));var sox=require(_0x8a01('0x7'));var csv=require(_0x8a01('0x8'));var ejs=require(_0x8a01('0x9'));var fs=require('fs');var fs_extra=require(_0x8a01('0xa'));var _=require('lodash');var squel=require(_0x8a01('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x8a01('0xc'));var toCsv=require('to-csv');var querystring=require(_0x8a01('0xd'));var Papa=require(_0x8a01('0xe'));var Redis=require(_0x8a01('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x8a01('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8a01('0x11'));var logger=require(_0x8a01('0x12'))('api');var utils=require(_0x8a01('0x13'));var config=require(_0x8a01('0x14'));var licenseUtil=require(_0x8a01('0x15'));var db=require('../../mysqldb')['db'];config[_0x8a01('0x16')]=_[_0x8a01('0x17')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./userNotification.socket')[_0x8a01('0x18')](socket);function respondWithStatusCode(_0x5a1c6b,_0x18a0a0){_0x18a0a0=_0x18a0a0||0xcc;return function(_0x3a55f9){if(_0x3a55f9){return _0x5a1c6b['sendStatus'](_0x18a0a0);}return _0x5a1c6b['status'](_0x18a0a0)[_0x8a01('0x19')]();};}function respondWithResult(_0x9b8b94,_0xa8e7f6){_0xa8e7f6=_0xa8e7f6||0xc8;return function(_0x16346b){if(_0x16346b){return _0x9b8b94['status'](_0xa8e7f6)['json'](_0x16346b);}};}function respondWithFilteredResult(_0x42072a,_0x3c5574){return function(_0x49c67e){if(_0x49c67e){var _0x1723a6=typeof _0x3c5574['offset']==='undefined'&&typeof _0x3c5574[_0x8a01('0x1a')]==='undefined';var _0x240dac=_0x49c67e[_0x8a01('0x1b')];var _0x317511=_0x1723a6?0x0:_0x3c5574[_0x8a01('0x1c')];var _0x38d840=_0x1723a6?_0x49c67e[_0x8a01('0x1b')]:_0x3c5574[_0x8a01('0x1c')]+_0x3c5574[_0x8a01('0x1a')];var _0x245986;if(_0x38d840>=_0x240dac){_0x38d840=_0x240dac;_0x245986=0xc8;}else{_0x245986=0xce;}_0x42072a['status'](_0x245986);return _0x42072a[_0x8a01('0x1d')]('Content-Range',_0x317511+'-'+_0x38d840+'/'+_0x240dac)[_0x8a01('0x1e')](_0x49c67e);}return null;};}function patchUpdates(_0x1fc6af){return function(_0x6b484e){try{jsonpatch[_0x8a01('0x1f')](_0x6b484e,_0x1fc6af,!![]);}catch(_0x41e3c3){return BPromise[_0x8a01('0x20')](_0x41e3c3);}return _0x6b484e[_0x8a01('0x21')]();};}function saveUpdates(_0x129ea3,_0x246ed4){return function(_0x3be449){if(_0x3be449){return _0x3be449['update'](_0x129ea3)[_0x8a01('0x22')](function(_0x3d5447){return _0x3d5447;});}return null;};}function removeEntity(_0x45271e,_0x48b8d4){return function(_0x22471a){if(_0x22471a){return _0x22471a['destroy']()[_0x8a01('0x22')](function(){_0x45271e[_0x8a01('0x23')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2cbc6f,_0xce446){return function(_0x2e5ca7){if(!_0x2e5ca7){_0x2cbc6f[_0x8a01('0x24')](0x194);}return _0x2e5ca7;};}function handleError(_0x3e0a34,_0xdcef18){_0xdcef18=_0xdcef18||0x1f4;return function(_0x3f93bc){logger[_0x8a01('0x25')](_0x3f93bc[_0x8a01('0x26')]);if(_0x3f93bc[_0x8a01('0x27')]){delete _0x3f93bc['name'];}_0x3e0a34[_0x8a01('0x23')](_0xdcef18)[_0x8a01('0x28')](_0x3f93bc);};}exports[_0x8a01('0x29')]=function(_0x5f2530,_0x2d5871,_0x44084e){if(!_0x5f2530[_0x8a01('0x2a')]['hasOwnProperty'](_0x8a01('0x2b'))&&!_0x5f2530[_0x8a01('0x2a')][_0x8a01('0x2c')](_0x8a01('0x2d'))){throw new db['Sequelize'][(_0x8a01('0x2e'))](_0x8a01('0x2f'));}else{if(_0x5f2530[_0x8a01('0x2a')][_0x8a01('0x2c')](_0x8a01('0x2d'))&&!_0x5f2530[_0x8a01('0x2a')][_0x8a01('0x2c')](_0x8a01('0x30'))){throw new db[(_0x8a01('0x31'))][(_0x8a01('0x2e'))](_0x8a01('0x32'));}if(!_0x5f2530[_0x8a01('0x2a')][_0x8a01('0x2c')](_0x8a01('0x33'))){throw new db[(_0x8a01('0x31'))][(_0x8a01('0x2e'))](_0x8a01('0x34'));}else{try{var _0x414249=JSON[_0x8a01('0x35')](_0x5f2530['body']['recipients']);}catch(_0x1b1e24){logger[_0x8a01('0x25')](_0x1b1e24);throw new db[(_0x8a01('0x31'))]['ValidationError'](_0x8a01('0x36'));}var _0x4839c0=['chatqueue',_0x8a01('0x37'),_0x8a01('0x38'),_0x8a01('0x39'),_0x8a01('0x3a'),_0x8a01('0x3b'),_0x8a01('0x3c'),_0x8a01('0x3d'),_0x8a01('0x3e')];if(_[_0x8a01('0x3f')](_0x414249,function(_0x357e95){return!_[_0x8a01('0x40')](_0x4839c0,_0x357e95[_0x8a01('0x41')][_0x8a01('0x42')]());})){throw new db[(_0x8a01('0x31'))][(_0x8a01('0x2e'))](_0x8a01('0x43'));}}}var _0x313a44={};_0x313a44[_0x8a01('0x44')]=_0x5f2530[_0x8a01('0x2a')][_0x8a01('0x2c')](_0x8a01('0x44'))?_0x5f2530[_0x8a01('0x2a')][_0x8a01('0x44')]:_0x5f2530[_0x8a01('0x3e')]['fullname'];_0x313a44[_0x8a01('0x45')]=_[_0x8a01('0x46')](_0x5f2530['body'][_0x8a01('0x45')])?null:_0x5f2530[_0x8a01('0x2a')]['recipientsDescription'];_0x313a44[_0x8a01('0x47')]=_0x5f2530[_0x8a01('0x2a')][_0x8a01('0x47')]||![];_0x313a44[_0x8a01('0x48')]=_0x5f2530[_0x8a01('0x3e')]['id'];return getContent(_0x5f2530['body'])[_0x8a01('0x22')](function(_0x4eccce){_0x313a44['body']=_0x4eccce;return getRecipients(_0x414249);})['then'](function(_0x3b8e8b){_0x313a44[_0x8a01('0x49')]=_[_0x8a01('0x4a')](_0x3b8e8b)[_0x8a01('0x4b')](',');return db['sequelize']['transaction'](function(_0x4f584c){return db[_0x8a01('0x4c')][_0x8a01('0x4d')](_0x313a44,{'raw':!![],'transaction':_0x4f584c})[_0x8a01('0x22')](function(_0x3f3be2){var _0x1ec545={'sender':_0x313a44['senderName'],'description':_0x313a44['recipientsDescription'],'content':_0x313a44['body'],'beep':_0x313a44[_0x8a01('0x47')]};_0x3b8e8b[_0x8a01('0x4e')](function(_0x3ece45){_0x1ec545[_0x8a01('0x4f')]=_0x3ece45;socket[_0x8a01('0x50')](_0x8a01('0x51'),_0x1ec545);});return _0x3f3be2;});});})[_0x8a01('0x22')](respondWithResult(_0x2d5871,0xc9))[_0x8a01('0x52')](handleError(_0x2d5871,null));};function getContent(_0x49a488){return new BPromise(function(_0x562863,_0x6adf29){if(_0x49a488[_0x8a01('0x2b')]){_0x562863(_0x49a488['text']);return;}return db[_0x8a01('0x53')]['findOne']({'attributes':[_0x8a01('0x54')],'where':{'id':_0x49a488[_0x8a01('0x2d')]},'raw':!![]})[_0x8a01('0x22')](function(_0x542f72){if(!_0x542f72)throw new db[(_0x8a01('0x31'))]['ValidationError'](_0x8a01('0x55'));var _0x20d49f=Mustache[_0x8a01('0x56')](_0x542f72[_0x8a01('0x54')],_0x49a488[_0x8a01('0x30')]);_0x562863(_0x20d49f);})[_0x8a01('0x52')](function(_0x3b035c){_0x6adf29(_0x3b035c);});});}function getRecipients(_0x14f8f0){return new BPromise(function(_0x14a0f1,_0x17ef0d){var _0x216bdc=[];var _0x1336c5=[];_0x14f8f0['forEach'](function(_0x1ca3dc){var _0x46fc88=_[_0x8a01('0x57')](_0x1ca3dc[_0x8a01('0x41')]['toLowerCase']());if(_0x46fc88===_0x8a01('0x58')){_0x216bdc=_[_0x8a01('0x59')](_0x216bdc,_0x1ca3dc[_0x8a01('0x5a')]);}else{if(_[_0x8a01('0x40')](_0x46fc88,'queue'))_0x46fc88=_0x46fc88['replace']('queue',_0x8a01('0x5b'));_0x1ca3dc['ids']['forEach'](function(_0x19c5c4){_0x1336c5[_0x8a01('0x5c')](getAgents(_0x46fc88,_0x19c5c4));});}});return BPromise['all'](_0x1336c5)[_0x8a01('0x22')](function(_0x1581db){_0x216bdc=_[_0x8a01('0x59')](_0x216bdc,_['flatten'](_0x1581db));_0x14a0f1(_0x216bdc);})[_0x8a01('0x52')](function(_0x1d7160){_0x17ef0d(_0x1d7160);});});}function getAgents(_0x4cc8c9,_0x25bb49){return new BPromise(function(_0x4c4135,_0x469386){return db[_0x4cc8c9]['findOne']({'where':{'id':_0x25bb49}})[_0x8a01('0x22')](function(_0x31f1ca){return _0x31f1ca[_0x8a01('0x5d')]({'attributes':['id'],'raw':!![]})['then'](function(_0x2b30cf){var _0x5e2275=_[_0x8a01('0x5e')](_0x2b30cf,'id');_0x4c4135(_0x5e2275);});})['catch'](function(_0x430535){_0x469386(_0x430535);});});} \ No newline at end of file +var _0xb1ac=['count','set','Content-Range','json','reject','save','then','destroy','stack','send','sendUserNotification','body','hasOwnProperty','text','TemplateId','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','Missing\x20\x27view\x27\x20parameter','recipients','parse','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','mailqueue','openchannelqueue','smsqueue','voicequeue','whatsappqueue','team','user','some','includes','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','isEmpty','recipientsDescription','beep','recipientsId','sortBy','join','sequelize','transaction','UserNotification','create','recipient','catch','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','startCase','union','ids','queue','Queue','forEach','push','all','flatten','getAgents','map','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./userNotification.socket','register','sendStatus','status','end','offset','undefined','limit'];(function(_0x47aa64,_0xfb8a07){var _0x549c7a=function(_0x266165){while(--_0x266165){_0x47aa64['push'](_0x47aa64['shift']());}};_0x549c7a(++_0xfb8a07);}(_0xb1ac,0xa9));var _0xcb1a=function(_0x4f4328,_0x1b7e33){_0x4f4328=_0x4f4328-0x0;var _0x5d3544=_0xb1ac[_0x4f4328];return _0x5d3544;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xcb1a('0x0'));var zipdir=require(_0xcb1a('0x1'));var jsonpatch=require(_0xcb1a('0x2'));var rp=require(_0xcb1a('0x3'));var moment=require(_0xcb1a('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xcb1a('0x5'));var util=require(_0xcb1a('0x6'));var path=require(_0xcb1a('0x7'));var sox=require(_0xcb1a('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xcb1a('0x9'));var _=require(_0xcb1a('0xa'));var squel=require(_0xcb1a('0xb'));var crypto=require(_0xcb1a('0xc'));var jsforce=require(_0xcb1a('0xd'));var deskjs=require(_0xcb1a('0xe'));var toCsv=require(_0xcb1a('0xf'));var querystring=require(_0xcb1a('0x10'));var Papa=require(_0xcb1a('0x11'));var Redis=require(_0xcb1a('0x12'));var authService=require(_0xcb1a('0x13'));var qs=require(_0xcb1a('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcb1a('0x15'));var logger=require('../../config/logger')(_0xcb1a('0x16'));var utils=require(_0xcb1a('0x17'));var config=require(_0xcb1a('0x18'));var licenseUtil=require(_0xcb1a('0x19'));var db=require(_0xcb1a('0x1a'))['db'];config['redis']=_[_0xcb1a('0x1b')](config[_0xcb1a('0x1c')],{'host':_0xcb1a('0x1d'),'port':0x18eb});var socket=require(_0xcb1a('0x1e'))(new Redis(config[_0xcb1a('0x1c')]));require(_0xcb1a('0x1f'))[_0xcb1a('0x20')](socket);function respondWithStatusCode(_0x588634,_0x2fbf38){_0x2fbf38=_0x2fbf38||0xcc;return function(_0x3c3979){if(_0x3c3979){return _0x588634[_0xcb1a('0x21')](_0x2fbf38);}return _0x588634[_0xcb1a('0x22')](_0x2fbf38)[_0xcb1a('0x23')]();};}function respondWithResult(_0xa16a10,_0x312efa){_0x312efa=_0x312efa||0xc8;return function(_0x29c85f){if(_0x29c85f){return _0xa16a10[_0xcb1a('0x22')](_0x312efa)['json'](_0x29c85f);}};}function respondWithFilteredResult(_0x1d6480,_0x43d0e3){return function(_0x4dc70e){if(_0x4dc70e){var _0x1ec48e=typeof _0x43d0e3[_0xcb1a('0x24')]===_0xcb1a('0x25')&&typeof _0x43d0e3[_0xcb1a('0x26')]===_0xcb1a('0x25');var _0x1bcccb=_0x4dc70e[_0xcb1a('0x27')];var _0x15dc5a=_0x1ec48e?0x0:_0x43d0e3[_0xcb1a('0x24')];var _0x1adffe=_0x1ec48e?_0x4dc70e[_0xcb1a('0x27')]:_0x43d0e3[_0xcb1a('0x24')]+_0x43d0e3['limit'];var _0x2ee200;if(_0x1adffe>=_0x1bcccb){_0x1adffe=_0x1bcccb;_0x2ee200=0xc8;}else{_0x2ee200=0xce;}_0x1d6480[_0xcb1a('0x22')](_0x2ee200);return _0x1d6480[_0xcb1a('0x28')](_0xcb1a('0x29'),_0x15dc5a+'-'+_0x1adffe+'/'+_0x1bcccb)[_0xcb1a('0x2a')](_0x4dc70e);}return null;};}function patchUpdates(_0x380d35){return function(_0x3cdeac){try{jsonpatch['apply'](_0x3cdeac,_0x380d35,!![]);}catch(_0x5608f2){return BPromise[_0xcb1a('0x2b')](_0x5608f2);}return _0x3cdeac[_0xcb1a('0x2c')]();};}function saveUpdates(_0x5d9783,_0x4ee9fa){return function(_0x421bb3){if(_0x421bb3){return _0x421bb3['update'](_0x5d9783)[_0xcb1a('0x2d')](function(_0x53a327){return _0x53a327;});}return null;};}function removeEntity(_0x50e15a,_0x1da58a){return function(_0x18fd44){if(_0x18fd44){return _0x18fd44[_0xcb1a('0x2e')]()[_0xcb1a('0x2d')](function(){_0x50e15a[_0xcb1a('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0x599b78,_0x39e768){return function(_0x5cd355){if(!_0x5cd355){_0x599b78['sendStatus'](0x194);}return _0x5cd355;};}function handleError(_0x7673e8,_0x4dbaaa){_0x4dbaaa=_0x4dbaaa||0x1f4;return function(_0x11cbb8){logger['error'](_0x11cbb8[_0xcb1a('0x2f')]);if(_0x11cbb8['name']){delete _0x11cbb8['name'];}_0x7673e8[_0xcb1a('0x22')](_0x4dbaaa)[_0xcb1a('0x30')](_0x11cbb8);};}exports[_0xcb1a('0x31')]=function(_0x3bc275,_0x3bd484,_0x36fc09){if(!_0x3bc275[_0xcb1a('0x32')][_0xcb1a('0x33')](_0xcb1a('0x34'))&&!_0x3bc275[_0xcb1a('0x32')]['hasOwnProperty'](_0xcb1a('0x35'))){throw new db[(_0xcb1a('0x36'))][(_0xcb1a('0x37'))](_0xcb1a('0x38'));}else{if(_0x3bc275[_0xcb1a('0x32')][_0xcb1a('0x33')](_0xcb1a('0x35'))&&!_0x3bc275['body']['hasOwnProperty'](_0xcb1a('0x39'))){throw new db[(_0xcb1a('0x36'))]['ValidationError'](_0xcb1a('0x3a'));}if(!_0x3bc275[_0xcb1a('0x32')][_0xcb1a('0x33')](_0xcb1a('0x3b'))){throw new db[(_0xcb1a('0x36'))][(_0xcb1a('0x37'))]('Missing\x20\x27recipients\x27\x20parameter');}else{try{var _0x12b744=JSON[_0xcb1a('0x3c')](_0x3bc275['body'][_0xcb1a('0x3b')]);}catch(_0x5b6ade){logger['error'](_0x5b6ade);throw new db['Sequelize'][(_0xcb1a('0x37'))](_0xcb1a('0x3d'));}var _0x17f9e9=[_0xcb1a('0x3e'),_0xcb1a('0x3f'),_0xcb1a('0x40'),_0xcb1a('0x41'),_0xcb1a('0x42'),_0xcb1a('0x43'),_0xcb1a('0x44'),_0xcb1a('0x45'),_0xcb1a('0x46')];if(_[_0xcb1a('0x47')](_0x12b744,function(_0x5190e0){return!_[_0xcb1a('0x48')](_0x17f9e9,_0x5190e0[_0xcb1a('0x49')][_0xcb1a('0x4a')]());})){throw new db[(_0xcb1a('0x36'))][(_0xcb1a('0x37'))](_0xcb1a('0x4b'));}}}var _0x1a631a={};_0x1a631a[_0xcb1a('0x4c')]=_0x3bc275['body'][_0xcb1a('0x33')](_0xcb1a('0x4c'))?_0x3bc275[_0xcb1a('0x32')][_0xcb1a('0x4c')]:_0x3bc275[_0xcb1a('0x46')][_0xcb1a('0x4d')];_0x1a631a['recipientsDescription']=_[_0xcb1a('0x4e')](_0x3bc275[_0xcb1a('0x32')][_0xcb1a('0x4f')])?null:_0x3bc275[_0xcb1a('0x32')]['recipientsDescription'];_0x1a631a[_0xcb1a('0x50')]=_0x3bc275[_0xcb1a('0x32')]['beep']||![];_0x1a631a['SenderId']=_0x3bc275['user']['id'];return getContent(_0x3bc275[_0xcb1a('0x32')])[_0xcb1a('0x2d')](function(_0x4b6fc0){_0x1a631a['body']=_0x4b6fc0;return getRecipients(_0x12b744);})['then'](function(_0x23ff63){_0x1a631a[_0xcb1a('0x51')]=_[_0xcb1a('0x52')](_0x23ff63)[_0xcb1a('0x53')](',');return db[_0xcb1a('0x54')][_0xcb1a('0x55')](function(_0x2cf7ae){return db[_0xcb1a('0x56')][_0xcb1a('0x57')](_0x1a631a,{'raw':!![],'transaction':_0x2cf7ae})[_0xcb1a('0x2d')](function(_0x1b8896){var _0x5b71c2={'sender':_0x1a631a[_0xcb1a('0x4c')],'description':_0x1a631a[_0xcb1a('0x4f')],'content':_0x1a631a[_0xcb1a('0x32')],'beep':_0x1a631a[_0xcb1a('0x50')]};_0x23ff63['forEach'](function(_0x5516bf){_0x5b71c2[_0xcb1a('0x58')]=_0x5516bf;socket['emit']('userNotification:send',_0x5b71c2);});return _0x1b8896;});});})[_0xcb1a('0x2d')](respondWithResult(_0x3bd484,0xc9))[_0xcb1a('0x59')](handleError(_0x3bd484,null));};function getContent(_0x1e3de5){return new BPromise(function(_0x52a9e9,_0x2f1754){if(_0x1e3de5[_0xcb1a('0x34')]){_0x52a9e9(_0x1e3de5[_0xcb1a('0x34')]);return;}return db['Template']['findOne']({'attributes':[_0xcb1a('0x5a')],'where':{'id':_0x1e3de5[_0xcb1a('0x35')]},'raw':!![]})[_0xcb1a('0x2d')](function(_0x4e3c49){if(!_0x4e3c49)throw new db[(_0xcb1a('0x36'))][(_0xcb1a('0x37'))](_0xcb1a('0x5b'));var _0x469314=Mustache[_0xcb1a('0x5c')](_0x4e3c49[_0xcb1a('0x5a')],_0x1e3de5[_0xcb1a('0x39')]);_0x52a9e9(_0x469314);})['catch'](function(_0x315d5a){_0x2f1754(_0x315d5a);});});}function getRecipients(_0x4ce7df){return new BPromise(function(_0x5aa3b7,_0x28007b){var _0x49c39b=[];var _0x59b866=[];_0x4ce7df['forEach'](function(_0x40cf14){var _0x408e46=_[_0xcb1a('0x5d')](_0x40cf14[_0xcb1a('0x49')][_0xcb1a('0x4a')]());if(_0x408e46==='User'){_0x49c39b=_[_0xcb1a('0x5e')](_0x49c39b,_0x40cf14[_0xcb1a('0x5f')]);}else{if(_[_0xcb1a('0x48')](_0x408e46,_0xcb1a('0x60')))_0x408e46=_0x408e46['replace'](_0xcb1a('0x60'),_0xcb1a('0x61'));_0x40cf14['ids'][_0xcb1a('0x62')](function(_0x53b850){_0x59b866[_0xcb1a('0x63')](getAgents(_0x408e46,_0x53b850));});}});return BPromise[_0xcb1a('0x64')](_0x59b866)[_0xcb1a('0x2d')](function(_0x210626){_0x49c39b=_[_0xcb1a('0x5e')](_0x49c39b,_[_0xcb1a('0x65')](_0x210626));_0x5aa3b7(_0x49c39b);})[_0xcb1a('0x59')](function(_0x255231){_0x28007b(_0x255231);});});}function getAgents(_0x3985b2,_0x2bf6a2){return new BPromise(function(_0x41652a,_0x495da7){return db[_0x3985b2]['findOne']({'where':{'id':_0x2bf6a2}})[_0xcb1a('0x2d')](function(_0x4f5e4e){return _0x4f5e4e[_0xcb1a('0x66')]({'attributes':['id'],'raw':!![]})[_0xcb1a('0x2d')](function(_0x3cb817){var _0x499953=_[_0xcb1a('0x67')](_0x3cb817,'id');_0x41652a(_0x499953);});})['catch'](function(_0x67a0b0){_0x495da7(_0x67a0b0);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index f327ebd..5d25487 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 _0xf60d=['save','update','remove','emit','hasOwnProperty','events','../../mysqldb','UserNotification'];(function(_0x3a6855,_0x38028b){var _0x262c2b=function(_0x17649a){while(--_0x17649a){_0x3a6855['push'](_0x3a6855['shift']());}};_0x262c2b(++_0x38028b);}(_0xf60d,0x1c5));var _0xdf60=function(_0x9c2427,_0x17c865){_0x9c2427=_0x9c2427-0x0;var _0x51984f=_0xf60d[_0x9c2427];return _0x51984f;};'use strict';var EventEmitter=require(_0xdf60('0x0'));var UserNotification=require(_0xdf60('0x1'))['db'][_0xdf60('0x2')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xdf60('0x3'),'afterUpdate':_0xdf60('0x4'),'afterDestroy':_0xdf60('0x5')};function emitEvent(_0x93f638){return function(_0x19e8ea,_0x50bf07,_0x78c242){UserNotificationEvents[_0xdf60('0x6')](_0x93f638+':'+_0x19e8ea['id'],_0x19e8ea);UserNotificationEvents[_0xdf60('0x6')](_0x93f638,_0x19e8ea);_0x78c242(null);};}for(var e in events){if(events[_0xdf60('0x7')](e)){var event=events[e];UserNotification['hook'](e,emitEvent(event));}}module['exports']=UserNotificationEvents; \ No newline at end of file +var _0xf56d=['hook','exports','events','../../mysqldb','UserNotification','setMaxListeners','update','remove','emit','hasOwnProperty'];(function(_0x9e0cb3,_0x9cd497){var _0x5926b7=function(_0x30e82d){while(--_0x30e82d){_0x9e0cb3['push'](_0x9e0cb3['shift']());}};_0x5926b7(++_0x9cd497);}(_0xf56d,0x66));var _0xdf56=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf56d[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0xdf56('0x0'));var UserNotification=require(_0xdf56('0x1'))['db'][_0xdf56('0x2')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0xdf56('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xdf56('0x4'),'afterDestroy':_0xdf56('0x5')};function emitEvent(_0x2a99fe){return function(_0x5f1365,_0x5cb306,_0x23ed93){UserNotificationEvents[_0xdf56('0x6')](_0x2a99fe+':'+_0x5f1365['id'],_0x5f1365);UserNotificationEvents['emit'](_0x2a99fe,_0x5f1365);_0x23ed93(null);};}for(var e in events){if(events[_0xdf56('0x7')](e)){var event=events[e];UserNotification[_0xdf56('0x8')](e,emitEvent(event));}}module[_0xdf56('0x9')]=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index 2b8461c..6a1a3f3 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 _0x73a6=['path','rimraf','../../config/environment','./userNotification.attributes','define','UserNotification','userNotifications','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api'];(function(_0x299267,_0x34c247){var _0x3392b0=function(_0x4747de){while(--_0x4747de){_0x299267['push'](_0x299267['shift']());}};_0x3392b0(++_0x34c247);}(_0x73a6,0x75));var _0x673a=function(_0x1dcca0,_0x95bc1c){_0x1dcca0=_0x1dcca0-0x0;var _0x38a4e1=_0x73a6[_0x1dcca0];return _0x38a4e1;};'use strict';var _=require(_0x673a('0x0'));var util=require('util');var logger=require(_0x673a('0x1'))(_0x673a('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x673a('0x3'));var rimraf=require(_0x673a('0x4'));var config=require(_0x673a('0x5'));var attributes=require(_0x673a('0x6'));module['exports']=function(_0x25630c,_0x802921){return _0x25630c[_0x673a('0x7')](_0x673a('0x8'),attributes,{'tableName':_0x673a('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x673a('0xa'),'collate':_0x673a('0xb')});}; \ No newline at end of file +var _0xec29=['api','bluebird','path','rimraf','../../config/environment','./userNotification.attributes','define','UserNotification','userNotifications','utf8mb4_unicode_ci','lodash','util'];(function(_0x1a1417,_0x295248){var _0x108869=function(_0x4500d7){while(--_0x4500d7){_0x1a1417['push'](_0x1a1417['shift']());}};_0x108869(++_0x295248);}(_0xec29,0xa6));var _0x9ec2=function(_0x5cc4f6,_0x16888e){_0x5cc4f6=_0x5cc4f6-0x0;var _0x2c65d0=_0xec29[_0x5cc4f6];return _0x2c65d0;};'use strict';var _=require(_0x9ec2('0x0'));var util=require(_0x9ec2('0x1'));var logger=require('../../config/logger')(_0x9ec2('0x2'));var moment=require('moment');var BPromise=require(_0x9ec2('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9ec2('0x4'));var rimraf=require(_0x9ec2('0x5'));var config=require(_0x9ec2('0x6'));var attributes=require(_0x9ec2('0x7'));module['exports']=function(_0x118102,_0x199f26){return _0x118102[_0x9ec2('0x8')](_0x9ec2('0x9'),attributes,{'tableName':_0x9ec2('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x9ec2('0xb')});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index 687fcf8..120db84 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 _0x8f10=['../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./userNotification.socket','register','then','request\x20sent','debug','UserNotification,\x20%s,\x20%s,\x20%s','stringify','error','code','UserNotification,\x20%s,\x20%s','message','info','result','lodash','util','moment','bluebird','../../config/utils'];(function(_0x5af24e,_0x4cee36){var _0x347713=function(_0x116cd1){while(--_0x116cd1){_0x5af24e['push'](_0x5af24e['shift']());}};_0x347713(++_0x4cee36);}(_0x8f10,0xb8));var _0x08f1=function(_0x5c8c7e,_0x4106d0){_0x5c8c7e=_0x5c8c7e-0x0;var _0x271e33=_0x8f10[_0x5c8c7e];return _0x271e33;};'use strict';var _=require(_0x08f1('0x0'));var util=require(_0x08f1('0x1'));var moment=require(_0x08f1('0x2'));var BPromise=require(_0x08f1('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x08f1('0x4'));var logger=require(_0x08f1('0x5'))(_0x08f1('0x6'));var config=require('../../config/environment');var jayson=require(_0x08f1('0x7'));var client=jayson[_0x08f1('0x8')][_0x08f1('0x9')]({'port':0x232a});config[_0x08f1('0xa')]=_[_0x08f1('0xb')](config['redis'],{'host':_0x08f1('0xc'),'port':0x18eb});var socket=require(_0x08f1('0xd'))(new Redis(config['redis']));require(_0x08f1('0xe'))[_0x08f1('0xf')](socket);function respondWithRpcPromise(_0x1d4225,_0x568098,_0x101f97){return new BPromise(function(_0x4b8b17,_0x21f312){return client['request'](_0x1d4225,_0x101f97)[_0x08f1('0x10')](function(_0x20c41b){logger['info']('UserNotification,\x20%s,\x20%s',_0x568098,_0x08f1('0x11'));logger[_0x08f1('0x12')](_0x08f1('0x13'),_0x568098,_0x08f1('0x11'),JSON[_0x08f1('0x14')](_0x20c41b));if(_0x20c41b['error']){if(_0x20c41b[_0x08f1('0x15')][_0x08f1('0x16')]===0x1f4){logger[_0x08f1('0x15')](_0x08f1('0x17'),_0x568098,_0x20c41b[_0x08f1('0x15')][_0x08f1('0x18')]);return _0x21f312(_0x20c41b[_0x08f1('0x15')][_0x08f1('0x18')]);}logger[_0x08f1('0x15')](_0x08f1('0x17'),_0x568098,_0x20c41b[_0x08f1('0x15')]['message']);return _0x4b8b17(_0x20c41b[_0x08f1('0x15')][_0x08f1('0x18')]);}else{logger[_0x08f1('0x19')](_0x08f1('0x17'),_0x568098,'request\x20sent');_0x4b8b17(_0x20c41b[_0x08f1('0x1a')]['message']);}})['catch'](function(_0x522261){logger['error'](_0x08f1('0x17'),_0x568098,_0x522261);_0x21f312(_0x522261);});});} \ No newline at end of file +var _0x1707=['message','result','lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','defaults','localhost','register','request','info','UserNotification,\x20%s,\x20%s','debug','UserNotification,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x5a35b3,_0x31dcb2){var _0x28c148=function(_0x524451){while(--_0x524451){_0x5a35b3['push'](_0x5a35b3['shift']());}};_0x28c148(++_0x31dcb2);}(_0x1707,0x1e2));var _0x7170=function(_0x392156,_0x3f3101){_0x392156=_0x392156-0x0;var _0x15d914=_0x1707[_0x392156];return _0x15d914;};'use strict';var _=require(_0x7170('0x0'));var util=require('util');var moment=require(_0x7170('0x1'));var BPromise=require(_0x7170('0x2'));var rs=require(_0x7170('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x7170('0x4'));var logger=require(_0x7170('0x5'))(_0x7170('0x6'));var config=require(_0x7170('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x7170('0x8')]['http']({'port':0x232a});config[_0x7170('0x9')]=_[_0x7170('0xa')](config['redis'],{'host':_0x7170('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7170('0x9')]));require('./userNotification.socket')[_0x7170('0xc')](socket);function respondWithRpcPromise(_0x1fac59,_0x492afe,_0x4c246f){return new BPromise(function(_0x336f57,_0x1708a7){return client[_0x7170('0xd')](_0x1fac59,_0x4c246f)['then'](function(_0x33708c){logger[_0x7170('0xe')](_0x7170('0xf'),_0x492afe,'request\x20sent');logger[_0x7170('0x10')](_0x7170('0x11'),_0x492afe,_0x7170('0x12'),JSON[_0x7170('0x13')](_0x33708c));if(_0x33708c[_0x7170('0x14')]){if(_0x33708c[_0x7170('0x14')][_0x7170('0x15')]===0x1f4){logger['error']('UserNotification,\x20%s,\x20%s',_0x492afe,_0x33708c[_0x7170('0x14')]['message']);return _0x1708a7(_0x33708c['error'][_0x7170('0x16')]);}logger[_0x7170('0x14')](_0x7170('0xf'),_0x492afe,_0x33708c[_0x7170('0x14')]['message']);return _0x336f57(_0x33708c[_0x7170('0x14')]['message']);}else{logger[_0x7170('0xe')]('UserNotification,\x20%s,\x20%s',_0x492afe,_0x7170('0x12'));_0x336f57(_0x33708c[_0x7170('0x17')]['message']);}})['catch'](function(_0x3d8aad){logger['error'](_0x7170('0xf'),_0x492afe,_0x3d8aad);_0x1708a7(_0x3d8aad);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index f5eadf3..4ae10ee 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 _0x999e=['save','update','emit','removeListener','register','./userNotification.events'];(function(_0x503cd5,_0x57774a){var _0x1fdf1e=function(_0x5222cc){while(--_0x5222cc){_0x503cd5['push'](_0x503cd5['shift']());}};_0x1fdf1e(++_0x57774a);}(_0x999e,0x107));var _0xe999=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x999e[_0x3dd15e];return _0x231fd0;};'use strict';var UserNotificationEvents=require(_0xe999('0x0'));var events=[_0xe999('0x1'),'remove',_0xe999('0x2')];function createListener(_0x22df27,_0x4d5d50){return function(_0x31b4d8){_0x4d5d50[_0xe999('0x3')](_0x22df27,_0x31b4d8);};}function removeListener(_0xd3f741,_0x1f1f5c){return function(){UserNotificationEvents[_0xe999('0x4')](_0xd3f741,_0x1f1f5c);};}exports[_0xe999('0x5')]=function(_0xee10e){for(var _0x2592b3=0x0,_0x266350=events['length'];_0x2592b3<_0x266350;_0x2592b3++){var _0x56de88=events[_0x2592b3];var _0x7b58d2=createListener('userNotification:'+_0x56de88,_0xee10e);UserNotificationEvents['on'](_0x56de88,_0x7b58d2);}}; \ No newline at end of file +var _0xf4f9=['remove','update','emit','removeListener','register','length','userNotification:','./userNotification.events'];(function(_0xc03202,_0x528c8a){var _0x4b2680=function(_0xcabb9){while(--_0xcabb9){_0xc03202['push'](_0xc03202['shift']());}};_0x4b2680(++_0x528c8a);}(_0xf4f9,0x187));var _0x9f4f=function(_0x43e251,_0x552b10){_0x43e251=_0x43e251-0x0;var _0x530182=_0xf4f9[_0x43e251];return _0x530182;};'use strict';var UserNotificationEvents=require(_0x9f4f('0x0'));var events=['save',_0x9f4f('0x1'),_0x9f4f('0x2')];function createListener(_0x2019d2,_0x3d1f53){return function(_0x229e29){_0x3d1f53[_0x9f4f('0x3')](_0x2019d2,_0x229e29);};}function removeListener(_0x320898,_0x435010){return function(){UserNotificationEvents[_0x9f4f('0x4')](_0x320898,_0x435010);};}exports[_0x9f4f('0x5')]=function(_0x25e2af){for(var _0x575d7a=0x0,_0x4619a9=events[_0x9f4f('0x6')];_0x575d7a<_0x4619a9;_0x575d7a++){var _0xeeed2a=events[_0x575d7a];var _0xebb2f0=createListener(_0x9f4f('0x7')+_0xeeed2a,_0x25e2af);UserNotificationEvents['on'](_0xeeed2a,_0xebb2f0);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index 9a08f64..61f824e 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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x41f4e1,_0x2f6215){var _0x3b3041=function(_0x2344cb){while(--_0x2344cb){_0x41f4e1['push'](_0x41f4e1['shift']());}};_0x3b3041(++_0x2f6215);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x5bdbfd,_0x3aaf24){var _0x5711c0=function(_0x14b3ac){while(--_0x14b3ac){_0x5bdbfd['push'](_0x5bdbfd['shift']());}};_0x5711c0(++_0x3aaf24);}(_0x9c44,0x178));var _0x49c4=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0x9c44[_0x16b9ed];return _0x66b1f8;};'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/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index d96e761..8ba2885 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 _0x2eb6=['sequelize','exports','INTEGER'];(function(_0x1aac41,_0x5d3570){var _0x345a9e=function(_0x13f5a9){while(--_0x13f5a9){_0x1aac41['push'](_0x1aac41['shift']());}};_0x345a9e(++_0x5d3570);}(_0x2eb6,0x102));var _0x62eb=function(_0x304027,_0x3909c2){_0x304027=_0x304027-0x0;var _0x4d5956=_0x2eb6[_0x304027];return _0x4d5956;};'use strict';var Sequelize=require(_0x62eb('0x0'));module[_0x62eb('0x1')]={'penalty':{'type':Sequelize[_0x62eb('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x0d3f=['INTEGER','sequelize'];(function(_0x51257b,_0x23f5df){var _0x846f82=function(_0x578ff7){while(--_0x578ff7){_0x51257b['push'](_0x51257b['shift']());}};_0x846f82(++_0x23f5df);}(_0x0d3f,0x1d5));var _0xf0d3=function(_0x228a4a,_0x23d65e){_0x228a4a=_0x228a4a-0x0;var _0x3d3937=_0x0d3f[_0x228a4a];return _0x3d3937;};'use strict';var Sequelize=require(_0xf0d3('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xf0d3('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js index ea409ab..4f15756 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 _0x664f=['UserOpenchannelQueue','user_has_openchannel_queues','../../config/logger','api','bluebird','path','rimraf','./userOpenchannelQueue.attributes','exports'];(function(_0x294e22,_0x39188e){var _0x4c0596=function(_0x31c62d){while(--_0x31c62d){_0x294e22['push'](_0x294e22['shift']());}};_0x4c0596(++_0x39188e);}(_0x664f,0x1bb));var _0xf664=function(_0x2fbedc,_0x25d163){_0x2fbedc=_0x2fbedc-0x0;var _0x56b33e=_0x664f[_0x2fbedc];return _0x56b33e;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xf664('0x0'))(_0xf664('0x1'));var moment=require('moment');var BPromise=require(_0xf664('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf664('0x3'));var rimraf=require(_0xf664('0x4'));var config=require('../../config/environment');var attributes=require(_0xf664('0x5'));module[_0xf664('0x6')]=function(_0x119200,_0x167a3e){return _0x119200['define'](_0xf664('0x7'),attributes,{'tableName':_0xf664('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb6f2=['user_has_openchannel_queues','lodash','util','../../config/logger','api','moment','rimraf','../../config/environment','./userOpenchannelQueue.attributes','exports','define','UserOpenchannelQueue'];(function(_0x5d3bd4,_0x4393fc){var _0x4c4646=function(_0x47337f){while(--_0x47337f){_0x5d3bd4['push'](_0x5d3bd4['shift']());}};_0x4c4646(++_0x4393fc);}(_0xb6f2,0x18d));var _0x2b6f=function(_0x42bdad,_0x12836c){_0x42bdad=_0x42bdad-0x0;var _0x122626=_0xb6f2[_0x42bdad];return _0x122626;};'use strict';var _=require(_0x2b6f('0x0'));var util=require(_0x2b6f('0x1'));var logger=require(_0x2b6f('0x2'))(_0x2b6f('0x3'));var moment=require(_0x2b6f('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x2b6f('0x5'));var config=require(_0x2b6f('0x6'));var attributes=require(_0x2b6f('0x7'));module[_0x2b6f('0x8')]=function(_0x199081,_0x4c4a97){return _0x199081[_0x2b6f('0x9')](_0x2b6f('0xa'),attributes,{'tableName':_0x2b6f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js index e387757..e5aeb37 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 _0xcdb9=['ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird'];(function(_0x51a6c3,_0x2ec979){var _0x12dd41=function(_0x36fc8f){while(--_0x36fc8f){_0x51a6c3['push'](_0x51a6c3['shift']());}};_0x12dd41(++_0x2ec979);}(_0xcdb9,0x96));var _0x9cdb=function(_0x4d67a1,_0xd8675d){_0x4d67a1=_0x4d67a1-0x0;var _0x2a0a29=_0xcdb9[_0x4d67a1];return _0x2a0a29;};'use strict';var _=require(_0x9cdb('0x0'));var util=require(_0x9cdb('0x1'));var moment=require(_0x9cdb('0x2'));var BPromise=require(_0x9cdb('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9cdb('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x9cdb('0x5'))(_0x9cdb('0x6'));var config=require(_0x9cdb('0x7'));var jayson=require(_0x9cdb('0x8'));var client=jayson[_0x9cdb('0x9')][_0x9cdb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x594d57,_0x13247c,_0x326fc0){return new BPromise(function(_0x1c8e2d,_0x4a32f8){return client['request'](_0x594d57,_0x326fc0)[_0x9cdb('0xb')](function(_0xec2cd3){logger[_0x9cdb('0xc')](_0x9cdb('0xd'),_0x13247c,_0x9cdb('0xe'));logger[_0x9cdb('0xf')](_0x9cdb('0x10'),_0x13247c,_0x9cdb('0xe'),JSON['stringify'](_0xec2cd3));if(_0xec2cd3[_0x9cdb('0x11')]){if(_0xec2cd3[_0x9cdb('0x11')][_0x9cdb('0x12')]===0x1f4){logger[_0x9cdb('0x11')](_0x9cdb('0xd'),_0x13247c,_0xec2cd3[_0x9cdb('0x11')][_0x9cdb('0x13')]);return _0x4a32f8(_0xec2cd3['error'][_0x9cdb('0x13')]);}logger[_0x9cdb('0x11')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x13247c,_0xec2cd3[_0x9cdb('0x11')][_0x9cdb('0x13')]);return _0x1c8e2d(_0xec2cd3[_0x9cdb('0x11')][_0x9cdb('0x13')]);}else{logger[_0x9cdb('0xc')](_0x9cdb('0xd'),_0x13247c,_0x9cdb('0xe'));_0x1c8e2d(_0xec2cd3[_0x9cdb('0x14')][_0x9cdb('0x13')]);}})[_0x9cdb('0x15')](function(_0x26d807){logger[_0x9cdb('0x11')](_0x9cdb('0xd'),_0x13247c,_0x26d807);_0x4a32f8(_0x26d807);});});} \ No newline at end of file +var _0xf8c8=['stringify','error','code','message','result','catch','lodash','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','debug'];(function(_0x4f5226,_0x518f6c){var _0x42fdd5=function(_0x565397){while(--_0x565397){_0x4f5226['push'](_0x4f5226['shift']());}};_0x42fdd5(++_0x518f6c);}(_0xf8c8,0xde));var _0x8f8c=function(_0x5ca370,_0x44dbb3){_0x5ca370=_0x5ca370-0x0;var _0x22b86b=_0xf8c8[_0x5ca370];return _0x22b86b;};'use strict';var _=require(_0x8f8c('0x0'));var util=require('util');var moment=require(_0x8f8c('0x1'));var BPromise=require(_0x8f8c('0x2'));var rs=require(_0x8f8c('0x3'));var fs=require('fs');var Redis=require(_0x8f8c('0x4'));var db=require(_0x8f8c('0x5'))['db'];var utils=require(_0x8f8c('0x6'));var logger=require(_0x8f8c('0x7'))('rpc');var config=require(_0x8f8c('0x8'));var jayson=require(_0x8f8c('0x9'));var client=jayson[_0x8f8c('0xa')][_0x8f8c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x15dc4d,_0x5daf75,_0x47b606){return new BPromise(function(_0xdd528e,_0x24337e){return client[_0x8f8c('0xc')](_0x15dc4d,_0x47b606)[_0x8f8c('0xd')](function(_0x30ae72){logger[_0x8f8c('0xe')](_0x8f8c('0xf'),_0x5daf75,_0x8f8c('0x10'));logger[_0x8f8c('0x11')]('UserOpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x5daf75,_0x8f8c('0x10'),JSON[_0x8f8c('0x12')](_0x30ae72));if(_0x30ae72[_0x8f8c('0x13')]){if(_0x30ae72[_0x8f8c('0x13')][_0x8f8c('0x14')]===0x1f4){logger['error']('UserOpenchannelQueue,\x20%s,\x20%s',_0x5daf75,_0x30ae72[_0x8f8c('0x13')][_0x8f8c('0x15')]);return _0x24337e(_0x30ae72[_0x8f8c('0x13')][_0x8f8c('0x15')]);}logger[_0x8f8c('0x13')](_0x8f8c('0xf'),_0x5daf75,_0x30ae72[_0x8f8c('0x13')][_0x8f8c('0x15')]);return _0xdd528e(_0x30ae72['error'][_0x8f8c('0x15')]);}else{logger[_0x8f8c('0xe')](_0x8f8c('0xf'),_0x5daf75,_0x8f8c('0x10'));_0xdd528e(_0x30ae72[_0x8f8c('0x16')]['message']);}})[_0x8f8c('0x17')](function(_0x36b2d9){logger[_0x8f8c('0x13')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x5daf75,_0x36b2d9);_0x24337e(_0x36b2d9);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index 066a8f4..65e13d8 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 _0x1225=['update','destroy','delete','removeSections','removeResources','exports','multer','util','path','../../components/interaction/service','../../config/environment','./userProfile.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/sections','getSections','getResources','post','create','/:id/clone','clone','addSections','/:id/resources','addResources'];(function(_0x3a58d9,_0x21e5ed){var _0x3f518c=function(_0x22cfb6){while(--_0x22cfb6){_0x3a58d9['push'](_0x3a58d9['shift']());}};_0x3f518c(++_0x21e5ed);}(_0x1225,0x10b));var _0x5122=function(_0x33b86f,_0x7b02cf){_0x33b86f=_0x33b86f-0x0;var _0x3f009f=_0x1225[_0x33b86f];return _0x3f009f;};'use strict';var multer=require(_0x5122('0x0'));var util=require(_0x5122('0x1'));var path=require(_0x5122('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x5122('0x3'));var config=require(_0x5122('0x4'));var controller=require(_0x5122('0x5'));router[_0x5122('0x6')]('/',auth[_0x5122('0x7')](),controller[_0x5122('0x8')]);router[_0x5122('0x6')](_0x5122('0x9'),auth['isAuthenticated'](),controller[_0x5122('0xa')]);router[_0x5122('0x6')](_0x5122('0xb'),auth['isAuthenticated'](),controller[_0x5122('0xc')]);router[_0x5122('0x6')](_0x5122('0xd'),auth[_0x5122('0x7')](),controller[_0x5122('0xe')]);router[_0x5122('0x6')]('/:id/resources',auth[_0x5122('0x7')](),controller[_0x5122('0xf')]);router[_0x5122('0x10')]('/',auth[_0x5122('0x7')](),controller[_0x5122('0x11')]);router['post'](_0x5122('0x12'),auth[_0x5122('0x7')](),controller[_0x5122('0x13')]);router[_0x5122('0x10')](_0x5122('0xd'),auth[_0x5122('0x7')](),controller[_0x5122('0x14')]);router[_0x5122('0x10')](_0x5122('0x15'),auth[_0x5122('0x7')](),controller[_0x5122('0x16')]);router['put'](_0x5122('0xb'),auth['isAuthenticated'](),controller[_0x5122('0x17')]);router['delete']('/:id',auth[_0x5122('0x7')](),controller[_0x5122('0x18')]);router[_0x5122('0x19')]('/:id/sections',auth['isAuthenticated'](),controller[_0x5122('0x1a')]);router['delete']('/:id/resources',auth[_0x5122('0x7')](),controller[_0x5122('0x1b')]);module[_0x5122('0x1c')]=router; \ No newline at end of file +var _0xb1a1=['./userProfile.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/sections','/:id/resources','getResources','post','/:id/clone','clone','put','update','destroy','delete','removeSections','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x305020,_0x14ffba){var _0xc607db=function(_0xacd6b8){while(--_0xacd6b8){_0x305020['push'](_0x305020['shift']());}};_0xc607db(++_0x14ffba);}(_0xb1a1,0x7a));var _0x1b1a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb1a1[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x1b1a('0x0'));var util=require(_0x1b1a('0x1'));var path=require(_0x1b1a('0x2'));var timeout=require('connect-timeout');var express=require(_0x1b1a('0x3'));var router=express[_0x1b1a('0x4')]();var fs_extra=require(_0x1b1a('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x1b1a('0x6'));var config=require(_0x1b1a('0x7'));var controller=require(_0x1b1a('0x8'));router[_0x1b1a('0x9')]('/',auth[_0x1b1a('0xa')](),controller['index']);router['get'](_0x1b1a('0xb'),auth[_0x1b1a('0xa')](),controller[_0x1b1a('0xc')]);router['get'](_0x1b1a('0xd'),auth['isAuthenticated'](),controller[_0x1b1a('0xe')]);router[_0x1b1a('0x9')](_0x1b1a('0xf'),auth[_0x1b1a('0xa')](),controller['getSections']);router[_0x1b1a('0x9')](_0x1b1a('0x10'),auth['isAuthenticated'](),controller[_0x1b1a('0x11')]);router[_0x1b1a('0x12')]('/',auth[_0x1b1a('0xa')](),controller['create']);router['post'](_0x1b1a('0x13'),auth[_0x1b1a('0xa')](),controller[_0x1b1a('0x14')]);router[_0x1b1a('0x12')](_0x1b1a('0xf'),auth[_0x1b1a('0xa')](),controller['addSections']);router['post']('/:id/resources',auth[_0x1b1a('0xa')](),controller['addResources']);router[_0x1b1a('0x15')](_0x1b1a('0xd'),auth[_0x1b1a('0xa')](),controller[_0x1b1a('0x16')]);router['delete'](_0x1b1a('0xd'),auth[_0x1b1a('0xa')](),controller[_0x1b1a('0x17')]);router[_0x1b1a('0x18')](_0x1b1a('0xf'),auth[_0x1b1a('0xa')](),controller[_0x1b1a('0x19')]);router[_0x1b1a('0x18')](_0x1b1a('0x10'),auth[_0x1b1a('0xa')](),controller['removeResources']);module['exports']=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index 02187be..41cd828 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 _0xdd76=['join','getDataValue','split','STRING','BOOLEAN','sequelize','name','crudPermissions'];(function(_0x1d1d29,_0x4dbcdc){var _0x74afc4=function(_0x4cabfe){while(--_0x4cabfe){_0x1d1d29['push'](_0x1d1d29['shift']());}};_0x74afc4(++_0x4dbcdc);}(_0xdd76,0x75));var _0x6dd7=function(_0x500542,_0x50491e){_0x500542=_0x500542-0x0;var _0x22462e=_0xdd76[_0x500542];return _0x22462e;};'use strict';var Sequelize=require(_0x6dd7('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x6dd7('0x1')},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x139a93){this['setDataValue'](_0x6dd7('0x2'),_0x139a93?_0x139a93[_0x6dd7('0x3')](''):[]);},'get':function(){return this[_0x6dd7('0x4')](_0x6dd7('0x2'))?this[_0x6dd7('0x4')]('crudPermissions')[_0x6dd7('0x5')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x6dd7('0x6')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0x6dd7('0x7')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x6dd7('0x7')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x6dd7('0x7')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0x6dd7('0x7')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x6dd7('0x7')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x6dd7('0x7')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x6dd7('0x7')],'defaultValue':!![]}}; \ No newline at end of file +var _0x02a9=['exports','name','STRING','setDataValue','crudPermissions','join','BOOLEAN','sequelize'];(function(_0x215f9e,_0x438b14){var _0x217ce4=function(_0x2d8081){while(--_0x2d8081){_0x215f9e['push'](_0x215f9e['shift']());}};_0x217ce4(++_0x438b14);}(_0x02a9,0x6f));var _0x902a=function(_0x2d7ba6,_0xc39c63){_0x2d7ba6=_0x2d7ba6-0x0;var _0x4f161c=_0x02a9[_0x2d7ba6];return _0x4f161c;};'use strict';var Sequelize=require(_0x902a('0x0'));module[_0x902a('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x902a('0x2')},'crudPermissions':{'type':Sequelize[_0x902a('0x3')],'set':function(_0x2d0d04){this[_0x902a('0x4')](_0x902a('0x5'),_0x2d0d04?_0x2d0d04[_0x902a('0x6')](''):[]);},'get':function(){return this['getDataValue'](_0x902a('0x5'))?this['getDataValue'](_0x902a('0x5'))['split'](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0x902a('0x7')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x902a('0x7')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x902a('0x7')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x902a('0x7')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x902a('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 7406757..6efd905 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 _0x4912=['error','stack','name','send','index','map','UserProfile','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','rows','catch','show','rawAttributes','find','create','clone','params','get','omit','createdAt','updatedAt','crudPermissions','body','sequelize','transaction','UserProfileSection','findAll','each','autoAssociation','sectionId','userProfileId','Resources','describe','addSections','UserProfileResource','push','removeSections','getSections','enabled','isEmpty','includes','subsections','concat','findOne','Dashboard','forEach','resourceId','Plugin','bulkCreate','removeResources','ids','getResources','section','Missing\x20section\x20parameter','No\x20User\x20Profile\x20found\x20for\x20id\x20','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy'];(function(_0x5c351c,_0x2046d8){var _0x26f3b3=function(_0x47ac18){while(--_0x47ac18){_0x5c351c['push'](_0x5c351c['shift']());}};_0x26f3b3(++_0x2046d8);}(_0x4912,0x1ac));var _0x2491=function(_0x3830b8,_0x31b9f5){_0x3830b8=_0x3830b8-0x0;var _0x4abd96=_0x4912[_0x3830b8];return _0x4abd96;};'use strict';var emlformat=require(_0x2491('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2491('0x1'));var jsonpatch=require(_0x2491('0x2'));var rp=require(_0x2491('0x3'));var moment=require(_0x2491('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x2491('0x5'));var util=require(_0x2491('0x6'));var path=require('path');var sox=require(_0x2491('0x7'));var csv=require('to-csv');var ejs=require(_0x2491('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2491('0x9'));var squel=require(_0x2491('0xa'));var crypto=require(_0x2491('0xb'));var jsforce=require(_0x2491('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x2491('0xd'));var querystring=require(_0x2491('0xe'));var Papa=require(_0x2491('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x2491('0x10'));var as=require(_0x2491('0x11'));var hardwareService=require(_0x2491('0x12'));var logger=require('../../config/logger')(_0x2491('0x13'));var utils=require(_0x2491('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x2491('0x15'));var db=require(_0x2491('0x16'))['db'];config[_0x2491('0x17')]=_[_0x2491('0x18')](config[_0x2491('0x17')],{'host':_0x2491('0x19'),'port':0x18eb});var socket=require(_0x2491('0x1a'))(new Redis(config[_0x2491('0x17')]));require(_0x2491('0x1b'))[_0x2491('0x1c')](socket);function respondWithStatusCode(_0x28a383,_0x4e2c80){_0x4e2c80=_0x4e2c80||0xcc;return function(_0x35e75f){if(_0x35e75f){return _0x28a383[_0x2491('0x1d')](_0x4e2c80);}return _0x28a383[_0x2491('0x1e')](_0x4e2c80)[_0x2491('0x1f')]();};}function respondWithResult(_0xb4758c,_0x18db89){_0x18db89=_0x18db89||0xc8;return function(_0x5ce001){if(_0x5ce001){return _0xb4758c[_0x2491('0x1e')](_0x18db89)[_0x2491('0x20')](_0x5ce001);}};}function respondWithFilteredResult(_0x21fb42,_0x461c66){return function(_0x1bd3ae){if(_0x1bd3ae){var _0x4e6e00=typeof _0x461c66[_0x2491('0x21')]===_0x2491('0x22')&&typeof _0x461c66[_0x2491('0x23')]===_0x2491('0x22');var _0x504531=_0x1bd3ae[_0x2491('0x24')];var _0x51c87e=_0x4e6e00?0x0:_0x461c66[_0x2491('0x21')];var _0x53c3e9=_0x4e6e00?_0x1bd3ae['count']:_0x461c66['offset']+_0x461c66[_0x2491('0x23')];var _0x57f7ab;if(_0x53c3e9>=_0x504531){_0x53c3e9=_0x504531;_0x57f7ab=0xc8;}else{_0x57f7ab=0xce;}_0x21fb42[_0x2491('0x1e')](_0x57f7ab);return _0x21fb42[_0x2491('0x25')](_0x2491('0x26'),_0x51c87e+'-'+_0x53c3e9+'/'+_0x504531)['json'](_0x1bd3ae);}return null;};}function patchUpdates(_0x245154){return function(_0x550d19){try{jsonpatch[_0x2491('0x27')](_0x550d19,_0x245154,!![]);}catch(_0x4c5402){return BPromise[_0x2491('0x28')](_0x4c5402);}return _0x550d19[_0x2491('0x29')]();};}function saveUpdates(_0x3cef77,_0xf943f6){return function(_0x188082){if(_0x188082){return _0x188082['update'](_0x3cef77)[_0x2491('0x2a')](function(_0x2bef3c){return _0x2bef3c;});}return null;};}function removeEntity(_0x222186,_0x2fa0f1){return function(_0x35188c){if(_0x35188c){return _0x35188c[_0x2491('0x2b')]()[_0x2491('0x2a')](function(){_0x222186[_0x2491('0x1e')](0xcc)[_0x2491('0x1f')]();});}};}function handleEntityNotFound(_0x25a2a4,_0x12504a){return function(_0x5eaec7){if(!_0x5eaec7){_0x25a2a4[_0x2491('0x1d')](0x194);}return _0x5eaec7;};}function handleError(_0x23560a,_0x333a91){_0x333a91=_0x333a91||0x1f4;return function(_0x2b0d6a){logger[_0x2491('0x2c')](_0x2b0d6a[_0x2491('0x2d')]);if(_0x2b0d6a['name']){delete _0x2b0d6a[_0x2491('0x2e')];}_0x23560a[_0x2491('0x1e')](_0x333a91)[_0x2491('0x2f')](_0x2b0d6a);};}exports[_0x2491('0x30')]=function(_0x48d1d7,_0x5b68ab){var _0x57f7d7={},_0xd224ee={},_0x3cc299={'count':0x0,'rows':[]};var _0x13991e=_[_0x2491('0x31')](db[_0x2491('0x32')]['rawAttributes'],function(_0x56c3be){return{'name':_0x56c3be[_0x2491('0x33')],'type':_0x56c3be['type'][_0x2491('0x34')]};});_0xd224ee[_0x2491('0x35')]=_[_0x2491('0x31')](_0x13991e,'name');_0xd224ee[_0x2491('0x36')]=_[_0x2491('0x37')](_0x48d1d7[_0x2491('0x36')]);_0xd224ee[_0x2491('0x38')]=_[_0x2491('0x39')](_0xd224ee['model'],_0xd224ee[_0x2491('0x36')]);_0x57f7d7[_0x2491('0x3a')]=_[_0x2491('0x39')](_0xd224ee['model'],qs[_0x2491('0x3b')](_0x48d1d7[_0x2491('0x36')]['fields']));_0x57f7d7[_0x2491('0x3a')]=_0x57f7d7[_0x2491('0x3a')][_0x2491('0x3c')]?_0x57f7d7[_0x2491('0x3a')]:_0xd224ee[_0x2491('0x35')];if(!_0x48d1d7[_0x2491('0x36')][_0x2491('0x3d')]('nolimit')){_0x57f7d7[_0x2491('0x23')]=qs[_0x2491('0x23')](_0x48d1d7[_0x2491('0x36')][_0x2491('0x23')]);_0x57f7d7['offset']=qs[_0x2491('0x21')](_0x48d1d7[_0x2491('0x36')][_0x2491('0x21')]);}_0x57f7d7['order']=qs['sort'](_0x48d1d7[_0x2491('0x36')][_0x2491('0x3e')]);_0x57f7d7[_0x2491('0x3f')]=qs[_0x2491('0x38')](_[_0x2491('0x40')](_0x48d1d7[_0x2491('0x36')],_0xd224ee[_0x2491('0x38')]),_0x13991e);if(_0x48d1d7[_0x2491('0x36')][_0x2491('0x41')]){_0x57f7d7[_0x2491('0x3f')]=_[_0x2491('0x42')](_0x57f7d7[_0x2491('0x3f')],{'$or':_[_0x2491('0x31')](_0x13991e,function(_0x29d027){if(_0x29d027[_0x2491('0x43')]!==_0x2491('0x44')){var _0x4fd890={};_0x4fd890[_0x29d027[_0x2491('0x2e')]]={'$like':'%'+_0x48d1d7['query'][_0x2491('0x41')]+'%'};return _0x4fd890;}})});}_0x57f7d7=_[_0x2491('0x42')]({},_0x57f7d7,_0x48d1d7[_0x2491('0x45')]);var _0x241f94={'where':_0x57f7d7[_0x2491('0x3f')]};return db['UserProfile'][_0x2491('0x24')](_0x241f94)['then'](function(_0x440a6e){_0x3cc299['count']=_0x440a6e;if(_0x48d1d7[_0x2491('0x36')][_0x2491('0x46')]){_0x57f7d7[_0x2491('0x47')]=[{'all':!![]}];}return db[_0x2491('0x32')]['findAll'](_0x57f7d7);})['then'](function(_0x1177c8){_0x3cc299[_0x2491('0x48')]=_0x1177c8;return _0x3cc299;})['then'](respondWithFilteredResult(_0x5b68ab,_0x57f7d7))[_0x2491('0x49')](handleError(_0x5b68ab,null));};exports[_0x2491('0x4a')]=function(_0x3501bf,_0x5d667b){var _0x491076={'raw':![],'where':{'id':_0x3501bf['params']['id']}},_0x135fff={};_0x135fff['model']=_[_0x2491('0x37')](db[_0x2491('0x32')][_0x2491('0x4b')]);_0x135fff[_0x2491('0x36')]=_['keys'](_0x3501bf['query']);_0x135fff['filters']=_[_0x2491('0x39')](_0x135fff['model'],_0x135fff[_0x2491('0x36')]);_0x491076[_0x2491('0x3a')]=_[_0x2491('0x39')](_0x135fff[_0x2491('0x35')],qs['fields'](_0x3501bf['query'][_0x2491('0x3b')]));_0x491076[_0x2491('0x3a')]=_0x491076['attributes'][_0x2491('0x3c')]?_0x491076[_0x2491('0x3a')]:_0x135fff[_0x2491('0x35')];if(_0x3501bf['query'][_0x2491('0x46')]){_0x491076['include']=[{'all':!![]}];}_0x491076=_[_0x2491('0x42')]({},_0x491076,_0x3501bf['options']);return db[_0x2491('0x32')][_0x2491('0x4c')](_0x491076)[_0x2491('0x2a')](handleEntityNotFound(_0x5d667b,null))[_0x2491('0x2a')](respondWithResult(_0x5d667b,null))[_0x2491('0x49')](handleError(_0x5d667b,null));};exports[_0x2491('0x4d')]=function(_0x2a9c0a,_0x2bb5ab){return db[_0x2491('0x32')][_0x2491('0x4d')](_0x2a9c0a['body'],{})['then'](respondWithResult(_0x2bb5ab,0xc9))[_0x2491('0x49')](handleError(_0x2bb5ab,null));};exports[_0x2491('0x4e')]=function(_0x16da1a,_0x34b92c){var _0x36b5b0={'where':{'id':_0x16da1a[_0x2491('0x4f')]['id']}},_0x51e5b6={};_0x51e5b6[_0x2491('0x35')]=_[_0x2491('0x37')](db[_0x2491('0x32')][_0x2491('0x4b')]);_0x36b5b0['attributes']=_['intersection'](_0x51e5b6[_0x2491('0x35')],qs[_0x2491('0x3b')](_0x16da1a[_0x2491('0x36')][_0x2491('0x3b')]));_0x36b5b0[_0x2491('0x3a')]=_0x36b5b0[_0x2491('0x3a')][_0x2491('0x3c')]?_0x36b5b0['attributes']:_0x51e5b6[_0x2491('0x35')];if(_0x16da1a['query'][_0x2491('0x46')]){_0x36b5b0[_0x2491('0x47')]=[{'all':!![]}];}_0x36b5b0=_[_0x2491('0x42')]({},_0x36b5b0,_0x16da1a[_0x2491('0x45')]);return db[_0x2491('0x32')][_0x2491('0x4c')](_0x36b5b0)[_0x2491('0x2a')](handleEntityNotFound(_0x34b92c,null))[_0x2491('0x2a')](function(_0x369f97){if(_0x369f97){var _0x5db9da=_0x369f97[_0x2491('0x50')]({'plain':!![]});_0x5db9da=qs[_0x2491('0x51')](_0x5db9da,['id',_0x2491('0x52'),_0x2491('0x53'),_0x2491('0x54')]);_0x16da1a['body']=_[_0x2491('0x51')](_0x16da1a[_0x2491('0x55')],['id',_0x2491('0x52'),_0x2491('0x53')]);return db[_0x2491('0x56')][_0x2491('0x57')](function(_0x4aab5e){return db[_0x2491('0x32')][_0x2491('0x4d')](_['merge'](_0x5db9da,_0x16da1a[_0x2491('0x55')]),{'include':_0x16da1a[_0x2491('0x36')][_0x2491('0x46')]?[{'all':!![]}]:undefined,'transaction':_0x4aab5e})[_0x2491('0x2a')](function(_0x5af2da){var _0x947012=_0x5af2da[_0x2491('0x50')]({'plain':!![]});return db[_0x2491('0x58')][_0x2491('0x59')]({'where':{'userProfileId':_0x16da1a[_0x2491('0x4f')]['id']},'raw':!![]})['then'](function(_0x1825cc){if(_0x1825cc){return BPromise[_0x2491('0x5a')](_0x1825cc,function(_0x1f389b){return new BPromise(function(_0x3a5c8b,_0x58f176){if(_0x1f389b['autoAssociation']===null||_0x1f389b[_0x2491('0x5b')]===0x1)_0x3a5c8b(null);return db['UserProfileResource'][_0x2491('0x59')]({'where':{'sectionId':_0x1f389b['id']},'raw':!![]})[_0x2491('0x2a')](function(_0x3d1fb7){var _0x59d8a2=_['map'](_0x3d1fb7,function(_0x35b5d9){return qs[_0x2491('0x51')](_0x35b5d9,['id',_0x2491('0x52'),_0x2491('0x53'),_0x2491('0x5c')]);});_0x3a5c8b(_0x59d8a2);})[_0x2491('0x49')](function(_0x33a058){_0x58f176(_0x33a058);});})[_0x2491('0x2a')](function(_0x300180){var _0x8abb92=qs[_0x2491('0x51')](_0x1f389b,['id',_0x2491('0x52'),_0x2491('0x53')]);_0x8abb92[_0x2491('0x5d')]=_0x947012['id'];if(_0x300180)_0x8abb92[_0x2491('0x5e')]=_0x300180;return _0x8abb92;})['then'](function(_0x1dda14){return db['UserProfileSection']['create'](_0x1dda14,{'include':[{'model':db['UserProfileResource'],'as':_0x2491('0x5e')}],'raw':!![],'transaction':_0x4aab5e});});})[_0x2491('0x2a')](function(){return _0x947012;});}});});});}})[_0x2491('0x2a')](respondWithResult(_0x34b92c,0xc9))['catch'](handleError(_0x34b92c,null));};exports['update']=function(_0x4041e9,_0x2e6a6b){if(_0x4041e9['body']['id']){delete _0x4041e9[_0x2491('0x55')]['id'];}return db[_0x2491('0x32')]['find']({'where':{'id':_0x4041e9[_0x2491('0x4f')]['id']}})[_0x2491('0x2a')](handleEntityNotFound(_0x2e6a6b,null))['then'](saveUpdates(_0x4041e9[_0x2491('0x55')],null))['then'](respondWithResult(_0x2e6a6b,null))[_0x2491('0x49')](handleError(_0x2e6a6b,null));};exports['destroy']=function(_0x4ad9c3,_0x391262){return db[_0x2491('0x32')][_0x2491('0x4c')]({'where':{'id':_0x4ad9c3['params']['id']}})[_0x2491('0x2a')](handleEntityNotFound(_0x391262,null))[_0x2491('0x2a')](removeEntity(_0x391262,null))[_0x2491('0x49')](handleError(_0x391262,null));};exports[_0x2491('0x5f')]=function(_0x557618,_0x243562){return db[_0x2491('0x32')][_0x2491('0x5f')]()[_0x2491('0x2a')](respondWithResult(_0x243562,null))[_0x2491('0x49')](handleError(_0x243562,null));};exports[_0x2491('0x60')]=function(_0x1aadcf,_0x5bf85c){var _0x1d28d6=_0x1aadcf[_0x2491('0x55')];return db[_0x2491('0x32')]['find']({'where':{'id':_0x1aadcf['params']['id']}})[_0x2491('0x2a')](handleEntityNotFound(_0x5bf85c,null))[_0x2491('0x2a')](function(_0x57643c){if(_0x57643c){return db[_0x2491('0x56')][_0x2491('0x57')](function(_0x4115f6){return db['UserProfileSection'][_0x2491('0x2b')]({'where':{'userProfileId':_0x1aadcf[_0x2491('0x4f')]['id'],'sectionId':_[_0x2491('0x31')](_0x1d28d6,function(_0x36acce){return _0x36acce[_0x2491('0x5c')];})},'transaction':_0x4115f6})[_0x2491('0x2a')](function(){var _0x13b76d=_[_0x2491('0x31')](_0x1d28d6,function(_0x5e00c9){_0x5e00c9[_0x2491('0x5d')]=_0x1aadcf['params']['id'];return _0x5e00c9;});var _0x2f8999=[];return BPromise[_0x2491('0x5a')](_0x13b76d,function(_0x49251f){return db[_0x2491('0x58')][_0x2491('0x4d')](_0x49251f,{'include':[{'model':db[_0x2491('0x61')],'as':_0x2491('0x5e')}],'raw':!![],'transaction':_0x4115f6})[_0x2491('0x2a')](function(_0x5e7f23){_0x2f8999[_0x2491('0x62')](_0x5e7f23[_0x2491('0x50')]({'plain':!![]}));});})['then'](function(){return _0x2f8999;});});});}})[_0x2491('0x2a')](function(_0x100a38){return _0x100a38;})[_0x2491('0x2a')](respondWithResult(_0x5bf85c,null))[_0x2491('0x49')](handleError(_0x5bf85c,null));};exports[_0x2491('0x63')]=function(_0xe7b5e7,_0xd86eec){var _0x3d3766;return db[_0x2491('0x32')]['find']({'where':{'id':_0xe7b5e7[_0x2491('0x4f')]['id']},'attributes':['id',_0x2491('0x2e')]})[_0x2491('0x2a')](handleEntityNotFound(_0xd86eec,null))[_0x2491('0x2a')](function(_0x304089){if(_0x304089){_0x3d3766=_0x304089;return db['UserProfileSection'][_0x2491('0x2b')]({'where':{'userProfileId':_0xe7b5e7[_0x2491('0x4f')]['id'],'sectionId':_0xe7b5e7[_0x2491('0x36')]['ids']}});}})[_0x2491('0x2a')](function(){return _0x3d3766;})[_0x2491('0x2a')](respondWithStatusCode(_0xd86eec,null))[_0x2491('0x49')](handleError(_0xd86eec,null));};exports[_0x2491('0x64')]=function(_0x2b6c6c,_0x49be0e){var _0x5a525e=[];var _0x337fb6=[];return db[_0x2491('0x58')][_0x2491('0x59')]({'where':{'userProfileId':_0x2b6c6c['params']['id']},'raw':!![]})[_0x2491('0x2a')](function(_0x12f391){_0x5a525e=_[_0x2491('0x41')](_0x12f391,function(_0x3a002e){return _0x3a002e[_0x2491('0x65')]===0x1||_['includes']([0x3eb,0x709],_0x3a002e[_0x2491('0x5c')]);});if(!_[_0x2491('0x66')](_0x5a525e)){return _[_0x2491('0x31')](_0x5a525e,function(_0x39e56a){return _0x39e56a[_0x2491('0x5c')];});}else{return;}})[_0x2491('0x2a')](function(_0x104a3a){if(_0x104a3a)_0x337fb6=_0x104a3a;if(_[_0x2491('0x67')](_0x337fb6,0x64)){var _0x38b113=_[_0x2491('0x4c')](_0x5a525e,{'sectionId':0x64});return hasDefaultDashboard(_0x38b113)[_0x2491('0x2a')](function(_0x90cc20){return _[_0x2491('0x31')](_0x5a525e,function(_0x1418ff){if(_0x1418ff['sectionId']===0x64){_0x1418ff['subsections']=_0x90cc20;}return _0x1418ff;});});}else{return;}})[_0x2491('0x2a')](function(_0x3a9863){if(_0x3a9863)_0x5a525e=_0x3a9863;if(_[_0x2491('0x67')](_0x337fb6,0x3eb)){var _0x308ae5=_[_0x2491('0x4c')](_0x5a525e,{'sectionId':0x3eb});return getCustomDashboards(_0x308ae5)[_0x2491('0x2a')](function(_0x50c6f6){return _[_0x2491('0x31')](_0x5a525e,function(_0x3ba175){if(_0x308ae5['enabled']){if(_0x3ba175[_0x2491('0x5c')]===0x3eb){_0x3ba175['subsections']=_0x50c6f6;}}else{if(_0x3ba175[_0x2491('0x5c')]===0x64){if(!_0x3ba175[_0x2491('0x68')]){_0x3ba175[_0x2491('0x68')]=[];}_0x3ba175[_0x2491('0x68')]=_0x3ba175[_0x2491('0x68')][_0x2491('0x69')](_0x50c6f6);}}return _0x3ba175;});});}else{return;}})[_0x2491('0x2a')](function(_0x22a28e){if(_0x22a28e)_0x5a525e=_0x22a28e;if(_[_0x2491('0x67')](_0x337fb6,0x709)){var _0x52cd3a=_[_0x2491('0x4c')](_0x5a525e,{'sectionId':0x709});return getPlugins(_0x52cd3a)[_0x2491('0x2a')](function(_0x58eef1){if(_0x52cd3a[_0x2491('0x65')]){return _[_0x2491('0x31')](_0x5a525e,function(_0x39b25f){if(_0x39b25f[_0x2491('0x5c')]===0x709){_0x39b25f[_0x2491('0x68')]=_0x58eef1;}return _0x39b25f;});}else{var _0x3e0260={'sectionId':0x76c,'enabled':0x1,'subsections':_0x58eef1};var _0x436c63=_['map'](_0x5a525e);_0x436c63[_0x2491('0x62')](_0x3e0260);return _0x436c63;}});}else{return;}})[_0x2491('0x2a')](function(_0x1b1a45){if(_0x1b1a45)_0x5a525e=_0x1b1a45;return _[_0x2491('0x41')](_0x5a525e,[_0x2491('0x65'),0x1]);})['then'](respondWithResult(_0x49be0e,null))[_0x2491('0x49')](handleError(_0x49be0e,null));};function hasDefaultDashboard(_0x45c8ca){var _0x5d74b0=[0x65];return new BPromise(function(_0x65ed9e,_0x4cb6a1){try{if(_0x45c8ca[_0x2491('0x5b')]){_0x65ed9e(_0x5d74b0);}else{return db[_0x2491('0x61')][_0x2491('0x6a')]({'where':{'sectionId':_0x45c8ca['id']},'raw':!![]})[_0x2491('0x2a')](function(_0x39ee2){_0x39ee2?_0x65ed9e(_0x5d74b0):_0x65ed9e();});}}catch(_0x528560){_0x4cb6a1(_0x528560);}});}function getCustomDashboards(_0x44ddec){var _0x4f1479=[];return new BPromise(function(_0x1777aa,_0x2386dd){try{if(_0x44ddec[_0x2491('0x5b')]){return db[_0x2491('0x6b')]['findAll']({'raw':!![]})[_0x2491('0x2a')](function(_0x54a6d0){_0x54a6d0[_0x2491('0x6c')](function(_0x362438){_0x4f1479['push'](_0x362438['id']+0x1869f);});_0x1777aa(_0x4f1479);});}else{return db['UserProfileResource'][_0x2491('0x59')]({'where':{'sectionId':_0x44ddec['id']},'raw':!![]})[_0x2491('0x2a')](function(_0x16ec1f){_0x16ec1f[_0x2491('0x6c')](function(_0x33d4e0){_0x4f1479[_0x2491('0x62')](_0x33d4e0[_0x2491('0x6d')]+0x1869f);});_0x1777aa(_0x4f1479);});}}catch(_0x508049){_0x2386dd(_0x508049);}});}function getPlugins(_0x431bfd){var _0x2bbfae=[];return new BPromise(function(_0x5d8fff,_0x205a3a){try{if(_0x431bfd[_0x2491('0x5b')]){return db[_0x2491('0x6e')][_0x2491('0x59')]({'raw':!![]})['then'](function(_0x2fd0f2){_0x2fd0f2[_0x2491('0x6c')](function(_0x1ff30b){_0x2bbfae[_0x2491('0x62')](_0x1ff30b['id']+0x15b38);});_0x5d8fff(_0x2bbfae);});}else{return db[_0x2491('0x61')][_0x2491('0x59')]({'where':{'sectionId':_0x431bfd['id']},'raw':!![]})[_0x2491('0x2a')](function(_0xb380ef){_0xb380ef[_0x2491('0x6c')](function(_0x5c4662){_0x2bbfae[_0x2491('0x62')](_0x5c4662['resourceId']+0x15b38);});_0x5d8fff(_0x2bbfae);});}}catch(_0x391c1c){_0x205a3a(_0x391c1c);}});}exports['addResources']=function(_0x73f0e1,_0x39587a){return db[_0x2491('0x32')]['find']({'where':{'id':_0x73f0e1[_0x2491('0x4f')]['id']}})[_0x2491('0x2a')](handleEntityNotFound(_0x39587a,null))[_0x2491('0x2a')](function(_0x298d66){if(_0x298d66){return db[_0x2491('0x56')][_0x2491('0x57')](function(_0x1fc468){return db[_0x2491('0x58')]['findAll']({'where':{'userProfileId':_0x73f0e1[_0x2491('0x4f')]['id']},'attributes':['id'],'raw':!![]})[_0x2491('0x2a')](function(_0x334b0a){if(_0x334b0a){return db[_0x2491('0x58')][_0x2491('0x2b')]({'where':{'userProfileId':_0x73f0e1[_0x2491('0x4f')]['id'],'id':_['map'](_0x334b0a,function(_0x34b349){return _0x34b349['id'];})},'transaction':_0x1fc468});}})['then'](function(_0x4729f5){var _0x47848b=_[_0x2491('0x31')](_0x73f0e1[_0x2491('0x55')],function(_0x1ec5b2){_0x1ec5b2[_0x2491('0x5d')]=_0x73f0e1['params']['id'];return _0x1ec5b2;});return db['UserProfileSection'][_0x2491('0x6f')](_0x47848b,{'raw':!![],'transaction':_0x1fc468});})[_0x2491('0x2a')](function(_0x5f1c02){var _0x35884b=_['filter'](_[_0x2491('0x31')](_0x5f1c02,function(_0x9c8027){return _0x9c8027[_0x2491('0x50')]({'plain':!![]});}),{'includeAll':![]});if(_0x35884b){return db['UserProfileSection'][_0x2491('0x59')]({'where':{'userProfileId':_0x73f0e1[_0x2491('0x4f')]['id'],'sectionId':_[_0x2491('0x31')](_0x35884b,function(_0x2d35ab){return _0x2d35ab[_0x2491('0x5c')];})},'attributes':['id','sectionId'],'raw':!![]})['then'](function(_0x185eb3){var _0x51d732=_[_0x2491('0x31')](_0x73f0e1[_0x2491('0x55')],function(_0x5c72b6){_0x5c72b6['userProfileId']=_0x73f0e1['params']['id'];return _0x5c72b6;});return db[_0x2491('0x61')][_0x2491('0x6f')](_0x51d732,{'raw':!![],'transaction':_0x1fc468});});}})[_0x2491('0x49')](handleError(_0x39587a,null));});}})['then'](function(_0x6a8617){var _0x4f82ef=_['map'](_0x6a8617,function(_0x4c95e9){return _0x4c95e9['get']({'plain':!![]});});})[_0x2491('0x2a')](respondWithResult(_0x39587a,null))['catch'](handleError(_0x39587a,null));};exports[_0x2491('0x70')]=function(_0x4c13c6,_0xf35a73,_0x4e6115){return db[_0x2491('0x32')][_0x2491('0x4c')]({'where':{'id':_0x4c13c6['params']['id']}})[_0x2491('0x2a')](handleEntityNotFound(_0xf35a73,null))[_0x2491('0x2a')](function(_0x2ccd46){if(_0x2ccd46){return _0x2ccd46[_0x2491('0x70')](_0x4c13c6[_0x2491('0x36')][_0x2491('0x71')]);}})['then'](respondWithStatusCode(_0xf35a73,null))[_0x2491('0x49')](handleError(_0xf35a73,null));};exports[_0x2491('0x72')]=function(_0x16d849,_0x529679){var _0x80082c={};if(!_0x16d849[_0x2491('0x36')][_0x2491('0x73')])throw new Error(_0x2491('0x74'));if(!_0x16d849['query'][_0x2491('0x3d')]('nolimit')){_0x80082c[_0x2491('0x23')]=qs['limit'](_0x16d849[_0x2491('0x36')][_0x2491('0x23')]);_0x80082c['offset']=qs[_0x2491('0x21')](_0x16d849[_0x2491('0x36')][_0x2491('0x21')]);}return db[_0x2491('0x32')][_0x2491('0x4c')]({'where':{'id':_0x16d849[_0x2491('0x4f')]['id']}})[_0x2491('0x2a')](function(_0x342bef){if(!_0x342bef)throw new Error(_0x2491('0x75')+_0x16d849[_0x2491('0x4f')]['id']);return db['UserProfile'][_0x2491('0x72')](_0x16d849);})['then'](respondWithFilteredResult(_0x529679,_0x80082c))[_0x2491('0x49')](handleError(_0x529679,null));}; \ No newline at end of file +var _0x1cd1=['omit','createdAt','updatedAt','crudPermissions','body','sequelize','transaction','autoAssociation','UserProfileResource','sectionId','catch','userProfileId','Resources','UserProfileSection','describe','addSections','each','push','removeSections','ids','getSections','enabled','includes','subsections','concat','Dashboard','forEach','Plugin','resourceId','addResources','bulkCreate','Missing\x20section\x20parameter','No\x20User\x20Profile\x20found\x20for\x20id\x20','getResources','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','defaults','redis','localhost','socket.io-emitter','./userProfile.socket','register','status','end','json','offset','undefined','limit','set','apply','reject','save','update','then','destroy','sendStatus','error','name','index','UserProfile','rawAttributes','fieldName','type','key','model','map','filters','attributes','intersection','query','fields','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','count','includeAll','include','findAll','params','keys','length','find','create','get'];(function(_0x13e724,_0x296739){var _0x334a44=function(_0x28f54e){while(--_0x28f54e){_0x13e724['push'](_0x13e724['shift']());}};_0x334a44(++_0x296739);}(_0x1cd1,0x108));var _0x11cd=function(_0x3eb761,_0xa5bdad){_0x3eb761=_0x3eb761-0x0;var _0x374b59=_0x1cd1[_0x3eb761];return _0x374b59;};'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(_0x11cd('0x8'));var csv=require(_0x11cd('0x9'));var ejs=require(_0x11cd('0xa'));var fs=require('fs');var fs_extra=require(_0x11cd('0xb'));var _=require('lodash');var squel=require(_0x11cd('0xc'));var crypto=require(_0x11cd('0xd'));var jsforce=require(_0x11cd('0xe'));var deskjs=require(_0x11cd('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x11cd('0x10'));var authService=require(_0x11cd('0x11'));var qs=require(_0x11cd('0x12'));var as=require(_0x11cd('0x13'));var hardwareService=require(_0x11cd('0x14'));var logger=require(_0x11cd('0x15'))(_0x11cd('0x16'));var utils=require(_0x11cd('0x17'));var config=require(_0x11cd('0x18'));var licenseUtil=require(_0x11cd('0x19'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x11cd('0x1a')](config[_0x11cd('0x1b')],{'host':_0x11cd('0x1c'),'port':0x18eb});var socket=require(_0x11cd('0x1d'))(new Redis(config[_0x11cd('0x1b')]));require(_0x11cd('0x1e'))[_0x11cd('0x1f')](socket);function respondWithStatusCode(_0x2ff068,_0x142276){_0x142276=_0x142276||0xcc;return function(_0x2e728b){if(_0x2e728b){return _0x2ff068['sendStatus'](_0x142276);}return _0x2ff068[_0x11cd('0x20')](_0x142276)[_0x11cd('0x21')]();};}function respondWithResult(_0x3c9b0b,_0x33827b){_0x33827b=_0x33827b||0xc8;return function(_0x261bf8){if(_0x261bf8){return _0x3c9b0b[_0x11cd('0x20')](_0x33827b)[_0x11cd('0x22')](_0x261bf8);}};}function respondWithFilteredResult(_0x19edc6,_0x4d28da){return function(_0xb67c39){if(_0xb67c39){var _0x4f78d5=typeof _0x4d28da[_0x11cd('0x23')]===_0x11cd('0x24')&&typeof _0x4d28da[_0x11cd('0x25')]===_0x11cd('0x24');var _0x5e5c16=_0xb67c39['count'];var _0x3b9439=_0x4f78d5?0x0:_0x4d28da[_0x11cd('0x23')];var _0x2d5c0e=_0x4f78d5?_0xb67c39['count']:_0x4d28da[_0x11cd('0x23')]+_0x4d28da['limit'];var _0x51d02b;if(_0x2d5c0e>=_0x5e5c16){_0x2d5c0e=_0x5e5c16;_0x51d02b=0xc8;}else{_0x51d02b=0xce;}_0x19edc6[_0x11cd('0x20')](_0x51d02b);return _0x19edc6[_0x11cd('0x26')]('Content-Range',_0x3b9439+'-'+_0x2d5c0e+'/'+_0x5e5c16)['json'](_0xb67c39);}return null;};}function patchUpdates(_0x522196){return function(_0x38ac0a){try{jsonpatch[_0x11cd('0x27')](_0x38ac0a,_0x522196,!![]);}catch(_0x48a70d){return BPromise[_0x11cd('0x28')](_0x48a70d);}return _0x38ac0a[_0x11cd('0x29')]();};}function saveUpdates(_0x5255f7,_0xc7c1ff){return function(_0x34dd36){if(_0x34dd36){return _0x34dd36[_0x11cd('0x2a')](_0x5255f7)[_0x11cd('0x2b')](function(_0x4d0a23){return _0x4d0a23;});}return null;};}function removeEntity(_0x52bffb,_0x1873a4){return function(_0x535daa){if(_0x535daa){return _0x535daa[_0x11cd('0x2c')]()[_0x11cd('0x2b')](function(){_0x52bffb['status'](0xcc)[_0x11cd('0x21')]();});}};}function handleEntityNotFound(_0x32b955,_0xa2b998){return function(_0x2516d9){if(!_0x2516d9){_0x32b955[_0x11cd('0x2d')](0x194);}return _0x2516d9;};}function handleError(_0x4ab551,_0x323b12){_0x323b12=_0x323b12||0x1f4;return function(_0x49d914){logger[_0x11cd('0x2e')](_0x49d914['stack']);if(_0x49d914[_0x11cd('0x2f')]){delete _0x49d914[_0x11cd('0x2f')];}_0x4ab551[_0x11cd('0x20')](_0x323b12)['send'](_0x49d914);};}exports[_0x11cd('0x30')]=function(_0x79e1c9,_0x2a9017){var _0x4f406b={},_0x248d86={},_0x697315={'count':0x0,'rows':[]};var _0x59ca0f=_['map'](db[_0x11cd('0x31')][_0x11cd('0x32')],function(_0x39d502){return{'name':_0x39d502[_0x11cd('0x33')],'type':_0x39d502[_0x11cd('0x34')][_0x11cd('0x35')]};});_0x248d86[_0x11cd('0x36')]=_[_0x11cd('0x37')](_0x59ca0f,_0x11cd('0x2f'));_0x248d86['query']=_['keys'](_0x79e1c9['query']);_0x248d86[_0x11cd('0x38')]=_['intersection'](_0x248d86[_0x11cd('0x36')],_0x248d86['query']);_0x4f406b[_0x11cd('0x39')]=_[_0x11cd('0x3a')](_0x248d86['model'],qs['fields'](_0x79e1c9[_0x11cd('0x3b')][_0x11cd('0x3c')]));_0x4f406b[_0x11cd('0x39')]=_0x4f406b[_0x11cd('0x39')]['length']?_0x4f406b[_0x11cd('0x39')]:_0x248d86[_0x11cd('0x36')];if(!_0x79e1c9[_0x11cd('0x3b')][_0x11cd('0x3d')](_0x11cd('0x3e'))){_0x4f406b[_0x11cd('0x25')]=qs[_0x11cd('0x25')](_0x79e1c9['query']['limit']);_0x4f406b[_0x11cd('0x23')]=qs[_0x11cd('0x23')](_0x79e1c9[_0x11cd('0x3b')][_0x11cd('0x23')]);}_0x4f406b[_0x11cd('0x3f')]=qs[_0x11cd('0x40')](_0x79e1c9[_0x11cd('0x3b')][_0x11cd('0x40')]);_0x4f406b[_0x11cd('0x41')]=qs[_0x11cd('0x38')](_[_0x11cd('0x42')](_0x79e1c9[_0x11cd('0x3b')],_0x248d86['filters']),_0x59ca0f);if(_0x79e1c9[_0x11cd('0x3b')]['filter']){_0x4f406b[_0x11cd('0x41')]=_['merge'](_0x4f406b['where'],{'$or':_[_0x11cd('0x37')](_0x59ca0f,function(_0x355f81){if(_0x355f81[_0x11cd('0x34')]!==_0x11cd('0x43')){var _0x2bd0fd={};_0x2bd0fd[_0x355f81['name']]={'$like':'%'+_0x79e1c9[_0x11cd('0x3b')][_0x11cd('0x44')]+'%'};return _0x2bd0fd;}})});}_0x4f406b=_[_0x11cd('0x45')]({},_0x4f406b,_0x79e1c9[_0x11cd('0x46')]);var _0x3d6dce={'where':_0x4f406b[_0x11cd('0x41')]};return db[_0x11cd('0x31')][_0x11cd('0x47')](_0x3d6dce)[_0x11cd('0x2b')](function(_0x35d836){_0x697315[_0x11cd('0x47')]=_0x35d836;if(_0x79e1c9[_0x11cd('0x3b')][_0x11cd('0x48')]){_0x4f406b[_0x11cd('0x49')]=[{'all':!![]}];}return db[_0x11cd('0x31')][_0x11cd('0x4a')](_0x4f406b);})[_0x11cd('0x2b')](function(_0x456c52){_0x697315['rows']=_0x456c52;return _0x697315;})[_0x11cd('0x2b')](respondWithFilteredResult(_0x2a9017,_0x4f406b))['catch'](handleError(_0x2a9017,null));};exports['show']=function(_0x19c912,_0x2cc9e8){var _0xd26eec={'raw':![],'where':{'id':_0x19c912[_0x11cd('0x4b')]['id']}},_0x4be6e0={};_0x4be6e0['model']=_[_0x11cd('0x4c')](db[_0x11cd('0x31')]['rawAttributes']);_0x4be6e0[_0x11cd('0x3b')]=_[_0x11cd('0x4c')](_0x19c912[_0x11cd('0x3b')]);_0x4be6e0['filters']=_[_0x11cd('0x3a')](_0x4be6e0[_0x11cd('0x36')],_0x4be6e0[_0x11cd('0x3b')]);_0xd26eec[_0x11cd('0x39')]=_[_0x11cd('0x3a')](_0x4be6e0[_0x11cd('0x36')],qs['fields'](_0x19c912[_0x11cd('0x3b')][_0x11cd('0x3c')]));_0xd26eec[_0x11cd('0x39')]=_0xd26eec['attributes'][_0x11cd('0x4d')]?_0xd26eec[_0x11cd('0x39')]:_0x4be6e0['model'];if(_0x19c912[_0x11cd('0x3b')][_0x11cd('0x48')]){_0xd26eec[_0x11cd('0x49')]=[{'all':!![]}];}_0xd26eec=_[_0x11cd('0x45')]({},_0xd26eec,_0x19c912[_0x11cd('0x46')]);return db[_0x11cd('0x31')][_0x11cd('0x4e')](_0xd26eec)[_0x11cd('0x2b')](handleEntityNotFound(_0x2cc9e8,null))[_0x11cd('0x2b')](respondWithResult(_0x2cc9e8,null))['catch'](handleError(_0x2cc9e8,null));};exports[_0x11cd('0x4f')]=function(_0x343a42,_0x13f062){return db[_0x11cd('0x31')]['create'](_0x343a42['body'],{})['then'](respondWithResult(_0x13f062,0xc9))['catch'](handleError(_0x13f062,null));};exports['clone']=function(_0x2c1382,_0xcda239){var _0xdfdb49={'where':{'id':_0x2c1382[_0x11cd('0x4b')]['id']}},_0x4509d7={};_0x4509d7[_0x11cd('0x36')]=_[_0x11cd('0x4c')](db[_0x11cd('0x31')][_0x11cd('0x32')]);_0xdfdb49['attributes']=_[_0x11cd('0x3a')](_0x4509d7['model'],qs[_0x11cd('0x3c')](_0x2c1382[_0x11cd('0x3b')][_0x11cd('0x3c')]));_0xdfdb49['attributes']=_0xdfdb49[_0x11cd('0x39')]['length']?_0xdfdb49[_0x11cd('0x39')]:_0x4509d7[_0x11cd('0x36')];if(_0x2c1382[_0x11cd('0x3b')][_0x11cd('0x48')]){_0xdfdb49['include']=[{'all':!![]}];}_0xdfdb49=_['merge']({},_0xdfdb49,_0x2c1382[_0x11cd('0x46')]);return db[_0x11cd('0x31')][_0x11cd('0x4e')](_0xdfdb49)[_0x11cd('0x2b')](handleEntityNotFound(_0xcda239,null))['then'](function(_0xfb855a){if(_0xfb855a){var _0xedb644=_0xfb855a[_0x11cd('0x50')]({'plain':!![]});_0xedb644=qs[_0x11cd('0x51')](_0xedb644,['id',_0x11cd('0x52'),_0x11cd('0x53'),_0x11cd('0x54')]);_0x2c1382[_0x11cd('0x55')]=_[_0x11cd('0x51')](_0x2c1382[_0x11cd('0x55')],['id',_0x11cd('0x52'),_0x11cd('0x53')]);return db[_0x11cd('0x56')][_0x11cd('0x57')](function(_0x59cc7c){return db['UserProfile'][_0x11cd('0x4f')](_[_0x11cd('0x45')](_0xedb644,_0x2c1382[_0x11cd('0x55')]),{'include':_0x2c1382[_0x11cd('0x3b')][_0x11cd('0x48')]?[{'all':!![]}]:undefined,'transaction':_0x59cc7c})['then'](function(_0x52b929){var _0x43e02f=_0x52b929[_0x11cd('0x50')]({'plain':!![]});return db['UserProfileSection'][_0x11cd('0x4a')]({'where':{'userProfileId':_0x2c1382['params']['id']},'raw':!![]})[_0x11cd('0x2b')](function(_0x471d98){if(_0x471d98){return BPromise['each'](_0x471d98,function(_0x5dc214){return new BPromise(function(_0x3a1759,_0x326501){if(_0x5dc214[_0x11cd('0x58')]===null||_0x5dc214[_0x11cd('0x58')]===0x1)_0x3a1759(null);return db[_0x11cd('0x59')][_0x11cd('0x4a')]({'where':{'sectionId':_0x5dc214['id']},'raw':!![]})[_0x11cd('0x2b')](function(_0x31b957){var _0x382714=_[_0x11cd('0x37')](_0x31b957,function(_0x372431){return qs['omit'](_0x372431,['id',_0x11cd('0x52'),'updatedAt',_0x11cd('0x5a')]);});_0x3a1759(_0x382714);})[_0x11cd('0x5b')](function(_0x12188c){_0x326501(_0x12188c);});})[_0x11cd('0x2b')](function(_0x5a449f){var _0x59dc26=qs[_0x11cd('0x51')](_0x5dc214,['id',_0x11cd('0x52'),_0x11cd('0x53')]);_0x59dc26[_0x11cd('0x5c')]=_0x43e02f['id'];if(_0x5a449f)_0x59dc26[_0x11cd('0x5d')]=_0x5a449f;return _0x59dc26;})['then'](function(_0x4c37a6){return db[_0x11cd('0x5e')][_0x11cd('0x4f')](_0x4c37a6,{'include':[{'model':db[_0x11cd('0x59')],'as':_0x11cd('0x5d')}],'raw':!![],'transaction':_0x59cc7c});});})[_0x11cd('0x2b')](function(){return _0x43e02f;});}});});});}})['then'](respondWithResult(_0xcda239,0xc9))['catch'](handleError(_0xcda239,null));};exports['update']=function(_0x5385d8,_0x2c6a43){if(_0x5385d8[_0x11cd('0x55')]['id']){delete _0x5385d8[_0x11cd('0x55')]['id'];}return db[_0x11cd('0x31')][_0x11cd('0x4e')]({'where':{'id':_0x5385d8[_0x11cd('0x4b')]['id']}})[_0x11cd('0x2b')](handleEntityNotFound(_0x2c6a43,null))[_0x11cd('0x2b')](saveUpdates(_0x5385d8[_0x11cd('0x55')],null))[_0x11cd('0x2b')](respondWithResult(_0x2c6a43,null))[_0x11cd('0x5b')](handleError(_0x2c6a43,null));};exports['destroy']=function(_0x71b9f0,_0x58eecf){return db['UserProfile'][_0x11cd('0x4e')]({'where':{'id':_0x71b9f0[_0x11cd('0x4b')]['id']}})[_0x11cd('0x2b')](handleEntityNotFound(_0x58eecf,null))['then'](removeEntity(_0x58eecf,null))[_0x11cd('0x5b')](handleError(_0x58eecf,null));};exports[_0x11cd('0x5f')]=function(_0x46a928,_0x1350a4){return db['UserProfile'][_0x11cd('0x5f')]()['then'](respondWithResult(_0x1350a4,null))[_0x11cd('0x5b')](handleError(_0x1350a4,null));};exports[_0x11cd('0x60')]=function(_0x4c6b29,_0xae19f8){var _0x1e725e=_0x4c6b29[_0x11cd('0x55')];return db[_0x11cd('0x31')][_0x11cd('0x4e')]({'where':{'id':_0x4c6b29[_0x11cd('0x4b')]['id']}})['then'](handleEntityNotFound(_0xae19f8,null))[_0x11cd('0x2b')](function(_0x2ae1dc){if(_0x2ae1dc){return db[_0x11cd('0x56')][_0x11cd('0x57')](function(_0x12f3ac){return db[_0x11cd('0x5e')]['destroy']({'where':{'userProfileId':_0x4c6b29[_0x11cd('0x4b')]['id'],'sectionId':_[_0x11cd('0x37')](_0x1e725e,function(_0xebde09){return _0xebde09[_0x11cd('0x5a')];})},'transaction':_0x12f3ac})['then'](function(){var _0x438eb9=_[_0x11cd('0x37')](_0x1e725e,function(_0x471992){_0x471992['userProfileId']=_0x4c6b29['params']['id'];return _0x471992;});var _0x142d87=[];return BPromise[_0x11cd('0x61')](_0x438eb9,function(_0x482576){return db[_0x11cd('0x5e')]['create'](_0x482576,{'include':[{'model':db['UserProfileResource'],'as':_0x11cd('0x5d')}],'raw':!![],'transaction':_0x12f3ac})[_0x11cd('0x2b')](function(_0x175902){_0x142d87[_0x11cd('0x62')](_0x175902[_0x11cd('0x50')]({'plain':!![]}));});})[_0x11cd('0x2b')](function(){return _0x142d87;});});});}})[_0x11cd('0x2b')](function(_0x943811){return _0x943811;})['then'](respondWithResult(_0xae19f8,null))['catch'](handleError(_0xae19f8,null));};exports[_0x11cd('0x63')]=function(_0x24a967,_0x589a0c){var _0x232a26;return db[_0x11cd('0x31')][_0x11cd('0x4e')]({'where':{'id':_0x24a967[_0x11cd('0x4b')]['id']},'attributes':['id','name']})[_0x11cd('0x2b')](handleEntityNotFound(_0x589a0c,null))['then'](function(_0x50ddfd){if(_0x50ddfd){_0x232a26=_0x50ddfd;return db['UserProfileSection']['destroy']({'where':{'userProfileId':_0x24a967['params']['id'],'sectionId':_0x24a967['query'][_0x11cd('0x64')]}});}})[_0x11cd('0x2b')](function(){return _0x232a26;})['then'](respondWithStatusCode(_0x589a0c,null))[_0x11cd('0x5b')](handleError(_0x589a0c,null));};exports[_0x11cd('0x65')]=function(_0x2ae584,_0x2bec03){var _0x83804f=[];var _0x3d5aa2=[];return db['UserProfileSection'][_0x11cd('0x4a')]({'where':{'userProfileId':_0x2ae584[_0x11cd('0x4b')]['id']},'raw':!![]})[_0x11cd('0x2b')](function(_0x5c8568){_0x83804f=_[_0x11cd('0x44')](_0x5c8568,function(_0x21a240){return _0x21a240[_0x11cd('0x66')]===0x1||_[_0x11cd('0x67')]([0x3eb,0x709],_0x21a240['sectionId']);});if(!_['isEmpty'](_0x83804f)){return _[_0x11cd('0x37')](_0x83804f,function(_0x4ef1ed){return _0x4ef1ed[_0x11cd('0x5a')];});}else{return;}})[_0x11cd('0x2b')](function(_0xd8e273){if(_0xd8e273)_0x3d5aa2=_0xd8e273;if(_[_0x11cd('0x67')](_0x3d5aa2,0x64)){var _0x5978c7=_[_0x11cd('0x4e')](_0x83804f,{'sectionId':0x64});return hasDefaultDashboard(_0x5978c7)[_0x11cd('0x2b')](function(_0x266086){return _[_0x11cd('0x37')](_0x83804f,function(_0x276520){if(_0x276520[_0x11cd('0x5a')]===0x64){_0x276520['subsections']=_0x266086;}return _0x276520;});});}else{return;}})[_0x11cd('0x2b')](function(_0x3ca71d){if(_0x3ca71d)_0x83804f=_0x3ca71d;if(_[_0x11cd('0x67')](_0x3d5aa2,0x3eb)){var _0x573243=_['find'](_0x83804f,{'sectionId':0x3eb});return getCustomDashboards(_0x573243)['then'](function(_0x4e71b2){return _['map'](_0x83804f,function(_0x561326){if(_0x573243[_0x11cd('0x66')]){if(_0x561326[_0x11cd('0x5a')]===0x3eb){_0x561326['subsections']=_0x4e71b2;}}else{if(_0x561326[_0x11cd('0x5a')]===0x64){if(!_0x561326[_0x11cd('0x68')]){_0x561326[_0x11cd('0x68')]=[];}_0x561326[_0x11cd('0x68')]=_0x561326[_0x11cd('0x68')][_0x11cd('0x69')](_0x4e71b2);}}return _0x561326;});});}else{return;}})['then'](function(_0x5a336a){if(_0x5a336a)_0x83804f=_0x5a336a;if(_[_0x11cd('0x67')](_0x3d5aa2,0x709)){var _0x14c8f5=_[_0x11cd('0x4e')](_0x83804f,{'sectionId':0x709});return getPlugins(_0x14c8f5)[_0x11cd('0x2b')](function(_0x411412){if(_0x14c8f5['enabled']){return _['map'](_0x83804f,function(_0x4b2d87){if(_0x4b2d87['sectionId']===0x709){_0x4b2d87[_0x11cd('0x68')]=_0x411412;}return _0x4b2d87;});}else{var _0x4b5e29={'sectionId':0x76c,'enabled':0x1,'subsections':_0x411412};var _0x984855=_[_0x11cd('0x37')](_0x83804f);_0x984855[_0x11cd('0x62')](_0x4b5e29);return _0x984855;}});}else{return;}})[_0x11cd('0x2b')](function(_0x35dfd1){if(_0x35dfd1)_0x83804f=_0x35dfd1;return _[_0x11cd('0x44')](_0x83804f,[_0x11cd('0x66'),0x1]);})[_0x11cd('0x2b')](respondWithResult(_0x2bec03,null))[_0x11cd('0x5b')](handleError(_0x2bec03,null));};function hasDefaultDashboard(_0x39532e){var _0x4a7b21=[0x65];return new BPromise(function(_0x1782f0,_0x4a93ff){try{if(_0x39532e[_0x11cd('0x58')]){_0x1782f0(_0x4a7b21);}else{return db[_0x11cd('0x59')]['findOne']({'where':{'sectionId':_0x39532e['id']},'raw':!![]})[_0x11cd('0x2b')](function(_0x3ae705){_0x3ae705?_0x1782f0(_0x4a7b21):_0x1782f0();});}}catch(_0x403583){_0x4a93ff(_0x403583);}});}function getCustomDashboards(_0x18f3db){var _0x483cf1=[];return new BPromise(function(_0x4e6d5d,_0x25d4d3){try{if(_0x18f3db[_0x11cd('0x58')]){return db[_0x11cd('0x6a')][_0x11cd('0x4a')]({'raw':!![]})[_0x11cd('0x2b')](function(_0x273231){_0x273231[_0x11cd('0x6b')](function(_0x1f77a8){_0x483cf1[_0x11cd('0x62')](_0x1f77a8['id']+0x1869f);});_0x4e6d5d(_0x483cf1);});}else{return db[_0x11cd('0x59')][_0x11cd('0x4a')]({'where':{'sectionId':_0x18f3db['id']},'raw':!![]})[_0x11cd('0x2b')](function(_0x2f0385){_0x2f0385[_0x11cd('0x6b')](function(_0x2f4276){_0x483cf1[_0x11cd('0x62')](_0x2f4276['resourceId']+0x1869f);});_0x4e6d5d(_0x483cf1);});}}catch(_0x3a20bf){_0x25d4d3(_0x3a20bf);}});}function getPlugins(_0x3fd545){var _0x127ce2=[];return new BPromise(function(_0x253fb6,_0x17d30c){try{if(_0x3fd545[_0x11cd('0x58')]){return db[_0x11cd('0x6c')]['findAll']({'raw':!![]})[_0x11cd('0x2b')](function(_0x4ba070){_0x4ba070['forEach'](function(_0x54446a){_0x127ce2[_0x11cd('0x62')](_0x54446a['id']+0x15b38);});_0x253fb6(_0x127ce2);});}else{return db['UserProfileResource'][_0x11cd('0x4a')]({'where':{'sectionId':_0x3fd545['id']},'raw':!![]})['then'](function(_0x104d1f){_0x104d1f[_0x11cd('0x6b')](function(_0x253ae6){_0x127ce2[_0x11cd('0x62')](_0x253ae6[_0x11cd('0x6d')]+0x15b38);});_0x253fb6(_0x127ce2);});}}catch(_0x2a1747){_0x17d30c(_0x2a1747);}});}exports[_0x11cd('0x6e')]=function(_0x11f5c8,_0x41f131){return db['UserProfile'][_0x11cd('0x4e')]({'where':{'id':_0x11f5c8[_0x11cd('0x4b')]['id']}})['then'](handleEntityNotFound(_0x41f131,null))['then'](function(_0x410414){if(_0x410414){return db[_0x11cd('0x56')][_0x11cd('0x57')](function(_0x401276){return db['UserProfileSection'][_0x11cd('0x4a')]({'where':{'userProfileId':_0x11f5c8[_0x11cd('0x4b')]['id']},'attributes':['id'],'raw':!![]})[_0x11cd('0x2b')](function(_0x30df25){if(_0x30df25){return db[_0x11cd('0x5e')]['destroy']({'where':{'userProfileId':_0x11f5c8[_0x11cd('0x4b')]['id'],'id':_[_0x11cd('0x37')](_0x30df25,function(_0x36bfc6){return _0x36bfc6['id'];})},'transaction':_0x401276});}})[_0x11cd('0x2b')](function(_0x1217a3){var _0x222473=_[_0x11cd('0x37')](_0x11f5c8[_0x11cd('0x55')],function(_0x117d5b){_0x117d5b[_0x11cd('0x5c')]=_0x11f5c8['params']['id'];return _0x117d5b;});return db[_0x11cd('0x5e')][_0x11cd('0x6f')](_0x222473,{'raw':!![],'transaction':_0x401276});})[_0x11cd('0x2b')](function(_0x34f8fa){var _0x52e3f4=_[_0x11cd('0x44')](_['map'](_0x34f8fa,function(_0x12b8d9){return _0x12b8d9[_0x11cd('0x50')]({'plain':!![]});}),{'includeAll':![]});if(_0x52e3f4){return db[_0x11cd('0x5e')][_0x11cd('0x4a')]({'where':{'userProfileId':_0x11f5c8['params']['id'],'sectionId':_[_0x11cd('0x37')](_0x52e3f4,function(_0x1f8fce){return _0x1f8fce[_0x11cd('0x5a')];})},'attributes':['id','sectionId'],'raw':!![]})['then'](function(_0x2bc529){var _0x2fd1f3=_[_0x11cd('0x37')](_0x11f5c8[_0x11cd('0x55')],function(_0x1974cd){_0x1974cd['userProfileId']=_0x11f5c8[_0x11cd('0x4b')]['id'];return _0x1974cd;});return db['UserProfileResource'][_0x11cd('0x6f')](_0x2fd1f3,{'raw':!![],'transaction':_0x401276});});}})[_0x11cd('0x5b')](handleError(_0x41f131,null));});}})['then'](function(_0xb0f526){var _0x3da540=_[_0x11cd('0x37')](_0xb0f526,function(_0x283299){return _0x283299['get']({'plain':!![]});});})[_0x11cd('0x2b')](respondWithResult(_0x41f131,null))[_0x11cd('0x5b')](handleError(_0x41f131,null));};exports['removeResources']=function(_0x2c7cc5,_0x5037c7,_0x25e9cb){return db[_0x11cd('0x31')][_0x11cd('0x4e')]({'where':{'id':_0x2c7cc5[_0x11cd('0x4b')]['id']}})[_0x11cd('0x2b')](handleEntityNotFound(_0x5037c7,null))[_0x11cd('0x2b')](function(_0x26722a){if(_0x26722a){return _0x26722a['removeResources'](_0x2c7cc5[_0x11cd('0x3b')][_0x11cd('0x64')]);}})['then'](respondWithStatusCode(_0x5037c7,null))[_0x11cd('0x5b')](handleError(_0x5037c7,null));};exports['getResources']=function(_0x2851e2,_0x3a978d){var _0x1bc3bf={};if(!_0x2851e2[_0x11cd('0x3b')]['section'])throw new Error(_0x11cd('0x70'));if(!_0x2851e2[_0x11cd('0x3b')][_0x11cd('0x3d')](_0x11cd('0x3e'))){_0x1bc3bf[_0x11cd('0x25')]=qs[_0x11cd('0x25')](_0x2851e2['query'][_0x11cd('0x25')]);_0x1bc3bf['offset']=qs[_0x11cd('0x23')](_0x2851e2['query'][_0x11cd('0x23')]);}return db[_0x11cd('0x31')][_0x11cd('0x4e')]({'where':{'id':_0x2851e2[_0x11cd('0x4b')]['id']}})[_0x11cd('0x2b')](function(_0x1ebf8e){if(!_0x1ebf8e)throw new Error(_0x11cd('0x71')+_0x2851e2[_0x11cd('0x4b')]['id']);return db[_0x11cd('0x31')][_0x11cd('0x72')](_0x2851e2);})['then'](respondWithFilteredResult(_0x3a978d,_0x1bc3bf))[_0x11cd('0x5b')](handleError(_0x3a978d,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index 20c1e43..7d36987 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 _0x7e27=['update','remove','emit','hook','exports','events','../../mysqldb','setMaxListeners','save'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x7e27,0xdd));var _0x77e2=function(_0x346045,_0x3ce566){_0x346045=_0x346045-0x0;var _0x3d1573=_0x7e27[_0x346045];return _0x3d1573;};'use strict';var EventEmitter=require(_0x77e2('0x0'));var UserProfile=require(_0x77e2('0x1'))['db']['UserProfile'];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x77e2('0x2')](0x0);var events={'afterCreate':_0x77e2('0x3'),'afterUpdate':_0x77e2('0x4'),'afterDestroy':_0x77e2('0x5')};function emitEvent(_0x49537e){return function(_0x30766a,_0x21bb94,_0x20c6f0){UserProfileEvents['emit'](_0x49537e+':'+_0x30766a['id'],_0x30766a);UserProfileEvents[_0x77e2('0x6')](_0x49537e,_0x30766a);_0x20c6f0(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserProfile[_0x77e2('0x7')](e,emitEvent(event));}}module[_0x77e2('0x8')]=UserProfileEvents; \ No newline at end of file +var _0xb091=['setMaxListeners','save','remove','emit','hasOwnProperty','hook','../../mysqldb','UserProfile'];(function(_0x235ec2,_0x2408c0){var _0x2c0388=function(_0x424764){while(--_0x424764){_0x235ec2['push'](_0x235ec2['shift']());}};_0x2c0388(++_0x2408c0);}(_0xb091,0x16e));var _0x1b09=function(_0x27baf0,_0x5c17f0){_0x27baf0=_0x27baf0-0x0;var _0xbeca79=_0xb091[_0x27baf0];return _0xbeca79;};'use strict';var EventEmitter=require('events');var UserProfile=require(_0x1b09('0x0'))['db'][_0x1b09('0x1')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x1b09('0x2')](0x0);var events={'afterCreate':_0x1b09('0x3'),'afterUpdate':'update','afterDestroy':_0x1b09('0x4')};function emitEvent(_0x59af61){return function(_0x5aa3b0,_0x295863,_0x24d22c){UserProfileEvents['emit'](_0x59af61+':'+_0x5aa3b0['id'],_0x5aa3b0);UserProfileEvents[_0x1b09('0x5')](_0x59af61,_0x5aa3b0);_0x24d22c(null);};}for(var e in events){if(events[_0x1b09('0x6')](e)){var event=events[e];UserProfile[_0x1b09('0x7')](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 028f861..40ab7d7 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 _0x5898=['ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','dispositions','customdashboards','Dashboard','intervals','Interval','pauses','scheduler','Schedule','sounds','Sound','tags','Tag','templates','triggers','Trigger','trunks','Trunk','variables','Plugin','extractedreports','Reports','toUpperCase','slice','Sequelize','SELECT','select','ui.','InteractionId','ui.createdAt','from','user_has_','_interactions','where','ui.UserId\x20=\x20?','sequelize','toString','OpenTabs','define','user_profiles','raw','query','section','mergeResources','Invalid\x20section\x20\x27','isEmpty','length','UserProfileSection','all','ignore','union','find','push','autoAssociation','rawAttributes','model','filters','intersection','attributes','fields','hasOwnProperty','limit','offset','order','sort','pick','key','foreignKey','forEach','merge','options','includeAll','include','reportType','default','custom','count','rows','ids','customSorting','extraQueryConditions','color','tag','ThroughTags','Agents','true','chat','dataValues','fax','mail','openchannel','whatsapp','lodash','./userProfile.attributes','../../components/parsers/qs','exports','models','filter','field','value','then','associatedResources','map','catch','findAll','name','UserProfileResource','AnalyticExtractedReport','resourceId','type','toLowerCase','squareprojects','childModel','SquareProject','odbc','SquareOdbc','squarerecordings','projectName','projects','CmContact','parentSections','Lists','ListId','CmList','companies','globalcustomfields','CmCustomField','chatqueues','ChatQueue','chatwebsites','ChatWebsite','faxqueues','FaxQueue','faxaccounts','FaxAccount','outboundroutes','VoiceExtension','VoiceContext','voicemails','VoiceMail','voicerecordings','membername','agent','User','role','telephone','queue','QueueCampaigns','VoiceQueue','VoiceMusicOnHold','chanspies','voiceprefixes','VoicePrefix','ivrcampaigns','Campaign','mailqueues','MailQueue','MailAccount','mailsubstatuses','MailSubstatus','openchannelqueues','OpenchannelAccount','smsaccounts','SmsAccount','whatsappqueues','WhatsappQueue','teams','Team','voicequeues','queuecampaigns','VoiceQueues','agents','telephones','Users','admin','zendeskaccounts','ZendeskAccount','salesforceaccounts','SalesforceAccount','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','deskaccounts','DeskAccount','zohoaccounts'];(function(_0x49f8fa,_0x72260e){var _0x384b7c=function(_0x12eea9){while(--_0x12eea9){_0x49f8fa['push'](_0x49f8fa['shift']());}};_0x384b7c(++_0x72260e);}(_0x5898,0x11b));var _0x8589=function(_0x1e73fc,_0x533750){_0x1e73fc=_0x1e73fc-0x0;var _0xeceac4=_0x5898[_0x1e73fc];return _0xeceac4;};'use strict';var _=require(_0x8589('0x0'));var attributes=require(_0x8589('0x1'));var qs=require(_0x8589('0x2'));var squel=require('squel');module[_0x8589('0x3')]=function(_0x4db772){var _0x3dd8a3=_0x4db772[_0x8589('0x4')];function _0x4f14d8(_0x456273,_0x321011){return new Promise(function(_0x162740,_0x34a6c4){if(!_0x321011)return _0x162740(null);var _0x1c2656=_0x321011[_0x8589('0x5')]?{[_0x321011[_0x8589('0x5')][_0x8589('0x6')]]:_0x321011[_0x8589('0x5')][_0x8589('0x7')]}:undefined;return _0x3dd8a3[_0x456273]['findAll']({'where':_0x1c2656,'raw':!![]})[_0x8589('0x8')](function(_0x26c8f0){_0x321011[_0x8589('0x9')]=_[_0x8589('0xa')](_0x26c8f0,'id');_0x162740(_0x321011);})[_0x8589('0xb')](function(_0x4cedfa){_0x34a6c4(_0x4cedfa);});});}function _0x220c66(_0x46e8c7,_0x299110){return new Promise(function(_0x4a88fd,_0x3b05ae){var _0x17ce2d=_0x46e8c7['filter']?{[_0x46e8c7['filter'][_0x8589('0x6')]]:_0x46e8c7['filter']['value']}:undefined;return _0x3dd8a3[_0x46e8c7['model']][_0x8589('0xc')]({'where':_0x17ce2d,'raw':!![]})[_0x8589('0x8')](function(_0x102eb6){_0x299110[_0x8589('0x9')]=_['map'](_0x102eb6,function(_0x4c7e5b){return _0x4c7e5b[_0x8589('0xd')];});_0x4a88fd(_0x299110);})[_0x8589('0xb')](function(_0x225bfc){_0x3b05ae(_0x225bfc);});});}function _0x3cbf29(_0x5342ed,_0x35798f,_0x33dc39){if(!_0x35798f)return Promise['resolve'](null);return new Promise(function(_0x49938b,_0x761ea6){return _0x3dd8a3[_0x8589('0xe')]['findAll']({'where':{'sectionId':_0x35798f['id']},'raw':!![]})['then'](function(_0x4eae26){if(_0x5342ed['field']&&_0x5342ed['field']!=='id'){_0x35798f[_0x8589('0x9')]=_[_0x8589('0xa')](_0x4eae26,function(_0x9ebea4){return _0x9ebea4[_0x5342ed[_0x8589('0x6')]];});}else{if(_0x33dc39===_0x8589('0xf')){_0x35798f[_0x8589('0x9')]=_[_0x8589('0xa')](_0x4eae26,function(_0x1af2e6){return{'id':_0x1af2e6[_0x8589('0x10')],'type':_0x1af2e6[_0x8589('0x11')]};});}else{_0x35798f[_0x8589('0x9')]=_[_0x8589('0xa')](_0x4eae26,function(_0x3d3249){return _0x3d3249['resourceId'];});}}_0x49938b(_0x35798f);})[_0x8589('0xb')](function(_0x4710a9){_0x761ea6(_0x4710a9);});});}function _0x37f1df(_0x1df472,_0x5a6369){var _0x2d02c0={'parentSections':[]};switch(_0x1df472[_0x8589('0x12')]()){case _0x8589('0x13'):_0x2d02c0[_0x8589('0x14')]=_0x8589('0x15');break;case _0x8589('0x16'):_0x2d02c0['childModel']=_0x8589('0x17');break;case _0x8589('0x18'):_0x2d02c0['childModel']='SquareRecording';_0x2d02c0['parentSections']=[{'name':'SquareProjects','field':_0x8589('0xd'),'foreignKey':_0x8589('0x19')}];break;case _0x8589('0x1a'):_0x2d02c0[_0x8589('0x14')]='JscriptyProject';break;case'contacts':_0x2d02c0[_0x8589('0x14')]=_0x8589('0x1b');_0x2d02c0[_0x8589('0x1c')]=[{'name':_0x8589('0x1d'),'field':'id','foreignKey':_0x8589('0x1e')}];break;case'lists':_0x2d02c0['childModel']=_0x8589('0x1f');break;case _0x8589('0x20'):_0x2d02c0['childModel']='CmCompany';break;case _0x8589('0x21'):_0x2d02c0[_0x8589('0x14')]=_0x8589('0x22');break;case _0x8589('0x23'):_0x2d02c0['childModel']=_0x8589('0x24');break;case _0x8589('0x25'):_0x2d02c0[_0x8589('0x14')]=_0x8589('0x26');break;case _0x8589('0x27'):_0x2d02c0[_0x8589('0x14')]=_0x8589('0x28');break;case _0x8589('0x29'):_0x2d02c0['childModel']=_0x8589('0x2a');break;case'inboundroutes':case'internalroutes':case _0x8589('0x2b'):_0x2d02c0[_0x8589('0x14')]=_0x8589('0x2c');break;case'contexts':_0x2d02c0[_0x8589('0x14')]=_0x8589('0x2d');break;case _0x8589('0x2e'):_0x2d02c0[_0x8589('0x14')]=_0x8589('0x2f');break;case _0x8589('0x30'):_0x2d02c0[_0x8589('0x14')]='VoiceRecording';_0x2d02c0[_0x8589('0x1c')]=[{'name':'Agents','field':_0x8589('0xd'),'foreignKey':_0x8589('0x31'),'model':'User','filter':{'field':'role','value':[_0x8589('0x32')]}},{'name':'Telephones','field':'name','foreignKey':'membername','model':_0x8589('0x33'),'filter':{'field':_0x8589('0x34'),'value':[_0x8589('0x35')]}},{'name':'VoiceQueues','field':'name','foreignKey':_0x8589('0x36'),'model':'VoiceQueue','filter':{'field':_0x8589('0x11'),'value':['inbound']}},{'name':_0x8589('0x37'),'field':_0x8589('0xd'),'foreignKey':_0x8589('0x36'),'model':_0x8589('0x38'),'filter':{'field':_0x8589('0x11'),'value':['outbound']}}];break;case'musiconholds':_0x2d02c0['childModel']=_0x8589('0x39');break;case _0x8589('0x3a'):_0x2d02c0[_0x8589('0x14')]='VoiceChanSpy';break;case _0x8589('0x3b'):_0x2d02c0['childModel']=_0x8589('0x3c');break;case _0x8589('0x3d'):_0x2d02c0[_0x8589('0x14')]=_0x8589('0x3e');break;case _0x8589('0x3f'):_0x2d02c0[_0x8589('0x14')]=_0x8589('0x40');break;case'mailaccounts':_0x2d02c0['childModel']=_0x8589('0x41');break;case _0x8589('0x42'):_0x2d02c0[_0x8589('0x14')]=_0x8589('0x43');break;case _0x8589('0x44'):_0x2d02c0[_0x8589('0x14')]='OpenchannelQueue';break;case'openchannelaccounts':_0x2d02c0[_0x8589('0x14')]=_0x8589('0x45');break;case'smsqueues':_0x2d02c0[_0x8589('0x14')]='SmsQueue';break;case _0x8589('0x46'):_0x2d02c0[_0x8589('0x14')]=_0x8589('0x47');break;case _0x8589('0x48'):_0x2d02c0['childModel']=_0x8589('0x49');break;case'whatsappaccounts':_0x2d02c0['childModel']='WhatsappAccount';break;case _0x8589('0x4a'):_0x2d02c0[_0x8589('0x14')]=_0x8589('0x4b');break;case _0x8589('0x4c'):case _0x8589('0x4d'):_0x2d02c0[_0x8589('0x14')]=_0x8589('0x38');if(_0x5a6369){_0x2d02c0[_0x8589('0x1c')]=[{'name':_0x8589('0x4e')},{'name':_0x8589('0x37')}];}break;case'users':case _0x8589('0x4f'):case _0x8589('0x50'):_0x2d02c0[_0x8589('0x14')]='User';if(_0x5a6369){_0x2d02c0[_0x8589('0x1c')]=[{'name':_0x8589('0x51'),'filter':{'field':_0x8589('0x34'),'value':[_0x8589('0x52'),'user']},'ignore':!![]},{'name':'Agents'},{'name':'Telephones'}];}break;case _0x8589('0x53'):_0x2d02c0[_0x8589('0x14')]=_0x8589('0x54');break;case _0x8589('0x55'):_0x2d02c0[_0x8589('0x14')]=_0x8589('0x56');break;case'freshdeskaccounts':_0x2d02c0[_0x8589('0x14')]=_0x8589('0x57');break;case _0x8589('0x58'):_0x2d02c0[_0x8589('0x14')]=_0x8589('0x59');break;case _0x8589('0x5a'):_0x2d02c0[_0x8589('0x14')]=_0x8589('0x5b');break;case _0x8589('0x5c'):_0x2d02c0[_0x8589('0x14')]=_0x8589('0x5d');break;case _0x8589('0x5e'):_0x2d02c0['childModel']=_0x8589('0x33');break;case _0x8589('0x5f'):_0x2d02c0[_0x8589('0x14')]=_0x8589('0x60');break;case _0x8589('0x61'):_0x2d02c0['childModel']='Disposition';break;case _0x8589('0x62'):_0x2d02c0[_0x8589('0x14')]=_0x8589('0x63');break;case _0x8589('0x64'):_0x2d02c0['childModel']=_0x8589('0x65');break;case _0x8589('0x66'):_0x2d02c0[_0x8589('0x14')]='Pause';break;case _0x8589('0x67'):_0x2d02c0[_0x8589('0x14')]=_0x8589('0x68');break;case _0x8589('0x69'):_0x2d02c0['childModel']=_0x8589('0x6a');break;case _0x8589('0x6b'):_0x2d02c0[_0x8589('0x14')]=_0x8589('0x6c');break;case _0x8589('0x6d'):_0x2d02c0['childModel']='Template';break;case _0x8589('0x6e'):_0x2d02c0[_0x8589('0x14')]=_0x8589('0x6f');break;case _0x8589('0x70'):_0x2d02c0[_0x8589('0x14')]=_0x8589('0x71');break;case _0x8589('0x72'):_0x2d02c0[_0x8589('0x14')]='Variable';break;case'plugins':_0x2d02c0['childModel']=_0x8589('0x73');break;case _0x8589('0x74'):_0x2d02c0['childModel']=_0x8589('0xf');_0x2d02c0[_0x8589('0x1c')]=[{'name':_0x8589('0x75'),'field':'id','foreignKey':'reportId'}];break;case'metrics':_0x2d02c0[_0x8589('0x14')]='AnalyticMetric';break;}return _0x2d02c0;}function _0x21e236(_0x24c593,_0x4f0358){var _0x48a614=_0x24c593['charAt'](0x0)[_0x8589('0x76')]()+_0x24c593[_0x8589('0x77')](0x1);var _0x2cd76d={'type':_0x3dd8a3[_0x8589('0x78')]['QueryTypes'][_0x8589('0x79')],'raw':!![]};return new Promise(function(_0x2e5362,_0x5837ab){var _0x361c75=squel[_0x8589('0x7a')]()[_0x8589('0x6')](_0x8589('0x7b')+_0x48a614+_0x8589('0x7c'),'id')[_0x8589('0x6')](_0x8589('0x7d'))[_0x8589('0x7e')](_0x8589('0x7f')+_0x24c593+_0x8589('0x80'),'ui')[_0x8589('0x81')](_0x8589('0x82'),_0x4f0358['id']);return _0x3dd8a3[_0x8589('0x83')]['query'](_0x361c75[_0x8589('0x84')](),_0x2cd76d)[_0x8589('0x8')](function(_0x47d8c7){_0x4f0358[_0x48a614+_0x8589('0x85')]=_0x47d8c7;_0x2e5362(_0x47d8c7);})[_0x8589('0xb')](function(_0x28dd68){_0x5837ab(_0x28dd68);});});}return _0x4db772[_0x8589('0x86')]('UserProfile',attributes,{'tableName':_0x8589('0x87'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x3fb450){var _0x4f08c0={'raw':_0x3fb450['query'][_0x8589('0x88')],'where':{}};var _0x76a101={};var _0x2968c3={'count':0x0,'rows':[]};var _0xda50b9=_0x3fb450[_0x8589('0x89')][_0x8589('0x8a')];var _0x51ee29=_0x3fb450[_0x8589('0x89')][_0x8589('0x8b')]||![];var _0x2397b2=_0x37f1df(_0xda50b9,_0x51ee29);if(!_0x2397b2[_0x8589('0x14')])throw new Error(_0x8589('0x8c')+_0xda50b9+'\x27');var _0x5990f3=[{'name':_0xda50b9}];if(!_[_0x8589('0x8d')](_0x2397b2[_0x8589('0x1c')]))_0x5990f3=_0x2397b2[_0x8589('0x1c')];var _0x2f0dfc=[];for(var _0x3802c6=0x0;_0x3802c6<_0x5990f3[_0x8589('0x8e')];_0x3802c6++){_0x2f0dfc['push'](_0x3dd8a3[_0x8589('0x8f')]['find']({'where':{'userProfileId':_0x3fb450['params']['id'],'name':_0x5990f3[_0x3802c6][_0x8589('0xd')]},'raw':!![]}));}return Promise[_0x8589('0x90')](_0x2f0dfc)[_0x8589('0x8')](function(_0x3125d3){var _0x1e8059=_[_0x8589('0x5')](_0x3125d3,function(_0x35d514){return _0x35d514?_0x35d514:undefined;});var _0x57a30e=_[_0x8589('0x5')](_0x5990f3,[_0x8589('0x91'),!![]]);var _0x266801=_[_0x8589('0x8d')](_0x1e8059)&&_[_0x8589('0x8d')](_0x57a30e)?null:_[_0x8589('0x92')](_0x57a30e,_0x1e8059);if(!_0x266801)return null;var _0x1e31cd=[];for(var _0x364f8d=0x0;_0x364f8d<_0x266801[_0x8589('0x8e')];_0x364f8d++){var _0x48b97b=_[_0x8589('0x93')](_0x5990f3,function(_0x62db1a){return _0x266801[_0x364f8d]?_0x62db1a['name']===_0x266801[_0x364f8d][_0x8589('0xd')]:null;});if(_0x48b97b){if(_0x266801[_0x364f8d][_0x8589('0x91')]){_0x1e31cd[_0x8589('0x94')](_0x4f14d8(_0x2397b2[_0x8589('0x14')],_0x266801[_0x364f8d]));}else{if(!_0x266801[_0x364f8d][_0x8589('0x95')]){_0x1e31cd[_0x8589('0x94')](_0x3cbf29(_0x48b97b,_0x266801[_0x364f8d],_0x2397b2[_0x8589('0x14')]));}else{if(_0x48b97b['model']){_0x1e31cd[_0x8589('0x94')](_0x220c66(_0x48b97b,_0x266801[_0x364f8d]));}}}}}return Promise[_0x8589('0x90')](_0x1e31cd);})[_0x8589('0x8')](function(_0x3adbb0){var _0x28d389=_0x3adbb0;var _0xfc56b4=null;if(_0x28d389){_0xfc56b4=_0x28d389[_0x8589('0x8e')]===0x1?_0x28d389[0x0]:null;}if(!_0xfc56b4&&!_0x28d389)return _0x2968c3;var _0x196ee9=_0x3dd8a3[_0x2397b2['childModel']][_0x8589('0x96')];_0x76a101[_0x8589('0x97')]=_['keys'](_0x196ee9);_0x76a101[_0x8589('0x89')]=_['keys'](_0x3fb450[_0x8589('0x89')]);_0x76a101[_0x8589('0x98')]=_[_0x8589('0x99')](_0x76a101[_0x8589('0x97')],_0x76a101[_0x8589('0x89')]);_0x4f08c0[_0x8589('0x9a')]=_[_0x8589('0x99')](_0x76a101[_0x8589('0x97')],qs['fields'](_0x3fb450['query'][_0x8589('0x9b')]));_0x4f08c0['attributes']=_0x4f08c0[_0x8589('0x9a')][_0x8589('0x8e')]?_0x4f08c0[_0x8589('0x9a')]:_0x76a101[_0x8589('0x97')];if(!_0x3fb450[_0x8589('0x89')][_0x8589('0x9c')]('nolimit')){_0x4f08c0[_0x8589('0x9d')]=qs[_0x8589('0x9d')](_0x3fb450[_0x8589('0x89')][_0x8589('0x9d')]);_0x4f08c0[_0x8589('0x9e')]=qs[_0x8589('0x9e')](_0x3fb450[_0x8589('0x89')][_0x8589('0x9e')]);}_0x4f08c0[_0x8589('0x9f')]=qs[_0x8589('0xa0')](_0x3fb450[_0x8589('0x89')][_0x8589('0xa0')]);_0x4f08c0['where']=qs[_0x8589('0x98')](_[_0x8589('0xa1')](_0x3fb450['query'],_0x76a101[_0x8589('0x98')]));if(_0x3fb450[_0x8589('0x89')][_0x8589('0x5')]){_0x4f08c0[_0x8589('0x81')]=_['merge'](_0x4f08c0[_0x8589('0x81')],{'$or':_[_0x8589('0xa')](_0x196ee9,function(_0x4acadb){if(_0x4acadb[_0x8589('0x11')][_0x8589('0xa2')]!=='VIRTUAL'){var _0xd6e866={};_0xd6e866[_0x4acadb[_0x8589('0x6')]]={'$like':'%'+_0x3fb450[_0x8589('0x89')][_0x8589('0x5')]+'%'};return _0xd6e866;}})});}var _0x36226e=[];var _0x39c911=null;var _0x154558={};if(_0xfc56b4){_0x39c911=_[_0x8589('0x93')](_0x5990f3,[_0x8589('0xd'),_0xfc56b4[_0x8589('0xd')]]);if(_0x39c911[_0x8589('0x6')]){_0x154558={};if(_0x2397b2[_0x8589('0x14')]==='AnalyticExtractedReport'){_0x154558[_0x39c911['foreignKey']]=_[_0x8589('0xa')](_0xfc56b4[_0x8589('0x9')],'id');}else{_0x154558[_0x39c911[_0x8589('0xa3')]]=_0xfc56b4[_0x8589('0x9')];}_0x36226e[_0x8589('0x94')](_0x154558);}else{_0x4f08c0[_0x8589('0x81')]['id']=_0xfc56b4[_0x8589('0x9')];}}else{for(var _0x43d4ab=0x0;_0x43d4ab<_0x28d389['length'];_0x43d4ab++){_0x39c911=_[_0x8589('0x93')](_0x5990f3,[_0x8589('0xd'),_0x28d389[_0x43d4ab][_0x8589('0xd')]]);if(_0x39c911[_0x8589('0x6')]){_0x154558={};_0x154558[_0x39c911[_0x8589('0xa3')]]=_0x28d389[_0x43d4ab]['associatedResources'];_0x36226e[_0x8589('0x94')](_0x154558);}else{if(!_0x4f08c0[_0x8589('0x81')]['id'])_0x4f08c0[_0x8589('0x81')]['id']=[];_0x28d389[_0x43d4ab][_0x8589('0x9')][_0x8589('0xa4')](function(_0x8c70c0){_0x4f08c0[_0x8589('0x81')]['id'][_0x8589('0x94')](_0x8c70c0);});}}}if(!_[_0x8589('0x8d')](_0x36226e)){_0x4f08c0[_0x8589('0x81')]=_[_0x8589('0xa5')](_0x4f08c0[_0x8589('0x81')],{'$and':{'$or':_0x36226e}});}_0x4f08c0=_['merge']({},_0x4f08c0,_0x3fb450[_0x8589('0xa6')]);if(_0xfc56b4&&!_0xfc56b4[_0x8589('0x95')]&&_0x2397b2[_0x8589('0x14')]===_0x8589('0xf')){if(_0x3fb450['query'][_0x8589('0xa7')]){_0x4f08c0[_0x8589('0xa8')]=[{'all':!![]}];}return _0x3dd8a3[_0x2397b2[_0x8589('0x14')]]['findAll'](_0x4f08c0)['then'](function(_0x48356b){var _0x42f730=[];_0x48356b[_0x8589('0xa4')](function(_0x4894fc){var _0x38e7d5;switch(_0x4894fc[_0x8589('0xa9')]){case _0x8589('0xaa'):_0x38e7d5=_[_0x8589('0x93')](_0xfc56b4[_0x8589('0x9')],function(_0x3c6144){return _0x3c6144['id']===_0x4894fc['reportId']&&_0x3c6144[_0x8589('0x11')]==='DefaultReports';});break;case _0x8589('0xab'):_0x38e7d5=_[_0x8589('0x93')](_0xfc56b4[_0x8589('0x9')],function(_0x2515d1){return _0x2515d1['id']===_0x4894fc['reportId']&&_0x2515d1[_0x8589('0x11')]==='CustomReports';});break;}if(_0x38e7d5)_0x42f730[_0x8589('0x94')](_0x4894fc);});_0x2968c3[_0x8589('0xac')]=_0x42f730[_0x8589('0x8e')];_0x2968c3[_0x8589('0xad')]=_0x42f730;return _0x2968c3;});}else{if(!_[_0x8589('0x8d')](_0x3fb450[_0x8589('0x89')][_0x8589('0xae')])){_0x4f08c0[_0x8589('0x81')]['id']=_0x4f08c0[_0x8589('0x81')]['id']?_[_0x8589('0x99')](_0x4f08c0[_0x8589('0x81')]['id'],_0x3fb450['query'][_0x8589('0xae')]):_0x3fb450[_0x8589('0x89')][_0x8589('0xae')];if(_0x3fb450[_0x8589('0x89')][_0x8589('0xaf')]){_0x4f08c0[_0x8589('0x9f')]=_0x3fb450[_0x8589('0x89')][_0x8589('0xaf')];}}if(_0x3fb450[_0x8589('0x89')]['extraQueryConditions']){_0x4f08c0[_0x8589('0x81')]=_[_0x8589('0xa5')](_0x4f08c0[_0x8589('0x81')],{'$and':_0x3fb450[_0x8589('0x89')][_0x8589('0xb0')]});}return _0x3dd8a3[_0x2397b2['childModel']][_0x8589('0xac')]({'where':_0x4f08c0[_0x8589('0x81')]})['then'](function(_0x173200){_0x2968c3[_0x8589('0xac')]=_0x173200;if(_0x3fb450[_0x8589('0x89')][_0x8589('0xa7')]){if(_0x2397b2[_0x8589('0x14')]===_0x8589('0x1b')){_0x4f08c0['include']=[{'model':_0x3dd8a3['Tag'],'as':'Tags','attributes':['id',_0x8589('0xd'),_0x8589('0xb1')],'required':_0x3fb450['query'][_0x8589('0xb2')]?!![]:![]},{'model':_0x3dd8a3['Tag'],'as':_0x8589('0xb3'),'attributes':['id',_0x8589('0xd'),_0x8589('0xb1')],'through':_0x3fb450[_0x8589('0x89')][_0x8589('0xb2')]?{'attributes':[],'where':{'TagId':_0x3fb450[_0x8589('0x89')][_0x8589('0xb2')]||undefined}}:{},'required':_0x3fb450[_0x8589('0x89')][_0x8589('0xb2')]?!![]:![]}];}else{_0x4f08c0[_0x8589('0xa8')]=[{'all':!![]}];}}return _0x3dd8a3[_0x2397b2[_0x8589('0x14')]][_0x8589('0xc')](_0x4f08c0);})[_0x8589('0x8')](function(_0x43f773){_0x2968c3['rows']=_0x43f773;if(_0xda50b9===_0x8589('0xb4')&&_0x3fb450[_0x8589('0x89')]['openTabs']===_0x8589('0xb5')){var _0x3594a2=[];for(var _0x57ffdb=0x0;_0x57ffdb<_0x2968c3[_0x8589('0xad')][_0x8589('0x8e')];_0x57ffdb++){_0x3594a2[_0x8589('0x94')](_0x21e236(_0x8589('0xb6'),_0x2968c3['rows'][_0x57ffdb][_0x8589('0xb7')]));_0x3594a2[_0x8589('0x94')](_0x21e236('sms',_0x2968c3[_0x8589('0xad')][_0x57ffdb][_0x8589('0xb7')]));_0x3594a2['push'](_0x21e236(_0x8589('0xb8'),_0x2968c3[_0x8589('0xad')][_0x57ffdb]['dataValues']));_0x3594a2[_0x8589('0x94')](_0x21e236(_0x8589('0xb9'),_0x2968c3[_0x8589('0xad')][_0x57ffdb][_0x8589('0xb7')]));_0x3594a2['push'](_0x21e236(_0x8589('0xba'),_0x2968c3[_0x8589('0xad')][_0x57ffdb][_0x8589('0xb7')]));_0x3594a2[_0x8589('0x94')](_0x21e236(_0x8589('0xbb'),_0x2968c3[_0x8589('0xad')][_0x57ffdb][_0x8589('0xb7')]));}return Promise[_0x8589('0x90')](_0x3594a2)[_0x8589('0x8')](function(){return _0x2968c3;});}return _0x2968c3;});}});}}});}; \ No newline at end of file +var _0x66f4=['ChatQueue','chatwebsites','ChatWebsite','FaxQueue','faxaccounts','FaxAccount','inboundroutes','internalroutes','outboundroutes','VoiceExtension','contexts','VoiceContext','voicemails','VoiceMail','voicerecordings','User','role','agent','Telephones','telephone','VoiceQueues','queue','type','QueueCampaigns','VoiceQueue','outbound','musiconholds','VoiceMusicOnHold','voiceprefixes','VoicePrefix','ivrcampaigns','Campaign','mailqueues','mailaccounts','MailAccount','mailsubstatuses','MailSubstatus','OpenchannelQueue','OpenchannelAccount','smsqueues','smsaccounts','SmsAccount','whatsappqueues','WhatsappQueue','whatsappaccounts','WhatsappAccount','teams','voicequeues','queuecampaigns','agents','admin','user','Agents','zendeskaccounts','ZendeskAccount','freshdeskaccounts','sugarcrmaccounts','deskaccounts','DeskAccount','zohoaccounts','ZohoAccount','CannedAnswer','dispositions','Disposition','customdashboards','intervals','Interval','pauses','Pause','Schedule','sounds','Sound','tags','Tag','templates','Template','Trigger','trunks','variables','Variable','plugins','Plugin','extractedreports','Reports','reportId','metrics','AnalyticMetric','charAt','toUpperCase','slice','QueryTypes','SELECT','select','InteractionId','from','user_has_','_interactions','where','ui.UserId\x20=\x20?','sequelize','toString','then','OpenTabs','UserProfile','user_profiles','query','raw','section','mergeResources','Invalid\x20section\x20\x27','isEmpty','length','push','UserProfileSection','find','params','all','ignore','union','autoAssociation','rawAttributes','keys','attributes','intersection','fields','hasOwnProperty','nolimit','limit','offset','order','sort','filters','pick','merge','foreignKey','forEach','options','includeAll','include','reportType','default','DefaultReports','custom','CustomReports','rows','ids','extraQueryConditions','count','Tags','color','tag','ThroughTags','chat','sms','dataValues','whatsapp','lodash','./userProfile.attributes','../../components/parsers/qs','squel','models','filter','field','findAll','associatedResources','map','catch','model','name','resolve','UserProfileResource','AnalyticExtractedReport','resourceId','toLowerCase','SquareProject','odbc','childModel','SquareOdbc','squarerecordings','SquareRecording','parentSections','SquareProjects','projectName','projects','CmContact','ListId','lists','CmCompany','globalcustomfields','CmCustomField','chatqueues'];(function(_0x35c12c,_0x378ba0){var _0x2bab3a=function(_0x43eeb2){while(--_0x43eeb2){_0x35c12c['push'](_0x35c12c['shift']());}};_0x2bab3a(++_0x378ba0);}(_0x66f4,0x15b));var _0x466f=function(_0x5d0ae4,_0x47931a){_0x5d0ae4=_0x5d0ae4-0x0;var _0x335917=_0x66f4[_0x5d0ae4];return _0x335917;};'use strict';var _=require(_0x466f('0x0'));var attributes=require(_0x466f('0x1'));var qs=require(_0x466f('0x2'));var squel=require(_0x466f('0x3'));module['exports']=function(_0x544e45){var _0x3c9487=_0x544e45[_0x466f('0x4')];function _0xc5fe52(_0x1c88ba,_0x22c7cb){return new Promise(function(_0x327676,_0x407aef){if(!_0x22c7cb)return _0x327676(null);var _0x2b5bb6=_0x22c7cb[_0x466f('0x5')]?{[_0x22c7cb[_0x466f('0x5')][_0x466f('0x6')]]:_0x22c7cb[_0x466f('0x5')]['value']}:undefined;return _0x3c9487[_0x1c88ba][_0x466f('0x7')]({'where':_0x2b5bb6,'raw':!![]})['then'](function(_0x33a04c){_0x22c7cb[_0x466f('0x8')]=_[_0x466f('0x9')](_0x33a04c,'id');_0x327676(_0x22c7cb);})[_0x466f('0xa')](function(_0x18465c){_0x407aef(_0x18465c);});});}function _0x3910b4(_0x4c333d,_0x5742db){return new Promise(function(_0x277ca0,_0x1c1ffb){var _0x19f185=_0x4c333d[_0x466f('0x5')]?{[_0x4c333d[_0x466f('0x5')][_0x466f('0x6')]]:_0x4c333d[_0x466f('0x5')]['value']}:undefined;return _0x3c9487[_0x4c333d[_0x466f('0xb')]][_0x466f('0x7')]({'where':_0x19f185,'raw':!![]})['then'](function(_0x5e1fb1){_0x5742db[_0x466f('0x8')]=_[_0x466f('0x9')](_0x5e1fb1,function(_0x2ca31a){return _0x2ca31a[_0x466f('0xc')];});_0x277ca0(_0x5742db);})[_0x466f('0xa')](function(_0x383995){_0x1c1ffb(_0x383995);});});}function _0x369d0b(_0x8e7beb,_0x356056,_0x172d7a){if(!_0x356056)return Promise[_0x466f('0xd')](null);return new Promise(function(_0x35dcbe,_0x162998){return _0x3c9487[_0x466f('0xe')][_0x466f('0x7')]({'where':{'sectionId':_0x356056['id']},'raw':!![]})['then'](function(_0x22d917){if(_0x8e7beb[_0x466f('0x6')]&&_0x8e7beb[_0x466f('0x6')]!=='id'){_0x356056['associatedResources']=_['map'](_0x22d917,function(_0x35f302){return _0x35f302[_0x8e7beb[_0x466f('0x6')]];});}else{if(_0x172d7a===_0x466f('0xf')){_0x356056[_0x466f('0x8')]=_[_0x466f('0x9')](_0x22d917,function(_0x1ed983){return{'id':_0x1ed983['resourceId'],'type':_0x1ed983['type']};});}else{_0x356056[_0x466f('0x8')]=_['map'](_0x22d917,function(_0x92b135){return _0x92b135[_0x466f('0x10')];});}}_0x35dcbe(_0x356056);})[_0x466f('0xa')](function(_0x5bdc69){_0x162998(_0x5bdc69);});});}function _0x20bb73(_0x8ac0a2,_0x3e1b0a){var _0x1c846f={'parentSections':[]};switch(_0x8ac0a2[_0x466f('0x11')]()){case'squareprojects':_0x1c846f['childModel']=_0x466f('0x12');break;case _0x466f('0x13'):_0x1c846f[_0x466f('0x14')]=_0x466f('0x15');break;case _0x466f('0x16'):_0x1c846f[_0x466f('0x14')]=_0x466f('0x17');_0x1c846f[_0x466f('0x18')]=[{'name':_0x466f('0x19'),'field':_0x466f('0xc'),'foreignKey':_0x466f('0x1a')}];break;case _0x466f('0x1b'):_0x1c846f[_0x466f('0x14')]='JscriptyProject';break;case'contacts':_0x1c846f[_0x466f('0x14')]=_0x466f('0x1c');_0x1c846f[_0x466f('0x18')]=[{'name':'Lists','field':'id','foreignKey':_0x466f('0x1d')}];break;case _0x466f('0x1e'):_0x1c846f[_0x466f('0x14')]='CmList';break;case'companies':_0x1c846f[_0x466f('0x14')]=_0x466f('0x1f');break;case _0x466f('0x20'):_0x1c846f[_0x466f('0x14')]=_0x466f('0x21');break;case _0x466f('0x22'):_0x1c846f[_0x466f('0x14')]=_0x466f('0x23');break;case _0x466f('0x24'):_0x1c846f[_0x466f('0x14')]=_0x466f('0x25');break;case'faxqueues':_0x1c846f['childModel']=_0x466f('0x26');break;case _0x466f('0x27'):_0x1c846f[_0x466f('0x14')]=_0x466f('0x28');break;case _0x466f('0x29'):case _0x466f('0x2a'):case _0x466f('0x2b'):_0x1c846f[_0x466f('0x14')]=_0x466f('0x2c');break;case _0x466f('0x2d'):_0x1c846f['childModel']=_0x466f('0x2e');break;case _0x466f('0x2f'):_0x1c846f[_0x466f('0x14')]=_0x466f('0x30');break;case _0x466f('0x31'):_0x1c846f[_0x466f('0x14')]='VoiceRecording';_0x1c846f[_0x466f('0x18')]=[{'name':'Agents','field':_0x466f('0xc'),'foreignKey':'membername','model':_0x466f('0x32'),'filter':{'field':_0x466f('0x33'),'value':[_0x466f('0x34')]}},{'name':_0x466f('0x35'),'field':_0x466f('0xc'),'foreignKey':'membername','model':_0x466f('0x32'),'filter':{'field':_0x466f('0x33'),'value':[_0x466f('0x36')]}},{'name':_0x466f('0x37'),'field':_0x466f('0xc'),'foreignKey':_0x466f('0x38'),'model':'VoiceQueue','filter':{'field':_0x466f('0x39'),'value':['inbound']}},{'name':_0x466f('0x3a'),'field':_0x466f('0xc'),'foreignKey':_0x466f('0x38'),'model':_0x466f('0x3b'),'filter':{'field':_0x466f('0x39'),'value':[_0x466f('0x3c')]}}];break;case _0x466f('0x3d'):_0x1c846f['childModel']=_0x466f('0x3e');break;case'chanspies':_0x1c846f['childModel']='VoiceChanSpy';break;case _0x466f('0x3f'):_0x1c846f[_0x466f('0x14')]=_0x466f('0x40');break;case _0x466f('0x41'):_0x1c846f[_0x466f('0x14')]=_0x466f('0x42');break;case _0x466f('0x43'):_0x1c846f[_0x466f('0x14')]='MailQueue';break;case _0x466f('0x44'):_0x1c846f[_0x466f('0x14')]=_0x466f('0x45');break;case _0x466f('0x46'):_0x1c846f[_0x466f('0x14')]=_0x466f('0x47');break;case'openchannelqueues':_0x1c846f[_0x466f('0x14')]=_0x466f('0x48');break;case'openchannelaccounts':_0x1c846f[_0x466f('0x14')]=_0x466f('0x49');break;case _0x466f('0x4a'):_0x1c846f[_0x466f('0x14')]='SmsQueue';break;case _0x466f('0x4b'):_0x1c846f[_0x466f('0x14')]=_0x466f('0x4c');break;case _0x466f('0x4d'):_0x1c846f['childModel']=_0x466f('0x4e');break;case _0x466f('0x4f'):_0x1c846f[_0x466f('0x14')]=_0x466f('0x50');break;case _0x466f('0x51'):_0x1c846f[_0x466f('0x14')]='Team';break;case _0x466f('0x52'):case _0x466f('0x53'):_0x1c846f[_0x466f('0x14')]=_0x466f('0x3b');if(_0x3e1b0a){_0x1c846f['parentSections']=[{'name':_0x466f('0x37')},{'name':_0x466f('0x3a')}];}break;case'users':case _0x466f('0x54'):case'telephones':_0x1c846f[_0x466f('0x14')]=_0x466f('0x32');if(_0x3e1b0a){_0x1c846f[_0x466f('0x18')]=[{'name':'Users','filter':{'field':'role','value':[_0x466f('0x55'),_0x466f('0x56')]},'ignore':!![]},{'name':_0x466f('0x57')},{'name':_0x466f('0x35')}];}break;case _0x466f('0x58'):_0x1c846f[_0x466f('0x14')]=_0x466f('0x59');break;case'salesforceaccounts':_0x1c846f['childModel']='SalesforceAccount';break;case _0x466f('0x5a'):_0x1c846f[_0x466f('0x14')]='FreshdeskAccount';break;case _0x466f('0x5b'):_0x1c846f['childModel']='SugarcrmAccount';break;case _0x466f('0x5c'):_0x1c846f[_0x466f('0x14')]=_0x466f('0x5d');break;case _0x466f('0x5e'):_0x1c846f[_0x466f('0x14')]=_0x466f('0x5f');break;case'vtigeraccounts':_0x1c846f[_0x466f('0x14')]='User';break;case'cannedanswers':_0x1c846f[_0x466f('0x14')]=_0x466f('0x60');break;case _0x466f('0x61'):_0x1c846f['childModel']=_0x466f('0x62');break;case _0x466f('0x63'):_0x1c846f[_0x466f('0x14')]='Dashboard';break;case _0x466f('0x64'):_0x1c846f[_0x466f('0x14')]=_0x466f('0x65');break;case _0x466f('0x66'):_0x1c846f[_0x466f('0x14')]=_0x466f('0x67');break;case'scheduler':_0x1c846f[_0x466f('0x14')]=_0x466f('0x68');break;case _0x466f('0x69'):_0x1c846f[_0x466f('0x14')]=_0x466f('0x6a');break;case _0x466f('0x6b'):_0x1c846f['childModel']=_0x466f('0x6c');break;case _0x466f('0x6d'):_0x1c846f['childModel']=_0x466f('0x6e');break;case'triggers':_0x1c846f['childModel']=_0x466f('0x6f');break;case _0x466f('0x70'):_0x1c846f[_0x466f('0x14')]='Trunk';break;case _0x466f('0x71'):_0x1c846f[_0x466f('0x14')]=_0x466f('0x72');break;case _0x466f('0x73'):_0x1c846f[_0x466f('0x14')]=_0x466f('0x74');break;case _0x466f('0x75'):_0x1c846f[_0x466f('0x14')]=_0x466f('0xf');_0x1c846f['parentSections']=[{'name':_0x466f('0x76'),'field':'id','foreignKey':_0x466f('0x77')}];break;case _0x466f('0x78'):_0x1c846f[_0x466f('0x14')]=_0x466f('0x79');break;}return _0x1c846f;}function _0x470f61(_0x29ea51,_0x1488a1){var _0xc0a020=_0x29ea51[_0x466f('0x7a')](0x0)[_0x466f('0x7b')]()+_0x29ea51[_0x466f('0x7c')](0x1);var _0x48ad06={'type':_0x3c9487['Sequelize'][_0x466f('0x7d')][_0x466f('0x7e')],'raw':!![]};return new Promise(function(_0x3d1439,_0x1ec2d1){var _0xc001d7=squel[_0x466f('0x7f')]()[_0x466f('0x6')]('ui.'+_0xc0a020+_0x466f('0x80'),'id')[_0x466f('0x6')]('ui.createdAt')[_0x466f('0x81')](_0x466f('0x82')+_0x29ea51+_0x466f('0x83'),'ui')[_0x466f('0x84')](_0x466f('0x85'),_0x1488a1['id']);return _0x3c9487[_0x466f('0x86')]['query'](_0xc001d7[_0x466f('0x87')](),_0x48ad06)[_0x466f('0x88')](function(_0xc1e53f){_0x1488a1[_0xc0a020+_0x466f('0x89')]=_0xc1e53f;_0x3d1439(_0xc1e53f);})[_0x466f('0xa')](function(_0x1263b0){_0x1ec2d1(_0x1263b0);});});}return _0x544e45['define'](_0x466f('0x8a'),attributes,{'tableName':_0x466f('0x8b'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x1e1a90){var _0x4b6779={'raw':_0x1e1a90[_0x466f('0x8c')][_0x466f('0x8d')],'where':{}};var _0x510ed5={};var _0x415d7c={'count':0x0,'rows':[]};var _0x59028b=_0x1e1a90['query'][_0x466f('0x8e')];var _0x18712e=_0x1e1a90['query'][_0x466f('0x8f')]||![];var _0x30580c=_0x20bb73(_0x59028b,_0x18712e);if(!_0x30580c['childModel'])throw new Error(_0x466f('0x90')+_0x59028b+'\x27');var _0x453b59=[{'name':_0x59028b}];if(!_[_0x466f('0x91')](_0x30580c[_0x466f('0x18')]))_0x453b59=_0x30580c[_0x466f('0x18')];var _0x397cb7=[];for(var _0x997352=0x0;_0x997352<_0x453b59[_0x466f('0x92')];_0x997352++){_0x397cb7[_0x466f('0x93')](_0x3c9487[_0x466f('0x94')][_0x466f('0x95')]({'where':{'userProfileId':_0x1e1a90[_0x466f('0x96')]['id'],'name':_0x453b59[_0x997352][_0x466f('0xc')]},'raw':!![]}));}return Promise[_0x466f('0x97')](_0x397cb7)[_0x466f('0x88')](function(_0x4b8133){var _0x547689=_[_0x466f('0x5')](_0x4b8133,function(_0x3bf78f){return _0x3bf78f?_0x3bf78f:undefined;});var _0x3b045a=_[_0x466f('0x5')](_0x453b59,[_0x466f('0x98'),!![]]);var _0x3e7b0a=_[_0x466f('0x91')](_0x547689)&&_[_0x466f('0x91')](_0x3b045a)?null:_[_0x466f('0x99')](_0x3b045a,_0x547689);if(!_0x3e7b0a)return null;var _0x33b1f4=[];for(var _0x12ff14=0x0;_0x12ff14<_0x3e7b0a['length'];_0x12ff14++){var _0x5b6d78=_[_0x466f('0x95')](_0x453b59,function(_0x3f8518){return _0x3e7b0a[_0x12ff14]?_0x3f8518[_0x466f('0xc')]===_0x3e7b0a[_0x12ff14][_0x466f('0xc')]:null;});if(_0x5b6d78){if(_0x3e7b0a[_0x12ff14]['ignore']){_0x33b1f4[_0x466f('0x93')](_0xc5fe52(_0x30580c[_0x466f('0x14')],_0x3e7b0a[_0x12ff14]));}else{if(!_0x3e7b0a[_0x12ff14][_0x466f('0x9a')]){_0x33b1f4[_0x466f('0x93')](_0x369d0b(_0x5b6d78,_0x3e7b0a[_0x12ff14],_0x30580c[_0x466f('0x14')]));}else{if(_0x5b6d78[_0x466f('0xb')]){_0x33b1f4[_0x466f('0x93')](_0x3910b4(_0x5b6d78,_0x3e7b0a[_0x12ff14]));}}}}}return Promise['all'](_0x33b1f4);})[_0x466f('0x88')](function(_0x17291f){var _0x59edc3=_0x17291f;var _0x384d25=null;if(_0x59edc3){_0x384d25=_0x59edc3[_0x466f('0x92')]===0x1?_0x59edc3[0x0]:null;}if(!_0x384d25&&!_0x59edc3)return _0x415d7c;var _0x3b022b=_0x3c9487[_0x30580c[_0x466f('0x14')]][_0x466f('0x9b')];_0x510ed5['model']=_[_0x466f('0x9c')](_0x3b022b);_0x510ed5[_0x466f('0x8c')]=_[_0x466f('0x9c')](_0x1e1a90[_0x466f('0x8c')]);_0x510ed5['filters']=_['intersection'](_0x510ed5[_0x466f('0xb')],_0x510ed5['query']);_0x4b6779[_0x466f('0x9d')]=_[_0x466f('0x9e')](_0x510ed5[_0x466f('0xb')],qs[_0x466f('0x9f')](_0x1e1a90[_0x466f('0x8c')][_0x466f('0x9f')]));_0x4b6779[_0x466f('0x9d')]=_0x4b6779[_0x466f('0x9d')][_0x466f('0x92')]?_0x4b6779[_0x466f('0x9d')]:_0x510ed5[_0x466f('0xb')];if(!_0x1e1a90['query'][_0x466f('0xa0')](_0x466f('0xa1'))){_0x4b6779[_0x466f('0xa2')]=qs[_0x466f('0xa2')](_0x1e1a90[_0x466f('0x8c')][_0x466f('0xa2')]);_0x4b6779['offset']=qs[_0x466f('0xa3')](_0x1e1a90['query'][_0x466f('0xa3')]);}_0x4b6779[_0x466f('0xa4')]=qs[_0x466f('0xa5')](_0x1e1a90[_0x466f('0x8c')][_0x466f('0xa5')]);_0x4b6779['where']=qs[_0x466f('0xa6')](_[_0x466f('0xa7')](_0x1e1a90[_0x466f('0x8c')],_0x510ed5[_0x466f('0xa6')]));if(_0x1e1a90['query'][_0x466f('0x5')]){_0x4b6779[_0x466f('0x84')]=_[_0x466f('0xa8')](_0x4b6779[_0x466f('0x84')],{'$or':_[_0x466f('0x9')](_0x3b022b,function(_0x21c284){if(_0x21c284[_0x466f('0x39')]['key']!=='VIRTUAL'){var _0x465e98={};_0x465e98[_0x21c284['field']]={'$like':'%'+_0x1e1a90['query'][_0x466f('0x5')]+'%'};return _0x465e98;}})});}var _0x3c21ea=[];var _0x18e942=null;var _0x515716={};if(_0x384d25){_0x18e942=_['find'](_0x453b59,[_0x466f('0xc'),_0x384d25[_0x466f('0xc')]]);if(_0x18e942[_0x466f('0x6')]){_0x515716={};if(_0x30580c[_0x466f('0x14')]===_0x466f('0xf')){_0x515716[_0x18e942[_0x466f('0xa9')]]=_[_0x466f('0x9')](_0x384d25[_0x466f('0x8')],'id');}else{_0x515716[_0x18e942[_0x466f('0xa9')]]=_0x384d25[_0x466f('0x8')];}_0x3c21ea[_0x466f('0x93')](_0x515716);}else{_0x4b6779[_0x466f('0x84')]['id']=_0x384d25[_0x466f('0x8')];}}else{for(var _0xf4f753=0x0;_0xf4f753<_0x59edc3[_0x466f('0x92')];_0xf4f753++){_0x18e942=_[_0x466f('0x95')](_0x453b59,['name',_0x59edc3[_0xf4f753][_0x466f('0xc')]]);if(_0x18e942[_0x466f('0x6')]){_0x515716={};_0x515716[_0x18e942[_0x466f('0xa9')]]=_0x59edc3[_0xf4f753][_0x466f('0x8')];_0x3c21ea[_0x466f('0x93')](_0x515716);}else{if(!_0x4b6779[_0x466f('0x84')]['id'])_0x4b6779[_0x466f('0x84')]['id']=[];_0x59edc3[_0xf4f753]['associatedResources'][_0x466f('0xaa')](function(_0x728af9){_0x4b6779[_0x466f('0x84')]['id'][_0x466f('0x93')](_0x728af9);});}}}if(!_[_0x466f('0x91')](_0x3c21ea)){_0x4b6779[_0x466f('0x84')]=_[_0x466f('0xa8')](_0x4b6779[_0x466f('0x84')],{'$and':{'$or':_0x3c21ea}});}_0x4b6779=_[_0x466f('0xa8')]({},_0x4b6779,_0x1e1a90[_0x466f('0xab')]);if(_0x384d25&&!_0x384d25[_0x466f('0x9a')]&&_0x30580c['childModel']===_0x466f('0xf')){if(_0x1e1a90[_0x466f('0x8c')][_0x466f('0xac')]){_0x4b6779[_0x466f('0xad')]=[{'all':!![]}];}return _0x3c9487[_0x30580c[_0x466f('0x14')]][_0x466f('0x7')](_0x4b6779)['then'](function(_0x1269c4){var _0x4d5929=[];_0x1269c4[_0x466f('0xaa')](function(_0x454413){var _0x53020b;switch(_0x454413[_0x466f('0xae')]){case _0x466f('0xaf'):_0x53020b=_[_0x466f('0x95')](_0x384d25['associatedResources'],function(_0x408ceb){return _0x408ceb['id']===_0x454413[_0x466f('0x77')]&&_0x408ceb[_0x466f('0x39')]===_0x466f('0xb0');});break;case _0x466f('0xb1'):_0x53020b=_[_0x466f('0x95')](_0x384d25[_0x466f('0x8')],function(_0x25cb6a){return _0x25cb6a['id']===_0x454413[_0x466f('0x77')]&&_0x25cb6a[_0x466f('0x39')]===_0x466f('0xb2');});break;}if(_0x53020b)_0x4d5929[_0x466f('0x93')](_0x454413);});_0x415d7c['count']=_0x4d5929[_0x466f('0x92')];_0x415d7c[_0x466f('0xb3')]=_0x4d5929;return _0x415d7c;});}else{if(!_[_0x466f('0x91')](_0x1e1a90['query'][_0x466f('0xb4')])){_0x4b6779[_0x466f('0x84')]['id']=_0x4b6779[_0x466f('0x84')]['id']?_[_0x466f('0x9e')](_0x4b6779['where']['id'],_0x1e1a90[_0x466f('0x8c')]['ids']):_0x1e1a90[_0x466f('0x8c')]['ids'];if(_0x1e1a90[_0x466f('0x8c')]['customSorting']){_0x4b6779['order']=_0x1e1a90[_0x466f('0x8c')]['customSorting'];}}if(_0x1e1a90[_0x466f('0x8c')][_0x466f('0xb5')]){_0x4b6779[_0x466f('0x84')]=_[_0x466f('0xa8')](_0x4b6779['where'],{'$and':_0x1e1a90[_0x466f('0x8c')]['extraQueryConditions']});}return _0x3c9487[_0x30580c['childModel']]['count']({'where':_0x4b6779['where']})[_0x466f('0x88')](function(_0x46db0b){_0x415d7c[_0x466f('0xb6')]=_0x46db0b;if(_0x1e1a90[_0x466f('0x8c')][_0x466f('0xac')]){if(_0x30580c[_0x466f('0x14')]==='CmContact'){_0x4b6779['include']=[{'model':_0x3c9487[_0x466f('0x6c')],'as':_0x466f('0xb7'),'attributes':['id',_0x466f('0xc'),_0x466f('0xb8')],'required':_0x1e1a90[_0x466f('0x8c')][_0x466f('0xb9')]?!![]:![]},{'model':_0x3c9487['Tag'],'as':_0x466f('0xba'),'attributes':['id','name','color'],'through':_0x1e1a90[_0x466f('0x8c')][_0x466f('0xb9')]?{'attributes':[],'where':{'TagId':_0x1e1a90[_0x466f('0x8c')]['tag']||undefined}}:{},'required':_0x1e1a90[_0x466f('0x8c')][_0x466f('0xb9')]?!![]:![]}];}else{_0x4b6779['include']=[{'all':!![]}];}}return _0x3c9487[_0x30580c[_0x466f('0x14')]][_0x466f('0x7')](_0x4b6779);})['then'](function(_0x2152c2){_0x415d7c[_0x466f('0xb3')]=_0x2152c2;if(_0x59028b===_0x466f('0x57')&&_0x1e1a90[_0x466f('0x8c')]['openTabs']==='true'){var _0x26a25d=[];for(var _0x484af7=0x0;_0x484af7<_0x415d7c[_0x466f('0xb3')][_0x466f('0x92')];_0x484af7++){_0x26a25d[_0x466f('0x93')](_0x470f61(_0x466f('0xbb'),_0x415d7c[_0x466f('0xb3')][_0x484af7]['dataValues']));_0x26a25d[_0x466f('0x93')](_0x470f61(_0x466f('0xbc'),_0x415d7c[_0x466f('0xb3')][_0x484af7][_0x466f('0xbd')]));_0x26a25d[_0x466f('0x93')](_0x470f61('fax',_0x415d7c['rows'][_0x484af7][_0x466f('0xbd')]));_0x26a25d[_0x466f('0x93')](_0x470f61('mail',_0x415d7c[_0x466f('0xb3')][_0x484af7]['dataValues']));_0x26a25d[_0x466f('0x93')](_0x470f61('openchannel',_0x415d7c['rows'][_0x484af7]['dataValues']));_0x26a25d['push'](_0x470f61(_0x466f('0xbe'),_0x415d7c['rows'][_0x484af7]['dataValues']));}return Promise['all'](_0x26a25d)[_0x466f('0x88')](function(){return _0x415d7c;});}return _0x415d7c;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index 17f370a..dc0e5aa 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 _0x9851=['../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','request','then','info','UserProfile,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x39cc48,_0x5e86bd){var _0x45fb8f=function(_0x3b8592){while(--_0x3b8592){_0x39cc48['push'](_0x39cc48['shift']());}};_0x45fb8f(++_0x5e86bd);}(_0x9851,0x1f1));var _0x1985=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9851[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x1985('0x0'));var util=require('util');var moment=require(_0x1985('0x1'));var BPromise=require(_0x1985('0x2'));var rs=require(_0x1985('0x3'));var fs=require('fs');var Redis=require(_0x1985('0x4'));var db=require(_0x1985('0x5'))['db'];var utils=require(_0x1985('0x6'));var logger=require(_0x1985('0x7'))(_0x1985('0x8'));var config=require(_0x1985('0x9'));var jayson=require(_0x1985('0xa'));var client=jayson['client'][_0x1985('0xb')]({'port':0x232a});config[_0x1985('0xc')]=_[_0x1985('0xd')](config['redis'],{'host':_0x1985('0xe'),'port':0x18eb});var socket=require(_0x1985('0xf'))(new Redis(config['redis']));require(_0x1985('0x10'))['register'](socket);function respondWithRpcPromise(_0xa15178,_0x4490ad,_0x2d8c61){return new BPromise(function(_0xea819d,_0x3babb5){return client[_0x1985('0x11')](_0xa15178,_0x2d8c61)[_0x1985('0x12')](function(_0x14c620){logger[_0x1985('0x13')](_0x1985('0x14'),_0x4490ad,_0x1985('0x15'));logger[_0x1985('0x16')]('UserProfile,\x20%s,\x20%s,\x20%s',_0x4490ad,_0x1985('0x15'),JSON[_0x1985('0x17')](_0x14c620));if(_0x14c620['error']){if(_0x14c620['error']['code']===0x1f4){logger[_0x1985('0x18')](_0x1985('0x14'),_0x4490ad,_0x14c620['error'][_0x1985('0x19')]);return _0x3babb5(_0x14c620[_0x1985('0x18')][_0x1985('0x19')]);}logger['error'](_0x1985('0x14'),_0x4490ad,_0x14c620['error'][_0x1985('0x19')]);return _0xea819d(_0x14c620['error'][_0x1985('0x19')]);}else{logger['info'](_0x1985('0x14'),_0x4490ad,_0x1985('0x15'));_0xea819d(_0x14c620[_0x1985('0x1a')][_0x1985('0x19')]);}})[_0x1985('0x1b')](function(_0xae9447){logger[_0x1985('0x18')](_0x1985('0x14'),_0x4490ad,_0xae9447);_0x3babb5(_0xae9447);});});} \ No newline at end of file +var _0x38b2=['message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','redis','socket.io-emitter','./userProfile.socket','register','request','then','info','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','code','error','UserProfile,\x20%s,\x20%s'];(function(_0x466895,_0x43f6c6){var _0x27807c=function(_0x3c9958){while(--_0x3c9958){_0x466895['push'](_0x466895['shift']());}};_0x27807c(++_0x43f6c6);}(_0x38b2,0xf6));var _0x238b=function(_0x2661f1,_0x2129ba){_0x2661f1=_0x2661f1-0x0;var _0x49a68f=_0x38b2[_0x2661f1];return _0x49a68f;};'use strict';var _=require(_0x238b('0x0'));var util=require(_0x238b('0x1'));var moment=require(_0x238b('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x238b('0x3'));var db=require(_0x238b('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x238b('0x5'))('rpc');var config=require(_0x238b('0x6'));var jayson=require(_0x238b('0x7'));var client=jayson[_0x238b('0x8')][_0x238b('0x9')]({'port':0x232a});config['redis']=_[_0x238b('0xa')](config[_0x238b('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x238b('0xc'))(new Redis(config[_0x238b('0xb')]));require(_0x238b('0xd'))[_0x238b('0xe')](socket);function respondWithRpcPromise(_0x19afcf,_0x17f674,_0x1b7bf4){return new BPromise(function(_0x4df7d6,_0x137ad2){return client[_0x238b('0xf')](_0x19afcf,_0x1b7bf4)[_0x238b('0x10')](function(_0x40762f){logger[_0x238b('0x11')]('UserProfile,\x20%s,\x20%s',_0x17f674,_0x238b('0x12'));logger[_0x238b('0x13')](_0x238b('0x14'),_0x17f674,_0x238b('0x12'),JSON['stringify'](_0x40762f));if(_0x40762f['error']){if(_0x40762f['error'][_0x238b('0x15')]===0x1f4){logger[_0x238b('0x16')](_0x238b('0x17'),_0x17f674,_0x40762f[_0x238b('0x16')][_0x238b('0x18')]);return _0x137ad2(_0x40762f[_0x238b('0x16')][_0x238b('0x18')]);}logger[_0x238b('0x16')]('UserProfile,\x20%s,\x20%s',_0x17f674,_0x40762f[_0x238b('0x16')]['message']);return _0x4df7d6(_0x40762f[_0x238b('0x16')]['message']);}else{logger[_0x238b('0x11')]('UserProfile,\x20%s,\x20%s',_0x17f674,_0x238b('0x12'));_0x4df7d6(_0x40762f[_0x238b('0x19')][_0x238b('0x18')]);}})[_0x238b('0x1a')](function(_0x30d14){logger[_0x238b('0x16')]('UserProfile,\x20%s,\x20%s',_0x17f674,_0x30d14);_0x137ad2(_0x30d14);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index 6bab661..df25407 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 _0x39d8=['remove','update','removeListener','register','length','userProfile:','./userProfile.events','save'];(function(_0x4b58e9,_0x1b02ca){var _0x5307b3=function(_0x5ec6ce){while(--_0x5ec6ce){_0x4b58e9['push'](_0x4b58e9['shift']());}};_0x5307b3(++_0x1b02ca);}(_0x39d8,0x1de));var _0x839d=function(_0x5e6116,_0x4bae08){_0x5e6116=_0x5e6116-0x0;var _0x29bf86=_0x39d8[_0x5e6116];return _0x29bf86;};'use strict';var UserProfileEvents=require(_0x839d('0x0'));var events=[_0x839d('0x1'),_0x839d('0x2'),_0x839d('0x3')];function createListener(_0x57a7b2,_0x51827a){return function(_0x17a9c1){_0x51827a['emit'](_0x57a7b2,_0x17a9c1);};}function removeListener(_0x456342,_0x581179){return function(){UserProfileEvents[_0x839d('0x4')](_0x456342,_0x581179);};}exports[_0x839d('0x5')]=function(_0x19e76c){for(var _0x102bab=0x0,_0x52d84=events[_0x839d('0x6')];_0x102bab<_0x52d84;_0x102bab++){var _0x918cf0=events[_0x102bab];var _0x25112c=createListener(_0x839d('0x7')+_0x918cf0,_0x19e76c);UserProfileEvents['on'](_0x918cf0,_0x25112c);}}; \ No newline at end of file +var _0x5d5a=['update','emit','removeListener','register','length','./userProfile.events','save','remove'];(function(_0x3f4b60,_0x804787){var _0x1076a9=function(_0x2cc237){while(--_0x2cc237){_0x3f4b60['push'](_0x3f4b60['shift']());}};_0x1076a9(++_0x804787);}(_0x5d5a,0x65));var _0xa5d5=function(_0x1cc3e3,_0x58b503){_0x1cc3e3=_0x1cc3e3-0x0;var _0x287073=_0x5d5a[_0x1cc3e3];return _0x287073;};'use strict';var UserProfileEvents=require(_0xa5d5('0x0'));var events=[_0xa5d5('0x1'),_0xa5d5('0x2'),_0xa5d5('0x3')];function createListener(_0x24b96c,_0x33c5b4){return function(_0x506e69){_0x33c5b4[_0xa5d5('0x4')](_0x24b96c,_0x506e69);};}function removeListener(_0x44e939,_0x5203f5){return function(){UserProfileEvents[_0xa5d5('0x5')](_0x44e939,_0x5203f5);};}exports[_0xa5d5('0x6')]=function(_0x2c85d3){for(var _0x5f1e2a=0x0,_0x9dba8d=events[_0xa5d5('0x7')];_0x5f1e2a<_0x9dba8d;_0x5f1e2a++){var _0x26e90e=events[_0x5f1e2a];var _0x5a36d3=createListener('userProfile:'+_0x26e90e,_0x2c85d3);UserProfileEvents['on'](_0x26e90e,_0x5a36d3);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index 28161bf..0a54511 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 _0x61ad=['../../config/environment','./userProfileResource.controller','get','/describe','isAuthenticated','describe','/:id','post','create','put','delete','destroy','exports','util','express','fs-extra','../../components/auth/service'];(function(_0x17a678,_0x58f6e4){var _0x4e8ee5=function(_0x50191d){while(--_0x50191d){_0x17a678['push'](_0x17a678['shift']());}};_0x4e8ee5(++_0x58f6e4);}(_0x61ad,0x150));var _0xd61a=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x61ad[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require('multer');var util=require(_0xd61a('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xd61a('0x1'));var router=express['Router']();var fs_extra=require(_0xd61a('0x2'));var auth=require(_0xd61a('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xd61a('0x4'));var controller=require(_0xd61a('0x5'));router[_0xd61a('0x6')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xd61a('0x7'),auth[_0xd61a('0x8')](),controller[_0xd61a('0x9')]);router[_0xd61a('0x6')](_0xd61a('0xa'),auth[_0xd61a('0x8')](),controller['show']);router[_0xd61a('0xb')]('/',auth[_0xd61a('0x8')](),controller[_0xd61a('0xc')]);router[_0xd61a('0xd')]('/:id',auth[_0xd61a('0x8')](),controller['update']);router[_0xd61a('0xe')](_0xd61a('0xa'),auth[_0xd61a('0x8')](),controller[_0xd61a('0xf')]);module[_0xd61a('0x10')]=router; \ No newline at end of file +var _0xd4f8=['/:id','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','./userProfileResource.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x2fbcf6,_0x2e7155){var _0x3e7265=function(_0x15a3c3){while(--_0x15a3c3){_0x2fbcf6['push'](_0x2fbcf6['shift']());}};_0x3e7265(++_0x2e7155);}(_0xd4f8,0x133));var _0x8d4f=function(_0x2b2a56,_0x11e8a5){_0x2b2a56=_0x2b2a56-0x0;var _0x4868a0=_0xd4f8[_0x2b2a56];return _0x4868a0;};'use strict';var multer=require(_0x8d4f('0x0'));var util=require(_0x8d4f('0x1'));var path=require(_0x8d4f('0x2'));var timeout=require(_0x8d4f('0x3'));var express=require('express');var router=express[_0x8d4f('0x4')]();var fs_extra=require(_0x8d4f('0x5'));var auth=require(_0x8d4f('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x8d4f('0x7'));router[_0x8d4f('0x8')]('/',auth[_0x8d4f('0x9')](),controller[_0x8d4f('0xa')]);router[_0x8d4f('0x8')](_0x8d4f('0xb'),auth[_0x8d4f('0x9')](),controller[_0x8d4f('0xc')]);router['get'](_0x8d4f('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x8d4f('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0x8d4f('0xf')](_0x8d4f('0xd'),auth['isAuthenticated'](),controller[_0x8d4f('0x10')]);router[_0x8d4f('0x11')](_0x8d4f('0xd'),auth[_0x8d4f('0x9')](),controller[_0x8d4f('0x12')]);module[_0x8d4f('0x13')]=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index 6c03c0b..89d0417 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 _0xf5bf=['STRING','sequelize','exports'];(function(_0x384739,_0x3fc0df){var _0x27fa3b=function(_0x54f12e){while(--_0x54f12e){_0x384739['push'](_0x384739['shift']());}};_0x27fa3b(++_0x3fc0df);}(_0xf5bf,0x85));var _0xff5b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf5bf[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xff5b('0x0'));module[_0xff5b('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'resourceId':{'type':Sequelize['INTEGER'],'allowNull':![]},'type':{'type':Sequelize[_0xff5b('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xf846=['INTEGER','sequelize','exports'];(function(_0x3110ef,_0xd186bd){var _0x3a4a42=function(_0x5eb751){while(--_0x5eb751){_0x3110ef['push'](_0x3110ef['shift']());}};_0x3a4a42(++_0xd186bd);}(_0xf846,0x12d));var _0x6f84=function(_0x577dbb,_0x8a7488){_0x577dbb=_0x577dbb-0x0;var _0x1303c0=_0xf846[_0x577dbb];return _0x1303c0;};'use strict';var Sequelize=require(_0x6f84('0x0'));module[_0x6f84('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'resourceId':{'type':Sequelize[_0x6f84('0x2')],'allowNull':![]},'type':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index 87656d9..7609dc0 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 _0xb016=['util','path','to-csv','ejs','fs-extra','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','end','error','name','send','index','map','UserProfileResource','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','params','update','find','body','describe','eml-format','rimraf','request-promise','bluebird','mustache'];(function(_0x13c5bc,_0x41b0bb){var _0x2fea6e=function(_0x1503a3){while(--_0x1503a3){_0x13c5bc['push'](_0x13c5bc['shift']());}};_0x2fea6e(++_0x41b0bb);}(_0xb016,0x159));var _0x6b01=function(_0x15ae05,_0x3d4df7){_0x15ae05=_0x15ae05-0x0;var _0x477471=_0xb016[_0x15ae05];return _0x477471;};'use strict';var emlformat=require(_0x6b01('0x0'));var rimraf=require(_0x6b01('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x6b01('0x2'));var moment=require('moment');var BPromise=require(_0x6b01('0x3'));var Mustache=require(_0x6b01('0x4'));var util=require(_0x6b01('0x5'));var path=require(_0x6b01('0x6'));var sox=require('sox');var csv=require(_0x6b01('0x7'));var ejs=require(_0x6b01('0x8'));var fs=require('fs');var fs_extra=require(_0x6b01('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x6b01('0xa'));var jsforce=require(_0x6b01('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6b01('0xc'));var Papa=require(_0x6b01('0xd'));var Redis=require(_0x6b01('0xe'));var authService=require(_0x6b01('0xf'));var qs=require(_0x6b01('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x6b01('0x11'))(_0x6b01('0x12'));var utils=require(_0x6b01('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x6b01('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x51f976,_0x26f2a0){_0x26f2a0=_0x26f2a0||0xcc;return function(_0x4fa826){if(_0x4fa826){return _0x51f976[_0x6b01('0x15')](_0x26f2a0);}return _0x51f976[_0x6b01('0x16')](_0x26f2a0)['end']();};}function respondWithResult(_0x2c305e,_0x4ea5fa){_0x4ea5fa=_0x4ea5fa||0xc8;return function(_0x50d778){if(_0x50d778){return _0x2c305e['status'](_0x4ea5fa)[_0x6b01('0x17')](_0x50d778);}};}function respondWithFilteredResult(_0x4cbd38,_0x5b2f60){return function(_0x3a259f){if(_0x3a259f){var _0x327e86=typeof _0x5b2f60[_0x6b01('0x18')]===_0x6b01('0x19')&&typeof _0x5b2f60[_0x6b01('0x1a')]===_0x6b01('0x19');var _0x122769=_0x3a259f[_0x6b01('0x1b')];var _0x9c6571=_0x327e86?0x0:_0x5b2f60[_0x6b01('0x18')];var _0x18f336=_0x327e86?_0x3a259f['count']:_0x5b2f60[_0x6b01('0x18')]+_0x5b2f60[_0x6b01('0x1a')];var _0x3b0bab;if(_0x18f336>=_0x122769){_0x18f336=_0x122769;_0x3b0bab=0xc8;}else{_0x3b0bab=0xce;}_0x4cbd38[_0x6b01('0x16')](_0x3b0bab);return _0x4cbd38[_0x6b01('0x1c')](_0x6b01('0x1d'),_0x9c6571+'-'+_0x18f336+'/'+_0x122769)[_0x6b01('0x17')](_0x3a259f);}return null;};}function patchUpdates(_0x3c0573){return function(_0x54a942){try{jsonpatch[_0x6b01('0x1e')](_0x54a942,_0x3c0573,!![]);}catch(_0xc1f453){return BPromise[_0x6b01('0x1f')](_0xc1f453);}return _0x54a942[_0x6b01('0x20')]();};}function saveUpdates(_0x1fced4,_0x181b09){return function(_0x2cea6e){if(_0x2cea6e){return _0x2cea6e['update'](_0x1fced4)[_0x6b01('0x21')](function(_0xcf9200){return _0xcf9200;});}return null;};}function removeEntity(_0x42c990,_0x51243c){return function(_0x399808){if(_0x399808){return _0x399808[_0x6b01('0x22')]()[_0x6b01('0x21')](function(){_0x42c990[_0x6b01('0x16')](0xcc)[_0x6b01('0x23')]();});}};}function handleEntityNotFound(_0x2456e9,_0x1b46fb){return function(_0x136452){if(!_0x136452){_0x2456e9[_0x6b01('0x15')](0x194);}return _0x136452;};}function handleError(_0x152dda,_0x3c0607){_0x3c0607=_0x3c0607||0x1f4;return function(_0xa846d8){logger[_0x6b01('0x24')](_0xa846d8['stack']);if(_0xa846d8[_0x6b01('0x25')]){delete _0xa846d8[_0x6b01('0x25')];}_0x152dda[_0x6b01('0x16')](_0x3c0607)[_0x6b01('0x26')](_0xa846d8);};}exports[_0x6b01('0x27')]=function(_0x528cbd,_0x54f030){var _0x3fae61={},_0x3df3d4={},_0xc574c={'count':0x0,'rows':[]};var _0x8883d1=_[_0x6b01('0x28')](db[_0x6b01('0x29')]['rawAttributes'],function(_0x39f193){return{'name':_0x39f193['fieldName'],'type':_0x39f193[_0x6b01('0x2a')]['key']};});_0x3df3d4[_0x6b01('0x2b')]=_[_0x6b01('0x28')](_0x8883d1,_0x6b01('0x25'));_0x3df3d4[_0x6b01('0x2c')]=_[_0x6b01('0x2d')](_0x528cbd['query']);_0x3df3d4[_0x6b01('0x2e')]=_[_0x6b01('0x2f')](_0x3df3d4[_0x6b01('0x2b')],_0x3df3d4['query']);_0x3fae61['attributes']=_[_0x6b01('0x2f')](_0x3df3d4['model'],qs[_0x6b01('0x30')](_0x528cbd[_0x6b01('0x2c')][_0x6b01('0x30')]));_0x3fae61['attributes']=_0x3fae61[_0x6b01('0x31')][_0x6b01('0x32')]?_0x3fae61[_0x6b01('0x31')]:_0x3df3d4['model'];if(!_0x528cbd[_0x6b01('0x2c')][_0x6b01('0x33')](_0x6b01('0x34'))){_0x3fae61[_0x6b01('0x1a')]=qs[_0x6b01('0x1a')](_0x528cbd['query'][_0x6b01('0x1a')]);_0x3fae61[_0x6b01('0x18')]=qs[_0x6b01('0x18')](_0x528cbd[_0x6b01('0x2c')][_0x6b01('0x18')]);}_0x3fae61[_0x6b01('0x35')]=qs[_0x6b01('0x36')](_0x528cbd[_0x6b01('0x2c')]['sort']);_0x3fae61[_0x6b01('0x37')]=qs['filters'](_[_0x6b01('0x38')](_0x528cbd[_0x6b01('0x2c')],_0x3df3d4[_0x6b01('0x2e')]),_0x8883d1);if(_0x528cbd[_0x6b01('0x2c')][_0x6b01('0x39')]){_0x3fae61[_0x6b01('0x37')]=_[_0x6b01('0x3a')](_0x3fae61['where'],{'$or':_[_0x6b01('0x28')](_0x8883d1,function(_0x15f274){if(_0x15f274[_0x6b01('0x2a')]!==_0x6b01('0x3b')){var _0x1ca3aa={};_0x1ca3aa[_0x15f274[_0x6b01('0x25')]]={'$like':'%'+_0x528cbd[_0x6b01('0x2c')][_0x6b01('0x39')]+'%'};return _0x1ca3aa;}})});}_0x3fae61=_['merge']({},_0x3fae61,_0x528cbd[_0x6b01('0x3c')]);var _0x55907f={'where':_0x3fae61[_0x6b01('0x37')]};return db[_0x6b01('0x29')]['count'](_0x55907f)[_0x6b01('0x21')](function(_0x2e661b){_0xc574c[_0x6b01('0x1b')]=_0x2e661b;if(_0x528cbd[_0x6b01('0x2c')][_0x6b01('0x3d')]){_0x3fae61[_0x6b01('0x3e')]=[{'all':!![]}];}return db[_0x6b01('0x29')][_0x6b01('0x3f')](_0x3fae61);})[_0x6b01('0x21')](function(_0x17f335){_0xc574c['rows']=_0x17f335;return _0xc574c;})[_0x6b01('0x21')](respondWithFilteredResult(_0x54f030,_0x3fae61))[_0x6b01('0x40')](handleError(_0x54f030,null));};exports['show']=function(_0x52cec0,_0x32b9ec){var _0xd11195={'raw':![],'where':{'id':_0x52cec0[_0x6b01('0x41')]['id']}},_0x558ec1={};_0x558ec1[_0x6b01('0x2b')]=_['keys'](db[_0x6b01('0x29')]['rawAttributes']);_0x558ec1[_0x6b01('0x2c')]=_[_0x6b01('0x2d')](_0x52cec0[_0x6b01('0x2c')]);_0x558ec1['filters']=_[_0x6b01('0x2f')](_0x558ec1[_0x6b01('0x2b')],_0x558ec1['query']);_0xd11195['attributes']=_['intersection'](_0x558ec1[_0x6b01('0x2b')],qs[_0x6b01('0x30')](_0x52cec0[_0x6b01('0x2c')][_0x6b01('0x30')]));_0xd11195[_0x6b01('0x31')]=_0xd11195[_0x6b01('0x31')]['length']?_0xd11195[_0x6b01('0x31')]:_0x558ec1[_0x6b01('0x2b')];if(_0x52cec0[_0x6b01('0x2c')][_0x6b01('0x3d')]){_0xd11195[_0x6b01('0x3e')]=[{'all':!![]}];}_0xd11195=_[_0x6b01('0x3a')]({},_0xd11195,_0x52cec0['options']);return db[_0x6b01('0x29')]['find'](_0xd11195)['then'](handleEntityNotFound(_0x32b9ec,null))[_0x6b01('0x21')](respondWithResult(_0x32b9ec,null))[_0x6b01('0x40')](handleError(_0x32b9ec,null));};exports['create']=function(_0x408bb0,_0x27442e){return db[_0x6b01('0x29')]['create'](_0x408bb0['body'],{})['then'](respondWithResult(_0x27442e,0xc9))[_0x6b01('0x40')](handleError(_0x27442e,null));};exports[_0x6b01('0x42')]=function(_0x518d94,_0x34cef6){if(_0x518d94['body']['id']){delete _0x518d94['body']['id'];}return db['UserProfileResource'][_0x6b01('0x43')]({'where':{'id':_0x518d94[_0x6b01('0x41')]['id']}})['then'](handleEntityNotFound(_0x34cef6,null))['then'](saveUpdates(_0x518d94[_0x6b01('0x44')],null))['then'](respondWithResult(_0x34cef6,null))[_0x6b01('0x40')](handleError(_0x34cef6,null));};exports[_0x6b01('0x22')]=function(_0x32d446,_0x172a56){return db[_0x6b01('0x29')]['find']({'where':{'id':_0x32d446[_0x6b01('0x41')]['id']}})[_0x6b01('0x21')](handleEntityNotFound(_0x172a56,null))[_0x6b01('0x21')](removeEntity(_0x172a56,null))['catch'](handleError(_0x172a56,null));};exports[_0x6b01('0x45')]=function(_0x13ab4f,_0x5617d7){return db[_0x6b01('0x29')][_0x6b01('0x45')]()[_0x6b01('0x21')](respondWithResult(_0x5617d7,null))[_0x6b01('0x40')](handleError(_0x5617d7,null));}; \ No newline at end of file +var _0x8e3f=['save','update','destroy','then','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','query','intersection','fields','attributes','length','hasOwnProperty','sort','where','filters','pick','merge','filter','options','UserProfileResource','includeAll','include','findAll','catch','show','params','create','body','find','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','undefined','limit','count','offset','set','Content-Range','json','apply','reject'];(function(_0x487b0c,_0x14ff74){var _0x1adbdc=function(_0x2e7b9d){while(--_0x2e7b9d){_0x487b0c['push'](_0x487b0c['shift']());}};_0x1adbdc(++_0x14ff74);}(_0x8e3f,0xc1));var _0xf8e3=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x8e3f[_0x4565bf];return _0x5610ba;};'use strict';var emlformat=require(_0xf8e3('0x0'));var rimraf=require(_0xf8e3('0x1'));var zipdir=require(_0xf8e3('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf8e3('0x3'));var moment=require(_0xf8e3('0x4'));var BPromise=require(_0xf8e3('0x5'));var Mustache=require('mustache');var util=require(_0xf8e3('0x6'));var path=require(_0xf8e3('0x7'));var sox=require('sox');var csv=require(_0xf8e3('0x8'));var ejs=require(_0xf8e3('0x9'));var fs=require('fs');var fs_extra=require(_0xf8e3('0xa'));var _=require(_0xf8e3('0xb'));var squel=require('squel');var crypto=require(_0xf8e3('0xc'));var jsforce=require(_0xf8e3('0xd'));var deskjs=require(_0xf8e3('0xe'));var toCsv=require(_0xf8e3('0x8'));var querystring=require(_0xf8e3('0xf'));var Papa=require(_0xf8e3('0x10'));var Redis=require(_0xf8e3('0x11'));var authService=require(_0xf8e3('0x12'));var qs=require(_0xf8e3('0x13'));var as=require(_0xf8e3('0x14'));var hardwareService=require(_0xf8e3('0x15'));var logger=require(_0xf8e3('0x16'))('api');var utils=require(_0xf8e3('0x17'));var config=require(_0xf8e3('0x18'));var licenseUtil=require(_0xf8e3('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x40ae02,_0x41f85e){_0x41f85e=_0x41f85e||0xcc;return function(_0x336790){if(_0x336790){return _0x40ae02[_0xf8e3('0x1a')](_0x41f85e);}return _0x40ae02['status'](_0x41f85e)[_0xf8e3('0x1b')]();};}function respondWithResult(_0xa856f5,_0x2fe631){_0x2fe631=_0x2fe631||0xc8;return function(_0x4af736){if(_0x4af736){return _0xa856f5[_0xf8e3('0x1c')](_0x2fe631)['json'](_0x4af736);}};}function respondWithFilteredResult(_0x1ec773,_0x40c196){return function(_0x460629){if(_0x460629){var _0x570ee3=typeof _0x40c196['offset']===_0xf8e3('0x1d')&&typeof _0x40c196[_0xf8e3('0x1e')]===_0xf8e3('0x1d');var _0x3b01ac=_0x460629[_0xf8e3('0x1f')];var _0x11d4cc=_0x570ee3?0x0:_0x40c196[_0xf8e3('0x20')];var _0x2e27e3=_0x570ee3?_0x460629[_0xf8e3('0x1f')]:_0x40c196[_0xf8e3('0x20')]+_0x40c196['limit'];var _0x20cc64;if(_0x2e27e3>=_0x3b01ac){_0x2e27e3=_0x3b01ac;_0x20cc64=0xc8;}else{_0x20cc64=0xce;}_0x1ec773[_0xf8e3('0x1c')](_0x20cc64);return _0x1ec773[_0xf8e3('0x21')](_0xf8e3('0x22'),_0x11d4cc+'-'+_0x2e27e3+'/'+_0x3b01ac)[_0xf8e3('0x23')](_0x460629);}return null;};}function patchUpdates(_0x11c58e){return function(_0x1cae53){try{jsonpatch[_0xf8e3('0x24')](_0x1cae53,_0x11c58e,!![]);}catch(_0x5b99b1){return BPromise[_0xf8e3('0x25')](_0x5b99b1);}return _0x1cae53[_0xf8e3('0x26')]();};}function saveUpdates(_0x3c636d,_0xccbcc0){return function(_0x4a1e5f){if(_0x4a1e5f){return _0x4a1e5f[_0xf8e3('0x27')](_0x3c636d)['then'](function(_0x286059){return _0x286059;});}return null;};}function removeEntity(_0x225a1b,_0x33d526){return function(_0x2dc856){if(_0x2dc856){return _0x2dc856[_0xf8e3('0x28')]()[_0xf8e3('0x29')](function(){_0x225a1b['status'](0xcc)[_0xf8e3('0x1b')]();});}};}function handleEntityNotFound(_0x2fc674,_0x3373ca){return function(_0x417b42){if(!_0x417b42){_0x2fc674[_0xf8e3('0x1a')](0x194);}return _0x417b42;};}function handleError(_0x3b41a1,_0x2963ed){_0x2963ed=_0x2963ed||0x1f4;return function(_0x157a2d){logger['error'](_0x157a2d[_0xf8e3('0x2a')]);if(_0x157a2d[_0xf8e3('0x2b')]){delete _0x157a2d[_0xf8e3('0x2b')];}_0x3b41a1[_0xf8e3('0x1c')](_0x2963ed)[_0xf8e3('0x2c')](_0x157a2d);};}exports[_0xf8e3('0x2d')]=function(_0x16485e,_0xfaf15d){var _0x4f2ae9={},_0x21e1c0={},_0x243e28={'count':0x0,'rows':[]};var _0x492694=_[_0xf8e3('0x2e')](db['UserProfileResource'][_0xf8e3('0x2f')],function(_0x10cf28){return{'name':_0x10cf28[_0xf8e3('0x30')],'type':_0x10cf28[_0xf8e3('0x31')][_0xf8e3('0x32')]};});_0x21e1c0[_0xf8e3('0x33')]=_[_0xf8e3('0x2e')](_0x492694,_0xf8e3('0x2b'));_0x21e1c0['query']=_[_0xf8e3('0x34')](_0x16485e[_0xf8e3('0x35')]);_0x21e1c0['filters']=_['intersection'](_0x21e1c0['model'],_0x21e1c0[_0xf8e3('0x35')]);_0x4f2ae9['attributes']=_[_0xf8e3('0x36')](_0x21e1c0[_0xf8e3('0x33')],qs[_0xf8e3('0x37')](_0x16485e[_0xf8e3('0x35')]['fields']));_0x4f2ae9['attributes']=_0x4f2ae9[_0xf8e3('0x38')][_0xf8e3('0x39')]?_0x4f2ae9[_0xf8e3('0x38')]:_0x21e1c0[_0xf8e3('0x33')];if(!_0x16485e[_0xf8e3('0x35')][_0xf8e3('0x3a')]('nolimit')){_0x4f2ae9[_0xf8e3('0x1e')]=qs['limit'](_0x16485e['query'][_0xf8e3('0x1e')]);_0x4f2ae9[_0xf8e3('0x20')]=qs[_0xf8e3('0x20')](_0x16485e[_0xf8e3('0x35')]['offset']);}_0x4f2ae9['order']=qs[_0xf8e3('0x3b')](_0x16485e[_0xf8e3('0x35')]['sort']);_0x4f2ae9[_0xf8e3('0x3c')]=qs[_0xf8e3('0x3d')](_[_0xf8e3('0x3e')](_0x16485e[_0xf8e3('0x35')],_0x21e1c0['filters']),_0x492694);if(_0x16485e['query']['filter']){_0x4f2ae9[_0xf8e3('0x3c')]=_[_0xf8e3('0x3f')](_0x4f2ae9[_0xf8e3('0x3c')],{'$or':_[_0xf8e3('0x2e')](_0x492694,function(_0x53160a){if(_0x53160a[_0xf8e3('0x31')]!=='VIRTUAL'){var _0x20909b={};_0x20909b[_0x53160a[_0xf8e3('0x2b')]]={'$like':'%'+_0x16485e[_0xf8e3('0x35')][_0xf8e3('0x40')]+'%'};return _0x20909b;}})});}_0x4f2ae9=_[_0xf8e3('0x3f')]({},_0x4f2ae9,_0x16485e[_0xf8e3('0x41')]);var _0x82e778={'where':_0x4f2ae9[_0xf8e3('0x3c')]};return db[_0xf8e3('0x42')]['count'](_0x82e778)[_0xf8e3('0x29')](function(_0x537089){_0x243e28[_0xf8e3('0x1f')]=_0x537089;if(_0x16485e[_0xf8e3('0x35')][_0xf8e3('0x43')]){_0x4f2ae9[_0xf8e3('0x44')]=[{'all':!![]}];}return db[_0xf8e3('0x42')][_0xf8e3('0x45')](_0x4f2ae9);})[_0xf8e3('0x29')](function(_0x2f05b7){_0x243e28['rows']=_0x2f05b7;return _0x243e28;})[_0xf8e3('0x29')](respondWithFilteredResult(_0xfaf15d,_0x4f2ae9))[_0xf8e3('0x46')](handleError(_0xfaf15d,null));};exports[_0xf8e3('0x47')]=function(_0x382dbb,_0x6dd110){var _0xe7fcb9={'raw':![],'where':{'id':_0x382dbb[_0xf8e3('0x48')]['id']}},_0x792190={};_0x792190['model']=_['keys'](db['UserProfileResource'][_0xf8e3('0x2f')]);_0x792190[_0xf8e3('0x35')]=_['keys'](_0x382dbb[_0xf8e3('0x35')]);_0x792190['filters']=_[_0xf8e3('0x36')](_0x792190[_0xf8e3('0x33')],_0x792190['query']);_0xe7fcb9[_0xf8e3('0x38')]=_['intersection'](_0x792190[_0xf8e3('0x33')],qs[_0xf8e3('0x37')](_0x382dbb['query'][_0xf8e3('0x37')]));_0xe7fcb9[_0xf8e3('0x38')]=_0xe7fcb9[_0xf8e3('0x38')][_0xf8e3('0x39')]?_0xe7fcb9['attributes']:_0x792190['model'];if(_0x382dbb['query'][_0xf8e3('0x43')]){_0xe7fcb9[_0xf8e3('0x44')]=[{'all':!![]}];}_0xe7fcb9=_[_0xf8e3('0x3f')]({},_0xe7fcb9,_0x382dbb['options']);return db[_0xf8e3('0x42')]['find'](_0xe7fcb9)[_0xf8e3('0x29')](handleEntityNotFound(_0x6dd110,null))[_0xf8e3('0x29')](respondWithResult(_0x6dd110,null))['catch'](handleError(_0x6dd110,null));};exports['create']=function(_0x128234,_0x2939e6){return db[_0xf8e3('0x42')][_0xf8e3('0x49')](_0x128234[_0xf8e3('0x4a')],{})[_0xf8e3('0x29')](respondWithResult(_0x2939e6,0xc9))[_0xf8e3('0x46')](handleError(_0x2939e6,null));};exports[_0xf8e3('0x27')]=function(_0xdc2430,_0x81898e){if(_0xdc2430[_0xf8e3('0x4a')]['id']){delete _0xdc2430['body']['id'];}return db[_0xf8e3('0x42')][_0xf8e3('0x4b')]({'where':{'id':_0xdc2430[_0xf8e3('0x48')]['id']}})[_0xf8e3('0x29')](handleEntityNotFound(_0x81898e,null))[_0xf8e3('0x29')](saveUpdates(_0xdc2430[_0xf8e3('0x4a')],null))['then'](respondWithResult(_0x81898e,null))[_0xf8e3('0x46')](handleError(_0x81898e,null));};exports[_0xf8e3('0x28')]=function(_0x39caae,_0x3e60a6){return db[_0xf8e3('0x42')][_0xf8e3('0x4b')]({'where':{'id':_0x39caae['params']['id']}})[_0xf8e3('0x29')](handleEntityNotFound(_0x3e60a6,null))[_0xf8e3('0x29')](removeEntity(_0x3e60a6,null))[_0xf8e3('0x46')](handleError(_0x3e60a6,null));};exports[_0xf8e3('0x4c')]=function(_0x113404,_0x2fef16){return db['UserProfileResource'][_0xf8e3('0x4c')]()[_0xf8e3('0x29')](respondWithResult(_0x2fef16,null))[_0xf8e3('0x46')](handleError(_0x2fef16,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index b4a0695..858156f 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 _0x5ad8=['../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./userProfileResource.attributes','define','UserProfileResource','user_profile_has_resources','compositeIndex','resourceId','sectionId','lodash','util'];(function(_0x582a3e,_0x2ea5c0){var _0x495787=function(_0x2f74e3){while(--_0x2f74e3){_0x582a3e['push'](_0x582a3e['shift']());}};_0x495787(++_0x2ea5c0);}(_0x5ad8,0x14e));var _0x85ad=function(_0x3a8128,_0x4b3ae2){_0x3a8128=_0x3a8128-0x0;var _0x934bbb=_0x5ad8[_0x3a8128];return _0x934bbb;};'use strict';var _=require(_0x85ad('0x0'));var util=require(_0x85ad('0x1'));var logger=require(_0x85ad('0x2'))(_0x85ad('0x3'));var moment=require(_0x85ad('0x4'));var BPromise=require(_0x85ad('0x5'));var rp=require(_0x85ad('0x6'));var fs=require('fs');var path=require(_0x85ad('0x7'));var rimraf=require('rimraf');var config=require(_0x85ad('0x8'));var attributes=require(_0x85ad('0x9'));module['exports']=function(_0x1667e3,_0x3e0482){return _0x1667e3[_0x85ad('0xa')](_0x85ad('0xb'),attributes,{'tableName':_0x85ad('0xc'),'paranoid':![],'indexes':[{'name':_0x85ad('0xd'),'fields':[_0x85ad('0xe'),_0x85ad('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0f77=['lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./userProfileResource.attributes','exports','define','UserProfileResource','user_profile_has_resources','resourceId','sectionId'];(function(_0x43ede8,_0x130bcc){var _0x142275=function(_0x3e531a){while(--_0x3e531a){_0x43ede8['push'](_0x43ede8['shift']());}};_0x142275(++_0x130bcc);}(_0x0f77,0x130));var _0x70f7=function(_0x31db21,_0x78c1d7){_0x31db21=_0x31db21-0x0;var _0x3360c4=_0x0f77[_0x31db21];return _0x3360c4;};'use strict';var _=require(_0x70f7('0x0'));var util=require(_0x70f7('0x1'));var logger=require(_0x70f7('0x2'))(_0x70f7('0x3'));var moment=require(_0x70f7('0x4'));var BPromise=require(_0x70f7('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x70f7('0x6'));var rimraf=require(_0x70f7('0x7'));var config=require(_0x70f7('0x8'));var attributes=require(_0x70f7('0x9'));module[_0x70f7('0xa')]=function(_0x2e3fec,_0x5a5840){return _0x2e3fec[_0x70f7('0xb')](_0x70f7('0xc'),attributes,{'tableName':_0x70f7('0xd'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0x70f7('0xe'),_0x70f7('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index 3e3160e..bef7d96 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 _0x6207=['debug','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserProfileResource,\x20%s,\x20%s','request\x20sent'];(function(_0x174fc0,_0x2044ab){var _0x516273=function(_0x84f702){while(--_0x84f702){_0x174fc0['push'](_0x174fc0['shift']());}};_0x516273(++_0x2044ab);}(_0x6207,0xa7));var _0x7620=function(_0x49b031,_0x394721){_0x49b031=_0x49b031-0x0;var _0x57b4b2=_0x6207[_0x49b031];return _0x57b4b2;};'use strict';var _=require(_0x7620('0x0'));var util=require(_0x7620('0x1'));var moment=require(_0x7620('0x2'));var BPromise=require(_0x7620('0x3'));var rs=require(_0x7620('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7620('0x5'))['db'];var utils=require(_0x7620('0x6'));var logger=require('../../config/logger')(_0x7620('0x7'));var config=require(_0x7620('0x8'));var jayson=require(_0x7620('0x9'));var client=jayson[_0x7620('0xa')][_0x7620('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1f395c,_0x5ecbb0,_0x207dc2){return new BPromise(function(_0x1c611f,_0x50c5ce){return client[_0x7620('0xc')](_0x1f395c,_0x207dc2)[_0x7620('0xd')](function(_0x5d37c8){logger[_0x7620('0xe')](_0x7620('0xf'),_0x5ecbb0,_0x7620('0x10'));logger[_0x7620('0x11')](_0x7620('0x12'),_0x5ecbb0,_0x7620('0x10'),JSON[_0x7620('0x13')](_0x5d37c8));if(_0x5d37c8[_0x7620('0x14')]){if(_0x5d37c8['error'][_0x7620('0x15')]===0x1f4){logger['error'](_0x7620('0xf'),_0x5ecbb0,_0x5d37c8[_0x7620('0x14')][_0x7620('0x16')]);return _0x50c5ce(_0x5d37c8[_0x7620('0x14')]['message']);}logger[_0x7620('0x14')]('UserProfileResource,\x20%s,\x20%s',_0x5ecbb0,_0x5d37c8[_0x7620('0x14')][_0x7620('0x16')]);return _0x1c611f(_0x5d37c8[_0x7620('0x14')][_0x7620('0x16')]);}else{logger[_0x7620('0xe')](_0x7620('0xf'),_0x5ecbb0,_0x7620('0x10'));_0x1c611f(_0x5d37c8['result']['message']);}})['catch'](function(_0x4252cf){logger[_0x7620('0x14')](_0x7620('0xf'),_0x5ecbb0,_0x4252cf);_0x50c5ce(_0x4252cf);});});} \ No newline at end of file +var _0x765d=['../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','code','UserProfileResource,\x20%s,\x20%s','message','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','rpc'];(function(_0x234098,_0xa827eb){var _0xee0fa5=function(_0x19afb0){while(--_0x19afb0){_0x234098['push'](_0x234098['shift']());}};_0xee0fa5(++_0xa827eb);}(_0x765d,0x83));var _0xd765=function(_0x3d71d3,_0x11caf1){_0x3d71d3=_0x3d71d3-0x0;var _0x30ec87=_0x765d[_0x3d71d3];return _0x30ec87;};'use strict';var _=require(_0xd765('0x0'));var util=require(_0xd765('0x1'));var moment=require(_0xd765('0x2'));var BPromise=require('bluebird');var rs=require(_0xd765('0x3'));var fs=require('fs');var Redis=require(_0xd765('0x4'));var db=require(_0xd765('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xd765('0x6'));var config=require(_0xd765('0x7'));var jayson=require(_0xd765('0x8'));var client=jayson[_0xd765('0x9')][_0xd765('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x31f06d,_0x948f91,_0x179edc){return new BPromise(function(_0x304a04,_0x5a1b8b){return client[_0xd765('0xb')](_0x31f06d,_0x179edc)[_0xd765('0xc')](function(_0x49d7ab){logger[_0xd765('0xd')]('UserProfileResource,\x20%s,\x20%s',_0x948f91,_0xd765('0xe'));logger[_0xd765('0xf')](_0xd765('0x10'),_0x948f91,'request\x20sent',JSON[_0xd765('0x11')](_0x49d7ab));if(_0x49d7ab[_0xd765('0x12')]){if(_0x49d7ab[_0xd765('0x12')][_0xd765('0x13')]===0x1f4){logger[_0xd765('0x12')](_0xd765('0x14'),_0x948f91,_0x49d7ab['error'][_0xd765('0x15')]);return _0x5a1b8b(_0x49d7ab[_0xd765('0x12')][_0xd765('0x15')]);}logger[_0xd765('0x12')]('UserProfileResource,\x20%s,\x20%s',_0x948f91,_0x49d7ab[_0xd765('0x12')]['message']);return _0x304a04(_0x49d7ab[_0xd765('0x12')][_0xd765('0x15')]);}else{logger[_0xd765('0xd')](_0xd765('0x14'),_0x948f91,_0xd765('0xe'));_0x304a04(_0x49d7ab[_0xd765('0x16')][_0xd765('0x15')]);}})['catch'](function(_0x137db2){logger[_0xd765('0x12')]('UserProfileResource,\x20%s,\x20%s',_0x948f91,_0x137db2);_0x5a1b8b(_0x137db2);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index b07ff35..a4607b1 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 _0x9e1e=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileSection.controller','get','isAuthenticated','index','/describe','/:id','show','post','create','delete','exports','path'];(function(_0x1fe8f6,_0x1d61b9){var _0x1fecb8=function(_0x4119de){while(--_0x4119de){_0x1fe8f6['push'](_0x1fe8f6['shift']());}};_0x1fecb8(++_0x1d61b9);}(_0x9e1e,0x11c));var _0xe9e1=function(_0x2d290b,_0x56e7d3){_0x2d290b=_0x2d290b-0x0;var _0x2257f9=_0x9e1e[_0x2d290b];return _0x2257f9;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe9e1('0x0'));var timeout=require(_0xe9e1('0x1'));var express=require(_0xe9e1('0x2'));var router=express[_0xe9e1('0x3')]();var fs_extra=require(_0xe9e1('0x4'));var auth=require(_0xe9e1('0x5'));var interaction=require(_0xe9e1('0x6'));var config=require(_0xe9e1('0x7'));var controller=require(_0xe9e1('0x8'));router[_0xe9e1('0x9')]('/',auth[_0xe9e1('0xa')](),controller[_0xe9e1('0xb')]);router['get'](_0xe9e1('0xc'),auth[_0xe9e1('0xa')](),controller['describe']);router[_0xe9e1('0x9')](_0xe9e1('0xd'),auth[_0xe9e1('0xa')](),controller[_0xe9e1('0xe')]);router[_0xe9e1('0xf')]('/',auth[_0xe9e1('0xa')](),controller[_0xe9e1('0x10')]);router['put'](_0xe9e1('0xd'),auth['isAuthenticated'](),controller['update']);router[_0xe9e1('0x11')](_0xe9e1('0xd'),auth[_0xe9e1('0xa')](),controller['destroy']);module[_0xe9e1('0x12')]=router; \ No newline at end of file +var _0x6855=['index','/describe','describe','show','post','create','/:id','update','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','get','isAuthenticated'];(function(_0x53a7af,_0x1408a5){var _0x3cc7f6=function(_0x4bf101){while(--_0x4bf101){_0x53a7af['push'](_0x53a7af['shift']());}};_0x3cc7f6(++_0x1408a5);}(_0x6855,0x128));var _0x5685=function(_0x3ab353,_0x5d5283){_0x3ab353=_0x3ab353-0x0;var _0x1e2285=_0x6855[_0x3ab353];return _0x1e2285;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x5685('0x0'));var timeout=require(_0x5685('0x1'));var express=require(_0x5685('0x2'));var router=express[_0x5685('0x3')]();var fs_extra=require(_0x5685('0x4'));var auth=require(_0x5685('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./userProfileSection.controller');router[_0x5685('0x6')]('/',auth[_0x5685('0x7')](),controller[_0x5685('0x8')]);router['get'](_0x5685('0x9'),auth[_0x5685('0x7')](),controller[_0x5685('0xa')]);router[_0x5685('0x6')]('/:id',auth[_0x5685('0x7')](),controller[_0x5685('0xb')]);router[_0x5685('0xc')]('/',auth[_0x5685('0x7')](),controller[_0x5685('0xd')]);router['put'](_0x5685('0xe'),auth[_0x5685('0x7')](),controller[_0x5685('0xf')]);router[_0x5685('0x10')](_0x5685('0xe'),auth[_0x5685('0x7')](),controller[_0x5685('0x11')]);module[_0x5685('0x12')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index d9678f4..7e28d95 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 _0xe820=['sequelize','STRING','BOOLEAN','setDataValue','join','getDataValue','crudPermissions'];(function(_0x22bb99,_0x35e71d){var _0x2e76bf=function(_0x4e2fa1){while(--_0x4e2fa1){_0x22bb99['push'](_0x22bb99['shift']());}};_0x2e76bf(++_0x35e71d);}(_0xe820,0xd2));var _0x0e82=function(_0x5a5c9e,_0x46f16d){_0x5a5c9e=_0x5a5c9e-0x0;var _0x272e22=_0xe820[_0x5a5c9e];return _0x272e22;};'use strict';var Sequelize=require(_0x0e82('0x0'));module['exports']={'name':{'type':Sequelize[_0x0e82('0x1')],'allowNull':![]},'category':{'type':Sequelize['STRING'],'allowNull':![]},'sectionId':{'type':Sequelize['INTEGER'],'allowNull':![]},'enabled':{'type':Sequelize[_0x0e82('0x2')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x0e82('0x2')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x0e82('0x1')],'set':function(_0x59b28d){this[_0x0e82('0x3')]('crudPermissions',_0x59b28d?_0x59b28d[_0x0e82('0x4')](''):[]);},'get':function(){return this[_0x0e82('0x5')](_0x0e82('0x6'))?this[_0x0e82('0x5')](_0x0e82('0x6'))['split'](''):[];}}}; \ No newline at end of file +var _0x0b0e=['STRING','INTEGER','BOOLEAN','setDataValue','crudPermissions','join','getDataValue','sequelize'];(function(_0x5dbe60,_0x4ed9db){var _0x301b1a=function(_0x88ba7b){while(--_0x88ba7b){_0x5dbe60['push'](_0x5dbe60['shift']());}};_0x301b1a(++_0x4ed9db);}(_0x0b0e,0x187));var _0xe0b0=function(_0x3fe042,_0x1106f7){_0x3fe042=_0x3fe042-0x0;var _0x7d4a1f=_0x0b0e[_0x3fe042];return _0x7d4a1f;};'use strict';var Sequelize=require(_0xe0b0('0x0'));module['exports']={'name':{'type':Sequelize[_0xe0b0('0x1')],'allowNull':![]},'category':{'type':Sequelize['STRING'],'allowNull':![]},'sectionId':{'type':Sequelize[_0xe0b0('0x2')],'allowNull':![]},'enabled':{'type':Sequelize[_0xe0b0('0x3')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0xe0b0('0x3')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0xe0b0('0x1')],'set':function(_0x28040c){this[_0xe0b0('0x4')](_0xe0b0('0x5'),_0x28040c?_0x28040c[_0xe0b0('0x6')](''):[]);},'get':function(){return this[_0xe0b0('0x7')](_0xe0b0('0x5'))?this[_0xe0b0('0x7')]('crudPermissions')['split'](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index 205ff07..174ec68 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 _0xf2cc=['where','pick','filter','merge','include','catch','show','length','includeAll','options','find','create','body','params','destroy','describe','eml-format','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','update','then','end','error','name','map','UserProfileSection','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort'];(function(_0x26f812,_0x53a96b){var _0x1d5f31=function(_0x11c80a){while(--_0x11c80a){_0x26f812['push'](_0x26f812['shift']());}};_0x1d5f31(++_0x53a96b);}(_0xf2cc,0x182));var _0xcf2c=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xf2cc[_0x397e5f];return _0x5302b8;};'use strict';var emlformat=require(_0xcf2c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xcf2c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xcf2c('0x2'));var moment=require(_0xcf2c('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xcf2c('0x4'));var util=require(_0xcf2c('0x5'));var path=require(_0xcf2c('0x6'));var sox=require(_0xcf2c('0x7'));var csv=require(_0xcf2c('0x8'));var ejs=require(_0xcf2c('0x9'));var fs=require('fs');var fs_extra=require(_0xcf2c('0xa'));var _=require(_0xcf2c('0xb'));var squel=require(_0xcf2c('0xc'));var crypto=require(_0xcf2c('0xd'));var jsforce=require(_0xcf2c('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xcf2c('0x8'));var querystring=require(_0xcf2c('0xf'));var Papa=require(_0xcf2c('0x10'));var Redis=require(_0xcf2c('0x11'));var authService=require(_0xcf2c('0x12'));var qs=require(_0xcf2c('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcf2c('0x14'));var logger=require(_0xcf2c('0x15'))(_0xcf2c('0x16'));var utils=require('../../config/utils');var config=require(_0xcf2c('0x17'));var licenseUtil=require(_0xcf2c('0x18'));var db=require(_0xcf2c('0x19'))['db'];function respondWithStatusCode(_0x3d0e0c,_0xb3ce4a){_0xb3ce4a=_0xb3ce4a||0xcc;return function(_0x29d1e0){if(_0x29d1e0){return _0x3d0e0c['sendStatus'](_0xb3ce4a);}return _0x3d0e0c[_0xcf2c('0x1a')](_0xb3ce4a)['end']();};}function respondWithResult(_0x4b454c,_0x4e348d){_0x4e348d=_0x4e348d||0xc8;return function(_0x4f07c7){if(_0x4f07c7){return _0x4b454c[_0xcf2c('0x1a')](_0x4e348d)['json'](_0x4f07c7);}};}function respondWithFilteredResult(_0x2a56d9,_0x5167d3){return function(_0x267745){if(_0x267745){var _0x7086d7=typeof _0x5167d3[_0xcf2c('0x1b')]==='undefined'&&typeof _0x5167d3[_0xcf2c('0x1c')]===_0xcf2c('0x1d');var _0x501f19=_0x267745[_0xcf2c('0x1e')];var _0x558dcb=_0x7086d7?0x0:_0x5167d3['offset'];var _0x4f2d3d=_0x7086d7?_0x267745[_0xcf2c('0x1e')]:_0x5167d3[_0xcf2c('0x1b')]+_0x5167d3['limit'];var _0x3b8a8f;if(_0x4f2d3d>=_0x501f19){_0x4f2d3d=_0x501f19;_0x3b8a8f=0xc8;}else{_0x3b8a8f=0xce;}_0x2a56d9['status'](_0x3b8a8f);return _0x2a56d9[_0xcf2c('0x1f')](_0xcf2c('0x20'),_0x558dcb+'-'+_0x4f2d3d+'/'+_0x501f19)[_0xcf2c('0x21')](_0x267745);}return null;};}function patchUpdates(_0x1695df){return function(_0x1b8277){try{jsonpatch[_0xcf2c('0x22')](_0x1b8277,_0x1695df,!![]);}catch(_0x14cdfc){return BPromise[_0xcf2c('0x23')](_0x14cdfc);}return _0x1b8277[_0xcf2c('0x24')]();};}function saveUpdates(_0x3b498e,_0xeef095){return function(_0x3de7e9){if(_0x3de7e9){return _0x3de7e9[_0xcf2c('0x25')](_0x3b498e)['then'](function(_0x3faf5c){return _0x3faf5c;});}return null;};}function removeEntity(_0x4dafde,_0x20a53a){return function(_0x41b339){if(_0x41b339){return _0x41b339['destroy']()[_0xcf2c('0x26')](function(){_0x4dafde[_0xcf2c('0x1a')](0xcc)[_0xcf2c('0x27')]();});}};}function handleEntityNotFound(_0x23a5ea,_0x2fce29){return function(_0x1041ed){if(!_0x1041ed){_0x23a5ea['sendStatus'](0x194);}return _0x1041ed;};}function handleError(_0x46ee76,_0x23be6f){_0x23be6f=_0x23be6f||0x1f4;return function(_0x1eff5a){logger[_0xcf2c('0x28')](_0x1eff5a['stack']);if(_0x1eff5a['name']){delete _0x1eff5a[_0xcf2c('0x29')];}_0x46ee76['status'](_0x23be6f)['send'](_0x1eff5a);};}exports['index']=function(_0x5a1f2f,_0x97681f){var _0x534a5f={},_0x577030={},_0x3cd9d5={'count':0x0,'rows':[]};var _0x424cf5=_[_0xcf2c('0x2a')](db[_0xcf2c('0x2b')][_0xcf2c('0x2c')],function(_0x59d708){return{'name':_0x59d708[_0xcf2c('0x2d')],'type':_0x59d708[_0xcf2c('0x2e')][_0xcf2c('0x2f')]};});_0x577030[_0xcf2c('0x30')]=_['map'](_0x424cf5,'name');_0x577030['query']=_[_0xcf2c('0x31')](_0x5a1f2f[_0xcf2c('0x32')]);_0x577030[_0xcf2c('0x33')]=_[_0xcf2c('0x34')](_0x577030[_0xcf2c('0x30')],_0x577030[_0xcf2c('0x32')]);_0x534a5f[_0xcf2c('0x35')]=_[_0xcf2c('0x34')](_0x577030[_0xcf2c('0x30')],qs[_0xcf2c('0x36')](_0x5a1f2f[_0xcf2c('0x32')][_0xcf2c('0x36')]));_0x534a5f[_0xcf2c('0x35')]=_0x534a5f[_0xcf2c('0x35')]['length']?_0x534a5f[_0xcf2c('0x35')]:_0x577030[_0xcf2c('0x30')];if(!_0x5a1f2f[_0xcf2c('0x32')][_0xcf2c('0x37')]('nolimit')){_0x534a5f['limit']=qs['limit'](_0x5a1f2f[_0xcf2c('0x32')][_0xcf2c('0x1c')]);_0x534a5f[_0xcf2c('0x1b')]=qs['offset'](_0x5a1f2f[_0xcf2c('0x32')][_0xcf2c('0x1b')]);}_0x534a5f[_0xcf2c('0x38')]=qs[_0xcf2c('0x39')](_0x5a1f2f[_0xcf2c('0x32')][_0xcf2c('0x39')]);_0x534a5f[_0xcf2c('0x3a')]=qs[_0xcf2c('0x33')](_[_0xcf2c('0x3b')](_0x5a1f2f[_0xcf2c('0x32')],_0x577030[_0xcf2c('0x33')]),_0x424cf5);if(_0x5a1f2f[_0xcf2c('0x32')][_0xcf2c('0x3c')]){_0x534a5f[_0xcf2c('0x3a')]=_[_0xcf2c('0x3d')](_0x534a5f[_0xcf2c('0x3a')],{'$or':_[_0xcf2c('0x2a')](_0x424cf5,function(_0x2b5e1b){if(_0x2b5e1b['type']!=='VIRTUAL'){var _0x160630={};_0x160630[_0x2b5e1b['name']]={'$like':'%'+_0x5a1f2f[_0xcf2c('0x32')]['filter']+'%'};return _0x160630;}})});}_0x534a5f=_[_0xcf2c('0x3d')]({},_0x534a5f,_0x5a1f2f['options']);var _0x1d391c={'where':_0x534a5f['where']};return db[_0xcf2c('0x2b')][_0xcf2c('0x1e')](_0x1d391c)[_0xcf2c('0x26')](function(_0x319863){_0x3cd9d5[_0xcf2c('0x1e')]=_0x319863;if(_0x5a1f2f[_0xcf2c('0x32')]['includeAll']){_0x534a5f[_0xcf2c('0x3e')]=[{'all':!![]}];}return db[_0xcf2c('0x2b')]['findAll'](_0x534a5f);})[_0xcf2c('0x26')](function(_0x374965){_0x3cd9d5['rows']=_0x374965;return _0x3cd9d5;})['then'](respondWithFilteredResult(_0x97681f,_0x534a5f))[_0xcf2c('0x3f')](handleError(_0x97681f,null));};exports[_0xcf2c('0x40')]=function(_0x5d03fc,_0x1332b4){var _0x31de03={'raw':![],'where':{'id':_0x5d03fc['params']['id']}},_0x300c13={};_0x300c13[_0xcf2c('0x30')]=_[_0xcf2c('0x31')](db[_0xcf2c('0x2b')][_0xcf2c('0x2c')]);_0x300c13[_0xcf2c('0x32')]=_['keys'](_0x5d03fc[_0xcf2c('0x32')]);_0x300c13[_0xcf2c('0x33')]=_[_0xcf2c('0x34')](_0x300c13[_0xcf2c('0x30')],_0x300c13['query']);_0x31de03[_0xcf2c('0x35')]=_['intersection'](_0x300c13[_0xcf2c('0x30')],qs[_0xcf2c('0x36')](_0x5d03fc[_0xcf2c('0x32')]['fields']));_0x31de03[_0xcf2c('0x35')]=_0x31de03[_0xcf2c('0x35')][_0xcf2c('0x41')]?_0x31de03['attributes']:_0x300c13[_0xcf2c('0x30')];if(_0x5d03fc[_0xcf2c('0x32')][_0xcf2c('0x42')]){_0x31de03[_0xcf2c('0x3e')]=[{'all':!![]}];}_0x31de03=_['merge']({},_0x31de03,_0x5d03fc[_0xcf2c('0x43')]);return db[_0xcf2c('0x2b')][_0xcf2c('0x44')](_0x31de03)[_0xcf2c('0x26')](handleEntityNotFound(_0x1332b4,null))[_0xcf2c('0x26')](respondWithResult(_0x1332b4,null))[_0xcf2c('0x3f')](handleError(_0x1332b4,null));};exports[_0xcf2c('0x45')]=function(_0x17ffbb,_0x4499fd){return db[_0xcf2c('0x2b')]['create'](_0x17ffbb[_0xcf2c('0x46')],{})[_0xcf2c('0x26')](respondWithResult(_0x4499fd,0xc9))[_0xcf2c('0x3f')](handleError(_0x4499fd,null));};exports[_0xcf2c('0x25')]=function(_0x395ba7,_0x21a658){if(_0x395ba7[_0xcf2c('0x46')]['id']){delete _0x395ba7[_0xcf2c('0x46')]['id'];}return db['UserProfileSection']['find']({'where':{'id':_0x395ba7[_0xcf2c('0x47')]['id']}})[_0xcf2c('0x26')](handleEntityNotFound(_0x21a658,null))[_0xcf2c('0x26')](saveUpdates(_0x395ba7[_0xcf2c('0x46')],null))[_0xcf2c('0x26')](respondWithResult(_0x21a658,null))[_0xcf2c('0x3f')](handleError(_0x21a658,null));};exports[_0xcf2c('0x48')]=function(_0x4c1889,_0x39f76a){return db[_0xcf2c('0x2b')]['find']({'where':{'id':_0x4c1889[_0xcf2c('0x47')]['id']}})[_0xcf2c('0x26')](handleEntityNotFound(_0x39f76a,null))[_0xcf2c('0x26')](removeEntity(_0x39f76a,null))[_0xcf2c('0x3f')](handleError(_0x39f76a,null));};exports[_0xcf2c('0x49')]=function(_0x461f53,_0x322fe6){return db['UserProfileSection']['describe']()['then'](respondWithResult(_0x322fe6,null))[_0xcf2c('0x3f')](handleError(_0x322fe6,null));}; \ No newline at end of file +var _0xc37d=['error','name','index','map','UserProfileSection','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','params','rawAttributes','includeAll','body','catch','find','describe','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','then'];(function(_0x50ae2e,_0xa3738e){var _0x415960=function(_0x227cc1){while(--_0x227cc1){_0x50ae2e['push'](_0x50ae2e['shift']());}};_0x415960(++_0xa3738e);}(_0xc37d,0x18b));var _0xdc37=function(_0x235977,_0x4b0d30){_0x235977=_0x235977-0x0;var _0x266582=_0xc37d[_0x235977];return _0x266582;};'use strict';var emlformat=require(_0xdc37('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xdc37('0x1'));var jsonpatch=require(_0xdc37('0x2'));var rp=require(_0xdc37('0x3'));var moment=require('moment');var BPromise=require(_0xdc37('0x4'));var Mustache=require('mustache');var util=require(_0xdc37('0x5'));var path=require(_0xdc37('0x6'));var sox=require('sox');var csv=require(_0xdc37('0x7'));var ejs=require(_0xdc37('0x8'));var fs=require('fs');var fs_extra=require(_0xdc37('0x9'));var _=require('lodash');var squel=require(_0xdc37('0xa'));var crypto=require(_0xdc37('0xb'));var jsforce=require(_0xdc37('0xc'));var deskjs=require(_0xdc37('0xd'));var toCsv=require('to-csv');var querystring=require(_0xdc37('0xe'));var Papa=require(_0xdc37('0xf'));var Redis=require('ioredis');var authService=require(_0xdc37('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xdc37('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xdc37('0x12'))('api');var utils=require(_0xdc37('0x13'));var config=require(_0xdc37('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xdc37('0x15'))['db'];function respondWithStatusCode(_0x2fe669,_0x13798a){_0x13798a=_0x13798a||0xcc;return function(_0x19c551){if(_0x19c551){return _0x2fe669[_0xdc37('0x16')](_0x13798a);}return _0x2fe669['status'](_0x13798a)[_0xdc37('0x17')]();};}function respondWithResult(_0x67ce3e,_0x1b5d43){_0x1b5d43=_0x1b5d43||0xc8;return function(_0x209010){if(_0x209010){return _0x67ce3e[_0xdc37('0x18')](_0x1b5d43)[_0xdc37('0x19')](_0x209010);}};}function respondWithFilteredResult(_0x596d3f,_0xde1780){return function(_0x12f4c9){if(_0x12f4c9){var _0x55262c=typeof _0xde1780[_0xdc37('0x1a')]===_0xdc37('0x1b')&&typeof _0xde1780[_0xdc37('0x1c')]===_0xdc37('0x1b');var _0x358a1d=_0x12f4c9[_0xdc37('0x1d')];var _0x3d1841=_0x55262c?0x0:_0xde1780[_0xdc37('0x1a')];var _0x3219e3=_0x55262c?_0x12f4c9['count']:_0xde1780['offset']+_0xde1780[_0xdc37('0x1c')];var _0xa21198;if(_0x3219e3>=_0x358a1d){_0x3219e3=_0x358a1d;_0xa21198=0xc8;}else{_0xa21198=0xce;}_0x596d3f['status'](_0xa21198);return _0x596d3f[_0xdc37('0x1e')](_0xdc37('0x1f'),_0x3d1841+'-'+_0x3219e3+'/'+_0x358a1d)[_0xdc37('0x19')](_0x12f4c9);}return null;};}function patchUpdates(_0x28e6e3){return function(_0x1fa003){try{jsonpatch[_0xdc37('0x20')](_0x1fa003,_0x28e6e3,!![]);}catch(_0x384ff0){return BPromise[_0xdc37('0x21')](_0x384ff0);}return _0x1fa003['save']();};}function saveUpdates(_0x1995c9,_0x4366fb){return function(_0x1318d1){if(_0x1318d1){return _0x1318d1[_0xdc37('0x22')](_0x1995c9)['then'](function(_0x1d8371){return _0x1d8371;});}return null;};}function removeEntity(_0x19f85e,_0x470aff){return function(_0x5d0d75){if(_0x5d0d75){return _0x5d0d75[_0xdc37('0x23')]()[_0xdc37('0x24')](function(){_0x19f85e['status'](0xcc)[_0xdc37('0x17')]();});}};}function handleEntityNotFound(_0x4ac05f,_0x4f8811){return function(_0x3e2750){if(!_0x3e2750){_0x4ac05f[_0xdc37('0x16')](0x194);}return _0x3e2750;};}function handleError(_0x40f211,_0x134321){_0x134321=_0x134321||0x1f4;return function(_0x1000c6){logger[_0xdc37('0x25')](_0x1000c6['stack']);if(_0x1000c6[_0xdc37('0x26')]){delete _0x1000c6[_0xdc37('0x26')];}_0x40f211[_0xdc37('0x18')](_0x134321)['send'](_0x1000c6);};}exports[_0xdc37('0x27')]=function(_0x3c8688,_0x133a76){var _0x441253={},_0x4dbd68={},_0x389b21={'count':0x0,'rows':[]};var _0x251577=_[_0xdc37('0x28')](db[_0xdc37('0x29')]['rawAttributes'],function(_0x5313f4){return{'name':_0x5313f4['fieldName'],'type':_0x5313f4[_0xdc37('0x2a')][_0xdc37('0x2b')]};});_0x4dbd68[_0xdc37('0x2c')]=_[_0xdc37('0x28')](_0x251577,'name');_0x4dbd68[_0xdc37('0x2d')]=_[_0xdc37('0x2e')](_0x3c8688[_0xdc37('0x2d')]);_0x4dbd68[_0xdc37('0x2f')]=_['intersection'](_0x4dbd68[_0xdc37('0x2c')],_0x4dbd68[_0xdc37('0x2d')]);_0x441253[_0xdc37('0x30')]=_[_0xdc37('0x31')](_0x4dbd68[_0xdc37('0x2c')],qs[_0xdc37('0x32')](_0x3c8688[_0xdc37('0x2d')][_0xdc37('0x32')]));_0x441253['attributes']=_0x441253[_0xdc37('0x30')][_0xdc37('0x33')]?_0x441253[_0xdc37('0x30')]:_0x4dbd68[_0xdc37('0x2c')];if(!_0x3c8688[_0xdc37('0x2d')][_0xdc37('0x34')](_0xdc37('0x35'))){_0x441253[_0xdc37('0x1c')]=qs[_0xdc37('0x1c')](_0x3c8688[_0xdc37('0x2d')][_0xdc37('0x1c')]);_0x441253[_0xdc37('0x1a')]=qs[_0xdc37('0x1a')](_0x3c8688[_0xdc37('0x2d')]['offset']);}_0x441253[_0xdc37('0x36')]=qs[_0xdc37('0x37')](_0x3c8688['query'][_0xdc37('0x37')]);_0x441253[_0xdc37('0x38')]=qs[_0xdc37('0x2f')](_[_0xdc37('0x39')](_0x3c8688[_0xdc37('0x2d')],_0x4dbd68['filters']),_0x251577);if(_0x3c8688[_0xdc37('0x2d')][_0xdc37('0x3a')]){_0x441253[_0xdc37('0x38')]=_[_0xdc37('0x3b')](_0x441253[_0xdc37('0x38')],{'$or':_['map'](_0x251577,function(_0x56df8b){if(_0x56df8b['type']!==_0xdc37('0x3c')){var _0x3eb3da={};_0x3eb3da[_0x56df8b[_0xdc37('0x26')]]={'$like':'%'+_0x3c8688[_0xdc37('0x2d')][_0xdc37('0x3a')]+'%'};return _0x3eb3da;}})});}_0x441253=_['merge']({},_0x441253,_0x3c8688[_0xdc37('0x3d')]);var _0x5059eb={'where':_0x441253[_0xdc37('0x38')]};return db[_0xdc37('0x29')][_0xdc37('0x1d')](_0x5059eb)[_0xdc37('0x24')](function(_0x5b06af){_0x389b21['count']=_0x5b06af;if(_0x3c8688[_0xdc37('0x2d')]['includeAll']){_0x441253[_0xdc37('0x3e')]=[{'all':!![]}];}return db['UserProfileSection'][_0xdc37('0x3f')](_0x441253);})[_0xdc37('0x24')](function(_0x23b505){_0x389b21[_0xdc37('0x40')]=_0x23b505;return _0x389b21;})[_0xdc37('0x24')](respondWithFilteredResult(_0x133a76,_0x441253))['catch'](handleError(_0x133a76,null));};exports['show']=function(_0xe3b76f,_0x5aaf25){var _0x552391={'raw':![],'where':{'id':_0xe3b76f[_0xdc37('0x41')]['id']}},_0x866917={};_0x866917[_0xdc37('0x2c')]=_[_0xdc37('0x2e')](db[_0xdc37('0x29')][_0xdc37('0x42')]);_0x866917[_0xdc37('0x2d')]=_[_0xdc37('0x2e')](_0xe3b76f[_0xdc37('0x2d')]);_0x866917[_0xdc37('0x2f')]=_['intersection'](_0x866917['model'],_0x866917[_0xdc37('0x2d')]);_0x552391['attributes']=_['intersection'](_0x866917[_0xdc37('0x2c')],qs[_0xdc37('0x32')](_0xe3b76f['query'][_0xdc37('0x32')]));_0x552391[_0xdc37('0x30')]=_0x552391['attributes'][_0xdc37('0x33')]?_0x552391['attributes']:_0x866917[_0xdc37('0x2c')];if(_0xe3b76f[_0xdc37('0x2d')][_0xdc37('0x43')]){_0x552391['include']=[{'all':!![]}];}_0x552391=_[_0xdc37('0x3b')]({},_0x552391,_0xe3b76f[_0xdc37('0x3d')]);return db[_0xdc37('0x29')]['find'](_0x552391)['then'](handleEntityNotFound(_0x5aaf25,null))[_0xdc37('0x24')](respondWithResult(_0x5aaf25,null))['catch'](handleError(_0x5aaf25,null));};exports['create']=function(_0x23c3e4,_0x351294){return db[_0xdc37('0x29')]['create'](_0x23c3e4[_0xdc37('0x44')],{})[_0xdc37('0x24')](respondWithResult(_0x351294,0xc9))[_0xdc37('0x45')](handleError(_0x351294,null));};exports[_0xdc37('0x22')]=function(_0xba8fe1,_0x5af233){if(_0xba8fe1[_0xdc37('0x44')]['id']){delete _0xba8fe1[_0xdc37('0x44')]['id'];}return db[_0xdc37('0x29')][_0xdc37('0x46')]({'where':{'id':_0xba8fe1[_0xdc37('0x41')]['id']}})[_0xdc37('0x24')](handleEntityNotFound(_0x5af233,null))[_0xdc37('0x24')](saveUpdates(_0xba8fe1[_0xdc37('0x44')],null))['then'](respondWithResult(_0x5af233,null))[_0xdc37('0x45')](handleError(_0x5af233,null));};exports[_0xdc37('0x23')]=function(_0x213f4e,_0x2ef9f7){return db[_0xdc37('0x29')]['find']({'where':{'id':_0x213f4e['params']['id']}})[_0xdc37('0x24')](handleEntityNotFound(_0x2ef9f7,null))[_0xdc37('0x24')](removeEntity(_0x2ef9f7,null))[_0xdc37('0x45')](handleError(_0x2ef9f7,null));};exports[_0xdc37('0x47')]=function(_0x1af4e6,_0x5a0843){return db[_0xdc37('0x29')][_0xdc37('0x47')]()['then'](respondWithResult(_0x5a0843,null))[_0xdc37('0x45')](handleError(_0x5a0843,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index cf062ca..13bb44f 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 _0x6caf=['request-promise','rimraf','../../config/environment','./userProfileSection.attributes','exports','define','UserProfileSection','user_profile_has_sections','sectionId','userProfileId','lodash','moment','bluebird'];(function(_0xd677b,_0x3d6296){var _0x1113f5=function(_0x31e27b){while(--_0x31e27b){_0xd677b['push'](_0xd677b['shift']());}};_0x1113f5(++_0x3d6296);}(_0x6caf,0x142));var _0xf6ca=function(_0x77d310,_0x2b2fe7){_0x77d310=_0x77d310-0x0;var _0x2cdce4=_0x6caf[_0x77d310];return _0x2cdce4;};'use strict';var _=require(_0xf6ca('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xf6ca('0x1'));var BPromise=require(_0xf6ca('0x2'));var rp=require(_0xf6ca('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf6ca('0x4'));var config=require(_0xf6ca('0x5'));var attributes=require(_0xf6ca('0x6'));module[_0xf6ca('0x7')]=function(_0x3a009c,_0x4973ae){return _0x3a009c[_0xf6ca('0x8')](_0xf6ca('0x9'),attributes,{'tableName':_0xf6ca('0xa'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0xf6ca('0xb'),_0xf6ca('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xfaa0=['bluebird','path','../../config/environment','./userProfileSection.attributes','define','UserProfileSection','compositeIndex','lodash','util','../../config/logger','api','moment'];(function(_0x65d12e,_0x4b0a30){var _0x4274e0=function(_0x121624){while(--_0x121624){_0x65d12e['push'](_0x65d12e['shift']());}};_0x4274e0(++_0x4b0a30);}(_0xfaa0,0x103));var _0x0faa=function(_0x116019,_0x29bf5d){_0x116019=_0x116019-0x0;var _0x196cf6=_0xfaa0[_0x116019];return _0x196cf6;};'use strict';var _=require(_0x0faa('0x0'));var util=require(_0x0faa('0x1'));var logger=require(_0x0faa('0x2'))(_0x0faa('0x3'));var moment=require(_0x0faa('0x4'));var BPromise=require(_0x0faa('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0faa('0x6'));var rimraf=require('rimraf');var config=require(_0x0faa('0x7'));var attributes=require(_0x0faa('0x8'));module['exports']=function(_0x15f624,_0xef28cc){return _0x15f624[_0x0faa('0x9')](_0x0faa('0xa'),attributes,{'tableName':'user_profile_has_sections','paranoid':![],'indexes':[{'name':_0x0faa('0xb'),'fields':['sectionId','userProfileId']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index 2baa957..7e12c27 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 _0x808d=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','UserProfileSection,\x20%s,\x20%s','message','info','catch','util'];(function(_0x54f000,_0x551dff){var _0x483e6d=function(_0xb07490){while(--_0xb07490){_0x54f000['push'](_0x54f000['shift']());}};_0x483e6d(++_0x551dff);}(_0x808d,0x1e3));var _0xd808=function(_0x179e69,_0x632b1c){_0x179e69=_0x179e69-0x0;var _0x2dba9a=_0x808d[_0x179e69];return _0x2dba9a;};'use strict';var _=require('lodash');var util=require(_0xd808('0x0'));var moment=require(_0xd808('0x1'));var BPromise=require(_0xd808('0x2'));var rs=require(_0xd808('0x3'));var fs=require('fs');var Redis=require(_0xd808('0x4'));var db=require(_0xd808('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xd808('0x6'))(_0xd808('0x7'));var config=require(_0xd808('0x8'));var jayson=require(_0xd808('0x9'));var client=jayson[_0xd808('0xa')][_0xd808('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x397fbb,_0x56a971,_0x594e7d){return new BPromise(function(_0x374221,_0x1074a0){return client[_0xd808('0xc')](_0x397fbb,_0x594e7d)[_0xd808('0xd')](function(_0x42efa8){logger['info']('UserProfileSection,\x20%s,\x20%s',_0x56a971,_0xd808('0xe'));logger['debug'](_0xd808('0xf'),_0x56a971,'request\x20sent',JSON[_0xd808('0x10')](_0x42efa8));if(_0x42efa8[_0xd808('0x11')]){if(_0x42efa8['error']['code']===0x1f4){logger[_0xd808('0x11')](_0xd808('0x12'),_0x56a971,_0x42efa8[_0xd808('0x11')][_0xd808('0x13')]);return _0x1074a0(_0x42efa8['error'][_0xd808('0x13')]);}logger[_0xd808('0x11')]('UserProfileSection,\x20%s,\x20%s',_0x56a971,_0x42efa8['error'][_0xd808('0x13')]);return _0x374221(_0x42efa8[_0xd808('0x11')]['message']);}else{logger[_0xd808('0x14')]('UserProfileSection,\x20%s,\x20%s',_0x56a971,_0xd808('0xe'));_0x374221(_0x42efa8['result'][_0xd808('0x13')]);}})[_0xd808('0x15')](function(_0xf0f040){logger[_0xd808('0x11')]('UserProfileSection,\x20%s,\x20%s',_0x56a971,_0xf0f040);_0x1074a0(_0xf0f040);});});} \ No newline at end of file +var _0x8786=['debug','request\x20sent','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','UserProfileSection,\x20%s,\x20%s'];(function(_0x14c47a,_0x5d4db9){var _0x46f873=function(_0xbedfb9){while(--_0xbedfb9){_0x14c47a['push'](_0x14c47a['shift']());}};_0x46f873(++_0x5d4db9);}(_0x8786,0x7a));var _0x6878=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x8786[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require(_0x6878('0x0'));var util=require(_0x6878('0x1'));var moment=require(_0x6878('0x2'));var BPromise=require(_0x6878('0x3'));var rs=require(_0x6878('0x4'));var fs=require('fs');var Redis=require(_0x6878('0x5'));var db=require(_0x6878('0x6'))['db'];var utils=require(_0x6878('0x7'));var logger=require(_0x6878('0x8'))(_0x6878('0x9'));var config=require(_0x6878('0xa'));var jayson=require(_0x6878('0xb'));var client=jayson['client'][_0x6878('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x40c823,_0x4b979f,_0x189938){return new BPromise(function(_0x13ddf4,_0x3b7462){return client['request'](_0x40c823,_0x189938)[_0x6878('0xd')](function(_0x18feba){logger[_0x6878('0xe')](_0x6878('0xf'),_0x4b979f,'request\x20sent');logger[_0x6878('0x10')]('UserProfileSection,\x20%s,\x20%s,\x20%s',_0x4b979f,_0x6878('0x11'),JSON[_0x6878('0x12')](_0x18feba));if(_0x18feba[_0x6878('0x13')]){if(_0x18feba[_0x6878('0x13')][_0x6878('0x14')]===0x1f4){logger[_0x6878('0x13')](_0x6878('0xf'),_0x4b979f,_0x18feba[_0x6878('0x13')][_0x6878('0x15')]);return _0x3b7462(_0x18feba[_0x6878('0x13')][_0x6878('0x15')]);}logger[_0x6878('0x13')](_0x6878('0xf'),_0x4b979f,_0x18feba[_0x6878('0x13')]['message']);return _0x13ddf4(_0x18feba[_0x6878('0x13')][_0x6878('0x15')]);}else{logger[_0x6878('0xe')](_0x6878('0xf'),_0x4b979f,_0x6878('0x11'));_0x13ddf4(_0x18feba['result']['message']);}})[_0x6878('0x16')](function(_0x188082){logger[_0x6878('0x13')](_0x6878('0xf'),_0x4b979f,_0x188082);_0x3b7462(_0x188082);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index c0c26fb..a14dc06 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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x4cdc7b,_0x2103dc){var _0x3423a1=function(_0x2682a2){while(--_0x2682a2){_0x4cdc7b['push'](_0x4cdc7b['shift']());}};_0x3423a1(++_0x2103dc);}(_0x70e0,0x17b));var _0x070e=function(_0xea35fd,_0x52588d){_0xea35fd=_0xea35fd-0x0;var _0x2485a4=_0x70e0[_0xea35fd];return _0x2485a4;};'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 _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x194b2a,_0xf240d2){var _0x5cefa8=function(_0x2e3acd){while(--_0x2e3acd){_0x194b2a['push'](_0x194b2a['shift']());}};_0x5cefa8(++_0xf240d2);}(_0xedd9,0xfc));var _0x9edd=function(_0x5f078a,_0x45d330){_0x5f078a=_0x5f078a-0x0;var _0x291c01=_0xedd9[_0x5f078a];return _0x291c01;};'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/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index 88bb305..6b5bfa0 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 _0x4c72=['sequelize','INTEGER'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x4c72,0x1e4));var _0x24c7=function(_0x4d2a4c,_0x2a338c){_0x4d2a4c=_0x4d2a4c-0x0;var _0x733496=_0x4c72[_0x4d2a4c];return _0x733496;};'use strict';var Sequelize=require(_0x24c7('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x24c7('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x27d1=['exports'];(function(_0xbea048,_0x203f7e){var _0x466a9e=function(_0x56f310){while(--_0x56f310){_0xbea048['push'](_0xbea048['shift']());}};_0x466a9e(++_0x203f7e);}(_0x27d1,0xfe));var _0x127d=function(_0x48fe78,_0x33d193){_0x48fe78=_0x48fe78-0x0;var _0x14a987=_0x27d1[_0x48fe78];return _0x14a987;};'use strict';var Sequelize=require('sequelize');module[_0x127d('0x0')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.model.js b/server/api/userSmsQueue/userSmsQueue.model.js index e264089..5a0f76f 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 _0xc359=['user_has_sms_queues','util','api','moment','bluebird','path','../../config/environment','exports'];(function(_0x2e8802,_0x59ad8c){var _0x4617aa=function(_0x4380b4){while(--_0x4380b4){_0x2e8802['push'](_0x2e8802['shift']());}};_0x4617aa(++_0x59ad8c);}(_0xc359,0x1d9));var _0x9c35=function(_0x3474ac,_0x22d0f7){_0x3474ac=_0x3474ac-0x0;var _0x5345ec=_0xc359[_0x3474ac];return _0x5345ec;};'use strict';var _=require('lodash');var util=require(_0x9c35('0x0'));var logger=require('../../config/logger')(_0x9c35('0x1'));var moment=require(_0x9c35('0x2'));var BPromise=require(_0x9c35('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9c35('0x4'));var rimraf=require('rimraf');var config=require(_0x9c35('0x5'));var attributes=require('./userSmsQueue.attributes');module[_0x9c35('0x6')]=function(_0x5b3ada,_0x490409){return _0x5b3ada['define']('UserSmsQueue',attributes,{'tableName':_0x9c35('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4351=['exports','define','user_has_sms_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userSmsQueue.attributes'];(function(_0x460150,_0x232949){var _0x340677=function(_0x5b7e32){while(--_0x5b7e32){_0x460150['push'](_0x460150['shift']());}};_0x340677(++_0x232949);}(_0x4351,0x1b5));var _0x1435=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x4351[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0x1435('0x0'));var util=require(_0x1435('0x1'));var logger=require(_0x1435('0x2'))(_0x1435('0x3'));var moment=require(_0x1435('0x4'));var BPromise=require(_0x1435('0x5'));var rp=require(_0x1435('0x6'));var fs=require('fs');var path=require(_0x1435('0x7'));var rimraf=require(_0x1435('0x8'));var config=require(_0x1435('0x9'));var attributes=require(_0x1435('0xa'));module[_0x1435('0xb')]=function(_0x1f0838,_0x3a9f9a){return _0x1f0838[_0x1435('0xc')]('UserSmsQueue',attributes,{'tableName':_0x1435('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.rpc.js b/server/api/userSmsQueue/userSmsQueue.rpc.js index 8211cb9..f0fab1c 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 _0x1085=['UserSmsQueue,\x20%s,\x20%s,\x20%s','error','UserSmsQueue,\x20%s,\x20%s','message','catch','lodash','util','moment','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','request','info','request\x20sent','debug'];(function(_0x26f395,_0x59710a){var _0x35b59c=function(_0x348e7){while(--_0x348e7){_0x26f395['push'](_0x26f395['shift']());}};_0x35b59c(++_0x59710a);}(_0x1085,0x115));var _0x5108=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1085[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x5108('0x0'));var util=require(_0x5108('0x1'));var moment=require(_0x5108('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5108('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x5108('0x4'))(_0x5108('0x5'));var config=require(_0x5108('0x6'));var jayson=require(_0x5108('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x53d1e5,_0x22e195,_0x256366){return new BPromise(function(_0x58a16a,_0x138dc0){return client[_0x5108('0x8')](_0x53d1e5,_0x256366)['then'](function(_0x357b5d){logger[_0x5108('0x9')]('UserSmsQueue,\x20%s,\x20%s',_0x22e195,_0x5108('0xa'));logger[_0x5108('0xb')](_0x5108('0xc'),_0x22e195,_0x5108('0xa'),JSON['stringify'](_0x357b5d));if(_0x357b5d[_0x5108('0xd')]){if(_0x357b5d[_0x5108('0xd')]['code']===0x1f4){logger[_0x5108('0xd')](_0x5108('0xe'),_0x22e195,_0x357b5d[_0x5108('0xd')][_0x5108('0xf')]);return _0x138dc0(_0x357b5d[_0x5108('0xd')][_0x5108('0xf')]);}logger[_0x5108('0xd')](_0x5108('0xe'),_0x22e195,_0x357b5d['error'][_0x5108('0xf')]);return _0x58a16a(_0x357b5d['error']['message']);}else{logger['info'](_0x5108('0xe'),_0x22e195,'request\x20sent');_0x58a16a(_0x357b5d['result'][_0x5108('0xf')]);}})[_0x5108('0x10')](function(_0x1a748d){logger[_0x5108('0xd')](_0x5108('0xe'),_0x22e195,_0x1a748d);_0x138dc0(_0x1a748d);});});} \ No newline at end of file +var _0xb9f3=['debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','UserSmsQueue,\x20%s,\x20%s','message','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent'];(function(_0x460fd7,_0x2012db){var _0x44d1c2=function(_0x545e11){while(--_0x545e11){_0x460fd7['push'](_0x460fd7['shift']());}};_0x44d1c2(++_0x2012db);}(_0xb9f3,0x12d));var _0x3b9f=function(_0x18d08b,_0x1bdcc1){_0x18d08b=_0x18d08b-0x0;var _0xd3401d=_0xb9f3[_0x18d08b];return _0xd3401d;};'use strict';var _=require(_0x3b9f('0x0'));var util=require(_0x3b9f('0x1'));var moment=require('moment');var BPromise=require(_0x3b9f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3b9f('0x3'));var db=require(_0x3b9f('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3b9f('0x5'))('rpc');var config=require(_0x3b9f('0x6'));var jayson=require(_0x3b9f('0x7'));var client=jayson[_0x3b9f('0x8')][_0x3b9f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x34df63,_0x49ec37,_0x38a7b8){return new BPromise(function(_0x1c5799,_0x283721){return client[_0x3b9f('0xa')](_0x34df63,_0x38a7b8)[_0x3b9f('0xb')](function(_0xd98911){logger[_0x3b9f('0xc')]('UserSmsQueue,\x20%s,\x20%s',_0x49ec37,_0x3b9f('0xd'));logger[_0x3b9f('0xe')](_0x3b9f('0xf'),_0x49ec37,_0x3b9f('0xd'),JSON[_0x3b9f('0x10')](_0xd98911));if(_0xd98911[_0x3b9f('0x11')]){if(_0xd98911[_0x3b9f('0x11')]['code']===0x1f4){logger[_0x3b9f('0x11')](_0x3b9f('0x12'),_0x49ec37,_0xd98911['error']['message']);return _0x283721(_0xd98911[_0x3b9f('0x11')]['message']);}logger[_0x3b9f('0x11')](_0x3b9f('0x12'),_0x49ec37,_0xd98911[_0x3b9f('0x11')]['message']);return _0x1c5799(_0xd98911[_0x3b9f('0x11')][_0x3b9f('0x13')]);}else{logger[_0x3b9f('0xc')](_0x3b9f('0x12'),_0x49ec37,'request\x20sent');_0x1c5799(_0xd98911['result'][_0x3b9f('0x13')]);}})[_0x3b9f('0x14')](function(_0x17af3a){logger[_0x3b9f('0x11')](_0x3b9f('0x12'),_0x49ec37,_0x17af3a);_0x283721(_0x17af3a);});});} \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.attributes.js b/server/api/userVoicePrefix/userVoicePrefix.attributes.js index 303b7f4..015210e 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 _0x9a03=['sequelize','exports','INTEGER'];(function(_0x5c59c3,_0x129ff2){var _0x5868aa=function(_0x9a30b4){while(--_0x9a30b4){_0x5c59c3['push'](_0x5c59c3['shift']());}};_0x5868aa(++_0x129ff2);}(_0x9a03,0xa5));var _0x39a0=function(_0x2136a6,_0x35af63){_0x2136a6=_0x2136a6-0x0;var _0x55b948=_0x9a03[_0x2136a6];return _0x55b948;};'use strict';var Sequelize=require(_0x39a0('0x0'));module[_0x39a0('0x1')]={'UserId':{'type':Sequelize[_0x39a0('0x2')]},'VoicePrefixId':{'type':Sequelize[_0x39a0('0x2')]}}; \ No newline at end of file +var _0x50f5=['sequelize','exports'];(function(_0x550d12,_0x5384bd){var _0x12103d=function(_0x2a9834){while(--_0x2a9834){_0x550d12['push'](_0x550d12['shift']());}};_0x12103d(++_0x5384bd);}(_0x50f5,0x9a));var _0x550f=function(_0x4b194e,_0x53821b){_0x4b194e=_0x4b194e-0x0;var _0x5016c0=_0x50f5[_0x4b194e];return _0x5016c0;};'use strict';var Sequelize=require(_0x550f('0x0'));module[_0x550f('0x1')]={'UserId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.model.js b/server/api/userVoicePrefix/userVoicePrefix.model.js index 441384f..106d753 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(_0x597f06,_0x4ef212){var _0x4535e9=function(_0x55532c){while(--_0x55532c){_0x597f06['push'](_0x597f06['shift']());}};_0x4535e9(++_0x4ef212);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0xa9e0[_0x1c546c];return _0x2cc384;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));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(_0x432d9a,_0x54bcf8){var _0x4e63f8=function(_0x2f162b){while(--_0x2f162b){_0x432d9a['push'](_0x432d9a['shift']());}};_0x4e63f8(++_0x54bcf8);}(_0xa9e0,0x123));var _0x0a9e=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0xa9e0[_0xa1e3e3];return _0xc980e9;};'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 83aa14f..0ef8d86 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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x2d6df9,_0x45da50){var _0x429b18=function(_0x5b3c09){while(--_0x5b3c09){_0x2d6df9['push'](_0x2d6df9['shift']());}};_0x429b18(++_0x45da50);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file +var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0xfdc8d1,_0x968eed){var _0x3524bd=function(_0x56717d){while(--_0x56717d){_0xfdc8d1['push'](_0xfdc8d1['shift']());}};_0x3524bd(++_0x968eed);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x555069,_0x23d66a){_0x555069=_0x555069-0x0;var _0x100af7=_0xcb91[_0x555069];return _0x100af7;};'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/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index f86ee3e..27a2f9b 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 _0x6631=['exports','INTEGER','sequelize'];(function(_0x2d45ee,_0x46b47c){var _0x5d11ac=function(_0x27a013){while(--_0x27a013){_0x2d45ee['push'](_0x2d45ee['shift']());}};_0x5d11ac(++_0x46b47c);}(_0x6631,0x134));var _0x1663=function(_0x2a582c,_0x348cb6){_0x2a582c=_0x2a582c-0x0;var _0x2e0128=_0x6631[_0x2a582c];return _0x2e0128;};'use strict';var Sequelize=require(_0x1663('0x0'));module[_0x1663('0x1')]={'penalty':{'type':Sequelize[_0x1663('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xed9d=['sequelize','exports','INTEGER'];(function(_0x26dea2,_0x3ca3e6){var _0x286bdc=function(_0x221aac){while(--_0x221aac){_0x26dea2['push'](_0x26dea2['shift']());}};_0x286bdc(++_0x3ca3e6);}(_0xed9d,0xab));var _0xded9=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0xed9d[_0x4154a6];return _0x3b2786;};'use strict';var Sequelize=require(_0xded9('0x0'));module[_0xded9('0x1')]={'penalty':{'type':Sequelize[_0xded9('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 1d0b87a..a225e41 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 _0xe9fa=['exports','define','UserVoiceQueue','user_has_voice_queues','util','../../config/logger','api','moment','request-promise','path','rimraf','./userVoiceQueue.attributes'];(function(_0x41d6e1,_0x45b065){var _0x3efa77=function(_0x46a6fa){while(--_0x46a6fa){_0x41d6e1['push'](_0x41d6e1['shift']());}};_0x3efa77(++_0x45b065);}(_0xe9fa,0x160));var _0xae9f=function(_0x5a94b9,_0x353ad1){_0x5a94b9=_0x5a94b9-0x0;var _0x191437=_0xe9fa[_0x5a94b9];return _0x191437;};'use strict';var _=require('lodash');var util=require(_0xae9f('0x0'));var logger=require(_0xae9f('0x1'))(_0xae9f('0x2'));var moment=require(_0xae9f('0x3'));var BPromise=require('bluebird');var rp=require(_0xae9f('0x4'));var fs=require('fs');var path=require(_0xae9f('0x5'));var rimraf=require(_0xae9f('0x6'));var config=require('../../config/environment');var attributes=require(_0xae9f('0x7'));module[_0xae9f('0x8')]=function(_0x2e0d59,_0x1728ea){return _0x2e0d59[_0xae9f('0x9')](_0xae9f('0xa'),attributes,{'tableName':_0xae9f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2902=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userVoiceQueue.attributes','exports','define','UserVoiceQueue','lodash'];(function(_0x159c2f,_0xd39d20){var _0x591f68=function(_0x161ba6){while(--_0x161ba6){_0x159c2f['push'](_0x159c2f['shift']());}};_0x591f68(++_0xd39d20);}(_0x2902,0x7d));var _0x2290=function(_0x4a599b,_0x1d2125){_0x4a599b=_0x4a599b-0x0;var _0x2d53d3=_0x2902[_0x4a599b];return _0x2d53d3;};'use strict';var _=require(_0x2290('0x0'));var util=require(_0x2290('0x1'));var logger=require(_0x2290('0x2'))(_0x2290('0x3'));var moment=require(_0x2290('0x4'));var BPromise=require(_0x2290('0x5'));var rp=require(_0x2290('0x6'));var fs=require('fs');var path=require(_0x2290('0x7'));var rimraf=require(_0x2290('0x8'));var config=require(_0x2290('0x9'));var attributes=require(_0x2290('0xa'));module[_0x2290('0xb')]=function(_0x433aa4,_0x60277f){return _0x433aa4[_0x2290('0xc')](_0x2290('0xd'),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 62666b0..ea2b137 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 _0xd2f2=['request','info','UserVoiceQueue,\x20%s,\x20%s','debug','request\x20sent','error','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xd2f2,0x135));var _0x2d2f=function(_0x3cf9f5,_0x316df1){_0x3cf9f5=_0x3cf9f5-0x0;var _0x38f98c=_0xd2f2[_0x3cf9f5];return _0x38f98c;};'use strict';var _=require('lodash');var util=require(_0x2d2f('0x0'));var moment=require(_0x2d2f('0x1'));var BPromise=require('bluebird');var rs=require(_0x2d2f('0x2'));var fs=require('fs');var Redis=require(_0x2d2f('0x3'));var db=require(_0x2d2f('0x4'))['db'];var utils=require(_0x2d2f('0x5'));var logger=require(_0x2d2f('0x6'))('rpc');var config=require(_0x2d2f('0x7'));var jayson=require(_0x2d2f('0x8'));var client=jayson[_0x2d2f('0x9')][_0x2d2f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4d1a62,_0x4cd79a,_0x283793){return new BPromise(function(_0x26542f,_0x1d53c2){return client[_0x2d2f('0xb')](_0x4d1a62,_0x283793)['then'](function(_0x2c94e1){logger[_0x2d2f('0xc')](_0x2d2f('0xd'),_0x4cd79a,'request\x20sent');logger[_0x2d2f('0xe')]('UserVoiceQueue,\x20%s,\x20%s,\x20%s',_0x4cd79a,_0x2d2f('0xf'),JSON['stringify'](_0x2c94e1));if(_0x2c94e1[_0x2d2f('0x10')]){if(_0x2c94e1[_0x2d2f('0x10')]['code']===0x1f4){logger[_0x2d2f('0x10')]('UserVoiceQueue,\x20%s,\x20%s',_0x4cd79a,_0x2c94e1[_0x2d2f('0x10')][_0x2d2f('0x11')]);return _0x1d53c2(_0x2c94e1[_0x2d2f('0x10')][_0x2d2f('0x11')]);}logger[_0x2d2f('0x10')](_0x2d2f('0xd'),_0x4cd79a,_0x2c94e1[_0x2d2f('0x10')][_0x2d2f('0x11')]);return _0x26542f(_0x2c94e1[_0x2d2f('0x10')]['message']);}else{logger['info'](_0x2d2f('0xd'),_0x4cd79a,_0x2d2f('0xf'));_0x26542f(_0x2c94e1[_0x2d2f('0x12')][_0x2d2f('0x11')]);}})[_0x2d2f('0x13')](function(_0x37dc42){logger['error'](_0x2d2f('0xd'),_0x4cd79a,_0x37dc42);_0x1d53c2(_0x37dc42);});});} \ No newline at end of file +var _0x697d=['client','request','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise'];(function(_0x3ceac4,_0xf57186){var _0x9e4fe8=function(_0x439e4f){while(--_0x439e4f){_0x3ceac4['push'](_0x3ceac4['shift']());}};_0x9e4fe8(++_0xf57186);}(_0x697d,0x19b));var _0xd697=function(_0x57e176,_0x147601){_0x57e176=_0x57e176-0x0;var _0x28497a=_0x697d[_0x57e176];return _0x28497a;};'use strict';var _=require(_0xd697('0x0'));var util=require(_0xd697('0x1'));var moment=require(_0xd697('0x2'));var BPromise=require(_0xd697('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd697('0x4'));var db=require(_0xd697('0x5'))['db'];var utils=require(_0xd697('0x6'));var logger=require('../../config/logger')(_0xd697('0x7'));var config=require('../../config/environment');var jayson=require(_0xd697('0x8'));var client=jayson[_0xd697('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0xdf1923,_0x87fac4,_0x114d03){return new BPromise(function(_0xa804f1,_0x4ae4ce){return client[_0xd697('0xa')](_0xdf1923,_0x114d03)['then'](function(_0x3131b4){logger[_0xd697('0xb')](_0xd697('0xc'),_0x87fac4,_0xd697('0xd'));logger[_0xd697('0xe')](_0xd697('0xf'),_0x87fac4,'request\x20sent',JSON[_0xd697('0x10')](_0x3131b4));if(_0x3131b4[_0xd697('0x11')]){if(_0x3131b4['error']['code']===0x1f4){logger[_0xd697('0x11')](_0xd697('0xc'),_0x87fac4,_0x3131b4[_0xd697('0x11')]['message']);return _0x4ae4ce(_0x3131b4[_0xd697('0x11')][_0xd697('0x12')]);}logger[_0xd697('0x11')](_0xd697('0xc'),_0x87fac4,_0x3131b4[_0xd697('0x11')][_0xd697('0x12')]);return _0xa804f1(_0x3131b4[_0xd697('0x11')][_0xd697('0x12')]);}else{logger[_0xd697('0xb')](_0xd697('0xc'),_0x87fac4,_0xd697('0xd'));_0xa804f1(_0x3131b4[_0xd697('0x13')]['message']);}})[_0xd697('0x14')](function(_0x682e36){logger['error']('UserVoiceQueue,\x20%s,\x20%s',_0x87fac4,_0x682e36);_0x4ae4ce(_0x682e36);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index 3a5030d..0f30f7a 100644 --- a/server/api/userVoiceQueueRt/index.js +++ b/server/api/userVoiceQueueRt/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x5341d8,_0x11f185){var _0x15ee61=function(_0x42e18c){while(--_0x42e18c){_0x5341d8['push'](_0x5341d8['shift']());}};_0x15ee61(++_0x11f185);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x175290,_0x42e572){var _0x52bd78=function(_0xea7cc7){while(--_0xea7cc7){_0x175290['push'](_0x175290['shift']());}};_0x52bd78(++_0x42e572);}(_0x9c44,0x178));var _0x49c4=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0x9c44[_0x3ff085];return _0x2b68c3;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index a424d67..9aa8249 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 _0xeecc=['queue_interface','sequelize','exports','Required\x20by\x20Asterisk','STRING','INTEGER'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xeecc,0x121));var _0xceec=function(_0x1693a4,_0x3f399a){_0x1693a4=_0x1693a4-0x0;var _0xb7ae64=_0xeecc[_0x1693a4];return _0xb7ae64;};'use strict';var Sequelize=require(_0xceec('0x0'));module[_0xceec('0x1')]={'uniqueid':{'type':Sequelize['INTEGER'],'primaryKey':!![],'autoIncrement':!![],'comment':_0xceec('0x2')},'membername':{'type':Sequelize[_0xceec('0x3')],'allowNull':![],'comment':_0xceec('0x2')},'UserId':{'type':Sequelize[_0xceec('0x4')],'allowNull':![]},'queue_name':{'type':Sequelize[_0xceec('0x3')],'allowNull':![],'unique':_0xceec('0x5'),'comment':_0xceec('0x2')},'VoiceQueueId':{'type':Sequelize[_0xceec('0x4')],'allowNull':![]},'interface':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xceec('0x5'),'comment':'Required\x20by\x20Asterisk'},'penalty':{'type':Sequelize[_0xceec('0x4')](0xb),'defaultValue':0x0,'comment':_0xceec('0x2')},'paused':{'type':Sequelize[_0xceec('0x4')](0xb),'defaultValue':0x0,'comment':_0xceec('0x2')}}; \ No newline at end of file +var _0xede7=['INTEGER','Required\x20by\x20Asterisk','STRING','queue_interface','sequelize'];(function(_0x4ae9ce,_0x3718ff){var _0x53ec97=function(_0x2ac8b3){while(--_0x2ac8b3){_0x4ae9ce['push'](_0x4ae9ce['shift']());}};_0x53ec97(++_0x3718ff);}(_0xede7,0xcc));var _0x7ede=function(_0x15aef6,_0x25345c){_0x15aef6=_0x15aef6-0x0;var _0x422f3d=_0xede7[_0x15aef6];return _0x422f3d;};'use strict';var Sequelize=require(_0x7ede('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x7ede('0x1')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x7ede('0x2')},'membername':{'type':Sequelize[_0x7ede('0x3')],'allowNull':![],'comment':_0x7ede('0x2')},'UserId':{'type':Sequelize['INTEGER'],'allowNull':![]},'queue_name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x7ede('0x4'),'comment':_0x7ede('0x2')},'VoiceQueueId':{'type':Sequelize[_0x7ede('0x1')],'allowNull':![]},'interface':{'type':Sequelize[_0x7ede('0x3')],'allowNull':![],'unique':'queue_interface','comment':_0x7ede('0x2')},'penalty':{'type':Sequelize[_0x7ede('0x1')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'},'paused':{'type':Sequelize[_0x7ede('0x1')](0xb),'defaultValue':0x0,'comment':_0x7ede('0x2')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index ecbff63..0fb8a1f 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 _0xfff5=['remove','emit','hook','events','UserVoiceQueueRt','setMaxListeners','update'];(function(_0x11d25d,_0x1c92f4){var _0x5a7003=function(_0x4f50ca){while(--_0x4f50ca){_0x11d25d['push'](_0x11d25d['shift']());}};_0x5a7003(++_0x1c92f4);}(_0xfff5,0xf1));var _0x5fff=function(_0x23b8e2,_0x1ae30f){_0x23b8e2=_0x23b8e2-0x0;var _0x4ee3a7=_0xfff5[_0x23b8e2];return _0x4ee3a7;};'use strict';var EventEmitter=require(_0x5fff('0x0'));var UserVoiceQueueRt=require('../../mysqldb')['db'][_0x5fff('0x1')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x5fff('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x5fff('0x3'),'afterDestroy':_0x5fff('0x4')};function emitEvent(_0xc1104f){return function(_0x20b2aa,_0x85455f,_0x492727){UserVoiceQueueRtEvents[_0x5fff('0x5')](_0xc1104f+':'+_0x20b2aa['id'],_0x20b2aa);UserVoiceQueueRtEvents[_0x5fff('0x5')](_0xc1104f,_0x20b2aa);_0x492727(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserVoiceQueueRt[_0x5fff('0x6')](e,emitEvent(event));}}module['exports']=UserVoiceQueueRtEvents; \ No newline at end of file +var _0x044a=['exports','events','UserVoiceQueueRt','setMaxListeners','save','update','emit','hasOwnProperty'];(function(_0x3863b1,_0x6d4959){var _0x5d769a=function(_0x1857db){while(--_0x1857db){_0x3863b1['push'](_0x3863b1['shift']());}};_0x5d769a(++_0x6d4959);}(_0x044a,0x169));var _0xa044=function(_0x474b1e,_0x29201a){_0x474b1e=_0x474b1e-0x0;var _0x5bdad7=_0x044a[_0x474b1e];return _0x5bdad7;};'use strict';var EventEmitter=require(_0xa044('0x0'));var UserVoiceQueueRt=require('../../mysqldb')['db'][_0xa044('0x1')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0xa044('0x2')](0x0);var events={'afterCreate':_0xa044('0x3'),'afterUpdate':_0xa044('0x4'),'afterDestroy':'remove'};function emitEvent(_0x5924c4){return function(_0x3872b2,_0x5dde60,_0x5e9810){UserVoiceQueueRtEvents[_0xa044('0x5')](_0x5924c4+':'+_0x3872b2['id'],_0x3872b2);UserVoiceQueueRtEvents['emit'](_0x5924c4,_0x3872b2);_0x5e9810(null);};}for(var e in events){if(events[_0xa044('0x6')](e)){var event=events[e];UserVoiceQueueRt['hook'](e,emitEvent(event));}}module[_0xa044('0x7')]=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index 0181331..2214faa 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 _0x9a58=['define','UserVoiceQueueRt','user_has_voice_queues_rt','lodash','util','../../config/logger','api','moment','path','../../config/environment','./userVoiceQueueRt.attributes','exports'];(function(_0x1ea028,_0x51e905){var _0x54ea93=function(_0x35ad17){while(--_0x35ad17){_0x1ea028['push'](_0x1ea028['shift']());}};_0x54ea93(++_0x51e905);}(_0x9a58,0x7b));var _0x89a5=function(_0x32f6b9,_0x2d4aa9){_0x32f6b9=_0x32f6b9-0x0;var _0x267d52=_0x9a58[_0x32f6b9];return _0x267d52;};'use strict';var _=require(_0x89a5('0x0'));var util=require(_0x89a5('0x1'));var logger=require(_0x89a5('0x2'))(_0x89a5('0x3'));var moment=require(_0x89a5('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x89a5('0x5'));var rimraf=require('rimraf');var config=require(_0x89a5('0x6'));var attributes=require(_0x89a5('0x7'));module[_0x89a5('0x8')]=function(_0x29916e,_0x2dbf7a){return _0x29916e[_0x89a5('0x9')](_0x89a5('0xa'),attributes,{'tableName':_0x89a5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1ff5=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','lodash','../../config/logger','api'];(function(_0x3f0a71,_0x47ece4){var _0x308419=function(_0x434828){while(--_0x434828){_0x3f0a71['push'](_0x3f0a71['shift']());}};_0x308419(++_0x47ece4);}(_0x1ff5,0x16f));var _0x51ff=function(_0x5d3543,_0x5cbacd){_0x5d3543=_0x5d3543-0x0;var _0x210843=_0x1ff5[_0x5d3543];return _0x210843;};'use strict';var _=require(_0x51ff('0x0'));var util=require('util');var logger=require(_0x51ff('0x1'))(_0x51ff('0x2'));var moment=require(_0x51ff('0x3'));var BPromise=require(_0x51ff('0x4'));var rp=require(_0x51ff('0x5'));var fs=require('fs');var path=require(_0x51ff('0x6'));var rimraf=require(_0x51ff('0x7'));var config=require(_0x51ff('0x8'));var attributes=require('./userVoiceQueueRt.attributes');module[_0x51ff('0x9')]=function(_0x54d993,_0x536c5f){return _0x54d993['define']('UserVoiceQueueRt',attributes,{'tableName':'user_has_voice_queues_rt','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 d0110f8..a4c0f7b 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 _0x48df=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','localhost','socket.io-emitter','redis','./userVoiceQueueRt.socket','request','then','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','UserVoiceQueueRt','findAll','options','raw','where','sequelize','COUNT','`paused`\x20=\x201,\x201,\x20null','GetVoiceQueueRtPauses','util','moment','ioredis'];(function(_0x5c686b,_0x47c7e5){var _0x366ea9=function(_0x5da208){while(--_0x5da208){_0x5c686b['push'](_0x5c686b['shift']());}};_0x366ea9(++_0x47c7e5);}(_0x48df,0xb6));var _0xf48d=function(_0x8a969d,_0x339d9f){_0x8a969d=_0x8a969d-0x0;var _0x1d8dc7=_0x48df[_0x8a969d];return _0x1d8dc7;};'use strict';var _=require('lodash');var util=require(_0xf48d('0x0'));var moment=require(_0xf48d('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf48d('0x2'));var db=require(_0xf48d('0x3'))['db'];var utils=require(_0xf48d('0x4'));var logger=require(_0xf48d('0x5'))(_0xf48d('0x6'));var config=require(_0xf48d('0x7'));var jayson=require(_0xf48d('0x8'));var client=jayson[_0xf48d('0x9')][_0xf48d('0xa')]({'port':0x232a});config['redis']=_[_0xf48d('0xb')](config['redis'],{'host':_0xf48d('0xc'),'port':0x18eb});var socket=require(_0xf48d('0xd'))(new Redis(config[_0xf48d('0xe')]));require(_0xf48d('0xf'))['register'](socket);function respondWithRpcPromise(_0x49a09c,_0x4b5346,_0x943ce){return new BPromise(function(_0x23baad,_0x4d6484){return client[_0xf48d('0x10')](_0x49a09c,_0x943ce)[_0xf48d('0x11')](function(_0xde4da){logger[_0xf48d('0x12')](_0xf48d('0x13'),_0x4b5346,_0xf48d('0x14'));logger[_0xf48d('0x15')]('UserVoiceQueueRt,\x20%s,\x20%s,\x20%s',_0x4b5346,_0xf48d('0x14'),JSON[_0xf48d('0x16')](_0xde4da));if(_0xde4da[_0xf48d('0x17')]){if(_0xde4da[_0xf48d('0x17')][_0xf48d('0x18')]===0x1f4){logger[_0xf48d('0x17')](_0xf48d('0x13'),_0x4b5346,_0xde4da[_0xf48d('0x17')][_0xf48d('0x19')]);return _0x4d6484(_0xde4da['error'][_0xf48d('0x19')]);}logger[_0xf48d('0x17')](_0xf48d('0x13'),_0x4b5346,_0xde4da[_0xf48d('0x17')]['message']);return _0x23baad(_0xde4da[_0xf48d('0x17')][_0xf48d('0x19')]);}else{logger[_0xf48d('0x12')](_0xf48d('0x13'),_0x4b5346,_0xf48d('0x14'));_0x23baad(_0xde4da[_0xf48d('0x1a')]['message']);}})[_0xf48d('0x1b')](function(_0x11eded){logger[_0xf48d('0x17')](_0xf48d('0x13'),_0x4b5346,_0x11eded);_0x4d6484(_0x11eded);});});}exports['GetVoiceQueueRtPauses']=function(_0x4cce47){var _0x504bd3=this;return new Promise(function(_0x39f57e,_0x4d41e7){return db[_0xf48d('0x1c')][_0xf48d('0x1d')]({'raw':_0x4cce47[_0xf48d('0x1e')]?_0x4cce47[_0xf48d('0x1e')][_0xf48d('0x1f')]===undefined?!![]:![]:!![],'where':_0x4cce47['options']?_0x4cce47[_0xf48d('0x1e')][_0xf48d('0x20')]||null:null,'attributes':[[db[_0xf48d('0x21')]['fn'](_0xf48d('0x22'),db[_0xf48d('0x21')]['fn']('IF',db[_0xf48d('0x21')]['literal'](_0xf48d('0x23')))),'outboundQueuePauses']]})[_0xf48d('0x11')](function(_0x49ccdf){logger[_0xf48d('0x12')]('GetVoiceQueueRtPauses',_0x4cce47);logger[_0xf48d('0x15')](_0xf48d('0x24'),_0x4cce47,JSON['stringify'](_0x49ccdf));_0x39f57e(_0x49ccdf);})[_0xf48d('0x1b')](function(_0x2c2cca){logger['error']('GetVoiceQueueRtPauses',_0x2c2cca[_0xf48d('0x19')],_0x4cce47);_0x4d41e7(_0x504bd3[_0xf48d('0x17')](0x1f4,_0x2c2cca[_0xf48d('0x19')]));});});}; \ No newline at end of file +var _0xe08a=['info','result','catch','UserVoiceQueueRt','findAll','options','raw','where','sequelize','COUNT','literal','outboundQueuePauses','GetVoiceQueueRtPauses','debug','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','defaults','redis','localhost','socket.io-emitter','./userVoiceQueueRt.socket','register','request\x20sent','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','UserVoiceQueueRt,\x20%s,\x20%s','message'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xe08a,0x9e));var _0xae08=function(_0x4661f4,_0x50c5ec){_0x4661f4=_0x4661f4-0x0;var _0x690188=_0xe08a[_0x4661f4];return _0x690188;};'use strict';var _=require(_0xae08('0x0'));var util=require(_0xae08('0x1'));var moment=require(_0xae08('0x2'));var BPromise=require(_0xae08('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xae08('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xae08('0x5'));var logger=require(_0xae08('0x6'))('rpc');var config=require(_0xae08('0x7'));var jayson=require(_0xae08('0x8'));var client=jayson['client'][_0xae08('0x9')]({'port':0x232a});config['redis']=_[_0xae08('0xa')](config[_0xae08('0xb')],{'host':_0xae08('0xc'),'port':0x18eb});var socket=require(_0xae08('0xd'))(new Redis(config[_0xae08('0xb')]));require(_0xae08('0xe'))[_0xae08('0xf')](socket);function respondWithRpcPromise(_0x1a8fe5,_0x554641,_0x14da75){return new BPromise(function(_0x53a912,_0x2f90f7){return client['request'](_0x1a8fe5,_0x14da75)['then'](function(_0x38a0f5){logger['info']('UserVoiceQueueRt,\x20%s,\x20%s',_0x554641,_0xae08('0x10'));logger['debug'](_0xae08('0x11'),_0x554641,_0xae08('0x10'),JSON[_0xae08('0x12')](_0x38a0f5));if(_0x38a0f5[_0xae08('0x13')]){if(_0x38a0f5[_0xae08('0x13')]['code']===0x1f4){logger[_0xae08('0x13')](_0xae08('0x14'),_0x554641,_0x38a0f5['error']['message']);return _0x2f90f7(_0x38a0f5[_0xae08('0x13')][_0xae08('0x15')]);}logger[_0xae08('0x13')](_0xae08('0x14'),_0x554641,_0x38a0f5['error'][_0xae08('0x15')]);return _0x53a912(_0x38a0f5[_0xae08('0x13')]['message']);}else{logger[_0xae08('0x16')](_0xae08('0x14'),_0x554641,_0xae08('0x10'));_0x53a912(_0x38a0f5[_0xae08('0x17')][_0xae08('0x15')]);}})[_0xae08('0x18')](function(_0x53c07d){logger[_0xae08('0x13')](_0xae08('0x14'),_0x554641,_0x53c07d);_0x2f90f7(_0x53c07d);});});}exports['GetVoiceQueueRtPauses']=function(_0x5a7a03){var _0xb43be2=this;return new Promise(function(_0x5eaceb,_0x44dbb2){return db[_0xae08('0x19')][_0xae08('0x1a')]({'raw':_0x5a7a03['options']?_0x5a7a03[_0xae08('0x1b')][_0xae08('0x1c')]===undefined?!![]:![]:!![],'where':_0x5a7a03[_0xae08('0x1b')]?_0x5a7a03[_0xae08('0x1b')][_0xae08('0x1d')]||null:null,'attributes':[[db[_0xae08('0x1e')]['fn'](_0xae08('0x1f'),db['sequelize']['fn']('IF',db[_0xae08('0x1e')][_0xae08('0x20')]('`paused`\x20=\x201,\x201,\x20null'))),_0xae08('0x21')]]})['then'](function(_0x50d510){logger[_0xae08('0x16')](_0xae08('0x22'),_0x5a7a03);logger[_0xae08('0x23')](_0xae08('0x22'),_0x5a7a03,JSON[_0xae08('0x12')](_0x50d510));_0x5eaceb(_0x50d510);})['catch'](function(_0x31c61a){logger[_0xae08('0x13')](_0xae08('0x22'),_0x31c61a['message'],_0x5a7a03);_0x44dbb2(_0xb43be2[_0xae08('0x13')](0x1f4,_0x31c61a[_0xae08('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index 8e4a353..a19f872 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 _0x1a28=['update','removeListener','length','userVoiceQueueRt:','./userVoiceQueueRt.events','save','remove'];(function(_0x15ba60,_0x384469){var _0x1cec65=function(_0x12ff5a){while(--_0x12ff5a){_0x15ba60['push'](_0x15ba60['shift']());}};_0x1cec65(++_0x384469);}(_0x1a28,0x10e));var _0x81a2=function(_0x38aeea,_0x57522a){_0x38aeea=_0x38aeea-0x0;var _0x5e8d2c=_0x1a28[_0x38aeea];return _0x5e8d2c;};'use strict';var UserVoiceQueueRtEvents=require(_0x81a2('0x0'));var events=[_0x81a2('0x1'),_0x81a2('0x2'),_0x81a2('0x3')];function createListener(_0x46ac8d,_0x19b137){return function(_0x5e5b20){_0x19b137['emit'](_0x46ac8d,_0x5e5b20);};}function removeListener(_0x350cfe,_0x41fa0c){return function(){UserVoiceQueueRtEvents[_0x81a2('0x4')](_0x350cfe,_0x41fa0c);};}exports['register']=function(_0x4188d7){for(var _0x20dcd4=0x0,_0x597932=events[_0x81a2('0x5')];_0x20dcd4<_0x597932;_0x20dcd4++){var _0x2aa66f=events[_0x20dcd4];var _0x453392=createListener(_0x81a2('0x6')+_0x2aa66f,_0x4188d7);UserVoiceQueueRtEvents['on'](_0x2aa66f,_0x453392);}}; \ No newline at end of file +var _0xbd18=['./userVoiceQueueRt.events','save','remove','length','userVoiceQueueRt:'];(function(_0x313b66,_0x2e5bcc){var _0x59e027=function(_0x466dec){while(--_0x466dec){_0x313b66['push'](_0x313b66['shift']());}};_0x59e027(++_0x2e5bcc);}(_0xbd18,0x195));var _0x8bd1=function(_0x1b29dc,_0x5f0020){_0x1b29dc=_0x1b29dc-0x0;var _0x43b99c=_0xbd18[_0x1b29dc];return _0x43b99c;};'use strict';var UserVoiceQueueRtEvents=require(_0x8bd1('0x0'));var events=[_0x8bd1('0x1'),_0x8bd1('0x2'),'update'];function createListener(_0x95654,_0x56d5e6){return function(_0x59e1d9){_0x56d5e6['emit'](_0x95654,_0x59e1d9);};}function removeListener(_0x2cdea7,_0x113554){return function(){UserVoiceQueueRtEvents['removeListener'](_0x2cdea7,_0x113554);};}exports['register']=function(_0x205c76){for(var _0x136254=0x0,_0x325bed=events[_0x8bd1('0x3')];_0x136254<_0x325bed;_0x136254++){var _0x49254d=events[_0x136254];var _0x13d571=createListener(_0x8bd1('0x4')+_0x49254d,_0x205c76);UserVoiceQueueRtEvents['on'](_0x49254d,_0x13d571);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index 6d9bbd9..e9298f2 100644 --- a/server/api/userWhatsappQueue/index.js +++ b/server/api/userWhatsappQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x4529a6,_0x36ec60){var _0x13b3d7=function(_0x559761){while(--_0x559761){_0x4529a6['push'](_0x4529a6['shift']());}};_0x13b3d7(++_0x36ec60);}(_0xe706,0xa3));var _0x6e70=function(_0x2e11d3,_0x26a29a){_0x2e11d3=_0x2e11d3-0x0;var _0x3f7f7f=_0xe706[_0x2e11d3];return _0x3f7f7f;};'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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x9b9752,_0x1b1943){var _0x21c891=function(_0x4106e5){while(--_0x4106e5){_0x9b9752['push'](_0x9b9752['shift']());}};_0x21c891(++_0x1b1943);}(_0x70e0,0x17b));var _0x070e=function(_0x5ed5d4,_0x2f376a){_0x5ed5d4=_0x5ed5d4-0x0;var _0x2914a7=_0x70e0[_0x5ed5d4];return _0x2914a7;};'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/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index c9db5e0..dea6ba1 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 _0xd845=['INTEGER','sequelize','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd845,0x1e1));var _0x5d84=function(_0x186376,_0x5d988a){_0x186376=_0x186376-0x0;var _0x2dbdd9=_0xd845[_0x186376];return _0x2dbdd9;};'use strict';var Sequelize=require(_0x5d84('0x0'));module[_0x5d84('0x1')]={'penalty':{'type':Sequelize[_0x5d84('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xdc68=['exports','INTEGER','sequelize'];(function(_0x5fe1a4,_0x31cb33){var _0xb14841=function(_0x5bf0e9){while(--_0x5bf0e9){_0x5fe1a4['push'](_0x5fe1a4['shift']());}};_0xb14841(++_0x31cb33);}(_0xdc68,0x16d));var _0x8dc6=function(_0x205d8c,_0xa496d6){_0x205d8c=_0x205d8c-0x0;var _0x1aa6df=_0xdc68[_0x205d8c];return _0x1aa6df;};'use strict';var Sequelize=require(_0x8dc6('0x0'));module[_0x8dc6('0x1')]={'penalty':{'type':Sequelize[_0x8dc6('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 3a2dc99..e3efa04 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 _0x2dcf=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports','define','user_has_whatsapp_queues','lodash','util'];(function(_0x1a4a06,_0x36a5c2){var _0x49ec08=function(_0x497f24){while(--_0x497f24){_0x1a4a06['push'](_0x1a4a06['shift']());}};_0x49ec08(++_0x36a5c2);}(_0x2dcf,0x172));var _0xf2dc=function(_0x10bda8,_0x1090dc){_0x10bda8=_0x10bda8-0x0;var _0x5c5448=_0x2dcf[_0x10bda8];return _0x5c5448;};'use strict';var _=require(_0xf2dc('0x0'));var util=require(_0xf2dc('0x1'));var logger=require(_0xf2dc('0x2'))(_0xf2dc('0x3'));var moment=require(_0xf2dc('0x4'));var BPromise=require(_0xf2dc('0x5'));var rp=require(_0xf2dc('0x6'));var fs=require('fs');var path=require(_0xf2dc('0x7'));var rimraf=require(_0xf2dc('0x8'));var config=require('../../config/environment');var attributes=require('./userWhatsappQueue.attributes');module[_0xf2dc('0x9')]=function(_0x37dfb1,_0x349aed){return _0x37dfb1[_0xf2dc('0xa')]('UserWhatsappQueue',attributes,{'tableName':_0xf2dc('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1b54=['../../config/environment','./userWhatsappQueue.attributes','UserWhatsappQueue','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x18d631,_0x4376d2){var _0x50d708=function(_0x3b6ab5){while(--_0x3b6ab5){_0x18d631['push'](_0x18d631['shift']());}};_0x50d708(++_0x4376d2);}(_0x1b54,0x15b));var _0x41b5=function(_0x433e80,_0x80753f){_0x433e80=_0x433e80-0x0;var _0x3d0725=_0x1b54[_0x433e80];return _0x3d0725;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x41b5('0x0'))(_0x41b5('0x1'));var moment=require(_0x41b5('0x2'));var BPromise=require(_0x41b5('0x3'));var rp=require(_0x41b5('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x41b5('0x5'));var attributes=require(_0x41b5('0x6'));module['exports']=function(_0x3d11df,_0x72a0c7){return _0x3d11df['define'](_0x41b5('0x7'),attributes,{'tableName':'user_has_whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js b/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js index 809f34e..bfc5c95 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 _0xf1ac=['request','then','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','util','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x20f287,_0x2a0832){var _0x2bfe11=function(_0x3eb9ce){while(--_0x3eb9ce){_0x20f287['push'](_0x20f287['shift']());}};_0x2bfe11(++_0x2a0832);}(_0xf1ac,0x171));var _0xcf1a=function(_0x58fc2f,_0x111399){_0x58fc2f=_0x58fc2f-0x0;var _0x3a1312=_0xf1ac[_0x58fc2f];return _0x3a1312;};'use strict';var _=require('lodash');var util=require(_0xcf1a('0x0'));var moment=require('moment');var BPromise=require(_0xcf1a('0x1'));var rs=require(_0xcf1a('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xcf1a('0x3'));var logger=require(_0xcf1a('0x4'))(_0xcf1a('0x5'));var config=require(_0xcf1a('0x6'));var jayson=require(_0xcf1a('0x7'));var client=jayson[_0xcf1a('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x487517,_0x41cb4d,_0xd3f67b){return new BPromise(function(_0x146120,_0x5d474b){return client[_0xcf1a('0x9')](_0x487517,_0xd3f67b)[_0xcf1a('0xa')](function(_0xe966c8){logger['info'](_0xcf1a('0xb'),_0x41cb4d,_0xcf1a('0xc'));logger[_0xcf1a('0xd')](_0xcf1a('0xe'),_0x41cb4d,_0xcf1a('0xc'),JSON[_0xcf1a('0xf')](_0xe966c8));if(_0xe966c8[_0xcf1a('0x10')]){if(_0xe966c8[_0xcf1a('0x10')][_0xcf1a('0x11')]===0x1f4){logger[_0xcf1a('0x10')](_0xcf1a('0xb'),_0x41cb4d,_0xe966c8[_0xcf1a('0x10')][_0xcf1a('0x12')]);return _0x5d474b(_0xe966c8[_0xcf1a('0x10')][_0xcf1a('0x12')]);}logger['error'](_0xcf1a('0xb'),_0x41cb4d,_0xe966c8[_0xcf1a('0x10')][_0xcf1a('0x12')]);return _0x146120(_0xe966c8[_0xcf1a('0x10')][_0xcf1a('0x12')]);}else{logger[_0xcf1a('0x13')](_0xcf1a('0xb'),_0x41cb4d,_0xcf1a('0xc'));_0x146120(_0xe966c8['result']['message']);}})[_0xcf1a('0x14')](function(_0x22a75c){logger[_0xcf1a('0x10')](_0xcf1a('0xb'),_0x41cb4d,_0x22a75c);_0x5d474b(_0x22a75c);});});} \ No newline at end of file +var _0x2d03=['../../config/utils','rpc','../../config/environment','jayson/promise','client','then','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x3e88fa,_0x225a23){var _0x76c38e=function(_0x1b6d34){while(--_0x1b6d34){_0x3e88fa['push'](_0x3e88fa['shift']());}};_0x76c38e(++_0x225a23);}(_0x2d03,0x145));var _0x32d0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2d03[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x32d0('0x0'));var moment=require('moment');var BPromise=require(_0x32d0('0x1'));var rs=require(_0x32d0('0x2'));var fs=require('fs');var Redis=require(_0x32d0('0x3'));var db=require(_0x32d0('0x4'))['db'];var utils=require(_0x32d0('0x5'));var logger=require('../../config/logger')(_0x32d0('0x6'));var config=require(_0x32d0('0x7'));var jayson=require(_0x32d0('0x8'));var client=jayson[_0x32d0('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4b481d,_0x20e30e,_0x5763b0){return new BPromise(function(_0x31d778,_0x14bdf6){return client['request'](_0x4b481d,_0x5763b0)[_0x32d0('0xa')](function(_0x26106a){logger[_0x32d0('0xb')](_0x32d0('0xc'),_0x20e30e,_0x32d0('0xd'));logger[_0x32d0('0xe')](_0x32d0('0xf'),_0x20e30e,_0x32d0('0xd'),JSON[_0x32d0('0x10')](_0x26106a));if(_0x26106a['error']){if(_0x26106a[_0x32d0('0x11')][_0x32d0('0x12')]===0x1f4){logger[_0x32d0('0x11')](_0x32d0('0xc'),_0x20e30e,_0x26106a[_0x32d0('0x11')]['message']);return _0x14bdf6(_0x26106a[_0x32d0('0x11')][_0x32d0('0x13')]);}logger[_0x32d0('0x11')]('UserWhatsappQueue,\x20%s,\x20%s',_0x20e30e,_0x26106a[_0x32d0('0x11')]['message']);return _0x31d778(_0x26106a[_0x32d0('0x11')][_0x32d0('0x13')]);}else{logger['info'](_0x32d0('0xc'),_0x20e30e,_0x32d0('0xd'));_0x31d778(_0x26106a[_0x32d0('0x14')]['message']);}})[_0x32d0('0x15')](function(_0x32b80a){logger[_0x32d0('0x11')](_0x32d0('0xc'),_0x20e30e,_0x32b80a);_0x14bdf6(_0x32b80a);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index fd2df48..982d1e2 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 _0x8e94=['../../components/auth/service','get','isAuthenticated','post','create','put','update','/:id','destroy','exports','multer','util','connect-timeout','Router'];(function(_0x13a9d4,_0x165963){var _0x911f0f=function(_0x4d0770){while(--_0x4d0770){_0x13a9d4['push'](_0x13a9d4['shift']());}};_0x911f0f(++_0x165963);}(_0x8e94,0xf8));var _0x48e9=function(_0x2842b4,_0x2b1b7b){_0x2842b4=_0x2842b4-0x0;var _0x2b9521=_0x8e94[_0x2842b4];return _0x2b9521;};'use strict';var multer=require(_0x48e9('0x0'));var util=require(_0x48e9('0x1'));var path=require('path');var timeout=require(_0x48e9('0x2'));var express=require('express');var router=express[_0x48e9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x48e9('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./variable.controller');router[_0x48e9('0x5')]('/',auth[_0x48e9('0x6')](),controller['index']);router[_0x48e9('0x5')]('/:id',auth[_0x48e9('0x6')](),controller['show']);router[_0x48e9('0x7')]('/',auth[_0x48e9('0x6')](),controller[_0x48e9('0x8')]);router[_0x48e9('0x9')]('/:id',auth[_0x48e9('0x6')](),controller[_0x48e9('0xa')]);router['delete'](_0x48e9('0xb'),auth['isAuthenticated'](),controller[_0x48e9('0xc')]);module[_0x48e9('0xd')]=router; \ No newline at end of file +var _0x4944=['index','/:id','show','post','create','put','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./variable.controller','get','isAuthenticated'];(function(_0xfbfcf5,_0x16f7e8){var _0x438726=function(_0xdfcf7e){while(--_0xdfcf7e){_0xfbfcf5['push'](_0xfbfcf5['shift']());}};_0x438726(++_0x16f7e8);}(_0x4944,0x6d));var _0x4494=function(_0x3f8e2d,_0x52723a){_0x3f8e2d=_0x3f8e2d-0x0;var _0x3a980a=_0x4944[_0x3f8e2d];return _0x3a980a;};'use strict';var multer=require(_0x4494('0x0'));var util=require('util');var path=require(_0x4494('0x1'));var timeout=require(_0x4494('0x2'));var express=require(_0x4494('0x3'));var router=express[_0x4494('0x4')]();var fs_extra=require(_0x4494('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x4494('0x6'));var config=require('../../config/environment');var controller=require(_0x4494('0x7'));router[_0x4494('0x8')]('/',auth[_0x4494('0x9')](),controller[_0x4494('0xa')]);router[_0x4494('0x8')](_0x4494('0xb'),auth[_0x4494('0x9')](),controller[_0x4494('0xc')]);router[_0x4494('0xd')]('/',auth['isAuthenticated'](),controller[_0x4494('0xe')]);router[_0x4494('0xf')](_0x4494('0xb'),auth[_0x4494('0x9')](),controller['update']);router['delete'](_0x4494('0xb'),auth[_0x4494('0x9')](),controller[_0x4494('0x10')]);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 3068d09..e2ec225 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 _0x5331=['STRING','name','sequelize','exports'];(function(_0x4ce978,_0x23923){var _0x2db47d=function(_0x42141f){while(--_0x42141f){_0x4ce978['push'](_0x4ce978['shift']());}};_0x2db47d(++_0x23923);}(_0x5331,0x112));var _0x1533=function(_0x4d6127,_0x471fc6){_0x4d6127=_0x4d6127-0x0;var _0x4fe144=_0x5331[_0x4d6127];return _0x4fe144;};'use strict';var Sequelize=require(_0x1533('0x0'));module[_0x1533('0x1')]={'name':{'type':Sequelize[_0x1533('0x2')],'unique':_0x1533('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x1533('0x2')]}}; \ No newline at end of file +var _0x02ca=['name','STRING','exports'];(function(_0x41f690,_0x39c670){var _0x40cff3=function(_0x561100){while(--_0x561100){_0x41f690['push'](_0x41f690['shift']());}};_0x40cff3(++_0x39c670);}(_0x02ca,0x197));var _0xa02c=function(_0x329a15,_0x4723b6){_0x329a15=_0x329a15-0x0;var _0x53496b=_0x02ca[_0x329a15];return _0x53496b;};'use strict';var Sequelize=require('sequelize');module[_0xa02c('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0xa02c('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xa02c('0x2')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index d2d15fd..5bfeb30 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 _0x1a34=['destroy','get','Variables','UserProfileResource','sendStatus','error','stack','send','index','map','Variable','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','rows','show','params','keys','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','name','find','fast-json-patch','request-promise','moment','mustache','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','save','update','then'];(function(_0x19e9cf,_0x5b83e4){var _0x3d32b6=function(_0x37c803){while(--_0x37c803){_0x19e9cf['push'](_0x19e9cf['shift']());}};_0x3d32b6(++_0x5b83e4);}(_0x1a34,0x177));var _0x41a3=function(_0x4416c1,_0x1a3fa2){_0x4416c1=_0x4416c1-0x0;var _0x2afb99=_0x1a34[_0x4416c1];return _0x2afb99;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x41a3('0x0'));var rp=require(_0x41a3('0x1'));var moment=require(_0x41a3('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x41a3('0x3'));var util=require('util');var path=require('path');var sox=require(_0x41a3('0x4'));var csv=require(_0x41a3('0x5'));var ejs=require(_0x41a3('0x6'));var fs=require('fs');var fs_extra=require(_0x41a3('0x7'));var _=require(_0x41a3('0x8'));var squel=require('squel');var crypto=require(_0x41a3('0x9'));var jsforce=require(_0x41a3('0xa'));var deskjs=require(_0x41a3('0xb'));var toCsv=require(_0x41a3('0x5'));var querystring=require(_0x41a3('0xc'));var Papa=require('papaparse');var Redis=require(_0x41a3('0xd'));var authService=require(_0x41a3('0xe'));var qs=require(_0x41a3('0xf'));var as=require(_0x41a3('0x10'));var hardwareService=require(_0x41a3('0x11'));var logger=require('../../config/logger')(_0x41a3('0x12'));var utils=require(_0x41a3('0x13'));var config=require(_0x41a3('0x14'));var licenseUtil=require(_0x41a3('0x15'));var db=require(_0x41a3('0x16'))['db'];function respondWithStatusCode(_0xca507c,_0x51bd2a){_0x51bd2a=_0x51bd2a||0xcc;return function(_0x16e699){if(_0x16e699){return _0xca507c['sendStatus'](_0x51bd2a);}return _0xca507c['status'](_0x51bd2a)[_0x41a3('0x17')]();};}function respondWithResult(_0x3fc85c,_0x256da4){_0x256da4=_0x256da4||0xc8;return function(_0x29068c){if(_0x29068c){return _0x3fc85c[_0x41a3('0x18')](_0x256da4)[_0x41a3('0x19')](_0x29068c);}};}function respondWithFilteredResult(_0x4b4ed4,_0x37cf84){return function(_0x2338a4){if(_0x2338a4){var _0x29391e=typeof _0x37cf84[_0x41a3('0x1a')]===_0x41a3('0x1b')&&typeof _0x37cf84[_0x41a3('0x1c')]==='undefined';var _0x47637e=_0x2338a4['count'];var _0x403a28=_0x29391e?0x0:_0x37cf84[_0x41a3('0x1a')];var _0x558c76=_0x29391e?_0x2338a4[_0x41a3('0x1d')]:_0x37cf84[_0x41a3('0x1a')]+_0x37cf84[_0x41a3('0x1c')];var _0x4d9652;if(_0x558c76>=_0x47637e){_0x558c76=_0x47637e;_0x4d9652=0xc8;}else{_0x4d9652=0xce;}_0x4b4ed4[_0x41a3('0x18')](_0x4d9652);return _0x4b4ed4[_0x41a3('0x1e')](_0x41a3('0x1f'),_0x403a28+'-'+_0x558c76+'/'+_0x47637e)['json'](_0x2338a4);}return null;};}function patchUpdates(_0x45622a){return function(_0x306984){try{jsonpatch['apply'](_0x306984,_0x45622a,!![]);}catch(_0x5c310f){return BPromise['reject'](_0x5c310f);}return _0x306984[_0x41a3('0x20')]();};}function saveUpdates(_0x353bfe,_0x31c299){return function(_0xd22d5c){if(_0xd22d5c){return _0xd22d5c[_0x41a3('0x21')](_0x353bfe)[_0x41a3('0x22')](function(_0x5cc921){return _0x5cc921;});}return null;};}function removeEntity(_0x16e849,_0x15d4ad){return function(_0x384d5b){if(_0x384d5b){return _0x384d5b[_0x41a3('0x23')]()[_0x41a3('0x22')](function(){var _0x648469=_0x384d5b[_0x41a3('0x24')]({'plain':!![]});var _0x4a4423=_0x41a3('0x25');return db[_0x41a3('0x26')][_0x41a3('0x23')]({'where':{'type':_0x4a4423,'resourceId':_0x648469['id']}})[_0x41a3('0x22')](function(){return _0x384d5b;});})[_0x41a3('0x22')](function(){_0x16e849[_0x41a3('0x18')](0xcc)[_0x41a3('0x17')]();});}};}function handleEntityNotFound(_0xab8fd6,_0x2e21d6){return function(_0xaf2664){if(!_0xaf2664){_0xab8fd6[_0x41a3('0x27')](0x194);}return _0xaf2664;};}function handleError(_0x338149,_0x2d354d){_0x2d354d=_0x2d354d||0x1f4;return function(_0x55b014){logger[_0x41a3('0x28')](_0x55b014[_0x41a3('0x29')]);if(_0x55b014['name']){delete _0x55b014['name'];}_0x338149['status'](_0x2d354d)[_0x41a3('0x2a')](_0x55b014);};}exports[_0x41a3('0x2b')]=function(_0x2644d3,_0x153b51){var _0x394f42={},_0x208bb5={},_0x52e560={'count':0x0,'rows':[]};var _0xb8364b=_[_0x41a3('0x2c')](db[_0x41a3('0x2d')][_0x41a3('0x2e')],function(_0x4dbffe){return{'name':_0x4dbffe[_0x41a3('0x2f')],'type':_0x4dbffe['type'][_0x41a3('0x30')]};});_0x208bb5[_0x41a3('0x31')]=_[_0x41a3('0x2c')](_0xb8364b,'name');_0x208bb5[_0x41a3('0x32')]=_['keys'](_0x2644d3[_0x41a3('0x32')]);_0x208bb5[_0x41a3('0x33')]=_[_0x41a3('0x34')](_0x208bb5[_0x41a3('0x31')],_0x208bb5[_0x41a3('0x32')]);_0x394f42[_0x41a3('0x35')]=_[_0x41a3('0x34')](_0x208bb5['model'],qs[_0x41a3('0x36')](_0x2644d3[_0x41a3('0x32')]['fields']));_0x394f42['attributes']=_0x394f42[_0x41a3('0x35')][_0x41a3('0x37')]?_0x394f42['attributes']:_0x208bb5[_0x41a3('0x31')];if(!_0x2644d3['query'][_0x41a3('0x38')]('nolimit')){_0x394f42[_0x41a3('0x1c')]=qs[_0x41a3('0x1c')](_0x2644d3[_0x41a3('0x32')]['limit']);_0x394f42[_0x41a3('0x1a')]=qs[_0x41a3('0x1a')](_0x2644d3[_0x41a3('0x32')][_0x41a3('0x1a')]);}_0x394f42['order']=qs[_0x41a3('0x39')](_0x2644d3[_0x41a3('0x32')][_0x41a3('0x39')]);_0x394f42[_0x41a3('0x3a')]=qs[_0x41a3('0x33')](_[_0x41a3('0x3b')](_0x2644d3[_0x41a3('0x32')],_0x208bb5['filters']),_0xb8364b);if(_0x2644d3[_0x41a3('0x32')][_0x41a3('0x3c')]){_0x394f42[_0x41a3('0x3a')]=_[_0x41a3('0x3d')](_0x394f42[_0x41a3('0x3a')],{'$or':_[_0x41a3('0x2c')](_0xb8364b,function(_0x25aff3){if(_0x25aff3[_0x41a3('0x3e')]!==_0x41a3('0x3f')){var _0x4954db={};_0x4954db[_0x25aff3['name']]={'$like':'%'+_0x2644d3[_0x41a3('0x32')][_0x41a3('0x3c')]+'%'};return _0x4954db;}})});}_0x394f42=_[_0x41a3('0x3d')]({},_0x394f42,_0x2644d3[_0x41a3('0x40')]);var _0x9ce65={'where':_0x394f42['where']};return db[_0x41a3('0x2d')][_0x41a3('0x1d')](_0x9ce65)[_0x41a3('0x22')](function(_0x2db3a2){_0x52e560[_0x41a3('0x1d')]=_0x2db3a2;if(_0x2644d3['query'][_0x41a3('0x41')]){_0x394f42[_0x41a3('0x42')]=[{'all':!![]}];}return db[_0x41a3('0x2d')]['findAll'](_0x394f42);})['then'](function(_0x3c5c5d){_0x52e560[_0x41a3('0x43')]=_0x3c5c5d;return _0x52e560;})[_0x41a3('0x22')](respondWithFilteredResult(_0x153b51,_0x394f42))['catch'](handleError(_0x153b51,null));};exports[_0x41a3('0x44')]=function(_0x2d55ed,_0x3f677a){var _0x10fd79={'raw':!![],'where':{'id':_0x2d55ed[_0x41a3('0x45')]['id']}},_0x57bb4d={};_0x57bb4d[_0x41a3('0x31')]=_['keys'](db['Variable'][_0x41a3('0x2e')]);_0x57bb4d[_0x41a3('0x32')]=_[_0x41a3('0x46')](_0x2d55ed[_0x41a3('0x32')]);_0x57bb4d[_0x41a3('0x33')]=_['intersection'](_0x57bb4d[_0x41a3('0x31')],_0x57bb4d[_0x41a3('0x32')]);_0x10fd79[_0x41a3('0x35')]=_[_0x41a3('0x34')](_0x57bb4d[_0x41a3('0x31')],qs[_0x41a3('0x36')](_0x2d55ed['query'][_0x41a3('0x36')]));_0x10fd79[_0x41a3('0x35')]=_0x10fd79[_0x41a3('0x35')][_0x41a3('0x37')]?_0x10fd79[_0x41a3('0x35')]:_0x57bb4d[_0x41a3('0x31')];if(_0x2d55ed[_0x41a3('0x32')]['includeAll']){_0x10fd79[_0x41a3('0x42')]=[{'all':!![]}];}_0x10fd79=_[_0x41a3('0x3d')]({},_0x10fd79,_0x2d55ed[_0x41a3('0x40')]);return db[_0x41a3('0x2d')]['find'](_0x10fd79)['then'](handleEntityNotFound(_0x3f677a,null))[_0x41a3('0x22')](respondWithResult(_0x3f677a,null))[_0x41a3('0x47')](handleError(_0x3f677a,null));};exports[_0x41a3('0x48')]=function(_0x243e57,_0x267ebb){return db[_0x41a3('0x2d')][_0x41a3('0x48')](_0x243e57[_0x41a3('0x49')],{})[_0x41a3('0x22')](function(_0x23942a){var _0x4dc1c6=_0x243e57[_0x41a3('0x4a')][_0x41a3('0x24')]({'plain':!![]});if(!_0x4dc1c6)throw new Error(_0x41a3('0x4b'));if(_0x4dc1c6[_0x41a3('0x4c')]===_0x41a3('0x4a')){var _0x568c8a=_0x23942a[_0x41a3('0x24')]({'plain':!![]});var _0x3ec550=_0x41a3('0x25');return db[_0x41a3('0x4d')]['find']({'where':{'name':_0x3ec550,'userProfileId':_0x4dc1c6[_0x41a3('0x4e')]},'raw':!![]})[_0x41a3('0x22')](function(_0x16a57d){if(_0x16a57d&&_0x16a57d[_0x41a3('0x4f')]===0x0){return db[_0x41a3('0x26')][_0x41a3('0x48')]({'name':_0x568c8a[_0x41a3('0x50')],'resourceId':_0x568c8a['id'],'type':_0x16a57d[_0x41a3('0x50')],'sectionId':_0x16a57d['id']},{})[_0x41a3('0x22')](function(){return _0x23942a;});}else{return _0x23942a;}})['catch'](function(_0x16973b){logger[_0x41a3('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x16973b);throw _0x16973b;});}return _0x23942a;})['then'](respondWithResult(_0x267ebb,0xc9))['catch'](handleError(_0x267ebb,null));};exports['update']=function(_0x13bf3c,_0x221158){if(_0x13bf3c[_0x41a3('0x49')]['id']){delete _0x13bf3c[_0x41a3('0x49')]['id'];}return db[_0x41a3('0x2d')][_0x41a3('0x51')]({'where':{'id':_0x13bf3c[_0x41a3('0x45')]['id']}})[_0x41a3('0x22')](handleEntityNotFound(_0x221158,null))[_0x41a3('0x22')](saveUpdates(_0x13bf3c['body'],null))['then'](respondWithResult(_0x221158,null))[_0x41a3('0x47')](handleError(_0x221158,null));};exports[_0x41a3('0x23')]=function(_0x5cff6f,_0x322f81){return db[_0x41a3('0x2d')][_0x41a3('0x51')]({'where':{'id':_0x5cff6f[_0x41a3('0x45')]['id']}})['then'](handleEntityNotFound(_0x322f81,null))['then'](removeEntity(_0x322f81,null))[_0x41a3('0x47')](handleError(_0x322f81,null));}; \ No newline at end of file +var _0xfcd2=['length','find','create','body','role','Variables','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','zip-dir','request-promise','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','apply','reject','save','update','then','destroy','get','UserProfileResource','end','stack','send','index','map','Variable','fieldName','type','key','model','name','query','filters','intersection','attributes','fields','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','keys'];(function(_0x1c345e,_0xe0f7b1){var _0x3ed615=function(_0x4a3dfa){while(--_0x4a3dfa){_0x1c345e['push'](_0x1c345e['shift']());}};_0x3ed615(++_0xe0f7b1);}(_0xfcd2,0x1d8));var _0x2fcd=function(_0xbc2b74,_0x2c7c40){_0xbc2b74=_0xbc2b74-0x0;var _0x5bdcb1=_0xfcd2[_0xbc2b74];return _0x5bdcb1;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x2fcd('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2fcd('0x1'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x2fcd('0x2'));var util=require(_0x2fcd('0x3'));var path=require(_0x2fcd('0x4'));var sox=require(_0x2fcd('0x5'));var csv=require(_0x2fcd('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2fcd('0x7'));var _=require(_0x2fcd('0x8'));var squel=require(_0x2fcd('0x9'));var crypto=require(_0x2fcd('0xa'));var jsforce=require(_0x2fcd('0xb'));var deskjs=require(_0x2fcd('0xc'));var toCsv=require(_0x2fcd('0x6'));var querystring=require(_0x2fcd('0xd'));var Papa=require(_0x2fcd('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x2fcd('0xf'));var hardwareService=require(_0x2fcd('0x10'));var logger=require(_0x2fcd('0x11'))(_0x2fcd('0x12'));var utils=require('../../config/utils');var config=require(_0x2fcd('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x2fcd('0x14'))['db'];function respondWithStatusCode(_0x2ff982,_0x181242){_0x181242=_0x181242||0xcc;return function(_0x3e97d7){if(_0x3e97d7){return _0x2ff982[_0x2fcd('0x15')](_0x181242);}return _0x2ff982[_0x2fcd('0x16')](_0x181242)['end']();};}function respondWithResult(_0x2fdcc6,_0x172be3){_0x172be3=_0x172be3||0xc8;return function(_0x2f1dd4){if(_0x2f1dd4){return _0x2fdcc6[_0x2fcd('0x16')](_0x172be3)[_0x2fcd('0x17')](_0x2f1dd4);}};}function respondWithFilteredResult(_0x2c0158,_0x42916e){return function(_0x4e581d){if(_0x4e581d){var _0x52b56c=typeof _0x42916e[_0x2fcd('0x18')]==='undefined'&&typeof _0x42916e[_0x2fcd('0x19')]===_0x2fcd('0x1a');var _0x400982=_0x4e581d[_0x2fcd('0x1b')];var _0x1aacc5=_0x52b56c?0x0:_0x42916e['offset'];var _0x51ef8a=_0x52b56c?_0x4e581d[_0x2fcd('0x1b')]:_0x42916e[_0x2fcd('0x18')]+_0x42916e['limit'];var _0x308b84;if(_0x51ef8a>=_0x400982){_0x51ef8a=_0x400982;_0x308b84=0xc8;}else{_0x308b84=0xce;}_0x2c0158[_0x2fcd('0x16')](_0x308b84);return _0x2c0158[_0x2fcd('0x1c')]('Content-Range',_0x1aacc5+'-'+_0x51ef8a+'/'+_0x400982)[_0x2fcd('0x17')](_0x4e581d);}return null;};}function patchUpdates(_0x170514){return function(_0x32c10e){try{jsonpatch[_0x2fcd('0x1d')](_0x32c10e,_0x170514,!![]);}catch(_0x1e64c3){return BPromise[_0x2fcd('0x1e')](_0x1e64c3);}return _0x32c10e[_0x2fcd('0x1f')]();};}function saveUpdates(_0x4f2d85,_0x18fa5c){return function(_0x5c0942){if(_0x5c0942){return _0x5c0942[_0x2fcd('0x20')](_0x4f2d85)[_0x2fcd('0x21')](function(_0x4a498c){return _0x4a498c;});}return null;};}function removeEntity(_0x70b582,_0xd7e27b){return function(_0x4c55c8){if(_0x4c55c8){return _0x4c55c8[_0x2fcd('0x22')]()[_0x2fcd('0x21')](function(){var _0x4fe7f7=_0x4c55c8[_0x2fcd('0x23')]({'plain':!![]});var _0x93245c='Variables';return db[_0x2fcd('0x24')][_0x2fcd('0x22')]({'where':{'type':_0x93245c,'resourceId':_0x4fe7f7['id']}})['then'](function(){return _0x4c55c8;});})[_0x2fcd('0x21')](function(){_0x70b582[_0x2fcd('0x16')](0xcc)[_0x2fcd('0x25')]();});}};}function handleEntityNotFound(_0xa530a9,_0x1f9a2b){return function(_0x257563){if(!_0x257563){_0xa530a9['sendStatus'](0x194);}return _0x257563;};}function handleError(_0x488a9d,_0x1bb56c){_0x1bb56c=_0x1bb56c||0x1f4;return function(_0x412e66){logger['error'](_0x412e66[_0x2fcd('0x26')]);if(_0x412e66['name']){delete _0x412e66['name'];}_0x488a9d[_0x2fcd('0x16')](_0x1bb56c)[_0x2fcd('0x27')](_0x412e66);};}exports[_0x2fcd('0x28')]=function(_0x20754f,_0x5cb1d8){var _0x2c3db9={},_0x47e62c={},_0x19f41f={'count':0x0,'rows':[]};var _0x5db276=_[_0x2fcd('0x29')](db[_0x2fcd('0x2a')]['rawAttributes'],function(_0x5116b1){return{'name':_0x5116b1[_0x2fcd('0x2b')],'type':_0x5116b1[_0x2fcd('0x2c')][_0x2fcd('0x2d')]};});_0x47e62c[_0x2fcd('0x2e')]=_[_0x2fcd('0x29')](_0x5db276,_0x2fcd('0x2f'));_0x47e62c['query']=_['keys'](_0x20754f[_0x2fcd('0x30')]);_0x47e62c[_0x2fcd('0x31')]=_[_0x2fcd('0x32')](_0x47e62c[_0x2fcd('0x2e')],_0x47e62c['query']);_0x2c3db9[_0x2fcd('0x33')]=_['intersection'](_0x47e62c[_0x2fcd('0x2e')],qs[_0x2fcd('0x34')](_0x20754f['query'][_0x2fcd('0x34')]));_0x2c3db9[_0x2fcd('0x33')]=_0x2c3db9['attributes']['length']?_0x2c3db9['attributes']:_0x47e62c[_0x2fcd('0x2e')];if(!_0x20754f[_0x2fcd('0x30')]['hasOwnProperty'](_0x2fcd('0x35'))){_0x2c3db9[_0x2fcd('0x19')]=qs[_0x2fcd('0x19')](_0x20754f[_0x2fcd('0x30')][_0x2fcd('0x19')]);_0x2c3db9[_0x2fcd('0x18')]=qs[_0x2fcd('0x18')](_0x20754f['query']['offset']);}_0x2c3db9['order']=qs['sort'](_0x20754f['query'][_0x2fcd('0x36')]);_0x2c3db9[_0x2fcd('0x37')]=qs['filters'](_[_0x2fcd('0x38')](_0x20754f[_0x2fcd('0x30')],_0x47e62c[_0x2fcd('0x31')]),_0x5db276);if(_0x20754f[_0x2fcd('0x30')][_0x2fcd('0x39')]){_0x2c3db9['where']=_[_0x2fcd('0x3a')](_0x2c3db9[_0x2fcd('0x37')],{'$or':_['map'](_0x5db276,function(_0x263aab){if(_0x263aab['type']!==_0x2fcd('0x3b')){var _0x364e12={};_0x364e12[_0x263aab['name']]={'$like':'%'+_0x20754f[_0x2fcd('0x30')][_0x2fcd('0x39')]+'%'};return _0x364e12;}})});}_0x2c3db9=_[_0x2fcd('0x3a')]({},_0x2c3db9,_0x20754f[_0x2fcd('0x3c')]);var _0x2fc109={'where':_0x2c3db9[_0x2fcd('0x37')]};return db[_0x2fcd('0x2a')][_0x2fcd('0x1b')](_0x2fc109)[_0x2fcd('0x21')](function(_0x2a0627){_0x19f41f[_0x2fcd('0x1b')]=_0x2a0627;if(_0x20754f[_0x2fcd('0x30')][_0x2fcd('0x3d')]){_0x2c3db9[_0x2fcd('0x3e')]=[{'all':!![]}];}return db['Variable']['findAll'](_0x2c3db9);})[_0x2fcd('0x21')](function(_0x3a34b9){_0x19f41f[_0x2fcd('0x3f')]=_0x3a34b9;return _0x19f41f;})[_0x2fcd('0x21')](respondWithFilteredResult(_0x5cb1d8,_0x2c3db9))[_0x2fcd('0x40')](handleError(_0x5cb1d8,null));};exports[_0x2fcd('0x41')]=function(_0x353ce1,_0x3b396d){var _0x93b15f={'raw':!![],'where':{'id':_0x353ce1['params']['id']}},_0x23fd1a={};_0x23fd1a[_0x2fcd('0x2e')]=_[_0x2fcd('0x42')](db['Variable']['rawAttributes']);_0x23fd1a[_0x2fcd('0x30')]=_[_0x2fcd('0x42')](_0x353ce1[_0x2fcd('0x30')]);_0x23fd1a[_0x2fcd('0x31')]=_[_0x2fcd('0x32')](_0x23fd1a[_0x2fcd('0x2e')],_0x23fd1a[_0x2fcd('0x30')]);_0x93b15f[_0x2fcd('0x33')]=_[_0x2fcd('0x32')](_0x23fd1a[_0x2fcd('0x2e')],qs[_0x2fcd('0x34')](_0x353ce1[_0x2fcd('0x30')][_0x2fcd('0x34')]));_0x93b15f['attributes']=_0x93b15f['attributes'][_0x2fcd('0x43')]?_0x93b15f[_0x2fcd('0x33')]:_0x23fd1a[_0x2fcd('0x2e')];if(_0x353ce1[_0x2fcd('0x30')]['includeAll']){_0x93b15f[_0x2fcd('0x3e')]=[{'all':!![]}];}_0x93b15f=_['merge']({},_0x93b15f,_0x353ce1[_0x2fcd('0x3c')]);return db['Variable'][_0x2fcd('0x44')](_0x93b15f)[_0x2fcd('0x21')](handleEntityNotFound(_0x3b396d,null))[_0x2fcd('0x21')](respondWithResult(_0x3b396d,null))[_0x2fcd('0x40')](handleError(_0x3b396d,null));};exports[_0x2fcd('0x45')]=function(_0xe93744,_0x3381d1){return db[_0x2fcd('0x2a')][_0x2fcd('0x45')](_0xe93744[_0x2fcd('0x46')],{})['then'](function(_0x571000){var _0x4b7ff7=_0xe93744['user'][_0x2fcd('0x23')]({'plain':!![]});if(!_0x4b7ff7)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4b7ff7[_0x2fcd('0x47')]==='user'){var _0x210603=_0x571000['get']({'plain':!![]});var _0x4ff8d6=_0x2fcd('0x48');return db['UserProfileSection'][_0x2fcd('0x44')]({'where':{'name':_0x4ff8d6,'userProfileId':_0x4b7ff7[_0x2fcd('0x49')]},'raw':!![]})[_0x2fcd('0x21')](function(_0x1c2b44){if(_0x1c2b44&&_0x1c2b44[_0x2fcd('0x4a')]===0x0){return db[_0x2fcd('0x24')][_0x2fcd('0x45')]({'name':_0x210603[_0x2fcd('0x2f')],'resourceId':_0x210603['id'],'type':_0x1c2b44['name'],'sectionId':_0x1c2b44['id']},{})['then'](function(){return _0x571000;});}else{return _0x571000;}})[_0x2fcd('0x40')](function(_0x5ba1aa){logger['error'](_0x2fcd('0x4b'),_0x5ba1aa);throw _0x5ba1aa;});}return _0x571000;})[_0x2fcd('0x21')](respondWithResult(_0x3381d1,0xc9))[_0x2fcd('0x40')](handleError(_0x3381d1,null));};exports[_0x2fcd('0x20')]=function(_0x2bad10,_0x46cfbe){if(_0x2bad10['body']['id']){delete _0x2bad10['body']['id'];}return db['Variable']['find']({'where':{'id':_0x2bad10[_0x2fcd('0x4c')]['id']}})['then'](handleEntityNotFound(_0x46cfbe,null))['then'](saveUpdates(_0x2bad10[_0x2fcd('0x46')],null))[_0x2fcd('0x21')](respondWithResult(_0x46cfbe,null))['catch'](handleError(_0x46cfbe,null));};exports[_0x2fcd('0x22')]=function(_0x94a614,_0x4026b7){return db['Variable'][_0x2fcd('0x44')]({'where':{'id':_0x94a614['params']['id']}})[_0x2fcd('0x21')](handleEntityNotFound(_0x4026b7,null))['then'](removeEntity(_0x4026b7,null))[_0x2fcd('0x40')](handleError(_0x4026b7,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index f84f09c..a4caf9d 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 _0xbcee=['rimraf','exports','define','Variable','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x392500,_0x1be72f){var _0x4c28d5=function(_0x1c507c){while(--_0x1c507c){_0x392500['push'](_0x392500['shift']());}};_0x4c28d5(++_0x1be72f);}(_0xbcee,0xbf));var _0xebce=function(_0x1c36de,_0x1cad96){_0x1c36de=_0x1c36de-0x0;var _0x1e639a=_0xbcee[_0x1c36de];return _0x1e639a;};'use strict';var _=require('lodash');var util=require(_0xebce('0x0'));var logger=require(_0xebce('0x1'))(_0xebce('0x2'));var moment=require(_0xebce('0x3'));var BPromise=require(_0xebce('0x4'));var rp=require(_0xebce('0x5'));var fs=require('fs');var path=require(_0xebce('0x6'));var rimraf=require(_0xebce('0x7'));var config=require('../../config/environment');var attributes=require('./variable.attributes');module[_0xebce('0x8')]=function(_0x2c111b,_0x3d5b8c){return _0x2c111b[_0xebce('0x9')](_0xebce('0xa'),attributes,{'tableName':'tools_variables','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd0c7=['api','path','rimraf','../../config/environment','define','Variable','tools_variables','lodash','util','../../config/logger'];(function(_0xd7a38a,_0x555621){var _0x40d0d2=function(_0x4a9d40){while(--_0x4a9d40){_0xd7a38a['push'](_0xd7a38a['shift']());}};_0x40d0d2(++_0x555621);}(_0xd0c7,0x13d));var _0x7d0c=function(_0x316b15,_0x3641a9){_0x316b15=_0x316b15-0x0;var _0x3d6651=_0xd0c7[_0x316b15];return _0x3d6651;};'use strict';var _=require(_0x7d0c('0x0'));var util=require(_0x7d0c('0x1'));var logger=require(_0x7d0c('0x2'))(_0x7d0c('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x7d0c('0x4'));var rimraf=require(_0x7d0c('0x5'));var config=require(_0x7d0c('0x6'));var attributes=require('./variable.attributes');module['exports']=function(_0x41242c,_0x11700f){return _0x41242c[_0x7d0c('0x7')](_0x7d0c('0x8'),attributes,{'tableName':_0x7d0c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/variable/variable.rpc.js b/server/api/variable/variable.rpc.js index 823fe2c..ed80a36 100644 --- a/server/api/variable/variable.rpc.js +++ b/server/api/variable/variable.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x814b=['model','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','ShowVariable','options','where','include','map','attributes'];(function(_0x36b1ff,_0x58afb8){var _0x37bfbe=function(_0x597794){while(--_0x597794){_0x36b1ff['push'](_0x36b1ff['shift']());}};_0x37bfbe(++_0x58afb8);}(_0x814b,0x1a2));var _0xb814=function(_0x2e65ee,_0x29dad9){_0x2e65ee=_0x2e65ee-0x0;var _0x4c712a=_0x814b[_0x2e65ee];return _0x4c712a;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var moment=require(_0xb814('0x2'));var BPromise=require(_0xb814('0x3'));var rs=require(_0xb814('0x4'));var fs=require('fs');var Redis=require(_0xb814('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xb814('0x6'));var logger=require(_0xb814('0x7'))(_0xb814('0x8'));var config=require(_0xb814('0x9'));var jayson=require(_0xb814('0xa'));var client=jayson[_0xb814('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3b0829,_0x2e6272,_0x5c8539){return new BPromise(function(_0x271af9,_0x2913a6){return client[_0xb814('0xc')](_0x3b0829,_0x5c8539)[_0xb814('0xd')](function(_0x1fea33){logger[_0xb814('0xe')](_0xb814('0xf'),_0x2e6272,_0xb814('0x10'));logger[_0xb814('0x11')](_0xb814('0x12'),_0x2e6272,_0xb814('0x10'),JSON['stringify'](_0x1fea33));if(_0x1fea33[_0xb814('0x13')]){if(_0x1fea33['error'][_0xb814('0x14')]===0x1f4){logger[_0xb814('0x13')](_0xb814('0xf'),_0x2e6272,_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);return _0x2913a6(_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);}logger[_0xb814('0x13')](_0xb814('0xf'),_0x2e6272,_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);return _0x271af9(_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);}else{logger[_0xb814('0xe')](_0xb814('0xf'),_0x2e6272,_0xb814('0x10'));_0x271af9(_0x1fea33[_0xb814('0x16')][_0xb814('0x15')]);}})[_0xb814('0x17')](function(_0x21b73f){logger[_0xb814('0x13')]('Variable,\x20%s,\x20%s',_0x2e6272,_0x21b73f);_0x2913a6(_0x21b73f);});});}exports[_0xb814('0x18')]=function(_0x55ba16){var _0x270598=this;return new Promise(function(_0xfac75b,_0x4c3007){return db['Variable']['find']({'raw':_0x55ba16[_0xb814('0x19')]?_0x55ba16['options']['raw']===undefined?!![]:![]:!![],'where':_0x55ba16[_0xb814('0x19')]?_0x55ba16[_0xb814('0x19')][_0xb814('0x1a')]||null:null,'attributes':_0x55ba16['options']?_0x55ba16[_0xb814('0x19')]['attributes']||null:null,'include':_0x55ba16[_0xb814('0x19')]?_0x55ba16[_0xb814('0x19')][_0xb814('0x1b')]?_[_0xb814('0x1c')](_0x55ba16[_0xb814('0x19')][_0xb814('0x1b')],function(_0x1f5d40){return{'model':db[_0x1f5d40['model']],'as':_0x1f5d40['as'],'attributes':_0x1f5d40[_0xb814('0x1d')],'include':_0x1f5d40['include']?_[_0xb814('0x1c')](_0x1f5d40[_0xb814('0x1b')],function(_0x31c7ec){return{'model':db[_0x31c7ec[_0xb814('0x1e')]],'as':_0x31c7ec['as'],'attributes':_0x31c7ec[_0xb814('0x1d')],'include':_0x31c7ec[_0xb814('0x1b')]?_[_0xb814('0x1c')](_0x31c7ec['include'],function(_0x392222){return{'model':db[_0x392222[_0xb814('0x1e')]],'as':_0x392222['as'],'attributes':_0x392222[_0xb814('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xb814('0xd')](function(_0x32ed56){logger[_0xb814('0xe')](_0xb814('0x18'),_0x55ba16);logger[_0xb814('0x11')]('ShowVariable',_0x55ba16,JSON[_0xb814('0x1f')](_0x32ed56));_0xfac75b(_0x32ed56);})[_0xb814('0x17')](function(_0x52ed64){logger[_0xb814('0x13')](_0xb814('0x18'),_0x52ed64[_0xb814('0x15')],_0x55ba16);_0x4c3007(_0x270598['error'](0x1f4,_0x52ed64[_0xb814('0x15')]));});});}; \ No newline at end of file +var _0x1cb9=['include','map','model','then','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','ShowVariable','Variable','options','attributes'];(function(_0x319784,_0x47e6d4){var _0x1917da=function(_0x2cb921){while(--_0x2cb921){_0x319784['push'](_0x319784['shift']());}};_0x1917da(++_0x47e6d4);}(_0x1cb9,0x14e));var _0x91cb=function(_0x3f082c,_0x412b81){_0x3f082c=_0x3f082c-0x0;var _0x8451e5=_0x1cb9[_0x3f082c];return _0x8451e5;};'use strict';var _=require(_0x91cb('0x0'));var util=require('util');var moment=require(_0x91cb('0x1'));var BPromise=require(_0x91cb('0x2'));var rs=require(_0x91cb('0x3'));var fs=require('fs');var Redis=require(_0x91cb('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x91cb('0x5'));var logger=require(_0x91cb('0x6'))('rpc');var config=require(_0x91cb('0x7'));var jayson=require(_0x91cb('0x8'));var client=jayson[_0x91cb('0x9')][_0x91cb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3b9d98,_0x8f8a3b,_0x4c1f56){return new BPromise(function(_0x15c517,_0x5bda2f){return client[_0x91cb('0xb')](_0x3b9d98,_0x4c1f56)['then'](function(_0xa43e7a){logger[_0x91cb('0xc')](_0x91cb('0xd'),_0x8f8a3b,_0x91cb('0xe'));logger[_0x91cb('0xf')](_0x91cb('0x10'),_0x8f8a3b,_0x91cb('0xe'),JSON[_0x91cb('0x11')](_0xa43e7a));if(_0xa43e7a[_0x91cb('0x12')]){if(_0xa43e7a[_0x91cb('0x12')]['code']===0x1f4){logger[_0x91cb('0x12')](_0x91cb('0xd'),_0x8f8a3b,_0xa43e7a['error'][_0x91cb('0x13')]);return _0x5bda2f(_0xa43e7a[_0x91cb('0x12')][_0x91cb('0x13')]);}logger[_0x91cb('0x12')]('Variable,\x20%s,\x20%s',_0x8f8a3b,_0xa43e7a['error'][_0x91cb('0x13')]);return _0x15c517(_0xa43e7a[_0x91cb('0x12')]['message']);}else{logger['info'](_0x91cb('0xd'),_0x8f8a3b,_0x91cb('0xe'));_0x15c517(_0xa43e7a[_0x91cb('0x14')]['message']);}})[_0x91cb('0x15')](function(_0x135890){logger['error'](_0x91cb('0xd'),_0x8f8a3b,_0x135890);_0x5bda2f(_0x135890);});});}exports[_0x91cb('0x16')]=function(_0x1cd34b){var _0xcd1a78=this;return new Promise(function(_0x5cc1c3,_0x3fba4f){return db[_0x91cb('0x17')]['find']({'raw':_0x1cd34b[_0x91cb('0x18')]?_0x1cd34b['options']['raw']===undefined?!![]:![]:!![],'where':_0x1cd34b[_0x91cb('0x18')]?_0x1cd34b[_0x91cb('0x18')]['where']||null:null,'attributes':_0x1cd34b['options']?_0x1cd34b['options'][_0x91cb('0x19')]||null:null,'include':_0x1cd34b[_0x91cb('0x18')]?_0x1cd34b[_0x91cb('0x18')][_0x91cb('0x1a')]?_['map'](_0x1cd34b[_0x91cb('0x18')][_0x91cb('0x1a')],function(_0x1fa837){return{'model':db[_0x1fa837['model']],'as':_0x1fa837['as'],'attributes':_0x1fa837[_0x91cb('0x19')],'include':_0x1fa837[_0x91cb('0x1a')]?_[_0x91cb('0x1b')](_0x1fa837[_0x91cb('0x1a')],function(_0x3ca500){return{'model':db[_0x3ca500[_0x91cb('0x1c')]],'as':_0x3ca500['as'],'attributes':_0x3ca500[_0x91cb('0x19')],'include':_0x3ca500[_0x91cb('0x1a')]?_[_0x91cb('0x1b')](_0x3ca500['include'],function(_0x59bf3a){return{'model':db[_0x59bf3a[_0x91cb('0x1c')]],'as':_0x59bf3a['as'],'attributes':_0x59bf3a['attributes']};}):[]};}):[]};}):[]:[]})[_0x91cb('0x1d')](function(_0x34d372){logger[_0x91cb('0xc')]('ShowVariable',_0x1cd34b);logger[_0x91cb('0xf')]('ShowVariable',_0x1cd34b,JSON[_0x91cb('0x11')](_0x34d372));_0x5cc1c3(_0x34d372);})[_0x91cb('0x15')](function(_0x3b3ee6){logger[_0x91cb('0x12')](_0x91cb('0x16'),_0x3b3ee6['message'],_0x1cd34b);_0x3fba4f(_0xcd1a78[_0x91cb('0x12')](0x1f4,_0x3b3ee6['message']));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index e13f5e2..1874c9a 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 _0xeaa3=['../../components/auth/service','./version.controller','get','index','isAuthenticated','canUpdate','fetch','/reset','reset','/pull','/restart','restart','/migrations','exports','express','Router'];(function(_0x5bce1e,_0x12f869){var _0x1afc1b=function(_0x3a509a){while(--_0x3a509a){_0x5bce1e['push'](_0x5bce1e['shift']());}};_0x1afc1b(++_0x12f869);}(_0xeaa3,0x19e));var _0x3eaa=function(_0xbe60c8,_0x52536b){_0xbe60c8=_0xbe60c8-0x0;var _0x2e61ba=_0xeaa3[_0xbe60c8];return _0x2e61ba;};'use strict';var express=require(_0x3eaa('0x0'));var router=express[_0x3eaa('0x1')]();var auth=require(_0x3eaa('0x2'));var controller=require(_0x3eaa('0x3'));router[_0x3eaa('0x4')]('/',controller[_0x3eaa('0x5')]);router[_0x3eaa('0x4')]('/fetch',auth[_0x3eaa('0x6')](),auth[_0x3eaa('0x7')](),controller[_0x3eaa('0x8')]);router['get'](_0x3eaa('0x9'),auth[_0x3eaa('0x6')](),auth['canUpdate'](),controller[_0x3eaa('0xa')]);router[_0x3eaa('0x4')](_0x3eaa('0xb'),auth[_0x3eaa('0x6')](),auth[_0x3eaa('0x7')](),controller['pull']);router[_0x3eaa('0x4')](_0x3eaa('0xc'),auth[_0x3eaa('0x6')](),controller[_0x3eaa('0xd')]);router[_0x3eaa('0x4')](_0x3eaa('0xe'),controller['migrations']);module[_0x3eaa('0xf')]=router; \ No newline at end of file +var _0xf469=['/reset','reset','/pull','pull','/migrations','migrations','exports','express','Router','../../components/auth/service','./version.controller','get','/fetch','isAuthenticated'];(function(_0x48dcf8,_0x559b5f){var _0x4a08f4=function(_0x4da60d){while(--_0x4da60d){_0x48dcf8['push'](_0x48dcf8['shift']());}};_0x4a08f4(++_0x559b5f);}(_0xf469,0x93));var _0x9f46=function(_0x22e395,_0x2e40b8){_0x22e395=_0x22e395-0x0;var _0x20c938=_0xf469[_0x22e395];return _0x20c938;};'use strict';var express=require(_0x9f46('0x0'));var router=express[_0x9f46('0x1')]();var auth=require(_0x9f46('0x2'));var controller=require(_0x9f46('0x3'));router['get']('/',controller['index']);router[_0x9f46('0x4')](_0x9f46('0x5'),auth[_0x9f46('0x6')](),auth['canUpdate'](),controller['fetch']);router[_0x9f46('0x4')](_0x9f46('0x7'),auth['isAuthenticated'](),auth['canUpdate'](),controller[_0x9f46('0x8')]);router[_0x9f46('0x4')](_0x9f46('0x9'),auth[_0x9f46('0x6')](),auth['canUpdate'](),controller[_0x9f46('0xa')]);router['get']('/restart',auth[_0x9f46('0x6')](),controller['restart']);router[_0x9f46('0x4')](_0x9f46('0xb'),controller[_0x9f46('0xc')]);module[_0x9f46('0xd')]=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index a4953bc..a66e710 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 _0xb825=['path','lodash','pkginfo','version','child_process','exec','../../mysqldb','../../config/environment','../../config/pm2','../../config/logger','simple-git','root','index','exports','query','latest','fetch','tags','2.0.0','status','json','master','error','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_HEAD','pull','npm\x20install\x20--production','restart','motion2','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','join','length','replace','push','sort','sequelize','Migration','getQueryInterface','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','server','migrations','map','\x20to\x20','Database\x20already\x20up-to-date'];(function(_0x5a4400,_0xfae3b6){var _0xf9b532=function(_0x39804e){while(--_0x39804e){_0x5a4400['push'](_0x5a4400['shift']());}};_0xf9b532(++_0xfae3b6);}(_0xb825,0x1d4));var _0x5b82=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xb825[_0x2dafbe];return _0x58a45a;};'use strict';var Umzug=require('umzug');var path=require(_0x5b82('0x0'));var fs=require('fs');var _=require(_0x5b82('0x1'));var pkginfo=require(_0x5b82('0x2'))(module,_0x5b82('0x3'));var compareVersions=require('compare-versions');var exec=require(_0x5b82('0x4'))[_0x5b82('0x5')];var db=require(_0x5b82('0x6'))['db'];var config=require(_0x5b82('0x7'));var pm2=require(_0x5b82('0x8'));var logger=require(_0x5b82('0x9'))('update');var git=require(_0x5b82('0xa'))(config[_0x5b82('0xb')]);exports[_0x5b82('0xc')]=function(_0x4aaf12,_0x5316d7){var _0x4e86c0={'current':module[_0x5b82('0xd')][_0x5b82('0x3')],'phonebar':0x2};if(_0x4aaf12[_0x5b82('0xe')]&&_0x4aaf12[_0x5b82('0xe')][_0x5b82('0xf')]){return git[_0x5b82('0x10')]()[_0x5b82('0x11')](function(_0x56a1c3,_0x2b88ed){_0x4e86c0[_0x5b82('0xf')]=(_0x56a1c3?module[_0x5b82('0xd')]['version']:_0x2b88ed[_0x5b82('0xf')])||_0x5b82('0x12');return _0x5316d7[_0x5b82('0x13')](0xc8)[_0x5b82('0x14')](_0x4e86c0);});}else{return _0x5316d7[_0x5b82('0x13')](0xc8)[_0x5b82('0x14')](_0x4e86c0);}};exports['fetch']=function(_0x563b24,_0x981bd){return git[_0x5b82('0x10')](['origin',_0x5b82('0x15')],function(_0x3ed2fe){if(_0x3ed2fe){logger[_0x5b82('0x16')](_0x3ed2fe);return _0x981bd['status'](0x1f4)[_0x5b82('0x14')](_0x3ed2fe);}logger[_0x5b82('0x17')](_0x5b82('0x18'));return _0x981bd[_0x5b82('0x13')](0xc8)[_0x5b82('0x14')]({'output':_0x5b82('0x19')});});};exports['reset']=function(_0x18918f,_0x572029){return git[_0x5b82('0x1a')]([_0x5b82('0x1b'),_0x5b82('0x1c')],function(_0x26fa77){if(_0x26fa77){logger['error'](_0x26fa77);return _0x572029[_0x5b82('0x13')](0x1f4)['json'](_0x26fa77);}logger[_0x5b82('0x17')](_0x5b82('0x1d'));return _0x572029[_0x5b82('0x13')](0xc8)[_0x5b82('0x14')]({'output':'git\x20reset\x20--hard'});});};exports[_0x5b82('0x1e')]=function(_0x3ec549,_0x19527e){exec(_0x5b82('0x1f'),function(_0x19d4e1,_0x358751,_0x4f2a18){logger[_0x5b82('0x17')](_0x358751);logger[_0x5b82('0x17')](_0x4f2a18);if(_0x19d4e1){logger[_0x5b82('0x16')](_0x19d4e1);return _0x19527e['status'](0x1f4)['json'](_0x19d4e1);}return _0x19527e[_0x5b82('0x13')](0xc8)[_0x5b82('0x14')]({'output':_0x358751});});};exports[_0x5b82('0x20')]=function(_0x39fd0b,_0x2efc79){return pm2['restart'](_0x5b82('0x21'))[_0x5b82('0x22')](function(_0x20d06c){logger[_0x5b82('0x17')](_0x5b82('0x23'),_0x20d06c);return _0x2efc79[_0x5b82('0x13')](0xc8)['json']({'output':_0x5b82('0x24')});})[_0x5b82('0x25')](function(_0x29b626){logger[_0x5b82('0x16')](_0x29b626);return _0x2efc79[_0x5b82('0x13')](0x1f4)[_0x5b82('0x14')](_0x29b626);});};exports['migrations']=function(_0x2f024a,_0x99c0a3){var _0x3ab7e9=fs['readdirSync'](path[_0x5b82('0x26')](config['root'],'server','migrations'));var _0x16f278=[];for(var _0x32252a=0x0;_0x32252a<_0x3ab7e9[_0x5b82('0x27')];_0x32252a++){var _0x2695d2=_0x3ab7e9[_0x32252a][_0x5b82('0x28')]('.js','');if(compareVersions(module['exports'][_0x5b82('0x3')],_0x2695d2)===-0x1){_0x16f278[_0x5b82('0x29')](_0x2695d2);}}if(_0x16f278[_0x5b82('0x27')]){var _0x5c80f0=_0x16f278[_0x5b82('0x2a')](compareVersions);var _0x3059f0=new Umzug({'storage':_0x5b82('0x2b'),'storageOptions':{'model':db[_0x5b82('0x2c')],'modelName':'Migration','columnName':'version'},'migrations':{'params':[db['sequelize'][_0x5b82('0x2d')](),db[_0x5b82('0x2b')]['constructor'],function(){throw new Error(_0x5b82('0x2e'));}],'path':path[_0x5b82('0x26')](config[_0x5b82('0xb')],_0x5b82('0x2f'),_0x5b82('0x30')),'pattern':/\.js$/}});_0x3059f0['up']({'migrations':_[_0x5b82('0x31')](_0x5c80f0,function(_0x2b1e56){return _0x2b1e56+'.js';})})[_0x5b82('0x22')](function(){return _0x99c0a3['status'](0xc8)[_0x5b82('0x14')]({'output':'Database\x20migrated\x20successfully\x20from\x20version\x20'+module[_0x5b82('0xd')][_0x5b82('0x3')]+_0x5b82('0x32')+_['last'](_0x5c80f0),'migrations':_[_0x5b82('0x26')](_0x5c80f0)});})[_0x5b82('0x25')](function(_0x296866){if(_0x296866 instanceof db[_0x5b82('0x2b')]['UniqueConstraintError']){return _0x99c0a3[_0x5b82('0x13')](0xc8)[_0x5b82('0x14')]({'output':'Database\x20already\x20up-to-date'});}else{return _0x99c0a3[_0x5b82('0x13')](0x1f4)[_0x5b82('0x14')](_0x296866);}});}else{return _0x99c0a3[_0x5b82('0x13')](0xc8)[_0x5b82('0x14')]({'output':_0x5b82('0x33')});}}; \ No newline at end of file +var _0x9d8f=['info','git\x20fetch','status','reset','--hard','FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','restart','motion2','then','pm2\x20restart\x20motion\x20%s','catch','migrations','readdirSync','join','server','replace','.js','push','length','sort','Migration','sequelize','getQueryInterface','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','pkginfo','compare-versions','child_process','exec','../../mysqldb','../../config/environment','../../config/pm2','../../config/logger','update','simple-git','root','index','exports','version','query','latest','fetch','tags','2.0.0','json','origin','master','error'];(function(_0x5b8533,_0x1f3cb0){var _0x1ef259=function(_0xfa566c){while(--_0xfa566c){_0x5b8533['push'](_0x5b8533['shift']());}};_0x1ef259(++_0x1f3cb0);}(_0x9d8f,0x1e8));var _0xf9d8=function(_0x5baeb5,_0x4334b5){_0x5baeb5=_0x5baeb5-0x0;var _0x6f222a=_0x9d8f[_0x5baeb5];return _0x6f222a;};'use strict';var Umzug=require(_0xf9d8('0x0'));var path=require(_0xf9d8('0x1'));var fs=require('fs');var _=require('lodash');var pkginfo=require(_0xf9d8('0x2'))(module,'version');var compareVersions=require(_0xf9d8('0x3'));var exec=require(_0xf9d8('0x4'))[_0xf9d8('0x5')];var db=require(_0xf9d8('0x6'))['db'];var config=require(_0xf9d8('0x7'));var pm2=require(_0xf9d8('0x8'));var logger=require(_0xf9d8('0x9'))(_0xf9d8('0xa'));var git=require(_0xf9d8('0xb'))(config[_0xf9d8('0xc')]);exports[_0xf9d8('0xd')]=function(_0x2ee177,_0x21060b){var _0x3019dc={'current':module[_0xf9d8('0xe')][_0xf9d8('0xf')],'phonebar':0x2};if(_0x2ee177[_0xf9d8('0x10')]&&_0x2ee177[_0xf9d8('0x10')][_0xf9d8('0x11')]){return git[_0xf9d8('0x12')]()[_0xf9d8('0x13')](function(_0x547a13,_0x40258d){_0x3019dc[_0xf9d8('0x11')]=(_0x547a13?module['exports'][_0xf9d8('0xf')]:_0x40258d[_0xf9d8('0x11')])||_0xf9d8('0x14');return _0x21060b['status'](0xc8)[_0xf9d8('0x15')](_0x3019dc);});}else{return _0x21060b['status'](0xc8)[_0xf9d8('0x15')](_0x3019dc);}};exports[_0xf9d8('0x12')]=function(_0xe07c3c,_0x394ff9){return git[_0xf9d8('0x12')]([_0xf9d8('0x16'),_0xf9d8('0x17')],function(_0x13e824){if(_0x13e824){logger[_0xf9d8('0x18')](_0x13e824);return _0x394ff9['status'](0x1f4)[_0xf9d8('0x15')](_0x13e824);}logger[_0xf9d8('0x19')](_0xf9d8('0x1a'));return _0x394ff9[_0xf9d8('0x1b')](0xc8)[_0xf9d8('0x15')]({'output':'git\x20fetch\x20origin\x20master'});});};exports[_0xf9d8('0x1c')]=function(_0x302666,_0x55a0c9){return git[_0xf9d8('0x1c')]([_0xf9d8('0x1d'),_0xf9d8('0x1e')],function(_0x1eadf5){if(_0x1eadf5){logger[_0xf9d8('0x18')](_0x1eadf5);return _0x55a0c9[_0xf9d8('0x1b')](0x1f4)[_0xf9d8('0x15')](_0x1eadf5);}logger[_0xf9d8('0x19')](_0xf9d8('0x1f'));return _0x55a0c9[_0xf9d8('0x1b')](0xc8)['json']({'output':_0xf9d8('0x20')});});};exports[_0xf9d8('0x21')]=function(_0x3063b5,_0x1b7e31){exec('npm\x20install\x20--production',function(_0x3c5c5b,_0x33f3c0,_0x5dcfb5){logger[_0xf9d8('0x19')](_0x33f3c0);logger['info'](_0x5dcfb5);if(_0x3c5c5b){logger[_0xf9d8('0x18')](_0x3c5c5b);return _0x1b7e31[_0xf9d8('0x1b')](0x1f4)['json'](_0x3c5c5b);}return _0x1b7e31[_0xf9d8('0x1b')](0xc8)[_0xf9d8('0x15')]({'output':_0x33f3c0});});};exports['restart']=function(_0x5f1462,_0x33ab82){return pm2[_0xf9d8('0x22')](_0xf9d8('0x23'))[_0xf9d8('0x24')](function(_0x1ce5b0){logger[_0xf9d8('0x19')](_0xf9d8('0x25'),_0x1ce5b0);return _0x33ab82['status'](0xc8)[_0xf9d8('0x15')]({'output':'Your\x20system\x20has\x20been\x20restart\x20successfully'});})[_0xf9d8('0x26')](function(_0x1c5d19){logger[_0xf9d8('0x18')](_0x1c5d19);return _0x33ab82[_0xf9d8('0x1b')](0x1f4)['json'](_0x1c5d19);});};exports[_0xf9d8('0x27')]=function(_0x421347,_0x3f47db){var _0x5aa227=fs[_0xf9d8('0x28')](path[_0xf9d8('0x29')](config[_0xf9d8('0xc')],_0xf9d8('0x2a'),_0xf9d8('0x27')));var _0x379637=[];for(var _0x24c5ae=0x0;_0x24c5ae<_0x5aa227['length'];_0x24c5ae++){var _0x108831=_0x5aa227[_0x24c5ae][_0xf9d8('0x2b')](_0xf9d8('0x2c'),'');if(compareVersions(module['exports'][_0xf9d8('0xf')],_0x108831)===-0x1){_0x379637[_0xf9d8('0x2d')](_0x108831);}}if(_0x379637[_0xf9d8('0x2e')]){var _0x40bf53=_0x379637[_0xf9d8('0x2f')](compareVersions);var _0x3e9cc6=new Umzug({'storage':'sequelize','storageOptions':{'model':db[_0xf9d8('0x30')],'modelName':_0xf9d8('0x30'),'columnName':_0xf9d8('0xf')},'migrations':{'params':[db[_0xf9d8('0x31')][_0xf9d8('0x32')](),db[_0xf9d8('0x31')][_0xf9d8('0x33')],function(){throw new Error(_0xf9d8('0x34'));}],'path':path[_0xf9d8('0x29')](config[_0xf9d8('0xc')],_0xf9d8('0x2a'),'migrations'),'pattern':/\.js$/}});_0x3e9cc6['up']({'migrations':_['map'](_0x40bf53,function(_0x5f3a0b){return _0x5f3a0b+_0xf9d8('0x2c');})})[_0xf9d8('0x24')](function(){return _0x3f47db[_0xf9d8('0x1b')](0xc8)[_0xf9d8('0x15')]({'output':_0xf9d8('0x35')+module[_0xf9d8('0xe')][_0xf9d8('0xf')]+_0xf9d8('0x36')+_['last'](_0x40bf53),'migrations':_['join'](_0x40bf53)});})[_0xf9d8('0x26')](function(_0x239a82){if(_0x239a82 instanceof db[_0xf9d8('0x31')][_0xf9d8('0x37')]){return _0x3f47db[_0xf9d8('0x1b')](0xc8)[_0xf9d8('0x15')]({'output':_0xf9d8('0x38')});}else{return _0x3f47db[_0xf9d8('0x1b')](0x1f4)[_0xf9d8('0x15')](_0x239a82);}});}else{return _0x3f47db[_0xf9d8('0x1b')](0xc8)['json']({'output':_0xf9d8('0x38')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index be32d01..2267e0e 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 _0xbecf=['delete','multer','util','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','get','isAuthenticated','index','describe','/:id','show','create','put'];(function(_0x5650c3,_0x3526c2){var _0x2f6644=function(_0x44692f){while(--_0x44692f){_0x5650c3['push'](_0x5650c3['shift']());}};_0x2f6644(++_0x3526c2);}(_0xbecf,0x144));var _0xfbec=function(_0x2ca98f,_0x5908cc){_0x2ca98f=_0x2ca98f-0x0;var _0x57c653=_0xbecf[_0x2ca98f];return _0x57c653;};'use strict';var multer=require(_0xfbec('0x0'));var util=require(_0xfbec('0x1'));var path=require('path');var timeout=require(_0xfbec('0x2'));var express=require('express');var router=express[_0xfbec('0x3')]();var fs_extra=require(_0xfbec('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xfbec('0x5'));var config=require(_0xfbec('0x6'));var controller=require(_0xfbec('0x7'));router[_0xfbec('0x8')]('/',auth[_0xfbec('0x9')](),controller[_0xfbec('0xa')]);router[_0xfbec('0x8')]('/describe',auth['isAuthenticated'](),controller[_0xfbec('0xb')]);router['get'](_0xfbec('0xc'),auth[_0xfbec('0x9')](),controller[_0xfbec('0xd')]);router['post']('/',auth[_0xfbec('0x9')](),controller[_0xfbec('0xe')]);router[_0xfbec('0xf')](_0xfbec('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xfbec('0x10')](_0xfbec('0xc'),auth[_0xfbec('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xb4ab=['get','isAuthenticated','index','/describe','describe','/:id','show','create','put','update','delete','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller'];(function(_0x1f6202,_0x253cc){var _0x5756d1=function(_0x63847){while(--_0x63847){_0x1f6202['push'](_0x1f6202['shift']());}};_0x5756d1(++_0x253cc);}(_0xb4ab,0x1da));var _0xbb4a=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xb4ab[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0xbb4a('0x0'));var util=require(_0xbb4a('0x1'));var path=require(_0xbb4a('0x2'));var timeout=require(_0xbb4a('0x3'));var express=require(_0xbb4a('0x4'));var router=express['Router']();var fs_extra=require(_0xbb4a('0x5'));var auth=require(_0xbb4a('0x6'));var interaction=require(_0xbb4a('0x7'));var config=require(_0xbb4a('0x8'));var controller=require(_0xbb4a('0x9'));router[_0xbb4a('0xa')]('/',auth[_0xbb4a('0xb')](),controller[_0xbb4a('0xc')]);router[_0xbb4a('0xa')](_0xbb4a('0xd'),auth[_0xbb4a('0xb')](),controller[_0xbb4a('0xe')]);router[_0xbb4a('0xa')](_0xbb4a('0xf'),auth['isAuthenticated'](),controller[_0xbb4a('0x10')]);router['post']('/',auth['isAuthenticated'](),controller[_0xbb4a('0x11')]);router[_0xbb4a('0x12')](_0xbb4a('0xf'),auth[_0xbb4a('0xb')](),controller[_0xbb4a('0x13')]);router[_0xbb4a('0x14')]('/:id',auth[_0xbb4a('0xb')](),controller['destroy']);module[_0xbb4a('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index 9a82868..42b6ad7 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 _0xd732=['DATE','BOOLEAN','INTEGER','sequelize','STRING'];(function(_0x3410fb,_0x2b570c){var _0x28edd4=function(_0x37468e){while(--_0x37468e){_0x3410fb['push'](_0x3410fb['shift']());}};_0x28edd4(++_0x2b570c);}(_0xd732,0x18e));var _0x2d73=function(_0x133faf,_0x2e653f){_0x133faf=_0x133faf-0x0;var _0x50c320=_0xd732[_0x133faf];return _0x50c320;};'use strict';var Sequelize=require(_0x2d73('0x0'));module['exports']={'type':{'type':Sequelize[_0x2d73('0x1')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x2d73('0x1')]},'queue':{'type':Sequelize[_0x2d73('0x1')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0x2d73('0x2')]},'agentconnectAt':{'type':Sequelize['DATE']},'agentcompleteAt':{'type':Sequelize[_0x2d73('0x2')]},'agentringnoanswerAt':{'type':Sequelize[_0x2d73('0x2')]},'agentdumpAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0x2d73('0x3')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x2d73('0x3')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x2d73('0x4')]},'agentacw':{'type':Sequelize[_0x2d73('0x3')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x2d73('0x4')]},'reason':{'type':Sequelize['STRING']},'lastevent':{'type':Sequelize[_0x2d73('0x1')]},'channel':{'type':Sequelize[_0x2d73('0x1')]},'channelstate':{'type':Sequelize[_0x2d73('0x4')]},'channelstatedesc':{'type':Sequelize[_0x2d73('0x1')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x2d73('0x1')]},'language':{'type':Sequelize[_0x2d73('0x1')]},'accountcode':{'type':Sequelize[_0x2d73('0x1')]},'context':{'type':Sequelize[_0x2d73('0x1')]},'exten':{'type':Sequelize[_0x2d73('0x1')]},'priority':{'type':Sequelize[_0x2d73('0x1')]},'destchannel':{'type':Sequelize[_0x2d73('0x1')]},'destchannelstate':{'type':Sequelize[_0x2d73('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0x2d73('0x1')]},'destcalleridnum':{'type':Sequelize[_0x2d73('0x1')]},'destcalleridname':{'type':Sequelize[_0x2d73('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0x2d73('0x1')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x2d73('0x1')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0x2d73('0x1')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x2d73('0x1')]},'destuniqueid':{'type':Sequelize[_0x2d73('0x1')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x2d73('0x1')]},'answeredelsewheremembername':{'type':Sequelize[_0x2d73('0x1')]},'transfer':{'type':Sequelize[_0x2d73('0x3')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize[_0x2d73('0x1')]},'agententerreason':{'type':Sequelize[_0x2d73('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x2032=['FORWARD,\x20BLIND,\x20ATTENDED','exports','STRING','DATE','INTEGER','BOOLEAN'];(function(_0x229489,_0x3b3a2a){var _0x3d6b4f=function(_0x564e7a){while(--_0x564e7a){_0x229489['push'](_0x229489['shift']());}};_0x3d6b4f(++_0x3b3a2a);}(_0x2032,0xd9));var _0x2203=function(_0xde134e,_0x5a519f){_0xde134e=_0xde134e-0x0;var _0x5aa211=_0x2032[_0xde134e];return _0x5aa211;};'use strict';var Sequelize=require('sequelize');module[_0x2203('0x0')]={'type':{'type':Sequelize[_0x2203('0x1')]},'uniqueid':{'type':Sequelize[_0x2203('0x1')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x2203('0x1')]},'queue':{'type':Sequelize[_0x2203('0x1')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x2203('0x1')]},'agentcalledAt':{'type':Sequelize[_0x2203('0x2')]},'agentconnectAt':{'type':Sequelize[_0x2203('0x2')]},'agentcompleteAt':{'type':Sequelize[_0x2203('0x2')]},'agentringnoanswerAt':{'type':Sequelize[_0x2203('0x2')]},'agentdumpAt':{'type':Sequelize[_0x2203('0x2')]},'holdtime':{'type':Sequelize[_0x2203('0x3')]},'agentcomplete':{'type':Sequelize[_0x2203('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x2203('0x4')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x2203('0x4')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x2203('0x3')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0x2203('0x1')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x2203('0x1')]},'channelstate':{'type':Sequelize[_0x2203('0x3')]},'channelstatedesc':{'type':Sequelize[_0x2203('0x1')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x2203('0x1')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x2203('0x1')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x2203('0x1')]},'priority':{'type':Sequelize[_0x2203('0x1')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x2203('0x1')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0x2203('0x1')]},'destcontext':{'type':Sequelize[_0x2203('0x1')]},'destexten':{'type':Sequelize[_0x2203('0x1')]},'destpriority':{'type':Sequelize[_0x2203('0x1')]},'destuniqueid':{'type':Sequelize[_0x2203('0x1')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x2203('0x1')]},'answeredelsewheremembername':{'type':Sequelize[_0x2203('0x1')]},'transfer':{'type':Sequelize[_0x2203('0x4')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x2203('0x1')],'comment':_0x2203('0x5')},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize[_0x2203('0x1')]},'agententerreason':{'type':Sequelize[_0x2203('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.controller.js b/server/api/voiceAgentReport/voiceAgentReport.controller.js index 92e9b01..4785278 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(_0x2aea9e,_0x1f587f){var _0x430b92=function(_0x416c37){while(--_0x416c37){_0x2aea9e['push'](_0x2aea9e['shift']());}};_0x430b92(++_0x1f587f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0xa9e0[_0x5b561d];return _0x431060;};'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(_0x44946b,_0xf874ec){var _0x249bc4=function(_0x40a23e){while(--_0x40a23e){_0x44946b['push'](_0x44946b['shift']());}};_0x249bc4(++_0xf874ec);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0xa9e0[_0x5447fd];return _0x15b28a;};'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 516d638..f7323f3 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 _0x7579=['destuniqueid','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./voiceAgentReport.attributes','define','report_agent'];(function(_0x43ca3b,_0x16a437){var _0x48ab7b=function(_0x508d75){while(--_0x508d75){_0x43ca3b['push'](_0x43ca3b['shift']());}};_0x48ab7b(++_0x16a437);}(_0x7579,0x1e2));var _0x9757=function(_0x3d9afb,_0x1046ce){_0x3d9afb=_0x3d9afb-0x0;var _0x1b017c=_0x7579[_0x3d9afb];return _0x1b017c;};'use strict';var _=require(_0x9757('0x0'));var util=require(_0x9757('0x1'));var logger=require(_0x9757('0x2'))(_0x9757('0x3'));var moment=require(_0x9757('0x4'));var BPromise=require(_0x9757('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9757('0x6'));var rimraf=require(_0x9757('0x7'));var config=require(_0x9757('0x8'));var attributes=require(_0x9757('0x9'));module['exports']=function(_0x2aede4,_0x80e411){return _0x2aede4[_0x9757('0xa')]('VoiceAgentReport',attributes,{'tableName':_0x9757('0xb'),'paranoid':![],'indexes':[{'fields':['uniqueid',_0x9757('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2f2e=['path','rimraf','../../config/environment','define','VoiceAgentReport','report_agent','util','../../config/logger','moment','request-promise'];(function(_0x49b207,_0x408ade){var _0x2dc8fa=function(_0x150975){while(--_0x150975){_0x49b207['push'](_0x49b207['shift']());}};_0x2dc8fa(++_0x408ade);}(_0x2f2e,0x146));var _0xe2f2=function(_0x36bc58,_0x27f03c){_0x36bc58=_0x36bc58-0x0;var _0x4a547e=_0x2f2e[_0x36bc58];return _0x4a547e;};'use strict';var _=require('lodash');var util=require(_0xe2f2('0x0'));var logger=require(_0xe2f2('0x1'))('api');var moment=require(_0xe2f2('0x2'));var BPromise=require('bluebird');var rp=require(_0xe2f2('0x3'));var fs=require('fs');var path=require(_0xe2f2('0x4'));var rimraf=require(_0xe2f2('0x5'));var config=require(_0xe2f2('0x6'));var attributes=require('./voiceAgentReport.attributes');module['exports']=function(_0x5b202f,_0x3dca30){return _0x5b202f[_0xe2f2('0x7')](_0xe2f2('0x8'),attributes,{'tableName':_0xe2f2('0x9'),'paranoid':![],'indexes':[{'fields':['uniqueid','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 ca4154b..cc9a8e6 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 _0x8e21=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','error','message','result','catch','CreateVoiceAgentReport','body','options','raw','then','stringify','UpdateVoiceAgentReport','update','where','attributes','limit','lodash','moment','randomstring'];(function(_0x1fa381,_0x758c2a){var _0x47eefe=function(_0x127f8c){while(--_0x127f8c){_0x1fa381['push'](_0x1fa381['shift']());}};_0x47eefe(++_0x758c2a);}(_0x8e21,0x13d));var _0x18e2=function(_0x1e06f1,_0x59d7e1){_0x1e06f1=_0x1e06f1-0x0;var _0x34f77e=_0x8e21[_0x1e06f1];return _0x34f77e;};'use strict';var _=require(_0x18e2('0x0'));var util=require('util');var moment=require(_0x18e2('0x1'));var BPromise=require('bluebird');var rs=require(_0x18e2('0x2'));var fs=require('fs');var Redis=require(_0x18e2('0x3'));var db=require(_0x18e2('0x4'))['db'];var utils=require(_0x18e2('0x5'));var logger=require(_0x18e2('0x6'))(_0x18e2('0x7'));var config=require(_0x18e2('0x8'));var jayson=require(_0x18e2('0x9'));var client=jayson['client'][_0x18e2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5c025c,_0x37e7bc,_0x4c3a49){return new BPromise(function(_0x538a84,_0x32b76e){return client[_0x18e2('0xb')](_0x5c025c,_0x4c3a49)['then'](function(_0x4ebc06){logger[_0x18e2('0xc')](_0x18e2('0xd'),_0x37e7bc,_0x18e2('0xe'));logger[_0x18e2('0xf')](_0x18e2('0x10'),_0x37e7bc,_0x18e2('0xe'),JSON['stringify'](_0x4ebc06));if(_0x4ebc06[_0x18e2('0x11')]){if(_0x4ebc06[_0x18e2('0x11')]['code']===0x1f4){logger['error'](_0x18e2('0xd'),_0x37e7bc,_0x4ebc06[_0x18e2('0x11')][_0x18e2('0x12')]);return _0x32b76e(_0x4ebc06[_0x18e2('0x11')][_0x18e2('0x12')]);}logger[_0x18e2('0x11')](_0x18e2('0xd'),_0x37e7bc,_0x4ebc06[_0x18e2('0x11')][_0x18e2('0x12')]);return _0x538a84(_0x4ebc06[_0x18e2('0x11')][_0x18e2('0x12')]);}else{logger['info'](_0x18e2('0xd'),_0x37e7bc,'request\x20sent');_0x538a84(_0x4ebc06[_0x18e2('0x13')][_0x18e2('0x12')]);}})[_0x18e2('0x14')](function(_0x43a723){logger[_0x18e2('0x11')](_0x18e2('0xd'),_0x37e7bc,_0x43a723);_0x32b76e(_0x43a723);});});}exports[_0x18e2('0x15')]=function(_0x2d9f58){var _0x4109ca=this;return new Promise(function(_0x8cf6e6,_0x3bb389){return db['VoiceAgentReport']['create'](_0x2d9f58[_0x18e2('0x16')],{'raw':_0x2d9f58[_0x18e2('0x17')]?_0x2d9f58[_0x18e2('0x17')][_0x18e2('0x18')]===undefined?!![]:![]:!![]})[_0x18e2('0x19')](function(_0x2f7039){logger[_0x18e2('0xc')]('CreateVoiceAgentReport',_0x2d9f58);logger['debug'](_0x18e2('0x15'),_0x2d9f58,JSON[_0x18e2('0x1a')](_0x2f7039));_0x8cf6e6(_0x2f7039);})['catch'](function(_0x3bf687){logger[_0x18e2('0x11')](_0x18e2('0x15'),_0x3bf687['message'],_0x2d9f58);_0x3bb389(_0x4109ca[_0x18e2('0x11')](0x1f4,_0x3bf687[_0x18e2('0x12')]));});});};exports[_0x18e2('0x1b')]=function(_0x592199){var _0x3f01f1=this;return new Promise(function(_0x3801d9,_0x403143){return db['VoiceAgentReport'][_0x18e2('0x1c')](_0x592199[_0x18e2('0x16')],{'raw':_0x592199[_0x18e2('0x17')]?_0x592199[_0x18e2('0x17')][_0x18e2('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x592199['options']?_0x592199[_0x18e2('0x17')][_0x18e2('0x1d')]||null:null,'attributes':_0x592199[_0x18e2('0x17')]?_0x592199[_0x18e2('0x17')][_0x18e2('0x1e')]||null:null,'limit':_0x592199[_0x18e2('0x17')]?_0x592199['options'][_0x18e2('0x1f')]||null:null})[_0x18e2('0x19')](function(_0x39f679){logger['info'](_0x18e2('0x1b'),_0x592199);logger['debug'](_0x18e2('0x1b'),_0x592199,JSON['stringify'](_0x39f679));_0x3801d9(_0x39f679);})[_0x18e2('0x14')](function(_0x333ef3){logger[_0x18e2('0x11')]('UpdateVoiceAgentReport',_0x333ef3[_0x18e2('0x12')],_0x592199);_0x403143(_0x3f01f1[_0x18e2('0x11')](0x1f4,_0x333ef3['message']));});});}; \ No newline at end of file +var _0x0c34=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceAgentReport,\x20%s,\x20%s','message','result','catch','VoiceAgentReport','create','options','then','CreateVoiceAgentReport','UpdateVoiceAgentReport','update','body','where','attributes','limit','lodash','bluebird','ioredis','../../mysqldb'];(function(_0x59b533,_0x59fdcc){var _0x2beced=function(_0xd3aaf3){while(--_0xd3aaf3){_0x59b533['push'](_0x59b533['shift']());}};_0x2beced(++_0x59fdcc);}(_0x0c34,0x80));var _0x40c3=function(_0x2e2a27,_0x3e58d3){_0x2e2a27=_0x2e2a27-0x0;var _0x100752=_0x0c34[_0x2e2a27];return _0x100752;};'use strict';var _=require(_0x40c3('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x40c3('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x40c3('0x2'));var db=require(_0x40c3('0x3'))['db'];var utils=require(_0x40c3('0x4'));var logger=require(_0x40c3('0x5'))('rpc');var config=require(_0x40c3('0x6'));var jayson=require(_0x40c3('0x7'));var client=jayson[_0x40c3('0x8')][_0x40c3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4c73a8,_0x5057fd,_0x4954d7){return new BPromise(function(_0x2e6b90,_0xa655f8){return client[_0x40c3('0xa')](_0x4c73a8,_0x4954d7)['then'](function(_0x47bcab){logger[_0x40c3('0xb')]('VoiceAgentReport,\x20%s,\x20%s',_0x5057fd,_0x40c3('0xc'));logger[_0x40c3('0xd')](_0x40c3('0xe'),_0x5057fd,_0x40c3('0xc'),JSON[_0x40c3('0xf')](_0x47bcab));if(_0x47bcab[_0x40c3('0x10')]){if(_0x47bcab[_0x40c3('0x10')][_0x40c3('0x11')]===0x1f4){logger[_0x40c3('0x10')](_0x40c3('0x12'),_0x5057fd,_0x47bcab[_0x40c3('0x10')][_0x40c3('0x13')]);return _0xa655f8(_0x47bcab['error'][_0x40c3('0x13')]);}logger[_0x40c3('0x10')](_0x40c3('0x12'),_0x5057fd,_0x47bcab[_0x40c3('0x10')][_0x40c3('0x13')]);return _0x2e6b90(_0x47bcab[_0x40c3('0x10')][_0x40c3('0x13')]);}else{logger[_0x40c3('0xb')](_0x40c3('0x12'),_0x5057fd,_0x40c3('0xc'));_0x2e6b90(_0x47bcab[_0x40c3('0x14')][_0x40c3('0x13')]);}})[_0x40c3('0x15')](function(_0x2655dd){logger[_0x40c3('0x10')](_0x40c3('0x12'),_0x5057fd,_0x2655dd);_0xa655f8(_0x2655dd);});});}exports['CreateVoiceAgentReport']=function(_0x364779){var _0x4324b8=this;return new Promise(function(_0x535051,_0x3d4c0a){return db[_0x40c3('0x16')][_0x40c3('0x17')](_0x364779['body'],{'raw':_0x364779[_0x40c3('0x18')]?_0x364779[_0x40c3('0x18')]['raw']===undefined?!![]:![]:!![]})[_0x40c3('0x19')](function(_0x4669bf){logger['info']('CreateVoiceAgentReport',_0x364779);logger[_0x40c3('0xd')](_0x40c3('0x1a'),_0x364779,JSON[_0x40c3('0xf')](_0x4669bf));_0x535051(_0x4669bf);})['catch'](function(_0x3790a9){logger[_0x40c3('0x10')](_0x40c3('0x1a'),_0x3790a9[_0x40c3('0x13')],_0x364779);_0x3d4c0a(_0x4324b8['error'](0x1f4,_0x3790a9['message']));});});};exports[_0x40c3('0x1b')]=function(_0x3fd893){var _0x4a9dde=this;return new Promise(function(_0x2c3342,_0x2ba84a){return db['VoiceAgentReport'][_0x40c3('0x1c')](_0x3fd893[_0x40c3('0x1d')],{'raw':_0x3fd893['options']?_0x3fd893[_0x40c3('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3fd893[_0x40c3('0x18')]?_0x3fd893[_0x40c3('0x18')][_0x40c3('0x1e')]||null:null,'attributes':_0x3fd893[_0x40c3('0x18')]?_0x3fd893['options'][_0x40c3('0x1f')]||null:null,'limit':_0x3fd893[_0x40c3('0x18')]?_0x3fd893[_0x40c3('0x18')][_0x40c3('0x20')]||null:null})[_0x40c3('0x19')](function(_0xfd5efb){logger[_0x40c3('0xb')](_0x40c3('0x1b'),_0x3fd893);logger[_0x40c3('0xd')](_0x40c3('0x1b'),_0x3fd893,JSON['stringify'](_0xfd5efb));_0x2c3342(_0xfd5efb);})[_0x40c3('0x15')](function(_0x8df973){logger[_0x40c3('0x10')](_0x40c3('0x1b'),_0x8df973['message'],_0x3fd893);_0x2ba84a(_0x4a9dde[_0x40c3('0x10')](0x1f4,_0x8df973[_0x40c3('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index 3c93b6f..5c78c0d 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 _0x9c5a=['fs-extra','../../components/interaction/service','../../config/environment','get','index','describe','isAuthenticated','show','create','update','delete','/:id','destroy','exports','multer','util','connect-timeout','express','Router'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x9c5a,0x1c3));var _0xa9c5=function(_0x55221f,_0x1d3e6b){_0x55221f=_0x55221f-0x0;var _0x3e942b=_0x9c5a[_0x55221f];return _0x3e942b;};'use strict';var multer=require(_0xa9c5('0x0'));var util=require(_0xa9c5('0x1'));var path=require('path');var timeout=require(_0xa9c5('0x2'));var express=require(_0xa9c5('0x3'));var router=express[_0xa9c5('0x4')]();var fs_extra=require(_0xa9c5('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xa9c5('0x6'));var config=require(_0xa9c5('0x7'));var controller=require('./voiceCallReport.controller');router[_0xa9c5('0x8')]('/',auth['isAuthenticated'](),controller[_0xa9c5('0x9')]);router[_0xa9c5('0x8')]('/describe',auth['isAuthenticated'](),controller[_0xa9c5('0xa')]);router[_0xa9c5('0x8')]('/:id',auth[_0xa9c5('0xb')](),controller[_0xa9c5('0xc')]);router['post']('/',auth[_0xa9c5('0xb')](),controller[_0xa9c5('0xd')]);router['put']('/:id',auth[_0xa9c5('0xb')](),controller[_0xa9c5('0xe')]);router[_0xa9c5('0xf')](_0xa9c5('0x10'),auth[_0xa9c5('0xb')](),controller[_0xa9c5('0x11')]);module[_0xa9c5('0x12')]=router; \ No newline at end of file +var _0x24ca=['create','update','delete','destroy','multer','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceCallReport.controller','get','/describe','isAuthenticated','describe','/:id','post'];(function(_0x5aaf93,_0x5c0001){var _0x17d307=function(_0x21d77a){while(--_0x21d77a){_0x5aaf93['push'](_0x5aaf93['shift']());}};_0x17d307(++_0x5c0001);}(_0x24ca,0x8c));var _0xa24c=function(_0x51bda1,_0x44f80d){_0x51bda1=_0x51bda1-0x0;var _0x1ce08c=_0x24ca[_0x51bda1];return _0x1ce08c;};'use strict';var multer=require(_0xa24c('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xa24c('0x1'));var express=require('express');var router=express[_0xa24c('0x2')]();var fs_extra=require(_0xa24c('0x3'));var auth=require(_0xa24c('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xa24c('0x5'));var controller=require(_0xa24c('0x6'));router[_0xa24c('0x7')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xa24c('0x8'),auth[_0xa24c('0x9')](),controller[_0xa24c('0xa')]);router[_0xa24c('0x7')](_0xa24c('0xb'),auth[_0xa24c('0x9')](),controller['show']);router[_0xa24c('0xc')]('/',auth[_0xa24c('0x9')](),controller[_0xa24c('0xd')]);router['put']('/:id',auth[_0xa24c('0x9')](),controller[_0xa24c('0xe')]);router[_0xa24c('0xf')](_0xa24c('0xb'),auth[_0xa24c('0x9')](),controller[_0xa24c('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index 80a7b86..178a2ad 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 _0x4012=['inbound','outbound','inbound-fax','outbound-fax','dialer','DATE','INTEGER','sequelize','exports','STRING','ENUM'];(function(_0x5a5038,_0x5044c0){var _0x42cc9e=function(_0x4de4b2){while(--_0x4de4b2){_0x5a5038['push'](_0x5a5038['shift']());}};_0x42cc9e(++_0x5044c0);}(_0x4012,0x1bf));var _0x2401=function(_0x3d0215,_0x2f9ef4){_0x3d0215=_0x3d0215-0x0;var _0x5af3ea=_0x4012[_0x3d0215];return _0x5af3ea;};'use strict';var Sequelize=require(_0x2401('0x0'));module[_0x2401('0x1')]={'uniqueid':{'type':Sequelize[_0x2401('0x2')]},'type':{'type':Sequelize[_0x2401('0x3')](_0x2401('0x4'),'internal',_0x2401('0x5'),_0x2401('0x6'),_0x2401('0x7'),_0x2401('0x8'))},'tag':{'type':Sequelize[_0x2401('0x2')]},'accountcode':{'type':Sequelize[_0x2401('0x2')]},'source':{'type':Sequelize[_0x2401('0x2')]},'destination':{'type':Sequelize[_0x2401('0x2')]},'destinationcontext':{'type':Sequelize[_0x2401('0x2')]},'callerid':{'type':Sequelize[_0x2401('0x2')]},'channel':{'type':Sequelize[_0x2401('0x2')]},'destinationchannel':{'type':Sequelize['STRING']},'lastapplication':{'type':Sequelize[_0x2401('0x2')]},'lastdata':{'type':Sequelize['TEXT']},'starttime':{'type':Sequelize[_0x2401('0x9')]},'systemanswertime':{'type':Sequelize[_0x2401('0x9')]},'answertime':{'type':Sequelize[_0x2401('0x9')]},'endtime':{'type':Sequelize[_0x2401('0x9')]},'duration':{'type':Sequelize[_0x2401('0xa')]},'billableseconds':{'type':Sequelize[_0x2401('0xa')]},'mohtime':{'type':Sequelize[_0x2401('0xa')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x2401('0x2')]},'amaflags':{'type':Sequelize[_0x2401('0x2')]},'userfield':{'type':Sequelize[_0x2401('0x2')]},'userDisposition':{'type':Sequelize[_0x2401('0x2')]},'userSecondDisposition':{'type':Sequelize[_0x2401('0x2')]},'userThirdDisposition':{'type':Sequelize[_0x2401('0x2')]},'note':{'type':Sequelize[_0x2401('0x2')]},'prefix':{'type':Sequelize['STRING']},'routeid':{'type':Sequelize[_0x2401('0xa')]},'sipcallid':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xa846=['DATE','INTEGER','exports','STRING','ENUM','inbound','internal','outbound','outbound-fax','dialer'];(function(_0x2f9fbf,_0x591d39){var _0xc2bc1c=function(_0x203ff9){while(--_0x203ff9){_0x2f9fbf['push'](_0x2f9fbf['shift']());}};_0xc2bc1c(++_0x591d39);}(_0xa846,0x70));var _0x6a84=function(_0x24af8a,_0x36499e){_0x24af8a=_0x24af8a-0x0;var _0x47fb01=_0xa846[_0x24af8a];return _0x47fb01;};'use strict';var Sequelize=require('sequelize');module[_0x6a84('0x0')]={'uniqueid':{'type':Sequelize[_0x6a84('0x1')]},'type':{'type':Sequelize[_0x6a84('0x2')](_0x6a84('0x3'),_0x6a84('0x4'),_0x6a84('0x5'),'inbound-fax',_0x6a84('0x6'),_0x6a84('0x7'))},'tag':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x6a84('0x1')]},'source':{'type':Sequelize[_0x6a84('0x1')]},'destination':{'type':Sequelize[_0x6a84('0x1')]},'destinationcontext':{'type':Sequelize[_0x6a84('0x1')]},'callerid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x6a84('0x1')]},'destinationchannel':{'type':Sequelize['STRING']},'lastapplication':{'type':Sequelize[_0x6a84('0x1')]},'lastdata':{'type':Sequelize['TEXT']},'starttime':{'type':Sequelize[_0x6a84('0x8')]},'systemanswertime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0x6a84('0x8')]},'endtime':{'type':Sequelize[_0x6a84('0x8')]},'duration':{'type':Sequelize[_0x6a84('0x9')]},'billableseconds':{'type':Sequelize[_0x6a84('0x9')]},'mohtime':{'type':Sequelize[_0x6a84('0x9')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x6a84('0x1')]},'amaflags':{'type':Sequelize[_0x6a84('0x1')]},'userfield':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize[_0x6a84('0x1')]},'userSecondDisposition':{'type':Sequelize[_0x6a84('0x1')]},'userThirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x6a84('0x1')]},'prefix':{'type':Sequelize['STRING']},'routeid':{'type':Sequelize[_0x6a84('0x9')]},'sipcallid':{'type':Sequelize[_0x6a84('0x1')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index 775899a..194546a 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 _0x2032=['../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','sendStatus','error','stack','name','send','index','map','VoiceCallReport','fieldName','type','key','query','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','pick','filters','filter','merge','where','options','alias','User','rows','catch','show','params','keys','rawAttributes','includeAll','include','create','body','find','describe','uniqueid','user','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2032,0xd9));var _0x2203=function(_0x51a0d9,_0x3ff6ea){_0x51a0d9=_0x51a0d9-0x0;var _0x2044d0=_0x2032[_0x51a0d9];return _0x2044d0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2203('0x0'));var zipdir=require(_0x2203('0x1'));var jsonpatch=require(_0x2203('0x2'));var rp=require('request-promise');var moment=require(_0x2203('0x3'));var BPromise=require(_0x2203('0x4'));var Mustache=require('mustache');var util=require(_0x2203('0x5'));var path=require(_0x2203('0x6'));var sox=require(_0x2203('0x7'));var csv=require(_0x2203('0x8'));var ejs=require(_0x2203('0x9'));var fs=require('fs');var fs_extra=require(_0x2203('0xa'));var _=require(_0x2203('0xb'));var squel=require(_0x2203('0xc'));var crypto=require(_0x2203('0xd'));var jsforce=require(_0x2203('0xe'));var deskjs=require(_0x2203('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2203('0x10'));var Redis=require('ioredis');var authService=require(_0x2203('0x11'));var qs=require(_0x2203('0x12'));var as=require(_0x2203('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2203('0x14'))('api');var utils=require(_0x2203('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x2203('0x16'));var db=require(_0x2203('0x17'))['db'];function respondWithStatusCode(_0x4b9376,_0x583bc7){_0x583bc7=_0x583bc7||0xcc;return function(_0x585c76){if(_0x585c76){return _0x4b9376['sendStatus'](_0x583bc7);}return _0x4b9376['status'](_0x583bc7)[_0x2203('0x18')]();};}function respondWithResult(_0x538b30,_0x592e47){_0x592e47=_0x592e47||0xc8;return function(_0x21a3af){if(_0x21a3af){return _0x538b30[_0x2203('0x19')](_0x592e47)[_0x2203('0x1a')](_0x21a3af);}};}function respondWithFilteredResult(_0x41af85,_0x226209){return function(_0x3fe0a8){if(_0x3fe0a8){var _0x2c36e6=typeof _0x226209[_0x2203('0x1b')]===_0x2203('0x1c')&&typeof _0x226209[_0x2203('0x1d')]==='undefined';var _0x280eda=_0x3fe0a8[_0x2203('0x1e')];var _0x4893ff=_0x2c36e6?0x0:_0x226209[_0x2203('0x1b')];var _0x8906e1=_0x2c36e6?_0x3fe0a8['count']:_0x226209[_0x2203('0x1b')]+_0x226209['limit'];var _0x2904ba;if(_0x8906e1>=_0x280eda){_0x8906e1=_0x280eda;_0x2904ba=0xc8;}else{_0x2904ba=0xce;}_0x41af85[_0x2203('0x19')](_0x2904ba);return _0x41af85[_0x2203('0x1f')](_0x2203('0x20'),_0x4893ff+'-'+_0x8906e1+'/'+_0x280eda)[_0x2203('0x1a')](_0x3fe0a8);}return null;};}function patchUpdates(_0x449039){return function(_0x538c23){try{jsonpatch[_0x2203('0x21')](_0x538c23,_0x449039,!![]);}catch(_0x50822b){return BPromise['reject'](_0x50822b);}return _0x538c23[_0x2203('0x22')]();};}function saveUpdates(_0x496d82,_0x3b8ef9){return function(_0x5bfe61){if(_0x5bfe61){return _0x5bfe61['update'](_0x496d82)[_0x2203('0x23')](function(_0x5e29cd){return _0x5e29cd;});}return null;};}function removeEntity(_0x5c8da9,_0x226374){return function(_0x2718f5){if(_0x2718f5){return _0x2718f5[_0x2203('0x24')]()[_0x2203('0x23')](function(){_0x5c8da9[_0x2203('0x19')](0xcc)[_0x2203('0x18')]();});}};}function handleEntityNotFound(_0x49c12,_0x250349){return function(_0x576378){if(!_0x576378){_0x49c12[_0x2203('0x25')](0x194);}return _0x576378;};}function handleError(_0x36b958,_0x39a11a){_0x39a11a=_0x39a11a||0x1f4;return function(_0x5f11bf){logger[_0x2203('0x26')](_0x5f11bf[_0x2203('0x27')]);if(_0x5f11bf['name']){delete _0x5f11bf[_0x2203('0x28')];}_0x36b958[_0x2203('0x19')](_0x39a11a)[_0x2203('0x29')](_0x5f11bf);};}exports[_0x2203('0x2a')]=function(_0x28ae02,_0x1df508){var _0x9c53f={},_0x5a95c1={},_0x34b8ba={'count':0x0,'rows':[]};var _0x616ed8=_[_0x2203('0x2b')](db[_0x2203('0x2c')]['rawAttributes'],function(_0x3a8e23){return{'name':_0x3a8e23[_0x2203('0x2d')],'type':_0x3a8e23[_0x2203('0x2e')][_0x2203('0x2f')]};});_0x5a95c1['model']=_[_0x2203('0x2b')](_0x616ed8,_0x2203('0x28'));_0x5a95c1['query']=_['keys'](_0x28ae02[_0x2203('0x30')]);_0x5a95c1['filters']=_['intersection'](_0x5a95c1[_0x2203('0x31')],_0x5a95c1[_0x2203('0x30')]);_0x9c53f[_0x2203('0x32')]=_[_0x2203('0x33')](_0x5a95c1[_0x2203('0x31')],qs['fields'](_0x28ae02[_0x2203('0x30')][_0x2203('0x34')]));_0x9c53f['attributes']=_0x9c53f[_0x2203('0x32')][_0x2203('0x35')]?_0x9c53f[_0x2203('0x32')]:_0x5a95c1[_0x2203('0x31')];if(!_0x28ae02[_0x2203('0x30')][_0x2203('0x36')](_0x2203('0x37'))){_0x9c53f[_0x2203('0x1d')]=qs[_0x2203('0x1d')](_0x28ae02['query'][_0x2203('0x1d')]);_0x9c53f[_0x2203('0x1b')]=qs['offset'](_0x28ae02['query'][_0x2203('0x1b')]);}_0x9c53f['order']=qs[_0x2203('0x38')](_0x28ae02[_0x2203('0x30')][_0x2203('0x38')]);_0x9c53f['where']=qs['filters'](_[_0x2203('0x39')](_0x28ae02['query'],_0x5a95c1[_0x2203('0x3a')]),_0x616ed8);if(_0x28ae02['query'][_0x2203('0x3b')]){_0x9c53f['where']=_[_0x2203('0x3c')](_0x9c53f[_0x2203('0x3d')],{'$or':_[_0x2203('0x2b')](_0x616ed8,function(_0x40a793){if(_0x40a793[_0x2203('0x2e')]!=='VIRTUAL'){var _0x5f1561={};_0x5f1561[_0x40a793['name']]={'$like':'%'+_0x28ae02[_0x2203('0x30')][_0x2203('0x3b')]+'%'};return _0x5f1561;}})});}_0x9c53f=_[_0x2203('0x3c')]({},_0x9c53f,_0x28ae02[_0x2203('0x3e')]);var _0x3283fb={'where':_0x9c53f[_0x2203('0x3d')]};return db[_0x2203('0x2c')]['count'](_0x3283fb)[_0x2203('0x23')](function(_0x1b12c3){_0x34b8ba[_0x2203('0x1e')]=_0x1b12c3;if(_0x28ae02[_0x2203('0x30')]['includeAll']){_0x9c53f['include']=[{'attributes':['id',_0x2203('0x28'),'fullname',_0x2203('0x3f')],'model':db[_0x2203('0x40')],'as':_0x2203('0x40')}];}return db['VoiceCallReport']['findAll'](_0x9c53f);})[_0x2203('0x23')](function(_0x3739f6){_0x34b8ba[_0x2203('0x41')]=_0x3739f6;return _0x34b8ba;})[_0x2203('0x23')](respondWithFilteredResult(_0x1df508,_0x9c53f))[_0x2203('0x42')](handleError(_0x1df508,null));};exports[_0x2203('0x43')]=function(_0x5cd573,_0x15d3b6){var _0x165a3f={'raw':!![],'where':{'id':_0x5cd573[_0x2203('0x44')]['id']}},_0x3a866c={};_0x3a866c[_0x2203('0x31')]=_[_0x2203('0x45')](db[_0x2203('0x2c')][_0x2203('0x46')]);_0x3a866c[_0x2203('0x30')]=_[_0x2203('0x45')](_0x5cd573['query']);_0x3a866c[_0x2203('0x3a')]=_[_0x2203('0x33')](_0x3a866c[_0x2203('0x31')],_0x3a866c[_0x2203('0x30')]);_0x165a3f['attributes']=_['intersection'](_0x3a866c[_0x2203('0x31')],qs['fields'](_0x5cd573[_0x2203('0x30')][_0x2203('0x34')]));_0x165a3f[_0x2203('0x32')]=_0x165a3f[_0x2203('0x32')]['length']?_0x165a3f[_0x2203('0x32')]:_0x3a866c[_0x2203('0x31')];if(_0x5cd573['query'][_0x2203('0x47')]){_0x165a3f[_0x2203('0x48')]=[{'all':!![]}];}_0x165a3f=_[_0x2203('0x3c')]({},_0x165a3f,_0x5cd573[_0x2203('0x3e')]);return db['VoiceCallReport']['find'](_0x165a3f)[_0x2203('0x23')](handleEntityNotFound(_0x15d3b6,null))['then'](respondWithResult(_0x15d3b6,null))['catch'](handleError(_0x15d3b6,null));};exports[_0x2203('0x49')]=function(_0x33b7b5,_0x1a2665){return db['VoiceCallReport']['create'](_0x33b7b5[_0x2203('0x4a')],{})[_0x2203('0x23')](respondWithResult(_0x1a2665,0xc9))[_0x2203('0x42')](handleError(_0x1a2665,null));};exports[_0x2203('0x24')]=function(_0x225b0e,_0x21fd78){return db['VoiceCallReport'][_0x2203('0x4b')]({'where':{'id':_0x225b0e['params']['id']}})[_0x2203('0x23')](handleEntityNotFound(_0x21fd78,null))[_0x2203('0x23')](removeEntity(_0x21fd78,null))[_0x2203('0x42')](handleError(_0x21fd78,null));};exports[_0x2203('0x4c')]=function(_0x58b9bb,_0x506795){return db[_0x2203('0x2c')][_0x2203('0x4c')]()[_0x2203('0x23')](respondWithResult(_0x506795,null))[_0x2203('0x42')](handleError(_0x506795,null));};exports['update']=function(_0x4de47a,_0x49999a){if(_0x4de47a[_0x2203('0x4a')][_0x2203('0x4d')]){delete _0x4de47a['body'][_0x2203('0x4d')];}return db[_0x2203('0x2c')]['find']({'where':{'uniqueid':_0x4de47a[_0x2203('0x44')]['id'],'UserId':{'$or':[null,_0x4de47a[_0x2203('0x4e')]['id']]}}})[_0x2203('0x23')](handleEntityNotFound(_0x49999a,null))[_0x2203('0x23')](saveUpdates(_0x4de47a['body'],null))[_0x2203('0x23')](respondWithResult(_0x49999a,null))['catch'](handleError(_0x49999a,null));}; \ No newline at end of file +var _0xdb28=['options','includeAll','fullname','User','findAll','rows','catch','show','params','rawAttributes','intersection','include','find','create','destroy','describe','body','uniqueid','user','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','apply','save','update','then','sendStatus','error','stack','name','send','index','VoiceCallReport','fieldName','type','key','map','query','keys','model','fields','attributes','length','nolimit','order','sort','filters','filter','where','VIRTUAL','merge'];(function(_0x3e62f5,_0x42e3bd){var _0x20faf0=function(_0x3b5b9b){while(--_0x3b5b9b){_0x3e62f5['push'](_0x3e62f5['shift']());}};_0x20faf0(++_0x42e3bd);}(_0xdb28,0x106));var _0x8db2=function(_0x38fb19,_0x113ace){_0x38fb19=_0x38fb19-0x0;var _0x59152f=_0xdb28[_0x38fb19];return _0x59152f;};'use strict';var emlformat=require(_0x8db2('0x0'));var rimraf=require(_0x8db2('0x1'));var zipdir=require(_0x8db2('0x2'));var jsonpatch=require(_0x8db2('0x3'));var rp=require('request-promise');var moment=require(_0x8db2('0x4'));var BPromise=require(_0x8db2('0x5'));var Mustache=require(_0x8db2('0x6'));var util=require(_0x8db2('0x7'));var path=require(_0x8db2('0x8'));var sox=require('sox');var csv=require(_0x8db2('0x9'));var ejs=require(_0x8db2('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x8db2('0xb'));var crypto=require(_0x8db2('0xc'));var jsforce=require(_0x8db2('0xd'));var deskjs=require(_0x8db2('0xe'));var toCsv=require(_0x8db2('0x9'));var querystring=require(_0x8db2('0xf'));var Papa=require(_0x8db2('0x10'));var Redis=require('ioredis');var authService=require(_0x8db2('0x11'));var qs=require(_0x8db2('0x12'));var as=require(_0x8db2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8db2('0x14'))(_0x8db2('0x15'));var utils=require('../../config/utils');var config=require(_0x8db2('0x16'));var licenseUtil=require(_0x8db2('0x17'));var db=require(_0x8db2('0x18'))['db'];function respondWithStatusCode(_0x204f49,_0x37d017){_0x37d017=_0x37d017||0xcc;return function(_0x559fb1){if(_0x559fb1){return _0x204f49['sendStatus'](_0x37d017);}return _0x204f49[_0x8db2('0x19')](_0x37d017)[_0x8db2('0x1a')]();};}function respondWithResult(_0x350d61,_0x1d6a15){_0x1d6a15=_0x1d6a15||0xc8;return function(_0x227355){if(_0x227355){return _0x350d61[_0x8db2('0x19')](_0x1d6a15)[_0x8db2('0x1b')](_0x227355);}};}function respondWithFilteredResult(_0x3c96a7,_0x131252){return function(_0x16c8c2){if(_0x16c8c2){var _0x5489a9=typeof _0x131252[_0x8db2('0x1c')]===_0x8db2('0x1d')&&typeof _0x131252['limit']===_0x8db2('0x1d');var _0x44957d=_0x16c8c2[_0x8db2('0x1e')];var _0x3fddc2=_0x5489a9?0x0:_0x131252[_0x8db2('0x1c')];var _0x46ce14=_0x5489a9?_0x16c8c2['count']:_0x131252['offset']+_0x131252[_0x8db2('0x1f')];var _0x104e33;if(_0x46ce14>=_0x44957d){_0x46ce14=_0x44957d;_0x104e33=0xc8;}else{_0x104e33=0xce;}_0x3c96a7[_0x8db2('0x19')](_0x104e33);return _0x3c96a7[_0x8db2('0x20')]('Content-Range',_0x3fddc2+'-'+_0x46ce14+'/'+_0x44957d)[_0x8db2('0x1b')](_0x16c8c2);}return null;};}function patchUpdates(_0x36a9ff){return function(_0x260940){try{jsonpatch[_0x8db2('0x21')](_0x260940,_0x36a9ff,!![]);}catch(_0x3dbe8e){return BPromise['reject'](_0x3dbe8e);}return _0x260940[_0x8db2('0x22')]();};}function saveUpdates(_0x3e30e6,_0x18f69c){return function(_0x125be2){if(_0x125be2){return _0x125be2[_0x8db2('0x23')](_0x3e30e6)[_0x8db2('0x24')](function(_0x796ec1){return _0x796ec1;});}return null;};}function removeEntity(_0x5c6614,_0x256202){return function(_0x4f6516){if(_0x4f6516){return _0x4f6516['destroy']()['then'](function(){_0x5c6614['status'](0xcc)[_0x8db2('0x1a')]();});}};}function handleEntityNotFound(_0x29b5cd,_0x3be281){return function(_0x2baed0){if(!_0x2baed0){_0x29b5cd[_0x8db2('0x25')](0x194);}return _0x2baed0;};}function handleError(_0x8d4f54,_0x58cd9d){_0x58cd9d=_0x58cd9d||0x1f4;return function(_0x3544ba){logger[_0x8db2('0x26')](_0x3544ba[_0x8db2('0x27')]);if(_0x3544ba[_0x8db2('0x28')]){delete _0x3544ba['name'];}_0x8d4f54[_0x8db2('0x19')](_0x58cd9d)[_0x8db2('0x29')](_0x3544ba);};}exports[_0x8db2('0x2a')]=function(_0x1687ed,_0xbe5ece){var _0x21bae5={},_0xa54ea3={},_0x3124d5={'count':0x0,'rows':[]};var _0xbc5366=_['map'](db[_0x8db2('0x2b')]['rawAttributes'],function(_0x59cb77){return{'name':_0x59cb77[_0x8db2('0x2c')],'type':_0x59cb77[_0x8db2('0x2d')][_0x8db2('0x2e')]};});_0xa54ea3['model']=_[_0x8db2('0x2f')](_0xbc5366,'name');_0xa54ea3[_0x8db2('0x30')]=_[_0x8db2('0x31')](_0x1687ed[_0x8db2('0x30')]);_0xa54ea3['filters']=_['intersection'](_0xa54ea3[_0x8db2('0x32')],_0xa54ea3[_0x8db2('0x30')]);_0x21bae5['attributes']=_['intersection'](_0xa54ea3[_0x8db2('0x32')],qs[_0x8db2('0x33')](_0x1687ed[_0x8db2('0x30')][_0x8db2('0x33')]));_0x21bae5[_0x8db2('0x34')]=_0x21bae5[_0x8db2('0x34')][_0x8db2('0x35')]?_0x21bae5[_0x8db2('0x34')]:_0xa54ea3[_0x8db2('0x32')];if(!_0x1687ed[_0x8db2('0x30')]['hasOwnProperty'](_0x8db2('0x36'))){_0x21bae5[_0x8db2('0x1f')]=qs['limit'](_0x1687ed[_0x8db2('0x30')][_0x8db2('0x1f')]);_0x21bae5['offset']=qs['offset'](_0x1687ed[_0x8db2('0x30')]['offset']);}_0x21bae5[_0x8db2('0x37')]=qs[_0x8db2('0x38')](_0x1687ed[_0x8db2('0x30')][_0x8db2('0x38')]);_0x21bae5['where']=qs[_0x8db2('0x39')](_['pick'](_0x1687ed[_0x8db2('0x30')],_0xa54ea3[_0x8db2('0x39')]),_0xbc5366);if(_0x1687ed[_0x8db2('0x30')][_0x8db2('0x3a')]){_0x21bae5['where']=_['merge'](_0x21bae5[_0x8db2('0x3b')],{'$or':_[_0x8db2('0x2f')](_0xbc5366,function(_0x5dc2b4){if(_0x5dc2b4[_0x8db2('0x2d')]!==_0x8db2('0x3c')){var _0x656dd2={};_0x656dd2[_0x5dc2b4['name']]={'$like':'%'+_0x1687ed[_0x8db2('0x30')][_0x8db2('0x3a')]+'%'};return _0x656dd2;}})});}_0x21bae5=_[_0x8db2('0x3d')]({},_0x21bae5,_0x1687ed[_0x8db2('0x3e')]);var _0x2e6f0c={'where':_0x21bae5[_0x8db2('0x3b')]};return db[_0x8db2('0x2b')][_0x8db2('0x1e')](_0x2e6f0c)[_0x8db2('0x24')](function(_0x63c561){_0x3124d5[_0x8db2('0x1e')]=_0x63c561;if(_0x1687ed[_0x8db2('0x30')][_0x8db2('0x3f')]){_0x21bae5['include']=[{'attributes':['id',_0x8db2('0x28'),_0x8db2('0x40'),'alias'],'model':db['User'],'as':_0x8db2('0x41')}];}return db['VoiceCallReport'][_0x8db2('0x42')](_0x21bae5);})[_0x8db2('0x24')](function(_0x313130){_0x3124d5[_0x8db2('0x43')]=_0x313130;return _0x3124d5;})[_0x8db2('0x24')](respondWithFilteredResult(_0xbe5ece,_0x21bae5))[_0x8db2('0x44')](handleError(_0xbe5ece,null));};exports[_0x8db2('0x45')]=function(_0x5c97ef,_0x2f86b1){var _0x3d44de={'raw':!![],'where':{'id':_0x5c97ef[_0x8db2('0x46')]['id']}},_0x40c69e={};_0x40c69e['model']=_[_0x8db2('0x31')](db[_0x8db2('0x2b')][_0x8db2('0x47')]);_0x40c69e[_0x8db2('0x30')]=_['keys'](_0x5c97ef[_0x8db2('0x30')]);_0x40c69e['filters']=_[_0x8db2('0x48')](_0x40c69e[_0x8db2('0x32')],_0x40c69e[_0x8db2('0x30')]);_0x3d44de['attributes']=_['intersection'](_0x40c69e[_0x8db2('0x32')],qs['fields'](_0x5c97ef[_0x8db2('0x30')][_0x8db2('0x33')]));_0x3d44de[_0x8db2('0x34')]=_0x3d44de[_0x8db2('0x34')][_0x8db2('0x35')]?_0x3d44de[_0x8db2('0x34')]:_0x40c69e[_0x8db2('0x32')];if(_0x5c97ef[_0x8db2('0x30')][_0x8db2('0x3f')]){_0x3d44de[_0x8db2('0x49')]=[{'all':!![]}];}_0x3d44de=_[_0x8db2('0x3d')]({},_0x3d44de,_0x5c97ef[_0x8db2('0x3e')]);return db['VoiceCallReport'][_0x8db2('0x4a')](_0x3d44de)[_0x8db2('0x24')](handleEntityNotFound(_0x2f86b1,null))[_0x8db2('0x24')](respondWithResult(_0x2f86b1,null))[_0x8db2('0x44')](handleError(_0x2f86b1,null));};exports['create']=function(_0x4ffd9d,_0x11c224){return db[_0x8db2('0x2b')][_0x8db2('0x4b')](_0x4ffd9d['body'],{})['then'](respondWithResult(_0x11c224,0xc9))['catch'](handleError(_0x11c224,null));};exports[_0x8db2('0x4c')]=function(_0x368c37,_0x55c7dd){return db[_0x8db2('0x2b')][_0x8db2('0x4a')]({'where':{'id':_0x368c37[_0x8db2('0x46')]['id']}})[_0x8db2('0x24')](handleEntityNotFound(_0x55c7dd,null))['then'](removeEntity(_0x55c7dd,null))['catch'](handleError(_0x55c7dd,null));};exports[_0x8db2('0x4d')]=function(_0x18c6ef,_0x2908e4){return db[_0x8db2('0x2b')][_0x8db2('0x4d')]()[_0x8db2('0x24')](respondWithResult(_0x2908e4,null))[_0x8db2('0x44')](handleError(_0x2908e4,null));};exports[_0x8db2('0x23')]=function(_0x4187d6,_0x426ae0){if(_0x4187d6[_0x8db2('0x4e')][_0x8db2('0x4f')]){delete _0x4187d6[_0x8db2('0x4e')][_0x8db2('0x4f')];}return db[_0x8db2('0x2b')]['find']({'where':{'uniqueid':_0x4187d6[_0x8db2('0x46')]['id'],'UserId':{'$or':[null,_0x4187d6[_0x8db2('0x50')]['id']]}}})['then'](handleEntityNotFound(_0x426ae0,null))[_0x8db2('0x24')](saveUpdates(_0x4187d6[_0x8db2('0x4e')],null))[_0x8db2('0x24')](respondWithResult(_0x426ae0,null))['catch'](handleError(_0x426ae0,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index 301713f..d343c6a 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 _0x4b06=['moment','bluebird','request-promise','path','../../config/environment','./voiceCallReport.attributes','define','VoiceCallReport','lodash','util','../../config/logger'];(function(_0x1519ef,_0x5d53b7){var _0x1682fd=function(_0xe72f50){while(--_0xe72f50){_0x1519ef['push'](_0x1519ef['shift']());}};_0x1682fd(++_0x5d53b7);}(_0x4b06,0x97));var _0x64b0=function(_0x79fdd7,_0x547430){_0x79fdd7=_0x79fdd7-0x0;var _0x15a992=_0x4b06[_0x79fdd7];return _0x15a992;};'use strict';var _=require(_0x64b0('0x0'));var util=require(_0x64b0('0x1'));var logger=require(_0x64b0('0x2'))('api');var moment=require(_0x64b0('0x3'));var BPromise=require(_0x64b0('0x4'));var rp=require(_0x64b0('0x5'));var fs=require('fs');var path=require(_0x64b0('0x6'));var rimraf=require('rimraf');var config=require(_0x64b0('0x7'));var attributes=require(_0x64b0('0x8'));module['exports']=function(_0xb88b5a,_0x454e58){return _0xb88b5a[_0x64b0('0x9')](_0x64b0('0xa'),attributes,{'tableName':'report_call','paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x4ee3=['report_call','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','./voiceCallReport.attributes','define'];(function(_0x2ea0ca,_0xe72520){var _0x919e2f=function(_0x15b050){while(--_0x15b050){_0x2ea0ca['push'](_0x2ea0ca['shift']());}};_0x919e2f(++_0xe72520);}(_0x4ee3,0x120));var _0x34ee=function(_0x10138d,_0x21f327){_0x10138d=_0x10138d-0x0;var _0x50bbd0=_0x4ee3[_0x10138d];return _0x50bbd0;};'use strict';var _=require(_0x34ee('0x0'));var util=require(_0x34ee('0x1'));var logger=require(_0x34ee('0x2'))('api');var moment=require(_0x34ee('0x3'));var BPromise=require(_0x34ee('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x34ee('0x5'));var rimraf=require(_0x34ee('0x6'));var config=require('../../config/environment');var attributes=require(_0x34ee('0x7'));module['exports']=function(_0xd9ffb8,_0x12abdb){return _0xd9ffb8[_0x34ee('0x8')]('VoiceCallReport',attributes,{'tableName':_0x34ee('0x9'),'paranoid':![],'indexes':[{'fields':[_0x34ee('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 b69dff9..8c68a2c 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 _0x14da=['client','http','request','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','VoiceCallReport','findAll','options','raw','where','attributes','limit','include','map','model','then','info','GetVoiceCallReport','CreateVoiceCallReport','UpdateVoiceCallReport','update','body','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x14da,0x136));var _0xa14d=function(_0x40d078,_0x210a77){_0x40d078=_0x40d078-0x0;var _0x46fc81=_0x14da[_0x40d078];return _0x46fc81;};'use strict';var _=require(_0xa14d('0x0'));var util=require(_0xa14d('0x1'));var moment=require(_0xa14d('0x2'));var BPromise=require(_0xa14d('0x3'));var rs=require(_0xa14d('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa14d('0x5'))['db'];var utils=require(_0xa14d('0x6'));var logger=require(_0xa14d('0x7'))(_0xa14d('0x8'));var config=require('../../config/environment');var jayson=require(_0xa14d('0x9'));var client=jayson[_0xa14d('0xa')][_0xa14d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1d7d22,_0x1acf36,_0x432747){return new BPromise(function(_0x214331,_0x66b1d4){return client[_0xa14d('0xc')](_0x1d7d22,_0x432747)['then'](function(_0x262d71){logger['info'](_0xa14d('0xd'),_0x1acf36,_0xa14d('0xe'));logger[_0xa14d('0xf')](_0xa14d('0x10'),_0x1acf36,_0xa14d('0xe'),JSON[_0xa14d('0x11')](_0x262d71));if(_0x262d71['error']){if(_0x262d71[_0xa14d('0x12')][_0xa14d('0x13')]===0x1f4){logger[_0xa14d('0x12')](_0xa14d('0xd'),_0x1acf36,_0x262d71[_0xa14d('0x12')][_0xa14d('0x14')]);return _0x66b1d4(_0x262d71['error']['message']);}logger[_0xa14d('0x12')](_0xa14d('0xd'),_0x1acf36,_0x262d71[_0xa14d('0x12')][_0xa14d('0x14')]);return _0x214331(_0x262d71[_0xa14d('0x12')][_0xa14d('0x14')]);}else{logger['info'](_0xa14d('0xd'),_0x1acf36,_0xa14d('0xe'));_0x214331(_0x262d71[_0xa14d('0x15')][_0xa14d('0x14')]);}})[_0xa14d('0x16')](function(_0x223a91){logger[_0xa14d('0x12')]('VoiceCallReport,\x20%s,\x20%s',_0x1acf36,_0x223a91);_0x66b1d4(_0x223a91);});});}exports['GetVoiceCallReport']=function(_0x47f5d0){var _0x49aeb9=this;return new Promise(function(_0x3c2473,_0x294706){return db[_0xa14d('0x17')][_0xa14d('0x18')]({'raw':_0x47f5d0[_0xa14d('0x19')]?_0x47f5d0[_0xa14d('0x19')][_0xa14d('0x1a')]===undefined?!![]:![]:!![],'where':_0x47f5d0[_0xa14d('0x19')]?_0x47f5d0['options'][_0xa14d('0x1b')]||null:null,'attributes':_0x47f5d0[_0xa14d('0x19')]?_0x47f5d0[_0xa14d('0x19')][_0xa14d('0x1c')]||null:null,'limit':_0x47f5d0[_0xa14d('0x19')]?_0x47f5d0[_0xa14d('0x19')][_0xa14d('0x1d')]||null:null,'include':_0x47f5d0[_0xa14d('0x19')]?_0x47f5d0[_0xa14d('0x19')][_0xa14d('0x1e')]?_['map'](_0x47f5d0[_0xa14d('0x19')]['include'],function(_0x517a1c){return{'model':db[_0x517a1c['model']],'as':_0x517a1c['as'],'attributes':_0x517a1c[_0xa14d('0x1c')],'include':_0x517a1c[_0xa14d('0x1e')]?_[_0xa14d('0x1f')](_0x517a1c[_0xa14d('0x1e')],function(_0x31328a){return{'model':db[_0x31328a[_0xa14d('0x20')]],'as':_0x31328a['as'],'attributes':_0x31328a[_0xa14d('0x1c')],'include':_0x31328a[_0xa14d('0x1e')]?_[_0xa14d('0x1f')](_0x31328a[_0xa14d('0x1e')],function(_0x3a7704){return{'model':db[_0x3a7704[_0xa14d('0x20')]],'as':_0x3a7704['as'],'attributes':_0x3a7704[_0xa14d('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xa14d('0x21')](function(_0x462c4b){logger[_0xa14d('0x22')](_0xa14d('0x23'),_0x47f5d0);logger[_0xa14d('0xf')](_0xa14d('0x23'),_0x47f5d0,JSON[_0xa14d('0x11')](_0x462c4b));_0x3c2473(_0x462c4b);})[_0xa14d('0x16')](function(_0x5595e3){logger[_0xa14d('0x12')](_0xa14d('0x23'),_0x5595e3[_0xa14d('0x14')],_0x47f5d0);_0x294706(_0x49aeb9[_0xa14d('0x12')](0x1f4,_0x5595e3['message']));});});};exports['CreateVoiceCallReport']=function(_0x1bd3d9){var _0x3bc0fc=this;return new Promise(function(_0x5ca8f6,_0x1b9410){return db[_0xa14d('0x17')]['create'](_0x1bd3d9['body'],{'raw':_0x1bd3d9[_0xa14d('0x19')]?_0x1bd3d9[_0xa14d('0x19')]['raw']===undefined?!![]:![]:!![]})[_0xa14d('0x21')](function(_0x1d032){logger['info'](_0xa14d('0x24'),_0x1bd3d9);logger[_0xa14d('0xf')]('CreateVoiceCallReport',_0x1bd3d9,JSON[_0xa14d('0x11')](_0x1d032));_0x5ca8f6(_0x1d032);})[_0xa14d('0x16')](function(_0x45523f){logger[_0xa14d('0x12')](_0xa14d('0x24'),_0x45523f[_0xa14d('0x14')],_0x1bd3d9);_0x1b9410(_0x3bc0fc['error'](0x1f4,_0x45523f[_0xa14d('0x14')]));});});};exports[_0xa14d('0x25')]=function(_0x1ec307){var _0x5456ae=this;return new Promise(function(_0x37799e,_0x4084df){return db[_0xa14d('0x17')][_0xa14d('0x26')](_0x1ec307[_0xa14d('0x27')],{'raw':_0x1ec307['options']?_0x1ec307[_0xa14d('0x19')][_0xa14d('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1ec307[_0xa14d('0x19')]?_0x1ec307[_0xa14d('0x19')][_0xa14d('0x1b')]||null:null,'attributes':_0x1ec307[_0xa14d('0x19')]?_0x1ec307[_0xa14d('0x19')][_0xa14d('0x1c')]||null:null,'limit':_0x1ec307[_0xa14d('0x19')]?_0x1ec307[_0xa14d('0x19')][_0xa14d('0x1d')]||null:null})[_0xa14d('0x21')](function(_0x4e8bdd){logger[_0xa14d('0x22')](_0xa14d('0x25'),_0x1ec307);logger['debug']('UpdateVoiceCallReport',_0x1ec307,JSON[_0xa14d('0x11')](_0x4e8bdd));_0x37799e(_0x4e8bdd);})[_0xa14d('0x16')](function(_0x5b6def){logger[_0xa14d('0x12')](_0xa14d('0x25'),_0x5b6def[_0xa14d('0x14')],_0x1ec307);_0x4084df(_0x5456ae[_0xa14d('0x12')](0x1f4,_0x5b6def[_0xa14d('0x14')]));});});}; \ No newline at end of file +var _0xc92e=['findAll','options','raw','where','attributes','include','map','model','CreateVoiceCallReport','create','body','debug','UpdateVoiceCallReport','update','limit','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','GetVoiceCallReport','VoiceCallReport'];(function(_0xb65e77,_0x238c3d){var _0x38134b=function(_0x39da21){while(--_0x39da21){_0xb65e77['push'](_0xb65e77['shift']());}};_0x38134b(++_0x238c3d);}(_0xc92e,0xab));var _0xec92=function(_0x5a20cd,_0x3d40af){_0x5a20cd=_0x5a20cd-0x0;var _0x5cc41d=_0xc92e[_0x5a20cd];return _0x5cc41d;};'use strict';var _=require(_0xec92('0x0'));var util=require(_0xec92('0x1'));var moment=require(_0xec92('0x2'));var BPromise=require(_0xec92('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xec92('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xec92('0x5'));var logger=require(_0xec92('0x6'))(_0xec92('0x7'));var config=require(_0xec92('0x8'));var jayson=require(_0xec92('0x9'));var client=jayson[_0xec92('0xa')][_0xec92('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2333b6,_0x1c39ba,_0x119975){return new BPromise(function(_0x5a95f2,_0x533b93){return client[_0xec92('0xc')](_0x2333b6,_0x119975)[_0xec92('0xd')](function(_0xf73b93){logger[_0xec92('0xe')](_0xec92('0xf'),_0x1c39ba,_0xec92('0x10'));logger['debug']('VoiceCallReport,\x20%s,\x20%s,\x20%s',_0x1c39ba,_0xec92('0x10'),JSON[_0xec92('0x11')](_0xf73b93));if(_0xf73b93[_0xec92('0x12')]){if(_0xf73b93['error']['code']===0x1f4){logger['error'](_0xec92('0xf'),_0x1c39ba,_0xf73b93[_0xec92('0x12')][_0xec92('0x13')]);return _0x533b93(_0xf73b93[_0xec92('0x12')][_0xec92('0x13')]);}logger[_0xec92('0x12')](_0xec92('0xf'),_0x1c39ba,_0xf73b93[_0xec92('0x12')][_0xec92('0x13')]);return _0x5a95f2(_0xf73b93[_0xec92('0x12')][_0xec92('0x13')]);}else{logger[_0xec92('0xe')](_0xec92('0xf'),_0x1c39ba,'request\x20sent');_0x5a95f2(_0xf73b93[_0xec92('0x14')][_0xec92('0x13')]);}})[_0xec92('0x15')](function(_0x21d89b){logger[_0xec92('0x12')](_0xec92('0xf'),_0x1c39ba,_0x21d89b);_0x533b93(_0x21d89b);});});}exports[_0xec92('0x16')]=function(_0x219bbf){var _0x44e67c=this;return new Promise(function(_0x1884ac,_0x550a1e){return db[_0xec92('0x17')][_0xec92('0x18')]({'raw':_0x219bbf[_0xec92('0x19')]?_0x219bbf[_0xec92('0x19')][_0xec92('0x1a')]===undefined?!![]:![]:!![],'where':_0x219bbf[_0xec92('0x19')]?_0x219bbf[_0xec92('0x19')][_0xec92('0x1b')]||null:null,'attributes':_0x219bbf[_0xec92('0x19')]?_0x219bbf[_0xec92('0x19')][_0xec92('0x1c')]||null:null,'limit':_0x219bbf[_0xec92('0x19')]?_0x219bbf['options']['limit']||null:null,'include':_0x219bbf[_0xec92('0x19')]?_0x219bbf[_0xec92('0x19')][_0xec92('0x1d')]?_[_0xec92('0x1e')](_0x219bbf[_0xec92('0x19')]['include'],function(_0x1a3ad7){return{'model':db[_0x1a3ad7[_0xec92('0x1f')]],'as':_0x1a3ad7['as'],'attributes':_0x1a3ad7['attributes'],'include':_0x1a3ad7[_0xec92('0x1d')]?_['map'](_0x1a3ad7[_0xec92('0x1d')],function(_0x30603b){return{'model':db[_0x30603b['model']],'as':_0x30603b['as'],'attributes':_0x30603b['attributes'],'include':_0x30603b[_0xec92('0x1d')]?_[_0xec92('0x1e')](_0x30603b[_0xec92('0x1d')],function(_0x2ab093){return{'model':db[_0x2ab093['model']],'as':_0x2ab093['as'],'attributes':_0x2ab093[_0xec92('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1b3468){logger[_0xec92('0xe')](_0xec92('0x16'),_0x219bbf);logger['debug'](_0xec92('0x16'),_0x219bbf,JSON[_0xec92('0x11')](_0x1b3468));_0x1884ac(_0x1b3468);})[_0xec92('0x15')](function(_0x195ac2){logger[_0xec92('0x12')]('GetVoiceCallReport',_0x195ac2[_0xec92('0x13')],_0x219bbf);_0x550a1e(_0x44e67c[_0xec92('0x12')](0x1f4,_0x195ac2['message']));});});};exports[_0xec92('0x20')]=function(_0x4a3c7e){var _0x583260=this;return new Promise(function(_0x3c1194,_0x1ad206){return db[_0xec92('0x17')][_0xec92('0x21')](_0x4a3c7e[_0xec92('0x22')],{'raw':_0x4a3c7e[_0xec92('0x19')]?_0x4a3c7e['options']['raw']===undefined?!![]:![]:!![]})[_0xec92('0xd')](function(_0x40ede7){logger['info'](_0xec92('0x20'),_0x4a3c7e);logger[_0xec92('0x23')]('CreateVoiceCallReport',_0x4a3c7e,JSON[_0xec92('0x11')](_0x40ede7));_0x3c1194(_0x40ede7);})['catch'](function(_0x3b7f54){logger[_0xec92('0x12')]('CreateVoiceCallReport',_0x3b7f54[_0xec92('0x13')],_0x4a3c7e);_0x1ad206(_0x583260[_0xec92('0x12')](0x1f4,_0x3b7f54[_0xec92('0x13')]));});});};exports[_0xec92('0x24')]=function(_0x133488){var _0x4a3f86=this;return new Promise(function(_0x97791,_0x238191){return db[_0xec92('0x17')][_0xec92('0x25')](_0x133488['body'],{'raw':_0x133488[_0xec92('0x19')]?_0x133488[_0xec92('0x19')][_0xec92('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x133488[_0xec92('0x19')]?_0x133488[_0xec92('0x19')][_0xec92('0x1b')]||null:null,'attributes':_0x133488[_0xec92('0x19')]?_0x133488[_0xec92('0x19')][_0xec92('0x1c')]||null:null,'limit':_0x133488[_0xec92('0x19')]?_0x133488[_0xec92('0x19')][_0xec92('0x26')]||null:null})[_0xec92('0xd')](function(_0x5b542a){logger[_0xec92('0xe')](_0xec92('0x24'),_0x133488);logger[_0xec92('0x23')](_0xec92('0x24'),_0x133488,JSON[_0xec92('0x11')](_0x5b542a));_0x97791(_0x5b542a);})['catch'](function(_0x3f5d1b){logger[_0xec92('0x12')]('UpdateVoiceCallReport',_0x3f5d1b[_0xec92('0x13')],_0x133488);_0x238191(_0x4a3f86[_0xec92('0x12')](0x1f4,_0x3f5d1b[_0xec92('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index 163cc82..15815c4 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 _0xc6bb=['../../config/environment','isAuthenticated','get','show','post','create','put','/:id','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x3141bc,_0x174be3){var _0x4a6850=function(_0x41d596){while(--_0x41d596){_0x3141bc['push'](_0x3141bc['shift']());}};_0x4a6850(++_0x174be3);}(_0xc6bb,0x174));var _0xbc6b=function(_0x4cadcf,_0x2b146a){_0x4cadcf=_0x4cadcf-0x0;var _0x5aeefc=_0xc6bb[_0x4cadcf];return _0x5aeefc;};'use strict';var multer=require(_0xbc6b('0x0'));var util=require(_0xbc6b('0x1'));var path=require(_0xbc6b('0x2'));var timeout=require(_0xbc6b('0x3'));var express=require(_0xbc6b('0x4'));var router=express[_0xbc6b('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xbc6b('0x6'));var interaction=require(_0xbc6b('0x7'));var config=require(_0xbc6b('0x8'));var controller=require('./voiceChanSpy.controller');router['get']('/',auth[_0xbc6b('0x9')](),controller['index']);router[_0xbc6b('0xa')]('/:id',auth[_0xbc6b('0x9')](),controller[_0xbc6b('0xb')]);router[_0xbc6b('0xc')]('/',auth[_0xbc6b('0x9')](),controller[_0xbc6b('0xd')]);router[_0xbc6b('0xe')](_0xbc6b('0xf'),auth[_0xbc6b('0x9')](),controller['update']);router[_0xbc6b('0x10')]('/:id',auth[_0xbc6b('0x9')](),controller[_0xbc6b('0x11')]);module[_0xbc6b('0x12')]=router; \ No newline at end of file +var _0x508d=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','get','isAuthenticated','/:id','update','delete','multer','util','connect-timeout','express'];(function(_0xd24d0d,_0x4b3a89){var _0x2582ec=function(_0x53ba1a){while(--_0x53ba1a){_0xd24d0d['push'](_0xd24d0d['shift']());}};_0x2582ec(++_0x4b3a89);}(_0x508d,0xf8));var _0xd508=function(_0x24061a,_0x1c9f4d){_0x24061a=_0x24061a-0x0;var _0x82054e=_0x508d[_0x24061a];return _0x82054e;};'use strict';var multer=require(_0xd508('0x0'));var util=require(_0xd508('0x1'));var path=require('path');var timeout=require(_0xd508('0x2'));var express=require(_0xd508('0x3'));var router=express[_0xd508('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xd508('0x5'));var interaction=require(_0xd508('0x6'));var config=require(_0xd508('0x7'));var controller=require(_0xd508('0x8'));router[_0xd508('0x9')]('/',auth[_0xd508('0xa')](),controller['index']);router[_0xd508('0x9')](_0xd508('0xb'),auth[_0xd508('0xa')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0xd508('0xc')]);router[_0xd508('0xd')](_0xd508('0xb'),auth[_0xd508('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index ef7487a..0b921a2 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 _0x1a7d=['BOOLEAN','exports','STRING','options','join','getDataValue','split'];(function(_0x562ac8,_0x5f4db7){var _0x292a45=function(_0x54ecbf){while(--_0x54ecbf){_0x562ac8['push'](_0x562ac8['shift']());}};_0x292a45(++_0x5f4db7);}(_0x1a7d,0xbe));var _0xd1a7=function(_0x120461,_0x13a6f8){_0x120461=_0x120461-0x0;var _0x52cdf0=_0x1a7d[_0x120461];return _0x52cdf0;};'use strict';var Sequelize=require('sequelize');module[_0xd1a7('0x0')]={'name':{'type':Sequelize[_0xd1a7('0x1')]},'prefix':{'type':Sequelize[_0xd1a7('0x1')],'unique':'name','allowNull':![]},'options':{'type':Sequelize[_0xd1a7('0x1')],'set':function(_0x6fcaed){this['setDataValue'](_0xd1a7('0x2'),_0x6fcaed?_0x6fcaed[_0xd1a7('0x3')](''):[]);},'get':function(){return this[_0xd1a7('0x4')](_0xd1a7('0x2'))?this['getDataValue'](_0xd1a7('0x2'))[_0xd1a7('0x5')](''):[];}},'auth':{'type':Sequelize[_0xd1a7('0x6')],'defaultValue':![]},'password':{'type':Sequelize[_0xd1a7('0x1')]},'record':{'type':Sequelize[_0xd1a7('0x6')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0xd1a7('0x1')]},'description':{'type':Sequelize[_0xd1a7('0x1')]}}; \ No newline at end of file +var _0x35ec=['join','getDataValue','options','BOOLEAN','sequelize','exports','STRING','name'];(function(_0x25145f,_0x4e2353){var _0x189047=function(_0x208ae9){while(--_0x208ae9){_0x25145f['push'](_0x25145f['shift']());}};_0x189047(++_0x4e2353);}(_0x35ec,0x11c));var _0xc35e=function(_0x20bfd5,_0x2a2910){_0x20bfd5=_0x20bfd5-0x0;var _0x2b159f=_0x35ec[_0x20bfd5];return _0x2b159f;};'use strict';var Sequelize=require(_0xc35e('0x0'));module[_0xc35e('0x1')]={'name':{'type':Sequelize[_0xc35e('0x2')]},'prefix':{'type':Sequelize['STRING'],'unique':_0xc35e('0x3'),'allowNull':![]},'options':{'type':Sequelize['STRING'],'set':function(_0x4a41b8){this['setDataValue']('options',_0x4a41b8?_0x4a41b8[_0xc35e('0x4')](''):[]);},'get':function(){return this[_0xc35e('0x5')](_0xc35e('0x6'))?this[_0xc35e('0x5')](_0xc35e('0x6'))['split'](''):[];}},'auth':{'type':Sequelize[_0xc35e('0x7')],'defaultValue':![]},'password':{'type':Sequelize[_0xc35e('0x2')]},'record':{'type':Sequelize[_0xc35e('0x7')],'defaultValue':![]},'recordingFormat':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xc35e('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index 72b2897..b11672c 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 _0x593e=['UserProfileResource','error','name','send','index','map','VoiceChanSpy','fieldName','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','merge','type','includeAll','include','findAll','rows','catch','show','params','length','options','find','create','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','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/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','destroy','then','get','ChanSpies'];(function(_0xdeac17,_0x19ad66){var _0x33aabd=function(_0x558a9e){while(--_0x558a9e){_0xdeac17['push'](_0xdeac17['shift']());}};_0x33aabd(++_0x19ad66);}(_0x593e,0xcb));var _0xe593=function(_0x589586,_0xe70df4){_0x589586=_0x589586-0x0;var _0x211e5d=_0x593e[_0x589586];return _0x211e5d;};'use strict';var emlformat=require(_0xe593('0x0'));var rimraf=require(_0xe593('0x1'));var zipdir=require(_0xe593('0x2'));var jsonpatch=require(_0xe593('0x3'));var rp=require(_0xe593('0x4'));var moment=require(_0xe593('0x5'));var BPromise=require(_0xe593('0x6'));var Mustache=require(_0xe593('0x7'));var util=require('util');var path=require(_0xe593('0x8'));var sox=require(_0xe593('0x9'));var csv=require(_0xe593('0xa'));var ejs=require(_0xe593('0xb'));var fs=require('fs');var fs_extra=require(_0xe593('0xc'));var _=require(_0xe593('0xd'));var squel=require(_0xe593('0xe'));var crypto=require(_0xe593('0xf'));var jsforce=require(_0xe593('0x10'));var deskjs=require(_0xe593('0x11'));var toCsv=require('to-csv');var querystring=require(_0xe593('0x12'));var Papa=require(_0xe593('0x13'));var Redis=require(_0xe593('0x14'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe593('0x15'));var hardwareService=require(_0xe593('0x16'));var logger=require(_0xe593('0x17'))('api');var utils=require(_0xe593('0x18'));var config=require(_0xe593('0x19'));var licenseUtil=require(_0xe593('0x1a'));var db=require(_0xe593('0x1b'))['db'];function respondWithStatusCode(_0x8ee313,_0x31dad0){_0x31dad0=_0x31dad0||0xcc;return function(_0x24c9fd){if(_0x24c9fd){return _0x8ee313[_0xe593('0x1c')](_0x31dad0);}return _0x8ee313[_0xe593('0x1d')](_0x31dad0)[_0xe593('0x1e')]();};}function respondWithResult(_0x499819,_0x2907e4){_0x2907e4=_0x2907e4||0xc8;return function(_0x1de391){if(_0x1de391){return _0x499819['status'](_0x2907e4)[_0xe593('0x1f')](_0x1de391);}};}function respondWithFilteredResult(_0x44837b,_0x5d4c6a){return function(_0x2ae9b6){if(_0x2ae9b6){var _0x40416c=typeof _0x5d4c6a[_0xe593('0x20')]===_0xe593('0x21')&&typeof _0x5d4c6a[_0xe593('0x22')]===_0xe593('0x21');var _0x48f3b4=_0x2ae9b6[_0xe593('0x23')];var _0x470d07=_0x40416c?0x0:_0x5d4c6a['offset'];var _0xd1020e=_0x40416c?_0x2ae9b6[_0xe593('0x23')]:_0x5d4c6a['offset']+_0x5d4c6a[_0xe593('0x22')];var _0x3dba1b;if(_0xd1020e>=_0x48f3b4){_0xd1020e=_0x48f3b4;_0x3dba1b=0xc8;}else{_0x3dba1b=0xce;}_0x44837b[_0xe593('0x1d')](_0x3dba1b);return _0x44837b[_0xe593('0x24')](_0xe593('0x25'),_0x470d07+'-'+_0xd1020e+'/'+_0x48f3b4)[_0xe593('0x1f')](_0x2ae9b6);}return null;};}function patchUpdates(_0x3d2a51){return function(_0x4ea53f){try{jsonpatch['apply'](_0x4ea53f,_0x3d2a51,!![]);}catch(_0x1634d4){return BPromise['reject'](_0x1634d4);}return _0x4ea53f['save']();};}function saveUpdates(_0x1bb8e8,_0x3c65b5){return function(_0x57379d){if(_0x57379d){return _0x57379d[_0xe593('0x26')](_0x1bb8e8)['then'](function(_0x1672bf){return _0x1672bf;});}return null;};}function removeEntity(_0x2c191f,_0x185cea){return function(_0x44d997){if(_0x44d997){return _0x44d997[_0xe593('0x27')]()[_0xe593('0x28')](function(){var _0x20a098=_0x44d997[_0xe593('0x29')]({'plain':!![]});var _0x4fc483=_0xe593('0x2a');return db[_0xe593('0x2b')]['destroy']({'where':{'type':_0x4fc483,'resourceId':_0x20a098['id']}})['then'](function(){return _0x44d997;});})[_0xe593('0x28')](function(){_0x2c191f[_0xe593('0x1d')](0xcc)[_0xe593('0x1e')]();});}};}function handleEntityNotFound(_0x43699d,_0x3b66bc){return function(_0x27a3d2){if(!_0x27a3d2){_0x43699d['sendStatus'](0x194);}return _0x27a3d2;};}function handleError(_0x350e2b,_0x54e5e2){_0x54e5e2=_0x54e5e2||0x1f4;return function(_0x1dacf6){logger[_0xe593('0x2c')](_0x1dacf6['stack']);if(_0x1dacf6[_0xe593('0x2d')]){delete _0x1dacf6['name'];}_0x350e2b[_0xe593('0x1d')](_0x54e5e2)[_0xe593('0x2e')](_0x1dacf6);};}exports[_0xe593('0x2f')]=function(_0x501e54,_0x1ae8d9){var _0x13f44={},_0x3066ed={},_0x338222={'count':0x0,'rows':[]};var _0x2588be=_[_0xe593('0x30')](db[_0xe593('0x31')]['rawAttributes'],function(_0x4098a9){return{'name':_0x4098a9[_0xe593('0x32')],'type':_0x4098a9['type'][_0xe593('0x33')]};});_0x3066ed['model']=_[_0xe593('0x30')](_0x2588be,_0xe593('0x2d'));_0x3066ed[_0xe593('0x34')]=_[_0xe593('0x35')](_0x501e54[_0xe593('0x34')]);_0x3066ed[_0xe593('0x36')]=_[_0xe593('0x37')](_0x3066ed[_0xe593('0x38')],_0x3066ed[_0xe593('0x34')]);_0x13f44[_0xe593('0x39')]=_['intersection'](_0x3066ed[_0xe593('0x38')],qs[_0xe593('0x3a')](_0x501e54[_0xe593('0x34')]['fields']));_0x13f44['attributes']=_0x13f44[_0xe593('0x39')]['length']?_0x13f44[_0xe593('0x39')]:_0x3066ed[_0xe593('0x38')];if(!_0x501e54[_0xe593('0x34')][_0xe593('0x3b')](_0xe593('0x3c'))){_0x13f44[_0xe593('0x22')]=qs[_0xe593('0x22')](_0x501e54['query']['limit']);_0x13f44[_0xe593('0x20')]=qs['offset'](_0x501e54[_0xe593('0x34')]['offset']);}_0x13f44[_0xe593('0x3d')]=qs['sort'](_0x501e54['query'][_0xe593('0x3e')]);_0x13f44[_0xe593('0x3f')]=qs[_0xe593('0x36')](_['pick'](_0x501e54['query'],_0x3066ed['filters']),_0x2588be);if(_0x501e54[_0xe593('0x34')]['filter']){_0x13f44[_0xe593('0x3f')]=_[_0xe593('0x40')](_0x13f44[_0xe593('0x3f')],{'$or':_[_0xe593('0x30')](_0x2588be,function(_0x50249e){if(_0x50249e[_0xe593('0x41')]!=='VIRTUAL'){var _0x36c08e={};_0x36c08e[_0x50249e['name']]={'$like':'%'+_0x501e54['query']['filter']+'%'};return _0x36c08e;}})});}_0x13f44=_[_0xe593('0x40')]({},_0x13f44,_0x501e54['options']);var _0x3addf0={'where':_0x13f44[_0xe593('0x3f')]};return db[_0xe593('0x31')]['count'](_0x3addf0)[_0xe593('0x28')](function(_0x3f9784){_0x338222[_0xe593('0x23')]=_0x3f9784;if(_0x501e54[_0xe593('0x34')][_0xe593('0x42')]){_0x13f44[_0xe593('0x43')]=[{'all':!![]}];}return db[_0xe593('0x31')][_0xe593('0x44')](_0x13f44);})['then'](function(_0x211065){_0x338222[_0xe593('0x45')]=_0x211065;return _0x338222;})[_0xe593('0x28')](respondWithFilteredResult(_0x1ae8d9,_0x13f44))[_0xe593('0x46')](handleError(_0x1ae8d9,null));};exports[_0xe593('0x47')]=function(_0x4d3018,_0x4a9a5f){var _0x3fd874={'raw':![],'where':{'id':_0x4d3018[_0xe593('0x48')]['id']}},_0x380429={};_0x380429['model']=_[_0xe593('0x35')](db[_0xe593('0x31')]['rawAttributes']);_0x380429['query']=_[_0xe593('0x35')](_0x4d3018[_0xe593('0x34')]);_0x380429[_0xe593('0x36')]=_['intersection'](_0x380429[_0xe593('0x38')],_0x380429[_0xe593('0x34')]);_0x3fd874[_0xe593('0x39')]=_[_0xe593('0x37')](_0x380429['model'],qs['fields'](_0x4d3018['query']['fields']));_0x3fd874[_0xe593('0x39')]=_0x3fd874['attributes'][_0xe593('0x49')]?_0x3fd874[_0xe593('0x39')]:_0x380429[_0xe593('0x38')];if(_0x4d3018[_0xe593('0x34')][_0xe593('0x42')]){_0x3fd874[_0xe593('0x43')]=[{'all':!![]}];}_0x3fd874=_[_0xe593('0x40')]({},_0x3fd874,_0x4d3018[_0xe593('0x4a')]);return db['VoiceChanSpy'][_0xe593('0x4b')](_0x3fd874)[_0xe593('0x28')](handleEntityNotFound(_0x4a9a5f,null))[_0xe593('0x28')](respondWithResult(_0x4a9a5f,null))['catch'](handleError(_0x4a9a5f,null));};exports[_0xe593('0x4c')]=function(_0x5dfdb1,_0x39ec9e){return db[_0xe593('0x31')][_0xe593('0x4c')](_0x5dfdb1['body'],{})['then'](function(_0x7431a3){var _0x45beb1=_0x5dfdb1['user']['get']({'plain':!![]});if(!_0x45beb1)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x45beb1['role']==='user'){var _0x383645=_0x7431a3[_0xe593('0x29')]({'plain':!![]});var _0x1ed8b5=_0xe593('0x2a');return db[_0xe593('0x4d')][_0xe593('0x4b')]({'where':{'name':_0x1ed8b5,'userProfileId':_0x45beb1[_0xe593('0x4e')]},'raw':!![]})[_0xe593('0x28')](function(_0x355ad8){if(_0x355ad8&&_0x355ad8[_0xe593('0x4f')]===0x0){return db[_0xe593('0x2b')][_0xe593('0x4c')]({'name':_0x383645[_0xe593('0x2d')],'resourceId':_0x383645['id'],'type':_0x355ad8[_0xe593('0x2d')],'sectionId':_0x355ad8['id']},{})[_0xe593('0x28')](function(){return _0x7431a3;});}else{return _0x7431a3;}})[_0xe593('0x46')](function(_0x5d60c3){logger[_0xe593('0x2c')](_0xe593('0x50'),_0x5d60c3);throw _0x5d60c3;});}return _0x7431a3;})[_0xe593('0x28')](respondWithResult(_0x39ec9e,0xc9))[_0xe593('0x46')](handleError(_0x39ec9e,null));};exports[_0xe593('0x26')]=function(_0x8130b2,_0x363643){if(_0x8130b2[_0xe593('0x51')]['id']){delete _0x8130b2[_0xe593('0x51')]['id'];}return db[_0xe593('0x31')][_0xe593('0x4b')]({'where':{'id':_0x8130b2[_0xe593('0x48')]['id']}})[_0xe593('0x28')](handleEntityNotFound(_0x363643,null))[_0xe593('0x28')](saveUpdates(_0x8130b2[_0xe593('0x51')],null))['then'](respondWithResult(_0x363643,null))[_0xe593('0x46')](handleError(_0x363643,null));};exports[_0xe593('0x27')]=function(_0x142d0f,_0x24d061){return db[_0xe593('0x31')]['find']({'where':{'id':_0x142d0f['params']['id']}})[_0xe593('0x28')](handleEntityNotFound(_0x24d061,null))[_0xe593('0x28')](removeEntity(_0x24d061,null))[_0xe593('0x46')](handleError(_0x24d061,null));}; \ No newline at end of file +var _0x180f=['../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','limit','undefined','count','status','set','Content-Range','apply','save','update','then','get','ChanSpies','UserProfileResource','destroy','error','stack','name','send','index','map','VoiceChanSpy','rawAttributes','fieldName','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','options','findAll','rows','catch','show','includeAll','include','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','autoAssociation','params','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis'];(function(_0x5f09c5,_0x2bfca0){var _0x426ad9=function(_0x18fe5f){while(--_0x18fe5f){_0x5f09c5['push'](_0x5f09c5['shift']());}};_0x426ad9(++_0x2bfca0);}(_0x180f,0xf3));var _0xf180=function(_0x132d12,_0x2c9799){_0x132d12=_0x132d12-0x0;var _0x1c3163=_0x180f[_0x132d12];return _0x1c3163;};'use strict';var emlformat=require(_0xf180('0x0'));var rimraf=require(_0xf180('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf180('0x2'));var rp=require(_0xf180('0x3'));var moment=require('moment');var BPromise=require(_0xf180('0x4'));var Mustache=require(_0xf180('0x5'));var util=require(_0xf180('0x6'));var path=require(_0xf180('0x7'));var sox=require(_0xf180('0x8'));var csv=require('to-csv');var ejs=require(_0xf180('0x9'));var fs=require('fs');var fs_extra=require(_0xf180('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xf180('0xb'));var jsforce=require(_0xf180('0xc'));var deskjs=require(_0xf180('0xd'));var toCsv=require(_0xf180('0xe'));var querystring=require(_0xf180('0xf'));var Papa=require(_0xf180('0x10'));var Redis=require(_0xf180('0x11'));var authService=require(_0xf180('0x12'));var qs=require(_0xf180('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf180('0x14'));var logger=require(_0xf180('0x15'))(_0xf180('0x16'));var utils=require(_0xf180('0x17'));var config=require(_0xf180('0x18'));var licenseUtil=require(_0xf180('0x19'));var db=require(_0xf180('0x1a'))['db'];function respondWithStatusCode(_0x2122a0,_0x171513){_0x171513=_0x171513||0xcc;return function(_0x22a1f8){if(_0x22a1f8){return _0x2122a0[_0xf180('0x1b')](_0x171513);}return _0x2122a0['status'](_0x171513)[_0xf180('0x1c')]();};}function respondWithResult(_0x22d179,_0x1eb0a2){_0x1eb0a2=_0x1eb0a2||0xc8;return function(_0x355b07){if(_0x355b07){return _0x22d179['status'](_0x1eb0a2)[_0xf180('0x1d')](_0x355b07);}};}function respondWithFilteredResult(_0x3d3f48,_0x1dbdcf){return function(_0x4ee79b){if(_0x4ee79b){var _0x105c6a=typeof _0x1dbdcf[_0xf180('0x1e')]==='undefined'&&typeof _0x1dbdcf[_0xf180('0x1f')]===_0xf180('0x20');var _0x492c22=_0x4ee79b[_0xf180('0x21')];var _0x14ddc6=_0x105c6a?0x0:_0x1dbdcf[_0xf180('0x1e')];var _0xf7ab26=_0x105c6a?_0x4ee79b[_0xf180('0x21')]:_0x1dbdcf[_0xf180('0x1e')]+_0x1dbdcf[_0xf180('0x1f')];var _0x43f1f4;if(_0xf7ab26>=_0x492c22){_0xf7ab26=_0x492c22;_0x43f1f4=0xc8;}else{_0x43f1f4=0xce;}_0x3d3f48[_0xf180('0x22')](_0x43f1f4);return _0x3d3f48[_0xf180('0x23')](_0xf180('0x24'),_0x14ddc6+'-'+_0xf7ab26+'/'+_0x492c22)[_0xf180('0x1d')](_0x4ee79b);}return null;};}function patchUpdates(_0x180c0a){return function(_0x5c8e98){try{jsonpatch[_0xf180('0x25')](_0x5c8e98,_0x180c0a,!![]);}catch(_0x185cc6){return BPromise['reject'](_0x185cc6);}return _0x5c8e98[_0xf180('0x26')]();};}function saveUpdates(_0x538bac,_0x36aeee){return function(_0x4c54b6){if(_0x4c54b6){return _0x4c54b6[_0xf180('0x27')](_0x538bac)[_0xf180('0x28')](function(_0x5d5ead){return _0x5d5ead;});}return null;};}function removeEntity(_0x48925e,_0x1b28d6){return function(_0x932e29){if(_0x932e29){return _0x932e29['destroy']()[_0xf180('0x28')](function(){var _0x41772a=_0x932e29[_0xf180('0x29')]({'plain':!![]});var _0x1242d3=_0xf180('0x2a');return db[_0xf180('0x2b')][_0xf180('0x2c')]({'where':{'type':_0x1242d3,'resourceId':_0x41772a['id']}})[_0xf180('0x28')](function(){return _0x932e29;});})[_0xf180('0x28')](function(){_0x48925e[_0xf180('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3cda7b,_0x158d1a){return function(_0x151b90){if(!_0x151b90){_0x3cda7b[_0xf180('0x1b')](0x194);}return _0x151b90;};}function handleError(_0x37379c,_0x2aeee4){_0x2aeee4=_0x2aeee4||0x1f4;return function(_0xe1db31){logger[_0xf180('0x2d')](_0xe1db31[_0xf180('0x2e')]);if(_0xe1db31[_0xf180('0x2f')]){delete _0xe1db31['name'];}_0x37379c[_0xf180('0x22')](_0x2aeee4)[_0xf180('0x30')](_0xe1db31);};}exports[_0xf180('0x31')]=function(_0x2cf029,_0x466895){var _0x275c90={},_0x2b4f43={},_0x341af6={'count':0x0,'rows':[]};var _0x2af26b=_[_0xf180('0x32')](db[_0xf180('0x33')][_0xf180('0x34')],function(_0x247068){return{'name':_0x247068[_0xf180('0x35')],'type':_0x247068['type'][_0xf180('0x36')]};});_0x2b4f43[_0xf180('0x37')]=_['map'](_0x2af26b,_0xf180('0x2f'));_0x2b4f43['query']=_[_0xf180('0x38')](_0x2cf029[_0xf180('0x39')]);_0x2b4f43[_0xf180('0x3a')]=_['intersection'](_0x2b4f43[_0xf180('0x37')],_0x2b4f43[_0xf180('0x39')]);_0x275c90[_0xf180('0x3b')]=_[_0xf180('0x3c')](_0x2b4f43['model'],qs[_0xf180('0x3d')](_0x2cf029[_0xf180('0x39')][_0xf180('0x3d')]));_0x275c90[_0xf180('0x3b')]=_0x275c90[_0xf180('0x3b')][_0xf180('0x3e')]?_0x275c90[_0xf180('0x3b')]:_0x2b4f43[_0xf180('0x37')];if(!_0x2cf029[_0xf180('0x39')][_0xf180('0x3f')]('nolimit')){_0x275c90[_0xf180('0x1f')]=qs['limit'](_0x2cf029['query'][_0xf180('0x1f')]);_0x275c90['offset']=qs['offset'](_0x2cf029[_0xf180('0x39')][_0xf180('0x1e')]);}_0x275c90[_0xf180('0x40')]=qs[_0xf180('0x41')](_0x2cf029['query']['sort']);_0x275c90[_0xf180('0x42')]=qs['filters'](_[_0xf180('0x43')](_0x2cf029['query'],_0x2b4f43[_0xf180('0x3a')]),_0x2af26b);if(_0x2cf029[_0xf180('0x39')][_0xf180('0x44')]){_0x275c90[_0xf180('0x42')]=_[_0xf180('0x45')](_0x275c90[_0xf180('0x42')],{'$or':_[_0xf180('0x32')](_0x2af26b,function(_0x1def62){if(_0x1def62[_0xf180('0x46')]!=='VIRTUAL'){var _0x389de4={};_0x389de4[_0x1def62[_0xf180('0x2f')]]={'$like':'%'+_0x2cf029['query'][_0xf180('0x44')]+'%'};return _0x389de4;}})});}_0x275c90=_[_0xf180('0x45')]({},_0x275c90,_0x2cf029[_0xf180('0x47')]);var _0x268e34={'where':_0x275c90['where']};return db[_0xf180('0x33')]['count'](_0x268e34)[_0xf180('0x28')](function(_0xaa961){_0x341af6[_0xf180('0x21')]=_0xaa961;if(_0x2cf029[_0xf180('0x39')]['includeAll']){_0x275c90['include']=[{'all':!![]}];}return db[_0xf180('0x33')][_0xf180('0x48')](_0x275c90);})[_0xf180('0x28')](function(_0x3083ba){_0x341af6[_0xf180('0x49')]=_0x3083ba;return _0x341af6;})[_0xf180('0x28')](respondWithFilteredResult(_0x466895,_0x275c90))[_0xf180('0x4a')](handleError(_0x466895,null));};exports[_0xf180('0x4b')]=function(_0x321668,_0xf42737){var _0x53455a={'raw':![],'where':{'id':_0x321668['params']['id']}},_0x1c4821={};_0x1c4821[_0xf180('0x37')]=_[_0xf180('0x38')](db[_0xf180('0x33')]['rawAttributes']);_0x1c4821[_0xf180('0x39')]=_[_0xf180('0x38')](_0x321668['query']);_0x1c4821[_0xf180('0x3a')]=_[_0xf180('0x3c')](_0x1c4821[_0xf180('0x37')],_0x1c4821[_0xf180('0x39')]);_0x53455a[_0xf180('0x3b')]=_[_0xf180('0x3c')](_0x1c4821[_0xf180('0x37')],qs[_0xf180('0x3d')](_0x321668[_0xf180('0x39')][_0xf180('0x3d')]));_0x53455a[_0xf180('0x3b')]=_0x53455a[_0xf180('0x3b')][_0xf180('0x3e')]?_0x53455a[_0xf180('0x3b')]:_0x1c4821[_0xf180('0x37')];if(_0x321668[_0xf180('0x39')][_0xf180('0x4c')]){_0x53455a[_0xf180('0x4d')]=[{'all':!![]}];}_0x53455a=_[_0xf180('0x45')]({},_0x53455a,_0x321668[_0xf180('0x47')]);return db['VoiceChanSpy']['find'](_0x53455a)[_0xf180('0x28')](handleEntityNotFound(_0xf42737,null))[_0xf180('0x28')](respondWithResult(_0xf42737,null))[_0xf180('0x4a')](handleError(_0xf42737,null));};exports[_0xf180('0x4e')]=function(_0x1915b4,_0x30e469){return db[_0xf180('0x33')][_0xf180('0x4e')](_0x1915b4[_0xf180('0x4f')],{})[_0xf180('0x28')](function(_0x46f962){var _0x16bc09=_0x1915b4[_0xf180('0x50')][_0xf180('0x29')]({'plain':!![]});if(!_0x16bc09)throw new Error(_0xf180('0x51'));if(_0x16bc09['role']===_0xf180('0x50')){var _0x12fabe=_0x46f962['get']({'plain':!![]});var _0xbf1ed3=_0xf180('0x2a');return db[_0xf180('0x52')][_0xf180('0x53')]({'where':{'name':_0xbf1ed3,'userProfileId':_0x16bc09[_0xf180('0x54')]},'raw':!![]})[_0xf180('0x28')](function(_0x15bc7b){if(_0x15bc7b&&_0x15bc7b[_0xf180('0x55')]===0x0){return db[_0xf180('0x2b')][_0xf180('0x4e')]({'name':_0x12fabe[_0xf180('0x2f')],'resourceId':_0x12fabe['id'],'type':_0x15bc7b[_0xf180('0x2f')],'sectionId':_0x15bc7b['id']},{})['then'](function(){return _0x46f962;});}else{return _0x46f962;}})[_0xf180('0x4a')](function(_0x5c485b){logger[_0xf180('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5c485b);throw _0x5c485b;});}return _0x46f962;})['then'](respondWithResult(_0x30e469,0xc9))['catch'](handleError(_0x30e469,null));};exports['update']=function(_0x225c82,_0x3e0e1a){if(_0x225c82['body']['id']){delete _0x225c82[_0xf180('0x4f')]['id'];}return db[_0xf180('0x33')]['find']({'where':{'id':_0x225c82[_0xf180('0x56')]['id']}})['then'](handleEntityNotFound(_0x3e0e1a,null))['then'](saveUpdates(_0x225c82['body'],null))[_0xf180('0x28')](respondWithResult(_0x3e0e1a,null))[_0xf180('0x4a')](handleError(_0x3e0e1a,null));};exports[_0xf180('0x2c')]=function(_0x5cd77f,_0x2dcc9e){return db[_0xf180('0x33')][_0xf180('0x53')]({'where':{'id':_0x5cd77f[_0xf180('0x56')]['id']}})[_0xf180('0x28')](handleEntityNotFound(_0x2dcc9e,null))['then'](removeEntity(_0x2dcc9e,null))[_0xf180('0x4a')](handleError(_0x2dcc9e,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index bbfa5a5..168c635 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 _0x436a=['then','catch','models','define','VoiceChanSpy','voice_chanspy','VoiceExtension','destroy','lodash','bluebird','./voiceChanSpy.attributes','from-sip','format','%s%s','prefix','system','push','merge','Set','CDR(type)=%s','chanspy','${UNIQUEID}.%s,a','recordingFormat','auth','Authenticate','ChanSpy','SIP/%s,%s','name','options','join','record','length','internal','User','findAll','agent'];(function(_0x371f72,_0x57403c){var _0x1fbceb=function(_0x32db62){while(--_0x32db62){_0x371f72['push'](_0x371f72['shift']());}};_0x1fbceb(++_0x57403c);}(_0x436a,0x14c));var _0xa436=function(_0x22f44f,_0x554b8f){_0x22f44f=_0x22f44f-0x0;var _0x79fe01=_0x436a[_0x22f44f];return _0x79fe01;};'use strict';var _=require(_0xa436('0x0'));var util=require('util');var BPromise=require(_0xa436('0x1'));var attributes=require(_0xa436('0x2'));var getUserApplications=function(_0x4917a9,_0x46e72e,_0xe26ae3){var _0x238545=0x1;var _0x235d12=[];var _0x58f260={'context':_0x46e72e['context']||_0xa436('0x3'),'exten':util[_0xa436('0x4')](_0xa436('0x5'),_0x4917a9[_0xa436('0x6')],_0xe26ae3),'type':_0xa436('0x7'),'isApp':![],'ChanSpyId':_0x4917a9['id'],'UserId':_0x46e72e['id']};_0x235d12[_0xa436('0x8')](_[_0xa436('0x9')]({'app':_0xa436('0xa'),'appdata':util[_0xa436('0x4')](_0xa436('0xb'),_0xa436('0xc')),'priority':_0x238545++},_0x58f260));if(_0x4917a9['record']){_0x235d12[_0xa436('0x8')](_['merge']({'app':'MixMonitor','appdata':util[_0xa436('0x4')](_0xa436('0xd'),_0x4917a9[_0xa436('0xe')]),'priority':_0x238545++},_0x58f260));}if(_0x4917a9[_0xa436('0xf')]){_0x235d12['push'](_[_0xa436('0x9')]({'app':_0xa436('0x10'),'appdata':_0x4917a9['password'],'priority':_0x238545++},_0x58f260));}_0x235d12[_0xa436('0x8')](_[_0xa436('0x9')]({'app':_0xa436('0x11'),'appdata':util[_0xa436('0x4')](_0xa436('0x12'),_0x46e72e[_0xa436('0x13')],_0x4917a9['options']?_0x4917a9[_0xa436('0x14')][_0xa436('0x15')](''):''),'priority':_0x238545++},_0x58f260));if(_0x4917a9[_0xa436('0x16')]){_0x235d12['push'](_['merge']({'app':'StopMixMonitor','priority':_0x238545++},_0x58f260));}return _0x235d12;};var getChanSpyApplications=function(_0x3ee505,_0x24e4ce){var _0x486280=[];for(var _0x5c0efd=0x0,_0x30df20=0x1;_0x5c0efd<_0x24e4ce[_0xa436('0x17')];_0x5c0efd++,_0x30df20=0x1){_0x486280=_0x486280['concat'](getUserApplications(_0x3ee505,_0x24e4ce[_0x5c0efd],_0x24e4ce[_0x5c0efd][_0xa436('0x18')]));if(_0x24e4ce[_0x5c0efd]['internal']!=_0x24e4ce[_0x5c0efd][_0xa436('0x13')]){_0x486280=_0x486280['concat'](getUserApplications(_0x3ee505,_0x24e4ce[_0x5c0efd],_0x24e4ce[_0x5c0efd][_0xa436('0x13')]));}}return _0x486280;};var getChanSpyPromise=function(_0xd3fd4d,_0x2b601e){return new BPromise(function(_0x2615f7,_0x1452ca){return _0xd3fd4d[_0xa436('0x19')][_0xa436('0x1a')]({'attributes':['id','name',_0xa436('0x18')],'where':{'role':_0xa436('0x1b'),'chanspy':!![]},'raw':!![]})[_0xa436('0x1c')](function(_0x24fe5f){if(_0x24fe5f){return _0x2615f7(getChanSpyApplications(_0x2b601e,_0x24fe5f));}return _0x2615f7([]);})[_0xa436('0x1d')](function(_0x4e0e44){_0x1452ca(_0x4e0e44);});});};module['exports']=function(_0x2dbd5f,_0x36b1f9){var _0x5ebd73=_0x2dbd5f[_0xa436('0x1e')];return _0x2dbd5f[_0xa436('0x1f')](_0xa436('0x20'),attributes,{'tableName':_0xa436('0x21'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x514042,_0x5d6bb7,_0x3cdaa7){return getChanSpyPromise(_0x5ebd73,_0x514042)['then'](function(_0x2f4192){if(_0x2f4192&&_0x2f4192[_0xa436('0x17')]){return _0x5ebd73[_0xa436('0x22')]['bulkCreate'](_0x2f4192);}})[_0xa436('0x1c')](function(){_0x3cdaa7();})[_0xa436('0x1d')](function(_0x55f857){_0x3cdaa7(_0x55f857);});},'afterUpdate':function(_0x352c11,_0x2eba56,_0x50a1d3){return _0x5ebd73[_0xa436('0x22')][_0xa436('0x23')]({'where':{'ChanSpyId':_0x352c11['id']}})[_0xa436('0x1c')](function(){return getChanSpyPromise(_0x5ebd73,_0x352c11);})[_0xa436('0x1c')](function(_0x3f417b){if(_0x3f417b&&_0x3f417b[_0xa436('0x17')]){return _0x5ebd73[_0xa436('0x22')]['bulkCreate'](_0x3f417b);}})[_0xa436('0x1c')](function(){_0x50a1d3();})[_0xa436('0x1d')](function(_0x17d3b2){_0x50a1d3(_0x17d3b2);});},'afterDestroy':function(_0x38deb0,_0x1ac238,_0x5692ed){return _0x5ebd73[_0xa436('0x22')]['destroy']({'where':{'ChanSpyId':_0x38deb0['id']}})[_0xa436('0x1c')](function(){_0x5692ed();})[_0xa436('0x1d')](function(_0x51e46f){_0x5692ed(_0x51e46f);});}}});}; \ No newline at end of file +var _0x9bbb=['push','merge','Set','format','chanspy','MixMonitor','recordingFormat','auth','Authenticate','ChanSpy','SIP/%s,%s','name','options','join','record','length','concat','internal','User','agent','then','catch','exports','models','define','VoiceChanSpy','VoiceExtension','destroy','bulkCreate','util','bluebird','./voiceChanSpy.attributes','from-sip','%s%s','prefix'];(function(_0x309251,_0x59a3d3){var _0x3c6e84=function(_0x2c535){while(--_0x2c535){_0x309251['push'](_0x309251['shift']());}};_0x3c6e84(++_0x59a3d3);}(_0x9bbb,0x19e));var _0xb9bb=function(_0x1ab137,_0x34f390){_0x1ab137=_0x1ab137-0x0;var _0x21ed46=_0x9bbb[_0x1ab137];return _0x21ed46;};'use strict';var _=require('lodash');var util=require(_0xb9bb('0x0'));var BPromise=require(_0xb9bb('0x1'));var attributes=require(_0xb9bb('0x2'));var getUserApplications=function(_0x16d0de,_0xe2770d,_0xf41620){var _0x2378a6=0x1;var _0x1a44f3=[];var _0x1a6216={'context':_0xe2770d['context']||_0xb9bb('0x3'),'exten':util['format'](_0xb9bb('0x4'),_0x16d0de[_0xb9bb('0x5')],_0xf41620),'type':'system','isApp':![],'ChanSpyId':_0x16d0de['id'],'UserId':_0xe2770d['id']};_0x1a44f3[_0xb9bb('0x6')](_[_0xb9bb('0x7')]({'app':_0xb9bb('0x8'),'appdata':util[_0xb9bb('0x9')]('CDR(type)=%s',_0xb9bb('0xa')),'priority':_0x2378a6++},_0x1a6216));if(_0x16d0de['record']){_0x1a44f3[_0xb9bb('0x6')](_['merge']({'app':_0xb9bb('0xb'),'appdata':util['format']('${UNIQUEID}.%s,a',_0x16d0de[_0xb9bb('0xc')]),'priority':_0x2378a6++},_0x1a6216));}if(_0x16d0de[_0xb9bb('0xd')]){_0x1a44f3['push'](_['merge']({'app':_0xb9bb('0xe'),'appdata':_0x16d0de['password'],'priority':_0x2378a6++},_0x1a6216));}_0x1a44f3[_0xb9bb('0x6')](_[_0xb9bb('0x7')]({'app':_0xb9bb('0xf'),'appdata':util['format'](_0xb9bb('0x10'),_0xe2770d[_0xb9bb('0x11')],_0x16d0de[_0xb9bb('0x12')]?_0x16d0de['options'][_0xb9bb('0x13')](''):''),'priority':_0x2378a6++},_0x1a6216));if(_0x16d0de[_0xb9bb('0x14')]){_0x1a44f3['push'](_['merge']({'app':'StopMixMonitor','priority':_0x2378a6++},_0x1a6216));}return _0x1a44f3;};var getChanSpyApplications=function(_0x388aa1,_0x2aa1fe){var _0x1fd877=[];for(var _0x2b42f0=0x0,_0x4082b5=0x1;_0x2b42f0<_0x2aa1fe[_0xb9bb('0x15')];_0x2b42f0++,_0x4082b5=0x1){_0x1fd877=_0x1fd877[_0xb9bb('0x16')](getUserApplications(_0x388aa1,_0x2aa1fe[_0x2b42f0],_0x2aa1fe[_0x2b42f0][_0xb9bb('0x17')]));if(_0x2aa1fe[_0x2b42f0][_0xb9bb('0x17')]!=_0x2aa1fe[_0x2b42f0][_0xb9bb('0x11')]){_0x1fd877=_0x1fd877['concat'](getUserApplications(_0x388aa1,_0x2aa1fe[_0x2b42f0],_0x2aa1fe[_0x2b42f0]['name']));}}return _0x1fd877;};var getChanSpyPromise=function(_0x494aa9,_0x14b61c){return new BPromise(function(_0x1e9cc3,_0x58a8dd){return _0x494aa9[_0xb9bb('0x18')]['findAll']({'attributes':['id','name',_0xb9bb('0x17')],'where':{'role':_0xb9bb('0x19'),'chanspy':!![]},'raw':!![]})[_0xb9bb('0x1a')](function(_0x5983b2){if(_0x5983b2){return _0x1e9cc3(getChanSpyApplications(_0x14b61c,_0x5983b2));}return _0x1e9cc3([]);})[_0xb9bb('0x1b')](function(_0x5b3974){_0x58a8dd(_0x5b3974);});});};module[_0xb9bb('0x1c')]=function(_0x5a8f38,_0x19449f){var _0x366f6a=_0x5a8f38[_0xb9bb('0x1d')];return _0x5a8f38[_0xb9bb('0x1e')](_0xb9bb('0x1f'),attributes,{'tableName':'voice_chanspy','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x5e4fa2,_0x43a9a4,_0x255756){return getChanSpyPromise(_0x366f6a,_0x5e4fa2)['then'](function(_0x230fe1){if(_0x230fe1&&_0x230fe1[_0xb9bb('0x15')]){return _0x366f6a['VoiceExtension']['bulkCreate'](_0x230fe1);}})[_0xb9bb('0x1a')](function(){_0x255756();})[_0xb9bb('0x1b')](function(_0x28d050){_0x255756(_0x28d050);});},'afterUpdate':function(_0x664807,_0x2f57e7,_0x1996f4){return _0x366f6a[_0xb9bb('0x20')][_0xb9bb('0x21')]({'where':{'ChanSpyId':_0x664807['id']}})[_0xb9bb('0x1a')](function(){return getChanSpyPromise(_0x366f6a,_0x664807);})['then'](function(_0x5b88dd){if(_0x5b88dd&&_0x5b88dd[_0xb9bb('0x15')]){return _0x366f6a[_0xb9bb('0x20')][_0xb9bb('0x22')](_0x5b88dd);}})[_0xb9bb('0x1a')](function(){_0x1996f4();})['catch'](function(_0x4c7a11){_0x1996f4(_0x4c7a11);});},'afterDestroy':function(_0x5f5b59,_0x1b984d,_0x43084e){return _0x366f6a[_0xb9bb('0x20')]['destroy']({'where':{'ChanSpyId':_0x5f5b59['id']}})['then'](function(){_0x43084e();})['catch'](function(_0x6404b4){_0x43084e(_0x6404b4);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index 8841063..3f95614 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 _0xcb91=['stringify','error','code','message','catch','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s'];(function(_0x53fe7d,_0x3b14bc){var _0xaeaefc=function(_0x16d2e8){while(--_0x16d2e8){_0x53fe7d['push'](_0x53fe7d['shift']());}};_0xaeaefc(++_0x3b14bc);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x142020,_0x1f7233){_0x142020=_0x142020-0x0;var _0x40da8f=_0xcb91[_0x142020];return _0x40da8f;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1cb9('0x0'));var BPromise=require(_0x1cb9('0x1'));var rs=require(_0x1cb9('0x2'));var fs=require('fs');var Redis=require(_0x1cb9('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1cb9('0x4'));var logger=require(_0x1cb9('0x5'))('rpc');var config=require(_0x1cb9('0x6'));var jayson=require(_0x1cb9('0x7'));var client=jayson['client'][_0x1cb9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3f7deb,_0x4ffe20,_0x38737d){return new BPromise(function(_0x12567c,_0x59d1be){return client[_0x1cb9('0x9')](_0x3f7deb,_0x38737d)['then'](function(_0x567139){logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,_0x1cb9('0xc'));logger[_0x1cb9('0xd')](_0x1cb9('0xe'),_0x4ffe20,'request\x20sent',JSON[_0x1cb9('0xf')](_0x567139));if(_0x567139[_0x1cb9('0x10')]){if(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x11')]===0x1f4){logger[_0x1cb9('0x10')]('VoiceChanSpy,\x20%s,\x20%s',_0x4ffe20,_0x567139['error']['message']);return _0x59d1be(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x567139['error'][_0x1cb9('0x12')]);return _0x12567c(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}else{logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,'request\x20sent');_0x12567c(_0x567139['result'][_0x1cb9('0x12')]);}})[_0x1cb9('0x13')](function(_0x3904b7){logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x3904b7);_0x59d1be(_0x3904b7);});});} \ No newline at end of file +var _0x0e9f=['debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceChanSpy,\x20%s,\x20%s','message','catch','lodash','util','randomstring','../../config/utils','../../config/environment','jayson/promise','http','then','info','request\x20sent'];(function(_0x3186aa,_0x34c21e){var _0x2d8c36=function(_0x239e99){while(--_0x239e99){_0x3186aa['push'](_0x3186aa['shift']());}};_0x2d8c36(++_0x34c21e);}(_0x0e9f,0x116));var _0xf0e9=function(_0x49aa43,_0xb3caa5){_0x49aa43=_0x49aa43-0x0;var _0x539ad3=_0x0e9f[_0x49aa43];return _0x539ad3;};'use strict';var _=require(_0xf0e9('0x0'));var util=require(_0xf0e9('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xf0e9('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xf0e9('0x3'));var logger=require('../../config/logger')('rpc');var config=require(_0xf0e9('0x4'));var jayson=require(_0xf0e9('0x5'));var client=jayson['client'][_0xf0e9('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x4a35a3,_0x3f9792,_0x2fa08f){return new BPromise(function(_0x106ba0,_0x58edfe){return client['request'](_0x4a35a3,_0x2fa08f)[_0xf0e9('0x7')](function(_0x7b3146){logger[_0xf0e9('0x8')]('VoiceChanSpy,\x20%s,\x20%s',_0x3f9792,_0xf0e9('0x9'));logger[_0xf0e9('0xa')](_0xf0e9('0xb'),_0x3f9792,'request\x20sent',JSON[_0xf0e9('0xc')](_0x7b3146));if(_0x7b3146[_0xf0e9('0xd')]){if(_0x7b3146[_0xf0e9('0xd')][_0xf0e9('0xe')]===0x1f4){logger['error'](_0xf0e9('0xf'),_0x3f9792,_0x7b3146['error'][_0xf0e9('0x10')]);return _0x58edfe(_0x7b3146[_0xf0e9('0xd')]['message']);}logger[_0xf0e9('0xd')](_0xf0e9('0xf'),_0x3f9792,_0x7b3146[_0xf0e9('0xd')][_0xf0e9('0x10')]);return _0x106ba0(_0x7b3146[_0xf0e9('0xd')][_0xf0e9('0x10')]);}else{logger['info'](_0xf0e9('0xf'),_0x3f9792,_0xf0e9('0x9'));_0x106ba0(_0x7b3146['result'][_0xf0e9('0x10')]);}})[_0xf0e9('0x11')](function(_0x3d0b4d){logger[_0xf0e9('0xd')]('VoiceChanSpy,\x20%s,\x20%s',_0x3f9792,_0x3d0b4d);_0x58edfe(_0x3d0b4d);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index ec98360..4fa35d1 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 _0xe53b=['./voiceContext.controller','get','isAuthenticated','index','/:id','post','create','update','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x31dd63,_0x556c56){var _0xea1941=function(_0xe5e4c5){while(--_0xe5e4c5){_0x31dd63['push'](_0x31dd63['shift']());}};_0xea1941(++_0x556c56);}(_0xe53b,0xf7));var _0xbe53=function(_0x401e2f,_0x1183b4){_0x401e2f=_0x401e2f-0x0;var _0x3c1241=_0xe53b[_0x401e2f];return _0x3c1241;};'use strict';var multer=require(_0xbe53('0x0'));var util=require('util');var path=require(_0xbe53('0x1'));var timeout=require('connect-timeout');var express=require(_0xbe53('0x2'));var router=express[_0xbe53('0x3')]();var fs_extra=require(_0xbe53('0x4'));var auth=require(_0xbe53('0x5'));var interaction=require(_0xbe53('0x6'));var config=require(_0xbe53('0x7'));var controller=require(_0xbe53('0x8'));router[_0xbe53('0x9')]('/',auth[_0xbe53('0xa')](),controller[_0xbe53('0xb')]);router[_0xbe53('0x9')](_0xbe53('0xc'),auth[_0xbe53('0xa')](),controller['show']);router[_0xbe53('0xd')]('/',auth[_0xbe53('0xa')](),controller[_0xbe53('0xe')]);router['put']('/:id',auth[_0xbe53('0xa')](),controller[_0xbe53('0xf')]);router['delete'](_0xbe53('0xc'),auth[_0xbe53('0xa')](),controller['destroy']);module[_0xbe53('0x10')]=router; \ No newline at end of file +var _0x95f0=['../../components/interaction/service','get','isAuthenticated','index','show','post','create','/:id','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x34e983,_0x2e879e){var _0xb9faff=function(_0x2431ff){while(--_0x2431ff){_0x34e983['push'](_0x34e983['shift']());}};_0xb9faff(++_0x2e879e);}(_0x95f0,0x1d3));var _0x095f=function(_0x4f2bc5,_0x1ced74){_0x4f2bc5=_0x4f2bc5-0x0;var _0x103453=_0x95f0[_0x4f2bc5];return _0x103453;};'use strict';var multer=require(_0x095f('0x0'));var util=require(_0x095f('0x1'));var path=require(_0x095f('0x2'));var timeout=require(_0x095f('0x3'));var express=require(_0x095f('0x4'));var router=express[_0x095f('0x5')]();var fs_extra=require(_0x095f('0x6'));var auth=require(_0x095f('0x7'));var interaction=require(_0x095f('0x8'));var config=require('../../config/environment');var controller=require('./voiceContext.controller');router[_0x095f('0x9')]('/',auth[_0x095f('0xa')](),controller[_0x095f('0xb')]);router[_0x095f('0x9')]('/:id',auth[_0x095f('0xa')](),controller[_0x095f('0xc')]);router[_0x095f('0xd')]('/',auth[_0x095f('0xa')](),controller[_0x095f('0xe')]);router['put'](_0x095f('0xf'),auth[_0x095f('0xa')](),controller[_0x095f('0x10')]);router[_0x095f('0x11')](_0x095f('0xf'),auth[_0x095f('0xa')](),controller[_0x095f('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index 02fb0de..07f8563 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 _0x2ab3=['BOOLEAN','sequelize','exports','name'];(function(_0xe0a9d0,_0x3aeccf){var _0x13338e=function(_0x1f2c28){while(--_0x1f2c28){_0xe0a9d0['push'](_0xe0a9d0['shift']());}};_0x13338e(++_0x3aeccf);}(_0x2ab3,0xb9));var _0x32ab=function(_0x37b3e5,_0x33b516){_0x37b3e5=_0x37b3e5-0x0;var _0x207f20=_0x2ab3[_0x37b3e5];return _0x207f20;};'use strict';var Sequelize=require(_0x32ab('0x0'));module[_0x32ab('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x32ab('0x2')},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x32ab('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x7348=['sequelize','exports','STRING','name'];(function(_0x2f4a2d,_0x10af1b){var _0x1e6191=function(_0x16e090){while(--_0x16e090){_0x2f4a2d['push'](_0x2f4a2d['shift']());}};_0x1e6191(++_0x10af1b);}(_0x7348,0x140));var _0x8734=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x7348[_0x42cae2];return _0x5f256f;};'use strict';var Sequelize=require(_0x8734('0x0'));module[_0x8734('0x1')]={'name':{'type':Sequelize[_0x8734('0x2')],'unique':_0x8734('0x3')},'description':{'type':Sequelize[_0x8734('0x2')],'allowNull':!![]},'defaultEntry':{'type':Sequelize['BOOLEAN'],'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 78afecb..1153994 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 _0x5687=['fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','findAll','show','params','include','create','body','join','root','server/files/templates/context.ejs','utf8','render','writeFileSync','role','user','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','chan_sip.so','/etc/asterisk/extensions_xcally_contexts.conf','Reload','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','request','then','info','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','error','code','message','catch','VoiceContext,\x20%s,\x20%s','sendStatus','status','end','json','undefined','limit','offset','count','set','apply','reject','save','update','destroy','get','Contexts','UserProfileResource','stack','send','map','VoiceContext','rawAttributes','fieldName','type','model','name','query','keys','filters','intersection','attributes'];(function(_0x3fae3a,_0x1508a6){var _0x45adb4=function(_0x367514){while(--_0x367514){_0x3fae3a['push'](_0x3fae3a['shift']());}};_0x45adb4(++_0x1508a6);}(_0x5687,0x155));var _0x7568=function(_0x3f7f66,_0x12a90c){_0x3f7f66=_0x3f7f66-0x0;var _0x4383d0=_0x5687[_0x3f7f66];return _0x4383d0;};'use strict';var emlformat=require(_0x7568('0x0'));var rimraf=require(_0x7568('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7568('0x2'));var rp=require(_0x7568('0x3'));var moment=require(_0x7568('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x7568('0x5'));var util=require(_0x7568('0x6'));var path=require(_0x7568('0x7'));var sox=require(_0x7568('0x8'));var csv=require(_0x7568('0x9'));var ejs=require(_0x7568('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x7568('0xb'));var crypto=require(_0x7568('0xc'));var jsforce=require(_0x7568('0xd'));var deskjs=require(_0x7568('0xe'));var toCsv=require(_0x7568('0x9'));var querystring=require(_0x7568('0xf'));var Papa=require(_0x7568('0x10'));var Redis=require(_0x7568('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x7568('0x12'));var hardwareService=require(_0x7568('0x13'));var logger=require(_0x7568('0x14'))('api');var utils=require(_0x7568('0x15'));var config=require(_0x7568('0x16'));var licenseUtil=require(_0x7568('0x17'));var db=require(_0x7568('0x18'))['db'];var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4acb24,_0x3fa529,_0x1acd4e,_0x4b3d48){return new BPromise(function(_0x48b266,_0x34445f){var _0x2ea730=_0x4b3d48||client;return _0x2ea730[_0x7568('0x19')](_0x4acb24,_0x1acd4e)[_0x7568('0x1a')](function(_0x2248e3){logger[_0x7568('0x1b')]('VoiceContext,\x20%s,\x20%s',_0x3fa529,_0x7568('0x1c'));logger[_0x7568('0x1d')](_0x7568('0x1e'),_0x3fa529,_0x7568('0x1c'),JSON['stringify'](_0x2248e3));if(_0x2248e3[_0x7568('0x1f')]){if(_0x2248e3[_0x7568('0x1f')][_0x7568('0x20')]===0x1f4){logger[_0x7568('0x1f')]('VoiceContext,\x20%s,\x20%s',_0x3fa529,_0x2248e3['error'][_0x7568('0x21')]);return _0x34445f(_0x2248e3[_0x7568('0x1f')][_0x7568('0x21')]);}logger['error']('VoiceContext,\x20%s,\x20%s',_0x3fa529,_0x2248e3[_0x7568('0x1f')][_0x7568('0x21')]);return _0x48b266(_0x2248e3[_0x7568('0x1f')][_0x7568('0x21')]);}else{logger[_0x7568('0x1b')]('VoiceContext,\x20%s,\x20%s',_0x3fa529,_0x7568('0x1c'));_0x48b266(_0x2248e3['result'][_0x7568('0x21')]);}})[_0x7568('0x22')](function(_0x1d7a4e){logger[_0x7568('0x1f')](_0x7568('0x23'),_0x3fa529,_0x1d7a4e);_0x34445f(_0x1d7a4e);});});}function respondWithStatusCode(_0x154aef,_0x4a0fcf){_0x4a0fcf=_0x4a0fcf||0xcc;return function(_0x5a7c91){if(_0x5a7c91){return _0x154aef[_0x7568('0x24')](_0x4a0fcf);}return _0x154aef[_0x7568('0x25')](_0x4a0fcf)[_0x7568('0x26')]();};}function respondWithResult(_0xa0c11d,_0x331330){_0x331330=_0x331330||0xc8;return function(_0x597866){if(_0x597866){return _0xa0c11d['status'](_0x331330)[_0x7568('0x27')](_0x597866);}};}function respondWithFilteredResult(_0x1bf151,_0x5c565d){return function(_0x259c2c){if(_0x259c2c){var _0x47fa45=typeof _0x5c565d['offset']===_0x7568('0x28')&&typeof _0x5c565d[_0x7568('0x29')]===_0x7568('0x28');var _0x215e4a=_0x259c2c['count'];var _0x520816=_0x47fa45?0x0:_0x5c565d[_0x7568('0x2a')];var _0x4a6fc7=_0x47fa45?_0x259c2c[_0x7568('0x2b')]:_0x5c565d[_0x7568('0x2a')]+_0x5c565d[_0x7568('0x29')];var _0x130c74;if(_0x4a6fc7>=_0x215e4a){_0x4a6fc7=_0x215e4a;_0x130c74=0xc8;}else{_0x130c74=0xce;}_0x1bf151['status'](_0x130c74);return _0x1bf151[_0x7568('0x2c')]('Content-Range',_0x520816+'-'+_0x4a6fc7+'/'+_0x215e4a)[_0x7568('0x27')](_0x259c2c);}return null;};}function patchUpdates(_0x11dbc8){return function(_0x1d7b70){try{jsonpatch[_0x7568('0x2d')](_0x1d7b70,_0x11dbc8,!![]);}catch(_0x2c037e){return BPromise[_0x7568('0x2e')](_0x2c037e);}return _0x1d7b70[_0x7568('0x2f')]();};}function saveUpdates(_0x149663,_0x3c77e6){return function(_0x260a06){if(_0x260a06){return _0x260a06[_0x7568('0x30')](_0x149663)[_0x7568('0x1a')](function(_0x1d9c0b){return _0x1d9c0b;});}return null;};}function removeEntity(_0x1862a0,_0xd34b5){return function(_0x5c70d0){if(_0x5c70d0){return _0x5c70d0[_0x7568('0x31')]()[_0x7568('0x1a')](function(){var _0xa809f9=_0x5c70d0[_0x7568('0x32')]({'plain':!![]});var _0x289e98=_0x7568('0x33');return db[_0x7568('0x34')][_0x7568('0x31')]({'where':{'type':_0x289e98,'resourceId':_0xa809f9['id']}})[_0x7568('0x1a')](function(){return _0x5c70d0;});})[_0x7568('0x1a')](function(){_0x1862a0['status'](0xcc)[_0x7568('0x26')]();});}};}function handleEntityNotFound(_0x2bfa73,_0x1211a9){return function(_0x1c9a0e){if(!_0x1c9a0e){_0x2bfa73['sendStatus'](0x194);}return _0x1c9a0e;};}function handleError(_0x3093ce,_0xc1bc7){_0xc1bc7=_0xc1bc7||0x1f4;return function(_0x24f46f){logger[_0x7568('0x1f')](_0x24f46f[_0x7568('0x35')]);if(_0x24f46f['name']){delete _0x24f46f['name'];}_0x3093ce['status'](_0xc1bc7)[_0x7568('0x36')](_0x24f46f);};}exports['index']=function(_0x13892b,_0x21f8c0){var _0x469b8f={},_0x58862e={},_0x33bdad={'count':0x0,'rows':[]};var _0x55a6bf=_[_0x7568('0x37')](db[_0x7568('0x38')][_0x7568('0x39')],function(_0x44f3a0){return{'name':_0x44f3a0[_0x7568('0x3a')],'type':_0x44f3a0[_0x7568('0x3b')]['key']};});_0x58862e[_0x7568('0x3c')]=_[_0x7568('0x37')](_0x55a6bf,_0x7568('0x3d'));_0x58862e[_0x7568('0x3e')]=_[_0x7568('0x3f')](_0x13892b[_0x7568('0x3e')]);_0x58862e[_0x7568('0x40')]=_[_0x7568('0x41')](_0x58862e[_0x7568('0x3c')],_0x58862e[_0x7568('0x3e')]);_0x469b8f[_0x7568('0x42')]=_[_0x7568('0x41')](_0x58862e[_0x7568('0x3c')],qs[_0x7568('0x43')](_0x13892b[_0x7568('0x3e')][_0x7568('0x43')]));_0x469b8f[_0x7568('0x42')]=_0x469b8f[_0x7568('0x42')][_0x7568('0x44')]?_0x469b8f[_0x7568('0x42')]:_0x58862e[_0x7568('0x3c')];if(!_0x13892b[_0x7568('0x3e')][_0x7568('0x45')](_0x7568('0x46'))){_0x469b8f['limit']=qs[_0x7568('0x29')](_0x13892b[_0x7568('0x3e')][_0x7568('0x29')]);_0x469b8f[_0x7568('0x2a')]=qs[_0x7568('0x2a')](_0x13892b[_0x7568('0x3e')]['offset']);}_0x469b8f[_0x7568('0x47')]=qs[_0x7568('0x48')](_0x13892b[_0x7568('0x3e')][_0x7568('0x48')]);_0x469b8f[_0x7568('0x49')]=qs[_0x7568('0x40')](_[_0x7568('0x4a')](_0x13892b[_0x7568('0x3e')],_0x58862e[_0x7568('0x40')]),_0x55a6bf);if(_0x13892b['query'][_0x7568('0x4b')]){_0x469b8f[_0x7568('0x49')]=_['merge'](_0x469b8f[_0x7568('0x49')],{'$or':_[_0x7568('0x37')](_0x55a6bf,function(_0x36cb0a){if(_0x36cb0a['type']!==_0x7568('0x4c')){var _0x43fc79={};_0x43fc79[_0x36cb0a[_0x7568('0x3d')]]={'$like':'%'+_0x13892b[_0x7568('0x3e')][_0x7568('0x4b')]+'%'};return _0x43fc79;}})});}_0x469b8f=_[_0x7568('0x4d')]({},_0x469b8f,_0x13892b[_0x7568('0x4e')]);var _0x5cfd34={'where':_0x469b8f[_0x7568('0x49')]};return db[_0x7568('0x38')][_0x7568('0x2b')](_0x5cfd34)[_0x7568('0x1a')](function(_0x4fdff7){_0x33bdad['count']=_0x4fdff7;if(_0x13892b[_0x7568('0x3e')][_0x7568('0x4f')]){_0x469b8f['include']=[{'all':!![]}];}return db[_0x7568('0x38')][_0x7568('0x50')](_0x469b8f);})[_0x7568('0x1a')](function(_0x10e5e2){_0x33bdad['rows']=_0x10e5e2;return _0x33bdad;})['then'](respondWithFilteredResult(_0x21f8c0,_0x469b8f))['catch'](handleError(_0x21f8c0,null));};exports[_0x7568('0x51')]=function(_0x4455da,_0x23129e){var _0x4e16d3={'raw':![],'where':{'id':_0x4455da[_0x7568('0x52')]['id']}},_0x424e85={};_0x424e85[_0x7568('0x3c')]=_['keys'](db[_0x7568('0x38')][_0x7568('0x39')]);_0x424e85['query']=_[_0x7568('0x3f')](_0x4455da['query']);_0x424e85['filters']=_[_0x7568('0x41')](_0x424e85['model'],_0x424e85[_0x7568('0x3e')]);_0x4e16d3[_0x7568('0x42')]=_[_0x7568('0x41')](_0x424e85[_0x7568('0x3c')],qs[_0x7568('0x43')](_0x4455da['query'][_0x7568('0x43')]));_0x4e16d3['attributes']=_0x4e16d3[_0x7568('0x42')][_0x7568('0x44')]?_0x4e16d3['attributes']:_0x424e85['model'];if(_0x4455da['query']['includeAll']){_0x4e16d3[_0x7568('0x53')]=[{'all':!![]}];}_0x4e16d3=_[_0x7568('0x4d')]({},_0x4e16d3,_0x4455da[_0x7568('0x4e')]);return db[_0x7568('0x38')]['find'](_0x4e16d3)[_0x7568('0x1a')](handleEntityNotFound(_0x23129e,null))[_0x7568('0x1a')](respondWithResult(_0x23129e,null))[_0x7568('0x22')](handleError(_0x23129e,null));};exports[_0x7568('0x54')]=function(_0x278fbf,_0x442d3f,_0x5d8069){var _0x4b71ca;return db[_0x7568('0x38')][_0x7568('0x54')](_0x278fbf[_0x7568('0x55')],{'raw':!![]})[_0x7568('0x1a')](function(_0x1be10a){_0x4b71ca=_0x1be10a;return db[_0x7568('0x38')]['findAll']({'raw':!![]});})['then'](function(_0x5c1762){var _0x56f5d5=fs['readFileSync'](path[_0x7568('0x56')](config[_0x7568('0x57')],_0x7568('0x58')),_0x7568('0x59'));var _0x31bcf9=ejs[_0x7568('0x5a')](_0x56f5d5,{'contexts':_0x5c1762||[]});fs[_0x7568('0x5b')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x31bcf9);})[_0x7568('0x1a')](function(){return respondWithRpcPromise('Reload',_0x7568('0x54'),{'module':'chan_sip.so'});})['then'](function(){var _0x535538=_0x278fbf['user'][_0x7568('0x32')]({'plain':!![]});if(!_0x535538)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x535538[_0x7568('0x5c')]===_0x7568('0x5d')){var _0xf8fe7=_0x4b71ca[_0x7568('0x32')]({'plain':!![]});return db['UserProfileSection'][_0x7568('0x5e')]({'where':{'name':_0x7568('0x33'),'userProfileId':_0x535538[_0x7568('0x5f')]},'raw':!![]})[_0x7568('0x1a')](function(_0x7d7702){if(_0x7d7702&&_0x7d7702[_0x7568('0x60')]===0x0){return db['UserProfileResource'][_0x7568('0x54')]({'name':_0xf8fe7[_0x7568('0x3d')],'resourceId':_0xf8fe7['id'],'type':_0x7d7702['name'],'sectionId':_0x7d7702['id']},{})['then'](function(){return _0x4b71ca;});}else{return _0x4b71ca;}})['catch'](function(_0x294547){logger[_0x7568('0x1f')](_0x7568('0x61'),_0x294547);throw _0x294547;});}return _0x4b71ca;})['then'](respondWithResult(_0x442d3f,0xc9))[_0x7568('0x22')](handleError(_0x442d3f,null));};exports[_0x7568('0x30')]=function(_0x210120,_0x16e4d6,_0x26d63){var _0x16b185;return db[_0x7568('0x38')][_0x7568('0x5e')]({'where':{'id':_0x210120[_0x7568('0x52')]['id']}})['then'](handleEntityNotFound(_0x16e4d6,null))[_0x7568('0x1a')](saveUpdates(_0x210120[_0x7568('0x55')],null))[_0x7568('0x1a')](function(_0x181e38){if(_0x181e38){_0x16b185=_0x181e38;return db[_0x7568('0x38')][_0x7568('0x50')]({'raw':!![]});}})['then'](function(_0x1eea26){var _0x2124c4=fs[_0x7568('0x62')](path[_0x7568('0x56')](config[_0x7568('0x57')],_0x7568('0x58')),_0x7568('0x59'));var _0x3855b1=ejs[_0x7568('0x5a')](_0x2124c4,{'contexts':_0x1eea26||[]});fs[_0x7568('0x5b')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x3855b1);})[_0x7568('0x1a')](function(){return respondWithRpcPromise('Reload',_0x7568('0x30'),{'module':_0x7568('0x63')});})[_0x7568('0x1a')](function(){return _0x16b185;})[_0x7568('0x1a')](respondWithResult(_0x16e4d6,null))[_0x7568('0x22')](handleError(_0x16e4d6,null));};exports[_0x7568('0x31')]=function(_0x1c50a6,_0x9cbd7a,_0x2db5e2){var _0x566bd2;return db['VoiceContext'][_0x7568('0x5e')]({'where':{'id':_0x1c50a6[_0x7568('0x52')]['id']}})[_0x7568('0x1a')](handleEntityNotFound(_0x9cbd7a,null))[_0x7568('0x1a')](removeEntity(_0x9cbd7a,null))[_0x7568('0x1a')](function(){return db['VoiceContext'][_0x7568('0x50')]({'raw':!![]});})[_0x7568('0x1a')](function(_0x1c56cd){var _0x4ace2d=fs[_0x7568('0x62')](path[_0x7568('0x56')](config['root'],_0x7568('0x58')),'utf8');var _0x31dd63=ejs['render'](_0x4ace2d,{'contexts':_0x1c56cd});fs[_0x7568('0x5b')](_0x7568('0x64'),_0x31dd63);return respondWithRpcPromise(_0x7568('0x65'),'destroy',{'module':_0x7568('0x63')});})[_0x7568('0x22')](handleError(_0x9cbd7a,null));}; \ No newline at end of file +var _0xc873=['userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','root','utf8','readFileSync','join','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','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','jayson/promise','client','http','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','json','offset','undefined','limit','count','set','apply','then','destroy','get','Contexts','UserProfileResource','end','stack','name','map','VoiceContext','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','findAll','rows','show','params','rawAttributes','create','body','server/files/templates/context.ejs','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find'];(function(_0x284307,_0x4799ef){var _0x226ed0=function(_0x2a3209){while(--_0x2a3209){_0x284307['push'](_0x284307['shift']());}};_0x226ed0(++_0x4799ef);}(_0xc873,0x72));var _0x3c87=function(_0x4a2e8c,_0x462084){_0x4a2e8c=_0x4a2e8c-0x0;var _0x4bc763=_0xc873[_0x4a2e8c];return _0x4bc763;};'use strict';var emlformat=require(_0x3c87('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x3c87('0x1'));var rp=require(_0x3c87('0x2'));var moment=require(_0x3c87('0x3'));var BPromise=require(_0x3c87('0x4'));var Mustache=require(_0x3c87('0x5'));var util=require(_0x3c87('0x6'));var path=require(_0x3c87('0x7'));var sox=require(_0x3c87('0x8'));var csv=require('to-csv');var ejs=require(_0x3c87('0x9'));var fs=require('fs');var fs_extra=require(_0x3c87('0xa'));var _=require('lodash');var squel=require(_0x3c87('0xb'));var crypto=require(_0x3c87('0xc'));var jsforce=require(_0x3c87('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x3c87('0xe'));var querystring=require(_0x3c87('0xf'));var Papa=require(_0x3c87('0x10'));var Redis=require(_0x3c87('0x11'));var authService=require(_0x3c87('0x12'));var qs=require(_0x3c87('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3c87('0x14'));var logger=require(_0x3c87('0x15'))(_0x3c87('0x16'));var utils=require(_0x3c87('0x17'));var config=require(_0x3c87('0x18'));var licenseUtil=require(_0x3c87('0x19'));var db=require(_0x3c87('0x1a'))['db'];var jayson=require(_0x3c87('0x1b'));var client=jayson[_0x3c87('0x1c')][_0x3c87('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x435e17,_0xd45d26,_0x513ddf,_0x29321b){return new BPromise(function(_0x21d2d1,_0x3b2c23){var _0x1c6d63=_0x29321b||client;return _0x1c6d63['request'](_0x435e17,_0x513ddf)['then'](function(_0x1d7898){logger[_0x3c87('0x1e')](_0x3c87('0x1f'),_0xd45d26,_0x3c87('0x20'));logger[_0x3c87('0x21')](_0x3c87('0x22'),_0xd45d26,_0x3c87('0x20'),JSON[_0x3c87('0x23')](_0x1d7898));if(_0x1d7898[_0x3c87('0x24')]){if(_0x1d7898[_0x3c87('0x24')][_0x3c87('0x25')]===0x1f4){logger[_0x3c87('0x24')](_0x3c87('0x1f'),_0xd45d26,_0x1d7898[_0x3c87('0x24')][_0x3c87('0x26')]);return _0x3b2c23(_0x1d7898[_0x3c87('0x24')][_0x3c87('0x26')]);}logger[_0x3c87('0x24')]('VoiceContext,\x20%s,\x20%s',_0xd45d26,_0x1d7898[_0x3c87('0x24')][_0x3c87('0x26')]);return _0x21d2d1(_0x1d7898['error'][_0x3c87('0x26')]);}else{logger[_0x3c87('0x1e')](_0x3c87('0x1f'),_0xd45d26,_0x3c87('0x20'));_0x21d2d1(_0x1d7898[_0x3c87('0x27')][_0x3c87('0x26')]);}})[_0x3c87('0x28')](function(_0x1d9786){logger[_0x3c87('0x24')]('VoiceContext,\x20%s,\x20%s',_0xd45d26,_0x1d9786);_0x3b2c23(_0x1d9786);});});}function respondWithStatusCode(_0x4b2844,_0x3ee86c){_0x3ee86c=_0x3ee86c||0xcc;return function(_0x5619e2){if(_0x5619e2){return _0x4b2844[_0x3c87('0x29')](_0x3ee86c);}return _0x4b2844[_0x3c87('0x2a')](_0x3ee86c)['end']();};}function respondWithResult(_0x3bdf2d,_0x29d2f3){_0x29d2f3=_0x29d2f3||0xc8;return function(_0x7eda3b){if(_0x7eda3b){return _0x3bdf2d[_0x3c87('0x2a')](_0x29d2f3)[_0x3c87('0x2b')](_0x7eda3b);}};}function respondWithFilteredResult(_0x6c5d65,_0x489c67){return function(_0x39c1c3){if(_0x39c1c3){var _0x3fcbd0=typeof _0x489c67[_0x3c87('0x2c')]===_0x3c87('0x2d')&&typeof _0x489c67[_0x3c87('0x2e')]===_0x3c87('0x2d');var _0x40da8e=_0x39c1c3[_0x3c87('0x2f')];var _0x256fdb=_0x3fcbd0?0x0:_0x489c67['offset'];var _0x476be9=_0x3fcbd0?_0x39c1c3[_0x3c87('0x2f')]:_0x489c67[_0x3c87('0x2c')]+_0x489c67[_0x3c87('0x2e')];var _0x56cb2f;if(_0x476be9>=_0x40da8e){_0x476be9=_0x40da8e;_0x56cb2f=0xc8;}else{_0x56cb2f=0xce;}_0x6c5d65[_0x3c87('0x2a')](_0x56cb2f);return _0x6c5d65[_0x3c87('0x30')]('Content-Range',_0x256fdb+'-'+_0x476be9+'/'+_0x40da8e)['json'](_0x39c1c3);}return null;};}function patchUpdates(_0xa9d1b7){return function(_0xbdf804){try{jsonpatch[_0x3c87('0x31')](_0xbdf804,_0xa9d1b7,!![]);}catch(_0x1dec20){return BPromise['reject'](_0x1dec20);}return _0xbdf804['save']();};}function saveUpdates(_0x5752a5,_0x3be312){return function(_0x5a19eb){if(_0x5a19eb){return _0x5a19eb['update'](_0x5752a5)[_0x3c87('0x32')](function(_0x4a628d){return _0x4a628d;});}return null;};}function removeEntity(_0x3d95e5,_0x1785c8){return function(_0x187d2c){if(_0x187d2c){return _0x187d2c[_0x3c87('0x33')]()[_0x3c87('0x32')](function(){var _0x5dc981=_0x187d2c[_0x3c87('0x34')]({'plain':!![]});var _0x42d4ce=_0x3c87('0x35');return db[_0x3c87('0x36')][_0x3c87('0x33')]({'where':{'type':_0x42d4ce,'resourceId':_0x5dc981['id']}})[_0x3c87('0x32')](function(){return _0x187d2c;});})[_0x3c87('0x32')](function(){_0x3d95e5[_0x3c87('0x2a')](0xcc)[_0x3c87('0x37')]();});}};}function handleEntityNotFound(_0x1a61cf,_0x400a57){return function(_0x3a983d){if(!_0x3a983d){_0x1a61cf[_0x3c87('0x29')](0x194);}return _0x3a983d;};}function handleError(_0x2fed9e,_0x60b3bc){_0x60b3bc=_0x60b3bc||0x1f4;return function(_0x12c9d2){logger[_0x3c87('0x24')](_0x12c9d2[_0x3c87('0x38')]);if(_0x12c9d2['name']){delete _0x12c9d2[_0x3c87('0x39')];}_0x2fed9e[_0x3c87('0x2a')](_0x60b3bc)['send'](_0x12c9d2);};}exports['index']=function(_0x48705d,_0x9fafe9){var _0x4dfab7={},_0x3f3737={},_0x16694a={'count':0x0,'rows':[]};var _0x37d37d=_[_0x3c87('0x3a')](db[_0x3c87('0x3b')]['rawAttributes'],function(_0x202c67){return{'name':_0x202c67[_0x3c87('0x3c')],'type':_0x202c67[_0x3c87('0x3d')][_0x3c87('0x3e')]};});_0x3f3737[_0x3c87('0x3f')]=_[_0x3c87('0x3a')](_0x37d37d,_0x3c87('0x39'));_0x3f3737[_0x3c87('0x40')]=_[_0x3c87('0x41')](_0x48705d[_0x3c87('0x40')]);_0x3f3737['filters']=_[_0x3c87('0x42')](_0x3f3737[_0x3c87('0x3f')],_0x3f3737[_0x3c87('0x40')]);_0x4dfab7['attributes']=_['intersection'](_0x3f3737[_0x3c87('0x3f')],qs[_0x3c87('0x43')](_0x48705d['query'][_0x3c87('0x43')]));_0x4dfab7['attributes']=_0x4dfab7[_0x3c87('0x44')][_0x3c87('0x45')]?_0x4dfab7[_0x3c87('0x44')]:_0x3f3737['model'];if(!_0x48705d[_0x3c87('0x40')][_0x3c87('0x46')](_0x3c87('0x47'))){_0x4dfab7[_0x3c87('0x2e')]=qs[_0x3c87('0x2e')](_0x48705d[_0x3c87('0x40')][_0x3c87('0x2e')]);_0x4dfab7[_0x3c87('0x2c')]=qs[_0x3c87('0x2c')](_0x48705d[_0x3c87('0x40')][_0x3c87('0x2c')]);}_0x4dfab7[_0x3c87('0x48')]=qs['sort'](_0x48705d[_0x3c87('0x40')]['sort']);_0x4dfab7[_0x3c87('0x49')]=qs[_0x3c87('0x4a')](_[_0x3c87('0x4b')](_0x48705d[_0x3c87('0x40')],_0x3f3737[_0x3c87('0x4a')]),_0x37d37d);if(_0x48705d[_0x3c87('0x40')]['filter']){_0x4dfab7[_0x3c87('0x49')]=_[_0x3c87('0x4c')](_0x4dfab7[_0x3c87('0x49')],{'$or':_[_0x3c87('0x3a')](_0x37d37d,function(_0x5cdc68){if(_0x5cdc68['type']!==_0x3c87('0x4d')){var _0x2aaf70={};_0x2aaf70[_0x5cdc68['name']]={'$like':'%'+_0x48705d[_0x3c87('0x40')][_0x3c87('0x4e')]+'%'};return _0x2aaf70;}})});}_0x4dfab7=_[_0x3c87('0x4c')]({},_0x4dfab7,_0x48705d[_0x3c87('0x4f')]);var _0x48ab02={'where':_0x4dfab7[_0x3c87('0x49')]};return db['VoiceContext'][_0x3c87('0x2f')](_0x48ab02)['then'](function(_0x217168){_0x16694a['count']=_0x217168;if(_0x48705d[_0x3c87('0x40')][_0x3c87('0x50')]){_0x4dfab7['include']=[{'all':!![]}];}return db[_0x3c87('0x3b')][_0x3c87('0x51')](_0x4dfab7);})[_0x3c87('0x32')](function(_0x4d637d){_0x16694a[_0x3c87('0x52')]=_0x4d637d;return _0x16694a;})['then'](respondWithFilteredResult(_0x9fafe9,_0x4dfab7))['catch'](handleError(_0x9fafe9,null));};exports[_0x3c87('0x53')]=function(_0x384dfb,_0x1372b2){var _0x57650f={'raw':![],'where':{'id':_0x384dfb[_0x3c87('0x54')]['id']}},_0x50ce25={};_0x50ce25['model']=_[_0x3c87('0x41')](db[_0x3c87('0x3b')][_0x3c87('0x55')]);_0x50ce25[_0x3c87('0x40')]=_[_0x3c87('0x41')](_0x384dfb['query']);_0x50ce25[_0x3c87('0x4a')]=_[_0x3c87('0x42')](_0x50ce25[_0x3c87('0x3f')],_0x50ce25['query']);_0x57650f[_0x3c87('0x44')]=_[_0x3c87('0x42')](_0x50ce25[_0x3c87('0x3f')],qs[_0x3c87('0x43')](_0x384dfb['query']['fields']));_0x57650f[_0x3c87('0x44')]=_0x57650f[_0x3c87('0x44')]['length']?_0x57650f[_0x3c87('0x44')]:_0x50ce25[_0x3c87('0x3f')];if(_0x384dfb[_0x3c87('0x40')][_0x3c87('0x50')]){_0x57650f['include']=[{'all':!![]}];}_0x57650f=_['merge']({},_0x57650f,_0x384dfb[_0x3c87('0x4f')]);return db['VoiceContext']['find'](_0x57650f)[_0x3c87('0x32')](handleEntityNotFound(_0x1372b2,null))[_0x3c87('0x32')](respondWithResult(_0x1372b2,null))[_0x3c87('0x28')](handleError(_0x1372b2,null));};exports[_0x3c87('0x56')]=function(_0x4e0072,_0x19cf4c,_0x315e3e){var _0x5dc41d;return db[_0x3c87('0x3b')][_0x3c87('0x56')](_0x4e0072[_0x3c87('0x57')],{'raw':!![]})[_0x3c87('0x32')](function(_0x369d22){_0x5dc41d=_0x369d22;return db[_0x3c87('0x3b')]['findAll']({'raw':!![]});})['then'](function(_0x501f40){var _0x4125d8=fs['readFileSync'](path['join'](config['root'],_0x3c87('0x58')),'utf8');var _0x20f7f8=ejs[_0x3c87('0x59')](_0x4125d8,{'contexts':_0x501f40||[]});fs[_0x3c87('0x5a')](_0x3c87('0x5b'),_0x20f7f8);})[_0x3c87('0x32')](function(){return respondWithRpcPromise(_0x3c87('0x5c'),_0x3c87('0x56'),{'module':_0x3c87('0x5d')});})['then'](function(){var _0x4d3f8d=_0x4e0072[_0x3c87('0x5e')][_0x3c87('0x34')]({'plain':!![]});if(!_0x4d3f8d)throw new Error(_0x3c87('0x5f'));if(_0x4d3f8d['role']==='user'){var _0x562477=_0x5dc41d[_0x3c87('0x34')]({'plain':!![]});return db[_0x3c87('0x60')][_0x3c87('0x61')]({'where':{'name':_0x3c87('0x35'),'userProfileId':_0x4d3f8d[_0x3c87('0x62')]},'raw':!![]})[_0x3c87('0x32')](function(_0x59b651){if(_0x59b651&&_0x59b651[_0x3c87('0x63')]===0x0){return db[_0x3c87('0x36')][_0x3c87('0x56')]({'name':_0x562477[_0x3c87('0x39')],'resourceId':_0x562477['id'],'type':_0x59b651['name'],'sectionId':_0x59b651['id']},{})[_0x3c87('0x32')](function(){return _0x5dc41d;});}else{return _0x5dc41d;}})[_0x3c87('0x28')](function(_0x4f1673){logger[_0x3c87('0x24')](_0x3c87('0x64'),_0x4f1673);throw _0x4f1673;});}return _0x5dc41d;})['then'](respondWithResult(_0x19cf4c,0xc9))[_0x3c87('0x28')](handleError(_0x19cf4c,null));};exports[_0x3c87('0x65')]=function(_0x569f74,_0x4a4051,_0x24a031){var _0x1f452c;return db['VoiceContext']['find']({'where':{'id':_0x569f74[_0x3c87('0x54')]['id']}})[_0x3c87('0x32')](handleEntityNotFound(_0x4a4051,null))['then'](saveUpdates(_0x569f74[_0x3c87('0x57')],null))[_0x3c87('0x32')](function(_0x1c9692){if(_0x1c9692){_0x1f452c=_0x1c9692;return db['VoiceContext'][_0x3c87('0x51')]({'raw':!![]});}})[_0x3c87('0x32')](function(_0x39ae3e){var _0x41f9aa=fs['readFileSync'](path['join'](config[_0x3c87('0x66')],'server/files/templates/context.ejs'),_0x3c87('0x67'));var _0x38f4ad=ejs[_0x3c87('0x59')](_0x41f9aa,{'contexts':_0x39ae3e||[]});fs[_0x3c87('0x5a')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x38f4ad);})[_0x3c87('0x32')](function(){return respondWithRpcPromise(_0x3c87('0x5c'),'update',{'module':_0x3c87('0x5d')});})[_0x3c87('0x32')](function(){return _0x1f452c;})[_0x3c87('0x32')](respondWithResult(_0x4a4051,null))['catch'](handleError(_0x4a4051,null));};exports[_0x3c87('0x33')]=function(_0x43fb38,_0x45d7bc,_0xab1d66){var _0x258efa;return db[_0x3c87('0x3b')]['find']({'where':{'id':_0x43fb38[_0x3c87('0x54')]['id']}})[_0x3c87('0x32')](handleEntityNotFound(_0x45d7bc,null))['then'](removeEntity(_0x45d7bc,null))['then'](function(){return db[_0x3c87('0x3b')]['findAll']({'raw':!![]});})[_0x3c87('0x32')](function(_0xf4a6a9){var _0x2dc491=fs[_0x3c87('0x68')](path[_0x3c87('0x69')](config[_0x3c87('0x66')],_0x3c87('0x58')),_0x3c87('0x67'));var _0x30a197=ejs[_0x3c87('0x59')](_0x2dc491,{'contexts':_0xf4a6a9});fs['writeFileSync']('/etc/asterisk/extensions_xcally_contexts.conf',_0x30a197);return respondWithRpcPromise(_0x3c87('0x5c'),_0x3c87('0x33'),{'module':_0x3c87('0x5d')});})[_0x3c87('0x28')](handleError(_0x45d7bc,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index 1e8c977..e4ca797 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 _0xacea=['voice_contexts','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceContext.attributes','define','VoiceContext'];(function(_0x1dfe06,_0xbe4704){var _0x8131d9=function(_0x41881b){while(--_0x41881b){_0x1dfe06['push'](_0x1dfe06['shift']());}};_0x8131d9(++_0xbe4704);}(_0xacea,0x1a1));var _0xaace=function(_0x40f246,_0x3fe540){_0x40f246=_0x40f246-0x0;var _0x1775de=_0xacea[_0x40f246];return _0x1775de;};'use strict';var _=require(_0xaace('0x0'));var util=require(_0xaace('0x1'));var logger=require(_0xaace('0x2'))('api');var moment=require(_0xaace('0x3'));var BPromise=require(_0xaace('0x4'));var rp=require(_0xaace('0x5'));var fs=require('fs');var path=require(_0xaace('0x6'));var rimraf=require(_0xaace('0x7'));var config=require(_0xaace('0x8'));var attributes=require(_0xaace('0x9'));module['exports']=function(_0x139657,_0x2a56be){return _0x139657[_0xaace('0xa')](_0xaace('0xb'),attributes,{'tableName':_0xaace('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc54a=['VoiceContext','voice_contexts','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./voiceContext.attributes','exports'];(function(_0x122d9f,_0x2c9e5b){var _0x41a09e=function(_0x3d9564){while(--_0x3d9564){_0x122d9f['push'](_0x122d9f['shift']());}};_0x41a09e(++_0x2c9e5b);}(_0xc54a,0x1d6));var _0xac54=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc54a[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xac54('0x0'));var util=require(_0xac54('0x1'));var logger=require(_0xac54('0x2'))(_0xac54('0x3'));var moment=require(_0xac54('0x4'));var BPromise=require('bluebird');var rp=require(_0xac54('0x5'));var fs=require('fs');var path=require(_0xac54('0x6'));var rimraf=require(_0xac54('0x7'));var config=require(_0xac54('0x8'));var attributes=require(_0xac54('0x9'));module[_0xac54('0xa')]=function(_0x16c53e,_0x18d7cd){return _0x16c53e['define'](_0xac54('0xb'),attributes,{'tableName':_0xac54('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.rpc.js b/server/api/voiceContext/voiceContext.rpc.js index ff43e81..e6b3753 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 _0x7334=['ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceContext,\x20%s,\x20%s','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','lodash','util','moment'];(function(_0x20ed93,_0x4aa2da){var _0x19263d=function(_0xcb1268){while(--_0xcb1268){_0x20ed93['push'](_0x20ed93['shift']());}};_0x19263d(++_0x4aa2da);}(_0x7334,0x184));var _0x4733=function(_0x21fd12,_0x447966){_0x21fd12=_0x21fd12-0x0;var _0x4b7b56=_0x7334[_0x21fd12];return _0x4b7b56;};'use strict';var _=require(_0x4733('0x0'));var util=require(_0x4733('0x1'));var moment=require(_0x4733('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4733('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x4733('0x4'));var logger=require(_0x4733('0x5'))(_0x4733('0x6'));var config=require(_0x4733('0x7'));var jayson=require(_0x4733('0x8'));var client=jayson[_0x4733('0x9')][_0x4733('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x283754,_0x12cafa,_0x43d95c){return new BPromise(function(_0x8257cf,_0x3562b7){return client[_0x4733('0xb')](_0x283754,_0x43d95c)[_0x4733('0xc')](function(_0x2d5fde){logger[_0x4733('0xd')](_0x4733('0xe'),_0x12cafa,'request\x20sent');logger[_0x4733('0xf')](_0x4733('0x10'),_0x12cafa,'request\x20sent',JSON[_0x4733('0x11')](_0x2d5fde));if(_0x2d5fde['error']){if(_0x2d5fde[_0x4733('0x12')][_0x4733('0x13')]===0x1f4){logger[_0x4733('0x12')](_0x4733('0xe'),_0x12cafa,_0x2d5fde[_0x4733('0x12')][_0x4733('0x14')]);return _0x3562b7(_0x2d5fde[_0x4733('0x12')]['message']);}logger[_0x4733('0x12')]('VoiceContext,\x20%s,\x20%s',_0x12cafa,_0x2d5fde[_0x4733('0x12')][_0x4733('0x14')]);return _0x8257cf(_0x2d5fde[_0x4733('0x12')][_0x4733('0x14')]);}else{logger[_0x4733('0xd')](_0x4733('0xe'),_0x12cafa,_0x4733('0x15'));_0x8257cf(_0x2d5fde[_0x4733('0x16')][_0x4733('0x14')]);}})['catch'](function(_0x2c0031){logger[_0x4733('0x12')]('VoiceContext,\x20%s,\x20%s',_0x12cafa,_0x2c0031);_0x3562b7(_0x2c0031);});});} \ No newline at end of file +var _0x609a=['then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http'];(function(_0x48d45b,_0x552d6d){var _0x43bbbc=function(_0x2b7ad3){while(--_0x2b7ad3){_0x48d45b['push'](_0x48d45b['shift']());}};_0x43bbbc(++_0x552d6d);}(_0x609a,0x11c));var _0xa609=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x609a[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0xa609('0x0'));var util=require(_0xa609('0x1'));var moment=require('moment');var BPromise=require(_0xa609('0x2'));var rs=require(_0xa609('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa609('0x4'))['db'];var utils=require(_0xa609('0x5'));var logger=require(_0xa609('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xa609('0x7'));var client=jayson[_0xa609('0x8')][_0xa609('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x42acb9,_0x42b384,_0x45c41a){return new BPromise(function(_0x70d215,_0x153251){return client['request'](_0x42acb9,_0x45c41a)[_0xa609('0xa')](function(_0x42b756){logger[_0xa609('0xb')](_0xa609('0xc'),_0x42b384,_0xa609('0xd'));logger[_0xa609('0xe')](_0xa609('0xf'),_0x42b384,_0xa609('0xd'),JSON[_0xa609('0x10')](_0x42b756));if(_0x42b756[_0xa609('0x11')]){if(_0x42b756[_0xa609('0x11')][_0xa609('0x12')]===0x1f4){logger[_0xa609('0x11')](_0xa609('0xc'),_0x42b384,_0x42b756[_0xa609('0x11')][_0xa609('0x13')]);return _0x153251(_0x42b756[_0xa609('0x11')][_0xa609('0x13')]);}logger['error'](_0xa609('0xc'),_0x42b384,_0x42b756[_0xa609('0x11')][_0xa609('0x13')]);return _0x70d215(_0x42b756[_0xa609('0x11')]['message']);}else{logger[_0xa609('0xb')](_0xa609('0xc'),_0x42b384,_0xa609('0xd'));_0x70d215(_0x42b756[_0xa609('0x14')][_0xa609('0x13')]);}})['catch'](function(_0x4c45ad){logger[_0xa609('0x11')](_0xa609('0xc'),_0x42b384,_0x4c45ad);_0x153251(_0x4c45ad);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index f1c6a57..49d5b48 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 _0x02ba=['create','put','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./voiceDialReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post'];(function(_0x75c3eb,_0x271b5a){var _0x6e6585=function(_0x3d48f5){while(--_0x3d48f5){_0x75c3eb['push'](_0x75c3eb['shift']());}};_0x6e6585(++_0x271b5a);}(_0x02ba,0xaf));var _0xa02b=function(_0x594f87,_0x108bbb){_0x594f87=_0x594f87-0x0;var _0x58bb0f=_0x02ba[_0x594f87];return _0x58bb0f;};'use strict';var multer=require(_0xa02b('0x0'));var util=require(_0xa02b('0x1'));var path=require('path');var timeout=require(_0xa02b('0x2'));var express=require(_0xa02b('0x3'));var router=express[_0xa02b('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xa02b('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xa02b('0x6'));var controller=require(_0xa02b('0x7'));router[_0xa02b('0x8')]('/',auth[_0xa02b('0x9')](),controller[_0xa02b('0xa')]);router['get'](_0xa02b('0xb'),auth['isAuthenticated'](),controller[_0xa02b('0xc')]);router[_0xa02b('0x8')](_0xa02b('0xd'),auth['isAuthenticated'](),controller['show']);router[_0xa02b('0xe')]('/',auth[_0xa02b('0x9')](),controller[_0xa02b('0xf')]);router[_0xa02b('0x10')](_0xa02b('0xd'),auth[_0xa02b('0x9')](),controller['update']);router['delete'](_0xa02b('0xd'),auth['isAuthenticated'](),controller[_0xa02b('0x11')]);module[_0xa02b('0x12')]=router; \ No newline at end of file +var _0x5a1f=['delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceDialReport.controller','isAuthenticated','get','/describe','describe','/:id','post','create','put','update'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0x5a1f,0x1ba));var _0xf5a1=function(_0x3b7b99,_0x211249){_0x3b7b99=_0x3b7b99-0x0;var _0x21a0e9=_0x5a1f[_0x3b7b99];return _0x21a0e9;};'use strict';var multer=require('multer');var util=require(_0xf5a1('0x0'));var path=require(_0xf5a1('0x1'));var timeout=require(_0xf5a1('0x2'));var express=require(_0xf5a1('0x3'));var router=express[_0xf5a1('0x4')]();var fs_extra=require(_0xf5a1('0x5'));var auth=require(_0xf5a1('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xf5a1('0x7'));var controller=require(_0xf5a1('0x8'));router['get']('/',auth[_0xf5a1('0x9')](),controller['index']);router[_0xf5a1('0xa')](_0xf5a1('0xb'),auth[_0xf5a1('0x9')](),controller[_0xf5a1('0xc')]);router['get'](_0xf5a1('0xd'),auth['isAuthenticated'](),controller['show']);router[_0xf5a1('0xe')]('/',auth[_0xf5a1('0x9')](),controller[_0xf5a1('0xf')]);router[_0xf5a1('0x10')]('/:id',auth[_0xf5a1('0x9')](),controller[_0xf5a1('0x11')]);router[_0xf5a1('0x12')](_0xf5a1('0xd'),auth[_0xf5a1('0x9')](),controller['destroy']);module[_0xf5a1('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index 8083cfc..e1e11dc 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 _0x81bd=['exports','STRING','INTEGER','DATE','sequelize'];(function(_0x3eaf93,_0x3361ad){var _0xea6aa1=function(_0x4c48f2){while(--_0x4c48f2){_0x3eaf93['push'](_0x3eaf93['shift']());}};_0xea6aa1(++_0x3361ad);}(_0x81bd,0x7c));var _0xd81b=function(_0x3ddde9,_0x1a6a2b){_0x3ddde9=_0x3ddde9-0x0;var _0xdfb693=_0x81bd[_0x3ddde9];return _0xdfb693;};'use strict';var Sequelize=require(_0xd81b('0x0'));module[_0xd81b('0x1')]={'privilege':{'type':Sequelize[_0xd81b('0x2')]},'channel':{'type':Sequelize[_0xd81b('0x2')]},'channelstate':{'type':Sequelize[_0xd81b('0x3')]},'channelstatedesc':{'type':Sequelize[_0xd81b('0x2')]},'calleridnum':{'type':Sequelize[_0xd81b('0x2')]},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0xd81b('0x2')]},'connectedlinename':{'type':Sequelize[_0xd81b('0x2')]},'language':{'type':Sequelize[_0xd81b('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xd81b('0x2')]},'exten':{'type':Sequelize[_0xd81b('0x2')]},'priority':{'type':Sequelize[_0xd81b('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0xd81b('0x2')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0xd81b('0x2')]},'destcalleridnum':{'type':Sequelize[_0xd81b('0x2')]},'destcalleridname':{'type':Sequelize[_0xd81b('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xd81b('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xd81b('0x2')]},'destlanguage':{'type':Sequelize[_0xd81b('0x2')]},'destaccountcode':{'type':Sequelize[_0xd81b('0x2')]},'destcontext':{'type':Sequelize[_0xd81b('0x2')]},'destexten':{'type':Sequelize[_0xd81b('0x2')]},'destpriority':{'type':Sequelize[_0xd81b('0x3')]},'destuniqueid':{'type':Sequelize[_0xd81b('0x2')]},'destlinkedid':{'type':Sequelize[_0xd81b('0x2')]},'dialstring':{'type':Sequelize[_0xd81b('0x2')]},'dialstatus':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0xd81b('0x4')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xd81b('0x4')]},'lastevent':{'type':Sequelize[_0xd81b('0x2')],'comment':'called,connect,complete'},'routeId':{'type':Sequelize[_0xd81b('0x3')]},'duration':{'type':Sequelize['INTEGER']},'holdtime':{'type':Sequelize[_0xd81b('0x3')]},'billableseconds':{'type':Sequelize[_0xd81b('0x3')]}}; \ No newline at end of file +var _0x00bb=['STRING','INTEGER','DATE','called,connect,complete','sequelize','exports'];(function(_0x445e68,_0x307fa4){var _0x4f0d46=function(_0x4eb5ec){while(--_0x4eb5ec){_0x445e68['push'](_0x445e68['shift']());}};_0x4f0d46(++_0x307fa4);}(_0x00bb,0x1d8));var _0xb00b=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0x00bb[_0x37bd26];return _0xe83dc4;};'use strict';var Sequelize=require(_0xb00b('0x0'));module[_0xb00b('0x1')]={'privilege':{'type':Sequelize[_0xb00b('0x2')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0xb00b('0x3')]},'channelstatedesc':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xb00b('0x2')]},'calleridname':{'type':Sequelize[_0xb00b('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0xb00b('0x2')]},'language':{'type':Sequelize[_0xb00b('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xb00b('0x3')]},'uniqueid':{'type':Sequelize[_0xb00b('0x2')]},'linkedid':{'type':Sequelize[_0xb00b('0x2')]},'destchannel':{'type':Sequelize[_0xb00b('0x2')]},'destchannelstate':{'type':Sequelize[_0xb00b('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0xb00b('0x2')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0xb00b('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xb00b('0x2')]},'destlanguage':{'type':Sequelize[_0xb00b('0x2')]},'destaccountcode':{'type':Sequelize[_0xb00b('0x2')]},'destcontext':{'type':Sequelize[_0xb00b('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0xb00b('0x3')]},'destuniqueid':{'type':Sequelize['STRING']},'destlinkedid':{'type':Sequelize['STRING']},'dialstring':{'type':Sequelize['STRING']},'dialstatus':{'type':Sequelize[_0xb00b('0x2')]},'starttime':{'type':Sequelize[_0xb00b('0x4')]},'answertime':{'type':Sequelize[_0xb00b('0x4')]},'endtime':{'type':Sequelize[_0xb00b('0x4')]},'lastevent':{'type':Sequelize[_0xb00b('0x2')],'comment':_0xb00b('0x5')},'routeId':{'type':Sequelize['INTEGER']},'duration':{'type':Sequelize[_0xb00b('0x3')]},'holdtime':{'type':Sequelize[_0xb00b('0x3')]},'billableseconds':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index 108d2cb..5452e79 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 _0xcf21=['include','find','catch','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','map','VoiceDialReport','rawAttributes','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','sort','pick','filter','where','merge','options','findAll','rows','params','includeAll'];(function(_0x5dc7bb,_0x3c2edc){var _0x3569c3=function(_0x13eb1d){while(--_0x13eb1d){_0x5dc7bb['push'](_0x5dc7bb['shift']());}};_0x3569c3(++_0x3c2edc);}(_0xcf21,0x164));var _0x1cf2=function(_0x4aeb38,_0x3fb7f4){_0x4aeb38=_0x4aeb38-0x0;var _0x5afbe1=_0xcf21[_0x4aeb38];return _0x5afbe1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1cf2('0x0'));var zipdir=require(_0x1cf2('0x1'));var jsonpatch=require(_0x1cf2('0x2'));var rp=require(_0x1cf2('0x3'));var moment=require(_0x1cf2('0x4'));var BPromise=require(_0x1cf2('0x5'));var Mustache=require('mustache');var util=require(_0x1cf2('0x6'));var path=require(_0x1cf2('0x7'));var sox=require(_0x1cf2('0x8'));var csv=require(_0x1cf2('0x9'));var ejs=require(_0x1cf2('0xa'));var fs=require('fs');var fs_extra=require(_0x1cf2('0xb'));var _=require(_0x1cf2('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x1cf2('0xd'));var toCsv=require(_0x1cf2('0x9'));var querystring=require(_0x1cf2('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x1cf2('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x1cf2('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1cf2('0x11'))(_0x1cf2('0x12'));var utils=require(_0x1cf2('0x13'));var config=require(_0x1cf2('0x14'));var licenseUtil=require(_0x1cf2('0x15'));var db=require(_0x1cf2('0x16'))['db'];function respondWithStatusCode(_0x5966ef,_0x4ed042){_0x4ed042=_0x4ed042||0xcc;return function(_0x371a1d){if(_0x371a1d){return _0x5966ef[_0x1cf2('0x17')](_0x4ed042);}return _0x5966ef[_0x1cf2('0x18')](_0x4ed042)[_0x1cf2('0x19')]();};}function respondWithResult(_0x500997,_0x47bea1){_0x47bea1=_0x47bea1||0xc8;return function(_0x47ad5a){if(_0x47ad5a){return _0x500997[_0x1cf2('0x18')](_0x47bea1)['json'](_0x47ad5a);}};}function respondWithFilteredResult(_0x9fcd19,_0x2694c9){return function(_0x4b1283){if(_0x4b1283){var _0x12ce60=typeof _0x2694c9['offset']===_0x1cf2('0x1a')&&typeof _0x2694c9['limit']==='undefined';var _0xe2eb94=_0x4b1283[_0x1cf2('0x1b')];var _0x23fc2d=_0x12ce60?0x0:_0x2694c9[_0x1cf2('0x1c')];var _0x4a5bf4=_0x12ce60?_0x4b1283[_0x1cf2('0x1b')]:_0x2694c9[_0x1cf2('0x1c')]+_0x2694c9[_0x1cf2('0x1d')];var _0x2ac7e8;if(_0x4a5bf4>=_0xe2eb94){_0x4a5bf4=_0xe2eb94;_0x2ac7e8=0xc8;}else{_0x2ac7e8=0xce;}_0x9fcd19[_0x1cf2('0x18')](_0x2ac7e8);return _0x9fcd19['set'](_0x1cf2('0x1e'),_0x23fc2d+'-'+_0x4a5bf4+'/'+_0xe2eb94)['json'](_0x4b1283);}return null;};}function patchUpdates(_0xd37a76){return function(_0x5b04ec){try{jsonpatch[_0x1cf2('0x1f')](_0x5b04ec,_0xd37a76,!![]);}catch(_0xbe0099){return BPromise[_0x1cf2('0x20')](_0xbe0099);}return _0x5b04ec[_0x1cf2('0x21')]();};}function saveUpdates(_0x148cc0,_0x55b8f5){return function(_0xe1a71c){if(_0xe1a71c){return _0xe1a71c[_0x1cf2('0x22')](_0x148cc0)[_0x1cf2('0x23')](function(_0x33815a){return _0x33815a;});}return null;};}function removeEntity(_0x448348,_0x4e5bbc){return function(_0xdb000d){if(_0xdb000d){return _0xdb000d[_0x1cf2('0x24')]()['then'](function(){_0x448348['status'](0xcc)[_0x1cf2('0x19')]();});}};}function handleEntityNotFound(_0x4cdd6e,_0x3a591f){return function(_0x13be47){if(!_0x13be47){_0x4cdd6e['sendStatus'](0x194);}return _0x13be47;};}function handleError(_0x42055d,_0x305c70){_0x305c70=_0x305c70||0x1f4;return function(_0x5e8668){logger[_0x1cf2('0x25')](_0x5e8668[_0x1cf2('0x26')]);if(_0x5e8668['name']){delete _0x5e8668[_0x1cf2('0x27')];}_0x42055d['status'](_0x305c70)['send'](_0x5e8668);};}exports[_0x1cf2('0x28')]=function(_0x80efed,_0x356039){var _0x5ddd8d={},_0x158ab1={},_0x435b6f={'count':0x0,'rows':[]};var _0x2e5ef5=_[_0x1cf2('0x29')](db[_0x1cf2('0x2a')][_0x1cf2('0x2b')],function(_0x5985cf){return{'name':_0x5985cf['fieldName'],'type':_0x5985cf['type'][_0x1cf2('0x2c')]};});_0x158ab1['model']=_[_0x1cf2('0x29')](_0x2e5ef5,_0x1cf2('0x27'));_0x158ab1[_0x1cf2('0x2d')]=_[_0x1cf2('0x2e')](_0x80efed['query']);_0x158ab1[_0x1cf2('0x2f')]=_[_0x1cf2('0x30')](_0x158ab1[_0x1cf2('0x31')],_0x158ab1['query']);_0x5ddd8d[_0x1cf2('0x32')]=_[_0x1cf2('0x30')](_0x158ab1[_0x1cf2('0x31')],qs[_0x1cf2('0x33')](_0x80efed[_0x1cf2('0x2d')][_0x1cf2('0x33')]));_0x5ddd8d[_0x1cf2('0x32')]=_0x5ddd8d[_0x1cf2('0x32')][_0x1cf2('0x34')]?_0x5ddd8d['attributes']:_0x158ab1[_0x1cf2('0x31')];if(!_0x80efed['query']['hasOwnProperty'](_0x1cf2('0x35'))){_0x5ddd8d[_0x1cf2('0x1d')]=qs[_0x1cf2('0x1d')](_0x80efed[_0x1cf2('0x2d')][_0x1cf2('0x1d')]);_0x5ddd8d[_0x1cf2('0x1c')]=qs[_0x1cf2('0x1c')](_0x80efed[_0x1cf2('0x2d')][_0x1cf2('0x1c')]);}_0x5ddd8d['order']=qs[_0x1cf2('0x36')](_0x80efed['query']['sort']);_0x5ddd8d['where']=qs[_0x1cf2('0x2f')](_[_0x1cf2('0x37')](_0x80efed[_0x1cf2('0x2d')],_0x158ab1[_0x1cf2('0x2f')]),_0x2e5ef5);if(_0x80efed['query'][_0x1cf2('0x38')]){_0x5ddd8d[_0x1cf2('0x39')]=_[_0x1cf2('0x3a')](_0x5ddd8d[_0x1cf2('0x39')],{'$or':_['map'](_0x2e5ef5,function(_0x2a91c7){if(_0x2a91c7['type']!=='VIRTUAL'){var _0x337bd4={};_0x337bd4[_0x2a91c7[_0x1cf2('0x27')]]={'$like':'%'+_0x80efed[_0x1cf2('0x2d')]['filter']+'%'};return _0x337bd4;}})});}_0x5ddd8d=_[_0x1cf2('0x3a')]({},_0x5ddd8d,_0x80efed[_0x1cf2('0x3b')]);var _0x1c5182={'where':_0x5ddd8d[_0x1cf2('0x39')]};return db[_0x1cf2('0x2a')]['count'](_0x1c5182)[_0x1cf2('0x23')](function(_0xa99367){_0x435b6f['count']=_0xa99367;if(_0x80efed[_0x1cf2('0x2d')]['includeAll']){_0x5ddd8d['include']=[{'all':!![]}];}return db['VoiceDialReport'][_0x1cf2('0x3c')](_0x5ddd8d);})['then'](function(_0x4b0667){_0x435b6f[_0x1cf2('0x3d')]=_0x4b0667;return _0x435b6f;})[_0x1cf2('0x23')](respondWithFilteredResult(_0x356039,_0x5ddd8d))['catch'](handleError(_0x356039,null));};exports['show']=function(_0x4d937b,_0x19473a){var _0x16e4a3={'raw':!![],'where':{'id':_0x4d937b[_0x1cf2('0x3e')]['id']}},_0x33a72e={};_0x33a72e[_0x1cf2('0x31')]=_['keys'](db[_0x1cf2('0x2a')][_0x1cf2('0x2b')]);_0x33a72e['query']=_[_0x1cf2('0x2e')](_0x4d937b[_0x1cf2('0x2d')]);_0x33a72e[_0x1cf2('0x2f')]=_[_0x1cf2('0x30')](_0x33a72e[_0x1cf2('0x31')],_0x33a72e[_0x1cf2('0x2d')]);_0x16e4a3[_0x1cf2('0x32')]=_[_0x1cf2('0x30')](_0x33a72e[_0x1cf2('0x31')],qs[_0x1cf2('0x33')](_0x4d937b[_0x1cf2('0x2d')][_0x1cf2('0x33')]));_0x16e4a3['attributes']=_0x16e4a3[_0x1cf2('0x32')]['length']?_0x16e4a3[_0x1cf2('0x32')]:_0x33a72e[_0x1cf2('0x31')];if(_0x4d937b['query'][_0x1cf2('0x3f')]){_0x16e4a3[_0x1cf2('0x40')]=[{'all':!![]}];}_0x16e4a3=_['merge']({},_0x16e4a3,_0x4d937b[_0x1cf2('0x3b')]);return db[_0x1cf2('0x2a')][_0x1cf2('0x41')](_0x16e4a3)['then'](handleEntityNotFound(_0x19473a,null))[_0x1cf2('0x23')](respondWithResult(_0x19473a,null))[_0x1cf2('0x42')](handleError(_0x19473a,null));};exports[_0x1cf2('0x43')]=function(_0x5050c6,_0x2da07a){return db[_0x1cf2('0x2a')][_0x1cf2('0x43')](_0x5050c6[_0x1cf2('0x44')],{})[_0x1cf2('0x23')](respondWithResult(_0x2da07a,0xc9))['catch'](handleError(_0x2da07a,null));};exports['update']=function(_0x2888ff,_0x36865f){if(_0x2888ff[_0x1cf2('0x44')]['id']){delete _0x2888ff[_0x1cf2('0x44')]['id'];}return db[_0x1cf2('0x2a')][_0x1cf2('0x41')]({'where':{'id':_0x2888ff[_0x1cf2('0x3e')]['id']}})[_0x1cf2('0x23')](handleEntityNotFound(_0x36865f,null))[_0x1cf2('0x23')](saveUpdates(_0x2888ff[_0x1cf2('0x44')],null))[_0x1cf2('0x23')](respondWithResult(_0x36865f,null))['catch'](handleError(_0x36865f,null));};exports[_0x1cf2('0x24')]=function(_0x38a332,_0x49b58f){return db[_0x1cf2('0x2a')][_0x1cf2('0x41')]({'where':{'id':_0x38a332['params']['id']}})[_0x1cf2('0x23')](handleEntityNotFound(_0x49b58f,null))[_0x1cf2('0x23')](removeEntity(_0x49b58f,null))['catch'](handleError(_0x49b58f,null));};exports['describe']=function(_0x57b257,_0x5c991e){return db[_0x1cf2('0x2a')][_0x1cf2('0x45')]()[_0x1cf2('0x23')](respondWithResult(_0x5c991e,null))[_0x1cf2('0x42')](handleError(_0x5c991e,null));}; \ No newline at end of file +var _0x36e4=['body','find','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','status','offset','limit','count','Content-Range','json','apply','reject','save','update','then','destroy','end','sendStatus','error','stack','name','index','map','VoiceDialReport','rawAttributes','fieldName','type','key','query','keys','filters','attributes','intersection','model','fields','length','order','sort','where','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','show','params','catch','create'];(function(_0x57da0a,_0x284aed){var _0x3145d5=function(_0xfe7c3b){while(--_0xfe7c3b){_0x57da0a['push'](_0x57da0a['shift']());}};_0x3145d5(++_0x284aed);}(_0x36e4,0x12b));var _0x436e=function(_0x4284e2,_0x5483a6){_0x4284e2=_0x4284e2-0x0;var _0x402f5a=_0x36e4[_0x4284e2];return _0x402f5a;};'use strict';var emlformat=require(_0x436e('0x0'));var rimraf=require(_0x436e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x436e('0x2'));var rp=require(_0x436e('0x3'));var moment=require(_0x436e('0x4'));var BPromise=require(_0x436e('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x436e('0x6'));var fs=require('fs');var fs_extra=require(_0x436e('0x7'));var _=require(_0x436e('0x8'));var squel=require(_0x436e('0x9'));var crypto=require(_0x436e('0xa'));var jsforce=require(_0x436e('0xb'));var deskjs=require(_0x436e('0xc'));var toCsv=require(_0x436e('0xd'));var querystring=require(_0x436e('0xe'));var Papa=require(_0x436e('0xf'));var Redis=require('ioredis');var authService=require(_0x436e('0x10'));var qs=require(_0x436e('0x11'));var as=require(_0x436e('0x12'));var hardwareService=require(_0x436e('0x13'));var logger=require('../../config/logger')(_0x436e('0x14'));var utils=require(_0x436e('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x436e('0x16'));var db=require(_0x436e('0x17'))['db'];function respondWithStatusCode(_0x184321,_0x3c154c){_0x3c154c=_0x3c154c||0xcc;return function(_0x5a6037){if(_0x5a6037){return _0x184321['sendStatus'](_0x3c154c);}return _0x184321[_0x436e('0x18')](_0x3c154c)['end']();};}function respondWithResult(_0x5c9537,_0x159046){_0x159046=_0x159046||0xc8;return function(_0x1902ff){if(_0x1902ff){return _0x5c9537[_0x436e('0x18')](_0x159046)['json'](_0x1902ff);}};}function respondWithFilteredResult(_0x5a0108,_0x4b02aa){return function(_0x355baa){if(_0x355baa){var _0x5686c5=typeof _0x4b02aa[_0x436e('0x19')]==='undefined'&&typeof _0x4b02aa[_0x436e('0x1a')]==='undefined';var _0x2ac671=_0x355baa['count'];var _0x2e1e45=_0x5686c5?0x0:_0x4b02aa['offset'];var _0x15fb4b=_0x5686c5?_0x355baa[_0x436e('0x1b')]:_0x4b02aa[_0x436e('0x19')]+_0x4b02aa['limit'];var _0x1a6854;if(_0x15fb4b>=_0x2ac671){_0x15fb4b=_0x2ac671;_0x1a6854=0xc8;}else{_0x1a6854=0xce;}_0x5a0108['status'](_0x1a6854);return _0x5a0108['set'](_0x436e('0x1c'),_0x2e1e45+'-'+_0x15fb4b+'/'+_0x2ac671)[_0x436e('0x1d')](_0x355baa);}return null;};}function patchUpdates(_0x4cc18c){return function(_0x5805fd){try{jsonpatch[_0x436e('0x1e')](_0x5805fd,_0x4cc18c,!![]);}catch(_0x5a5cc0){return BPromise[_0x436e('0x1f')](_0x5a5cc0);}return _0x5805fd[_0x436e('0x20')]();};}function saveUpdates(_0x2fc8cb,_0x12c909){return function(_0xa3d92d){if(_0xa3d92d){return _0xa3d92d[_0x436e('0x21')](_0x2fc8cb)[_0x436e('0x22')](function(_0x55ea9e){return _0x55ea9e;});}return null;};}function removeEntity(_0x5d41fd,_0x3220bc){return function(_0x4e68c2){if(_0x4e68c2){return _0x4e68c2[_0x436e('0x23')]()[_0x436e('0x22')](function(){_0x5d41fd[_0x436e('0x18')](0xcc)[_0x436e('0x24')]();});}};}function handleEntityNotFound(_0x42692c,_0xe7b6de){return function(_0x4c31a5){if(!_0x4c31a5){_0x42692c[_0x436e('0x25')](0x194);}return _0x4c31a5;};}function handleError(_0x306342,_0x58be0b){_0x58be0b=_0x58be0b||0x1f4;return function(_0x4c9a50){logger[_0x436e('0x26')](_0x4c9a50[_0x436e('0x27')]);if(_0x4c9a50['name']){delete _0x4c9a50[_0x436e('0x28')];}_0x306342[_0x436e('0x18')](_0x58be0b)['send'](_0x4c9a50);};}exports[_0x436e('0x29')]=function(_0x1b512b,_0x271202){var _0x1cec7f={},_0x5d4252={},_0x4f6593={'count':0x0,'rows':[]};var _0x34ccfa=_[_0x436e('0x2a')](db[_0x436e('0x2b')][_0x436e('0x2c')],function(_0x3990e1){return{'name':_0x3990e1[_0x436e('0x2d')],'type':_0x3990e1[_0x436e('0x2e')][_0x436e('0x2f')]};});_0x5d4252['model']=_[_0x436e('0x2a')](_0x34ccfa,_0x436e('0x28'));_0x5d4252[_0x436e('0x30')]=_[_0x436e('0x31')](_0x1b512b['query']);_0x5d4252[_0x436e('0x32')]=_['intersection'](_0x5d4252['model'],_0x5d4252['query']);_0x1cec7f[_0x436e('0x33')]=_[_0x436e('0x34')](_0x5d4252[_0x436e('0x35')],qs[_0x436e('0x36')](_0x1b512b[_0x436e('0x30')]['fields']));_0x1cec7f['attributes']=_0x1cec7f['attributes'][_0x436e('0x37')]?_0x1cec7f['attributes']:_0x5d4252[_0x436e('0x35')];if(!_0x1b512b[_0x436e('0x30')]['hasOwnProperty']('nolimit')){_0x1cec7f['limit']=qs[_0x436e('0x1a')](_0x1b512b['query'][_0x436e('0x1a')]);_0x1cec7f[_0x436e('0x19')]=qs[_0x436e('0x19')](_0x1b512b[_0x436e('0x30')][_0x436e('0x19')]);}_0x1cec7f[_0x436e('0x38')]=qs['sort'](_0x1b512b[_0x436e('0x30')][_0x436e('0x39')]);_0x1cec7f[_0x436e('0x3a')]=qs[_0x436e('0x32')](_['pick'](_0x1b512b[_0x436e('0x30')],_0x5d4252[_0x436e('0x32')]),_0x34ccfa);if(_0x1b512b['query']['filter']){_0x1cec7f[_0x436e('0x3a')]=_['merge'](_0x1cec7f[_0x436e('0x3a')],{'$or':_[_0x436e('0x2a')](_0x34ccfa,function(_0xbf59ab){if(_0xbf59ab[_0x436e('0x2e')]!==_0x436e('0x3b')){var _0x2faf5f={};_0x2faf5f[_0xbf59ab[_0x436e('0x28')]]={'$like':'%'+_0x1b512b[_0x436e('0x30')][_0x436e('0x3c')]+'%'};return _0x2faf5f;}})});}_0x1cec7f=_[_0x436e('0x3d')]({},_0x1cec7f,_0x1b512b[_0x436e('0x3e')]);var _0x18b8ba={'where':_0x1cec7f[_0x436e('0x3a')]};return db['VoiceDialReport'][_0x436e('0x1b')](_0x18b8ba)[_0x436e('0x22')](function(_0x126b7d){_0x4f6593[_0x436e('0x1b')]=_0x126b7d;if(_0x1b512b[_0x436e('0x30')][_0x436e('0x3f')]){_0x1cec7f[_0x436e('0x40')]=[{'all':!![]}];}return db[_0x436e('0x2b')][_0x436e('0x41')](_0x1cec7f);})[_0x436e('0x22')](function(_0x2bfc4c){_0x4f6593[_0x436e('0x42')]=_0x2bfc4c;return _0x4f6593;})[_0x436e('0x22')](respondWithFilteredResult(_0x271202,_0x1cec7f))['catch'](handleError(_0x271202,null));};exports[_0x436e('0x43')]=function(_0x8d4298,_0x5e41a1){var _0x3ca8ab={'raw':!![],'where':{'id':_0x8d4298[_0x436e('0x44')]['id']}},_0xd46dcd={};_0xd46dcd['model']=_[_0x436e('0x31')](db[_0x436e('0x2b')][_0x436e('0x2c')]);_0xd46dcd[_0x436e('0x30')]=_['keys'](_0x8d4298[_0x436e('0x30')]);_0xd46dcd[_0x436e('0x32')]=_['intersection'](_0xd46dcd['model'],_0xd46dcd[_0x436e('0x30')]);_0x3ca8ab['attributes']=_[_0x436e('0x34')](_0xd46dcd['model'],qs[_0x436e('0x36')](_0x8d4298['query'][_0x436e('0x36')]));_0x3ca8ab[_0x436e('0x33')]=_0x3ca8ab[_0x436e('0x33')][_0x436e('0x37')]?_0x3ca8ab[_0x436e('0x33')]:_0xd46dcd[_0x436e('0x35')];if(_0x8d4298[_0x436e('0x30')][_0x436e('0x3f')]){_0x3ca8ab[_0x436e('0x40')]=[{'all':!![]}];}_0x3ca8ab=_['merge']({},_0x3ca8ab,_0x8d4298[_0x436e('0x3e')]);return db['VoiceDialReport']['find'](_0x3ca8ab)['then'](handleEntityNotFound(_0x5e41a1,null))[_0x436e('0x22')](respondWithResult(_0x5e41a1,null))[_0x436e('0x45')](handleError(_0x5e41a1,null));};exports[_0x436e('0x46')]=function(_0x383814,_0x4f0cd7){return db['VoiceDialReport'][_0x436e('0x46')](_0x383814[_0x436e('0x47')],{})[_0x436e('0x22')](respondWithResult(_0x4f0cd7,0xc9))['catch'](handleError(_0x4f0cd7,null));};exports[_0x436e('0x21')]=function(_0x1ab872,_0x1dc8f1){if(_0x1ab872[_0x436e('0x47')]['id']){delete _0x1ab872[_0x436e('0x47')]['id'];}return db['VoiceDialReport'][_0x436e('0x48')]({'where':{'id':_0x1ab872[_0x436e('0x44')]['id']}})[_0x436e('0x22')](handleEntityNotFound(_0x1dc8f1,null))['then'](saveUpdates(_0x1ab872[_0x436e('0x47')],null))[_0x436e('0x22')](respondWithResult(_0x1dc8f1,null))[_0x436e('0x45')](handleError(_0x1dc8f1,null));};exports['destroy']=function(_0x217ed2,_0x2dcf6c){return db[_0x436e('0x2b')]['find']({'where':{'id':_0x217ed2['params']['id']}})[_0x436e('0x22')](handleEntityNotFound(_0x2dcf6c,null))[_0x436e('0x22')](removeEntity(_0x2dcf6c,null))['catch'](handleError(_0x2dcf6c,null));};exports[_0x436e('0x49')]=function(_0x1e56da,_0x5abbf1){return db[_0x436e('0x2b')][_0x436e('0x49')]()[_0x436e('0x22')](respondWithResult(_0x5abbf1,null))[_0x436e('0x45')](handleError(_0x5abbf1,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index 5469232..147a681 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 _0x9f82=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceDialReport.attributes','exports','define','uniqueid'];(function(_0x3a2c67,_0x2344c4){var _0x5a2802=function(_0x48c90a){while(--_0x48c90a){_0x3a2c67['push'](_0x3a2c67['shift']());}};_0x5a2802(++_0x2344c4);}(_0x9f82,0x111));var _0x29f8=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x9f82[_0x1035c1];return _0x308d67;};'use strict';var _=require('lodash');var util=require(_0x29f8('0x0'));var logger=require(_0x29f8('0x1'))(_0x29f8('0x2'));var moment=require(_0x29f8('0x3'));var BPromise=require(_0x29f8('0x4'));var rp=require(_0x29f8('0x5'));var fs=require('fs');var path=require(_0x29f8('0x6'));var rimraf=require(_0x29f8('0x7'));var config=require(_0x29f8('0x8'));var attributes=require(_0x29f8('0x9'));module[_0x29f8('0xa')]=function(_0x21686b,_0x40ea65){return _0x21686b[_0x29f8('0xb')]('VoiceDialReport',attributes,{'tableName':'report_dial','paranoid':![],'indexes':[{'fields':[_0x29f8('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8d8c=['bluebird','request-promise','path','rimraf','../../config/environment','define','VoiceDialReport','report_dial','uniqueid','lodash','util','api','moment'];(function(_0x4e26e7,_0xe00e5c){var _0x498d13=function(_0x266154){while(--_0x266154){_0x4e26e7['push'](_0x4e26e7['shift']());}};_0x498d13(++_0xe00e5c);}(_0x8d8c,0x1dd));var _0xc8d8=function(_0xf16b1,_0x33c637){_0xf16b1=_0xf16b1-0x0;var _0x26f94d=_0x8d8c[_0xf16b1];return _0x26f94d;};'use strict';var _=require(_0xc8d8('0x0'));var util=require(_0xc8d8('0x1'));var logger=require('../../config/logger')(_0xc8d8('0x2'));var moment=require(_0xc8d8('0x3'));var BPromise=require(_0xc8d8('0x4'));var rp=require(_0xc8d8('0x5'));var fs=require('fs');var path=require(_0xc8d8('0x6'));var rimraf=require(_0xc8d8('0x7'));var config=require(_0xc8d8('0x8'));var attributes=require('./voiceDialReport.attributes');module['exports']=function(_0x2612a2,_0x506871){return _0x2612a2[_0xc8d8('0x9')](_0xc8d8('0xa'),attributes,{'tableName':_0xc8d8('0xb'),'paranoid':![],'indexes':[{'fields':[_0xc8d8('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index abae6d3..ed05f55 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 _0x111f=['where','attributes','limit','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','CreateVoiceDialReport','VoiceDialReport','create','options','then','debug','catch','UpdateVoiceDialReport','raw'];(function(_0x48eac3,_0x155b55){var _0x34e336=function(_0x11ae4b){while(--_0x11ae4b){_0x48eac3['push'](_0x48eac3['shift']());}};_0x34e336(++_0x155b55);}(_0x111f,0x158));var _0xf111=function(_0xa13622,_0x5987d5){_0xa13622=_0xa13622-0x0;var _0x5289f8=_0x111f[_0xa13622];return _0x5289f8;};'use strict';var _=require(_0xf111('0x0'));var util=require(_0xf111('0x1'));var moment=require(_0xf111('0x2'));var BPromise=require('bluebird');var rs=require(_0xf111('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf111('0x4'))['db'];var utils=require(_0xf111('0x5'));var logger=require(_0xf111('0x6'))('rpc');var config=require(_0xf111('0x7'));var jayson=require(_0xf111('0x8'));var client=jayson[_0xf111('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x34336c,_0x1ce807,_0x396138){return new BPromise(function(_0x57cdb9,_0x212da0){return client[_0xf111('0xa')](_0x34336c,_0x396138)['then'](function(_0xd55987){logger[_0xf111('0xb')](_0xf111('0xc'),_0x1ce807,_0xf111('0xd'));logger['debug'](_0xf111('0xe'),_0x1ce807,_0xf111('0xd'),JSON[_0xf111('0xf')](_0xd55987));if(_0xd55987[_0xf111('0x10')]){if(_0xd55987[_0xf111('0x10')][_0xf111('0x11')]===0x1f4){logger[_0xf111('0x10')](_0xf111('0xc'),_0x1ce807,_0xd55987[_0xf111('0x10')][_0xf111('0x12')]);return _0x212da0(_0xd55987[_0xf111('0x10')][_0xf111('0x12')]);}logger[_0xf111('0x10')](_0xf111('0xc'),_0x1ce807,_0xd55987[_0xf111('0x10')]['message']);return _0x57cdb9(_0xd55987[_0xf111('0x10')][_0xf111('0x12')]);}else{logger[_0xf111('0xb')](_0xf111('0xc'),_0x1ce807,_0xf111('0xd'));_0x57cdb9(_0xd55987['result'][_0xf111('0x12')]);}})['catch'](function(_0x4e2a4e){logger[_0xf111('0x10')](_0xf111('0xc'),_0x1ce807,_0x4e2a4e);_0x212da0(_0x4e2a4e);});});}exports[_0xf111('0x13')]=function(_0xb11cf7){var _0xdc1a95=this;return new Promise(function(_0x36eed7,_0x53a127){return db[_0xf111('0x14')][_0xf111('0x15')](_0xb11cf7['body'],{'raw':_0xb11cf7[_0xf111('0x16')]?_0xb11cf7[_0xf111('0x16')]['raw']===undefined?!![]:![]:!![]})[_0xf111('0x17')](function(_0x4199cc){logger[_0xf111('0xb')]('CreateVoiceDialReport',_0xb11cf7);logger[_0xf111('0x18')](_0xf111('0x13'),_0xb11cf7,JSON[_0xf111('0xf')](_0x4199cc));_0x36eed7(_0x4199cc);})[_0xf111('0x19')](function(_0x987674){logger[_0xf111('0x10')](_0xf111('0x13'),_0x987674[_0xf111('0x12')],_0xb11cf7);_0x53a127(_0xdc1a95[_0xf111('0x10')](0x1f4,_0x987674[_0xf111('0x12')]));});});};exports[_0xf111('0x1a')]=function(_0x590a4f){var _0x6ff5d8=this;return new Promise(function(_0x5a8e8f,_0x2ed0c2){return db[_0xf111('0x14')]['update'](_0x590a4f['body'],{'raw':_0x590a4f['options']?_0x590a4f['options'][_0xf111('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x590a4f[_0xf111('0x16')]?_0x590a4f[_0xf111('0x16')][_0xf111('0x1c')]||null:null,'attributes':_0x590a4f[_0xf111('0x16')]?_0x590a4f['options'][_0xf111('0x1d')]||null:null,'limit':_0x590a4f['options']?_0x590a4f[_0xf111('0x16')][_0xf111('0x1e')]||null:null})['then'](function(_0x781026){logger[_0xf111('0xb')](_0xf111('0x1a'),_0x590a4f);logger[_0xf111('0x18')](_0xf111('0x1a'),_0x590a4f,JSON[_0xf111('0xf')](_0x781026));_0x5a8e8f(_0x781026);})[_0xf111('0x19')](function(_0x45a742){logger[_0xf111('0x10')](_0xf111('0x1a'),_0x45a742[_0xf111('0x12')],_0x590a4f);_0x2ed0c2(_0x6ff5d8['error'](0x1f4,_0x45a742[_0xf111('0x12')]));});});}; \ No newline at end of file +var _0xa7ac=['VoiceDialReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateVoiceDialReport','create','body','options','raw','debug','UpdateVoiceDialReport','update','where','stringify','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent'];(function(_0x2cfc23,_0x5618ca){var _0x300a52=function(_0x38636c){while(--_0x38636c){_0x2cfc23['push'](_0x2cfc23['shift']());}};_0x300a52(++_0x5618ca);}(_0xa7ac,0xf7));var _0xca7a=function(_0x4a2369,_0x2ba8c4){_0x4a2369=_0x4a2369-0x0;var _0x39f063=_0xa7ac[_0x4a2369];return _0x39f063;};'use strict';var _=require(_0xca7a('0x0'));var util=require(_0xca7a('0x1'));var moment=require('moment');var BPromise=require(_0xca7a('0x2'));var rs=require(_0xca7a('0x3'));var fs=require('fs');var Redis=require(_0xca7a('0x4'));var db=require(_0xca7a('0x5'))['db'];var utils=require(_0xca7a('0x6'));var logger=require('../../config/logger')(_0xca7a('0x7'));var config=require(_0xca7a('0x8'));var jayson=require(_0xca7a('0x9'));var client=jayson[_0xca7a('0xa')][_0xca7a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3db735,_0x514dfc,_0x550945){return new BPromise(function(_0x2bc954,_0x1d7c0e){return client[_0xca7a('0xc')](_0x3db735,_0x550945)[_0xca7a('0xd')](function(_0x2a7422){logger[_0xca7a('0xe')](_0xca7a('0xf'),_0x514dfc,_0xca7a('0x10'));logger['debug'](_0xca7a('0x11'),_0x514dfc,_0xca7a('0x10'),JSON['stringify'](_0x2a7422));if(_0x2a7422['error']){if(_0x2a7422[_0xca7a('0x12')][_0xca7a('0x13')]===0x1f4){logger['error'](_0xca7a('0xf'),_0x514dfc,_0x2a7422['error'][_0xca7a('0x14')]);return _0x1d7c0e(_0x2a7422[_0xca7a('0x12')][_0xca7a('0x14')]);}logger['error'](_0xca7a('0xf'),_0x514dfc,_0x2a7422[_0xca7a('0x12')]['message']);return _0x2bc954(_0x2a7422[_0xca7a('0x12')][_0xca7a('0x14')]);}else{logger['info']('VoiceDialReport,\x20%s,\x20%s',_0x514dfc,_0xca7a('0x10'));_0x2bc954(_0x2a7422[_0xca7a('0x15')][_0xca7a('0x14')]);}})[_0xca7a('0x16')](function(_0x480a45){logger[_0xca7a('0x12')]('VoiceDialReport,\x20%s,\x20%s',_0x514dfc,_0x480a45);_0x1d7c0e(_0x480a45);});});}exports[_0xca7a('0x17')]=function(_0x3eed4b){var _0x28cffe=this;return new Promise(function(_0x1503ba,_0x44e72b){return db['VoiceDialReport'][_0xca7a('0x18')](_0x3eed4b[_0xca7a('0x19')],{'raw':_0x3eed4b[_0xca7a('0x1a')]?_0x3eed4b[_0xca7a('0x1a')][_0xca7a('0x1b')]===undefined?!![]:![]:!![]})[_0xca7a('0xd')](function(_0x569391){logger['info'](_0xca7a('0x17'),_0x3eed4b);logger[_0xca7a('0x1c')](_0xca7a('0x17'),_0x3eed4b,JSON['stringify'](_0x569391));_0x1503ba(_0x569391);})[_0xca7a('0x16')](function(_0x531328){logger[_0xca7a('0x12')](_0xca7a('0x17'),_0x531328[_0xca7a('0x14')],_0x3eed4b);_0x44e72b(_0x28cffe[_0xca7a('0x12')](0x1f4,_0x531328[_0xca7a('0x14')]));});});};exports[_0xca7a('0x1d')]=function(_0x32769a){var _0x17d53f=this;return new Promise(function(_0x259ac8,_0x5829b5){return db['VoiceDialReport'][_0xca7a('0x1e')](_0x32769a['body'],{'raw':_0x32769a[_0xca7a('0x1a')]?_0x32769a[_0xca7a('0x1a')][_0xca7a('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x32769a[_0xca7a('0x1a')]?_0x32769a[_0xca7a('0x1a')][_0xca7a('0x1f')]||null:null,'attributes':_0x32769a['options']?_0x32769a[_0xca7a('0x1a')]['attributes']||null:null,'limit':_0x32769a[_0xca7a('0x1a')]?_0x32769a['options']['limit']||null:null})[_0xca7a('0xd')](function(_0x631402){logger[_0xca7a('0xe')](_0xca7a('0x1d'),_0x32769a);logger[_0xca7a('0x1c')]('UpdateVoiceDialReport',_0x32769a,JSON[_0xca7a('0x20')](_0x631402));_0x259ac8(_0x631402);})[_0xca7a('0x16')](function(_0x4dcc01){logger[_0xca7a('0x12')](_0xca7a('0x1d'),_0x4dcc01['message'],_0x32769a);_0x5829b5(_0x17d53f[_0xca7a('0x12')](0x1f4,_0x4dcc01['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index c6d6225..60bab81 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 _0x0859=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./voiceExtension.controller','get','isAuthenticated','index','/:id','post','create','addApplications','delete'];(function(_0x1404e7,_0xeaca8f){var _0xcf15fd=function(_0x41f051){while(--_0x41f051){_0x1404e7['push'](_0x1404e7['shift']());}};_0xcf15fd(++_0xeaca8f);}(_0x0859,0xcc));var _0x9085=function(_0x4764ae,_0xf88201){_0x4764ae=_0x4764ae-0x0;var _0x5e3716=_0x0859[_0x4764ae];return _0x5e3716;};'use strict';var multer=require(_0x9085('0x0'));var util=require(_0x9085('0x1'));var path=require(_0x9085('0x2'));var timeout=require(_0x9085('0x3'));var express=require(_0x9085('0x4'));var router=express[_0x9085('0x5')]();var fs_extra=require(_0x9085('0x6'));var auth=require(_0x9085('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x9085('0x8'));router[_0x9085('0x9')]('/',auth[_0x9085('0xa')](),controller[_0x9085('0xb')]);router[_0x9085('0x9')](_0x9085('0xc'),auth[_0x9085('0xa')](),controller['show']);router[_0x9085('0xd')]('/',auth[_0x9085('0xa')](),controller[_0x9085('0xe')]);router[_0x9085('0xd')]('/:id/applications',auth['isAuthenticated'](),controller[_0x9085('0xf')]);router['put'](_0x9085('0xc'),auth[_0x9085('0xa')](),controller['update']);router[_0x9085('0x10')](_0x9085('0xc'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x8fc0=['./voiceExtension.controller','get','isAuthenticated','index','/:id','show','post','/:id/applications','addApplications','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../config/environment'];(function(_0xb60674,_0xa4e08a){var _0x2514a0=function(_0x5bfc26){while(--_0x5bfc26){_0xb60674['push'](_0xb60674['shift']());}};_0x2514a0(++_0xa4e08a);}(_0x8fc0,0xe0));var _0x08fc=function(_0x49b207,_0x408ade){_0x49b207=_0x49b207-0x0;var _0x2dc8fa=_0x8fc0[_0x49b207];return _0x2dc8fa;};'use strict';var multer=require(_0x08fc('0x0'));var util=require(_0x08fc('0x1'));var path=require(_0x08fc('0x2'));var timeout=require(_0x08fc('0x3'));var express=require(_0x08fc('0x4'));var router=express['Router']();var fs_extra=require(_0x08fc('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x08fc('0x6'));var controller=require(_0x08fc('0x7'));router[_0x08fc('0x8')]('/',auth[_0x08fc('0x9')](),controller[_0x08fc('0xa')]);router['get'](_0x08fc('0xb'),auth['isAuthenticated'](),controller[_0x08fc('0xc')]);router[_0x08fc('0xd')]('/',auth[_0x08fc('0x9')](),controller['create']);router[_0x08fc('0xd')](_0x08fc('0xe'),auth[_0x08fc('0x9')](),controller[_0x08fc('0xf')]);router[_0x08fc('0x10')]('/:id',auth[_0x08fc('0x9')](),controller[_0x08fc('0x11')]);router[_0x08fc('0x12')]('/:id',auth[_0x08fc('0x9')](),controller[_0x08fc('0x13')]);module[_0x08fc('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index 3ae40a3..36edd95 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 _0x9a8f=['system','any','*,*,*,*','INTEGER','BOOLEAN','wav','VIRTUAL','getDataValue','exten','compositeIndex','STRING','NoOp','outbound','internal','outbound-fax'];(function(_0x3bebd7,_0x4a9457){var _0x235bc6=function(_0x425e33){while(--_0x425e33){_0x3bebd7['push'](_0x3bebd7['shift']());}};_0x235bc6(++_0x4a9457);}(_0x9a8f,0x135));var _0xf9a8=function(_0x3236ec,_0x404929){_0x3236ec=_0x3236ec-0x0;var _0x147a6a=_0x9a8f[_0x3236ec];return _0x147a6a;};'use strict';var Sequelize=require('sequelize');module['exports']={'context':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xf9a8('0x0'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize['STRING'],'allowNull':![],'unique':'compositeIndex'},'priority':{'type':Sequelize[_0xf9a8('0x1')],'allowNull':![],'defaultValue':'1','unique':'compositeIndex'},'tag':{'type':Sequelize[_0xf9a8('0x1')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0xf9a8('0x1')],'allowNull':![],'defaultValue':_0xf9a8('0x2')},'appdata':{'type':Sequelize[_0xf9a8('0x1')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize['ENUM']('inbound',_0xf9a8('0x3'),_0xf9a8('0x4'),'inbound-fax',_0xf9a8('0x5'),_0xf9a8('0x6'),_0xf9a8('0x7')),'allowNull':![]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xf9a8('0x1')],'allowNull':![],'defaultValue':_0xf9a8('0x8')},'IntervalId':{'type':Sequelize[_0xf9a8('0x9')]},'isApp':{'type':Sequelize[_0xf9a8('0xa')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0xf9a8('0x1')],'defaultValue':null},'callerID':{'type':Sequelize[_0xf9a8('0x1')],'allowNull':!![]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0xf9a8('0x9')]},'recordingFormat':{'type':Sequelize[_0xf9a8('0x1')],'defaultValue':_0xf9a8('0xb')},'answer':{'type':Sequelize[_0xf9a8('0xa')],'defaultValue':!![]},'name':{'type':Sequelize[_0xf9a8('0xc')],'get':function(_0x5ceed2){return this[_0xf9a8('0xd')](_0xf9a8('0xe'));}},'alias':{'type':Sequelize[_0xf9a8('0x1')],'allowNull':!![]}}; \ No newline at end of file +var _0xeaaa=['*,*,*,*','INTEGER','BOOLEAN','VIRTUAL','getDataValue','exten','sequelize','exports','STRING','compositeIndex','NoOp','ENUM','inbound','outbound','inbound-fax','outbound-fax','system'];(function(_0x1f1c94,_0x356c81){var _0x1b4b9c=function(_0x38f7ff){while(--_0x38f7ff){_0x1f1c94['push'](_0x1f1c94['shift']());}};_0x1b4b9c(++_0x356c81);}(_0xeaaa,0x6c));var _0xaeaa=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xeaaa[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require(_0xaeaa('0x0'));module[_0xaeaa('0x1')]={'context':{'type':Sequelize[_0xaeaa('0x2')],'allowNull':![],'unique':_0xaeaa('0x3'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0xaeaa('0x2')],'allowNull':![],'unique':_0xaeaa('0x3')},'priority':{'type':Sequelize[_0xaeaa('0x2')],'allowNull':![],'defaultValue':'1','unique':_0xaeaa('0x3')},'tag':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0xaeaa('0x2')],'allowNull':![],'defaultValue':_0xaeaa('0x4')},'appdata':{'type':Sequelize['STRING'](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0xaeaa('0x5')](_0xaeaa('0x6'),_0xaeaa('0x7'),'internal',_0xaeaa('0x8'),_0xaeaa('0x9'),_0xaeaa('0xa'),'any'),'allowNull':![]},'description':{'type':Sequelize[_0xaeaa('0x2')]},'interval':{'type':Sequelize[_0xaeaa('0x2')],'allowNull':![],'defaultValue':_0xaeaa('0xb')},'IntervalId':{'type':Sequelize[_0xaeaa('0xc')]},'isApp':{'type':Sequelize[_0xaeaa('0xd')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize['STRING'],'defaultValue':null},'callerID':{'type':Sequelize[_0xaeaa('0x2')],'allowNull':!![]},'record':{'type':Sequelize[_0xaeaa('0xd')],'defaultValue':![]},'cutdigits':{'type':Sequelize['INTEGER']},'recordingFormat':{'type':Sequelize[_0xaeaa('0x2')],'defaultValue':'wav'},'answer':{'type':Sequelize[_0xaeaa('0xd')],'defaultValue':!![]},'name':{'type':Sequelize[_0xaeaa('0xe')],'get':function(_0x325685){return this[_0xaeaa('0xf')](_0xaeaa('0x10'));}},'alias':{'type':Sequelize[_0xaeaa('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 df2ed4a..9fbdf7d 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 _0x1348=['startsWith','body','exten','concat','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','InboundRoutes','internal','UserProfileSection','userProfileId','autoAssociation','update','context','description','cutdigits','mandatoryDisposition','alias','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findOne','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','finally','lodash','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','defaults','localhost','./voiceExtension.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','destroy','then','get','inbound','outbound','filter','ignore','map','value','includes','type','name','UserProfileResource','error','stack','send','index','VoiceExtension','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','includeAll','include','findAll','show','find','params','catch','create'];(function(_0x15c481,_0x3a8d02){var _0x2fac0c=function(_0x17c598){while(--_0x17c598){_0x15c481['push'](_0x15c481['shift']());}};_0x2fac0c(++_0x3a8d02);}(_0x1348,0xd4));var _0x8134=function(_0x457d6d,_0x5b0b53){_0x457d6d=_0x457d6d-0x0;var _0x3e388d=_0x1348[_0x457d6d];return _0x3e388d;};'use strict';var _=require(_0x8134('0x0'));var Redis=require(_0x8134('0x1'));var qs=require('../../components/parsers/qs');var logger=require(_0x8134('0x2'))(_0x8134('0x3'));var config=require(_0x8134('0x4'));var db=require(_0x8134('0x5'))['db'];config['redis']=_[_0x8134('0x6')](config['redis'],{'host':_0x8134('0x7'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x8134('0x8'))[_0x8134('0x9')](socket);function respondWithStatusCode(_0x3e0ed3,_0x48e3d2){_0x48e3d2=_0x48e3d2||0xcc;return function(_0x5a2c6d){if(_0x5a2c6d){return _0x3e0ed3[_0x8134('0xa')](_0x48e3d2);}return _0x3e0ed3[_0x8134('0xb')](_0x48e3d2)[_0x8134('0xc')]();};}function respondWithResult(_0x2e8ec3,_0x46b4d3){_0x46b4d3=_0x46b4d3||0xc8;return function(_0x4f3c39){if(_0x4f3c39){return _0x2e8ec3[_0x8134('0xb')](_0x46b4d3)[_0x8134('0xd')](_0x4f3c39);}};}function respondWithFilteredResult(_0xf05c13,_0x2a0bf9){return function(_0x131466){if(_0x131466){var _0x471186=typeof _0x2a0bf9[_0x8134('0xe')]===_0x8134('0xf')&&typeof _0x2a0bf9[_0x8134('0x10')]===_0x8134('0xf');var _0x53114f=_0x131466['count'];var _0x581f5b=_0x471186?0x0:_0x2a0bf9['offset'];var _0x41208e=_0x471186?_0x131466[_0x8134('0x11')]:_0x2a0bf9[_0x8134('0xe')]+_0x2a0bf9[_0x8134('0x10')];var _0x25f842;if(_0x41208e>=_0x53114f){_0x41208e=_0x53114f;_0x25f842=0xc8;}else{_0x25f842=0xce;}_0xf05c13[_0x8134('0xb')](_0x25f842);return _0xf05c13[_0x8134('0x12')]('Content-Range',_0x581f5b+'-'+_0x41208e+'/'+_0x53114f)[_0x8134('0xd')](_0x131466);}return null;};}function removeEntity(_0x424ee7){return function(_0x4f8bc4){if(_0x4f8bc4){return _0x4f8bc4[_0x8134('0x13')]()[_0x8134('0x14')](function(){var _0x31c500=_0x4f8bc4[_0x8134('0x15')]({'plain':!![]});var _0xd63861=[{'name':'InboundRoutes','value':_0x8134('0x16'),'ignore':![]},{'name':'OutboundRoutes','value':_0x8134('0x17'),'ignore':![]},{'name':'InternalRoutes','value':'internal','ignore':![]}];var _0x17a310=_(_0xd63861)[_0x8134('0x18')](_0x8134('0x19'))[_0x8134('0x1a')](_0x8134('0x1b'))['value']();if(_[_0x8134('0x1c')](_0x17a310,_0x31c500['type'])){return;}var _0x12c346=_['find'](_0xd63861,[_0x8134('0x1b'),_0x31c500[_0x8134('0x1d')]])[_0x8134('0x1e')];return db[_0x8134('0x1f')][_0x8134('0x13')]({'where':{'type':_0x12c346,'resourceId':_0x31c500['id']}})[_0x8134('0x14')](function(){return _0x4f8bc4;});})[_0x8134('0x14')](function(){_0x424ee7[_0x8134('0xb')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4e352a){return function(_0x17c10b){if(!_0x17c10b){_0x4e352a[_0x8134('0xa')](0x194);}return _0x17c10b;};}function handleError(_0x24a7da,_0xd2a013){_0xd2a013=_0xd2a013||0x1f4;return function(_0x1c3128){logger[_0x8134('0x20')](_0x1c3128[_0x8134('0x21')]);if(_0x1c3128[_0x8134('0x1e')]){delete _0x1c3128[_0x8134('0x1e')];}_0x24a7da[_0x8134('0xb')](_0xd2a013)[_0x8134('0x22')](_0x1c3128);};}exports[_0x8134('0x23')]=function(_0x2f0a26,_0x573bb3){var _0x229cc3={},_0x4c7570={},_0x4963dd={'count':0x0,'rows':[]};var _0x1cc67a=_[_0x8134('0x1a')](db[_0x8134('0x24')][_0x8134('0x25')],function(_0x4c75df){return{'name':_0x4c75df[_0x8134('0x26')],'type':_0x4c75df[_0x8134('0x1d')][_0x8134('0x27')]};});_0x4c7570[_0x8134('0x28')]=_[_0x8134('0x1a')](_0x1cc67a,_0x8134('0x1e'));_0x4c7570[_0x8134('0x29')]=_[_0x8134('0x2a')](_0x2f0a26[_0x8134('0x29')]);_0x4c7570[_0x8134('0x2b')]=_[_0x8134('0x2c')](_0x4c7570[_0x8134('0x28')],_0x4c7570[_0x8134('0x29')]);_0x229cc3['attributes']=_[_0x8134('0x2c')](_0x4c7570[_0x8134('0x28')],qs[_0x8134('0x2d')](_0x2f0a26[_0x8134('0x29')][_0x8134('0x2d')]));_0x229cc3['attributes']=_0x229cc3[_0x8134('0x2e')][_0x8134('0x2f')]?_0x229cc3[_0x8134('0x2e')]:_0x4c7570[_0x8134('0x28')];if(!_0x2f0a26[_0x8134('0x29')][_0x8134('0x30')](_0x8134('0x31'))){_0x229cc3[_0x8134('0x10')]=qs[_0x8134('0x10')](_0x2f0a26[_0x8134('0x29')]['limit']);_0x229cc3[_0x8134('0xe')]=qs[_0x8134('0xe')](_0x2f0a26['query'][_0x8134('0xe')]);}_0x229cc3[_0x8134('0x32')]=qs[_0x8134('0x33')](_0x2f0a26[_0x8134('0x29')][_0x8134('0x33')]);_0x229cc3[_0x8134('0x34')]=qs['filters'](_[_0x8134('0x35')](_0x2f0a26[_0x8134('0x29')],_0x4c7570['filters']),_0x1cc67a);if(_0x2f0a26[_0x8134('0x29')]['filter']){_0x229cc3[_0x8134('0x34')]=_[_0x8134('0x36')](_0x229cc3[_0x8134('0x34')],{'$or':_[_0x8134('0x1a')](_0x1cc67a,function(_0x122c66){if(_0x122c66['type']!==_0x8134('0x37')){var _0x4d9f5d={};_0x4d9f5d[_0x122c66[_0x8134('0x1e')]]={'$like':'%'+_0x2f0a26['query']['filter']+'%'};return _0x4d9f5d;}})});}_0x229cc3=_[_0x8134('0x36')]({},_0x229cc3,_0x2f0a26['options']);var _0xf16fc7={'where':_0x229cc3['where']};return db[_0x8134('0x24')]['count'](_0xf16fc7)[_0x8134('0x14')](function(_0x4c0c62){_0x4963dd[_0x8134('0x11')]=_0x4c0c62;if(_0x2f0a26[_0x8134('0x29')][_0x8134('0x38')]){_0x229cc3[_0x8134('0x39')]=[{'all':!![]}];}return db[_0x8134('0x24')][_0x8134('0x3a')](_0x229cc3);})['then'](function(_0x772d0e){_0x4963dd['rows']=_0x772d0e;return _0x4963dd;})[_0x8134('0x14')](respondWithFilteredResult(_0x573bb3,_0x229cc3))['catch'](handleError(_0x573bb3,null));};exports[_0x8134('0x3b')]=function(_0x3375fb,_0x5dd328){var _0x156d35={'raw':![],'where':{'id':_0x3375fb['params']['id']}},_0x320c70={};_0x320c70['model']=_['keys'](db[_0x8134('0x24')][_0x8134('0x25')]);_0x320c70['query']=_[_0x8134('0x2a')](_0x3375fb[_0x8134('0x29')]);_0x320c70['filters']=_['intersection'](_0x320c70[_0x8134('0x28')],_0x320c70[_0x8134('0x29')]);_0x156d35['attributes']=_[_0x8134('0x2c')](_0x320c70[_0x8134('0x28')],qs[_0x8134('0x2d')](_0x3375fb[_0x8134('0x29')]['fields']));_0x156d35[_0x8134('0x2e')]=_0x156d35['attributes'][_0x8134('0x2f')]?_0x156d35['attributes']:_0x320c70[_0x8134('0x28')];if(_0x3375fb['query'][_0x8134('0x38')]){_0x156d35[_0x8134('0x39')]=[{'all':!![]}];}_0x156d35=_['merge']({},_0x156d35,_0x3375fb['options']);return db[_0x8134('0x24')][_0x8134('0x3c')](_0x156d35)[_0x8134('0x14')](handleEntityNotFound(_0x5dd328,null))[_0x8134('0x14')](respondWithResult(_0x5dd328,null))['catch'](handleError(_0x5dd328,null));};exports[_0x8134('0x13')]=function(_0x4d971f,_0x532d94){return db[_0x8134('0x24')]['find']({'where':{'id':_0x4d971f[_0x8134('0x3d')]['id']}})[_0x8134('0x14')](handleEntityNotFound(_0x532d94,null))['then'](removeEntity(_0x532d94,null))[_0x8134('0x3e')](handleError(_0x532d94,null));};exports[_0x8134('0x3f')]=function(_0x4b62d2,_0x3bced1){if(_0x4b62d2['body']['type']==='outbound'&&!_[_0x8134('0x40')](_0x4b62d2[_0x8134('0x41')]['exten'],'_')){_0x4b62d2['body'][_0x8134('0x42')]='_'[_0x8134('0x43')](_0x4b62d2[_0x8134('0x41')]['exten']);}return db[_0x8134('0x24')][_0x8134('0x3f')](_0x4b62d2[_0x8134('0x41')],{'raw':![]})[_0x8134('0x14')](function(_0x245045){var _0x359670=_0x4b62d2[_0x8134('0x44')][_0x8134('0x15')]({'plain':!![]});if(!_0x359670)throw new Error(_0x8134('0x45'));if(_0x359670[_0x8134('0x46')]===_0x8134('0x44')){var _0x28acc9=_0x245045[_0x8134('0x15')]({'plain':!![]});var _0x4b8f66=[{'name':_0x8134('0x47'),'value':_0x8134('0x16')},{'name':'OutboundRoutes','value':'outbound'},{'name':'InternalRoutes','value':_0x8134('0x48')}];var _0x103e93=_['find'](_0x4b8f66,['value',_0x28acc9[_0x8134('0x1d')]])['name'];return db[_0x8134('0x49')]['find']({'where':{'name':_0x103e93,'userProfileId':_0x359670[_0x8134('0x4a')]},'raw':!![]})['then'](function(_0x98e499){if(_0x98e499&&_0x98e499[_0x8134('0x4b')]===0x0){return db[_0x8134('0x1f')]['create']({'name':_0x28acc9[_0x8134('0x1e')],'resourceId':_0x28acc9['id'],'type':_0x98e499[_0x8134('0x1e')],'sectionId':_0x98e499['id']},{})[_0x8134('0x14')](function(){return _0x245045;});}else{return _0x245045;}})[_0x8134('0x3e')](function(_0x5973f2){logger[_0x8134('0x20')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5973f2);throw _0x5973f2;});}return _0x245045;})['then'](respondWithResult(_0x3bced1,0xc9))[_0x8134('0x3e')](handleError(_0x3bced1,null));};exports[_0x8134('0x4c')]=function(_0x350837,_0x1029e2){if(_0x350837[_0x8134('0x41')]['id']){delete _0x350837['body']['id'];}return db[_0x8134('0x24')][_0x8134('0x3c')]({'where':{'id':_0x350837['params']['id']}})[_0x8134('0x14')](handleEntityNotFound(_0x1029e2,null))[_0x8134('0x14')](function(_0x3110a1){if(_0x3110a1){return db['VoiceExtension'][_0x8134('0x4c')](_[_0x8134('0x35')](_0x350837[_0x8134('0x41')],[_0x8134('0x42'),_0x8134('0x4d'),_0x8134('0x4e'),'recordingFormat',_0x8134('0x4f'),_0x8134('0x50'),_0x8134('0x51')]),{'where':{'context':_0x3110a1[_0x8134('0x4d')],'exten':_0x3110a1[_0x8134('0x42')]},'individualHooks':!![]})[_0x8134('0x14')](function(_0x42efee){return _0x42efee;});}return null;})[_0x8134('0x14')](respondWithStatusCode(_0x1029e2,null))[_0x8134('0x3e')](handleError(_0x1029e2,null));};exports['addApplications']=function(_0x552bab,_0x2a4067){var _0x39bb02=_0x552bab[_0x8134('0x3d')]['id'];var _0x4515ed=_0x552bab[_0x8134('0x41')];var _0x1428b8=0xc8;var _0x1f006d=null;return db[_0x8134('0x52')][_0x8134('0x53')]({'isolationLevel':db[_0x8134('0x52')][_0x8134('0x54')][_0x8134('0x55')][_0x8134('0x56')]},function(_0x55ff64){return db['VoiceExtension'][_0x8134('0x57')]({'where':{'id':_0x39bb02},'transaction':_0x55ff64})[_0x8134('0x14')](function(_0x9ebaa4){if(_0x9ebaa4){return db[_0x8134('0x24')][_0x8134('0x13')]({'where':{'VoiceExtensionId':_0x39bb02},'transaction':_0x55ff64})[_0x8134('0x14')](function(){var _0x358680=_['map'](_0x4515ed,function(_0x30c157){_0x30c157['VoiceExtensionId']=_0x39bb02;_0x30c157['isApp']=!![];return _0x30c157;});return _0x9ebaa4['createRouting'](_0x358680);})[_0x8134('0x14')](function(_0x3208ae){return db['VoiceExtension'][_0x8134('0x58')](_0x3208ae,{'transaction':_0x55ff64});});}else{_0x1428b8=0x194;_0x1f006d=[];}});})['then'](function(){if(_0x1428b8!==0x194){return db['VoiceExtension'][_0x8134('0x59')]({'where':{'isApp':!![],'VoiceExtensionId':_0x39bb02},'order':_0x8134('0x5a')})['then'](function(_0x20f259){_0x1f006d=_0x20f259;});}})[_0x8134('0x3e')](function(_0x41c7d0){_0x1428b8=0x1f4;logger[_0x8134('0x20')](_0x41c7d0[_0x8134('0x21')]);if(_0x41c7d0[_0x8134('0x1e')]){delete _0x41c7d0[_0x8134('0x1e')];}_0x1f006d=_0x41c7d0;})[_0x8134('0x5b')](function(){if(_0x1f006d===null){_0x2a4067[_0x8134('0xa')](_0x1428b8);}else{if(_0x1428b8===0x1f4){_0x2a4067['status'](_0x1428b8)[_0x8134('0x22')](_0x1f006d);}else{_0x2a4067[_0x8134('0xb')](_0x1428b8)[_0x8134('0xd')](_0x1f006d);}}});}; \ No newline at end of file +var _0xe50d=['InboundRoutes','inbound','OutboundRoutes','InternalRoutes','internal','ignore','value','find','type','name','then','error','send','map','VoiceExtension','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','filter','merge','VIRTUAL','options','includeAll','rows','show','catch','params','create','outbound','startsWith','body','exten','concat','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','pick','context','recordingFormat','cutdigits','mandatoryDisposition','alias','addApplications','transaction','sequelize','ISOLATION_LEVELS','READ_COMMITTED','VoiceExtensionId','findAndCountAll','cast(priority\x20as\x20unsigned)','finally','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','defaults','localhost','./voiceExtension.socket','register','sendStatus','status','end','json','limit','count','Content-Range','destroy'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xe50d,0xfb));var _0xde50=function(_0x54029c,_0x47e016){_0x54029c=_0x54029c-0x0;var _0x5765ea=_0xe50d[_0x54029c];return _0x5765ea;};'use strict';var _=require(_0xde50('0x0'));var Redis=require(_0xde50('0x1'));var qs=require(_0xde50('0x2'));var logger=require(_0xde50('0x3'))(_0xde50('0x4'));var config=require(_0xde50('0x5'));var db=require('../../mysqldb')['db'];config[_0xde50('0x6')]=_[_0xde50('0x7')](config['redis'],{'host':_0xde50('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xde50('0x6')]));require(_0xde50('0x9'))[_0xde50('0xa')](socket);function respondWithStatusCode(_0x11990b,_0x3bb6de){_0x3bb6de=_0x3bb6de||0xcc;return function(_0x8974d8){if(_0x8974d8){return _0x11990b[_0xde50('0xb')](_0x3bb6de);}return _0x11990b[_0xde50('0xc')](_0x3bb6de)[_0xde50('0xd')]();};}function respondWithResult(_0xb06959,_0x241f4d){_0x241f4d=_0x241f4d||0xc8;return function(_0x2fdfde){if(_0x2fdfde){return _0xb06959['status'](_0x241f4d)[_0xde50('0xe')](_0x2fdfde);}};}function respondWithFilteredResult(_0xe71ac2,_0x2535ac){return function(_0x555eb8){if(_0x555eb8){var _0x37f4d6=typeof _0x2535ac['offset']==='undefined'&&typeof _0x2535ac[_0xde50('0xf')]==='undefined';var _0x563274=_0x555eb8[_0xde50('0x10')];var _0x38429c=_0x37f4d6?0x0:_0x2535ac['offset'];var _0x3adea5=_0x37f4d6?_0x555eb8['count']:_0x2535ac['offset']+_0x2535ac['limit'];var _0x426be2;if(_0x3adea5>=_0x563274){_0x3adea5=_0x563274;_0x426be2=0xc8;}else{_0x426be2=0xce;}_0xe71ac2[_0xde50('0xc')](_0x426be2);return _0xe71ac2['set'](_0xde50('0x11'),_0x38429c+'-'+_0x3adea5+'/'+_0x563274)[_0xde50('0xe')](_0x555eb8);}return null;};}function removeEntity(_0x14cda8){return function(_0x529c59){if(_0x529c59){return _0x529c59[_0xde50('0x12')]()['then'](function(){var _0x54bcc9=_0x529c59['get']({'plain':!![]});var _0x459892=[{'name':_0xde50('0x13'),'value':_0xde50('0x14'),'ignore':![]},{'name':_0xde50('0x15'),'value':'outbound','ignore':![]},{'name':_0xde50('0x16'),'value':_0xde50('0x17'),'ignore':![]}];var _0x56082c=_(_0x459892)['filter'](_0xde50('0x18'))['map'](_0xde50('0x19'))[_0xde50('0x19')]();if(_['includes'](_0x56082c,_0x54bcc9['type'])){return;}var _0x2f4308=_[_0xde50('0x1a')](_0x459892,[_0xde50('0x19'),_0x54bcc9[_0xde50('0x1b')]])[_0xde50('0x1c')];return db['UserProfileResource'][_0xde50('0x12')]({'where':{'type':_0x2f4308,'resourceId':_0x54bcc9['id']}})[_0xde50('0x1d')](function(){return _0x529c59;});})[_0xde50('0x1d')](function(){_0x14cda8[_0xde50('0xc')](0xcc)[_0xde50('0xd')]();});}};}function handleEntityNotFound(_0x4c63a9){return function(_0xdc0c94){if(!_0xdc0c94){_0x4c63a9[_0xde50('0xb')](0x194);}return _0xdc0c94;};}function handleError(_0x3a0166,_0x36b999){_0x36b999=_0x36b999||0x1f4;return function(_0x16706f){logger[_0xde50('0x1e')](_0x16706f['stack']);if(_0x16706f[_0xde50('0x1c')]){delete _0x16706f[_0xde50('0x1c')];}_0x3a0166[_0xde50('0xc')](_0x36b999)[_0xde50('0x1f')](_0x16706f);};}exports['index']=function(_0x12dae1,_0x8519b6){var _0x1b2ba5={},_0x275353={},_0x20239f={'count':0x0,'rows':[]};var _0x3c34ad=_[_0xde50('0x20')](db[_0xde50('0x21')][_0xde50('0x22')],function(_0x165cbf){return{'name':_0x165cbf['fieldName'],'type':_0x165cbf['type'][_0xde50('0x23')]};});_0x275353[_0xde50('0x24')]=_[_0xde50('0x20')](_0x3c34ad,'name');_0x275353[_0xde50('0x25')]=_[_0xde50('0x26')](_0x12dae1[_0xde50('0x25')]);_0x275353[_0xde50('0x27')]=_[_0xde50('0x28')](_0x275353[_0xde50('0x24')],_0x275353[_0xde50('0x25')]);_0x1b2ba5[_0xde50('0x29')]=_['intersection'](_0x275353['model'],qs[_0xde50('0x2a')](_0x12dae1[_0xde50('0x25')][_0xde50('0x2a')]));_0x1b2ba5[_0xde50('0x29')]=_0x1b2ba5['attributes'][_0xde50('0x2b')]?_0x1b2ba5[_0xde50('0x29')]:_0x275353[_0xde50('0x24')];if(!_0x12dae1[_0xde50('0x25')][_0xde50('0x2c')](_0xde50('0x2d'))){_0x1b2ba5[_0xde50('0xf')]=qs[_0xde50('0xf')](_0x12dae1[_0xde50('0x25')]['limit']);_0x1b2ba5[_0xde50('0x2e')]=qs[_0xde50('0x2e')](_0x12dae1[_0xde50('0x25')][_0xde50('0x2e')]);}_0x1b2ba5[_0xde50('0x2f')]=qs[_0xde50('0x30')](_0x12dae1[_0xde50('0x25')][_0xde50('0x30')]);_0x1b2ba5[_0xde50('0x31')]=qs['filters'](_['pick'](_0x12dae1['query'],_0x275353[_0xde50('0x27')]),_0x3c34ad);if(_0x12dae1[_0xde50('0x25')][_0xde50('0x32')]){_0x1b2ba5['where']=_[_0xde50('0x33')](_0x1b2ba5[_0xde50('0x31')],{'$or':_[_0xde50('0x20')](_0x3c34ad,function(_0x30be29){if(_0x30be29[_0xde50('0x1b')]!==_0xde50('0x34')){var _0x2fab22={};_0x2fab22[_0x30be29[_0xde50('0x1c')]]={'$like':'%'+_0x12dae1[_0xde50('0x25')][_0xde50('0x32')]+'%'};return _0x2fab22;}})});}_0x1b2ba5=_[_0xde50('0x33')]({},_0x1b2ba5,_0x12dae1[_0xde50('0x35')]);var _0x4bc901={'where':_0x1b2ba5[_0xde50('0x31')]};return db[_0xde50('0x21')][_0xde50('0x10')](_0x4bc901)[_0xde50('0x1d')](function(_0x58e297){_0x20239f[_0xde50('0x10')]=_0x58e297;if(_0x12dae1[_0xde50('0x25')][_0xde50('0x36')]){_0x1b2ba5['include']=[{'all':!![]}];}return db[_0xde50('0x21')]['findAll'](_0x1b2ba5);})['then'](function(_0x5e3493){_0x20239f[_0xde50('0x37')]=_0x5e3493;return _0x20239f;})[_0xde50('0x1d')](respondWithFilteredResult(_0x8519b6,_0x1b2ba5))['catch'](handleError(_0x8519b6,null));};exports[_0xde50('0x38')]=function(_0x5ab42c,_0x20eb4c){var _0x4efdf9={'raw':![],'where':{'id':_0x5ab42c['params']['id']}},_0x492761={};_0x492761[_0xde50('0x24')]=_['keys'](db['VoiceExtension'][_0xde50('0x22')]);_0x492761['query']=_[_0xde50('0x26')](_0x5ab42c['query']);_0x492761['filters']=_[_0xde50('0x28')](_0x492761[_0xde50('0x24')],_0x492761[_0xde50('0x25')]);_0x4efdf9[_0xde50('0x29')]=_[_0xde50('0x28')](_0x492761[_0xde50('0x24')],qs[_0xde50('0x2a')](_0x5ab42c[_0xde50('0x25')][_0xde50('0x2a')]));_0x4efdf9[_0xde50('0x29')]=_0x4efdf9[_0xde50('0x29')][_0xde50('0x2b')]?_0x4efdf9[_0xde50('0x29')]:_0x492761[_0xde50('0x24')];if(_0x5ab42c['query'][_0xde50('0x36')]){_0x4efdf9['include']=[{'all':!![]}];}_0x4efdf9=_[_0xde50('0x33')]({},_0x4efdf9,_0x5ab42c['options']);return db[_0xde50('0x21')][_0xde50('0x1a')](_0x4efdf9)['then'](handleEntityNotFound(_0x20eb4c,null))['then'](respondWithResult(_0x20eb4c,null))[_0xde50('0x39')](handleError(_0x20eb4c,null));};exports[_0xde50('0x12')]=function(_0x1d769e,_0x2c4818){return db[_0xde50('0x21')][_0xde50('0x1a')]({'where':{'id':_0x1d769e[_0xde50('0x3a')]['id']}})[_0xde50('0x1d')](handleEntityNotFound(_0x2c4818,null))['then'](removeEntity(_0x2c4818,null))[_0xde50('0x39')](handleError(_0x2c4818,null));};exports[_0xde50('0x3b')]=function(_0xc3174c,_0x5223a2){if(_0xc3174c['body'][_0xde50('0x1b')]===_0xde50('0x3c')&&!_[_0xde50('0x3d')](_0xc3174c[_0xde50('0x3e')]['exten'],'_')){_0xc3174c['body'][_0xde50('0x3f')]='_'[_0xde50('0x40')](_0xc3174c[_0xde50('0x3e')][_0xde50('0x3f')]);}return db[_0xde50('0x21')]['create'](_0xc3174c['body'],{'raw':![]})[_0xde50('0x1d')](function(_0x218e4a){var _0x324159=_0xc3174c[_0xde50('0x41')][_0xde50('0x42')]({'plain':!![]});if(!_0x324159)throw new Error(_0xde50('0x43'));if(_0x324159[_0xde50('0x44')]===_0xde50('0x41')){var _0x135e15=_0x218e4a['get']({'plain':!![]});var _0x56853d=[{'name':_0xde50('0x13'),'value':'inbound'},{'name':_0xde50('0x15'),'value':_0xde50('0x3c')},{'name':'InternalRoutes','value':'internal'}];var _0x66061b=_[_0xde50('0x1a')](_0x56853d,[_0xde50('0x19'),_0x135e15[_0xde50('0x1b')]])[_0xde50('0x1c')];return db[_0xde50('0x45')]['find']({'where':{'name':_0x66061b,'userProfileId':_0x324159[_0xde50('0x46')]},'raw':!![]})[_0xde50('0x1d')](function(_0x46029f){if(_0x46029f&&_0x46029f[_0xde50('0x47')]===0x0){return db[_0xde50('0x48')][_0xde50('0x3b')]({'name':_0x135e15['name'],'resourceId':_0x135e15['id'],'type':_0x46029f[_0xde50('0x1c')],'sectionId':_0x46029f['id']},{})['then'](function(){return _0x218e4a;});}else{return _0x218e4a;}})['catch'](function(_0x367e2a){logger[_0xde50('0x1e')](_0xde50('0x49'),_0x367e2a);throw _0x367e2a;});}return _0x218e4a;})['then'](respondWithResult(_0x5223a2,0xc9))['catch'](handleError(_0x5223a2,null));};exports[_0xde50('0x4a')]=function(_0x46af17,_0x27a4d5){if(_0x46af17[_0xde50('0x3e')]['id']){delete _0x46af17[_0xde50('0x3e')]['id'];}return db[_0xde50('0x21')][_0xde50('0x1a')]({'where':{'id':_0x46af17[_0xde50('0x3a')]['id']}})[_0xde50('0x1d')](handleEntityNotFound(_0x27a4d5,null))[_0xde50('0x1d')](function(_0x49c9da){if(_0x49c9da){return db[_0xde50('0x21')][_0xde50('0x4a')](_[_0xde50('0x4b')](_0x46af17[_0xde50('0x3e')],['exten',_0xde50('0x4c'),'description',_0xde50('0x4d'),_0xde50('0x4e'),_0xde50('0x4f'),_0xde50('0x50')]),{'where':{'context':_0x49c9da[_0xde50('0x4c')],'exten':_0x49c9da[_0xde50('0x3f')]},'individualHooks':!![]})[_0xde50('0x1d')](function(_0x4d04a5){return _0x4d04a5;});}return null;})['then'](respondWithStatusCode(_0x27a4d5,null))[_0xde50('0x39')](handleError(_0x27a4d5,null));};exports[_0xde50('0x51')]=function(_0xc2a1d8,_0x7b347e){var _0x152a47=_0xc2a1d8['params']['id'];var _0x548809=_0xc2a1d8['body'];var _0x47bea4=0xc8;var _0x1bccbf=null;return db['sequelize'][_0xde50('0x52')]({'isolationLevel':db[_0xde50('0x53')]['Transaction'][_0xde50('0x54')][_0xde50('0x55')]},function(_0xec4086){return db['VoiceExtension']['findOne']({'where':{'id':_0x152a47},'transaction':_0xec4086})[_0xde50('0x1d')](function(_0xcf63b6){if(_0xcf63b6){return db[_0xde50('0x21')][_0xde50('0x12')]({'where':{'VoiceExtensionId':_0x152a47},'transaction':_0xec4086})[_0xde50('0x1d')](function(){var _0x2439c1=_[_0xde50('0x20')](_0x548809,function(_0x7bf37c){_0x7bf37c[_0xde50('0x56')]=_0x152a47;_0x7bf37c['isApp']=!![];return _0x7bf37c;});return _0xcf63b6['createRouting'](_0x2439c1);})[_0xde50('0x1d')](function(_0x406c7e){return db['VoiceExtension']['bulkCreate'](_0x406c7e,{'transaction':_0xec4086});});}else{_0x47bea4=0x194;_0x1bccbf=[];}});})[_0xde50('0x1d')](function(){if(_0x47bea4!==0x194){return db[_0xde50('0x21')][_0xde50('0x57')]({'where':{'isApp':!![],'VoiceExtensionId':_0x152a47},'order':_0xde50('0x58')})[_0xde50('0x1d')](function(_0x132a6a){_0x1bccbf=_0x132a6a;});}})[_0xde50('0x39')](function(_0x1f9ead){_0x47bea4=0x1f4;logger['error'](_0x1f9ead['stack']);if(_0x1f9ead[_0xde50('0x1c')]){delete _0x1f9ead[_0xde50('0x1c')];}_0x1bccbf=_0x1f9ead;})[_0xde50('0x59')](function(){if(_0x1bccbf===null){_0x7b347e[_0xde50('0xb')](_0x47bea4);}else{if(_0x47bea4===0x1f4){_0x7b347e['status'](_0x47bea4)['send'](_0x1bccbf);}else{_0x7b347e[_0xde50('0xc')](_0x47bea4)[_0xde50('0xe')](_0x1bccbf);}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index 93ca4a1..96342b9 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 _0x4d27=['events','VoiceExtension','setMaxListeners','save','update','remove','emit','hook','exports'];(function(_0x1f0213,_0x3c3c9e){var _0x2048c4=function(_0x26d0c6){while(--_0x26d0c6){_0x1f0213['push'](_0x1f0213['shift']());}};_0x2048c4(++_0x3c3c9e);}(_0x4d27,0x7e));var _0x74d2=function(_0x12d0fe,_0x153485){_0x12d0fe=_0x12d0fe-0x0;var _0x43e937=_0x4d27[_0x12d0fe];return _0x43e937;};'use strict';var EventEmitter=require(_0x74d2('0x0'));var VoiceExtension=require('../../mysqldb')['db'][_0x74d2('0x1')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x74d2('0x2')](0x0);var events={'afterCreate':_0x74d2('0x3'),'afterUpdate':_0x74d2('0x4'),'afterDestroy':_0x74d2('0x5')};function emitEvent(_0xd8e387){return function(_0x22d58e,_0x11403f,_0x1ea87c){VoiceExtensionEvents[_0x74d2('0x6')](_0xd8e387+':'+_0x22d58e['id'],_0x22d58e);VoiceExtensionEvents[_0x74d2('0x6')](_0xd8e387,_0x22d58e);_0x1ea87c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceExtension[_0x74d2('0x7')](e,emitEvent(event));}}module[_0x74d2('0x8')]=VoiceExtensionEvents; \ No newline at end of file +var _0x4ddc=['setMaxListeners','save','update','remove','hook','exports','events','../../mysqldb','VoiceExtension'];(function(_0x16d9e9,_0x2bfe6b){var _0x120192=function(_0x372946){while(--_0x372946){_0x16d9e9['push'](_0x16d9e9['shift']());}};_0x120192(++_0x2bfe6b);}(_0x4ddc,0x84));var _0xc4dd=function(_0x48ba5f,_0x3ac37f){_0x48ba5f=_0x48ba5f-0x0;var _0x433259=_0x4ddc[_0x48ba5f];return _0x433259;};'use strict';var EventEmitter=require(_0xc4dd('0x0'));var VoiceExtension=require(_0xc4dd('0x1'))['db'][_0xc4dd('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0xc4dd('0x3')](0x0);var events={'afterCreate':_0xc4dd('0x4'),'afterUpdate':_0xc4dd('0x5'),'afterDestroy':_0xc4dd('0x6')};function emitEvent(_0x21d9c2){return function(_0x3c4d81,_0x5ab732,_0xc5d8ce){VoiceExtensionEvents['emit'](_0x21d9c2+':'+_0x3c4d81['id'],_0x3c4d81);VoiceExtensionEvents['emit'](_0x21d9c2,_0x3c4d81);_0xc5d8ce(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceExtension[_0xc4dd('0x7')](e,emitEvent(event));}}module[_0xc4dd('0x8')]=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index d60c2ef..758c3aa 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 _0x649b=['define','VoiceExtension','voice_extensions','get','concat','Hangup','exports','type','CDR(type)=','context','alias','NoOp','CDR(routeAlias)=','exten','inbound','push','Set','XCALLY-MOTION-PROGRESS=0','outbound','CDR(type)=outbound','No\x20alias\x20set','CDR(destination)=','cutdigits','${EXTEN:','CDR(routeid)=','ExecIf','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','XCALLY-MOTION-ANSWER=0','MONITOR_OPTIONS=ab','outboundrouteid=','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','trunk','timeout','url','length','name','param','split','phone','prefix','SIP','join','options','indexOf','U(xcally-mixmonitor-context)','replace','isEmpty','Interval','findAll','interval','IntervalId','then','*,*,*,*','intervals','map','filter','tag','CDR(tag)=','toLowerCase','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','Set(CALLERID(all)=','NoOp(No\x20number\x20available)','answer','queue','playback','includes','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice',',${EXTEN},','outboundDial','appdata','XMCS-UNIQUEID=${CHANNEL(LINKEDID)}','priority','last','catch'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x649b,0x166));var _0xb649=function(_0x2c4aa5,_0x930b68){_0x2c4aa5=_0x2c4aa5-0x0;var _0xead5ca=_0x649b[_0x2c4aa5];return _0xead5ca;};'use strict';var _=require('lodash');var attributes=require('./voiceExtension.attributes');module[_0xb649('0x0')]=function(_0x1fd3a2){var _0x4ede93=_0x1fd3a2['models'];function _0xd0360e(_0x54800b){var _0x9422ae=0x2;var _0x20a3fd=[{'type':_0x54800b[_0xb649('0x1')],'app':'Set','appdata':_0xb649('0x2')+_0x54800b[_0xb649('0x1')],'context':_0x54800b[_0xb649('0x3')],'exten':_0x54800b['exten'],'priority':_0x9422ae++,'VoiceExtensionId':_0x54800b['id']},{'type':_0x54800b['type'],'app':_0x54800b[_0xb649('0x4')]?'Set':_0xb649('0x5'),'appdata':_0x54800b[_0xb649('0x4')]?_0xb649('0x6')+_0x54800b[_0xb649('0x4')]:'No\x20alias\x20set','context':_0x54800b[_0xb649('0x3')],'exten':_0x54800b[_0xb649('0x7')],'priority':_0x9422ae++,'VoiceExtensionId':_0x54800b['id']}];if(_0x54800b[_0xb649('0x1')]===_0xb649('0x8')){_0x20a3fd['push']({'type':_0xb649('0x8'),'app':'Set','appdata':'CDR(routeid)='+_0x54800b['id'],'context':_0x54800b['context'],'exten':_0x54800b[_0xb649('0x7')],'priority':_0x9422ae++,'VoiceExtensionId':_0x54800b['id']});}_0x20a3fd[_0xb649('0x9')]({'type':_0x54800b[_0xb649('0x1')],'app':_0xb649('0xa'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x54800b[_0xb649('0x3')],'exten':_0x54800b[_0xb649('0x7')],'priority':_0x9422ae++,'VoiceExtensionId':_0x54800b['id']},{'type':_0x54800b[_0xb649('0x1')],'app':'Set','appdata':_0xb649('0xb'),'context':_0x54800b[_0xb649('0x3')],'exten':_0x54800b[_0xb649('0x7')],'priority':_0x9422ae++,'VoiceExtensionId':_0x54800b['id']},{'type':_0x54800b[_0xb649('0x1')],'app':_0xb649('0xa'),'appdata':'MONITOR_OPTIONS=ab','context':_0x54800b[_0xb649('0x3')],'exten':_0x54800b[_0xb649('0x7')],'priority':_0x9422ae++,'VoiceExtensionId':_0x54800b['id']});return _0x20a3fd;}function _0x11e3c9(_0x5e455a){var _0x36c236=0x2;var _0x1030c6=[{'type':_0xb649('0xc'),'app':_0xb649('0xa'),'appdata':_0xb649('0xd'),'context':_0x5e455a['context'],'exten':_0x5e455a['exten'],'priority':_0x36c236++,'VoiceExtensionId':_0x5e455a['id']},{'type':_0xb649('0xc'),'app':_0x5e455a[_0xb649('0x4')]?_0xb649('0xa'):_0xb649('0x5'),'appdata':_0x5e455a[_0xb649('0x4')]?_0xb649('0x6')+_0x5e455a[_0xb649('0x4')]:_0xb649('0xe'),'context':_0x5e455a[_0xb649('0x3')],'exten':_0x5e455a[_0xb649('0x7')],'priority':_0x36c236++,'VoiceExtensionId':_0x5e455a['id']},{'type':'outbound','app':'Set','appdata':_0xb649('0xf')+(_0x5e455a[_0xb649('0x10')]?_0xb649('0x11')+_0x5e455a[_0xb649('0x10')]+'}':'${EXTEN}'),'context':_0x5e455a[_0xb649('0x3')],'exten':_0x5e455a[_0xb649('0x7')],'priority':_0x36c236++,'VoiceExtensionId':_0x5e455a['id']},{'type':'outbound','app':_0xb649('0xa'),'appdata':_0xb649('0x12')+_0x5e455a['id'],'context':_0x5e455a[_0xb649('0x3')],'exten':_0x5e455a[_0xb649('0x7')],'priority':_0x36c236++,'VoiceExtensionId':_0x5e455a['id']},{'type':'outbound','app':_0xb649('0x13'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x36c236+0x2)+'):Goto('+(_0x36c236+0x1)+')','context':_0x5e455a[_0xb649('0x3')],'exten':_0x5e455a[_0xb649('0x7')],'priority':_0x36c236++,'VoiceExtensionId':_0x5e455a['id']},{'type':_0xb649('0xc'),'app':_0xb649('0xa'),'appdata':_0x5e455a['cutdigits']?_0xb649('0x14')+_0x5e455a[_0xb649('0x10')]+'}':_0xb649('0x15'),'context':_0x5e455a[_0xb649('0x3')],'exten':_0x5e455a[_0xb649('0x7')],'priority':_0x36c236++,'VoiceExtensionId':_0x5e455a['id']},{'type':_0xb649('0xc'),'app':'Set','appdata':_0xb649('0x16'),'context':_0x5e455a[_0xb649('0x3')],'exten':_0x5e455a[_0xb649('0x7')],'priority':_0x36c236++,'VoiceExtensionId':_0x5e455a['id']},{'type':_0xb649('0xc'),'app':'Set','appdata':_0xb649('0xb'),'context':_0x5e455a['context'],'exten':_0x5e455a[_0xb649('0x7')],'priority':_0x36c236++,'VoiceExtensionId':_0x5e455a['id']},{'type':'outbound','app':_0xb649('0xa'),'appdata':_0xb649('0x17'),'context':_0x5e455a[_0xb649('0x3')],'exten':_0x5e455a[_0xb649('0x7')],'priority':_0x36c236++,'VoiceExtensionId':_0x5e455a['id']},{'type':_0xb649('0xc'),'app':_0xb649('0xa'),'appdata':_0xb649('0x18')+_0x5e455a['id'],'context':_0x5e455a[_0xb649('0x3')],'exten':_0x5e455a[_0xb649('0x7')],'priority':_0x36c236++,'VoiceExtensionId':_0x5e455a['id']}];if(_0x5e455a[_0xb649('0x19')](_0xb649('0x1a'))&&_0x5e455a[_0xb649('0x1a')]!==_0xb649('0x1b')){_0x1030c6['push']({'type':_0xb649('0xc'),'app':'Set','appdata':_0xb649('0x1c'),'context':_0x5e455a[_0xb649('0x3')],'exten':_0x5e455a[_0xb649('0x7')],'priority':_0x36c236++,'VoiceExtensionId':_0x5e455a['id']},{'type':'outbound','app':_0xb649('0xa'),'appdata':_0xb649('0x1d')+_0x5e455a['recordingFormat']||_0xb649('0x1e'),'context':_0x5e455a[_0xb649('0x3')],'exten':_0x5e455a[_0xb649('0x7')],'priority':_0x36c236++,'VoiceExtensionId':_0x5e455a['id']});}return _0x1030c6;}function _0x31a574(_0x384520,_0x1356ec){var _0x4c991d=[{'name':_0xb649('0x1f'),'param':0x0},{'name':_0xb649('0x20'),'param':0x1},{'name':'options','param':0x2},{'name':_0xb649('0x21'),'param':0x3}];var _0x35dd88={};var _0x2a3883=_0x1356ec['split'](',');var _0x32bce9=[];for(var _0x127ed3=0x0;_0x127ed3<_0x4c991d[_0xb649('0x22')];_0x127ed3++){switch(_0x4c991d[_0x127ed3][_0xb649('0x23')]){case _0xb649('0x1f'):_0x35dd88[_0xb649('0x1f')]=_0x2a3883[_0x4c991d[_0x127ed3][_0xb649('0x24')]][_0xb649('0x25')]('/')[0x1];_0x35dd88[_0xb649('0x26')]=_0x2a3883[_0x4c991d[_0x127ed3][_0xb649('0x24')]][_0xb649('0x25')]('/')[0x2];_0x35dd88[_0xb649('0x27')]=_0x35dd88[_0xb649('0x26')]?_0x35dd88[_0xb649('0x26')]['split']('$')[0x0]:undefined;_0x35dd88[_0xb649('0x26')]=_0x384520[_0xb649('0x10')]?(_0x35dd88[_0xb649('0x27')]||'')+'${EXTEN:'+_0x384520[_0xb649('0x10')]+'}':(_0x35dd88[_0xb649('0x27')]||'')+'${EXTEN}';_0x32bce9[_0x4c991d[_0x127ed3][_0xb649('0x24')]]=[_0xb649('0x28'),_0x35dd88[_0xb649('0x1f')],_0x35dd88[_0xb649('0x26')]][_0xb649('0x29')]('/');break;case'options':_0x35dd88['options']=_0x2a3883[_0x4c991d[_0x127ed3]['param']];if(_0x384520[_0xb649('0x1a')]!==_0xb649('0x1b')){if(_0x35dd88[_0xb649('0x2a')][_0xb649('0x2b')]('U(xcally-mixmonitor-context)')<0x0){_0x35dd88[_0xb649('0x2a')]+=_0xb649('0x2c');}}else{_0x35dd88['options']=_0x35dd88[_0xb649('0x2a')][_0xb649('0x2d')](_0xb649('0x2c'),'');}_0x32bce9[_0x4c991d[_0x127ed3][_0xb649('0x24')]]=_0x35dd88[_0xb649('0x2a')];break;default:_0x32bce9[_0x4c991d[_0x127ed3][_0xb649('0x24')]]=_0x2a3883[_0x4c991d[_0x127ed3][_0xb649('0x24')]];}}return _0x32bce9[_0xb649('0x29')](',');}function _0x1c75bd(_0x47feb1,_0x112f2f,_0x49e6ea){return new Promise(function(_0x228a60,_0x36eb4d){var _0x5d6b5f=[];if(_[_0xb649('0x2e')](_0x112f2f))return _0x228a60(_0x5d6b5f);_0x4ede93[_0xb649('0x2f')][_0xb649('0x30')]({'attributes':['id',_0xb649('0x31'),_0xb649('0x32')],'raw':!![]})[_0xb649('0x33')](function(_0x305750){for(var _0x48aa9b=0x0,_0x90c06d=0x0;_0x48aa9b<_0x112f2f[_0xb649('0x22')];_0x48aa9b++,_0x90c06d=0x0){var _0x37dbfa=_0x112f2f[_0x48aa9b];var _0x170ce6=[];var _0x3092e2=[];delete _0x37dbfa['id'];if(_0x37dbfa['interval']!==_0xb649('0x34')){_0x37dbfa['intervals']=[_0x37dbfa['interval']];}else{_0x37dbfa[_0xb649('0x35')]=_0x37dbfa[_0xb649('0x32')]?_[_0xb649('0x36')](_[_0xb649('0x37')](_0x305750,{'IntervalId':_0x37dbfa[_0xb649('0x32')]}),'interval'):[];}_0x37dbfa[_0xb649('0x3')]=_0x47feb1[_0xb649('0x3')];_0x37dbfa[_0xb649('0x7')]=_0x47feb1[_0xb649('0x7')];if(_0x37dbfa['type'])_0x37dbfa['type']=_0x37dbfa[_0xb649('0x1')]['toLowerCase']();if(_0x47feb1[_0xb649('0x1')]===_0xb649('0xc')){if(_0x37dbfa[_0xb649('0x19')](_0xb649('0x38'))&&_0x37dbfa['tag']&&_0x37dbfa[_0xb649('0x38')]!=='--'){_0x170ce6['push']({'type':_0x37dbfa['type']['toLowerCase'](),'app':_0xb649('0xa'),'appdata':_0xb649('0x39')+_0x37dbfa[_0xb649('0x38')],'context':_0x47feb1['context'],'exten':_0x47feb1[_0xb649('0x7')],'priority':_0x37dbfa[_0xb649('0x35')][_0xb649('0x22')]+_0x49e6ea+_0x90c06d++,'VoiceExtensionId':_0x47feb1['id']});}_0x170ce6[_0xb649('0x9')]({'type':_0x37dbfa[_0xb649('0x1')][_0xb649('0x3a')](),'app':_0xb649('0x13'),'appdata':_0xb649('0x3b')+(_0x37dbfa[_0xb649('0x3c')]?_0xb649('0x3d')+_0x37dbfa['callerID']+')':_0xb649('0x3e')),'context':_0x47feb1[_0xb649('0x3')],'exten':_0x47feb1[_0xb649('0x7')],'priority':_0x37dbfa[_0xb649('0x35')]['length']+_0x49e6ea+_0x90c06d++,'VoiceExtensionId':_0x47feb1['id']});}else{if(_0x37dbfa['hasOwnProperty'](_0xb649('0x3f'))){if([_0xb649('0x40'),_0xb649('0x41')][_0xb649('0x42')](_0x37dbfa[_0xb649('0x43')][_0xb649('0x3a')]())&&_0x37dbfa[_0xb649('0x44')]!==_0xb649('0x45')){if(_0x37dbfa[_0xb649('0x3f')]){_0x170ce6['push']({'type':_0x37dbfa[_0xb649('0x1')][_0xb649('0x3a')](),'app':_0xb649('0x13'),'appdata':_0xb649('0x46'),'context':_0x47feb1[_0xb649('0x3')],'exten':_0x47feb1['exten'],'priority':_0x37dbfa[_0xb649('0x35')]['length']+_0x49e6ea+_0x90c06d++,'VoiceExtensionId':_0x47feb1['id']});_0x170ce6['push']({'type':_0x37dbfa[_0xb649('0x1')][_0xb649('0x3a')](),'app':'Set','appdata':_0xb649('0x47'),'context':_0x47feb1['context'],'exten':_0x47feb1['exten'],'priority':_0x37dbfa[_0xb649('0x35')][_0xb649('0x22')]+_0x49e6ea+_0x90c06d++,'VoiceExtensionId':_0x47feb1['id']});}else{_0x170ce6['push']({'type':_0x37dbfa[_0xb649('0x1')][_0xb649('0x3a')](),'app':'ExecIf','appdata':_0xb649('0x48'),'context':_0x47feb1[_0xb649('0x3')],'exten':_0x47feb1[_0xb649('0x7')],'priority':_0x37dbfa['intervals'][_0xb649('0x22')]+_0x49e6ea+_0x90c06d++,'VoiceExtensionId':_0x47feb1['id']});_0x170ce6[_0xb649('0x9')]({'type':_0x37dbfa[_0xb649('0x1')][_0xb649('0x3a')](),'app':_0xb649('0xa'),'appdata':_0xb649('0x49'),'context':_0x47feb1[_0xb649('0x3')],'exten':_0x47feb1[_0xb649('0x7')],'priority':_0x37dbfa[_0xb649('0x35')]['length']+_0x49e6ea+_0x90c06d++,'VoiceExtensionId':_0x47feb1['id']});}}}}for(var _0x1cdc67=0x0;_0x1cdc67<_0x37dbfa[_0xb649('0x35')][_0xb649('0x22')];_0x1cdc67++){var _0x39cf25=_0x49e6ea+_0x37dbfa['intervals'][_0xb649('0x22')];var _0x440fbf=_0x1cdc67===_0x37dbfa['intervals'][_0xb649('0x22')]-0x1?_0x49e6ea+_0x170ce6[_0xb649('0x22')]+_0x3092e2[_0xb649('0x22')]+0x2:_0x49e6ea+_0x1cdc67+0x1;_0x170ce6[_0xb649('0x4a')](_0x1cdc67,0x0,{'type':_0x47feb1[_0xb649('0x1')],'app':'GotoIfTime','appdata':_0x37dbfa[_0xb649('0x35')][_0x1cdc67]+'?'+_0x47feb1['context']+_0xb649('0x4b')+_0x39cf25+':'+_0x47feb1['context']+_0xb649('0x4b')+_0x440fbf,'exten':_0x47feb1['exten'],'context':_0x47feb1['context'],'priority':_0x49e6ea+_0x1cdc67,'VoiceExtensionId':_0x47feb1['id']});}if(_0x37dbfa['appType']===_0xb649('0x4c')){_0x37dbfa[_0xb649('0x4d')]=_0x31a574(_0x47feb1,_0x37dbfa['appdata']);}if(_0x37dbfa[_0xb649('0x44')]==='agi'){_0x170ce6[_0xb649('0x9')]({'type':_0x37dbfa[_0xb649('0x1')][_0xb649('0x3a')](),'app':'Set','appdata':_0xb649('0x4e'),'context':_0x47feb1[_0xb649('0x3')],'exten':_0x47feb1['exten'],'priority':_0x37dbfa[_0xb649('0x35')][_0xb649('0x22')]+_0x49e6ea+_0x90c06d++,'VoiceExtensionId':_0x47feb1['id']});}_0x37dbfa[_0xb649('0x4f')]=_0x170ce6[_0xb649('0x22')]?_[_0xb649('0x50')](_0x170ce6)[_0xb649('0x4f')]+0x1:_0x49e6ea;_0x5d6b5f=_['concat'](_0x5d6b5f,_0x170ce6,[_0x37dbfa],_0x3092e2);_0x49e6ea=_[_0xb649('0x50')](_0x5d6b5f)[_0xb649('0x4f')]+0x1;}return _0x228a60(_0x5d6b5f);})[_0xb649('0x51')](function(_0x2da302){_0x36eb4d(_0x2da302);});});}return _0x1fd3a2[_0xb649('0x52')](_0xb649('0x53'),attributes,{'tableName':_0xb649('0x54'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x124862){var _0x44e898=this[_0xb649('0x55')]({'plain':!![]});var _0x1992cc=_0x44e898[_0xb649('0x1')]==='outbound'?_0x11e3c9(_0x44e898):_0xd0360e(_0x44e898);return _0x1c75bd(_0x44e898,_0x124862,_[_0xb649('0x50')](_0x1992cc)[_0xb649('0x4f')]+0x1)['then'](function(_0x4fccd7){var _0x550139=_[_0xb649('0x56')](_0x1992cc,_0x4fccd7);_0x550139['push']({'type':_0x44e898['type'],'app':_0xb649('0x57'),'exten':_0x44e898[_0xb649('0x7')],'context':_0x44e898[_0xb649('0x3')],'priority':_[_0xb649('0x50')](_0x550139)[_0xb649('0x4f')]+0x1,'VoiceExtensionId':_0x44e898['id']});return _0x550139;});}}});}; \ No newline at end of file +var _0xef87=['replace','isEmpty','Interval','findAll','interval','IntervalId','then','length','*,*,*,*','intervals','map','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','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice',',${EXTEN},','outboundDial','appdata','agi','priority','last','concat','define','VoiceExtension','voice_extensions','lodash','models','type','CDR(type)=','context','exten','alias','Set','NoOp','No\x20alias\x20set','inbound','push','CDR(routeid)=','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','CDR(routeAlias)=','CDR(destination)=','${EXTEN:','cutdigits','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','outboundrouteid=','hasOwnProperty','recordingFormat','wav','timeout','options','url','split','name','trunk','param','phone','prefix','${EXTEN}','SIP','join','none','U(xcally-mixmonitor-context)'];(function(_0x2d855d,_0x2aed2a){var _0x395d09=function(_0x4a5554){while(--_0x4a5554){_0x2d855d['push'](_0x2d855d['shift']());}};_0x395d09(++_0x2aed2a);}(_0xef87,0x1bb));var _0x7ef8=function(_0x56588d,_0x508ce2){_0x56588d=_0x56588d-0x0;var _0x15477a=_0xef87[_0x56588d];return _0x15477a;};'use strict';var _=require(_0x7ef8('0x0'));var attributes=require('./voiceExtension.attributes');module['exports']=function(_0x156f7f){var _0x105425=_0x156f7f[_0x7ef8('0x1')];function _0x314a0d(_0xfd17c2){var _0x47488e=0x2;var _0xce1b70=[{'type':_0xfd17c2[_0x7ef8('0x2')],'app':'Set','appdata':_0x7ef8('0x3')+_0xfd17c2[_0x7ef8('0x2')],'context':_0xfd17c2[_0x7ef8('0x4')],'exten':_0xfd17c2[_0x7ef8('0x5')],'priority':_0x47488e++,'VoiceExtensionId':_0xfd17c2['id']},{'type':_0xfd17c2[_0x7ef8('0x2')],'app':_0xfd17c2[_0x7ef8('0x6')]?_0x7ef8('0x7'):_0x7ef8('0x8'),'appdata':_0xfd17c2[_0x7ef8('0x6')]?'CDR(routeAlias)='+_0xfd17c2[_0x7ef8('0x6')]:_0x7ef8('0x9'),'context':_0xfd17c2[_0x7ef8('0x4')],'exten':_0xfd17c2[_0x7ef8('0x5')],'priority':_0x47488e++,'VoiceExtensionId':_0xfd17c2['id']}];if(_0xfd17c2[_0x7ef8('0x2')]===_0x7ef8('0xa')){_0xce1b70[_0x7ef8('0xb')]({'type':'inbound','app':'Set','appdata':_0x7ef8('0xc')+_0xfd17c2['id'],'context':_0xfd17c2['context'],'exten':_0xfd17c2[_0x7ef8('0x5')],'priority':_0x47488e++,'VoiceExtensionId':_0xfd17c2['id']});}_0xce1b70[_0x7ef8('0xb')]({'type':_0xfd17c2['type'],'app':'Set','appdata':_0x7ef8('0xd'),'context':_0xfd17c2['context'],'exten':_0xfd17c2[_0x7ef8('0x5')],'priority':_0x47488e++,'VoiceExtensionId':_0xfd17c2['id']},{'type':_0xfd17c2[_0x7ef8('0x2')],'app':_0x7ef8('0x7'),'appdata':_0x7ef8('0xe'),'context':_0xfd17c2[_0x7ef8('0x4')],'exten':_0xfd17c2[_0x7ef8('0x5')],'priority':_0x47488e++,'VoiceExtensionId':_0xfd17c2['id']},{'type':_0xfd17c2[_0x7ef8('0x2')],'app':_0x7ef8('0x7'),'appdata':_0x7ef8('0xf'),'context':_0xfd17c2[_0x7ef8('0x4')],'exten':_0xfd17c2[_0x7ef8('0x5')],'priority':_0x47488e++,'VoiceExtensionId':_0xfd17c2['id']});return _0xce1b70;}function _0x3554e7(_0x32d087){var _0x359370=0x2;var _0x42037f=[{'type':_0x7ef8('0x10'),'app':'Set','appdata':_0x7ef8('0x11'),'context':_0x32d087[_0x7ef8('0x4')],'exten':_0x32d087[_0x7ef8('0x5')],'priority':_0x359370++,'VoiceExtensionId':_0x32d087['id']},{'type':_0x7ef8('0x10'),'app':_0x32d087[_0x7ef8('0x6')]?'Set':_0x7ef8('0x8'),'appdata':_0x32d087['alias']?_0x7ef8('0x12')+_0x32d087[_0x7ef8('0x6')]:_0x7ef8('0x9'),'context':_0x32d087[_0x7ef8('0x4')],'exten':_0x32d087[_0x7ef8('0x5')],'priority':_0x359370++,'VoiceExtensionId':_0x32d087['id']},{'type':_0x7ef8('0x10'),'app':_0x7ef8('0x7'),'appdata':_0x7ef8('0x13')+(_0x32d087['cutdigits']?_0x7ef8('0x14')+_0x32d087[_0x7ef8('0x15')]+'}':'${EXTEN}'),'context':_0x32d087['context'],'exten':_0x32d087[_0x7ef8('0x5')],'priority':_0x359370++,'VoiceExtensionId':_0x32d087['id']},{'type':'outbound','app':_0x7ef8('0x7'),'appdata':'CDR(routeid)='+_0x32d087['id'],'context':_0x32d087[_0x7ef8('0x4')],'exten':_0x32d087[_0x7ef8('0x5')],'priority':_0x359370++,'VoiceExtensionId':_0x32d087['id']},{'type':_0x7ef8('0x10'),'app':_0x7ef8('0x16'),'appdata':_0x7ef8('0x17')+(_0x359370+0x2)+_0x7ef8('0x18')+(_0x359370+0x1)+')','context':_0x32d087[_0x7ef8('0x4')],'exten':_0x32d087['exten'],'priority':_0x359370++,'VoiceExtensionId':_0x32d087['id']},{'type':_0x7ef8('0x10'),'app':_0x7ef8('0x7'),'appdata':_0x32d087[_0x7ef8('0x15')]?'CDR(prefix)=${EXTEN:0:'+_0x32d087['cutdigits']+'}':'CDR(prefix)=noprefix','context':_0x32d087[_0x7ef8('0x4')],'exten':_0x32d087[_0x7ef8('0x5')],'priority':_0x359370++,'VoiceExtensionId':_0x32d087['id']},{'type':'outbound','app':_0x7ef8('0x7'),'appdata':_0x7ef8('0xd'),'context':_0x32d087[_0x7ef8('0x4')],'exten':_0x32d087[_0x7ef8('0x5')],'priority':_0x359370++,'VoiceExtensionId':_0x32d087['id']},{'type':_0x7ef8('0x10'),'app':'Set','appdata':_0x7ef8('0xe'),'context':_0x32d087['context'],'exten':_0x32d087[_0x7ef8('0x5')],'priority':_0x359370++,'VoiceExtensionId':_0x32d087['id']},{'type':'outbound','app':_0x7ef8('0x7'),'appdata':'MONITOR_OPTIONS=ab','context':_0x32d087[_0x7ef8('0x4')],'exten':_0x32d087[_0x7ef8('0x5')],'priority':_0x359370++,'VoiceExtensionId':_0x32d087['id']},{'type':_0x7ef8('0x10'),'app':'Set','appdata':_0x7ef8('0x19')+_0x32d087['id'],'context':_0x32d087[_0x7ef8('0x4')],'exten':_0x32d087[_0x7ef8('0x5')],'priority':_0x359370++,'VoiceExtensionId':_0x32d087['id']}];if(_0x32d087[_0x7ef8('0x1a')]('recordingFormat')&&_0x32d087['recordingFormat']!=='none'){_0x42037f[_0x7ef8('0xb')]({'type':_0x7ef8('0x10'),'app':_0x7ef8('0x7'),'appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x32d087['context'],'exten':_0x32d087[_0x7ef8('0x5')],'priority':_0x359370++,'VoiceExtensionId':_0x32d087['id']},{'type':'outbound','app':_0x7ef8('0x7'),'appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x32d087[_0x7ef8('0x1b')]||_0x7ef8('0x1c'),'context':_0x32d087[_0x7ef8('0x4')],'exten':_0x32d087[_0x7ef8('0x5')],'priority':_0x359370++,'VoiceExtensionId':_0x32d087['id']});}return _0x42037f;}function _0x553670(_0x48c807,_0x59a256){var _0x2ada95=[{'name':'trunk','param':0x0},{'name':_0x7ef8('0x1d'),'param':0x1},{'name':_0x7ef8('0x1e'),'param':0x2},{'name':_0x7ef8('0x1f'),'param':0x3}];var _0x46fa44={};var _0x4c3d5e=_0x59a256[_0x7ef8('0x20')](',');var _0x5b2a7c=[];for(var _0x308a0d=0x0;_0x308a0d<_0x2ada95['length'];_0x308a0d++){switch(_0x2ada95[_0x308a0d][_0x7ef8('0x21')]){case'trunk':_0x46fa44[_0x7ef8('0x22')]=_0x4c3d5e[_0x2ada95[_0x308a0d][_0x7ef8('0x23')]][_0x7ef8('0x20')]('/')[0x1];_0x46fa44[_0x7ef8('0x24')]=_0x4c3d5e[_0x2ada95[_0x308a0d][_0x7ef8('0x23')]][_0x7ef8('0x20')]('/')[0x2];_0x46fa44[_0x7ef8('0x25')]=_0x46fa44['phone']?_0x46fa44[_0x7ef8('0x24')]['split']('$')[0x0]:undefined;_0x46fa44[_0x7ef8('0x24')]=_0x48c807[_0x7ef8('0x15')]?(_0x46fa44[_0x7ef8('0x25')]||'')+_0x7ef8('0x14')+_0x48c807[_0x7ef8('0x15')]+'}':(_0x46fa44[_0x7ef8('0x25')]||'')+_0x7ef8('0x26');_0x5b2a7c[_0x2ada95[_0x308a0d]['param']]=[_0x7ef8('0x27'),_0x46fa44[_0x7ef8('0x22')],_0x46fa44['phone']][_0x7ef8('0x28')]('/');break;case _0x7ef8('0x1e'):_0x46fa44['options']=_0x4c3d5e[_0x2ada95[_0x308a0d][_0x7ef8('0x23')]];if(_0x48c807[_0x7ef8('0x1b')]!==_0x7ef8('0x29')){if(_0x46fa44[_0x7ef8('0x1e')]['indexOf'](_0x7ef8('0x2a'))<0x0){_0x46fa44['options']+=_0x7ef8('0x2a');}}else{_0x46fa44[_0x7ef8('0x1e')]=_0x46fa44[_0x7ef8('0x1e')][_0x7ef8('0x2b')](_0x7ef8('0x2a'),'');}_0x5b2a7c[_0x2ada95[_0x308a0d][_0x7ef8('0x23')]]=_0x46fa44['options'];break;default:_0x5b2a7c[_0x2ada95[_0x308a0d]['param']]=_0x4c3d5e[_0x2ada95[_0x308a0d][_0x7ef8('0x23')]];}}return _0x5b2a7c['join'](',');}function _0x492273(_0x48c096,_0x42d8a9,_0x5cb016){return new Promise(function(_0xb9607f,_0x47300a){var _0x38982c=[];if(_[_0x7ef8('0x2c')](_0x42d8a9))return _0xb9607f(_0x38982c);_0x105425[_0x7ef8('0x2d')][_0x7ef8('0x2e')]({'attributes':['id',_0x7ef8('0x2f'),_0x7ef8('0x30')],'raw':!![]})[_0x7ef8('0x31')](function(_0x4d7ad2){for(var _0x705650=0x0,_0x3dbdda=0x0;_0x705650<_0x42d8a9[_0x7ef8('0x32')];_0x705650++,_0x3dbdda=0x0){var _0xeb49=_0x42d8a9[_0x705650];var _0x92a91=[];var _0x316aa0=[];delete _0xeb49['id'];if(_0xeb49['interval']!==_0x7ef8('0x33')){_0xeb49[_0x7ef8('0x34')]=[_0xeb49[_0x7ef8('0x2f')]];}else{_0xeb49[_0x7ef8('0x34')]=_0xeb49[_0x7ef8('0x30')]?_[_0x7ef8('0x35')](_['filter'](_0x4d7ad2,{'IntervalId':_0xeb49[_0x7ef8('0x30')]}),_0x7ef8('0x2f')):[];}_0xeb49[_0x7ef8('0x4')]=_0x48c096['context'];_0xeb49[_0x7ef8('0x5')]=_0x48c096[_0x7ef8('0x5')];if(_0xeb49[_0x7ef8('0x2')])_0xeb49[_0x7ef8('0x2')]=_0xeb49[_0x7ef8('0x2')][_0x7ef8('0x36')]();if(_0x48c096[_0x7ef8('0x2')]==='outbound'){if(_0xeb49['hasOwnProperty'](_0x7ef8('0x37'))&&_0xeb49[_0x7ef8('0x37')]&&_0xeb49[_0x7ef8('0x37')]!=='--'){_0x92a91[_0x7ef8('0xb')]({'type':_0xeb49[_0x7ef8('0x2')][_0x7ef8('0x36')](),'app':_0x7ef8('0x7'),'appdata':_0x7ef8('0x38')+_0xeb49[_0x7ef8('0x37')],'context':_0x48c096[_0x7ef8('0x4')],'exten':_0x48c096[_0x7ef8('0x5')],'priority':_0xeb49[_0x7ef8('0x34')]['length']+_0x5cb016+_0x3dbdda++,'VoiceExtensionId':_0x48c096['id']});}_0x92a91[_0x7ef8('0xb')]({'type':_0xeb49['type'][_0x7ef8('0x36')](),'app':_0x7ef8('0x16'),'appdata':_0x7ef8('0x39')+(_0xeb49[_0x7ef8('0x3a')]?_0x7ef8('0x3b')+_0xeb49[_0x7ef8('0x3a')]+')':_0x7ef8('0x3c')),'context':_0x48c096[_0x7ef8('0x4')],'exten':_0x48c096[_0x7ef8('0x5')],'priority':_0xeb49[_0x7ef8('0x34')][_0x7ef8('0x32')]+_0x5cb016+_0x3dbdda++,'VoiceExtensionId':_0x48c096['id']});}else{if(_0xeb49[_0x7ef8('0x1a')](_0x7ef8('0x3d'))){if([_0x7ef8('0x3e'),_0x7ef8('0x3f')]['includes'](_0xeb49['app'][_0x7ef8('0x36')]())&&_0xeb49[_0x7ef8('0x40')]!==_0x7ef8('0x41')){if(_0xeb49['answer']){_0x92a91[_0x7ef8('0xb')]({'type':_0xeb49[_0x7ef8('0x2')]['toLowerCase'](),'app':'ExecIf','appdata':_0x7ef8('0x42'),'context':_0x48c096[_0x7ef8('0x4')],'exten':_0x48c096['exten'],'priority':_0xeb49[_0x7ef8('0x34')][_0x7ef8('0x32')]+_0x5cb016+_0x3dbdda++,'VoiceExtensionId':_0x48c096['id']});_0x92a91[_0x7ef8('0xb')]({'type':_0xeb49[_0x7ef8('0x2')]['toLowerCase'](),'app':_0x7ef8('0x7'),'appdata':_0x7ef8('0x43'),'context':_0x48c096[_0x7ef8('0x4')],'exten':_0x48c096[_0x7ef8('0x5')],'priority':_0xeb49['intervals']['length']+_0x5cb016+_0x3dbdda++,'VoiceExtensionId':_0x48c096['id']});}else{_0x92a91['push']({'type':_0xeb49[_0x7ef8('0x2')][_0x7ef8('0x36')](),'app':'ExecIf','appdata':_0x7ef8('0x44'),'context':_0x48c096[_0x7ef8('0x4')],'exten':_0x48c096[_0x7ef8('0x5')],'priority':_0xeb49[_0x7ef8('0x34')][_0x7ef8('0x32')]+_0x5cb016+_0x3dbdda++,'VoiceExtensionId':_0x48c096['id']});_0x92a91['push']({'type':_0xeb49[_0x7ef8('0x2')]['toLowerCase'](),'app':_0x7ef8('0x7'),'appdata':_0x7ef8('0x45'),'context':_0x48c096[_0x7ef8('0x4')],'exten':_0x48c096[_0x7ef8('0x5')],'priority':_0xeb49[_0x7ef8('0x34')][_0x7ef8('0x32')]+_0x5cb016+_0x3dbdda++,'VoiceExtensionId':_0x48c096['id']});}}}}for(var _0x10e15a=0x0;_0x10e15a<_0xeb49[_0x7ef8('0x34')][_0x7ef8('0x32')];_0x10e15a++){var _0x9f95eb=_0x5cb016+_0xeb49[_0x7ef8('0x34')][_0x7ef8('0x32')];var _0x1b0e51=_0x10e15a===_0xeb49[_0x7ef8('0x34')][_0x7ef8('0x32')]-0x1?_0x5cb016+_0x92a91[_0x7ef8('0x32')]+_0x316aa0[_0x7ef8('0x32')]+0x2:_0x5cb016+_0x10e15a+0x1;_0x92a91[_0x7ef8('0x46')](_0x10e15a,0x0,{'type':_0x48c096[_0x7ef8('0x2')],'app':'GotoIfTime','appdata':_0xeb49[_0x7ef8('0x34')][_0x10e15a]+'?'+_0x48c096[_0x7ef8('0x4')]+_0x7ef8('0x47')+_0x9f95eb+':'+_0x48c096[_0x7ef8('0x4')]+_0x7ef8('0x47')+_0x1b0e51,'exten':_0x48c096['exten'],'context':_0x48c096['context'],'priority':_0x5cb016+_0x10e15a,'VoiceExtensionId':_0x48c096['id']});}if(_0xeb49[_0x7ef8('0x40')]===_0x7ef8('0x48')){_0xeb49[_0x7ef8('0x49')]=_0x553670(_0x48c096,_0xeb49[_0x7ef8('0x49')]);}if(_0xeb49['appType']===_0x7ef8('0x4a')){_0x92a91[_0x7ef8('0xb')]({'type':_0xeb49['type'][_0x7ef8('0x36')](),'app':_0x7ef8('0x7'),'appdata':'XMCS-UNIQUEID=${CHANNEL(LINKEDID)}','context':_0x48c096[_0x7ef8('0x4')],'exten':_0x48c096[_0x7ef8('0x5')],'priority':_0xeb49[_0x7ef8('0x34')][_0x7ef8('0x32')]+_0x5cb016+_0x3dbdda++,'VoiceExtensionId':_0x48c096['id']});}_0xeb49[_0x7ef8('0x4b')]=_0x92a91[_0x7ef8('0x32')]?_[_0x7ef8('0x4c')](_0x92a91)[_0x7ef8('0x4b')]+0x1:_0x5cb016;_0x38982c=_[_0x7ef8('0x4d')](_0x38982c,_0x92a91,[_0xeb49],_0x316aa0);_0x5cb016=_['last'](_0x38982c)[_0x7ef8('0x4b')]+0x1;}return _0xb9607f(_0x38982c);})['catch'](function(_0xcd0b8b){_0x47300a(_0xcd0b8b);});});}return _0x156f7f[_0x7ef8('0x4e')](_0x7ef8('0x4f'),attributes,{'tableName':_0x7ef8('0x50'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x322179){var _0x5a7a69=this['get']({'plain':!![]});var _0x366f66=_0x5a7a69['type']===_0x7ef8('0x10')?_0x3554e7(_0x5a7a69):_0x314a0d(_0x5a7a69);return _0x492273(_0x5a7a69,_0x322179,_[_0x7ef8('0x4c')](_0x366f66)['priority']+0x1)[_0x7ef8('0x31')](function(_0x1537bd){var _0x2b1448=_[_0x7ef8('0x4d')](_0x366f66,_0x1537bd);_0x2b1448['push']({'type':_0x5a7a69[_0x7ef8('0x2')],'app':'Hangup','exten':_0x5a7a69[_0x7ef8('0x5')],'context':_0x5a7a69[_0x7ef8('0x4')],'priority':_[_0x7ef8('0x4c')](_0x2b1448)[_0x7ef8('0x4b')]+0x1,'VoiceExtensionId':_0x5a7a69['id']});return _0x2b1448;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index d58e00f..94bdc26 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 _0x2178=['defaults','localhost','./voiceExtension.socket','register','request','then','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','findAll','options','raw','limit','include','model','attributes','map','GetVoiceExtension','stringify','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis'];(function(_0x31172e,_0xa59e5){var _0x414ada=function(_0x37ede4){while(--_0x37ede4){_0x31172e['push'](_0x31172e['shift']());}};_0x414ada(++_0xa59e5);}(_0x2178,0x1b0));var _0x8217=function(_0x525445,_0x4f8f42){_0x525445=_0x525445-0x0;var _0x48b600=_0x2178[_0x525445];return _0x48b600;};'use strict';var _=require(_0x8217('0x0'));var util=require('util');var moment=require(_0x8217('0x1'));var BPromise=require(_0x8217('0x2'));var rs=require(_0x8217('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8217('0x4'))['db'];var utils=require(_0x8217('0x5'));var logger=require('../../config/logger')(_0x8217('0x6'));var config=require(_0x8217('0x7'));var jayson=require(_0x8217('0x8'));var client=jayson[_0x8217('0x9')][_0x8217('0xa')]({'port':0x232a});config[_0x8217('0xb')]=_[_0x8217('0xc')](config[_0x8217('0xb')],{'host':_0x8217('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x8217('0xe'))[_0x8217('0xf')](socket);function respondWithRpcPromise(_0xe65a16,_0x5f2121,_0xe4d46c){return new BPromise(function(_0x5e5ff3,_0x569eba){return client[_0x8217('0x10')](_0xe65a16,_0xe4d46c)[_0x8217('0x11')](function(_0x3ab032){logger[_0x8217('0x12')](_0x8217('0x13'),_0x5f2121,_0x8217('0x14'));logger[_0x8217('0x15')]('VoiceExtension,\x20%s,\x20%s,\x20%s',_0x5f2121,'request\x20sent',JSON['stringify'](_0x3ab032));if(_0x3ab032[_0x8217('0x16')]){if(_0x3ab032[_0x8217('0x16')][_0x8217('0x17')]===0x1f4){logger[_0x8217('0x16')]('VoiceExtension,\x20%s,\x20%s',_0x5f2121,_0x3ab032[_0x8217('0x16')][_0x8217('0x18')]);return _0x569eba(_0x3ab032[_0x8217('0x16')]['message']);}logger[_0x8217('0x16')](_0x8217('0x13'),_0x5f2121,_0x3ab032[_0x8217('0x16')][_0x8217('0x18')]);return _0x5e5ff3(_0x3ab032[_0x8217('0x16')][_0x8217('0x18')]);}else{logger[_0x8217('0x12')]('VoiceExtension,\x20%s,\x20%s',_0x5f2121,_0x8217('0x14'));_0x5e5ff3(_0x3ab032[_0x8217('0x19')]['message']);}})[_0x8217('0x1a')](function(_0x16d4a9){logger['error']('VoiceExtension,\x20%s,\x20%s',_0x5f2121,_0x16d4a9);_0x569eba(_0x16d4a9);});});}exports['GetVoiceExtension']=function(_0x417105){var _0xf1ec0b=this;return new Promise(function(_0x2ed079,_0xe573c6){return db['VoiceExtension'][_0x8217('0x1b')]({'raw':_0x417105[_0x8217('0x1c')]?_0x417105[_0x8217('0x1c')][_0x8217('0x1d')]===undefined?!![]:![]:!![],'where':_0x417105[_0x8217('0x1c')]?_0x417105[_0x8217('0x1c')]['where']||null:null,'attributes':_0x417105[_0x8217('0x1c')]?_0x417105[_0x8217('0x1c')]['attributes']||null:null,'limit':_0x417105[_0x8217('0x1c')]?_0x417105[_0x8217('0x1c')][_0x8217('0x1e')]||null:null,'include':_0x417105[_0x8217('0x1c')]?_0x417105[_0x8217('0x1c')][_0x8217('0x1f')]?_['map'](_0x417105['options'][_0x8217('0x1f')],function(_0xbb940e){return{'model':db[_0xbb940e[_0x8217('0x20')]],'as':_0xbb940e['as'],'attributes':_0xbb940e[_0x8217('0x21')],'include':_0xbb940e[_0x8217('0x1f')]?_['map'](_0xbb940e[_0x8217('0x1f')],function(_0x1eb568){return{'model':db[_0x1eb568[_0x8217('0x20')]],'as':_0x1eb568['as'],'attributes':_0x1eb568[_0x8217('0x21')],'include':_0x1eb568['include']?_[_0x8217('0x22')](_0x1eb568['include'],function(_0x2ef2f1){return{'model':db[_0x2ef2f1[_0x8217('0x20')]],'as':_0x2ef2f1['as'],'attributes':_0x2ef2f1[_0x8217('0x21')]};}):[]};}):[]};}):[]:[]})[_0x8217('0x11')](function(_0x53eca2){logger[_0x8217('0x12')](_0x8217('0x23'),_0x417105);logger[_0x8217('0x15')](_0x8217('0x23'),_0x417105,JSON[_0x8217('0x24')](_0x53eca2));_0x2ed079(_0x53eca2);})[_0x8217('0x1a')](function(_0x38d858){logger['error']('GetVoiceExtension',_0x38d858[_0x8217('0x18')],_0x417105);_0xe573c6(_0xf1ec0b[_0x8217('0x16')](0x1f4,_0x38d858[_0x8217('0x18')]));});});}; \ No newline at end of file +var _0x9485=['info','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVoiceExtension','VoiceExtension','findAll','options','raw','where','limit','include','map','model','attributes','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','register','request','then'];(function(_0x5a7dbe,_0x586ad8){var _0x558afb=function(_0x13595e){while(--_0x13595e){_0x5a7dbe['push'](_0x5a7dbe['shift']());}};_0x558afb(++_0x586ad8);}(_0x9485,0x8b));var _0x5948=function(_0x590dbb,_0x1d8dd4){_0x590dbb=_0x590dbb-0x0;var _0x53375e=_0x9485[_0x590dbb];return _0x53375e;};'use strict';var _=require(_0x5948('0x0'));var util=require(_0x5948('0x1'));var moment=require(_0x5948('0x2'));var BPromise=require(_0x5948('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5948('0x4'));var db=require(_0x5948('0x5'))['db'];var utils=require(_0x5948('0x6'));var logger=require('../../config/logger')(_0x5948('0x7'));var config=require(_0x5948('0x8'));var jayson=require(_0x5948('0x9'));var client=jayson[_0x5948('0xa')][_0x5948('0xb')]({'port':0x232a});config[_0x5948('0xc')]=_['defaults'](config[_0x5948('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x5948('0xd'))(new Redis(config[_0x5948('0xc')]));require('./voiceExtension.socket')[_0x5948('0xe')](socket);function respondWithRpcPromise(_0x3cd013,_0x515ce8,_0x476902){return new BPromise(function(_0x31cfe4,_0x34e3bb){return client[_0x5948('0xf')](_0x3cd013,_0x476902)[_0x5948('0x10')](function(_0x85c3d2){logger[_0x5948('0x11')](_0x5948('0x12'),_0x515ce8,_0x5948('0x13'));logger[_0x5948('0x14')](_0x5948('0x15'),_0x515ce8,'request\x20sent',JSON[_0x5948('0x16')](_0x85c3d2));if(_0x85c3d2[_0x5948('0x17')]){if(_0x85c3d2[_0x5948('0x17')][_0x5948('0x18')]===0x1f4){logger[_0x5948('0x17')](_0x5948('0x12'),_0x515ce8,_0x85c3d2[_0x5948('0x17')][_0x5948('0x19')]);return _0x34e3bb(_0x85c3d2[_0x5948('0x17')][_0x5948('0x19')]);}logger[_0x5948('0x17')](_0x5948('0x12'),_0x515ce8,_0x85c3d2[_0x5948('0x17')][_0x5948('0x19')]);return _0x31cfe4(_0x85c3d2[_0x5948('0x17')]['message']);}else{logger['info']('VoiceExtension,\x20%s,\x20%s',_0x515ce8,_0x5948('0x13'));_0x31cfe4(_0x85c3d2[_0x5948('0x1a')][_0x5948('0x19')]);}})[_0x5948('0x1b')](function(_0x22cc28){logger[_0x5948('0x17')]('VoiceExtension,\x20%s,\x20%s',_0x515ce8,_0x22cc28);_0x34e3bb(_0x22cc28);});});}exports[_0x5948('0x1c')]=function(_0x1c7419){var _0x21f9fa=this;return new Promise(function(_0x392397,_0x4a4edf){return db[_0x5948('0x1d')][_0x5948('0x1e')]({'raw':_0x1c7419[_0x5948('0x1f')]?_0x1c7419[_0x5948('0x1f')][_0x5948('0x20')]===undefined?!![]:![]:!![],'where':_0x1c7419[_0x5948('0x1f')]?_0x1c7419[_0x5948('0x1f')][_0x5948('0x21')]||null:null,'attributes':_0x1c7419[_0x5948('0x1f')]?_0x1c7419[_0x5948('0x1f')]['attributes']||null:null,'limit':_0x1c7419[_0x5948('0x1f')]?_0x1c7419['options'][_0x5948('0x22')]||null:null,'include':_0x1c7419[_0x5948('0x1f')]?_0x1c7419[_0x5948('0x1f')][_0x5948('0x23')]?_[_0x5948('0x24')](_0x1c7419[_0x5948('0x1f')][_0x5948('0x23')],function(_0xcfc1d7){return{'model':db[_0xcfc1d7['model']],'as':_0xcfc1d7['as'],'attributes':_0xcfc1d7['attributes'],'include':_0xcfc1d7['include']?_[_0x5948('0x24')](_0xcfc1d7[_0x5948('0x23')],function(_0xe4629a){return{'model':db[_0xe4629a['model']],'as':_0xe4629a['as'],'attributes':_0xe4629a['attributes'],'include':_0xe4629a[_0x5948('0x23')]?_['map'](_0xe4629a[_0x5948('0x23')],function(_0x5e5ef3){return{'model':db[_0x5e5ef3[_0x5948('0x25')]],'as':_0x5e5ef3['as'],'attributes':_0x5e5ef3[_0x5948('0x26')]};}):[]};}):[]};}):[]:[]})[_0x5948('0x10')](function(_0x1ad0af){logger[_0x5948('0x11')](_0x5948('0x1c'),_0x1c7419);logger['debug']('GetVoiceExtension',_0x1c7419,JSON[_0x5948('0x16')](_0x1ad0af));_0x392397(_0x1ad0af);})[_0x5948('0x1b')](function(_0x4a6740){logger['error']('GetVoiceExtension',_0x4a6740[_0x5948('0x19')],_0x1c7419);_0x4a4edf(_0x21f9fa[_0x5948('0x17')](0x1f4,_0x4a6740[_0x5948('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index a533728..df2059c 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 _0x5fab=['emit','removeListener','register','length','./voiceExtension.events','save','update'];(function(_0x19eef9,_0x1e7b7a){var _0x46e6e3=function(_0x29adb9){while(--_0x29adb9){_0x19eef9['push'](_0x19eef9['shift']());}};_0x46e6e3(++_0x1e7b7a);}(_0x5fab,0x177));var _0xb5fa=function(_0x538acc,_0x47e62){_0x538acc=_0x538acc-0x0;var _0x3b985a=_0x5fab[_0x538acc];return _0x3b985a;};'use strict';var VoiceExtensionEvents=require(_0xb5fa('0x0'));var events=[_0xb5fa('0x1'),'remove',_0xb5fa('0x2')];function createListener(_0x2e2a50,_0x3fc227){return function(_0x316ad0){_0x3fc227[_0xb5fa('0x3')](_0x2e2a50,_0x316ad0);};}function removeListener(_0x595d8b,_0x29390a){return function(){VoiceExtensionEvents[_0xb5fa('0x4')](_0x595d8b,_0x29390a);};}exports[_0xb5fa('0x5')]=function(_0x44df89){for(var _0x4a0249=0x0,_0x5d70f6=events[_0xb5fa('0x6')];_0x4a0249<_0x5d70f6;_0x4a0249++){var _0x1aec3e=events[_0x4a0249];var _0x9c7bce=createListener('voiceExtension:'+_0x1aec3e,_0x44df89);VoiceExtensionEvents['on'](_0x1aec3e,_0x9c7bce);}}; \ No newline at end of file +var _0x5fc3=['./voiceExtension.events','save','update','emit','removeListener','register','voiceExtension:'];(function(_0x2d518,_0x61c0e9){var _0xdc2ee7=function(_0x473acd){while(--_0x473acd){_0x2d518['push'](_0x2d518['shift']());}};_0xdc2ee7(++_0x61c0e9);}(_0x5fc3,0xa8));var _0x35fc=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0x5fc3[_0x209941];return _0x1e8729;};'use strict';var VoiceExtensionEvents=require(_0x35fc('0x0'));var events=[_0x35fc('0x1'),'remove',_0x35fc('0x2')];function createListener(_0x2ac6da,_0x196bc2){return function(_0x91d024){_0x196bc2[_0x35fc('0x3')](_0x2ac6da,_0x91d024);};}function removeListener(_0x5e75e6,_0x2d1404){return function(){VoiceExtensionEvents[_0x35fc('0x4')](_0x5e75e6,_0x2d1404);};}exports[_0x35fc('0x5')]=function(_0x5b85ad){for(var _0x5754be=0x0,_0x19a0d1=events['length'];_0x5754be<_0x19a0d1;_0x5754be++){var _0x16e153=events[_0x5754be];var _0x27524f=createListener(_0x35fc('0x6')+_0x16e153,_0x5b85ad);VoiceExtensionEvents['on'](_0x16e153,_0x27524f);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index d277725..42d6a1c 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 _0x32f4=['multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceMail.controller','get','isAuthenticated','/:id','getMessages','post','create','update','exports'];(function(_0x6f0dfa,_0x635302){var _0x3fad9f=function(_0xd19f5d){while(--_0xd19f5d){_0x6f0dfa['push'](_0x6f0dfa['shift']());}};_0x3fad9f(++_0x635302);}(_0x32f4,0x154));var _0x432f=function(_0x2a94ae,_0x4cfb47){_0x2a94ae=_0x2a94ae-0x0;var _0x3275bc=_0x32f4[_0x2a94ae];return _0x3275bc;};'use strict';var multer=require(_0x432f('0x0'));var util=require(_0x432f('0x1'));var path=require(_0x432f('0x2'));var timeout=require(_0x432f('0x3'));var express=require('express');var router=express[_0x432f('0x4')]();var fs_extra=require(_0x432f('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x432f('0x6'));var config=require(_0x432f('0x7'));var controller=require(_0x432f('0x8'));router[_0x432f('0x9')]('/',auth[_0x432f('0xa')](),controller['index']);router['get'](_0x432f('0xb'),auth[_0x432f('0xa')](),controller['show']);router[_0x432f('0x9')]('/:id/messages',auth[_0x432f('0xa')](),controller[_0x432f('0xc')]);router[_0x432f('0xd')]('/',auth[_0x432f('0xa')](),controller[_0x432f('0xe')]);router['put'](_0x432f('0xb'),auth['isAuthenticated'](),controller[_0x432f('0xf')]);router['delete'](_0x432f('0xb'),auth[_0x432f('0xa')](),controller['destroy']);module[_0x432f('0x10')]=router; \ No newline at end of file +var _0xeda8=['show','/:id/messages','create','put','/:id','update','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMail.controller','get','isAuthenticated','index'];(function(_0x3e3e86,_0x12dc19){var _0x4bfbd6=function(_0x38a92f){while(--_0x38a92f){_0x3e3e86['push'](_0x3e3e86['shift']());}};_0x4bfbd6(++_0x12dc19);}(_0xeda8,0x104));var _0x8eda=function(_0xb244b4,_0x4f1010){_0xb244b4=_0xb244b4-0x0;var _0x5b5ae7=_0xeda8[_0xb244b4];return _0x5b5ae7;};'use strict';var multer=require(_0x8eda('0x0'));var util=require(_0x8eda('0x1'));var path=require('path');var timeout=require(_0x8eda('0x2'));var express=require(_0x8eda('0x3'));var router=express[_0x8eda('0x4')]();var fs_extra=require(_0x8eda('0x5'));var auth=require(_0x8eda('0x6'));var interaction=require(_0x8eda('0x7'));var config=require(_0x8eda('0x8'));var controller=require(_0x8eda('0x9'));router[_0x8eda('0xa')]('/',auth[_0x8eda('0xb')](),controller[_0x8eda('0xc')]);router[_0x8eda('0xa')]('/:id',auth[_0x8eda('0xb')](),controller[_0x8eda('0xd')]);router[_0x8eda('0xa')](_0x8eda('0xe'),auth['isAuthenticated'](),controller['getMessages']);router['post']('/',auth['isAuthenticated'](),controller[_0x8eda('0xf')]);router[_0x8eda('0x10')](_0x8eda('0x11'),auth['isAuthenticated'](),controller[_0x8eda('0x12')]);router['delete'](_0x8eda('0x11'),auth[_0x8eda('0xb')](),controller[_0x8eda('0x13')]);module[_0x8eda('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 3d930ab..ecab310 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 _0xc09e=['sequelize','exports','STRING','from-voicemail','contest_mailbox','setDataValue','email','string','trim','ENUM','yes','TINYINT(4)','getDataValue','fullname','\x20-\x20','mailbox'];(function(_0x312221,_0x3075b3){var _0x54ac99=function(_0x2752c6){while(--_0x2752c6){_0x312221['push'](_0x312221['shift']());}};_0x54ac99(++_0x3075b3);}(_0xc09e,0x190));var _0xec09=function(_0x1d39fd,_0x2dd8b8){_0x1d39fd=_0x1d39fd-0x0;var _0x56f2c6=_0xc09e[_0x1d39fd];return _0x56f2c6;};'use strict';var Sequelize=require(_0xec09('0x0'));module[_0xec09('0x1')]={'customer_id':{'type':Sequelize[_0xec09('0x2')]},'context':{'type':Sequelize[_0xec09('0x2')],'defaultValue':_0xec09('0x3'),'unique':_0xec09('0x4')},'mailbox':{'type':Sequelize[_0xec09('0x2')],'defaultValue':'','allowNull':![],'unique':_0xec09('0x4')},'password':{'type':Sequelize[_0xec09('0x2')]},'fullname':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0xec09('0x2')],'validate':{'isEmail':!![]},'set':function(_0x311177){this[_0xec09('0x5')](_0xec09('0x6'),typeof _0x311177===_0xec09('0x7')&&_0x311177[_0xec09('0x8')]()?_0x311177[_0xec09('0x8')]():null);}},'pager':{'type':Sequelize[_0xec09('0x2')]},'tz':{'type':Sequelize[_0xec09('0x2')],'defaultValue':'central'},'attach':{'type':Sequelize[_0xec09('0x9')]('yes','no'),'defaultValue':_0xec09('0xa'),'allowNull':![]},'saycid':{'type':Sequelize[_0xec09('0x9')](_0xec09('0xa'),'no'),'defaultValue':_0xec09('0xa'),'allowNull':![]},'dialout':{'type':Sequelize[_0xec09('0x2')]},'callback':{'type':Sequelize[_0xec09('0x2')]},'review':{'type':Sequelize[_0xec09('0x9')](_0xec09('0xa'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0xec09('0x9')](_0xec09('0xa'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0xec09('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0xec09('0x9')](_0xec09('0xa'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0xec09('0xb'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0xec09('0x9')](_0xec09('0xa'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0xec09('0x9')](_0xec09('0xa'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize['ENUM'](_0xec09('0xa'),'no'),'defaultValue':_0xec09('0xa'),'allowNull':![]},'forcename':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0xec09('0x9')](_0xec09('0xa'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize['ENUM'](_0xec09('0xa'),'no'),'defaultValue':_0xec09('0xa'),'allowNull':![]},'stamp':{'type':'TIMESTAMP'},'emailsubject':{'type':Sequelize[_0xec09('0x2')]},'emailbody':{'type':Sequelize['STRING']},'maxsecs':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0xec09('0xc')](_0xec09('0xd'))+_0xec09('0xe')+this[_0xec09('0xc')](_0xec09('0xf'));}}}; \ No newline at end of file +var _0xfbf5=['central','ENUM','yes','TINYINT(4)','INTEGER','VIRTUAL','fullname','\x20-\x20','getDataValue','sequelize','exports','STRING','from-voicemail','contest_mailbox','setDataValue','string','trim'];(function(_0xf823e8,_0x5e0a92){var _0x44c99a=function(_0xc09a6f){while(--_0xc09a6f){_0xf823e8['push'](_0xf823e8['shift']());}};_0x44c99a(++_0x5e0a92);}(_0xfbf5,0xd5));var _0x5fbf=function(_0x1c74e5,_0x1f29ee){_0x1c74e5=_0x1c74e5-0x0;var _0x37b4a2=_0xfbf5[_0x1c74e5];return _0x37b4a2;};'use strict';var Sequelize=require(_0x5fbf('0x0'));module[_0x5fbf('0x1')]={'customer_id':{'type':Sequelize[_0x5fbf('0x2')]},'context':{'type':Sequelize['STRING'],'defaultValue':_0x5fbf('0x3'),'unique':_0x5fbf('0x4')},'mailbox':{'type':Sequelize['STRING'],'defaultValue':'','allowNull':![],'unique':'contest_mailbox'},'password':{'type':Sequelize[_0x5fbf('0x2')]},'fullname':{'type':Sequelize[_0x5fbf('0x2')]},'email':{'type':Sequelize[_0x5fbf('0x2')],'validate':{'isEmail':!![]},'set':function(_0x2c0adc){this[_0x5fbf('0x5')]('email',typeof _0x2c0adc===_0x5fbf('0x6')&&_0x2c0adc[_0x5fbf('0x7')]()?_0x2c0adc[_0x5fbf('0x7')]():null);}},'pager':{'type':Sequelize[_0x5fbf('0x2')]},'tz':{'type':Sequelize[_0x5fbf('0x2')],'defaultValue':_0x5fbf('0x8')},'attach':{'type':Sequelize[_0x5fbf('0x9')]('yes','no'),'defaultValue':'yes','allowNull':![]},'saycid':{'type':Sequelize['ENUM'](_0x5fbf('0xa'),'no'),'defaultValue':'yes','allowNull':![]},'dialout':{'type':Sequelize[_0x5fbf('0x2')]},'callback':{'type':Sequelize[_0x5fbf('0x2')]},'review':{'type':Sequelize[_0x5fbf('0x9')](_0x5fbf('0xa'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize['ENUM'](_0x5fbf('0xa'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x5fbf('0x9')](_0x5fbf('0xa'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x5fbf('0x9')](_0x5fbf('0xa'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x5fbf('0xb'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x5fbf('0x9')](_0x5fbf('0xa'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x5fbf('0x9')](_0x5fbf('0xa'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize['ENUM'](_0x5fbf('0xa'),'no'),'defaultValue':_0x5fbf('0xa'),'allowNull':![]},'forcename':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x5fbf('0x9')](_0x5fbf('0xa'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize['ENUM'](_0x5fbf('0xa'),'no'),'defaultValue':_0x5fbf('0xa'),'allowNull':![]},'stamp':{'type':'TIMESTAMP'},'emailsubject':{'type':Sequelize[_0x5fbf('0x2')]},'emailbody':{'type':Sequelize[_0x5fbf('0x2')]},'maxsecs':{'type':Sequelize[_0x5fbf('0xc')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x5fbf('0xc')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x5fbf('0xd')],'get':function(){return this['getDataValue'](_0x5fbf('0xe'))+_0x5fbf('0xf')+this[_0x5fbf('0x10')]('mailbox');}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index 747a2f6..26c9fd7 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 _0x7916=['update','then','get','destroy','end','error','name','send','index','map','VoiceMail','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','length','attributes','nolimit','sort','where','merge','VIRTUAL','filter','options','includeAll','findAll','rows','catch','params','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','getMessages','VoiceMailMessage','hasOwnProperty','pick','mailbox','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','ejs','fs-extra','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','undefined','limit','count','offset','set','Content-Range','reject'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x7916,0x128));var _0x6791=function(_0x3c15fc,_0x466a9c){_0x3c15fc=_0x3c15fc-0x0;var _0x50ac77=_0x7916[_0x3c15fc];return _0x50ac77;};'use strict';var emlformat=require(_0x6791('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6791('0x1'));var jsonpatch=require(_0x6791('0x2'));var rp=require('request-promise');var moment=require(_0x6791('0x3'));var BPromise=require(_0x6791('0x4'));var Mustache=require(_0x6791('0x5'));var util=require(_0x6791('0x6'));var path=require('path');var sox=require(_0x6791('0x7'));var csv=require('to-csv');var ejs=require(_0x6791('0x8'));var fs=require('fs');var fs_extra=require(_0x6791('0x9'));var _=require('lodash');var squel=require(_0x6791('0xa'));var crypto=require('crypto');var jsforce=require(_0x6791('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6791('0xc'));var Papa=require(_0x6791('0xd'));var Redis=require('ioredis');var authService=require(_0x6791('0xe'));var qs=require(_0x6791('0xf'));var as=require(_0x6791('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6791('0x11'))(_0x6791('0x12'));var utils=require(_0x6791('0x13'));var config=require(_0x6791('0x14'));var licenseUtil=require(_0x6791('0x15'));var db=require(_0x6791('0x16'))['db'];function respondWithStatusCode(_0x61ac73,_0x16c62b){_0x16c62b=_0x16c62b||0xcc;return function(_0x423e22){if(_0x423e22){return _0x61ac73[_0x6791('0x17')](_0x16c62b);}return _0x61ac73[_0x6791('0x18')](_0x16c62b)['end']();};}function respondWithResult(_0x4b1719,_0x34b28d){_0x34b28d=_0x34b28d||0xc8;return function(_0x5122f9){if(_0x5122f9){return _0x4b1719[_0x6791('0x18')](_0x34b28d)['json'](_0x5122f9);}};}function respondWithFilteredResult(_0x3be9f0,_0x163898){return function(_0x517910){if(_0x517910){var _0x3e4792=typeof _0x163898['offset']===_0x6791('0x19')&&typeof _0x163898[_0x6791('0x1a')]==='undefined';var _0xbc35d=_0x517910[_0x6791('0x1b')];var _0x5bec14=_0x3e4792?0x0:_0x163898[_0x6791('0x1c')];var _0x4d8a79=_0x3e4792?_0x517910[_0x6791('0x1b')]:_0x163898[_0x6791('0x1c')]+_0x163898[_0x6791('0x1a')];var _0x3a72ce;if(_0x4d8a79>=_0xbc35d){_0x4d8a79=_0xbc35d;_0x3a72ce=0xc8;}else{_0x3a72ce=0xce;}_0x3be9f0[_0x6791('0x18')](_0x3a72ce);return _0x3be9f0[_0x6791('0x1d')](_0x6791('0x1e'),_0x5bec14+'-'+_0x4d8a79+'/'+_0xbc35d)['json'](_0x517910);}return null;};}function patchUpdates(_0x4a2922){return function(_0x306acb){try{jsonpatch['apply'](_0x306acb,_0x4a2922,!![]);}catch(_0x21ef16){return BPromise[_0x6791('0x1f')](_0x21ef16);}return _0x306acb['save']();};}function saveUpdates(_0x17f200,_0x309610){return function(_0x15b9ab){if(_0x15b9ab){return _0x15b9ab[_0x6791('0x20')](_0x17f200)['then'](function(_0x3e17b3){return _0x3e17b3;});}return null;};}function removeEntity(_0x1b516d,_0x4a8717){return function(_0x53bb44){if(_0x53bb44){return _0x53bb44['destroy']()[_0x6791('0x21')](function(){var _0x502043=_0x53bb44[_0x6791('0x22')]({'plain':!![]});var _0x5409f1='Voicemails';return db['UserProfileResource'][_0x6791('0x23')]({'where':{'type':_0x5409f1,'resourceId':_0x502043['id']}})[_0x6791('0x21')](function(){return _0x53bb44;});})[_0x6791('0x21')](function(){_0x1b516d['status'](0xcc)[_0x6791('0x24')]();});}};}function handleEntityNotFound(_0x30cc17,_0x493a59){return function(_0x342107){if(!_0x342107){_0x30cc17['sendStatus'](0x194);}return _0x342107;};}function handleError(_0x424b0e,_0x49dd24){_0x49dd24=_0x49dd24||0x1f4;return function(_0x4fc5d5){logger[_0x6791('0x25')](_0x4fc5d5['stack']);if(_0x4fc5d5[_0x6791('0x26')]){delete _0x4fc5d5[_0x6791('0x26')];}_0x424b0e['status'](_0x49dd24)[_0x6791('0x27')](_0x4fc5d5);};}exports[_0x6791('0x28')]=function(_0x234c5e,_0xd36448){var _0x5d9d54={},_0x4f91d6={},_0x348b9c={'count':0x0,'rows':[]};var _0x5e5ac3=_[_0x6791('0x29')](db[_0x6791('0x2a')][_0x6791('0x2b')],function(_0x2b98b8){return{'name':_0x2b98b8[_0x6791('0x2c')],'type':_0x2b98b8[_0x6791('0x2d')][_0x6791('0x2e')]};});_0x4f91d6[_0x6791('0x2f')]=_[_0x6791('0x29')](_0x5e5ac3,_0x6791('0x26'));_0x4f91d6['query']=_[_0x6791('0x30')](_0x234c5e[_0x6791('0x31')]);_0x4f91d6[_0x6791('0x32')]=_[_0x6791('0x33')](_0x4f91d6[_0x6791('0x2f')],_0x4f91d6[_0x6791('0x31')]);_0x5d9d54['attributes']=_['intersection'](_0x4f91d6['model'],qs[_0x6791('0x34')](_0x234c5e[_0x6791('0x31')][_0x6791('0x34')]));_0x5d9d54['attributes']=_0x5d9d54['attributes'][_0x6791('0x35')]?_0x5d9d54[_0x6791('0x36')]:_0x4f91d6[_0x6791('0x2f')];if(!_0x234c5e[_0x6791('0x31')]['hasOwnProperty'](_0x6791('0x37'))){_0x5d9d54[_0x6791('0x1a')]=qs[_0x6791('0x1a')](_0x234c5e['query'][_0x6791('0x1a')]);_0x5d9d54['offset']=qs['offset'](_0x234c5e[_0x6791('0x31')][_0x6791('0x1c')]);}_0x5d9d54['order']=qs[_0x6791('0x38')](_0x234c5e[_0x6791('0x31')][_0x6791('0x38')]);_0x5d9d54[_0x6791('0x39')]=qs[_0x6791('0x32')](_['pick'](_0x234c5e[_0x6791('0x31')],_0x4f91d6[_0x6791('0x32')]),_0x5e5ac3);if(_0x234c5e[_0x6791('0x31')]['filter']){_0x5d9d54[_0x6791('0x39')]=_[_0x6791('0x3a')](_0x5d9d54[_0x6791('0x39')],{'$or':_['map'](_0x5e5ac3,function(_0x11a012){if(_0x11a012[_0x6791('0x2d')]!==_0x6791('0x3b')){var _0x122aa5={};_0x122aa5[_0x11a012['name']]={'$like':'%'+_0x234c5e[_0x6791('0x31')][_0x6791('0x3c')]+'%'};return _0x122aa5;}})});}_0x5d9d54=_[_0x6791('0x3a')]({},_0x5d9d54,_0x234c5e[_0x6791('0x3d')]);var _0x12f121={'where':_0x5d9d54[_0x6791('0x39')]};return db[_0x6791('0x2a')][_0x6791('0x1b')](_0x12f121)[_0x6791('0x21')](function(_0x4e4004){_0x348b9c['count']=_0x4e4004;if(_0x234c5e[_0x6791('0x31')][_0x6791('0x3e')]){_0x5d9d54['include']=[{'all':!![]}];}return db[_0x6791('0x2a')][_0x6791('0x3f')](_0x5d9d54);})[_0x6791('0x21')](function(_0x3edb86){_0x348b9c[_0x6791('0x40')]=_0x3edb86;return _0x348b9c;})[_0x6791('0x21')](respondWithFilteredResult(_0xd36448,_0x5d9d54))[_0x6791('0x41')](handleError(_0xd36448,null));};exports['show']=function(_0xb3bea8,_0x4b9fca){var _0x17ecf0={'raw':!![],'where':{'id':_0xb3bea8[_0x6791('0x42')]['id']}},_0xfc170e={};_0xfc170e[_0x6791('0x2f')]=_['keys'](db[_0x6791('0x2a')][_0x6791('0x2b')]);_0xfc170e[_0x6791('0x31')]=_[_0x6791('0x30')](_0xb3bea8[_0x6791('0x31')]);_0xfc170e[_0x6791('0x32')]=_[_0x6791('0x33')](_0xfc170e[_0x6791('0x2f')],_0xfc170e['query']);_0x17ecf0[_0x6791('0x36')]=_[_0x6791('0x33')](_0xfc170e[_0x6791('0x2f')],qs[_0x6791('0x34')](_0xb3bea8['query'][_0x6791('0x34')]));_0x17ecf0[_0x6791('0x36')]=_0x17ecf0['attributes'][_0x6791('0x35')]?_0x17ecf0['attributes']:_0xfc170e[_0x6791('0x2f')];if(_0xb3bea8[_0x6791('0x31')][_0x6791('0x3e')]){_0x17ecf0[_0x6791('0x43')]=[{'all':!![]}];}_0x17ecf0=_[_0x6791('0x3a')]({},_0x17ecf0,_0xb3bea8[_0x6791('0x3d')]);return db[_0x6791('0x2a')][_0x6791('0x44')](_0x17ecf0)[_0x6791('0x21')](handleEntityNotFound(_0x4b9fca,null))['then'](respondWithResult(_0x4b9fca,null))[_0x6791('0x41')](handleError(_0x4b9fca,null));};exports['create']=function(_0x10e806,_0x2bb86a){return db[_0x6791('0x2a')][_0x6791('0x45')](_0x10e806[_0x6791('0x46')],{})['then'](function(_0x2bc08d){var _0x35e087=_0x10e806[_0x6791('0x47')][_0x6791('0x22')]({'plain':!![]});if(!_0x35e087)throw new Error(_0x6791('0x48'));if(_0x35e087['role']===_0x6791('0x47')){var _0x42948b=_0x2bc08d['get']({'plain':!![]});var _0x3df699='Voicemails';return db[_0x6791('0x49')][_0x6791('0x44')]({'where':{'name':_0x3df699,'userProfileId':_0x35e087[_0x6791('0x4a')]},'raw':!![]})[_0x6791('0x21')](function(_0x558069){if(_0x558069&&_0x558069[_0x6791('0x4b')]===0x0){return db[_0x6791('0x4c')]['create']({'name':_0x42948b[_0x6791('0x26')],'resourceId':_0x42948b['id'],'type':_0x558069[_0x6791('0x26')],'sectionId':_0x558069['id']},{})[_0x6791('0x21')](function(){return _0x2bc08d;});}else{return _0x2bc08d;}})['catch'](function(_0x355e97){logger[_0x6791('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x355e97);throw _0x355e97;});}return _0x2bc08d;})[_0x6791('0x21')](respondWithResult(_0x2bb86a,0xc9))[_0x6791('0x41')](handleError(_0x2bb86a,null));};exports['update']=function(_0x169531,_0x216498){if(_0x169531[_0x6791('0x46')]['id']){delete _0x169531[_0x6791('0x46')]['id'];}return db['VoiceMail'][_0x6791('0x44')]({'where':{'id':_0x169531[_0x6791('0x42')]['id']}})[_0x6791('0x21')](handleEntityNotFound(_0x216498,null))['then'](saveUpdates(_0x169531['body'],null))[_0x6791('0x21')](respondWithResult(_0x216498,null))[_0x6791('0x41')](handleError(_0x216498,null));};exports[_0x6791('0x23')]=function(_0x45756f,_0x288f05){return db['VoiceMail']['find']({'where':{'id':_0x45756f[_0x6791('0x42')]['id']}})['then'](handleEntityNotFound(_0x288f05,null))['then'](removeEntity(_0x288f05,null))[_0x6791('0x41')](handleError(_0x288f05,null));};exports[_0x6791('0x4d')]=function(_0x2cb48e,_0x10b41b,_0x13089d){return db[_0x6791('0x2a')]['findOne']({'where':{'id':_0x2cb48e['params']['id']}})[_0x6791('0x21')](handleEntityNotFound(_0x10b41b,null))[_0x6791('0x21')](function(_0x56e424){var _0x44b1df;var _0x535ecf={},_0x473443={};_0x473443[_0x6791('0x2f')]=_['keys'](db[_0x6791('0x4e')][_0x6791('0x2b')]);_0x473443[_0x6791('0x31')]=_['keys'](_0x2cb48e[_0x6791('0x31')]);_0x473443[_0x6791('0x32')]=_[_0x6791('0x33')](_0x473443[_0x6791('0x2f')],_0x473443[_0x6791('0x31')]);_0x535ecf['attributes']=_['intersection'](_0x473443[_0x6791('0x2f')],qs[_0x6791('0x34')](_0x2cb48e['query'][_0x6791('0x34')]));_0x535ecf[_0x6791('0x36')]=_0x535ecf[_0x6791('0x36')][_0x6791('0x35')]?_0x535ecf[_0x6791('0x36')]:_0x473443[_0x6791('0x2f')];if(!_0x2cb48e[_0x6791('0x31')][_0x6791('0x4f')]('nolimit')){_0x535ecf[_0x6791('0x1a')]=qs[_0x6791('0x1a')](_0x2cb48e[_0x6791('0x31')][_0x6791('0x1a')]);_0x535ecf['offset']=qs[_0x6791('0x1c')](_0x2cb48e[_0x6791('0x31')][_0x6791('0x1c')]);}_0x535ecf['order']=qs[_0x6791('0x38')](_0x2cb48e[_0x6791('0x31')][_0x6791('0x38')]);_0x535ecf[_0x6791('0x39')]=qs['filters'](_[_0x6791('0x50')](_0x2cb48e[_0x6791('0x31')],_0x473443['filters']));if(_0x2cb48e[_0x6791('0x31')][_0x6791('0x3c')]){_0x535ecf[_0x6791('0x39')]=_[_0x6791('0x3a')](_0x535ecf[_0x6791('0x39')],{'$or':_[_0x6791('0x29')](_0x535ecf['attributes'],function(_0x301f2f){var _0x33caf0={};_0x33caf0[_0x301f2f]={'$like':'%'+_0x2cb48e[_0x6791('0x31')]['filter']+'%'};return _0x33caf0;})});}_0x535ecf[_0x6791('0x39')]=_['merge'](_0x535ecf[_0x6791('0x39')],{'mailboxuser':_0x56e424[_0x6791('0x51')]});_0x535ecf=_[_0x6791('0x3a')]({},_0x535ecf,_0x2cb48e[_0x6791('0x3d')]);return db[_0x6791('0x4e')]['findAndCountAll'](_0x535ecf)[_0x6791('0x21')](respondWithFilteredResult(_0x10b41b,_0x535ecf));})[_0x6791('0x41')](handleError(_0x10b41b,null));}; \ No newline at end of file +var _0x9c00=['name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','offset','order','sort','pick','filter','merge','where','VIRTUAL','options','VoiceMail','includeAll','include','rows','catch','show','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','getMessages','findOne','VoiceMailMessage','mailbox','findAndCountAll','eml-format','rimraf','request-promise','moment','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','Content-Range','apply','reject','update','destroy','get','Voicemails','UserProfileResource','then','stack'];(function(_0x237dda,_0x4fb956){var _0x3c2bed=function(_0x5eb03b){while(--_0x5eb03b){_0x237dda['push'](_0x237dda['shift']());}};_0x3c2bed(++_0x4fb956);}(_0x9c00,0x1a0));var _0x09c0=function(_0x32bff9,_0x3f27d5){_0x32bff9=_0x32bff9-0x0;var _0xbab93=_0x9c00[_0x32bff9];return _0xbab93;};'use strict';var emlformat=require(_0x09c0('0x0'));var rimraf=require(_0x09c0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x09c0('0x2'));var moment=require(_0x09c0('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x09c0('0x4'));var util=require(_0x09c0('0x5'));var path=require(_0x09c0('0x6'));var sox=require(_0x09c0('0x7'));var csv=require(_0x09c0('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x09c0('0x9'));var squel=require(_0x09c0('0xa'));var crypto=require(_0x09c0('0xb'));var jsforce=require(_0x09c0('0xc'));var deskjs=require(_0x09c0('0xd'));var toCsv=require('to-csv');var querystring=require(_0x09c0('0xe'));var Papa=require(_0x09c0('0xf'));var Redis=require(_0x09c0('0x10'));var authService=require(_0x09c0('0x11'));var qs=require(_0x09c0('0x12'));var as=require(_0x09c0('0x13'));var hardwareService=require(_0x09c0('0x14'));var logger=require(_0x09c0('0x15'))(_0x09c0('0x16'));var utils=require(_0x09c0('0x17'));var config=require(_0x09c0('0x18'));var licenseUtil=require(_0x09c0('0x19'));var db=require(_0x09c0('0x1a'))['db'];function respondWithStatusCode(_0x144271,_0x3b95cc){_0x3b95cc=_0x3b95cc||0xcc;return function(_0x331905){if(_0x331905){return _0x144271[_0x09c0('0x1b')](_0x3b95cc);}return _0x144271[_0x09c0('0x1c')](_0x3b95cc)[_0x09c0('0x1d')]();};}function respondWithResult(_0x3649d2,_0x16e490){_0x16e490=_0x16e490||0xc8;return function(_0x254598){if(_0x254598){return _0x3649d2[_0x09c0('0x1c')](_0x16e490)[_0x09c0('0x1e')](_0x254598);}};}function respondWithFilteredResult(_0x33c3d6,_0x2fdf11){return function(_0x4ff6b7){if(_0x4ff6b7){var _0x590129=typeof _0x2fdf11['offset']===_0x09c0('0x1f')&&typeof _0x2fdf11[_0x09c0('0x20')]===_0x09c0('0x1f');var _0x628272=_0x4ff6b7['count'];var _0x2c4440=_0x590129?0x0:_0x2fdf11['offset'];var _0x4c29a7=_0x590129?_0x4ff6b7[_0x09c0('0x21')]:_0x2fdf11['offset']+_0x2fdf11[_0x09c0('0x20')];var _0x319c36;if(_0x4c29a7>=_0x628272){_0x4c29a7=_0x628272;_0x319c36=0xc8;}else{_0x319c36=0xce;}_0x33c3d6[_0x09c0('0x1c')](_0x319c36);return _0x33c3d6['set'](_0x09c0('0x22'),_0x2c4440+'-'+_0x4c29a7+'/'+_0x628272)[_0x09c0('0x1e')](_0x4ff6b7);}return null;};}function patchUpdates(_0x8ad645){return function(_0x3447c5){try{jsonpatch[_0x09c0('0x23')](_0x3447c5,_0x8ad645,!![]);}catch(_0xa5d16f){return BPromise[_0x09c0('0x24')](_0xa5d16f);}return _0x3447c5['save']();};}function saveUpdates(_0x1695e8,_0x46f171){return function(_0x473fbd){if(_0x473fbd){return _0x473fbd[_0x09c0('0x25')](_0x1695e8)['then'](function(_0x4f6824){return _0x4f6824;});}return null;};}function removeEntity(_0x321bcc,_0x25fdb5){return function(_0x1e8a1c){if(_0x1e8a1c){return _0x1e8a1c[_0x09c0('0x26')]()['then'](function(){var _0x42ebfc=_0x1e8a1c[_0x09c0('0x27')]({'plain':!![]});var _0x56d883=_0x09c0('0x28');return db[_0x09c0('0x29')][_0x09c0('0x26')]({'where':{'type':_0x56d883,'resourceId':_0x42ebfc['id']}})[_0x09c0('0x2a')](function(){return _0x1e8a1c;});})[_0x09c0('0x2a')](function(){_0x321bcc[_0x09c0('0x1c')](0xcc)[_0x09c0('0x1d')]();});}};}function handleEntityNotFound(_0x35b61c,_0x1ea951){return function(_0x1aa80e){if(!_0x1aa80e){_0x35b61c[_0x09c0('0x1b')](0x194);}return _0x1aa80e;};}function handleError(_0x5e53ac,_0x15a667){_0x15a667=_0x15a667||0x1f4;return function(_0x1bdde9){logger['error'](_0x1bdde9[_0x09c0('0x2b')]);if(_0x1bdde9['name']){delete _0x1bdde9[_0x09c0('0x2c')];}_0x5e53ac['status'](_0x15a667)[_0x09c0('0x2d')](_0x1bdde9);};}exports[_0x09c0('0x2e')]=function(_0x108409,_0x4159bc){var _0x4e999a={},_0x5478b7={},_0x17c374={'count':0x0,'rows':[]};var _0x38a315=_[_0x09c0('0x2f')](db['VoiceMail'][_0x09c0('0x30')],function(_0x4bdae9){return{'name':_0x4bdae9[_0x09c0('0x31')],'type':_0x4bdae9[_0x09c0('0x32')][_0x09c0('0x33')]};});_0x5478b7['model']=_[_0x09c0('0x2f')](_0x38a315,_0x09c0('0x2c'));_0x5478b7[_0x09c0('0x34')]=_[_0x09c0('0x35')](_0x108409[_0x09c0('0x34')]);_0x5478b7[_0x09c0('0x36')]=_[_0x09c0('0x37')](_0x5478b7['model'],_0x5478b7[_0x09c0('0x34')]);_0x4e999a[_0x09c0('0x38')]=_[_0x09c0('0x37')](_0x5478b7[_0x09c0('0x39')],qs[_0x09c0('0x3a')](_0x108409['query'][_0x09c0('0x3a')]));_0x4e999a[_0x09c0('0x38')]=_0x4e999a[_0x09c0('0x38')][_0x09c0('0x3b')]?_0x4e999a[_0x09c0('0x38')]:_0x5478b7['model'];if(!_0x108409[_0x09c0('0x34')][_0x09c0('0x3c')](_0x09c0('0x3d'))){_0x4e999a[_0x09c0('0x20')]=qs[_0x09c0('0x20')](_0x108409[_0x09c0('0x34')][_0x09c0('0x20')]);_0x4e999a['offset']=qs[_0x09c0('0x3e')](_0x108409[_0x09c0('0x34')][_0x09c0('0x3e')]);}_0x4e999a[_0x09c0('0x3f')]=qs[_0x09c0('0x40')](_0x108409['query']['sort']);_0x4e999a['where']=qs['filters'](_[_0x09c0('0x41')](_0x108409[_0x09c0('0x34')],_0x5478b7[_0x09c0('0x36')]),_0x38a315);if(_0x108409[_0x09c0('0x34')][_0x09c0('0x42')]){_0x4e999a['where']=_[_0x09c0('0x43')](_0x4e999a[_0x09c0('0x44')],{'$or':_['map'](_0x38a315,function(_0x1067cf){if(_0x1067cf['type']!==_0x09c0('0x45')){var _0x5c80a2={};_0x5c80a2[_0x1067cf[_0x09c0('0x2c')]]={'$like':'%'+_0x108409[_0x09c0('0x34')]['filter']+'%'};return _0x5c80a2;}})});}_0x4e999a=_[_0x09c0('0x43')]({},_0x4e999a,_0x108409[_0x09c0('0x46')]);var _0x5d69fd={'where':_0x4e999a[_0x09c0('0x44')]};return db[_0x09c0('0x47')][_0x09c0('0x21')](_0x5d69fd)[_0x09c0('0x2a')](function(_0xeb8191){_0x17c374[_0x09c0('0x21')]=_0xeb8191;if(_0x108409['query'][_0x09c0('0x48')]){_0x4e999a[_0x09c0('0x49')]=[{'all':!![]}];}return db[_0x09c0('0x47')]['findAll'](_0x4e999a);})[_0x09c0('0x2a')](function(_0x30c0c5){_0x17c374[_0x09c0('0x4a')]=_0x30c0c5;return _0x17c374;})['then'](respondWithFilteredResult(_0x4159bc,_0x4e999a))[_0x09c0('0x4b')](handleError(_0x4159bc,null));};exports[_0x09c0('0x4c')]=function(_0x52cd5c,_0x5bbf4e){var _0x397e73={'raw':!![],'where':{'id':_0x52cd5c['params']['id']}},_0x471078={};_0x471078[_0x09c0('0x39')]=_[_0x09c0('0x35')](db['VoiceMail'][_0x09c0('0x30')]);_0x471078[_0x09c0('0x34')]=_[_0x09c0('0x35')](_0x52cd5c[_0x09c0('0x34')]);_0x471078[_0x09c0('0x36')]=_['intersection'](_0x471078[_0x09c0('0x39')],_0x471078['query']);_0x397e73['attributes']=_[_0x09c0('0x37')](_0x471078[_0x09c0('0x39')],qs[_0x09c0('0x3a')](_0x52cd5c[_0x09c0('0x34')][_0x09c0('0x3a')]));_0x397e73[_0x09c0('0x38')]=_0x397e73['attributes']['length']?_0x397e73['attributes']:_0x471078[_0x09c0('0x39')];if(_0x52cd5c[_0x09c0('0x34')][_0x09c0('0x48')]){_0x397e73['include']=[{'all':!![]}];}_0x397e73=_[_0x09c0('0x43')]({},_0x397e73,_0x52cd5c[_0x09c0('0x46')]);return db[_0x09c0('0x47')][_0x09c0('0x4d')](_0x397e73)[_0x09c0('0x2a')](handleEntityNotFound(_0x5bbf4e,null))[_0x09c0('0x2a')](respondWithResult(_0x5bbf4e,null))[_0x09c0('0x4b')](handleError(_0x5bbf4e,null));};exports[_0x09c0('0x4e')]=function(_0x3f6d14,_0x38085c){return db[_0x09c0('0x47')][_0x09c0('0x4e')](_0x3f6d14[_0x09c0('0x4f')],{})[_0x09c0('0x2a')](function(_0x332b69){var _0x32abbe=_0x3f6d14[_0x09c0('0x50')][_0x09c0('0x27')]({'plain':!![]});if(!_0x32abbe)throw new Error(_0x09c0('0x51'));if(_0x32abbe[_0x09c0('0x52')]==='user'){var _0x4acf54=_0x332b69[_0x09c0('0x27')]({'plain':!![]});var _0x15b0a2=_0x09c0('0x28');return db[_0x09c0('0x53')]['find']({'where':{'name':_0x15b0a2,'userProfileId':_0x32abbe[_0x09c0('0x54')]},'raw':!![]})[_0x09c0('0x2a')](function(_0x1823c2){if(_0x1823c2&&_0x1823c2['autoAssociation']===0x0){return db[_0x09c0('0x29')][_0x09c0('0x4e')]({'name':_0x4acf54[_0x09c0('0x2c')],'resourceId':_0x4acf54['id'],'type':_0x1823c2[_0x09c0('0x2c')],'sectionId':_0x1823c2['id']},{})[_0x09c0('0x2a')](function(){return _0x332b69;});}else{return _0x332b69;}})[_0x09c0('0x4b')](function(_0x45ecd0){logger['error'](_0x09c0('0x55'),_0x45ecd0);throw _0x45ecd0;});}return _0x332b69;})[_0x09c0('0x2a')](respondWithResult(_0x38085c,0xc9))[_0x09c0('0x4b')](handleError(_0x38085c,null));};exports[_0x09c0('0x25')]=function(_0x21fe00,_0x316fbd){if(_0x21fe00[_0x09c0('0x4f')]['id']){delete _0x21fe00['body']['id'];}return db['VoiceMail'][_0x09c0('0x4d')]({'where':{'id':_0x21fe00[_0x09c0('0x56')]['id']}})[_0x09c0('0x2a')](handleEntityNotFound(_0x316fbd,null))['then'](saveUpdates(_0x21fe00[_0x09c0('0x4f')],null))['then'](respondWithResult(_0x316fbd,null))[_0x09c0('0x4b')](handleError(_0x316fbd,null));};exports[_0x09c0('0x26')]=function(_0x42d4dd,_0x290618){return db[_0x09c0('0x47')][_0x09c0('0x4d')]({'where':{'id':_0x42d4dd[_0x09c0('0x56')]['id']}})['then'](handleEntityNotFound(_0x290618,null))[_0x09c0('0x2a')](removeEntity(_0x290618,null))[_0x09c0('0x4b')](handleError(_0x290618,null));};exports[_0x09c0('0x57')]=function(_0x270ff2,_0x3a6845,_0x219195){return db[_0x09c0('0x47')][_0x09c0('0x58')]({'where':{'id':_0x270ff2[_0x09c0('0x56')]['id']}})[_0x09c0('0x2a')](handleEntityNotFound(_0x3a6845,null))[_0x09c0('0x2a')](function(_0x4c4339){var _0x34cc0a;var _0x3564e6={},_0x26dc22={};_0x26dc22[_0x09c0('0x39')]=_['keys'](db[_0x09c0('0x59')]['rawAttributes']);_0x26dc22[_0x09c0('0x34')]=_[_0x09c0('0x35')](_0x270ff2[_0x09c0('0x34')]);_0x26dc22['filters']=_['intersection'](_0x26dc22[_0x09c0('0x39')],_0x26dc22[_0x09c0('0x34')]);_0x3564e6[_0x09c0('0x38')]=_[_0x09c0('0x37')](_0x26dc22['model'],qs[_0x09c0('0x3a')](_0x270ff2[_0x09c0('0x34')]['fields']));_0x3564e6[_0x09c0('0x38')]=_0x3564e6[_0x09c0('0x38')][_0x09c0('0x3b')]?_0x3564e6[_0x09c0('0x38')]:_0x26dc22['model'];if(!_0x270ff2[_0x09c0('0x34')][_0x09c0('0x3c')](_0x09c0('0x3d'))){_0x3564e6[_0x09c0('0x20')]=qs[_0x09c0('0x20')](_0x270ff2[_0x09c0('0x34')][_0x09c0('0x20')]);_0x3564e6[_0x09c0('0x3e')]=qs[_0x09c0('0x3e')](_0x270ff2[_0x09c0('0x34')][_0x09c0('0x3e')]);}_0x3564e6[_0x09c0('0x3f')]=qs[_0x09c0('0x40')](_0x270ff2['query'][_0x09c0('0x40')]);_0x3564e6[_0x09c0('0x44')]=qs[_0x09c0('0x36')](_[_0x09c0('0x41')](_0x270ff2[_0x09c0('0x34')],_0x26dc22['filters']));if(_0x270ff2[_0x09c0('0x34')][_0x09c0('0x42')]){_0x3564e6[_0x09c0('0x44')]=_[_0x09c0('0x43')](_0x3564e6['where'],{'$or':_[_0x09c0('0x2f')](_0x3564e6[_0x09c0('0x38')],function(_0x569462){var _0x325013={};_0x325013[_0x569462]={'$like':'%'+_0x270ff2[_0x09c0('0x34')][_0x09c0('0x42')]+'%'};return _0x325013;})});}_0x3564e6[_0x09c0('0x44')]=_[_0x09c0('0x43')](_0x3564e6['where'],{'mailboxuser':_0x4c4339[_0x09c0('0x5a')]});_0x3564e6=_[_0x09c0('0x43')]({},_0x3564e6,_0x270ff2[_0x09c0('0x46')]);return db[_0x09c0('0x59')][_0x09c0('0x5b')](_0x3564e6)['then'](respondWithFilteredResult(_0x3a6845,_0x3564e6));})[_0x09c0('0x4b')](handleError(_0x3a6845,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index 7f7aa13..830e77f 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 _0x34b4=['context','lodash','../../config/logger','api','moment','path','rimraf','../../config/environment','./voiceMail.attributes','exports','define','VoiceMail','voice_voicemail','mailbox_context','mailbox'];(function(_0x5f0089,_0x227e2c){var _0x193892=function(_0x24051f){while(--_0x24051f){_0x5f0089['push'](_0x5f0089['shift']());}};_0x193892(++_0x227e2c);}(_0x34b4,0x100));var _0x434b=function(_0x32f17e,_0x3e37fb){_0x32f17e=_0x32f17e-0x0;var _0x143bf6=_0x34b4[_0x32f17e];return _0x143bf6;};'use strict';var _=require(_0x434b('0x0'));var util=require('util');var logger=require(_0x434b('0x1'))(_0x434b('0x2'));var moment=require(_0x434b('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x434b('0x4'));var rimraf=require(_0x434b('0x5'));var config=require(_0x434b('0x6'));var attributes=require(_0x434b('0x7'));module[_0x434b('0x8')]=function(_0xd9bf65,_0x47d590){return _0xd9bf65[_0x434b('0x9')](_0x434b('0xa'),attributes,{'tableName':_0x434b('0xb'),'paranoid':![],'indexes':[{'name':_0x434b('0xc'),'fields':[_0x434b('0xd'),_0x434b('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xbd19=['mailbox','lodash','util','api','request-promise','path','./voiceMail.attributes','exports','VoiceMail'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xbd19,0x1f0));var _0x9bd1=function(_0x556bb1,_0x34830d){_0x556bb1=_0x556bb1-0x0;var _0x45455f=_0xbd19[_0x556bb1];return _0x45455f;};'use strict';var _=require(_0x9bd1('0x0'));var util=require(_0x9bd1('0x1'));var logger=require('../../config/logger')(_0x9bd1('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x9bd1('0x3'));var fs=require('fs');var path=require(_0x9bd1('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x9bd1('0x5'));module[_0x9bd1('0x6')]=function(_0x1036eb,_0x1e8127){return _0x1036eb['define'](_0x9bd1('0x7'),attributes,{'tableName':'voice_voicemail','paranoid':![],'indexes':[{'name':'mailbox_context','fields':[_0x9bd1('0x8'),'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 e9809cf..d3b7162 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 _0xdfee=['debug','error','code','VoiceMail,\x20%s,\x20%s','message','result','catch','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','request\x20sent'];(function(_0x4c5f20,_0x3a2813){var _0x5220af=function(_0x5eff92){while(--_0x5eff92){_0x4c5f20['push'](_0x4c5f20['shift']());}};_0x5220af(++_0x3a2813);}(_0xdfee,0x11f));var _0xedfe=function(_0xc2f1e7,_0x477d0b){_0xc2f1e7=_0xc2f1e7-0x0;var _0x4d8db1=_0xdfee[_0xc2f1e7];return _0x4d8db1;};'use strict';var _=require(_0xedfe('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xedfe('0x1'));var fs=require('fs');var Redis=require(_0xedfe('0x2'));var db=require(_0xedfe('0x3'))['db'];var utils=require(_0xedfe('0x4'));var logger=require(_0xedfe('0x5'))('rpc');var config=require(_0xedfe('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xedfe('0x7')][_0xedfe('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1bd9bb,_0x147f94,_0x3adbf3){return new BPromise(function(_0x3d47af,_0x593e6b){return client[_0xedfe('0x9')](_0x1bd9bb,_0x3adbf3)[_0xedfe('0xa')](function(_0x2fad01){logger[_0xedfe('0xb')]('VoiceMail,\x20%s,\x20%s',_0x147f94,_0xedfe('0xc'));logger[_0xedfe('0xd')]('VoiceMail,\x20%s,\x20%s,\x20%s',_0x147f94,_0xedfe('0xc'),JSON['stringify'](_0x2fad01));if(_0x2fad01[_0xedfe('0xe')]){if(_0x2fad01['error'][_0xedfe('0xf')]===0x1f4){logger[_0xedfe('0xe')](_0xedfe('0x10'),_0x147f94,_0x2fad01[_0xedfe('0xe')][_0xedfe('0x11')]);return _0x593e6b(_0x2fad01[_0xedfe('0xe')][_0xedfe('0x11')]);}logger['error'](_0xedfe('0x10'),_0x147f94,_0x2fad01[_0xedfe('0xe')][_0xedfe('0x11')]);return _0x3d47af(_0x2fad01['error']['message']);}else{logger[_0xedfe('0xb')](_0xedfe('0x10'),_0x147f94,'request\x20sent');_0x3d47af(_0x2fad01[_0xedfe('0x12')][_0xedfe('0x11')]);}})[_0xedfe('0x13')](function(_0x2b8c62){logger[_0xedfe('0xe')](_0xedfe('0x10'),_0x147f94,_0x2b8c62);_0x593e6b(_0x2b8c62);});});} \ No newline at end of file +var _0xac11=['request','then','info','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0x542578,_0x1e4be4){var _0x35fa76=function(_0x236c12){while(--_0x236c12){_0x542578['push'](_0x542578['shift']());}};_0x35fa76(++_0x1e4be4);}(_0xac11,0xa5));var _0x1ac1=function(_0x528596,_0x3d8ede){_0x528596=_0x528596-0x0;var _0x459b65=_0xac11[_0x528596];return _0x459b65;};'use strict';var _=require(_0x1ac1('0x0'));var util=require('util');var moment=require(_0x1ac1('0x1'));var BPromise=require(_0x1ac1('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1ac1('0x3'));var db=require(_0x1ac1('0x4'))['db'];var utils=require(_0x1ac1('0x5'));var logger=require(_0x1ac1('0x6'))('rpc');var config=require(_0x1ac1('0x7'));var jayson=require(_0x1ac1('0x8'));var client=jayson[_0x1ac1('0x9')][_0x1ac1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x463f51,_0x4e1e0c,_0x4fe8e5){return new BPromise(function(_0x17a8f9,_0x4096d4){return client[_0x1ac1('0xb')](_0x463f51,_0x4fe8e5)[_0x1ac1('0xc')](function(_0x13e545){logger[_0x1ac1('0xd')](_0x1ac1('0xe'),_0x4e1e0c,_0x1ac1('0xf'));logger[_0x1ac1('0x10')]('VoiceMail,\x20%s,\x20%s,\x20%s',_0x4e1e0c,_0x1ac1('0xf'),JSON[_0x1ac1('0x11')](_0x13e545));if(_0x13e545['error']){if(_0x13e545[_0x1ac1('0x12')][_0x1ac1('0x13')]===0x1f4){logger[_0x1ac1('0x12')]('VoiceMail,\x20%s,\x20%s',_0x4e1e0c,_0x13e545[_0x1ac1('0x12')][_0x1ac1('0x14')]);return _0x4096d4(_0x13e545[_0x1ac1('0x12')][_0x1ac1('0x14')]);}logger[_0x1ac1('0x12')](_0x1ac1('0xe'),_0x4e1e0c,_0x13e545[_0x1ac1('0x12')][_0x1ac1('0x14')]);return _0x17a8f9(_0x13e545[_0x1ac1('0x12')]['message']);}else{logger[_0x1ac1('0xd')]('VoiceMail,\x20%s,\x20%s',_0x4e1e0c,_0x1ac1('0xf'));_0x17a8f9(_0x13e545[_0x1ac1('0x15')]['message']);}})['catch'](function(_0x5c05f9){logger[_0x1ac1('0x12')](_0x1ac1('0xe'),_0x4e1e0c,_0x5c05f9);_0x4096d4(_0x5c05f9);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index 45816b3..028b306 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 _0xb967=['exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','get','isAuthenticated','index','/:id','show','/:id/download','download','post','create','put','update','delete','destroy'];(function(_0x338454,_0x5ac674){var _0x47024d=function(_0x1749dc){while(--_0x1749dc){_0x338454['push'](_0x338454['shift']());}};_0x47024d(++_0x5ac674);}(_0xb967,0x1b1));var _0x7b96=function(_0x40b23e,_0xc6d07c){_0x40b23e=_0x40b23e-0x0;var _0x4ffc93=_0xb967[_0x40b23e];return _0x4ffc93;};'use strict';var multer=require('multer');var util=require(_0x7b96('0x0'));var path=require(_0x7b96('0x1'));var timeout=require(_0x7b96('0x2'));var express=require(_0x7b96('0x3'));var router=express[_0x7b96('0x4')]();var fs_extra=require(_0x7b96('0x5'));var auth=require(_0x7b96('0x6'));var interaction=require(_0x7b96('0x7'));var config=require(_0x7b96('0x8'));var controller=require(_0x7b96('0x9'));router[_0x7b96('0xa')]('/',auth[_0x7b96('0xb')](),controller[_0x7b96('0xc')]);router['get'](_0x7b96('0xd'),auth[_0x7b96('0xb')](),controller[_0x7b96('0xe')]);router['get'](_0x7b96('0xf'),auth['isAuthenticated'](),controller[_0x7b96('0x10')]);router[_0x7b96('0x11')]('/',auth[_0x7b96('0xb')](),controller[_0x7b96('0x12')]);router[_0x7b96('0x13')](_0x7b96('0xd'),auth[_0x7b96('0xb')](),controller[_0x7b96('0x14')]);router[_0x7b96('0x15')](_0x7b96('0xd'),auth[_0x7b96('0xb')](),controller[_0x7b96('0x16')]);module[_0x7b96('0x17')]=router; \ No newline at end of file +var _0x0dc2=['exports','util','path','express','./voiceMailMessage.controller','index','get','/:id','isAuthenticated','show','download','post','create','put','delete'];(function(_0x4ff72c,_0xb0ba97){var _0x146abc=function(_0x301ef7){while(--_0x301ef7){_0x4ff72c['push'](_0x4ff72c['shift']());}};_0x146abc(++_0xb0ba97);}(_0x0dc2,0x13c));var _0x20dc=function(_0x479f2f,_0x4b406c){_0x479f2f=_0x479f2f-0x0;var _0x147186=_0x0dc2[_0x479f2f];return _0x147186;};'use strict';var multer=require('multer');var util=require(_0x20dc('0x0'));var path=require(_0x20dc('0x1'));var timeout=require('connect-timeout');var express=require(_0x20dc('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x20dc('0x3'));router['get']('/',auth['isAuthenticated'](),controller[_0x20dc('0x4')]);router[_0x20dc('0x5')](_0x20dc('0x6'),auth[_0x20dc('0x7')](),controller[_0x20dc('0x8')]);router[_0x20dc('0x5')]('/:id/download',auth[_0x20dc('0x7')](),controller[_0x20dc('0x9')]);router[_0x20dc('0xa')]('/',auth[_0x20dc('0x7')](),controller[_0x20dc('0xb')]);router[_0x20dc('0xc')](_0x20dc('0x6'),auth[_0x20dc('0x7')](),controller['update']);router[_0x20dc('0xd')](_0x20dc('0x6'),auth[_0x20dc('0x7')](),controller['destroy']);module[_0x20dc('0xe')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index ef1386a..a218937 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 _0x896d=['VIRTUAL','getDataValue','STRING','BLOB','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','exports'];(function(_0x10ae62,_0x50c4a6){var _0x108d18=function(_0x834be1){while(--_0x834be1){_0x10ae62['push'](_0x10ae62['shift']());}};_0x108d18(++_0x50c4a6);}(_0x896d,0xd6));var _0xd896=function(_0x16bddd,_0x52ba84){_0x16bddd=_0x16bddd-0x0;var _0x3f23a3=_0x896d[_0x16bddd];return _0x3f23a3;};'use strict';var Sequelize=require(_0xd896('0x0'));module[_0xd896('0x1')]={'name':{'type':Sequelize[_0xd896('0x2')],'get':function(_0x2f7690){return this[_0xd896('0x3')]('id');}},'msgnum':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0xd896('0x4')],'defaultValue':''},'context':{'type':Sequelize[_0xd896('0x4')],'defaultValue':''},'macrocontext':{'type':Sequelize['STRING'],'defaultValue':''},'callerid':{'type':Sequelize[_0xd896('0x4')],'defaultValue':''},'origtime':{'type':Sequelize[_0xd896('0x4')],'defaultValue':''},'duration':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0xd896('0x4')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0xd896('0x4')],'defaultValue':''},'recording':{'type':Sequelize[_0xd896('0x5')]('long'),'defaultValue':null},'flag':{'type':Sequelize[_0xd896('0x4')],'defaultValue':''},'msg_id':{'type':Sequelize[_0xd896('0x4')],'defaultValue':''},'stamp':{'type':'TIMESTAMP','defaultValue':Sequelize[_0xd896('0x6')](_0xd896('0x7'))}}; \ No newline at end of file +var _0x5149=['literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','exports','getDataValue','STRING','BLOB','long','TIMESTAMP'];(function(_0x14671f,_0x2ea5c4){var _0x59dc8f=function(_0x279c7f){while(--_0x279c7f){_0x14671f['push'](_0x14671f['shift']());}};_0x59dc8f(++_0x2ea5c4);}(_0x5149,0xa4));var _0x9514=function(_0x3fad5a,_0x2d3b02){_0x3fad5a=_0x3fad5a-0x0;var _0x4ca713=_0x5149[_0x3fad5a];return _0x4ca713;};'use strict';var Sequelize=require(_0x9514('0x0'));module[_0x9514('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x5e3bfa){return this[_0x9514('0x2')]('id');}},'msgnum':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x9514('0x3')],'defaultValue':''},'context':{'type':Sequelize[_0x9514('0x3')],'defaultValue':''},'macrocontext':{'type':Sequelize['STRING'],'defaultValue':''},'callerid':{'type':Sequelize[_0x9514('0x3')],'defaultValue':''},'origtime':{'type':Sequelize[_0x9514('0x3')],'defaultValue':''},'duration':{'type':Sequelize[_0x9514('0x3')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x9514('0x3')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x9514('0x3')],'defaultValue':''},'recording':{'type':Sequelize[_0x9514('0x4')](_0x9514('0x5')),'defaultValue':null},'flag':{'type':Sequelize['STRING'],'defaultValue':''},'msg_id':{'type':Sequelize[_0x9514('0x3')],'defaultValue':''},'stamp':{'type':_0x9514('0x6'),'defaultValue':Sequelize[_0x9514('0x7')](_0x9514('0x8'))}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index b4869bd..aa69752 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 _0xa44c=['jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','end','status','offset','undefined','limit','count','set','json','reject','save','update','then','destroy','stack','name','send','VoiceMailMessage','fieldName','key','model','map','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','type','VIRTUAL','merge','options','include','rows','catch','show','params','find','create','body','download','recording','msg_id','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','attachment','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','eml-format','fast-json-patch','request-promise','moment','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto'];(function(_0x208f77,_0x2b2968){var _0x27e75f=function(_0x40930e){while(--_0x40930e){_0x208f77['push'](_0x208f77['shift']());}};_0x27e75f(++_0x2b2968);}(_0xa44c,0x1e6));var _0xca44=function(_0x5eaa7d,_0x4d9d8b){_0x5eaa7d=_0x5eaa7d-0x0;var _0x1a96fd=_0xa44c[_0x5eaa7d];return _0x1a96fd;};'use strict';var emlformat=require(_0xca44('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xca44('0x1'));var rp=require(_0xca44('0x2'));var moment=require(_0xca44('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xca44('0x4'));var path=require('path');var sox=require(_0xca44('0x5'));var csv=require(_0xca44('0x6'));var ejs=require(_0xca44('0x7'));var fs=require('fs');var fs_extra=require(_0xca44('0x8'));var _=require(_0xca44('0x9'));var squel=require(_0xca44('0xa'));var crypto=require(_0xca44('0xb'));var jsforce=require(_0xca44('0xc'));var deskjs=require(_0xca44('0xd'));var toCsv=require(_0xca44('0x6'));var querystring=require(_0xca44('0xe'));var Papa=require(_0xca44('0xf'));var Redis=require('ioredis');var authService=require(_0xca44('0x10'));var qs=require(_0xca44('0x11'));var as=require(_0xca44('0x12'));var hardwareService=require(_0xca44('0x13'));var logger=require(_0xca44('0x14'))(_0xca44('0x15'));var utils=require(_0xca44('0x16'));var config=require(_0xca44('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xca44('0x18'))['db'];function respondWithStatusCode(_0x4b5ceb,_0x1c5f3d){_0x1c5f3d=_0x1c5f3d||0xcc;return function(_0x6c705e){if(_0x6c705e){return _0x4b5ceb['sendStatus'](_0x1c5f3d);}return _0x4b5ceb['status'](_0x1c5f3d)[_0xca44('0x19')]();};}function respondWithResult(_0x44009a,_0x4b3c6e){_0x4b3c6e=_0x4b3c6e||0xc8;return function(_0x2efc7f){if(_0x2efc7f){return _0x44009a[_0xca44('0x1a')](_0x4b3c6e)['json'](_0x2efc7f);}};}function respondWithFilteredResult(_0x173490,_0x37042d){return function(_0x53d17d){if(_0x53d17d){var _0x46579c=typeof _0x37042d[_0xca44('0x1b')]===_0xca44('0x1c')&&typeof _0x37042d[_0xca44('0x1d')]===_0xca44('0x1c');var _0x1980c7=_0x53d17d[_0xca44('0x1e')];var _0x26362e=_0x46579c?0x0:_0x37042d[_0xca44('0x1b')];var _0x5e5e5c=_0x46579c?_0x53d17d[_0xca44('0x1e')]:_0x37042d[_0xca44('0x1b')]+_0x37042d[_0xca44('0x1d')];var _0x3c3ed6;if(_0x5e5e5c>=_0x1980c7){_0x5e5e5c=_0x1980c7;_0x3c3ed6=0xc8;}else{_0x3c3ed6=0xce;}_0x173490[_0xca44('0x1a')](_0x3c3ed6);return _0x173490[_0xca44('0x1f')]('Content-Range',_0x26362e+'-'+_0x5e5e5c+'/'+_0x1980c7)[_0xca44('0x20')](_0x53d17d);}return null;};}function patchUpdates(_0x3cdc89){return function(_0x120722){try{jsonpatch['apply'](_0x120722,_0x3cdc89,!![]);}catch(_0x1718bf){return BPromise[_0xca44('0x21')](_0x1718bf);}return _0x120722[_0xca44('0x22')]();};}function saveUpdates(_0x187739,_0x3b42a0){return function(_0x3080c9){if(_0x3080c9){return _0x3080c9[_0xca44('0x23')](_0x187739)[_0xca44('0x24')](function(_0x3e9078){return _0x3e9078;});}return null;};}function removeEntity(_0x3426be,_0x1e9e86){return function(_0x387884){if(_0x387884){return _0x387884[_0xca44('0x25')]()[_0xca44('0x24')](function(){_0x3426be[_0xca44('0x1a')](0xcc)[_0xca44('0x19')]();});}};}function handleEntityNotFound(_0x3338ff,_0x42ed84){return function(_0x598d0e){if(!_0x598d0e){_0x3338ff['sendStatus'](0x194);}return _0x598d0e;};}function handleError(_0x53199a,_0x5c9771){_0x5c9771=_0x5c9771||0x1f4;return function(_0x3e5622){logger['error'](_0x3e5622[_0xca44('0x26')]);if(_0x3e5622[_0xca44('0x27')]){delete _0x3e5622[_0xca44('0x27')];}_0x53199a['status'](_0x5c9771)[_0xca44('0x28')](_0x3e5622);};}exports['index']=function(_0x30af4e,_0x5c32f6){var _0x335da3={},_0x4124ab={},_0x51485b={'count':0x0,'rows':[]};var _0x2271b8=_['map'](db[_0xca44('0x29')]['rawAttributes'],function(_0x4b4398){return{'name':_0x4b4398[_0xca44('0x2a')],'type':_0x4b4398['type'][_0xca44('0x2b')]};});_0x4124ab[_0xca44('0x2c')]=_['differenceBy'](_[_0xca44('0x2d')](_0x2271b8,_0xca44('0x27')),['name']);_0x4124ab[_0xca44('0x2e')]=_[_0xca44('0x2f')](_0x30af4e[_0xca44('0x2e')]);_0x4124ab['filters']=_['intersection'](_0x4124ab['model'],_0x4124ab[_0xca44('0x2e')]);_0x335da3[_0xca44('0x30')]=_[_0xca44('0x31')](_0x4124ab[_0xca44('0x2c')],qs[_0xca44('0x32')](_0x30af4e[_0xca44('0x2e')][_0xca44('0x32')]));_0x335da3[_0xca44('0x30')]=_0x335da3[_0xca44('0x30')][_0xca44('0x33')]?_0x335da3['attributes']:_0x4124ab[_0xca44('0x2c')];if(!_0x30af4e[_0xca44('0x2e')][_0xca44('0x34')](_0xca44('0x35'))){_0x335da3[_0xca44('0x1d')]=qs[_0xca44('0x1d')](_0x30af4e[_0xca44('0x2e')][_0xca44('0x1d')]);_0x335da3[_0xca44('0x1b')]=qs[_0xca44('0x1b')](_0x30af4e[_0xca44('0x2e')][_0xca44('0x1b')]);}_0x335da3[_0xca44('0x36')]=qs[_0xca44('0x37')](_0x30af4e[_0xca44('0x2e')][_0xca44('0x37')]);_0x335da3[_0xca44('0x38')]=qs[_0xca44('0x39')](_[_0xca44('0x3a')](_0x30af4e[_0xca44('0x2e')],_0x4124ab[_0xca44('0x39')]),_0x2271b8);if(_0x30af4e[_0xca44('0x2e')][_0xca44('0x3b')]){_0x335da3[_0xca44('0x38')]=_['merge'](_0x335da3[_0xca44('0x38')],{'$or':_['map'](_0x2271b8,function(_0x3e26c7){if(_0x3e26c7[_0xca44('0x3c')]!==_0xca44('0x3d')){var _0x105f16={};_0x105f16[_0x3e26c7[_0xca44('0x27')]]={'$like':'%'+_0x30af4e[_0xca44('0x2e')][_0xca44('0x3b')]+'%'};return _0x105f16;}})});}_0x335da3=_[_0xca44('0x3e')]({},_0x335da3,_0x30af4e[_0xca44('0x3f')]);var _0x958848={'where':_0x335da3[_0xca44('0x38')]};return db[_0xca44('0x29')][_0xca44('0x1e')](_0x958848)[_0xca44('0x24')](function(_0x4cd9f9){_0x51485b[_0xca44('0x1e')]=_0x4cd9f9;if(_0x30af4e[_0xca44('0x2e')]['includeAll']){_0x335da3[_0xca44('0x40')]=[{'all':!![]}];}return db[_0xca44('0x29')]['findAll'](_0x335da3);})[_0xca44('0x24')](function(_0x2abb97){_0x51485b[_0xca44('0x41')]=_0x2abb97;return _0x51485b;})['then'](respondWithFilteredResult(_0x5c32f6,_0x335da3))[_0xca44('0x42')](handleError(_0x5c32f6,null));};exports[_0xca44('0x43')]=function(_0x1cf227,_0x25bb82){var _0x1cc874={'raw':!![],'where':{'id':_0x1cf227[_0xca44('0x44')]['id']}},_0x523db3={};_0x523db3[_0xca44('0x2c')]=_[_0xca44('0x2f')](db[_0xca44('0x29')]['rawAttributes']);_0x523db3[_0xca44('0x2e')]=_[_0xca44('0x2f')](_0x1cf227['query']);_0x523db3[_0xca44('0x39')]=_[_0xca44('0x31')](_0x523db3[_0xca44('0x2c')],_0x523db3['query']);_0x1cc874[_0xca44('0x30')]=_[_0xca44('0x31')](_0x523db3[_0xca44('0x2c')],qs[_0xca44('0x32')](_0x1cf227[_0xca44('0x2e')][_0xca44('0x32')]));_0x1cc874[_0xca44('0x30')]=_0x1cc874[_0xca44('0x30')][_0xca44('0x33')]?_0x1cc874[_0xca44('0x30')]:_0x523db3[_0xca44('0x2c')];if(_0x1cf227['query']['includeAll']){_0x1cc874[_0xca44('0x40')]=[{'all':!![]}];}_0x1cc874=_[_0xca44('0x3e')]({},_0x1cc874,_0x1cf227['options']);return db['VoiceMailMessage'][_0xca44('0x45')](_0x1cc874)[_0xca44('0x24')](handleEntityNotFound(_0x25bb82,null))['then'](respondWithResult(_0x25bb82,null))[_0xca44('0x42')](handleError(_0x25bb82,null));};exports[_0xca44('0x46')]=function(_0x4758e9,_0x565e72){return db[_0xca44('0x29')]['create'](_0x4758e9['body'],{})[_0xca44('0x24')](respondWithResult(_0x565e72,0xc9))[_0xca44('0x42')](handleError(_0x565e72,null));};exports[_0xca44('0x23')]=function(_0x3ecfce,_0x509e7f){if(_0x3ecfce[_0xca44('0x47')]['id']){delete _0x3ecfce[_0xca44('0x47')]['id'];}return db[_0xca44('0x29')][_0xca44('0x45')]({'where':{'id':_0x3ecfce[_0xca44('0x44')]['id']}})[_0xca44('0x24')](handleEntityNotFound(_0x509e7f,null))[_0xca44('0x24')](saveUpdates(_0x3ecfce[_0xca44('0x47')],null))[_0xca44('0x24')](respondWithResult(_0x509e7f,null))[_0xca44('0x42')](handleError(_0x509e7f,null));};exports[_0xca44('0x25')]=function(_0x1653fc,_0xe24b8a){return db['VoiceMailMessage'][_0xca44('0x45')]({'where':{'id':_0x1653fc['params']['id']}})[_0xca44('0x24')](handleEntityNotFound(_0xe24b8a,null))[_0xca44('0x24')](removeEntity(_0xe24b8a,null))['catch'](handleError(_0xe24b8a,null));};exports[_0xca44('0x48')]=function(_0x84e018,_0x52937c,_0x3926f9){return db[_0xca44('0x29')][_0xca44('0x45')]({'where':{'id':_0x84e018[_0xca44('0x44')]['id']},'attributes':['id',_0xca44('0x49'),_0xca44('0x4a')]})['then'](handleEntityNotFound(_0x52937c,null))[_0xca44('0x24')](function(_0x4fafd3){if(_0x4fafd3){if(!_0x4fafd3['recording']){throw new db[(_0xca44('0x4b'))][(_0xca44('0x4c'))](_0xca44('0x4d'));}var _0x193acb={'Content-Type':_0xca44('0x4e'),'Content-Disposition':_0xca44('0x4f')};if(_0x4fafd3['msg_id']){_0x193acb[_0xca44('0x50')]=_0xca44('0x51')+_0x4fafd3[_0xca44('0x4a')]+_0xca44('0x52');}_0x52937c[_0xca44('0x1f')](_0x193acb);return _0x52937c[_0xca44('0x28')](new Buffer(_0x4fafd3[_0xca44('0x49')]));}})['catch'](handleError(_0x52937c,null));}; \ No newline at end of file +var _0xeab9=['eml-format','rimraf','zip-dir','fast-json-patch','bluebird','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','sendStatus','error','stack','name','send','index','VoiceMailMessage','rawAttributes','fieldName','type','key','model','differenceBy','map','query','keys','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','pick','VIRTUAL','filter','merge','options','rows','catch','params','length','includeAll','create','body','find','destroy','download','recording','msg_id','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','attachment','Content-Disposition','set'];(function(_0x3452c7,_0x395c6f){var _0x4b490f=function(_0x4cacf1){while(--_0x4cacf1){_0x3452c7['push'](_0x3452c7['shift']());}};_0x4b490f(++_0x395c6f);}(_0xeab9,0x1ec));var _0x9eab=function(_0x1756f3,_0x60f2ce){_0x1756f3=_0x1756f3-0x0;var _0x2795f1=_0xeab9[_0x1756f3];return _0x2795f1;};'use strict';var emlformat=require(_0x9eab('0x0'));var rimraf=require(_0x9eab('0x1'));var zipdir=require(_0x9eab('0x2'));var jsonpatch=require(_0x9eab('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x9eab('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x9eab('0x5'));var csv=require('to-csv');var ejs=require(_0x9eab('0x6'));var fs=require('fs');var fs_extra=require(_0x9eab('0x7'));var _=require('lodash');var squel=require(_0x9eab('0x8'));var crypto=require(_0x9eab('0x9'));var jsforce=require(_0x9eab('0xa'));var deskjs=require(_0x9eab('0xb'));var toCsv=require(_0x9eab('0xc'));var querystring=require(_0x9eab('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x9eab('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9eab('0xf'));var logger=require(_0x9eab('0x10'))(_0x9eab('0x11'));var utils=require(_0x9eab('0x12'));var config=require(_0x9eab('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x9eab('0x14'))['db'];function respondWithStatusCode(_0x200497,_0x2de9b3){_0x2de9b3=_0x2de9b3||0xcc;return function(_0x205432){if(_0x205432){return _0x200497['sendStatus'](_0x2de9b3);}return _0x200497[_0x9eab('0x15')](_0x2de9b3)[_0x9eab('0x16')]();};}function respondWithResult(_0x440de,_0xc76f88){_0xc76f88=_0xc76f88||0xc8;return function(_0xed679b){if(_0xed679b){return _0x440de[_0x9eab('0x15')](_0xc76f88)[_0x9eab('0x17')](_0xed679b);}};}function respondWithFilteredResult(_0x21cbce,_0x2c0ab9){return function(_0xf278a1){if(_0xf278a1){var _0x5bb556=typeof _0x2c0ab9[_0x9eab('0x18')]===_0x9eab('0x19')&&typeof _0x2c0ab9[_0x9eab('0x1a')]===_0x9eab('0x19');var _0x4a5235=_0xf278a1['count'];var _0x5a9f99=_0x5bb556?0x0:_0x2c0ab9['offset'];var _0x52f56a=_0x5bb556?_0xf278a1[_0x9eab('0x1b')]:_0x2c0ab9[_0x9eab('0x18')]+_0x2c0ab9[_0x9eab('0x1a')];var _0xe895e3;if(_0x52f56a>=_0x4a5235){_0x52f56a=_0x4a5235;_0xe895e3=0xc8;}else{_0xe895e3=0xce;}_0x21cbce[_0x9eab('0x15')](_0xe895e3);return _0x21cbce['set'](_0x9eab('0x1c'),_0x5a9f99+'-'+_0x52f56a+'/'+_0x4a5235)[_0x9eab('0x17')](_0xf278a1);}return null;};}function patchUpdates(_0x22fb9b){return function(_0x34aa74){try{jsonpatch[_0x9eab('0x1d')](_0x34aa74,_0x22fb9b,!![]);}catch(_0x451635){return BPromise[_0x9eab('0x1e')](_0x451635);}return _0x34aa74[_0x9eab('0x1f')]();};}function saveUpdates(_0x2abd5f,_0x711c90){return function(_0x505bbd){if(_0x505bbd){return _0x505bbd[_0x9eab('0x20')](_0x2abd5f)[_0x9eab('0x21')](function(_0x4701d9){return _0x4701d9;});}return null;};}function removeEntity(_0x309642,_0xe6fa1c){return function(_0x2e1b53){if(_0x2e1b53){return _0x2e1b53['destroy']()[_0x9eab('0x21')](function(){_0x309642['status'](0xcc)[_0x9eab('0x16')]();});}};}function handleEntityNotFound(_0x1171eb,_0x17f425){return function(_0x32c9c1){if(!_0x32c9c1){_0x1171eb[_0x9eab('0x22')](0x194);}return _0x32c9c1;};}function handleError(_0x1272ea,_0x18a10e){_0x18a10e=_0x18a10e||0x1f4;return function(_0x3ebff0){logger[_0x9eab('0x23')](_0x3ebff0[_0x9eab('0x24')]);if(_0x3ebff0[_0x9eab('0x25')]){delete _0x3ebff0[_0x9eab('0x25')];}_0x1272ea[_0x9eab('0x15')](_0x18a10e)[_0x9eab('0x26')](_0x3ebff0);};}exports[_0x9eab('0x27')]=function(_0x2695b4,_0x1e0dee){var _0x129448={},_0x1d0c49={},_0x262bee={'count':0x0,'rows':[]};var _0x22d0e4=_['map'](db[_0x9eab('0x28')][_0x9eab('0x29')],function(_0x38771f){return{'name':_0x38771f[_0x9eab('0x2a')],'type':_0x38771f[_0x9eab('0x2b')][_0x9eab('0x2c')]};});_0x1d0c49[_0x9eab('0x2d')]=_[_0x9eab('0x2e')](_[_0x9eab('0x2f')](_0x22d0e4,_0x9eab('0x25')),[_0x9eab('0x25')]);_0x1d0c49[_0x9eab('0x30')]=_[_0x9eab('0x31')](_0x2695b4[_0x9eab('0x30')]);_0x1d0c49[_0x9eab('0x32')]=_[_0x9eab('0x33')](_0x1d0c49[_0x9eab('0x2d')],_0x1d0c49['query']);_0x129448['attributes']=_['intersection'](_0x1d0c49[_0x9eab('0x2d')],qs['fields'](_0x2695b4[_0x9eab('0x30')][_0x9eab('0x34')]));_0x129448['attributes']=_0x129448[_0x9eab('0x35')]['length']?_0x129448[_0x9eab('0x35')]:_0x1d0c49['model'];if(!_0x2695b4['query'][_0x9eab('0x36')]('nolimit')){_0x129448[_0x9eab('0x1a')]=qs['limit'](_0x2695b4[_0x9eab('0x30')]['limit']);_0x129448[_0x9eab('0x18')]=qs['offset'](_0x2695b4[_0x9eab('0x30')][_0x9eab('0x18')]);}_0x129448[_0x9eab('0x37')]=qs[_0x9eab('0x38')](_0x2695b4[_0x9eab('0x30')][_0x9eab('0x38')]);_0x129448[_0x9eab('0x39')]=qs['filters'](_[_0x9eab('0x3a')](_0x2695b4[_0x9eab('0x30')],_0x1d0c49[_0x9eab('0x32')]),_0x22d0e4);if(_0x2695b4['query']['filter']){_0x129448['where']=_['merge'](_0x129448[_0x9eab('0x39')],{'$or':_['map'](_0x22d0e4,function(_0x18eca9){if(_0x18eca9[_0x9eab('0x2b')]!==_0x9eab('0x3b')){var _0xcb8302={};_0xcb8302[_0x18eca9[_0x9eab('0x25')]]={'$like':'%'+_0x2695b4[_0x9eab('0x30')][_0x9eab('0x3c')]+'%'};return _0xcb8302;}})});}_0x129448=_[_0x9eab('0x3d')]({},_0x129448,_0x2695b4[_0x9eab('0x3e')]);var _0x2537a0={'where':_0x129448[_0x9eab('0x39')]};return db[_0x9eab('0x28')][_0x9eab('0x1b')](_0x2537a0)[_0x9eab('0x21')](function(_0x4c180b){_0x262bee['count']=_0x4c180b;if(_0x2695b4['query']['includeAll']){_0x129448['include']=[{'all':!![]}];}return db['VoiceMailMessage']['findAll'](_0x129448);})[_0x9eab('0x21')](function(_0x373a5d){_0x262bee[_0x9eab('0x3f')]=_0x373a5d;return _0x262bee;})['then'](respondWithFilteredResult(_0x1e0dee,_0x129448))[_0x9eab('0x40')](handleError(_0x1e0dee,null));};exports['show']=function(_0x429c41,_0x1db12a){var _0x23f9e8={'raw':!![],'where':{'id':_0x429c41[_0x9eab('0x41')]['id']}},_0x47fac8={};_0x47fac8['model']=_['keys'](db[_0x9eab('0x28')][_0x9eab('0x29')]);_0x47fac8[_0x9eab('0x30')]=_[_0x9eab('0x31')](_0x429c41['query']);_0x47fac8[_0x9eab('0x32')]=_[_0x9eab('0x33')](_0x47fac8[_0x9eab('0x2d')],_0x47fac8[_0x9eab('0x30')]);_0x23f9e8['attributes']=_[_0x9eab('0x33')](_0x47fac8[_0x9eab('0x2d')],qs[_0x9eab('0x34')](_0x429c41[_0x9eab('0x30')]['fields']));_0x23f9e8[_0x9eab('0x35')]=_0x23f9e8['attributes'][_0x9eab('0x42')]?_0x23f9e8[_0x9eab('0x35')]:_0x47fac8['model'];if(_0x429c41['query'][_0x9eab('0x43')]){_0x23f9e8['include']=[{'all':!![]}];}_0x23f9e8=_[_0x9eab('0x3d')]({},_0x23f9e8,_0x429c41[_0x9eab('0x3e')]);return db['VoiceMailMessage']['find'](_0x23f9e8)[_0x9eab('0x21')](handleEntityNotFound(_0x1db12a,null))[_0x9eab('0x21')](respondWithResult(_0x1db12a,null))['catch'](handleError(_0x1db12a,null));};exports['create']=function(_0x4bfafe,_0x362f75){return db[_0x9eab('0x28')][_0x9eab('0x44')](_0x4bfafe[_0x9eab('0x45')],{})[_0x9eab('0x21')](respondWithResult(_0x362f75,0xc9))[_0x9eab('0x40')](handleError(_0x362f75,null));};exports['update']=function(_0x2153d1,_0x263169){if(_0x2153d1[_0x9eab('0x45')]['id']){delete _0x2153d1[_0x9eab('0x45')]['id'];}return db[_0x9eab('0x28')][_0x9eab('0x46')]({'where':{'id':_0x2153d1[_0x9eab('0x41')]['id']}})['then'](handleEntityNotFound(_0x263169,null))[_0x9eab('0x21')](saveUpdates(_0x2153d1[_0x9eab('0x45')],null))[_0x9eab('0x21')](respondWithResult(_0x263169,null))[_0x9eab('0x40')](handleError(_0x263169,null));};exports[_0x9eab('0x47')]=function(_0x5af91e,_0x569961){return db[_0x9eab('0x28')][_0x9eab('0x46')]({'where':{'id':_0x5af91e[_0x9eab('0x41')]['id']}})[_0x9eab('0x21')](handleEntityNotFound(_0x569961,null))[_0x9eab('0x21')](removeEntity(_0x569961,null))[_0x9eab('0x40')](handleError(_0x569961,null));};exports[_0x9eab('0x48')]=function(_0xce094c,_0x1f86ca,_0xe55833){return db[_0x9eab('0x28')]['find']({'where':{'id':_0xce094c['params']['id']},'attributes':['id',_0x9eab('0x49'),_0x9eab('0x4a')]})[_0x9eab('0x21')](handleEntityNotFound(_0x1f86ca,null))[_0x9eab('0x21')](function(_0x107f15){if(_0x107f15){if(!_0x107f15[_0x9eab('0x49')]){throw new db[(_0x9eab('0x4b'))][(_0x9eab('0x4c'))](_0x9eab('0x4d'));}var _0x2746b8={'Content-Type':_0x9eab('0x4e'),'Content-Disposition':_0x9eab('0x4f')};if(_0x107f15[_0x9eab('0x4a')]){_0x2746b8[_0x9eab('0x50')]='attachment;\x20filename=\x22'+_0x107f15[_0x9eab('0x4a')]+'.wav\x22';}_0x1f86ca[_0x9eab('0x51')](_0x2746b8);return _0x1f86ca['send'](new Buffer(_0x107f15[_0x9eab('0x49')]));}})[_0x9eab('0x40')](handleError(_0x1f86ca,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index 3331204..3c7ce19 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 _0xf725=['dir','lodash','util','path','rimraf','../../config/environment','./voiceMailMessage.attributes','define','VoiceMailMessage','voice_voicemail_messages'];(function(_0x32fc3e,_0x466211){var _0x314576=function(_0x54bf72){while(--_0x54bf72){_0x32fc3e['push'](_0x32fc3e['shift']());}};_0x314576(++_0x466211);}(_0xf725,0x8d));var _0x5f72=function(_0x57175a,_0x33d3e1){_0x57175a=_0x57175a-0x0;var _0x56f765=_0xf725[_0x57175a];return _0x56f765;};'use strict';var _=require(_0x5f72('0x0'));var util=require(_0x5f72('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(_0x5f72('0x2'));var rimraf=require(_0x5f72('0x3'));var config=require(_0x5f72('0x4'));var attributes=require(_0x5f72('0x5'));module['exports']=function(_0x4c4041,_0x222905){return _0x4c4041[_0x5f72('0x6')](_0x5f72('0x7'),attributes,{'tableName':_0x5f72('0x8'),'paranoid':![],'indexes':[{'name':_0x5f72('0x9'),'fields':['dir']}],'timestamps':![]});}; \ No newline at end of file +var _0x7ed4=['dir','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports','voice_voicemail_messages'];(function(_0x64dd28,_0x387502){var _0x571761=function(_0x20c1d2){while(--_0x20c1d2){_0x64dd28['push'](_0x64dd28['shift']());}};_0x571761(++_0x387502);}(_0x7ed4,0xe8));var _0x47ed=function(_0x536ed3,_0x481b22){_0x536ed3=_0x536ed3-0x0;var _0x1a3f43=_0x7ed4[_0x536ed3];return _0x1a3f43;};'use strict';var _=require('lodash');var util=require(_0x47ed('0x0'));var logger=require(_0x47ed('0x1'))(_0x47ed('0x2'));var moment=require(_0x47ed('0x3'));var BPromise=require(_0x47ed('0x4'));var rp=require(_0x47ed('0x5'));var fs=require('fs');var path=require(_0x47ed('0x6'));var rimraf=require('rimraf');var config=require(_0x47ed('0x7'));var attributes=require('./voiceMailMessage.attributes');module[_0x47ed('0x8')]=function(_0x5b51c2,_0xfc066a){return _0x5b51c2['define']('VoiceMailMessage',attributes,{'tableName':_0x47ed('0x9'),'paranoid':![],'indexes':[{'name':_0x47ed('0xa'),'fields':[_0x47ed('0xa')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index 2a4c0ee..1877206 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 _0xc0de=['error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','VoiceMailMessage,\x20%s,\x20%s','debug','request\x20sent','stringify'];(function(_0xee14f7,_0x37b083){var _0x38a44a=function(_0x27fc45){while(--_0x27fc45){_0xee14f7['push'](_0xee14f7['shift']());}};_0x38a44a(++_0x37b083);}(_0xc0de,0x19c));var _0xec0d=function(_0x29327d,_0x35bf21){_0x29327d=_0x29327d-0x0;var _0x5c7a22=_0xc0de[_0x29327d];return _0x5c7a22;};'use strict';var _=require(_0xec0d('0x0'));var util=require(_0xec0d('0x1'));var moment=require(_0xec0d('0x2'));var BPromise=require(_0xec0d('0x3'));var rs=require(_0xec0d('0x4'));var fs=require('fs');var Redis=require(_0xec0d('0x5'));var db=require(_0xec0d('0x6'))['db'];var utils=require(_0xec0d('0x7'));var logger=require(_0xec0d('0x8'))('rpc');var config=require(_0xec0d('0x9'));var jayson=require(_0xec0d('0xa'));var client=jayson[_0xec0d('0xb')][_0xec0d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3de1f,_0x5de4c7,_0x7d0a25){return new BPromise(function(_0x822aa2,_0x391867){return client[_0xec0d('0xd')](_0x3de1f,_0x7d0a25)[_0xec0d('0xe')](function(_0x30acd7){logger[_0xec0d('0xf')](_0xec0d('0x10'),_0x5de4c7,'request\x20sent');logger[_0xec0d('0x11')]('VoiceMailMessage,\x20%s,\x20%s,\x20%s',_0x5de4c7,_0xec0d('0x12'),JSON[_0xec0d('0x13')](_0x30acd7));if(_0x30acd7['error']){if(_0x30acd7[_0xec0d('0x14')]['code']===0x1f4){logger['error'](_0xec0d('0x10'),_0x5de4c7,_0x30acd7[_0xec0d('0x14')][_0xec0d('0x15')]);return _0x391867(_0x30acd7[_0xec0d('0x14')][_0xec0d('0x15')]);}logger[_0xec0d('0x14')](_0xec0d('0x10'),_0x5de4c7,_0x30acd7[_0xec0d('0x14')]['message']);return _0x822aa2(_0x30acd7[_0xec0d('0x14')][_0xec0d('0x15')]);}else{logger[_0xec0d('0xf')](_0xec0d('0x10'),_0x5de4c7,_0xec0d('0x12'));_0x822aa2(_0x30acd7[_0xec0d('0x16')][_0xec0d('0x15')]);}})[_0xec0d('0x17')](function(_0x401999){logger['error'](_0xec0d('0x10'),_0x5de4c7,_0x401999);_0x391867(_0x401999);});});} \ No newline at end of file +var _0xcc5e=['request\x20sent','VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','util','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','VoiceMailMessage,\x20%s,\x20%s'];(function(_0x2c292a,_0x2dc555){var _0x4933ea=function(_0x1c6505){while(--_0x1c6505){_0x2c292a['push'](_0x2c292a['shift']());}};_0x4933ea(++_0x2dc555);}(_0xcc5e,0x14b));var _0xecc5=function(_0x366e75,_0x533d1d){_0x366e75=_0x366e75-0x0;var _0x3b167b=_0xcc5e[_0x366e75];return _0x3b167b;};'use strict';var _=require('lodash');var util=require(_0xecc5('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xecc5('0x1'));var fs=require('fs');var Redis=require(_0xecc5('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xecc5('0x3'))(_0xecc5('0x4'));var config=require(_0xecc5('0x5'));var jayson=require(_0xecc5('0x6'));var client=jayson['client'][_0xecc5('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2c1acc,_0x59062b,_0x266aa8){return new BPromise(function(_0x49d6b3,_0x42c503){return client[_0xecc5('0x8')](_0x2c1acc,_0x266aa8)[_0xecc5('0x9')](function(_0x488e39){logger['info'](_0xecc5('0xa'),_0x59062b,_0xecc5('0xb'));logger['debug'](_0xecc5('0xc'),_0x59062b,_0xecc5('0xb'),JSON[_0xecc5('0xd')](_0x488e39));if(_0x488e39[_0xecc5('0xe')]){if(_0x488e39[_0xecc5('0xe')][_0xecc5('0xf')]===0x1f4){logger[_0xecc5('0xe')](_0xecc5('0xa'),_0x59062b,_0x488e39[_0xecc5('0xe')]['message']);return _0x42c503(_0x488e39[_0xecc5('0xe')][_0xecc5('0x10')]);}logger[_0xecc5('0xe')]('VoiceMailMessage,\x20%s,\x20%s',_0x59062b,_0x488e39[_0xecc5('0xe')][_0xecc5('0x10')]);return _0x49d6b3(_0x488e39[_0xecc5('0xe')][_0xecc5('0x10')]);}else{logger[_0xecc5('0x11')](_0xecc5('0xa'),_0x59062b,'request\x20sent');_0x49d6b3(_0x488e39[_0xecc5('0x12')]['message']);}})['catch'](function(_0x343fee){logger[_0xecc5('0xe')]('VoiceMailMessage,\x20%s,\x20%s',_0x59062b,_0x343fee);_0x42c503(_0x343fee);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index bbd4c77..76250a1 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 _0xbf3f=['Router','fs-extra','../../components/interaction/service','./voiceMusicOnHold.controller','get','isAuthenticated','index','/:id','/:id/sounds','post','create','addSound','put','update','destroy','delete','/:id/sounds/:id2','removeSound','exports','path','connect-timeout','express'];(function(_0x71e493,_0x4308b7){var _0x3d40ab=function(_0x29715){while(--_0x29715){_0x71e493['push'](_0x71e493['shift']());}};_0x3d40ab(++_0x4308b7);}(_0xbf3f,0xad));var _0xfbf3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbf3f[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xfbf3('0x0'));var timeout=require(_0xfbf3('0x1'));var express=require(_0xfbf3('0x2'));var router=express[_0xfbf3('0x3')]();var fs_extra=require(_0xfbf3('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xfbf3('0x5'));var config=require('../../config/environment');var controller=require(_0xfbf3('0x6'));router[_0xfbf3('0x7')]('/',auth[_0xfbf3('0x8')](),controller[_0xfbf3('0x9')]);router[_0xfbf3('0x7')](_0xfbf3('0xa'),auth['isAuthenticated'](),controller['show']);router[_0xfbf3('0x7')](_0xfbf3('0xb'),auth[_0xfbf3('0x8')](),controller['getSounds']);router[_0xfbf3('0xc')]('/',auth[_0xfbf3('0x8')](),controller[_0xfbf3('0xd')]);router[_0xfbf3('0xc')](_0xfbf3('0xb'),auth[_0xfbf3('0x8')](),controller[_0xfbf3('0xe')]);router[_0xfbf3('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xfbf3('0x10')]);router['delete']('/:id',auth[_0xfbf3('0x8')](),controller[_0xfbf3('0x11')]);router[_0xfbf3('0x12')](_0xfbf3('0x13'),auth[_0xfbf3('0x8')](),controller[_0xfbf3('0x14')]);module[_0xfbf3('0x15')]=router; \ No newline at end of file +var _0x525b=['../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','get','isAuthenticated','index','/:id','show','/:id/sounds','getSounds','post','create','put','update','delete','exports','multer','path','express','Router','fs-extra'];(function(_0x1a1a49,_0x185d94){var _0x3ddfb0=function(_0x4f3bcb){while(--_0x4f3bcb){_0x1a1a49['push'](_0x1a1a49['shift']());}};_0x3ddfb0(++_0x185d94);}(_0x525b,0x12f));var _0xb525=function(_0x413b62,_0x740bd3){_0x413b62=_0x413b62-0x0;var _0x19bad0=_0x525b[_0x413b62];return _0x19bad0;};'use strict';var multer=require(_0xb525('0x0'));var util=require('util');var path=require(_0xb525('0x1'));var timeout=require('connect-timeout');var express=require(_0xb525('0x2'));var router=express[_0xb525('0x3')]();var fs_extra=require(_0xb525('0x4'));var auth=require(_0xb525('0x5'));var interaction=require(_0xb525('0x6'));var config=require(_0xb525('0x7'));var controller=require(_0xb525('0x8'));router[_0xb525('0x9')]('/',auth[_0xb525('0xa')](),controller[_0xb525('0xb')]);router[_0xb525('0x9')](_0xb525('0xc'),auth[_0xb525('0xa')](),controller[_0xb525('0xd')]);router[_0xb525('0x9')](_0xb525('0xe'),auth[_0xb525('0xa')](),controller[_0xb525('0xf')]);router[_0xb525('0x10')]('/',auth[_0xb525('0xa')](),controller[_0xb525('0x11')]);router['post']('/:id/sounds',auth[_0xb525('0xa')](),controller['addSound']);router[_0xb525('0x12')]('/:id',auth[_0xb525('0xa')](),controller[_0xb525('0x13')]);router[_0xb525('0x14')](_0xb525('0xc'),auth['isAuthenticated'](),controller['destroy']);router['delete']('/:id/sounds/:id2',auth[_0xb525('0xa')](),controller['removeSound']);module[_0xb525('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index f19e449..09f9253 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 _0x3477=['alpha','TIMESTAMP','BOOLEAN','sequelize','exports','STRING','name','ENUM','custom','files','mp3nb','quietmp3nb','mp3'];(function(_0x37901d,_0x346a56){var _0x1f28c9=function(_0x117eac){while(--_0x117eac){_0x37901d['push'](_0x37901d['shift']());}};_0x1f28c9(++_0x346a56);}(_0x3477,0x85));var _0x7347=function(_0x38c900,_0x590c05){_0x38c900=_0x38c900-0x0;var _0x48a640=_0x3477[_0x38c900];return _0x48a640;};'use strict';var Sequelize=require(_0x7347('0x0'));module[_0x7347('0x1')]={'name':{'type':Sequelize[_0x7347('0x2')],'allowNull':![],'unique':_0x7347('0x3')},'mode':{'type':Sequelize[_0x7347('0x4')](_0x7347('0x5'),_0x7347('0x6'),_0x7347('0x7'),_0x7347('0x8'),'quietmp3',_0x7347('0x9')),'allowNull':!![],'defaultValue':_0x7347('0x6')},'directory':{'type':Sequelize[_0x7347('0x2')],'allowNull':!![]},'application':{'type':Sequelize['STRING'],'allowNull':!![]},'digit':{'type':Sequelize[_0x7347('0x2')],'allowNull':!![]},'sort':{'type':Sequelize[_0x7347('0x2')],'allowNull':!![],'defaultValue':_0x7347('0xa')},'format':{'type':Sequelize[_0x7347('0x2')],'allowNull':!![]},'stamp':{'type':_0x7347('0xb')},'defaultEntry':{'type':Sequelize[_0x7347('0xc')],'defaultValue':0x0}}; \ No newline at end of file +var _0xa5cf=['files','mp3nb','quietmp3nb','quietmp3','alpha','TIMESTAMP','BOOLEAN','sequelize','STRING','name','ENUM','custom'];(function(_0x552ef0,_0x15c171){var _0x17e234=function(_0x400cfc){while(--_0x400cfc){_0x552ef0['push'](_0x552ef0['shift']());}};_0x17e234(++_0x15c171);}(_0xa5cf,0x11b));var _0xfa5c=function(_0x8ef9b9,_0x52e4ce){_0x8ef9b9=_0x8ef9b9-0x0;var _0x2109a8=_0xa5cf[_0x8ef9b9];return _0x2109a8;};'use strict';var Sequelize=require(_0xfa5c('0x0'));module['exports']={'name':{'type':Sequelize[_0xfa5c('0x1')],'allowNull':![],'unique':_0xfa5c('0x2')},'mode':{'type':Sequelize[_0xfa5c('0x3')](_0xfa5c('0x4'),_0xfa5c('0x5'),_0xfa5c('0x6'),_0xfa5c('0x7'),_0xfa5c('0x8'),'mp3'),'allowNull':!![],'defaultValue':_0xfa5c('0x5')},'directory':{'type':Sequelize['STRING'],'allowNull':!![]},'application':{'type':Sequelize[_0xfa5c('0x1')],'allowNull':!![]},'digit':{'type':Sequelize['STRING'],'allowNull':!![]},'sort':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xfa5c('0x9')},'format':{'type':Sequelize['STRING'],'allowNull':!![]},'stamp':{'type':_0xfa5c('0xa')},'defaultEntry':{'type':Sequelize[_0xfa5c('0xb')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js index 25b070c..3db7b0e 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 _0x5480=['catch','show','params','length','options','find','body','create','transaction','files','directory','root','server/files/moh','mode','mkdirSync','0777','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','sequelize','forEach','unlinkSync','join','rmdirSync','ValidationError','addSound','findOne','save_name','converted_format','server/files/sounds/converted','%s.%s','basename','extname','format','Sequelize','message','removeSound','id2','Sound','createdAt','getSounds','pick','rimraf','zip-dir','moment','bluebird','util','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','get','MusicOnHolds','UserProfileResource','end','error','name','send','index','map','VoiceMusicOnHold','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','includeAll','include','findAll','rows'];(function(_0x2f0533,_0x3200e2){var _0x15d58a=function(_0x3c0cd9){while(--_0x3c0cd9){_0x2f0533['push'](_0x2f0533['shift']());}};_0x15d58a(++_0x3200e2);}(_0x5480,0x111));var _0x0548=function(_0x574617,_0x42eccc){_0x574617=_0x574617-0x0;var _0x29de90=_0x5480[_0x574617];return _0x29de90;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0548('0x0'));var zipdir=require(_0x0548('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0548('0x2'));var BPromise=require(_0x0548('0x3'));var Mustache=require('mustache');var util=require(_0x0548('0x4'));var path=require(_0x0548('0x5'));var sox=require(_0x0548('0x6'));var csv=require(_0x0548('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0548('0x8'));var squel=require(_0x0548('0x9'));var crypto=require(_0x0548('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x0548('0xb'));var toCsv=require('to-csv');var querystring=require(_0x0548('0xc'));var Papa=require(_0x0548('0xd'));var Redis=require(_0x0548('0xe'));var authService=require(_0x0548('0xf'));var qs=require(_0x0548('0x10'));var as=require(_0x0548('0x11'));var hardwareService=require(_0x0548('0x12'));var logger=require(_0x0548('0x13'))(_0x0548('0x14'));var utils=require(_0x0548('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x0548('0x16'))['db'];function respondWithStatusCode(_0x47407e,_0x2eafd2){_0x2eafd2=_0x2eafd2||0xcc;return function(_0x23135a){if(_0x23135a){return _0x47407e[_0x0548('0x17')](_0x2eafd2);}return _0x47407e[_0x0548('0x18')](_0x2eafd2)['end']();};}function respondWithResult(_0x169a62,_0x24db94){_0x24db94=_0x24db94||0xc8;return function(_0x20abc1){if(_0x20abc1){return _0x169a62[_0x0548('0x18')](_0x24db94)[_0x0548('0x19')](_0x20abc1);}};}function respondWithFilteredResult(_0xd2316b,_0x36cde0){return function(_0x2a49b5){if(_0x2a49b5){var _0x2f793f=typeof _0x36cde0[_0x0548('0x1a')]===_0x0548('0x1b')&&typeof _0x36cde0[_0x0548('0x1c')]===_0x0548('0x1b');var _0x3a5ba7=_0x2a49b5[_0x0548('0x1d')];var _0x306d1f=_0x2f793f?0x0:_0x36cde0[_0x0548('0x1a')];var _0x5e2d19=_0x2f793f?_0x2a49b5[_0x0548('0x1d')]:_0x36cde0[_0x0548('0x1a')]+_0x36cde0[_0x0548('0x1c')];var _0x1db5ee;if(_0x5e2d19>=_0x3a5ba7){_0x5e2d19=_0x3a5ba7;_0x1db5ee=0xc8;}else{_0x1db5ee=0xce;}_0xd2316b[_0x0548('0x18')](_0x1db5ee);return _0xd2316b[_0x0548('0x1e')]('Content-Range',_0x306d1f+'-'+_0x5e2d19+'/'+_0x3a5ba7)[_0x0548('0x19')](_0x2a49b5);}return null;};}function patchUpdates(_0x240d90){return function(_0x5f57cf){try{jsonpatch[_0x0548('0x1f')](_0x5f57cf,_0x240d90,!![]);}catch(_0x7421cd){return BPromise[_0x0548('0x20')](_0x7421cd);}return _0x5f57cf[_0x0548('0x21')]();};}function saveUpdates(_0x2bf7ad,_0x56598d){return function(_0x307fc6){if(_0x307fc6){return _0x307fc6[_0x0548('0x22')](_0x2bf7ad)[_0x0548('0x23')](function(_0x262722){return _0x262722;});}return null;};}function removeEntity(_0x4423ae,_0xf1ddd6){return function(_0xd3444e){if(_0xd3444e){return _0xd3444e[_0x0548('0x24')]()[_0x0548('0x23')](function(){var _0x4cf3c0=_0xd3444e[_0x0548('0x25')]({'plain':!![]});var _0x14a683=_0x0548('0x26');return db[_0x0548('0x27')][_0x0548('0x24')]({'where':{'type':_0x14a683,'resourceId':_0x4cf3c0['id']}})['then'](function(){return _0xd3444e;});})[_0x0548('0x23')](function(){_0x4423ae[_0x0548('0x18')](0xcc)[_0x0548('0x28')]();});}};}function handleEntityNotFound(_0x2deab0,_0x337f10){return function(_0x249d0c){if(!_0x249d0c){_0x2deab0[_0x0548('0x17')](0x194);}return _0x249d0c;};}function handleError(_0x356ead,_0x1d04b7){_0x1d04b7=_0x1d04b7||0x1f4;return function(_0x153f41){logger[_0x0548('0x29')](_0x153f41['stack']);if(_0x153f41['name']){delete _0x153f41[_0x0548('0x2a')];}_0x356ead['status'](_0x1d04b7)[_0x0548('0x2b')](_0x153f41);};}exports[_0x0548('0x2c')]=function(_0x303e2d,_0x351c89){var _0x5f0a20={},_0x55d75={},_0x48e016={'count':0x0,'rows':[]};var _0x483134=_[_0x0548('0x2d')](db[_0x0548('0x2e')][_0x0548('0x2f')],function(_0x233dda){return{'name':_0x233dda[_0x0548('0x30')],'type':_0x233dda[_0x0548('0x31')][_0x0548('0x32')]};});_0x55d75[_0x0548('0x33')]=_[_0x0548('0x2d')](_0x483134,'name');_0x55d75['query']=_[_0x0548('0x34')](_0x303e2d[_0x0548('0x35')]);_0x55d75['filters']=_[_0x0548('0x36')](_0x55d75[_0x0548('0x33')],_0x55d75[_0x0548('0x35')]);_0x5f0a20[_0x0548('0x37')]=_[_0x0548('0x36')](_0x55d75[_0x0548('0x33')],qs[_0x0548('0x38')](_0x303e2d[_0x0548('0x35')][_0x0548('0x38')]));_0x5f0a20['attributes']=_0x5f0a20[_0x0548('0x37')]['length']?_0x5f0a20[_0x0548('0x37')]:_0x55d75[_0x0548('0x33')];if(!_0x303e2d['query'][_0x0548('0x39')](_0x0548('0x3a'))){_0x5f0a20[_0x0548('0x1c')]=qs[_0x0548('0x1c')](_0x303e2d[_0x0548('0x35')][_0x0548('0x1c')]);_0x5f0a20[_0x0548('0x1a')]=qs[_0x0548('0x1a')](_0x303e2d[_0x0548('0x35')][_0x0548('0x1a')]);}_0x5f0a20[_0x0548('0x3b')]=qs[_0x0548('0x3c')](_0x303e2d[_0x0548('0x35')][_0x0548('0x3c')]);delete _0x303e2d[_0x0548('0x35')][_0x0548('0x3c')];_0x5f0a20[_0x0548('0x3d')]=qs[_0x0548('0x3e')](_['pick'](_0x303e2d['query'],_0x55d75[_0x0548('0x3e')]),_0x483134);if(_0x303e2d[_0x0548('0x35')][_0x0548('0x3f')]){_0x5f0a20['where']=_[_0x0548('0x40')](_0x5f0a20[_0x0548('0x3d')],{'$or':_[_0x0548('0x2d')](_0x483134,function(_0xea8baf){if(_0xea8baf[_0x0548('0x31')]!=='VIRTUAL'){var _0x2cbf83={};_0x2cbf83[_0xea8baf[_0x0548('0x2a')]]={'$like':'%'+_0x303e2d[_0x0548('0x35')][_0x0548('0x3f')]+'%'};return _0x2cbf83;}})});}_0x5f0a20=_['merge']({},_0x5f0a20,_0x303e2d['options']);var _0x4734d9={'where':_0x5f0a20[_0x0548('0x3d')]};return db[_0x0548('0x2e')]['count'](_0x4734d9)[_0x0548('0x23')](function(_0x497b75){_0x48e016[_0x0548('0x1d')]=_0x497b75;if(_0x303e2d[_0x0548('0x35')][_0x0548('0x41')]){_0x5f0a20[_0x0548('0x42')]=[{'all':!![]}];}return db['VoiceMusicOnHold'][_0x0548('0x43')](_0x5f0a20);})[_0x0548('0x23')](function(_0x5b34a8){_0x48e016[_0x0548('0x44')]=_0x5b34a8;return _0x48e016;})[_0x0548('0x23')](respondWithFilteredResult(_0x351c89,_0x5f0a20))[_0x0548('0x45')](handleError(_0x351c89,null));};exports[_0x0548('0x46')]=function(_0x3c11fc,_0x3a071e){var _0x53b015={'raw':![],'where':{'id':_0x3c11fc[_0x0548('0x47')]['id']}},_0x538815={};_0x538815[_0x0548('0x33')]=_[_0x0548('0x34')](db['VoiceMusicOnHold'][_0x0548('0x2f')]);_0x538815[_0x0548('0x35')]=_['keys'](_0x3c11fc[_0x0548('0x35')]);_0x538815['filters']=_[_0x0548('0x36')](_0x538815[_0x0548('0x33')],_0x538815[_0x0548('0x35')]);_0x53b015[_0x0548('0x37')]=_['intersection'](_0x538815[_0x0548('0x33')],qs[_0x0548('0x38')](_0x3c11fc[_0x0548('0x35')][_0x0548('0x38')]));_0x53b015[_0x0548('0x37')]=_0x53b015[_0x0548('0x37')][_0x0548('0x48')]?_0x53b015['attributes']:_0x538815['model'];if(_0x3c11fc[_0x0548('0x35')][_0x0548('0x41')]){_0x53b015[_0x0548('0x42')]=[{'all':!![]}];}_0x53b015=_[_0x0548('0x40')]({},_0x53b015,_0x3c11fc[_0x0548('0x49')]);return db['VoiceMusicOnHold'][_0x0548('0x4a')](_0x53b015)['then'](handleEntityNotFound(_0x3a071e,null))[_0x0548('0x23')](respondWithResult(_0x3a071e,null))['catch'](handleError(_0x3a071e,null));};exports[_0x0548('0x22')]=function(_0xec7bb7,_0xcbf942){if(_0xec7bb7[_0x0548('0x4b')]['id']){delete _0xec7bb7['body']['id'];}return db[_0x0548('0x2e')][_0x0548('0x4a')]({'where':{'id':_0xec7bb7[_0x0548('0x47')]['id']}})[_0x0548('0x23')](handleEntityNotFound(_0xcbf942,null))[_0x0548('0x23')](saveUpdates(_0xec7bb7[_0x0548('0x4b')],null))['then'](respondWithResult(_0xcbf942,null))[_0x0548('0x45')](handleError(_0xcbf942,null));};exports[_0x0548('0x4c')]=function(_0x2de451,_0x3a2669,_0x222556){return db['sequelize'][_0x0548('0x4d')](function(_0x59c9aa){if(_0x2de451[_0x0548('0x4b')]['mode']===_0x0548('0x4e')){_0x2de451[_0x0548('0x4b')][_0x0548('0x4f')]=path['join'](config[_0x0548('0x50')],_0x0548('0x51'),_0x2de451[_0x0548('0x4b')][_0x0548('0x2a')]);}return db[_0x0548('0x2e')][_0x0548('0x4c')](_0x2de451[_0x0548('0x4b')],{'transaction':_0x59c9aa})['then'](function(_0x4c4548){if(_0x2de451[_0x0548('0x4b')][_0x0548('0x52')]===_0x0548('0x4e')){fs[_0x0548('0x53')](_0x4c4548[_0x0548('0x4f')],parseInt(_0x0548('0x54'),0x8));}var _0x4086cf=_0x2de451['user'][_0x0548('0x25')]({'plain':!![]});if(!_0x4086cf)throw new Error(_0x0548('0x55'));if(_0x4086cf[_0x0548('0x56')]===_0x0548('0x57')){var _0xad73ba=_0x4c4548[_0x0548('0x25')]({'plain':!![]});return db[_0x0548('0x58')][_0x0548('0x4a')]({'where':{'name':_0x0548('0x26'),'userProfileId':_0x4086cf['userProfileId']},'raw':!![]})[_0x0548('0x23')](function(_0x1e9c95){if(_0x1e9c95&&_0x1e9c95[_0x0548('0x59')]===0x0){return db[_0x0548('0x27')][_0x0548('0x4c')]({'name':_0xad73ba[_0x0548('0x2a')],'resourceId':_0xad73ba['id'],'type':_0x1e9c95[_0x0548('0x2a')],'sectionId':_0x1e9c95['id']},{})[_0x0548('0x23')](function(){return _0x4c4548;});}else{return _0x4c4548;}})['catch'](function(_0x2f3cbe){logger['error'](_0x0548('0x5a'),_0x2f3cbe);});}return _0x4c4548;});})[_0x0548('0x23')](respondWithResult(_0x3a2669,0xc9))[_0x0548('0x45')](handleError(_0x3a2669,null));};exports[_0x0548('0x24')]=function(_0x3db368,_0x245bf2,_0x2ee19c){var _0x14a8a4;return db[_0x0548('0x2e')]['find']({'where':{'id':_0x3db368['params']['id']}})[_0x0548('0x23')](function(_0x108e10){if(_0x108e10){return db[_0x0548('0x5b')][_0x0548('0x4d')](function(_0x284e6d){return _0x108e10[_0x0548('0x24')]({'transaction':_0x284e6d,'raw':!![]})['then'](function(_0x1380a5){if(_0x1380a5[_0x0548('0x4f')]){fs['readdirSync'](_0x1380a5[_0x0548('0x4f')])[_0x0548('0x5c')](function(_0x1474d5){fs[_0x0548('0x5d')](path[_0x0548('0x5e')](_0x1380a5[_0x0548('0x4f')],_0x1474d5));});fs[_0x0548('0x5f')](_0x1380a5['directory']);}return _0x1380a5;});})[_0x0548('0x45')](function(_0x4d076c){throw new db['Sequelize'][(_0x0548('0x60'))](_0x4d076c['message']);});}})[_0x0548('0x23')](handleEntityNotFound(_0x245bf2,null))[_0x0548('0x23')](removeEntity(_0x245bf2,null))[_0x0548('0x45')](handleError(_0x245bf2,null));};exports['addSound']=function(_0x2988d7,_0x2c7367,_0xda8df8){return db[_0x0548('0x5b')][_0x0548('0x4d')](function(_0x1c6923){var _0x58258b;return db[_0x0548('0x2e')]['find']({'where':{'id':_0x2988d7[_0x0548('0x47')]['id']}})[_0x0548('0x23')](function(_0x99f061){if(_0x99f061){_0x58258b=_0x99f061;return _0x99f061[_0x0548('0x61')](_0x2988d7[_0x0548('0x4b')]['id'],{'transaction':_0x1c6923});}})[_0x0548('0x23')](function(_0x46d3c3){if(_0x46d3c3){return db['Sound'][_0x0548('0x62')]({'where':{'id':_0x2988d7[_0x0548('0x4b')]['id']},'attributes':['id','name',_0x0548('0x63'),_0x0548('0x64'),'createdAt'],'raw':!![]});}})['then'](function(_0x53d413){if(_0x53d413){var _0xe8856a=path[_0x0548('0x5e')](config[_0x0548('0x50')],_0x0548('0x65'),util['format'](_0x0548('0x66'),path[_0x0548('0x67')](_0x53d413['save_name'],path[_0x0548('0x68')](_0x53d413[_0x0548('0x63')])),_0x53d413[_0x0548('0x64')]));var _0x496d93=path['join'](config[_0x0548('0x50')],_0x0548('0x51'),_0x58258b[_0x0548('0x2a')],util[_0x0548('0x69')]('%s.%s',_0x53d413['name'],_0x53d413[_0x0548('0x64')]));fs['symlinkSync'](_0xe8856a,_0x496d93);return _0x53d413;}})[_0x0548('0x45')](function(_0xc3c40f){throw new db[(_0x0548('0x6a'))]['ValidationError'](_0xc3c40f[_0x0548('0x6b')]);});})[_0x0548('0x23')](handleEntityNotFound(_0x2c7367,null))['then'](respondWithResult(_0x2c7367,0xc9))['catch'](handleError(_0x2c7367,null));};exports[_0x0548('0x6c')]=function(_0x213622,_0x5c9533,_0x12e3e4){return db['sequelize'][_0x0548('0x4d')](function(_0x40a012){var _0x4f4d6d;return db['VoiceMusicOnHold'][_0x0548('0x62')]({'where':{'id':_0x213622[_0x0548('0x47')]['id']}})[_0x0548('0x23')](handleEntityNotFound(_0x5c9533,null))[_0x0548('0x23')](function(_0x1eb9ae){if(_0x1eb9ae){_0x4f4d6d=_0x1eb9ae;return _0x1eb9ae[_0x0548('0x6c')](_0x213622[_0x0548('0x47')][_0x0548('0x6d')]);}})[_0x0548('0x23')](function(_0x5dd52c){if(_0x5dd52c){return db[_0x0548('0x6e')]['findOne']({'where':{'id':_0x213622[_0x0548('0x47')]['id2']},'attributes':['id',_0x0548('0x2a'),'save_name',_0x0548('0x64'),_0x0548('0x6f')],'raw':!![]});}})[_0x0548('0x23')](function(_0x47d0df){if(_0x47d0df){fs[_0x0548('0x5d')](path[_0x0548('0x5e')](_0x4f4d6d[_0x0548('0x4f')],util[_0x0548('0x69')](_0x0548('0x66'),_0x47d0df[_0x0548('0x2a')],_0x47d0df[_0x0548('0x64')])));return _0x47d0df;}})['catch'](function(_0xa8926a){throw new db[(_0x0548('0x6a'))][(_0x0548('0x60'))](_0xa8926a[_0x0548('0x6b')]);});})[_0x0548('0x23')](handleEntityNotFound(_0x5c9533,null))['then'](respondWithStatusCode(_0x5c9533,0xcc))[_0x0548('0x45')](handleError(_0x5c9533,null));};exports[_0x0548('0x70')]=function(_0x105668,_0x30e46c,_0x209ad5){var _0x5eb389={};var _0x224d12={};var _0x54a523;var _0x86600;return db[_0x0548('0x2e')]['findOne']({'where':{'id':_0x105668[_0x0548('0x47')]['id']}})[_0x0548('0x23')](handleEntityNotFound(_0x30e46c,null))['then'](function(_0x1df21b){if(_0x1df21b){_0x54a523=_0x1df21b;_0x224d12[_0x0548('0x33')]=_[_0x0548('0x34')](db[_0x0548('0x6e')]['rawAttributes']);_0x224d12[_0x0548('0x35')]=_[_0x0548('0x34')](_0x105668['query']);_0x224d12[_0x0548('0x3e')]=_[_0x0548('0x36')](_0x224d12[_0x0548('0x33')],_0x224d12[_0x0548('0x35')]);_0x5eb389[_0x0548('0x37')]=_['intersection'](_0x224d12[_0x0548('0x33')],qs[_0x0548('0x38')](_0x105668[_0x0548('0x35')][_0x0548('0x38')]));_0x5eb389[_0x0548('0x37')]=_0x5eb389[_0x0548('0x37')][_0x0548('0x48')]?_0x5eb389['attributes']:_0x224d12['model'];_0x5eb389[_0x0548('0x3b')]=qs[_0x0548('0x3c')](_0x105668[_0x0548('0x35')][_0x0548('0x3c')]);_0x5eb389[_0x0548('0x3d')]=qs[_0x0548('0x3e')](_[_0x0548('0x71')](_0x105668[_0x0548('0x35')],_0x224d12[_0x0548('0x3e')]));if(_0x105668['query']['filter']){_0x5eb389['where']=_[_0x0548('0x40')](_0x5eb389['where'],{'$or':_[_0x0548('0x2d')](_0x5eb389[_0x0548('0x37')],function(_0x238df7){var _0x1f9f3c={};_0x1f9f3c[_0x238df7]={'$like':'%'+_0x105668[_0x0548('0x35')][_0x0548('0x3f')]+'%'};return _0x1f9f3c;})});}_0x5eb389=_[_0x0548('0x40')]({},_0x5eb389,_0x105668[_0x0548('0x49')]);return _0x54a523[_0x0548('0x70')](_0x5eb389);}})[_0x0548('0x23')](function(_0x329836){if(_0x329836){_0x86600=_0x329836[_0x0548('0x48')];if(!_0x105668['query'][_0x0548('0x39')]('nolimit')){_0x5eb389[_0x0548('0x1c')]=qs[_0x0548('0x1c')](_0x105668[_0x0548('0x35')]['limit']);_0x5eb389[_0x0548('0x1a')]=qs[_0x0548('0x1a')](_0x105668[_0x0548('0x35')]['offset']);}return _0x54a523[_0x0548('0x70')](_0x5eb389);}})[_0x0548('0x23')](function(_0x5e4220){if(_0x5e4220){return _0x5e4220?{'count':_0x86600,'rows':_0x5e4220}:null;}})['then'](respondWithResult(_0x30e46c,null))[_0x0548('0x45')](handleError(_0x30e46c,null));}; \ No newline at end of file +var _0x368b=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','update','then','destroy','MusicOnHolds','stack','name','send','index','map','rawAttributes','type','model','keys','query','intersection','attributes','fields','length','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','VoiceMusicOnHold','include','findAll','catch','params','find','body','create','sequelize','mode','files','directory','join','mkdirSync','0777','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','transaction','readdirSync','forEach','rmdirSync','Sequelize','ValidationError','message','addSound','Sound','save_name','converted_format','createdAt','root','server/files/sounds/converted','format','basename','server/files/moh','%s.%s','symlinkSync','removeSound','id2','getSounds','order','hasOwnProperty','fast-json-patch','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/advancedSearch'];(function(_0x247f5f,_0x2ea651){var _0x2b7878=function(_0x100609){while(--_0x100609){_0x247f5f['push'](_0x247f5f['shift']());}};_0x2b7878(++_0x2ea651);}(_0x368b,0xc8));var _0xb368=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x368b[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xb368('0x0'));var rp=require('request-promise');var moment=require(_0xb368('0x1'));var BPromise=require(_0xb368('0x2'));var Mustache=require(_0xb368('0x3'));var util=require(_0xb368('0x4'));var path=require('path');var sox=require(_0xb368('0x5'));var csv=require('to-csv');var ejs=require(_0xb368('0x6'));var fs=require('fs');var fs_extra=require(_0xb368('0x7'));var _=require(_0xb368('0x8'));var squel=require('squel');var crypto=require(_0xb368('0x9'));var jsforce=require(_0xb368('0xa'));var deskjs=require(_0xb368('0xb'));var toCsv=require(_0xb368('0xc'));var querystring=require('querystring');var Papa=require(_0xb368('0xd'));var Redis=require('ioredis');var authService=require(_0xb368('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xb368('0xf'));var hardwareService=require(_0xb368('0x10'));var logger=require(_0xb368('0x11'))(_0xb368('0x12'));var utils=require(_0xb368('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xb368('0x14'));var db=require(_0xb368('0x15'))['db'];function respondWithStatusCode(_0x466f9a,_0x4f49c7){_0x4f49c7=_0x4f49c7||0xcc;return function(_0x33e9d9){if(_0x33e9d9){return _0x466f9a[_0xb368('0x16')](_0x4f49c7);}return _0x466f9a[_0xb368('0x17')](_0x4f49c7)[_0xb368('0x18')]();};}function respondWithResult(_0x54638d,_0x5b52c6){_0x5b52c6=_0x5b52c6||0xc8;return function(_0xd8b2c9){if(_0xd8b2c9){return _0x54638d['status'](_0x5b52c6)[_0xb368('0x19')](_0xd8b2c9);}};}function respondWithFilteredResult(_0x45b3de,_0x454492){return function(_0x271944){if(_0x271944){var _0x430c7e=typeof _0x454492[_0xb368('0x1a')]===_0xb368('0x1b')&&typeof _0x454492[_0xb368('0x1c')]==='undefined';var _0x5e4ca8=_0x271944[_0xb368('0x1d')];var _0x5174ce=_0x430c7e?0x0:_0x454492[_0xb368('0x1a')];var _0x19f69a=_0x430c7e?_0x271944[_0xb368('0x1d')]:_0x454492['offset']+_0x454492[_0xb368('0x1c')];var _0x4382c5;if(_0x19f69a>=_0x5e4ca8){_0x19f69a=_0x5e4ca8;_0x4382c5=0xc8;}else{_0x4382c5=0xce;}_0x45b3de[_0xb368('0x17')](_0x4382c5);return _0x45b3de[_0xb368('0x1e')]('Content-Range',_0x5174ce+'-'+_0x19f69a+'/'+_0x5e4ca8)[_0xb368('0x19')](_0x271944);}return null;};}function patchUpdates(_0x23d6b3){return function(_0x15d69d){try{jsonpatch[_0xb368('0x1f')](_0x15d69d,_0x23d6b3,!![]);}catch(_0x15b133){return BPromise[_0xb368('0x20')](_0x15b133);}return _0x15d69d['save']();};}function saveUpdates(_0x1b99b9,_0x27634c){return function(_0x4311a4){if(_0x4311a4){return _0x4311a4[_0xb368('0x21')](_0x1b99b9)[_0xb368('0x22')](function(_0x5a9aba){return _0x5a9aba;});}return null;};}function removeEntity(_0x61697b,_0x13cf54){return function(_0x3caf54){if(_0x3caf54){return _0x3caf54[_0xb368('0x23')]()[_0xb368('0x22')](function(){var _0x35fd40=_0x3caf54['get']({'plain':!![]});var _0x489e1a=_0xb368('0x24');return db['UserProfileResource'][_0xb368('0x23')]({'where':{'type':_0x489e1a,'resourceId':_0x35fd40['id']}})[_0xb368('0x22')](function(){return _0x3caf54;});})[_0xb368('0x22')](function(){_0x61697b[_0xb368('0x17')](0xcc)[_0xb368('0x18')]();});}};}function handleEntityNotFound(_0x2459d2,_0x4999bf){return function(_0x3068a5){if(!_0x3068a5){_0x2459d2['sendStatus'](0x194);}return _0x3068a5;};}function handleError(_0x33e575,_0x1c8d3d){_0x1c8d3d=_0x1c8d3d||0x1f4;return function(_0x42f1b1){logger['error'](_0x42f1b1[_0xb368('0x25')]);if(_0x42f1b1[_0xb368('0x26')]){delete _0x42f1b1[_0xb368('0x26')];}_0x33e575[_0xb368('0x17')](_0x1c8d3d)[_0xb368('0x27')](_0x42f1b1);};}exports[_0xb368('0x28')]=function(_0x588308,_0x43a779){var _0x5ad016={},_0x44f55a={},_0x1bb865={'count':0x0,'rows':[]};var _0x1716e3=_[_0xb368('0x29')](db['VoiceMusicOnHold'][_0xb368('0x2a')],function(_0x158219){return{'name':_0x158219['fieldName'],'type':_0x158219[_0xb368('0x2b')]['key']};});_0x44f55a[_0xb368('0x2c')]=_[_0xb368('0x29')](_0x1716e3,_0xb368('0x26'));_0x44f55a['query']=_[_0xb368('0x2d')](_0x588308[_0xb368('0x2e')]);_0x44f55a['filters']=_[_0xb368('0x2f')](_0x44f55a[_0xb368('0x2c')],_0x44f55a[_0xb368('0x2e')]);_0x5ad016[_0xb368('0x30')]=_['intersection'](_0x44f55a[_0xb368('0x2c')],qs['fields'](_0x588308['query'][_0xb368('0x31')]));_0x5ad016[_0xb368('0x30')]=_0x5ad016['attributes'][_0xb368('0x32')]?_0x5ad016[_0xb368('0x30')]:_0x44f55a[_0xb368('0x2c')];if(!_0x588308[_0xb368('0x2e')]['hasOwnProperty'](_0xb368('0x33'))){_0x5ad016[_0xb368('0x1c')]=qs[_0xb368('0x1c')](_0x588308['query'][_0xb368('0x1c')]);_0x5ad016['offset']=qs[_0xb368('0x1a')](_0x588308[_0xb368('0x2e')][_0xb368('0x1a')]);}_0x5ad016['order']=qs[_0xb368('0x34')](_0x588308[_0xb368('0x2e')][_0xb368('0x34')]);delete _0x588308['query'][_0xb368('0x34')];_0x5ad016[_0xb368('0x35')]=qs[_0xb368('0x36')](_[_0xb368('0x37')](_0x588308['query'],_0x44f55a['filters']),_0x1716e3);if(_0x588308['query'][_0xb368('0x38')]){_0x5ad016[_0xb368('0x35')]=_[_0xb368('0x39')](_0x5ad016[_0xb368('0x35')],{'$or':_[_0xb368('0x29')](_0x1716e3,function(_0x75daff){if(_0x75daff[_0xb368('0x2b')]!==_0xb368('0x3a')){var _0x4d1106={};_0x4d1106[_0x75daff[_0xb368('0x26')]]={'$like':'%'+_0x588308[_0xb368('0x2e')][_0xb368('0x38')]+'%'};return _0x4d1106;}})});}_0x5ad016=_['merge']({},_0x5ad016,_0x588308[_0xb368('0x3b')]);var _0x7ab8fe={'where':_0x5ad016[_0xb368('0x35')]};return db[_0xb368('0x3c')][_0xb368('0x1d')](_0x7ab8fe)[_0xb368('0x22')](function(_0x3c11fd){_0x1bb865['count']=_0x3c11fd;if(_0x588308[_0xb368('0x2e')]['includeAll']){_0x5ad016[_0xb368('0x3d')]=[{'all':!![]}];}return db['VoiceMusicOnHold'][_0xb368('0x3e')](_0x5ad016);})[_0xb368('0x22')](function(_0x3c9da4){_0x1bb865['rows']=_0x3c9da4;return _0x1bb865;})[_0xb368('0x22')](respondWithFilteredResult(_0x43a779,_0x5ad016))[_0xb368('0x3f')](handleError(_0x43a779,null));};exports['show']=function(_0x4cafca,_0x132390){var _0xce493f={'raw':![],'where':{'id':_0x4cafca[_0xb368('0x40')]['id']}},_0x5795a4={};_0x5795a4['model']=_[_0xb368('0x2d')](db[_0xb368('0x3c')][_0xb368('0x2a')]);_0x5795a4['query']=_[_0xb368('0x2d')](_0x4cafca[_0xb368('0x2e')]);_0x5795a4[_0xb368('0x36')]=_[_0xb368('0x2f')](_0x5795a4[_0xb368('0x2c')],_0x5795a4[_0xb368('0x2e')]);_0xce493f[_0xb368('0x30')]=_[_0xb368('0x2f')](_0x5795a4['model'],qs[_0xb368('0x31')](_0x4cafca[_0xb368('0x2e')][_0xb368('0x31')]));_0xce493f[_0xb368('0x30')]=_0xce493f[_0xb368('0x30')][_0xb368('0x32')]?_0xce493f[_0xb368('0x30')]:_0x5795a4[_0xb368('0x2c')];if(_0x4cafca[_0xb368('0x2e')]['includeAll']){_0xce493f[_0xb368('0x3d')]=[{'all':!![]}];}_0xce493f=_[_0xb368('0x39')]({},_0xce493f,_0x4cafca[_0xb368('0x3b')]);return db[_0xb368('0x3c')][_0xb368('0x41')](_0xce493f)[_0xb368('0x22')](handleEntityNotFound(_0x132390,null))[_0xb368('0x22')](respondWithResult(_0x132390,null))[_0xb368('0x3f')](handleError(_0x132390,null));};exports[_0xb368('0x21')]=function(_0x41a848,_0x294ea6){if(_0x41a848['body']['id']){delete _0x41a848['body']['id'];}return db[_0xb368('0x3c')][_0xb368('0x41')]({'where':{'id':_0x41a848[_0xb368('0x40')]['id']}})['then'](handleEntityNotFound(_0x294ea6,null))[_0xb368('0x22')](saveUpdates(_0x41a848[_0xb368('0x42')],null))[_0xb368('0x22')](respondWithResult(_0x294ea6,null))[_0xb368('0x3f')](handleError(_0x294ea6,null));};exports[_0xb368('0x43')]=function(_0x53b480,_0x3c0859,_0x3012a4){return db[_0xb368('0x44')]['transaction'](function(_0x2db8e0){if(_0x53b480[_0xb368('0x42')][_0xb368('0x45')]===_0xb368('0x46')){_0x53b480['body'][_0xb368('0x47')]=path[_0xb368('0x48')](config['root'],'server/files/moh',_0x53b480[_0xb368('0x42')]['name']);}return db[_0xb368('0x3c')]['create'](_0x53b480[_0xb368('0x42')],{'transaction':_0x2db8e0})[_0xb368('0x22')](function(_0x21c880){if(_0x53b480[_0xb368('0x42')][_0xb368('0x45')]===_0xb368('0x46')){fs[_0xb368('0x49')](_0x21c880[_0xb368('0x47')],parseInt(_0xb368('0x4a'),0x8));}var _0x18546b=_0x53b480[_0xb368('0x4b')][_0xb368('0x4c')]({'plain':!![]});if(!_0x18546b)throw new Error(_0xb368('0x4d'));if(_0x18546b[_0xb368('0x4e')]===_0xb368('0x4b')){var _0x375f93=_0x21c880[_0xb368('0x4c')]({'plain':!![]});return db['UserProfileSection'][_0xb368('0x41')]({'where':{'name':_0xb368('0x24'),'userProfileId':_0x18546b[_0xb368('0x4f')]},'raw':!![]})[_0xb368('0x22')](function(_0x5cc4f4){if(_0x5cc4f4&&_0x5cc4f4[_0xb368('0x50')]===0x0){return db[_0xb368('0x51')][_0xb368('0x43')]({'name':_0x375f93['name'],'resourceId':_0x375f93['id'],'type':_0x5cc4f4[_0xb368('0x26')],'sectionId':_0x5cc4f4['id']},{})[_0xb368('0x22')](function(){return _0x21c880;});}else{return _0x21c880;}})['catch'](function(_0x1b9ffc){logger[_0xb368('0x52')](_0xb368('0x53'),_0x1b9ffc);});}return _0x21c880;});})[_0xb368('0x22')](respondWithResult(_0x3c0859,0xc9))['catch'](handleError(_0x3c0859,null));};exports[_0xb368('0x23')]=function(_0x2cd33c,_0x41b00b,_0x39ed81){var _0x5774c1;return db[_0xb368('0x3c')]['find']({'where':{'id':_0x2cd33c['params']['id']}})[_0xb368('0x22')](function(_0x44968f){if(_0x44968f){return db[_0xb368('0x44')][_0xb368('0x54')](function(_0x5add51){return _0x44968f[_0xb368('0x23')]({'transaction':_0x5add51,'raw':!![]})[_0xb368('0x22')](function(_0x5d7003){if(_0x5d7003[_0xb368('0x47')]){fs[_0xb368('0x55')](_0x5d7003[_0xb368('0x47')])[_0xb368('0x56')](function(_0x1e324d){fs['unlinkSync'](path[_0xb368('0x48')](_0x5d7003[_0xb368('0x47')],_0x1e324d));});fs[_0xb368('0x57')](_0x5d7003[_0xb368('0x47')]);}return _0x5d7003;});})[_0xb368('0x3f')](function(_0x453926){throw new db[(_0xb368('0x58'))][(_0xb368('0x59'))](_0x453926[_0xb368('0x5a')]);});}})[_0xb368('0x22')](handleEntityNotFound(_0x41b00b,null))[_0xb368('0x22')](removeEntity(_0x41b00b,null))[_0xb368('0x3f')](handleError(_0x41b00b,null));};exports['addSound']=function(_0x374639,_0xac8eec,_0x1d3c98){return db[_0xb368('0x44')][_0xb368('0x54')](function(_0x1abb2c){var _0x1bef6b;return db[_0xb368('0x3c')][_0xb368('0x41')]({'where':{'id':_0x374639[_0xb368('0x40')]['id']}})[_0xb368('0x22')](function(_0x326d16){if(_0x326d16){_0x1bef6b=_0x326d16;return _0x326d16[_0xb368('0x5b')](_0x374639[_0xb368('0x42')]['id'],{'transaction':_0x1abb2c});}})[_0xb368('0x22')](function(_0xf8d715){if(_0xf8d715){return db[_0xb368('0x5c')]['findOne']({'where':{'id':_0x374639['body']['id']},'attributes':['id',_0xb368('0x26'),_0xb368('0x5d'),_0xb368('0x5e'),_0xb368('0x5f')],'raw':!![]});}})[_0xb368('0x22')](function(_0x192611){if(_0x192611){var _0x4e9578=path[_0xb368('0x48')](config[_0xb368('0x60')],_0xb368('0x61'),util[_0xb368('0x62')]('%s.%s',path[_0xb368('0x63')](_0x192611[_0xb368('0x5d')],path['extname'](_0x192611[_0xb368('0x5d')])),_0x192611[_0xb368('0x5e')]));var _0x110062=path['join'](config['root'],_0xb368('0x64'),_0x1bef6b[_0xb368('0x26')],util[_0xb368('0x62')](_0xb368('0x65'),_0x192611[_0xb368('0x26')],_0x192611['converted_format']));fs[_0xb368('0x66')](_0x4e9578,_0x110062);return _0x192611;}})[_0xb368('0x3f')](function(_0x58eac3){throw new db[(_0xb368('0x58'))]['ValidationError'](_0x58eac3[_0xb368('0x5a')]);});})[_0xb368('0x22')](handleEntityNotFound(_0xac8eec,null))[_0xb368('0x22')](respondWithResult(_0xac8eec,0xc9))[_0xb368('0x3f')](handleError(_0xac8eec,null));};exports[_0xb368('0x67')]=function(_0x514d79,_0x255b84,_0x25cba4){return db[_0xb368('0x44')][_0xb368('0x54')](function(_0x14f016){var _0x2e42f3;return db[_0xb368('0x3c')]['findOne']({'where':{'id':_0x514d79['params']['id']}})[_0xb368('0x22')](handleEntityNotFound(_0x255b84,null))['then'](function(_0x270766){if(_0x270766){_0x2e42f3=_0x270766;return _0x270766['removeSound'](_0x514d79[_0xb368('0x40')]['id2']);}})[_0xb368('0x22')](function(_0x139a5b){if(_0x139a5b){return db[_0xb368('0x5c')]['findOne']({'where':{'id':_0x514d79[_0xb368('0x40')][_0xb368('0x68')]},'attributes':['id',_0xb368('0x26'),'save_name','converted_format','createdAt'],'raw':!![]});}})['then'](function(_0x49ee33){if(_0x49ee33){fs['unlinkSync'](path['join'](_0x2e42f3[_0xb368('0x47')],util[_0xb368('0x62')](_0xb368('0x65'),_0x49ee33[_0xb368('0x26')],_0x49ee33[_0xb368('0x5e')])));return _0x49ee33;}})['catch'](function(_0x14f18f){throw new db[(_0xb368('0x58'))][(_0xb368('0x59'))](_0x14f18f[_0xb368('0x5a')]);});})[_0xb368('0x22')](handleEntityNotFound(_0x255b84,null))[_0xb368('0x22')](respondWithStatusCode(_0x255b84,0xcc))[_0xb368('0x3f')](handleError(_0x255b84,null));};exports[_0xb368('0x69')]=function(_0x4767d3,_0x2f8e41,_0x348948){var _0x2c83f3={};var _0x5f4cd6={};var _0x3eeccf;var _0x15ba6b;return db[_0xb368('0x3c')]['findOne']({'where':{'id':_0x4767d3[_0xb368('0x40')]['id']}})['then'](handleEntityNotFound(_0x2f8e41,null))[_0xb368('0x22')](function(_0xb76ec9){if(_0xb76ec9){_0x3eeccf=_0xb76ec9;_0x5f4cd6[_0xb368('0x2c')]=_[_0xb368('0x2d')](db['Sound']['rawAttributes']);_0x5f4cd6['query']=_[_0xb368('0x2d')](_0x4767d3[_0xb368('0x2e')]);_0x5f4cd6['filters']=_[_0xb368('0x2f')](_0x5f4cd6[_0xb368('0x2c')],_0x5f4cd6[_0xb368('0x2e')]);_0x2c83f3[_0xb368('0x30')]=_[_0xb368('0x2f')](_0x5f4cd6[_0xb368('0x2c')],qs[_0xb368('0x31')](_0x4767d3['query']['fields']));_0x2c83f3['attributes']=_0x2c83f3[_0xb368('0x30')][_0xb368('0x32')]?_0x2c83f3[_0xb368('0x30')]:_0x5f4cd6[_0xb368('0x2c')];_0x2c83f3[_0xb368('0x6a')]=qs[_0xb368('0x34')](_0x4767d3[_0xb368('0x2e')][_0xb368('0x34')]);_0x2c83f3['where']=qs['filters'](_[_0xb368('0x37')](_0x4767d3[_0xb368('0x2e')],_0x5f4cd6[_0xb368('0x36')]));if(_0x4767d3[_0xb368('0x2e')]['filter']){_0x2c83f3['where']=_[_0xb368('0x39')](_0x2c83f3[_0xb368('0x35')],{'$or':_['map'](_0x2c83f3[_0xb368('0x30')],function(_0x3b2d49){var _0x4b15a4={};_0x4b15a4[_0x3b2d49]={'$like':'%'+_0x4767d3['query']['filter']+'%'};return _0x4b15a4;})});}_0x2c83f3=_[_0xb368('0x39')]({},_0x2c83f3,_0x4767d3[_0xb368('0x3b')]);return _0x3eeccf[_0xb368('0x69')](_0x2c83f3);}})['then'](function(_0x529fe3){if(_0x529fe3){_0x15ba6b=_0x529fe3['length'];if(!_0x4767d3[_0xb368('0x2e')][_0xb368('0x6b')](_0xb368('0x33'))){_0x2c83f3[_0xb368('0x1c')]=qs[_0xb368('0x1c')](_0x4767d3[_0xb368('0x2e')][_0xb368('0x1c')]);_0x2c83f3['offset']=qs[_0xb368('0x1a')](_0x4767d3[_0xb368('0x2e')][_0xb368('0x1a')]);}return _0x3eeccf[_0xb368('0x69')](_0x2c83f3);}})[_0xb368('0x22')](function(_0x37804c){if(_0x37804c){return _0x37804c?{'count':_0x15ba6b,'rows':_0x37804c}:null;}})[_0xb368('0x22')](respondWithResult(_0x2f8e41,null))[_0xb368('0x3f')](handleError(_0x2f8e41,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index 239c598..97991b3 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 _0x09c3=['exports','define','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./voiceMusicOnHold.attributes'];(function(_0x56eea7,_0x334b62){var _0x2e92e2=function(_0x3861a2){while(--_0x3861a2){_0x56eea7['push'](_0x56eea7['shift']());}};_0x2e92e2(++_0x334b62);}(_0x09c3,0x183));var _0x309c=function(_0x5e3701,_0x596265){_0x5e3701=_0x5e3701-0x0;var _0x345dcf=_0x09c3[_0x5e3701];return _0x345dcf;};'use strict';var _=require(_0x309c('0x0'));var util=require('util');var logger=require(_0x309c('0x1'))(_0x309c('0x2'));var moment=require(_0x309c('0x3'));var BPromise=require('bluebird');var rp=require(_0x309c('0x4'));var fs=require('fs');var path=require(_0x309c('0x5'));var rimraf=require(_0x309c('0x6'));var config=require(_0x309c('0x7'));var attributes=require(_0x309c('0x8'));module[_0x309c('0x9')]=function(_0x389669,_0x163d6e){return _0x389669[_0x309c('0xa')]('VoiceMusicOnHold',attributes,{'tableName':'voice_musiconhold','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa922=['./voiceMusicOnHold.attributes','define','VoiceMusicOnHold','voice_musiconhold','lodash','util','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x3e4833,_0x757a76){var _0x51aa6=function(_0x518227){while(--_0x518227){_0x3e4833['push'](_0x3e4833['shift']());}};_0x51aa6(++_0x757a76);}(_0xa922,0x1d0));var _0x2a92=function(_0x514835,_0x95fcdf){_0x514835=_0x514835-0x0;var _0x44c151=_0xa922[_0x514835];return _0x44c151;};'use strict';var _=require(_0x2a92('0x0'));var util=require(_0x2a92('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x2a92('0x2'));var rp=require(_0x2a92('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2a92('0x4'));var config=require(_0x2a92('0x5'));var attributes=require(_0x2a92('0x6'));module['exports']=function(_0x23e787,_0xbe36bf){return _0x23e787[_0x2a92('0x7')](_0x2a92('0x8'),attributes,{'tableName':_0x2a92('0x9'),'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 35d8e64..3fd8dd3 100644 --- a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js +++ b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['http','request','then','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x1eb8e0,_0x2e5296){var _0x2dc483=function(_0x5e8dc1){while(--_0x5e8dc1){_0x1eb8e0['push'](_0x1eb8e0['shift']());}};_0x2dc483(++_0x2e5296);}(_0xe706,0xa3));var _0x6e70=function(_0x6fae04,_0x33078d){_0x6fae04=_0x6fae04-0x0;var _0x546f87=_0xe706[_0x6fae04];return _0x546f87;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var moment=require(_0x6e70('0x2'));var BPromise=require('bluebird');var rs=require(_0x6e70('0x3'));var fs=require('fs');var Redis=require(_0x6e70('0x4'));var db=require(_0x6e70('0x5'))['db'];var utils=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));var config=require(_0x6e70('0x9'));var jayson=require(_0x6e70('0xa'));var client=jayson[_0x6e70('0xb')][_0x6e70('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x36357b,_0x293ce7,_0x45a2d4){return new BPromise(function(_0x188ed3,_0x3c4843){return client[_0x6e70('0xd')](_0x36357b,_0x45a2d4)[_0x6e70('0xe')](function(_0x25e61c){logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,_0x6e70('0x11'));logger[_0x6e70('0x12')](_0x6e70('0x13'),_0x293ce7,_0x6e70('0x11'),JSON['stringify'](_0x25e61c));if(_0x25e61c['error']){if(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x15')]===0x1f4){logger[_0x6e70('0x14')](_0x6e70('0x10'),_0x293ce7,_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);return _0x3c4843(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);}logger['error']('VoiceMusicOnHold,\x20%s,\x20%s',_0x293ce7,_0x25e61c['error'][_0x6e70('0x16')]);return _0x188ed3(_0x25e61c['error']['message']);}else{logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,'request\x20sent');_0x188ed3(_0x25e61c[_0x6e70('0x17')]['message']);}})[_0x6e70('0x18')](function(_0x161f23){logger['error']('VoiceMusicOnHold,\x20%s,\x20%s',_0x293ce7,_0x161f23);_0x3c4843(_0x161f23);});});} \ No newline at end of file +var _0x70e0=['code','VoiceMusicOnHold,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x45ab18,_0x4d173f){var _0x573610=function(_0x186e98){while(--_0x186e98){_0x45ab18['push'](_0x45ab18['shift']());}};_0x573610(++_0x4d173f);}(_0x70e0,0x17b));var _0x070e=function(_0x6fa9d5,_0x22866b){_0x6fa9d5=_0x6fa9d5-0x0;var _0x14e1e4=_0x70e0[_0x6fa9d5];return _0x14e1e4;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var moment=require(_0x070e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x070e('0x3'));var db=require(_0x070e('0x4'))['db'];var utils=require(_0x070e('0x5'));var logger=require(_0x070e('0x6'))('rpc');var config=require(_0x070e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x070e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x56e420,_0x5032e5,_0x35ab0c){return new BPromise(function(_0x1e11f0,_0x604664){return client[_0x070e('0x9')](_0x56e420,_0x35ab0c)[_0x070e('0xa')](function(_0x68a09e){logger[_0x070e('0xb')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x5032e5,'request\x20sent');logger[_0x070e('0xc')](_0x070e('0xd'),_0x5032e5,_0x070e('0xe'),JSON[_0x070e('0xf')](_0x68a09e));if(_0x68a09e[_0x070e('0x10')]){if(_0x68a09e[_0x070e('0x10')][_0x070e('0x11')]===0x1f4){logger[_0x070e('0x10')](_0x070e('0x12'),_0x5032e5,_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);return _0x604664(_0x68a09e['error']['message']);}logger[_0x070e('0x10')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x5032e5,_0x68a09e['error']['message']);return _0x1e11f0(_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);}else{logger['info']('VoiceMusicOnHold,\x20%s,\x20%s',_0x5032e5,_0x070e('0xe'));_0x1e11f0(_0x68a09e[_0x070e('0x14')][_0x070e('0x13')]);}})[_0x070e('0x15')](function(_0x5bc71e){logger['error'](_0x070e('0x12'),_0x5032e5,_0x5bc71e);_0x604664(_0x5bc71e);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index 3d41fbc..683c0be 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 _0x0689=['destroy','delete','removeAgents','removeTeams','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voicePrefix.controller','get','isAuthenticated','describe','/:id','show','/:id/users','getAgents','/:id/teams','getTeams','post','create','addAgents','addTeams','put','update'];(function(_0x2aff8c,_0x149aaa){var _0xa7b2ec=function(_0x707b96){while(--_0x707b96){_0x2aff8c['push'](_0x2aff8c['shift']());}};_0xa7b2ec(++_0x149aaa);}(_0x0689,0x161));var _0x9068=function(_0x5f1cf7,_0x47d9a9){_0x5f1cf7=_0x5f1cf7-0x0;var _0x2ab77b=_0x0689[_0x5f1cf7];return _0x2ab77b;};'use strict';var multer=require('multer');var util=require(_0x9068('0x0'));var path=require('path');var timeout=require(_0x9068('0x1'));var express=require(_0x9068('0x2'));var router=express[_0x9068('0x3')]();var fs_extra=require(_0x9068('0x4'));var auth=require(_0x9068('0x5'));var interaction=require(_0x9068('0x6'));var config=require(_0x9068('0x7'));var controller=require(_0x9068('0x8'));router[_0x9068('0x9')]('/',auth[_0x9068('0xa')](),controller['index']);router[_0x9068('0x9')]('/describe',auth['isAuthenticated'](),controller[_0x9068('0xb')]);router[_0x9068('0x9')](_0x9068('0xc'),auth[_0x9068('0xa')](),controller[_0x9068('0xd')]);router[_0x9068('0x9')](_0x9068('0xe'),auth[_0x9068('0xa')](),controller[_0x9068('0xf')]);router['get'](_0x9068('0x10'),auth[_0x9068('0xa')](),controller[_0x9068('0x11')]);router[_0x9068('0x12')]('/',auth['isAuthenticated'](),controller[_0x9068('0x13')]);router[_0x9068('0x12')](_0x9068('0xe'),auth['isAuthenticated'](),controller[_0x9068('0x14')]);router[_0x9068('0x12')](_0x9068('0x10'),auth['isAuthenticated'](),controller[_0x9068('0x15')]);router[_0x9068('0x16')]('/:id',auth[_0x9068('0xa')](),controller[_0x9068('0x17')]);router['delete'](_0x9068('0xc'),auth[_0x9068('0xa')](),controller[_0x9068('0x18')]);router[_0x9068('0x19')]('/:id/users',auth[_0x9068('0xa')](),controller[_0x9068('0x1a')]);router[_0x9068('0x19')](_0x9068('0x10'),auth[_0x9068('0xa')](),controller[_0x9068('0x1b')]);module[_0x9068('0x1c')]=router; \ No newline at end of file +var _0x7722=['../../components/auth/service','../../components/interaction/service','./voicePrefix.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/users','getAgents','/:id/teams','getTeams','post','addAgents','addTeams','put','update','destroy','delete','removeAgents','removeTeams','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0xc55d64,_0x133f2d){var _0x4194f6=function(_0x4a38c9){while(--_0x4a38c9){_0xc55d64['push'](_0xc55d64['shift']());}};_0x4194f6(++_0x133f2d);}(_0x7722,0x14e));var _0x2772=function(_0x16ceea,_0x264224){_0x16ceea=_0x16ceea-0x0;var _0x54cbb0=_0x7722[_0x16ceea];return _0x54cbb0;};'use strict';var multer=require(_0x2772('0x0'));var util=require(_0x2772('0x1'));var path=require(_0x2772('0x2'));var timeout=require(_0x2772('0x3'));var express=require(_0x2772('0x4'));var router=express[_0x2772('0x5')]();var fs_extra=require(_0x2772('0x6'));var auth=require(_0x2772('0x7'));var interaction=require(_0x2772('0x8'));var config=require('../../config/environment');var controller=require(_0x2772('0x9'));router['get']('/',auth[_0x2772('0xa')](),controller[_0x2772('0xb')]);router[_0x2772('0xc')](_0x2772('0xd'),auth[_0x2772('0xa')](),controller[_0x2772('0xe')]);router[_0x2772('0xc')](_0x2772('0xf'),auth[_0x2772('0xa')](),controller[_0x2772('0x10')]);router[_0x2772('0xc')](_0x2772('0x11'),auth[_0x2772('0xa')](),controller[_0x2772('0x12')]);router[_0x2772('0xc')](_0x2772('0x13'),auth['isAuthenticated'](),controller[_0x2772('0x14')]);router[_0x2772('0x15')]('/',auth[_0x2772('0xa')](),controller['create']);router[_0x2772('0x15')](_0x2772('0x11'),auth[_0x2772('0xa')](),controller[_0x2772('0x16')]);router[_0x2772('0x15')]('/:id/teams',auth[_0x2772('0xa')](),controller[_0x2772('0x17')]);router[_0x2772('0x18')](_0x2772('0xf'),auth['isAuthenticated'](),controller[_0x2772('0x19')]);router['delete'](_0x2772('0xf'),auth[_0x2772('0xa')](),controller[_0x2772('0x1a')]);router[_0x2772('0x1b')](_0x2772('0x11'),auth[_0x2772('0xa')](),controller[_0x2772('0x1c')]);router['delete'](_0x2772('0x13'),auth[_0x2772('0xa')](),controller[_0x2772('0x1d')]);module[_0x2772('0x1e')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index e8b831e..3245332 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 _0x998e=['STRING','name','VIRTUAL','system-','getDataValue','INTEGER','sequelize','exports'];(function(_0x41c9d5,_0x35efcc){var _0x2c5a84=function(_0x5e3f0c){while(--_0x5e3f0c){_0x41c9d5['push'](_0x41c9d5['shift']());}};_0x2c5a84(++_0x35efcc);}(_0x998e,0x13e));var _0xe998=function(_0x4a9fc2,_0x22134a){_0x4a9fc2=_0x4a9fc2-0x0;var _0x424897=_0x998e[_0x4a9fc2];return _0x424897;};'use strict';var Sequelize=require(_0xe998('0x0'));module[_0xe998('0x1')]={'name':{'type':Sequelize[_0xe998('0x2')],'allowNull':![],'unique':_0xe998('0x3')},'prefix':{'type':Sequelize[_0xe998('0x4')],'get':function(_0x3067f1){return _0xe998('0x5')+this[_0xe998('0x6')](_0xe998('0x3'))+'-';}},'description':{'type':Sequelize['STRING']},'callerIdAll':{'type':Sequelize[_0xe998('0x2')]},'VoiceExtensionId':{'type':Sequelize[_0xe998('0x7')]}}; \ No newline at end of file +var _0x31cc=['VIRTUAL','INTEGER','STRING','name'];(function(_0x2d604b,_0x4f1748){var _0x504857=function(_0x3c4990){while(--_0x3c4990){_0x2d604b['push'](_0x2d604b['shift']());}};_0x504857(++_0x4f1748);}(_0x31cc,0x182));var _0xc31c=function(_0x5037ab,_0x43209e){_0x5037ab=_0x5037ab-0x0;var _0x512adb=_0x31cc[_0x5037ab];return _0x512adb;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xc31c('0x0')],'allowNull':![],'unique':_0xc31c('0x1')},'prefix':{'type':Sequelize[_0xc31c('0x2')],'get':function(_0x247592){return'system-'+this['getDataValue'](_0xc31c('0x1'))+'-';}},'description':{'type':Sequelize[_0xc31c('0x0')]},'callerIdAll':{'type':Sequelize[_0xc31c('0x0')]},'VoiceExtensionId':{'type':Sequelize[_0xc31c('0x3')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index c9443b6..477a56e 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 _0xe2cf=['socket.io-emitter','register','end','json','offset','limit','undefined','count','status','set','apply','reject','save','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','map','VoicePrefix','rawAttributes','fieldName','type','key','keys','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','include','rows','show','params','includeAll','find','catch','create','sequelize','transaction','VoiceExtension','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','VoicePrefixes','autoAssociation','context','from-sip','system','description','Voice\x20Prefix\x20Extension','priority','appdata','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','push','Set','CDR(prefix)=','PREFIX-CALLERIDALL=','No\x20callerid\x20available','goto','${EXTEN:','charAt','body','addAgents','ids','userVoicePrefix:save','isArray','emit','userVoicePrefix:remove','getAgents','findOne','User','nolimit','getTeams','addTeams','findAll','Agents','online','voicePause','flatMap','each','TeamVoicePrefix','upsert','UserVoicePrefix','forEach','removeTeams','field','tq.TeamId','from','join','user_has_teams','VoicePrefixId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','every','TeamId','includes','all','compact','value','isEmpty','removeAgents','rimraf','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','lodash','squel','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x35d9ac,_0x3ce531){var _0x3edc42=function(_0x3c6ea1){while(--_0x3c6ea1){_0x35d9ac['push'](_0x35d9ac['shift']());}};_0x3edc42(++_0x3ce531);}(_0xe2cf,0x1a1));var _0xfe2c=function(_0x5bdf8e,_0x45d970){_0x5bdf8e=_0x5bdf8e-0x0;var _0x3e0750=_0xe2cf[_0x5bdf8e];return _0x3e0750;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfe2c('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xfe2c('0x1'));var rp=require('request-promise');var moment=require(_0xfe2c('0x2'));var BPromise=require(_0xfe2c('0x3'));var Mustache=require(_0xfe2c('0x4'));var util=require(_0xfe2c('0x5'));var path=require('path');var sox=require(_0xfe2c('0x6'));var csv=require(_0xfe2c('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfe2c('0x8'));var squel=require(_0xfe2c('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xfe2c('0xa'));var toCsv=require(_0xfe2c('0x7'));var querystring=require(_0xfe2c('0xb'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xfe2c('0xc'));var qs=require(_0xfe2c('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfe2c('0xe'));var logger=require(_0xfe2c('0xf'))(_0xfe2c('0x10'));var utils=require(_0xfe2c('0x11'));var config=require(_0xfe2c('0x12'));var licenseUtil=require(_0xfe2c('0x13'));var db=require(_0xfe2c('0x14'))['db'];config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xfe2c('0x15'))(new Redis(config['redis']));require('./voicePrefix.socket')[_0xfe2c('0x16')](socket);function respondWithStatusCode(_0x4d0a10,_0x2aa7df){_0x2aa7df=_0x2aa7df||0xcc;return function(_0x12e4c4){if(_0x12e4c4){return _0x4d0a10['sendStatus'](_0x2aa7df);}return _0x4d0a10['status'](_0x2aa7df)[_0xfe2c('0x17')]();};}function respondWithResult(_0x3b3ebd,_0x1dbed4){_0x1dbed4=_0x1dbed4||0xc8;return function(_0x56cebc){if(_0x56cebc){return _0x3b3ebd['status'](_0x1dbed4)[_0xfe2c('0x18')](_0x56cebc);}};}function respondWithFilteredResult(_0x96a3a3,_0x135436){return function(_0x23242b){if(_0x23242b){var _0x36aeec=typeof _0x135436[_0xfe2c('0x19')]==='undefined'&&typeof _0x135436[_0xfe2c('0x1a')]===_0xfe2c('0x1b');var _0x1d7852=_0x23242b[_0xfe2c('0x1c')];var _0x55f751=_0x36aeec?0x0:_0x135436[_0xfe2c('0x19')];var _0x59bdeb=_0x36aeec?_0x23242b['count']:_0x135436[_0xfe2c('0x19')]+_0x135436[_0xfe2c('0x1a')];var _0x4bf7c0;if(_0x59bdeb>=_0x1d7852){_0x59bdeb=_0x1d7852;_0x4bf7c0=0xc8;}else{_0x4bf7c0=0xce;}_0x96a3a3[_0xfe2c('0x1d')](_0x4bf7c0);return _0x96a3a3[_0xfe2c('0x1e')]('Content-Range',_0x55f751+'-'+_0x59bdeb+'/'+_0x1d7852)[_0xfe2c('0x18')](_0x23242b);}return null;};}function patchUpdates(_0x5dd54b){return function(_0x4481ff){try{jsonpatch[_0xfe2c('0x1f')](_0x4481ff,_0x5dd54b,!![]);}catch(_0x8b5c0d){return BPromise[_0xfe2c('0x20')](_0x8b5c0d);}return _0x4481ff[_0xfe2c('0x21')]();};}function saveUpdates(_0x2ee3b3,_0x57cd6d){return function(_0x41a545){if(_0x41a545){return _0x41a545[_0xfe2c('0x22')](_0x2ee3b3)[_0xfe2c('0x23')](function(_0x26448c){return _0x26448c;});}return null;};}function removeEntity(_0x3486b5,_0x10afde){return function(_0x53bab0){if(_0x53bab0){return _0x53bab0[_0xfe2c('0x24')]()['then'](function(){var _0x16daf3=_0x53bab0[_0xfe2c('0x25')]({'plain':!![]});var _0x1c35d3='VoicePrefixes';return db[_0xfe2c('0x26')][_0xfe2c('0x24')]({'where':{'type':_0x1c35d3,'resourceId':_0x16daf3['id']}})['then'](function(){return _0x53bab0;});})[_0xfe2c('0x23')](function(){_0x3486b5[_0xfe2c('0x1d')](0xcc)[_0xfe2c('0x17')]();});}};}function handleEntityNotFound(_0x53a8c1,_0x170026){return function(_0x1b7c91){if(!_0x1b7c91){_0x53a8c1['sendStatus'](0x194);}return _0x1b7c91;};}function handleError(_0x481219,_0x1cf1d7){_0x1cf1d7=_0x1cf1d7||0x1f4;return function(_0x13e9a9){logger[_0xfe2c('0x27')](_0x13e9a9[_0xfe2c('0x28')]);if(_0x13e9a9[_0xfe2c('0x29')]){delete _0x13e9a9['name'];}_0x481219[_0xfe2c('0x1d')](_0x1cf1d7)[_0xfe2c('0x2a')](_0x13e9a9);};}exports[_0xfe2c('0x2b')]=function(_0x210c2e,_0x2843a5){var _0xabc499={},_0x69d23a={},_0x3f8696={'count':0x0,'rows':[]};var _0x2e09fe=_[_0xfe2c('0x2c')](db[_0xfe2c('0x2d')][_0xfe2c('0x2e')],function(_0x4e6b92){return{'name':_0x4e6b92[_0xfe2c('0x2f')],'type':_0x4e6b92[_0xfe2c('0x30')][_0xfe2c('0x31')]};});_0x69d23a['model']=_[_0xfe2c('0x2c')](_0x2e09fe,_0xfe2c('0x29'));_0x69d23a['query']=_[_0xfe2c('0x32')](_0x210c2e[_0xfe2c('0x33')]);_0x69d23a[_0xfe2c('0x34')]=_['intersection'](_0x69d23a[_0xfe2c('0x35')],_0x69d23a[_0xfe2c('0x33')]);_0xabc499[_0xfe2c('0x36')]=_[_0xfe2c('0x37')](_0x69d23a[_0xfe2c('0x35')],qs[_0xfe2c('0x38')](_0x210c2e[_0xfe2c('0x33')]['fields']));_0xabc499['attributes']=_0xabc499[_0xfe2c('0x36')][_0xfe2c('0x39')]?_0xabc499[_0xfe2c('0x36')]:_0x69d23a[_0xfe2c('0x35')];if(!_0x210c2e['query'][_0xfe2c('0x3a')]('nolimit')){_0xabc499[_0xfe2c('0x1a')]=qs[_0xfe2c('0x1a')](_0x210c2e['query'][_0xfe2c('0x1a')]);_0xabc499['offset']=qs['offset'](_0x210c2e[_0xfe2c('0x33')][_0xfe2c('0x19')]);}_0xabc499[_0xfe2c('0x3b')]=qs[_0xfe2c('0x3c')](_0x210c2e[_0xfe2c('0x33')][_0xfe2c('0x3c')]);_0xabc499[_0xfe2c('0x3d')]=qs[_0xfe2c('0x34')](_[_0xfe2c('0x3e')](_0x210c2e[_0xfe2c('0x33')],_0x69d23a[_0xfe2c('0x34')]),_0x2e09fe);if(_0x210c2e['query'][_0xfe2c('0x3f')]){_0xabc499[_0xfe2c('0x3d')]=_[_0xfe2c('0x40')](_0xabc499['where'],{'$or':_['map'](_0x2e09fe,function(_0x4e5f0b){if(_0x4e5f0b[_0xfe2c('0x30')]!==_0xfe2c('0x41')){var _0x428b32={};_0x428b32[_0x4e5f0b[_0xfe2c('0x29')]]={'$like':'%'+_0x210c2e['query'][_0xfe2c('0x3f')]+'%'};return _0x428b32;}})});}_0xabc499=_[_0xfe2c('0x40')]({},_0xabc499,_0x210c2e[_0xfe2c('0x42')]);var _0x278acb={'where':_0xabc499[_0xfe2c('0x3d')]};return db['VoicePrefix'][_0xfe2c('0x1c')](_0x278acb)[_0xfe2c('0x23')](function(_0x6055dd){_0x3f8696[_0xfe2c('0x1c')]=_0x6055dd;if(_0x210c2e['query']['includeAll']){_0xabc499[_0xfe2c('0x43')]=[{'all':!![]}];}return db[_0xfe2c('0x2d')]['findAll'](_0xabc499);})[_0xfe2c('0x23')](function(_0x27862d){_0x3f8696[_0xfe2c('0x44')]=_0x27862d;return _0x3f8696;})[_0xfe2c('0x23')](respondWithFilteredResult(_0x2843a5,_0xabc499))['catch'](handleError(_0x2843a5,null));};exports[_0xfe2c('0x45')]=function(_0xfe35e5,_0x331a8a){var _0x466cdb={'raw':![],'where':{'id':_0xfe35e5[_0xfe2c('0x46')]['id']}},_0x122a05={};_0x122a05[_0xfe2c('0x35')]=_[_0xfe2c('0x32')](db['VoicePrefix'][_0xfe2c('0x2e')]);_0x122a05['query']=_[_0xfe2c('0x32')](_0xfe35e5[_0xfe2c('0x33')]);_0x122a05[_0xfe2c('0x34')]=_[_0xfe2c('0x37')](_0x122a05['model'],_0x122a05['query']);_0x466cdb['attributes']=_['intersection'](_0x122a05['model'],qs[_0xfe2c('0x38')](_0xfe35e5['query']['fields']));_0x466cdb[_0xfe2c('0x36')]=_0x466cdb['attributes'][_0xfe2c('0x39')]?_0x466cdb['attributes']:_0x122a05[_0xfe2c('0x35')];if(_0xfe35e5[_0xfe2c('0x33')][_0xfe2c('0x47')]){_0x466cdb[_0xfe2c('0x43')]=[{'all':!![]}];}_0x466cdb=_[_0xfe2c('0x40')]({},_0x466cdb,_0xfe35e5['options']);return db[_0xfe2c('0x2d')][_0xfe2c('0x48')](_0x466cdb)[_0xfe2c('0x23')](handleEntityNotFound(_0x331a8a,null))['then'](respondWithResult(_0x331a8a,null))[_0xfe2c('0x49')](handleError(_0x331a8a,null));};exports[_0xfe2c('0x24')]=function(_0x579b6b,_0x56f716){return db['VoicePrefix'][_0xfe2c('0x48')]({'where':{'id':_0x579b6b[_0xfe2c('0x46')]['id']}})[_0xfe2c('0x23')](handleEntityNotFound(_0x56f716,null))[_0xfe2c('0x23')](removeEntity(_0x56f716,null))[_0xfe2c('0x49')](handleError(_0x56f716,null));};exports['describe']=function(_0x24cdce,_0x2983b0){return db[_0xfe2c('0x2d')]['describe']()['then'](respondWithResult(_0x2983b0,null))[_0xfe2c('0x49')](handleError(_0x2983b0,null));};exports[_0xfe2c('0x4a')]=function(_0x2daa5f,_0x154381){var _0x384766;return db[_0xfe2c('0x4b')][_0xfe2c('0x4c')](function(_0x37e3de){return db[_0xfe2c('0x2d')][_0xfe2c('0x4a')](_0x2daa5f['body'],{'transaction':_0x37e3de})[_0xfe2c('0x23')](function(_0x34e8e0){_0x384766=_0x34e8e0[_0xfe2c('0x25')]({'plain':!![]});return db[_0xfe2c('0x4d')][_0xfe2c('0x48')]({'where':{'id':_0x384766[_0xfe2c('0x4e')]},'raw':!![]})[_0xfe2c('0x23')](function(_0x158e70){return createVoicePrefixExtensions(_0x384766,_0x158e70,_0x37e3de);});});})[_0xfe2c('0x23')](function(){var _0xf54c02=_0x2daa5f[_0xfe2c('0x4f')]['get']({'plain':!![]});if(!_0xf54c02)throw new Error(_0xfe2c('0x50'));if(_0xf54c02['role']===_0xfe2c('0x4f')){var _0x4f4bc6=_0x384766;return db['UserProfileSection']['find']({'where':{'name':_0xfe2c('0x51'),'userProfileId':_0xf54c02['userProfileId']},'raw':!![]})[_0xfe2c('0x23')](function(_0x5f47cc){if(_0x5f47cc&&_0x5f47cc[_0xfe2c('0x52')]===0x0){return db[_0xfe2c('0x26')][_0xfe2c('0x4a')]({'name':_0x4f4bc6[_0xfe2c('0x29')],'resourceId':_0x4f4bc6['id'],'type':_0x5f47cc[_0xfe2c('0x29')],'sectionId':_0x5f47cc['id']},{})[_0xfe2c('0x23')](function(){return _0x384766;});}else{return _0x384766;}})[_0xfe2c('0x49')](function(_0x11d99e){logger[_0xfe2c('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x11d99e);throw _0x11d99e;});}return _0x384766;})[_0xfe2c('0x23')](respondWithResult(_0x154381,null))[_0xfe2c('0x49')](handleError(_0x154381,null));};function Extension(_0xf9ed12,_0x385c21,_0x366687,_0x5e6d96){this[_0xfe2c('0x53')]=_0xfe2c('0x54');this['exten']=_0xf9ed12;this['app']=_0x366687;this[_0xfe2c('0x30')]=_0xfe2c('0x55');this[_0xfe2c('0x56')]=_0xfe2c('0x57');this[_0xfe2c('0x58')]=_0x385c21;this[_0xfe2c('0x59')]=_0x5e6d96;}function createVoicePrefixExtensions(_0x306f81,_0x510c61,_0x1a2278){return new BPromise(function(_0x33df71,_0x4679){var _0x821144=new Extension(formatPrefixName(_0x306f81[_0xfe2c('0x5a')]),0x1,_0xfe2c('0x5b'),_0xfe2c('0x5c'));_0x821144['VoicePrefixId']=_0x306f81['id'];return db[_0xfe2c('0x4d')]['create'](_0x821144,{'transaction':_0x1a2278})[_0xfe2c('0x23')](function(_0x349d72){var _0x4cede1=_0x349d72[_0xfe2c('0x25')]({'plain':!![]});var _0x5caca7=_[_0xfe2c('0x2c')](addVoicePrefixExtensions(_0x306f81,_0x510c61),function(_0x377064){_0x377064['VoiceExtensionId']=_0x4cede1['id'];_0x377064[_0xfe2c('0x5d')]=_0x306f81['id'];return _0x377064;});return db['VoiceExtension'][_0xfe2c('0x5e')](_0x5caca7,{'transaction':_0x1a2278})['then'](function(_0x23827b){if(!_0x23827b){return _0x4679(_0xfe2c('0x5f'));}else{return _0x33df71(_0x23827b);}})['catch'](function(_0x661798){return _0x4679(_0x661798);});});;});};function addVoicePrefixExtensions(_0x7a0a77,_0x17b42a){var _0xda63e=[];var _0xa47aeb=formatPrefixName(_0x7a0a77['prefix']);_0xda63e[_0xfe2c('0x60')](new Extension(_0xa47aeb,0x2,_0xfe2c('0x61'),_0xfe2c('0x62')+_0x7a0a77[_0xfe2c('0x29')]));if(_0x7a0a77['callerIdAll']){_0xda63e[_0xfe2c('0x60')](new Extension(_0xa47aeb,0x3,'Set',_0xfe2c('0x63')+_0x7a0a77['callerIdAll']));}else{_0xda63e[_0xfe2c('0x60')](new Extension(_0xa47aeb,0x3,_0xfe2c('0x5b'),_0xfe2c('0x64')));}_0xda63e[_0xfe2c('0x60')](new Extension(_0xa47aeb,0x4,_0xfe2c('0x65'),_0x17b42a[_0xfe2c('0x53')]+','+_0xfe2c('0x66')+(0x8+_0x7a0a77[_0xfe2c('0x29')][_0xfe2c('0x39')])+'}'+','+0x1));return _0xda63e;}function formatPrefixName(_0x21b07a){var _0x3da347='_';for(var _0x2fcb15=0x0;_0x2fcb15<_0x21b07a[_0xfe2c('0x39')];_0x2fcb15++){if(_0x21b07a[_0xfe2c('0x67')](_0x2fcb15)=='-'){_0x3da347+=_0x21b07a[_0xfe2c('0x67')](_0x2fcb15);}else{_0x3da347+='['+_0x21b07a[_0xfe2c('0x67')](_0x2fcb15)+']';}}_0x3da347+='.';return _0x3da347;}exports['update']=function(_0x2f48d5,_0x53513a,_0xdafb46){var _0x5aee3f=_0x2f48d5[_0xfe2c('0x68')];_0x5aee3f['prefix']='system-'+_0x5aee3f[_0xfe2c('0x29')]+'-';return db[_0xfe2c('0x4b')][_0xfe2c('0x4c')](function(_0x40124f){return db[_0xfe2c('0x2d')]['update'](_0x5aee3f,{'where':{'id':_0x5aee3f['id']},'transaction':_0x40124f})[_0xfe2c('0x23')](function(){return db[_0xfe2c('0x4d')]['destroy']({'where':{'VoicePrefixId':_0x5aee3f['id']},'transaction':_0x40124f})[_0xfe2c('0x23')](function(){return db[_0xfe2c('0x4d')]['find']({'where':{'id':_0x5aee3f['VoiceExtensionId']},'raw':!![]})['then'](function(_0x14d619){return createVoicePrefixExtensions(_0x5aee3f,_0x14d619,_0x40124f);});});});})[_0xfe2c('0x23')](function(){return db[_0xfe2c('0x2d')]['findById'](_0x5aee3f['id']);})['then'](respondWithResult(_0x53513a,null))[_0xfe2c('0x49')](handleError(_0x53513a,null));};exports[_0xfe2c('0x69')]=function(_0x56a3be,_0x3508c2,_0x9c07d5){return db[_0xfe2c('0x2d')][_0xfe2c('0x48')]({'where':{'id':_0x56a3be['params']['id']}})['then'](handleEntityNotFound(_0x3508c2,null))[_0xfe2c('0x23')](function(_0x414b87){if(_0x414b87){return _0x414b87['addAgents'](_0x56a3be[_0xfe2c('0x68')][_0xfe2c('0x6a')],_['omit'](_0x56a3be[_0xfe2c('0x68')],['ids','id'])||{})['spread'](function(_0x1f5190){for(var _0x157ad0=0x0;_0x157ad0<_0x56a3be['body'][_0xfe2c('0x6a')][_0xfe2c('0x39')];_0x157ad0+=0x1){socket['emit'](_0xfe2c('0x6b'),{'UserId':Number(_0x56a3be['body'][_0xfe2c('0x6a')][_0x157ad0]),'VoicePrefixId':Number(_0x56a3be[_0xfe2c('0x46')]['id'])});}return _0x1f5190;});}})[_0xfe2c('0x23')](respondWithResult(_0x3508c2,null))[_0xfe2c('0x49')](handleError(_0x3508c2,null));};exports['removeAgents']=function(_0x10e0a0,_0x85c898,_0x5317e4){return db[_0xfe2c('0x2d')]['find']({'where':{'id':_0x10e0a0[_0xfe2c('0x46')]['id']}})['then'](handleEntityNotFound(_0x85c898,null))[_0xfe2c('0x23')](function(_0x23311a){if(_0x23311a){return _0x23311a['removeAgents'](_0x10e0a0[_0xfe2c('0x33')][_0xfe2c('0x6a')])[_0xfe2c('0x23')](function(){if(_[_0xfe2c('0x6c')](_0x10e0a0[_0xfe2c('0x33')][_0xfe2c('0x6a')])){for(var _0x52627b=0x0;_0x52627b<_0x10e0a0[_0xfe2c('0x33')]['ids']['length'];_0x52627b+=0x1){socket[_0xfe2c('0x6d')](_0xfe2c('0x6e'),{'UserId':Number(_0x10e0a0[_0xfe2c('0x33')][_0xfe2c('0x6a')][_0x52627b]),'VoicePrefixId':Number(_0x10e0a0[_0xfe2c('0x46')]['id'])});}}else{socket[_0xfe2c('0x6d')]('userVoicePrefix:remove',{'UserId':Number(_0x10e0a0[_0xfe2c('0x33')][_0xfe2c('0x6a')]),'VoicePrefixId':Number(_0x10e0a0[_0xfe2c('0x46')]['id'])});}});}})[_0xfe2c('0x23')](respondWithStatusCode(_0x85c898,null))['catch'](handleError(_0x85c898,null));};exports[_0xfe2c('0x6f')]=function(_0x4f595d,_0x392232,_0x114553){var _0x512137={};var _0x1baccd={};var _0x540a67;var _0x49f9e1;return db['VoicePrefix'][_0xfe2c('0x70')]({'where':{'id':_0x4f595d[_0xfe2c('0x46')]['id']}})[_0xfe2c('0x23')](handleEntityNotFound(_0x392232,null))[_0xfe2c('0x23')](function(_0x4147fc){if(_0x4147fc){_0x540a67=_0x4147fc;_0x1baccd[_0xfe2c('0x35')]=_[_0xfe2c('0x32')](db[_0xfe2c('0x71')][_0xfe2c('0x2e')]);_0x1baccd['query']=_['keys'](_0x4f595d[_0xfe2c('0x33')]);_0x1baccd[_0xfe2c('0x34')]=_[_0xfe2c('0x37')](_0x1baccd[_0xfe2c('0x35')],_0x1baccd[_0xfe2c('0x33')]);_0x512137[_0xfe2c('0x36')]=_['intersection'](_0x1baccd[_0xfe2c('0x35')],qs[_0xfe2c('0x38')](_0x4f595d[_0xfe2c('0x33')][_0xfe2c('0x38')]));_0x512137[_0xfe2c('0x36')]=_0x512137[_0xfe2c('0x36')][_0xfe2c('0x39')]?_0x512137[_0xfe2c('0x36')]:_0x1baccd[_0xfe2c('0x35')];_0x512137['order']=qs[_0xfe2c('0x3c')](_0x4f595d[_0xfe2c('0x33')][_0xfe2c('0x3c')]);_0x512137[_0xfe2c('0x3d')]=qs[_0xfe2c('0x34')](_[_0xfe2c('0x3e')](_0x4f595d['query'],_0x1baccd[_0xfe2c('0x34')]));if(_0x4f595d[_0xfe2c('0x33')][_0xfe2c('0x3f')]){_0x512137[_0xfe2c('0x3d')]=_['merge'](_0x512137['where'],{'$or':_[_0xfe2c('0x2c')](_0x512137[_0xfe2c('0x36')],function(_0x312e84){var _0x57643d={};_0x57643d[_0x312e84]={'$like':'%'+_0x4f595d[_0xfe2c('0x33')][_0xfe2c('0x3f')]+'%'};return _0x57643d;})});}_0x512137=_[_0xfe2c('0x40')]({},_0x512137,_0x4f595d['options']);return _0x540a67[_0xfe2c('0x6f')](_0x512137);}})[_0xfe2c('0x23')](function(_0x1193c2){if(_0x1193c2){_0x49f9e1=_0x1193c2[_0xfe2c('0x39')];if(!_0x4f595d[_0xfe2c('0x33')][_0xfe2c('0x3a')](_0xfe2c('0x72'))){_0x512137[_0xfe2c('0x1a')]=qs[_0xfe2c('0x1a')](_0x4f595d['query'][_0xfe2c('0x1a')]);_0x512137['offset']=qs[_0xfe2c('0x19')](_0x4f595d[_0xfe2c('0x33')][_0xfe2c('0x19')]);}return _0x540a67['getAgents'](_0x512137);}})['then'](function(_0x4f39af){if(_0x4f39af){return _0x4f39af?{'count':_0x49f9e1,'rows':_0x4f39af}:null;}})[_0xfe2c('0x23')](respondWithResult(_0x392232,null))[_0xfe2c('0x49')](handleError(_0x392232,null));};exports[_0xfe2c('0x73')]=function(_0x3b07e7,_0x37e3d8,_0x27d025){var _0x23e1db={};var _0x14ebf0={};var _0x20c22a;var _0xb283e0;return db[_0xfe2c('0x2d')][_0xfe2c('0x70')]({'where':{'id':_0x3b07e7[_0xfe2c('0x46')]['id']}})['then'](handleEntityNotFound(_0x37e3d8,null))[_0xfe2c('0x23')](function(_0x532f06){if(_0x532f06){_0x20c22a=_0x532f06;_0x14ebf0[_0xfe2c('0x35')]=_[_0xfe2c('0x32')](db['Team']['rawAttributes']);_0x14ebf0['query']=_[_0xfe2c('0x32')](_0x3b07e7[_0xfe2c('0x33')]);_0x14ebf0[_0xfe2c('0x34')]=_[_0xfe2c('0x37')](_0x14ebf0[_0xfe2c('0x35')],_0x14ebf0[_0xfe2c('0x33')]);_0x23e1db['attributes']=_['intersection'](_0x14ebf0[_0xfe2c('0x35')],qs[_0xfe2c('0x38')](_0x3b07e7[_0xfe2c('0x33')]['fields']));_0x23e1db[_0xfe2c('0x36')]=_0x23e1db['attributes'][_0xfe2c('0x39')]?_0x23e1db[_0xfe2c('0x36')]:_0x14ebf0[_0xfe2c('0x35')];_0x23e1db[_0xfe2c('0x3b')]=qs['sort'](_0x3b07e7[_0xfe2c('0x33')][_0xfe2c('0x3c')]);_0x23e1db[_0xfe2c('0x3d')]=qs[_0xfe2c('0x34')](_[_0xfe2c('0x3e')](_0x3b07e7['query'],_0x14ebf0[_0xfe2c('0x34')]));if(_0x3b07e7[_0xfe2c('0x33')]['filter']){_0x23e1db[_0xfe2c('0x3d')]=_[_0xfe2c('0x40')](_0x23e1db[_0xfe2c('0x3d')],{'$or':_[_0xfe2c('0x2c')](_0x23e1db[_0xfe2c('0x36')],function(_0x50f27e){var _0x995423={};_0x995423[_0x50f27e]={'$like':'%'+_0x3b07e7[_0xfe2c('0x33')][_0xfe2c('0x3f')]+'%'};return _0x995423;})});}_0x23e1db=_[_0xfe2c('0x40')]({},_0x23e1db,_0x3b07e7[_0xfe2c('0x42')]);return _0x20c22a[_0xfe2c('0x73')](_0x23e1db);}})[_0xfe2c('0x23')](function(_0x142bf1){if(_0x142bf1){_0xb283e0=_0x142bf1['length'];if(!_0x3b07e7['query'][_0xfe2c('0x3a')](_0xfe2c('0x72'))){_0x23e1db[_0xfe2c('0x1a')]=qs[_0xfe2c('0x1a')](_0x3b07e7[_0xfe2c('0x33')][_0xfe2c('0x1a')]);_0x23e1db['offset']=qs['offset'](_0x3b07e7['query'][_0xfe2c('0x19')]);}return _0x20c22a[_0xfe2c('0x73')](_0x23e1db);}})[_0xfe2c('0x23')](function(_0x2351d5){if(_0x2351d5){return _0x2351d5?{'count':_0xb283e0,'rows':_0x2351d5}:null;}})[_0xfe2c('0x23')](respondWithResult(_0x37e3d8,null))[_0xfe2c('0x49')](handleError(_0x37e3d8,null));};exports[_0xfe2c('0x74')]=function(_0x3f2102,_0x1cc35d,_0x246d5d){var _0x5f34d3=_0x3f2102[_0xfe2c('0x68')][_0xfe2c('0x6a')];var _0x14631f;return db['Team'][_0xfe2c('0x75')]({'where':{'id':_0x5f34d3},'attributes':['id'],'include':[{'model':db[_0xfe2c('0x71')],'as':_0xfe2c('0x76'),'attributes':['id',_0xfe2c('0x29'),_0xfe2c('0x77'),_0xfe2c('0x78'),'interface'],'raw':!![]}]})['then'](function(_0x5f4744){if(_0x5f4744){_0x14631f=_0x5f4744;var _0x18ad4f=_[_0xfe2c('0x79')](_0x5f4744,function(_0x24faae){var _0x450e1d=_0x24faae[_0xfe2c('0x25')]({'plain':!![]});return _0x450e1d[_0xfe2c('0x76')];});return db['VoicePrefix'][_0xfe2c('0x48')]({'where':{'id':_0x3f2102['params']['id']}})[_0xfe2c('0x23')](function(_0x552cd3){return db['sequelize'][_0xfe2c('0x4c')](function(_0x32ed72){return _0x552cd3[_0xfe2c('0x74')](_0x5f34d3,{'transaction':_0x32ed72})['then'](function(){return BPromise[_0xfe2c('0x7a')](_0x14631f,function(_0x4f946d){return db[_0xfe2c('0x7b')][_0xfe2c('0x7c')]({'TeamId':_0x4f946d['id'],'VoicePrefixId':_0x3f2102[_0xfe2c('0x46')]['id']},{'transaction':_0x32ed72});});})[_0xfe2c('0x23')](function(){return BPromise['each'](_0x18ad4f,function(_0x42495d){return db[_0xfe2c('0x7d')]['findOrCreate']({'where':{'UserId':_0x42495d['id'],'VoicePrefixId':_0x3f2102[_0xfe2c('0x46')]['id']},'transaction':_0x32ed72});});})[_0xfe2c('0x23')](function(){_0x18ad4f[_0xfe2c('0x7e')](function(_0x1682b2){socket[_0xfe2c('0x6d')]('userVoicePrefix:save',{'UserId':_0x1682b2['id'],'VoicePrefixId':_0x552cd3['id']});});});});});}})[_0xfe2c('0x23')](respondWithStatusCode(_0x1cc35d,null))[_0xfe2c('0x49')](handleError(_0x1cc35d,null));};exports[_0xfe2c('0x7f')]=function(_0x3027f9,_0x3d6fba,_0x2523cc){return db['Team'][_0xfe2c('0x75')]({'where':{'id':_0x3027f9[_0xfe2c('0x33')][_0xfe2c('0x6a')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xfe2c('0x76'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x3d6fba,null))[_0xfe2c('0x23')](function(_0x5cbd7f){var _0x3dba12=_[_0xfe2c('0x2c')](_0x5cbd7f,'id');var _0x40be3c=[];var _0x4dd915=[];var _0x6efab6=squel['select']();_0x6efab6[_0xfe2c('0x80')](_0xfe2c('0x81'))[_0xfe2c('0x82')]('team_has_voice_prefixes','tq')[_0xfe2c('0x83')](_0xfe2c('0x84'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xfe2c('0x3d')](_0xfe2c('0x85'),_0x3027f9['params']['id']);for(var _0x3b6535=0x0;_0x3b6535<_0x5cbd7f[_0xfe2c('0x39')];_0x3b6535+=0x1){let _0x1d712e=_0x5cbd7f[_0x3b6535];for(var _0x14696e=0x0;_0x14696e<_0x1d712e[_0xfe2c('0x76')][_0xfe2c('0x39')];_0x14696e+=0x1){let _0x252527=_0x1d712e[_0xfe2c('0x76')][_0x14696e];var _0x1c0877=_0x6efab6[_0xfe2c('0x86')]();_0x1c0877[_0xfe2c('0x3d')](_0xfe2c('0x87'),_0x252527['id']);_0x4dd915[_0xfe2c('0x60')](db[_0xfe2c('0x4b')][_0xfe2c('0x33')](_0x1c0877[_0xfe2c('0x88')](),{'type':db['sequelize'][_0xfe2c('0x89')]['SELECT']})[_0xfe2c('0x23')](function(_0x5f3a0f){if(_0x5f3a0f[_0xfe2c('0x39')]===0x1){return _0x252527['id'];}else{var _0x329de0=_[_0xfe2c('0x8a')](_[_0xfe2c('0x2c')](_0x5f3a0f,_0xfe2c('0x8b')),function(_0x5b6e4f){return _[_0xfe2c('0x8c')](_0x3dba12,_0x5b6e4f);});if(_0x329de0){return _0x252527['id'];}}}));}}return BPromise[_0xfe2c('0x8d')](_0x4dd915)[_0xfe2c('0x23')](function(_0x57d173){_0x40be3c=_(_0x40be3c)['union'](_0x57d173)[_0xfe2c('0x8e')]()[_0xfe2c('0x8f')]();return db['VoicePrefix'][_0xfe2c('0x48')]({'where':{'id':_0x3027f9[_0xfe2c('0x46')]['id']}})[_0xfe2c('0x23')](function(_0x2f3af6){return db[_0xfe2c('0x4b')]['transaction'](function(_0x36abbf){return _0x2f3af6[_0xfe2c('0x7f')](_0x3027f9[_0xfe2c('0x33')][_0xfe2c('0x6a')],{'transaction':_0x36abbf})[_0xfe2c('0x23')](function(){if(!_[_0xfe2c('0x90')](_0x40be3c)){return _0x2f3af6[_0xfe2c('0x91')](_0x40be3c,{'transaction':_0x36abbf});}})[_0xfe2c('0x23')](function(){_0x40be3c['forEach'](function(_0x29c9ef){socket['emit'](_0xfe2c('0x6e'),{'UserId':_0x29c9ef,'VoicePrefixId':_0x2f3af6['id']});});});});});});})[_0xfe2c('0x23')](respondWithStatusCode(_0x3d6fba,null))[_0xfe2c('0x49')](handleError(_0x3d6fba,null));}; \ No newline at end of file +var _0x8f4c=['save','update','destroy','then','VoicePrefixes','error','send','index','map','VoicePrefix','rawAttributes','fieldName','type','model','name','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','describe','create','sequelize','transaction','body','get','VoiceExtension','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','exten','app','description','Voice\x20Prefix\x20Extension','appdata','NoOp','Voice\x20Prefix','Extensions\x20creation\x20failed','push','Set','CDR(prefix)=','callerIdAll','No\x20callerid\x20available','goto','${EXTEN:','charAt','prefix','system-','VoiceExtensionId','addAgents','ids','omit','spread','removeAgents','isArray','emit','userVoicePrefix:remove','findOne','User','getAgents','getTeams','addTeams','findAll','Agents','online','voicePause','interface','flatMap','each','TeamVoicePrefix','upsert','findOrCreate','forEach','userVoicePrefix:save','removeTeams','select','tq.TeamId','from','team_has_voice_prefixes','join','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','TeamId','includes','all','compact','isEmpty','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject'];(function(_0x2eac0b,_0x3c769c){var _0x3478e2=function(_0x263a2c){while(--_0x263a2c){_0x2eac0b['push'](_0x2eac0b['shift']());}};_0x3478e2(++_0x3c769c);}(_0x8f4c,0x113));var _0xc8f4=function(_0x3a75f1,_0x1ce196){_0x3a75f1=_0x3a75f1-0x0;var _0x577155=_0x8f4c[_0x3a75f1];return _0x577155;};'use strict';var emlformat=require(_0xc8f4('0x0'));var rimraf=require(_0xc8f4('0x1'));var zipdir=require(_0xc8f4('0x2'));var jsonpatch=require(_0xc8f4('0x3'));var rp=require(_0xc8f4('0x4'));var moment=require(_0xc8f4('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xc8f4('0x6'));var util=require(_0xc8f4('0x7'));var path=require(_0xc8f4('0x8'));var sox=require('sox');var csv=require(_0xc8f4('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xc8f4('0xa'));var crypto=require('crypto');var jsforce=require(_0xc8f4('0xb'));var deskjs=require(_0xc8f4('0xc'));var toCsv=require(_0xc8f4('0x9'));var querystring=require(_0xc8f4('0xd'));var Papa=require(_0xc8f4('0xe'));var Redis=require('ioredis');var authService=require(_0xc8f4('0xf'));var qs=require(_0xc8f4('0x10'));var as=require(_0xc8f4('0x11'));var hardwareService=require(_0xc8f4('0x12'));var logger=require('../../config/logger')(_0xc8f4('0x13'));var utils=require('../../config/utils');var config=require(_0xc8f4('0x14'));var licenseUtil=require(_0xc8f4('0x15'));var db=require(_0xc8f4('0x16'))['db'];config[_0xc8f4('0x17')]=_[_0xc8f4('0x18')](config['redis'],{'host':_0xc8f4('0x19'),'port':0x18eb});var socket=require(_0xc8f4('0x1a'))(new Redis(config[_0xc8f4('0x17')]));require(_0xc8f4('0x1b'))[_0xc8f4('0x1c')](socket);function respondWithStatusCode(_0x411c5c,_0x4e3c36){_0x4e3c36=_0x4e3c36||0xcc;return function(_0x2bce00){if(_0x2bce00){return _0x411c5c[_0xc8f4('0x1d')](_0x4e3c36);}return _0x411c5c[_0xc8f4('0x1e')](_0x4e3c36)[_0xc8f4('0x1f')]();};}function respondWithResult(_0x22c08a,_0x56a25d){_0x56a25d=_0x56a25d||0xc8;return function(_0xac45d5){if(_0xac45d5){return _0x22c08a['status'](_0x56a25d)['json'](_0xac45d5);}};}function respondWithFilteredResult(_0x14bc02,_0x225b76){return function(_0x108076){if(_0x108076){var _0x7bb973=typeof _0x225b76[_0xc8f4('0x20')]===_0xc8f4('0x21')&&typeof _0x225b76[_0xc8f4('0x22')]===_0xc8f4('0x21');var _0x1982bb=_0x108076[_0xc8f4('0x23')];var _0x3cd90c=_0x7bb973?0x0:_0x225b76[_0xc8f4('0x20')];var _0x22236c=_0x7bb973?_0x108076['count']:_0x225b76[_0xc8f4('0x20')]+_0x225b76[_0xc8f4('0x22')];var _0x29e52d;if(_0x22236c>=_0x1982bb){_0x22236c=_0x1982bb;_0x29e52d=0xc8;}else{_0x29e52d=0xce;}_0x14bc02[_0xc8f4('0x1e')](_0x29e52d);return _0x14bc02[_0xc8f4('0x24')](_0xc8f4('0x25'),_0x3cd90c+'-'+_0x22236c+'/'+_0x1982bb)[_0xc8f4('0x26')](_0x108076);}return null;};}function patchUpdates(_0x43eb57){return function(_0x5e62aa){try{jsonpatch[_0xc8f4('0x27')](_0x5e62aa,_0x43eb57,!![]);}catch(_0x205c41){return BPromise[_0xc8f4('0x28')](_0x205c41);}return _0x5e62aa[_0xc8f4('0x29')]();};}function saveUpdates(_0x5d54a9,_0x39174f){return function(_0x4a44e0){if(_0x4a44e0){return _0x4a44e0[_0xc8f4('0x2a')](_0x5d54a9)['then'](function(_0x177a44){return _0x177a44;});}return null;};}function removeEntity(_0x3dd717,_0x5c94c6){return function(_0x41f4de){if(_0x41f4de){return _0x41f4de[_0xc8f4('0x2b')]()[_0xc8f4('0x2c')](function(){var _0x2fa052=_0x41f4de['get']({'plain':!![]});var _0x3db490=_0xc8f4('0x2d');return db['UserProfileResource'][_0xc8f4('0x2b')]({'where':{'type':_0x3db490,'resourceId':_0x2fa052['id']}})[_0xc8f4('0x2c')](function(){return _0x41f4de;});})[_0xc8f4('0x2c')](function(){_0x3dd717[_0xc8f4('0x1e')](0xcc)[_0xc8f4('0x1f')]();});}};}function handleEntityNotFound(_0x385e41,_0x4a25da){return function(_0x45f972){if(!_0x45f972){_0x385e41[_0xc8f4('0x1d')](0x194);}return _0x45f972;};}function handleError(_0x1ea3d9,_0x4dcd8f){_0x4dcd8f=_0x4dcd8f||0x1f4;return function(_0xf4a556){logger[_0xc8f4('0x2e')](_0xf4a556['stack']);if(_0xf4a556['name']){delete _0xf4a556['name'];}_0x1ea3d9[_0xc8f4('0x1e')](_0x4dcd8f)[_0xc8f4('0x2f')](_0xf4a556);};}exports[_0xc8f4('0x30')]=function(_0x28baa0,_0x273e73){var _0x2f9a80={},_0x3181af={},_0xffc7aa={'count':0x0,'rows':[]};var _0x4b4203=_[_0xc8f4('0x31')](db[_0xc8f4('0x32')][_0xc8f4('0x33')],function(_0x5cb6ce){return{'name':_0x5cb6ce[_0xc8f4('0x34')],'type':_0x5cb6ce[_0xc8f4('0x35')]['key']};});_0x3181af[_0xc8f4('0x36')]=_[_0xc8f4('0x31')](_0x4b4203,_0xc8f4('0x37'));_0x3181af['query']=_[_0xc8f4('0x38')](_0x28baa0[_0xc8f4('0x39')]);_0x3181af[_0xc8f4('0x3a')]=_['intersection'](_0x3181af[_0xc8f4('0x36')],_0x3181af[_0xc8f4('0x39')]);_0x2f9a80[_0xc8f4('0x3b')]=_[_0xc8f4('0x3c')](_0x3181af[_0xc8f4('0x36')],qs[_0xc8f4('0x3d')](_0x28baa0[_0xc8f4('0x39')][_0xc8f4('0x3d')]));_0x2f9a80[_0xc8f4('0x3b')]=_0x2f9a80[_0xc8f4('0x3b')][_0xc8f4('0x3e')]?_0x2f9a80[_0xc8f4('0x3b')]:_0x3181af[_0xc8f4('0x36')];if(!_0x28baa0[_0xc8f4('0x39')][_0xc8f4('0x3f')](_0xc8f4('0x40'))){_0x2f9a80['limit']=qs[_0xc8f4('0x22')](_0x28baa0['query'][_0xc8f4('0x22')]);_0x2f9a80['offset']=qs[_0xc8f4('0x20')](_0x28baa0[_0xc8f4('0x39')][_0xc8f4('0x20')]);}_0x2f9a80[_0xc8f4('0x41')]=qs[_0xc8f4('0x42')](_0x28baa0[_0xc8f4('0x39')][_0xc8f4('0x42')]);_0x2f9a80['where']=qs[_0xc8f4('0x3a')](_[_0xc8f4('0x43')](_0x28baa0[_0xc8f4('0x39')],_0x3181af[_0xc8f4('0x3a')]),_0x4b4203);if(_0x28baa0['query'][_0xc8f4('0x44')]){_0x2f9a80[_0xc8f4('0x45')]=_[_0xc8f4('0x46')](_0x2f9a80[_0xc8f4('0x45')],{'$or':_[_0xc8f4('0x31')](_0x4b4203,function(_0x1d7831){if(_0x1d7831[_0xc8f4('0x35')]!==_0xc8f4('0x47')){var _0x1eebbd={};_0x1eebbd[_0x1d7831[_0xc8f4('0x37')]]={'$like':'%'+_0x28baa0[_0xc8f4('0x39')][_0xc8f4('0x44')]+'%'};return _0x1eebbd;}})});}_0x2f9a80=_['merge']({},_0x2f9a80,_0x28baa0[_0xc8f4('0x48')]);var _0x32e067={'where':_0x2f9a80[_0xc8f4('0x45')]};return db[_0xc8f4('0x32')]['count'](_0x32e067)['then'](function(_0x413a55){_0xffc7aa[_0xc8f4('0x23')]=_0x413a55;if(_0x28baa0['query'][_0xc8f4('0x49')]){_0x2f9a80[_0xc8f4('0x4a')]=[{'all':!![]}];}return db['VoicePrefix']['findAll'](_0x2f9a80);})[_0xc8f4('0x2c')](function(_0x342c28){_0xffc7aa[_0xc8f4('0x4b')]=_0x342c28;return _0xffc7aa;})[_0xc8f4('0x2c')](respondWithFilteredResult(_0x273e73,_0x2f9a80))[_0xc8f4('0x4c')](handleError(_0x273e73,null));};exports[_0xc8f4('0x4d')]=function(_0x4de3d1,_0x522f52){var _0x705792={'raw':![],'where':{'id':_0x4de3d1[_0xc8f4('0x4e')]['id']}},_0x8c82a5={};_0x8c82a5['model']=_['keys'](db['VoicePrefix']['rawAttributes']);_0x8c82a5['query']=_[_0xc8f4('0x38')](_0x4de3d1[_0xc8f4('0x39')]);_0x8c82a5[_0xc8f4('0x3a')]=_[_0xc8f4('0x3c')](_0x8c82a5[_0xc8f4('0x36')],_0x8c82a5[_0xc8f4('0x39')]);_0x705792['attributes']=_[_0xc8f4('0x3c')](_0x8c82a5[_0xc8f4('0x36')],qs['fields'](_0x4de3d1['query'][_0xc8f4('0x3d')]));_0x705792[_0xc8f4('0x3b')]=_0x705792[_0xc8f4('0x3b')][_0xc8f4('0x3e')]?_0x705792['attributes']:_0x8c82a5['model'];if(_0x4de3d1[_0xc8f4('0x39')][_0xc8f4('0x49')]){_0x705792[_0xc8f4('0x4a')]=[{'all':!![]}];}_0x705792=_[_0xc8f4('0x46')]({},_0x705792,_0x4de3d1[_0xc8f4('0x48')]);return db[_0xc8f4('0x32')]['find'](_0x705792)['then'](handleEntityNotFound(_0x522f52,null))[_0xc8f4('0x2c')](respondWithResult(_0x522f52,null))[_0xc8f4('0x4c')](handleError(_0x522f52,null));};exports[_0xc8f4('0x2b')]=function(_0x1b3744,_0x39b4a4){return db[_0xc8f4('0x32')][_0xc8f4('0x4f')]({'where':{'id':_0x1b3744[_0xc8f4('0x4e')]['id']}})[_0xc8f4('0x2c')](handleEntityNotFound(_0x39b4a4,null))['then'](removeEntity(_0x39b4a4,null))['catch'](handleError(_0x39b4a4,null));};exports[_0xc8f4('0x50')]=function(_0xc11ff5,_0x1e5932){return db[_0xc8f4('0x32')][_0xc8f4('0x50')]()[_0xc8f4('0x2c')](respondWithResult(_0x1e5932,null))[_0xc8f4('0x4c')](handleError(_0x1e5932,null));};exports[_0xc8f4('0x51')]=function(_0x197f3c,_0x189fae){var _0x15064a;return db[_0xc8f4('0x52')][_0xc8f4('0x53')](function(_0x4ec67d){return db[_0xc8f4('0x32')][_0xc8f4('0x51')](_0x197f3c[_0xc8f4('0x54')],{'transaction':_0x4ec67d})[_0xc8f4('0x2c')](function(_0x481dd2){_0x15064a=_0x481dd2[_0xc8f4('0x55')]({'plain':!![]});return db[_0xc8f4('0x56')]['find']({'where':{'id':_0x15064a['VoiceExtensionId']},'raw':!![]})[_0xc8f4('0x2c')](function(_0x5cc52d){return createVoicePrefixExtensions(_0x15064a,_0x5cc52d,_0x4ec67d);});});})[_0xc8f4('0x2c')](function(){var _0x29f8f4=_0x197f3c[_0xc8f4('0x57')][_0xc8f4('0x55')]({'plain':!![]});if(!_0x29f8f4)throw new Error(_0xc8f4('0x58'));if(_0x29f8f4[_0xc8f4('0x59')]===_0xc8f4('0x57')){var _0x1f7602=_0x15064a;return db[_0xc8f4('0x5a')][_0xc8f4('0x4f')]({'where':{'name':_0xc8f4('0x2d'),'userProfileId':_0x29f8f4['userProfileId']},'raw':!![]})[_0xc8f4('0x2c')](function(_0x1f983e){if(_0x1f983e&&_0x1f983e[_0xc8f4('0x5b')]===0x0){return db[_0xc8f4('0x5c')]['create']({'name':_0x1f7602[_0xc8f4('0x37')],'resourceId':_0x1f7602['id'],'type':_0x1f983e['name'],'sectionId':_0x1f983e['id']},{})['then'](function(){return _0x15064a;});}else{return _0x15064a;}})[_0xc8f4('0x4c')](function(_0x451a3e){logger[_0xc8f4('0x2e')](_0xc8f4('0x5d'),_0x451a3e);throw _0x451a3e;});}return _0x15064a;})[_0xc8f4('0x2c')](respondWithResult(_0x189fae,null))[_0xc8f4('0x4c')](handleError(_0x189fae,null));};function Extension(_0x5aba71,_0x562e89,_0x45fb1a,_0x2b558e){this[_0xc8f4('0x5e')]=_0xc8f4('0x5f');this[_0xc8f4('0x60')]=_0x5aba71;this[_0xc8f4('0x61')]=_0x45fb1a;this[_0xc8f4('0x35')]='system';this[_0xc8f4('0x62')]=_0xc8f4('0x63');this['priority']=_0x562e89;this[_0xc8f4('0x64')]=_0x2b558e;}function createVoicePrefixExtensions(_0x2da305,_0x9dbf80,_0x5b8bf4){return new BPromise(function(_0x368798,_0x3aa12d){var _0x33801b=new Extension(formatPrefixName(_0x2da305['prefix']),0x1,_0xc8f4('0x65'),_0xc8f4('0x66'));_0x33801b['VoicePrefixId']=_0x2da305['id'];return db['VoiceExtension'][_0xc8f4('0x51')](_0x33801b,{'transaction':_0x5b8bf4})['then'](function(_0x281b3a){var _0x44f603=_0x281b3a['get']({'plain':!![]});var _0x5f2781=_['map'](addVoicePrefixExtensions(_0x2da305,_0x9dbf80),function(_0x490b8b){_0x490b8b['VoiceExtensionId']=_0x44f603['id'];_0x490b8b['VoicePrefixId']=_0x2da305['id'];return _0x490b8b;});return db[_0xc8f4('0x56')]['bulkCreate'](_0x5f2781,{'transaction':_0x5b8bf4})[_0xc8f4('0x2c')](function(_0x357e45){if(!_0x357e45){return _0x3aa12d(_0xc8f4('0x67'));}else{return _0x368798(_0x357e45);}})[_0xc8f4('0x4c')](function(_0x5ea840){return _0x3aa12d(_0x5ea840);});});;});};function addVoicePrefixExtensions(_0x3f2596,_0x329c26){var _0x3ca2ca=[];var _0xb50e61=formatPrefixName(_0x3f2596['prefix']);_0x3ca2ca[_0xc8f4('0x68')](new Extension(_0xb50e61,0x2,_0xc8f4('0x69'),_0xc8f4('0x6a')+_0x3f2596[_0xc8f4('0x37')]));if(_0x3f2596['callerIdAll']){_0x3ca2ca[_0xc8f4('0x68')](new Extension(_0xb50e61,0x3,_0xc8f4('0x69'),'PREFIX-CALLERIDALL='+_0x3f2596[_0xc8f4('0x6b')]));}else{_0x3ca2ca[_0xc8f4('0x68')](new Extension(_0xb50e61,0x3,_0xc8f4('0x65'),_0xc8f4('0x6c')));}_0x3ca2ca[_0xc8f4('0x68')](new Extension(_0xb50e61,0x4,_0xc8f4('0x6d'),_0x329c26['context']+','+_0xc8f4('0x6e')+(0x8+_0x3f2596[_0xc8f4('0x37')][_0xc8f4('0x3e')])+'}'+','+0x1));return _0x3ca2ca;}function formatPrefixName(_0x5e5117){var _0x28db1f='_';for(var _0x2b6510=0x0;_0x2b6510<_0x5e5117[_0xc8f4('0x3e')];_0x2b6510++){if(_0x5e5117['charAt'](_0x2b6510)=='-'){_0x28db1f+=_0x5e5117[_0xc8f4('0x6f')](_0x2b6510);}else{_0x28db1f+='['+_0x5e5117[_0xc8f4('0x6f')](_0x2b6510)+']';}}_0x28db1f+='.';return _0x28db1f;}exports[_0xc8f4('0x2a')]=function(_0x1278f1,_0x5bf089,_0x8c8e43){var _0x9996da=_0x1278f1['body'];_0x9996da[_0xc8f4('0x70')]=_0xc8f4('0x71')+_0x9996da['name']+'-';return db[_0xc8f4('0x52')][_0xc8f4('0x53')](function(_0x437718){return db[_0xc8f4('0x32')][_0xc8f4('0x2a')](_0x9996da,{'where':{'id':_0x9996da['id']},'transaction':_0x437718})[_0xc8f4('0x2c')](function(){return db[_0xc8f4('0x56')][_0xc8f4('0x2b')]({'where':{'VoicePrefixId':_0x9996da['id']},'transaction':_0x437718})['then'](function(){return db[_0xc8f4('0x56')][_0xc8f4('0x4f')]({'where':{'id':_0x9996da[_0xc8f4('0x72')]},'raw':!![]})[_0xc8f4('0x2c')](function(_0xdc64f3){return createVoicePrefixExtensions(_0x9996da,_0xdc64f3,_0x437718);});});});})['then'](function(){return db[_0xc8f4('0x32')]['findById'](_0x9996da['id']);})[_0xc8f4('0x2c')](respondWithResult(_0x5bf089,null))[_0xc8f4('0x4c')](handleError(_0x5bf089,null));};exports[_0xc8f4('0x73')]=function(_0x30e155,_0xc6df8e,_0x9a7714){return db[_0xc8f4('0x32')][_0xc8f4('0x4f')]({'where':{'id':_0x30e155[_0xc8f4('0x4e')]['id']}})[_0xc8f4('0x2c')](handleEntityNotFound(_0xc6df8e,null))[_0xc8f4('0x2c')](function(_0x4d7d74){if(_0x4d7d74){return _0x4d7d74[_0xc8f4('0x73')](_0x30e155[_0xc8f4('0x54')][_0xc8f4('0x74')],_[_0xc8f4('0x75')](_0x30e155['body'],['ids','id'])||{})[_0xc8f4('0x76')](function(_0x4cde06){for(var _0x205ed9=0x0;_0x205ed9<_0x30e155['body'][_0xc8f4('0x74')]['length'];_0x205ed9+=0x1){socket['emit']('userVoicePrefix:save',{'UserId':Number(_0x30e155['body']['ids'][_0x205ed9]),'VoicePrefixId':Number(_0x30e155['params']['id'])});}return _0x4cde06;});}})[_0xc8f4('0x2c')](respondWithResult(_0xc6df8e,null))['catch'](handleError(_0xc6df8e,null));};exports[_0xc8f4('0x77')]=function(_0x3ad7dd,_0x3e22c2,_0x367d5e){return db[_0xc8f4('0x32')]['find']({'where':{'id':_0x3ad7dd[_0xc8f4('0x4e')]['id']}})[_0xc8f4('0x2c')](handleEntityNotFound(_0x3e22c2,null))[_0xc8f4('0x2c')](function(_0x5b354d){if(_0x5b354d){return _0x5b354d[_0xc8f4('0x77')](_0x3ad7dd[_0xc8f4('0x39')][_0xc8f4('0x74')])[_0xc8f4('0x2c')](function(){if(_[_0xc8f4('0x78')](_0x3ad7dd[_0xc8f4('0x39')][_0xc8f4('0x74')])){for(var _0x1401f1=0x0;_0x1401f1<_0x3ad7dd['query'][_0xc8f4('0x74')][_0xc8f4('0x3e')];_0x1401f1+=0x1){socket[_0xc8f4('0x79')](_0xc8f4('0x7a'),{'UserId':Number(_0x3ad7dd[_0xc8f4('0x39')][_0xc8f4('0x74')][_0x1401f1]),'VoicePrefixId':Number(_0x3ad7dd[_0xc8f4('0x4e')]['id'])});}}else{socket[_0xc8f4('0x79')](_0xc8f4('0x7a'),{'UserId':Number(_0x3ad7dd[_0xc8f4('0x39')][_0xc8f4('0x74')]),'VoicePrefixId':Number(_0x3ad7dd['params']['id'])});}});}})[_0xc8f4('0x2c')](respondWithStatusCode(_0x3e22c2,null))[_0xc8f4('0x4c')](handleError(_0x3e22c2,null));};exports['getAgents']=function(_0x412695,_0x1921bc,_0x50f012){var _0x16ea62={};var _0x2bbf57={};var _0x57b97a;var _0x5bb6cc;return db[_0xc8f4('0x32')][_0xc8f4('0x7b')]({'where':{'id':_0x412695[_0xc8f4('0x4e')]['id']}})['then'](handleEntityNotFound(_0x1921bc,null))[_0xc8f4('0x2c')](function(_0xf1c31d){if(_0xf1c31d){_0x57b97a=_0xf1c31d;_0x2bbf57['model']=_['keys'](db[_0xc8f4('0x7c')][_0xc8f4('0x33')]);_0x2bbf57[_0xc8f4('0x39')]=_['keys'](_0x412695[_0xc8f4('0x39')]);_0x2bbf57[_0xc8f4('0x3a')]=_[_0xc8f4('0x3c')](_0x2bbf57['model'],_0x2bbf57[_0xc8f4('0x39')]);_0x16ea62[_0xc8f4('0x3b')]=_[_0xc8f4('0x3c')](_0x2bbf57[_0xc8f4('0x36')],qs[_0xc8f4('0x3d')](_0x412695[_0xc8f4('0x39')][_0xc8f4('0x3d')]));_0x16ea62[_0xc8f4('0x3b')]=_0x16ea62[_0xc8f4('0x3b')][_0xc8f4('0x3e')]?_0x16ea62[_0xc8f4('0x3b')]:_0x2bbf57['model'];_0x16ea62[_0xc8f4('0x41')]=qs['sort'](_0x412695[_0xc8f4('0x39')][_0xc8f4('0x42')]);_0x16ea62[_0xc8f4('0x45')]=qs[_0xc8f4('0x3a')](_[_0xc8f4('0x43')](_0x412695[_0xc8f4('0x39')],_0x2bbf57[_0xc8f4('0x3a')]));if(_0x412695[_0xc8f4('0x39')]['filter']){_0x16ea62[_0xc8f4('0x45')]=_['merge'](_0x16ea62['where'],{'$or':_[_0xc8f4('0x31')](_0x16ea62[_0xc8f4('0x3b')],function(_0x35a3db){var _0x4fedd9={};_0x4fedd9[_0x35a3db]={'$like':'%'+_0x412695['query'][_0xc8f4('0x44')]+'%'};return _0x4fedd9;})});}_0x16ea62=_[_0xc8f4('0x46')]({},_0x16ea62,_0x412695[_0xc8f4('0x48')]);return _0x57b97a['getAgents'](_0x16ea62);}})[_0xc8f4('0x2c')](function(_0x5ce8eb){if(_0x5ce8eb){_0x5bb6cc=_0x5ce8eb[_0xc8f4('0x3e')];if(!_0x412695[_0xc8f4('0x39')][_0xc8f4('0x3f')](_0xc8f4('0x40'))){_0x16ea62[_0xc8f4('0x22')]=qs['limit'](_0x412695[_0xc8f4('0x39')]['limit']);_0x16ea62[_0xc8f4('0x20')]=qs[_0xc8f4('0x20')](_0x412695[_0xc8f4('0x39')][_0xc8f4('0x20')]);}return _0x57b97a[_0xc8f4('0x7d')](_0x16ea62);}})[_0xc8f4('0x2c')](function(_0x3f1852){if(_0x3f1852){return _0x3f1852?{'count':_0x5bb6cc,'rows':_0x3f1852}:null;}})[_0xc8f4('0x2c')](respondWithResult(_0x1921bc,null))[_0xc8f4('0x4c')](handleError(_0x1921bc,null));};exports[_0xc8f4('0x7e')]=function(_0x28bcf0,_0x53bd16,_0x526010){var _0x23890b={};var _0x20c759={};var _0x13a274;var _0xb813ba;return db[_0xc8f4('0x32')][_0xc8f4('0x7b')]({'where':{'id':_0x28bcf0[_0xc8f4('0x4e')]['id']}})[_0xc8f4('0x2c')](handleEntityNotFound(_0x53bd16,null))[_0xc8f4('0x2c')](function(_0x7758c2){if(_0x7758c2){_0x13a274=_0x7758c2;_0x20c759[_0xc8f4('0x36')]=_[_0xc8f4('0x38')](db['Team']['rawAttributes']);_0x20c759[_0xc8f4('0x39')]=_['keys'](_0x28bcf0['query']);_0x20c759[_0xc8f4('0x3a')]=_['intersection'](_0x20c759['model'],_0x20c759['query']);_0x23890b['attributes']=_['intersection'](_0x20c759[_0xc8f4('0x36')],qs[_0xc8f4('0x3d')](_0x28bcf0[_0xc8f4('0x39')][_0xc8f4('0x3d')]));_0x23890b[_0xc8f4('0x3b')]=_0x23890b[_0xc8f4('0x3b')][_0xc8f4('0x3e')]?_0x23890b[_0xc8f4('0x3b')]:_0x20c759[_0xc8f4('0x36')];_0x23890b[_0xc8f4('0x41')]=qs[_0xc8f4('0x42')](_0x28bcf0[_0xc8f4('0x39')][_0xc8f4('0x42')]);_0x23890b[_0xc8f4('0x45')]=qs[_0xc8f4('0x3a')](_[_0xc8f4('0x43')](_0x28bcf0[_0xc8f4('0x39')],_0x20c759[_0xc8f4('0x3a')]));if(_0x28bcf0[_0xc8f4('0x39')][_0xc8f4('0x44')]){_0x23890b[_0xc8f4('0x45')]=_[_0xc8f4('0x46')](_0x23890b[_0xc8f4('0x45')],{'$or':_['map'](_0x23890b['attributes'],function(_0xe8ff50){var _0x416ade={};_0x416ade[_0xe8ff50]={'$like':'%'+_0x28bcf0[_0xc8f4('0x39')][_0xc8f4('0x44')]+'%'};return _0x416ade;})});}_0x23890b=_[_0xc8f4('0x46')]({},_0x23890b,_0x28bcf0[_0xc8f4('0x48')]);return _0x13a274[_0xc8f4('0x7e')](_0x23890b);}})[_0xc8f4('0x2c')](function(_0xe9d619){if(_0xe9d619){_0xb813ba=_0xe9d619[_0xc8f4('0x3e')];if(!_0x28bcf0[_0xc8f4('0x39')][_0xc8f4('0x3f')](_0xc8f4('0x40'))){_0x23890b[_0xc8f4('0x22')]=qs['limit'](_0x28bcf0[_0xc8f4('0x39')][_0xc8f4('0x22')]);_0x23890b[_0xc8f4('0x20')]=qs[_0xc8f4('0x20')](_0x28bcf0[_0xc8f4('0x39')]['offset']);}return _0x13a274[_0xc8f4('0x7e')](_0x23890b);}})[_0xc8f4('0x2c')](function(_0x5a5f87){if(_0x5a5f87){return _0x5a5f87?{'count':_0xb813ba,'rows':_0x5a5f87}:null;}})['then'](respondWithResult(_0x53bd16,null))[_0xc8f4('0x4c')](handleError(_0x53bd16,null));};exports[_0xc8f4('0x7f')]=function(_0xe771f7,_0x32c7c3,_0x3ecd2e){var _0x4b2876=_0xe771f7['body'][_0xc8f4('0x74')];var _0xe437e;return db['Team'][_0xc8f4('0x80')]({'where':{'id':_0x4b2876},'attributes':['id'],'include':[{'model':db[_0xc8f4('0x7c')],'as':_0xc8f4('0x81'),'attributes':['id',_0xc8f4('0x37'),_0xc8f4('0x82'),_0xc8f4('0x83'),_0xc8f4('0x84')],'raw':!![]}]})[_0xc8f4('0x2c')](function(_0x4a4ea5){if(_0x4a4ea5){_0xe437e=_0x4a4ea5;var _0x23177d=_[_0xc8f4('0x85')](_0x4a4ea5,function(_0x129d2a){var _0x4d63e1=_0x129d2a[_0xc8f4('0x55')]({'plain':!![]});return _0x4d63e1['Agents'];});return db[_0xc8f4('0x32')][_0xc8f4('0x4f')]({'where':{'id':_0xe771f7[_0xc8f4('0x4e')]['id']}})['then'](function(_0x3a2f12){return db['sequelize'][_0xc8f4('0x53')](function(_0xfbf268){return _0x3a2f12[_0xc8f4('0x7f')](_0x4b2876,{'transaction':_0xfbf268})['then'](function(){return BPromise[_0xc8f4('0x86')](_0xe437e,function(_0x3a1a5a){return db[_0xc8f4('0x87')][_0xc8f4('0x88')]({'TeamId':_0x3a1a5a['id'],'VoicePrefixId':_0xe771f7['params']['id']},{'transaction':_0xfbf268});});})[_0xc8f4('0x2c')](function(){return BPromise['each'](_0x23177d,function(_0x2180a4){return db['UserVoicePrefix'][_0xc8f4('0x89')]({'where':{'UserId':_0x2180a4['id'],'VoicePrefixId':_0xe771f7[_0xc8f4('0x4e')]['id']},'transaction':_0xfbf268});});})['then'](function(){_0x23177d[_0xc8f4('0x8a')](function(_0x1b0146){socket[_0xc8f4('0x79')](_0xc8f4('0x8b'),{'UserId':_0x1b0146['id'],'VoicePrefixId':_0x3a2f12['id']});});});});});}})[_0xc8f4('0x2c')](respondWithStatusCode(_0x32c7c3,null))['catch'](handleError(_0x32c7c3,null));};exports[_0xc8f4('0x8c')]=function(_0x2a69de,_0xfe16,_0xac0f76){return db['Team'][_0xc8f4('0x80')]({'where':{'id':_0x2a69de[_0xc8f4('0x39')][_0xc8f4('0x74')]},'attributes':['id'],'include':[{'model':db[_0xc8f4('0x7c')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xc8f4('0x2c')](handleEntityNotFound(_0xfe16,null))[_0xc8f4('0x2c')](function(_0x32258c){var _0x3e67d5=_[_0xc8f4('0x31')](_0x32258c,'id');var _0xbc97d=[];var _0x5b723a=[];var _0x9c5a78=squel[_0xc8f4('0x8d')]();_0x9c5a78['field'](_0xc8f4('0x8e'))[_0xc8f4('0x8f')](_0xc8f4('0x90'),'tq')[_0xc8f4('0x91')]('user_has_teams','ut',_0xc8f4('0x92'))['where'](_0xc8f4('0x93'),_0x2a69de[_0xc8f4('0x4e')]['id']);for(var _0x11c10f=0x0;_0x11c10f<_0x32258c['length'];_0x11c10f+=0x1){let _0x2e3221=_0x32258c[_0x11c10f];for(var _0x103c24=0x0;_0x103c24<_0x2e3221[_0xc8f4('0x81')][_0xc8f4('0x3e')];_0x103c24+=0x1){let _0x2e1a3b=_0x2e3221[_0xc8f4('0x81')][_0x103c24];var _0x3c0e05=_0x9c5a78['clone']();_0x3c0e05[_0xc8f4('0x45')](_0xc8f4('0x94'),_0x2e1a3b['id']);_0x5b723a[_0xc8f4('0x68')](db[_0xc8f4('0x52')][_0xc8f4('0x39')](_0x3c0e05[_0xc8f4('0x95')](),{'type':db[_0xc8f4('0x52')][_0xc8f4('0x96')][_0xc8f4('0x97')]})[_0xc8f4('0x2c')](function(_0x29d70c){if(_0x29d70c[_0xc8f4('0x3e')]===0x1){return _0x2e1a3b['id'];}else{var _0x10cc75=_[_0xc8f4('0x98')](_[_0xc8f4('0x31')](_0x29d70c,_0xc8f4('0x99')),function(_0x84dc88){return _[_0xc8f4('0x9a')](_0x3e67d5,_0x84dc88);});if(_0x10cc75){return _0x2e1a3b['id'];}}}));}}return BPromise[_0xc8f4('0x9b')](_0x5b723a)[_0xc8f4('0x2c')](function(_0x506950){_0xbc97d=_(_0xbc97d)['union'](_0x506950)[_0xc8f4('0x9c')]()['value']();return db['VoicePrefix'][_0xc8f4('0x4f')]({'where':{'id':_0x2a69de[_0xc8f4('0x4e')]['id']}})['then'](function(_0x4bba01){return db['sequelize']['transaction'](function(_0x27334b){return _0x4bba01['removeTeams'](_0x2a69de['query'][_0xc8f4('0x74')],{'transaction':_0x27334b})[_0xc8f4('0x2c')](function(){if(!_[_0xc8f4('0x9d')](_0xbc97d)){return _0x4bba01[_0xc8f4('0x77')](_0xbc97d,{'transaction':_0x27334b});}})[_0xc8f4('0x2c')](function(){_0xbc97d[_0xc8f4('0x8a')](function(_0x34a545){socket[_0xc8f4('0x79')](_0xc8f4('0x7a'),{'UserId':_0x34a545,'VoicePrefixId':_0x4bba01['id']});});});});});});})[_0xc8f4('0x2c')](respondWithStatusCode(_0xfe16,null))['catch'](handleError(_0xfe16,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index 519d692..44049f0 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 _0x07fd=['update','emit','hasOwnProperty','hook','exports','events','setMaxListeners','save'];(function(_0x3f2c0f,_0x59988e){var _0x7b1b08=function(_0x9d53dd){while(--_0x9d53dd){_0x3f2c0f['push'](_0x3f2c0f['shift']());}};_0x7b1b08(++_0x59988e);}(_0x07fd,0x155));var _0xd07f=function(_0x816e28,_0x4e0f63){_0x816e28=_0x816e28-0x0;var _0x1c0489=_0x07fd[_0x816e28];return _0x1c0489;};'use strict';var EventEmitter=require(_0xd07f('0x0'));var VoicePrefix=require('../../mysqldb')['db']['VoicePrefix'];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0xd07f('0x1')](0x0);var events={'afterCreate':_0xd07f('0x2'),'afterUpdate':_0xd07f('0x3'),'afterDestroy':'remove'};function emitEvent(_0x15f6a2){return function(_0x250967,_0x3b7507,_0x49a7f9){VoicePrefixEvents[_0xd07f('0x4')](_0x15f6a2+':'+_0x250967['id'],_0x250967);VoicePrefixEvents[_0xd07f('0x4')](_0x15f6a2,_0x250967);_0x49a7f9(null);};}for(var e in events){if(events[_0xd07f('0x5')](e)){var event=events[e];VoicePrefix[_0xd07f('0x6')](e,emitEvent(event));}}module[_0xd07f('0x7')]=VoicePrefixEvents; \ No newline at end of file +var _0xb881=['hasOwnProperty','hook','exports','events','../../mysqldb','VoicePrefix','save','update','emit'];(function(_0x3bfd7b,_0x158ef1){var _0x2b5596=function(_0x17d33f){while(--_0x17d33f){_0x3bfd7b['push'](_0x3bfd7b['shift']());}};_0x2b5596(++_0x158ef1);}(_0xb881,0x66));var _0x1b88=function(_0x46ce14,_0x4f7796){_0x46ce14=_0x46ce14-0x0;var _0x1f15f0=_0xb881[_0x46ce14];return _0x1f15f0;};'use strict';var EventEmitter=require(_0x1b88('0x0'));var VoicePrefix=require(_0x1b88('0x1'))['db'][_0x1b88('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x1b88('0x3'),'afterUpdate':_0x1b88('0x4'),'afterDestroy':'remove'};function emitEvent(_0x14ac77){return function(_0x400fac,_0x279b2b,_0x2cff2a){VoicePrefixEvents['emit'](_0x14ac77+':'+_0x400fac['id'],_0x400fac);VoicePrefixEvents[_0x1b88('0x5')](_0x14ac77,_0x400fac);_0x2cff2a(null);};}for(var e in events){if(events[_0x1b88('0x6')](e)){var event=events[e];VoicePrefix[_0x1b88('0x7')](e,emitEvent(event));}}module[_0x1b88('0x8')]=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index 1f94e3f..13f08a2 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 _0xe62c=['bluebird','request-promise','path','rimraf','exports','define','VoicePrefix','voice_prefixes','lodash','../../config/logger','moment'];(function(_0xb93d2c,_0x654706){var _0x5d2548=function(_0x29f611){while(--_0x29f611){_0xb93d2c['push'](_0xb93d2c['shift']());}};_0x5d2548(++_0x654706);}(_0xe62c,0x173));var _0xce62=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0xe62c[_0x13d07a];return _0x5ee0ee;};'use strict';var _=require(_0xce62('0x0'));var util=require('util');var logger=require(_0xce62('0x1'))('api');var moment=require(_0xce62('0x2'));var BPromise=require(_0xce62('0x3'));var rp=require(_0xce62('0x4'));var fs=require('fs');var path=require(_0xce62('0x5'));var rimraf=require(_0xce62('0x6'));var config=require('../../config/environment');var attributes=require('./voicePrefix.attributes');module[_0xce62('0x7')]=function(_0x171b14,_0x30b2ff){return _0x171b14[_0xce62('0x8')](_0xce62('0x9'),attributes,{'tableName':_0xce62('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb91c=['lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./voicePrefix.attributes','define','voice_prefixes'];(function(_0x361697,_0x33b129){var _0x3773ec=function(_0x337692){while(--_0x337692){_0x361697['push'](_0x361697['shift']());}};_0x3773ec(++_0x33b129);}(_0xb91c,0x1e4));var _0xcb91=function(_0x3ce59b,_0x498956){_0x3ce59b=_0x3ce59b-0x0;var _0x373c10=_0xb91c[_0x3ce59b];return _0x373c10;};'use strict';var _=require(_0xcb91('0x0'));var util=require(_0xcb91('0x1'));var logger=require(_0xcb91('0x2'))(_0xcb91('0x3'));var moment=require('moment');var BPromise=require(_0xcb91('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xcb91('0x5'));var rimraf=require(_0xcb91('0x6'));var config=require(_0xcb91('0x7'));var attributes=require(_0xcb91('0x8'));module['exports']=function(_0x427b72,_0x8433ab){return _0x427b72[_0xcb91('0x9')]('VoicePrefix',attributes,{'tableName':_0xcb91('0xa'),'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 4c778da..4026f98 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 _0x073d=['message','result','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','register','then','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x1b58a9,_0x2df346){var _0x3daa9f=function(_0x3f30c7){while(--_0x3f30c7){_0x1b58a9['push'](_0x1b58a9['shift']());}};_0x3daa9f(++_0x2df346);}(_0x073d,0xd2));var _0xd073=function(_0x534c8f,_0x500079){_0x534c8f=_0x534c8f-0x0;var _0x5a57f5=_0x073d[_0x534c8f];return _0x5a57f5;};'use strict';var _=require('lodash');var util=require(_0xd073('0x0'));var moment=require(_0xd073('0x1'));var BPromise=require(_0xd073('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd073('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xd073('0x4'));var logger=require(_0xd073('0x5'))('rpc');var config=require(_0xd073('0x6'));var jayson=require(_0xd073('0x7'));var client=jayson[_0xd073('0x8')][_0xd073('0x9')]({'port':0x232a});config[_0xd073('0xa')]=_[_0xd073('0xb')](config[_0xd073('0xa')],{'host':_0xd073('0xc'),'port':0x18eb});var socket=require(_0xd073('0xd'))(new Redis(config[_0xd073('0xa')]));require(_0xd073('0xe'))[_0xd073('0xf')](socket);function respondWithRpcPromise(_0x238d31,_0x3f1fc6,_0x5c916e){return new BPromise(function(_0x53abea,_0xf39d94){return client['request'](_0x238d31,_0x5c916e)[_0xd073('0x10')](function(_0xf3f0f0){logger[_0xd073('0x11')](_0xd073('0x12'),_0x3f1fc6,_0xd073('0x13'));logger['debug'](_0xd073('0x14'),_0x3f1fc6,_0xd073('0x13'),JSON[_0xd073('0x15')](_0xf3f0f0));if(_0xf3f0f0[_0xd073('0x16')]){if(_0xf3f0f0['error'][_0xd073('0x17')]===0x1f4){logger[_0xd073('0x16')]('VoicePrefix,\x20%s,\x20%s',_0x3f1fc6,_0xf3f0f0[_0xd073('0x16')][_0xd073('0x18')]);return _0xf39d94(_0xf3f0f0[_0xd073('0x16')][_0xd073('0x18')]);}logger['error'](_0xd073('0x12'),_0x3f1fc6,_0xf3f0f0['error']['message']);return _0x53abea(_0xf3f0f0[_0xd073('0x16')][_0xd073('0x18')]);}else{logger[_0xd073('0x11')]('VoicePrefix,\x20%s,\x20%s',_0x3f1fc6,_0xd073('0x13'));_0x53abea(_0xf3f0f0[_0xd073('0x19')][_0xd073('0x18')]);}})['catch'](function(_0x194db8){logger[_0xd073('0x16')](_0xd073('0x12'),_0x3f1fc6,_0x194db8);_0xf39d94(_0x194db8);});});} \ No newline at end of file +var _0xe6e9=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./voicePrefix.socket','register','then','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','lodash','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0xe6e9,0x182));var _0x9e6e=function(_0x5512f2,_0xf84d18){_0x5512f2=_0x5512f2-0x0;var _0x447492=_0xe6e9[_0x5512f2];return _0x447492;};'use strict';var _=require(_0x9e6e('0x0'));var util=require(_0x9e6e('0x1'));var moment=require(_0x9e6e('0x2'));var BPromise=require('bluebird');var rs=require(_0x9e6e('0x3'));var fs=require('fs');var Redis=require(_0x9e6e('0x4'));var db=require(_0x9e6e('0x5'))['db'];var utils=require(_0x9e6e('0x6'));var logger=require(_0x9e6e('0x7'))('rpc');var config=require(_0x9e6e('0x8'));var jayson=require(_0x9e6e('0x9'));var client=jayson[_0x9e6e('0xa')][_0x9e6e('0xb')]({'port':0x232a});config[_0x9e6e('0xc')]=_['defaults'](config[_0x9e6e('0xc')],{'host':_0x9e6e('0xd'),'port':0x18eb});var socket=require(_0x9e6e('0xe'))(new Redis(config[_0x9e6e('0xc')]));require(_0x9e6e('0xf'))[_0x9e6e('0x10')](socket);function respondWithRpcPromise(_0x4862cb,_0x1b683d,_0x40360d){return new BPromise(function(_0x286351,_0xbf2d04){return client['request'](_0x4862cb,_0x40360d)[_0x9e6e('0x11')](function(_0x4697d1){logger['info'](_0x9e6e('0x12'),_0x1b683d,_0x9e6e('0x13'));logger[_0x9e6e('0x14')](_0x9e6e('0x15'),_0x1b683d,'request\x20sent',JSON[_0x9e6e('0x16')](_0x4697d1));if(_0x4697d1[_0x9e6e('0x17')]){if(_0x4697d1[_0x9e6e('0x17')][_0x9e6e('0x18')]===0x1f4){logger[_0x9e6e('0x17')](_0x9e6e('0x12'),_0x1b683d,_0x4697d1[_0x9e6e('0x17')][_0x9e6e('0x19')]);return _0xbf2d04(_0x4697d1[_0x9e6e('0x17')][_0x9e6e('0x19')]);}logger[_0x9e6e('0x17')](_0x9e6e('0x12'),_0x1b683d,_0x4697d1[_0x9e6e('0x17')][_0x9e6e('0x19')]);return _0x286351(_0x4697d1[_0x9e6e('0x17')][_0x9e6e('0x19')]);}else{logger[_0x9e6e('0x1a')](_0x9e6e('0x12'),_0x1b683d,_0x9e6e('0x13'));_0x286351(_0x4697d1[_0x9e6e('0x1b')][_0x9e6e('0x19')]);}})['catch'](function(_0x54ba62){logger['error'](_0x9e6e('0x12'),_0x1b683d,_0x54ba62);_0xbf2d04(_0x54ba62);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index 1088f00..f5d8730 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 _0x4dd3=['./voicePrefix.events','save','remove','emit','register','length','voicePrefix:'];(function(_0x48b7b4,_0x427fc8){var _0x15d7a2=function(_0x1668e7){while(--_0x1668e7){_0x48b7b4['push'](_0x48b7b4['shift']());}};_0x15d7a2(++_0x427fc8);}(_0x4dd3,0xf5));var _0x34dd=function(_0x15bc81,_0x4d4f77){_0x15bc81=_0x15bc81-0x0;var _0x59440e=_0x4dd3[_0x15bc81];return _0x59440e;};'use strict';var VoicePrefixEvents=require(_0x34dd('0x0'));var events=[_0x34dd('0x1'),_0x34dd('0x2'),'update'];function createListener(_0x5d835f,_0x23d13f){return function(_0x4cdb5f){_0x23d13f[_0x34dd('0x3')](_0x5d835f,_0x4cdb5f);};}function removeListener(_0x29d4bd,_0x7e6807){return function(){VoicePrefixEvents['removeListener'](_0x29d4bd,_0x7e6807);};}exports[_0x34dd('0x4')]=function(_0x704165){for(var _0x37ce1d=0x0,_0x365482=events[_0x34dd('0x5')];_0x37ce1d<_0x365482;_0x37ce1d++){var _0x5e8911=events[_0x37ce1d];var _0x4cb036=createListener(_0x34dd('0x6')+_0x5e8911,_0x704165);VoicePrefixEvents['on'](_0x5e8911,_0x4cb036);}}; \ No newline at end of file +var _0xa101=['voicePrefix:','./voicePrefix.events','save','update','emit','removeListener','register'];(function(_0x3ceb1c,_0x451019){var _0x3c211b=function(_0x1dc3b2){while(--_0x1dc3b2){_0x3ceb1c['push'](_0x3ceb1c['shift']());}};_0x3c211b(++_0x451019);}(_0xa101,0x15f));var _0x1a10=function(_0x528575,_0x2e067d){_0x528575=_0x528575-0x0;var _0x3063b7=_0xa101[_0x528575];return _0x3063b7;};'use strict';var VoicePrefixEvents=require(_0x1a10('0x0'));var events=[_0x1a10('0x1'),'remove',_0x1a10('0x2')];function createListener(_0x1c42d9,_0x522253){return function(_0x9e0102){_0x522253[_0x1a10('0x3')](_0x1c42d9,_0x9e0102);};}function removeListener(_0x51baf6,_0x205faf){return function(){VoicePrefixEvents[_0x1a10('0x4')](_0x51baf6,_0x205faf);};}exports[_0x1a10('0x5')]=function(_0x1a9d22){for(var _0x2eb3c8=0x0,_0x2b95f3=events['length'];_0x2eb3c8<_0x2b95f3;_0x2eb3c8++){var _0x4f0cd4=events[_0x2eb3c8];var _0x3c90fa=createListener(_0x1a10('0x6')+_0x4f0cd4,_0x1a9d22);VoicePrefixEvents['on'](_0x4f0cd4,_0x3c90fa);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index 3389120..3c7991e 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(_0x4f6c68,_0xb423f0){var _0x4dbe3c=function(_0x30a1e4){while(--_0x30a1e4){_0x4f6c68['push'](_0x4f6c68['shift']());}};_0x4dbe3c(++_0xb423f0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0xa9e0[_0x34bc30];return _0x5706de;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/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 _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(_0xed40c9,_0x2539d8){var _0x3b5d78=function(_0x1df8cf){while(--_0x1df8cf){_0xed40c9['push'](_0xed40c9['shift']());}};_0x3b5d78(++_0x2539d8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0xa9e0[_0x5783f4];return _0x28e380;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/hoppers',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/hopper_finals',auth['isAuthenticated'](),controller['getHopperFinals']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getTeams']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['get'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x8')]('/:id/blacklists',auth[_0x0a9e('0xd')](),controller['getBlackLists']);router[_0x0a9e('0x18')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x18')](_0x0a9e('0x1a'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x18')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router[_0x0a9e('0x18')]('/:id/users',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);router['post'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller['addLists']);router[_0x0a9e('0x18')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x22')]);router['delete']('/:id/teams',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router[_0x0a9e('0x21')](_0x0a9e('0x12'),auth['isAuthenticated'](),controller[_0x0a9e('0x24')]);router['delete'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x25')]);router[_0x0a9e('0x21')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x26')]);module[_0x0a9e('0x27')]=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index 1bafd2a..4b0133e 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 _0xc266=['#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','#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','mandatoryDisposition','sequelize','exports','STRING','ENUM','outbound','inbound','default','fewestcalls','random','rrmemory','wrandom','rrordered','setDataValue','strategy','type','getDataValue','preview','roundrobin','INTEGER','yes','once','join','periodic_announce','split','joinempty','leavewhenempty','BOOLEAN','acw','wrapuptime','power','predictive','progressive','Dial\x20Method.','Max\x209999\x20channels,\x200\x20means\x20unlimited.','UNSIGNED','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','dropRate','Only\x20for\x20predictive\x20method.','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','ASC','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)'];(function(_0x3ce14c,_0xe4e001){var _0x5df5a4=function(_0x324718){while(--_0x324718){_0x3ce14c['push'](_0x3ce14c['shift']());}};_0x5df5a4(++_0xe4e001);}(_0xc266,0x147));var _0x6c26=function(_0x49a6be,_0x287b5b){_0x49a6be=_0x49a6be-0x0;var _0x529d4d=_0xc266[_0x49a6be];return _0x529d4d;};'use strict';var Sequelize=require(_0x6c26('0x0'));module[_0x6c26('0x1')]={'name':{'type':Sequelize[_0x6c26('0x2')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x6c26('0x3')]('inbound',_0x6c26('0x4')),'allowNull':![],'defaultValue':_0x6c26('0x5')},'musiconhold':{'type':Sequelize[_0x6c26('0x2')],'defaultValue':_0x6c26('0x6')},'announce':{'type':Sequelize[_0x6c26('0x2')],'defaultValue':''},'strategy':{'type':Sequelize[_0x6c26('0x3')]('rr','ringall','leastrecent',_0x6c26('0x7'),_0x6c26('0x8'),_0x6c26('0x9'),'linear',_0x6c26('0xa'),_0x6c26('0xb')),'allowNull':![],'defaultValue':'ringall','set':function(_0x4d166e){this[_0x6c26('0xc')](_0x6c26('0xd'),_0x4d166e?_0x4d166e:_0x6c26('0x9'));},'get':function(){var _0x5a37b7=this['getDataValue'](_0x6c26('0xe'));var _0x1b6105=this[_0x6c26('0xf')]('dialMethod');var _0x381291=this['getDataValue'](_0x6c26('0xd'));if(_0x5a37b7==='outbound'){if(_0x1b6105===_0x6c26('0x10')){return null;}if(_0x1b6105==='booked'&&![_0x6c26('0x9'),_0x6c26('0x11')]['includes'](_0x381291)){this[_0x6c26('0xc')](_0x6c26('0xd'),_0x6c26('0x9'));}}return _0x381291;}},'servicelevel':{'type':Sequelize[_0x6c26('0x12')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x6c26('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x6c26('0x12')](0xb)},'timeout':{'type':Sequelize[_0x6c26('0x12')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x6c26('0x12')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x6c26('0x2')]},'weight':{'type':Sequelize[_0x6c26('0x12')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x6c26('0x3')](_0x6c26('0x13'),'no'),'defaultValue':_0x6c26('0x13')},'autopause':{'type':Sequelize[_0x6c26('0x3')](_0x6c26('0x13'),'no','all'),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x6c26('0x12')](0xb)},'autopausebusy':{'type':Sequelize[_0x6c26('0x3')]('yes','no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize['ENUM'](_0x6c26('0x13'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x6c26('0x12')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize['ENUM'](_0x6c26('0x13'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize['ENUM'](_0x6c26('0x13'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x6c26('0x3')](_0x6c26('0x13'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x6c26('0x3')]('yes','no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x6c26('0x2')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x6c26('0x2')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x6c26('0x12')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x6c26('0x12')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize['ENUM'](_0x6c26('0x13'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x6c26('0x3')](_0x6c26('0x13'),'no'),'defaultValue':'yes'},'announce_holdtime':{'type':Sequelize['ENUM'](_0x6c26('0x13'),'no',_0x6c26('0x14')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x6c26('0x2')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x6c26('0x3')](_0x6c26('0x13'),'no')},'announce_position_limit':{'type':Sequelize[_0x6c26('0x12')](0xb)},'announce_round_seconds':{'type':Sequelize[_0x6c26('0x3')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x6c26('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x6c26('0x2')]},'queue_youarenext':{'type':Sequelize[_0x6c26('0x2')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x6c26('0x2')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x6c26('0x2')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x6c26('0x2')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x6c26('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x6c26('0x2')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x6c26('0x2')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x6c26('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x6c26('0x2')]},'queue_quantity1':{'type':Sequelize[_0x6c26('0x2')]},'queue_quantity2':{'type':Sequelize[_0x6c26('0x2')]},'queue_periodic_announce':{'type':Sequelize['STRING']},'queue_less_than':{'type':Sequelize['STRING']},'periodic_announce':{'type':Sequelize['TEXT'],'set':function(_0x145a78){this[_0x6c26('0xc')]('periodic_announce',_0x145a78?_0x145a78[_0x6c26('0x15')](','):[]);},'get':function(){return this[_0x6c26('0xf')](_0x6c26('0x16'))?this[_0x6c26('0xf')]('periodic_announce')[_0x6c26('0x17')](','):[];}},'joinempty':{'type':Sequelize['STRING'],'defaultValue':_0x6c26('0x13'),'set':function(_0x1535e2){this[_0x6c26('0xc')]('joinempty',_0x1535e2?_0x1535e2[_0x6c26('0x15')](','):undefined);},'get':function(){return this[_0x6c26('0xf')](_0x6c26('0x18'))?this[_0x6c26('0xf')]('joinempty')[_0x6c26('0x17')](','):undefined;}},'leavewhenempty':{'type':Sequelize['STRING'],'defaultValue':'no','set':function(_0x4a3c89){this[_0x6c26('0xc')](_0x6c26('0x19'),_0x4a3c89?_0x4a3c89[_0x6c26('0x15')](','):undefined);},'get':function(){return this[_0x6c26('0xf')](_0x6c26('0x19'))?this['getDataValue'](_0x6c26('0x19'))[_0x6c26('0x17')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x6c26('0x3')](_0x6c26('0x13'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x6c26('0x3')]('yes','no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x6c26('0x12')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x6c26('0x3')](_0x6c26('0x13'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x6c26('0x2')]},'description':{'type':Sequelize[_0x6c26('0x2')]},'acw':{'type':Sequelize[_0x6c26('0x1a')],'defaultValue':0x0,'set':function(_0x397fb4){this[_0x6c26('0xc')](_0x6c26('0x1b'),_0x397fb4);if(_0x397fb4){if(this[_0x6c26('0xf')](_0x6c26('0x1c'))<0x2){this[_0x6c26('0xc')](_0x6c26('0x1c'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0x6c26('0x12')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x6c26('0x1a')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'dialMethod':{'type':Sequelize[_0x6c26('0x3')]('preview','progressive',_0x6c26('0x1d'),_0x6c26('0x1e'),'booked'),'defaultValue':_0x6c26('0x1f'),'comment':_0x6c26('0x20')},'dialLimitChannel':{'type':Sequelize[_0x6c26('0x12')](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x6c26('0x21')},'dialLimitQueue':{'type':Sequelize['INTEGER'](0x4)[_0x6c26('0x22')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x6c26('0x23')},'dialPowerLevel':{'type':Sequelize[_0x6c26('0x24')](0x2)['UNSIGNED'],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x6c26('0x25')},'dialPredictiveOptimization':{'type':Sequelize[_0x6c26('0x3')]('agentBusyFactor',_0x6c26('0x26')),'defaultValue':_0x6c26('0x26'),'comment':_0x6c26('0x27')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x6c26('0x24')](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x6c26('0x28')},'dialPredictiveInterval':{'type':Sequelize['INTEGER'](0x3)[_0x6c26('0x22')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':'Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)'},'dialOriginateCallerIdName':{'type':Sequelize[_0x6c26('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x6c26('0x2')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)[_0x6c26('0x22')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x6c26('0x29')},'dialQueueOptions':{'type':Sequelize['STRING'],'defaultValue':'tTxX','comment':_0x6c26('0x2a')},'dialQueueTimeout':{'type':Sequelize[_0x6c26('0x12')](0x3)[_0x6c26('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x6c26('0x2b')},'dialQueueProject':{'type':Sequelize[_0x6c26('0x2')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialCongestionMaxRetry':{'type':Sequelize[_0x6c26('0x12')](0x3)[_0x6c26('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x6c26('0x2c')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x6c26('0x12')](0x5)[_0x6c26('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize[_0x6c26('0x12')](0x3)[_0x6c26('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x6c26('0x2d')},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x6c26('0x2e')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x6c26('0x12')](0x3)[_0x6c26('0x22')],'defaultValue':0x3,'comment':_0x6c26('0x2f')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x6c26('0x12')](0x5)[_0x6c26('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x6c26('0x30')},'dialGlobalMaxRetry':{'type':Sequelize[_0x6c26('0x12')](0x3)[_0x6c26('0x22')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x6c26('0x31')},'dialTimezone':{'type':Sequelize[_0x6c26('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x6c26('0x2')],'defaultValue':_0x6c26('0x32')},'dialPrefix':{'type':Sequelize[_0x6c26('0x2')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x6c26('0x3')](_0x6c26('0x33'),_0x6c26('0x34'),'onlyIfOpen'),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0x6c26('0x1a')],'defaultValue':0x0,'comment':_0x6c26('0x35')},'dialAMDInitialSilence':{'type':Sequelize[_0x6c26('0x12')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x6c26('0x36')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)[_0x6c26('0x22')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x6c26('0x37')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x6c26('0x12')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x6c26('0x12')](0x9)[_0x6c26('0x22')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x6c26('0x38')},'dialAMDMinWordLength':{'type':Sequelize[_0x6c26('0x12')](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x6c26('0x39')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0x6c26('0x22')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x6c26('0x3a')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0x6c26('0x22')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x6c26('0x3b')},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x6c26('0x22')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x6c26('0x3c')},'dialRecallMeTimeout':{'type':Sequelize[_0x6c26('0x12')](0x5)[_0x6c26('0x22')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x6c26('0x3d')},'dialRecallInQueue':{'type':Sequelize[_0x6c26('0x1a')],'defaultValue':0x0,'comment':_0x6c26('0x3e')},'dialOrderByScheduledAt':{'type':Sequelize[_0x6c26('0x3')](_0x6c26('0x3f'),_0x6c26('0x40')),'defaultValue':_0x6c26('0x3f')},'dialQueueProject2':{'type':Sequelize[_0x6c26('0x2')],'comment':_0x6c26('0x41')},'dialAgiAfterHangupClient':{'type':Sequelize[_0x6c26('0x1a')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x6c26('0x12')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x6c26('0x42')},'dialCutDigit':{'type':Sequelize[_0x6c26('0x12')](0x3)[_0x6c26('0x22')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x6c26('0x43')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x6c26('0x12')](0x3)[_0x6c26('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x6c26('0x44')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x6c26('0x12')](0x5)[_0x6c26('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x6c26('0x45')},'dialDropMaxRetry':{'type':Sequelize[_0x6c26('0x12')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize[_0x6c26('0x12')](0x5)[_0x6c26('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x6c26('0x46')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x6c26('0x12')](0x3)[_0x6c26('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x6c26('0x47')},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x6c26('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x6c26('0x48')},'dialMachineMaxRetry':{'type':Sequelize[_0x6c26('0x12')](0x3)[_0x6c26('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x6c26('0x49')},'dialMachineRetryFrequency':{'type':Sequelize[_0x6c26('0x12')](0x5)[_0x6c26('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x6c26('0x12')](0x3)[_0x6c26('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x6c26('0x4a')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x6c26('0x12')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x6c26('0x4b')},'mandatoryDispositionPauseId':{'type':Sequelize[_0x6c26('0x12')],'allowNull':!![],'comment':_0x6c26('0x4c')},'mandatoryDisposition':{'type':Sequelize[_0x6c26('0x1a')],'defaultValue':![],'comment':_0x6c26('0x4d'),'set':function(_0x383f0c){if(!_0x383f0c)this[_0x6c26('0xc')]('mandatoryDispositionPauseId',null);this[_0x6c26('0xc')](_0x6c26('0x4e'),_0x383f0c);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x6c26('0x12')](0x3)['UNSIGNED'],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x6c26('0x12')](0x3)[_0x6c26('0x22')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0x6c26('0x1a')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0x6c26('0x12')](0x3)[_0x6c26('0x22')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xddaf=['dialMethod','preview','booked','includes','INTEGER','yes','all','once','TEXT','periodic_announce','split','joinempty','join','leavewhenempty','acw','wrapuptime','Active/Disactive\x20Campaign','power','predictive','progressive','Dial\x20Method.','UNSIGNED','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','dropRate','Only\x20for\x20predictive\x20method.','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','#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','BOOLEAN','Active/Disactive\x20AMD','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','Active/Disactive\x20Recall\x20In\x20Queue','ASC','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDisposition','STRING','name','ENUM','inbound','default','ringall','leastrecent','fewestcalls','random','linear','wrandom','rrordered','setDataValue','strategy','rrmemory','getDataValue'];(function(_0x13c640,_0x1491a1){var _0x522903=function(_0x3db6f0){while(--_0x3db6f0){_0x13c640['push'](_0x13c640['shift']());}};_0x522903(++_0x1491a1);}(_0xddaf,0xe0));var _0xfdda=function(_0x1c4056,_0x52cd96){_0x1c4056=_0x1c4056-0x0;var _0x31c5b6=_0xddaf[_0x1c4056];return _0x31c5b6;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xfdda('0x0')],'allowNull':![],'unique':_0xfdda('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xfdda('0x2')](_0xfdda('0x3'),'outbound'),'allowNull':![],'defaultValue':'inbound'},'musiconhold':{'type':Sequelize[_0xfdda('0x0')],'defaultValue':_0xfdda('0x4')},'announce':{'type':Sequelize[_0xfdda('0x0')],'defaultValue':''},'strategy':{'type':Sequelize['ENUM']('rr',_0xfdda('0x5'),_0xfdda('0x6'),_0xfdda('0x7'),_0xfdda('0x8'),'rrmemory',_0xfdda('0x9'),_0xfdda('0xa'),_0xfdda('0xb')),'allowNull':![],'defaultValue':'ringall','set':function(_0x237383){this[_0xfdda('0xc')](_0xfdda('0xd'),_0x237383?_0x237383:_0xfdda('0xe'));},'get':function(){var _0x1a9795=this[_0xfdda('0xf')]('type');var _0xf14f1d=this[_0xfdda('0xf')](_0xfdda('0x10'));var _0x2cfc58=this['getDataValue'](_0xfdda('0xd'));if(_0x1a9795==='outbound'){if(_0xf14f1d===_0xfdda('0x11')){return null;}if(_0xf14f1d===_0xfdda('0x12')&&![_0xfdda('0xe'),'roundrobin'][_0xfdda('0x13')](_0x2cfc58)){this[_0xfdda('0xc')]('strategy','rrmemory');}}return _0x2cfc58;}},'servicelevel':{'type':Sequelize[_0xfdda('0x14')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0xfdda('0x0')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize['INTEGER'](0xb)},'timeout':{'type':Sequelize[_0xfdda('0x14')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0xfdda('0x14')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0xfdda('0x0')]},'weight':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize['ENUM'](_0xfdda('0x15'),'no'),'defaultValue':'yes'},'autopause':{'type':Sequelize['ENUM'](_0xfdda('0x15'),'no',_0xfdda('0x16')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize['INTEGER'](0xb)},'autopausebusy':{'type':Sequelize['ENUM'](_0xfdda('0x15'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0xfdda('0x14')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize['ENUM'](_0xfdda('0x15'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0xfdda('0x2')](_0xfdda('0x15'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0xfdda('0x2')](_0xfdda('0x15'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize['ENUM'](_0xfdda('0x15'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0xfdda('0x0')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0xfdda('0x0')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0xfdda('0x14')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0xfdda('0x14')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0xfdda('0x14')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0xfdda('0x2')](_0xfdda('0x15'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0xfdda('0x2')]('yes','no'),'defaultValue':_0xfdda('0x15')},'announce_holdtime':{'type':Sequelize[_0xfdda('0x2')](_0xfdda('0x15'),'no',_0xfdda('0x17')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0xfdda('0x0')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0xfdda('0x2')](_0xfdda('0x15'),'no')},'announce_position_limit':{'type':Sequelize[_0xfdda('0x14')](0xb)},'announce_round_seconds':{'type':Sequelize[_0xfdda('0x2')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0xfdda('0x0')],'defaultValue':''},'monitor_type':{'type':Sequelize['STRING']},'queue_youarenext':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0xfdda('0x0')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0xfdda('0x0')],'defaultValue':null},'queue_holdtime':{'type':Sequelize['STRING'],'defaultValue':null},'queue_minute':{'type':Sequelize[_0xfdda('0x0')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize['STRING'],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0xfdda('0x0')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0xfdda('0x0')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0xfdda('0x0')]},'queue_quantity1':{'type':Sequelize[_0xfdda('0x0')]},'queue_quantity2':{'type':Sequelize[_0xfdda('0x0')]},'queue_periodic_announce':{'type':Sequelize[_0xfdda('0x0')]},'queue_less_than':{'type':Sequelize[_0xfdda('0x0')]},'periodic_announce':{'type':Sequelize[_0xfdda('0x18')],'set':function(_0x1e62c4){this[_0xfdda('0xc')](_0xfdda('0x19'),_0x1e62c4?_0x1e62c4['join'](','):[]);},'get':function(){return this[_0xfdda('0xf')](_0xfdda('0x19'))?this[_0xfdda('0xf')](_0xfdda('0x19'))[_0xfdda('0x1a')](','):[];}},'joinempty':{'type':Sequelize[_0xfdda('0x0')],'defaultValue':_0xfdda('0x15'),'set':function(_0x46d377){this[_0xfdda('0xc')](_0xfdda('0x1b'),_0x46d377?_0x46d377[_0xfdda('0x1c')](','):undefined);},'get':function(){return this['getDataValue'](_0xfdda('0x1b'))?this[_0xfdda('0xf')]('joinempty')[_0xfdda('0x1a')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0xfdda('0x0')],'defaultValue':'no','set':function(_0x5f4d6b){this['setDataValue'](_0xfdda('0x1d'),_0x5f4d6b?_0x5f4d6b[_0xfdda('0x1c')](','):undefined);},'get':function(){return this['getDataValue'](_0xfdda('0x1d'))?this[_0xfdda('0xf')](_0xfdda('0x1d'))[_0xfdda('0x1a')](','):undefined;}},'reportholdtime':{'type':Sequelize['ENUM'](_0xfdda('0x15'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0xfdda('0x2')](_0xfdda('0x15'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0xfdda('0x14')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0xfdda('0x2')](_0xfdda('0x15'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0xfdda('0x0')]},'description':{'type':Sequelize[_0xfdda('0x0')]},'acw':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'set':function(_0x82aef3){this['setDataValue'](_0xfdda('0x1e'),_0x82aef3);if(_0x82aef3){if(this[_0xfdda('0xf')]('wrapuptime')<0x2){this[_0xfdda('0xc')](_0xfdda('0x1f'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0xfdda('0x14')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0xfdda('0x20')},'dialMethod':{'type':Sequelize['ENUM'](_0xfdda('0x11'),'progressive',_0xfdda('0x21'),_0xfdda('0x22'),'booked'),'defaultValue':_0xfdda('0x23'),'comment':_0xfdda('0x24')},'dialLimitChannel':{'type':Sequelize[_0xfdda('0x14')](0x4)[_0xfdda('0x25')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20channels,\x200\x20means\x20unlimited.'},'dialLimitQueue':{'type':Sequelize['INTEGER'](0x4)[_0xfdda('0x25')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xfdda('0x26')},'dialPowerLevel':{'type':Sequelize[_0xfdda('0x27')](0x2)[_0xfdda('0x25')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':'Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).'},'dialPredictiveOptimization':{'type':Sequelize['ENUM']('agentBusyFactor',_0xfdda('0x28')),'defaultValue':'dropRate','comment':_0xfdda('0x29')},'dialPredictiveOptimizationPercentage':{'type':Sequelize['FLOAT'](0x2)[_0xfdda('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0xfdda('0x2a')},'dialPredictiveInterval':{'type':Sequelize[_0xfdda('0x14')](0x3)[_0xfdda('0x25')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':'Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)'},'dialOriginateCallerIdName':{'type':Sequelize[_0xfdda('0x0')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xfdda('0x0')]},'dialOriginateTimeout':{'type':Sequelize[_0xfdda('0x14')](0x3)[_0xfdda('0x25')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xfdda('0x2b')},'dialQueueOptions':{'type':Sequelize['STRING'],'defaultValue':'tTxX','comment':_0xfdda('0x2c')},'dialQueueTimeout':{'type':Sequelize[_0xfdda('0x14')](0x3)[_0xfdda('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xfdda('0x2d')},'dialQueueProject':{'type':Sequelize[_0xfdda('0x0')],'comment':_0xfdda('0x2e')},'dialCongestionMaxRetry':{'type':Sequelize[_0xfdda('0x14')](0x3)[_0xfdda('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0xfdda('0x14')](0x5)[_0xfdda('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xfdda('0x2f')},'dialBusyMaxRetry':{'type':Sequelize[_0xfdda('0x14')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xfdda('0x30')},'dialBusyRetryFrequency':{'type':Sequelize[_0xfdda('0x14')](0x5)[_0xfdda('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xfdda('0x14')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0xfdda('0x31')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xfdda('0x14')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xfdda('0x32')},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xfdda('0x33')},'dialTimezone':{'type':Sequelize[_0xfdda('0x0')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xfdda('0x0')],'defaultValue':_0xfdda('0x34')},'dialPrefix':{'type':Sequelize[_0xfdda('0x0')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0xfdda('0x2')](_0xfdda('0x35'),'never','onlyIfOpen'),'defaultValue':_0xfdda('0x35')},'dialAMDActive':{'type':Sequelize[_0xfdda('0x36')],'defaultValue':0x0,'comment':_0xfdda('0x37')},'dialAMDInitialSilence':{'type':Sequelize[_0xfdda('0x14')](0x9)[_0xfdda('0x25')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize[_0xfdda('0x14')](0x9)[_0xfdda('0x25')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xfdda('0x38')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xfdda('0x14')](0x9)[_0xfdda('0x25')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xfdda('0x39')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xfdda('0x14')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xfdda('0x3a')},'dialAMDMinWordLength':{'type':Sequelize[_0xfdda('0x14')](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xfdda('0x3b')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xfdda('0x14')](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xfdda('0x3c')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xfdda('0x14')](0x9)[_0xfdda('0x25')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xfdda('0x3d')},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)[_0xfdda('0x25')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xfdda('0x3e')},'dialRecallMeTimeout':{'type':Sequelize[_0xfdda('0x14')](0x5)[_0xfdda('0x25')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':'#RecallMe\x20Timeout\x20(min:1)'},'dialRecallInQueue':{'type':Sequelize[_0xfdda('0x36')],'defaultValue':0x0,'comment':_0xfdda('0x3f')},'dialOrderByScheduledAt':{'type':Sequelize['ENUM']('DESC',_0xfdda('0x40')),'defaultValue':_0xfdda('0x41')},'dialQueueProject2':{'type':Sequelize[_0xfdda('0x0')],'comment':_0xfdda('0x2e')},'dialAgiAfterHangupClient':{'type':Sequelize[_0xfdda('0x36')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xfdda('0x14')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xfdda('0x42')},'dialCutDigit':{'type':Sequelize[_0xfdda('0x14')](0x3)[_0xfdda('0x25')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xfdda('0x43')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xfdda('0x14')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xfdda('0x44')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xfdda('0x14')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xfdda('0x45')},'dialDropMaxRetry':{'type':Sequelize[_0xfdda('0x14')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xfdda('0x46')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xfdda('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xfdda('0x47')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xfdda('0x14')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xfdda('0x48')},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xfdda('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xfdda('0x49')},'dialMachineMaxRetry':{'type':Sequelize[_0xfdda('0x14')](0x3)[_0xfdda('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xfdda('0x4a')},'dialMachineRetryFrequency':{'type':Sequelize[_0xfdda('0x14')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xfdda('0x4b')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xfdda('0x14')](0x3)[_0xfdda('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xfdda('0x4c')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xfdda('0x14')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xfdda('0x4d')},'mandatoryDispositionPauseId':{'type':Sequelize[_0xfdda('0x14')],'allowNull':!![],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xfdda('0x36')],'defaultValue':![],'comment':_0xfdda('0x4e'),'set':function(_0xb1811a){if(!_0xb1811a)this[_0xfdda('0xc')]('mandatoryDispositionPauseId',null);this[_0xfdda('0xc')](_0xfdda('0x4f'),_0xb1811a);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0xfdda('0x14')](0x3)['UNSIGNED'],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize['INTEGER'](0x3)[_0xfdda('0x25')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0xfdda('0x36')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0xfdda('0x14')](0x3)[_0xfdda('0x25')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index 23032a0..81f7c92 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 _0x9ab0=['cm_hopper_black','NOW()','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','register','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','VoiceQueues','inbound','QueueCampaigns','outbound','ignore','map','value','includes','type','find','name','UserProfileResource','stack','send','index','VoiceQueue','rawAttributes','fieldName','key','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filters','pick','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','keys','catch','create','body','user','role','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','omit','createdAt','updatedAt','UserProfileSection','getHoppers','findOne','CmHopper','VoiceQueueId','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','addTeams','teams','User','Agents','voicePause','flatMap','forEach','penalty','sequelize','transaction','each','TeamVoiceQueue','UserVoiceQueue','findOrCreate','UserVoiceQueueRt','upsert','isNil','interface','format','SIP/%s','emit','removeTeams','Team','ids','field','tq.TeamId','from','join','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','all','union','compact','isEmpty','removeAgents','userVoiceQueue:remove','addAgents','userVoiceQueue:save','online','getAgents','getMembers','getLists','CmList','YYYY-MM-DD\x20HH:mm:ss','dialCheckDuplicateType','always','into','cm_hopper','fromQuery','scheduledAt','ContactId','phone','CmListId','cm_contacts','deletedAt\x20IS\x20NULL','phone\x20IS\x20NOT\x20NULL','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','phone\x20NOT\x20IN\x20(?)','select','COALESCE(phone,\x27\x27)','onlyIfOpen','insert','ListId','ListId\x20=\x20?','cm_hopper_additional_phones','CmHopperId','ci.item','cm_contact_has_items','h.ContactId=ci.CmContactId','h.scheduledat=?','ci.ItemClass=?','PHONE','removeLists','getBlackLists','addBlackLists','spread'];(function(_0x15a93a,_0x4822e4){var _0x592780=function(_0x588d75){while(--_0x588d75){_0x15a93a['push'](_0x15a93a['shift']());}};_0x592780(++_0x4822e4);}(_0x9ab0,0x195));var _0x09ab=function(_0x2a00a8,_0x672dfd){_0x2a00a8=_0x2a00a8-0x0;var _0x2aa8ff=_0x9ab0[_0x2a00a8];return _0x2aa8ff;};'use strict';var emlformat=require(_0x09ab('0x0'));var rimraf=require(_0x09ab('0x1'));var zipdir=require(_0x09ab('0x2'));var jsonpatch=require(_0x09ab('0x3'));var rp=require(_0x09ab('0x4'));var moment=require(_0x09ab('0x5'));var BPromise=require(_0x09ab('0x6'));var Mustache=require(_0x09ab('0x7'));var util=require(_0x09ab('0x8'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x09ab('0x9'));var fs=require('fs');var fs_extra=require(_0x09ab('0xa'));var _=require(_0x09ab('0xb'));var squel=require(_0x09ab('0xc'));var crypto=require(_0x09ab('0xd'));var jsforce=require(_0x09ab('0xe'));var deskjs=require(_0x09ab('0xf'));var toCsv=require(_0x09ab('0x10'));var querystring=require(_0x09ab('0x11'));var Papa=require('papaparse');var Redis=require(_0x09ab('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x09ab('0x13'));var as=require(_0x09ab('0x14'));var hardwareService=require(_0x09ab('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x09ab('0x16'));var config=require(_0x09ab('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x09ab('0x18')]=_[_0x09ab('0x19')](config[_0x09ab('0x18')],{'host':_0x09ab('0x1a'),'port':0x18eb});var socket=require(_0x09ab('0x1b'))(new Redis(config[_0x09ab('0x18')]));require(_0x09ab('0x1c'))[_0x09ab('0x1d')](socket);function respondWithStatusCode(_0x10971,_0x1d4354){_0x1d4354=_0x1d4354||0xcc;return function(_0x2a16e4){if(_0x2a16e4){return _0x10971[_0x09ab('0x1e')](_0x1d4354);}return _0x10971['status'](_0x1d4354)[_0x09ab('0x1f')]();};}function respondWithResult(_0x3ff3b2,_0x3aa4f6){_0x3aa4f6=_0x3aa4f6||0xc8;return function(_0x4a165b){if(_0x4a165b){return _0x3ff3b2[_0x09ab('0x20')](_0x3aa4f6)[_0x09ab('0x21')](_0x4a165b);}};}function respondWithFilteredResult(_0x2f75a8,_0x574b0f){return function(_0x3d77d6){if(_0x3d77d6){var _0x3f86c4=typeof _0x574b0f[_0x09ab('0x22')]===_0x09ab('0x23')&&typeof _0x574b0f[_0x09ab('0x24')]===_0x09ab('0x23');var _0x5c053b=_0x3d77d6[_0x09ab('0x25')];var _0x437ffc=_0x3f86c4?0x0:_0x574b0f['offset'];var _0xddb65d=_0x3f86c4?_0x3d77d6[_0x09ab('0x25')]:_0x574b0f[_0x09ab('0x22')]+_0x574b0f[_0x09ab('0x24')];var _0x403d30;if(_0xddb65d>=_0x5c053b){_0xddb65d=_0x5c053b;_0x403d30=0xc8;}else{_0x403d30=0xce;}_0x2f75a8[_0x09ab('0x20')](_0x403d30);return _0x2f75a8[_0x09ab('0x26')](_0x09ab('0x27'),_0x437ffc+'-'+_0xddb65d+'/'+_0x5c053b)['json'](_0x3d77d6);}return null;};}function patchUpdates(_0x30304f){return function(_0x454a95){try{jsonpatch[_0x09ab('0x28')](_0x454a95,_0x30304f,!![]);}catch(_0x33e2d8){return BPromise[_0x09ab('0x29')](_0x33e2d8);}return _0x454a95[_0x09ab('0x2a')]();};}function saveUpdates(_0x597beb,_0x414277){return function(_0x26d939){if(_0x26d939){return _0x26d939[_0x09ab('0x2b')](_0x597beb)[_0x09ab('0x2c')](function(_0x293e54){return _0x293e54;});}return null;};}function removeEntity(_0x4c776b,_0x50a95b){return function(_0x21ed17){if(_0x21ed17){return _0x21ed17[_0x09ab('0x2d')]()['then'](function(){var _0x429b1b=_0x21ed17[_0x09ab('0x2e')]({'plain':!![]});var _0x22d3dd=[{'name':_0x09ab('0x2f'),'value':_0x09ab('0x30'),'ignore':![]},{'name':_0x09ab('0x31'),'value':_0x09ab('0x32'),'ignore':![]}];var _0xe1e83d=_(_0x22d3dd)['filter'](_0x09ab('0x33'))[_0x09ab('0x34')](_0x09ab('0x35'))[_0x09ab('0x35')]();if(_[_0x09ab('0x36')](_0xe1e83d,_0x429b1b[_0x09ab('0x37')])){return;}var _0x2dae4d=_[_0x09ab('0x38')](_0x22d3dd,[_0x09ab('0x35'),_0x429b1b[_0x09ab('0x37')]])[_0x09ab('0x39')];return db[_0x09ab('0x3a')][_0x09ab('0x2d')]({'where':{'type':_0x2dae4d,'resourceId':_0x429b1b['id']}})['then'](function(){return _0x21ed17;});})[_0x09ab('0x2c')](function(){_0x4c776b[_0x09ab('0x20')](0xcc)[_0x09ab('0x1f')]();});}};}function handleEntityNotFound(_0x28e630,_0x3e2930){return function(_0x11bf0d){if(!_0x11bf0d){_0x28e630[_0x09ab('0x1e')](0x194);}return _0x11bf0d;};}function handleError(_0x388454,_0x1497d2){_0x1497d2=_0x1497d2||0x1f4;return function(_0x5a43bc){logger['error'](_0x5a43bc[_0x09ab('0x3b')]);if(_0x5a43bc[_0x09ab('0x39')]){delete _0x5a43bc['name'];}_0x388454[_0x09ab('0x20')](_0x1497d2)[_0x09ab('0x3c')](_0x5a43bc);};}exports[_0x09ab('0x3d')]=function(_0x552537,_0x32a14e){var _0x32923f={},_0x2cea85={},_0x527d91={'count':0x0,'rows':[]};var _0x4e908d=_[_0x09ab('0x34')](db[_0x09ab('0x3e')][_0x09ab('0x3f')],function(_0x1bc90e){return{'name':_0x1bc90e[_0x09ab('0x40')],'type':_0x1bc90e['type'][_0x09ab('0x41')]};});_0x2cea85[_0x09ab('0x42')]=_['map'](_0x4e908d,_0x09ab('0x39'));_0x2cea85[_0x09ab('0x43')]=_['keys'](_0x552537['query']);_0x2cea85['filters']=_['intersection'](_0x2cea85[_0x09ab('0x42')],_0x2cea85[_0x09ab('0x43')]);_0x32923f['attributes']=_[_0x09ab('0x44')](_0x2cea85[_0x09ab('0x42')],qs[_0x09ab('0x45')](_0x552537[_0x09ab('0x43')]['fields']));_0x32923f[_0x09ab('0x46')]=_0x32923f[_0x09ab('0x46')][_0x09ab('0x47')]?_0x32923f[_0x09ab('0x46')]:_0x2cea85[_0x09ab('0x42')];if(!_0x552537[_0x09ab('0x43')][_0x09ab('0x48')](_0x09ab('0x49'))){_0x32923f[_0x09ab('0x24')]=qs[_0x09ab('0x24')](_0x552537[_0x09ab('0x43')][_0x09ab('0x24')]);_0x32923f['offset']=qs[_0x09ab('0x22')](_0x552537[_0x09ab('0x43')][_0x09ab('0x22')]);}_0x32923f[_0x09ab('0x4a')]=qs[_0x09ab('0x4b')](_0x552537['query'][_0x09ab('0x4b')]);_0x32923f['where']=qs[_0x09ab('0x4c')](_[_0x09ab('0x4d')](_0x552537[_0x09ab('0x43')],_0x2cea85[_0x09ab('0x4c')]),_0x4e908d);if(_0x552537[_0x09ab('0x43')]['filter']){_0x32923f[_0x09ab('0x4e')]=_[_0x09ab('0x4f')](_0x32923f[_0x09ab('0x4e')],{'$or':_[_0x09ab('0x34')](_0x4e908d,function(_0x2ab35c){if(_0x2ab35c[_0x09ab('0x37')]!==_0x09ab('0x50')){var _0x75feeb={};_0x75feeb[_0x2ab35c[_0x09ab('0x39')]]={'$like':'%'+_0x552537[_0x09ab('0x43')][_0x09ab('0x51')]+'%'};return _0x75feeb;}})});}_0x32923f=_[_0x09ab('0x4f')]({},_0x32923f,_0x552537[_0x09ab('0x52')]);var _0x2a88a3={'where':_0x32923f[_0x09ab('0x4e')]};return db[_0x09ab('0x3e')][_0x09ab('0x25')](_0x2a88a3)[_0x09ab('0x2c')](function(_0x386c26){_0x527d91['count']=_0x386c26;if(_0x552537['query'][_0x09ab('0x53')]){_0x32923f[_0x09ab('0x54')]=[{'all':!![]}];}return db['VoiceQueue'][_0x09ab('0x55')](_0x32923f);})[_0x09ab('0x2c')](function(_0x5de20e){_0x527d91[_0x09ab('0x56')]=_0x5de20e;return _0x527d91;})[_0x09ab('0x2c')](respondWithFilteredResult(_0x32a14e,_0x32923f))['catch'](handleError(_0x32a14e,null));};exports[_0x09ab('0x57')]=function(_0x29d62a,_0xe010d2){var _0x142472={'raw':![],'where':{'id':_0x29d62a[_0x09ab('0x58')]['id']}},_0x3100d3={};_0x3100d3[_0x09ab('0x42')]=_[_0x09ab('0x59')](db['VoiceQueue'][_0x09ab('0x3f')]);_0x3100d3[_0x09ab('0x43')]=_[_0x09ab('0x59')](_0x29d62a['query']);_0x3100d3[_0x09ab('0x4c')]=_[_0x09ab('0x44')](_0x3100d3[_0x09ab('0x42')],_0x3100d3[_0x09ab('0x43')]);_0x142472['attributes']=_['intersection'](_0x3100d3['model'],qs['fields'](_0x29d62a[_0x09ab('0x43')][_0x09ab('0x45')]));_0x142472[_0x09ab('0x46')]=_0x142472['attributes'][_0x09ab('0x47')]?_0x142472[_0x09ab('0x46')]:_0x3100d3['model'];if(_0x29d62a[_0x09ab('0x43')][_0x09ab('0x53')]){_0x142472[_0x09ab('0x54')]=[{'all':!![]}];}_0x142472=_[_0x09ab('0x4f')]({},_0x142472,_0x29d62a['options']);return db[_0x09ab('0x3e')][_0x09ab('0x38')](_0x142472)[_0x09ab('0x2c')](handleEntityNotFound(_0xe010d2,null))[_0x09ab('0x2c')](respondWithResult(_0xe010d2,null))[_0x09ab('0x5a')](handleError(_0xe010d2,null));};exports['create']=function(_0x3a3ae3,_0x14f64d){return db[_0x09ab('0x3e')][_0x09ab('0x5b')](_0x3a3ae3[_0x09ab('0x5c')],{})[_0x09ab('0x2c')](function(_0x7a296b){var _0x2162f8=_0x3a3ae3[_0x09ab('0x5d')][_0x09ab('0x2e')]({'plain':!![]});if(!_0x2162f8)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2162f8[_0x09ab('0x5e')]===_0x09ab('0x5d')){var _0x1953b0=_0x7a296b[_0x09ab('0x2e')]({'plain':!![]});var _0x5237b8=[{'name':_0x09ab('0x2f'),'value':_0x09ab('0x30')},{'name':_0x09ab('0x31'),'value':_0x09ab('0x32')}];var _0x587b1d=_[_0x09ab('0x38')](_0x5237b8,[_0x09ab('0x35'),_0x1953b0['type']])[_0x09ab('0x39')];return db['UserProfileSection']['find']({'where':{'name':_0x587b1d,'userProfileId':_0x2162f8[_0x09ab('0x5f')]},'raw':!![]})[_0x09ab('0x2c')](function(_0x2612b3){if(_0x2612b3&&_0x2612b3['autoAssociation']===0x0){return db['UserProfileResource'][_0x09ab('0x5b')]({'name':_0x1953b0[_0x09ab('0x39')],'resourceId':_0x1953b0['id'],'type':_0x2612b3['name'],'sectionId':_0x2612b3['id']},{})[_0x09ab('0x2c')](function(){return _0x7a296b;});}else{return _0x7a296b;}})[_0x09ab('0x5a')](function(_0xd58017){logger[_0x09ab('0x60')](_0x09ab('0x61'),_0xd58017);throw _0xd58017;});}return _0x7a296b;})[_0x09ab('0x2c')](respondWithResult(_0x14f64d,0xc9))[_0x09ab('0x5a')](handleError(_0x14f64d,null));};exports['clone']=function(_0x2141c5,_0x236737){var _0x3180f8={'where':{'id':_0x2141c5[_0x09ab('0x58')]['id']}},_0x439ccd={};_0x439ccd[_0x09ab('0x42')]=_[_0x09ab('0x59')](db[_0x09ab('0x3e')][_0x09ab('0x3f')]);_0x3180f8[_0x09ab('0x46')]=_['intersection'](_0x439ccd[_0x09ab('0x42')],qs[_0x09ab('0x45')](_0x2141c5[_0x09ab('0x43')]['fields']));_0x3180f8['attributes']=_0x3180f8[_0x09ab('0x46')][_0x09ab('0x47')]?_0x3180f8[_0x09ab('0x46')]:_0x439ccd[_0x09ab('0x42')];if(_0x2141c5[_0x09ab('0x43')]['includeAll']){_0x3180f8[_0x09ab('0x54')]=[{'all':!![]}];}_0x3180f8=_[_0x09ab('0x4f')]({},_0x3180f8,_0x2141c5[_0x09ab('0x52')]);return db[_0x09ab('0x3e')][_0x09ab('0x38')](_0x3180f8)['then'](handleEntityNotFound(_0x236737,null))['then'](function(_0x112e42){if(_0x112e42){var _0x1af53c=_0x112e42[_0x09ab('0x2e')]({'plain':!![]});_0x1af53c=qs[_0x09ab('0x62')](_0x1af53c,['id',_0x09ab('0x63'),_0x09ab('0x64')]);_0x2141c5[_0x09ab('0x5c')]=_['omit'](_0x2141c5[_0x09ab('0x5c')],['id','createdAt',_0x09ab('0x64')]);return db[_0x09ab('0x3e')]['create'](_[_0x09ab('0x4f')](_0x1af53c,_0x2141c5['body']),{'include':_0x2141c5[_0x09ab('0x43')][_0x09ab('0x53')]?[{'all':!![]}]:undefined})[_0x09ab('0x2c')](function(_0x5c1a04){var _0x2564d6=_0x2141c5['user'][_0x09ab('0x2e')]({'plain':!![]});if(!_0x2564d6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2564d6[_0x09ab('0x5e')]===_0x09ab('0x5d')){var _0x345101=_0x5c1a04['get']({'plain':!![]});var _0x4c83d9=[{'name':_0x09ab('0x2f'),'value':_0x09ab('0x30')},{'name':_0x09ab('0x31'),'value':_0x09ab('0x32')}];var _0x558a4d=_['find'](_0x4c83d9,[_0x09ab('0x35'),_0x345101[_0x09ab('0x37')]])[_0x09ab('0x39')];return db[_0x09ab('0x65')][_0x09ab('0x38')]({'where':{'name':_0x558a4d,'userProfileId':_0x2564d6[_0x09ab('0x5f')]},'raw':!![]})[_0x09ab('0x2c')](function(_0x56fdd7){if(_0x56fdd7&&_0x56fdd7['autoAssociation']===0x0){return db[_0x09ab('0x3a')][_0x09ab('0x5b')]({'name':_0x345101[_0x09ab('0x39')],'resourceId':_0x345101['id'],'type':_0x56fdd7[_0x09ab('0x39')],'sectionId':_0x56fdd7['id']},{})['then'](function(){return _0x5c1a04;});}else{return _0x5c1a04;}})['catch'](function(_0x594176){logger[_0x09ab('0x60')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x594176);throw _0x594176;});}return _0x5c1a04;});}})['then'](respondWithResult(_0x236737,0xc9))[_0x09ab('0x5a')](handleError(_0x236737,null));};exports[_0x09ab('0x2b')]=function(_0x175cbe,_0x1a2110){if(_0x175cbe[_0x09ab('0x5c')]['id']){delete _0x175cbe[_0x09ab('0x5c')]['id'];}return db[_0x09ab('0x3e')][_0x09ab('0x38')]({'where':{'id':_0x175cbe[_0x09ab('0x58')]['id']}})['then'](handleEntityNotFound(_0x1a2110,null))[_0x09ab('0x2c')](saveUpdates(_0x175cbe[_0x09ab('0x5c')],null))['then'](respondWithResult(_0x1a2110,null))[_0x09ab('0x5a')](handleError(_0x1a2110,null));};exports['destroy']=function(_0x68d91c,_0x13efc0){return db[_0x09ab('0x3e')]['find']({'where':{'id':_0x68d91c['params']['id']}})['then'](handleEntityNotFound(_0x13efc0,null))[_0x09ab('0x2c')](removeEntity(_0x13efc0,null))[_0x09ab('0x5a')](handleError(_0x13efc0,null));};exports[_0x09ab('0x66')]=function(_0x54348f,_0x2de63a,_0x20e37f){var _0x3f283a={'raw':![],'where':{}};var _0x55b578={};var _0x178b2e={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x09ab('0x67')]({'where':{'id':_0x54348f['params']['id']}})[_0x09ab('0x2c')](handleEntityNotFound(_0x2de63a,null))[_0x09ab('0x2c')](function(_0x37e549){if(_0x37e549){_0x55b578[_0x09ab('0x42')]=_['keys'](db[_0x09ab('0x68')][_0x09ab('0x3f')]);_0x55b578[_0x09ab('0x43')]=_[_0x09ab('0x59')](_0x54348f[_0x09ab('0x43')]);_0x55b578['filters']=_[_0x09ab('0x44')](_0x55b578['model'],_0x55b578[_0x09ab('0x43')]);_0x3f283a[_0x09ab('0x46')]=_['intersection'](_0x55b578['model'],qs[_0x09ab('0x45')](_0x54348f[_0x09ab('0x43')][_0x09ab('0x45')]));_0x3f283a[_0x09ab('0x46')]=_0x3f283a[_0x09ab('0x46')][_0x09ab('0x47')]?_0x3f283a[_0x09ab('0x46')]:_0x55b578[_0x09ab('0x42')];if(!_0x54348f[_0x09ab('0x43')][_0x09ab('0x48')]('nolimit')){_0x3f283a[_0x09ab('0x24')]=qs[_0x09ab('0x24')](_0x54348f[_0x09ab('0x43')][_0x09ab('0x24')]);_0x3f283a['offset']=qs['offset'](_0x54348f['query'][_0x09ab('0x22')]);}_0x3f283a[_0x09ab('0x4a')]=qs['sort'](_0x54348f[_0x09ab('0x43')][_0x09ab('0x4b')]);_0x3f283a[_0x09ab('0x4e')]=qs[_0x09ab('0x4c')](_['pick'](_0x54348f[_0x09ab('0x43')],_0x55b578[_0x09ab('0x4c')]));_0x3f283a['where'][_0x09ab('0x69')]=_0x37e549['id'];if(_0x54348f[_0x09ab('0x43')][_0x09ab('0x51')]){_0x3f283a[_0x09ab('0x4e')]=_['merge'](_0x3f283a[_0x09ab('0x4e')],{'$or':_[_0x09ab('0x34')](_0x3f283a[_0x09ab('0x46')],function(_0x228c8c){var _0x3cc3ba={};_0x3cc3ba[_0x228c8c]={'$like':'%'+_0x54348f[_0x09ab('0x43')][_0x09ab('0x51')]+'%'};return _0x3cc3ba;})});}_0x3f283a=_[_0x09ab('0x4f')]({},_0x3f283a,_0x54348f[_0x09ab('0x52')]);return db[_0x09ab('0x68')][_0x09ab('0x25')]({'where':_0x3f283a[_0x09ab('0x4e')]})[_0x09ab('0x2c')](function(_0x574d46){_0x178b2e[_0x09ab('0x25')]=_0x574d46;if(_0x54348f['query'][_0x09ab('0x53')]){_0x3f283a[_0x09ab('0x54')]=[{'all':!![]}];}return db['CmHopper'][_0x09ab('0x55')](_0x3f283a);})[_0x09ab('0x2c')](function(_0x4efda0){_0x178b2e['rows']=_0x4efda0;return _0x178b2e;});}})[_0x09ab('0x2c')](respondWithFilteredResult(_0x2de63a,_0x3f283a))[_0x09ab('0x5a')](handleError(_0x2de63a,null));};exports[_0x09ab('0x6a')]=function(_0x504192,_0xbd42da,_0x2bec6b){var _0x3524f3={'raw':!![],'where':{}};var _0x407997={};var _0x387539={'count':0x0,'rows':[]};return db[_0x09ab('0x3e')][_0x09ab('0x67')]({'where':{'id':_0x504192['params']['id']}})[_0x09ab('0x2c')](handleEntityNotFound(_0xbd42da,null))['then'](function(_0x1b01de){if(_0x1b01de){_0x407997[_0x09ab('0x42')]=_[_0x09ab('0x59')](db['CmHopperHistory'][_0x09ab('0x3f')]);_0x407997[_0x09ab('0x43')]=_[_0x09ab('0x59')](_0x504192['query']);_0x407997['filters']=_[_0x09ab('0x44')](_0x407997[_0x09ab('0x42')],_0x407997[_0x09ab('0x43')]);_0x3524f3[_0x09ab('0x46')]=_[_0x09ab('0x44')](_0x407997['model'],qs[_0x09ab('0x45')](_0x504192[_0x09ab('0x43')][_0x09ab('0x45')]));_0x3524f3[_0x09ab('0x46')]=_0x3524f3[_0x09ab('0x46')]['length']?_0x3524f3[_0x09ab('0x46')]:_0x407997['model'];if(!_0x504192[_0x09ab('0x43')][_0x09ab('0x48')]('nolimit')){_0x3524f3[_0x09ab('0x24')]=qs['limit'](_0x504192[_0x09ab('0x43')][_0x09ab('0x24')]);_0x3524f3[_0x09ab('0x22')]=qs[_0x09ab('0x22')](_0x504192['query'][_0x09ab('0x22')]);}_0x3524f3[_0x09ab('0x4a')]=qs[_0x09ab('0x4b')](_0x504192[_0x09ab('0x43')]['sort']);_0x3524f3['where']=qs[_0x09ab('0x4c')](_['pick'](_0x504192['query'],_0x407997[_0x09ab('0x4c')]));_0x3524f3[_0x09ab('0x4e')][_0x09ab('0x69')]=_0x1b01de['id'];if(_0x504192[_0x09ab('0x43')][_0x09ab('0x51')]){_0x3524f3[_0x09ab('0x4e')]=_['merge'](_0x3524f3[_0x09ab('0x4e')],{'$or':_[_0x09ab('0x34')](_0x3524f3['attributes'],function(_0x5bf320){var _0xf8cac={};_0xf8cac[_0x5bf320]={'$like':'%'+_0x504192[_0x09ab('0x43')][_0x09ab('0x51')]+'%'};return _0xf8cac;})});}_0x3524f3=_[_0x09ab('0x4f')]({},_0x3524f3,_0x504192[_0x09ab('0x52')]);return db['CmHopperHistory'][_0x09ab('0x25')]({'where':_0x3524f3[_0x09ab('0x4e')]})['then'](function(_0x4d323f){_0x387539[_0x09ab('0x25')]=_0x4d323f;if(_0x504192[_0x09ab('0x43')][_0x09ab('0x53')]){_0x3524f3[_0x09ab('0x54')]=[{'all':!![]}];}return db[_0x09ab('0x6b')][_0x09ab('0x55')](_0x3524f3);})['then'](function(_0x2b5f55){_0x387539[_0x09ab('0x56')]=_0x2b5f55;return _0x387539;});}})[_0x09ab('0x2c')](respondWithFilteredResult(_0xbd42da,_0x3524f3))[_0x09ab('0x5a')](handleError(_0xbd42da,null));};exports[_0x09ab('0x6c')]=function(_0x518646,_0x4a6f77,_0x4b3639){var _0x24a1bb={'raw':!![],'where':{}};var _0x44e418={};var _0x5cb9a6={'count':0x0,'rows':[]};return db[_0x09ab('0x3e')][_0x09ab('0x67')]({'where':{'id':_0x518646[_0x09ab('0x58')]['id']}})[_0x09ab('0x2c')](handleEntityNotFound(_0x4a6f77,null))[_0x09ab('0x2c')](function(_0x2df362){if(_0x2df362){_0x44e418['model']=_[_0x09ab('0x59')](db[_0x09ab('0x6d')]['rawAttributes']);_0x44e418[_0x09ab('0x43')]=_['keys'](_0x518646[_0x09ab('0x43')]);_0x44e418['filters']=_[_0x09ab('0x44')](_0x44e418['model'],_0x44e418[_0x09ab('0x43')]);_0x24a1bb[_0x09ab('0x46')]=_[_0x09ab('0x44')](_0x44e418[_0x09ab('0x42')],qs['fields'](_0x518646['query'][_0x09ab('0x45')]));_0x24a1bb[_0x09ab('0x46')]=_0x24a1bb[_0x09ab('0x46')][_0x09ab('0x47')]?_0x24a1bb[_0x09ab('0x46')]:_0x44e418[_0x09ab('0x42')];if(!_0x518646[_0x09ab('0x43')][_0x09ab('0x48')](_0x09ab('0x49'))){_0x24a1bb[_0x09ab('0x24')]=qs[_0x09ab('0x24')](_0x518646[_0x09ab('0x43')][_0x09ab('0x24')]);_0x24a1bb['offset']=qs[_0x09ab('0x22')](_0x518646[_0x09ab('0x43')][_0x09ab('0x22')]);}_0x24a1bb[_0x09ab('0x4a')]=qs['sort'](_0x518646['query']['sort']);_0x24a1bb[_0x09ab('0x4e')]=qs[_0x09ab('0x4c')](_[_0x09ab('0x4d')](_0x518646[_0x09ab('0x43')],_0x44e418[_0x09ab('0x4c')]));_0x24a1bb[_0x09ab('0x4e')]['VoiceQueueId']=_0x2df362['id'];if(_0x518646[_0x09ab('0x43')][_0x09ab('0x51')]){_0x24a1bb[_0x09ab('0x4e')]=_[_0x09ab('0x4f')](_0x24a1bb['where'],{'$or':_[_0x09ab('0x34')](_0x24a1bb[_0x09ab('0x46')],function(_0x54d2c7){var _0x56e9a6={};_0x56e9a6[_0x54d2c7]={'$like':'%'+_0x518646[_0x09ab('0x43')]['filter']+'%'};return _0x56e9a6;})});}_0x24a1bb=_['merge']({},_0x24a1bb,_0x518646[_0x09ab('0x52')]);return db[_0x09ab('0x6d')][_0x09ab('0x25')]({'where':_0x24a1bb['where']})['then'](function(_0x1895bc){_0x5cb9a6[_0x09ab('0x25')]=_0x1895bc;if(_0x518646[_0x09ab('0x43')][_0x09ab('0x53')]){_0x24a1bb[_0x09ab('0x54')]=[{'all':!![]}];}return db[_0x09ab('0x6d')][_0x09ab('0x55')](_0x24a1bb);})['then'](function(_0x225478){_0x5cb9a6[_0x09ab('0x56')]=_0x225478;return _0x5cb9a6;});}})[_0x09ab('0x2c')](respondWithFilteredResult(_0x4a6f77,_0x24a1bb))[_0x09ab('0x5a')](handleError(_0x4a6f77,null));};exports[_0x09ab('0x6e')]=function(_0x5a63b4,_0x533181,_0x44cdde){var _0x5cbc22={'raw':!![],'where':{}};var _0x362d3a={};var _0x488365={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x09ab('0x67')]({'where':{'id':_0x5a63b4[_0x09ab('0x58')]['id']}})['then'](handleEntityNotFound(_0x533181,null))[_0x09ab('0x2c')](function(_0x3e6308){if(_0x3e6308){_0x362d3a[_0x09ab('0x42')]=_['keys'](db['CmHopperBlack'][_0x09ab('0x3f')]);_0x362d3a[_0x09ab('0x43')]=_[_0x09ab('0x59')](_0x5a63b4[_0x09ab('0x43')]);_0x362d3a['filters']=_[_0x09ab('0x44')](_0x362d3a['model'],_0x362d3a['query']);_0x5cbc22['attributes']=_[_0x09ab('0x44')](_0x362d3a[_0x09ab('0x42')],qs[_0x09ab('0x45')](_0x5a63b4[_0x09ab('0x43')]['fields']));_0x5cbc22[_0x09ab('0x46')]=_0x5cbc22['attributes'][_0x09ab('0x47')]?_0x5cbc22['attributes']:_0x362d3a['model'];if(!_0x5a63b4[_0x09ab('0x43')][_0x09ab('0x48')](_0x09ab('0x49'))){_0x5cbc22['limit']=qs[_0x09ab('0x24')](_0x5a63b4[_0x09ab('0x43')][_0x09ab('0x24')]);_0x5cbc22[_0x09ab('0x22')]=qs['offset'](_0x5a63b4[_0x09ab('0x43')][_0x09ab('0x22')]);}_0x5cbc22[_0x09ab('0x4a')]=qs[_0x09ab('0x4b')](_0x5a63b4[_0x09ab('0x43')]['sort']);_0x5cbc22[_0x09ab('0x4e')]=qs['filters'](_[_0x09ab('0x4d')](_0x5a63b4[_0x09ab('0x43')],_0x362d3a[_0x09ab('0x4c')]));_0x5cbc22['where']['VoiceQueueId']=_0x3e6308['id'];if(_0x5a63b4['query'][_0x09ab('0x51')]){_0x5cbc22['where']=_['merge'](_0x5cbc22[_0x09ab('0x4e')],{'$or':_['map'](_0x5cbc22[_0x09ab('0x46')],function(_0x10147e){var _0x3e9a3e={};_0x3e9a3e[_0x10147e]={'$like':'%'+_0x5a63b4[_0x09ab('0x43')][_0x09ab('0x51')]+'%'};return _0x3e9a3e;})});}_0x5cbc22=_[_0x09ab('0x4f')]({},_0x5cbc22,_0x5a63b4[_0x09ab('0x52')]);return db[_0x09ab('0x6f')][_0x09ab('0x25')]({'where':_0x5cbc22['where']})[_0x09ab('0x2c')](function(_0x294585){_0x488365[_0x09ab('0x25')]=_0x294585;if(_0x5a63b4[_0x09ab('0x43')][_0x09ab('0x53')]){_0x5cbc22['include']=[{'all':!![]}];}return db[_0x09ab('0x6f')][_0x09ab('0x55')](_0x5cbc22);})['then'](function(_0x3ff970){_0x488365['rows']=_0x3ff970;return _0x488365;});}})[_0x09ab('0x2c')](respondWithFilteredResult(_0x533181,_0x5cbc22))[_0x09ab('0x5a')](handleError(_0x533181,null));};exports[_0x09ab('0x70')]=function(_0x5e56dd,_0x286866,_0x571c9b){var _0xcbadda={};var _0x270eab={};var _0x1bf7c6;var _0x4239ce;return db['VoiceQueue']['findOne']({'where':{'id':_0x5e56dd[_0x09ab('0x58')]['id']}})['then'](handleEntityNotFound(_0x286866,null))['then'](function(_0xd5f459){if(_0xd5f459){_0x1bf7c6=_0xd5f459;_0x270eab[_0x09ab('0x42')]=_['keys'](db['Team'][_0x09ab('0x3f')]);_0x270eab[_0x09ab('0x43')]=_[_0x09ab('0x59')](_0x5e56dd[_0x09ab('0x43')]);_0x270eab[_0x09ab('0x4c')]=_[_0x09ab('0x44')](_0x270eab[_0x09ab('0x42')],_0x270eab[_0x09ab('0x43')]);_0xcbadda[_0x09ab('0x46')]=_['intersection'](_0x270eab[_0x09ab('0x42')],qs[_0x09ab('0x45')](_0x5e56dd[_0x09ab('0x43')][_0x09ab('0x45')]));_0xcbadda[_0x09ab('0x46')]=_0xcbadda[_0x09ab('0x46')][_0x09ab('0x47')]?_0xcbadda[_0x09ab('0x46')]:_0x270eab[_0x09ab('0x42')];_0xcbadda['order']=qs['sort'](_0x5e56dd['query']['sort']);_0xcbadda[_0x09ab('0x4e')]=qs['filters'](_[_0x09ab('0x4d')](_0x5e56dd['query'],_0x270eab[_0x09ab('0x4c')]));if(_0x5e56dd[_0x09ab('0x43')]['filter']){_0xcbadda[_0x09ab('0x4e')]=_[_0x09ab('0x4f')](_0xcbadda[_0x09ab('0x4e')],{'$or':_['map'](_0xcbadda['attributes'],function(_0x318a1b){var _0x3eaecb={};_0x3eaecb[_0x318a1b]={'$like':'%'+_0x5e56dd[_0x09ab('0x43')][_0x09ab('0x51')]+'%'};return _0x3eaecb;})});}_0xcbadda=_[_0x09ab('0x4f')]({},_0xcbadda,_0x5e56dd[_0x09ab('0x52')]);return _0x1bf7c6[_0x09ab('0x70')](_0xcbadda);}})[_0x09ab('0x2c')](function(_0x370d03){if(_0x370d03){_0x4239ce=_0x370d03[_0x09ab('0x47')];if(!_0x5e56dd[_0x09ab('0x43')][_0x09ab('0x48')](_0x09ab('0x49'))){_0xcbadda[_0x09ab('0x24')]=qs['limit'](_0x5e56dd[_0x09ab('0x43')][_0x09ab('0x24')]);_0xcbadda[_0x09ab('0x22')]=qs[_0x09ab('0x22')](_0x5e56dd[_0x09ab('0x43')][_0x09ab('0x22')]);}return _0x1bf7c6[_0x09ab('0x70')](_0xcbadda);}})[_0x09ab('0x2c')](function(_0x26f872){if(_0x26f872){return _0x26f872?{'count':_0x4239ce,'rows':_0x26f872}:null;}})[_0x09ab('0x2c')](respondWithResult(_0x286866,null))[_0x09ab('0x5a')](handleError(_0x286866,null));};exports[_0x09ab('0x71')]=function(_0xd352e1,_0x187a9a,_0x27353c){var _0x3340fc=_0xd352e1[_0x09ab('0x5c')][_0x09ab('0x72')];var _0x1d29a5=_['map'](_0x3340fc,'id');return db['Team'][_0x09ab('0x55')]({'where':{'id':_0x1d29a5},'attributes':['id'],'include':[{'model':db[_0x09ab('0x73')],'as':_0x09ab('0x74'),'attributes':['id',_0x09ab('0x39'),'online',_0x09ab('0x75'),'interface'],'raw':!![]}]})[_0x09ab('0x2c')](function(_0x450819){if(_0x450819){var _0x1ac293=_[_0x09ab('0x76')](_0x450819,function(_0x3840af){var _0x16b86c=_0x3840af[_0x09ab('0x2e')]({'plain':!![]});_0x16b86c['Agents'][_0x09ab('0x77')](function(_0x3cd5a6){_0x3cd5a6[_0x09ab('0x78')]=_[_0x09ab('0x38')](_0x3340fc,{'id':_0x16b86c['id']})['penalty'];});return _0x16b86c[_0x09ab('0x74')];});return db['VoiceQueue'][_0x09ab('0x38')]({'where':{'id':_0xd352e1[_0x09ab('0x58')]['id']}})[_0x09ab('0x2c')](function(_0x451bb0){return db[_0x09ab('0x79')][_0x09ab('0x7a')](function(_0x54f6a7){return _0x451bb0[_0x09ab('0x71')](_0x1d29a5,{'transaction':_0x54f6a7})[_0x09ab('0x2c')](function(){return BPromise[_0x09ab('0x7b')](_0x3340fc,function(_0x395d50){return db[_0x09ab('0x7c')]['upsert']({'TeamId':_0x395d50['id'],'VoiceQueueId':_0xd352e1[_0x09ab('0x58')]['id'],'penalty':_0x395d50['penalty']},{'transaction':_0x54f6a7});});})[_0x09ab('0x2c')](function(){return BPromise[_0x09ab('0x7b')](_0x1ac293,function(_0x213fe7){return db[_0x09ab('0x7d')][_0x09ab('0x7e')]({'where':{'UserId':_0x213fe7['id'],'VoiceQueueId':_0xd352e1['params']['id']},'defaults':{'penalty':_0x213fe7[_0x09ab('0x78')]},'transaction':_0x54f6a7});});})[_0x09ab('0x2c')](function(){return BPromise[_0x09ab('0x7b')](_[_0x09ab('0x51')](_0x1ac293,{'online':!![]}),function(_0x1d0444){return db[_0x09ab('0x7f')][_0x09ab('0x80')]({'membername':_0x1d0444['name'],'UserId':_0x1d0444['id'],'queue_name':_0x451bb0[_0x09ab('0x39')],'VoiceQueueId':_0x451bb0['id'],'interface':_[_0x09ab('0x81')](_0x1d0444[_0x09ab('0x82')])?util[_0x09ab('0x83')](_0x09ab('0x84'),_0x1d0444[_0x09ab('0x39')]):_0x1d0444[_0x09ab('0x82')],'paused':_0x1d0444[_0x09ab('0x75')]||![],'penalty':_0x1d0444[_0x09ab('0x78')]},{'transaction':_0x54f6a7});});})['then'](function(){_0x1ac293[_0x09ab('0x77')](function(_0x45f291){socket[_0x09ab('0x85')]('userVoiceQueue:save',{'UserId':_0x45f291['id'],'VoiceQueueId':_0x451bb0['id']});});});});});}})['then'](respondWithStatusCode(_0x187a9a,null))['catch'](handleError(_0x187a9a,null));};exports[_0x09ab('0x86')]=function(_0x4d25ef,_0x8b96a1,_0x35cca8){return db[_0x09ab('0x87')][_0x09ab('0x55')]({'where':{'id':_0x4d25ef[_0x09ab('0x43')][_0x09ab('0x88')]},'attributes':['id'],'include':[{'model':db[_0x09ab('0x73')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x09ab('0x2c')](handleEntityNotFound(_0x8b96a1,null))['then'](function(_0x1c489f){var _0x4be670=_[_0x09ab('0x34')](_0x1c489f,'id');var _0x545c3a=[];var _0x53e881=[];var _0x11b43b=squel['select']();_0x11b43b[_0x09ab('0x89')](_0x09ab('0x8a'))[_0x09ab('0x8b')]('team_has_voice_queues','tq')[_0x09ab('0x8c')]('user_has_teams','ut',_0x09ab('0x8d'))['where'](_0x09ab('0x8e'),_0x4d25ef['params']['id']);for(var _0x3e51ff=0x0;_0x3e51ff<_0x1c489f[_0x09ab('0x47')];_0x3e51ff+=0x1){let _0x2c20f2=_0x1c489f[_0x3e51ff];for(var _0x28be58=0x0;_0x28be58<_0x2c20f2[_0x09ab('0x74')]['length'];_0x28be58+=0x1){let _0x3cf53e=_0x2c20f2[_0x09ab('0x74')][_0x28be58];var _0x171ed6=_0x11b43b[_0x09ab('0x8f')]();_0x171ed6[_0x09ab('0x4e')](_0x09ab('0x90'),_0x3cf53e['id']);_0x53e881[_0x09ab('0x91')](db[_0x09ab('0x79')][_0x09ab('0x43')](_0x171ed6[_0x09ab('0x92')](),{'type':db[_0x09ab('0x79')][_0x09ab('0x93')][_0x09ab('0x94')]})['then'](function(_0x22fe4b){if(_0x22fe4b[_0x09ab('0x47')]===0x1){return _0x3cf53e['id'];}else{var _0x3bcda8=_[_0x09ab('0x95')](_['map'](_0x22fe4b,_0x09ab('0x96')),function(_0x429f62){return _['includes'](_0x4be670,_0x429f62);});if(_0x3bcda8){return _0x3cf53e['id'];}}}));}}return BPromise[_0x09ab('0x97')](_0x53e881)[_0x09ab('0x2c')](function(_0x1c4639){_0x545c3a=_(_0x545c3a)[_0x09ab('0x98')](_0x1c4639)[_0x09ab('0x99')]()['value']();return db[_0x09ab('0x3e')][_0x09ab('0x38')]({'where':{'id':_0x4d25ef[_0x09ab('0x58')]['id']}})[_0x09ab('0x2c')](function(_0x3f7abc){return db[_0x09ab('0x79')][_0x09ab('0x7a')](function(_0x537d6a){return _0x3f7abc[_0x09ab('0x86')](_0x4d25ef[_0x09ab('0x43')][_0x09ab('0x88')],{'transaction':_0x537d6a})[_0x09ab('0x2c')](function(){if(!_[_0x09ab('0x9a')](_0x545c3a)){return _0x3f7abc[_0x09ab('0x9b')](_0x545c3a,{'transaction':_0x537d6a})[_0x09ab('0x2c')](function(){return db[_0x09ab('0x7f')][_0x09ab('0x2d')]({'where':{'VoiceQueueId':_0x4d25ef[_0x09ab('0x58')]['id'],'UserId':_0x545c3a},'transaction':_0x537d6a});});}})[_0x09ab('0x2c')](function(){_0x545c3a[_0x09ab('0x77')](function(_0x2fc8ee){socket[_0x09ab('0x85')](_0x09ab('0x9c'),{'UserId':_0x2fc8ee,'VoiceQueueId':_0x3f7abc['id']});});});});});});})[_0x09ab('0x2c')](respondWithStatusCode(_0x8b96a1,null))[_0x09ab('0x5a')](handleError(_0x8b96a1,null));};exports['addAgents']=function(_0x21bbc4,_0x2c1826,_0x47a289){var _0x210082,_0x4964df;return db[_0x09ab('0x3e')]['find']({'where':{'id':_0x21bbc4[_0x09ab('0x58')]['id']}})[_0x09ab('0x2c')](handleEntityNotFound(_0x2c1826,null))[_0x09ab('0x2c')](function(_0x43a8b6){if(_0x43a8b6){_0x4964df=_0x43a8b6;return _0x43a8b6[_0x09ab('0x9d')](_0x21bbc4['body'][_0x09ab('0x88')],_[_0x09ab('0x62')](_0x21bbc4[_0x09ab('0x5c')],[_0x09ab('0x88'),'id'])||{})['spread'](function(_0xb4efed){for(var _0x8da46f=0x0;_0x8da46f<_0x21bbc4[_0x09ab('0x5c')][_0x09ab('0x88')][_0x09ab('0x47')];_0x8da46f+=0x1){socket[_0x09ab('0x85')](_0x09ab('0x9e'),{'UserId':Number(_0x21bbc4[_0x09ab('0x5c')]['ids'][_0x8da46f]),'VoiceQueueId':Number(_0x21bbc4[_0x09ab('0x58')]['id'])});}return _0xb4efed;});}})[_0x09ab('0x2c')](function(_0xdc0827){_0x210082=_0xdc0827||[];if(_0x4964df){return db[_0x09ab('0x73')][_0x09ab('0x55')]({'where':{'id':_0x21bbc4[_0x09ab('0x5c')]['ids']},'attributes':['id',_0x09ab('0x39'),_0x09ab('0x9f'),_0x09ab('0x75'),_0x09ab('0x82')],'raw':!![]});}})[_0x09ab('0x2c')](function(_0x54b578){if(!_[_0x09ab('0x9a')](_0x54b578)){var _0x228124=[];for(var _0x5ae758=0x0;_0x5ae758<_0x54b578[_0x09ab('0x47')];_0x5ae758++){if(_0x54b578[_0x5ae758]['online']){_0x228124[_0x09ab('0x91')](db[_0x09ab('0x7f')][_0x09ab('0x80')]({'membername':_0x54b578[_0x5ae758][_0x09ab('0x39')],'UserId':_0x54b578[_0x5ae758]['id'],'queue_name':_0x4964df[_0x09ab('0x39')],'VoiceQueueId':_0x4964df['id'],'interface':_[_0x09ab('0x81')](_0x54b578[_0x5ae758][_0x09ab('0x82')])?util['format'](_0x09ab('0x84'),_0x54b578[_0x5ae758][_0x09ab('0x39')]):_0x54b578[_0x5ae758]['interface'],'paused':_0x54b578[_0x5ae758][_0x09ab('0x75')]||![],'penalty':_0x21bbc4[_0x09ab('0x5c')][_0x09ab('0x78')]||0x0}));}}return BPromise[_0x09ab('0x97')](_0x228124);}})['then'](function(){return _0x210082;})[_0x09ab('0x2c')](respondWithResult(_0x2c1826,null))[_0x09ab('0x5a')](handleError(_0x2c1826,null));};exports[_0x09ab('0x9b')]=function(_0x26bbb1,_0x37a684,_0x151229){return db['VoiceQueue'][_0x09ab('0x38')]({'where':{'id':_0x26bbb1[_0x09ab('0x58')]['id']}})[_0x09ab('0x2c')](handleEntityNotFound(_0x37a684,null))[_0x09ab('0x2c')](function(_0x1390b7){if(_0x1390b7){return _0x1390b7[_0x09ab('0x9b')](_0x26bbb1[_0x09ab('0x43')][_0x09ab('0x88')])[_0x09ab('0x2c')](function(){if(_['isArray'](_0x26bbb1[_0x09ab('0x43')][_0x09ab('0x88')])){for(var _0x142e16=0x0;_0x142e16<_0x26bbb1[_0x09ab('0x43')][_0x09ab('0x88')][_0x09ab('0x47')];_0x142e16+=0x1){socket[_0x09ab('0x85')](_0x09ab('0x9c'),{'UserId':Number(_0x26bbb1[_0x09ab('0x43')][_0x09ab('0x88')][_0x142e16]),'VoiceQueueId':Number(_0x26bbb1[_0x09ab('0x58')]['id'])});}}else{socket[_0x09ab('0x85')](_0x09ab('0x9c'),{'UserId':Number(_0x26bbb1['query'][_0x09ab('0x88')]),'VoiceQueueId':Number(_0x26bbb1['params']['id'])});}});}})['then'](function(_0x8dcd01){return db[_0x09ab('0x7f')][_0x09ab('0x2d')]({'where':{'VoiceQueueId':_0x26bbb1['params']['id'],'UserId':_0x26bbb1[_0x09ab('0x43')]['ids']}})['then'](function(){return _0x8dcd01;});})[_0x09ab('0x2c')](respondWithStatusCode(_0x37a684,null))['catch'](handleError(_0x37a684,null));};exports['getAgents']=function(_0x3e91c2,_0x788e2f,_0x3a2c6b){var _0xa08c8={};var _0x2b278c={};var _0x335657;var _0x18b531;return db[_0x09ab('0x3e')][_0x09ab('0x67')]({'where':{'id':_0x3e91c2[_0x09ab('0x58')]['id']}})[_0x09ab('0x2c')](handleEntityNotFound(_0x788e2f,null))[_0x09ab('0x2c')](function(_0x2d2289){if(_0x2d2289){_0x335657=_0x2d2289;_0x2b278c[_0x09ab('0x42')]=_[_0x09ab('0x59')](db['User']['rawAttributes']);_0x2b278c['query']=_[_0x09ab('0x59')](_0x3e91c2[_0x09ab('0x43')]);_0x2b278c[_0x09ab('0x4c')]=_[_0x09ab('0x44')](_0x2b278c[_0x09ab('0x42')],_0x2b278c[_0x09ab('0x43')]);_0xa08c8[_0x09ab('0x46')]=_['intersection'](_0x2b278c[_0x09ab('0x42')],qs[_0x09ab('0x45')](_0x3e91c2['query'][_0x09ab('0x45')]));_0xa08c8[_0x09ab('0x46')]=_0xa08c8[_0x09ab('0x46')][_0x09ab('0x47')]?_0xa08c8[_0x09ab('0x46')]:_0x2b278c['model'];_0xa08c8[_0x09ab('0x4a')]=qs[_0x09ab('0x4b')](_0x3e91c2[_0x09ab('0x43')][_0x09ab('0x4b')]);_0xa08c8[_0x09ab('0x4e')]=qs[_0x09ab('0x4c')](_[_0x09ab('0x4d')](_0x3e91c2[_0x09ab('0x43')],_0x2b278c[_0x09ab('0x4c')]));if(_0x3e91c2[_0x09ab('0x43')][_0x09ab('0x51')]){_0xa08c8[_0x09ab('0x4e')]=_['merge'](_0xa08c8[_0x09ab('0x4e')],{'$or':_['map'](_0xa08c8[_0x09ab('0x46')],function(_0x3bd50d){var _0x154d17={};_0x154d17[_0x3bd50d]={'$like':'%'+_0x3e91c2['query'][_0x09ab('0x51')]+'%'};return _0x154d17;})});}_0xa08c8=_[_0x09ab('0x4f')]({},_0xa08c8,_0x3e91c2['options']);return _0x335657[_0x09ab('0xa0')](_0xa08c8);}})[_0x09ab('0x2c')](function(_0x45d081){if(_0x45d081){_0x18b531=_0x45d081[_0x09ab('0x47')];if(!_0x3e91c2[_0x09ab('0x43')][_0x09ab('0x48')](_0x09ab('0x49'))){_0xa08c8['limit']=qs[_0x09ab('0x24')](_0x3e91c2['query']['limit']);_0xa08c8[_0x09ab('0x22')]=qs[_0x09ab('0x22')](_0x3e91c2[_0x09ab('0x43')][_0x09ab('0x22')]);}return _0x335657[_0x09ab('0xa0')](_0xa08c8);}})[_0x09ab('0x2c')](function(_0x4b188d){if(_0x4b188d){return _0x4b188d?{'count':_0x18b531,'rows':_0x4b188d}:null;}})[_0x09ab('0x2c')](respondWithResult(_0x788e2f,null))[_0x09ab('0x5a')](handleError(_0x788e2f,null));};exports['getMembers']=function(_0x3bca30,_0x2644b5,_0xda48c0){var _0x16159e={};var _0x59cf13={};var _0x4024da;var _0x35a4ae;return db[_0x09ab('0x3e')][_0x09ab('0x67')]({'where':{'id':_0x3bca30[_0x09ab('0x58')]['id']}})['then'](handleEntityNotFound(_0x2644b5,null))[_0x09ab('0x2c')](function(_0x4129b5){if(_0x4129b5){_0x4024da=_0x4129b5;_0x59cf13[_0x09ab('0x42')]=_['keys'](db[_0x09ab('0x7f')]['rawAttributes']);_0x59cf13[_0x09ab('0x43')]=_[_0x09ab('0x59')](_0x3bca30['query']);_0x59cf13['filters']=_[_0x09ab('0x44')](_0x59cf13[_0x09ab('0x42')],_0x59cf13[_0x09ab('0x43')]);_0x16159e[_0x09ab('0x46')]=_['intersection'](_0x59cf13[_0x09ab('0x42')],qs[_0x09ab('0x45')](_0x3bca30[_0x09ab('0x43')][_0x09ab('0x45')]));_0x16159e[_0x09ab('0x46')]=_0x16159e['attributes'][_0x09ab('0x47')]?_0x16159e[_0x09ab('0x46')]:_0x59cf13[_0x09ab('0x42')];_0x16159e['order']=qs[_0x09ab('0x4b')](_0x3bca30[_0x09ab('0x43')][_0x09ab('0x4b')]);_0x16159e['where']=qs[_0x09ab('0x4c')](_[_0x09ab('0x4d')](_0x3bca30[_0x09ab('0x43')],_0x59cf13['filters']));if(_0x3bca30[_0x09ab('0x43')][_0x09ab('0x51')]){_0x16159e['where']=_['merge'](_0x16159e[_0x09ab('0x4e')],{'$or':_[_0x09ab('0x34')](_0x16159e[_0x09ab('0x46')],function(_0x5dfe1e){var _0x2cab0c={};_0x2cab0c[_0x5dfe1e]={'$like':'%'+_0x3bca30[_0x09ab('0x43')]['filter']+'%'};return _0x2cab0c;})});}_0x16159e=_[_0x09ab('0x4f')]({},_0x16159e,_0x3bca30[_0x09ab('0x52')]);return _0x4024da['getMembers'](_0x16159e);}})['then'](function(_0x562ad3){if(_0x562ad3){_0x35a4ae=_0x562ad3[_0x09ab('0x47')];if(!_0x3bca30[_0x09ab('0x43')]['hasOwnProperty'](_0x09ab('0x49'))){_0x16159e[_0x09ab('0x24')]=qs['limit'](_0x3bca30['query']['limit']);_0x16159e[_0x09ab('0x22')]=qs['offset'](_0x3bca30['query']['offset']);}return _0x4024da[_0x09ab('0xa1')](_0x16159e);}})[_0x09ab('0x2c')](function(_0x4ab931){return _0x4ab931?{'count':_0x35a4ae,'rows':_0x4ab931}:null;})['then'](respondWithResult(_0x2644b5,null))['catch'](handleError(_0x2644b5,null));};exports[_0x09ab('0xa2')]=function(_0x51401e,_0x5a8632,_0x55bf7d){var _0x458304={};var _0x18b687={};var _0xd48670;var _0x106bcf;return db[_0x09ab('0x3e')][_0x09ab('0x67')]({'where':{'id':_0x51401e['params']['id']}})[_0x09ab('0x2c')](handleEntityNotFound(_0x5a8632,null))[_0x09ab('0x2c')](function(_0x2d321b){if(_0x2d321b){_0xd48670=_0x2d321b;_0x18b687[_0x09ab('0x42')]=_['keys'](db[_0x09ab('0xa3')]['rawAttributes']);_0x18b687['query']=_['keys'](_0x51401e[_0x09ab('0x43')]);_0x18b687['filters']=_[_0x09ab('0x44')](_0x18b687['model'],_0x18b687[_0x09ab('0x43')]);_0x458304[_0x09ab('0x46')]=_[_0x09ab('0x44')](_0x18b687[_0x09ab('0x42')],qs['fields'](_0x51401e[_0x09ab('0x43')][_0x09ab('0x45')]));_0x458304[_0x09ab('0x46')]=_0x458304['attributes']['length']?_0x458304[_0x09ab('0x46')]:_0x18b687[_0x09ab('0x42')];_0x458304[_0x09ab('0x4a')]=qs[_0x09ab('0x4b')](_0x51401e[_0x09ab('0x43')][_0x09ab('0x4b')]);_0x458304[_0x09ab('0x4e')]=qs[_0x09ab('0x4c')](_[_0x09ab('0x4d')](_0x51401e[_0x09ab('0x43')],_0x18b687['filters']));if(_0x51401e[_0x09ab('0x43')]['filter']){_0x458304[_0x09ab('0x4e')]=_['merge'](_0x458304['where'],{'$or':_[_0x09ab('0x34')](_0x458304[_0x09ab('0x46')],function(_0x37db2e){var _0x153062={};_0x153062[_0x37db2e]={'$like':'%'+_0x51401e[_0x09ab('0x43')]['filter']+'%'};return _0x153062;})});}_0x458304=_[_0x09ab('0x4f')]({},_0x458304,_0x51401e[_0x09ab('0x52')]);return _0xd48670[_0x09ab('0xa2')](_0x458304);}})[_0x09ab('0x2c')](function(_0xe46a14){if(_0xe46a14){_0x106bcf=_0xe46a14[_0x09ab('0x47')];if(!_0x51401e[_0x09ab('0x43')][_0x09ab('0x48')](_0x09ab('0x49'))){_0x458304['limit']=qs[_0x09ab('0x24')](_0x51401e['query'][_0x09ab('0x24')]);_0x458304['offset']=qs[_0x09ab('0x22')](_0x51401e['query'][_0x09ab('0x22')]);}return _0xd48670[_0x09ab('0xa2')](_0x458304);}})[_0x09ab('0x2c')](function(_0x549161){if(_0x549161){return _0x549161?{'count':_0x106bcf,'rows':_0x549161}:null;}})['then'](respondWithResult(_0x5a8632,null))[_0x09ab('0x5a')](handleError(_0x5a8632,null));};exports['addLists']=function(_0x52c906,_0x55ad42,_0x5b70c6){var _0x1b53a2=moment()[_0x09ab('0x83')](_0x09ab('0xa4'));var _0x2d3e51,_0x472246;return db[_0x09ab('0x3e')][_0x09ab('0x38')]({'where':{'id':_0x52c906[_0x09ab('0x58')]['id']}})[_0x09ab('0x2c')](handleEntityNotFound(_0x55ad42,null))[_0x09ab('0x2c')](function(_0x4ae4f8){if(_0x4ae4f8){_0x472246=_0x4ae4f8;return _0x4ae4f8['addLists'](_0x52c906['body'][_0x09ab('0x88')],_['omit'](_0x52c906[_0x09ab('0x5c')],[_0x09ab('0x88'),'id'])||{});}return null;})['spread'](function(_0x222c3b){var _0x58aa3b;_0x2d3e51=_0x222c3b||[];var _0x189432=[];if(_0x222c3b){for(var _0x2ae5b8=0x0;_0x2ae5b8<_0x222c3b['length'];_0x2ae5b8+=0x1){var _0x9390a=_0x222c3b[_0x2ae5b8][_0x09ab('0x2e')]({'plain':!![]});_0x472246[_0x09ab('0xa5')]=_0x52c906['body']['dialCheckDuplicateType']?_0x52c906[_0x09ab('0x5c')][_0x09ab('0xa5')]:_0x472246[_0x09ab('0xa5')];switch(_0x472246[_0x09ab('0xa5')]){case _0x09ab('0xa6'):_0x58aa3b=squel['insert']()[_0x09ab('0xa7')](_0x09ab('0xa8'))[_0x09ab('0xa9')](['phone',_0x09ab('0xaa'),_0x09ab('0xab'),'ListId',_0x09ab('0x69'),_0x09ab('0x63'),_0x09ab('0x64')],squel['select']()[_0x09ab('0x89')](_0x09ab('0xac'),_0x09ab('0xac'))[_0x09ab('0x89')]('\x27'+_0x1b53a2+'\x27','scheduledAt')[_0x09ab('0x89')]('id',_0x09ab('0xab'))[_0x09ab('0x89')](_0x9390a[_0x09ab('0xad')]['toString'](),'ListId')[_0x09ab('0x89')](_0x52c906['params']['id']['toString'](),_0x09ab('0x69'))[_0x09ab('0x89')]('\x27'+_0x1b53a2+'\x27',_0x09ab('0x63'))[_0x09ab('0x89')]('\x27'+_0x1b53a2+'\x27',_0x09ab('0x64'))['from'](_0x09ab('0xae'))[_0x09ab('0x4e')](_0x09ab('0xaf'))['where']('ListId\x20=\x20?',_0x9390a[_0x09ab('0xad')][_0x09ab('0x92')]())[_0x09ab('0x4e')](_0x09ab('0xb0'))[_0x09ab('0x4e')]('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0x09ab('0x89')](_0x09ab('0xb1'))['from'](_0x09ab('0xb2'))[_0x09ab('0x4e')](_0x09ab('0x8e'),_0x52c906[_0x09ab('0x58')]['id'][_0x09ab('0x92')]()))[_0x09ab('0x4e')](_0x09ab('0xb3'),squel[_0x09ab('0xb4')]()[_0x09ab('0x89')](_0x09ab('0xb5'))[_0x09ab('0x8b')](_0x09ab('0xa8'))[_0x09ab('0x4e')]('VoiceQueueId\x20=\x20?',_0x52c906[_0x09ab('0x58')]['id'][_0x09ab('0x92')]())))[_0x09ab('0x92')]();break;case _0x09ab('0xb6'):_0x58aa3b=squel[_0x09ab('0xb7')]()['into'](_0x09ab('0xa8'))[_0x09ab('0xa9')]([_0x09ab('0xac'),_0x09ab('0xaa'),_0x09ab('0xab'),'ListId','VoiceQueueId',_0x09ab('0x63'),_0x09ab('0x64')],squel[_0x09ab('0xb4')]()[_0x09ab('0x89')](_0x09ab('0xac'),_0x09ab('0xac'))[_0x09ab('0x89')]('\x27'+_0x1b53a2+'\x27',_0x09ab('0xaa'))['field']('id',_0x09ab('0xab'))[_0x09ab('0x89')](_0x9390a[_0x09ab('0xad')][_0x09ab('0x92')](),_0x09ab('0xb8'))['field'](_0x52c906['params']['id'][_0x09ab('0x92')](),_0x09ab('0x69'))['field']('\x27'+_0x1b53a2+'\x27',_0x09ab('0x63'))[_0x09ab('0x89')]('\x27'+_0x1b53a2+'\x27','updatedAt')[_0x09ab('0x8b')]('cm_contacts')[_0x09ab('0x4e')](_0x09ab('0xaf'))[_0x09ab('0x4e')](_0x09ab('0xb9'),_0x9390a[_0x09ab('0xad')][_0x09ab('0x92')]())[_0x09ab('0x4e')](_0x09ab('0xb0'))[_0x09ab('0x4e')](_0x09ab('0xb3'),squel[_0x09ab('0xb4')]()['field'](_0x09ab('0xb5'))['from'](_0x09ab('0xa8'))[_0x09ab('0x4e')]('VoiceQueueId\x20=\x20?',_0x52c906['params']['id'][_0x09ab('0x92')]())))[_0x09ab('0x92')]();break;default:_0x58aa3b=squel[_0x09ab('0xb7')]()[_0x09ab('0xa7')](_0x09ab('0xa8'))['fromQuery'](['phone',_0x09ab('0xaa'),'ContactId','ListId',_0x09ab('0x69'),_0x09ab('0x63'),_0x09ab('0x64')],squel['select']()[_0x09ab('0x89')](_0x09ab('0xac'),'phone')[_0x09ab('0x89')]('\x27'+_0x1b53a2+'\x27',_0x09ab('0xaa'))[_0x09ab('0x89')]('id',_0x09ab('0xab'))[_0x09ab('0x89')](_0x9390a[_0x09ab('0xad')]['toString'](),_0x09ab('0xb8'))['field'](_0x52c906[_0x09ab('0x58')]['id'][_0x09ab('0x92')](),'VoiceQueueId')[_0x09ab('0x89')]('\x27'+_0x1b53a2+'\x27','createdAt')[_0x09ab('0x89')]('\x27'+_0x1b53a2+'\x27',_0x09ab('0x64'))[_0x09ab('0x8b')]('cm_contacts')[_0x09ab('0x4e')]('deletedAt\x20IS\x20NULL')[_0x09ab('0x4e')](_0x09ab('0xb9'),_0x9390a[_0x09ab('0xad')][_0x09ab('0x92')]())[_0x09ab('0x4e')](_0x09ab('0xb0')))[_0x09ab('0x92')]();}_0x189432[_0x09ab('0x91')](db[_0x09ab('0x79')][_0x09ab('0x43')](_0x58aa3b));}return BPromise[_0x09ab('0x97')](_0x189432);}})[_0x09ab('0x2c')](function(){var _0x19bd7f=[];var _0x3dce32=squel[_0x09ab('0xb7')]()[_0x09ab('0xa7')](_0x09ab('0xba'))[_0x09ab('0xa9')]([_0x09ab('0xbb'),_0x09ab('0xac'),'OrderBy',_0x09ab('0x63'),_0x09ab('0x64')],squel[_0x09ab('0xb4')]()[_0x09ab('0x89')]('h.id')[_0x09ab('0x89')](_0x09ab('0xbc'))['field']('ci.OrderBy+1')[_0x09ab('0x89')]('\x27'+_0x1b53a2+'\x27',_0x09ab('0x63'))[_0x09ab('0x89')]('\x27'+_0x1b53a2+'\x27',_0x09ab('0x64'))[_0x09ab('0x8b')](_0x09ab('0xbd'),'ci')[_0x09ab('0x8c')]('cm_hopper','h',_0x09ab('0xbe'))['where'](_0x09ab('0xbf'),_0x1b53a2)[_0x09ab('0x4e')](_0x09ab('0xc0'),_0x09ab('0xc1')))['toString']();_0x19bd7f[_0x09ab('0x91')](db['sequelize'][_0x09ab('0x43')](_0x3dce32));return BPromise[_0x09ab('0x97')](_0x19bd7f);})['then'](function(){return _0x2d3e51;})[_0x09ab('0x2c')](respondWithResult(_0x55ad42,null))[_0x09ab('0x5a')](handleError(_0x55ad42,null));};exports[_0x09ab('0xc2')]=function(_0x4f58c1,_0x184220,_0x21697f){return db[_0x09ab('0x3e')][_0x09ab('0x38')]({'where':{'id':_0x4f58c1[_0x09ab('0x58')]['id']}})[_0x09ab('0x2c')](handleEntityNotFound(_0x184220,null))[_0x09ab('0x2c')](function(_0x5a4c55){if(_0x5a4c55){return _0x5a4c55['removeLists'](_0x4f58c1['query'][_0x09ab('0x88')]);}})[_0x09ab('0x2c')](function(_0x13ea61){if(_0x13ea61){return db[_0x09ab('0x68')][_0x09ab('0x2d')]({'where':{'ListId':_0x4f58c1[_0x09ab('0x43')][_0x09ab('0x88')],'VoiceQueueId':_0x4f58c1[_0x09ab('0x58')]['id']}})['then'](function(){return _0x13ea61;});}})[_0x09ab('0x2c')](respondWithStatusCode(_0x184220,null))['catch'](handleError(_0x184220,null));};exports[_0x09ab('0xc3')]=function(_0x2899d2,_0x3b8f87,_0x4dd250){var _0x393f5e={};var _0x47016f={};var _0x584063;var _0x5e1ee1;return db[_0x09ab('0x3e')][_0x09ab('0x67')]({'where':{'id':_0x2899d2[_0x09ab('0x58')]['id']}})[_0x09ab('0x2c')](handleEntityNotFound(_0x3b8f87,null))['then'](function(_0x41d8bb){if(_0x41d8bb){_0x584063=_0x41d8bb;_0x47016f[_0x09ab('0x42')]=_[_0x09ab('0x59')](db['CmList'][_0x09ab('0x3f')]);_0x47016f['query']=_[_0x09ab('0x59')](_0x2899d2[_0x09ab('0x43')]);_0x47016f['filters']=_[_0x09ab('0x44')](_0x47016f[_0x09ab('0x42')],_0x47016f[_0x09ab('0x43')]);_0x393f5e[_0x09ab('0x46')]=_[_0x09ab('0x44')](_0x47016f['model'],qs[_0x09ab('0x45')](_0x2899d2[_0x09ab('0x43')][_0x09ab('0x45')]));_0x393f5e[_0x09ab('0x46')]=_0x393f5e['attributes'][_0x09ab('0x47')]?_0x393f5e[_0x09ab('0x46')]:_0x47016f[_0x09ab('0x42')];_0x393f5e[_0x09ab('0x4a')]=qs[_0x09ab('0x4b')](_0x2899d2[_0x09ab('0x43')][_0x09ab('0x4b')]);_0x393f5e[_0x09ab('0x4e')]=qs['filters'](_[_0x09ab('0x4d')](_0x2899d2[_0x09ab('0x43')],_0x47016f['filters']));if(_0x2899d2[_0x09ab('0x43')]['filter']){_0x393f5e[_0x09ab('0x4e')]=_['merge'](_0x393f5e[_0x09ab('0x4e')],{'$or':_[_0x09ab('0x34')](_0x393f5e['attributes'],function(_0x25af91){var _0x1dceca={};_0x1dceca[_0x25af91]={'$like':'%'+_0x2899d2[_0x09ab('0x43')][_0x09ab('0x51')]+'%'};return _0x1dceca;})});}_0x393f5e=_[_0x09ab('0x4f')]({},_0x393f5e,_0x2899d2[_0x09ab('0x52')]);return _0x584063[_0x09ab('0xc3')](_0x393f5e);}})[_0x09ab('0x2c')](function(_0x55abe9){if(_0x55abe9){_0x5e1ee1=_0x55abe9['length'];if(!_0x2899d2[_0x09ab('0x43')][_0x09ab('0x48')](_0x09ab('0x49'))){_0x393f5e[_0x09ab('0x24')]=qs['limit'](_0x2899d2['query'][_0x09ab('0x24')]);_0x393f5e[_0x09ab('0x22')]=qs[_0x09ab('0x22')](_0x2899d2[_0x09ab('0x43')][_0x09ab('0x22')]);}return _0x584063[_0x09ab('0xc3')](_0x393f5e);}})[_0x09ab('0x2c')](function(_0x1afced){if(_0x1afced){return _0x1afced?{'count':_0x5e1ee1,'rows':_0x1afced}:null;}})[_0x09ab('0x2c')](respondWithResult(_0x3b8f87,null))[_0x09ab('0x5a')](handleError(_0x3b8f87,null));};exports['addBlackLists']=function(_0x5571ec,_0x388535,_0x1296b8){var _0x52278c,_0x1c77db;return db['VoiceQueue'][_0x09ab('0x38')]({'where':{'id':_0x5571ec[_0x09ab('0x58')]['id']}})[_0x09ab('0x2c')](handleEntityNotFound(_0x388535,null))[_0x09ab('0x2c')](function(_0x588869){if(_0x588869){_0x1c77db=_0x588869;return _0x588869[_0x09ab('0xc4')](_0x5571ec[_0x09ab('0x5c')][_0x09ab('0x88')],_[_0x09ab('0x62')](_0x5571ec[_0x09ab('0x5c')],[_0x09ab('0x88'),'id'])||{});}return null;})[_0x09ab('0xc5')](function(_0x169b1c){var _0x234ca7;_0x52278c=_0x169b1c||[];var _0x265810=[];if(_0x169b1c){for(var _0x4c9f6e=0x0;_0x4c9f6e<_0x169b1c[_0x09ab('0x47')];_0x4c9f6e+=0x1){var _0x4ff94d=_0x169b1c[_0x4c9f6e][_0x09ab('0x2e')]({'plain':!![]});_0x234ca7=squel[_0x09ab('0xb7')]()[_0x09ab('0xa7')](_0x09ab('0xc6'))[_0x09ab('0xa9')]([_0x09ab('0xac'),_0x09ab('0xab'),_0x09ab('0xb8'),_0x09ab('0x69'),_0x09ab('0x63'),_0x09ab('0x64')],squel[_0x09ab('0xb4')]()[_0x09ab('0x89')]('phone',_0x09ab('0xac'))['field']('id','ContactId')[_0x09ab('0x89')](_0x4ff94d[_0x09ab('0xad')]['toString'](),'ListId')[_0x09ab('0x89')](_0x5571ec[_0x09ab('0x58')]['id'][_0x09ab('0x92')](),_0x09ab('0x69'))['field']('NOW()',_0x09ab('0x63'))[_0x09ab('0x89')](_0x09ab('0xc7'),_0x09ab('0x64'))['from'](_0x09ab('0xae'))[_0x09ab('0x4e')]('deletedAt\x20IS\x20NULL')['where'](_0x09ab('0xb9'),_0x4ff94d[_0x09ab('0xad')][_0x09ab('0x92')]())['where'](_0x09ab('0xb0')))[_0x09ab('0x92')]();_0x265810[_0x09ab('0x91')](db[_0x09ab('0x79')][_0x09ab('0x43')](_0x234ca7));}return BPromise[_0x09ab('0x97')](_0x265810);}})['then'](function(){return _0x52278c;})[_0x09ab('0x2c')](respondWithResult(_0x388535,null))[_0x09ab('0x5a')](handleError(_0x388535,null));};exports[_0x09ab('0xc8')]=function(_0x1a3b94,_0x48d8f5,_0x473e63){return db[_0x09ab('0x3e')][_0x09ab('0x38')]({'where':{'id':_0x1a3b94['params']['id']}})['then'](handleEntityNotFound(_0x48d8f5,null))['then'](function(_0x85f9b){if(_0x85f9b){return _0x85f9b[_0x09ab('0xc8')](_0x1a3b94[_0x09ab('0x43')]['ids']);}})[_0x09ab('0x2c')](function(_0x228d85){if(_0x228d85){return db['CmHopperBlack'][_0x09ab('0x2d')]({'where':{'ListId':_0x1a3b94[_0x09ab('0x43')]['ids'],'VoiceQueueId':_0x1a3b94[_0x09ab('0x58')]['id']}})[_0x09ab('0x2c')](function(){return _0x228d85;});}})[_0x09ab('0x2c')](respondWithStatusCode(_0x48d8f5,null))[_0x09ab('0x5a')](handleError(_0x48d8f5,null));}; \ No newline at end of file +var _0x2f2e=['send','index','VoiceQueue','rawAttributes','fieldName','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','options','findAll','rows','catch','show','params','keys','includeAll','include','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','inbound','find','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','getHoppers','findOne','CmHopper','VoiceQueueId','getHopperHistories','CmHopperHistory','CmHopperFinal','CmHopperBlack','getTeams','teams','Team','User','online','voicePause','interface','flatMap','penalty','Agents','sequelize','transaction','addTeams','upsert','each','findOrCreate','UserVoiceQueueRt','SIP/%s','forEach','emit','userVoiceQueue:save','removeTeams','ids','field','tq.TeamId','from','team_has_voice_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','QueryTypes','every','TeamId','all','compact','isEmpty','userVoiceQueue:remove','spread','push','isNil','format','removeAgents','getAgents','getMembers','getLists','CmList','addLists','YYYY-MM-DD\x20HH:mm:ss','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','ContactId','ListId','select','scheduledAt','CmListId','toString','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','onlyIfOpen','cm_hopper_additional_phones','CmHopperId','h.id','ci.item','ci.OrderBy+1','cm_contact_has_items','h.ContactId=ci.CmContactId','h.scheduledat=?','ci.ItemClass=?','removeLists','getBlackLists','addBlackLists','cm_hopper_black','NOW()','removeBlackLists','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','fs-extra','lodash','squel','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','get','VoiceQueues','QueueCampaigns','outbound','filter','ignore','map','value','includes','type','name','UserProfileResource','end'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0x2f2e,0x146));var _0xe2f2=function(_0x289c3e,_0x3614b5){_0x289c3e=_0x289c3e-0x0;var _0x25a4b3=_0x2f2e[_0x289c3e];return _0x25a4b3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe2f2('0x0'));var zipdir=require(_0xe2f2('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe2f2('0x2'));var moment=require('moment');var BPromise=require(_0xe2f2('0x3'));var Mustache=require(_0xe2f2('0x4'));var util=require(_0xe2f2('0x5'));var path=require(_0xe2f2('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe2f2('0x7'));var _=require(_0xe2f2('0x8'));var squel=require(_0xe2f2('0x9'));var crypto=require(_0xe2f2('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xe2f2('0xb'));var Papa=require('papaparse');var Redis=require(_0xe2f2('0xc'));var authService=require(_0xe2f2('0xd'));var qs=require(_0xe2f2('0xe'));var as=require(_0xe2f2('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe2f2('0x10'))(_0xe2f2('0x11'));var utils=require('../../config/utils');var config=require(_0xe2f2('0x12'));var licenseUtil=require(_0xe2f2('0x13'));var db=require(_0xe2f2('0x14'))['db'];config[_0xe2f2('0x15')]=_[_0xe2f2('0x16')](config[_0xe2f2('0x15')],{'host':_0xe2f2('0x17'),'port':0x18eb});var socket=require(_0xe2f2('0x18'))(new Redis(config[_0xe2f2('0x15')]));require(_0xe2f2('0x19'))['register'](socket);function respondWithStatusCode(_0x3bfa74,_0x375fc0){_0x375fc0=_0x375fc0||0xcc;return function(_0x85f49d){if(_0x85f49d){return _0x3bfa74[_0xe2f2('0x1a')](_0x375fc0);}return _0x3bfa74[_0xe2f2('0x1b')](_0x375fc0)['end']();};}function respondWithResult(_0x5b7f1a,_0x10cc99){_0x10cc99=_0x10cc99||0xc8;return function(_0xb11b33){if(_0xb11b33){return _0x5b7f1a[_0xe2f2('0x1b')](_0x10cc99)['json'](_0xb11b33);}};}function respondWithFilteredResult(_0x86c42b,_0x653f02){return function(_0x22433f){if(_0x22433f){var _0x511d90=typeof _0x653f02[_0xe2f2('0x1c')]===_0xe2f2('0x1d')&&typeof _0x653f02[_0xe2f2('0x1e')]===_0xe2f2('0x1d');var _0xf6ca03=_0x22433f[_0xe2f2('0x1f')];var _0x5d664a=_0x511d90?0x0:_0x653f02[_0xe2f2('0x1c')];var _0x354e5c=_0x511d90?_0x22433f[_0xe2f2('0x1f')]:_0x653f02[_0xe2f2('0x1c')]+_0x653f02[_0xe2f2('0x1e')];var _0x2670f6;if(_0x354e5c>=_0xf6ca03){_0x354e5c=_0xf6ca03;_0x2670f6=0xc8;}else{_0x2670f6=0xce;}_0x86c42b[_0xe2f2('0x1b')](_0x2670f6);return _0x86c42b[_0xe2f2('0x20')](_0xe2f2('0x21'),_0x5d664a+'-'+_0x354e5c+'/'+_0xf6ca03)[_0xe2f2('0x22')](_0x22433f);}return null;};}function patchUpdates(_0x1e9829){return function(_0x598b48){try{jsonpatch[_0xe2f2('0x23')](_0x598b48,_0x1e9829,!![]);}catch(_0x3be5af){return BPromise[_0xe2f2('0x24')](_0x3be5af);}return _0x598b48[_0xe2f2('0x25')]();};}function saveUpdates(_0x124ff2,_0x141f34){return function(_0x43211a){if(_0x43211a){return _0x43211a[_0xe2f2('0x26')](_0x124ff2)[_0xe2f2('0x27')](function(_0x47a9a8){return _0x47a9a8;});}return null;};}function removeEntity(_0x22e734,_0x56ab92){return function(_0xdf8ce8){if(_0xdf8ce8){return _0xdf8ce8[_0xe2f2('0x28')]()[_0xe2f2('0x27')](function(){var _0x5595b2=_0xdf8ce8[_0xe2f2('0x29')]({'plain':!![]});var _0x58e1fd=[{'name':_0xe2f2('0x2a'),'value':'inbound','ignore':![]},{'name':_0xe2f2('0x2b'),'value':_0xe2f2('0x2c'),'ignore':![]}];var _0x1ec167=_(_0x58e1fd)[_0xe2f2('0x2d')](_0xe2f2('0x2e'))[_0xe2f2('0x2f')]('value')[_0xe2f2('0x30')]();if(_[_0xe2f2('0x31')](_0x1ec167,_0x5595b2[_0xe2f2('0x32')])){return;}var _0x4abae7=_['find'](_0x58e1fd,[_0xe2f2('0x30'),_0x5595b2[_0xe2f2('0x32')]])[_0xe2f2('0x33')];return db[_0xe2f2('0x34')]['destroy']({'where':{'type':_0x4abae7,'resourceId':_0x5595b2['id']}})[_0xe2f2('0x27')](function(){return _0xdf8ce8;});})['then'](function(){_0x22e734[_0xe2f2('0x1b')](0xcc)[_0xe2f2('0x35')]();});}};}function handleEntityNotFound(_0x33f30a,_0x19ae85){return function(_0x5bf310){if(!_0x5bf310){_0x33f30a[_0xe2f2('0x1a')](0x194);}return _0x5bf310;};}function handleError(_0x336b6a,_0x124ca5){_0x124ca5=_0x124ca5||0x1f4;return function(_0x5f5857){logger['error'](_0x5f5857['stack']);if(_0x5f5857[_0xe2f2('0x33')]){delete _0x5f5857[_0xe2f2('0x33')];}_0x336b6a[_0xe2f2('0x1b')](_0x124ca5)[_0xe2f2('0x36')](_0x5f5857);};}exports[_0xe2f2('0x37')]=function(_0x4f203a,_0x30bee3){var _0x51d28a={},_0x1a62c2={},_0x113773={'count':0x0,'rows':[]};var _0x555dba=_[_0xe2f2('0x2f')](db[_0xe2f2('0x38')][_0xe2f2('0x39')],function(_0x9d9f8f){return{'name':_0x9d9f8f[_0xe2f2('0x3a')],'type':_0x9d9f8f[_0xe2f2('0x32')][_0xe2f2('0x3b')]};});_0x1a62c2[_0xe2f2('0x3c')]=_['map'](_0x555dba,'name');_0x1a62c2[_0xe2f2('0x3d')]=_['keys'](_0x4f203a[_0xe2f2('0x3d')]);_0x1a62c2[_0xe2f2('0x3e')]=_[_0xe2f2('0x3f')](_0x1a62c2['model'],_0x1a62c2[_0xe2f2('0x3d')]);_0x51d28a['attributes']=_[_0xe2f2('0x3f')](_0x1a62c2[_0xe2f2('0x3c')],qs[_0xe2f2('0x40')](_0x4f203a[_0xe2f2('0x3d')][_0xe2f2('0x40')]));_0x51d28a[_0xe2f2('0x41')]=_0x51d28a['attributes'][_0xe2f2('0x42')]?_0x51d28a[_0xe2f2('0x41')]:_0x1a62c2[_0xe2f2('0x3c')];if(!_0x4f203a[_0xe2f2('0x3d')][_0xe2f2('0x43')](_0xe2f2('0x44'))){_0x51d28a[_0xe2f2('0x1e')]=qs[_0xe2f2('0x1e')](_0x4f203a['query']['limit']);_0x51d28a[_0xe2f2('0x1c')]=qs['offset'](_0x4f203a[_0xe2f2('0x3d')]['offset']);}_0x51d28a[_0xe2f2('0x45')]=qs[_0xe2f2('0x46')](_0x4f203a[_0xe2f2('0x3d')]['sort']);_0x51d28a[_0xe2f2('0x47')]=qs[_0xe2f2('0x3e')](_[_0xe2f2('0x48')](_0x4f203a[_0xe2f2('0x3d')],_0x1a62c2[_0xe2f2('0x3e')]),_0x555dba);if(_0x4f203a[_0xe2f2('0x3d')][_0xe2f2('0x2d')]){_0x51d28a[_0xe2f2('0x47')]=_['merge'](_0x51d28a[_0xe2f2('0x47')],{'$or':_[_0xe2f2('0x2f')](_0x555dba,function(_0x510a6b){if(_0x510a6b[_0xe2f2('0x32')]!=='VIRTUAL'){var _0x509b2c={};_0x509b2c[_0x510a6b[_0xe2f2('0x33')]]={'$like':'%'+_0x4f203a[_0xe2f2('0x3d')]['filter']+'%'};return _0x509b2c;}})});}_0x51d28a=_[_0xe2f2('0x49')]({},_0x51d28a,_0x4f203a[_0xe2f2('0x4a')]);var _0x27470b={'where':_0x51d28a[_0xe2f2('0x47')]};return db['VoiceQueue'][_0xe2f2('0x1f')](_0x27470b)[_0xe2f2('0x27')](function(_0x812355){_0x113773[_0xe2f2('0x1f')]=_0x812355;if(_0x4f203a[_0xe2f2('0x3d')]['includeAll']){_0x51d28a['include']=[{'all':!![]}];}return db[_0xe2f2('0x38')][_0xe2f2('0x4b')](_0x51d28a);})[_0xe2f2('0x27')](function(_0x10b78f){_0x113773[_0xe2f2('0x4c')]=_0x10b78f;return _0x113773;})[_0xe2f2('0x27')](respondWithFilteredResult(_0x30bee3,_0x51d28a))[_0xe2f2('0x4d')](handleError(_0x30bee3,null));};exports[_0xe2f2('0x4e')]=function(_0x38a072,_0x3b41bb){var _0x300cd9={'raw':![],'where':{'id':_0x38a072[_0xe2f2('0x4f')]['id']}},_0x4b00e9={};_0x4b00e9[_0xe2f2('0x3c')]=_[_0xe2f2('0x50')](db['VoiceQueue'][_0xe2f2('0x39')]);_0x4b00e9['query']=_['keys'](_0x38a072['query']);_0x4b00e9[_0xe2f2('0x3e')]=_[_0xe2f2('0x3f')](_0x4b00e9[_0xe2f2('0x3c')],_0x4b00e9[_0xe2f2('0x3d')]);_0x300cd9[_0xe2f2('0x41')]=_[_0xe2f2('0x3f')](_0x4b00e9[_0xe2f2('0x3c')],qs[_0xe2f2('0x40')](_0x38a072[_0xe2f2('0x3d')][_0xe2f2('0x40')]));_0x300cd9[_0xe2f2('0x41')]=_0x300cd9[_0xe2f2('0x41')][_0xe2f2('0x42')]?_0x300cd9[_0xe2f2('0x41')]:_0x4b00e9['model'];if(_0x38a072[_0xe2f2('0x3d')][_0xe2f2('0x51')]){_0x300cd9[_0xe2f2('0x52')]=[{'all':!![]}];}_0x300cd9=_[_0xe2f2('0x49')]({},_0x300cd9,_0x38a072[_0xe2f2('0x4a')]);return db[_0xe2f2('0x38')]['find'](_0x300cd9)[_0xe2f2('0x27')](handleEntityNotFound(_0x3b41bb,null))[_0xe2f2('0x27')](respondWithResult(_0x3b41bb,null))[_0xe2f2('0x4d')](handleError(_0x3b41bb,null));};exports[_0xe2f2('0x53')]=function(_0x5a5eea,_0x262144){return db[_0xe2f2('0x38')][_0xe2f2('0x53')](_0x5a5eea[_0xe2f2('0x54')],{})[_0xe2f2('0x27')](function(_0x13a94b){var _0x310bb2=_0x5a5eea[_0xe2f2('0x55')][_0xe2f2('0x29')]({'plain':!![]});if(!_0x310bb2)throw new Error(_0xe2f2('0x56'));if(_0x310bb2[_0xe2f2('0x57')]==='user'){var _0x3899e2=_0x13a94b['get']({'plain':!![]});var _0x1d1ab2=[{'name':_0xe2f2('0x2a'),'value':_0xe2f2('0x58')},{'name':'QueueCampaigns','value':_0xe2f2('0x2c')}];var _0x406557=_[_0xe2f2('0x59')](_0x1d1ab2,[_0xe2f2('0x30'),_0x3899e2[_0xe2f2('0x32')]])['name'];return db[_0xe2f2('0x5a')][_0xe2f2('0x59')]({'where':{'name':_0x406557,'userProfileId':_0x310bb2[_0xe2f2('0x5b')]},'raw':!![]})['then'](function(_0x48457a){if(_0x48457a&&_0x48457a[_0xe2f2('0x5c')]===0x0){return db['UserProfileResource'][_0xe2f2('0x53')]({'name':_0x3899e2[_0xe2f2('0x33')],'resourceId':_0x3899e2['id'],'type':_0x48457a[_0xe2f2('0x33')],'sectionId':_0x48457a['id']},{})['then'](function(){return _0x13a94b;});}else{return _0x13a94b;}})[_0xe2f2('0x4d')](function(_0x12aa00){logger[_0xe2f2('0x5d')](_0xe2f2('0x5e'),_0x12aa00);throw _0x12aa00;});}return _0x13a94b;})[_0xe2f2('0x27')](respondWithResult(_0x262144,0xc9))[_0xe2f2('0x4d')](handleError(_0x262144,null));};exports[_0xe2f2('0x5f')]=function(_0x265235,_0x2ce387){var _0x493843={'where':{'id':_0x265235[_0xe2f2('0x4f')]['id']}},_0x247f95={};_0x247f95[_0xe2f2('0x3c')]=_[_0xe2f2('0x50')](db[_0xe2f2('0x38')][_0xe2f2('0x39')]);_0x493843[_0xe2f2('0x41')]=_[_0xe2f2('0x3f')](_0x247f95[_0xe2f2('0x3c')],qs['fields'](_0x265235[_0xe2f2('0x3d')][_0xe2f2('0x40')]));_0x493843['attributes']=_0x493843[_0xe2f2('0x41')][_0xe2f2('0x42')]?_0x493843[_0xe2f2('0x41')]:_0x247f95[_0xe2f2('0x3c')];if(_0x265235[_0xe2f2('0x3d')][_0xe2f2('0x51')]){_0x493843[_0xe2f2('0x52')]=[{'all':!![]}];}_0x493843=_[_0xe2f2('0x49')]({},_0x493843,_0x265235[_0xe2f2('0x4a')]);return db[_0xe2f2('0x38')][_0xe2f2('0x59')](_0x493843)[_0xe2f2('0x27')](handleEntityNotFound(_0x2ce387,null))[_0xe2f2('0x27')](function(_0xc6238e){if(_0xc6238e){var _0x3f19e7=_0xc6238e[_0xe2f2('0x29')]({'plain':!![]});_0x3f19e7=qs[_0xe2f2('0x60')](_0x3f19e7,['id',_0xe2f2('0x61'),_0xe2f2('0x62')]);_0x265235[_0xe2f2('0x54')]=_['omit'](_0x265235[_0xe2f2('0x54')],['id','createdAt',_0xe2f2('0x62')]);return db[_0xe2f2('0x38')][_0xe2f2('0x53')](_['merge'](_0x3f19e7,_0x265235[_0xe2f2('0x54')]),{'include':_0x265235[_0xe2f2('0x3d')][_0xe2f2('0x51')]?[{'all':!![]}]:undefined})[_0xe2f2('0x27')](function(_0x3978cb){var _0x4e9cdd=_0x265235[_0xe2f2('0x55')][_0xe2f2('0x29')]({'plain':!![]});if(!_0x4e9cdd)throw new Error(_0xe2f2('0x56'));if(_0x4e9cdd[_0xe2f2('0x57')]==='user'){var _0x236659=_0x3978cb[_0xe2f2('0x29')]({'plain':!![]});var _0x2d816b=[{'name':_0xe2f2('0x2a'),'value':_0xe2f2('0x58')},{'name':_0xe2f2('0x2b'),'value':_0xe2f2('0x2c')}];var _0x2008f7=_[_0xe2f2('0x59')](_0x2d816b,[_0xe2f2('0x30'),_0x236659[_0xe2f2('0x32')]])[_0xe2f2('0x33')];return db[_0xe2f2('0x5a')][_0xe2f2('0x59')]({'where':{'name':_0x2008f7,'userProfileId':_0x4e9cdd['userProfileId']},'raw':!![]})['then'](function(_0x2c342a){if(_0x2c342a&&_0x2c342a['autoAssociation']===0x0){return db[_0xe2f2('0x34')][_0xe2f2('0x53')]({'name':_0x236659[_0xe2f2('0x33')],'resourceId':_0x236659['id'],'type':_0x2c342a[_0xe2f2('0x33')],'sectionId':_0x2c342a['id']},{})['then'](function(){return _0x3978cb;});}else{return _0x3978cb;}})[_0xe2f2('0x4d')](function(_0xd608c1){logger[_0xe2f2('0x5d')](_0xe2f2('0x5e'),_0xd608c1);throw _0xd608c1;});}return _0x3978cb;});}})[_0xe2f2('0x27')](respondWithResult(_0x2ce387,0xc9))['catch'](handleError(_0x2ce387,null));};exports['update']=function(_0xb12e,_0x1966cb){if(_0xb12e['body']['id']){delete _0xb12e[_0xe2f2('0x54')]['id'];}return db[_0xe2f2('0x38')]['find']({'where':{'id':_0xb12e[_0xe2f2('0x4f')]['id']}})[_0xe2f2('0x27')](handleEntityNotFound(_0x1966cb,null))[_0xe2f2('0x27')](saveUpdates(_0xb12e[_0xe2f2('0x54')],null))[_0xe2f2('0x27')](respondWithResult(_0x1966cb,null))[_0xe2f2('0x4d')](handleError(_0x1966cb,null));};exports['destroy']=function(_0x19b235,_0x32bccc){return db[_0xe2f2('0x38')]['find']({'where':{'id':_0x19b235[_0xe2f2('0x4f')]['id']}})[_0xe2f2('0x27')](handleEntityNotFound(_0x32bccc,null))[_0xe2f2('0x27')](removeEntity(_0x32bccc,null))[_0xe2f2('0x4d')](handleError(_0x32bccc,null));};exports[_0xe2f2('0x63')]=function(_0x2b9642,_0x5873ac,_0xfb5d8e){var _0x3a47ef={'raw':![],'where':{}};var _0x46a9a8={};var _0x2f686f={'count':0x0,'rows':[]};return db[_0xe2f2('0x38')][_0xe2f2('0x64')]({'where':{'id':_0x2b9642[_0xe2f2('0x4f')]['id']}})[_0xe2f2('0x27')](handleEntityNotFound(_0x5873ac,null))[_0xe2f2('0x27')](function(_0x11dd35){if(_0x11dd35){_0x46a9a8['model']=_['keys'](db[_0xe2f2('0x65')]['rawAttributes']);_0x46a9a8['query']=_[_0xe2f2('0x50')](_0x2b9642[_0xe2f2('0x3d')]);_0x46a9a8[_0xe2f2('0x3e')]=_[_0xe2f2('0x3f')](_0x46a9a8[_0xe2f2('0x3c')],_0x46a9a8[_0xe2f2('0x3d')]);_0x3a47ef['attributes']=_[_0xe2f2('0x3f')](_0x46a9a8[_0xe2f2('0x3c')],qs[_0xe2f2('0x40')](_0x2b9642['query']['fields']));_0x3a47ef[_0xe2f2('0x41')]=_0x3a47ef[_0xe2f2('0x41')][_0xe2f2('0x42')]?_0x3a47ef[_0xe2f2('0x41')]:_0x46a9a8[_0xe2f2('0x3c')];if(!_0x2b9642['query']['hasOwnProperty'](_0xe2f2('0x44'))){_0x3a47ef['limit']=qs[_0xe2f2('0x1e')](_0x2b9642[_0xe2f2('0x3d')][_0xe2f2('0x1e')]);_0x3a47ef[_0xe2f2('0x1c')]=qs[_0xe2f2('0x1c')](_0x2b9642[_0xe2f2('0x3d')][_0xe2f2('0x1c')]);}_0x3a47ef[_0xe2f2('0x45')]=qs[_0xe2f2('0x46')](_0x2b9642[_0xe2f2('0x3d')]['sort']);_0x3a47ef[_0xe2f2('0x47')]=qs[_0xe2f2('0x3e')](_[_0xe2f2('0x48')](_0x2b9642[_0xe2f2('0x3d')],_0x46a9a8[_0xe2f2('0x3e')]));_0x3a47ef['where'][_0xe2f2('0x66')]=_0x11dd35['id'];if(_0x2b9642[_0xe2f2('0x3d')][_0xe2f2('0x2d')]){_0x3a47ef[_0xe2f2('0x47')]=_[_0xe2f2('0x49')](_0x3a47ef['where'],{'$or':_['map'](_0x3a47ef['attributes'],function(_0x3d02af){var _0x4a9db6={};_0x4a9db6[_0x3d02af]={'$like':'%'+_0x2b9642['query']['filter']+'%'};return _0x4a9db6;})});}_0x3a47ef=_[_0xe2f2('0x49')]({},_0x3a47ef,_0x2b9642[_0xe2f2('0x4a')]);return db[_0xe2f2('0x65')]['count']({'where':_0x3a47ef[_0xe2f2('0x47')]})['then'](function(_0x5ad53c){_0x2f686f[_0xe2f2('0x1f')]=_0x5ad53c;if(_0x2b9642[_0xe2f2('0x3d')][_0xe2f2('0x51')]){_0x3a47ef['include']=[{'all':!![]}];}return db[_0xe2f2('0x65')]['findAll'](_0x3a47ef);})[_0xe2f2('0x27')](function(_0x256623){_0x2f686f[_0xe2f2('0x4c')]=_0x256623;return _0x2f686f;});}})[_0xe2f2('0x27')](respondWithFilteredResult(_0x5873ac,_0x3a47ef))[_0xe2f2('0x4d')](handleError(_0x5873ac,null));};exports[_0xe2f2('0x67')]=function(_0x3f13d3,_0x2b5c52,_0x2e359a){var _0x18bfb8={'raw':!![],'where':{}};var _0x15e6df={};var _0x563234={'count':0x0,'rows':[]};return db[_0xe2f2('0x38')][_0xe2f2('0x64')]({'where':{'id':_0x3f13d3[_0xe2f2('0x4f')]['id']}})['then'](handleEntityNotFound(_0x2b5c52,null))[_0xe2f2('0x27')](function(_0x1481c9){if(_0x1481c9){_0x15e6df[_0xe2f2('0x3c')]=_[_0xe2f2('0x50')](db[_0xe2f2('0x68')][_0xe2f2('0x39')]);_0x15e6df[_0xe2f2('0x3d')]=_[_0xe2f2('0x50')](_0x3f13d3[_0xe2f2('0x3d')]);_0x15e6df[_0xe2f2('0x3e')]=_[_0xe2f2('0x3f')](_0x15e6df['model'],_0x15e6df[_0xe2f2('0x3d')]);_0x18bfb8[_0xe2f2('0x41')]=_[_0xe2f2('0x3f')](_0x15e6df[_0xe2f2('0x3c')],qs[_0xe2f2('0x40')](_0x3f13d3[_0xe2f2('0x3d')][_0xe2f2('0x40')]));_0x18bfb8['attributes']=_0x18bfb8[_0xe2f2('0x41')][_0xe2f2('0x42')]?_0x18bfb8['attributes']:_0x15e6df[_0xe2f2('0x3c')];if(!_0x3f13d3[_0xe2f2('0x3d')][_0xe2f2('0x43')](_0xe2f2('0x44'))){_0x18bfb8['limit']=qs[_0xe2f2('0x1e')](_0x3f13d3[_0xe2f2('0x3d')][_0xe2f2('0x1e')]);_0x18bfb8['offset']=qs[_0xe2f2('0x1c')](_0x3f13d3[_0xe2f2('0x3d')][_0xe2f2('0x1c')]);}_0x18bfb8[_0xe2f2('0x45')]=qs[_0xe2f2('0x46')](_0x3f13d3[_0xe2f2('0x3d')][_0xe2f2('0x46')]);_0x18bfb8[_0xe2f2('0x47')]=qs[_0xe2f2('0x3e')](_[_0xe2f2('0x48')](_0x3f13d3[_0xe2f2('0x3d')],_0x15e6df[_0xe2f2('0x3e')]));_0x18bfb8[_0xe2f2('0x47')][_0xe2f2('0x66')]=_0x1481c9['id'];if(_0x3f13d3['query']['filter']){_0x18bfb8[_0xe2f2('0x47')]=_['merge'](_0x18bfb8['where'],{'$or':_[_0xe2f2('0x2f')](_0x18bfb8[_0xe2f2('0x41')],function(_0x3f63a7){var _0x7699cf={};_0x7699cf[_0x3f63a7]={'$like':'%'+_0x3f13d3[_0xe2f2('0x3d')][_0xe2f2('0x2d')]+'%'};return _0x7699cf;})});}_0x18bfb8=_[_0xe2f2('0x49')]({},_0x18bfb8,_0x3f13d3['options']);return db[_0xe2f2('0x68')]['count']({'where':_0x18bfb8[_0xe2f2('0x47')]})[_0xe2f2('0x27')](function(_0x5a84bc){_0x563234[_0xe2f2('0x1f')]=_0x5a84bc;if(_0x3f13d3[_0xe2f2('0x3d')][_0xe2f2('0x51')]){_0x18bfb8[_0xe2f2('0x52')]=[{'all':!![]}];}return db[_0xe2f2('0x68')][_0xe2f2('0x4b')](_0x18bfb8);})[_0xe2f2('0x27')](function(_0x41d2d7){_0x563234['rows']=_0x41d2d7;return _0x563234;});}})['then'](respondWithFilteredResult(_0x2b5c52,_0x18bfb8))['catch'](handleError(_0x2b5c52,null));};exports['getHopperFinals']=function(_0x315cd1,_0x2b8759,_0x157da8){var _0x126cd2={'raw':!![],'where':{}};var _0x32e2f7={};var _0x5e4ad7={'count':0x0,'rows':[]};return db[_0xe2f2('0x38')]['findOne']({'where':{'id':_0x315cd1[_0xe2f2('0x4f')]['id']}})[_0xe2f2('0x27')](handleEntityNotFound(_0x2b8759,null))[_0xe2f2('0x27')](function(_0x140d33){if(_0x140d33){_0x32e2f7[_0xe2f2('0x3c')]=_[_0xe2f2('0x50')](db[_0xe2f2('0x69')][_0xe2f2('0x39')]);_0x32e2f7[_0xe2f2('0x3d')]=_[_0xe2f2('0x50')](_0x315cd1[_0xe2f2('0x3d')]);_0x32e2f7[_0xe2f2('0x3e')]=_[_0xe2f2('0x3f')](_0x32e2f7[_0xe2f2('0x3c')],_0x32e2f7[_0xe2f2('0x3d')]);_0x126cd2['attributes']=_[_0xe2f2('0x3f')](_0x32e2f7['model'],qs[_0xe2f2('0x40')](_0x315cd1[_0xe2f2('0x3d')][_0xe2f2('0x40')]));_0x126cd2[_0xe2f2('0x41')]=_0x126cd2[_0xe2f2('0x41')][_0xe2f2('0x42')]?_0x126cd2['attributes']:_0x32e2f7['model'];if(!_0x315cd1[_0xe2f2('0x3d')][_0xe2f2('0x43')](_0xe2f2('0x44'))){_0x126cd2['limit']=qs[_0xe2f2('0x1e')](_0x315cd1['query'][_0xe2f2('0x1e')]);_0x126cd2[_0xe2f2('0x1c')]=qs['offset'](_0x315cd1['query'][_0xe2f2('0x1c')]);}_0x126cd2[_0xe2f2('0x45')]=qs[_0xe2f2('0x46')](_0x315cd1[_0xe2f2('0x3d')]['sort']);_0x126cd2[_0xe2f2('0x47')]=qs[_0xe2f2('0x3e')](_['pick'](_0x315cd1['query'],_0x32e2f7[_0xe2f2('0x3e')]));_0x126cd2[_0xe2f2('0x47')]['VoiceQueueId']=_0x140d33['id'];if(_0x315cd1[_0xe2f2('0x3d')]['filter']){_0x126cd2[_0xe2f2('0x47')]=_[_0xe2f2('0x49')](_0x126cd2[_0xe2f2('0x47')],{'$or':_[_0xe2f2('0x2f')](_0x126cd2[_0xe2f2('0x41')],function(_0x315b01){var _0x1135a4={};_0x1135a4[_0x315b01]={'$like':'%'+_0x315cd1[_0xe2f2('0x3d')][_0xe2f2('0x2d')]+'%'};return _0x1135a4;})});}_0x126cd2=_[_0xe2f2('0x49')]({},_0x126cd2,_0x315cd1[_0xe2f2('0x4a')]);return db['CmHopperFinal'][_0xe2f2('0x1f')]({'where':_0x126cd2[_0xe2f2('0x47')]})['then'](function(_0x342429){_0x5e4ad7[_0xe2f2('0x1f')]=_0x342429;if(_0x315cd1[_0xe2f2('0x3d')][_0xe2f2('0x51')]){_0x126cd2[_0xe2f2('0x52')]=[{'all':!![]}];}return db[_0xe2f2('0x69')][_0xe2f2('0x4b')](_0x126cd2);})['then'](function(_0xcef5ad){_0x5e4ad7[_0xe2f2('0x4c')]=_0xcef5ad;return _0x5e4ad7;});}})[_0xe2f2('0x27')](respondWithFilteredResult(_0x2b8759,_0x126cd2))[_0xe2f2('0x4d')](handleError(_0x2b8759,null));};exports['getHopperBlacks']=function(_0x340d7e,_0x2d42c6,_0x32b464){var _0x27d730={'raw':!![],'where':{}};var _0x2cfe7f={};var _0x1d0c16={'count':0x0,'rows':[]};return db['VoiceQueue']['findOne']({'where':{'id':_0x340d7e[_0xe2f2('0x4f')]['id']}})[_0xe2f2('0x27')](handleEntityNotFound(_0x2d42c6,null))['then'](function(_0x459386){if(_0x459386){_0x2cfe7f[_0xe2f2('0x3c')]=_[_0xe2f2('0x50')](db['CmHopperBlack']['rawAttributes']);_0x2cfe7f['query']=_[_0xe2f2('0x50')](_0x340d7e[_0xe2f2('0x3d')]);_0x2cfe7f[_0xe2f2('0x3e')]=_[_0xe2f2('0x3f')](_0x2cfe7f['model'],_0x2cfe7f[_0xe2f2('0x3d')]);_0x27d730[_0xe2f2('0x41')]=_[_0xe2f2('0x3f')](_0x2cfe7f[_0xe2f2('0x3c')],qs[_0xe2f2('0x40')](_0x340d7e['query'][_0xe2f2('0x40')]));_0x27d730[_0xe2f2('0x41')]=_0x27d730[_0xe2f2('0x41')][_0xe2f2('0x42')]?_0x27d730[_0xe2f2('0x41')]:_0x2cfe7f[_0xe2f2('0x3c')];if(!_0x340d7e['query']['hasOwnProperty'](_0xe2f2('0x44'))){_0x27d730[_0xe2f2('0x1e')]=qs[_0xe2f2('0x1e')](_0x340d7e[_0xe2f2('0x3d')][_0xe2f2('0x1e')]);_0x27d730[_0xe2f2('0x1c')]=qs['offset'](_0x340d7e[_0xe2f2('0x3d')][_0xe2f2('0x1c')]);}_0x27d730[_0xe2f2('0x45')]=qs['sort'](_0x340d7e[_0xe2f2('0x3d')][_0xe2f2('0x46')]);_0x27d730['where']=qs['filters'](_['pick'](_0x340d7e[_0xe2f2('0x3d')],_0x2cfe7f[_0xe2f2('0x3e')]));_0x27d730['where'][_0xe2f2('0x66')]=_0x459386['id'];if(_0x340d7e[_0xe2f2('0x3d')][_0xe2f2('0x2d')]){_0x27d730[_0xe2f2('0x47')]=_[_0xe2f2('0x49')](_0x27d730['where'],{'$or':_[_0xe2f2('0x2f')](_0x27d730[_0xe2f2('0x41')],function(_0x5565be){var _0x2cf644={};_0x2cf644[_0x5565be]={'$like':'%'+_0x340d7e[_0xe2f2('0x3d')][_0xe2f2('0x2d')]+'%'};return _0x2cf644;})});}_0x27d730=_[_0xe2f2('0x49')]({},_0x27d730,_0x340d7e[_0xe2f2('0x4a')]);return db[_0xe2f2('0x6a')][_0xe2f2('0x1f')]({'where':_0x27d730[_0xe2f2('0x47')]})[_0xe2f2('0x27')](function(_0x50eae){_0x1d0c16[_0xe2f2('0x1f')]=_0x50eae;if(_0x340d7e[_0xe2f2('0x3d')][_0xe2f2('0x51')]){_0x27d730[_0xe2f2('0x52')]=[{'all':!![]}];}return db[_0xe2f2('0x6a')][_0xe2f2('0x4b')](_0x27d730);})[_0xe2f2('0x27')](function(_0x379289){_0x1d0c16[_0xe2f2('0x4c')]=_0x379289;return _0x1d0c16;});}})[_0xe2f2('0x27')](respondWithFilteredResult(_0x2d42c6,_0x27d730))['catch'](handleError(_0x2d42c6,null));};exports[_0xe2f2('0x6b')]=function(_0x277c13,_0xf6698e,_0x15bac7){var _0x20e7e0={};var _0x55910b={};var _0x10c292;var _0xe796b1;return db['VoiceQueue']['findOne']({'where':{'id':_0x277c13[_0xe2f2('0x4f')]['id']}})[_0xe2f2('0x27')](handleEntityNotFound(_0xf6698e,null))[_0xe2f2('0x27')](function(_0x79cd2d){if(_0x79cd2d){_0x10c292=_0x79cd2d;_0x55910b[_0xe2f2('0x3c')]=_[_0xe2f2('0x50')](db['Team']['rawAttributes']);_0x55910b['query']=_[_0xe2f2('0x50')](_0x277c13[_0xe2f2('0x3d')]);_0x55910b[_0xe2f2('0x3e')]=_[_0xe2f2('0x3f')](_0x55910b[_0xe2f2('0x3c')],_0x55910b[_0xe2f2('0x3d')]);_0x20e7e0[_0xe2f2('0x41')]=_[_0xe2f2('0x3f')](_0x55910b[_0xe2f2('0x3c')],qs[_0xe2f2('0x40')](_0x277c13[_0xe2f2('0x3d')][_0xe2f2('0x40')]));_0x20e7e0['attributes']=_0x20e7e0['attributes'][_0xe2f2('0x42')]?_0x20e7e0['attributes']:_0x55910b[_0xe2f2('0x3c')];_0x20e7e0['order']=qs[_0xe2f2('0x46')](_0x277c13['query'][_0xe2f2('0x46')]);_0x20e7e0[_0xe2f2('0x47')]=qs[_0xe2f2('0x3e')](_[_0xe2f2('0x48')](_0x277c13[_0xe2f2('0x3d')],_0x55910b[_0xe2f2('0x3e')]));if(_0x277c13[_0xe2f2('0x3d')][_0xe2f2('0x2d')]){_0x20e7e0[_0xe2f2('0x47')]=_[_0xe2f2('0x49')](_0x20e7e0[_0xe2f2('0x47')],{'$or':_[_0xe2f2('0x2f')](_0x20e7e0['attributes'],function(_0x1e594a){var _0x18bae8={};_0x18bae8[_0x1e594a]={'$like':'%'+_0x277c13[_0xe2f2('0x3d')][_0xe2f2('0x2d')]+'%'};return _0x18bae8;})});}_0x20e7e0=_[_0xe2f2('0x49')]({},_0x20e7e0,_0x277c13[_0xe2f2('0x4a')]);return _0x10c292[_0xe2f2('0x6b')](_0x20e7e0);}})[_0xe2f2('0x27')](function(_0xb73bc){if(_0xb73bc){_0xe796b1=_0xb73bc['length'];if(!_0x277c13['query'][_0xe2f2('0x43')](_0xe2f2('0x44'))){_0x20e7e0['limit']=qs[_0xe2f2('0x1e')](_0x277c13[_0xe2f2('0x3d')][_0xe2f2('0x1e')]);_0x20e7e0[_0xe2f2('0x1c')]=qs[_0xe2f2('0x1c')](_0x277c13[_0xe2f2('0x3d')][_0xe2f2('0x1c')]);}return _0x10c292['getTeams'](_0x20e7e0);}})[_0xe2f2('0x27')](function(_0x33c7b0){if(_0x33c7b0){return _0x33c7b0?{'count':_0xe796b1,'rows':_0x33c7b0}:null;}})[_0xe2f2('0x27')](respondWithResult(_0xf6698e,null))[_0xe2f2('0x4d')](handleError(_0xf6698e,null));};exports['addTeams']=function(_0x45c0f8,_0x2c3601,_0x18dc58){var _0x15b340=_0x45c0f8[_0xe2f2('0x54')][_0xe2f2('0x6c')];var _0x20af08=_[_0xe2f2('0x2f')](_0x15b340,'id');return db[_0xe2f2('0x6d')][_0xe2f2('0x4b')]({'where':{'id':_0x20af08},'attributes':['id'],'include':[{'model':db[_0xe2f2('0x6e')],'as':'Agents','attributes':['id',_0xe2f2('0x33'),_0xe2f2('0x6f'),_0xe2f2('0x70'),_0xe2f2('0x71')],'raw':!![]}]})[_0xe2f2('0x27')](function(_0x59e7bc){if(_0x59e7bc){var _0x4dc04f=_[_0xe2f2('0x72')](_0x59e7bc,function(_0x4f9a03){var _0x15535f=_0x4f9a03[_0xe2f2('0x29')]({'plain':!![]});_0x15535f['Agents']['forEach'](function(_0x42d3d0){_0x42d3d0[_0xe2f2('0x73')]=_['find'](_0x15b340,{'id':_0x15535f['id']})[_0xe2f2('0x73')];});return _0x15535f[_0xe2f2('0x74')];});return db[_0xe2f2('0x38')][_0xe2f2('0x59')]({'where':{'id':_0x45c0f8[_0xe2f2('0x4f')]['id']}})['then'](function(_0x43aa78){return db[_0xe2f2('0x75')][_0xe2f2('0x76')](function(_0x58f0bf){return _0x43aa78[_0xe2f2('0x77')](_0x20af08,{'transaction':_0x58f0bf})[_0xe2f2('0x27')](function(){return BPromise['each'](_0x15b340,function(_0x48d702){return db['TeamVoiceQueue'][_0xe2f2('0x78')]({'TeamId':_0x48d702['id'],'VoiceQueueId':_0x45c0f8['params']['id'],'penalty':_0x48d702[_0xe2f2('0x73')]},{'transaction':_0x58f0bf});});})[_0xe2f2('0x27')](function(){return BPromise[_0xe2f2('0x79')](_0x4dc04f,function(_0x875a3a){return db['UserVoiceQueue'][_0xe2f2('0x7a')]({'where':{'UserId':_0x875a3a['id'],'VoiceQueueId':_0x45c0f8[_0xe2f2('0x4f')]['id']},'defaults':{'penalty':_0x875a3a['penalty']},'transaction':_0x58f0bf});});})[_0xe2f2('0x27')](function(){return BPromise[_0xe2f2('0x79')](_[_0xe2f2('0x2d')](_0x4dc04f,{'online':!![]}),function(_0x2fb696){return db[_0xe2f2('0x7b')][_0xe2f2('0x78')]({'membername':_0x2fb696['name'],'UserId':_0x2fb696['id'],'queue_name':_0x43aa78[_0xe2f2('0x33')],'VoiceQueueId':_0x43aa78['id'],'interface':_['isNil'](_0x2fb696[_0xe2f2('0x71')])?util['format'](_0xe2f2('0x7c'),_0x2fb696[_0xe2f2('0x33')]):_0x2fb696[_0xe2f2('0x71')],'paused':_0x2fb696[_0xe2f2('0x70')]||![],'penalty':_0x2fb696[_0xe2f2('0x73')]},{'transaction':_0x58f0bf});});})[_0xe2f2('0x27')](function(){_0x4dc04f[_0xe2f2('0x7d')](function(_0x10fba5){socket[_0xe2f2('0x7e')](_0xe2f2('0x7f'),{'UserId':_0x10fba5['id'],'VoiceQueueId':_0x43aa78['id']});});});});});}})[_0xe2f2('0x27')](respondWithStatusCode(_0x2c3601,null))[_0xe2f2('0x4d')](handleError(_0x2c3601,null));};exports[_0xe2f2('0x80')]=function(_0x1fdbc1,_0x4b9b08,_0x156ab4){return db[_0xe2f2('0x6d')]['findAll']({'where':{'id':_0x1fdbc1[_0xe2f2('0x3d')][_0xe2f2('0x81')]},'attributes':['id'],'include':[{'model':db[_0xe2f2('0x6e')],'as':_0xe2f2('0x74'),'attributes':['id'],'raw':!![]}]})[_0xe2f2('0x27')](handleEntityNotFound(_0x4b9b08,null))[_0xe2f2('0x27')](function(_0x9ef1e2){var _0x2b04d0=_[_0xe2f2('0x2f')](_0x9ef1e2,'id');var _0x3b0917=[];var _0x46edb5=[];var _0x103859=squel['select']();_0x103859[_0xe2f2('0x82')](_0xe2f2('0x83'))[_0xe2f2('0x84')](_0xe2f2('0x85'),'tq')[_0xe2f2('0x86')](_0xe2f2('0x87'),'ut',_0xe2f2('0x88'))[_0xe2f2('0x47')](_0xe2f2('0x89'),_0x1fdbc1[_0xe2f2('0x4f')]['id']);for(var _0x392d4b=0x0;_0x392d4b<_0x9ef1e2[_0xe2f2('0x42')];_0x392d4b+=0x1){let _0x1242e2=_0x9ef1e2[_0x392d4b];for(var _0x35d44f=0x0;_0x35d44f<_0x1242e2[_0xe2f2('0x74')]['length'];_0x35d44f+=0x1){let _0x31d108=_0x1242e2[_0xe2f2('0x74')][_0x35d44f];var _0x15c532=_0x103859['clone']();_0x15c532[_0xe2f2('0x47')]('ut.UserId\x20=\x20?',_0x31d108['id']);_0x46edb5['push'](db[_0xe2f2('0x75')][_0xe2f2('0x3d')](_0x15c532['toString'](),{'type':db[_0xe2f2('0x75')][_0xe2f2('0x8a')]['SELECT']})[_0xe2f2('0x27')](function(_0x2d2c1a){if(_0x2d2c1a[_0xe2f2('0x42')]===0x1){return _0x31d108['id'];}else{var _0x3d9485=_[_0xe2f2('0x8b')](_[_0xe2f2('0x2f')](_0x2d2c1a,_0xe2f2('0x8c')),function(_0x10d41e){return _[_0xe2f2('0x31')](_0x2b04d0,_0x10d41e);});if(_0x3d9485){return _0x31d108['id'];}}}));}}return BPromise[_0xe2f2('0x8d')](_0x46edb5)['then'](function(_0x4f0ea1){_0x3b0917=_(_0x3b0917)['union'](_0x4f0ea1)[_0xe2f2('0x8e')]()[_0xe2f2('0x30')]();return db[_0xe2f2('0x38')][_0xe2f2('0x59')]({'where':{'id':_0x1fdbc1[_0xe2f2('0x4f')]['id']}})[_0xe2f2('0x27')](function(_0x35b15b){return db['sequelize'][_0xe2f2('0x76')](function(_0x43cd51){return _0x35b15b[_0xe2f2('0x80')](_0x1fdbc1['query'][_0xe2f2('0x81')],{'transaction':_0x43cd51})[_0xe2f2('0x27')](function(){if(!_[_0xe2f2('0x8f')](_0x3b0917)){return _0x35b15b['removeAgents'](_0x3b0917,{'transaction':_0x43cd51})[_0xe2f2('0x27')](function(){return db[_0xe2f2('0x7b')][_0xe2f2('0x28')]({'where':{'VoiceQueueId':_0x1fdbc1[_0xe2f2('0x4f')]['id'],'UserId':_0x3b0917},'transaction':_0x43cd51});});}})[_0xe2f2('0x27')](function(){_0x3b0917[_0xe2f2('0x7d')](function(_0x51c72f){socket[_0xe2f2('0x7e')](_0xe2f2('0x90'),{'UserId':_0x51c72f,'VoiceQueueId':_0x35b15b['id']});});});});});});})[_0xe2f2('0x27')](respondWithStatusCode(_0x4b9b08,null))['catch'](handleError(_0x4b9b08,null));};exports['addAgents']=function(_0x17e5a8,_0x31dda2,_0x37eb5c){var _0xf9a714,_0x4ef8c9;return db['VoiceQueue'][_0xe2f2('0x59')]({'where':{'id':_0x17e5a8[_0xe2f2('0x4f')]['id']}})['then'](handleEntityNotFound(_0x31dda2,null))['then'](function(_0x18ec86){if(_0x18ec86){_0x4ef8c9=_0x18ec86;return _0x18ec86['addAgents'](_0x17e5a8[_0xe2f2('0x54')][_0xe2f2('0x81')],_[_0xe2f2('0x60')](_0x17e5a8['body'],['ids','id'])||{})[_0xe2f2('0x91')](function(_0x4f3438){for(var _0x40ab98=0x0;_0x40ab98<_0x17e5a8[_0xe2f2('0x54')][_0xe2f2('0x81')][_0xe2f2('0x42')];_0x40ab98+=0x1){socket['emit'](_0xe2f2('0x7f'),{'UserId':Number(_0x17e5a8[_0xe2f2('0x54')][_0xe2f2('0x81')][_0x40ab98]),'VoiceQueueId':Number(_0x17e5a8[_0xe2f2('0x4f')]['id'])});}return _0x4f3438;});}})[_0xe2f2('0x27')](function(_0xb649d3){_0xf9a714=_0xb649d3||[];if(_0x4ef8c9){return db[_0xe2f2('0x6e')][_0xe2f2('0x4b')]({'where':{'id':_0x17e5a8['body']['ids']},'attributes':['id',_0xe2f2('0x33'),_0xe2f2('0x6f'),_0xe2f2('0x70'),_0xe2f2('0x71')],'raw':!![]});}})[_0xe2f2('0x27')](function(_0x4e22b9){if(!_['isEmpty'](_0x4e22b9)){var _0x57e099=[];for(var _0x38ca2d=0x0;_0x38ca2d<_0x4e22b9[_0xe2f2('0x42')];_0x38ca2d++){if(_0x4e22b9[_0x38ca2d][_0xe2f2('0x6f')]){_0x57e099[_0xe2f2('0x92')](db[_0xe2f2('0x7b')][_0xe2f2('0x78')]({'membername':_0x4e22b9[_0x38ca2d][_0xe2f2('0x33')],'UserId':_0x4e22b9[_0x38ca2d]['id'],'queue_name':_0x4ef8c9[_0xe2f2('0x33')],'VoiceQueueId':_0x4ef8c9['id'],'interface':_[_0xe2f2('0x93')](_0x4e22b9[_0x38ca2d][_0xe2f2('0x71')])?util[_0xe2f2('0x94')](_0xe2f2('0x7c'),_0x4e22b9[_0x38ca2d][_0xe2f2('0x33')]):_0x4e22b9[_0x38ca2d][_0xe2f2('0x71')],'paused':_0x4e22b9[_0x38ca2d]['voicePause']||![],'penalty':_0x17e5a8[_0xe2f2('0x54')][_0xe2f2('0x73')]||0x0}));}}return BPromise['all'](_0x57e099);}})[_0xe2f2('0x27')](function(){return _0xf9a714;})[_0xe2f2('0x27')](respondWithResult(_0x31dda2,null))[_0xe2f2('0x4d')](handleError(_0x31dda2,null));};exports[_0xe2f2('0x95')]=function(_0x2711be,_0x5c6e01,_0x7d3f5d){return db[_0xe2f2('0x38')][_0xe2f2('0x59')]({'where':{'id':_0x2711be[_0xe2f2('0x4f')]['id']}})[_0xe2f2('0x27')](handleEntityNotFound(_0x5c6e01,null))[_0xe2f2('0x27')](function(_0x5f2e4d){if(_0x5f2e4d){return _0x5f2e4d[_0xe2f2('0x95')](_0x2711be[_0xe2f2('0x3d')][_0xe2f2('0x81')])[_0xe2f2('0x27')](function(){if(_['isArray'](_0x2711be[_0xe2f2('0x3d')][_0xe2f2('0x81')])){for(var _0x220ba5=0x0;_0x220ba5<_0x2711be['query'][_0xe2f2('0x81')]['length'];_0x220ba5+=0x1){socket[_0xe2f2('0x7e')](_0xe2f2('0x90'),{'UserId':Number(_0x2711be[_0xe2f2('0x3d')]['ids'][_0x220ba5]),'VoiceQueueId':Number(_0x2711be[_0xe2f2('0x4f')]['id'])});}}else{socket[_0xe2f2('0x7e')](_0xe2f2('0x90'),{'UserId':Number(_0x2711be[_0xe2f2('0x3d')][_0xe2f2('0x81')]),'VoiceQueueId':Number(_0x2711be[_0xe2f2('0x4f')]['id'])});}});}})[_0xe2f2('0x27')](function(_0x2dd678){return db[_0xe2f2('0x7b')]['destroy']({'where':{'VoiceQueueId':_0x2711be[_0xe2f2('0x4f')]['id'],'UserId':_0x2711be[_0xe2f2('0x3d')][_0xe2f2('0x81')]}})[_0xe2f2('0x27')](function(){return _0x2dd678;});})['then'](respondWithStatusCode(_0x5c6e01,null))['catch'](handleError(_0x5c6e01,null));};exports['getAgents']=function(_0x49671c,_0x337048,_0x28e113){var _0x276f7f={};var _0x1e0ec7={};var _0x2efee0;var _0x17e563;return db[_0xe2f2('0x38')][_0xe2f2('0x64')]({'where':{'id':_0x49671c['params']['id']}})[_0xe2f2('0x27')](handleEntityNotFound(_0x337048,null))[_0xe2f2('0x27')](function(_0x47a65e){if(_0x47a65e){_0x2efee0=_0x47a65e;_0x1e0ec7['model']=_[_0xe2f2('0x50')](db[_0xe2f2('0x6e')][_0xe2f2('0x39')]);_0x1e0ec7[_0xe2f2('0x3d')]=_[_0xe2f2('0x50')](_0x49671c['query']);_0x1e0ec7['filters']=_[_0xe2f2('0x3f')](_0x1e0ec7[_0xe2f2('0x3c')],_0x1e0ec7[_0xe2f2('0x3d')]);_0x276f7f[_0xe2f2('0x41')]=_[_0xe2f2('0x3f')](_0x1e0ec7['model'],qs['fields'](_0x49671c['query'][_0xe2f2('0x40')]));_0x276f7f['attributes']=_0x276f7f[_0xe2f2('0x41')]['length']?_0x276f7f[_0xe2f2('0x41')]:_0x1e0ec7['model'];_0x276f7f[_0xe2f2('0x45')]=qs[_0xe2f2('0x46')](_0x49671c[_0xe2f2('0x3d')][_0xe2f2('0x46')]);_0x276f7f[_0xe2f2('0x47')]=qs[_0xe2f2('0x3e')](_[_0xe2f2('0x48')](_0x49671c['query'],_0x1e0ec7[_0xe2f2('0x3e')]));if(_0x49671c[_0xe2f2('0x3d')][_0xe2f2('0x2d')]){_0x276f7f['where']=_[_0xe2f2('0x49')](_0x276f7f[_0xe2f2('0x47')],{'$or':_[_0xe2f2('0x2f')](_0x276f7f['attributes'],function(_0x5c29e2){var _0x188934={};_0x188934[_0x5c29e2]={'$like':'%'+_0x49671c[_0xe2f2('0x3d')][_0xe2f2('0x2d')]+'%'};return _0x188934;})});}_0x276f7f=_[_0xe2f2('0x49')]({},_0x276f7f,_0x49671c[_0xe2f2('0x4a')]);return _0x2efee0[_0xe2f2('0x96')](_0x276f7f);}})['then'](function(_0xf58071){if(_0xf58071){_0x17e563=_0xf58071[_0xe2f2('0x42')];if(!_0x49671c[_0xe2f2('0x3d')]['hasOwnProperty'](_0xe2f2('0x44'))){_0x276f7f[_0xe2f2('0x1e')]=qs[_0xe2f2('0x1e')](_0x49671c[_0xe2f2('0x3d')][_0xe2f2('0x1e')]);_0x276f7f['offset']=qs['offset'](_0x49671c[_0xe2f2('0x3d')]['offset']);}return _0x2efee0[_0xe2f2('0x96')](_0x276f7f);}})[_0xe2f2('0x27')](function(_0x4eb658){if(_0x4eb658){return _0x4eb658?{'count':_0x17e563,'rows':_0x4eb658}:null;}})[_0xe2f2('0x27')](respondWithResult(_0x337048,null))[_0xe2f2('0x4d')](handleError(_0x337048,null));};exports[_0xe2f2('0x97')]=function(_0x32fc9e,_0x226872,_0x4603cd){var _0x1fdb81={};var _0x5a39af={};var _0x5ebb2a;var _0x24c265;return db[_0xe2f2('0x38')][_0xe2f2('0x64')]({'where':{'id':_0x32fc9e[_0xe2f2('0x4f')]['id']}})[_0xe2f2('0x27')](handleEntityNotFound(_0x226872,null))[_0xe2f2('0x27')](function(_0x337124){if(_0x337124){_0x5ebb2a=_0x337124;_0x5a39af[_0xe2f2('0x3c')]=_[_0xe2f2('0x50')](db['UserVoiceQueueRt']['rawAttributes']);_0x5a39af[_0xe2f2('0x3d')]=_[_0xe2f2('0x50')](_0x32fc9e[_0xe2f2('0x3d')]);_0x5a39af['filters']=_[_0xe2f2('0x3f')](_0x5a39af['model'],_0x5a39af['query']);_0x1fdb81[_0xe2f2('0x41')]=_[_0xe2f2('0x3f')](_0x5a39af['model'],qs['fields'](_0x32fc9e[_0xe2f2('0x3d')][_0xe2f2('0x40')]));_0x1fdb81['attributes']=_0x1fdb81[_0xe2f2('0x41')][_0xe2f2('0x42')]?_0x1fdb81[_0xe2f2('0x41')]:_0x5a39af[_0xe2f2('0x3c')];_0x1fdb81[_0xe2f2('0x45')]=qs[_0xe2f2('0x46')](_0x32fc9e['query'][_0xe2f2('0x46')]);_0x1fdb81[_0xe2f2('0x47')]=qs[_0xe2f2('0x3e')](_[_0xe2f2('0x48')](_0x32fc9e['query'],_0x5a39af[_0xe2f2('0x3e')]));if(_0x32fc9e[_0xe2f2('0x3d')][_0xe2f2('0x2d')]){_0x1fdb81[_0xe2f2('0x47')]=_[_0xe2f2('0x49')](_0x1fdb81[_0xe2f2('0x47')],{'$or':_[_0xe2f2('0x2f')](_0x1fdb81['attributes'],function(_0x43236a){var _0x4d0214={};_0x4d0214[_0x43236a]={'$like':'%'+_0x32fc9e[_0xe2f2('0x3d')][_0xe2f2('0x2d')]+'%'};return _0x4d0214;})});}_0x1fdb81=_[_0xe2f2('0x49')]({},_0x1fdb81,_0x32fc9e['options']);return _0x5ebb2a[_0xe2f2('0x97')](_0x1fdb81);}})['then'](function(_0x51625a){if(_0x51625a){_0x24c265=_0x51625a[_0xe2f2('0x42')];if(!_0x32fc9e[_0xe2f2('0x3d')]['hasOwnProperty']('nolimit')){_0x1fdb81[_0xe2f2('0x1e')]=qs[_0xe2f2('0x1e')](_0x32fc9e['query'][_0xe2f2('0x1e')]);_0x1fdb81[_0xe2f2('0x1c')]=qs[_0xe2f2('0x1c')](_0x32fc9e[_0xe2f2('0x3d')][_0xe2f2('0x1c')]);}return _0x5ebb2a[_0xe2f2('0x97')](_0x1fdb81);}})[_0xe2f2('0x27')](function(_0x5cd92d){return _0x5cd92d?{'count':_0x24c265,'rows':_0x5cd92d}:null;})[_0xe2f2('0x27')](respondWithResult(_0x226872,null))[_0xe2f2('0x4d')](handleError(_0x226872,null));};exports[_0xe2f2('0x98')]=function(_0x2106f1,_0x52caaa,_0x2daf0c){var _0x2f57bf={};var _0x4bd471={};var _0x34836b;var _0x276a7b;return db[_0xe2f2('0x38')][_0xe2f2('0x64')]({'where':{'id':_0x2106f1[_0xe2f2('0x4f')]['id']}})['then'](handleEntityNotFound(_0x52caaa,null))['then'](function(_0x51e3f8){if(_0x51e3f8){_0x34836b=_0x51e3f8;_0x4bd471[_0xe2f2('0x3c')]=_[_0xe2f2('0x50')](db[_0xe2f2('0x99')][_0xe2f2('0x39')]);_0x4bd471[_0xe2f2('0x3d')]=_[_0xe2f2('0x50')](_0x2106f1[_0xe2f2('0x3d')]);_0x4bd471[_0xe2f2('0x3e')]=_['intersection'](_0x4bd471[_0xe2f2('0x3c')],_0x4bd471[_0xe2f2('0x3d')]);_0x2f57bf['attributes']=_[_0xe2f2('0x3f')](_0x4bd471[_0xe2f2('0x3c')],qs[_0xe2f2('0x40')](_0x2106f1[_0xe2f2('0x3d')]['fields']));_0x2f57bf['attributes']=_0x2f57bf[_0xe2f2('0x41')][_0xe2f2('0x42')]?_0x2f57bf[_0xe2f2('0x41')]:_0x4bd471[_0xe2f2('0x3c')];_0x2f57bf['order']=qs['sort'](_0x2106f1[_0xe2f2('0x3d')]['sort']);_0x2f57bf[_0xe2f2('0x47')]=qs['filters'](_[_0xe2f2('0x48')](_0x2106f1[_0xe2f2('0x3d')],_0x4bd471[_0xe2f2('0x3e')]));if(_0x2106f1[_0xe2f2('0x3d')][_0xe2f2('0x2d')]){_0x2f57bf[_0xe2f2('0x47')]=_[_0xe2f2('0x49')](_0x2f57bf['where'],{'$or':_[_0xe2f2('0x2f')](_0x2f57bf[_0xe2f2('0x41')],function(_0x1bf2c2){var _0x2e0c5d={};_0x2e0c5d[_0x1bf2c2]={'$like':'%'+_0x2106f1['query'][_0xe2f2('0x2d')]+'%'};return _0x2e0c5d;})});}_0x2f57bf=_[_0xe2f2('0x49')]({},_0x2f57bf,_0x2106f1[_0xe2f2('0x4a')]);return _0x34836b['getLists'](_0x2f57bf);}})[_0xe2f2('0x27')](function(_0x36f59f){if(_0x36f59f){_0x276a7b=_0x36f59f['length'];if(!_0x2106f1[_0xe2f2('0x3d')][_0xe2f2('0x43')]('nolimit')){_0x2f57bf[_0xe2f2('0x1e')]=qs[_0xe2f2('0x1e')](_0x2106f1['query'][_0xe2f2('0x1e')]);_0x2f57bf[_0xe2f2('0x1c')]=qs[_0xe2f2('0x1c')](_0x2106f1[_0xe2f2('0x3d')][_0xe2f2('0x1c')]);}return _0x34836b[_0xe2f2('0x98')](_0x2f57bf);}})[_0xe2f2('0x27')](function(_0x35045f){if(_0x35045f){return _0x35045f?{'count':_0x276a7b,'rows':_0x35045f}:null;}})['then'](respondWithResult(_0x52caaa,null))['catch'](handleError(_0x52caaa,null));};exports[_0xe2f2('0x9a')]=function(_0x52b6df,_0x1517cf,_0x27d607){var _0x335577=moment()[_0xe2f2('0x94')](_0xe2f2('0x9b'));var _0x2d5908,_0x4d6bc2;return db['VoiceQueue']['find']({'where':{'id':_0x52b6df['params']['id']}})[_0xe2f2('0x27')](handleEntityNotFound(_0x1517cf,null))[_0xe2f2('0x27')](function(_0x4f539a){if(_0x4f539a){_0x4d6bc2=_0x4f539a;return _0x4f539a['addLists'](_0x52b6df[_0xe2f2('0x54')][_0xe2f2('0x81')],_[_0xe2f2('0x60')](_0x52b6df['body'],[_0xe2f2('0x81'),'id'])||{});}return null;})[_0xe2f2('0x91')](function(_0x4fa412){var _0x5b6289;_0x2d5908=_0x4fa412||[];var _0x4d4a06=[];if(_0x4fa412){for(var _0x43c7cc=0x0;_0x43c7cc<_0x4fa412[_0xe2f2('0x42')];_0x43c7cc+=0x1){var _0x386839=_0x4fa412[_0x43c7cc][_0xe2f2('0x29')]({'plain':!![]});_0x4d6bc2[_0xe2f2('0x9c')]=_0x52b6df['body'][_0xe2f2('0x9c')]?_0x52b6df[_0xe2f2('0x54')][_0xe2f2('0x9c')]:_0x4d6bc2[_0xe2f2('0x9c')];switch(_0x4d6bc2[_0xe2f2('0x9c')]){case _0xe2f2('0x9d'):_0x5b6289=squel[_0xe2f2('0x9e')]()[_0xe2f2('0x9f')](_0xe2f2('0xa0'))[_0xe2f2('0xa1')]([_0xe2f2('0xa2'),'scheduledAt',_0xe2f2('0xa3'),_0xe2f2('0xa4'),_0xe2f2('0x66'),'createdAt',_0xe2f2('0x62')],squel[_0xe2f2('0xa5')]()[_0xe2f2('0x82')]('phone','phone')['field']('\x27'+_0x335577+'\x27',_0xe2f2('0xa6'))['field']('id',_0xe2f2('0xa3'))[_0xe2f2('0x82')](_0x386839[_0xe2f2('0xa7')][_0xe2f2('0xa8')](),'ListId')[_0xe2f2('0x82')](_0x52b6df[_0xe2f2('0x4f')]['id'][_0xe2f2('0xa8')](),'VoiceQueueId')['field']('\x27'+_0x335577+'\x27',_0xe2f2('0x61'))['field']('\x27'+_0x335577+'\x27',_0xe2f2('0x62'))[_0xe2f2('0x84')](_0xe2f2('0xa9'))[_0xe2f2('0x47')](_0xe2f2('0xaa'))[_0xe2f2('0x47')](_0xe2f2('0xab'),_0x386839[_0xe2f2('0xa7')][_0xe2f2('0xa8')]())['where'](_0xe2f2('0xac'))[_0xe2f2('0x47')](_0xe2f2('0xad'),squel[_0xe2f2('0xa5')]()[_0xe2f2('0x82')]('COALESCE(calleridnum,\x27\x27)')[_0xe2f2('0x84')]('cm_hopper_final')[_0xe2f2('0x47')](_0xe2f2('0x89'),_0x52b6df[_0xe2f2('0x4f')]['id'][_0xe2f2('0xa8')]()))[_0xe2f2('0x47')](_0xe2f2('0xad'),squel[_0xe2f2('0xa5')]()[_0xe2f2('0x82')]('COALESCE(phone,\x27\x27)')[_0xe2f2('0x84')]('cm_hopper')[_0xe2f2('0x47')](_0xe2f2('0x89'),_0x52b6df[_0xe2f2('0x4f')]['id'][_0xe2f2('0xa8')]())))[_0xe2f2('0xa8')]();break;case _0xe2f2('0xae'):_0x5b6289=squel[_0xe2f2('0x9e')]()[_0xe2f2('0x9f')](_0xe2f2('0xa0'))[_0xe2f2('0xa1')]([_0xe2f2('0xa2'),_0xe2f2('0xa6'),_0xe2f2('0xa3'),_0xe2f2('0xa4'),_0xe2f2('0x66'),_0xe2f2('0x61'),_0xe2f2('0x62')],squel[_0xe2f2('0xa5')]()['field']('phone',_0xe2f2('0xa2'))['field']('\x27'+_0x335577+'\x27',_0xe2f2('0xa6'))[_0xe2f2('0x82')]('id',_0xe2f2('0xa3'))[_0xe2f2('0x82')](_0x386839[_0xe2f2('0xa7')][_0xe2f2('0xa8')](),_0xe2f2('0xa4'))[_0xe2f2('0x82')](_0x52b6df[_0xe2f2('0x4f')]['id']['toString'](),_0xe2f2('0x66'))[_0xe2f2('0x82')]('\x27'+_0x335577+'\x27','createdAt')[_0xe2f2('0x82')]('\x27'+_0x335577+'\x27',_0xe2f2('0x62'))[_0xe2f2('0x84')]('cm_contacts')[_0xe2f2('0x47')](_0xe2f2('0xaa'))[_0xe2f2('0x47')](_0xe2f2('0xab'),_0x386839[_0xe2f2('0xa7')][_0xe2f2('0xa8')]())[_0xe2f2('0x47')](_0xe2f2('0xac'))[_0xe2f2('0x47')]('phone\x20NOT\x20IN\x20(?)',squel[_0xe2f2('0xa5')]()[_0xe2f2('0x82')]('COALESCE(phone,\x27\x27)')['from'](_0xe2f2('0xa0'))['where'](_0xe2f2('0x89'),_0x52b6df[_0xe2f2('0x4f')]['id']['toString']())))[_0xe2f2('0xa8')]();break;default:_0x5b6289=squel[_0xe2f2('0x9e')]()[_0xe2f2('0x9f')]('cm_hopper')[_0xe2f2('0xa1')]([_0xe2f2('0xa2'),_0xe2f2('0xa6'),'ContactId',_0xe2f2('0xa4'),'VoiceQueueId',_0xe2f2('0x61'),_0xe2f2('0x62')],squel[_0xe2f2('0xa5')]()['field'](_0xe2f2('0xa2'),_0xe2f2('0xa2'))[_0xe2f2('0x82')]('\x27'+_0x335577+'\x27',_0xe2f2('0xa6'))[_0xe2f2('0x82')]('id',_0xe2f2('0xa3'))[_0xe2f2('0x82')](_0x386839[_0xe2f2('0xa7')]['toString'](),_0xe2f2('0xa4'))[_0xe2f2('0x82')](_0x52b6df[_0xe2f2('0x4f')]['id'][_0xe2f2('0xa8')](),_0xe2f2('0x66'))[_0xe2f2('0x82')]('\x27'+_0x335577+'\x27',_0xe2f2('0x61'))[_0xe2f2('0x82')]('\x27'+_0x335577+'\x27',_0xe2f2('0x62'))[_0xe2f2('0x84')](_0xe2f2('0xa9'))[_0xe2f2('0x47')](_0xe2f2('0xaa'))[_0xe2f2('0x47')]('ListId\x20=\x20?',_0x386839[_0xe2f2('0xa7')][_0xe2f2('0xa8')]())[_0xe2f2('0x47')](_0xe2f2('0xac')))[_0xe2f2('0xa8')]();}_0x4d4a06['push'](db['sequelize'][_0xe2f2('0x3d')](_0x5b6289));}return BPromise[_0xe2f2('0x8d')](_0x4d4a06);}})['then'](function(){var _0x29d8a6=[];var _0xb9d9a4=squel['insert']()[_0xe2f2('0x9f')](_0xe2f2('0xaf'))[_0xe2f2('0xa1')]([_0xe2f2('0xb0'),_0xe2f2('0xa2'),'OrderBy',_0xe2f2('0x61'),_0xe2f2('0x62')],squel[_0xe2f2('0xa5')]()['field'](_0xe2f2('0xb1'))['field'](_0xe2f2('0xb2'))[_0xe2f2('0x82')](_0xe2f2('0xb3'))[_0xe2f2('0x82')]('\x27'+_0x335577+'\x27','createdAt')[_0xe2f2('0x82')]('\x27'+_0x335577+'\x27','updatedAt')[_0xe2f2('0x84')](_0xe2f2('0xb4'),'ci')[_0xe2f2('0x86')](_0xe2f2('0xa0'),'h',_0xe2f2('0xb5'))[_0xe2f2('0x47')](_0xe2f2('0xb6'),_0x335577)[_0xe2f2('0x47')](_0xe2f2('0xb7'),'PHONE'))[_0xe2f2('0xa8')]();_0x29d8a6[_0xe2f2('0x92')](db[_0xe2f2('0x75')]['query'](_0xb9d9a4));return BPromise[_0xe2f2('0x8d')](_0x29d8a6);})[_0xe2f2('0x27')](function(){return _0x2d5908;})[_0xe2f2('0x27')](respondWithResult(_0x1517cf,null))[_0xe2f2('0x4d')](handleError(_0x1517cf,null));};exports[_0xe2f2('0xb8')]=function(_0x4d4aed,_0x41d7ab,_0x4bf576){return db[_0xe2f2('0x38')][_0xe2f2('0x59')]({'where':{'id':_0x4d4aed[_0xe2f2('0x4f')]['id']}})[_0xe2f2('0x27')](handleEntityNotFound(_0x41d7ab,null))[_0xe2f2('0x27')](function(_0x38c96b){if(_0x38c96b){return _0x38c96b[_0xe2f2('0xb8')](_0x4d4aed[_0xe2f2('0x3d')][_0xe2f2('0x81')]);}})[_0xe2f2('0x27')](function(_0x55a85a){if(_0x55a85a){return db[_0xe2f2('0x65')][_0xe2f2('0x28')]({'where':{'ListId':_0x4d4aed[_0xe2f2('0x3d')][_0xe2f2('0x81')],'VoiceQueueId':_0x4d4aed[_0xe2f2('0x4f')]['id']}})[_0xe2f2('0x27')](function(){return _0x55a85a;});}})[_0xe2f2('0x27')](respondWithStatusCode(_0x41d7ab,null))['catch'](handleError(_0x41d7ab,null));};exports[_0xe2f2('0xb9')]=function(_0x5aa6c1,_0x200b5e,_0x13f7dc){var _0x5399dc={};var _0xd6b726={};var _0x1bf81b;var _0x1fec81;return db[_0xe2f2('0x38')][_0xe2f2('0x64')]({'where':{'id':_0x5aa6c1[_0xe2f2('0x4f')]['id']}})[_0xe2f2('0x27')](handleEntityNotFound(_0x200b5e,null))['then'](function(_0x12e16a){if(_0x12e16a){_0x1bf81b=_0x12e16a;_0xd6b726[_0xe2f2('0x3c')]=_[_0xe2f2('0x50')](db['CmList']['rawAttributes']);_0xd6b726[_0xe2f2('0x3d')]=_[_0xe2f2('0x50')](_0x5aa6c1[_0xe2f2('0x3d')]);_0xd6b726[_0xe2f2('0x3e')]=_[_0xe2f2('0x3f')](_0xd6b726[_0xe2f2('0x3c')],_0xd6b726[_0xe2f2('0x3d')]);_0x5399dc['attributes']=_[_0xe2f2('0x3f')](_0xd6b726[_0xe2f2('0x3c')],qs[_0xe2f2('0x40')](_0x5aa6c1[_0xe2f2('0x3d')]['fields']));_0x5399dc[_0xe2f2('0x41')]=_0x5399dc['attributes']['length']?_0x5399dc[_0xe2f2('0x41')]:_0xd6b726[_0xe2f2('0x3c')];_0x5399dc[_0xe2f2('0x45')]=qs['sort'](_0x5aa6c1[_0xe2f2('0x3d')]['sort']);_0x5399dc[_0xe2f2('0x47')]=qs[_0xe2f2('0x3e')](_[_0xe2f2('0x48')](_0x5aa6c1[_0xe2f2('0x3d')],_0xd6b726[_0xe2f2('0x3e')]));if(_0x5aa6c1[_0xe2f2('0x3d')][_0xe2f2('0x2d')]){_0x5399dc[_0xe2f2('0x47')]=_['merge'](_0x5399dc[_0xe2f2('0x47')],{'$or':_[_0xe2f2('0x2f')](_0x5399dc['attributes'],function(_0x477d83){var _0x31b17b={};_0x31b17b[_0x477d83]={'$like':'%'+_0x5aa6c1['query']['filter']+'%'};return _0x31b17b;})});}_0x5399dc=_[_0xe2f2('0x49')]({},_0x5399dc,_0x5aa6c1[_0xe2f2('0x4a')]);return _0x1bf81b[_0xe2f2('0xb9')](_0x5399dc);}})[_0xe2f2('0x27')](function(_0x24a7d1){if(_0x24a7d1){_0x1fec81=_0x24a7d1[_0xe2f2('0x42')];if(!_0x5aa6c1[_0xe2f2('0x3d')][_0xe2f2('0x43')](_0xe2f2('0x44'))){_0x5399dc[_0xe2f2('0x1e')]=qs[_0xe2f2('0x1e')](_0x5aa6c1[_0xe2f2('0x3d')][_0xe2f2('0x1e')]);_0x5399dc['offset']=qs['offset'](_0x5aa6c1['query'][_0xe2f2('0x1c')]);}return _0x1bf81b[_0xe2f2('0xb9')](_0x5399dc);}})['then'](function(_0x337513){if(_0x337513){return _0x337513?{'count':_0x1fec81,'rows':_0x337513}:null;}})['then'](respondWithResult(_0x200b5e,null))[_0xe2f2('0x4d')](handleError(_0x200b5e,null));};exports[_0xe2f2('0xba')]=function(_0xb6c63b,_0x5c3096,_0x5b6caf){var _0x4a4d97,_0xb59f70;return db[_0xe2f2('0x38')][_0xe2f2('0x59')]({'where':{'id':_0xb6c63b[_0xe2f2('0x4f')]['id']}})[_0xe2f2('0x27')](handleEntityNotFound(_0x5c3096,null))['then'](function(_0x902e80){if(_0x902e80){_0xb59f70=_0x902e80;return _0x902e80[_0xe2f2('0xba')](_0xb6c63b[_0xe2f2('0x54')][_0xe2f2('0x81')],_[_0xe2f2('0x60')](_0xb6c63b['body'],[_0xe2f2('0x81'),'id'])||{});}return null;})['spread'](function(_0x36adfe){var _0x56ac1b;_0x4a4d97=_0x36adfe||[];var _0x2a72de=[];if(_0x36adfe){for(var _0x1ed64f=0x0;_0x1ed64f<_0x36adfe['length'];_0x1ed64f+=0x1){var _0x3a8a1d=_0x36adfe[_0x1ed64f][_0xe2f2('0x29')]({'plain':!![]});_0x56ac1b=squel['insert']()['into'](_0xe2f2('0xbb'))[_0xe2f2('0xa1')]([_0xe2f2('0xa2'),_0xe2f2('0xa3'),_0xe2f2('0xa4'),_0xe2f2('0x66'),_0xe2f2('0x61'),_0xe2f2('0x62')],squel['select']()[_0xe2f2('0x82')]('phone',_0xe2f2('0xa2'))[_0xe2f2('0x82')]('id',_0xe2f2('0xa3'))['field'](_0x3a8a1d['CmListId'][_0xe2f2('0xa8')](),'ListId')[_0xe2f2('0x82')](_0xb6c63b[_0xe2f2('0x4f')]['id'][_0xe2f2('0xa8')](),_0xe2f2('0x66'))['field'](_0xe2f2('0xbc'),'createdAt')[_0xe2f2('0x82')](_0xe2f2('0xbc'),_0xe2f2('0x62'))[_0xe2f2('0x84')](_0xe2f2('0xa9'))['where'](_0xe2f2('0xaa'))['where'](_0xe2f2('0xab'),_0x3a8a1d[_0xe2f2('0xa7')][_0xe2f2('0xa8')]())[_0xe2f2('0x47')](_0xe2f2('0xac')))['toString']();_0x2a72de['push'](db['sequelize']['query'](_0x56ac1b));}return BPromise['all'](_0x2a72de);}})[_0xe2f2('0x27')](function(){return _0x4a4d97;})['then'](respondWithResult(_0x5c3096,null))[_0xe2f2('0x4d')](handleError(_0x5c3096,null));};exports[_0xe2f2('0xbd')]=function(_0x288c35,_0x580b01,_0x5abe50){return db[_0xe2f2('0x38')][_0xe2f2('0x59')]({'where':{'id':_0x288c35[_0xe2f2('0x4f')]['id']}})[_0xe2f2('0x27')](handleEntityNotFound(_0x580b01,null))[_0xe2f2('0x27')](function(_0xe14659){if(_0xe14659){return _0xe14659[_0xe2f2('0xbd')](_0x288c35['query'][_0xe2f2('0x81')]);}})[_0xe2f2('0x27')](function(_0x47c6ad){if(_0x47c6ad){return db[_0xe2f2('0x6a')]['destroy']({'where':{'ListId':_0x288c35[_0xe2f2('0x3d')][_0xe2f2('0x81')],'VoiceQueueId':_0x288c35[_0xe2f2('0x4f')]['id']}})['then'](function(){return _0x47c6ad;});}})['then'](respondWithStatusCode(_0x580b01,null))[_0xe2f2('0x4d')](handleError(_0x580b01,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index 2d8f1fd..e61a9b7 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 _0xe23b=['remove','emit','hasOwnProperty','hook','exports','events','VoiceQueue','update'];(function(_0x4ce74d,_0x64bffc){var _0x5c6839=function(_0x330a98){while(--_0x330a98){_0x4ce74d['push'](_0x4ce74d['shift']());}};_0x5c6839(++_0x64bffc);}(_0xe23b,0x95));var _0xbe23=function(_0x1774d3,_0x1cb4fc){_0x1774d3=_0x1774d3-0x0;var _0x5c9509=_0xe23b[_0x1774d3];return _0x5c9509;};'use strict';var EventEmitter=require(_0xbe23('0x0'));var VoiceQueue=require('../../mysqldb')['db'][_0xbe23('0x1')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xbe23('0x2'),'afterDestroy':_0xbe23('0x3')};function emitEvent(_0x196fb8){return function(_0x2583ca,_0x27b286,_0x50c146){VoiceQueueEvents[_0xbe23('0x4')](_0x196fb8+':'+_0x2583ca['id'],_0x2583ca);VoiceQueueEvents[_0xbe23('0x4')](_0x196fb8,_0x2583ca);_0x50c146(null);};}for(var e in events){if(events[_0xbe23('0x5')](e)){var event=events[e];VoiceQueue[_0xbe23('0x6')](e,emitEvent(event));}}module[_0xbe23('0x7')]=VoiceQueueEvents; \ No newline at end of file +var _0x9870=['VoiceQueue','setMaxListeners','remove','emit','hasOwnProperty','exports','events','../../mysqldb'];(function(_0x3dfffd,_0x31a7c4){var _0x42e938=function(_0x39913a){while(--_0x39913a){_0x3dfffd['push'](_0x3dfffd['shift']());}};_0x42e938(++_0x31a7c4);}(_0x9870,0x136));var _0x0987=function(_0x58a493,_0x15eb55){_0x58a493=_0x58a493-0x0;var _0x34c60a=_0x9870[_0x58a493];return _0x34c60a;};'use strict';var EventEmitter=require(_0x0987('0x0'));var VoiceQueue=require(_0x0987('0x1'))['db'][_0x0987('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x0987('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x0987('0x4')};function emitEvent(_0x2da735){return function(_0x46d7e2,_0x56b2fe,_0xadda0e){VoiceQueueEvents[_0x0987('0x5')](_0x2da735+':'+_0x46d7e2['id'],_0x46d7e2);VoiceQueueEvents[_0x0987('0x5')](_0x2da735,_0x46d7e2);_0xadda0e(null);};}for(var e in events){if(events[_0x0987('0x6')](e)){var event=events[e];VoiceQueue['hook'](e,emitEvent(event));}}module[_0x0987('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 e4733a7..1c52f9e 100644 --- a/server/api/voiceQueue/voiceQueue.model.js +++ b/server/api/voiceQueue/voiceQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../config/environment','./voiceQueue.attributes','exports','define','VoiceQueue','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x4bcaa8,_0x285b61){var _0x2cc1a9=function(_0x569d3b){while(--_0x569d3b){_0x4bcaa8['push'](_0x4bcaa8['shift']());}};_0x2cc1a9(++_0x285b61);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0xa9e0[_0x2bf141];return _0x48277b;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9c44=['request-promise','path','./voiceQueue.attributes','define','VoiceQueue','voice_queues','../../config/logger','api','moment','bluebird'];(function(_0x91d012,_0x3e6b65){var _0x559e7a=function(_0x354121){while(--_0x354121){_0x91d012['push'](_0x91d012['shift']());}};_0x559e7a(++_0x3e6b65);}(_0x9c44,0x178));var _0x49c4=function(_0x45d55e,_0x2fede3){_0x45d55e=_0x45d55e-0x0;var _0x29812a=_0x9c44[_0x45d55e];return _0x29812a;};'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 diff --git a/server/api/voiceQueue/voiceQueue.rpc.js b/server/api/voiceQueue/voiceQueue.rpc.js index bc32a2d..42dca13 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 _0x4013=['ShowVoiceQueue','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','redis','socket.io-emitter','./voiceQueue.socket','register','then','info','VoiceQueue,\x20%s,\x20%s','VoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','GetVoiceQueue','VoiceQueue','findAll','options','raw','where','limit','include','map','model','attributes','debug'];(function(_0x2ab365,_0xa3812e){var _0x49fef3=function(_0x29b883){while(--_0x29b883){_0x2ab365['push'](_0x2ab365['shift']());}};_0x49fef3(++_0xa3812e);}(_0x4013,0x161));var _0x3401=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0x4013[_0x36eaaa];return _0x461349;};'use strict';var _=require(_0x3401('0x0'));var util=require(_0x3401('0x1'));var moment=require('moment');var BPromise=require(_0x3401('0x2'));var rs=require(_0x3401('0x3'));var fs=require('fs');var Redis=require(_0x3401('0x4'));var db=require(_0x3401('0x5'))['db'];var utils=require(_0x3401('0x6'));var logger=require('../../config/logger')(_0x3401('0x7'));var config=require('../../config/environment');var jayson=require(_0x3401('0x8'));var client=jayson[_0x3401('0x9')][_0x3401('0xa')]({'port':0x232a});config[_0x3401('0xb')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x3401('0xc'))(new Redis(config[_0x3401('0xb')]));require(_0x3401('0xd'))[_0x3401('0xe')](socket);function respondWithRpcPromise(_0x3d2ae6,_0x5337fd,_0x21aeda){return new BPromise(function(_0x35e862,_0x12a7d0){return client['request'](_0x3d2ae6,_0x21aeda)[_0x3401('0xf')](function(_0x1ae4c4){logger[_0x3401('0x10')](_0x3401('0x11'),_0x5337fd,'request\x20sent');logger['debug'](_0x3401('0x12'),_0x5337fd,_0x3401('0x13'),JSON[_0x3401('0x14')](_0x1ae4c4));if(_0x1ae4c4[_0x3401('0x15')]){if(_0x1ae4c4['error'][_0x3401('0x16')]===0x1f4){logger[_0x3401('0x15')](_0x3401('0x11'),_0x5337fd,_0x1ae4c4[_0x3401('0x15')]['message']);return _0x12a7d0(_0x1ae4c4['error'][_0x3401('0x17')]);}logger['error'](_0x3401('0x11'),_0x5337fd,_0x1ae4c4[_0x3401('0x15')]['message']);return _0x35e862(_0x1ae4c4[_0x3401('0x15')][_0x3401('0x17')]);}else{logger['info'](_0x3401('0x11'),_0x5337fd,_0x3401('0x13'));_0x35e862(_0x1ae4c4[_0x3401('0x18')][_0x3401('0x17')]);}})['catch'](function(_0x227507){logger['error'](_0x3401('0x11'),_0x5337fd,_0x227507);_0x12a7d0(_0x227507);});});}exports[_0x3401('0x19')]=function(_0x18a597){var _0x4c73c3=this;return new Promise(function(_0x40c74d,_0x31214e){return db[_0x3401('0x1a')][_0x3401('0x1b')]({'raw':_0x18a597['options']?_0x18a597[_0x3401('0x1c')][_0x3401('0x1d')]===undefined?!![]:![]:!![],'where':_0x18a597[_0x3401('0x1c')]?_0x18a597[_0x3401('0x1c')][_0x3401('0x1e')]||null:null,'attributes':_0x18a597['options']?_0x18a597[_0x3401('0x1c')]['attributes']||null:null,'limit':_0x18a597[_0x3401('0x1c')]?_0x18a597[_0x3401('0x1c')][_0x3401('0x1f')]||null:null,'include':_0x18a597[_0x3401('0x1c')]?_0x18a597[_0x3401('0x1c')][_0x3401('0x20')]?_[_0x3401('0x21')](_0x18a597[_0x3401('0x1c')]['include'],function(_0x3d1b2d){return{'model':db[_0x3d1b2d[_0x3401('0x22')]],'as':_0x3d1b2d['as'],'attributes':_0x3d1b2d[_0x3401('0x23')],'include':_0x3d1b2d[_0x3401('0x20')]?_['map'](_0x3d1b2d[_0x3401('0x20')],function(_0x3e5dee){return{'model':db[_0x3e5dee['model']],'as':_0x3e5dee['as'],'attributes':_0x3e5dee[_0x3401('0x23')],'include':_0x3e5dee[_0x3401('0x20')]?_[_0x3401('0x21')](_0x3e5dee['include'],function(_0xf73f7f){return{'model':db[_0xf73f7f['model']],'as':_0xf73f7f['as'],'attributes':_0xf73f7f['attributes']};}):[]};}):[]};}):[]:[]})[_0x3401('0xf')](function(_0x228117){logger[_0x3401('0x10')]('GetVoiceQueue',_0x18a597);logger[_0x3401('0x24')]('GetVoiceQueue',_0x18a597,JSON[_0x3401('0x14')](_0x228117));_0x40c74d(_0x228117);})['catch'](function(_0x28e15c){logger[_0x3401('0x15')]('GetVoiceQueue',_0x28e15c[_0x3401('0x17')],_0x18a597);_0x31214e(_0x4c73c3[_0x3401('0x15')](0x1f4,_0x28e15c['message']));});});};exports[_0x3401('0x25')]=function(_0x305fad){var _0x4f39b0=this;return new Promise(function(_0x4679a9,_0x506734){return db[_0x3401('0x1a')]['find']({'raw':_0x305fad[_0x3401('0x1c')]?_0x305fad['options']['raw']===undefined?!![]:![]:!![],'where':_0x305fad[_0x3401('0x1c')]?_0x305fad[_0x3401('0x1c')][_0x3401('0x1e')]||null:null,'attributes':_0x305fad['options']?_0x305fad[_0x3401('0x1c')][_0x3401('0x23')]||null:null,'include':_0x305fad[_0x3401('0x1c')]?_0x305fad[_0x3401('0x1c')][_0x3401('0x20')]?_[_0x3401('0x21')](_0x305fad['options'][_0x3401('0x20')],function(_0x151de2){return{'model':db[_0x151de2[_0x3401('0x22')]],'as':_0x151de2['as'],'attributes':_0x151de2[_0x3401('0x23')],'include':_0x151de2[_0x3401('0x20')]?_['map'](_0x151de2[_0x3401('0x20')],function(_0x1f9542){return{'model':db[_0x1f9542[_0x3401('0x22')]],'as':_0x1f9542['as'],'attributes':_0x1f9542['attributes'],'include':_0x1f9542[_0x3401('0x20')]?_[_0x3401('0x21')](_0x1f9542['include'],function(_0x2334b2){return{'model':db[_0x2334b2['model']],'as':_0x2334b2['as'],'attributes':_0x2334b2['attributes']};}):[]};}):[]};}):[]:[]})[_0x3401('0xf')](function(_0x4b0a1a){logger[_0x3401('0x10')]('ShowVoiceQueue',_0x305fad);logger[_0x3401('0x24')](_0x3401('0x25'),_0x305fad,JSON[_0x3401('0x14')](_0x4b0a1a));_0x4679a9(_0x4b0a1a);})[_0x3401('0x26')](function(_0x23bf6d){logger['error']('ShowVoiceQueue',_0x23bf6d[_0x3401('0x17')],_0x305fad);_0x506734(_0x4f39b0[_0x3401('0x15')](0x1f4,_0x23bf6d[_0x3401('0x17')]));});});}; \ No newline at end of file +var _0x9172=['catch','GetVoiceQueue','findAll','options','raw','where','limit','include','map','model','attributes','then','ShowVoiceQueue','VoiceQueue','find','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','register','request','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result'];(function(_0x1fafa5,_0x1aa281){var _0xcf08c9=function(_0x3af1b4){while(--_0x3af1b4){_0x1fafa5['push'](_0x1fafa5['shift']());}};_0xcf08c9(++_0x1aa281);}(_0x9172,0x14f));var _0x2917=function(_0x468b0f,_0x408566){_0x468b0f=_0x468b0f-0x0;var _0x3e74d9=_0x9172[_0x468b0f];return _0x3e74d9;};'use strict';var _=require(_0x2917('0x0'));var util=require(_0x2917('0x1'));var moment=require(_0x2917('0x2'));var BPromise=require('bluebird');var rs=require(_0x2917('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2917('0x4'))['db'];var utils=require(_0x2917('0x5'));var logger=require('../../config/logger')(_0x2917('0x6'));var config=require(_0x2917('0x7'));var jayson=require(_0x2917('0x8'));var client=jayson[_0x2917('0x9')]['http']({'port':0x232a});config[_0x2917('0xa')]=_[_0x2917('0xb')](config[_0x2917('0xa')],{'host':_0x2917('0xc'),'port':0x18eb});var socket=require(_0x2917('0xd'))(new Redis(config['redis']));require(_0x2917('0xe'))[_0x2917('0xf')](socket);function respondWithRpcPromise(_0x31a213,_0x5c687d,_0x2bed03){return new BPromise(function(_0x5e097c,_0x2aaa82){return client[_0x2917('0x10')](_0x31a213,_0x2bed03)['then'](function(_0x2eb6e4){logger[_0x2917('0x11')](_0x2917('0x12'),_0x5c687d,_0x2917('0x13'));logger[_0x2917('0x14')]('VoiceQueue,\x20%s,\x20%s,\x20%s',_0x5c687d,_0x2917('0x13'),JSON[_0x2917('0x15')](_0x2eb6e4));if(_0x2eb6e4[_0x2917('0x16')]){if(_0x2eb6e4[_0x2917('0x16')]['code']===0x1f4){logger[_0x2917('0x16')](_0x2917('0x12'),_0x5c687d,_0x2eb6e4[_0x2917('0x16')][_0x2917('0x17')]);return _0x2aaa82(_0x2eb6e4[_0x2917('0x16')]['message']);}logger[_0x2917('0x16')](_0x2917('0x12'),_0x5c687d,_0x2eb6e4[_0x2917('0x16')][_0x2917('0x17')]);return _0x5e097c(_0x2eb6e4[_0x2917('0x16')]['message']);}else{logger[_0x2917('0x11')](_0x2917('0x12'),_0x5c687d,'request\x20sent');_0x5e097c(_0x2eb6e4[_0x2917('0x18')][_0x2917('0x17')]);}})[_0x2917('0x19')](function(_0x4cd069){logger[_0x2917('0x16')](_0x2917('0x12'),_0x5c687d,_0x4cd069);_0x2aaa82(_0x4cd069);});});}exports[_0x2917('0x1a')]=function(_0x3b3884){var _0x3a7ded=this;return new Promise(function(_0x2a024f,_0x3769dd){return db['VoiceQueue'][_0x2917('0x1b')]({'raw':_0x3b3884[_0x2917('0x1c')]?_0x3b3884[_0x2917('0x1c')][_0x2917('0x1d')]===undefined?!![]:![]:!![],'where':_0x3b3884[_0x2917('0x1c')]?_0x3b3884[_0x2917('0x1c')][_0x2917('0x1e')]||null:null,'attributes':_0x3b3884[_0x2917('0x1c')]?_0x3b3884[_0x2917('0x1c')]['attributes']||null:null,'limit':_0x3b3884[_0x2917('0x1c')]?_0x3b3884[_0x2917('0x1c')][_0x2917('0x1f')]||null:null,'include':_0x3b3884[_0x2917('0x1c')]?_0x3b3884['options'][_0x2917('0x20')]?_[_0x2917('0x21')](_0x3b3884[_0x2917('0x1c')][_0x2917('0x20')],function(_0x2d4b26){return{'model':db[_0x2d4b26[_0x2917('0x22')]],'as':_0x2d4b26['as'],'attributes':_0x2d4b26[_0x2917('0x23')],'include':_0x2d4b26[_0x2917('0x20')]?_[_0x2917('0x21')](_0x2d4b26['include'],function(_0x1aae93){return{'model':db[_0x1aae93[_0x2917('0x22')]],'as':_0x1aae93['as'],'attributes':_0x1aae93[_0x2917('0x23')],'include':_0x1aae93[_0x2917('0x20')]?_[_0x2917('0x21')](_0x1aae93[_0x2917('0x20')],function(_0x5d8b91){return{'model':db[_0x5d8b91[_0x2917('0x22')]],'as':_0x5d8b91['as'],'attributes':_0x5d8b91['attributes']};}):[]};}):[]};}):[]:[]})[_0x2917('0x24')](function(_0x13316b){logger[_0x2917('0x11')](_0x2917('0x1a'),_0x3b3884);logger[_0x2917('0x14')](_0x2917('0x1a'),_0x3b3884,JSON[_0x2917('0x15')](_0x13316b));_0x2a024f(_0x13316b);})[_0x2917('0x19')](function(_0x3ea347){logger['error'](_0x2917('0x1a'),_0x3ea347[_0x2917('0x17')],_0x3b3884);_0x3769dd(_0x3a7ded[_0x2917('0x16')](0x1f4,_0x3ea347['message']));});});};exports[_0x2917('0x25')]=function(_0x15fc27){var _0x44e4a1=this;return new Promise(function(_0xb3148b,_0x250e9a){return db[_0x2917('0x26')][_0x2917('0x27')]({'raw':_0x15fc27[_0x2917('0x1c')]?_0x15fc27[_0x2917('0x1c')][_0x2917('0x1d')]===undefined?!![]:![]:!![],'where':_0x15fc27[_0x2917('0x1c')]?_0x15fc27[_0x2917('0x1c')]['where']||null:null,'attributes':_0x15fc27[_0x2917('0x1c')]?_0x15fc27[_0x2917('0x1c')]['attributes']||null:null,'include':_0x15fc27[_0x2917('0x1c')]?_0x15fc27[_0x2917('0x1c')]['include']?_['map'](_0x15fc27['options'][_0x2917('0x20')],function(_0x486838){return{'model':db[_0x486838['model']],'as':_0x486838['as'],'attributes':_0x486838[_0x2917('0x23')],'include':_0x486838[_0x2917('0x20')]?_[_0x2917('0x21')](_0x486838[_0x2917('0x20')],function(_0x507bd8){return{'model':db[_0x507bd8[_0x2917('0x22')]],'as':_0x507bd8['as'],'attributes':_0x507bd8[_0x2917('0x23')],'include':_0x507bd8[_0x2917('0x20')]?_[_0x2917('0x21')](_0x507bd8['include'],function(_0x44a406){return{'model':db[_0x44a406[_0x2917('0x22')]],'as':_0x44a406['as'],'attributes':_0x44a406[_0x2917('0x23')]};}):[]};}):[]};}):[]:[]})[_0x2917('0x24')](function(_0x4f0083){logger[_0x2917('0x11')](_0x2917('0x25'),_0x15fc27);logger[_0x2917('0x14')]('ShowVoiceQueue',_0x15fc27,JSON['stringify'](_0x4f0083));_0xb3148b(_0x4f0083);})['catch'](function(_0x92a834){logger[_0x2917('0x16')](_0x2917('0x25'),_0x92a834[_0x2917('0x17')],_0x15fc27);_0x250e9a(_0x44e4a1[_0x2917('0x16')](0x1f4,_0x92a834[_0x2917('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index 2fcb0bc..62231e3 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 _0x48f2=['removeListener','length','voiceQueue:','update','emit'];(function(_0x52fd3d,_0x3af718){var _0x49b06d=function(_0x2f4a2b){while(--_0x2f4a2b){_0x52fd3d['push'](_0x52fd3d['shift']());}};_0x49b06d(++_0x3af718);}(_0x48f2,0x1a2));var _0x248f=function(_0x548278,_0x415a9a){_0x548278=_0x548278-0x0;var _0x2aded8=_0x48f2[_0x548278];return _0x2aded8;};'use strict';var VoiceQueueEvents=require('./voiceQueue.events');var events=['save','remove',_0x248f('0x0')];function createListener(_0x22da47,_0x1c9e2d){return function(_0x3c0d7a){_0x1c9e2d[_0x248f('0x1')](_0x22da47,_0x3c0d7a);};}function removeListener(_0xd38851,_0x4908a5){return function(){VoiceQueueEvents[_0x248f('0x2')](_0xd38851,_0x4908a5);};}exports['register']=function(_0x3ea48d){for(var _0x4eb604=0x0,_0x3e5a1c=events[_0x248f('0x3')];_0x4eb604<_0x3e5a1c;_0x4eb604++){var _0x3c21c4=events[_0x4eb604];var _0xc4e209=createListener(_0x248f('0x4')+_0x3c21c4,_0x3ea48d);VoiceQueueEvents['on'](_0x3c21c4,_0xc4e209);}}; \ No newline at end of file +var _0xfa16=['removeListener','register','length','./voiceQueue.events','save','remove','update','emit'];(function(_0x48202b,_0x1608d7){var _0x4eee0e=function(_0x3522a5){while(--_0x3522a5){_0x48202b['push'](_0x48202b['shift']());}};_0x4eee0e(++_0x1608d7);}(_0xfa16,0x1d3));var _0x6fa1=function(_0x356dde,_0x21b303){_0x356dde=_0x356dde-0x0;var _0x57ed2f=_0xfa16[_0x356dde];return _0x57ed2f;};'use strict';var VoiceQueueEvents=require(_0x6fa1('0x0'));var events=[_0x6fa1('0x1'),_0x6fa1('0x2'),_0x6fa1('0x3')];function createListener(_0x55ad5b,_0x558ae8){return function(_0x46f649){_0x558ae8[_0x6fa1('0x4')](_0x55ad5b,_0x46f649);};}function removeListener(_0x213745,_0x2a9ab6){return function(){VoiceQueueEvents[_0x6fa1('0x5')](_0x213745,_0x2a9ab6);};}exports[_0x6fa1('0x6')]=function(_0x2ee394){for(var _0x3aeed9=0x0,_0x4ea151=events[_0x6fa1('0x7')];_0x3aeed9<_0x4ea151;_0x3aeed9++){var _0x269630=events[_0x3aeed9];var _0x62665e=createListener('voiceQueue:'+_0x269630,_0x2ee394);VoiceQueueEvents['on'](_0x269630,_0x62665e);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index e5c9725..00b4dc8 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 _0x2f54=['destroy','multer','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','./voiceQueueReport.controller','isAuthenticated','index','get','/describe','/index','getVoiceQueuesReport','/:id','show','post','create','put','delete'];(function(_0x343a58,_0x7dc868){var _0x3992e4=function(_0x1f2d63){while(--_0x1f2d63){_0x343a58['push'](_0x343a58['shift']());}};_0x3992e4(++_0x7dc868);}(_0x2f54,0x1a5));var _0x42f5=function(_0x536c66,_0x570b6b){_0x536c66=_0x536c66-0x0;var _0x221d57=_0x2f54[_0x536c66];return _0x221d57;};'use strict';var multer=require(_0x42f5('0x0'));var util=require(_0x42f5('0x1'));var path=require(_0x42f5('0x2'));var timeout=require(_0x42f5('0x3'));var express=require(_0x42f5('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x42f5('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x42f5('0x6'));var controller=require(_0x42f5('0x7'));router['get']('/',auth[_0x42f5('0x8')](),controller[_0x42f5('0x9')]);router[_0x42f5('0xa')](_0x42f5('0xb'),auth[_0x42f5('0x8')](),controller['describe']);router['get'](_0x42f5('0xc'),auth[_0x42f5('0x8')](),controller[_0x42f5('0xd')]);router[_0x42f5('0xa')](_0x42f5('0xe'),auth[_0x42f5('0x8')](),controller[_0x42f5('0xf')]);router[_0x42f5('0x10')]('/',auth['isAuthenticated'](),controller[_0x42f5('0x11')]);router[_0x42f5('0x12')](_0x42f5('0xe'),auth[_0x42f5('0x8')](),controller['update']);router[_0x42f5('0x13')](_0x42f5('0xe'),auth[_0x42f5('0x8')](),controller[_0x42f5('0x14')]);module['exports']=router; \ No newline at end of file +var _0xc1b2=['multer','util','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','get','isAuthenticated','index','/describe','describe','/index','/:id','post','create','put','update','delete','exports'];(function(_0x10eb11,_0x1c2aaa){var _0x1aad42=function(_0x2192f6){while(--_0x2192f6){_0x10eb11['push'](_0x10eb11['shift']());}};_0x1aad42(++_0x1c2aaa);}(_0xc1b2,0x64));var _0x2c1b=function(_0x1db6d5,_0xc35095){_0x1db6d5=_0x1db6d5-0x0;var _0x4c6990=_0xc1b2[_0x1db6d5];return _0x4c6990;};'use strict';var multer=require(_0x2c1b('0x0'));var util=require(_0x2c1b('0x1'));var path=require('path');var timeout=require(_0x2c1b('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x2c1b('0x3'));var interaction=require(_0x2c1b('0x4'));var config=require(_0x2c1b('0x5'));var controller=require(_0x2c1b('0x6'));router[_0x2c1b('0x7')]('/',auth[_0x2c1b('0x8')](),controller[_0x2c1b('0x9')]);router['get'](_0x2c1b('0xa'),auth[_0x2c1b('0x8')](),controller[_0x2c1b('0xb')]);router[_0x2c1b('0x7')](_0x2c1b('0xc'),auth['isAuthenticated'](),controller['getVoiceQueuesReport']);router[_0x2c1b('0x7')](_0x2c1b('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x2c1b('0xe')]('/',auth[_0x2c1b('0x8')](),controller[_0x2c1b('0xf')]);router[_0x2c1b('0x10')](_0x2c1b('0xd'),auth[_0x2c1b('0x8')](),controller[_0x2c1b('0x11')]);router[_0x2c1b('0x12')](_0x2c1b('0xd'),auth[_0x2c1b('0x8')](),controller['destroy']);module[_0x2c1b('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 7890ee5..0657764 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 _0x929a=['exports','STRING','DATE','getDataValue','queuecallerjoinAt','YYYY-MM-DD\x20HH:mm:ss','diff','seconds','setDataValue','queuecallerleaveAt','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','moment'];(function(_0x7eeb16,_0x570aa4){var _0x87a1e4=function(_0x385f71){while(--_0x385f71){_0x7eeb16['push'](_0x7eeb16['shift']());}};_0x87a1e4(++_0x570aa4);}(_0x929a,0x195));var _0xa929=function(_0x2a9fd5,_0x594de0){_0x2a9fd5=_0x2a9fd5-0x0;var _0x369c8d=_0x929a[_0x2a9fd5];return _0x369c8d;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xa929('0x0'));module[_0xa929('0x1')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xa929('0x2')]},'calleridnum':{'type':Sequelize[_0xa929('0x2')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0xa929('0x2')]},'queuecallerjoinAt':{'type':Sequelize[_0xa929('0x3')]},'queuecallerleaveAt':{'type':Sequelize[_0xa929('0x3')],'set':function(_0x214534){var _0x44e5e5=moment(_0x214534);var _0x46a486=moment(this[_0xa929('0x4')](_0xa929('0x5')))['format'](_0xa929('0x6'));var _0xcf28d8=_0x44e5e5[_0xa929('0x7')](_0x46a486,_0xa929('0x8'));this[_0xa929('0x9')](_0xa929('0xa'),_0x214534);this['setDataValue']('holdtime',_0xcf28d8||null);}},'position':{'type':Sequelize['INTEGER']},'count':{'type':Sequelize[_0xa929('0xb')]},'queuecallerabandon':{'type':Sequelize[_0xa929('0xc')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize['DATE']},'queuecallercomplete':{'type':Sequelize[_0xa929('0xc')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize['DATE']},'queuecallerexit':{'type':Sequelize[_0xa929('0xc')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0xa929('0x3')]},'queuecallerexitreason':{'type':Sequelize['STRING'],'comment':'COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'},'originalposition':{'type':Sequelize[_0xa929('0xb')]},'channel':{'type':Sequelize[_0xa929('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0xa929('0x2')]},'accountcode':{'type':Sequelize[_0xa929('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0xa929('0x2')]},'priority':{'type':Sequelize[_0xa929('0x2')]},'holdtime':{'type':Sequelize[_0xa929('0xb')]},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xa929('0xc')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xa929('0x2')],'comment':_0xa929('0xd')},'transferexten':{'type':Sequelize[_0xa929('0x2')]},'transferuniqueid':{'type':Sequelize[_0xa929('0x2')]},'disposition':{'type':Sequelize[_0xa929('0x2')]},'secondDisposition':{'type':Sequelize[_0xa929('0x2')]},'thirdDisposition':{'type':Sequelize[_0xa929('0x2')]},'queuecallerenterreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'note':{'type':Sequelize[_0xa929('0x2')]}}; \ No newline at end of file +var _0x240b=['INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','moment','exports','STRING','DATE','getDataValue','format','diff','seconds','setDataValue','queuecallerleaveAt','holdtime'];(function(_0x4be3d5,_0x488ffc){var _0x4738f3=function(_0x1395b8){while(--_0x1395b8){_0x4be3d5['push'](_0x4be3d5['shift']());}};_0x4738f3(++_0x488ffc);}(_0x240b,0x73));var _0xb240=function(_0x560ffd,_0x5d0f15){_0x560ffd=_0x560ffd-0x0;var _0x2af735=_0x240b[_0x560ffd];return _0x2af735;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xb240('0x0'));module[_0xb240('0x1')]={'type':{'type':Sequelize[_0xb240('0x2')]},'uniqueid':{'type':Sequelize[_0xb240('0x2')]},'calleridnum':{'type':Sequelize[_0xb240('0x2')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0xb240('0x2')]},'queuecallerjoinAt':{'type':Sequelize[_0xb240('0x3')]},'queuecallerleaveAt':{'type':Sequelize[_0xb240('0x3')],'set':function(_0x1a906d){var _0x4d02f9=moment(_0x1a906d);var _0x109f0f=moment(this[_0xb240('0x4')]('queuecallerjoinAt'))[_0xb240('0x5')]('YYYY-MM-DD\x20HH:mm:ss');var _0x37093f=_0x4d02f9[_0xb240('0x6')](_0x109f0f,_0xb240('0x7'));this[_0xb240('0x8')](_0xb240('0x9'),_0x1a906d);this['setDataValue'](_0xb240('0xa'),_0x37093f||null);}},'position':{'type':Sequelize[_0xb240('0xb')]},'count':{'type':Sequelize['INTEGER']},'queuecallerabandon':{'type':Sequelize[_0xb240('0xc')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0xb240('0x3')]},'queuecallercomplete':{'type':Sequelize[_0xb240('0xc')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize['DATE']},'queuecallerexit':{'type':Sequelize[_0xb240('0xc')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize['DATE']},'queuecallerexitreason':{'type':Sequelize[_0xb240('0x2')],'comment':'COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'},'originalposition':{'type':Sequelize[_0xb240('0xb')]},'channel':{'type':Sequelize[_0xb240('0x2')]},'connectedlinenum':{'type':Sequelize[_0xb240('0x2')]},'connectedlinename':{'type':Sequelize[_0xb240('0x2')]},'accountcode':{'type':Sequelize[_0xb240('0x2')]},'context':{'type':Sequelize[_0xb240('0x2')]},'exten':{'type':Sequelize[_0xb240('0x2')]},'priority':{'type':Sequelize[_0xb240('0x2')]},'holdtime':{'type':Sequelize[_0xb240('0xb')]},'mohtime':{'type':Sequelize[_0xb240('0xb')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xb240('0xc')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0xb240('0xc')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xb240('0x2')],'comment':_0xb240('0xd')},'transferexten':{'type':Sequelize[_0xb240('0x2')]},'transferuniqueid':{'type':Sequelize[_0xb240('0x2')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xb240('0x2')]},'thirdDisposition':{'type':Sequelize[_0xb240('0x2')]},'queuecallerenterreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'note':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index c80d15b..c6430bf 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 _0xc2ed=['update','then','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','filters','attributes','length','hasOwnProperty','limit','order','sort','pick','filter','where','merge','VIRTUAL','options','include','VoiceQueueReport','rows','catch','show','params','keys','intersection','fields','includeAll','find','create','body','destroy','describe','getVoiceQueuesReport','nolimit','eml-format','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','count','set','apply','save'];(function(_0xc8a11,_0x347a33){var _0x55a500=function(_0x288d05){while(--_0x288d05){_0xc8a11['push'](_0xc8a11['shift']());}};_0x55a500(++_0x347a33);}(_0xc2ed,0x1d4));var _0xdc2e=function(_0x102e37,_0x14a181){_0x102e37=_0x102e37-0x0;var _0x35a07c=_0xc2ed[_0x102e37];return _0x35a07c;};'use strict';var emlformat=require(_0xdc2e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xdc2e('0x1'));var jsonpatch=require(_0xdc2e('0x2'));var rp=require(_0xdc2e('0x3'));var moment=require(_0xdc2e('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xdc2e('0x5'));var path=require(_0xdc2e('0x6'));var sox=require(_0xdc2e('0x7'));var csv=require(_0xdc2e('0x8'));var ejs=require(_0xdc2e('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xdc2e('0xa'));var squel=require(_0xdc2e('0xb'));var crypto=require(_0xdc2e('0xc'));var jsforce=require(_0xdc2e('0xd'));var deskjs=require(_0xdc2e('0xe'));var toCsv=require(_0xdc2e('0x8'));var querystring=require(_0xdc2e('0xf'));var Papa=require('papaparse');var Redis=require(_0xdc2e('0x10'));var authService=require(_0xdc2e('0x11'));var qs=require(_0xdc2e('0x12'));var as=require(_0xdc2e('0x13'));var hardwareService=require(_0xdc2e('0x14'));var logger=require(_0xdc2e('0x15'))(_0xdc2e('0x16'));var utils=require(_0xdc2e('0x17'));var config=require(_0xdc2e('0x18'));var licenseUtil=require(_0xdc2e('0x19'));var db=require(_0xdc2e('0x1a'))['db'];config[_0xdc2e('0x1b')]=_[_0xdc2e('0x1c')](config[_0xdc2e('0x1b')],{'host':_0xdc2e('0x1d'),'port':0x18eb});var socket=require(_0xdc2e('0x1e'))(new Redis(config[_0xdc2e('0x1b')]));require('./voiceQueueReport.socket')[_0xdc2e('0x1f')](socket);function respondWithStatusCode(_0x1d2710,_0x245b5e){_0x245b5e=_0x245b5e||0xcc;return function(_0x566fe4){if(_0x566fe4){return _0x1d2710[_0xdc2e('0x20')](_0x245b5e);}return _0x1d2710[_0xdc2e('0x21')](_0x245b5e)[_0xdc2e('0x22')]();};}function respondWithResult(_0x56e2da,_0x56a734){_0x56a734=_0x56a734||0xc8;return function(_0x23bef2){if(_0x23bef2){return _0x56e2da[_0xdc2e('0x21')](_0x56a734)[_0xdc2e('0x23')](_0x23bef2);}};}function respondWithFilteredResult(_0x54e8e0,_0x33857c){return function(_0xc33e05){if(_0xc33e05){var _0x43241a=typeof _0x33857c[_0xdc2e('0x24')]===_0xdc2e('0x25')&&typeof _0x33857c['limit']==='undefined';var _0x593970=_0xc33e05[_0xdc2e('0x26')];var _0x6916a5=_0x43241a?0x0:_0x33857c[_0xdc2e('0x24')];var _0x22fa03=_0x43241a?_0xc33e05[_0xdc2e('0x26')]:_0x33857c[_0xdc2e('0x24')]+_0x33857c['limit'];var _0x5df9a6;if(_0x22fa03>=_0x593970){_0x22fa03=_0x593970;_0x5df9a6=0xc8;}else{_0x5df9a6=0xce;}_0x54e8e0[_0xdc2e('0x21')](_0x5df9a6);return _0x54e8e0[_0xdc2e('0x27')]('Content-Range',_0x6916a5+'-'+_0x22fa03+'/'+_0x593970)[_0xdc2e('0x23')](_0xc33e05);}return null;};}function patchUpdates(_0x126627){return function(_0x985fa5){try{jsonpatch[_0xdc2e('0x28')](_0x985fa5,_0x126627,!![]);}catch(_0x5513c7){return BPromise['reject'](_0x5513c7);}return _0x985fa5[_0xdc2e('0x29')]();};}function saveUpdates(_0x2ab54f,_0x330751){return function(_0x2978fc){if(_0x2978fc){return _0x2978fc[_0xdc2e('0x2a')](_0x2ab54f)[_0xdc2e('0x2b')](function(_0x170c50){return _0x170c50;});}return null;};}function removeEntity(_0x108276,_0x194e93){return function(_0x4609eb){if(_0x4609eb){return _0x4609eb['destroy']()[_0xdc2e('0x2b')](function(){_0x108276[_0xdc2e('0x21')](0xcc)[_0xdc2e('0x22')]();});}};}function handleEntityNotFound(_0x4f9e10,_0x41275c){return function(_0x4e3e85){if(!_0x4e3e85){_0x4f9e10[_0xdc2e('0x20')](0x194);}return _0x4e3e85;};}function handleError(_0x3772bb,_0x54e86c){_0x54e86c=_0x54e86c||0x1f4;return function(_0x26e8f7){logger[_0xdc2e('0x2c')](_0x26e8f7[_0xdc2e('0x2d')]);if(_0x26e8f7[_0xdc2e('0x2e')]){delete _0x26e8f7[_0xdc2e('0x2e')];}_0x3772bb['status'](_0x54e86c)['send'](_0x26e8f7);};}exports[_0xdc2e('0x2f')]=function(_0x19d32e,_0x29869a){var _0x4944cb={},_0x26dae4={},_0x1f09da={'count':0x0,'rows':[]};var _0x27f0d0=_[_0xdc2e('0x30')](db['VoiceQueueReport'][_0xdc2e('0x31')],function(_0x10d71c){return{'name':_0x10d71c[_0xdc2e('0x32')],'type':_0x10d71c[_0xdc2e('0x33')][_0xdc2e('0x34')]};});_0x26dae4[_0xdc2e('0x35')]=_[_0xdc2e('0x30')](_0x27f0d0,_0xdc2e('0x2e'));_0x26dae4[_0xdc2e('0x36')]=_['keys'](_0x19d32e['query']);_0x26dae4[_0xdc2e('0x37')]=_['intersection'](_0x26dae4['model'],_0x26dae4[_0xdc2e('0x36')]);_0x4944cb[_0xdc2e('0x38')]=_['intersection'](_0x26dae4[_0xdc2e('0x35')],qs['fields'](_0x19d32e[_0xdc2e('0x36')]['fields']));_0x4944cb['attributes']=_0x4944cb[_0xdc2e('0x38')][_0xdc2e('0x39')]?_0x4944cb[_0xdc2e('0x38')]:_0x26dae4[_0xdc2e('0x35')];if(!_0x19d32e[_0xdc2e('0x36')][_0xdc2e('0x3a')]('nolimit')){_0x4944cb['limit']=qs[_0xdc2e('0x3b')](_0x19d32e[_0xdc2e('0x36')][_0xdc2e('0x3b')]);_0x4944cb[_0xdc2e('0x24')]=qs['offset'](_0x19d32e[_0xdc2e('0x36')][_0xdc2e('0x24')]);}_0x4944cb[_0xdc2e('0x3c')]=qs[_0xdc2e('0x3d')](_0x19d32e['query'][_0xdc2e('0x3d')]);_0x4944cb['where']=qs[_0xdc2e('0x37')](_[_0xdc2e('0x3e')](_0x19d32e[_0xdc2e('0x36')],_0x26dae4[_0xdc2e('0x37')]),_0x27f0d0);if(_0x19d32e[_0xdc2e('0x36')][_0xdc2e('0x3f')]){_0x4944cb[_0xdc2e('0x40')]=_[_0xdc2e('0x41')](_0x4944cb[_0xdc2e('0x40')],{'$or':_['map'](_0x27f0d0,function(_0x1fd0e1){if(_0x1fd0e1[_0xdc2e('0x33')]!==_0xdc2e('0x42')){var _0x54aa02={};_0x54aa02[_0x1fd0e1['name']]={'$like':'%'+_0x19d32e[_0xdc2e('0x36')][_0xdc2e('0x3f')]+'%'};return _0x54aa02;}})});}_0x4944cb=_[_0xdc2e('0x41')]({},_0x4944cb,_0x19d32e[_0xdc2e('0x43')]);var _0x564dba={'where':_0x4944cb[_0xdc2e('0x40')]};return db['VoiceQueueReport'][_0xdc2e('0x26')](_0x564dba)['then'](function(_0x256ea9){_0x1f09da[_0xdc2e('0x26')]=_0x256ea9;if(_0x19d32e['query']['includeAll']){_0x4944cb[_0xdc2e('0x44')]=[{'all':!![]}];}return db[_0xdc2e('0x45')]['findAll'](_0x4944cb);})['then'](function(_0x5c7253){_0x1f09da[_0xdc2e('0x46')]=_0x5c7253;return _0x1f09da;})[_0xdc2e('0x2b')](respondWithFilteredResult(_0x29869a,_0x4944cb))[_0xdc2e('0x47')](handleError(_0x29869a,null));};exports[_0xdc2e('0x48')]=function(_0x16a1d0,_0x3a73b3){var _0x2e718a={'raw':![],'where':{'id':_0x16a1d0[_0xdc2e('0x49')]['id']}},_0x1baa3e={};_0x1baa3e['model']=_[_0xdc2e('0x4a')](db[_0xdc2e('0x45')][_0xdc2e('0x31')]);_0x1baa3e[_0xdc2e('0x36')]=_[_0xdc2e('0x4a')](_0x16a1d0[_0xdc2e('0x36')]);_0x1baa3e[_0xdc2e('0x37')]=_[_0xdc2e('0x4b')](_0x1baa3e[_0xdc2e('0x35')],_0x1baa3e[_0xdc2e('0x36')]);_0x2e718a['attributes']=_[_0xdc2e('0x4b')](_0x1baa3e[_0xdc2e('0x35')],qs[_0xdc2e('0x4c')](_0x16a1d0[_0xdc2e('0x36')][_0xdc2e('0x4c')]));_0x2e718a[_0xdc2e('0x38')]=_0x2e718a['attributes'][_0xdc2e('0x39')]?_0x2e718a[_0xdc2e('0x38')]:_0x1baa3e[_0xdc2e('0x35')];if(_0x16a1d0[_0xdc2e('0x36')][_0xdc2e('0x4d')]){_0x2e718a['include']=[{'all':!![]}];}_0x2e718a=_[_0xdc2e('0x41')]({},_0x2e718a,_0x16a1d0['options']);return db[_0xdc2e('0x45')][_0xdc2e('0x4e')](_0x2e718a)['then'](handleEntityNotFound(_0x3a73b3,null))['then'](respondWithResult(_0x3a73b3,null))[_0xdc2e('0x47')](handleError(_0x3a73b3,null));};exports[_0xdc2e('0x4f')]=function(_0x2632b7,_0x96edc3){return db[_0xdc2e('0x45')][_0xdc2e('0x4f')](_0x2632b7['body'],{})['then'](respondWithResult(_0x96edc3,0xc9))[_0xdc2e('0x47')](handleError(_0x96edc3,null));};exports[_0xdc2e('0x2a')]=function(_0xb64df1,_0x4535e1){if(_0xb64df1[_0xdc2e('0x50')]['id']){delete _0xb64df1['body']['id'];}return db[_0xdc2e('0x45')][_0xdc2e('0x4e')]({'where':{'id':_0xb64df1[_0xdc2e('0x49')]['id']}})['then'](handleEntityNotFound(_0x4535e1,null))[_0xdc2e('0x2b')](saveUpdates(_0xb64df1['body'],null))[_0xdc2e('0x2b')](respondWithResult(_0x4535e1,null))[_0xdc2e('0x47')](handleError(_0x4535e1,null));};exports[_0xdc2e('0x51')]=function(_0x47e3b6,_0x3949f5){return db[_0xdc2e('0x45')][_0xdc2e('0x4e')]({'where':{'id':_0x47e3b6['params']['id']}})[_0xdc2e('0x2b')](handleEntityNotFound(_0x3949f5,null))[_0xdc2e('0x2b')](removeEntity(_0x3949f5,null))[_0xdc2e('0x47')](handleError(_0x3949f5,null));};exports[_0xdc2e('0x52')]=function(_0x2e369c,_0x3205b0){return db[_0xdc2e('0x45')][_0xdc2e('0x52')]()[_0xdc2e('0x2b')](respondWithResult(_0x3205b0,null))[_0xdc2e('0x47')](handleError(_0x3205b0,null));};exports[_0xdc2e('0x53')]=function(_0x30b8dc,_0x1279ae){var _0x4032ee={},_0x5335d8={},_0xf77dc4={'count':0x0,'rows':[]};_0x5335d8[_0xdc2e('0x35')]=_[_0xdc2e('0x4a')](db['VoiceQueueReport'][_0xdc2e('0x31')]);_0x5335d8['query']=_['keys'](_0x30b8dc['query']);_0x5335d8[_0xdc2e('0x37')]=_['intersection'](_0x5335d8[_0xdc2e('0x35')],_0x5335d8['query']);_0x4032ee['attributes']=_[_0xdc2e('0x4b')](_0x5335d8[_0xdc2e('0x35')],qs[_0xdc2e('0x4c')](_0x30b8dc[_0xdc2e('0x36')][_0xdc2e('0x4c')]));_0x4032ee[_0xdc2e('0x38')]=_0x4032ee['attributes'][_0xdc2e('0x39')]?_0x4032ee[_0xdc2e('0x38')]:_0x5335d8[_0xdc2e('0x35')];if(!_0x30b8dc[_0xdc2e('0x36')][_0xdc2e('0x3a')](_0xdc2e('0x54'))){_0x4032ee[_0xdc2e('0x3b')]=qs[_0xdc2e('0x3b')](_0x30b8dc['query'][_0xdc2e('0x3b')]);_0x4032ee[_0xdc2e('0x24')]=qs[_0xdc2e('0x24')](_0x30b8dc[_0xdc2e('0x36')][_0xdc2e('0x24')]);}_0x4032ee[_0xdc2e('0x3c')]=qs['sort'](_0x30b8dc[_0xdc2e('0x36')][_0xdc2e('0x3d')]);_0x4032ee[_0xdc2e('0x40')]=qs[_0xdc2e('0x37')](_['pick'](_0x30b8dc[_0xdc2e('0x36')],_0x5335d8['filters']));if(_0x30b8dc[_0xdc2e('0x36')]['filter']){_0x4032ee['where']=_['merge'](_0x4032ee[_0xdc2e('0x40')],{'$or':_['map'](_0x4032ee[_0xdc2e('0x38')],function(_0x44193d){var _0xcebc32={};_0xcebc32[_0x44193d]={'$like':'%'+_0x30b8dc['query'][_0xdc2e('0x3f')]+'%'};return _0xcebc32;})});}_0x4032ee=_[_0xdc2e('0x41')]({},_0x4032ee,_0x30b8dc[_0xdc2e('0x43')]);var _0x44fc39={'where':_0x4032ee['where']};return db[_0xdc2e('0x45')][_0xdc2e('0x26')](_0x44fc39)[_0xdc2e('0x2b')](function(_0x2ba923){_0xf77dc4[_0xdc2e('0x26')]=_0x2ba923;if(_0x30b8dc['query'][_0xdc2e('0x4d')]){_0x4032ee[_0xdc2e('0x44')]=[{'all':!![]}];}return db['VoiceQueueReport']['findAll'](_0x4032ee);})[_0xdc2e('0x2b')](function(_0xa64d75){_0xf77dc4[_0xdc2e('0x46')]=_0xa64d75;return _0xf77dc4;})[_0xdc2e('0x2b')](respondWithFilteredResult(_0x1279ae,_0x4032ee,'getVoiceQueuesReport'))[_0xdc2e('0x47')](handleError(_0x1279ae,null,'getVoiceQueuesReport'));}; \ No newline at end of file +var _0x3e7f=['bluebird','path','sox','to-csv','ejs','fs-extra','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','reject','save','update','destroy','then','error','stack','name','send','index','map','VoiceQueueReport','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','rows','catch','params','include','find','create','body','describe','getVoiceQueuesReport','nolimit','order','eml-format','rimraf','zip-dir','moment'];(function(_0x200c42,_0x566d60){var _0x140777=function(_0x46dec6){while(--_0x46dec6){_0x200c42['push'](_0x200c42['shift']());}};_0x140777(++_0x566d60);}(_0x3e7f,0x1dc));var _0xf3e7=function(_0x3de7d0,_0x5e89b0){_0x3de7d0=_0x3de7d0-0x0;var _0x1a2969=_0x3e7f[_0x3de7d0];return _0x1a2969;};'use strict';var emlformat=require(_0xf3e7('0x0'));var rimraf=require(_0xf3e7('0x1'));var zipdir=require(_0xf3e7('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xf3e7('0x3'));var BPromise=require(_0xf3e7('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xf3e7('0x5'));var sox=require(_0xf3e7('0x6'));var csv=require(_0xf3e7('0x7'));var ejs=require(_0xf3e7('0x8'));var fs=require('fs');var fs_extra=require(_0xf3e7('0x9'));var _=require('lodash');var squel=require(_0xf3e7('0xa'));var crypto=require('crypto');var jsforce=require(_0xf3e7('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xf3e7('0x7'));var querystring=require(_0xf3e7('0xc'));var Papa=require(_0xf3e7('0xd'));var Redis=require(_0xf3e7('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xf3e7('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf3e7('0x10'));var logger=require(_0xf3e7('0x11'))('api');var utils=require(_0xf3e7('0x12'));var config=require(_0xf3e7('0x13'));var licenseUtil=require(_0xf3e7('0x14'));var db=require(_0xf3e7('0x15'))['db'];config[_0xf3e7('0x16')]=_[_0xf3e7('0x17')](config[_0xf3e7('0x16')],{'host':_0xf3e7('0x18'),'port':0x18eb});var socket=require(_0xf3e7('0x19'))(new Redis(config[_0xf3e7('0x16')]));require('./voiceQueueReport.socket')[_0xf3e7('0x1a')](socket);function respondWithStatusCode(_0x5c7b3c,_0x3bab65){_0x3bab65=_0x3bab65||0xcc;return function(_0x2e8801){if(_0x2e8801){return _0x5c7b3c[_0xf3e7('0x1b')](_0x3bab65);}return _0x5c7b3c[_0xf3e7('0x1c')](_0x3bab65)[_0xf3e7('0x1d')]();};}function respondWithResult(_0x27d857,_0x10e612){_0x10e612=_0x10e612||0xc8;return function(_0x38e46a){if(_0x38e46a){return _0x27d857[_0xf3e7('0x1c')](_0x10e612)['json'](_0x38e46a);}};}function respondWithFilteredResult(_0x15e321,_0xe6ca2c){return function(_0x3bdaea){if(_0x3bdaea){var _0x5eed31=typeof _0xe6ca2c[_0xf3e7('0x1e')]===_0xf3e7('0x1f')&&typeof _0xe6ca2c[_0xf3e7('0x20')]==='undefined';var _0x2cbce6=_0x3bdaea[_0xf3e7('0x21')];var _0x530be0=_0x5eed31?0x0:_0xe6ca2c[_0xf3e7('0x1e')];var _0x40347a=_0x5eed31?_0x3bdaea[_0xf3e7('0x21')]:_0xe6ca2c[_0xf3e7('0x1e')]+_0xe6ca2c[_0xf3e7('0x20')];var _0x4ca886;if(_0x40347a>=_0x2cbce6){_0x40347a=_0x2cbce6;_0x4ca886=0xc8;}else{_0x4ca886=0xce;}_0x15e321['status'](_0x4ca886);return _0x15e321['set'](_0xf3e7('0x22'),_0x530be0+'-'+_0x40347a+'/'+_0x2cbce6)[_0xf3e7('0x23')](_0x3bdaea);}return null;};}function patchUpdates(_0x5980f1){return function(_0x3a763d){try{jsonpatch['apply'](_0x3a763d,_0x5980f1,!![]);}catch(_0x2279e2){return BPromise[_0xf3e7('0x24')](_0x2279e2);}return _0x3a763d[_0xf3e7('0x25')]();};}function saveUpdates(_0xfcc2e6,_0x3b3e3c){return function(_0x1fa69d){if(_0x1fa69d){return _0x1fa69d[_0xf3e7('0x26')](_0xfcc2e6)['then'](function(_0x326876){return _0x326876;});}return null;};}function removeEntity(_0x371636,_0x454185){return function(_0x2b5157){if(_0x2b5157){return _0x2b5157[_0xf3e7('0x27')]()[_0xf3e7('0x28')](function(){_0x371636[_0xf3e7('0x1c')](0xcc)[_0xf3e7('0x1d')]();});}};}function handleEntityNotFound(_0x2ba8ef,_0x18a1f3){return function(_0x2bcf38){if(!_0x2bcf38){_0x2ba8ef[_0xf3e7('0x1b')](0x194);}return _0x2bcf38;};}function handleError(_0x25cbe7,_0x313191){_0x313191=_0x313191||0x1f4;return function(_0x2138df){logger[_0xf3e7('0x29')](_0x2138df[_0xf3e7('0x2a')]);if(_0x2138df[_0xf3e7('0x2b')]){delete _0x2138df[_0xf3e7('0x2b')];}_0x25cbe7['status'](_0x313191)[_0xf3e7('0x2c')](_0x2138df);};}exports[_0xf3e7('0x2d')]=function(_0x1d1ab1,_0x25b70a){var _0x465f84={},_0x3a9084={},_0x27d28f={'count':0x0,'rows':[]};var _0x439396=_[_0xf3e7('0x2e')](db[_0xf3e7('0x2f')][_0xf3e7('0x30')],function(_0x57c4e6){return{'name':_0x57c4e6[_0xf3e7('0x31')],'type':_0x57c4e6['type'][_0xf3e7('0x32')]};});_0x3a9084[_0xf3e7('0x33')]=_['map'](_0x439396,_0xf3e7('0x2b'));_0x3a9084[_0xf3e7('0x34')]=_[_0xf3e7('0x35')](_0x1d1ab1[_0xf3e7('0x34')]);_0x3a9084[_0xf3e7('0x36')]=_['intersection'](_0x3a9084[_0xf3e7('0x33')],_0x3a9084['query']);_0x465f84[_0xf3e7('0x37')]=_[_0xf3e7('0x38')](_0x3a9084[_0xf3e7('0x33')],qs[_0xf3e7('0x39')](_0x1d1ab1[_0xf3e7('0x34')][_0xf3e7('0x39')]));_0x465f84[_0xf3e7('0x37')]=_0x465f84[_0xf3e7('0x37')][_0xf3e7('0x3a')]?_0x465f84[_0xf3e7('0x37')]:_0x3a9084[_0xf3e7('0x33')];if(!_0x1d1ab1[_0xf3e7('0x34')][_0xf3e7('0x3b')]('nolimit')){_0x465f84[_0xf3e7('0x20')]=qs[_0xf3e7('0x20')](_0x1d1ab1[_0xf3e7('0x34')][_0xf3e7('0x20')]);_0x465f84['offset']=qs[_0xf3e7('0x1e')](_0x1d1ab1['query'][_0xf3e7('0x1e')]);}_0x465f84['order']=qs['sort'](_0x1d1ab1['query'][_0xf3e7('0x3c')]);_0x465f84[_0xf3e7('0x3d')]=qs[_0xf3e7('0x36')](_[_0xf3e7('0x3e')](_0x1d1ab1[_0xf3e7('0x34')],_0x3a9084['filters']),_0x439396);if(_0x1d1ab1['query'][_0xf3e7('0x3f')]){_0x465f84[_0xf3e7('0x3d')]=_[_0xf3e7('0x40')](_0x465f84[_0xf3e7('0x3d')],{'$or':_[_0xf3e7('0x2e')](_0x439396,function(_0x2d2124){if(_0x2d2124[_0xf3e7('0x41')]!==_0xf3e7('0x42')){var _0x6f7f5d={};_0x6f7f5d[_0x2d2124[_0xf3e7('0x2b')]]={'$like':'%'+_0x1d1ab1[_0xf3e7('0x34')]['filter']+'%'};return _0x6f7f5d;}})});}_0x465f84=_[_0xf3e7('0x40')]({},_0x465f84,_0x1d1ab1[_0xf3e7('0x43')]);var _0x1368d1={'where':_0x465f84[_0xf3e7('0x3d')]};return db[_0xf3e7('0x2f')][_0xf3e7('0x21')](_0x1368d1)['then'](function(_0x42965d){_0x27d28f['count']=_0x42965d;if(_0x1d1ab1[_0xf3e7('0x34')][_0xf3e7('0x44')]){_0x465f84['include']=[{'all':!![]}];}return db[_0xf3e7('0x2f')]['findAll'](_0x465f84);})[_0xf3e7('0x28')](function(_0x1bf41d){_0x27d28f[_0xf3e7('0x45')]=_0x1bf41d;return _0x27d28f;})[_0xf3e7('0x28')](respondWithFilteredResult(_0x25b70a,_0x465f84))[_0xf3e7('0x46')](handleError(_0x25b70a,null));};exports['show']=function(_0x449095,_0x39c956){var _0x331a2c={'raw':![],'where':{'id':_0x449095[_0xf3e7('0x47')]['id']}},_0x528cf3={};_0x528cf3[_0xf3e7('0x33')]=_[_0xf3e7('0x35')](db['VoiceQueueReport'][_0xf3e7('0x30')]);_0x528cf3[_0xf3e7('0x34')]=_[_0xf3e7('0x35')](_0x449095['query']);_0x528cf3['filters']=_[_0xf3e7('0x38')](_0x528cf3[_0xf3e7('0x33')],_0x528cf3['query']);_0x331a2c[_0xf3e7('0x37')]=_[_0xf3e7('0x38')](_0x528cf3[_0xf3e7('0x33')],qs[_0xf3e7('0x39')](_0x449095[_0xf3e7('0x34')][_0xf3e7('0x39')]));_0x331a2c[_0xf3e7('0x37')]=_0x331a2c[_0xf3e7('0x37')]['length']?_0x331a2c['attributes']:_0x528cf3[_0xf3e7('0x33')];if(_0x449095[_0xf3e7('0x34')]['includeAll']){_0x331a2c[_0xf3e7('0x48')]=[{'all':!![]}];}_0x331a2c=_[_0xf3e7('0x40')]({},_0x331a2c,_0x449095[_0xf3e7('0x43')]);return db[_0xf3e7('0x2f')][_0xf3e7('0x49')](_0x331a2c)[_0xf3e7('0x28')](handleEntityNotFound(_0x39c956,null))[_0xf3e7('0x28')](respondWithResult(_0x39c956,null))[_0xf3e7('0x46')](handleError(_0x39c956,null));};exports[_0xf3e7('0x4a')]=function(_0x419fba,_0x286a27){return db[_0xf3e7('0x2f')]['create'](_0x419fba[_0xf3e7('0x4b')],{})[_0xf3e7('0x28')](respondWithResult(_0x286a27,0xc9))[_0xf3e7('0x46')](handleError(_0x286a27,null));};exports[_0xf3e7('0x26')]=function(_0x560ffa,_0x5410ad){if(_0x560ffa[_0xf3e7('0x4b')]['id']){delete _0x560ffa[_0xf3e7('0x4b')]['id'];}return db[_0xf3e7('0x2f')][_0xf3e7('0x49')]({'where':{'id':_0x560ffa[_0xf3e7('0x47')]['id']}})[_0xf3e7('0x28')](handleEntityNotFound(_0x5410ad,null))[_0xf3e7('0x28')](saveUpdates(_0x560ffa[_0xf3e7('0x4b')],null))[_0xf3e7('0x28')](respondWithResult(_0x5410ad,null))[_0xf3e7('0x46')](handleError(_0x5410ad,null));};exports[_0xf3e7('0x27')]=function(_0x19739d,_0x577fae){return db['VoiceQueueReport'][_0xf3e7('0x49')]({'where':{'id':_0x19739d[_0xf3e7('0x47')]['id']}})[_0xf3e7('0x28')](handleEntityNotFound(_0x577fae,null))['then'](removeEntity(_0x577fae,null))[_0xf3e7('0x46')](handleError(_0x577fae,null));};exports[_0xf3e7('0x4c')]=function(_0x38b648,_0x2da732){return db['VoiceQueueReport'][_0xf3e7('0x4c')]()[_0xf3e7('0x28')](respondWithResult(_0x2da732,null))['catch'](handleError(_0x2da732,null));};exports[_0xf3e7('0x4d')]=function(_0x18a96e,_0x9106ff){var _0x2dc03c={},_0x1c8a8a={},_0x42e781={'count':0x0,'rows':[]};_0x1c8a8a[_0xf3e7('0x33')]=_[_0xf3e7('0x35')](db[_0xf3e7('0x2f')][_0xf3e7('0x30')]);_0x1c8a8a[_0xf3e7('0x34')]=_[_0xf3e7('0x35')](_0x18a96e['query']);_0x1c8a8a['filters']=_[_0xf3e7('0x38')](_0x1c8a8a[_0xf3e7('0x33')],_0x1c8a8a[_0xf3e7('0x34')]);_0x2dc03c['attributes']=_['intersection'](_0x1c8a8a[_0xf3e7('0x33')],qs[_0xf3e7('0x39')](_0x18a96e[_0xf3e7('0x34')][_0xf3e7('0x39')]));_0x2dc03c[_0xf3e7('0x37')]=_0x2dc03c[_0xf3e7('0x37')][_0xf3e7('0x3a')]?_0x2dc03c['attributes']:_0x1c8a8a[_0xf3e7('0x33')];if(!_0x18a96e[_0xf3e7('0x34')][_0xf3e7('0x3b')](_0xf3e7('0x4e'))){_0x2dc03c[_0xf3e7('0x20')]=qs['limit'](_0x18a96e[_0xf3e7('0x34')]['limit']);_0x2dc03c['offset']=qs['offset'](_0x18a96e[_0xf3e7('0x34')][_0xf3e7('0x1e')]);}_0x2dc03c[_0xf3e7('0x4f')]=qs['sort'](_0x18a96e[_0xf3e7('0x34')][_0xf3e7('0x3c')]);_0x2dc03c[_0xf3e7('0x3d')]=qs['filters'](_[_0xf3e7('0x3e')](_0x18a96e[_0xf3e7('0x34')],_0x1c8a8a[_0xf3e7('0x36')]));if(_0x18a96e['query'][_0xf3e7('0x3f')]){_0x2dc03c[_0xf3e7('0x3d')]=_[_0xf3e7('0x40')](_0x2dc03c[_0xf3e7('0x3d')],{'$or':_[_0xf3e7('0x2e')](_0x2dc03c['attributes'],function(_0x1e8216){var _0x75cbc7={};_0x75cbc7[_0x1e8216]={'$like':'%'+_0x18a96e[_0xf3e7('0x34')]['filter']+'%'};return _0x75cbc7;})});}_0x2dc03c=_[_0xf3e7('0x40')]({},_0x2dc03c,_0x18a96e['options']);var _0x31b5f4={'where':_0x2dc03c[_0xf3e7('0x3d')]};return db[_0xf3e7('0x2f')][_0xf3e7('0x21')](_0x31b5f4)[_0xf3e7('0x28')](function(_0x8801f7){_0x42e781['count']=_0x8801f7;if(_0x18a96e[_0xf3e7('0x34')]['includeAll']){_0x2dc03c['include']=[{'all':!![]}];}return db[_0xf3e7('0x2f')]['findAll'](_0x2dc03c);})['then'](function(_0x34a526){_0x42e781[_0xf3e7('0x45')]=_0x34a526;return _0x42e781;})[_0xf3e7('0x28')](respondWithFilteredResult(_0x9106ff,_0x2dc03c,'getVoiceQueuesReport'))['catch'](handleError(_0x9106ff,null,_0xf3e7('0x4d')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index 499bd14..caea63a 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 _0x533d=['update','remove','hasOwnProperty','hook','exports','../../mysqldb','VoiceQueueReport','save'];(function(_0x570e05,_0x4ba2d0){var _0x4c65fe=function(_0x44ee0d){while(--_0x44ee0d){_0x570e05['push'](_0x570e05['shift']());}};_0x4c65fe(++_0x4ba2d0);}(_0x533d,0xc5));var _0xd533=function(_0x3da144,_0x578cbd){_0x3da144=_0x3da144-0x0;var _0x13fdc7=_0x533d[_0x3da144];return _0x13fdc7;};'use strict';var EventEmitter=require('events');var VoiceQueueReport=require(_0xd533('0x0'))['db'][_0xd533('0x1')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xd533('0x2'),'afterUpdate':_0xd533('0x3'),'afterDestroy':_0xd533('0x4')};function emitEvent(_0x5d48ab){return function(_0x437d3c,_0x154ec0,_0x513aef){VoiceQueueReportEvents['emit'](_0x5d48ab+':'+_0x437d3c['id'],_0x437d3c);VoiceQueueReportEvents['emit'](_0x5d48ab,_0x437d3c);_0x513aef(null);};}for(var e in events){if(events[_0xd533('0x5')](e)){var event=events[e];VoiceQueueReport[_0xd533('0x6')](e,emitEvent(event));}}module[_0xd533('0x7')]=VoiceQueueReportEvents; \ No newline at end of file +var _0x1320=['VoiceQueueReport','setMaxListeners','save','update','remove','hasOwnProperty','hook','exports','events'];(function(_0x351e58,_0x18686c){var _0x257364=function(_0x1cd006){while(--_0x1cd006){_0x351e58['push'](_0x351e58['shift']());}};_0x257364(++_0x18686c);}(_0x1320,0x179));var _0x0132=function(_0x223840,_0x254999){_0x223840=_0x223840-0x0;var _0xf6d439=_0x1320[_0x223840];return _0xf6d439;};'use strict';var EventEmitter=require(_0x0132('0x0'));var VoiceQueueReport=require('../../mysqldb')['db'][_0x0132('0x1')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x0132('0x2')](0x0);var events={'afterCreate':_0x0132('0x3'),'afterUpdate':_0x0132('0x4'),'afterDestroy':_0x0132('0x5')};function emitEvent(_0x317b9d){return function(_0x52a6d,_0x4c0764,_0x143956){VoiceQueueReportEvents['emit'](_0x317b9d+':'+_0x52a6d['id'],_0x52a6d);VoiceQueueReportEvents['emit'](_0x317b9d,_0x52a6d);_0x143956(null);};}for(var e in events){if(events[_0x0132('0x6')](e)){var event=events[e];VoiceQueueReport[_0x0132('0x7')](e,emitEvent(event));}}module[_0x0132('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 7ba676d..dfbe5db 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 _0xf28b=['VoiceQueueReport','report_queue','calleridnum','lodash','util','bluebird','request-promise','path','rimraf','./voiceQueueReport.attributes','exports','define'];(function(_0x507f21,_0x15bd42){var _0xe2d513=function(_0x25cfa6){while(--_0x25cfa6){_0x507f21['push'](_0x507f21['shift']());}};_0xe2d513(++_0x15bd42);}(_0xf28b,0x117));var _0xbf28=function(_0x496937,_0x5a02a7){_0x496937=_0x496937-0x0;var _0x3f2ba6=_0xf28b[_0x496937];return _0x3f2ba6;};'use strict';var _=require(_0xbf28('0x0'));var util=require(_0xbf28('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xbf28('0x2'));var rp=require(_0xbf28('0x3'));var fs=require('fs');var path=require(_0xbf28('0x4'));var rimraf=require(_0xbf28('0x5'));var config=require('../../config/environment');var attributes=require(_0xbf28('0x6'));module[_0xbf28('0x7')]=function(_0x1c4c62,_0x692099){return _0x1c4c62[_0xbf28('0x8')](_0xbf28('0x9'),attributes,{'tableName':_0xbf28('0xa'),'paranoid':![],'indexes':[{'fields':['uniqueid']},{'fields':[_0xbf28('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5589=['../../config/environment','./voiceQueueReport.attributes','exports','define','VoiceQueueReport','uniqueid','calleridnum','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x2f1d2f,_0x527d85){var _0x2874cf=function(_0x3203df){while(--_0x3203df){_0x2f1d2f['push'](_0x2f1d2f['shift']());}};_0x2874cf(++_0x527d85);}(_0x5589,0x127));var _0x9558=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0x5589[_0x18ab2a];return _0x16dcee;};'use strict';var _=require(_0x9558('0x0'));var util=require(_0x9558('0x1'));var logger=require(_0x9558('0x2'))(_0x9558('0x3'));var moment=require(_0x9558('0x4'));var BPromise=require(_0x9558('0x5'));var rp=require(_0x9558('0x6'));var fs=require('fs');var path=require(_0x9558('0x7'));var rimraf=require(_0x9558('0x8'));var config=require(_0x9558('0x9'));var attributes=require(_0x9558('0xa'));module[_0x9558('0xb')]=function(_0x23fc3b,_0x32e290){return _0x23fc3b[_0x9558('0xc')](_0x9558('0xd'),attributes,{'tableName':'report_queue','paranoid':![],'indexes':[{'fields':[_0x9558('0xe')]},{'fields':[_0x9558('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index 2d01f69..e8b928a 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 _0xdbb3=['rpc','../../config/environment','client','http','defaults','redis','localhost','socket.io-emitter','./voiceQueueReport.socket','register','then','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetVoiceQueueReport','VoiceQueueReport','options','where','limit','map','include','model','attributes','CreateVoiceQueueReport','create','body','UpdateVoiceQueueReport','update','raw','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x118881,_0x437889){var _0x32a5bd=function(_0x2e7a74){while(--_0x2e7a74){_0x118881['push'](_0x118881['shift']());}};_0x32a5bd(++_0x437889);}(_0xdbb3,0x1a7));var _0x3dbb=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0xdbb3[_0x4bfac3];return _0x15f0f2;};'use strict';var _=require('lodash');var util=require(_0x3dbb('0x0'));var moment=require(_0x3dbb('0x1'));var BPromise=require(_0x3dbb('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3dbb('0x3'));var db=require(_0x3dbb('0x4'))['db'];var utils=require(_0x3dbb('0x5'));var logger=require(_0x3dbb('0x6'))(_0x3dbb('0x7'));var config=require(_0x3dbb('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x3dbb('0x9')][_0x3dbb('0xa')]({'port':0x232a});config['redis']=_[_0x3dbb('0xb')](config[_0x3dbb('0xc')],{'host':_0x3dbb('0xd'),'port':0x18eb});var socket=require(_0x3dbb('0xe'))(new Redis(config[_0x3dbb('0xc')]));require(_0x3dbb('0xf'))[_0x3dbb('0x10')](socket);function respondWithRpcPromise(_0x4b1075,_0x42e9e7,_0x251c0d){return new BPromise(function(_0xcd7491,_0x5d9a30){return client['request'](_0x4b1075,_0x251c0d)[_0x3dbb('0x11')](function(_0x12c9f5){logger[_0x3dbb('0x12')](_0x3dbb('0x13'),_0x42e9e7,_0x3dbb('0x14'));logger[_0x3dbb('0x15')](_0x3dbb('0x16'),_0x42e9e7,_0x3dbb('0x14'),JSON[_0x3dbb('0x17')](_0x12c9f5));if(_0x12c9f5['error']){if(_0x12c9f5['error']['code']===0x1f4){logger[_0x3dbb('0x18')](_0x3dbb('0x13'),_0x42e9e7,_0x12c9f5[_0x3dbb('0x18')][_0x3dbb('0x19')]);return _0x5d9a30(_0x12c9f5[_0x3dbb('0x18')][_0x3dbb('0x19')]);}logger[_0x3dbb('0x18')](_0x3dbb('0x13'),_0x42e9e7,_0x12c9f5[_0x3dbb('0x18')][_0x3dbb('0x19')]);return _0xcd7491(_0x12c9f5[_0x3dbb('0x18')][_0x3dbb('0x19')]);}else{logger[_0x3dbb('0x12')](_0x3dbb('0x13'),_0x42e9e7,'request\x20sent');_0xcd7491(_0x12c9f5[_0x3dbb('0x1a')][_0x3dbb('0x19')]);}})[_0x3dbb('0x1b')](function(_0x51b6ec){logger['error'](_0x3dbb('0x13'),_0x42e9e7,_0x51b6ec);_0x5d9a30(_0x51b6ec);});});}exports[_0x3dbb('0x1c')]=function(_0xdb46df){var _0x40da8f=this;return new Promise(function(_0x48f375,_0x52af90){return db[_0x3dbb('0x1d')]['findAll']({'raw':_0xdb46df['options']?_0xdb46df[_0x3dbb('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0xdb46df['options']?_0xdb46df[_0x3dbb('0x1e')][_0x3dbb('0x1f')]||null:null,'attributes':_0xdb46df[_0x3dbb('0x1e')]?_0xdb46df['options']['attributes']||null:null,'limit':_0xdb46df[_0x3dbb('0x1e')]?_0xdb46df[_0x3dbb('0x1e')][_0x3dbb('0x20')]||null:null,'include':_0xdb46df[_0x3dbb('0x1e')]?_0xdb46df['options']['include']?_[_0x3dbb('0x21')](_0xdb46df[_0x3dbb('0x1e')][_0x3dbb('0x22')],function(_0x326ff5){return{'model':db[_0x326ff5[_0x3dbb('0x23')]],'as':_0x326ff5['as'],'attributes':_0x326ff5['attributes'],'include':_0x326ff5[_0x3dbb('0x22')]?_[_0x3dbb('0x21')](_0x326ff5[_0x3dbb('0x22')],function(_0x493cbb){return{'model':db[_0x493cbb['model']],'as':_0x493cbb['as'],'attributes':_0x493cbb[_0x3dbb('0x24')],'include':_0x493cbb[_0x3dbb('0x22')]?_[_0x3dbb('0x21')](_0x493cbb[_0x3dbb('0x22')],function(_0x134a68){return{'model':db[_0x134a68[_0x3dbb('0x23')]],'as':_0x134a68['as'],'attributes':_0x134a68[_0x3dbb('0x24')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3d1570){logger[_0x3dbb('0x12')](_0x3dbb('0x1c'),_0xdb46df);logger[_0x3dbb('0x15')](_0x3dbb('0x1c'),_0xdb46df,JSON['stringify'](_0x3d1570));_0x48f375(_0x3d1570);})['catch'](function(_0x4de985){logger[_0x3dbb('0x18')]('GetVoiceQueueReport',_0x4de985[_0x3dbb('0x19')],_0xdb46df);_0x52af90(_0x40da8f[_0x3dbb('0x18')](0x1f4,_0x4de985[_0x3dbb('0x19')]));});});};exports[_0x3dbb('0x25')]=function(_0x5de60e){var _0x2e7732=this;return new Promise(function(_0x3bcaf2,_0x1f1bb3){return db[_0x3dbb('0x1d')][_0x3dbb('0x26')](_0x5de60e[_0x3dbb('0x27')],{'raw':_0x5de60e['options']?_0x5de60e[_0x3dbb('0x1e')]['raw']===undefined?!![]:![]:!![]})[_0x3dbb('0x11')](function(_0x56b7e4){logger['info'](_0x3dbb('0x25'),_0x5de60e);logger[_0x3dbb('0x15')]('CreateVoiceQueueReport',_0x5de60e,JSON[_0x3dbb('0x17')](_0x56b7e4));_0x3bcaf2(_0x56b7e4);})['catch'](function(_0x5c1158){logger[_0x3dbb('0x18')](_0x3dbb('0x25'),_0x5c1158[_0x3dbb('0x19')],_0x5de60e);_0x1f1bb3(_0x2e7732[_0x3dbb('0x18')](0x1f4,_0x5c1158[_0x3dbb('0x19')]));});});};exports[_0x3dbb('0x28')]=function(_0xb6de0c){var _0x101828=this;return new Promise(function(_0x4a19e7,_0x56f2df){return db[_0x3dbb('0x1d')][_0x3dbb('0x29')](_0xb6de0c[_0x3dbb('0x27')],{'raw':_0xb6de0c['options']?_0xb6de0c[_0x3dbb('0x1e')][_0x3dbb('0x2a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xb6de0c[_0x3dbb('0x1e')]?_0xb6de0c[_0x3dbb('0x1e')][_0x3dbb('0x1f')]||null:null,'attributes':_0xb6de0c[_0x3dbb('0x1e')]?_0xb6de0c[_0x3dbb('0x1e')][_0x3dbb('0x24')]||null:null,'limit':_0xb6de0c[_0x3dbb('0x1e')]?_0xb6de0c[_0x3dbb('0x1e')]['limit']||null:null})[_0x3dbb('0x11')](function(_0x275a5f){logger[_0x3dbb('0x12')]('UpdateVoiceQueueReport',_0xb6de0c);logger[_0x3dbb('0x15')](_0x3dbb('0x28'),_0xb6de0c,JSON[_0x3dbb('0x17')](_0x275a5f));_0x4a19e7(_0x275a5f);})[_0x3dbb('0x1b')](function(_0x58885c){logger[_0x3dbb('0x18')](_0x3dbb('0x28'),_0x58885c[_0x3dbb('0x19')],_0xb6de0c);_0x56f2df(_0x101828[_0x3dbb('0x18')](0x1f4,_0x58885c[_0x3dbb('0x19')]));});});}; \ No newline at end of file +var _0x31a2=['raw','where','attributes','limit','include','model','map','then','GetVoiceQueueReport','debug','CreateVoiceQueueReport','VoiceQueueReport','create','body','stringify','UpdateVoiceQueueReport','update','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','request','request\x20sent','VoiceQueueReport,\x20%s,\x20%s,\x20%s','error','VoiceQueueReport,\x20%s,\x20%s','message','info','result','catch','findAll','options'];(function(_0x1b0659,_0x586a89){var _0x1e3bf6=function(_0x4fb9a2){while(--_0x4fb9a2){_0x1b0659['push'](_0x1b0659['shift']());}};_0x1e3bf6(++_0x586a89);}(_0x31a2,0x179));var _0x231a=function(_0x46c722,_0x159924){_0x46c722=_0x46c722-0x0;var _0x4e9bc6=_0x31a2[_0x46c722];return _0x4e9bc6;};'use strict';var _=require(_0x231a('0x0'));var util=require(_0x231a('0x1'));var moment=require(_0x231a('0x2'));var BPromise=require('bluebird');var rs=require(_0x231a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x231a('0x4'))['db'];var utils=require(_0x231a('0x5'));var logger=require(_0x231a('0x6'))(_0x231a('0x7'));var config=require(_0x231a('0x8'));var jayson=require(_0x231a('0x9'));var client=jayson[_0x231a('0xa')][_0x231a('0xb')]({'port':0x232a});config[_0x231a('0xc')]=_[_0x231a('0xd')](config[_0x231a('0xc')],{'host':_0x231a('0xe'),'port':0x18eb});var socket=require(_0x231a('0xf'))(new Redis(config['redis']));require(_0x231a('0x10'))['register'](socket);function respondWithRpcPromise(_0x1f4a0e,_0x1de7d1,_0x1efa77){return new BPromise(function(_0x3cac1b,_0x2bca87){return client[_0x231a('0x11')](_0x1f4a0e,_0x1efa77)['then'](function(_0x5f111d){logger['info']('VoiceQueueReport,\x20%s,\x20%s',_0x1de7d1,_0x231a('0x12'));logger['debug'](_0x231a('0x13'),_0x1de7d1,_0x231a('0x12'),JSON['stringify'](_0x5f111d));if(_0x5f111d['error']){if(_0x5f111d[_0x231a('0x14')]['code']===0x1f4){logger[_0x231a('0x14')](_0x231a('0x15'),_0x1de7d1,_0x5f111d[_0x231a('0x14')]['message']);return _0x2bca87(_0x5f111d[_0x231a('0x14')][_0x231a('0x16')]);}logger[_0x231a('0x14')]('VoiceQueueReport,\x20%s,\x20%s',_0x1de7d1,_0x5f111d[_0x231a('0x14')][_0x231a('0x16')]);return _0x3cac1b(_0x5f111d[_0x231a('0x14')]['message']);}else{logger[_0x231a('0x17')](_0x231a('0x15'),_0x1de7d1,_0x231a('0x12'));_0x3cac1b(_0x5f111d[_0x231a('0x18')][_0x231a('0x16')]);}})[_0x231a('0x19')](function(_0x2d1e5e){logger[_0x231a('0x14')]('VoiceQueueReport,\x20%s,\x20%s',_0x1de7d1,_0x2d1e5e);_0x2bca87(_0x2d1e5e);});});}exports['GetVoiceQueueReport']=function(_0x170c92){var _0x556fc0=this;return new Promise(function(_0x263701,_0x26859e){return db['VoiceQueueReport'][_0x231a('0x1a')]({'raw':_0x170c92['options']?_0x170c92[_0x231a('0x1b')][_0x231a('0x1c')]===undefined?!![]:![]:!![],'where':_0x170c92[_0x231a('0x1b')]?_0x170c92[_0x231a('0x1b')][_0x231a('0x1d')]||null:null,'attributes':_0x170c92['options']?_0x170c92[_0x231a('0x1b')][_0x231a('0x1e')]||null:null,'limit':_0x170c92[_0x231a('0x1b')]?_0x170c92[_0x231a('0x1b')][_0x231a('0x1f')]||null:null,'include':_0x170c92['options']?_0x170c92[_0x231a('0x1b')][_0x231a('0x20')]?_['map'](_0x170c92[_0x231a('0x1b')][_0x231a('0x20')],function(_0x1e6fb7){return{'model':db[_0x1e6fb7['model']],'as':_0x1e6fb7['as'],'attributes':_0x1e6fb7[_0x231a('0x1e')],'include':_0x1e6fb7['include']?_['map'](_0x1e6fb7[_0x231a('0x20')],function(_0x387cb9){return{'model':db[_0x387cb9[_0x231a('0x21')]],'as':_0x387cb9['as'],'attributes':_0x387cb9[_0x231a('0x1e')],'include':_0x387cb9['include']?_[_0x231a('0x22')](_0x387cb9[_0x231a('0x20')],function(_0x298495){return{'model':db[_0x298495[_0x231a('0x21')]],'as':_0x298495['as'],'attributes':_0x298495[_0x231a('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x231a('0x23')](function(_0x2839be){logger[_0x231a('0x17')](_0x231a('0x24'),_0x170c92);logger[_0x231a('0x25')](_0x231a('0x24'),_0x170c92,JSON['stringify'](_0x2839be));_0x263701(_0x2839be);})[_0x231a('0x19')](function(_0x333065){logger['error'](_0x231a('0x24'),_0x333065['message'],_0x170c92);_0x26859e(_0x556fc0[_0x231a('0x14')](0x1f4,_0x333065['message']));});});};exports[_0x231a('0x26')]=function(_0x476c5d){var _0x29ea0d=this;return new Promise(function(_0x2a79da,_0x5c70fa){return db[_0x231a('0x27')][_0x231a('0x28')](_0x476c5d[_0x231a('0x29')],{'raw':_0x476c5d[_0x231a('0x1b')]?_0x476c5d[_0x231a('0x1b')][_0x231a('0x1c')]===undefined?!![]:![]:!![]})[_0x231a('0x23')](function(_0x426848){logger[_0x231a('0x17')]('CreateVoiceQueueReport',_0x476c5d);logger['debug'](_0x231a('0x26'),_0x476c5d,JSON[_0x231a('0x2a')](_0x426848));_0x2a79da(_0x426848);})[_0x231a('0x19')](function(_0x4c2b08){logger[_0x231a('0x14')](_0x231a('0x26'),_0x4c2b08[_0x231a('0x16')],_0x476c5d);_0x5c70fa(_0x29ea0d[_0x231a('0x14')](0x1f4,_0x4c2b08[_0x231a('0x16')]));});});};exports[_0x231a('0x2b')]=function(_0x276d68){var _0x447e69=this;return new Promise(function(_0x1fa02f,_0x2f0932){return db[_0x231a('0x27')][_0x231a('0x2c')](_0x276d68[_0x231a('0x29')],{'raw':_0x276d68[_0x231a('0x1b')]?_0x276d68[_0x231a('0x1b')][_0x231a('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x276d68[_0x231a('0x1b')]?_0x276d68[_0x231a('0x1b')][_0x231a('0x1d')]||null:null,'attributes':_0x276d68[_0x231a('0x1b')]?_0x276d68[_0x231a('0x1b')][_0x231a('0x1e')]||null:null,'limit':_0x276d68[_0x231a('0x1b')]?_0x276d68[_0x231a('0x1b')][_0x231a('0x1f')]||null:null})['then'](function(_0x44d20d){logger[_0x231a('0x17')]('UpdateVoiceQueueReport',_0x276d68);logger[_0x231a('0x25')]('UpdateVoiceQueueReport',_0x276d68,JSON[_0x231a('0x2a')](_0x44d20d));_0x1fa02f(_0x44d20d);})[_0x231a('0x19')](function(_0x2504cf){logger['error'](_0x231a('0x2b'),_0x2504cf['message'],_0x276d68);_0x2f0932(_0x447e69[_0x231a('0x14')](0x1f4,_0x2504cf[_0x231a('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index f9c846f..9571f92 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 _0x655d=['removeListener','length','voiceQueueReport:','./voiceQueueReport.events','save','remove','update','emit'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x655d,0x13b));var _0xd655=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x655d[_0x20a584];return _0x4b41a8;};'use strict';var VoiceQueueReportEvents=require(_0xd655('0x0'));var events=[_0xd655('0x1'),_0xd655('0x2'),_0xd655('0x3')];function createListener(_0xc55c64,_0x11249a){return function(_0x47e2d8){_0x11249a[_0xd655('0x4')](_0xc55c64,_0x47e2d8);};}function removeListener(_0x1557d5,_0x5d85f7){return function(){VoiceQueueReportEvents[_0xd655('0x5')](_0x1557d5,_0x5d85f7);};}exports['register']=function(_0x1a2ecb){for(var _0x1c3f69=0x0,_0x13b981=events[_0xd655('0x6')];_0x1c3f69<_0x13b981;_0x1c3f69++){var _0x4541ad=events[_0x1c3f69];var _0x4e9c8b=createListener(_0xd655('0x7')+_0x4541ad,_0x1a2ecb);VoiceQueueReportEvents['on'](_0x4541ad,_0x4e9c8b);}}; \ No newline at end of file +var _0xb453=['./voiceQueueReport.events','save','update','emit','removeListener','register','length','voiceQueueReport:'];(function(_0x2acbce,_0x2b48d3){var _0x1de0e0=function(_0x36ae0e){while(--_0x36ae0e){_0x2acbce['push'](_0x2acbce['shift']());}};_0x1de0e0(++_0x2b48d3);}(_0xb453,0x1e8));var _0x3b45=function(_0x1f48c9,_0x42d054){_0x1f48c9=_0x1f48c9-0x0;var _0x2bf537=_0xb453[_0x1f48c9];return _0x2bf537;};'use strict';var VoiceQueueReportEvents=require(_0x3b45('0x0'));var events=[_0x3b45('0x1'),'remove',_0x3b45('0x2')];function createListener(_0x19c429,_0x48ecf8){return function(_0x4a6ac4){_0x48ecf8[_0x3b45('0x3')](_0x19c429,_0x4a6ac4);};}function removeListener(_0x471768,_0x10029d){return function(){VoiceQueueReportEvents[_0x3b45('0x4')](_0x471768,_0x10029d);};}exports[_0x3b45('0x5')]=function(_0x210775){for(var _0x2f4baa=0x0,_0x39c77c=events[_0x3b45('0x6')];_0x2f4baa<_0x39c77c;_0x2f4baa++){var _0x1b529a=events[_0x2f4baa];var _0x59da08=createListener(_0x3b45('0x7')+_0x1b529a,_0x210775);VoiceQueueReportEvents['on'](_0x1b529a,_0x59da08);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index ad483e4..825d066 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 _0x23d3=['exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','post','create','put','update','delete','/:id','destroy'];(function(_0x3d6b15,_0x2ff69b){var _0x263799=function(_0x244a57){while(--_0x244a57){_0x3d6b15['push'](_0x3d6b15['shift']());}};_0x263799(++_0x2ff69b);}(_0x23d3,0xe8));var _0x323d=function(_0x41c556,_0x240d66){_0x41c556=_0x41c556-0x0;var _0x5181f8=_0x23d3[_0x41c556];return _0x5181f8;};'use strict';var multer=require(_0x323d('0x0'));var util=require(_0x323d('0x1'));var path=require(_0x323d('0x2'));var timeout=require('connect-timeout');var express=require(_0x323d('0x3'));var router=express[_0x323d('0x4')]();var fs_extra=require(_0x323d('0x5'));var auth=require(_0x323d('0x6'));var interaction=require(_0x323d('0x7'));var config=require(_0x323d('0x8'));var controller=require('./voiceQueuesLog.controller');router[_0x323d('0x9')]('/',auth[_0x323d('0xa')](),controller[_0x323d('0xb')]);router[_0x323d('0x9')]('/:id',auth[_0x323d('0xa')](),controller[_0x323d('0xc')]);router[_0x323d('0xd')]('/',auth['isAuthenticated'](),controller[_0x323d('0xe')]);router[_0x323d('0xf')]('/:id',auth[_0x323d('0xa')](),controller[_0x323d('0x10')]);router[_0x323d('0x11')](_0x323d('0x12'),auth['isAuthenticated'](),controller[_0x323d('0x13')]);module[_0x323d('0x14')]=router; \ No newline at end of file +var _0x12c8=['../../components/interaction/service','../../config/environment','isAuthenticated','index','/:id','show','post','create','put','destroy','util','path','connect-timeout','Router'];(function(_0x165834,_0x49e6d7){var _0x2f8df1=function(_0x224230){while(--_0x224230){_0x165834['push'](_0x165834['shift']());}};_0x2f8df1(++_0x49e6d7);}(_0x12c8,0x114));var _0x812c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x12c8[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x812c('0x0'));var path=require(_0x812c('0x1'));var timeout=require(_0x812c('0x2'));var express=require('express');var router=express[_0x812c('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x812c('0x4'));var config=require(_0x812c('0x5'));var controller=require('./voiceQueuesLog.controller');router['get']('/',auth[_0x812c('0x6')](),controller[_0x812c('0x7')]);router['get'](_0x812c('0x8'),auth[_0x812c('0x6')](),controller[_0x812c('0x9')]);router[_0x812c('0xa')]('/',auth[_0x812c('0x6')](),controller[_0x812c('0xb')]);router[_0x812c('0xc')](_0x812c('0x8'),auth[_0x812c('0x6')](),controller['update']);router['delete'](_0x812c('0x8'),auth[_0x812c('0x6')](),controller[_0x812c('0xd')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index 41d0320..e90b330 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 _0x1275=['sequelize','exports','STRING','DATE','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP'];(function(_0x363123,_0xc162aa){var _0x220234=function(_0x4f9520){while(--_0x4f9520){_0x363123['push'](_0x363123['shift']());}};_0x220234(++_0xc162aa);}(_0x1275,0x19e));var _0x5127=function(_0x22b6a1,_0x212718){_0x22b6a1=_0x22b6a1-0x0;var _0x2507c0=_0x1275[_0x22b6a1];return _0x2507c0;};'use strict';var Sequelize=require(_0x5127('0x0'));var moment=require('moment');module[_0x5127('0x1')]={'time':{'type':Sequelize[_0x5127('0x2')]},'callid':{'type':Sequelize[_0x5127('0x2')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x5127('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x5127('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x5127('0x2')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x5127('0x2')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x5127('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x5127('0x2')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x5127('0x2')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x5127('0x2')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x5127('0x3')],'allowNull':![],'defaultValue':Sequelize[_0x5127('0x4')](_0x5127('0x5'))}}; \ No newline at end of file +var _0x647a=['exports','STRING','DATE','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','moment'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x647a,0x83));var _0xa647=function(_0x296453,_0x219c2a){_0x296453=_0x296453-0x0;var _0x37b596=_0x647a[_0x296453];return _0x37b596;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xa647('0x0'));module[_0xa647('0x1')]={'time':{'type':Sequelize[_0xa647('0x2')]},'callid':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0xa647('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0xa647('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0xa647('0x2')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0xa647('0x2')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0xa647('0x2')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0xa647('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0xa647('0x2')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0xa647('0x2')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0xa647('0x3')],'allowNull':![],'defaultValue':Sequelize[_0xa647('0x4')](_0xa647('0x5'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index 543ee5c..23084ac 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 _0xa474=['set','save','then','stack','name','send','index','VoiceQueuesLog','rawAttributes','type','key','model','query','filters','intersection','fields','attributes','order','sort','where','merge','map','VIRTUAL','filter','options','includeAll','include','findAll','show','keys','length','find','catch','create','body','update','params','destroy','rimraf','request-promise','moment','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count'];(function(_0x4d70dc,_0x1569ed){var _0x4e6a9e=function(_0x1c443c){while(--_0x1c443c){_0x4d70dc['push'](_0x4d70dc['shift']());}};_0x4e6a9e(++_0x1569ed);}(_0xa474,0xe6));var _0x4a47=function(_0x45b1fa,_0x505f9){_0x45b1fa=_0x45b1fa-0x0;var _0x377d9a=_0xa474[_0x45b1fa];return _0x377d9a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4a47('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x4a47('0x1'));var moment=require(_0x4a47('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x4a47('0x3'));var path=require(_0x4a47('0x4'));var sox=require('sox');var csv=require(_0x4a47('0x5'));var ejs=require(_0x4a47('0x6'));var fs=require('fs');var fs_extra=require(_0x4a47('0x7'));var _=require(_0x4a47('0x8'));var squel=require(_0x4a47('0x9'));var crypto=require('crypto');var jsforce=require(_0x4a47('0xa'));var deskjs=require(_0x4a47('0xb'));var toCsv=require(_0x4a47('0x5'));var querystring=require(_0x4a47('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x4a47('0xd'));var hardwareService=require(_0x4a47('0xe'));var logger=require(_0x4a47('0xf'))('api');var utils=require('../../config/utils');var config=require(_0x4a47('0x10'));var licenseUtil=require('../../config/license/util');var db=require(_0x4a47('0x11'))['db'];function respondWithStatusCode(_0x432b2e,_0x1f16b3){_0x1f16b3=_0x1f16b3||0xcc;return function(_0x497e06){if(_0x497e06){return _0x432b2e[_0x4a47('0x12')](_0x1f16b3);}return _0x432b2e[_0x4a47('0x13')](_0x1f16b3)[_0x4a47('0x14')]();};}function respondWithResult(_0x529c28,_0xdf0fc6){_0xdf0fc6=_0xdf0fc6||0xc8;return function(_0x3a9ebf){if(_0x3a9ebf){return _0x529c28[_0x4a47('0x13')](_0xdf0fc6)[_0x4a47('0x15')](_0x3a9ebf);}};}function respondWithFilteredResult(_0x500516,_0x58d4df){return function(_0x5743eb){if(_0x5743eb){var _0x326cc1=typeof _0x58d4df[_0x4a47('0x16')]===_0x4a47('0x17')&&typeof _0x58d4df[_0x4a47('0x18')]===_0x4a47('0x17');var _0x36b032=_0x5743eb[_0x4a47('0x19')];var _0x415a56=_0x326cc1?0x0:_0x58d4df['offset'];var _0x1cf56f=_0x326cc1?_0x5743eb[_0x4a47('0x19')]:_0x58d4df[_0x4a47('0x16')]+_0x58d4df[_0x4a47('0x18')];var _0x3521d0;if(_0x1cf56f>=_0x36b032){_0x1cf56f=_0x36b032;_0x3521d0=0xc8;}else{_0x3521d0=0xce;}_0x500516[_0x4a47('0x13')](_0x3521d0);return _0x500516[_0x4a47('0x1a')]('Content-Range',_0x415a56+'-'+_0x1cf56f+'/'+_0x36b032)[_0x4a47('0x15')](_0x5743eb);}return null;};}function patchUpdates(_0x3f2f42){return function(_0xa29184){try{jsonpatch['apply'](_0xa29184,_0x3f2f42,!![]);}catch(_0x11af11){return BPromise['reject'](_0x11af11);}return _0xa29184[_0x4a47('0x1b')]();};}function saveUpdates(_0xabe7e,_0x50d3cf){return function(_0x1006ac){if(_0x1006ac){return _0x1006ac['update'](_0xabe7e)[_0x4a47('0x1c')](function(_0x33ef5d){return _0x33ef5d;});}return null;};}function removeEntity(_0x2c7b8a,_0xd4b7ab){return function(_0x3dcc3e){if(_0x3dcc3e){return _0x3dcc3e['destroy']()[_0x4a47('0x1c')](function(){_0x2c7b8a['status'](0xcc)[_0x4a47('0x14')]();});}};}function handleEntityNotFound(_0x4e5d62,_0x1dc28b){return function(_0x3de1b6){if(!_0x3de1b6){_0x4e5d62['sendStatus'](0x194);}return _0x3de1b6;};}function handleError(_0x417c67,_0x3d8f6f){_0x3d8f6f=_0x3d8f6f||0x1f4;return function(_0x2142bf){logger['error'](_0x2142bf[_0x4a47('0x1d')]);if(_0x2142bf['name']){delete _0x2142bf[_0x4a47('0x1e')];}_0x417c67['status'](_0x3d8f6f)[_0x4a47('0x1f')](_0x2142bf);};}exports[_0x4a47('0x20')]=function(_0x549970,_0x57eeed){var _0x54e0bc={},_0x40471e={},_0x15f585={'count':0x0,'rows':[]};var _0x4043e0=_['map'](db[_0x4a47('0x21')][_0x4a47('0x22')],function(_0xf19c7e){return{'name':_0xf19c7e['fieldName'],'type':_0xf19c7e[_0x4a47('0x23')][_0x4a47('0x24')]};});_0x40471e[_0x4a47('0x25')]=_['map'](_0x4043e0,_0x4a47('0x1e'));_0x40471e[_0x4a47('0x26')]=_['keys'](_0x549970['query']);_0x40471e[_0x4a47('0x27')]=_[_0x4a47('0x28')](_0x40471e[_0x4a47('0x25')],_0x40471e[_0x4a47('0x26')]);_0x54e0bc['attributes']=_[_0x4a47('0x28')](_0x40471e[_0x4a47('0x25')],qs['fields'](_0x549970[_0x4a47('0x26')][_0x4a47('0x29')]));_0x54e0bc['attributes']=_0x54e0bc['attributes']['length']?_0x54e0bc[_0x4a47('0x2a')]:_0x40471e[_0x4a47('0x25')];if(!_0x549970[_0x4a47('0x26')]['hasOwnProperty']('nolimit')){_0x54e0bc[_0x4a47('0x18')]=qs[_0x4a47('0x18')](_0x549970[_0x4a47('0x26')][_0x4a47('0x18')]);_0x54e0bc['offset']=qs['offset'](_0x549970[_0x4a47('0x26')][_0x4a47('0x16')]);}_0x54e0bc[_0x4a47('0x2b')]=qs['sort'](_0x549970[_0x4a47('0x26')][_0x4a47('0x2c')]);_0x54e0bc[_0x4a47('0x2d')]=qs['filters'](_['pick'](_0x549970[_0x4a47('0x26')],_0x40471e['filters']),_0x4043e0);if(_0x549970['query']['filter']){_0x54e0bc[_0x4a47('0x2d')]=_[_0x4a47('0x2e')](_0x54e0bc['where'],{'$or':_[_0x4a47('0x2f')](_0x4043e0,function(_0x8bda70){if(_0x8bda70['type']!==_0x4a47('0x30')){var _0x4fba2d={};_0x4fba2d[_0x8bda70[_0x4a47('0x1e')]]={'$like':'%'+_0x549970[_0x4a47('0x26')][_0x4a47('0x31')]+'%'};return _0x4fba2d;}})});}_0x54e0bc=_['merge']({},_0x54e0bc,_0x549970[_0x4a47('0x32')]);var _0x4f3818={'where':_0x54e0bc[_0x4a47('0x2d')]};return db[_0x4a47('0x21')][_0x4a47('0x19')](_0x4f3818)['then'](function(_0xa2a08e){_0x15f585['count']=_0xa2a08e;if(_0x549970['query'][_0x4a47('0x33')]){_0x54e0bc[_0x4a47('0x34')]=[{'all':!![]}];}return db['VoiceQueuesLog'][_0x4a47('0x35')](_0x54e0bc);})[_0x4a47('0x1c')](function(_0x2f813f){_0x15f585['rows']=_0x2f813f;return _0x15f585;})[_0x4a47('0x1c')](respondWithFilteredResult(_0x57eeed,_0x54e0bc))['catch'](handleError(_0x57eeed,null));};exports[_0x4a47('0x36')]=function(_0x1ec1f5,_0x208844){var _0x28675b={'raw':!![],'where':{'id':_0x1ec1f5['params']['id']}},_0x548089={};_0x548089[_0x4a47('0x25')]=_[_0x4a47('0x37')](db[_0x4a47('0x21')]['rawAttributes']);_0x548089['query']=_[_0x4a47('0x37')](_0x1ec1f5[_0x4a47('0x26')]);_0x548089['filters']=_['intersection'](_0x548089[_0x4a47('0x25')],_0x548089[_0x4a47('0x26')]);_0x28675b['attributes']=_['intersection'](_0x548089[_0x4a47('0x25')],qs['fields'](_0x1ec1f5[_0x4a47('0x26')][_0x4a47('0x29')]));_0x28675b['attributes']=_0x28675b[_0x4a47('0x2a')][_0x4a47('0x38')]?_0x28675b['attributes']:_0x548089[_0x4a47('0x25')];if(_0x1ec1f5[_0x4a47('0x26')]['includeAll']){_0x28675b[_0x4a47('0x34')]=[{'all':!![]}];}_0x28675b=_[_0x4a47('0x2e')]({},_0x28675b,_0x1ec1f5[_0x4a47('0x32')]);return db[_0x4a47('0x21')][_0x4a47('0x39')](_0x28675b)[_0x4a47('0x1c')](handleEntityNotFound(_0x208844,null))['then'](respondWithResult(_0x208844,null))[_0x4a47('0x3a')](handleError(_0x208844,null));};exports[_0x4a47('0x3b')]=function(_0x510e27,_0x2397e9){return db['VoiceQueuesLog']['create'](_0x510e27[_0x4a47('0x3c')],{})[_0x4a47('0x1c')](respondWithResult(_0x2397e9,0xc9))[_0x4a47('0x3a')](handleError(_0x2397e9,null));};exports[_0x4a47('0x3d')]=function(_0x140191,_0x54a6e7){if(_0x140191[_0x4a47('0x3c')]['id']){delete _0x140191['body']['id'];}return db['VoiceQueuesLog'][_0x4a47('0x39')]({'where':{'id':_0x140191[_0x4a47('0x3e')]['id']}})[_0x4a47('0x1c')](handleEntityNotFound(_0x54a6e7,null))['then'](saveUpdates(_0x140191[_0x4a47('0x3c')],null))[_0x4a47('0x1c')](respondWithResult(_0x54a6e7,null))[_0x4a47('0x3a')](handleError(_0x54a6e7,null));};exports[_0x4a47('0x3f')]=function(_0x5044d4,_0x3e2cf9){return db[_0x4a47('0x21')][_0x4a47('0x39')]({'where':{'id':_0x5044d4[_0x4a47('0x3e')]['id']}})[_0x4a47('0x1c')](handleEntityNotFound(_0x3e2cf9,null))['then'](removeEntity(_0x3e2cf9,null))[_0x4a47('0x3a')](handleError(_0x3e2cf9,null));}; \ No newline at end of file +var _0x2620=['name','send','index','VoiceQueuesLog','rawAttributes','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','VIRTUAL','options','count','includeAll','findAll','rows','show','params','include','find','create','body','catch','eml-format','zip-dir','request-promise','moment','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','offset','limit','undefined','Content-Range','apply','reject','update','then','destroy','stack'];(function(_0x5b5126,_0x1cfa5f){var _0x144470=function(_0x3edefd){while(--_0x3edefd){_0x5b5126['push'](_0x5b5126['shift']());}};_0x144470(++_0x1cfa5f);}(_0x2620,0x144));var _0x0262=function(_0x8ba19a,_0x1d2b2b){_0x8ba19a=_0x8ba19a-0x0;var _0x2bd8b4=_0x2620[_0x8ba19a];return _0x2bd8b4;};'use strict';var emlformat=require(_0x0262('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0262('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0262('0x2'));var moment=require(_0x0262('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x0262('0x4'));var path=require(_0x0262('0x5'));var sox=require('sox');var csv=require(_0x0262('0x6'));var ejs=require(_0x0262('0x7'));var fs=require('fs');var fs_extra=require(_0x0262('0x8'));var _=require(_0x0262('0x9'));var squel=require(_0x0262('0xa'));var crypto=require(_0x0262('0xb'));var jsforce=require(_0x0262('0xc'));var deskjs=require(_0x0262('0xd'));var toCsv=require(_0x0262('0x6'));var querystring=require(_0x0262('0xe'));var Papa=require(_0x0262('0xf'));var Redis=require(_0x0262('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x0262('0x11'));var hardwareService=require(_0x0262('0x12'));var logger=require(_0x0262('0x13'))('api');var utils=require(_0x0262('0x14'));var config=require(_0x0262('0x15'));var licenseUtil=require(_0x0262('0x16'));var db=require(_0x0262('0x17'))['db'];function respondWithStatusCode(_0x1c017e,_0x486d3e){_0x486d3e=_0x486d3e||0xcc;return function(_0x44a2c6){if(_0x44a2c6){return _0x1c017e[_0x0262('0x18')](_0x486d3e);}return _0x1c017e['status'](_0x486d3e)[_0x0262('0x19')]();};}function respondWithResult(_0x448481,_0x28d4f8){_0x28d4f8=_0x28d4f8||0xc8;return function(_0x5a5255){if(_0x5a5255){return _0x448481['status'](_0x28d4f8)['json'](_0x5a5255);}};}function respondWithFilteredResult(_0x354fd9,_0x3f6268){return function(_0x22687d){if(_0x22687d){var _0x1fd850=typeof _0x3f6268[_0x0262('0x1a')]==='undefined'&&typeof _0x3f6268[_0x0262('0x1b')]===_0x0262('0x1c');var _0x18d0d9=_0x22687d['count'];var _0x2d2036=_0x1fd850?0x0:_0x3f6268[_0x0262('0x1a')];var _0x5b356c=_0x1fd850?_0x22687d['count']:_0x3f6268[_0x0262('0x1a')]+_0x3f6268['limit'];var _0x297ace;if(_0x5b356c>=_0x18d0d9){_0x5b356c=_0x18d0d9;_0x297ace=0xc8;}else{_0x297ace=0xce;}_0x354fd9['status'](_0x297ace);return _0x354fd9['set'](_0x0262('0x1d'),_0x2d2036+'-'+_0x5b356c+'/'+_0x18d0d9)['json'](_0x22687d);}return null;};}function patchUpdates(_0x304c34){return function(_0x131830){try{jsonpatch[_0x0262('0x1e')](_0x131830,_0x304c34,!![]);}catch(_0x754b32){return BPromise[_0x0262('0x1f')](_0x754b32);}return _0x131830['save']();};}function saveUpdates(_0x391d8f,_0x31141c){return function(_0x3de22e){if(_0x3de22e){return _0x3de22e[_0x0262('0x20')](_0x391d8f)[_0x0262('0x21')](function(_0x306e25){return _0x306e25;});}return null;};}function removeEntity(_0x416889,_0x26a29d){return function(_0x175d3f){if(_0x175d3f){return _0x175d3f[_0x0262('0x22')]()[_0x0262('0x21')](function(){_0x416889['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x22eefd,_0x149055){return function(_0x24f983){if(!_0x24f983){_0x22eefd[_0x0262('0x18')](0x194);}return _0x24f983;};}function handleError(_0x44449b,_0x5471cb){_0x5471cb=_0x5471cb||0x1f4;return function(_0x24a40e){logger['error'](_0x24a40e[_0x0262('0x23')]);if(_0x24a40e[_0x0262('0x24')]){delete _0x24a40e[_0x0262('0x24')];}_0x44449b['status'](_0x5471cb)[_0x0262('0x25')](_0x24a40e);};}exports[_0x0262('0x26')]=function(_0x5633d8,_0xcb1477){var _0x448fe8={},_0x4b7598={},_0x181f0d={'count':0x0,'rows':[]};var _0x5f3da9=_['map'](db[_0x0262('0x27')][_0x0262('0x28')],function(_0x4a38e0){return{'name':_0x4a38e0['fieldName'],'type':_0x4a38e0[_0x0262('0x29')][_0x0262('0x2a')]};});_0x4b7598[_0x0262('0x2b')]=_[_0x0262('0x2c')](_0x5f3da9,'name');_0x4b7598[_0x0262('0x2d')]=_[_0x0262('0x2e')](_0x5633d8[_0x0262('0x2d')]);_0x4b7598[_0x0262('0x2f')]=_['intersection'](_0x4b7598[_0x0262('0x2b')],_0x4b7598[_0x0262('0x2d')]);_0x448fe8['attributes']=_[_0x0262('0x30')](_0x4b7598[_0x0262('0x2b')],qs[_0x0262('0x31')](_0x5633d8[_0x0262('0x2d')][_0x0262('0x31')]));_0x448fe8[_0x0262('0x32')]=_0x448fe8[_0x0262('0x32')][_0x0262('0x33')]?_0x448fe8['attributes']:_0x4b7598[_0x0262('0x2b')];if(!_0x5633d8['query'][_0x0262('0x34')](_0x0262('0x35'))){_0x448fe8[_0x0262('0x1b')]=qs[_0x0262('0x1b')](_0x5633d8[_0x0262('0x2d')][_0x0262('0x1b')]);_0x448fe8[_0x0262('0x1a')]=qs[_0x0262('0x1a')](_0x5633d8[_0x0262('0x2d')][_0x0262('0x1a')]);}_0x448fe8[_0x0262('0x36')]=qs['sort'](_0x5633d8[_0x0262('0x2d')]['sort']);_0x448fe8[_0x0262('0x37')]=qs['filters'](_[_0x0262('0x38')](_0x5633d8[_0x0262('0x2d')],_0x4b7598[_0x0262('0x2f')]),_0x5f3da9);if(_0x5633d8[_0x0262('0x2d')][_0x0262('0x39')]){_0x448fe8['where']=_[_0x0262('0x3a')](_0x448fe8[_0x0262('0x37')],{'$or':_['map'](_0x5f3da9,function(_0x3df7bf){if(_0x3df7bf[_0x0262('0x29')]!==_0x0262('0x3b')){var _0x3a3e55={};_0x3a3e55[_0x3df7bf['name']]={'$like':'%'+_0x5633d8[_0x0262('0x2d')][_0x0262('0x39')]+'%'};return _0x3a3e55;}})});}_0x448fe8=_['merge']({},_0x448fe8,_0x5633d8[_0x0262('0x3c')]);var _0xd65b23={'where':_0x448fe8[_0x0262('0x37')]};return db[_0x0262('0x27')][_0x0262('0x3d')](_0xd65b23)['then'](function(_0x377c79){_0x181f0d[_0x0262('0x3d')]=_0x377c79;if(_0x5633d8[_0x0262('0x2d')][_0x0262('0x3e')]){_0x448fe8['include']=[{'all':!![]}];}return db[_0x0262('0x27')][_0x0262('0x3f')](_0x448fe8);})[_0x0262('0x21')](function(_0x1ceca6){_0x181f0d[_0x0262('0x40')]=_0x1ceca6;return _0x181f0d;})[_0x0262('0x21')](respondWithFilteredResult(_0xcb1477,_0x448fe8))['catch'](handleError(_0xcb1477,null));};exports[_0x0262('0x41')]=function(_0x5c971d,_0x3ea81d){var _0x32f173={'raw':!![],'where':{'id':_0x5c971d[_0x0262('0x42')]['id']}},_0x512868={};_0x512868[_0x0262('0x2b')]=_['keys'](db[_0x0262('0x27')][_0x0262('0x28')]);_0x512868[_0x0262('0x2d')]=_[_0x0262('0x2e')](_0x5c971d[_0x0262('0x2d')]);_0x512868['filters']=_[_0x0262('0x30')](_0x512868['model'],_0x512868['query']);_0x32f173[_0x0262('0x32')]=_[_0x0262('0x30')](_0x512868[_0x0262('0x2b')],qs[_0x0262('0x31')](_0x5c971d[_0x0262('0x2d')][_0x0262('0x31')]));_0x32f173['attributes']=_0x32f173[_0x0262('0x32')][_0x0262('0x33')]?_0x32f173[_0x0262('0x32')]:_0x512868[_0x0262('0x2b')];if(_0x5c971d[_0x0262('0x2d')][_0x0262('0x3e')]){_0x32f173[_0x0262('0x43')]=[{'all':!![]}];}_0x32f173=_[_0x0262('0x3a')]({},_0x32f173,_0x5c971d[_0x0262('0x3c')]);return db[_0x0262('0x27')][_0x0262('0x44')](_0x32f173)[_0x0262('0x21')](handleEntityNotFound(_0x3ea81d,null))['then'](respondWithResult(_0x3ea81d,null))['catch'](handleError(_0x3ea81d,null));};exports[_0x0262('0x45')]=function(_0x20cb91,_0x1ae410){return db[_0x0262('0x27')]['create'](_0x20cb91[_0x0262('0x46')],{})[_0x0262('0x21')](respondWithResult(_0x1ae410,0xc9))[_0x0262('0x47')](handleError(_0x1ae410,null));};exports[_0x0262('0x20')]=function(_0x274e78,_0x2087d1){if(_0x274e78[_0x0262('0x46')]['id']){delete _0x274e78[_0x0262('0x46')]['id'];}return db[_0x0262('0x27')][_0x0262('0x44')]({'where':{'id':_0x274e78[_0x0262('0x42')]['id']}})[_0x0262('0x21')](handleEntityNotFound(_0x2087d1,null))[_0x0262('0x21')](saveUpdates(_0x274e78[_0x0262('0x46')],null))[_0x0262('0x21')](respondWithResult(_0x2087d1,null))[_0x0262('0x47')](handleError(_0x2087d1,null));};exports['destroy']=function(_0x56399f,_0x1f2e8c){return db[_0x0262('0x27')]['find']({'where':{'id':_0x56399f[_0x0262('0x42')]['id']}})[_0x0262('0x21')](handleEntityNotFound(_0x1f2e8c,null))[_0x0262('0x21')](removeEntity(_0x1f2e8c,null))[_0x0262('0x47')](handleError(_0x1f2e8c,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index 43a21a1..626cee1 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 _0xefdf=['request-promise','path','rimraf','../../config/environment','./voiceQueuesLog.attributes','exports','define','VoiceQueuesLog','voice_queues_log','event_dtm','event','dtm','lodash','../../config/logger','api','bluebird'];(function(_0x2e7ca2,_0x956841){var _0x1085b8=function(_0x1f5e1e){while(--_0x1f5e1e){_0x2e7ca2['push'](_0x2e7ca2['shift']());}};_0x1085b8(++_0x956841);}(_0xefdf,0x15c));var _0xfefd=function(_0x1d89c3,_0x9c8b86){_0x1d89c3=_0x1d89c3-0x0;var _0x308a10=_0xefdf[_0x1d89c3];return _0x308a10;};'use strict';var _=require(_0xfefd('0x0'));var util=require('util');var logger=require(_0xfefd('0x1'))(_0xfefd('0x2'));var moment=require('moment');var BPromise=require(_0xfefd('0x3'));var rp=require(_0xfefd('0x4'));var fs=require('fs');var path=require(_0xfefd('0x5'));var rimraf=require(_0xfefd('0x6'));var config=require(_0xfefd('0x7'));var attributes=require(_0xfefd('0x8'));module[_0xfefd('0x9')]=function(_0x3f5320,_0x2db864){return _0x3f5320[_0xfefd('0xa')](_0xfefd('0xb'),attributes,{'tableName':_0xfefd('0xc'),'paranoid':![],'indexes':[{'name':_0xfefd('0xd'),'fields':[_0xfefd('0xe'),_0xfefd('0xf')]}],'timestamps':![]});}; \ No newline at end of file +var _0x9f60=['request-promise','path','rimraf','./voiceQueuesLog.attributes','exports','VoiceQueuesLog','voice_queues_log','event_dtm','event','dtm','lodash','../../config/logger','api','moment','bluebird'];(function(_0x146e67,_0x165f7b){var _0x109f1d=function(_0x2c7efb){while(--_0x2c7efb){_0x146e67['push'](_0x146e67['shift']());}};_0x109f1d(++_0x165f7b);}(_0x9f60,0x1ae));var _0x09f6=function(_0x7f8068,_0xc5bcc9){_0x7f8068=_0x7f8068-0x0;var _0x2404e4=_0x9f60[_0x7f8068];return _0x2404e4;};'use strict';var _=require(_0x09f6('0x0'));var util=require('util');var logger=require(_0x09f6('0x1'))(_0x09f6('0x2'));var moment=require(_0x09f6('0x3'));var BPromise=require(_0x09f6('0x4'));var rp=require(_0x09f6('0x5'));var fs=require('fs');var path=require(_0x09f6('0x6'));var rimraf=require(_0x09f6('0x7'));var config=require('../../config/environment');var attributes=require(_0x09f6('0x8'));module[_0x09f6('0x9')]=function(_0x5f589a,_0x56961e){return _0x5f589a['define'](_0x09f6('0xa'),attributes,{'tableName':_0x09f6('0xb'),'paranoid':![],'indexes':[{'name':_0x09f6('0xc'),'fields':[_0x09f6('0xd'),_0x09f6('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 f40bc43..d44abcb 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 _0x9969=['info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x312631,_0x28b5f9){var _0x5e5d27=function(_0x4a19bc){while(--_0x4a19bc){_0x312631['push'](_0x312631['shift']());}};_0x5e5d27(++_0x28b5f9);}(_0x9969,0x130));var _0x9996=function(_0x445878,_0x3e34d8){_0x445878=_0x445878-0x0;var _0x4c4d87=_0x9969[_0x445878];return _0x4c4d87;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x9996('0x0'));var BPromise=require(_0x9996('0x1'));var rs=require(_0x9996('0x2'));var fs=require('fs');var Redis=require(_0x9996('0x3'));var db=require(_0x9996('0x4'))['db'];var utils=require(_0x9996('0x5'));var logger=require(_0x9996('0x6'))(_0x9996('0x7'));var config=require(_0x9996('0x8'));var jayson=require(_0x9996('0x9'));var client=jayson['client'][_0x9996('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1e04f0,_0xe9a500,_0x57c7d9){return new BPromise(function(_0x154807,_0x39337c){return client['request'](_0x1e04f0,_0x57c7d9)['then'](function(_0x89638c){logger[_0x9996('0xb')](_0x9996('0xc'),_0xe9a500,_0x9996('0xd'));logger[_0x9996('0xe')](_0x9996('0xf'),_0xe9a500,_0x9996('0xd'),JSON[_0x9996('0x10')](_0x89638c));if(_0x89638c[_0x9996('0x11')]){if(_0x89638c[_0x9996('0x11')][_0x9996('0x12')]===0x1f4){logger[_0x9996('0x11')]('VoiceQueuesLog,\x20%s,\x20%s',_0xe9a500,_0x89638c[_0x9996('0x11')]['message']);return _0x39337c(_0x89638c[_0x9996('0x11')][_0x9996('0x13')]);}logger['error'](_0x9996('0xc'),_0xe9a500,_0x89638c['error'][_0x9996('0x13')]);return _0x154807(_0x89638c[_0x9996('0x11')][_0x9996('0x13')]);}else{logger[_0x9996('0xb')](_0x9996('0xc'),_0xe9a500,_0x9996('0xd'));_0x154807(_0x89638c['result'][_0x9996('0x13')]);}})[_0x9996('0x14')](function(_0x64b0a2){logger['error'](_0x9996('0xc'),_0xe9a500,_0x64b0a2);_0x39337c(_0x64b0a2);});});} \ No newline at end of file +var _0xa39b=['info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','../../config/logger','rpc','../../config/environment','jayson/promise','client','then'];(function(_0x32be9b,_0x48789d){var _0x28eabc=function(_0x1da055){while(--_0x1da055){_0x32be9b['push'](_0x32be9b['shift']());}};_0x28eabc(++_0x48789d);}(_0xa39b,0x199));var _0xba39=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xa39b[_0x59ee6f];return _0x4c0979;};'use strict';var _=require('lodash');var util=require(_0xba39('0x0'));var moment=require(_0xba39('0x1'));var BPromise=require(_0xba39('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(_0xba39('0x3'))(_0xba39('0x4'));var config=require(_0xba39('0x5'));var jayson=require(_0xba39('0x6'));var client=jayson[_0xba39('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4721d5,_0x237302,_0x3169a0){return new BPromise(function(_0xd4fb3e,_0x5c1580){return client['request'](_0x4721d5,_0x3169a0)[_0xba39('0x8')](function(_0x58492e){logger[_0xba39('0x9')](_0xba39('0xa'),_0x237302,_0xba39('0xb'));logger['debug'](_0xba39('0xc'),_0x237302,_0xba39('0xb'),JSON[_0xba39('0xd')](_0x58492e));if(_0x58492e[_0xba39('0xe')]){if(_0x58492e[_0xba39('0xe')][_0xba39('0xf')]===0x1f4){logger['error'](_0xba39('0xa'),_0x237302,_0x58492e[_0xba39('0xe')][_0xba39('0x10')]);return _0x5c1580(_0x58492e[_0xba39('0xe')][_0xba39('0x10')]);}logger[_0xba39('0xe')](_0xba39('0xa'),_0x237302,_0x58492e[_0xba39('0xe')][_0xba39('0x10')]);return _0xd4fb3e(_0x58492e[_0xba39('0xe')]['message']);}else{logger[_0xba39('0x9')](_0xba39('0xa'),_0x237302,'request\x20sent');_0xd4fb3e(_0x58492e[_0xba39('0x11')][_0xba39('0x10')]);}})[_0xba39('0x12')](function(_0x5bb9fe){logger['error'](_0xba39('0xa'),_0x237302,_0x5bb9fe);_0x5c1580(_0x5bb9fe);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index 09bb4b6..5c745f2 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 _0x700a=['util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceRecording.controller','get','isAuthenticated','index','describe','/:id','show','download','/:id/downloads','downloads','/:id/transcribe','downloadTranscribe','post','create','put','update','delete','destroy','exports','multer'];(function(_0x36643e,_0x5e365b){var _0xd0ecf6=function(_0x275cb3){while(--_0x275cb3){_0x36643e['push'](_0x36643e['shift']());}};_0xd0ecf6(++_0x5e365b);}(_0x700a,0xfb));var _0xa700=function(_0x4906ec,_0x17686a){_0x4906ec=_0x4906ec-0x0;var _0x4f4490=_0x700a[_0x4906ec];return _0x4f4490;};'use strict';var multer=require(_0xa700('0x0'));var util=require(_0xa700('0x1'));var path=require(_0xa700('0x2'));var timeout=require(_0xa700('0x3'));var express=require('express');var router=express[_0xa700('0x4')]();var fs_extra=require(_0xa700('0x5'));var auth=require(_0xa700('0x6'));var interaction=require(_0xa700('0x7'));var config=require(_0xa700('0x8'));var controller=require(_0xa700('0x9'));router[_0xa700('0xa')]('/',auth[_0xa700('0xb')](),controller[_0xa700('0xc')]);router['get']('/describe',auth[_0xa700('0xb')](),controller[_0xa700('0xd')]);router['get'](_0xa700('0xe'),auth[_0xa700('0xb')](),controller[_0xa700('0xf')]);router[_0xa700('0xa')]('/:id/download',auth[_0xa700('0xb')](),controller[_0xa700('0x10')]);router['get'](_0xa700('0x11'),controller[_0xa700('0x12')]);router[_0xa700('0xa')](_0xa700('0x13'),auth[_0xa700('0xb')](),controller[_0xa700('0x14')]);router[_0xa700('0x15')]('/',auth[_0xa700('0xb')](),controller[_0xa700('0x16')]);router[_0xa700('0x15')](_0xa700('0x13'),auth[_0xa700('0xb')](),controller['runTranscribe']);router[_0xa700('0x17')]('/:id',auth[_0xa700('0xb')](),controller[_0xa700('0x18')]);router[_0xa700('0x19')](_0xa700('0xe'),auth['isAuthenticated'](),controller[_0xa700('0x1a')]);module[_0xa700('0x1b')]=router; \ No newline at end of file +var _0x49fa=['fs-extra','../../components/interaction/service','../../config/environment','./voiceRecording.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/download','download','/:id/downloads','/:id/transcribe','create','post','put','delete','destroy','exports','multer','util','connect-timeout','express','Router'];(function(_0x52684f,_0xff73fc){var _0x4a55f0=function(_0x8ce37c){while(--_0x8ce37c){_0x52684f['push'](_0x52684f['shift']());}};_0x4a55f0(++_0xff73fc);}(_0x49fa,0x14d));var _0xa49f=function(_0x4ae04e,_0x42630b){_0x4ae04e=_0x4ae04e-0x0;var _0x57e0d5=_0x49fa[_0x4ae04e];return _0x57e0d5;};'use strict';var multer=require(_0xa49f('0x0'));var util=require(_0xa49f('0x1'));var path=require('path');var timeout=require(_0xa49f('0x2'));var express=require(_0xa49f('0x3'));var router=express[_0xa49f('0x4')]();var fs_extra=require(_0xa49f('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xa49f('0x6'));var config=require(_0xa49f('0x7'));var controller=require(_0xa49f('0x8'));router[_0xa49f('0x9')]('/',auth[_0xa49f('0xa')](),controller[_0xa49f('0xb')]);router[_0xa49f('0x9')](_0xa49f('0xc'),auth[_0xa49f('0xa')](),controller[_0xa49f('0xd')]);router[_0xa49f('0x9')](_0xa49f('0xe'),auth['isAuthenticated'](),controller[_0xa49f('0xf')]);router[_0xa49f('0x9')](_0xa49f('0x10'),auth[_0xa49f('0xa')](),controller[_0xa49f('0x11')]);router[_0xa49f('0x9')](_0xa49f('0x12'),controller['downloads']);router[_0xa49f('0x9')](_0xa49f('0x13'),auth[_0xa49f('0xa')](),controller['downloadTranscribe']);router['post']('/',auth[_0xa49f('0xa')](),controller[_0xa49f('0x14')]);router[_0xa49f('0x15')](_0xa49f('0x13'),auth[_0xa49f('0xa')](),controller['runTranscribe']);router[_0xa49f('0x16')](_0xa49f('0xe'),auth[_0xa49f('0xa')](),controller['update']);router[_0xa49f('0x17')](_0xa49f('0xe'),auth['isAuthenticated'](),controller[_0xa49f('0x18')]);module[_0xa49f('0x19')]=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index 62ec984..6ba2a12 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(_0x40220a,_0x22feb1){var _0x3903cc=function(_0x33a296){while(--_0x33a296){_0x40220a['push'](_0x40220a['shift']());}};_0x3903cc(++_0x22feb1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0xa9e0[_0x3b5250];return _0xc844a1;};'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(_0x4c12ec,_0x2e9103){var _0x3ae42c=function(_0x5a728f){while(--_0x5a728f){_0x4c12ec['push'](_0x4c12ec['shift']());}};_0x3ae42c(++_0x2e9103);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xa9e0[_0x6131cd];return _0x47e916;};'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 43ea699..bfe5557 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 _0xc810=['Not\x20found','downloads','sequelize','MD5','col','$and','push','extname','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','listBuckets','createBucket','upload','TranscribeService','startTranscriptionJob','basename','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','bucket','Bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','Location','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeName','transcribeStatus','runTranscribe','findOne','Setting','transcribeAccountId','transcribeRegion','language','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentAccountId','data2','Cloud\x20Provider\x20not\x20configured','data1','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','IN_PROGRESS','tempSentiment','updateAttributes','downloadTranscribe','fileText','root','.txt','Transcript\x20not\x20available','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','aws-sdk','uuid/v4','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','save','then','destroy','error','stack','name','index','map','VoiceRecording','rawAttributes','key','model','differenceBy','format','keys','filters','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','find','create','body','params','download','../../components/encryptor','uniqueid','value','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','unlink','message','send'];(function(_0x2e4e19,_0x493b50){var _0x9ba20b=function(_0x2f6456){while(--_0x2f6456){_0x2e4e19['push'](_0x2e4e19['shift']());}};_0x9ba20b(++_0x493b50);}(_0xc810,0x174));var _0x0c81=function(_0xeff13a,_0x1e381a){_0xeff13a=_0xeff13a-0x0;var _0x22a96c=_0xc810[_0xeff13a];return _0x22a96c;};'use strict';var emlformat=require(_0x0c81('0x0'));var rimraf=require(_0x0c81('0x1'));var zipdir=require(_0x0c81('0x2'));var jsonpatch=require(_0x0c81('0x3'));var rp=require(_0x0c81('0x4'));var moment=require(_0x0c81('0x5'));var BPromise=require(_0x0c81('0x6'));var Mustache=require(_0x0c81('0x7'));var util=require(_0x0c81('0x8'));var path=require(_0x0c81('0x9'));var sox=require(_0x0c81('0xa'));var csv=require(_0x0c81('0xb'));var ejs=require(_0x0c81('0xc'));var fs=require('fs');var fs_extra=require(_0x0c81('0xd'));var _=require(_0x0c81('0xe'));var squel=require(_0x0c81('0xf'));var crypto=require(_0x0c81('0x10'));var jsforce=require('jsforce');var deskjs=require(_0x0c81('0x11'));var toCsv=require('to-csv');var querystring=require(_0x0c81('0x12'));var Papa=require(_0x0c81('0x13'));var AWS=require(_0x0c81('0x14'));var uuidv4=require(_0x0c81('0x15'));var Redis=require(_0x0c81('0x16'));var authService=require(_0x0c81('0x17'));var qs=require('../../components/parsers/qs');var as=require(_0x0c81('0x18'));var hardwareService=require(_0x0c81('0x19'));var logger=require(_0x0c81('0x1a'))(_0x0c81('0x1b'));var utils=require(_0x0c81('0x1c'));var config=require('../../config/environment');var licenseUtil=require(_0x0c81('0x1d'));var db=require(_0x0c81('0x1e'))['db'];function respondWithStatusCode(_0x2ac773,_0x3c1104){_0x3c1104=_0x3c1104||0xcc;return function(_0x21fe07){if(_0x21fe07){return _0x2ac773[_0x0c81('0x1f')](_0x3c1104);}return _0x2ac773[_0x0c81('0x20')](_0x3c1104)[_0x0c81('0x21')]();};}function respondWithResult(_0x424c46,_0x405919){_0x405919=_0x405919||0xc8;return function(_0x426b30){if(_0x426b30){return _0x424c46['status'](_0x405919)[_0x0c81('0x22')](_0x426b30);}};}function respondWithFilteredResult(_0x40e733,_0x20abcd){return function(_0x3e5d9a){if(_0x3e5d9a){var _0x42997b=typeof _0x20abcd[_0x0c81('0x23')]===_0x0c81('0x24')&&typeof _0x20abcd[_0x0c81('0x25')]==='undefined';var _0x201d84=_0x3e5d9a[_0x0c81('0x26')];var _0x4976b0=_0x42997b?0x0:_0x20abcd[_0x0c81('0x23')];var _0x333a1d=_0x42997b?_0x3e5d9a['count']:_0x20abcd[_0x0c81('0x23')]+_0x20abcd[_0x0c81('0x25')];var _0x384a73;if(_0x333a1d>=_0x201d84){_0x333a1d=_0x201d84;_0x384a73=0xc8;}else{_0x384a73=0xce;}_0x40e733[_0x0c81('0x20')](_0x384a73);return _0x40e733[_0x0c81('0x27')](_0x0c81('0x28'),_0x4976b0+'-'+_0x333a1d+'/'+_0x201d84)['json'](_0x3e5d9a);}return null;};}function patchUpdates(_0x576821){return function(_0x3137c8){try{jsonpatch['apply'](_0x3137c8,_0x576821,!![]);}catch(_0x35a0c4){return BPromise['reject'](_0x35a0c4);}return _0x3137c8[_0x0c81('0x29')]();};}function saveUpdates(_0x15c112,_0x49d659){return function(_0x2c9404){if(_0x2c9404){return _0x2c9404['update'](_0x15c112)[_0x0c81('0x2a')](function(_0x381d8d){return _0x381d8d;});}return null;};}function removeEntity(_0x234249,_0xecc8a2){return function(_0x2c06fc){if(_0x2c06fc){return _0x2c06fc[_0x0c81('0x2b')]()['then'](function(){_0x234249['status'](0xcc)[_0x0c81('0x21')]();});}};}function handleEntityNotFound(_0x476f2a,_0x4f7847){return function(_0x23078b){if(!_0x23078b){_0x476f2a[_0x0c81('0x1f')](0x194);}return _0x23078b;};}function handleError(_0x35f60e,_0xa50909){_0xa50909=_0xa50909||0x1f4;return function(_0x28cc03){logger[_0x0c81('0x2c')](_0x28cc03[_0x0c81('0x2d')]);if(_0x28cc03[_0x0c81('0x2e')]){delete _0x28cc03['name'];}_0x35f60e[_0x0c81('0x20')](_0xa50909)['send'](_0x28cc03);};}exports[_0x0c81('0x2f')]=function(_0x181e4d,_0x2a00dd){var _0x495428={},_0x364f11={},_0x1ffb87={'count':0x0,'rows':[]};var _0xfa8039=_[_0x0c81('0x30')](db[_0x0c81('0x31')][_0x0c81('0x32')],function(_0x2f52ca){return{'name':_0x2f52ca['fieldName'],'type':_0x2f52ca['type'][_0x0c81('0x33')]};});_0x364f11[_0x0c81('0x34')]=_[_0x0c81('0x35')](_[_0x0c81('0x30')](_0xfa8039,_0x0c81('0x2e')),[_0x0c81('0x36')]);_0x364f11['query']=_[_0x0c81('0x37')](_0x181e4d['query']);_0x364f11[_0x0c81('0x38')]=_[_0x0c81('0x39')](_0x364f11[_0x0c81('0x34')],_0x364f11['query']);_0x495428['attributes']=_[_0x0c81('0x39')](_0x364f11[_0x0c81('0x34')],qs['fields'](_0x181e4d[_0x0c81('0x3a')][_0x0c81('0x3b')]));_0x495428[_0x0c81('0x3c')]=_0x495428[_0x0c81('0x3c')][_0x0c81('0x3d')]?_0x495428[_0x0c81('0x3c')]:_0x364f11[_0x0c81('0x34')];if(!_0x181e4d['query'][_0x0c81('0x3e')](_0x0c81('0x3f'))){_0x495428['limit']=qs[_0x0c81('0x25')](_0x181e4d[_0x0c81('0x3a')][_0x0c81('0x25')]);_0x495428[_0x0c81('0x23')]=qs['offset'](_0x181e4d['query'][_0x0c81('0x23')]);}_0x495428[_0x0c81('0x40')]=qs[_0x0c81('0x41')](_0x181e4d[_0x0c81('0x3a')][_0x0c81('0x41')]);_0x495428[_0x0c81('0x42')]=qs[_0x0c81('0x38')](_[_0x0c81('0x43')](_0x181e4d['query'],_0x364f11['filters']),_0xfa8039);if(_0x181e4d[_0x0c81('0x3a')][_0x0c81('0x44')]){_0x495428[_0x0c81('0x42')]=_[_0x0c81('0x45')](_0x495428[_0x0c81('0x42')],{'$or':_['map'](_0xfa8039,function(_0x2d221e){if(_0x2d221e[_0x0c81('0x46')]!==_0x0c81('0x47')){var _0xeba2b7={};_0xeba2b7[_0x2d221e['name']]={'$like':'%'+_0x181e4d[_0x0c81('0x3a')][_0x0c81('0x44')]+'%'};return _0xeba2b7;}})});}_0x495428=_[_0x0c81('0x45')]({},_0x495428,_0x181e4d[_0x0c81('0x48')]);var _0xcee528={'where':_0x495428[_0x0c81('0x42')]};return db[_0x0c81('0x31')][_0x0c81('0x26')](_0xcee528)[_0x0c81('0x2a')](function(_0x208119){_0x1ffb87[_0x0c81('0x26')]=_0x208119;if(_0x181e4d[_0x0c81('0x3a')][_0x0c81('0x49')]){_0x495428[_0x0c81('0x4a')]=[{'all':!![]}];}return db[_0x0c81('0x31')][_0x0c81('0x4b')](_0x495428);})[_0x0c81('0x2a')](function(_0x5b9247){_0x1ffb87[_0x0c81('0x4c')]=_0x5b9247;return _0x1ffb87;})[_0x0c81('0x2a')](respondWithFilteredResult(_0x2a00dd,_0x495428))[_0x0c81('0x4d')](handleError(_0x2a00dd,null));};exports[_0x0c81('0x4e')]=function(_0x1e32df,_0x4c4815){var _0xc2ac98={'raw':![],'where':{'id':_0x1e32df['params']['id']}},_0x4c2e77={};_0x4c2e77[_0x0c81('0x34')]=_[_0x0c81('0x37')](db[_0x0c81('0x31')][_0x0c81('0x32')]);_0x4c2e77[_0x0c81('0x3a')]=_[_0x0c81('0x37')](_0x1e32df[_0x0c81('0x3a')]);_0x4c2e77[_0x0c81('0x38')]=_[_0x0c81('0x39')](_0x4c2e77[_0x0c81('0x34')],_0x4c2e77[_0x0c81('0x3a')]);_0xc2ac98[_0x0c81('0x3c')]=_[_0x0c81('0x39')](_0x4c2e77[_0x0c81('0x34')],qs[_0x0c81('0x3b')](_0x1e32df['query'][_0x0c81('0x3b')]));_0xc2ac98[_0x0c81('0x3c')]=_0xc2ac98['attributes'][_0x0c81('0x3d')]?_0xc2ac98[_0x0c81('0x3c')]:_0x4c2e77[_0x0c81('0x34')];if(_0x1e32df[_0x0c81('0x3a')][_0x0c81('0x49')]){_0xc2ac98[_0x0c81('0x4a')]=[{'all':!![]}];}_0xc2ac98=_[_0x0c81('0x45')]({},_0xc2ac98,_0x1e32df[_0x0c81('0x48')]);return db[_0x0c81('0x31')][_0x0c81('0x4f')](_0xc2ac98)[_0x0c81('0x2a')](handleEntityNotFound(_0x4c4815,null))[_0x0c81('0x2a')](respondWithResult(_0x4c4815,null))[_0x0c81('0x4d')](handleError(_0x4c4815,null));};exports[_0x0c81('0x50')]=function(_0xbba674,_0x2e1e0b){return db[_0x0c81('0x31')][_0x0c81('0x50')](_0xbba674[_0x0c81('0x51')],{})[_0x0c81('0x2a')](respondWithResult(_0x2e1e0b,0xc9))[_0x0c81('0x4d')](handleError(_0x2e1e0b,null));};exports['update']=function(_0x195dc1,_0x3c4c13){if(_0x195dc1[_0x0c81('0x51')]['id']){delete _0x195dc1[_0x0c81('0x51')]['id'];}return db[_0x0c81('0x31')]['find']({'where':{'id':_0x195dc1[_0x0c81('0x52')]['id']}})[_0x0c81('0x2a')](handleEntityNotFound(_0x3c4c13,null))[_0x0c81('0x2a')](saveUpdates(_0x195dc1[_0x0c81('0x51')],null))[_0x0c81('0x2a')](respondWithResult(_0x3c4c13,null))[_0x0c81('0x4d')](handleError(_0x3c4c13,null));};exports['describe']=function(_0x2c6361,_0x2fd1a6){return db['VoiceRecording']['describe']()[_0x0c81('0x2a')](respondWithResult(_0x2fd1a6,null))[_0x0c81('0x4d')](handleError(_0x2fd1a6,null));};exports[_0x0c81('0x53')]=function(_0x2e9ec1,_0x2bd405,_0x4c8634){var _0x2aa1a5=require(_0x0c81('0x54'));var _0xf82196=![];var _0x2891e5={};if(_0x2e9ec1[_0x0c81('0x3a')][_0x0c81('0x46')]&&_0x2e9ec1[_0x0c81('0x3a')]['type']===_0x0c81('0x55')){_0x2891e5['uniqueid']=_0x2e9ec1['params']['id'];}else{_0x2891e5['id']=_0x2e9ec1[_0x0c81('0x52')]['id'];}return db[_0x0c81('0x31')][_0x0c81('0x4f')]({'where':_0x2891e5,'attributes':['id',_0x0c81('0x56')],'raw':!![]})[_0x0c81('0x2a')](handleEntityNotFound(_0x2bd405,null))[_0x0c81('0x2a')](function(_0x5103a5){if(_0x5103a5){var _0xc348d=_0x5103a5[_0x0c81('0x56')];var _0x11067b=util[_0x0c81('0x36')](_0x0c81('0x57'),_0xc348d);if(fs[_0x0c81('0x58')](_0x11067b)){_0xf82196=!![];return _0x2aa1a5[_0x0c81('0x59')](_0x11067b,_0xc348d,config[_0x0c81('0x5a')][_0x0c81('0x5b')])[_0x0c81('0x2a')](function(){return _0x5103a5;});}return _0x5103a5;}})[_0x0c81('0x2a')](function(_0x3199d6){if(_0x3199d6){var _0xffc5ab=_0x3199d6[_0x0c81('0x56')];if(!fs[_0x0c81('0x58')](_0xffc5ab)){throw new db[(_0x0c81('0x5c'))][(_0x0c81('0x5d'))](_0x0c81('0x5e'));}if(_0x3199d6['filename']){return _0x2bd405[_0x0c81('0x53')](_0xffc5ab,_0x3199d6[_0x0c81('0x5f')]+path['extname'](_0xffc5ab),function(){if(_0xf82196){fs['unlink'](_0xffc5ab);}});}else{return _0x2bd405['download'](_0xffc5ab,function(_0xfda56b){if(_0xf82196){fs[_0x0c81('0x60')](_0xffc5ab);}});}}})[_0x0c81('0x4d')](function(_0x81a9ab){if(_0x81a9ab[_0x0c81('0x61')]==='VoiceRecording\x20not\x20found'){_0x2bd405[_0x0c81('0x20')](0x194)[_0x0c81('0x62')](_0x0c81('0x63'));}else{return handleError(_0x2bd405,null);}});};exports[_0x0c81('0x64')]=function(_0x4d53e6,_0x22ad9e,_0x421245){var _0x35cf6e=require(_0x0c81('0x54'));var _0x35510b=![];var _0x4599e5={'$and':[db[_0x0c81('0x65')][_0x0c81('0x42')](db[_0x0c81('0x65')]['fn'](_0x0c81('0x66'),db[_0x0c81('0x65')][_0x0c81('0x67')](_0x0c81('0x55'))),_0x4d53e6[_0x0c81('0x3a')]['token'])]};if(_0x4d53e6[_0x0c81('0x3a')][_0x0c81('0x46')]&&_0x4d53e6[_0x0c81('0x3a')]['type']===_0x0c81('0x55')){_0x4599e5[_0x0c81('0x68')][_0x0c81('0x69')]({'uniqueid':_0x4d53e6[_0x0c81('0x52')]['id']});}else{_0x4599e5[_0x0c81('0x68')]['push']({'id':_0x4d53e6[_0x0c81('0x52')]['id']});}return db[_0x0c81('0x31')][_0x0c81('0x4f')]({'where':_0x4599e5,'attributes':['id',_0x0c81('0x56')],'raw':!![]})[_0x0c81('0x2a')](handleEntityNotFound(_0x22ad9e,null))['then'](function(_0x56a5d9){if(_0x56a5d9){var _0x25e2f6=util[_0x0c81('0x36')](_0x0c81('0x57'),_0x56a5d9[_0x0c81('0x56')]);if(fs['existsSync'](_0x25e2f6)){_0x35510b=!![];return _0x35cf6e[_0x0c81('0x59')](_0x25e2f6,_0x56a5d9['value'],config[_0x0c81('0x5a')]['recording'])[_0x0c81('0x2a')](function(){return _0x56a5d9;});}return _0x56a5d9;}})[_0x0c81('0x2a')](function(_0x3c9383){if(_0x3c9383){if(!fs[_0x0c81('0x58')](_0x3c9383[_0x0c81('0x56')])){throw new db[(_0x0c81('0x5c'))][(_0x0c81('0x5d'))]('VoiceRecording\x20not\x20found');}if(_0x3c9383['filename']){return _0x22ad9e[_0x0c81('0x53')](_0x3c9383[_0x0c81('0x56')],_0x3c9383[_0x0c81('0x5f')]+path[_0x0c81('0x6a')](_0x3c9383[_0x0c81('0x56')]),function(){if(_0x35510b){fs[_0x0c81('0x60')](_0x3c9383[_0x0c81('0x56')]);}});}else{return _0x22ad9e[_0x0c81('0x53')](_0x3c9383['value'],function(_0xb59b78){if(_0x35510b){fs['unlink'](_0x3c9383[_0x0c81('0x56')]);}});}}})[_0x0c81('0x4d')](handleError(_0x22ad9e,null));};exports[_0x0c81('0x2b')]=function(_0x65e17f,_0x308ee6){return db[_0x0c81('0x31')][_0x0c81('0x4f')]({'where':{'id':_0x65e17f['params']['id']}})['then'](function(_0x5f298e){if(_[_0x0c81('0x6b')](_0x5f298e)){throw new ReferenceError(_0x0c81('0x6c'));}return _0x5f298e;})[_0x0c81('0x2a')](function(_0x22ed96){var _0x5809f7=_0x22ed96[_0x0c81('0x56')];logger[_0x0c81('0x6d')](_0x0c81('0x6e'),_0x5809f7);if(!_['isNil'](_0x22ed96[_0x0c81('0x56')])&&fs['existsSync'](_0x5809f7)){logger[_0x0c81('0x6d')](_0x0c81('0x6f')+_0x5809f7+_0x0c81('0x70'));fs[_0x0c81('0x71')](_0x5809f7);}_0x5809f7=_0x5809f7+_0x0c81('0x72');if(!_[_0x0c81('0x6b')](_0x22ed96[_0x0c81('0x56')])&&fs[_0x0c81('0x58')](_0x5809f7)){logger[_0x0c81('0x6d')]('File:\x20\x22'+_0x5809f7+_0x0c81('0x70'));fs[_0x0c81('0x71')](_0x5809f7);}return _0x22ed96;})[_0x0c81('0x2a')](function(_0x52c69e){if(!_0x52c69e)throw new InternalError();return _0x52c69e[_0x0c81('0x2b')]();})['then'](function(){_0x308ee6['status'](0xcc)[_0x0c81('0x21')]();})[_0x0c81('0x4d')](handleError(_0x308ee6,null));};function getBucketslist(_0x2a87a2,_0x3b45ed,_0x27f974){return new Promise(function(_0x593ec2,_0x18c483){var _0x3c86f5=new AWS['S3']({'accessKeyId':_0x3b45ed,'secretAccessKey':_0x2a87a2,'region':_0x27f974});_0x3c86f5[_0x0c81('0x73')]({},function(_0x43befe,_0x187aac){if(_0x43befe){return _0x18c483(_0x43befe);}else{return _0x593ec2(_0x187aac);}});});}function createBucket(_0x235068,_0x468876,_0x5a2ec5,_0x314b11){return new Promise(function(_0x430c98,_0x5f4d35){var _0x4a39e4=new AWS['S3']({'accessKeyId':_0x468876,'secretAccessKey':_0x235068,'region':_0x5a2ec5});_0x4a39e4[_0x0c81('0x74')]({'Bucket':_0x314b11},function(_0x46af3b,_0x46ceac){if(_0x46af3b){return _0x5f4d35(_0x46af3b);}else{return _0x430c98(_0x46ceac);}});});}function uploadFile(_0x2fa24c,_0xe40480,_0x40b4a7,_0x594ff7,_0x5a453e,_0x5bf8b9){return new Promise(function(_0x4287bb,_0x2bf220){var _0x19f4ef=new AWS['S3']({'accessKeyId':_0xe40480,'secretAccessKey':_0x2fa24c,'region':_0x40b4a7});_0x19f4ef[_0x0c81('0x75')]({'Bucket':_0x594ff7,'Key':_0x5a453e,'Body':_0x5bf8b9},function(_0x2ab7ec,_0xcfccc4){if(_0x2ab7ec){return _0x2bf220(_0x2ab7ec);}else{return _0x4287bb(_0xcfccc4);}});});}function startTranscribe(_0x4d66a5,_0x2c9c77,_0x4bf091,_0x3fc710,_0x5adc56,_0x5f50fa){return new Promise(function(_0x238425,_0x5e3d4a){var _0x8fd16b=new AWS[(_0x0c81('0x76'))]({'accessKeyId':_0x2c9c77,'secretAccessKey':_0x4d66a5,'region':_0x4bf091});_0x8fd16b[_0x0c81('0x77')]({'TranscriptionJobName':_0x3fc710,'LanguageCode':_0x5adc56,'Media':{'MediaFileUri':_0x5f50fa}},function(_0x4b83d1,_0x14759d){if(_0x4b83d1){return _0x5e3d4a(_0x4b83d1);}else{return _0x238425(_0x14759d);}});});}function transcribe(_0x51b784,_0x2bf784,_0x34246c,_0x42b86b,_0x23ccef,_0x4912fe,_0x15b04d){return new Promise(function(_0x5856aa,_0x5ce433){var _0x576149={};logger[_0x0c81('0x6d')](util[_0x0c81('0x36')]('[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s',_0x51b784,_0x23ccef));return uploadFile(_0x2bf784,_0x34246c,_0x42b86b,_0x23ccef,path[_0x0c81('0x78')](_0x4912fe),fs['readFileSync'](_0x4912fe))[_0x0c81('0x2a')](function(_0xf40246){logger[_0x0c81('0x6d')](util[_0x0c81('0x36')](_0x0c81('0x79'),_0x51b784,_0x23ccef,_0xf40246['Location']));_0x576149[_0x0c81('0x7a')]=_0xf40246[_0x0c81('0x7b')];_0x576149[_0x0c81('0x7c')]=_0xf40246['Location'];logger[_0x0c81('0x6d')](util[_0x0c81('0x36')](_0x0c81('0x7d'),_0x51b784));return startTranscribe(_0x2bf784,_0x34246c,_0x42b86b,uuidv4(),_0x15b04d,_0xf40246[_0x0c81('0x7e')]);})[_0x0c81('0x2a')](function(_0xea6953){logger['info'](util[_0x0c81('0x36')](_0x0c81('0x7f'),_0x51b784,_0xea6953[_0x0c81('0x80')][_0x0c81('0x81')]));_0x576149[_0x0c81('0x82')]=_0xea6953['TranscriptionJob'][_0x0c81('0x81')];_0x576149[_0x0c81('0x83')]=_0xea6953[_0x0c81('0x80')]['TranscriptionJobStatus'];return _0x5856aa(_0x576149);})[_0x0c81('0x4d')](function(_0x1506f8){return _0x5ce433(_0x1506f8);});});}exports[_0x0c81('0x84')]=function(_0x4f79c6,_0xafd031,_0x1fb2f8){var _0x3f1403;var _0x45bb5d;var _0x24064f;var _0x25653a=require('../../components/encryptor');return db['VoiceRecording'][_0x0c81('0x85')]({'where':{'id':_0x4f79c6[_0x0c81('0x52')]['id']}})['then'](function(_0x48bf9f){if(_0x48bf9f){var _0x5abc29=util['format']('%s.cypher',_0x48bf9f['value']);if(fs['existsSync'](_0x5abc29)){cypher=!![];return _0x25653a['decryptFile'](_0x5abc29,_0x48bf9f[_0x0c81('0x56')],config[_0x0c81('0x5a')][_0x0c81('0x5b')])['then'](function(){return _0x48bf9f;});}return _0x48bf9f;}})[_0x0c81('0x2a')](function(_0x151b5c){if(!_0x151b5c){throw new db['Sequelize'][(_0x0c81('0x5d'))]('Voice\x20Recording\x20not\x20found');}_0x45bb5d=_0x151b5c;return db[_0x0c81('0x86')]['findOne']({'where':{'id':0x1}});})['then'](handleEntityNotFound(_0xafd031,null))['then'](function(_0x13063d){if(_0x13063d){_0x3f1403=_0x13063d;if(!_0x3f1403['transcribe']||!_0x3f1403[_0x0c81('0x87')]||!_0x3f1403[_0x0c81('0x88')]||!_0x3f1403[_0x0c81('0x89')]||!_0x3f1403[_0x0c81('0x7a')]){throw new db[(_0x0c81('0x5c'))]['ValidationError'](_0x0c81('0x8a'));}if(_0x4f79c6[_0x0c81('0x51')][_0x0c81('0x8b')]&&(!_0x3f1403[_0x0c81('0x8c')]||!_0x3f1403[_0x0c81('0x8d')]||!_0x3f1403['sentimentRegion']||!_0x3f1403[_0x0c81('0x89')]||!_0x3f1403[_0x0c81('0x7a')])){throw new db[(_0x0c81('0x5c'))][(_0x0c81('0x5d'))]('Sentiment\x20Analysis\x20not\x20configured');}return db['CloudProvider'][_0x0c81('0x85')]({'where':{'id':_0x3f1403['transcribeAccountId']}});}})[_0x0c81('0x2a')](function(_0x5033a9){if(!_0x5033a9){throw new db[(_0x0c81('0x5c'))][(_0x0c81('0x5d'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x5033a9['data1']||!_0x5033a9[_0x0c81('0x8e')]){throw new db[(_0x0c81('0x5c'))]['ValidationError'](_0x0c81('0x8f'));}_0x24064f=_0x5033a9;return getBucketslist(_0x24064f[_0x0c81('0x90')],_0x24064f[_0x0c81('0x8e')],_0x3f1403['transcribeRegion']);})['then'](function(_0x4bdb8f){if(_0x4bdb8f&&_0x4bdb8f['Buckets']){var _0x2f3279=_[_0x0c81('0x4f')](_0x4bdb8f['Buckets'],function(_0x550a78){return _0x550a78[_0x0c81('0x91')]===_0x3f1403[_0x0c81('0x7a')];});if(!_0x2f3279){logger['info'](util[_0x0c81('0x36')](_0x0c81('0x92'),_0x4f79c6[_0x0c81('0x52')]['id'],_0x3f1403[_0x0c81('0x7a')]));return createBucket(_0x24064f[_0x0c81('0x90')],_0x24064f[_0x0c81('0x8e')],_0x3f1403[_0x0c81('0x88')],_0x3f1403[_0x0c81('0x7a')]);}logger['info'](util[_0x0c81('0x36')](_0x0c81('0x93'),_0x4f79c6['params']['id'],_0x3f1403['bucket']));return;}})[_0x0c81('0x2a')](function(_0x5827b9){if(_0x45bb5d[_0x0c81('0x83')]===_0x0c81('0x94')){return transcribe(_0x4f79c6[_0x0c81('0x52')]['id'],_0x24064f['data1'],_0x24064f[_0x0c81('0x8e')],_0x3f1403[_0x0c81('0x88')],_0x3f1403[_0x0c81('0x7a')],_0x45bb5d[_0x0c81('0x56')],_0x3f1403['language']);}else{logger['info'](util[_0x0c81('0x36')]('[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested',_0x4f79c6[_0x0c81('0x52')]['id']));return{'transcribeStatus':_0x0c81('0x95')};}})['then'](function(_0x463f0d){if(_0x463f0d){_0x463f0d[_0x0c81('0x96')]=_0x4f79c6[_0x0c81('0x51')][_0x0c81('0x8b')];return _0x45bb5d[_0x0c81('0x97')](_0x463f0d);}})[_0x0c81('0x2a')](respondWithResult(_0xafd031,null))['catch'](handleError(_0xafd031,null));};function writeFile(_0x610e33,_0x66dc15){return new Promise(function(_0x125481,_0x4d398c){fs['writeFile'](_0x66dc15,_0x610e33,function(_0x1c8220,_0x24f344){if(_0x1c8220){return _0x4d398c(_0x1c8220);}else{return _0x125481(_0x24f344);}});});}exports[_0x0c81('0x98')]=function(_0x5735ed,_0x1ae442,_0x568609){return db[_0x0c81('0x31')][_0x0c81('0x85')]({'where':{'id':_0x5735ed['params']['id']}})['then'](handleEntityNotFound(_0x1ae442))[_0x0c81('0x2a')](function(_0x43edf6){if(_0x43edf6&&_0x43edf6[_0x0c81('0x99')]){var _0x356271=_0x43edf6[_0x0c81('0x99')];var _0x1c667f=config[_0x0c81('0x9a')]+'/server/files/transcribes/transcribe_'+_0x43edf6['id']+_0x0c81('0x9b');if(fs[_0x0c81('0x58')](_0x1c667f)){return _0x1c667f;}return writeFile(_0x356271,_0x1c667f)[_0x0c81('0x2a')](function(){return _0x1c667f;});}else{throw new db['Sequelize'][(_0x0c81('0x5d'))](_0x0c81('0x9c'));}})['then'](function(_0x9b5936){return _0x1ae442['download'](_0x9b5936);})[_0x0c81('0x4d')](handleError(_0x1ae442));}; \ No newline at end of file +var _0x6ef4=['runSentiment','sentiment','sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','data1','data2','Cloud\x20Provider\x20not\x20configured','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','transcribeRegion','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','writeFile','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_','.txt','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','lodash','squel','crypto','jsforce','desk.js','querystring','aws-sdk','uuid/v4','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','end','json','offset','limit','undefined','count','apply','reject','update','then','error','stack','name','send','index','type','key','differenceBy','map','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','where','merge','VIRTUAL','options','VoiceRecording','includeAll','include','findAll','rows','catch','show','params','rawAttributes','create','body','describe','download','uniqueid','find','value','%s.cypher','existsSync','recording','ValidationError','VoiceRecording\x20not\x20found','filename','unlink','message','Not\x20found','downloads','../../components/encryptor','sequelize','MD5','$and','push','format','secrets','extname','destroy','cancellazione\x20fisica\x20documento\x20%s','isNil','info','File:\x20\x22','.cypher','upload','TranscribeService','[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','transcribeStatus','TranscriptionJob','TranscriptionJobStatus','runTranscribe','findOne','Sequelize','Voice\x20Recording\x20not\x20found','Setting','transcribe','transcribeAccountId','language','Transcribe\x20not\x20configured'];(function(_0x1fc659,_0x2cd6ef){var _0x290165=function(_0x1e9f7e){while(--_0x1e9f7e){_0x1fc659['push'](_0x1fc659['shift']());}};_0x290165(++_0x2cd6ef);}(_0x6ef4,0x141));var _0x46ef=function(_0x4a5213,_0x27ccaa){_0x4a5213=_0x4a5213-0x0;var _0x6bec52=_0x6ef4[_0x4a5213];return _0x6bec52;};'use strict';var emlformat=require(_0x46ef('0x0'));var rimraf=require(_0x46ef('0x1'));var zipdir=require(_0x46ef('0x2'));var jsonpatch=require(_0x46ef('0x3'));var rp=require(_0x46ef('0x4'));var moment=require(_0x46ef('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x46ef('0x6'));var path=require(_0x46ef('0x7'));var sox=require(_0x46ef('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x46ef('0x9'));var squel=require(_0x46ef('0xa'));var crypto=require(_0x46ef('0xb'));var jsforce=require(_0x46ef('0xc'));var deskjs=require(_0x46ef('0xd'));var toCsv=require('to-csv');var querystring=require(_0x46ef('0xe'));var Papa=require('papaparse');var AWS=require(_0x46ef('0xf'));var uuidv4=require(_0x46ef('0x10'));var Redis=require(_0x46ef('0x11'));var authService=require(_0x46ef('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x46ef('0x13'));var hardwareService=require(_0x46ef('0x14'));var logger=require(_0x46ef('0x15'))(_0x46ef('0x16'));var utils=require('../../config/utils');var config=require(_0x46ef('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1dddb1,_0x43e6b2){_0x43e6b2=_0x43e6b2||0xcc;return function(_0x2a20d8){if(_0x2a20d8){return _0x1dddb1[_0x46ef('0x18')](_0x43e6b2);}return _0x1dddb1[_0x46ef('0x19')](_0x43e6b2)[_0x46ef('0x1a')]();};}function respondWithResult(_0x4da097,_0xf5e213){_0xf5e213=_0xf5e213||0xc8;return function(_0x2bb582){if(_0x2bb582){return _0x4da097[_0x46ef('0x19')](_0xf5e213)[_0x46ef('0x1b')](_0x2bb582);}};}function respondWithFilteredResult(_0x5a394a,_0x5bb104){return function(_0xc1e05a){if(_0xc1e05a){var _0x509ee0=typeof _0x5bb104[_0x46ef('0x1c')]==='undefined'&&typeof _0x5bb104[_0x46ef('0x1d')]===_0x46ef('0x1e');var _0x3efeb1=_0xc1e05a['count'];var _0x351a29=_0x509ee0?0x0:_0x5bb104[_0x46ef('0x1c')];var _0x4dc902=_0x509ee0?_0xc1e05a[_0x46ef('0x1f')]:_0x5bb104['offset']+_0x5bb104['limit'];var _0x31a685;if(_0x4dc902>=_0x3efeb1){_0x4dc902=_0x3efeb1;_0x31a685=0xc8;}else{_0x31a685=0xce;}_0x5a394a[_0x46ef('0x19')](_0x31a685);return _0x5a394a['set']('Content-Range',_0x351a29+'-'+_0x4dc902+'/'+_0x3efeb1)[_0x46ef('0x1b')](_0xc1e05a);}return null;};}function patchUpdates(_0x1b564a){return function(_0x5343a8){try{jsonpatch[_0x46ef('0x20')](_0x5343a8,_0x1b564a,!![]);}catch(_0x2603e9){return BPromise[_0x46ef('0x21')](_0x2603e9);}return _0x5343a8['save']();};}function saveUpdates(_0x1ceb03,_0x51d4d8){return function(_0x13e102){if(_0x13e102){return _0x13e102[_0x46ef('0x22')](_0x1ceb03)[_0x46ef('0x23')](function(_0x1b9469){return _0x1b9469;});}return null;};}function removeEntity(_0x3e571c,_0x20b679){return function(_0x5a6a46){if(_0x5a6a46){return _0x5a6a46['destroy']()[_0x46ef('0x23')](function(){_0x3e571c[_0x46ef('0x19')](0xcc)[_0x46ef('0x1a')]();});}};}function handleEntityNotFound(_0x23d6c5,_0x5ea51c){return function(_0x3d7db4){if(!_0x3d7db4){_0x23d6c5[_0x46ef('0x18')](0x194);}return _0x3d7db4;};}function handleError(_0xcb533b,_0xa8fff4){_0xa8fff4=_0xa8fff4||0x1f4;return function(_0x4c1f86){logger[_0x46ef('0x24')](_0x4c1f86[_0x46ef('0x25')]);if(_0x4c1f86[_0x46ef('0x26')]){delete _0x4c1f86['name'];}_0xcb533b[_0x46ef('0x19')](_0xa8fff4)[_0x46ef('0x27')](_0x4c1f86);};}exports[_0x46ef('0x28')]=function(_0x9ad46d,_0x4d4f38){var _0x21d107={},_0x112fb1={},_0x31ef6d={'count':0x0,'rows':[]};var _0x4c3e7f=_['map'](db['VoiceRecording']['rawAttributes'],function(_0x59d0d4){return{'name':_0x59d0d4['fieldName'],'type':_0x59d0d4[_0x46ef('0x29')][_0x46ef('0x2a')]};});_0x112fb1['model']=_[_0x46ef('0x2b')](_[_0x46ef('0x2c')](_0x4c3e7f,'name'),['format']);_0x112fb1[_0x46ef('0x2d')]=_[_0x46ef('0x2e')](_0x9ad46d['query']);_0x112fb1['filters']=_[_0x46ef('0x2f')](_0x112fb1[_0x46ef('0x30')],_0x112fb1['query']);_0x21d107[_0x46ef('0x31')]=_[_0x46ef('0x2f')](_0x112fb1[_0x46ef('0x30')],qs['fields'](_0x9ad46d[_0x46ef('0x2d')][_0x46ef('0x32')]));_0x21d107[_0x46ef('0x31')]=_0x21d107[_0x46ef('0x31')][_0x46ef('0x33')]?_0x21d107[_0x46ef('0x31')]:_0x112fb1['model'];if(!_0x9ad46d[_0x46ef('0x2d')][_0x46ef('0x34')](_0x46ef('0x35'))){_0x21d107['limit']=qs['limit'](_0x9ad46d[_0x46ef('0x2d')][_0x46ef('0x1d')]);_0x21d107['offset']=qs[_0x46ef('0x1c')](_0x9ad46d[_0x46ef('0x2d')][_0x46ef('0x1c')]);}_0x21d107[_0x46ef('0x36')]=qs['sort'](_0x9ad46d['query'][_0x46ef('0x37')]);_0x21d107['where']=qs[_0x46ef('0x38')](_['pick'](_0x9ad46d[_0x46ef('0x2d')],_0x112fb1[_0x46ef('0x38')]),_0x4c3e7f);if(_0x9ad46d['query'][_0x46ef('0x39')]){_0x21d107[_0x46ef('0x3a')]=_[_0x46ef('0x3b')](_0x21d107[_0x46ef('0x3a')],{'$or':_[_0x46ef('0x2c')](_0x4c3e7f,function(_0x718ae0){if(_0x718ae0[_0x46ef('0x29')]!==_0x46ef('0x3c')){var _0x42a671={};_0x42a671[_0x718ae0[_0x46ef('0x26')]]={'$like':'%'+_0x9ad46d[_0x46ef('0x2d')]['filter']+'%'};return _0x42a671;}})});}_0x21d107=_[_0x46ef('0x3b')]({},_0x21d107,_0x9ad46d[_0x46ef('0x3d')]);var _0x15b07e={'where':_0x21d107['where']};return db[_0x46ef('0x3e')]['count'](_0x15b07e)[_0x46ef('0x23')](function(_0x21b1a0){_0x31ef6d[_0x46ef('0x1f')]=_0x21b1a0;if(_0x9ad46d[_0x46ef('0x2d')][_0x46ef('0x3f')]){_0x21d107[_0x46ef('0x40')]=[{'all':!![]}];}return db[_0x46ef('0x3e')][_0x46ef('0x41')](_0x21d107);})['then'](function(_0x16b549){_0x31ef6d[_0x46ef('0x42')]=_0x16b549;return _0x31ef6d;})[_0x46ef('0x23')](respondWithFilteredResult(_0x4d4f38,_0x21d107))[_0x46ef('0x43')](handleError(_0x4d4f38,null));};exports[_0x46ef('0x44')]=function(_0x39cc49,_0x1567e4){var _0x867770={'raw':![],'where':{'id':_0x39cc49[_0x46ef('0x45')]['id']}},_0x5a760b={};_0x5a760b[_0x46ef('0x30')]=_[_0x46ef('0x2e')](db['VoiceRecording'][_0x46ef('0x46')]);_0x5a760b[_0x46ef('0x2d')]=_['keys'](_0x39cc49[_0x46ef('0x2d')]);_0x5a760b[_0x46ef('0x38')]=_['intersection'](_0x5a760b['model'],_0x5a760b[_0x46ef('0x2d')]);_0x867770['attributes']=_[_0x46ef('0x2f')](_0x5a760b[_0x46ef('0x30')],qs[_0x46ef('0x32')](_0x39cc49[_0x46ef('0x2d')][_0x46ef('0x32')]));_0x867770[_0x46ef('0x31')]=_0x867770[_0x46ef('0x31')]['length']?_0x867770[_0x46ef('0x31')]:_0x5a760b[_0x46ef('0x30')];if(_0x39cc49[_0x46ef('0x2d')][_0x46ef('0x3f')]){_0x867770[_0x46ef('0x40')]=[{'all':!![]}];}_0x867770=_[_0x46ef('0x3b')]({},_0x867770,_0x39cc49[_0x46ef('0x3d')]);return db[_0x46ef('0x3e')]['find'](_0x867770)[_0x46ef('0x23')](handleEntityNotFound(_0x1567e4,null))[_0x46ef('0x23')](respondWithResult(_0x1567e4,null))[_0x46ef('0x43')](handleError(_0x1567e4,null));};exports[_0x46ef('0x47')]=function(_0x3ccc1d,_0x1a45b0){return db[_0x46ef('0x3e')][_0x46ef('0x47')](_0x3ccc1d['body'],{})[_0x46ef('0x23')](respondWithResult(_0x1a45b0,0xc9))['catch'](handleError(_0x1a45b0,null));};exports[_0x46ef('0x22')]=function(_0x3bc70c,_0xc3ecfc){if(_0x3bc70c[_0x46ef('0x48')]['id']){delete _0x3bc70c[_0x46ef('0x48')]['id'];}return db[_0x46ef('0x3e')]['find']({'where':{'id':_0x3bc70c['params']['id']}})[_0x46ef('0x23')](handleEntityNotFound(_0xc3ecfc,null))[_0x46ef('0x23')](saveUpdates(_0x3bc70c[_0x46ef('0x48')],null))[_0x46ef('0x23')](respondWithResult(_0xc3ecfc,null))[_0x46ef('0x43')](handleError(_0xc3ecfc,null));};exports[_0x46ef('0x49')]=function(_0x3cab19,_0x46e37a){return db['VoiceRecording'][_0x46ef('0x49')]()[_0x46ef('0x23')](respondWithResult(_0x46e37a,null))[_0x46ef('0x43')](handleError(_0x46e37a,null));};exports[_0x46ef('0x4a')]=function(_0x253b7a,_0x37513d,_0x511cb7){var _0x32739c=require('../../components/encryptor');var _0x50948e=![];var _0x3bfd30={};if(_0x253b7a['query'][_0x46ef('0x29')]&&_0x253b7a[_0x46ef('0x2d')][_0x46ef('0x29')]===_0x46ef('0x4b')){_0x3bfd30[_0x46ef('0x4b')]=_0x253b7a[_0x46ef('0x45')]['id'];}else{_0x3bfd30['id']=_0x253b7a[_0x46ef('0x45')]['id'];}return db['VoiceRecording'][_0x46ef('0x4c')]({'where':_0x3bfd30,'attributes':['id',_0x46ef('0x4d')],'raw':!![]})[_0x46ef('0x23')](handleEntityNotFound(_0x37513d,null))['then'](function(_0x347e63){if(_0x347e63){var _0x4b468b=_0x347e63[_0x46ef('0x4d')];var _0x220337=util['format'](_0x46ef('0x4e'),_0x4b468b);if(fs[_0x46ef('0x4f')](_0x220337)){_0x50948e=!![];return _0x32739c['decryptFile'](_0x220337,_0x4b468b,config['secrets'][_0x46ef('0x50')])[_0x46ef('0x23')](function(){return _0x347e63;});}return _0x347e63;}})[_0x46ef('0x23')](function(_0x46ae67){if(_0x46ae67){var _0x56d186=_0x46ae67[_0x46ef('0x4d')];if(!fs['existsSync'](_0x56d186)){throw new db['Sequelize'][(_0x46ef('0x51'))](_0x46ef('0x52'));}if(_0x46ae67[_0x46ef('0x53')]){return _0x37513d[_0x46ef('0x4a')](_0x56d186,_0x46ae67[_0x46ef('0x53')]+path['extname'](_0x56d186),function(){if(_0x50948e){fs['unlink'](_0x56d186);}});}else{return _0x37513d[_0x46ef('0x4a')](_0x56d186,function(_0x448ad0){if(_0x50948e){fs[_0x46ef('0x54')](_0x56d186);}});}}})[_0x46ef('0x43')](function(_0x2ce6e2){if(_0x2ce6e2[_0x46ef('0x55')]==='VoiceRecording\x20not\x20found'){_0x37513d[_0x46ef('0x19')](0x194)['send'](_0x46ef('0x56'));}else{return handleError(_0x37513d,null);}});};exports[_0x46ef('0x57')]=function(_0x8126b0,_0x249bde,_0x4c540a){var _0x24e219=require(_0x46ef('0x58'));var _0x452268=![];var _0x4a139a={'$and':[db[_0x46ef('0x59')][_0x46ef('0x3a')](db['sequelize']['fn'](_0x46ef('0x5a'),db['sequelize']['col'](_0x46ef('0x4b'))),_0x8126b0['query']['token'])]};if(_0x8126b0[_0x46ef('0x2d')][_0x46ef('0x29')]&&_0x8126b0[_0x46ef('0x2d')][_0x46ef('0x29')]==='uniqueid'){_0x4a139a['$and']['push']({'uniqueid':_0x8126b0[_0x46ef('0x45')]['id']});}else{_0x4a139a[_0x46ef('0x5b')][_0x46ef('0x5c')]({'id':_0x8126b0[_0x46ef('0x45')]['id']});}return db['VoiceRecording']['find']({'where':_0x4a139a,'attributes':['id',_0x46ef('0x4d')],'raw':!![]})[_0x46ef('0x23')](handleEntityNotFound(_0x249bde,null))[_0x46ef('0x23')](function(_0x42d511){if(_0x42d511){var _0x31dfdf=util[_0x46ef('0x5d')](_0x46ef('0x4e'),_0x42d511[_0x46ef('0x4d')]);if(fs[_0x46ef('0x4f')](_0x31dfdf)){_0x452268=!![];return _0x24e219['decryptFile'](_0x31dfdf,_0x42d511[_0x46ef('0x4d')],config[_0x46ef('0x5e')][_0x46ef('0x50')])[_0x46ef('0x23')](function(){return _0x42d511;});}return _0x42d511;}})['then'](function(_0x47bfd3){if(_0x47bfd3){if(!fs[_0x46ef('0x4f')](_0x47bfd3['value'])){throw new db['Sequelize'][(_0x46ef('0x51'))](_0x46ef('0x52'));}if(_0x47bfd3[_0x46ef('0x53')]){return _0x249bde[_0x46ef('0x4a')](_0x47bfd3['value'],_0x47bfd3[_0x46ef('0x53')]+path[_0x46ef('0x5f')](_0x47bfd3[_0x46ef('0x4d')]),function(){if(_0x452268){fs[_0x46ef('0x54')](_0x47bfd3[_0x46ef('0x4d')]);}});}else{return _0x249bde[_0x46ef('0x4a')](_0x47bfd3['value'],function(_0xd56f0d){if(_0x452268){fs[_0x46ef('0x54')](_0x47bfd3[_0x46ef('0x4d')]);}});}}})[_0x46ef('0x43')](handleError(_0x249bde,null));};exports[_0x46ef('0x60')]=function(_0x3697d0,_0x31a311){return db[_0x46ef('0x3e')][_0x46ef('0x4c')]({'where':{'id':_0x3697d0[_0x46ef('0x45')]['id']}})[_0x46ef('0x23')](function(_0x478428){if(_['isNil'](_0x478428)){throw new ReferenceError('Entity\x20not\x20found');}return _0x478428;})['then'](function(_0x12b66b){var _0x269315=_0x12b66b[_0x46ef('0x4d')];logger['info'](_0x46ef('0x61'),_0x269315);if(!_[_0x46ef('0x62')](_0x12b66b[_0x46ef('0x4d')])&&fs['existsSync'](_0x269315)){logger[_0x46ef('0x63')](_0x46ef('0x64')+_0x269315+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x269315);}_0x269315=_0x269315+_0x46ef('0x65');if(!_[_0x46ef('0x62')](_0x12b66b[_0x46ef('0x4d')])&&fs['existsSync'](_0x269315)){logger['info'](_0x46ef('0x64')+_0x269315+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x269315);}return _0x12b66b;})['then'](function(_0x5d0920){if(!_0x5d0920)throw new InternalError();return _0x5d0920[_0x46ef('0x60')]();})[_0x46ef('0x23')](function(){_0x31a311['status'](0xcc)[_0x46ef('0x1a')]();})[_0x46ef('0x43')](handleError(_0x31a311,null));};function getBucketslist(_0x1ef809,_0x2237cd,_0x30c27f){return new Promise(function(_0x57b512,_0x519c0d){var _0x4f0884=new AWS['S3']({'accessKeyId':_0x2237cd,'secretAccessKey':_0x1ef809,'region':_0x30c27f});_0x4f0884['listBuckets']({},function(_0x8637af,_0x2ea8f5){if(_0x8637af){return _0x519c0d(_0x8637af);}else{return _0x57b512(_0x2ea8f5);}});});}function createBucket(_0x2ef527,_0x2cc835,_0x13e8ea,_0x2825eb){return new Promise(function(_0x26cf94,_0x1aa79c){var _0x2bfa5e=new AWS['S3']({'accessKeyId':_0x2cc835,'secretAccessKey':_0x2ef527,'region':_0x13e8ea});_0x2bfa5e['createBucket']({'Bucket':_0x2825eb},function(_0x42ebd3,_0x9cd91e){if(_0x42ebd3){return _0x1aa79c(_0x42ebd3);}else{return _0x26cf94(_0x9cd91e);}});});}function uploadFile(_0x3d9b7d,_0x2fa663,_0x42c945,_0x440a40,_0x4954b2,_0xec8238){return new Promise(function(_0x46805d,_0x21f1f0){var _0xa21bf6=new AWS['S3']({'accessKeyId':_0x2fa663,'secretAccessKey':_0x3d9b7d,'region':_0x42c945});_0xa21bf6[_0x46ef('0x66')]({'Bucket':_0x440a40,'Key':_0x4954b2,'Body':_0xec8238},function(_0x4cd27b,_0x6d6a27){if(_0x4cd27b){return _0x21f1f0(_0x4cd27b);}else{return _0x46805d(_0x6d6a27);}});});}function startTranscribe(_0x11113f,_0x128369,_0x594dcf,_0x4297b8,_0x520412,_0x256a12){return new Promise(function(_0x5bfd57,_0x357941){var _0x9ef864=new AWS[(_0x46ef('0x67'))]({'accessKeyId':_0x128369,'secretAccessKey':_0x11113f,'region':_0x594dcf});_0x9ef864['startTranscriptionJob']({'TranscriptionJobName':_0x4297b8,'LanguageCode':_0x520412,'Media':{'MediaFileUri':_0x256a12}},function(_0x290243,_0x4830cd){if(_0x290243){return _0x357941(_0x290243);}else{return _0x5bfd57(_0x4830cd);}});});}function transcribe(_0x357e82,_0x445a43,_0x88769e,_0x3f795f,_0x466057,_0x5ab473,_0x5777a1){return new Promise(function(_0x25f05e,_0x49a9ab){var _0x59561f={};logger[_0x46ef('0x63')](util[_0x46ef('0x5d')](_0x46ef('0x68'),_0x357e82,_0x466057));return uploadFile(_0x445a43,_0x88769e,_0x3f795f,_0x466057,path[_0x46ef('0x69')](_0x5ab473),fs[_0x46ef('0x6a')](_0x5ab473))['then'](function(_0x45b6a7){logger[_0x46ef('0x63')](util['format'](_0x46ef('0x6b'),_0x357e82,_0x466057,_0x45b6a7['Location']));_0x59561f[_0x46ef('0x6c')]=_0x45b6a7[_0x46ef('0x6d')];_0x59561f[_0x46ef('0x6e')]=_0x45b6a7[_0x46ef('0x6f')];logger[_0x46ef('0x63')](util['format'](_0x46ef('0x70'),_0x357e82));return startTranscribe(_0x445a43,_0x88769e,_0x3f795f,uuidv4(),_0x5777a1,_0x45b6a7[_0x46ef('0x6f')]);})[_0x46ef('0x23')](function(_0x28711a){logger[_0x46ef('0x63')](util[_0x46ef('0x5d')]('[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created',_0x357e82,_0x28711a['TranscriptionJob'][_0x46ef('0x71')]));_0x59561f['transcribeName']=_0x28711a['TranscriptionJob'][_0x46ef('0x71')];_0x59561f[_0x46ef('0x72')]=_0x28711a[_0x46ef('0x73')][_0x46ef('0x74')];return _0x25f05e(_0x59561f);})[_0x46ef('0x43')](function(_0x190ad3){return _0x49a9ab(_0x190ad3);});});}exports[_0x46ef('0x75')]=function(_0xdcc3e7,_0x5c3b67,_0x5cc39b){var _0xc89417;var _0x29f278;var _0x2d3f6e;var _0x59b022=require(_0x46ef('0x58'));return db[_0x46ef('0x3e')][_0x46ef('0x76')]({'where':{'id':_0xdcc3e7['params']['id']}})[_0x46ef('0x23')](function(_0x5d0f4e){if(_0x5d0f4e){var _0x219c34=util[_0x46ef('0x5d')](_0x46ef('0x4e'),_0x5d0f4e['value']);if(fs[_0x46ef('0x4f')](_0x219c34)){cypher=!![];return _0x59b022['decryptFile'](_0x219c34,_0x5d0f4e[_0x46ef('0x4d')],config[_0x46ef('0x5e')]['recording'])['then'](function(){return _0x5d0f4e;});}return _0x5d0f4e;}})[_0x46ef('0x23')](function(_0x4b74bd){if(!_0x4b74bd){throw new db[(_0x46ef('0x77'))]['ValidationError'](_0x46ef('0x78'));}_0x29f278=_0x4b74bd;return db[_0x46ef('0x79')][_0x46ef('0x76')]({'where':{'id':0x1}});})[_0x46ef('0x23')](handleEntityNotFound(_0x5c3b67,null))[_0x46ef('0x23')](function(_0x24280b){if(_0x24280b){_0xc89417=_0x24280b;if(!_0xc89417[_0x46ef('0x7a')]||!_0xc89417[_0x46ef('0x7b')]||!_0xc89417['transcribeRegion']||!_0xc89417[_0x46ef('0x7c')]||!_0xc89417[_0x46ef('0x6c')]){throw new db['Sequelize'][(_0x46ef('0x51'))](_0x46ef('0x7d'));}if(_0xdcc3e7['body'][_0x46ef('0x7e')]&&(!_0xc89417[_0x46ef('0x7f')]||!_0xc89417[_0x46ef('0x80')]||!_0xc89417[_0x46ef('0x81')]||!_0xc89417[_0x46ef('0x7c')]||!_0xc89417[_0x46ef('0x6c')])){throw new db['Sequelize'][(_0x46ef('0x51'))](_0x46ef('0x82'));}return db[_0x46ef('0x83')]['findOne']({'where':{'id':_0xc89417[_0x46ef('0x7b')]}});}})[_0x46ef('0x23')](function(_0x4bc717){if(!_0x4bc717){throw new db[(_0x46ef('0x77'))][(_0x46ef('0x51'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x4bc717[_0x46ef('0x84')]||!_0x4bc717[_0x46ef('0x85')]){throw new db[(_0x46ef('0x77'))][(_0x46ef('0x51'))](_0x46ef('0x86'));}_0x2d3f6e=_0x4bc717;return getBucketslist(_0x2d3f6e[_0x46ef('0x84')],_0x2d3f6e['data2'],_0xc89417['transcribeRegion']);})[_0x46ef('0x23')](function(_0x4264b9){if(_0x4264b9&&_0x4264b9[_0x46ef('0x87')]){var _0xd20d68=_[_0x46ef('0x4c')](_0x4264b9[_0x46ef('0x87')],function(_0xb15f31){return _0xb15f31[_0x46ef('0x88')]===_0xc89417[_0x46ef('0x6c')];});if(!_0xd20d68){logger[_0x46ef('0x63')](util[_0x46ef('0x5d')](_0x46ef('0x89'),_0xdcc3e7[_0x46ef('0x45')]['id'],_0xc89417[_0x46ef('0x6c')]));return createBucket(_0x2d3f6e[_0x46ef('0x84')],_0x2d3f6e[_0x46ef('0x85')],_0xc89417[_0x46ef('0x8a')],_0xc89417[_0x46ef('0x6c')]);}logger[_0x46ef('0x63')](util[_0x46ef('0x5d')](_0x46ef('0x8b'),_0xdcc3e7[_0x46ef('0x45')]['id'],_0xc89417[_0x46ef('0x6c')]));return;}})['then'](function(_0x534ee7){if(_0x29f278['transcribeStatus']==='NEW'){return transcribe(_0xdcc3e7[_0x46ef('0x45')]['id'],_0x2d3f6e[_0x46ef('0x84')],_0x2d3f6e[_0x46ef('0x85')],_0xc89417[_0x46ef('0x8a')],_0xc89417['bucket'],_0x29f278['value'],_0xc89417[_0x46ef('0x7c')]);}else{logger[_0x46ef('0x63')](util[_0x46ef('0x5d')](_0x46ef('0x8c'),_0xdcc3e7[_0x46ef('0x45')]['id']));return{'transcribeStatus':_0x46ef('0x8d')};}})[_0x46ef('0x23')](function(_0x429865){if(_0x429865){_0x429865[_0x46ef('0x8e')]=_0xdcc3e7['body'][_0x46ef('0x7e')];return _0x29f278['updateAttributes'](_0x429865);}})[_0x46ef('0x23')](respondWithResult(_0x5c3b67,null))['catch'](handleError(_0x5c3b67,null));};function writeFile(_0x4db0e9,_0x4c96e7){return new Promise(function(_0x340033,_0x14a3d1){fs[_0x46ef('0x8f')](_0x4c96e7,_0x4db0e9,function(_0x43e247,_0x4c584a){if(_0x43e247){return _0x14a3d1(_0x43e247);}else{return _0x340033(_0x4c584a);}});});}exports[_0x46ef('0x90')]=function(_0x297b99,_0x48acea,_0x38852e){return db[_0x46ef('0x3e')][_0x46ef('0x76')]({'where':{'id':_0x297b99[_0x46ef('0x45')]['id']}})[_0x46ef('0x23')](handleEntityNotFound(_0x48acea))[_0x46ef('0x23')](function(_0x257dbd){if(_0x257dbd&&_0x257dbd['fileText']){var _0x22d2a2=_0x257dbd[_0x46ef('0x91')];var _0x5d64a3=config[_0x46ef('0x92')]+_0x46ef('0x93')+_0x257dbd['id']+_0x46ef('0x94');if(fs[_0x46ef('0x4f')](_0x5d64a3)){return _0x5d64a3;}return writeFile(_0x22d2a2,_0x5d64a3)[_0x46ef('0x23')](function(){return _0x5d64a3;});}else{throw new db[(_0x46ef('0x77'))]['ValidationError']('Transcript\x20not\x20available');}})[_0x46ef('0x23')](function(_0x115e17){return _0x48acea[_0x46ef('0x4a')](_0x115e17);})[_0x46ef('0x43')](handleError(_0x48acea));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index 70b6b44..f4a6632 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 _0x8a1b=['define','uniqueid','transcribeStatus','./voiceRecording.attributes','exports'];(function(_0x27c2e4,_0x4daf61){var _0x13f2fa=function(_0x53bf2c){while(--_0x53bf2c){_0x27c2e4['push'](_0x27c2e4['shift']());}};_0x13f2fa(++_0x4daf61);}(_0x8a1b,0xf8));var _0xb8a1=function(_0x3577cd,_0x441ae4){_0x3577cd=_0x3577cd-0x0;var _0x3c1ea4=_0x8a1b[_0x3577cd];return _0x3c1ea4;};'use strict';var attributes=require(_0xb8a1('0x0'));module[_0xb8a1('0x1')]=function(_0x50a877,_0x19be3a){return _0x50a877[_0xb8a1('0x2')]('VoiceRecording',attributes,{'tableName':'voice_recordings','paranoid':![],'indexes':[{'name':_0xb8a1('0x3'),'fields':[_0xb8a1('0x3')]},{'name':_0xb8a1('0x4'),'fields':[_0xb8a1('0x4')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5ebe=['exports','define','VoiceRecording','voice_recordings','transcribeStatus'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x5ebe,0x69));var _0xe5eb=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x5ebe[_0x122ef9];return _0x42fba0;};'use strict';var attributes=require('./voiceRecording.attributes');module[_0xe5eb('0x0')]=function(_0x3d71a9,_0x12cbfd){return _0x3d71a9[_0xe5eb('0x1')](_0xe5eb('0x2'),attributes,{'tableName':_0xe5eb('0x3'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']},{'name':_0xe5eb('0x4'),'fields':[_0xe5eb('0x4')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index a46c555..70ad6c7 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 _0x66fa=['CreateVoiceRecording','../../components/encryptor','Setting','findOne','callRecordingEncryption','create','existsSync','value','format','%s.cypher','encryptFile','secrets','recording','CreateVoiceRecording\x20file\x20encrypted','debug','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','then','info','VoiceRecording,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','VoiceRecording,\x20%s,\x20%s','message','catch','VoiceRecording','update','body','options','raw','where','attributes','UpdateVoiceRecording','stringify'];(function(_0x5ba749,_0x3a3d49){var _0x1d4d80=function(_0x4e695d){while(--_0x4e695d){_0x5ba749['push'](_0x5ba749['shift']());}};_0x1d4d80(++_0x3a3d49);}(_0x66fa,0x117));var _0xa66f=function(_0x4b77f4,_0x201ba6){_0x4b77f4=_0x4b77f4-0x0;var _0x48cd53=_0x66fa[_0x4b77f4];return _0x48cd53;};'use strict';var _=require(_0xa66f('0x0'));var util=require(_0xa66f('0x1'));var moment=require('moment');var BPromise=require(_0xa66f('0x2'));var rs=require(_0xa66f('0x3'));var fs=require('fs');var Redis=require(_0xa66f('0x4'));var db=require(_0xa66f('0x5'))['db'];var utils=require(_0xa66f('0x6'));var logger=require(_0xa66f('0x7'))(_0xa66f('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa66f('0x9')][_0xa66f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2f0b78,_0x1d02fc,_0x38b58b){return new BPromise(function(_0x5096bf,_0x39c1ef){return client['request'](_0x2f0b78,_0x38b58b)[_0xa66f('0xb')](function(_0x597c7c){logger[_0xa66f('0xc')]('VoiceRecording,\x20%s,\x20%s',_0x1d02fc,'request\x20sent');logger['debug'](_0xa66f('0xd'),_0x1d02fc,_0xa66f('0xe'),JSON['stringify'](_0x597c7c));if(_0x597c7c[_0xa66f('0xf')]){if(_0x597c7c['error'][_0xa66f('0x10')]===0x1f4){logger['error'](_0xa66f('0x11'),_0x1d02fc,_0x597c7c[_0xa66f('0xf')][_0xa66f('0x12')]);return _0x39c1ef(_0x597c7c['error']['message']);}logger[_0xa66f('0xf')]('VoiceRecording,\x20%s,\x20%s',_0x1d02fc,_0x597c7c['error']['message']);return _0x5096bf(_0x597c7c[_0xa66f('0xf')][_0xa66f('0x12')]);}else{logger[_0xa66f('0xc')](_0xa66f('0x11'),_0x1d02fc,_0xa66f('0xe'));_0x5096bf(_0x597c7c['result']['message']);}})[_0xa66f('0x13')](function(_0x32d338){logger[_0xa66f('0xf')](_0xa66f('0x11'),_0x1d02fc,_0x32d338);_0x39c1ef(_0x32d338);});});}exports['UpdateVoiceRecording']=function(_0x1cbe64){var _0x55b59d=this;return new Promise(function(_0x4a28d4,_0x2f9da2){return db[_0xa66f('0x14')][_0xa66f('0x15')](_0x1cbe64[_0xa66f('0x16')],{'raw':_0x1cbe64[_0xa66f('0x17')]?_0x1cbe64[_0xa66f('0x17')][_0xa66f('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1cbe64[_0xa66f('0x17')]?_0x1cbe64[_0xa66f('0x17')][_0xa66f('0x19')]||null:null,'attributes':_0x1cbe64[_0xa66f('0x17')]?_0x1cbe64[_0xa66f('0x17')][_0xa66f('0x1a')]||null:null,'limit':_0x1cbe64[_0xa66f('0x17')]?_0x1cbe64[_0xa66f('0x17')]['limit']||null:null})[_0xa66f('0xb')](function(_0xc5c82e){logger[_0xa66f('0xc')](_0xa66f('0x1b'),_0x1cbe64);logger['debug'](_0xa66f('0x1b'),_0x1cbe64,JSON[_0xa66f('0x1c')](_0xc5c82e));_0x4a28d4(_0xc5c82e);})[_0xa66f('0x13')](function(_0x16f1fa){logger['error']('UpdateVoiceRecording',_0x16f1fa[_0xa66f('0x12')],_0x1cbe64);_0x2f9da2(_0x55b59d['error'](0x1f4,_0x16f1fa[_0xa66f('0x12')]));});});};exports[_0xa66f('0x1d')]=function(_0x384164){var _0x57da7f=this;return new Promise(function(_0x4683c7,_0x1c2903){var _0x13495f=require(_0xa66f('0x1e'));var _0x17c103;return db[_0xa66f('0x1f')][_0xa66f('0x20')]({'attributes':['id',_0xa66f('0x21')],'where':{'id':0x1},'raw':!![]})[_0xa66f('0xb')](function(_0x117d03){_0x17c103=_0x117d03;return db[_0xa66f('0x14')][_0xa66f('0x22')](_0x384164[_0xa66f('0x16')]);})[_0xa66f('0xb')](function(_0x49f615){if(_0x17c103['callRecordingEncryption']&&fs[_0xa66f('0x23')](_0x49f615[_0xa66f('0x24')])){var _0x55f309=util[_0xa66f('0x25')](_0xa66f('0x26'),_0x49f615['value']);return _0x13495f[_0xa66f('0x27')](_0x49f615[_0xa66f('0x24')],_0x55f309,config[_0xa66f('0x28')][_0xa66f('0x29')])[_0xa66f('0xb')](function(){fs['unlink'](_0x49f615[_0xa66f('0x24')]);logger['info'](_0xa66f('0x2a'));return _0x49f615;});}return _0x49f615;})[_0xa66f('0xb')](function(_0x2e4dc8){logger['info'](_0xa66f('0x1d'),_0x384164);logger[_0xa66f('0x2b')]('CreateVoiceRecording',_0x384164,JSON[_0xa66f('0x1c')](_0x2e4dc8));_0x4683c7(_0x2e4dc8);})[_0xa66f('0x13')](function(_0xba9457){logger[_0xa66f('0xf')](_0xa66f('0x1d'),_0xba9457[_0xa66f('0x12')],_0x384164);_0x1c2903(_0x57da7f[_0xa66f('0xf')](0x1f4,_0xba9457[_0xa66f('0x12')]));});});}; \ No newline at end of file +var _0xef0f=['CreateVoiceRecording','Setting','findOne','callRecordingEncryption','create','body','value','%s.cypher','unlink','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','VoiceRecording,\x20%s,\x20%s','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateVoiceRecording','VoiceRecording','update','options','raw','attributes'];(function(_0x45e98e,_0x169b60){var _0x374dba=function(_0x597612){while(--_0x597612){_0x45e98e['push'](_0x45e98e['shift']());}};_0x374dba(++_0x169b60);}(_0xef0f,0x168));var _0xfef0=function(_0x3720a3,_0x18d1ec){_0x3720a3=_0x3720a3-0x0;var _0x393b36=_0xef0f[_0x3720a3];return _0x393b36;};'use strict';var _=require(_0xfef0('0x0'));var util=require('util');var moment=require(_0xfef0('0x1'));var BPromise=require(_0xfef0('0x2'));var rs=require(_0xfef0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfef0('0x4'))['db'];var utils=require(_0xfef0('0x5'));var logger=require(_0xfef0('0x6'))('rpc');var config=require(_0xfef0('0x7'));var jayson=require(_0xfef0('0x8'));var client=jayson[_0xfef0('0x9')][_0xfef0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xad43e,_0x11dfd7,_0x5130bd){return new BPromise(function(_0x41ec94,_0x58cf6d){return client[_0xfef0('0xb')](_0xad43e,_0x5130bd)[_0xfef0('0xc')](function(_0x3a81cc){logger[_0xfef0('0xd')](_0xfef0('0xe'),_0x11dfd7,_0xfef0('0xf'));logger[_0xfef0('0x10')](_0xfef0('0x11'),_0x11dfd7,_0xfef0('0xf'),JSON[_0xfef0('0x12')](_0x3a81cc));if(_0x3a81cc[_0xfef0('0x13')]){if(_0x3a81cc[_0xfef0('0x13')][_0xfef0('0x14')]===0x1f4){logger[_0xfef0('0x13')]('VoiceRecording,\x20%s,\x20%s',_0x11dfd7,_0x3a81cc[_0xfef0('0x13')][_0xfef0('0x15')]);return _0x58cf6d(_0x3a81cc[_0xfef0('0x13')][_0xfef0('0x15')]);}logger[_0xfef0('0x13')](_0xfef0('0xe'),_0x11dfd7,_0x3a81cc[_0xfef0('0x13')]['message']);return _0x41ec94(_0x3a81cc[_0xfef0('0x13')]['message']);}else{logger['info']('VoiceRecording,\x20%s,\x20%s',_0x11dfd7,_0xfef0('0xf'));_0x41ec94(_0x3a81cc[_0xfef0('0x16')][_0xfef0('0x15')]);}})[_0xfef0('0x17')](function(_0x2a96d9){logger[_0xfef0('0x13')](_0xfef0('0xe'),_0x11dfd7,_0x2a96d9);_0x58cf6d(_0x2a96d9);});});}exports[_0xfef0('0x18')]=function(_0x581459){var _0xd60678=this;return new Promise(function(_0x1642cd,_0x1577fa){return db[_0xfef0('0x19')][_0xfef0('0x1a')](_0x581459['body'],{'raw':_0x581459[_0xfef0('0x1b')]?_0x581459['options'][_0xfef0('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x581459[_0xfef0('0x1b')]?_0x581459[_0xfef0('0x1b')]['where']||null:null,'attributes':_0x581459[_0xfef0('0x1b')]?_0x581459['options'][_0xfef0('0x1d')]||null:null,'limit':_0x581459[_0xfef0('0x1b')]?_0x581459['options']['limit']||null:null})['then'](function(_0x19fde8){logger['info'](_0xfef0('0x18'),_0x581459);logger[_0xfef0('0x10')](_0xfef0('0x18'),_0x581459,JSON[_0xfef0('0x12')](_0x19fde8));_0x1642cd(_0x19fde8);})[_0xfef0('0x17')](function(_0xd687ed){logger['error']('UpdateVoiceRecording',_0xd687ed[_0xfef0('0x15')],_0x581459);_0x1577fa(_0xd60678[_0xfef0('0x13')](0x1f4,_0xd687ed[_0xfef0('0x15')]));});});};exports[_0xfef0('0x1e')]=function(_0xab231c){var _0xf60f2=this;return new Promise(function(_0x5df04f,_0x168b98){var _0x391279=require('../../components/encryptor');var _0x1a6758;return db[_0xfef0('0x1f')][_0xfef0('0x20')]({'attributes':['id',_0xfef0('0x21')],'where':{'id':0x1},'raw':!![]})[_0xfef0('0xc')](function(_0x1ac4a3){_0x1a6758=_0x1ac4a3;return db[_0xfef0('0x19')][_0xfef0('0x22')](_0xab231c[_0xfef0('0x23')]);})[_0xfef0('0xc')](function(_0x3ee42f){if(_0x1a6758[_0xfef0('0x21')]&&fs['existsSync'](_0x3ee42f[_0xfef0('0x24')])){var _0x5806bd=util['format'](_0xfef0('0x25'),_0x3ee42f[_0xfef0('0x24')]);return _0x391279['encryptFile'](_0x3ee42f['value'],_0x5806bd,config['secrets']['recording'])['then'](function(){fs[_0xfef0('0x26')](_0x3ee42f[_0xfef0('0x24')]);logger[_0xfef0('0xd')]('CreateVoiceRecording\x20file\x20encrypted');return _0x3ee42f;});}return _0x3ee42f;})['then'](function(_0x50430e){logger[_0xfef0('0xd')]('CreateVoiceRecording',_0xab231c);logger[_0xfef0('0x10')](_0xfef0('0x1e'),_0xab231c,JSON[_0xfef0('0x12')](_0x50430e));_0x5df04f(_0x50430e);})['catch'](function(_0x3cad13){logger['error'](_0xfef0('0x1e'),_0x3cad13[_0xfef0('0x15')],_0xab231c);_0x168b98(_0xf60f2[_0xfef0('0x13')](0x1f4,_0x3cad13[_0xfef0('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index c34cd63..3ac74b0 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 _0xef1d=['util','fs-extra','../../components/auth/service','../../config/environment','./voiceTransferReport.controller','get','isAuthenticated','describe','/:id','show','post','create','put','destroy','multer'];(function(_0x5df615,_0x51e516){var _0x5d1712=function(_0x3f99ac){while(--_0x3f99ac){_0x5df615['push'](_0x5df615['shift']());}};_0x5d1712(++_0x51e516);}(_0xef1d,0xc2));var _0xdef1=function(_0x3323fc,_0x38a3ef){_0x3323fc=_0x3323fc-0x0;var _0xc1a7b7=_0xef1d[_0x3323fc];return _0xc1a7b7;};'use strict';var multer=require(_0xdef1('0x0'));var util=require(_0xdef1('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xdef1('0x2'));var auth=require(_0xdef1('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xdef1('0x4'));var controller=require(_0xdef1('0x5'));router[_0xdef1('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0xdef1('0x6')]('/describe',auth[_0xdef1('0x7')](),controller[_0xdef1('0x8')]);router[_0xdef1('0x6')](_0xdef1('0x9'),auth['isAuthenticated'](),controller[_0xdef1('0xa')]);router[_0xdef1('0xb')]('/',auth[_0xdef1('0x7')](),controller[_0xdef1('0xc')]);router[_0xdef1('0xd')](_0xdef1('0x9'),auth[_0xdef1('0x7')](),controller['update']);router['delete'](_0xdef1('0x9'),auth['isAuthenticated'](),controller[_0xdef1('0xe')]);module['exports']=router; \ No newline at end of file +var _0xc0c2=['../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','get','isAuthenticated','/describe','describe','show','post','create','put','/:id','delete','exports','util','path','connect-timeout','express','../../components/auth/service'];(function(_0x116c2d,_0x5ad54d){var _0x19a4c6=function(_0x4c1eb8){while(--_0x4c1eb8){_0x116c2d['push'](_0x116c2d['shift']());}};_0x19a4c6(++_0x5ad54d);}(_0xc0c2,0x93));var _0x2c0c=function(_0xdf56aa,_0x4d9c15){_0xdf56aa=_0xdf56aa-0x0;var _0x82768=_0xc0c2[_0xdf56aa];return _0x82768;};'use strict';var multer=require('multer');var util=require(_0x2c0c('0x0'));var path=require(_0x2c0c('0x1'));var timeout=require(_0x2c0c('0x2'));var express=require(_0x2c0c('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x2c0c('0x4'));var interaction=require(_0x2c0c('0x5'));var config=require(_0x2c0c('0x6'));var controller=require(_0x2c0c('0x7'));router[_0x2c0c('0x8')]('/',auth[_0x2c0c('0x9')](),controller['index']);router[_0x2c0c('0x8')](_0x2c0c('0xa'),auth['isAuthenticated'](),controller[_0x2c0c('0xb')]);router[_0x2c0c('0x8')]('/:id',auth[_0x2c0c('0x9')](),controller[_0x2c0c('0xc')]);router[_0x2c0c('0xd')]('/',auth['isAuthenticated'](),controller[_0x2c0c('0xe')]);router[_0x2c0c('0xf')](_0x2c0c('0x10'),auth[_0x2c0c('0x9')](),controller['update']);router[_0x2c0c('0x11')](_0x2c0c('0x10'),auth[_0x2c0c('0x9')](),controller['destroy']);module[_0x2c0c('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index 0bf6c05..d3105ee 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 _0x1b66=['ENUM','Yes','blind','STRING'];(function(_0x3da035,_0x2cc569){var _0x47dfe5=function(_0x597024){while(--_0x597024){_0x3da035['push'](_0x3da035['shift']());}};_0x47dfe5(++_0x2cc569);}(_0x1b66,0xba));var _0x61b6=function(_0x1c2082,_0xacdcac){_0x1c2082=_0x1c2082-0x0;var _0x3d875d=_0x1b66[_0x1c2082];return _0x3d875d;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module['exports']={'type':{'type':Sequelize['ENUM'](_0x61b6('0x0'),'attended')},'result':{'type':Sequelize[_0x61b6('0x1')]},'transfererchannel':{'type':Sequelize['STRING']},'transferercalleridnum':{'type':Sequelize[_0x61b6('0x1')]},'transferercalleridname':{'type':Sequelize[_0x61b6('0x1')]},'transfererconnectedlinenum':{'type':Sequelize[_0x61b6('0x1')]},'transfererconnectedlinename':{'type':Sequelize[_0x61b6('0x1')]},'transfereraccountcode':{'type':Sequelize['STRING']},'transferercontext':{'type':Sequelize[_0x61b6('0x1')]},'transfererexten':{'type':Sequelize['STRING']},'transfererlinkedid':{'type':Sequelize['STRING']},'transfereechannel':{'type':Sequelize['STRING']},'transfereecalleridnum':{'type':Sequelize[_0x61b6('0x1')]},'transfereecalleridname':{'type':Sequelize[_0x61b6('0x1')]},'transfereeconnectedlinenum':{'type':Sequelize['STRING']},'transfereeconnectedlinename':{'type':Sequelize[_0x61b6('0x1')]},'transfereeaccountcode':{'type':Sequelize[_0x61b6('0x1')]},'transfereecontext':{'type':Sequelize[_0x61b6('0x1')]},'transfereeexten':{'type':Sequelize[_0x61b6('0x1')]},'transfereelinkedid':{'type':Sequelize[_0x61b6('0x1')]},'isexternal':{'type':Sequelize[_0x61b6('0x2')](_0x61b6('0x3'),'No')},'context':{'type':Sequelize[_0x61b6('0x1')]},'extension':{'type':Sequelize[_0x61b6('0x1')]}}; \ No newline at end of file +var _0xc393=['moment','exports','ENUM','blind','attended','STRING','Yes','sequelize'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xc393,0x177));var _0x3c39=function(_0x109f59,_0x26443b){_0x109f59=_0x109f59-0x0;var _0xf84297=_0xc393[_0x109f59];return _0xf84297;};'use strict';var Sequelize=require(_0x3c39('0x0'));var moment=require(_0x3c39('0x1'));module[_0x3c39('0x2')]={'type':{'type':Sequelize[_0x3c39('0x3')](_0x3c39('0x4'),_0x3c39('0x5'))},'result':{'type':Sequelize[_0x3c39('0x6')]},'transfererchannel':{'type':Sequelize[_0x3c39('0x6')]},'transferercalleridnum':{'type':Sequelize[_0x3c39('0x6')]},'transferercalleridname':{'type':Sequelize[_0x3c39('0x6')]},'transfererconnectedlinenum':{'type':Sequelize['STRING']},'transfererconnectedlinename':{'type':Sequelize[_0x3c39('0x6')]},'transfereraccountcode':{'type':Sequelize[_0x3c39('0x6')]},'transferercontext':{'type':Sequelize[_0x3c39('0x6')]},'transfererexten':{'type':Sequelize[_0x3c39('0x6')]},'transfererlinkedid':{'type':Sequelize[_0x3c39('0x6')]},'transfereechannel':{'type':Sequelize['STRING']},'transfereecalleridnum':{'type':Sequelize[_0x3c39('0x6')]},'transfereecalleridname':{'type':Sequelize[_0x3c39('0x6')]},'transfereeconnectedlinenum':{'type':Sequelize['STRING']},'transfereeconnectedlinename':{'type':Sequelize[_0x3c39('0x6')]},'transfereeaccountcode':{'type':Sequelize[_0x3c39('0x6')]},'transfereecontext':{'type':Sequelize[_0x3c39('0x6')]},'transfereeexten':{'type':Sequelize[_0x3c39('0x6')]},'transfereelinkedid':{'type':Sequelize[_0x3c39('0x6')]},'isexternal':{'type':Sequelize['ENUM'](_0x3c39('0x7'),'No')},'context':{'type':Sequelize[_0x3c39('0x6')]},'extension':{'type':Sequelize[_0x3c39('0x6')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index e60589a..c9a5348 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 _0xee0b=['ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','destroy','error','stack','name','index','map','VoiceTransferReport','rawAttributes','fieldName','key','model','keys','query','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','then','rows','catch','show','params','intersection','includeAll','include','body','find','describe','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse'];(function(_0x4a130a,_0x115a42){var _0x5758a8=function(_0x5750c7){while(--_0x5750c7){_0x4a130a['push'](_0x4a130a['shift']());}};_0x5758a8(++_0x115a42);}(_0xee0b,0x85));var _0xbee0=function(_0x54494c,_0x20f3fd){_0x54494c=_0x54494c-0x0;var _0xc9072c=_0xee0b[_0x54494c];return _0xc9072c;};'use strict';var emlformat=require(_0xbee0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbee0('0x1'));var jsonpatch=require(_0xbee0('0x2'));var rp=require(_0xbee0('0x3'));var moment=require('moment');var BPromise=require(_0xbee0('0x4'));var Mustache=require(_0xbee0('0x5'));var util=require(_0xbee0('0x6'));var path=require('path');var sox=require(_0xbee0('0x7'));var csv=require(_0xbee0('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbee0('0x9'));var squel=require(_0xbee0('0xa'));var crypto=require(_0xbee0('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xbee0('0xc'));var toCsv=require(_0xbee0('0x8'));var querystring=require(_0xbee0('0xd'));var Papa=require(_0xbee0('0xe'));var Redis=require(_0xbee0('0xf'));var authService=require(_0xbee0('0x10'));var qs=require(_0xbee0('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbee0('0x12'));var logger=require(_0xbee0('0x13'))(_0xbee0('0x14'));var utils=require('../../config/utils');var config=require(_0xbee0('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xbee0('0x16'))['db'];function respondWithStatusCode(_0x466c91,_0xa4f967){_0xa4f967=_0xa4f967||0xcc;return function(_0x1bc6e6){if(_0x1bc6e6){return _0x466c91[_0xbee0('0x17')](_0xa4f967);}return _0x466c91[_0xbee0('0x18')](_0xa4f967)[_0xbee0('0x19')]();};}function respondWithResult(_0x401275,_0x29038d){_0x29038d=_0x29038d||0xc8;return function(_0x21411f){if(_0x21411f){return _0x401275[_0xbee0('0x18')](_0x29038d)[_0xbee0('0x1a')](_0x21411f);}};}function respondWithFilteredResult(_0x1528f9,_0x38783b){return function(_0x5b80f1){if(_0x5b80f1){var _0x4027bc=typeof _0x38783b[_0xbee0('0x1b')]===_0xbee0('0x1c')&&typeof _0x38783b[_0xbee0('0x1d')]==='undefined';var _0x44325d=_0x5b80f1[_0xbee0('0x1e')];var _0x3bf885=_0x4027bc?0x0:_0x38783b[_0xbee0('0x1b')];var _0x49d8a0=_0x4027bc?_0x5b80f1[_0xbee0('0x1e')]:_0x38783b[_0xbee0('0x1b')]+_0x38783b[_0xbee0('0x1d')];var _0x1d19e3;if(_0x49d8a0>=_0x44325d){_0x49d8a0=_0x44325d;_0x1d19e3=0xc8;}else{_0x1d19e3=0xce;}_0x1528f9[_0xbee0('0x18')](_0x1d19e3);return _0x1528f9['set'](_0xbee0('0x1f'),_0x3bf885+'-'+_0x49d8a0+'/'+_0x44325d)[_0xbee0('0x1a')](_0x5b80f1);}return null;};}function patchUpdates(_0x10944b){return function(_0xdfc27a){try{jsonpatch[_0xbee0('0x20')](_0xdfc27a,_0x10944b,!![]);}catch(_0x36012b){return BPromise[_0xbee0('0x21')](_0x36012b);}return _0xdfc27a[_0xbee0('0x22')]();};}function saveUpdates(_0x3776fc,_0x500413){return function(_0x456437){if(_0x456437){return _0x456437[_0xbee0('0x23')](_0x3776fc)['then'](function(_0xe8eb3f){return _0xe8eb3f;});}return null;};}function removeEntity(_0x12420d,_0x5242b2){return function(_0x590547){if(_0x590547){return _0x590547[_0xbee0('0x24')]()['then'](function(){_0x12420d[_0xbee0('0x18')](0xcc)[_0xbee0('0x19')]();});}};}function handleEntityNotFound(_0x5aff1d,_0x203148){return function(_0x3a085d){if(!_0x3a085d){_0x5aff1d[_0xbee0('0x17')](0x194);}return _0x3a085d;};}function handleError(_0x41fc70,_0x145790){_0x145790=_0x145790||0x1f4;return function(_0x584f58){logger[_0xbee0('0x25')](_0x584f58[_0xbee0('0x26')]);if(_0x584f58['name']){delete _0x584f58[_0xbee0('0x27')];}_0x41fc70[_0xbee0('0x18')](_0x145790)['send'](_0x584f58);};}exports[_0xbee0('0x28')]=function(_0x39bed0,_0x41ca08){var _0x44f476={},_0x436a6f={},_0x1033fa={'count':0x0,'rows':[]};var _0x3dd886=_[_0xbee0('0x29')](db[_0xbee0('0x2a')][_0xbee0('0x2b')],function(_0x411938){return{'name':_0x411938[_0xbee0('0x2c')],'type':_0x411938['type'][_0xbee0('0x2d')]};});_0x436a6f[_0xbee0('0x2e')]=_[_0xbee0('0x29')](_0x3dd886,_0xbee0('0x27'));_0x436a6f['query']=_[_0xbee0('0x2f')](_0x39bed0[_0xbee0('0x30')]);_0x436a6f[_0xbee0('0x31')]=_['intersection'](_0x436a6f[_0xbee0('0x2e')],_0x436a6f[_0xbee0('0x30')]);_0x44f476[_0xbee0('0x32')]=_['intersection'](_0x436a6f['model'],qs['fields'](_0x39bed0[_0xbee0('0x30')][_0xbee0('0x33')]));_0x44f476['attributes']=_0x44f476['attributes'][_0xbee0('0x34')]?_0x44f476[_0xbee0('0x32')]:_0x436a6f['model'];if(!_0x39bed0[_0xbee0('0x30')][_0xbee0('0x35')](_0xbee0('0x36'))){_0x44f476[_0xbee0('0x1d')]=qs[_0xbee0('0x1d')](_0x39bed0['query'][_0xbee0('0x1d')]);_0x44f476[_0xbee0('0x1b')]=qs[_0xbee0('0x1b')](_0x39bed0[_0xbee0('0x30')][_0xbee0('0x1b')]);}_0x44f476[_0xbee0('0x37')]=qs[_0xbee0('0x38')](_0x39bed0['query'][_0xbee0('0x38')]);_0x44f476[_0xbee0('0x39')]=qs[_0xbee0('0x31')](_[_0xbee0('0x3a')](_0x39bed0[_0xbee0('0x30')],_0x436a6f[_0xbee0('0x31')]),_0x3dd886);if(_0x39bed0[_0xbee0('0x30')][_0xbee0('0x3b')]){_0x44f476[_0xbee0('0x39')]=_['merge'](_0x44f476[_0xbee0('0x39')],{'$or':_[_0xbee0('0x29')](_0x3dd886,function(_0x453208){if(_0x453208['type']!==_0xbee0('0x3c')){var _0x800ae7={};_0x800ae7[_0x453208[_0xbee0('0x27')]]={'$like':'%'+_0x39bed0['query'][_0xbee0('0x3b')]+'%'};return _0x800ae7;}})});}_0x44f476=_[_0xbee0('0x3d')]({},_0x44f476,_0x39bed0[_0xbee0('0x3e')]);var _0x57eca8={'where':_0x44f476[_0xbee0('0x39')]};return db[_0xbee0('0x2a')]['count'](_0x57eca8)[_0xbee0('0x3f')](function(_0x3dbbf0){_0x1033fa['count']=_0x3dbbf0;if(_0x39bed0[_0xbee0('0x30')]['includeAll']){_0x44f476['include']=[{'all':!![]}];}return db[_0xbee0('0x2a')]['findAll'](_0x44f476);})['then'](function(_0x4d06dd){_0x1033fa[_0xbee0('0x40')]=_0x4d06dd;return _0x1033fa;})[_0xbee0('0x3f')](respondWithFilteredResult(_0x41ca08,_0x44f476))[_0xbee0('0x41')](handleError(_0x41ca08,null));};exports[_0xbee0('0x42')]=function(_0x2a27aa,_0xdf52af){var _0x19858a={'raw':!![],'where':{'id':_0x2a27aa[_0xbee0('0x43')]['id']}},_0x3933f8={};_0x3933f8['model']=_['keys'](db['VoiceTransferReport']['rawAttributes']);_0x3933f8['query']=_[_0xbee0('0x2f')](_0x2a27aa['query']);_0x3933f8['filters']=_[_0xbee0('0x44')](_0x3933f8[_0xbee0('0x2e')],_0x3933f8[_0xbee0('0x30')]);_0x19858a[_0xbee0('0x32')]=_[_0xbee0('0x44')](_0x3933f8['model'],qs[_0xbee0('0x33')](_0x2a27aa[_0xbee0('0x30')][_0xbee0('0x33')]));_0x19858a[_0xbee0('0x32')]=_0x19858a['attributes'][_0xbee0('0x34')]?_0x19858a[_0xbee0('0x32')]:_0x3933f8[_0xbee0('0x2e')];if(_0x2a27aa[_0xbee0('0x30')][_0xbee0('0x45')]){_0x19858a[_0xbee0('0x46')]=[{'all':!![]}];}_0x19858a=_[_0xbee0('0x3d')]({},_0x19858a,_0x2a27aa[_0xbee0('0x3e')]);return db[_0xbee0('0x2a')]['find'](_0x19858a)[_0xbee0('0x3f')](handleEntityNotFound(_0xdf52af,null))['then'](respondWithResult(_0xdf52af,null))[_0xbee0('0x41')](handleError(_0xdf52af,null));};exports['create']=function(_0x38dddb,_0x374d96){return db[_0xbee0('0x2a')]['create'](_0x38dddb[_0xbee0('0x47')],{})[_0xbee0('0x3f')](respondWithResult(_0x374d96,0xc9))['catch'](handleError(_0x374d96,null));};exports[_0xbee0('0x23')]=function(_0x4e4521,_0x3e9d81){if(_0x4e4521['body']['id']){delete _0x4e4521[_0xbee0('0x47')]['id'];}return db['VoiceTransferReport'][_0xbee0('0x48')]({'where':{'id':_0x4e4521[_0xbee0('0x43')]['id']}})[_0xbee0('0x3f')](handleEntityNotFound(_0x3e9d81,null))[_0xbee0('0x3f')](saveUpdates(_0x4e4521['body'],null))[_0xbee0('0x3f')](respondWithResult(_0x3e9d81,null))[_0xbee0('0x41')](handleError(_0x3e9d81,null));};exports['destroy']=function(_0xd7a17e,_0x2b9c74){return db[_0xbee0('0x2a')]['find']({'where':{'id':_0xd7a17e[_0xbee0('0x43')]['id']}})[_0xbee0('0x3f')](handleEntityNotFound(_0x2b9c74,null))[_0xbee0('0x3f')](removeEntity(_0x2b9c74,null))[_0xbee0('0x41')](handleError(_0x2b9c74,null));};exports[_0xbee0('0x49')]=function(_0x2a0658,_0x1e79bd){return db['VoiceTransferReport']['describe']()[_0xbee0('0x3f')](respondWithResult(_0x1e79bd,null))[_0xbee0('0x41')](handleError(_0x1e79bd,null));}; \ No newline at end of file +var _0xe4d0=['query','filters','intersection','model','attributes','fields','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','rows','catch','params','keys','length','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','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','count','limit','set','apply','reject','update','then','destroy','name','send','index','map','VoiceTransferReport','rawAttributes','fieldName','type','key'];(function(_0x26462c,_0xd20a35){var _0x509a42=function(_0x1b22c9){while(--_0x1b22c9){_0x26462c['push'](_0x26462c['shift']());}};_0x509a42(++_0xd20a35);}(_0xe4d0,0x190));var _0x0e4d=function(_0x5f1cf8,_0x5e0923){_0x5f1cf8=_0x5f1cf8-0x0;var _0x27d0fa=_0xe4d0[_0x5f1cf8];return _0x27d0fa;};'use strict';var emlformat=require(_0x0e4d('0x0'));var rimraf=require(_0x0e4d('0x1'));var zipdir=require(_0x0e4d('0x2'));var jsonpatch=require(_0x0e4d('0x3'));var rp=require(_0x0e4d('0x4'));var moment=require('moment');var BPromise=require(_0x0e4d('0x5'));var Mustache=require(_0x0e4d('0x6'));var util=require(_0x0e4d('0x7'));var path=require(_0x0e4d('0x8'));var sox=require(_0x0e4d('0x9'));var csv=require(_0x0e4d('0xa'));var ejs=require(_0x0e4d('0xb'));var fs=require('fs');var fs_extra=require(_0x0e4d('0xc'));var _=require(_0x0e4d('0xd'));var squel=require(_0x0e4d('0xe'));var crypto=require(_0x0e4d('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0e4d('0x10'));var Redis=require(_0x0e4d('0x11'));var authService=require(_0x0e4d('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x0e4d('0x13'));var hardwareService=require(_0x0e4d('0x14'));var logger=require(_0x0e4d('0x15'))(_0x0e4d('0x16'));var utils=require(_0x0e4d('0x17'));var config=require(_0x0e4d('0x18'));var licenseUtil=require(_0x0e4d('0x19'));var db=require(_0x0e4d('0x1a'))['db'];function respondWithStatusCode(_0x20efd5,_0x10f620){_0x10f620=_0x10f620||0xcc;return function(_0x36bddb){if(_0x36bddb){return _0x20efd5[_0x0e4d('0x1b')](_0x10f620);}return _0x20efd5['status'](_0x10f620)[_0x0e4d('0x1c')]();};}function respondWithResult(_0x21744b,_0x253705){_0x253705=_0x253705||0xc8;return function(_0x370860){if(_0x370860){return _0x21744b[_0x0e4d('0x1d')](_0x253705)[_0x0e4d('0x1e')](_0x370860);}};}function respondWithFilteredResult(_0x4455fc,_0x3e2e08){return function(_0x27ce41){if(_0x27ce41){var _0x215751=typeof _0x3e2e08[_0x0e4d('0x1f')]===_0x0e4d('0x20')&&typeof _0x3e2e08['limit']===_0x0e4d('0x20');var _0x3019ea=_0x27ce41[_0x0e4d('0x21')];var _0x44bf4c=_0x215751?0x0:_0x3e2e08['offset'];var _0x2c572f=_0x215751?_0x27ce41[_0x0e4d('0x21')]:_0x3e2e08[_0x0e4d('0x1f')]+_0x3e2e08[_0x0e4d('0x22')];var _0x3c869c;if(_0x2c572f>=_0x3019ea){_0x2c572f=_0x3019ea;_0x3c869c=0xc8;}else{_0x3c869c=0xce;}_0x4455fc[_0x0e4d('0x1d')](_0x3c869c);return _0x4455fc[_0x0e4d('0x23')]('Content-Range',_0x44bf4c+'-'+_0x2c572f+'/'+_0x3019ea)['json'](_0x27ce41);}return null;};}function patchUpdates(_0x6d9415){return function(_0x32274d){try{jsonpatch[_0x0e4d('0x24')](_0x32274d,_0x6d9415,!![]);}catch(_0x50e852){return BPromise[_0x0e4d('0x25')](_0x50e852);}return _0x32274d['save']();};}function saveUpdates(_0x328002,_0x3e8fe6){return function(_0x5b0cb0){if(_0x5b0cb0){return _0x5b0cb0[_0x0e4d('0x26')](_0x328002)[_0x0e4d('0x27')](function(_0x4a2c92){return _0x4a2c92;});}return null;};}function removeEntity(_0x4eec8b,_0x1a5ee){return function(_0x67f972){if(_0x67f972){return _0x67f972[_0x0e4d('0x28')]()[_0x0e4d('0x27')](function(){_0x4eec8b[_0x0e4d('0x1d')](0xcc)[_0x0e4d('0x1c')]();});}};}function handleEntityNotFound(_0x419ed0,_0x4d0d88){return function(_0x5125a5){if(!_0x5125a5){_0x419ed0[_0x0e4d('0x1b')](0x194);}return _0x5125a5;};}function handleError(_0x45bdeb,_0x3ed0dc){_0x3ed0dc=_0x3ed0dc||0x1f4;return function(_0x44f58e){logger['error'](_0x44f58e['stack']);if(_0x44f58e[_0x0e4d('0x29')]){delete _0x44f58e['name'];}_0x45bdeb[_0x0e4d('0x1d')](_0x3ed0dc)[_0x0e4d('0x2a')](_0x44f58e);};}exports[_0x0e4d('0x2b')]=function(_0x5cf7f9,_0x3987ca){var _0x71ad91={},_0x9fb47a={},_0x2c5669={'count':0x0,'rows':[]};var _0x53efbf=_[_0x0e4d('0x2c')](db[_0x0e4d('0x2d')][_0x0e4d('0x2e')],function(_0x4be03a){return{'name':_0x4be03a[_0x0e4d('0x2f')],'type':_0x4be03a[_0x0e4d('0x30')][_0x0e4d('0x31')]};});_0x9fb47a['model']=_[_0x0e4d('0x2c')](_0x53efbf,_0x0e4d('0x29'));_0x9fb47a[_0x0e4d('0x32')]=_['keys'](_0x5cf7f9[_0x0e4d('0x32')]);_0x9fb47a[_0x0e4d('0x33')]=_[_0x0e4d('0x34')](_0x9fb47a[_0x0e4d('0x35')],_0x9fb47a[_0x0e4d('0x32')]);_0x71ad91[_0x0e4d('0x36')]=_[_0x0e4d('0x34')](_0x9fb47a[_0x0e4d('0x35')],qs[_0x0e4d('0x37')](_0x5cf7f9['query'][_0x0e4d('0x37')]));_0x71ad91['attributes']=_0x71ad91[_0x0e4d('0x36')]['length']?_0x71ad91[_0x0e4d('0x36')]:_0x9fb47a[_0x0e4d('0x35')];if(!_0x5cf7f9[_0x0e4d('0x32')]['hasOwnProperty'](_0x0e4d('0x38'))){_0x71ad91[_0x0e4d('0x22')]=qs[_0x0e4d('0x22')](_0x5cf7f9[_0x0e4d('0x32')][_0x0e4d('0x22')]);_0x71ad91[_0x0e4d('0x1f')]=qs['offset'](_0x5cf7f9['query'][_0x0e4d('0x1f')]);}_0x71ad91['order']=qs[_0x0e4d('0x39')](_0x5cf7f9[_0x0e4d('0x32')][_0x0e4d('0x39')]);_0x71ad91['where']=qs[_0x0e4d('0x33')](_[_0x0e4d('0x3a')](_0x5cf7f9['query'],_0x9fb47a[_0x0e4d('0x33')]),_0x53efbf);if(_0x5cf7f9['query'][_0x0e4d('0x3b')]){_0x71ad91[_0x0e4d('0x3c')]=_[_0x0e4d('0x3d')](_0x71ad91['where'],{'$or':_['map'](_0x53efbf,function(_0x4930c8){if(_0x4930c8[_0x0e4d('0x30')]!==_0x0e4d('0x3e')){var _0x9a70fc={};_0x9a70fc[_0x4930c8[_0x0e4d('0x29')]]={'$like':'%'+_0x5cf7f9[_0x0e4d('0x32')][_0x0e4d('0x3b')]+'%'};return _0x9a70fc;}})});}_0x71ad91=_[_0x0e4d('0x3d')]({},_0x71ad91,_0x5cf7f9[_0x0e4d('0x3f')]);var _0x5f5038={'where':_0x71ad91['where']};return db[_0x0e4d('0x2d')][_0x0e4d('0x21')](_0x5f5038)['then'](function(_0x59b4c0){_0x2c5669[_0x0e4d('0x21')]=_0x59b4c0;if(_0x5cf7f9[_0x0e4d('0x32')][_0x0e4d('0x40')]){_0x71ad91[_0x0e4d('0x41')]=[{'all':!![]}];}return db[_0x0e4d('0x2d')]['findAll'](_0x71ad91);})[_0x0e4d('0x27')](function(_0x38eba3){_0x2c5669[_0x0e4d('0x42')]=_0x38eba3;return _0x2c5669;})[_0x0e4d('0x27')](respondWithFilteredResult(_0x3987ca,_0x71ad91))[_0x0e4d('0x43')](handleError(_0x3987ca,null));};exports['show']=function(_0x265d2b,_0x3136b4){var _0x51ebe1={'raw':!![],'where':{'id':_0x265d2b[_0x0e4d('0x44')]['id']}},_0x456135={};_0x456135[_0x0e4d('0x35')]=_['keys'](db[_0x0e4d('0x2d')]['rawAttributes']);_0x456135[_0x0e4d('0x32')]=_[_0x0e4d('0x45')](_0x265d2b[_0x0e4d('0x32')]);_0x456135[_0x0e4d('0x33')]=_[_0x0e4d('0x34')](_0x456135[_0x0e4d('0x35')],_0x456135[_0x0e4d('0x32')]);_0x51ebe1[_0x0e4d('0x36')]=_[_0x0e4d('0x34')](_0x456135[_0x0e4d('0x35')],qs[_0x0e4d('0x37')](_0x265d2b['query']['fields']));_0x51ebe1[_0x0e4d('0x36')]=_0x51ebe1[_0x0e4d('0x36')][_0x0e4d('0x46')]?_0x51ebe1['attributes']:_0x456135[_0x0e4d('0x35')];if(_0x265d2b['query'][_0x0e4d('0x40')]){_0x51ebe1[_0x0e4d('0x41')]=[{'all':!![]}];}_0x51ebe1=_['merge']({},_0x51ebe1,_0x265d2b['options']);return db[_0x0e4d('0x2d')][_0x0e4d('0x47')](_0x51ebe1)[_0x0e4d('0x27')](handleEntityNotFound(_0x3136b4,null))[_0x0e4d('0x27')](respondWithResult(_0x3136b4,null))[_0x0e4d('0x43')](handleError(_0x3136b4,null));};exports[_0x0e4d('0x48')]=function(_0xb3c302,_0x2fdee4){return db[_0x0e4d('0x2d')][_0x0e4d('0x48')](_0xb3c302[_0x0e4d('0x49')],{})[_0x0e4d('0x27')](respondWithResult(_0x2fdee4,0xc9))['catch'](handleError(_0x2fdee4,null));};exports[_0x0e4d('0x26')]=function(_0x5a4455,_0xca0bef){if(_0x5a4455[_0x0e4d('0x49')]['id']){delete _0x5a4455['body']['id'];}return db[_0x0e4d('0x2d')][_0x0e4d('0x47')]({'where':{'id':_0x5a4455[_0x0e4d('0x44')]['id']}})['then'](handleEntityNotFound(_0xca0bef,null))[_0x0e4d('0x27')](saveUpdates(_0x5a4455[_0x0e4d('0x49')],null))['then'](respondWithResult(_0xca0bef,null))[_0x0e4d('0x43')](handleError(_0xca0bef,null));};exports[_0x0e4d('0x28')]=function(_0x42293e,_0x2e2e9a){return db[_0x0e4d('0x2d')]['find']({'where':{'id':_0x42293e[_0x0e4d('0x44')]['id']}})[_0x0e4d('0x27')](handleEntityNotFound(_0x2e2e9a,null))[_0x0e4d('0x27')](removeEntity(_0x2e2e9a,null))['catch'](handleError(_0x2e2e9a,null));};exports[_0x0e4d('0x4a')]=function(_0x39405a,_0x559c38){return db['VoiceTransferReport'][_0x0e4d('0x4a')]()[_0x0e4d('0x27')](respondWithResult(_0x559c38,null))[_0x0e4d('0x43')](handleError(_0x559c38,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index f1b429b..6b508cd 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 _0xbc38=['moment','bluebird','request-promise','path','../../config/environment','./voiceTransferReport.attributes','exports','define','report_call_transfer','util','../../config/logger'];(function(_0x20d3b5,_0x25f3af){var _0x58565e=function(_0x276666){while(--_0x276666){_0x20d3b5['push'](_0x20d3b5['shift']());}};_0x58565e(++_0x25f3af);}(_0xbc38,0x106));var _0x8bc3=function(_0x362c1f,_0x4fccd9){_0x362c1f=_0x362c1f-0x0;var _0x32bd2a=_0xbc38[_0x362c1f];return _0x32bd2a;};'use strict';var _=require('lodash');var util=require(_0x8bc3('0x0'));var logger=require(_0x8bc3('0x1'))('api');var moment=require(_0x8bc3('0x2'));var BPromise=require(_0x8bc3('0x3'));var rp=require(_0x8bc3('0x4'));var fs=require('fs');var path=require(_0x8bc3('0x5'));var rimraf=require('rimraf');var config=require(_0x8bc3('0x6'));var attributes=require(_0x8bc3('0x7'));module[_0x8bc3('0x8')]=function(_0x305275,_0x4355ff){return _0x305275[_0x8bc3('0x9')]('VoiceTransferReport',attributes,{'tableName':_0x8bc3('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2bf6=['api','bluebird','request-promise','rimraf','./voiceTransferReport.attributes','exports','VoiceTransferReport','report_call_transfer','lodash'];(function(_0x1fc73c,_0x1b08e6){var _0x4fec7d=function(_0x53668e){while(--_0x53668e){_0x1fc73c['push'](_0x1fc73c['shift']());}};_0x4fec7d(++_0x1b08e6);}(_0x2bf6,0x1af));var _0x62bf=function(_0x4fddd0,_0x39a83c){_0x4fddd0=_0x4fddd0-0x0;var _0x18280a=_0x2bf6[_0x4fddd0];return _0x18280a;};'use strict';var _=require(_0x62bf('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x62bf('0x1'));var moment=require('moment');var BPromise=require(_0x62bf('0x2'));var rp=require(_0x62bf('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x62bf('0x4'));var config=require('../../config/environment');var attributes=require(_0x62bf('0x5'));module[_0x62bf('0x6')]=function(_0xd20496,_0x33c2c3){return _0xd20496['define'](_0x62bf('0x7'),attributes,{'tableName':_0x62bf('0x8'),'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 cd98496..4ffae39 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 _0x5fff=['randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateVoiceTransferReport','create','options','raw','then','lodash','util','moment'];(function(_0x4e9a22,_0x65e645){var _0x364420=function(_0x4ecb09){while(--_0x4ecb09){_0x4e9a22['push'](_0x4e9a22['shift']());}};_0x364420(++_0x65e645);}(_0x5fff,0x75));var _0xf5ff=function(_0x29d915,_0x54a040){_0x29d915=_0x29d915-0x0;var _0x160f86=_0x5fff[_0x29d915];return _0x160f86;};'use strict';var _=require(_0xf5ff('0x0'));var util=require(_0xf5ff('0x1'));var moment=require(_0xf5ff('0x2'));var BPromise=require('bluebird');var rs=require(_0xf5ff('0x3'));var fs=require('fs');var Redis=require(_0xf5ff('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xf5ff('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5ff('0x6'));var jayson=require(_0xf5ff('0x7'));var client=jayson[_0xf5ff('0x8')][_0xf5ff('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x52bbba,_0xf1f83b,_0x3fd4cb){return new BPromise(function(_0x1430a4,_0x2b75cd){return client['request'](_0x52bbba,_0x3fd4cb)['then'](function(_0x5194a4){logger[_0xf5ff('0xa')](_0xf5ff('0xb'),_0xf1f83b,_0xf5ff('0xc'));logger['debug'](_0xf5ff('0xd'),_0xf1f83b,'request\x20sent',JSON[_0xf5ff('0xe')](_0x5194a4));if(_0x5194a4[_0xf5ff('0xf')]){if(_0x5194a4[_0xf5ff('0xf')][_0xf5ff('0x10')]===0x1f4){logger[_0xf5ff('0xf')](_0xf5ff('0xb'),_0xf1f83b,_0x5194a4[_0xf5ff('0xf')][_0xf5ff('0x11')]);return _0x2b75cd(_0x5194a4[_0xf5ff('0xf')][_0xf5ff('0x11')]);}logger[_0xf5ff('0xf')]('VoiceTransferReport,\x20%s,\x20%s',_0xf1f83b,_0x5194a4[_0xf5ff('0xf')][_0xf5ff('0x11')]);return _0x1430a4(_0x5194a4[_0xf5ff('0xf')]['message']);}else{logger[_0xf5ff('0xa')](_0xf5ff('0xb'),_0xf1f83b,'request\x20sent');_0x1430a4(_0x5194a4[_0xf5ff('0x12')][_0xf5ff('0x11')]);}})['catch'](function(_0x188119){logger[_0xf5ff('0xf')](_0xf5ff('0xb'),_0xf1f83b,_0x188119);_0x2b75cd(_0x188119);});});}exports[_0xf5ff('0x13')]=function(_0x558790){var _0xbe44bd=this;return new Promise(function(_0x4d6c94,_0x4fd2cb){return db['VoiceTransferReport'][_0xf5ff('0x14')](_0x558790['body'],{'raw':_0x558790[_0xf5ff('0x15')]?_0x558790[_0xf5ff('0x15')][_0xf5ff('0x16')]===undefined?!![]:![]:!![]})[_0xf5ff('0x17')](function(_0x3d5085){logger[_0xf5ff('0xa')](_0xf5ff('0x13'),_0x558790);logger['debug'](_0xf5ff('0x13'),_0x558790,JSON['stringify'](_0x3d5085));_0x4d6c94(_0x3d5085);})['catch'](function(_0x28df9b){logger[_0xf5ff('0xf')](_0xf5ff('0x13'),_0x28df9b[_0xf5ff('0x11')],_0x558790);_0x4fd2cb(_0xbe44bd[_0xf5ff('0xf')](0x1f4,_0x28df9b['message']));});});}; \ No newline at end of file +var _0xa56a=['result','catch','create','options','raw','CreateVoiceTransferReport','stringify','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','error','code','VoiceTransferReport,\x20%s,\x20%s','message','info'];(function(_0x51fb36,_0x3ba789){var _0x4a8068=function(_0x2b23c0){while(--_0x2b23c0){_0x51fb36['push'](_0x51fb36['shift']());}};_0x4a8068(++_0x3ba789);}(_0xa56a,0x93));var _0xaa56=function(_0x6479d7,_0x1498cb){_0x6479d7=_0x6479d7-0x0;var _0x3306fd=_0xa56a[_0x6479d7];return _0x3306fd;};'use strict';var _=require(_0xaa56('0x0'));var util=require(_0xaa56('0x1'));var moment=require(_0xaa56('0x2'));var BPromise=require(_0xaa56('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xaa56('0x4'));var db=require(_0xaa56('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xaa56('0x6'))(_0xaa56('0x7'));var config=require(_0xaa56('0x8'));var jayson=require(_0xaa56('0x9'));var client=jayson[_0xaa56('0xa')][_0xaa56('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x57aa21,_0x57dccd,_0x1ef691){return new BPromise(function(_0x238faa,_0x1a05ec){return client['request'](_0x57aa21,_0x1ef691)[_0xaa56('0xc')](function(_0x1dafc4){logger['info']('VoiceTransferReport,\x20%s,\x20%s',_0x57dccd,_0xaa56('0xd'));logger[_0xaa56('0xe')](_0xaa56('0xf'),_0x57dccd,_0xaa56('0xd'),JSON['stringify'](_0x1dafc4));if(_0x1dafc4['error']){if(_0x1dafc4[_0xaa56('0x10')][_0xaa56('0x11')]===0x1f4){logger[_0xaa56('0x10')](_0xaa56('0x12'),_0x57dccd,_0x1dafc4[_0xaa56('0x10')][_0xaa56('0x13')]);return _0x1a05ec(_0x1dafc4[_0xaa56('0x10')][_0xaa56('0x13')]);}logger[_0xaa56('0x10')]('VoiceTransferReport,\x20%s,\x20%s',_0x57dccd,_0x1dafc4['error'][_0xaa56('0x13')]);return _0x238faa(_0x1dafc4['error'][_0xaa56('0x13')]);}else{logger[_0xaa56('0x14')]('VoiceTransferReport,\x20%s,\x20%s',_0x57dccd,'request\x20sent');_0x238faa(_0x1dafc4[_0xaa56('0x15')][_0xaa56('0x13')]);}})[_0xaa56('0x16')](function(_0x326d78){logger[_0xaa56('0x10')](_0xaa56('0x12'),_0x57dccd,_0x326d78);_0x1a05ec(_0x326d78);});});}exports['CreateVoiceTransferReport']=function(_0x39e3e9){var _0x44cba6=this;return new Promise(function(_0x8e93dc,_0x2e561a){return db['VoiceTransferReport'][_0xaa56('0x17')](_0x39e3e9['body'],{'raw':_0x39e3e9[_0xaa56('0x18')]?_0x39e3e9[_0xaa56('0x18')][_0xaa56('0x19')]===undefined?!![]:![]:!![]})[_0xaa56('0xc')](function(_0x197223){logger[_0xaa56('0x14')](_0xaa56('0x1a'),_0x39e3e9);logger['debug'](_0xaa56('0x1a'),_0x39e3e9,JSON[_0xaa56('0x1b')](_0x197223));_0x8e93dc(_0x197223);})['catch'](function(_0x12c5cf){logger['error'](_0xaa56('0x1a'),_0x12c5cf[_0xaa56('0x13')],_0x39e3e9);_0x2e561a(_0x44cba6[_0xaa56('0x10')](0x1f4,_0x12c5cf['message']));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index 22cd93c..02aa960 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 _0x0bb5=['unhold','/calls','calls','/transfer','exports','express','Router','post','/originate','isAuthenticated','isWebrtcLicence','originate','/hangup','/answer','/hold','hold','/unhold'];(function(_0x1a3e23,_0x289e02){var _0x49b481=function(_0x55ba14){while(--_0x55ba14){_0x1a3e23['push'](_0x1a3e23['shift']());}};_0x49b481(++_0x289e02);}(_0x0bb5,0x148));var _0x50bb=function(_0x5ce0ba,_0x32fb25){_0x5ce0ba=_0x5ce0ba-0x0;var _0x29e959=_0x0bb5[_0x5ce0ba];return _0x29e959;};'use strict';var express=require(_0x50bb('0x0'));var router=express[_0x50bb('0x1')]();var auth=require('../../components/auth/service');var controller=require('./webbar.controller');router[_0x50bb('0x2')](_0x50bb('0x3'),auth[_0x50bb('0x4')](),auth[_0x50bb('0x5')](),controller[_0x50bb('0x6')]);router[_0x50bb('0x2')](_0x50bb('0x7'),auth[_0x50bb('0x4')](),auth['isWebrtcLicence'](),controller['hangup']);router[_0x50bb('0x2')](_0x50bb('0x8'),auth[_0x50bb('0x4')](),auth[_0x50bb('0x5')](),controller['answer']);router['post'](_0x50bb('0x9'),auth[_0x50bb('0x4')](),auth[_0x50bb('0x5')](),controller[_0x50bb('0xa')]);router['post'](_0x50bb('0xb'),auth[_0x50bb('0x4')](),auth[_0x50bb('0x5')](),controller[_0x50bb('0xc')]);router[_0x50bb('0x2')](_0x50bb('0xd'),auth[_0x50bb('0x4')](),auth['isWebrtcLicence'](),controller[_0x50bb('0xe')]);router['post'](_0x50bb('0xf'),auth[_0x50bb('0x4')](),auth[_0x50bb('0x5')](),controller['transfer']);module[_0x50bb('0x10')]=router; \ No newline at end of file +var _0xe14d=['hangup','answer','/hold','hold','/unhold','unhold','/calls','calls','/transfer','transfer','exports','express','Router','../../components/auth/service','./webbar.controller','/originate','isAuthenticated','originate','post','/hangup','isWebrtcLicence'];(function(_0x4fdb0a,_0x47ddfd){var _0x57e3a2=function(_0x2c9ca6){while(--_0x2c9ca6){_0x4fdb0a['push'](_0x4fdb0a['shift']());}};_0x57e3a2(++_0x47ddfd);}(_0xe14d,0x1ee));var _0xde14=function(_0x1d9aa0,_0x272488){_0x1d9aa0=_0x1d9aa0-0x0;var _0x226868=_0xe14d[_0x1d9aa0];return _0x226868;};'use strict';var express=require(_0xde14('0x0'));var router=express[_0xde14('0x1')]();var auth=require(_0xde14('0x2'));var controller=require(_0xde14('0x3'));router['post'](_0xde14('0x4'),auth[_0xde14('0x5')](),auth['isWebrtcLicence'](),controller[_0xde14('0x6')]);router[_0xde14('0x7')](_0xde14('0x8'),auth[_0xde14('0x5')](),auth[_0xde14('0x9')](),controller[_0xde14('0xa')]);router['post']('/answer',auth[_0xde14('0x5')](),auth[_0xde14('0x9')](),controller[_0xde14('0xb')]);router[_0xde14('0x7')](_0xde14('0xc'),auth[_0xde14('0x5')](),auth[_0xde14('0x9')](),controller[_0xde14('0xd')]);router['post'](_0xde14('0xe'),auth[_0xde14('0x5')](),auth[_0xde14('0x9')](),controller[_0xde14('0xf')]);router[_0xde14('0x7')](_0xde14('0x10'),auth[_0xde14('0x5')](),auth[_0xde14('0x9')](),controller[_0xde14('0x11')]);router[_0xde14('0x7')](_0xde14('0x12'),auth[_0xde14('0x5')](),auth[_0xde14('0x9')](),controller[_0xde14('0x13')]);module[_0xde14('0x14')]=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index 50d3b44..fd0bbd5 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 _0x593e=['number','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','stringify','handleError:','error','name','status','send','NotFound','request','code','message','catch','findOne','agent','then','all','filter','UserId','sessionId','length','sessionId\x20','\x20not\x20found!','originate','body','json','userId','callerId','callbackUrl','entityFound:','format','user:%s','hangup\x20fired:','webbar:hangup','hangup\x20executed!','answer','answer\x20fired:','webbar:answer','answer\x20executed!','webbar:hold','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls','calls\x20fired:','VoiceChannels','rows','conference\x20fired:','webbar:conference','conference\x20executed!','transfer\x20fired:','transferNumber','transfer\x20executed!','path','lodash','../../mysqldb','../../config/environment','util','bluebird','jayson/promise','client','../../config/logger','webbarapi','ioredis','redis','defaults','localhost','socket.io-emitter','validate','userId\x20is\x20required','string','callNumber\x20is\x20required'];(function(_0x1d0009,_0x10959e){var _0x2c95c9=function(_0x5b3924){while(--_0x5b3924){_0x1d0009['push'](_0x1d0009['shift']());}};_0x2c95c9(++_0x10959e);}(_0x593e,0xcb));var _0xe593=function(_0x10bcaa,_0xb188a2){_0x10bcaa=_0x10bcaa-0x0;var _0x59807e=_0x593e[_0x10bcaa];return _0x59807e;};'use strict';var path=require(_0xe593('0x0'));var fs=require('fs');var _=require(_0xe593('0x1'));var db=require(_0xe593('0x2'))['db'];var config=require(_0xe593('0x3'));var util=require(_0xe593('0x4'));var BPromise=require(_0xe593('0x5'));var jayson=require(_0xe593('0x6'));var amiClient=jayson[_0xe593('0x7')]['http']({'port':0x232a});var logger=require(_0xe593('0x8'))(_0xe593('0x9'));var Redis=require(_0xe593('0xa'));config[_0xe593('0xb')]=_[_0xe593('0xc')](config[_0xe593('0xb')],{'host':_0xe593('0xd'),'port':0x18eb});var io=require(_0xe593('0xe'))(new Redis(config[_0xe593('0xb')]));var Schema=require(_0xe593('0xf'));var originateValidation=new Schema({'userId':{'type':'number','required':[!![],_0xe593('0x10')]},'callNumber':{'type':_0xe593('0x11'),'required':[!![],_0xe593('0x12')]},'callerId':{'type':'string'},'callbackUrl':{'type':'string'}});var hangupValidation=new Schema({'userId':{'type':_0xe593('0x13'),'required':[!![],_0xe593('0x10')]},'sessionId':{'type':_0xe593('0x11'),'required':![]}});var answerValidation=new Schema({'userId':{'type':'number','required':[!![],_0xe593('0x10')]},'sessionId':{'type':_0xe593('0x11'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0xe593('0x13'),'required':[!![],_0xe593('0x10')]},'sessionId':{'type':_0xe593('0x11'),'required':[!![],_0xe593('0x14')]},'transferNumber':{'type':_0xe593('0x11'),'required':[!![],_0xe593('0x15')]}});var holdValidation=new Schema({'userId':{'type':_0xe593('0x13'),'required':[!![],_0xe593('0x10')]},'sessionId':{'type':'string','required':![]}});var unholdValidation=new Schema({'userId':{'type':_0xe593('0x13'),'required':[!![],_0xe593('0x10')]},'sessionId':{'type':'string','required':![]}});var callsValidation=new Schema({'userId':{'type':_0xe593('0x13'),'required':[!![],_0xe593('0x10')]}});var conferenceValidation=new Schema({'userId':{'type':'number','required':[!![],_0xe593('0x10')]}});function emit(_0x40416c,_0x1c6de3,_0x2d525c){logger[_0xe593('0x16')](_0x40416c,_0x1c6de3,JSON[_0xe593('0x17')](_0x2d525c));io['to'](_0x40416c)['emit'](_0x1c6de3,_0x2d525c);}function handleError(_0xfbc79f){return function(_0x470d07){console['log'](_0xe593('0x18'),_0x470d07,_0x470d07 instanceof RangeError);logger[_0xe593('0x19')](_0x470d07['stack']);if(_0x470d07 instanceof RangeError){if(_0x470d07[_0xe593('0x1a')]){delete _0x470d07[_0xe593('0x1a')];}_0xfbc79f[_0xe593('0x1b')](0x194)[_0xe593('0x1c')](_0x470d07);}else{if(_0x470d07[_0xe593('0x1a')]){delete _0x470d07[_0xe593('0x1a')];}_0xfbc79f[_0xe593('0x1b')](0x1f4)['send'](_0x470d07);}};}function checkError(){return function(_0x4af4c8){if(!_0x4af4c8){throw new RangeError(_0xe593('0x1d'));}return _0x4af4c8;};}function respondWithRpcPromise(_0x5d4895,_0x56c23f){return new BPromise(function(_0x1bb8e8,_0x3c65b5){var _0x57379d=amiClient;return _0x57379d[_0xe593('0x1e')](_0x5d4895,_0x56c23f)['then'](function(_0x1672bf){if(_0x1672bf[_0xe593('0x19')]){if(_0x1672bf[_0xe593('0x19')][_0xe593('0x1f')]===0x1f4){return _0x3c65b5(_0x1672bf[_0xe593('0x19')][_0xe593('0x20')]);}return _0x1bb8e8(_0x1672bf[_0xe593('0x19')][_0xe593('0x20')]);}else{_0x1bb8e8(_0x1672bf['result']);}})[_0xe593('0x21')](function(_0x347d7d){_0x3c65b5(_0x347d7d);});});}function getAgent(_0x480218){return db['User'][_0xe593('0x22')]({'where':{'id':_0x480218,'role':_0xe593('0x23')}})[_0xe593('0x24')](checkError());}function getAgentCheckSession(_0x43699d,_0x3b66bc){return new BPromise(function(_0x27a3d2,_0x5918cd){var _0x350e2b=respondWithRpcPromise('VoiceChannels');var _0x1dacf6=getAgent(_0x43699d);Promise[_0xe593('0x25')]([_0x350e2b,_0x1dacf6])['then'](function(_0x337ee0){var _0x561a01=_0x337ee0[0x0];var _0x44a68c=_0x337ee0[0x1];var _0x1c147b=_[_0xe593('0x26')](_0x561a01['rows'],function(_0x1ae8d9){return _0x1ae8d9[_0xe593('0x27')]==_0x44a68c['id']&&_0x1ae8d9[_0xe593('0x28')]==_0x3b66bc;});if(_0x1c147b[_0xe593('0x29')]==0x1){_0x27a3d2(_0x44a68c);}else{_0x5918cd(new RangeError(_0xe593('0x2a')+_0x3b66bc+_0xe593('0x2b')));}});});}exports[_0xe593('0x2c')]=function(_0x4efc93,_0x4098a9){logger[_0xe593('0x16')]('originate\x20fired:',_0x4efc93[_0xe593('0x2d')]);var _0x571995=originateValidation[_0xe593('0xf')](_0x4efc93[_0xe593('0x2d')]);if(_0x571995[_0xe593('0x29')]>0x0){return _0x4098a9[_0xe593('0x1b')](0x190)[_0xe593('0x2e')](_0x571995);}var _0x24a560=_0x4efc93[_0xe593('0x2d')][_0xe593('0x2f')];var _0x11f287=_0x4efc93[_0xe593('0x2d')]['callNumber'];var _0x27a563=_0x4efc93[_0xe593('0x2d')][_0xe593('0x30')];var _0x5a55c0=_0x4efc93['body'][_0xe593('0x31')];return getAgent(_0x24a560)['then'](function(_0x232bf1){logger[_0xe593('0x16')](_0xe593('0x32'),_0x232bf1[_0xe593('0x1a')]);emit(util[_0xe593('0x33')](_0xe593('0x34'),_0x232bf1[_0xe593('0x1a')]),'webbar:originate',{'callNumber':_0x11f287,'callerId':_0x27a563,'callbackUrl':_0x5a55c0});return _0x4098a9['status'](0xc8)[_0xe593('0x2e')]({'error':![],'message':'originate\x20executed!'});})[_0xe593('0x21')](handleError(_0x4098a9));};exports['hangup']=function(_0x206775,_0x5b9589){logger['info'](_0xe593('0x35'),_0x206775[_0xe593('0x2d')]);var _0x2aa9d8=hangupValidation['validate'](_0x206775['body']);if(_0x2aa9d8['length']>0x0){return _0x5b9589[_0xe593('0x1b')](0x190)['json'](_0x2aa9d8);}var _0x37ba0e=_0x206775[_0xe593('0x2d')][_0xe593('0x2f')];var _0x475207=_0x206775['body'][_0xe593('0x28')];return getAgent(_0x37ba0e)['then'](function(_0x36c08e){logger['info']('entityFound:',_0x36c08e['name']);emit(util[_0xe593('0x33')]('user:%s',_0x36c08e[_0xe593('0x1a')]),_0xe593('0x36'),{'sessionId':_0x475207});return _0x5b9589[_0xe593('0x1b')](0xc8)['json']({'error':![],'message':_0xe593('0x37')});})[_0xe593('0x21')](handleError(_0x5b9589));};exports[_0xe593('0x38')]=function(_0x4655dd,_0x26ff41){logger[_0xe593('0x16')](_0xe593('0x39'),_0x4655dd[_0xe593('0x2d')]);var _0x4b36e1=answerValidation[_0xe593('0xf')](_0x4655dd[_0xe593('0x2d')]);if(_0x4b36e1[_0xe593('0x29')]>0x0){return _0x26ff41[_0xe593('0x1b')](0x190)[_0xe593('0x2e')](_0x4b36e1);}var _0x4d3018=_0x4655dd['body'][_0xe593('0x2f')];var _0x380429=_0x4655dd[_0xe593('0x2d')]['sessionId'];return getAgent(_0x4d3018)[_0xe593('0x24')](function(_0x8a4c26){logger['info']('entityFound:',_0x8a4c26[_0xe593('0x1a')]);emit(util[_0xe593('0x33')](_0xe593('0x34'),_0x8a4c26['name']),_0xe593('0x3a'),{'sessionId':_0x380429});return _0x26ff41[_0xe593('0x1b')](0xc8)[_0xe593('0x2e')]({'error':![],'message':_0xe593('0x3b')});})['catch'](handleError(_0x26ff41));};exports['hold']=function(_0x4a7434,_0x4c8d14){logger[_0xe593('0x16')]('hold\x20fired:',_0x4a7434[_0xe593('0x2d')]);var _0xd016b3=holdValidation[_0xe593('0xf')](_0x4a7434[_0xe593('0x2d')]);if(_0xd016b3[_0xe593('0x29')]>0x0){return _0x4c8d14[_0xe593('0x1b')](0x190)[_0xe593('0x2e')](_0xd016b3);}var _0x297c3e=_0x4a7434['body'][_0xe593('0x2f')];var _0x1a5e0f=_0x4a7434[_0xe593('0x2d')]['sessionId'];return getAgent(_0x297c3e)[_0xe593('0x24')](function(_0x5dfdb1){logger[_0xe593('0x16')](_0xe593('0x32'),_0x5dfdb1[_0xe593('0x1a')]);emit(util['format']('user:%s',_0x5dfdb1[_0xe593('0x1a')]),_0xe593('0x3c'),{'sessionId':_0x1a5e0f});return _0x4c8d14['status'](0xc8)['json']({'error':![],'message':'hold\x20executed!'});})['catch'](handleError(_0x4c8d14));};exports['unhold']=function(_0x383645,_0x1e48d8){logger[_0xe593('0x16')](_0xe593('0x3d'),_0x383645[_0xe593('0x2d')]);var _0x44201e=unholdValidation[_0xe593('0xf')](_0x383645[_0xe593('0x2d')]);if(_0x44201e[_0xe593('0x29')]>0x0){return _0x1e48d8[_0xe593('0x1b')](0x190)[_0xe593('0x2e')](_0x44201e);}var _0x1ea4ef=_0x383645[_0xe593('0x2d')][_0xe593('0x2f')];var _0xa25aa8=_0x383645[_0xe593('0x2d')]['sessionId'];return getAgent(_0x1ea4ef)[_0xe593('0x24')](function(_0x12e2ac){logger[_0xe593('0x16')](_0xe593('0x32'),_0x12e2ac[_0xe593('0x1a')]);emit(util[_0xe593('0x33')](_0xe593('0x34'),_0x12e2ac[_0xe593('0x1a')]),_0xe593('0x3e'),{'sessionId':_0xa25aa8});return _0x1e48d8[_0xe593('0x1b')](0xc8)[_0xe593('0x2e')]({'error':![],'message':_0xe593('0x3f')});})[_0xe593('0x21')](handleError(_0x1e48d8));};exports[_0xe593('0x40')]=function(_0x93ca5e,_0x5e8f9c){logger[_0xe593('0x16')](_0xe593('0x41'),_0x5e8f9c[_0xe593('0x2d')]);var _0x24d061=callsValidation[_0xe593('0xf')](_0x93ca5e['body']);if(_0x24d061['length']>0x0){return _0x5e8f9c[_0xe593('0x1b')](0x190)[_0xe593('0x2e')](_0x24d061);}var _0x318dd2=_0x93ca5e[_0xe593('0x2d')][_0xe593('0x2f')];var _0x1e49ed=respondWithRpcPromise(_0xe593('0x42'));var _0x518b6f=getAgent(_0x318dd2);return Promise['all']([_0x1e49ed,_0x518b6f])[_0xe593('0x24')](function(_0x23ee3b){var _0x4ff51d=_0x23ee3b[0x0];var _0x103403=_0x23ee3b[0x1];var _0xf8ed1d=_[_0xe593('0x26')](_0x4ff51d[_0xe593('0x43')],function(_0x3a3d7b){return _0x3a3d7b[_0xe593('0x27')]==_0x103403['id'];});return _0x5e8f9c[_0xe593('0x1b')](0xc8)[_0xe593('0x2e')]({'count':_0xf8ed1d[_0xe593('0x29')],'rows':_0xf8ed1d});})[_0xe593('0x21')](handleError(_0x5e8f9c));};exports['conference']=function(_0x36f38e,_0x13e368){logger[_0xe593('0x16')](_0xe593('0x44'),_0x36f38e[_0xe593('0x2d')]);var _0x202b18=conferenceValidation[_0xe593('0xf')](_0x36f38e['body']);if(_0x202b18[_0xe593('0x29')]>0x0){return _0x13e368[_0xe593('0x1b')](0x190)[_0xe593('0x2e')](_0x202b18);}var _0x14f8e1=_0x36f38e['body'][_0xe593('0x2f')];return getAgent(_0x14f8e1)[_0xe593('0x24')](function(_0x207c3d){logger[_0xe593('0x16')](_0xe593('0x32'),_0x207c3d['name']);emit(util[_0xe593('0x33')](_0xe593('0x34'),_0x207c3d[_0xe593('0x1a')]),_0xe593('0x45'));return _0x13e368[_0xe593('0x1b')](0xc8)[_0xe593('0x2e')]({'error':![],'message':_0xe593('0x46')});})[_0xe593('0x21')](handleError(_0x13e368));};exports['transfer']=function(_0x2145c0,_0x16f9fc){logger[_0xe593('0x16')](_0xe593('0x47'),_0x2145c0[_0xe593('0x2d')]);var _0x9f1813=transferValidation[_0xe593('0xf')](_0x2145c0[_0xe593('0x2d')]);if(_0x9f1813[_0xe593('0x29')]>0x0){return _0x16f9fc[_0xe593('0x1b')](0x190)['json'](_0x9f1813);}var _0x190e90=_0x2145c0[_0xe593('0x2d')][_0xe593('0x2f')];var _0x492a9e=_0x2145c0[_0xe593('0x2d')][_0xe593('0x28')];var _0x4001b7=_0x2145c0[_0xe593('0x2d')][_0xe593('0x48')];return getAgent(_0x190e90)['then'](function(_0x17a1bc){logger[_0xe593('0x16')]('entityFound:',_0x17a1bc[_0xe593('0x1a')]);emit(util[_0xe593('0x33')](_0xe593('0x34'),_0x17a1bc[_0xe593('0x1a')]),'webbar:transfer',{'sessionId':_0x492a9e,'transferNumber':_0x4001b7});return _0x16f9fc[_0xe593('0x1b')](0xc8)[_0xe593('0x2e')]({'error':![],'message':_0xe593('0x49')});})['catch'](handleError(_0x16f9fc));}; \ No newline at end of file +var _0x0b78=['result','catch','User','findOne','all','filter','rows','UserId','sessionId','length','originate','originate\x20fired:','body','json','userId','callNumber','callerId','callbackUrl','user:%s','webbar:originate','originate\x20executed!','hangup','hangup\x20fired:','entityFound:','webbar:hangup','hangup\x20executed!','answer\x20fired:','format','hold','hold\x20fired:','webbar:hold','hold\x20executed!','unhold','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls','calls\x20fired:','VoiceChannels','conference','conference\x20executed!','transfer','transfer\x20fired:','transferNumber','path','lodash','../../config/environment','util','jayson/promise','http','../../config/logger','webbarapi','defaults','localhost','socket.io-emitter','redis','validate','userId\x20is\x20required','string','callNumber\x20is\x20required','number','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','stringify','emit','log','handleError:','error','stack','status','send','name','NotFound','then','code','message'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x0b78,0x1ad));var _0x80b7=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x0b78[_0x40a045];return _0x1a687c;};'use strict';var path=require(_0x80b7('0x0'));var fs=require('fs');var _=require(_0x80b7('0x1'));var db=require('../../mysqldb')['db'];var config=require(_0x80b7('0x2'));var util=require(_0x80b7('0x3'));var BPromise=require('bluebird');var jayson=require(_0x80b7('0x4'));var amiClient=jayson['client'][_0x80b7('0x5')]({'port':0x232a});var logger=require(_0x80b7('0x6'))(_0x80b7('0x7'));var Redis=require('ioredis');config['redis']=_[_0x80b7('0x8')](config['redis'],{'host':_0x80b7('0x9'),'port':0x18eb});var io=require(_0x80b7('0xa'))(new Redis(config[_0x80b7('0xb')]));var Schema=require(_0x80b7('0xc'));var originateValidation=new Schema({'userId':{'type':'number','required':[!![],_0x80b7('0xd')]},'callNumber':{'type':_0x80b7('0xe'),'required':[!![],_0x80b7('0xf')]},'callerId':{'type':'string'},'callbackUrl':{'type':_0x80b7('0xe')}});var hangupValidation=new Schema({'userId':{'type':'number','required':[!![],_0x80b7('0xd')]},'sessionId':{'type':_0x80b7('0xe'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x80b7('0x10'),'required':[!![],_0x80b7('0xd')]},'sessionId':{'type':_0x80b7('0xe'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x80b7('0x10'),'required':[!![],_0x80b7('0xd')]},'sessionId':{'type':_0x80b7('0xe'),'required':[!![],_0x80b7('0x11')]},'transferNumber':{'type':_0x80b7('0xe'),'required':[!![],_0x80b7('0x12')]}});var holdValidation=new Schema({'userId':{'type':'number','required':[!![],_0x80b7('0xd')]},'sessionId':{'type':_0x80b7('0xe'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':'number','required':[!![],_0x80b7('0xd')]},'sessionId':{'type':_0x80b7('0xe'),'required':![]}});var callsValidation=new Schema({'userId':{'type':'number','required':[!![],_0x80b7('0xd')]}});var conferenceValidation=new Schema({'userId':{'type':_0x80b7('0x10'),'required':[!![],_0x80b7('0xd')]}});function emit(_0x2c0c4e,_0x36d0bb,_0x352805){logger[_0x80b7('0x13')](_0x2c0c4e,_0x36d0bb,JSON[_0x80b7('0x14')](_0x352805));io['to'](_0x2c0c4e)[_0x80b7('0x15')](_0x36d0bb,_0x352805);}function handleError(_0x34299c){return function(_0x4c12b1){console[_0x80b7('0x16')](_0x80b7('0x17'),_0x4c12b1,_0x4c12b1 instanceof RangeError);logger[_0x80b7('0x18')](_0x4c12b1[_0x80b7('0x19')]);if(_0x4c12b1 instanceof RangeError){if(_0x4c12b1['name']){delete _0x4c12b1['name'];}_0x34299c[_0x80b7('0x1a')](0x194)[_0x80b7('0x1b')](_0x4c12b1);}else{if(_0x4c12b1[_0x80b7('0x1c')]){delete _0x4c12b1[_0x80b7('0x1c')];}_0x34299c['status'](0x1f4)['send'](_0x4c12b1);}};}function checkError(){return function(_0x2aebe3){if(!_0x2aebe3){throw new RangeError(_0x80b7('0x1d'));}return _0x2aebe3;};}function respondWithRpcPromise(_0xa465d2,_0x3ad8c1){return new BPromise(function(_0x527d0f,_0x18d407){var _0x4c3bed=amiClient;return _0x4c3bed['request'](_0xa465d2,_0x3ad8c1)[_0x80b7('0x1e')](function(_0xdab5e0){if(_0xdab5e0[_0x80b7('0x18')]){if(_0xdab5e0[_0x80b7('0x18')][_0x80b7('0x1f')]===0x1f4){return _0x18d407(_0xdab5e0[_0x80b7('0x18')][_0x80b7('0x20')]);}return _0x527d0f(_0xdab5e0[_0x80b7('0x18')][_0x80b7('0x20')]);}else{_0x527d0f(_0xdab5e0[_0x80b7('0x21')]);}})[_0x80b7('0x22')](function(_0x311aa3){_0x18d407(_0x311aa3);});});}function getAgent(_0x9da9e9){return db[_0x80b7('0x23')][_0x80b7('0x24')]({'where':{'id':_0x9da9e9,'role':'agent'}})[_0x80b7('0x1e')](checkError());}function getAgentCheckSession(_0x1661be,_0x5e3f6f){return new BPromise(function(_0x370bfb,_0x37fda1){var _0x17d845=respondWithRpcPromise('VoiceChannels');var _0x1b7715=getAgent(_0x1661be);Promise[_0x80b7('0x25')]([_0x17d845,_0x1b7715])[_0x80b7('0x1e')](function(_0x30cd74){var _0x1c4607=_0x30cd74[0x0];var _0x399ef1=_0x30cd74[0x1];var _0x1365aa=_[_0x80b7('0x26')](_0x1c4607[_0x80b7('0x27')],function(_0x940c7a){return _0x940c7a[_0x80b7('0x28')]==_0x399ef1['id']&&_0x940c7a[_0x80b7('0x29')]==_0x5e3f6f;});if(_0x1365aa[_0x80b7('0x2a')]==0x1){_0x370bfb(_0x399ef1);}else{_0x37fda1(new RangeError('sessionId\x20'+_0x5e3f6f+'\x20not\x20found!'));}});});}exports[_0x80b7('0x2b')]=function(_0x1ec86c,_0x4fa26a){logger['info'](_0x80b7('0x2c'),_0x1ec86c[_0x80b7('0x2d')]);var _0x1cbe71=originateValidation[_0x80b7('0xc')](_0x1ec86c[_0x80b7('0x2d')]);if(_0x1cbe71[_0x80b7('0x2a')]>0x0){return _0x4fa26a['status'](0x190)[_0x80b7('0x2e')](_0x1cbe71);}var _0x1f9041=_0x1ec86c[_0x80b7('0x2d')][_0x80b7('0x2f')];var _0x52563d=_0x1ec86c[_0x80b7('0x2d')][_0x80b7('0x30')];var _0x5df414=_0x1ec86c[_0x80b7('0x2d')][_0x80b7('0x31')];var _0x18ec95=_0x1ec86c[_0x80b7('0x2d')][_0x80b7('0x32')];return getAgent(_0x1f9041)[_0x80b7('0x1e')](function(_0x3ff3f9){logger[_0x80b7('0x13')]('entityFound:',_0x3ff3f9['name']);emit(util['format'](_0x80b7('0x33'),_0x3ff3f9[_0x80b7('0x1c')]),_0x80b7('0x34'),{'callNumber':_0x52563d,'callerId':_0x5df414,'callbackUrl':_0x18ec95});return _0x4fa26a[_0x80b7('0x1a')](0xc8)[_0x80b7('0x2e')]({'error':![],'message':_0x80b7('0x35')});})[_0x80b7('0x22')](handleError(_0x4fa26a));};exports[_0x80b7('0x36')]=function(_0x485b0a,_0x2a34eb){logger[_0x80b7('0x13')](_0x80b7('0x37'),_0x485b0a[_0x80b7('0x2d')]);var _0x44cfcd=hangupValidation[_0x80b7('0xc')](_0x485b0a['body']);if(_0x44cfcd[_0x80b7('0x2a')]>0x0){return _0x2a34eb['status'](0x190)[_0x80b7('0x2e')](_0x44cfcd);}var _0x1a6e69=_0x485b0a['body']['userId'];var _0x823c32=_0x485b0a['body']['sessionId'];return getAgent(_0x1a6e69)[_0x80b7('0x1e')](function(_0x2f3b26){logger['info'](_0x80b7('0x38'),_0x2f3b26[_0x80b7('0x1c')]);emit(util['format']('user:%s',_0x2f3b26[_0x80b7('0x1c')]),_0x80b7('0x39'),{'sessionId':_0x823c32});return _0x2a34eb[_0x80b7('0x1a')](0xc8)[_0x80b7('0x2e')]({'error':![],'message':_0x80b7('0x3a')});})[_0x80b7('0x22')](handleError(_0x2a34eb));};exports['answer']=function(_0x1c28d2,_0x46f4e9){logger[_0x80b7('0x13')](_0x80b7('0x3b'),_0x1c28d2['body']);var _0x20a9b9=answerValidation['validate'](_0x1c28d2[_0x80b7('0x2d')]);if(_0x20a9b9[_0x80b7('0x2a')]>0x0){return _0x46f4e9[_0x80b7('0x1a')](0x190)[_0x80b7('0x2e')](_0x20a9b9);}var _0x132a0d=_0x1c28d2[_0x80b7('0x2d')][_0x80b7('0x2f')];var _0x39cd2c=_0x1c28d2[_0x80b7('0x2d')][_0x80b7('0x29')];return getAgent(_0x132a0d)[_0x80b7('0x1e')](function(_0x3dfee7){logger[_0x80b7('0x13')]('entityFound:',_0x3dfee7[_0x80b7('0x1c')]);emit(util[_0x80b7('0x3c')]('user:%s',_0x3dfee7[_0x80b7('0x1c')]),'webbar:answer',{'sessionId':_0x39cd2c});return _0x46f4e9['status'](0xc8)[_0x80b7('0x2e')]({'error':![],'message':'answer\x20executed!'});})['catch'](handleError(_0x46f4e9));};exports[_0x80b7('0x3d')]=function(_0x449a90,_0x5ad993){logger[_0x80b7('0x13')](_0x80b7('0x3e'),_0x449a90[_0x80b7('0x2d')]);var _0x5455a5=holdValidation[_0x80b7('0xc')](_0x449a90[_0x80b7('0x2d')]);if(_0x5455a5[_0x80b7('0x2a')]>0x0){return _0x5ad993[_0x80b7('0x1a')](0x190)['json'](_0x5455a5);}var _0x5dcbcd=_0x449a90['body'][_0x80b7('0x2f')];var _0x5c33b5=_0x449a90[_0x80b7('0x2d')][_0x80b7('0x29')];return getAgent(_0x5dcbcd)[_0x80b7('0x1e')](function(_0x44b23d){logger[_0x80b7('0x13')](_0x80b7('0x38'),_0x44b23d['name']);emit(util['format'](_0x80b7('0x33'),_0x44b23d[_0x80b7('0x1c')]),_0x80b7('0x3f'),{'sessionId':_0x5c33b5});return _0x5ad993[_0x80b7('0x1a')](0xc8)[_0x80b7('0x2e')]({'error':![],'message':_0x80b7('0x40')});})['catch'](handleError(_0x5ad993));};exports[_0x80b7('0x41')]=function(_0x36e5a5,_0x47bacb){logger[_0x80b7('0x13')](_0x80b7('0x42'),_0x36e5a5[_0x80b7('0x2d')]);var _0x49ada9=unholdValidation['validate'](_0x36e5a5[_0x80b7('0x2d')]);if(_0x49ada9[_0x80b7('0x2a')]>0x0){return _0x47bacb[_0x80b7('0x1a')](0x190)[_0x80b7('0x2e')](_0x49ada9);}var _0x1b544d=_0x36e5a5[_0x80b7('0x2d')]['userId'];var _0x1b81a2=_0x36e5a5[_0x80b7('0x2d')][_0x80b7('0x29')];return getAgent(_0x1b544d)[_0x80b7('0x1e')](function(_0x2eb688){logger['info']('entityFound:',_0x2eb688[_0x80b7('0x1c')]);emit(util[_0x80b7('0x3c')](_0x80b7('0x33'),_0x2eb688['name']),_0x80b7('0x43'),{'sessionId':_0x1b81a2});return _0x47bacb['status'](0xc8)[_0x80b7('0x2e')]({'error':![],'message':_0x80b7('0x44')});})[_0x80b7('0x22')](handleError(_0x47bacb));};exports[_0x80b7('0x45')]=function(_0x213bd4,_0x3ea23d){logger[_0x80b7('0x13')](_0x80b7('0x46'),_0x3ea23d[_0x80b7('0x2d')]);var _0x4f2588=callsValidation[_0x80b7('0xc')](_0x213bd4[_0x80b7('0x2d')]);if(_0x4f2588[_0x80b7('0x2a')]>0x0){return _0x3ea23d[_0x80b7('0x1a')](0x190)['json'](_0x4f2588);}var _0x42c810=_0x213bd4[_0x80b7('0x2d')][_0x80b7('0x2f')];var _0x41c23c=respondWithRpcPromise(_0x80b7('0x47'));var _0x1c009a=getAgent(_0x42c810);return Promise[_0x80b7('0x25')]([_0x41c23c,_0x1c009a])['then'](function(_0x349e1f){var _0x23f06f=_0x349e1f[0x0];var _0xc4b38=_0x349e1f[0x1];var _0x251b87=_['filter'](_0x23f06f[_0x80b7('0x27')],function(_0x3d7769){return _0x3d7769['UserId']==_0xc4b38['id'];});return _0x3ea23d[_0x80b7('0x1a')](0xc8)[_0x80b7('0x2e')]({'count':_0x251b87['length'],'rows':_0x251b87});})[_0x80b7('0x22')](handleError(_0x3ea23d));};exports[_0x80b7('0x48')]=function(_0x56fd5e,_0x4fe677){logger[_0x80b7('0x13')]('conference\x20fired:',_0x56fd5e[_0x80b7('0x2d')]);var _0x2c2005=conferenceValidation['validate'](_0x56fd5e[_0x80b7('0x2d')]);if(_0x2c2005[_0x80b7('0x2a')]>0x0){return _0x4fe677['status'](0x190)[_0x80b7('0x2e')](_0x2c2005);}var _0x18fe00=_0x56fd5e[_0x80b7('0x2d')][_0x80b7('0x2f')];return getAgent(_0x18fe00)[_0x80b7('0x1e')](function(_0x1b0aba){logger[_0x80b7('0x13')](_0x80b7('0x38'),_0x1b0aba[_0x80b7('0x1c')]);emit(util['format']('user:%s',_0x1b0aba[_0x80b7('0x1c')]),'webbar:conference');return _0x4fe677[_0x80b7('0x1a')](0xc8)[_0x80b7('0x2e')]({'error':![],'message':_0x80b7('0x49')});})['catch'](handleError(_0x4fe677));};exports[_0x80b7('0x4a')]=function(_0x80bf4f,_0x50af8a){logger[_0x80b7('0x13')](_0x80b7('0x4b'),_0x80bf4f[_0x80b7('0x2d')]);var _0x2b6aba=transferValidation['validate'](_0x80bf4f['body']);if(_0x2b6aba[_0x80b7('0x2a')]>0x0){return _0x50af8a[_0x80b7('0x1a')](0x190)[_0x80b7('0x2e')](_0x2b6aba);}var _0x54ec05=_0x80bf4f['body'][_0x80b7('0x2f')];var _0x27452c=_0x80bf4f[_0x80b7('0x2d')]['sessionId'];var _0x33b76f=_0x80bf4f[_0x80b7('0x2d')][_0x80b7('0x4c')];return getAgent(_0x54ec05)[_0x80b7('0x1e')](function(_0x55eba7){logger['info'](_0x80b7('0x38'),_0x55eba7[_0x80b7('0x1c')]);emit(util['format']('user:%s',_0x55eba7['name']),'webbar:transfer',{'sessionId':_0x27452c,'transferNumber':_0x33b76f});return _0x50af8a[_0x80b7('0x1a')](0xc8)['json']({'error':![],'message':'transfer\x20executed!'});})[_0x80b7('0x22')](handleError(_0x50af8a));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index f62e48d..9a7904f 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 _0xfea6=['/:id/users','addAgents','/:id/applications','addApplications','/:id/notify','notify','/:id/send','send','put','/:id','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../config/environment','./whatsappAccount.controller','index','get','isAuthenticated','show','getDispositions','/:id/canned_answers','getAnswers','getAgents','getApplications','post','create','/:id/dispositions','addDisposition','addAnswer'];(function(_0x4574c9,_0x55b83c){var _0x44fa13=function(_0x10c420){while(--_0x10c420){_0x4574c9['push'](_0x4574c9['shift']());}};_0x44fa13(++_0x55b83c);}(_0xfea6,0x1d8));var _0x6fea=function(_0xd023f0,_0x230b29){_0xd023f0=_0xd023f0-0x0;var _0x5c4b8b=_0xfea6[_0xd023f0];return _0x5c4b8b;};'use strict';var multer=require(_0x6fea('0x0'));var util=require(_0x6fea('0x1'));var path=require(_0x6fea('0x2'));var timeout=require(_0x6fea('0x3'));var express=require(_0x6fea('0x4'));var router=express[_0x6fea('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x6fea('0x6'));var controller=require(_0x6fea('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x6fea('0x8')]);router[_0x6fea('0x9')]('/describe',auth[_0x6fea('0xa')](),controller['describe']);router[_0x6fea('0x9')]('/:id',auth[_0x6fea('0xa')](),controller[_0x6fea('0xb')]);router[_0x6fea('0x9')]('/:id/dispositions',auth[_0x6fea('0xa')](),controller[_0x6fea('0xc')]);router['get'](_0x6fea('0xd'),auth[_0x6fea('0xa')](),controller[_0x6fea('0xe')]);router[_0x6fea('0x9')]('/:id/users',auth[_0x6fea('0xa')](),controller[_0x6fea('0xf')]);router[_0x6fea('0x9')]('/:id/applications',auth[_0x6fea('0xa')](),controller[_0x6fea('0x10')]);router[_0x6fea('0x11')]('/',auth[_0x6fea('0xa')](),controller[_0x6fea('0x12')]);router['post'](_0x6fea('0x13'),auth[_0x6fea('0xa')](),controller[_0x6fea('0x14')]);router[_0x6fea('0x11')](_0x6fea('0xd'),auth[_0x6fea('0xa')](),controller[_0x6fea('0x15')]);router[_0x6fea('0x11')](_0x6fea('0x16'),auth['isAuthenticated'](),controller[_0x6fea('0x17')]);router[_0x6fea('0x11')](_0x6fea('0x18'),auth[_0x6fea('0xa')](),controller[_0x6fea('0x19')]);router['post'](_0x6fea('0x1a'),controller[_0x6fea('0x1b')]);router[_0x6fea('0x11')](_0x6fea('0x1c'),auth[_0x6fea('0xa')](),controller[_0x6fea('0x1d')]);router[_0x6fea('0x1e')]('/:id',auth['isAuthenticated'](),controller['update']);router['delete'](_0x6fea('0x1f'),auth[_0x6fea('0xa')](),controller[_0x6fea('0x20')]);router[_0x6fea('0x21')](_0x6fea('0x13'),auth[_0x6fea('0xa')](),controller[_0x6fea('0x22')]);router[_0x6fea('0x21')](_0x6fea('0xd'),auth[_0x6fea('0xa')](),controller[_0x6fea('0x23')]);router[_0x6fea('0x21')](_0x6fea('0x16'),auth[_0x6fea('0xa')](),controller[_0x6fea('0x24')]);module[_0x6fea('0x25')]=router; \ No newline at end of file +var _0x877f=['util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','get','isAuthenticated','index','describe','/:id','show','/:id/dispositions','getDispositions','/:id/users','getAgents','/:id/applications','getApplications','post','addDisposition','/:id/canned_answers','addAnswer','addApplications','/:id/notify','notify','delete','removeAnswers','removeAgents','multer'];(function(_0x3c91a3,_0x497bda){var _0x2d7863=function(_0x26562c){while(--_0x26562c){_0x3c91a3['push'](_0x3c91a3['shift']());}};_0x2d7863(++_0x497bda);}(_0x877f,0x19f));var _0xf877=function(_0x2394b9,_0x4f02cf){_0x2394b9=_0x2394b9-0x0;var _0x245dd8=_0x877f[_0x2394b9];return _0x245dd8;};'use strict';var multer=require(_0xf877('0x0'));var util=require(_0xf877('0x1'));var path=require(_0xf877('0x2'));var timeout=require(_0xf877('0x3'));var express=require(_0xf877('0x4'));var router=express[_0xf877('0x5')]();var fs_extra=require(_0xf877('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xf877('0x7'));var config=require(_0xf877('0x8'));var controller=require(_0xf877('0x9'));router[_0xf877('0xa')]('/',auth[_0xf877('0xb')](),controller[_0xf877('0xc')]);router[_0xf877('0xa')]('/describe',auth[_0xf877('0xb')](),controller[_0xf877('0xd')]);router['get'](_0xf877('0xe'),auth['isAuthenticated'](),controller[_0xf877('0xf')]);router['get'](_0xf877('0x10'),auth[_0xf877('0xb')](),controller[_0xf877('0x11')]);router[_0xf877('0xa')]('/:id/canned_answers',auth['isAuthenticated'](),controller['getAnswers']);router[_0xf877('0xa')](_0xf877('0x12'),auth[_0xf877('0xb')](),controller[_0xf877('0x13')]);router[_0xf877('0xa')](_0xf877('0x14'),auth[_0xf877('0xb')](),controller[_0xf877('0x15')]);router[_0xf877('0x16')]('/',auth[_0xf877('0xb')](),controller['create']);router[_0xf877('0x16')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0xf877('0x17')]);router[_0xf877('0x16')](_0xf877('0x18'),auth[_0xf877('0xb')](),controller[_0xf877('0x19')]);router[_0xf877('0x16')]('/:id/users',auth[_0xf877('0xb')](),controller['addAgents']);router[_0xf877('0x16')](_0xf877('0x14'),auth[_0xf877('0xb')](),controller[_0xf877('0x1a')]);router[_0xf877('0x16')](_0xf877('0x1b'),controller[_0xf877('0x1c')]);router[_0xf877('0x16')]('/:id/send',auth[_0xf877('0xb')](),controller['send']);router['put'](_0xf877('0xe'),auth[_0xf877('0xb')](),controller['update']);router[_0xf877('0x1d')](_0xf877('0xe'),auth[_0xf877('0xb')](),controller['destroy']);router[_0xf877('0x1d')](_0xf877('0x10'),auth[_0xf877('0xb')](),controller['removeDispositions']);router[_0xf877('0x1d')](_0xf877('0x18'),auth[_0xf877('0xb')](),controller[_0xf877('0x1e')]);router['delete'](_0xf877('0x12'),auth[_0xf877('0xb')](),controller[_0xf877('0x1f')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index 11413b5..d187e7f 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 _0x64c4=['randomstring','exports','name','STRING','generate','twilio','sinch','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition'];(function(_0x599124,_0x5d6469){var _0x4abd03=function(_0x38a0fb){while(--_0x38a0fb){_0x599124['push'](_0x599124['shift']());}};_0x4abd03(++_0x5d6469);}(_0x64c4,0xa5));var _0x464c=function(_0x35541c,_0xe6aa01){_0x35541c=_0x35541c-0x0;var _0x2f81d4=_0x64c4[_0x35541c];return _0x2f81d4;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x464c('0x0'));module[_0x464c('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x464c('0x2'),'allowNull':![]},'key':{'type':Sequelize[_0x464c('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0x464c('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0x464c('0x3')],'defaultValue':function(){return rs[_0x464c('0x4')]();}},'phone':{'type':Sequelize[_0x464c('0x3')]},'type':{'type':Sequelize['ENUM'](_0x464c('0x5'),_0x464c('0x6'))},'accountSid':{'type':Sequelize[_0x464c('0x3')]},'baseUrl':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0x464c('0x3')]},'notificationTemplate':{'type':Sequelize[_0x464c('0x7')],'defaultValue':function(){return _0x464c('0x8');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x464c('0x9')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x464c('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x464c('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x464c('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x464c('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x464c('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x464c('0xa')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x464c('0x9')],'defaultValue':![],'comment':_0x464c('0xb'),'set':function(_0x1edc55){if(!_0x1edc55){this['setDataValue'](_0x464c('0xc'),null);}this[_0x464c('0xd')](_0x464c('0xe'),_0x1edc55);}},'description':{'type':Sequelize[_0x464c('0x3')]}}; \ No newline at end of file +var _0x975f=['randomstring','name','STRING','generate','ENUM','sinch','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','sequelize'];(function(_0x2627a4,_0x3e66c0){var _0x2782b0=function(_0x1d469c){while(--_0x1d469c){_0x2627a4['push'](_0x2627a4['shift']());}};_0x2782b0(++_0x3e66c0);}(_0x975f,0x109));var _0xf975=function(_0xc753c8,_0x5627ff){_0xc753c8=_0xc753c8-0x0;var _0xd02f5c=_0x975f[_0xc753c8];return _0xd02f5c;};'use strict';var Sequelize=require(_0xf975('0x0'));var rs=require(_0xf975('0x1'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xf975('0x2'),'allowNull':![]},'key':{'type':Sequelize[_0xf975('0x3')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0xf975('0x3')],'defaultValue':function(){return rs[_0xf975('0x4')]();}},'phone':{'type':Sequelize[_0xf975('0x3')]},'type':{'type':Sequelize[_0xf975('0x5')]('twilio',_0xf975('0x6'))},'accountSid':{'type':Sequelize[_0xf975('0x3')]},'baseUrl':{'type':Sequelize[_0xf975('0x3')]},'authToken':{'type':Sequelize[_0xf975('0x3')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xf975('0x7');}},'notificationSound':{'type':Sequelize[_0xf975('0x8')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0xf975('0x8')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xf975('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xf975('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xf975('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xf975('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xf975('0x9')],'comment':_0xf975('0xa')},'mandatoryDisposition':{'type':Sequelize[_0xf975('0x8')],'defaultValue':![],'comment':_0xf975('0xb'),'set':function(_0x3f70aa){if(!_0x3f70aa){this['setDataValue'](_0xf975('0xc'),null);}this[_0xf975('0xd')]('mandatoryDisposition',_0x3f70aa);}},'description':{'type':Sequelize[_0xf975('0x3')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index 13d24cb..7aa4685 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 _0x8ce3=['messageId','MessageSid','sinch','notifications','ValidationError','from\x20is\x20mandatory','Sequelize','body\x20is\x20mandatory\x20and\x20not\x20empty','isNil','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','CmList','CmContact','Contacts','DESC','contact','WhatsappInteraction','spread','interaction','autoclose','push','close','unmanaged','ContactId','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','queueId','WhatsappQueue','waitForTheAssignedQueue','startRouting','receiveMessage','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','set','Content-Type','text/xml','\x0a','to\x20is\x20mandatory','List','out','Messages','dataValues','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','redis','defaults','socket.io-emitter','./whatsappAccount.socket','register','jayson/promise','client','request','WhatsappAccount,\x20%s,\x20%s','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','reject','save','update','then','destroy','get','WhatsappAccounts','name','send','index','Pause','map','WhatsappAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','show','params','mandatoryDispositionPause','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','Disposition','hasOwnProperty','WhatsappAccountId','include','removeDispositions','ids','addAnswer','CannedAnswer','findOne','removeAnswers','addAgents','omit','userWhatsappAccount:save','removeAgents','isArray','emit','userWhatsappAccount:remove','getAgents','User','addApplications','sequelize','Transaction','ISOLATION_LEVELS','WhatsappApplication','bulkCreate','findAndCountAll','priority','stack','finally','getApplications','notify','whatsapp','Applications','account','statuses','state','read','WhatsappMessage','message_id','applications','no\x20available\x20attributes','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','from','From','whatsapp:','Body'];(function(_0x5d9d13,_0x214efb){var _0x1fff6b=function(_0x1aa75e){while(--_0x1aa75e){_0x5d9d13['push'](_0x5d9d13['shift']());}};_0x1fff6b(++_0x214efb);}(_0x8ce3,0x1b9));var _0x38ce=function(_0x1c413e,_0x51788b){_0x1c413e=_0x1c413e-0x0;var _0x1d8309=_0x8ce3[_0x1c413e];return _0x1d8309;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x38ce('0x0'));var zipdir=require(_0x38ce('0x1'));var jsonpatch=require(_0x38ce('0x2'));var rp=require(_0x38ce('0x3'));var moment=require(_0x38ce('0x4'));var BPromise=require(_0x38ce('0x5'));var Mustache=require('mustache');var util=require(_0x38ce('0x6'));var path=require(_0x38ce('0x7'));var sox=require(_0x38ce('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x38ce('0x9'));var squel=require(_0x38ce('0xa'));var crypto=require(_0x38ce('0xb'));var jsforce=require(_0x38ce('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x38ce('0xd'));var querystring=require(_0x38ce('0xe'));var Papa=require(_0x38ce('0xf'));var Redis=require(_0x38ce('0x10'));var authService=require(_0x38ce('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x38ce('0x12'));var hardwareService=require(_0x38ce('0x13'));var logger=require(_0x38ce('0x14'))(_0x38ce('0x15'));var utils=require(_0x38ce('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x38ce('0x17'));var db=require('../../mysqldb')['db'];config[_0x38ce('0x18')]=_[_0x38ce('0x19')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x38ce('0x1a'))(new Redis(config[_0x38ce('0x18')]));require(_0x38ce('0x1b'))[_0x38ce('0x1c')](socket);var jayson=require(_0x38ce('0x1d'));var client=jayson[_0x38ce('0x1e')]['http']({'port':0x232c});function respondWithRpcPromise(_0x40cef4,_0x143578,_0x2d4333,_0x13b7a2){return new BPromise(function(_0x2f083b,_0x407978){var _0x39f275=_0x13b7a2||client;return _0x39f275[_0x38ce('0x1f')](_0x40cef4,_0x2d4333)['then'](function(_0xcd447f){logger['info'](_0x38ce('0x20'),_0x143578,'request\x20sent');logger[_0x38ce('0x21')](_0x38ce('0x22'),_0x143578,'request\x20sent',JSON[_0x38ce('0x23')](_0xcd447f));if(_0xcd447f['error']){if(_0xcd447f[_0x38ce('0x24')]['code']===0x1f4){logger[_0x38ce('0x24')](_0x38ce('0x20'),_0x143578,_0xcd447f[_0x38ce('0x24')][_0x38ce('0x25')]);return _0x407978(_0xcd447f[_0x38ce('0x24')][_0x38ce('0x25')]);}logger['error'](_0x38ce('0x20'),_0x143578,_0xcd447f[_0x38ce('0x24')][_0x38ce('0x25')]);return _0x2f083b(_0xcd447f[_0x38ce('0x24')]['message']);}else{logger[_0x38ce('0x26')](_0x38ce('0x20'),_0x143578,'request\x20sent');_0x2f083b(_0xcd447f[_0x38ce('0x27')][_0x38ce('0x25')]);}})[_0x38ce('0x28')](function(_0x4d0adf){logger[_0x38ce('0x24')]('WhatsappAccount,\x20%s,\x20%s',_0x143578,_0x4d0adf);_0x407978(_0x4d0adf);});});}function respondWithStatusCode(_0x2d4e34,_0x17078b){_0x17078b=_0x17078b||0xcc;return function(_0x30f97e){if(_0x30f97e){return _0x2d4e34[_0x38ce('0x29')](_0x17078b);}return _0x2d4e34[_0x38ce('0x2a')](_0x17078b)[_0x38ce('0x2b')]();};}function respondWithResult(_0x3c56c7,_0x4bf539){_0x4bf539=_0x4bf539||0xc8;return function(_0x19edf6){if(_0x19edf6){return _0x3c56c7[_0x38ce('0x2a')](_0x4bf539)['json'](_0x19edf6);}};}function respondWithFilteredResult(_0x53d4fe,_0x35a5fb){return function(_0xf29eb2){if(_0xf29eb2){var _0x27bb02=typeof _0x35a5fb[_0x38ce('0x2c')]===_0x38ce('0x2d')&&typeof _0x35a5fb[_0x38ce('0x2e')]===_0x38ce('0x2d');var _0xf5e8b1=_0xf29eb2[_0x38ce('0x2f')];var _0x26eefa=_0x27bb02?0x0:_0x35a5fb[_0x38ce('0x2c')];var _0x536577=_0x27bb02?_0xf29eb2[_0x38ce('0x2f')]:_0x35a5fb['offset']+_0x35a5fb[_0x38ce('0x2e')];var _0x3a5f3b;if(_0x536577>=_0xf5e8b1){_0x536577=_0xf5e8b1;_0x3a5f3b=0xc8;}else{_0x3a5f3b=0xce;}_0x53d4fe[_0x38ce('0x2a')](_0x3a5f3b);return _0x53d4fe['set'](_0x38ce('0x30'),_0x26eefa+'-'+_0x536577+'/'+_0xf5e8b1)[_0x38ce('0x31')](_0xf29eb2);}return null;};}function patchUpdates(_0x331505){return function(_0x3173bc){try{jsonpatch['apply'](_0x3173bc,_0x331505,!![]);}catch(_0x2fb9c3){return BPromise[_0x38ce('0x32')](_0x2fb9c3);}return _0x3173bc[_0x38ce('0x33')]();};}function saveUpdates(_0x26847c,_0x101195){return function(_0x12a2bd){if(_0x12a2bd){return _0x12a2bd[_0x38ce('0x34')](_0x26847c)[_0x38ce('0x35')](function(_0x391bba){return _0x391bba;});}return null;};}function removeEntity(_0x1c5c59,_0x12ff41){return function(_0x219e3a){if(_0x219e3a){return _0x219e3a[_0x38ce('0x36')]()[_0x38ce('0x35')](function(){var _0x35a1b2=_0x219e3a[_0x38ce('0x37')]({'plain':!![]});var _0x493b4e=_0x38ce('0x38');return db['UserProfileResource']['destroy']({'where':{'type':_0x493b4e,'resourceId':_0x35a1b2['id']}})['then'](function(){return _0x219e3a;});})[_0x38ce('0x35')](function(){_0x1c5c59[_0x38ce('0x2a')](0xcc)[_0x38ce('0x2b')]();});}};}function handleEntityNotFound(_0x49bff9,_0x47f7a0){return function(_0x2186f2){if(!_0x2186f2){_0x49bff9[_0x38ce('0x29')](0x194);}return _0x2186f2;};}function handleError(_0x2f8945,_0x1abefc){_0x1abefc=_0x1abefc||0x1f4;return function(_0x27fd83){logger[_0x38ce('0x24')](_0x27fd83['stack']);if(_0x27fd83[_0x38ce('0x39')]){delete _0x27fd83['name'];}_0x2f8945[_0x38ce('0x2a')](_0x1abefc)[_0x38ce('0x3a')](_0x27fd83);};}exports[_0x38ce('0x3b')]=function(_0x3c8d84,_0x3eb16b){var _0x54e1e3={'include':[{'model':db[_0x38ce('0x3c')],'as':'mandatoryDispositionPause'}]},_0x590871={},_0x4173e4={'count':0x0,'rows':[]};var _0x124048=_[_0x38ce('0x3d')](db[_0x38ce('0x3e')][_0x38ce('0x3f')],function(_0x8bb4f7){return{'name':_0x8bb4f7[_0x38ce('0x40')],'type':_0x8bb4f7[_0x38ce('0x41')][_0x38ce('0x42')]};});_0x590871[_0x38ce('0x43')]=_[_0x38ce('0x3d')](_0x124048,_0x38ce('0x39'));_0x590871[_0x38ce('0x44')]=_[_0x38ce('0x45')](_0x3c8d84[_0x38ce('0x44')]);_0x590871[_0x38ce('0x46')]=_[_0x38ce('0x47')](_0x590871[_0x38ce('0x43')],_0x590871[_0x38ce('0x44')]);_0x54e1e3[_0x38ce('0x48')]=_['intersection'](_0x590871['model'],qs['fields'](_0x3c8d84[_0x38ce('0x44')][_0x38ce('0x49')]));_0x54e1e3[_0x38ce('0x48')]=_0x54e1e3['attributes'][_0x38ce('0x4a')]?_0x54e1e3['attributes']:_0x590871['model'];if(!_0x3c8d84[_0x38ce('0x44')]['hasOwnProperty'](_0x38ce('0x4b'))){_0x54e1e3[_0x38ce('0x2e')]=qs[_0x38ce('0x2e')](_0x3c8d84[_0x38ce('0x44')][_0x38ce('0x2e')]);_0x54e1e3[_0x38ce('0x2c')]=qs[_0x38ce('0x2c')](_0x3c8d84[_0x38ce('0x44')]['offset']);}_0x54e1e3[_0x38ce('0x4c')]=qs[_0x38ce('0x4d')](_0x3c8d84[_0x38ce('0x44')][_0x38ce('0x4d')]);_0x54e1e3[_0x38ce('0x4e')]=qs[_0x38ce('0x46')](_[_0x38ce('0x4f')](_0x3c8d84[_0x38ce('0x44')],_0x590871[_0x38ce('0x46')]),_0x124048);if(_0x3c8d84[_0x38ce('0x44')][_0x38ce('0x50')]){_0x54e1e3[_0x38ce('0x4e')]=_[_0x38ce('0x51')](_0x54e1e3[_0x38ce('0x4e')],{'$or':_[_0x38ce('0x3d')](_0x124048,function(_0x2c4b30){if(_0x2c4b30[_0x38ce('0x41')]!==_0x38ce('0x52')){var _0x56445c={};_0x56445c[_0x2c4b30[_0x38ce('0x39')]]={'$like':'%'+_0x3c8d84['query'][_0x38ce('0x50')]+'%'};return _0x56445c;}})});}_0x54e1e3=_[_0x38ce('0x51')]({},_0x54e1e3,_0x3c8d84['options']);var _0x2b4bfc={'where':_0x54e1e3[_0x38ce('0x4e')]};return db['WhatsappAccount'][_0x38ce('0x2f')](_0x2b4bfc)['then'](function(_0x3b8583){_0x4173e4[_0x38ce('0x2f')]=_0x3b8583;if(_0x3c8d84['query'][_0x38ce('0x53')]){_0x54e1e3['include']=[{'all':!![]}];}return db[_0x38ce('0x3e')][_0x38ce('0x54')](_0x54e1e3);})[_0x38ce('0x35')](function(_0x378ff4){_0x4173e4[_0x38ce('0x55')]=_0x378ff4;return _0x4173e4;})[_0x38ce('0x35')](respondWithFilteredResult(_0x3eb16b,_0x54e1e3))[_0x38ce('0x28')](handleError(_0x3eb16b,null));};exports[_0x38ce('0x56')]=function(_0x3db729,_0x1a3d40){var _0x51107a={'raw':![],'where':{'id':_0x3db729[_0x38ce('0x57')]['id']},'include':[{'model':db[_0x38ce('0x3c')],'as':_0x38ce('0x58')}]},_0x15c51c={};_0x15c51c[_0x38ce('0x43')]=_[_0x38ce('0x45')](db['WhatsappAccount']['rawAttributes']);_0x15c51c[_0x38ce('0x44')]=_[_0x38ce('0x45')](_0x3db729[_0x38ce('0x44')]);_0x15c51c[_0x38ce('0x46')]=_['intersection'](_0x15c51c[_0x38ce('0x43')],_0x15c51c['query']);_0x51107a[_0x38ce('0x48')]=_[_0x38ce('0x47')](_0x15c51c['model'],qs[_0x38ce('0x49')](_0x3db729['query'][_0x38ce('0x49')]));_0x51107a[_0x38ce('0x48')]=_0x51107a['attributes'][_0x38ce('0x4a')]?_0x51107a[_0x38ce('0x48')]:_0x15c51c[_0x38ce('0x43')];if(_0x3db729['query']['includeAll']){_0x51107a['include']=[{'all':!![]}];}_0x51107a=_['merge']({},_0x51107a,_0x3db729[_0x38ce('0x59')]);return db[_0x38ce('0x3e')][_0x38ce('0x5a')](_0x51107a)[_0x38ce('0x35')](handleEntityNotFound(_0x1a3d40,null))[_0x38ce('0x35')](respondWithResult(_0x1a3d40,null))['catch'](handleError(_0x1a3d40,null));};exports['create']=function(_0x4e5d68,_0x3636e7){return db[_0x38ce('0x3e')][_0x38ce('0x5b')](_0x4e5d68[_0x38ce('0x5c')],{})[_0x38ce('0x35')](function(_0x57ae75){var _0x49029a=_0x4e5d68[_0x38ce('0x5d')][_0x38ce('0x37')]({'plain':!![]});if(!_0x49029a)throw new Error(_0x38ce('0x5e'));if(_0x49029a['role']===_0x38ce('0x5d')){var _0x45f164=_0x57ae75['get']({'plain':!![]});var _0x2201a3='WhatsappAccounts';return db[_0x38ce('0x5f')]['find']({'where':{'name':_0x2201a3,'userProfileId':_0x49029a[_0x38ce('0x60')]},'raw':!![]})[_0x38ce('0x35')](function(_0x48be6d){if(_0x48be6d&&_0x48be6d[_0x38ce('0x61')]===0x0){return db[_0x38ce('0x62')][_0x38ce('0x5b')]({'name':_0x45f164[_0x38ce('0x39')],'resourceId':_0x45f164['id'],'type':_0x48be6d['name'],'sectionId':_0x48be6d['id']},{})[_0x38ce('0x35')](function(){return _0x57ae75;});}else{return _0x57ae75;}})['catch'](function(_0x3f2d63){logger[_0x38ce('0x24')](_0x38ce('0x63'),_0x3f2d63);throw _0x3f2d63;});}return _0x57ae75;})[_0x38ce('0x35')](respondWithResult(_0x3636e7,0xc9))[_0x38ce('0x28')](handleError(_0x3636e7,null));};exports[_0x38ce('0x34')]=function(_0x323db2,_0x4a3875){if(_0x323db2['body']['id']){delete _0x323db2[_0x38ce('0x5c')]['id'];}return db[_0x38ce('0x3e')][_0x38ce('0x5a')]({'where':{'id':_0x323db2[_0x38ce('0x57')]['id']},'include':[{'model':db[_0x38ce('0x3c')],'as':_0x38ce('0x58')}]})[_0x38ce('0x35')](handleEntityNotFound(_0x4a3875,null))['then'](saveUpdates(_0x323db2['body'],null))[_0x38ce('0x35')](respondWithResult(_0x4a3875,null))[_0x38ce('0x28')](handleError(_0x4a3875,null));};exports['destroy']=function(_0x375ae1,_0x15a155){return db[_0x38ce('0x3e')][_0x38ce('0x5a')]({'where':{'id':_0x375ae1[_0x38ce('0x57')]['id']}})[_0x38ce('0x35')](handleEntityNotFound(_0x15a155,null))[_0x38ce('0x35')](removeEntity(_0x15a155,null))[_0x38ce('0x28')](handleError(_0x15a155,null));};exports[_0x38ce('0x64')]=function(_0x1dc869,_0x578279){return db['WhatsappAccount'][_0x38ce('0x64')]()[_0x38ce('0x35')](respondWithResult(_0x578279,null))[_0x38ce('0x28')](handleError(_0x578279,null));};exports[_0x38ce('0x65')]=function(_0x4959cd,_0x199615,_0x4392dc){if(_0x4959cd[_0x38ce('0x5c')]['id']){delete _0x4959cd[_0x38ce('0x5c')]['id'];}return db['WhatsappAccount'][_0x38ce('0x5a')]({'where':{'id':_0x4959cd['params']['id']}})[_0x38ce('0x35')](handleEntityNotFound(_0x199615,null))['then'](function(_0x4f93dd){if(_0x4f93dd){_0x4959cd['body']['WhatsappAccountId']=_0x4f93dd['id'];return db[_0x38ce('0x66')][_0x38ce('0x5b')](_0x4959cd[_0x38ce('0x5c')]);}})[_0x38ce('0x35')](respondWithResult(_0x199615,null))[_0x38ce('0x28')](handleError(_0x199615,null));};exports['getDispositions']=function(_0x3d44d1,_0x43d217,_0x4e54ab){var _0xd7e25e={'raw':![],'where':{}};var _0x58c38a={};var _0x540fba={'count':0x0,'rows':[]};return db[_0x38ce('0x3e')]['findOne']({'where':{'id':_0x3d44d1['params']['id']}})[_0x38ce('0x35')](handleEntityNotFound(_0x43d217,null))[_0x38ce('0x35')](function(_0x4ee973){if(_0x4ee973){_0x58c38a[_0x38ce('0x43')]=_['keys'](db[_0x38ce('0x66')][_0x38ce('0x3f')]);_0x58c38a[_0x38ce('0x44')]=_[_0x38ce('0x45')](_0x3d44d1[_0x38ce('0x44')]);_0x58c38a[_0x38ce('0x46')]=_[_0x38ce('0x47')](_0x58c38a[_0x38ce('0x43')],_0x58c38a[_0x38ce('0x44')]);_0xd7e25e[_0x38ce('0x48')]=_[_0x38ce('0x47')](_0x58c38a[_0x38ce('0x43')],qs[_0x38ce('0x49')](_0x3d44d1[_0x38ce('0x44')][_0x38ce('0x49')]));_0xd7e25e[_0x38ce('0x48')]=_0xd7e25e['attributes'][_0x38ce('0x4a')]?_0xd7e25e['attributes']:_0x58c38a['model'];if(!_0x3d44d1[_0x38ce('0x44')][_0x38ce('0x67')]('nolimit')){_0xd7e25e['limit']=qs['limit'](_0x3d44d1[_0x38ce('0x44')]['limit']);_0xd7e25e[_0x38ce('0x2c')]=qs['offset'](_0x3d44d1['query']['offset']);}_0xd7e25e[_0x38ce('0x4c')]=qs[_0x38ce('0x4d')](_0x3d44d1[_0x38ce('0x44')]['sort']);_0xd7e25e[_0x38ce('0x4e')]=qs[_0x38ce('0x46')](_[_0x38ce('0x4f')](_0x3d44d1[_0x38ce('0x44')],_0x58c38a[_0x38ce('0x46')]));_0xd7e25e[_0x38ce('0x4e')][_0x38ce('0x68')]=_0x4ee973['id'];if(_0x3d44d1[_0x38ce('0x44')]['filter']){_0xd7e25e[_0x38ce('0x4e')]=_[_0x38ce('0x51')](_0xd7e25e['where'],{'$or':_['map'](_0xd7e25e[_0x38ce('0x48')],function(_0x3dc5bf){var _0x1b977e={};_0x1b977e[_0x3dc5bf]={'$like':'%'+_0x3d44d1['query'][_0x38ce('0x50')]+'%'};return _0x1b977e;})});}_0xd7e25e=_[_0x38ce('0x51')]({},_0xd7e25e,_0x3d44d1[_0x38ce('0x59')]);return db[_0x38ce('0x66')][_0x38ce('0x2f')]({'where':_0xd7e25e[_0x38ce('0x4e')]})[_0x38ce('0x35')](function(_0x4617c3){_0x540fba[_0x38ce('0x2f')]=_0x4617c3;if(_0x3d44d1['query'][_0x38ce('0x53')]){_0xd7e25e[_0x38ce('0x69')]=[{'all':!![]}];}return db[_0x38ce('0x66')][_0x38ce('0x54')](_0xd7e25e);})['then'](function(_0x47e078){_0x540fba['rows']=_0x47e078;return _0x540fba;});}})['then'](respondWithFilteredResult(_0x43d217,_0xd7e25e))['catch'](handleError(_0x43d217,null));};exports[_0x38ce('0x6a')]=function(_0x4300a3,_0x17196e,_0x464817){return db[_0x38ce('0x3e')]['find']({'where':{'id':_0x4300a3['params']['id']}})[_0x38ce('0x35')](handleEntityNotFound(_0x17196e,null))[_0x38ce('0x35')](function(_0x4c8b17){if(_0x4c8b17){return _0x4c8b17[_0x38ce('0x6a')](_0x4300a3['query'][_0x38ce('0x6b')]);}})[_0x38ce('0x35')](respondWithStatusCode(_0x17196e,null))[_0x38ce('0x28')](handleError(_0x17196e,null));};exports[_0x38ce('0x6c')]=function(_0x108ba3,_0x1d529b,_0xf5d9b1){if(_0x108ba3[_0x38ce('0x5c')]['id']){delete _0x108ba3[_0x38ce('0x5c')]['id'];}return db[_0x38ce('0x3e')][_0x38ce('0x5a')]({'where':{'id':_0x108ba3[_0x38ce('0x57')]['id']}})[_0x38ce('0x35')](handleEntityNotFound(_0x1d529b,null))[_0x38ce('0x35')](function(_0x30f557){if(_0x30f557){_0x108ba3['body'][_0x38ce('0x68')]=_0x30f557['id'];return db[_0x38ce('0x6d')][_0x38ce('0x5b')](_0x108ba3[_0x38ce('0x5c')]);}})[_0x38ce('0x35')](respondWithResult(_0x1d529b,null))[_0x38ce('0x28')](handleError(_0x1d529b,null));};exports['getAnswers']=function(_0x3c637f,_0x4bff3c,_0x2def08){var _0x10e57e={'raw':![],'where':{}};var _0x27a0e5={};var _0x138a69={'count':0x0,'rows':[]};return db[_0x38ce('0x3e')][_0x38ce('0x6e')]({'where':{'id':_0x3c637f['params']['id']}})[_0x38ce('0x35')](handleEntityNotFound(_0x4bff3c,null))['then'](function(_0x3a8355){if(_0x3a8355){_0x27a0e5[_0x38ce('0x43')]=_[_0x38ce('0x45')](db[_0x38ce('0x6d')]['rawAttributes']);_0x27a0e5[_0x38ce('0x44')]=_[_0x38ce('0x45')](_0x3c637f['query']);_0x27a0e5['filters']=_[_0x38ce('0x47')](_0x27a0e5[_0x38ce('0x43')],_0x27a0e5[_0x38ce('0x44')]);_0x10e57e[_0x38ce('0x48')]=_['intersection'](_0x27a0e5[_0x38ce('0x43')],qs[_0x38ce('0x49')](_0x3c637f[_0x38ce('0x44')]['fields']));_0x10e57e[_0x38ce('0x48')]=_0x10e57e[_0x38ce('0x48')]['length']?_0x10e57e[_0x38ce('0x48')]:_0x27a0e5[_0x38ce('0x43')];if(!_0x3c637f['query'][_0x38ce('0x67')](_0x38ce('0x4b'))){_0x10e57e[_0x38ce('0x2e')]=qs[_0x38ce('0x2e')](_0x3c637f[_0x38ce('0x44')]['limit']);_0x10e57e[_0x38ce('0x2c')]=qs[_0x38ce('0x2c')](_0x3c637f[_0x38ce('0x44')][_0x38ce('0x2c')]);}_0x10e57e['order']=qs[_0x38ce('0x4d')](_0x3c637f[_0x38ce('0x44')][_0x38ce('0x4d')]);_0x10e57e[_0x38ce('0x4e')]=qs[_0x38ce('0x46')](_['pick'](_0x3c637f['query'],_0x27a0e5[_0x38ce('0x46')]));_0x10e57e[_0x38ce('0x4e')][_0x38ce('0x68')]=_0x3a8355['id'];if(_0x3c637f[_0x38ce('0x44')]['filter']){_0x10e57e['where']=_[_0x38ce('0x51')](_0x10e57e[_0x38ce('0x4e')],{'$or':_[_0x38ce('0x3d')](_0x10e57e[_0x38ce('0x48')],function(_0x516f37){var _0x39763b={};_0x39763b[_0x516f37]={'$like':'%'+_0x3c637f[_0x38ce('0x44')]['filter']+'%'};return _0x39763b;})});}_0x10e57e=_['merge']({},_0x10e57e,_0x3c637f['options']);return db[_0x38ce('0x6d')][_0x38ce('0x2f')]({'where':_0x10e57e['where']})[_0x38ce('0x35')](function(_0x5753f1){_0x138a69[_0x38ce('0x2f')]=_0x5753f1;if(_0x3c637f['query'][_0x38ce('0x53')]){_0x10e57e['include']=[{'all':!![]}];}return db[_0x38ce('0x6d')][_0x38ce('0x54')](_0x10e57e);})[_0x38ce('0x35')](function(_0x4db79c){_0x138a69[_0x38ce('0x55')]=_0x4db79c;return _0x138a69;});}})['then'](respondWithFilteredResult(_0x4bff3c,_0x10e57e))[_0x38ce('0x28')](handleError(_0x4bff3c,null));};exports[_0x38ce('0x6f')]=function(_0x368ee5,_0x21ffaa,_0x1b4ca0){return db[_0x38ce('0x3e')][_0x38ce('0x5a')]({'where':{'id':_0x368ee5[_0x38ce('0x57')]['id']}})[_0x38ce('0x35')](handleEntityNotFound(_0x21ffaa,null))[_0x38ce('0x35')](function(_0x50b7f3){if(_0x50b7f3){return _0x50b7f3[_0x38ce('0x6f')](_0x368ee5[_0x38ce('0x44')][_0x38ce('0x6b')]);}})[_0x38ce('0x35')](respondWithStatusCode(_0x21ffaa,null))[_0x38ce('0x28')](handleError(_0x21ffaa,null));};exports[_0x38ce('0x70')]=function(_0x556acc,_0x576c1e,_0x302db5){return db['WhatsappAccount'][_0x38ce('0x5a')]({'where':{'id':_0x556acc['params']['id']}})['then'](handleEntityNotFound(_0x576c1e,null))[_0x38ce('0x35')](function(_0x330f04){if(_0x330f04){return _0x330f04[_0x38ce('0x70')](_0x556acc['body'][_0x38ce('0x6b')],_[_0x38ce('0x71')](_0x556acc['body'],[_0x38ce('0x6b'),'id'])||{})['spread'](function(_0x1e201d){for(var _0x4b3e97=0x0;_0x4b3e97<_0x556acc[_0x38ce('0x5c')][_0x38ce('0x6b')][_0x38ce('0x4a')];_0x4b3e97+=0x1){socket['emit'](_0x38ce('0x72'),{'UserId':Number(_0x556acc['body'][_0x38ce('0x6b')][_0x4b3e97]),'WhatsappAccountId':Number(_0x556acc[_0x38ce('0x57')]['id'])});}return _0x1e201d;});}})[_0x38ce('0x35')](respondWithResult(_0x576c1e,null))['catch'](handleError(_0x576c1e,null));};exports[_0x38ce('0x73')]=function(_0x2dbb7e,_0x37f191,_0x39f9a0){return db['WhatsappAccount']['find']({'where':{'id':_0x2dbb7e['params']['id']}})[_0x38ce('0x35')](handleEntityNotFound(_0x37f191,null))[_0x38ce('0x35')](function(_0x4325e8){if(_0x4325e8){return _0x4325e8[_0x38ce('0x73')](_0x2dbb7e[_0x38ce('0x44')][_0x38ce('0x6b')])[_0x38ce('0x35')](function(){if(_[_0x38ce('0x74')](_0x2dbb7e[_0x38ce('0x44')][_0x38ce('0x6b')])){for(var _0x514234=0x0;_0x514234<_0x2dbb7e[_0x38ce('0x44')][_0x38ce('0x6b')]['length'];_0x514234+=0x1){socket[_0x38ce('0x75')](_0x38ce('0x76'),{'UserId':Number(_0x2dbb7e[_0x38ce('0x44')][_0x38ce('0x6b')][_0x514234]),'WhatsappAccountId':Number(_0x2dbb7e[_0x38ce('0x57')]['id'])});}}else{socket['emit'](_0x38ce('0x76'),{'UserId':Number(_0x2dbb7e['query'][_0x38ce('0x6b')]),'WhatsappAccountId':Number(_0x2dbb7e[_0x38ce('0x57')]['id'])});}});}})['then'](respondWithStatusCode(_0x37f191,null))[_0x38ce('0x28')](handleError(_0x37f191,null));};exports[_0x38ce('0x77')]=function(_0xad7f00,_0x184213,_0x158bbe){var _0x22c48d={};var _0x4e3cd9={};var _0x3b7465;var _0x4100f0;return db[_0x38ce('0x3e')][_0x38ce('0x6e')]({'where':{'id':_0xad7f00[_0x38ce('0x57')]['id']}})[_0x38ce('0x35')](handleEntityNotFound(_0x184213,null))[_0x38ce('0x35')](function(_0x467fc9){if(_0x467fc9){_0x3b7465=_0x467fc9;_0x4e3cd9[_0x38ce('0x43')]=_[_0x38ce('0x45')](db[_0x38ce('0x78')][_0x38ce('0x3f')]);_0x4e3cd9[_0x38ce('0x44')]=_[_0x38ce('0x45')](_0xad7f00['query']);_0x4e3cd9[_0x38ce('0x46')]=_[_0x38ce('0x47')](_0x4e3cd9[_0x38ce('0x43')],_0x4e3cd9[_0x38ce('0x44')]);_0x22c48d[_0x38ce('0x48')]=_[_0x38ce('0x47')](_0x4e3cd9[_0x38ce('0x43')],qs['fields'](_0xad7f00[_0x38ce('0x44')][_0x38ce('0x49')]));_0x22c48d[_0x38ce('0x48')]=_0x22c48d[_0x38ce('0x48')][_0x38ce('0x4a')]?_0x22c48d[_0x38ce('0x48')]:_0x4e3cd9['model'];_0x22c48d[_0x38ce('0x4c')]=qs['sort'](_0xad7f00[_0x38ce('0x44')][_0x38ce('0x4d')]);_0x22c48d[_0x38ce('0x4e')]=qs[_0x38ce('0x46')](_[_0x38ce('0x4f')](_0xad7f00[_0x38ce('0x44')],_0x4e3cd9[_0x38ce('0x46')]));if(_0xad7f00[_0x38ce('0x44')]['filter']){_0x22c48d['where']=_[_0x38ce('0x51')](_0x22c48d[_0x38ce('0x4e')],{'$or':_[_0x38ce('0x3d')](_0x22c48d[_0x38ce('0x48')],function(_0x2bba79){var _0x55d1f4={};_0x55d1f4[_0x2bba79]={'$like':'%'+_0xad7f00['query']['filter']+'%'};return _0x55d1f4;})});}_0x22c48d=_[_0x38ce('0x51')]({},_0x22c48d,_0xad7f00[_0x38ce('0x59')]);return _0x3b7465[_0x38ce('0x77')](_0x22c48d);}})['then'](function(_0xf178a5){if(_0xf178a5){_0x4100f0=_0xf178a5[_0x38ce('0x4a')];if(!_0xad7f00[_0x38ce('0x44')]['hasOwnProperty'](_0x38ce('0x4b'))){_0x22c48d[_0x38ce('0x2e')]=qs[_0x38ce('0x2e')](_0xad7f00[_0x38ce('0x44')][_0x38ce('0x2e')]);_0x22c48d[_0x38ce('0x2c')]=qs['offset'](_0xad7f00[_0x38ce('0x44')][_0x38ce('0x2c')]);}return _0x3b7465['getAgents'](_0x22c48d);}})[_0x38ce('0x35')](function(_0x258028){if(_0x258028){return _0x258028?{'count':_0x4100f0,'rows':_0x258028}:null;}})[_0x38ce('0x35')](respondWithResult(_0x184213,null))[_0x38ce('0x28')](handleError(_0x184213,null));};exports[_0x38ce('0x79')]=function(_0x4b6458,_0x3b3e87){var _0x28c0b9=_0x4b6458[_0x38ce('0x57')]['id'];var _0x209f02=_0x4b6458[_0x38ce('0x5c')];var _0x1f443d=0xc8;var _0x475b00=null;return db[_0x38ce('0x7a')]['transaction']({'isolationLevel':db[_0x38ce('0x7a')][_0x38ce('0x7b')][_0x38ce('0x7c')]['READ_COMMITTED']},function(_0x2e11fa){return db['WhatsappAccount'][_0x38ce('0x6e')]({'where':{'id':_0x28c0b9},'transaction':_0x2e11fa})['then'](function(_0x2faeac){if(_0x2faeac){return db[_0x38ce('0x7d')][_0x38ce('0x36')]({'where':{'WhatsappAccountId':_0x28c0b9},'transaction':_0x2e11fa})[_0x38ce('0x35')](function(){var _0x3a99d3=_[_0x38ce('0x3d')](_0x209f02,function(_0x20c678){_0x20c678['WhatsappAccountId']=_0x28c0b9;return _0x20c678;});return db[_0x38ce('0x7d')][_0x38ce('0x7e')](_0x3a99d3,{'transaction':_0x2e11fa});});}else{_0x1f443d=0x194;_0x475b00=[];}});})['then'](function(){if(_0x1f443d!==0x194){return db['WhatsappApplication'][_0x38ce('0x7f')]({'where':{'WhatsappAccountId':_0x28c0b9},'order':_0x38ce('0x80')})[_0x38ce('0x35')](function(_0x335267){_0x475b00=_0x335267;});}})['catch'](function(_0x6ebda1){_0x1f443d=0x1f4;logger[_0x38ce('0x24')](_0x6ebda1[_0x38ce('0x81')]);if(_0x6ebda1[_0x38ce('0x39')]){delete _0x6ebda1[_0x38ce('0x39')];}_0x475b00=_0x6ebda1;})[_0x38ce('0x82')](function(){if(_0x475b00===null){_0x3b3e87['sendStatus'](_0x1f443d);}else{if(_0x1f443d===0x1f4){_0x3b3e87['status'](_0x1f443d)[_0x38ce('0x3a')](_0x475b00);}else{_0x3b3e87[_0x38ce('0x2a')](_0x1f443d)[_0x38ce('0x31')](_0x475b00);}}});};exports['getApplications']=function(_0x2f551d,_0x3a0c03,_0x18fddb){var _0x3dc890={};var _0x575b6a={};var _0x5f4c2e;var _0x79b595;return db[_0x38ce('0x3e')][_0x38ce('0x6e')]({'where':{'id':_0x2f551d[_0x38ce('0x57')]['id']}})[_0x38ce('0x35')](handleEntityNotFound(_0x3a0c03,null))[_0x38ce('0x35')](function(_0x19ab74){if(_0x19ab74){_0x5f4c2e=_0x19ab74;_0x575b6a[_0x38ce('0x43')]=_[_0x38ce('0x45')](db[_0x38ce('0x7d')][_0x38ce('0x3f')]);_0x575b6a[_0x38ce('0x44')]=_[_0x38ce('0x45')](_0x2f551d[_0x38ce('0x44')]);_0x575b6a['filters']=_[_0x38ce('0x47')](_0x575b6a[_0x38ce('0x43')],_0x575b6a[_0x38ce('0x44')]);_0x3dc890['attributes']=_[_0x38ce('0x47')](_0x575b6a[_0x38ce('0x43')],qs[_0x38ce('0x49')](_0x2f551d[_0x38ce('0x44')][_0x38ce('0x49')]));_0x3dc890[_0x38ce('0x48')]=_0x3dc890[_0x38ce('0x48')][_0x38ce('0x4a')]?_0x3dc890[_0x38ce('0x48')]:_0x575b6a[_0x38ce('0x43')];_0x3dc890[_0x38ce('0x4c')]=qs[_0x38ce('0x4d')](_0x2f551d[_0x38ce('0x44')][_0x38ce('0x4d')]);_0x3dc890[_0x38ce('0x4e')]=qs[_0x38ce('0x46')](_[_0x38ce('0x4f')](_0x2f551d['query'],_0x575b6a[_0x38ce('0x46')]));if(_0x2f551d[_0x38ce('0x44')]['filter']){_0x3dc890[_0x38ce('0x4e')]=_['merge'](_0x3dc890['where'],{'$or':_[_0x38ce('0x3d')](_0x3dc890[_0x38ce('0x48')],function(_0x483af9){var _0x12304f={};_0x12304f[_0x483af9]={'$like':'%'+_0x2f551d[_0x38ce('0x44')]['filter']+'%'};return _0x12304f;})});}_0x3dc890=_['merge']({},_0x3dc890,_0x2f551d['options']);return _0x5f4c2e[_0x38ce('0x83')](_0x3dc890);}})[_0x38ce('0x35')](function(_0x709199){if(_0x709199){_0x79b595=_0x709199['length'];if(!_0x2f551d[_0x38ce('0x44')][_0x38ce('0x67')](_0x38ce('0x4b'))){_0x3dc890[_0x38ce('0x2e')]=qs[_0x38ce('0x2e')](_0x2f551d[_0x38ce('0x44')]['limit']);_0x3dc890[_0x38ce('0x2c')]=qs[_0x38ce('0x2c')](_0x2f551d[_0x38ce('0x44')][_0x38ce('0x2c')]);}return _0x5f4c2e[_0x38ce('0x83')](_0x3dc890);}})['then'](function(_0x958f77){if(_0x958f77){return _0x958f77?{'count':_0x79b595,'rows':_0x958f77}:null;}})[_0x38ce('0x35')](respondWithResult(_0x3a0c03,null))[_0x38ce('0x28')](handleError(_0x3a0c03,null));};exports[_0x38ce('0x84')]=function(_0x11e002,_0x56053c,_0x1bb899){var _0xcc0be6={'channel':_0x38ce('0x85')};var _0x53b4fd=[];var _0x3c0945=[];var _0x4117ed={};return db[_0x38ce('0x3e')]['find']({'where':{'id':_0x11e002[_0x38ce('0x57')]['id']},'include':[{'model':db[_0x38ce('0x7d')],'as':_0x38ce('0x86')}]})[_0x38ce('0x35')](handleEntityNotFound(_0x56053c,null))[_0x38ce('0x35')](function(_0x1e23ea){_0xcc0be6[_0x38ce('0x87')]=_0x1e23ea;if(_0xcc0be6[_0x38ce('0x87')]&&_0xcc0be6['account']['type']==='sinch'&&_0x11e002[_0x38ce('0x5c')][_0x38ce('0x88')]){if(_0x11e002[_0x38ce('0x5c')][_0x38ce('0x88')]['length']===0x0)return;if(_0x11e002[_0x38ce('0x5c')][_0x38ce('0x88')][0x0][_0x38ce('0x89')]!==_0x38ce('0x8a'))return;return db[_0x38ce('0x8b')][_0x38ce('0x34')]({'read':!![],'readAt':_0x11e002['body'][_0x38ce('0x88')][0x0]['timestamp']},{'where':{'messageId':_0x11e002[_0x38ce('0x5c')]['statuses'][0x0][_0x38ce('0x8c')]},'individualHooks':!![]})[_0x38ce('0x35')](function(_0x5c51c9){return _0x56053c['status'](0xc8)[_0x38ce('0x31')](_0x5c51c9);});}_0xcc0be6[_0x38ce('0x8d')]=_['orderBy'](_0x1e23ea['Applications'],[_0x38ce('0x80')],['asc']);if(_0xcc0be6[_0x38ce('0x87')][_0x38ce('0x86')]){delete _0xcc0be6[_0x38ce('0x87')][_0x38ce('0x86')];}return db['CmContact'][_0x38ce('0x64')]()['then'](function(_0x2509d8){if(!_0x2509d8){throw new db['Sequelize']['ValidationError'](_0x38ce('0x8e'));}_0x53b4fd=_['difference'](_[_0x38ce('0x45')](_0x2509d8),[_0x38ce('0x8f'),_0x38ce('0x90')]);_0x3c0945=_['difference'](_[_0x38ce('0x45')](_0x2509d8),[_0x38ce('0x8f'),'updatedAt',_0x38ce('0x91'),_0x38ce('0x92')]);_0xcc0be6[_0x38ce('0x5c')]={'mapKey':_0x38ce('0x93')};if(_0xcc0be6[_0x38ce('0x87')]&&_0xcc0be6[_0x38ce('0x87')][_0x38ce('0x41')]===_0x38ce('0x94')){_0xcc0be6[_0x38ce('0x5c')][_0x38ce('0x95')]=_0x11e002['body'][_0x38ce('0x96')]['replace'](_0x38ce('0x97'),'');_0xcc0be6[_0x38ce('0x5c')][_0x38ce('0x5c')]=_0x11e002[_0x38ce('0x5c')][_0x38ce('0x98')];_0xcc0be6[_0x38ce('0x5c')][_0x38ce('0x99')]=_0x11e002['body'][_0x38ce('0x9a')];}if(_0xcc0be6['account']&&_0xcc0be6[_0x38ce('0x87')][_0x38ce('0x41')]===_0x38ce('0x9b')){_0xcc0be6[_0x38ce('0x5c')][_0x38ce('0x95')]=_0x11e002[_0x38ce('0x5c')][_0x38ce('0x9c')][0x0][_0x38ce('0x95')];_0xcc0be6[_0x38ce('0x5c')]['body']=_0x11e002[_0x38ce('0x5c')][_0x38ce('0x9c')][0x0]['message'][_0x38ce('0x5c')];_0xcc0be6[_0x38ce('0x5c')]['messageId']=_0x11e002[_0x38ce('0x5c')]['notifications'][0x0][_0x38ce('0x8c')];}if(_0xcc0be6[_0x38ce('0x5c')]['id']){delete _0xcc0be6['body']['id'];}if(_['isNil'](_0xcc0be6[_0x38ce('0x5c')][_0x38ce('0x95')])){throw new db['Sequelize'][(_0x38ce('0x9d'))](_0x38ce('0x9e'));}if(_['isNil'](_0xcc0be6[_0x38ce('0x5c')][_0x38ce('0x5c')])||_0xcc0be6['body'][_0x38ce('0x5c')]===''){throw new db[(_0x38ce('0x9f'))][(_0x38ce('0x9d'))](_0x38ce('0xa0'));}if(_[_0x38ce('0xa1')](_0xcc0be6[_0x38ce('0x5c')]['mapKey'])){throw new db[(_0x38ce('0x9f'))]['ValidationError'](_0x38ce('0xa2')+_0x3c0945);}if(!_['includes'](_0x3c0945,_0xcc0be6[_0x38ce('0x5c')][_0x38ce('0xa3')])){throw new db[(_0x38ce('0x9f'))][(_0x38ce('0x9d'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x3c0945);}_0x4117ed[_0xcc0be6['body'][_0x38ce('0xa3')]]=_0xcc0be6[_0x38ce('0x5c')][_0x38ce('0x95')];return db[_0x38ce('0xa4')]['find']({'where':{'id':_0xcc0be6['account'][_0x38ce('0x92')]},'include':[{'model':db[_0x38ce('0xa5')],'as':_0x38ce('0xa6'),'where':_0x4117ed,'limit':0x1,'order':[[_0x38ce('0x90'),_0x38ce('0xa7')]]}]});})['then'](handleEntityNotFound(_0x56053c,null))[_0x38ce('0x35')](function(_0x50a3b8){if(_0x50a3b8){_0xcc0be6['list']=_['omit'](_0x50a3b8,['Contacts']);if(_0x50a3b8[_0x38ce('0xa6')][_0x38ce('0x4a')]){return _0x50a3b8[_0x38ce('0xa6')][0x0];}var _0x7d600b=_[_0x38ce('0x19')](_0xcc0be6['body'],{'firstName':_0xcc0be6[_0x38ce('0x5c')][_0x38ce('0x95')],'ListId':_0x50a3b8['id']});_0x7d600b[_0xcc0be6['body'][_0x38ce('0xa3')]]=_0xcc0be6['body'][_0x38ce('0x95')];return db[_0x38ce('0xa5')][_0x38ce('0x5b')](_0x7d600b,{'fields':_0x53b4fd,'raw':!![]});}})['then'](handleEntityNotFound(_0x56053c,null))['then'](function(_0x2512db){if(_0x2512db){_0xcc0be6[_0x38ce('0xa8')]=_0x2512db;var _0xd39b65={'ContactId':_0x2512db['id'],'phone':_0xcc0be6[_0x38ce('0x5c')][_0x38ce('0x95')],'WhatsappAccountId':_0x11e002['params']['id']};var _0x419c22={'ContactId':_0x2512db['id'],'WhatsappAccountId':_0x11e002[_0x38ce('0x57')]['id'],'closed':![]};return db['WhatsappInteraction'][_0x38ce('0x5a')]({'where':_0x419c22})[_0x38ce('0x35')](function(_0x417e90){if(_0x417e90){return[_0x417e90,![]];}return db[_0x38ce('0xa9')][_0x38ce('0x5b')](_0xd39b65)['then'](function(_0x28244a){return[_0x28244a,!![]];});});}})[_0x38ce('0xaa')](function(_0x2332fc,_0x4c98a4){_0xcc0be6[_0x38ce('0xab')]=_0x2332fc[_0x38ce('0x37')]({'plain':!![]});_0xcc0be6['interaction']['created']=![];if(_0x4c98a4){if(_0xcc0be6[_0x38ce('0x87')][_0x38ce('0xac')]){_0xcc0be6['applications'][_0x38ce('0xad')]({'id':0x0,'priority':_0xcc0be6[_0x38ce('0x8d')][_0x38ce('0x4a')]+0x1,'app':_0x38ce('0xae'),'appdata':_0x38ce('0xaf'),'interval':'*,*,*,*'});}_0xcc0be6[_0x38ce('0xab')]['created']=!![];}return db[_0x38ce('0x8b')][_0x38ce('0x5b')]({'phone':_0xcc0be6[_0x38ce('0x5c')][_0x38ce('0x95')],'messageId':_0xcc0be6[_0x38ce('0x5c')][_0x38ce('0x99')],'body':_0xcc0be6[_0x38ce('0x5c')][_0x38ce('0x5c')],'WhatsappAccountId':_0x11e002['params']['id'],'WhatsappInteractionId':_0x2332fc['id'],'direction':'in','ContactId':_0x2332fc[_0x38ce('0xb0')],'AttachmentId':_0xcc0be6[_0x38ce('0x5c')][_0x38ce('0xb1')]});})[_0x38ce('0x35')](function(_0x197a2e){_0xcc0be6['message']=_0x197a2e;if(!_0xcc0be6[_0x38ce('0xab')]['UserId'])return;return db['User'][_0x38ce('0x5a')]({'attributes':['id',_0x38ce('0x39')],'where':{'id':_0xcc0be6[_0x38ce('0xab')][_0x38ce('0xb2')]}});})[_0x38ce('0x35')](function(_0x359711){if(_0x359711){_0xcc0be6[_0x38ce('0x8d')][_0x38ce('0xb3')]({'id':0x0,'priority':0x0,'app':_0x38ce('0xb4'),'appdata':_0x359711['name']+','+(_0xcc0be6[_0x38ce('0x87')][_0x38ce('0xb5')]||0xa),'interval':'*,*,*,*'});}if(!_0xcc0be6['interaction'][_0x38ce('0xb6')])return;return db[_0x38ce('0xb7')]['find']({'attributes':['id',_0x38ce('0x39')],'where':{'id':_0xcc0be6[_0x38ce('0xab')][_0x38ce('0xb6')]}});})['then'](function(_0x4a3a71){if(_0x4a3a71){_0xcc0be6[_0x38ce('0x8d')]['unshift']({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x4a3a71[_0x38ce('0x39')]+','+(_0xcc0be6[_0x38ce('0x87')][_0x38ce('0xb8')]||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise('Start',_0x38ce('0xb9'),_0xcc0be6);})['then'](function(_0x11072e){if(_0x11072e){var _0x3a8438=0xc8;var _0x317222=_0x38ce('0xba');logger[_0x38ce('0x26')](_0x38ce('0x22'),_0x317222,_0x3a8438,_0x38ce('0xbb'));logger[_0x38ce('0x21')](_0x38ce('0xbc'),_0x317222,_0x3a8438,_0x38ce('0xbb'),JSON[_0x38ce('0x23')](_0x11072e));if(_0xcc0be6[_0x38ce('0x87')][_0x38ce('0x41')]===_0x38ce('0x94')){return _0x56053c[_0x38ce('0x2a')](_0x3a8438)[_0x38ce('0xbd')](_0x38ce('0xbe'),_0x38ce('0xbf'))[_0x38ce('0x3a')](_0x38ce('0xc0'));}else{return _0x56053c[_0x38ce('0x2a')](_0x3a8438)[_0x38ce('0x31')](_0x11072e);}}});})[_0x38ce('0x28')](handleError(_0x56053c,null));};exports[_0x38ce('0x3a')]=function(_0x4dd9df,_0x22a91d,_0x126a48){var _0x12387d,_0x14d640,_0x47d3ae;if(_[_0x38ce('0xa1')](_0x4dd9df[_0x38ce('0x5c')][_0x38ce('0x5c')])||_0x4dd9df['body'][_0x38ce('0x5c')]===''){throw new db[(_0x38ce('0x9f'))][(_0x38ce('0x9d'))](_0x38ce('0xa0'));}if(_[_0x38ce('0xa1')](_0x4dd9df[_0x38ce('0x5c')]['to'])){throw new db[(_0x38ce('0x9f'))]['ValidationError'](_0x38ce('0xc1'));}_0x12387d=_0x4dd9df[_0x38ce('0x5c')]['to'];return db[_0x38ce('0x3e')][_0x38ce('0x5a')]({'where':{'id':_0x4dd9df[_0x38ce('0x57')]['id']},'include':[{'model':db[_0x38ce('0xa4')],'as':_0x38ce('0xc2'),'include':[{'model':db['CmContact'],'as':_0x38ce('0xa6'),'where':{'mobile':_0x12387d},'limit':0x1,'order':[['updatedAt','DESC']]}]}]})[_0x38ce('0x35')](handleEntityNotFound(_0x22a91d,null))['then'](function(_0x41c981){if(_0x41c981&&_0x41c981[_0x38ce('0xc2')]){_0x14d640=_0x41c981['get']({'plain':!![]});if(_0x14d640[_0x38ce('0xc2')]&&_0x14d640[_0x38ce('0xc2')][_0x38ce('0xa6')][_0x38ce('0x4a')]){return _0x14d640[_0x38ce('0xc2')][_0x38ce('0xa6')][0x0];}return db[_0x38ce('0xa5')][_0x38ce('0x5b')](_[_0x38ce('0x19')](_0x4dd9df['body'],{'firstName':_0x12387d,'mobile':_0x12387d,'phone':_0x12387d,'ListId':_0x14d640['ListId']}));}})[_0x38ce('0x35')](handleEntityNotFound(_0x22a91d,null))[_0x38ce('0x35')](function(_0x5460a4){if(_0x5460a4){_0x47d3ae=_0x5460a4;return db['WhatsappInteraction'][_0x38ce('0x5a')]({'where':{'ContactId':_0x47d3ae['id'],'closed':![],'WhatsappAccountId':_0x14d640['id']}})[_0x38ce('0x35')](function(_0x4e0a94){if(_0x4e0a94){return[_0x4e0a94,![]];}return db[_0x38ce('0xa9')]['create']({'UserId':_0x4dd9df['user']['id'],'ContactId':_0x47d3ae['id'],'WhatsappAccountId':_0x14d640['id'],'phone':_0x12387d,'firstMsgDirection':_0x38ce('0xc3'),'Messages':[_[_0x38ce('0x51')](_0x4dd9df['body'],{'read':![],'body':_0x4dd9df[_0x38ce('0x5c')][_0x38ce('0x5c')],'phone':_0x12387d,'WhatsappAccountId':_0x14d640['id'],'UserId':_0x4dd9df['user']['id'],'ContactId':_0x47d3ae['id']})]},{'include':[{'model':db[_0x38ce('0x8b')],'as':_0x38ce('0xc4')}]})[_0x38ce('0x35')](function(_0x4108e9){return[_0x4108e9,!![]];});});}})[_0x38ce('0xaa')](function(_0x33c4c5,_0x28f529){if(_0x28f529){return _0x33c4c5;}return db[_0x38ce('0x8b')]['create'](_[_0x38ce('0x51')](_0x4dd9df[_0x38ce('0x5c')],{'read':![],'body':_0x4dd9df[_0x38ce('0x5c')]['body'],'phone':_0x12387d,'WhatsappAccountId':_0x14d640['id'],'WhatsappInteractionId':_0x33c4c5['id'],'UserId':_0x4dd9df[_0x38ce('0x5d')]['id'],'ContactId':_0x47d3ae['id']}))[_0x38ce('0x35')](function(_0x1f02ed){_0x33c4c5['dataValues'][_0x38ce('0xc4')]=[];_0x33c4c5[_0x38ce('0xc5')]['Messages'][_0x38ce('0xad')](_0x1f02ed[_0x38ce('0xc5')]);return _0x33c4c5;});})[_0x38ce('0x35')](respondWithResult(_0x22a91d,null))[_0x38ce('0x28')](handleError(_0x22a91d,null));}; \ No newline at end of file +var _0x6d08=['fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','include','show','params','rawAttributes','includeAll','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','describe','WhatsappAccountId','Disposition','findAll','rows','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','removeAnswers','addAgents','omit','emit','userWhatsappAccount:save','isArray','userWhatsappAccount:remove','getAgents','User','sequelize','Transaction','WhatsappApplication','bulkCreate','findAndCountAll','finally','send','getApplications','whatsapp','account','sinch','statuses','state','read','WhatsappMessage','timestamp','message_id','orderBy','Applications','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','createdAt','difference','updatedAt','mobile','twilio','From','replace','Body','messageId','MessageSid','from','notifications','isNil','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','Contacts','list','WhatsappInteraction','spread','interaction','created','autoclose','applications','close','unmanaged','*,*,*,*','ContactId','AttachmentId','UserId','unshift','agent','queueId','WhatsappQueue','queue','waitForTheAssignedQueue','startRouting','receiveMessage','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','entity\x20found','Content-Type','text/xml','\x0a','body\x20is\x20mandatory\x20and\x20not\x20empty','CmList','List','DESC','ListId','out','dataValues','Messages','push','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','jayson/promise','client','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','destroy','get','WhatsappAccounts','UserProfileResource','stack','name','index','Pause','mandatoryDispositionPause','map','WhatsappAccount','fieldName','key','model','keys','query','filters','intersection','attributes'];(function(_0x5177ad,_0x414516){var _0x2c668a=function(_0x812ded){while(--_0x812ded){_0x5177ad['push'](_0x5177ad['shift']());}};_0x2c668a(++_0x414516);}(_0x6d08,0x13d));var _0x86d0=function(_0x18f1e4,_0x588730){_0x18f1e4=_0x18f1e4-0x0;var _0x14f540=_0x6d08[_0x18f1e4];return _0x14f540;};'use strict';var emlformat=require(_0x86d0('0x0'));var rimraf=require(_0x86d0('0x1'));var zipdir=require(_0x86d0('0x2'));var jsonpatch=require(_0x86d0('0x3'));var rp=require(_0x86d0('0x4'));var moment=require(_0x86d0('0x5'));var BPromise=require(_0x86d0('0x6'));var Mustache=require(_0x86d0('0x7'));var util=require(_0x86d0('0x8'));var path=require(_0x86d0('0x9'));var sox=require(_0x86d0('0xa'));var csv=require('to-csv');var ejs=require(_0x86d0('0xb'));var fs=require('fs');var fs_extra=require(_0x86d0('0xc'));var _=require(_0x86d0('0xd'));var squel=require(_0x86d0('0xe'));var crypto=require(_0x86d0('0xf'));var jsforce=require(_0x86d0('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x86d0('0x11'));var querystring=require('querystring');var Papa=require(_0x86d0('0x12'));var Redis=require('ioredis');var authService=require(_0x86d0('0x13'));var qs=require(_0x86d0('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x86d0('0x15'));var logger=require(_0x86d0('0x16'))(_0x86d0('0x17'));var utils=require(_0x86d0('0x18'));var config=require(_0x86d0('0x19'));var licenseUtil=require(_0x86d0('0x1a'));var db=require(_0x86d0('0x1b'))['db'];config['redis']=_[_0x86d0('0x1c')](config[_0x86d0('0x1d')],{'host':_0x86d0('0x1e'),'port':0x18eb});var socket=require(_0x86d0('0x1f'))(new Redis(config['redis']));require('./whatsappAccount.socket')['register'](socket);var jayson=require(_0x86d0('0x20'));var client=jayson[_0x86d0('0x21')]['http']({'port':0x232c});function respondWithRpcPromise(_0x2a8283,_0x466084,_0x3c47f3,_0x7b7698){return new BPromise(function(_0x1254cc,_0x2b142d){var _0x10640b=_0x7b7698||client;return _0x10640b['request'](_0x2a8283,_0x3c47f3)[_0x86d0('0x22')](function(_0x2cac55){logger[_0x86d0('0x23')](_0x86d0('0x24'),_0x466084,_0x86d0('0x25'));logger[_0x86d0('0x26')](_0x86d0('0x27'),_0x466084,'request\x20sent',JSON[_0x86d0('0x28')](_0x2cac55));if(_0x2cac55['error']){if(_0x2cac55[_0x86d0('0x29')][_0x86d0('0x2a')]===0x1f4){logger[_0x86d0('0x29')](_0x86d0('0x24'),_0x466084,_0x2cac55[_0x86d0('0x29')][_0x86d0('0x2b')]);return _0x2b142d(_0x2cac55['error'][_0x86d0('0x2b')]);}logger[_0x86d0('0x29')](_0x86d0('0x24'),_0x466084,_0x2cac55[_0x86d0('0x29')]['message']);return _0x1254cc(_0x2cac55[_0x86d0('0x29')][_0x86d0('0x2b')]);}else{logger[_0x86d0('0x23')](_0x86d0('0x24'),_0x466084,_0x86d0('0x25'));_0x1254cc(_0x2cac55['result'][_0x86d0('0x2b')]);}})[_0x86d0('0x2c')](function(_0x270785){logger['error'](_0x86d0('0x24'),_0x466084,_0x270785);_0x2b142d(_0x270785);});});}function respondWithStatusCode(_0x2b77d4,_0x5a9ffd){_0x5a9ffd=_0x5a9ffd||0xcc;return function(_0x5b192f){if(_0x5b192f){return _0x2b77d4[_0x86d0('0x2d')](_0x5a9ffd);}return _0x2b77d4[_0x86d0('0x2e')](_0x5a9ffd)[_0x86d0('0x2f')]();};}function respondWithResult(_0x235e8b,_0x322cd3){_0x322cd3=_0x322cd3||0xc8;return function(_0xbd1feb){if(_0xbd1feb){return _0x235e8b[_0x86d0('0x2e')](_0x322cd3)[_0x86d0('0x30')](_0xbd1feb);}};}function respondWithFilteredResult(_0x49ea27,_0x10125b){return function(_0x148d13){if(_0x148d13){var _0x1dfb2b=typeof _0x10125b['offset']===_0x86d0('0x31')&&typeof _0x10125b[_0x86d0('0x32')]===_0x86d0('0x31');var _0x35573a=_0x148d13[_0x86d0('0x33')];var _0x20dfd7=_0x1dfb2b?0x0:_0x10125b['offset'];var _0xe4a15=_0x1dfb2b?_0x148d13[_0x86d0('0x33')]:_0x10125b[_0x86d0('0x34')]+_0x10125b['limit'];var _0x5b1b73;if(_0xe4a15>=_0x35573a){_0xe4a15=_0x35573a;_0x5b1b73=0xc8;}else{_0x5b1b73=0xce;}_0x49ea27[_0x86d0('0x2e')](_0x5b1b73);return _0x49ea27[_0x86d0('0x35')](_0x86d0('0x36'),_0x20dfd7+'-'+_0xe4a15+'/'+_0x35573a)[_0x86d0('0x30')](_0x148d13);}return null;};}function patchUpdates(_0x45571a){return function(_0x523e06){try{jsonpatch['apply'](_0x523e06,_0x45571a,!![]);}catch(_0x4cb8ed){return BPromise[_0x86d0('0x37')](_0x4cb8ed);}return _0x523e06[_0x86d0('0x38')]();};}function saveUpdates(_0x308b29,_0x21b28e){return function(_0x7e6f29){if(_0x7e6f29){return _0x7e6f29[_0x86d0('0x39')](_0x308b29)[_0x86d0('0x22')](function(_0x1c3276){return _0x1c3276;});}return null;};}function removeEntity(_0x223ad6,_0xa7ca3b){return function(_0x3300d3){if(_0x3300d3){return _0x3300d3[_0x86d0('0x3a')]()['then'](function(){var _0x3540fd=_0x3300d3[_0x86d0('0x3b')]({'plain':!![]});var _0x432c8a=_0x86d0('0x3c');return db[_0x86d0('0x3d')][_0x86d0('0x3a')]({'where':{'type':_0x432c8a,'resourceId':_0x3540fd['id']}})['then'](function(){return _0x3300d3;});})[_0x86d0('0x22')](function(){_0x223ad6['status'](0xcc)[_0x86d0('0x2f')]();});}};}function handleEntityNotFound(_0x18a377,_0x5e4099){return function(_0x1adc20){if(!_0x1adc20){_0x18a377[_0x86d0('0x2d')](0x194);}return _0x1adc20;};}function handleError(_0x4f0d64,_0x43305c){_0x43305c=_0x43305c||0x1f4;return function(_0x505cf2){logger[_0x86d0('0x29')](_0x505cf2[_0x86d0('0x3e')]);if(_0x505cf2[_0x86d0('0x3f')]){delete _0x505cf2['name'];}_0x4f0d64[_0x86d0('0x2e')](_0x43305c)['send'](_0x505cf2);};}exports[_0x86d0('0x40')]=function(_0x50674c,_0x4ce423){var _0x14b93b={'include':[{'model':db[_0x86d0('0x41')],'as':_0x86d0('0x42')}]},_0x2a27ee={},_0x41e1af={'count':0x0,'rows':[]};var _0xc49f60=_[_0x86d0('0x43')](db[_0x86d0('0x44')]['rawAttributes'],function(_0x37806a){return{'name':_0x37806a[_0x86d0('0x45')],'type':_0x37806a['type'][_0x86d0('0x46')]};});_0x2a27ee[_0x86d0('0x47')]=_['map'](_0xc49f60,_0x86d0('0x3f'));_0x2a27ee['query']=_[_0x86d0('0x48')](_0x50674c[_0x86d0('0x49')]);_0x2a27ee[_0x86d0('0x4a')]=_[_0x86d0('0x4b')](_0x2a27ee[_0x86d0('0x47')],_0x2a27ee[_0x86d0('0x49')]);_0x14b93b[_0x86d0('0x4c')]=_[_0x86d0('0x4b')](_0x2a27ee[_0x86d0('0x47')],qs['fields'](_0x50674c[_0x86d0('0x49')][_0x86d0('0x4d')]));_0x14b93b['attributes']=_0x14b93b[_0x86d0('0x4c')][_0x86d0('0x4e')]?_0x14b93b[_0x86d0('0x4c')]:_0x2a27ee[_0x86d0('0x47')];if(!_0x50674c[_0x86d0('0x49')][_0x86d0('0x4f')](_0x86d0('0x50'))){_0x14b93b[_0x86d0('0x32')]=qs['limit'](_0x50674c['query'][_0x86d0('0x32')]);_0x14b93b[_0x86d0('0x34')]=qs[_0x86d0('0x34')](_0x50674c[_0x86d0('0x49')][_0x86d0('0x34')]);}_0x14b93b[_0x86d0('0x51')]=qs[_0x86d0('0x52')](_0x50674c['query'][_0x86d0('0x52')]);_0x14b93b[_0x86d0('0x53')]=qs[_0x86d0('0x4a')](_[_0x86d0('0x54')](_0x50674c['query'],_0x2a27ee[_0x86d0('0x4a')]),_0xc49f60);if(_0x50674c[_0x86d0('0x49')][_0x86d0('0x55')]){_0x14b93b[_0x86d0('0x53')]=_[_0x86d0('0x56')](_0x14b93b['where'],{'$or':_[_0x86d0('0x43')](_0xc49f60,function(_0x6818e0){if(_0x6818e0[_0x86d0('0x57')]!==_0x86d0('0x58')){var _0x22af34={};_0x22af34[_0x6818e0[_0x86d0('0x3f')]]={'$like':'%'+_0x50674c[_0x86d0('0x49')][_0x86d0('0x55')]+'%'};return _0x22af34;}})});}_0x14b93b=_[_0x86d0('0x56')]({},_0x14b93b,_0x50674c[_0x86d0('0x59')]);var _0x31ae34={'where':_0x14b93b['where']};return db['WhatsappAccount']['count'](_0x31ae34)[_0x86d0('0x22')](function(_0x5a47ae){_0x41e1af[_0x86d0('0x33')]=_0x5a47ae;if(_0x50674c[_0x86d0('0x49')]['includeAll']){_0x14b93b[_0x86d0('0x5a')]=[{'all':!![]}];}return db['WhatsappAccount']['findAll'](_0x14b93b);})[_0x86d0('0x22')](function(_0x17de0d){_0x41e1af['rows']=_0x17de0d;return _0x41e1af;})[_0x86d0('0x22')](respondWithFilteredResult(_0x4ce423,_0x14b93b))['catch'](handleError(_0x4ce423,null));};exports[_0x86d0('0x5b')]=function(_0xdfd57b,_0x51926d){var _0x4a2d08={'raw':![],'where':{'id':_0xdfd57b[_0x86d0('0x5c')]['id']},'include':[{'model':db[_0x86d0('0x41')],'as':_0x86d0('0x42')}]},_0x45bf85={};_0x45bf85[_0x86d0('0x47')]=_['keys'](db[_0x86d0('0x44')][_0x86d0('0x5d')]);_0x45bf85[_0x86d0('0x49')]=_[_0x86d0('0x48')](_0xdfd57b['query']);_0x45bf85['filters']=_[_0x86d0('0x4b')](_0x45bf85['model'],_0x45bf85['query']);_0x4a2d08['attributes']=_['intersection'](_0x45bf85['model'],qs[_0x86d0('0x4d')](_0xdfd57b[_0x86d0('0x49')][_0x86d0('0x4d')]));_0x4a2d08['attributes']=_0x4a2d08['attributes'][_0x86d0('0x4e')]?_0x4a2d08['attributes']:_0x45bf85[_0x86d0('0x47')];if(_0xdfd57b[_0x86d0('0x49')][_0x86d0('0x5e')]){_0x4a2d08[_0x86d0('0x5a')]=[{'all':!![]}];}_0x4a2d08=_[_0x86d0('0x56')]({},_0x4a2d08,_0xdfd57b[_0x86d0('0x59')]);return db['WhatsappAccount'][_0x86d0('0x5f')](_0x4a2d08)[_0x86d0('0x22')](handleEntityNotFound(_0x51926d,null))[_0x86d0('0x22')](respondWithResult(_0x51926d,null))['catch'](handleError(_0x51926d,null));};exports[_0x86d0('0x60')]=function(_0x36e205,_0x5cafed){return db[_0x86d0('0x44')][_0x86d0('0x60')](_0x36e205[_0x86d0('0x61')],{})[_0x86d0('0x22')](function(_0x48fb09){var _0x4825be=_0x36e205[_0x86d0('0x62')][_0x86d0('0x3b')]({'plain':!![]});if(!_0x4825be)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4825be[_0x86d0('0x63')]===_0x86d0('0x62')){var _0x115349=_0x48fb09[_0x86d0('0x3b')]({'plain':!![]});var _0x3e975d=_0x86d0('0x3c');return db[_0x86d0('0x64')][_0x86d0('0x5f')]({'where':{'name':_0x3e975d,'userProfileId':_0x4825be[_0x86d0('0x65')]},'raw':!![]})[_0x86d0('0x22')](function(_0x29050a){if(_0x29050a&&_0x29050a[_0x86d0('0x66')]===0x0){return db[_0x86d0('0x3d')]['create']({'name':_0x115349[_0x86d0('0x3f')],'resourceId':_0x115349['id'],'type':_0x29050a[_0x86d0('0x3f')],'sectionId':_0x29050a['id']},{})['then'](function(){return _0x48fb09;});}else{return _0x48fb09;}})[_0x86d0('0x2c')](function(_0x1af94a){logger[_0x86d0('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1af94a);throw _0x1af94a;});}return _0x48fb09;})[_0x86d0('0x22')](respondWithResult(_0x5cafed,0xc9))[_0x86d0('0x2c')](handleError(_0x5cafed,null));};exports[_0x86d0('0x39')]=function(_0x33d2a5,_0x192088){if(_0x33d2a5[_0x86d0('0x61')]['id']){delete _0x33d2a5[_0x86d0('0x61')]['id'];}return db['WhatsappAccount']['find']({'where':{'id':_0x33d2a5[_0x86d0('0x5c')]['id']},'include':[{'model':db['Pause'],'as':_0x86d0('0x42')}]})['then'](handleEntityNotFound(_0x192088,null))['then'](saveUpdates(_0x33d2a5[_0x86d0('0x61')],null))['then'](respondWithResult(_0x192088,null))[_0x86d0('0x2c')](handleError(_0x192088,null));};exports[_0x86d0('0x3a')]=function(_0x51fc32,_0x218704){return db[_0x86d0('0x44')][_0x86d0('0x5f')]({'where':{'id':_0x51fc32[_0x86d0('0x5c')]['id']}})[_0x86d0('0x22')](handleEntityNotFound(_0x218704,null))[_0x86d0('0x22')](removeEntity(_0x218704,null))[_0x86d0('0x2c')](handleError(_0x218704,null));};exports[_0x86d0('0x67')]=function(_0x1a825f,_0x216f0a){return db[_0x86d0('0x44')][_0x86d0('0x67')]()[_0x86d0('0x22')](respondWithResult(_0x216f0a,null))['catch'](handleError(_0x216f0a,null));};exports['addDisposition']=function(_0x6f520a,_0x32c35d,_0x28bd6e){if(_0x6f520a['body']['id']){delete _0x6f520a['body']['id'];}return db[_0x86d0('0x44')][_0x86d0('0x5f')]({'where':{'id':_0x6f520a[_0x86d0('0x5c')]['id']}})[_0x86d0('0x22')](handleEntityNotFound(_0x32c35d,null))[_0x86d0('0x22')](function(_0xdc1e22){if(_0xdc1e22){_0x6f520a['body'][_0x86d0('0x68')]=_0xdc1e22['id'];return db[_0x86d0('0x69')]['create'](_0x6f520a['body']);}})[_0x86d0('0x22')](respondWithResult(_0x32c35d,null))[_0x86d0('0x2c')](handleError(_0x32c35d,null));};exports['getDispositions']=function(_0x16e74e,_0x84d253,_0x520d57){var _0x31c96d={'raw':![],'where':{}};var _0xd73a95={};var _0x511577={'count':0x0,'rows':[]};return db[_0x86d0('0x44')]['findOne']({'where':{'id':_0x16e74e[_0x86d0('0x5c')]['id']}})[_0x86d0('0x22')](handleEntityNotFound(_0x84d253,null))[_0x86d0('0x22')](function(_0x4c34f){if(_0x4c34f){_0xd73a95[_0x86d0('0x47')]=_[_0x86d0('0x48')](db[_0x86d0('0x69')][_0x86d0('0x5d')]);_0xd73a95[_0x86d0('0x49')]=_['keys'](_0x16e74e[_0x86d0('0x49')]);_0xd73a95[_0x86d0('0x4a')]=_[_0x86d0('0x4b')](_0xd73a95[_0x86d0('0x47')],_0xd73a95[_0x86d0('0x49')]);_0x31c96d[_0x86d0('0x4c')]=_[_0x86d0('0x4b')](_0xd73a95[_0x86d0('0x47')],qs['fields'](_0x16e74e[_0x86d0('0x49')][_0x86d0('0x4d')]));_0x31c96d[_0x86d0('0x4c')]=_0x31c96d['attributes']['length']?_0x31c96d[_0x86d0('0x4c')]:_0xd73a95[_0x86d0('0x47')];if(!_0x16e74e[_0x86d0('0x49')]['hasOwnProperty'](_0x86d0('0x50'))){_0x31c96d[_0x86d0('0x32')]=qs[_0x86d0('0x32')](_0x16e74e[_0x86d0('0x49')][_0x86d0('0x32')]);_0x31c96d['offset']=qs[_0x86d0('0x34')](_0x16e74e['query'][_0x86d0('0x34')]);}_0x31c96d[_0x86d0('0x51')]=qs[_0x86d0('0x52')](_0x16e74e['query'][_0x86d0('0x52')]);_0x31c96d[_0x86d0('0x53')]=qs['filters'](_[_0x86d0('0x54')](_0x16e74e[_0x86d0('0x49')],_0xd73a95[_0x86d0('0x4a')]));_0x31c96d[_0x86d0('0x53')]['WhatsappAccountId']=_0x4c34f['id'];if(_0x16e74e['query'][_0x86d0('0x55')]){_0x31c96d[_0x86d0('0x53')]=_[_0x86d0('0x56')](_0x31c96d[_0x86d0('0x53')],{'$or':_['map'](_0x31c96d[_0x86d0('0x4c')],function(_0x1a0512){var _0x28467a={};_0x28467a[_0x1a0512]={'$like':'%'+_0x16e74e[_0x86d0('0x49')][_0x86d0('0x55')]+'%'};return _0x28467a;})});}_0x31c96d=_['merge']({},_0x31c96d,_0x16e74e[_0x86d0('0x59')]);return db[_0x86d0('0x69')][_0x86d0('0x33')]({'where':_0x31c96d[_0x86d0('0x53')]})['then'](function(_0x59131e){_0x511577[_0x86d0('0x33')]=_0x59131e;if(_0x16e74e[_0x86d0('0x49')][_0x86d0('0x5e')]){_0x31c96d[_0x86d0('0x5a')]=[{'all':!![]}];}return db[_0x86d0('0x69')][_0x86d0('0x6a')](_0x31c96d);})[_0x86d0('0x22')](function(_0x4b7f03){_0x511577[_0x86d0('0x6b')]=_0x4b7f03;return _0x511577;});}})[_0x86d0('0x22')](respondWithFilteredResult(_0x84d253,_0x31c96d))[_0x86d0('0x2c')](handleError(_0x84d253,null));};exports[_0x86d0('0x6c')]=function(_0x10c860,_0xee1287,_0xaa620c){return db[_0x86d0('0x44')][_0x86d0('0x5f')]({'where':{'id':_0x10c860['params']['id']}})['then'](handleEntityNotFound(_0xee1287,null))[_0x86d0('0x22')](function(_0x234c69){if(_0x234c69){return _0x234c69[_0x86d0('0x6c')](_0x10c860['query'][_0x86d0('0x6d')]);}})[_0x86d0('0x22')](respondWithStatusCode(_0xee1287,null))[_0x86d0('0x2c')](handleError(_0xee1287,null));};exports[_0x86d0('0x6e')]=function(_0x174658,_0x2e5ada,_0x31144e){if(_0x174658[_0x86d0('0x61')]['id']){delete _0x174658[_0x86d0('0x61')]['id'];}return db[_0x86d0('0x44')][_0x86d0('0x5f')]({'where':{'id':_0x174658['params']['id']}})[_0x86d0('0x22')](handleEntityNotFound(_0x2e5ada,null))[_0x86d0('0x22')](function(_0x4c9303){if(_0x4c9303){_0x174658[_0x86d0('0x61')]['WhatsappAccountId']=_0x4c9303['id'];return db[_0x86d0('0x6f')]['create'](_0x174658[_0x86d0('0x61')]);}})[_0x86d0('0x22')](respondWithResult(_0x2e5ada,null))['catch'](handleError(_0x2e5ada,null));};exports[_0x86d0('0x70')]=function(_0x1cebf0,_0x5ed3ed,_0x44fe24){var _0x12aa6a={'raw':![],'where':{}};var _0x4055e7={};var _0x17df5f={'count':0x0,'rows':[]};return db[_0x86d0('0x44')][_0x86d0('0x71')]({'where':{'id':_0x1cebf0['params']['id']}})[_0x86d0('0x22')](handleEntityNotFound(_0x5ed3ed,null))[_0x86d0('0x22')](function(_0x38d4d9){if(_0x38d4d9){_0x4055e7[_0x86d0('0x47')]=_[_0x86d0('0x48')](db['CannedAnswer'][_0x86d0('0x5d')]);_0x4055e7[_0x86d0('0x49')]=_[_0x86d0('0x48')](_0x1cebf0[_0x86d0('0x49')]);_0x4055e7['filters']=_[_0x86d0('0x4b')](_0x4055e7[_0x86d0('0x47')],_0x4055e7[_0x86d0('0x49')]);_0x12aa6a[_0x86d0('0x4c')]=_['intersection'](_0x4055e7['model'],qs[_0x86d0('0x4d')](_0x1cebf0[_0x86d0('0x49')]['fields']));_0x12aa6a[_0x86d0('0x4c')]=_0x12aa6a[_0x86d0('0x4c')]['length']?_0x12aa6a[_0x86d0('0x4c')]:_0x4055e7['model'];if(!_0x1cebf0['query'][_0x86d0('0x4f')](_0x86d0('0x50'))){_0x12aa6a['limit']=qs[_0x86d0('0x32')](_0x1cebf0[_0x86d0('0x49')][_0x86d0('0x32')]);_0x12aa6a[_0x86d0('0x34')]=qs[_0x86d0('0x34')](_0x1cebf0[_0x86d0('0x49')][_0x86d0('0x34')]);}_0x12aa6a['order']=qs[_0x86d0('0x52')](_0x1cebf0['query']['sort']);_0x12aa6a[_0x86d0('0x53')]=qs['filters'](_[_0x86d0('0x54')](_0x1cebf0['query'],_0x4055e7[_0x86d0('0x4a')]));_0x12aa6a[_0x86d0('0x53')]['WhatsappAccountId']=_0x38d4d9['id'];if(_0x1cebf0[_0x86d0('0x49')]['filter']){_0x12aa6a[_0x86d0('0x53')]=_[_0x86d0('0x56')](_0x12aa6a[_0x86d0('0x53')],{'$or':_[_0x86d0('0x43')](_0x12aa6a['attributes'],function(_0xa392a){var _0x371eb6={};_0x371eb6[_0xa392a]={'$like':'%'+_0x1cebf0[_0x86d0('0x49')]['filter']+'%'};return _0x371eb6;})});}_0x12aa6a=_[_0x86d0('0x56')]({},_0x12aa6a,_0x1cebf0[_0x86d0('0x59')]);return db[_0x86d0('0x6f')][_0x86d0('0x33')]({'where':_0x12aa6a['where']})['then'](function(_0x4f1782){_0x17df5f['count']=_0x4f1782;if(_0x1cebf0['query'][_0x86d0('0x5e')]){_0x12aa6a[_0x86d0('0x5a')]=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x12aa6a);})['then'](function(_0x1ded22){_0x17df5f[_0x86d0('0x6b')]=_0x1ded22;return _0x17df5f;});}})[_0x86d0('0x22')](respondWithFilteredResult(_0x5ed3ed,_0x12aa6a))[_0x86d0('0x2c')](handleError(_0x5ed3ed,null));};exports['removeAnswers']=function(_0x389e8a,_0x36910e,_0x75ea4c){return db['WhatsappAccount']['find']({'where':{'id':_0x389e8a[_0x86d0('0x5c')]['id']}})['then'](handleEntityNotFound(_0x36910e,null))['then'](function(_0xe44a8e){if(_0xe44a8e){return _0xe44a8e[_0x86d0('0x72')](_0x389e8a['query']['ids']);}})[_0x86d0('0x22')](respondWithStatusCode(_0x36910e,null))[_0x86d0('0x2c')](handleError(_0x36910e,null));};exports[_0x86d0('0x73')]=function(_0x334101,_0x3e3ec0,_0x5e80ba){return db['WhatsappAccount']['find']({'where':{'id':_0x334101[_0x86d0('0x5c')]['id']}})[_0x86d0('0x22')](handleEntityNotFound(_0x3e3ec0,null))[_0x86d0('0x22')](function(_0x495025){if(_0x495025){return _0x495025[_0x86d0('0x73')](_0x334101[_0x86d0('0x61')][_0x86d0('0x6d')],_[_0x86d0('0x74')](_0x334101['body'],[_0x86d0('0x6d'),'id'])||{})['spread'](function(_0x7d63e7){for(var _0x3b4da8=0x0;_0x3b4da8<_0x334101[_0x86d0('0x61')][_0x86d0('0x6d')]['length'];_0x3b4da8+=0x1){socket[_0x86d0('0x75')](_0x86d0('0x76'),{'UserId':Number(_0x334101[_0x86d0('0x61')][_0x86d0('0x6d')][_0x3b4da8]),'WhatsappAccountId':Number(_0x334101[_0x86d0('0x5c')]['id'])});}return _0x7d63e7;});}})['then'](respondWithResult(_0x3e3ec0,null))[_0x86d0('0x2c')](handleError(_0x3e3ec0,null));};exports['removeAgents']=function(_0x21c5ce,_0x5f3c83,_0xdd0e7f){return db[_0x86d0('0x44')]['find']({'where':{'id':_0x21c5ce[_0x86d0('0x5c')]['id']}})[_0x86d0('0x22')](handleEntityNotFound(_0x5f3c83,null))[_0x86d0('0x22')](function(_0xbf3e1a){if(_0xbf3e1a){return _0xbf3e1a['removeAgents'](_0x21c5ce['query'][_0x86d0('0x6d')])[_0x86d0('0x22')](function(){if(_[_0x86d0('0x77')](_0x21c5ce[_0x86d0('0x49')][_0x86d0('0x6d')])){for(var _0x58ccef=0x0;_0x58ccef<_0x21c5ce[_0x86d0('0x49')][_0x86d0('0x6d')]['length'];_0x58ccef+=0x1){socket[_0x86d0('0x75')](_0x86d0('0x78'),{'UserId':Number(_0x21c5ce[_0x86d0('0x49')][_0x86d0('0x6d')][_0x58ccef]),'WhatsappAccountId':Number(_0x21c5ce[_0x86d0('0x5c')]['id'])});}}else{socket[_0x86d0('0x75')](_0x86d0('0x78'),{'UserId':Number(_0x21c5ce[_0x86d0('0x49')][_0x86d0('0x6d')]),'WhatsappAccountId':Number(_0x21c5ce[_0x86d0('0x5c')]['id'])});}});}})[_0x86d0('0x22')](respondWithStatusCode(_0x5f3c83,null))[_0x86d0('0x2c')](handleError(_0x5f3c83,null));};exports[_0x86d0('0x79')]=function(_0xa58355,_0x11b8f0,_0x58a2a1){var _0x235044={};var _0x3388a2={};var _0x25daa6;var _0x567dca;return db[_0x86d0('0x44')][_0x86d0('0x71')]({'where':{'id':_0xa58355['params']['id']}})[_0x86d0('0x22')](handleEntityNotFound(_0x11b8f0,null))['then'](function(_0x2c2ee0){if(_0x2c2ee0){_0x25daa6=_0x2c2ee0;_0x3388a2[_0x86d0('0x47')]=_[_0x86d0('0x48')](db[_0x86d0('0x7a')]['rawAttributes']);_0x3388a2[_0x86d0('0x49')]=_[_0x86d0('0x48')](_0xa58355[_0x86d0('0x49')]);_0x3388a2['filters']=_[_0x86d0('0x4b')](_0x3388a2['model'],_0x3388a2[_0x86d0('0x49')]);_0x235044[_0x86d0('0x4c')]=_['intersection'](_0x3388a2['model'],qs['fields'](_0xa58355[_0x86d0('0x49')][_0x86d0('0x4d')]));_0x235044[_0x86d0('0x4c')]=_0x235044['attributes']['length']?_0x235044[_0x86d0('0x4c')]:_0x3388a2[_0x86d0('0x47')];_0x235044[_0x86d0('0x51')]=qs[_0x86d0('0x52')](_0xa58355['query'][_0x86d0('0x52')]);_0x235044[_0x86d0('0x53')]=qs['filters'](_[_0x86d0('0x54')](_0xa58355[_0x86d0('0x49')],_0x3388a2[_0x86d0('0x4a')]));if(_0xa58355[_0x86d0('0x49')][_0x86d0('0x55')]){_0x235044[_0x86d0('0x53')]=_[_0x86d0('0x56')](_0x235044[_0x86d0('0x53')],{'$or':_[_0x86d0('0x43')](_0x235044[_0x86d0('0x4c')],function(_0x15f717){var _0x2f5611={};_0x2f5611[_0x15f717]={'$like':'%'+_0xa58355[_0x86d0('0x49')][_0x86d0('0x55')]+'%'};return _0x2f5611;})});}_0x235044=_['merge']({},_0x235044,_0xa58355[_0x86d0('0x59')]);return _0x25daa6[_0x86d0('0x79')](_0x235044);}})[_0x86d0('0x22')](function(_0x624049){if(_0x624049){_0x567dca=_0x624049[_0x86d0('0x4e')];if(!_0xa58355[_0x86d0('0x49')][_0x86d0('0x4f')](_0x86d0('0x50'))){_0x235044[_0x86d0('0x32')]=qs[_0x86d0('0x32')](_0xa58355['query'][_0x86d0('0x32')]);_0x235044['offset']=qs[_0x86d0('0x34')](_0xa58355[_0x86d0('0x49')][_0x86d0('0x34')]);}return _0x25daa6[_0x86d0('0x79')](_0x235044);}})[_0x86d0('0x22')](function(_0x24fe35){if(_0x24fe35){return _0x24fe35?{'count':_0x567dca,'rows':_0x24fe35}:null;}})[_0x86d0('0x22')](respondWithResult(_0x11b8f0,null))[_0x86d0('0x2c')](handleError(_0x11b8f0,null));};exports['addApplications']=function(_0x58d85a,_0x3db953){var _0x16caac=_0x58d85a[_0x86d0('0x5c')]['id'];var _0x4bc4f1=_0x58d85a[_0x86d0('0x61')];var _0x296433=0xc8;var _0x23fe25=null;return db[_0x86d0('0x7b')]['transaction']({'isolationLevel':db[_0x86d0('0x7b')][_0x86d0('0x7c')]['ISOLATION_LEVELS']['READ_COMMITTED']},function(_0x6bcd0d){return db['WhatsappAccount']['findOne']({'where':{'id':_0x16caac},'transaction':_0x6bcd0d})[_0x86d0('0x22')](function(_0x12e6e4){if(_0x12e6e4){return db[_0x86d0('0x7d')][_0x86d0('0x3a')]({'where':{'WhatsappAccountId':_0x16caac},'transaction':_0x6bcd0d})[_0x86d0('0x22')](function(){var _0x43bd22=_[_0x86d0('0x43')](_0x4bc4f1,function(_0x2facf8){_0x2facf8['WhatsappAccountId']=_0x16caac;return _0x2facf8;});return db[_0x86d0('0x7d')][_0x86d0('0x7e')](_0x43bd22,{'transaction':_0x6bcd0d});});}else{_0x296433=0x194;_0x23fe25=[];}});})[_0x86d0('0x22')](function(){if(_0x296433!==0x194){return db[_0x86d0('0x7d')][_0x86d0('0x7f')]({'where':{'WhatsappAccountId':_0x16caac},'order':'priority'})[_0x86d0('0x22')](function(_0x22be50){_0x23fe25=_0x22be50;});}})['catch'](function(_0xdba927){_0x296433=0x1f4;logger[_0x86d0('0x29')](_0xdba927['stack']);if(_0xdba927[_0x86d0('0x3f')]){delete _0xdba927[_0x86d0('0x3f')];}_0x23fe25=_0xdba927;})[_0x86d0('0x80')](function(){if(_0x23fe25===null){_0x3db953[_0x86d0('0x2d')](_0x296433);}else{if(_0x296433===0x1f4){_0x3db953[_0x86d0('0x2e')](_0x296433)[_0x86d0('0x81')](_0x23fe25);}else{_0x3db953[_0x86d0('0x2e')](_0x296433)[_0x86d0('0x30')](_0x23fe25);}}});};exports[_0x86d0('0x82')]=function(_0x19f975,_0x4d7d0d,_0x4d9497){var _0x3f0ded={};var _0x270101={};var _0xc7453d;var _0x393114;return db['WhatsappAccount'][_0x86d0('0x71')]({'where':{'id':_0x19f975[_0x86d0('0x5c')]['id']}})[_0x86d0('0x22')](handleEntityNotFound(_0x4d7d0d,null))[_0x86d0('0x22')](function(_0x1dcebc){if(_0x1dcebc){_0xc7453d=_0x1dcebc;_0x270101[_0x86d0('0x47')]=_[_0x86d0('0x48')](db[_0x86d0('0x7d')][_0x86d0('0x5d')]);_0x270101[_0x86d0('0x49')]=_['keys'](_0x19f975[_0x86d0('0x49')]);_0x270101['filters']=_[_0x86d0('0x4b')](_0x270101[_0x86d0('0x47')],_0x270101[_0x86d0('0x49')]);_0x3f0ded[_0x86d0('0x4c')]=_['intersection'](_0x270101[_0x86d0('0x47')],qs[_0x86d0('0x4d')](_0x19f975[_0x86d0('0x49')][_0x86d0('0x4d')]));_0x3f0ded[_0x86d0('0x4c')]=_0x3f0ded[_0x86d0('0x4c')]['length']?_0x3f0ded[_0x86d0('0x4c')]:_0x270101[_0x86d0('0x47')];_0x3f0ded['order']=qs['sort'](_0x19f975[_0x86d0('0x49')][_0x86d0('0x52')]);_0x3f0ded[_0x86d0('0x53')]=qs[_0x86d0('0x4a')](_[_0x86d0('0x54')](_0x19f975[_0x86d0('0x49')],_0x270101[_0x86d0('0x4a')]));if(_0x19f975[_0x86d0('0x49')]['filter']){_0x3f0ded[_0x86d0('0x53')]=_[_0x86d0('0x56')](_0x3f0ded[_0x86d0('0x53')],{'$or':_[_0x86d0('0x43')](_0x3f0ded[_0x86d0('0x4c')],function(_0x335dd1){var _0x513169={};_0x513169[_0x335dd1]={'$like':'%'+_0x19f975['query'][_0x86d0('0x55')]+'%'};return _0x513169;})});}_0x3f0ded=_[_0x86d0('0x56')]({},_0x3f0ded,_0x19f975[_0x86d0('0x59')]);return _0xc7453d[_0x86d0('0x82')](_0x3f0ded);}})[_0x86d0('0x22')](function(_0x44b0ef){if(_0x44b0ef){_0x393114=_0x44b0ef[_0x86d0('0x4e')];if(!_0x19f975[_0x86d0('0x49')][_0x86d0('0x4f')](_0x86d0('0x50'))){_0x3f0ded['limit']=qs[_0x86d0('0x32')](_0x19f975[_0x86d0('0x49')][_0x86d0('0x32')]);_0x3f0ded['offset']=qs[_0x86d0('0x34')](_0x19f975['query'][_0x86d0('0x34')]);}return _0xc7453d[_0x86d0('0x82')](_0x3f0ded);}})[_0x86d0('0x22')](function(_0x5a98b1){if(_0x5a98b1){return _0x5a98b1?{'count':_0x393114,'rows':_0x5a98b1}:null;}})[_0x86d0('0x22')](respondWithResult(_0x4d7d0d,null))[_0x86d0('0x2c')](handleError(_0x4d7d0d,null));};exports['notify']=function(_0x242673,_0x47c3d0,_0x453d09){var _0x3e8661={'channel':_0x86d0('0x83')};var _0x3968be=[];var _0x58bac9=[];var _0x3f246b={};return db[_0x86d0('0x44')][_0x86d0('0x5f')]({'where':{'id':_0x242673['params']['id']},'include':[{'model':db[_0x86d0('0x7d')],'as':'Applications'}]})[_0x86d0('0x22')](handleEntityNotFound(_0x47c3d0,null))['then'](function(_0x493f6c){_0x3e8661[_0x86d0('0x84')]=_0x493f6c;if(_0x3e8661[_0x86d0('0x84')]&&_0x3e8661['account'][_0x86d0('0x57')]===_0x86d0('0x85')&&_0x242673[_0x86d0('0x61')][_0x86d0('0x86')]){if(_0x242673[_0x86d0('0x61')]['statuses']['length']===0x0)return;if(_0x242673[_0x86d0('0x61')][_0x86d0('0x86')][0x0][_0x86d0('0x87')]!==_0x86d0('0x88'))return;return db[_0x86d0('0x89')]['update']({'read':!![],'readAt':_0x242673[_0x86d0('0x61')]['statuses'][0x0][_0x86d0('0x8a')]},{'where':{'messageId':_0x242673[_0x86d0('0x61')][_0x86d0('0x86')][0x0][_0x86d0('0x8b')]},'individualHooks':!![]})[_0x86d0('0x22')](function(_0x32020b){return _0x47c3d0[_0x86d0('0x2e')](0xc8)[_0x86d0('0x30')](_0x32020b);});}_0x3e8661['applications']=_[_0x86d0('0x8c')](_0x493f6c[_0x86d0('0x8d')],['priority'],['asc']);if(_0x3e8661[_0x86d0('0x84')][_0x86d0('0x8d')]){delete _0x3e8661[_0x86d0('0x84')]['Applications'];}return db[_0x86d0('0x8e')][_0x86d0('0x67')]()['then'](function(_0x245f2a){if(!_0x245f2a){throw new db[(_0x86d0('0x8f'))][(_0x86d0('0x90'))](_0x86d0('0x91'));}_0x3968be=_['difference'](_['keys'](_0x245f2a),[_0x86d0('0x92'),'updatedAt']);_0x58bac9=_[_0x86d0('0x93')](_['keys'](_0x245f2a),['createdAt',_0x86d0('0x94'),'CompanyId','ListId']);_0x3e8661[_0x86d0('0x61')]={'mapKey':_0x86d0('0x95')};if(_0x3e8661[_0x86d0('0x84')]&&_0x3e8661[_0x86d0('0x84')][_0x86d0('0x57')]===_0x86d0('0x96')){_0x3e8661[_0x86d0('0x61')]['from']=_0x242673[_0x86d0('0x61')][_0x86d0('0x97')][_0x86d0('0x98')]('whatsapp:','');_0x3e8661[_0x86d0('0x61')][_0x86d0('0x61')]=_0x242673['body'][_0x86d0('0x99')];_0x3e8661['body'][_0x86d0('0x9a')]=_0x242673['body'][_0x86d0('0x9b')];}if(_0x3e8661['account']&&_0x3e8661[_0x86d0('0x84')]['type']==='sinch'){_0x3e8661[_0x86d0('0x61')][_0x86d0('0x9c')]=_0x242673[_0x86d0('0x61')]['notifications'][0x0]['from'];_0x3e8661['body'][_0x86d0('0x61')]=_0x242673['body'][_0x86d0('0x9d')][0x0]['message'][_0x86d0('0x61')];_0x3e8661['body'][_0x86d0('0x9a')]=_0x242673[_0x86d0('0x61')][_0x86d0('0x9d')][0x0]['message_id'];}if(_0x3e8661[_0x86d0('0x61')]['id']){delete _0x3e8661[_0x86d0('0x61')]['id'];}if(_['isNil'](_0x3e8661[_0x86d0('0x61')]['from'])){throw new db[(_0x86d0('0x8f'))][(_0x86d0('0x90'))]('from\x20is\x20mandatory');}if(_['isNil'](_0x3e8661['body'][_0x86d0('0x61')])||_0x3e8661[_0x86d0('0x61')][_0x86d0('0x61')]===''){throw new db[(_0x86d0('0x8f'))][(_0x86d0('0x90'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x86d0('0x9e')](_0x3e8661[_0x86d0('0x61')][_0x86d0('0x9f')])){throw new db[(_0x86d0('0x8f'))][(_0x86d0('0x90'))](_0x86d0('0xa0')+_0x58bac9);}if(!_['includes'](_0x58bac9,_0x3e8661['body'][_0x86d0('0x9f')])){throw new db[(_0x86d0('0x8f'))][(_0x86d0('0x90'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x58bac9);}_0x3f246b[_0x3e8661[_0x86d0('0x61')][_0x86d0('0x9f')]]=_0x3e8661[_0x86d0('0x61')][_0x86d0('0x9c')];return db['CmList'][_0x86d0('0x5f')]({'where':{'id':_0x3e8661[_0x86d0('0x84')]['ListId']},'include':[{'model':db['CmContact'],'as':_0x86d0('0xa1'),'where':_0x3f246b,'limit':0x1,'order':[[_0x86d0('0x94'),'DESC']]}]});})[_0x86d0('0x22')](handleEntityNotFound(_0x47c3d0,null))[_0x86d0('0x22')](function(_0x4493bd){if(_0x4493bd){_0x3e8661[_0x86d0('0xa2')]=_['omit'](_0x4493bd,[_0x86d0('0xa1')]);if(_0x4493bd[_0x86d0('0xa1')]['length']){return _0x4493bd['Contacts'][0x0];}var _0x433c39=_[_0x86d0('0x1c')](_0x3e8661[_0x86d0('0x61')],{'firstName':_0x3e8661[_0x86d0('0x61')][_0x86d0('0x9c')],'ListId':_0x4493bd['id']});_0x433c39[_0x3e8661[_0x86d0('0x61')]['mapKey']]=_0x3e8661[_0x86d0('0x61')][_0x86d0('0x9c')];return db[_0x86d0('0x8e')][_0x86d0('0x60')](_0x433c39,{'fields':_0x3968be,'raw':!![]});}})[_0x86d0('0x22')](handleEntityNotFound(_0x47c3d0,null))[_0x86d0('0x22')](function(_0x1ec716){if(_0x1ec716){_0x3e8661['contact']=_0x1ec716;var _0x200a94={'ContactId':_0x1ec716['id'],'phone':_0x3e8661['body'][_0x86d0('0x9c')],'WhatsappAccountId':_0x242673[_0x86d0('0x5c')]['id']};var _0x571e8c={'ContactId':_0x1ec716['id'],'WhatsappAccountId':_0x242673['params']['id'],'closed':![]};return db['WhatsappInteraction'][_0x86d0('0x5f')]({'where':_0x571e8c})[_0x86d0('0x22')](function(_0x16b6f8){if(_0x16b6f8){return[_0x16b6f8,![]];}return db[_0x86d0('0xa3')][_0x86d0('0x60')](_0x200a94)[_0x86d0('0x22')](function(_0x49f492){return[_0x49f492,!![]];});});}})[_0x86d0('0xa4')](function(_0x3712e5,_0x100a67){_0x3e8661[_0x86d0('0xa5')]=_0x3712e5[_0x86d0('0x3b')]({'plain':!![]});_0x3e8661[_0x86d0('0xa5')][_0x86d0('0xa6')]=![];if(_0x100a67){if(_0x3e8661['account'][_0x86d0('0xa7')]){_0x3e8661['applications']['push']({'id':0x0,'priority':_0x3e8661[_0x86d0('0xa8')][_0x86d0('0x4e')]+0x1,'app':_0x86d0('0xa9'),'appdata':_0x86d0('0xaa'),'interval':_0x86d0('0xab')});}_0x3e8661['interaction'][_0x86d0('0xa6')]=!![];}return db[_0x86d0('0x89')][_0x86d0('0x60')]({'phone':_0x3e8661[_0x86d0('0x61')][_0x86d0('0x9c')],'messageId':_0x3e8661[_0x86d0('0x61')][_0x86d0('0x9a')],'body':_0x3e8661[_0x86d0('0x61')][_0x86d0('0x61')],'WhatsappAccountId':_0x242673[_0x86d0('0x5c')]['id'],'WhatsappInteractionId':_0x3712e5['id'],'direction':'in','ContactId':_0x3712e5[_0x86d0('0xac')],'AttachmentId':_0x3e8661['body'][_0x86d0('0xad')]});})['then'](function(_0x2f1af9){_0x3e8661[_0x86d0('0x2b')]=_0x2f1af9;if(!_0x3e8661['interaction'][_0x86d0('0xae')])return;return db[_0x86d0('0x7a')][_0x86d0('0x5f')]({'attributes':['id',_0x86d0('0x3f')],'where':{'id':_0x3e8661[_0x86d0('0xa5')][_0x86d0('0xae')]}});})[_0x86d0('0x22')](function(_0x21f38f){if(_0x21f38f){_0x3e8661[_0x86d0('0xa8')][_0x86d0('0xaf')]({'id':0x0,'priority':0x0,'app':_0x86d0('0xb0'),'appdata':_0x21f38f[_0x86d0('0x3f')]+','+(_0x3e8661[_0x86d0('0x84')]['waitForTheAssignedAgent']||0xa),'interval':'*,*,*,*'});}if(!_0x3e8661[_0x86d0('0xa5')][_0x86d0('0xb1')])return;return db[_0x86d0('0xb2')][_0x86d0('0x5f')]({'attributes':['id',_0x86d0('0x3f')],'where':{'id':_0x3e8661[_0x86d0('0xa5')]['queueId']}});})['then'](function(_0x4c669d){if(_0x4c669d){_0x3e8661['applications']['unshift']({'id':0x0,'priority':0x1,'app':_0x86d0('0xb3'),'appdata':_0x4c669d[_0x86d0('0x3f')]+','+(_0x3e8661[_0x86d0('0x84')][_0x86d0('0xb4')]||0x12c),'interval':_0x86d0('0xab')});}return respondWithRpcPromise('Start',_0x86d0('0xb5'),_0x3e8661);})[_0x86d0('0x22')](function(_0x18cc3f){if(_0x18cc3f){var _0x5823ff=0xc8;var _0x1a50ea=_0x86d0('0xb6');logger[_0x86d0('0x23')](_0x86d0('0x27'),_0x1a50ea,_0x5823ff,'entity\x20found');logger[_0x86d0('0x26')](_0x86d0('0xb7'),_0x1a50ea,_0x5823ff,_0x86d0('0xb8'),JSON[_0x86d0('0x28')](_0x18cc3f));if(_0x3e8661[_0x86d0('0x84')]['type']===_0x86d0('0x96')){return _0x47c3d0[_0x86d0('0x2e')](_0x5823ff)[_0x86d0('0x35')](_0x86d0('0xb9'),_0x86d0('0xba'))['send'](_0x86d0('0xbb'));}else{return _0x47c3d0[_0x86d0('0x2e')](_0x5823ff)[_0x86d0('0x30')](_0x18cc3f);}}});})['catch'](handleError(_0x47c3d0,null));};exports[_0x86d0('0x81')]=function(_0x198b60,_0x599bb7,_0x523d53){var _0x531f56,_0x379174,_0xf3c49e;if(_[_0x86d0('0x9e')](_0x198b60['body'][_0x86d0('0x61')])||_0x198b60[_0x86d0('0x61')][_0x86d0('0x61')]===''){throw new db['Sequelize'][(_0x86d0('0x90'))](_0x86d0('0xbc'));}if(_[_0x86d0('0x9e')](_0x198b60[_0x86d0('0x61')]['to'])){throw new db[(_0x86d0('0x8f'))]['ValidationError']('to\x20is\x20mandatory');}_0x531f56=_0x198b60['body']['to'];return db[_0x86d0('0x44')][_0x86d0('0x5f')]({'where':{'id':_0x198b60[_0x86d0('0x5c')]['id']},'include':[{'model':db[_0x86d0('0xbd')],'as':_0x86d0('0xbe'),'include':[{'model':db[_0x86d0('0x8e')],'as':_0x86d0('0xa1'),'where':{'mobile':_0x531f56},'limit':0x1,'order':[[_0x86d0('0x94'),_0x86d0('0xbf')]]}]}]})[_0x86d0('0x22')](handleEntityNotFound(_0x599bb7,null))['then'](function(_0x3e00a7){if(_0x3e00a7&&_0x3e00a7['List']){_0x379174=_0x3e00a7[_0x86d0('0x3b')]({'plain':!![]});if(_0x379174[_0x86d0('0xbe')]&&_0x379174[_0x86d0('0xbe')][_0x86d0('0xa1')][_0x86d0('0x4e')]){return _0x379174[_0x86d0('0xbe')]['Contacts'][0x0];}return db['CmContact'][_0x86d0('0x60')](_[_0x86d0('0x1c')](_0x198b60['body'],{'firstName':_0x531f56,'mobile':_0x531f56,'phone':_0x531f56,'ListId':_0x379174[_0x86d0('0xc0')]}));}})['then'](handleEntityNotFound(_0x599bb7,null))[_0x86d0('0x22')](function(_0x48f23d){if(_0x48f23d){_0xf3c49e=_0x48f23d;return db[_0x86d0('0xa3')][_0x86d0('0x5f')]({'where':{'ContactId':_0xf3c49e['id'],'closed':![],'WhatsappAccountId':_0x379174['id']}})['then'](function(_0x253836){if(_0x253836){return[_0x253836,![]];}return db[_0x86d0('0xa3')][_0x86d0('0x60')]({'UserId':_0x198b60[_0x86d0('0x62')]['id'],'ContactId':_0xf3c49e['id'],'WhatsappAccountId':_0x379174['id'],'phone':_0x531f56,'firstMsgDirection':_0x86d0('0xc1'),'Messages':[_[_0x86d0('0x56')](_0x198b60['body'],{'read':![],'body':_0x198b60['body'][_0x86d0('0x61')],'phone':_0x531f56,'WhatsappAccountId':_0x379174['id'],'UserId':_0x198b60[_0x86d0('0x62')]['id'],'ContactId':_0xf3c49e['id']})]},{'include':[{'model':db[_0x86d0('0x89')],'as':'Messages'}]})[_0x86d0('0x22')](function(_0x5c7d70){return[_0x5c7d70,!![]];});});}})[_0x86d0('0xa4')](function(_0x1df1f0,_0x4f24e8){if(_0x4f24e8){return _0x1df1f0;}return db[_0x86d0('0x89')][_0x86d0('0x60')](_[_0x86d0('0x56')](_0x198b60[_0x86d0('0x61')],{'read':![],'body':_0x198b60[_0x86d0('0x61')][_0x86d0('0x61')],'phone':_0x531f56,'WhatsappAccountId':_0x379174['id'],'WhatsappInteractionId':_0x1df1f0['id'],'UserId':_0x198b60[_0x86d0('0x62')]['id'],'ContactId':_0xf3c49e['id']}))[_0x86d0('0x22')](function(_0x21a066){_0x1df1f0[_0x86d0('0xc2')][_0x86d0('0xc3')]=[];_0x1df1f0['dataValues'][_0x86d0('0xc3')][_0x86d0('0xc4')](_0x21a066[_0x86d0('0xc2')]);return _0x1df1f0;});})[_0x86d0('0x22')](respondWithResult(_0x599bb7,null))[_0x86d0('0x2c')](handleError(_0x599bb7,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index 37bbbbf..3dbfc73 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 _0x8fda=['save','update','remove','emit','hasOwnProperty','hook','../../mysqldb','WhatsappAccount','setMaxListeners'];(function(_0x3e7bf3,_0x3839cc){var _0xad4708=function(_0x1558d7){while(--_0x1558d7){_0x3e7bf3['push'](_0x3e7bf3['shift']());}};_0xad4708(++_0x3839cc);}(_0x8fda,0x7b));var _0xa8fd=function(_0x2427bc,_0x4c016d){_0x2427bc=_0x2427bc-0x0;var _0x21d800=_0x8fda[_0x2427bc];return _0x21d800;};'use strict';var EventEmitter=require('events');var WhatsappAccount=require(_0xa8fd('0x0'))['db'][_0xa8fd('0x1')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0xa8fd('0x2')](0x0);var events={'afterCreate':_0xa8fd('0x3'),'afterUpdate':_0xa8fd('0x4'),'afterDestroy':_0xa8fd('0x5')};function emitEvent(_0x5936fa){return function(_0x35e693,_0x598353,_0x42d068){WhatsappAccountEvents[_0xa8fd('0x6')](_0x5936fa+':'+_0x35e693['id'],_0x35e693);WhatsappAccountEvents[_0xa8fd('0x6')](_0x5936fa,_0x35e693);_0x42d068(null);};}for(var e in events){if(events[_0xa8fd('0x7')](e)){var event=events[e];WhatsappAccount[_0xa8fd('0x8')](e,emitEvent(event));}}module['exports']=WhatsappAccountEvents; \ No newline at end of file +var _0x1c8d=['save','emit','hook','events','../../mysqldb','setMaxListeners'];(function(_0x8eb144,_0x2dbbc5){var _0x3fe8d7=function(_0x234111){while(--_0x234111){_0x8eb144['push'](_0x8eb144['shift']());}};_0x3fe8d7(++_0x2dbbc5);}(_0x1c8d,0x189));var _0xd1c8=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x1c8d[_0x3bf83f];return _0x22c4a9;};'use strict';var EventEmitter=require(_0xd1c8('0x0'));var WhatsappAccount=require(_0xd1c8('0x1'))['db']['WhatsappAccount'];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0xd1c8('0x2')](0x0);var events={'afterCreate':_0xd1c8('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x59555d){return function(_0xf9d922,_0x31a614,_0x4da553){WhatsappAccountEvents[_0xd1c8('0x4')](_0x59555d+':'+_0xf9d922['id'],_0xf9d922);WhatsappAccountEvents['emit'](_0x59555d,_0xf9d922);_0x4da553(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappAccount[_0xd1c8('0x5')](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 7fc5287..c3d021e 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 _0x07c8=['rimraf','../../config/environment','./whatsappAccount.attributes','exports','whatsapp_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x22789a,_0x4a1c8c){var _0xede88=function(_0x49243f){while(--_0x49243f){_0x22789a['push'](_0x22789a['shift']());}};_0xede88(++_0x4a1c8c);}(_0x07c8,0x179));var _0x807c=function(_0x506758,_0x330b9f){_0x506758=_0x506758-0x0;var _0x2ad411=_0x07c8[_0x506758];return _0x2ad411;};'use strict';var _=require(_0x807c('0x0'));var util=require(_0x807c('0x1'));var logger=require(_0x807c('0x2'))(_0x807c('0x3'));var moment=require(_0x807c('0x4'));var BPromise=require(_0x807c('0x5'));var rp=require(_0x807c('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x807c('0x7'));var config=require(_0x807c('0x8'));var attributes=require(_0x807c('0x9'));module[_0x807c('0xa')]=function(_0x450325,_0xc42c81){return _0x450325['define']('WhatsappAccount',attributes,{'tableName':_0x807c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4159=['request-promise','rimraf','../../config/environment','./whatsappAccount.attributes','define','WhatsappAccount','whatsapp_accounts','lodash','util','api','bluebird'];(function(_0x1dbd36,_0x3691fd){var _0x41196f=function(_0x3def44){while(--_0x3def44){_0x1dbd36['push'](_0x1dbd36['shift']());}};_0x41196f(++_0x3691fd);}(_0x4159,0x1e0));var _0x9415=function(_0x21f0b3,_0x39742c){_0x21f0b3=_0x21f0b3-0x0;var _0x282510=_0x4159[_0x21f0b3];return _0x282510;};'use strict';var _=require(_0x9415('0x0'));var util=require(_0x9415('0x1'));var logger=require('../../config/logger')(_0x9415('0x2'));var moment=require('moment');var BPromise=require(_0x9415('0x3'));var rp=require(_0x9415('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9415('0x5'));var config=require(_0x9415('0x6'));var attributes=require(_0x9415('0x7'));module['exports']=function(_0xbbc9df,_0x410f6c){return _0xbbc9df[_0x9415('0x8')](_0x9415('0x9'),attributes,{'tableName':_0x9415('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 6bd8ffd..d2a285a 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 _0x91ba=['WhatsappAccount','options','raw','where','include','map','model','attributes','lodash','util','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','redis','socket.io-emitter','./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','ShowWhatsappAccount'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x91ba,0x74));var _0xa91b=function(_0x5e8d3a,_0x2ac363){_0x5e8d3a=_0x5e8d3a-0x0;var _0x3a0dbb=_0x91ba[_0x5e8d3a];return _0x3a0dbb;};'use strict';var _=require(_0xa91b('0x0'));var util=require(_0xa91b('0x1'));var moment=require(_0xa91b('0x2'));var BPromise=require(_0xa91b('0x3'));var rs=require(_0xa91b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa91b('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xa91b('0x6'));var config=require(_0xa91b('0x7'));var jayson=require(_0xa91b('0x8'));var client=jayson[_0xa91b('0x9')]['http']({'port':0x232a});config[_0xa91b('0xa')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xa91b('0xb'))(new Redis(config[_0xa91b('0xa')]));require(_0xa91b('0xc'))[_0xa91b('0xd')](socket);function respondWithRpcPromise(_0x2bf9bc,_0xa95a5b,_0x584186){return new BPromise(function(_0x56fce7,_0x5b7810){return client[_0xa91b('0xe')](_0x2bf9bc,_0x584186)[_0xa91b('0xf')](function(_0x1e04ad){logger['info'](_0xa91b('0x10'),_0xa95a5b,_0xa91b('0x11'));logger[_0xa91b('0x12')](_0xa91b('0x13'),_0xa95a5b,_0xa91b('0x11'),JSON[_0xa91b('0x14')](_0x1e04ad));if(_0x1e04ad[_0xa91b('0x15')]){if(_0x1e04ad[_0xa91b('0x15')][_0xa91b('0x16')]===0x1f4){logger[_0xa91b('0x15')](_0xa91b('0x10'),_0xa95a5b,_0x1e04ad[_0xa91b('0x15')][_0xa91b('0x17')]);return _0x5b7810(_0x1e04ad['error'][_0xa91b('0x17')]);}logger[_0xa91b('0x15')](_0xa91b('0x10'),_0xa95a5b,_0x1e04ad[_0xa91b('0x15')][_0xa91b('0x17')]);return _0x56fce7(_0x1e04ad[_0xa91b('0x15')][_0xa91b('0x17')]);}else{logger[_0xa91b('0x18')](_0xa91b('0x10'),_0xa95a5b,_0xa91b('0x11'));_0x56fce7(_0x1e04ad[_0xa91b('0x19')][_0xa91b('0x17')]);}})[_0xa91b('0x1a')](function(_0x1be665){logger['error'](_0xa91b('0x10'),_0xa95a5b,_0x1be665);_0x5b7810(_0x1be665);});});}exports[_0xa91b('0x1b')]=function(_0x36e6fd){var _0x29b141=this;return new Promise(function(_0xdb489c,_0x397560){return db[_0xa91b('0x1c')]['find']({'raw':_0x36e6fd['options']?_0x36e6fd[_0xa91b('0x1d')][_0xa91b('0x1e')]===undefined?!![]:![]:!![],'where':_0x36e6fd[_0xa91b('0x1d')]?_0x36e6fd[_0xa91b('0x1d')][_0xa91b('0x1f')]||null:null,'attributes':_0x36e6fd[_0xa91b('0x1d')]?_0x36e6fd[_0xa91b('0x1d')]['attributes']||null:null,'include':_0x36e6fd[_0xa91b('0x1d')]?_0x36e6fd[_0xa91b('0x1d')][_0xa91b('0x20')]?_[_0xa91b('0x21')](_0x36e6fd[_0xa91b('0x1d')][_0xa91b('0x20')],function(_0x4626e7){return{'model':db[_0x4626e7[_0xa91b('0x22')]],'as':_0x4626e7['as'],'attributes':_0x4626e7[_0xa91b('0x23')],'include':_0x4626e7[_0xa91b('0x20')]?_[_0xa91b('0x21')](_0x4626e7[_0xa91b('0x20')],function(_0x3ff22c){return{'model':db[_0x3ff22c['model']],'as':_0x3ff22c['as'],'attributes':_0x3ff22c['attributes'],'include':_0x3ff22c[_0xa91b('0x20')]?_['map'](_0x3ff22c[_0xa91b('0x20')],function(_0x55b815){return{'model':db[_0x55b815['model']],'as':_0x55b815['as'],'attributes':_0x55b815[_0xa91b('0x23')]};}):[]};}):[]};}):[]:[]})[_0xa91b('0xf')](function(_0x1862e5){logger[_0xa91b('0x18')](_0xa91b('0x1b'),_0x36e6fd);logger[_0xa91b('0x12')](_0xa91b('0x1b'),_0x36e6fd,JSON[_0xa91b('0x14')](_0x1862e5));_0xdb489c(_0x1862e5);})[_0xa91b('0x1a')](function(_0x3a1279){logger[_0xa91b('0x15')](_0xa91b('0x1b'),_0x3a1279[_0xa91b('0x17')],_0x36e6fd);_0x397560(_0x29b141[_0xa91b('0x15')](0x1f4,_0x3a1279[_0xa91b('0x17')]));});});}; \ No newline at end of file +var _0x9176=['options','attributes','include','map','model','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','./whatsappAccount.socket','register','request','then','info','stringify','error','message','WhatsappAccount,\x20%s,\x20%s','request\x20sent','catch','ShowWhatsappAccount','WhatsappAccount','find','raw'];(function(_0x52b839,_0x4f40e4){var _0x52d00f=function(_0x5012a1){while(--_0x5012a1){_0x52b839['push'](_0x52b839['shift']());}};_0x52d00f(++_0x4f40e4);}(_0x9176,0x164));var _0x6917=function(_0x5050c3,_0x329596){_0x5050c3=_0x5050c3-0x0;var _0x370fbf=_0x9176[_0x5050c3];return _0x370fbf;};'use strict';var _=require(_0x6917('0x0'));var util=require(_0x6917('0x1'));var moment=require(_0x6917('0x2'));var BPromise=require(_0x6917('0x3'));var rs=require(_0x6917('0x4'));var fs=require('fs');var Redis=require(_0x6917('0x5'));var db=require(_0x6917('0x6'))['db'];var utils=require(_0x6917('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x6917('0x8'));var jayson=require(_0x6917('0x9'));var client=jayson[_0x6917('0xa')][_0x6917('0xb')]({'port':0x232a});config[_0x6917('0xc')]=_['defaults'](config[_0x6917('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x6917('0xd'))(new Redis(config['redis']));require(_0x6917('0xe'))[_0x6917('0xf')](socket);function respondWithRpcPromise(_0x24d878,_0x56a4f6,_0x11fc8b){return new BPromise(function(_0x53a1de,_0x4610d4){return client[_0x6917('0x10')](_0x24d878,_0x11fc8b)[_0x6917('0x11')](function(_0xbf96a7){logger[_0x6917('0x12')]('WhatsappAccount,\x20%s,\x20%s',_0x56a4f6,'request\x20sent');logger['debug']('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x56a4f6,'request\x20sent',JSON[_0x6917('0x13')](_0xbf96a7));if(_0xbf96a7[_0x6917('0x14')]){if(_0xbf96a7[_0x6917('0x14')]['code']===0x1f4){logger[_0x6917('0x14')]('WhatsappAccount,\x20%s,\x20%s',_0x56a4f6,_0xbf96a7[_0x6917('0x14')]['message']);return _0x4610d4(_0xbf96a7[_0x6917('0x14')][_0x6917('0x15')]);}logger['error'](_0x6917('0x16'),_0x56a4f6,_0xbf96a7['error']['message']);return _0x53a1de(_0xbf96a7[_0x6917('0x14')][_0x6917('0x15')]);}else{logger[_0x6917('0x12')]('WhatsappAccount,\x20%s,\x20%s',_0x56a4f6,_0x6917('0x17'));_0x53a1de(_0xbf96a7['result'][_0x6917('0x15')]);}})[_0x6917('0x18')](function(_0x1d8b8b){logger[_0x6917('0x14')]('WhatsappAccount,\x20%s,\x20%s',_0x56a4f6,_0x1d8b8b);_0x4610d4(_0x1d8b8b);});});}exports[_0x6917('0x19')]=function(_0x39eeb9){var _0x39fd85=this;return new Promise(function(_0x1728f4,_0x334629){return db[_0x6917('0x1a')][_0x6917('0x1b')]({'raw':_0x39eeb9['options']?_0x39eeb9['options'][_0x6917('0x1c')]===undefined?!![]:![]:!![],'where':_0x39eeb9[_0x6917('0x1d')]?_0x39eeb9[_0x6917('0x1d')]['where']||null:null,'attributes':_0x39eeb9['options']?_0x39eeb9['options'][_0x6917('0x1e')]||null:null,'include':_0x39eeb9[_0x6917('0x1d')]?_0x39eeb9[_0x6917('0x1d')][_0x6917('0x1f')]?_[_0x6917('0x20')](_0x39eeb9[_0x6917('0x1d')][_0x6917('0x1f')],function(_0x42ab0d){return{'model':db[_0x42ab0d['model']],'as':_0x42ab0d['as'],'attributes':_0x42ab0d[_0x6917('0x1e')],'include':_0x42ab0d[_0x6917('0x1f')]?_[_0x6917('0x20')](_0x42ab0d[_0x6917('0x1f')],function(_0x3ca45a){return{'model':db[_0x3ca45a[_0x6917('0x21')]],'as':_0x3ca45a['as'],'attributes':_0x3ca45a[_0x6917('0x1e')],'include':_0x3ca45a['include']?_[_0x6917('0x20')](_0x3ca45a[_0x6917('0x1f')],function(_0x44ff4c){return{'model':db[_0x44ff4c[_0x6917('0x21')]],'as':_0x44ff4c['as'],'attributes':_0x44ff4c['attributes']};}):[]};}):[]};}):[]:[]})[_0x6917('0x11')](function(_0x3de9b6){logger[_0x6917('0x12')](_0x6917('0x19'),_0x39eeb9);logger[_0x6917('0x22')](_0x6917('0x19'),_0x39eeb9,JSON[_0x6917('0x13')](_0x3de9b6));_0x1728f4(_0x3de9b6);})[_0x6917('0x18')](function(_0x1fbdd9){logger[_0x6917('0x14')]('ShowWhatsappAccount',_0x1fbdd9[_0x6917('0x15')],_0x39eeb9);_0x334629(_0x39fd85['error'](0x1f4,_0x1fbdd9[_0x6917('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index 36b9543..6bff121 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 _0x32ce=['save','remove','emit','removeListener','register','length','./whatsappAccount.events'];(function(_0x37bd26,_0x5ad346){var _0xe83dc4=function(_0x1ac229){while(--_0x1ac229){_0x37bd26['push'](_0x37bd26['shift']());}};_0xe83dc4(++_0x5ad346);}(_0x32ce,0x68));var _0xe32c=function(_0x832089,_0x2b271a){_0x832089=_0x832089-0x0;var _0x1d5ce1=_0x32ce[_0x832089];return _0x1d5ce1;};'use strict';var WhatsappAccountEvents=require(_0xe32c('0x0'));var events=[_0xe32c('0x1'),_0xe32c('0x2'),'update'];function createListener(_0x527af6,_0x568d52){return function(_0x517597){_0x568d52[_0xe32c('0x3')](_0x527af6,_0x517597);};}function removeListener(_0x1b00d8,_0xde021e){return function(){WhatsappAccountEvents[_0xe32c('0x4')](_0x1b00d8,_0xde021e);};}exports[_0xe32c('0x5')]=function(_0x33bcf7){for(var _0x25a872=0x0,_0x3b26e3=events[_0xe32c('0x6')];_0x25a872<_0x3b26e3;_0x25a872++){var _0x5a6a28=events[_0x25a872];var _0x563063=createListener('whatsappAccount:'+_0x5a6a28,_0x33bcf7);WhatsappAccountEvents['on'](_0x5a6a28,_0x563063);}}; \ No newline at end of file +var _0x11bc=['save','remove','update','emit','removeListener','whatsappAccount:','./whatsappAccount.events'];(function(_0x2601b4,_0x315e78){var _0x3e3661=function(_0x13b45b){while(--_0x13b45b){_0x2601b4['push'](_0x2601b4['shift']());}};_0x3e3661(++_0x315e78);}(_0x11bc,0x92));var _0xc11b=function(_0x12d5a5,_0x440b27){_0x12d5a5=_0x12d5a5-0x0;var _0x34efef=_0x11bc[_0x12d5a5];return _0x34efef;};'use strict';var WhatsappAccountEvents=require(_0xc11b('0x0'));var events=[_0xc11b('0x1'),_0xc11b('0x2'),_0xc11b('0x3')];function createListener(_0x45a0d2,_0x4355c7){return function(_0x26e7d1){_0x4355c7[_0xc11b('0x4')](_0x45a0d2,_0x26e7d1);};}function removeListener(_0x5f3634,_0x2ed527){return function(){WhatsappAccountEvents[_0xc11b('0x5')](_0x5f3634,_0x2ed527);};}exports['register']=function(_0x2c6a30){for(var _0x2da837=0x0,_0x229beb=events['length'];_0x2da837<_0x229beb;_0x2da837++){var _0x55223d=events[_0x2da837];var _0x5ac3e4=createListener(_0xc11b('0x6')+_0x55223d,_0x2c6a30);WhatsappAccountEvents['on'](_0x55223d,_0x5ac3e4);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index 56cd2f6..514a0b4 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 _0xd43c=['util','path','express','Router','../../components/auth/service','./whatsappApplication.controller','get','index','/:id','isAuthenticated','show','create','put','update','delete','destroy','multer'];(function(_0x4d5220,_0x27f582){var _0x1aadd2=function(_0x1641f7){while(--_0x1641f7){_0x4d5220['push'](_0x4d5220['shift']());}};_0x1aadd2(++_0x27f582);}(_0xd43c,0x175));var _0xcd43=function(_0x15ee45,_0x543b6b){_0x15ee45=_0x15ee45-0x0;var _0x13660f=_0xd43c[_0x15ee45];return _0x13660f;};'use strict';var multer=require(_0xcd43('0x0'));var util=require(_0xcd43('0x1'));var path=require(_0xcd43('0x2'));var timeout=require('connect-timeout');var express=require(_0xcd43('0x3'));var router=express[_0xcd43('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xcd43('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xcd43('0x6'));router[_0xcd43('0x7')]('/',auth['isAuthenticated'](),controller[_0xcd43('0x8')]);router['get'](_0xcd43('0x9'),auth[_0xcd43('0xa')](),controller[_0xcd43('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0xcd43('0xc')]);router[_0xcd43('0xd')](_0xcd43('0x9'),auth[_0xcd43('0xa')](),controller[_0xcd43('0xe')]);router[_0xcd43('0xf')]('/:id',auth[_0xcd43('0xa')](),controller[_0xcd43('0x10')]);module['exports']=router; \ No newline at end of file +var _0x5ed4=['show','post','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','get','isAuthenticated','index','/:id'];(function(_0x178e39,_0x3c54c9){var _0x2f1023=function(_0x483161){while(--_0x483161){_0x178e39['push'](_0x178e39['shift']());}};_0x2f1023(++_0x3c54c9);}(_0x5ed4,0x1aa));var _0x45ed=function(_0xb574a5,_0xfe664f){_0xb574a5=_0xb574a5-0x0;var _0x24ab1f=_0x5ed4[_0xb574a5];return _0x24ab1f;};'use strict';var multer=require(_0x45ed('0x0'));var util=require(_0x45ed('0x1'));var path=require(_0x45ed('0x2'));var timeout=require(_0x45ed('0x3'));var express=require(_0x45ed('0x4'));var router=express[_0x45ed('0x5')]();var fs_extra=require(_0x45ed('0x6'));var auth=require(_0x45ed('0x7'));var interaction=require(_0x45ed('0x8'));var config=require(_0x45ed('0x9'));var controller=require(_0x45ed('0xa'));router[_0x45ed('0xb')]('/',auth[_0x45ed('0xc')](),controller[_0x45ed('0xd')]);router[_0x45ed('0xb')](_0x45ed('0xe'),auth[_0x45ed('0xc')](),controller[_0x45ed('0xf')]);router[_0x45ed('0x10')]('/',auth[_0x45ed('0xc')](),controller['create']);router[_0x45ed('0x11')](_0x45ed('0xe'),auth[_0x45ed('0xc')](),controller['update']);router[_0x45ed('0x12')](_0x45ed('0xe'),auth[_0x45ed('0xc')](),controller[_0x45ed('0x13')]);module[_0x45ed('0x14')]=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index e994a28..9f45009 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 _0xce10=['sequelize','exports','noop','*,*,*,*'];(function(_0x3c24e7,_0x2031f6){var _0x41cbe9=function(_0x2122bd){while(--_0x2122bd){_0x3c24e7['push'](_0x3c24e7['shift']());}};_0x41cbe9(++_0x2031f6);}(_0xce10,0x94));var _0x0ce1=function(_0x591cfd,_0x501204){_0x591cfd=_0x591cfd-0x0;var _0x4d0100=_0xce10[_0x591cfd];return _0x4d0100;};'use strict';var Sequelize=require(_0x0ce1('0x0'));module[_0x0ce1('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x0ce1('0x2')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x0ce1('0x3')}}; \ No newline at end of file +var _0xa051=['*,*,*,*','sequelize','exports','INTEGER','STRING','noop','TEXT'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa051,0x189));var _0x1a05=function(_0x1e3d52,_0x568f40){_0x1e3d52=_0x1e3d52-0x0;var _0x3b3e46=_0xa051[_0x1e3d52];return _0x3b3e46;};'use strict';var Sequelize=require(_0x1a05('0x0'));module[_0x1a05('0x1')]={'priority':{'type':Sequelize[_0x1a05('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x1a05('0x3')],'allowNull':![],'defaultValue':_0x1a05('0x4')},'appdata':{'type':Sequelize[_0x1a05('0x5')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x1a05('0x3')],'defaultValue':_0x1a05('0x6')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index 176475e..347d7ae 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 _0x095b=['limit','Content-Range','apply','save','update','error','stack','name','map','WhatsappApplication','rawAttributes','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filters','filter','VIRTUAL','merge','options','then','includeAll','include','findAll','catch','find','body','destroy','params','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','count','offset'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x095b,0x6e));var _0xb095=function(_0x49f289,_0x375848){_0x49f289=_0x49f289-0x0;var _0xe36292=_0x095b[_0x49f289];return _0xe36292;};'use strict';var emlformat=require(_0xb095('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb095('0x1'));var jsonpatch=require(_0xb095('0x2'));var rp=require(_0xb095('0x3'));var moment=require(_0xb095('0x4'));var BPromise=require(_0xb095('0x5'));var Mustache=require('mustache');var util=require(_0xb095('0x6'));var path=require(_0xb095('0x7'));var sox=require(_0xb095('0x8'));var csv=require(_0xb095('0x9'));var ejs=require(_0xb095('0xa'));var fs=require('fs');var fs_extra=require(_0xb095('0xb'));var _=require(_0xb095('0xc'));var squel=require(_0xb095('0xd'));var crypto=require(_0xb095('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xb095('0xf'));var toCsv=require(_0xb095('0x9'));var querystring=require(_0xb095('0x10'));var Papa=require(_0xb095('0x11'));var Redis=require(_0xb095('0x12'));var authService=require(_0xb095('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb095('0x14'));var logger=require(_0xb095('0x15'))('api');var utils=require(_0xb095('0x16'));var config=require(_0xb095('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xb095('0x18'))['db'];function respondWithStatusCode(_0x5e0fb3,_0x7b6edf){_0x7b6edf=_0x7b6edf||0xcc;return function(_0x23dcc5){if(_0x23dcc5){return _0x5e0fb3[_0xb095('0x19')](_0x7b6edf);}return _0x5e0fb3[_0xb095('0x1a')](_0x7b6edf)[_0xb095('0x1b')]();};}function respondWithResult(_0x394df0,_0x781a3f){_0x781a3f=_0x781a3f||0xc8;return function(_0x4afb4d){if(_0x4afb4d){return _0x394df0[_0xb095('0x1a')](_0x781a3f)[_0xb095('0x1c')](_0x4afb4d);}};}function respondWithFilteredResult(_0x44280b,_0x2e6a89){return function(_0xd92481){if(_0xd92481){var _0x2568f8=typeof _0x2e6a89['offset']==='undefined'&&typeof _0x2e6a89['limit']===_0xb095('0x1d');var _0x2c4e86=_0xd92481[_0xb095('0x1e')];var _0x54d06=_0x2568f8?0x0:_0x2e6a89[_0xb095('0x1f')];var _0x7f0681=_0x2568f8?_0xd92481['count']:_0x2e6a89[_0xb095('0x1f')]+_0x2e6a89[_0xb095('0x20')];var _0x27e1d0;if(_0x7f0681>=_0x2c4e86){_0x7f0681=_0x2c4e86;_0x27e1d0=0xc8;}else{_0x27e1d0=0xce;}_0x44280b[_0xb095('0x1a')](_0x27e1d0);return _0x44280b['set'](_0xb095('0x21'),_0x54d06+'-'+_0x7f0681+'/'+_0x2c4e86)[_0xb095('0x1c')](_0xd92481);}return null;};}function patchUpdates(_0x2273f8){return function(_0x318687){try{jsonpatch[_0xb095('0x22')](_0x318687,_0x2273f8,!![]);}catch(_0x2af120){return BPromise['reject'](_0x2af120);}return _0x318687[_0xb095('0x23')]();};}function saveUpdates(_0x525a1a,_0x51750f){return function(_0x4ef4a9){if(_0x4ef4a9){return _0x4ef4a9[_0xb095('0x24')](_0x525a1a)['then'](function(_0x39f9de){return _0x39f9de;});}return null;};}function removeEntity(_0x4650f1,_0x2f1a8b){return function(_0x32d1e6){if(_0x32d1e6){return _0x32d1e6['destroy']()['then'](function(){_0x4650f1[_0xb095('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3c6488,_0x1bbe29){return function(_0x1f1206){if(!_0x1f1206){_0x3c6488['sendStatus'](0x194);}return _0x1f1206;};}function handleError(_0x3e2095,_0x608591){_0x608591=_0x608591||0x1f4;return function(_0x3cb69f){logger[_0xb095('0x25')](_0x3cb69f[_0xb095('0x26')]);if(_0x3cb69f[_0xb095('0x27')]){delete _0x3cb69f[_0xb095('0x27')];}_0x3e2095[_0xb095('0x1a')](_0x608591)['send'](_0x3cb69f);};}exports['index']=function(_0xd6426c,_0x1d82a5){var _0x53803f={},_0x2f273f={},_0x3d00d1={'count':0x0,'rows':[]};var _0x468d94=_[_0xb095('0x28')](db[_0xb095('0x29')][_0xb095('0x2a')],function(_0xafd194){return{'name':_0xafd194['fieldName'],'type':_0xafd194[_0xb095('0x2b')][_0xb095('0x2c')]};});_0x2f273f[_0xb095('0x2d')]=_[_0xb095('0x28')](_0x468d94,_0xb095('0x27'));_0x2f273f[_0xb095('0x2e')]=_[_0xb095('0x2f')](_0xd6426c['query']);_0x2f273f['filters']=_['intersection'](_0x2f273f['model'],_0x2f273f['query']);_0x53803f[_0xb095('0x30')]=_[_0xb095('0x31')](_0x2f273f[_0xb095('0x2d')],qs[_0xb095('0x32')](_0xd6426c[_0xb095('0x2e')][_0xb095('0x32')]));_0x53803f[_0xb095('0x30')]=_0x53803f[_0xb095('0x30')][_0xb095('0x33')]?_0x53803f[_0xb095('0x30')]:_0x2f273f[_0xb095('0x2d')];if(!_0xd6426c['query'][_0xb095('0x34')](_0xb095('0x35'))){_0x53803f[_0xb095('0x20')]=qs['limit'](_0xd6426c['query'][_0xb095('0x20')]);_0x53803f[_0xb095('0x1f')]=qs[_0xb095('0x1f')](_0xd6426c[_0xb095('0x2e')]['offset']);}_0x53803f['order']=qs[_0xb095('0x36')](_0xd6426c['query'][_0xb095('0x36')]);_0x53803f[_0xb095('0x37')]=qs['filters'](_[_0xb095('0x38')](_0xd6426c[_0xb095('0x2e')],_0x2f273f[_0xb095('0x39')]),_0x468d94);if(_0xd6426c['query'][_0xb095('0x3a')]){_0x53803f[_0xb095('0x37')]=_['merge'](_0x53803f[_0xb095('0x37')],{'$or':_[_0xb095('0x28')](_0x468d94,function(_0x7dd3c9){if(_0x7dd3c9[_0xb095('0x2b')]!==_0xb095('0x3b')){var _0x3d5e17={};_0x3d5e17[_0x7dd3c9[_0xb095('0x27')]]={'$like':'%'+_0xd6426c[_0xb095('0x2e')]['filter']+'%'};return _0x3d5e17;}})});}_0x53803f=_[_0xb095('0x3c')]({},_0x53803f,_0xd6426c[_0xb095('0x3d')]);var _0x69cfbe={'where':_0x53803f[_0xb095('0x37')]};return db[_0xb095('0x29')][_0xb095('0x1e')](_0x69cfbe)[_0xb095('0x3e')](function(_0x1eb503){_0x3d00d1[_0xb095('0x1e')]=_0x1eb503;if(_0xd6426c[_0xb095('0x2e')][_0xb095('0x3f')]){_0x53803f[_0xb095('0x40')]=[{'all':!![]}];}return db[_0xb095('0x29')][_0xb095('0x41')](_0x53803f);})[_0xb095('0x3e')](function(_0x4f57ef){_0x3d00d1['rows']=_0x4f57ef;return _0x3d00d1;})[_0xb095('0x3e')](respondWithFilteredResult(_0x1d82a5,_0x53803f))[_0xb095('0x42')](handleError(_0x1d82a5,null));};exports['show']=function(_0x2a8178,_0x3f63fa){var _0x1582d5={'raw':!![],'where':{'id':_0x2a8178['params']['id']}},_0x367bce={};_0x367bce['model']=_[_0xb095('0x2f')](db[_0xb095('0x29')][_0xb095('0x2a')]);_0x367bce['query']=_['keys'](_0x2a8178['query']);_0x367bce[_0xb095('0x39')]=_['intersection'](_0x367bce[_0xb095('0x2d')],_0x367bce[_0xb095('0x2e')]);_0x1582d5[_0xb095('0x30')]=_['intersection'](_0x367bce[_0xb095('0x2d')],qs['fields'](_0x2a8178['query']['fields']));_0x1582d5[_0xb095('0x30')]=_0x1582d5['attributes'][_0xb095('0x33')]?_0x1582d5['attributes']:_0x367bce[_0xb095('0x2d')];if(_0x2a8178['query'][_0xb095('0x3f')]){_0x1582d5[_0xb095('0x40')]=[{'all':!![]}];}_0x1582d5=_[_0xb095('0x3c')]({},_0x1582d5,_0x2a8178['options']);return db[_0xb095('0x29')][_0xb095('0x43')](_0x1582d5)[_0xb095('0x3e')](handleEntityNotFound(_0x3f63fa,null))[_0xb095('0x3e')](respondWithResult(_0x3f63fa,null))[_0xb095('0x42')](handleError(_0x3f63fa,null));};exports['create']=function(_0x45c71c,_0x4ad545){return db['WhatsappApplication']['create'](_0x45c71c[_0xb095('0x44')],{})['then'](respondWithResult(_0x4ad545,0xc9))[_0xb095('0x42')](handleError(_0x4ad545,null));};exports[_0xb095('0x24')]=function(_0x5685e2,_0x32f642){if(_0x5685e2[_0xb095('0x44')]['id']){delete _0x5685e2[_0xb095('0x44')]['id'];}return db[_0xb095('0x29')][_0xb095('0x43')]({'where':{'id':_0x5685e2['params']['id']}})['then'](handleEntityNotFound(_0x32f642,null))[_0xb095('0x3e')](saveUpdates(_0x5685e2[_0xb095('0x44')],null))[_0xb095('0x3e')](respondWithResult(_0x32f642,null))['catch'](handleError(_0x32f642,null));};exports[_0xb095('0x45')]=function(_0xf0f9e6,_0x13bb46){return db[_0xb095('0x29')][_0xb095('0x43')]({'where':{'id':_0xf0f9e6[_0xb095('0x46')]['id']}})[_0xb095('0x3e')](handleEntityNotFound(_0x13bb46,null))['then'](removeEntity(_0x13bb46,null))[_0xb095('0x42')](handleError(_0x13bb46,null));}; \ No newline at end of file +var _0xd448=['sort','where','filter','merge','VIRTUAL','findAll','catch','show','params','keys','includeAll','include','find','create','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','Content-Range','reject','save','update','then','destroy','end','stack','name','send','index','map','WhatsappApplication','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order'];(function(_0x38fd45,_0x165051){var _0xc63717=function(_0xfef455){while(--_0xfef455){_0x38fd45['push'](_0x38fd45['shift']());}};_0xc63717(++_0x165051);}(_0xd448,0x172));var _0x8d44=function(_0xafbd95,_0x4d6704){_0xafbd95=_0xafbd95-0x0;var _0x54dbf9=_0xd448[_0xafbd95];return _0x54dbf9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8d44('0x0'));var zipdir=require(_0x8d44('0x1'));var jsonpatch=require(_0x8d44('0x2'));var rp=require(_0x8d44('0x3'));var moment=require(_0x8d44('0x4'));var BPromise=require(_0x8d44('0x5'));var Mustache=require(_0x8d44('0x6'));var util=require(_0x8d44('0x7'));var path=require(_0x8d44('0x8'));var sox=require(_0x8d44('0x9'));var csv=require('to-csv');var ejs=require(_0x8d44('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x8d44('0xb'));var crypto=require(_0x8d44('0xc'));var jsforce=require(_0x8d44('0xd'));var deskjs=require(_0x8d44('0xe'));var toCsv=require('to-csv');var querystring=require(_0x8d44('0xf'));var Papa=require(_0x8d44('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x8d44('0x11'));var as=require(_0x8d44('0x12'));var hardwareService=require(_0x8d44('0x13'));var logger=require('../../config/logger')(_0x8d44('0x14'));var utils=require(_0x8d44('0x15'));var config=require(_0x8d44('0x16'));var licenseUtil=require(_0x8d44('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x260f72,_0x67aeab){_0x67aeab=_0x67aeab||0xcc;return function(_0x1f73eb){if(_0x1f73eb){return _0x260f72[_0x8d44('0x18')](_0x67aeab);}return _0x260f72[_0x8d44('0x19')](_0x67aeab)['end']();};}function respondWithResult(_0x20f2cf,_0x41db66){_0x41db66=_0x41db66||0xc8;return function(_0x236a40){if(_0x236a40){return _0x20f2cf[_0x8d44('0x19')](_0x41db66)[_0x8d44('0x1a')](_0x236a40);}};}function respondWithFilteredResult(_0x59746c,_0x407d70){return function(_0x54aa00){if(_0x54aa00){var _0x35de0d=typeof _0x407d70[_0x8d44('0x1b')]===_0x8d44('0x1c')&&typeof _0x407d70[_0x8d44('0x1d')]===_0x8d44('0x1c');var _0x1f0e53=_0x54aa00[_0x8d44('0x1e')];var _0x1f29cb=_0x35de0d?0x0:_0x407d70['offset'];var _0x10d801=_0x35de0d?_0x54aa00[_0x8d44('0x1e')]:_0x407d70['offset']+_0x407d70[_0x8d44('0x1d')];var _0x12c37a;if(_0x10d801>=_0x1f0e53){_0x10d801=_0x1f0e53;_0x12c37a=0xc8;}else{_0x12c37a=0xce;}_0x59746c[_0x8d44('0x19')](_0x12c37a);return _0x59746c['set'](_0x8d44('0x1f'),_0x1f29cb+'-'+_0x10d801+'/'+_0x1f0e53)[_0x8d44('0x1a')](_0x54aa00);}return null;};}function patchUpdates(_0x2924e6){return function(_0xeaba9f){try{jsonpatch['apply'](_0xeaba9f,_0x2924e6,!![]);}catch(_0x31f991){return BPromise[_0x8d44('0x20')](_0x31f991);}return _0xeaba9f[_0x8d44('0x21')]();};}function saveUpdates(_0x4e39fe,_0x17b0eb){return function(_0x43c3fc){if(_0x43c3fc){return _0x43c3fc[_0x8d44('0x22')](_0x4e39fe)[_0x8d44('0x23')](function(_0x1f78c4){return _0x1f78c4;});}return null;};}function removeEntity(_0x4b5eb8,_0x45251a){return function(_0x2409ea){if(_0x2409ea){return _0x2409ea[_0x8d44('0x24')]()['then'](function(){_0x4b5eb8['status'](0xcc)[_0x8d44('0x25')]();});}};}function handleEntityNotFound(_0x105a12,_0x325a5a){return function(_0x22a9a7){if(!_0x22a9a7){_0x105a12[_0x8d44('0x18')](0x194);}return _0x22a9a7;};}function handleError(_0x288994,_0x2877d0){_0x2877d0=_0x2877d0||0x1f4;return function(_0x5f59ab){logger['error'](_0x5f59ab[_0x8d44('0x26')]);if(_0x5f59ab[_0x8d44('0x27')]){delete _0x5f59ab[_0x8d44('0x27')];}_0x288994[_0x8d44('0x19')](_0x2877d0)[_0x8d44('0x28')](_0x5f59ab);};}exports[_0x8d44('0x29')]=function(_0x41e47a,_0x4ce131){var _0x211834={},_0x5eb0c5={},_0x4bc6cb={'count':0x0,'rows':[]};var _0x35aa1e=_[_0x8d44('0x2a')](db[_0x8d44('0x2b')][_0x8d44('0x2c')],function(_0x42266e){return{'name':_0x42266e[_0x8d44('0x2d')],'type':_0x42266e[_0x8d44('0x2e')]['key']};});_0x5eb0c5[_0x8d44('0x2f')]=_['map'](_0x35aa1e,'name');_0x5eb0c5['query']=_['keys'](_0x41e47a[_0x8d44('0x30')]);_0x5eb0c5[_0x8d44('0x31')]=_[_0x8d44('0x32')](_0x5eb0c5[_0x8d44('0x2f')],_0x5eb0c5['query']);_0x211834[_0x8d44('0x33')]=_[_0x8d44('0x32')](_0x5eb0c5[_0x8d44('0x2f')],qs[_0x8d44('0x34')](_0x41e47a['query'][_0x8d44('0x34')]));_0x211834[_0x8d44('0x33')]=_0x211834[_0x8d44('0x33')][_0x8d44('0x35')]?_0x211834[_0x8d44('0x33')]:_0x5eb0c5[_0x8d44('0x2f')];if(!_0x41e47a['query'][_0x8d44('0x36')]('nolimit')){_0x211834[_0x8d44('0x1d')]=qs[_0x8d44('0x1d')](_0x41e47a[_0x8d44('0x30')][_0x8d44('0x1d')]);_0x211834[_0x8d44('0x1b')]=qs[_0x8d44('0x1b')](_0x41e47a[_0x8d44('0x30')][_0x8d44('0x1b')]);}_0x211834[_0x8d44('0x37')]=qs[_0x8d44('0x38')](_0x41e47a[_0x8d44('0x30')][_0x8d44('0x38')]);_0x211834[_0x8d44('0x39')]=qs[_0x8d44('0x31')](_['pick'](_0x41e47a['query'],_0x5eb0c5[_0x8d44('0x31')]),_0x35aa1e);if(_0x41e47a['query'][_0x8d44('0x3a')]){_0x211834[_0x8d44('0x39')]=_[_0x8d44('0x3b')](_0x211834[_0x8d44('0x39')],{'$or':_[_0x8d44('0x2a')](_0x35aa1e,function(_0x2ecba7){if(_0x2ecba7[_0x8d44('0x2e')]!==_0x8d44('0x3c')){var _0x397ae5={};_0x397ae5[_0x2ecba7[_0x8d44('0x27')]]={'$like':'%'+_0x41e47a['query'][_0x8d44('0x3a')]+'%'};return _0x397ae5;}})});}_0x211834=_[_0x8d44('0x3b')]({},_0x211834,_0x41e47a['options']);var _0x4d5fbd={'where':_0x211834[_0x8d44('0x39')]};return db[_0x8d44('0x2b')]['count'](_0x4d5fbd)[_0x8d44('0x23')](function(_0x30b744){_0x4bc6cb[_0x8d44('0x1e')]=_0x30b744;if(_0x41e47a[_0x8d44('0x30')]['includeAll']){_0x211834['include']=[{'all':!![]}];}return db['WhatsappApplication'][_0x8d44('0x3d')](_0x211834);})['then'](function(_0x6a6a44){_0x4bc6cb['rows']=_0x6a6a44;return _0x4bc6cb;})[_0x8d44('0x23')](respondWithFilteredResult(_0x4ce131,_0x211834))[_0x8d44('0x3e')](handleError(_0x4ce131,null));};exports[_0x8d44('0x3f')]=function(_0x6e99b3,_0x2117d2){var _0xd2f7d0={'raw':!![],'where':{'id':_0x6e99b3[_0x8d44('0x40')]['id']}},_0x5a6a7e={};_0x5a6a7e[_0x8d44('0x2f')]=_[_0x8d44('0x41')](db[_0x8d44('0x2b')][_0x8d44('0x2c')]);_0x5a6a7e[_0x8d44('0x30')]=_[_0x8d44('0x41')](_0x6e99b3[_0x8d44('0x30')]);_0x5a6a7e[_0x8d44('0x31')]=_[_0x8d44('0x32')](_0x5a6a7e['model'],_0x5a6a7e[_0x8d44('0x30')]);_0xd2f7d0[_0x8d44('0x33')]=_['intersection'](_0x5a6a7e['model'],qs[_0x8d44('0x34')](_0x6e99b3[_0x8d44('0x30')][_0x8d44('0x34')]));_0xd2f7d0[_0x8d44('0x33')]=_0xd2f7d0['attributes'][_0x8d44('0x35')]?_0xd2f7d0['attributes']:_0x5a6a7e[_0x8d44('0x2f')];if(_0x6e99b3[_0x8d44('0x30')][_0x8d44('0x42')]){_0xd2f7d0[_0x8d44('0x43')]=[{'all':!![]}];}_0xd2f7d0=_['merge']({},_0xd2f7d0,_0x6e99b3['options']);return db[_0x8d44('0x2b')][_0x8d44('0x44')](_0xd2f7d0)[_0x8d44('0x23')](handleEntityNotFound(_0x2117d2,null))[_0x8d44('0x23')](respondWithResult(_0x2117d2,null))[_0x8d44('0x3e')](handleError(_0x2117d2,null));};exports[_0x8d44('0x45')]=function(_0x44655a,_0x29b30f){return db['WhatsappApplication']['create'](_0x44655a[_0x8d44('0x46')],{})[_0x8d44('0x23')](respondWithResult(_0x29b30f,0xc9))[_0x8d44('0x3e')](handleError(_0x29b30f,null));};exports['update']=function(_0x3bf7f8,_0x44189f){if(_0x3bf7f8[_0x8d44('0x46')]['id']){delete _0x3bf7f8[_0x8d44('0x46')]['id'];}return db[_0x8d44('0x2b')][_0x8d44('0x44')]({'where':{'id':_0x3bf7f8['params']['id']}})['then'](handleEntityNotFound(_0x44189f,null))[_0x8d44('0x23')](saveUpdates(_0x3bf7f8[_0x8d44('0x46')],null))['then'](respondWithResult(_0x44189f,null))[_0x8d44('0x3e')](handleError(_0x44189f,null));};exports[_0x8d44('0x24')]=function(_0x583b12,_0x3c63c7){return db['WhatsappApplication'][_0x8d44('0x44')]({'where':{'id':_0x583b12[_0x8d44('0x40')]['id']}})[_0x8d44('0x23')](handleEntityNotFound(_0x3c63c7,null))[_0x8d44('0x23')](removeEntity(_0x3c63c7,null))['catch'](handleError(_0x3c63c7,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index 8475011..3e2d0a8 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 _0x50a6=['util','moment','request-promise','path','rimraf','./whatsappApplication.attributes','define','WhatsappApplication','whatsapp_applications','utf8mb4_unicode_ci','lodash'];(function(_0x15833e,_0x58a046){var _0x5c4745=function(_0x2d1a2c){while(--_0x2d1a2c){_0x15833e['push'](_0x15833e['shift']());}};_0x5c4745(++_0x58a046);}(_0x50a6,0xa4));var _0x650a=function(_0x1ba3f0,_0x3b220d){_0x1ba3f0=_0x1ba3f0-0x0;var _0x53064d=_0x50a6[_0x1ba3f0];return _0x53064d;};'use strict';var _=require(_0x650a('0x0'));var util=require(_0x650a('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x650a('0x2'));var BPromise=require('bluebird');var rp=require(_0x650a('0x3'));var fs=require('fs');var path=require(_0x650a('0x4'));var rimraf=require(_0x650a('0x5'));var config=require('../../config/environment');var attributes=require(_0x650a('0x6'));module['exports']=function(_0x4eabde,_0x2d486d){return _0x4eabde[_0x650a('0x7')](_0x650a('0x8'),attributes,{'tableName':_0x650a('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x650a('0xa')});}; \ No newline at end of file +var _0xe107=['../../config/logger','api','moment','request-promise','../../config/environment','./whatsappApplication.attributes','exports','define','WhatsappApplication','whatsapp_applications','utf8mb4','lodash'];(function(_0x357d51,_0x4e90ae){var _0x35764c=function(_0x3f4921){while(--_0x3f4921){_0x357d51['push'](_0x357d51['shift']());}};_0x35764c(++_0x4e90ae);}(_0xe107,0xb3));var _0x7e10=function(_0x1c9cd5,_0xb57690){_0x1c9cd5=_0x1c9cd5-0x0;var _0x9cec09=_0xe107[_0x1c9cd5];return _0x9cec09;};'use strict';var _=require(_0x7e10('0x0'));var util=require('util');var logger=require(_0x7e10('0x1'))(_0x7e10('0x2'));var moment=require(_0x7e10('0x3'));var BPromise=require('bluebird');var rp=require(_0x7e10('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7e10('0x5'));var attributes=require(_0x7e10('0x6'));module[_0x7e10('0x7')]=function(_0x5be19f,_0x5f1edf){return _0x5be19f[_0x7e10('0x8')](_0x7e10('0x9'),attributes,{'tableName':_0x7e10('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7e10('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index c737ab4..1853fb0 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 _0x99e9=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring'];(function(_0x2a7210,_0x2f3d23){var _0x460766=function(_0xd575dd){while(--_0xd575dd){_0x2a7210['push'](_0x2a7210['shift']());}};_0x460766(++_0x2f3d23);}(_0x99e9,0xb4));var _0x999e=function(_0x35387d,_0x1ba72f){_0x35387d=_0x35387d-0x0;var _0x3aba56=_0x99e9[_0x35387d];return _0x3aba56;};'use strict';var _=require('lodash');var util=require(_0x999e('0x0'));var moment=require(_0x999e('0x1'));var BPromise=require(_0x999e('0x2'));var rs=require(_0x999e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x999e('0x4'))['db'];var utils=require(_0x999e('0x5'));var logger=require(_0x999e('0x6'))('rpc');var config=require(_0x999e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x999e('0x8')][_0x999e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x100330,_0x18f337,_0x5c1c17){return new BPromise(function(_0x46aeae,_0x38a692){return client[_0x999e('0xa')](_0x100330,_0x5c1c17)[_0x999e('0xb')](function(_0x2c38cf){logger[_0x999e('0xc')](_0x999e('0xd'),_0x18f337,_0x999e('0xe'));logger[_0x999e('0xf')](_0x999e('0x10'),_0x18f337,_0x999e('0xe'),JSON[_0x999e('0x11')](_0x2c38cf));if(_0x2c38cf[_0x999e('0x12')]){if(_0x2c38cf[_0x999e('0x12')][_0x999e('0x13')]===0x1f4){logger[_0x999e('0x12')](_0x999e('0xd'),_0x18f337,_0x2c38cf['error'][_0x999e('0x14')]);return _0x38a692(_0x2c38cf['error'][_0x999e('0x14')]);}logger[_0x999e('0x12')](_0x999e('0xd'),_0x18f337,_0x2c38cf['error'][_0x999e('0x14')]);return _0x46aeae(_0x2c38cf['error'][_0x999e('0x14')]);}else{logger['info']('WhatsappApplication,\x20%s,\x20%s',_0x18f337,_0x999e('0xe'));_0x46aeae(_0x2c38cf[_0x999e('0x15')][_0x999e('0x14')]);}})[_0x999e('0x16')](function(_0x1e9bff){logger[_0x999e('0x12')]('WhatsappApplication,\x20%s,\x20%s',_0x18f337,_0x1e9bff);_0x38a692(_0x1e9bff);});});} \ No newline at end of file +var _0xfd28=['error','code','message','info','result','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','WhatsappApplication,\x20%s,\x20%s','debug','request\x20sent'];(function(_0x18ec72,_0x528911){var _0x2acf47=function(_0x4d9bf2){while(--_0x4d9bf2){_0x18ec72['push'](_0x18ec72['shift']());}};_0x2acf47(++_0x528911);}(_0xfd28,0x148));var _0x8fd2=function(_0x382a62,_0x1baa5e){_0x382a62=_0x382a62-0x0;var _0x490a25=_0xfd28[_0x382a62];return _0x490a25;};'use strict';var _=require('lodash');var util=require(_0x8fd2('0x0'));var moment=require(_0x8fd2('0x1'));var BPromise=require('bluebird');var rs=require(_0x8fd2('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8fd2('0x3'))['db'];var utils=require(_0x8fd2('0x4'));var logger=require(_0x8fd2('0x5'))('rpc');var config=require(_0x8fd2('0x6'));var jayson=require(_0x8fd2('0x7'));var client=jayson[_0x8fd2('0x8')][_0x8fd2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2f0afc,_0x4bdc1a,_0x53d938){return new BPromise(function(_0x10fccf,_0x466c3d){return client[_0x8fd2('0xa')](_0x2f0afc,_0x53d938)['then'](function(_0x13cc69){logger['info'](_0x8fd2('0xb'),_0x4bdc1a,'request\x20sent');logger[_0x8fd2('0xc')]('WhatsappApplication,\x20%s,\x20%s,\x20%s',_0x4bdc1a,_0x8fd2('0xd'),JSON['stringify'](_0x13cc69));if(_0x13cc69[_0x8fd2('0xe')]){if(_0x13cc69['error'][_0x8fd2('0xf')]===0x1f4){logger[_0x8fd2('0xe')](_0x8fd2('0xb'),_0x4bdc1a,_0x13cc69[_0x8fd2('0xe')][_0x8fd2('0x10')]);return _0x466c3d(_0x13cc69[_0x8fd2('0xe')][_0x8fd2('0x10')]);}logger[_0x8fd2('0xe')](_0x8fd2('0xb'),_0x4bdc1a,_0x13cc69[_0x8fd2('0xe')][_0x8fd2('0x10')]);return _0x10fccf(_0x13cc69[_0x8fd2('0xe')][_0x8fd2('0x10')]);}else{logger[_0x8fd2('0x11')](_0x8fd2('0xb'),_0x4bdc1a,'request\x20sent');_0x10fccf(_0x13cc69[_0x8fd2('0x12')]['message']);}})['catch'](function(_0x56f75d){logger[_0x8fd2('0xe')](_0x8fd2('0xb'),_0x4bdc1a,_0x56f75d);_0x466c3d(_0x56f75d);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index 7d8c0d1..5710e75 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 _0xe714=['post','/:id/tags','whatsapp','/:id','whatsappinteraction:update','update','delete','tracked','whatsappinteraction:destroy','destroy','multer','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./whatsappInteraction.controller','get','isAuthenticated','index','describe','/:id/messages','getMessages','/:id/download','download','create'];(function(_0x22ff70,_0x2936f4){var _0x172356=function(_0x1ec3de){while(--_0x1ec3de){_0x22ff70['push'](_0x22ff70['shift']());}};_0x172356(++_0x2936f4);}(_0xe714,0xe2));var _0x4e71=function(_0x25d2e2,_0xe9a4db){_0x25d2e2=_0x25d2e2-0x0;var _0x2fa47a=_0xe714[_0x25d2e2];return _0x2fa47a;};'use strict';var multer=require(_0x4e71('0x0'));var util=require('util');var path=require(_0x4e71('0x1'));var timeout=require(_0x4e71('0x2'));var express=require(_0x4e71('0x3'));var router=express[_0x4e71('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x4e71('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x4e71('0x6'));var controller=require(_0x4e71('0x7'));router[_0x4e71('0x8')]('/',auth[_0x4e71('0x9')](),controller[_0x4e71('0xa')]);router[_0x4e71('0x8')]('/describe',auth[_0x4e71('0x9')](),controller[_0x4e71('0xb')]);router[_0x4e71('0x8')]('/:id',auth[_0x4e71('0x9')](),controller['show']);router[_0x4e71('0x8')](_0x4e71('0xc'),auth[_0x4e71('0x9')](),controller[_0x4e71('0xd')]);router[_0x4e71('0x8')](_0x4e71('0xe'),auth[_0x4e71('0x9')](),controller[_0x4e71('0xf')]);router['post']('/',auth[_0x4e71('0x9')](),controller[_0x4e71('0x10')]);router['post'](_0x4e71('0xc'),auth[_0x4e71('0x9')](),controller['addMessage']);router[_0x4e71('0x11')](_0x4e71('0x12'),auth['isAuthenticated'](),interaction['tracked'](_0x4e71('0x13'),'whatsappinteraction:addtags'),controller['addTags']);router['put'](_0x4e71('0x14'),auth[_0x4e71('0x9')](),interaction['tracked']('whatsapp',_0x4e71('0x15')),controller[_0x4e71('0x16')]);router[_0x4e71('0x17')](_0x4e71('0x14'),auth[_0x4e71('0x9')](),interaction[_0x4e71('0x18')]('whatsapp',_0x4e71('0x19')),controller[_0x4e71('0x1a')]);router['delete'](_0x4e71('0x12'),auth[_0x4e71('0x9')](),controller['removeTags']);module['exports']=router; \ No newline at end of file +var _0x277c=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','describe','/:id','show','/:id/messages','/:id/download','download','post','create','addMessage','tracked','whatsapp','put','whatsappinteraction:update','update','whatsappinteraction:destroy','destroy','delete','/:id/tags','removeTags','exports','multer','path'];(function(_0x2b10c6,_0x185590){var _0x3789d2=function(_0x272987){while(--_0x272987){_0x2b10c6['push'](_0x2b10c6['shift']());}};_0x3789d2(++_0x185590);}(_0x277c,0x153));var _0xc277=function(_0x37bff3,_0x300723){_0x37bff3=_0x37bff3-0x0;var _0x18937e=_0x277c[_0x37bff3];return _0x18937e;};'use strict';var multer=require(_0xc277('0x0'));var util=require('util');var path=require(_0xc277('0x1'));var timeout=require(_0xc277('0x2'));var express=require(_0xc277('0x3'));var router=express[_0xc277('0x4')]();var fs_extra=require(_0xc277('0x5'));var auth=require(_0xc277('0x6'));var interaction=require(_0xc277('0x7'));var config=require(_0xc277('0x8'));var controller=require('./whatsappInteraction.controller');router['get']('/',auth[_0xc277('0x9')](),controller['index']);router[_0xc277('0xa')]('/describe',auth[_0xc277('0x9')](),controller[_0xc277('0xb')]);router['get'](_0xc277('0xc'),auth[_0xc277('0x9')](),controller[_0xc277('0xd')]);router[_0xc277('0xa')](_0xc277('0xe'),auth[_0xc277('0x9')](),controller['getMessages']);router['get'](_0xc277('0xf'),auth[_0xc277('0x9')](),controller[_0xc277('0x10')]);router[_0xc277('0x11')]('/',auth['isAuthenticated'](),controller[_0xc277('0x12')]);router['post'](_0xc277('0xe'),auth[_0xc277('0x9')](),controller[_0xc277('0x13')]);router[_0xc277('0x11')]('/:id/tags',auth[_0xc277('0x9')](),interaction[_0xc277('0x14')](_0xc277('0x15'),'whatsappinteraction:addtags'),controller['addTags']);router[_0xc277('0x16')]('/:id',auth[_0xc277('0x9')](),interaction['tracked'](_0xc277('0x15'),_0xc277('0x17')),controller[_0xc277('0x18')]);router['delete']('/:id',auth[_0xc277('0x9')](),interaction['tracked']('whatsapp',_0xc277('0x19')),controller[_0xc277('0x1a')]);router[_0xc277('0x1b')](_0xc277('0x1c'),auth[_0xc277('0x9')](),controller[_0xc277('0x1d')]);module[_0xc277('0x1e')]=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index 3a0a3e7..dbfd317 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 _0x4f7b=['ENUM','out','INTEGER','sequelize','moment','exports','BOOLEAN','STRING','DATE'];(function(_0x2b3a87,_0x4d2a98){var _0x5584ae=function(_0x4b57ca){while(--_0x4b57ca){_0x2b3a87['push'](_0x2b3a87['shift']());}};_0x5584ae(++_0x4d2a98);}(_0x4f7b,0x13e));var _0xb4f7=function(_0x2cedf9,_0x414546){_0x2cedf9=_0x2cedf9-0x0;var _0x14c010=_0x4f7b[_0x2cedf9];return _0x14c010;};'use strict';var Sequelize=require(_0xb4f7('0x0'));var moment=require(_0xb4f7('0x1'));module[_0xb4f7('0x2')]={'closed':{'type':Sequelize[_0xb4f7('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xb4f7('0x4')]},'secondDisposition':{'type':Sequelize[_0xb4f7('0x4')]},'thirdDisposition':{'type':Sequelize[_0xb4f7('0x4')]},'note':{'type':Sequelize[_0xb4f7('0x4')]},'phone':{'type':Sequelize[_0xb4f7('0x4')]},'read1stAt':{'type':Sequelize[_0xb4f7('0x5')]},'firstMsgDirection':{'type':Sequelize[_0xb4f7('0x6')]('in',_0xb4f7('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xb4f7('0x6')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xb4f7('0x3')],'defaultValue':![]},'queueId':{'type':Sequelize[_0xb4f7('0x8')]}}; \ No newline at end of file +var _0xeb3f=['BOOLEAN','DATE','STRING','ENUM','out','INTEGER','sequelize','moment','exports'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0xeb3f,0xa8));var _0xfeb3=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xeb3f[_0x17d9e3];return _0x14192d;};'use strict';var Sequelize=require(_0xfeb3('0x0'));var moment=require(_0xfeb3('0x1'));module[_0xfeb3('0x2')]={'closed':{'type':Sequelize[_0xfeb3('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xfeb3('0x4')]},'disposition':{'type':Sequelize[_0xfeb3('0x5')]},'secondDisposition':{'type':Sequelize[_0xfeb3('0x5')]},'thirdDisposition':{'type':Sequelize[_0xfeb3('0x5')]},'note':{'type':Sequelize[_0xfeb3('0x5')]},'phone':{'type':Sequelize[_0xfeb3('0x5')]},'read1stAt':{'type':Sequelize[_0xfeb3('0x4')]},'firstMsgDirection':{'type':Sequelize[_0xfeb3('0x6')]('in',_0xfeb3('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xfeb3('0x4')]},'lastMsgDirection':{'type':Sequelize[_0xfeb3('0x6')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xfeb3('0x3')],'defaultValue':![]},'queueId':{'type':Sequelize[_0xfeb3('0x8')]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index 889b8db..b4fa154 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 _0x5835=['filter','merge','$gte','split','format','rows','setTags','Tag','color','emit','whatsappInteractionTags:save','download','unix','join','root','server','files','tmp','attachments','User','fullname','push','CmContact','Contact','firstName','Attachment','Messages','createdAt','direction','secret','WhatsappAccount','Account','Owner','mkdirSync','N.A.','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','toString','disposition','existsSync','createReadStream','pipe','System','lastName','out','read','renderFile','views','downloadInteraction.ejs','.pdf','Whatsapp','createPdfFromHTML','log','unlinkSync','rimraf','bluebird','util','lodash','../../components/interaction/service','../../components/export/pdf','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','sendStatus','status','offset','undefined','count','limit','set','destroy','then','end','error','name','send','index','map','WhatsappInteraction','fieldName','type','key','getOptions','findAll','query','user','catch','show','params','model','keys','filters','intersection','attributes','fields','length','includeAll','options','create','body','find','describe','WhatsappMessage','addMessage','ids','getMessages','findOne','rawAttributes','hasOwnProperty','sort','pick','where','WhatsappInteractionId'];(function(_0x61b186,_0x46b756){var _0x2b3365=function(_0x10a041){while(--_0x10a041){_0x61b186['push'](_0x61b186['shift']());}};_0x2b3365(++_0x46b756);}(_0x5835,0x123));var _0x5583=function(_0x292b29,_0x16a985){_0x292b29=_0x292b29-0x0;var _0xd30f65=_0x5835[_0x292b29];return _0xd30f65;};'use strict';var rimraf=require(_0x5583('0x0'));var zipdir=require('zip-dir');var moment=require('moment');var BPromise=require(_0x5583('0x1'));var util=require(_0x5583('0x2'));var path=require('path');var ejs=require('ejs');var fs=require('fs');var _=require(_0x5583('0x3'));var Redis=require('ioredis');var interaction=require(_0x5583('0x4'));var qs=require('../../components/parsers/qs');var pdf=require(_0x5583('0x5'));var logger=require('../../config/logger')('api');var config=require(_0x5583('0x6'));var db=require(_0x5583('0x7'))['db'];config[_0x5583('0x8')]=_[_0x5583('0x9')](config[_0x5583('0x8')],{'host':_0x5583('0xa'),'port':0x18eb});var socket=require(_0x5583('0xb'))(new Redis(config[_0x5583('0x8')]));require(_0x5583('0xc'))['register'](socket);function respondWithStatusCode(_0x55bbba,_0x2e1b2b){_0x2e1b2b=_0x2e1b2b||0xcc;return function(_0xa19167){if(_0xa19167){return _0x55bbba[_0x5583('0xd')](_0x2e1b2b);}return _0x55bbba[_0x5583('0xe')](_0x2e1b2b)['end']();};}function respondWithResult(_0x2b4737,_0x3cec50){_0x3cec50=_0x3cec50||0xc8;return function(_0xcb9ae5){if(_0xcb9ae5){return _0x2b4737['status'](_0x3cec50)['json'](_0xcb9ae5);}};}function respondWithFilteredResult(_0x251606,_0x3e695c){return function(_0x228b1e){if(_0x228b1e){var _0x33b251=typeof _0x3e695c[_0x5583('0xf')]===_0x5583('0x10')&&typeof _0x3e695c['limit']===_0x5583('0x10');var _0xbe0d02=_0x228b1e[_0x5583('0x11')];var _0x1d5330=_0x33b251?0x0:_0x3e695c[_0x5583('0xf')];var _0x49d525=_0x33b251?_0x228b1e[_0x5583('0x11')]:_0x3e695c[_0x5583('0xf')]+_0x3e695c[_0x5583('0x12')];var _0x388de3;if(_0x49d525>=_0xbe0d02){_0x49d525=_0xbe0d02;_0x388de3=0xc8;}else{_0x388de3=0xce;}_0x251606['status'](_0x388de3);return _0x251606[_0x5583('0x13')]('Content-Range',_0x1d5330+'-'+_0x49d525+'/'+_0xbe0d02)['json'](_0x228b1e);}return null;};}function saveUpdates(_0x51b24d){return function(_0x183883){if(_0x183883){return _0x183883['update'](_0x51b24d)['then'](function(_0x57812c){return _0x57812c;});}return null;};}function removeEntity(_0x225127){return function(_0x588178){if(_0x588178){return _0x588178[_0x5583('0x14')]()[_0x5583('0x15')](function(){_0x225127[_0x5583('0xe')](0xcc)[_0x5583('0x16')]();});}};}function handleEntityNotFound(_0x3ce34a){return function(_0x53efa3){if(!_0x53efa3){_0x3ce34a[_0x5583('0xd')](0x194);}return _0x53efa3;};}function handleError(_0x313bc3,_0x5379a8){_0x5379a8=_0x5379a8||0x1f4;return function(_0xb94c73){logger[_0x5583('0x17')](_0xb94c73['stack']);if(_0xb94c73[_0x5583('0x18')]){delete _0xb94c73[_0x5583('0x18')];}_0x313bc3[_0x5583('0xe')](_0x5379a8)[_0x5583('0x19')](_0xb94c73);};}exports[_0x5583('0x1a')]=function(_0x62fbc6,_0x20ac33){var _0x2a1035={};var _0x4870c9=_[_0x5583('0x1b')](db[_0x5583('0x1c')]['rawAttributes'],function(_0xf69b10){return{'name':_0xf69b10[_0x5583('0x1d')],'type':_0xf69b10[_0x5583('0x1e')][_0x5583('0x1f')]};});_0x2a1035=qs[_0x5583('0x20')](_0x4870c9,_0x62fbc6);return interaction[_0x5583('0x21')]('whatsapp',_0x62fbc6[_0x5583('0x22')],_0x62fbc6[_0x5583('0x23')],_0x2a1035,_0x4870c9)[_0x5583('0x15')](respondWithFilteredResult(_0x20ac33,_0x2a1035))[_0x5583('0x24')](handleError(_0x20ac33,null));};exports[_0x5583('0x25')]=function(_0x215a1e,_0x235ad1){var _0x4b2a67={'raw':![],'where':{'id':_0x215a1e[_0x5583('0x26')]['id']}},_0x17ab05={};_0x17ab05[_0x5583('0x27')]=_[_0x5583('0x28')](db[_0x5583('0x1c')]['rawAttributes']);_0x17ab05[_0x5583('0x22')]=_[_0x5583('0x28')](_0x215a1e[_0x5583('0x22')]);_0x17ab05[_0x5583('0x29')]=_[_0x5583('0x2a')](_0x17ab05[_0x5583('0x27')],_0x17ab05[_0x5583('0x22')]);_0x4b2a67[_0x5583('0x2b')]=_['intersection'](_0x17ab05[_0x5583('0x27')],qs['fields'](_0x215a1e[_0x5583('0x22')][_0x5583('0x2c')]));_0x4b2a67[_0x5583('0x2b')]=_0x4b2a67[_0x5583('0x2b')][_0x5583('0x2d')]?_0x4b2a67[_0x5583('0x2b')]:_0x17ab05[_0x5583('0x27')];if(_0x215a1e[_0x5583('0x22')][_0x5583('0x2e')]){_0x4b2a67['include']=[{'all':!![]}];}_0x4b2a67=_['merge']({},_0x4b2a67,_0x215a1e[_0x5583('0x2f')]);return db[_0x5583('0x1c')]['find'](_0x4b2a67)[_0x5583('0x15')](handleEntityNotFound(_0x235ad1,null))[_0x5583('0x15')](respondWithResult(_0x235ad1,null))[_0x5583('0x24')](handleError(_0x235ad1,null));};exports[_0x5583('0x30')]=function(_0x533bde,_0x1ba14f){return db['WhatsappInteraction'][_0x5583('0x30')](_0x533bde[_0x5583('0x31')],{})[_0x5583('0x15')](respondWithResult(_0x1ba14f,0xc9))[_0x5583('0x24')](handleError(_0x1ba14f,null));};exports['update']=function(_0x433f24,_0x38a490){if(_0x433f24['body']['id']){delete _0x433f24[_0x5583('0x31')]['id'];}return db[_0x5583('0x1c')][_0x5583('0x32')]({'where':{'id':_0x433f24[_0x5583('0x26')]['id']}})[_0x5583('0x15')](handleEntityNotFound(_0x38a490,null))[_0x5583('0x15')](saveUpdates(_0x433f24[_0x5583('0x31')],null))['then'](respondWithResult(_0x38a490,null))[_0x5583('0x24')](handleError(_0x38a490,null));};exports[_0x5583('0x14')]=function(_0x5a862f,_0x30d35b){return db[_0x5583('0x1c')][_0x5583('0x32')]({'where':{'id':_0x5a862f['params']['id']}})[_0x5583('0x15')](handleEntityNotFound(_0x30d35b,null))[_0x5583('0x15')](removeEntity(_0x30d35b,null))['catch'](handleError(_0x30d35b,null));};exports[_0x5583('0x33')]=function(_0x1a5dac,_0xbe4692){return db[_0x5583('0x1c')][_0x5583('0x33')]()[_0x5583('0x15')](respondWithResult(_0xbe4692,null))[_0x5583('0x24')](handleError(_0xbe4692,null));};exports['addMessage']=function(_0x4dd138,_0x1335b8){return db[_0x5583('0x34')]['find']({'where':{'id':_0x4dd138['params']['id']}})[_0x5583('0x15')](handleEntityNotFound(_0x1335b8,null))[_0x5583('0x15')](function(_0x8b201d){if(_0x8b201d){return _0x8b201d[_0x5583('0x35')](_0x4dd138[_0x5583('0x31')]['ids'],_['omit'](_0x4dd138[_0x5583('0x31')],[_0x5583('0x36'),'id'])||{});}})[_0x5583('0x15')](respondWithResult(_0x1335b8,null))['catch'](handleError(_0x1335b8,null));};exports[_0x5583('0x37')]=function(_0x5172af,_0x4e8203){var _0x384e21={'raw':![],'where':{}};var _0x1af605={};var _0x4bc89e={'count':0x0,'rows':[]};return db[_0x5583('0x1c')][_0x5583('0x38')]({'where':{'id':_0x5172af[_0x5583('0x26')]['id']}})[_0x5583('0x15')](handleEntityNotFound(_0x4e8203,null))[_0x5583('0x15')](function(_0x42ac3c){if(_0x42ac3c){_0x1af605[_0x5583('0x27')]=_['keys'](db['WhatsappMessage'][_0x5583('0x39')]);_0x1af605[_0x5583('0x22')]=_[_0x5583('0x28')](_0x5172af[_0x5583('0x22')]);_0x1af605[_0x5583('0x29')]=_[_0x5583('0x2a')](_0x1af605[_0x5583('0x27')],_0x1af605['query']);_0x384e21[_0x5583('0x2b')]=_[_0x5583('0x2a')](_0x1af605['model'],qs[_0x5583('0x2c')](_0x5172af[_0x5583('0x22')][_0x5583('0x2c')]));_0x384e21[_0x5583('0x2b')]=_0x384e21[_0x5583('0x2b')][_0x5583('0x2d')]?_0x384e21[_0x5583('0x2b')]:_0x1af605[_0x5583('0x27')];if(!_0x5172af['query'][_0x5583('0x3a')]('nolimit')){_0x384e21[_0x5583('0x12')]=qs[_0x5583('0x12')](_0x5172af[_0x5583('0x22')][_0x5583('0x12')]);_0x384e21['offset']=qs[_0x5583('0xf')](_0x5172af[_0x5583('0x22')]['offset']);}_0x384e21['order']=qs[_0x5583('0x3b')](_0x5172af['query'][_0x5583('0x3b')]);_0x384e21['where']=qs[_0x5583('0x29')](_[_0x5583('0x3c')](_0x5172af['query'],_0x1af605[_0x5583('0x29')]));_0x384e21[_0x5583('0x3d')][_0x5583('0x3e')]=_0x42ac3c['id'];if(_0x5172af[_0x5583('0x22')][_0x5583('0x3f')]){_0x384e21['where']=_[_0x5583('0x40')](_0x384e21[_0x5583('0x3d')],{'$or':_['map'](_0x384e21[_0x5583('0x2b')],function(_0x1b1e28){var _0x350607={};_0x350607[_0x1b1e28]={'$like':'%'+_0x5172af[_0x5583('0x22')]['filter']+'%'};return _0x350607;})});}if(_0x5172af[_0x5583('0x22')][_0x5583('0x41')]){var _0x597880=_0x5172af[_0x5583('0x22')][_0x5583('0x41')][_0x5583('0x42')](',');var _0x163818={};_0x163818[_0x597880[0x0]]={'$gte':moment(_0x597880[0x1])[_0x5583('0x43')]('YYYY-MM-DD\x20HH:mm:ss')};_0x384e21[_0x5583('0x3d')]=_[_0x5583('0x40')](_0x384e21[_0x5583('0x3d')],_0x163818);}_0x384e21=_[_0x5583('0x40')]({},_0x384e21,_0x5172af[_0x5583('0x2f')]);return db['WhatsappMessage'][_0x5583('0x11')]({'where':_0x384e21[_0x5583('0x3d')]})[_0x5583('0x15')](function(_0xfea084){_0x4bc89e[_0x5583('0x11')]=_0xfea084;if(_0x5172af[_0x5583('0x22')]['includeAll']){_0x384e21['include']=[{'all':!![]}];}return db[_0x5583('0x34')][_0x5583('0x21')](_0x384e21);})[_0x5583('0x15')](function(_0x1e9ab2){_0x4bc89e[_0x5583('0x44')]=_0x1e9ab2;return _0x4bc89e;});}})[_0x5583('0x15')](respondWithFilteredResult(_0x4e8203,_0x384e21))[_0x5583('0x24')](handleError(_0x4e8203,null));};exports['addTags']=function(_0x20d3e4,_0x14d2fd){return db[_0x5583('0x1c')][_0x5583('0x32')]({'where':{'id':_0x20d3e4[_0x5583('0x26')]['id']}})[_0x5583('0x15')](handleEntityNotFound(_0x14d2fd,null))[_0x5583('0x15')](function(_0x452a67){if(_0x452a67){return _0x452a67[_0x5583('0x45')](_0x20d3e4[_0x5583('0x31')][_0x5583('0x36')],_['omit'](_0x20d3e4[_0x5583('0x31')],[_0x5583('0x36'),'id'])||{})['spread'](function(){return db[_0x5583('0x46')]['findAll']({'attributes':['id',_0x5583('0x18'),_0x5583('0x47')],'where':{'id':_0x20d3e4[_0x5583('0x31')]['ids']}});})['then'](function(_0x313f2d){socket[_0x5583('0x48')](_0x5583('0x49'),{'id':Number(_0x20d3e4['params']['id']),'tags':_0x313f2d||[]});return{'id':Number(_0x20d3e4[_0x5583('0x26')]['id']),'tags':_0x313f2d||[]};});}})[_0x5583('0x15')](respondWithResult(_0x14d2fd,null))[_0x5583('0x24')](handleError(_0x14d2fd,null));};exports['removeTags']=function(_0x167b90,_0x1513fe){return db[_0x5583('0x1c')][_0x5583('0x32')]({'where':{'id':_0x167b90[_0x5583('0x26')]['id']}})[_0x5583('0x15')](handleEntityNotFound(_0x1513fe,null))[_0x5583('0x15')](function(_0x475834){if(_0x475834){return _0x475834['removeTags'](_0x167b90['query'][_0x5583('0x36')]);}})[_0x5583('0x15')](respondWithStatusCode(_0x1513fe,null))['catch'](handleError(_0x1513fe,null));};exports[_0x5583('0x4a')]=function(_0x530611,_0x244b64){var _0x5764d7=moment()[_0x5583('0x4b')]()['toString']();var _0x2408d1=path[_0x5583('0x4c')](config[_0x5583('0x4d')],_0x5583('0x4e'),_0x5583('0x4f'),_0x5583('0x50'));var _0x36166d=path[_0x5583('0x4c')](config[_0x5583('0x4d')],'server',_0x5583('0x4f'),_0x5583('0x51'));var _0x213be7=path[_0x5583('0x4c')](_0x2408d1,_0x5764d7);var _0x13a9b3=util[_0x5583('0x43')]('transcript-%d-%s.zip',_0x530611[_0x5583('0x26')]['id'],_0x5764d7);var _0x5b337e=path['join'](_0x2408d1,_0x13a9b3);var _0x52b08d=[];_0x52b08d['push']({'model':db['User'],'as':_0x5583('0x52'),'attributes':['id',_0x5583('0x53')],'raw':!![]});_0x52b08d[_0x5583('0x54')]({'model':db[_0x5583('0x55')],'as':_0x5583('0x56'),'attributes':['id',_0x5583('0x57'),'lastName'],'raw':!![]});if(_0x530611[_0x5583('0x22')][_0x5583('0x51')]){_0x52b08d[_0x5583('0x54')]({'model':db[_0x5583('0x58')],'as':_0x5583('0x58'),'raw':!![]});}var _0x580d11=[{'model':db[_0x5583('0x34')],'as':_0x5583('0x59'),'attributes':['id',_0x5583('0x31'),_0x5583('0x5a'),_0x5583('0x5b'),_0x5583('0x5c'),'read'],'include':_0x52b08d}];_0x580d11[_0x5583('0x54')]({'model':db[_0x5583('0x5d')],'as':_0x5583('0x5e'),'attributes':['id',_0x5583('0x18')]});_0x580d11[_0x5583('0x54')]({'model':db[_0x5583('0x52')],'as':_0x5583('0x5f'),'attributes':['id',_0x5583('0x53')]});return db[_0x5583('0x1c')][_0x5583('0x32')]({'where':{'id':_0x530611[_0x5583('0x26')]['id']},'include':_0x580d11})[_0x5583('0x15')](handleEntityNotFound(_0x244b64,null))[_0x5583('0x15')](function(_0x23f5fb){if(_0x23f5fb){var _0x5b81b5=_0x23f5fb['get']({'plain':!![]});fs[_0x5583('0x60')](_0x213be7);var _0x7f30c8={'channel':'Whatsapp','account':_0x5b81b5[_0x5583('0x5e')]['name'],'agent':_0x5b81b5[_0x5583('0x5f')]?_0x5b81b5[_0x5583('0x5f')][_0x5583('0x53')]:_0x5583('0x61'),'createdAt':moment(_0x5b81b5[_0x5583('0x5a')])[_0x5583('0x43')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'closedAt':_0x5b81b5[_0x5583('0x62')]?moment(_0x5b81b5[_0x5583('0x63')])[_0x5583('0x43')](_0x5583('0x64'))[_0x5583('0x65')]():'','disposition':_0x5b81b5[_0x5583('0x66')],'messages':_(_0x5b81b5['Messages'])[_0x5583('0x3f')]({'secret':![]})[_0x5583('0x1b')](function(_0x3f817a){if(_0x3f817a['Attachment']){var _0x3b5d66=path[_0x5583('0x4c')](_0x36166d,_0x3f817a[_0x5583('0x58')]['basename']);if(fs[_0x5583('0x67')](_0x3b5d66)){fs[_0x5583('0x68')](_0x3b5d66)[_0x5583('0x69')](fs['createWriteStream'](path[_0x5583('0x4c')](_0x213be7,_0x3f817a[_0x5583('0x58')]['basename'])));}}return{'date':moment(_0x3f817a['createdAt'])[_0x5583('0x43')](_0x5583('0x64'))['toString'](),'sender':_0x3f817a[_0x5583('0x5b')]==='out'?_0x3f817a[_0x5583('0x52')]?_0x3f817a[_0x5583('0x52')][_0x5583('0x53')]:_0x5583('0x6a'):_0x3f817a[_0x5583('0x56')]['firstName']+(_0x3f817a[_0x5583('0x56')]['lastName']?'\x20'+_0x3f817a[_0x5583('0x56')][_0x5583('0x6b')]:''),'body':_0x3f817a['Attachment']?_0x3f817a[_0x5583('0x58')]['basename']:_0x3f817a[_0x5583('0x31')],'direction':_0x3f817a[_0x5583('0x5b')]===_0x5583('0x6c')?'A':'C','secret':_0x3f817a[_0x5583('0x5c')],'read':_0x3f817a[_0x5583('0x6d')],'attachment':_0x3f817a[_0x5583('0x58')]};})['value']()};return ejs[_0x5583('0x6e')](path[_0x5583('0x4c')](config[_0x5583('0x4d')],_0x5583('0x4e'),_0x5583('0x6f'),_0x5583('0x70')),{'interaction':_0x7f30c8})[_0x5583('0x15')](function(_0x5dd0a7){var _0xd5d8d0=path['join'](_0x213be7,'transcript-'+_0x5b81b5['id']+'-'+_0x5764d7+_0x5583('0x71'));var _0x42c87a={'path':_0xd5d8d0,'channel':_0x5583('0x72'),'interactionId':_0x5b81b5['id']};return pdf[_0x5583('0x73')](_0x5dd0a7,_0x42c87a);})[_0x5583('0x15')](function(){return new BPromise(function(_0x1b781a,_0x3d28ee){zipdir(_0x213be7,{'saveTo':_0x5b337e},function(_0x432954,_0x442ccb){if(_0x432954)return _0x3d28ee(_0x432954);return _0x1b781a(_0x442ccb);});})[_0x5583('0x15')](function(){return new BPromise(function(_0x30ba14,_0x3ede69){rimraf(_0x213be7,function(_0x5f18dc){if(_0x5f18dc)_0x3ede69(_0x5f18dc);return _0x30ba14();});});})[_0x5583('0x15')](function(){return _0x244b64[_0x5583('0x4a')](_0x5b337e,_0x13a9b3,function(_0x3f8057){if(_0x3f8057){console[_0x5583('0x74')]('err',_0x3f8057);}else{fs[_0x5583('0x75')](_0x5b337e);}});});});}else{return _0x244b64[_0x5583('0xd')](0xc8);}})['catch'](handleError(_0x244b64,null));}; \ No newline at end of file +var _0xf5f6=['index','map','WhatsappInteraction','rawAttributes','getOptions','query','user','catch','show','params','model','keys','filters','intersection','attributes','fields','includeAll','include','merge','options','find','create','body','addMessage','WhatsappMessage','ids','omit','length','hasOwnProperty','nolimit','order','sort','where','pick','WhatsappInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','findAll','rows','addTags','color','emit','whatsappInteractionTags:save','removeTags','download','unix','join','root','server','files','attachments','transcript-%d-%s.zip','push','User','fullname','CmContact','Contact','firstName','lastName','Attachment','Messages','createdAt','direction','read','WhatsappAccount','Account','Owner','get','toString','closedAt','disposition','existsSync','createReadStream','pipe','createWriteStream','basename','System','out','value','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','Whatsapp','log','bluebird','util','path','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','api','../../config/environment','defaults','redis','localhost','./whatsappInteraction.socket','status','end','json','offset','undefined','limit','count','Content-Range','update','then','destroy','sendStatus','error','name'];(function(_0x29f11c,_0x5098e7){var _0xef85b=function(_0x38883a){while(--_0x38883a){_0x29f11c['push'](_0x29f11c['shift']());}};_0xef85b(++_0x5098e7);}(_0xf5f6,0x143));var _0x6f5f=function(_0xbba7b5,_0x5aef2b){_0xbba7b5=_0xbba7b5-0x0;var _0x3b7967=_0xf5f6[_0xbba7b5];return _0x3b7967;};'use strict';var rimraf=require('rimraf');var zipdir=require('zip-dir');var moment=require('moment');var BPromise=require(_0x6f5f('0x0'));var util=require(_0x6f5f('0x1'));var path=require(_0x6f5f('0x2'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x6f5f('0x3'));var Redis=require(_0x6f5f('0x4'));var interaction=require(_0x6f5f('0x5'));var qs=require(_0x6f5f('0x6'));var pdf=require(_0x6f5f('0x7'));var logger=require('../../config/logger')(_0x6f5f('0x8'));var config=require(_0x6f5f('0x9'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x6f5f('0xa')](config[_0x6f5f('0xb')],{'host':_0x6f5f('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x6f5f('0xd'))['register'](socket);function respondWithStatusCode(_0x47fb97,_0x275894){_0x275894=_0x275894||0xcc;return function(_0xc1f0b9){if(_0xc1f0b9){return _0x47fb97['sendStatus'](_0x275894);}return _0x47fb97[_0x6f5f('0xe')](_0x275894)[_0x6f5f('0xf')]();};}function respondWithResult(_0xb4306a,_0x22399d){_0x22399d=_0x22399d||0xc8;return function(_0x40ba43){if(_0x40ba43){return _0xb4306a[_0x6f5f('0xe')](_0x22399d)[_0x6f5f('0x10')](_0x40ba43);}};}function respondWithFilteredResult(_0x148ce6,_0x1d510d){return function(_0x555ee4){if(_0x555ee4){var _0x3641c4=typeof _0x1d510d[_0x6f5f('0x11')]===_0x6f5f('0x12')&&typeof _0x1d510d[_0x6f5f('0x13')]==='undefined';var _0x5045d1=_0x555ee4[_0x6f5f('0x14')];var _0xd1d8f5=_0x3641c4?0x0:_0x1d510d[_0x6f5f('0x11')];var _0x2115d3=_0x3641c4?_0x555ee4[_0x6f5f('0x14')]:_0x1d510d[_0x6f5f('0x11')]+_0x1d510d['limit'];var _0x1a0913;if(_0x2115d3>=_0x5045d1){_0x2115d3=_0x5045d1;_0x1a0913=0xc8;}else{_0x1a0913=0xce;}_0x148ce6['status'](_0x1a0913);return _0x148ce6['set'](_0x6f5f('0x15'),_0xd1d8f5+'-'+_0x2115d3+'/'+_0x5045d1)[_0x6f5f('0x10')](_0x555ee4);}return null;};}function saveUpdates(_0x34603a){return function(_0x4b1bab){if(_0x4b1bab){return _0x4b1bab[_0x6f5f('0x16')](_0x34603a)[_0x6f5f('0x17')](function(_0x47e5d7){return _0x47e5d7;});}return null;};}function removeEntity(_0x329668){return function(_0xca0365){if(_0xca0365){return _0xca0365[_0x6f5f('0x18')]()[_0x6f5f('0x17')](function(){_0x329668[_0x6f5f('0xe')](0xcc)[_0x6f5f('0xf')]();});}};}function handleEntityNotFound(_0x4f5783){return function(_0x55716f){if(!_0x55716f){_0x4f5783[_0x6f5f('0x19')](0x194);}return _0x55716f;};}function handleError(_0x449864,_0x10bac1){_0x10bac1=_0x10bac1||0x1f4;return function(_0xb20182){logger[_0x6f5f('0x1a')](_0xb20182['stack']);if(_0xb20182[_0x6f5f('0x1b')]){delete _0xb20182[_0x6f5f('0x1b')];}_0x449864['status'](_0x10bac1)['send'](_0xb20182);};}exports[_0x6f5f('0x1c')]=function(_0x39ad0e,_0x5f0a19){var _0x40bfcc={};var _0x38eef8=_[_0x6f5f('0x1d')](db[_0x6f5f('0x1e')][_0x6f5f('0x1f')],function(_0x6ea8bd){return{'name':_0x6ea8bd['fieldName'],'type':_0x6ea8bd['type']['key']};});_0x40bfcc=qs[_0x6f5f('0x20')](_0x38eef8,_0x39ad0e);return interaction['findAll']('whatsapp',_0x39ad0e[_0x6f5f('0x21')],_0x39ad0e[_0x6f5f('0x22')],_0x40bfcc,_0x38eef8)[_0x6f5f('0x17')](respondWithFilteredResult(_0x5f0a19,_0x40bfcc))[_0x6f5f('0x23')](handleError(_0x5f0a19,null));};exports[_0x6f5f('0x24')]=function(_0x16680f,_0x390bd7){var _0x6aeb11={'raw':![],'where':{'id':_0x16680f[_0x6f5f('0x25')]['id']}},_0xe81af3={};_0xe81af3[_0x6f5f('0x26')]=_[_0x6f5f('0x27')](db[_0x6f5f('0x1e')][_0x6f5f('0x1f')]);_0xe81af3[_0x6f5f('0x21')]=_[_0x6f5f('0x27')](_0x16680f[_0x6f5f('0x21')]);_0xe81af3[_0x6f5f('0x28')]=_[_0x6f5f('0x29')](_0xe81af3[_0x6f5f('0x26')],_0xe81af3[_0x6f5f('0x21')]);_0x6aeb11[_0x6f5f('0x2a')]=_[_0x6f5f('0x29')](_0xe81af3[_0x6f5f('0x26')],qs[_0x6f5f('0x2b')](_0x16680f[_0x6f5f('0x21')][_0x6f5f('0x2b')]));_0x6aeb11['attributes']=_0x6aeb11[_0x6f5f('0x2a')]['length']?_0x6aeb11[_0x6f5f('0x2a')]:_0xe81af3[_0x6f5f('0x26')];if(_0x16680f[_0x6f5f('0x21')][_0x6f5f('0x2c')]){_0x6aeb11[_0x6f5f('0x2d')]=[{'all':!![]}];}_0x6aeb11=_[_0x6f5f('0x2e')]({},_0x6aeb11,_0x16680f[_0x6f5f('0x2f')]);return db[_0x6f5f('0x1e')][_0x6f5f('0x30')](_0x6aeb11)[_0x6f5f('0x17')](handleEntityNotFound(_0x390bd7,null))['then'](respondWithResult(_0x390bd7,null))[_0x6f5f('0x23')](handleError(_0x390bd7,null));};exports[_0x6f5f('0x31')]=function(_0x57a4e3,_0x53299e){return db[_0x6f5f('0x1e')][_0x6f5f('0x31')](_0x57a4e3[_0x6f5f('0x32')],{})[_0x6f5f('0x17')](respondWithResult(_0x53299e,0xc9))[_0x6f5f('0x23')](handleError(_0x53299e,null));};exports['update']=function(_0x1d5506,_0x47c90d){if(_0x1d5506[_0x6f5f('0x32')]['id']){delete _0x1d5506['body']['id'];}return db[_0x6f5f('0x1e')][_0x6f5f('0x30')]({'where':{'id':_0x1d5506[_0x6f5f('0x25')]['id']}})[_0x6f5f('0x17')](handleEntityNotFound(_0x47c90d,null))[_0x6f5f('0x17')](saveUpdates(_0x1d5506[_0x6f5f('0x32')],null))[_0x6f5f('0x17')](respondWithResult(_0x47c90d,null))['catch'](handleError(_0x47c90d,null));};exports['destroy']=function(_0x41f326,_0x3c98fc){return db[_0x6f5f('0x1e')][_0x6f5f('0x30')]({'where':{'id':_0x41f326[_0x6f5f('0x25')]['id']}})[_0x6f5f('0x17')](handleEntityNotFound(_0x3c98fc,null))[_0x6f5f('0x17')](removeEntity(_0x3c98fc,null))[_0x6f5f('0x23')](handleError(_0x3c98fc,null));};exports['describe']=function(_0x186d7d,_0x557283){return db[_0x6f5f('0x1e')]['describe']()[_0x6f5f('0x17')](respondWithResult(_0x557283,null))[_0x6f5f('0x23')](handleError(_0x557283,null));};exports[_0x6f5f('0x33')]=function(_0x373ab7,_0x1a5bb6){return db[_0x6f5f('0x34')]['find']({'where':{'id':_0x373ab7[_0x6f5f('0x25')]['id']}})['then'](handleEntityNotFound(_0x1a5bb6,null))[_0x6f5f('0x17')](function(_0x41d607){if(_0x41d607){return _0x41d607['addMessage'](_0x373ab7['body'][_0x6f5f('0x35')],_[_0x6f5f('0x36')](_0x373ab7['body'],[_0x6f5f('0x35'),'id'])||{});}})[_0x6f5f('0x17')](respondWithResult(_0x1a5bb6,null))[_0x6f5f('0x23')](handleError(_0x1a5bb6,null));};exports['getMessages']=function(_0x45cb3a,_0x2bdfb3){var _0x2bb228={'raw':![],'where':{}};var _0x3de3cc={};var _0x4254c4={'count':0x0,'rows':[]};return db[_0x6f5f('0x1e')]['findOne']({'where':{'id':_0x45cb3a['params']['id']}})[_0x6f5f('0x17')](handleEntityNotFound(_0x2bdfb3,null))[_0x6f5f('0x17')](function(_0x4e7f0c){if(_0x4e7f0c){_0x3de3cc[_0x6f5f('0x26')]=_[_0x6f5f('0x27')](db[_0x6f5f('0x34')]['rawAttributes']);_0x3de3cc[_0x6f5f('0x21')]=_['keys'](_0x45cb3a[_0x6f5f('0x21')]);_0x3de3cc[_0x6f5f('0x28')]=_[_0x6f5f('0x29')](_0x3de3cc[_0x6f5f('0x26')],_0x3de3cc[_0x6f5f('0x21')]);_0x2bb228[_0x6f5f('0x2a')]=_[_0x6f5f('0x29')](_0x3de3cc[_0x6f5f('0x26')],qs['fields'](_0x45cb3a[_0x6f5f('0x21')][_0x6f5f('0x2b')]));_0x2bb228[_0x6f5f('0x2a')]=_0x2bb228[_0x6f5f('0x2a')][_0x6f5f('0x37')]?_0x2bb228[_0x6f5f('0x2a')]:_0x3de3cc[_0x6f5f('0x26')];if(!_0x45cb3a[_0x6f5f('0x21')][_0x6f5f('0x38')](_0x6f5f('0x39'))){_0x2bb228[_0x6f5f('0x13')]=qs[_0x6f5f('0x13')](_0x45cb3a[_0x6f5f('0x21')][_0x6f5f('0x13')]);_0x2bb228[_0x6f5f('0x11')]=qs[_0x6f5f('0x11')](_0x45cb3a['query']['offset']);}_0x2bb228[_0x6f5f('0x3a')]=qs['sort'](_0x45cb3a[_0x6f5f('0x21')][_0x6f5f('0x3b')]);_0x2bb228[_0x6f5f('0x3c')]=qs[_0x6f5f('0x28')](_[_0x6f5f('0x3d')](_0x45cb3a[_0x6f5f('0x21')],_0x3de3cc[_0x6f5f('0x28')]));_0x2bb228['where'][_0x6f5f('0x3e')]=_0x4e7f0c['id'];if(_0x45cb3a[_0x6f5f('0x21')][_0x6f5f('0x3f')]){_0x2bb228[_0x6f5f('0x3c')]=_[_0x6f5f('0x2e')](_0x2bb228[_0x6f5f('0x3c')],{'$or':_[_0x6f5f('0x1d')](_0x2bb228['attributes'],function(_0x27c454){var _0x3f1501={};_0x3f1501[_0x27c454]={'$like':'%'+_0x45cb3a[_0x6f5f('0x21')]['filter']+'%'};return _0x3f1501;})});}if(_0x45cb3a[_0x6f5f('0x21')][_0x6f5f('0x40')]){var _0x2c89dc=_0x45cb3a[_0x6f5f('0x21')][_0x6f5f('0x40')][_0x6f5f('0x41')](',');var _0x503f7f={};_0x503f7f[_0x2c89dc[0x0]]={'$gte':moment(_0x2c89dc[0x1])[_0x6f5f('0x42')](_0x6f5f('0x43'))};_0x2bb228['where']=_['merge'](_0x2bb228[_0x6f5f('0x3c')],_0x503f7f);}_0x2bb228=_[_0x6f5f('0x2e')]({},_0x2bb228,_0x45cb3a['options']);return db[_0x6f5f('0x34')]['count']({'where':_0x2bb228[_0x6f5f('0x3c')]})[_0x6f5f('0x17')](function(_0x2e7609){_0x4254c4[_0x6f5f('0x14')]=_0x2e7609;if(_0x45cb3a[_0x6f5f('0x21')]['includeAll']){_0x2bb228[_0x6f5f('0x2d')]=[{'all':!![]}];}return db['WhatsappMessage'][_0x6f5f('0x44')](_0x2bb228);})['then'](function(_0x1dd3a5){_0x4254c4[_0x6f5f('0x45')]=_0x1dd3a5;return _0x4254c4;});}})[_0x6f5f('0x17')](respondWithFilteredResult(_0x2bdfb3,_0x2bb228))[_0x6f5f('0x23')](handleError(_0x2bdfb3,null));};exports[_0x6f5f('0x46')]=function(_0x4e99d7,_0x2fb91c){return db['WhatsappInteraction']['find']({'where':{'id':_0x4e99d7['params']['id']}})[_0x6f5f('0x17')](handleEntityNotFound(_0x2fb91c,null))['then'](function(_0x986ce9){if(_0x986ce9){return _0x986ce9['setTags'](_0x4e99d7['body'][_0x6f5f('0x35')],_['omit'](_0x4e99d7[_0x6f5f('0x32')],[_0x6f5f('0x35'),'id'])||{})['spread'](function(){return db['Tag'][_0x6f5f('0x44')]({'attributes':['id',_0x6f5f('0x1b'),_0x6f5f('0x47')],'where':{'id':_0x4e99d7[_0x6f5f('0x32')][_0x6f5f('0x35')]}});})[_0x6f5f('0x17')](function(_0x5b69f9){socket[_0x6f5f('0x48')](_0x6f5f('0x49'),{'id':Number(_0x4e99d7[_0x6f5f('0x25')]['id']),'tags':_0x5b69f9||[]});return{'id':Number(_0x4e99d7[_0x6f5f('0x25')]['id']),'tags':_0x5b69f9||[]};});}})[_0x6f5f('0x17')](respondWithResult(_0x2fb91c,null))[_0x6f5f('0x23')](handleError(_0x2fb91c,null));};exports[_0x6f5f('0x4a')]=function(_0xd5d69a,_0x1ee131){return db['WhatsappInteraction']['find']({'where':{'id':_0xd5d69a[_0x6f5f('0x25')]['id']}})['then'](handleEntityNotFound(_0x1ee131,null))[_0x6f5f('0x17')](function(_0x366dc9){if(_0x366dc9){return _0x366dc9['removeTags'](_0xd5d69a['query']['ids']);}})[_0x6f5f('0x17')](respondWithStatusCode(_0x1ee131,null))[_0x6f5f('0x23')](handleError(_0x1ee131,null));};exports[_0x6f5f('0x4b')]=function(_0x473e84,_0x2f1a46){var _0x589728=moment()[_0x6f5f('0x4c')]()['toString']();var _0x5505a4=path[_0x6f5f('0x4d')](config[_0x6f5f('0x4e')],_0x6f5f('0x4f'),_0x6f5f('0x50'),'tmp');var _0x16d641=path[_0x6f5f('0x4d')](config[_0x6f5f('0x4e')],_0x6f5f('0x4f'),'files',_0x6f5f('0x51'));var _0x21dde7=path[_0x6f5f('0x4d')](_0x5505a4,_0x589728);var _0x1cb40f=util[_0x6f5f('0x42')](_0x6f5f('0x52'),_0x473e84[_0x6f5f('0x25')]['id'],_0x589728);var _0x4b2a02=path[_0x6f5f('0x4d')](_0x5505a4,_0x1cb40f);var _0x3e27fb=[];_0x3e27fb[_0x6f5f('0x53')]({'model':db[_0x6f5f('0x54')],'as':_0x6f5f('0x54'),'attributes':['id',_0x6f5f('0x55')],'raw':!![]});_0x3e27fb[_0x6f5f('0x53')]({'model':db[_0x6f5f('0x56')],'as':_0x6f5f('0x57'),'attributes':['id',_0x6f5f('0x58'),_0x6f5f('0x59')],'raw':!![]});if(_0x473e84['query'][_0x6f5f('0x51')]){_0x3e27fb[_0x6f5f('0x53')]({'model':db[_0x6f5f('0x5a')],'as':_0x6f5f('0x5a'),'raw':!![]});}var _0x371597=[{'model':db['WhatsappMessage'],'as':_0x6f5f('0x5b'),'attributes':['id',_0x6f5f('0x32'),_0x6f5f('0x5c'),_0x6f5f('0x5d'),'secret',_0x6f5f('0x5e')],'include':_0x3e27fb}];_0x371597['push']({'model':db[_0x6f5f('0x5f')],'as':_0x6f5f('0x60'),'attributes':['id',_0x6f5f('0x1b')]});_0x371597[_0x6f5f('0x53')]({'model':db['User'],'as':_0x6f5f('0x61'),'attributes':['id',_0x6f5f('0x55')]});return db[_0x6f5f('0x1e')][_0x6f5f('0x30')]({'where':{'id':_0x473e84[_0x6f5f('0x25')]['id']},'include':_0x371597})['then'](handleEntityNotFound(_0x2f1a46,null))[_0x6f5f('0x17')](function(_0x38e0b6){if(_0x38e0b6){var _0x63d915=_0x38e0b6[_0x6f5f('0x62')]({'plain':!![]});fs['mkdirSync'](_0x21dde7);var _0x3e7bcc={'channel':'Whatsapp','account':_0x63d915['Account']['name'],'agent':_0x63d915['Owner']?_0x63d915[_0x6f5f('0x61')][_0x6f5f('0x55')]:'N.A.','createdAt':moment(_0x63d915[_0x6f5f('0x5c')])[_0x6f5f('0x42')]('YYYY-MM-DD\x20HH:mm:ss')[_0x6f5f('0x63')](),'closedAt':_0x63d915['closed']?moment(_0x63d915[_0x6f5f('0x64')])[_0x6f5f('0x42')]('YYYY-MM-DD\x20HH:mm:ss')[_0x6f5f('0x63')]():'','disposition':_0x63d915[_0x6f5f('0x65')],'messages':_(_0x63d915[_0x6f5f('0x5b')])[_0x6f5f('0x3f')]({'secret':![]})[_0x6f5f('0x1d')](function(_0x225c8c){if(_0x225c8c['Attachment']){var _0x2e3bb1=path['join'](_0x16d641,_0x225c8c['Attachment']['basename']);if(fs[_0x6f5f('0x66')](_0x2e3bb1)){fs[_0x6f5f('0x67')](_0x2e3bb1)[_0x6f5f('0x68')](fs[_0x6f5f('0x69')](path[_0x6f5f('0x4d')](_0x21dde7,_0x225c8c[_0x6f5f('0x5a')][_0x6f5f('0x6a')])));}}return{'date':moment(_0x225c8c['createdAt'])[_0x6f5f('0x42')](_0x6f5f('0x43'))[_0x6f5f('0x63')](),'sender':_0x225c8c[_0x6f5f('0x5d')]==='out'?_0x225c8c[_0x6f5f('0x54')]?_0x225c8c[_0x6f5f('0x54')][_0x6f5f('0x55')]:_0x6f5f('0x6b'):_0x225c8c['Contact'][_0x6f5f('0x58')]+(_0x225c8c[_0x6f5f('0x57')][_0x6f5f('0x59')]?'\x20'+_0x225c8c[_0x6f5f('0x57')][_0x6f5f('0x59')]:''),'body':_0x225c8c[_0x6f5f('0x5a')]?_0x225c8c[_0x6f5f('0x5a')][_0x6f5f('0x6a')]:_0x225c8c['body'],'direction':_0x225c8c[_0x6f5f('0x5d')]===_0x6f5f('0x6c')?'A':'C','secret':_0x225c8c['secret'],'read':_0x225c8c['read'],'attachment':_0x225c8c['Attachment']};})[_0x6f5f('0x6d')]()};return ejs[_0x6f5f('0x6e')](path['join'](config[_0x6f5f('0x4e')],_0x6f5f('0x4f'),_0x6f5f('0x6f'),_0x6f5f('0x70')),{'interaction':_0x3e7bcc})[_0x6f5f('0x17')](function(_0x25d5aa){var _0x4095a7=path['join'](_0x21dde7,_0x6f5f('0x71')+_0x63d915['id']+'-'+_0x589728+_0x6f5f('0x72'));var _0x2dc3a0={'path':_0x4095a7,'channel':_0x6f5f('0x73'),'interactionId':_0x63d915['id']};return pdf['createPdfFromHTML'](_0x25d5aa,_0x2dc3a0);})['then'](function(){return new BPromise(function(_0x1c5edc,_0x13817b){zipdir(_0x21dde7,{'saveTo':_0x4b2a02},function(_0x31bcff,_0x4d084c){if(_0x31bcff)return _0x13817b(_0x31bcff);return _0x1c5edc(_0x4d084c);});})[_0x6f5f('0x17')](function(){return new BPromise(function(_0x1bb844,_0x3f4ee3){rimraf(_0x21dde7,function(_0x5ccf3d){if(_0x5ccf3d)_0x3f4ee3(_0x5ccf3d);return _0x1bb844();});});})[_0x6f5f('0x17')](function(){return _0x2f1a46[_0x6f5f('0x4b')](_0x4b2a02,_0x1cb40f,function(_0x5318d7){if(_0x5318d7){console[_0x6f5f('0x74')]('err',_0x5318d7);}else{fs['unlinkSync'](_0x4b2a02);}});});});}else{return _0x2f1a46[_0x6f5f('0x19')](0xc8);}})[_0x6f5f('0x23')](handleError(_0x2f1a46,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index 09bffde..2804c13 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 _0x063c=['getUsers','setDataValue','Users','map','findAll','then','unreadMessages','emit','hook','exports','../../mysqldb','WhatsappInteraction','WhatsappMessage','setMaxListeners','save','remove'];(function(_0x34d0a7,_0x582c90){var _0x299ea9=function(_0x2cc137){while(--_0x2cc137){_0x34d0a7['push'](_0x34d0a7['shift']());}};_0x299ea9(++_0x582c90);}(_0x063c,0xba));var _0xc063=function(_0x5b7288,_0x55a1af){_0x5b7288=_0x5b7288-0x0;var _0x5ed14d=_0x063c[_0x5b7288];return _0x5ed14d;};'use strict';var EventEmitter=require('events');var WhatsappInteraction=require(_0xc063('0x0'))['db'][_0xc063('0x1')];var WhatsappMessage=require(_0xc063('0x0'))['db'][_0xc063('0x2')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0xc063('0x3')](0x0);var events={'afterCreate':_0xc063('0x4'),'afterUpdate':'update','afterDestroy':_0xc063('0x5')};function emitEvent(_0x5ec48e){return function(_0x590831,_0x59b81f,_0x182d20){_0x590831[_0xc063('0x6')]({'attributes':['id'],'raw':!![]})['then'](function(_0x3dbe7c){_0x590831[_0xc063('0x7')](_0xc063('0x8'),_0x3dbe7c[_0xc063('0x9')](function(_0x4ac472){return{'id':_0x4ac472['id']};}));return WhatsappMessage[_0xc063('0xa')]({'where':{'WhatsappInteractionId':_0x590831['id'],'direction':'in','read':![]},'raw':!![]});})[_0xc063('0xb')](function(_0x4e788f){_0x590831[_0xc063('0x7')](_0xc063('0xc'),_0x4e788f['length']);WhatsappInteractionEvents[_0xc063('0xd')](_0x5ec48e+':'+_0x590831['id'],_0x590831);WhatsappInteractionEvents['emit'](_0x5ec48e,_0x590831);_0x182d20(null);})['catch'](_0x182d20(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappInteraction[_0xc063('0xe')](e,emitEvent(event));}}module[_0xc063('0xf')]=WhatsappInteractionEvents; \ No newline at end of file +var _0x71f4=['setMaxListeners','save','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','exports','WhatsappInteraction','../../mysqldb','WhatsappMessage'];(function(_0x261a25,_0x3b621a){var _0x4f5bc2=function(_0x39e381){while(--_0x39e381){_0x261a25['push'](_0x261a25['shift']());}};_0x4f5bc2(++_0x3b621a);}(_0x71f4,0xf9));var _0x471f=function(_0x1d445f,_0x564bbe){_0x1d445f=_0x1d445f-0x0;var _0x256d8d=_0x71f4[_0x1d445f];return _0x256d8d;};'use strict';var EventEmitter=require('events');var WhatsappInteraction=require('../../mysqldb')['db'][_0x471f('0x0')];var WhatsappMessage=require(_0x471f('0x1'))['db'][_0x471f('0x2')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x471f('0x3')](0x0);var events={'afterCreate':_0x471f('0x4'),'afterUpdate':'update','afterDestroy':_0x471f('0x5')};function emitEvent(_0x57bbfa){return function(_0x3e0c2e,_0x5978a7,_0x1d0101){_0x3e0c2e[_0x471f('0x6')]({'attributes':['id'],'raw':!![]})[_0x471f('0x7')](function(_0x3cdca9){_0x3e0c2e[_0x471f('0x8')](_0x471f('0x9'),_0x3cdca9[_0x471f('0xa')](function(_0x3a4fa9){return{'id':_0x3a4fa9['id']};}));return WhatsappMessage[_0x471f('0xb')]({'where':{'WhatsappInteractionId':_0x3e0c2e['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x51f77e){_0x3e0c2e['setDataValue'](_0x471f('0xc'),_0x51f77e[_0x471f('0xd')]);WhatsappInteractionEvents['emit'](_0x57bbfa+':'+_0x3e0c2e['id'],_0x3e0c2e);WhatsappInteractionEvents[_0x471f('0xe')](_0x57bbfa,_0x3e0c2e);_0x1d0101(null);})[_0x471f('0xf')](_0x1d0101(null));};}for(var e in events){if(events[_0x471f('0x10')](e)){var event=events[e];WhatsappInteraction['hook'](e,emitEvent(event));}}module[_0x471f('0x11')]=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index 1daadd1..7df07bb 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 _0xd54c=['rimraf','../../config/environment','./whatsappInteraction.attributes','define','whatsapp_interactions','changed','closed','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','bluebird','request-promise','path'];(function(_0x175851,_0x53fca5){var _0x544070=function(_0x4c3188){while(--_0x4c3188){_0x175851['push'](_0x175851['shift']());}};_0x544070(++_0x53fca5);}(_0xd54c,0x1e5));var _0xcd54=function(_0x36ff60,_0x277b8c){_0x36ff60=_0x36ff60-0x0;var _0x4e2b33=_0xd54c[_0x36ff60];return _0x4e2b33;};'use strict';var _=require(_0xcd54('0x0'));var util=require(_0xcd54('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xcd54('0x2'));var rp=require(_0xcd54('0x3'));var fs=require('fs');var path=require(_0xcd54('0x4'));var rimraf=require(_0xcd54('0x5'));var config=require(_0xcd54('0x6'));var attributes=require(_0xcd54('0x7'));module['exports']=function(_0x2a6b8e,_0x1b61cc){return _0x2a6b8e[_0xcd54('0x8')]('WhatsappInteraction',attributes,{'tableName':_0xcd54('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x26765f,_0x7b35c2,_0x11479c){if(_0x26765f[_0xcd54('0xa')](_0xcd54('0xb'))){_0x26765f['closedAt']=moment()[_0xcd54('0xc')](_0xcd54('0xd'));}_0x11479c(null,_0x26765f);}}});}; \ No newline at end of file +var _0x6d32=['bluebird','path','../../config/environment','./whatsappInteraction.attributes','exports','WhatsappInteraction','whatsapp_interactions','changed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','util','moment'];(function(_0x162ee0,_0x291661){var _0x48fc5e=function(_0x297a35){while(--_0x297a35){_0x162ee0['push'](_0x162ee0['shift']());}};_0x48fc5e(++_0x291661);}(_0x6d32,0x183));var _0x26d3=function(_0x2d2c16,_0x4e88b6){_0x2d2c16=_0x2d2c16-0x0;var _0x53f2fb=_0x6d32[_0x2d2c16];return _0x53f2fb;};'use strict';var _=require(_0x26d3('0x0'));var util=require(_0x26d3('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x26d3('0x2'));var BPromise=require(_0x26d3('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x26d3('0x4'));var rimraf=require('rimraf');var config=require(_0x26d3('0x5'));var attributes=require(_0x26d3('0x6'));module[_0x26d3('0x7')]=function(_0x3587da,_0x4091dc){return _0x3587da['define'](_0x26d3('0x8'),attributes,{'tableName':_0x26d3('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x272b0d,_0x59bfb6,_0x8d0ff5){if(_0x272b0d[_0x26d3('0xa')]('closed')){_0x272b0d[_0x26d3('0xb')]=moment()['format'](_0x26d3('0xc'));}_0x8d0ff5(null,_0x272b0d);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index 7969a6c..87d7f15 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 _0x3f79=['debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','body','options','attributes','info','UpdateWhatsappInteraction','AddTagsToWhatsappInteraction','WhatsappInteraction','find','where','addTags','omit','ids','spread','AddTags','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','register','request','then','WhatsappInteraction,\x20%s,\x20%s','request\x20sent'];(function(_0x31b7b2,_0x40e71c){var _0x1c9954=function(_0x7a7919){while(--_0x7a7919){_0x31b7b2['push'](_0x31b7b2['shift']());}};_0x1c9954(++_0x40e71c);}(_0x3f79,0x187));var _0x93f7=function(_0x5533b3,_0x18478c){_0x5533b3=_0x5533b3-0x0;var _0x25be14=_0x3f79[_0x5533b3];return _0x25be14;};'use strict';var _=require(_0x93f7('0x0'));var util=require(_0x93f7('0x1'));var moment=require(_0x93f7('0x2'));var BPromise=require(_0x93f7('0x3'));var rs=require(_0x93f7('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x93f7('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x93f7('0x6'))(_0x93f7('0x7'));var config=require(_0x93f7('0x8'));var jayson=require(_0x93f7('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0x93f7('0xa')]=_[_0x93f7('0xb')](config[_0x93f7('0xa')],{'host':_0x93f7('0xc'),'port':0x18eb});var socket=require(_0x93f7('0xd'))(new Redis(config[_0x93f7('0xa')]));require('./whatsappInteraction.socket')[_0x93f7('0xe')](socket);function respondWithRpcPromise(_0x5571fc,_0x4a20dc,_0x288bae){return new BPromise(function(_0x313a29,_0x40b6e2){return client[_0x93f7('0xf')](_0x5571fc,_0x288bae)[_0x93f7('0x10')](function(_0x4f89b8){logger['info'](_0x93f7('0x11'),_0x4a20dc,_0x93f7('0x12'));logger[_0x93f7('0x13')](_0x93f7('0x14'),_0x4a20dc,_0x93f7('0x12'),JSON[_0x93f7('0x15')](_0x4f89b8));if(_0x4f89b8['error']){if(_0x4f89b8[_0x93f7('0x16')][_0x93f7('0x17')]===0x1f4){logger[_0x93f7('0x16')]('WhatsappInteraction,\x20%s,\x20%s',_0x4a20dc,_0x4f89b8['error']['message']);return _0x40b6e2(_0x4f89b8[_0x93f7('0x16')][_0x93f7('0x18')]);}logger[_0x93f7('0x16')](_0x93f7('0x11'),_0x4a20dc,_0x4f89b8[_0x93f7('0x16')]['message']);return _0x313a29(_0x4f89b8[_0x93f7('0x16')][_0x93f7('0x18')]);}else{logger['info']('WhatsappInteraction,\x20%s,\x20%s',_0x4a20dc,_0x93f7('0x12'));_0x313a29(_0x4f89b8[_0x93f7('0x19')][_0x93f7('0x18')]);}})[_0x93f7('0x1a')](function(_0x460530){logger['error'](_0x93f7('0x11'),_0x4a20dc,_0x460530);_0x40b6e2(_0x460530);});});}exports['UpdateWhatsappInteraction']=function(_0x2b4a07){var _0x37e817=this;return new Promise(function(_0x5308f6,_0x395833){return db['WhatsappInteraction']['update'](_0x2b4a07[_0x93f7('0x1b')],{'raw':_0x2b4a07[_0x93f7('0x1c')]?_0x2b4a07[_0x93f7('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2b4a07['options']?_0x2b4a07[_0x93f7('0x1c')]['where']||null:null,'attributes':_0x2b4a07[_0x93f7('0x1c')]?_0x2b4a07[_0x93f7('0x1c')][_0x93f7('0x1d')]||null:null,'limit':_0x2b4a07['options']?_0x2b4a07[_0x93f7('0x1c')]['limit']||null:null})['then'](function(_0x58c8a0){logger[_0x93f7('0x1e')](_0x93f7('0x1f'),_0x2b4a07);logger['debug'](_0x93f7('0x1f'),_0x2b4a07,JSON[_0x93f7('0x15')](_0x58c8a0));_0x5308f6(_0x58c8a0);})['catch'](function(_0x4e6b0c){logger[_0x93f7('0x16')]('UpdateWhatsappInteraction',_0x4e6b0c[_0x93f7('0x18')],_0x2b4a07);_0x395833(_0x37e817['error'](0x1f4,_0x4e6b0c[_0x93f7('0x18')]));});});};exports[_0x93f7('0x20')]=function(_0x8eb260){return new Promise(function(_0x5d1ba7,_0x2366a3){return db[_0x93f7('0x21')][_0x93f7('0x22')]({'where':_0x8eb260[_0x93f7('0x1c')]?_0x8eb260[_0x93f7('0x1c')][_0x93f7('0x23')]||null:null})[_0x93f7('0x10')](function(_0x255414){if(_0x255414){return _0x255414[_0x93f7('0x24')](_0x8eb260[_0x93f7('0x1b')]['ids'],_[_0x93f7('0x25')](_0x8eb260[_0x93f7('0x1b')],[_0x93f7('0x26'),'id'])||{});}})[_0x93f7('0x27')](function(_0x17338e){logger[_0x93f7('0x1e')](_0x93f7('0x28'),_0x8eb260);logger[_0x93f7('0x13')](_0x93f7('0x28'),_0x8eb260,JSON[_0x93f7('0x15')](_0x17338e));_0x5d1ba7(_0x17338e);})[_0x93f7('0x1a')](function(_0x377646){logger[_0x93f7('0x16')](_0x93f7('0x28'),_0x377646[_0x93f7('0x18')],_0x8eb260);_0x2366a3(_this[_0x93f7('0x16')](0x1f4,_0x377646[_0x93f7('0x18')]));});});}; \ No newline at end of file +var _0x076b=['client','http','redis','defaults','socket.io-emitter','request','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateWhatsappInteraction','WhatsappInteraction','body','options','raw','where','then','find','addTags','ids','AddTags','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x33a694,_0x9b6640){var _0x41ff01=function(_0x4c38b7){while(--_0x4c38b7){_0x33a694['push'](_0x33a694['shift']());}};_0x41ff01(++_0x9b6640);}(_0x076b,0x198));var _0xb076=function(_0x3d1b2d,_0x170037){_0x3d1b2d=_0x3d1b2d-0x0;var _0x14148f=_0x076b[_0x3d1b2d];return _0x14148f;};'use strict';var _=require(_0xb076('0x0'));var util=require(_0xb076('0x1'));var moment=require(_0xb076('0x2'));var BPromise=require(_0xb076('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb076('0x4'))['db'];var utils=require(_0xb076('0x5'));var logger=require(_0xb076('0x6'))(_0xb076('0x7'));var config=require(_0xb076('0x8'));var jayson=require(_0xb076('0x9'));var client=jayson[_0xb076('0xa')][_0xb076('0xb')]({'port':0x232a});config[_0xb076('0xc')]=_[_0xb076('0xd')](config[_0xb076('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xb076('0xe'))(new Redis(config[_0xb076('0xc')]));require('./whatsappInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x4b8c13,_0x47d698,_0x45ce1f){return new BPromise(function(_0x449777,_0x12f666){return client[_0xb076('0xf')](_0x4b8c13,_0x45ce1f)['then'](function(_0x42b0a9){logger[_0xb076('0x10')](_0xb076('0x11'),_0x47d698,_0xb076('0x12'));logger[_0xb076('0x13')](_0xb076('0x14'),_0x47d698,_0xb076('0x12'),JSON[_0xb076('0x15')](_0x42b0a9));if(_0x42b0a9[_0xb076('0x16')]){if(_0x42b0a9['error'][_0xb076('0x17')]===0x1f4){logger['error'](_0xb076('0x11'),_0x47d698,_0x42b0a9[_0xb076('0x16')][_0xb076('0x18')]);return _0x12f666(_0x42b0a9[_0xb076('0x16')][_0xb076('0x18')]);}logger[_0xb076('0x16')](_0xb076('0x11'),_0x47d698,_0x42b0a9['error'][_0xb076('0x18')]);return _0x449777(_0x42b0a9['error'][_0xb076('0x18')]);}else{logger[_0xb076('0x10')](_0xb076('0x11'),_0x47d698,'request\x20sent');_0x449777(_0x42b0a9[_0xb076('0x19')][_0xb076('0x18')]);}})[_0xb076('0x1a')](function(_0x315ec7){logger['error']('WhatsappInteraction,\x20%s,\x20%s',_0x47d698,_0x315ec7);_0x12f666(_0x315ec7);});});}exports[_0xb076('0x1b')]=function(_0x52c753){var _0x2dffdf=this;return new Promise(function(_0x110901,_0x558678){return db[_0xb076('0x1c')]['update'](_0x52c753[_0xb076('0x1d')],{'raw':_0x52c753[_0xb076('0x1e')]?_0x52c753[_0xb076('0x1e')][_0xb076('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x52c753['options']?_0x52c753[_0xb076('0x1e')][_0xb076('0x20')]||null:null,'attributes':_0x52c753[_0xb076('0x1e')]?_0x52c753[_0xb076('0x1e')]['attributes']||null:null,'limit':_0x52c753[_0xb076('0x1e')]?_0x52c753[_0xb076('0x1e')]['limit']||null:null})[_0xb076('0x21')](function(_0xf59dd7){logger[_0xb076('0x10')](_0xb076('0x1b'),_0x52c753);logger[_0xb076('0x13')](_0xb076('0x1b'),_0x52c753,JSON['stringify'](_0xf59dd7));_0x110901(_0xf59dd7);})['catch'](function(_0x3e6781){logger[_0xb076('0x16')](_0xb076('0x1b'),_0x3e6781['message'],_0x52c753);_0x558678(_0x2dffdf[_0xb076('0x16')](0x1f4,_0x3e6781[_0xb076('0x18')]));});});};exports['AddTagsToWhatsappInteraction']=function(_0x594c94){return new Promise(function(_0x53d8d1,_0x1d8a59){return db['WhatsappInteraction'][_0xb076('0x22')]({'where':_0x594c94[_0xb076('0x1e')]?_0x594c94[_0xb076('0x1e')][_0xb076('0x20')]||null:null})[_0xb076('0x21')](function(_0x4d6f4d){if(_0x4d6f4d){return _0x4d6f4d[_0xb076('0x23')](_0x594c94[_0xb076('0x1d')][_0xb076('0x24')],_['omit'](_0x594c94[_0xb076('0x1d')],[_0xb076('0x24'),'id'])||{});}})['spread'](function(_0x4a4a65){logger[_0xb076('0x10')](_0xb076('0x25'),_0x594c94);logger[_0xb076('0x13')](_0xb076('0x25'),_0x594c94,JSON['stringify'](_0x4a4a65));_0x53d8d1(_0x4a4a65);})['catch'](function(_0x306e88){logger['error'](_0xb076('0x25'),_0x306e88[_0xb076('0x18')],_0x594c94);_0x1d8a59(_this[_0xb076('0x16')](0x1f4,_0x306e88[_0xb076('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index 3e83d7d..552470c 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 _0xd76d=['whatsappInteraction:','./whatsappInteraction.events','save','update','emit'];(function(_0x4c4d88,_0x1c929d){var _0x5d714c=function(_0x12833a){while(--_0x12833a){_0x4c4d88['push'](_0x4c4d88['shift']());}};_0x5d714c(++_0x1c929d);}(_0xd76d,0x178));var _0xdd76=function(_0x3ee6bc,_0x4025bb){_0x3ee6bc=_0x3ee6bc-0x0;var _0x5bda78=_0xd76d[_0x3ee6bc];return _0x5bda78;};'use strict';var WhatsappInteractionEvents=require(_0xdd76('0x0'));var events=[_0xdd76('0x1'),'remove',_0xdd76('0x2')];function createListener(_0x368085,_0x50d51c){return function(_0x2b5fdf){_0x50d51c[_0xdd76('0x3')](_0x368085,_0x2b5fdf);};}function removeListener(_0xa0372b,_0x1a7a0e){return function(){WhatsappInteractionEvents['removeListener'](_0xa0372b,_0x1a7a0e);};}exports['register']=function(_0x57a418){for(var _0x44770b=0x0,_0x48e41c=events['length'];_0x44770b<_0x48e41c;_0x44770b++){var _0x5795f7=events[_0x44770b];var _0x1a0ce0=createListener(_0xdd76('0x4')+_0x5795f7,_0x57a418);WhatsappInteractionEvents['on'](_0x5795f7,_0x1a0ce0);}}; \ No newline at end of file +var _0xf7a9=['./whatsappInteraction.events','save','remove','update','removeListener','register','whatsappInteraction:'];(function(_0x26b622,_0x237e9e){var _0x58a028=function(_0xde1652){while(--_0xde1652){_0x26b622['push'](_0x26b622['shift']());}};_0x58a028(++_0x237e9e);}(_0xf7a9,0x1e3));var _0x9f7a=function(_0x5b75f3,_0x112a83){_0x5b75f3=_0x5b75f3-0x0;var _0x1aaea6=_0xf7a9[_0x5b75f3];return _0x1aaea6;};'use strict';var WhatsappInteractionEvents=require(_0x9f7a('0x0'));var events=[_0x9f7a('0x1'),_0x9f7a('0x2'),_0x9f7a('0x3')];function createListener(_0x3f01c9,_0x494df4){return function(_0x16837e){_0x494df4['emit'](_0x3f01c9,_0x16837e);};}function removeListener(_0x58c30c,_0x13003e){return function(){WhatsappInteractionEvents[_0x9f7a('0x4')](_0x58c30c,_0x13003e);};}exports[_0x9f7a('0x5')]=function(_0x5e154c){for(var _0x1f2a53=0x0,_0x55592d=events['length'];_0x1f2a53<_0x55592d;_0x1f2a53++){var _0x58fc07=events[_0x1f2a53];var _0x11cd11=createListener(_0x9f7a('0x6')+_0x58fc07,_0x5e154c);WhatsappInteractionEvents['on'](_0x58fc07,_0x11cd11);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index 0e68173..acfe711 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 _0xe02a=['/:id/status','status','put','/:id','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','show','post','whatsapp','whatsappmessage:create','create'];(function(_0x5d79bf,_0x54ce0b){var _0x4d1060=function(_0x147bc1){while(--_0x147bc1){_0x5d79bf['push'](_0x5d79bf['shift']());}};_0x4d1060(++_0x54ce0b);}(_0xe02a,0xe4));var _0xae02=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xe02a[_0x17d9e3];return _0x14192d;};'use strict';var multer=require('multer');var util=require(_0xae02('0x0'));var path=require(_0xae02('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xae02('0x2'));var auth=require(_0xae02('0x3'));var interaction=require(_0xae02('0x4'));var config=require(_0xae02('0x5'));var controller=require('./whatsappMessage.controller');router['get']('/',auth[_0xae02('0x6')](),controller[_0xae02('0x7')]);router[_0xae02('0x8')]('/describe',auth['isAuthenticated'](),controller[_0xae02('0x9')]);router['get']('/:id',auth[_0xae02('0x6')](),controller[_0xae02('0xa')]);router[_0xae02('0xb')]('/',auth['isAuthenticated'](),interaction['tracked'](_0xae02('0xc'),_0xae02('0xd')),controller[_0xae02('0xe')]);router[_0xae02('0xb')](_0xae02('0xf'),controller[_0xae02('0x10')]);router[_0xae02('0x11')](_0xae02('0x12'),auth[_0xae02('0x6')](),controller[_0xae02('0x13')]);router[_0xae02('0x11')](_0xae02('0x14'),auth[_0xae02('0x6')](),controller[_0xae02('0x15')]);router[_0xae02('0x11')](_0xae02('0x16'),auth[_0xae02('0x6')](),controller[_0xae02('0x17')]);router[_0xae02('0x18')]('/:id',auth[_0xae02('0x6')](),controller[_0xae02('0x19')]);module[_0xae02('0x1a')]=router; \ No newline at end of file +var _0x935f=['/:id/accept','reject','delete','destroy','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','/describe','describe','get','/:id','show','tracked','whatsapp','whatsappmessage:create','create','/:id/status','status','put'];(function(_0x5ebec4,_0x474731){var _0x3b9d3b=function(_0x3aa9da){while(--_0x3aa9da){_0x5ebec4['push'](_0x5ebec4['shift']());}};_0x3b9d3b(++_0x474731);}(_0x935f,0xbb));var _0xf935=function(_0x124296,_0x5a2798){_0x124296=_0x124296-0x0;var _0x3e3a09=_0x935f[_0x124296];return _0x3e3a09;};'use strict';var multer=require('multer');var util=require(_0xf935('0x0'));var path=require('path');var timeout=require(_0xf935('0x1'));var express=require(_0xf935('0x2'));var router=express[_0xf935('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xf935('0x4'));var interaction=require(_0xf935('0x5'));var config=require(_0xf935('0x6'));var controller=require('./whatsappMessage.controller');router['get']('/',auth[_0xf935('0x7')](),controller[_0xf935('0x8')]);router['get'](_0xf935('0x9'),auth['isAuthenticated'](),controller[_0xf935('0xa')]);router[_0xf935('0xb')](_0xf935('0xc'),auth[_0xf935('0x7')](),controller[_0xf935('0xd')]);router['post']('/',auth[_0xf935('0x7')](),interaction[_0xf935('0xe')](_0xf935('0xf'),_0xf935('0x10')),controller[_0xf935('0x11')]);router['post'](_0xf935('0x12'),controller[_0xf935('0x13')]);router[_0xf935('0x14')](_0xf935('0xc'),auth['isAuthenticated'](),controller['update']);router['put'](_0xf935('0x15'),auth[_0xf935('0x7')](),controller['accept']);router[_0xf935('0x14')]('/:id/reject',auth[_0xf935('0x7')](),controller[_0xf935('0x16')]);router[_0xf935('0x17')](_0xf935('0xc'),auth['isAuthenticated'](),controller[_0xf935('0x18')]);module[_0xf935('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 5487f53..c0fa78b 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 _0xc15e=['ENUM','out','STRING','DATE','BOOLEAN','TEXT'];(function(_0x5b664a,_0x4e14ef){var _0x968f4f=function(_0xb3759c){while(--_0xb3759c){_0x5b664a['push'](_0x5b664a['shift']());}};_0x968f4f(++_0x4e14ef);}(_0xc15e,0x191));var _0xec15=function(_0x463304,_0x2a29ae){_0x463304=_0x463304-0x0;var _0x3ee5f6=_0xc15e[_0x463304];return _0x3ee5f6;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize[_0xec15('0x0')]('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xec15('0x1')]('in',_0xec15('0x2')),'defaultValue':_0xec15('0x2'),'allowNull':![]},'messageId':{'type':Sequelize[_0xec15('0x3')](0xbe)},'phone':{'type':Sequelize[_0xec15('0x3')]},'readAt':{'type':Sequelize[_0xec15('0x4')]},'secret':{'type':Sequelize[_0xec15('0x5')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xec15('0x3')]},'providerResponse':{'type':Sequelize[_0xec15('0x0')]}}; \ No newline at end of file +var _0xc734=['sequelize','exports','TEXT','medium','BOOLEAN','out','STRING','DATE'];(function(_0x258fb5,_0x47c7f5){var _0x124437=function(_0x4a0ad1){while(--_0x4a0ad1){_0x258fb5['push'](_0x258fb5['shift']());}};_0x124437(++_0x47c7f5);}(_0xc734,0x108));var _0x4c73=function(_0x23ec06,_0x561142){_0x23ec06=_0x23ec06-0x0;var _0x2831d4=_0xc734[_0x23ec06];return _0x2831d4;};'use strict';var Sequelize=require(_0x4c73('0x0'));module[_0x4c73('0x1')]={'body':{'type':Sequelize[_0x4c73('0x2')](_0x4c73('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x4c73('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x4c73('0x5')),'defaultValue':_0x4c73('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0x4c73('0x6')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0x4c73('0x7')]},'secret':{'type':Sequelize[_0x4c73('0x4')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x4c73('0x6')]},'providerResponse':{'type':Sequelize[_0x4c73('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index 576a59c..041c003 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 _0xca24=['info','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','error','code','message','WhatsappMessage,\x20%s,\x20%s','sendStatus','status','end','json','offset','limit','set','Content-Range','reject','destroy','stack','name','index','map','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','count','includeAll','findAll','rows','catch','params','WhatsappMessage','rawAttributes','create','body','update','find','describe','whatsapp-interactions','accept','whatsapp','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','get','WhatsappInteraction','read1stAt','interaction','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','stringify','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','User','agent','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','WhatsappInteractionId','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','contact','rejectmessage','WhatsappAccount','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','twilio','MessageSid','messageId','MessageStatus','eml-format','rimraf','zip-dir','request-promise','moment','mustache','path','to-csv','ejs','lodash','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','redis','defaults','register','client','http','then'];(function(_0x3cd91d,_0x163516){var _0x3b4fab=function(_0x1b3319){while(--_0x1b3319){_0x3cd91d['push'](_0x3cd91d['shift']());}};_0x3b4fab(++_0x163516);}(_0xca24,0x68));var _0x4ca2=function(_0x1328da,_0x151104){_0x1328da=_0x1328da-0x0;var _0x4470ea=_0xca24[_0x1328da];return _0x4470ea;};'use strict';var emlformat=require(_0x4ca2('0x0'));var rimraf=require(_0x4ca2('0x1'));var zipdir=require(_0x4ca2('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4ca2('0x3'));var moment=require(_0x4ca2('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x4ca2('0x5'));var util=require('util');var path=require(_0x4ca2('0x6'));var sox=require('sox');var csv=require(_0x4ca2('0x7'));var ejs=require(_0x4ca2('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4ca2('0x9'));var squel=require('squel');var crypto=require(_0x4ca2('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x4ca2('0xb'));var toCsv=require(_0x4ca2('0x7'));var querystring=require('querystring');var Papa=require(_0x4ca2('0xc'));var Redis=require('ioredis');var authService=require(_0x4ca2('0xd'));var qs=require(_0x4ca2('0xe'));var as=require(_0x4ca2('0xf'));var hardwareService=require(_0x4ca2('0x10'));var logger=require(_0x4ca2('0x11'))(_0x4ca2('0x12'));var utils=require('../../config/utils');var config=require(_0x4ca2('0x13'));var licenseUtil=require(_0x4ca2('0x14'));var db=require('../../mysqldb')['db'];config[_0x4ca2('0x15')]=_[_0x4ca2('0x16')](config[_0x4ca2('0x15')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./whatsappMessage.socket')[_0x4ca2('0x17')](socket);var jayson=require('jayson/promise');var client=jayson[_0x4ca2('0x18')][_0x4ca2('0x19')]({'port':0x232c});var client9002=jayson[_0x4ca2('0x18')][_0x4ca2('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x198516,_0x11a089,_0x2c4b8e,_0x45c675){return new BPromise(function(_0xb98ea2,_0x3e302b){var _0x279b5f=_0x45c675||client;return _0x279b5f['request'](_0x198516,_0x2c4b8e)[_0x4ca2('0x1a')](function(_0x54a60c){logger[_0x4ca2('0x1b')]('WhatsappMessage,\x20%s,\x20%s',_0x11a089,_0x4ca2('0x1c'));logger[_0x4ca2('0x1d')](_0x4ca2('0x1e'),_0x11a089,_0x4ca2('0x1c'),JSON['stringify'](_0x54a60c));if(_0x54a60c['error']){if(_0x54a60c[_0x4ca2('0x1f')][_0x4ca2('0x20')]===0x1f4){logger[_0x4ca2('0x1f')]('WhatsappMessage,\x20%s,\x20%s',_0x11a089,_0x54a60c[_0x4ca2('0x1f')][_0x4ca2('0x21')]);return _0x3e302b(_0x54a60c['error'][_0x4ca2('0x21')]);}logger[_0x4ca2('0x1f')](_0x4ca2('0x22'),_0x11a089,_0x54a60c[_0x4ca2('0x1f')][_0x4ca2('0x21')]);return _0xb98ea2(_0x54a60c[_0x4ca2('0x1f')][_0x4ca2('0x21')]);}else{logger[_0x4ca2('0x1b')](_0x4ca2('0x22'),_0x11a089,_0x4ca2('0x1c'));_0xb98ea2(_0x54a60c['result'][_0x4ca2('0x21')]);}})['catch'](function(_0x5aed08){logger[_0x4ca2('0x1f')]('WhatsappMessage,\x20%s,\x20%s',_0x11a089,_0x5aed08);_0x3e302b(_0x5aed08);});});}function respondWithStatusCode(_0x61272f,_0x576b82){_0x576b82=_0x576b82||0xcc;return function(_0x524baa){if(_0x524baa){return _0x61272f[_0x4ca2('0x23')](_0x576b82);}return _0x61272f[_0x4ca2('0x24')](_0x576b82)[_0x4ca2('0x25')]();};}function respondWithResult(_0x538b1c,_0x152552){_0x152552=_0x152552||0xc8;return function(_0x49d4b9){if(_0x49d4b9){return _0x538b1c[_0x4ca2('0x24')](_0x152552)[_0x4ca2('0x26')](_0x49d4b9);}};}function respondWithFilteredResult(_0x5698e6,_0x565b68){return function(_0x2de826){if(_0x2de826){var _0x24ca4a=typeof _0x565b68[_0x4ca2('0x27')]==='undefined'&&typeof _0x565b68[_0x4ca2('0x28')]==='undefined';var _0x2ea07c=_0x2de826['count'];var _0x669bba=_0x24ca4a?0x0:_0x565b68['offset'];var _0xed5dbb=_0x24ca4a?_0x2de826['count']:_0x565b68[_0x4ca2('0x27')]+_0x565b68['limit'];var _0x16013c;if(_0xed5dbb>=_0x2ea07c){_0xed5dbb=_0x2ea07c;_0x16013c=0xc8;}else{_0x16013c=0xce;}_0x5698e6[_0x4ca2('0x24')](_0x16013c);return _0x5698e6[_0x4ca2('0x29')](_0x4ca2('0x2a'),_0x669bba+'-'+_0xed5dbb+'/'+_0x2ea07c)[_0x4ca2('0x26')](_0x2de826);}return null;};}function patchUpdates(_0x369cba){return function(_0x57b68f){try{jsonpatch['apply'](_0x57b68f,_0x369cba,!![]);}catch(_0x1214c6){return BPromise[_0x4ca2('0x2b')](_0x1214c6);}return _0x57b68f['save']();};}function saveUpdates(_0x2af019,_0x4bc01d){return function(_0x2c8f81){if(_0x2c8f81){return _0x2c8f81['update'](_0x2af019)['then'](function(_0x9aa770){return _0x9aa770;});}return null;};}function removeEntity(_0xc642d4,_0x4c207a){return function(_0x32cb0f){if(_0x32cb0f){return _0x32cb0f[_0x4ca2('0x2c')]()[_0x4ca2('0x1a')](function(){_0xc642d4[_0x4ca2('0x24')](0xcc)['end']();});}};}function handleEntityNotFound(_0x455728,_0x1ed3ec){return function(_0x55e383){if(!_0x55e383){_0x455728[_0x4ca2('0x23')](0x194);}return _0x55e383;};}function handleError(_0x2a6594,_0x35b9dc){_0x35b9dc=_0x35b9dc||0x1f4;return function(_0x843f1c){logger[_0x4ca2('0x1f')](_0x843f1c[_0x4ca2('0x2d')]);if(_0x843f1c[_0x4ca2('0x2e')]){delete _0x843f1c[_0x4ca2('0x2e')];}_0x2a6594[_0x4ca2('0x24')](_0x35b9dc)['send'](_0x843f1c);};}exports[_0x4ca2('0x2f')]=function(_0x33b5c6,_0x3b3df5){var _0x1def52={},_0x3e51b2={},_0x368922={'count':0x0,'rows':[]};var _0x1decd8=_[_0x4ca2('0x30')](db['WhatsappMessage']['rawAttributes'],function(_0x31b424){return{'name':_0x31b424[_0x4ca2('0x31')],'type':_0x31b424[_0x4ca2('0x32')][_0x4ca2('0x33')]};});_0x3e51b2[_0x4ca2('0x34')]=_[_0x4ca2('0x30')](_0x1decd8,'name');_0x3e51b2[_0x4ca2('0x35')]=_[_0x4ca2('0x36')](_0x33b5c6['query']);_0x3e51b2[_0x4ca2('0x37')]=_[_0x4ca2('0x38')](_0x3e51b2[_0x4ca2('0x34')],_0x3e51b2['query']);_0x1def52[_0x4ca2('0x39')]=_[_0x4ca2('0x38')](_0x3e51b2[_0x4ca2('0x34')],qs[_0x4ca2('0x3a')](_0x33b5c6[_0x4ca2('0x35')][_0x4ca2('0x3a')]));_0x1def52[_0x4ca2('0x39')]=_0x1def52[_0x4ca2('0x39')][_0x4ca2('0x3b')]?_0x1def52[_0x4ca2('0x39')]:_0x3e51b2['model'];if(!_0x33b5c6[_0x4ca2('0x35')][_0x4ca2('0x3c')](_0x4ca2('0x3d'))){_0x1def52['limit']=qs['limit'](_0x33b5c6[_0x4ca2('0x35')][_0x4ca2('0x28')]);_0x1def52[_0x4ca2('0x27')]=qs[_0x4ca2('0x27')](_0x33b5c6[_0x4ca2('0x35')][_0x4ca2('0x27')]);}_0x1def52[_0x4ca2('0x3e')]=qs['sort'](_0x33b5c6[_0x4ca2('0x35')][_0x4ca2('0x3f')]);_0x1def52[_0x4ca2('0x40')]=qs[_0x4ca2('0x37')](_['pick'](_0x33b5c6[_0x4ca2('0x35')],_0x3e51b2['filters']),_0x1decd8);if(_0x33b5c6[_0x4ca2('0x35')][_0x4ca2('0x41')]){_0x1def52[_0x4ca2('0x40')]=_['merge'](_0x1def52[_0x4ca2('0x40')],{'$or':_[_0x4ca2('0x30')](_0x1decd8,function(_0x55bc9c){if(_0x55bc9c[_0x4ca2('0x32')]!==_0x4ca2('0x42')){var _0x1a6bce={};_0x1a6bce[_0x55bc9c['name']]={'$like':'%'+_0x33b5c6['query'][_0x4ca2('0x41')]+'%'};return _0x1a6bce;}})});}_0x1def52=_[_0x4ca2('0x43')]({},_0x1def52,_0x33b5c6['options']);var _0x2fd001={'where':_0x1def52[_0x4ca2('0x40')]};return db['WhatsappMessage'][_0x4ca2('0x44')](_0x2fd001)[_0x4ca2('0x1a')](function(_0x435313){_0x368922[_0x4ca2('0x44')]=_0x435313;if(_0x33b5c6[_0x4ca2('0x35')][_0x4ca2('0x45')]){_0x1def52['include']=[{'all':!![]}];}return db['WhatsappMessage'][_0x4ca2('0x46')](_0x1def52);})[_0x4ca2('0x1a')](function(_0x572202){_0x368922[_0x4ca2('0x47')]=_0x572202;return _0x368922;})[_0x4ca2('0x1a')](respondWithFilteredResult(_0x3b3df5,_0x1def52))[_0x4ca2('0x48')](handleError(_0x3b3df5,null));};exports['show']=function(_0x412167,_0xbe69d6){var _0x4b6fcc={'raw':!![],'where':{'id':_0x412167[_0x4ca2('0x49')]['id']}},_0x306e7e={};_0x306e7e[_0x4ca2('0x34')]=_[_0x4ca2('0x36')](db[_0x4ca2('0x4a')][_0x4ca2('0x4b')]);_0x306e7e['query']=_[_0x4ca2('0x36')](_0x412167[_0x4ca2('0x35')]);_0x306e7e['filters']=_[_0x4ca2('0x38')](_0x306e7e[_0x4ca2('0x34')],_0x306e7e[_0x4ca2('0x35')]);_0x4b6fcc['attributes']=_[_0x4ca2('0x38')](_0x306e7e['model'],qs[_0x4ca2('0x3a')](_0x412167[_0x4ca2('0x35')][_0x4ca2('0x3a')]));_0x4b6fcc[_0x4ca2('0x39')]=_0x4b6fcc[_0x4ca2('0x39')][_0x4ca2('0x3b')]?_0x4b6fcc[_0x4ca2('0x39')]:_0x306e7e['model'];if(_0x412167[_0x4ca2('0x35')][_0x4ca2('0x45')]){_0x4b6fcc['include']=[{'all':!![]}];}_0x4b6fcc=_[_0x4ca2('0x43')]({},_0x4b6fcc,_0x412167['options']);return db[_0x4ca2('0x4a')]['find'](_0x4b6fcc)['then'](handleEntityNotFound(_0xbe69d6,null))[_0x4ca2('0x1a')](respondWithResult(_0xbe69d6,null))[_0x4ca2('0x48')](handleError(_0xbe69d6,null));};exports[_0x4ca2('0x4c')]=function(_0x347aa5,_0x523bab){return db[_0x4ca2('0x4a')][_0x4ca2('0x4c')](_0x347aa5[_0x4ca2('0x4d')],{})[_0x4ca2('0x1a')](respondWithResult(_0x523bab,0xc9))[_0x4ca2('0x48')](handleError(_0x523bab,null));};exports[_0x4ca2('0x4e')]=function(_0xcae0ae,_0x302047){if(_0xcae0ae[_0x4ca2('0x4d')]['id']){delete _0xcae0ae[_0x4ca2('0x4d')]['id'];}return db['WhatsappMessage']['find']({'where':{'id':_0xcae0ae['params']['id']}})[_0x4ca2('0x1a')](handleEntityNotFound(_0x302047,null))['then'](saveUpdates(_0xcae0ae[_0x4ca2('0x4d')],null))[_0x4ca2('0x1a')](respondWithResult(_0x302047,null))['catch'](handleError(_0x302047,null));};exports[_0x4ca2('0x2c')]=function(_0xca6c40,_0x56f088){return db['WhatsappMessage'][_0x4ca2('0x4f')]({'where':{'id':_0xca6c40[_0x4ca2('0x49')]['id']}})[_0x4ca2('0x1a')](handleEntityNotFound(_0x56f088,null))['then'](removeEntity(_0x56f088,null))['catch'](handleError(_0x56f088,null));};exports[_0x4ca2('0x50')]=function(_0x2b731c,_0x2f16dd){return db[_0x4ca2('0x4a')][_0x4ca2('0x50')]()[_0x4ca2('0x1a')](respondWithResult(_0x2f16dd,null))[_0x4ca2('0x48')](handleError(_0x2f16dd,null));};var interaction_log=require('../../config/logger')(_0x4ca2('0x51'));exports[_0x4ca2('0x52')]=function(_0x4d8d39,_0x8185b5,_0x40e1b7){var _0x223b62={'agent':{},'channel':_0x4ca2('0x53')};if(_0x4d8d39[_0x4ca2('0x4d')]['id']){delete _0x4d8d39[_0x4ca2('0x4d')]['id'];}_0x4d8d39[_0x4ca2('0x4d')]['read']=!![];_0x4d8d39['body'][_0x4ca2('0x54')]=moment()[_0x4ca2('0x55')](_0x4ca2('0x56'));_0x4d8d39[_0x4ca2('0x4d')][_0x4ca2('0x57')]=_0x4d8d39[_0x4ca2('0x4d')][_0x4ca2('0x57')]||_0x4d8d39['user']['id'];_0x223b62['agent']['id']=_0x4d8d39[_0x4ca2('0x4d')]['UserId'];return db[_0x4ca2('0x4a')]['find']({'where':{'id':_0x4d8d39[_0x4ca2('0x49')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x8185b5,null))['then'](saveUpdates(_0x4d8d39[_0x4ca2('0x4d')],null))[_0x4ca2('0x1a')](function(_0x4df6b3){if(_0x4df6b3){_0x223b62[_0x4ca2('0x21')]=_0x4df6b3[_0x4ca2('0x58')]({'plain':!![]});return db[_0x4ca2('0x59')][_0x4ca2('0x4f')]({'where':{'id':_0x4df6b3['WhatsappInteractionId']}});}return null;})[_0x4ca2('0x1a')](handleEntityNotFound(_0x8185b5,null))[_0x4ca2('0x1a')](function(_0x5af6be){if(_0x5af6be){return _0x5af6be['update']({'UserId':_0x4d8d39['body']['UserId'],'read1stAt':_['isNil'](_0x5af6be[_0x4ca2('0x5a')])?moment()[_0x4ca2('0x55')](_0x4ca2('0x56')):undefined});}return null;})[_0x4ca2('0x1a')](function(_0xe016ff){if(_0xe016ff){_0x223b62[_0x4ca2('0x5b')]=_0xe016ff[_0x4ca2('0x58')]({'plain':!![]});interaction_log[_0x4ca2('0x1b')](_0x4ca2('0x5c'),_0x4d8d39[_0x4ca2('0x5d')]['id'],_0x4d8d39['user'][_0x4ca2('0x2e')],_0x4d8d39[_0x4ca2('0x5d')][_0x4ca2('0x5e')],_0x223b62[_0x4ca2('0x5b')]['id'],_0x4d8d39[_0x4ca2('0x4d')]?JSON[_0x4ca2('0x5f')](_0x4d8d39[_0x4ca2('0x4d')]):_0x4ca2('0x60'));return respondWithRpcPromise('AcceptMessage',_0x4ca2('0x61'),_0x223b62);}return null;})[_0x4ca2('0x1a')](function(_0xd4eb07){var _0x2b88bf=_0x4ca2('0x62')+_0xd4eb07[_0x4ca2('0x21')][_0x4ca2('0x63')];return db[_0x4ca2('0x64')][_0x4ca2('0x35')](_0x2b88bf,{'type':db[_0x4ca2('0x65')][_0x4ca2('0x66')][_0x4ca2('0x67')],'raw':!![]})['then'](function(_0x16265c){return _0x16265c;});})[_0x4ca2('0x1a')](function(_0x3bf8e0){if(_0x3bf8e0){_0x223b62[_0x4ca2('0x21')]['contact']=_0x3bf8e0[0x0];if(!_0x4d8d39[_0x4ca2('0x4d')][_0x4ca2('0x57')])return;return db[_0x4ca2('0x68')][_0x4ca2('0x4f')]({'where':{'id':_0x4d8d39['body'][_0x4ca2('0x57')],'role':_0x4ca2('0x69')},'attributes':['id','name',_0x4ca2('0x6a'),_0x4ca2('0x6b'),_0x4ca2('0x6c')],'raw':!![]});}return null;})[_0x4ca2('0x1a')](function(_0x37e9af){if(!_0x37e9af)return null;_0x223b62['message']['agent']=_0x37e9af;return _0x223b62;})[_0x4ca2('0x1a')](function(_0x27c8e6){if(_0x27c8e6){if(_0x4d8d39[_0x4ca2('0x4d')][_0x4ca2('0x6d')]){_0x223b62[_0x4ca2('0x21')][_0x4ca2('0x6e')]=util[_0x4ca2('0x55')](_0x4ca2('0x6f'),_0x4d8d39[_0x4ca2('0x5d')][_0x4ca2('0x2e')]);_0x223b62[_0x4ca2('0x21')][_0x4ca2('0x70')]=_0x223b62[_0x4ca2('0x70')];_0x223b62[_0x4ca2('0x21')][_0x4ca2('0x71')]=_0x223b62[_0x4ca2('0x70')];_0x223b62[_0x4ca2('0x21')][_0x4ca2('0x72')]=_0x4ca2('0x52');return respondWithRpcPromise(_0x4ca2('0x73'),_0x4ca2('0x73'),{'event':_0x4ca2('0x74'),'message':_0x223b62['message']},client9002)[_0x4ca2('0x1a')](function(){return _0x223b62;});}return _0x223b62;}return null;})[_0x4ca2('0x1a')](respondWithResult(_0x8185b5,null))[_0x4ca2('0x48')](handleError(_0x8185b5,null));};var interaction_log=require(_0x4ca2('0x11'))(_0x4ca2('0x51'));exports['reject']=function(_0x1755f9,_0x4edfda,_0x53ffa3){var _0x3cd5eb={'agent':{},'channel':_0x4ca2('0x53')};if(_0x1755f9[_0x4ca2('0x4d')]['id']){delete _0x1755f9[_0x4ca2('0x4d')]['id'];}_0x1755f9[_0x4ca2('0x4d')]['UserId']=_0x1755f9[_0x4ca2('0x4d')][_0x4ca2('0x57')]||_0x1755f9[_0x4ca2('0x5d')]['id'];_0x3cd5eb[_0x4ca2('0x69')]['id']=_0x1755f9[_0x4ca2('0x4d')][_0x4ca2('0x57')];return db[_0x4ca2('0x4a')][_0x4ca2('0x4f')]({'where':{'id':_0x1755f9[_0x4ca2('0x49')]['id'],'UserId':null}})[_0x4ca2('0x1a')](handleEntityNotFound(_0x4edfda,null))[_0x4ca2('0x1a')](function(_0x1c684c){if(_0x1c684c){_0x3cd5eb[_0x4ca2('0x21')]=_0x1c684c['get']({'plain':!![]});return db['WhatsappInteraction'][_0x4ca2('0x4f')]({'where':{'id':_0x1c684c[_0x4ca2('0x75')]}});}return null;})[_0x4ca2('0x1a')](handleEntityNotFound(_0x4edfda,null))[_0x4ca2('0x1a')](function(_0x27d90b){if(_0x27d90b){_0x3cd5eb['interaction']=_0x27d90b[_0x4ca2('0x58')]({'plain':!![]});interaction_log[_0x4ca2('0x1b')](_0x4ca2('0x76'),_0x1755f9['user']['id'],_0x1755f9[_0x4ca2('0x5d')][_0x4ca2('0x2e')],_0x1755f9['user']['role'],_0x3cd5eb[_0x4ca2('0x5b')]['id'],_0x1755f9[_0x4ca2('0x4d')]?JSON[_0x4ca2('0x5f')](_0x1755f9[_0x4ca2('0x4d')]):_0x4ca2('0x60'));return respondWithRpcPromise(_0x4ca2('0x77'),_0x4ca2('0x78'),_0x3cd5eb);}return null;})['then'](function(_0x35495d){var _0x50bae2=_0x4ca2('0x62')+_0x35495d[_0x4ca2('0x21')]['ContactId'];return db[_0x4ca2('0x64')][_0x4ca2('0x35')](_0x50bae2,{'type':db[_0x4ca2('0x65')][_0x4ca2('0x66')]['SELECT'],'raw':!![]})[_0x4ca2('0x1a')](function(_0x819a8d){return _0x819a8d;});})['then'](function(_0x4eba8f){if(_0x4eba8f){_0x3cd5eb['message'][_0x4ca2('0x79')]=_0x4eba8f[0x0];if(!_0x1755f9[_0x4ca2('0x4d')][_0x4ca2('0x57')])return;return db['User'][_0x4ca2('0x4f')]({'where':{'id':_0x1755f9[_0x4ca2('0x4d')]['UserId'],'role':_0x4ca2('0x69')},'attributes':['id',_0x4ca2('0x2e'),_0x4ca2('0x6a'),'email',_0x4ca2('0x6c')],'raw':!![]});}return null;})[_0x4ca2('0x1a')](function(_0x2e63ef){if(!_0x2e63ef)return null;_0x3cd5eb[_0x4ca2('0x21')][_0x4ca2('0x69')]=_0x2e63ef;return _0x3cd5eb;})[_0x4ca2('0x1a')](function(_0x430ebb){if(_0x430ebb){_0x430ebb['message']['interface']=util['format']('SIP/%s',_0x1755f9[_0x4ca2('0x5d')][_0x4ca2('0x2e')]);_0x430ebb[_0x4ca2('0x21')]['channel']=_0x3cd5eb[_0x4ca2('0x70')];_0x430ebb[_0x4ca2('0x21')][_0x4ca2('0x71')]=_0x3cd5eb[_0x4ca2('0x70')];_0x430ebb[_0x4ca2('0x21')][_0x4ca2('0x72')]=_0x4ca2('0x2b');respondWithRpcPromise(_0x4ca2('0x73'),_0x4ca2('0x73'),{'event':_0x4ca2('0x7a'),'message':_0x430ebb[_0x4ca2('0x21')]},client9002);return _0x3cd5eb;}return null;})['then'](respondWithResult(_0x4edfda,null))['catch'](handleError(_0x4edfda,null));};exports['status']=function(_0x57800c,_0x324aa1,_0x447dc7){if(_0x57800c[_0x4ca2('0x4d')]['id']){delete _0x57800c[_0x4ca2('0x4d')]['id'];}var _0x7433b0;return db[_0x4ca2('0x4a')]['find']({'where':{'id':_0x57800c[_0x4ca2('0x49')]['id']}})[_0x4ca2('0x1a')](handleEntityNotFound(_0x324aa1,null))[_0x4ca2('0x1a')](function(_0x4e1ee6){if(_0x4e1ee6){_0x7433b0=_0x4e1ee6;return db[_0x4ca2('0x7b')][_0x4ca2('0x4f')]({'where':{'id':_0x4e1ee6[_0x4ca2('0x7c')]}});}})['then'](handleEntityNotFound(_0x324aa1,null))[_0x4ca2('0x1a')](function(_0x43e91c){if(_0x43e91c){logger[_0x4ca2('0x1d')](_0x4ca2('0x7d'),_0x4ca2('0x24'),_0x4ca2('0x7e'),_0x43e91c[_0x4ca2('0x32')],util['inspect'](_0x57800c[_0x4ca2('0x4d')],{'showHidden':![],'depth':null}));switch(_0x43e91c[_0x4ca2('0x32')]){case _0x4ca2('0x7f'):if(_0x57800c[_0x4ca2('0x4d')][_0x4ca2('0x80')]&&_0x57800c[_0x4ca2('0x4d')]['MessageSid']===_0x7433b0[_0x4ca2('0x81')]&&_0x57800c['body'][_0x4ca2('0x82')]&&_0x57800c[_0x4ca2('0x4d')][_0x4ca2('0x82')]==='read'){return _0x7433b0[_0x4ca2('0x4e')]({'read':!![]});}else{logger['error']('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x4ca2('0x24'),_0x4ca2('0x7f'),util['inspect'](_0x57800c[_0x4ca2('0x4d')],{'showHidden':![],'depth':null}));}break;}return _0x7433b0;}})[_0x4ca2('0x1a')](respondWithResult(_0x324aa1,null))[_0x4ca2('0x48')](handleError(_0x324aa1,null));}; \ No newline at end of file +var _0xa9a8=['filter','merge','where','VIRTUAL','options','count','then','rows','show','params','find','create','catch','body','describe','whatsapp-interactions','accept','whatsapp','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','WhatsappInteraction','WhatsappInteractionId','isNil','read1stAt','interaction','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','User','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','reject','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectMessage','fullname','rejectmessage','WhatsappAccount','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','eml-format','rimraf','request-promise','moment','util','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','client','http','request','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','status','end','json','undefined','limit','offset','update','destroy','sendStatus','stack','name','send','index','map','WhatsappMessage','rawAttributes','fieldName','type','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','order'];(function(_0x3f3eee,_0x5524d6){var _0x1c4f82=function(_0xeb651e){while(--_0xeb651e){_0x3f3eee['push'](_0x3f3eee['shift']());}};_0x1c4f82(++_0x5524d6);}(_0xa9a8,0xc5));var _0x8a9a=function(_0x24a33a,_0x4f47c3){_0x24a33a=_0x24a33a-0x0;var _0xb349fe=_0xa9a8[_0x24a33a];return _0xb349fe;};'use strict';var emlformat=require(_0x8a9a('0x0'));var rimraf=require(_0x8a9a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x8a9a('0x2'));var moment=require(_0x8a9a('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x8a9a('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0x8a9a('0x5'));var ejs=require(_0x8a9a('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8a9a('0x7'));var squel=require(_0x8a9a('0x8'));var crypto=require('crypto');var jsforce=require(_0x8a9a('0x9'));var deskjs=require(_0x8a9a('0xa'));var toCsv=require(_0x8a9a('0x5'));var querystring=require(_0x8a9a('0xb'));var Papa=require(_0x8a9a('0xc'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x8a9a('0xd'));var as=require(_0x8a9a('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8a9a('0xf'))(_0x8a9a('0x10'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x8a9a('0x11'));var db=require(_0x8a9a('0x12'))['db'];config[_0x8a9a('0x13')]=_[_0x8a9a('0x14')](config[_0x8a9a('0x13')],{'host':_0x8a9a('0x15'),'port':0x18eb});var socket=require(_0x8a9a('0x16'))(new Redis(config['redis']));require(_0x8a9a('0x17'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x8a9a('0x18')][_0x8a9a('0x19')]({'port':0x232c});var client9002=jayson[_0x8a9a('0x18')][_0x8a9a('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x58f14f,_0x1c678a,_0x4b51d2,_0x53450a){return new BPromise(function(_0xd97d9b,_0xb600d3){var _0xae9695=_0x53450a||client;return _0xae9695[_0x8a9a('0x1a')](_0x58f14f,_0x4b51d2)['then'](function(_0x1f18de){logger[_0x8a9a('0x1b')](_0x8a9a('0x1c'),_0x1c678a,_0x8a9a('0x1d'));logger[_0x8a9a('0x1e')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x1c678a,_0x8a9a('0x1d'),JSON[_0x8a9a('0x1f')](_0x1f18de));if(_0x1f18de[_0x8a9a('0x20')]){if(_0x1f18de['error']['code']===0x1f4){logger[_0x8a9a('0x20')](_0x8a9a('0x1c'),_0x1c678a,_0x1f18de[_0x8a9a('0x20')][_0x8a9a('0x21')]);return _0xb600d3(_0x1f18de[_0x8a9a('0x20')][_0x8a9a('0x21')]);}logger[_0x8a9a('0x20')](_0x8a9a('0x1c'),_0x1c678a,_0x1f18de[_0x8a9a('0x20')]['message']);return _0xd97d9b(_0x1f18de[_0x8a9a('0x20')][_0x8a9a('0x21')]);}else{logger[_0x8a9a('0x1b')](_0x8a9a('0x1c'),_0x1c678a,_0x8a9a('0x1d'));_0xd97d9b(_0x1f18de[_0x8a9a('0x22')][_0x8a9a('0x21')]);}})['catch'](function(_0x5c507a){logger[_0x8a9a('0x20')]('WhatsappMessage,\x20%s,\x20%s',_0x1c678a,_0x5c507a);_0xb600d3(_0x5c507a);});});}function respondWithStatusCode(_0x14269f,_0x9d9a3c){_0x9d9a3c=_0x9d9a3c||0xcc;return function(_0xb8bee2){if(_0xb8bee2){return _0x14269f['sendStatus'](_0x9d9a3c);}return _0x14269f[_0x8a9a('0x23')](_0x9d9a3c)[_0x8a9a('0x24')]();};}function respondWithResult(_0xdd0595,_0x1e4133){_0x1e4133=_0x1e4133||0xc8;return function(_0x25e305){if(_0x25e305){return _0xdd0595[_0x8a9a('0x23')](_0x1e4133)[_0x8a9a('0x25')](_0x25e305);}};}function respondWithFilteredResult(_0x319834,_0x1cdf6c){return function(_0x398ea1){if(_0x398ea1){var _0x1c643e=typeof _0x1cdf6c['offset']===_0x8a9a('0x26')&&typeof _0x1cdf6c[_0x8a9a('0x27')]===_0x8a9a('0x26');var _0x104c95=_0x398ea1['count'];var _0x519788=_0x1c643e?0x0:_0x1cdf6c[_0x8a9a('0x28')];var _0x3b150d=_0x1c643e?_0x398ea1['count']:_0x1cdf6c[_0x8a9a('0x28')]+_0x1cdf6c[_0x8a9a('0x27')];var _0xb6f89c;if(_0x3b150d>=_0x104c95){_0x3b150d=_0x104c95;_0xb6f89c=0xc8;}else{_0xb6f89c=0xce;}_0x319834[_0x8a9a('0x23')](_0xb6f89c);return _0x319834['set']('Content-Range',_0x519788+'-'+_0x3b150d+'/'+_0x104c95)[_0x8a9a('0x25')](_0x398ea1);}return null;};}function patchUpdates(_0x5e0aff){return function(_0x316c5b){try{jsonpatch['apply'](_0x316c5b,_0x5e0aff,!![]);}catch(_0x1a322b){return BPromise['reject'](_0x1a322b);}return _0x316c5b['save']();};}function saveUpdates(_0x456ba9,_0x24fc3e){return function(_0x51b928){if(_0x51b928){return _0x51b928[_0x8a9a('0x29')](_0x456ba9)['then'](function(_0x1b717a){return _0x1b717a;});}return null;};}function removeEntity(_0x3a31d8,_0x49b007){return function(_0x21aef8){if(_0x21aef8){return _0x21aef8[_0x8a9a('0x2a')]()['then'](function(){_0x3a31d8['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5c4492,_0x4bb09f){return function(_0x4b71a4){if(!_0x4b71a4){_0x5c4492[_0x8a9a('0x2b')](0x194);}return _0x4b71a4;};}function handleError(_0x4289b8,_0x1b3ac8){_0x1b3ac8=_0x1b3ac8||0x1f4;return function(_0x5d7ddb){logger[_0x8a9a('0x20')](_0x5d7ddb[_0x8a9a('0x2c')]);if(_0x5d7ddb['name']){delete _0x5d7ddb[_0x8a9a('0x2d')];}_0x4289b8[_0x8a9a('0x23')](_0x1b3ac8)[_0x8a9a('0x2e')](_0x5d7ddb);};}exports[_0x8a9a('0x2f')]=function(_0x9031f7,_0x4e4f46){var _0x37727d={},_0x71bb72={},_0x1846ac={'count':0x0,'rows':[]};var _0xf79891=_[_0x8a9a('0x30')](db[_0x8a9a('0x31')][_0x8a9a('0x32')],function(_0x574c1e){return{'name':_0x574c1e[_0x8a9a('0x33')],'type':_0x574c1e[_0x8a9a('0x34')]['key']};});_0x71bb72['model']=_[_0x8a9a('0x30')](_0xf79891,_0x8a9a('0x2d'));_0x71bb72[_0x8a9a('0x35')]=_[_0x8a9a('0x36')](_0x9031f7[_0x8a9a('0x35')]);_0x71bb72[_0x8a9a('0x37')]=_[_0x8a9a('0x38')](_0x71bb72[_0x8a9a('0x39')],_0x71bb72[_0x8a9a('0x35')]);_0x37727d['attributes']=_[_0x8a9a('0x38')](_0x71bb72['model'],qs['fields'](_0x9031f7[_0x8a9a('0x35')][_0x8a9a('0x3a')]));_0x37727d[_0x8a9a('0x3b')]=_0x37727d[_0x8a9a('0x3b')][_0x8a9a('0x3c')]?_0x37727d[_0x8a9a('0x3b')]:_0x71bb72[_0x8a9a('0x39')];if(!_0x9031f7[_0x8a9a('0x35')][_0x8a9a('0x3d')]('nolimit')){_0x37727d['limit']=qs[_0x8a9a('0x27')](_0x9031f7[_0x8a9a('0x35')][_0x8a9a('0x27')]);_0x37727d['offset']=qs[_0x8a9a('0x28')](_0x9031f7['query'][_0x8a9a('0x28')]);}_0x37727d[_0x8a9a('0x3e')]=qs['sort'](_0x9031f7['query']['sort']);_0x37727d['where']=qs['filters'](_['pick'](_0x9031f7[_0x8a9a('0x35')],_0x71bb72[_0x8a9a('0x37')]),_0xf79891);if(_0x9031f7['query'][_0x8a9a('0x3f')]){_0x37727d['where']=_[_0x8a9a('0x40')](_0x37727d[_0x8a9a('0x41')],{'$or':_[_0x8a9a('0x30')](_0xf79891,function(_0x4f9901){if(_0x4f9901['type']!==_0x8a9a('0x42')){var _0x2ef296={};_0x2ef296[_0x4f9901['name']]={'$like':'%'+_0x9031f7[_0x8a9a('0x35')]['filter']+'%'};return _0x2ef296;}})});}_0x37727d=_[_0x8a9a('0x40')]({},_0x37727d,_0x9031f7[_0x8a9a('0x43')]);var _0x1ffbaa={'where':_0x37727d[_0x8a9a('0x41')]};return db[_0x8a9a('0x31')][_0x8a9a('0x44')](_0x1ffbaa)[_0x8a9a('0x45')](function(_0x568b55){_0x1846ac[_0x8a9a('0x44')]=_0x568b55;if(_0x9031f7[_0x8a9a('0x35')]['includeAll']){_0x37727d['include']=[{'all':!![]}];}return db[_0x8a9a('0x31')]['findAll'](_0x37727d);})[_0x8a9a('0x45')](function(_0x1bb4b0){_0x1846ac[_0x8a9a('0x46')]=_0x1bb4b0;return _0x1846ac;})[_0x8a9a('0x45')](respondWithFilteredResult(_0x4e4f46,_0x37727d))['catch'](handleError(_0x4e4f46,null));};exports[_0x8a9a('0x47')]=function(_0x50c745,_0x381edf){var _0xdf07={'raw':!![],'where':{'id':_0x50c745[_0x8a9a('0x48')]['id']}},_0x326ac4={};_0x326ac4[_0x8a9a('0x39')]=_[_0x8a9a('0x36')](db[_0x8a9a('0x31')][_0x8a9a('0x32')]);_0x326ac4[_0x8a9a('0x35')]=_[_0x8a9a('0x36')](_0x50c745[_0x8a9a('0x35')]);_0x326ac4[_0x8a9a('0x37')]=_[_0x8a9a('0x38')](_0x326ac4['model'],_0x326ac4[_0x8a9a('0x35')]);_0xdf07[_0x8a9a('0x3b')]=_[_0x8a9a('0x38')](_0x326ac4['model'],qs[_0x8a9a('0x3a')](_0x50c745[_0x8a9a('0x35')]['fields']));_0xdf07[_0x8a9a('0x3b')]=_0xdf07['attributes'][_0x8a9a('0x3c')]?_0xdf07[_0x8a9a('0x3b')]:_0x326ac4['model'];if(_0x50c745[_0x8a9a('0x35')]['includeAll']){_0xdf07['include']=[{'all':!![]}];}_0xdf07=_[_0x8a9a('0x40')]({},_0xdf07,_0x50c745['options']);return db[_0x8a9a('0x31')][_0x8a9a('0x49')](_0xdf07)[_0x8a9a('0x45')](handleEntityNotFound(_0x381edf,null))['then'](respondWithResult(_0x381edf,null))['catch'](handleError(_0x381edf,null));};exports['create']=function(_0xfcc781,_0x5744db){return db[_0x8a9a('0x31')][_0x8a9a('0x4a')](_0xfcc781['body'],{})[_0x8a9a('0x45')](respondWithResult(_0x5744db,0xc9))[_0x8a9a('0x4b')](handleError(_0x5744db,null));};exports[_0x8a9a('0x29')]=function(_0x3bb495,_0x1d404f){if(_0x3bb495[_0x8a9a('0x4c')]['id']){delete _0x3bb495[_0x8a9a('0x4c')]['id'];}return db[_0x8a9a('0x31')]['find']({'where':{'id':_0x3bb495[_0x8a9a('0x48')]['id']}})[_0x8a9a('0x45')](handleEntityNotFound(_0x1d404f,null))['then'](saveUpdates(_0x3bb495[_0x8a9a('0x4c')],null))[_0x8a9a('0x45')](respondWithResult(_0x1d404f,null))[_0x8a9a('0x4b')](handleError(_0x1d404f,null));};exports['destroy']=function(_0x194006,_0x3be5bf){return db['WhatsappMessage'][_0x8a9a('0x49')]({'where':{'id':_0x194006[_0x8a9a('0x48')]['id']}})['then'](handleEntityNotFound(_0x3be5bf,null))[_0x8a9a('0x45')](removeEntity(_0x3be5bf,null))[_0x8a9a('0x4b')](handleError(_0x3be5bf,null));};exports['describe']=function(_0x64528,_0x3dae4c){return db['WhatsappMessage'][_0x8a9a('0x4d')]()[_0x8a9a('0x45')](respondWithResult(_0x3dae4c,null))[_0x8a9a('0x4b')](handleError(_0x3dae4c,null));};var interaction_log=require(_0x8a9a('0xf'))(_0x8a9a('0x4e'));exports[_0x8a9a('0x4f')]=function(_0x5305a3,_0x3f72d0,_0x3ba3e4){var _0x23d8d0={'agent':{},'channel':_0x8a9a('0x50')};if(_0x5305a3[_0x8a9a('0x4c')]['id']){delete _0x5305a3[_0x8a9a('0x4c')]['id'];}_0x5305a3[_0x8a9a('0x4c')][_0x8a9a('0x51')]=!![];_0x5305a3[_0x8a9a('0x4c')][_0x8a9a('0x52')]=moment()[_0x8a9a('0x53')](_0x8a9a('0x54'));_0x5305a3[_0x8a9a('0x4c')][_0x8a9a('0x55')]=_0x5305a3[_0x8a9a('0x4c')][_0x8a9a('0x55')]||_0x5305a3[_0x8a9a('0x56')]['id'];_0x23d8d0[_0x8a9a('0x57')]['id']=_0x5305a3[_0x8a9a('0x4c')][_0x8a9a('0x55')];return db[_0x8a9a('0x31')][_0x8a9a('0x49')]({'where':{'id':_0x5305a3[_0x8a9a('0x48')]['id'],'UserId':null}})[_0x8a9a('0x45')](handleEntityNotFound(_0x3f72d0,null))[_0x8a9a('0x45')](saveUpdates(_0x5305a3['body'],null))['then'](function(_0x3cbd97){if(_0x3cbd97){_0x23d8d0[_0x8a9a('0x21')]=_0x3cbd97[_0x8a9a('0x58')]({'plain':!![]});return db[_0x8a9a('0x59')][_0x8a9a('0x49')]({'where':{'id':_0x3cbd97[_0x8a9a('0x5a')]}});}return null;})[_0x8a9a('0x45')](handleEntityNotFound(_0x3f72d0,null))[_0x8a9a('0x45')](function(_0x26e9a2){if(_0x26e9a2){return _0x26e9a2[_0x8a9a('0x29')]({'UserId':_0x5305a3['body'][_0x8a9a('0x55')],'read1stAt':_[_0x8a9a('0x5b')](_0x26e9a2[_0x8a9a('0x5c')])?moment()[_0x8a9a('0x53')](_0x8a9a('0x54')):undefined});}return null;})[_0x8a9a('0x45')](function(_0x5ca2fa){if(_0x5ca2fa){_0x23d8d0[_0x8a9a('0x5d')]=_0x5ca2fa[_0x8a9a('0x58')]({'plain':!![]});interaction_log[_0x8a9a('0x1b')](_0x8a9a('0x5e'),_0x5305a3[_0x8a9a('0x56')]['id'],_0x5305a3['user']['name'],_0x5305a3[_0x8a9a('0x56')]['role'],_0x23d8d0[_0x8a9a('0x5d')]['id'],_0x5305a3[_0x8a9a('0x4c')]?JSON[_0x8a9a('0x1f')](_0x5305a3[_0x8a9a('0x4c')]):_0x8a9a('0x5f'));return respondWithRpcPromise(_0x8a9a('0x60'),'acceptMessage',_0x23d8d0);}return null;})[_0x8a9a('0x45')](function(_0x217151){var _0x177e44=_0x8a9a('0x61')+_0x217151[_0x8a9a('0x21')][_0x8a9a('0x62')];return db[_0x8a9a('0x63')][_0x8a9a('0x35')](_0x177e44,{'type':db[_0x8a9a('0x64')][_0x8a9a('0x65')][_0x8a9a('0x66')],'raw':!![]})[_0x8a9a('0x45')](function(_0xf8ebcc){return _0xf8ebcc;});})[_0x8a9a('0x45')](function(_0x32bbd7){if(_0x32bbd7){_0x23d8d0[_0x8a9a('0x21')]['contact']=_0x32bbd7[0x0];if(!_0x5305a3[_0x8a9a('0x4c')][_0x8a9a('0x55')])return;return db[_0x8a9a('0x67')]['find']({'where':{'id':_0x5305a3[_0x8a9a('0x4c')][_0x8a9a('0x55')],'role':_0x8a9a('0x57')},'attributes':['id',_0x8a9a('0x2d'),'fullname',_0x8a9a('0x68'),_0x8a9a('0x69')],'raw':!![]});}return null;})[_0x8a9a('0x45')](function(_0x5548be){if(!_0x5548be)return null;_0x23d8d0[_0x8a9a('0x21')][_0x8a9a('0x57')]=_0x5548be;return _0x23d8d0;})[_0x8a9a('0x45')](function(_0x4dd07c){if(_0x4dd07c){if(_0x5305a3[_0x8a9a('0x4c')][_0x8a9a('0x6a')]){_0x23d8d0[_0x8a9a('0x21')][_0x8a9a('0x6b')]=util[_0x8a9a('0x53')](_0x8a9a('0x6c'),_0x5305a3[_0x8a9a('0x56')][_0x8a9a('0x2d')]);_0x23d8d0[_0x8a9a('0x21')][_0x8a9a('0x6d')]=_0x23d8d0[_0x8a9a('0x6d')];_0x23d8d0[_0x8a9a('0x21')][_0x8a9a('0x6e')]=_0x23d8d0[_0x8a9a('0x6d')];_0x23d8d0[_0x8a9a('0x21')][_0x8a9a('0x6f')]=_0x8a9a('0x4f');return respondWithRpcPromise(_0x8a9a('0x70'),_0x8a9a('0x70'),{'event':_0x8a9a('0x71'),'message':_0x23d8d0['message']},client9002)[_0x8a9a('0x45')](function(){return _0x23d8d0;});}return _0x23d8d0;}return null;})[_0x8a9a('0x45')](respondWithResult(_0x3f72d0,null))[_0x8a9a('0x4b')](handleError(_0x3f72d0,null));};var interaction_log=require(_0x8a9a('0xf'))(_0x8a9a('0x4e'));exports[_0x8a9a('0x72')]=function(_0x52de5b,_0x355f01,_0x553764){var _0x1f2cce={'agent':{},'channel':_0x8a9a('0x50')};if(_0x52de5b[_0x8a9a('0x4c')]['id']){delete _0x52de5b[_0x8a9a('0x4c')]['id'];}_0x52de5b['body'][_0x8a9a('0x55')]=_0x52de5b[_0x8a9a('0x4c')][_0x8a9a('0x55')]||_0x52de5b[_0x8a9a('0x56')]['id'];_0x1f2cce[_0x8a9a('0x57')]['id']=_0x52de5b[_0x8a9a('0x4c')][_0x8a9a('0x55')];return db[_0x8a9a('0x31')][_0x8a9a('0x49')]({'where':{'id':_0x52de5b[_0x8a9a('0x48')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x355f01,null))[_0x8a9a('0x45')](function(_0xa331ed){if(_0xa331ed){_0x1f2cce[_0x8a9a('0x21')]=_0xa331ed[_0x8a9a('0x58')]({'plain':!![]});return db[_0x8a9a('0x59')][_0x8a9a('0x49')]({'where':{'id':_0xa331ed[_0x8a9a('0x5a')]}});}return null;})['then'](handleEntityNotFound(_0x355f01,null))['then'](function(_0x3eac66){if(_0x3eac66){_0x1f2cce[_0x8a9a('0x5d')]=_0x3eac66[_0x8a9a('0x58')]({'plain':!![]});interaction_log[_0x8a9a('0x1b')](_0x8a9a('0x73'),_0x52de5b[_0x8a9a('0x56')]['id'],_0x52de5b['user'][_0x8a9a('0x2d')],_0x52de5b[_0x8a9a('0x56')][_0x8a9a('0x74')],_0x1f2cce['interaction']['id'],_0x52de5b['body']?JSON[_0x8a9a('0x1f')](_0x52de5b[_0x8a9a('0x4c')]):_0x8a9a('0x5f'));return respondWithRpcPromise(_0x8a9a('0x75'),_0x8a9a('0x76'),_0x1f2cce);}return null;})['then'](function(_0x31d57b){var _0x55dc0c=_0x8a9a('0x61')+_0x31d57b['message'][_0x8a9a('0x62')];return db[_0x8a9a('0x63')][_0x8a9a('0x35')](_0x55dc0c,{'type':db[_0x8a9a('0x64')]['QueryTypes']['SELECT'],'raw':!![]})['then'](function(_0x57a607){return _0x57a607;});})[_0x8a9a('0x45')](function(_0x261069){if(_0x261069){_0x1f2cce['message']['contact']=_0x261069[0x0];if(!_0x52de5b[_0x8a9a('0x4c')]['UserId'])return;return db[_0x8a9a('0x67')][_0x8a9a('0x49')]({'where':{'id':_0x52de5b[_0x8a9a('0x4c')][_0x8a9a('0x55')],'role':_0x8a9a('0x57')},'attributes':['id',_0x8a9a('0x2d'),_0x8a9a('0x77'),'email',_0x8a9a('0x69')],'raw':!![]});}return null;})[_0x8a9a('0x45')](function(_0x45e69a){if(!_0x45e69a)return null;_0x1f2cce[_0x8a9a('0x21')]['agent']=_0x45e69a;return _0x1f2cce;})[_0x8a9a('0x45')](function(_0xdef979){if(_0xdef979){_0xdef979[_0x8a9a('0x21')][_0x8a9a('0x6b')]=util[_0x8a9a('0x53')](_0x8a9a('0x6c'),_0x52de5b[_0x8a9a('0x56')][_0x8a9a('0x2d')]);_0xdef979[_0x8a9a('0x21')][_0x8a9a('0x6d')]=_0x1f2cce[_0x8a9a('0x6d')];_0xdef979[_0x8a9a('0x21')][_0x8a9a('0x6e')]=_0x1f2cce['channel'];_0xdef979[_0x8a9a('0x21')][_0x8a9a('0x6f')]=_0x8a9a('0x72');respondWithRpcPromise(_0x8a9a('0x70'),_0x8a9a('0x70'),{'event':_0x8a9a('0x78'),'message':_0xdef979[_0x8a9a('0x21')]},client9002);return _0x1f2cce;}return null;})['then'](respondWithResult(_0x355f01,null))[_0x8a9a('0x4b')](handleError(_0x355f01,null));};exports[_0x8a9a('0x23')]=function(_0x2b47de,_0x2f4715,_0x4f8609){if(_0x2b47de['body']['id']){delete _0x2b47de[_0x8a9a('0x4c')]['id'];}var _0x1b9013;return db['WhatsappMessage'][_0x8a9a('0x49')]({'where':{'id':_0x2b47de[_0x8a9a('0x48')]['id']}})[_0x8a9a('0x45')](handleEntityNotFound(_0x2f4715,null))[_0x8a9a('0x45')](function(_0x482918){if(_0x482918){_0x1b9013=_0x482918;return db[_0x8a9a('0x79')][_0x8a9a('0x49')]({'where':{'id':_0x482918[_0x8a9a('0x7a')]}});}})['then'](handleEntityNotFound(_0x2f4715,null))[_0x8a9a('0x45')](function(_0x5e9994){if(_0x5e9994){logger[_0x8a9a('0x1e')](_0x8a9a('0x7b'),_0x8a9a('0x23'),_0x8a9a('0x7c'),_0x5e9994[_0x8a9a('0x34')],util[_0x8a9a('0x7d')](_0x2b47de[_0x8a9a('0x4c')],{'showHidden':![],'depth':null}));switch(_0x5e9994[_0x8a9a('0x34')]){case'twilio':if(_0x2b47de[_0x8a9a('0x4c')]['MessageSid']&&_0x2b47de[_0x8a9a('0x4c')][_0x8a9a('0x7e')]===_0x1b9013[_0x8a9a('0x7f')]&&_0x2b47de[_0x8a9a('0x4c')]['MessageStatus']&&_0x2b47de['body'][_0x8a9a('0x80')]===_0x8a9a('0x51')){return _0x1b9013[_0x8a9a('0x29')]({'read':!![]});}else{logger[_0x8a9a('0x20')](_0x8a9a('0x81'),_0x8a9a('0x23'),'twilio',util[_0x8a9a('0x7d')](_0x2b47de['body'],{'showHidden':![],'depth':null}));}break;}return _0x1b9013;}})[_0x8a9a('0x45')](respondWithResult(_0x2f4715,null))['catch'](handleError(_0x2f4715,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index b3452bf..9f2cf88 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 _0x16d2=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappMessage','setMaxListeners','save','update'];(function(_0x256422,_0x367394){var _0x55dddc=function(_0x1594bc){while(--_0x1594bc){_0x256422['push'](_0x256422['shift']());}};_0x55dddc(++_0x367394);}(_0x16d2,0x123));var _0x216d=function(_0x4eff81,_0x4533b6){_0x4eff81=_0x4eff81-0x0;var _0x39b405=_0x16d2[_0x4eff81];return _0x39b405;};'use strict';var EventEmitter=require(_0x216d('0x0'));var WhatsappMessage=require(_0x216d('0x1'))['db'][_0x216d('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x216d('0x3')](0x0);var events={'afterCreate':_0x216d('0x4'),'afterUpdate':_0x216d('0x5'),'afterDestroy':_0x216d('0x6')};function emitEvent(_0x239b49){return function(_0xfd7306,_0x593bb0,_0x2c662d){WhatsappMessageEvents[_0x216d('0x7')](_0x239b49+':'+_0xfd7306['id'],_0xfd7306);WhatsappMessageEvents[_0x216d('0x7')](_0x239b49,_0xfd7306);_0x2c662d(null);};}for(var e in events){if(events[_0x216d('0x8')](e)){var event=events[e];WhatsappMessage[_0x216d('0x9')](e,emitEvent(event));}}module[_0x216d('0xa')]=WhatsappMessageEvents; \ No newline at end of file +var _0x9b87=['../../mysqldb','WhatsappMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x528ebc,_0x289535){var _0x479bed=function(_0x32d319){while(--_0x32d319){_0x528ebc['push'](_0x528ebc['shift']());}};_0x479bed(++_0x289535);}(_0x9b87,0x8e));var _0x79b8=function(_0x235d12,_0x4b7919){_0x235d12=_0x235d12-0x0;var _0x3a83af=_0x9b87[_0x235d12];return _0x3a83af;};'use strict';var EventEmitter=require(_0x79b8('0x0'));var WhatsappMessage=require(_0x79b8('0x1'))['db'][_0x79b8('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x79b8('0x3')](0x0);var events={'afterCreate':_0x79b8('0x4'),'afterUpdate':_0x79b8('0x5'),'afterDestroy':_0x79b8('0x6')};function emitEvent(_0xb4e3e7){return function(_0xbc1e74,_0xa65bbc,_0x1f9679){WhatsappMessageEvents[_0x79b8('0x7')](_0xb4e3e7+':'+_0xbc1e74['id'],_0xbc1e74);WhatsappMessageEvents[_0x79b8('0x7')](_0xb4e3e7,_0xbc1e74);_0x1f9679(null);};}for(var e in events){if(events[_0x79b8('0x8')](e)){var event=events[e];WhatsappMessage[_0x79b8('0x9')](e,emitEvent(event));}}module[_0x79b8('0xa')]=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index 862afb3..318121a 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 _0xae7a=['messageId','fti_whatsapp_messages','FULLTEXT','models','toLowerCase','direction','out','secret','isNil','UserId','WhatsappInteraction','WhatsappInteractionId','then','update','createdAt','find','WhatsappAccountId','type','twilio','accountSid','authToken','messages','create','body','phone','whatsapp:','remote','/api/whatsapp/messages/','token','sid','error','afterCreate','inspect','WhatsappMessage,\x20%s,\x20%s,\x20%s','sinch','baseUrl','/whatsapp/v1/','/messages/','text','POST','Bearer\x20','application/json','message_id','statuses','catch','err','WhatsappMessage,\x20%s','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','bluebird','request-promise','path','../../config/environment','./whatsappMessage.attributes','exports','define','WhatsappMessage','whatsapp_messages'];(function(_0x8437a6,_0x3b674a){var _0x5e762f=function(_0x460fc2){while(--_0x460fc2){_0x8437a6['push'](_0x8437a6['shift']());}};_0x5e762f(++_0x3b674a);}(_0xae7a,0x1a0));var _0xaae7=function(_0x3af54c,_0x436158){_0x3af54c=_0x3af54c-0x0;var _0x4bc816=_0xae7a[_0x3af54c];return _0x4bc816;};'use strict';var _=require(_0xaae7('0x0'));var util=require(_0xaae7('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xaae7('0x2'));var rp=require(_0xaae7('0x3'));var fetch=require('node-fetch');var fs=require('fs');var path=require(_0xaae7('0x4'));var rimraf=require('rimraf');var config=require(_0xaae7('0x5'));var attributes=require(_0xaae7('0x6'));module[_0xaae7('0x7')]=function(_0x2d1a69,_0xb4599d){return _0x2d1a69[_0xaae7('0x8')](_0xaae7('0x9'),attributes,{'tableName':_0xaae7('0xa'),'paranoid':![],'indexes':[{'name':_0xaae7('0xb'),'fields':[_0xaae7('0xb')]},{'name':_0xaae7('0xc'),'fields':['body'],'type':_0xaae7('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0xddbfad,_0x692a41,_0x380470){var _0x5a86f6=_0x2d1a69[_0xaae7('0xe')];var _0x5a8cad=_0xddbfad['get']({'plain':!![]});if(_0x5a8cad['direction'][_0xaae7('0xf')]()==='in'||_0x5a8cad[_0xaae7('0x10')]['toLowerCase']()===_0xaae7('0x11')&&!_0x5a8cad[_0xaae7('0x12')]&&!_[_0xaae7('0x13')](_0x5a8cad[_0xaae7('0x14')])){_0x5a86f6[_0xaae7('0x15')]['findOne']({'where':{'id':_0x5a8cad[_0xaae7('0x16')]}})[_0xaae7('0x17')](function(_0x437e0c){if(_0x437e0c){_0x437e0c[_0xaae7('0x18')]({'lastMsgAt':_0x5a8cad[_0xaae7('0x19')],'lastMsgDirection':_0x5a8cad[_0xaae7('0x10')][_0xaae7('0xf')]()});}})['catch'](function(_0x4b2281){console['error'](_0x4b2281);});}if(_0x5a8cad['direction']===_0xaae7('0x11')&&!_0x5a8cad['secret']){var _0x4df7ce;_0x5a86f6['WhatsappAccount'][_0xaae7('0x1a')]({'where':{'id':_0x5a8cad[_0xaae7('0x1b')]},'raw':!![]})['then'](function(_0x2962f1){_0x4df7ce=_0x2962f1;if(_0x4df7ce&&_0x4df7ce[_0xaae7('0x1c')]){switch(_0x4df7ce[_0xaae7('0x1c')]){case _0xaae7('0x1d'):var _0x33ba8d=require(_0xaae7('0x1d'));if(_0x4df7ce[_0xaae7('0x1e')]&&_0x4df7ce['authToken']&&_0x4df7ce['phone']){var _0x32c1db=new _0x33ba8d(_0x4df7ce[_0xaae7('0x1e')],_0x4df7ce[_0xaae7('0x1f')]);_0x32c1db[_0xaae7('0x20')][_0xaae7('0x21')]({'body':_0x5a8cad[_0xaae7('0x22')],'to':'whatsapp:'+_0x5a8cad[_0xaae7('0x23')],'from':_0xaae7('0x24')+_0x4df7ce['phone'],'statusCallback':_0x4df7ce[_0xaae7('0x25')]+_0xaae7('0x26')+_0x5a8cad['id']+'/status?token='+_0x4df7ce[_0xaae7('0x27')]})[_0xaae7('0x17')](function(_0x1bca88){if(_0x1bca88[_0xaae7('0x28')]){return _0xddbfad[_0xaae7('0x18')]({'messageId':_0x1bca88[_0xaae7('0x28')]});}})['catch'](function(_0x2a7971){logger[_0xaae7('0x29')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0xaae7('0x2a'),_0xaae7('0x1d'),util[_0xaae7('0x2b')](_0x2a7971,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xaae7('0x2c'),_0xaae7('0x2a'),_0xaae7('0x1d'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0xaae7('0x2d'):var _0x400e82=_0x4df7ce[_0xaae7('0x1e')];var _0x28b370=_0x4df7ce['authToken'];var _0x1e2c64=_0x4df7ce[_0xaae7('0x2e')]+_0xaae7('0x2f')+_0x400e82+_0xaae7('0x30');var _0x12500d={'to':[_0x5a8cad[_0xaae7('0x23')]],'message':{'type':_0xaae7('0x31'),'text':_0x5a8cad['body']}};var _0x5c563e={'method':_0xaae7('0x32'),'uri':_0x1e2c64,'headers':{'Authorization':_0xaae7('0x33')+_0x28b370,'Content-Type':_0xaae7('0x34')},'body':_0x12500d,'json':!![]};rp(_0x5c563e)['then'](function(_0x2368c4){if(_0x2368c4['statuses'][0x0][_0xaae7('0x35')]){return _0xddbfad['update']({'messageId':_0x2368c4[_0xaae7('0x36')][0x0][_0xaae7('0x35')]});}})[_0xaae7('0x37')](function(_0x10f397){logger[_0xaae7('0x38')](_0xaae7('0x39'),_0x10f397);});break;}}})[_0xaae7('0x3a')](function(){_0x380470();});}else{_0x380470();}}},'charset':_0xaae7('0x3b'),'collate':_0xaae7('0x3c')});}; \ No newline at end of file +var _0xfae6=['application/json','statuses','message_id','err','WhatsappMessage,\x20%s','utf8mb4_unicode_ci','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','body','models','toLowerCase','out','secret','isNil','UserId','WhatsappInteraction','findOne','then','update','createdAt','catch','error','direction','find','WhatsappAccountId','type','twilio','authToken','messages','create','whatsapp:','phone','/api/whatsapp/messages/','token','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','sinch','accountSid','baseUrl','/whatsapp/v1/','text','POST'];(function(_0x45eba5,_0x8b25c0){var _0x592639=function(_0x506aba){while(--_0x506aba){_0x45eba5['push'](_0x45eba5['shift']());}};_0x592639(++_0x8b25c0);}(_0xfae6,0x150));var _0x6fae=function(_0x589eef,_0x4d4b1c){_0x589eef=_0x589eef-0x0;var _0x1d9965=_0xfae6[_0x589eef];return _0x1d9965;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x6fae('0x0'))('api');var moment=require(_0x6fae('0x1'));var BPromise=require(_0x6fae('0x2'));var rp=require(_0x6fae('0x3'));var fetch=require('node-fetch');var fs=require('fs');var path=require(_0x6fae('0x4'));var rimraf=require(_0x6fae('0x5'));var config=require(_0x6fae('0x6'));var attributes=require('./whatsappMessage.attributes');module[_0x6fae('0x7')]=function(_0x56f017,_0x17ab32){return _0x56f017[_0x6fae('0x8')](_0x6fae('0x9'),attributes,{'tableName':_0x6fae('0xa'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0x6fae('0xb')]},{'name':_0x6fae('0xc'),'fields':[_0x6fae('0xd')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x195590,_0x353f3b,_0x29ee67){var _0x2f5eaf=_0x56f017[_0x6fae('0xe')];var _0x1078b9=_0x195590['get']({'plain':!![]});if(_0x1078b9['direction'][_0x6fae('0xf')]()==='in'||_0x1078b9['direction'][_0x6fae('0xf')]()===_0x6fae('0x10')&&!_0x1078b9[_0x6fae('0x11')]&&!_[_0x6fae('0x12')](_0x1078b9[_0x6fae('0x13')])){_0x2f5eaf[_0x6fae('0x14')][_0x6fae('0x15')]({'where':{'id':_0x1078b9['WhatsappInteractionId']}})[_0x6fae('0x16')](function(_0x12d84f){if(_0x12d84f){_0x12d84f[_0x6fae('0x17')]({'lastMsgAt':_0x1078b9[_0x6fae('0x18')],'lastMsgDirection':_0x1078b9['direction'][_0x6fae('0xf')]()});}})[_0x6fae('0x19')](function(_0x2afd30){console[_0x6fae('0x1a')](_0x2afd30);});}if(_0x1078b9[_0x6fae('0x1b')]===_0x6fae('0x10')&&!_0x1078b9[_0x6fae('0x11')]){var _0x530e2;_0x2f5eaf['WhatsappAccount'][_0x6fae('0x1c')]({'where':{'id':_0x1078b9[_0x6fae('0x1d')]},'raw':!![]})[_0x6fae('0x16')](function(_0xf75a84){_0x530e2=_0xf75a84;if(_0x530e2&&_0x530e2['type']){switch(_0x530e2[_0x6fae('0x1e')]){case _0x6fae('0x1f'):var _0x4cf5c8=require(_0x6fae('0x1f'));if(_0x530e2['accountSid']&&_0x530e2[_0x6fae('0x20')]&&_0x530e2['phone']){var _0x4eb94b=new _0x4cf5c8(_0x530e2['accountSid'],_0x530e2[_0x6fae('0x20')]);_0x4eb94b[_0x6fae('0x21')][_0x6fae('0x22')]({'body':_0x1078b9[_0x6fae('0xd')],'to':_0x6fae('0x23')+_0x1078b9[_0x6fae('0x24')],'from':_0x6fae('0x23')+_0x530e2['phone'],'statusCallback':_0x530e2['remote']+_0x6fae('0x25')+_0x1078b9['id']+'/status?token='+_0x530e2[_0x6fae('0x26')]})[_0x6fae('0x16')](function(_0x26ac8e){if(_0x26ac8e[_0x6fae('0x27')]){return _0x195590[_0x6fae('0x17')]({'messageId':_0x26ac8e[_0x6fae('0x27')]});}})[_0x6fae('0x19')](function(_0x520dd2){logger[_0x6fae('0x1a')](_0x6fae('0x28'),_0x6fae('0x29'),_0x6fae('0x1f'),util['inspect'](_0x520dd2,{'showHidden':![],'depth':null}));});}else{logger[_0x6fae('0x1a')](_0x6fae('0x28'),_0x6fae('0x29'),_0x6fae('0x1f'),_0x6fae('0x2a'));}break;case _0x6fae('0x2b'):var _0x12ae52=_0x530e2[_0x6fae('0x2c')];var _0x5a5388=_0x530e2['authToken'];var _0x4aa2cf=_0x530e2[_0x6fae('0x2d')]+_0x6fae('0x2e')+_0x12ae52+'/messages/';var _0x387aaf={'to':[_0x1078b9[_0x6fae('0x24')]],'message':{'type':_0x6fae('0x2f'),'text':_0x1078b9[_0x6fae('0xd')]}};var _0x4966b0={'method':_0x6fae('0x30'),'uri':_0x4aa2cf,'headers':{'Authorization':'Bearer\x20'+_0x5a5388,'Content-Type':_0x6fae('0x31')},'body':_0x387aaf,'json':!![]};rp(_0x4966b0)[_0x6fae('0x16')](function(_0x599675){if(_0x599675[_0x6fae('0x32')][0x0][_0x6fae('0x33')]){return _0x195590[_0x6fae('0x17')]({'messageId':_0x599675[_0x6fae('0x32')][0x0]['message_id']});}})[_0x6fae('0x19')](function(_0x3f56cc){logger[_0x6fae('0x34')](_0x6fae('0x35'),_0x3f56cc);});break;}}})['finally'](function(){_0x29ee67();});}else{_0x29ee67();}}},'charset':'utf8mb4','collate':_0x6fae('0x36')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index 0446b06..2d716ca 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 _0xc92b=['error','code','message','info','catch','CreateWhatsappMessage','WhatsappMessage','options','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','http','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','register','request','then','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x594ca2,_0x5406e4){var _0x3aa496=function(_0x44c988){while(--_0x44c988){_0x594ca2['push'](_0x594ca2['shift']());}};_0x3aa496(++_0x5406e4);}(_0xc92b,0x100));var _0xbc92=function(_0x4260c3,_0x2fb5d8){_0x4260c3=_0x4260c3-0x0;var _0x36dfcc=_0xc92b[_0x4260c3];return _0x36dfcc;};'use strict';var _=require(_0xbc92('0x0'));var util=require(_0xbc92('0x1'));var moment=require(_0xbc92('0x2'));var BPromise=require(_0xbc92('0x3'));var rs=require(_0xbc92('0x4'));var fs=require('fs');var Redis=require(_0xbc92('0x5'));var db=require(_0xbc92('0x6'))['db'];var utils=require(_0xbc92('0x7'));var logger=require('../../config/logger')(_0xbc92('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xbc92('0x9')]({'port':0x232a});config[_0xbc92('0xa')]=_[_0xbc92('0xb')](config['redis'],{'host':_0xbc92('0xc'),'port':0x18eb});var socket=require(_0xbc92('0xd'))(new Redis(config['redis']));require(_0xbc92('0xe'))[_0xbc92('0xf')](socket);function respondWithRpcPromise(_0x3ec451,_0x1bf43c,_0x48e72e){return new BPromise(function(_0x3e8ddf,_0x45bcfa){return client[_0xbc92('0x10')](_0x3ec451,_0x48e72e)[_0xbc92('0x11')](function(_0x3c5aeb){logger['info'](_0xbc92('0x12'),_0x1bf43c,_0xbc92('0x13'));logger[_0xbc92('0x14')](_0xbc92('0x15'),_0x1bf43c,_0xbc92('0x13'),JSON[_0xbc92('0x16')](_0x3c5aeb));if(_0x3c5aeb[_0xbc92('0x17')]){if(_0x3c5aeb['error'][_0xbc92('0x18')]===0x1f4){logger['error']('WhatsappMessage,\x20%s,\x20%s',_0x1bf43c,_0x3c5aeb[_0xbc92('0x17')][_0xbc92('0x19')]);return _0x45bcfa(_0x3c5aeb[_0xbc92('0x17')][_0xbc92('0x19')]);}logger[_0xbc92('0x17')]('WhatsappMessage,\x20%s,\x20%s',_0x1bf43c,_0x3c5aeb[_0xbc92('0x17')][_0xbc92('0x19')]);return _0x3e8ddf(_0x3c5aeb[_0xbc92('0x17')][_0xbc92('0x19')]);}else{logger[_0xbc92('0x1a')](_0xbc92('0x12'),_0x1bf43c,_0xbc92('0x13'));_0x3e8ddf(_0x3c5aeb['result'][_0xbc92('0x19')]);}})[_0xbc92('0x1b')](function(_0x2868c4){logger[_0xbc92('0x17')](_0xbc92('0x12'),_0x1bf43c,_0x2868c4);_0x45bcfa(_0x2868c4);});});}exports[_0xbc92('0x1c')]=function(_0x231e24){var _0x1d3725=this;return new Promise(function(_0x5fd021,_0x5163fd){return db[_0xbc92('0x1d')]['create'](_0x231e24['body'],{'raw':_0x231e24['options']?_0x231e24[_0xbc92('0x1e')]['raw']===undefined?!![]:![]:!![]})[_0xbc92('0x11')](function(_0x82915f){logger['info'](_0xbc92('0x1c'),_0x231e24);logger['debug'](_0xbc92('0x1c'),_0x231e24,JSON[_0xbc92('0x16')](_0x82915f));_0x5fd021(_0x82915f);})[_0xbc92('0x1b')](function(_0x5ac783){logger[_0xbc92('0x17')](_0xbc92('0x1c'),_0x5ac783[_0xbc92('0x19')],_0x231e24);_0x5163fd(_0x1d3725[_0xbc92('0x17')](0x1f4,_0x5ac783[_0xbc92('0x19')]));});});}; \ No newline at end of file +var _0xc4ed=['debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','WhatsappMessage,\x20%s,\x20%s','message','info','catch','CreateWhatsappMessage','create','options','then','util','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','./whatsappMessage.socket','register'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc4ed,0x16a));var _0xdc4e=function(_0x19ff50,_0x4ec334){_0x19ff50=_0x19ff50-0x0;var _0x33b996=_0xc4ed[_0x19ff50];return _0x33b996;};'use strict';var _=require('lodash');var util=require(_0xdc4e('0x0'));var moment=require('moment');var BPromise=require(_0xdc4e('0x1'));var rs=require(_0xdc4e('0x2'));var fs=require('fs');var Redis=require(_0xdc4e('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xdc4e('0x4'))(_0xdc4e('0x5'));var config=require(_0xdc4e('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xdc4e('0x7')][_0xdc4e('0x8')]({'port':0x232a});config['redis']=_['defaults'](config[_0xdc4e('0x9')],{'host':_0xdc4e('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xdc4e('0x9')]));require(_0xdc4e('0xb'))[_0xdc4e('0xc')](socket);function respondWithRpcPromise(_0x33ece5,_0x4fc720,_0x3c8620){return new BPromise(function(_0x386456,_0x3772f7){return client['request'](_0x33ece5,_0x3c8620)['then'](function(_0x2fadc3){logger['info']('WhatsappMessage,\x20%s,\x20%s',_0x4fc720,'request\x20sent');logger[_0xdc4e('0xd')](_0xdc4e('0xe'),_0x4fc720,_0xdc4e('0xf'),JSON['stringify'](_0x2fadc3));if(_0x2fadc3[_0xdc4e('0x10')]){if(_0x2fadc3[_0xdc4e('0x10')]['code']===0x1f4){logger['error'](_0xdc4e('0x11'),_0x4fc720,_0x2fadc3[_0xdc4e('0x10')][_0xdc4e('0x12')]);return _0x3772f7(_0x2fadc3[_0xdc4e('0x10')]['message']);}logger['error']('WhatsappMessage,\x20%s,\x20%s',_0x4fc720,_0x2fadc3['error']['message']);return _0x386456(_0x2fadc3[_0xdc4e('0x10')]['message']);}else{logger[_0xdc4e('0x13')]('WhatsappMessage,\x20%s,\x20%s',_0x4fc720,_0xdc4e('0xf'));_0x386456(_0x2fadc3['result'][_0xdc4e('0x12')]);}})[_0xdc4e('0x14')](function(_0x4d8538){logger[_0xdc4e('0x10')](_0xdc4e('0x11'),_0x4fc720,_0x4d8538);_0x3772f7(_0x4d8538);});});}exports[_0xdc4e('0x15')]=function(_0x15bd1f){var _0x3746b5=this;return new Promise(function(_0x3336c9,_0x44c5bb){return db['WhatsappMessage'][_0xdc4e('0x16')](_0x15bd1f['body'],{'raw':_0x15bd1f[_0xdc4e('0x17')]?_0x15bd1f['options']['raw']===undefined?!![]:![]:!![]})[_0xdc4e('0x18')](function(_0x2ebb0e){logger[_0xdc4e('0x13')]('CreateWhatsappMessage',_0x15bd1f);logger[_0xdc4e('0xd')](_0xdc4e('0x15'),_0x15bd1f,JSON['stringify'](_0x2ebb0e));_0x3336c9(_0x2ebb0e);})[_0xdc4e('0x14')](function(_0x4fdaa1){logger[_0xdc4e('0x10')](_0xdc4e('0x15'),_0x4fdaa1[_0xdc4e('0x12')],_0x15bd1f);_0x44c5bb(_0x3746b5[_0xdc4e('0x10')](0x1f4,_0x4fdaa1[_0xdc4e('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index 22f74ce..1c214c1 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 _0x2d39=['length','whatsappMessage:','save','remove','update','removeListener','register'];(function(_0x4ba54b,_0x46f4de){var _0x364bfe=function(_0xe601b3){while(--_0xe601b3){_0x4ba54b['push'](_0x4ba54b['shift']());}};_0x364bfe(++_0x46f4de);}(_0x2d39,0x1b4));var _0x92d3=function(_0x3bf56f,_0x51b417){_0x3bf56f=_0x3bf56f-0x0;var _0x8d6a93=_0x2d39[_0x3bf56f];return _0x8d6a93;};'use strict';var WhatsappMessageEvents=require('./whatsappMessage.events');var events=[_0x92d3('0x0'),_0x92d3('0x1'),_0x92d3('0x2')];function createListener(_0x204985,_0x1ecefb){return function(_0x254c6a){_0x1ecefb['emit'](_0x204985,_0x254c6a);};}function removeListener(_0x36810c,_0x2d9291){return function(){WhatsappMessageEvents[_0x92d3('0x3')](_0x36810c,_0x2d9291);};}exports[_0x92d3('0x4')]=function(_0x3b5360){for(var _0x54ec2a=0x0,_0x4fa430=events[_0x92d3('0x5')];_0x54ec2a<_0x4fa430;_0x54ec2a++){var _0x53d3e8=events[_0x54ec2a];var _0x553346=createListener(_0x92d3('0x6')+_0x53d3e8,_0x3b5360);WhatsappMessageEvents['on'](_0x53d3e8,_0x553346);}}; \ No newline at end of file +var _0xf9c6=['remove','update','emit','removeListener','register','./whatsappMessage.events','save'];(function(_0x3a9f3c,_0x5f24ac){var _0x11e38a=function(_0x24dab0){while(--_0x24dab0){_0x3a9f3c['push'](_0x3a9f3c['shift']());}};_0x11e38a(++_0x5f24ac);}(_0xf9c6,0x1d3));var _0x6f9c=function(_0x2db984,_0x49bc7f){_0x2db984=_0x2db984-0x0;var _0x4e1ab3=_0xf9c6[_0x2db984];return _0x4e1ab3;};'use strict';var WhatsappMessageEvents=require(_0x6f9c('0x0'));var events=[_0x6f9c('0x1'),_0x6f9c('0x2'),_0x6f9c('0x3')];function createListener(_0x374810,_0x2da763){return function(_0x23d60b){_0x2da763[_0x6f9c('0x4')](_0x374810,_0x23d60b);};}function removeListener(_0xbbabbb,_0x3e41ea){return function(){WhatsappMessageEvents[_0x6f9c('0x5')](_0xbbabbb,_0x3e41ea);};}exports[_0x6f9c('0x6')]=function(_0x5b67e6){for(var _0x29cee5=0x0,_0x2c8dd6=events['length'];_0x29cee5<_0x2c8dd6;_0x29cee5++){var _0x15f070=events[_0x29cee5];var _0x3f1d18=createListener('whatsappMessage:'+_0x15f070,_0x5b67e6);WhatsappMessageEvents['on'](_0x15f070,_0x3f1d18);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index 76404b6..0638482 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 _0x4aff=['../../components/auth/service','../../components/interaction/service','./whatsappQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','create','post','addTeams','put','update','delete','destroy','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x7508aa,_0x21f610){var _0x540c29=function(_0x93c14f){while(--_0x93c14f){_0x7508aa['push'](_0x7508aa['shift']());}};_0x540c29(++_0x21f610);}(_0x4aff,0x18c));var _0xf4af=function(_0x4f98bd,_0x5a478d){_0x4f98bd=_0x4f98bd-0x0;var _0x143a7d=_0x4aff[_0x4f98bd];return _0x143a7d;};'use strict';var multer=require(_0xf4af('0x0'));var util=require(_0xf4af('0x1'));var path=require(_0xf4af('0x2'));var timeout=require(_0xf4af('0x3'));var express=require(_0xf4af('0x4'));var router=express[_0xf4af('0x5')]();var fs_extra=require(_0xf4af('0x6'));var auth=require(_0xf4af('0x7'));var interaction=require(_0xf4af('0x8'));var config=require('../../config/environment');var controller=require(_0xf4af('0x9'));router[_0xf4af('0xa')]('/',auth[_0xf4af('0xb')](),controller[_0xf4af('0xc')]);router['get'](_0xf4af('0xd'),auth[_0xf4af('0xb')](),controller[_0xf4af('0xe')]);router['get'](_0xf4af('0xf'),auth[_0xf4af('0xb')](),controller[_0xf4af('0x10')]);router[_0xf4af('0xa')](_0xf4af('0x11'),auth[_0xf4af('0xb')](),controller['getMembers']);router[_0xf4af('0xa')](_0xf4af('0x12'),auth[_0xf4af('0xb')](),controller[_0xf4af('0x13')]);router['get'](_0xf4af('0x14'),auth[_0xf4af('0xb')](),controller[_0xf4af('0x15')]);router['post']('/',auth[_0xf4af('0xb')](),controller[_0xf4af('0x16')]);router[_0xf4af('0x17')](_0xf4af('0x12'),auth['isAuthenticated'](),controller[_0xf4af('0x18')]);router[_0xf4af('0x17')](_0xf4af('0x14'),auth['isAuthenticated'](),controller['addAgents']);router[_0xf4af('0x19')](_0xf4af('0xf'),auth[_0xf4af('0xb')](),controller[_0xf4af('0x1a')]);router[_0xf4af('0x1b')](_0xf4af('0xf'),auth['isAuthenticated'](),controller[_0xf4af('0x1c')]);router[_0xf4af('0x1b')](_0xf4af('0x12'),auth['isAuthenticated'](),controller['removeTeams']);router[_0xf4af('0x1b')]('/:id/users',auth[_0xf4af('0xb')](),controller[_0xf4af('0x1d')]);module[_0xf4af('0x1e')]=router; \ No newline at end of file +var _0xf60c=['./whatsappQueue.controller','get','isAuthenticated','/describe','/:id','show','/:id/members','getTeams','/:id/users','getAgents','post','/:id/teams','addTeams','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0xff1b50,_0x41cc0b){var _0x10f6d3=function(_0x1b2b61){while(--_0x1b2b61){_0xff1b50['push'](_0xff1b50['shift']());}};_0x10f6d3(++_0x41cc0b);}(_0xf60c,0x105));var _0xcf60=function(_0x59c4ed,_0x5aed9d){_0x59c4ed=_0x59c4ed-0x0;var _0x35792e=_0xf60c[_0x59c4ed];return _0x35792e;};'use strict';var multer=require(_0xcf60('0x0'));var util=require(_0xcf60('0x1'));var path=require(_0xcf60('0x2'));var timeout=require(_0xcf60('0x3'));var express=require('express');var router=express[_0xcf60('0x4')]();var fs_extra=require(_0xcf60('0x5'));var auth=require(_0xcf60('0x6'));var interaction=require(_0xcf60('0x7'));var config=require(_0xcf60('0x8'));var controller=require(_0xcf60('0x9'));router[_0xcf60('0xa')]('/',auth[_0xcf60('0xb')](),controller['index']);router[_0xcf60('0xa')](_0xcf60('0xc'),auth[_0xcf60('0xb')](),controller['describe']);router[_0xcf60('0xa')](_0xcf60('0xd'),auth[_0xcf60('0xb')](),controller[_0xcf60('0xe')]);router[_0xcf60('0xa')](_0xcf60('0xf'),auth[_0xcf60('0xb')](),controller['getMembers']);router[_0xcf60('0xa')]('/:id/teams',auth[_0xcf60('0xb')](),controller[_0xcf60('0x10')]);router[_0xcf60('0xa')](_0xcf60('0x11'),auth[_0xcf60('0xb')](),controller[_0xcf60('0x12')]);router[_0xcf60('0x13')]('/',auth[_0xcf60('0xb')](),controller['create']);router[_0xcf60('0x13')](_0xcf60('0x14'),auth['isAuthenticated'](),controller[_0xcf60('0x15')]);router[_0xcf60('0x13')](_0xcf60('0x11'),auth[_0xcf60('0xb')](),controller['addAgents']);router[_0xcf60('0x16')](_0xcf60('0xd'),auth[_0xcf60('0xb')](),controller[_0xcf60('0x17')]);router[_0xcf60('0x18')](_0xcf60('0xd'),auth[_0xcf60('0xb')](),controller[_0xcf60('0x19')]);router['delete']('/:id/teams',auth[_0xcf60('0xb')](),controller['removeTeams']);router[_0xcf60('0x18')](_0xcf60('0x11'),auth[_0xcf60('0xb')](),controller['removeAgents']);module[_0xcf60('0x1a')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index 6bab42e..da9d2e4 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 _0x823c=['beepall','sequelize','STRING','name','INTEGER','ENUM','rrmemory'];(function(_0x917bb1,_0x5c39e5){var _0x5bfab7=function(_0x1fddc5){while(--_0x1fddc5){_0x917bb1['push'](_0x917bb1['shift']());}};_0x5bfab7(++_0x5c39e5);}(_0x823c,0x143));var _0xc823=function(_0x1b4603,_0x25d3dd){_0x1b4603=_0x1b4603-0x0;var _0x347282=_0x823c[_0x1b4603];return _0x347282;};'use strict';var Sequelize=require(_0xc823('0x0'));module['exports']={'name':{'type':Sequelize[_0xc823('0x1')],'unique':_0xc823('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0xc823('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xc823('0x4')](_0xc823('0x5'),_0xc823('0x6'),'roundrobin')},'description':{'type':Sequelize[_0xc823('0x1')]}}; \ No newline at end of file +var _0xe0b2=['name','INTEGER','ENUM','rrmemory','beepall','exports','STRING'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xe0b2,0xec));var _0x2e0b=function(_0x44250f,_0x5e54d3){_0x44250f=_0x44250f-0x0;var _0x5c312d=_0xe0b2[_0x44250f];return _0x5c312d;};'use strict';var Sequelize=require('sequelize');module[_0x2e0b('0x0')]={'name':{'type':Sequelize[_0x2e0b('0x1')],'unique':_0x2e0b('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x2e0b('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x2e0b('0x4')](_0x2e0b('0x5'),_0x2e0b('0x6'),'roundrobin')},'description':{'type':Sequelize[_0x2e0b('0x1')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index f4a92d7..5ad672d 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 _0xa032=['QueryTypes','SELECT','TeamId','includes','all','compact','value','isEmpty','removeAgents','userWhatsappQueue:remove','addAgents','omit','isArray','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','moment','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./whatsappQueue.socket','register','status','end','undefined','limit','count','offset','set','json','reject','save','update','then','destroy','get','WhatsappQueues','sendStatus','error','stack','name','send','index','WhatsappQueue','rawAttributes','type','key','map','query','keys','intersection','model','attributes','fields','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','options','findAll','rows','show','length','includeAll','include','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','catch','params','describe','getMembers','findOne','UserWhatsappQueue','WhatsappQueueId','findAndCountAll','UserId','agent','whatsappPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','order','ids','User','Agents','online','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','userWhatsappQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_whatsapp_queues','join','user_has_teams','WhatsappQueueId\x20=\x20?','ut.UserId\x20=\x20?','toString'];(function(_0x57e5fa,_0x579542){var _0x4d8b97=function(_0xfc24f5){while(--_0xfc24f5){_0x57e5fa['push'](_0x57e5fa['shift']());}};_0x4d8b97(++_0x579542);}(_0xa032,0x12e));var _0x2a03=function(_0x351509,_0x54725c){_0x351509=_0x351509-0x0;var _0x4e9861=_0xa032[_0x351509];return _0x4e9861;};'use strict';var emlformat=require(_0x2a03('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2a03('0x1'));var jsonpatch=require(_0x2a03('0x2'));var rp=require(_0x2a03('0x3'));var moment=require(_0x2a03('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x2a03('0x5'));var sox=require(_0x2a03('0x6'));var csv=require('to-csv');var ejs=require(_0x2a03('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2a03('0x8'));var squel=require(_0x2a03('0x9'));var crypto=require(_0x2a03('0xa'));var jsforce=require(_0x2a03('0xb'));var deskjs=require(_0x2a03('0xc'));var toCsv=require(_0x2a03('0xd'));var querystring=require(_0x2a03('0xe'));var Papa=require(_0x2a03('0xf'));var Redis=require(_0x2a03('0x10'));var authService=require(_0x2a03('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x2a03('0x12'));var hardwareService=require(_0x2a03('0x13'));var logger=require(_0x2a03('0x14'))(_0x2a03('0x15'));var utils=require(_0x2a03('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x2a03('0x17'));var db=require(_0x2a03('0x18'))['db'];config['redis']=_[_0x2a03('0x19')](config[_0x2a03('0x1a')],{'host':_0x2a03('0x1b'),'port':0x18eb});var socket=require(_0x2a03('0x1c'))(new Redis(config['redis']));require(_0x2a03('0x1d'))[_0x2a03('0x1e')](socket);function respondWithStatusCode(_0x2b15e9,_0x2d6f3c){_0x2d6f3c=_0x2d6f3c||0xcc;return function(_0xb09af3){if(_0xb09af3){return _0x2b15e9['sendStatus'](_0x2d6f3c);}return _0x2b15e9[_0x2a03('0x1f')](_0x2d6f3c)[_0x2a03('0x20')]();};}function respondWithResult(_0x151713,_0x5580e5){_0x5580e5=_0x5580e5||0xc8;return function(_0x6964f3){if(_0x6964f3){return _0x151713['status'](_0x5580e5)['json'](_0x6964f3);}};}function respondWithFilteredResult(_0x49f75d,_0x8e0493){return function(_0x312867){if(_0x312867){var _0x47c7e1=typeof _0x8e0493['offset']===_0x2a03('0x21')&&typeof _0x8e0493[_0x2a03('0x22')]===_0x2a03('0x21');var _0x481a35=_0x312867[_0x2a03('0x23')];var _0x3c3ba3=_0x47c7e1?0x0:_0x8e0493[_0x2a03('0x24')];var _0x281094=_0x47c7e1?_0x312867['count']:_0x8e0493['offset']+_0x8e0493[_0x2a03('0x22')];var _0x383e8b;if(_0x281094>=_0x481a35){_0x281094=_0x481a35;_0x383e8b=0xc8;}else{_0x383e8b=0xce;}_0x49f75d[_0x2a03('0x1f')](_0x383e8b);return _0x49f75d[_0x2a03('0x25')]('Content-Range',_0x3c3ba3+'-'+_0x281094+'/'+_0x481a35)[_0x2a03('0x26')](_0x312867);}return null;};}function patchUpdates(_0x5f4a0f){return function(_0x20a84e){try{jsonpatch['apply'](_0x20a84e,_0x5f4a0f,!![]);}catch(_0xafc29c){return BPromise[_0x2a03('0x27')](_0xafc29c);}return _0x20a84e[_0x2a03('0x28')]();};}function saveUpdates(_0x1a3a2d,_0x11a05a){return function(_0x391b15){if(_0x391b15){return _0x391b15[_0x2a03('0x29')](_0x1a3a2d)[_0x2a03('0x2a')](function(_0x483fb4){return _0x483fb4;});}return null;};}function removeEntity(_0xb7ebca,_0x4742c4){return function(_0x3a4513){if(_0x3a4513){return _0x3a4513[_0x2a03('0x2b')]()[_0x2a03('0x2a')](function(){var _0x1c63e1=_0x3a4513[_0x2a03('0x2c')]({'plain':!![]});var _0x23037c=_0x2a03('0x2d');return db['UserProfileResource']['destroy']({'where':{'type':_0x23037c,'resourceId':_0x1c63e1['id']}})[_0x2a03('0x2a')](function(){return _0x3a4513;});})[_0x2a03('0x2a')](function(){_0xb7ebca['status'](0xcc)[_0x2a03('0x20')]();});}};}function handleEntityNotFound(_0x3b7528,_0x9ffa8e){return function(_0xd49595){if(!_0xd49595){_0x3b7528[_0x2a03('0x2e')](0x194);}return _0xd49595;};}function handleError(_0x3c2490,_0x7aa5a4){_0x7aa5a4=_0x7aa5a4||0x1f4;return function(_0x2f1897){logger[_0x2a03('0x2f')](_0x2f1897[_0x2a03('0x30')]);if(_0x2f1897[_0x2a03('0x31')]){delete _0x2f1897[_0x2a03('0x31')];}_0x3c2490[_0x2a03('0x1f')](_0x7aa5a4)[_0x2a03('0x32')](_0x2f1897);};}exports[_0x2a03('0x33')]=function(_0x123912,_0x25b0d1){var _0x401dfe={},_0x1c2e54={},_0x285b32={'count':0x0,'rows':[]};var _0x49a1f0=_['map'](db[_0x2a03('0x34')][_0x2a03('0x35')],function(_0x553c93){return{'name':_0x553c93['fieldName'],'type':_0x553c93[_0x2a03('0x36')][_0x2a03('0x37')]};});_0x1c2e54['model']=_[_0x2a03('0x38')](_0x49a1f0,_0x2a03('0x31'));_0x1c2e54[_0x2a03('0x39')]=_[_0x2a03('0x3a')](_0x123912[_0x2a03('0x39')]);_0x1c2e54['filters']=_[_0x2a03('0x3b')](_0x1c2e54[_0x2a03('0x3c')],_0x1c2e54['query']);_0x401dfe[_0x2a03('0x3d')]=_[_0x2a03('0x3b')](_0x1c2e54[_0x2a03('0x3c')],qs['fields'](_0x123912['query'][_0x2a03('0x3e')]));_0x401dfe['attributes']=_0x401dfe[_0x2a03('0x3d')]['length']?_0x401dfe[_0x2a03('0x3d')]:_0x1c2e54[_0x2a03('0x3c')];if(!_0x123912[_0x2a03('0x39')][_0x2a03('0x3f')](_0x2a03('0x40'))){_0x401dfe['limit']=qs['limit'](_0x123912['query'][_0x2a03('0x22')]);_0x401dfe[_0x2a03('0x24')]=qs['offset'](_0x123912[_0x2a03('0x39')][_0x2a03('0x24')]);}_0x401dfe['order']=qs['sort'](_0x123912[_0x2a03('0x39')][_0x2a03('0x41')]);_0x401dfe[_0x2a03('0x42')]=qs[_0x2a03('0x43')](_[_0x2a03('0x44')](_0x123912[_0x2a03('0x39')],_0x1c2e54[_0x2a03('0x43')]),_0x49a1f0);if(_0x123912[_0x2a03('0x39')][_0x2a03('0x45')]){_0x401dfe[_0x2a03('0x42')]=_[_0x2a03('0x46')](_0x401dfe[_0x2a03('0x42')],{'$or':_[_0x2a03('0x38')](_0x49a1f0,function(_0x332c9a){if(_0x332c9a[_0x2a03('0x36')]!=='VIRTUAL'){var _0x331a68={};_0x331a68[_0x332c9a[_0x2a03('0x31')]]={'$like':'%'+_0x123912[_0x2a03('0x39')]['filter']+'%'};return _0x331a68;}})});}_0x401dfe=_[_0x2a03('0x46')]({},_0x401dfe,_0x123912[_0x2a03('0x47')]);var _0x287a66={'where':_0x401dfe[_0x2a03('0x42')]};return db[_0x2a03('0x34')][_0x2a03('0x23')](_0x287a66)[_0x2a03('0x2a')](function(_0x5700c9){_0x285b32['count']=_0x5700c9;if(_0x123912[_0x2a03('0x39')]['includeAll']){_0x401dfe['include']=[{'all':!![]}];}return db[_0x2a03('0x34')][_0x2a03('0x48')](_0x401dfe);})['then'](function(_0x5d2d0b){_0x285b32[_0x2a03('0x49')]=_0x5d2d0b;return _0x285b32;})[_0x2a03('0x2a')](respondWithFilteredResult(_0x25b0d1,_0x401dfe))['catch'](handleError(_0x25b0d1,null));};exports[_0x2a03('0x4a')]=function(_0x1c7726,_0x39ab78){var _0x34fa6b={'raw':!![],'where':{'id':_0x1c7726['params']['id']}},_0x3160da={};_0x3160da[_0x2a03('0x3c')]=_[_0x2a03('0x3a')](db[_0x2a03('0x34')][_0x2a03('0x35')]);_0x3160da[_0x2a03('0x39')]=_[_0x2a03('0x3a')](_0x1c7726[_0x2a03('0x39')]);_0x3160da[_0x2a03('0x43')]=_[_0x2a03('0x3b')](_0x3160da[_0x2a03('0x3c')],_0x3160da[_0x2a03('0x39')]);_0x34fa6b[_0x2a03('0x3d')]=_['intersection'](_0x3160da['model'],qs['fields'](_0x1c7726['query']['fields']));_0x34fa6b[_0x2a03('0x3d')]=_0x34fa6b[_0x2a03('0x3d')][_0x2a03('0x4b')]?_0x34fa6b['attributes']:_0x3160da['model'];if(_0x1c7726['query'][_0x2a03('0x4c')]){_0x34fa6b[_0x2a03('0x4d')]=[{'all':!![]}];}_0x34fa6b=_[_0x2a03('0x46')]({},_0x34fa6b,_0x1c7726[_0x2a03('0x47')]);return db['WhatsappQueue'][_0x2a03('0x4e')](_0x34fa6b)[_0x2a03('0x2a')](handleEntityNotFound(_0x39ab78,null))[_0x2a03('0x2a')](respondWithResult(_0x39ab78,null))['catch'](handleError(_0x39ab78,null));};exports[_0x2a03('0x4f')]=function(_0x5a7666,_0x189883){return db[_0x2a03('0x34')]['create'](_0x5a7666[_0x2a03('0x50')],{})['then'](function(_0x204010){var _0xb017dc=_0x5a7666['user'][_0x2a03('0x2c')]({'plain':!![]});if(!_0xb017dc)throw new Error(_0x2a03('0x51'));if(_0xb017dc[_0x2a03('0x52')]==='user'){var _0x55e391=_0x204010[_0x2a03('0x2c')]({'plain':!![]});var _0x2e1da2=_0x2a03('0x2d');return db[_0x2a03('0x53')]['find']({'where':{'name':_0x2e1da2,'userProfileId':_0xb017dc[_0x2a03('0x54')]},'raw':!![]})['then'](function(_0x11824d){if(_0x11824d&&_0x11824d[_0x2a03('0x55')]===0x0){return db[_0x2a03('0x56')][_0x2a03('0x4f')]({'name':_0x55e391[_0x2a03('0x31')],'resourceId':_0x55e391['id'],'type':_0x11824d['name'],'sectionId':_0x11824d['id']},{})[_0x2a03('0x2a')](function(){return _0x204010;});}else{return _0x204010;}})['catch'](function(_0x54104f){logger[_0x2a03('0x2f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x54104f);throw _0x54104f;});}return _0x204010;})[_0x2a03('0x2a')](respondWithResult(_0x189883,0xc9))[_0x2a03('0x57')](handleError(_0x189883,null));};exports[_0x2a03('0x29')]=function(_0x1ae96f,_0x4f08a5){if(_0x1ae96f['body']['id']){delete _0x1ae96f['body']['id'];}return db[_0x2a03('0x34')]['find']({'where':{'id':_0x1ae96f[_0x2a03('0x58')]['id']}})[_0x2a03('0x2a')](handleEntityNotFound(_0x4f08a5,null))[_0x2a03('0x2a')](saveUpdates(_0x1ae96f[_0x2a03('0x50')],null))[_0x2a03('0x2a')](respondWithResult(_0x4f08a5,null))[_0x2a03('0x57')](handleError(_0x4f08a5,null));};exports[_0x2a03('0x2b')]=function(_0x33b4ce,_0x4a6e26){return db['WhatsappQueue']['find']({'where':{'id':_0x33b4ce[_0x2a03('0x58')]['id']}})['then'](handleEntityNotFound(_0x4a6e26,null))[_0x2a03('0x2a')](removeEntity(_0x4a6e26,null))[_0x2a03('0x57')](handleError(_0x4a6e26,null));};exports[_0x2a03('0x59')]=function(_0x105cd3,_0x4a39ee){return db[_0x2a03('0x34')][_0x2a03('0x59')]()[_0x2a03('0x2a')](respondWithResult(_0x4a39ee,null))[_0x2a03('0x57')](handleError(_0x4a39ee,null));};exports[_0x2a03('0x5a')]=function(_0x162db9,_0x28a239,_0x2916bd){var _0x5b817b={'raw':!![],'where':{}},_0x4f87b3={},_0x5a86e6;return db[_0x2a03('0x34')][_0x2a03('0x5b')]({'where':{'id':_0x162db9['params']['id']}})['then'](handleEntityNotFound(_0x28a239,null))[_0x2a03('0x2a')](function(_0x2f4c21){if(_0x2f4c21){_0x5a86e6=_0x2f4c21['get']({'plain':!![]});_0x4f87b3[_0x2a03('0x3c')]=_['keys'](db[_0x2a03('0x5c')][_0x2a03('0x35')]);_0x4f87b3[_0x2a03('0x39')]=_[_0x2a03('0x3a')](_0x162db9[_0x2a03('0x39')]);_0x4f87b3[_0x2a03('0x43')]=_[_0x2a03('0x3b')](_0x4f87b3[_0x2a03('0x3c')],_0x4f87b3[_0x2a03('0x39')]);_0x5b817b[_0x2a03('0x3d')]=_[_0x2a03('0x3b')](_0x4f87b3[_0x2a03('0x3c')],qs['fields'](_0x162db9['query'][_0x2a03('0x3e')]));_0x5b817b['attributes']=_0x5b817b[_0x2a03('0x3d')][_0x2a03('0x4b')]?_0x5b817b[_0x2a03('0x3d')]:_0x4f87b3['model'];if(!_0x162db9[_0x2a03('0x39')][_0x2a03('0x3f')]('nolimit')){_0x5b817b[_0x2a03('0x22')]=qs[_0x2a03('0x22')](_0x162db9['query'][_0x2a03('0x22')]);_0x5b817b[_0x2a03('0x24')]=qs[_0x2a03('0x24')](_0x162db9['query'][_0x2a03('0x24')]);}_0x5b817b['order']=qs[_0x2a03('0x41')](_0x162db9[_0x2a03('0x39')][_0x2a03('0x41')]);_0x5b817b[_0x2a03('0x42')]=qs['filters'](_[_0x2a03('0x44')](_0x162db9[_0x2a03('0x39')],_0x4f87b3[_0x2a03('0x43')]));_0x5b817b[_0x2a03('0x42')][_0x2a03('0x5d')]=_0x2f4c21['id'];if(_0x162db9[_0x2a03('0x39')][_0x2a03('0x45')]){_0x5b817b[_0x2a03('0x42')]=_['merge'](_0x5b817b[_0x2a03('0x42')],{'$or':_[_0x2a03('0x38')](_0x5b817b[_0x2a03('0x3d')],function(_0x5e83b3){var _0x201373={};_0x201373[_0x5e83b3]={'$like':'%'+_0x162db9['query'][_0x2a03('0x45')]+'%'};return _0x201373;})});}_0x5b817b=_[_0x2a03('0x46')]({},_0x5b817b,_0x162db9[_0x2a03('0x47')]);return db[_0x2a03('0x5c')]['findAll'](_0x5b817b);}})[_0x2a03('0x2a')](function(_0x3672d0){if(_0x3672d0){return db['User'][_0x2a03('0x5e')]({'where':{'id':_['map'](_0x3672d0,_0x2a03('0x5f')),'role':_0x2a03('0x60')},'attributes':['id','name',_0x2a03('0x61'),_0x2a03('0x62'),_0x2a03('0x63')]});}})[_0x2a03('0x2a')](function(_0x5e1fe3){if(_0x5e1fe3){return{'count':_0x5e1fe3['count'],'rows':_[_0x2a03('0x38')](_0x5e1fe3[_0x2a03('0x49')],function(_0x279097){return{'membername':_0x279097[_0x2a03('0x31')],'UserId':_0x279097['id'],'queue_name':_0x5a86e6[_0x2a03('0x31')],'WhatsappQueueId':_0x5a86e6['id'],'interface':util[_0x2a03('0x64')](_0x2a03('0x65'),_0x2a03('0x66'),_0x279097['name']),'penalty':0x0,'paused':_0x279097[_0x2a03('0x61')],'createdAt':_0x279097[_0x2a03('0x63')],'updatedAt':_0x279097[_0x2a03('0x62')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x28a239,_0x5b817b))[_0x2a03('0x57')](handleError(_0x28a239,null));};exports[_0x2a03('0x67')]=function(_0x50e491,_0x304b78,_0x24f162){var _0xdcc5cf={};var _0x5b519d={};var _0x1f2bbf;var _0x4bd9b1;return db['WhatsappQueue'][_0x2a03('0x5b')]({'where':{'id':_0x50e491[_0x2a03('0x58')]['id']}})['then'](handleEntityNotFound(_0x304b78,null))[_0x2a03('0x2a')](function(_0x361859){if(_0x361859){_0x1f2bbf=_0x361859;_0x5b519d['model']=_[_0x2a03('0x3a')](db[_0x2a03('0x68')][_0x2a03('0x35')]);_0x5b519d[_0x2a03('0x39')]=_[_0x2a03('0x3a')](_0x50e491[_0x2a03('0x39')]);_0x5b519d[_0x2a03('0x43')]=_[_0x2a03('0x3b')](_0x5b519d[_0x2a03('0x3c')],_0x5b519d[_0x2a03('0x39')]);_0xdcc5cf[_0x2a03('0x3d')]=_[_0x2a03('0x3b')](_0x5b519d[_0x2a03('0x3c')],qs[_0x2a03('0x3e')](_0x50e491[_0x2a03('0x39')][_0x2a03('0x3e')]));_0xdcc5cf['attributes']=_0xdcc5cf[_0x2a03('0x3d')][_0x2a03('0x4b')]?_0xdcc5cf[_0x2a03('0x3d')]:_0x5b519d['model'];_0xdcc5cf[_0x2a03('0x69')]=qs[_0x2a03('0x41')](_0x50e491[_0x2a03('0x39')][_0x2a03('0x41')]);_0xdcc5cf['where']=qs[_0x2a03('0x43')](_[_0x2a03('0x44')](_0x50e491[_0x2a03('0x39')],_0x5b519d[_0x2a03('0x43')]));if(_0x50e491[_0x2a03('0x39')][_0x2a03('0x45')]){_0xdcc5cf['where']=_[_0x2a03('0x46')](_0xdcc5cf[_0x2a03('0x42')],{'$or':_['map'](_0xdcc5cf[_0x2a03('0x3d')],function(_0x2d3ae1){var _0x1f7a2c={};_0x1f7a2c[_0x2d3ae1]={'$like':'%'+_0x50e491['query'][_0x2a03('0x45')]+'%'};return _0x1f7a2c;})});}_0xdcc5cf=_[_0x2a03('0x46')]({},_0xdcc5cf,_0x50e491[_0x2a03('0x47')]);return _0x1f2bbf[_0x2a03('0x67')](_0xdcc5cf);}})[_0x2a03('0x2a')](function(_0x577ce1){if(_0x577ce1){_0x4bd9b1=_0x577ce1[_0x2a03('0x4b')];if(!_0x50e491[_0x2a03('0x39')]['hasOwnProperty']('nolimit')){_0xdcc5cf[_0x2a03('0x22')]=qs['limit'](_0x50e491[_0x2a03('0x39')][_0x2a03('0x22')]);_0xdcc5cf[_0x2a03('0x24')]=qs[_0x2a03('0x24')](_0x50e491['query'][_0x2a03('0x24')]);}return _0x1f2bbf[_0x2a03('0x67')](_0xdcc5cf);}})[_0x2a03('0x2a')](function(_0x463876){if(_0x463876){return _0x463876?{'count':_0x4bd9b1,'rows':_0x463876}:null;}})[_0x2a03('0x2a')](respondWithResult(_0x304b78,null))[_0x2a03('0x57')](handleError(_0x304b78,null));};exports['addTeams']=function(_0x1a3f22,_0x185264,_0x59c5df){var _0x1fba7e=_0x1a3f22['body'][_0x2a03('0x6a')];return db[_0x2a03('0x68')]['findAll']({'where':{'id':_0x1fba7e},'attributes':['id'],'include':[{'model':db[_0x2a03('0x6b')],'as':_0x2a03('0x6c'),'attributes':['id',_0x2a03('0x31'),_0x2a03('0x6d'),'voicePause',_0x2a03('0x6e')],'raw':!![]}]})[_0x2a03('0x2a')](function(_0x498f15){if(_0x498f15){var _0x354654=_[_0x2a03('0x6f')](_0x498f15,function(_0x23e156){var _0x99a967=_0x23e156[_0x2a03('0x2c')]({'plain':!![]});return _0x99a967[_0x2a03('0x6c')];});return db[_0x2a03('0x34')][_0x2a03('0x4e')]({'where':{'id':_0x1a3f22['params']['id']}})['then'](function(_0x2bf72d){return db[_0x2a03('0x70')][_0x2a03('0x71')](function(_0x4a4d1b){return _0x2bf72d['addTeams'](_0x1fba7e,{'transaction':_0x4a4d1b})[_0x2a03('0x2a')](function(){return BPromise[_0x2a03('0x72')](_0x354654,function(_0x316074){return db[_0x2a03('0x5c')][_0x2a03('0x73')]({'where':{'UserId':_0x316074['id'],'WhatsappQueueId':_0x1a3f22['params']['id']},'transaction':_0x4a4d1b});});})[_0x2a03('0x2a')](function(){_0x354654[_0x2a03('0x74')](function(_0x1f28a0){socket[_0x2a03('0x75')](_0x2a03('0x76'),{'UserId':_0x1f28a0['id'],'WhatsappQueueId':_0x2bf72d['id']});});});});});}})[_0x2a03('0x2a')](respondWithStatusCode(_0x185264,null))[_0x2a03('0x57')](handleError(_0x185264,null));};exports[_0x2a03('0x77')]=function(_0x2a1705,_0x52dbb4,_0x28fec1){return db['Team'][_0x2a03('0x48')]({'where':{'id':_0x2a1705['query']['ids']},'attributes':['id'],'include':[{'model':db[_0x2a03('0x6b')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x52dbb4,null))[_0x2a03('0x2a')](function(_0x47cab6){var _0x59add1=_[_0x2a03('0x38')](_0x47cab6,'id');var _0x1d2e9b=[];var _0xd161b4=[];var _0x4face9=squel[_0x2a03('0x78')]();_0x4face9[_0x2a03('0x79')](_0x2a03('0x7a'))[_0x2a03('0x7b')](_0x2a03('0x7c'),'tq')[_0x2a03('0x7d')](_0x2a03('0x7e'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x2a03('0x42')](_0x2a03('0x7f'),_0x2a1705[_0x2a03('0x58')]['id']);for(var _0x3f038d=0x0;_0x3f038d<_0x47cab6[_0x2a03('0x4b')];_0x3f038d+=0x1){let _0x450e77=_0x47cab6[_0x3f038d];for(var _0x1dc5f2=0x0;_0x1dc5f2<_0x450e77[_0x2a03('0x6c')]['length'];_0x1dc5f2+=0x1){let _0x5e24b0=_0x450e77[_0x2a03('0x6c')][_0x1dc5f2];var _0x139c90=_0x4face9['clone']();_0x139c90[_0x2a03('0x42')](_0x2a03('0x80'),_0x5e24b0['id']);_0xd161b4['push'](db[_0x2a03('0x70')][_0x2a03('0x39')](_0x139c90[_0x2a03('0x81')](),{'type':db[_0x2a03('0x70')][_0x2a03('0x82')][_0x2a03('0x83')]})[_0x2a03('0x2a')](function(_0x17cc1b){if(_0x17cc1b[_0x2a03('0x4b')]===0x1){return _0x5e24b0['id'];}else{var _0x294ab4=_['every'](_[_0x2a03('0x38')](_0x17cc1b,_0x2a03('0x84')),function(_0x1765ee){return _[_0x2a03('0x85')](_0x59add1,_0x1765ee);});if(_0x294ab4){return _0x5e24b0['id'];}}}));}}return BPromise[_0x2a03('0x86')](_0xd161b4)[_0x2a03('0x2a')](function(_0x21cce0){_0x1d2e9b=_(_0x1d2e9b)['union'](_0x21cce0)[_0x2a03('0x87')]()[_0x2a03('0x88')]();return db['WhatsappQueue'][_0x2a03('0x4e')]({'where':{'id':_0x2a1705[_0x2a03('0x58')]['id']}})[_0x2a03('0x2a')](function(_0x38ae4a){return db[_0x2a03('0x70')]['transaction'](function(_0x499d5d){return _0x38ae4a[_0x2a03('0x77')](_0x2a1705[_0x2a03('0x39')][_0x2a03('0x6a')],{'transaction':_0x499d5d})[_0x2a03('0x2a')](function(){if(!_[_0x2a03('0x89')](_0x1d2e9b)){return _0x38ae4a[_0x2a03('0x8a')](_0x1d2e9b,{'transaction':_0x499d5d});}})[_0x2a03('0x2a')](function(){_0x1d2e9b[_0x2a03('0x74')](function(_0x1afbc1){socket[_0x2a03('0x75')](_0x2a03('0x8b'),{'UserId':_0x1afbc1,'WhatsappQueueId':_0x38ae4a['id']});});});});});});})[_0x2a03('0x2a')](respondWithStatusCode(_0x52dbb4,null))[_0x2a03('0x57')](handleError(_0x52dbb4,null));};exports[_0x2a03('0x8c')]=function(_0x494422,_0x10f21d,_0x428808){return db[_0x2a03('0x34')]['find']({'where':{'id':_0x494422[_0x2a03('0x58')]['id']}})[_0x2a03('0x2a')](handleEntityNotFound(_0x10f21d,null))['then'](function(_0x1adca0){if(_0x1adca0){return _0x1adca0['addAgents'](_0x494422[_0x2a03('0x50')][_0x2a03('0x6a')],_[_0x2a03('0x8d')](_0x494422[_0x2a03('0x50')],[_0x2a03('0x6a'),'id'])||{})['spread'](function(_0x3b966e){for(var _0x176492=0x0;_0x176492<_0x494422[_0x2a03('0x50')][_0x2a03('0x6a')][_0x2a03('0x4b')];_0x176492+=0x1){socket['emit'](_0x2a03('0x76'),{'UserId':Number(_0x494422[_0x2a03('0x50')][_0x2a03('0x6a')][_0x176492]),'WhatsappQueueId':Number(_0x494422[_0x2a03('0x58')]['id'])});}return _0x3b966e;});}})['then'](respondWithResult(_0x10f21d,null))[_0x2a03('0x57')](handleError(_0x10f21d,null));};exports[_0x2a03('0x8a')]=function(_0x5b3dbc,_0x3a94cb,_0x14ab96){return db[_0x2a03('0x34')][_0x2a03('0x4e')]({'where':{'id':_0x5b3dbc[_0x2a03('0x58')]['id']}})[_0x2a03('0x2a')](handleEntityNotFound(_0x3a94cb,null))['then'](function(_0x4cce16){if(_0x4cce16){return _0x4cce16[_0x2a03('0x8a')](_0x5b3dbc['query'][_0x2a03('0x6a')])['then'](function(){if(_[_0x2a03('0x8e')](_0x5b3dbc['query'][_0x2a03('0x6a')])){for(var _0x35649f=0x0;_0x35649f<_0x5b3dbc[_0x2a03('0x39')][_0x2a03('0x6a')]['length'];_0x35649f+=0x1){socket[_0x2a03('0x75')]('userWhatsappQueue:remove',{'UserId':Number(_0x5b3dbc[_0x2a03('0x39')][_0x2a03('0x6a')][_0x35649f]),'WhatsappQueueId':Number(_0x5b3dbc[_0x2a03('0x58')]['id'])});}}else{socket[_0x2a03('0x75')]('userWhatsappQueue:remove',{'UserId':Number(_0x5b3dbc[_0x2a03('0x39')][_0x2a03('0x6a')]),'WhatsappQueueId':Number(_0x5b3dbc[_0x2a03('0x58')]['id'])});}});}})[_0x2a03('0x2a')](respondWithStatusCode(_0x3a94cb,null))[_0x2a03('0x57')](handleError(_0x3a94cb,null));};exports['getAgents']=function(_0x34308a,_0x523983,_0x255011){var _0x3043f8={};var _0xfbf4ec={};var _0x51cb14;var _0x478742;return db[_0x2a03('0x34')][_0x2a03('0x5b')]({'where':{'id':_0x34308a[_0x2a03('0x58')]['id']}})[_0x2a03('0x2a')](handleEntityNotFound(_0x523983,null))[_0x2a03('0x2a')](function(_0x4d9b81){if(_0x4d9b81){_0x51cb14=_0x4d9b81;_0xfbf4ec['model']=_[_0x2a03('0x3a')](db['User'][_0x2a03('0x35')]);_0xfbf4ec[_0x2a03('0x39')]=_['keys'](_0x34308a[_0x2a03('0x39')]);_0xfbf4ec[_0x2a03('0x43')]=_[_0x2a03('0x3b')](_0xfbf4ec[_0x2a03('0x3c')],_0xfbf4ec['query']);_0x3043f8[_0x2a03('0x3d')]=_['intersection'](_0xfbf4ec[_0x2a03('0x3c')],qs[_0x2a03('0x3e')](_0x34308a[_0x2a03('0x39')][_0x2a03('0x3e')]));_0x3043f8['attributes']=_0x3043f8[_0x2a03('0x3d')][_0x2a03('0x4b')]?_0x3043f8['attributes']:_0xfbf4ec[_0x2a03('0x3c')];_0x3043f8['order']=qs[_0x2a03('0x41')](_0x34308a[_0x2a03('0x39')][_0x2a03('0x41')]);_0x3043f8[_0x2a03('0x42')]=qs[_0x2a03('0x43')](_[_0x2a03('0x44')](_0x34308a[_0x2a03('0x39')],_0xfbf4ec[_0x2a03('0x43')]));if(_0x34308a['query'][_0x2a03('0x45')]){_0x3043f8[_0x2a03('0x42')]=_[_0x2a03('0x46')](_0x3043f8[_0x2a03('0x42')],{'$or':_[_0x2a03('0x38')](_0x3043f8[_0x2a03('0x3d')],function(_0x232882){var _0x149170={};_0x149170[_0x232882]={'$like':'%'+_0x34308a['query']['filter']+'%'};return _0x149170;})});}_0x3043f8=_[_0x2a03('0x46')]({},_0x3043f8,_0x34308a[_0x2a03('0x47')]);return _0x51cb14[_0x2a03('0x8f')](_0x3043f8);}})[_0x2a03('0x2a')](function(_0xd1d872){if(_0xd1d872){_0x478742=_0xd1d872[_0x2a03('0x4b')];if(!_0x34308a['query'][_0x2a03('0x3f')]('nolimit')){_0x3043f8[_0x2a03('0x22')]=qs[_0x2a03('0x22')](_0x34308a[_0x2a03('0x39')][_0x2a03('0x22')]);_0x3043f8[_0x2a03('0x24')]=qs[_0x2a03('0x24')](_0x34308a[_0x2a03('0x39')][_0x2a03('0x24')]);}return _0x51cb14[_0x2a03('0x8f')](_0x3043f8);}})[_0x2a03('0x2a')](function(_0x195e95){if(_0x195e95){return _0x195e95?{'count':_0x478742,'rows':_0x195e95}:null;}})[_0x2a03('0x2a')](respondWithResult(_0x523983,null))[_0x2a03('0x57')](handleError(_0x523983,null));}; \ No newline at end of file +var _0x1c30=['send','index','rawAttributes','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','sort','filters','pick','filter','where','merge','type','options','WhatsappQueue','includeAll','include','rows','show','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','params','describe','getMembers','findOne','nolimit','order','WhatsappQueueId','UserWhatsappQueue','User','findAndCountAll','agent','whatsappPause','createdAt','%s/%s','SIP','updatedAt','getTeams','Team','addTeams','ids','findAll','Agents','voicePause','interface','flatMap','sequelize','transaction','findOrCreate','removeTeams','select','tq.TeamId','team_has_whatsapp_queues','user_has_teams','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','includes','all','value','removeAgents','forEach','emit','userWhatsappQueue:remove','addAgents','omit','spread','userWhatsappQueue:save','isArray','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','save','update','then','destroy','get','WhatsappQueues','UserProfileResource','error','name'];(function(_0x1dfc4a,_0x5f34f8){var _0x42e577=function(_0x237a47){while(--_0x237a47){_0x1dfc4a['push'](_0x1dfc4a['shift']());}};_0x42e577(++_0x5f34f8);}(_0x1c30,0x169));var _0x01c3=function(_0x2bddf9,_0x22c873){_0x2bddf9=_0x2bddf9-0x0;var _0x3f3ae9=_0x1c30[_0x2bddf9];return _0x3f3ae9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x01c3('0x0'));var zipdir=require(_0x01c3('0x1'));var jsonpatch=require(_0x01c3('0x2'));var rp=require(_0x01c3('0x3'));var moment=require(_0x01c3('0x4'));var BPromise=require(_0x01c3('0x5'));var Mustache=require(_0x01c3('0x6'));var util=require(_0x01c3('0x7'));var path=require(_0x01c3('0x8'));var sox=require('sox');var csv=require(_0x01c3('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x01c3('0xa'));var _=require(_0x01c3('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x01c3('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x01c3('0x9'));var querystring=require('querystring');var Papa=require(_0x01c3('0xd'));var Redis=require(_0x01c3('0xe'));var authService=require(_0x01c3('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x01c3('0x10'));var hardwareService=require(_0x01c3('0x11'));var logger=require('../../config/logger')(_0x01c3('0x12'));var utils=require(_0x01c3('0x13'));var config=require(_0x01c3('0x14'));var licenseUtil=require(_0x01c3('0x15'));var db=require(_0x01c3('0x16'))['db'];config[_0x01c3('0x17')]=_[_0x01c3('0x18')](config[_0x01c3('0x17')],{'host':_0x01c3('0x19'),'port':0x18eb});var socket=require(_0x01c3('0x1a'))(new Redis(config['redis']));require('./whatsappQueue.socket')[_0x01c3('0x1b')](socket);function respondWithStatusCode(_0x4fcf28,_0x2164fb){_0x2164fb=_0x2164fb||0xcc;return function(_0x1324b4){if(_0x1324b4){return _0x4fcf28[_0x01c3('0x1c')](_0x2164fb);}return _0x4fcf28[_0x01c3('0x1d')](_0x2164fb)[_0x01c3('0x1e')]();};}function respondWithResult(_0x33ec97,_0x1472cd){_0x1472cd=_0x1472cd||0xc8;return function(_0x13e227){if(_0x13e227){return _0x33ec97[_0x01c3('0x1d')](_0x1472cd)[_0x01c3('0x1f')](_0x13e227);}};}function respondWithFilteredResult(_0x3f84cd,_0x2b1bb3){return function(_0x5bdc7a){if(_0x5bdc7a){var _0x2484a6=typeof _0x2b1bb3[_0x01c3('0x20')]===_0x01c3('0x21')&&typeof _0x2b1bb3[_0x01c3('0x22')]==='undefined';var _0x4c67ec=_0x5bdc7a[_0x01c3('0x23')];var _0x42b5a8=_0x2484a6?0x0:_0x2b1bb3[_0x01c3('0x20')];var _0x150799=_0x2484a6?_0x5bdc7a['count']:_0x2b1bb3[_0x01c3('0x20')]+_0x2b1bb3[_0x01c3('0x22')];var _0x387ea3;if(_0x150799>=_0x4c67ec){_0x150799=_0x4c67ec;_0x387ea3=0xc8;}else{_0x387ea3=0xce;}_0x3f84cd[_0x01c3('0x1d')](_0x387ea3);return _0x3f84cd[_0x01c3('0x24')]('Content-Range',_0x42b5a8+'-'+_0x150799+'/'+_0x4c67ec)[_0x01c3('0x1f')](_0x5bdc7a);}return null;};}function patchUpdates(_0x1d89fb){return function(_0xf529d2){try{jsonpatch['apply'](_0xf529d2,_0x1d89fb,!![]);}catch(_0x42f560){return BPromise[_0x01c3('0x25')](_0x42f560);}return _0xf529d2[_0x01c3('0x26')]();};}function saveUpdates(_0x2bd5ac,_0x58256d){return function(_0x1b7339){if(_0x1b7339){return _0x1b7339[_0x01c3('0x27')](_0x2bd5ac)[_0x01c3('0x28')](function(_0x36589a){return _0x36589a;});}return null;};}function removeEntity(_0xce3fa9,_0x53cbdc){return function(_0x4e298d){if(_0x4e298d){return _0x4e298d[_0x01c3('0x29')]()[_0x01c3('0x28')](function(){var _0x1478a3=_0x4e298d[_0x01c3('0x2a')]({'plain':!![]});var _0x10583d=_0x01c3('0x2b');return db[_0x01c3('0x2c')][_0x01c3('0x29')]({'where':{'type':_0x10583d,'resourceId':_0x1478a3['id']}})['then'](function(){return _0x4e298d;});})[_0x01c3('0x28')](function(){_0xce3fa9[_0x01c3('0x1d')](0xcc)[_0x01c3('0x1e')]();});}};}function handleEntityNotFound(_0x5cb96e,_0x2d66bc){return function(_0x14366c){if(!_0x14366c){_0x5cb96e[_0x01c3('0x1c')](0x194);}return _0x14366c;};}function handleError(_0x1c4e70,_0x5dc4b7){_0x5dc4b7=_0x5dc4b7||0x1f4;return function(_0x2ea5fc){logger[_0x01c3('0x2d')](_0x2ea5fc['stack']);if(_0x2ea5fc[_0x01c3('0x2e')]){delete _0x2ea5fc[_0x01c3('0x2e')];}_0x1c4e70[_0x01c3('0x1d')](_0x5dc4b7)[_0x01c3('0x2f')](_0x2ea5fc);};}exports[_0x01c3('0x30')]=function(_0xb41115,_0x590399){var _0xae520d={},_0x3357d2={},_0x406d12={'count':0x0,'rows':[]};var _0x20fe5e=_['map'](db['WhatsappQueue'][_0x01c3('0x31')],function(_0x5b1d07){return{'name':_0x5b1d07['fieldName'],'type':_0x5b1d07['type'][_0x01c3('0x32')]};});_0x3357d2[_0x01c3('0x33')]=_[_0x01c3('0x34')](_0x20fe5e,_0x01c3('0x2e'));_0x3357d2[_0x01c3('0x35')]=_[_0x01c3('0x36')](_0xb41115['query']);_0x3357d2['filters']=_[_0x01c3('0x37')](_0x3357d2[_0x01c3('0x33')],_0x3357d2['query']);_0xae520d[_0x01c3('0x38')]=_[_0x01c3('0x37')](_0x3357d2[_0x01c3('0x33')],qs[_0x01c3('0x39')](_0xb41115['query']['fields']));_0xae520d['attributes']=_0xae520d[_0x01c3('0x38')][_0x01c3('0x3a')]?_0xae520d[_0x01c3('0x38')]:_0x3357d2['model'];if(!_0xb41115[_0x01c3('0x35')][_0x01c3('0x3b')]('nolimit')){_0xae520d['limit']=qs[_0x01c3('0x22')](_0xb41115[_0x01c3('0x35')][_0x01c3('0x22')]);_0xae520d[_0x01c3('0x20')]=qs[_0x01c3('0x20')](_0xb41115[_0x01c3('0x35')][_0x01c3('0x20')]);}_0xae520d['order']=qs[_0x01c3('0x3c')](_0xb41115[_0x01c3('0x35')]['sort']);_0xae520d['where']=qs[_0x01c3('0x3d')](_[_0x01c3('0x3e')](_0xb41115[_0x01c3('0x35')],_0x3357d2['filters']),_0x20fe5e);if(_0xb41115[_0x01c3('0x35')][_0x01c3('0x3f')]){_0xae520d[_0x01c3('0x40')]=_[_0x01c3('0x41')](_0xae520d[_0x01c3('0x40')],{'$or':_[_0x01c3('0x34')](_0x20fe5e,function(_0x3195bf){if(_0x3195bf[_0x01c3('0x42')]!=='VIRTUAL'){var _0x44481f={};_0x44481f[_0x3195bf['name']]={'$like':'%'+_0xb41115[_0x01c3('0x35')][_0x01c3('0x3f')]+'%'};return _0x44481f;}})});}_0xae520d=_[_0x01c3('0x41')]({},_0xae520d,_0xb41115[_0x01c3('0x43')]);var _0x52f978={'where':_0xae520d[_0x01c3('0x40')]};return db[_0x01c3('0x44')][_0x01c3('0x23')](_0x52f978)['then'](function(_0x4d5752){_0x406d12[_0x01c3('0x23')]=_0x4d5752;if(_0xb41115[_0x01c3('0x35')][_0x01c3('0x45')]){_0xae520d[_0x01c3('0x46')]=[{'all':!![]}];}return db[_0x01c3('0x44')]['findAll'](_0xae520d);})[_0x01c3('0x28')](function(_0x5c557a){_0x406d12[_0x01c3('0x47')]=_0x5c557a;return _0x406d12;})[_0x01c3('0x28')](respondWithFilteredResult(_0x590399,_0xae520d))['catch'](handleError(_0x590399,null));};exports[_0x01c3('0x48')]=function(_0x301360,_0x35aa8b){var _0x80528={'raw':!![],'where':{'id':_0x301360['params']['id']}},_0x2db5b9={};_0x2db5b9['model']=_[_0x01c3('0x36')](db[_0x01c3('0x44')][_0x01c3('0x31')]);_0x2db5b9[_0x01c3('0x35')]=_['keys'](_0x301360[_0x01c3('0x35')]);_0x2db5b9['filters']=_[_0x01c3('0x37')](_0x2db5b9[_0x01c3('0x33')],_0x2db5b9[_0x01c3('0x35')]);_0x80528[_0x01c3('0x38')]=_[_0x01c3('0x37')](_0x2db5b9[_0x01c3('0x33')],qs[_0x01c3('0x39')](_0x301360[_0x01c3('0x35')]['fields']));_0x80528[_0x01c3('0x38')]=_0x80528['attributes'][_0x01c3('0x3a')]?_0x80528[_0x01c3('0x38')]:_0x2db5b9[_0x01c3('0x33')];if(_0x301360['query'][_0x01c3('0x45')]){_0x80528[_0x01c3('0x46')]=[{'all':!![]}];}_0x80528=_['merge']({},_0x80528,_0x301360[_0x01c3('0x43')]);return db[_0x01c3('0x44')]['find'](_0x80528)[_0x01c3('0x28')](handleEntityNotFound(_0x35aa8b,null))[_0x01c3('0x28')](respondWithResult(_0x35aa8b,null))[_0x01c3('0x49')](handleError(_0x35aa8b,null));};exports[_0x01c3('0x4a')]=function(_0x5a3bc2,_0x36cc7b){return db['WhatsappQueue'][_0x01c3('0x4a')](_0x5a3bc2[_0x01c3('0x4b')],{})['then'](function(_0x137d24){var _0x58fa9b=_0x5a3bc2[_0x01c3('0x4c')][_0x01c3('0x2a')]({'plain':!![]});if(!_0x58fa9b)throw new Error(_0x01c3('0x4d'));if(_0x58fa9b['role']===_0x01c3('0x4c')){var _0x89f064=_0x137d24[_0x01c3('0x2a')]({'plain':!![]});var _0x5a34d7=_0x01c3('0x2b');return db[_0x01c3('0x4e')]['find']({'where':{'name':_0x5a34d7,'userProfileId':_0x58fa9b[_0x01c3('0x4f')]},'raw':!![]})[_0x01c3('0x28')](function(_0x3bf790){if(_0x3bf790&&_0x3bf790[_0x01c3('0x50')]===0x0){return db[_0x01c3('0x2c')][_0x01c3('0x4a')]({'name':_0x89f064[_0x01c3('0x2e')],'resourceId':_0x89f064['id'],'type':_0x3bf790[_0x01c3('0x2e')],'sectionId':_0x3bf790['id']},{})[_0x01c3('0x28')](function(){return _0x137d24;});}else{return _0x137d24;}})[_0x01c3('0x49')](function(_0x2a9c8a){logger['error'](_0x01c3('0x51'),_0x2a9c8a);throw _0x2a9c8a;});}return _0x137d24;})[_0x01c3('0x28')](respondWithResult(_0x36cc7b,0xc9))['catch'](handleError(_0x36cc7b,null));};exports['update']=function(_0x127725,_0x5dd609){if(_0x127725[_0x01c3('0x4b')]['id']){delete _0x127725['body']['id'];}return db[_0x01c3('0x44')][_0x01c3('0x52')]({'where':{'id':_0x127725['params']['id']}})[_0x01c3('0x28')](handleEntityNotFound(_0x5dd609,null))[_0x01c3('0x28')](saveUpdates(_0x127725['body'],null))[_0x01c3('0x28')](respondWithResult(_0x5dd609,null))['catch'](handleError(_0x5dd609,null));};exports[_0x01c3('0x29')]=function(_0x462fc5,_0x2ae33b){return db[_0x01c3('0x44')]['find']({'where':{'id':_0x462fc5[_0x01c3('0x53')]['id']}})[_0x01c3('0x28')](handleEntityNotFound(_0x2ae33b,null))[_0x01c3('0x28')](removeEntity(_0x2ae33b,null))[_0x01c3('0x49')](handleError(_0x2ae33b,null));};exports[_0x01c3('0x54')]=function(_0x556387,_0x2d38e1){return db[_0x01c3('0x44')][_0x01c3('0x54')]()[_0x01c3('0x28')](respondWithResult(_0x2d38e1,null))['catch'](handleError(_0x2d38e1,null));};exports[_0x01c3('0x55')]=function(_0x4aa39c,_0x3537cc,_0x44e257){var _0x3b846a={'raw':!![],'where':{}},_0x175f21={},_0x1eb475;return db[_0x01c3('0x44')][_0x01c3('0x56')]({'where':{'id':_0x4aa39c[_0x01c3('0x53')]['id']}})[_0x01c3('0x28')](handleEntityNotFound(_0x3537cc,null))[_0x01c3('0x28')](function(_0x149765){if(_0x149765){_0x1eb475=_0x149765[_0x01c3('0x2a')]({'plain':!![]});_0x175f21[_0x01c3('0x33')]=_[_0x01c3('0x36')](db['UserWhatsappQueue']['rawAttributes']);_0x175f21[_0x01c3('0x35')]=_[_0x01c3('0x36')](_0x4aa39c[_0x01c3('0x35')]);_0x175f21['filters']=_[_0x01c3('0x37')](_0x175f21[_0x01c3('0x33')],_0x175f21[_0x01c3('0x35')]);_0x3b846a[_0x01c3('0x38')]=_[_0x01c3('0x37')](_0x175f21['model'],qs[_0x01c3('0x39')](_0x4aa39c[_0x01c3('0x35')]['fields']));_0x3b846a[_0x01c3('0x38')]=_0x3b846a[_0x01c3('0x38')][_0x01c3('0x3a')]?_0x3b846a[_0x01c3('0x38')]:_0x175f21[_0x01c3('0x33')];if(!_0x4aa39c[_0x01c3('0x35')][_0x01c3('0x3b')](_0x01c3('0x57'))){_0x3b846a[_0x01c3('0x22')]=qs[_0x01c3('0x22')](_0x4aa39c['query']['limit']);_0x3b846a[_0x01c3('0x20')]=qs[_0x01c3('0x20')](_0x4aa39c[_0x01c3('0x35')][_0x01c3('0x20')]);}_0x3b846a[_0x01c3('0x58')]=qs[_0x01c3('0x3c')](_0x4aa39c[_0x01c3('0x35')]['sort']);_0x3b846a['where']=qs[_0x01c3('0x3d')](_[_0x01c3('0x3e')](_0x4aa39c[_0x01c3('0x35')],_0x175f21['filters']));_0x3b846a[_0x01c3('0x40')][_0x01c3('0x59')]=_0x149765['id'];if(_0x4aa39c[_0x01c3('0x35')][_0x01c3('0x3f')]){_0x3b846a[_0x01c3('0x40')]=_[_0x01c3('0x41')](_0x3b846a[_0x01c3('0x40')],{'$or':_['map'](_0x3b846a['attributes'],function(_0x4c7f5d){var _0x36b160={};_0x36b160[_0x4c7f5d]={'$like':'%'+_0x4aa39c[_0x01c3('0x35')][_0x01c3('0x3f')]+'%'};return _0x36b160;})});}_0x3b846a=_[_0x01c3('0x41')]({},_0x3b846a,_0x4aa39c[_0x01c3('0x43')]);return db[_0x01c3('0x5a')]['findAll'](_0x3b846a);}})[_0x01c3('0x28')](function(_0x233911){if(_0x233911){return db[_0x01c3('0x5b')][_0x01c3('0x5c')]({'where':{'id':_[_0x01c3('0x34')](_0x233911,'UserId'),'role':_0x01c3('0x5d')},'attributes':['id','name',_0x01c3('0x5e'),'updatedAt',_0x01c3('0x5f')]});}})['then'](function(_0x3a2144){if(_0x3a2144){return{'count':_0x3a2144['count'],'rows':_[_0x01c3('0x34')](_0x3a2144[_0x01c3('0x47')],function(_0x4be673){return{'membername':_0x4be673['name'],'UserId':_0x4be673['id'],'queue_name':_0x1eb475[_0x01c3('0x2e')],'WhatsappQueueId':_0x1eb475['id'],'interface':util['format'](_0x01c3('0x60'),_0x01c3('0x61'),_0x4be673['name']),'penalty':0x0,'paused':_0x4be673[_0x01c3('0x5e')],'createdAt':_0x4be673[_0x01c3('0x5f')],'updatedAt':_0x4be673[_0x01c3('0x62')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x3537cc,_0x3b846a))[_0x01c3('0x49')](handleError(_0x3537cc,null));};exports[_0x01c3('0x63')]=function(_0x141293,_0x43af54,_0x46ffa6){var _0x1e6dda={};var _0x4cc44b={};var _0x23b55b;var _0x3b8feb;return db[_0x01c3('0x44')]['findOne']({'where':{'id':_0x141293[_0x01c3('0x53')]['id']}})[_0x01c3('0x28')](handleEntityNotFound(_0x43af54,null))[_0x01c3('0x28')](function(_0x150ee1){if(_0x150ee1){_0x23b55b=_0x150ee1;_0x4cc44b['model']=_[_0x01c3('0x36')](db[_0x01c3('0x64')][_0x01c3('0x31')]);_0x4cc44b[_0x01c3('0x35')]=_[_0x01c3('0x36')](_0x141293[_0x01c3('0x35')]);_0x4cc44b[_0x01c3('0x3d')]=_[_0x01c3('0x37')](_0x4cc44b['model'],_0x4cc44b[_0x01c3('0x35')]);_0x1e6dda[_0x01c3('0x38')]=_[_0x01c3('0x37')](_0x4cc44b[_0x01c3('0x33')],qs['fields'](_0x141293['query'][_0x01c3('0x39')]));_0x1e6dda['attributes']=_0x1e6dda[_0x01c3('0x38')]['length']?_0x1e6dda[_0x01c3('0x38')]:_0x4cc44b[_0x01c3('0x33')];_0x1e6dda[_0x01c3('0x58')]=qs[_0x01c3('0x3c')](_0x141293[_0x01c3('0x35')][_0x01c3('0x3c')]);_0x1e6dda['where']=qs[_0x01c3('0x3d')](_['pick'](_0x141293[_0x01c3('0x35')],_0x4cc44b[_0x01c3('0x3d')]));if(_0x141293[_0x01c3('0x35')]['filter']){_0x1e6dda[_0x01c3('0x40')]=_['merge'](_0x1e6dda[_0x01c3('0x40')],{'$or':_['map'](_0x1e6dda[_0x01c3('0x38')],function(_0x2d1fa6){var _0x5a4f19={};_0x5a4f19[_0x2d1fa6]={'$like':'%'+_0x141293[_0x01c3('0x35')]['filter']+'%'};return _0x5a4f19;})});}_0x1e6dda=_[_0x01c3('0x41')]({},_0x1e6dda,_0x141293[_0x01c3('0x43')]);return _0x23b55b[_0x01c3('0x63')](_0x1e6dda);}})[_0x01c3('0x28')](function(_0x1f8adc){if(_0x1f8adc){_0x3b8feb=_0x1f8adc[_0x01c3('0x3a')];if(!_0x141293['query']['hasOwnProperty'](_0x01c3('0x57'))){_0x1e6dda[_0x01c3('0x22')]=qs['limit'](_0x141293[_0x01c3('0x35')]['limit']);_0x1e6dda[_0x01c3('0x20')]=qs['offset'](_0x141293[_0x01c3('0x35')][_0x01c3('0x20')]);}return _0x23b55b[_0x01c3('0x63')](_0x1e6dda);}})['then'](function(_0x342b89){if(_0x342b89){return _0x342b89?{'count':_0x3b8feb,'rows':_0x342b89}:null;}})[_0x01c3('0x28')](respondWithResult(_0x43af54,null))[_0x01c3('0x49')](handleError(_0x43af54,null));};exports[_0x01c3('0x65')]=function(_0x49d072,_0x188750,_0x33e3f3){var _0xc2dcab=_0x49d072[_0x01c3('0x4b')][_0x01c3('0x66')];return db['Team'][_0x01c3('0x67')]({'where':{'id':_0xc2dcab},'attributes':['id'],'include':[{'model':db['User'],'as':_0x01c3('0x68'),'attributes':['id',_0x01c3('0x2e'),'online',_0x01c3('0x69'),_0x01c3('0x6a')],'raw':!![]}]})[_0x01c3('0x28')](function(_0x157939){if(_0x157939){var _0x172308=_[_0x01c3('0x6b')](_0x157939,function(_0xc10ec1){var _0x4b361e=_0xc10ec1[_0x01c3('0x2a')]({'plain':!![]});return _0x4b361e[_0x01c3('0x68')];});return db[_0x01c3('0x44')][_0x01c3('0x52')]({'where':{'id':_0x49d072[_0x01c3('0x53')]['id']}})[_0x01c3('0x28')](function(_0x124f52){return db[_0x01c3('0x6c')][_0x01c3('0x6d')](function(_0x1ff7b6){return _0x124f52[_0x01c3('0x65')](_0xc2dcab,{'transaction':_0x1ff7b6})[_0x01c3('0x28')](function(){return BPromise['each'](_0x172308,function(_0x36f561){return db[_0x01c3('0x5a')][_0x01c3('0x6e')]({'where':{'UserId':_0x36f561['id'],'WhatsappQueueId':_0x49d072[_0x01c3('0x53')]['id']},'transaction':_0x1ff7b6});});})[_0x01c3('0x28')](function(){_0x172308['forEach'](function(_0x1c3dad){socket['emit']('userWhatsappQueue:save',{'UserId':_0x1c3dad['id'],'WhatsappQueueId':_0x124f52['id']});});});});});}})[_0x01c3('0x28')](respondWithStatusCode(_0x188750,null))['catch'](handleError(_0x188750,null));};exports[_0x01c3('0x6f')]=function(_0x35b714,_0xf7633e,_0x25d2fd){return db[_0x01c3('0x64')][_0x01c3('0x67')]({'where':{'id':_0x35b714[_0x01c3('0x35')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0x01c3('0x68'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0xf7633e,null))[_0x01c3('0x28')](function(_0x3bc7fb){var _0x14fcc0=_[_0x01c3('0x34')](_0x3bc7fb,'id');var _0x48f70c=[];var _0x2c152c=[];var _0x17dd52=squel[_0x01c3('0x70')]();_0x17dd52['field'](_0x01c3('0x71'))['from'](_0x01c3('0x72'),'tq')['join'](_0x01c3('0x73'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x01c3('0x40')](_0x01c3('0x74'),_0x35b714[_0x01c3('0x53')]['id']);for(var _0x443d86=0x0;_0x443d86<_0x3bc7fb[_0x01c3('0x3a')];_0x443d86+=0x1){let _0x2721b5=_0x3bc7fb[_0x443d86];for(var _0x3c3625=0x0;_0x3c3625<_0x2721b5[_0x01c3('0x68')][_0x01c3('0x3a')];_0x3c3625+=0x1){let _0x342cc7=_0x2721b5[_0x01c3('0x68')][_0x3c3625];var _0x5f2dec=_0x17dd52[_0x01c3('0x75')]();_0x5f2dec[_0x01c3('0x40')](_0x01c3('0x76'),_0x342cc7['id']);_0x2c152c['push'](db['sequelize'][_0x01c3('0x35')](_0x5f2dec[_0x01c3('0x77')](),{'type':db['sequelize'][_0x01c3('0x78')][_0x01c3('0x79')]})[_0x01c3('0x28')](function(_0x3b348a){if(_0x3b348a[_0x01c3('0x3a')]===0x1){return _0x342cc7['id'];}else{var _0x136047=_[_0x01c3('0x7a')](_[_0x01c3('0x34')](_0x3b348a,'TeamId'),function(_0x138e69){return _[_0x01c3('0x7b')](_0x14fcc0,_0x138e69);});if(_0x136047){return _0x342cc7['id'];}}}));}}return BPromise[_0x01c3('0x7c')](_0x2c152c)[_0x01c3('0x28')](function(_0x2c5111){_0x48f70c=_(_0x48f70c)['union'](_0x2c5111)['compact']()[_0x01c3('0x7d')]();return db[_0x01c3('0x44')][_0x01c3('0x52')]({'where':{'id':_0x35b714[_0x01c3('0x53')]['id']}})[_0x01c3('0x28')](function(_0x442405){return db[_0x01c3('0x6c')][_0x01c3('0x6d')](function(_0x22e18d){return _0x442405[_0x01c3('0x6f')](_0x35b714['query'][_0x01c3('0x66')],{'transaction':_0x22e18d})[_0x01c3('0x28')](function(){if(!_['isEmpty'](_0x48f70c)){return _0x442405[_0x01c3('0x7e')](_0x48f70c,{'transaction':_0x22e18d});}})[_0x01c3('0x28')](function(){_0x48f70c[_0x01c3('0x7f')](function(_0x49f65f){socket[_0x01c3('0x80')](_0x01c3('0x81'),{'UserId':_0x49f65f,'WhatsappQueueId':_0x442405['id']});});});});});});})[_0x01c3('0x28')](respondWithStatusCode(_0xf7633e,null))['catch'](handleError(_0xf7633e,null));};exports[_0x01c3('0x82')]=function(_0x1441bd,_0x45edbe,_0x245e8c){return db[_0x01c3('0x44')]['find']({'where':{'id':_0x1441bd[_0x01c3('0x53')]['id']}})[_0x01c3('0x28')](handleEntityNotFound(_0x45edbe,null))[_0x01c3('0x28')](function(_0x285f5d){if(_0x285f5d){return _0x285f5d[_0x01c3('0x82')](_0x1441bd[_0x01c3('0x4b')][_0x01c3('0x66')],_[_0x01c3('0x83')](_0x1441bd[_0x01c3('0x4b')],[_0x01c3('0x66'),'id'])||{})[_0x01c3('0x84')](function(_0x5ae805){for(var _0x4e1136=0x0;_0x4e1136<_0x1441bd[_0x01c3('0x4b')][_0x01c3('0x66')][_0x01c3('0x3a')];_0x4e1136+=0x1){socket[_0x01c3('0x80')](_0x01c3('0x85'),{'UserId':Number(_0x1441bd[_0x01c3('0x4b')][_0x01c3('0x66')][_0x4e1136]),'WhatsappQueueId':Number(_0x1441bd['params']['id'])});}return _0x5ae805;});}})[_0x01c3('0x28')](respondWithResult(_0x45edbe,null))[_0x01c3('0x49')](handleError(_0x45edbe,null));};exports['removeAgents']=function(_0x4efa6b,_0x44a20e,_0x4a4b89){return db[_0x01c3('0x44')][_0x01c3('0x52')]({'where':{'id':_0x4efa6b[_0x01c3('0x53')]['id']}})['then'](handleEntityNotFound(_0x44a20e,null))[_0x01c3('0x28')](function(_0x8b1f59){if(_0x8b1f59){return _0x8b1f59[_0x01c3('0x7e')](_0x4efa6b[_0x01c3('0x35')][_0x01c3('0x66')])[_0x01c3('0x28')](function(){if(_[_0x01c3('0x86')](_0x4efa6b['query'][_0x01c3('0x66')])){for(var _0x465670=0x0;_0x465670<_0x4efa6b[_0x01c3('0x35')][_0x01c3('0x66')][_0x01c3('0x3a')];_0x465670+=0x1){socket['emit'](_0x01c3('0x81'),{'UserId':Number(_0x4efa6b[_0x01c3('0x35')][_0x01c3('0x66')][_0x465670]),'WhatsappQueueId':Number(_0x4efa6b[_0x01c3('0x53')]['id'])});}}else{socket[_0x01c3('0x80')](_0x01c3('0x81'),{'UserId':Number(_0x4efa6b[_0x01c3('0x35')][_0x01c3('0x66')]),'WhatsappQueueId':Number(_0x4efa6b[_0x01c3('0x53')]['id'])});}});}})[_0x01c3('0x28')](respondWithStatusCode(_0x44a20e,null))[_0x01c3('0x49')](handleError(_0x44a20e,null));};exports[_0x01c3('0x87')]=function(_0xb3bbe6,_0x1d2780,_0x14ac96){var _0x205f43={};var _0x24083a={};var _0x3546a5;var _0x2aaee8;return db[_0x01c3('0x44')][_0x01c3('0x56')]({'where':{'id':_0xb3bbe6['params']['id']}})[_0x01c3('0x28')](handleEntityNotFound(_0x1d2780,null))[_0x01c3('0x28')](function(_0x15e9c7){if(_0x15e9c7){_0x3546a5=_0x15e9c7;_0x24083a['model']=_[_0x01c3('0x36')](db[_0x01c3('0x5b')][_0x01c3('0x31')]);_0x24083a['query']=_[_0x01c3('0x36')](_0xb3bbe6[_0x01c3('0x35')]);_0x24083a[_0x01c3('0x3d')]=_[_0x01c3('0x37')](_0x24083a['model'],_0x24083a[_0x01c3('0x35')]);_0x205f43[_0x01c3('0x38')]=_['intersection'](_0x24083a[_0x01c3('0x33')],qs[_0x01c3('0x39')](_0xb3bbe6[_0x01c3('0x35')][_0x01c3('0x39')]));_0x205f43[_0x01c3('0x38')]=_0x205f43[_0x01c3('0x38')][_0x01c3('0x3a')]?_0x205f43[_0x01c3('0x38')]:_0x24083a['model'];_0x205f43['order']=qs[_0x01c3('0x3c')](_0xb3bbe6['query'][_0x01c3('0x3c')]);_0x205f43['where']=qs[_0x01c3('0x3d')](_['pick'](_0xb3bbe6['query'],_0x24083a[_0x01c3('0x3d')]));if(_0xb3bbe6[_0x01c3('0x35')][_0x01c3('0x3f')]){_0x205f43[_0x01c3('0x40')]=_[_0x01c3('0x41')](_0x205f43[_0x01c3('0x40')],{'$or':_[_0x01c3('0x34')](_0x205f43['attributes'],function(_0x5c0fda){var _0x3f4cd7={};_0x3f4cd7[_0x5c0fda]={'$like':'%'+_0xb3bbe6[_0x01c3('0x35')][_0x01c3('0x3f')]+'%'};return _0x3f4cd7;})});}_0x205f43=_['merge']({},_0x205f43,_0xb3bbe6[_0x01c3('0x43')]);return _0x3546a5['getAgents'](_0x205f43);}})[_0x01c3('0x28')](function(_0x27bed7){if(_0x27bed7){_0x2aaee8=_0x27bed7['length'];if(!_0xb3bbe6[_0x01c3('0x35')][_0x01c3('0x3b')]('nolimit')){_0x205f43['limit']=qs[_0x01c3('0x22')](_0xb3bbe6[_0x01c3('0x35')]['limit']);_0x205f43[_0x01c3('0x20')]=qs[_0x01c3('0x20')](_0xb3bbe6[_0x01c3('0x35')][_0x01c3('0x20')]);}return _0x3546a5[_0x01c3('0x87')](_0x205f43);}})[_0x01c3('0x28')](function(_0x3893b7){if(_0x3893b7){return _0x3893b7?{'count':_0x2aaee8,'rows':_0x3893b7}:null;}})[_0x01c3('0x28')](respondWithResult(_0x1d2780,null))[_0x01c3('0x49')](handleError(_0x1d2780,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index 69a6f17..beb0c8e 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 _0xa1e3=['save','hasOwnProperty','events','../../mysqldb','WhatsappQueue','setMaxListeners'];(function(_0x56ba92,_0xb3c986){var _0x8fe94d=function(_0x23b21c){while(--_0x23b21c){_0x56ba92['push'](_0x56ba92['shift']());}};_0x8fe94d(++_0xb3c986);}(_0xa1e3,0x1a0));var _0x3a1e=function(_0x3361be,_0x544435){_0x3361be=_0x3361be-0x0;var _0x39114e=_0xa1e3[_0x3361be];return _0x39114e;};'use strict';var EventEmitter=require(_0x3a1e('0x0'));var WhatsappQueue=require(_0x3a1e('0x1'))['db'][_0x3a1e('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x3a1e('0x3')](0x0);var events={'afterCreate':_0x3a1e('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x42bdad){return function(_0x5e36b1,_0x137d90,_0x1d717a){WhatsappQueueEvents['emit'](_0x42bdad+':'+_0x5e36b1['id'],_0x5e36b1);WhatsappQueueEvents['emit'](_0x42bdad,_0x5e36b1);_0x1d717a(null);};}for(var e in events){if(events[_0x3a1e('0x5')](e)){var event=events[e];WhatsappQueue['hook'](e,emitEvent(event));}}module['exports']=WhatsappQueueEvents; \ No newline at end of file +var _0x7cf4=['WhatsappQueue','setMaxListeners','update','emit','hook','exports'];(function(_0x233dc0,_0x2866ad){var _0x1fc160=function(_0x51e38b){while(--_0x51e38b){_0x233dc0['push'](_0x233dc0['shift']());}};_0x1fc160(++_0x2866ad);}(_0x7cf4,0xfc));var _0x47cf=function(_0x12f80b,_0x468148){_0x12f80b=_0x12f80b-0x0;var _0x6b7d77=_0x7cf4[_0x12f80b];return _0x6b7d77;};'use strict';var EventEmitter=require('events');var WhatsappQueue=require('../../mysqldb')['db'][_0x47cf('0x0')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x47cf('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x47cf('0x2'),'afterDestroy':'remove'};function emitEvent(_0xfdf46a){return function(_0x3fd660,_0x443862,_0x26e581){WhatsappQueueEvents[_0x47cf('0x3')](_0xfdf46a+':'+_0x3fd660['id'],_0x3fd660);WhatsappQueueEvents['emit'](_0xfdf46a,_0x3fd660);_0x26e581(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappQueue[_0x47cf('0x4')](e,emitEvent(event));}}module[_0x47cf('0x5')]=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index 5089aeb..bec83e9 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 _0xcd28=['path','rimraf','../../config/environment','./whatsappQueue.attributes','exports','define','whatsapp_queues','lodash','util','moment','request-promise'];(function(_0x4d6bfd,_0x8d79ff){var _0x243a46=function(_0x3883b1){while(--_0x3883b1){_0x4d6bfd['push'](_0x4d6bfd['shift']());}};_0x243a46(++_0x8d79ff);}(_0xcd28,0xf9));var _0x8cd2=function(_0xc2d782,_0x4a54bb){_0xc2d782=_0xc2d782-0x0;var _0x4fc670=_0xcd28[_0xc2d782];return _0x4fc670;};'use strict';var _=require(_0x8cd2('0x0'));var util=require(_0x8cd2('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x8cd2('0x2'));var BPromise=require('bluebird');var rp=require(_0x8cd2('0x3'));var fs=require('fs');var path=require(_0x8cd2('0x4'));var rimraf=require(_0x8cd2('0x5'));var config=require(_0x8cd2('0x6'));var attributes=require(_0x8cd2('0x7'));module[_0x8cd2('0x8')]=function(_0x3e44c8,_0x210fee){return _0x3e44c8[_0x8cd2('0x9')]('WhatsappQueue',attributes,{'tableName':_0x8cd2('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaa5e=['path','rimraf','./whatsappQueue.attributes','define','whatsapp_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x233578,_0x104907){var _0x5e29e3=function(_0x5697bb){while(--_0x5697bb){_0x233578['push'](_0x233578['shift']());}};_0x5e29e3(++_0x104907);}(_0xaa5e,0xb9));var _0xeaa5=function(_0x2846e1,_0x54483f){_0x2846e1=_0x2846e1-0x0;var _0x19583e=_0xaa5e[_0x2846e1];return _0x19583e;};'use strict';var _=require(_0xeaa5('0x0'));var util=require(_0xeaa5('0x1'));var logger=require(_0xeaa5('0x2'))(_0xeaa5('0x3'));var moment=require(_0xeaa5('0x4'));var BPromise=require(_0xeaa5('0x5'));var rp=require(_0xeaa5('0x6'));var fs=require('fs');var path=require(_0xeaa5('0x7'));var rimraf=require(_0xeaa5('0x8'));var config=require('../../config/environment');var attributes=require(_0xeaa5('0x9'));module['exports']=function(_0x3ed9e2,_0x132280){return _0x3ed9e2[_0xeaa5('0xa')]('WhatsappQueue',attributes,{'tableName':_0xeaa5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.rpc.js b/server/api/whatsappQueue/whatsappQueue.rpc.js index deb993a..22f0e93 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 _0x2128=['catch','GetWhatsappQueue','findAll','options','raw','attributes','limit','include','map','model','WhatsappQueue','find','where','ShowWhatsappQueue','util','moment','bluebird','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','redis','defaults','socket.io-emitter','register','request','then','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x2128,0x83));var _0x8212=function(_0x458b97,_0x24d421){_0x458b97=_0x458b97-0x0;var _0x3f42e3=_0x2128[_0x458b97];return _0x3f42e3;};'use strict';var _=require('lodash');var util=require(_0x8212('0x0'));var moment=require(_0x8212('0x1'));var BPromise=require(_0x8212('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8212('0x3'))['db'];var utils=require(_0x8212('0x4'));var logger=require('../../config/logger')(_0x8212('0x5'));var config=require('../../config/environment');var jayson=require(_0x8212('0x6'));var client=jayson[_0x8212('0x7')][_0x8212('0x8')]({'port':0x232a});config[_0x8212('0x9')]=_[_0x8212('0xa')](config[_0x8212('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x8212('0xb'))(new Redis(config[_0x8212('0x9')]));require('./whatsappQueue.socket')[_0x8212('0xc')](socket);function respondWithRpcPromise(_0x2db5,_0x56f3fd,_0x3007aa){return new BPromise(function(_0x367b90,_0x41d272){return client[_0x8212('0xd')](_0x2db5,_0x3007aa)[_0x8212('0xe')](function(_0x496f68){logger[_0x8212('0xf')](_0x8212('0x10'),_0x56f3fd,_0x8212('0x11'));logger[_0x8212('0x12')](_0x8212('0x13'),_0x56f3fd,_0x8212('0x11'),JSON[_0x8212('0x14')](_0x496f68));if(_0x496f68['error']){if(_0x496f68[_0x8212('0x15')][_0x8212('0x16')]===0x1f4){logger[_0x8212('0x15')](_0x8212('0x10'),_0x56f3fd,_0x496f68[_0x8212('0x15')][_0x8212('0x17')]);return _0x41d272(_0x496f68[_0x8212('0x15')]['message']);}logger[_0x8212('0x15')](_0x8212('0x10'),_0x56f3fd,_0x496f68[_0x8212('0x15')][_0x8212('0x17')]);return _0x367b90(_0x496f68[_0x8212('0x15')][_0x8212('0x17')]);}else{logger[_0x8212('0xf')](_0x8212('0x10'),_0x56f3fd,_0x8212('0x11'));_0x367b90(_0x496f68[_0x8212('0x18')]['message']);}})[_0x8212('0x19')](function(_0xd08924){logger['error'](_0x8212('0x10'),_0x56f3fd,_0xd08924);_0x41d272(_0xd08924);});});}exports[_0x8212('0x1a')]=function(_0x551c38){var _0x2fd133=this;return new Promise(function(_0x599e67,_0x42926f){return db['WhatsappQueue'][_0x8212('0x1b')]({'raw':_0x551c38[_0x8212('0x1c')]?_0x551c38['options'][_0x8212('0x1d')]===undefined?!![]:![]:!![],'where':_0x551c38['options']?_0x551c38[_0x8212('0x1c')]['where']||null:null,'attributes':_0x551c38['options']?_0x551c38[_0x8212('0x1c')][_0x8212('0x1e')]||null:null,'limit':_0x551c38[_0x8212('0x1c')]?_0x551c38[_0x8212('0x1c')][_0x8212('0x1f')]||null:null,'include':_0x551c38[_0x8212('0x1c')]?_0x551c38[_0x8212('0x1c')][_0x8212('0x20')]?_[_0x8212('0x21')](_0x551c38[_0x8212('0x1c')][_0x8212('0x20')],function(_0x434464){return{'model':db[_0x434464[_0x8212('0x22')]],'as':_0x434464['as'],'attributes':_0x434464[_0x8212('0x1e')],'include':_0x434464[_0x8212('0x20')]?_[_0x8212('0x21')](_0x434464['include'],function(_0x341a72){return{'model':db[_0x341a72['model']],'as':_0x341a72['as'],'attributes':_0x341a72[_0x8212('0x1e')],'include':_0x341a72[_0x8212('0x20')]?_[_0x8212('0x21')](_0x341a72[_0x8212('0x20')],function(_0x42ee5a){return{'model':db[_0x42ee5a[_0x8212('0x22')]],'as':_0x42ee5a['as'],'attributes':_0x42ee5a['attributes']};}):[]};}):[]};}):[]:[]})[_0x8212('0xe')](function(_0x1701ac){logger['info'](_0x8212('0x1a'),_0x551c38);logger[_0x8212('0x12')](_0x8212('0x1a'),_0x551c38,JSON['stringify'](_0x1701ac));_0x599e67(_0x1701ac);})['catch'](function(_0x4e6e83){logger[_0x8212('0x15')](_0x8212('0x1a'),_0x4e6e83['message'],_0x551c38);_0x42926f(_0x2fd133[_0x8212('0x15')](0x1f4,_0x4e6e83[_0x8212('0x17')]));});});};exports['ShowWhatsappQueue']=function(_0x1c2f3c){var _0x2c20b0=this;return new Promise(function(_0x136737,_0x1c0675){return db[_0x8212('0x23')][_0x8212('0x24')]({'raw':_0x1c2f3c['options']?_0x1c2f3c[_0x8212('0x1c')][_0x8212('0x1d')]===undefined?!![]:![]:!![],'where':_0x1c2f3c[_0x8212('0x1c')]?_0x1c2f3c[_0x8212('0x1c')][_0x8212('0x25')]||null:null,'attributes':_0x1c2f3c['options']?_0x1c2f3c['options']['attributes']||null:null,'include':_0x1c2f3c[_0x8212('0x1c')]?_0x1c2f3c['options']['include']?_[_0x8212('0x21')](_0x1c2f3c[_0x8212('0x1c')][_0x8212('0x20')],function(_0x58a2aa){return{'model':db[_0x58a2aa[_0x8212('0x22')]],'as':_0x58a2aa['as'],'attributes':_0x58a2aa[_0x8212('0x1e')],'include':_0x58a2aa['include']?_[_0x8212('0x21')](_0x58a2aa[_0x8212('0x20')],function(_0x534d22){return{'model':db[_0x534d22[_0x8212('0x22')]],'as':_0x534d22['as'],'attributes':_0x534d22['attributes'],'include':_0x534d22['include']?_[_0x8212('0x21')](_0x534d22[_0x8212('0x20')],function(_0x34fc8f){return{'model':db[_0x34fc8f[_0x8212('0x22')]],'as':_0x34fc8f['as'],'attributes':_0x34fc8f[_0x8212('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x8212('0xe')](function(_0x4e25fc){logger[_0x8212('0xf')](_0x8212('0x26'),_0x1c2f3c);logger[_0x8212('0x12')](_0x8212('0x26'),_0x1c2f3c,JSON[_0x8212('0x14')](_0x4e25fc));_0x136737(_0x4e25fc);})[_0x8212('0x19')](function(_0x553aff){logger['error'](_0x8212('0x26'),_0x553aff[_0x8212('0x17')],_0x1c2f3c);_0x1c0675(_0x2c20b0[_0x8212('0x15')](0x1f4,_0x553aff[_0x8212('0x17')]));});});}; \ No newline at end of file +var _0xb47c=['register','request','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','GetWhatsappQueue','WhatsappQueue','findAll','raw','where','attributes','options','include','map','model','then','catch','find','ShowWhatsappQueue','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./whatsappQueue.socket'];(function(_0x2a460a,_0x2a2e15){var _0x222048=function(_0x170cbb){while(--_0x170cbb){_0x2a460a['push'](_0x2a460a['shift']());}};_0x222048(++_0x2a2e15);}(_0xb47c,0x121));var _0xcb47=function(_0x2085f3,_0x50105b){_0x2085f3=_0x2085f3-0x0;var _0x384e3c=_0xb47c[_0x2085f3];return _0x384e3c;};'use strict';var _=require(_0xcb47('0x0'));var util=require(_0xcb47('0x1'));var moment=require(_0xcb47('0x2'));var BPromise=require(_0xcb47('0x3'));var rs=require(_0xcb47('0x4'));var fs=require('fs');var Redis=require(_0xcb47('0x5'));var db=require(_0xcb47('0x6'))['db'];var utils=require(_0xcb47('0x7'));var logger=require(_0xcb47('0x8'))(_0xcb47('0x9'));var config=require(_0xcb47('0xa'));var jayson=require(_0xcb47('0xb'));var client=jayson[_0xcb47('0xc')][_0xcb47('0xd')]({'port':0x232a});config['redis']=_[_0xcb47('0xe')](config[_0xcb47('0xf')],{'host':_0xcb47('0x10'),'port':0x18eb});var socket=require(_0xcb47('0x11'))(new Redis(config[_0xcb47('0xf')]));require(_0xcb47('0x12'))[_0xcb47('0x13')](socket);function respondWithRpcPromise(_0x2aa615,_0x34cfd0,_0x5e8f69){return new BPromise(function(_0x3067cb,_0x11520e){return client[_0xcb47('0x14')](_0x2aa615,_0x5e8f69)['then'](function(_0x510d72){logger[_0xcb47('0x15')](_0xcb47('0x16'),_0x34cfd0,_0xcb47('0x17'));logger[_0xcb47('0x18')](_0xcb47('0x19'),_0x34cfd0,_0xcb47('0x17'),JSON[_0xcb47('0x1a')](_0x510d72));if(_0x510d72['error']){if(_0x510d72[_0xcb47('0x1b')]['code']===0x1f4){logger['error'](_0xcb47('0x16'),_0x34cfd0,_0x510d72[_0xcb47('0x1b')]['message']);return _0x11520e(_0x510d72[_0xcb47('0x1b')][_0xcb47('0x1c')]);}logger[_0xcb47('0x1b')](_0xcb47('0x16'),_0x34cfd0,_0x510d72[_0xcb47('0x1b')][_0xcb47('0x1c')]);return _0x3067cb(_0x510d72['error'][_0xcb47('0x1c')]);}else{logger[_0xcb47('0x15')](_0xcb47('0x16'),_0x34cfd0,_0xcb47('0x17'));_0x3067cb(_0x510d72[_0xcb47('0x1d')][_0xcb47('0x1c')]);}})['catch'](function(_0x370464){logger[_0xcb47('0x1b')]('WhatsappQueue,\x20%s,\x20%s',_0x34cfd0,_0x370464);_0x11520e(_0x370464);});});}exports[_0xcb47('0x1e')]=function(_0x32c7a4){var _0x569f0f=this;return new Promise(function(_0x38cfeb,_0x26ea38){return db[_0xcb47('0x1f')][_0xcb47('0x20')]({'raw':_0x32c7a4['options']?_0x32c7a4['options'][_0xcb47('0x21')]===undefined?!![]:![]:!![],'where':_0x32c7a4['options']?_0x32c7a4['options'][_0xcb47('0x22')]||null:null,'attributes':_0x32c7a4['options']?_0x32c7a4['options'][_0xcb47('0x23')]||null:null,'limit':_0x32c7a4[_0xcb47('0x24')]?_0x32c7a4[_0xcb47('0x24')]['limit']||null:null,'include':_0x32c7a4['options']?_0x32c7a4[_0xcb47('0x24')][_0xcb47('0x25')]?_[_0xcb47('0x26')](_0x32c7a4[_0xcb47('0x24')]['include'],function(_0x52bcf6){return{'model':db[_0x52bcf6[_0xcb47('0x27')]],'as':_0x52bcf6['as'],'attributes':_0x52bcf6[_0xcb47('0x23')],'include':_0x52bcf6['include']?_[_0xcb47('0x26')](_0x52bcf6[_0xcb47('0x25')],function(_0x4639cb){return{'model':db[_0x4639cb['model']],'as':_0x4639cb['as'],'attributes':_0x4639cb[_0xcb47('0x23')],'include':_0x4639cb[_0xcb47('0x25')]?_[_0xcb47('0x26')](_0x4639cb[_0xcb47('0x25')],function(_0x291100){return{'model':db[_0x291100['model']],'as':_0x291100['as'],'attributes':_0x291100[_0xcb47('0x23')]};}):[]};}):[]};}):[]:[]})[_0xcb47('0x28')](function(_0x4c344d){logger[_0xcb47('0x15')](_0xcb47('0x1e'),_0x32c7a4);logger[_0xcb47('0x18')](_0xcb47('0x1e'),_0x32c7a4,JSON[_0xcb47('0x1a')](_0x4c344d));_0x38cfeb(_0x4c344d);})[_0xcb47('0x29')](function(_0xb89d69){logger['error'](_0xcb47('0x1e'),_0xb89d69[_0xcb47('0x1c')],_0x32c7a4);_0x26ea38(_0x569f0f[_0xcb47('0x1b')](0x1f4,_0xb89d69['message']));});});};exports['ShowWhatsappQueue']=function(_0x242e04){var _0x285f06=this;return new Promise(function(_0x38a276,_0x46eac2){return db[_0xcb47('0x1f')][_0xcb47('0x2a')]({'raw':_0x242e04['options']?_0x242e04[_0xcb47('0x24')][_0xcb47('0x21')]===undefined?!![]:![]:!![],'where':_0x242e04['options']?_0x242e04[_0xcb47('0x24')][_0xcb47('0x22')]||null:null,'attributes':_0x242e04[_0xcb47('0x24')]?_0x242e04[_0xcb47('0x24')][_0xcb47('0x23')]||null:null,'include':_0x242e04[_0xcb47('0x24')]?_0x242e04[_0xcb47('0x24')][_0xcb47('0x25')]?_[_0xcb47('0x26')](_0x242e04['options'][_0xcb47('0x25')],function(_0x443d39){return{'model':db[_0x443d39['model']],'as':_0x443d39['as'],'attributes':_0x443d39['attributes'],'include':_0x443d39[_0xcb47('0x25')]?_['map'](_0x443d39[_0xcb47('0x25')],function(_0x43160d){return{'model':db[_0x43160d['model']],'as':_0x43160d['as'],'attributes':_0x43160d[_0xcb47('0x23')],'include':_0x43160d[_0xcb47('0x25')]?_[_0xcb47('0x26')](_0x43160d[_0xcb47('0x25')],function(_0x5a30de){return{'model':db[_0x5a30de[_0xcb47('0x27')]],'as':_0x5a30de['as'],'attributes':_0x5a30de[_0xcb47('0x23')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1a1e45){logger[_0xcb47('0x15')](_0xcb47('0x2b'),_0x242e04);logger['debug'](_0xcb47('0x2b'),_0x242e04,JSON['stringify'](_0x1a1e45));_0x38a276(_0x1a1e45);})[_0xcb47('0x29')](function(_0x1464fe){logger[_0xcb47('0x1b')](_0xcb47('0x2b'),_0x1464fe[_0xcb47('0x1c')],_0x242e04);_0x46eac2(_0x285f06[_0xcb47('0x1b')](0x1f4,_0x1464fe[_0xcb47('0x1c')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index 0334e10..7cb9d24 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 _0xd9b7=['./whatsappQueue.events','save','remove','update','emit','removeListener','register','length'];(function(_0x5ab0fe,_0x11570c){var _0x3742f7=function(_0x1d6d17){while(--_0x1d6d17){_0x5ab0fe['push'](_0x5ab0fe['shift']());}};_0x3742f7(++_0x11570c);}(_0xd9b7,0x1c0));var _0x7d9b=function(_0x379b6d,_0x73a0b3){_0x379b6d=_0x379b6d-0x0;var _0x1eab10=_0xd9b7[_0x379b6d];return _0x1eab10;};'use strict';var WhatsappQueueEvents=require(_0x7d9b('0x0'));var events=[_0x7d9b('0x1'),_0x7d9b('0x2'),_0x7d9b('0x3')];function createListener(_0x1f8051,_0x55d34c){return function(_0x446c18){_0x55d34c[_0x7d9b('0x4')](_0x1f8051,_0x446c18);};}function removeListener(_0x490746,_0x4f4615){return function(){WhatsappQueueEvents[_0x7d9b('0x5')](_0x490746,_0x4f4615);};}exports[_0x7d9b('0x6')]=function(_0x25380b){for(var _0x2fd5d4=0x0,_0x188b58=events[_0x7d9b('0x7')];_0x2fd5d4<_0x188b58;_0x2fd5d4++){var _0x33e5cd=events[_0x2fd5d4];var _0x28cb64=createListener('whatsappQueue:'+_0x33e5cd,_0x25380b);WhatsappQueueEvents['on'](_0x33e5cd,_0x28cb64);}}; \ No newline at end of file +var _0x3fe2=['./whatsappQueue.events','save','update','emit','register','length','whatsappQueue:'];(function(_0x1d9479,_0x278ed3){var _0x52482d=function(_0x57205e){while(--_0x57205e){_0x1d9479['push'](_0x1d9479['shift']());}};_0x52482d(++_0x278ed3);}(_0x3fe2,0x173));var _0x23fe=function(_0x55db0f,_0x475944){_0x55db0f=_0x55db0f-0x0;var _0x5cdb0d=_0x3fe2[_0x55db0f];return _0x5cdb0d;};'use strict';var WhatsappQueueEvents=require(_0x23fe('0x0'));var events=[_0x23fe('0x1'),'remove',_0x23fe('0x2')];function createListener(_0x2b4b73,_0xc7fe35){return function(_0x369d6e){_0xc7fe35[_0x23fe('0x3')](_0x2b4b73,_0x369d6e);};}function removeListener(_0x101756,_0x311468){return function(){WhatsappQueueEvents['removeListener'](_0x101756,_0x311468);};}exports[_0x23fe('0x4')]=function(_0x2cac6e){for(var _0x37b292=0x0,_0x43953c=events[_0x23fe('0x5')];_0x37b292<_0x43953c;_0x37b292++){var _0x5617f9=events[_0x37b292];var _0x3a0c0b=createListener(_0x23fe('0x6')+_0x5617f9,_0x2cac6e);WhatsappQueueEvents['on'](_0x5617f9,_0x3a0c0b);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index 41cb63e..d22689a 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 _0x0e64=['/describe','/:id','show','update','delete','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','isAuthenticated','index','get'];(function(_0x14183a,_0x4e5034){var _0x104704=function(_0x5cbbe4){while(--_0x5cbbe4){_0x14183a['push'](_0x14183a['shift']());}};_0x104704(++_0x4e5034);}(_0x0e64,0x149));var _0x40e6=function(_0x59ae14,_0x21bdef){_0x59ae14=_0x59ae14-0x0;var _0x377a90=_0x0e64[_0x59ae14];return _0x377a90;};'use strict';var multer=require(_0x40e6('0x0'));var util=require(_0x40e6('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x40e6('0x2')]();var fs_extra=require(_0x40e6('0x3'));var auth=require(_0x40e6('0x4'));var interaction=require(_0x40e6('0x5'));var config=require(_0x40e6('0x6'));var controller=require(_0x40e6('0x7'));router['get']('/',auth[_0x40e6('0x8')](),controller[_0x40e6('0x9')]);router[_0x40e6('0xa')](_0x40e6('0xb'),auth[_0x40e6('0x8')](),controller['describe']);router[_0x40e6('0xa')](_0x40e6('0xc'),auth['isAuthenticated'](),controller[_0x40e6('0xd')]);router['post']('/',auth[_0x40e6('0x8')](),controller['create']);router['put']('/:id',auth[_0x40e6('0x8')](),controller[_0x40e6('0xe')]);router[_0x40e6('0xf')](_0x40e6('0xc'),auth[_0x40e6('0x8')](),controller['destroy']);module[_0x40e6('0x10')]=router; \ No newline at end of file +var _0xa185=['create','update','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','/describe','describe','get','/:id','show'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xa185,0xe8));var _0x5a18=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xa185[_0xfae23b];return _0x200640;};'use strict';var multer=require(_0x5a18('0x0'));var util=require(_0x5a18('0x1'));var path=require(_0x5a18('0x2'));var timeout=require('connect-timeout');var express=require(_0x5a18('0x3'));var router=express[_0x5a18('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x5a18('0x5'));var interaction=require(_0x5a18('0x6'));var config=require(_0x5a18('0x7'));var controller=require('./whatsappQueueReport.controller');router['get']('/',auth[_0x5a18('0x8')](),controller[_0x5a18('0x9')]);router['get'](_0x5a18('0xa'),auth[_0x5a18('0x8')](),controller[_0x5a18('0xb')]);router[_0x5a18('0xc')](_0x5a18('0xd'),auth[_0x5a18('0x8')](),controller[_0x5a18('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x5a18('0xf')]);router['put']('/:id',auth[_0x5a18('0x8')](),controller[_0x5a18('0x10')]);router['delete']('/:id',auth[_0x5a18('0x8')](),controller[_0x5a18('0x11')]);module[_0x5a18('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 3b9a93b..fa1dd0f 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(_0x33949a,_0x23e910){var _0x212a88=function(_0x692c73){while(--_0x692c73){_0x33949a['push'](_0x33949a['shift']());}};_0x212a88(++_0x23e910);}(_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 _0x9957=['exports','STRING','DATE','sequelize'];(function(_0x128115,_0x31d50e){var _0x3b10af=function(_0x29b65a){while(--_0x29b65a){_0x128115['push'](_0x128115['shift']());}};_0x3b10af(++_0x31d50e);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'uniqueid':{'type':Sequelize[_0x7995('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x7995('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x7995('0x3')]},'acceptAt':{'type':Sequelize[_0x7995('0x3')]},'exitAt':{'type':Sequelize[_0x7995('0x3')]},'reason':{'type':Sequelize[_0x7995('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js index 08ff7b3..f8c6152 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 _0xda3f=['fields','nolimit','sort','filter','where','merge','type','VIRTUAL','options','WhatsappQueueReport','includeAll','include','findAll','rows','catch','params','rawAttributes','length','find','create','body','destroy','describe','rimraf','zip-dir','bluebird','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','then','end','stack','name','send','map','key','model','query','keys','filters','intersection','attributes'];(function(_0x1871f1,_0x5e72a1){var _0x5c968c=function(_0x5a9656){while(--_0x5a9656){_0x1871f1['push'](_0x1871f1['shift']());}};_0x5c968c(++_0x5e72a1);}(_0xda3f,0xec));var _0xfda3=function(_0x186d72,_0x39c2f3){_0x186d72=_0x186d72-0x0;var _0xc6bcc0=_0xda3f[_0x186d72];return _0xc6bcc0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfda3('0x0'));var zipdir=require(_0xfda3('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xfda3('0x2'));var Mustache=require('mustache');var util=require(_0xfda3('0x3'));var path=require(_0xfda3('0x4'));var sox=require('sox');var csv=require(_0xfda3('0x5'));var ejs=require(_0xfda3('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xfda3('0x7'));var crypto=require(_0xfda3('0x8'));var jsforce=require(_0xfda3('0x9'));var deskjs=require(_0xfda3('0xa'));var toCsv=require(_0xfda3('0x5'));var querystring=require(_0xfda3('0xb'));var Papa=require(_0xfda3('0xc'));var Redis=require(_0xfda3('0xd'));var authService=require(_0xfda3('0xe'));var qs=require(_0xfda3('0xf'));var as=require(_0xfda3('0x10'));var hardwareService=require(_0xfda3('0x11'));var logger=require('../../config/logger')(_0xfda3('0x12'));var utils=require(_0xfda3('0x13'));var config=require(_0xfda3('0x14'));var licenseUtil=require(_0xfda3('0x15'));var db=require(_0xfda3('0x16'))['db'];function respondWithStatusCode(_0x4b77ea,_0x583125){_0x583125=_0x583125||0xcc;return function(_0x5d7d5b){if(_0x5d7d5b){return _0x4b77ea[_0xfda3('0x17')](_0x583125);}return _0x4b77ea[_0xfda3('0x18')](_0x583125)['end']();};}function respondWithResult(_0x501588,_0x587e9b){_0x587e9b=_0x587e9b||0xc8;return function(_0x227d72){if(_0x227d72){return _0x501588[_0xfda3('0x18')](_0x587e9b)['json'](_0x227d72);}};}function respondWithFilteredResult(_0x57a229,_0x533365){return function(_0x80ea80){if(_0x80ea80){var _0x474707=typeof _0x533365[_0xfda3('0x19')]===_0xfda3('0x1a')&&typeof _0x533365[_0xfda3('0x1b')]===_0xfda3('0x1a');var _0x2aadcb=_0x80ea80[_0xfda3('0x1c')];var _0x4680bf=_0x474707?0x0:_0x533365[_0xfda3('0x19')];var _0x54a7c6=_0x474707?_0x80ea80[_0xfda3('0x1c')]:_0x533365[_0xfda3('0x19')]+_0x533365[_0xfda3('0x1b')];var _0x32855a;if(_0x54a7c6>=_0x2aadcb){_0x54a7c6=_0x2aadcb;_0x32855a=0xc8;}else{_0x32855a=0xce;}_0x57a229['status'](_0x32855a);return _0x57a229[_0xfda3('0x1d')](_0xfda3('0x1e'),_0x4680bf+'-'+_0x54a7c6+'/'+_0x2aadcb)[_0xfda3('0x1f')](_0x80ea80);}return null;};}function patchUpdates(_0x51e731){return function(_0x5ad52a){try{jsonpatch[_0xfda3('0x20')](_0x5ad52a,_0x51e731,!![]);}catch(_0x38d428){return BPromise[_0xfda3('0x21')](_0x38d428);}return _0x5ad52a['save']();};}function saveUpdates(_0x3cf5a9,_0xef2535){return function(_0x1e15a8){if(_0x1e15a8){return _0x1e15a8[_0xfda3('0x22')](_0x3cf5a9)[_0xfda3('0x23')](function(_0x2b84b7){return _0x2b84b7;});}return null;};}function removeEntity(_0x2677f6,_0xc6fb9a){return function(_0x16eaa6){if(_0x16eaa6){return _0x16eaa6['destroy']()[_0xfda3('0x23')](function(){_0x2677f6[_0xfda3('0x18')](0xcc)[_0xfda3('0x24')]();});}};}function handleEntityNotFound(_0x4ae9b9,_0x45a977){return function(_0x39e246){if(!_0x39e246){_0x4ae9b9[_0xfda3('0x17')](0x194);}return _0x39e246;};}function handleError(_0x38946d,_0x1cb831){_0x1cb831=_0x1cb831||0x1f4;return function(_0xad9f7b){logger['error'](_0xad9f7b[_0xfda3('0x25')]);if(_0xad9f7b[_0xfda3('0x26')]){delete _0xad9f7b[_0xfda3('0x26')];}_0x38946d[_0xfda3('0x18')](_0x1cb831)[_0xfda3('0x27')](_0xad9f7b);};}exports['index']=function(_0x3c1549,_0x4101b1){var _0x301509={},_0x474992={},_0xe21ec6={'count':0x0,'rows':[]};var _0x3cfeb2=_[_0xfda3('0x28')](db['WhatsappQueueReport']['rawAttributes'],function(_0x3aef3c){return{'name':_0x3aef3c['fieldName'],'type':_0x3aef3c['type'][_0xfda3('0x29')]};});_0x474992[_0xfda3('0x2a')]=_[_0xfda3('0x28')](_0x3cfeb2,_0xfda3('0x26'));_0x474992[_0xfda3('0x2b')]=_[_0xfda3('0x2c')](_0x3c1549[_0xfda3('0x2b')]);_0x474992[_0xfda3('0x2d')]=_[_0xfda3('0x2e')](_0x474992['model'],_0x474992[_0xfda3('0x2b')]);_0x301509[_0xfda3('0x2f')]=_[_0xfda3('0x2e')](_0x474992[_0xfda3('0x2a')],qs[_0xfda3('0x30')](_0x3c1549[_0xfda3('0x2b')][_0xfda3('0x30')]));_0x301509[_0xfda3('0x2f')]=_0x301509[_0xfda3('0x2f')]['length']?_0x301509['attributes']:_0x474992[_0xfda3('0x2a')];if(!_0x3c1549[_0xfda3('0x2b')]['hasOwnProperty'](_0xfda3('0x31'))){_0x301509[_0xfda3('0x1b')]=qs[_0xfda3('0x1b')](_0x3c1549['query'][_0xfda3('0x1b')]);_0x301509[_0xfda3('0x19')]=qs[_0xfda3('0x19')](_0x3c1549[_0xfda3('0x2b')][_0xfda3('0x19')]);}_0x301509['order']=qs[_0xfda3('0x32')](_0x3c1549[_0xfda3('0x2b')][_0xfda3('0x32')]);_0x301509['where']=qs[_0xfda3('0x2d')](_['pick'](_0x3c1549[_0xfda3('0x2b')],_0x474992[_0xfda3('0x2d')]),_0x3cfeb2);if(_0x3c1549[_0xfda3('0x2b')][_0xfda3('0x33')]){_0x301509[_0xfda3('0x34')]=_[_0xfda3('0x35')](_0x301509[_0xfda3('0x34')],{'$or':_[_0xfda3('0x28')](_0x3cfeb2,function(_0x577be8){if(_0x577be8[_0xfda3('0x36')]!==_0xfda3('0x37')){var _0xd2dde0={};_0xd2dde0[_0x577be8[_0xfda3('0x26')]]={'$like':'%'+_0x3c1549['query'][_0xfda3('0x33')]+'%'};return _0xd2dde0;}})});}_0x301509=_[_0xfda3('0x35')]({},_0x301509,_0x3c1549[_0xfda3('0x38')]);var _0x5bad90={'where':_0x301509['where']};return db[_0xfda3('0x39')][_0xfda3('0x1c')](_0x5bad90)[_0xfda3('0x23')](function(_0x1aaa6c){_0xe21ec6[_0xfda3('0x1c')]=_0x1aaa6c;if(_0x3c1549[_0xfda3('0x2b')][_0xfda3('0x3a')]){_0x301509[_0xfda3('0x3b')]=[{'all':!![]}];}return db[_0xfda3('0x39')][_0xfda3('0x3c')](_0x301509);})['then'](function(_0x27200f){_0xe21ec6[_0xfda3('0x3d')]=_0x27200f;return _0xe21ec6;})['then'](respondWithFilteredResult(_0x4101b1,_0x301509))[_0xfda3('0x3e')](handleError(_0x4101b1,null));};exports['show']=function(_0x51a314,_0x4e6886){var _0x2208bc={'raw':!![],'where':{'id':_0x51a314[_0xfda3('0x3f')]['id']}},_0x107fb1={};_0x107fb1[_0xfda3('0x2a')]=_['keys'](db[_0xfda3('0x39')][_0xfda3('0x40')]);_0x107fb1[_0xfda3('0x2b')]=_[_0xfda3('0x2c')](_0x51a314['query']);_0x107fb1[_0xfda3('0x2d')]=_[_0xfda3('0x2e')](_0x107fb1[_0xfda3('0x2a')],_0x107fb1['query']);_0x2208bc['attributes']=_[_0xfda3('0x2e')](_0x107fb1[_0xfda3('0x2a')],qs[_0xfda3('0x30')](_0x51a314[_0xfda3('0x2b')][_0xfda3('0x30')]));_0x2208bc[_0xfda3('0x2f')]=_0x2208bc[_0xfda3('0x2f')][_0xfda3('0x41')]?_0x2208bc[_0xfda3('0x2f')]:_0x107fb1[_0xfda3('0x2a')];if(_0x51a314[_0xfda3('0x2b')][_0xfda3('0x3a')]){_0x2208bc[_0xfda3('0x3b')]=[{'all':!![]}];}_0x2208bc=_[_0xfda3('0x35')]({},_0x2208bc,_0x51a314['options']);return db['WhatsappQueueReport'][_0xfda3('0x42')](_0x2208bc)[_0xfda3('0x23')](handleEntityNotFound(_0x4e6886,null))[_0xfda3('0x23')](respondWithResult(_0x4e6886,null))[_0xfda3('0x3e')](handleError(_0x4e6886,null));};exports[_0xfda3('0x43')]=function(_0x60a89d,_0x192133){return db[_0xfda3('0x39')][_0xfda3('0x43')](_0x60a89d[_0xfda3('0x44')],{})['then'](respondWithResult(_0x192133,0xc9))[_0xfda3('0x3e')](handleError(_0x192133,null));};exports[_0xfda3('0x22')]=function(_0x481356,_0x36aa3a){if(_0x481356[_0xfda3('0x44')]['id']){delete _0x481356['body']['id'];}return db[_0xfda3('0x39')][_0xfda3('0x42')]({'where':{'id':_0x481356[_0xfda3('0x3f')]['id']}})['then'](handleEntityNotFound(_0x36aa3a,null))[_0xfda3('0x23')](saveUpdates(_0x481356[_0xfda3('0x44')],null))[_0xfda3('0x23')](respondWithResult(_0x36aa3a,null))['catch'](handleError(_0x36aa3a,null));};exports[_0xfda3('0x45')]=function(_0x33565d,_0x2f54eb){return db[_0xfda3('0x39')][_0xfda3('0x42')]({'where':{'id':_0x33565d['params']['id']}})[_0xfda3('0x23')](handleEntityNotFound(_0x2f54eb,null))['then'](removeEntity(_0x2f54eb,null))[_0xfda3('0x3e')](handleError(_0x2f54eb,null));};exports['describe']=function(_0x1b5e89,_0x6447){return db[_0xfda3('0x39')][_0xfda3('0x46')]()['then'](respondWithResult(_0x6447,null))[_0xfda3('0x3e')](handleError(_0x6447,null));}; \ No newline at end of file +var _0x878f=['intersection','fields','length','nolimit','order','sort','filter','where','type','VIRTUAL','merge','includeAll','include','WhatsappQueueReport','rows','params','find','create','body','catch','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','json','reject','save','update','then','destroy','end','error','stack','name','send','index','map','rawAttributes','fieldName','key','query','keys','filters','model','attributes'];(function(_0x5c3629,_0x40b358){var _0xfa0ceb=function(_0x4c005b){while(--_0x4c005b){_0x5c3629['push'](_0x5c3629['shift']());}};_0xfa0ceb(++_0x40b358);}(_0x878f,0x173));var _0xf878=function(_0x4a912f,_0x1be4b1){_0x4a912f=_0x4a912f-0x0;var _0x50e3df=_0x878f[_0x4a912f];return _0x50e3df;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf878('0x0'));var zipdir=require(_0xf878('0x1'));var jsonpatch=require(_0xf878('0x2'));var rp=require(_0xf878('0x3'));var moment=require(_0xf878('0x4'));var BPromise=require(_0xf878('0x5'));var Mustache=require(_0xf878('0x6'));var util=require(_0xf878('0x7'));var path=require(_0xf878('0x8'));var sox=require(_0xf878('0x9'));var csv=require(_0xf878('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf878('0xb'));var squel=require(_0xf878('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xf878('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xf878('0xd'));var authService=require(_0xf878('0xe'));var qs=require(_0xf878('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf878('0x10'));var logger=require(_0xf878('0x11'))('api');var utils=require(_0xf878('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xf878('0x13'));var db=require(_0xf878('0x14'))['db'];function respondWithStatusCode(_0x339c9c,_0x596fb5){_0x596fb5=_0x596fb5||0xcc;return function(_0x1ce004){if(_0x1ce004){return _0x339c9c[_0xf878('0x15')](_0x596fb5);}return _0x339c9c[_0xf878('0x16')](_0x596fb5)['end']();};}function respondWithResult(_0xe2c2de,_0x3902f7){_0x3902f7=_0x3902f7||0xc8;return function(_0x119e9e){if(_0x119e9e){return _0xe2c2de['status'](_0x3902f7)['json'](_0x119e9e);}};}function respondWithFilteredResult(_0x4c0948,_0x35ff2d){return function(_0x31d888){if(_0x31d888){var _0x6dbeca=typeof _0x35ff2d[_0xf878('0x17')]===_0xf878('0x18')&&typeof _0x35ff2d[_0xf878('0x19')]===_0xf878('0x18');var _0x3c5dee=_0x31d888[_0xf878('0x1a')];var _0x3b2e1b=_0x6dbeca?0x0:_0x35ff2d['offset'];var _0x2b2b54=_0x6dbeca?_0x31d888[_0xf878('0x1a')]:_0x35ff2d[_0xf878('0x17')]+_0x35ff2d[_0xf878('0x19')];var _0x3714f6;if(_0x2b2b54>=_0x3c5dee){_0x2b2b54=_0x3c5dee;_0x3714f6=0xc8;}else{_0x3714f6=0xce;}_0x4c0948[_0xf878('0x16')](_0x3714f6);return _0x4c0948[_0xf878('0x1b')]('Content-Range',_0x3b2e1b+'-'+_0x2b2b54+'/'+_0x3c5dee)[_0xf878('0x1c')](_0x31d888);}return null;};}function patchUpdates(_0x140866){return function(_0x250f85){try{jsonpatch['apply'](_0x250f85,_0x140866,!![]);}catch(_0x432e5d){return BPromise[_0xf878('0x1d')](_0x432e5d);}return _0x250f85[_0xf878('0x1e')]();};}function saveUpdates(_0x392822,_0x22d884){return function(_0x442450){if(_0x442450){return _0x442450[_0xf878('0x1f')](_0x392822)[_0xf878('0x20')](function(_0x212436){return _0x212436;});}return null;};}function removeEntity(_0x1a6506,_0x45e61f){return function(_0x566995){if(_0x566995){return _0x566995[_0xf878('0x21')]()['then'](function(){_0x1a6506[_0xf878('0x16')](0xcc)[_0xf878('0x22')]();});}};}function handleEntityNotFound(_0x35b3b4,_0x280036){return function(_0x20449e){if(!_0x20449e){_0x35b3b4['sendStatus'](0x194);}return _0x20449e;};}function handleError(_0x58c713,_0x59ba7b){_0x59ba7b=_0x59ba7b||0x1f4;return function(_0x242926){logger[_0xf878('0x23')](_0x242926[_0xf878('0x24')]);if(_0x242926['name']){delete _0x242926[_0xf878('0x25')];}_0x58c713[_0xf878('0x16')](_0x59ba7b)[_0xf878('0x26')](_0x242926);};}exports[_0xf878('0x27')]=function(_0x41dd55,_0x5aff46){var _0x502322={},_0x9a127d={},_0x5d9c97={'count':0x0,'rows':[]};var _0x4a0286=_[_0xf878('0x28')](db['WhatsappQueueReport'][_0xf878('0x29')],function(_0x51afaf){return{'name':_0x51afaf[_0xf878('0x2a')],'type':_0x51afaf['type'][_0xf878('0x2b')]};});_0x9a127d['model']=_[_0xf878('0x28')](_0x4a0286,_0xf878('0x25'));_0x9a127d[_0xf878('0x2c')]=_[_0xf878('0x2d')](_0x41dd55[_0xf878('0x2c')]);_0x9a127d[_0xf878('0x2e')]=_['intersection'](_0x9a127d[_0xf878('0x2f')],_0x9a127d[_0xf878('0x2c')]);_0x502322[_0xf878('0x30')]=_[_0xf878('0x31')](_0x9a127d[_0xf878('0x2f')],qs['fields'](_0x41dd55[_0xf878('0x2c')][_0xf878('0x32')]));_0x502322['attributes']=_0x502322[_0xf878('0x30')][_0xf878('0x33')]?_0x502322[_0xf878('0x30')]:_0x9a127d[_0xf878('0x2f')];if(!_0x41dd55[_0xf878('0x2c')]['hasOwnProperty'](_0xf878('0x34'))){_0x502322[_0xf878('0x19')]=qs[_0xf878('0x19')](_0x41dd55[_0xf878('0x2c')]['limit']);_0x502322[_0xf878('0x17')]=qs['offset'](_0x41dd55['query'][_0xf878('0x17')]);}_0x502322[_0xf878('0x35')]=qs[_0xf878('0x36')](_0x41dd55[_0xf878('0x2c')][_0xf878('0x36')]);_0x502322['where']=qs[_0xf878('0x2e')](_['pick'](_0x41dd55[_0xf878('0x2c')],_0x9a127d[_0xf878('0x2e')]),_0x4a0286);if(_0x41dd55['query'][_0xf878('0x37')]){_0x502322[_0xf878('0x38')]=_['merge'](_0x502322[_0xf878('0x38')],{'$or':_[_0xf878('0x28')](_0x4a0286,function(_0x5b4098){if(_0x5b4098[_0xf878('0x39')]!==_0xf878('0x3a')){var _0x34731d={};_0x34731d[_0x5b4098[_0xf878('0x25')]]={'$like':'%'+_0x41dd55[_0xf878('0x2c')][_0xf878('0x37')]+'%'};return _0x34731d;}})});}_0x502322=_[_0xf878('0x3b')]({},_0x502322,_0x41dd55['options']);var _0x1179fb={'where':_0x502322[_0xf878('0x38')]};return db['WhatsappQueueReport'][_0xf878('0x1a')](_0x1179fb)['then'](function(_0x489964){_0x5d9c97[_0xf878('0x1a')]=_0x489964;if(_0x41dd55[_0xf878('0x2c')][_0xf878('0x3c')]){_0x502322[_0xf878('0x3d')]=[{'all':!![]}];}return db[_0xf878('0x3e')]['findAll'](_0x502322);})[_0xf878('0x20')](function(_0x4c4ae4){_0x5d9c97[_0xf878('0x3f')]=_0x4c4ae4;return _0x5d9c97;})[_0xf878('0x20')](respondWithFilteredResult(_0x5aff46,_0x502322))['catch'](handleError(_0x5aff46,null));};exports['show']=function(_0x180594,_0x2a66c1){var _0x13fcd3={'raw':!![],'where':{'id':_0x180594[_0xf878('0x40')]['id']}},_0x2f6ee5={};_0x2f6ee5[_0xf878('0x2f')]=_[_0xf878('0x2d')](db[_0xf878('0x3e')][_0xf878('0x29')]);_0x2f6ee5['query']=_[_0xf878('0x2d')](_0x180594[_0xf878('0x2c')]);_0x2f6ee5[_0xf878('0x2e')]=_[_0xf878('0x31')](_0x2f6ee5[_0xf878('0x2f')],_0x2f6ee5[_0xf878('0x2c')]);_0x13fcd3['attributes']=_[_0xf878('0x31')](_0x2f6ee5[_0xf878('0x2f')],qs[_0xf878('0x32')](_0x180594[_0xf878('0x2c')][_0xf878('0x32')]));_0x13fcd3['attributes']=_0x13fcd3[_0xf878('0x30')][_0xf878('0x33')]?_0x13fcd3[_0xf878('0x30')]:_0x2f6ee5[_0xf878('0x2f')];if(_0x180594['query'][_0xf878('0x3c')]){_0x13fcd3[_0xf878('0x3d')]=[{'all':!![]}];}_0x13fcd3=_[_0xf878('0x3b')]({},_0x13fcd3,_0x180594['options']);return db['WhatsappQueueReport'][_0xf878('0x41')](_0x13fcd3)['then'](handleEntityNotFound(_0x2a66c1,null))['then'](respondWithResult(_0x2a66c1,null))['catch'](handleError(_0x2a66c1,null));};exports[_0xf878('0x42')]=function(_0x49e719,_0x156fdb){return db[_0xf878('0x3e')][_0xf878('0x42')](_0x49e719[_0xf878('0x43')],{})[_0xf878('0x20')](respondWithResult(_0x156fdb,0xc9))[_0xf878('0x44')](handleError(_0x156fdb,null));};exports[_0xf878('0x1f')]=function(_0x526c89,_0xb0bf4c){if(_0x526c89[_0xf878('0x43')]['id']){delete _0x526c89[_0xf878('0x43')]['id'];}return db[_0xf878('0x3e')][_0xf878('0x41')]({'where':{'id':_0x526c89['params']['id']}})['then'](handleEntityNotFound(_0xb0bf4c,null))[_0xf878('0x20')](saveUpdates(_0x526c89[_0xf878('0x43')],null))['then'](respondWithResult(_0xb0bf4c,null))[_0xf878('0x44')](handleError(_0xb0bf4c,null));};exports['destroy']=function(_0x1ce6b9,_0x31adde){return db[_0xf878('0x3e')][_0xf878('0x41')]({'where':{'id':_0x1ce6b9['params']['id']}})[_0xf878('0x20')](handleEntityNotFound(_0x31adde,null))[_0xf878('0x20')](removeEntity(_0x31adde,null))[_0xf878('0x44')](handleError(_0x31adde,null));};exports['describe']=function(_0xce30a5,_0x30df05){return db[_0xf878('0x3e')][_0xf878('0x45')]()['then'](respondWithResult(_0x30df05,null))[_0xf878('0x44')](handleError(_0x30df05,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index 074d968..7d60fe3 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 _0x34af=['../../config/environment','./whatsappQueueReport.attributes','exports','define','WhatsappQueueReport','report_whatsapp_queue','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x475448,_0x435e98){var _0x45d341=function(_0x268ed2){while(--_0x268ed2){_0x475448['push'](_0x475448['shift']());}};_0x45d341(++_0x435e98);}(_0x34af,0x19d));var _0xf34a=function(_0xf6523f,_0x151caf){_0xf6523f=_0xf6523f-0x0;var _0x4a39e4=_0x34af[_0xf6523f];return _0x4a39e4;};'use strict';var _=require('lodash');var util=require(_0xf34a('0x0'));var logger=require(_0xf34a('0x1'))(_0xf34a('0x2'));var moment=require(_0xf34a('0x3'));var BPromise=require(_0xf34a('0x4'));var rp=require(_0xf34a('0x5'));var fs=require('fs');var path=require(_0xf34a('0x6'));var rimraf=require('rimraf');var config=require(_0xf34a('0x7'));var attributes=require(_0xf34a('0x8'));module[_0xf34a('0x9')]=function(_0x57d38c,_0xbd2e40){return _0x57d38c[_0xf34a('0xa')](_0xf34a('0xb'),attributes,{'tableName':_0xf34a('0xc'),'paranoid':![],'indexes':[{'name':_0xf34a('0xd'),'fields':[_0xf34a('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2892=['util','../../config/logger','api','moment','path','rimraf','../../config/environment','./whatsappQueueReport.attributes','exports','define','WhatsappQueueReport','report_whatsapp_queue','uniqueid','lodash'];(function(_0x4f431d,_0xd51a3b){var _0x4f31e1=function(_0x1c688d){while(--_0x1c688d){_0x4f431d['push'](_0x4f431d['shift']());}};_0x4f31e1(++_0xd51a3b);}(_0x2892,0x117));var _0x2289=function(_0x2aa45c,_0x5505a6){_0x2aa45c=_0x2aa45c-0x0;var _0xc7f51d=_0x2892[_0x2aa45c];return _0xc7f51d;};'use strict';var _=require(_0x2289('0x0'));var util=require(_0x2289('0x1'));var logger=require(_0x2289('0x2'))(_0x2289('0x3'));var moment=require(_0x2289('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x2289('0x5'));var rimraf=require(_0x2289('0x6'));var config=require(_0x2289('0x7'));var attributes=require(_0x2289('0x8'));module[_0x2289('0x9')]=function(_0x27d2f8,_0x2cf426){return _0x27d2f8[_0x2289('0xa')](_0x2289('0xb'),attributes,{'tableName':_0x2289('0xc'),'paranoid':![],'indexes':[{'name':_0x2289('0xd'),'fields':[_0x2289('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index 2ebdef9..ab45ba9 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 _0xad98=['info','request\x20sent','catch','CreateWhatsappQueueReport','create','body','options','raw','then','UpdateWhatsappQueueReport','WhatsappQueueReport','where','attributes','limit','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','WhatsappQueueReport,\x20%s,\x20%s','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x5f3f88,_0x562baf){var _0xd08119=function(_0x42dbf7){while(--_0x42dbf7){_0x5f3f88['push'](_0x5f3f88['shift']());}};_0xd08119(++_0x562baf);}(_0xad98,0x1bb));var _0x8ad9=function(_0x2f3412,_0x2b8d24){_0x2f3412=_0x2f3412-0x0;var _0x4071d6=_0xad98[_0x2f3412];return _0x4071d6;};'use strict';var _=require(_0x8ad9('0x0'));var util=require(_0x8ad9('0x1'));var moment=require(_0x8ad9('0x2'));var BPromise=require(_0x8ad9('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8ad9('0x4'))['db'];var utils=require(_0x8ad9('0x5'));var logger=require(_0x8ad9('0x6'))(_0x8ad9('0x7'));var config=require(_0x8ad9('0x8'));var jayson=require(_0x8ad9('0x9'));var client=jayson[_0x8ad9('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5df27f,_0x4866dd,_0x422e81){return new BPromise(function(_0x144a16,_0x477d6b){return client[_0x8ad9('0xb')](_0x5df27f,_0x422e81)['then'](function(_0x333287){logger['info'](_0x8ad9('0xc'),_0x4866dd,'request\x20sent');logger[_0x8ad9('0xd')](_0x8ad9('0xe'),_0x4866dd,'request\x20sent',JSON[_0x8ad9('0xf')](_0x333287));if(_0x333287[_0x8ad9('0x10')]){if(_0x333287[_0x8ad9('0x10')][_0x8ad9('0x11')]===0x1f4){logger[_0x8ad9('0x10')](_0x8ad9('0xc'),_0x4866dd,_0x333287['error'][_0x8ad9('0x12')]);return _0x477d6b(_0x333287[_0x8ad9('0x10')][_0x8ad9('0x12')]);}logger[_0x8ad9('0x10')](_0x8ad9('0xc'),_0x4866dd,_0x333287['error'][_0x8ad9('0x12')]);return _0x144a16(_0x333287[_0x8ad9('0x10')][_0x8ad9('0x12')]);}else{logger[_0x8ad9('0x13')](_0x8ad9('0xc'),_0x4866dd,_0x8ad9('0x14'));_0x144a16(_0x333287['result'][_0x8ad9('0x12')]);}})[_0x8ad9('0x15')](function(_0x4c9613){logger[_0x8ad9('0x10')](_0x8ad9('0xc'),_0x4866dd,_0x4c9613);_0x477d6b(_0x4c9613);});});}exports[_0x8ad9('0x16')]=function(_0x5092f8){var _0x4ed718=this;return new Promise(function(_0x89402e,_0x33e423){return db['WhatsappQueueReport'][_0x8ad9('0x17')](_0x5092f8[_0x8ad9('0x18')],{'raw':_0x5092f8[_0x8ad9('0x19')]?_0x5092f8['options'][_0x8ad9('0x1a')]===undefined?!![]:![]:!![]})[_0x8ad9('0x1b')](function(_0xdd991e){logger[_0x8ad9('0x13')](_0x8ad9('0x16'),_0x5092f8);logger[_0x8ad9('0xd')](_0x8ad9('0x16'),_0x5092f8,JSON[_0x8ad9('0xf')](_0xdd991e));_0x89402e(_0xdd991e);})[_0x8ad9('0x15')](function(_0x57a66a){logger[_0x8ad9('0x10')](_0x8ad9('0x16'),_0x57a66a['message'],_0x5092f8);_0x33e423(_0x4ed718[_0x8ad9('0x10')](0x1f4,_0x57a66a[_0x8ad9('0x12')]));});});};exports[_0x8ad9('0x1c')]=function(_0x502bc8){var _0x2a797a=this;return new Promise(function(_0x4eaf75,_0x55b650){return db[_0x8ad9('0x1d')]['update'](_0x502bc8[_0x8ad9('0x18')],{'raw':_0x502bc8[_0x8ad9('0x19')]?_0x502bc8['options'][_0x8ad9('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x502bc8[_0x8ad9('0x19')]?_0x502bc8['options'][_0x8ad9('0x1e')]||null:null,'attributes':_0x502bc8[_0x8ad9('0x19')]?_0x502bc8[_0x8ad9('0x19')][_0x8ad9('0x1f')]||null:null,'limit':_0x502bc8[_0x8ad9('0x19')]?_0x502bc8[_0x8ad9('0x19')][_0x8ad9('0x20')]||null:null})[_0x8ad9('0x1b')](function(_0xf40ad0){logger['info'](_0x8ad9('0x1c'),_0x502bc8);logger[_0x8ad9('0xd')]('UpdateWhatsappQueueReport',_0x502bc8,JSON[_0x8ad9('0xf')](_0xf40ad0));_0x4eaf75(_0xf40ad0);})[_0x8ad9('0x15')](function(_0x27e8b6){logger['error'](_0x8ad9('0x1c'),_0x27e8b6[_0x8ad9('0x12')],_0x502bc8);_0x55b650(_0x2a797a[_0x8ad9('0x10')](0x1f4,_0x27e8b6['message']));});});}; \ No newline at end of file +var _0x7b3c=['catch','CreateWhatsappQueueReport','WhatsappQueueReport','body','options','raw','UpdateWhatsappQueueReport','update','where','limit','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','http','request','then','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x4a97c5,_0x5a254d){var _0x506a52=function(_0x1f212c){while(--_0x1f212c){_0x4a97c5['push'](_0x4a97c5['shift']());}};_0x506a52(++_0x5a254d);}(_0x7b3c,0x102));var _0xc7b3=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x7b3c[_0x21a9d9];return _0x46adce;};'use strict';var _=require(_0xc7b3('0x0'));var util=require(_0xc7b3('0x1'));var moment=require(_0xc7b3('0x2'));var BPromise=require('bluebird');var rs=require(_0xc7b3('0x3'));var fs=require('fs');var Redis=require(_0xc7b3('0x4'));var db=require(_0xc7b3('0x5'))['db'];var utils=require(_0xc7b3('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xc7b3('0x7'));var client=jayson[_0xc7b3('0x8')][_0xc7b3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3bd95d,_0x3d9cd7,_0x59f724){return new BPromise(function(_0x4606fb,_0x2569b6){return client[_0xc7b3('0xa')](_0x3bd95d,_0x59f724)[_0xc7b3('0xb')](function(_0x32b7cd){logger[_0xc7b3('0xc')](_0xc7b3('0xd'),_0x3d9cd7,_0xc7b3('0xe'));logger[_0xc7b3('0xf')](_0xc7b3('0x10'),_0x3d9cd7,_0xc7b3('0xe'),JSON[_0xc7b3('0x11')](_0x32b7cd));if(_0x32b7cd[_0xc7b3('0x12')]){if(_0x32b7cd['error'][_0xc7b3('0x13')]===0x1f4){logger[_0xc7b3('0x12')](_0xc7b3('0xd'),_0x3d9cd7,_0x32b7cd[_0xc7b3('0x12')][_0xc7b3('0x14')]);return _0x2569b6(_0x32b7cd[_0xc7b3('0x12')][_0xc7b3('0x14')]);}logger['error'](_0xc7b3('0xd'),_0x3d9cd7,_0x32b7cd[_0xc7b3('0x12')][_0xc7b3('0x14')]);return _0x4606fb(_0x32b7cd['error'][_0xc7b3('0x14')]);}else{logger[_0xc7b3('0xc')](_0xc7b3('0xd'),_0x3d9cd7,_0xc7b3('0xe'));_0x4606fb(_0x32b7cd['result'][_0xc7b3('0x14')]);}})[_0xc7b3('0x15')](function(_0x47ab1c){logger['error'](_0xc7b3('0xd'),_0x3d9cd7,_0x47ab1c);_0x2569b6(_0x47ab1c);});});}exports[_0xc7b3('0x16')]=function(_0x17fe8b){var _0x515d49=this;return new Promise(function(_0x1ec231,_0x232a53){return db[_0xc7b3('0x17')]['create'](_0x17fe8b[_0xc7b3('0x18')],{'raw':_0x17fe8b[_0xc7b3('0x19')]?_0x17fe8b[_0xc7b3('0x19')][_0xc7b3('0x1a')]===undefined?!![]:![]:!![]})[_0xc7b3('0xb')](function(_0x41dacd){logger['info']('CreateWhatsappQueueReport',_0x17fe8b);logger[_0xc7b3('0xf')](_0xc7b3('0x16'),_0x17fe8b,JSON[_0xc7b3('0x11')](_0x41dacd));_0x1ec231(_0x41dacd);})['catch'](function(_0x3dedc9){logger[_0xc7b3('0x12')](_0xc7b3('0x16'),_0x3dedc9[_0xc7b3('0x14')],_0x17fe8b);_0x232a53(_0x515d49[_0xc7b3('0x12')](0x1f4,_0x3dedc9[_0xc7b3('0x14')]));});});};exports[_0xc7b3('0x1b')]=function(_0x4541bf){var _0x2f4ce0=this;return new Promise(function(_0x1154cc,_0xcd0a2a){return db[_0xc7b3('0x17')][_0xc7b3('0x1c')](_0x4541bf['body'],{'raw':_0x4541bf[_0xc7b3('0x19')]?_0x4541bf[_0xc7b3('0x19')][_0xc7b3('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4541bf[_0xc7b3('0x19')]?_0x4541bf[_0xc7b3('0x19')][_0xc7b3('0x1d')]||null:null,'attributes':_0x4541bf[_0xc7b3('0x19')]?_0x4541bf['options']['attributes']||null:null,'limit':_0x4541bf[_0xc7b3('0x19')]?_0x4541bf['options'][_0xc7b3('0x1e')]||null:null})[_0xc7b3('0xb')](function(_0x45f4a3){logger[_0xc7b3('0xc')]('UpdateWhatsappQueueReport',_0x4541bf);logger[_0xc7b3('0xf')](_0xc7b3('0x1b'),_0x4541bf,JSON[_0xc7b3('0x11')](_0x45f4a3));_0x1154cc(_0x45f4a3);})[_0xc7b3('0x15')](function(_0x49158a){logger[_0xc7b3('0x12')](_0xc7b3('0x1b'),_0x49158a[_0xc7b3('0x14')],_0x4541bf);_0xcd0a2a(_0x2f4ce0['error'](0x1f4,_0x49158a[_0xc7b3('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index 4c9c0f6..d9be670 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 _0x6241=['connect-timeout','express','Router','../../components/auth/service','./whatsappTransferReport.controller','get','/describe','isAuthenticated','describe','/:id','show','post','put','update','destroy','exports','multer','util','path'];(function(_0x30ae00,_0x1e984a){var _0x4a18a8=function(_0x475cd1){while(--_0x475cd1){_0x30ae00['push'](_0x30ae00['shift']());}};_0x4a18a8(++_0x1e984a);}(_0x6241,0x12d));var _0x1624=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x6241[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x1624('0x0'));var util=require(_0x1624('0x1'));var path=require(_0x1624('0x2'));var timeout=require(_0x1624('0x3'));var express=require(_0x1624('0x4'));var router=express[_0x1624('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x1624('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x1624('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x1624('0x8')](_0x1624('0x9'),auth[_0x1624('0xa')](),controller[_0x1624('0xb')]);router['get'](_0x1624('0xc'),auth[_0x1624('0xa')](),controller[_0x1624('0xd')]);router[_0x1624('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0x1624('0xf')]('/:id',auth[_0x1624('0xa')](),controller[_0x1624('0x10')]);router['delete'](_0x1624('0xc'),auth[_0x1624('0xa')](),controller[_0x1624('0x11')]);module[_0x1624('0x12')]=router; \ No newline at end of file +var _0xbb4f=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','post','create','update','delete','destroy','exports','multer','util','path','express'];(function(_0x113717,_0x27126b){var _0xb7e216=function(_0x1ba0e4){while(--_0x1ba0e4){_0x113717['push'](_0x113717['shift']());}};_0xb7e216(++_0x27126b);}(_0xbb4f,0x1ea));var _0xfbb4=function(_0x42f576,_0x291838){_0x42f576=_0x42f576-0x0;var _0xd373a4=_0xbb4f[_0x42f576];return _0xd373a4;};'use strict';var multer=require(_0xfbb4('0x0'));var util=require(_0xfbb4('0x1'));var path=require(_0xfbb4('0x2'));var timeout=require('connect-timeout');var express=require(_0xfbb4('0x3'));var router=express[_0xfbb4('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xfbb4('0x5'));var interaction=require(_0xfbb4('0x6'));var config=require(_0xfbb4('0x7'));var controller=require('./whatsappTransferReport.controller');router[_0xfbb4('0x8')]('/',auth[_0xfbb4('0x9')](),controller['index']);router['get'](_0xfbb4('0xa'),auth[_0xfbb4('0x9')](),controller[_0xfbb4('0xb')]);router[_0xfbb4('0x8')](_0xfbb4('0xc'),auth[_0xfbb4('0x9')](),controller['show']);router[_0xfbb4('0xd')]('/',auth[_0xfbb4('0x9')](),controller[_0xfbb4('0xe')]);router['put']('/:id',auth[_0xfbb4('0x9')](),controller[_0xfbb4('0xf')]);router[_0xfbb4('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xfbb4('0x11')]);module[_0xfbb4('0x12')]=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index cb2a73b..ac1cef9 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 _0x676c=['queue','DATE','sequelize','exports','STRING','account','agent'];(function(_0x48bb8f,_0x15ae9f){var _0x115417=function(_0x3be454){while(--_0x3be454){_0x48bb8f['push'](_0x48bb8f['shift']());}};_0x115417(++_0x15ae9f);}(_0x676c,0x198));var _0xc676=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x676c[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0xc676('0x0'));module[_0xc676('0x1')]={'uniqueid':{'type':Sequelize[_0xc676('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xc676('0x3'),_0xc676('0x4'),_0xc676('0x5')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0xc676('0x6')]}}; \ No newline at end of file +var _0xcb10=['sequelize','exports','ENUM','account','queue'];(function(_0x3b0731,_0xcf9925){var _0x4204d7=function(_0x635ac5){while(--_0x635ac5){_0x3b0731['push'](_0x3b0731['shift']());}};_0x4204d7(++_0xcf9925);}(_0xcb10,0x104));var _0x0cb1=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0xcb10[_0x178e48];return _0x440d7e;};'use strict';var Sequelize=require(_0x0cb1('0x0'));module[_0x0cb1('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x0cb1('0x2')](_0x0cb1('0x3'),'agent',_0x0cb1('0x4')),'allowNull':![]},'transferredAt':{'type':Sequelize['DATE']}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index ebdd102..e444f40 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 _0x8357=['filter','merge','options','includeAll','include','findAll','rows','show','params','intersection','fields','catch','create','body','find','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../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','Content-Range','apply','reject','save','update','then','destroy','error','name','index','map','WhatsappTransferReport','rawAttributes','fieldName','type','key','model','query','keys','attributes','length','hasOwnProperty','order','sort','where','filters','pick'];(function(_0x4a9af8,_0x1e8f31){var _0x553ccd=function(_0x59d64c){while(--_0x59d64c){_0x4a9af8['push'](_0x4a9af8['shift']());}};_0x553ccd(++_0x1e8f31);}(_0x8357,0x140));var _0x7835=function(_0x3e7d9a,_0x3ff3ed){_0x3e7d9a=_0x3e7d9a-0x0;var _0x2801da=_0x8357[_0x3e7d9a];return _0x2801da;};'use strict';var emlformat=require(_0x7835('0x0'));var rimraf=require(_0x7835('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7835('0x2'));var rp=require(_0x7835('0x3'));var moment=require(_0x7835('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x7835('0x5'));var util=require(_0x7835('0x6'));var path=require('path');var sox=require(_0x7835('0x7'));var csv=require(_0x7835('0x8'));var ejs=require(_0x7835('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7835('0xa'));var squel=require(_0x7835('0xb'));var crypto=require(_0x7835('0xc'));var jsforce=require(_0x7835('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x7835('0x8'));var querystring=require(_0x7835('0xe'));var Papa=require(_0x7835('0xf'));var Redis=require(_0x7835('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x7835('0x11'));var as=require(_0x7835('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7835('0x13'))(_0x7835('0x14'));var utils=require(_0x7835('0x15'));var config=require(_0x7835('0x16'));var licenseUtil=require(_0x7835('0x17'));var db=require(_0x7835('0x18'))['db'];function respondWithStatusCode(_0x536922,_0x2171c2){_0x2171c2=_0x2171c2||0xcc;return function(_0x4f5f09){if(_0x4f5f09){return _0x536922[_0x7835('0x19')](_0x2171c2);}return _0x536922[_0x7835('0x1a')](_0x2171c2)[_0x7835('0x1b')]();};}function respondWithResult(_0x402deb,_0x7d0960){_0x7d0960=_0x7d0960||0xc8;return function(_0x1766f8){if(_0x1766f8){return _0x402deb[_0x7835('0x1a')](_0x7d0960)[_0x7835('0x1c')](_0x1766f8);}};}function respondWithFilteredResult(_0x2821b3,_0x262f1d){return function(_0xa99022){if(_0xa99022){var _0x1615cc=typeof _0x262f1d[_0x7835('0x1d')]===_0x7835('0x1e')&&typeof _0x262f1d[_0x7835('0x1f')]===_0x7835('0x1e');var _0xd6f34f=_0xa99022[_0x7835('0x20')];var _0x432de0=_0x1615cc?0x0:_0x262f1d[_0x7835('0x1d')];var _0x4534e0=_0x1615cc?_0xa99022[_0x7835('0x20')]:_0x262f1d[_0x7835('0x1d')]+_0x262f1d['limit'];var _0x1485d8;if(_0x4534e0>=_0xd6f34f){_0x4534e0=_0xd6f34f;_0x1485d8=0xc8;}else{_0x1485d8=0xce;}_0x2821b3[_0x7835('0x1a')](_0x1485d8);return _0x2821b3['set'](_0x7835('0x21'),_0x432de0+'-'+_0x4534e0+'/'+_0xd6f34f)['json'](_0xa99022);}return null;};}function patchUpdates(_0x50561b){return function(_0x198835){try{jsonpatch[_0x7835('0x22')](_0x198835,_0x50561b,!![]);}catch(_0x381832){return BPromise[_0x7835('0x23')](_0x381832);}return _0x198835[_0x7835('0x24')]();};}function saveUpdates(_0x5b768b,_0x12b547){return function(_0x2c0e12){if(_0x2c0e12){return _0x2c0e12[_0x7835('0x25')](_0x5b768b)[_0x7835('0x26')](function(_0x5ec61e){return _0x5ec61e;});}return null;};}function removeEntity(_0x241777,_0x29ec6d){return function(_0x58960d){if(_0x58960d){return _0x58960d[_0x7835('0x27')]()[_0x7835('0x26')](function(){_0x241777[_0x7835('0x1a')](0xcc)[_0x7835('0x1b')]();});}};}function handleEntityNotFound(_0xefe37,_0x399380){return function(_0xe0525f){if(!_0xe0525f){_0xefe37['sendStatus'](0x194);}return _0xe0525f;};}function handleError(_0x4d67ee,_0x27d9ff){_0x27d9ff=_0x27d9ff||0x1f4;return function(_0x58eb92){logger[_0x7835('0x28')](_0x58eb92['stack']);if(_0x58eb92[_0x7835('0x29')]){delete _0x58eb92[_0x7835('0x29')];}_0x4d67ee[_0x7835('0x1a')](_0x27d9ff)['send'](_0x58eb92);};}exports[_0x7835('0x2a')]=function(_0x4426d0,_0x466afc){var _0x2cf0c5={},_0x1db5be={},_0x325e43={'count':0x0,'rows':[]};var _0x465d92=_[_0x7835('0x2b')](db[_0x7835('0x2c')][_0x7835('0x2d')],function(_0x19cffc){return{'name':_0x19cffc[_0x7835('0x2e')],'type':_0x19cffc[_0x7835('0x2f')][_0x7835('0x30')]};});_0x1db5be[_0x7835('0x31')]=_[_0x7835('0x2b')](_0x465d92,'name');_0x1db5be[_0x7835('0x32')]=_[_0x7835('0x33')](_0x4426d0[_0x7835('0x32')]);_0x1db5be['filters']=_['intersection'](_0x1db5be[_0x7835('0x31')],_0x1db5be[_0x7835('0x32')]);_0x2cf0c5[_0x7835('0x34')]=_['intersection'](_0x1db5be[_0x7835('0x31')],qs['fields'](_0x4426d0[_0x7835('0x32')]['fields']));_0x2cf0c5[_0x7835('0x34')]=_0x2cf0c5['attributes'][_0x7835('0x35')]?_0x2cf0c5[_0x7835('0x34')]:_0x1db5be[_0x7835('0x31')];if(!_0x4426d0[_0x7835('0x32')][_0x7835('0x36')]('nolimit')){_0x2cf0c5[_0x7835('0x1f')]=qs[_0x7835('0x1f')](_0x4426d0['query'][_0x7835('0x1f')]);_0x2cf0c5[_0x7835('0x1d')]=qs[_0x7835('0x1d')](_0x4426d0[_0x7835('0x32')][_0x7835('0x1d')]);}_0x2cf0c5[_0x7835('0x37')]=qs[_0x7835('0x38')](_0x4426d0[_0x7835('0x32')][_0x7835('0x38')]);_0x2cf0c5[_0x7835('0x39')]=qs[_0x7835('0x3a')](_[_0x7835('0x3b')](_0x4426d0['query'],_0x1db5be[_0x7835('0x3a')]),_0x465d92);if(_0x4426d0[_0x7835('0x32')][_0x7835('0x3c')]){_0x2cf0c5['where']=_[_0x7835('0x3d')](_0x2cf0c5[_0x7835('0x39')],{'$or':_[_0x7835('0x2b')](_0x465d92,function(_0x3de143){if(_0x3de143[_0x7835('0x2f')]!=='VIRTUAL'){var _0x348cbb={};_0x348cbb[_0x3de143[_0x7835('0x29')]]={'$like':'%'+_0x4426d0[_0x7835('0x32')][_0x7835('0x3c')]+'%'};return _0x348cbb;}})});}_0x2cf0c5=_['merge']({},_0x2cf0c5,_0x4426d0[_0x7835('0x3e')]);var _0x517921={'where':_0x2cf0c5[_0x7835('0x39')]};return db[_0x7835('0x2c')]['count'](_0x517921)[_0x7835('0x26')](function(_0x2da424){_0x325e43[_0x7835('0x20')]=_0x2da424;if(_0x4426d0[_0x7835('0x32')][_0x7835('0x3f')]){_0x2cf0c5[_0x7835('0x40')]=[{'all':!![]}];}return db[_0x7835('0x2c')][_0x7835('0x41')](_0x2cf0c5);})[_0x7835('0x26')](function(_0x2063a0){_0x325e43[_0x7835('0x42')]=_0x2063a0;return _0x325e43;})[_0x7835('0x26')](respondWithFilteredResult(_0x466afc,_0x2cf0c5))['catch'](handleError(_0x466afc,null));};exports[_0x7835('0x43')]=function(_0x1ebda9,_0x507d63){var _0x1219f9={'raw':!![],'where':{'id':_0x1ebda9[_0x7835('0x44')]['id']}},_0x15653c={};_0x15653c['model']=_[_0x7835('0x33')](db[_0x7835('0x2c')][_0x7835('0x2d')]);_0x15653c['query']=_[_0x7835('0x33')](_0x1ebda9[_0x7835('0x32')]);_0x15653c['filters']=_[_0x7835('0x45')](_0x15653c[_0x7835('0x31')],_0x15653c[_0x7835('0x32')]);_0x1219f9['attributes']=_[_0x7835('0x45')](_0x15653c[_0x7835('0x31')],qs[_0x7835('0x46')](_0x1ebda9[_0x7835('0x32')][_0x7835('0x46')]));_0x1219f9[_0x7835('0x34')]=_0x1219f9[_0x7835('0x34')]['length']?_0x1219f9[_0x7835('0x34')]:_0x15653c[_0x7835('0x31')];if(_0x1ebda9[_0x7835('0x32')]['includeAll']){_0x1219f9[_0x7835('0x40')]=[{'all':!![]}];}_0x1219f9=_[_0x7835('0x3d')]({},_0x1219f9,_0x1ebda9['options']);return db[_0x7835('0x2c')]['find'](_0x1219f9)[_0x7835('0x26')](handleEntityNotFound(_0x507d63,null))[_0x7835('0x26')](respondWithResult(_0x507d63,null))[_0x7835('0x47')](handleError(_0x507d63,null));};exports[_0x7835('0x48')]=function(_0x592d0d,_0x139a60){return db['WhatsappTransferReport'][_0x7835('0x48')](_0x592d0d['body'],{})[_0x7835('0x26')](respondWithResult(_0x139a60,0xc9))[_0x7835('0x47')](handleError(_0x139a60,null));};exports['update']=function(_0x5a9ecd,_0x5b3f00){if(_0x5a9ecd[_0x7835('0x49')]['id']){delete _0x5a9ecd[_0x7835('0x49')]['id'];}return db[_0x7835('0x2c')]['find']({'where':{'id':_0x5a9ecd[_0x7835('0x44')]['id']}})[_0x7835('0x26')](handleEntityNotFound(_0x5b3f00,null))['then'](saveUpdates(_0x5a9ecd[_0x7835('0x49')],null))[_0x7835('0x26')](respondWithResult(_0x5b3f00,null))['catch'](handleError(_0x5b3f00,null));};exports['destroy']=function(_0x15a988,_0x1db034){return db['WhatsappTransferReport'][_0x7835('0x4a')]({'where':{'id':_0x15a988['params']['id']}})[_0x7835('0x26')](handleEntityNotFound(_0x1db034,null))['then'](removeEntity(_0x1db034,null))[_0x7835('0x47')](handleError(_0x1db034,null));};exports[_0x7835('0x4b')]=function(_0x3b500c,_0x263c8b){return db['WhatsappTransferReport'][_0x7835('0x4b')]()[_0x7835('0x26')](respondWithResult(_0x263c8b,null))[_0x7835('0x47')](handleError(_0x263c8b,null));}; \ No newline at end of file +var _0x42dc=['fields','length','nolimit','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','find','create','update','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','json','limit','undefined','count','offset','set','Content-Range','apply','reject','then','destroy','status','error','stack','name','send','index','map','WhatsappTransferReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes'];(function(_0x39592a,_0xa234bd){var _0x2d800f=function(_0x2dcea4){while(--_0x2dcea4){_0x39592a['push'](_0x39592a['shift']());}};_0x2d800f(++_0xa234bd);}(_0x42dc,0xa6));var _0xc42d=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x42dc[_0x1facfa];return _0x9ec701;};'use strict';var emlformat=require(_0xc42d('0x0'));var rimraf=require(_0xc42d('0x1'));var zipdir=require(_0xc42d('0x2'));var jsonpatch=require(_0xc42d('0x3'));var rp=require(_0xc42d('0x4'));var moment=require(_0xc42d('0x5'));var BPromise=require(_0xc42d('0x6'));var Mustache=require(_0xc42d('0x7'));var util=require(_0xc42d('0x8'));var path=require(_0xc42d('0x9'));var sox=require(_0xc42d('0xa'));var csv=require(_0xc42d('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc42d('0xc'));var _=require(_0xc42d('0xd'));var squel=require(_0xc42d('0xe'));var crypto=require('crypto');var jsforce=require(_0xc42d('0xf'));var deskjs=require(_0xc42d('0x10'));var toCsv=require(_0xc42d('0xb'));var querystring=require(_0xc42d('0x11'));var Papa=require(_0xc42d('0x12'));var Redis=require(_0xc42d('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xc42d('0x14'));var as=require(_0xc42d('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc42d('0x16'))('api');var utils=require(_0xc42d('0x17'));var config=require(_0xc42d('0x18'));var licenseUtil=require(_0xc42d('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x368148,_0x399101){_0x399101=_0x399101||0xcc;return function(_0x261529){if(_0x261529){return _0x368148[_0xc42d('0x1a')](_0x399101);}return _0x368148['status'](_0x399101)[_0xc42d('0x1b')]();};}function respondWithResult(_0x215087,_0x58d3e9){_0x58d3e9=_0x58d3e9||0xc8;return function(_0x1702b2){if(_0x1702b2){return _0x215087['status'](_0x58d3e9)[_0xc42d('0x1c')](_0x1702b2);}};}function respondWithFilteredResult(_0xa59016,_0x3b8e33){return function(_0x567480){if(_0x567480){var _0x27c6e3=typeof _0x3b8e33['offset']==='undefined'&&typeof _0x3b8e33[_0xc42d('0x1d')]===_0xc42d('0x1e');var _0x49e305=_0x567480[_0xc42d('0x1f')];var _0xd6b4fb=_0x27c6e3?0x0:_0x3b8e33[_0xc42d('0x20')];var _0xd5cf9c=_0x27c6e3?_0x567480['count']:_0x3b8e33[_0xc42d('0x20')]+_0x3b8e33[_0xc42d('0x1d')];var _0x3a2c99;if(_0xd5cf9c>=_0x49e305){_0xd5cf9c=_0x49e305;_0x3a2c99=0xc8;}else{_0x3a2c99=0xce;}_0xa59016['status'](_0x3a2c99);return _0xa59016[_0xc42d('0x21')](_0xc42d('0x22'),_0xd6b4fb+'-'+_0xd5cf9c+'/'+_0x49e305)['json'](_0x567480);}return null;};}function patchUpdates(_0x4b0a6e){return function(_0x1a6818){try{jsonpatch[_0xc42d('0x23')](_0x1a6818,_0x4b0a6e,!![]);}catch(_0x2292df){return BPromise[_0xc42d('0x24')](_0x2292df);}return _0x1a6818['save']();};}function saveUpdates(_0x5ce408,_0x2ef87d){return function(_0x38e3ee){if(_0x38e3ee){return _0x38e3ee['update'](_0x5ce408)[_0xc42d('0x25')](function(_0x302736){return _0x302736;});}return null;};}function removeEntity(_0x1212cc,_0x327e20){return function(_0x2878f4){if(_0x2878f4){return _0x2878f4[_0xc42d('0x26')]()[_0xc42d('0x25')](function(){_0x1212cc[_0xc42d('0x27')](0xcc)[_0xc42d('0x1b')]();});}};}function handleEntityNotFound(_0x5393fc,_0x2f8e2d){return function(_0x5f0140){if(!_0x5f0140){_0x5393fc[_0xc42d('0x1a')](0x194);}return _0x5f0140;};}function handleError(_0x75073e,_0x5cc9c6){_0x5cc9c6=_0x5cc9c6||0x1f4;return function(_0xbca3b0){logger[_0xc42d('0x28')](_0xbca3b0[_0xc42d('0x29')]);if(_0xbca3b0[_0xc42d('0x2a')]){delete _0xbca3b0['name'];}_0x75073e['status'](_0x5cc9c6)[_0xc42d('0x2b')](_0xbca3b0);};}exports[_0xc42d('0x2c')]=function(_0x505b49,_0x5b7da2){var _0x22bcee={},_0x859688={},_0x2f2af4={'count':0x0,'rows':[]};var _0x1a269c=_[_0xc42d('0x2d')](db[_0xc42d('0x2e')][_0xc42d('0x2f')],function(_0x43906f){return{'name':_0x43906f[_0xc42d('0x30')],'type':_0x43906f[_0xc42d('0x31')]['key']};});_0x859688[_0xc42d('0x32')]=_[_0xc42d('0x2d')](_0x1a269c,_0xc42d('0x2a'));_0x859688[_0xc42d('0x33')]=_[_0xc42d('0x34')](_0x505b49[_0xc42d('0x33')]);_0x859688[_0xc42d('0x35')]=_[_0xc42d('0x36')](_0x859688[_0xc42d('0x32')],_0x859688[_0xc42d('0x33')]);_0x22bcee[_0xc42d('0x37')]=_[_0xc42d('0x36')](_0x859688['model'],qs['fields'](_0x505b49[_0xc42d('0x33')][_0xc42d('0x38')]));_0x22bcee[_0xc42d('0x37')]=_0x22bcee[_0xc42d('0x37')][_0xc42d('0x39')]?_0x22bcee[_0xc42d('0x37')]:_0x859688[_0xc42d('0x32')];if(!_0x505b49[_0xc42d('0x33')]['hasOwnProperty'](_0xc42d('0x3a'))){_0x22bcee[_0xc42d('0x1d')]=qs['limit'](_0x505b49[_0xc42d('0x33')]['limit']);_0x22bcee['offset']=qs['offset'](_0x505b49['query'][_0xc42d('0x20')]);}_0x22bcee['order']=qs['sort'](_0x505b49['query']['sort']);_0x22bcee[_0xc42d('0x3b')]=qs['filters'](_[_0xc42d('0x3c')](_0x505b49[_0xc42d('0x33')],_0x859688['filters']),_0x1a269c);if(_0x505b49['query'][_0xc42d('0x3d')]){_0x22bcee[_0xc42d('0x3b')]=_[_0xc42d('0x3e')](_0x22bcee[_0xc42d('0x3b')],{'$or':_[_0xc42d('0x2d')](_0x1a269c,function(_0x35679c){if(_0x35679c[_0xc42d('0x31')]!==_0xc42d('0x3f')){var _0x58e964={};_0x58e964[_0x35679c[_0xc42d('0x2a')]]={'$like':'%'+_0x505b49[_0xc42d('0x33')][_0xc42d('0x3d')]+'%'};return _0x58e964;}})});}_0x22bcee=_[_0xc42d('0x3e')]({},_0x22bcee,_0x505b49[_0xc42d('0x40')]);var _0x15990e={'where':_0x22bcee[_0xc42d('0x3b')]};return db[_0xc42d('0x2e')]['count'](_0x15990e)[_0xc42d('0x25')](function(_0x430531){_0x2f2af4[_0xc42d('0x1f')]=_0x430531;if(_0x505b49[_0xc42d('0x33')]['includeAll']){_0x22bcee[_0xc42d('0x41')]=[{'all':!![]}];}return db['WhatsappTransferReport'][_0xc42d('0x42')](_0x22bcee);})['then'](function(_0x5055bb){_0x2f2af4[_0xc42d('0x43')]=_0x5055bb;return _0x2f2af4;})[_0xc42d('0x25')](respondWithFilteredResult(_0x5b7da2,_0x22bcee))[_0xc42d('0x44')](handleError(_0x5b7da2,null));};exports['show']=function(_0x1b63b1,_0x306148){var _0x39a1a1={'raw':!![],'where':{'id':_0x1b63b1['params']['id']}},_0x17ce4a={};_0x17ce4a[_0xc42d('0x32')]=_[_0xc42d('0x34')](db[_0xc42d('0x2e')]['rawAttributes']);_0x17ce4a[_0xc42d('0x33')]=_[_0xc42d('0x34')](_0x1b63b1[_0xc42d('0x33')]);_0x17ce4a[_0xc42d('0x35')]=_[_0xc42d('0x36')](_0x17ce4a[_0xc42d('0x32')],_0x17ce4a[_0xc42d('0x33')]);_0x39a1a1['attributes']=_[_0xc42d('0x36')](_0x17ce4a[_0xc42d('0x32')],qs[_0xc42d('0x38')](_0x1b63b1[_0xc42d('0x33')][_0xc42d('0x38')]));_0x39a1a1[_0xc42d('0x37')]=_0x39a1a1['attributes'][_0xc42d('0x39')]?_0x39a1a1[_0xc42d('0x37')]:_0x17ce4a[_0xc42d('0x32')];if(_0x1b63b1[_0xc42d('0x33')]['includeAll']){_0x39a1a1[_0xc42d('0x41')]=[{'all':!![]}];}_0x39a1a1=_[_0xc42d('0x3e')]({},_0x39a1a1,_0x1b63b1[_0xc42d('0x40')]);return db['WhatsappTransferReport'][_0xc42d('0x45')](_0x39a1a1)[_0xc42d('0x25')](handleEntityNotFound(_0x306148,null))['then'](respondWithResult(_0x306148,null))[_0xc42d('0x44')](handleError(_0x306148,null));};exports[_0xc42d('0x46')]=function(_0x10d14f,_0x44baee){return db['WhatsappTransferReport']['create'](_0x10d14f['body'],{})[_0xc42d('0x25')](respondWithResult(_0x44baee,0xc9))[_0xc42d('0x44')](handleError(_0x44baee,null));};exports[_0xc42d('0x47')]=function(_0x186ee0,_0x123223){if(_0x186ee0[_0xc42d('0x48')]['id']){delete _0x186ee0[_0xc42d('0x48')]['id'];}return db[_0xc42d('0x2e')][_0xc42d('0x45')]({'where':{'id':_0x186ee0['params']['id']}})[_0xc42d('0x25')](handleEntityNotFound(_0x123223,null))[_0xc42d('0x25')](saveUpdates(_0x186ee0[_0xc42d('0x48')],null))[_0xc42d('0x25')](respondWithResult(_0x123223,null))['catch'](handleError(_0x123223,null));};exports['destroy']=function(_0x173b03,_0x1c8162){return db[_0xc42d('0x2e')][_0xc42d('0x45')]({'where':{'id':_0x173b03['params']['id']}})[_0xc42d('0x25')](handleEntityNotFound(_0x1c8162,null))[_0xc42d('0x25')](removeEntity(_0x1c8162,null))['catch'](handleError(_0x1c8162,null));};exports['describe']=function(_0x3fa00a,_0x30734d){return db[_0xc42d('0x2e')][_0xc42d('0x49')]()[_0xc42d('0x25')](respondWithResult(_0x30734d,null))[_0xc42d('0x44')](handleError(_0x30734d,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index f54d3bd..01ba57c 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 _0x820f=['../../config/logger','moment','request-promise','rimraf','../../config/environment','./whatsappTransferReport.attributes','define','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','lodash','util'];(function(_0x580730,_0x423233){var _0xf5629a=function(_0x5f3d05){while(--_0x5f3d05){_0x580730['push'](_0x580730['shift']());}};_0xf5629a(++_0x423233);}(_0x820f,0x6a));var _0xf820=function(_0x26a776,_0xb78d93){_0x26a776=_0x26a776-0x0;var _0x440e98=_0x820f[_0x26a776];return _0x440e98;};'use strict';var _=require(_0xf820('0x0'));var util=require(_0xf820('0x1'));var logger=require(_0xf820('0x2'))('api');var moment=require(_0xf820('0x3'));var BPromise=require('bluebird');var rp=require(_0xf820('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf820('0x5'));var config=require(_0xf820('0x6'));var attributes=require(_0xf820('0x7'));module['exports']=function(_0x580771,_0x3774da){return _0x580771[_0xf820('0x8')](_0xf820('0x9'),attributes,{'tableName':_0xf820('0xa'),'paranoid':![],'indexes':[{'name':_0xf820('0xb'),'fields':[_0xf820('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5992=['api','moment','bluebird','request-promise','path','rimraf','./whatsappTransferReport.attributes','exports','define','WhatsappTransferReport','uniqueid','lodash','util'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x5992,0x8d));var _0x2599=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x5992[_0x1d1779];return _0x2377e9;};'use strict';var _=require(_0x2599('0x0'));var util=require(_0x2599('0x1'));var logger=require('../../config/logger')(_0x2599('0x2'));var moment=require(_0x2599('0x3'));var BPromise=require(_0x2599('0x4'));var rp=require(_0x2599('0x5'));var fs=require('fs');var path=require(_0x2599('0x6'));var rimraf=require(_0x2599('0x7'));var config=require('../../config/environment');var attributes=require(_0x2599('0x8'));module[_0x2599('0x9')]=function(_0x2df602,_0x421279){return _0x2df602[_0x2599('0xa')](_0x2599('0xb'),attributes,{'tableName':'report_whatsapp_transfer','paranoid':![],'indexes':[{'name':_0x2599('0xc'),'fields':[_0x2599('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index f7f42c4..8d03afe 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 _0x1ad7=['request','then','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http'];(function(_0x485dae,_0x2b6720){var _0x47c230=function(_0x1496a4){while(--_0x1496a4){_0x485dae['push'](_0x485dae['shift']());}};_0x47c230(++_0x2b6720);}(_0x1ad7,0x69));var _0x71ad=function(_0x540133,_0x41783f){_0x540133=_0x540133-0x0;var _0x26b6e9=_0x1ad7[_0x540133];return _0x26b6e9;};'use strict';var _=require(_0x71ad('0x0'));var util=require(_0x71ad('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x71ad('0x2'));var db=require(_0x71ad('0x3'))['db'];var utils=require(_0x71ad('0x4'));var logger=require(_0x71ad('0x5'))(_0x71ad('0x6'));var config=require(_0x71ad('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x71ad('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3c36db,_0x187573,_0x54c263){return new BPromise(function(_0x3f32e3,_0x96d3db){return client[_0x71ad('0x9')](_0x3c36db,_0x54c263)[_0x71ad('0xa')](function(_0x2939a9){logger['info'](_0x71ad('0xb'),_0x187573,_0x71ad('0xc'));logger[_0x71ad('0xd')]('WhatsappTransferReport,\x20%s,\x20%s,\x20%s',_0x187573,_0x71ad('0xc'),JSON[_0x71ad('0xe')](_0x2939a9));if(_0x2939a9[_0x71ad('0xf')]){if(_0x2939a9[_0x71ad('0xf')][_0x71ad('0x10')]===0x1f4){logger[_0x71ad('0xf')]('WhatsappTransferReport,\x20%s,\x20%s',_0x187573,_0x2939a9[_0x71ad('0xf')]['message']);return _0x96d3db(_0x2939a9[_0x71ad('0xf')][_0x71ad('0x11')]);}logger[_0x71ad('0xf')](_0x71ad('0xb'),_0x187573,_0x2939a9[_0x71ad('0xf')]['message']);return _0x3f32e3(_0x2939a9[_0x71ad('0xf')][_0x71ad('0x11')]);}else{logger['info'](_0x71ad('0xb'),_0x187573,_0x71ad('0xc'));_0x3f32e3(_0x2939a9['result'][_0x71ad('0x11')]);}})[_0x71ad('0x12')](function(_0x47894e){logger['error'](_0x71ad('0xb'),_0x187573,_0x47894e);_0x96d3db(_0x47894e);});});} \ No newline at end of file +var _0x5b94=['moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','request\x20sent','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','WhatsappTransferReport,\x20%s,\x20%s','info','result','catch','util'];(function(_0x420516,_0x5ce5ca){var _0x16484e=function(_0x18775b){while(--_0x18775b){_0x420516['push'](_0x420516['shift']());}};_0x16484e(++_0x5ce5ca);}(_0x5b94,0x12a));var _0x45b9=function(_0x3740fe,_0x6c543c){_0x3740fe=_0x3740fe-0x0;var _0x55492b=_0x5b94[_0x3740fe];return _0x55492b;};'use strict';var _=require('lodash');var util=require(_0x45b9('0x0'));var moment=require(_0x45b9('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x45b9('0x2'));var db=require(_0x45b9('0x3'))['db'];var utils=require(_0x45b9('0x4'));var logger=require(_0x45b9('0x5'))(_0x45b9('0x6'));var config=require(_0x45b9('0x7'));var jayson=require(_0x45b9('0x8'));var client=jayson[_0x45b9('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4bc98c,_0x435bd5,_0x52edf5){return new BPromise(function(_0x3c273a,_0x216955){return client[_0x45b9('0xa')](_0x4bc98c,_0x52edf5)[_0x45b9('0xb')](function(_0x5a9462){logger['info']('WhatsappTransferReport,\x20%s,\x20%s',_0x435bd5,_0x45b9('0xc'));logger[_0x45b9('0xd')](_0x45b9('0xe'),_0x435bd5,_0x45b9('0xc'),JSON[_0x45b9('0xf')](_0x5a9462));if(_0x5a9462[_0x45b9('0x10')]){if(_0x5a9462['error'][_0x45b9('0x11')]===0x1f4){logger['error']('WhatsappTransferReport,\x20%s,\x20%s',_0x435bd5,_0x5a9462[_0x45b9('0x10')][_0x45b9('0x12')]);return _0x216955(_0x5a9462[_0x45b9('0x10')]['message']);}logger[_0x45b9('0x10')](_0x45b9('0x13'),_0x435bd5,_0x5a9462[_0x45b9('0x10')]['message']);return _0x3c273a(_0x5a9462[_0x45b9('0x10')][_0x45b9('0x12')]);}else{logger[_0x45b9('0x14')]('WhatsappTransferReport,\x20%s,\x20%s',_0x435bd5,_0x45b9('0xc'));_0x3c273a(_0x5a9462[_0x45b9('0x15')][_0x45b9('0x12')]);}})[_0x45b9('0x16')](function(_0x2eb2f8){logger['error'](_0x45b9('0x13'),_0x435bd5,_0x2eb2f8);_0x216955(_0x2eb2f8);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index ac636a3..94b3b2a 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x938d=['Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./mysqldb','./config/license','./rpc','./config/environment','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/whatsapp','./config/schedule/transcribe','./config/schedule/cloud-provider','sequelize','sync','then','default','listen','info','start','filter','exitCode','length','pm2_env','name','Online\x20apps:','map','online','status','join','None','App\x20Ready!','catch','log','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','error'];(function(_0x1d1e71,_0x166a02){var _0x309d1b=function(_0x26e7db){while(--_0x26e7db){_0x1d1e71['push'](_0x1d1e71['shift']());}};_0x309d1b(++_0x166a02);}(_0x938d,0x122));var _0xd938=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x938d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd938('0x0'));var db=require(_0xd938('0x1'))['db'];var seedDb=require('./config/seedDB');var checkLicense=require(_0xd938('0x2'));var rpc=require(_0xd938('0x3'));var config=require(_0xd938('0x4'));var logger=require('./config/logger')('app');var pm2=require(_0xd938('0x5'));var pm2Config=require(_0xd938('0x6'));var schedule=require(_0xd938('0x7'));var chat=require('./config/schedule/chat');var whatsapp=require(_0xd938('0x8'));var transcribe=require(_0xd938('0x9'));var provider=require(_0xd938('0xa'));function main(){return db[_0xd938('0xb')][_0xd938('0xc')]()[_0xd938('0xd')](function(){if(config['seedDB']){return seedDb[_0xd938('0xe')]();}})[_0xd938('0xd')](function(){return checkLicense[_0xd938('0xe')]();})[_0xd938('0xd')](function(){return rpc[_0xd938('0xf')]();})[_0xd938('0xd')](function(_0x4b05ee){logger[_0xd938('0x10')](_0x4b05ee);return chat[_0xd938('0x11')]();})[_0xd938('0xd')](function(){return whatsapp[_0xd938('0x11')]();})[_0xd938('0xd')](function(){return schedule[_0xd938('0x11')]();})[_0xd938('0xd')](function(){return transcribe[_0xd938('0x11')]();})[_0xd938('0xd')](function(){return provider[_0xd938('0x11')]();})[_0xd938('0xd')](function(_0x1c7b54){logger[_0xd938('0x10')](_0x1c7b54);return pm2['start'](pm2Config);})['then'](function(_0x5c9f99){var _0x2f07e7=_0x5c9f99[_0xd938('0x12')](function(_0x217728){return typeof _0x217728['exitCode']==='number'&&_0x217728[_0xd938('0x13')]>=0x0;});if(_0x2f07e7[_0xd938('0x14')]>0x0){throw new Error(_0x2f07e7['length']+'\x20processes\x20failed\x20at\x20startup:\x20'+_['map'](_0x2f07e7,function(_0x352648){return'\x22'+_0x352648[_0xd938('0x15')][_0xd938('0x16')]+'\x22';}));}logger['info'](_0xd938('0x17'),_[_0xd938('0x18')](_[_0xd938('0x12')](_0x5c9f99,{'status':_0xd938('0x19')}),_0xd938('0x16'))['join']());logger[_0xd938('0x10')]('Offline\x20apps:',_['map'](_[_0xd938('0x12')](_0x5c9f99,function(_0x5d0241){return _0x5d0241[_0xd938('0x1a')]!==_0xd938('0x19');}),_0xd938('0x16'))[_0xd938('0x1b')]()||_0xd938('0x1c'));console['log'](_0xd938('0x1d'));})[_0xd938('0x1e')](function(_0x1193d1){console[_0xd938('0x1f')](_0xd938('0x20'),_0x1193d1);logger[_0xd938('0x21')](_0xd938('0x22'),_0x1193d1);process[_0xd938('0x23')](0x1);});}main(); \ No newline at end of file +var _0x16d8=['start','filter','exitCode','number','length','\x20processes\x20failed\x20at\x20startup:\x20','map','pm2_env','name','online','join','status','None','App\x20Ready!','log','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','./mysqldb','./config/seedDB','./config/license','./rpc','./config/environment','./config/logger','app','./config/pm2','./config/pm2/config','./config/schedule/chat','./config/schedule/transcribe','./config/schedule/cloud-provider','sequelize','sync','then','default','info'];(function(_0x12d275,_0x349955){var _0x4396f8=function(_0x4a66cd){while(--_0x4a66cd){_0x12d275['push'](_0x12d275['shift']());}};_0x4396f8(++_0x349955);}(_0x16d8,0xa3));var _0x816d=function(_0x1bba83,_0x11243a){_0x1bba83=_0x1bba83-0x0;var _0x58ebc4=_0x16d8[_0x1bba83];return _0x58ebc4;};'use strict';var _=require('lodash');var db=require(_0x816d('0x0'))['db'];var seedDb=require(_0x816d('0x1'));var checkLicense=require(_0x816d('0x2'));var rpc=require(_0x816d('0x3'));var config=require(_0x816d('0x4'));var logger=require(_0x816d('0x5'))(_0x816d('0x6'));var pm2=require(_0x816d('0x7'));var pm2Config=require(_0x816d('0x8'));var schedule=require('./config/schedule');var chat=require(_0x816d('0x9'));var whatsapp=require('./config/schedule/whatsapp');var transcribe=require(_0x816d('0xa'));var provider=require(_0x816d('0xb'));function main(){return db[_0x816d('0xc')][_0x816d('0xd')]()[_0x816d('0xe')](function(){if(config['seedDB']){return seedDb[_0x816d('0xf')]();}})[_0x816d('0xe')](function(){return checkLicense[_0x816d('0xf')]();})['then'](function(){return rpc['listen']();})['then'](function(_0x1c0bda){logger[_0x816d('0x10')](_0x1c0bda);return chat[_0x816d('0x11')]();})[_0x816d('0xe')](function(){return whatsapp['start']();})[_0x816d('0xe')](function(){return schedule[_0x816d('0x11')]();})[_0x816d('0xe')](function(){return transcribe['start']();})[_0x816d('0xe')](function(){return provider[_0x816d('0x11')]();})['then'](function(_0x39c256){logger[_0x816d('0x10')](_0x39c256);return pm2['start'](pm2Config);})[_0x816d('0xe')](function(_0x3a50c8){var _0x4e2aa9=_0x3a50c8[_0x816d('0x12')](function(_0xa2c0f){return typeof _0xa2c0f[_0x816d('0x13')]===_0x816d('0x14')&&_0xa2c0f[_0x816d('0x13')]>=0x0;});if(_0x4e2aa9[_0x816d('0x15')]>0x0){throw new Error(_0x4e2aa9[_0x816d('0x15')]+_0x816d('0x16')+_[_0x816d('0x17')](_0x4e2aa9,function(_0x525c3b){return'\x22'+_0x525c3b[_0x816d('0x18')][_0x816d('0x19')]+'\x22';}));}logger[_0x816d('0x10')]('Online\x20apps:',_[_0x816d('0x17')](_[_0x816d('0x12')](_0x3a50c8,{'status':_0x816d('0x1a')}),_0x816d('0x19'))[_0x816d('0x1b')]());logger[_0x816d('0x10')]('Offline\x20apps:',_[_0x816d('0x17')](_[_0x816d('0x12')](_0x3a50c8,function(_0x11ff2b){return _0x11ff2b[_0x816d('0x1c')]!==_0x816d('0x1a');}),_0x816d('0x19'))[_0x816d('0x1b')]()||_0x816d('0x1d'));console['log'](_0x816d('0x1e'));})['catch'](function(_0xd77200){console[_0x816d('0x1f')](_0x816d('0x20'),_0xd77200);logger[_0x816d('0x21')](_0x816d('0x22'),_0xd77200);process[_0x816d('0x23')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index fb3a45f..e0e1834 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 _0x9ffd=['User\x20not\x20found.','canUpdate','getLicense','Forbidden','isWebrtcLicence','webrtc','isMiddleware','signToken','setTokenCookie','cookie','motion.token','redirect','/dashboards/general','send','retrieveApiKey','isNil','generateApiKey','regenerateApiKey','apiKeyIat','validatePasswordPattern','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','decryptString','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','length','unshift','encryptString','join','secret','payload','verify','randomBytes','toString','hex','floor','HS512','../../mysqldb','../../config/environment','../../config/license/hardware','../encryptor','lodash','jsonwebtoken','express-jwt','basic-auth','crypto','util','moment','secrets','session','role','fullname','name','internal','email','chatPause','mailPause','faxPause','smsPause','openchannelPause','pauseType','showWebBar','lastLoginAt','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarExpires','interface','privacyEnabled','settingsEnabled','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions','downloadAttachments','ignorePauseForPreviewCalls','selectRecallMeCampaign','chatAutoanswer','chatAutoanswerDelay','emailAutoanswer','emailAutoanswerDelay','smsAutoanswer','openchannelAutoanswerDelay','faxAutoanswer','isChatInteractionAuthorized','use','user','ChatInteraction','closed','then','disposition','unmanaged','json','Unmanaged.','Forbidden.','catch','headers','authorization','startsWith','User','find','authenticate','pass','Bearer','status','Unknown\x20authorization\x20format','query','apikey','getUuid','sub','findOne','allowedLoginAttempts','blockDuration','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','blocked','blockedAt','add','minutes','Invalid\x20API\x20access\x20key'];(function(_0x542b1c,_0x105fc0){var _0x2d12ac=function(_0x4426eb){while(--_0x4426eb){_0x542b1c['push'](_0x542b1c['shift']());}};_0x2d12ac(++_0x105fc0);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x3da22b,_0x5c7fa8){_0x3da22b=_0x3da22b-0x0;var _0x5b855a=_0x9ffd[_0x3da22b];return _0x5b855a;};'use strict';var db=require(_0xd9ff('0x0'))['db'];var config=require(_0xd9ff('0x1'));var hardwareConf=require(_0xd9ff('0x2'));var licenseUtil=require('../../config/license/util');var encryptor=require(_0xd9ff('0x3'));var _=require(_0xd9ff('0x4'));var jwt=require(_0xd9ff('0x5'));var expressJwt=require(_0xd9ff('0x6'));var compose=require('composable-middleware');var basicAuth=require(_0xd9ff('0x7'));var crypto=require(_0xd9ff('0x8'));var BPromise=require('bluebird');var util=require(_0xd9ff('0x9'));var moment=require(_0xd9ff('0xa'));var validateJwt=expressJwt({'secret':config[_0xd9ff('0xb')][_0xd9ff('0xc')]});var userAttributes=['id',_0xd9ff('0xd'),_0xd9ff('0xe'),_0xd9ff('0xf'),_0xd9ff('0x10'),_0xd9ff('0x11'),'userpic','permissions','md5secret','voicePause',_0xd9ff('0x12'),_0xd9ff('0x13'),_0xd9ff('0x14'),_0xd9ff('0x15'),_0xd9ff('0x16'),_0xd9ff('0x17'),_0xd9ff('0x18'),_0xd9ff('0x19'),'lastPauseAt','crudPermissions',_0xd9ff('0x1a'),_0xd9ff('0x1b'),_0xd9ff('0x1c'),_0xd9ff('0x1d'),_0xd9ff('0x1e'),'phoneBarDnd',_0xd9ff('0x1f'),_0xd9ff('0x20'),'phoneBarEnableSettings',_0xd9ff('0x21'),'phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk',_0xd9ff('0x22'),'userProfileId',_0xd9ff('0x23'),_0xd9ff('0x24'),_0xd9ff('0x25'),_0xd9ff('0x26'),_0xd9ff('0x27'),_0xd9ff('0x28'),_0xd9ff('0x29'),_0xd9ff('0x2a'),_0xd9ff('0x2b'),_0xd9ff('0x2c'),_0xd9ff('0x2d'),_0xd9ff('0x2e'),_0xd9ff('0x2f'),'smsAutoanswerDelay','openchannelAutoanswer',_0xd9ff('0x30'),_0xd9ff('0x31'),'faxAutoanswerDelay','whatsappAutoanswer','whatsappAutoanswerDelay','messengerSoundNotification'];exports[_0xd9ff('0x32')]=function(){return this['isAuthenticated'](!![])[_0xd9ff('0x33')](function(_0x3fd141,_0x291f52,_0x9f074e){if(_0x3fd141[_0xd9ff('0x34')]){_0x9f074e();}else{return db[_0xd9ff('0x35')]['findOne']({'where':{'id':_0x3fd141['params']['id']},'attributes':['id',_0xd9ff('0x36'),'disposition'],'raw':!![]})[_0xd9ff('0x37')](function(_0x4d86fe){if(_0x4d86fe&&_0x4d86fe[_0xd9ff('0x36')]){return _0x291f52['status'](_0x4d86fe[_0xd9ff('0x38')]===_0xd9ff('0x39')?0x195:0x193)[_0xd9ff('0x3a')]({'message':_0x4d86fe[_0xd9ff('0x38')]==='unmanaged'?_0xd9ff('0x3b'):_0xd9ff('0x3c')});}else{_0x9f074e();}})[_0xd9ff('0x3d')](function(_0x4390f7){_0x9f074e(_0x4390f7);});}});};exports['isAuthenticated']=function isAuthenticated(_0x1d3684){return compose()[_0xd9ff('0x33')](function(_0x44b5a7,_0x45fb63,_0x263d3a){var _0xe516e2;if(_0x44b5a7[_0xd9ff('0x3e')][_0xd9ff('0x3f')]){if(_[_0xd9ff('0x40')](_0x44b5a7['headers'][_0xd9ff('0x3f')],'Basic')){var _0x1d55fd=basicAuth(_0x44b5a7);db[_0xd9ff('0x41')][_0xd9ff('0x42')]({'where':{'name':_0x1d55fd['name']}})[_0xd9ff('0x37')](function(_0x3b26da){if(!_0x3b26da||!_0x3b26da[_0xd9ff('0x43')](_0x1d55fd[_0xd9ff('0x44')])){return _0x45fb63['status'](0x191)[_0xd9ff('0x3a')]({'message':'Wrong\x20credentials.'});}_0x44b5a7[_0xd9ff('0x34')]={'id':_0x3b26da['id']};_0x263d3a();})[_0xd9ff('0x3d')](function(_0x323cb5){_0x263d3a(_0x323cb5);});}else if(_[_0xd9ff('0x40')](_0x44b5a7[_0xd9ff('0x3e')][_0xd9ff('0x3f')],_0xd9ff('0x45'))){validateJwt(_0x44b5a7,_0x45fb63,_0x263d3a);}else{if(_0x1d3684){_0x263d3a();}else{return _0x45fb63[_0xd9ff('0x46')](0x193)[_0xd9ff('0x3a')]({'message':_0xd9ff('0x47')});}}}else if(_0x44b5a7[_0xd9ff('0x48')][_0xd9ff('0x49')]){try{var _0x4670e4={'audience':hardwareConf[_0xd9ff('0x4a')](),'issuer':hardwareConf['getUuid']()};verifyJwt(_0x44b5a7[_0xd9ff('0x48')][_0xd9ff('0x49')],_0x4670e4)[_0xd9ff('0x37')](function(_0x4ab10f){return db[_0xd9ff('0x41')]['find']({'where':{'id':_0x4ab10f[_0xd9ff('0x4b')]}})['then'](function(_0x20a021){_0xe516e2=_0x20a021;return db['Setting'][_0xd9ff('0x4c')]({'where':{'id':0x1},'attributes':[_0xd9ff('0x4d'),_0xd9ff('0x4e')],'raw':!![]});})['then'](function(_0x4db3f6){if(!_0xe516e2||!_['isEqual'](_0xe516e2[_0xd9ff('0x4f')],_0x4ab10f[_0xd9ff('0x50')])){return _0x45fb63[_0xd9ff('0x46')](0x191)[_0xd9ff('0x3a')]({'message':_0xd9ff('0x51')});}if(_0xe516e2[_0xd9ff('0x52')]){return _0x45fb63['status'](0x191)['json']({'message':'Invalid\x20API\x20access\x20key'});}if(_0xe516e2[_0xd9ff('0x53')]){if(_0x4db3f6[_0xd9ff('0x4e')]>0x0){if(moment(_0xe516e2[_0xd9ff('0x54')])[_0xd9ff('0x55')](_0x4db3f6['blockDuration'],_0xd9ff('0x56'))>moment()){return _0x45fb63['status'](0x191)[_0xd9ff('0x3a')]({'message':_0xd9ff('0x57')});}}else{return _0x45fb63[_0xd9ff('0x46')](0x191)[_0xd9ff('0x3a')]({'message':'Invalid\x20API\x20access\x20key'});}}_0x44b5a7[_0xd9ff('0x34')]={'id':_0xe516e2['id']};_0x263d3a();});})[_0xd9ff('0x3d')](function(){return _0x45fb63['status'](0x191)[_0xd9ff('0x3a')]({'message':_0xd9ff('0x57')});});}catch(_0x94dcd8){_0x263d3a(_0x94dcd8);}}else if(_0x1d3684){_0x263d3a();}else{return _0x45fb63[_0xd9ff('0x46')](0x193)[_0xd9ff('0x3a')]({'message':_0xd9ff('0x47')});}})['use'](function(_0x294c89,_0x116f28,_0x10533a){if(_0x294c89[_0xd9ff('0x34')]){db[_0xd9ff('0x41')]['find']({'where':{'id':_0x294c89[_0xd9ff('0x34')]['id']},'attributes':userAttributes})[_0xd9ff('0x37')](function(_0xe0bc49){if(!_0xe0bc49){return _0x116f28['status'](0x194)['json']({'message':_0xd9ff('0x58')});}_0x294c89[_0xd9ff('0x34')]=_0xe0bc49;_0x10533a();})[_0xd9ff('0x3d')](function(_0x2dfb8f){_0x10533a(_0x2dfb8f);});}else if(_0x1d3684){_0x10533a();}else{return _0x116f28[_0xd9ff('0x46')](0x194)[_0xd9ff('0x3a')]({'message':'User\x20object\x20not\x20found.'});}});};exports[_0xd9ff('0x59')]=function canUpdate(){return compose()[_0xd9ff('0x33')](function(_0x54726c,_0x1c6e88,_0x45a05e){return licenseUtil[_0xd9ff('0x5a')]()[_0xd9ff('0x37')](function(_0x2da412){if(_0x2da412['update']){_0x45a05e();}else{return _0x1c6e88['status'](0x193)['json']({'message':_0xd9ff('0x5b')});}})['catch'](function(_0x4528c1){_0x45a05e(_0x4528c1);});});};exports[_0xd9ff('0x5c')]=function isWebrtcLicence(){return compose()[_0xd9ff('0x33')](function(_0x4cfba7,_0x396736,_0x153f09){return licenseUtil['getLicense']()[_0xd9ff('0x37')](function(_0x2b72de){if(_0x2b72de[_0xd9ff('0x5d')]){_0x153f09();}else{return _0x396736[_0xd9ff('0x46')](0x193)['json']({'message':_0xd9ff('0x5b')});}})['catch'](function(_0x309189){_0x153f09(_0x309189);});});};exports['isMiddleware']=function(_0x450ca1,_0x3d91e6,_0x2bf37a){_0x450ca1[_0xd9ff('0x5e')]=!![];return _0x2bf37a();};exports[_0xd9ff('0x5f')]=function signToken(_0x540b78){return signJwt(_0x540b78);};exports[_0xd9ff('0x60')]=function(_0x3d6f11,_0x2fbe53){if(!_0x3d6f11[_0xd9ff('0x34')]){return _0x2fbe53['status'](0x194)['json']({'message':'It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.'});}var _0x7399a5={'payload':{'id':_0x3d6f11[_0xd9ff('0x34')]['id'],'role':_0x3d6f11[_0xd9ff('0x34')]['role']},'options':{'expiresIn':0x15180}};return signJwt(_0x7399a5)[_0xd9ff('0x37')](function(_0x61eec4){_0x2fbe53[_0xd9ff('0x61')](_0xd9ff('0x62'),_0x61eec4);_0x2fbe53[_0xd9ff('0x63')](_0xd9ff('0x64'));})[_0xd9ff('0x3d')](function(_0x1e1364){return _0x2fbe53[_0xd9ff('0x46')](0x1f4)[_0xd9ff('0x65')](_0x1e1364);});};exports[_0xd9ff('0x66')]=function(_0x3d6143){if(_[_0xd9ff('0x67')](_0x3d6143['apiKeyNonce'])||_[_0xd9ff('0x67')](_0x3d6143['apiKeyIat'])){return null;}else{return createJwt(_0x3d6143);}};exports[_0xd9ff('0x68')]=function(_0x5eff95){_0x5eff95[_0xd9ff('0x4f')]=generateNonce();_0x5eff95['apiKeyIat']=generateIssuedAt();return createJwt(_0x5eff95);};exports[_0xd9ff('0x69')]=function(_0x5624a0,_0x3aea70){var _0x4a45d4=_0x5624a0[_0xd9ff('0x48')]['apikey'];if(_0x4a45d4){var _0x33a76d={'nonce':_0x3aea70['apiKeyNonce'],'iat':_0x3aea70[_0xd9ff('0x6a')],'audience':hardwareConf[_0xd9ff('0x4a')](),'issuer':hardwareConf[_0xd9ff('0x4a')]()};return verifyJwt(_0x4a45d4,_0x33a76d)[_0xd9ff('0x37')](function(){return generateApiKey(_0x3aea70);});}else{throw{'message':'Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one'};}};exports[_0xd9ff('0x6b')]=function(_0x180e79){var _0x1dc00c=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x1dc00c['test'](_0x180e79))throw new db[(_0xd9ff('0x6c'))][(_0xd9ff('0x6d'))](_0xd9ff('0x6e'));return;};exports[_0xd9ff('0x6f')]=function(_0x11dd0c,_0x56e8e8,_0x27cc9e){var _0x412114=encryptor[_0xd9ff('0x70')](_0x56e8e8)[_0xd9ff('0x71')](',');for(var _0x29f36e=0x0;_0x29f36e<_0x27cc9e;_0x29f36e++){if(!_0x412114[_0x29f36e])break;if(_0x11dd0c[_0xd9ff('0x72')]()===_0x412114[_0x29f36e][_0xd9ff('0x72')]()){var _0x5bac6f=util[_0xd9ff('0x73')](_0xd9ff('0x74'),_0x27cc9e);if(_0x27cc9e===0x1){_0x5bac6f='The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.';}throw new db[(_0xd9ff('0x6c'))][(_0xd9ff('0x6d'))](_0x5bac6f);}}return;};exports['updatePasswordsHistory']=function(_0x11b0a5,_0x36d5c2){var _0x25d8d1=_0x36d5c2?encryptor['decryptString'](_0x36d5c2)['split'](','):[];if(_0x25d8d1[_0xd9ff('0x75')]===0x5){_0x25d8d1['splice'](-0x1,0x1);}_0x25d8d1[_0xd9ff('0x76')](_0x11b0a5);return encryptor[_0xd9ff('0x77')](_0x25d8d1[_0xd9ff('0x78')](','));};function signJwt(_0x102aea){var _0x53a230=BPromise['promisify'](jwt['sign'],{'context':jwt});var _0x188b58=_0x102aea[_0xd9ff('0x79')]||config[_0xd9ff('0xb')][_0xd9ff('0xc')];return new BPromise(function(_0x27dad3,_0x5b14fc){_0x53a230(_0x102aea[_0xd9ff('0x7a')],_0x188b58,_0x102aea['options'])[_0xd9ff('0x37')](function(_0x37f6a5){_0x27dad3(_0x37f6a5);})[_0xd9ff('0x3d')](function(_0x1d137f){_0x5b14fc(_0x1d137f);});});}function verifyJwt(_0x312406,_0x2d6e39,_0xed12df){var _0xfcafbe=BPromise['promisify'](jwt[_0xd9ff('0x7b')],{'context':jwt});var _0x29e2f6=_0xed12df||config['secrets']['session'];return new BPromise(function(_0x3e8766,_0x4d9226){_0xfcafbe(_0x312406,_0x29e2f6,_0x2d6e39)[_0xd9ff('0x37')](function(_0x34fca4){_0x3e8766(_0x34fca4);})['catch'](function(_0x3a6fc0){_0x4d9226(_0x3a6fc0);});});}function generateNonce(){return crypto[_0xd9ff('0x7c')](0x10)[_0xd9ff('0x7d')](_0xd9ff('0x7e'));}function generateIssuedAt(){return Math[_0xd9ff('0x7f')](Date['now']()/0x3e8)[_0xd9ff('0x7d')]();}function createJwt(_0x5b497b){var _0x57032e={'payload':{'iat':_0x5b497b[_0xd9ff('0x6a')],'nonce':_0x5b497b[_0xd9ff('0x4f')]},'options':{'algorithm':_0xd9ff('0x80'),'subject':_0x5b497b['id'][_0xd9ff('0x7d')](),'issuer':hardwareConf['getUuid'](),'audience':hardwareConf[_0xd9ff('0x4a')]()}};return signJwt(_0x57032e)[_0xd9ff('0x37')](function(_0x358ccd){return{'iat':_0x5b497b[_0xd9ff('0x6a')],'nonce':_0x5b497b[_0xd9ff('0x4f')],'token':_0x358ccd};});} \ No newline at end of file +var _0x9c00=['floor','toString','../../mysqldb','../../config/environment','../encryptor','lodash','express-jwt','composable-middleware','basic-auth','crypto','bluebird','secrets','session','role','fullname','name','email','userpic','permissions','md5secret','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','pauseType','showWebBar','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','interface','userProfileId','privacyEnabled','settingsEnabled','downloadVoiceRecordings','ignorePauseForPreviewCalls','chatAutoanswer','chatAutoanswerDelay','emailAutoanswer','smsAutoanswer','smsAutoanswerDelay','openchannelAutoanswer','openchannelAutoanswerDelay','faxAutoanswer','faxAutoanswerDelay','whatsappAutoanswer','messengerSoundNotification','isChatInteractionAuthorized','isAuthenticated','use','user','ChatInteraction','findOne','closed','disposition','status','unmanaged','json','Unmanaged.','Forbidden.','catch','headers','authorization','startsWith','User','find','then','authenticate','pass','Wrong\x20credentials.','Unknown\x20authorization\x20format','query','apikey','getUuid','sub','Setting','blockDuration','isEqual','apiKeyNonce','disabled','Invalid\x20API\x20access\x20key','blocked','blockedAt','add','minutes','canUpdate','Forbidden','isWebrtcLicence','getLicense','webrtc','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','motion.token','redirect','/dashboards/general','send','retrieveApiKey','isNil','apiKeyIat','generateApiKey','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','decryptString','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.','length','splice','unshift','encryptString','sign','secret','payload','options','promisify','randomBytes','hex'];(function(_0x45268b,_0x52c8f7){var _0x77a556=function(_0x2b49c1){while(--_0x2b49c1){_0x45268b['push'](_0x45268b['shift']());}};_0x77a556(++_0x52c8f7);}(_0x9c00,0x1a0));var _0x09c0=function(_0x1bd85d,_0xdc683f){_0x1bd85d=_0x1bd85d-0x0;var _0xd40669=_0x9c00[_0x1bd85d];return _0xd40669;};'use strict';var db=require(_0x09c0('0x0'))['db'];var config=require(_0x09c0('0x1'));var hardwareConf=require('../../config/license/hardware');var licenseUtil=require('../../config/license/util');var encryptor=require(_0x09c0('0x2'));var _=require(_0x09c0('0x3'));var jwt=require('jsonwebtoken');var expressJwt=require(_0x09c0('0x4'));var compose=require(_0x09c0('0x5'));var basicAuth=require(_0x09c0('0x6'));var crypto=require(_0x09c0('0x7'));var BPromise=require(_0x09c0('0x8'));var util=require('util');var moment=require('moment');var validateJwt=expressJwt({'secret':config[_0x09c0('0x9')][_0x09c0('0xa')]});var userAttributes=['id',_0x09c0('0xb'),_0x09c0('0xc'),_0x09c0('0xd'),'internal',_0x09c0('0xe'),_0x09c0('0xf'),_0x09c0('0x10'),_0x09c0('0x11'),_0x09c0('0x12'),_0x09c0('0x13'),_0x09c0('0x14'),_0x09c0('0x15'),_0x09c0('0x16'),_0x09c0('0x17'),_0x09c0('0x18'),_0x09c0('0x19'),_0x09c0('0x1a'),_0x09c0('0x1b'),_0x09c0('0x1c'),_0x09c0('0x1d'),_0x09c0('0x1e'),_0x09c0('0x1f'),_0x09c0('0x20'),_0x09c0('0x21'),_0x09c0('0x22'),_0x09c0('0x23'),_0x09c0('0x24'),_0x09c0('0x25'),_0x09c0('0x26'),_0x09c0('0x27'),'phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk',_0x09c0('0x28'),_0x09c0('0x29'),_0x09c0('0x2a'),_0x09c0('0x2b'),'wssPort',_0x09c0('0x2c'),'downloadOmnichannelInteractions','downloadAttachments',_0x09c0('0x2d'),'selectRecallMeCampaign',_0x09c0('0x2e'),_0x09c0('0x2f'),_0x09c0('0x30'),'emailAutoanswerDelay',_0x09c0('0x31'),_0x09c0('0x32'),_0x09c0('0x33'),_0x09c0('0x34'),_0x09c0('0x35'),_0x09c0('0x36'),_0x09c0('0x37'),'whatsappAutoanswerDelay',_0x09c0('0x38')];exports[_0x09c0('0x39')]=function(){return this[_0x09c0('0x3a')](!![])[_0x09c0('0x3b')](function(_0x59a76a,_0x4f6824,_0x321bcc){if(_0x59a76a[_0x09c0('0x3c')]){_0x321bcc();}else{return db[_0x09c0('0x3d')][_0x09c0('0x3e')]({'where':{'id':_0x59a76a['params']['id']},'attributes':['id',_0x09c0('0x3f'),_0x09c0('0x40')],'raw':!![]})['then'](function(_0x2c7202){if(_0x2c7202&&_0x2c7202[_0x09c0('0x3f')]){return _0x4f6824[_0x09c0('0x41')](_0x2c7202[_0x09c0('0x40')]===_0x09c0('0x42')?0x195:0x193)[_0x09c0('0x43')]({'message':_0x2c7202[_0x09c0('0x40')]===_0x09c0('0x42')?_0x09c0('0x44'):_0x09c0('0x45')});}else{_0x321bcc();}})[_0x09c0('0x46')](function(_0x5e53ac){_0x321bcc(_0x5e53ac);});}});};exports[_0x09c0('0x3a')]=function isAuthenticated(_0x1bdde9){return compose()['use'](function(_0x1d09e0,_0x5aa0b9,_0x3f5b10){var _0x4d6bdc;if(_0x1d09e0[_0x09c0('0x47')][_0x09c0('0x48')]){if(_[_0x09c0('0x49')](_0x1d09e0[_0x09c0('0x47')]['authorization'],'Basic')){var _0x17c374=basicAuth(_0x1d09e0);db[_0x09c0('0x4a')][_0x09c0('0x4b')]({'where':{'name':_0x17c374['name']}})[_0x09c0('0x4c')](function(_0x4bdae9){if(!_0x4bdae9||!_0x4bdae9[_0x09c0('0x4d')](_0x17c374[_0x09c0('0x4e')])){return _0x5aa0b9[_0x09c0('0x41')](0x191)['json']({'message':_0x09c0('0x4f')});}_0x1d09e0[_0x09c0('0x3c')]={'id':_0x4bdae9['id']};_0x3f5b10();})[_0x09c0('0x46')](function(_0x184c0b){_0x3f5b10(_0x184c0b);});}else if(_[_0x09c0('0x49')](_0x1d09e0[_0x09c0('0x47')][_0x09c0('0x48')],'Bearer')){validateJwt(_0x1d09e0,_0x5aa0b9,_0x3f5b10);}else{if(_0x1bdde9){_0x3f5b10();}else{return _0x5aa0b9[_0x09c0('0x41')](0x193)[_0x09c0('0x43')]({'message':_0x09c0('0x50')});}}}else if(_0x1d09e0[_0x09c0('0x51')][_0x09c0('0x52')]){try{var _0x50a37e={'audience':hardwareConf[_0x09c0('0x53')](),'issuer':hardwareConf[_0x09c0('0x53')]()};verifyJwt(_0x1d09e0[_0x09c0('0x51')][_0x09c0('0x52')],_0x50a37e)[_0x09c0('0x4c')](function(_0x541d0a){return db[_0x09c0('0x4a')][_0x09c0('0x4b')]({'where':{'id':_0x541d0a[_0x09c0('0x54')]}})[_0x09c0('0x4c')](function(_0x419d1c){_0x4d6bdc=_0x419d1c;return db[_0x09c0('0x55')][_0x09c0('0x3e')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0x09c0('0x56')],'raw':!![]});})[_0x09c0('0x4c')](function(_0x3ab3d9){if(!_0x4d6bdc||!_[_0x09c0('0x57')](_0x4d6bdc[_0x09c0('0x58')],_0x541d0a['nonce'])){return _0x5aa0b9['status'](0x191)['json']({'message':'API\x20access\x20key\x20is\x20not\x20valid\x20anymore'});}if(_0x4d6bdc[_0x09c0('0x59')]){return _0x5aa0b9[_0x09c0('0x41')](0x191)[_0x09c0('0x43')]({'message':_0x09c0('0x5a')});}if(_0x4d6bdc[_0x09c0('0x5b')]){if(_0x3ab3d9['blockDuration']>0x0){if(moment(_0x4d6bdc[_0x09c0('0x5c')])[_0x09c0('0x5d')](_0x3ab3d9['blockDuration'],_0x09c0('0x5e'))>moment()){return _0x5aa0b9['status'](0x191)[_0x09c0('0x43')]({'message':'Invalid\x20API\x20access\x20key'});}}else{return _0x5aa0b9[_0x09c0('0x41')](0x191)[_0x09c0('0x43')]({'message':'Invalid\x20API\x20access\x20key'});}}_0x1d09e0[_0x09c0('0x3c')]={'id':_0x4d6bdc['id']};_0x3f5b10();});})[_0x09c0('0x46')](function(){return _0x5aa0b9['status'](0x191)[_0x09c0('0x43')]({'message':_0x09c0('0x5a')});});}catch(_0xb8a592){_0x3f5b10(_0xb8a592);}}else if(_0x1bdde9){_0x3f5b10();}else{return _0x5aa0b9[_0x09c0('0x41')](0x193)[_0x09c0('0x43')]({'message':_0x09c0('0x50')});}})['use'](function(_0x24bb97,_0x3e0686,_0x2d6344){if(_0x24bb97['user']){db[_0x09c0('0x4a')][_0x09c0('0x4b')]({'where':{'id':_0x24bb97[_0x09c0('0x3c')]['id']},'attributes':userAttributes})['then'](function(_0x184340){if(!_0x184340){return _0x3e0686[_0x09c0('0x41')](0x194)['json']({'message':'User\x20not\x20found.'});}_0x24bb97[_0x09c0('0x3c')]=_0x184340;_0x2d6344();})[_0x09c0('0x46')](function(_0x576f10){_0x2d6344(_0x576f10);});}else if(_0x1bdde9){_0x2d6344();}else{return _0x3e0686[_0x09c0('0x41')](0x194)[_0x09c0('0x43')]({'message':'User\x20object\x20not\x20found.'});}});};exports[_0x09c0('0x5f')]=function canUpdate(){return compose()[_0x09c0('0x3b')](function(_0x2e7d4f,_0x33fc26,_0x2cef94){return licenseUtil['getLicense']()[_0x09c0('0x4c')](function(_0x499fe8){if(_0x499fe8['update']){_0x2cef94();}else{return _0x33fc26[_0x09c0('0x41')](0x193)[_0x09c0('0x43')]({'message':_0x09c0('0x60')});}})[_0x09c0('0x46')](function(_0x252496){_0x2cef94(_0x252496);});});};exports[_0x09c0('0x61')]=function isWebrtcLicence(){return compose()['use'](function(_0x5e239a,_0x502eff,_0xf54a1f){return licenseUtil[_0x09c0('0x62')]()[_0x09c0('0x4c')](function(_0x56ec01){if(_0x56ec01[_0x09c0('0x63')]){_0xf54a1f();}else{return _0x502eff[_0x09c0('0x41')](0x193)[_0x09c0('0x43')]({'message':_0x09c0('0x60')});}})[_0x09c0('0x46')](function(_0x7ba10f){_0xf54a1f(_0x7ba10f);});});};exports[_0x09c0('0x64')]=function(_0x2b3c56,_0x3f6d14,_0x38085c){_0x2b3c56[_0x09c0('0x64')]=!![];return _0x38085c();};exports[_0x09c0('0x65')]=function signToken(_0x28bd8a){return signJwt(_0x28bd8a);};exports[_0x09c0('0x66')]=function(_0x332b69,_0x32abbe){if(!_0x332b69[_0x09c0('0x3c')]){return _0x32abbe[_0x09c0('0x41')](0x194)[_0x09c0('0x43')]({'message':_0x09c0('0x67')});}var _0x5b27a4={'payload':{'id':_0x332b69[_0x09c0('0x3c')]['id'],'role':_0x332b69[_0x09c0('0x3c')][_0x09c0('0xb')]},'options':{'expiresIn':0x15180}};return signJwt(_0x5b27a4)[_0x09c0('0x4c')](function(_0x22f8b7){_0x32abbe['cookie'](_0x09c0('0x68'),_0x22f8b7);_0x32abbe[_0x09c0('0x69')](_0x09c0('0x6a'));})['catch'](function(_0xe0b82a){return _0x32abbe[_0x09c0('0x41')](0x1f4)[_0x09c0('0x6b')](_0xe0b82a);});};exports[_0x09c0('0x6c')]=function(_0x55b0f0){if(_[_0x09c0('0x6d')](_0x55b0f0[_0x09c0('0x58')])||_['isNil'](_0x55b0f0[_0x09c0('0x6e')])){return null;}else{return createJwt(_0x55b0f0);}};exports[_0x09c0('0x6f')]=function(_0x12f881){_0x12f881[_0x09c0('0x58')]=generateNonce();_0x12f881[_0x09c0('0x6e')]=generateIssuedAt();return createJwt(_0x12f881);};exports[_0x09c0('0x70')]=function(_0x3ebabb,_0x4987cf){var _0x4b6402=_0x3ebabb[_0x09c0('0x51')][_0x09c0('0x52')];if(_0x4b6402){var _0x1ab662={'nonce':_0x4987cf['apiKeyNonce'],'iat':_0x4987cf[_0x09c0('0x6e')],'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0x09c0('0x53')]()};return verifyJwt(_0x4b6402,_0x1ab662)[_0x09c0('0x4c')](function(){return generateApiKey(_0x4987cf);});}else{throw{'message':_0x09c0('0x71')};}};exports[_0x09c0('0x72')]=function(_0x1df729){var _0xa94cfa=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0xa94cfa[_0x09c0('0x73')](_0x1df729))throw new db['Sequelize'][(_0x09c0('0x74'))](_0x09c0('0x75'));return;};exports[_0x09c0('0x76')]=function(_0x270ff2,_0x3a6845,_0x219195){var _0x1ad79f=encryptor[_0x09c0('0x77')](_0x3a6845)[_0x09c0('0x78')](',');for(var _0x123ad7=0x0;_0x123ad7<_0x219195;_0x123ad7++){if(!_0x1ad79f[_0x123ad7])break;if(_0x270ff2[_0x09c0('0x79')]()===_0x1ad79f[_0x123ad7]['toLowerCase']()){var _0x34cc0a=util[_0x09c0('0x7a')](_0x09c0('0x7b'),_0x219195);if(_0x219195===0x1){_0x34cc0a=_0x09c0('0x7c');}throw new db['Sequelize'][(_0x09c0('0x74'))](_0x34cc0a);}}return;};exports['updatePasswordsHistory']=function(_0x29205f,_0x9a4f4){var _0x1cfdb3=_0x9a4f4?encryptor['decryptString'](_0x9a4f4)['split'](','):[];if(_0x1cfdb3[_0x09c0('0x7d')]===0x5){_0x1cfdb3[_0x09c0('0x7e')](-0x1,0x1);}_0x1cfdb3[_0x09c0('0x7f')](_0x29205f);return encryptor[_0x09c0('0x80')](_0x1cfdb3['join'](','));};function signJwt(_0x247c3d){var _0x17eba7=BPromise['promisify'](jwt[_0x09c0('0x81')],{'context':jwt});var _0x47722f=_0x247c3d[_0x09c0('0x82')]||config[_0x09c0('0x9')]['session'];return new BPromise(function(_0x8d27a5,_0x24f23b){_0x17eba7(_0x247c3d[_0x09c0('0x83')],_0x47722f,_0x247c3d[_0x09c0('0x84')])[_0x09c0('0x4c')](function(_0x4613e0){_0x8d27a5(_0x4613e0);})[_0x09c0('0x46')](function(_0x63dda8){_0x24f23b(_0x63dda8);});});}function verifyJwt(_0x17931c,_0x2722fb,_0x85adc7){var _0x2906cb=BPromise[_0x09c0('0x85')](jwt['verify'],{'context':jwt});var _0x13f3af=_0x85adc7||config[_0x09c0('0x9')][_0x09c0('0xa')];return new BPromise(function(_0x4163fc,_0x356dcd){_0x2906cb(_0x17931c,_0x13f3af,_0x2722fb)['then'](function(_0x1205da){_0x4163fc(_0x1205da);})[_0x09c0('0x46')](function(_0x2e54f1){_0x356dcd(_0x2e54f1);});});}function generateNonce(){return crypto[_0x09c0('0x86')](0x10)['toString'](_0x09c0('0x87'));}function generateIssuedAt(){return Math[_0x09c0('0x88')](Date['now']()/0x3e8)[_0x09c0('0x89')]();}function createJwt(_0x1920c9){var _0x20dd29={'payload':{'iat':_0x1920c9[_0x09c0('0x6e')],'nonce':_0x1920c9[_0x09c0('0x58')]},'options':{'algorithm':'HS512','subject':_0x1920c9['id'][_0x09c0('0x89')](),'issuer':hardwareConf[_0x09c0('0x53')](),'audience':hardwareConf[_0x09c0('0x53')]()}};return signJwt(_0x20dd29)[_0x09c0('0x4c')](function(_0xe5af77){return{'iat':_0x1920c9['apiKeyIat'],'nonce':_0x1920c9[_0x09c0('0x58')],'token':_0xe5af77};});} \ No newline at end of file diff --git a/server/components/contacts/index.js b/server/components/contacts/index.js index e83fbdd..28a652d 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 _0x8a2f=['countFilteredContacts','User','buildContactsQuery','clause','getFilteredContacts','rows','describe','CmContact','keys','startsWith','cf_','map','findOne','slice','all','length','fieldType','findAll','skipContactsQuery','resolve','then','parseAdvancedSearchFilter','search','parseQueryParameters','default','where','fields','filter','user','tags','skip','checkListsRestrictions','ids','tag'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x8a2f,0x99));var _0xf8a2=function(_0xbf0c1e,_0x53bf9f){_0xbf0c1e=_0xbf0c1e-0x0;var _0x1adb3c=_0x8a2f[_0xbf0c1e];return _0x1adb3c;};'use strict';var _=require('lodash');var sqlUtils=require('./sql-utils');var db=require('../../mysqldb')['db'];exports[_0xf8a2('0x0')]=function(_0x593c6f,_0x3791a9,_0x408305,_0x270fe3){var _0x33ca9d={'count':0x0,'rows':[]};var _0x5bf106=sqlUtils[_0xf8a2('0x1')](_0x3791a9,_0x593c6f);if(_0x5bf106){return Promise[_0xf8a2('0x2')](_0x33ca9d);}var _0x1117af=sqlUtils['getContactsSubquery']();var _0x4dbbb1={};var _0x5256c6=![];var _0x50b51a=![];return Promise[_0xf8a2('0x2')]()[_0xf8a2('0x3')](function(){if(_0x593c6f['search']){return sqlUtils[_0xf8a2('0x4')](_0x593c6f[_0xf8a2('0x5')],_0x270fe3);}else{return sqlUtils[_0xf8a2('0x6')](_0x593c6f,_0x270fe3);}})[_0xf8a2('0x3')](function(_0x14e6f5){_0x1117af['where'](_0x14e6f5[_0xf8a2('0x7')]);_0x1117af[_0xf8a2('0x8')](_0x14e6f5[_0xf8a2('0x9')]);_0x1117af[_0xf8a2('0x8')](_0x14e6f5[_0xf8a2('0xa')]);_0x1117af[_0xf8a2('0x8')](_0x14e6f5[_0xf8a2('0xb')]['clause']);_0x4dbbb1=_0x14e6f5[_0xf8a2('0xc')];_0x50b51a=_0x14e6f5[_0xf8a2('0xb')][_0xf8a2('0xd')];return sqlUtils[_0xf8a2('0xe')](_0x3791a9,_0x593c6f,_0x50b51a);})[_0xf8a2('0x3')](function(_0x12a0d9){_0x1117af['where'](_0x12a0d9);var _0x1a04fe=_0x593c6f[_0xf8a2('0x5')]?_0x4dbbb1[_0xf8a2('0xf')]:_0x593c6f[_0xf8a2('0x10')];_0x5256c6=_0x1a04fe?!![]:![];return sqlUtils[_0xf8a2('0x11')](_0x1117af,_0x1a04fe);})[_0xf8a2('0x3')](function(_0x3fc1e1){_0x33ca9d['count']=_0x3fc1e1;if(_0x33ca9d['count']===0x0){return;}if(_0x593c6f[_0xf8a2('0x12')]){_0x50b51a=!![];}return sqlUtils[_0xf8a2('0x13')](_0x1117af,_0x593c6f[_0xf8a2('0x9')],_0x408305,_0x5256c6,_0x4dbbb1[_0xf8a2('0x14')],_0x50b51a);})[_0xf8a2('0x3')](function(_0x554c85){if(!_0x554c85){return[];}return sqlUtils[_0xf8a2('0x15')](_0x554c85,_0x593c6f,_0x408305);})[_0xf8a2('0x3')](function(_0x1fb7e2){_0x33ca9d[_0xf8a2('0x16')]=_0x1fb7e2;return _0x33ca9d;})['catch'](function(_0x286a4f){throw _0x286a4f;});};exports[_0xf8a2('0x17')]=function(){var _0xbea780={};var _0x55c2c3=[];return db[_0xf8a2('0x18')][_0xf8a2('0x17')]()['then'](function(_0x4512cc){_0xbea780=_0x4512cc;var _0x48778b=Object[_0xf8a2('0x19')](_0xbea780)[_0xf8a2('0xa')](function(_0x26e144){return _[_0xf8a2('0x1a')](_0x26e144,_0xf8a2('0x1b'))?_0x26e144:undefined;});var _0x266650=_0x48778b[_0xf8a2('0x1c')](function(_0x5a0088){return db['CmCustomField'][_0xf8a2('0x1d')]({'where':{'id':_0x5a0088[_0xf8a2('0x1e')](0x3)},'raw':!![]});});return Promise[_0xf8a2('0x1f')](_0x266650);})[_0xf8a2('0x3')](function(_0x10ca99){for(var _0x2feb16=0x0;_0x2feb16<_0x10ca99[_0xf8a2('0x20')];_0x2feb16++){if(_0x10ca99[_0x2feb16]){var _0x311d15=_0xf8a2('0x1b')+_0x10ca99[_0x2feb16]['id'];_0xbea780[_0x311d15][_0xf8a2('0x21')]=_0x10ca99[_0x2feb16]['type'];}}_0x55c2c3=_[_0xf8a2('0x1c')](Object[_0xf8a2('0x19')](_0xbea780),function(_0x357afe){return{'name':_0x357afe,'type':_0xbea780[_0x357afe]['type']};});return _0x55c2c3;})['catch'](function(_0x5e21e3){throw _0x5e21e3;});}; \ No newline at end of file +var _0x9c9d=['./sql-utils','../../mysqldb','findAll','getContactsSubquery','resolve','search','parseAdvancedSearchFilter','parseQueryParameters','then','where','default','fields','user','checkListsRestrictions','ids','count','User','buildContactsQuery','clause','getFilteredContacts','catch','describe','keys','filter','startsWith','cf_','map','CmCustomField','findOne','slice','all','length'];(function(_0x250d2a,_0x2983be){var _0x5738fa=function(_0x3cbde0){while(--_0x3cbde0){_0x250d2a['push'](_0x250d2a['shift']());}};_0x5738fa(++_0x2983be);}(_0x9c9d,0x100));var _0xd9c9=function(_0xe0a2e6,_0x2c2b05){_0xe0a2e6=_0xe0a2e6-0x0;var _0x2bac4d=_0x9c9d[_0xe0a2e6];return _0x2bac4d;};'use strict';var _=require('lodash');var sqlUtils=require(_0xd9c9('0x0'));var db=require(_0xd9c9('0x1'))['db'];exports[_0xd9c9('0x2')]=function(_0x5ca845,_0x2017b8,_0x20455d,_0x5ce546){var _0x28337e={'count':0x0,'rows':[]};var _0x2c69ae=sqlUtils['skipContactsQuery'](_0x2017b8,_0x5ca845);if(_0x2c69ae){return Promise['resolve'](_0x28337e);}var _0x3a4905=sqlUtils[_0xd9c9('0x3')]();var _0x2bc3ae={};var _0x27e0ad=![];var _0x2054a5=![];return Promise[_0xd9c9('0x4')]()['then'](function(){if(_0x5ca845[_0xd9c9('0x5')]){return sqlUtils[_0xd9c9('0x6')](_0x5ca845[_0xd9c9('0x5')],_0x5ce546);}else{return sqlUtils[_0xd9c9('0x7')](_0x5ca845,_0x5ce546);}})[_0xd9c9('0x8')](function(_0x28b7d9){_0x3a4905[_0xd9c9('0x9')](_0x28b7d9[_0xd9c9('0xa')]);_0x3a4905['where'](_0x28b7d9[_0xd9c9('0xb')]);_0x3a4905[_0xd9c9('0x9')](_0x28b7d9['filter']);_0x3a4905[_0xd9c9('0x9')](_0x28b7d9['user']['clause']);_0x2bc3ae=_0x28b7d9['tags'];_0x2054a5=_0x28b7d9[_0xd9c9('0xc')]['skip'];return sqlUtils[_0xd9c9('0xd')](_0x2017b8,_0x5ca845,_0x2054a5);})[_0xd9c9('0x8')](function(_0x1e272d){_0x3a4905[_0xd9c9('0x9')](_0x1e272d);var _0x4115f6=_0x5ca845[_0xd9c9('0x5')]?_0x2bc3ae[_0xd9c9('0xe')]:_0x5ca845['tag'];_0x27e0ad=_0x4115f6?!![]:![];return sqlUtils['countFilteredContacts'](_0x3a4905,_0x4115f6);})['then'](function(_0x9399f0){_0x28337e[_0xd9c9('0xf')]=_0x9399f0;if(_0x28337e['count']===0x0){return;}if(_0x5ca845[_0xd9c9('0x10')]){_0x2054a5=!![];}return sqlUtils[_0xd9c9('0x11')](_0x3a4905,_0x5ca845[_0xd9c9('0xb')],_0x20455d,_0x27e0ad,_0x2bc3ae[_0xd9c9('0x12')],_0x2054a5);})['then'](function(_0x3c972f){if(!_0x3c972f){return[];}return sqlUtils[_0xd9c9('0x13')](_0x3c972f,_0x5ca845,_0x20455d);})[_0xd9c9('0x8')](function(_0x58829b){_0x28337e['rows']=_0x58829b;return _0x28337e;})[_0xd9c9('0x14')](function(_0x5bcb73){throw _0x5bcb73;});};exports[_0xd9c9('0x15')]=function(){var _0x18d7e8={};var _0x474271=[];return db['CmContact'][_0xd9c9('0x15')]()[_0xd9c9('0x8')](function(_0x242b29){_0x18d7e8=_0x242b29;var _0x504c3a=Object[_0xd9c9('0x16')](_0x18d7e8)[_0xd9c9('0x17')](function(_0x25f2bd){return _[_0xd9c9('0x18')](_0x25f2bd,_0xd9c9('0x19'))?_0x25f2bd:undefined;});var _0x326c45=_0x504c3a[_0xd9c9('0x1a')](function(_0x5233dd){return db[_0xd9c9('0x1b')][_0xd9c9('0x1c')]({'where':{'id':_0x5233dd[_0xd9c9('0x1d')](0x3)},'raw':!![]});});return Promise[_0xd9c9('0x1e')](_0x326c45);})['then'](function(_0xb92885){for(var _0x764eec=0x0;_0x764eec<_0xb92885[_0xd9c9('0x1f')];_0x764eec++){if(_0xb92885[_0x764eec]){var _0x4b977a=_0xd9c9('0x19')+_0xb92885[_0x764eec]['id'];_0x18d7e8[_0x4b977a]['fieldType']=_0xb92885[_0x764eec]['type'];}}_0x474271=_['map'](Object['keys'](_0x18d7e8),function(_0x347134){return{'name':_0x347134,'type':_0x18d7e8[_0x347134]['type']};});return _0x474271;})[_0xd9c9('0x14')](function(_0x3bea6f){throw _0x3bea6f;});}; \ No newline at end of file diff --git a/server/components/contacts/sql-utils.js b/server/components/contacts/sql-utils.js index 0036802..6439da5 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 _0xbbe6=['parseSearch','sqlOperator','conditions','find','dateOfBirth','datetime','castTo','DATE','buildExpression','type','default','text','start','value','end','Tag','map','clause','and','tags','User','user','uc.UserId\x20=\x20?','skip','keys','name','compact','Contact','c.ListId\x20IN\x20?','concat','\x20=\x20?','then','fields','tag','filter','resolve','getLists','attributes','group','c.id','limit','offset','subqry.id','having','order','DESC','subqry.','from','color','Sequelize','QueryTypes','SELECT','sequelize','toString','Tags','clone','isEmpty','query','COUNT(*)','exports','lodash','squel','../parsers/advancedSearch','../parsers/qs','../interaction/utils','role','agent','search','ListId','autocomplete','true','select','cm_contacts','where','c.deletedAt\x20IS\x20NULL','subqry','cm_user_has_contacts','uc.CmContactId\x20=\x20','.id','cm_contact_has_tags','ct.CmContactId\x20=\x20','left_join','tools_tags','t.id\x20=\x20ct.TagId','firstName','email','createdAt','updatedAt','TagIds','push','forEach','field','GROUP_CONCAT(DISTINCT\x20t.id)','expr','getSelectedTags','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','isNumeric','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?'];(function(_0xfb23c1,_0xb0d570){var _0x5d87ce=function(_0x570655){while(--_0x570655){_0xfb23c1['push'](_0xfb23c1['shift']());}};_0x5d87ce(++_0xb0d570);}(_0xbbe6,0x114));var _0x6bbe=function(_0x42f5bc,_0x49f3b5){_0x42f5bc=_0x42f5bc-0x0;var _0x23ab80=_0xbbe6[_0x42f5bc];return _0x23ab80;};'use strict';var _=require(_0x6bbe('0x0'));var squel=require(_0x6bbe('0x1'));var as=require(_0x6bbe('0x2'));var qs=require(_0x6bbe('0x3'));var utils=require(_0x6bbe('0x4'));var db=require('../../mysqldb')['db'];function skipContactsQuery(_0x40eff5,_0x35c484){var _0x64d4f2=![];if(_0x40eff5[_0x6bbe('0x5')]===_0x6bbe('0x6')&&!_0x35c484[_0x6bbe('0x7')]&&!_0x35c484[_0x6bbe('0x8')]&&_0x35c484[_0x6bbe('0x9')]!==_0x6bbe('0xa')){_0x64d4f2=!![];}return _0x64d4f2;}function getContactsSubquery(){return squel[_0x6bbe('0xb')]()['from'](_0x6bbe('0xc'),'c')[_0x6bbe('0xd')](_0x6bbe('0xe'));}function applyJoinClauses(_0x1c14cc,_0x47a9b4){var _0x42f445=_0x47a9b4?'c':_0x6bbe('0xf');_0x1c14cc['left_join'](_0x6bbe('0x10'),'uc',_0x6bbe('0x11')+_0x42f445+_0x6bbe('0x12'))['left_join'](_0x6bbe('0x13'),'ct',_0x6bbe('0x14')+_0x42f445+_0x6bbe('0x12'))[_0x6bbe('0x15')](_0x6bbe('0x16'),'t',_0x6bbe('0x17'));return _0x1c14cc;}function addFieldsToQuery(_0x640009,_0x15af8a,_0x523c0f,_0x41038c,_0x2073bd){var _0x3a8d61=_0x2073bd?'c':'subqry';if(!_0x15af8a){_0x15af8a=['id',_0x6bbe('0x18'),'lastName','phone','mobile','fax',_0x6bbe('0x19'),_0x6bbe('0x8'),'CompanyId',_0x6bbe('0x1a'),_0x6bbe('0x1b'),'deletedAt',_0x6bbe('0x1c')];}else if(!_0x15af8a['includes']('id')){_0x15af8a[_0x6bbe('0x1d')]('id');}var _0x397031=_0x523c0f&&_0x2073bd||!_0x523c0f&&!_0x2073bd;if(_0x41038c){_0x397031=_0x41038c&&_0x2073bd||!_0x41038c&&!_0x2073bd;}_0x15af8a[_0x6bbe('0x1e')](function(_0x5f1f14){if(_0x5f1f14===_0x6bbe('0x1c')){if(_0x397031){_0x640009[_0x6bbe('0x1f')](_0x6bbe('0x20'),_0x5f1f14);}else if(_0x523c0f||_0x41038c){_0x640009['field'](_0x3a8d61+'.'+_0x5f1f14);}}else{_0x640009[_0x6bbe('0x1f')](_0x3a8d61+'.'+_0x5f1f14);}});return _0x640009;}function getSqlClauses(){var _0x4170e3={'default':squel['expr'](),'fields':squel['expr'](),'filter':squel[_0x6bbe('0x21')](),'tags':{'clause':squel[_0x6bbe('0x21')](),'ids':null},'user':{'clause':squel['expr'](),'skip':![]}};return _0x4170e3;}function parseTagParameter(_0x428f52){var _0x59ccf3=squel[_0x6bbe('0x21')]();if(_0x428f52){var _0x45d22e=utils[_0x6bbe('0x22')](_0x428f52);_0x45d22e[_0x6bbe('0x1e')](function(_0xcf617d){_0x59ccf3['or'](_0x6bbe('0x23'),'%,'+_0xcf617d+',%');});}return _0x59ccf3;}function parseSearchFilter(_0x15a704){var _0x4f60c5=squel[_0x6bbe('0x21')]();if(_0x15a704){var _0x4c9135=_0x15a704[_0x6bbe('0x24')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(_0x4c9135[_0x6bbe('0x25')]('\x20')[_0x6bbe('0x26')]>0x1){_0x4f60c5['or'](_0x6bbe('0x27'),qs[_0x6bbe('0x28')](_0x4c9135,!![]),null);}else{if(qs[_0x6bbe('0x29')](_0x4c9135)){_0x4f60c5['or'](_0x6bbe('0x2a'),_0x4c9135+'%');_0x4f60c5['or'](_0x6bbe('0x2b'),_0x4c9135+'%');_0x4f60c5['or']('c.mobile\x20LIKE\x20?',_0x4c9135+'%');_0x4f60c5['or'](_0x6bbe('0x2c'),_0x4c9135+'%');}else if(qs[_0x6bbe('0x2d')](_0x4c9135)){_0x4f60c5['or'](_0x6bbe('0x2e'),_0x4c9135+'%');}else{_0x4f60c5['or'](_0x6bbe('0x2f'),'%'+_0x4c9135+'%');_0x4f60c5['or']('c.lastName\x20LIKE\x20?','%'+_0x4c9135+'%');_0x4f60c5['or'](_0x6bbe('0x2e'),'%'+_0x4c9135+'%');}}}return _0x4f60c5;}function parseAdvancedSearchFilter(_0x536a8e,_0x310864){var _0x50a75e=getSqlClauses();var _0x4ef4f3=as[_0x6bbe('0x30')](_0x536a8e);var _0x1ca0dd=_0x4ef4f3[_0x6bbe('0x31')];for(var _0x41e49f=0x0;_0x41e49f<_0x4ef4f3[_0x6bbe('0x32')][_0x6bbe('0x26')];_0x41e49f++){var _0x4abf83=_0x4ef4f3['conditions'][_0x41e49f];var _0x41d7e='c';var _0x3cd9cf=_[_0x6bbe('0x33')](_0x310864,['name',_0x4abf83[_0x6bbe('0x1f')]]);if(_0x3cd9cf){if(_0x4abf83[_0x6bbe('0x1f')]===_0x6bbe('0x34')||_0x3cd9cf['fieldType']===_0x6bbe('0x35')){_0x4abf83[_0x6bbe('0x36')]=_0x6bbe('0x37');}var _0x5200fe=as[_0x6bbe('0x38')](_0x41d7e,_0x3cd9cf[_0x6bbe('0x39')],_0x4abf83);_0x50a75e[_0x6bbe('0x3a')][_0x1ca0dd](_0x5200fe[_0x6bbe('0x3b')],_0x5200fe['value'][_0x6bbe('0x3c')],_0x5200fe[_0x6bbe('0x3d')][_0x6bbe('0x3e')]);}else{if(_0x4abf83[_0x6bbe('0x1f')]===_0x6bbe('0x3f')){var _0x32dbc7=_0x4abf83[_0x6bbe('0x3d')]['split'](',')[_0x6bbe('0x40')](function(_0x1af511){return Number(_0x1af511);});var _0x4974d7=parseTagParameter(_0x32dbc7);_0x50a75e['tags'][_0x6bbe('0x41')][_0x6bbe('0x42')](_0x4974d7);_0x50a75e[_0x6bbe('0x43')]['ids']=_0x32dbc7;}else if(_0x4abf83[_0x6bbe('0x1f')]===_0x6bbe('0x44')){_0x50a75e[_0x6bbe('0x45')]['clause'][_0x6bbe('0x42')](_0x6bbe('0x46'),_0x4abf83[_0x6bbe('0x3d')]);_0x50a75e[_0x6bbe('0x45')][_0x6bbe('0x47')]=!![];}}}return _0x50a75e;}function parseModelFields(_0x354d2e,_0x226cf7){var _0x53eba0=squel[_0x6bbe('0x21')]();var _0xf8ec6=_(_0x354d2e)[_0x6bbe('0x48')]()[_0x6bbe('0x40')](function(_0x5c86e4){return _['some'](_0x226cf7,[_0x6bbe('0x49'),_0x5c86e4])?_0x5c86e4:undefined;})[_0x6bbe('0x4a')]()[_0x6bbe('0x3d')]();if(_0x354d2e[_0x6bbe('0x4b')]){_0xf8ec6['push'](_0x6bbe('0x4b'));}if(_0x354d2e[_0x6bbe('0x44')]){_0xf8ec6['push'](_0x6bbe('0x44'));}if(_0xf8ec6[_0x6bbe('0x26')]>0x0){_0xf8ec6[_0x6bbe('0x1e')](function(_0x2b768f){if(_0x2b768f==='ListId'){_0x53eba0[_0x6bbe('0x42')](_0x6bbe('0x4c'),[][_0x6bbe('0x4d')](_0x354d2e[_0x2b768f]));}else if(_0x2b768f===_0x6bbe('0x4b')){var _0x315d2a='%'+_0x354d2e[_0x2b768f]+'%';_0x53eba0[_0x6bbe('0x42')]('CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?',_0x315d2a);}else if(_0x2b768f==='User'){_0x53eba0['and'](_0x6bbe('0x46'),_0x354d2e[_0x2b768f]);}else{_0x53eba0[_0x6bbe('0x42')]('c.'+_0x2b768f+_0x6bbe('0x4e'),_0x354d2e[_0x2b768f]);}});}return _0x53eba0;}function parseQueryParameters(_0x8e6b1b,_0x475716){var _0x512282=getSqlClauses();return Promise['resolve']()[_0x6bbe('0x4f')](function(){return parseModelFields(_0x8e6b1b,_0x475716);})[_0x6bbe('0x4f')](function(_0x598345){_0x512282[_0x6bbe('0x50')][_0x6bbe('0x42')](_0x598345);return parseTagParameter(_0x8e6b1b[_0x6bbe('0x51')]);})['then'](function(_0x154f5f){_0x512282[_0x6bbe('0x43')][_0x6bbe('0x41')][_0x6bbe('0x42')](_0x154f5f);return parseSearchFilter(_0x8e6b1b['filter']);})[_0x6bbe('0x4f')](function(_0x1ac62f){_0x512282[_0x6bbe('0x52')]=_0x1ac62f;return _0x512282;});}function checkListsRestrictions(_0x4098df,_0x30228a,_0x1987ca){var _0xc0fe91=squel[_0x6bbe('0x21')]();return Promise[_0x6bbe('0x53')]()[_0x6bbe('0x4f')](function(){if(_0x30228a[_0x6bbe('0x7')]&&_0x4098df[_0x6bbe('0x5')]===_0x6bbe('0x6')&&!_0x1987ca){return _0x4098df[_0x6bbe('0x54')]({'attributes':['id'],'raw':!![]});}})[_0x6bbe('0x4f')](function(_0x5acd32){if(_0x5acd32){if(_0x5acd32[_0x6bbe('0x26')]===0x0){_0xc0fe91[_0x6bbe('0x42')]('c.ListId\x20IS\x20NULL');}else{_0xc0fe91['and'](_0x6bbe('0x4c'),_[_0x6bbe('0x40')](_0x5acd32,'id'));}}})[_0x6bbe('0x4f')](function(){return _0xc0fe91;});}function buildContactsQuery(_0x2c0b90,_0x1e0506,_0x19823c,_0x4ae351,_0x4e5ef2,_0x1dea7b){if(_0x1e0506){_0x1e0506=_0x19823c[_0x6bbe('0x55')];}_0x2c0b90=addFieldsToQuery(_0x2c0b90,_0x1e0506,_0x4ae351,_0x1dea7b,!![]);var _0x1c142e=squel[_0x6bbe('0xb')]();_0x1c142e=addFieldsToQuery(_0x1c142e,_0x1e0506,_0x4ae351,_0x1dea7b,![]);if(_0x4ae351||_0x1dea7b){_0x2c0b90=applyJoinClauses(_0x2c0b90,!![]);_0x2c0b90[_0x6bbe('0x56')](_0x6bbe('0x57'));if(_0x19823c[_0x6bbe('0x58')]){_0x1c142e[_0x6bbe('0x58')](_0x19823c[_0x6bbe('0x58')]);}if(_0x19823c['offset']){_0x1c142e[_0x6bbe('0x59')](_0x19823c[_0x6bbe('0x59')]);}}else{_0x1c142e=applyJoinClauses(_0x1c142e,![]);_0x1c142e[_0x6bbe('0x56')](_0x6bbe('0x5a'));if(_0x19823c[_0x6bbe('0x58')]){_0x2c0b90['limit'](_0x19823c[_0x6bbe('0x58')]);}if(_0x19823c[_0x6bbe('0x59')]){_0x2c0b90[_0x6bbe('0x59')](_0x19823c[_0x6bbe('0x59')]);}}_0x1c142e[_0x6bbe('0x5b')](_0x4e5ef2);if(_0x19823c[_0x6bbe('0x5c')]){_0x19823c[_0x6bbe('0x5c')][_0x6bbe('0x1e')](function(_0x385380){_0x2c0b90[_0x6bbe('0x5c')]('c.'+_0x385380[0x0],_0x385380[0x1]===_0x6bbe('0x5d')?![]:!![]);_0x1c142e[_0x6bbe('0x5c')](_0x6bbe('0x5e')+_0x385380[0x0],_0x385380[0x1]===_0x6bbe('0x5d')?![]:!![]);});}_0x1c142e[_0x6bbe('0x5f')](_0x2c0b90,_0x6bbe('0xf'));return _0x1c142e;}function getFilteredContacts(_0x5c8e54){var _0xc756d7=[];return db[_0x6bbe('0x3f')]['findAll']({'attributes':['id',_0x6bbe('0x49'),_0x6bbe('0x60')],'raw':!![]})[_0x6bbe('0x4f')](function(_0x1d6e5e){_0xc756d7=_['keyBy'](_0x1d6e5e,'id');var _0x58533f={'type':db[_0x6bbe('0x61')][_0x6bbe('0x62')][_0x6bbe('0x63')],'model':db['CmContact'],'mapToModel':!![],'nest':!![],'raw':!![]};return db[_0x6bbe('0x64')]['query'](_0x5c8e54[_0x6bbe('0x65')](),_0x58533f);})[_0x6bbe('0x4f')](function(_0x45a5ab){_0x45a5ab[_0x6bbe('0x1e')](function(_0x2bf2a8){if(_0x2bf2a8['TagIds']){_0x2bf2a8[_0x6bbe('0x66')]=[];_0x2bf2a8[_0x6bbe('0x1c')][_0x6bbe('0x25')](',')[_0x6bbe('0x1e')](function(_0x4a18a3){_0x2bf2a8[_0x6bbe('0x66')]['push'](_0xc756d7[_0x4a18a3]);});}delete _0x2bf2a8[_0x6bbe('0x1c')];});return _0x45a5ab;});}function countFilteredContacts(_0xdbf99,_0x58764c){var _0x1361fc=_0xdbf99[_0x6bbe('0x67')]();_0x1361fc[_0x6bbe('0x1f')]('COUNT(*)');_0x1361fc=applyJoinClauses(_0x1361fc,!![]);_0xdbf99[_0x6bbe('0x56')]('c.id');var _0x86fd21=utils['getSelectedTags'](_0x58764c);if(!_[_0x6bbe('0x68')](_0x86fd21)){_0x1361fc[_0x6bbe('0xd')]('t.id\x20IN\x20?',_0x86fd21);}var _0x5f00b1={'type':db['Sequelize'][_0x6bbe('0x62')][_0x6bbe('0x63')],'raw':!![]};return db['sequelize'][_0x6bbe('0x69')](_0x1361fc[_0x6bbe('0x65')](),_0x5f00b1)[_0x6bbe('0x4f')](function(_0x494011){return _0x494011[0x0][_0x6bbe('0x6a')];});}module[_0x6bbe('0x6b')]={'buildContactsQuery':buildContactsQuery,'checkListsRestrictions':checkListsRestrictions,'countFilteredContacts':countFilteredContacts,'getContactsSubquery':getContactsSubquery,'getFilteredContacts':getFilteredContacts,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipContactsQuery':skipContactsQuery}; \ No newline at end of file +var _0x5e02=['buildExpression','type','default','text','Tag','split','tags','clause','and','User','user','uc.UserId\x20=\x20?','value','keys','map','some','compact','c.ListId\x20IN\x20?','concat','Contact','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','resolve','then','fields','filter','c.ListId\x20IS\x20NULL','attributes','select','group','limit','offset','subqry.id','order','DESC','findAll','keyBy','QueryTypes','SELECT','CmContact','query','toString','Tags','clone','COUNT(*)','c.id','t.id\x20IN\x20?','Sequelize','sequelize','exports','lodash','squel','../parsers/advancedSearch','../interaction/utils','role','agent','search','ListId','from','c.deletedAt\x20IS\x20NULL','subqry','left_join','cm_user_has_contacts','uc.CmContactId\x20=\x20','.id','ct.CmContactId\x20=\x20','tools_tags','lastName','fax','email','CompanyId','createdAt','updatedAt','deletedAt','TagIds','includes','push','forEach','field','GROUP_CONCAT(DISTINCT\x20t.id)','expr','getSelectedTags','CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','length','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','isNumeric','c.id\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','parseSearch','sqlOperator','conditions','find','name','dateOfBirth','fieldType','datetime','DATE'];(function(_0x249cd7,_0x1d2da8){var _0x209a2a=function(_0xc5e3b6){while(--_0xc5e3b6){_0x249cd7['push'](_0x249cd7['shift']());}};_0x209a2a(++_0x1d2da8);}(_0x5e02,0x164));var _0x25e0=function(_0x43e097,_0x33e351){_0x43e097=_0x43e097-0x0;var _0x1bb782=_0x5e02[_0x43e097];return _0x1bb782;};'use strict';var _=require(_0x25e0('0x0'));var squel=require(_0x25e0('0x1'));var as=require(_0x25e0('0x2'));var qs=require('../parsers/qs');var utils=require(_0x25e0('0x3'));var db=require('../../mysqldb')['db'];function skipContactsQuery(_0x4540a8,_0x3bd27f){var _0x65cd97=![];if(_0x4540a8[_0x25e0('0x4')]===_0x25e0('0x5')&&!_0x3bd27f[_0x25e0('0x6')]&&!_0x3bd27f[_0x25e0('0x7')]&&_0x3bd27f['autocomplete']!=='true'){_0x65cd97=!![];}return _0x65cd97;}function getContactsSubquery(){return squel['select']()[_0x25e0('0x8')]('cm_contacts','c')['where'](_0x25e0('0x9'));}function applyJoinClauses(_0x5d8f94,_0x450876){var _0x194534=_0x450876?'c':_0x25e0('0xa');_0x5d8f94[_0x25e0('0xb')](_0x25e0('0xc'),'uc',_0x25e0('0xd')+_0x194534+_0x25e0('0xe'))['left_join']('cm_contact_has_tags','ct',_0x25e0('0xf')+_0x194534+'.id')['left_join'](_0x25e0('0x10'),'t','t.id\x20=\x20ct.TagId');return _0x5d8f94;}function addFieldsToQuery(_0x62eab,_0x33591e,_0x4df0ee,_0x19f0cb,_0x550895){var _0x4e5c85=_0x550895?'c':_0x25e0('0xa');if(!_0x33591e){_0x33591e=['id','firstName',_0x25e0('0x11'),'phone','mobile',_0x25e0('0x12'),_0x25e0('0x13'),'ListId',_0x25e0('0x14'),_0x25e0('0x15'),_0x25e0('0x16'),_0x25e0('0x17'),_0x25e0('0x18')];}else if(!_0x33591e[_0x25e0('0x19')]('id')){_0x33591e[_0x25e0('0x1a')]('id');}var _0x2ce0e5=_0x4df0ee&&_0x550895||!_0x4df0ee&&!_0x550895;if(_0x19f0cb){_0x2ce0e5=_0x19f0cb&&_0x550895||!_0x19f0cb&&!_0x550895;}_0x33591e[_0x25e0('0x1b')](function(_0xdd5b8){if(_0xdd5b8==='TagIds'){if(_0x2ce0e5){_0x62eab[_0x25e0('0x1c')](_0x25e0('0x1d'),_0xdd5b8);}else if(_0x4df0ee||_0x19f0cb){_0x62eab[_0x25e0('0x1c')](_0x4e5c85+'.'+_0xdd5b8);}}else{_0x62eab[_0x25e0('0x1c')](_0x4e5c85+'.'+_0xdd5b8);}});return _0x62eab;}function getSqlClauses(){var _0x1e63e3={'default':squel[_0x25e0('0x1e')](),'fields':squel[_0x25e0('0x1e')](),'filter':squel[_0x25e0('0x1e')](),'tags':{'clause':squel[_0x25e0('0x1e')](),'ids':null},'user':{'clause':squel['expr'](),'skip':![]}};return _0x1e63e3;}function parseTagParameter(_0x5b62e2){var _0x33d981=squel[_0x25e0('0x1e')]();if(_0x5b62e2){var _0x5a73ec=utils[_0x25e0('0x1f')](_0x5b62e2);_0x5a73ec[_0x25e0('0x1b')](function(_0x4c8946){_0x33d981['or'](_0x25e0('0x20'),'%,'+_0x4c8946+',%');});}return _0x33d981;}function parseSearchFilter(_0x4987ac){var _0x397244=squel[_0x25e0('0x1e')]();if(_0x4987ac){var _0x3619ca=_0x4987ac['replace']('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(_0x3619ca['split']('\x20')[_0x25e0('0x21')]>0x1){_0x397244['or'](_0x25e0('0x22'),qs[_0x25e0('0x23')](_0x3619ca,!![]),null);}else{if(qs[_0x25e0('0x24')](_0x3619ca)){_0x397244['or'](_0x25e0('0x25'),_0x3619ca+'%');_0x397244['or']('c.phone\x20LIKE\x20?',_0x3619ca+'%');_0x397244['or'](_0x25e0('0x26'),_0x3619ca+'%');_0x397244['or'](_0x25e0('0x27'),_0x3619ca+'%');}else if(qs['isEmail'](_0x3619ca)){_0x397244['or'](_0x25e0('0x28'),_0x3619ca+'%');}else{_0x397244['or'](_0x25e0('0x29'),'%'+_0x3619ca+'%');_0x397244['or'](_0x25e0('0x2a'),'%'+_0x3619ca+'%');_0x397244['or'](_0x25e0('0x28'),'%'+_0x3619ca+'%');}}}return _0x397244;}function parseAdvancedSearchFilter(_0x2d62fc,_0x21bb6f){var _0x49a425=getSqlClauses();var _0x142a8e=as[_0x25e0('0x2b')](_0x2d62fc);var _0x58e5eb=_0x142a8e[_0x25e0('0x2c')];for(var _0x4be6e7=0x0;_0x4be6e7<_0x142a8e['conditions'][_0x25e0('0x21')];_0x4be6e7++){var _0x378e33=_0x142a8e[_0x25e0('0x2d')][_0x4be6e7];var _0x10557f='c';var _0x57725e=_[_0x25e0('0x2e')](_0x21bb6f,[_0x25e0('0x2f'),_0x378e33[_0x25e0('0x1c')]]);if(_0x57725e){if(_0x378e33[_0x25e0('0x1c')]===_0x25e0('0x30')||_0x57725e[_0x25e0('0x31')]===_0x25e0('0x32')){_0x378e33['castTo']=_0x25e0('0x33');}var _0x58d505=as[_0x25e0('0x34')](_0x10557f,_0x57725e[_0x25e0('0x35')],_0x378e33);_0x49a425[_0x25e0('0x36')][_0x58e5eb](_0x58d505[_0x25e0('0x37')],_0x58d505['value']['start'],_0x58d505['value']['end']);}else{if(_0x378e33['field']===_0x25e0('0x38')){var _0x2d499b=_0x378e33['value'][_0x25e0('0x39')](',')['map'](function(_0x524614){return Number(_0x524614);});var _0x35e771=parseTagParameter(_0x2d499b);_0x49a425[_0x25e0('0x3a')][_0x25e0('0x3b')][_0x25e0('0x3c')](_0x35e771);_0x49a425[_0x25e0('0x3a')]['ids']=_0x2d499b;}else if(_0x378e33[_0x25e0('0x1c')]===_0x25e0('0x3d')){_0x49a425[_0x25e0('0x3e')][_0x25e0('0x3b')][_0x25e0('0x3c')](_0x25e0('0x3f'),_0x378e33[_0x25e0('0x40')]);_0x49a425['user']['skip']=!![];}}}return _0x49a425;}function parseModelFields(_0x37a28f,_0x44b4bf){var _0x532e1c=squel[_0x25e0('0x1e')]();var _0x4eadf3=_(_0x37a28f)[_0x25e0('0x41')]()[_0x25e0('0x42')](function(_0x2ae3ff){return _[_0x25e0('0x43')](_0x44b4bf,['name',_0x2ae3ff])?_0x2ae3ff:undefined;})[_0x25e0('0x44')]()[_0x25e0('0x40')]();if(_0x37a28f['Contact']){_0x4eadf3[_0x25e0('0x1a')]('Contact');}if(_0x37a28f[_0x25e0('0x3d')]){_0x4eadf3[_0x25e0('0x1a')]('User');}if(_0x4eadf3['length']>0x0){_0x4eadf3['forEach'](function(_0x5045d5){if(_0x5045d5===_0x25e0('0x7')){_0x532e1c[_0x25e0('0x3c')](_0x25e0('0x45'),[][_0x25e0('0x46')](_0x37a28f[_0x5045d5]));}else if(_0x5045d5===_0x25e0('0x47')){var _0x476de8='%'+_0x37a28f[_0x5045d5]+'%';_0x532e1c[_0x25e0('0x3c')](_0x25e0('0x48'),_0x476de8);}else if(_0x5045d5==='User'){_0x532e1c[_0x25e0('0x3c')](_0x25e0('0x3f'),_0x37a28f[_0x5045d5]);}else{_0x532e1c[_0x25e0('0x3c')]('c.'+_0x5045d5+_0x25e0('0x49'),_0x37a28f[_0x5045d5]);}});}return _0x532e1c;}function parseQueryParameters(_0x479ab9,_0x4c0938){var _0x4eeca9=getSqlClauses();return Promise[_0x25e0('0x4a')]()[_0x25e0('0x4b')](function(){return parseModelFields(_0x479ab9,_0x4c0938);})[_0x25e0('0x4b')](function(_0x7ed91a){_0x4eeca9[_0x25e0('0x4c')][_0x25e0('0x3c')](_0x7ed91a);return parseTagParameter(_0x479ab9['tag']);})['then'](function(_0x487be4){_0x4eeca9[_0x25e0('0x3a')]['clause']['and'](_0x487be4);return parseSearchFilter(_0x479ab9[_0x25e0('0x4d')]);})['then'](function(_0x58b37c){_0x4eeca9[_0x25e0('0x4d')]=_0x58b37c;return _0x4eeca9;});}function checkListsRestrictions(_0x673079,_0x4b0ec7,_0x1d328e){var _0x2bc20d=squel[_0x25e0('0x1e')]();return Promise[_0x25e0('0x4a')]()['then'](function(){if(_0x4b0ec7[_0x25e0('0x6')]&&_0x673079['role']===_0x25e0('0x5')&&!_0x1d328e){return _0x673079['getLists']({'attributes':['id'],'raw':!![]});}})[_0x25e0('0x4b')](function(_0x1fe8d4){if(_0x1fe8d4){if(_0x1fe8d4[_0x25e0('0x21')]===0x0){_0x2bc20d[_0x25e0('0x3c')](_0x25e0('0x4e'));}else{_0x2bc20d[_0x25e0('0x3c')](_0x25e0('0x45'),_[_0x25e0('0x42')](_0x1fe8d4,'id'));}}})[_0x25e0('0x4b')](function(){return _0x2bc20d;});}function buildContactsQuery(_0x2cb472,_0x4643dc,_0x4eff0a,_0x13c1da,_0xeaa41e,_0x36c658){if(_0x4643dc){_0x4643dc=_0x4eff0a[_0x25e0('0x4f')];}_0x2cb472=addFieldsToQuery(_0x2cb472,_0x4643dc,_0x13c1da,_0x36c658,!![]);var _0x5c0f45=squel[_0x25e0('0x50')]();_0x5c0f45=addFieldsToQuery(_0x5c0f45,_0x4643dc,_0x13c1da,_0x36c658,![]);if(_0x13c1da||_0x36c658){_0x2cb472=applyJoinClauses(_0x2cb472,!![]);_0x2cb472[_0x25e0('0x51')]('c.id');if(_0x4eff0a['limit']){_0x5c0f45[_0x25e0('0x52')](_0x4eff0a[_0x25e0('0x52')]);}if(_0x4eff0a[_0x25e0('0x53')]){_0x5c0f45[_0x25e0('0x53')](_0x4eff0a[_0x25e0('0x53')]);}}else{_0x5c0f45=applyJoinClauses(_0x5c0f45,![]);_0x5c0f45['group'](_0x25e0('0x54'));if(_0x4eff0a[_0x25e0('0x52')]){_0x2cb472[_0x25e0('0x52')](_0x4eff0a[_0x25e0('0x52')]);}if(_0x4eff0a[_0x25e0('0x53')]){_0x2cb472['offset'](_0x4eff0a['offset']);}}_0x5c0f45['having'](_0xeaa41e);if(_0x4eff0a[_0x25e0('0x55')]){_0x4eff0a[_0x25e0('0x55')][_0x25e0('0x1b')](function(_0x5800eb){_0x2cb472[_0x25e0('0x55')]('c.'+_0x5800eb[0x0],_0x5800eb[0x1]===_0x25e0('0x56')?![]:!![]);_0x5c0f45['order']('subqry.'+_0x5800eb[0x0],_0x5800eb[0x1]==='DESC'?![]:!![]);});}_0x5c0f45[_0x25e0('0x8')](_0x2cb472,_0x25e0('0xa'));return _0x5c0f45;}function getFilteredContacts(_0x5f290b){var _0x4f893c=[];return db[_0x25e0('0x38')][_0x25e0('0x57')]({'attributes':['id',_0x25e0('0x2f'),'color'],'raw':!![]})[_0x25e0('0x4b')](function(_0xdc3e99){_0x4f893c=_[_0x25e0('0x58')](_0xdc3e99,'id');var _0xdd9ed3={'type':db['Sequelize'][_0x25e0('0x59')][_0x25e0('0x5a')],'model':db[_0x25e0('0x5b')],'mapToModel':!![],'nest':!![],'raw':!![]};return db['sequelize'][_0x25e0('0x5c')](_0x5f290b[_0x25e0('0x5d')](),_0xdd9ed3);})[_0x25e0('0x4b')](function(_0x9a10f2){_0x9a10f2['forEach'](function(_0x59dbef){if(_0x59dbef[_0x25e0('0x18')]){_0x59dbef[_0x25e0('0x5e')]=[];_0x59dbef['TagIds'][_0x25e0('0x39')](',')[_0x25e0('0x1b')](function(_0xd6ef3a){_0x59dbef['Tags']['push'](_0x4f893c[_0xd6ef3a]);});}delete _0x59dbef[_0x25e0('0x18')];});return _0x9a10f2;});}function countFilteredContacts(_0x24ef36,_0x23bec3){var _0x4dac59=_0x24ef36[_0x25e0('0x5f')]();_0x4dac59[_0x25e0('0x1c')](_0x25e0('0x60'));_0x4dac59=applyJoinClauses(_0x4dac59,!![]);_0x24ef36['group'](_0x25e0('0x61'));var _0x1cdc16=utils[_0x25e0('0x1f')](_0x23bec3);if(!_['isEmpty'](_0x1cdc16)){_0x4dac59['where'](_0x25e0('0x62'),_0x1cdc16);}var _0x3ca0ca={'type':db[_0x25e0('0x63')][_0x25e0('0x59')][_0x25e0('0x5a')],'raw':!![]};return db[_0x25e0('0x64')][_0x25e0('0x5c')](_0x4dac59[_0x25e0('0x5d')](),_0x3ca0ca)[_0x25e0('0x4b')](function(_0x465cec){return _0x465cec[0x0][_0x25e0('0x60')];});}module[_0x25e0('0x65')]={'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 69420b2..8212ada 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 _0x9ac7=['algorithm','join','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','getCiphers','filter','hasOwnProperty','encryptFile','createWriteStream','createCipher','binary','end','final','write','close','unlink','createReadStream','createDecipher','data','update','encryptString','secret','utf8','base64','crypto','lodash','../../config/environment','../../config/logger','app','aes192','encrypt'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x9ac7,0x79));var _0x79ac=function(_0xb0f7c3,_0x4eae95){_0xb0f7c3=_0xb0f7c3-0x0;var _0x28ea68=_0x9ac7[_0xb0f7c3];return _0x28ea68;};'use strict';var crypto=require(_0x79ac('0x0'));var fs=require('fs');var BPromise=require('bluebird');var _=require(_0x79ac('0x1'));var config=require(_0x79ac('0x2'));var logger=require(_0x79ac('0x3'))(_0x79ac('0x4'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config['secrets']['session'],'algorithm':'aes-256-ctr'};const fileOptions={'algorithm':_0x79ac('0x5')};if(config[_0x79ac('0x6')]&&config['encrypt']['algorithm']){var isSupported=isAlgorithmSupported(config[_0x79ac('0x6')][_0x79ac('0x7')]);if(isSupported){fileOptions['algorithm']=config[_0x79ac('0x6')]['algorithm'];}else{var supportedAlgorithms=getSupportedCiphers()[_0x79ac('0x8')](',\x20');logger[_0x79ac('0x9')](config[_0x79ac('0x6')]['algorithm'],_0x79ac('0xa'),supportedAlgorithms);}}function isASupportedCipher(_0x36d4bf){return AES_SUPPORTED_RX[_0x79ac('0xb')](_0x36d4bf);}function getSupportedCiphers(){return crypto[_0x79ac('0xc')]()[_0x79ac('0xd')](isASupportedCipher);}function isAlgorithmSupported(_0x47b40a){return getSupportedCiphers()['indexOf'](_0x47b40a)>-0x1;}function combineOptions(_0x140850){var _0x73afe0={};for(var _0x1ad549 in fileOptions){if(fileOptions[_0x79ac('0xe')](_0x1ad549)){_0x73afe0[_0x1ad549]=fileOptions[_0x1ad549];}}if(_0x140850){for(var _0x42b843 in _0x140850){if(_0x140850[_0x79ac('0xe')](_0x42b843)){_0x73afe0[_0x42b843]=_0x140850[_0x42b843];}}}return _0x73afe0;}exports[_0x79ac('0xf')]=function(_0x4de81c,_0x5ea765,_0xb303e5,_0x34bdc3){return new BPromise(function(_0x1e5367,_0x4c071c){_0x34bdc3=combineOptions(_0x34bdc3);var _0x4547f7=new Buffer(_0xb303e5);var _0x1ac713=fs['createReadStream'](_0x4de81c);var _0x493948=fs[_0x79ac('0x10')](_0x5ea765);var _0x50b7e6=crypto[_0x79ac('0x11')](_0x34bdc3[_0x79ac('0x7')],_0x4547f7);_0x1ac713['on']('data',function(_0x281ef0){var _0x2a8961=new Buffer(_0x50b7e6['update'](_0x281ef0),_0x79ac('0x12'));_0x493948['write'](_0x2a8961);});_0x1ac713['on'](_0x79ac('0x13'),function(){try{var _0x602ad=new Buffer(_0x50b7e6[_0x79ac('0x14')](_0x79ac('0x12')),_0x79ac('0x12'));_0x493948[_0x79ac('0x15')](_0x602ad);_0x493948[_0x79ac('0x13')]();_0x493948['on'](_0x79ac('0x16'),function(){return _0x1e5367(_0x5ea765);});}catch(_0xccf12d){fs[_0x79ac('0x17')](_0x5ea765);return _0x4c071c(_0xccf12d);}});});};exports['decryptFile']=function(_0x37613b,_0x4ffda6,_0x115105,_0x1ea954){return new BPromise(function(_0x238bf9,_0x3d3cdd){_0x1ea954=combineOptions(_0x1ea954);var _0x295eb0=new Buffer(_0x115105);var _0x3346e3=fs[_0x79ac('0x18')](_0x37613b);var _0x3e9ef4=fs[_0x79ac('0x10')](_0x4ffda6);var _0x16a4ef=crypto[_0x79ac('0x19')](_0x1ea954[_0x79ac('0x7')],_0x295eb0);_0x3346e3['on'](_0x79ac('0x1a'),function(_0x30af9c){var _0x2a2b92=new Buffer(_0x16a4ef[_0x79ac('0x1b')](_0x30af9c),_0x79ac('0x12'));_0x3e9ef4[_0x79ac('0x15')](_0x2a2b92);});_0x3346e3['on']('end',function(){try{var _0xd7294e=new Buffer(_0x16a4ef['final']('binary'),_0x79ac('0x12'));_0x3e9ef4['write'](_0xd7294e);_0x3e9ef4[_0x79ac('0x13')]();_0x3e9ef4['on'](_0x79ac('0x16'),function(){return _0x238bf9(_0x4ffda6);});}catch(_0x2cc56e){fs[_0x79ac('0x17')](_0x4ffda6);return _0x3d3cdd(_0x2cc56e);}});});};exports[_0x79ac('0x1c')]=function(_0x457f85,_0x43325f,_0x14381f){var _0xf29f53=_0x14381f||stringOptions[_0x79ac('0x7')];var _0x4da786=_0x43325f||stringOptions[_0x79ac('0x1d')];var _0xe70c33=crypto['createCipher'](_0xf29f53,_0x4da786);var _0x56c274=_0xe70c33[_0x79ac('0x1b')](_0x457f85,_0x79ac('0x1e'),_0x79ac('0x1f'));_0x56c274+=_0xe70c33[_0x79ac('0x14')]('base64');return _0x56c274;};exports['decryptString']=function(_0x196fae,_0x3b5eeb,_0x448101){var _0x2c1ca5=_0x448101||stringOptions[_0x79ac('0x7')];var _0x11c9ca=_0x3b5eeb||stringOptions[_0x79ac('0x1d')];var _0x4233f5=crypto[_0x79ac('0x19')](_0x2c1ca5,_0x11c9ca);var _0x3cb713=_0x4233f5['update'](_0x196fae,_0x79ac('0x1f'),_0x79ac('0x1e'));_0x3cb713+=_0x4233f5[_0x79ac('0x14')](_0x79ac('0x1e'));return _0x3cb713;}; \ No newline at end of file +var _0xe2e9=['hasOwnProperty','encryptFile','createReadStream','createWriteStream','createCipher','binary','end','final','write','close','unlink','createDecipher','data','update','encryptString','utf8','base64','secret','bluebird','lodash','../../config/logger','app','aes-256-ctr','aes192','algorithm','encrypt','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','getCiphers','filter','indexOf'];(function(_0x359ef6,_0x5a9613){var _0x5abf26=function(_0x258448){while(--_0x258448){_0x359ef6['push'](_0x359ef6['shift']());}};_0x5abf26(++_0x5a9613);}(_0xe2e9,0x148));var _0x9e2e=function(_0x3fb83b,_0x64ad11){_0x3fb83b=_0x3fb83b-0x0;var _0x1e8bf8=_0xe2e9[_0x3fb83b];return _0x1e8bf8;};'use strict';var crypto=require('crypto');var fs=require('fs');var BPromise=require(_0x9e2e('0x0'));var _=require(_0x9e2e('0x1'));var config=require('../../config/environment');var logger=require(_0x9e2e('0x2'))(_0x9e2e('0x3'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config['secrets']['session'],'algorithm':_0x9e2e('0x4')};const fileOptions={'algorithm':_0x9e2e('0x5')};if(config['encrypt']&&config['encrypt'][_0x9e2e('0x6')]){var isSupported=isAlgorithmSupported(config[_0x9e2e('0x7')][_0x9e2e('0x6')]);if(isSupported){fileOptions[_0x9e2e('0x6')]=config[_0x9e2e('0x7')][_0x9e2e('0x6')];}else{var supportedAlgorithms=getSupportedCiphers()['join'](',\x20');logger[_0x9e2e('0x8')](config[_0x9e2e('0x7')]['algorithm'],_0x9e2e('0x9'),supportedAlgorithms);}}function isASupportedCipher(_0x314551){return AES_SUPPORTED_RX['test'](_0x314551);}function getSupportedCiphers(){return crypto[_0x9e2e('0xa')]()[_0x9e2e('0xb')](isASupportedCipher);}function isAlgorithmSupported(_0x26d9e1){return getSupportedCiphers()[_0x9e2e('0xc')](_0x26d9e1)>-0x1;}function combineOptions(_0x495a09){var _0x15853d={};for(var _0x59fd7a in fileOptions){if(fileOptions[_0x9e2e('0xd')](_0x59fd7a)){_0x15853d[_0x59fd7a]=fileOptions[_0x59fd7a];}}if(_0x495a09){for(var _0x4e4279 in _0x495a09){if(_0x495a09[_0x9e2e('0xd')](_0x4e4279)){_0x15853d[_0x4e4279]=_0x495a09[_0x4e4279];}}}return _0x15853d;}exports[_0x9e2e('0xe')]=function(_0x14880c,_0x581025,_0x46f0f9,_0x4f0df8){return new BPromise(function(_0x47bcfd,_0x2f4f70){_0x4f0df8=combineOptions(_0x4f0df8);var _0x3bd42c=new Buffer(_0x46f0f9);var _0xa9cfca=fs[_0x9e2e('0xf')](_0x14880c);var _0x3e55bb=fs[_0x9e2e('0x10')](_0x581025);var _0x16abc7=crypto[_0x9e2e('0x11')](_0x4f0df8[_0x9e2e('0x6')],_0x3bd42c);_0xa9cfca['on']('data',function(_0x57aa6d){var _0x461a7f=new Buffer(_0x16abc7['update'](_0x57aa6d),_0x9e2e('0x12'));_0x3e55bb['write'](_0x461a7f);});_0xa9cfca['on'](_0x9e2e('0x13'),function(){try{var _0x41b4ac=new Buffer(_0x16abc7[_0x9e2e('0x14')](_0x9e2e('0x12')),_0x9e2e('0x12'));_0x3e55bb[_0x9e2e('0x15')](_0x41b4ac);_0x3e55bb['end']();_0x3e55bb['on'](_0x9e2e('0x16'),function(){return _0x47bcfd(_0x581025);});}catch(_0xab3dab){fs[_0x9e2e('0x17')](_0x581025);return _0x2f4f70(_0xab3dab);}});});};exports['decryptFile']=function(_0x3598a3,_0x2f97eb,_0x54f355,_0x1280e1){return new BPromise(function(_0x2d7747,_0x521cb9){_0x1280e1=combineOptions(_0x1280e1);var _0x28f82d=new Buffer(_0x54f355);var _0x1c138a=fs['createReadStream'](_0x3598a3);var _0x3310f0=fs[_0x9e2e('0x10')](_0x2f97eb);var _0x516749=crypto[_0x9e2e('0x18')](_0x1280e1[_0x9e2e('0x6')],_0x28f82d);_0x1c138a['on'](_0x9e2e('0x19'),function(_0x28d8f8){var _0x58188b=new Buffer(_0x516749[_0x9e2e('0x1a')](_0x28d8f8),_0x9e2e('0x12'));_0x3310f0[_0x9e2e('0x15')](_0x58188b);});_0x1c138a['on'](_0x9e2e('0x13'),function(){try{var _0x10e15d=new Buffer(_0x516749[_0x9e2e('0x14')]('binary'),_0x9e2e('0x12'));_0x3310f0[_0x9e2e('0x15')](_0x10e15d);_0x3310f0[_0x9e2e('0x13')]();_0x3310f0['on']('close',function(){return _0x2d7747(_0x2f97eb);});}catch(_0x499d3b){fs[_0x9e2e('0x17')](_0x2f97eb);return _0x521cb9(_0x499d3b);}});});};exports[_0x9e2e('0x1b')]=function(_0x3d7da2,_0x4f10d6,_0x17a3fc){var _0x46aac0=_0x17a3fc||stringOptions['algorithm'];var _0x1ff1e5=_0x4f10d6||stringOptions['secret'];var _0x2a0a2f=crypto[_0x9e2e('0x11')](_0x46aac0,_0x1ff1e5);var _0x4607bc=_0x2a0a2f[_0x9e2e('0x1a')](_0x3d7da2,_0x9e2e('0x1c'),_0x9e2e('0x1d'));_0x4607bc+=_0x2a0a2f[_0x9e2e('0x14')](_0x9e2e('0x1d'));return _0x4607bc;};exports['decryptString']=function(_0x405d47,_0xfe2553,_0x31d8d0){var _0x274b38=_0x31d8d0||stringOptions[_0x9e2e('0x6')];var _0x4f0da2=_0xfe2553||stringOptions[_0x9e2e('0x1e')];var _0x5d495d=crypto[_0x9e2e('0x18')](_0x274b38,_0x4f0da2);var _0x5347ea=_0x5d495d[_0x9e2e('0x1a')](_0x405d47,_0x9e2e('0x1d'),_0x9e2e('0x1c'));_0x5347ea+=_0x5d495d[_0x9e2e('0x14')](_0x9e2e('0x1c'));return _0x5347ea;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index 416af42..4137e40 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 _0xee74=['Failed','finally','exit','util','path','lodash','to-csv','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','argv','savename','AnalyticExtractedReport','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','find','split','splitSizeCsv','sequelize','query','QueryTypes','then','num','Empty','length','range','isInteger','forEach','push','format','%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT','dirname','basename','.csv','existsSync','join','mkdirSync','each','%s%d.%s','csv','writeFileSync','%s.%s','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect'];(function(_0x1b20d3,_0x1f1724){var _0x2babdb=function(_0x306ea2){while(--_0x306ea2){_0x1b20d3['push'](_0x1b20d3['shift']());}};_0x2babdb(++_0x1f1724);}(_0xee74,0x19b));var _0x4ee7=function(_0x495226,_0x382177){_0x495226=_0x495226-0x0;var _0x462f02=_0xee74[_0x495226];return _0x462f02;};'use strict';var util=require(_0x4ee7('0x0'));var path=require(_0x4ee7('0x1'));var _=require(_0x4ee7('0x2'));var csv=require(_0x4ee7('0x3'));var fs=require('fs');var BPromise=require(_0x4ee7('0x4'));var zipdir=require(_0x4ee7('0x5'));var rimraf=require(_0x4ee7('0x6'));var db=require('../../mysqldb')['db'];var dbH=require(_0x4ee7('0x7'))[_0x4ee7('0x8')];var logger=require(_0x4ee7('0x9'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x4ee7('0xa')][0x2]);var QUERY=process[_0x4ee7('0xa')][0x3];var PATH=process[_0x4ee7('0xa')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x2d55bb,_0x51ab68){var _0x1b1e83={'status':_0x2d55bb};var _0x4ad89b={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x51ab68){_0x1b1e83[_0x4ee7('0xb')]=_0x51ab68;}return db[_0x4ee7('0xc')]['update'](_0x1b1e83,_0x4ad89b);}function main(){var _0xa8d3ea=0x1388;var _0x3b86ee;logger[_0x4ee7('0xd')](util['format'](_0x4ee7('0xe'),EXTRACTED_REPORT_ID,_0x4ee7('0xf')));return db['Setting'][_0x4ee7('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x4ee7('0x11'),_0x4ee7('0x12')]})['then'](function(_0x130b61){if(_0x130b61){_0x3b86ee=_0x130b61;_0xa8d3ea=_0x3b86ee['splitSizeCsv']||0x1388;}})['then'](function(){return dbH[_0x4ee7('0x13')][_0x4ee7('0x14')](util['format']('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x4ee7('0x13')][_0x4ee7('0x15')]['SELECT']});})[_0x4ee7('0x16')](function(_0x2c60a2){if(!_0x2c60a2[0x0][_0x4ee7('0x17')]){return analyticExtractedReport(_0x4ee7('0x18'));}var _0x2997fd=[];var _0x195d97=0x0;if(_0x3b86ee[_0x4ee7('0x11')]){if(_0x2c60a2&&_0x2c60a2[_0x4ee7('0x19')]){var _0x131577=_[_0x4ee7('0x1a')](_0x2c60a2[0x0]['num']/_0xa8d3ea);var _0x31d13c=Number[_0x4ee7('0x1b')](_0x2c60a2[0x0][_0x4ee7('0x17')]/_0xa8d3ea)?_0x2c60a2[0x0]['num']%_0xa8d3ea:0x0;_0x131577[_0x4ee7('0x1c')](function(_0x365877){if(_0x365877>0x0){_0x195d97+=_0xa8d3ea;}_0x2997fd[_0x4ee7('0x1d')](dbH[_0x4ee7('0x13')]['query'](util[_0x4ee7('0x1e')](_0x4ee7('0x1f'),QUERY,_0xa8d3ea,_0x195d97),{'type':dbH['sequelize']['QueryTypes'][_0x4ee7('0x20')]}));});if(_0x31d13c>0x0){_0x195d97+=_0xa8d3ea;_0x2997fd[_0x4ee7('0x1d')](dbH[_0x4ee7('0x13')][_0x4ee7('0x14')](util[_0x4ee7('0x1e')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x31d13c,_0x195d97),{'type':dbH[_0x4ee7('0x13')][_0x4ee7('0x15')][_0x4ee7('0x20')]}));}}}else{_0x2997fd[_0x4ee7('0x1d')](dbH['sequelize'][_0x4ee7('0x14')](QUERY,{'type':dbH[_0x4ee7('0x13')][_0x4ee7('0x15')][_0x4ee7('0x20')]}));}var _0x19d9b6=path[_0x4ee7('0x21')](PATH);var _0x1465e6=path[_0x4ee7('0x22')](PATH,_0x4ee7('0x23'));var _0x962e37=_0x3b86ee[_0x4ee7('0x11')]&&_0x2997fd['length']>0x1;var _0x534540=[];if(!fs[_0x4ee7('0x24')](path[_0x4ee7('0x25')](_0x19d9b6,_0x1465e6))&&_0x962e37){fs[_0x4ee7('0x26')](path[_0x4ee7('0x25')](_0x19d9b6,_0x1465e6));}return BPromise[_0x4ee7('0x27')](_0x2997fd,function(_0x5d6a9c){_0x534540[_0x4ee7('0x1d')](_0x5d6a9c);})[_0x4ee7('0x16')](function(){for(var _0x23e9ba=0x0;_0x23e9ba<_0x534540[_0x4ee7('0x19')];_0x23e9ba+=0x1){var _0x4d6d81;var _0x30a10a=_0x534540[_0x23e9ba];if(_0x962e37){_0x4d6d81=path[_0x4ee7('0x25')](_0x19d9b6,_0x1465e6,util['format'](_0x4ee7('0x28'),_0x1465e6,_0x23e9ba,'csv'));}else{_0x4d6d81=path[_0x4ee7('0x25')](_0x19d9b6,util[_0x4ee7('0x1e')]('%s.%s',_0x1465e6,_0x4ee7('0x29')));}fs[_0x4ee7('0x2a')](_0x4d6d81,csv(_0x30a10a));}})[_0x4ee7('0x16')](function(){if(_0x962e37){return new Promise(function(_0xcadf24){zipdir(path[_0x4ee7('0x25')](_0x19d9b6,_0x1465e6),{'saveTo':path[_0x4ee7('0x25')](_0x19d9b6,util[_0x4ee7('0x1e')](_0x4ee7('0x2b'),_0x1465e6,_0x4ee7('0x2c')))},function(_0x3402af,_0x9ab19b){rimraf(path[_0x4ee7('0x25')](_0x19d9b6,_0x1465e6),function(){});_0xcadf24('zip\x20finished');});});}})[_0x4ee7('0x16')](function(){logger[_0x4ee7('0xd')](util[_0x4ee7('0x1e')](_0x4ee7('0x2d'),EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport('Completed',_0x962e37?util[_0x4ee7('0x1e')](_0x4ee7('0x2b'),_0x1465e6,_0x962e37?_0x4ee7('0x2c'):'csv'):null);});})['catch'](function(_0x3f03e0){logger[_0x4ee7('0xd')](util['format'](_0x4ee7('0x2e'),EXTRACTED_REPORT_ID,_0x4ee7('0xf')),util[_0x4ee7('0x2f')](_0x3f03e0,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x4ee7('0x30'));})[_0x4ee7('0x31')](function(){process[_0x4ee7('0x32')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x37de=['finally','exit','util','path','lodash','to-csv','zip-dir','rimraf','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','info','format','CSV','Setting','find','then','splitSizeCsv','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','sequelize','QueryTypes','num','Empty','split','length','range','isInteger','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT','dirname','basename','.csv','existsSync','join','%s%d.%s','csv','%s.%s','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch'];(function(_0x45aa18,_0x412fc5){var _0x26119d=function(_0x68dcc6){while(--_0x68dcc6){_0x45aa18['push'](_0x45aa18['shift']());}};_0x26119d(++_0x412fc5);}(_0x37de,0x182));var _0xe37d=function(_0x24e64a,_0x22af59){_0x24e64a=_0x24e64a-0x0;var _0x3827d2=_0x37de[_0x24e64a];return _0x3827d2;};'use strict';var util=require(_0xe37d('0x0'));var path=require(_0xe37d('0x1'));var _=require(_0xe37d('0x2'));var csv=require(_0xe37d('0x3'));var fs=require('fs');var BPromise=require('bluebird');var zipdir=require(_0xe37d('0x4'));var rimraf=require(_0xe37d('0x5'));var db=require('../../mysqldb')['db'];var dbH=require('../../mysqldb')[_0xe37d('0x6')];var logger=require(_0xe37d('0x7'))(_0xe37d('0x8'));var EXTRACTED_REPORT_ID=Number(process[_0xe37d('0x9')][0x2]);var QUERY=process[_0xe37d('0x9')][0x3];var PATH=process[_0xe37d('0x9')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x44280d,_0x4e9142){var _0x3dbe97={'status':_0x44280d};var _0xff834b={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x4e9142){_0x3dbe97[_0xe37d('0xa')]=_0x4e9142;}return db[_0xe37d('0xb')]['update'](_0x3dbe97,_0xff834b);}function main(){var _0x4d12a4=0x1388;var _0x34e2ab;logger[_0xe37d('0xc')](util[_0xe37d('0xd')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xe37d('0xe')));return db[_0xe37d('0xf')][_0xe37d('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split','splitSizeCsv']})[_0xe37d('0x11')](function(_0x155102){if(_0x155102){_0x34e2ab=_0x155102;_0x4d12a4=_0x34e2ab[_0xe37d('0x12')]||0x1388;}})[_0xe37d('0x11')](function(){return dbH['sequelize'][_0xe37d('0x13')](util[_0xe37d('0xd')](_0xe37d('0x14'),QUERY),{'type':dbH[_0xe37d('0x15')][_0xe37d('0x16')]['SELECT']});})['then'](function(_0x194af0){if(!_0x194af0[0x0][_0xe37d('0x17')]){return analyticExtractedReport(_0xe37d('0x18'));}var _0x45cc56=[];var _0x4a7969=0x0;if(_0x34e2ab[_0xe37d('0x19')]){if(_0x194af0&&_0x194af0[_0xe37d('0x1a')]){var _0x1e2e73=_[_0xe37d('0x1b')](_0x194af0[0x0][_0xe37d('0x17')]/_0x4d12a4);var _0x2243a1=Number[_0xe37d('0x1c')](_0x194af0[0x0]['num']/_0x4d12a4)?_0x194af0[0x0][_0xe37d('0x17')]%_0x4d12a4:0x0;_0x1e2e73[_0xe37d('0x1d')](function(_0x2b35e5){if(_0x2b35e5>0x0){_0x4a7969+=_0x4d12a4;}_0x45cc56[_0xe37d('0x1e')](dbH['sequelize'][_0xe37d('0x13')](util['format'](_0xe37d('0x1f'),QUERY,_0x4d12a4,_0x4a7969),{'type':dbH[_0xe37d('0x15')][_0xe37d('0x16')]['SELECT']}));});if(_0x2243a1>0x0){_0x4a7969+=_0x4d12a4;_0x45cc56[_0xe37d('0x1e')](dbH[_0xe37d('0x15')]['query'](util[_0xe37d('0xd')](_0xe37d('0x1f'),QUERY,_0x2243a1,_0x4a7969),{'type':dbH[_0xe37d('0x15')][_0xe37d('0x16')][_0xe37d('0x20')]}));}}}else{_0x45cc56[_0xe37d('0x1e')](dbH[_0xe37d('0x15')]['query'](QUERY,{'type':dbH[_0xe37d('0x15')]['QueryTypes'][_0xe37d('0x20')]}));}var _0x5642fd=path[_0xe37d('0x21')](PATH);var _0x3e9618=path[_0xe37d('0x22')](PATH,_0xe37d('0x23'));var _0x3d2266=_0x34e2ab[_0xe37d('0x19')]&&_0x45cc56[_0xe37d('0x1a')]>0x1;var _0x293db2=[];if(!fs[_0xe37d('0x24')](path['join'](_0x5642fd,_0x3e9618))&&_0x3d2266){fs['mkdirSync'](path[_0xe37d('0x25')](_0x5642fd,_0x3e9618));}return BPromise['each'](_0x45cc56,function(_0x3e78e6){_0x293db2[_0xe37d('0x1e')](_0x3e78e6);})[_0xe37d('0x11')](function(){for(var _0x1663aa=0x0;_0x1663aa<_0x293db2['length'];_0x1663aa+=0x1){var _0xd3ad01;var _0x48768d=_0x293db2[_0x1663aa];if(_0x3d2266){_0xd3ad01=path['join'](_0x5642fd,_0x3e9618,util[_0xe37d('0xd')](_0xe37d('0x26'),_0x3e9618,_0x1663aa,_0xe37d('0x27')));}else{_0xd3ad01=path[_0xe37d('0x25')](_0x5642fd,util['format'](_0xe37d('0x28'),_0x3e9618,_0xe37d('0x27')));}fs['writeFileSync'](_0xd3ad01,csv(_0x48768d));}})['then'](function(){if(_0x3d2266){return new Promise(function(_0x19aeeb){zipdir(path[_0xe37d('0x25')](_0x5642fd,_0x3e9618),{'saveTo':path[_0xe37d('0x25')](_0x5642fd,util['format']('%s.%s',_0x3e9618,_0xe37d('0x29')))},function(_0x11bb53,_0x2ad374){rimraf(path[_0xe37d('0x25')](_0x5642fd,_0x3e9618),function(){});_0x19aeeb(_0xe37d('0x2a'));});});}})[_0xe37d('0x11')](function(){logger[_0xe37d('0xc')](util['format'](_0xe37d('0x2b'),EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport(_0xe37d('0x2c'),_0x3d2266?util[_0xe37d('0xd')]('%s.%s',_0x3e9618,_0x3d2266?_0xe37d('0x29'):_0xe37d('0x27')):null);});})[_0xe37d('0x2d')](function(_0x5c326d){logger[_0xe37d('0xc')](util[_0xe37d('0xd')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xe37d('0xe')),util['inspect'](_0x5c326d,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0xe37d('0x2e')](function(){process[_0xe37d('0x2f')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index 60ef521..1382485 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 _0x3aba=['%s\x20#%d','channel','interactionId','YYYY-MM-DD','center','footer','pipe','finish','error','end','createPdfFromHTML','path','catch','lodash','moment','html-to-pdfmake','pdfmake/src/printer','rimraf','window','bluebird','../../mysqldb','dbH','../../config/logger','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','update','tableHeader','pick','map','toString','value','length','auto','body','push','concat','keys','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','startDate','format','header','before','margin','\x20/\x20','Arial','black','right','num','Empty','find','split','splitSizePdf','then','range','isInteger','forEach','sequelize','query','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','basename','.pdf','existsSync','join','mkdirSync','flatten','createPdfKitDocument','%s%d.%s','pdf','%s.%s','all','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','PDF','Completed','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','info','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','/fonts/arial-regular.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf'];(function(_0x40033e,_0x476c99){var _0x386ab2=function(_0x3b1a4d){while(--_0x3b1a4d){_0x40033e['push'](_0x40033e['shift']());}};_0x386ab2(++_0x476c99);}(_0x3aba,0xbd));var _0xa3ab=function(_0x3e0b8f,_0x1cddeb){_0x3e0b8f=_0x3e0b8f-0x0;var _0x22f742=_0x3aba[_0x3e0b8f];return _0x22f742;};'use strict';var _=require(_0xa3ab('0x0'));var fs=require('fs');var util=require('util');var path=require('path');var moment=require(_0xa3ab('0x1'));var htmlToPdfmake=require(_0xa3ab('0x2'));var PdfPrinter=require(_0xa3ab('0x3'));var zipdir=require('zip-dir');var rimraf=require(_0xa3ab('0x4'));var JSDOM=require('jsdom')['JSDOM'];var window=new JSDOM('')[_0xa3ab('0x5')];var BPromise=require(_0xa3ab('0x6'));var db=require(_0xa3ab('0x7'))['db'];var dbH=require('../../mysqldb')[_0xa3ab('0x8')];var logger=require(_0xa3ab('0x9'))('analytics');var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process['argv'][0x3];var PATH=process['argv'][0x4];var NAME=process[_0xa3ab('0xa')][0x5];var FORMAT=_0xa3ab('0xb');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x4fd2f0,_0x5af721){var _0x2790ae={'status':_0x4fd2f0};var _0x47ed9a={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x5af721){_0x2790ae[_0xa3ab('0xc')]=_0x5af721;}return db[_0xa3ab('0xd')][_0xa3ab('0xe')](_0x2790ae,_0x47ed9a);}function getHeaders(_0xf9cc16){return _['map'](_0xf9cc16,function(_0x235b73){return{'text':_0x235b73,'style':_0xa3ab('0xf')};});}function getRows(_0x2e3d78,_0x46952d){return _['map'](_0x46952d,function(_0x4507f7){return _(_0x4507f7)[_0xa3ab('0x10')](_0x2e3d78)[_0xa3ab('0x11')](function(_0x104511){return _0x104511?_[_0xa3ab('0x12')](_0x104511):'';})[_0xa3ab('0x13')]();});}function createTable(_0x45b5b2,_0x1937ce){var _0x4faec4={'widths':_['fill'](Array(_0x45b5b2[_0xa3ab('0x14')]),0x91),'heights':function(_0x2019d5){return _0x2019d5===0x0?_0xa3ab('0x15'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x5071f6=getHeaders(_0x45b5b2);_0x4faec4[_0xa3ab('0x16')][_0xa3ab('0x17')](_0x5071f6);var _0x5a7148=getRows(_0x45b5b2,_0x1937ce);_0x4faec4[_0xa3ab('0x16')]=_0x4faec4[_0xa3ab('0x16')][_0xa3ab('0x18')](_0x5a7148);return _0x4faec4;}function createTables(_0x176976){var _0x226a20=[];var _0x5d3dd9=_['chunk'](Object[_0xa3ab('0x19')](_0x176976[0x0]),0x5);_0x5d3dd9['forEach'](function(_0x45b84e){_0x226a20[_0xa3ab('0x17')](createTable(_0x45b84e,_0x176976));});return _0x226a20;}function getPDFDocDefinition(_0x21d246){var _0x1a251a=util['format'](_0xa3ab('0x1a'),NAME,EXTRACTED_REPORT['name'],moment(EXTRACTED_REPORT[_0xa3ab('0x1b')])[_0xa3ab('0x1c')](FORMAT),moment(EXTRACTED_REPORT['endDate'])[_0xa3ab('0x1c')](FORMAT));var _0x4e6378=[];for(var _0x2621a7=0x0;_0x2621a7<_0x21d246[_0xa3ab('0x14')];_0x2621a7++){var _0x2c77ca=[];if(_0x2621a7===0x0){_0x2c77ca['push']({'text':_0x1a251a,'style':_0xa3ab('0x1d')});}var _0x3a60f3={'table':_0x21d246[_0x2621a7]};if(_0x2621a7>0x0){_0x3a60f3['pageBreak']=_0xa3ab('0x1e');_0x3a60f3[_0xa3ab('0x1f')]=[0x0,0x46,0x0,0x0];}_0x2c77ca[_0xa3ab('0x17')](_0x3a60f3);_0x4e6378[_0xa3ab('0x17')](_0x2c77ca);}return{'pageSize':'A4','pageOrientation':'landscape','content':_0x4e6378,'footer':function(_0x1b008e,_0x54516c){return{'text':_0x1b008e[_0xa3ab('0x12')]()+_0xa3ab('0x20')+_0x54516c,'style':'footer'};},'defaultStyle':{'font':_0xa3ab('0x21')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0xa3ab('0x22')},'footer':{'alignment':_0xa3ab('0x23'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x5b1c61){var _0x22a3bc=0x1388;var _0x55651a;if(!_0x5b1c61[0x0][_0xa3ab('0x24')]){return analyticExtractedReport(_0xa3ab('0x25'));}return db['Setting'][_0xa3ab('0x26')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xa3ab('0x27'),_0xa3ab('0x28')]})[_0xa3ab('0x29')](function(_0x3ad9c8){if(_0x3ad9c8){_0x55651a=_0x3ad9c8;_0x22a3bc=_0x55651a['splitSizePdf']||0x3e8;}})[_0xa3ab('0x29')](function(){var _0x1fd9d6=[];var _0x59f6a0=0x0;if(_0x55651a[_0xa3ab('0x27')]){if(_0x5b1c61&&_0x5b1c61[_0xa3ab('0x14')]){var _0x12c001=_[_0xa3ab('0x2a')](_0x5b1c61[0x0][_0xa3ab('0x24')]/_0x22a3bc);var _0x8fed54=Number[_0xa3ab('0x2b')](_0x5b1c61[0x0][_0xa3ab('0x24')]/_0x22a3bc)?_0x5b1c61[0x0]['num']%_0x22a3bc:0x0;_0x12c001[_0xa3ab('0x2c')](function(_0x4275c4){if(_0x4275c4>0x0){_0x59f6a0+=_0x22a3bc;}_0x1fd9d6['push'](dbH[_0xa3ab('0x2d')][_0xa3ab('0x2e')](util[_0xa3ab('0x1c')](_0xa3ab('0x2f'),QUERY,_0x22a3bc,_0x59f6a0),{'type':dbH['sequelize'][_0xa3ab('0x30')][_0xa3ab('0x31')]}));});if(_0x8fed54>0x0){_0x59f6a0+=_0x22a3bc;_0x1fd9d6[_0xa3ab('0x17')](dbH[_0xa3ab('0x2d')][_0xa3ab('0x2e')](util[_0xa3ab('0x1c')](_0xa3ab('0x2f'),QUERY,_0x8fed54,_0x59f6a0),{'type':dbH[_0xa3ab('0x2d')]['QueryTypes'][_0xa3ab('0x31')]}));}}}else{_0x1fd9d6['push'](dbH[_0xa3ab('0x2d')][_0xa3ab('0x2e')](QUERY,{'type':dbH[_0xa3ab('0x2d')][_0xa3ab('0x30')][_0xa3ab('0x31')]}));}var _0x55d14a=path['dirname'](PATH);var _0x3b299e=path[_0xa3ab('0x32')](PATH,_0xa3ab('0x33'));var _0x4f40ac=_0x55651a['split']&&_0x1fd9d6[_0xa3ab('0x14')]>0x1;var _0xe3997e=[];if(!fs[_0xa3ab('0x34')](path[_0xa3ab('0x35')](_0x55d14a,_0x3b299e))&&_0x4f40ac){fs[_0xa3ab('0x36')](path['join'](_0x55d14a,_0x3b299e));}return BPromise['each'](_0x1fd9d6,function(_0x348054){_0xe3997e['push'](_0x348054);})['then'](function(){var _0x10a5f7=[];for(var _0xd62f17=0x0;_0xd62f17<_0xe3997e[_0xa3ab('0x14')];_0xd62f17+=0x1){var _0x2d5e13=_0xe3997e[_0xd62f17];var _0x4b0b43=createTables(_[_0xa3ab('0x37')](_0x2d5e13));var _0x24bfde;var _0x25d7f4=getPDFDocDefinition(_0x4b0b43);var _0x3c2453=getPDFPrinter();var _0x4e080f=_0x3c2453[_0xa3ab('0x38')](_0x25d7f4);if(_0x4f40ac){_0x24bfde=path[_0xa3ab('0x35')](_0x55d14a,_0x3b299e,util['format'](_0xa3ab('0x39'),_0x3b299e,_0xd62f17,_0xa3ab('0x3a')));}else{_0x24bfde=path[_0xa3ab('0x35')](_0x55d14a,util[_0xa3ab('0x1c')](_0xa3ab('0x3b'),_0x3b299e,'pdf'));}_0x10a5f7['push'](writePDFDocument(_0x4e080f,_0x24bfde));}return Promise[_0xa3ab('0x3c')](_0x10a5f7);})[_0xa3ab('0x29')](function(){if(_0x4f40ac){return new Promise(function(_0x4969db){zipdir(path['join'](_0x55d14a,_0x3b299e),{'saveTo':path[_0xa3ab('0x35')](_0x55d14a,util[_0xa3ab('0x1c')](_0xa3ab('0x3b'),_0x3b299e,_0xa3ab('0x3d')))},function(){rimraf(path[_0xa3ab('0x35')](_0x55d14a,_0x3b299e),function(){});_0x4969db(_0xa3ab('0x3e'));});});}})[_0xa3ab('0x29')](function(){if(!_0x4f40ac)return;rimraf(path[_0xa3ab('0x35')](_0x55d14a,_0x3b299e),function(){});})[_0xa3ab('0x29')](function(){logger['info'](util['format'](_0xa3ab('0x3f'),EXTRACTED_REPORT_ID,_0xa3ab('0x40')));return analyticExtractedReport(_0xa3ab('0x41'),_0x4f40ac?util['format'](_0xa3ab('0x3b'),_0x3b299e,_0x4f40ac?_0xa3ab('0x3d'):'pdf'):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger['info'](util[_0xa3ab('0x1c')](_0xa3ab('0x42'),EXTRACTED_REPORT_ID,_0xa3ab('0x40')));return db[_0xa3ab('0xd')][_0xa3ab('0x43')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0xa3ab('0x29')](function(_0x5890fb){EXTRACTED_REPORT=_0x5890fb;return dbH[_0xa3ab('0x2d')][_0xa3ab('0x2e')](util['format'](_0xa3ab('0x44'),QUERY),{'type':dbH[_0xa3ab('0x2d')][_0xa3ab('0x30')][_0xa3ab('0x31')]});})['then'](extractReport)['catch'](function(_0x53eed7){logger[_0xa3ab('0x45')](util[_0xa3ab('0x1c')](_0xa3ab('0x46'),EXTRACTED_REPORT_ID,_0xa3ab('0x40')),util['inspect'](_0x53eed7,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xa3ab('0x47'));})['finally'](function(){process['exit'](EXIT_CODE);});}main();function getPDFPrinter(){var _0xb18356=new PdfPrinter({'Arial':{'normal':__dirname+_0xa3ab('0x48'),'bold':__dirname+'/fonts/arial-bold.ttf','italics':__dirname+_0xa3ab('0x49'),'bolditalics':__dirname+_0xa3ab('0x4a')}});return _0xb18356;}function getPDFDocDefinitionFromHTML(_0x50597e,_0x4529a0){var _0x4e35d7=util[_0xa3ab('0x1c')](_0xa3ab('0x4b'),_0x4529a0[_0xa3ab('0x4c')],_0x4529a0[_0xa3ab('0x4d')]);var _0x216341=moment()['format'](_0xa3ab('0x4e'))[_0xa3ab('0x12')]();var _0x2ec7fa=htmlToPdfmake(_0x50597e,{'window':window,'tableAutoSize':!![]});return{'content':[_0x2ec7fa],'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0xa3ab('0x4f'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0xa3ab('0x4f'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0xa3ab('0x4f')}},'header':function(){return[{'text':'Interaction\x20Transcript','style':_0xa3ab('0x1d')}];},'footer':function(_0x2fda1b,_0x461e43){return[{'text':util[_0xa3ab('0x1c')]('\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s',_0x4e35d7,_0x2fda1b,_0x461e43,_0x216341),'style':_0xa3ab('0x50')}];}};}function writePDFDocument(_0x24a40e,_0x387990){return new Promise(function(_0x28b33c,_0x1e7c7d){var _0x3d01e3=_0x24a40e[_0xa3ab('0x51')](fs['createWriteStream'](_0x387990));_0x3d01e3['on']('finish',function(){_0x28b33c(_0xa3ab('0x52'));});_0x3d01e3['on'](_0xa3ab('0x53'),function(_0x5492cb){_0x1e7c7d(_0x5492cb);});_0x24a40e[_0xa3ab('0x54')]();});}exports[_0xa3ab('0x55')]=function(_0x495918,_0x232012){var _0x18829=getPDFPrinter();var _0x3c373f=getPDFDocDefinitionFromHTML(_0x495918,_0x232012);var _0x2914f5=_0x18829[_0xa3ab('0x38')](_0x3c373f);return writePDFDocument(_0x2914f5,_0x232012[_0xa3ab('0x56')])[_0xa3ab('0x57')](function(_0x5f3f22){throw _0x5f3f22;});}; \ No newline at end of file +var _0x9adf=['%s.%s','all','zip','info','PDF','Completed','AnalyticExtractedReport','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','finally','exit','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','interactionId','YYYY-MM-DD','center','Interaction\x20Transcript','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','footer','pipe','createWriteStream','finish','error','end','createPdfFromHTML','lodash','util','html-to-pdfmake','pdfmake/src/printer','zip-dir','rimraf','jsdom','JSDOM','bluebird','../../mysqldb','dbH','../../config/logger','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','update','tableHeader','map','value','auto','body','push','concat','chunk','keys','forEach','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','length','header','pageBreak','margin','landscape','toString','\x20/\x20','Arial','black','right','num','Empty','find','splitSizePdf','then','split','isInteger','sequelize','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','query','dirname','existsSync','join','mkdirSync','each','flatten','pdf'];(function(_0x430341,_0x1f4e68){var _0x39b602=function(_0x5cb52e){while(--_0x5cb52e){_0x430341['push'](_0x430341['shift']());}};_0x39b602(++_0x1f4e68);}(_0x9adf,0x187));var _0xf9ad=function(_0x4e9661,_0x29d2e2){_0x4e9661=_0x4e9661-0x0;var _0x38daf1=_0x9adf[_0x4e9661];return _0x38daf1;};'use strict';var _=require(_0xf9ad('0x0'));var fs=require('fs');var util=require(_0xf9ad('0x1'));var path=require('path');var moment=require('moment');var htmlToPdfmake=require(_0xf9ad('0x2'));var PdfPrinter=require(_0xf9ad('0x3'));var zipdir=require(_0xf9ad('0x4'));var rimraf=require(_0xf9ad('0x5'));var JSDOM=require(_0xf9ad('0x6'))[_0xf9ad('0x7')];var window=new JSDOM('')['window'];var BPromise=require(_0xf9ad('0x8'));var db=require(_0xf9ad('0x9'))['db'];var dbH=require('../../mysqldb')[_0xf9ad('0xa')];var logger=require(_0xf9ad('0xb'))(_0xf9ad('0xc'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0xf9ad('0xd')][0x3];var PATH=process[_0xf9ad('0xd')][0x4];var NAME=process[_0xf9ad('0xd')][0x5];var FORMAT=_0xf9ad('0xe');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x13d92f,_0x382f81){var _0x42e1b6={'status':_0x13d92f};var _0x4b9b19={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x382f81){_0x42e1b6[_0xf9ad('0xf')]=_0x382f81;}return db['AnalyticExtractedReport'][_0xf9ad('0x10')](_0x42e1b6,_0x4b9b19);}function getHeaders(_0x255f5b){return _['map'](_0x255f5b,function(_0x538a97){return{'text':_0x538a97,'style':_0xf9ad('0x11')};});}function getRows(_0x1e7867,_0x234f0b){return _[_0xf9ad('0x12')](_0x234f0b,function(_0x1f24d1){return _(_0x1f24d1)['pick'](_0x1e7867)['map'](function(_0x498978){return _0x498978?_['toString'](_0x498978):'';})[_0xf9ad('0x13')]();});}function createTable(_0x10dffd,_0x2174d6){var _0x31f21b={'widths':_['fill'](Array(_0x10dffd['length']),0x91),'heights':function(_0x10782d){return _0x10782d===0x0?_0xf9ad('0x14'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x2efc1a=getHeaders(_0x10dffd);_0x31f21b[_0xf9ad('0x15')][_0xf9ad('0x16')](_0x2efc1a);var _0x220c1d=getRows(_0x10dffd,_0x2174d6);_0x31f21b[_0xf9ad('0x15')]=_0x31f21b[_0xf9ad('0x15')][_0xf9ad('0x17')](_0x220c1d);return _0x31f21b;}function createTables(_0x3104c4){var _0x23bfb7=[];var _0x3e867=_[_0xf9ad('0x18')](Object[_0xf9ad('0x19')](_0x3104c4[0x0]),0x5);_0x3e867[_0xf9ad('0x1a')](function(_0x3bc29d){_0x23bfb7[_0xf9ad('0x16')](createTable(_0x3bc29d,_0x3104c4));});return _0x23bfb7;}function getPDFDocDefinition(_0x177515){var _0x2d8876=util[_0xf9ad('0x1b')](_0xf9ad('0x1c'),NAME,EXTRACTED_REPORT[_0xf9ad('0x1d')],moment(EXTRACTED_REPORT['startDate'])['format'](FORMAT),moment(EXTRACTED_REPORT['endDate'])[_0xf9ad('0x1b')](FORMAT));var _0x195c4b=[];for(var _0x18913e=0x0;_0x18913e<_0x177515[_0xf9ad('0x1e')];_0x18913e++){var _0xef5749=[];if(_0x18913e===0x0){_0xef5749[_0xf9ad('0x16')]({'text':_0x2d8876,'style':_0xf9ad('0x1f')});}var _0x39a91b={'table':_0x177515[_0x18913e]};if(_0x18913e>0x0){_0x39a91b[_0xf9ad('0x20')]='before';_0x39a91b[_0xf9ad('0x21')]=[0x0,0x46,0x0,0x0];}_0xef5749[_0xf9ad('0x16')](_0x39a91b);_0x195c4b[_0xf9ad('0x16')](_0xef5749);}return{'pageSize':'A4','pageOrientation':_0xf9ad('0x22'),'content':_0x195c4b,'footer':function(_0x4f4fcc,_0x126c26){return{'text':_0x4f4fcc[_0xf9ad('0x23')]()+_0xf9ad('0x24')+_0x126c26,'style':'footer'};},'defaultStyle':{'font':_0xf9ad('0x25')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0xf9ad('0x26')},'footer':{'alignment':_0xf9ad('0x27'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x4f83f5){var _0x3a6e46=0x1388;var _0x214973;if(!_0x4f83f5[0x0][_0xf9ad('0x28')]){return analyticExtractedReport(_0xf9ad('0x29'));}return db['Setting'][_0xf9ad('0x2a')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split','splitSizePdf']})['then'](function(_0x154547){if(_0x154547){_0x214973=_0x154547;_0x3a6e46=_0x214973[_0xf9ad('0x2b')]||0x3e8;}})[_0xf9ad('0x2c')](function(){var _0x2c7578=[];var _0x2b4d91=0x0;if(_0x214973[_0xf9ad('0x2d')]){if(_0x4f83f5&&_0x4f83f5[_0xf9ad('0x1e')]){var _0x4724fd=_['range'](_0x4f83f5[0x0]['num']/_0x3a6e46);var _0x2e3e49=Number[_0xf9ad('0x2e')](_0x4f83f5[0x0][_0xf9ad('0x28')]/_0x3a6e46)?_0x4f83f5[0x0][_0xf9ad('0x28')]%_0x3a6e46:0x0;_0x4724fd[_0xf9ad('0x1a')](function(_0x33714b){if(_0x33714b>0x0){_0x2b4d91+=_0x3a6e46;}_0x2c7578[_0xf9ad('0x16')](dbH[_0xf9ad('0x2f')]['query'](util[_0xf9ad('0x1b')](_0xf9ad('0x30'),QUERY,_0x3a6e46,_0x2b4d91),{'type':dbH[_0xf9ad('0x2f')][_0xf9ad('0x31')][_0xf9ad('0x32')]}));});if(_0x2e3e49>0x0){_0x2b4d91+=_0x3a6e46;_0x2c7578[_0xf9ad('0x16')](dbH[_0xf9ad('0x2f')][_0xf9ad('0x33')](util[_0xf9ad('0x1b')](_0xf9ad('0x30'),QUERY,_0x2e3e49,_0x2b4d91),{'type':dbH[_0xf9ad('0x2f')][_0xf9ad('0x31')][_0xf9ad('0x32')]}));}}}else{_0x2c7578[_0xf9ad('0x16')](dbH['sequelize'][_0xf9ad('0x33')](QUERY,{'type':dbH[_0xf9ad('0x2f')][_0xf9ad('0x31')]['SELECT']}));}var _0x4a1dde=path[_0xf9ad('0x34')](PATH);var _0x24ef39=path['basename'](PATH,'.pdf');var _0x19cb56=_0x214973[_0xf9ad('0x2d')]&&_0x2c7578[_0xf9ad('0x1e')]>0x1;var _0xfbe63f=[];if(!fs[_0xf9ad('0x35')](path[_0xf9ad('0x36')](_0x4a1dde,_0x24ef39))&&_0x19cb56){fs[_0xf9ad('0x37')](path['join'](_0x4a1dde,_0x24ef39));}return BPromise[_0xf9ad('0x38')](_0x2c7578,function(_0x5b0f53){_0xfbe63f[_0xf9ad('0x16')](_0x5b0f53);})[_0xf9ad('0x2c')](function(){var _0x22e0d8=[];for(var _0x515db2=0x0;_0x515db2<_0xfbe63f[_0xf9ad('0x1e')];_0x515db2+=0x1){var _0x422725=_0xfbe63f[_0x515db2];var _0x27fd71=createTables(_[_0xf9ad('0x39')](_0x422725));var _0x2878f7;var _0x3a8d3b=getPDFDocDefinition(_0x27fd71);var _0x4a10fc=getPDFPrinter();var _0x2f31fa=_0x4a10fc['createPdfKitDocument'](_0x3a8d3b);if(_0x19cb56){_0x2878f7=path[_0xf9ad('0x36')](_0x4a1dde,_0x24ef39,util['format']('%s%d.%s',_0x24ef39,_0x515db2,_0xf9ad('0x3a')));}else{_0x2878f7=path[_0xf9ad('0x36')](_0x4a1dde,util['format'](_0xf9ad('0x3b'),_0x24ef39,_0xf9ad('0x3a')));}_0x22e0d8['push'](writePDFDocument(_0x2f31fa,_0x2878f7));}return Promise[_0xf9ad('0x3c')](_0x22e0d8);})[_0xf9ad('0x2c')](function(){if(_0x19cb56){return new Promise(function(_0x12b014){zipdir(path['join'](_0x4a1dde,_0x24ef39),{'saveTo':path['join'](_0x4a1dde,util[_0xf9ad('0x1b')](_0xf9ad('0x3b'),_0x24ef39,_0xf9ad('0x3d')))},function(){rimraf(path[_0xf9ad('0x36')](_0x4a1dde,_0x24ef39),function(){});_0x12b014('zip\x20finished');});});}})['then'](function(){if(!_0x19cb56)return;rimraf(path[_0xf9ad('0x36')](_0x4a1dde,_0x24ef39),function(){});})[_0xf9ad('0x2c')](function(){logger[_0xf9ad('0x3e')](util['format']('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0xf9ad('0x3f')));return analyticExtractedReport(_0xf9ad('0x40'),_0x19cb56?util[_0xf9ad('0x1b')](_0xf9ad('0x3b'),_0x24ef39,_0x19cb56?'zip':'pdf'):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0xf9ad('0x3e')](util['format']('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xf9ad('0x3f')));return db[_0xf9ad('0x41')][_0xf9ad('0x42')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0xf9ad('0x2c')](function(_0x1af2af){EXTRACTED_REPORT=_0x1af2af;return dbH[_0xf9ad('0x2f')][_0xf9ad('0x33')](util[_0xf9ad('0x1b')](_0xf9ad('0x43'),QUERY),{'type':dbH[_0xf9ad('0x2f')][_0xf9ad('0x31')][_0xf9ad('0x32')]});})[_0xf9ad('0x2c')](extractReport)[_0xf9ad('0x44')](function(_0x51b958){logger[_0xf9ad('0x3e')](util[_0xf9ad('0x1b')](_0xf9ad('0x45'),EXTRACTED_REPORT_ID,_0xf9ad('0x3f')),util['inspect'](_0x51b958,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xf9ad('0x46'));})[_0xf9ad('0x47')](function(){process[_0xf9ad('0x48')](EXIT_CODE);});}main();function getPDFPrinter(){var _0xf27f0a=new PdfPrinter({'Arial':{'normal':__dirname+_0xf9ad('0x49'),'bold':__dirname+_0xf9ad('0x4a'),'italics':__dirname+_0xf9ad('0x4b'),'bolditalics':__dirname+_0xf9ad('0x4c')}});return _0xf27f0a;}function getPDFDocDefinitionFromHTML(_0xd2275c,_0x559161){var _0x2d013e=util['format'](_0xf9ad('0x4d'),_0x559161['channel'],_0x559161[_0xf9ad('0x4e')]);var _0x29ef33=moment()[_0xf9ad('0x1b')](_0xf9ad('0x4f'))[_0xf9ad('0x23')]();var _0x130923=htmlToPdfmake(_0xd2275c,{'window':window,'tableAutoSize':!![]});return{'content':[_0x130923],'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0xf9ad('0x50'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0xf9ad('0x50'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0xf9ad('0x50')}},'header':function(){return[{'text':_0xf9ad('0x51'),'style':_0xf9ad('0x1f')}];},'footer':function(_0x588939,_0x475092){return[{'text':util['format'](_0xf9ad('0x52'),_0x2d013e,_0x588939,_0x475092,_0x29ef33),'style':_0xf9ad('0x53')}];}};}function writePDFDocument(_0x206c9b,_0x283347){return new Promise(function(_0x380ffe,_0x1835aa){var _0x3fb054=_0x206c9b[_0xf9ad('0x54')](fs[_0xf9ad('0x55')](_0x283347));_0x3fb054['on'](_0xf9ad('0x56'),function(){_0x380ffe(_0xf9ad('0x56'));});_0x3fb054['on'](_0xf9ad('0x57'),function(_0x26bd26){_0x1835aa(_0x26bd26);});_0x206c9b[_0xf9ad('0x58')]();});}exports[_0xf9ad('0x59')]=function(_0x27ae8a,_0x2208de){var _0x377d33=getPDFPrinter();var _0x31e6f2=getPDFDocDefinitionFromHTML(_0x27ae8a,_0x2208de);var _0x2a9785=_0x377d33['createPdfKitDocument'](_0x31e6f2);return writePDFDocument(_0x2a9785,_0x2208de['path'])['catch'](function(_0x37b596){throw _0x37b596;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index 9441319..1cffffe 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 _0x7939=['info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','zip','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','util','path','lodash','json2xls','bluebird','zip-dir','rimraf','../../mysqldb','dbH','analytics','argv','savename','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','find','splitSizeXlsx','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','num','Empty','split','length','isInteger','%s\x20limit\x20%d\x20OFFSET\x20%d','push','basename','.xlsx','join','mkdirSync','each','%s%d.%s','%s.%s','xlsx','writeFileSync','binary','zip\x20finished'];(function(_0x31f9fd,_0x5c6fbe){var _0x5a6f3b=function(_0xef3cbb){while(--_0xef3cbb){_0x31f9fd['push'](_0x31f9fd['shift']());}};_0x5a6f3b(++_0x5c6fbe);}(_0x7939,0x190));var _0x9793=function(_0x377be6,_0x2be95c){_0x377be6=_0x377be6-0x0;var _0x5e2807=_0x7939[_0x377be6];return _0x5e2807;};'use strict';var util=require(_0x9793('0x0'));var path=require(_0x9793('0x1'));var _=require(_0x9793('0x2'));var fs=require('fs');var json2xls=require(_0x9793('0x3'));var BPromise=require(_0x9793('0x4'));var zipdir=require(_0x9793('0x5'));var rimraf=require(_0x9793('0x6'));var db=require('../../mysqldb')['db'];var dbH=require(_0x9793('0x7'))[_0x9793('0x8')];var logger=require('../../config/logger')(_0x9793('0x9'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x9793('0xa')][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x3fc665,_0x386aa5){var _0x361d5f={'status':_0x3fc665};var _0x57af92={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x386aa5){_0x361d5f[_0x9793('0xb')]=_0x386aa5;}return db['AnalyticExtractedReport']['update'](_0x361d5f,_0x57af92);}function main(){var _0x39fcb2=0x1388;var _0x28dcff;logger['info'](util[_0x9793('0xc')](_0x9793('0xd'),EXTRACTED_REPORT_ID,_0x9793('0xe')));return db[_0x9793('0xf')][_0x9793('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x9793('0x11')]})[_0x9793('0x12')](function(_0x356fc4){if(_0x356fc4){_0x28dcff=_0x356fc4;_0x39fcb2=_0x28dcff[_0x9793('0x11')]||0x1388;}})[_0x9793('0x12')](function(){return dbH[_0x9793('0x13')][_0x9793('0x14')](util[_0x9793('0xc')](_0x9793('0x15'),QUERY),{'type':dbH[_0x9793('0x13')][_0x9793('0x16')]['SELECT']});})[_0x9793('0x12')](function(_0x47db0){if(!_0x47db0[0x0][_0x9793('0x17')]){return analyticExtractedReport(_0x9793('0x18'));}var _0xfec9c1=[];var _0x5930a6=0x0;if(_0x28dcff[_0x9793('0x19')]){if(_0x47db0&&_0x47db0[_0x9793('0x1a')]){var _0x2db390=_['range'](_0x47db0[0x0][_0x9793('0x17')]/_0x39fcb2);var _0x359e29=Number[_0x9793('0x1b')](_0x47db0[0x0]['num']/_0x39fcb2)?_0x47db0[0x0][_0x9793('0x17')]%_0x39fcb2:0x0;_0x2db390['forEach'](function(_0x56f022){if(_0x56f022>0x0){_0x5930a6+=_0x39fcb2;}_0xfec9c1['push'](dbH[_0x9793('0x13')][_0x9793('0x14')](util[_0x9793('0xc')](_0x9793('0x1c'),QUERY,_0x39fcb2,_0x5930a6),{'type':dbH['sequelize'][_0x9793('0x16')]['SELECT']}));});if(_0x359e29>0x0){_0x5930a6+=_0x39fcb2;_0xfec9c1[_0x9793('0x1d')](dbH[_0x9793('0x13')][_0x9793('0x14')](util[_0x9793('0xc')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x359e29,_0x5930a6),{'type':dbH[_0x9793('0x13')][_0x9793('0x16')]['SELECT']}));}}}else{_0xfec9c1[_0x9793('0x1d')](dbH[_0x9793('0x13')][_0x9793('0x14')](QUERY,{'type':dbH[_0x9793('0x13')][_0x9793('0x16')]['SELECT']}));}var _0x515a35=path['dirname'](PATH);var _0x1b33f0=path[_0x9793('0x1e')](PATH,_0x9793('0x1f'));var _0x13ecc3=_0x28dcff['split']&&_0xfec9c1[_0x9793('0x1a')]>0x1;var _0x2aaf5c=[];if(!fs['existsSync'](path[_0x9793('0x20')](_0x515a35,_0x1b33f0))&&_0x13ecc3){fs[_0x9793('0x21')](path[_0x9793('0x20')](_0x515a35,_0x1b33f0));}return BPromise[_0x9793('0x22')](_0xfec9c1,function(_0x45a6d0){_0x2aaf5c['push'](_0x45a6d0);})[_0x9793('0x12')](function(){for(var _0xa85a19=0x0;_0xa85a19<_0x2aaf5c[_0x9793('0x1a')];_0xa85a19+=0x1){var _0x49b07a;var _0x533ce4=_0x2aaf5c[_0xa85a19];if(_0x13ecc3){_0x49b07a=path['join'](_0x515a35,_0x1b33f0,util['format'](_0x9793('0x23'),_0x1b33f0,_0xa85a19,'xlsx'));}else{_0x49b07a=path[_0x9793('0x20')](_0x515a35,util[_0x9793('0xc')](_0x9793('0x24'),_0x1b33f0,_0x9793('0x25')));}fs[_0x9793('0x26')](_0x49b07a,json2xls(_0x533ce4),_0x9793('0x27'));}})[_0x9793('0x12')](function(){if(_0x13ecc3){return new Promise(function(_0x27b216){zipdir(path['join'](_0x515a35,_0x1b33f0),{'saveTo':path['join'](_0x515a35,util[_0x9793('0xc')]('%s.%s',_0x1b33f0,'zip'))},function(_0x1a5467,_0x4460ee){rimraf(path[_0x9793('0x20')](_0x515a35,_0x1b33f0),function(){});_0x27b216(_0x9793('0x28'));});});}})['then'](function(){logger[_0x9793('0x29')](util['format'](_0x9793('0x2a'),EXTRACTED_REPORT_ID,_0x9793('0xe')));return analyticExtractedReport('Completed',_0x13ecc3?util[_0x9793('0xc')](_0x9793('0x24'),_0x1b33f0,_0x13ecc3?_0x9793('0x2b'):'xlsx'):null);});})[_0x9793('0x2c')](function(_0x1bc542){logger[_0x9793('0x29')](util['format'](_0x9793('0x2d'),EXTRACTED_REPORT_ID,_0x9793('0xe')),util[_0x9793('0x2e')](_0x1bc542,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x9793('0x2f'));})[_0x9793('0x30')](function(){process['exit'](EXIT_CODE);});}main(); \ No newline at end of file +var _0x4220=['Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','find','split','splitSizeXlsx','then','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','sequelize','QueryTypes','SELECT','num','Empty','length','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.xlsx','existsSync','join','mkdirSync','each','%s.%s','xlsx','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','path','lodash','json2xls','bluebird','zip-dir','rimraf','../../mysqldb','../../config/logger','argv','savename','AnalyticExtractedReport','info','format'];(function(_0x1ccf81,_0x1f5d6f){var _0x4dfeeb=function(_0x332045){while(--_0x332045){_0x1ccf81['push'](_0x1ccf81['shift']());}};_0x4dfeeb(++_0x1f5d6f);}(_0x4220,0xd4));var _0x0422=function(_0x39258b,_0x41c498){_0x39258b=_0x39258b-0x0;var _0x5c2e8c=_0x4220[_0x39258b];return _0x5c2e8c;};'use strict';var util=require('util');var path=require(_0x0422('0x0'));var _=require(_0x0422('0x1'));var fs=require('fs');var json2xls=require(_0x0422('0x2'));var BPromise=require(_0x0422('0x3'));var zipdir=require(_0x0422('0x4'));var rimraf=require(_0x0422('0x5'));var db=require(_0x0422('0x6'))['db'];var dbH=require('../../mysqldb')['dbH'];var logger=require(_0x0422('0x7'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x0422('0x8')][0x2]);var QUERY=process[_0x0422('0x8')][0x3];var PATH=process[_0x0422('0x8')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x481fd3,_0x34a2ff){var _0x236d1f={'status':_0x481fd3};var _0x4aeeb5={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x34a2ff){_0x236d1f[_0x0422('0x9')]=_0x34a2ff;}return db[_0x0422('0xa')]['update'](_0x236d1f,_0x4aeeb5);}function main(){var _0x31560a=0x1388;var _0x31eb73;logger[_0x0422('0xb')](util[_0x0422('0xc')](_0x0422('0xd'),EXTRACTED_REPORT_ID,_0x0422('0xe')));return db['Setting'][_0x0422('0xf')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x0422('0x10'),_0x0422('0x11')]})[_0x0422('0x12')](function(_0x374884){if(_0x374884){_0x31eb73=_0x374884;_0x31560a=_0x31eb73[_0x0422('0x11')]||0x1388;}})[_0x0422('0x12')](function(){return dbH['sequelize'][_0x0422('0x13')](util['format'](_0x0422('0x14'),QUERY),{'type':dbH[_0x0422('0x15')][_0x0422('0x16')][_0x0422('0x17')]});})[_0x0422('0x12')](function(_0x3c346c){if(!_0x3c346c[0x0][_0x0422('0x18')]){return analyticExtractedReport(_0x0422('0x19'));}var _0x4b6a6c=[];var _0x104785=0x0;if(_0x31eb73[_0x0422('0x10')]){if(_0x3c346c&&_0x3c346c[_0x0422('0x1a')]){var _0xc745e8=_['range'](_0x3c346c[0x0][_0x0422('0x18')]/_0x31560a);var _0x436e0c=Number['isInteger'](_0x3c346c[0x0]['num']/_0x31560a)?_0x3c346c[0x0]['num']%_0x31560a:0x0;_0xc745e8[_0x0422('0x1b')](function(_0x3d7d00){if(_0x3d7d00>0x0){_0x104785+=_0x31560a;}_0x4b6a6c[_0x0422('0x1c')](dbH[_0x0422('0x15')][_0x0422('0x13')](util['format'](_0x0422('0x1d'),QUERY,_0x31560a,_0x104785),{'type':dbH['sequelize'][_0x0422('0x16')][_0x0422('0x17')]}));});if(_0x436e0c>0x0){_0x104785+=_0x31560a;_0x4b6a6c[_0x0422('0x1c')](dbH[_0x0422('0x15')][_0x0422('0x13')](util[_0x0422('0xc')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x436e0c,_0x104785),{'type':dbH[_0x0422('0x15')][_0x0422('0x16')][_0x0422('0x17')]}));}}}else{_0x4b6a6c['push'](dbH[_0x0422('0x15')][_0x0422('0x13')](QUERY,{'type':dbH[_0x0422('0x15')]['QueryTypes'][_0x0422('0x17')]}));}var _0x34966c=path[_0x0422('0x1e')](PATH);var _0x17b698=path[_0x0422('0x1f')](PATH,_0x0422('0x20'));var _0x434927=_0x31eb73[_0x0422('0x10')]&&_0x4b6a6c[_0x0422('0x1a')]>0x1;var _0x7505f2=[];if(!fs[_0x0422('0x21')](path[_0x0422('0x22')](_0x34966c,_0x17b698))&&_0x434927){fs[_0x0422('0x23')](path['join'](_0x34966c,_0x17b698));}return BPromise[_0x0422('0x24')](_0x4b6a6c,function(_0x4dc5e7){_0x7505f2['push'](_0x4dc5e7);})[_0x0422('0x12')](function(){for(var _0x44734a=0x0;_0x44734a<_0x7505f2[_0x0422('0x1a')];_0x44734a+=0x1){var _0x5ebac3;var _0x574812=_0x7505f2[_0x44734a];if(_0x434927){_0x5ebac3=path[_0x0422('0x22')](_0x34966c,_0x17b698,util['format']('%s%d.%s',_0x17b698,_0x44734a,'xlsx'));}else{_0x5ebac3=path[_0x0422('0x22')](_0x34966c,util[_0x0422('0xc')](_0x0422('0x25'),_0x17b698,_0x0422('0x26')));}fs['writeFileSync'](_0x5ebac3,json2xls(_0x574812),'binary');}})[_0x0422('0x12')](function(){if(_0x434927){return new Promise(function(_0x3662e4){zipdir(path[_0x0422('0x22')](_0x34966c,_0x17b698),{'saveTo':path[_0x0422('0x22')](_0x34966c,util['format'](_0x0422('0x25'),_0x17b698,_0x0422('0x27')))},function(_0x50bdf7,_0x2e463d){rimraf(path[_0x0422('0x22')](_0x34966c,_0x17b698),function(){});_0x3662e4('zip\x20finished');});});}})[_0x0422('0x12')](function(){logger[_0x0422('0xb')](util[_0x0422('0xc')](_0x0422('0x28'),EXTRACTED_REPORT_ID,_0x0422('0xe')));return analyticExtractedReport(_0x0422('0x29'),_0x434927?util['format'](_0x0422('0x25'),_0x17b698,_0x434927?_0x0422('0x27'):_0x0422('0x26')):null);});})[_0x0422('0x2a')](function(_0x5e5df9){logger[_0x0422('0xb')](util[_0x0422('0xc')](_0x0422('0x2b'),EXTRACTED_REPORT_ID,_0x0422('0xe')),util[_0x0422('0x2c')](_0x5e5df9,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})['finally'](function(){process['exit'](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index 524ca7c..c214a4a 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 _0xe8eb=['splice','GotoIfTime',',${EXTEN},','last','concat','Hangup','transaction','sortBy','catch','error','rewrite','lodash','models','Interval','findAll','intervals','IntervalId','then','VoiceExtension','uniq','map','exten','filter','queue','playback','hasOwnProperty','priority','extension','find','push','type','Set','format','CDR(type)=%s','context','VoiceExtensionId','inbound','extensions','CDR(routeid)=','CDR(destination)=','cutdigits','${EXTEN:','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','createdAt','updatedAt','interval','*,*,*,*','tag','CDR(tag)=','outbound','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','indexOf','app','toLowerCase','appType','custom','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1'];(function(_0x86b219,_0x43038f){var _0x1f320c=function(_0x8cd63f){while(--_0x8cd63f){_0x86b219['push'](_0x86b219['shift']());}};_0x1f320c(++_0x43038f);}(_0xe8eb,0x1c7));var _0xbe8e=function(_0x5e0115,_0x134af6){_0x5e0115=_0x5e0115-0x0;var _0x31241d=_0xe8eb[_0x5e0115];return _0x31241d;};'use strict';var _=require(_0xbe8e('0x0'));var util=require('util');function rewrite(_0xf17580,_0x377603){var _0x552314=this;return _0xf17580[_0xbe8e('0x1')][_0xbe8e('0x2')][_0xbe8e('0x3')]({'raw':!![]})['then'](function(_0x2a147c){_0x552314[_0xbe8e('0x4')]=_0x2a147c;return _0xf17580[_0xbe8e('0x1')]['VoiceExtension'][_0xbe8e('0x3')]({'where':{'IntervalId':_0x377603[_0xbe8e('0x5')]},'raw':!![]});})[_0xbe8e('0x6')](function(_0x1408fa){return _0xf17580['models'][_0xbe8e('0x7')][_0xbe8e('0x3')]({'where':{'exten':{'$in':_[_0xbe8e('0x8')](_[_0xbe8e('0x9')](_0x1408fa,_0xbe8e('0xa')))}},'order':[{'raw':'CAST(priority\x20AS\x20UNSIGNED)'}],'raw':!![]});})[_0xbe8e('0x6')](function(_0x2b75b8){var _0x4e64d6=_['filter'](_0x2b75b8,{'priority':'1'});var _0x1f84a8=_[_0xbe8e('0xb')](_0x2b75b8,{'isApp':0x1});var _0x40960d=_['groupBy'](_0x1f84a8,_0xbe8e('0xa'));var _0x3ad59f=[_0xbe8e('0xc'),_0xbe8e('0xd')];var _0x3744b5=[];var _0x5d6013=[];for(var _0x54b748 in _0x40960d){if(_0x40960d[_0xbe8e('0xe')](_0x54b748)){_0x552314[_0xbe8e('0xf')]=0x2;_0x552314['extensions']=[];_0x552314[_0xbe8e('0x10')]=_[_0xbe8e('0x11')](_0x4e64d6,{'exten':_0x40960d[_0x54b748][0x0][_0xbe8e('0xa')]});_0x552314['extensions'][_0xbe8e('0x12')]({'type':_0x40960d[_0x54b748][0x0][_0xbe8e('0x13')],'app':_0xbe8e('0x14'),'appdata':util[_0xbe8e('0x15')](_0xbe8e('0x16'),_0x40960d[_0x54b748][0x0][_0xbe8e('0x13')]),'context':_0x40960d[_0x54b748][0x0][_0xbe8e('0x17')],'exten':_0x40960d[_0x54b748][0x0][_0xbe8e('0xa')],'priority':_0x552314[_0xbe8e('0xf')]++,'VoiceExtensionId':_0x40960d[_0x54b748][0x0][_0xbe8e('0x18')]});if(_0x40960d[_0x54b748][0x0]['type']===_0xbe8e('0x19')){_0x552314[_0xbe8e('0x1a')][_0xbe8e('0x12')]({'type':_0x40960d[_0x54b748][0x0]['type'],'app':_0xbe8e('0x14'),'appdata':_0xbe8e('0x1b')+_0x40960d[_0x54b748][0x0][_0xbe8e('0x18')],'context':_0x40960d[_0x54b748][0x0][_0xbe8e('0x17')],'exten':_0x40960d[_0x54b748][0x0][_0xbe8e('0xa')],'priority':_0x552314[_0xbe8e('0xf')]++,'VoiceExtensionId':_0x40960d[_0x54b748][0x0][_0xbe8e('0x18')]});}else if(_0x40960d[_0x54b748][0x0][_0xbe8e('0x13')]==='outbound'){if(_0x552314[_0xbe8e('0x10')]){_0x552314['extensions'][_0xbe8e('0x12')]({'type':_0x40960d[_0x54b748][0x0][_0xbe8e('0x13')],'app':_0xbe8e('0x14'),'appdata':_0xbe8e('0x1c')+(_0x552314['extension'][_0xbe8e('0x1d')]?_0xbe8e('0x1e')+_0x552314[_0xbe8e('0x10')]['cutdigits']+'}':'${EXTEN}'),'context':_0x40960d[_0x54b748][0x0][_0xbe8e('0x17')],'exten':_0x40960d[_0x54b748][0x0][_0xbe8e('0xa')],'priority':_0x552314[_0xbe8e('0xf')]++,'VoiceExtensionId':_0x40960d[_0x54b748][0x0][_0xbe8e('0x18')]});}_0x552314['extensions'][_0xbe8e('0x12')]({'type':_0x40960d[_0x54b748][0x0]['type'],'app':'Set','appdata':_0xbe8e('0x1b')+_0x40960d[_0x54b748][0x0][_0xbe8e('0x18')],'context':_0x40960d[_0x54b748][0x0][_0xbe8e('0x17')],'exten':_0x40960d[_0x54b748][0x0][_0xbe8e('0xa')],'priority':_0x552314[_0xbe8e('0xf')]++,'VoiceExtensionId':_0x40960d[_0x54b748][0x0][_0xbe8e('0x18')]});var _0x1820a2=_0x552314[_0xbe8e('0xf')]++;_0x552314[_0xbe8e('0x1a')][_0xbe8e('0x12')]({'type':_0x40960d[_0x54b748][0x0][_0xbe8e('0x13')],'app':_0xbe8e('0x1f'),'appdata':_0xbe8e('0x20')+(_0x1820a2+0x2)+_0xbe8e('0x21')+(_0x1820a2+0x1)+')','context':_0x40960d[_0x54b748][0x0][_0xbe8e('0x17')],'exten':_0x40960d[_0x54b748][0x0][_0xbe8e('0xa')],'priority':_0x1820a2,'VoiceExtensionId':_0x40960d[_0x54b748][0x0]['VoiceExtensionId']});if(_0x552314[_0xbe8e('0x10')]){_0x552314['extensions'][_0xbe8e('0x12')]({'type':_0x40960d[_0x54b748][0x0][_0xbe8e('0x13')],'app':_0xbe8e('0x14'),'appdata':_0x552314[_0xbe8e('0x10')][_0xbe8e('0x1d')]?_0xbe8e('0x22')+_0x552314['extension'][_0xbe8e('0x1d')]+'}':_0xbe8e('0x23'),'context':_0x40960d[_0x54b748][0x0]['context'],'exten':_0x40960d[_0x54b748][0x0][_0xbe8e('0xa')],'priority':_0x552314[_0xbe8e('0xf')]++,'VoiceExtensionId':_0x40960d[_0x54b748][0x0][_0xbe8e('0x18')]});}_0x552314[_0xbe8e('0x1a')]['push']({'type':_0x40960d[_0x54b748][0x0]['type'],'app':_0xbe8e('0x14'),'appdata':_0xbe8e('0x24')+_0x40960d[_0x54b748][0x0][_0xbe8e('0x18')],'context':_0x40960d[_0x54b748][0x0][_0xbe8e('0x17')],'exten':_0x40960d[_0x54b748][0x0][_0xbe8e('0xa')],'priority':_0x552314[_0xbe8e('0xf')]++,'VoiceExtensionId':_0x40960d[_0x54b748][0x0][_0xbe8e('0x18')]});if(_0x552314[_0xbe8e('0x10')]&&_0x552314[_0xbe8e('0x10')]['hasOwnProperty'](_0xbe8e('0x25'))&&_0x552314['extension']['recordingFormat']!=='none'){_0x552314['extensions']['push']({'type':_0x40960d[_0x54b748][0x0]['type'],'app':_0xbe8e('0x14'),'appdata':_0xbe8e('0x26'),'context':_0x40960d[_0x54b748][0x0][_0xbe8e('0x17')],'exten':_0x40960d[_0x54b748][0x0]['exten'],'priority':_0x552314[_0xbe8e('0xf')]++,'VoiceExtensionId':_0x40960d[_0x54b748][0x0][_0xbe8e('0x18')]});_0x552314['extensions'][_0xbe8e('0x12')]({'type':_0x40960d[_0x54b748][0x0][_0xbe8e('0x13')],'app':'Set','appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x552314['extension'][_0xbe8e('0x25')]||_0xbe8e('0x27'),'context':_0x40960d[_0x54b748][0x0][_0xbe8e('0x17')],'exten':_0x40960d[_0x54b748][0x0][_0xbe8e('0xa')],'priority':_0x552314[_0xbe8e('0xf')]++,'VoiceExtensionId':_0x40960d[_0x54b748][0x0][_0xbe8e('0x18')]});}}_0x552314[_0xbe8e('0x1a')][_0xbe8e('0x12')]({'type':_0x40960d[_0x54b748][0x0][_0xbe8e('0x13')],'app':_0xbe8e('0x14'),'appdata':_0xbe8e('0x28'),'context':_0x40960d[_0x54b748][0x0][_0xbe8e('0x17')],'exten':_0x40960d[_0x54b748][0x0][_0xbe8e('0xa')],'priority':_0x552314[_0xbe8e('0xf')]++,'VoiceExtensionId':_0x40960d[_0x54b748][0x0][_0xbe8e('0x18')]});_0x552314[_0xbe8e('0x1a')][_0xbe8e('0x12')]({'type':_0x40960d[_0x54b748][0x0]['type'],'app':_0xbe8e('0x14'),'appdata':_0xbe8e('0x29'),'context':_0x40960d[_0x54b748][0x0][_0xbe8e('0x17')],'exten':_0x40960d[_0x54b748][0x0]['exten'],'priority':_0x552314[_0xbe8e('0xf')]++,'VoiceExtensionId':_0x40960d[_0x54b748][0x0][_0xbe8e('0x18')]});_0x552314['extensions']['push']({'type':_0x40960d[_0x54b748][0x0][_0xbe8e('0x13')],'app':_0xbe8e('0x14'),'appdata':_0xbe8e('0x2a'),'context':_0x40960d[_0x54b748][0x0][_0xbe8e('0x17')],'exten':_0x40960d[_0x54b748][0x0]['exten'],'priority':_0x552314[_0xbe8e('0xf')]++,'VoiceExtensionId':_0x40960d[_0x54b748][0x0][_0xbe8e('0x18')]});for(var _0x108d04=0x0,_0x4a39eb=0x0;_0x108d04<_0x40960d[_0x54b748][_0xbe8e('0x2b')];_0x108d04+=0x1,_0x4a39eb=0x0){var _0x575ab4=_0x40960d[_0x54b748][_0x108d04];if(_0x575ab4[_0xbe8e('0x13')]){_0x575ab4['type']=_0x575ab4['type']['toLowerCase']();}var _0x485e1c=[];var _0x217c42=[];delete _0x575ab4['id'];delete _0x575ab4[_0xbe8e('0x2c')];delete _0x575ab4[_0xbe8e('0x2d')];var _0x7e4bb5=_0x575ab4[_0xbe8e('0x2e')]!==_0xbe8e('0x2f')?[_0x575ab4[_0xbe8e('0x2e')]]:_0x575ab4[_0xbe8e('0x5')]?_[_0xbe8e('0x9')](_['filter'](_0x552314[_0xbe8e('0x4')],{'IntervalId':_0x575ab4[_0xbe8e('0x5')]}),_0xbe8e('0x2e')):[];if(_0x575ab4[_0xbe8e('0xe')](_0xbe8e('0x30'))){if(_0x575ab4[_0xbe8e('0x30')]&&_0x575ab4[_0xbe8e('0x30')]!=='--'){_0x485e1c[_0xbe8e('0x12')]({'type':_0x575ab4[_0xbe8e('0x13')],'app':_0xbe8e('0x14'),'appdata':_0xbe8e('0x31')+_0x575ab4[_0xbe8e('0x30')],'context':_0x575ab4[_0xbe8e('0x17')],'exten':_0x575ab4[_0xbe8e('0xa')],'priority':_0x7e4bb5[_0xbe8e('0x2b')]+_0x552314[_0xbe8e('0xf')]+_0x4a39eb++,'VoiceExtensionId':_0x575ab4['VoiceExtensionId']});}}if(_0x575ab4[_0xbe8e('0x13')]===_0xbe8e('0x32')&&_0x575ab4[_0xbe8e('0xe')](_0xbe8e('0x33'))){if(_0x575ab4[_0xbe8e('0x33')]){_0x485e1c['push']({'type':_0x575ab4['type'],'app':'ExecIf','appdata':_0xbe8e('0x34')+_0x575ab4[_0xbe8e('0x33')]+')','context':_0x575ab4[_0xbe8e('0x17')],'exten':_0x575ab4[_0xbe8e('0xa')],'priority':_0x7e4bb5[_0xbe8e('0x2b')]+_0x552314[_0xbe8e('0xf')]+_0x4a39eb++,'VoiceExtensionId':_0x575ab4[_0xbe8e('0x18')]});}else{_0x485e1c[_0xbe8e('0x12')]({'type':_0x575ab4[_0xbe8e('0x13')],'app':_0xbe8e('0x1f'),'appdata':_0xbe8e('0x35'),'context':_0x575ab4[_0xbe8e('0x17')],'exten':_0x575ab4[_0xbe8e('0xa')],'priority':_0x7e4bb5[_0xbe8e('0x2b')]+_0x552314['priority']+_0x4a39eb++,'VoiceExtensionId':_0x575ab4['VoiceExtensionId']});}}if(_0x575ab4[_0xbe8e('0xe')](_0xbe8e('0x36'))){if(_0x3ad59f[_0xbe8e('0x37')](_0x575ab4[_0xbe8e('0x38')][_0xbe8e('0x39')]())>=0x0&&_0x575ab4[_0xbe8e('0x3a')]!==_0xbe8e('0x3b')){if(_0x575ab4[_0xbe8e('0x36')]){_0x485e1c[_0xbe8e('0x12')]({'type':_0x575ab4[_0xbe8e('0x13')],'app':_0xbe8e('0x1f'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x575ab4[_0xbe8e('0x17')],'exten':_0x575ab4[_0xbe8e('0xa')],'priority':_0x7e4bb5['length']+_0x552314[_0xbe8e('0xf')]+_0x4a39eb++,'VoiceExtensionId':_0x575ab4[_0xbe8e('0x18')]});_0x485e1c[_0xbe8e('0x12')]({'type':_0x575ab4['type'],'app':_0xbe8e('0x14'),'appdata':_0xbe8e('0x3c'),'context':_0x575ab4[_0xbe8e('0x17')],'exten':_0x575ab4[_0xbe8e('0xa')],'priority':_0x7e4bb5[_0xbe8e('0x2b')]+_0x552314[_0xbe8e('0xf')]+_0x4a39eb++,'VoiceExtensionId':_0x575ab4[_0xbe8e('0x18')]});}else{_0x485e1c['push']({'type':_0x575ab4[_0xbe8e('0x13')],'app':'ExecIf','appdata':_0xbe8e('0x3d'),'context':_0x575ab4[_0xbe8e('0x17')],'exten':_0x575ab4[_0xbe8e('0xa')],'priority':_0x7e4bb5[_0xbe8e('0x2b')]+_0x552314[_0xbe8e('0xf')]+_0x4a39eb++,'VoiceExtensionId':_0x575ab4[_0xbe8e('0x18')]});_0x485e1c['push']({'type':_0x575ab4['type'],'app':'Set','appdata':_0xbe8e('0x3e'),'context':_0x575ab4[_0xbe8e('0x17')],'exten':_0x575ab4[_0xbe8e('0xa')],'priority':_0x7e4bb5[_0xbe8e('0x2b')]+_0x552314['priority']+_0x4a39eb++,'VoiceExtensionId':_0x575ab4['VoiceExtensionId']});}}}for(var _0x33877a=0x0;_0x33877a<_0x7e4bb5[_0xbe8e('0x2b')];_0x33877a+=0x1){var _0x2e90b8=_0x552314[_0xbe8e('0xf')]+_0x7e4bb5['length'];var _0x2fd319=_0x33877a===_0x7e4bb5[_0xbe8e('0x2b')]-0x1?_0x552314[_0xbe8e('0xf')]+_0x485e1c[_0xbe8e('0x2b')]+_0x217c42[_0xbe8e('0x2b')]+0x2:_0x552314['priority']+_0x33877a+0x1;_0x485e1c[_0xbe8e('0x3f')](_0x33877a,0x0,{'type':_0x575ab4[_0xbe8e('0x13')],'app':_0xbe8e('0x40'),'appdata':_0x7e4bb5[_0x33877a]+'?'+_0x575ab4['context']+_0xbe8e('0x41')+_0x2e90b8+':'+_0x575ab4[_0xbe8e('0x17')]+',${EXTEN},'+_0x2fd319,'exten':_0x575ab4[_0xbe8e('0xa')],'context':_0x575ab4['context'],'priority':_0x552314[_0xbe8e('0xf')]+_0x33877a,'VoiceExtensionId':_0x40960d[_0x54b748][0x0][_0xbe8e('0x18')]});}_0x575ab4[_0xbe8e('0xf')]=_0x485e1c[_0xbe8e('0x2b')]?_[_0xbe8e('0x42')](_0x485e1c)['priority']+0x1:_0x552314[_0xbe8e('0xf')];_0x552314[_0xbe8e('0xf')]=(_0x217c42['length']?_[_0xbe8e('0x42')](_0x217c42)[_0xbe8e('0xf')]:_0x575ab4['priority'])+0x1;_0x552314[_0xbe8e('0x1a')]=_[_0xbe8e('0x43')](_0x552314[_0xbe8e('0x1a')],_0x485e1c,[_0x575ab4],_0x217c42);}_0x552314['extensions'][_0xbe8e('0x12')]({'type':_0x40960d[_0x54b748][0x0][_0xbe8e('0x13')],'app':_0xbe8e('0x44'),'exten':_0x40960d[_0x54b748][0x0][_0xbe8e('0xa')],'context':_0x40960d[_0x54b748][0x0][_0xbe8e('0x17')],'priority':_0x552314[_0xbe8e('0xf')],'VoiceExtensionId':_0x40960d[_0x54b748][0x0][_0xbe8e('0x18')]});_0x3744b5['push'](_0x40960d[_0x54b748][0x0][_0xbe8e('0x18')]);_0x5d6013=_[_0xbe8e('0x43')](_0x5d6013,_0x552314[_0xbe8e('0x1a')]);}}return _0xf17580[_0xbe8e('0x45')](function(_0x1b4bad){return _0xf17580[_0xbe8e('0x1')][_0xbe8e('0x7')]['destroy']({'where':{'VoiceExtensionId':{'$in':_0x3744b5}},'transaction':_0x1b4bad})[_0xbe8e('0x6')](function(_0x52a65e){return _0xf17580[_0xbe8e('0x1')][_0xbe8e('0x7')]['bulkCreate'](_[_0xbe8e('0x46')](_0x5d6013,_0xbe8e('0xf')),{'transaction':_0x1b4bad});});});})[_0xbe8e('0x47')](function(_0x17ca34){console[_0xbe8e('0x48')](_0x17ca34);});}exports[_0xbe8e('0x49')]=rewrite; \ No newline at end of file +var _0xbd09=['CDR(routeid)=','VoiceExtensionId','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','):Goto(','CDR(prefix)=noprefix','outboundrouteid=','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','recordingFormat','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','createdAt','updatedAt','interval','*,*,*,*','tag','CDR(tag)=','outbound','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','XCALLY-MOTION-PROGRESS=1',',${EXTEN},','last','concat','Hangup','destroy','sortBy','error','rewrite','lodash','util','models','findAll','intervals','VoiceExtension','IntervalId','then','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','queue','playback','hasOwnProperty','extensions','extension','find','push','type','Set','CDR(type)=%s','context','priority','inbound'];(function(_0x8719b4,_0x21b9ca){var _0x1ffc6a=function(_0x34fdc6){while(--_0x34fdc6){_0x8719b4['push'](_0x8719b4['shift']());}};_0x1ffc6a(++_0x21b9ca);}(_0xbd09,0x145));var _0x9bd0=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xbd09[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x9bd0('0x0'));var util=require(_0x9bd0('0x1'));function rewrite(_0x1f55b2,_0x3b2ffc){var _0x183429=this;return _0x1f55b2[_0x9bd0('0x2')]['Interval'][_0x9bd0('0x3')]({'raw':!![]})['then'](function(_0x15efd3){_0x183429[_0x9bd0('0x4')]=_0x15efd3;return _0x1f55b2[_0x9bd0('0x2')][_0x9bd0('0x5')][_0x9bd0('0x3')]({'where':{'IntervalId':_0x3b2ffc[_0x9bd0('0x6')]},'raw':!![]});})[_0x9bd0('0x7')](function(_0x41712f){return _0x1f55b2[_0x9bd0('0x2')][_0x9bd0('0x5')]['findAll']({'where':{'exten':{'$in':_['uniq'](_['map'](_0x41712f,_0x9bd0('0x8')))}},'order':[{'raw':_0x9bd0('0x9')}],'raw':!![]});})['then'](function(_0x28f650){var _0x4a54fe=_[_0x9bd0('0xa')](_0x28f650,{'priority':'1'});var _0x545eec=_[_0x9bd0('0xa')](_0x28f650,{'isApp':0x1});var _0x1d81e9=_[_0x9bd0('0xb')](_0x545eec,_0x9bd0('0x8'));var _0x544a4b=[_0x9bd0('0xc'),_0x9bd0('0xd')];var _0x180f7f=[];var _0x27038e=[];for(var _0x9f630a in _0x1d81e9){if(_0x1d81e9[_0x9bd0('0xe')](_0x9f630a)){_0x183429['priority']=0x2;_0x183429[_0x9bd0('0xf')]=[];_0x183429[_0x9bd0('0x10')]=_[_0x9bd0('0x11')](_0x4a54fe,{'exten':_0x1d81e9[_0x9f630a][0x0][_0x9bd0('0x8')]});_0x183429[_0x9bd0('0xf')][_0x9bd0('0x12')]({'type':_0x1d81e9[_0x9f630a][0x0][_0x9bd0('0x13')],'app':_0x9bd0('0x14'),'appdata':util['format'](_0x9bd0('0x15'),_0x1d81e9[_0x9f630a][0x0]['type']),'context':_0x1d81e9[_0x9f630a][0x0][_0x9bd0('0x16')],'exten':_0x1d81e9[_0x9f630a][0x0][_0x9bd0('0x8')],'priority':_0x183429[_0x9bd0('0x17')]++,'VoiceExtensionId':_0x1d81e9[_0x9f630a][0x0]['VoiceExtensionId']});if(_0x1d81e9[_0x9f630a][0x0][_0x9bd0('0x13')]===_0x9bd0('0x18')){_0x183429[_0x9bd0('0xf')][_0x9bd0('0x12')]({'type':_0x1d81e9[_0x9f630a][0x0][_0x9bd0('0x13')],'app':'Set','appdata':_0x9bd0('0x19')+_0x1d81e9[_0x9f630a][0x0]['VoiceExtensionId'],'context':_0x1d81e9[_0x9f630a][0x0][_0x9bd0('0x16')],'exten':_0x1d81e9[_0x9f630a][0x0]['exten'],'priority':_0x183429['priority']++,'VoiceExtensionId':_0x1d81e9[_0x9f630a][0x0][_0x9bd0('0x1a')]});}else if(_0x1d81e9[_0x9f630a][0x0][_0x9bd0('0x13')]==='outbound'){if(_0x183429[_0x9bd0('0x10')]){_0x183429[_0x9bd0('0xf')][_0x9bd0('0x12')]({'type':_0x1d81e9[_0x9f630a][0x0]['type'],'app':_0x9bd0('0x14'),'appdata':_0x9bd0('0x1b')+(_0x183429['extension'][_0x9bd0('0x1c')]?_0x9bd0('0x1d')+_0x183429[_0x9bd0('0x10')]['cutdigits']+'}':_0x9bd0('0x1e')),'context':_0x1d81e9[_0x9f630a][0x0][_0x9bd0('0x16')],'exten':_0x1d81e9[_0x9f630a][0x0][_0x9bd0('0x8')],'priority':_0x183429[_0x9bd0('0x17')]++,'VoiceExtensionId':_0x1d81e9[_0x9f630a][0x0][_0x9bd0('0x1a')]});}_0x183429[_0x9bd0('0xf')][_0x9bd0('0x12')]({'type':_0x1d81e9[_0x9f630a][0x0][_0x9bd0('0x13')],'app':'Set','appdata':_0x9bd0('0x19')+_0x1d81e9[_0x9f630a][0x0]['VoiceExtensionId'],'context':_0x1d81e9[_0x9f630a][0x0][_0x9bd0('0x16')],'exten':_0x1d81e9[_0x9f630a][0x0]['exten'],'priority':_0x183429[_0x9bd0('0x17')]++,'VoiceExtensionId':_0x1d81e9[_0x9f630a][0x0][_0x9bd0('0x1a')]});var _0x472dae=_0x183429[_0x9bd0('0x17')]++;_0x183429[_0x9bd0('0xf')]['push']({'type':_0x1d81e9[_0x9f630a][0x0][_0x9bd0('0x13')],'app':'ExecIf','appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x472dae+0x2)+_0x9bd0('0x1f')+(_0x472dae+0x1)+')','context':_0x1d81e9[_0x9f630a][0x0][_0x9bd0('0x16')],'exten':_0x1d81e9[_0x9f630a][0x0][_0x9bd0('0x8')],'priority':_0x472dae,'VoiceExtensionId':_0x1d81e9[_0x9f630a][0x0][_0x9bd0('0x1a')]});if(_0x183429[_0x9bd0('0x10')]){_0x183429[_0x9bd0('0xf')][_0x9bd0('0x12')]({'type':_0x1d81e9[_0x9f630a][0x0]['type'],'app':_0x9bd0('0x14'),'appdata':_0x183429[_0x9bd0('0x10')][_0x9bd0('0x1c')]?'CDR(prefix)=${EXTEN:0:'+_0x183429['extension']['cutdigits']+'}':_0x9bd0('0x20'),'context':_0x1d81e9[_0x9f630a][0x0][_0x9bd0('0x16')],'exten':_0x1d81e9[_0x9f630a][0x0][_0x9bd0('0x8')],'priority':_0x183429['priority']++,'VoiceExtensionId':_0x1d81e9[_0x9f630a][0x0]['VoiceExtensionId']});}_0x183429[_0x9bd0('0xf')][_0x9bd0('0x12')]({'type':_0x1d81e9[_0x9f630a][0x0][_0x9bd0('0x13')],'app':_0x9bd0('0x14'),'appdata':_0x9bd0('0x21')+_0x1d81e9[_0x9f630a][0x0]['VoiceExtensionId'],'context':_0x1d81e9[_0x9f630a][0x0]['context'],'exten':_0x1d81e9[_0x9f630a][0x0][_0x9bd0('0x8')],'priority':_0x183429[_0x9bd0('0x17')]++,'VoiceExtensionId':_0x1d81e9[_0x9f630a][0x0][_0x9bd0('0x1a')]});if(_0x183429[_0x9bd0('0x10')]&&_0x183429[_0x9bd0('0x10')][_0x9bd0('0xe')]('recordingFormat')&&_0x183429['extension']['recordingFormat']!==_0x9bd0('0x22')){_0x183429[_0x9bd0('0xf')][_0x9bd0('0x12')]({'type':_0x1d81e9[_0x9f630a][0x0][_0x9bd0('0x13')],'app':_0x9bd0('0x14'),'appdata':_0x9bd0('0x23'),'context':_0x1d81e9[_0x9f630a][0x0]['context'],'exten':_0x1d81e9[_0x9f630a][0x0]['exten'],'priority':_0x183429[_0x9bd0('0x17')]++,'VoiceExtensionId':_0x1d81e9[_0x9f630a][0x0][_0x9bd0('0x1a')]});_0x183429[_0x9bd0('0xf')][_0x9bd0('0x12')]({'type':_0x1d81e9[_0x9f630a][0x0][_0x9bd0('0x13')],'app':_0x9bd0('0x14'),'appdata':_0x9bd0('0x24')+_0x183429[_0x9bd0('0x10')][_0x9bd0('0x25')]||_0x9bd0('0x26'),'context':_0x1d81e9[_0x9f630a][0x0]['context'],'exten':_0x1d81e9[_0x9f630a][0x0][_0x9bd0('0x8')],'priority':_0x183429['priority']++,'VoiceExtensionId':_0x1d81e9[_0x9f630a][0x0][_0x9bd0('0x1a')]});}}_0x183429[_0x9bd0('0xf')][_0x9bd0('0x12')]({'type':_0x1d81e9[_0x9f630a][0x0][_0x9bd0('0x13')],'app':_0x9bd0('0x14'),'appdata':_0x9bd0('0x27'),'context':_0x1d81e9[_0x9f630a][0x0][_0x9bd0('0x16')],'exten':_0x1d81e9[_0x9f630a][0x0][_0x9bd0('0x8')],'priority':_0x183429[_0x9bd0('0x17')]++,'VoiceExtensionId':_0x1d81e9[_0x9f630a][0x0][_0x9bd0('0x1a')]});_0x183429['extensions'][_0x9bd0('0x12')]({'type':_0x1d81e9[_0x9f630a][0x0][_0x9bd0('0x13')],'app':'Set','appdata':_0x9bd0('0x28'),'context':_0x1d81e9[_0x9f630a][0x0][_0x9bd0('0x16')],'exten':_0x1d81e9[_0x9f630a][0x0][_0x9bd0('0x8')],'priority':_0x183429[_0x9bd0('0x17')]++,'VoiceExtensionId':_0x1d81e9[_0x9f630a][0x0]['VoiceExtensionId']});_0x183429[_0x9bd0('0xf')]['push']({'type':_0x1d81e9[_0x9f630a][0x0]['type'],'app':_0x9bd0('0x14'),'appdata':_0x9bd0('0x29'),'context':_0x1d81e9[_0x9f630a][0x0][_0x9bd0('0x16')],'exten':_0x1d81e9[_0x9f630a][0x0][_0x9bd0('0x8')],'priority':_0x183429['priority']++,'VoiceExtensionId':_0x1d81e9[_0x9f630a][0x0][_0x9bd0('0x1a')]});for(var _0x496343=0x0,_0x371cbc=0x0;_0x496343<_0x1d81e9[_0x9f630a][_0x9bd0('0x2a')];_0x496343+=0x1,_0x371cbc=0x0){var _0x3fff25=_0x1d81e9[_0x9f630a][_0x496343];if(_0x3fff25[_0x9bd0('0x13')]){_0x3fff25[_0x9bd0('0x13')]=_0x3fff25[_0x9bd0('0x13')]['toLowerCase']();}var _0xcdb29a=[];var _0x5bda81=[];delete _0x3fff25['id'];delete _0x3fff25[_0x9bd0('0x2b')];delete _0x3fff25[_0x9bd0('0x2c')];var _0x288d15=_0x3fff25[_0x9bd0('0x2d')]!==_0x9bd0('0x2e')?[_0x3fff25[_0x9bd0('0x2d')]]:_0x3fff25[_0x9bd0('0x6')]?_['map'](_['filter'](_0x183429[_0x9bd0('0x4')],{'IntervalId':_0x3fff25['IntervalId']}),'interval'):[];if(_0x3fff25[_0x9bd0('0xe')](_0x9bd0('0x2f'))){if(_0x3fff25['tag']&&_0x3fff25[_0x9bd0('0x2f')]!=='--'){_0xcdb29a[_0x9bd0('0x12')]({'type':_0x3fff25[_0x9bd0('0x13')],'app':_0x9bd0('0x14'),'appdata':_0x9bd0('0x30')+_0x3fff25[_0x9bd0('0x2f')],'context':_0x3fff25[_0x9bd0('0x16')],'exten':_0x3fff25[_0x9bd0('0x8')],'priority':_0x288d15[_0x9bd0('0x2a')]+_0x183429[_0x9bd0('0x17')]+_0x371cbc++,'VoiceExtensionId':_0x3fff25[_0x9bd0('0x1a')]});}}if(_0x3fff25[_0x9bd0('0x13')]===_0x9bd0('0x31')&&_0x3fff25[_0x9bd0('0xe')](_0x9bd0('0x32'))){if(_0x3fff25[_0x9bd0('0x32')]){_0xcdb29a[_0x9bd0('0x12')]({'type':_0x3fff25[_0x9bd0('0x13')],'app':_0x9bd0('0x33'),'appdata':_0x9bd0('0x34')+_0x3fff25[_0x9bd0('0x32')]+')','context':_0x3fff25['context'],'exten':_0x3fff25[_0x9bd0('0x8')],'priority':_0x288d15[_0x9bd0('0x2a')]+_0x183429[_0x9bd0('0x17')]+_0x371cbc++,'VoiceExtensionId':_0x3fff25[_0x9bd0('0x1a')]});}else{_0xcdb29a[_0x9bd0('0x12')]({'type':_0x3fff25[_0x9bd0('0x13')],'app':_0x9bd0('0x33'),'appdata':_0x9bd0('0x35'),'context':_0x3fff25[_0x9bd0('0x16')],'exten':_0x3fff25[_0x9bd0('0x8')],'priority':_0x288d15['length']+_0x183429[_0x9bd0('0x17')]+_0x371cbc++,'VoiceExtensionId':_0x3fff25['VoiceExtensionId']});}}if(_0x3fff25[_0x9bd0('0xe')](_0x9bd0('0x36'))){if(_0x544a4b['indexOf'](_0x3fff25[_0x9bd0('0x37')]['toLowerCase']())>=0x0&&_0x3fff25[_0x9bd0('0x38')]!==_0x9bd0('0x39')){if(_0x3fff25[_0x9bd0('0x36')]){_0xcdb29a['push']({'type':_0x3fff25['type'],'app':_0x9bd0('0x33'),'appdata':_0x9bd0('0x3a'),'context':_0x3fff25[_0x9bd0('0x16')],'exten':_0x3fff25[_0x9bd0('0x8')],'priority':_0x288d15[_0x9bd0('0x2a')]+_0x183429['priority']+_0x371cbc++,'VoiceExtensionId':_0x3fff25[_0x9bd0('0x1a')]});_0xcdb29a[_0x9bd0('0x12')]({'type':_0x3fff25[_0x9bd0('0x13')],'app':_0x9bd0('0x14'),'appdata':_0x9bd0('0x3b'),'context':_0x3fff25['context'],'exten':_0x3fff25['exten'],'priority':_0x288d15[_0x9bd0('0x2a')]+_0x183429[_0x9bd0('0x17')]+_0x371cbc++,'VoiceExtensionId':_0x3fff25[_0x9bd0('0x1a')]});}else{_0xcdb29a[_0x9bd0('0x12')]({'type':_0x3fff25['type'],'app':_0x9bd0('0x33'),'appdata':_0x9bd0('0x3c'),'context':_0x3fff25[_0x9bd0('0x16')],'exten':_0x3fff25[_0x9bd0('0x8')],'priority':_0x288d15[_0x9bd0('0x2a')]+_0x183429[_0x9bd0('0x17')]+_0x371cbc++,'VoiceExtensionId':_0x3fff25[_0x9bd0('0x1a')]});_0xcdb29a[_0x9bd0('0x12')]({'type':_0x3fff25[_0x9bd0('0x13')],'app':'Set','appdata':_0x9bd0('0x3d'),'context':_0x3fff25[_0x9bd0('0x16')],'exten':_0x3fff25[_0x9bd0('0x8')],'priority':_0x288d15['length']+_0x183429[_0x9bd0('0x17')]+_0x371cbc++,'VoiceExtensionId':_0x3fff25['VoiceExtensionId']});}}}for(var _0x2608b9=0x0;_0x2608b9<_0x288d15[_0x9bd0('0x2a')];_0x2608b9+=0x1){var _0x1370be=_0x183429[_0x9bd0('0x17')]+_0x288d15[_0x9bd0('0x2a')];var _0x2843dd=_0x2608b9===_0x288d15['length']-0x1?_0x183429[_0x9bd0('0x17')]+_0xcdb29a[_0x9bd0('0x2a')]+_0x5bda81[_0x9bd0('0x2a')]+0x2:_0x183429['priority']+_0x2608b9+0x1;_0xcdb29a['splice'](_0x2608b9,0x0,{'type':_0x3fff25[_0x9bd0('0x13')],'app':'GotoIfTime','appdata':_0x288d15[_0x2608b9]+'?'+_0x3fff25['context']+_0x9bd0('0x3e')+_0x1370be+':'+_0x3fff25[_0x9bd0('0x16')]+',${EXTEN},'+_0x2843dd,'exten':_0x3fff25['exten'],'context':_0x3fff25[_0x9bd0('0x16')],'priority':_0x183429['priority']+_0x2608b9,'VoiceExtensionId':_0x1d81e9[_0x9f630a][0x0][_0x9bd0('0x1a')]});}_0x3fff25['priority']=_0xcdb29a['length']?_[_0x9bd0('0x3f')](_0xcdb29a)[_0x9bd0('0x17')]+0x1:_0x183429[_0x9bd0('0x17')];_0x183429[_0x9bd0('0x17')]=(_0x5bda81[_0x9bd0('0x2a')]?_[_0x9bd0('0x3f')](_0x5bda81)[_0x9bd0('0x17')]:_0x3fff25[_0x9bd0('0x17')])+0x1;_0x183429['extensions']=_[_0x9bd0('0x40')](_0x183429[_0x9bd0('0xf')],_0xcdb29a,[_0x3fff25],_0x5bda81);}_0x183429[_0x9bd0('0xf')][_0x9bd0('0x12')]({'type':_0x1d81e9[_0x9f630a][0x0][_0x9bd0('0x13')],'app':_0x9bd0('0x41'),'exten':_0x1d81e9[_0x9f630a][0x0][_0x9bd0('0x8')],'context':_0x1d81e9[_0x9f630a][0x0][_0x9bd0('0x16')],'priority':_0x183429[_0x9bd0('0x17')],'VoiceExtensionId':_0x1d81e9[_0x9f630a][0x0][_0x9bd0('0x1a')]});_0x180f7f['push'](_0x1d81e9[_0x9f630a][0x0][_0x9bd0('0x1a')]);_0x27038e=_[_0x9bd0('0x40')](_0x27038e,_0x183429[_0x9bd0('0xf')]);}}return _0x1f55b2['transaction'](function(_0xba530d){return _0x1f55b2['models'][_0x9bd0('0x5')][_0x9bd0('0x42')]({'where':{'VoiceExtensionId':{'$in':_0x180f7f}},'transaction':_0xba530d})[_0x9bd0('0x7')](function(_0x22b714){return _0x1f55b2['models'][_0x9bd0('0x5')]['bulkCreate'](_[_0x9bd0('0x43')](_0x27038e,_0x9bd0('0x17')),{'transaction':_0xba530d});});});})['catch'](function(_0x1260a1){console[_0x9bd0('0x44')](_0x1260a1);});}exports[_0x9bd0('0x45')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index 0db40aa..722cf37 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 _0x8bd5=['str','calleridnum','cm_hopper_final','\x20=\x20?','id\x20IN\x20?','cm_hopper_black','VoiceQueue','findAll','outbound','dialCheckDuplicateType','CmList','always','VoiceQueueId','onlyIfOpen','sequelize','query','all','BlackLists','get','Lists','CampaignId','Campaign','generalCheckHopper','Error\x20processing\x20rows\x20block:','emit','contact:csv_','resolve','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','CmContact','parse','duplicate','pause','info','Error\x20executing\x20contact\x20csv\x20import:','bluebird','lodash','squel','papaparse','../../../config/environment','../../../config/logger','api','redis','defaults','localhost','socket.io-emitter','register','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20socket_timestamp\x20parameter!','error','index','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','map','data','firstName','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','length','find','create','then','push','pick','catch','Error\x20while\x20creating\x20contact:\x20','message','stringify','cmContact','checkHopper','inspect','insert','into','cm_hopper','fromQuery','scheduledAt','createdAt','select','field','NOW()','ContactId','toString','updatedAt','from','cm_contacts','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)'];(function(_0x3c2a69,_0x4c8b41){var _0x596bc8=function(_0x1b4b7c){while(--_0x1b4b7c){_0x3c2a69['push'](_0x3c2a69['shift']());}};_0x596bc8(++_0x4c8b41);}(_0x8bd5,0xfb));var _0x58bd=function(_0x495ea7,_0x567259){_0x495ea7=_0x495ea7-0x0;var _0x214e55=_0x8bd5[_0x495ea7];return _0x214e55;};'use strict';var BPromise=require(_0x58bd('0x0'));var util=require('util');var _=require(_0x58bd('0x1'));var fs=require('fs');var squel=require(_0x58bd('0x2'));var Papa=require(_0x58bd('0x3'));var Redis=require('ioredis');var db=require('../../../mysqldb')['db'];var config=require(_0x58bd('0x4'));var logger=require(_0x58bd('0x5'))(_0x58bd('0x6'));config[_0x58bd('0x7')]=_[_0x58bd('0x8')](config[_0x58bd('0x7')],{'host':_0x58bd('0x9'),'port':0x18eb});var socket=require(_0x58bd('0xa'))(new Redis(config['redis']));require('../../../api/cmContact/cmContact.socket')[_0x58bd('0xb')](socket);try{if(!process[_0x58bd('0xc')][0x2]||process[_0x58bd('0xc')][0x2]===_0x58bd('0xd')||process[_0x58bd('0xc')][0x2]===_0x58bd('0xe')){throw new Error(_0x58bd('0xf'));}var FILEPATH=process[_0x58bd('0xc')][0x2];if(!process[_0x58bd('0xc')][0x3]||process[_0x58bd('0xc')][0x3]===_0x58bd('0xd')||process['argv'][0x3]===_0x58bd('0xe')||!process['argv'][0x4]||process[_0x58bd('0xc')][0x4]===_0x58bd('0xd')||process['argv'][0x4]===_0x58bd('0xe')){throw new Error(_0x58bd('0x10'));}var FIELDS=_[_0x58bd('0x11')](process[_0x58bd('0xc')][0x3][_0x58bd('0x12')](','),process[_0x58bd('0xc')][0x4]['split'](','));if(!process[_0x58bd('0xc')][0x5]||process[_0x58bd('0xc')][0x5]===_0x58bd('0xd')||process[_0x58bd('0xc')][0x5]===_0x58bd('0xe')){throw new Error('Missing\x20ListId\x20parameter!');}var LISTID=process['argv'][0x5];var COMPANYID=process[_0x58bd('0xc')][0x6]&&process['argv'][0x6]!==_0x58bd('0xd')&&process['argv'][0x6]!=='null'?process[_0x58bd('0xc')][0x6]:null;var DUPLICATES=process['argv'][0x7]&&process['argv'][0x7]!=='undefined'&&process[_0x58bd('0xc')][0x7]!=='null'?process[_0x58bd('0xc')][0x7]:null;if(!process['argv'][0x8]||process[_0x58bd('0xc')][0x8]===_0x58bd('0xd')||process['argv'][0x8]===_0x58bd('0xe')){throw new Error(_0x58bd('0x13'));}var SOCKET_TIMESTAMP=process['argv'][0x8];}catch(_0xfe4025){logger[_0x58bd('0x14')](_0xfe4025);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(_0x1f880d,_0x1a6e0b,_0x42ee5a,_0x5836c1){var _0x482668={'message':_0x1a6e0b};_0x482668[_0x1f880d]=!![];if(_0x42ee5a){_0x482668['contact']=_0x42ee5a;}if(_0x5836c1){_0x482668[_0x58bd('0x15')]=_0x5836c1;}return _0x482668;}function isEmail(_0x1dc0b8){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'](_0x1dc0b8);}function checkRow(_0x5ad7ca,_0x5c3a47,_0x14097c){return new BPromise(function(_0x18119d,_0x427f4a){if(_[_0x58bd('0x16')](_0x5ad7ca)){return _0x427f4a(handleCheckRowError(_0x58bd('0x14'),_0x58bd('0x17'),null,_0x14097c));}if(_0x5ad7ca[_0x58bd('0x18')]&&_0x5ad7ca[_0x58bd('0x18')]['length']){var _0x4c9759=_[_0x58bd('0x19')](_0x5ad7ca[_0x58bd('0x18')],'message')['join'](';');return _0x427f4a(handleCheckRowError(_0x58bd('0x14'),_0x4c9759,null,_0x14097c));}var _0xfa16ba={};for(var _0x1381e1 in FIELDS){if(FIELDS['hasOwnProperty'](_0x1381e1)&&FIELDS[_0x1381e1]){_0xfa16ba[_0x1381e1]=_0x5ad7ca['data'][0x0][FIELDS[_0x1381e1]]||_0x5ad7ca[_0x58bd('0x1a')][0x0]['\ufeff'+FIELDS[_0x1381e1]];}}if(!_0xfa16ba[_0x58bd('0x1b')]){return _0x427f4a(handleCheckRowError(_0x58bd('0x14'),_0x58bd('0x1c'),null,_0x14097c));}if(!_0xfa16ba[_0x58bd('0x1d')]){return _0x427f4a(handleCheckRowError(_0x58bd('0x14'),_0x58bd('0x1e'),null,_0x14097c));}if(_0xfa16ba[_0x58bd('0x1f')]){var _0x2563a3=moment(_0xfa16ba['birthDate'],_0x58bd('0x20'));if(!_0x2563a3[_0x58bd('0x21')]()){return _0x427f4a(handleCheckRowError(_0x58bd('0x14'),_0x58bd('0x22'),null,_0x14097c));}}if(_0xfa16ba['email']){if(!isEmail(_0xfa16ba['email'])){return _0x427f4a(handleCheckRowError(_0x58bd('0x14'),_0x58bd('0x23'),null,_0x14097c));}}_0xfa16ba[_0x58bd('0x24')]=LISTID;_0xfa16ba[_0x58bd('0x25')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES['length']&&_0x5c3a47){var _0xa46e1a={};for(var _0x33c2e7=0x0,_0xae3f14=DUPLICATES[_0x58bd('0x26')];_0x33c2e7<_0xae3f14;_0x33c2e7+=0x1){_0xa46e1a[DUPLICATES[_0x33c2e7]]=_0xfa16ba[DUPLICATES[_0x33c2e7]];}var _0x90099f=_[_0x58bd('0x27')](_0x5c3a47,_0xa46e1a);if(_0x90099f){return _0x427f4a(handleCheckRowError('duplicate','Duplicate\x20Contact',_0x90099f,_0x14097c));}}return db['CmContact'][_0x58bd('0x28')](_0xfa16ba,{'raw':!![],'hooks':![],'fields':_['keys'](_0xfa16ba)})[_0x58bd('0x29')](function(_0x52d17a){if(DUPLICATES&&DUPLICATES[_0x58bd('0x26')]&&_0x5c3a47){_0x5c3a47[_0x58bd('0x2a')](_[_0x58bd('0x2b')](_0xfa16ba,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x52d17a['id'];return _0x18119d();})[_0x58bd('0x2c')](function(_0x3fba2e){return _0x427f4a(handleCheckRowError(_0x58bd('0x14'),_0x58bd('0x2d')+(_0x3fba2e[_0x58bd('0x2e')]||JSON[_0x58bd('0x2f')](_0x3fba2e)),null,_0x14097c));});});}function checkHopper(){function _0x5a0f48(){return function(_0xcf4bf4){logger[_0x58bd('0x14')](_0x58bd('0x30'),_0x58bd('0x31'),util[_0x58bd('0x32')](_0xcf4bf4,{'showHidden':![],'depth':null}));};}var _0x46b2f8=function(_0x8e713e,_0x234525){var _0x1c7fab=squel[_0x58bd('0x33')]()[_0x58bd('0x34')](_0x58bd('0x35'))[_0x58bd('0x36')]([_0x58bd('0x1d'),_0x58bd('0x37'),'ContactId','ListId',_0x234525,_0x58bd('0x38'),'updatedAt'],squel[_0x58bd('0x39')]()['field'](_0x58bd('0x1d'),_0x58bd('0x1d'))[_0x58bd('0x3a')](_0x58bd('0x3b'),_0x58bd('0x37'))[_0x58bd('0x3a')]('id',_0x58bd('0x3c'))[_0x58bd('0x3a')](LISTID[_0x58bd('0x3d')](),_0x58bd('0x24'))['field'](_0x8e713e['id'][_0x58bd('0x3d')](),_0x234525)[_0x58bd('0x3a')](_0x58bd('0x3b'),_0x58bd('0x38'))[_0x58bd('0x3a')](_0x58bd('0x3b'),_0x58bd('0x3e'))[_0x58bd('0x3f')](_0x58bd('0x40'))[_0x58bd('0x41')](_0x58bd('0x42'))[_0x58bd('0x41')](_0x58bd('0x43'),LISTID[_0x58bd('0x3d')]())[_0x58bd('0x41')](_0x58bd('0x44'))[_0x58bd('0x41')](_0x58bd('0x45'),squel[_0x58bd('0x39')]()[_0x58bd('0x3a')](_0x58bd('0x1d'))['from'](_0x58bd('0x35'))['where'](_0x234525+'\x20=\x20?',_0x8e713e['id'][_0x58bd('0x3d')]())))['toString']();return _0x1c7fab;};var _0xb7e060=function(_0x2ec762,_0xed058a){var _0x39b73c=squel[_0x58bd('0x33')]()[_0x58bd('0x34')]('cm_hopper')[_0x58bd('0x36')]([_0x58bd('0x1d'),_0x58bd('0x37'),_0x58bd('0x3c'),_0x58bd('0x24'),_0xed058a,_0x58bd('0x38'),_0x58bd('0x3e')],squel[_0x58bd('0x39')]()[_0x58bd('0x3a')](_0x58bd('0x1d'),_0x58bd('0x1d'))[_0x58bd('0x3a')](_0x58bd('0x3b'),_0x58bd('0x37'))[_0x58bd('0x3a')]('id','ContactId')[_0x58bd('0x3a')](LISTID[_0x58bd('0x3d')](),_0x58bd('0x24'))[_0x58bd('0x3a')](_0x2ec762['id'][_0x58bd('0x3d')](),_0xed058a)[_0x58bd('0x3a')](_0x58bd('0x3b'),_0x58bd('0x38'))[_0x58bd('0x3a')](_0x58bd('0x3b'),_0x58bd('0x3e'))['from'](_0x58bd('0x40'))[_0x58bd('0x41')](_0x58bd('0x42'))['where'](_0x58bd('0x43'),LISTID['toString']())[_0x58bd('0x41')]('id\x20IN\x20?',squel[_0x58bd('0x46')](hopperContacts))[_0x58bd('0x41')](_0x58bd('0x44'))[_0x58bd('0x41')](_0x58bd('0x45'),squel[_0x58bd('0x39')]()['field'](_0x58bd('0x47'))[_0x58bd('0x3f')](_0x58bd('0x48'))[_0x58bd('0x41')](_0xed058a+_0x58bd('0x49'),_0x2ec762['id'][_0x58bd('0x3d')]()))['where'](_0x58bd('0x45'),squel[_0x58bd('0x39')]()[_0x58bd('0x3a')](_0x58bd('0x1d'))[_0x58bd('0x3f')](_0x58bd('0x35'))[_0x58bd('0x41')](_0xed058a+'\x20=\x20?',_0x2ec762['id']['toString']())))[_0x58bd('0x3d')]();return _0x39b73c;};function _0x4a932b(_0x1b1b90,_0x14e585){var _0x1394da=squel['insert']()[_0x58bd('0x34')]('cm_hopper')[_0x58bd('0x36')]([_0x58bd('0x1d'),_0x58bd('0x37'),_0x58bd('0x3c'),_0x58bd('0x24'),_0x14e585,_0x58bd('0x38'),'updatedAt'],squel[_0x58bd('0x39')]()[_0x58bd('0x3a')](_0x58bd('0x1d'),_0x58bd('0x1d'))[_0x58bd('0x3a')](_0x58bd('0x3b'),_0x58bd('0x37'))[_0x58bd('0x3a')]('id',_0x58bd('0x3c'))[_0x58bd('0x3a')](LISTID[_0x58bd('0x3d')](),'ListId')[_0x58bd('0x3a')](_0x1b1b90['id'][_0x58bd('0x3d')](),_0x14e585)[_0x58bd('0x3a')](_0x58bd('0x3b'),_0x58bd('0x38'))[_0x58bd('0x3a')](_0x58bd('0x3b'),_0x58bd('0x3e'))[_0x58bd('0x3f')](_0x58bd('0x40'))[_0x58bd('0x41')](_0x58bd('0x42'))['where'](_0x58bd('0x43'),LISTID['toString']())['where'](_0x58bd('0x4a'),squel[_0x58bd('0x46')](hopperContacts))['where']('phone\x20IS\x20NOT\x20NULL'))['toString']();return _0x1394da;}function _0x5a722c(_0x8568d9,_0x1099c7){var _0x1e3bee=squel[_0x58bd('0x33')]()[_0x58bd('0x34')](_0x58bd('0x4b'))[_0x58bd('0x36')]([_0x58bd('0x1d'),_0x58bd('0x3c'),_0x58bd('0x24'),_0x1099c7,'createdAt',_0x58bd('0x3e')],squel[_0x58bd('0x39')]()[_0x58bd('0x3a')](_0x58bd('0x1d'),_0x58bd('0x1d'))['field']('id',_0x58bd('0x3c'))[_0x58bd('0x3a')](LISTID['toString'](),_0x58bd('0x24'))['field'](_0x8568d9['id'][_0x58bd('0x3d')](),_0x1099c7)[_0x58bd('0x3a')](_0x58bd('0x3b'),_0x58bd('0x38'))[_0x58bd('0x3a')]('NOW()','updatedAt')[_0x58bd('0x3f')](_0x58bd('0x40'))['where'](_0x58bd('0x42'))[_0x58bd('0x41')](_0x58bd('0x43'),LISTID[_0x58bd('0x3d')]())[_0x58bd('0x41')](_0x58bd('0x4a'),squel[_0x58bd('0x46')](hopperContacts))[_0x58bd('0x41')]('phone\x20IS\x20NOT\x20NULL'))['toString']();return _0x1e3bee;}return db[_0x58bd('0x4c')][_0x58bd('0x4d')]({'where':{'type':_0x58bd('0x4e')},'attributes':['id',_0x58bd('0x4f')],'include':[{'model':db[_0x58bd('0x50')],'as':'Lists','where':{'id':LISTID}}]})[_0x58bd('0x29')](function(_0x280312){var _0x5140c9=[];if(_0x280312){var _0x23296e;for(var _0x49906e=0x0,_0x30b452;_0x49906e<_0x280312[_0x58bd('0x26')];_0x49906e+=0x1){_0x30b452=_0x280312[_0x49906e]['get']({'plain':!![]});switch(_0x30b452[_0x58bd('0x4f')]){case _0x58bd('0x51'):_0x5140c9[_0x58bd('0x2a')](db['sequelize']['query'](_0xb7e060(_0x30b452,_0x58bd('0x52')))['then'](function(){})['catch'](_0x5a0f48()));break;case _0x58bd('0x53'):_0x5140c9[_0x58bd('0x2a')](db[_0x58bd('0x54')][_0x58bd('0x55')](_0x46b2f8(_0x30b452,'VoiceQueueId'))[_0x58bd('0x29')](function(){})['catch'](_0x5a0f48()));break;default:_0x5140c9['push'](db[_0x58bd('0x54')]['query'](_0x4a932b(_0x30b452,_0x58bd('0x52')))[_0x58bd('0x29')](function(){})[_0x58bd('0x2c')](_0x5a0f48()));}}}return _0x5140c9;})[_0x58bd('0x56')]()[_0x58bd('0x29')](function(){return db[_0x58bd('0x4c')][_0x58bd('0x4d')]({'where':{'type':'outbound'},'attributes':['id'],'include':[{'model':db[_0x58bd('0x50')],'as':_0x58bd('0x57'),'where':{'id':LISTID}}]})[_0x58bd('0x29')](function(_0x43efff){var _0x1daeeb=[];if(_0x43efff){var _0x316f47;for(var _0x1d7a75=0x0,_0x3c775f;_0x1d7a75<_0x43efff[_0x58bd('0x26')];_0x1d7a75+=0x1){_0x3c775f=_0x43efff[_0x1d7a75][_0x58bd('0x58')]({'plain':!![]});_0x1daeeb[_0x58bd('0x2a')](db[_0x58bd('0x54')][_0x58bd('0x55')](_0x5a722c(_0x3c775f,_0x58bd('0x52')))[_0x58bd('0x29')](function(){})[_0x58bd('0x2c')](_0x5a0f48()));}}return _0x1daeeb;})['all']();})[_0x58bd('0x29')](function(){return db['Campaign'][_0x58bd('0x4d')]({'attributes':['id',_0x58bd('0x4f')],'include':[{'model':db['CmList'],'as':_0x58bd('0x59'),'where':{'id':LISTID}}]})[_0x58bd('0x29')](function(_0x2d4223){var _0x32439d=[];if(_0x2d4223){for(var _0x1e9714=0x0,_0x2893e0;_0x1e9714<_0x2d4223[_0x58bd('0x26')];_0x1e9714+=0x1){_0x2893e0=_0x2d4223[_0x1e9714]['get']({'plain':!![]});switch(_0x2893e0[_0x58bd('0x4f')]){case _0x58bd('0x51'):_0x32439d[_0x58bd('0x2a')](db[_0x58bd('0x54')]['query'](_0xb7e060(_0x2893e0,'CampaignId'))['then'](function(){})['catch'](_0x5a0f48()));break;case _0x58bd('0x53'):_0x32439d[_0x58bd('0x2a')](db[_0x58bd('0x54')]['query'](_0x46b2f8(_0x2893e0,_0x58bd('0x5a')))[_0x58bd('0x29')](function(){})[_0x58bd('0x2c')](_0x5a0f48()));break;default:_0x32439d[_0x58bd('0x2a')](db[_0x58bd('0x54')]['query'](_0x4a932b(_0x2893e0,'CampaignId'))[_0x58bd('0x29')](function(){})['catch'](_0x5a0f48()));}}}return _0x32439d;})[_0x58bd('0x56')]();})['then'](function(){return db[_0x58bd('0x5b')][_0x58bd('0x4d')]({'attributes':['id'],'include':[{'model':db[_0x58bd('0x50')],'as':_0x58bd('0x57'),'where':{'id':LISTID}}]})[_0x58bd('0x29')](function(_0x420e11){var _0x576501=[];if(_0x420e11){for(var _0x2c3131=0x0,_0x2ad07d;_0x2c3131<_0x420e11[_0x58bd('0x26')];_0x2c3131+=0x1){_0x2ad07d=_0x420e11[_0x2c3131][_0x58bd('0x58')]({'plain':!![]});_0x576501[_0x58bd('0x2a')](db[_0x58bd('0x54')]['query'](_0x5a722c(_0x2ad07d,_0x58bd('0x5a')))[_0x58bd('0x29')](function(){})[_0x58bd('0x2c')](_0x5a0f48()));}}return _0x576501;})['all']();})['catch'](function(_0x57a076){logger[_0x58bd('0x14')]('cmContact,\x20%s,\x20%s',_0x58bd('0x5c'),_0x57a076[_0x58bd('0x2e')]);});}var processPromises=function(_0x4abad2){return BPromise[_0x58bd('0x56')](promises)[_0x58bd('0x29')](function(_0xd6fa22){})[_0x58bd('0x2c')](function(_0x4a45ae){logger[_0x58bd('0x14')](_0x58bd('0x5d'),JSON['stringify'](_0x4a45ae));})['finally'](function(){socket[_0x58bd('0x5e')](_0x58bd('0x5f')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x4abad2){return _0x4abad2['resume']();}});};var endCsv=function(){return BPromise[_0x58bd('0x60')]()['then'](function(){if(hopperContacts){return checkHopper();}})[_0x58bd('0x29')](function(){socket[_0x58bd('0x5e')]('contact:csv_'+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x58bd('0x61')](FILEPATH);}catch(_0x577955){logger['error'](_0x58bd('0x62'),JSON[_0x58bd('0x2f')](_0x577955));}finally{process[_0x58bd('0x63')](0x0);}});};process['on'](_0x58bd('0x64'),function(){logger['info']('CSV\x20import\x20process\x20stopped!');endCsv();});function main(){return BPromise['resolve']()[_0x58bd('0x29')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x58bd('0x12')](',');return db[_0x58bd('0x65')][_0x58bd('0x4d')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x58bd('0x29')](function(_0x529c0a){var _0x186b72=fs['createReadStream'](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x58bd('0x66')](_0x186b72,{'header':!![],'skipEmptyLines':!![],'step':function(_0x87977c,_0x4c720a){total+=0x1;var _0x5dbf76=total;promises['push'](checkRow(_0x87977c,_0x529c0a,_0x5dbf76)[_0x58bd('0x29')](function(){success+=0x1;})[_0x58bd('0x2c')](function(_0x35723b){if(_0x35723b['error']){errors+=0x1;delete _0x35723b[_0x58bd('0x14')];}else if(_0x35723b[_0x58bd('0x67')]){duplicates+=0x1;delete _0x35723b[_0x58bd('0x67')];}rows[_0x58bd('0x2a')](_0x35723b);}));if(total%0xc8===0x0){_0x4c720a[_0x58bd('0x68')]();return processPromises(_0x4c720a);}},'complete':function(){return processPromises()[_0x58bd('0x29')](function(){logger[_0x58bd('0x69')]('CSV\x20parsed\x20correctly!');endCsv();});},'error':function(_0x127f9e,_0x170ebb){logger[_0x58bd('0x69')]('CSV\x20parse\x20error',JSON[_0x58bd('0x2f')](_0x127f9e));endCsv();}});})[_0x58bd('0x2c')](function(_0x48661b){logger[_0x58bd('0x14')](_0x58bd('0x6a'),JSON[_0x58bd('0x2f')](_0x48661b));});}main(); \ No newline at end of file +var _0x1f04=['insert','into','cm_hopper','fromQuery','scheduledAt','ContactId','createdAt','updatedAt','select','field','toString','NOW()','from','cm_contacts','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','id\x20IN\x20?','str','cm_hopper_final','cm_hopper_black','phone\x20IS\x20NOT\x20NULL','VoiceQueue','findAll','outbound','dialCheckDuplicateType','Lists','get','always','sequelize','query','VoiceQueueId','then','onlyIfOpen','CmList','all','Campaign','CampaignId','BlackLists','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','resolve','contact:csv_','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','CSV\x20import\x20process\x20stopped!','createReadStream','pause','info','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','squel','ioredis','../../../config/environment','../../../config/logger','api','redis','defaults','localhost','socket.io-emitter','register','null','Missing\x20filepath\x20parameter!','argv','undefined','Missing\x20binding\x20parameters!','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','error','contact','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','map','message','hasOwnProperty','data','firstName','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','ListId','find','duplicate','Duplicate\x20Contact','CmContact','create','keys','push','pick','catch','Error\x20while\x20creating\x20contact:\x20','stringify','cmContact','checkHopper'];(function(_0x43f07f,_0x5a37cc){var _0xadcae1=function(_0x50f415){while(--_0x50f415){_0x43f07f['push'](_0x43f07f['shift']());}};_0xadcae1(++_0x5a37cc);}(_0x1f04,0x10f));var _0x41f0=function(_0x4a4737,_0x32214c){_0x4a4737=_0x4a4737-0x0;var _0x2d2ede=_0x1f04[_0x4a4737];return _0x2d2ede;};'use strict';var BPromise=require(_0x41f0('0x0'));var util=require('util');var _=require('lodash');var fs=require('fs');var squel=require(_0x41f0('0x1'));var Papa=require('papaparse');var Redis=require(_0x41f0('0x2'));var db=require('../../../mysqldb')['db'];var config=require(_0x41f0('0x3'));var logger=require(_0x41f0('0x4'))(_0x41f0('0x5'));config[_0x41f0('0x6')]=_[_0x41f0('0x7')](config[_0x41f0('0x6')],{'host':_0x41f0('0x8'),'port':0x18eb});var socket=require(_0x41f0('0x9'))(new Redis(config[_0x41f0('0x6')]));require('../../../api/cmContact/cmContact.socket')[_0x41f0('0xa')](socket);try{if(!process['argv'][0x2]||process['argv'][0x2]==='undefined'||process['argv'][0x2]===_0x41f0('0xb')){throw new Error(_0x41f0('0xc'));}var FILEPATH=process[_0x41f0('0xd')][0x2];if(!process[_0x41f0('0xd')][0x3]||process[_0x41f0('0xd')][0x3]===_0x41f0('0xe')||process[_0x41f0('0xd')][0x3]===_0x41f0('0xb')||!process['argv'][0x4]||process['argv'][0x4]==='undefined'||process[_0x41f0('0xd')][0x4]===_0x41f0('0xb')){throw new Error(_0x41f0('0xf'));}var FIELDS=_['zipObject'](process[_0x41f0('0xd')][0x3][_0x41f0('0x10')](','),process['argv'][0x4]['split'](','));if(!process['argv'][0x5]||process['argv'][0x5]===_0x41f0('0xe')||process['argv'][0x5]==='null'){throw new Error(_0x41f0('0x11'));}var LISTID=process[_0x41f0('0xd')][0x5];var COMPANYID=process[_0x41f0('0xd')][0x6]&&process[_0x41f0('0xd')][0x6]!==_0x41f0('0xe')&&process['argv'][0x6]!==_0x41f0('0xb')?process[_0x41f0('0xd')][0x6]:null;var DUPLICATES=process[_0x41f0('0xd')][0x7]&&process['argv'][0x7]!=='undefined'&&process['argv'][0x7]!==_0x41f0('0xb')?process[_0x41f0('0xd')][0x7]:null;if(!process['argv'][0x8]||process['argv'][0x8]===_0x41f0('0xe')||process['argv'][0x8]===_0x41f0('0xb')){throw new Error(_0x41f0('0x12'));}var SOCKET_TIMESTAMP=process[_0x41f0('0xd')][0x8];}catch(_0x3c5fc2){logger[_0x41f0('0x13')](_0x3c5fc2);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(_0x265ad1,_0x32d4d9,_0x2e4a28,_0x32bc89){var _0x5c5b99={'message':_0x32d4d9};_0x5c5b99[_0x265ad1]=!![];if(_0x2e4a28){_0x5c5b99[_0x41f0('0x14')]=_0x2e4a28;}if(_0x32bc89){_0x5c5b99['index']=_0x32bc89;}return _0x5c5b99;}function isEmail(_0x1c486e){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'](_0x1c486e);}function checkRow(_0x277ee7,_0x19cd96,_0xf26ec){return new BPromise(function(_0x4b48bf,_0xb0279b){if(_[_0x41f0('0x15')](_0x277ee7)){return _0xb0279b(handleCheckRowError(_0x41f0('0x13'),_0x41f0('0x16'),null,_0xf26ec));}if(_0x277ee7['errors']&&_0x277ee7[_0x41f0('0x17')][_0x41f0('0x18')]){var _0xc7f950=_[_0x41f0('0x19')](_0x277ee7[_0x41f0('0x17')],_0x41f0('0x1a'))['join'](';');return _0xb0279b(handleCheckRowError(_0x41f0('0x13'),_0xc7f950,null,_0xf26ec));}var _0x3997bb={};for(var _0x4eba4e in FIELDS){if(FIELDS[_0x41f0('0x1b')](_0x4eba4e)&&FIELDS[_0x4eba4e]){_0x3997bb[_0x4eba4e]=_0x277ee7['data'][0x0][FIELDS[_0x4eba4e]]||_0x277ee7[_0x41f0('0x1c')][0x0]['\ufeff'+FIELDS[_0x4eba4e]];}}if(!_0x3997bb[_0x41f0('0x1d')]){return _0xb0279b(handleCheckRowError(_0x41f0('0x13'),'firstName\x20not\x20specified!',null,_0xf26ec));}if(!_0x3997bb[_0x41f0('0x1e')]){return _0xb0279b(handleCheckRowError('error',_0x41f0('0x1f'),null,_0xf26ec));}if(_0x3997bb['birthDate']){var _0x40be9d=moment(_0x3997bb[_0x41f0('0x20')],_0x41f0('0x21'));if(!_0x40be9d['isValid']()){return _0xb0279b(handleCheckRowError(_0x41f0('0x13'),_0x41f0('0x22'),null,_0xf26ec));}}if(_0x3997bb[_0x41f0('0x23')]){if(!isEmail(_0x3997bb[_0x41f0('0x23')])){return _0xb0279b(handleCheckRowError(_0x41f0('0x13'),'email\x20format\x20is\x20not\x20valid!',null,_0xf26ec));}}_0x3997bb[_0x41f0('0x24')]=LISTID;_0x3997bb['CompanyId']=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x41f0('0x18')]&&_0x19cd96){var _0x12925c={};for(var _0x1ca88f=0x0,_0x29409d=DUPLICATES['length'];_0x1ca88f<_0x29409d;_0x1ca88f+=0x1){_0x12925c[DUPLICATES[_0x1ca88f]]=_0x3997bb[DUPLICATES[_0x1ca88f]];}var _0x4020c7=_[_0x41f0('0x25')](_0x19cd96,_0x12925c);if(_0x4020c7){return _0xb0279b(handleCheckRowError(_0x41f0('0x26'),_0x41f0('0x27'),_0x4020c7,_0xf26ec));}}return db[_0x41f0('0x28')][_0x41f0('0x29')](_0x3997bb,{'raw':!![],'hooks':![],'fields':_[_0x41f0('0x2a')](_0x3997bb)})['then'](function(_0x23c595){if(DUPLICATES&&DUPLICATES[_0x41f0('0x18')]&&_0x19cd96){_0x19cd96[_0x41f0('0x2b')](_[_0x41f0('0x2c')](_0x3997bb,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x23c595['id'];return _0x4b48bf();})[_0x41f0('0x2d')](function(_0x4b0e84){return _0xb0279b(handleCheckRowError(_0x41f0('0x13'),_0x41f0('0x2e')+(_0x4b0e84['message']||JSON[_0x41f0('0x2f')](_0x4b0e84)),null,_0xf26ec));});});}function checkHopper(){function _0x2e47cd(){return function(_0x1435e0){logger[_0x41f0('0x13')](_0x41f0('0x30'),_0x41f0('0x31'),util['inspect'](_0x1435e0,{'showHidden':![],'depth':null}));};}var _0x425315=function(_0x287517,_0x3a2c64){var _0x307824=squel[_0x41f0('0x32')]()[_0x41f0('0x33')](_0x41f0('0x34'))[_0x41f0('0x35')]([_0x41f0('0x1e'),_0x41f0('0x36'),_0x41f0('0x37'),'ListId',_0x3a2c64,_0x41f0('0x38'),_0x41f0('0x39')],squel[_0x41f0('0x3a')]()[_0x41f0('0x3b')](_0x41f0('0x1e'),'phone')['field']('NOW()','scheduledAt')[_0x41f0('0x3b')]('id',_0x41f0('0x37'))[_0x41f0('0x3b')](LISTID[_0x41f0('0x3c')](),_0x41f0('0x24'))[_0x41f0('0x3b')](_0x287517['id'][_0x41f0('0x3c')](),_0x3a2c64)[_0x41f0('0x3b')](_0x41f0('0x3d'),_0x41f0('0x38'))['field'](_0x41f0('0x3d'),_0x41f0('0x39'))[_0x41f0('0x3e')](_0x41f0('0x3f'))[_0x41f0('0x40')](_0x41f0('0x41'))['where'](_0x41f0('0x42'),LISTID[_0x41f0('0x3c')]())[_0x41f0('0x40')]('phone\x20IS\x20NOT\x20NULL')[_0x41f0('0x40')](_0x41f0('0x43'),squel[_0x41f0('0x3a')]()['field'](_0x41f0('0x1e'))['from']('cm_hopper')[_0x41f0('0x40')](_0x3a2c64+_0x41f0('0x44'),_0x287517['id'][_0x41f0('0x3c')]())))[_0x41f0('0x3c')]();return _0x307824;};var _0x2c155c=function(_0x1b1987,_0x116adb){var _0x2597ed=squel[_0x41f0('0x32')]()[_0x41f0('0x33')](_0x41f0('0x34'))[_0x41f0('0x35')]([_0x41f0('0x1e'),_0x41f0('0x36'),_0x41f0('0x37'),'ListId',_0x116adb,_0x41f0('0x38'),_0x41f0('0x39')],squel[_0x41f0('0x3a')]()['field'](_0x41f0('0x1e'),'phone')[_0x41f0('0x3b')]('NOW()',_0x41f0('0x36'))['field']('id','ContactId')[_0x41f0('0x3b')](LISTID[_0x41f0('0x3c')](),_0x41f0('0x24'))[_0x41f0('0x3b')](_0x1b1987['id']['toString'](),_0x116adb)[_0x41f0('0x3b')](_0x41f0('0x3d'),_0x41f0('0x38'))['field'](_0x41f0('0x3d'),_0x41f0('0x39'))['from'](_0x41f0('0x3f'))[_0x41f0('0x40')](_0x41f0('0x41'))[_0x41f0('0x40')](_0x41f0('0x42'),LISTID[_0x41f0('0x3c')]())[_0x41f0('0x40')](_0x41f0('0x45'),squel[_0x41f0('0x46')](hopperContacts))[_0x41f0('0x40')]('phone\x20IS\x20NOT\x20NULL')[_0x41f0('0x40')](_0x41f0('0x43'),squel[_0x41f0('0x3a')]()['field']('calleridnum')[_0x41f0('0x3e')](_0x41f0('0x47'))[_0x41f0('0x40')](_0x116adb+_0x41f0('0x44'),_0x1b1987['id'][_0x41f0('0x3c')]()))['where'](_0x41f0('0x43'),squel[_0x41f0('0x3a')]()[_0x41f0('0x3b')]('phone')[_0x41f0('0x3e')](_0x41f0('0x34'))[_0x41f0('0x40')](_0x116adb+_0x41f0('0x44'),_0x1b1987['id'][_0x41f0('0x3c')]())))['toString']();return _0x2597ed;};function _0x11e677(_0xa731bf,_0x5b92da){var _0x145303=squel[_0x41f0('0x32')]()[_0x41f0('0x33')]('cm_hopper')['fromQuery']([_0x41f0('0x1e'),'scheduledAt',_0x41f0('0x37'),_0x41f0('0x24'),_0x5b92da,'createdAt',_0x41f0('0x39')],squel[_0x41f0('0x3a')]()[_0x41f0('0x3b')](_0x41f0('0x1e'),_0x41f0('0x1e'))[_0x41f0('0x3b')](_0x41f0('0x3d'),_0x41f0('0x36'))['field']('id',_0x41f0('0x37'))[_0x41f0('0x3b')](LISTID['toString'](),_0x41f0('0x24'))[_0x41f0('0x3b')](_0xa731bf['id'][_0x41f0('0x3c')](),_0x5b92da)[_0x41f0('0x3b')](_0x41f0('0x3d'),_0x41f0('0x38'))[_0x41f0('0x3b')](_0x41f0('0x3d'),_0x41f0('0x39'))['from'](_0x41f0('0x3f'))['where']('deletedAt\x20IS\x20NULL')['where'](_0x41f0('0x42'),LISTID['toString']())[_0x41f0('0x40')](_0x41f0('0x45'),squel['str'](hopperContacts))[_0x41f0('0x40')]('phone\x20IS\x20NOT\x20NULL'))[_0x41f0('0x3c')]();return _0x145303;}function _0x527179(_0x3531f6,_0x136de6){var _0x563dc1=squel[_0x41f0('0x32')]()[_0x41f0('0x33')](_0x41f0('0x48'))[_0x41f0('0x35')](['phone',_0x41f0('0x37'),_0x41f0('0x24'),_0x136de6,_0x41f0('0x38'),'updatedAt'],squel[_0x41f0('0x3a')]()[_0x41f0('0x3b')](_0x41f0('0x1e'),'phone')[_0x41f0('0x3b')]('id',_0x41f0('0x37'))[_0x41f0('0x3b')](LISTID['toString'](),_0x41f0('0x24'))[_0x41f0('0x3b')](_0x3531f6['id'][_0x41f0('0x3c')](),_0x136de6)[_0x41f0('0x3b')](_0x41f0('0x3d'),_0x41f0('0x38'))[_0x41f0('0x3b')](_0x41f0('0x3d'),_0x41f0('0x39'))[_0x41f0('0x3e')](_0x41f0('0x3f'))[_0x41f0('0x40')](_0x41f0('0x41'))[_0x41f0('0x40')](_0x41f0('0x42'),LISTID[_0x41f0('0x3c')]())['where']('id\x20IN\x20?',squel[_0x41f0('0x46')](hopperContacts))[_0x41f0('0x40')](_0x41f0('0x49')))['toString']();return _0x563dc1;}return db[_0x41f0('0x4a')][_0x41f0('0x4b')]({'where':{'type':_0x41f0('0x4c')},'attributes':['id',_0x41f0('0x4d')],'include':[{'model':db['CmList'],'as':_0x41f0('0x4e'),'where':{'id':LISTID}}]})['then'](function(_0x1ef438){var _0x53cd2f=[];if(_0x1ef438){var _0x1def56;for(var _0x2df4c=0x0,_0x1c55da;_0x2df4c<_0x1ef438[_0x41f0('0x18')];_0x2df4c+=0x1){_0x1c55da=_0x1ef438[_0x2df4c][_0x41f0('0x4f')]({'plain':!![]});switch(_0x1c55da[_0x41f0('0x4d')]){case _0x41f0('0x50'):_0x53cd2f['push'](db[_0x41f0('0x51')][_0x41f0('0x52')](_0x2c155c(_0x1c55da,_0x41f0('0x53')))[_0x41f0('0x54')](function(){})[_0x41f0('0x2d')](_0x2e47cd()));break;case _0x41f0('0x55'):_0x53cd2f[_0x41f0('0x2b')](db[_0x41f0('0x51')][_0x41f0('0x52')](_0x425315(_0x1c55da,_0x41f0('0x53')))[_0x41f0('0x54')](function(){})[_0x41f0('0x2d')](_0x2e47cd()));break;default:_0x53cd2f[_0x41f0('0x2b')](db[_0x41f0('0x51')]['query'](_0x11e677(_0x1c55da,_0x41f0('0x53')))['then'](function(){})['catch'](_0x2e47cd()));}}}return _0x53cd2f;})['all']()[_0x41f0('0x54')](function(){return db[_0x41f0('0x4a')]['findAll']({'where':{'type':_0x41f0('0x4c')},'attributes':['id'],'include':[{'model':db[_0x41f0('0x56')],'as':'BlackLists','where':{'id':LISTID}}]})['then'](function(_0x2f2014){var _0x268baa=[];if(_0x2f2014){var _0x18d170;for(var _0x26d15d=0x0,_0x4f2769;_0x26d15d<_0x2f2014[_0x41f0('0x18')];_0x26d15d+=0x1){_0x4f2769=_0x2f2014[_0x26d15d]['get']({'plain':!![]});_0x268baa[_0x41f0('0x2b')](db[_0x41f0('0x51')][_0x41f0('0x52')](_0x527179(_0x4f2769,_0x41f0('0x53')))[_0x41f0('0x54')](function(){})['catch'](_0x2e47cd()));}}return _0x268baa;})[_0x41f0('0x57')]();})[_0x41f0('0x54')](function(){return db[_0x41f0('0x58')]['findAll']({'attributes':['id',_0x41f0('0x4d')],'include':[{'model':db[_0x41f0('0x56')],'as':_0x41f0('0x4e'),'where':{'id':LISTID}}]})[_0x41f0('0x54')](function(_0x3f7b38){var _0xca8a75=[];if(_0x3f7b38){for(var _0x45a27e=0x0,_0x3c23d4;_0x45a27e<_0x3f7b38['length'];_0x45a27e+=0x1){_0x3c23d4=_0x3f7b38[_0x45a27e][_0x41f0('0x4f')]({'plain':!![]});switch(_0x3c23d4[_0x41f0('0x4d')]){case _0x41f0('0x50'):_0xca8a75[_0x41f0('0x2b')](db[_0x41f0('0x51')][_0x41f0('0x52')](_0x2c155c(_0x3c23d4,_0x41f0('0x59')))[_0x41f0('0x54')](function(){})['catch'](_0x2e47cd()));break;case _0x41f0('0x55'):_0xca8a75[_0x41f0('0x2b')](db[_0x41f0('0x51')]['query'](_0x425315(_0x3c23d4,_0x41f0('0x59')))[_0x41f0('0x54')](function(){})[_0x41f0('0x2d')](_0x2e47cd()));break;default:_0xca8a75[_0x41f0('0x2b')](db[_0x41f0('0x51')][_0x41f0('0x52')](_0x11e677(_0x3c23d4,_0x41f0('0x59')))[_0x41f0('0x54')](function(){})[_0x41f0('0x2d')](_0x2e47cd()));}}}return _0xca8a75;})[_0x41f0('0x57')]();})['then'](function(){return db[_0x41f0('0x58')]['findAll']({'attributes':['id'],'include':[{'model':db['CmList'],'as':_0x41f0('0x5a'),'where':{'id':LISTID}}]})[_0x41f0('0x54')](function(_0xcf8d94){var _0x5255c2=[];if(_0xcf8d94){for(var _0xb8a6fc=0x0,_0x5e4964;_0xb8a6fc<_0xcf8d94['length'];_0xb8a6fc+=0x1){_0x5e4964=_0xcf8d94[_0xb8a6fc]['get']({'plain':!![]});_0x5255c2['push'](db['sequelize'][_0x41f0('0x52')](_0x527179(_0x5e4964,_0x41f0('0x59')))[_0x41f0('0x54')](function(){})[_0x41f0('0x2d')](_0x2e47cd()));}}return _0x5255c2;})[_0x41f0('0x57')]();})[_0x41f0('0x2d')](function(_0x5832e7){logger[_0x41f0('0x13')](_0x41f0('0x5b'),_0x41f0('0x5c'),_0x5832e7[_0x41f0('0x1a')]);});}var processPromises=function(_0x9ee342){return BPromise['all'](promises)['then'](function(_0x1ee4f0){})[_0x41f0('0x2d')](function(_0xbccc37){logger[_0x41f0('0x13')](_0x41f0('0x5d'),JSON[_0x41f0('0x2f')](_0xbccc37));})['finally'](function(){socket['emit']('contact:csv_'+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x9ee342){return _0x9ee342['resume']();}});};var endCsv=function(){return BPromise[_0x41f0('0x5e')]()[_0x41f0('0x54')](function(){if(hopperContacts){return checkHopper();}})['then'](function(){socket['emit'](_0x41f0('0x5f')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x41f0('0x60')](FILEPATH);}catch(_0x12694d){logger[_0x41f0('0x13')](_0x41f0('0x61'),JSON[_0x41f0('0x2f')](_0x12694d));}finally{process[_0x41f0('0x62')](0x0);}});};process['on'](_0x41f0('0x63'),function(){logger['info'](_0x41f0('0x64'));endCsv();});function main(){return BPromise[_0x41f0('0x5e')]()[_0x41f0('0x54')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x41f0('0x10')](',');return db['CmContact'][_0x41f0('0x4b')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x41f0('0x54')](function(_0x4d6c3c){var _0x57265e=fs[_0x41f0('0x65')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa['parse'](_0x57265e,{'header':!![],'skipEmptyLines':!![],'step':function(_0x394cf3,_0x5f34d5){total+=0x1;var _0x1198cd=total;promises[_0x41f0('0x2b')](checkRow(_0x394cf3,_0x4d6c3c,_0x1198cd)['then'](function(){success+=0x1;})[_0x41f0('0x2d')](function(_0x4ed076){if(_0x4ed076[_0x41f0('0x13')]){errors+=0x1;delete _0x4ed076[_0x41f0('0x13')];}else if(_0x4ed076[_0x41f0('0x26')]){duplicates+=0x1;delete _0x4ed076[_0x41f0('0x26')];}rows[_0x41f0('0x2b')](_0x4ed076);}));if(total%0xc8===0x0){_0x5f34d5[_0x41f0('0x66')]();return processPromises(_0x5f34d5);}},'complete':function(){return processPromises()['then'](function(){logger[_0x41f0('0x67')](_0x41f0('0x68'));endCsv();});},'error':function(_0x5b9bd0,_0x26e349){logger[_0x41f0('0x67')](_0x41f0('0x69'),JSON[_0x41f0('0x2f')](_0x5b9bd0));endCsv();}});})[_0x41f0('0x2d')](function(_0x140038){logger[_0x41f0('0x13')](_0x41f0('0x6a'),JSON['stringify'](_0x140038));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index 56be88e..d373c56 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 _0xb467=['cm_contacts','field','ListId\x20=\x20?','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt','cm_hopper_additional_phones','CmHopperId','OrderBy','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','cm_hopper.ListId\x20=\x20?','concat','CompanyId','scheduledAt',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','min_id','group','info','Received\x20SIGINT','error','message','exit','errors','code','query','spread','catch','campaigns.id','campaigns.dialTimezone','campaigns_has_cm_lists','sequelize','voice_queues.id','voice_queues.dialTimezone','voice_queues_has_cm_lists','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','voice_queues_has_cm_lists.CmListId=','all','timezones','dialTimezone','isNil','utcOffset','set','main','stringify','send','start','clone','root','server/files/tmp','.csv','keys','header','ContactItemType','findAll','name','_description','parse','createReadStream','data','rows','find','hasOwnProperty','trim','isValid','isNaN','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','replace','itemTypeId','SystemRow','appendFileSync','contact:import:','Abort\x20parser','abort','SystemError','duplicates','cm_contacts_','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','campaigns_','voice_queues_','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','each','dialTimezone,utcOffset','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27','DROP\x20TABLE\x20','contactId','orderBy','voice_queues','voice_queues_has_cm_blacklists','VoiceQueueId','CampaignId','campaigns_has_cm_blacklists','campaigns','finish','affectedRows','emit','unlink','complete','argv','file\x20doesn\x27t\x20exists','binding','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','uncaughtException','path','papaparse','util','bluebird','moment','squel','ioredis','../../../mysqldb','import','redis','defaults','format','YYYY-MM-DD\x20HH:mm:ss','test','phone','from','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','CmContact','AdditionalPhones','then','length','push','split','filter','CmContactHasItem','updated','create','PHONE','inserted','cm_contacts.phone','cm_contacts.id','cm_contacts.ListId','cm_contacts.updatedAt','cm_contacts.priority','into','cm_hopper','fromQuery','scheduledat','ContactId','ListId','createdAt','priority','UserId','recallme','fields','.CmListId','join','.id\x20=\x20','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_contacts.createdAt','insert','cm_contacts.ListId\x20=\x20','cm_hopper_black','date_add(cm_contacts.scheduledat,interval\x20','.offset-cm_contacts.utcOffset\x20minute)','cm_contacts.UserId','updatedAt','select'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xb467,0x77));var _0x7b46=function(_0x102977,_0x3a99a6){_0x102977=_0x102977-0x0;var _0x15c466=_0xb467[_0x102977];return _0x15c466;};'use strict';var fs=require('fs');var path=require(_0x7b46('0x0'));var _=require('lodash');var Papa=require(_0x7b46('0x1'));var util=require(_0x7b46('0x2'));var BPromise=require(_0x7b46('0x3'));var moment=require(_0x7b46('0x4'));var squel=require(_0x7b46('0x5'));var Redis=require(_0x7b46('0x6'));var db=require(_0x7b46('0x7'))['db'];var config=require('../../../config/environment');var shared=require('../../../config/environment/shared');var logger=require('../../../config/logger')(_0x7b46('0x8'));config[_0x7b46('0x9')]=_[_0x7b46('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7b46('0x9')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0x7b46('0xb')]('YYYY-MM-DD\x20HH:mm:ss');var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0x7b46('0xb')](_0x7b46('0xc'));function isEmail(_0x370335){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))*$/[_0x7b46('0xd')](_0x370335);}function selectNotIn(_0x27b00e,_0x39749a,_0x4921fb,_0x159fc6,_0x740444){return squel['select']()['field'](_0x7b46('0xe'))[_0x7b46('0xf')](_0x159fc6)['join'](_0x39749a,null,_0x39749a+'.id\x20=\x20'+_0x159fc6+'.'+_0x4921fb)[_0x7b46('0x10')](_0x159fc6+'.'+_0x4921fb+_0x7b46('0x11')+_0x27b00e+'.'+_0x4921fb)[_0x7b46('0x10')](_0x39749a+_0x7b46('0x12')+_0x740444['join']()+')');}function handleAdditionalPhones(){return new Promise(function(_0x5e321e,_0x2a14af){promisesAdditionalPhones=[];return db[_0x7b46('0x13')]['findAll']({'raw':!![],'attributes':['id',_0x7b46('0x14')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0x7b46('0x15')](function(_0x26f2f3){if(_0x26f2f3!==null){var _0x3e0bba=[];for(var _0x59cbac=0x0;_0x59cbac<_0x26f2f3[_0x7b46('0x16')];_0x59cbac++){var _0x5dd947=_0x26f2f3[_0x59cbac];_0x3e0bba[_0x7b46('0x17')](insertAdditionalPhones(_0x5dd947));}}Promise['all'](_0x3e0bba)[_0x7b46('0x15')](function(){_0x5e321e({'val':0x1});});});});}function insertAdditionalPhones(_0x23584c){return new Promise(function(_0x13fd0c,_0x5153db){var _0x21f632=_0x23584c[_0x7b46('0x14')];var _0x3be7db=_0x21f632['split'](';');var _0x82736f=[];orderBy=0x0;for(var _0xc0f17d=0x0;_0xc0f17d<_0x3be7db[_0x7b46('0x16')];_0xc0f17d++){_0x82736f[_0x7b46('0x17')](splitAdditionalPhone(_0x23584c['id'],_0x3be7db[_0xc0f17d]));}Promise['all'](_0x82736f)[_0x7b46('0x15')](function(){_0x13fd0c({'val':_0x3be7db[_0x7b46('0x16')]});});});}function splitAdditionalPhone(_0x496232,_0x501629){return new Promise(function(_0x17a4f8,_0x55d360){var _0x2c2d11=_0x501629['split'](':');var _0x21bf52=_0x2c2d11[0x0];var _0x5a7c07=_0x2c2d11[0x1];if(!_['isNil'](_0x5a7c07)){var _0x1b45ab=_0x5a7c07[_0x7b46('0x18')]('|');var _0xbd6eb2=[];for(var _0xd64de3=0x0;_0xd64de3<_0x1b45ab[_0x7b46('0x16')];_0xd64de3++){if(_0x1b45ab[_0xd64de3]!==''){var _0x1dbbcc=_[_0x7b46('0x19')](promisesAdditionalPhones,{'contactId':_0x496232,'phone':_0x1b45ab[_0xd64de3]});if(_0x1dbbcc[_0x7b46('0x16')]==0x0){orderBy++;promisesAdditionalPhones[_0x7b46('0x17')]({'contactId':_0x496232,'contactTypeId':_0x21bf52,'phone':_0x1b45ab[_0xd64de3],'orderBy':orderBy});}}}_0x17a4f8({'ok':0x1});}else _0x17a4f8({'res':0x0});});}function createAdditionalPhone(_0x3f824b,_0x8bfb70,_0x195a7d,_0x269b8a){var _0x4f9d5c='';var _0xd96735='';var _0x20597f=_0x195a7d['split']('§');_0x4f9d5c=_0x20597f[0x0];if(_0x20597f[_0x7b46('0x16')]==0x2)_0xd96735=_0x20597f[0x1];return new Promise(function(_0x5eeb6b,_0x26ccec){return db[_0x7b46('0x1a')]['findOne']({'where':{'CmContactId':_0x3f824b,'item':_0x4f9d5c}})[_0x7b46('0x15')](function(_0x379f72){if(_0x379f72){return db[_0x7b46('0x1a')]['update']({'ItemTypeId':_0x8bfb70,'description':_0xd96735,'OrderBy':_0x269b8a},{'where':{'CmContactId':_0x3f824b,'item':_0x4f9d5c}})[_0x7b46('0x15')](function(_0x29b80f){_0x5eeb6b({'res':_0x7b46('0x1b')});});}else{return db['CmContactHasItem'][_0x7b46('0x1c')]({'CmContactId':_0x3f824b,'item':_0x4f9d5c,'description':_0xd96735,'ItemTypeId':_0x8bfb70,'OrderBy':_0x269b8a,'ItemClass':_0x7b46('0x1d')})[_0x7b46('0x15')](function(_0xb99d9f){_0x5eeb6b({'res':_0x7b46('0x1e')});});}});});}function insertCmHopper(_0x46a9de,_0x113750,_0x13605b,_0x106fc2,_0x7df54){var _0x177bfb=[_0x7b46('0x1f'),'cm_contacts.scheduledat',_0x7b46('0x20'),_0x7b46('0x21'),_0x113750+'.'+_0x106fc2,'cm_contacts.createdAt',_0x7b46('0x22'),_0x7b46('0x23'),'cm_contacts.UserId','\x22'+_0x7df54+'\x22'];return squel['insert']()[_0x7b46('0x24')](_0x7b46('0x25'))[_0x7b46('0x26')]([_0x7b46('0xe'),_0x7b46('0x27'),_0x7b46('0x28'),_0x7b46('0x29'),_0x106fc2,_0x7b46('0x2a'),'updatedAt',_0x7b46('0x2b'),_0x7b46('0x2c'),_0x7b46('0x2d')],squel['select']()[_0x7b46('0x2e')](_0x177bfb)[_0x7b46('0xf')](_0x113750)['join']('cm_contacts',null,'cm_contacts.ListId\x20=\x20'+_0x113750+_0x7b46('0x2f'))[_0x7b46('0x30')](_0x13605b,null,_0x13605b+_0x7b46('0x31')+_0x113750+'.'+_0x106fc2)[_0x7b46('0x10')](_0x113750+_0x7b46('0x32'),_0x46a9de)[_0x7b46('0x10')](_0x7b46('0x33'),NOW)[_0x7b46('0x10')](_0x7b46('0x34'),selectNotIn(_0x113750,_0x13605b,_0x106fc2,_0x7b46('0x25'),[_0x7b46('0x35'),_0x7b46('0x36')]))['where'](_0x7b46('0x34'),selectNotIn(_0x113750,_0x13605b,_0x106fc2,_0x7b46('0x25'),[_0x7b46('0x35')])))[_0x7b46('0x37')]();}function insertCmHopperBlack(_0x3a0801,_0x2832dd,_0x1558b7,_0x1dc995){var _0x284f23=['cm_contacts.phone',_0x7b46('0x20'),_0x7b46('0x21'),_0x2832dd+'.'+_0x1dc995,_0x7b46('0x38'),_0x7b46('0x22')];return squel[_0x7b46('0x39')]()['into']('cm_hopper_black')[_0x7b46('0x26')](['phone','ContactId',_0x7b46('0x29'),_0x1dc995,_0x7b46('0x2a'),'updatedAt'],squel['select']()[_0x7b46('0x2e')](_0x284f23)[_0x7b46('0xf')](_0x2832dd)[_0x7b46('0x30')]('cm_contacts',null,_0x7b46('0x3a')+_0x2832dd+_0x7b46('0x2f'))[_0x7b46('0x30')](_0x1558b7,null,_0x1558b7+'.id\x20=\x20'+_0x2832dd+'.'+_0x1dc995)['where'](_0x2832dd+_0x7b46('0x32'),_0x3a0801)['where']('cm_contacts.createdAt\x20=\x20?',NOW)[_0x7b46('0x10')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel['select']()['field'](_0x7b46('0xe'))[_0x7b46('0xf')](_0x7b46('0x3b'))[_0x7b46('0x10')]('ListId\x20=\x20?',_0x3a0801)['where'](_0x1dc995+_0x7b46('0x11')+_0x2832dd+'.'+_0x1dc995)))[_0x7b46('0x37')]();}function insertTzCmHopper(_0x334d60,_0x32c8f5,_0x4942d8,_0x94e956,_0x268077,_0x93717d){var _0x5d0189=[_0x7b46('0x1f'),_0x7b46('0x3c')+_0x93717d+_0x7b46('0x3d'),_0x7b46('0x20'),_0x7b46('0x21'),_0x32c8f5+'.'+_0x94e956,_0x7b46('0x38'),_0x7b46('0x22'),_0x7b46('0x23'),_0x7b46('0x3e'),'\x22'+_0x268077+'\x22'];var _0x5124cd=squel[_0x7b46('0x39')]()[_0x7b46('0x24')]('cm_hopper')['fromQuery']([_0x7b46('0xe'),_0x7b46('0x27'),'ContactId',_0x7b46('0x29'),_0x94e956,_0x7b46('0x2a'),_0x7b46('0x3f'),_0x7b46('0x2b'),_0x7b46('0x2c'),_0x7b46('0x2d')],squel[_0x7b46('0x40')]()[_0x7b46('0x2e')](_0x5d0189)[_0x7b46('0xf')](_0x32c8f5)['join'](_0x7b46('0x41'),null,'cm_contacts.ListId\x20=\x20'+_0x32c8f5+'.CmListId')[_0x7b46('0x30')](_0x4942d8,null,_0x4942d8+_0x7b46('0x31')+_0x32c8f5+'.'+_0x94e956)[_0x7b46('0x30')](_0x93717d,null,_0x93717d+'.id\x20=\x20'+_0x32c8f5+'.'+_0x94e956)[_0x7b46('0x10')](_0x32c8f5+_0x7b46('0x32'),_0x334d60)['where'](_0x7b46('0x33'),NOW)[_0x7b46('0x10')](_0x7b46('0x34'),selectNotIn(_0x32c8f5,_0x4942d8,_0x94e956,_0x7b46('0x25'),[_0x7b46('0x35'),_0x7b46('0x36')]))[_0x7b46('0x10')](_0x7b46('0x34'),selectNotIn(_0x32c8f5,_0x4942d8,_0x94e956,'cm_hopper',[_0x7b46('0x35')])))[_0x7b46('0x37')]();return _0x5124cd;}function insertTzCmHopperBlack(_0x1f5620,_0x44943a,_0x2eb3c8,_0x26fd49){var _0x1a4341=[_0x7b46('0x1f'),_0x7b46('0x20'),_0x7b46('0x21'),_0x44943a+'.'+_0x26fd49,_0x7b46('0x38'),_0x7b46('0x22')];return squel[_0x7b46('0x39')]()['into'](_0x7b46('0x3b'))[_0x7b46('0x26')](['phone',_0x7b46('0x28'),'ListId',_0x26fd49,_0x7b46('0x2a'),_0x7b46('0x3f')],squel['select']()[_0x7b46('0x2e')](_0x1a4341)[_0x7b46('0xf')](_0x44943a)[_0x7b46('0x30')](_0x7b46('0x41'),null,_0x7b46('0x3a')+_0x44943a+_0x7b46('0x2f'))[_0x7b46('0x30')](_0x2eb3c8,null,_0x2eb3c8+'.id\x20=\x20'+_0x44943a+'.'+_0x26fd49)['where'](_0x44943a+_0x7b46('0x32'),_0x1f5620)[_0x7b46('0x10')](_0x7b46('0x33'),NOW)[_0x7b46('0x10')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0x7b46('0x40')]()[_0x7b46('0x42')](_0x7b46('0xe'))[_0x7b46('0xf')]('cm_hopper_black')['where'](_0x7b46('0x43'),_0x1f5620)[_0x7b46('0x10')](_0x26fd49+_0x7b46('0x11')+_0x44943a+'.'+_0x26fd49)))[_0x7b46('0x37')]();}function insertCmHopperAdditionalPhones(_0x3f19b6){var _0x470564=[_0x7b46('0x44'),_0x7b46('0x45'),'cm_contact_has_items.OrderBy',_0x7b46('0x46'),_0x7b46('0x47')];return squel[_0x7b46('0x39')]()[_0x7b46('0x24')](_0x7b46('0x48'))['fromQuery']([_0x7b46('0x49'),'phone',_0x7b46('0x4a'),'createdAt',_0x7b46('0x3f')],squel[_0x7b46('0x40')]()[_0x7b46('0x2e')](_0x470564)[_0x7b46('0xf')](_0x7b46('0x25'))[_0x7b46('0x30')](_0x7b46('0x41'),null,_0x7b46('0x4b'))['join'](_0x7b46('0x4c'),null,'cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId')[_0x7b46('0x10')](_0x7b46('0x4d'),_0x3f19b6)[_0x7b46('0x10')]('cm_contacts.createdAt\x20=\x20?',NOW))[_0x7b46('0x37')]();}function insertCmContact(_0xee9a4b,_0x136750,_0x5f0831,_0x4b7c8a){var _0x4a5a13=_[_0x7b46('0x4e')](_['keys'](_0x4b7c8a),['ListId',_0x7b46('0x4f'),_0x7b46('0x2a'),_0x7b46('0x3f'),_0x7b46('0x50')]);return squel[_0x7b46('0x39')]()[_0x7b46('0x24')](_0x7b46('0x41'))[_0x7b46('0x26')](_0x4a5a13,squel[_0x7b46('0x40')]()[_0x7b46('0x2e')](_0x4a5a13)[_0x7b46('0xf')](_0x136750)[_0x7b46('0x10')]('('+_0x5f0831[_0x7b46('0x30')](',')+_0x7b46('0x51'),squel[_0x7b46('0x40')]()[_0x7b46('0x2e')](_0x5f0831)[_0x7b46('0xf')](_0x7b46('0x41'))[_0x7b46('0x10')](_0x7b46('0x43'),_0xee9a4b)[_0x7b46('0x10')](_0x7b46('0x52')))[_0x7b46('0x10')](_0x7b46('0x53'),squel[_0x7b46('0x40')]()[_0x7b46('0x42')]('MIN(id)',_0x7b46('0x54'))['from'](_0x136750)[_0x7b46('0x55')](_0x5f0831['join'](','))))[_0x7b46('0x37')]();}function handleStop(){logger[_0x7b46('0x56')](_0x7b46('0x57'));stopped=!![];}function handleUncaughtException(_0xc45f9d){logger[_0x7b46('0x58')](_0xc45f9d[_0x7b46('0x59')]);process[_0x7b46('0x5a')](0x1);}function handleError(_0x10f6d6,_0x4ebe7e){stats[_0x7b46('0x5b')][_0x7b46('0x17')]({'name':_0x4ebe7e[_0x7b46('0x5c')],'message':_0x4ebe7e[_0x7b46('0x59')],'row':_0x10f6d6});}function handleQuery(_0x1d2b87){logger[_0x7b46('0x56')](_0x1d2b87);return db['sequelize'][_0x7b46('0x5d')](_0x1d2b87)[_0x7b46('0x5e')](function(_0x261f4c){results[_0x7b46('0x17')](_0x261f4c);})[_0x7b46('0x5f')](function(_0x2af23f){logger['error'](_0x2af23f[_0x7b46('0x59')]);});}function updateTzCampaigns(_0x4c537c){return new Promise(function(_0x289de7,_0x41891e){var _0x29593c=squel[_0x7b46('0x40')]()['fields']([_0x7b46('0x60'),_0x7b46('0x61')])[_0x7b46('0xf')]('campaigns')[_0x7b46('0x30')](_0x7b46('0x62'),null,'campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId')[_0x7b46('0x10')]('campaigns_has_cm_lists.CmListId='+_0x4c537c);db[_0x7b46('0x63')][_0x7b46('0x5d')](_0x29593c[_0x7b46('0x37')]())[_0x7b46('0x5e')](function(_0x585bdb){var _0x20bc87=[];for(var _0x2acfd0=0x0;_0x2acfd0<_0x585bdb['length'];_0x2acfd0++){_0x20bc87[_0x7b46('0x17')](getTimezoneData(_0x585bdb[_0x2acfd0],tmp_campaigns));}BPromise['all'](_0x20bc87)[_0x7b46('0x15')](function(){_0x289de7({'val':0x1});});})['catch'](function(_0x4f2b9d){logger[_0x7b46('0x58')](_0x4f2b9d[_0x7b46('0x59')]);_0x289de7({'val':0x0});});});}function updateTzVoiceQueues(_0x2ec12d){return new Promise(function(_0x33167a,_0x363144){var _0xa6fadb=squel[_0x7b46('0x40')]()[_0x7b46('0x2e')]([_0x7b46('0x64'),_0x7b46('0x65')])['from']('voice_queues')[_0x7b46('0x30')](_0x7b46('0x66'),null,_0x7b46('0x67'))[_0x7b46('0x10')](_0x7b46('0x68')+_0x2ec12d);db[_0x7b46('0x63')][_0x7b46('0x5d')](_0xa6fadb[_0x7b46('0x37')]())[_0x7b46('0x5e')](function(_0x5d8982){var _0x4473c2=[];for(var _0x16fee2=0x0;_0x16fee2<_0x5d8982[_0x7b46('0x16')];_0x16fee2++){_0x4473c2[_0x7b46('0x17')](getTimezoneData(_0x5d8982[_0x16fee2],tmp_voice_queues));}BPromise[_0x7b46('0x69')](_0x4473c2)[_0x7b46('0x15')](function(){_0x33167a({'val':0x1});});})['catch'](function(_0x13c505){logger[_0x7b46('0x58')](_0x13c505['message']);_0x33167a({'val':0x0});});});}function getTimezoneData(_0x32851b,_0x4d1db6){return new Promise(function(_0x55854b,_0x48ca87){var _0x1e7f46=shared[_0x7b46('0x6a')];var _0x1a6907=_0x1e7f46[_0x32851b[_0x7b46('0x6b')]];if(_[_0x7b46('0x6c')](_0x1a6907)){_0x55854b({'ret':0x1});}else{var _0x276ce9=_0x1a6907[_0x7b46('0x6d')];var _0x29a8bc=squel['insert']()[_0x7b46('0x24')](_0x4d1db6)['set']('id',_0x32851b['id'])[_0x7b46('0x6e')]('offset',_0x276ce9)[_0x7b46('0x6e')](_0x7b46('0x6b'),_0x32851b[_0x7b46('0x6b')])[_0x7b46('0x37')]();return db[_0x7b46('0x63')][_0x7b46('0x5d')](_0x29a8bc)['spread'](function(_0x3cfc9b){_0x55854b({'ret':0x1});})[_0x7b46('0x5f')](function(_0x15ab57){logger[_0x7b46('0x58')](_0x15ab57[_0x7b46('0x59')]);_0x48ca87({'ret':0x1});});}});}function handleTZQuery(_0x2479e5){logger[_0x7b46('0x56')](_0x2479e5);return db['sequelize'][_0x7b46('0x5d')](_0x2479e5)[_0x7b46('0x5e')](function(_0x1b0839){})[_0x7b46('0x5f')](function(_0x16afc6){logger['error'](_0x16afc6[_0x7b46('0x59')]);});}function main(_0x2225c2,_0xc0f791,_0x1236b3,_0x578f5c){logger[_0x7b46('0x56')](_0x7b46('0x6f'),_0x2225c2,JSON[_0x7b46('0x70')](_0xc0f791));process[_0x7b46('0x71')](_0x7b46('0x72'));var _0x106146=_0xc0f791['binding'];var _0x42ad98=_[_0x7b46('0x73')](_0x106146);var _0x2c3d67=_0xc0f791['socket_timestamp'];var _0x3804ce=path[_0x7b46('0x30')](config[_0x7b46('0x74')],_0x7b46('0x75'),_0x2c3d67+_0x7b46('0x76'));hasTZ=_['keys'](_0x106146)['includes'](_0x7b46('0x6b'));var _0x3850cd=_[_0x7b46('0x77')](_0x106146)[_0x7b46('0x30')]();logger[_0x7b46('0x56')](_0x7b46('0x78'),_0x3850cd);db[_0x7b46('0x79')][_0x7b46('0x7a')]({'raw':!![],'attributes':['id',_0x7b46('0x7b')]})['then'](function(_0x580770){for(var _0x1ea188=0x0;_0x1ea188<_0x580770['length'];_0x1ea188++){if(_0x580770[_0x1ea188]['name']in _0x106146){contactItemTypes[_0x7b46('0x17')](_0x580770[_0x1ea188]);delete _0x42ad98[_0x580770[_0x1ea188][_0x7b46('0x7b')]];hasAdditionalPhones=!![];}for(var _0x1e67f0 in _0x106146){if(_0x580770[_0x1ea188][_0x7b46('0x7b')]+_0x7b46('0x7c')===_0x1e67f0){phoneDescriptions[_0x7b46('0x17')]({'itemTypeId':_0x580770[_0x1ea188]['id'],'description':_0x1e67f0});delete _0x42ad98[_0x1e67f0];}}}if(hasAdditionalPhones)_0x42ad98[_0x7b46('0x14')]='';var _0x257a87=_['keys'](_0x42ad98)[_0x7b46('0x30')]();logger[_0x7b46('0x56')](_0x7b46('0x78'),_0x257a87);fs['writeFileSync'](_0x3804ce,_0x257a87+'\x0a');Papa[_0x7b46('0x7d')](fs[_0x7b46('0x7e')](_0x2225c2),{'header':!![],'skipEmptyLines':!![],'step':function(_0x7779ee,_0x134746){try{for(var _0x5879a6=0x0,_0x4a5850=[];_0x5879a6<_0x7779ee[_0x7b46('0x7f')]['length'];_0x5879a6++){stats[_0x7b46('0x80')]+=0x1;if(_0x7779ee[_0x7b46('0x5b')][_0x5879a6]){handleError(_0x7779ee['data'][_0x5879a6],_0x7779ee[_0x7b46('0x5b')][_0x5879a6]);}else{var _0x580127=[];var _0x5ad7bc=[];var _0x56081f={};for(var _0x5c732b in _0x106146){let _0x4d3a7e=contactItemTypes[_0x7b46('0x81')](_0xf69e70=>_0xf69e70['name']===_0x5c732b);let _0x40cf13=contactItemTypes[_0x7b46('0x81')](_0x2e98b3=>_0x2e98b3[_0x7b46('0x7b')]+_0x7b46('0x7c')===_0x5c732b);if(_[_0x7b46('0x6c')](_0x4d3a7e)&&_[_0x7b46('0x6c')](_0x40cf13)){if(_0x106146[_0x7b46('0x82')](_0x5c732b)){if(_0x7779ee[_0x7b46('0x7f')][_0x5879a6][_0x106146[_0x5c732b]]){var _0x192657=_[_0x7b46('0x83')](_0x7779ee[_0x7b46('0x7f')][_0x5879a6][_0x106146[_0x5c732b]]['replace'](/"/g,'\x27'));switch(_0x5c732b){case _0x7b46('0x27'):var _0x58ff63=moment(_0x192657,_0x7b46('0xc'),!![]);if(_0x58ff63[_0x7b46('0x84')]()){_0x4a5850[_0x7b46('0x17')]('\x22'+_0x192657+'\x22');}else{_0x580127[_0x7b46('0x17')]('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case _0x7b46('0x2b'):var _0x35dbb6=parseInt(_0x192657);_0x192657=_[_0x7b46('0x85')](_0x35dbb6)||_0x35dbb6<0x0||_0x35dbb6>0x4?_0x578f5c?0x3:0x2:_0x35dbb6;_0x4a5850['push']('\x22'+_0x192657+'\x22');break;case _0x7b46('0x2c'):var _0x2f17e5=parseInt(_0x192657);if(_['isNumber'](_0x2f17e5)&&_['includes'](_0x1236b3,_0x2f17e5)){_0x4a5850[_0x7b46('0x17')]('\x22'+_0x2f17e5+'\x22');}else{_0x580127[_0x7b46('0x17')](_0x7b46('0x86'));}break;case _0x7b46('0x87'):if(isEmail(_0x192657)){_0x4a5850[_0x7b46('0x17')]('\x22'+_0x192657+'\x22');}else{_0x580127[_0x7b46('0x17')](_0x7b46('0x88'));}break;case _0x7b46('0x89'):var _0x84da3f=moment(_0x192657,_0x7b46('0x8a'),!![]);if(_0x84da3f['isValid']()){_0x4a5850['push']('\x22'+_0x192657+'\x22');}else{_0x580127[_0x7b46('0x17')](_0x7b46('0x8b'));}break;case _0x7b46('0x6b'):var _0x113023=shared['timezones'];var _0xe0a9ba=_0x113023[_0x192657];if(!_[_0x7b46('0x6c')](_0xe0a9ba)){var _0x143c7d=_0xe0a9ba[_0x7b46('0x6d')];_0x4a5850[_0x7b46('0x17')]('\x22'+_0x192657+'\x22');_0x4a5850[_0x7b46('0x17')]('\x22'+_0x143c7d+'\x22');}break;default:_0x4a5850[_0x7b46('0x17')]('\x22'+_0x192657+'\x22');}}else{switch(_0x5c732b){case _0x7b46('0x8c'):case _0x7b46('0xe'):_0x580127['push'](_0x5c732b+_0x7b46('0x8d'));break;default:_0x4a5850[_0x7b46('0x17')]('\x22\x22');}}}}else{var _0x3d0140='';if(!_['isNil'](_0x4d3a7e)){if(!_0x56081f[_0x7b46('0x82')](_0x4d3a7e['id'])){if(!_[_0x7b46('0x6c')](_0x7779ee[_0x7b46('0x7f')][_0x5879a6][_0x106146[_0x5c732b]])){var _0x192657=_[_0x7b46('0x83')](_0x7779ee[_0x7b46('0x7f')][_0x5879a6][_0x106146[_0x5c732b]][_0x7b46('0x8e')](/"/g,'\x27'));var _0x4c64a9=phoneDescriptions[_0x7b46('0x81')](_0x511a88=>_0x511a88[_0x7b46('0x8f')]===_0x4d3a7e['id']);if(!_[_0x7b46('0x6c')](_0x4c64a9)){var _0x38f9ab=_[_0x7b46('0x83')](_0x7779ee[_0x7b46('0x7f')][_0x5879a6][_0x106146[_0x4c64a9['description']]]['replace'](/"/g,'\x27'));if(!_['isNil'](_0x38f9ab))_0x192657=_0x192657+'§'+_0x38f9ab;}if(_0x3d0140=='')_0x3d0140=_0x192657;else _0x3d0140+='|'+_0x192657;}_0x5ad7bc[_0x7b46('0x17')](_0x4d3a7e['id']+':'+_0x3d0140);_0x56081f[_0x4d3a7e['id']]=0x1;}}}}if(hasAdditionalPhones){_0x4a5850[_0x7b46('0x17')]('\x22'+_0x5ad7bc['join'](';')+'\x22');}if(_0x580127[_0x7b46('0x16')]){handleError(_0x7779ee[_0x7b46('0x7f')][_0x5879a6],{'code':_0x7b46('0x90'),'message':_0x580127[_0x7b46('0x30')]()});}else{fs[_0x7b46('0x91')](_0x3804ce,_0x4a5850[_0x7b46('0x30')]()+'\x0a');}_0x4a5850=[];}if(!(stats[_0x7b46('0x80')]%0xc8)){socket['emit'](_0x7b46('0x92')+_0x2c3d67,stats);stats[_0x7b46('0x5b')]=[];}}if(stopped){logger[_0x7b46('0x56')](_0x7b46('0x93'));_0x134746[_0x7b46('0x94')]();}}catch(_0x106ccc){handleError(_0x7779ee['data'][_0x5879a6],{'code':_0x7b46('0x95'),'message':_0x106ccc['message']});logger[_0x7b46('0x58')]('step',_0x106ccc['message']);}},'complete':function(){try{var _0x34bac1=[];var _0x5205e2=[];var _0x2b033e=_0x7b46('0x41');if(_0xc0f791['duplicates']&&_0xc0f791[_0x7b46('0x96')][_0x7b46('0x16')]){_0x2b033e=_0x7b46('0x97')+_0x2c3d67;_0x34bac1[_0x7b46('0x17')](_0x7b46('0x98')+_0x2b033e+_0x7b46('0x99'));}tmp_campaigns=_0x7b46('0x9a')+_0x2c3d67;tmp_voice_queues=_0x7b46('0x9b')+_0x2c3d67;_0x5205e2['push'](_0x7b46('0x98')+tmp_campaigns+'(id\x20int,dialTimezone\x20varchar(255),offset\x20int);');_0x5205e2[_0x7b46('0x17')](_0x7b46('0x98')+tmp_voice_queues+_0x7b46('0x9c'));BPromise[_0x7b46('0x9d')](_0x5205e2,handleTZQuery)['then'](function(_0x5154cf){updateTzCampaigns(_0xc0f791[_0x7b46('0x29')])['then'](function(_0x4668b4){updateTzVoiceQueues(_0xc0f791['ListId'])['then'](function(_0x2ebbce){if(hasTZ)_0x257a87=_0x257a87['replace'](_0x7b46('0x6b'),_0x7b46('0x9e'));var _0x339d37=util['format'](_0x7b46('0x9f'),_0x3804ce,_0x2b033e,_0x257a87,_0xc0f791[_0x7b46('0x29')],_0xc0f791[_0x7b46('0x4f')]||null,NOW,NOW);if(_[_0x7b46('0x6c')](_0x106146[_0x7b46('0x27')])){_0x339d37+=',\x20scheduledAt\x20=\x20NOW()';}_0x34bac1['push'](_0x339d37);if(_0xc0f791[_0x7b46('0x96')]&&_0xc0f791['duplicates'][_0x7b46('0x16')]){_0x34bac1['push'](insertCmContact(_0xc0f791[_0x7b46('0x29')],_0x2b033e,_0xc0f791[_0x7b46('0x96')],_0x106146));_0x34bac1[_0x7b46('0x17')](_0x7b46('0xa0')+_0x2b033e+';');}BPromise[_0x7b46('0x9d')](_0x34bac1,handleQuery)['then'](function(_0x560566){BPromise['all']([handleAdditionalPhones()])['then'](function(){_0x34bac1=[];for(var _0x361f2d=0x0;_0x361f2d\x20\x20');}var _0x5dc21a=path[_0x7b46('0x30')](config[_0x7b46('0x74')],_0x7b46('0x75'),process[_0x7b46('0xae')][0x2]);if(!fs['existsSync'](_0x5dc21a)){throw new Error(_0x7b46('0xaf'));}var _0x26e467={};try{_0x26e467=JSON[_0x7b46('0x7d')](process[_0x7b46('0xae')][0x3]);if(!_0x26e467[_0x7b46('0xb0')]){throw new Error(_0x7b46('0xb1'));}if(!_0x26e467[_0x7b46('0xb0')]['phone']){throw new Error(_0x7b46('0xb2'));}if(!_0x26e467[_0x7b46('0xb0')]['firstName']){throw new Error(_0x7b46('0xb3'));}var _0x179630=0x0;if(_0x26e467[_0x7b46('0xb0')]['UserId']){_0x179630=0x1;}if(!_0x26e467['ListId']){throw new Error('ListId\x20is\x20mandatory');}}catch(_0x45cab8){throw new Error(_0x7b46('0xb4'));}var _0xbb1895=[];try{_0xbb1895=_[_0x7b46('0xb5')](JSON[_0x7b46('0x7d')](process[_0x7b46('0xae')][0x4]),'id');}catch(_0x42064b){logger[_0x7b46('0x56')](_0x7b46('0xb6'));}main(_0x5dc21a,_0x26e467,_0xbb1895,_0x179630);}validate();process['on']('SIGINT',handleStop);process['on'](_0x7b46('0xb7'),handleUncaughtException); \ No newline at end of file +var _0xbee7=['spread','catch','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','campaigns_has_cm_lists.CmListId=','voice_queues.dialTimezone','voice_queues','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','timezones','dialTimezone','utcOffset','set','offset','main','stringify','send','start','clone','root','server/files/tmp','.csv','header','ContactItemType','name','_description','writeFileSync','parse','createReadStream','find','hasOwnProperty','data','trim','replace','isValid','priority','isNaN','isNumber','email','email\x20wrong\x20format','dateOfBirth','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','appendFileSync','rows','emit','contact:import:','Abort\x20parser','SystemError','step','duplicates','cm_contacts_','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','campaigns_','voice_queues_','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','each','dialTimezone,utcOffset','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','contactId','contactTypeId','orderBy','voice_queues_has_cm_lists','voice_queues_has_cm_blacklists','VoiceQueueId','campaigns_has_cm_lists','campaigns','CampaignId','campaigns_has_cm_blacklists','finish','affectedRows','unlink','complete','argv','arguments\x20\x20\x20','existsSync','binding\x20doesn\x27t\x20exists','binding','firstName\x20is\x20mandatory','body\x20id\x20mandatory','SIGINT','path','lodash','papaparse','util','bluebird','squel','../../../config/environment','../../../config/environment/shared','redis','defaults','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','test','select','field','from','join','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','CmContact','AdditionalPhones','length','push','then','all','split','isNil','filter','CmContactHasItem','updated','create','PHONE','inserted','cm_contacts.phone','cm_contacts.id','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','insert','into','fromQuery','phone','ContactId','ListId','updatedAt','UserId','recallme','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.ListId','createdAt','fields','cm_contacts','cm_hopper_black','date_add(cm_contacts.scheduledat,interval\x20','.offset-cm_contacts.utcOffset\x20minute)','scheduledat','ListId\x20=\x20?','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.updatedAt','cm_hopper_additional_phones','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','concat','keys','CompanyId','scheduledAt',')\x20NOT\x20IN\x20?','id\x20IN\x20?','MIN(id)','min_id','group','info','error','message','exit','errors','code','sequelize','query'];(function(_0x28bf11,_0x17c609){var _0x50096a=function(_0x428e68){while(--_0x428e68){_0x28bf11['push'](_0x28bf11['shift']());}};_0x50096a(++_0x17c609);}(_0xbee7,0x102));var _0x7bee=function(_0x2d6ae0,_0x438493){_0x2d6ae0=_0x2d6ae0-0x0;var _0x4cae8d=_0xbee7[_0x2d6ae0];return _0x4cae8d;};'use strict';var fs=require('fs');var path=require(_0x7bee('0x0'));var _=require(_0x7bee('0x1'));var Papa=require(_0x7bee('0x2'));var util=require(_0x7bee('0x3'));var BPromise=require(_0x7bee('0x4'));var moment=require('moment');var squel=require(_0x7bee('0x5'));var Redis=require('ioredis');var db=require('../../../mysqldb')['db'];var config=require(_0x7bee('0x6'));var shared=require(_0x7bee('0x7'));var logger=require('../../../config/logger')('import');config[_0x7bee('0x8')]=_[_0x7bee('0x9')](config[_0x7bee('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0x7bee('0xa'))(new Redis(config['redis']));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0x7bee('0xb')](_0x7bee('0xc'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0x7bee('0xb')](_0x7bee('0xc'));function isEmail(_0x4aa9b7){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))*$/[_0x7bee('0xd')](_0x4aa9b7);}function selectNotIn(_0x45acdb,_0x58eb54,_0x121626,_0x266d82,_0x1ff8ba){return squel[_0x7bee('0xe')]()[_0x7bee('0xf')]('phone')[_0x7bee('0x10')](_0x266d82)[_0x7bee('0x11')](_0x58eb54,null,_0x58eb54+_0x7bee('0x12')+_0x266d82+'.'+_0x121626)[_0x7bee('0x13')](_0x266d82+'.'+_0x121626+_0x7bee('0x14')+_0x45acdb+'.'+_0x121626)[_0x7bee('0x13')](_0x58eb54+_0x7bee('0x15')+_0x1ff8ba[_0x7bee('0x11')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x2e4d62,_0x4b65d1){promisesAdditionalPhones=[];return db[_0x7bee('0x16')]['findAll']({'raw':!![],'attributes':['id',_0x7bee('0x17')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})['then'](function(_0x590db5){if(_0x590db5!==null){var _0x1e562e=[];for(var _0x50dda4=0x0;_0x50dda4<_0x590db5[_0x7bee('0x18')];_0x50dda4++){var _0x306878=_0x590db5[_0x50dda4];_0x1e562e[_0x7bee('0x19')](insertAdditionalPhones(_0x306878));}}Promise['all'](_0x1e562e)[_0x7bee('0x1a')](function(){_0x2e4d62({'val':0x1});});});});}function insertAdditionalPhones(_0xb861ed){return new Promise(function(_0x188eab,_0x1ddda0){var _0x297535=_0xb861ed[_0x7bee('0x17')];var _0x418d28=_0x297535['split'](';');var _0x40ea93=[];orderBy=0x0;for(var _0x536a95=0x0;_0x536a95<_0x418d28['length'];_0x536a95++){_0x40ea93[_0x7bee('0x19')](splitAdditionalPhone(_0xb861ed['id'],_0x418d28[_0x536a95]));}Promise[_0x7bee('0x1b')](_0x40ea93)['then'](function(){_0x188eab({'val':_0x418d28[_0x7bee('0x18')]});});});}function splitAdditionalPhone(_0x2183ad,_0x4f6f5d){return new Promise(function(_0x1a2845,_0x12f2e4){var _0xd064f4=_0x4f6f5d[_0x7bee('0x1c')](':');var _0x32e567=_0xd064f4[0x0];var _0x55512a=_0xd064f4[0x1];if(!_[_0x7bee('0x1d')](_0x55512a)){var _0x52ab9f=_0x55512a[_0x7bee('0x1c')]('|');var _0x9b7ac6=[];for(var _0x40d410=0x0;_0x40d410<_0x52ab9f[_0x7bee('0x18')];_0x40d410++){if(_0x52ab9f[_0x40d410]!==''){var _0x5a93c9=_[_0x7bee('0x1e')](promisesAdditionalPhones,{'contactId':_0x2183ad,'phone':_0x52ab9f[_0x40d410]});if(_0x5a93c9[_0x7bee('0x18')]==0x0){orderBy++;promisesAdditionalPhones[_0x7bee('0x19')]({'contactId':_0x2183ad,'contactTypeId':_0x32e567,'phone':_0x52ab9f[_0x40d410],'orderBy':orderBy});}}}_0x1a2845({'ok':0x1});}else _0x1a2845({'res':0x0});});}function createAdditionalPhone(_0x88571b,_0x11659a,_0x583e68,_0x153a76){var _0x4d423a='';var _0x1358d0='';var _0x3a1171=_0x583e68['split']('§');_0x4d423a=_0x3a1171[0x0];if(_0x3a1171['length']==0x2)_0x1358d0=_0x3a1171[0x1];return new Promise(function(_0x389fc0,_0x1556c8){return db[_0x7bee('0x1f')]['findOne']({'where':{'CmContactId':_0x88571b,'item':_0x4d423a}})[_0x7bee('0x1a')](function(_0x50c738){if(_0x50c738){return db[_0x7bee('0x1f')]['update']({'ItemTypeId':_0x11659a,'description':_0x1358d0,'OrderBy':_0x153a76},{'where':{'CmContactId':_0x88571b,'item':_0x4d423a}})[_0x7bee('0x1a')](function(_0xe8fbc4){_0x389fc0({'res':_0x7bee('0x20')});});}else{return db['CmContactHasItem'][_0x7bee('0x21')]({'CmContactId':_0x88571b,'item':_0x4d423a,'description':_0x1358d0,'ItemTypeId':_0x11659a,'OrderBy':_0x153a76,'ItemClass':_0x7bee('0x22')})['then'](function(_0x2c74f8){_0x389fc0({'res':_0x7bee('0x23')});});}});});}function insertCmHopper(_0x5a8c84,_0x5f31fa,_0x13ff7d,_0x987b74,_0x204b40){var _0x348533=[_0x7bee('0x24'),'cm_contacts.scheduledat',_0x7bee('0x25'),'cm_contacts.ListId',_0x5f31fa+'.'+_0x987b74,_0x7bee('0x26'),_0x7bee('0x27'),_0x7bee('0x28'),'cm_contacts.UserId','\x22'+_0x204b40+'\x22'];return squel[_0x7bee('0x29')]()[_0x7bee('0x2a')]('cm_hopper')[_0x7bee('0x2b')]([_0x7bee('0x2c'),'scheduledat',_0x7bee('0x2d'),_0x7bee('0x2e'),_0x987b74,'createdAt',_0x7bee('0x2f'),'priority',_0x7bee('0x30'),_0x7bee('0x31')],squel[_0x7bee('0xe')]()['fields'](_0x348533)[_0x7bee('0x10')](_0x5f31fa)[_0x7bee('0x11')]('cm_contacts',null,_0x7bee('0x32')+_0x5f31fa+_0x7bee('0x33'))[_0x7bee('0x11')](_0x13ff7d,null,_0x13ff7d+'.id\x20=\x20'+_0x5f31fa+'.'+_0x987b74)[_0x7bee('0x13')](_0x5f31fa+_0x7bee('0x34'),_0x5a8c84)['where'](_0x7bee('0x35'),NOW)[_0x7bee('0x13')](_0x7bee('0x36'),selectNotIn(_0x5f31fa,_0x13ff7d,_0x987b74,_0x7bee('0x37'),[_0x7bee('0x38'),_0x7bee('0x39')]))[_0x7bee('0x13')](_0x7bee('0x36'),selectNotIn(_0x5f31fa,_0x13ff7d,_0x987b74,_0x7bee('0x37'),['\x22always\x22'])))[_0x7bee('0x3a')]();}function insertCmHopperBlack(_0x17272d,_0xd8f9c8,_0x4f6f1f,_0x26878f){var _0x4de9b0=[_0x7bee('0x24'),'cm_contacts.id',_0x7bee('0x3b'),_0xd8f9c8+'.'+_0x26878f,_0x7bee('0x26'),'cm_contacts.updatedAt'];return squel[_0x7bee('0x29')]()['into']('cm_hopper_black')['fromQuery']([_0x7bee('0x2c'),_0x7bee('0x2d'),_0x7bee('0x2e'),_0x26878f,_0x7bee('0x3c'),'updatedAt'],squel[_0x7bee('0xe')]()[_0x7bee('0x3d')](_0x4de9b0)['from'](_0xd8f9c8)[_0x7bee('0x11')](_0x7bee('0x3e'),null,'cm_contacts.ListId\x20=\x20'+_0xd8f9c8+_0x7bee('0x33'))['join'](_0x4f6f1f,null,_0x4f6f1f+_0x7bee('0x12')+_0xd8f9c8+'.'+_0x26878f)[_0x7bee('0x13')](_0xd8f9c8+_0x7bee('0x34'),_0x17272d)[_0x7bee('0x13')](_0x7bee('0x35'),NOW)[_0x7bee('0x13')](_0x7bee('0x36'),squel[_0x7bee('0xe')]()[_0x7bee('0xf')](_0x7bee('0x2c'))[_0x7bee('0x10')](_0x7bee('0x3f'))[_0x7bee('0x13')]('ListId\x20=\x20?',_0x17272d)[_0x7bee('0x13')](_0x26878f+'\x20=\x20'+_0xd8f9c8+'.'+_0x26878f)))[_0x7bee('0x3a')]();}function insertTzCmHopper(_0x3777b7,_0x249ee8,_0x466edc,_0x4ca5e5,_0x176fbf,_0x531fdc){var _0x27e3e7=[_0x7bee('0x24'),_0x7bee('0x40')+_0x531fdc+_0x7bee('0x41'),_0x7bee('0x25'),_0x7bee('0x3b'),_0x249ee8+'.'+_0x4ca5e5,_0x7bee('0x26'),_0x7bee('0x27'),'cm_contacts.priority','cm_contacts.UserId','\x22'+_0x176fbf+'\x22'];var _0x1d7baf=squel['insert']()['into'](_0x7bee('0x37'))['fromQuery']([_0x7bee('0x2c'),_0x7bee('0x42'),'ContactId','ListId',_0x4ca5e5,_0x7bee('0x3c'),_0x7bee('0x2f'),'priority',_0x7bee('0x30'),_0x7bee('0x31')],squel[_0x7bee('0xe')]()[_0x7bee('0x3d')](_0x27e3e7)[_0x7bee('0x10')](_0x249ee8)['join']('cm_contacts',null,'cm_contacts.ListId\x20=\x20'+_0x249ee8+_0x7bee('0x33'))[_0x7bee('0x11')](_0x466edc,null,_0x466edc+_0x7bee('0x12')+_0x249ee8+'.'+_0x4ca5e5)['join'](_0x531fdc,null,_0x531fdc+_0x7bee('0x12')+_0x249ee8+'.'+_0x4ca5e5)['where'](_0x249ee8+_0x7bee('0x34'),_0x3777b7)[_0x7bee('0x13')]('cm_contacts.createdAt\x20=\x20?',NOW)['where'](_0x7bee('0x36'),selectNotIn(_0x249ee8,_0x466edc,_0x4ca5e5,_0x7bee('0x37'),[_0x7bee('0x38'),_0x7bee('0x39')]))[_0x7bee('0x13')](_0x7bee('0x36'),selectNotIn(_0x249ee8,_0x466edc,_0x4ca5e5,'cm_hopper',[_0x7bee('0x38')])))['toString']();return _0x1d7baf;}function insertTzCmHopperBlack(_0x467057,_0x2ce7b0,_0x527e9a,_0x2a82c9){var _0x35df53=['cm_contacts.phone',_0x7bee('0x25'),_0x7bee('0x3b'),_0x2ce7b0+'.'+_0x2a82c9,'cm_contacts.createdAt','cm_contacts.updatedAt'];return squel['insert']()[_0x7bee('0x2a')](_0x7bee('0x3f'))[_0x7bee('0x2b')](['phone',_0x7bee('0x2d'),_0x7bee('0x2e'),_0x2a82c9,_0x7bee('0x3c'),_0x7bee('0x2f')],squel[_0x7bee('0xe')]()[_0x7bee('0x3d')](_0x35df53)[_0x7bee('0x10')](_0x2ce7b0)[_0x7bee('0x11')](_0x7bee('0x3e'),null,_0x7bee('0x32')+_0x2ce7b0+_0x7bee('0x33'))[_0x7bee('0x11')](_0x527e9a,null,_0x527e9a+_0x7bee('0x12')+_0x2ce7b0+'.'+_0x2a82c9)[_0x7bee('0x13')](_0x2ce7b0+_0x7bee('0x34'),_0x467057)[_0x7bee('0x13')]('cm_contacts.createdAt\x20=\x20?',NOW)['where'](_0x7bee('0x36'),squel[_0x7bee('0xe')]()[_0x7bee('0xf')](_0x7bee('0x2c'))[_0x7bee('0x10')](_0x7bee('0x3f'))[_0x7bee('0x13')](_0x7bee('0x43'),_0x467057)[_0x7bee('0x13')](_0x2a82c9+_0x7bee('0x14')+_0x2ce7b0+'.'+_0x2a82c9)))['toString']();}function insertCmHopperAdditionalPhones(_0x2d916b){var _0x2b0510=[_0x7bee('0x44'),_0x7bee('0x45'),_0x7bee('0x46'),'cm_contact_has_items.createdAt',_0x7bee('0x47')];return squel[_0x7bee('0x29')]()[_0x7bee('0x2a')](_0x7bee('0x48'))[_0x7bee('0x2b')](['CmHopperId',_0x7bee('0x2c'),'OrderBy',_0x7bee('0x3c'),_0x7bee('0x2f')],squel[_0x7bee('0xe')]()[_0x7bee('0x3d')](_0x2b0510)['from'](_0x7bee('0x37'))[_0x7bee('0x11')](_0x7bee('0x3e'),null,_0x7bee('0x49'))[_0x7bee('0x11')](_0x7bee('0x4a'),null,'cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId')[_0x7bee('0x13')]('cm_hopper.ListId\x20=\x20?',_0x2d916b)[_0x7bee('0x13')](_0x7bee('0x35'),NOW))[_0x7bee('0x3a')]();}function insertCmContact(_0x542727,_0x450a75,_0x514c7e,_0x41a54b){var _0x3cfae0=_[_0x7bee('0x4b')](_[_0x7bee('0x4c')](_0x41a54b),[_0x7bee('0x2e'),_0x7bee('0x4d'),_0x7bee('0x3c'),'updatedAt',_0x7bee('0x4e')]);return squel[_0x7bee('0x29')]()[_0x7bee('0x2a')](_0x7bee('0x3e'))[_0x7bee('0x2b')](_0x3cfae0,squel['select']()[_0x7bee('0x3d')](_0x3cfae0)[_0x7bee('0x10')](_0x450a75)[_0x7bee('0x13')]('('+_0x514c7e[_0x7bee('0x11')](',')+_0x7bee('0x4f'),squel[_0x7bee('0xe')]()[_0x7bee('0x3d')](_0x514c7e)[_0x7bee('0x10')](_0x7bee('0x3e'))[_0x7bee('0x13')]('ListId\x20=\x20?',_0x542727)[_0x7bee('0x13')]('deletedAt\x20IS\x20NULL'))['where'](_0x7bee('0x50'),squel[_0x7bee('0xe')]()[_0x7bee('0xf')](_0x7bee('0x51'),_0x7bee('0x52'))[_0x7bee('0x10')](_0x450a75)[_0x7bee('0x53')](_0x514c7e[_0x7bee('0x11')](','))))[_0x7bee('0x3a')]();}function handleStop(){logger[_0x7bee('0x54')]('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x4615e8){logger[_0x7bee('0x55')](_0x4615e8[_0x7bee('0x56')]);process[_0x7bee('0x57')](0x1);}function handleError(_0x44582a,_0x1313ac){stats[_0x7bee('0x58')][_0x7bee('0x19')]({'name':_0x1313ac[_0x7bee('0x59')],'message':_0x1313ac[_0x7bee('0x56')],'row':_0x44582a});}function handleQuery(_0x497695){logger[_0x7bee('0x54')](_0x497695);return db[_0x7bee('0x5a')][_0x7bee('0x5b')](_0x497695)[_0x7bee('0x5c')](function(_0x490157){results[_0x7bee('0x19')](_0x490157);})[_0x7bee('0x5d')](function(_0x461df2){logger[_0x7bee('0x55')](_0x461df2[_0x7bee('0x56')]);});}function updateTzCampaigns(_0x3c8926){return new Promise(function(_0x4a1f16,_0x2a656e){var _0x590357=squel[_0x7bee('0xe')]()[_0x7bee('0x3d')](['campaigns.id','campaigns.dialTimezone'])['from']('campaigns')[_0x7bee('0x11')]('campaigns_has_cm_lists',null,_0x7bee('0x5e'))[_0x7bee('0x13')](_0x7bee('0x5f')+_0x3c8926);db[_0x7bee('0x5a')][_0x7bee('0x5b')](_0x590357[_0x7bee('0x3a')]())['spread'](function(_0x4b10d1){var _0x5e9728=[];for(var _0x5e574e=0x0;_0x5e574e<_0x4b10d1[_0x7bee('0x18')];_0x5e574e++){_0x5e9728[_0x7bee('0x19')](getTimezoneData(_0x4b10d1[_0x5e574e],tmp_campaigns));}BPromise[_0x7bee('0x1b')](_0x5e9728)[_0x7bee('0x1a')](function(){_0x4a1f16({'val':0x1});});})[_0x7bee('0x5d')](function(_0x5a5e5e){logger[_0x7bee('0x55')](_0x5a5e5e['message']);_0x4a1f16({'val':0x0});});});}function updateTzVoiceQueues(_0x2a6053){return new Promise(function(_0x55078b,_0xe331f){var _0x4a0e04=squel[_0x7bee('0xe')]()[_0x7bee('0x3d')](['voice_queues.id',_0x7bee('0x60')])['from'](_0x7bee('0x61'))[_0x7bee('0x11')]('voice_queues_has_cm_lists',null,_0x7bee('0x62'))['where']('voice_queues_has_cm_lists.CmListId='+_0x2a6053);db[_0x7bee('0x5a')][_0x7bee('0x5b')](_0x4a0e04[_0x7bee('0x3a')]())[_0x7bee('0x5c')](function(_0x4af1e7){var _0x3f5047=[];for(var _0x560f85=0x0;_0x560f85<_0x4af1e7[_0x7bee('0x18')];_0x560f85++){_0x3f5047[_0x7bee('0x19')](getTimezoneData(_0x4af1e7[_0x560f85],tmp_voice_queues));}BPromise[_0x7bee('0x1b')](_0x3f5047)[_0x7bee('0x1a')](function(){_0x55078b({'val':0x1});});})[_0x7bee('0x5d')](function(_0x2155b4){logger[_0x7bee('0x55')](_0x2155b4['message']);_0x55078b({'val':0x0});});});}function getTimezoneData(_0x43589e,_0x206f7f){return new Promise(function(_0x542504,_0x4ee777){var _0x2342b7=shared[_0x7bee('0x63')];var _0x290c19=_0x2342b7[_0x43589e[_0x7bee('0x64')]];if(_['isNil'](_0x290c19)){_0x542504({'ret':0x1});}else{var _0x1f9376=_0x290c19[_0x7bee('0x65')];var _0x2d56b5=squel['insert']()[_0x7bee('0x2a')](_0x206f7f)['set']('id',_0x43589e['id'])[_0x7bee('0x66')](_0x7bee('0x67'),_0x1f9376)[_0x7bee('0x66')](_0x7bee('0x64'),_0x43589e['dialTimezone'])[_0x7bee('0x3a')]();return db[_0x7bee('0x5a')][_0x7bee('0x5b')](_0x2d56b5)[_0x7bee('0x5c')](function(_0x425529){_0x542504({'ret':0x1});})['catch'](function(_0x4ebe48){logger[_0x7bee('0x55')](_0x4ebe48[_0x7bee('0x56')]);_0x4ee777({'ret':0x1});});}});}function handleTZQuery(_0x286350){logger[_0x7bee('0x54')](_0x286350);return db['sequelize'][_0x7bee('0x5b')](_0x286350)[_0x7bee('0x5c')](function(_0x1d3fc5){})['catch'](function(_0x2ab404){logger[_0x7bee('0x55')](_0x2ab404[_0x7bee('0x56')]);});}function main(_0x1cd479,_0x4744d9,_0x459f1f,_0x33f226){logger[_0x7bee('0x54')](_0x7bee('0x68'),_0x1cd479,JSON[_0x7bee('0x69')](_0x4744d9));process[_0x7bee('0x6a')](_0x7bee('0x6b'));var _0x197800=_0x4744d9['binding'];var _0x35d8af=_[_0x7bee('0x6c')](_0x197800);var _0x3e624a=_0x4744d9['socket_timestamp'];var _0x228c77=path[_0x7bee('0x11')](config[_0x7bee('0x6d')],_0x7bee('0x6e'),_0x3e624a+_0x7bee('0x6f'));hasTZ=_[_0x7bee('0x4c')](_0x197800)['includes'](_0x7bee('0x64'));var _0x4f28ff=_[_0x7bee('0x4c')](_0x197800)[_0x7bee('0x11')]();logger[_0x7bee('0x54')](_0x7bee('0x70'),_0x4f28ff);db[_0x7bee('0x71')]['findAll']({'raw':!![],'attributes':['id',_0x7bee('0x72')]})[_0x7bee('0x1a')](function(_0x2669a5){for(var _0x2cfe61=0x0;_0x2cfe61<_0x2669a5[_0x7bee('0x18')];_0x2cfe61++){if(_0x2669a5[_0x2cfe61][_0x7bee('0x72')]in _0x197800){contactItemTypes[_0x7bee('0x19')](_0x2669a5[_0x2cfe61]);delete _0x35d8af[_0x2669a5[_0x2cfe61][_0x7bee('0x72')]];hasAdditionalPhones=!![];}for(var _0x1c481 in _0x197800){if(_0x2669a5[_0x2cfe61]['name']+_0x7bee('0x73')===_0x1c481){phoneDescriptions[_0x7bee('0x19')]({'itemTypeId':_0x2669a5[_0x2cfe61]['id'],'description':_0x1c481});delete _0x35d8af[_0x1c481];}}}if(hasAdditionalPhones)_0x35d8af['AdditionalPhones']='';var _0x3f6b3d=_['keys'](_0x35d8af)[_0x7bee('0x11')]();logger[_0x7bee('0x54')](_0x7bee('0x70'),_0x3f6b3d);fs[_0x7bee('0x74')](_0x228c77,_0x3f6b3d+'\x0a');Papa[_0x7bee('0x75')](fs[_0x7bee('0x76')](_0x1cd479),{'header':!![],'skipEmptyLines':!![],'step':function(_0x21eb4f,_0x3dc62f){try{for(var _0x202fea=0x0,_0x4f2e20=[];_0x202fea<_0x21eb4f['data'][_0x7bee('0x18')];_0x202fea++){stats['rows']+=0x1;if(_0x21eb4f[_0x7bee('0x58')][_0x202fea]){handleError(_0x21eb4f['data'][_0x202fea],_0x21eb4f[_0x7bee('0x58')][_0x202fea]);}else{var _0x451e9b=[];var _0x2cb43b=[];var _0x193373={};for(var _0x2fe9e3 in _0x197800){let _0x424c10=contactItemTypes[_0x7bee('0x77')](_0x7af61c=>_0x7af61c[_0x7bee('0x72')]===_0x2fe9e3);let _0x494a0f=contactItemTypes[_0x7bee('0x77')](_0x595ae3=>_0x595ae3[_0x7bee('0x72')]+_0x7bee('0x73')===_0x2fe9e3);if(_[_0x7bee('0x1d')](_0x424c10)&&_[_0x7bee('0x1d')](_0x494a0f)){if(_0x197800[_0x7bee('0x78')](_0x2fe9e3)){if(_0x21eb4f[_0x7bee('0x79')][_0x202fea][_0x197800[_0x2fe9e3]]){var _0x24a1b9=_[_0x7bee('0x7a')](_0x21eb4f[_0x7bee('0x79')][_0x202fea][_0x197800[_0x2fe9e3]][_0x7bee('0x7b')](/"/g,'\x27'));switch(_0x2fe9e3){case _0x7bee('0x42'):var _0x441eaf=moment(_0x24a1b9,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0x441eaf[_0x7bee('0x7c')]()){_0x4f2e20[_0x7bee('0x19')]('\x22'+_0x24a1b9+'\x22');}else{_0x451e9b[_0x7bee('0x19')]('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case _0x7bee('0x7d'):var _0x4c71e9=parseInt(_0x24a1b9);_0x24a1b9=_[_0x7bee('0x7e')](_0x4c71e9)||_0x4c71e9<0x0||_0x4c71e9>0x4?_0x33f226?0x3:0x2:_0x4c71e9;_0x4f2e20[_0x7bee('0x19')]('\x22'+_0x24a1b9+'\x22');break;case'UserId':var _0x14633f=parseInt(_0x24a1b9);if(_[_0x7bee('0x7f')](_0x14633f)&&_['includes'](_0x459f1f,_0x14633f)){_0x4f2e20['push']('\x22'+_0x14633f+'\x22');}else{_0x451e9b[_0x7bee('0x19')]('agent\x20not\x20exists');}break;case _0x7bee('0x80'):if(isEmail(_0x24a1b9)){_0x4f2e20['push']('\x22'+_0x24a1b9+'\x22');}else{_0x451e9b['push'](_0x7bee('0x81'));}break;case _0x7bee('0x82'):var _0x2c55cf=moment(_0x24a1b9,'YYYY-MM-DD',!![]);if(_0x2c55cf[_0x7bee('0x7c')]()){_0x4f2e20[_0x7bee('0x19')]('\x22'+_0x24a1b9+'\x22');}else{_0x451e9b[_0x7bee('0x19')](_0x7bee('0x83'));}break;case _0x7bee('0x64'):var _0x192205=shared[_0x7bee('0x63')];var _0x1a21af=_0x192205[_0x24a1b9];if(!_[_0x7bee('0x1d')](_0x1a21af)){var _0x20db4d=_0x1a21af[_0x7bee('0x65')];_0x4f2e20[_0x7bee('0x19')]('\x22'+_0x24a1b9+'\x22');_0x4f2e20[_0x7bee('0x19')]('\x22'+_0x20db4d+'\x22');}break;default:_0x4f2e20[_0x7bee('0x19')]('\x22'+_0x24a1b9+'\x22');}}else{switch(_0x2fe9e3){case _0x7bee('0x84'):case _0x7bee('0x2c'):_0x451e9b[_0x7bee('0x19')](_0x2fe9e3+_0x7bee('0x85'));break;default:_0x4f2e20[_0x7bee('0x19')]('\x22\x22');}}}}else{var _0x4bfa94='';if(!_[_0x7bee('0x1d')](_0x424c10)){if(!_0x193373[_0x7bee('0x78')](_0x424c10['id'])){if(!_[_0x7bee('0x1d')](_0x21eb4f['data'][_0x202fea][_0x197800[_0x2fe9e3]])){var _0x24a1b9=_[_0x7bee('0x7a')](_0x21eb4f[_0x7bee('0x79')][_0x202fea][_0x197800[_0x2fe9e3]][_0x7bee('0x7b')](/"/g,'\x27'));var _0x452986=phoneDescriptions[_0x7bee('0x77')](_0x3a04db=>_0x3a04db['itemTypeId']===_0x424c10['id']);if(!_[_0x7bee('0x1d')](_0x452986)){var _0x28d077=_[_0x7bee('0x7a')](_0x21eb4f[_0x7bee('0x79')][_0x202fea][_0x197800[_0x452986['description']]][_0x7bee('0x7b')](/"/g,'\x27'));if(!_[_0x7bee('0x1d')](_0x28d077))_0x24a1b9=_0x24a1b9+'§'+_0x28d077;}if(_0x4bfa94=='')_0x4bfa94=_0x24a1b9;else _0x4bfa94+='|'+_0x24a1b9;}_0x2cb43b[_0x7bee('0x19')](_0x424c10['id']+':'+_0x4bfa94);_0x193373[_0x424c10['id']]=0x1;}}}}if(hasAdditionalPhones){_0x4f2e20[_0x7bee('0x19')]('\x22'+_0x2cb43b['join'](';')+'\x22');}if(_0x451e9b[_0x7bee('0x18')]){handleError(_0x21eb4f[_0x7bee('0x79')][_0x202fea],{'code':'SystemRow','message':_0x451e9b[_0x7bee('0x11')]()});}else{fs[_0x7bee('0x86')](_0x228c77,_0x4f2e20[_0x7bee('0x11')]()+'\x0a');}_0x4f2e20=[];}if(!(stats[_0x7bee('0x87')]%0xc8)){socket[_0x7bee('0x88')](_0x7bee('0x89')+_0x3e624a,stats);stats[_0x7bee('0x58')]=[];}}if(stopped){logger[_0x7bee('0x54')](_0x7bee('0x8a'));_0x3dc62f['abort']();}}catch(_0x52fa24){handleError(_0x21eb4f[_0x7bee('0x79')][_0x202fea],{'code':_0x7bee('0x8b'),'message':_0x52fa24['message']});logger[_0x7bee('0x55')](_0x7bee('0x8c'),_0x52fa24[_0x7bee('0x56')]);}},'complete':function(){try{var _0x1ad6ac=[];var _0x3ef32b=[];var _0x10c748=_0x7bee('0x3e');if(_0x4744d9[_0x7bee('0x8d')]&&_0x4744d9[_0x7bee('0x8d')]['length']){_0x10c748=_0x7bee('0x8e')+_0x3e624a;_0x1ad6ac['push'](_0x7bee('0x8f')+_0x10c748+_0x7bee('0x90'));}tmp_campaigns=_0x7bee('0x91')+_0x3e624a;tmp_voice_queues=_0x7bee('0x92')+_0x3e624a;_0x3ef32b[_0x7bee('0x19')](_0x7bee('0x8f')+tmp_campaigns+_0x7bee('0x93'));_0x3ef32b['push'](_0x7bee('0x8f')+tmp_voice_queues+_0x7bee('0x93'));BPromise[_0x7bee('0x94')](_0x3ef32b,handleTZQuery)['then'](function(_0x4570af){updateTzCampaigns(_0x4744d9[_0x7bee('0x2e')])[_0x7bee('0x1a')](function(_0x5392d9){updateTzVoiceQueues(_0x4744d9[_0x7bee('0x2e')])[_0x7bee('0x1a')](function(_0x433b73){if(hasTZ)_0x3f6b3d=_0x3f6b3d[_0x7bee('0x7b')](_0x7bee('0x64'),_0x7bee('0x95'));var _0x1c8994=util[_0x7bee('0xb')](_0x7bee('0x96'),_0x228c77,_0x10c748,_0x3f6b3d,_0x4744d9[_0x7bee('0x2e')],_0x4744d9[_0x7bee('0x4d')]||null,NOW,NOW);if(_[_0x7bee('0x1d')](_0x197800[_0x7bee('0x42')])){_0x1c8994+=_0x7bee('0x97');}_0x1ad6ac[_0x7bee('0x19')](_0x1c8994);if(_0x4744d9[_0x7bee('0x8d')]&&_0x4744d9[_0x7bee('0x8d')][_0x7bee('0x18')]){_0x1ad6ac[_0x7bee('0x19')](insertCmContact(_0x4744d9[_0x7bee('0x2e')],_0x10c748,_0x4744d9[_0x7bee('0x8d')],_0x197800));_0x1ad6ac[_0x7bee('0x19')](_0x7bee('0x98')+_0x10c748+';');}BPromise[_0x7bee('0x94')](_0x1ad6ac,handleQuery)[_0x7bee('0x1a')](function(_0x27f0e9){BPromise[_0x7bee('0x1b')]([handleAdditionalPhones()])[_0x7bee('0x1a')](function(){_0x1ad6ac=[];for(var _0xf45a40=0x0;_0xf45a40\x20\x20','existsSync','file\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','body\x20id\x20mandatory','No\x20agent\x20available','SIGINT','uncaughtException','papaparse','util','bluebird','squel','ioredis','../../../config/environment','../../../config/logger','import','redis','defaults','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','cm_contacts_temp_','YYYYMMDDHHmmss','test','select','phone','join','.id\x20=\x20','where','\x20=\x20','sequelize','query','select\x20*\x20from\x20','length','isNil','push','all','then','error','message','AdditionalPhones','split','filter','findOne','update','updated','CmContactHasItem','create','PHONE','CmHopper','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','priority','UserId','recallme','fields','from','cm_contacts','cm_contacts.ListId\x20=\x20','cm_contacts.createdAt\x20=\x20?','\x22onlyIfOpen\x22','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','toString','insert','fromQuery','updatedAt','.CmListId','.CmListId\x20=\x20?','field','cm_hopper_black','ListId\x20=\x20?','\x20=\x20?','cm_hopper.id','cm_contact_has_items.item','cm_hopper_additional_phones','CmHopperId','OrderBy','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId',')\x20NOT\x20IN\x20?','MIN(id)','min_id','group','info','exit','catch','stringify','send','start','binding','clone','socket_timestamp','root','server/files/tmp','.csv','body','ContactItemType','findAll','name','_description','keys','header','parse','createReadStream','rows','errors','data','find','hasOwnProperty','trim','replace','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','isNumber','agent\x20not\x20exists','email','email\x20wrong\x20format'];(function(_0x1f43a4,_0x479bed){var _0x40c198=function(_0x196113){while(--_0x196113){_0x1f43a4['push'](_0x1f43a4['shift']());}};_0x40c198(++_0x479bed);}(_0xc900,0xb3));var _0x0c90=function(_0x13c45d,_0x22dcee){_0x13c45d=_0x13c45d-0x0;var _0x4a173c=_0xc900[_0x13c45d];return _0x4a173c;};'use strict';var fs=require('fs');var path=require('path');var _=require('lodash');var Papa=require(_0x0c90('0x0'));var util=require(_0x0c90('0x1'));var BPromise=require(_0x0c90('0x2'));var moment=require('moment');var squel=require(_0x0c90('0x3'));var Redis=require(_0x0c90('0x4'));var db=require('../../../mysqldb')['db'];var config=require(_0x0c90('0x5'));var logger=require(_0x0c90('0x6'))(_0x0c90('0x7'));config[_0x0c90('0x8')]=_[_0x0c90('0x9')](config[_0x0c90('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0x0c90('0xa'))(new Redis(config[_0x0c90('0x8')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var promisesContact=[];var orderBy=0x0;var updatedRows=0x0;var stopped=![];var NOW=moment()[_0x0c90('0xb')](_0x0c90('0xc'));var tempTableName=_0x0c90('0xd')+moment()[_0x0c90('0xb')](_0x0c90('0xe'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x18d9fd){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))*$/[_0x0c90('0xf')](_0x18d9fd);}function selectNotIn(_0x34456e,_0x10daeb,_0x467e4c,_0x3c3529,_0x57917b){return squel[_0x0c90('0x10')]()['field'](_0x0c90('0x11'))['from'](_0x3c3529)[_0x0c90('0x12')](_0x10daeb,null,_0x10daeb+_0x0c90('0x13')+_0x3c3529+'.'+_0x467e4c)[_0x0c90('0x14')](_0x3c3529+'.'+_0x467e4c+_0x0c90('0x15')+_0x34456e+'.'+_0x467e4c)[_0x0c90('0x14')](_0x10daeb+'.dialCheckDuplicateType\x20IN\x20('+_0x57917b[_0x0c90('0x12')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x4451e0,_0x4f35f4){promisesAdditionalPhones=[];promisesContact=[];return db[_0x0c90('0x16')][_0x0c90('0x17')](_0x0c90('0x18')+tempTableName)['spread'](function(_0x5daeb7){if(_0x5daeb7!==null){var _0x412635=[];for(var _0x15ca42=0x0;_0x15ca42<_0x5daeb7[_0x0c90('0x19')];_0x15ca42++){var _0x62d429=_0x5daeb7[_0x15ca42];if(!_[_0x0c90('0x1a')](_0x62d429[_0x0c90('0x11')])){if(!_[_0x0c90('0x1a')](_0x62d429['AdditionalPhones']))_0x412635[_0x0c90('0x1b')](insertAdditionalPhones(_0x62d429));promisesContact[_0x0c90('0x1b')]({'contact':_0x62d429});}}}Promise[_0x0c90('0x1c')](_0x412635)[_0x0c90('0x1d')](function(){_0x4451e0({'val':0x1});});})['catch'](function(_0x10a775){logger[_0x0c90('0x1e')](_0x10a775[_0x0c90('0x1f')]);});});}function insertAdditionalPhones(_0x1241a9){return new Promise(function(_0x315932,_0xc08f54){var _0x4cc940=_0x1241a9[_0x0c90('0x20')];if(_['isNil'](_0x4cc940))_0xc08f54({'val':0x0});else{var _0x474293=_0x4cc940[_0x0c90('0x21')](';');var _0x47b13c=[];orderBy=0x0;for(var _0x2a053a=0x0;_0x2a053a<_0x474293[_0x0c90('0x19')];_0x2a053a++){_0x47b13c[_0x0c90('0x1b')](splitAdditionalPhone(_0x1241a9['id'],_0x474293[_0x2a053a]));}Promise[_0x0c90('0x1c')](_0x47b13c)[_0x0c90('0x1d')](function(){_0x315932({'val':_0x474293[_0x0c90('0x19')]});});}});}function splitAdditionalPhone(_0x4dfbc3,_0x26f0a3){return new Promise(function(_0x12f22c,_0x5695a2){var _0x54316b=_0x26f0a3[_0x0c90('0x21')](':');var _0x3ea861=_0x54316b[0x0];var _0x35c243=_0x54316b[0x1];if(_0x35c243!==''){var _0x109a5f=_0x35c243['split']('|');var _0x2dfa14=[];for(var _0x438652=0x0;_0x438652<_0x109a5f[_0x0c90('0x19')];_0x438652++){if(_0x109a5f[_0x438652]!==''){var _0x277d4a=_[_0x0c90('0x22')](promisesAdditionalPhones,{'contactId':_0x4dfbc3,'phone':_0x109a5f[_0x438652]});if(_0x277d4a[_0x0c90('0x19')]==0x0){orderBy++;promisesAdditionalPhones['push']({'contactId':_0x4dfbc3,'contactTypeId':_0x3ea861,'phone':_0x109a5f[_0x438652],'orderBy':orderBy});}}}_0x12f22c({'ok':0x1});}else _0x12f22c({'res':0x0});});}function createAdditionalPhone(_0x15de68,_0x22a47d,_0x39f1b2,_0x13b377){var _0x52d28d='';var _0x4c8603='';var _0x1f27f1=_0x39f1b2[_0x0c90('0x21')]('§');_0x52d28d=_0x1f27f1[0x0];if(_0x1f27f1[_0x0c90('0x19')]==0x2)_0x4c8603=_0x1f27f1[0x1];return new Promise(function(_0x122a4f,_0x119e09){return db['CmContactHasItem'][_0x0c90('0x23')]({'where':{'CmContactId':_0x15de68,'item':_0x52d28d}})[_0x0c90('0x1d')](function(_0x478002){if(_0x478002){return db['CmContactHasItem'][_0x0c90('0x24')]({'ItemTypeId':_0x22a47d,'description':_0x4c8603,'OrderBy':_0x13b377},{'where':{'CmContactId':_0x15de68,'item':_0x52d28d}})['then'](function(_0x54a3f5){_0x122a4f({'res':_0x0c90('0x25')});});}else{return db[_0x0c90('0x26')][_0x0c90('0x27')]({'CmContactId':_0x15de68,'item':_0x52d28d,'ItemTypeId':_0x22a47d,'description':_0x4c8603,'OrderBy':_0x13b377,'ItemClass':_0x0c90('0x28')})['then'](function(_0xc6d2e3){_0x122a4f({'res':'inserted'});});}});});}function updateContact(_0x220803){return new Promise(function(_0x5a0e75,_0x177c95){var _0x30ba54=_0x220803['id'];delete _0x220803['id'];return db['CmContact'][_0x0c90('0x24')](_0x220803,{'where':{'id':_0x30ba54}})[_0x0c90('0x1d')](function(_0x18bc7f){updatedRows+=0x1;return db[_0x0c90('0x29')][_0x0c90('0x24')]({'phone':_0x220803[_0x0c90('0x11')]},{'where':{'ContactId':_0x30ba54}})[_0x0c90('0x1d')](function(_0x92b45){_0x5a0e75({'ret':'OK'});});});});}function insertCmHopper(_0x4bd42e,_0x27be8d,_0x10a712,_0x404f78,_0x3968a3){var _0x4b5382=[_0x0c90('0x2a'),_0x0c90('0x2b'),_0x0c90('0x2c'),_0x0c90('0x2d'),_0x27be8d+'.'+_0x404f78,_0x0c90('0x2e'),_0x0c90('0x2f'),_0x0c90('0x30'),_0x0c90('0x31'),'\x22'+_0x3968a3+'\x22'];return squel['insert']()[_0x0c90('0x32')](_0x0c90('0x33'))['fromQuery']([_0x0c90('0x11'),_0x0c90('0x34'),_0x0c90('0x35'),_0x0c90('0x36'),_0x404f78,_0x0c90('0x37'),'updatedAt',_0x0c90('0x38'),_0x0c90('0x39'),_0x0c90('0x3a')],squel[_0x0c90('0x10')]()[_0x0c90('0x3b')](_0x4b5382)[_0x0c90('0x3c')](_0x27be8d)[_0x0c90('0x12')](_0x0c90('0x3d'),null,_0x0c90('0x3e')+_0x27be8d+'.CmListId')[_0x0c90('0x12')](_0x10a712,null,_0x10a712+'.id\x20=\x20'+_0x27be8d+'.'+_0x404f78)[_0x0c90('0x14')](_0x27be8d+'.CmListId\x20=\x20?',_0x4bd42e)[_0x0c90('0x14')](_0x0c90('0x3f'),NOW)['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x27be8d,_0x10a712,_0x404f78,_0x0c90('0x33'),['\x22always\x22',_0x0c90('0x40')]))[_0x0c90('0x14')](_0x0c90('0x41'),selectNotIn(_0x27be8d,_0x10a712,_0x404f78,'cm_hopper',[_0x0c90('0x42')])))[_0x0c90('0x43')]();}function insertCmHopperBlack(_0x123b58,_0x3e5137,_0x2139c3,_0x1184c4){var _0x565b10=[_0x0c90('0x2a'),_0x0c90('0x2c'),_0x0c90('0x2d'),_0x3e5137+'.'+_0x1184c4,_0x0c90('0x2e'),_0x0c90('0x2f')];return squel[_0x0c90('0x44')]()[_0x0c90('0x32')]('cm_hopper_black')[_0x0c90('0x45')](['phone',_0x0c90('0x35'),_0x0c90('0x36'),_0x1184c4,_0x0c90('0x37'),_0x0c90('0x46')],squel[_0x0c90('0x10')]()[_0x0c90('0x3b')](_0x565b10)[_0x0c90('0x3c')](_0x3e5137)[_0x0c90('0x12')](_0x0c90('0x3d'),null,_0x0c90('0x3e')+_0x3e5137+_0x0c90('0x47'))[_0x0c90('0x12')](_0x2139c3,null,_0x2139c3+_0x0c90('0x13')+_0x3e5137+'.'+_0x1184c4)[_0x0c90('0x14')](_0x3e5137+_0x0c90('0x48'),_0x123b58)['where'](_0x0c90('0x3f'),NOW)[_0x0c90('0x14')](_0x0c90('0x41'),squel[_0x0c90('0x10')]()[_0x0c90('0x49')](_0x0c90('0x11'))[_0x0c90('0x3c')](_0x0c90('0x4a'))[_0x0c90('0x14')](_0x0c90('0x4b'),_0x123b58)[_0x0c90('0x14')](_0x1184c4+_0x0c90('0x4c'),_0x3e5137+'.'+_0x1184c4)))[_0x0c90('0x43')]();}function insertCmHopperAdditionalPhones(_0x229e2f){var _0x595504=[_0x0c90('0x4d'),_0x0c90('0x4e'),'cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt'];return squel[_0x0c90('0x44')]()[_0x0c90('0x32')](_0x0c90('0x4f'))[_0x0c90('0x45')]([_0x0c90('0x50'),'phone',_0x0c90('0x51'),_0x0c90('0x37'),_0x0c90('0x46')],squel['select']()[_0x0c90('0x3b')](_0x595504)[_0x0c90('0x3c')](_0x0c90('0x33'))[_0x0c90('0x12')](_0x0c90('0x3d'),null,_0x0c90('0x52'))[_0x0c90('0x12')](_0x0c90('0x53'),null,_0x0c90('0x54'))[_0x0c90('0x14')]('cm_hopper.ListId\x20=\x20?',_0x229e2f)[_0x0c90('0x14')]('cm_contacts.createdAt\x20=\x20?',NOW))[_0x0c90('0x43')]();}function insertCmContact(_0x67539d,_0x4783e2,_0x21b3ed,_0x22d676){var _0x4520b0=_['concat'](_['keys'](_0x22d676),['ListId','CompanyId',_0x0c90('0x37'),_0x0c90('0x46')]);return squel[_0x0c90('0x44')]()['into'](_0x0c90('0x3d'))[_0x0c90('0x45')](_0x4520b0,squel['select']()[_0x0c90('0x3b')](_0x4520b0)['from'](_0x4783e2)[_0x0c90('0x14')]('('+_0x21b3ed[_0x0c90('0x12')](',')+_0x0c90('0x55'),squel[_0x0c90('0x10')]()['fields'](_0x21b3ed)[_0x0c90('0x3c')]('cm_contacts')[_0x0c90('0x14')](_0x0c90('0x4b'),_0x67539d))['where']('id\x20IN\x20?',squel['select']()[_0x0c90('0x49')](_0x0c90('0x56'),_0x0c90('0x57'))[_0x0c90('0x3c')](_0x4783e2)[_0x0c90('0x58')](_0x21b3ed['join'](','))))[_0x0c90('0x43')]();}function handleStop(){logger[_0x0c90('0x59')]('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x3eb725){logger['error'](_0x3eb725[_0x0c90('0x1f')]);process[_0x0c90('0x5a')](0x1);}function handleError(_0x520df4,_0x22da16){stats['errors']['push']({'name':_0x22da16['code'],'message':_0x22da16[_0x0c90('0x1f')],'row':_0x520df4});}function handleQuery(_0x7428f1){logger[_0x0c90('0x59')](_0x7428f1);return db[_0x0c90('0x16')]['query'](_0x7428f1)['spread'](function(_0x426f65){results[_0x0c90('0x1b')](_0x426f65);})[_0x0c90('0x5b')](function(_0x4c4e5a){logger[_0x0c90('0x1e')](_0x4c4e5a[_0x0c90('0x1f')]);});}function main(_0x8e652,_0x4902d8,_0x4e01c6,_0x37bc0a){logger[_0x0c90('0x59')]('main',_0x8e652,JSON[_0x0c90('0x5c')](_0x4902d8));process[_0x0c90('0x5d')](_0x0c90('0x5e'));var _0x40b34e=_0x4902d8[_0x0c90('0x5f')];var _0x1cf0a6=_[_0x0c90('0x60')](_0x40b34e);var _0x143e0d=_0x4902d8[_0x0c90('0x61')];var _0x558c83=path['join'](config[_0x0c90('0x62')],_0x0c90('0x63'),_0x143e0d+_0x0c90('0x64'));logger[_0x0c90('0x59')](_0x0c90('0x65'),_0x4902d8);db[_0x0c90('0x66')][_0x0c90('0x67')]({'raw':!![],'attributes':['id',_0x0c90('0x68')]})[_0x0c90('0x1d')](function(_0x351ac2){for(var _0x1d9c34=0x0;_0x1d9c34<_0x351ac2[_0x0c90('0x19')];_0x1d9c34++){if(_0x351ac2[_0x1d9c34][_0x0c90('0x68')]in _0x40b34e){contactItemTypes[_0x0c90('0x1b')](_0x351ac2[_0x1d9c34]);delete _0x1cf0a6[_0x351ac2[_0x1d9c34][_0x0c90('0x68')]];hasAdditionalPhones=!![];}for(var _0x50bc24 in _0x40b34e){if(_0x351ac2[_0x1d9c34][_0x0c90('0x68')]+_0x0c90('0x69')===_0x50bc24){phoneDescriptions[_0x0c90('0x1b')]({'itemTypeId':_0x351ac2[_0x1d9c34]['id'],'description':_0x50bc24});delete _0x1cf0a6[_0x50bc24];}}}if(hasAdditionalPhones)_0x1cf0a6['AdditionalPhones']='';var _0x5e8aa8=_[_0x0c90('0x6a')](_0x1cf0a6)['join']();logger[_0x0c90('0x59')](_0x0c90('0x6b'),_0x5e8aa8);fs['writeFileSync'](_0x558c83,_0x5e8aa8+'\x0a');Papa[_0x0c90('0x6c')](fs[_0x0c90('0x6d')](_0x8e652),{'header':!![],'skipEmptyLines':!![],'step':function(_0x25ef97,_0x38e3cf){try{for(var _0x5d8ca7=0x0,_0x5f2628=[];_0x5d8ca7<_0x25ef97['data'][_0x0c90('0x19')];_0x5d8ca7++){stats[_0x0c90('0x6e')]+=0x1;if(_0x25ef97[_0x0c90('0x6f')][_0x5d8ca7]){handleError(_0x25ef97[_0x0c90('0x70')][_0x5d8ca7],_0x25ef97['errors'][_0x5d8ca7]);}else{var _0x16a712=[];var _0x51e699=[];var _0x2d2198={};for(var _0x27e39d in _0x40b34e){let _0x32d6de=contactItemTypes['find'](_0x10f686=>_0x10f686[_0x0c90('0x68')]===_0x27e39d);let _0x2da9f9=contactItemTypes[_0x0c90('0x71')](_0x57c3b3=>_0x57c3b3['name']+_0x0c90('0x69')===_0x27e39d);if(_['isNil'](_0x32d6de)&&_[_0x0c90('0x1a')](_0x2da9f9)){if(_0x40b34e[_0x0c90('0x72')](_0x27e39d)){if(_0x25ef97[_0x0c90('0x70')][_0x5d8ca7][_0x40b34e[_0x27e39d]]){var _0x250d41=_[_0x0c90('0x73')](_0x25ef97[_0x0c90('0x70')][_0x5d8ca7][_0x40b34e[_0x27e39d]][_0x0c90('0x74')](/"/g,'\x27'));switch(_0x27e39d){case _0x0c90('0x34'):var _0x14ff26=moment(_0x250d41,_0x0c90('0xc'),!![]);if(_0x14ff26['isValid']()){_0x5f2628[_0x0c90('0x1b')]('\x22'+_0x250d41+'\x22');}else{_0x16a712[_0x0c90('0x1b')](_0x0c90('0x75'));}break;case _0x0c90('0x38'):var _0x17856c=parseInt(_0x250d41);_0x250d41=_[_0x0c90('0x76')](_0x17856c)||_0x17856c<0x0||_0x17856c>0x4?_0x37bc0a?0x3:0x2:_0x17856c;_0x5f2628[_0x0c90('0x1b')]('\x22'+_0x250d41+'\x22');break;case _0x0c90('0x39'):var _0x4d59e5=parseInt(_0x250d41);if(_[_0x0c90('0x77')](_0x4d59e5)&&_['includes'](_0x4e01c6,_0x4d59e5)){_0x5f2628[_0x0c90('0x1b')]('\x22'+_0x4d59e5+'\x22');}else{_0x16a712[_0x0c90('0x1b')](_0x0c90('0x78'));}break;case _0x0c90('0x79'):if(isEmail(_0x250d41)){_0x5f2628['push']('\x22'+_0x250d41+'\x22');}else{_0x16a712[_0x0c90('0x1b')](_0x0c90('0x7a'));}break;case _0x0c90('0x7b'):var _0x48a32f=moment(_0x250d41,_0x0c90('0x7c'),!![]);if(_0x48a32f[_0x0c90('0x7d')]()){_0x5f2628['push']('\x22'+_0x250d41+'\x22');}else{_0x16a712[_0x0c90('0x1b')]('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;default:_0x5f2628[_0x0c90('0x1b')]('\x22'+_0x250d41+'\x22');}}else{switch(_0x27e39d){case'firstName':case'phone':_0x16a712[_0x0c90('0x1b')](_0x27e39d+_0x0c90('0x7e'));break;default:_0x5f2628['push']('\x22\x22');}}}}else{var _0x47aa29='';if(!_[_0x0c90('0x1a')](_0x32d6de)){if(!_0x2d2198[_0x0c90('0x72')](_0x32d6de['id'])){for(var _0x5d80b9=0x0;_0x5d80b9<_0x40b34e[_0x27e39d]['length'];_0x5d80b9++){var _0x250d41=_['trim'](_0x25ef97[_0x0c90('0x70')][_0x5d8ca7][_0x40b34e[_0x27e39d][_0x5d80b9]][_0x0c90('0x74')](/"/g,'\x27'));var _0x1228b0=phoneDescriptions[_0x0c90('0x71')](_0x1aa42e=>_0x1aa42e['itemTypeId']===_0x32d6de['id']);if(!_[_0x0c90('0x1a')](_0x1228b0)){var _0x142268=_[_0x0c90('0x73')](_0x25ef97['data'][_0x5d8ca7][_0x40b34e[_0x1228b0['description']][0x0]][_0x0c90('0x74')](/"/g,'\x27'));if(!_[_0x0c90('0x1a')](_0x142268))_0x250d41=_0x250d41+'§'+_0x142268;}if(_0x47aa29=='')_0x47aa29=_0x250d41;else _0x47aa29+='|'+_0x250d41;}_0x51e699[_0x0c90('0x1b')](_0x32d6de['id']+':'+_0x47aa29);_0x2d2198[_0x32d6de['id']]=0x1;}}}}if(hasAdditionalPhones){_0x5f2628['push']('\x22'+_0x51e699['join'](';')+'\x22');}if(_0x16a712['length']){handleError(_0x25ef97[_0x0c90('0x70')][_0x5d8ca7],{'code':'SystemRow','message':_0x16a712['join']()});}else{fs['appendFileSync'](_0x558c83,_0x5f2628['join']()+'\x0a');}_0x5f2628=[];}if(!(stats[_0x0c90('0x6e')]%0xc8)){socket[_0x0c90('0x7f')](_0x0c90('0x80')+_0x143e0d,stats);stats[_0x0c90('0x6f')]=[];}}if(stopped){logger[_0x0c90('0x59')]('Abort\x20parser');_0x38e3cf['abort']();}}catch(_0x57eab8){handleError(_0x25ef97[_0x0c90('0x70')][_0x5d8ca7],{'code':_0x0c90('0x81'),'message':_0x57eab8[_0x0c90('0x1f')]});logger[_0x0c90('0x1e')](_0x0c90('0x82'),_0x57eab8[_0x0c90('0x1f')]);}},'complete':function(){try{var _0x544e94=[];var _0xccc215=tempTableName;_0x544e94[_0x0c90('0x1b')](_0x0c90('0x83')+_0xccc215+_0x0c90('0x84'));logger[_0x0c90('0x59')](_0x0c90('0x85'),contactItemTypes[_0x0c90('0x19')]);var _0xa1a116=util[_0x0c90('0xb')](_0x0c90('0x86'),_0x558c83,_0xccc215,_0x5e8aa8,_0x4902d8[_0x0c90('0x36')],_0x4902d8[_0x0c90('0x87')]||null,NOW,NOW);if(_['isNil'](_0x40b34e[_0x0c90('0x34')])){_0xa1a116+=',\x20scheduledAt\x20=\x20NOW()';}_0x544e94[_0x0c90('0x1b')](_0xa1a116);BPromise['each'](_0x544e94,handleQuery)[_0x0c90('0x1d')](function(_0x1f1ee2){BPromise[_0x0c90('0x1c')]([handleAdditionalPhones()])[_0x0c90('0x1d')](function(){_0x544e94=[];for(var _0x4d26be=0x0;_0x4d26be_0x1629e6[_0x2b0d('0x6a')]===_0x145cc6);let _0x54fd59=contactItemTypes[_0x2b0d('0x71')](_0x52d036=>_0x52d036[_0x2b0d('0x6a')]+'_description'===_0x145cc6);if(_[_0x2b0d('0x1c')](_0x4ca34a)&&_[_0x2b0d('0x1c')](_0x54fd59)){if(_0x3d5ccf['hasOwnProperty'](_0x145cc6)){if(_0x4e2355[_0x2b0d('0x6f')][_0x4a487c][_0x3d5ccf[_0x145cc6]]){var _0x4b5bbb=_['trim'](_0x4e2355[_0x2b0d('0x6f')][_0x4a487c][_0x3d5ccf[_0x145cc6]][_0x2b0d('0x72')](/"/g,'\x27'));switch(_0x145cc6){case _0x2b0d('0x35'):var _0x4c346d=moment(_0x4b5bbb,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0x4c346d[_0x2b0d('0x73')]()){_0x25f37b['push']('\x22'+_0x4b5bbb+'\x22');}else{_0x156ad6[_0x2b0d('0x1e')](_0x2b0d('0x74'));}break;case _0x2b0d('0x38'):var _0xc02719=parseInt(_0x4b5bbb);_0x4b5bbb=_['isNaN'](_0xc02719)||_0xc02719<0x0||_0xc02719>0x4?_0x2ed82a?0x3:0x2:_0xc02719;_0x25f37b[_0x2b0d('0x1e')]('\x22'+_0x4b5bbb+'\x22');break;case'UserId':var _0x339805=parseInt(_0x4b5bbb);if(_[_0x2b0d('0x75')](_0x339805)&&_[_0x2b0d('0x76')](_0x25fd98,_0x339805)){_0x25f37b[_0x2b0d('0x1e')]('\x22'+_0x339805+'\x22');}else{_0x156ad6[_0x2b0d('0x1e')](_0x2b0d('0x77'));}break;case _0x2b0d('0x78'):if(isEmail(_0x4b5bbb)){_0x25f37b[_0x2b0d('0x1e')]('\x22'+_0x4b5bbb+'\x22');}else{_0x156ad6[_0x2b0d('0x1e')](_0x2b0d('0x79'));}break;case _0x2b0d('0x7a'):var _0x11a06d=moment(_0x4b5bbb,'YYYY-MM-DD',!![]);if(_0x11a06d['isValid']()){_0x25f37b[_0x2b0d('0x1e')]('\x22'+_0x4b5bbb+'\x22');}else{_0x156ad6[_0x2b0d('0x1e')](_0x2b0d('0x7b'));}break;default:_0x25f37b['push']('\x22'+_0x4b5bbb+'\x22');}}else{switch(_0x145cc6){case _0x2b0d('0x7c'):case _0x2b0d('0x12'):_0x156ad6['push'](_0x145cc6+_0x2b0d('0x7d'));break;default:_0x25f37b['push']('\x22\x22');}}}}else{var _0x4d10a3='';if(!_[_0x2b0d('0x1c')](_0x4ca34a)){if(!_0x29e9f6[_0x2b0d('0x7e')](_0x4ca34a['id'])){for(var _0x2aba75=0x0;_0x2aba75<_0x3d5ccf[_0x145cc6]['length'];_0x2aba75++){var _0x4b5bbb=_[_0x2b0d('0x7f')](_0x4e2355[_0x2b0d('0x6f')][_0x4a487c][_0x3d5ccf[_0x145cc6][_0x2aba75]][_0x2b0d('0x72')](/"/g,'\x27'));var _0x364c93=phoneDescriptions[_0x2b0d('0x71')](_0xec90b0=>_0xec90b0[_0x2b0d('0x80')]===_0x4ca34a['id']);if(!_[_0x2b0d('0x1c')](_0x364c93)){var _0x57f1e2=_[_0x2b0d('0x7f')](_0x4e2355[_0x2b0d('0x6f')][_0x4a487c][_0x3d5ccf[_0x364c93['description']][0x0]][_0x2b0d('0x72')](/"/g,'\x27'));if(!_[_0x2b0d('0x1c')](_0x57f1e2))_0x4b5bbb=_0x4b5bbb+'§'+_0x57f1e2;}if(_0x4d10a3=='')_0x4d10a3=_0x4b5bbb;else _0x4d10a3+='|'+_0x4b5bbb;}_0x1ab2af[_0x2b0d('0x1e')](_0x4ca34a['id']+':'+_0x4d10a3);_0x29e9f6[_0x4ca34a['id']]=0x1;}}}}if(hasAdditionalPhones){_0x25f37b[_0x2b0d('0x1e')]('\x22'+_0x1ab2af[_0x2b0d('0x14')](';')+'\x22');}if(_0x156ad6[_0x2b0d('0x1b')]){handleError(_0x4e2355[_0x2b0d('0x6f')][_0x4a487c],{'code':_0x2b0d('0x81'),'message':_0x156ad6[_0x2b0d('0x14')]()});}else{fs[_0x2b0d('0x82')](_0x2067c8,_0x25f37b[_0x2b0d('0x14')]()+'\x0a');}_0x25f37b=[];}if(!(stats[_0x2b0d('0x70')]%0xc8)){socket[_0x2b0d('0x83')](_0x2b0d('0x84')+_0x174f92,stats);stats[_0x2b0d('0x5f')]=[];}}if(stopped){logger[_0x2b0d('0x5c')](_0x2b0d('0x85'));_0x4e5870[_0x2b0d('0x86')]();}}catch(_0x1762c7){handleError(_0x4e2355[_0x2b0d('0x6f')][_0x4a487c],{'code':_0x2b0d('0x87'),'message':_0x1762c7['message']});logger[_0x2b0d('0x20')](_0x2b0d('0x88'),_0x1762c7[_0x2b0d('0x21')]);}},'complete':function(){try{var _0x110ebb=[];var _0x6b02c1=tempTableName;_0x110ebb[_0x2b0d('0x1e')](_0x2b0d('0x89')+_0x6b02c1+_0x2b0d('0x8a'));logger[_0x2b0d('0x5c')](_0x2b0d('0x8b'),contactItemTypes[_0x2b0d('0x1b')]);var _0x4ed78e=util[_0x2b0d('0xd')](_0x2b0d('0x8c'),_0x2067c8,_0x6b02c1,_0xed2bc2,_0x91a241['ListId'],_0x91a241[_0x2b0d('0x58')]||null,NOW,NOW);if(_[_0x2b0d('0x1c')](_0x3d5ccf[_0x2b0d('0x35')])){_0x4ed78e+=_0x2b0d('0x8d');}_0x110ebb[_0x2b0d('0x1e')](_0x4ed78e);BPromise[_0x2b0d('0x8e')](_0x110ebb,handleQuery)['then'](function(_0x32ab55){BPromise[_0x2b0d('0x23')]([handleAdditionalPhones()])['then'](function(){_0x110ebb=[];for(var _0x3f1a52=0x0;_0x3f1a52\x20\x20');}var _0x2fe315=path[_0x2b0d('0x14')](config[_0x2b0d('0x67')],_0x2b0d('0x68'),process[_0x2b0d('0x97')][0x2]);if(!fs[_0x2b0d('0x98')](_0x2fe315)){throw new Error('file\x20doesn\x27t\x20exists');}var _0x45e4e3={};try{_0x45e4e3=JSON[_0x2b0d('0x99')](process['argv'][0x3]);if(!_0x45e4e3[_0x2b0d('0x65')]){throw new Error(_0x2b0d('0x9a'));}var _0x38a3d1=0x0;if(_0x45e4e3[_0x2b0d('0x65')]['UserId']){_0x38a3d1=0x1;}if(!_0x45e4e3[_0x2b0d('0x47')]){throw new Error(_0x2b0d('0x9b'));}}catch(_0x13418f){throw new Error('body\x20id\x20mandatory');}var _0x2deae7=[];try{_0x2deae7=_[_0x2b0d('0x9c')](JSON['parse'](process[_0x2b0d('0x97')][0x4]),'id');}catch(_0x177280){logger[_0x2b0d('0x5c')](_0x2b0d('0x9d'));}main(_0x2fe315,_0x45e4e3,_0x2deae7,_0x38a3d1);}validate();process['on']('SIGINT',handleStop);process['on']('uncaughtException',handleUncaughtException); \ No newline at end of file diff --git a/server/components/integrations/configuration.js b/server/components/integrations/configuration.js index 5ae0a80..8f9b6f6 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 _0x96ff=['destcalleridnum','getDescriptions','***\x20Call\x20Info\x20***','keyValue','Caller\x20Number','Caller\x20Name','calleridname','Call\x20To','destexten','Queue','UniqueId','uniqueid','***\x20Agent\x20Info\x20***','Agent\x20Number','***\x20Time\x20Info\x20***','Agent\x20Ring','agentcalledAt','Agent\x20Connect','agentconnectAt','Agent\x20Complete','agentcompleteAt','Hold\x20Time','holdtime','Talk\x20Time','talktime','Called\x20Number','Member\x20Name','Date','Answer\x20Time','answertime','Complete\x20Time','endtime','duration','billableseconds','getSubjects','[xCALLY\x20Ticket]','toLowerCase','voice','push','variable','calleridnum','outbound','string','Outbound\x20Call'];(function(_0x52aa1d,_0x2c150f){var _0x8024f8=function(_0x12adb8){while(--_0x12adb8){_0x52aa1d['push'](_0x52aa1d['shift']());}};_0x8024f8(++_0x2c150f);}(_0x96ff,0x7a));var _0xf96f=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x96ff[_0x4b369d];return _0x571a98;};'use strict';exports[_0xf96f('0x0')]=function(_0x36c580,_0x161505){var _0xf7e1c0=[{'type':'string','content':_0xf96f('0x1'),'variableName':null}];switch(_0x36c580[_0xf96f('0x2')]()){case _0xf96f('0x3'):switch(_0x161505['toLowerCase']()){case'inbound':_0xf7e1c0[_0xf96f('0x4')]({'type':_0xf96f('0x5'),'content':'','variableName':'queue'});_0xf7e1c0[_0xf96f('0x4')]({'type':'variable','content':'','variableName':_0xf96f('0x6')});break;case _0xf96f('0x7'):_0xf7e1c0[_0xf96f('0x4')]({'type':_0xf96f('0x8'),'content':_0xf96f('0x9'),'variableName':null});_0xf7e1c0['push']({'type':_0xf96f('0x5'),'content':'','variableName':_0xf96f('0xa')});break;}}return _0xf7e1c0;};exports[_0xf96f('0xb')]=function(_0x43bc7d,_0x20d7ef){var _0x27efdd=[];switch(_0x43bc7d[_0xf96f('0x2')]()){case _0xf96f('0x3'):switch(_0x20d7ef[_0xf96f('0x2')]()){case'inbound':_0x27efdd=[{'type':_0xf96f('0x8'),'content':_0xf96f('0xc'),'key':null,'keyType':null,'variableName':null},{'type':_0xf96f('0xd'),'content':'','key':_0xf96f('0xe'),'keyType':_0xf96f('0x5'),'variableName':_0xf96f('0x6')},{'type':_0xf96f('0xd'),'content':'','key':_0xf96f('0xf'),'keyType':_0xf96f('0x5'),'variableName':_0xf96f('0x10')},{'type':_0xf96f('0xd'),'content':'','key':_0xf96f('0x11'),'keyType':_0xf96f('0x5'),'variableName':_0xf96f('0x12')},{'type':_0xf96f('0xd'),'content':'','key':_0xf96f('0x13'),'keyType':_0xf96f('0x5'),'variableName':'queue'},{'type':'keyValue','content':'','key':_0xf96f('0x14'),'keyType':_0xf96f('0x5'),'variableName':_0xf96f('0x15')},{'type':_0xf96f('0xd'),'content':'','key':'Date','keyType':_0xf96f('0x5'),'variableName':'agentcalledAt'},{'type':'string','content':_0xf96f('0x16'),'key':null,'keyType':null,'variableName':null},{'type':_0xf96f('0xd'),'content':'','key':'Agent\x20Name','keyType':'variable','variableName':'destcalleridname'},{'type':_0xf96f('0xd'),'content':'','key':_0xf96f('0x17'),'keyType':_0xf96f('0x5'),'variableName':'destcalleridnum'},{'type':_0xf96f('0x8'),'content':_0xf96f('0x18'),'key':null,'keyType':null,'variableName':null},{'type':_0xf96f('0xd'),'content':'','key':_0xf96f('0x19'),'keyType':_0xf96f('0x5'),'variableName':_0xf96f('0x1a')},{'type':_0xf96f('0xd'),'content':'','key':_0xf96f('0x1b'),'keyType':'variable','variableName':_0xf96f('0x1c')},{'type':_0xf96f('0xd'),'content':'','key':_0xf96f('0x1d'),'keyType':'variable','variableName':_0xf96f('0x1e')},{'type':_0xf96f('0xd'),'content':'','key':_0xf96f('0x1f'),'keyType':_0xf96f('0x5'),'variableName':_0xf96f('0x20')},{'type':'keyValue','content':'','key':_0xf96f('0x21'),'keyType':_0xf96f('0x5'),'variableName':_0xf96f('0x22')}];break;case'outbound':_0x27efdd=[{'type':_0xf96f('0x8'),'content':_0xf96f('0xc'),'variableName':null},{'type':_0xf96f('0xd'),'content':'','key':_0xf96f('0x23'),'keyType':_0xf96f('0x5'),'keyContent':'','variableName':_0xf96f('0xa')},{'type':_0xf96f('0xd'),'content':'','key':_0xf96f('0x24'),'keyType':_0xf96f('0x5'),'keyContent':'','variableName':'membername'},{'type':_0xf96f('0xd'),'content':'','key':_0xf96f('0x14'),'keyType':_0xf96f('0x5'),'keyContent':'','variableName':'uniqueid'},{'type':'keyValue','content':'','key':_0xf96f('0x25'),'keyType':_0xf96f('0x5'),'keyContent':'','variableName':'starttime'},{'type':_0xf96f('0x8'),'content':_0xf96f('0x18')},{'type':_0xf96f('0xd'),'content':'','key':_0xf96f('0x26'),'keyType':_0xf96f('0x5'),'keyContent':'','variableName':_0xf96f('0x27')},{'type':_0xf96f('0xd'),'content':'','key':_0xf96f('0x28'),'keyType':_0xf96f('0x5'),'keyContent':'','variableName':_0xf96f('0x29')},{'type':'keyValue','content':'','key':'Duration','keyType':_0xf96f('0x5'),'keyContent':'','variableName':_0xf96f('0x2a')},{'type':_0xf96f('0xd'),'content':'','key':'Billable\x20Time','keyType':_0xf96f('0x5'),'keyContent':'','variableName':_0xf96f('0x2b')}];break;}}return _0x27efdd;}; \ No newline at end of file +var _0xe63d=['Member\x20Name','membername','Date','starttime','Answer\x20Time','answertime','endtime','duration','Billable\x20Time','billableseconds','getSubjects','[xCALLY\x20Ticket]','toLowerCase','voice','inbound','push','calleridnum','outbound','string','Outbound\x20Call','variable','getDescriptions','Caller\x20Number','keyValue','calleridname','Call\x20To','destexten','Queue','queue','agentcalledAt','***\x20Agent\x20Info\x20***','Agent\x20Name','Agent\x20Number','destcalleridnum','***\x20Time\x20Info\x20***','Agent\x20Ring','agentcompleteAt','Hold\x20Time','holdtime','Talk\x20Time','***\x20Call\x20Info\x20***','Called\x20Number'];(function(_0x249033,_0x3a1b9b){var _0x34ea3f=function(_0x4c507d){while(--_0x4c507d){_0x249033['push'](_0x249033['shift']());}};_0x34ea3f(++_0x3a1b9b);}(_0xe63d,0x106));var _0xde63=function(_0x387c2e,_0x1bc867){_0x387c2e=_0x387c2e-0x0;var _0x8987e1=_0xe63d[_0x387c2e];return _0x8987e1;};'use strict';exports[_0xde63('0x0')]=function(_0x2d14b1,_0x12a3d9){var _0x3deca1=[{'type':'string','content':_0xde63('0x1'),'variableName':null}];switch(_0x2d14b1[_0xde63('0x2')]()){case _0xde63('0x3'):switch(_0x12a3d9[_0xde63('0x2')]()){case _0xde63('0x4'):_0x3deca1[_0xde63('0x5')]({'type':'variable','content':'','variableName':'queue'});_0x3deca1[_0xde63('0x5')]({'type':'variable','content':'','variableName':_0xde63('0x6')});break;case _0xde63('0x7'):_0x3deca1[_0xde63('0x5')]({'type':_0xde63('0x8'),'content':_0xde63('0x9'),'variableName':null});_0x3deca1[_0xde63('0x5')]({'type':_0xde63('0xa'),'content':'','variableName':'destcalleridnum'});break;}}return _0x3deca1;};exports[_0xde63('0xb')]=function(_0x2b08fc,_0x5f2336){var _0x3604cf=[];switch(_0x2b08fc[_0xde63('0x2')]()){case _0xde63('0x3'):switch(_0x5f2336[_0xde63('0x2')]()){case _0xde63('0x4'):_0x3604cf=[{'type':_0xde63('0x8'),'content':'***\x20Call\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':_0xde63('0xc'),'keyType':_0xde63('0xa'),'variableName':_0xde63('0x6')},{'type':_0xde63('0xd'),'content':'','key':'Caller\x20Name','keyType':_0xde63('0xa'),'variableName':_0xde63('0xe')},{'type':'keyValue','content':'','key':_0xde63('0xf'),'keyType':_0xde63('0xa'),'variableName':_0xde63('0x10')},{'type':_0xde63('0xd'),'content':'','key':_0xde63('0x11'),'keyType':'variable','variableName':_0xde63('0x12')},{'type':'keyValue','content':'','key':'UniqueId','keyType':_0xde63('0xa'),'variableName':'uniqueid'},{'type':'keyValue','content':'','key':'Date','keyType':_0xde63('0xa'),'variableName':_0xde63('0x13')},{'type':'string','content':_0xde63('0x14'),'key':null,'keyType':null,'variableName':null},{'type':_0xde63('0xd'),'content':'','key':_0xde63('0x15'),'keyType':'variable','variableName':'destcalleridname'},{'type':'keyValue','content':'','key':_0xde63('0x16'),'keyType':_0xde63('0xa'),'variableName':_0xde63('0x17')},{'type':_0xde63('0x8'),'content':_0xde63('0x18'),'key':null,'keyType':null,'variableName':null},{'type':_0xde63('0xd'),'content':'','key':_0xde63('0x19'),'keyType':'variable','variableName':_0xde63('0x13')},{'type':'keyValue','content':'','key':'Agent\x20Connect','keyType':'variable','variableName':'agentconnectAt'},{'type':'keyValue','content':'','key':'Agent\x20Complete','keyType':_0xde63('0xa'),'variableName':_0xde63('0x1a')},{'type':_0xde63('0xd'),'content':'','key':_0xde63('0x1b'),'keyType':_0xde63('0xa'),'variableName':_0xde63('0x1c')},{'type':_0xde63('0xd'),'content':'','key':_0xde63('0x1d'),'keyType':_0xde63('0xa'),'variableName':'talktime'}];break;case'outbound':_0x3604cf=[{'type':_0xde63('0x8'),'content':_0xde63('0x1e'),'variableName':null},{'type':_0xde63('0xd'),'content':'','key':_0xde63('0x1f'),'keyType':_0xde63('0xa'),'keyContent':'','variableName':_0xde63('0x17')},{'type':_0xde63('0xd'),'content':'','key':_0xde63('0x20'),'keyType':_0xde63('0xa'),'keyContent':'','variableName':_0xde63('0x21')},{'type':_0xde63('0xd'),'content':'','key':'UniqueId','keyType':_0xde63('0xa'),'keyContent':'','variableName':'uniqueid'},{'type':_0xde63('0xd'),'content':'','key':_0xde63('0x22'),'keyType':_0xde63('0xa'),'keyContent':'','variableName':_0xde63('0x23')},{'type':_0xde63('0x8'),'content':_0xde63('0x18')},{'type':_0xde63('0xd'),'content':'','key':_0xde63('0x24'),'keyType':_0xde63('0xa'),'keyContent':'','variableName':_0xde63('0x25')},{'type':_0xde63('0xd'),'content':'','key':'Complete\x20Time','keyType':_0xde63('0xa'),'keyContent':'','variableName':_0xde63('0x26')},{'type':_0xde63('0xd'),'content':'','key':'Duration','keyType':_0xde63('0xa'),'keyContent':'','variableName':_0xde63('0x27')},{'type':'keyValue','content':'','key':_0xde63('0x28'),'keyType':_0xde63('0xa'),'keyContent':'','variableName':_0xde63('0x29')}];break;}}return _0x3604cf;}; \ No newline at end of file diff --git a/server/components/interaction/service.js b/server/components/interaction/service.js index 71c0d63..3d9a695 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 _0x5171=['omit','phone','fax','mobile','updateUser','lodash','./sql-utils','./utils','findAll','skipInteractionsQuery','resolve','getInteractionsQuery','then','search','parseQueryParameters','where','body','contact','default','fields','user','having','tags','checkAccountsRestrictions','group','i.id','ids','tag','countFilteredInteractions','count','length','clause','order','forEach','contactName','DESC','closed','getFilteredInteractions','rows','catch','tracked','query','clone'];(function(_0x4041ef,_0x2e36ff){var _0x37f0a9=function(_0x41f2ae){while(--_0x41f2ae){_0x4041ef['push'](_0x4041ef['shift']());}};_0x37f0a9(++_0x2e36ff);}(_0x5171,0x15d));var _0x1517=function(_0x16bb4b,_0x5fe431){_0x16bb4b=_0x16bb4b-0x0;var _0x8aeb84=_0x5171[_0x16bb4b];return _0x8aeb84;};'use strict';var _=require(_0x1517('0x0'));var sqlUtils=require(_0x1517('0x1'));var utils=require(_0x1517('0x2'));exports[_0x1517('0x3')]=function(_0x1a4e77,_0x4bcc6c,_0x26c7f8,_0x1a107c,_0x11c686){var _0x39a688={'count':0x0,'rows':[]};var _0x4a215c=sqlUtils[_0x1517('0x4')](_0x1a4e77,_0x26c7f8,_0x4bcc6c);if(_0x4a215c){return Promise[_0x1517('0x5')](_0x39a688);}var _0x2d722a=sqlUtils[_0x1517('0x6')](_0x1a4e77);var _0x561b8f={};return Promise[_0x1517('0x5')]()[_0x1517('0x7')](function(){if(_0x4bcc6c[_0x1517('0x8')]){return sqlUtils['parseAdvancedSearchFilter'](_0x4bcc6c[_0x1517('0x8')],_0x11c686);}else{return sqlUtils[_0x1517('0x9')](_0x1a4e77,_0x4bcc6c,_0x11c686);}})[_0x1517('0x7')](function(_0x4300b8){_0x2d722a[_0x1517('0xa')](_0x4300b8[_0x1517('0xb')]);_0x2d722a[_0x1517('0xa')](_0x4300b8[_0x1517('0xc')]);_0x2d722a[_0x1517('0xa')](_0x4300b8[_0x1517('0xd')]);_0x2d722a['where'](_0x4300b8[_0x1517('0xe')]);_0x2d722a[_0x1517('0xa')](_0x4300b8['filter']);_0x2d722a[_0x1517('0xa')](_0x4300b8[_0x1517('0xf')]);_0x2d722a[_0x1517('0x10')](_0x4300b8['read']);_0x561b8f=_0x4300b8[_0x1517('0x11')];return sqlUtils[_0x1517('0x12')](_0x1a4e77,_0x26c7f8,_0x4bcc6c);})[_0x1517('0x7')](function(_0x236d06){_0x2d722a[_0x1517('0xa')](_0x236d06);_0x2d722a[_0x1517('0x13')](_0x1517('0x14'));var _0x11c273=_0x4bcc6c[_0x1517('0x8')]?_0x561b8f[_0x1517('0x15')]:_0x4bcc6c[_0x1517('0x16')];return sqlUtils[_0x1517('0x17')](_0x2d722a,_0x11c273);})['then'](function(_0x4950ab){_0x39a688[_0x1517('0x18')]=_0x4950ab[_0x1517('0x19')];if(_0x39a688['count']===0x0){return[];}_0x2d722a[_0x1517('0x10')](_0x561b8f[_0x1517('0x1a')]);if(_0x1a107c[_0x1517('0x1b')]){_0x1a107c[_0x1517('0x1b')][_0x1517('0x1c')](function(_0x55f6c2){var _0x44294f=_0x55f6c2[0x0]===_0x1517('0x1d')?_0x55f6c2[0x0]:'i.'+_0x55f6c2[0x0];_0x2d722a['order'](_0x44294f,_0x55f6c2[0x1]===_0x1517('0x1e')?![]:!![]);if(_0x55f6c2[0x0]===_0x1517('0x1f')){var _0x1419d3=sqlUtils['getClosedOrderClause'](_0x1a4e77,_0x4bcc6c);_0x2d722a['order'](_0x1419d3,_0x55f6c2[0x1]===_0x1517('0x1e')?![]:!![]);}});}return sqlUtils[_0x1517('0x20')](_0x1a4e77,_0x2d722a,_0x4bcc6c,_0x1a107c);})[_0x1517('0x7')](function(_0x16084b){_0x39a688[_0x1517('0x21')]=_0x16084b;return _0x39a688;})[_0x1517('0x22')](function(_0x4a3860){throw _0x4a3860;});};exports[_0x1517('0x23')]=function(_0x18a8b1,_0x44d177){return function(_0xff180c,_0xdeb4f0,_0xf51340){var _0x4c83dc=_0xff180c[_0x1517('0xf')];var _0x1f09d3={};var _0x55f13d=_0xff180c[_0x1517('0x24')];if(_0x1f09d3){_0x1f09d3=_[_0x1517('0x25')](_0xff180c[_0x1517('0xb')]);_0x1f09d3=_[_0x1517('0x26')](_0x1f09d3,[_0x1517('0xb'),'html',_0x1517('0x27'),_0x1517('0x28'),_0x1517('0x29')]);}utils[_0x1517('0x2a')](_0x4c83dc,_0x1f09d3,_0x55f13d,_0x18a8b1,_0x44d177);_0xf51340(null);};}; \ No newline at end of file +var _0x7c50=['mobile','updateUser','lodash','./sql-utils','./utils','findAll','skipInteractionsQuery','resolve','getInteractionsQuery','then','search','parseAdvancedSearchFilter','parseQueryParameters','body','contact','default','where','fields','filter','user','tags','checkAccountsRestrictions','i.id','tag','countFilteredInteractions','count','length','clause','order','contactName','DESC','closed','getFilteredInteractions','rows','catch','tracked','clone','omit','html'];(function(_0x28386c,_0x10f7ce){var _0x49b105=function(_0x4a5049){while(--_0x4a5049){_0x28386c['push'](_0x28386c['shift']());}};_0x49b105(++_0x10f7ce);}(_0x7c50,0x113));var _0x07c5=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0x7c50[_0x4243a3];return _0x1b2a33;};'use strict';var _=require(_0x07c5('0x0'));var sqlUtils=require(_0x07c5('0x1'));var utils=require(_0x07c5('0x2'));exports[_0x07c5('0x3')]=function(_0x3e604d,_0x359e94,_0x55c192,_0x4b2eef,_0x4f623c){var _0xf62197={'count':0x0,'rows':[]};var _0x52be64=sqlUtils[_0x07c5('0x4')](_0x3e604d,_0x55c192,_0x359e94);if(_0x52be64){return Promise[_0x07c5('0x5')](_0xf62197);}var _0x55217a=sqlUtils[_0x07c5('0x6')](_0x3e604d);var _0x166f16={};return Promise['resolve']()[_0x07c5('0x7')](function(){if(_0x359e94[_0x07c5('0x8')]){return sqlUtils[_0x07c5('0x9')](_0x359e94[_0x07c5('0x8')],_0x4f623c);}else{return sqlUtils[_0x07c5('0xa')](_0x3e604d,_0x359e94,_0x4f623c);}})[_0x07c5('0x7')](function(_0x5b273f){_0x55217a['where'](_0x5b273f[_0x07c5('0xb')]);_0x55217a['where'](_0x5b273f[_0x07c5('0xc')]);_0x55217a['where'](_0x5b273f[_0x07c5('0xd')]);_0x55217a[_0x07c5('0xe')](_0x5b273f[_0x07c5('0xf')]);_0x55217a[_0x07c5('0xe')](_0x5b273f[_0x07c5('0x10')]);_0x55217a[_0x07c5('0xe')](_0x5b273f[_0x07c5('0x11')]);_0x55217a['having'](_0x5b273f['read']);_0x166f16=_0x5b273f[_0x07c5('0x12')];return sqlUtils[_0x07c5('0x13')](_0x3e604d,_0x55c192,_0x359e94);})[_0x07c5('0x7')](function(_0x27b934){_0x55217a[_0x07c5('0xe')](_0x27b934);_0x55217a['group'](_0x07c5('0x14'));var _0x591e2e=_0x359e94[_0x07c5('0x8')]?_0x166f16['ids']:_0x359e94[_0x07c5('0x15')];return sqlUtils[_0x07c5('0x16')](_0x55217a,_0x591e2e);})['then'](function(_0x16b6b2){_0xf62197[_0x07c5('0x17')]=_0x16b6b2[_0x07c5('0x18')];if(_0xf62197[_0x07c5('0x17')]===0x0){return[];}_0x55217a['having'](_0x166f16[_0x07c5('0x19')]);if(_0x4b2eef[_0x07c5('0x1a')]){_0x4b2eef['order']['forEach'](function(_0x58deed){var _0xe312ad=_0x58deed[0x0]===_0x07c5('0x1b')?_0x58deed[0x0]:'i.'+_0x58deed[0x0];_0x55217a[_0x07c5('0x1a')](_0xe312ad,_0x58deed[0x1]===_0x07c5('0x1c')?![]:!![]);if(_0x58deed[0x0]===_0x07c5('0x1d')){var _0x21beb9=sqlUtils['getClosedOrderClause'](_0x3e604d,_0x359e94);_0x55217a[_0x07c5('0x1a')](_0x21beb9,_0x58deed[0x1]==='DESC'?![]:!![]);}});}return sqlUtils[_0x07c5('0x1e')](_0x3e604d,_0x55217a,_0x359e94,_0x4b2eef);})[_0x07c5('0x7')](function(_0x2331f8){_0xf62197[_0x07c5('0x1f')]=_0x2331f8;return _0xf62197;})[_0x07c5('0x20')](function(_0x37bbe6){throw _0x37bbe6;});};exports[_0x07c5('0x21')]=function(_0x3adc8b,_0xea33ea){return function(_0x3db777,_0x20301f,_0x5c2a77){var _0x292cff=_0x3db777[_0x07c5('0x11')];var _0x303b08={};var _0xa5282d=_0x3db777['query'];if(_0x303b08){_0x303b08=_[_0x07c5('0x22')](_0x3db777[_0x07c5('0xb')]);_0x303b08=_[_0x07c5('0x23')](_0x303b08,[_0x07c5('0xb'),_0x07c5('0x24'),'phone','fax',_0x07c5('0x25')]);}utils[_0x07c5('0x26')](_0x292cff,_0x303b08,_0xa5282d,_0x3adc8b,_0xea33ea);_0x5c2a77(null);};}; \ No newline at end of file diff --git a/server/components/interaction/sql-utils.js b/server/components/interaction/sql-utils.js index 9539f59..247d769 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 _0x1038=['get','Websites','Accounts','resolve','role','i.thirdDisposition','i.secondDisposition','i.disposition','i.substatus','closed','shift','CONCAT_WS(\x27\x27,\x20','Interaction','Sequelize','QueryTypes','sequelize','query','toString','keyBy','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','a.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.lastMsgAt','i.lastMsgDirection','i.ContactId','i.MailAccountId','i.UserId','openchannel','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','Contact.firstName','c.lastName','Contact.lastName','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','limit','offset','groupBy','Setting','enableEmailPreview','all','COUNT(*)','t.id\x20IN\x20?','lodash','../parsers/advancedSearch','../parsers/qs','./update-interaction','updateInteraction','./utils','../../mysqldb','getAccountFK','search','select','field','name','color','from','user_has_','u.id','left_join','users','u.id\x20=\x20ui.UserId','length','where','ui.','\x20IN\x20?','map','getInteractionFK','interactions','cm_contacts','o.id\x20=\x20i.UserId','a.id\x20=\x20i.','messages','me.','\x20=\x20i.id','interactionsTags','tools_tags','t.id\x20=\x20it.TagId','expr','getSelectedTags','unreadMessages\x20{OPERATOR}\x200','replace','{OPERATOR}','isNumeric','i.id\x20LIKE\x20?','sms','includes','i.phone\x20LIKE\x20?','i.from\x20LIKE\x20?','mail','isEmail','c.email\x20LIKE\x20?','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','fax','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','find','type','text','value','start','unreadMessages','read','Contact','operator','split','contact','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','end','Tag','tags','clause','and','User','$substring','user','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','buildExpression','body','plainBody','some','compact','forEach','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','then','fields','tag','filter'];(function(_0x224f65,_0x4750bf){var _0x3f921c=function(_0x1b5f64){while(--_0x1b5f64){_0x224f65['push'](_0x224f65['shift']());}};_0x3f921c(++_0x4750bf);}(_0x1038,0x17d));var _0x8103=function(_0x2ae2ad,_0xac5b0c){_0x2ae2ad=_0x2ae2ad-0x0;var _0x26dbd7=_0x1038[_0x2ae2ad];return _0x26dbd7;};'use strict';var _=require(_0x8103('0x0'));var squel=require('squel');var as=require(_0x8103('0x1'));var qs=require(_0x8103('0x2'));var updateInteraction=require(_0x8103('0x3'))[_0x8103('0x4')];var utils=require(_0x8103('0x5'));var db=require(_0x8103('0x6'))['db'];function skipInteractionsQuery(_0x1a0734,_0x220391,_0x1a5cc0){var _0x4518ad=![];var _0x58e099=utils[_0x8103('0x7')](_0x1a0734);if(_0x220391['role']==='agent'&&!_0x1a5cc0[_0x8103('0x8')]&&!_0x1a5cc0[_0x58e099]){_0x4518ad=!![];}return _0x4518ad;}function getTagsQuery(){return squel[_0x8103('0x9')]()[_0x8103('0xa')]('id')[_0x8103('0xa')](_0x8103('0xb'))[_0x8103('0xa')](_0x8103('0xc'))[_0x8103('0xd')]('tools_tags');}function getUsersQuery(_0x23c5a9,_0xac7594){var _0x168ba6=utils['getInteractionFK'](_0x23c5a9);var _0x3d4d76=_0x8103('0xe')+_0x23c5a9+'_interactions';var _0x37fffd=squel[_0x8103('0x9')]()[_0x8103('0xa')](_0x8103('0xf'))[_0x8103('0xa')]('u.fullname')[_0x8103('0xa')]('ui.'+_0x168ba6)[_0x8103('0xd')](_0x3d4d76,'ui')[_0x8103('0x10')](_0x8103('0x11'),'u',_0x8103('0x12'));if(_0xac7594[_0x8103('0x13')]>0x0){_0x37fffd[_0x8103('0x14')](_0x8103('0x15')+_0x168ba6+_0x8103('0x16'),_[_0x8103('0x17')](_0xac7594,'id'));}return _0x37fffd;}function getInteractionsQuery(_0x4373fe){var _0x7a1de=utils['getInteractionsTables'](_0x4373fe);var _0x439ea0=utils[_0x8103('0x7')](_0x4373fe);var _0x537040=utils[_0x8103('0x18')](_0x4373fe);return squel[_0x8103('0x9')]()[_0x8103('0xd')](_0x7a1de[_0x8103('0x19')],'i')['left_join'](_0x8103('0x1a'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x8103('0x10')](_0x8103('0x11'),'o',_0x8103('0x1b'))['left_join'](_0x7a1de['accounts'],'a',_0x8103('0x1c')+_0x439ea0)[_0x8103('0x10')](_0x7a1de[_0x8103('0x1d')],'me',_0x8103('0x1e')+_0x537040+_0x8103('0x1f'))[_0x8103('0x10')](_0x7a1de[_0x8103('0x20')],'it','it.'+_0x537040+'\x20=\x20i.id')[_0x8103('0x10')](_0x8103('0x21'),'t',_0x8103('0x22'));}function getSqlClauses(){var _0x2401af={'body':squel[_0x8103('0x23')](),'contact':squel[_0x8103('0x23')](),'default':squel['expr'](),'fields':squel[_0x8103('0x23')](),'filter':squel[_0x8103('0x23')](),'read':squel[_0x8103('0x23')](),'tags':{'clause':squel[_0x8103('0x23')](),'ids':null},'user':squel['expr']()};return _0x2401af;}function parseTagParameter(_0x57d694){var _0x473143=squel[_0x8103('0x23')]();if(_0x57d694){var _0x3b7ae5=utils[_0x8103('0x24')](_0x57d694);_0x3b7ae5['forEach'](function(_0x9c3b9b){_0x473143['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x9c3b9b+',%');});}return _0x473143;}function parseReadParameter(_0x765de){var _0x2a5c81='';if(_0x765de){_0x2a5c81=_0x8103('0x25');if(_0x765de==='1'){_0x2a5c81=_0x2a5c81[_0x8103('0x26')]('{OPERATOR}','=');}else{_0x2a5c81=_0x2a5c81[_0x8103('0x26')](_0x8103('0x27'),'>');}}return _0x2a5c81;}function parseSearchFilter(_0x53114d,_0x5680b6){var _0x578987=squel['expr']();if(_0x5680b6){var _0x47b764=_0x5680b6[_0x8103('0x26')]('\x5c','\x5c\x5c')[_0x8103('0x26')](/'/g,'\x27\x27');if(qs[_0x8103('0x28')](_0x47b764)){_0x578987['or'](_0x8103('0x29'),_0x47b764+'%');if([_0x8103('0x2a'),'whatsapp'][_0x8103('0x2b')](_0x53114d)){_0x578987['or'](_0x8103('0x2c'),_0x47b764+'%');}else if(_0x53114d==='fax'){_0x578987['or']('i.fax\x20LIKE\x20?',_0x47b764+'%');}else if(_0x53114d==='openchannel'){_0x578987['or'](_0x8103('0x2d'),_0x47b764+'%');}}else if(_0x53114d===_0x8103('0x2e')&&qs[_0x8103('0x2f')](_0x47b764)){_0x578987['or'](_0x8103('0x30'),_0x47b764+'%');}else{if(_0x53114d===_0x8103('0x2e')){_0x578987['or'](_0x8103('0x31'),qs[_0x8103('0x32')](_0x47b764,!![]))['or']('MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x8103('0x32')](_0x47b764));}else if(_0x53114d!==_0x8103('0x33')){_0x578987['or'](_0x8103('0x34'),qs[_0x8103('0x32')](_0x47b764));}_0x578987['or'](_0x8103('0x35'),qs[_0x8103('0x32')](_0x47b764,!![]),null);}}return _0x578987;}function parseAdvancedSearchFilter(_0x1eb196,_0x44e5d7){var _0x3198a8=getSqlClauses();var _0x5946ad=as[_0x8103('0x36')](_0x1eb196);var _0xda083f=_0x5946ad[_0x8103('0x37')];for(var _0xfd8eed=0x0;_0xfd8eed<_0x5946ad[_0x8103('0x38')][_0x8103('0x13')];_0xfd8eed++){var _0x10eb91=_0x5946ad['conditions'][_0xfd8eed];var _0x42f3e5='i';var _0x59d96a=_[_0x8103('0x39')](_0x44e5d7,[_0x8103('0xb'),_0x10eb91['field']]);if(_0x59d96a){var _0x262c17=as['buildExpression'](_0x42f3e5,_0x59d96a[_0x8103('0x3a')],_0x10eb91);_0x3198a8['default'][_0xda083f](_0x262c17[_0x8103('0x3b')],_0x262c17[_0x8103('0x3c')][_0x8103('0x3d')],_0x262c17[_0x8103('0x3c')]['end']);}else{switch(_0x10eb91[_0x8103('0xa')]){case _0x8103('0x3e'):var _0x1cefa3=parseReadParameter(_0x10eb91[_0x8103('0x3c')]);_0x3198a8[_0x8103('0x3f')]['and'](_0x1cefa3);break;case _0x8103('0x40'):if(_0x10eb91[_0x8103('0x41')]==='$substring'){if(_0x10eb91[_0x8103('0x3c')][_0x8103('0x42')]('\x20')[_0x8103('0x13')]>0x1){_0x3198a8[_0x8103('0x43')][_0xda083f](_0x8103('0x35'),qs[_0x8103('0x32')](_0x10eb91['value'],!![]),null);}else{var _0x3053ba='%'+_0x10eb91[_0x8103('0x3c')]+'%';_0x3198a8[_0x8103('0x43')][_0xda083f](_0x8103('0x44'),_0x3053ba,_0x3053ba,_0x3053ba);}}else{_0x59d96a=_[_0x8103('0x39')](_0x44e5d7,[_0x8103('0xb'),_0x8103('0x45')]);_0x10eb91[_0x8103('0xa')]=_0x8103('0x45');_0x262c17=as['buildExpression'](_0x42f3e5,_0x59d96a[_0x8103('0x3a')],_0x10eb91);_0x3198a8[_0x8103('0x43')][_0xda083f](_0x262c17[_0x8103('0x3b')],_0x262c17[_0x8103('0x3c')][_0x8103('0x3d')],_0x262c17[_0x8103('0x3c')][_0x8103('0x46')]);}break;case _0x8103('0x47'):var _0x57d015=_0x10eb91[_0x8103('0x3c')]['split'](',')[_0x8103('0x17')](function(_0x731302){return Number(_0x731302);});var _0xfde245=parseTagParameter(_0x57d015);_0x3198a8[_0x8103('0x48')][_0x8103('0x49')][_0x8103('0x4a')](_0xfde245);_0x3198a8[_0x8103('0x48')]['ids']=_0x57d015;break;case _0x8103('0x4b'):if(_0x10eb91[_0x8103('0x41')]===_0x8103('0x4c')){_0x3198a8[_0x8103('0x4d')][_0xda083f](_0x8103('0x4e'),'%'+_0x10eb91[_0x8103('0x3c')]+'%',null);}else{_0x59d96a=_[_0x8103('0x39')](_0x44e5d7,[_0x8103('0xb'),_0x8103('0x4f')]);_0x10eb91[_0x8103('0xa')]=_0x8103('0x4f');_0x262c17=as[_0x8103('0x50')](_0x42f3e5,_0x59d96a[_0x8103('0x3a')],_0x10eb91);_0x3198a8['user'][_0xda083f](_0x262c17[_0x8103('0x3b')],_0x262c17[_0x8103('0x3c')][_0x8103('0x3d')],_0x262c17[_0x8103('0x3c')]['end']);}break;case _0x8103('0x51'):case _0x8103('0x52'):_0x262c17=as[_0x8103('0x50')]('me',null,_0x10eb91);_0x3198a8[_0x8103('0x51')][_0xda083f](_0x262c17[_0x8103('0x3b')],_0x262c17[_0x8103('0x3c')]['start'],_0x262c17['value'][_0x8103('0x46')]);break;}}}return _0x3198a8;}function parseModelFields(_0x5af476,_0x3e6564,_0x476726){var _0x521414=utils[_0x8103('0x7')](_0x5af476);var _0x11f40c=squel[_0x8103('0x23')]();var _0x142603=_(_0x3e6564)['keys']()[_0x8103('0x17')](function(_0x337d4f){return _[_0x8103('0x53')](_0x476726,[_0x8103('0xb'),_0x337d4f])?_0x337d4f:undefined;})[_0x8103('0x54')]()[_0x8103('0x3c')]();if(_0x142603[_0x8103('0x13')]>0x0){_0x142603[_0x8103('0x55')](function(_0x40a1e7){if(_0x40a1e7===_0x521414){_0x11f40c[_0x8103('0x4a')]('i.'+_0x521414+_0x8103('0x16'),[]['concat'](_0x3e6564[_0x40a1e7]));}else if(_0x40a1e7==='createdAt'){var _0x1a6969=JSON[_0x8103('0x56')](_0x3e6564[_0x40a1e7])[_0x8103('0x57')];var _0x5c424b=JSON['parse'](_0x3e6564[_0x40a1e7])[_0x8103('0x58')];_0x11f40c[_0x8103('0x4a')](_0x8103('0x59'),_0x1a6969,_0x5c424b);}else{if(_0x3e6564[_0x40a1e7]===_0x8103('0x5a')){_0x11f40c[_0x8103('0x4a')]('i.'+_0x40a1e7+_0x8103('0x5b'));}else{_0x11f40c[_0x8103('0x4a')]('i.'+_0x40a1e7+'\x20=\x20?',_0x3e6564[_0x40a1e7]);}}});}return _0x11f40c;}function parseQueryParameters(_0x4aa227,_0x456029,_0x381fe8){var _0x20d314=getSqlClauses();return Promise['resolve']()[_0x8103('0x5c')](function(){return parseModelFields(_0x4aa227,_0x456029,_0x381fe8);})[_0x8103('0x5c')](function(_0x2b767b){_0x20d314[_0x8103('0x5d')][_0x8103('0x4a')](_0x2b767b);return parseReadParameter(_0x456029[_0x8103('0x3f')]);})['then'](function(_0x494c9c){_0x20d314[_0x8103('0x3f')]['and'](_0x494c9c);return parseTagParameter(_0x456029[_0x8103('0x5e')]);})[_0x8103('0x5c')](function(_0x16ec79){_0x20d314[_0x8103('0x48')]['clause'][_0x8103('0x4a')](_0x16ec79);return parseSearchFilter(_0x4aa227,_0x456029[_0x8103('0x5f')]);})[_0x8103('0x5c')](function(_0x396f59){_0x20d314[_0x8103('0x5f')]=_0x396f59;return _0x20d314;});}function checkAccountsRestrictions(_0x190000,_0x175e61,_0x25ccd6){var _0x53ea33=utils[_0x8103('0x7')](_0x190000);var _0x2bc4a3=_0x8103('0x60')+_['capitalize'](_0x190000)+(_0x190000==='chat'?_0x8103('0x61'):_0x8103('0x62'));var _0x1f5aed=squel[_0x8103('0x23')]();return Promise[_0x8103('0x63')]()[_0x8103('0x5c')](function(){if(_0x25ccd6[_0x8103('0x8')]&&_0x175e61[_0x8103('0x64')]==='agent'){return _0x175e61[_0x2bc4a3]({'attributes':['id'],'raw':!![]});}})['then'](function(_0x5bde6a){if(_0x5bde6a){if(_0x5bde6a[_0x8103('0x13')]===0x0){_0x1f5aed[_0x8103('0x4a')]('i.'+_0x53ea33+_0x8103('0x5b'));}else{_0x1f5aed[_0x8103('0x4a')]('i.'+_0x53ea33+_0x8103('0x16'),_[_0x8103('0x17')](_0x5bde6a,'id'));}}else if(!_0x25ccd6[_0x53ea33]){_0x1f5aed['and']('i.'+_0x53ea33+'\x20IS\x20NOT\x20NULL');}})[_0x8103('0x5c')](function(){return _0x1f5aed;});}function getClosedOrderClause(_0x3dafa9,_0x8de173){var _0x3c05d8='';var _0x250a68=[_0x8103('0x65'),_0x8103('0x66'),_0x8103('0x67')];if(_0x3dafa9==='mail'){_0x250a68['unshift'](_0x8103('0x68'));}if(_0x8de173[_0x8103('0x69')]==='0'&&_0x3dafa9===_0x8103('0x2e')){_0x3c05d8='i.substatus';}else{if(_0x8de173[_0x8103('0x69')]==='1'){_0x250a68[_0x8103('0x6a')]();}_0x3c05d8=_0x8103('0x6b')+_0x250a68['join'](',\x20')+')';}return _0x3c05d8;}function getFilteredInteractions(_0x14ece5,_0x29b678,_0x9179dd,_0xf10cd4){var _0x4c5bc4=utils[_0x8103('0x18')](_0x14ece5);var _0x171909=_['capitalize'](_0x14ece5)+_0x8103('0x6c');var _0x189149=[];var _0x38d5d0=getTagsQuery();var _0x55fbd5={'type':db[_0x8103('0x6d')][_0x8103('0x6e')]['SELECT'],'raw':!![]};var _0x564356=[];var _0x41cbc4=[];return db[_0x8103('0x6f')][_0x8103('0x70')](_0x38d5d0[_0x8103('0x71')](),_0x55fbd5)[_0x8103('0x5c')](function(_0x4f0202){_0x189149=_[_0x8103('0x72')](_0x4f0202,'id');_0x55fbd5=_[_0x8103('0x73')](_0x55fbd5,{'model':db[_0x171909],'mapToModel':!![],'nest':!![]});if(_0x9179dd[_0x8103('0x5d')]){_0xf10cd4['attributes'][_0x8103('0x55')](function(_0x5b6553){_0x29b678[_0x8103('0xa')]('i.'+_0x5b6553);});}else{_0x29b678[_0x8103('0xa')](_0x8103('0x74'),_0x8103('0x3e'));_0x29b678[_0x8103('0xa')](_0x8103('0x75'),_0x8103('0x76'));_0x29b678[_0x8103('0xa')](_0x8103('0x77'),'Account.mandatoryDisposition');if(_0x14ece5===_0x8103('0x2e')){_0x29b678[_0x8103('0xa')](_0x8103('0x78'),_0x8103('0x79'));_0x29b678[_0x8103('0xa')](_0x8103('0x7a'),'contactName');_0x29b678[_0x8103('0xa')]('i.id');_0x29b678[_0x8103('0xa')](_0x8103('0x7b'));_0x29b678[_0x8103('0xa')](_0x8103('0x7c'));_0x29b678[_0x8103('0xa')](_0x8103('0x7d'));_0x29b678[_0x8103('0xa')](_0x8103('0x7e'));_0x29b678[_0x8103('0xa')](_0x8103('0x7f'));_0x29b678[_0x8103('0xa')](_0x8103('0x80'));_0x29b678[_0x8103('0xa')](_0x8103('0x81'));_0x29b678[_0x8103('0xa')]('i.subject');_0x29b678['field'](_0x8103('0x67'));_0x29b678[_0x8103('0xa')](_0x8103('0x66'));_0x29b678[_0x8103('0xa')](_0x8103('0x65'));_0x29b678['field'](_0x8103('0x68'));_0x29b678['field']('i.to');_0x29b678['field'](_0x8103('0x82'));_0x29b678[_0x8103('0xa')](_0x8103('0x83'));_0x29b678['field'](_0x8103('0x84'));}else if(_0x14ece5===_0x8103('0x85')){_0x29b678[_0x8103('0xa')](_0x8103('0x86'),'contactName');}else{_0x29b678[_0x8103('0xa')](_0x8103('0x87'),_0x8103('0x88'));}if(_0x14ece5!=='mail'){_0x29b678[_0x8103('0xa')]('i.*');}_0x29b678[_0x8103('0xa')]('c.firstName',_0x8103('0x89'));_0x29b678[_0x8103('0xa')](_0x8103('0x8a'),_0x8103('0x8b'));_0x29b678[_0x8103('0xa')]('c.email',_0x8103('0x8c'));_0x29b678['field'](_0x8103('0x8d'),_0x8103('0x8e'));_0x29b678[_0x8103('0xa')](_0x8103('0x8f'),_0x8103('0x90'));_0x29b678[_0x8103('0xa')](_0x8103('0x91'),_0x8103('0x92'));_0x29b678[_0x8103('0xa')](_0x8103('0x93'),_0x8103('0x94'));_0x29b678[_0x8103('0xa')]('o.internal','Owner.internal');_0x29b678['field'](_0x8103('0x95'),_0x8103('0x96'));}if(_0xf10cd4[_0x8103('0x97')]){_0x29b678[_0x8103('0x97')](_0xf10cd4[_0x8103('0x97')]);}if(_0xf10cd4[_0x8103('0x98')]){_0x29b678[_0x8103('0x98')](_0xf10cd4[_0x8103('0x98')]);}return db[_0x8103('0x6f')]['query'](_0x29b678['toString'](),_0x55fbd5);})[_0x8103('0x5c')](function(_0x163398){_0x564356=_0x163398;var _0x4513fd=getUsersQuery(_0x14ece5,_0x564356);return db[_0x8103('0x6f')][_0x8103('0x70')](_0x4513fd[_0x8103('0x71')](),_0x55fbd5);})['then'](function(_0x2f82d3){_0x41cbc4=_[_0x8103('0x99')](_0x2f82d3,_0x4c5bc4);if(_0x14ece5===_0x8103('0x2e')){return db[_0x8103('0x9a')]['findOne']({'attributes':[_0x8103('0x9b')],'raw':!![]});}})['then'](function(_0x4e4104){var _0xa96781=_0x4e4104?_0x4e4104[_0x8103('0x9b')]:undefined;var _0x30b0f2=_0x564356[_0x8103('0x17')](function(_0x3f8526){return updateInteraction(_0x3f8526,_0x189149,_0x41cbc4,_0xa96781);});return Promise[_0x8103('0x9c')](_0x30b0f2);});}function countFilteredInteractions(_0x59b719,_0x5a3fa0){var _0x4af776=_0x59b719['clone']();_0x4af776[_0x8103('0xa')](_0x8103('0x9d'));_0x4af776['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x8103('0x3e'));var _0x2d7bce=utils[_0x8103('0x24')](_0x5a3fa0);if(!_['isEmpty'](_0x2d7bce)){_0x4af776[_0x8103('0x14')](_0x8103('0x9e'),_0x2d7bce);}var _0x1b679c={'type':db[_0x8103('0x6d')][_0x8103('0x6e')]['SELECT'],'raw':!![]};return db[_0x8103('0x6f')][_0x8103('0x70')](_0x4af776[_0x8103('0x71')](),_0x1b679c);}module['exports']={'checkAccountsRestrictions':checkAccountsRestrictions,'countFilteredInteractions':countFilteredInteractions,'getClosedOrderClause':getClosedOrderClause,'getFilteredInteractions':getFilteredInteractions,'getInteractionsQuery':getInteractionsQuery,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipInteractionsQuery':skipInteractionsQuery}; \ No newline at end of file +var _0x054e=['Accounts','\x20IS\x20NOT\x20NULL','i.secondDisposition','i.disposition','closed','i.substatus','shift','CONCAT_WS(\x27\x27,\x20','join','Sequelize','QueryTypes','sequelize','toString','keyBy','attributes','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','a.mandatoryDisposition','Account.mandatoryDisposition','a.email','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20CONCAT(\x27%\x27,\x20a.email,\x20\x27%\x27)\x20THEN\x20TRIM(SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201))\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.createdAt','i.updatedAt','i.closed','i.closedAt','i.attach','i.lastMsgAt','i.lastMsgDirection','i.thirdDisposition','i.to','i.ContactId','i.MailAccountId','i.UserId','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.internal','TagIds','limit','offset','query','groupBy','findOne','enableEmailPreview','getSelectedTags','isEmpty','t.id\x20IN\x20?','SELECT','exports','lodash','squel','../parsers/advancedSearch','./update-interaction','./utils','role','agent','select','field','name','color','from','getInteractionFK','_interactions','u.id','left_join','users','u.id\x20=\x20ui.UserId','where','ui.','\x20IN\x20?','getInteractionsTables','getAccountFK','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','a.id\x20=\x20i.','messages','me.','\x20=\x20i.id','interactionsTags','tools_tags','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','i.phone\x20LIKE\x20?','fax','i.fax\x20LIKE\x20?','openchannel','i.from\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','mail','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','parseSearch','sqlOperator','length','conditions','find','type','text','value','start','unreadMessages','read','and','Contact','split','contact','ContactId','buildExpression','end','Tag','tags','ids','User','operator','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','user','body','plainBody','keys','compact','concat','createdAt','$gte','parse','$lte','null','\x20IS\x20NULL','\x20=\x20?','resolve','then','fields','tag','clause','filter','capitalize','chat','Websites'];(function(_0x3a9a6a,_0x51afcd){var _0xc860c8=function(_0x4578b6){while(--_0x4578b6){_0x3a9a6a['push'](_0x3a9a6a['shift']());}};_0xc860c8(++_0x51afcd);}(_0x054e,0xde));var _0xe054=function(_0x4c7b20,_0x361515){_0x4c7b20=_0x4c7b20-0x0;var _0x4872bd=_0x054e[_0x4c7b20];return _0x4872bd;};'use strict';var _=require(_0xe054('0x0'));var squel=require(_0xe054('0x1'));var as=require(_0xe054('0x2'));var qs=require('../parsers/qs');var updateInteraction=require(_0xe054('0x3'))['updateInteraction'];var utils=require(_0xe054('0x4'));var db=require('../../mysqldb')['db'];function skipInteractionsQuery(_0x2ddd1e,_0x2c0da5,_0x305a34){var _0x2fbb3d=![];var _0x3c53f2=utils['getAccountFK'](_0x2ddd1e);if(_0x2c0da5[_0xe054('0x5')]===_0xe054('0x6')&&!_0x305a34['search']&&!_0x305a34[_0x3c53f2]){_0x2fbb3d=!![];}return _0x2fbb3d;}function getTagsQuery(){return squel[_0xe054('0x7')]()[_0xe054('0x8')]('id')[_0xe054('0x8')](_0xe054('0x9'))[_0xe054('0x8')](_0xe054('0xa'))[_0xe054('0xb')]('tools_tags');}function getUsersQuery(_0x564e1e,_0x42ad33){var _0x4e3467=utils[_0xe054('0xc')](_0x564e1e);var _0x258f7d='user_has_'+_0x564e1e+_0xe054('0xd');var _0x447928=squel[_0xe054('0x7')]()[_0xe054('0x8')](_0xe054('0xe'))[_0xe054('0x8')]('u.fullname')[_0xe054('0x8')]('ui.'+_0x4e3467)['from'](_0x258f7d,'ui')[_0xe054('0xf')](_0xe054('0x10'),'u',_0xe054('0x11'));if(_0x42ad33['length']>0x0){_0x447928[_0xe054('0x12')](_0xe054('0x13')+_0x4e3467+_0xe054('0x14'),_['map'](_0x42ad33,'id'));}return _0x447928;}function getInteractionsQuery(_0x293e54){var _0x2a0357=utils[_0xe054('0x15')](_0x293e54);var _0xe2b755=utils[_0xe054('0x16')](_0x293e54);var _0x50ab3e=utils['getInteractionFK'](_0x293e54);return squel[_0xe054('0x7')]()[_0xe054('0xb')](_0x2a0357['interactions'],'i')[_0xe054('0xf')](_0xe054('0x17'),'c',_0xe054('0x18'))[_0xe054('0xf')](_0xe054('0x10'),'o',_0xe054('0x19'))[_0xe054('0xf')](_0x2a0357['accounts'],'a',_0xe054('0x1a')+_0xe2b755)[_0xe054('0xf')](_0x2a0357[_0xe054('0x1b')],'me',_0xe054('0x1c')+_0x50ab3e+_0xe054('0x1d'))[_0xe054('0xf')](_0x2a0357[_0xe054('0x1e')],'it','it.'+_0x50ab3e+_0xe054('0x1d'))[_0xe054('0xf')](_0xe054('0x1f'),'t',_0xe054('0x20'));}function getSqlClauses(){var _0x40f24c={'body':squel[_0xe054('0x21')](),'contact':squel['expr'](),'default':squel['expr'](),'fields':squel[_0xe054('0x21')](),'filter':squel[_0xe054('0x21')](),'read':squel[_0xe054('0x21')](),'tags':{'clause':squel[_0xe054('0x21')](),'ids':null},'user':squel[_0xe054('0x21')]()};return _0x40f24c;}function parseTagParameter(_0x493811){var _0x438f42=squel[_0xe054('0x21')]();if(_0x493811){var _0x444e33=utils['getSelectedTags'](_0x493811);_0x444e33[_0xe054('0x22')](function(_0x403c94){_0x438f42['or'](_0xe054('0x23'),'%,'+_0x403c94+',%');});}return _0x438f42;}function parseReadParameter(_0x534247){var _0x49e5d7='';if(_0x534247){_0x49e5d7=_0xe054('0x24');if(_0x534247==='1'){_0x49e5d7=_0x49e5d7[_0xe054('0x25')](_0xe054('0x26'),'=');}else{_0x49e5d7=_0x49e5d7['replace'](_0xe054('0x26'),'>');}}return _0x49e5d7;}function parseSearchFilter(_0x1cc66e,_0x1b8c1a){var _0x1e17f4=squel[_0xe054('0x21')]();if(_0x1b8c1a){var _0x2b60e5=_0x1b8c1a[_0xe054('0x25')]('\x5c','\x5c\x5c')[_0xe054('0x25')](/'/g,'\x27\x27');if(qs[_0xe054('0x27')](_0x2b60e5)){_0x1e17f4['or'](_0xe054('0x28'),_0x2b60e5+'%');if([_0xe054('0x29'),'whatsapp']['includes'](_0x1cc66e)){_0x1e17f4['or'](_0xe054('0x2a'),_0x2b60e5+'%');}else if(_0x1cc66e===_0xe054('0x2b')){_0x1e17f4['or'](_0xe054('0x2c'),_0x2b60e5+'%');}else if(_0x1cc66e===_0xe054('0x2d')){_0x1e17f4['or'](_0xe054('0x2e'),_0x2b60e5+'%');}}else if(_0x1cc66e==='mail'&&qs[_0xe054('0x2f')](_0x2b60e5)){_0x1e17f4['or'](_0xe054('0x30'),_0x2b60e5+'%');}else{if(_0x1cc66e===_0xe054('0x31')){_0x1e17f4['or'](_0xe054('0x32'),qs['getFullTextValue'](_0x2b60e5,!![]))['or'](_0xe054('0x33'),qs[_0xe054('0x34')](_0x2b60e5));}else if(_0x1cc66e!==_0xe054('0x2b')){_0x1e17f4['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xe054('0x34')](_0x2b60e5));}_0x1e17f4['or'](_0xe054('0x35'),qs[_0xe054('0x34')](_0x2b60e5,!![]),null);}}return _0x1e17f4;}function parseAdvancedSearchFilter(_0x1c99ff,_0x204f51){var _0xff1c28=getSqlClauses();var _0xbb4d98=as[_0xe054('0x36')](_0x1c99ff);var _0x27ca16=_0xbb4d98[_0xe054('0x37')];for(var _0x46f1f9=0x0;_0x46f1f9<_0xbb4d98['conditions'][_0xe054('0x38')];_0x46f1f9++){var _0x40e9f3=_0xbb4d98[_0xe054('0x39')][_0x46f1f9];var _0x2dba49='i';var _0x3ddbfc=_[_0xe054('0x3a')](_0x204f51,[_0xe054('0x9'),_0x40e9f3['field']]);if(_0x3ddbfc){var _0x3f2e2e=as['buildExpression'](_0x2dba49,_0x3ddbfc[_0xe054('0x3b')],_0x40e9f3);_0xff1c28['default'][_0x27ca16](_0x3f2e2e[_0xe054('0x3c')],_0x3f2e2e[_0xe054('0x3d')][_0xe054('0x3e')],_0x3f2e2e['value']['end']);}else{switch(_0x40e9f3[_0xe054('0x8')]){case _0xe054('0x3f'):var _0x149adb=parseReadParameter(_0x40e9f3[_0xe054('0x3d')]);_0xff1c28[_0xe054('0x40')][_0xe054('0x41')](_0x149adb);break;case _0xe054('0x42'):if(_0x40e9f3['operator']==='$substring'){if(_0x40e9f3['value'][_0xe054('0x43')]('\x20')[_0xe054('0x38')]>0x1){_0xff1c28[_0xe054('0x44')][_0x27ca16]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xe054('0x34')](_0x40e9f3[_0xe054('0x3d')],!![]),null);}else{var _0x1e6065='%'+_0x40e9f3[_0xe054('0x3d')]+'%';_0xff1c28[_0xe054('0x44')][_0x27ca16]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x1e6065,_0x1e6065,_0x1e6065);}}else{_0x3ddbfc=_[_0xe054('0x3a')](_0x204f51,[_0xe054('0x9'),_0xe054('0x45')]);_0x40e9f3[_0xe054('0x8')]=_0xe054('0x45');_0x3f2e2e=as[_0xe054('0x46')](_0x2dba49,_0x3ddbfc[_0xe054('0x3b')],_0x40e9f3);_0xff1c28['contact'][_0x27ca16](_0x3f2e2e[_0xe054('0x3c')],_0x3f2e2e['value'][_0xe054('0x3e')],_0x3f2e2e[_0xe054('0x3d')][_0xe054('0x47')]);}break;case _0xe054('0x48'):var _0x2e647f=_0x40e9f3['value'][_0xe054('0x43')](',')['map'](function(_0x16ee5a){return Number(_0x16ee5a);});var _0x2b51cc=parseTagParameter(_0x2e647f);_0xff1c28['tags']['clause'][_0xe054('0x41')](_0x2b51cc);_0xff1c28[_0xe054('0x49')][_0xe054('0x4a')]=_0x2e647f;break;case _0xe054('0x4b'):if(_0x40e9f3[_0xe054('0x4c')]===_0xe054('0x4d')){_0xff1c28['user'][_0x27ca16](_0xe054('0x4e'),'%'+_0x40e9f3[_0xe054('0x3d')]+'%',null);}else{_0x3ddbfc=_[_0xe054('0x3a')](_0x204f51,[_0xe054('0x9'),_0xe054('0x4f')]);_0x40e9f3[_0xe054('0x8')]=_0xe054('0x4f');_0x3f2e2e=as[_0xe054('0x46')](_0x2dba49,_0x3ddbfc[_0xe054('0x3b')],_0x40e9f3);_0xff1c28[_0xe054('0x50')][_0x27ca16](_0x3f2e2e['text'],_0x3f2e2e[_0xe054('0x3d')]['start'],_0x3f2e2e[_0xe054('0x3d')][_0xe054('0x47')]);}break;case _0xe054('0x51'):case _0xe054('0x52'):_0x3f2e2e=as['buildExpression']('me',null,_0x40e9f3);_0xff1c28[_0xe054('0x51')][_0x27ca16](_0x3f2e2e[_0xe054('0x3c')],_0x3f2e2e['value'][_0xe054('0x3e')],_0x3f2e2e[_0xe054('0x3d')][_0xe054('0x47')]);break;}}}return _0xff1c28;}function parseModelFields(_0xed4513,_0x319870,_0x15271d){var _0x33c344=utils[_0xe054('0x16')](_0xed4513);var _0x3932a4=squel['expr']();var _0x4fef83=_(_0x319870)[_0xe054('0x53')]()['map'](function(_0x52c04b){return _['some'](_0x15271d,[_0xe054('0x9'),_0x52c04b])?_0x52c04b:undefined;})[_0xe054('0x54')]()[_0xe054('0x3d')]();if(_0x4fef83[_0xe054('0x38')]>0x0){_0x4fef83[_0xe054('0x22')](function(_0xb970b2){if(_0xb970b2===_0x33c344){_0x3932a4[_0xe054('0x41')]('i.'+_0x33c344+_0xe054('0x14'),[][_0xe054('0x55')](_0x319870[_0xb970b2]));}else if(_0xb970b2===_0xe054('0x56')){var _0x3d51ea=JSON['parse'](_0x319870[_0xb970b2])[_0xe054('0x57')];var _0x21ec54=JSON[_0xe054('0x58')](_0x319870[_0xb970b2])[_0xe054('0x59')];_0x3932a4['and']('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x3d51ea,_0x21ec54);}else{if(_0x319870[_0xb970b2]===_0xe054('0x5a')){_0x3932a4[_0xe054('0x41')]('i.'+_0xb970b2+_0xe054('0x5b'));}else{_0x3932a4['and']('i.'+_0xb970b2+_0xe054('0x5c'),_0x319870[_0xb970b2]);}}});}return _0x3932a4;}function parseQueryParameters(_0x523406,_0x268c1,_0x1e795b){var _0x39042e=getSqlClauses();return Promise[_0xe054('0x5d')]()[_0xe054('0x5e')](function(){return parseModelFields(_0x523406,_0x268c1,_0x1e795b);})[_0xe054('0x5e')](function(_0x5103d5){_0x39042e[_0xe054('0x5f')][_0xe054('0x41')](_0x5103d5);return parseReadParameter(_0x268c1[_0xe054('0x40')]);})[_0xe054('0x5e')](function(_0x2d40bc){_0x39042e[_0xe054('0x40')][_0xe054('0x41')](_0x2d40bc);return parseTagParameter(_0x268c1[_0xe054('0x60')]);})[_0xe054('0x5e')](function(_0x142a9a){_0x39042e[_0xe054('0x49')][_0xe054('0x61')][_0xe054('0x41')](_0x142a9a);return parseSearchFilter(_0x523406,_0x268c1['filter']);})[_0xe054('0x5e')](function(_0x29bda2){_0x39042e[_0xe054('0x62')]=_0x29bda2;return _0x39042e;});}function checkAccountsRestrictions(_0x44d3f1,_0x699742,_0x2cda11){var _0x42deeb=utils[_0xe054('0x16')](_0x44d3f1);var _0x2bce64='get'+_[_0xe054('0x63')](_0x44d3f1)+(_0x44d3f1===_0xe054('0x64')?_0xe054('0x65'):_0xe054('0x66'));var _0x56ac36=squel[_0xe054('0x21')]();return Promise[_0xe054('0x5d')]()[_0xe054('0x5e')](function(){if(_0x2cda11['search']&&_0x699742[_0xe054('0x5')]===_0xe054('0x6')){return _0x699742[_0x2bce64]({'attributes':['id'],'raw':!![]});}})[_0xe054('0x5e')](function(_0x12dbf5){if(_0x12dbf5){if(_0x12dbf5[_0xe054('0x38')]===0x0){_0x56ac36[_0xe054('0x41')]('i.'+_0x42deeb+_0xe054('0x5b'));}else{_0x56ac36['and']('i.'+_0x42deeb+_0xe054('0x14'),_['map'](_0x12dbf5,'id'));}}else if(!_0x2cda11[_0x42deeb]){_0x56ac36['and']('i.'+_0x42deeb+_0xe054('0x67'));}})[_0xe054('0x5e')](function(){return _0x56ac36;});}function getClosedOrderClause(_0x4ae923,_0x416bac){var _0x394bac='';var _0x154924=['i.thirdDisposition',_0xe054('0x68'),_0xe054('0x69')];if(_0x4ae923===_0xe054('0x31')){_0x154924['unshift']('i.substatus');}if(_0x416bac[_0xe054('0x6a')]==='0'&&_0x4ae923===_0xe054('0x31')){_0x394bac=_0xe054('0x6b');}else{if(_0x416bac[_0xe054('0x6a')]==='1'){_0x154924[_0xe054('0x6c')]();}_0x394bac=_0xe054('0x6d')+_0x154924[_0xe054('0x6e')](',\x20')+')';}return _0x394bac;}function getFilteredInteractions(_0x136c5d,_0x5389a2,_0x1117fc,_0x37f961){var _0x545ccb=utils['getInteractionFK'](_0x136c5d);var _0xcecc6a=_['capitalize'](_0x136c5d)+'Interaction';var _0x51d859=[];var _0x9cf873=getTagsQuery();var _0x30515f={'type':db[_0xe054('0x6f')][_0xe054('0x70')]['SELECT'],'raw':!![]};var _0x51d47e=[];var _0x2e57ca=[];return db[_0xe054('0x71')]['query'](_0x9cf873[_0xe054('0x72')](),_0x30515f)[_0xe054('0x5e')](function(_0xab82b3){_0x51d859=_[_0xe054('0x73')](_0xab82b3,'id');_0x30515f=_['merge'](_0x30515f,{'model':db[_0xcecc6a],'mapToModel':!![],'nest':!![]});if(_0x1117fc[_0xe054('0x5f')]){_0x37f961[_0xe054('0x74')][_0xe054('0x22')](function(_0x2a1a32){_0x5389a2[_0xe054('0x8')]('i.'+_0x2a1a32);});}else{_0x5389a2[_0xe054('0x8')](_0xe054('0x75'),_0xe054('0x3f'));_0x5389a2['field'](_0xe054('0x76'),'Account.key');_0x5389a2[_0xe054('0x8')](_0xe054('0x77'),_0xe054('0x78'));if(_0x136c5d===_0xe054('0x31')){_0x5389a2[_0xe054('0x8')](_0xe054('0x79'),'Account.email');_0x5389a2[_0xe054('0x8')](_0xe054('0x7a'),'contactName');_0x5389a2['field']('i.id');_0x5389a2[_0xe054('0x8')](_0xe054('0x7b'));_0x5389a2[_0xe054('0x8')](_0xe054('0x7c'));_0x5389a2[_0xe054('0x8')](_0xe054('0x7d'));_0x5389a2['field'](_0xe054('0x7e'));_0x5389a2['field'](_0xe054('0x7f'));_0x5389a2[_0xe054('0x8')](_0xe054('0x80'));_0x5389a2[_0xe054('0x8')](_0xe054('0x81'));_0x5389a2[_0xe054('0x8')]('i.subject');_0x5389a2[_0xe054('0x8')](_0xe054('0x69'));_0x5389a2['field']('i.secondDisposition');_0x5389a2[_0xe054('0x8')](_0xe054('0x82'));_0x5389a2[_0xe054('0x8')]('i.substatus');_0x5389a2[_0xe054('0x8')](_0xe054('0x83'));_0x5389a2[_0xe054('0x8')](_0xe054('0x84'));_0x5389a2['field'](_0xe054('0x85'));_0x5389a2[_0xe054('0x8')](_0xe054('0x86'));}else if(_0x136c5d===_0xe054('0x2d')){_0x5389a2[_0xe054('0x8')](_0xe054('0x87'),'contactName');}else{_0x5389a2[_0xe054('0x8')](_0xe054('0x88'),'contactName');}if(_0x136c5d!==_0xe054('0x31')){_0x5389a2['field'](_0xe054('0x89'));}_0x5389a2[_0xe054('0x8')](_0xe054('0x8a'),_0xe054('0x8b'));_0x5389a2[_0xe054('0x8')](_0xe054('0x8c'),_0xe054('0x8d'));_0x5389a2[_0xe054('0x8')](_0xe054('0x8e'),'Contact.email');_0x5389a2[_0xe054('0x8')](_0xe054('0x8f'),_0xe054('0x90'));_0x5389a2[_0xe054('0x8')](_0xe054('0x91'),_0xe054('0x92'));_0x5389a2['field'](_0xe054('0x93'),_0xe054('0x94'));_0x5389a2[_0xe054('0x8')]('o.fullname','Owner.fullname');_0x5389a2[_0xe054('0x8')](_0xe054('0x95'),'Owner.internal');_0x5389a2['field']('GROUP_CONCAT(DISTINCT\x20t.id)',_0xe054('0x96'));}if(_0x37f961[_0xe054('0x97')]){_0x5389a2['limit'](_0x37f961['limit']);}if(_0x37f961[_0xe054('0x98')]){_0x5389a2[_0xe054('0x98')](_0x37f961[_0xe054('0x98')]);}return db['sequelize'][_0xe054('0x99')](_0x5389a2[_0xe054('0x72')](),_0x30515f);})[_0xe054('0x5e')](function(_0x61f079){_0x51d47e=_0x61f079;var _0xa0851e=getUsersQuery(_0x136c5d,_0x51d47e);return db['sequelize'][_0xe054('0x99')](_0xa0851e[_0xe054('0x72')](),_0x30515f);})['then'](function(_0x310b2c){_0x2e57ca=_[_0xe054('0x9a')](_0x310b2c,_0x545ccb);if(_0x136c5d==='mail'){return db['Setting'][_0xe054('0x9b')]({'attributes':[_0xe054('0x9c')],'raw':!![]});}})['then'](function(_0x282fb5){var _0x4026c8=_0x282fb5?_0x282fb5[_0xe054('0x9c')]:undefined;var _0x2bb392=_0x51d47e['map'](function(_0x59530e){return updateInteraction(_0x59530e,_0x51d859,_0x2e57ca,_0x4026c8);});return Promise['all'](_0x2bb392);});}function countFilteredInteractions(_0x47a2b6,_0x14a069){var _0x3b1398=_0x47a2b6['clone']();_0x3b1398[_0xe054('0x8')]('COUNT(*)');_0x3b1398[_0xe054('0x8')](_0xe054('0x75'),_0xe054('0x3f'));var _0x5eac99=utils[_0xe054('0x9d')](_0x14a069);if(!_[_0xe054('0x9e')](_0x5eac99)){_0x3b1398[_0xe054('0x12')](_0xe054('0x9f'),_0x5eac99);}var _0x24241e={'type':db[_0xe054('0x6f')][_0xe054('0x70')][_0xe054('0xa0')],'raw':!![]};return db[_0xe054('0x71')][_0xe054('0x99')](_0x3b1398[_0xe054('0x72')](),_0x24241e);}module[_0xe054('0xa1')]={'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 8893571..26b4bc9 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 _0x80ee=['abandoned','total','disposition','UserId','talking','MailMessage','findOne','out','plainBody','-id','then','trimStart','catch','Users','TagIds','lodash','../../mysqldb','fullname','split','forEach','push','waiting','answered','unmanaged'];(function(_0x298064,_0x1d2bfb){var _0x2512ea=function(_0x3e5b28){while(--_0x3e5b28){_0x298064['push'](_0x298064['shift']());}};_0x2512ea(++_0x1d2bfb);}(_0x80ee,0x1d7));var _0xe80e=function(_0x127783,_0x258715){_0x127783=_0x127783-0x0;var _0x14f298=_0x80ee[_0x127783];return _0x14f298;};'use strict';var _=require(_0xe80e('0x0'));var db=require(_0xe80e('0x1'))['db'];function getInteractionUsers(_0x2a1570,_0x29035a){return new Promise(function(_0x549503,_0xa52066){try{var _0x1bd8b8=[];if(_0x29035a[_0x2a1570]){_0x1bd8b8=_0x29035a[_0x2a1570]['map'](function(_0x32348b){return{'id':_0x32348b['id'],'fullname':_0x32348b[_0xe80e('0x2')]};});}return _0x549503(_0x1bd8b8);}catch(_0x39921f){_0xa52066(_0x39921f);}});}function getInteractionTags(_0x463598,_0x482772){var _0xa3f3cc=[];if(_0x463598){_0x463598[_0xe80e('0x3')](',')[_0xe80e('0x4')](function(_0x37a841){_0xa3f3cc[_0xe80e('0x5')](_0x482772[_0x37a841]);});}return _0xa3f3cc;}function updateWaitingCounter(_0x23f1d9){if(_0x23f1d9[_0xe80e('0x6')]){_0x23f1d9[_0xe80e('0x6')]-=0x1;}}function updateInteractionCounters(_0x5179d3){_0x5179d3[_0xe80e('0x6')]=0x0;_0x5179d3['talking']=0x0;_0x5179d3[_0xe80e('0x7')]=0x0;_0x5179d3[_0xe80e('0x8')]=0x0;_0x5179d3[_0xe80e('0x9')]=0x0;_0x5179d3[_0xe80e('0xa')]=0x0;if(_0x5179d3['closed']){if(_0x5179d3[_0xe80e('0xb')]===_0xe80e('0x9')){_0x5179d3['abandoned']+=0x1;updateWaitingCounter(_0x5179d3);}if(_0x5179d3[_0xe80e('0xc')]){_0x5179d3[_0xe80e('0x7')]+=0x1;if(_0x5179d3[_0xe80e('0xd')]){_0x5179d3[_0xe80e('0xd')]-=0x1;}}else{if(_0x5179d3[_0xe80e('0xb')]){_0x5179d3[_0xe80e('0x8')]+=0x1;updateWaitingCounter(_0x5179d3);}}}else{if(!_0x5179d3[_0xe80e('0xc')]){_0x5179d3[_0xe80e('0x6')]+=0x1;}if(_0x5179d3[_0xe80e('0xc')]){_0x5179d3[_0xe80e('0xd')]+=0x1;updateWaitingCounter(_0x5179d3);}}_0x5179d3[_0xe80e('0xa')]+=0x1;return _0x5179d3;}function getLastMessageText(_0x36191e){return db[_0xe80e('0xe')][_0xe80e('0xf')]({'where':{'$and':[{'MailInteractionId':_0x36191e['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0xe80e('0x10')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0xe80e('0x11')],'order':_0xe80e('0x12'),'raw':!![]})[_0xe80e('0x13')](function(_0x2714c5){if(_0x2714c5&&_0x2714c5[_0xe80e('0x11')]){_0x36191e['lastMsgText']=_[_0xe80e('0x14')](_0x2714c5['plainBody']);}return _0x36191e;})[_0xe80e('0x15')](function(_0x3226a9){throw _0x3226a9;});}exports['updateInteraction']=function(_0x44ecf5,_0xf7ebd5,_0x450409,_0x545cff){return new Promise(function(_0x486aa4,_0x572f54){return getInteractionUsers(_0x44ecf5['id'],_0x450409)[_0xe80e('0x13')](function(_0x25251c){_0x44ecf5[_0xe80e('0x16')]=_0x25251c;return getInteractionTags(_0x44ecf5[_0xe80e('0x17')],_0xf7ebd5);})[_0xe80e('0x13')](function(_0x4c0c0e){_0x44ecf5['Tags']=_0x4c0c0e;delete _0x44ecf5[_0xe80e('0x17')];return updateInteractionCounters(_0x44ecf5);})[_0xe80e('0x13')](function(_0x13bea4){if(_0x545cff){return getLastMessageText(_0x13bea4);}else{return _0x13bea4;}})[_0xe80e('0x13')](function(_0x1b2ce0){_0x486aa4(_0x1b2ce0);})['catch'](function(_0x3e5138){_0x572f54(_0x3e5138);});});}; \ No newline at end of file +var _0xe485=['waiting','answered','unmanaged','abandoned','total','disposition','talking','UserId','MailMessage','findOne','out','plainBody','then','lastMsgText','trimStart','catch','updateInteraction','Users','TagIds','Tags','lodash','../../mysqldb','fullname','push'];(function(_0x2e911d,_0x58a451){var _0x543227=function(_0x2430ad){while(--_0x2430ad){_0x2e911d['push'](_0x2e911d['shift']());}};_0x543227(++_0x58a451);}(_0xe485,0x104));var _0x5e48=function(_0x1e1de2,_0x20dd89){_0x1e1de2=_0x1e1de2-0x0;var _0x859f40=_0xe485[_0x1e1de2];return _0x859f40;};'use strict';var _=require(_0x5e48('0x0'));var db=require(_0x5e48('0x1'))['db'];function getInteractionUsers(_0x17b5b7,_0x5c87de){return new Promise(function(_0x4be847,_0x57b354){try{var _0x5aea36=[];if(_0x5c87de[_0x17b5b7]){_0x5aea36=_0x5c87de[_0x17b5b7]['map'](function(_0x4e81ee){return{'id':_0x4e81ee['id'],'fullname':_0x4e81ee[_0x5e48('0x2')]};});}return _0x4be847(_0x5aea36);}catch(_0x1c16c9){_0x57b354(_0x1c16c9);}});}function getInteractionTags(_0x192b71,_0x409517){var _0x2a8690=[];if(_0x192b71){_0x192b71['split'](',')['forEach'](function(_0x392e9a){_0x2a8690[_0x5e48('0x3')](_0x409517[_0x392e9a]);});}return _0x2a8690;}function updateWaitingCounter(_0x4bb402){if(_0x4bb402[_0x5e48('0x4')]){_0x4bb402[_0x5e48('0x4')]-=0x1;}}function updateInteractionCounters(_0x3f0754){_0x3f0754['waiting']=0x0;_0x3f0754['talking']=0x0;_0x3f0754[_0x5e48('0x5')]=0x0;_0x3f0754[_0x5e48('0x6')]=0x0;_0x3f0754[_0x5e48('0x7')]=0x0;_0x3f0754[_0x5e48('0x8')]=0x0;if(_0x3f0754['closed']){if(_0x3f0754[_0x5e48('0x9')]==='abandoned'){_0x3f0754[_0x5e48('0x7')]+=0x1;updateWaitingCounter(_0x3f0754);}if(_0x3f0754['UserId']){_0x3f0754[_0x5e48('0x5')]+=0x1;if(_0x3f0754[_0x5e48('0xa')]){_0x3f0754['talking']-=0x1;}}else{if(_0x3f0754[_0x5e48('0x9')]){_0x3f0754[_0x5e48('0x6')]+=0x1;updateWaitingCounter(_0x3f0754);}}}else{if(!_0x3f0754[_0x5e48('0xb')]){_0x3f0754['waiting']+=0x1;}if(_0x3f0754['UserId']){_0x3f0754['talking']+=0x1;updateWaitingCounter(_0x3f0754);}}_0x3f0754[_0x5e48('0x8')]+=0x1;return _0x3f0754;}function getLastMessageText(_0x277559){return db[_0x5e48('0xc')][_0x5e48('0xd')]({'where':{'$and':[{'MailInteractionId':_0x277559['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x5e48('0xe')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x5e48('0xf')],'order':'-id','raw':!![]})[_0x5e48('0x10')](function(_0xfce5d1){if(_0xfce5d1&&_0xfce5d1[_0x5e48('0xf')]){_0x277559[_0x5e48('0x11')]=_[_0x5e48('0x12')](_0xfce5d1[_0x5e48('0xf')]);}return _0x277559;})[_0x5e48('0x13')](function(_0x482215){throw _0x482215;});}exports[_0x5e48('0x14')]=function(_0x2d9fad,_0x230c65,_0x52bfa5,_0x30a020){return new Promise(function(_0x2ff69a,_0x14150a){return getInteractionUsers(_0x2d9fad['id'],_0x52bfa5)['then'](function(_0x5c188d){_0x2d9fad[_0x5e48('0x15')]=_0x5c188d;return getInteractionTags(_0x2d9fad[_0x5e48('0x16')],_0x230c65);})[_0x5e48('0x10')](function(_0x5c238a){_0x2d9fad[_0x5e48('0x17')]=_0x5c238a;delete _0x2d9fad[_0x5e48('0x16')];return updateInteractionCounters(_0x2d9fad);})[_0x5e48('0x10')](function(_0x58d857){if(_0x30a020){return getLastMessageText(_0x58d857);}else{return _0x58d857;}})[_0x5e48('0x10')](function(_0x4b1e4b){_0x2ff69a(_0x4b1e4b);})['catch'](function(_0xd119c8){_0x14150a(_0xd119c8);});});}; \ No newline at end of file diff --git a/server/components/interaction/utils.js b/server/components/interaction/utils.js index 998df9a..196bae3 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 _0xbc17=['[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','role','stringify','null','Interaction','then','update','error','exports','lodash','../../mysqldb','openchannel-interactions','../../config/logger','mail-interactions','fax-interactions','sms-interactions','capitalize','chat','Website','upperFirst','InteractionId','unknown','websites','accounts','_interactions','_interaction_has_tags','_messages','user_has_','isArray','toLowerCase'];(function(_0xa407ad,_0x28df76){var _0x22daa7=function(_0x1df222){while(--_0x1df222){_0xa407ad['push'](_0xa407ad['shift']());}};_0x22daa7(++_0x28df76);}(_0xbc17,0x14b));var _0x7bc1=function(_0x622035,_0x1a4b91){_0x622035=_0x622035-0x0;var _0x326cf2=_0xbc17[_0x622035];return _0x326cf2;};'use strict';var _=require(_0x7bc1('0x0'));var db=require(_0x7bc1('0x1'))['db'];var loggers={'openchannel':require('../../config/logger')(_0x7bc1('0x2')),'mail':require(_0x7bc1('0x3'))(_0x7bc1('0x4')),'fax':require(_0x7bc1('0x3'))(_0x7bc1('0x5')),'sms':require(_0x7bc1('0x3'))(_0x7bc1('0x6')),'chat':require(_0x7bc1('0x3'))('chat-interactions'),'whatsapp':require(_0x7bc1('0x3'))('whatsapp-interactions')};function getAccountFK(_0x50a8fa){return _[_0x7bc1('0x7')](_0x50a8fa)+(_0x50a8fa===_0x7bc1('0x8')?_0x7bc1('0x9'):'Account')+'Id';}function getInteractionFK(_0x3bf023){return _[_0x7bc1('0x7')](_0x3bf023)+'InteractionId';}function getInteractionId(_0x17540c,_0x50946e,_0x47ea28){if(_0x17540c&&_0x17540c[_[_0x7bc1('0xa')](_0x47ea28)+_0x7bc1('0xb')]){return _0x17540c[_[_0x7bc1('0xa')](_0x47ea28)+_0x7bc1('0xb')];}else if(_0x17540c&&_0x17540c['id']){return _0x17540c['id'];}else if(_0x50946e&&_0x50946e['id']){return _0x50946e['id'];}else{return _0x7bc1('0xc');}}function getInteractionsTables(_0x2e456c){return{'accounts':_0x2e456c+'_'+(_0x2e456c==='chat'?_0x7bc1('0xd'):_0x7bc1('0xe')),'interactions':_0x2e456c+_0x7bc1('0xf'),'interactionsTags':_0x2e456c+_0x7bc1('0x10'),'messages':_0x2e456c+_0x7bc1('0x11'),'userInteractions':_0x7bc1('0x12')+_0x2e456c+'_interactions'};}function getSelectedTags(_0x517ce3){var _0xb6161a=[];if(_0x517ce3){_0xb6161a=Array[_0x7bc1('0x13')](_0x517ce3)?_0x517ce3:[_0x517ce3];}return _0xb6161a;}function log(_0x2d17f8,_0x3e6cde,_0x547d9c,_0x134f50,_0x506eb4,_0xf345d7){loggers[_0x506eb4[_0x7bc1('0x14')]()][_0x2d17f8](_0x7bc1('0x15'),_0xf345d7[_0x7bc1('0x16')](),_0x3e6cde?_0x3e6cde['id']:null,_0x3e6cde?_0x3e6cde[_0x7bc1('0x17')]:null,_0x3e6cde?_0x3e6cde[_0x7bc1('0x18')]:null,getInteractionId(_0x547d9c,_0x134f50,_0x506eb4),_0x547d9c?JSON[_0x7bc1('0x19')](_0x547d9c):_0x7bc1('0x1a'));}function updateUser(_0x231c77,_0x5c73ab,_0x4c9a00,_0x405adb,_0x2fd2a6){db[_['upperFirst'](_0x405adb)+_0x7bc1('0x1b')]['findOne']({'where':{'id':getInteractionId(_0x5c73ab,_0x4c9a00,_0x405adb)}})[_0x7bc1('0x1c')](function(_0x59baaa){if(_0x59baaa){return _0x59baaa[_0x7bc1('0x1d')]({'UserId':_0x231c77?_0x231c77['id']:null});}})['then'](function(_0x4657cf){if(_0x4657cf){log('info',_0x231c77,_0x5c73ab,_0x4c9a00,_0x405adb,_0x2fd2a6);}})['catch'](function(){log(_0x7bc1('0x1e'),_0x231c77,_0x5c73ab,_0x4c9a00,_0x405adb,_0x2fd2a6);});}module[_0x7bc1('0x1f')]={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'updateUser':updateUser}; \ No newline at end of file +var _0x54cb=['toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','role','stringify','null','Interaction','findOne','then','update','info','lodash','../../mysqldb','../../config/logger','fax-interactions','chat-interactions','whatsapp-interactions','capitalize','chat','upperFirst','InteractionId','unknown','accounts','_interaction_has_tags','_messages','user_has_','_interactions'];(function(_0x708864,_0x3b60e1){var _0x537c4c=function(_0x1efb41){while(--_0x1efb41){_0x708864['push'](_0x708864['shift']());}};_0x537c4c(++_0x3b60e1);}(_0x54cb,0x7c));var _0xb54c=function(_0x44ac34,_0x587913){_0x44ac34=_0x44ac34-0x0;var _0xcf4bc1=_0x54cb[_0x44ac34];return _0xcf4bc1;};'use strict';var _=require(_0xb54c('0x0'));var db=require(_0xb54c('0x1'))['db'];var loggers={'openchannel':require(_0xb54c('0x2'))('openchannel-interactions'),'mail':require(_0xb54c('0x2'))('mail-interactions'),'fax':require('../../config/logger')(_0xb54c('0x3')),'sms':require('../../config/logger')('sms-interactions'),'chat':require(_0xb54c('0x2'))(_0xb54c('0x4')),'whatsapp':require(_0xb54c('0x2'))(_0xb54c('0x5'))};function getAccountFK(_0x3f4610){return _[_0xb54c('0x6')](_0x3f4610)+(_0x3f4610===_0xb54c('0x7')?'Website':'Account')+'Id';}function getInteractionFK(_0x5c9123){return _[_0xb54c('0x6')](_0x5c9123)+'InteractionId';}function getInteractionId(_0x3e4eb1,_0xb53388,_0x5dc6dc){if(_0x3e4eb1&&_0x3e4eb1[_[_0xb54c('0x8')](_0x5dc6dc)+_0xb54c('0x9')]){return _0x3e4eb1[_['upperFirst'](_0x5dc6dc)+'InteractionId'];}else if(_0x3e4eb1&&_0x3e4eb1['id']){return _0x3e4eb1['id'];}else if(_0xb53388&&_0xb53388['id']){return _0xb53388['id'];}else{return _0xb54c('0xa');}}function getInteractionsTables(_0x36896f){return{'accounts':_0x36896f+'_'+(_0x36896f===_0xb54c('0x7')?'websites':_0xb54c('0xb')),'interactions':_0x36896f+'_interactions','interactionsTags':_0x36896f+_0xb54c('0xc'),'messages':_0x36896f+_0xb54c('0xd'),'userInteractions':_0xb54c('0xe')+_0x36896f+_0xb54c('0xf')};}function getSelectedTags(_0x3b8aea){var _0x3c7332=[];if(_0x3b8aea){_0x3c7332=Array['isArray'](_0x3b8aea)?_0x3b8aea:[_0x3b8aea];}return _0x3c7332;}function log(_0x3eaea7,_0x409426,_0x5df784,_0x1a6dfe,_0x436023,_0x1c1332){loggers[_0x436023[_0xb54c('0x10')]()][_0x3eaea7](_0xb54c('0x11'),_0x1c1332[_0xb54c('0x12')](),_0x409426?_0x409426['id']:null,_0x409426?_0x409426[_0xb54c('0x13')]:null,_0x409426?_0x409426[_0xb54c('0x14')]:null,getInteractionId(_0x5df784,_0x1a6dfe,_0x436023),_0x5df784?JSON[_0xb54c('0x15')](_0x5df784):_0xb54c('0x16'));}function updateUser(_0x81cece,_0x4599c9,_0x1abcc8,_0x52fa52,_0x1c5a1b){db[_[_0xb54c('0x8')](_0x52fa52)+_0xb54c('0x17')][_0xb54c('0x18')]({'where':{'id':getInteractionId(_0x4599c9,_0x1abcc8,_0x52fa52)}})[_0xb54c('0x19')](function(_0x1625bd){if(_0x1625bd){return _0x1625bd[_0xb54c('0x1a')]({'UserId':_0x81cece?_0x81cece['id']:null});}})[_0xb54c('0x19')](function(_0x2293e6){if(_0x2293e6){log(_0xb54c('0x1b'),_0x81cece,_0x4599c9,_0x1abcc8,_0x52fa52,_0x1c5a1b);}})['catch'](function(){log('error',_0x81cece,_0x4599c9,_0x1abcc8,_0x52fa52,_0x1c5a1b);});}module['exports']={'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 7c76863..2a4b1e5 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 _0x693c=['split','createDecipher','format','%s:%s:%s','update','base64','utf8','final','parse','License','findOne','then','count','status','catch','users','User','user','../../mysqldb','../../config/environment','data1','license'];(function(_0x537e04,_0x4c3191){var _0x15a35f=function(_0x569eae){while(--_0x569eae){_0x537e04['push'](_0x537e04['shift']());}};_0x15a35f(++_0x4c3191);}(_0x693c,0x11a));var _0xc693=function(_0x572ed1,_0x371563){_0x572ed1=_0x572ed1-0x0;var _0x3db234=_0x693c[_0x572ed1];return _0x3db234;};'use strict';var crypto=require('crypto');var util=require('util');var compose=require('composable-middleware');var db=require(_0xc693('0x0'))['db'];var config=require(_0xc693('0x1'));function getValueFromLicense(_0x26bc52,_0x281380){if(_0x26bc52&&_0x281380){if(_0x281380[_0xc693('0x2')]&&_0x281380[_0xc693('0x3')]){var _0x3e0d02=_0x281380[_0xc693('0x2')];var _0x50eacd=_0x281380[_0xc693('0x3')];var _0x5bc6e9=_0x3e0d02[_0xc693('0x4')]('-')[0x4];var _0x10edbb=_0x3e0d02['split']('-')[0x0];var _0x40e129=crypto[_0xc693('0x5')]('aes-256-ctr',util[_0xc693('0x6')](_0xc693('0x7'),_0x5bc6e9,_0x3e0d02,_0x10edbb));var _0x1fa427=_0x40e129[_0xc693('0x8')](_0x50eacd,_0xc693('0x9'),_0xc693('0xa'));_0x1fa427+=_0x40e129[_0xc693('0xb')](_0xc693('0xa'));var _0x3be2a9=JSON[_0xc693('0xc')](_0x1fa427);return _0x3be2a9['hasOwnProperty'](_0x26bc52)?_0x3be2a9[_0x26bc52]:null;}}return null;}function isLimit(_0x184f72,_0x3c6a4c,_0x352f72,_0x5d1f83){var _0x9bfd94=_0x3c6a4c;return compose()['use'](function(_0x4c6b2e,_0xe47732,_0x29225b){return db[_0xc693('0xd')][_0xc693('0xe')]({'where':{'id':0x1},'raw':!![]})['then'](function(_0x31e2e4){var _0x4a4fbd=getValueFromLicense(_0x184f72,_0x31e2e4);return _0x4a4fbd?_0x4a4fbd:_0x9bfd94;})[_0xc693('0xf')](function(_0x155fff){_0x9bfd94=_0x155fff;return _0x352f72[_0xc693('0x10')](_0x5d1f83);})[_0xc693('0xf')](function(_0x1e5cc2){if(_0x1e5cc2>=_0x9bfd94){return _0xe47732[_0xc693('0x11')](0x193)['json']({'message':util[_0xc693('0x6')]('Maximum\x20%s\x20limit\x20have\x20been\x20reached',_0x184f72)});}_0x29225b();})[_0xc693('0x12')](function(_0x38b4f1){_0x29225b(_0x38b4f1);});});}function isUserLimit(){return isLimit(_0xc693('0x13'),0x1,db[_0xc693('0x14')],{'where':{'$or':[{'role':'admin'},{'role':_0xc693('0x15')}]}});}exports['isUserLimit']=isUserLimit; \ No newline at end of file +var _0xd227=['../../mysqldb','../../config/environment','data1','license','split','createDecipher','aes-256-ctr','format','utf8','parse','hasOwnProperty','use','License','findOne','then','status','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','admin','user','isUserLimit','util','composable-middleware'];(function(_0xa6deb9,_0x344c89){var _0x3bd58e=function(_0x404098){while(--_0x404098){_0xa6deb9['push'](_0xa6deb9['shift']());}};_0x3bd58e(++_0x344c89);}(_0xd227,0xa6));var _0x7d22=function(_0x5adfa9,_0x4b835d){_0x5adfa9=_0x5adfa9-0x0;var _0x458f41=_0xd227[_0x5adfa9];return _0x458f41;};'use strict';var crypto=require('crypto');var util=require(_0x7d22('0x0'));var compose=require(_0x7d22('0x1'));var db=require(_0x7d22('0x2'))['db'];var config=require(_0x7d22('0x3'));function getValueFromLicense(_0x37dbfb,_0x2671c8){if(_0x37dbfb&&_0x2671c8){if(_0x2671c8[_0x7d22('0x4')]&&_0x2671c8[_0x7d22('0x5')]){var _0x35cb94=_0x2671c8[_0x7d22('0x4')];var _0x55d136=_0x2671c8[_0x7d22('0x5')];var _0x302adc=_0x35cb94['split']('-')[0x4];var _0x42a6d7=_0x35cb94[_0x7d22('0x6')]('-')[0x0];var _0x55b19e=crypto[_0x7d22('0x7')](_0x7d22('0x8'),util[_0x7d22('0x9')]('%s:%s:%s',_0x302adc,_0x35cb94,_0x42a6d7));var _0x5da628=_0x55b19e['update'](_0x55d136,'base64','utf8');_0x5da628+=_0x55b19e['final'](_0x7d22('0xa'));var _0x4ccd27=JSON[_0x7d22('0xb')](_0x5da628);return _0x4ccd27[_0x7d22('0xc')](_0x37dbfb)?_0x4ccd27[_0x37dbfb]:null;}}return null;}function isLimit(_0x519422,_0x3f6093,_0x5ecd9b,_0x1177b7){var _0x3d6990=_0x3f6093;return compose()[_0x7d22('0xd')](function(_0x5900e7,_0x4e1cec,_0x416cf7){return db[_0x7d22('0xe')][_0x7d22('0xf')]({'where':{'id':0x1},'raw':!![]})[_0x7d22('0x10')](function(_0x4ec44e){var _0x2ebc27=getValueFromLicense(_0x519422,_0x4ec44e);return _0x2ebc27?_0x2ebc27:_0x3d6990;})['then'](function(_0x87c5b9){_0x3d6990=_0x87c5b9;return _0x5ecd9b['count'](_0x1177b7);})[_0x7d22('0x10')](function(_0x3e81b1){if(_0x3e81b1>=_0x3d6990){return _0x4e1cec[_0x7d22('0x11')](0x193)['json']({'message':util[_0x7d22('0x9')](_0x7d22('0x12'),_0x519422)});}_0x416cf7();})[_0x7d22('0x13')](function(_0x10d455){_0x416cf7(_0x10d455);});});}function isUserLimit(){return isLimit(_0x7d22('0x14'),0x1,db['User'],{'where':{'$or':[{'role':_0x7d22('0x15')},{'role':_0x7d22('0x16')}]}});}exports[_0x7d22('0x17')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index 5f67b61..4c227fe 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 _0xd90c=['includes','$lte','days','YYYY-MM-DD','castTo','text','\x20AS\x20','field','$ne','\x20IS\x20NULL)','$in','IN\x20?','$notIn','=\x20?','$substring','$startsWith','$endsWith','$gt','$gte','BETWEEN\x20?\x20AND\x20?','start','pop','utcOffset','format','add','minutes','seconds','lodash','parseSearch','sqlOperator','startsWith','[$or]','replace','[$and]','split','forEach','shift','match','filter','indexOf','conditions','buildExpression','operator','$eq','$between','value'];(function(_0x576566,_0x557582){var _0x3f12d8=function(_0x18aaec){while(--_0x18aaec){_0x576566['push'](_0x576566['shift']());}};_0x3f12d8(++_0x557582);}(_0xd90c,0x15d));var _0xcd90=function(_0xb21889,_0x5ca32c){_0xb21889=_0xb21889-0x0;var _0xec8324=_0xd90c[_0xb21889];return _0xec8324;};'use strict';var _=require(_0xcd90('0x0'));var moment=require('moment');exports[_0xcd90('0x1')]=function(_0x3a3d6d){var _0x1315a7={'conditions':[]};_0x1315a7[_0xcd90('0x2')]=_[_0xcd90('0x3')](_0x3a3d6d,_0xcd90('0x4'))?'or':'and';var _0x36d3e9=_0x3a3d6d[_0xcd90('0x5')](_0xcd90('0x6'),'')['replace'](_0xcd90('0x4'),'')[_0xcd90('0x7')]('||');for(var _0x5c1bbe=0x0;_0x5c1bbe<_0x36d3e9['length'];_0x5c1bbe++){var _0x4084d8=_0x36d3e9[_0x5c1bbe][_0xcd90('0x7')](':=');var _0x24cca9=_0x4084d8[0x0];var _0x4aea9c=_0x4084d8['slice'](0x1);_0x4aea9c[_0xcd90('0x8')](function(_0x18917a){var _0x3215e4=_0x18917a[_0xcd90('0x7')]('[')[_0xcd90('0x9')]();var _0x29a16d=_0x18917a[_0xcd90('0xa')](/\[(.*?)\]/g);_0x29a16d[_0xcd90('0x8')](function(_0x3e1063){var _0x2147f8=_0x3e1063['split']('[')[_0xcd90('0xb')](function(_0x4710e4){return _0x4710e4[_0xcd90('0xc')](']')>-0x1;})['map'](function(_0x59cbb6){return _0x59cbb6[_0xcd90('0x7')](']')[0x0];})[0x0];_0x1315a7[_0xcd90('0xd')]['push']({'field':_0x24cca9,'operator':_0x3215e4,'value':_0x2147f8});});});}return _0x1315a7;};exports[_0xcd90('0xe')]=function(_0x1a153b,_0xdf7ded,_0x345485){var _0x5ba955={};if(_0xdf7ded==='DATE'){if(_0x345485[_0xcd90('0xf')]===_0xcd90('0x10')){_0x345485[_0xcd90('0xf')]=_0xcd90('0x11');_0x345485[_0xcd90('0x12')]+=','+_0x345485[_0xcd90('0x12')];}else if(_[_0xcd90('0x13')](['$gt',_0xcd90('0x14')],_0x345485[_0xcd90('0xf')])){_0x345485['value']=moment(_0x345485[_0xcd90('0x12')])['add'](0x1,_0xcd90('0x15'))['format'](_0xcd90('0x16'));}}if(_0x345485[_0xcd90('0x17')]){_0xdf7ded=_0x345485[_0xcd90('0x17')];_0x5ba955[_0xcd90('0x18')]='CAST('+_0x1a153b+'.'+_0x345485['field']+_0xcd90('0x19')+_0x345485[_0xcd90('0x17')]+')\x20'+parseOperator(_0x345485[_0xcd90('0xf')]);}else{_0x5ba955[_0xcd90('0x18')]=_0x1a153b+'.'+_0x345485[_0xcd90('0x1a')]+'\x20'+parseOperator(_0x345485['operator']);}if(_[_0xcd90('0x13')]([_0xcd90('0x1b'),'$notIn'],_0x345485[_0xcd90('0xf')]))_0x5ba955[_0xcd90('0x18')]='('+_0x5ba955[_0xcd90('0x18')]+'\x20OR\x20'+_0x1a153b+'.'+_0x345485[_0xcd90('0x1a')]+_0xcd90('0x1c');_0x5ba955[_0xcd90('0x12')]=parseValue(_0xdf7ded,_0x345485['operator'],_0x345485[_0xcd90('0x12')]);return _0x5ba955;};function parseOperator(_0x277879){var _0x25fafb;switch(_0x277879){case _0xcd90('0x1d'):_0x25fafb=_0xcd90('0x1e');break;case _0xcd90('0x1f'):_0x25fafb='NOT\x20IN\x20?';break;case _0xcd90('0x10'):_0x25fafb=_0xcd90('0x20');break;case'$ne':_0x25fafb='<>\x20?';break;case _0xcd90('0x21'):case _0xcd90('0x22'):case _0xcd90('0x23'):_0x25fafb='LIKE\x20?';break;case'$lt':_0x25fafb='<\x20?';break;case _0xcd90('0x24'):_0x25fafb='>\x20?';break;case'$lte':_0x25fafb='<=\x20?';break;case _0xcd90('0x25'):_0x25fafb='>=\x20?';break;case _0xcd90('0x11'):_0x25fafb=_0xcd90('0x26');break;}return _0x25fafb;}function parseValue(_0x5c4393,_0x53f475,_0x50eb9c){var _0x4818e7={'start':undefined,'end':undefined};switch(_0x53f475){case _0xcd90('0x1d'):case'$notIn':_0x4818e7[_0xcd90('0x27')]=_0x50eb9c['split'](',');break;case _0xcd90('0x21'):_0x4818e7[_0xcd90('0x27')]='%'+_0x50eb9c+'%';break;case'$startsWith':_0x4818e7[_0xcd90('0x27')]=_0x50eb9c+'%';break;case _0xcd90('0x23'):_0x4818e7[_0xcd90('0x27')]='%'+_0x50eb9c;break;case'$between':var _0x337a39=_0x50eb9c[_0xcd90('0x7')](',');var _0x50eb9c=_0x337a39[_0xcd90('0x9')]();var _0x3cba47=_0x337a39[_0xcd90('0x28')]();if(_0x5c4393==='DATE'){_0x50eb9c=moment(_0x50eb9c)[_0xcd90('0x29')](0x0,!![])[_0xcd90('0x2a')]();_0x3cba47=moment(_0x3cba47)[_0xcd90('0x29')](0x0,!![])[_0xcd90('0x2b')](0x17,'hours')[_0xcd90('0x2b')](0x3b,_0xcd90('0x2c'))[_0xcd90('0x2b')](0x3b,_0xcd90('0x2d'))[_0xcd90('0x2a')]();}_0x4818e7={'start':_0x50eb9c,'end':_0x3cba47};break;default:_0x4818e7['start']=_0x50eb9c;break;}return _0x4818e7;} \ No newline at end of file +var _0xd25b=['$lte','add','days','format','YYYY-MM-DD','castTo','field','\x20AS\x20','text','$ne','$notIn','\x20OR\x20','$in','NOT\x20IN\x20?','$eq','=\x20?','<>\x20?','$substring','$endsWith','LIKE\x20?','$lt','<\x20?','>\x20?','<=\x20?','$gte','>=\x20?','start','$startsWith','pop','utcOffset','hours','minutes','seconds','lodash','moment','sqlOperator','startsWith','[$or]','and','replace','split','slice','forEach','shift','match','filter','indexOf','map','conditions','push','buildExpression','DATE','operator','$between','value','includes','$gt'];(function(_0x1cd674,_0x8d3638){var _0x27928f=function(_0x5e3c70){while(--_0x5e3c70){_0x1cd674['push'](_0x1cd674['shift']());}};_0x27928f(++_0x8d3638);}(_0xd25b,0x1e9));var _0xbd25=function(_0x3956ec,_0x394ac7){_0x3956ec=_0x3956ec-0x0;var _0x86f4ad=_0xd25b[_0x3956ec];return _0x86f4ad;};'use strict';var _=require(_0xbd25('0x0'));var moment=require(_0xbd25('0x1'));exports['parseSearch']=function(_0x326f1c){var _0x58cf61={'conditions':[]};_0x58cf61[_0xbd25('0x2')]=_[_0xbd25('0x3')](_0x326f1c,_0xbd25('0x4'))?'or':_0xbd25('0x5');var _0x328043=_0x326f1c[_0xbd25('0x6')]('[$and]','')['replace'](_0xbd25('0x4'),'')[_0xbd25('0x7')]('||');for(var _0x5b1f56=0x0;_0x5b1f56<_0x328043['length'];_0x5b1f56++){var _0x406881=_0x328043[_0x5b1f56][_0xbd25('0x7')](':=');var _0x11d3a5=_0x406881[0x0];var _0x304878=_0x406881[_0xbd25('0x8')](0x1);_0x304878[_0xbd25('0x9')](function(_0x408d29){var _0x4a93fd=_0x408d29[_0xbd25('0x7')]('[')[_0xbd25('0xa')]();var _0x4d4c88=_0x408d29[_0xbd25('0xb')](/\[(.*?)\]/g);_0x4d4c88['forEach'](function(_0x5807e3){var _0x48d043=_0x5807e3[_0xbd25('0x7')]('[')[_0xbd25('0xc')](function(_0x23ecc9){return _0x23ecc9[_0xbd25('0xd')](']')>-0x1;})[_0xbd25('0xe')](function(_0x48ede1){return _0x48ede1[_0xbd25('0x7')](']')[0x0];})[0x0];_0x58cf61[_0xbd25('0xf')][_0xbd25('0x10')]({'field':_0x11d3a5,'operator':_0x4a93fd,'value':_0x48d043});});});}return _0x58cf61;};exports[_0xbd25('0x11')]=function(_0x1b7224,_0x336187,_0xa7d138){var _0x52e1a6={};if(_0x336187===_0xbd25('0x12')){if(_0xa7d138[_0xbd25('0x13')]==='$eq'){_0xa7d138['operator']=_0xbd25('0x14');_0xa7d138[_0xbd25('0x15')]+=','+_0xa7d138[_0xbd25('0x15')];}else if(_[_0xbd25('0x16')]([_0xbd25('0x17'),_0xbd25('0x18')],_0xa7d138[_0xbd25('0x13')])){_0xa7d138[_0xbd25('0x15')]=moment(_0xa7d138[_0xbd25('0x15')])[_0xbd25('0x19')](0x1,_0xbd25('0x1a'))[_0xbd25('0x1b')](_0xbd25('0x1c'));}}if(_0xa7d138[_0xbd25('0x1d')]){_0x336187=_0xa7d138[_0xbd25('0x1d')];_0x52e1a6['text']='CAST('+_0x1b7224+'.'+_0xa7d138[_0xbd25('0x1e')]+_0xbd25('0x1f')+_0xa7d138[_0xbd25('0x1d')]+')\x20'+parseOperator(_0xa7d138[_0xbd25('0x13')]);}else{_0x52e1a6[_0xbd25('0x20')]=_0x1b7224+'.'+_0xa7d138[_0xbd25('0x1e')]+'\x20'+parseOperator(_0xa7d138[_0xbd25('0x13')]);}if(_['includes']([_0xbd25('0x21'),_0xbd25('0x22')],_0xa7d138['operator']))_0x52e1a6[_0xbd25('0x20')]='('+_0x52e1a6[_0xbd25('0x20')]+_0xbd25('0x23')+_0x1b7224+'.'+_0xa7d138['field']+'\x20IS\x20NULL)';_0x52e1a6[_0xbd25('0x15')]=parseValue(_0x336187,_0xa7d138['operator'],_0xa7d138[_0xbd25('0x15')]);return _0x52e1a6;};function parseOperator(_0x11ac14){var _0x579b03;switch(_0x11ac14){case _0xbd25('0x24'):_0x579b03='IN\x20?';break;case _0xbd25('0x22'):_0x579b03=_0xbd25('0x25');break;case _0xbd25('0x26'):_0x579b03=_0xbd25('0x27');break;case _0xbd25('0x21'):_0x579b03=_0xbd25('0x28');break;case _0xbd25('0x29'):case'$startsWith':case _0xbd25('0x2a'):_0x579b03=_0xbd25('0x2b');break;case _0xbd25('0x2c'):_0x579b03=_0xbd25('0x2d');break;case'$gt':_0x579b03=_0xbd25('0x2e');break;case _0xbd25('0x18'):_0x579b03=_0xbd25('0x2f');break;case _0xbd25('0x30'):_0x579b03=_0xbd25('0x31');break;case'$between':_0x579b03='BETWEEN\x20?\x20AND\x20?';break;}return _0x579b03;}function parseValue(_0x448200,_0x67340a,_0x3e40ee){var _0x38ded8={'start':undefined,'end':undefined};switch(_0x67340a){case'$in':case _0xbd25('0x22'):_0x38ded8['start']=_0x3e40ee[_0xbd25('0x7')](',');break;case _0xbd25('0x29'):_0x38ded8[_0xbd25('0x32')]='%'+_0x3e40ee+'%';break;case _0xbd25('0x33'):_0x38ded8['start']=_0x3e40ee+'%';break;case'$endsWith':_0x38ded8['start']='%'+_0x3e40ee;break;case _0xbd25('0x14'):var _0x23fb05=_0x3e40ee['split'](',');var _0x3e40ee=_0x23fb05[_0xbd25('0xa')]();var _0x4ba1b7=_0x23fb05[_0xbd25('0x34')]();if(_0x448200===_0xbd25('0x12')){_0x3e40ee=moment(_0x3e40ee)[_0xbd25('0x35')](0x0,!![])[_0xbd25('0x1b')]();_0x4ba1b7=moment(_0x4ba1b7)['utcOffset'](0x0,!![])[_0xbd25('0x19')](0x17,_0xbd25('0x36'))[_0xbd25('0x19')](0x3b,_0xbd25('0x37'))[_0xbd25('0x19')](0x3b,_0xbd25('0x38'))['format']();}_0x38ded8={'start':_0x3e40ee,'end':_0x4ba1b7};break;default:_0x38ded8[_0xbd25('0x32')]=_0x3e40ee;break;}return _0x38ded8;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index 227bc18..81b4ffd 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 _0xba56=['limit','offset','sort','split','priority','cast','unsigned','substr','DESC','col','ASC','length','omit','isString','isNumeric','match','^[+]?[0-9]*$','isEmail','\x22{EXPR}\x22','{EXPR}','replace','getOptions','query','$id','map','intersection','model','attributes','hasOwnProperty','nolimit','order','where','filter','columns','value','merge','VIRTUAL','lower','options','lodash','moment','parse','includes','keys','fields','filters','isEmpty','forOwn','find','type','DATE','isPlainObject','$gte','YYYY-MM-DD','utc','format','subtract','name','uniqueid','isArray'];(function(_0x11d578,_0x5f955d){var _0x14f20f=function(_0x429a17){while(--_0x429a17){_0x11d578['push'](_0x11d578['shift']());}};_0x14f20f(++_0x5f955d);}(_0xba56,0x9f));var _0x6ba5=function(_0x3f288d,_0x3c7a97){_0x3f288d=_0x3f288d-0x0;var _0x5e8468=_0xba56[_0x3f288d];return _0x5e8468;};'use strict';var _=require(_0x6ba5('0x0'));var sequelize=require('sequelize');var moment=require(_0x6ba5('0x1'));var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x339464){var _0xc5c814=['ne'];try{var _0x298c3a=JSON[_0x6ba5('0x2')](_0x339464);var _0x2ee36e=Object['keys'](_0x298c3a)[0x0];return _0xc5c814[_0x6ba5('0x3')](_0x2ee36e);}catch(_0x201663){return![];}}function getOperatorValue(_0x101424){var _0x267df1=JSON[_0x6ba5('0x2')](_0x101424);var _0x4958b0=Object[_0x6ba5('0x4')](_0x267df1)[0x0];var _0x17411a=_0x267df1[_0x4958b0];return{['$'+_0x4958b0]:_0x17411a};}exports[_0x6ba5('0x5')]=function(_0x59d516){var _0x5daae0=null;if(_0x59d516){_0x5daae0=_0x59d516['split'](',');}return _0x5daae0;};exports[_0x6ba5('0x6')]=function(_0x182dd5,_0x1011d4){var _0x3e007e={};if(!_[_0x6ba5('0x7')](_0x182dd5)){_[_0x6ba5('0x8')](_0x182dd5,function(_0xc5425b,_0x46366e){try{if(_0x1011d4){var _0x35e422=_[_0x6ba5('0x9')](_0x1011d4,{'name':_0x46366e})||{};if(hasSequelizeOperator(_0xc5425b)){_0x3e007e[_0x46366e]=getOperatorValue(_0xc5425b);}else if(_0x35e422[_0x6ba5('0xa')]===_0x6ba5('0xb')&&_[_0x6ba5('0xc')](_0xc5425b)){var _0x205048=JSON[_0x6ba5('0x2')](_0xc5425b);var _0xe8c894={'$gte':moment(moment(_0x205048[_0x6ba5('0xd')])['format'](_0x6ba5('0xe')))[_0x6ba5('0xf')]()[_0x6ba5('0x10')](),'$lte':moment(moment(_0x205048['$lte'])[_0x6ba5('0x10')]('YYYY-MM-DD'))['utc']()[_0x6ba5('0x11')](0x1,'s')[_0x6ba5('0x10')]()};_0x3e007e[_0x46366e]=_0xe8c894;}else if(_0x35e422[_0x6ba5('0x12')]===_0x6ba5('0x13')){_0x3e007e[_0x46366e]=_0xc5425b;}else{_0x3e007e[_0x46366e]=_[_0x6ba5('0x14')](_0xc5425b)?_0xc5425b:JSON[_0x6ba5('0x2')](_0xc5425b);}}else{_0x3e007e[_0x46366e]=_[_0x6ba5('0x14')](_0xc5425b)?_0xc5425b:JSON[_0x6ba5('0x2')](_0xc5425b);}}catch(_0xf49a0d){_0x3e007e[_0x46366e]=_0xc5425b['split'](',');}});}return _0x3e007e;};exports[_0x6ba5('0x15')]=function(_0x234c7d){_0x234c7d=parseInt(_0x234c7d,0xa);if(!_0x234c7d||_0x234c7d<0x0){_0x234c7d=LIMIT_VALUE;}return _0x234c7d;};exports[_0x6ba5('0x16')]=function(_0x460e00){_0x460e00=parseInt(_0x460e00,0xa);if(!_0x460e00||_0x460e00<0x0){_0x460e00=0x0;}return _0x460e00;};exports[_0x6ba5('0x17')]=function(_0x23f518){var _0x4c8120,_0x2e53c6=null;if(_0x23f518){_0x4c8120=_0x23f518[_0x6ba5('0x18')](',');_0x2e53c6=_['map'](_0x4c8120,function(_0x7509a0){if(_0x7509a0['indexOf']('-')===0x0){return[_0x7509a0===_0x6ba5('0x19')?sequelize[_0x6ba5('0x1a')](sequelize['col'](_0x6ba5('0x19')),_0x6ba5('0x1b')):_0x7509a0[_0x6ba5('0x1c')](0x1),_0x6ba5('0x1d')];}else{return[_0x7509a0===_0x6ba5('0x19')?sequelize[_0x6ba5('0x1a')](sequelize[_0x6ba5('0x1e')](_0x6ba5('0x19')),_0x6ba5('0x1b')):_0x7509a0,_0x6ba5('0x1f')];}});}return _0x2e53c6;};exports['omit']=function(_0x4fcd44,_0x2deca4){if(_[_0x6ba5('0x7')](_0x4fcd44)){return _0x4fcd44;}if(_[_0x6ba5('0x14')](_0x4fcd44)){for(var _0x150f55=0x0;_0x150f55<_0x4fcd44[_0x6ba5('0x20')];_0x150f55+=0x1){_0x4fcd44[_0x150f55]=this[_0x6ba5('0x21')](_0x4fcd44[_0x150f55],_0x2deca4);}return _0x4fcd44;}if(!_['isObject'](_0x4fcd44)){return _0x4fcd44;}if(_[_0x6ba5('0x22')](_0x2deca4)){_0x2deca4=[_0x2deca4];}if(!_[_0x6ba5('0x14')](_0x2deca4)){return _0x4fcd44;}for(var _0x3689e9=0x0;_0x3689e9<_0x2deca4[_0x6ba5('0x20')];_0x3689e9+=0x1){_['unset'](_0x4fcd44,_0x2deca4[_0x3689e9]);}for(var _0x45b68e in _0x4fcd44){if(_0x4fcd44['hasOwnProperty'](_0x45b68e)){_0x4fcd44[_0x45b68e]=this['omit'](_0x4fcd44[_0x45b68e],_0x2deca4);}}return _0x4fcd44;};exports[_0x6ba5('0x23')]=function(_0x7209){return _0x7209[_0x6ba5('0x24')](RegExp(_0x6ba5('0x25')))?!![]:![];};exports[_0x6ba5('0x26')]=function(_0x30f1d6){return _0x30f1d6[_0x6ba5('0x24')](/^\S+@\S+$/)?!![]:![];};exports['getFullTextValue']=function(_0xe0cabd,_0x53facb){var _0x2a0a8c=[];var _0x277c8a=/[ `!@#$%^&*()_\-?~]/;var _0x400a54=_0x53facb?_0x6ba5('0x27'):_0x6ba5('0x28');_0xe0cabd[_0x6ba5('0x18')](/[ ,]+/)['forEach'](function(_0x3292cf){_0x3292cf=_0x3292cf[_0x6ba5('0x29')](/([^:]")"+/g,'$1');_0x3292cf='+'+_0x3292cf+'*';var _0x3d4044=_0x3292cf[_0x6ba5('0x24')](_0x277c8a);if(_0x3d4044){_0x3292cf='\x22'+_0x3292cf+'\x22';}_0x2a0a8c['push'](_0x3292cf);});_0x400a54=_0x400a54[_0x6ba5('0x29')](_0x6ba5('0x28'),_0x2a0a8c['join']('\x20'));return _0x400a54;};exports[_0x6ba5('0x2a')]=function(_0x795eac,_0x129e7e,_0x24b0b0){var _0x54a84b={},_0x557df7={};if(_0x129e7e[_0x6ba5('0x2b')][_0x6ba5('0x2c')]){_0x129e7e['query']['id']=_0x129e7e[_0x6ba5('0x2b')][_0x6ba5('0x2c')];delete _0x129e7e[_0x6ba5('0x2b')][_0x6ba5('0x2c')];}_0x54a84b['model']=_[_0x6ba5('0x2d')](_0x795eac,'name');_0x54a84b[_0x6ba5('0x2b')]=_['keys'](_0x129e7e[_0x6ba5('0x2b')]);_0x54a84b[_0x6ba5('0x6')]=_[_0x6ba5('0x2e')](_0x54a84b[_0x6ba5('0x2f')],_0x54a84b[_0x6ba5('0x2b')]);_0x557df7[_0x6ba5('0x30')]=_[_0x6ba5('0x2e')](_0x54a84b[_0x6ba5('0x2f')],this['fields'](_0x129e7e[_0x6ba5('0x2b')][_0x6ba5('0x5')]));_0x557df7[_0x6ba5('0x30')]=_0x557df7[_0x6ba5('0x30')][_0x6ba5('0x20')]?_0x557df7[_0x6ba5('0x30')]:_0x54a84b[_0x6ba5('0x2f')];if(!_0x129e7e['query'][_0x6ba5('0x31')](_0x6ba5('0x32'))){_0x557df7[_0x6ba5('0x15')]=this[_0x6ba5('0x15')](_0x129e7e[_0x6ba5('0x2b')][_0x6ba5('0x15')]);_0x557df7[_0x6ba5('0x16')]=this['offset'](_0x129e7e[_0x6ba5('0x2b')]['offset']);}_0x557df7[_0x6ba5('0x33')]=this['sort'](_0x129e7e['query'][_0x6ba5('0x17')]);_0x557df7[_0x6ba5('0x34')]=this[_0x6ba5('0x6')](_['pick'](_0x129e7e[_0x6ba5('0x2b')],_0x54a84b['filters']),_0x795eac);if(_0x129e7e[_0x6ba5('0x2b')][_0x6ba5('0x35')]){var _0x619add=_0x795eac;var _0x2f4b62=_0x129e7e[_0x6ba5('0x2b')][_0x6ba5('0x35')];if(typeof _0x2f4b62==='object'){_0x619add=_['filter'](_0x795eac,function(_0x355989){return _['includes'](_0x2f4b62[_0x6ba5('0x36')],_0x355989[_0x6ba5('0x12')]);});_0x2f4b62=_0x2f4b62[_0x6ba5('0x37')];}_0x557df7[_0x6ba5('0x34')]=_[_0x6ba5('0x38')](_0x557df7[_0x6ba5('0x34')],{'$or':_['map'](_0x619add,function(_0x2e2d4e){if(_0x2e2d4e[_0x6ba5('0xa')]!==_0x6ba5('0x39')){if(_0x24b0b0){return sequelize[_0x6ba5('0x34')](sequelize['fn'](_0x6ba5('0x3a'),sequelize[_0x6ba5('0x1e')](_0x2e2d4e[_0x6ba5('0x12')])),{'$like':sequelize['fn']('lower','%'+_0x129e7e[_0x6ba5('0x2b')][_0x6ba5('0x35')]+'%')});}else{var _0x2b4930={};_0x2b4930[_0x2e2d4e['name']]={'$like':'%'+_0x129e7e['query'][_0x6ba5('0x35')]+'%'};return _0x2b4930;}}})});}_0x557df7=_['merge']({},_0x557df7,_0x129e7e[_0x6ba5('0x3b')]);return _0x557df7;}; \ No newline at end of file +var _0x4d2f=['priority','cast','unsigned','substr','DESC','ASC','omit','isObject','isString','length','isNumeric','^[+]?[0-9]*$','isEmail','match','getFullTextValue','\x22{EXPR}\x22','{EXPR}','forEach','push','join','query','$id','model','attributes','hasOwnProperty','order','where','pick','filter','object','VIRTUAL','col','options','lodash','moment','parse','keys','includes','fields','split','filters','isEmpty','forOwn','find','type','DATE','isPlainObject','$gte','format','YYYY-MM-DD','$lte','utc','name','uniqueid','isArray','limit','offset','sort','map'];(function(_0x5b6092,_0x5563bd){var _0x3de6aa=function(_0x22732d){while(--_0x22732d){_0x5b6092['push'](_0x5b6092['shift']());}};_0x3de6aa(++_0x5563bd);}(_0x4d2f,0xd2));var _0xf4d2=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x4d2f[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0xf4d2('0x0'));var sequelize=require('sequelize');var moment=require(_0xf4d2('0x1'));var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x1cbd50){var _0xca7e1a=['ne'];try{var _0x482758=JSON[_0xf4d2('0x2')](_0x1cbd50);var _0x1f5217=Object[_0xf4d2('0x3')](_0x482758)[0x0];return _0xca7e1a[_0xf4d2('0x4')](_0x1f5217);}catch(_0x333d53){return![];}}function getOperatorValue(_0x432bc1){var _0x38ba21=JSON['parse'](_0x432bc1);var _0x2817fa=Object['keys'](_0x38ba21)[0x0];var _0x493728=_0x38ba21[_0x2817fa];return{['$'+_0x2817fa]:_0x493728};}exports[_0xf4d2('0x5')]=function(_0x1f43fd){var _0x227b36=null;if(_0x1f43fd){_0x227b36=_0x1f43fd[_0xf4d2('0x6')](',');}return _0x227b36;};exports[_0xf4d2('0x7')]=function(_0x44bf4e,_0x2effb9){var _0x2d7200={};if(!_[_0xf4d2('0x8')](_0x44bf4e)){_[_0xf4d2('0x9')](_0x44bf4e,function(_0x2d8d68,_0x3d812c){try{if(_0x2effb9){var _0x3f5a1b=_[_0xf4d2('0xa')](_0x2effb9,{'name':_0x3d812c})||{};if(hasSequelizeOperator(_0x2d8d68)){_0x2d7200[_0x3d812c]=getOperatorValue(_0x2d8d68);}else if(_0x3f5a1b[_0xf4d2('0xb')]===_0xf4d2('0xc')&&_[_0xf4d2('0xd')](_0x2d8d68)){var _0x578283=JSON[_0xf4d2('0x2')](_0x2d8d68);var _0x20ff1e={'$gte':moment(moment(_0x578283[_0xf4d2('0xe')])[_0xf4d2('0xf')](_0xf4d2('0x10')))['utc']()[_0xf4d2('0xf')](),'$lte':moment(moment(_0x578283[_0xf4d2('0x11')])[_0xf4d2('0xf')](_0xf4d2('0x10')))[_0xf4d2('0x12')]()['subtract'](0x1,'s')['format']()};_0x2d7200[_0x3d812c]=_0x20ff1e;}else if(_0x3f5a1b[_0xf4d2('0x13')]===_0xf4d2('0x14')){_0x2d7200[_0x3d812c]=_0x2d8d68;}else{_0x2d7200[_0x3d812c]=_['isArray'](_0x2d8d68)?_0x2d8d68:JSON[_0xf4d2('0x2')](_0x2d8d68);}}else{_0x2d7200[_0x3d812c]=_[_0xf4d2('0x15')](_0x2d8d68)?_0x2d8d68:JSON['parse'](_0x2d8d68);}}catch(_0x36dd61){_0x2d7200[_0x3d812c]=_0x2d8d68[_0xf4d2('0x6')](',');}});}return _0x2d7200;};exports[_0xf4d2('0x16')]=function(_0xa4c3dc){_0xa4c3dc=parseInt(_0xa4c3dc,0xa);if(!_0xa4c3dc||_0xa4c3dc<0x0){_0xa4c3dc=LIMIT_VALUE;}return _0xa4c3dc;};exports[_0xf4d2('0x17')]=function(_0x1b4490){_0x1b4490=parseInt(_0x1b4490,0xa);if(!_0x1b4490||_0x1b4490<0x0){_0x1b4490=0x0;}return _0x1b4490;};exports[_0xf4d2('0x18')]=function(_0x289ece){var _0x3b1eb8,_0x2dc1e3=null;if(_0x289ece){_0x3b1eb8=_0x289ece[_0xf4d2('0x6')](',');_0x2dc1e3=_[_0xf4d2('0x19')](_0x3b1eb8,function(_0x36c058){if(_0x36c058['indexOf']('-')===0x0){return[_0x36c058===_0xf4d2('0x1a')?sequelize[_0xf4d2('0x1b')](sequelize['col'](_0xf4d2('0x1a')),_0xf4d2('0x1c')):_0x36c058[_0xf4d2('0x1d')](0x1),_0xf4d2('0x1e')];}else{return[_0x36c058===_0xf4d2('0x1a')?sequelize[_0xf4d2('0x1b')](sequelize['col'](_0xf4d2('0x1a')),'unsigned'):_0x36c058,_0xf4d2('0x1f')];}});}return _0x2dc1e3;};exports[_0xf4d2('0x20')]=function(_0x123856,_0x1eff39){if(_[_0xf4d2('0x8')](_0x123856)){return _0x123856;}if(_['isArray'](_0x123856)){for(var _0x5e2c0d=0x0;_0x5e2c0d<_0x123856['length'];_0x5e2c0d+=0x1){_0x123856[_0x5e2c0d]=this[_0xf4d2('0x20')](_0x123856[_0x5e2c0d],_0x1eff39);}return _0x123856;}if(!_[_0xf4d2('0x21')](_0x123856)){return _0x123856;}if(_[_0xf4d2('0x22')](_0x1eff39)){_0x1eff39=[_0x1eff39];}if(!_[_0xf4d2('0x15')](_0x1eff39)){return _0x123856;}for(var _0x2e5828=0x0;_0x2e5828<_0x1eff39[_0xf4d2('0x23')];_0x2e5828+=0x1){_['unset'](_0x123856,_0x1eff39[_0x2e5828]);}for(var _0xe9e037 in _0x123856){if(_0x123856['hasOwnProperty'](_0xe9e037)){_0x123856[_0xe9e037]=this[_0xf4d2('0x20')](_0x123856[_0xe9e037],_0x1eff39);}}return _0x123856;};exports[_0xf4d2('0x24')]=function(_0x1f32d6){return _0x1f32d6['match'](RegExp(_0xf4d2('0x25')))?!![]:![];};exports[_0xf4d2('0x26')]=function(_0x38cfd8){return _0x38cfd8[_0xf4d2('0x27')](/^\S+@\S+$/)?!![]:![];};exports[_0xf4d2('0x28')]=function(_0x235249,_0x2bbc52){var _0x3ddbf9=[];var _0x3be4fb=/[ `!@#$%^&*()_\-?~]/;var _0x2042fa=_0x2bbc52?_0xf4d2('0x29'):_0xf4d2('0x2a');_0x235249[_0xf4d2('0x6')](/[ ,]+/)[_0xf4d2('0x2b')](function(_0x360d50){_0x360d50=_0x360d50['replace'](/([^:]")"+/g,'$1');_0x360d50='+'+_0x360d50+'*';var _0x465c21=_0x360d50[_0xf4d2('0x27')](_0x3be4fb);if(_0x465c21){_0x360d50='\x22'+_0x360d50+'\x22';}_0x3ddbf9[_0xf4d2('0x2c')](_0x360d50);});_0x2042fa=_0x2042fa['replace'](_0xf4d2('0x2a'),_0x3ddbf9[_0xf4d2('0x2d')]('\x20'));return _0x2042fa;};exports['getOptions']=function(_0x75b1f0,_0x2f4766,_0x41534f){var _0x2b5a28={},_0x25f6cf={};if(_0x2f4766[_0xf4d2('0x2e')][_0xf4d2('0x2f')]){_0x2f4766[_0xf4d2('0x2e')]['id']=_0x2f4766[_0xf4d2('0x2e')]['$id'];delete _0x2f4766[_0xf4d2('0x2e')][_0xf4d2('0x2f')];}_0x2b5a28[_0xf4d2('0x30')]=_[_0xf4d2('0x19')](_0x75b1f0,_0xf4d2('0x13'));_0x2b5a28['query']=_[_0xf4d2('0x3')](_0x2f4766[_0xf4d2('0x2e')]);_0x2b5a28['filters']=_['intersection'](_0x2b5a28['model'],_0x2b5a28[_0xf4d2('0x2e')]);_0x25f6cf['attributes']=_['intersection'](_0x2b5a28[_0xf4d2('0x30')],this['fields'](_0x2f4766[_0xf4d2('0x2e')][_0xf4d2('0x5')]));_0x25f6cf[_0xf4d2('0x31')]=_0x25f6cf['attributes'][_0xf4d2('0x23')]?_0x25f6cf[_0xf4d2('0x31')]:_0x2b5a28[_0xf4d2('0x30')];if(!_0x2f4766['query'][_0xf4d2('0x32')]('nolimit')){_0x25f6cf[_0xf4d2('0x16')]=this[_0xf4d2('0x16')](_0x2f4766[_0xf4d2('0x2e')][_0xf4d2('0x16')]);_0x25f6cf[_0xf4d2('0x17')]=this[_0xf4d2('0x17')](_0x2f4766[_0xf4d2('0x2e')][_0xf4d2('0x17')]);}_0x25f6cf[_0xf4d2('0x33')]=this[_0xf4d2('0x18')](_0x2f4766[_0xf4d2('0x2e')]['sort']);_0x25f6cf[_0xf4d2('0x34')]=this[_0xf4d2('0x7')](_[_0xf4d2('0x35')](_0x2f4766[_0xf4d2('0x2e')],_0x2b5a28[_0xf4d2('0x7')]),_0x75b1f0);if(_0x2f4766[_0xf4d2('0x2e')][_0xf4d2('0x36')]){var _0x2d7132=_0x75b1f0;var _0x2d1a20=_0x2f4766[_0xf4d2('0x2e')]['filter'];if(typeof _0x2d1a20===_0xf4d2('0x37')){_0x2d7132=_[_0xf4d2('0x36')](_0x75b1f0,function(_0x23caca){return _[_0xf4d2('0x4')](_0x2d1a20['columns'],_0x23caca[_0xf4d2('0x13')]);});_0x2d1a20=_0x2d1a20['value'];}_0x25f6cf[_0xf4d2('0x34')]=_['merge'](_0x25f6cf[_0xf4d2('0x34')],{'$or':_[_0xf4d2('0x19')](_0x2d7132,function(_0x264f15){if(_0x264f15[_0xf4d2('0xb')]!==_0xf4d2('0x38')){if(_0x41534f){return sequelize[_0xf4d2('0x34')](sequelize['fn']('lower',sequelize[_0xf4d2('0x39')](_0x264f15['name'])),{'$like':sequelize['fn']('lower','%'+_0x2f4766[_0xf4d2('0x2e')][_0xf4d2('0x36')]+'%')});}else{var _0x88e433={};_0x88e433[_0x264f15[_0xf4d2('0x13')]]={'$like':'%'+_0x2f4766[_0xf4d2('0x2e')][_0xf4d2('0x36')]+'%'};return _0x88e433;}}})});}_0x25f6cf=_['merge']({},_0x25f6cf,_0x2f4766[_0xf4d2('0x3a')]);return _0x25f6cf;}; \ No newline at end of file diff --git a/server/components/realtime/agents.js b/server/components/realtime/agents.js index 4ac4cab..091ada4 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 _0xada1=['merge','catch','getRealtimeAgents','busy','getAgentStatus','isArray','startCase','Queue','map','findOne','then','getAgents','getAgentIdsByQueues','includes','getAgentIdsByStatus','User','findAll','name','fullname','whatsappPause','pauseType','getSortedAgentsIdsByStatus','split','fields','globalStatus','order','startsWith','DESC','getUpdatedSortOptions','internal','substring','indexOf','toLowerCase','sortAgentsByStatus','userpic','online','lastLoginAt','lastPauseAt','address','faxPause','chatCapacity','openchannelCapacity','mailCapacity','smsCapacity','whatsappCapacity','chatCurrentCapacity','openchannelCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity','chatStatusTime','openchannelStatusTime','mailStatusTime','smsStatusTime','faxStatusTime','voiceStatusTime','queue','destconnectedlinenum','screenrecording','phoneBarEnableAutomaticScreenRecording','routealias','omit','pick','value','filterAgentAttributes','lodash','jayson/promise','http','chatPause','mailPause','openchannelPause','smsPause','voicePause','every','filter','length','idle','unknown','unavailable','ringing','isNil','voiceStatus','pause','chatStatus','faxStatus','openchannelStatus','smsStatus','whatsappStatus','request','error','result','Agents'];(function(_0x967959,_0x53c5c1){var _0x5c4489=function(_0x1ae5c6){while(--_0x1ae5c6){_0x967959['push'](_0x967959['shift']());}};_0x5c4489(++_0x53c5c1);}(_0xada1,0x151));var _0x1ada=function(_0x4b2436,_0x452299){_0x4b2436=_0x4b2436-0x0;var _0x4f5ab2=_0xada1[_0x4b2436];return _0x4f5ab2;};'use strict';var _=require(_0x1ada('0x0'));var jayson=require(_0x1ada('0x1'));var db=require('../../mysqldb')['db'];var amiClient=jayson['client'][_0x1ada('0x2')]({'port':0x232a});var routingClient=jayson['client'][_0x1ada('0x2')]({'port':0x232c});function isAgentPaused(_0x4f3d68,_0x56d3ea){var _0x19356b=[_0x4f3d68[_0x1ada('0x3')],_0x4f3d68['faxPause'],_0x4f3d68[_0x1ada('0x4')],_0x4f3d68[_0x1ada('0x5')],_0x4f3d68[_0x1ada('0x6')],_0x4f3d68[_0x1ada('0x7')],_0x4f3d68['whatsappPause']];if(!_0x56d3ea)return _[_0x1ada('0x8')](_0x19356b);var _0x55e538=_[_0x1ada('0x9')](_0x19356b);return _0x55e538[_0x1ada('0xa')]>0x0&&_0x55e538[_0x1ada('0xa')]<_0x19356b[_0x1ada('0xa')]?!![]:![];}function isIdle(_0x2ad99b){return _0x2ad99b===_0x1ada('0xb')||_0x2ad99b===_0x1ada('0xc')||_0x2ad99b===_0x1ada('0xd')||_0x2ad99b===_0x1ada('0xe')||_[_0x1ada('0xf')](_0x2ad99b);}function isAgentIdle(_0x22492f){if(_0x22492f[_0x1ada('0x10')]!=='idle'&&_0x22492f[_0x1ada('0x7')]){_0x22492f[_0x1ada('0x10')]=_0x1ada('0x11');return![];}return _[_0x1ada('0x8')]([_0x22492f[_0x1ada('0x12')],_0x22492f[_0x1ada('0x13')],_0x22492f['mailStatus'],_0x22492f[_0x1ada('0x14')],_0x22492f[_0x1ada('0x15')],_0x22492f[_0x1ada('0x10')],_0x22492f[_0x1ada('0x16')]],isIdle);}function getRealtimeAgents(){return amiClient[_0x1ada('0x17')]('Agents',{})['then'](function(_0x111483){if(_0x111483[_0x1ada('0x18')]){throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)');}var _0x1fa1bc=_0x111483[_0x1ada('0x19')];return routingClient['request'](_0x1ada('0x1a'),{})['then'](function(_0x381e4d){if(_0x381e4d[_0x1ada('0x18')]){throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)');}var _0x2edaee=_0x381e4d[_0x1ada('0x19')];return _[_0x1ada('0x1b')]({},_0x1fa1bc,_0x2edaee);});})[_0x1ada('0x1c')](function(_0x490a43){throw _0x490a43;});}exports[_0x1ada('0x1d')]=getRealtimeAgents;function getAgentStatus(_0x242dde){var _0xb7b87c='unknown';if(isAgentPaused(_0x242dde))_0xb7b87c=_0x1ada('0x11');else if(isAgentPaused(_0x242dde,!![]))_0xb7b87c='*pause';else if(isAgentIdle(_0x242dde))_0xb7b87c=_0x1ada('0xb');else _0xb7b87c=_0x1ada('0x1e');return _0xb7b87c;}exports[_0x1ada('0x1f')]=getAgentStatus;function getAgentIdsByQueues(_0x4e0a43,_0x2e40d5){var _0x5a2d02=_[_0x1ada('0x20')](_0x4e0a43)?_0x4e0a43:[_0x4e0a43];var _0x13e38b=_[_0x1ada('0x21')](_0x2e40d5)+_0x1ada('0x22');var _0x383d95=_[_0x1ada('0x23')](_0x5a2d02,function(_0x1c495f){return db[_0x13e38b][_0x1ada('0x24')]({'where':{'id':_0x1c495f}})[_0x1ada('0x25')](function(_0x4ec6e3){if(!_0x4ec6e3)return[];return _0x4ec6e3[_0x1ada('0x26')]({'attributes':['id'],'raw':!![]});});});return Promise['all'](_0x383d95)[_0x1ada('0x25')](function(_0x269e2d){var _0x376c8c=_(_0x269e2d)['flatten']()[_0x1ada('0x23')]('id')['uniq']()['value']();return _0x376c8c;});}exports[_0x1ada('0x27')]=getAgentIdsByQueues;function getAgentIdsByStatus(_0x479b04,_0x5e2cea,_0x525c0b){try{if(_0x5e2cea[_0x1ada('0xa')]>0x0){_0x479b04=_0x479b04[_0x1ada('0x9')](function(_0x4c0b4b){return _0x5e2cea[_0x1ada('0x28')](_0x4c0b4b['id']);});}var _0x18c258=_0x479b04[_0x1ada('0x9')](function(_0x1ebed5){var _0x38304b='busy';if(isAgentIdle(_0x1ebed5)){_0x38304b=_0x1ada('0xb');}return _0x38304b===_0x525c0b;});return _['map'](_0x18c258,'id');}catch(_0x45c8ea){throw _0x45c8ea;}}exports[_0x1ada('0x29')]=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x224baa,_0x505402,_0x39c486){return Promise['resolve']()[_0x1ada('0x25')](function(){if(_0x505402[_0x1ada('0xa')]>0x0){_0x224baa=_0x224baa[_0x1ada('0x9')](function(_0x4ffc7e){return _0x505402[_0x1ada('0x28')](_0x4ffc7e['id']);});}return _0x224baa;})['then'](function(){return db[_0x1ada('0x2a')][_0x1ada('0x2b')]({'attributes':['id',_0x1ada('0x2c'),_0x1ada('0x2d'),_0x1ada('0x3'),'faxPause','mailPause',_0x1ada('0x5'),_0x1ada('0x6'),_0x1ada('0x7'),_0x1ada('0x2e'),_0x1ada('0x2f')],'where':{'id':{'$in':_[_0x1ada('0x23')](_0x224baa,'id')}},'raw':!![]});})[_0x1ada('0x25')](function(_0x304e85){return _0x304e85[_0x1ada('0x23')](function(_0x4c1213){var _0x56e209=_['find'](_0x224baa,['id',_0x4c1213['id']]);var _0x395538=filterAgentAttributes(_0x56e209);_[_0x1ada('0x1b')](_0x4c1213,_0x395538);_0x4c1213['globalStatus']=getAgentStatus(_0x4c1213);return _0x4c1213;});})[_0x1ada('0x25')](function(_0x3a8a76){var _0x190bda=sortAgentsByStatus(_0x3a8a76,_0x39c486);return _[_0x1ada('0x23')](_0x190bda,'id');})[_0x1ada('0x1c')](function(_0x212751){throw _0x212751;});}exports[_0x1ada('0x30')]=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x38aa33){var _0x4ef680={'fields':[],'order':null};var _0x5d3e6f=_0x38aa33[_0x1ada('0x31')](',');_0x4ef680[_0x1ada('0x32')]=_[_0x1ada('0x9')](_0x5d3e6f,function(_0x5dfa01){if(!_0x5dfa01[_0x1ada('0x28')](_0x1ada('0x33'))){return!![];}_0x4ef680[_0x1ada('0x34')]=_[_0x1ada('0x35')](_0x5dfa01,'-')?_0x1ada('0x36'):'ASC';return![];});return _0x4ef680;}exports[_0x1ada('0x37')]=getUpdatedSortOptions;function validateSortParameter(_0x404ea4){if(_0x404ea4[_0x1ada('0x28')](_0x1ada('0x2d'))&&!_0x404ea4[_0x1ada('0x28')](_0x1ada('0x38'))){var _0x11c708=_0x404ea4[_0x1ada('0x39')](0x0,_0x404ea4[_0x1ada('0x3a')](_0x1ada('0x2d')));_0x404ea4+=','+_0x11c708+_0x1ada('0x38');}return _0x404ea4;}exports['validateSortParameter']=validateSortParameter;function sortAgentsByStatus(_0x2b9029,_0x20a99e){var _0x76f0f7=_0x2b9029['sort'](function(_0x326299,_0x56a730){if(_0x326299[_0x1ada('0x33')]===_0x56a730[_0x1ada('0x33')]){if(_0x326299['globalStatus']===_0x1ada('0x11')){if(_0x20a99e===_0x1ada('0x36')){return(_0x326299[_0x1ada('0x2f')]||'')<(_0x56a730[_0x1ada('0x2f')]||'')||_0x326299[_0x1ada('0x2d')][_0x1ada('0x3b')]()>_0x56a730[_0x1ada('0x2d')]['toLowerCase']()?0x1:-0x1;}else{return(_0x326299[_0x1ada('0x2f')]||'')<(_0x56a730['pauseType']||'')||_0x326299['fullname'][_0x1ada('0x3b')]()>_0x56a730[_0x1ada('0x2d')][_0x1ada('0x3b')]()?-0x1:0x1;}}else{if(_0x20a99e===_0x1ada('0x36')){return _0x326299[_0x1ada('0x2d')][_0x1ada('0x3b')]()<_0x56a730[_0x1ada('0x2d')][_0x1ada('0x3b')]()?0x1:-0x1;}else{return _0x326299[_0x1ada('0x2d')][_0x1ada('0x3b')]()<_0x56a730['fullname'][_0x1ada('0x3b')]()?-0x1:0x1;}}}else{if(_0x20a99e==='DESC'){return _0x326299[_0x1ada('0x33')]<_0x56a730[_0x1ada('0x33')]?0x1:-0x1;}else{return _0x326299['globalStatus']<_0x56a730[_0x1ada('0x33')]?-0x1:0x1;}}});return _0x76f0f7;}exports[_0x1ada('0x3c')]=sortAgentsByStatus;function filterAgentAttributes(_0x1bed18){var _0x2592ad=[_0x1ada('0x3d'),_0x1ada('0x3e'),_0x1ada('0x3f'),_0x1ada('0x40'),_0x1ada('0x2f'),_0x1ada('0x40'),_0x1ada('0x38'),_0x1ada('0x41'),_0x1ada('0x3'),_0x1ada('0x5'),_0x1ada('0x4'),_0x1ada('0x6'),_0x1ada('0x2e'),_0x1ada('0x42'),_0x1ada('0x7'),_0x1ada('0x43'),_0x1ada('0x44'),_0x1ada('0x45'),_0x1ada('0x46'),_0x1ada('0x47'),'faxCapacity',_0x1ada('0x48'),_0x1ada('0x49'),'mailCurrentCapacity','smsCurrentCapacity',_0x1ada('0x4a'),_0x1ada('0x4b'),_0x1ada('0x12'),_0x1ada('0x14'),'mailStatus',_0x1ada('0x15'),_0x1ada('0x16'),_0x1ada('0x13'),'voiceStatus',_0x1ada('0x4c'),_0x1ada('0x4d'),_0x1ada('0x4e'),_0x1ada('0x4f'),'whatsappStatusTime',_0x1ada('0x50'),_0x1ada('0x51'),_0x1ada('0x52'),_0x1ada('0x53'),_0x1ada('0x54'),'phoneBarEnableScreenRecordingByAgent',_0x1ada('0x55'),_0x1ada('0x56')];var _0x4573a3=[_0x1ada('0x3'),_0x1ada('0x5'),'mailPause','smsPause',_0x1ada('0x2e'),_0x1ada('0x42'),_0x1ada('0x7'),_0x1ada('0x3e')];var _0x2d2f04=_(_0x1bed18)[_0x1ada('0x57')](_0x4573a3)[_0x1ada('0x58')](_0x2592ad)[_0x1ada('0x59')]();return _0x2d2f04;}exports[_0x1ada('0x5a')]=filterAgentAttributes; \ No newline at end of file +var _0x11d3=['mailCapacity','whatsappCapacity','faxCapacity','mailCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity','mailStatusTime','smsStatusTime','whatsappStatusTime','faxStatusTime','destconnectedlinenum','screenrecording','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','routealias','omit','lodash','../../mysqldb','client','http','chatPause','faxPause','mailPause','openchannelPause','smsPause','voicePause','length','idle','unknown','unavailable','ringing','isNil','voiceStatus','pause','chatStatus','faxStatus','mailStatus','openchannelStatus','smsStatus','whatsappStatus','request','Agents','then','error','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','merge','catch','getRealtimeAgents','getAgentStatus','isArray','startCase','map','findOne','getAgents','all','flatten','uniq','value','getAgentIdsByQueues','filter','includes','busy','getAgentIdsByStatus','resolve','findAll','name','whatsappPause','pauseType','globalStatus','getSortedAgentsIdsByStatus','split','fields','startsWith','ASC','getUpdatedSortOptions','fullname','substring','indexOf','internal','validateSortParameter','sort','DESC','toLowerCase','sortAgentsByStatus','userpic','online','lastLoginAt','lastPauseAt','openchannelCapacity'];(function(_0x1beef3,_0x57c4b8){var _0x5af964=function(_0x36f463){while(--_0x36f463){_0x1beef3['push'](_0x1beef3['shift']());}};_0x5af964(++_0x57c4b8);}(_0x11d3,0x6d));var _0x311d=function(_0x2ef291,_0x11d6f5){_0x2ef291=_0x2ef291-0x0;var _0x2c374b=_0x11d3[_0x2ef291];return _0x2c374b;};'use strict';var _=require(_0x311d('0x0'));var jayson=require('jayson/promise');var db=require(_0x311d('0x1'))['db'];var amiClient=jayson[_0x311d('0x2')][_0x311d('0x3')]({'port':0x232a});var routingClient=jayson[_0x311d('0x2')][_0x311d('0x3')]({'port':0x232c});function isAgentPaused(_0x814a7,_0x4432fe){var _0x594b5b=[_0x814a7[_0x311d('0x4')],_0x814a7[_0x311d('0x5')],_0x814a7[_0x311d('0x6')],_0x814a7[_0x311d('0x7')],_0x814a7[_0x311d('0x8')],_0x814a7[_0x311d('0x9')],_0x814a7['whatsappPause']];if(!_0x4432fe)return _['every'](_0x594b5b);var _0x231be=_['filter'](_0x594b5b);return _0x231be['length']>0x0&&_0x231be[_0x311d('0xa')]<_0x594b5b[_0x311d('0xa')]?!![]:![];}function isIdle(_0x4e58a3){return _0x4e58a3===_0x311d('0xb')||_0x4e58a3===_0x311d('0xc')||_0x4e58a3===_0x311d('0xd')||_0x4e58a3===_0x311d('0xe')||_[_0x311d('0xf')](_0x4e58a3);}function isAgentIdle(_0x49210c){if(_0x49210c[_0x311d('0x10')]!==_0x311d('0xb')&&_0x49210c[_0x311d('0x9')]){_0x49210c[_0x311d('0x10')]=_0x311d('0x11');return![];}return _['every']([_0x49210c[_0x311d('0x12')],_0x49210c[_0x311d('0x13')],_0x49210c[_0x311d('0x14')],_0x49210c[_0x311d('0x15')],_0x49210c[_0x311d('0x16')],_0x49210c[_0x311d('0x10')],_0x49210c[_0x311d('0x17')]],isIdle);}function getRealtimeAgents(){return amiClient[_0x311d('0x18')](_0x311d('0x19'),{})[_0x311d('0x1a')](function(_0xb438e1){if(_0xb438e1[_0x311d('0x1b')]){throw new Error(_0x311d('0x1c'));}var _0xe07707=_0xb438e1[_0x311d('0x1d')];return routingClient[_0x311d('0x18')]('Agents',{})[_0x311d('0x1a')](function(_0x34d9c4){if(_0x34d9c4['error']){throw new Error(_0x311d('0x1e'));}var _0x33dda9=_0x34d9c4[_0x311d('0x1d')];return _[_0x311d('0x1f')]({},_0xe07707,_0x33dda9);});})[_0x311d('0x20')](function(_0x1d75a8){throw _0x1d75a8;});}exports[_0x311d('0x21')]=getRealtimeAgents;function getAgentStatus(_0x3a7a54){var _0x2e7319='unknown';if(isAgentPaused(_0x3a7a54))_0x2e7319=_0x311d('0x11');else if(isAgentPaused(_0x3a7a54,!![]))_0x2e7319='*pause';else if(isAgentIdle(_0x3a7a54))_0x2e7319=_0x311d('0xb');else _0x2e7319='busy';return _0x2e7319;}exports[_0x311d('0x22')]=getAgentStatus;function getAgentIdsByQueues(_0x4fead3,_0xb84cb){var _0x90c4a=_[_0x311d('0x23')](_0x4fead3)?_0x4fead3:[_0x4fead3];var _0x3b27ff=_[_0x311d('0x24')](_0xb84cb)+'Queue';var _0x1e072d=_[_0x311d('0x25')](_0x90c4a,function(_0x180936){return db[_0x3b27ff][_0x311d('0x26')]({'where':{'id':_0x180936}})[_0x311d('0x1a')](function(_0x5671ca){if(!_0x5671ca)return[];return _0x5671ca[_0x311d('0x27')]({'attributes':['id'],'raw':!![]});});});return Promise[_0x311d('0x28')](_0x1e072d)[_0x311d('0x1a')](function(_0x216513){var _0x45a1a7=_(_0x216513)[_0x311d('0x29')]()[_0x311d('0x25')]('id')[_0x311d('0x2a')]()[_0x311d('0x2b')]();return _0x45a1a7;});}exports[_0x311d('0x2c')]=getAgentIdsByQueues;function getAgentIdsByStatus(_0x41631b,_0x32f0f6,_0x242a9d){try{if(_0x32f0f6['length']>0x0){_0x41631b=_0x41631b[_0x311d('0x2d')](function(_0x52363c){return _0x32f0f6[_0x311d('0x2e')](_0x52363c['id']);});}var _0x1c36b4=_0x41631b['filter'](function(_0x1a7f16){var _0x12fc75=_0x311d('0x2f');if(isAgentIdle(_0x1a7f16)){_0x12fc75=_0x311d('0xb');}return _0x12fc75===_0x242a9d;});return _[_0x311d('0x25')](_0x1c36b4,'id');}catch(_0x9f48fc){throw _0x9f48fc;}}exports[_0x311d('0x30')]=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x13feda,_0x5667dc,_0xd86310){return Promise[_0x311d('0x31')]()[_0x311d('0x1a')](function(){if(_0x5667dc[_0x311d('0xa')]>0x0){_0x13feda=_0x13feda[_0x311d('0x2d')](function(_0x37f5cc){return _0x5667dc[_0x311d('0x2e')](_0x37f5cc['id']);});}return _0x13feda;})[_0x311d('0x1a')](function(){return db['User'][_0x311d('0x32')]({'attributes':['id',_0x311d('0x33'),'fullname',_0x311d('0x4'),_0x311d('0x5'),_0x311d('0x6'),'openchannelPause',_0x311d('0x8'),_0x311d('0x9'),_0x311d('0x34'),_0x311d('0x35')],'where':{'id':{'$in':_[_0x311d('0x25')](_0x13feda,'id')}},'raw':!![]});})[_0x311d('0x1a')](function(_0x76bca0){return _0x76bca0['map'](function(_0x574474){var _0x16b588=_['find'](_0x13feda,['id',_0x574474['id']]);var _0xe62223=filterAgentAttributes(_0x16b588);_[_0x311d('0x1f')](_0x574474,_0xe62223);_0x574474[_0x311d('0x36')]=getAgentStatus(_0x574474);return _0x574474;});})[_0x311d('0x1a')](function(_0x4f51e9){var _0x599db4=sortAgentsByStatus(_0x4f51e9,_0xd86310);return _[_0x311d('0x25')](_0x599db4,'id');})[_0x311d('0x20')](function(_0x1e189e){throw _0x1e189e;});}exports[_0x311d('0x37')]=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x274035){var _0x43cd29={'fields':[],'order':null};var _0x461dfa=_0x274035[_0x311d('0x38')](',');_0x43cd29[_0x311d('0x39')]=_[_0x311d('0x2d')](_0x461dfa,function(_0x32562e){if(!_0x32562e[_0x311d('0x2e')](_0x311d('0x36'))){return!![];}_0x43cd29['order']=_[_0x311d('0x3a')](_0x32562e,'-')?'DESC':_0x311d('0x3b');return![];});return _0x43cd29;}exports[_0x311d('0x3c')]=getUpdatedSortOptions;function validateSortParameter(_0x2fa1bf){if(_0x2fa1bf[_0x311d('0x2e')](_0x311d('0x3d'))&&!_0x2fa1bf[_0x311d('0x2e')]('internal')){var _0x1a5784=_0x2fa1bf[_0x311d('0x3e')](0x0,_0x2fa1bf[_0x311d('0x3f')](_0x311d('0x3d')));_0x2fa1bf+=','+_0x1a5784+_0x311d('0x40');}return _0x2fa1bf;}exports[_0x311d('0x41')]=validateSortParameter;function sortAgentsByStatus(_0x50e26a,_0x47650f){var _0x2f7444=_0x50e26a[_0x311d('0x42')](function(_0x5b8f3c,_0x39fd73){if(_0x5b8f3c['globalStatus']===_0x39fd73[_0x311d('0x36')]){if(_0x5b8f3c[_0x311d('0x36')]===_0x311d('0x11')){if(_0x47650f===_0x311d('0x43')){return(_0x5b8f3c[_0x311d('0x35')]||'')<(_0x39fd73[_0x311d('0x35')]||'')||_0x5b8f3c[_0x311d('0x3d')]['toLowerCase']()>_0x39fd73[_0x311d('0x3d')][_0x311d('0x44')]()?0x1:-0x1;}else{return(_0x5b8f3c['pauseType']||'')<(_0x39fd73[_0x311d('0x35')]||'')||_0x5b8f3c[_0x311d('0x3d')][_0x311d('0x44')]()>_0x39fd73[_0x311d('0x3d')][_0x311d('0x44')]()?-0x1:0x1;}}else{if(_0x47650f===_0x311d('0x43')){return _0x5b8f3c[_0x311d('0x3d')][_0x311d('0x44')]()<_0x39fd73[_0x311d('0x3d')][_0x311d('0x44')]()?0x1:-0x1;}else{return _0x5b8f3c[_0x311d('0x3d')][_0x311d('0x44')]()<_0x39fd73[_0x311d('0x3d')][_0x311d('0x44')]()?-0x1:0x1;}}}else{if(_0x47650f==='DESC'){return _0x5b8f3c[_0x311d('0x36')]<_0x39fd73['globalStatus']?0x1:-0x1;}else{return _0x5b8f3c[_0x311d('0x36')]<_0x39fd73[_0x311d('0x36')]?-0x1:0x1;}}});return _0x2f7444;}exports[_0x311d('0x45')]=sortAgentsByStatus;function filterAgentAttributes(_0x338bfc){var _0x6c3a9d=[_0x311d('0x46'),_0x311d('0x47'),_0x311d('0x48'),_0x311d('0x49'),'pauseType',_0x311d('0x49'),_0x311d('0x40'),'address',_0x311d('0x4'),_0x311d('0x7'),_0x311d('0x6'),'smsPause',_0x311d('0x34'),_0x311d('0x5'),_0x311d('0x9'),'chatCapacity',_0x311d('0x4a'),_0x311d('0x4b'),'smsCapacity',_0x311d('0x4c'),_0x311d('0x4d'),'chatCurrentCapacity','openchannelCurrentCapacity',_0x311d('0x4e'),_0x311d('0x4f'),_0x311d('0x50'),_0x311d('0x51'),_0x311d('0x12'),_0x311d('0x15'),_0x311d('0x14'),_0x311d('0x16'),_0x311d('0x17'),_0x311d('0x13'),_0x311d('0x10'),'chatStatusTime','openchannelStatusTime',_0x311d('0x52'),_0x311d('0x53'),_0x311d('0x54'),_0x311d('0x55'),'voiceStatusTime','queue',_0x311d('0x56'),_0x311d('0x57'),_0x311d('0x58'),_0x311d('0x59'),_0x311d('0x5a')];var _0x44e881=[_0x311d('0x4'),_0x311d('0x7'),_0x311d('0x6'),_0x311d('0x8'),_0x311d('0x34'),_0x311d('0x5'),_0x311d('0x9'),_0x311d('0x47')];var _0x1a8015=_(_0x338bfc)[_0x311d('0x5b')](_0x44e881)['pick'](_0x6c3a9d)[_0x311d('0x2b')]();return _0x1a8015;}exports['filterAgentAttributes']=filterAgentAttributes; \ No newline at end of file diff --git a/server/components/realtime/queues.js b/server/components/realtime/queues.js index f8c23ec..73f68fb 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 _0x6d7f=['available','waiting','find','merge','pick','initializeQueues','lodash','jayson/promise','util','http','client','loggedIn','busy','inUse','invalid','notInUse','onHold','ringing','ringInUse','talking','unavailable','pTalking','originated','dialActive','Trunk','startPredictive','startProgressive','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','voice','request','Queues','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','catch','getRealtimeQueues','inbound','concat','outbound','map','get','paused','loggedInDb'];(function(_0x1ab327,_0x424250){var _0x5e43cf=function(_0xec4983){while(--_0xec4983){_0x1ab327['push'](_0x1ab327['shift']());}};_0x5e43cf(++_0x424250);}(_0x6d7f,0x1ec));var _0xf6d7=function(_0x456a43,_0x471c3a){_0x456a43=_0x456a43-0x0;var _0xfe97de=_0x6d7f[_0x456a43];return _0xfe97de;};'use strict';var _=require(_0xf6d7('0x0'));var jayson=require(_0xf6d7('0x1'));var util=require(_0xf6d7('0x2'));var amiClient=jayson['client'][_0xf6d7('0x3')]({'port':0x232a});var routingClient=jayson[_0xf6d7('0x4')]['http']({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=['available',_0xf6d7('0x5'),'paused','waiting'];var VOICE_QUEUE_ATTRIBUTES=[_0xf6d7('0x6'),_0xf6d7('0x7'),_0xf6d7('0x8'),'loggedInDb',_0xf6d7('0x9'),_0xf6d7('0xa'),_0xf6d7('0xb'),_0xf6d7('0xc'),_0xf6d7('0xd'),_0xf6d7('0xe'),'unknown'];var OUTBOUND_QUEUE_ATTRIBUTES=[_0xf6d7('0xf'),_0xf6d7('0x10'),'message','statusMessage',_0xf6d7('0x11'),'dialMethod',_0xf6d7('0x12'),_0xf6d7('0x13'),_0xf6d7('0x14'),_0xf6d7('0x15'),_0xf6d7('0x16'),_0xf6d7('0x17'),_0xf6d7('0x18'),_0xf6d7('0x19'),_0xf6d7('0x1a'),_0xf6d7('0x1b'),_0xf6d7('0x1c'),'predictiveIntervalTotalCalls',_0xf6d7('0x1d'),_0xf6d7('0x1e'),_0xf6d7('0x1f'),_0xf6d7('0x20'),'predictiveIntervalAvgTalktime'];function getRealtimeQueues(_0x216e4f,_0xe9c956){var _0x858d8e=_0xe9c956===_0xf6d7('0x21')?amiClient:routingClient;return _0x858d8e[_0xf6d7('0x22')](_['startCase'](_0xe9c956)+_0xf6d7('0x23'),_0x216e4f)['then'](function(_0x308c9d){if(_0x308c9d['error'])throw new Error(util[_0xf6d7('0x24')](_0xf6d7('0x25'),_0xe9c956));return _0x308c9d[_0xf6d7('0x26')];})[_0xf6d7('0x27')](function(_0x31e98f){throw _0x31e98f;});}exports[_0xf6d7('0x28')]=getRealtimeQueues;function initializeQueues(_0x2a0463,_0x47936f,_0xef71fe,_0x4bc8d1){var _0x47532f=DEFAULT_QUEUE_ATTRIBUTES;if(_0xef71fe===_0xf6d7('0x21')){if(_0x4bc8d1===_0xf6d7('0x29')){_0x47532f=_0x47532f[_0xf6d7('0x2a')](VOICE_QUEUE_ATTRIBUTES);}else if(_0x4bc8d1===_0xf6d7('0x2b')){_0x47532f=_0x47532f['concat'](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x2a0463[_0xf6d7('0x2c')](function(_0x494fb4){var _0x4f2b9e=_0x494fb4[_0xf6d7('0x2d')]({'plain':!![]});_0x4f2b9e[_0xf6d7('0x2e')]=0x0;_0x4f2b9e[_0xf6d7('0x2f')]=0x0;_0x4f2b9e[_0xf6d7('0x5')]=0x0;_0x4f2b9e[_0xf6d7('0x30')]=0x0;_0x4f2b9e[_0xf6d7('0x31')]=0x0;if(_0xef71fe===_0xf6d7('0x21')){_0x4f2b9e[_0xf6d7('0xd')]=0x0;_0x4f2b9e[_0xf6d7('0x6')]=0x0;if(_0x4bc8d1===_0xf6d7('0x2b')){_0x4f2b9e['pTalking']=0x0;_0x4f2b9e[_0xf6d7('0x10')]=0x0;}}var _0xdae331=_[_0xf6d7('0x32')](_0x47936f,['id',_0x4f2b9e['id']]);if(_0xdae331){_[_0xf6d7('0x33')](_0x4f2b9e,_[_0xf6d7('0x34')](_0xdae331,_0x47532f));}return _0x4f2b9e;});}exports[_0xf6d7('0x35')]=initializeQueues; \ No newline at end of file +var _0xa6c7=['merge','pick','initializeQueues','lodash','jayson/promise','util','client','http','available','loggedIn','paused','waiting','busy','inUse','invalid','loggedInDb','ringing','ringInUse','unavailable','unknown','originated','message','dialActive','dialMethod','Trunk','startPredictive','startProgressive','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','voice','startCase','Queues','then','error','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','catch','getRealtimeQueues','inbound','concat','map','get','talking','outbound','find'];(function(_0x432769,_0x138284){var _0x377a0c=function(_0x5af174){while(--_0x5af174){_0x432769['push'](_0x432769['shift']());}};_0x377a0c(++_0x138284);}(_0xa6c7,0x184));var _0x7a6c=function(_0x527ef1,_0x1f90c0){_0x527ef1=_0x527ef1-0x0;var _0x3c7cb4=_0xa6c7[_0x527ef1];return _0x3c7cb4;};'use strict';var _=require(_0x7a6c('0x0'));var jayson=require(_0x7a6c('0x1'));var util=require(_0x7a6c('0x2'));var amiClient=jayson[_0x7a6c('0x3')][_0x7a6c('0x4')]({'port':0x232a});var routingClient=jayson['client'][_0x7a6c('0x4')]({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=[_0x7a6c('0x5'),_0x7a6c('0x6'),_0x7a6c('0x7'),_0x7a6c('0x8')];var VOICE_QUEUE_ATTRIBUTES=[_0x7a6c('0x9'),_0x7a6c('0xa'),_0x7a6c('0xb'),_0x7a6c('0xc'),'notInUse','onHold',_0x7a6c('0xd'),_0x7a6c('0xe'),'talking',_0x7a6c('0xf'),_0x7a6c('0x10')];var OUTBOUND_QUEUE_ATTRIBUTES=['pTalking',_0x7a6c('0x11'),_0x7a6c('0x12'),'statusMessage',_0x7a6c('0x13'),_0x7a6c('0x14'),_0x7a6c('0x15'),_0x7a6c('0x16'),_0x7a6c('0x17'),'erlangCalls',_0x7a6c('0x18'),_0x7a6c('0x19'),_0x7a6c('0x1a'),_0x7a6c('0x1b'),_0x7a6c('0x1c'),_0x7a6c('0x1d'),'predictiveIntervalAvailable',_0x7a6c('0x1e'),_0x7a6c('0x1f'),'predictiveIntervalDroppedCallsTimeout',_0x7a6c('0x20'),_0x7a6c('0x21'),_0x7a6c('0x22')];function getRealtimeQueues(_0x267a4f,_0x3160f2){var _0x320d8f=_0x3160f2===_0x7a6c('0x23')?amiClient:routingClient;return _0x320d8f['request'](_[_0x7a6c('0x24')](_0x3160f2)+_0x7a6c('0x25'),_0x267a4f)[_0x7a6c('0x26')](function(_0x1c0d9a){if(_0x1c0d9a[_0x7a6c('0x27')])throw new Error(util[_0x7a6c('0x28')](_0x7a6c('0x29'),_0x3160f2));return _0x1c0d9a[_0x7a6c('0x2a')];})[_0x7a6c('0x2b')](function(_0x5ebcc4){throw _0x5ebcc4;});}exports[_0x7a6c('0x2c')]=getRealtimeQueues;function initializeQueues(_0x13d3c7,_0x4dfe32,_0x1596d7,_0x5b0804){var _0x15d6b0=DEFAULT_QUEUE_ATTRIBUTES;if(_0x1596d7===_0x7a6c('0x23')){if(_0x5b0804===_0x7a6c('0x2d')){_0x15d6b0=_0x15d6b0['concat'](VOICE_QUEUE_ATTRIBUTES);}else if(_0x5b0804==='outbound'){_0x15d6b0=_0x15d6b0[_0x7a6c('0x2e')](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x13d3c7[_0x7a6c('0x2f')](function(_0x3c4c4a){var _0x256c4a=_0x3c4c4a[_0x7a6c('0x30')]({'plain':!![]});_0x256c4a[_0x7a6c('0x7')]=0x0;_0x256c4a[_0x7a6c('0xc')]=0x0;_0x256c4a['loggedIn']=0x0;_0x256c4a[_0x7a6c('0x5')]=0x0;_0x256c4a[_0x7a6c('0x8')]=0x0;if(_0x1596d7===_0x7a6c('0x23')){_0x256c4a[_0x7a6c('0x31')]=0x0;_0x256c4a['busy']=0x0;if(_0x5b0804===_0x7a6c('0x32')){_0x256c4a['pTalking']=0x0;_0x256c4a[_0x7a6c('0x11')]=0x0;}}var _0x1b179c=_[_0x7a6c('0x33')](_0x4dfe32,['id',_0x256c4a['id']]);if(_0x1b179c){_[_0x7a6c('0x34')](_0x256c4a,_[_0x7a6c('0x35')](_0x1b179c,_0x15d6b0));}return _0x256c4a;});}exports[_0x7a6c('0x36')]=initializeQueues; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index 24869ea..833f2be 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(_0x918313,_0x53b353){var _0x4c0f8c=function(_0x5e21ce){while(--_0x5e21ce){_0x918313['push'](_0x918313['shift']());}};_0x4c0f8c(++_0x53b353);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'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(_0x4f6864,_0xdb09cc){var _0xcd9bd1=function(_0xb3ac37){while(--_0xb3ac37){_0x4f6864['push'](_0x4f6864['shift']());}};_0xcd9bd1(++_0xdb09cc);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'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 6e5ebab..508878d 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 _0xbb8a=['update','hex','getUuid','platform','licenseToken','test','win32','dmidecode\x20--string\x20system-uuid','utf8','replace','createHash','digest','substring','lodash','bimedia-machine-uuid','child_process','execSync','../environment','networkInterfaces','orderBy','keys','length','filter','family','IPv4','internal','mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','cpus','map','join','md5'];(function(_0xe3600e,_0x6c806b){var _0x2e213d=function(_0x297003){while(--_0x297003){_0xe3600e['push'](_0xe3600e['shift']());}};_0x2e213d(++_0x6c806b);}(_0xbb8a,0x18e));var _0xabb8=function(_0x4b8919,_0x211011){_0x4b8919=_0x4b8919-0x0;var _0x50f366=_0xbb8a[_0x4b8919];return _0x50f366;};'use strict';var _=require(_0xabb8('0x0'));var os=require('os');var crypto=require('crypto');var machine=require(_0xabb8('0x1'));var exec=require(_0xabb8('0x2'))[_0xabb8('0x3')];var config=require(_0xabb8('0x4'));function getInterfaces(){var _0x2557eb=[];var _0x3d0ff0=os[_0xabb8('0x5')]();var _0x1ea4ba=_[_0xabb8('0x6')](_[_0xabb8('0x7')](_0x3d0ff0));for(var _0x530de8=0x0;_0x530de8<_0x1ea4ba[_0xabb8('0x8')];_0x530de8++){var _0x548164=_0x3d0ff0[_0x1ea4ba[_0x530de8]][_0xabb8('0x9')](function(_0x36bb54){return _0x36bb54[_0xabb8('0xa')]===_0xabb8('0xb')&&_0x36bb54[_0xabb8('0xc')]===![];});_0x2557eb=_0x2557eb['concat'](_0x548164);}return _0x2557eb;}function getFirstInterface(){var _0x7649ce=_['head'](getInterfaces());return{'macAddress':_0x7649ce&&_0x7649ce[_0xabb8('0xd')]?_0x7649ce['mac']:_0xabb8('0xe'),'ipAddress':_0x7649ce&&_0x7649ce[_0xabb8('0xf')]?_0x7649ce[_0xabb8('0xf')]:_0xabb8('0x10')};}exports[_0xabb8('0x11')]=getFirstInterface;function getCPUhash(){var _0x5059f3=_[_0xabb8('0x6')](os[_0xabb8('0x12')]()[_0xabb8('0x13')](function(_0x2a0842){return _0x2a0842['model'];}))[_0xabb8('0x14')](':');return crypto['createHash'](_0xabb8('0x15'))[_0xabb8('0x16')](_0x5059f3)['digest'](_0xabb8('0x17'));}exports[_0xabb8('0x18')]=function(){var _0x15c83e=os[_0xabb8('0x19')]();var _0x1eec2b=/[0-9a-f-]{36}/;if(config[_0xabb8('0x1a')]&&_0x1eec2b[_0xabb8('0x1b')](config['licenseToken'])){return config['licenseToken'];}else if(_0x15c83e===_0xabb8('0x1c')){return exec(_0xabb8('0x1d'),{'encoding':_0xabb8('0x1e')})[_0xabb8('0x1f')]('\x0d\x0a','');}else{var _0x3fd9fc=getFirstInterface();var _0x5acdcc=getCPUhash();var _0xdf9591=_0x5acdcc+'|'+os['hostname']()+'|'+_0x3fd9fc['macAddress']+'|'+_0x3fd9fc['ipAddress'];var _0x128ac9=crypto[_0xabb8('0x20')]('md5')['update'](_0xdf9591)[_0xabb8('0x21')](_0xabb8('0x17'));return _0x128ac9['substring'](0x0,0x8)+'-'+_0x128ac9['substring'](0x8,0xc)+'-'+_0x128ac9[_0xabb8('0x22')](0xc,0x10)+'-'+_0x128ac9['substring'](0x10,0x14)+'-'+_0x128ac9[_0xabb8('0x22')](0x14);}}; \ No newline at end of file +var _0x867d=['licenseToken','win32','dmidecode\x20--string\x20system-uuid','utf8','replace','hostname','ipAddress','createHash','hex','substring','execSync','../environment','orderBy','keys','length','filter','IPv4','internal','concat','mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','cpus','model','join','update','digest','getUuid','test'];(function(_0x7e24bc,_0x408dfa){var _0xa226fc=function(_0x566461){while(--_0x566461){_0x7e24bc['push'](_0x7e24bc['shift']());}};_0xa226fc(++_0x408dfa);}(_0x867d,0x86));var _0xd867=function(_0x2b20c3,_0x62ef3){_0x2b20c3=_0x2b20c3-0x0;var _0x195881=_0x867d[_0x2b20c3];return _0x195881;};'use strict';var _=require('lodash');var os=require('os');var crypto=require('crypto');var machine=require('bimedia-machine-uuid');var exec=require('child_process')[_0xd867('0x0')];var config=require(_0xd867('0x1'));function getInterfaces(){var _0x2dbb99=[];var _0xfd8d3c=os['networkInterfaces']();var _0x49fd4a=_[_0xd867('0x2')](_[_0xd867('0x3')](_0xfd8d3c));for(var _0x2f6891=0x0;_0x2f6891<_0x49fd4a[_0xd867('0x4')];_0x2f6891++){var _0x239352=_0xfd8d3c[_0x49fd4a[_0x2f6891]][_0xd867('0x5')](function(_0x126ea3){return _0x126ea3['family']===_0xd867('0x6')&&_0x126ea3[_0xd867('0x7')]===![];});_0x2dbb99=_0x2dbb99[_0xd867('0x8')](_0x239352);}return _0x2dbb99;}function getFirstInterface(){var _0x17dc41=_['head'](getInterfaces());return{'macAddress':_0x17dc41&&_0x17dc41[_0xd867('0x9')]?_0x17dc41['mac']:_0xd867('0xa'),'ipAddress':_0x17dc41&&_0x17dc41[_0xd867('0xb')]?_0x17dc41[_0xd867('0xb')]:_0xd867('0xc')};}exports[_0xd867('0xd')]=getFirstInterface;function getCPUhash(){var _0x34d2d2=_[_0xd867('0x2')](os[_0xd867('0xe')]()['map'](function(_0x26755f){return _0x26755f[_0xd867('0xf')];}))[_0xd867('0x10')](':');return crypto['createHash']('md5')[_0xd867('0x11')](_0x34d2d2)[_0xd867('0x12')]('hex');}exports[_0xd867('0x13')]=function(){var _0x16dffc=os['platform']();var _0x46adb6=/[0-9a-f-]{36}/;if(config['licenseToken']&&_0x46adb6[_0xd867('0x14')](config[_0xd867('0x15')])){return config[_0xd867('0x15')];}else if(_0x16dffc===_0xd867('0x16')){return exec(_0xd867('0x17'),{'encoding':_0xd867('0x18')})[_0xd867('0x19')]('\x0d\x0a','');}else{var _0x58ec5e=getFirstInterface();var _0x373ec6=getCPUhash();var _0x437e42=_0x373ec6+'|'+os[_0xd867('0x1a')]()+'|'+_0x58ec5e['macAddress']+'|'+_0x58ec5e[_0xd867('0x1b')];var _0x288a2d=crypto[_0xd867('0x1c')]('md5')[_0xd867('0x11')](_0x437e42)[_0xd867('0x12')](_0xd867('0x1d'));return _0x288a2d[_0xd867('0x1e')](0x0,0x8)+'-'+_0x288a2d[_0xd867('0x1e')](0x8,0xc)+'-'+_0x288a2d['substring'](0xc,0x10)+'-'+_0x288a2d['substring'](0x10,0x14)+'-'+_0x288a2d['substring'](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index 978dd30..2f4220f 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 _0xe083=['toUpperCase','YYYY-MM-DD\x20HH:mm','diff','decryptString','days','DEMO\x20START\x20AT\x20%s','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','message','getUuid','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','error','default','util','moment','pkginfo','../../components/encryptor','./hardware','../logger','license','https://www.xcallymotion.com','format','exports','version','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','catch','data1','data2','then','active','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','update','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe083,0xa6));var _0x3e08=function(_0x3b9db5,_0x368d58){_0x3b9db5=_0x3b9db5-0x0;var _0x5e6c4a=_0xe083[_0x3b9db5];return _0x5e6c4a;};'use strict';var util=require(_0x3e08('0x0'));var moment=require(_0x3e08('0x1'));var rp=require('request-promise');var BPromise=require('bluebird');var pkginfo=require(_0x3e08('0x2'))(module,'version');var db=require('../../mysqldb')['db'];var encryptor=require(_0x3e08('0x3'));var hardware=require(_0x3e08('0x4'));var logger=require(_0x3e08('0x5'))(_0x3e08('0x6'));var HOST=_0x3e08('0x7');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x34bcbd){return new BPromise(function(_0x3b467f,_0x10559a){var _0x331090=util[_0x3e08('0x8')]('%s/api/servers/%s/check?version=%s',HOST,_0x34bcbd,module[_0x3e08('0x9')][_0x3e08('0xa')]);if(oldToken){_0x331090=util['format'](_0x3e08('0xb'),HOST,_0x34bcbd,module[_0x3e08('0x9')][_0x3e08('0xa')],oldToken);}var _0x341424={'uri':_0x331090,'method':_0x3e08('0xc'),'timeout':0xea60,'json':!![]};return rp(_0x341424)['then'](function(_0x19279e){_0x3b467f(_0x19279e);})[_0x3e08('0xd')](function(_0x8a6ccb){_0x10559a(_0x8a6ccb);});});}function manageLicense(_0x137ef2,_0x4646d1){var _0x251b43=_0x4646d1['get']({'plain':!![]});if(!isOldTokenSent&&_0x251b43[_0x3e08('0xe')]!==_0x137ef2&&!_0x251b43[_0x3e08('0xf')]){oldToken=_0x251b43[_0x3e08('0xe')];}httpRequest(_0x137ef2)[_0x3e08('0x10')](function(_0x7b86ea){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x7b86ea[_0x3e08('0x11')]){isOldTokenSent=![];if(!_0x251b43[_0x3e08('0x6')]&&_0x251b43[_0x3e08('0x6')]!=_0x7b86ea[_0x3e08('0x6')]||_0x251b43[_0x3e08('0x6')]&&_0x251b43[_0x3e08('0xf')]){logger[_0x3e08('0x12')](_0x3e08('0x13'));}if(_0x251b43[_0x3e08('0x6')]&&!_0x251b43[_0x3e08('0xf')]&&_0x251b43[_0x3e08('0x6')]!=_0x7b86ea[_0x3e08('0x6')]){logger[_0x3e08('0x12')]('THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED');}if(_0x251b43[_0x3e08('0x6')]&&!_0x251b43[_0x3e08('0xf')]&&_0x251b43['license']==_0x7b86ea[_0x3e08('0x6')]){return _0x4646d1;}return _0x4646d1[_0x3e08('0x14')]({'data1':_0x137ef2,'data2':null,'license':_0x7b86ea[_0x3e08('0x6')]});}else{if(_0x7b86ea['license']||_0x251b43[_0x3e08('0x6')]){if(!_0x251b43[_0x3e08('0xf')]){if(_0x251b43[_0x3e08('0xe')]==_0x137ef2){GRAY_PERIOD_REASON=_0x3e08('0x15');logger[_0x3e08('0x12')](_0x3e08('0x16'));}else{GRAY_PERIOD_REASON='Changed';logger['info']('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x251b43['data1'],_0x137ef2);}logger[_0x3e08('0x12')](_0x3e08('0x17'),GRAY_PERIOD_REASON[_0x3e08('0x18')](),moment()[_0x3e08('0x8')](_0x3e08('0x19')));return _0x4646d1[_0x3e08('0x14')]({'data2':encryptor['encryptString'](moment()[_0x3e08('0x8')](_0x3e08('0x19')))});}else{if(moment()[_0x3e08('0x1a')](encryptor[_0x3e08('0x1b')](_0x251b43[_0x3e08('0xf')]),_0x3e08('0x1c'))>DAYS){logger[_0x3e08('0x12')](_0x3e08('0x1d'),moment()[_0x3e08('0x8')](_0x3e08('0x19')));isOldTokenSent=![];return _0x4646d1['update']({'data1':_0x137ef2,'data2':null,'license':null});}}}else{if(_0x251b43[_0x3e08('0xe')]!=_0x137ef2){logger[_0x3e08('0x12')](_0x3e08('0x1e'),_0x251b43[_0x3e08('0xe')],_0x137ef2);return _0x4646d1[_0x3e08('0x14')]({'data1':_0x137ef2,'data2':null,'license':null});}}}return _0x4646d1;})[_0x3e08('0x10')](function(_0x1e3bcc){_0x4646d1=_0x1e3bcc;})[_0x3e08('0xd')](function(_0x1e0027){logger['error'](_0x1e0027[_0x3e08('0x1f')]);})['finally'](function(){setTimeout(function(){manageLicense(hardware[_0x3e08('0x20')](),_0x4646d1);},TIME);});}function defaultLicense(){var _0x44ead5=hardware[_0x3e08('0x20')]();if(_0x44ead5){return db['License'][_0x3e08('0x21')]({'where':{'id':0x1},'defaults':{'data1':_0x44ead5}})[_0x3e08('0x22')](function(_0x33cebb,_0x3d9a48){logger[_0x3e08('0x12')](_0x3e08('0x23'),_0x44ead5);manageLicense(_0x44ead5,_0x33cebb);})[_0x3e08('0xd')](function(_0xd54f4e){logger[_0x3e08('0x24')](_0xd54f4e[_0x3e08('0x1f')]);});}}exports[_0x3e08('0x25')]=defaultLicense; \ No newline at end of file +var _0x73e0=['util','moment','request-promise','pkginfo','version','../../mysqldb','./hardware','../logger','https://www.xcallymotion.com','%s/api/servers/%s/check?version=%s','exports','format','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','then','catch','get','data2','data1','active','license','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','update','encryptString','days','error','message','finally','License','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','default'];(function(_0x3e6f8c,_0xd3e8ee){var _0x37798a=function(_0x451b60){while(--_0x451b60){_0x3e6f8c['push'](_0x3e6f8c['shift']());}};_0x37798a(++_0xd3e8ee);}(_0x73e0,0x78));var _0x073e=function(_0x20fbc0,_0x13423e){_0x20fbc0=_0x20fbc0-0x0;var _0x2e2bd6=_0x73e0[_0x20fbc0];return _0x2e2bd6;};'use strict';var util=require(_0x073e('0x0'));var moment=require(_0x073e('0x1'));var rp=require(_0x073e('0x2'));var BPromise=require('bluebird');var pkginfo=require(_0x073e('0x3'))(module,_0x073e('0x4'));var db=require(_0x073e('0x5'))['db'];var encryptor=require('../../components/encryptor');var hardware=require(_0x073e('0x6'));var logger=require(_0x073e('0x7'))('license');var HOST=_0x073e('0x8');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x20151a){return new BPromise(function(_0x343b19,_0x3f8334){var _0x2eae53=util['format'](_0x073e('0x9'),HOST,_0x20151a,module[_0x073e('0xa')][_0x073e('0x4')]);if(oldToken){_0x2eae53=util[_0x073e('0xb')](_0x073e('0xc'),HOST,_0x20151a,module[_0x073e('0xa')][_0x073e('0x4')],oldToken);}var _0x2dbf9d={'uri':_0x2eae53,'method':_0x073e('0xd'),'timeout':0xea60,'json':!![]};return rp(_0x2dbf9d)[_0x073e('0xe')](function(_0x4335f7){_0x343b19(_0x4335f7);})[_0x073e('0xf')](function(_0x5274fe){_0x3f8334(_0x5274fe);});});}function manageLicense(_0x5c211,_0x5aa489){var _0x49b82d=_0x5aa489[_0x073e('0x10')]({'plain':!![]});if(!isOldTokenSent&&_0x49b82d['data1']!==_0x5c211&&!_0x49b82d[_0x073e('0x11')]){oldToken=_0x49b82d[_0x073e('0x12')];}httpRequest(_0x5c211)[_0x073e('0xe')](function(_0x3c4b91){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x3c4b91[_0x073e('0x13')]){isOldTokenSent=![];if(!_0x49b82d['license']&&_0x49b82d[_0x073e('0x14')]!=_0x3c4b91[_0x073e('0x14')]||_0x49b82d['license']&&_0x49b82d[_0x073e('0x11')]){logger[_0x073e('0x15')](_0x073e('0x16'));}if(_0x49b82d[_0x073e('0x14')]&&!_0x49b82d[_0x073e('0x11')]&&_0x49b82d[_0x073e('0x14')]!=_0x3c4b91[_0x073e('0x14')]){logger[_0x073e('0x15')]('THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED');}if(_0x49b82d[_0x073e('0x14')]&&!_0x49b82d[_0x073e('0x11')]&&_0x49b82d[_0x073e('0x14')]==_0x3c4b91[_0x073e('0x14')]){return _0x5aa489;}return _0x5aa489['update']({'data1':_0x5c211,'data2':null,'license':_0x3c4b91[_0x073e('0x14')]});}else{if(_0x3c4b91[_0x073e('0x14')]||_0x49b82d['license']){if(!_0x49b82d['data2']){if(_0x49b82d[_0x073e('0x12')]==_0x5c211){GRAY_PERIOD_REASON=_0x073e('0x17');logger[_0x073e('0x15')](_0x073e('0x18'));}else{GRAY_PERIOD_REASON=_0x073e('0x19');logger[_0x073e('0x15')](_0x073e('0x1a'),_0x49b82d[_0x073e('0x12')],_0x5c211);}logger[_0x073e('0x15')](_0x073e('0x1b'),GRAY_PERIOD_REASON[_0x073e('0x1c')](),moment()[_0x073e('0xb')](_0x073e('0x1d')));return _0x5aa489[_0x073e('0x1e')]({'data2':encryptor[_0x073e('0x1f')](moment()['format']('YYYY-MM-DD\x20HH:mm'))});}else{if(moment()['diff'](encryptor['decryptString'](_0x49b82d['data2']),_0x073e('0x20'))>DAYS){logger[_0x073e('0x15')]('DEMO\x20START\x20AT\x20%s',moment()[_0x073e('0xb')]('YYYY-MM-DD\x20HH:mm'));isOldTokenSent=![];return _0x5aa489[_0x073e('0x1e')]({'data1':_0x5c211,'data2':null,'license':null});}}}else{if(_0x49b82d[_0x073e('0x12')]!=_0x5c211){logger[_0x073e('0x15')](_0x073e('0x1a'),_0x49b82d[_0x073e('0x12')],_0x5c211);return _0x5aa489[_0x073e('0x1e')]({'data1':_0x5c211,'data2':null,'license':null});}}}return _0x5aa489;})[_0x073e('0xe')](function(_0x5dabb6){_0x5aa489=_0x5dabb6;})[_0x073e('0xf')](function(_0x583f59){logger[_0x073e('0x21')](_0x583f59[_0x073e('0x22')]);})[_0x073e('0x23')](function(){setTimeout(function(){manageLicense(hardware['getUuid'](),_0x5aa489);},TIME);});}function defaultLicense(){var _0x19832b=hardware['getUuid']();if(_0x19832b){return db[_0x073e('0x24')]['findOrCreate']({'where':{'id':0x1},'defaults':{'data1':_0x19832b}})[_0x073e('0x25')](function(_0x56c425,_0x137eee){logger[_0x073e('0x15')](_0x073e('0x26'),_0x19832b);manageLicense(_0x19832b,_0x56c425);})[_0x073e('0xf')](function(_0x23186f){logger[_0x073e('0x21')](_0x23186f[_0x073e('0x22')]);});}}exports[_0x073e('0x27')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index c72d0de..b0e3e8e 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 _0xe55c=['isEmpty','License\x20key\x20value\x20not\x20found','data1','data2','split','%s:%s:%s','demo','decryptString','gray','deadline','add','days','grayReason','machineUuid','changed','disabled','message','User','role','sequelize','count','user','telephone','users','telephones','forEach','admin','pick','countBy','License\x20limit\x20reached\x20for\x20users','exports','lodash','moment','./hardware','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','Breaking\x20license','find','then','catch','uuid','license'];(function(_0x1f7f0f,_0x56c866){var _0x467749=function(_0x44d893){while(--_0x44d893){_0x1f7f0f['push'](_0x1f7f0f['shift']());}};_0x467749(++_0x56c866);}(_0xe55c,0xa6));var _0xce55=function(_0x894352,_0x5dab9b){_0x894352=_0x894352-0x0;var _0x264863=_0xe55c[_0x894352];return _0x264863;};'use strict';var util=require('util');var _=require(_0xce55('0x0'));var moment=require(_0xce55('0x1'));var BPromise=require('bluebird');var hardware=require(_0xce55('0x2'));var encryptor=require(_0xce55('0x3'));var db=require(_0xce55('0x4'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xce55('0x5'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0xce55('0x6'),'machineUuid':hardware[_0xce55('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xce55('0x5'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0xce55('0x8'),'machineUuid':hardware[_0xce55('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x389c4f){return new BPromise(function(_0x4117a8,_0x3a6ac0){return db['License'][_0xce55('0x9')](_['defaults'](_0x389c4f,{'raw':!![],'where':{'id':0x1}}))[_0xce55('0xa')](function(_0x3f7423){return checkLicense(_0x3f7423,null);})['then'](function(_0x228f0b){_0x4117a8(_0x228f0b);return;})[_0xce55('0xb')](function(_0x6d9792){_0x3a6ac0(_0x6d9792);});});}function checkLicense(_0x357eab,_0x531524){if(!_0x357eab){demoLicense[_0xce55('0xc')]=_0x357eab['data1'];return demoLicense;}try{var _0x4127ec=_0x531524||_0x357eab[_0xce55('0xd')];if(_[_0xce55('0xe')](_0x4127ec)){throw new Error(_0xce55('0xf'));}var _0x53d0ce=_0x357eab[_0xce55('0x10')];var _0x5e92a2=_0x357eab[_0xce55('0x11')];var _0x4581ca=_0x53d0ce['split']('-')[0x4];var _0x1b4af6=_0x53d0ce[_0xce55('0x12')]('-')[0x0];var _0x5e5736=encryptor['decryptString'](_0x4127ec,util['format'](_0xce55('0x13'),_0x4581ca,_0x53d0ce,_0x1b4af6));var _0xc7a526=JSON['parse'](_0x5e5736);_0xc7a526[_0xce55('0x14')]=![];_0xc7a526[_0xce55('0xc')]=_0x53d0ce;_0xc7a526['machineUuid']=hardware[_0xce55('0x7')]();if(_0x5e92a2){var _0x5607a3=encryptor[_0xce55('0x15')](_0x5e92a2);_0xc7a526[_0xce55('0x16')]=_0x5607a3;_0xc7a526[_0xce55('0x17')]=moment(_0x5607a3)[_0xce55('0x18')](0x7,_0xce55('0x19'))['format']();_0xc7a526[_0xce55('0x1a')]=_0xc7a526['uuid']!=_0xc7a526[_0xce55('0x1b')]?_0xce55('0x1c'):_0xce55('0x1d');}return _0xc7a526;}catch(_0x3053ed){breakingLicense[_0xce55('0xc')]=_0x357eab['data1'];breakingLicense[_0xce55('0x1e')]=_0x3053ed['message'];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x2efe08,_0x3228e3){getLicense()[_0xce55('0xa')](function(_0x32c23d){return db[_0xce55('0x1f')]['findAll']({'attributes':[_0xce55('0x20'),[db[_0xce55('0x21')]['fn']('COUNT',db[_0xce55('0x21')]['col'](_0xce55('0x20'))),_0xce55('0x22')]],'group':'role','where':{'role':{'$or':['admin',_0xce55('0x23'),_0xce55('0x24')]}},'raw':!![]})['then'](function(_0x1cd1d0){var _0x2a7ef9={'user':_0x32c23d[_0xce55('0x25')]||0x0,'telephone':_0x32c23d[_0xce55('0x26')]||0x0};_0x1cd1d0[_0xce55('0x27')](function(_0x48fecd){var _0x2998c4=_0x48fecd['role']===_0xce55('0x28')?_0xce55('0x23'):_0x48fecd[_0xce55('0x20')];_0x2a7ef9[_0x2998c4]-=_0x48fecd[_0xce55('0x22')];if(_0x2a7ef9[_0x2998c4]<0x0)_0x2a7ef9[_0x2998c4]=0x0;});_0x2efe08(_0x2a7ef9);return;});})[_0xce55('0xb')](function(_0x301eca){_0x3228e3(_0x301eca);});});}function checkUserLimits(_0x573992){return new BPromise(function(_0x503da3,_0x322d66){getLimits()[_0xce55('0xa')](function(_0x2d566e){var _0x550a11=_[_0xce55('0x29')](_[_0xce55('0x2a')](_0x573992,_0xce55('0x20')),[_0xce55('0x28'),_0xce55('0x23'),_0xce55('0x24')]);var _0x26f7de=(_0x550a11[_0xce55('0x28')]||0x0)+(_0x550a11[_0xce55('0x23')]||0x0);var _0x3e82dc=_0x550a11['telephone']||0x0;if(_0x26f7de>_0x2d566e[_0xce55('0x23')])return _0x322d66(_0xce55('0x2b'));if(_0x3e82dc>_0x2d566e[_0xce55('0x24')])return _0x322d66('License\x20limit\x20reached\x20for\x20telephones');return _0x503da3();})[_0xce55('0xb')](function(_0x364c83){_0x322d66(_0x364c83);});});}module[_0xce55('0x2c')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0x247c=['uuid','data1','isEmpty','License\x20key\x20value\x20not\x20found','split','decryptString','%s:%s:%s','parse','demo','machineUuid','deadline','add','days','grayReason','changed','then','User','findAll','role','sequelize','COUNT','col','count','admin','user','telephone','telephones','forEach','pick','countBy','License\x20limit\x20reached\x20for\x20users','exports','lodash','moment','bluebird','../../mysqldb','Demo\x20license','getUuid','2027-01-01T00:00:00.000Z','Breaking\x20license','find','catch'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x247c,0x11c));var _0xc247=function(_0x3f4027,_0x221cbb){_0x3f4027=_0x3f4027-0x0;var _0x4aea2e=_0x247c[_0x3f4027];return _0x4aea2e;};'use strict';var util=require('util');var _=require(_0xc247('0x0'));var moment=require(_0xc247('0x1'));var BPromise=require(_0xc247('0x2'));var hardware=require('./hardware');var encryptor=require('../../components/encryptor');var db=require(_0xc247('0x3'))['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':_0xc247('0x4'),'machineUuid':hardware[_0xc247('0x5')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xc247('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0xc247('0x7'),'machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x29bfed){return new BPromise(function(_0x10e608,_0x5686df){return db['License'][_0xc247('0x8')](_['defaults'](_0x29bfed,{'raw':!![],'where':{'id':0x1}}))['then'](function(_0x591fa1){return checkLicense(_0x591fa1,null);})['then'](function(_0x1ea650){_0x10e608(_0x1ea650);return;})[_0xc247('0x9')](function(_0x11c001){_0x5686df(_0x11c001);});});}function checkLicense(_0x449797,_0x5da69c){if(!_0x449797){demoLicense[_0xc247('0xa')]=_0x449797[_0xc247('0xb')];return demoLicense;}try{var _0x46ee79=_0x5da69c||_0x449797['license'];if(_[_0xc247('0xc')](_0x46ee79)){throw new Error(_0xc247('0xd'));}var _0x35b8b3=_0x449797[_0xc247('0xb')];var _0xdb0276=_0x449797['data2'];var _0x52fc97=_0x35b8b3['split']('-')[0x4];var _0x5437ee=_0x35b8b3[_0xc247('0xe')]('-')[0x0];var _0x56c767=encryptor[_0xc247('0xf')](_0x46ee79,util['format'](_0xc247('0x10'),_0x52fc97,_0x35b8b3,_0x5437ee));var _0x8b041d=JSON[_0xc247('0x11')](_0x56c767);_0x8b041d[_0xc247('0x12')]=![];_0x8b041d[_0xc247('0xa')]=_0x35b8b3;_0x8b041d[_0xc247('0x13')]=hardware['getUuid']();if(_0xdb0276){var _0x2670fb=encryptor[_0xc247('0xf')](_0xdb0276);_0x8b041d['gray']=_0x2670fb;_0x8b041d[_0xc247('0x14')]=moment(_0x2670fb)[_0xc247('0x15')](0x7,_0xc247('0x16'))['format']();_0x8b041d[_0xc247('0x17')]=_0x8b041d[_0xc247('0xa')]!=_0x8b041d[_0xc247('0x13')]?_0xc247('0x18'):'disabled';}return _0x8b041d;}catch(_0x56a868){breakingLicense['uuid']=_0x449797[_0xc247('0xb')];breakingLicense['message']=_0x56a868['message'];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x1e9590,_0x26e24a){getLicense()[_0xc247('0x19')](function(_0x5dde43){return db[_0xc247('0x1a')][_0xc247('0x1b')]({'attributes':[_0xc247('0x1c'),[db[_0xc247('0x1d')]['fn'](_0xc247('0x1e'),db[_0xc247('0x1d')][_0xc247('0x1f')](_0xc247('0x1c'))),_0xc247('0x20')]],'group':_0xc247('0x1c'),'where':{'role':{'$or':[_0xc247('0x21'),_0xc247('0x22'),_0xc247('0x23')]}},'raw':!![]})['then'](function(_0x10bb52){var _0x1cb21c={'user':_0x5dde43['users']||0x0,'telephone':_0x5dde43[_0xc247('0x24')]||0x0};_0x10bb52[_0xc247('0x25')](function(_0x8f9e42){var _0x274e2f=_0x8f9e42[_0xc247('0x1c')]===_0xc247('0x21')?_0xc247('0x22'):_0x8f9e42[_0xc247('0x1c')];_0x1cb21c[_0x274e2f]-=_0x8f9e42[_0xc247('0x20')];if(_0x1cb21c[_0x274e2f]<0x0)_0x1cb21c[_0x274e2f]=0x0;});_0x1e9590(_0x1cb21c);return;});})[_0xc247('0x9')](function(_0x31da1e){_0x26e24a(_0x31da1e);});});}function checkUserLimits(_0x446fb5){return new BPromise(function(_0x17f1c7,_0x4307b5){getLimits()[_0xc247('0x19')](function(_0x25e2d7){var _0x10b31d=_[_0xc247('0x26')](_[_0xc247('0x27')](_0x446fb5,_0xc247('0x1c')),[_0xc247('0x21'),'user',_0xc247('0x23')]);var _0x1f4add=(_0x10b31d[_0xc247('0x21')]||0x0)+(_0x10b31d[_0xc247('0x22')]||0x0);var _0x231f32=_0x10b31d[_0xc247('0x23')]||0x0;if(_0x1f4add>_0x25e2d7[_0xc247('0x22')])return _0x4307b5(_0xc247('0x28'));if(_0x231f32>_0x25e2d7['telephone'])return _0x4307b5('License\x20limit\x20reached\x20for\x20telephones');return _0x17f1c7();})[_0xc247('0x9')](function(_0x224c52){_0x4307b5(_0x224c52);});});}module[_0xc247('0x29')]={'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 391cb1d..69c53a0 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 _0x0424=['myappanuglar-secret','app-id','secret'];(function(_0x5b947d,_0x133125){var _0x1b0b88=function(_0x3fb9bf){while(--_0x3fb9bf){_0x5b947d['push'](_0x5b947d['shift']());}};_0x1b0b88(++_0x133125);}(_0x0424,0x159));var _0x4042=function(_0xec05a,_0xae2200){_0xec05a=_0xec05a-0x0;var _0x5911e2=_0x0424[_0xec05a];return _0x5911e2;};'use strict';module['exports']={'DOMAIN':'http://localhost:9000','SESSION_SECRET':_0x4042('0x0'),'GOOGLE_ID':_0x4042('0x1'),'GOOGLE_SECRET':_0x4042('0x2'),'DEBUG':''}; \ No newline at end of file +var _0x7916=['myappanuglar-secret','app-id','exports'];(function(_0x316904,_0x1e8b77){var _0xfa9a21=function(_0x2b75ae){while(--_0x2b75ae){_0x316904['push'](_0x316904['shift']());}};_0xfa9a21(++_0x1e8b77);}(_0x7916,0x128));var _0x6791=function(_0x12239a,_0x508ba7){_0x12239a=_0x12239a-0x0;var _0x54b6e9=_0x7916[_0x12239a];return _0x54b6e9;};'use strict';module[_0x6791('0x0')]={'DOMAIN':'http://localhost:9000','SESSION_SECRET':_0x6791('0x1'),'GOOGLE_ID':_0x6791('0x2'),'GOOGLE_SECRET':'secret','DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index 934b08b..ce04f28 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x01c4=['fileLogger','../utils/loggers'];(function(_0x2080a3,_0x48acfa){var _0x8d7d17=function(_0x2dbc06){while(--_0x2dbc06){_0x2080a3['push'](_0x2080a3['shift']());}};_0x8d7d17(++_0x48acfa);}(_0x01c4,0x1c1));var _0x401c=function(_0x3612eb,_0x1f07a9){_0x3612eb=_0x3612eb-0x0;var _0x1a13ab=_0x01c4[_0x3612eb];return _0x1a13ab;};'use strict';var fileLogger=require(_0x401c('0x0'))[_0x401c('0x1')];module['exports']=fileLogger; \ No newline at end of file +var _0x6672=['exports','../utils/loggers','fileLogger'];(function(_0x5d4ca7,_0x19113b){var _0x3efc03=function(_0x59675b){while(--_0x59675b){_0x5d4ca7['push'](_0x5d4ca7['shift']());}};_0x3efc03(++_0x19113b);}(_0x6672,0xaf));var _0x2667=function(_0x4d9bb2,_0x3db50d){_0x4d9bb2=_0x4d9bb2-0x0;var _0x3179fe=_0x6672[_0x4d9bb2];return _0x3179fe;};'use strict';var fileLogger=require(_0x2667('0x0'))[_0x2667('0x1')];module[_0x2667('0x2')]=fileLogger; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index b6d088e..3d0411d 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 _0x8d4e=['email','../../services/email/index.js','routing','../../services/routing/index.js','xdr','path','../../config/environment','resolve','join','root','legacy-libs','express','../../services/express/index.js','ami','../../services/ami/index.js','../../services/agi/index.js'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x8d4e,0x1c5));var _0xe8d4=function(_0x1eded5,_0x145979){_0x1eded5=_0x1eded5-0x0;var _0x48742e=_0x8d4e[_0x1eded5];return _0x48742e;};'use strict';var path=require(_0xe8d4('0x0'));var cfg=require(_0xe8d4('0x1'));var env={'NODE_PATH':path[_0xe8d4('0x2')](path[_0xe8d4('0x3')](cfg[_0xe8d4('0x4')],_0xe8d4('0x5')))};var pm2config={'apps':[{'name':_0xe8d4('0x6'),'script':path[_0xe8d4('0x3')](__dirname,_0xe8d4('0x7')),'env':env},{'name':_0xe8d4('0x8'),'script':path[_0xe8d4('0x3')](__dirname,_0xe8d4('0x9')),'env':env},{'name':'agi','script':path[_0xe8d4('0x3')](__dirname,_0xe8d4('0xa')),'env':env},{'name':_0xe8d4('0xb'),'script':path[_0xe8d4('0x3')](__dirname,_0xe8d4('0xc')),'env':env},{'name':_0xe8d4('0xd'),'script':path[_0xe8d4('0x3')](__dirname,_0xe8d4('0xe')),'env':env},{'name':_0xe8d4('0xf'),'script':path['join'](__dirname,'../../services/xdr/index.js'),'env':env}]};module['exports']=pm2config; \ No newline at end of file +var _0xb6b9=['legacy-libs','express','../../services/express/index.js','ami','../../services/ami/index.js','agi','../../services/agi/index.js','email','../../services/email/index.js','routing','../../services/xdr/index.js','exports','path','../../config/environment','resolve','join','root'];(function(_0x1ffda6,_0x389ccc){var _0x50f7f5=function(_0x410350){while(--_0x410350){_0x1ffda6['push'](_0x1ffda6['shift']());}};_0x50f7f5(++_0x389ccc);}(_0xb6b9,0x10b));var _0x9b6b=function(_0x29c9d8,_0x498897){_0x29c9d8=_0x29c9d8-0x0;var _0xedd068=_0xb6b9[_0x29c9d8];return _0xedd068;};'use strict';var path=require(_0x9b6b('0x0'));var cfg=require(_0x9b6b('0x1'));var env={'NODE_PATH':path[_0x9b6b('0x2')](path[_0x9b6b('0x3')](cfg[_0x9b6b('0x4')],_0x9b6b('0x5')))};var pm2config={'apps':[{'name':_0x9b6b('0x6'),'script':path[_0x9b6b('0x3')](__dirname,_0x9b6b('0x7')),'env':env},{'name':_0x9b6b('0x8'),'script':path[_0x9b6b('0x3')](__dirname,_0x9b6b('0x9')),'env':env},{'name':_0x9b6b('0xa'),'script':path['join'](__dirname,_0x9b6b('0xb')),'env':env},{'name':_0x9b6b('0xc'),'script':path[_0x9b6b('0x3')](__dirname,_0x9b6b('0xd')),'env':env},{'name':_0x9b6b('0xe'),'script':path[_0x9b6b('0x3')](__dirname,'../../services/routing/index.js'),'env':env},{'name':'xdr','script':path[_0x9b6b('0x3')](__dirname,_0x9b6b('0xf')),'env':env}]};module[_0x9b6b('0x10')]=pm2config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index 315e5db..1af29b0 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 _0x4aae=['pm2','./config','connect','connected','start','then','disconnect','stop','restart','list','describe','delete','dump','saved'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0x4aae,0x8c));var _0xe4aa=function(_0x41cca5,_0x5e58cd){_0x41cca5=_0x41cca5-0x0;var _0x18bee0=_0x4aae[_0x41cca5];return _0x18bee0;};'use strict';var pm2=require(_0xe4aa('0x0'));var BPromise=require('bluebird');var config=require(_0xe4aa('0x1'));function connect(){return new BPromise(function(_0x1832cb,_0xc66f13){return pm2[_0xe4aa('0x2')](function(_0x2af37c){if(_0x2af37c){return _0xc66f13(_0x2af37c);}return _0x1832cb(_0xe4aa('0x3'));});});};exports[_0xe4aa('0x4')]=function(_0x58bec8){return connect()[_0xe4aa('0x5')](function(){return new BPromise(function(_0xe635bb,_0x336f7c){return pm2[_0xe4aa('0x4')](_0x58bec8,function(_0x315eae,_0x4271f7){if(_0x315eae){return _0x336f7c(_0x315eae);}pm2[_0xe4aa('0x6')]();return _0xe635bb(_0x4271f7);});});});};exports[_0xe4aa('0x7')]=function(_0x2b4aaa){return connect()['then'](function(){return new BPromise(function(_0x1ccc11,_0xb3587e){return pm2['stop'](_0x2b4aaa,function(_0x5f83e6,_0xf3bfb5){if(_0x5f83e6){return _0xb3587e(_0x5f83e6);}pm2[_0xe4aa('0x6')]();return _0x1ccc11(_0xf3bfb5);});});});};exports[_0xe4aa('0x8')]=function(_0x48e867){return connect()[_0xe4aa('0x5')](function(){return new BPromise(function(_0x2fbc29,_0x247cf3){return pm2[_0xe4aa('0x8')](_0x48e867,function(_0x183f54,_0x1c9b7b){if(_0x183f54){return _0x247cf3(_0x183f54);}pm2['disconnect']();return _0x2fbc29(_0x1c9b7b);});});});};exports[_0xe4aa('0x9')]=function(){return connect()['then'](function(){return new BPromise(function(_0xea7bdc,_0x209177){return pm2[_0xe4aa('0x9')](function(_0x515151,_0xdd6227){if(_0x515151){return _0x209177(_0x515151);}pm2['disconnect']();return _0xea7bdc(_0xdd6227);});});});};exports[_0xe4aa('0xa')]=function(_0x1501ae){return connect()[_0xe4aa('0x5')](function(){return new BPromise(function(_0x289a2a,_0x2abe5b){return pm2[_0xe4aa('0xa')](_0x1501ae,function(_0x1f870c,_0x12a83e){if(_0x1f870c){return _0x2abe5b(_0x1f870c);}pm2['disconnect']();return _0x289a2a(_0x12a83e);});});});};exports['delete']=function(_0x5455bb){return connect()[_0xe4aa('0x5')](function(){return new BPromise(function(_0x52b62b,_0x718564){return pm2[_0xe4aa('0xb')](_0x5455bb,function(_0xbb75cf,_0x363df4){if(_0xbb75cf){return _0x718564(_0xbb75cf);}pm2[_0xe4aa('0x6')]();return _0x52b62b(_0x363df4);});});});};exports[_0xe4aa('0xc')]=function(){return connect()[_0xe4aa('0x5')](function(){return new BPromise(function(_0x2e2774,_0x4ef1bb){return pm2['dump'](function(_0x7ee354){if(_0x7ee354){return _0x4ef1bb(_0x7ee354);}return _0x2e2774(_0xe4aa('0xd'));});});});}; \ No newline at end of file +var _0x095b=['list','describe','delete','dump','saved','pm2','bluebird','./config','connected','start','disconnect','stop','restart','then'];(function(_0x572068,_0x588353){var _0x4f3fed=function(_0x5119e7){while(--_0x5119e7){_0x572068['push'](_0x572068['shift']());}};_0x4f3fed(++_0x588353);}(_0x095b,0x10f));var _0xb095=function(_0x5b6ed3,_0x3e8959){_0x5b6ed3=_0x5b6ed3-0x0;var _0x134725=_0x095b[_0x5b6ed3];return _0x134725;};'use strict';var pm2=require(_0xb095('0x0'));var BPromise=require(_0xb095('0x1'));var config=require(_0xb095('0x2'));function connect(){return new BPromise(function(_0x37026e,_0x5250be){return pm2['connect'](function(_0x31769a){if(_0x31769a){return _0x5250be(_0x31769a);}return _0x37026e(_0xb095('0x3'));});});};exports[_0xb095('0x4')]=function(_0xfc2799){return connect()['then'](function(){return new BPromise(function(_0x29cb29,_0xbe06f5){return pm2[_0xb095('0x4')](_0xfc2799,function(_0x127a3a,_0x4ec2ec){if(_0x127a3a){return _0xbe06f5(_0x127a3a);}pm2[_0xb095('0x5')]();return _0x29cb29(_0x4ec2ec);});});});};exports[_0xb095('0x6')]=function(_0xcb23e6){return connect()['then'](function(){return new BPromise(function(_0x523e04,_0x2f675a){return pm2[_0xb095('0x6')](_0xcb23e6,function(_0x217379,_0x4b503c){if(_0x217379){return _0x2f675a(_0x217379);}pm2[_0xb095('0x5')]();return _0x523e04(_0x4b503c);});});});};exports[_0xb095('0x7')]=function(_0x26f58e){return connect()[_0xb095('0x8')](function(){return new BPromise(function(_0x1bf80a,_0x136b82){return pm2[_0xb095('0x7')](_0x26f58e,function(_0x2af5f1,_0x30bd5c){if(_0x2af5f1){return _0x136b82(_0x2af5f1);}pm2['disconnect']();return _0x1bf80a(_0x30bd5c);});});});};exports[_0xb095('0x9')]=function(){return connect()[_0xb095('0x8')](function(){return new BPromise(function(_0x54897d,_0x71812){return pm2[_0xb095('0x9')](function(_0x43c5cb,_0x388c46){if(_0x43c5cb){return _0x71812(_0x43c5cb);}pm2['disconnect']();return _0x54897d(_0x388c46);});});});};exports['describe']=function(_0x24961c){return connect()['then'](function(){return new BPromise(function(_0x16d751,_0xfaa15c){return pm2[_0xb095('0xa')](_0x24961c,function(_0x4c425b,_0x335794){if(_0x4c425b){return _0xfaa15c(_0x4c425b);}pm2[_0xb095('0x5')]();return _0x16d751(_0x335794);});});});};exports[_0xb095('0xb')]=function(_0x562269){return connect()[_0xb095('0x8')](function(){return new BPromise(function(_0x5417cc,_0x59e9b0){return pm2['delete'](_0x562269,function(_0x31a72b,_0x681cb2){if(_0x31a72b){return _0x59e9b0(_0x31a72b);}pm2['disconnect']();return _0x5417cc(_0x681cb2);});});});};exports[_0xb095('0xc')]=function(){return connect()[_0xb095('0x8')](function(){return new BPromise(function(_0x29545b,_0xddcb1e){return pm2['dump'](function(_0x3f61cf){if(_0x3f61cf){return _0xddcb1e(_0x3f61cf);}return _0x29545b(_0xb095('0xd'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index 1b73f03..9e2b3ad 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 _0x4cea=['map','info','[CHAT]\x20Interactions\x20to\x20close:','join','ChatInteraction','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','then','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','emit','chatInteraction:update','catch','error','inspect','start','moment','ioredis','util','../../config/environment','../../mysqldb','../logger','schedule','redis','defaults','localhost','socket.io-emitter','Setting','find','chatTimeout','findAll','lastMsgAt','minutes','length'];(function(_0x170095,_0x5b169b){var _0xfc555=function(_0x58a685){while(--_0x58a685){_0x170095['push'](_0x170095['shift']());}};_0xfc555(++_0x5b169b);}(_0x4cea,0x10e));var _0xa4ce=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x4cea[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require('lodash');var moment=require(_0xa4ce('0x0'));var Redis=require(_0xa4ce('0x1'));var util=require(_0xa4ce('0x2'));var config=require(_0xa4ce('0x3'));var db=require(_0xa4ce('0x4'))['db'];var logger=require(_0xa4ce('0x5'))(_0xa4ce('0x6'));config[_0xa4ce('0x7')]=_[_0xa4ce('0x8')](config[_0xa4ce('0x7')],{'host':_0xa4ce('0x9'),'port':0x18eb});var io=require(_0xa4ce('0xa'))(new Redis(config['redis']));function closeInteractions(){var _0x3ca8d3=0x0;var _0x2674d0=[];return db[_0xa4ce('0xb')][_0xa4ce('0xc')]({'raw':!![],'attributes':['id',_0xa4ce('0xd')],'where':{'id':0x1}})['then'](function(_0xf94017){_0x3ca8d3=_0xf94017['chatTimeout'];if(_0x3ca8d3){return db['ChatInteraction'][_0xa4ce('0xe')]({'raw':!![],'attributes':['id',_0xa4ce('0xf')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()['subtract'](_0xf94017[_0xa4ce('0xd')],_0xa4ce('0x10'))}}});}else{return[];}})['then'](function(_0x2e263d){if(_0x2e263d&&_0x2e263d[_0xa4ce('0x11')]){_0x2674d0=_[_0xa4ce('0x12')](_0x2e263d||[],'id');logger[_0xa4ce('0x13')](_0xa4ce('0x14'),_0x2674d0[_0xa4ce('0x15')]());return db[_0xa4ce('0x16')][_0xa4ce('0x17')]({'closeReason':_0xa4ce('0x18'),'disposition':_0xa4ce('0x19'),'closed':!![],'closedAt':moment()[_0xa4ce('0x1a')](_0xa4ce('0x1b'))},{'where':{'id':_0x2674d0}});}})[_0xa4ce('0x1c')](function(){if(_0x2674d0&&_0x2674d0[_0xa4ce('0x11')]){logger[_0xa4ce('0x13')](_0xa4ce('0x1d'),_0x2674d0[_0xa4ce('0x15')]());for(var _0xeafc35=0x0;_0xeafc35<_0x2674d0[_0xa4ce('0x11')];_0xeafc35++){io[_0xa4ce('0x1e')](_0xa4ce('0x1f'),{'id':_0x2674d0[_0xeafc35],'closed':!![]});}}})[_0xa4ce('0x20')](function(_0x3d31e8){logger[_0xa4ce('0x21')]('[CHAT]\x20Error\x20closing\x20interactions',_0x3d31e8?util[_0xa4ce('0x22')](_0x3d31e8,{'showHidden':![],'depth':null}):'');});}exports[_0xa4ce('0x23')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xf732=['[CHAT]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment','ioredis','../../mysqldb','../logger','schedule','redis','defaults','socket.io-emitter','Setting','chatTimeout','then','ChatInteraction','findAll','lastMsgAt','subtract','minutes','length','map','info','join','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','emit','chatInteraction:update','error'];(function(_0x4299fd,_0x1d2451){var _0x4e7ff3=function(_0x4ba03d){while(--_0x4ba03d){_0x4299fd['push'](_0x4299fd['shift']());}};_0x4e7ff3(++_0x1d2451);}(_0xf732,0x1f2));var _0x2f73=function(_0x468ac5,_0x2edfd5){_0x468ac5=_0x468ac5-0x0;var _0x33a807=_0xf732[_0x468ac5];return _0x33a807;};'use strict';var _=require(_0x2f73('0x0'));var moment=require(_0x2f73('0x1'));var Redis=require(_0x2f73('0x2'));var util=require('util');var config=require('../../config/environment');var db=require(_0x2f73('0x3'))['db'];var logger=require(_0x2f73('0x4'))(_0x2f73('0x5'));config[_0x2f73('0x6')]=_[_0x2f73('0x7')](config[_0x2f73('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0x2f73('0x8'))(new Redis(config[_0x2f73('0x6')]));function closeInteractions(){var _0x1ef2c5=0x0;var _0x419073=[];return db[_0x2f73('0x9')]['find']({'raw':!![],'attributes':['id',_0x2f73('0xa')],'where':{'id':0x1}})[_0x2f73('0xb')](function(_0x262fa7){_0x1ef2c5=_0x262fa7[_0x2f73('0xa')];if(_0x1ef2c5){return db[_0x2f73('0xc')][_0x2f73('0xd')]({'raw':!![],'attributes':['id',_0x2f73('0xe')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x2f73('0xf')](_0x262fa7[_0x2f73('0xa')],_0x2f73('0x10'))}}});}else{return[];}})['then'](function(_0x12bd94){if(_0x12bd94&&_0x12bd94[_0x2f73('0x11')]){_0x419073=_[_0x2f73('0x12')](_0x12bd94||[],'id');logger[_0x2f73('0x13')]('[CHAT]\x20Interactions\x20to\x20close:',_0x419073[_0x2f73('0x14')]());return db[_0x2f73('0xc')][_0x2f73('0x15')]({'closeReason':_0x2f73('0x16'),'disposition':_0x2f73('0x17'),'closed':!![],'closedAt':moment()[_0x2f73('0x18')](_0x2f73('0x19'))},{'where':{'id':_0x419073}});}})['then'](function(){if(_0x419073&&_0x419073[_0x2f73('0x11')]){logger[_0x2f73('0x13')](_0x2f73('0x1a'),_0x419073['join']());for(var _0x309c84=0x0;_0x309c84<_0x419073[_0x2f73('0x11')];_0x309c84++){io[_0x2f73('0x1b')](_0x2f73('0x1c'),{'id':_0x419073[_0x309c84],'closed':!![]});}}})['catch'](function(_0x52cacf){logger[_0x2f73('0x1d')](_0x2f73('0x1e'),_0x52cacf?util[_0x2f73('0x1f')](_0x52cacf,{'showHidden':![],'depth':null}):'');});}exports[_0x2f73('0x20')]=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 eb1613c..b3d3f35 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 _0x5c98=['exports'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x5c98,0x95));var _0x85c9=function(_0x5e8917,_0x3a1df5){_0x5e8917=_0x5e8917-0x0;var _0x20374a=_0x5c98[_0x5e8917];return _0x20374a;};'use strict';function start(){var _0x2a36d2=require('../../api/cloudProvider/cloudProvider.oauth.js');return _0x2a36d2['startAllRefreshIntervals']();}module[_0x85c9('0x0')]={'intervals':{},'start':start}; \ No newline at end of file +var _0x746c=['../../api/cloudProvider/cloudProvider.oauth.js'];(function(_0x1ed406,_0x3b3184){var _0x359b38=function(_0x35dc97){while(--_0x35dc97){_0x1ed406['push'](_0x1ed406['shift']());}};_0x359b38(++_0x3b3184);}(_0x746c,0x6b));var _0xc746=function(_0x2513a1,_0x1ffb95){_0x2513a1=_0x2513a1-0x0;var _0x36e5e7=_0x746c[_0x2513a1];return _0x36e5e7;};'use strict';function start(){var _0x5ac2ea=require(_0xc746('0x0'));return _0x5ac2ea['startAllRefreshIntervals']();}module['exports']={'intervals':{},'start':start}; \ No newline at end of file diff --git a/server/config/schedule/index.js b/server/config/schedule/index.js index 641197e..24d2573 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 _0x45f4=['CustomReportId','runReport','no\x20report\x20id','Schedule','findAll','MailServerOut','CloudProvider','jobs','keyBy','toString','difference','length','exists','stop','delete\x20cron','toRun','my\x20id','cron','active','isBetween','startAt','endAt','add','start','add\x20cron','deleteJob','stop\x20cron','update\x20cron','run','util','path','lodash','moment','cron-job-manager','jayson/promise','bluebird','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','info','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','\x22%s\x22\x20<%s>','Smtp','bcc','format','Report\x20%s\x20last\x20%s\x20%s','name','subtractUnit','join','../../files/reports','savename','basename','extname','zip','existsSync','status','Sent','message','attachments','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','sendIfEmpty','empty\x20file,\x20email\x20not\x20sent','request','SendMail','then','error','error\x20mail','email\x20sent','data','isNil','subtractNumber','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','DefaultReportId','exec\x20defaul\x20report\x20id:%s','catch'];(function(_0x45d80c,_0x35c0ff){var _0x449a98=function(_0x1b5ab7){while(--_0x1b5ab7){_0x45d80c['push'](_0x45d80c['shift']());}};_0x449a98(++_0x35c0ff);}(_0x45f4,0xc5));var _0x445f=function(_0x38321d,_0x3cfdf0){_0x38321d=_0x38321d-0x0;var _0x553c0f=_0x45f4[_0x38321d];return _0x553c0f;};'use strict';var fs=require('fs');var util=require(_0x445f('0x0'));var path=require(_0x445f('0x1'));var _=require(_0x445f('0x2'));var moment=require(_0x445f('0x3'));var CronJobManager=require(_0x445f('0x4'));var jayson=require(_0x445f('0x5'));var BPromise=require(_0x445f('0x6'));var logger=require('../logger')('schedule');var db=require(_0x445f('0x7'))['db'];var analyticCustomReportController=require(_0x445f('0x8'));var analyticDefaultReportController=require(_0x445f('0x9'));var client=jayson[_0x445f('0xa')]['http']({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x36d4b3,_0xabf51b){return function(){logger[_0x445f('0xb')](_0x445f('0xc'),_0x36d4b3[_0x445f('0xd')]);var _0x116743=!![];var _0x1c5952=_0x36d4b3[_0x445f('0xe')]['getSmtpOptions']();var _0x79e69e={'account':_0x1c5952,'message':{'from':util['format'](_0x445f('0xf'),_0x36d4b3['MailAccount']['name'],_0x36d4b3['MailAccount'][_0x445f('0xd')]||_0x36d4b3[_0x445f('0xe')][_0x445f('0x10')]['user']),'to':_0x36d4b3[_0x445f('0xd')],'cc':_0x36d4b3['cc'],'bcc':_0x36d4b3[_0x445f('0x11')],'subject':util[_0x445f('0x12')](_0x445f('0x13'),_0xabf51b[_0x445f('0x14')],_0x36d4b3['subtractNumber'],_0x36d4b3[_0x445f('0x15')])}};var _0x32923c=path[_0x445f('0x16')](__dirname,_0x445f('0x17'));var _0x5ed957=_0xabf51b[_0x445f('0x18')];var _0x3d3139=util[_0x445f('0x12')]('%s.%s',path[_0x445f('0x19')](_0xabf51b[_0x445f('0x18')],path[_0x445f('0x1a')](_0xabf51b[_0x445f('0x18')])),_0x445f('0x1b'));var _0x5db004=path['join'](_0x32923c,_0x5ed957);var _0x2f732d=path[_0x445f('0x16')](_0x32923c,_0x3d3139);if(fs[_0x445f('0x1c')](_0x5db004)){_0xabf51b[_0x445f('0x1d')]=_0x445f('0x1e');_0x79e69e[_0x445f('0x1f')][_0x445f('0x20')]=[{'filename':_0x5ed957,'path':_0x5db004}];_0x79e69e[_0x445f('0x1f')][_0x445f('0x21')]=util['format'](_0x445f('0x22'),JSON[_0x445f('0x23')](_0xabf51b,null,0x2));}else if(fs[_0x445f('0x1c')](_0x2f732d)){_0xabf51b['status']=_0x445f('0x1e');_0x79e69e[_0x445f('0x1f')][_0x445f('0x20')]=[{'filename':_0x3d3139,'path':_0x2f732d}];}else{_0x79e69e[_0x445f('0x1f')][_0x445f('0x21')]='Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';if(!_0x36d4b3[_0x445f('0x24')]){_0x116743=![];logger[_0x445f('0xb')](_0x445f('0x25'));}}if(_0x116743){return client[_0x445f('0x26')](_0x445f('0x27'),_0x79e69e)[_0x445f('0x28')](function(_0xb7a4e7){if(_0xb7a4e7[_0x445f('0x29')]){return logger[_0x445f('0x29')](_0x445f('0x2a'),JSON[_0x445f('0x23')](_0xb7a4e7));}return logger[_0x445f('0xb')](_0x445f('0x2b'));})['catch'](function(_0x2f6ebe){return logger['error'](_0x445f('0x2a'),JSON[_0x445f('0x23')](_0x2f6ebe));});}};}function handleError(){return function(_0x31d49c){return logger[_0x445f('0x29')](JSON[_0x445f('0x23')](_0x31d49c));};}function handleResult(_0x2a4872){return function(_0x182f49){logger[_0x445f('0xb')](_0x445f('0x2c'),JSON[_0x445f('0x23')](_0x182f49));if(_0x2a4872[_0x445f('0xe')]&&_0x2a4872['MailAccount']['Smtp']&&!_[_0x445f('0x2d')](_0x2a4872['email'])){setTimeout(handleSendEmail(_0x2a4872,_0x182f49),0x3c*0x3e8);}};}function handleJob(_0x59be0c){return function(){try{if(_[_0x445f('0x2d')](_0x59be0c[_0x445f('0x2e')])){return logger[_0x445f('0xb')](_0x445f('0x2f'));}if(_[_0x445f('0x2d')](_0x59be0c['subtractUnit'])){return logger[_0x445f('0xb')](_0x445f('0x30'));}var _0x27a53e={'startDate':moment()[_0x445f('0x31')](_0x59be0c[_0x445f('0x2e')],_0x59be0c[_0x445f('0x15')])['format'](_0x445f('0x32')),'endDate':moment()[_0x445f('0x12')](_0x445f('0x32')),'type':_0x445f('0x33'),'output':_0x59be0c['output'],'name':_0x59be0c['name']};if(!_[_0x445f('0x2d')](_0x59be0c[_0x445f('0x34')])){logger['info'](_0x445f('0x35'),_0x59be0c['DefaultReportId']);return analyticDefaultReportController['runReport']({'id':_0x59be0c[_0x445f('0x34')]},_0x27a53e)[_0x445f('0x28')](handleResult(_0x59be0c))[_0x445f('0x36')](handleError());}if(!_[_0x445f('0x2d')](_0x59be0c[_0x445f('0x37')])){logger[_0x445f('0xb')]('exec\x20custom\x20report\x20id:%s',_0x59be0c[_0x445f('0x37')]);return analyticCustomReportController[_0x445f('0x38')]({'id':_0x59be0c[_0x445f('0x37')]},_0x27a53e)['then'](handleResult(_0x59be0c))[_0x445f('0x36')](handleError());}}catch(_0x20f4fa){logger[_0x445f('0x29')](JSON['stringify'](_0x20f4fa));}return logger[_0x445f('0xb')](_0x445f('0x39'));};}function getJobs(_0x507493){var _0x1f57d0={};if(_0x507493){_0x1f57d0['id']=_0x507493;}return db[_0x445f('0x3a')][_0x445f('0x3b')]({'where':_0x1f57d0,'include':[{'model':db[_0x445f('0xe')],'attributes':['id',_0x445f('0x14'),_0x445f('0xd')],'include':[{'model':db[_0x445f('0x3c')],'as':_0x445f('0x10'),'include':[{'model':db[_0x445f('0x3d')],'as':_0x445f('0x3d')}]}]}]})['then'](function(_0x3041d5){var _0x14b875=_['keys'](manager[_0x445f('0x3e')]);var _0x4ad9e7=_['map'](_0x3041d5,function(_0x47115c){return _0x47115c['id']['toString']();});var _0x5a2280=_[_0x445f('0x3f')](_0x3041d5,function(_0x5d7f20){return _0x5d7f20['id'][_0x445f('0x40')]();});var _0x3edc98=_0x507493?_0x4ad9e7:_[_0x445f('0x41')](_0x4ad9e7,_0x14b875);var _0x4e5224=_['intersection'](_0x4ad9e7,_0x14b875);var _0x450b74=_['difference'](_0x14b875,_0x4ad9e7);var _0x21ae0d;var _0x180842;for(_0x21ae0d=0x0;_0x21ae0d<_0x450b74[_0x445f('0x42')]&&!_0x507493;_0x21ae0d+=0x1){_0x180842=_0x450b74[_0x21ae0d]['toString']();if(manager[_0x445f('0x43')](_0x180842)){manager[_0x445f('0x44')](_0x180842);manager['deleteJob'](_0x180842);logger['info'](_0x445f('0x45'),_0x180842);}}logger['info'](_0x445f('0x46'),JSON[_0x445f('0x23')](_0x3edc98));for(_0x21ae0d=0x0;_0x21ae0d<_0x3edc98[_0x445f('0x42')];_0x21ae0d+=0x1){_0x180842=_0x3edc98[_0x21ae0d]['toString']();logger['info']('index',_0x180842);if(_0x507493){logger[_0x445f('0xb')](_0x445f('0x47'),_0x507493);logger[_0x445f('0xb')](JSON['stringify'](_0x5a2280[_0x180842]));BPromise['resolve']()[_0x445f('0x28')](handleJob(_0x5a2280[_0x180842]));logger[_0x445f('0xb')]('run\x20job',_0x5a2280[_0x180842]['name'],_0x5a2280[_0x180842][_0x445f('0x48')]);}else if(_0x5a2280[_0x180842][_0x445f('0x48')]&&_0x5a2280[_0x180842][_0x445f('0x49')]&&moment()[_0x445f('0x4a')](_0x5a2280[_0x180842][_0x445f('0x4b')],_0x5a2280[_0x180842][_0x445f('0x4c')])){manager[_0x445f('0x4d')](_0x180842,_0x5a2280[_0x180842]['cron'],handleJob(_0x5a2280[_0x180842]));manager[_0x445f('0x4e')](_0x180842);logger[_0x445f('0xb')](_0x445f('0x4f'),_0x5a2280[_0x180842][_0x445f('0x14')],_0x5a2280[_0x180842][_0x445f('0x48')]);}else if(manager['exists'](_0x180842)){manager['stop'](_0x180842);manager[_0x445f('0x50')](_0x180842);logger[_0x445f('0xb')](_0x445f('0x51'),_0x5a2280[_0x180842][_0x445f('0x14')],_0x5a2280[_0x180842][_0x445f('0x48')]);}}for(_0x21ae0d=0x0,_0x180842;_0x21ae0d<_0x4e5224[_0x445f('0x42')]&&!_0x507493;_0x21ae0d+=0x1){_0x180842=_0x4e5224[_0x21ae0d][_0x445f('0x40')]();if(manager[_0x445f('0x43')](_0x180842)){if(_0x5a2280[_0x180842][_0x445f('0x48')]&&_0x5a2280[_0x180842][_0x445f('0x49')]&&moment()['isBetween'](_0x5a2280[_0x180842][_0x445f('0x4b')],_0x5a2280[_0x180842][_0x445f('0x4c')])){manager['update'](_0x180842,_0x5a2280[_0x180842]['cron'],handleJob(_0x5a2280[_0x180842]));logger['info'](_0x445f('0x52'),_0x5a2280[_0x180842][_0x445f('0x14')],_0x5a2280[_0x180842][_0x445f('0x48')]);}else{manager[_0x445f('0x44')](_0x180842);manager['deleteJob'](_0x180842);logger[_0x445f('0xb')](_0x445f('0x51'),_0x5a2280[_0x180842]['name'],_0x5a2280[_0x180842][_0x445f('0x48')]);}}}})[_0x445f('0x36')](function(_0x53c20a){logger[_0x445f('0x29')](JSON[_0x445f('0x23')](_0x53c20a));});}exports[_0x445f('0x53')]=function(_0x183a97){return getJobs(_0x183a97);};exports['start']=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0x5759=['length','exists','delete\x20cron','toRun','my\x20id','cron','isBetween','startAt','endAt','start','add\x20cron','stop','deleteJob','stop\x20cron','update','update\x20cron','util','cron-job-manager','jayson/promise','bluebird','../logger','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','info','email','MailAccount','getSmtpOptions','format','\x22%s\x22\x20<%s>','Smtp','user','bcc','Report\x20%s\x20last\x20%s\x20%s','name','subtractNumber','join','../../files/reports','basename','savename','extname','existsSync','status','Sent','attachments','message','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','text','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','empty\x20file,\x20email\x20not\x20sent','SendMail','then','error','error\x20mail','email\x20sent','catch','data','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit','subtractUnit\x20null\x20or\x20undefined','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','exec\x20defaul\x20report\x20id:%s','DefaultReportId','runReport','CustomReportId','exec\x20custom\x20report\x20id:%s','no\x20report\x20id','Schedule','findAll','MailServerOut','CloudProvider','keys','map','toString','keyBy','difference'];(function(_0x540326,_0x550e2b){var _0x560666=function(_0x211124){while(--_0x211124){_0x540326['push'](_0x540326['shift']());}};_0x560666(++_0x550e2b);}(_0x5759,0x160));var _0x9575=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0x5759[_0x2f3848];return _0x102668;};'use strict';var fs=require('fs');var util=require(_0x9575('0x0'));var path=require('path');var _=require('lodash');var moment=require('moment');var CronJobManager=require(_0x9575('0x1'));var jayson=require(_0x9575('0x2'));var BPromise=require(_0x9575('0x3'));var logger=require(_0x9575('0x4'))(_0x9575('0x5'));var db=require(_0x9575('0x6'))['db'];var analyticCustomReportController=require(_0x9575('0x7'));var analyticDefaultReportController=require(_0x9575('0x8'));var client=jayson[_0x9575('0x9')][_0x9575('0xa')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x357672,_0x48f6c5){return function(){logger[_0x9575('0xb')]('Try\x20to\x20send\x20a\x20mail\x20to',_0x357672[_0x9575('0xc')]);var _0xb361e4=!![];var _0x3418ad=_0x357672[_0x9575('0xd')][_0x9575('0xe')]();var _0x1c0cd7={'account':_0x3418ad,'message':{'from':util[_0x9575('0xf')](_0x9575('0x10'),_0x357672[_0x9575('0xd')]['name'],_0x357672[_0x9575('0xd')]['email']||_0x357672[_0x9575('0xd')][_0x9575('0x11')][_0x9575('0x12')]),'to':_0x357672[_0x9575('0xc')],'cc':_0x357672['cc'],'bcc':_0x357672[_0x9575('0x13')],'subject':util[_0x9575('0xf')](_0x9575('0x14'),_0x48f6c5[_0x9575('0x15')],_0x357672[_0x9575('0x16')],_0x357672['subtractUnit'])}};var _0x8320ff=path[_0x9575('0x17')](__dirname,_0x9575('0x18'));var _0xeb27cb=_0x48f6c5['savename'];var _0x513695=util[_0x9575('0xf')]('%s.%s',path[_0x9575('0x19')](_0x48f6c5[_0x9575('0x1a')],path[_0x9575('0x1b')](_0x48f6c5[_0x9575('0x1a')])),'zip');var _0x16ef5c=path[_0x9575('0x17')](_0x8320ff,_0xeb27cb);var _0x25bea6=path[_0x9575('0x17')](_0x8320ff,_0x513695);if(fs[_0x9575('0x1c')](_0x16ef5c)){_0x48f6c5[_0x9575('0x1d')]=_0x9575('0x1e');_0x1c0cd7['message'][_0x9575('0x1f')]=[{'filename':_0xeb27cb,'path':_0x16ef5c}];_0x1c0cd7[_0x9575('0x20')]['text']=util['format'](_0x9575('0x21'),JSON[_0x9575('0x22')](_0x48f6c5,null,0x2));}else if(fs[_0x9575('0x1c')](_0x25bea6)){_0x48f6c5[_0x9575('0x1d')]='Sent';_0x1c0cd7['message'][_0x9575('0x1f')]=[{'filename':_0x513695,'path':_0x25bea6}];}else{_0x1c0cd7[_0x9575('0x20')][_0x9575('0x23')]=_0x9575('0x24');if(!_0x357672[_0x9575('0x25')]){_0xb361e4=![];logger[_0x9575('0xb')](_0x9575('0x26'));}}if(_0xb361e4){return client['request'](_0x9575('0x27'),_0x1c0cd7)[_0x9575('0x28')](function(_0x1fd9f5){if(_0x1fd9f5['error']){return logger[_0x9575('0x29')](_0x9575('0x2a'),JSON[_0x9575('0x22')](_0x1fd9f5));}return logger[_0x9575('0xb')](_0x9575('0x2b'));})[_0x9575('0x2c')](function(_0x49c267){return logger[_0x9575('0x29')](_0x9575('0x2a'),JSON[_0x9575('0x22')](_0x49c267));});}};}function handleError(){return function(_0x463aa3){return logger['error'](JSON[_0x9575('0x22')](_0x463aa3));};}function handleResult(_0x36cd92){return function(_0x18fa51){logger['info'](_0x9575('0x2d'),JSON[_0x9575('0x22')](_0x18fa51));if(_0x36cd92['MailAccount']&&_0x36cd92[_0x9575('0xd')][_0x9575('0x11')]&&!_[_0x9575('0x2e')](_0x36cd92[_0x9575('0xc')])){setTimeout(handleSendEmail(_0x36cd92,_0x18fa51),0x3c*0x3e8);}};}function handleJob(_0x410024){return function(){try{if(_[_0x9575('0x2e')](_0x410024[_0x9575('0x16')])){return logger[_0x9575('0xb')](_0x9575('0x2f'));}if(_[_0x9575('0x2e')](_0x410024[_0x9575('0x30')])){return logger[_0x9575('0xb')](_0x9575('0x31'));}var _0x15fd6f={'startDate':moment()['subtract'](_0x410024[_0x9575('0x16')],_0x410024[_0x9575('0x30')])['format'](_0x9575('0x32')),'endDate':moment()['format'](_0x9575('0x32')),'type':_0x9575('0x33'),'output':_0x410024[_0x9575('0x34')],'name':_0x410024[_0x9575('0x15')]};if(!_[_0x9575('0x2e')](_0x410024['DefaultReportId'])){logger['info'](_0x9575('0x35'),_0x410024[_0x9575('0x36')]);return analyticDefaultReportController[_0x9575('0x37')]({'id':_0x410024[_0x9575('0x36')]},_0x15fd6f)['then'](handleResult(_0x410024))[_0x9575('0x2c')](handleError());}if(!_[_0x9575('0x2e')](_0x410024[_0x9575('0x38')])){logger[_0x9575('0xb')](_0x9575('0x39'),_0x410024[_0x9575('0x38')]);return analyticCustomReportController[_0x9575('0x37')]({'id':_0x410024[_0x9575('0x38')]},_0x15fd6f)[_0x9575('0x28')](handleResult(_0x410024))['catch'](handleError());}}catch(_0x87461e){logger[_0x9575('0x29')](JSON[_0x9575('0x22')](_0x87461e));}return logger[_0x9575('0xb')](_0x9575('0x3a'));};}function getJobs(_0x48fe02){var _0x4c4f6d={};if(_0x48fe02){_0x4c4f6d['id']=_0x48fe02;}return db[_0x9575('0x3b')][_0x9575('0x3c')]({'where':_0x4c4f6d,'include':[{'model':db[_0x9575('0xd')],'attributes':['id',_0x9575('0x15'),_0x9575('0xc')],'include':[{'model':db[_0x9575('0x3d')],'as':_0x9575('0x11'),'include':[{'model':db[_0x9575('0x3e')],'as':_0x9575('0x3e')}]}]}]})[_0x9575('0x28')](function(_0x23c3ba){var _0x265c4c=_[_0x9575('0x3f')](manager['jobs']);var _0x1a4cdc=_[_0x9575('0x40')](_0x23c3ba,function(_0x467742){return _0x467742['id'][_0x9575('0x41')]();});var _0x3f97c5=_[_0x9575('0x42')](_0x23c3ba,function(_0x249828){return _0x249828['id']['toString']();});var _0x2da7be=_0x48fe02?_0x1a4cdc:_[_0x9575('0x43')](_0x1a4cdc,_0x265c4c);var _0x2f786d=_['intersection'](_0x1a4cdc,_0x265c4c);var _0x5c861c=_[_0x9575('0x43')](_0x265c4c,_0x1a4cdc);var _0x29bd0b;var _0x30ae7f;for(_0x29bd0b=0x0;_0x29bd0b<_0x5c861c[_0x9575('0x44')]&&!_0x48fe02;_0x29bd0b+=0x1){_0x30ae7f=_0x5c861c[_0x29bd0b]['toString']();if(manager[_0x9575('0x45')](_0x30ae7f)){manager['stop'](_0x30ae7f);manager['deleteJob'](_0x30ae7f);logger['info'](_0x9575('0x46'),_0x30ae7f);}}logger[_0x9575('0xb')](_0x9575('0x47'),JSON[_0x9575('0x22')](_0x2da7be));for(_0x29bd0b=0x0;_0x29bd0b<_0x2da7be[_0x9575('0x44')];_0x29bd0b+=0x1){_0x30ae7f=_0x2da7be[_0x29bd0b][_0x9575('0x41')]();logger[_0x9575('0xb')]('index',_0x30ae7f);if(_0x48fe02){logger[_0x9575('0xb')](_0x9575('0x48'),_0x48fe02);logger[_0x9575('0xb')](JSON[_0x9575('0x22')](_0x3f97c5[_0x30ae7f]));BPromise['resolve']()[_0x9575('0x28')](handleJob(_0x3f97c5[_0x30ae7f]));logger[_0x9575('0xb')]('run\x20job',_0x3f97c5[_0x30ae7f][_0x9575('0x15')],_0x3f97c5[_0x30ae7f][_0x9575('0x49')]);}else if(_0x3f97c5[_0x30ae7f][_0x9575('0x49')]&&_0x3f97c5[_0x30ae7f]['active']&&moment()[_0x9575('0x4a')](_0x3f97c5[_0x30ae7f][_0x9575('0x4b')],_0x3f97c5[_0x30ae7f][_0x9575('0x4c')])){manager['add'](_0x30ae7f,_0x3f97c5[_0x30ae7f][_0x9575('0x49')],handleJob(_0x3f97c5[_0x30ae7f]));manager[_0x9575('0x4d')](_0x30ae7f);logger['info'](_0x9575('0x4e'),_0x3f97c5[_0x30ae7f][_0x9575('0x15')],_0x3f97c5[_0x30ae7f][_0x9575('0x49')]);}else if(manager[_0x9575('0x45')](_0x30ae7f)){manager[_0x9575('0x4f')](_0x30ae7f);manager[_0x9575('0x50')](_0x30ae7f);logger[_0x9575('0xb')](_0x9575('0x51'),_0x3f97c5[_0x30ae7f][_0x9575('0x15')],_0x3f97c5[_0x30ae7f]['cron']);}}for(_0x29bd0b=0x0,_0x30ae7f;_0x29bd0b<_0x2f786d['length']&&!_0x48fe02;_0x29bd0b+=0x1){_0x30ae7f=_0x2f786d[_0x29bd0b]['toString']();if(manager['exists'](_0x30ae7f)){if(_0x3f97c5[_0x30ae7f]['cron']&&_0x3f97c5[_0x30ae7f]['active']&&moment()[_0x9575('0x4a')](_0x3f97c5[_0x30ae7f]['startAt'],_0x3f97c5[_0x30ae7f][_0x9575('0x4c')])){manager[_0x9575('0x52')](_0x30ae7f,_0x3f97c5[_0x30ae7f][_0x9575('0x49')],handleJob(_0x3f97c5[_0x30ae7f]));logger[_0x9575('0xb')](_0x9575('0x53'),_0x3f97c5[_0x30ae7f][_0x9575('0x15')],_0x3f97c5[_0x30ae7f][_0x9575('0x49')]);}else{manager[_0x9575('0x4f')](_0x30ae7f);manager[_0x9575('0x50')](_0x30ae7f);logger['info'](_0x9575('0x51'),_0x3f97c5[_0x30ae7f][_0x9575('0x15')],_0x3f97c5[_0x30ae7f][_0x9575('0x49')]);}}}})[_0x9575('0x2c')](function(_0x2d47c4){logger[_0x9575('0x29')](JSON[_0x9575('0x22')](_0x2d47c4));});}exports['run']=function(_0x51735e){return getJobs(_0x51735e);};exports[_0x9575('0x4d')]=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 83f8841..5acc463 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 _0xa5fa=['results','transcripts','length','transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','ValidationError','sentimentAccountId','language','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','Sequelize','Cloud\x20Provider\x20not\x20available','data2','Cloud\x20Provider\x20not\x20configured','sentimentRegion','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Positive','Mixed','Neutral','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','Sentiment\x20Analysis\x20not\x20requested','sentiment','bucket','CloudProvider','findOne','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','Negative','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribeAccountId','push','all','catch','start','aws-sdk','request-promise','util','bluebird','../../config/logger','transcribe','TranscribeService','getTranscriptionJob','detectSentiment','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','fileText','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','[RECORDING:%d]\x20Transcript\x20downloaded'];(function(_0x1a9c2d,_0x18eecf){var _0x3a6370=function(_0x217435){while(--_0x217435){_0x1a9c2d['push'](_0x1a9c2d['shift']());}};_0x3a6370(++_0x18eecf);}(_0xa5fa,0xc4));var _0xaa5f=function(_0x499573,_0x5e995b){_0x499573=_0x499573-0x0;var _0x1757e5=_0xa5fa[_0x499573];return _0x1757e5;};var _=require('lodash');var AWS=require(_0xaa5f('0x0'));var rp=require(_0xaa5f('0x1'));var util=require(_0xaa5f('0x2'));var BPromise=require(_0xaa5f('0x3'));var db=require('../../mysqldb')['db'];var logger=require(_0xaa5f('0x4'))(_0xaa5f('0x5'));function getTranscriptionJob(_0x4d1c8b,_0x233cd6,_0x42450a,_0x37f7bc){return new Promise(function(_0x20744d,_0x3d1489){var _0x13b606=new AWS[(_0xaa5f('0x6'))]({'accessKeyId':_0x233cd6,'secretAccessKey':_0x4d1c8b,'region':_0x42450a});_0x13b606[_0xaa5f('0x7')]({'TranscriptionJobName':_0x37f7bc},function(_0x74f64f,_0x3f550e){if(_0x74f64f){return _0x3d1489(_0x74f64f);}else{return _0x20744d(_0x3f550e);}});});}function sentiment(_0xb96e0,_0x4e5257,_0x1674c2,_0x227ebb,_0x4d3d16){return new Promise(function(_0x538865,_0x3fa93f){var _0x4bb69d=new AWS['Comprehend']({'accessKeyId':_0x4e5257,'secretAccessKey':_0xb96e0,'region':_0x1674c2});_0x4bb69d[_0xaa5f('0x8')]({'Text':_0x227ebb,'LanguageCode':_0x4d3d16['substring'](0x0,0x2)},function(_0x1781e4,_0x471e14){if(_0x1781e4){return _0x3fa93f(_0x1781e4);}else{return _0x538865(_0x471e14);}});});}function checkTranscribeJob(_0x206ed3,_0x9aeae9,_0x252ae0){var _0x48d1d3;return new BPromise(function(_0xbd4e10,_0x552c53){logger[_0xaa5f('0x9')](util[_0xaa5f('0xa')](_0xaa5f('0xb'),_0x206ed3['id'],_0x206ed3[_0xaa5f('0xc')]));return getTranscriptionJob(_0x252ae0[_0xaa5f('0xd')],_0x252ae0['data2'],_0x9aeae9['transcribeRegion'],_0x206ed3[_0xaa5f('0xc')])[_0xaa5f('0xe')](function(_0xb0bfb6){logger[_0xaa5f('0x9')](util[_0xaa5f('0xa')](_0xaa5f('0xf'),_0x206ed3['id'],_0x206ed3[_0xaa5f('0xc')],_0xb0bfb6[_0xaa5f('0x10')][_0xaa5f('0x11')]));if(!_0x206ed3[_0xaa5f('0x12')]){switch(_0xb0bfb6[_0xaa5f('0x10')][_0xaa5f('0x11')]){case'COMPLETED':var _0x1c072={'transcribeStatus':_0xb0bfb6[_0xaa5f('0x10')][_0xaa5f('0x11')],'fileUri':_0xb0bfb6[_0xaa5f('0x10')][_0xaa5f('0x13')][_0xaa5f('0x14')]};logger[_0xaa5f('0x9')](util[_0xaa5f('0xa')](_0xaa5f('0x15'),_0x206ed3['id']));return rp({'uri':_0xb0bfb6[_0xaa5f('0x10')][_0xaa5f('0x13')][_0xaa5f('0x14')],'json':!![]})[_0xaa5f('0xe')](function(_0x5238a8){logger[_0xaa5f('0x9')](util['format'](_0xaa5f('0x16'),_0x206ed3['id']));if(_0x5238a8&&_0x5238a8[_0xaa5f('0x17')]&&_0x5238a8['results'][_0xaa5f('0x18')]&&_0x5238a8[_0xaa5f('0x17')]['transcripts'][_0xaa5f('0x19')]){_0x1c072[_0xaa5f('0x12')]='';for(var _0x32cd16=0x0;_0x32cd16<_0x5238a8[_0xaa5f('0x17')][_0xaa5f('0x18')][_0xaa5f('0x19')];_0x32cd16++){_0x1c072[_0xaa5f('0x12')]+=_0x5238a8[_0xaa5f('0x17')]['transcripts'][_0x32cd16][_0xaa5f('0x1a')]+'';}}return _0x206ed3[_0xaa5f('0x1b')](_0x1c072);})[_0xaa5f('0xe')](function(){logger['info'](util[_0xaa5f('0xa')](_0xaa5f('0x1c'),_0x206ed3['id']));if(!_0x206ed3[_0xaa5f('0x1d')]){throw new db['Sequelize'][(_0xaa5f('0x1e'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x9aeae9['sentiment']||!_0x9aeae9[_0xaa5f('0x1f')]||!_0x9aeae9['sentimentRegion']||!_0x9aeae9[_0xaa5f('0x20')]||!_0x9aeae9['bucket']){throw new db['Sequelize']['ValidationError'](_0xaa5f('0x21'));}if(!_0x1c072['fileText']){throw new Error(_0xaa5f('0x22'));}if(_0x9aeae9[_0xaa5f('0x1f')]===_0x252ae0['id']){return _0x252ae0;}else{return db['CloudProvider']['findOne']({'where':{'id':_settings[_0xaa5f('0x1f')]}});}})['then'](function(_0x13e1bb){if(!_0x13e1bb){throw new db[(_0xaa5f('0x23'))]['ValidationError'](_0xaa5f('0x24'));}if(!_0x13e1bb[_0xaa5f('0xd')]||!_0x13e1bb[_0xaa5f('0x25')]){throw new db['Sequelize'][(_0xaa5f('0x1e'))](_0xaa5f('0x26'));}_0x48d1d3=_0x13e1bb;logger['info'](util['format']('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x206ed3['id']));return sentiment(_0x48d1d3['data1'],_0x48d1d3[_0xaa5f('0x25')],_0x9aeae9[_0xaa5f('0x27')],_0x1c072[_0xaa5f('0x12')],_0x9aeae9[_0xaa5f('0x20')]);})[_0xaa5f('0xe')](function(_0x3bcaf6){logger[_0xaa5f('0x9')](util['format'](_0xaa5f('0x28'),_0x206ed3['id']));return _0x206ed3[_0xaa5f('0x1b')]({'sentiment':_0x3bcaf6[_0xaa5f('0x29')],'sPositive':_0x3bcaf6[_0xaa5f('0x2a')][_0xaa5f('0x2b')],'sNegative':_0x3bcaf6[_0xaa5f('0x2a')]['Negative'],'sMixed':_0x3bcaf6[_0xaa5f('0x2a')][_0xaa5f('0x2c')],'sNeutral':_0x3bcaf6[_0xaa5f('0x2a')][_0xaa5f('0x2d')]});})[_0xaa5f('0xe')](function(){logger['info'](util['format'](_0xaa5f('0x1c'),_0x206ed3['id']));_0xbd4e10();});case _0xaa5f('0x2e'):return _0x206ed3[_0xaa5f('0x1b')]({'transcribeStatus':_0xaa5f('0x2e'),'failureReason':_0xb0bfb6['TranscriptionJob'][_0xaa5f('0x2f')]})[_0xaa5f('0xe')](function(){logger[_0xaa5f('0x9')](util[_0xaa5f('0xa')](_0xaa5f('0x1c'),_0x206ed3['id']));_0xbd4e10();});default:logger[_0xaa5f('0x9')](util[_0xaa5f('0xa')](_0xaa5f('0x30'),_0x206ed3['id']));break;}}else{return BPromise[_0xaa5f('0x31')]()[_0xaa5f('0xe')](function(){if(!_0x206ed3[_0xaa5f('0x1d')]){throw new db['Sequelize'][(_0xaa5f('0x1e'))](_0xaa5f('0x32'));}if(!_0x9aeae9[_0xaa5f('0x33')]||!_0x9aeae9[_0xaa5f('0x1f')]||!_0x9aeae9[_0xaa5f('0x27')]||!_0x9aeae9[_0xaa5f('0x20')]||!_0x9aeae9[_0xaa5f('0x34')]){throw new db[(_0xaa5f('0x23'))][(_0xaa5f('0x1e'))](_0xaa5f('0x21'));}if(!_0x206ed3['fileText']){throw new Error(_0xaa5f('0x22'));}if(_0x9aeae9['sentimentAccountId']===_0x252ae0['id']){return _0x252ae0;}else{return db[_0xaa5f('0x35')][_0xaa5f('0x36')]({'where':{'id':_settings[_0xaa5f('0x1f')]}});}})['then'](function(_0x1e535f){if(!_0x1e535f){throw new db[(_0xaa5f('0x23'))][(_0xaa5f('0x1e'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x1e535f[_0xaa5f('0xd')]||!_0x1e535f[_0xaa5f('0x25')]){throw new db[(_0xaa5f('0x23'))][(_0xaa5f('0x1e'))]('Cloud\x20Provider\x20not\x20configured');}_0x48d1d3=_0x1e535f;logger[_0xaa5f('0x9')](util[_0xaa5f('0xa')](_0xaa5f('0x37'),_0x206ed3['id']));return sentiment(_0x48d1d3[_0xaa5f('0xd')],_0x48d1d3[_0xaa5f('0x25')],_0x9aeae9[_0xaa5f('0x27')],_0x206ed3[_0xaa5f('0x12')],_0x9aeae9[_0xaa5f('0x20')]);})['then'](function(_0x137fc1){logger['info'](util[_0xaa5f('0xa')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x206ed3['id']));return _0x206ed3[_0xaa5f('0x1b')]({'sentiment':_0x137fc1[_0xaa5f('0x29')],'sPositive':_0x137fc1['SentimentScore'][_0xaa5f('0x2b')],'sNegative':_0x137fc1[_0xaa5f('0x2a')][_0xaa5f('0x38')],'sMixed':_0x137fc1['SentimentScore']['Mixed'],'sNeutral':_0x137fc1['SentimentScore'][_0xaa5f('0x2d')],'transcribeStatus':'COMPLETED'});})[_0xaa5f('0xe')](function(){logger[_0xaa5f('0x9')](util[_0xaa5f('0xa')](_0xaa5f('0x1c'),_0x206ed3['id']));_0xbd4e10();});}})['catch'](function(_0x47758b){if(_0x47758b){if(!_0x47758b[_0xaa5f('0x39')]||_0x47758b[_0xaa5f('0x39')]!==_0xaa5f('0x3a')){logger[_0xaa5f('0x3b')](util[_0xaa5f('0xa')](_0xaa5f('0x3c'),_0x206ed3['id']),util[_0xaa5f('0x3d')](_0x47758b,{'showHidden':![],'depth':null}));}}_0xbd4e10();});});}function checkTranscribe(){var _0x124c33;var _0x16f8bf;var _0x3ea553;return db[_0xaa5f('0x3e')][_0xaa5f('0x3f')]({'where':{'transcribeStatus':_0xaa5f('0x40')}})[_0xaa5f('0xe')](function(_0x803c2d){if(!_0x803c2d||!_0x803c2d['length']){throw new db[(_0xaa5f('0x23'))][(_0xaa5f('0x1e'))](_0xaa5f('0x41'));}_0x124c33=_0x803c2d;return db[_0xaa5f('0x42')][_0xaa5f('0x36')]({'where':{'id':0x1}});})[_0xaa5f('0xe')](function(_0x32bbed){if(!_0x32bbed){throw new db['Sequelize'][(_0xaa5f('0x1e'))](_0xaa5f('0x43'));}_0x16f8bf=_0x32bbed;if(!_0x16f8bf[_0xaa5f('0x5')]||!_0x16f8bf[_0xaa5f('0x44')]||!_0x16f8bf['transcribeRegion']||!_0x16f8bf[_0xaa5f('0x20')]||!_0x16f8bf[_0xaa5f('0x34')]){throw new db[(_0xaa5f('0x23'))]['ValidationError']('Transcribe\x20not\x20configured');}return db['CloudProvider']['findOne']({'where':{'id':_0x16f8bf['transcribeAccountId']}});})['then'](function(_0x1f47a0){if(!_0x1f47a0){throw new db[(_0xaa5f('0x23'))][(_0xaa5f('0x1e'))](_0xaa5f('0x24'));}if(!_0x1f47a0[_0xaa5f('0xd')]||!_0x1f47a0[_0xaa5f('0x25')]){throw new db['Sequelize']['ValidationError'](_0xaa5f('0x26'));}_0x3ea553=_0x1f47a0;var _0x3e0f41=[];_0x124c33['forEach'](function(_0x2653f8){_0x3e0f41[_0xaa5f('0x45')](checkTranscribeJob(_0x2653f8,_0x16f8bf,_0x3ea553));});return BPromise[_0xaa5f('0x46')](_0x3e0f41);})[_0xaa5f('0x47')](function(_0x469875){if(_0x469875){if(!_0x469875[_0xaa5f('0x39')]||_0x469875[_0xaa5f('0x39')]!=='SequelizeValidationError'){logger['error'](util[_0xaa5f('0x3d')](_0x469875,{'showHidden':![],'depth':null}));}}});}exports[_0xaa5f('0x48')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0x4517=['format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','transcribeRegion','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','fileText','COMPLETED','TranscriptFileUri','info','[RECORDING:%d]\x20Get\x20transcript','Transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','transcript','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','ValidationError','sentiment','sentimentRegion','language','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','CloudProvider','findOne','sentimentAccountId','data2','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','update','Sentiment','SentimentScore','Positive','Negative','Neutral','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','Sentiment\x20Analysis\x20not\x20requested','catch','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','VoiceRecording','findAll','No\x20transcribe\x20job\x20to\x20check','Setting','transcribeAccountId','bucket','Transcribe\x20not\x20configured','inspect','start','aws-sdk','request-promise','bluebird','../../mysqldb','../../config/logger','transcribe','TranscribeService','getTranscriptionJob','Comprehend','detectSentiment'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x4517,0x112));var _0x7451=function(_0x5771a4,_0x5a341d){_0x5771a4=_0x5771a4-0x0;var _0x1f13ad=_0x4517[_0x5771a4];return _0x1f13ad;};var _=require('lodash');var AWS=require(_0x7451('0x0'));var rp=require(_0x7451('0x1'));var util=require('util');var BPromise=require(_0x7451('0x2'));var db=require(_0x7451('0x3'))['db'];var logger=require(_0x7451('0x4'))(_0x7451('0x5'));function getTranscriptionJob(_0x355fbd,_0x21b34c,_0xb96eb8,_0x29eab9){return new Promise(function(_0x451332,_0x3489f9){var _0x3ac271=new AWS[(_0x7451('0x6'))]({'accessKeyId':_0x21b34c,'secretAccessKey':_0x355fbd,'region':_0xb96eb8});_0x3ac271[_0x7451('0x7')]({'TranscriptionJobName':_0x29eab9},function(_0x443b80,_0x2c2ace){if(_0x443b80){return _0x3489f9(_0x443b80);}else{return _0x451332(_0x2c2ace);}});});}function sentiment(_0x468a0a,_0x10031d,_0x4b7888,_0x29f2e1,_0xc586c3){return new Promise(function(_0x310fd1,_0x197f6d){var _0x323ba5=new AWS[(_0x7451('0x8'))]({'accessKeyId':_0x10031d,'secretAccessKey':_0x468a0a,'region':_0x4b7888});_0x323ba5[_0x7451('0x9')]({'Text':_0x29f2e1,'LanguageCode':_0xc586c3['substring'](0x0,0x2)},function(_0x4c4477,_0xf47f51){if(_0x4c4477){return _0x197f6d(_0x4c4477);}else{return _0x310fd1(_0xf47f51);}});});}function checkTranscribeJob(_0x5c7605,_0x450463,_0x2cb40b){var _0x4a14dc;return new BPromise(function(_0x7cb990,_0x38129d){logger['info'](util[_0x7451('0xa')](_0x7451('0xb'),_0x5c7605['id'],_0x5c7605[_0x7451('0xc')]));return getTranscriptionJob(_0x2cb40b[_0x7451('0xd')],_0x2cb40b['data2'],_0x450463[_0x7451('0xe')],_0x5c7605[_0x7451('0xc')])[_0x7451('0xf')](function(_0x58c0cd){logger['info'](util[_0x7451('0xa')](_0x7451('0x10'),_0x5c7605['id'],_0x5c7605[_0x7451('0xc')],_0x58c0cd[_0x7451('0x11')][_0x7451('0x12')]));if(!_0x5c7605[_0x7451('0x13')]){switch(_0x58c0cd[_0x7451('0x11')][_0x7451('0x12')]){case _0x7451('0x14'):var _0x5e52fe={'transcribeStatus':_0x58c0cd[_0x7451('0x11')][_0x7451('0x12')],'fileUri':_0x58c0cd[_0x7451('0x11')]['Transcript'][_0x7451('0x15')]};logger[_0x7451('0x16')](util[_0x7451('0xa')](_0x7451('0x17'),_0x5c7605['id']));return rp({'uri':_0x58c0cd[_0x7451('0x11')][_0x7451('0x18')][_0x7451('0x15')],'json':!![]})['then'](function(_0x3a0c1e){logger[_0x7451('0x16')](util['format'](_0x7451('0x19'),_0x5c7605['id']));if(_0x3a0c1e&&_0x3a0c1e[_0x7451('0x1a')]&&_0x3a0c1e[_0x7451('0x1a')]['transcripts']&&_0x3a0c1e[_0x7451('0x1a')][_0x7451('0x1b')][_0x7451('0x1c')]){_0x5e52fe[_0x7451('0x13')]='';for(var _0x37bc47=0x0;_0x37bc47<_0x3a0c1e[_0x7451('0x1a')][_0x7451('0x1b')][_0x7451('0x1c')];_0x37bc47++){_0x5e52fe[_0x7451('0x13')]+=_0x3a0c1e['results'][_0x7451('0x1b')][_0x37bc47][_0x7451('0x1d')]+'';}}return _0x5c7605['update'](_0x5e52fe);})['then'](function(){logger[_0x7451('0x16')](util[_0x7451('0xa')](_0x7451('0x1e'),_0x5c7605['id']));if(!_0x5c7605[_0x7451('0x1f')]){throw new db[(_0x7451('0x20'))][(_0x7451('0x21'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x450463[_0x7451('0x22')]||!_0x450463['sentimentAccountId']||!_0x450463[_0x7451('0x23')]||!_0x450463[_0x7451('0x24')]||!_0x450463['bucket']){throw new db[(_0x7451('0x20'))][(_0x7451('0x21'))](_0x7451('0x25'));}if(!_0x5e52fe[_0x7451('0x13')]){throw new Error(_0x7451('0x26'));}if(_0x450463['sentimentAccountId']===_0x2cb40b['id']){return _0x2cb40b;}else{return db[_0x7451('0x27')][_0x7451('0x28')]({'where':{'id':_settings[_0x7451('0x29')]}});}})['then'](function(_0x2be408){if(!_0x2be408){throw new db[(_0x7451('0x20'))]['ValidationError']('Cloud\x20Provider\x20not\x20available');}if(!_0x2be408[_0x7451('0xd')]||!_0x2be408[_0x7451('0x2a')]){throw new db['Sequelize']['ValidationError'](_0x7451('0x2b'));}_0x4a14dc=_0x2be408;logger[_0x7451('0x16')](util[_0x7451('0xa')](_0x7451('0x2c'),_0x5c7605['id']));return sentiment(_0x4a14dc[_0x7451('0xd')],_0x4a14dc[_0x7451('0x2a')],_0x450463[_0x7451('0x23')],_0x5e52fe[_0x7451('0x13')],_0x450463['language']);})[_0x7451('0xf')](function(_0x11aead){logger['info'](util[_0x7451('0xa')](_0x7451('0x2d'),_0x5c7605['id']));return _0x5c7605[_0x7451('0x2e')]({'sentiment':_0x11aead[_0x7451('0x2f')],'sPositive':_0x11aead[_0x7451('0x30')][_0x7451('0x31')],'sNegative':_0x11aead['SentimentScore'][_0x7451('0x32')],'sMixed':_0x11aead[_0x7451('0x30')]['Mixed'],'sNeutral':_0x11aead[_0x7451('0x30')][_0x7451('0x33')]});})['then'](function(){logger['info'](util['format']('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x5c7605['id']));_0x7cb990();});case'FAILED':return _0x5c7605[_0x7451('0x2e')]({'transcribeStatus':_0x7451('0x34'),'failureReason':_0x58c0cd[_0x7451('0x11')][_0x7451('0x35')]})[_0x7451('0xf')](function(){logger['info'](util['format']('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x5c7605['id']));_0x7cb990();});default:logger['info'](util['format'](_0x7451('0x36'),_0x5c7605['id']));break;}}else{return BPromise[_0x7451('0x37')]()[_0x7451('0xf')](function(){if(!_0x5c7605[_0x7451('0x1f')]){throw new db[(_0x7451('0x20'))][(_0x7451('0x21'))](_0x7451('0x38'));}if(!_0x450463[_0x7451('0x22')]||!_0x450463[_0x7451('0x29')]||!_0x450463[_0x7451('0x23')]||!_0x450463[_0x7451('0x24')]||!_0x450463['bucket']){throw new db['Sequelize'][(_0x7451('0x21'))]('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x5c7605[_0x7451('0x13')]){throw new Error(_0x7451('0x26'));}if(_0x450463['sentimentAccountId']===_0x2cb40b['id']){return _0x2cb40b;}else{return db['CloudProvider'][_0x7451('0x28')]({'where':{'id':_settings['sentimentAccountId']}});}})[_0x7451('0xf')](function(_0x514a3c){if(!_0x514a3c){throw new db[(_0x7451('0x20'))][(_0x7451('0x21'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x514a3c[_0x7451('0xd')]||!_0x514a3c['data2']){throw new db[(_0x7451('0x20'))][(_0x7451('0x21'))](_0x7451('0x2b'));}_0x4a14dc=_0x514a3c;logger[_0x7451('0x16')](util[_0x7451('0xa')](_0x7451('0x2c'),_0x5c7605['id']));return sentiment(_0x4a14dc[_0x7451('0xd')],_0x4a14dc[_0x7451('0x2a')],_0x450463[_0x7451('0x23')],_0x5c7605[_0x7451('0x13')],_0x450463[_0x7451('0x24')]);})[_0x7451('0xf')](function(_0x3ec29f){logger[_0x7451('0x16')](util['format'](_0x7451('0x2d'),_0x5c7605['id']));return _0x5c7605[_0x7451('0x2e')]({'sentiment':_0x3ec29f[_0x7451('0x2f')],'sPositive':_0x3ec29f[_0x7451('0x30')]['Positive'],'sNegative':_0x3ec29f[_0x7451('0x30')]['Negative'],'sMixed':_0x3ec29f['SentimentScore']['Mixed'],'sNeutral':_0x3ec29f['SentimentScore']['Neutral'],'transcribeStatus':_0x7451('0x14')});})[_0x7451('0xf')](function(){logger[_0x7451('0x16')](util['format'](_0x7451('0x1e'),_0x5c7605['id']));_0x7cb990();});}})[_0x7451('0x39')](function(_0x2f95fa){if(_0x2f95fa){if(!_0x2f95fa[_0x7451('0x3a')]||_0x2f95fa[_0x7451('0x3a')]!==_0x7451('0x3b')){logger[_0x7451('0x3c')](util[_0x7451('0xa')](_0x7451('0x3d'),_0x5c7605['id']),util['inspect'](_0x2f95fa,{'showHidden':![],'depth':null}));}}_0x7cb990();});});}function checkTranscribe(){var _0x4c779f;var _0x4b9bc6;var _0xd26beb;return db[_0x7451('0x3e')][_0x7451('0x3f')]({'where':{'transcribeStatus':'IN_PROGRESS'}})['then'](function(_0x5a570f){if(!_0x5a570f||!_0x5a570f[_0x7451('0x1c')]){throw new db['Sequelize']['ValidationError'](_0x7451('0x40'));}_0x4c779f=_0x5a570f;return db[_0x7451('0x41')][_0x7451('0x28')]({'where':{'id':0x1}});})[_0x7451('0xf')](function(_0x24e028){if(!_0x24e028){throw new db['Sequelize'][(_0x7451('0x21'))]('Settings\x20not\x20available');}_0x4b9bc6=_0x24e028;if(!_0x4b9bc6[_0x7451('0x5')]||!_0x4b9bc6[_0x7451('0x42')]||!_0x4b9bc6[_0x7451('0xe')]||!_0x4b9bc6[_0x7451('0x24')]||!_0x4b9bc6[_0x7451('0x43')]){throw new db[(_0x7451('0x20'))][(_0x7451('0x21'))](_0x7451('0x44'));}return db[_0x7451('0x27')]['findOne']({'where':{'id':_0x4b9bc6['transcribeAccountId']}});})[_0x7451('0xf')](function(_0x94f802){if(!_0x94f802){throw new db['Sequelize']['ValidationError']('Cloud\x20Provider\x20not\x20available');}if(!_0x94f802[_0x7451('0xd')]||!_0x94f802[_0x7451('0x2a')]){throw new db[(_0x7451('0x20'))][(_0x7451('0x21'))](_0x7451('0x2b'));}_0xd26beb=_0x94f802;var _0x9f5737=[];_0x4c779f['forEach'](function(_0x1f0886){_0x9f5737['push'](checkTranscribeJob(_0x1f0886,_0x4b9bc6,_0xd26beb));});return BPromise['all'](_0x9f5737);})['catch'](function(_0x107039){if(_0x107039){if(!_0x107039[_0x7451('0x3a')]||_0x107039[_0x7451('0x3a')]!==_0x7451('0x3b')){logger[_0x7451('0x3c')](util[_0x7451('0x45')](_0x107039,{'showHidden':![],'depth':null}));}}});}exports[_0x7451('0x46')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file diff --git a/server/config/schedule/whatsapp.js b/server/config/schedule/whatsapp.js index ec9a765..1593dd2 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 _0xe402=['hours','then','length','info','[WHATSAPP]\x20Interactions\x20to\x20close:','join','update','system','timeout','format','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','whatsappInteraction:update','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment','ioredis','util','../../config/environment','../../mysqldb','schedule','redis','localhost','WhatsappInteraction','findAll'];(function(_0x28d18d,_0x55896b){var _0x470640=function(_0x57e78b){while(--_0x57e78b){_0x28d18d['push'](_0x28d18d['shift']());}};_0x470640(++_0x55896b);}(_0xe402,0x1c5));var _0x2e40=function(_0xc5001c,_0x49ab7e){_0xc5001c=_0xc5001c-0x0;var _0x3e4c3e=_0xe402[_0xc5001c];return _0x3e4c3e;};'use strict';var _=require(_0x2e40('0x0'));var moment=require(_0x2e40('0x1'));var Redis=require(_0x2e40('0x2'));var util=require(_0x2e40('0x3'));var config=require(_0x2e40('0x4'));var db=require(_0x2e40('0x5'))['db'];var logger=require('../logger')(_0x2e40('0x6'));config[_0x2e40('0x7')]=_['defaults'](config[_0x2e40('0x7')],{'host':_0x2e40('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x2e40('0x7')]));function closeInteractions(){var _0x415f63=[];return db[_0x2e40('0x9')][_0x2e40('0xa')]({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()['subtract'](0x18,_0x2e40('0xb'))}}})[_0x2e40('0xc')](function(_0x1a4a68){if(_0x1a4a68&&_0x1a4a68[_0x2e40('0xd')]){_0x415f63=_['map'](_0x1a4a68||[],'id');logger[_0x2e40('0xe')](_0x2e40('0xf'),_0x415f63[_0x2e40('0x10')]());return db[_0x2e40('0x9')][_0x2e40('0x11')]({'closeReason':_0x2e40('0x12'),'disposition':_0x2e40('0x13'),'closed':!![],'closedAt':moment()[_0x2e40('0x14')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x415f63}});}})[_0x2e40('0xc')](function(){if(_0x415f63&&_0x415f63[_0x2e40('0xd')]){logger[_0x2e40('0xe')](_0x2e40('0x15'),_0x415f63[_0x2e40('0x10')]());for(var _0x48e9d3=0x0;_0x48e9d3<_0x415f63['length'];_0x48e9d3++){io[_0x2e40('0x16')](_0x2e40('0x17'),{'id':_0x415f63[_0x48e9d3],'closed':!![]});}}})[_0x2e40('0x18')](function(_0x510111){logger[_0x2e40('0x19')](_0x2e40('0x1a'),_0x510111?util[_0x2e40('0x1b')](_0x510111,{'showHidden':![],'depth':null}):'');});}exports[_0x2e40('0x1c')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x6889=['schedule','redis','defaults','localhost','socket.io-emitter','WhatsappInteraction','findAll','subtract','hours','length','map','info','join','format','then','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','whatsappInteraction:update','catch','inspect','start','moment','ioredis','util','../logger'];(function(_0x57d035,_0x1e8a72){var _0x5974c6=function(_0x276ffd){while(--_0x276ffd){_0x57d035['push'](_0x57d035['shift']());}};_0x5974c6(++_0x1e8a72);}(_0x6889,0x11c));var _0x9688=function(_0x21fe11,_0x52f846){_0x21fe11=_0x21fe11-0x0;var _0x5eb704=_0x6889[_0x21fe11];return _0x5eb704;};'use strict';var _=require('lodash');var moment=require(_0x9688('0x0'));var Redis=require(_0x9688('0x1'));var util=require(_0x9688('0x2'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var logger=require(_0x9688('0x3'))(_0x9688('0x4'));config[_0x9688('0x5')]=_[_0x9688('0x6')](config[_0x9688('0x5')],{'host':_0x9688('0x7'),'port':0x18eb});var io=require(_0x9688('0x8'))(new Redis(config[_0x9688('0x5')]));function closeInteractions(){var _0x494302=[];return db[_0x9688('0x9')][_0x9688('0xa')]({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x9688('0xb')](0x18,_0x9688('0xc'))}}})['then'](function(_0x43c78e){if(_0x43c78e&&_0x43c78e[_0x9688('0xd')]){_0x494302=_[_0x9688('0xe')](_0x43c78e||[],'id');logger[_0x9688('0xf')]('[WHATSAPP]\x20Interactions\x20to\x20close:',_0x494302[_0x9688('0x10')]());return db[_0x9688('0x9')]['update']({'closeReason':'system','disposition':'timeout','closed':!![],'closedAt':moment()[_0x9688('0x11')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x494302}});}})[_0x9688('0x12')](function(){if(_0x494302&&_0x494302[_0x9688('0xd')]){logger['info'](_0x9688('0x13'),_0x494302['join']());for(var _0x32d8a8=0x0;_0x32d8a8<_0x494302[_0x9688('0xd')];_0x32d8a8++){io['emit'](_0x9688('0x14'),{'id':_0x494302[_0x32d8a8],'closed':!![]});}}})[_0x9688('0x15')](function(_0x2c22b4){logger['error']('[WHATSAPP]\x20Error\x20closing\x20interactions',_0x2c22b4?util[_0x9688('0x16')](_0x2c22b4,{'showHidden':![],'depth':null}):'');});}exports[_0x9688('0x17')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/seedContact.js b/server/config/seedContact.js index b300083..6d7d5c5 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xeaea=['Innocenzo','innocenzo.biondo','now','Biondo','CmContact','destroy','then','log','finished\x20populating','CmHopper','bulkCreate','hopper1','catch','../mysqldb','push'];(function(_0x228ade,_0x47e287){var _0x2f177a=function(_0x36fdfc){while(--_0x36fdfc){_0x228ade['push'](_0x228ade['shift']());}};_0x2f177a(++_0x47e287);}(_0xeaea,0x1c0));var _0xaeae=function(_0x4a747d,_0x3b747f){_0x4a747d=_0x4a747d-0x0;var _0x3a5b5c=_0xeaea[_0x4a747d];return _0x3a5b5c;};'use strict';var util=require('util');var db=require(_0xaeae('0x0'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0xaeae('0x1')]({'id':i,'firstName':_0xaeae('0x2')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0xaeae('0x3')+i+'@xcally.com'});}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[_0xaeae('0x4')](),'updatedAt':Date['now']()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0xaeae('0x1')]({'id':i,'firstName':_0xaeae('0x2')+i,'lastName':_0xaeae('0x5')+i,'phone':0xf879fb460+i,'email':_0xaeae('0x3')+i+'@xcally.com'});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2['push']({'id':i,'active':![],'scheduledat':Date[_0xaeae('0x4')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xaeae('0x4')](),'updatedAt':Date[_0xaeae('0x4')]()});}db[_0xaeae('0x6')][_0xaeae('0x7')]({'where':{}})['then'](function(){return db['CmContact']['bulkCreate'](contacts);})[_0xaeae('0x8')](function(){console[_0xaeae('0x9')](_0xaeae('0xa'),'contacts1');return db[_0xaeae('0xb')]['destroy']({'where':{}});})['then'](function(){return db['CmHopper'][_0xaeae('0xc')](hopper);})[_0xaeae('0x8')](function(){console['log'](_0xaeae('0xa'),_0xaeae('0xd'));return db[_0xaeae('0x6')][_0xaeae('0xc')](contacts2);})[_0xaeae('0x8')](function(){console[_0xaeae('0x9')]('finished\x20populating','contacts2');return db[_0xaeae('0xb')][_0xaeae('0xc')](hopper2);})[_0xaeae('0x8')](function(){console[_0xaeae('0x9')](_0xaeae('0xa'),'hopper2');})[_0xaeae('0xe')](function(_0x94e108){console[_0xaeae('0x9')](_0x94e108);}); \ No newline at end of file +var _0xe948=['bulkCreate','log','contacts1','destroy','then','CmHopper','finished\x20populating','hopper1','contacts2','hopper2','catch','util','../mysqldb','push','Innocenzo','Biondo','innocenzo.biondo','@xcally.com','now','CmContact'];(function(_0xe68119,_0xf67a62){var _0x39c26a=function(_0x5148b1){while(--_0x5148b1){_0xe68119['push'](_0xe68119['shift']());}};_0x39c26a(++_0xf67a62);}(_0xe948,0x1af));var _0x8e94=function(_0x22094c,_0x1253ae){_0x22094c=_0x22094c-0x0;var _0x1102cb=_0xe948[_0x22094c];return _0x1102cb;};'use strict';var util=require(_0x8e94('0x0'));var db=require(_0x8e94('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x8e94('0x2')]({'id':i,'firstName':_0x8e94('0x3')+i,'lastName':_0x8e94('0x4')+i,'phone':0xf879fb460+i,'email':_0x8e94('0x5')+i+_0x8e94('0x6')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper['push']({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x8e94('0x7')](),'updatedAt':Date[_0x8e94('0x7')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x8e94('0x2')]({'id':i,'firstName':_0x8e94('0x3')+i,'lastName':_0x8e94('0x4')+i,'phone':0xf879fb460+i,'email':_0x8e94('0x5')+i+_0x8e94('0x6')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x8e94('0x2')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x8e94('0x7')](),'updatedAt':Date[_0x8e94('0x7')]()});}db[_0x8e94('0x8')]['destroy']({'where':{}})['then'](function(){return db[_0x8e94('0x8')][_0x8e94('0x9')](contacts);})['then'](function(){console[_0x8e94('0xa')]('finished\x20populating',_0x8e94('0xb'));return db['CmHopper'][_0x8e94('0xc')]({'where':{}});})[_0x8e94('0xd')](function(){return db[_0x8e94('0xe')][_0x8e94('0x9')](hopper);})['then'](function(){console['log'](_0x8e94('0xf'),_0x8e94('0x10'));return db[_0x8e94('0x8')][_0x8e94('0x9')](contacts2);})[_0x8e94('0xd')](function(){console[_0x8e94('0xa')]('finished\x20populating',_0x8e94('0x11'));return db[_0x8e94('0xe')]['bulkCreate'](hopper2);})[_0x8e94('0xd')](function(){console['log']('finished\x20populating',_0x8e94('0x12'));})[_0x8e94('0x13')](function(_0x3865df){console[_0x8e94('0xa')](_0x3865df);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index a590b83..13150ed 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5006=['/etc/pki/tls/private/motion.key','actpass','\x22%s\x22\x20<%s>','User','log','util','../mysqldb','push','format','%s%s','agent','password','friend','wss','all','ulaw','yes','/etc/pki/tls/certs/motion.crt'];(function(_0x581cad,_0x355b2e){var _0x1a9f4b=function(_0x5c8461){while(--_0x5c8461){_0x581cad['push'](_0x581cad['shift']());}};_0x1a9f4b(++_0x355b2e);}(_0x5006,0xef));var _0x6500=function(_0x4dc69d,_0x2326f4){_0x4dc69d=_0x4dc69d-0x0;var _0x148091=_0x5006[_0x4dc69d];return _0x148091;};'use strict';var util=require(_0x6500('0x0'));var db=require(_0x6500('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x6500('0x2')]({'name':util[_0x6500('0x3')](_0x6500('0x4'),'agent',i),'fullname':util['format'](_0x6500('0x4'),_0x6500('0x5'),i),'email':util[_0x6500('0x3')]('%s%s@xcally.com','agent',i),'role':_0x6500('0x5'),'password':_0x6500('0x6'),'internal':0xfa0+i,'type':_0x6500('0x7'),'transport':['udp','ws',_0x6500('0x8')],'disallow':[_0x6500('0x9')],'allow':[_0x6500('0xa')],'defaultuser':util[_0x6500('0x3')]('%s%s','agent',i),'encryption':_0x6500('0xb'),'avpf':_0x6500('0xb'),'force_avp':'yes','icesupport':_0x6500('0xb'),'dtlsenable':_0x6500('0xb'),'dtlsverify':'no','dtlscertfile':_0x6500('0xc'),'dtlsprivatekey':_0x6500('0xd'),'dtlssetup':_0x6500('0xe'),'callerid':util[_0x6500('0x3')](_0x6500('0xf'),util['format'](_0x6500('0x4'),_0x6500('0x5'),i),0xfa0+i)});}db[_0x6500('0x10')]['bulkCreate'](users)['then'](function(){console[_0x6500('0x11')]('add\x20user');})['catch'](function(_0x3e90f1){console['log'](_0x3e90f1);}); \ No newline at end of file +var _0x09a6=['log','../mysqldb','push','format','%s%s','agent','%s%s@xcally.com','password','wss','all','ulaw','yes','actpass','\x22%s\x22\x20<%s>','User','bulkCreate','then','add\x20user','catch'];(function(_0xf54bc8,_0x6a8ed4){var _0x317e4c=function(_0x4078d0){while(--_0x4078d0){_0xf54bc8['push'](_0xf54bc8['shift']());}};_0x317e4c(++_0x6a8ed4);}(_0x09a6,0x157));var _0x609a=function(_0x39187b,_0x2a6214){_0x39187b=_0x39187b-0x0;var _0x2cf25f=_0x09a6[_0x39187b];return _0x2cf25f;};'use strict';var util=require('util');var db=require(_0x609a('0x0'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x609a('0x1')]({'name':util[_0x609a('0x2')](_0x609a('0x3'),_0x609a('0x4'),i),'fullname':util[_0x609a('0x2')](_0x609a('0x3'),_0x609a('0x4'),i),'email':util[_0x609a('0x2')](_0x609a('0x5'),'agent',i),'role':_0x609a('0x4'),'password':_0x609a('0x6'),'internal':0xfa0+i,'type':'friend','transport':['udp','ws',_0x609a('0x7')],'disallow':[_0x609a('0x8')],'allow':[_0x609a('0x9')],'defaultuser':util[_0x609a('0x2')](_0x609a('0x3'),_0x609a('0x4'),i),'encryption':_0x609a('0xa'),'avpf':_0x609a('0xa'),'force_avp':_0x609a('0xa'),'icesupport':_0x609a('0xa'),'dtlsenable':_0x609a('0xa'),'dtlsverify':'no','dtlscertfile':'/etc/pki/tls/certs/motion.crt','dtlsprivatekey':'/etc/pki/tls/private/motion.key','dtlssetup':_0x609a('0xb'),'callerid':util['format'](_0x609a('0xc'),util['format'](_0x609a('0x3'),_0x609a('0x4'),i),0xfa0+i)});}db[_0x609a('0xd')][_0x609a('0xe')](users)[_0x609a('0xf')](function(){console['log'](_0x609a('0x10'));})[_0x609a('0x11')](function(_0x3539ed){console[_0x609a('0x12')](_0x3539ed);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index 71bc067..f29d021 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfaf2=['handshake','query','find','userProfileId','ChatInteraction','ChatInteractions','MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','WhatsappInteraction','admin','voice:inbound','hasOwnProperty','include','push','VoiceQueue','ChatQueue','FaxQueue','OpenchannelQueue','Trunk','user','voice:outbound','SmsQueue','MailQueue','getVoiceQueues','getChatQueues','getFaxQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','length','voice','chat','fax','sms','mail','openchannel','whatsapp','campaign:%s:%s','removeChatInteractions','emit','user_has_chat_interactions:remove','leave','removeMailInteractions','user_has_mail_interactions:remove','removeFaxInteractions','user_has_fax_interactions:remove','removeSmsInteractions','OpenchannelInteractions','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','log','join','default','connection','setMaxListeners','request','connectedAt','SocketIO\x20','address','disconnect','CONNECTED','lodash','util','bluebird','../mysqldb','./environment','Agents','User','name','role','agent','type','ivr','UserProfileSection','autoAssociation','VoiceQueues','SmsQueues','MailQueues','WhatsappQueues','Telephones','findAll','Trunks','IvrCampaigns','resourceId','map','where','telephone','Campaign','then','%s:queue:%s','format','user:%s'];(function(_0x635fdd,_0x31b053){var _0x5e9aab=function(_0x32369d){while(--_0x32369d){_0x635fdd['push'](_0x635fdd['shift']());}};_0x5e9aab(++_0x31b053);}(_0xfaf2,0x169));var _0x2faf=function(_0x4c7c78,_0x200447){_0x4c7c78=_0x4c7c78-0x0;var _0x2145a3=_0xfaf2[_0x4c7c78];return _0x2145a3;};'use strict';var _=require(_0x2faf('0x0'));var util=require(_0x2faf('0x1'));var BPromise=require(_0x2faf('0x2'));var db=require(_0x2faf('0x3'))['db'];var config=require(_0x2faf('0x4'));var queryQueues={'attributes':['id','name'],'include':[{'as':_0x2faf('0x5'),'model':db[_0x2faf('0x6')],'attributes':['id',_0x2faf('0x7'),_0x2faf('0x8')],'raw':!![],'where':{'role':_0x2faf('0x9')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id','name'],'where':{'role':'telephone'}};var queryTrunks={'raw':!![],'attributes':['id','name']};var queryAgents={'raw':!![],'attributes':['id',_0x2faf('0x7')],'where':{'role':_0x2faf('0x9')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x2faf('0x7'),_0x2faf('0xa')],'where':{'type':_0x2faf('0xb')}};function getAssociatedResources(_0x52f99f,_0x5c627c,_0x9c958c){return db[_0x2faf('0xc')]['findOne']({'where':{'name':_0x52f99f,'userProfileId':_0x5c627c},'raw':!![]})['then'](function(_0x3ec8cc){if(_0x3ec8cc){if(_0x3ec8cc[_0x2faf('0xd')]){switch(_0x52f99f){case _0x2faf('0xe'):case'ChatQueues':case'FaxQueues':case _0x2faf('0xf'):case _0x2faf('0x10'):case'OpenchannelQueues':case _0x2faf('0x11'):return db[_0x9c958c]['findAll'](queryQueues);case _0x2faf('0x12'):return db[_0x9c958c][_0x2faf('0x13')](queryTelephones);case _0x2faf('0x14'):return db[_0x9c958c][_0x2faf('0x13')](queryTrunks);case _0x2faf('0x15'):return db[_0x9c958c][_0x2faf('0x13')](queryCampaigns);}}else{return db['UserProfileResource'][_0x2faf('0x13')]({'attributes':[_0x2faf('0x16')],'where':{'sectionId':_0x3ec8cc['id']},'raw':!![]})['then'](function(_0x1fd4d3){if(_0x1fd4d3){var _0x3be136={'where':{'id':_[_0x2faf('0x17')](_0x1fd4d3,_0x2faf('0x16'))},'raw':!![]};switch(_0x9c958c){case'User':_0x3be136[_0x2faf('0x18')][_0x2faf('0x8')]=_0x2faf('0x19');break;case _0x2faf('0x1a'):_0x3be136['where'][_0x2faf('0xa')]=_0x2faf('0xb');break;}return db[_0x9c958c][_0x2faf('0x13')](_0x3be136);}else{return[];}});}}else{return[];}})[_0x2faf('0x1b')](function(_0x1b8098){return _0x1b8098;});}function joinOrLeaveQueues(_0x40d8bf,_0x2d538a,_0x5e4009,_0x48627f){_0x40d8bf[_0x2d538a](util['format'](_0x2faf('0x1c'),_0x5e4009,_0x48627f[_0x2faf('0x7')]));if(_0x48627f['Agents']){for(var _0x4295b9=0x0;_0x4295b9<_0x48627f['Agents']['length'];_0x4295b9+=0x1){_0x40d8bf[_0x2d538a](util[_0x2faf('0x1d')](_0x2faf('0x1e'),_0x48627f['Agents'][_0x4295b9][_0x2faf('0x7')]));}}}function joinOrLeave(_0x3c1e49,_0x3545cf,_0x3f598c){var _0xfe4559;if(_0x3c1e49[_0x2faf('0x1f')][_0x2faf('0x20')]['id']){db[_0x2faf('0x6')][_0x2faf('0x21')]({'attributes':['id',_0x2faf('0x7'),_0x2faf('0x8'),_0x2faf('0x22')],'where':{'id':_0x3c1e49['handshake'][_0x2faf('0x20')]['id']},'include':[{'model':db[_0x2faf('0x23')],'as':_0x2faf('0x24'),'attributes':['id'],'raw':!![]},{'model':db['MailInteraction'],'as':_0x2faf('0x25'),'attributes':['id'],'raw':!![]},{'model':db[_0x2faf('0x26')],'as':_0x2faf('0x27'),'attributes':['id'],'raw':!![]},{'model':db[_0x2faf('0x28')],'as':_0x2faf('0x29'),'attributes':['id'],'raw':!![]},{'model':db[_0x2faf('0x2a')],'as':'OpenchannelInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x2faf('0x2b')],'as':'WhatsappInteractions','attributes':['id'],'raw':!![]}]})[_0x2faf('0x1b')](function(_0x1133a0){if(_0x1133a0){_0xfe4559=_0x1133a0;_0x3c1e49[_0x3545cf](util[_0x2faf('0x1d')](_0x2faf('0x1e'),_0x1133a0[_0x2faf('0x7')]));var _0xac1403=[];switch(_0x1133a0[_0x2faf('0x8')]){case _0x2faf('0x2c'):_0x3c1e49[_0x3545cf](_0x2faf('0x2d'));_0x3c1e49[_0x3545cf]('voice:outbound');if(queryQueues[_0x2faf('0x2e')](_0x2faf('0x2f'))){delete queryQueues[_0x2faf('0x2f')];}_0xac1403[_0x2faf('0x30')](db[_0x2faf('0x31')]['findAll'](queryQueues));_0xac1403[_0x2faf('0x30')](db[_0x2faf('0x32')]['findAll'](queryQueues));_0xac1403[_0x2faf('0x30')](db[_0x2faf('0x33')][_0x2faf('0x13')](queryQueues));_0xac1403[_0x2faf('0x30')](db['SmsQueue'][_0x2faf('0x13')](queryQueues));_0xac1403['push'](db['MailQueue'][_0x2faf('0x13')](queryQueues));_0xac1403[_0x2faf('0x30')](db[_0x2faf('0x34')][_0x2faf('0x13')](queryQueues));_0xac1403['push'](db['WhatsappQueue'][_0x2faf('0x13')](queryQueues));_0xac1403[_0x2faf('0x30')](db[_0x2faf('0x6')][_0x2faf('0x13')](queryTelephones));_0xac1403[_0x2faf('0x30')](db[_0x2faf('0x35')]['findAll'](queryTrunks));_0xac1403[_0x2faf('0x30')](db[_0x2faf('0x1a')][_0x2faf('0x13')](queryCampaigns));_0xac1403[_0x2faf('0x30')](db[_0x2faf('0x6')][_0x2faf('0x13')](queryAgents));break;case _0x2faf('0x36'):_0x3c1e49[_0x3545cf](_0x2faf('0x2d'));_0x3c1e49[_0x3545cf](_0x2faf('0x37'));_0xac1403[_0x2faf('0x30')](getAssociatedResources(_0x2faf('0xe'),_0x1133a0[_0x2faf('0x22')],_0x2faf('0x31')));_0xac1403['push'](getAssociatedResources('ChatQueues',_0x1133a0[_0x2faf('0x22')],_0x2faf('0x32')));_0xac1403['push'](getAssociatedResources('FaxQueues',_0x1133a0[_0x2faf('0x22')],_0x2faf('0x33')));_0xac1403[_0x2faf('0x30')](getAssociatedResources(_0x2faf('0xf'),_0x1133a0[_0x2faf('0x22')],_0x2faf('0x38')));_0xac1403[_0x2faf('0x30')](getAssociatedResources('MailQueues',_0x1133a0['userProfileId'],_0x2faf('0x39')));_0xac1403['push'](getAssociatedResources('OpenchannelQueues',_0x1133a0['userProfileId'],'OpenchannelQueue'));_0xac1403[_0x2faf('0x30')](getAssociatedResources(_0x2faf('0x11'),_0x1133a0[_0x2faf('0x22')],'WhatsappQueue'));_0xac1403[_0x2faf('0x30')](getAssociatedResources('Telephones',_0x1133a0['userProfileId'],_0x2faf('0x6')));_0xac1403[_0x2faf('0x30')](getAssociatedResources(_0x2faf('0x14'),_0x1133a0[_0x2faf('0x22')],_0x2faf('0x35')));_0xac1403['push'](getAssociatedResources(_0x2faf('0x15'),_0x1133a0[_0x2faf('0x22')],_0x2faf('0x1a')));_0xac1403[_0x2faf('0x30')](db[_0x2faf('0x6')][_0x2faf('0x13')](queryAgents));break;case _0x2faf('0x9'):_0x3c1e49[_0x3545cf](_0x2faf('0x2d'));_0x3c1e49[_0x3545cf](_0x2faf('0x37'));_0xac1403[_0x2faf('0x30')](_0x1133a0[_0x2faf('0x3a')]({'attributes':['id',_0x2faf('0x7')]}));_0xac1403['push'](_0x1133a0[_0x2faf('0x3b')]({'attributes':['id',_0x2faf('0x7')]}));_0xac1403[_0x2faf('0x30')](_0x1133a0[_0x2faf('0x3c')]({'attributes':['id',_0x2faf('0x7')]}));_0xac1403[_0x2faf('0x30')](_0x1133a0[_0x2faf('0x3d')]({'attributes':['id','name']}));_0xac1403[_0x2faf('0x30')](_0x1133a0[_0x2faf('0x3e')]({'attributes':['id',_0x2faf('0x7')]}));_0xac1403[_0x2faf('0x30')](_0x1133a0[_0x2faf('0x3f')]({'attributes':['id',_0x2faf('0x7')]}));_0xac1403[_0x2faf('0x30')](_0x1133a0['getWhatsappQueues']({'attributes':['id',_0x2faf('0x7')]}));break;}return BPromise['all'](_0xac1403);}})[_0x2faf('0x1b')](function(_0x23d802){if(_0x23d802&&_0x23d802[_0x2faf('0x40')]){for(var _0x3887b7=0x0;_0x3887b7<_0x23d802[_0x2faf('0x40')];_0x3887b7+=0x1){for(var _0x2d9a74=0x0;_0x2d9a74<_0x23d802[_0x3887b7]['length'];_0x2d9a74+=0x1){switch(_0x3887b7){case 0x0:joinOrLeaveQueues(_0x3c1e49,_0x3545cf,_0x2faf('0x41'),_0x23d802[_0x3887b7][_0x2d9a74]);break;case 0x1:joinOrLeaveQueues(_0x3c1e49,_0x3545cf,_0x2faf('0x42'),_0x23d802[_0x3887b7][_0x2d9a74]);break;case 0x2:joinOrLeaveQueues(_0x3c1e49,_0x3545cf,_0x2faf('0x43'),_0x23d802[_0x3887b7][_0x2d9a74]);break;case 0x3:joinOrLeaveQueues(_0x3c1e49,_0x3545cf,_0x2faf('0x44'),_0x23d802[_0x3887b7][_0x2d9a74]);break;case 0x4:joinOrLeaveQueues(_0x3c1e49,_0x3545cf,_0x2faf('0x45'),_0x23d802[_0x3887b7][_0x2d9a74]);break;case 0x5:joinOrLeaveQueues(_0x3c1e49,_0x3545cf,_0x2faf('0x46'),_0x23d802[_0x3887b7][_0x2d9a74]);break;case 0x6:joinOrLeaveQueues(_0x3c1e49,_0x3545cf,_0x2faf('0x47'),_0x23d802[_0x3887b7][_0x2d9a74]);break;case 0x7:if(_0xfe4559[_0x2faf('0x8')]!==_0x2faf('0x9'))_0x3c1e49[_0x3545cf](util[_0x2faf('0x1d')]('telephone:%s',_0x23d802[_0x3887b7][_0x2d9a74]['name']));break;case 0x8:if(_0xfe4559['role']!==_0x2faf('0x9'))_0x3c1e49[_0x3545cf](util[_0x2faf('0x1d')]('trunk:%s',_0x23d802[_0x3887b7][_0x2d9a74][_0x2faf('0x7')]));break;case 0x9:if(_0xfe4559['role']!==_0x2faf('0x9'))_0x3c1e49[_0x3545cf](util['format'](_0x2faf('0x48'),_0x23d802[_0x3887b7][_0x2d9a74][_0x2faf('0xa')],_0x23d802[_0x3887b7][_0x2d9a74][_0x2faf('0x7')]));break;case 0xa:_0x3c1e49[_0x3545cf](util['format']('user:%s',_0x23d802[_0x3887b7][_0x2d9a74][_0x2faf('0x7')]));break;}}}}})[_0x2faf('0x1b')](function(){if(_0x3545cf==='leave'){var _0x10594e=_['map'](_0xfe4559['ChatInteractions'],'id');return _0xfe4559[_0x2faf('0x49')](_0x10594e)[_0x2faf('0x1b')](function(){for(var _0x5e1dd0=0x0;_0x5e1dd0<_0x10594e[_0x2faf('0x40')];_0x5e1dd0+=0x1){_0x3f598c[_0x2faf('0x4a')](_0x2faf('0x4b'),{'ChatInteractionId':Number(_0x10594e[_0x5e1dd0]),'UserId':Number(_0xfe4559['id'])});}});}})[_0x2faf('0x1b')](function(){if(_0x3545cf===_0x2faf('0x4c')){var _0x28d2c8=_[_0x2faf('0x17')](_0xfe4559[_0x2faf('0x25')],'id');return _0xfe4559[_0x2faf('0x4d')](_0x28d2c8)[_0x2faf('0x1b')](function(){for(var _0x489133=0x0;_0x489133<_0x28d2c8[_0x2faf('0x40')];_0x489133+=0x1){_0x3f598c['emit'](_0x2faf('0x4e'),{'MailInteractionId':Number(_0x28d2c8[_0x489133]),'UserId':Number(_0xfe4559['id'])});}});}})[_0x2faf('0x1b')](function(){if(_0x3545cf===_0x2faf('0x4c')){var _0x264f47=_[_0x2faf('0x17')](_0xfe4559[_0x2faf('0x27')],'id');return _0xfe4559[_0x2faf('0x4f')](_0x264f47)[_0x2faf('0x1b')](function(){for(var _0x50fbc1=0x0;_0x50fbc1<_0x264f47[_0x2faf('0x40')];_0x50fbc1+=0x1){_0x3f598c['emit'](_0x2faf('0x50'),{'FaxInteractionId':Number(_0x264f47[_0x50fbc1]),'UserId':Number(_0xfe4559['id'])});}});}})[_0x2faf('0x1b')](function(){if(_0x3545cf===_0x2faf('0x4c')){var _0x53c15d=_[_0x2faf('0x17')](_0xfe4559['SmsInteractions'],'id');return _0xfe4559[_0x2faf('0x51')](_0x53c15d)[_0x2faf('0x1b')](function(){for(var _0x5d7e05=0x0;_0x5d7e05<_0x53c15d[_0x2faf('0x40')];_0x5d7e05+=0x1){_0x3f598c[_0x2faf('0x4a')]('user_has_sms_interactions:remove',{'SmsInteractionId':Number(_0x53c15d[_0x5d7e05]),'UserId':Number(_0xfe4559['id'])});}});}})[_0x2faf('0x1b')](function(){if(_0x3545cf===_0x2faf('0x4c')){var _0x3efacc=_['map'](_0xfe4559[_0x2faf('0x52')],'id');return _0xfe4559[_0x2faf('0x53')](_0x3efacc)['then'](function(){for(var _0x31f48e=0x0;_0x31f48e<_0x3efacc[_0x2faf('0x40')];_0x31f48e+=0x1){_0x3f598c[_0x2faf('0x4a')](_0x2faf('0x54'),{'OpenchannelInteractionId':Number(_0x3efacc[_0x31f48e]),'UserId':Number(_0xfe4559['id'])});}});}})['then'](function(){if(_0x3545cf===_0x2faf('0x4c')){var _0x169822=_[_0x2faf('0x17')](_0xfe4559['WhatsappInteractions'],'id');return _0xfe4559[_0x2faf('0x55')](_0x169822)[_0x2faf('0x1b')](function(){for(var _0x4f0268=0x0;_0x4f0268<_0x169822[_0x2faf('0x40')];_0x4f0268+=0x1){_0x3f598c[_0x2faf('0x4a')](_0x2faf('0x56'),{'WhatsappInteractionId':Number(_0x169822[_0x4f0268]),'UserId':Number(_0xfe4559['id'])});}});}})['catch'](function(_0x1daa86){_0x3c1e49[_0x2faf('0x57')](_0x1daa86);});}}function onDisconnect(_0x11687c,_0x307e0a){joinOrLeave(_0x11687c,_0x2faf('0x4c'),_0x307e0a);}function onConnect(_0x2a23c3){joinOrLeave(_0x2a23c3,_0x2faf('0x58'));}exports[_0x2faf('0x59')]=function(_0x46a55b){_0x46a55b['on'](_0x2faf('0x5a'),function(_0x4bb21d){_0x4bb21d[_0x2faf('0x5b')](0x0);_0x4bb21d['address']=_0x4bb21d[_0x2faf('0x5c')][_0x2faf('0x5a')]['remoteAddress']+':'+_0x4bb21d[_0x2faf('0x5c')]['connection']['remotePort'];_0x4bb21d[_0x2faf('0x5d')]=new Date();_0x4bb21d[_0x2faf('0x57')]=function(_0x3cee43){console[_0x2faf('0x57')](_0x2faf('0x5e')+_0x4bb21d['nsp']['name']+'['+_0x4bb21d[_0x2faf('0x5f')]+']',_0x3cee43);};_0x4bb21d['on'](_0x2faf('0x60'),function(){onDisconnect(_0x4bb21d,_0x46a55b);_0x4bb21d[_0x2faf('0x57')]('DISCONNECTED');});onConnect(_0x4bb21d);_0x4bb21d[_0x2faf('0x57')](_0x2faf('0x61'));});}; \ No newline at end of file +var _0xbf07=['Telephones','Trunks','findAll','map','resourceId','where','telephone','Campaign','format','%s:queue:%s','length','user:%s','Agents','handshake','query','find','userProfileId','MailInteraction','MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','voice:inbound','hasOwnProperty','include','VoiceQueue','push','ChatQueue','FaxQueue','SmsQueue','OpenchannelQueue','Trunk','user','MailQueue','OpenchannelQueues','WhatsappQueue','voice:outbound','getVoiceQueues','getChatQueues','getFaxQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','all','voice','whatsapp','telephone:%s','trunk:%s','leave','ChatInteractions','removeChatInteractions','emit','user_has_chat_interactions:remove','removeMailInteractions','user_has_mail_interactions:remove','removeFaxInteractions','user_has_fax_interactions:remove','SmsInteractions','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','user_has_whatsapp_interactions:remove','catch','join','default','connection','setMaxListeners','address','request','remotePort','connectedAt','log','nsp','disconnect','DISCONNECTED','CONNECTED','lodash','bluebird','../mysqldb','name','User','role','agent','type','ivr','findOne','then','autoAssociation','VoiceQueues','ChatQueues','FaxQueues','SmsQueues','MailQueues','WhatsappQueues'];(function(_0x241e6e,_0x4835f4){var _0x15429d=function(_0x5d37ca){while(--_0x5d37ca){_0x241e6e['push'](_0x241e6e['shift']());}};_0x15429d(++_0x4835f4);}(_0xbf07,0x17a));var _0x7bf0=function(_0x2d2c16,_0x4e88b6){_0x2d2c16=_0x2d2c16-0x0;var _0x53f2fb=_0xbf07[_0x2d2c16];return _0x53f2fb;};'use strict';var _=require(_0x7bf0('0x0'));var util=require('util');var BPromise=require(_0x7bf0('0x1'));var db=require(_0x7bf0('0x2'))['db'];var config=require('./environment');var queryQueues={'attributes':['id',_0x7bf0('0x3')],'include':[{'as':'Agents','model':db[_0x7bf0('0x4')],'attributes':['id','name',_0x7bf0('0x5')],'raw':!![],'where':{'role':_0x7bf0('0x6')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x7bf0('0x3')],'where':{'role':'telephone'}};var queryTrunks={'raw':!![],'attributes':['id',_0x7bf0('0x3')]};var queryAgents={'raw':!![],'attributes':['id',_0x7bf0('0x3')],'where':{'role':_0x7bf0('0x6')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x7bf0('0x3'),_0x7bf0('0x7')],'where':{'type':_0x7bf0('0x8')}};function getAssociatedResources(_0x1fffbd,_0x27b42a,_0x1b6a9d){return db['UserProfileSection'][_0x7bf0('0x9')]({'where':{'name':_0x1fffbd,'userProfileId':_0x27b42a},'raw':!![]})[_0x7bf0('0xa')](function(_0x2afd55){if(_0x2afd55){if(_0x2afd55[_0x7bf0('0xb')]){switch(_0x1fffbd){case _0x7bf0('0xc'):case _0x7bf0('0xd'):case _0x7bf0('0xe'):case _0x7bf0('0xf'):case _0x7bf0('0x10'):case'OpenchannelQueues':case _0x7bf0('0x11'):return db[_0x1b6a9d]['findAll'](queryQueues);case _0x7bf0('0x12'):return db[_0x1b6a9d]['findAll'](queryTelephones);case _0x7bf0('0x13'):return db[_0x1b6a9d][_0x7bf0('0x14')](queryTrunks);case'IvrCampaigns':return db[_0x1b6a9d][_0x7bf0('0x14')](queryCampaigns);}}else{return db['UserProfileResource'][_0x7bf0('0x14')]({'attributes':['resourceId'],'where':{'sectionId':_0x2afd55['id']},'raw':!![]})[_0x7bf0('0xa')](function(_0x52cd07){if(_0x52cd07){var _0x16353f={'where':{'id':_[_0x7bf0('0x15')](_0x52cd07,_0x7bf0('0x16'))},'raw':!![]};switch(_0x1b6a9d){case _0x7bf0('0x4'):_0x16353f[_0x7bf0('0x17')][_0x7bf0('0x5')]=_0x7bf0('0x18');break;case _0x7bf0('0x19'):_0x16353f[_0x7bf0('0x17')]['type']='ivr';break;}return db[_0x1b6a9d][_0x7bf0('0x14')](_0x16353f);}else{return[];}});}}else{return[];}})[_0x7bf0('0xa')](function(_0xdfef07){return _0xdfef07;});}function joinOrLeaveQueues(_0x3d5978,_0x3f4988,_0x34475e,_0x1fe1f3){_0x3d5978[_0x3f4988](util[_0x7bf0('0x1a')](_0x7bf0('0x1b'),_0x34475e,_0x1fe1f3[_0x7bf0('0x3')]));if(_0x1fe1f3['Agents']){for(var _0x2c0efd=0x0;_0x2c0efd<_0x1fe1f3['Agents'][_0x7bf0('0x1c')];_0x2c0efd+=0x1){_0x3d5978[_0x3f4988](util[_0x7bf0('0x1a')](_0x7bf0('0x1d'),_0x1fe1f3[_0x7bf0('0x1e')][_0x2c0efd][_0x7bf0('0x3')]));}}}function joinOrLeave(_0x209236,_0x2d36f5,_0x21c107){var _0x3f454f;if(_0x209236[_0x7bf0('0x1f')][_0x7bf0('0x20')]['id']){db[_0x7bf0('0x4')][_0x7bf0('0x21')]({'attributes':['id',_0x7bf0('0x3'),'role',_0x7bf0('0x22')],'where':{'id':_0x209236[_0x7bf0('0x1f')][_0x7bf0('0x20')]['id']},'include':[{'model':db['ChatInteraction'],'as':'ChatInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x7bf0('0x23')],'as':_0x7bf0('0x24'),'attributes':['id'],'raw':!![]},{'model':db[_0x7bf0('0x25')],'as':_0x7bf0('0x26'),'attributes':['id'],'raw':!![]},{'model':db[_0x7bf0('0x27')],'as':'SmsInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x7bf0('0x28')],'as':_0x7bf0('0x29'),'attributes':['id'],'raw':!![]},{'model':db[_0x7bf0('0x2a')],'as':_0x7bf0('0x2b'),'attributes':['id'],'raw':!![]}]})[_0x7bf0('0xa')](function(_0x1d2968){if(_0x1d2968){_0x3f454f=_0x1d2968;_0x209236[_0x2d36f5](util[_0x7bf0('0x1a')](_0x7bf0('0x1d'),_0x1d2968[_0x7bf0('0x3')]));var _0x119cbb=[];switch(_0x1d2968[_0x7bf0('0x5')]){case'admin':_0x209236[_0x2d36f5](_0x7bf0('0x2c'));_0x209236[_0x2d36f5]('voice:outbound');if(queryQueues[_0x7bf0('0x2d')](_0x7bf0('0x2e'))){delete queryQueues[_0x7bf0('0x2e')];}_0x119cbb['push'](db[_0x7bf0('0x2f')][_0x7bf0('0x14')](queryQueues));_0x119cbb[_0x7bf0('0x30')](db[_0x7bf0('0x31')][_0x7bf0('0x14')](queryQueues));_0x119cbb[_0x7bf0('0x30')](db[_0x7bf0('0x32')][_0x7bf0('0x14')](queryQueues));_0x119cbb[_0x7bf0('0x30')](db[_0x7bf0('0x33')][_0x7bf0('0x14')](queryQueues));_0x119cbb[_0x7bf0('0x30')](db['MailQueue'][_0x7bf0('0x14')](queryQueues));_0x119cbb['push'](db[_0x7bf0('0x34')][_0x7bf0('0x14')](queryQueues));_0x119cbb[_0x7bf0('0x30')](db['WhatsappQueue'][_0x7bf0('0x14')](queryQueues));_0x119cbb[_0x7bf0('0x30')](db[_0x7bf0('0x4')][_0x7bf0('0x14')](queryTelephones));_0x119cbb[_0x7bf0('0x30')](db[_0x7bf0('0x35')]['findAll'](queryTrunks));_0x119cbb['push'](db['Campaign']['findAll'](queryCampaigns));_0x119cbb[_0x7bf0('0x30')](db[_0x7bf0('0x4')]['findAll'](queryAgents));break;case _0x7bf0('0x36'):_0x209236[_0x2d36f5](_0x7bf0('0x2c'));_0x209236[_0x2d36f5]('voice:outbound');_0x119cbb[_0x7bf0('0x30')](getAssociatedResources(_0x7bf0('0xc'),_0x1d2968[_0x7bf0('0x22')],_0x7bf0('0x2f')));_0x119cbb['push'](getAssociatedResources('ChatQueues',_0x1d2968['userProfileId'],_0x7bf0('0x31')));_0x119cbb[_0x7bf0('0x30')](getAssociatedResources(_0x7bf0('0xe'),_0x1d2968[_0x7bf0('0x22')],_0x7bf0('0x32')));_0x119cbb[_0x7bf0('0x30')](getAssociatedResources(_0x7bf0('0xf'),_0x1d2968[_0x7bf0('0x22')],'SmsQueue'));_0x119cbb[_0x7bf0('0x30')](getAssociatedResources(_0x7bf0('0x10'),_0x1d2968['userProfileId'],_0x7bf0('0x37')));_0x119cbb[_0x7bf0('0x30')](getAssociatedResources(_0x7bf0('0x38'),_0x1d2968[_0x7bf0('0x22')],_0x7bf0('0x34')));_0x119cbb['push'](getAssociatedResources(_0x7bf0('0x11'),_0x1d2968[_0x7bf0('0x22')],_0x7bf0('0x39')));_0x119cbb['push'](getAssociatedResources(_0x7bf0('0x12'),_0x1d2968['userProfileId'],_0x7bf0('0x4')));_0x119cbb[_0x7bf0('0x30')](getAssociatedResources(_0x7bf0('0x13'),_0x1d2968[_0x7bf0('0x22')],_0x7bf0('0x35')));_0x119cbb[_0x7bf0('0x30')](getAssociatedResources('IvrCampaigns',_0x1d2968[_0x7bf0('0x22')],_0x7bf0('0x19')));_0x119cbb[_0x7bf0('0x30')](db[_0x7bf0('0x4')][_0x7bf0('0x14')](queryAgents));break;case _0x7bf0('0x6'):_0x209236[_0x2d36f5]('voice:inbound');_0x209236[_0x2d36f5](_0x7bf0('0x3a'));_0x119cbb[_0x7bf0('0x30')](_0x1d2968[_0x7bf0('0x3b')]({'attributes':['id',_0x7bf0('0x3')]}));_0x119cbb[_0x7bf0('0x30')](_0x1d2968[_0x7bf0('0x3c')]({'attributes':['id',_0x7bf0('0x3')]}));_0x119cbb[_0x7bf0('0x30')](_0x1d2968[_0x7bf0('0x3d')]({'attributes':['id',_0x7bf0('0x3')]}));_0x119cbb[_0x7bf0('0x30')](_0x1d2968['getSmsQueues']({'attributes':['id','name']}));_0x119cbb[_0x7bf0('0x30')](_0x1d2968[_0x7bf0('0x3e')]({'attributes':['id',_0x7bf0('0x3')]}));_0x119cbb[_0x7bf0('0x30')](_0x1d2968[_0x7bf0('0x3f')]({'attributes':['id',_0x7bf0('0x3')]}));_0x119cbb['push'](_0x1d2968[_0x7bf0('0x40')]({'attributes':['id',_0x7bf0('0x3')]}));break;}return BPromise[_0x7bf0('0x41')](_0x119cbb);}})[_0x7bf0('0xa')](function(_0x77ad27){if(_0x77ad27&&_0x77ad27[_0x7bf0('0x1c')]){for(var _0x369a42=0x0;_0x369a42<_0x77ad27[_0x7bf0('0x1c')];_0x369a42+=0x1){for(var _0x3ae2b6=0x0;_0x3ae2b6<_0x77ad27[_0x369a42][_0x7bf0('0x1c')];_0x3ae2b6+=0x1){switch(_0x369a42){case 0x0:joinOrLeaveQueues(_0x209236,_0x2d36f5,_0x7bf0('0x42'),_0x77ad27[_0x369a42][_0x3ae2b6]);break;case 0x1:joinOrLeaveQueues(_0x209236,_0x2d36f5,'chat',_0x77ad27[_0x369a42][_0x3ae2b6]);break;case 0x2:joinOrLeaveQueues(_0x209236,_0x2d36f5,'fax',_0x77ad27[_0x369a42][_0x3ae2b6]);break;case 0x3:joinOrLeaveQueues(_0x209236,_0x2d36f5,'sms',_0x77ad27[_0x369a42][_0x3ae2b6]);break;case 0x4:joinOrLeaveQueues(_0x209236,_0x2d36f5,'mail',_0x77ad27[_0x369a42][_0x3ae2b6]);break;case 0x5:joinOrLeaveQueues(_0x209236,_0x2d36f5,'openchannel',_0x77ad27[_0x369a42][_0x3ae2b6]);break;case 0x6:joinOrLeaveQueues(_0x209236,_0x2d36f5,_0x7bf0('0x43'),_0x77ad27[_0x369a42][_0x3ae2b6]);break;case 0x7:if(_0x3f454f[_0x7bf0('0x5')]!==_0x7bf0('0x6'))_0x209236[_0x2d36f5](util[_0x7bf0('0x1a')](_0x7bf0('0x44'),_0x77ad27[_0x369a42][_0x3ae2b6]['name']));break;case 0x8:if(_0x3f454f[_0x7bf0('0x5')]!==_0x7bf0('0x6'))_0x209236[_0x2d36f5](util[_0x7bf0('0x1a')](_0x7bf0('0x45'),_0x77ad27[_0x369a42][_0x3ae2b6][_0x7bf0('0x3')]));break;case 0x9:if(_0x3f454f['role']!=='agent')_0x209236[_0x2d36f5](util[_0x7bf0('0x1a')]('campaign:%s:%s',_0x77ad27[_0x369a42][_0x3ae2b6][_0x7bf0('0x7')],_0x77ad27[_0x369a42][_0x3ae2b6][_0x7bf0('0x3')]));break;case 0xa:_0x209236[_0x2d36f5](util[_0x7bf0('0x1a')]('user:%s',_0x77ad27[_0x369a42][_0x3ae2b6][_0x7bf0('0x3')]));break;}}}}})[_0x7bf0('0xa')](function(){if(_0x2d36f5===_0x7bf0('0x46')){var _0x541d25=_[_0x7bf0('0x15')](_0x3f454f[_0x7bf0('0x47')],'id');return _0x3f454f[_0x7bf0('0x48')](_0x541d25)[_0x7bf0('0xa')](function(){for(var _0x42e10f=0x0;_0x42e10f<_0x541d25[_0x7bf0('0x1c')];_0x42e10f+=0x1){_0x21c107[_0x7bf0('0x49')](_0x7bf0('0x4a'),{'ChatInteractionId':Number(_0x541d25[_0x42e10f]),'UserId':Number(_0x3f454f['id'])});}});}})[_0x7bf0('0xa')](function(){if(_0x2d36f5==='leave'){var _0x548e86=_['map'](_0x3f454f[_0x7bf0('0x24')],'id');return _0x3f454f[_0x7bf0('0x4b')](_0x548e86)[_0x7bf0('0xa')](function(){for(var _0x3c8f2c=0x0;_0x3c8f2c<_0x548e86[_0x7bf0('0x1c')];_0x3c8f2c+=0x1){_0x21c107[_0x7bf0('0x49')](_0x7bf0('0x4c'),{'MailInteractionId':Number(_0x548e86[_0x3c8f2c]),'UserId':Number(_0x3f454f['id'])});}});}})[_0x7bf0('0xa')](function(){if(_0x2d36f5===_0x7bf0('0x46')){var _0x4e1e9c=_[_0x7bf0('0x15')](_0x3f454f[_0x7bf0('0x26')],'id');return _0x3f454f[_0x7bf0('0x4d')](_0x4e1e9c)[_0x7bf0('0xa')](function(){for(var _0x25c21a=0x0;_0x25c21a<_0x4e1e9c[_0x7bf0('0x1c')];_0x25c21a+=0x1){_0x21c107[_0x7bf0('0x49')](_0x7bf0('0x4e'),{'FaxInteractionId':Number(_0x4e1e9c[_0x25c21a]),'UserId':Number(_0x3f454f['id'])});}});}})[_0x7bf0('0xa')](function(){if(_0x2d36f5==='leave'){var _0x500954=_[_0x7bf0('0x15')](_0x3f454f[_0x7bf0('0x4f')],'id');return _0x3f454f[_0x7bf0('0x50')](_0x500954)['then'](function(){for(var _0x3c279d=0x0;_0x3c279d<_0x500954['length'];_0x3c279d+=0x1){_0x21c107[_0x7bf0('0x49')](_0x7bf0('0x51'),{'SmsInteractionId':Number(_0x500954[_0x3c279d]),'UserId':Number(_0x3f454f['id'])});}});}})[_0x7bf0('0xa')](function(){if(_0x2d36f5===_0x7bf0('0x46')){var _0x4306b7=_[_0x7bf0('0x15')](_0x3f454f['OpenchannelInteractions'],'id');return _0x3f454f[_0x7bf0('0x52')](_0x4306b7)[_0x7bf0('0xa')](function(){for(var _0x4c4fb6=0x0;_0x4c4fb6<_0x4306b7[_0x7bf0('0x1c')];_0x4c4fb6+=0x1){_0x21c107['emit'](_0x7bf0('0x53'),{'OpenchannelInteractionId':Number(_0x4306b7[_0x4c4fb6]),'UserId':Number(_0x3f454f['id'])});}});}})[_0x7bf0('0xa')](function(){if(_0x2d36f5===_0x7bf0('0x46')){var _0x173725=_[_0x7bf0('0x15')](_0x3f454f[_0x7bf0('0x2b')],'id');return _0x3f454f['removeWhatsappInteractions'](_0x173725)[_0x7bf0('0xa')](function(){for(var _0x2c8ef4=0x0;_0x2c8ef4<_0x173725[_0x7bf0('0x1c')];_0x2c8ef4+=0x1){_0x21c107[_0x7bf0('0x49')](_0x7bf0('0x54'),{'WhatsappInteractionId':Number(_0x173725[_0x2c8ef4]),'UserId':Number(_0x3f454f['id'])});}});}})[_0x7bf0('0x55')](function(_0x2ecdee){_0x209236['log'](_0x2ecdee);});}}function onDisconnect(_0x18522f,_0x146d9f){joinOrLeave(_0x18522f,_0x7bf0('0x46'),_0x146d9f);}function onConnect(_0x366cf1){joinOrLeave(_0x366cf1,_0x7bf0('0x56'));}exports[_0x7bf0('0x57')]=function(_0x5645a8){_0x5645a8['on'](_0x7bf0('0x58'),function(_0x5df0ef){_0x5df0ef[_0x7bf0('0x59')](0x0);_0x5df0ef[_0x7bf0('0x5a')]=_0x5df0ef[_0x7bf0('0x5b')][_0x7bf0('0x58')]['remoteAddress']+':'+_0x5df0ef[_0x7bf0('0x5b')][_0x7bf0('0x58')][_0x7bf0('0x5c')];_0x5df0ef[_0x7bf0('0x5d')]=new Date();_0x5df0ef[_0x7bf0('0x5e')]=function(_0x1cde26){console[_0x7bf0('0x5e')]('SocketIO\x20'+_0x5df0ef[_0x7bf0('0x5f')][_0x7bf0('0x3')]+'['+_0x5df0ef[_0x7bf0('0x5a')]+']',_0x1cde26);};_0x5df0ef['on'](_0x7bf0('0x60'),function(){onDisconnect(_0x5df0ef,_0x5645a8);_0x5df0ef['log'](_0x7bf0('0x61'));});onConnect(_0x5df0ef);_0x5df0ef[_0x7bf0('0x5e')](_0x7bf0('0x62'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index bd8a54e..d7390e6 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 _0xb401=['AfterUpdate','User','find','email','internal','default','hasOwnProperty','model','hook','callback','toLowerCase','condition','util','../../mysqldb','jayson/promise','../logger','triggers','http','Chat','ChatInteraction','afterCreate','afterUpdate','closedinteraction','ChatMessage','newmessage','ChatOfflineMessage','Sms','SmsInteraction','SmsMessage','WhatsappInteraction','newinteraction','Whatsapp','WhatsappMessage','Fax','FaxInteraction','Mail','MailInteraction','MailMessage','Openchannel','OpenchannelInteraction','OpenchannelMessage','request','EventManager','then','info','Trigger,\x20%s','error','code','catch','get','channel','motionChannel','event','resolve','ContactId','sequelize','query','Sequelize','SELECT','contact','UserId','undefined','interface','format','agent','incomingmessage','outgoingmessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','QueryTypes','SIP/%s','name','changed','closed','substatus'];(function(_0x232c92,_0x8a7d5d){var _0x56dd31=function(_0x52ff72){while(--_0x52ff72){_0x232c92['push'](_0x232c92['shift']());}};_0x56dd31(++_0x8a7d5d);}(_0xb401,0xea));var _0x1b40=function(_0x48d8aa,_0x2c2126){_0x48d8aa=_0x48d8aa-0x0;var _0x1ecf43=_0xb401[_0x48d8aa];return _0x1ecf43;};'use strict';var util=require(_0x1b40('0x0'));var db=require(_0x1b40('0x1'))['db'];var jayson=require(_0x1b40('0x2'));var logger=require(_0x1b40('0x3'))(_0x1b40('0x4'));var client=jayson['client'][_0x1b40('0x5')]({'port':0x232a});var triggers=[{'channel':_0x1b40('0x6'),'model':_0x1b40('0x7'),'event':_0x1b40('0x8'),'condition':'newinteraction','callback':afterCreate},{'channel':_0x1b40('0x6'),'model':'ChatInteraction','event':_0x1b40('0x9'),'condition':_0x1b40('0xa'),'callback':afterUpdate},{'channel':'Chat','model':_0x1b40('0xb'),'event':_0x1b40('0x8'),'condition':_0x1b40('0xc'),'callback':afterCreateMessage},{'channel':'Chat','model':_0x1b40('0xd'),'event':_0x1b40('0x8'),'condition':_0x1b40('0xc'),'callback':afterCreateOfflineMessage},{'channel':_0x1b40('0xe'),'model':_0x1b40('0xf'),'event':_0x1b40('0x8'),'condition':'newinteraction','callback':afterCreate},{'channel':_0x1b40('0xe'),'model':_0x1b40('0xf'),'event':'afterUpdate','condition':_0x1b40('0xa'),'callback':afterUpdate},{'channel':_0x1b40('0xe'),'model':_0x1b40('0x10'),'event':'afterCreate','condition':_0x1b40('0xc'),'callback':afterCreateMessage},{'channel':'Whatsapp','model':_0x1b40('0x11'),'event':_0x1b40('0x8'),'condition':_0x1b40('0x12'),'callback':afterCreate},{'channel':_0x1b40('0x13'),'model':_0x1b40('0x11'),'event':_0x1b40('0x9'),'condition':_0x1b40('0xa'),'callback':afterUpdate},{'channel':_0x1b40('0x13'),'model':_0x1b40('0x14'),'event':_0x1b40('0x8'),'condition':'newmessage','callback':afterCreateMessage},{'channel':'Fax','model':'FaxInteraction','event':_0x1b40('0x8'),'condition':_0x1b40('0x12'),'callback':afterCreate},{'channel':_0x1b40('0x15'),'model':_0x1b40('0x16'),'event':_0x1b40('0x9'),'condition':'closedinteraction','callback':afterUpdate},{'channel':'Fax','model':'FaxMessage','event':'afterCreate','condition':'newmessage','callback':afterCreateMessage},{'channel':_0x1b40('0x17'),'model':_0x1b40('0x18'),'event':_0x1b40('0x8'),'condition':_0x1b40('0x12'),'callback':afterCreate},{'channel':_0x1b40('0x17'),'model':_0x1b40('0x18'),'event':'afterUpdate','condition':_0x1b40('0xa'),'callback':afterUpdate},{'channel':_0x1b40('0x17'),'model':_0x1b40('0x19'),'event':_0x1b40('0x8'),'condition':_0x1b40('0xc'),'callback':afterCreateMessage},{'channel':_0x1b40('0x1a'),'model':_0x1b40('0x1b'),'event':_0x1b40('0x8'),'condition':_0x1b40('0x12'),'callback':afterCreate},{'channel':_0x1b40('0x1a'),'model':_0x1b40('0x1b'),'event':'afterUpdate','condition':_0x1b40('0xa'),'callback':afterUpdate},{'channel':_0x1b40('0x1a'),'model':_0x1b40('0x1c'),'event':_0x1b40('0x8'),'condition':_0x1b40('0xc'),'callback':afterCreateMessage}];function request(_0x4da190){return client[_0x1b40('0x1d')](_0x1b40('0x1e'),_0x4da190)[_0x1b40('0x1f')](function(_0x2ae70a){logger[_0x1b40('0x20')](_0x1b40('0x21'),_0x1b40('0x1e'),_0x2ae70a);if(_0x2ae70a[_0x1b40('0x22')]){if(_0x2ae70a[_0x1b40('0x22')][_0x1b40('0x23')]===0x1f4){logger['error'](_0x1b40('0x21'),_0x1b40('0x1e'),_0x2ae70a[_0x1b40('0x22')]);}}})[_0x1b40('0x24')](function(_0x33cd80){logger['error'](_0x1b40('0x21'),_0x1b40('0x1e'),_0x33cd80);});}function afterCreateMessage(_0x48f76f){return function(_0x129aef){_0x129aef=_0x129aef[_0x1b40('0x25')]({'plain':!![]});_0x129aef[_0x1b40('0x26')]=_0x48f76f;_0x129aef[_0x1b40('0x27')]=_0x48f76f;_0x129aef[_0x1b40('0x28')]=_0x129aef['direction'];Promise[_0x1b40('0x29')]()[_0x1b40('0x1f')](function(){if(typeof _0x129aef[_0x1b40('0x2a')]==='undefined')return null;var _0xa74250='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x129aef[_0x1b40('0x2a')];return db[_0x1b40('0x2b')][_0x1b40('0x2c')](_0xa74250,{'type':db[_0x1b40('0x2d')]['QueryTypes'][_0x1b40('0x2e')],'raw':!![]});})[_0x1b40('0x1f')](function(_0x2afbf7){if(_0x2afbf7){_0x129aef[_0x1b40('0x2f')]=_0x2afbf7[0x0];}if(typeof _0x129aef[_0x1b40('0x30')]===_0x1b40('0x31'))return;return getAgent(_0x129aef[_0x1b40('0x30')]);})['then'](function(_0x1362c6){if(_0x1362c6){_0x129aef[_0x1b40('0x32')]=util[_0x1b40('0x33')]('SIP/%s',_0x1362c6['name']);_0x129aef[_0x1b40('0x34')]=_0x1362c6;_0x129aef['channel']=_0x48f76f;return request({'event':_0x1b40('0x35'),'message':_0x129aef});}else{return request({'event':_0x1b40('0x36'),'message':_0x129aef});}})['catch'](function(_0x4b7601){logger['error'](_0x1b40('0x21'),'AfterCreateMessage',_0x4b7601);});};}function afterCreateOfflineMessage(_0x1063fb){return function(_0x3e4581){_0x3e4581=_0x3e4581[_0x1b40('0x25')]({'plain':!![]});_0x3e4581[_0x1b40('0x26')]=_0x1063fb;_0x3e4581[_0x1b40('0x27')]=_0x1063fb;_0x3e4581['event']='offlineMessage';return request({'event':_0x3e4581[_0x1b40('0x28')],'message':_0x3e4581});};}function afterCreate(_0x9b56e3,_0xe0904e){return function(_0x3f40e2){_0x3f40e2=_0x3f40e2[_0x1b40('0x25')]({'plain':!![]});_0x3f40e2[_0x1b40('0x26')]=_0x9b56e3;_0x3f40e2['motionChannel']=_0x9b56e3;_0x3f40e2[_0x1b40('0x28')]='opened';Promise[_0x1b40('0x29')]()[_0x1b40('0x1f')](function(){var _0x50bd8a=_0x1b40('0x37')+_0x3f40e2['ContactId'];return db[_0x1b40('0x2b')]['query'](_0x50bd8a,{'type':db[_0x1b40('0x2d')][_0x1b40('0x38')][_0x1b40('0x2e')],'raw':!![]});})[_0x1b40('0x1f')](function(_0x45721d){if(_0x45721d){_0x3f40e2[_0x1b40('0x2f')]=_0x45721d[0x0];}if(typeof _0x3f40e2[_0x1b40('0x30')]==='undefined')return;return getAgent(_0x3f40e2[_0x1b40('0x30')]);})[_0x1b40('0x1f')](function(_0x35b28a){if(_0x35b28a){_0x3f40e2[_0x1b40('0x32')]=util['format'](_0x1b40('0x39'),_0x35b28a[_0x1b40('0x3a')]);_0x3f40e2[_0x1b40('0x34')]=_0x35b28a;}return request({'event':_0xe0904e,'message':_0x3f40e2});})[_0x1b40('0x24')](function(_0x45a167){logger[_0x1b40('0x22')](_0x1b40('0x21'),'AfterCreate',_0x45a167);});};}function afterUpdate(_0x804950){return function(_0x7c381){var _0x5c5322=_0x7c381[_0x1b40('0x3b')](_0x1b40('0x3c'))&&_0x7c381[_0x1b40('0x3c')];var _0x9ebbd6=_0x7c381[_0x1b40('0x3b')](_0x1b40('0x3d'));if(_0x5c5322||_0x9ebbd6){var _0x147214=_0x5c5322?_0x1b40('0xa'):_0x1b40('0x3d');var _0x2451c5=_0x7c381[_0x1b40('0x25')]({'plain':!![]});_0x2451c5[_0x1b40('0x26')]=_0x804950;_0x2451c5[_0x1b40('0x27')]=_0x804950;_0x2451c5[_0x1b40('0x28')]=_0x5c5322?'closed':_0x1b40('0x3d');var _0x3b9455=_0x1b40('0x37')+_0x2451c5[_0x1b40('0x2a')];return db[_0x1b40('0x2b')][_0x1b40('0x2c')](_0x3b9455,{'type':db[_0x1b40('0x2d')][_0x1b40('0x38')][_0x1b40('0x2e')],'raw':!![]})[_0x1b40('0x1f')](function(_0x24ab94){if(_0x24ab94){_0x2451c5[_0x1b40('0x2f')]=_0x24ab94[0x0];}if(typeof _0x2451c5[_0x1b40('0x30')]===_0x1b40('0x31'))return;return getAgent(_0x2451c5[_0x1b40('0x30')]);})['then'](function(_0x55d387){if(_0x55d387){_0x2451c5[_0x1b40('0x32')]=util[_0x1b40('0x33')](_0x1b40('0x39'),_0x55d387[_0x1b40('0x3a')]);_0x2451c5[_0x1b40('0x34')]=_0x55d387;}return request({'event':_0x147214,'message':_0x2451c5});})[_0x1b40('0x24')](function(_0x37f954){logger[_0x1b40('0x22')](_0x1b40('0x21'),_0x1b40('0x3e'),_0x37f954);});}};}function getAgent(_0x3b0292){return db[_0x1b40('0x3f')][_0x1b40('0x40')]({'where':{'id':_0x3b0292},'attributes':['id',_0x1b40('0x3a'),'fullname',_0x1b40('0x41'),_0x1b40('0x42')],'raw':!![]})['then'](function(_0x40f2ed){return _0x40f2ed;});}exports[_0x1b40('0x43')]=function(){for(var _0x329b95=0x0;_0x329b95=_0x479af6[_0x423e('0x14')]){throw Error(_0x423e('0x15'));}_0x317c59(_0x33b376);})[_0x423e('0x16')](function(_0x306017){_0x44adac(_0x306017);});});}; \ No newline at end of file +var _0x6044=['fax','sms','whatsapp','openchannel','getChannels','isValidChannel','includes','clearBlockUser','isUndefined','blockedAt','agent','User','count','then','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','lodash','bluebird','./license/util','voice'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6044,0x7a));var _0x4604=function(_0x88070d,_0x47fab4){_0x88070d=_0x88070d-0x0;var _0x159cd5=_0x6044[_0x88070d];return _0x159cd5;};'use strict';var _=require(_0x4604('0x0'));var BPromise=require(_0x4604('0x1'));var db=require('../mysqldb')['db'];var util=require(_0x4604('0x2'));var channels=[_0x4604('0x3'),'mail','chat',_0x4604('0x4'),_0x4604('0x5'),_0x4604('0x6'),_0x4604('0x7')];exports[_0x4604('0x8')]=function(){return channels;};exports[_0x4604('0x9')]=function(_0x3fa5eb){_0x3fa5eb=_0x3fa5eb['toLowerCase']();return _[_0x4604('0xa')](channels,_0x3fa5eb);};exports[_0x4604('0xb')]=function(_0x51d031,_0x4a2827,_0x2f9ca7,_0x92fdb3){var _0x15ab7f={'loginAttempts':_0x4a2827,'blocked':_0x2f9ca7};if(!_[_0x4604('0xc')](_0x92fdb3)){_0x15ab7f[_0x4604('0xd')]=_0x92fdb3;}return _0x51d031['updateAttributes'](_0x15ab7f);};exports['getLicense']=function(_0x1f2058){return new BPromise(function(_0x302ea9,_0x21fdb2){var _0x49ec17=0x0;if(_0x1f2058['role']!==_0x4604('0xe')){_0x302ea9(_0x1f2058);}db[_0x4604('0xf')][_0x4604('0x10')]({'where':{'role':'agent','online':!![],'id':{'$ne':_0x1f2058['id']}}})[_0x4604('0x11')](function(_0x13124f){_0x49ec17=_0x13124f;return util[_0x4604('0x12')]();})[_0x4604('0x11')](function(_0xb5cac9){if(_0xb5cac9&&_0xb5cac9[_0x4604('0x13')]&&_0x49ec17>=_0xb5cac9[_0x4604('0x13')]){throw Error(_0x4604('0x14'));}_0x302ea9(_0x1f2058);})['catch'](function(_0x4c6879){_0x21fdb2(_0x4c6879);});});}; \ No newline at end of file diff --git a/server/errors/api.js b/server/errors/api.js index 7eef075..f18e038 100644 --- a/server/errors/api.js +++ b/server/errors/api.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdace=['send','exports','util','api','Internal\x20Server\x20Error','name','Error','inherits','message','Bad\x20Request','Not\x20Found','Forbidden','OutOfInterval','error','status'];(function(_0x5c2827,_0x47b816){var _0x2c5616=function(_0x59636f){while(--_0x59636f){_0x5c2827['push'](_0x5c2827['shift']());}};_0x2c5616(++_0x47b816);}(_0xdace,0xc5));var _0xedac=function(_0x4cfc1d,_0x2c0927){_0x4cfc1d=_0x4cfc1d-0x0;var _0x1c01a0=_0xdace[_0x4cfc1d];return _0x1c01a0;};'use strict';var util=require(_0xedac('0x0'));var logger=require('../config/logger')(_0xedac('0x1'));var APIError=function(_0x13adb5,_0x46eba0){this['message']=_0x13adb5||_0xedac('0x2');this[_0xedac('0x3')]=_0x46eba0||_0xedac('0x4');util[_0xedac('0x5')](APIError,Error);};var APIBadRequestError=function(_0x5a97c0){this[_0xedac('0x6')]=_0x5a97c0||_0xedac('0x7');this[_0xedac('0x3')]='Bad\x20Request';util[_0xedac('0x5')](APIBadRequestError,APIError);};var APINotFoundError=function(_0x21440e){this[_0xedac('0x6')]=_0x21440e||'Entity\x20not\x20found';this[_0xedac('0x3')]=_0xedac('0x8');util[_0xedac('0x5')](APINotFoundError,APIError);};function getStatusCode(_0x4af030){switch(_0x4af030){case'Bad\x20Request':return 0x190;case _0xedac('0x9'),_0xedac('0xa'):return 0x193;case'Not\x20Found':return 0x194;default:return 0x1f4;}}function handleError(_0x4d6a29){return function(_0x4db2ad){logger[_0xedac('0xb')](_0x4db2ad['stack']);var _0x261401=getStatusCode(_0x4db2ad['name']);if(_0x4db2ad[_0xedac('0x3')])delete _0x4db2ad[_0xedac('0x3')];return _0x4d6a29[_0xedac('0xc')](_0x261401)[_0xedac('0xd')](_0x4db2ad);};}module[_0xedac('0xe')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APINotFoundError':APINotFoundError,'handleError':handleError}; \ No newline at end of file +var _0x0bb5=['message','Internal\x20Server\x20Error','name','Error','inherits','Bad\x20Request','Not\x20Found','OutOfInterval','error','stack','status','send','exports','util','../config/logger'];(function(_0x3d3a19,_0x595596){var _0x4e5e65=function(_0xd5e1e){while(--_0xd5e1e){_0x3d3a19['push'](_0x3d3a19['shift']());}};_0x4e5e65(++_0x595596);}(_0x0bb5,0x148));var _0x50bb=function(_0x5ca2c7,_0x8a885f){_0x5ca2c7=_0x5ca2c7-0x0;var _0x182ccf=_0x0bb5[_0x5ca2c7];return _0x182ccf;};'use strict';var util=require(_0x50bb('0x0'));var logger=require(_0x50bb('0x1'))('api');var APIError=function(_0x5a12b6,_0x348380){this[_0x50bb('0x2')]=_0x5a12b6||_0x50bb('0x3');this[_0x50bb('0x4')]=_0x348380||_0x50bb('0x5');util[_0x50bb('0x6')](APIError,Error);};var APIBadRequestError=function(_0x451b4c){this[_0x50bb('0x2')]=_0x451b4c||'Bad\x20Request';this['name']=_0x50bb('0x7');util[_0x50bb('0x6')](APIBadRequestError,APIError);};var APINotFoundError=function(_0x2e5463){this[_0x50bb('0x2')]=_0x2e5463||'Entity\x20not\x20found';this['name']=_0x50bb('0x8');util[_0x50bb('0x6')](APINotFoundError,APIError);};function getStatusCode(_0x3ae598){switch(_0x3ae598){case _0x50bb('0x7'):return 0x190;case'Forbidden',_0x50bb('0x9'):return 0x193;case _0x50bb('0x8'):return 0x194;default:return 0x1f4;}}function handleError(_0x184d06){return function(_0x41055d){logger[_0x50bb('0xa')](_0x41055d[_0x50bb('0xb')]);var _0x38d3b6=getStatusCode(_0x41055d['name']);if(_0x41055d[_0x50bb('0x4')])delete _0x41055d['name'];return _0x184d06[_0x50bb('0xc')](_0x38d3b6)[_0x50bb('0xd')](_0x41055d);};}module[_0x50bb('0xe')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APINotFoundError':APINotFoundError,'handleError':handleError}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index 1ffd84e..d1ff706 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x682e=['404','status','render','json','send','exports'];(function(_0x17785e,_0x407d4e){var _0x5ccb41=function(_0x4f055e){while(--_0x4f055e){_0x17785e['push'](_0x17785e['shift']());}};_0x5ccb41(++_0x407d4e);}(_0x682e,0x119));var _0xe682=function(_0x3d4106,_0x3df69d){_0x3d4106=_0x3d4106-0x0;var _0x25e4a4=_0x682e[_0x3d4106];return _0x25e4a4;};'use strict';module[_0xe682('0x0')][0x194]=function pageNotFound(_0x53a74b,_0x3c4506){var _0x1a8c6b=_0xe682('0x1');var _0x106a11=0x194;var _0x449cca={'status':_0x106a11};_0x3c4506[_0xe682('0x2')](_0x449cca[_0xe682('0x2')]);_0x3c4506[_0xe682('0x3')](_0x1a8c6b,{},function(_0x2b9dd1,_0x3abe2e){if(_0x2b9dd1){return _0x3c4506[_0xe682('0x2')](_0x449cca['status'])[_0xe682('0x4')](_0x449cca);}_0x3c4506[_0xe682('0x5')](_0x3abe2e);});}; \ No newline at end of file +var _0x2e18=['render','send','exports','404','status'];(function(_0x3cb465,_0x36d920){var _0x4e197b=function(_0x25fd7d){while(--_0x25fd7d){_0x3cb465['push'](_0x3cb465['shift']());}};_0x4e197b(++_0x36d920);}(_0x2e18,0x19c));var _0x82e1=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0x2e18[_0x5d6456];return _0x4d66c1;};'use strict';module[_0x82e1('0x0')][0x194]=function pageNotFound(_0x2e1a35,_0x499adf){var _0x5e9a5f=_0x82e1('0x1');var _0x351a81=0x194;var _0x6f87f0={'status':_0x351a81};_0x499adf[_0x82e1('0x2')](_0x6f87f0[_0x82e1('0x2')]);_0x499adf[_0x82e1('0x3')](_0x5e9a5f,{},function(_0x382ee0,_0x4bce08){if(_0x382ee0){return _0x499adf[_0x82e1('0x2')](_0x6f87f0[_0x82e1('0x2')])['json'](_0x6f87f0);}_0x499adf[_0x82e1('0x4')](_0x4bce08);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index 8bf11ea..5005826 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(_0x3d4876,_0x366386){var _0x58ca9d=function(_0x5bd045){while(--_0x5bd045){_0x3d4876['push'](_0x3d4876['shift']());}};_0x58ca9d(++_0x366386);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1da04e,_0x31024b){_0x1da04e=_0x1da04e-0x0;var _0xdd8c41=_0xa9e0[_0x1da04e];return _0xdd8c41;};'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(_0x3b2244,_0x54873f){var _0x2dcc14=function(_0x53d73f){while(--_0x53d73f){_0x3b2244['push'](_0x3b2244['shift']());}};_0x2dcc14(++_0x54873f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xa9e0[_0x24237f];return _0x48298e;};'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 5c17a68..94c70a5 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc54c=['/api/sounds','./api/sound','/api/tags','./api/tag','/api/contact_item_types','/api/cm_contact_has_items','./api/cmContactHasItem','/api/cm_hopper_additional_phones','./api/cmHopperAdditionalPhone','./api/template','./api/trigger','/api/variables','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','/api/integrations/desk/fields','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields','/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/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/accounts','/api/integrations/dynamics365/configurations','/api/integrations/dynamics365/fields','./api/intDynamics365Field','./api/intFreshsalesAccount','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','./api/network','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','./api/squareReport','/api/square/details/reports','/api/jscripty/projects','/api/settings','./api/setting','/api/square/odbc','./api/squareOdbc','/api/square/projects','./api/squareProject','/api/square/recordings','/api/square/messages','./api/squareMessage','/api/teams','./api/license','/api/migrations','./api/migration','./api/attachment','/api/plugins','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','./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/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/messages','/api/whatsapp/reports/queue','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','/api/cloudProviders','./api/cloudProvider','/api/realtime','./api/realtime','/api/user-settings','./api/user-setting','/api/auth/local','./api/authLocal','./api/authGoogle','/api/auth/activedirectory','./api/jira','/api/rpc','./api/rpc','/api/version','./api/version','/api/system','/api/pm2','./api/pm2','/api/webbar','/api/logs','static','join','root','/apidoc','/www','/demo','snippet','3.2.0','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','resolve','appPath','/index.html','path','./errors','./utils/client-side-logger','./api/client-side-logs','default','then','/api/users','./api/user','use','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','/api/screen/recordings','./api/screenRecording','/api/voice/mails','/api/voice/mails/messages','./api/voiceMailMessage','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','/api/voice/queues/reports','./api/memberReport','/api/trunks','./api/trunk','/api/voice/transfers/reports','/api/mail/out_servers','./api/mailServerOut','/api/mail/accounts','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','./api/mailMessage','/api/mail/applications','./api/mailApplication','./api/mailQueueReport','/api/dashboards','./api/dashboard','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','/api/fax/applications','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','./api/faxMessage','./api/faxQueueReport','./api/smsAccount','/api/sms/applications','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','./api/smsMessage','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','/api/openchannel/applications','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/hopper','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','./api/action','/api/automations','/api/canned_answers','./api/cannedAnswer','/api/dispositions','./api/disposition','/api/conditions','./api/condition','./api/interval','/api/pauses','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','./api/schedule'];(function(_0x48a9e5,_0x307e13){var _0x274585=function(_0x438af0){while(--_0x438af0){_0x48a9e5['push'](_0x48a9e5['shift']());}};_0x274585(++_0x307e13);}(_0xc54c,0x1c2));var _0xcc54=function(_0x212bf5,_0x165cbd){_0x212bf5=_0x212bf5-0x0;var _0xfcad21=_0xc54c[_0x212bf5];return _0xfcad21;};'use strict';var path=require(_0xcc54('0x0'));var express=require('express');var errors=require(_0xcc54('0x1'));var config=require('./config/environment');var setupLoggers=require(_0xcc54('0x2'))['setupLoggers'];var clientSideLogs=require(_0xcc54('0x3'));exports[_0xcc54('0x4')]=function(_0x5cace5){return setupLoggers(_0x5cace5)[_0xcc54('0x5')](function(){_0x5cace5['use'](_0xcc54('0x6'),require(_0xcc54('0x7')));_0x5cace5[_0xcc54('0x8')]('/api/voice/chanspy',require(_0xcc54('0x9')));_0x5cace5[_0xcc54('0x8')](_0xcc54('0xa'),require(_0xcc54('0xb')));_0x5cace5[_0xcc54('0x8')](_0xcc54('0xc'),require('./api/voiceExtension'));_0x5cace5[_0xcc54('0x8')](_0xcc54('0xd'),require(_0xcc54('0xe')));_0x5cace5[_0xcc54('0x8')](_0xcc54('0xf'),require(_0xcc54('0x10')));_0x5cace5[_0xcc54('0x8')](_0xcc54('0x11'),require('./api/voiceRecording'));_0x5cace5[_0xcc54('0x8')](_0xcc54('0x12'),require(_0xcc54('0x13')));_0x5cace5[_0xcc54('0x8')](_0xcc54('0x14'),require('./api/voiceMail'));_0x5cace5[_0xcc54('0x8')](_0xcc54('0x15'),require(_0xcc54('0x16')));_0x5cace5['use']('/api/voice/calls/reports',require(_0xcc54('0x17')));_0x5cace5[_0xcc54('0x8')](_0xcc54('0x18'),require(_0xcc54('0x19')));_0x5cace5[_0xcc54('0x8')](_0xcc54('0x1a'),require('./api/voiceAgentReport'));_0x5cace5[_0xcc54('0x8')](_0xcc54('0x1b'),require('./api/voiceQueueReport'));_0x5cace5[_0xcc54('0x8')]('/api/members/reports',require(_0xcc54('0x1c')));_0x5cace5[_0xcc54('0x8')](_0xcc54('0x1d'),require(_0xcc54('0x1e')));_0x5cace5[_0xcc54('0x8')](_0xcc54('0x1f'),require('./api/voiceTransferReport'));_0x5cace5['use'](_0xcc54('0x20'),require(_0xcc54('0x21')));_0x5cace5[_0xcc54('0x8')](_0xcc54('0x22'),require('./api/mailAccount'));_0x5cace5[_0xcc54('0x8')](_0xcc54('0x23'),require(_0xcc54('0x24')));_0x5cace5[_0xcc54('0x8')](_0xcc54('0x25'),require(_0xcc54('0x26')));_0x5cace5['use'](_0xcc54('0x27'),require(_0xcc54('0x28')));_0x5cace5[_0xcc54('0x8')](_0xcc54('0x29'),require(_0xcc54('0x2a')));_0x5cace5[_0xcc54('0x8')](_0xcc54('0x2b'),require(_0xcc54('0x2c')));_0x5cace5[_0xcc54('0x8')]('/api/mail/reports/queue',require(_0xcc54('0x2d')));_0x5cace5[_0xcc54('0x8')](_0xcc54('0x2e'),require(_0xcc54('0x2f')));_0x5cace5[_0xcc54('0x8')](_0xcc54('0x30'),require(_0xcc54('0x31')));_0x5cace5[_0xcc54('0x8')](_0xcc54('0x32'),require('./api/faxAccount'));_0x5cace5[_0xcc54('0x8')](_0xcc54('0x33'),require(_0xcc54('0x34')));_0x5cace5[_0xcc54('0x8')](_0xcc54('0x35'),require(_0xcc54('0x36')));_0x5cace5[_0xcc54('0x8')](_0xcc54('0x37'),require(_0xcc54('0x38')));_0x5cace5[_0xcc54('0x8')]('/api/fax/queues',require('./api/faxQueue'));_0x5cace5[_0xcc54('0x8')]('/api/fax/reports/queue',require(_0xcc54('0x39')));_0x5cace5['use']('/api/sms/accounts',require(_0xcc54('0x3a')));_0x5cace5[_0xcc54('0x8')](_0xcc54('0x3b'),require(_0xcc54('0x3c')));_0x5cace5[_0xcc54('0x8')](_0xcc54('0x3d'),require(_0xcc54('0x3e')));_0x5cace5[_0xcc54('0x8')](_0xcc54('0x3f'),require(_0xcc54('0x40')));_0x5cace5[_0xcc54('0x8')](_0xcc54('0x41'),require(_0xcc54('0x42')));_0x5cace5['use'](_0xcc54('0x43'),require('./api/openchannelAccount'));_0x5cace5[_0xcc54('0x8')](_0xcc54('0x44'),require('./api/openchannelApplication'));_0x5cace5[_0xcc54('0x8')](_0xcc54('0x45'),require(_0xcc54('0x46')));_0x5cace5[_0xcc54('0x8')](_0xcc54('0x47'),require(_0xcc54('0x48')));_0x5cace5[_0xcc54('0x8')](_0xcc54('0x49'),require('./api/openchannelQueue'));_0x5cace5[_0xcc54('0x8')](_0xcc54('0x4a'),require(_0xcc54('0x4b')));_0x5cace5['use'](_0xcc54('0x4c'),require(_0xcc54('0x4d')));_0x5cace5[_0xcc54('0x8')](_0xcc54('0x4e'),require(_0xcc54('0x4f')));_0x5cace5[_0xcc54('0x8')](_0xcc54('0x50'),require(_0xcc54('0x51')));_0x5cace5['use']('/api/chat/messages',require('./api/chatMessage'));_0x5cace5[_0xcc54('0x8')](_0xcc54('0x52'),require(_0xcc54('0x53')));_0x5cace5['use']('/api/chat/queues',require('./api/chatQueue'));_0x5cace5[_0xcc54('0x8')](_0xcc54('0x54'),require(_0xcc54('0x55')));_0x5cace5[_0xcc54('0x8')](_0xcc54('0x56'),require(_0xcc54('0x57')));_0x5cace5[_0xcc54('0x8')](_0xcc54('0x58'),require(_0xcc54('0x59')));_0x5cace5[_0xcc54('0x8')]('/api/cm/contacts',require('./api/cmContact'));_0x5cace5[_0xcc54('0x8')](_0xcc54('0x5a'),require(_0xcc54('0x5b')));_0x5cace5[_0xcc54('0x8')](_0xcc54('0x5c'),require(_0xcc54('0x5d')));_0x5cace5[_0xcc54('0x8')](_0xcc54('0x5e'),require(_0xcc54('0x5f')));_0x5cace5[_0xcc54('0x8')](_0xcc54('0x60'),require(_0xcc54('0x61')));_0x5cace5[_0xcc54('0x8')](_0xcc54('0x62'),require('./api/cmCustomField'));_0x5cace5['use']('/api/actions',require(_0xcc54('0x63')));_0x5cace5[_0xcc54('0x8')](_0xcc54('0x64'),require('./api/automation'));_0x5cace5[_0xcc54('0x8')](_0xcc54('0x65'),require(_0xcc54('0x66')));_0x5cace5[_0xcc54('0x8')](_0xcc54('0x67'),require(_0xcc54('0x68')));_0x5cace5['use'](_0xcc54('0x69'),require(_0xcc54('0x6a')));_0x5cace5[_0xcc54('0x8')]('/api/intervals',require(_0xcc54('0x6b')));_0x5cace5[_0xcc54('0x8')](_0xcc54('0x6c'),require('./api/pause'));_0x5cace5['use']('/api/cdr',require(_0xcc54('0x6d')));_0x5cace5[_0xcc54('0x8')](_0xcc54('0x6e'),require(_0xcc54('0x6f')));_0x5cace5['use'](_0xcc54('0x70'),require(_0xcc54('0x71')));_0x5cace5[_0xcc54('0x8')](_0xcc54('0x72'),require(_0xcc54('0x73')));_0x5cace5[_0xcc54('0x8')](_0xcc54('0x74'),require(_0xcc54('0x75')));_0x5cace5[_0xcc54('0x8')](_0xcc54('0x76'),require('./api/contactItemType'));_0x5cace5['use'](_0xcc54('0x77'),require(_0xcc54('0x78')));_0x5cace5[_0xcc54('0x8')](_0xcc54('0x79'),require(_0xcc54('0x7a')));_0x5cace5[_0xcc54('0x8')]('/api/templates',require(_0xcc54('0x7b')));_0x5cace5['use']('/api/triggers',require(_0xcc54('0x7c')));_0x5cace5['use'](_0xcc54('0x7d'),require('./api/variable'));_0x5cace5[_0xcc54('0x8')]('/api/integrations',require('./api/integration'));_0x5cace5[_0xcc54('0x8')](_0xcc54('0x7e'),require(_0xcc54('0x7f')));_0x5cace5[_0xcc54('0x8')](_0xcc54('0x80'),require(_0xcc54('0x81')));_0x5cace5[_0xcc54('0x8')](_0xcc54('0x82'),require(_0xcc54('0x83')));_0x5cace5[_0xcc54('0x8')](_0xcc54('0x84'),require(_0xcc54('0x85')));_0x5cace5['use'](_0xcc54('0x86'),require(_0xcc54('0x87')));_0x5cace5['use'](_0xcc54('0x88'),require(_0xcc54('0x89')));_0x5cace5[_0xcc54('0x8')](_0xcc54('0x8a'),require('./api/analyticTreeReport'));_0x5cace5['use']('/api/integrations/salesforce/accounts',require(_0xcc54('0x8b')));_0x5cace5[_0xcc54('0x8')](_0xcc54('0x8c'),require(_0xcc54('0x8d')));_0x5cace5[_0xcc54('0x8')]('/api/integrations/salesforce/fields',require(_0xcc54('0x8e')));_0x5cace5['use'](_0xcc54('0x8f'),require('./api/intSugarcrmAccount'));_0x5cace5[_0xcc54('0x8')]('/api/integrations/sugarcrm/configurations',require(_0xcc54('0x90')));_0x5cace5[_0xcc54('0x8')](_0xcc54('0x91'),require(_0xcc54('0x92')));_0x5cace5[_0xcc54('0x8')](_0xcc54('0x93'),require(_0xcc54('0x94')));_0x5cace5[_0xcc54('0x8')](_0xcc54('0x95'),require('./api/intDeskConfiguration'));_0x5cace5[_0xcc54('0x8')](_0xcc54('0x96'),require('./api/intDeskField'));_0x5cace5['use'](_0xcc54('0x97'),require(_0xcc54('0x98')));_0x5cace5['use'](_0xcc54('0x99'),require(_0xcc54('0x9a')));_0x5cace5[_0xcc54('0x8')](_0xcc54('0x9b'),require('./api/intZohoField'));_0x5cace5['use'](_0xcc54('0x9c'),require('./api/intZendeskAccount'));_0x5cace5[_0xcc54('0x8')](_0xcc54('0x9d'),require(_0xcc54('0x9e')));_0x5cace5[_0xcc54('0x8')](_0xcc54('0x9f'),require(_0xcc54('0xa0')));_0x5cace5[_0xcc54('0x8')](_0xcc54('0xa1'),require(_0xcc54('0xa2')));_0x5cace5['use'](_0xcc54('0xa3'),require(_0xcc54('0xa4')));_0x5cace5[_0xcc54('0x8')](_0xcc54('0xa5'),require('./api/intFreshdeskField'));_0x5cace5[_0xcc54('0x8')](_0xcc54('0xa6'),require(_0xcc54('0xa7')));_0x5cace5[_0xcc54('0x8')](_0xcc54('0xa8'),require(_0xcc54('0xa9')));_0x5cace5[_0xcc54('0x8')](_0xcc54('0xaa'),require('./api/intVtigerField'));_0x5cace5['use']('/api/integrations/servicenow/accounts',require(_0xcc54('0xab')));_0x5cace5[_0xcc54('0x8')](_0xcc54('0xac'),require(_0xcc54('0xad')));_0x5cace5[_0xcc54('0x8')](_0xcc54('0xae'),require(_0xcc54('0xaf')));_0x5cace5['use'](_0xcc54('0xb0'),require('./api/intDynamics365Account'));_0x5cace5['use'](_0xcc54('0xb1'),require('./api/intDynamics365Configuration'));_0x5cace5[_0xcc54('0x8')](_0xcc54('0xb2'),require(_0xcc54('0xb3')));_0x5cace5[_0xcc54('0x8')]('/api/integrations/freshsales/accounts',require(_0xcc54('0xb4')));_0x5cace5[_0xcc54('0x8')]('/api/integrations/freshsales/configurations',require(_0xcc54('0xb5')));_0x5cace5[_0xcc54('0x8')](_0xcc54('0xb6'),require(_0xcc54('0xb7')));_0x5cace5[_0xcc54('0x8')]('/api/networks',require(_0xcc54('0xb8')));_0x5cace5[_0xcc54('0x8')](_0xcc54('0xb9'),require(_0xcc54('0xba')));_0x5cace5['use'](_0xcc54('0xbb'),require(_0xcc54('0xbc')));_0x5cace5[_0xcc54('0x8')](_0xcc54('0xbd'),require(_0xcc54('0xbe')));_0x5cace5[_0xcc54('0x8')](_0xcc54('0xbf'),require('./api/jscriptyQuestionReport'));_0x5cace5['use'](_0xcc54('0xc0'),require(_0xcc54('0xc1')));_0x5cace5['use'](_0xcc54('0xc2'),require(_0xcc54('0xc3')));_0x5cace5[_0xcc54('0x8')](_0xcc54('0xc4'),require(_0xcc54('0xc5')));_0x5cace5[_0xcc54('0x8')](_0xcc54('0xc6'),require('./api/squareReportDetail'));_0x5cace5[_0xcc54('0x8')](_0xcc54('0xc7'),require('./api/jscriptyProject'));_0x5cace5[_0xcc54('0x8')](_0xcc54('0xc8'),require(_0xcc54('0xc9')));_0x5cace5[_0xcc54('0x8')](_0xcc54('0xca'),require(_0xcc54('0xcb')));_0x5cace5[_0xcc54('0x8')](_0xcc54('0xcc'),require(_0xcc54('0xcd')));_0x5cace5[_0xcc54('0x8')](_0xcc54('0xce'),require('./api/squareRecording'));_0x5cace5[_0xcc54('0x8')](_0xcc54('0xcf'),require(_0xcc54('0xd0')));_0x5cace5['use'](_0xcc54('0xd1'),require('./api/team'));_0x5cace5[_0xcc54('0x8')]('/api/license',require(_0xcc54('0xd2')));_0x5cace5['use']('/api/campaigns',require('./api/campaign'));_0x5cace5[_0xcc54('0x8')](_0xcc54('0xd3'),require(_0xcc54('0xd4')));_0x5cace5[_0xcc54('0x8')]('/api/attachments',require(_0xcc54('0xd5')));_0x5cace5[_0xcc54('0x8')](_0xcc54('0xd6'),require(_0xcc54('0xd7')));_0x5cace5[_0xcc54('0x8')](_0xcc54('0xd8'),require(_0xcc54('0xd9')));_0x5cace5[_0xcc54('0x8')]('/api/chat/reports/transfer',require(_0xcc54('0xda')));_0x5cace5[_0xcc54('0x8')](_0xcc54('0xdb'),require(_0xcc54('0xdc')));_0x5cace5[_0xcc54('0x8')](_0xcc54('0xdd'),require(_0xcc54('0xde')));_0x5cace5['use'](_0xcc54('0xdf'),require(_0xcc54('0xe0')));_0x5cace5[_0xcc54('0x8')](_0xcc54('0xe1'),require(_0xcc54('0xe2')));_0x5cace5[_0xcc54('0x8')](_0xcc54('0xe3'),require(_0xcc54('0xe4')));_0x5cace5[_0xcc54('0x8')](_0xcc54('0xe5'),require(_0xcc54('0xe6')));_0x5cace5[_0xcc54('0x8')](_0xcc54('0xe7'),require(_0xcc54('0xe8')));_0x5cace5[_0xcc54('0x8')](_0xcc54('0xe9'),require(_0xcc54('0xea')));_0x5cace5['use'](_0xcc54('0xeb'),require(_0xcc54('0xec')));_0x5cace5[_0xcc54('0x8')](_0xcc54('0xed'),require('./api/whatsappAccount'));_0x5cace5[_0xcc54('0x8')](_0xcc54('0xee'),require(_0xcc54('0xef')));_0x5cace5[_0xcc54('0x8')](_0xcc54('0xf0'),require(_0xcc54('0xf1')));_0x5cace5[_0xcc54('0x8')](_0xcc54('0xf2'),require('./api/whatsappMessage'));_0x5cace5[_0xcc54('0x8')](_0xcc54('0xf3'),require('./api/whatsappQueueReport'));_0x5cace5[_0xcc54('0x8')](_0xcc54('0xf4'),require(_0xcc54('0xf5')));_0x5cace5[_0xcc54('0x8')](_0xcc54('0xf6'),require('./api/whatsappQueue'));_0x5cace5['use'](_0xcc54('0xf7'),require(_0xcc54('0xf8')));_0x5cace5[_0xcc54('0x8')](_0xcc54('0xf9'),require(_0xcc54('0xfa')));_0x5cace5[_0xcc54('0x8')](_0xcc54('0xfb'),require(_0xcc54('0xfc')));_0x5cace5[_0xcc54('0x8')](_0xcc54('0xfd'),require(_0xcc54('0xfe')));_0x5cace5[_0xcc54('0x8')]('/api/auth/google',require(_0xcc54('0xff')));_0x5cace5['use'](_0xcc54('0x100'),require('./api/authActiveDirectory'));_0x5cace5[_0xcc54('0x8')]('/api/jira',require(_0xcc54('0x101')));_0x5cace5[_0xcc54('0x8')](_0xcc54('0x102'),require(_0xcc54('0x103')));_0x5cace5[_0xcc54('0x8')](_0xcc54('0x104'),require(_0xcc54('0x105')));_0x5cace5[_0xcc54('0x8')](_0xcc54('0x106'),require('./api/system'));_0x5cace5['use'](_0xcc54('0x107'),require(_0xcc54('0x108')));_0x5cace5[_0xcc54('0x8')](_0xcc54('0x109'),require('./api/webbar'));_0x5cace5['use'](_0xcc54('0x10a'),clientSideLogs);_0x5cace5[_0xcc54('0x8')]('/apidoc',express[_0xcc54('0x10b')](path[_0xcc54('0x10c')](config[_0xcc54('0x10d')],_0xcc54('0x10e'))));_0x5cace5[_0xcc54('0x8')](_0xcc54('0x10f'),express[_0xcc54('0x10b')](path['join'](config['root'],'/www')));_0x5cace5[_0xcc54('0x8')](_0xcc54('0x110'),express[_0xcc54('0x10b')](path[_0xcc54('0x10c')](config[_0xcc54('0x10d')],'/demo')));_0x5cace5[_0xcc54('0x8')]('/snippet',express['static'](path[_0xcc54('0x10c')](config['root'],_0xcc54('0x111'),_0xcc54('0x112'))));_0x5cace5[_0xcc54('0x8')]('/plugins',express[_0xcc54('0x10b')](path[_0xcc54('0x10c')](config[_0xcc54('0x10d')],_0xcc54('0x113'))));_0x5cace5[_0xcc54('0x114')](_0xcc54('0x115'))[_0xcc54('0x116')](errors[0x194]);_0x5cace5[_0xcc54('0x114')]('/*')[_0xcc54('0x116')](function(_0x4e96c1,_0x1c6c29){_0x1c6c29['sendFile'](path[_0xcc54('0x117')](_0x5cace5[_0xcc54('0x116')](_0xcc54('0x118'))+_0xcc54('0x119')));});return _0x5cace5;});}; \ No newline at end of file +var _0x7ac8=['./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','./api/cmCompany','/api/cm/contacts','./api/cmContact','/api/cm/hopper','./api/cmHopper','/api/cm/hopper_black','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField','/api/actions','./api/action','/api/automations','/api/canned_answers','./api/cannedAnswer','/api/dispositions','./api/disposition','/api/conditions','./api/condition','/api/intervals','./api/interval','./api/pause','/api/cdr','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','/api/sounds','./api/sound','/api/tags','./api/tag','/api/contact_item_types','./api/contactItemType','./api/cmContactHasItem','/api/cm_hopper_additional_phones','/api/triggers','./api/trigger','/api/variables','/api/integrations','./api/integration','/api/integrations/reports','./api/integrationReport','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','./api/intSugarcrmConfiguration','./api/intSugarcrmField','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/desk/fields','/api/integrations/zoho/accounts','/api/integrations/zoho/configurations','/api/integrations/zoho/fields','./api/intZohoField','./api/intZendeskAccount','/api/integrations/zendesk/configurations','/api/integrations/zendesk/fields','./api/intZendeskField','./api/intFreshdeskAccount','./api/intFreshdeskField','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','./api/intVtigerField','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/dynamics365/accounts','./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/network','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','/api/jscripty/sessions/reports','./api/jscriptySessionReport','./api/smsQueueReport','/api/square/reports','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','./api/jscriptyProject','/api/settings','./api/squareOdbc','/api/square/projects','/api/square/recordings','./api/squareRecording','/api/square/messages','./api/squareMessage','/api/teams','./api/license','/api/campaigns','./api/campaign','/api/migrations','./api/attachment','/api/mail/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','/api/cm/lists','./api/cmList','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfile','/api/userProfile/sections','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','/api/whatsapp/accounts','./api/whatsappAccount','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappInteraction','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','./api/cloudProvider','/api/realtime','./api/realtime','/api/user-settings','/api/auth/local','/api/auth/activedirectory','/api/jira','./api/jira','/api/rpc','./api/rpc','/api/version','./api/version','/api/system','./api/system','/api/pm2','./api/pm2','/api/webbar','/api/logs','/apidoc','join','root','/www','static','/demo','/snippet','3.2.0','/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','resolve','appPath','/index.html','path','./errors','./config/environment','./utils/client-side-logger','setupLoggers','./api/client-side-logs','default','then','./api/user','use','./api/voiceChanSpy','./api/voiceContext','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','/api/screen/recordings','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','./api/voiceQueueReport','/api/members/reports','./api/memberReport','/api/trunks','./api/trunk','./api/voiceTransferReport','./api/mailServerOut','/api/mail/accounts','./api/mailAccount','/api/mail/queues','/api/mail/substatuses','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','./api/mailMessage','/api/mail/applications','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','./api/dashboardItem','/api/fax/accounts','/api/fax/applications','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','./api/faxMessage','/api/fax/queues','./api/faxQueueReport','./api/smsAccount','/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/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage'];(function(_0x3e8202,_0x4bf8f7){var _0x4b383e=function(_0x5687d8){while(--_0x5687d8){_0x3e8202['push'](_0x3e8202['shift']());}};_0x4b383e(++_0x4bf8f7);}(_0x7ac8,0xc2));var _0x87ac=function(_0x277ded,_0x830a66){_0x277ded=_0x277ded-0x0;var _0xf3081b=_0x7ac8[_0x277ded];return _0xf3081b;};'use strict';var path=require(_0x87ac('0x0'));var express=require('express');var errors=require(_0x87ac('0x1'));var config=require(_0x87ac('0x2'));var setupLoggers=require(_0x87ac('0x3'))[_0x87ac('0x4')];var clientSideLogs=require(_0x87ac('0x5'));exports[_0x87ac('0x6')]=function(_0xbdcbcf){return setupLoggers(_0xbdcbcf)[_0x87ac('0x7')](function(){_0xbdcbcf['use']('/api/users',require(_0x87ac('0x8')));_0xbdcbcf[_0x87ac('0x9')]('/api/voice/chanspy',require(_0x87ac('0xa')));_0xbdcbcf[_0x87ac('0x9')]('/api/voice/contexts',require(_0x87ac('0xb')));_0xbdcbcf['use']('/api/voice/extensions',require(_0x87ac('0xc')));_0xbdcbcf['use'](_0x87ac('0xd'),require(_0x87ac('0xe')));_0xbdcbcf[_0x87ac('0x9')](_0x87ac('0xf'),require(_0x87ac('0x10')));_0xbdcbcf[_0x87ac('0x9')](_0x87ac('0x11'),require('./api/voiceRecording'));_0xbdcbcf['use'](_0x87ac('0x12'),require('./api/screenRecording'));_0xbdcbcf[_0x87ac('0x9')](_0x87ac('0x13'),require(_0x87ac('0x14')));_0xbdcbcf[_0x87ac('0x9')](_0x87ac('0x15'),require(_0x87ac('0x16')));_0xbdcbcf['use']('/api/voice/calls/reports',require(_0x87ac('0x17')));_0xbdcbcf[_0x87ac('0x9')](_0x87ac('0x18'),require(_0x87ac('0x19')));_0xbdcbcf[_0x87ac('0x9')](_0x87ac('0x1a'),require(_0x87ac('0x1b')));_0xbdcbcf[_0x87ac('0x9')]('/api/voice/queues/reports',require(_0x87ac('0x1c')));_0xbdcbcf[_0x87ac('0x9')](_0x87ac('0x1d'),require(_0x87ac('0x1e')));_0xbdcbcf['use'](_0x87ac('0x1f'),require(_0x87ac('0x20')));_0xbdcbcf[_0x87ac('0x9')]('/api/voice/transfers/reports',require(_0x87ac('0x21')));_0xbdcbcf[_0x87ac('0x9')]('/api/mail/out_servers',require(_0x87ac('0x22')));_0xbdcbcf[_0x87ac('0x9')](_0x87ac('0x23'),require(_0x87ac('0x24')));_0xbdcbcf[_0x87ac('0x9')](_0x87ac('0x25'),require('./api/mailQueue'));_0xbdcbcf[_0x87ac('0x9')](_0x87ac('0x26'),require('./api/mailSubstatus'));_0xbdcbcf[_0x87ac('0x9')](_0x87ac('0x27'),require(_0x87ac('0x28')));_0xbdcbcf[_0x87ac('0x9')](_0x87ac('0x29'),require(_0x87ac('0x2a')));_0xbdcbcf[_0x87ac('0x9')](_0x87ac('0x2b'),require('./api/mailApplication'));_0xbdcbcf['use'](_0x87ac('0x2c'),require(_0x87ac('0x2d')));_0xbdcbcf['use'](_0x87ac('0x2e'),require('./api/dashboard'));_0xbdcbcf[_0x87ac('0x9')]('/api/dashboards/items',require(_0x87ac('0x2f')));_0xbdcbcf[_0x87ac('0x9')](_0x87ac('0x30'),require('./api/faxAccount'));_0xbdcbcf['use'](_0x87ac('0x31'),require(_0x87ac('0x32')));_0xbdcbcf[_0x87ac('0x9')](_0x87ac('0x33'),require(_0x87ac('0x34')));_0xbdcbcf['use'](_0x87ac('0x35'),require(_0x87ac('0x36')));_0xbdcbcf[_0x87ac('0x9')](_0x87ac('0x37'),require('./api/faxQueue'));_0xbdcbcf['use']('/api/fax/reports/queue',require(_0x87ac('0x38')));_0xbdcbcf[_0x87ac('0x9')]('/api/sms/accounts',require(_0x87ac('0x39')));_0xbdcbcf[_0x87ac('0x9')](_0x87ac('0x3a'),require(_0x87ac('0x3b')));_0xbdcbcf[_0x87ac('0x9')](_0x87ac('0x3c'),require(_0x87ac('0x3d')));_0xbdcbcf[_0x87ac('0x9')](_0x87ac('0x3e'),require(_0x87ac('0x3f')));_0xbdcbcf[_0x87ac('0x9')](_0x87ac('0x40'),require(_0x87ac('0x41')));_0xbdcbcf[_0x87ac('0x9')](_0x87ac('0x42'),require(_0x87ac('0x43')));_0xbdcbcf[_0x87ac('0x9')](_0x87ac('0x44'),require(_0x87ac('0x45')));_0xbdcbcf['use'](_0x87ac('0x46'),require(_0x87ac('0x47')));_0xbdcbcf[_0x87ac('0x9')](_0x87ac('0x48'),require(_0x87ac('0x49')));_0xbdcbcf['use']('/api/openchannel/queues',require(_0x87ac('0x4a')));_0xbdcbcf['use'](_0x87ac('0x4b'),require(_0x87ac('0x4c')));_0xbdcbcf[_0x87ac('0x9')](_0x87ac('0x4d'),require(_0x87ac('0x4e')));_0xbdcbcf['use'](_0x87ac('0x4f'),require('./api/chatApplication'));_0xbdcbcf[_0x87ac('0x9')](_0x87ac('0x50'),require(_0x87ac('0x51')));_0xbdcbcf[_0x87ac('0x9')](_0x87ac('0x52'),require(_0x87ac('0x53')));_0xbdcbcf[_0x87ac('0x9')](_0x87ac('0x54'),require(_0x87ac('0x55')));_0xbdcbcf['use']('/api/chat/queues',require('./api/chatQueue'));_0xbdcbcf[_0x87ac('0x9')]('/api/chat/groups',require(_0x87ac('0x56')));_0xbdcbcf[_0x87ac('0x9')](_0x87ac('0x57'),require(_0x87ac('0x58')));_0xbdcbcf['use']('/api/cm/companies',require(_0x87ac('0x59')));_0xbdcbcf[_0x87ac('0x9')](_0x87ac('0x5a'),require(_0x87ac('0x5b')));_0xbdcbcf[_0x87ac('0x9')](_0x87ac('0x5c'),require(_0x87ac('0x5d')));_0xbdcbcf[_0x87ac('0x9')](_0x87ac('0x5e'),require('./api/cmHopperBlack'));_0xbdcbcf[_0x87ac('0x9')]('/api/cm/hopper_final',require('./api/cmHopperFinal'));_0xbdcbcf[_0x87ac('0x9')](_0x87ac('0x5f'),require(_0x87ac('0x60')));_0xbdcbcf[_0x87ac('0x9')](_0x87ac('0x61'),require(_0x87ac('0x62')));_0xbdcbcf[_0x87ac('0x9')](_0x87ac('0x63'),require(_0x87ac('0x64')));_0xbdcbcf[_0x87ac('0x9')](_0x87ac('0x65'),require('./api/automation'));_0xbdcbcf[_0x87ac('0x9')](_0x87ac('0x66'),require(_0x87ac('0x67')));_0xbdcbcf[_0x87ac('0x9')](_0x87ac('0x68'),require(_0x87ac('0x69')));_0xbdcbcf['use'](_0x87ac('0x6a'),require(_0x87ac('0x6b')));_0xbdcbcf[_0x87ac('0x9')](_0x87ac('0x6c'),require(_0x87ac('0x6d')));_0xbdcbcf[_0x87ac('0x9')]('/api/pauses',require(_0x87ac('0x6e')));_0xbdcbcf['use'](_0x87ac('0x6f'),require(_0x87ac('0x70')));_0xbdcbcf[_0x87ac('0x9')](_0x87ac('0x71'),require(_0x87ac('0x72')));_0xbdcbcf[_0x87ac('0x9')](_0x87ac('0x73'),require('./api/schedule'));_0xbdcbcf['use'](_0x87ac('0x74'),require(_0x87ac('0x75')));_0xbdcbcf['use'](_0x87ac('0x76'),require(_0x87ac('0x77')));_0xbdcbcf[_0x87ac('0x9')](_0x87ac('0x78'),require(_0x87ac('0x79')));_0xbdcbcf[_0x87ac('0x9')]('/api/cm_contact_has_items',require(_0x87ac('0x7a')));_0xbdcbcf[_0x87ac('0x9')](_0x87ac('0x7b'),require('./api/cmHopperAdditionalPhone'));_0xbdcbcf[_0x87ac('0x9')]('/api/templates',require('./api/template'));_0xbdcbcf[_0x87ac('0x9')](_0x87ac('0x7c'),require(_0x87ac('0x7d')));_0xbdcbcf['use'](_0x87ac('0x7e'),require('./api/variable'));_0xbdcbcf[_0x87ac('0x9')](_0x87ac('0x7f'),require(_0x87ac('0x80')));_0xbdcbcf['use'](_0x87ac('0x81'),require(_0x87ac('0x82')));_0xbdcbcf[_0x87ac('0x9')]('/api/analytics/custom_reports',require(_0x87ac('0x83')));_0xbdcbcf[_0x87ac('0x9')](_0x87ac('0x84'),require(_0x87ac('0x85')));_0xbdcbcf[_0x87ac('0x9')]('/api/analytics/extracted_reports',require(_0x87ac('0x86')));_0xbdcbcf['use'](_0x87ac('0x87'),require(_0x87ac('0x88')));_0xbdcbcf[_0x87ac('0x9')](_0x87ac('0x89'),require('./api/analyticFieldReport'));_0xbdcbcf['use'](_0x87ac('0x8a'),require(_0x87ac('0x8b')));_0xbdcbcf[_0x87ac('0x9')](_0x87ac('0x8c'),require(_0x87ac('0x8d')));_0xbdcbcf['use'](_0x87ac('0x8e'),require(_0x87ac('0x8f')));_0xbdcbcf[_0x87ac('0x9')](_0x87ac('0x90'),require('./api/intSalesforceField'));_0xbdcbcf[_0x87ac('0x9')](_0x87ac('0x91'),require(_0x87ac('0x92')));_0xbdcbcf[_0x87ac('0x9')]('/api/integrations/sugarcrm/configurations',require(_0x87ac('0x93')));_0xbdcbcf[_0x87ac('0x9')]('/api/integrations/sugarcrm/fields',require(_0x87ac('0x94')));_0xbdcbcf[_0x87ac('0x9')]('/api/integrations/desk/accounts',require(_0x87ac('0x95')));_0xbdcbcf[_0x87ac('0x9')](_0x87ac('0x96'),require(_0x87ac('0x97')));_0xbdcbcf[_0x87ac('0x9')](_0x87ac('0x98'),require('./api/intDeskField'));_0xbdcbcf[_0x87ac('0x9')](_0x87ac('0x99'),require('./api/intZohoAccount'));_0xbdcbcf[_0x87ac('0x9')](_0x87ac('0x9a'),require('./api/intZohoConfiguration'));_0xbdcbcf['use'](_0x87ac('0x9b'),require(_0x87ac('0x9c')));_0xbdcbcf[_0x87ac('0x9')]('/api/integrations/zendesk/accounts',require(_0x87ac('0x9d')));_0xbdcbcf['use'](_0x87ac('0x9e'),require('./api/intZendeskConfiguration'));_0xbdcbcf[_0x87ac('0x9')](_0x87ac('0x9f'),require(_0x87ac('0xa0')));_0xbdcbcf[_0x87ac('0x9')]('/api/integrations/freshdesk/accounts',require(_0x87ac('0xa1')));_0xbdcbcf[_0x87ac('0x9')]('/api/integrations/freshdesk/configurations',require('./api/intFreshdeskConfiguration'));_0xbdcbcf['use']('/api/integrations/freshdesk/fields',require(_0x87ac('0xa2')));_0xbdcbcf[_0x87ac('0x9')]('/api/integrations/vtiger/accounts',require(_0x87ac('0xa3')));_0xbdcbcf['use'](_0x87ac('0xa4'),require(_0x87ac('0xa5')));_0xbdcbcf[_0x87ac('0x9')]('/api/integrations/vtiger/fields',require(_0x87ac('0xa6')));_0xbdcbcf[_0x87ac('0x9')]('/api/integrations/servicenow/accounts',require(_0x87ac('0xa7')));_0xbdcbcf[_0x87ac('0x9')](_0x87ac('0xa8'),require(_0x87ac('0xa9')));_0xbdcbcf[_0x87ac('0x9')]('/api/integrations/servicenow/fields',require('./api/intServicenowField'));_0xbdcbcf['use'](_0x87ac('0xaa'),require('./api/intDynamics365Account'));_0xbdcbcf[_0x87ac('0x9')]('/api/integrations/dynamics365/configurations',require(_0x87ac('0xab')));_0xbdcbcf[_0x87ac('0x9')](_0x87ac('0xac'),require(_0x87ac('0xad')));_0xbdcbcf[_0x87ac('0x9')](_0x87ac('0xae'),require(_0x87ac('0xaf')));_0xbdcbcf[_0x87ac('0x9')](_0x87ac('0xb0'),require(_0x87ac('0xb1')));_0xbdcbcf[_0x87ac('0x9')](_0x87ac('0xb2'),require('./api/intFreshsalesField'));_0xbdcbcf[_0x87ac('0x9')](_0x87ac('0xb3'),require(_0x87ac('0xb4')));_0xbdcbcf[_0x87ac('0x9')](_0x87ac('0xb5'),require(_0x87ac('0xb6')));_0xbdcbcf['use'](_0x87ac('0xb7'),require(_0x87ac('0xb8')));_0xbdcbcf[_0x87ac('0x9')]('/api/jscripty/answers/reports',require(_0x87ac('0xb9')));_0xbdcbcf['use'](_0x87ac('0xba'),require('./api/jscriptyQuestionReport'));_0xbdcbcf[_0x87ac('0x9')](_0x87ac('0xbb'),require(_0x87ac('0xbc')));_0xbdcbcf[_0x87ac('0x9')]('/api/sms/reports/queue',require(_0x87ac('0xbd')));_0xbdcbcf[_0x87ac('0x9')](_0x87ac('0xbe'),require(_0x87ac('0xbf')));_0xbdcbcf[_0x87ac('0x9')](_0x87ac('0xc0'),require(_0x87ac('0xc1')));_0xbdcbcf[_0x87ac('0x9')]('/api/jscripty/projects',require(_0x87ac('0xc2')));_0xbdcbcf[_0x87ac('0x9')](_0x87ac('0xc3'),require('./api/setting'));_0xbdcbcf[_0x87ac('0x9')]('/api/square/odbc',require(_0x87ac('0xc4')));_0xbdcbcf[_0x87ac('0x9')](_0x87ac('0xc5'),require('./api/squareProject'));_0xbdcbcf[_0x87ac('0x9')](_0x87ac('0xc6'),require(_0x87ac('0xc7')));_0xbdcbcf[_0x87ac('0x9')](_0x87ac('0xc8'),require(_0x87ac('0xc9')));_0xbdcbcf[_0x87ac('0x9')](_0x87ac('0xca'),require('./api/team'));_0xbdcbcf[_0x87ac('0x9')]('/api/license',require(_0x87ac('0xcb')));_0xbdcbcf[_0x87ac('0x9')](_0x87ac('0xcc'),require(_0x87ac('0xcd')));_0xbdcbcf['use'](_0x87ac('0xce'),require('./api/migration'));_0xbdcbcf['use']('/api/attachments',require(_0x87ac('0xcf')));_0xbdcbcf['use']('/api/plugins',require('./api/plugin'));_0xbdcbcf['use'](_0x87ac('0xd0'),require('./api/mailTransferReport'));_0xbdcbcf[_0x87ac('0x9')]('/api/chat/reports/transfer',require(_0x87ac('0xd1')));_0xbdcbcf[_0x87ac('0x9')](_0x87ac('0xd2'),require('./api/faxTransferReport'));_0xbdcbcf[_0x87ac('0x9')](_0x87ac('0xd3'),require(_0x87ac('0xd4')));_0xbdcbcf[_0x87ac('0x9')](_0x87ac('0xd5'),require('./api/smsTransferReport'));_0xbdcbcf['use'](_0x87ac('0xd6'),require(_0x87ac('0xd7')));_0xbdcbcf[_0x87ac('0x9')](_0x87ac('0xd8'),require(_0x87ac('0xd9')));_0xbdcbcf[_0x87ac('0x9')](_0x87ac('0xda'),require(_0x87ac('0xdb')));_0xbdcbcf[_0x87ac('0x9')](_0x87ac('0xdc'),require('./api/userProfileSection'));_0xbdcbcf[_0x87ac('0x9')](_0x87ac('0xdd'),require(_0x87ac('0xde')));_0xbdcbcf[_0x87ac('0x9')](_0x87ac('0xdf'),require('./api/userNotification'));_0xbdcbcf[_0x87ac('0x9')](_0x87ac('0xe0'),require(_0x87ac('0xe1')));_0xbdcbcf[_0x87ac('0x9')]('/api/whatsapp/applications',require(_0x87ac('0xe2')));_0xbdcbcf[_0x87ac('0x9')](_0x87ac('0xe3'),require(_0x87ac('0xe4')));_0xbdcbcf['use']('/api/whatsapp/messages',require(_0x87ac('0xe5')));_0xbdcbcf[_0x87ac('0x9')](_0x87ac('0xe6'),require(_0x87ac('0xe7')));_0xbdcbcf[_0x87ac('0x9')]('/api/whatsapp/reports/transfer',require(_0x87ac('0xe8')));_0xbdcbcf[_0x87ac('0x9')](_0x87ac('0xe9'),require(_0x87ac('0xea')));_0xbdcbcf[_0x87ac('0x9')]('/api/cloudProviders',require(_0x87ac('0xeb')));_0xbdcbcf[_0x87ac('0x9')](_0x87ac('0xec'),require(_0x87ac('0xed')));_0xbdcbcf[_0x87ac('0x9')](_0x87ac('0xee'),require('./api/user-setting'));_0xbdcbcf[_0x87ac('0x9')](_0x87ac('0xef'),require('./api/authLocal'));_0xbdcbcf[_0x87ac('0x9')]('/api/auth/google',require('./api/authGoogle'));_0xbdcbcf[_0x87ac('0x9')](_0x87ac('0xf0'),require('./api/authActiveDirectory'));_0xbdcbcf[_0x87ac('0x9')](_0x87ac('0xf1'),require(_0x87ac('0xf2')));_0xbdcbcf[_0x87ac('0x9')](_0x87ac('0xf3'),require(_0x87ac('0xf4')));_0xbdcbcf['use'](_0x87ac('0xf5'),require(_0x87ac('0xf6')));_0xbdcbcf[_0x87ac('0x9')](_0x87ac('0xf7'),require(_0x87ac('0xf8')));_0xbdcbcf[_0x87ac('0x9')](_0x87ac('0xf9'),require(_0x87ac('0xfa')));_0xbdcbcf[_0x87ac('0x9')](_0x87ac('0xfb'),require('./api/webbar'));_0xbdcbcf[_0x87ac('0x9')](_0x87ac('0xfc'),clientSideLogs);_0xbdcbcf[_0x87ac('0x9')](_0x87ac('0xfd'),express['static'](path[_0x87ac('0xfe')](config[_0x87ac('0xff')],_0x87ac('0xfd'))));_0xbdcbcf[_0x87ac('0x9')](_0x87ac('0x100'),express[_0x87ac('0x101')](path[_0x87ac('0xfe')](config[_0x87ac('0xff')],_0x87ac('0x100'))));_0xbdcbcf['use'](_0x87ac('0x102'),express[_0x87ac('0x101')](path['join'](config['root'],_0x87ac('0x102'))));_0xbdcbcf[_0x87ac('0x9')](_0x87ac('0x103'),express[_0x87ac('0x101')](path[_0x87ac('0xfe')](config[_0x87ac('0xff')],'snippet',_0x87ac('0x104'))));_0xbdcbcf[_0x87ac('0x9')](_0x87ac('0x105'),express[_0x87ac('0x101')](path[_0x87ac('0xfe')](config[_0x87ac('0xff')],'/server/files/plugins')));_0xbdcbcf[_0x87ac('0x106')](_0x87ac('0x107'))[_0x87ac('0x108')](errors[0x194]);_0xbdcbcf[_0x87ac('0x106')]('/*')[_0x87ac('0x108')](function(_0x3a22f5,_0x4e2e1f){_0x4e2e1f['sendFile'](path[_0x87ac('0x109')](_0xbdcbcf['get'](_0x87ac('0x10a'))+_0x87ac('0x10b')));});return _0xbdcbcf;});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index bb89a40..35af846 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6b13=['../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/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.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/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','server','http','rpc','port','localhost','error','log','../config/triggers','default','RPC\x20listening\x20on\x20','lodash','../config/environment','listen','merge','../api/user/user.rpc'];(function(_0x58712a,_0x1d88a9){var _0x342032=function(_0x5365f0){while(--_0x5365f0){_0x58712a['push'](_0x58712a['shift']());}};_0x342032(++_0x1d88a9);}(_0x6b13,0xd0));var _0x36b1=function(_0x4851ff,_0x1c9a8d){_0x4851ff=_0x4851ff-0x0;var _0x26773b=_0x6b13[_0x4851ff];return _0x26773b;};'use strict';var jayson=require('jayson/promise');var _=require(_0x36b1('0x0'));var config=require(_0x36b1('0x1'));exports[_0x36b1('0x2')]=function(){return new Promise(function(_0x51791d,_0x463d07){var _0x420365={};_0x420365=_[_0x36b1('0x3')](_0x420365,require(_0x36b1('0x4')));_0x420365=_[_0x36b1('0x3')](_0x420365,require('../api/voiceExtension/voiceExtension.rpc'));_0x420365=_[_0x36b1('0x3')](_0x420365,require(_0x36b1('0x5')));_0x420365=_[_0x36b1('0x3')](_0x420365,require(_0x36b1('0x6')));_0x420365=_[_0x36b1('0x3')](_0x420365,require(_0x36b1('0x7')));_0x420365=_['merge'](_0x420365,require(_0x36b1('0x8')));_0x420365=_[_0x36b1('0x3')](_0x420365,require(_0x36b1('0x9')));_0x420365=_['merge'](_0x420365,require(_0x36b1('0xa')));_0x420365=_[_0x36b1('0x3')](_0x420365,require(_0x36b1('0xb')));_0x420365=_[_0x36b1('0x3')](_0x420365,require(_0x36b1('0xc')));_0x420365=_[_0x36b1('0x3')](_0x420365,require(_0x36b1('0xd')));_0x420365=_['merge'](_0x420365,require(_0x36b1('0xe')));_0x420365=_[_0x36b1('0x3')](_0x420365,require('../api/mailServerIn/mailServerIn.rpc'));_0x420365=_['merge'](_0x420365,require(_0x36b1('0xf')));_0x420365=_[_0x36b1('0x3')](_0x420365,require(_0x36b1('0x10')));_0x420365=_['merge'](_0x420365,require(_0x36b1('0x11')));_0x420365=_[_0x36b1('0x3')](_0x420365,require('../api/mailMessage/mailMessage.rpc'));_0x420365=_['merge'](_0x420365,require('../api/mailApplication/mailApplication.rpc'));_0x420365=_['merge'](_0x420365,require(_0x36b1('0x12')));_0x420365=_[_0x36b1('0x3')](_0x420365,require(_0x36b1('0x13')));_0x420365=_[_0x36b1('0x3')](_0x420365,require(_0x36b1('0x14')));_0x420365=_[_0x36b1('0x3')](_0x420365,require('../api/faxInteraction/faxInteraction.rpc'));_0x420365=_[_0x36b1('0x3')](_0x420365,require('../api/faxMessage/faxMessage.rpc'));_0x420365=_[_0x36b1('0x3')](_0x420365,require(_0x36b1('0x15')));_0x420365=_['merge'](_0x420365,require(_0x36b1('0x16')));_0x420365=_['merge'](_0x420365,require(_0x36b1('0x17')));_0x420365=_['merge'](_0x420365,require(_0x36b1('0x18')));_0x420365=_['merge'](_0x420365,require(_0x36b1('0x19')));_0x420365=_[_0x36b1('0x3')](_0x420365,require('../api/smsQueue/smsQueue.rpc'));_0x420365=_[_0x36b1('0x3')](_0x420365,require(_0x36b1('0x1a')));_0x420365=_['merge'](_0x420365,require(_0x36b1('0x1b')));_0x420365=_[_0x36b1('0x3')](_0x420365,require(_0x36b1('0x1c')));_0x420365=_[_0x36b1('0x3')](_0x420365,require(_0x36b1('0x1d')));_0x420365=_[_0x36b1('0x3')](_0x420365,require(_0x36b1('0x1e')));_0x420365=_[_0x36b1('0x3')](_0x420365,require('../api/chatInteraction/chatInteraction.rpc'));_0x420365=_[_0x36b1('0x3')](_0x420365,require(_0x36b1('0x1f')));_0x420365=_[_0x36b1('0x3')](_0x420365,require(_0x36b1('0x20')));_0x420365=_[_0x36b1('0x3')](_0x420365,require(_0x36b1('0x21')));_0x420365=_[_0x36b1('0x3')](_0x420365,require(_0x36b1('0x22')));_0x420365=_['merge'](_0x420365,require(_0x36b1('0x23')));_0x420365=_[_0x36b1('0x3')](_0x420365,require('../api/cmHopperFinal/cmHopperFinal.rpc'));_0x420365=_[_0x36b1('0x3')](_0x420365,require('../api/cmHopperHistory/cmHopperHistory.rpc'));_0x420365=_['merge'](_0x420365,require(_0x36b1('0x24')));_0x420365=_[_0x36b1('0x3')](_0x420365,require(_0x36b1('0x25')));_0x420365=_[_0x36b1('0x3')](_0x420365,require(_0x36b1('0x26')));_0x420365=_['merge'](_0x420365,require(_0x36b1('0x27')));_0x420365=_[_0x36b1('0x3')](_0x420365,require(_0x36b1('0x28')));_0x420365=_['merge'](_0x420365,require(_0x36b1('0x29')));_0x420365=_[_0x36b1('0x3')](_0x420365,require(_0x36b1('0x2a')));_0x420365=_[_0x36b1('0x3')](_0x420365,require(_0x36b1('0x2b')));_0x420365=_[_0x36b1('0x3')](_0x420365,require('../api/intSalesforceAccount/intSalesforceAccount.rpc'));_0x420365=_[_0x36b1('0x3')](_0x420365,require(_0x36b1('0x2c')));_0x420365=_[_0x36b1('0x3')](_0x420365,require(_0x36b1('0x2d')));_0x420365=_[_0x36b1('0x3')](_0x420365,require('../api/intZohoAccount/intZohoAccount.rpc'));_0x420365=_[_0x36b1('0x3')](_0x420365,require(_0x36b1('0x2e')));_0x420365=_[_0x36b1('0x3')](_0x420365,require(_0x36b1('0x2f')));_0x420365=_[_0x36b1('0x3')](_0x420365,require('../api/intVtigerAccount/intVtigerAccount.rpc'));_0x420365=_[_0x36b1('0x3')](_0x420365,require('../api/intServicenowAccount/intServicenowAccount.rpc'));_0x420365=_[_0x36b1('0x3')](_0x420365,require(_0x36b1('0x30')));_0x420365=_[_0x36b1('0x3')](_0x420365,require(_0x36b1('0x31')));_0x420365=_[_0x36b1('0x3')](_0x420365,require(_0x36b1('0x32')));_0x420365=_[_0x36b1('0x3')](_0x420365,require('../api/smsQueueReport/smsQueueReport.rpc'));_0x420365=_[_0x36b1('0x3')](_0x420365,require(_0x36b1('0x33')));_0x420365=_[_0x36b1('0x3')](_0x420365,require('../api/squareReportDetail/squareReportDetail.rpc'));_0x420365=_[_0x36b1('0x3')](_0x420365,require('../api/setting/setting.rpc'));_0x420365=_[_0x36b1('0x3')](_0x420365,require(_0x36b1('0x34')));_0x420365=_[_0x36b1('0x3')](_0x420365,require(_0x36b1('0x35')));_0x420365=_['merge'](_0x420365,require(_0x36b1('0x36')));_0x420365=_[_0x36b1('0x3')](_0x420365,require(_0x36b1('0x37')));_0x420365=_[_0x36b1('0x3')](_0x420365,require('../api/campaign/campaign.rpc'));_0x420365=_[_0x36b1('0x3')](_0x420365,require('../api/attachment/attachment.rpc'));_0x420365=_[_0x36b1('0x3')](_0x420365,require(_0x36b1('0x38')));_0x420365=_[_0x36b1('0x3')](_0x420365,require(_0x36b1('0x39')));_0x420365=_[_0x36b1('0x3')](_0x420365,require(_0x36b1('0x3a')));_0x420365=_[_0x36b1('0x3')](_0x420365,require(_0x36b1('0x3b')));_0x420365=_[_0x36b1('0x3')](_0x420365,require(_0x36b1('0x3c')));_0x420365=_[_0x36b1('0x3')](_0x420365,require('../api/whatsappQueue/whatsappQueue.rpc'));var _0xeee48a=jayson[_0x36b1('0x3d')](_0x420365)[_0x36b1('0x3e')]();var _0x1342a0=config[_0x36b1('0x3f')][_0x36b1('0x40')]||config[_0x36b1('0x40')]+0x1;var _0x56cea4=config[_0x36b1('0x3f')]['ip']||_0x36b1('0x41');_0xeee48a['on'](_0x36b1('0x42'),function(_0x271397){return _0x463d07(_0x271397);});_0xeee48a[_0x36b1('0x2')](_0x1342a0,_0x56cea4,function(){console[_0x36b1('0x43')]('Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!',_0x56cea4,_0x1342a0);require(_0x36b1('0x44'))[_0x36b1('0x45')]();return _0x51791d(_0x36b1('0x46')+_0x56cea4+':'+_0x1342a0);});});}; \ No newline at end of file +var _0x23c0=['../api/pause/pause.rpc','../api/sound/sound.rpc','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc','../api/template/template.rpc','../api/trigger/trigger.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','../api/squareOdbc/squareOdbc.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/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','http','rpc','port','localhost','error','listen','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','RPC\x20listening\x20on\x20','jayson/promise','lodash','../config/environment','merge','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc'];(function(_0x496738,_0x3f1a9f){var _0xee1381=function(_0x4dc50c){while(--_0x4dc50c){_0x496738['push'](_0x496738['shift']());}};_0xee1381(++_0x3f1a9f);}(_0x23c0,0x153));var _0x023c=function(_0x64b31d,_0x393b36){_0x64b31d=_0x64b31d-0x0;var _0x42c45b=_0x23c0[_0x64b31d];return _0x42c45b;};'use strict';var jayson=require(_0x023c('0x0'));var _=require(_0x023c('0x1'));var config=require(_0x023c('0x2'));exports['listen']=function(){return new Promise(function(_0x48710e,_0x9f20a7){var _0x54214d={};_0x54214d=_[_0x023c('0x3')](_0x54214d,require(_0x023c('0x4')));_0x54214d=_['merge'](_0x54214d,require(_0x023c('0x5')));_0x54214d=_[_0x023c('0x3')](_0x54214d,require(_0x023c('0x6')));_0x54214d=_[_0x023c('0x3')](_0x54214d,require('../api/voiceRecording/voiceRecording.rpc'));_0x54214d=_['merge'](_0x54214d,require('../api/voiceCallReport/voiceCallReport.rpc'));_0x54214d=_[_0x023c('0x3')](_0x54214d,require(_0x023c('0x7')));_0x54214d=_[_0x023c('0x3')](_0x54214d,require('../api/voiceAgentReport/voiceAgentReport.rpc'));_0x54214d=_[_0x023c('0x3')](_0x54214d,require(_0x023c('0x8')));_0x54214d=_[_0x023c('0x3')](_0x54214d,require('../api/memberReport/memberReport.rpc'));_0x54214d=_[_0x023c('0x3')](_0x54214d,require(_0x023c('0x9')));_0x54214d=_[_0x023c('0x3')](_0x54214d,require(_0x023c('0xa')));_0x54214d=_[_0x023c('0x3')](_0x54214d,require(_0x023c('0xb')));_0x54214d=_['merge'](_0x54214d,require(_0x023c('0xc')));_0x54214d=_['merge'](_0x54214d,require(_0x023c('0xd')));_0x54214d=_[_0x023c('0x3')](_0x54214d,require(_0x023c('0xe')));_0x54214d=_[_0x023c('0x3')](_0x54214d,require('../api/mailInteraction/mailInteraction.rpc'));_0x54214d=_[_0x023c('0x3')](_0x54214d,require(_0x023c('0xf')));_0x54214d=_[_0x023c('0x3')](_0x54214d,require(_0x023c('0x10')));_0x54214d=_['merge'](_0x54214d,require(_0x023c('0x11')));_0x54214d=_[_0x023c('0x3')](_0x54214d,require(_0x023c('0x12')));_0x54214d=_[_0x023c('0x3')](_0x54214d,require('../api/faxApplication/faxApplication.rpc'));_0x54214d=_[_0x023c('0x3')](_0x54214d,require(_0x023c('0x13')));_0x54214d=_[_0x023c('0x3')](_0x54214d,require(_0x023c('0x14')));_0x54214d=_['merge'](_0x54214d,require(_0x023c('0x15')));_0x54214d=_[_0x023c('0x3')](_0x54214d,require('../api/faxQueueReport/faxQueueReport.rpc'));_0x54214d=_[_0x023c('0x3')](_0x54214d,require('../api/smsAccount/smsAccount.rpc'));_0x54214d=_[_0x023c('0x3')](_0x54214d,require(_0x023c('0x16')));_0x54214d=_[_0x023c('0x3')](_0x54214d,require('../api/smsMessage/smsMessage.rpc'));_0x54214d=_[_0x023c('0x3')](_0x54214d,require(_0x023c('0x17')));_0x54214d=_[_0x023c('0x3')](_0x54214d,require('../api/openchannelApplication/openchannelApplication.rpc'));_0x54214d=_[_0x023c('0x3')](_0x54214d,require(_0x023c('0x18')));_0x54214d=_['merge'](_0x54214d,require(_0x023c('0x19')));_0x54214d=_[_0x023c('0x3')](_0x54214d,require(_0x023c('0x1a')));_0x54214d=_[_0x023c('0x3')](_0x54214d,require(_0x023c('0x1b')));_0x54214d=_[_0x023c('0x3')](_0x54214d,require(_0x023c('0x1c')));_0x54214d=_[_0x023c('0x3')](_0x54214d,require(_0x023c('0x1d')));_0x54214d=_[_0x023c('0x3')](_0x54214d,require(_0x023c('0x1e')));_0x54214d=_[_0x023c('0x3')](_0x54214d,require(_0x023c('0x1f')));_0x54214d=_['merge'](_0x54214d,require(_0x023c('0x20')));_0x54214d=_[_0x023c('0x3')](_0x54214d,require(_0x023c('0x21')));_0x54214d=_[_0x023c('0x3')](_0x54214d,require(_0x023c('0x22')));_0x54214d=_['merge'](_0x54214d,require(_0x023c('0x23')));_0x54214d=_[_0x023c('0x3')](_0x54214d,require('../api/reportAgentPreview/reportAgentPreview.rpc'));_0x54214d=_[_0x023c('0x3')](_0x54214d,require('../api/interval/interval.rpc'));_0x54214d=_[_0x023c('0x3')](_0x54214d,require(_0x023c('0x24')));_0x54214d=_['merge'](_0x54214d,require(_0x023c('0x25')));_0x54214d=_[_0x023c('0x3')](_0x54214d,require(_0x023c('0x26')));_0x54214d=_[_0x023c('0x3')](_0x54214d,require(_0x023c('0x27')));_0x54214d=_[_0x023c('0x3')](_0x54214d,require(_0x023c('0x28')));_0x54214d=_[_0x023c('0x3')](_0x54214d,require('../api/variable/variable.rpc'));_0x54214d=_[_0x023c('0x3')](_0x54214d,require('../api/intSalesforceAccount/intSalesforceAccount.rpc'));_0x54214d=_[_0x023c('0x3')](_0x54214d,require(_0x023c('0x29')));_0x54214d=_[_0x023c('0x3')](_0x54214d,require(_0x023c('0x2a')));_0x54214d=_[_0x023c('0x3')](_0x54214d,require(_0x023c('0x2b')));_0x54214d=_['merge'](_0x54214d,require(_0x023c('0x2c')));_0x54214d=_[_0x023c('0x3')](_0x54214d,require(_0x023c('0x2d')));_0x54214d=_[_0x023c('0x3')](_0x54214d,require('../api/intVtigerAccount/intVtigerAccount.rpc'));_0x54214d=_[_0x023c('0x3')](_0x54214d,require(_0x023c('0x2e')));_0x54214d=_[_0x023c('0x3')](_0x54214d,require(_0x023c('0x2f')));_0x54214d=_[_0x023c('0x3')](_0x54214d,require(_0x023c('0x30')));_0x54214d=_['merge'](_0x54214d,require(_0x023c('0x31')));_0x54214d=_[_0x023c('0x3')](_0x54214d,require(_0x023c('0x32')));_0x54214d=_['merge'](_0x54214d,require(_0x023c('0x33')));_0x54214d=_['merge'](_0x54214d,require(_0x023c('0x34')));_0x54214d=_[_0x023c('0x3')](_0x54214d,require(_0x023c('0x35')));_0x54214d=_[_0x023c('0x3')](_0x54214d,require(_0x023c('0x36')));_0x54214d=_[_0x023c('0x3')](_0x54214d,require('../api/squareProject/squareProject.rpc'));_0x54214d=_[_0x023c('0x3')](_0x54214d,require(_0x023c('0x37')));_0x54214d=_[_0x023c('0x3')](_0x54214d,require(_0x023c('0x38')));_0x54214d=_[_0x023c('0x3')](_0x54214d,require(_0x023c('0x39')));_0x54214d=_[_0x023c('0x3')](_0x54214d,require(_0x023c('0x3a')));_0x54214d=_[_0x023c('0x3')](_0x54214d,require(_0x023c('0x3b')));_0x54214d=_[_0x023c('0x3')](_0x54214d,require(_0x023c('0x3c')));_0x54214d=_[_0x023c('0x3')](_0x54214d,require('../api/whatsappInteraction/whatsappInteraction.rpc'));_0x54214d=_[_0x023c('0x3')](_0x54214d,require(_0x023c('0x3d')));_0x54214d=_[_0x023c('0x3')](_0x54214d,require(_0x023c('0x3e')));_0x54214d=_['merge'](_0x54214d,require(_0x023c('0x3f')));var _0x9f40e1=jayson[_0x023c('0x40')](_0x54214d)[_0x023c('0x41')]();var _0x4dfac0=config[_0x023c('0x42')][_0x023c('0x43')]||config[_0x023c('0x43')]+0x1;var _0x539ec1=config[_0x023c('0x42')]['ip']||_0x023c('0x44');_0x9f40e1['on'](_0x023c('0x45'),function(_0x1c48e6){return _0x9f20a7(_0x1c48e6);});_0x9f40e1[_0x023c('0x46')](_0x4dfac0,_0x539ec1,function(){console[_0x023c('0x47')](_0x023c('0x48'),_0x539ec1,_0x4dfac0);require(_0x023c('0x49'))['default']();return _0x48710e(_0x023c('0x4a')+_0x539ec1+':'+_0x4dfac0);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index a454282..ce97ec3 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 _0x46aa=['error','emit','E_AGI_SOCKET_ERROR','close','E_AGI_SOCKET_CLOSE','timeout','destroy','pipe','command','inherits','prototype','sendRequest','sync','answer','ANSWER','getData','beep','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','VERBOSE\x20\x22%s\x22','exec','EXEC\x20%s\x20%s','setContext','SET\x20CONTEXT\x20%s','setExtension','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','isBoolean','isNumber','SET\x20VARIABLE\x20%s\x20\x22%s\x22','toString','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','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','exports','lodash','EventEmitter','./reply','./error','call','setEncoding','utf8','setTimeout','headers','ready','line','toLowerCase','hangup','substring','search','520\x20End\x20of\x20proper','function','no\x20code','replace','result=','indexOf','substr','startsWith','split','length'];(function(_0x4609a2,_0x3292df){var _0x347de7=function(_0x2d81fc){while(--_0x2d81fc){_0x4609a2['push'](_0x4609a2['shift']());}};_0x347de7(++_0x3292df);}(_0x46aa,0xcb));var _0xa46a=function(_0x11c573,_0x9e7c6e){_0x11c573=_0x11c573-0x0;var _0x6b72de=_0x46aa[_0x11c573];return _0x6b72de;};'use strict';var util=require('util');var _=require(_0xa46a('0x0'));var EventEmitter=require('events')[_0xa46a('0x1')];var AGIReply=require(_0xa46a('0x2'));var AGIError=require(_0xa46a('0x3'));function AGIChannel(_0x1ec29a){var _0x43f37c=this,_0x2c622e=new AGIReply(),_0x904ab4=![],_0x2e3ab3={};EventEmitter[_0xa46a('0x4')](_0x43f37c);_0x1ec29a[_0xa46a('0x5')](_0xa46a('0x6'));_0x1ec29a[_0xa46a('0x7')](0x8*0x3c*0x3c*0x3e8);_0x2c622e['setEncoding'](_0xa46a('0x6'));_0x2c622e['on'](_0xa46a('0x8'),function(_0x4f2bbf){for(var _0x814320 in _0x4f2bbf){_0x43f37c[_0x814320]=_0x4f2bbf[_0x814320];}_0x43f37c['emit'](_0xa46a('0x9'));});_0x2c622e['on'](_0xa46a('0xa'),function(_0x41f491){if(_0x41f491[_0xa46a('0xb')]()==_0xa46a('0xc')){_0x43f37c['emit'](_0xa46a('0xc'));return;}if(_0x41f491[_0xa46a('0xd')](0x0,0xb)=='520-Invalid'){_0x904ab4=!![];}if(_0x904ab4){_0x2e3ab3['rx']+=_0x41f491+'\x0a';if(_0x41f491[_0xa46a('0xe')](_0xa46a('0xf'))!=-0x1){_0x904ab4=![];}}else{_0x2e3ab3['rx']=_0x41f491;}if(_0x904ab4){return;}if(typeof _0x2e3ab3['cb']==_0xa46a('0x10')){var _0x3f9fe1=_0x2e3ab3['rx'][_0xa46a('0xd')](0x0,0x3),_0x2720c4=null,_0x2eda0b=null;_0x3f9fe1=parseInt(_0x3f9fe1);if(isNaN(_0x3f9fe1)){_0x2e3ab3['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0xa46a('0x11')});return;}if(_0x3f9fe1!=0xc8){_0x2e3ab3['cb'](null,{'code':_0x3f9fe1,'result':-0x1,'extra':'KO'});return;}_0x2720c4=_0x2e3ab3['rx'][_0xa46a('0xd')](0x4)[_0xa46a('0x12')](_0xa46a('0x13'),'');if(_0x2720c4[_0xa46a('0x14')]('\x20')!=-0x1){_0x2720c4=_0x2720c4[_0xa46a('0x15')](0x0,_0x2720c4[_0xa46a('0x14')]('\x20'));}if(_[_0xa46a('0x16')](_0x2720c4,'-1')){_0x2720c4=parseInt(_0x2720c4);}_0x2eda0b=_0x2e3ab3['rx'][_0xa46a('0x17')]('\x20');if(_0x2eda0b[_0xa46a('0x18')]==0x3){_0x2eda0b=_0x2eda0b[0x2][_0xa46a('0xd')](0x1,_0x2eda0b[0x2][_0xa46a('0x18')]-0x1);}else if(_0x2eda0b[_0xa46a('0x18')]>0x3){var _0x35c92c=/\((.+)\)/;var _0x1257f4=_0x2e3ab3['rx']['match'](_0x35c92c);if(_0x1257f4){_0x2eda0b=_0x1257f4[0x1];}else{_0x2eda0b=null;}}else{_0x2eda0b=null;}_0x2e3ab3['cb'](null,{'code':_0x3f9fe1,'result':_0x2720c4,'extra':_0x2eda0b});}});_0x1ec29a['on'](_0xa46a('0x19'),function(_0x4fdc40){_0x43f37c[_0xa46a('0x1a')]('error',new AGIError(_0xa46a('0x1b'),_0x4fdc40['code']));});_0x1ec29a['on'](_0xa46a('0x1c'),function(){_0x43f37c['emit'](_0xa46a('0x1c'),new AGIError(_0xa46a('0x1d')));});_0x1ec29a['on']('timeout',function(){_0x43f37c[_0xa46a('0x1a')](_0xa46a('0x1e'),new AGIError('E_AGI_SOCKET_TIMEOUT'));_0x1ec29a[_0xa46a('0x1f')]();});_0x1ec29a[_0xa46a('0x20')](_0x2c622e);this[_0xa46a('0x21')]=function(_0x3ea530,_0x441837){var _0x3ea530=_0x3ea530||'',_0x441837=typeof _0x441837=='function'?_0x441837:new Function();_0x2e3ab3={'tx':_0x3ea530,'rx':'','cb':_0x441837};_0x1ec29a['write'](_0x3ea530+'\x0a');},this['close']=function(){_0x1ec29a[_0xa46a('0x1f')]();};}util[_0xa46a('0x22')](AGIChannel,EventEmitter);AGIChannel[_0xa46a('0x23')][_0xa46a('0x24')]=function(_0x63a557){return this[_0xa46a('0x21')][_0xa46a('0x25')](this,_0x63a557);};AGIChannel[_0xa46a('0x23')][_0xa46a('0x26')]=function(){return this[_0xa46a('0x24')](_0xa46a('0x27'));};AGIChannel['prototype'][_0xa46a('0x28')]=function(_0x5df4e7,_0x57dd1e,_0x2ec51a){_0x5df4e7=_0x5df4e7===undefined?_0xa46a('0x29'):_0x5df4e7;_0x57dd1e=_0x57dd1e===undefined?'5':_0x57dd1e;_0x2ec51a=_0x2ec51a===undefined?'1':_0x2ec51a;return this[_0xa46a('0x24')](util[_0xa46a('0x2a')](_0xa46a('0x2b'),_0x5df4e7,_0x57dd1e*0x3e8,_0x2ec51a));};AGIChannel[_0xa46a('0x23')][_0xa46a('0x2c')]=function(_0x1936fb){_0x1936fb=_0x1936fb||'NO\x20MESSAGE';return this['sendRequest'](util[_0xa46a('0x2a')](_0xa46a('0x2d'),_0x1936fb));};AGIChannel['prototype'][_0xa46a('0x2e')]=function(_0x4f7ba5,_0x28780c){if(_['isArray'](_0x28780c)){return this[_0xa46a('0x24')](util[_0xa46a('0x2a')](_0xa46a('0x2f'),_0x4f7ba5,_0x28780c['join'](',')));}return this[_0xa46a('0x24')](util[_0xa46a('0x2a')](_0xa46a('0x2f'),_0x4f7ba5,_0x28780c));};AGIChannel[_0xa46a('0x23')][_0xa46a('0x30')]=function(_0x4aed30){return this['sendRequest'](util['format'](_0xa46a('0x31'),_0x4aed30));};AGIChannel[_0xa46a('0x23')][_0xa46a('0x32')]=function(_0x242330){return this[_0xa46a('0x24')](util[_0xa46a('0x2a')](_0xa46a('0x33'),_0x242330));};AGIChannel[_0xa46a('0x23')][_0xa46a('0x34')]=function(_0xa1026){return this[_0xa46a('0x24')](util[_0xa46a('0x2a')](_0xa46a('0x35'),_0xa1026));};AGIChannel[_0xa46a('0x23')][_0xa46a('0xc')]=function(){return this[_0xa46a('0x24')]('HANGUP');};AGIChannel[_0xa46a('0x23')]['setVariable']=function(_0x39c612,_0x40930d){var _0x12adc6=_[_0xa46a('0x36')](_0x40930d)||_[_0xa46a('0x37')](_0x40930d)?_0x40930d['toString']():_0x40930d;return this[_0xa46a('0x24')](util['format'](_0xa46a('0x38'),_0x39c612,_0x12adc6?_0x12adc6[_0xa46a('0x39')]()[_0xa46a('0x12')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel['prototype'][_0xa46a('0x3a')]=function(_0x33d9b0,_0x5a0429){return this[_0xa46a('0x24')](util['format'](_0xa46a('0x3b'),_0x33d9b0,_0x5a0429));};AGIChannel['prototype'][_0xa46a('0x3c')]=function(_0x52e066,_0x507884){return this[_0xa46a('0x24')](util[_0xa46a('0x2a')]('SAY\x20DIGITS\x20%s\x20%s',_0x52e066,_0x507884));};AGIChannel[_0xa46a('0x23')][_0xa46a('0x3d')]=function(_0x55e060,_0x12ccc3){return this['sendRequest'](util[_0xa46a('0x2a')](_0xa46a('0x3e'),_0x55e060,_0x12ccc3));};AGIChannel['prototype'][_0xa46a('0x3f')]=function(_0x3501c2,_0x1bd8f2,_0xb043bd){_0x1bd8f2=_0x1bd8f2||this['extension'];_0xb043bd=_0xb043bd||0x1;this[_0xa46a('0x30')](_0x3501c2);this['setExtension'](_0x1bd8f2);this[_0xa46a('0x34')](_0xb043bd);return this[_0xa46a('0x2c')](util[_0xa46a('0x2a')](_0xa46a('0x40'),_0x3501c2,_0x1bd8f2,_0xb043bd));};AGIChannel[_0xa46a('0x23')][_0xa46a('0x41')]=function(_0x131c6d){return this[_0xa46a('0x24')](util[_0xa46a('0x2a')](_0xa46a('0x42'),_0x131c6d));};AGIChannel[_0xa46a('0x23')][_0xa46a('0x43')]=function(_0x398517,_0x54bbfb,_0x1d5811,_0x329015,_0x3cd4d1,_0x4af267){_0x54bbfb=_0x54bbfb||_0xa46a('0x44');_0x1d5811=_0x1d5811||'';_0x329015=_0x329015===undefined?-0x1:_0x329015==='-1'?-0x1:_0x329015*0x3e8;_0x3cd4d1=_0x3cd4d1===undefined?'':'s='+_0x3cd4d1;_0x4af267=_0x4af267?_0xa46a('0x45'):'';return this[_0xa46a('0x24')](util['format'](_0xa46a('0x46'),_0x398517,_0x54bbfb,_0x1d5811,_0x329015,_0x4af267,_0x3cd4d1));};AGIChannel['prototype'][_0xa46a('0x47')]=function(_0x2958d1,_0x23a047){_0x23a047=_0x23a047||'';return this[_0xa46a('0x24')](util['format']('STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22',_0x2958d1,_0x23a047));};AGIChannel[_0xa46a('0x23')]['agi']=function(_0x385775){return this[_0xa46a('0x2e')](_0xa46a('0x48'),_0x385775);};AGIChannel[_0xa46a('0x23')]['wait']=function(_0x1b545f){return this[_0xa46a('0x2e')](_0xa46a('0x49'),_0x1b545f);};AGIChannel['prototype'][_0xa46a('0x19')]=function(_0x6f05c2,_0xfb54cc){this['noop'](util[_0xa46a('0x2a')](_0xa46a('0x4a'),_0x6f05c2['id'],_0x6f05c2['label'],_0xfb54cc));return{'code':0x1f4,'result':'-1','extra':''};};module[_0xa46a('0x4b')]=AGIChannel; \ No newline at end of file +var _0xcd03=['destroy','command','write','inherits','prototype','sendRequest','ANSWER','getData','beep','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','NO\x20MESSAGE','exec','EXEC\x20%s\x20%s','join','setContext','SET\x20CONTEXT\x20%s','setExtension','SET\x20PRIORITY\x20%s','setVariable','isBoolean','isNumber','toString','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','setPriority','noop','getVariable','GET\x20VARIABLE\x20\x22%s\x22','wav','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','AGI','WAIT','label','exports','util','events','./reply','./error','call','setEncoding','utf8','setTimeout','emit','ready','line','toLowerCase','hangup','520-Invalid','search','520\x20End\x20of\x20proper','function','substring','no\x20code','replace','indexOf','split','length','match','error','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','timeout'];(function(_0x3aff0f,_0x3b6ca0){var _0x21965b=function(_0x1067b8){while(--_0x1067b8){_0x3aff0f['push'](_0x3aff0f['shift']());}};_0x21965b(++_0x3b6ca0);}(_0xcd03,0x14f));var _0x3cd0=function(_0x5a349d,_0x3b73b5){_0x5a349d=_0x5a349d-0x0;var _0x3643a1=_0xcd03[_0x5a349d];return _0x3643a1;};'use strict';var util=require(_0x3cd0('0x0'));var _=require('lodash');var EventEmitter=require(_0x3cd0('0x1'))['EventEmitter'];var AGIReply=require(_0x3cd0('0x2'));var AGIError=require(_0x3cd0('0x3'));function AGIChannel(_0x437594){var _0x943d62=this,_0x10841e=new AGIReply(),_0x4fdf59=![],_0x2ef9a3={};EventEmitter[_0x3cd0('0x4')](_0x943d62);_0x437594[_0x3cd0('0x5')](_0x3cd0('0x6'));_0x437594[_0x3cd0('0x7')](0x8*0x3c*0x3c*0x3e8);_0x10841e[_0x3cd0('0x5')](_0x3cd0('0x6'));_0x10841e['on']('headers',function(_0x506fab){for(var _0x4da35a in _0x506fab){_0x943d62[_0x4da35a]=_0x506fab[_0x4da35a];}_0x943d62[_0x3cd0('0x8')](_0x3cd0('0x9'));});_0x10841e['on'](_0x3cd0('0xa'),function(_0x173a3d){if(_0x173a3d[_0x3cd0('0xb')]()==_0x3cd0('0xc')){_0x943d62['emit'](_0x3cd0('0xc'));return;}if(_0x173a3d['substring'](0x0,0xb)==_0x3cd0('0xd')){_0x4fdf59=!![];}if(_0x4fdf59){_0x2ef9a3['rx']+=_0x173a3d+'\x0a';if(_0x173a3d[_0x3cd0('0xe')](_0x3cd0('0xf'))!=-0x1){_0x4fdf59=![];}}else{_0x2ef9a3['rx']=_0x173a3d;}if(_0x4fdf59){return;}if(typeof _0x2ef9a3['cb']==_0x3cd0('0x10')){var _0x24dd2b=_0x2ef9a3['rx'][_0x3cd0('0x11')](0x0,0x3),_0x41151f=null,_0xc90cc=null;_0x24dd2b=parseInt(_0x24dd2b);if(isNaN(_0x24dd2b)){_0x2ef9a3['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x3cd0('0x12')});return;}if(_0x24dd2b!=0xc8){_0x2ef9a3['cb'](null,{'code':_0x24dd2b,'result':-0x1,'extra':'KO'});return;}_0x41151f=_0x2ef9a3['rx']['substring'](0x4)[_0x3cd0('0x13')]('result=','');if(_0x41151f[_0x3cd0('0x14')]('\x20')!=-0x1){_0x41151f=_0x41151f['substr'](0x0,_0x41151f[_0x3cd0('0x14')]('\x20'));}if(_['startsWith'](_0x41151f,'-1')){_0x41151f=parseInt(_0x41151f);}_0xc90cc=_0x2ef9a3['rx'][_0x3cd0('0x15')]('\x20');if(_0xc90cc[_0x3cd0('0x16')]==0x3){_0xc90cc=_0xc90cc[0x2]['substring'](0x1,_0xc90cc[0x2][_0x3cd0('0x16')]-0x1);}else if(_0xc90cc['length']>0x3){var _0x265d44=/\((.+)\)/;var _0x39fc63=_0x2ef9a3['rx'][_0x3cd0('0x17')](_0x265d44);if(_0x39fc63){_0xc90cc=_0x39fc63[0x1];}else{_0xc90cc=null;}}else{_0xc90cc=null;}_0x2ef9a3['cb'](null,{'code':_0x24dd2b,'result':_0x41151f,'extra':_0xc90cc});}});_0x437594['on'](_0x3cd0('0x18'),function(_0x3f6b70){_0x943d62[_0x3cd0('0x8')](_0x3cd0('0x18'),new AGIError(_0x3cd0('0x19'),_0x3f6b70[_0x3cd0('0x1a')]));});_0x437594['on'](_0x3cd0('0x1b'),function(){_0x943d62[_0x3cd0('0x8')](_0x3cd0('0x1b'),new AGIError(_0x3cd0('0x1c')));});_0x437594['on'](_0x3cd0('0x1d'),function(){_0x943d62[_0x3cd0('0x8')](_0x3cd0('0x1d'),new AGIError('E_AGI_SOCKET_TIMEOUT'));_0x437594[_0x3cd0('0x1e')]();});_0x437594['pipe'](_0x10841e);this[_0x3cd0('0x1f')]=function(_0x375705,_0x129551){var _0x375705=_0x375705||'',_0x129551=typeof _0x129551==_0x3cd0('0x10')?_0x129551:new Function();_0x2ef9a3={'tx':_0x375705,'rx':'','cb':_0x129551};_0x437594[_0x3cd0('0x20')](_0x375705+'\x0a');},this[_0x3cd0('0x1b')]=function(){_0x437594[_0x3cd0('0x1e')]();};}util[_0x3cd0('0x21')](AGIChannel,EventEmitter);AGIChannel[_0x3cd0('0x22')][_0x3cd0('0x23')]=function(_0x51ec5a){return this[_0x3cd0('0x1f')]['sync'](this,_0x51ec5a);};AGIChannel[_0x3cd0('0x22')]['answer']=function(){return this[_0x3cd0('0x23')](_0x3cd0('0x24'));};AGIChannel['prototype'][_0x3cd0('0x25')]=function(_0x989651,_0x39d0cc,_0x1a98a9){_0x989651=_0x989651===undefined?_0x3cd0('0x26'):_0x989651;_0x39d0cc=_0x39d0cc===undefined?'5':_0x39d0cc;_0x1a98a9=_0x1a98a9===undefined?'1':_0x1a98a9;return this[_0x3cd0('0x23')](util[_0x3cd0('0x27')](_0x3cd0('0x28'),_0x989651,_0x39d0cc*0x3e8,_0x1a98a9));};AGIChannel['prototype']['noop']=function(_0x335196){_0x335196=_0x335196||_0x3cd0('0x29');return this[_0x3cd0('0x23')](util[_0x3cd0('0x27')]('VERBOSE\x20\x22%s\x22',_0x335196));};AGIChannel[_0x3cd0('0x22')][_0x3cd0('0x2a')]=function(_0x3ea3ca,_0x2fcefe){if(_['isArray'](_0x2fcefe)){return this['sendRequest'](util[_0x3cd0('0x27')](_0x3cd0('0x2b'),_0x3ea3ca,_0x2fcefe[_0x3cd0('0x2c')](',')));}return this[_0x3cd0('0x23')](util[_0x3cd0('0x27')](_0x3cd0('0x2b'),_0x3ea3ca,_0x2fcefe));};AGIChannel['prototype'][_0x3cd0('0x2d')]=function(_0x56e119){return this['sendRequest'](util[_0x3cd0('0x27')](_0x3cd0('0x2e'),_0x56e119));};AGIChannel[_0x3cd0('0x22')][_0x3cd0('0x2f')]=function(_0x7015b5){return this[_0x3cd0('0x23')](util[_0x3cd0('0x27')]('SET\x20EXTENSION\x20%s',_0x7015b5));};AGIChannel[_0x3cd0('0x22')]['setPriority']=function(_0x256348){return this[_0x3cd0('0x23')](util[_0x3cd0('0x27')](_0x3cd0('0x30'),_0x256348));};AGIChannel['prototype'][_0x3cd0('0xc')]=function(){return this[_0x3cd0('0x23')]('HANGUP');};AGIChannel[_0x3cd0('0x22')][_0x3cd0('0x31')]=function(_0x3dd59e,_0x427c86){var _0x26087d=_[_0x3cd0('0x32')](_0x427c86)||_[_0x3cd0('0x33')](_0x427c86)?_0x427c86[_0x3cd0('0x34')]():_0x427c86;return this['sendRequest'](util[_0x3cd0('0x27')]('SET\x20VARIABLE\x20%s\x20\x22%s\x22',_0x3dd59e,_0x26087d?_0x26087d[_0x3cd0('0x34')]()[_0x3cd0('0x13')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x3cd0('0x22')]['sayNumber']=function(_0x52200a,_0x239925){return this[_0x3cd0('0x23')](util[_0x3cd0('0x27')](_0x3cd0('0x35'),_0x52200a,_0x239925));};AGIChannel['prototype'][_0x3cd0('0x36')]=function(_0x4da9fc,_0x42a572){return this[_0x3cd0('0x23')](util['format'](_0x3cd0('0x37'),_0x4da9fc,_0x42a572));};AGIChannel[_0x3cd0('0x22')]['sayPhonetic']=function(_0x4455ff,_0x57865b){return this[_0x3cd0('0x23')](util[_0x3cd0('0x27')](_0x3cd0('0x38'),_0x4455ff,_0x57865b));};AGIChannel[_0x3cd0('0x22')][_0x3cd0('0x39')]=function(_0x19cbca,_0x193916,_0x244040){_0x193916=_0x193916||this[_0x3cd0('0x3a')];_0x244040=_0x244040||0x1;this['setContext'](_0x19cbca);this[_0x3cd0('0x2f')](_0x193916);this[_0x3cd0('0x3b')](_0x244040);return this[_0x3cd0('0x3c')](util[_0x3cd0('0x27')]('GOTO\x20%s\x20%s\x20%s',_0x19cbca,_0x193916,_0x244040));};AGIChannel[_0x3cd0('0x22')][_0x3cd0('0x3d')]=function(_0x5c4593){return this['sendRequest'](util[_0x3cd0('0x27')](_0x3cd0('0x3e'),_0x5c4593));};AGIChannel[_0x3cd0('0x22')]['recordFile']=function(_0x187afa,_0x7c7182,_0x41b7f5,_0x73b305,_0x1953d3,_0x21827e){_0x7c7182=_0x7c7182||_0x3cd0('0x3f');_0x41b7f5=_0x41b7f5||'';_0x73b305=_0x73b305===undefined?-0x1:_0x73b305==='-1'?-0x1:_0x73b305*0x3e8;_0x1953d3=_0x1953d3===undefined?'':'s='+_0x1953d3;_0x21827e=_0x21827e?_0x3cd0('0x40'):'';return this['sendRequest'](util[_0x3cd0('0x27')](_0x3cd0('0x41'),_0x187afa,_0x7c7182,_0x41b7f5,_0x73b305,_0x21827e,_0x1953d3));};AGIChannel['prototype'][_0x3cd0('0x42')]=function(_0x11675c,_0x4b7877){_0x4b7877=_0x4b7877||'';return this[_0x3cd0('0x23')](util['format'](_0x3cd0('0x43'),_0x11675c,_0x4b7877));};AGIChannel[_0x3cd0('0x22')][_0x3cd0('0x44')]=function(_0x5328ac){return this[_0x3cd0('0x2a')](_0x3cd0('0x45'),_0x5328ac);};AGIChannel[_0x3cd0('0x22')]['wait']=function(_0x217209){return this[_0x3cd0('0x2a')](_0x3cd0('0x46'),_0x217209);};AGIChannel[_0x3cd0('0x22')]['error']=function(_0x583c40,_0x5bf2d4){this[_0x3cd0('0x3c')](util['format']('ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s',_0x583c40['id'],_0x583c40[_0x3cd0('0x47')],_0x5bf2d4));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x3cd0('0x48')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index f7c26b6..6be9d6a 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 _0xe205=['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.','Socket\x20closed.','Socket\x20timeout.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','format','apply'];(function(_0x5bf396,_0x155168){var _0x599631=function(_0xacbb7a){while(--_0xacbb7a){_0x5bf396['push'](_0x5bf396['shift']());}};_0x599631(++_0x155168);}(_0xe205,0x1d3));var _0x5e20=function(_0x2ed0cb,_0x512fff){_0x2ed0cb=_0x2ed0cb-0x0;var _0x1bd02d=_0xe205[_0x2ed0cb];return _0x1bd02d;};'use strict';var util=require(_0x5e20('0x0'));var error={'E_AGI_UNDEFINED':'Undefined\x20error.','E_AGI_ARGUMENT_PORT':_0x5e20('0x1'),'E_AGI_SERVER_ERROR':_0x5e20('0x2'),'E_AGI_SERVER_CLOSE':_0x5e20('0x3'),'E_AGI_SERVER_MAXCONNECTION':_0x5e20('0x4'),'E_AGI_SERVER_VOICE_DISABLED':'[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','E_AGI_SOCKET_ERROR':'Socket\x20error.\x20Code:\x20%s.','E_AGI_SOCKET_CLOSE':_0x5e20('0x5'),'E_AGI_SOCKET_TIMEOUT':_0x5e20('0x6'),'E_AGI_COMMAND_EMPTY':'Empty\x20command.','E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x5e20('0x7'),'E_AGI_IVR_ENTRY':_0x5e20('0x8')};function AGIError(_0x18970e){var _0x18970e=_0x18970e||null,_0x2649e9=_0x2649e9||[],_0x2ada2d=0x1,_0x3d44a7='';if(!error[_0x18970e]){_0x18970e=_0x5e20('0x9');}_0x2649e9['push'](error[_0x18970e]);while(arguments[_0x2ada2d]){_0x2649e9[_0x5e20('0xa')](arguments[_0x2ada2d]);_0x2ada2d++;}_0x3d44a7=util[_0x5e20('0xb')][_0x5e20('0xc')](util,_0x2649e9);this[_0x5e20('0xd')]=_0x3d44a7;this[_0x5e20('0xe')]=_0x18970e;}module[_0x5e20('0xf')]=AGIError; \ No newline at end of file +var _0x6fa5=['Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','push','apply','name','exports','util','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.'];(function(_0x197626,_0x4618a3){var _0x23c7d3=function(_0x4b7f90){while(--_0x4b7f90){_0x197626['push'](_0x197626['shift']());}};_0x23c7d3(++_0x4618a3);}(_0x6fa5,0x1d9));var _0x56fa=function(_0x5be9e0,_0x177bbb){_0x5be9e0=_0x5be9e0-0x0;var _0x1549c9=_0x6fa5[_0x5be9e0];return _0x1549c9;};'use strict';var util=require(_0x56fa('0x0'));var error={'E_AGI_UNDEFINED':_0x56fa('0x1'),'E_AGI_ARGUMENT_PORT':_0x56fa('0x2'),'E_AGI_SERVER_ERROR':_0x56fa('0x3'),'E_AGI_SERVER_CLOSE':_0x56fa('0x4'),'E_AGI_SERVER_MAXCONNECTION':_0x56fa('0x5'),'E_AGI_SERVER_VOICE_DISABLED':_0x56fa('0x6'),'E_AGI_SOCKET_ERROR':_0x56fa('0x7'),'E_AGI_SOCKET_CLOSE':_0x56fa('0x8'),'E_AGI_SOCKET_TIMEOUT':'Socket\x20timeout.','E_AGI_COMMAND_EMPTY':_0x56fa('0x9'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x56fa('0xa'),'E_AGI_IVR_ENTRY':_0x56fa('0xb')};function AGIError(_0x546252){var _0x546252=_0x546252||null,_0x50fae9=_0x50fae9||[],_0x571712=0x1,_0x3dd927='';if(!error[_0x546252]){_0x546252='E_AGI_UNDEFINED';}_0x50fae9['push'](error[_0x546252]);while(arguments[_0x571712]){_0x50fae9[_0x56fa('0xc')](arguments[_0x571712]);_0x571712++;}_0x3dd927=util['format'][_0x56fa('0xd')](util,_0x50fae9);this['message']=_0x3dd927;this[_0x56fa('0xe')]=_0x546252;}module[_0x56fa('0xf')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/events.js b/server/services/agi/events.js index 0c2f74d..165ddf2 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 _0x2ff6=['E_AGI_SERVER_ERROR','message','projectUpdate','exports','events','EventEmitter','ioredis','./error','../../config/environment','localhost','redis','subscribe','agi','emit','error'];(function(_0x4e37bc,_0x8174e7){var _0x48a8b7=function(_0x458409){while(--_0x458409){_0x4e37bc['push'](_0x4e37bc['shift']());}};_0x48a8b7(++_0x8174e7);}(_0x2ff6,0x130));var _0x62ff=function(_0x482dcf,_0x3c49cb){_0x482dcf=_0x482dcf-0x0;var _0x5bdf16=_0x2ff6[_0x482dcf];return _0x5bdf16;};'use strict';var _=require('lodash');var EventEmitter=require(_0x62ff('0x0'))[_0x62ff('0x1')];var Redis=require(_0x62ff('0x2'));var AGIError=require(_0x62ff('0x3'));var config=require(_0x62ff('0x4'));config['redis']=_['defaults'](config['redis'],{'host':_0x62ff('0x5'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0x62ff('0x6')]);sub[_0x62ff('0x7')](_0x62ff('0x8'),function(_0x1f4561){if(_0x1f4561)return eventEmitter[_0x62ff('0x9')](_0x62ff('0xa'),new AGIError(_0x62ff('0xb'),_0x1f4561));});sub['on'](_0x62ff('0xc'),function(_0x21ecd6,_0x3bb164){if(_0x21ecd6!==_0x62ff('0x8'))return;try{var _0x362762=JSON['parse'](_0x3bb164);eventEmitter[_0x62ff('0x9')](_0x62ff('0xd'),_0x362762);}catch(_0xa83154){eventEmitter['emit'](_0x62ff('0xa'),new AGIError('E_AGI_SERVER_ERROR',_0xa83154));}});module[_0x62ff('0xe')]={'EventEmitter':eventEmitter}; \ No newline at end of file +var _0xcae7=['localhost','subscribe','agi','error','message','parse','emit','E_AGI_SERVER_ERROR','exports','EventEmitter','ioredis','./error','../../config/environment','redis','defaults'];(function(_0x448ae2,_0x1676f5){var _0x4fdd34=function(_0x30e907){while(--_0x30e907){_0x448ae2['push'](_0x448ae2['shift']());}};_0x4fdd34(++_0x1676f5);}(_0xcae7,0xf9));var _0x7cae=function(_0x450689,_0x3b857c){_0x450689=_0x450689-0x0;var _0x46ffb0=_0xcae7[_0x450689];return _0x46ffb0;};'use strict';var _=require('lodash');var EventEmitter=require('events')[_0x7cae('0x0')];var Redis=require(_0x7cae('0x1'));var AGIError=require(_0x7cae('0x2'));var config=require(_0x7cae('0x3'));config[_0x7cae('0x4')]=_[_0x7cae('0x5')](config[_0x7cae('0x4')],{'host':_0x7cae('0x6'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0x7cae('0x4')]);sub[_0x7cae('0x7')](_0x7cae('0x8'),function(_0x3e51a7){if(_0x3e51a7)return eventEmitter['emit'](_0x7cae('0x9'),new AGIError('E_AGI_SERVER_ERROR',_0x3e51a7));});sub['on'](_0x7cae('0xa'),function(_0x2f2d2b,_0x59bc52){if(_0x2f2d2b!==_0x7cae('0x8'))return;try{var _0x1e2598=JSON[_0x7cae('0xb')](_0x59bc52);eventEmitter[_0x7cae('0xc')]('projectUpdate',_0x1e2598);}catch(_0x2f5092){eventEmitter[_0x7cae('0xc')]('error',new AGIError(_0x7cae('0xd'),_0x2f5092));}});module[_0x7cae('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 b19f488..2738e59 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 _0x2f27=['vertices','edges','numberOfEdges','addVertex','prototype','size','relations','traverseBFS','info','no\x20edge/s\x20available','condition','split','length','agicommand','vswitch','default','target','invalid','default\x20on\x20switch\x20not\x20found','max\x20retry\x20reach','agi','menu','getsecretdigits'];(function(_0x4cefc3,_0x23f291){var _0x1cc779=function(_0x7cb914){while(--_0x7cb914){_0x4cefc3['push'](_0x4cefc3['shift']());}};_0x1cc779(++_0x23f291);}(_0x2f27,0x70));var _0x72f2=function(_0x5985ef,_0x414f77){_0x5985ef=_0x5985ef-0x0;var _0x4f839a=_0x2f27[_0x5985ef];return _0x4f839a;};'use strict';var _=require('lodash');var logger=require('../../../config/logger')(_0x72f2('0x0'));var verticesWithRetry=[_0x72f2('0x1'),'getdigits',_0x72f2('0x2')];var Graph=function(){this[_0x72f2('0x3')]={};this[_0x72f2('0x4')]={};this[_0x72f2('0x5')]=0x0;};Graph['prototype'][_0x72f2('0x6')]=function(_0x41202d){this['vertices'][_0x41202d['id']]=_0x41202d;this[_0x72f2('0x4')][_0x41202d['id']]=[];};Graph[_0x72f2('0x7')]['addEdge']=function(_0x41905e,_0x34f898,_0x5b57cc){this[_0x72f2('0x4')][_0x41905e]['push']({'target':_0x34f898,'condition':_0x5b57cc});this['numberOfEdges']+=0x1;};Graph[_0x72f2('0x7')][_0x72f2('0x8')]=function(){return _[_0x72f2('0x8')](this[_0x72f2('0x3')]);};Graph[_0x72f2('0x7')][_0x72f2('0x9')]=function(){return this[_0x72f2('0x5')];};Graph['prototype']['getVertex']=function(_0x490903){return this[_0x72f2('0x3')][_0x490903];};Graph[_0x72f2('0x7')][_0x72f2('0xa')]=function(_0x1ebb67,_0x4e4ee6){if(!this[_0x72f2('0x3')][_0x1ebb67]){return logger['info']('no\x20vertex\x20found');}var _0x39c225=_0x4e4ee6(this[_0x72f2('0x3')][_0x1ebb67]);if(!_0x39c225){return logger[_0x72f2('0xb')]('stop\x20traverse');}if(this[_0x72f2('0x4')][_0x1ebb67]['length']===0x0){return logger['info'](_0x72f2('0xc'));}for(var _0x2a74b8=0x0,_0x47f193=[],_0x2cc77d=![];_0x2a74b8\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','uniqueid','close','timeout','find','handleNotFound','production','handleUnpublished','initialize','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','catch','[LICENSE]','./server','listening','connection','lodash','syncho','util','../../config/environment','../../config/logger','agi','../../config/license/util','./rpc','./project','EventEmitter','defaults','127.0.0.1','projectUpdate','nextTick','stack','findIndex','deleted','push','error','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','info','format','name','message','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','callerid','dnid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','createSquareReport'];(function(_0x154cb5,_0x1a8d5a){var _0x3f574f=function(_0x597a52){while(--_0x597a52){_0x154cb5['push'](_0x154cb5['shift']());}};_0x3f574f(++_0x1a8d5a);}(_0xeff6,0x10e));var _0x6eff=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xeff6[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x6eff('0x0'));var syncho=require(_0x6eff('0x1'));var util=require(_0x6eff('0x2'));var config=require(_0x6eff('0x3'));var logger=require(_0x6eff('0x4'))(_0x6eff('0x5'));var utilLicense=require(_0x6eff('0x6'));var rpc=require(_0x6eff('0x7'));var Project=require(_0x6eff('0x8'));var AGIEmitter=require('./events')[_0x6eff('0x9')];var projects=[];config[_0x6eff('0x5')]=_[_0x6eff('0xa')](config[_0x6eff('0x5')],{'ip':_0x6eff('0xb'),'port':0x11dd});AGIEmitter['on'](_0x6eff('0xc'),projectUpdateHandler);function connectionHandler(_0x56e48f){process[_0x6eff('0xd')](function(){syncho(function(){try{setChannelVariables(_0x56e48f);agiHandler(_0x56e48f);}catch(_0x58af75){logger['error'](_0x58af75[_0x6eff('0xe')]);}});});}function projectUpdateHandler(_0x558d3e){try{var _0x26ac5b=_[_0x6eff('0xf')](projects,['id',_0x558d3e['id']]);if(_0x26ac5b>-0x1){if(_0x558d3e[_0x6eff('0x10')]===!![]){projects['splice'](_0x26ac5b,0x1);}else{projects[_0x26ac5b]=_0x558d3e;}}else{projects[_0x6eff('0x11')](_0x558d3e);}}catch(_0x5b41a8){logger[_0x6eff('0x12')](_0x5b41a8[_0x6eff('0xe')]);}}function listeningHandler(){console[_0x6eff('0x13')](_0x6eff('0x14'),config['agi'][_0x6eff('0x15')]);logger[_0x6eff('0x16')](util[_0x6eff('0x17')]('[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d',config['agi']['ip'],config[_0x6eff('0x5')][_0x6eff('0x15')]));}function errorHandler(_0x5d6cad){if(_0x5d6cad&&_0x5d6cad[_0x6eff('0x18')]&&_0x5d6cad[_0x6eff('0x19')]){logger['error'](util[_0x6eff('0x17')]('[%s]\x20%s',_0x5d6cad[_0x6eff('0x18')],_0x5d6cad[_0x6eff('0x19')]));}else{logger[_0x6eff('0x12')](util['format']('[ERROR]\x20%s',_0x5d6cad[_0x6eff('0xe')]));}}function closeHandler(){logger['info'](util[_0x6eff('0x17')](_0x6eff('0x1a'),this[_0x6eff('0x1b')],this[_0x6eff('0x1c')],this['callerid'],this['dnid'],this['uniqueid']));try{createSquareReport(this);}catch(_0x115a4f){logger[_0x6eff('0x12')](_0x115a4f['stack']);}}function timeoutHandler(){logger[_0x6eff('0x16')](util[_0x6eff('0x17')](_0x6eff('0x1d'),this[_0x6eff('0x1b')],this[_0x6eff('0x1c')],this[_0x6eff('0x1e')],this[_0x6eff('0x1f')],this['uniqueid']));}function hangupHandler(){logger[_0x6eff('0x16')](util[_0x6eff('0x17')](_0x6eff('0x20'),this['arg_1'],this[_0x6eff('0x1c')],this['callerid'],this[_0x6eff('0x1f')],this['uniqueid']));this[_0x6eff('0x21')]=!![];}function createSquareReport(_0x462ccb,_0x48cac1){rpc[_0x6eff('0x22')](_0x462ccb)[_0x6eff('0x23')](function(_0x1a8c4c){if(_0x48cac1){_0x48cac1(null,_0x1a8c4c);}})['catch'](function(_0x5abe49){if(_0x48cac1){_0x48cac1(null,_0x5abe49);}});}function setChannelVariables(_0x1d47de){for(var _0x370720 in _0x1d47de){if(_0x1d47de[_0x6eff('0x24')](_0x370720)){if(_0x370720[_0x6eff('0x25')](_0x6eff('0x26'))===0x0){_0x1d47de[_0x370720[_0x6eff('0x27')](0x4)]=_0x1d47de[_0x370720];delete _0x1d47de[_0x370720];}}}}function agiHandler(_0x2ee32a){logger[_0x6eff('0x28')]('variables',JSON['stringify'](_0x2ee32a,null,0x2));logger['info'](util['format'](_0x6eff('0x29'),_0x2ee32a[_0x6eff('0x1b')],_0x2ee32a[_0x6eff('0x1c')],_0x2ee32a[_0x6eff('0x1e')],_0x2ee32a[_0x6eff('0x1f')],_0x2ee32a[_0x6eff('0x2a')]));_0x2ee32a['on'](_0x6eff('0x12'),errorHandler);_0x2ee32a['on'](_0x6eff('0x2b'),closeHandler);_0x2ee32a['on'](_0x6eff('0x2c'),timeoutHandler);_0x2ee32a['evtHangup']=![];_0x2ee32a['on']('hangup',hangupHandler);var _0x36e783=_[_0x6eff('0x2d')](projects,['name',_0x2ee32a[_0x6eff('0x1b')]]);if(!_0x36e783)return Project[_0x6eff('0x2e')](_0x2ee32a);if(!_0x36e783[_0x6eff('0x2f')])return Project[_0x6eff('0x30')](_0x2ee32a);return Project[_0x6eff('0x31')](_0x36e783,_0x2ee32a);}function main(){var _0x11c971;return utilLicense[_0x6eff('0x32')]()[_0x6eff('0x23')](function(_0x21ab4e){if(!_0x21ab4e)return;if(_0x21ab4e[_0x6eff('0x33')]){if(_0x21ab4e['callysquare']&&_0x21ab4e[_0x6eff('0x34')]>0x0){logger['info'](util[_0x6eff('0x17')](_0x6eff('0x35'),_0x21ab4e['callysquare']));_0x11c971=_0x21ab4e[_0x6eff('0x34')];}else{logger['info'](_0x6eff('0x36'));}}else{logger[_0x6eff('0x16')](_0x6eff('0x37'));_0x11c971=-0x1;}})[_0x6eff('0x23')](function(){return Project['getAll']();})['then'](function(_0x47b41f){projects=_0x47b41f;return;})[_0x6eff('0x38')](function(_0x10c39b){logger[_0x6eff('0x12')](_0x6eff('0x39'),_0x10c39b[_0x6eff('0xe')]);})['finally'](function(){var _0x3e79e4=require(_0x6eff('0x3a'))(config[_0x6eff('0x5')]['port'],config[_0x6eff('0x5')]['ip'],_0x11c971);_0x3e79e4['on'](_0x6eff('0x12'),errorHandler);_0x3e79e4['on'](_0x6eff('0x3b'),listeningHandler);_0x3e79e4['on'](_0x6eff('0x3c'),connectionHandler);_0x3e79e4['on']('close',closeHandler);});}main(); \ No newline at end of file +var _0x411d=['agi','../../config/license/util','./rpc','./project','./events','EventEmitter','projectUpdate','nextTick','error','stack','splice','push','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name','message','[%s]\x20%s','[ERROR]\x20%s','info','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','callerid','dnid','uniqueid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','createSquareReport','catch','hasOwnProperty','indexOf','agi_','substring','debug','stringify','close','hangup','find','handleNotFound','production','then','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20VOICE\x20IS\x20DISABLED','getAll','finally','./server','listening','connection','lodash','util','../../config/logger'];(function(_0x2b2604,_0x50dce6){var _0x5c2605=function(_0x594ac1){while(--_0x594ac1){_0x2b2604['push'](_0x2b2604['shift']());}};_0x5c2605(++_0x50dce6);}(_0x411d,0xa2));var _0xd411=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x411d[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xd411('0x0'));var syncho=require('syncho');var util=require(_0xd411('0x1'));var config=require('../../config/environment');var logger=require(_0xd411('0x2'))(_0xd411('0x3'));var utilLicense=require(_0xd411('0x4'));var rpc=require(_0xd411('0x5'));var Project=require(_0xd411('0x6'));var AGIEmitter=require(_0xd411('0x7'))[_0xd411('0x8')];var projects=[];config[_0xd411('0x3')]=_['defaults'](config[_0xd411('0x3')],{'ip':'127.0.0.1','port':0x11dd});AGIEmitter['on'](_0xd411('0x9'),projectUpdateHandler);function connectionHandler(_0x14ff4e){process[_0xd411('0xa')](function(){syncho(function(){try{setChannelVariables(_0x14ff4e);agiHandler(_0x14ff4e);}catch(_0x37ff9c){logger[_0xd411('0xb')](_0x37ff9c[_0xd411('0xc')]);}});});}function projectUpdateHandler(_0x7317bf){try{var _0x578514=_['findIndex'](projects,['id',_0x7317bf['id']]);if(_0x578514>-0x1){if(_0x7317bf['deleted']===!![]){projects[_0xd411('0xd')](_0x578514,0x1);}else{projects[_0x578514]=_0x7317bf;}}else{projects[_0xd411('0xe')](_0x7317bf);}}catch(_0x1a5b85){logger[_0xd411('0xb')](_0x1a5b85[_0xd411('0xc')]);}}function listeningHandler(){console['log'](_0xd411('0xf'),config[_0xd411('0x3')][_0xd411('0x10')]);logger['info'](util[_0xd411('0x11')](_0xd411('0x12'),config[_0xd411('0x3')]['ip'],config[_0xd411('0x3')][_0xd411('0x10')]));}function errorHandler(_0x26b7dd){if(_0x26b7dd&&_0x26b7dd[_0xd411('0x13')]&&_0x26b7dd[_0xd411('0x14')]){logger[_0xd411('0xb')](util[_0xd411('0x11')](_0xd411('0x15'),_0x26b7dd[_0xd411('0x13')],_0x26b7dd[_0xd411('0x14')]));}else{logger[_0xd411('0xb')](util[_0xd411('0x11')](_0xd411('0x16'),_0x26b7dd[_0xd411('0xc')]));}}function closeHandler(){logger[_0xd411('0x17')](util['format'](_0xd411('0x18'),this['arg_1'],this[_0xd411('0x19')],this['callerid'],this['dnid'],this['uniqueid']));try{createSquareReport(this);}catch(_0x7d6831){logger[_0xd411('0xb')](_0x7d6831[_0xd411('0xc')]);}}function timeoutHandler(){logger[_0xd411('0x17')](util[_0xd411('0x11')](_0xd411('0x1a'),this[_0xd411('0x1b')],this['calleridname'],this[_0xd411('0x1c')],this[_0xd411('0x1d')],this[_0xd411('0x1e')]));}function hangupHandler(){logger[_0xd411('0x17')](util[_0xd411('0x11')](_0xd411('0x1f'),this[_0xd411('0x1b')],this[_0xd411('0x19')],this['callerid'],this[_0xd411('0x1d')],this[_0xd411('0x1e')]));this[_0xd411('0x20')]=!![];}function createSquareReport(_0x2285dd,_0x57f50f){rpc[_0xd411('0x21')](_0x2285dd)['then'](function(_0x4b8131){if(_0x57f50f){_0x57f50f(null,_0x4b8131);}})[_0xd411('0x22')](function(_0x573757){if(_0x57f50f){_0x57f50f(null,_0x573757);}});}function setChannelVariables(_0x1d0c74){for(var _0x4bebac in _0x1d0c74){if(_0x1d0c74[_0xd411('0x23')](_0x4bebac)){if(_0x4bebac[_0xd411('0x24')](_0xd411('0x25'))===0x0){_0x1d0c74[_0x4bebac[_0xd411('0x26')](0x4)]=_0x1d0c74[_0x4bebac];delete _0x1d0c74[_0x4bebac];}}}}function agiHandler(_0x5bc455){logger[_0xd411('0x27')]('variables',JSON[_0xd411('0x28')](_0x5bc455,null,0x2));logger[_0xd411('0x17')](util[_0xd411('0x11')]('[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x5bc455['arg_1'],_0x5bc455[_0xd411('0x19')],_0x5bc455['callerid'],_0x5bc455[_0xd411('0x1d')],_0x5bc455[_0xd411('0x1e')]));_0x5bc455['on'](_0xd411('0xb'),errorHandler);_0x5bc455['on'](_0xd411('0x29'),closeHandler);_0x5bc455['on']('timeout',timeoutHandler);_0x5bc455[_0xd411('0x20')]=![];_0x5bc455['on'](_0xd411('0x2a'),hangupHandler);var _0x4e08e9=_[_0xd411('0x2b')](projects,[_0xd411('0x13'),_0x5bc455['arg_1']]);if(!_0x4e08e9)return Project[_0xd411('0x2c')](_0x5bc455);if(!_0x4e08e9[_0xd411('0x2d')])return Project['handleUnpublished'](_0x5bc455);return Project['initialize'](_0x4e08e9,_0x5bc455);}function main(){var _0x3602fd;return utilLicense['getLicense']()[_0xd411('0x2e')](function(_0x4044f8){if(!_0x4044f8)return;if(_0x4044f8['voice']){if(_0x4044f8[_0xd411('0x2f')]&&_0x4044f8['callysquare']>0x0){logger[_0xd411('0x17')](util[_0xd411('0x11')](_0xd411('0x30'),_0x4044f8['callysquare']));_0x3602fd=_0x4044f8[_0xd411('0x2f')];}else{logger[_0xd411('0x17')]('[LICENSE]\x20CHANNELS:\x20UNLIMITED');}}else{logger[_0xd411('0x17')](_0xd411('0x31'));_0x3602fd=-0x1;}})[_0xd411('0x2e')](function(){return Project[_0xd411('0x32')]();})[_0xd411('0x2e')](function(_0x1bd523){projects=_0x1bd523;return;})[_0xd411('0x22')](function(_0x22bb21){logger[_0xd411('0xb')]('[LICENSE]',_0x22bb21[_0xd411('0xc')]);})[_0xd411('0x33')](function(){var _0x6e4ab=require(_0xd411('0x34'))(config[_0xd411('0x3')]['port'],config['agi']['ip'],_0x3602fd);_0x6e4ab['on'](_0xd411('0xb'),errorHandler);_0x6e4ab['on'](_0xd411('0x35'),listeningHandler);_0x6e4ab['on'](_0xd411('0x36'),connectionHandler);_0x6e4ab['on'](_0xd411('0x29'),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 aa675e5..8c1e547 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 _0x7558=['jayson/promise','http','then','error','message','result','SendMail','bluebird'];(function(_0x13aaae,_0x356440){var _0x3ca182=function(_0x55686e){while(--_0x55686e){_0x13aaae['push'](_0x13aaae['shift']());}};_0x3ca182(++_0x356440);}(_0x7558,0x1bf));var _0x8755=function(_0x50d4f4,_0x2edb56){_0x50d4f4=_0x50d4f4-0x0;var _0x5364e0=_0x7558[_0x50d4f4];return _0x5364e0;};'use strict';var BPromise=require(_0x8755('0x0'));var jayson=require(_0x8755('0x1'));var client=jayson['client'][_0x8755('0x2')]({'port':0x232b});function request(_0x2c2199,_0xb6faa4){return new BPromise(function(_0x2c0361,_0x13a810){return client['request'](_0x2c2199,_0xb6faa4)[_0x8755('0x3')](function(_0x4a94b1){if(_0x4a94b1['error']){return _0x13a810(_0x4a94b1[_0x8755('0x4')][_0x8755('0x5')]);}else{return _0x2c0361(_0x4a94b1[_0x8755('0x6')]);}})['catch'](function(_0x392615){return _0x13a810(_0x392615);});});}exports['sendMailMessage']=function(_0x2e33d6,_0x342ffb){return request(_0x8755('0x7'),{'account':_0x2e33d6,'message':_0x342ffb});}; \ No newline at end of file +var _0xbf74=['jayson/promise','client','http','then','error','message','result','catch','sendMailMessage','SendMail','bluebird'];(function(_0x455d80,_0x4b77ae){var _0x3900d2=function(_0xdfe41a){while(--_0xdfe41a){_0x455d80['push'](_0x455d80['shift']());}};_0x3900d2(++_0x4b77ae);}(_0xbf74,0xfc));var _0x4bf7=function(_0x37f62e,_0x14ff36){_0x37f62e=_0x37f62e-0x0;var _0x3be3ae=_0xbf74[_0x37f62e];return _0x3be3ae;};'use strict';var BPromise=require(_0x4bf7('0x0'));var jayson=require(_0x4bf7('0x1'));var client=jayson[_0x4bf7('0x2')][_0x4bf7('0x3')]({'port':0x232b});function request(_0x2be29d,_0x4e74ab){return new BPromise(function(_0x385610,_0x517b2e){return client['request'](_0x2be29d,_0x4e74ab)[_0x4bf7('0x4')](function(_0x40a8a1){if(_0x40a8a1['error']){return _0x517b2e(_0x40a8a1[_0x4bf7('0x5')][_0x4bf7('0x6')]);}else{return _0x385610(_0x40a8a1[_0x4bf7('0x7')]);}})[_0x4bf7('0x8')](function(_0xc9db58){return _0x517b2e(_0xc9db58);});});}exports[_0x4bf7('0x9')]=function(_0x31e6f2,_0x3184b1){return request(_0x4bf7('0xa'),{'account':_0x31e6f2,'message':_0x3184b1});}; \ No newline at end of file diff --git a/server/services/agi/project.js b/server/services/agi/project.js index e89e986..8a87568 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 _0x5a64=['traverseBFS','start','clear','stringify','agicommand','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','code','evtHangup','isUndefined','result','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','vertex','toString','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','close','Project\x20%s\x20not\x20published','exports','lodash','moment','xml2json','util','../../config/logger','agi','./mailRpc','./graph','getSquareProjects','error','stack','hasOwnProperty','retry','maxRetry','addVertex','omit','mxCell','isArray','length','source','target','addEdge','value','toJson','mxGraphModel','root','inspect','production','debug','joinAt','format','YYYY-MM-DD\x20HH:mm:ss','info','arg_1','calleridname','callerid','uniqueid'];(function(_0x226d0f,_0xec0708){var _0x4be70c=function(_0x27772c){while(--_0x27772c){_0x226d0f['push'](_0x226d0f['shift']());}};_0x4be70c(++_0xec0708);}(_0x5a64,0x92));var _0x45a6=function(_0x3364fa,_0x541a6d){_0x3364fa=_0x3364fa-0x0;var _0x13cf0c=_0x5a64[_0x3364fa];return _0x13cf0c;};'use strict';var _=require(_0x45a6('0x0'));var moment=require(_0x45a6('0x1'));var parser=require(_0x45a6('0x2'));var util=require(_0x45a6('0x3'));var logger=require(_0x45a6('0x4'))(_0x45a6('0x5'));var rpc=require('./rpc');var mailRpc=require(_0x45a6('0x6'));var Graph=require(_0x45a6('0x7'));var Vertices=require('./vertices');var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0x45a6('0x8')]()['catch'](function(_0x17059f){logger[_0x45a6('0x9')]('Unable\x20to\x20download\x20CallySquare\x20projects',_0x17059f[_0x45a6('0xa')]);return[];});}function addVertex(_0xef242a,_0x5c7f93,_0xac3968){_0x5c7f93['agicommand']=_0xac3968;if(_0x5c7f93[_0x45a6('0xb')](_0x45a6('0xc'))){_0x5c7f93[_0x45a6('0xd')]=parseInt(_0x5c7f93[_0x45a6('0xc')],0xa);}_0xef242a[_0x45a6('0xe')](_[_0x45a6('0xf')](_0x5c7f93,_0x45a6('0x10')));}function initGraph(_0x923f34,_0x5a71aa){var _0x4d0515=new Graph();for(var _0x5371d3 in _0x923f34){if(_0x923f34[_0x45a6('0xb')](_0x5371d3)){if(_[_0x45a6('0x11')](_0x923f34[_0x5371d3])){for(var _0x10e904=0x0;_0x10e904<_0x923f34[_0x5371d3][_0x45a6('0x12')];_0x10e904+=0x1){addVertex(_0x4d0515,_0x923f34[_0x5371d3][_0x10e904],_0x5371d3);}}else{addVertex(_0x4d0515,_0x923f34[_0x5371d3],_0x5371d3);}}}for(var _0x2b141a=0x0;_0x2b141a<_0x5a71aa[_0x45a6('0x12')];_0x2b141a+=0x1){if(_0x5a71aa[_0x2b141a][_0x45a6('0x13')]&&_0x5a71aa[_0x2b141a][_0x45a6('0x14')]){_0x4d0515[_0x45a6('0x15')](_0x5a71aa[_0x2b141a]['source'],_0x5a71aa[_0x2b141a]['target'],_0x5a71aa[_0x2b141a][_0x45a6('0x16')]);}}return _0x4d0515;}function getRoot(_0x4f18a8){return parser[_0x45a6('0x17')](_0x4f18a8,{'object':!![]})[_0x45a6('0x18')][_0x45a6('0x19')];}function inspect(_0x1dbd4c){return util[_0x45a6('0x1a')](_0x1dbd4c,{'showHidden':![],'depth':null});}function initialize(_0x2f1e50,_0x37edc8){var _0x409b1d=getRoot(_0x2f1e50[_0x45a6('0x1b')]);if(!_0x409b1d||!_0x409b1d['start'])return;var _0x19a020,_0x5d6e4a,_0x29ed5a;logger[_0x45a6('0x1c')](_0x45a6('0x19'),JSON['stringify'](_0x409b1d,null,0x2));_0x37edc8[_0x45a6('0x1d')]=moment()[_0x45a6('0x1e')](_0x45a6('0x1f'));_0x19a020=initGraph(_[_0x45a6('0xf')](_0x409b1d,_0x45a6('0x10')),_0x409b1d[_0x45a6('0x10')]);_0x5d6e4a=new Vertices(_0x37edc8,rpc,mailRpc);logger[_0x45a6('0x20')](util['format']('[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x37edc8[_0x45a6('0x21')],_0x37edc8[_0x45a6('0x22')],_0x37edc8[_0x45a6('0x23')],_0x37edc8['dnid'],_0x37edc8[_0x45a6('0x24')]));_0x19a020[_0x45a6('0x25')](_0x409b1d[_0x45a6('0x26')]['id'],function(_0x20000f){try{_0x20000f=_0x5d6e4a[_0x45a6('0x27')](_0x20000f);logger['debug']('vertex',JSON[_0x45a6('0x28')](_0x20000f,null,0x2));if(_0x20000f[_0x45a6('0x29')]==='gotoc'){logger[_0x45a6('0x20')](_0x45a6('0x2a'));_0x37edc8[_0x45a6('0x2b')]=_0x20000f['context']||_0x37edc8[_0x45a6('0x2b')];_0x37edc8['extension']=_0x20000f[_0x45a6('0x2c')];_0x37edc8[_0x45a6('0x2d')]=_0x20000f['priority']?_0x20000f['priority']-0x1:0x1;return null;}else if(_0x20000f&&_0x5d6e4a[_0x20000f[_0x45a6('0x29')]]){_0x29ed5a=_0x5d6e4a[_0x20000f[_0x45a6('0x29')]](_0x20000f);logger['info'](_0x45a6('0x2e'),JSON[_0x45a6('0x28')](_0x29ed5a,null,0x2));if(_0x29ed5a&&_0x29ed5a[_0x45a6('0x2f')]===AGI_CODE_SUCCESS&&_0x29ed5a['result']!==AGI_RESULT_ERROR&&!_0x37edc8[_0x45a6('0x30')]){logger['debug'](_0x45a6('0x2e'),inspect(_0x29ed5a));return _[_0x45a6('0x31')](_0x29ed5a[_0x45a6('0x32')])?null:_0x29ed5a[_0x45a6('0x32')]['toString']();}else{logger[_0x45a6('0x9')](_0x45a6('0x2e'),inspect(_0x29ed5a));return null;}}else{logger['error']('agicommand\x20not\x20found');return null;}}catch(_0x24f786){logger[_0x45a6('0x9')](_0x24f786['stack']);return null;}});if(_0x409b1d[_0x45a6('0x33')]){logger[_0x45a6('0x20')](util[_0x45a6('0x1e')](_0x45a6('0x34'),_0x37edc8[_0x45a6('0x21')],_0x37edc8['calleridname'],_0x37edc8[_0x45a6('0x23')],_0x37edc8['dnid'],_0x37edc8[_0x45a6('0x24')]));_0x19a020[_0x45a6('0x25')](_0x409b1d[_0x45a6('0x33')]['id'],function(_0x5334a6){try{_0x5334a6=_0x5d6e4a['clear'](_0x5334a6);logger['debug'](_0x45a6('0x35'),JSON[_0x45a6('0x28')](_0x5334a6,null,0x2));if(_0x5334a6&&_0x5d6e4a[_0x5334a6[_0x45a6('0x29')]]){_0x29ed5a=_0x5d6e4a[_0x5334a6[_0x45a6('0x29')]](_0x5334a6);if(_0x29ed5a){logger[_0x45a6('0x1c')]('response',inspect(_0x29ed5a));return _[_0x45a6('0x31')](_0x29ed5a[_0x45a6('0x32')])?null:_0x29ed5a[_0x45a6('0x32')][_0x45a6('0x36')]();}else{logger['error'](_0x45a6('0x2e'),inspect(_0x29ed5a));return null;}}else{logger[_0x45a6('0x9')]('agicommand\x20not\x20found');return null;}}catch(_0x156812){logger[_0x45a6('0x9')](_0x156812[_0x45a6('0xa')]);return null;}});}logger[_0x45a6('0x20')](util['format'](_0x45a6('0x37'),_0x37edc8[_0x45a6('0x21')],_0x37edc8[_0x45a6('0x22')],_0x37edc8[_0x45a6('0x23')],_0x37edc8['dnid'],_0x37edc8['uniqueid']));logger[_0x45a6('0x20')](util[_0x45a6('0x1e')](_0x45a6('0x38'),_0x37edc8['context'],_0x37edc8[_0x45a6('0x2c')],parseInt(_0x37edc8['priority'],0xa)+0x1));_0x37edc8[_0x45a6('0x39')](_0x37edc8['context'],_0x37edc8[_0x45a6('0x2c')],parseInt(_0x37edc8[_0x45a6('0x2d')],0xa)+0x1);_0x37edc8[_0x45a6('0x3a')]();}function handleNotFound(_0x56fe3b){logger['error'](util[_0x45a6('0x1e')]('Project\x20%s\x20not\x20found',_0x56fe3b[_0x45a6('0x21')]));_0x56fe3b[_0x45a6('0x39')](_0x56fe3b[_0x45a6('0x2b')],_0x56fe3b[_0x45a6('0x2c')],parseInt(_0x56fe3b['priority'],0xa)+0x1);_0x56fe3b[_0x45a6('0x3a')]();}function handleUnpublished(_0x1a0491){logger[_0x45a6('0x9')](util[_0x45a6('0x1e')](_0x45a6('0x3b'),_0x1a0491[_0x45a6('0x21')]));_0x1a0491['continueAt'](_0x1a0491[_0x45a6('0x2b')],_0x1a0491[_0x45a6('0x2c')],parseInt(_0x1a0491[_0x45a6('0x2d')],0xa)+0x1);_0x1a0491['close']();}module[_0x45a6('0x3c')]={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file +var _0x4762=['source','addEdge','value','toJson','root','start','debug','stringify','joinAt','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','clear','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','evtHangup','isUndefined','result','toString','agicommand\x20not\x20found','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','finally','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','close','Project\x20%s\x20not\x20found','Project\x20%s\x20not\x20published','exports','lodash','util','agi','./rpc','./mailRpc','./graph','getSquareProjects','catch','error','Unable\x20to\x20download\x20CallySquare\x20projects','stack','agicommand','retry','maxRetry','omit','mxCell','hasOwnProperty','isArray','length'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0x4762,0x183));var _0x2476=function(_0x162084,_0x536d7a){_0x162084=_0x162084-0x0;var _0x34f95c=_0x4762[_0x162084];return _0x34f95c;};'use strict';var _=require(_0x2476('0x0'));var moment=require('moment');var parser=require('xml2json');var util=require(_0x2476('0x1'));var logger=require('../../config/logger')(_0x2476('0x2'));var rpc=require(_0x2476('0x3'));var mailRpc=require(_0x2476('0x4'));var Graph=require(_0x2476('0x5'));var Vertices=require('./vertices');var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0x2476('0x6')]()[_0x2476('0x7')](function(_0x3e5cfe){logger[_0x2476('0x8')](_0x2476('0x9'),_0x3e5cfe[_0x2476('0xa')]);return[];});}function addVertex(_0x4d9e1a,_0x33e04d,_0x4735ed){_0x33e04d[_0x2476('0xb')]=_0x4735ed;if(_0x33e04d['hasOwnProperty'](_0x2476('0xc'))){_0x33e04d[_0x2476('0xd')]=parseInt(_0x33e04d[_0x2476('0xc')],0xa);}_0x4d9e1a['addVertex'](_[_0x2476('0xe')](_0x33e04d,_0x2476('0xf')));}function initGraph(_0x955270,_0x2059a4){var _0x57b62d=new Graph();for(var _0x599a53 in _0x955270){if(_0x955270[_0x2476('0x10')](_0x599a53)){if(_[_0x2476('0x11')](_0x955270[_0x599a53])){for(var _0x4fad5f=0x0;_0x4fad5f<_0x955270[_0x599a53][_0x2476('0x12')];_0x4fad5f+=0x1){addVertex(_0x57b62d,_0x955270[_0x599a53][_0x4fad5f],_0x599a53);}}else{addVertex(_0x57b62d,_0x955270[_0x599a53],_0x599a53);}}}for(var _0x989797=0x0;_0x989797<_0x2059a4[_0x2476('0x12')];_0x989797+=0x1){if(_0x2059a4[_0x989797][_0x2476('0x13')]&&_0x2059a4[_0x989797]['target']){_0x57b62d[_0x2476('0x14')](_0x2059a4[_0x989797][_0x2476('0x13')],_0x2059a4[_0x989797]['target'],_0x2059a4[_0x989797][_0x2476('0x15')]);}}return _0x57b62d;}function getRoot(_0x523af0){return parser[_0x2476('0x16')](_0x523af0,{'object':!![]})['mxGraphModel'][_0x2476('0x17')];}function inspect(_0xbd3015){return util['inspect'](_0xbd3015,{'showHidden':![],'depth':null});}function initialize(_0x3bbc96,_0x5a58bd){var _0x4cd348=getRoot(_0x3bbc96['production']);if(!_0x4cd348||!_0x4cd348[_0x2476('0x18')])return;var _0x251714,_0x5b12c9,_0x4882e0;logger[_0x2476('0x19')]('root',JSON[_0x2476('0x1a')](_0x4cd348,null,0x2));_0x5a58bd[_0x2476('0x1b')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x251714=initGraph(_['omit'](_0x4cd348,_0x2476('0xf')),_0x4cd348['mxCell']);_0x5b12c9=new Vertices(_0x5a58bd,rpc,mailRpc);logger[_0x2476('0x1c')](util[_0x2476('0x1d')](_0x2476('0x1e'),_0x5a58bd[_0x2476('0x1f')],_0x5a58bd[_0x2476('0x20')],_0x5a58bd[_0x2476('0x21')],_0x5a58bd[_0x2476('0x22')],_0x5a58bd[_0x2476('0x23')]));_0x251714[_0x2476('0x24')](_0x4cd348[_0x2476('0x18')]['id'],function(_0x1413f8){try{_0x1413f8=_0x5b12c9[_0x2476('0x25')](_0x1413f8);logger[_0x2476('0x19')]('vertex',JSON['stringify'](_0x1413f8,null,0x2));if(_0x1413f8[_0x2476('0xb')]===_0x2476('0x26')){logger[_0x2476('0x1c')](_0x2476('0x27'));_0x5a58bd[_0x2476('0x28')]=_0x1413f8['context']||_0x5a58bd['context'];_0x5a58bd[_0x2476('0x29')]=_0x1413f8[_0x2476('0x29')];_0x5a58bd[_0x2476('0x2a')]=_0x1413f8['priority']?_0x1413f8[_0x2476('0x2a')]-0x1:0x1;return null;}else if(_0x1413f8&&_0x5b12c9[_0x1413f8['agicommand']]){_0x4882e0=_0x5b12c9[_0x1413f8['agicommand']](_0x1413f8);logger[_0x2476('0x1c')](_0x2476('0x2b'),JSON[_0x2476('0x1a')](_0x4882e0,null,0x2));if(_0x4882e0&&_0x4882e0['code']===AGI_CODE_SUCCESS&&_0x4882e0['result']!==AGI_RESULT_ERROR&&!_0x5a58bd[_0x2476('0x2c')]){logger['debug'](_0x2476('0x2b'),inspect(_0x4882e0));return _[_0x2476('0x2d')](_0x4882e0[_0x2476('0x2e')])?null:_0x4882e0['result'][_0x2476('0x2f')]();}else{logger[_0x2476('0x8')](_0x2476('0x2b'),inspect(_0x4882e0));return null;}}else{logger[_0x2476('0x8')](_0x2476('0x30'));return null;}}catch(_0x3b99d9){logger[_0x2476('0x8')](_0x3b99d9['stack']);return null;}});if(_0x4cd348['finally']){logger[_0x2476('0x1c')](util[_0x2476('0x1d')](_0x2476('0x31'),_0x5a58bd[_0x2476('0x1f')],_0x5a58bd[_0x2476('0x20')],_0x5a58bd[_0x2476('0x21')],_0x5a58bd[_0x2476('0x22')],_0x5a58bd[_0x2476('0x23')]));_0x251714[_0x2476('0x24')](_0x4cd348[_0x2476('0x32')]['id'],function(_0x90e578){try{_0x90e578=_0x5b12c9['clear'](_0x90e578);logger[_0x2476('0x19')]('vertex',JSON[_0x2476('0x1a')](_0x90e578,null,0x2));if(_0x90e578&&_0x5b12c9[_0x90e578['agicommand']]){_0x4882e0=_0x5b12c9[_0x90e578[_0x2476('0xb')]](_0x90e578);if(_0x4882e0){logger[_0x2476('0x19')](_0x2476('0x2b'),inspect(_0x4882e0));return _[_0x2476('0x2d')](_0x4882e0[_0x2476('0x2e')])?null:_0x4882e0[_0x2476('0x2e')]['toString']();}else{logger['error']('response',inspect(_0x4882e0));return null;}}else{logger[_0x2476('0x8')](_0x2476('0x30'));return null;}}catch(_0x45360e){logger[_0x2476('0x8')](_0x45360e[_0x2476('0xa')]);return null;}});}logger[_0x2476('0x1c')](util[_0x2476('0x1d')](_0x2476('0x33'),_0x5a58bd['arg_1'],_0x5a58bd[_0x2476('0x20')],_0x5a58bd[_0x2476('0x21')],_0x5a58bd[_0x2476('0x22')],_0x5a58bd[_0x2476('0x23')]));logger[_0x2476('0x1c')](util[_0x2476('0x1d')](_0x2476('0x34'),_0x5a58bd[_0x2476('0x28')],_0x5a58bd[_0x2476('0x29')],parseInt(_0x5a58bd[_0x2476('0x2a')],0xa)+0x1));_0x5a58bd[_0x2476('0x35')](_0x5a58bd[_0x2476('0x28')],_0x5a58bd[_0x2476('0x29')],parseInt(_0x5a58bd[_0x2476('0x2a')],0xa)+0x1);_0x5a58bd[_0x2476('0x36')]();}function handleNotFound(_0x2d41cd){logger['error'](util[_0x2476('0x1d')](_0x2476('0x37'),_0x2d41cd['arg_1']));_0x2d41cd['continueAt'](_0x2d41cd['context'],_0x2d41cd[_0x2476('0x29')],parseInt(_0x2d41cd[_0x2476('0x2a')],0xa)+0x1);_0x2d41cd['close']();}function handleUnpublished(_0x193812){logger[_0x2476('0x8')](util[_0x2476('0x1d')](_0x2476('0x38'),_0x193812['arg_1']));_0x193812[_0x2476('0x35')](_0x193812[_0x2476('0x28')],_0x193812['extension'],parseInt(_0x193812[_0x2476('0x2a')],0xa)+0x1);_0x193812['close']();}module[_0x2476('0x39')]={'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 6a23868..c923208 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 _0x066d=['util','stream','Transform','_localBuffer','_inBody','inherits','prototype','_transform','\x0d\x0a\x0d\x0a','toString','indexOf','substring','length','split','slice','trim','emit','exports'];(function(_0x3d1c53,_0xa162b9){var _0xe2b7d3=function(_0x528de0){while(--_0x528de0){_0x3d1c53['push'](_0x3d1c53['shift']());}};_0xe2b7d3(++_0xa162b9);}(_0x066d,0x1b0));var _0xd066=function(_0x2c0eb5,_0x1c1d3e){_0x2c0eb5=_0x2c0eb5-0x0;var _0xf3ea2d=_0x066d[_0x2c0eb5];return _0xf3ea2d;};'use strict';var util=require(_0xd066('0x0'));var Transform=require(_0xd066('0x1'))[_0xd066('0x2')];function AGIReply(_0x1781c3){Transform['call'](this,_0x1781c3);this[_0xd066('0x3')]='';this[_0xd066('0x4')]=![];}util[_0xd066('0x5')](AGIReply,Transform);AGIReply[_0xd066('0x6')][_0xd066('0x7')]=function(_0xbcf0c0,_0x5c1c4e,_0x48f606){var _0x32c24b='\x0a',_0x399428=['\x0a\x0a',_0xd066('0x8')],_0x17093d=-0x1,_0x5e32e1=-0x1,_0x4ab31a='',_0x1e2836=0x0,_0x5831f4='',_0x1cd603='';this['_localBuffer']+=_0xbcf0c0[_0xd066('0x9')]();_0x5831f4=this[_0xd066('0x3')];if(!this[_0xd066('0x4')]){_0x1e2836=0x0;while(_0x399428[_0x1e2836]){while((_0x5e32e1=_0x5831f4[_0xd066('0xa')](_0x399428[_0x1e2836]))!=-0x1){_0x4ab31a=_0x399428[_0x1e2836];_0x1cd603=_0x5831f4[_0xd066('0xb')](0x0,_0x5e32e1);_0x5831f4=_0x5831f4[_0xd066('0xb')](_0x5e32e1+_0x4ab31a[_0xd066('0xc')]);var _0x3287f5=_0x1cd603[_0xd066('0xd')](_0x32c24b),_0x168615=0x0,_0x111783={},_0x5329a2='',_0x543c12='',_0x22d768=-0x1;while(_0x3287f5[_0x168615]){_0x22d768=_0x3287f5[_0x168615][_0xd066('0xa')](':');if(_0x22d768!=-0x1){_0x5329a2=_0x3287f5[_0x168615][_0xd066('0xe')](0x0,_0x22d768)[_0xd066('0xf')]();_0x543c12=_0x3287f5[_0x168615]['slice'](_0x22d768+0x1)[_0xd066('0xf')]();if(_0x5329a2[_0xd066('0xc')]>0x0){_0x111783[_0x5329a2]=_0x543c12;}}else{}_0x168615++;}this['emit']('headers',_0x111783);this['_inBody']=!![];}_0x1e2836++;}this[_0xd066('0x3')]=_0x5831f4;}else{while((_0x17093d=_0x5831f4['indexOf'](_0x32c24b))!=-0x1){_0x1cd603=_0x5831f4[_0xd066('0xb')](0x0,_0x17093d);this[_0xd066('0x10')]('line',_0x1cd603);_0x5831f4=_0x5831f4[_0xd066('0xb')](_0x17093d+_0x32c24b[_0xd066('0xc')]);}this[_0xd066('0x3')]=_0x5831f4;}_0x48f606();};module[_0xd066('0x11')]=AGIReply; \ No newline at end of file +var _0x165f=['prototype','_transform','indexOf','substring','length','trim','slice','emit','headers','_inBody','exports','util','Transform','call','_localBuffer','inherits'];(function(_0x6060ce,_0x3aeb7a){var _0xecd553=function(_0x492635){while(--_0x492635){_0x6060ce['push'](_0x6060ce['shift']());}};_0xecd553(++_0x3aeb7a);}(_0x165f,0x6b));var _0xf165=function(_0x3a0f39,_0x3c38b4){_0x3a0f39=_0x3a0f39-0x0;var _0xd9bb28=_0x165f[_0x3a0f39];return _0xd9bb28;};'use strict';var util=require(_0xf165('0x0'));var Transform=require('stream')[_0xf165('0x1')];function AGIReply(_0x55f9d4){Transform[_0xf165('0x2')](this,_0x55f9d4);this[_0xf165('0x3')]='';this['_inBody']=![];}util[_0xf165('0x4')](AGIReply,Transform);AGIReply[_0xf165('0x5')][_0xf165('0x6')]=function(_0x2f6be9,_0x4f7c58,_0x413e24){var _0x1764ae='\x0a',_0x24f1a1=['\x0a\x0a','\x0d\x0a\x0d\x0a'],_0x208d35=-0x1,_0x31e1e6=-0x1,_0x5415d1='',_0x5372b6=0x0,_0x12ffde='',_0x1abeb4='';this[_0xf165('0x3')]+=_0x2f6be9['toString']();_0x12ffde=this[_0xf165('0x3')];if(!this['_inBody']){_0x5372b6=0x0;while(_0x24f1a1[_0x5372b6]){while((_0x31e1e6=_0x12ffde[_0xf165('0x7')](_0x24f1a1[_0x5372b6]))!=-0x1){_0x5415d1=_0x24f1a1[_0x5372b6];_0x1abeb4=_0x12ffde['substring'](0x0,_0x31e1e6);_0x12ffde=_0x12ffde[_0xf165('0x8')](_0x31e1e6+_0x5415d1[_0xf165('0x9')]);var _0x565ca9=_0x1abeb4['split'](_0x1764ae),_0x5ae391=0x0,_0x186f0c={},_0x2a74a0='',_0x51d74c='',_0x2cba2e=-0x1;while(_0x565ca9[_0x5ae391]){_0x2cba2e=_0x565ca9[_0x5ae391][_0xf165('0x7')](':');if(_0x2cba2e!=-0x1){_0x2a74a0=_0x565ca9[_0x5ae391]['slice'](0x0,_0x2cba2e)[_0xf165('0xa')]();_0x51d74c=_0x565ca9[_0x5ae391][_0xf165('0xb')](_0x2cba2e+0x1)[_0xf165('0xa')]();if(_0x2a74a0[_0xf165('0x9')]>0x0){_0x186f0c[_0x2a74a0]=_0x51d74c;}}else{}_0x5ae391++;}this[_0xf165('0xc')](_0xf165('0xd'),_0x186f0c);this[_0xf165('0xe')]=!![];}_0x5372b6++;}this['_localBuffer']=_0x12ffde;}else{while((_0x208d35=_0x12ffde[_0xf165('0x7')](_0x1764ae))!=-0x1){_0x1abeb4=_0x12ffde['substring'](0x0,_0x208d35);this['emit']('line',_0x1abeb4);_0x12ffde=_0x12ffde['substring'](_0x208d35+_0x1764ae[_0xf165('0x9')]);}this['_localBuffer']=_0x12ffde;}_0x413e24();};module[_0xf165('0xf')]=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index 631ed5d..6d231b6 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 _0x00bb=['email','getSquareProjectById','getVoiceQueueById','getVariableById','ShowSquareOdbc','dsn','getUserById','phone','ShowTrunk','save_name','getIntervalById','ShowInterval','Intervals','ShowSmsAccount','createSmsMessage','createSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_2','CreateSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','CreateCmContact','ShowPause','agentLogin','LoginUser','agentPause','PauseUser','UnpauseUser','lodash','moment','jayson/promise','http','request','then','message','result','catch','getSquareProjects','GetSquareProjects','getSquareProject','ShowSquareProject','production','getMailAccountById','ShowMailAccount','CloudProvider','name'];(function(_0x1e8eb4,_0x53a726){var _0x3e3e6e=function(_0x29dbf3){while(--_0x29dbf3){_0x1e8eb4['push'](_0x1e8eb4['shift']());}};_0x3e3e6e(++_0x53a726);}(_0x00bb,0x1d8));var _0xb00b=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x00bb[_0x6131cd];return _0x47e916;};'use strict';var _=require(_0xb00b('0x0'));var moment=require(_0xb00b('0x1'));var jayson=require(_0xb00b('0x2'));var client=jayson['client'][_0xb00b('0x3')]({'port':0x2329});function request(_0x47a3bf,_0x278c5e){return new Promise(function(_0x464fe7,_0x582ef9){return client[_0xb00b('0x4')](_0x47a3bf,_0x278c5e)[_0xb00b('0x5')](function(_0x5b3b34){if(_0x5b3b34['error']){return _0x582ef9(_0x5b3b34['error'][_0xb00b('0x6')]);}else{return _0x464fe7(_0x5b3b34[_0xb00b('0x7')]);}})[_0xb00b('0x8')](function(_0x37f07d){return _0x582ef9(_0x37f07d);});});}exports[_0xb00b('0x9')]=function(){return request(_0xb00b('0xa'),{'options':{'raw':![],'attributes':['id','name','production']}});};exports[_0xb00b('0xb')]=function(_0x1e9b7b){return request(_0xb00b('0xc'),{'options':{'raw':![],'where':{'name':_0x1e9b7b},'attributes':[_0xb00b('0xd')]}});};exports[_0xb00b('0xe')]=function(_0x48e125){return request(_0xb00b('0xf'),{'options':{'raw':![],'where':{'id':_0x48e125},'include':[{'model':'MailServerOut','as':'Smtp','include':[{'model':'CloudProvider','as':_0xb00b('0x10')}]}],'attributes':['id',_0xb00b('0x11'),_0xb00b('0x12')],'smtp':!![]}});};exports[_0xb00b('0x13')]=function(_0xef5d52){return request(_0xb00b('0xc'),{'options':{'where':{'id':_0xef5d52},'attributes':['name']}});};exports[_0xb00b('0x14')]=function(_0xb0d42e){return request('ShowVoiceQueue',{'options':{'where':{'id':_0xb0d42e},'attributes':[_0xb00b('0x11')]}});};exports[_0xb00b('0x15')]=function(_0x540b79){return request('ShowVariable',{'options':{'where':{'id':_0x540b79},'attributes':[_0xb00b('0x11')]}});};exports['getSquareOdbcById']=function(_0x51d136){return request(_0xb00b('0x16'),{'options':{'where':{'id':_0x51d136},'attributes':[_0xb00b('0x17')]}});};exports[_0xb00b('0x18')]=function(_0xbb72fc){return request('ShowUser',{'options':{'where':{'id':_0xbb72fc},'attributes':[_0xb00b('0x11')]}});};exports['getContactByPhone']=function(_0x415f91){return request('GetContactByPhone',{'options':{'where':{'phone':_0x415f91[_0xb00b('0x19')]},'attributes':['id']}});};exports['getTrunkById']=function(_0xb26ebb){return request(_0xb00b('0x1a'),{'options':{'where':{'id':_0xb26ebb},'attributes':['name']}});};exports['getSoundById']=function(_0x2b0da1){return request('ShowSound',{'options':{'where':{'id':_0x2b0da1},'attributes':[_0xb00b('0x1b')]}});};exports[_0xb00b('0x1c')]=function(_0x2fe48d){return request(_0xb00b('0x1d'),{'options':{'raw':![],'where':{'id':_0x2fe48d},'include':[{'model':'Interval','as':_0xb00b('0x1e')}]}});};exports['getSmsAccountById']=function(_0x25a973){return request(_0xb00b('0x1f'),{'options':{'where':{'id':_0x25a973},'attributes':['id','name']}});};exports[_0xb00b('0x20')]=function(_0x2896d1){return request('CreateSmsMessage',{'body':_0x2896d1});};exports[_0xb00b('0x21')]=function(_0x1f04d3){return request('CreateSquareDetailsReport',{'body':_0x1f04d3});};exports[_0xb00b('0x22')]=function(_0x243fdb){return request(_0xb00b('0x23'),{'body':_[_0xb00b('0x24')](_0x243fdb,{'project_name':_0x243fdb['arg_1'],'prev_project_name':_0x243fdb['arg_2']||'','is_subproject':_0x243fdb[_0xb00b('0x25')]?!![]:![],'leaveAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')})});};exports['createSquareRecording']=function(_0x16ac55){return request(_0xb00b('0x26'),{'body':_0x16ac55});};exports[_0xb00b('0x27')]=function(_0x3825af){return request(_0xb00b('0x28'),{'body':_0x3825af});};exports[_0xb00b('0x29')]=function(_0x15d3b9){return request('ShowCmHopper',{'options':{'raw':![],'where':{'phone':_0x15d3b9[_0xb00b('0x19')],'ListId':_0x15d3b9['ListId']}}})[_0xb00b('0x5')](function(_0x348165){if(_0x348165){return _0x348165;}return request(_0xb00b('0x2a'),{'body':_0x15d3b9});});};exports['getPauseById']=function(_0x2fc11a){return request(_0xb00b('0x2b'),{'options':{'where':{'id':_0x2fc11a},'attributes':[_0xb00b('0x11')]}});};exports[_0xb00b('0x2c')]=function(_0x303625,_0x2b9824){return request(_0xb00b('0x2d'),{'body':{'interface':_0x2b9824},'options':{'where':_0x303625}});};exports[_0xb00b('0x2e')]=function(_0x149c1a,_0x54e247,_0x2b5f41){return request(_0xb00b('0x2f'),{'body':{'type':_0x54e247,'uniqueid':_0x2b5f41},'options':{'where':_0x149c1a}});};exports['agentUnpause']=function(_0x593659){return request(_0xb00b('0x30'),{'body':{},'options':{'where':_0x593659}});};exports['agentLogout']=function(_0x456241){return request('LogoutUser',{'body':{},'options':{'where':_0x456241}});}; \ No newline at end of file +var _0xac55=['getPauseById','ShowPause','agentLogin','agentPause','PauseUser','UnpauseUser','agentLogout','LogoutUser','lodash','moment','jayson/promise','client','request','then','message','result','catch','getSquareProjects','GetSquareProjects','name','ShowSquareProject','getMailAccountById','MailServerOut','Smtp','CloudProvider','email','getSquareProjectById','ShowVoiceQueue','getVariableById','ShowVariable','getSquareOdbcById','ShowSquareOdbc','dsn','getUserById','ShowUser','getContactByPhone','phone','getSoundById','ShowSound','save_name','Interval','Intervals','ShowSmsAccount','createSmsMessage','CreateSmsMessage','CreateSquareDetailsReport','createSquareReport','merge','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ListId'];(function(_0x1be3b3,_0x4335ee){var _0x4f8b2d=function(_0x1d955f){while(--_0x1d955f){_0x1be3b3['push'](_0x1be3b3['shift']());}};_0x4f8b2d(++_0x4335ee);}(_0xac55,0x1c8));var _0x5ac5=function(_0x2d3a8c,_0x340543){_0x2d3a8c=_0x2d3a8c-0x0;var _0x1da990=_0xac55[_0x2d3a8c];return _0x1da990;};'use strict';var _=require(_0x5ac5('0x0'));var moment=require(_0x5ac5('0x1'));var jayson=require(_0x5ac5('0x2'));var client=jayson[_0x5ac5('0x3')]['http']({'port':0x2329});function request(_0x17b1d9,_0x13fcc6){return new Promise(function(_0x192f9d,_0x1cdfec){return client[_0x5ac5('0x4')](_0x17b1d9,_0x13fcc6)[_0x5ac5('0x5')](function(_0x234650){if(_0x234650['error']){return _0x1cdfec(_0x234650['error'][_0x5ac5('0x6')]);}else{return _0x192f9d(_0x234650[_0x5ac5('0x7')]);}})[_0x5ac5('0x8')](function(_0x42551a){return _0x1cdfec(_0x42551a);});});}exports[_0x5ac5('0x9')]=function(){return request(_0x5ac5('0xa'),{'options':{'raw':![],'attributes':['id',_0x5ac5('0xb'),'production']}});};exports['getSquareProject']=function(_0x2414f9){return request(_0x5ac5('0xc'),{'options':{'raw':![],'where':{'name':_0x2414f9},'attributes':['production']}});};exports[_0x5ac5('0xd')]=function(_0x294425){return request('ShowMailAccount',{'options':{'raw':![],'where':{'id':_0x294425},'include':[{'model':_0x5ac5('0xe'),'as':_0x5ac5('0xf'),'include':[{'model':'CloudProvider','as':_0x5ac5('0x10')}]}],'attributes':['id',_0x5ac5('0xb'),_0x5ac5('0x11')],'smtp':!![]}});};exports[_0x5ac5('0x12')]=function(_0x34260c){return request('ShowSquareProject',{'options':{'where':{'id':_0x34260c},'attributes':[_0x5ac5('0xb')]}});};exports['getVoiceQueueById']=function(_0x1ce256){return request(_0x5ac5('0x13'),{'options':{'where':{'id':_0x1ce256},'attributes':['name']}});};exports[_0x5ac5('0x14')]=function(_0x57377b){return request(_0x5ac5('0x15'),{'options':{'where':{'id':_0x57377b},'attributes':[_0x5ac5('0xb')]}});};exports[_0x5ac5('0x16')]=function(_0x1282be){return request(_0x5ac5('0x17'),{'options':{'where':{'id':_0x1282be},'attributes':[_0x5ac5('0x18')]}});};exports[_0x5ac5('0x19')]=function(_0x5510ef){return request(_0x5ac5('0x1a'),{'options':{'where':{'id':_0x5510ef},'attributes':['name']}});};exports[_0x5ac5('0x1b')]=function(_0x14d164){return request('GetContactByPhone',{'options':{'where':{'phone':_0x14d164[_0x5ac5('0x1c')]},'attributes':['id']}});};exports['getTrunkById']=function(_0x264422){return request('ShowTrunk',{'options':{'where':{'id':_0x264422},'attributes':['name']}});};exports[_0x5ac5('0x1d')]=function(_0x4c57e0){return request(_0x5ac5('0x1e'),{'options':{'where':{'id':_0x4c57e0},'attributes':[_0x5ac5('0x1f')]}});};exports['getIntervalById']=function(_0x4066f5){return request('ShowInterval',{'options':{'raw':![],'where':{'id':_0x4066f5},'include':[{'model':_0x5ac5('0x20'),'as':_0x5ac5('0x21')}]}});};exports['getSmsAccountById']=function(_0x47a898){return request(_0x5ac5('0x22'),{'options':{'where':{'id':_0x47a898},'attributes':['id',_0x5ac5('0xb')]}});};exports[_0x5ac5('0x23')]=function(_0x182683){return request(_0x5ac5('0x24'),{'body':_0x182683});};exports['createSquareDetailsReport']=function(_0x6e1120){return request(_0x5ac5('0x25'),{'body':_0x6e1120});};exports[_0x5ac5('0x26')]=function(_0x11b8ce){return request('CreateSquareReport',{'body':_[_0x5ac5('0x27')](_0x11b8ce,{'project_name':_0x11b8ce['arg_1'],'prev_project_name':_0x11b8ce[_0x5ac5('0x28')]||'','is_subproject':_0x11b8ce[_0x5ac5('0x28')]?!![]:![],'leaveAt':moment()[_0x5ac5('0x29')](_0x5ac5('0x2a'))})});};exports[_0x5ac5('0x2b')]=function(_0x3b3ec0){return request('CreateSquareRecording',{'body':_0x3b3ec0});};exports[_0x5ac5('0x2c')]=function(_0x4a5f4d){return request(_0x5ac5('0x2d'),{'body':_0x4a5f4d});};exports[_0x5ac5('0x2e')]=function(_0x35535f){return request('ShowCmHopper',{'options':{'raw':![],'where':{'phone':_0x35535f[_0x5ac5('0x1c')],'ListId':_0x35535f[_0x5ac5('0x2f')]}}})[_0x5ac5('0x5')](function(_0x21307c){if(_0x21307c){return _0x21307c;}return request('CreateCmContact',{'body':_0x35535f});});};exports[_0x5ac5('0x30')]=function(_0x4e4b3e){return request(_0x5ac5('0x31'),{'options':{'where':{'id':_0x4e4b3e},'attributes':[_0x5ac5('0xb')]}});};exports[_0x5ac5('0x32')]=function(_0x2fded3,_0x41a83a){return request('LoginUser',{'body':{'interface':_0x41a83a},'options':{'where':_0x2fded3}});};exports[_0x5ac5('0x33')]=function(_0x21116,_0x36285d,_0x4f5deb){return request(_0x5ac5('0x34'),{'body':{'type':_0x36285d,'uniqueid':_0x4f5deb},'options':{'where':_0x21116}});};exports['agentUnpause']=function(_0x472782){return request(_0x5ac5('0x35'),{'body':{},'options':{'where':_0x472782}});};exports[_0x5ac5('0x36')]=function(_0x314639){return request(_0x5ac5('0x37'),{'body':{},'options':{'where':_0x314639}});}; \ 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 1d3c9dd..84c3087 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 _0xdc86=['./lex'];(function(_0x1deb60,_0x29c823){var _0x3b2b66=function(_0x5a51dc){while(--_0x5a51dc){_0x1deb60['push'](_0x1deb60['shift']());}};_0x3b2b66(++_0x29c823);}(_0xdc86,0x118));var _0x6dc8=function(_0x5a776b,_0x46f785){_0x5a776b=_0x5a776b-0x0;var _0xbbef59=_0xdc86[_0x5a776b];return _0xbbef59;};var polly=require('./polly');var lex=require(_0x6dc8('0x0'));module['exports']={'polly':polly,'lex':lex}; \ No newline at end of file +var _0x158f=['exports','./lex'];(function(_0x82140,_0x3a9d87){var _0x2b15a6=function(_0x2b565e){while(--_0x2b565e){_0x82140['push'](_0x82140['shift']());}};_0x2b15a6(++_0x3a9d87);}(_0x158f,0x137));var _0xf158=function(_0x241119,_0x426e1e){_0x241119=_0x241119-0x0;var _0x417add=_0x158f[_0x241119];return _0x417add;};var polly=require('./polly');var lex=require(_0xf158('0x0'));module[_0xf158('0x1')]={'polly':polly,'lex':lex}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/index.js b/server/services/agi/scripts/aws/lex/index.js index 42c1677..06fb827 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 _0xf4eb=['./lib/api'];(function(_0x39fd11,_0x5d7883){var _0x302799=function(_0x4a0615){while(--_0x4a0615){_0x39fd11['push'](_0x39fd11['shift']());}};_0x302799(++_0x5d7883);}(_0xf4eb,0xec));var _0xbf4e=function(_0x18c448,_0x158095){_0x18c448=_0x18c448-0x0;var _0x489795=_0xf4eb[_0x18c448];return _0x489795;};'use strict';var lex=require(_0xbf4e('0x0'));module['exports']=function(_0x50f2fc,_0x479210,_0x5ed5b9,_0xbbbf01,_0x49d80e,_0x4e7fa7){return lex(_0x50f2fc,_0x479210,_0x5ed5b9,_0xbbbf01,_0x49d80e,_0x4e7fa7);}; \ No newline at end of file +var _0x96cc=['./lib/api'];(function(_0x2e9ee7,_0x1b9a8b){var _0xd3e252=function(_0x2840ab){while(--_0x2840ab){_0x2e9ee7['push'](_0x2e9ee7['shift']());}};_0xd3e252(++_0x1b9a8b);}(_0x96cc,0x16c));var _0xc96c=function(_0x279755,_0x42ad77){_0x279755=_0x279755-0x0;var _0x138178=_0x96cc[_0x279755];return _0x138178;};'use strict';var lex=require(_0xc96c('0x0'));module['exports']=function(_0x15025f,_0x5f11f2,_0x30bf8a,_0x3e7a95,_0x107043,_0x421701){return lex(_0x15025f,_0x5f11f2,_0x30bf8a,_0x3e7a95,_0x107043,_0x421701);}; \ 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 ced383b..2477ddb 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(_0x39761c,_0x43ebf5){var _0x289b97=function(_0x9da173){while(--_0x9da173){_0x39761c['push'](_0x39761c['shift']());}};_0x289b97(++_0x43ebf5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0xa9e0[_0x5447fd];return _0x15b28a;};'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(_0x1e5384,_0x5225a3){var _0x490940=function(_0x595af0){while(--_0x595af0){_0x1e5384['push'](_0x1e5384['shift']());}};_0x490940(++_0x5225a3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x138f59,_0x1b53fb){_0x138f59=_0x138f59-0x0;var _0x3d114d=_0xa9e0[_0x138f59];return _0x3d114d;};'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 4747340..4fdba2f 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 _0x37a7=['./lib/api','exports'];(function(_0xfcb7f4,_0x12b849){var _0x503dd9=function(_0x498b04){while(--_0x498b04){_0xfcb7f4['push'](_0xfcb7f4['shift']());}};_0x503dd9(++_0x12b849);}(_0x37a7,0x172));var _0x737a=function(_0x59c3fe,_0x2c4c4b){_0x59c3fe=_0x59c3fe-0x0;var _0x132a6c=_0x37a7[_0x59c3fe];return _0x132a6c;};'use strict';var polly=require(_0x737a('0x0'));module[_0x737a('0x1')]=function(_0x48c1b9,_0x4f5f07,_0x2f6d3d,_0x7a6fd8,_0x23eda9,_0x47ab61,_0x5b1001){return polly(_0x48c1b9,_0x4f5f07,_0x2f6d3d,_0x7a6fd8,_0x23eda9,_0x47ab61,_0x5b1001);}; \ No newline at end of file +var _0x2de9=['exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2de9,0x134));var _0x92de=function(_0x10161b,_0x59abc2){_0x10161b=_0x10161b-0x0;var _0x43fcb4=_0x2de9[_0x10161b];return _0x43fcb4;};'use strict';var polly=require('./lib/api');module[_0x92de('0x0')]=function(_0x40d738,_0x29279e,_0x23049e,_0x4792f9,_0x31d73a,_0x1a9052,_0x274557){return polly(_0x40d738,_0x29279e,_0x23049e,_0x4792f9,_0x31d73a,_0x1a9052,_0x274557);}; \ 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 ed35c80..d8b6ae6 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 _0x2450=['bluebird','randomstring','aws-sdk','synthesizeSpeech','AudioStream','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','text','mp3'];(function(_0x2160a9,_0x3cbd9e){var _0xa88cf7=function(_0x51ab6f){while(--_0x51ab6f){_0x2160a9['push'](_0x2160a9['shift']());}};_0xa88cf7(++_0x3cbd9e);}(_0x2450,0x75));var _0x0245=function(_0x3616b6,_0x4eeb4a){_0x3616b6=_0x3616b6-0x0;var _0x30a282=_0x2450[_0x3616b6];return _0x30a282;};'use strict';var fs=require('fs');var path=require('path');var BPromise=require(_0x0245('0x0'));var rs=require(_0x0245('0x1'));var AWS=require(_0x0245('0x2'));function pollyResult(_0x4c5f8e,_0x59c4ef,_0x494291){return new BPromise(function(_0x13473e,_0x151a73){_0x4c5f8e[_0x0245('0x3')](_0x59c4ef,function(_0x2110ea,_0x511aae){if(_0x2110ea){_0x151a73(_0x2110ea);}else if(_0x511aae){if(_0x511aae[_0x0245('0x4')]instanceof Buffer){fs[_0x0245('0x5')](_0x494291,_0x511aae['AudioStream'],function(_0x4d698a){if(_0x4d698a){_0x151a73(_0x4d698a);}else{_0x13473e();}});}else{_0x151a73(new Error(_0x0245('0x6')));}}else{_0x151a73(new Error('No\x20data\x20response\x20from\x20aws\x20Polly!'));}});});}module['exports']=function(_0x170cd3,_0x2a3a89,_0x4d30ee,_0x1c7f0b,_0x4eec0c,_0x48b228,_0x519845){var _0x59de16=new AWS['Polly']({'accessKeyId':_0x170cd3,'secretAccessKey':_0x2a3a89,'region':_0x4d30ee});var _0x1b4669={'Text':_0x4eec0c,'TextType':_0x48b228||_0x0245('0x7'),'OutputFormat':_0x0245('0x8'),'VoiceId':_0x1c7f0b};return pollyResult(_0x59de16,_0x1b4669,_0x519845);}; \ No newline at end of file +var _0x74be=['AudioStream','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','Polly','mp3','path','bluebird','randomstring','aws-sdk'];(function(_0x239688,_0x2ae4d1){var _0xd4a548=function(_0x53a3e7){while(--_0x53a3e7){_0x239688['push'](_0x239688['shift']());}};_0xd4a548(++_0x2ae4d1);}(_0x74be,0xef));var _0xe74b=function(_0x4f07cb,_0x2421d3){_0x4f07cb=_0x4f07cb-0x0;var _0x574246=_0x74be[_0x4f07cb];return _0x574246;};'use strict';var fs=require('fs');var path=require(_0xe74b('0x0'));var BPromise=require(_0xe74b('0x1'));var rs=require(_0xe74b('0x2'));var AWS=require(_0xe74b('0x3'));function pollyResult(_0x494531,_0x250c68,_0x2e28cf){return new BPromise(function(_0xb13dd0,_0x5b08e0){_0x494531['synthesizeSpeech'](_0x250c68,function(_0x2d63a3,_0x11fa5e){if(_0x2d63a3){_0x5b08e0(_0x2d63a3);}else if(_0x11fa5e){if(_0x11fa5e[_0xe74b('0x4')]instanceof Buffer){fs['writeFile'](_0x2e28cf,_0x11fa5e[_0xe74b('0x4')],function(_0x15b7cc){if(_0x15b7cc){_0x5b08e0(_0x15b7cc);}else{_0xb13dd0();}});}else{_0x5b08e0(new Error(_0xe74b('0x5')));}}else{_0x5b08e0(new Error(_0xe74b('0x6')));}});});}module['exports']=function(_0x6a5231,_0x548c2a,_0x6854f8,_0x3c6dee,_0x7a592b,_0x591aa2,_0x895712){var _0x2cbcef=new AWS[(_0xe74b('0x7'))]({'accessKeyId':_0x6a5231,'secretAccessKey':_0x548c2a,'region':_0x6854f8});var _0x186a80={'Text':_0x7a592b,'TextType':_0x591aa2||'text','OutputFormat':_0xe74b('0x8'),'VoiceId':_0x3c6dee};return pollyResult(_0x2cbcef,_0x186a80,_0x895712);}; \ 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 74dfefa..6e6b707 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 _0xff28=['./lib/api','exports'];(function(_0x7ad0e3,_0x3c64db){var _0x201397=function(_0x1781f1){while(--_0x1781f1){_0x7ad0e3['push'](_0x7ad0e3['shift']());}};_0x201397(++_0x3c64db);}(_0xff28,0x66));var _0x8ff2=function(_0x402731,_0x43c115){_0x402731=_0x402731-0x0;var _0x111736=_0xff28[_0x402731];return _0x111736;};'use strict';var asr=require(_0x8ff2('0x0'));module[_0x8ff2('0x1')]=function(_0xa2553e,_0x1e2114,_0x2d9c2d,_0x26ca83){return asr(_0xa2553e,_0x1e2114,_0x2d9c2d);}; \ No newline at end of file +var _0x0221=['./lib/api'];(function(_0x2ff238,_0x1811d2){var _0x204a56=function(_0x5bf2e1){while(--_0x5bf2e1){_0x2ff238['push'](_0x2ff238['shift']());}};_0x204a56(++_0x1811d2);}(_0x0221,0xc5));var _0x1022=function(_0x368dfc,_0x50eac6){_0x368dfc=_0x368dfc-0x0;var _0x24b66e=_0x0221[_0x368dfc];return _0x24b66e;};'use strict';var asr=require(_0x1022('0x0'));module['exports']=function(_0x2616ec,_0x11b483,_0x484d59,_0x8f1df1){return asr(_0x2616ec,_0x11b483,_0x484d59);}; \ 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 23a65e9..7385ccb 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 _0x1bca=['bluebird','string','length','filepath\x20should\x20be\x20a\x20string','key\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','readFileSync','toString','POST','/v1/speech:recognize?key=','LINEAR16','8000'];(function(_0x36f89c,_0x1e2de7){var _0x5bcdab=function(_0x56d052){while(--_0x56d052){_0x36f89c['push'](_0x36f89c['shift']());}};_0x5bcdab(++_0x1e2de7);}(_0x1bca,0xb6));var _0xa1bc=function(_0x137137,_0x4b96be){_0x137137=_0x137137-0x0;var _0x2ea972=_0x1bca[_0x137137];return _0x2ea972;};'use strict';var url=require('url');var BPromise=require(_0xa1bc('0x0'));var fs=require('fs');var host='https://speech.googleapis.com';module['exports']=function(_0x84fe95,_0x4feb3b,_0x1865b2){return new BPromise(function(_0x1fa3d2,_0x3469ad){var _0x543df3;if(typeof _0x84fe95!==_0xa1bc('0x1')||_0x84fe95[_0xa1bc('0x2')]===0x0){return _0x3469ad(_0xa1bc('0x3'));}if(typeof _0x4feb3b!==_0xa1bc('0x1')||_0x4feb3b['length']===0x0){return _0x3469ad(_0xa1bc('0x4'));}if(typeof _0x1865b2!==_0xa1bc('0x5')&&(typeof _0x1865b2!==_0xa1bc('0x1')||_0x1865b2[_0xa1bc('0x2')]===0x0)){return _0x3469ad(_0xa1bc('0x6'));}try{_0x543df3=fs[_0xa1bc('0x7')](_0x84fe95)[_0xa1bc('0x8')]('base64');}catch(_0x1b826d){return _0x3469ad(_0x1b826d);}return _0x1fa3d2({'method':_0xa1bc('0x9'),'uri':host+_0xa1bc('0xa')+_0x4feb3b,'body':{'config':{'encoding':_0xa1bc('0xb'),'sampleRateHertz':_0xa1bc('0xc'),'languageCode':_0x1865b2},'audio':{'content':_0x543df3}},'json':!![]});});}; \ No newline at end of file +var _0x6f7a=['string','length','filepath\x20should\x20be\x20a\x20string','key\x20should\x20be\x20a\x20string','lang\x20should\x20be\x20a\x20string','readFileSync','toString','base64','/v1/speech:recognize?key=','LINEAR16','url','bluebird','https://speech.googleapis.com','exports'];(function(_0x4af757,_0xe86c18){var _0x3b65d1=function(_0x31c7f6){while(--_0x31c7f6){_0x4af757['push'](_0x4af757['shift']());}};_0x3b65d1(++_0xe86c18);}(_0x6f7a,0x1ae));var _0xa6f7=function(_0x31252c,_0xaebf02){_0x31252c=_0x31252c-0x0;var _0x419db2=_0x6f7a[_0x31252c];return _0x419db2;};'use strict';var url=require(_0xa6f7('0x0'));var BPromise=require(_0xa6f7('0x1'));var fs=require('fs');var host=_0xa6f7('0x2');module[_0xa6f7('0x3')]=function(_0x4dd99d,_0x93614a,_0x407de3){return new BPromise(function(_0x12ecb8,_0x1da6dc){var _0x22e529;if(typeof _0x4dd99d!==_0xa6f7('0x4')||_0x4dd99d[_0xa6f7('0x5')]===0x0){return _0x1da6dc(_0xa6f7('0x6'));}if(typeof _0x93614a!==_0xa6f7('0x4')||_0x93614a[_0xa6f7('0x5')]===0x0){return _0x1da6dc(_0xa6f7('0x7'));}if(typeof _0x407de3!=='undefined'&&(typeof _0x407de3!=='string'||_0x407de3[_0xa6f7('0x5')]===0x0)){return _0x1da6dc(_0xa6f7('0x8'));}try{_0x22e529=fs[_0xa6f7('0x9')](_0x4dd99d)[_0xa6f7('0xa')](_0xa6f7('0xb'));}catch(_0x49a451){return _0x1da6dc(_0x49a451);}return _0x12ecb8({'method':'POST','uri':host+_0xa6f7('0xc')+_0x93614a,'body':{'config':{'encoding':_0xa6f7('0xd'),'sampleRateHertz':'8000','languageCode':_0x407de3},'audio':{'content':_0x22e529}},'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 6c9bc29..532a024 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 _0xa160=['exports','./asr'];(function(_0x1f87a3,_0x3799c5){var _0x17ebae=function(_0x55b076){while(--_0x55b076){_0x1f87a3['push'](_0x1f87a3['shift']());}};_0x17ebae(++_0x3799c5);}(_0xa160,0x129));var _0x0a16=function(_0x2d747a,_0x46743a){_0x2d747a=_0x2d747a-0x0;var _0x997146=_0xa160[_0x2d747a];return _0x997146;};var asr=require(_0x0a16('0x0'));module[_0x0a16('0x1')]={'asr':asr}; \ No newline at end of file +var _0x5ef9=['./asr','exports'];(function(_0x5c068c,_0x50f626){var _0x451b78=function(_0x42c56a){while(--_0x42c56a){_0x5c068c['push'](_0x5c068c['shift']());}};_0x451b78(++_0x50f626);}(_0x5ef9,0x128));var _0x95ef=function(_0x5a2285,_0x3212d1){_0x5a2285=_0x5a2285-0x0;var _0x48f6ed=_0x5ef9[_0x5a2285];return _0x48f6ed;};var asr=require(_0x95ef('0x0'));module[_0x95ef('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/scripts/index.js b/server/services/agi/scripts/index.js index 018b165..44948ef 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 _0xc133=['https','md5','querystring','request-promise','sox','google-tts-api','url','util','./aws','./google','./sestek','./tilde','agi','https://api.ispeech.org/api/rest','https:','path','WHAT_EVER','statusCode','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','createWriteStream','finish','info','finish\x20download\x20file','close','unlink','pipe','end','host','get','transcode','error\x20convert','finish\x20to\x20convert','resolve','tmp','generate','.wav','writeFileSync','base64','then','chmodSync','777','split','readFileSync','toString','https://texttospeech.googleapis.com/v1/','ssml','input','MP3','text:synthesize','POST','.mp3','audioContent','writeFile','googleCloudTTS\x20path','googleTTS','utf8','f.req=','jQ1olc','null','generic','parse\x20response\x20failed:\x0a','data','length','text\x20length\x20limit\x20reached','goggleTTS\x20path','googleASR','results','map','alternatives','transcript','confidence','join','googleASR\x20transcription','name','message','stringify','result','source','resolvedQuery','action','fulfillment','speech','score','status','code','metadata','endConversation','isFallbackIntent','googleDialogflowV2','SessionsClient','sessionPath','detectIntent','Dialogflow\x20V2\x20response:','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','fulfillmentText','displayName','intent','isFallback','languageCode','queryText','responseId','intentDetectionConfidence','tildeASR','asr','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','polly','awsLex','format','ispeechASR','sestekNDA','nda','text','channelData','CustomAction','CustomActionData','AudioFromTts','Data','audiofile','dirName','apiai-promise','bluebird'];(function(_0x2f28da,_0x2b8970){var _0x43d5aa=function(_0x508b56){while(--_0x508b56){_0x2f28da['push'](_0x2f28da['shift']());}};_0x43d5aa(++_0x2b8970);}(_0xc133,0x102));var _0x3c13=function(_0x4a77d5,_0x400c79){_0x4a77d5=_0x4a77d5-0x0;var _0x74afcf=_0xc133[_0x4a77d5];return _0x74afcf;};'use strict';var apiai=require(_0x3c13('0x0'));var BPromise=require(_0x3c13('0x1'));var dialogflow=require('dialogflow');var fs=require('fs');var http=require('http');var https=require(_0x3c13('0x2'));var md5=require(_0x3c13('0x3'));var path=require('path');var querystring=require(_0x3c13('0x4'));var rp=require(_0x3c13('0x5'));var rs=require('randomstring');var sox=require(_0x3c13('0x6'));var tts=require(_0x3c13('0x7'));var urlParse=require(_0x3c13('0x8'))['parse'];var util=require(_0x3c13('0x9'));var aws=require(_0x3c13('0xa'));var google=require(_0x3c13('0xb'));var sestek=require(_0x3c13('0xc'));var tilde=require(_0x3c13('0xd'));var logger=require('../../../config/logger')(_0x3c13('0xe'));var ISPEECH_API=_0x3c13('0xf');function downloadFile(_0x20e269,_0x5a1b6d){return new BPromise(function(_0x42cf3d,_0x498afa){var _0x55b5a5=urlParse(_0x20e269);var _0x414be3=_0x55b5a5['protocol']===_0x3c13('0x10')?https:http;var _0x58a37d={'host':_0x55b5a5['host'],'path':_0x55b5a5[_0x3c13('0x11')],'headers':{'user-agent':_0x3c13('0x12')}};_0x414be3['get'](_0x58a37d,function(_0x3fb7d3){if(_0x3fb7d3[_0x3c13('0x13')]!==0xc8){logger[_0x3c13('0x14')](_0x3c13('0x15')+_0x20e269+_0x3c13('0x16')+_0x3fb7d3[_0x3c13('0x13')]+'\x20('+_0x3fb7d3[_0x3c13('0x17')]+')');_0x498afa(new Error(_0x3c13('0x15')+_0x20e269+_0x3c13('0x16')+_0x3fb7d3[_0x3c13('0x13')]+'\x20('+_0x3fb7d3['statusMessage']+')'));return;}var _0xf2336c=fs[_0x3c13('0x18')](_0x5a1b6d);_0xf2336c['on'](_0x3c13('0x19'),function(){logger[_0x3c13('0x1a')](_0x3c13('0x1b'));_0xf2336c[_0x3c13('0x1c')](_0x42cf3d);});_0xf2336c['on'](_0x3c13('0x14'),function(_0x48a8a6){fs[_0x3c13('0x1d')](_0x5a1b6d);logger[_0x3c13('0x14')]('download\x20error',_0x48a8a6);_0x498afa(_0x48a8a6);});_0x3fb7d3[_0x3c13('0x1e')](_0xf2336c);})['on'](_0x3c13('0x14'),function(_0x365f6d){logger[_0x3c13('0x14')](_0x365f6d);_0x498afa(_0x365f6d);})[_0x3c13('0x1f')]();});}function uploadFile(_0x18149b){return new BPromise(function(_0x1e9ba6,_0x33af9a){var _0x196de9=urlParse(_0x18149b);var _0xbf4d51=_0x196de9['protocol']===_0x3c13('0x10')?https:http;var _0x4a110d={'host':_0x196de9[_0x3c13('0x20')],'path':_0x196de9[_0x3c13('0x11')],'headers':{'user-agent':_0x3c13('0x12')}};_0xbf4d51[_0x3c13('0x21')](_0x4a110d,function(_0x115cb7){if(_0x115cb7[_0x3c13('0x13')]!==0xc8){_0x33af9a(new Error('request\x20to\x20'+_0x18149b+'\x20failed,\x20status\x20code\x20=\x20'+_0x115cb7[_0x3c13('0x13')]+'\x20('+_0x115cb7[_0x3c13('0x17')]+')'));return;}var _0x3ed2b2='';_0x115cb7['on']('data',function(_0x54ad67){_0x3ed2b2+=_0x54ad67;});_0x115cb7['on'](_0x3c13('0x1f'),function(){_0x1e9ba6(_0x3ed2b2);});})['on'](_0x3c13('0x14'),function(_0x9f6958){_0x33af9a(_0x9f6958);})[_0x3c13('0x1f')]();});}function convertFile(_0x2c8f95,_0x41c5f7){return new BPromise(function(_0x3f56ec,_0x2a3cc4){var _0x12ee13=sox[_0x3c13('0x22')](_0x2c8f95,_0x41c5f7,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x12ee13['on'](_0x3c13('0x14'),function(_0x4bb95a){logger[_0x3c13('0x14')](_0x3c13('0x23'),_0x4bb95a);_0x2a3cc4(_0x4bb95a);});_0x12ee13['on']('end',function(){logger['info'](_0x3c13('0x24'));_0x3f56ec();});_0x12ee13['start']();});}function base64Decode(_0x593f62,_0x412104){var _0x3e4193=path[_0x3c13('0x25')](__dirname,_0x3c13('0x26'),rs[_0x3c13('0x27')](0x4)+_0x3c13('0x28'));fs[_0x3c13('0x29')](_0x3e4193,_0x593f62,_0x3c13('0x2a'));return convertFile(_0x3e4193,_0x412104)[_0x3c13('0x2b')](function(){try{fs['unlink'](_0x3e4193);fs[_0x3c13('0x2c')](_0x412104,_0x3c13('0x2d'));}catch(_0x5db35a){logger[_0x3c13('0x14')](_0x5db35a);}return _0x412104[_0x3c13('0x2e')]('.')[0x0];});}function base64Encode(_0x5da7e7){var _0x46157a=fs[_0x3c13('0x2f')](_0x5da7e7);return new Buffer(_0x46157a)[_0x3c13('0x30')]('base64');}exports['googleCloudTTS']=function(_0x4c038a,_0x313b3c,_0x202ac9,_0x5b9e8a,_0x4bdba8,_0x575838){var _0xcfd907,_0x22eb7a;var _0x11c45a=_0x3c13('0x31');var _0x404bcd='?key='+_0x4c038a;var _0x14b19b={};if(_0x313b3c===_0x3c13('0x32')){_0x14b19b[_0x3c13('0x33')]={'ssml':_0x202ac9};}else{_0x14b19b['input']={'text':_0x202ac9};};_0x14b19b['voice']={'languageCode':_0x5b9e8a,'ssmlGender':_0x4bdba8};_0x14b19b['audioConfig']={'audioEncoding':_0x3c13('0x34'),'sampleRateHertz':0x1f40};var _0x2d498f={'url':_0x11c45a+_0x3c13('0x35')+_0x404bcd,'method':_0x3c13('0x36'),'json':!![],'body':_0x14b19b};return rp(_0x2d498f)[_0x3c13('0x2b')](function(_0x458f65){return new BPromise(function(_0x2ecefc,_0x379864){_0xcfd907=path[_0x3c13('0x25')](__dirname,_0x3c13('0x26'),rs[_0x3c13('0x27')](0x4)+_0x3c13('0x37'));var _0x30480e=Buffer['from'](_0x458f65[_0x3c13('0x38')],'base64');return fs[_0x3c13('0x39')](_0xcfd907,_0x30480e,function(_0x5d9a24){_0x379864(_0x5d9a24);},function(_0x5e700c){fs[_0x3c13('0x2c')](_0xcfd907,'777');_0x2ecefc(_0x5e700c);});});})[_0x3c13('0x2b')](function(_0x53d9df){_0x22eb7a=path[_0x3c13('0x25')](__dirname,'tmp',rs[_0x3c13('0x27')](0x4)+_0x3c13('0x28'));return convertFile(_0xcfd907,_0x22eb7a);})[_0x3c13('0x2b')](function(){try{fs[_0x3c13('0x1d')](_0xcfd907);fs[_0x3c13('0x2c')](_0x22eb7a,'777');}catch(_0x13ee42){logger[_0x3c13('0x14')](_0x13ee42);}logger['info'](_0x3c13('0x3a'),_0x22eb7a['split']('.')[0x0]);return _0x22eb7a[_0x3c13('0x2e')]('.')[0x0];});};exports[_0x3c13('0x3b')]=function(_0x232457,_0x455651){var _0x358f31='https://translate.google.com/_/TranslateWebserverUi/data/batchexecute';var _0x5a9c7b,_0x1b3568;var _0x3a2fc3;var _0x32ac17={'encoding':_0x3c13('0x3c'),'method':_0x3c13('0x36'),'timeout':0x2710,'url':_0x358f31,'headers':{'Content-Type':'application/x-www-form-urlencoded'},'body':_0x3c13('0x3d')+encodeURIComponent(JSON['stringify']([[[_0x3c13('0x3e'),JSON['stringify']([_0x232457,_0x455651||'en',![],_0x3c13('0x3f')]),null,_0x3c13('0x40')]]]))};return rp(_0x32ac17)['then'](function(_0x2fb2bf){try{_0x3a2fc3=eval(_0x2fb2bf['slice'](0x5))[0x0][0x2];}catch(_0x21a2ba){throw new Error(_0x3c13('0x41')+_0x2fb2bf[_0x3c13('0x42')]);}if(!_0x3a2fc3){if(_0x232457[_0x3c13('0x43')]>0xc8){throw new Error(_0x3c13('0x44'));}else{throw new Error('lang\x20\x22'+_0x455651+'\x22\x20might\x20not\x20exist');}}try{_0x3a2fc3=eval(_0x3a2fc3)[0x0];}catch(_0xc85685){throw new Error('parse\x20response\x20failed:\x0a'+res['data']);}const _0x18d313=_0x3a2fc3;_0x5a9c7b=path['resolve'](__dirname,'tmp',rs[_0x3c13('0x27')](0x4)+'.mp3');fs[_0x3c13('0x29')](_0x5a9c7b,_0x3a2fc3,{'encoding':_0x3c13('0x2a')});_0x1b3568=path[_0x3c13('0x25')](__dirname,'tmp',rs['generate'](0x4)+_0x3c13('0x28'));return convertFile(_0x5a9c7b,_0x1b3568);})[_0x3c13('0x2b')](function(){try{fs[_0x3c13('0x1d')](_0x5a9c7b);fs[_0x3c13('0x2c')](_0x1b3568,_0x3c13('0x2d'));}catch(_0x2885a8){logger[_0x3c13('0x14')](_0x2885a8);}logger['info'](_0x3c13('0x45'),_0x1b3568[_0x3c13('0x2e')]('.')[0x0]);return _0x1b3568[_0x3c13('0x2e')]('.')[0x0];});};exports[_0x3c13('0x46')]=function(_0x382606,_0x25fc6e,_0x42f6a9){return google['asr'](_0x382606,_0x25fc6e,_0x42f6a9)['then'](function(_0x17f9d2){logger[_0x3c13('0x1a')](_0x17f9d2['uri']);return rp(_0x17f9d2);})[_0x3c13('0x2b')](function(_0x2de985){var _0x125ed4='';var _0xc35e62=0x0;try{fs[_0x3c13('0x1d')](_0x382606);}catch(_0x7e837f){logger['error'](_0x7e837f);}if(_0x2de985&&_0x2de985[_0x3c13('0x47')]){_0x125ed4=_0x2de985[_0x3c13('0x47')][_0x3c13('0x48')](function(_0x3e0c2d){return _0x3e0c2d&&_0x3e0c2d[_0x3c13('0x49')][0x0]&&_0x3e0c2d[_0x3c13('0x49')][0x0][_0x3c13('0x4a')]?_0x3e0c2d[_0x3c13('0x49')][0x0][_0x3c13('0x4a')]:'';})['join']('\x0a');_0xc35e62=_0x2de985['results'][_0x3c13('0x48')](function(_0x40212e){return _0x40212e&&_0x40212e[_0x3c13('0x49')][0x0]&&_0x40212e[_0x3c13('0x49')][0x0][_0x3c13('0x4b')]?_0x40212e['alternatives'][0x0][_0x3c13('0x4b')]:0x0;})[_0x3c13('0x4c')]('\x0a');}logger[_0x3c13('0x1a')](_0x3c13('0x4d'),_0x125ed4);logger[_0x3c13('0x1a')]('googleASR\x20confidence',_0xc35e62);return{'transcript':_0x125ed4,'confidence':_0xc35e62};})['catch'](function(_0x1d4a09){logger['error']('[%s]\x20%s:%s',_0x1d4a09[_0x3c13('0x13')],_0x1d4a09[_0x3c13('0x4e')],_0x1d4a09[_0x3c13('0x4f')]);});};exports['googleDialogflow']=function(_0x50dd83,_0x48bba4,_0x57e105,_0x55995a){var _0x2ee866=apiai(_0x48bba4,{'language':_0x55995a||'en'});return _0x2ee866['textRequest'](_0x57e105,{'sessionId':md5(_0x50dd83)})[_0x3c13('0x2b')](function(_0x1ec94c){logger[_0x3c13('0x1a')](JSON[_0x3c13('0x50')](_0x1ec94c));return{'source':_0x1ec94c[_0x3c13('0x51')][_0x3c13('0x52')],'resolvedQuery':_0x1ec94c['result'][_0x3c13('0x53')],'action':_0x1ec94c[_0x3c13('0x51')][_0x3c13('0x54')],'actionIncomplete':_0x1ec94c['result']['actionIncomplete'],'speech':_0x1ec94c[_0x3c13('0x51')][_0x3c13('0x55')][_0x3c13('0x56')],'score':_0x1ec94c[_0x3c13('0x51')][_0x3c13('0x57')],'statusCode':_0x1ec94c[_0x3c13('0x58')][_0x3c13('0x59')],'endConversation':_0x1ec94c[_0x3c13('0x51')][_0x3c13('0x5a')][_0x3c13('0x5b')]||![],'isFallbackIntent':_0x1ec94c[_0x3c13('0x51')][_0x3c13('0x5a')][_0x3c13('0x5c')]};});};exports[_0x3c13('0x5d')]=function(_0x422dc0,_0x3788a1,_0xf0e4de,_0x579c75,_0x38b0e7,_0xa2c0de){var _0x4a380e=_0x579c75['replace'](/\\n/g,'\x0a');var _0xae2055={'credentials':{'private_key':_0x4a380e,'client_email':_0xf0e4de}};var _0x38ff8b=new dialogflow[(_0x3c13('0x5e'))](_0xae2055);var _0x1e142c=_0x38ff8b[_0x3c13('0x5f')](_0x3788a1,md5(_0x422dc0));var _0x169acd={'session':_0x1e142c,'queryInput':{'text':{'text':_0x38b0e7,'languageCode':_0xa2c0de}}};return _0x38ff8b[_0x3c13('0x60')](_0x169acd)['then'](function(_0x342e69){if(_0x342e69&&_0x342e69['length']){logger[_0x3c13('0x1a')](_0x3c13('0x61'),JSON[_0x3c13('0x50')](_0x342e69));var _0x112930=_0x342e69[0x0];if(_0x112930){var _0x283143={'action':_0x112930[_0x3c13('0x62')][_0x3c13('0x54')],'allRequiredParamsPresent':_0x112930[_0x3c13('0x62')][_0x3c13('0x63')],'endConversation':_0x112930[_0x3c13('0x62')][_0x3c13('0x64')]&&_0x112930['queryResult'][_0x3c13('0x64')][_0x3c13('0x65')]?_0x112930[_0x3c13('0x62')][_0x3c13('0x64')][_0x3c13('0x65')][_0x3c13('0x66')]['boolValue']:![],'fulfillmentText':_0x112930['queryResult'][_0x3c13('0x67')],'intentName':_0x112930[_0x3c13('0x62')]['intent']['name'],'intentDisplayName':_0x112930[_0x3c13('0x62')]['intent'][_0x3c13('0x68')],'isFallbackIntent':_0x112930[_0x3c13('0x62')][_0x3c13('0x69')][_0x3c13('0x6a')],'languageCode':_0x112930[_0x3c13('0x62')][_0x3c13('0x6b')],'queryText':_0x112930[_0x3c13('0x62')][_0x3c13('0x6c')],'responseId':_0x112930[_0x3c13('0x6d')],'score':_0x112930['queryResult'][_0x3c13('0x6e')],'speech':_0x112930['queryResult']['fulfillmentText'],'providerResponse':JSON[_0x3c13('0x50')](_0x342e69)};return _0x283143;}}});};exports[_0x3c13('0x6f')]=function(_0xb40dd3,_0x260e1d,_0x128be9,_0x518a6c){return tilde[_0x3c13('0x70')](_0xb40dd3,_0x260e1d,_0x128be9,_0x518a6c)['then'](function(_0x536d68){try{fs[_0x3c13('0x1d')](_0xb40dd3);}catch(_0x2c7121){logger[_0x3c13('0x14')](_0x2c7121);}logger['info'](_0x3c13('0x71'),_0x536d68[_0x3c13('0x4a')]);logger[_0x3c13('0x1a')](_0x3c13('0x72'),_0x536d68['confidence']);return _0x536d68;});};exports[_0x3c13('0x73')]=function(_0x442e64,_0x1d40f,_0x285a37,_0x29e89f,_0x105cd0,_0x4ed121){var _0x330a65=path[_0x3c13('0x25')](__dirname,_0x3c13('0x26'),rs[_0x3c13('0x27')](0x4)+_0x3c13('0x37'));var _0x2bfcae;return aws[_0x3c13('0x74')](_0x442e64,_0x1d40f,_0x285a37,_0x29e89f,_0x105cd0,_0x4ed121,_0x330a65)['then'](function(){_0x2bfcae=path[_0x3c13('0x25')](__dirname,'tmp',rs['generate'](0x4)+_0x3c13('0x28'));return convertFile(_0x330a65,_0x2bfcae);})['then'](function(){try{fs[_0x3c13('0x1d')](_0x330a65);fs[_0x3c13('0x2c')](_0x2bfcae,_0x3c13('0x2d'));}catch(_0x5097af){logger[_0x3c13('0x14')](_0x5097af);}return _0x2bfcae['split']('.')[0x0];});};exports[_0x3c13('0x75')]=function(_0xe641bb,_0x156787,_0x17c4ef,_0x42a3d2,_0x1ba229,_0x5ef0b3){return aws['lex'](_0xe641bb,_0x156787,_0x17c4ef,_0x42a3d2,_0x1ba229,_0x5ef0b3)[_0x3c13('0x2b')](function(_0x2ececd){logger[_0x3c13('0x1a')](JSON[_0x3c13('0x50')](_0x2ececd));return _0x2ececd;});};exports['ispeechTTS']=function(_0x321959,_0x2bc055,_0x52d190,_0x2090b0){var _0x1e024e=util[_0x3c13('0x76')]('%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3',ISPEECH_API,_0x321959,encodeURIComponent(_0x2bc055),_0x52d190,_0x2090b0);var _0x1e06e3=path[_0x3c13('0x25')](__dirname,_0x3c13('0x26'),rs[_0x3c13('0x27')](0x4)+_0x3c13('0x37'));var _0x54aa57;return downloadFile(_0x1e024e,_0x1e06e3)[_0x3c13('0x2b')](function(){_0x54aa57=path[_0x3c13('0x25')](__dirname,_0x3c13('0x26'),rs['generate'](0x4)+'.wav');return convertFile(_0x1e06e3,_0x54aa57);})[_0x3c13('0x2b')](function(){try{fs[_0x3c13('0x1d')](_0x1e06e3);fs[_0x3c13('0x2c')](_0x54aa57,_0x3c13('0x2d'));}catch(_0xc8e87){logger[_0x3c13('0x14')](_0xc8e87);}return _0x54aa57[_0x3c13('0x2e')]('.')[0x0];});};exports[_0x3c13('0x77')]=function(_0x20b22b,_0xce8ee6,_0x53cba5,_0x109265){var _0x31984e=util[_0x3c13('0x76')]('%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s',ISPEECH_API,_0xce8ee6,_0x53cba5,base64Encode(_0x20b22b),_0x109265?util[_0x3c13('0x76')]('model=%s',encodeURIComponent(_0x109265)):'freeform=3');return uploadFile(_0x31984e)[_0x3c13('0x2b')](function(_0x6f2bd5){return querystring['parse'](_0x6f2bd5);});};exports[_0x3c13('0x78')]=function(_0x43a766,_0x496b03){return sestek[_0x3c13('0x79')](_0x43a766,_0x496b03)[_0x3c13('0x2b')](function(_0x1b2b7a){logger[_0x3c13('0x1a')](JSON[_0x3c13('0x50')](_0x1b2b7a));var _0x2d1a2c={'speech':_0x1b2b7a[_0x3c13('0x7a')],'action':_0x1b2b7a[_0x3c13('0x7b')]?_0x1b2b7a[_0x3c13('0x7b')][_0x3c13('0x7c')]:undefined,'actiondata':_0x1b2b7a[_0x3c13('0x7b')]?_0x1b2b7a[_0x3c13('0x7b')][_0x3c13('0x7d')]:undefined};if(_0x1b2b7a[_0x3c13('0x7b')]&&_0x1b2b7a['channelData'][_0x3c13('0x7e')]){return base64Decode(_0x1b2b7a[_0x3c13('0x7b')][_0x3c13('0x7e')][_0x3c13('0x7f')],path['resolve'](__dirname,_0x3c13('0x26'),rs['generate'](0x4)+_0x3c13('0x28')))[_0x3c13('0x2b')](function(_0x985e21){_0x2d1a2c[_0x3c13('0x80')]=_0x985e21;return _0x2d1a2c;});}return _0x2d1a2c;});};exports[_0x3c13('0x81')]=function(){return __dirname;}; \ No newline at end of file +var _0x1931=['allRequiredParamsPresent','diagnosticInfo','fields','fulfillmentText','intent','displayName','isFallback','languageCode','responseId','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','polly','awsLex','lex','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','freeform=3','sestekNDA','nda','text','channelData','CustomAction','CustomActionData','AudioFromTts','Data','apiai-promise','bluebird','http','https','path','querystring','request-promise','sox','url','parse','util','./aws','./google','./sestek','./tilde','../../../config/logger','https://api.ispeech.org/api/rest','protocol','https:','host','WHAT_EVER','get','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusCode','statusMessage','createWriteStream','finish','info','finish\x20download\x20file','close','download\x20error','pipe','end','data','transcode','wav','error\x20convert','resolve','tmp','generate','.wav','writeFileSync','base64','then','unlink','chmodSync','777','split','readFileSync','toString','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','input','audioConfig','MP3','text:synthesize','POST','.mp3','audioContent','googleCloudTTS\x20path','googleTTS','utf8','application/x-www-form-urlencoded','f.req=','stringify','null','generic','parse\x20response\x20failed:\x0a','length','text\x20length\x20limit\x20reached','lang\x20\x22','\x22\x20might\x20not\x20exist','goggleTTS\x20path','asr','uri','map','alternatives','transcript','join','confidence','googleASR\x20transcription','catch','googleDialogflow','textRequest','source','result','resolvedQuery','action','fulfillment','speech','score','code','metadata','isFallbackIntent','googleDialogflowV2','replace','SessionsClient','sessionPath','detectIntent','Dialogflow\x20V2\x20response:','queryResult'];(function(_0x799a50,_0x58f5a7){var _0x5d7de0=function(_0x3303f5){while(--_0x3303f5){_0x799a50['push'](_0x799a50['shift']());}};_0x5d7de0(++_0x58f5a7);}(_0x1931,0xa6));var _0x1193=function(_0x639d26,_0x43e726){_0x639d26=_0x639d26-0x0;var _0x2595bd=_0x1931[_0x639d26];return _0x2595bd;};'use strict';var apiai=require(_0x1193('0x0'));var BPromise=require(_0x1193('0x1'));var dialogflow=require('dialogflow');var fs=require('fs');var http=require(_0x1193('0x2'));var https=require(_0x1193('0x3'));var md5=require('md5');var path=require(_0x1193('0x4'));var querystring=require(_0x1193('0x5'));var rp=require(_0x1193('0x6'));var rs=require('randomstring');var sox=require(_0x1193('0x7'));var tts=require('google-tts-api');var urlParse=require(_0x1193('0x8'))[_0x1193('0x9')];var util=require(_0x1193('0xa'));var aws=require(_0x1193('0xb'));var google=require(_0x1193('0xc'));var sestek=require(_0x1193('0xd'));var tilde=require(_0x1193('0xe'));var logger=require(_0x1193('0xf'))('agi');var ISPEECH_API=_0x1193('0x10');function downloadFile(_0x3c7e52,_0xffad69){return new BPromise(function(_0xbfbbb3,_0x499b97){var _0x5c7c71=urlParse(_0x3c7e52);var _0x86d6f1=_0x5c7c71[_0x1193('0x11')]===_0x1193('0x12')?https:http;var _0x27d8af={'host':_0x5c7c71[_0x1193('0x13')],'path':_0x5c7c71[_0x1193('0x4')],'headers':{'user-agent':_0x1193('0x14')}};_0x86d6f1[_0x1193('0x15')](_0x27d8af,function(_0x4447f2){if(_0x4447f2['statusCode']!==0xc8){logger[_0x1193('0x16')](_0x1193('0x17')+_0x3c7e52+_0x1193('0x18')+_0x4447f2[_0x1193('0x19')]+'\x20('+_0x4447f2['statusMessage']+')');_0x499b97(new Error(_0x1193('0x17')+_0x3c7e52+_0x1193('0x18')+_0x4447f2['statusCode']+'\x20('+_0x4447f2[_0x1193('0x1a')]+')'));return;}var _0x53b86f=fs[_0x1193('0x1b')](_0xffad69);_0x53b86f['on'](_0x1193('0x1c'),function(){logger[_0x1193('0x1d')](_0x1193('0x1e'));_0x53b86f[_0x1193('0x1f')](_0xbfbbb3);});_0x53b86f['on'](_0x1193('0x16'),function(_0x2ce88c){fs['unlink'](_0xffad69);logger['error'](_0x1193('0x20'),_0x2ce88c);_0x499b97(_0x2ce88c);});_0x4447f2[_0x1193('0x21')](_0x53b86f);})['on'](_0x1193('0x16'),function(_0x5636df){logger[_0x1193('0x16')](_0x5636df);_0x499b97(_0x5636df);})[_0x1193('0x22')]();});}function uploadFile(_0x374480){return new BPromise(function(_0x5b0844,_0x56e376){var _0x275fde=urlParse(_0x374480);var _0x46b3a6=_0x275fde['protocol']===_0x1193('0x12')?https:http;var _0x2780e1={'host':_0x275fde[_0x1193('0x13')],'path':_0x275fde[_0x1193('0x4')],'headers':{'user-agent':'WHAT_EVER'}};_0x46b3a6[_0x1193('0x15')](_0x2780e1,function(_0x10ac50){if(_0x10ac50[_0x1193('0x19')]!==0xc8){_0x56e376(new Error(_0x1193('0x17')+_0x374480+'\x20failed,\x20status\x20code\x20=\x20'+_0x10ac50[_0x1193('0x19')]+'\x20('+_0x10ac50[_0x1193('0x1a')]+')'));return;}var _0x5b2348='';_0x10ac50['on'](_0x1193('0x23'),function(_0x3e9edb){_0x5b2348+=_0x3e9edb;});_0x10ac50['on']('end',function(){_0x5b0844(_0x5b2348);});})['on']('error',function(_0x53f29e){_0x56e376(_0x53f29e);})[_0x1193('0x22')]();});}function convertFile(_0x5368e3,_0xad56ba){return new BPromise(function(_0x448f86,_0x5e35d0){var _0x490cd1=sox[_0x1193('0x24')](_0x5368e3,_0xad56ba,{'sampleRate':0x1f40,'format':_0x1193('0x25'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x490cd1['on'](_0x1193('0x16'),function(_0x420ec2){logger[_0x1193('0x16')](_0x1193('0x26'),_0x420ec2);_0x5e35d0(_0x420ec2);});_0x490cd1['on']('end',function(){logger[_0x1193('0x1d')]('finish\x20to\x20convert');_0x448f86();});_0x490cd1['start']();});}function base64Decode(_0x3e1dcc,_0x32264f){var _0x1e8444=path[_0x1193('0x27')](__dirname,_0x1193('0x28'),rs[_0x1193('0x29')](0x4)+_0x1193('0x2a'));fs[_0x1193('0x2b')](_0x1e8444,_0x3e1dcc,_0x1193('0x2c'));return convertFile(_0x1e8444,_0x32264f)[_0x1193('0x2d')](function(){try{fs[_0x1193('0x2e')](_0x1e8444);fs[_0x1193('0x2f')](_0x32264f,_0x1193('0x30'));}catch(_0x4b00a2){logger[_0x1193('0x16')](_0x4b00a2);}return _0x32264f[_0x1193('0x31')]('.')[0x0];});}function base64Encode(_0x890848){var _0x32aa4a=fs[_0x1193('0x32')](_0x890848);return new Buffer(_0x32aa4a)[_0x1193('0x33')](_0x1193('0x2c'));}exports[_0x1193('0x34')]=function(_0x58ad35,_0x36dcb7,_0x76eb88,_0x3edc3e,_0xedc9ec,_0x192fcc){var _0xa86dbe,_0xc46c07;var _0x2364d0=_0x1193('0x35');var _0x5836b3=_0x1193('0x36')+_0x58ad35;var _0x464c60={};if(_0x36dcb7==='ssml'){_0x464c60['input']={'ssml':_0x76eb88};}else{_0x464c60[_0x1193('0x37')]={'text':_0x76eb88};};_0x464c60['voice']={'languageCode':_0x3edc3e,'ssmlGender':_0xedc9ec};_0x464c60[_0x1193('0x38')]={'audioEncoding':_0x1193('0x39'),'sampleRateHertz':0x1f40};var _0x5e86a1={'url':_0x2364d0+_0x1193('0x3a')+_0x5836b3,'method':_0x1193('0x3b'),'json':!![],'body':_0x464c60};return rp(_0x5e86a1)[_0x1193('0x2d')](function(_0x37bd57){return new BPromise(function(_0x5a8dd4,_0x4f041d){_0xa86dbe=path[_0x1193('0x27')](__dirname,_0x1193('0x28'),rs['generate'](0x4)+_0x1193('0x3c'));var _0x1bf8fc=Buffer['from'](_0x37bd57[_0x1193('0x3d')],_0x1193('0x2c'));return fs['writeFile'](_0xa86dbe,_0x1bf8fc,function(_0x17a796){_0x4f041d(_0x17a796);},function(_0x15a9cb){fs[_0x1193('0x2f')](_0xa86dbe,_0x1193('0x30'));_0x5a8dd4(_0x15a9cb);});});})['then'](function(_0x110c78){_0xc46c07=path['resolve'](__dirname,_0x1193('0x28'),rs['generate'](0x4)+_0x1193('0x2a'));return convertFile(_0xa86dbe,_0xc46c07);})[_0x1193('0x2d')](function(){try{fs[_0x1193('0x2e')](_0xa86dbe);fs[_0x1193('0x2f')](_0xc46c07,_0x1193('0x30'));}catch(_0x29bd36){logger[_0x1193('0x16')](_0x29bd36);}logger[_0x1193('0x1d')](_0x1193('0x3e'),_0xc46c07[_0x1193('0x31')]('.')[0x0]);return _0xc46c07[_0x1193('0x31')]('.')[0x0];});};exports[_0x1193('0x3f')]=function(_0x13ebd9,_0x1efb94){var _0x856008='https://translate.google.com/_/TranslateWebserverUi/data/batchexecute';var _0xdd87d2,_0x48e3ae;var _0x55e57b;var _0x10c403={'encoding':_0x1193('0x40'),'method':_0x1193('0x3b'),'timeout':0x2710,'url':_0x856008,'headers':{'Content-Type':_0x1193('0x41')},'body':_0x1193('0x42')+encodeURIComponent(JSON['stringify']([[['jQ1olc',JSON[_0x1193('0x43')]([_0x13ebd9,_0x1efb94||'en',![],_0x1193('0x44')]),null,_0x1193('0x45')]]]))};return rp(_0x10c403)[_0x1193('0x2d')](function(_0xf46fd4){try{_0x55e57b=eval(_0xf46fd4['slice'](0x5))[0x0][0x2];}catch(_0x2b73bf){throw new Error(_0x1193('0x46')+_0xf46fd4[_0x1193('0x23')]);}if(!_0x55e57b){if(_0x13ebd9[_0x1193('0x47')]>0xc8){throw new Error(_0x1193('0x48'));}else{throw new Error(_0x1193('0x49')+_0x1efb94+_0x1193('0x4a'));}}try{_0x55e57b=eval(_0x55e57b)[0x0];}catch(_0x54a0cf){throw new Error(_0x1193('0x46')+res[_0x1193('0x23')]);}const _0x54dccc=_0x55e57b;_0xdd87d2=path[_0x1193('0x27')](__dirname,'tmp',rs[_0x1193('0x29')](0x4)+_0x1193('0x3c'));fs[_0x1193('0x2b')](_0xdd87d2,_0x55e57b,{'encoding':_0x1193('0x2c')});_0x48e3ae=path[_0x1193('0x27')](__dirname,_0x1193('0x28'),rs[_0x1193('0x29')](0x4)+_0x1193('0x2a'));return convertFile(_0xdd87d2,_0x48e3ae);})[_0x1193('0x2d')](function(){try{fs[_0x1193('0x2e')](_0xdd87d2);fs[_0x1193('0x2f')](_0x48e3ae,_0x1193('0x30'));}catch(_0x37c2d8){logger['error'](_0x37c2d8);}logger['info'](_0x1193('0x4b'),_0x48e3ae[_0x1193('0x31')]('.')[0x0]);return _0x48e3ae['split']('.')[0x0];});};exports['googleASR']=function(_0x4aedd8,_0x29bb2b,_0x38064d){return google[_0x1193('0x4c')](_0x4aedd8,_0x29bb2b,_0x38064d)[_0x1193('0x2d')](function(_0x7f3a20){logger['info'](_0x7f3a20[_0x1193('0x4d')]);return rp(_0x7f3a20);})[_0x1193('0x2d')](function(_0x48ee17){var _0x4e1866='';var _0x304a5f=0x0;try{fs['unlink'](_0x4aedd8);}catch(_0x2213cc){logger[_0x1193('0x16')](_0x2213cc);}if(_0x48ee17&&_0x48ee17['results']){_0x4e1866=_0x48ee17['results'][_0x1193('0x4e')](function(_0x4fa390){return _0x4fa390&&_0x4fa390[_0x1193('0x4f')][0x0]&&_0x4fa390[_0x1193('0x4f')][0x0][_0x1193('0x50')]?_0x4fa390[_0x1193('0x4f')][0x0][_0x1193('0x50')]:'';})[_0x1193('0x51')]('\x0a');_0x304a5f=_0x48ee17['results'][_0x1193('0x4e')](function(_0x3d7da8){return _0x3d7da8&&_0x3d7da8[_0x1193('0x4f')][0x0]&&_0x3d7da8[_0x1193('0x4f')][0x0][_0x1193('0x52')]?_0x3d7da8['alternatives'][0x0][_0x1193('0x52')]:0x0;})[_0x1193('0x51')]('\x0a');}logger[_0x1193('0x1d')](_0x1193('0x53'),_0x4e1866);logger[_0x1193('0x1d')]('googleASR\x20confidence',_0x304a5f);return{'transcript':_0x4e1866,'confidence':_0x304a5f};})[_0x1193('0x54')](function(_0x503cae){logger[_0x1193('0x16')]('[%s]\x20%s:%s',_0x503cae[_0x1193('0x19')],_0x503cae['name'],_0x503cae['message']);});};exports[_0x1193('0x55')]=function(_0x2e3a26,_0x801181,_0x1fdac3,_0x1d60b2){var _0x1c5ba5=apiai(_0x801181,{'language':_0x1d60b2||'en'});return _0x1c5ba5[_0x1193('0x56')](_0x1fdac3,{'sessionId':md5(_0x2e3a26)})[_0x1193('0x2d')](function(_0x4b4315){logger['info'](JSON['stringify'](_0x4b4315));return{'source':_0x4b4315['result'][_0x1193('0x57')],'resolvedQuery':_0x4b4315[_0x1193('0x58')][_0x1193('0x59')],'action':_0x4b4315[_0x1193('0x58')][_0x1193('0x5a')],'actionIncomplete':_0x4b4315[_0x1193('0x58')]['actionIncomplete'],'speech':_0x4b4315[_0x1193('0x58')][_0x1193('0x5b')][_0x1193('0x5c')],'score':_0x4b4315[_0x1193('0x58')][_0x1193('0x5d')],'statusCode':_0x4b4315['status'][_0x1193('0x5e')],'endConversation':_0x4b4315[_0x1193('0x58')][_0x1193('0x5f')]['endConversation']||![],'isFallbackIntent':_0x4b4315[_0x1193('0x58')]['metadata'][_0x1193('0x60')]};});};exports[_0x1193('0x61')]=function(_0x469b69,_0x27eddb,_0x4d5bcf,_0x45b9ca,_0x1dae6a,_0x274747){var _0xbd662b=_0x45b9ca[_0x1193('0x62')](/\\n/g,'\x0a');var _0x363f0e={'credentials':{'private_key':_0xbd662b,'client_email':_0x4d5bcf}};var _0x5717c1=new dialogflow[(_0x1193('0x63'))](_0x363f0e);var _0x5aa891=_0x5717c1[_0x1193('0x64')](_0x27eddb,md5(_0x469b69));var _0x368d1c={'session':_0x5aa891,'queryInput':{'text':{'text':_0x1dae6a,'languageCode':_0x274747}}};return _0x5717c1[_0x1193('0x65')](_0x368d1c)[_0x1193('0x2d')](function(_0x364875){if(_0x364875&&_0x364875['length']){logger[_0x1193('0x1d')](_0x1193('0x66'),JSON[_0x1193('0x43')](_0x364875));var _0x2d8963=_0x364875[0x0];if(_0x2d8963){var _0x2a4a18={'action':_0x2d8963[_0x1193('0x67')]['action'],'allRequiredParamsPresent':_0x2d8963[_0x1193('0x67')][_0x1193('0x68')],'endConversation':_0x2d8963[_0x1193('0x67')]['diagnosticInfo']&&_0x2d8963[_0x1193('0x67')][_0x1193('0x69')][_0x1193('0x6a')]?_0x2d8963[_0x1193('0x67')]['diagnosticInfo'][_0x1193('0x6a')]['end_conversation']['boolValue']:![],'fulfillmentText':_0x2d8963['queryResult'][_0x1193('0x6b')],'intentName':_0x2d8963[_0x1193('0x67')][_0x1193('0x6c')]['name'],'intentDisplayName':_0x2d8963[_0x1193('0x67')][_0x1193('0x6c')][_0x1193('0x6d')],'isFallbackIntent':_0x2d8963[_0x1193('0x67')]['intent'][_0x1193('0x6e')],'languageCode':_0x2d8963[_0x1193('0x67')][_0x1193('0x6f')],'queryText':_0x2d8963[_0x1193('0x67')]['queryText'],'responseId':_0x2d8963[_0x1193('0x70')],'score':_0x2d8963[_0x1193('0x67')]['intentDetectionConfidence'],'speech':_0x2d8963[_0x1193('0x67')][_0x1193('0x6b')],'providerResponse':JSON[_0x1193('0x43')](_0x364875)};return _0x2a4a18;}}});};exports[_0x1193('0x71')]=function(_0x102700,_0x351097,_0x4585f9,_0x2d0632){return tilde[_0x1193('0x4c')](_0x102700,_0x351097,_0x4585f9,_0x2d0632)[_0x1193('0x2d')](function(_0x439904){try{fs[_0x1193('0x2e')](_0x102700);}catch(_0x367d3c){logger[_0x1193('0x16')](_0x367d3c);}logger[_0x1193('0x1d')](_0x1193('0x72'),_0x439904[_0x1193('0x50')]);logger[_0x1193('0x1d')](_0x1193('0x73'),_0x439904[_0x1193('0x52')]);return _0x439904;});};exports[_0x1193('0x74')]=function(_0x38ab44,_0x47480c,_0x2bffc5,_0x5a1e7f,_0x45bae7,_0x28f818){var _0x317a73=path['resolve'](__dirname,_0x1193('0x28'),rs[_0x1193('0x29')](0x4)+_0x1193('0x3c'));var _0x49caa0;return aws[_0x1193('0x75')](_0x38ab44,_0x47480c,_0x2bffc5,_0x5a1e7f,_0x45bae7,_0x28f818,_0x317a73)['then'](function(){_0x49caa0=path[_0x1193('0x27')](__dirname,_0x1193('0x28'),rs['generate'](0x4)+_0x1193('0x2a'));return convertFile(_0x317a73,_0x49caa0);})[_0x1193('0x2d')](function(){try{fs['unlink'](_0x317a73);fs[_0x1193('0x2f')](_0x49caa0,_0x1193('0x30'));}catch(_0x59da91){logger[_0x1193('0x16')](_0x59da91);}return _0x49caa0[_0x1193('0x31')]('.')[0x0];});};exports[_0x1193('0x76')]=function(_0x11e97f,_0x5f28c2,_0x5c2438,_0x1c604a,_0x198a05,_0x5dc144){return aws[_0x1193('0x77')](_0x11e97f,_0x5f28c2,_0x5c2438,_0x1c604a,_0x198a05,_0x5dc144)[_0x1193('0x2d')](function(_0x66864a){logger[_0x1193('0x1d')](JSON[_0x1193('0x43')](_0x66864a));return _0x66864a;});};exports[_0x1193('0x78')]=function(_0x1cb07b,_0x5ba2f3,_0x12deba,_0xc3e005){var _0x399820=util[_0x1193('0x79')](_0x1193('0x7a'),ISPEECH_API,_0x1cb07b,encodeURIComponent(_0x5ba2f3),_0x12deba,_0xc3e005);var _0x493840=path[_0x1193('0x27')](__dirname,_0x1193('0x28'),rs['generate'](0x4)+_0x1193('0x3c'));var _0x2e9090;return downloadFile(_0x399820,_0x493840)[_0x1193('0x2d')](function(){_0x2e9090=path[_0x1193('0x27')](__dirname,_0x1193('0x28'),rs[_0x1193('0x29')](0x4)+'.wav');return convertFile(_0x493840,_0x2e9090);})[_0x1193('0x2d')](function(){try{fs[_0x1193('0x2e')](_0x493840);fs[_0x1193('0x2f')](_0x2e9090,'777');}catch(_0x17758d){logger[_0x1193('0x16')](_0x17758d);}return _0x2e9090[_0x1193('0x31')]('.')[0x0];});};exports[_0x1193('0x7b')]=function(_0x4013d0,_0x441230,_0x1bc707,_0xba5496){var _0x28d6e0=util['format'](_0x1193('0x7c'),ISPEECH_API,_0x441230,_0x1bc707,base64Encode(_0x4013d0),_0xba5496?util[_0x1193('0x79')](_0x1193('0x7d'),encodeURIComponent(_0xba5496)):_0x1193('0x7e'));return uploadFile(_0x28d6e0)[_0x1193('0x2d')](function(_0x37b38c){return querystring[_0x1193('0x9')](_0x37b38c);});};exports[_0x1193('0x7f')]=function(_0x2a343c,_0x412c0b){return sestek[_0x1193('0x80')](_0x2a343c,_0x412c0b)[_0x1193('0x2d')](function(_0x3ee367){logger['info'](JSON[_0x1193('0x43')](_0x3ee367));var _0x586f2a={'speech':_0x3ee367[_0x1193('0x81')],'action':_0x3ee367['channelData']?_0x3ee367[_0x1193('0x82')][_0x1193('0x83')]:undefined,'actiondata':_0x3ee367[_0x1193('0x82')]?_0x3ee367[_0x1193('0x82')][_0x1193('0x84')]:undefined};if(_0x3ee367[_0x1193('0x82')]&&_0x3ee367['channelData'][_0x1193('0x85')]){return base64Decode(_0x3ee367['channelData'][_0x1193('0x85')][_0x1193('0x86')],path[_0x1193('0x27')](__dirname,_0x1193('0x28'),rs[_0x1193('0x29')](0x4)+_0x1193('0x2a')))[_0x1193('0x2d')](function(_0x1d274d){_0x586f2a['audiofile']=_0x1d274d;return _0x586f2a;});}return _0x586f2a;});};exports['dirName']=function(){return __dirname;}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/index.js b/server/services/agi/scripts/sestek/index.js index 1c8276d..d06ca25 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 _0x5b9c=['./nda'];(function(_0x3b1104,_0x44a6df){var _0x9d0a7e=function(_0x32c7aa){while(--_0x32c7aa){_0x3b1104['push'](_0x3b1104['shift']());}};_0x9d0a7e(++_0x44a6df);}(_0x5b9c,0x153));var _0xc5b9=function(_0x40f7a9,_0x3e3ccd){_0x40f7a9=_0x40f7a9-0x0;var _0x42fc29=_0x5b9c[_0x40f7a9];return _0x42fc29;};var nda=require(_0xc5b9('0x0'));module['exports']={'nda':nda}; \ No newline at end of file +var _0x86f6=['exports','./nda'];(function(_0x3fafb1,_0x5ef10d){var _0x4135ce=function(_0x7f0872){while(--_0x7f0872){_0x3fafb1['push'](_0x3fafb1['shift']());}};_0x4135ce(++_0x5ef10d);}(_0x86f6,0xcd));var _0x686f=function(_0x30dc67,_0x4c1900){_0x30dc67=_0x30dc67-0x0;var _0x352b1e=_0x86f6[_0x30dc67];return _0x352b1e;};var nda=require(_0x686f('0x0'));module[_0x686f('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 574fe88..dfb9b66 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 _0xe99c=['callerid','calleridname','dnid','text','access_token','project','ProjectName','ndagenerate_audio','AudioOutputSettings','custom_action','channelData','CustomAction','CustomActionData','custom_action_data','stringify','request-promise','../../../../../config/logger','agi','exports','ndauth_url','password','then','POST','resolve','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','message','Nda'];(function(_0x2adbeb,_0x5581be){var _0x5e18a6=function(_0x84e42b){while(--_0x84e42b){_0x2adbeb['push'](_0x2adbeb['shift']());}};_0x5e18a6(++_0x5581be);}(_0xe99c,0x197));var _0xce99=function(_0x39c405,_0x59b85d){_0x39c405=_0x39c405-0x0;var _0x5c295a=_0xe99c[_0x39c405];return _0x5c295a;};'use strict';var rp=require(_0xce99('0x0'));var url=require('url');var logger=require(_0xce99('0x1'))(_0xce99('0x2'));module[_0xce99('0x3')]=function(_0x3b01de,_0x228cea){var _0x5d8b70={'method':'POST','uri':url['resolve'](_0x228cea[_0xce99('0x4')],'/token'),'form':{'grant_type':_0xce99('0x5'),'username':_0x228cea['username'],'password':_0x228cea[_0xce99('0x5')]},'json':!![]};return rp(_0x5d8b70)[_0xce99('0x6')](function(_0x1e4c4e){var _0x732cca={'method':_0xce99('0x7'),'uri':url[_0xce99('0x8')](_0x228cea[_0xce99('0x9')],_0xce99('0xa')),'body':{'type':_0x228cea['ndaactivity_type']||_0xce99('0xb'),'channelId':_0xce99('0xc'),'conversation':{'id':_0x3b01de['uniqueid']},'from':{'id':_0x3b01de[_0xce99('0xd')],'name':_0x3b01de[_0xce99('0xe')]},'recipient':{'id':_0x3b01de[_0xce99('0xf')],'name':_0x3b01de['extension']},'text':_0x228cea[_0xce99('0x10')],'channelData':{}},'headers':{'Authorization':'Bearer\x20'+_0x1e4c4e[_0xce99('0x11')]},'json':!![]};if(_0x228cea[_0xce99('0x12')]){_0x732cca['body']['channelData'][_0xce99('0x13')]=_0x228cea[_0xce99('0x12')];}if(_0x228cea[_0xce99('0x14')]=='1'){_0x732cca['body']['channelData'][_0xce99('0x15')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':'audio/wav'};}if(_0x228cea[_0xce99('0x16')]){_0x732cca['body'][_0xce99('0x17')][_0xce99('0x18')]=_0x228cea[_0xce99('0x16')];if(_0x228cea['custom_action_data']){_0x732cca['body'][_0xce99('0x17')][_0xce99('0x19')]=_0x228cea[_0xce99('0x1a')];}}logger['info'](JSON[_0xce99('0x1b')](_0x732cca));return rp(_0x732cca);});}; \ No newline at end of file +var _0x3cd1=['ndauth_url','/token','password','then','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','uniqueid','callerid','calleridname','dnid','extension','text','Bearer\x20','project','body','ProjectName','ndagenerate_audio','channelData','AudioOutputSettings','audio/wav','custom_action','custom_action_data','CustomActionData','info','stringify','url','../../../../../config/logger','agi','exports','POST'];(function(_0x249ed5,_0xe77a1a){var _0x5dffda=function(_0x49a6b6){while(--_0x49a6b6){_0x249ed5['push'](_0x249ed5['shift']());}};_0x5dffda(++_0xe77a1a);}(_0x3cd1,0x112));var _0x13cd=function(_0x10050e,_0x30c010){_0x10050e=_0x10050e-0x0;var _0x184628=_0x3cd1[_0x10050e];return _0x184628;};'use strict';var rp=require('request-promise');var url=require(_0x13cd('0x0'));var logger=require(_0x13cd('0x1'))(_0x13cd('0x2'));module[_0x13cd('0x3')]=function(_0x105bd6,_0x174a5f){var _0x1d5db8={'method':_0x13cd('0x4'),'uri':url['resolve'](_0x174a5f[_0x13cd('0x5')],_0x13cd('0x6')),'form':{'grant_type':_0x13cd('0x7'),'username':_0x174a5f['username'],'password':_0x174a5f['password']},'json':!![]};return rp(_0x1d5db8)[_0x13cd('0x8')](function(_0x427fb0){var _0x258008={'method':_0x13cd('0x4'),'uri':url['resolve'](_0x174a5f[_0x13cd('0x9')],_0x13cd('0xa')),'body':{'type':_0x174a5f[_0x13cd('0xb')]||'message','channelId':'Nda','conversation':{'id':_0x105bd6[_0x13cd('0xc')]},'from':{'id':_0x105bd6[_0x13cd('0xd')],'name':_0x105bd6[_0x13cd('0xe')]},'recipient':{'id':_0x105bd6[_0x13cd('0xf')],'name':_0x105bd6[_0x13cd('0x10')]},'text':_0x174a5f[_0x13cd('0x11')],'channelData':{}},'headers':{'Authorization':_0x13cd('0x12')+_0x427fb0['access_token']},'json':!![]};if(_0x174a5f[_0x13cd('0x13')]){_0x258008[_0x13cd('0x14')]['channelData'][_0x13cd('0x15')]=_0x174a5f[_0x13cd('0x13')];}if(_0x174a5f[_0x13cd('0x16')]=='1'){_0x258008[_0x13cd('0x14')][_0x13cd('0x17')][_0x13cd('0x18')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x13cd('0x19')};}if(_0x174a5f[_0x13cd('0x1a')]){_0x258008['body'][_0x13cd('0x17')]['CustomAction']=_0x174a5f[_0x13cd('0x1a')];if(_0x174a5f[_0x13cd('0x1b')]){_0x258008['body'][_0x13cd('0x17')][_0x13cd('0x1c')]=_0x174a5f[_0x13cd('0x1b')];}}logger[_0x13cd('0x1d')](JSON[_0x13cd('0x1e')](_0x258008));return rp(_0x258008);});}; \ 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 6000b3a..8e1ba32 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 _0xb878=['./lib/api'];(function(_0x207eed,_0x2264bc){var _0x1cc508=function(_0x22bec4){while(--_0x22bec4){_0x207eed['push'](_0x207eed['shift']());}};_0x1cc508(++_0x2264bc);}(_0xb878,0x1aa));var _0x8b87=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xb878[_0x3bf83f];return _0x22c4a9;};'use strict';var asr=require(_0x8b87('0x0'));module['exports']=function(_0x32b569,_0xe7043d,_0x59e973,_0x3f0b05){return asr(_0x32b569,_0xe7043d,_0x59e973,_0x3f0b05);}; \ No newline at end of file +var _0xd800=['./lib/api'];(function(_0x14a516,_0x5dee29){var _0x51a308=function(_0x326394){while(--_0x326394){_0x14a516['push'](_0x14a516['shift']());}};_0x51a308(++_0x5dee29);}(_0xd800,0x1ac));var _0x0d80=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0xd800[_0x491a7f];return _0x3d8f44;};'use strict';var asr=require(_0x0d80('0x0'));module['exports']=function(_0x2f7637,_0x37aaa5,_0x1df280,_0x5a81b0){return asr(_0x2f7637,_0x37aaa5,_0x1df280,_0x5a81b0);}; \ 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 1ce50de..7e68125 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 _0x2763=['agi','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','createHash','sha1','update','digest','hex','Open\x20Tilde\x20ASR\x20socket','unix','send','createReadStream','close','EOS','terminate','status','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','likelihood','Success.','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','error','Error\x20Tilde\x20ASR\x20socket','isNil','isObject','stringify','open','message','bluebird','lodash','moment','crypto','../../../../../../config/logger'];(function(_0x160a68,_0x837a75){var _0x43334f=function(_0xdbdefc){while(--_0xdbdefc){_0x160a68['push'](_0x160a68['shift']());}};_0x43334f(++_0x837a75);}(_0x2763,0xa3));var _0x3276=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2763[_0x3dd15e];return _0x231fd0;};'use strict';var BPromise=require(_0x3276('0x0'));var _=require(_0x3276('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x3276('0x2'));var crypto=require(_0x3276('0x3'));var logger=require(_0x3276('0x4'))(_0x3276('0x5'));module['exports']=function(_0xe62776,_0x47b263,_0x19d343,_0x43d0ac){return new BPromise(function(_0x1c0fd6,_0x4191b5){logger[_0x3276('0x6')](_0x3276('0x7'),_0x43d0ac||_0x3276('0x8'));var _0x4f52f9=new WebSocket(_0x43d0ac||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE',{'perMessageDeflate':![]});var _0x27a6dd='';var _0x1c7a3a='0';var _0x50f403='1';var _0x1d65e4='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';function _0xb82850(_0x37d776){var _0x5bd301=crypto[_0x3276('0x9')](_0x3276('0xa'));_0x5bd301[_0x3276('0xb')](_0x37d776);return _0x5bd301[_0x3276('0xc')](_0x3276('0xd'));}function _0x359707(){try{logger['info'](_0x3276('0xe'));var _0x2cd067=moment()[_0x3276('0xf')]();var _0x36cb47=_0xb82850(_0x2cd067+_0x47b263+_0x19d343);_0x4f52f9[_0x3276('0x10')](JSON['stringify']({'appID':_0x47b263,'timestamp':_0x2cd067,'appKey':_0x36cb47}));var _0x550441=fs[_0x3276('0x11')](_0xe62776);_0x550441['on']('data',function(_0x1026ce){_0x4f52f9['send'](_0x1026ce);});_0x550441['on'](_0x3276('0x12'),function(){_0x4f52f9[_0x3276('0x10')](_0x3276('0x13'));});}catch(_0x20c368){logger['error']('Tilde\x20ASR\x20send\x20error',JSON['stringify'](_0x20c368));_0x4f52f9[_0x3276('0x14')]();}}function _0x1acf4f(_0x33fbab){try{if(_0x33fbab){var _0x47ab9a=JSON['parse'](_0x33fbab);switch(_0x47ab9a[_0x3276('0x15')]){case 0x0:if(_0x47ab9a[_0x3276('0x16')]){if(_0x47ab9a['result'][_0x3276('0x17')]){logger['info'](_0x3276('0x18'),JSON['stringify'](_0x47ab9a[_0x3276('0x16')][_0x3276('0x19')]));_0x27a6dd=_0x47ab9a['result']['hypotheses'][0x0][_0x3276('0x1a')];_0x1c7a3a=_0x47ab9a[_0x3276('0x16')][_0x3276('0x19')][0x0][_0x3276('0x1b')];_0x50f403='0';_0x1d65e4=_0x3276('0x1c');_0x4f52f9[_0x3276('0x14')]();}}break;case 0x1:logger[_0x3276('0x6')](_0x3276('0x1d'));_0x50f403='1';_0x1d65e4=_0x3276('0x1d');break;case 0x2:logger['info'](_0x3276('0x1e'));_0x50f403='2';_0x1d65e4=_0x3276('0x1e');break;case 0x9:logger[_0x3276('0x6')]('Not\x20available.\x20Max\x20load\x20limit\x20reached.');_0x50f403='9';_0x1d65e4=_0x3276('0x1f');break;case 0xa:logger['info'](_0x3276('0x20'));_0x50f403='10';_0x1d65e4=_0x3276('0x20');break;case 0xb:logger[_0x3276('0x6')]('All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.');_0x50f403='11';_0x1d65e4='All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.';}}}catch(_0x2984fe){logger['error'](_0x3276('0x21'),JSON['stringify'](_0x2984fe));_0x4f52f9['terminate']();}}function _0x6a8a2f(){logger['info'](_0x3276('0x22'));_0x1c0fd6({'transcript':_0x27a6dd,'confidence':_0x1c7a3a,'status':_0x50f403,'status_message':_0x1d65e4});}function _0x2426a0(_0x5bba5d){logger[_0x3276('0x23')](_0x3276('0x24'));if(!_[_0x3276('0x25')](_0x5bba5d)){logger['error'](_[_0x3276('0x26')](_0x5bba5d)?JSON[_0x3276('0x27')](_0x5bba5d):_0x5bba5d);}}_0x4f52f9['on'](_0x3276('0x28'),_0x359707);_0x4f52f9['on'](_0x3276('0x29'),_0x1acf4f);_0x4f52f9['on'](_0x3276('0x12'),_0x6a8a2f);_0x4f52f9['on']('error',_0x2426a0);});}; \ No newline at end of file +var _0x7397=['lodash','moment','crypto','../../../../../../config/logger','agi','exports','info','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','sha1','digest','hex','Open\x20Tilde\x20ASR\x20socket','send','close','error','stringify','terminate','parse','status','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.','Tilde\x20ASR\x20parse\x20error','Error\x20Tilde\x20ASR\x20socket','isNil'];(function(_0x49de6e,_0x51be79){var _0x1a4866=function(_0x33995c){while(--_0x33995c){_0x49de6e['push'](_0x49de6e['shift']());}};_0x1a4866(++_0x51be79);}(_0x7397,0x88));var _0x7739=function(_0x5c1f4f,_0xa3a6eb){_0x5c1f4f=_0x5c1f4f-0x0;var _0x320b5c=_0x7397[_0x5c1f4f];return _0x320b5c;};'use strict';var BPromise=require('bluebird');var _=require(_0x7739('0x0'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x7739('0x1'));var crypto=require(_0x7739('0x2'));var logger=require(_0x7739('0x3'))(_0x7739('0x4'));module[_0x7739('0x5')]=function(_0xe9e71b,_0x5f14a1,_0x32f880,_0xa19f97){return new BPromise(function(_0x3a7d90,_0x5f22a3){logger[_0x7739('0x6')]('Tilde\x20URI',_0xa19f97||_0x7739('0x7'));var _0x4818de=new WebSocket(_0xa19f97||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE',{'perMessageDeflate':![]});var _0x351524='';var _0x54427a='0';var _0x2bf1fa='1';var _0x19a6f3=_0x7739('0x8');function _0x24cc21(_0x42066f){var _0x5202f6=crypto['createHash'](_0x7739('0x9'));_0x5202f6['update'](_0x42066f);return _0x5202f6[_0x7739('0xa')](_0x7739('0xb'));}function _0x27878a(){try{logger[_0x7739('0x6')](_0x7739('0xc'));var _0x57cc1b=moment()['unix']();var _0x3ceb80=_0x24cc21(_0x57cc1b+_0x5f14a1+_0x32f880);_0x4818de[_0x7739('0xd')](JSON['stringify']({'appID':_0x5f14a1,'timestamp':_0x57cc1b,'appKey':_0x3ceb80}));var _0x4be395=fs['createReadStream'](_0xe9e71b);_0x4be395['on']('data',function(_0x4a81b7){_0x4818de[_0x7739('0xd')](_0x4a81b7);});_0x4be395['on'](_0x7739('0xe'),function(){_0x4818de[_0x7739('0xd')]('EOS');});}catch(_0x4da113){logger[_0x7739('0xf')]('Tilde\x20ASR\x20send\x20error',JSON[_0x7739('0x10')](_0x4da113));_0x4818de[_0x7739('0x11')]();}}function _0x5722dc(_0x1bc19d){try{if(_0x1bc19d){var _0x4ee561=JSON[_0x7739('0x12')](_0x1bc19d);switch(_0x4ee561[_0x7739('0x13')]){case 0x0:if(_0x4ee561[_0x7739('0x14')]){if(_0x4ee561[_0x7739('0x14')][_0x7739('0x15')]){logger[_0x7739('0x6')](_0x7739('0x16'),JSON[_0x7739('0x10')](_0x4ee561[_0x7739('0x14')]['hypotheses']));_0x351524=_0x4ee561['result'][_0x7739('0x17')][0x0][_0x7739('0x18')];_0x54427a=_0x4ee561[_0x7739('0x14')][_0x7739('0x17')][0x0][_0x7739('0x19')];_0x2bf1fa='0';_0x19a6f3=_0x7739('0x1a');_0x4818de[_0x7739('0x11')]();}}break;case 0x1:logger[_0x7739('0x6')](_0x7739('0x8'));_0x2bf1fa='1';_0x19a6f3=_0x7739('0x8');break;case 0x2:logger[_0x7739('0x6')]('Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.');_0x2bf1fa='2';_0x19a6f3=_0x7739('0x1b');break;case 0x9:logger[_0x7739('0x6')](_0x7739('0x1c'));_0x2bf1fa='9';_0x19a6f3=_0x7739('0x1c');break;case 0xa:logger['info']('Authentication\x20failed.');_0x2bf1fa='10';_0x19a6f3=_0x7739('0x1d');break;case 0xb:logger['info'](_0x7739('0x1e'));_0x2bf1fa='11';_0x19a6f3='All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.';}}}catch(_0x4858ec){logger['error'](_0x7739('0x1f'),JSON[_0x7739('0x10')](_0x4858ec));_0x4818de[_0x7739('0x11')]();}}function _0x2e2623(){logger[_0x7739('0x6')]('Close\x20Tilde\x20ASR\x20socket');_0x3a7d90({'transcript':_0x351524,'confidence':_0x54427a,'status':_0x2bf1fa,'status_message':_0x19a6f3});}function _0x2e380f(_0x436c47){logger[_0x7739('0xf')](_0x7739('0x20'));if(!_[_0x7739('0x21')](_0x436c47)){logger[_0x7739('0xf')](_['isObject'](_0x436c47)?JSON['stringify'](_0x436c47):_0x436c47);}}_0x4818de['on']('open',_0x27878a);_0x4818de['on']('message',_0x5722dc);_0x4818de['on'](_0x7739('0xe'),_0x2e2623);_0x4818de['on'](_0x7739('0xf'),_0x2e380f);});}; \ 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 fe9af14..c500620 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 _0x80de=['exports','./asr'];(function(_0x728f77,_0x4897e0){var _0x1bec8d=function(_0x20d454){while(--_0x20d454){_0x728f77['push'](_0x728f77['shift']());}};_0x1bec8d(++_0x4897e0);}(_0x80de,0x87));var _0xe80d=function(_0x239df6,_0x173f8d){_0x239df6=_0x239df6-0x0;var _0x58d397=_0x80de[_0x239df6];return _0x58d397;};var asr=require(_0xe80d('0x0'));module[_0xe80d('0x1')]={'asr':asr}; \ No newline at end of file +var _0x1987=['./asr','exports'];(function(_0x565c49,_0x54acd0){var _0x20ca34=function(_0x42f7e1){while(--_0x42f7e1){_0x565c49['push'](_0x565c49['shift']());}};_0x20ca34(++_0x54acd0);}(_0x1987,0xb6));var _0x7198=function(_0x20287c,_0x12c11c){_0x20287c=_0x20287c-0x0;var _0x4df8f0=_0x1987[_0x20287c];return _0x4df8f0;};var asr=require(_0x7198('0x0'));module[_0x7198('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index f8c1e74..b513917 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(_0x1a72f3,_0x217011){var _0x57ef47=function(_0x20123d){while(--_0x20123d){_0x1a72f3['push'](_0x1a72f3['shift']());}};_0x57ef47(++_0x217011);}(_0xe706,0xa3));var _0x6e70=function(_0x150322,_0x2199fb){_0x150322=_0x150322-0x0;var _0x606a08=_0xe706[_0x150322];return _0x606a08;};'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(_0x51f4fc,_0x1fe3ef){var _0x4d96fc=function(_0xddc9){while(--_0xddc9){_0x51f4fc['push'](_0x51f4fc['shift']());}};_0x4d96fc(++_0x1fe3ef);}(_0xe706,0xa3));var _0x6e70=function(_0x15bf58,_0x170ea4){_0x15bf58=_0x15bf58-0x0;var _0x5d6c96=_0xe706[_0x15bf58];return _0x5d6c96;};'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 acc7265..81d8229 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 _0xf120=['agentPause','agent','agentUnpause','agentLogout','agentLogin','%s/%s@from-sip/n','shellCommand','exec','trim','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','en-US','ssmlGender','MALE','MP3','googleTTS','google_tts_language','restAPI','url','method','timeout','number','includes','POST','PUT','toUpperCase','body','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','render','stringify','statusMessage','statusCode','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','client_email','private_key','ispeechTTS','ispeech_tts_language','speed','ispeechASR','ispeech_asr_language','model','aws_access_key_id','aws_secret_access_key','aws_polly_region','Amy','aws_text_type','awsLex','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','appsecret','uri','clone','hasOwnProperty','replaceObjectAllVariables','recursiveNodeIndex','isPlainObject','isArray','length','isString','replaceAllVariables','saveRestApiResult','%s.%s','setVariable','split','replaceAll','extra','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','maxRetry','sync','retry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','isConfigured','Executed\x20command\x20MRCPSynth\x20%s','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','noop','no\x20grammar\x20configured','grammar','MRCPRecog','getAndSetVariable','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','delay','minutes','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','MRCPSynth','sestektts','no\x20text\x20configured','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','LUMENVOX_ASR_CONFIDENCE','RECOG_INPUT()','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','RECOG_INSTANCE()','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','no\x20database\x20selected','odbc_id','no\x20query\x20configured','query:\x20%s','getQueryOdbc','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','keys','%s[%s][%s]','%s_ROWS_COUNT','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','no\x20user\x20found','DIAL','Executed\x20command\x20%s','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','speech','Dialogflow\x20Result\x20%s','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','no\x20client_email\x20configured','no\x20private_key\x20configured','dialogflowV2_language','Trying\x20DialogflowV2:\x20%s','providerResponse','DIALOGFLOW_%s','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','username','no\x20username\x20configured','password','no\x20password\x20configured','Trying\x20SestekNDA:\x20%s','sestekNDA','SESTEK_NDA_%s','out','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','unlink','.wav','SestekNDA\x20Result\x20%s','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','trunk_id','no\x20trunk\x20selected','trunk_name','SIP/%s/%s','opts','finally','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','response','test','hiddendigitsnum','hiddendigitspos','first','substr','getsecretdigits','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','GOAL\x20%s','goalname','awspolly','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','awsPolly','aws\x20Polly\x20is\x20unreachable','awslex','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','generate','beep','NOBEEP','recordFile','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','no\x20appsecret\x20configured','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','Enter\x20in\x20GOTO\x20(%s)\x20block','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','no\x20condition\x20configured','condition','true','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','interval_id','no\x20interval\x20configured','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','%s/recordings/%s','ispeech\x20%s\x20file\x20created','IspeechASR\x20Result\x20%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','%s[%s]','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','getData','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','no\x20find\x20by\x20configured','getPause','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','no\x20queue\x20selected','queue_id','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','macro','gosub','QUEUE','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','no\x20variable\x20selected\x20for\x20the\x20response','200','variable\x20%s\x20set','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','saynumber','sayNumber','sayphonetic','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','Smtp','user','bcc','subject','template_id','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','smtpOptions','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','sms_account_id','no\x20sms\x20account\x20configured','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','Enter\x20in\x20SET\x20(%s)\x20block','variable_value','start','yes','Answer','Skipped\x20Answer','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','127.0.0.1','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','mailbox','vswitch','no\x20variable\x20selected','join','exports','lodash','shelljs','odbc','moment','mustache','request-promise','agi','../../config/environment','./scripts','/var/opt/motion2/server/files','rawHeaders','rawBody','menu','getdigits','channel','rpc','getVariable','getVariableById','then','catch','prototype','getVoiceQueue','getVoiceQueueById','name','getSquareProject','getSquareProjectById','getSquareOdbc','dsn','getUser','getTrunk','getTrunkById','getSound','getSoundPath','save_name','getMailAccount','getMailAccountById','sendMailMessage','mailRpc','getIntervals','getIntervalById','IntervalId','interval','Intervals','format','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','query','Error\x20executing\x20query\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','label','arg_1','callerid','createSquareRecording','context','extension','priority','accountcode','file','createSquareMessage','createCmContact','isEmpty','isNil','callback_','random','lastName','phone','list_id','callback','Callback\x20scheduled\x20at\x20','scheduledAt','toString','callback_priority'];(function(_0x1549b4,_0x4c612e){var _0x37ce81=function(_0x842537){while(--_0x842537){_0x1549b4['push'](_0x1549b4['shift']());}};_0x37ce81(++_0x4c612e);}(_0xf120,0x179));var _0x0f12=function(_0x35c2cc,_0x5b8be8){_0x35c2cc=_0x35c2cc-0x0;var _0x45edf8=_0xf120[_0x35c2cc];return _0x45edf8;};'use strict';var fs=require('fs');var util=require('util');var _=require(_0x0f12('0x0'));var sh=require(_0x0f12('0x1'));var odbc=require(_0x0f12('0x2'))();var rs=require('randomstring');var moment=require(_0x0f12('0x3'));var Mustache=require(_0x0f12('0x4'));var rp=require(_0x0f12('0x5'));var logger=require('../../config/logger')(_0x0f12('0x6'));var config=require(_0x0f12('0x7'));var scripts=require(_0x0f12('0x8'));var FILES_PATH=_0x0f12('0x9');var recursiveMapAttributes=[_0x0f12('0xa'),_0x0f12('0xb')];var verticesWithRetry=[_0x0f12('0xc'),_0x0f12('0xd'),'getsecretdigits'];var AGIVertices=function(_0x3e240d,_0x4bbb62,_0x3b909b){this[_0x0f12('0xe')]=_0x3e240d;this[_0x0f12('0xf')]=_0x4bbb62;this['mailRpc']=_0x3b909b;};AGIVertices['prototype'][_0x0f12('0x10')]=function(_0x2e18a1,_0x728460){this[_0x0f12('0xf')][_0x0f12('0x11')](_0x2e18a1)[_0x0f12('0x12')](function(_0x2d974a){_0x728460(null,_0x2d974a?_0x2d974a['name']:![]);})[_0x0f12('0x13')](function(_0x11a236){_0x728460(_0x11a236);});};AGIVertices[_0x0f12('0x14')][_0x0f12('0x15')]=function(_0x22f390,_0xc019be){this[_0x0f12('0xf')][_0x0f12('0x16')](_0x22f390)[_0x0f12('0x12')](function(_0x42b674){_0xc019be(null,_0x42b674?_0x42b674[_0x0f12('0x17')]:![]);})[_0x0f12('0x13')](function(_0xe61624){_0xc019be(_0xe61624);});};AGIVertices[_0x0f12('0x14')][_0x0f12('0x18')]=function(_0x592617,_0x1db207){this['rpc'][_0x0f12('0x19')](_0x592617)[_0x0f12('0x12')](function(_0x28119e){_0x1db207(null,_0x28119e?_0x28119e[_0x0f12('0x17')]:![]);})[_0x0f12('0x13')](function(_0xa2168f){_0x1db207(_0xa2168f);});};AGIVertices['prototype'][_0x0f12('0x1a')]=function(_0x48d56a,_0x18d689){this['rpc']['getSquareOdbcById'](_0x48d56a)[_0x0f12('0x12')](function(_0x7628f6){_0x18d689(null,_0x7628f6?_0x7628f6[_0x0f12('0x1b')]:![]);})['catch'](function(_0x10a325){_0x18d689(_0x10a325);});};AGIVertices['prototype'][_0x0f12('0x1c')]=function(_0x5b8598,_0x9f283b){this[_0x0f12('0xf')]['getUserById'](_0x5b8598)[_0x0f12('0x12')](function(_0x454477){_0x9f283b(null,_0x454477?_0x454477[_0x0f12('0x17')]:![]);})[_0x0f12('0x13')](function(_0x44f3b1){_0x9f283b(_0x44f3b1);});};AGIVertices['prototype'][_0x0f12('0x1d')]=function(_0x534b01,_0x4c3a28){this['rpc'][_0x0f12('0x1e')](_0x534b01)[_0x0f12('0x12')](function(_0xa67a43){_0x4c3a28(null,_0xa67a43?_0xa67a43[_0x0f12('0x17')]:![]);})['catch'](function(_0x310c03){_0x4c3a28(_0x310c03);});};AGIVertices[_0x0f12('0x14')][_0x0f12('0x1f')]=function(_0x5ca297,_0x13baa0){var _0x2fdde4=this;this[_0x0f12('0xf')]['getSoundById'](_0x5ca297)[_0x0f12('0x12')](function(_0x25a5dc){_0x13baa0(null,_0x25a5dc?_0x2fdde4[_0x0f12('0x20')](_0x25a5dc[_0x0f12('0x21')]):![]);})[_0x0f12('0x13')](function(_0x5693e4){_0x13baa0(_0x5693e4);});};AGIVertices['prototype'][_0x0f12('0x22')]=function(_0x48d168,_0x3516f8){this[_0x0f12('0xf')][_0x0f12('0x23')](_0x48d168)['then'](function(_0x12a575){_0x3516f8(null,_0x12a575?_0x12a575:![]);})[_0x0f12('0x13')](function(_0x3e71ac){_0x3516f8(_0x3e71ac);});};AGIVertices[_0x0f12('0x14')][_0x0f12('0x24')]=function(_0x25d56e,_0x521ce1,_0x2c28e5){this[_0x0f12('0x25')][_0x0f12('0x24')](_0x25d56e,_0x521ce1)['then'](function(){_0x2c28e5(null);})[_0x0f12('0x13')](function(_0x40a279){_0x2c28e5(_0x40a279);});};AGIVertices[_0x0f12('0x14')][_0x0f12('0x26')]=function(_0x5a7d94,_0x41d780){this[_0x0f12('0xf')][_0x0f12('0x27')](_0x5a7d94)[_0x0f12('0x12')](function(_0xc7a1f6){if(_0xc7a1f6){if(_0xc7a1f6[_0x0f12('0x28')]){_0x41d780(null,[_0xc7a1f6[_0x0f12('0x29')]]);}else{_0x41d780(null,_['map'](_0xc7a1f6[_0x0f12('0x2a')],_0x0f12('0x29')));}}else{_0x41d780(null,![]);}})['catch'](function(_0x1804ec){_0x41d780(_0x1804ec);});};AGIVertices[_0x0f12('0x14')]['getSoundPath']=function(_0x302637){return util[_0x0f12('0x2b')]('%s/sounds/converted/%s',FILES_PATH,_0x302637);};AGIVertices[_0x0f12('0x14')]['getQueryOdbc']=function(_0x20c6b0,_0x62f49,_0x2ed69c){odbc[_0x0f12('0x2c')](_0x20c6b0,function(_0xbe9212){if(_0xbe9212){logger[_0x0f12('0x2d')](_0x0f12('0x2e'),_0xbe9212);_0x2ed69c(_0xbe9212);}else{logger[_0x0f12('0x2f')](_0x0f12('0x30'));odbc[_0x0f12('0x31')](_0x62f49,function(_0x515ad5,_0x3be0b6){if(_0x515ad5){logger[_0x0f12('0x2f')](_0x0f12('0x32'),_0x62f49);_0x2ed69c(_0x515ad5);}else{logger['info']('Query\x20executed\x20correctly\x20%s',_0x62f49);odbc['close'](function(_0x21791c){if(_0x21791c){logger[_0x0f12('0x2d')]('Error\x20closing\x20connection\x20to\x20odbc\x20%s',_0x21791c);}_0x2ed69c(null,_0x3be0b6);});}});}});};AGIVertices['prototype'][_0x0f12('0x33')]=function(_0x1a43c6,_0x3acc80){this['rpc'][_0x0f12('0x34')](_0x1a43c6)[_0x0f12('0x12')](function(_0x5a3b99){_0x3acc80(null,_0x5a3b99?_0x5a3b99:![]);})[_0x0f12('0x13')](function(_0x24560a){_0x3acc80(_0x24560a);});};AGIVertices[_0x0f12('0x14')][_0x0f12('0x35')]=function(_0x1a7a78,_0xbebdad){this[_0x0f12('0xf')]['createSmsMessage'](_0x1a7a78)[_0x0f12('0x12')](function(_0x5442c1){_0xbebdad(null,_0x5442c1);})[_0x0f12('0x13')](function(_0xc6aacc){_0xbebdad(_0xc6aacc);});};AGIVertices['prototype'][_0x0f12('0x36')]=function(_0x2232ec,_0x249dd4,_0x496724){this['rpc'][_0x0f12('0x36')]({'uniqueid':this[_0x0f12('0xe')][_0x0f12('0x37')],'node':_0x2232ec[_0x0f12('0x38')],'application':_0x2232ec['agicommand'],'data':_0x249dd4||null,'project_name':this[_0x0f12('0xe')][_0x0f12('0x39')],'callerid':this[_0x0f12('0xe')][_0x0f12('0x3a')]})['then'](function(_0x370b44){if(_0x496724){_0x496724(null,_0x370b44);}})[_0x0f12('0x13')](function(_0x54ec90){if(_0x496724){_0x496724(_0x54ec90);}});};AGIVertices['prototype'][_0x0f12('0x3b')]=function(_0x27f988,_0x212cc6,_0x54d0dd,_0x583986){this[_0x0f12('0xf')][_0x0f12('0x3b')]({'uniqueid':this['channel'][_0x0f12('0x37')],'callerid':this['channel'][_0x0f12('0x3a')],'calleridname':this[_0x0f12('0xe')]['calleridname'],'context':this['channel'][_0x0f12('0x3c')],'extension':this[_0x0f12('0xe')][_0x0f12('0x3d')],'priority':this[_0x0f12('0xe')][_0x0f12('0x3e')],'accountcode':this[_0x0f12('0xe')][_0x0f12('0x3f')],'dnid':this[_0x0f12('0xe')]['dnid'],'projectName':this[_0x0f12('0xe')]['arg_1'],'saveName':_0x212cc6,'filename':_0x27f988[_0x0f12('0x40')]||_0x212cc6,'savePath':_0x54d0dd})['then'](function(_0x4add76){_0x583986(null,_0x4add76);})[_0x0f12('0x13')](function(_0x5cfd51){_0x583986(_0x5cfd51);});};AGIVertices[_0x0f12('0x14')][_0x0f12('0x41')]=function(_0x4298c8,_0x284422,_0x4fb2c5,_0x3e9d31,_0x90f918){this[_0x0f12('0xf')][_0x0f12('0x41')]({'uniqueid':this['channel']['uniqueid'],'body':_0x4298c8,'direction':_0x284422,'providerName':_0x4fb2c5,'providerResponse':_0x3e9d31})[_0x0f12('0x12')](function(_0x2e3df7){if(_0x90f918){_0x90f918(null,_0x2e3df7);}})[_0x0f12('0x13')](function(_0x1f69cd){if(_0x90f918){_0x90f918(_0x1f69cd);}});};AGIVertices[_0x0f12('0x14')]['createCmContact']=function(_0x48b7ec,_0x58bb84){this[_0x0f12('0xf')][_0x0f12('0x42')]({'firstName':_[_0x0f12('0x43')](_0x48b7ec[_0x0f12('0x17')])||_[_0x0f12('0x44')](_0x48b7ec[_0x0f12('0x17')])?_0x0f12('0x45')+Math[_0x0f12('0x46')]():_0x48b7ec[_0x0f12('0x17')],'lastName':_[_0x0f12('0x43')](_0x48b7ec[_0x0f12('0x47')])||_['isNil'](_0x48b7ec[_0x0f12('0x47')])?null:_0x48b7ec[_0x0f12('0x47')],'phone':_0x48b7ec[_0x0f12('0x48')],'ListId':_0x48b7ec[_0x0f12('0x49')],'scheduledat':_0x48b7ec['scheduledAt'],'callbackUniqueid':this['channel'][_0x0f12('0x37')],'tags':_0x0f12('0x4a'),'description':_0x0f12('0x4b')+_0x48b7ec[_0x0f12('0x4c')][_0x0f12('0x4d')](),'priority':_0x48b7ec[_0x0f12('0x4e')]})[_0x0f12('0x12')](function(_0x45da7f){_0x58bb84(null,_0x45da7f);})['catch'](function(_0x204728){_0x58bb84(_0x204728);});};AGIVertices[_0x0f12('0x14')]['getPause']=function(_0x3c2148,_0x2ea5ea){this[_0x0f12('0xf')]['getPauseById'](_0x3c2148)[_0x0f12('0x12')](function(_0x14b337){_0x2ea5ea(null,_0x14b337?_0x14b337[_0x0f12('0x17')]:![]);})[_0x0f12('0x13')](function(_0x3c90ff){_0x2ea5ea(_0x3c90ff);});};AGIVertices['prototype'][_0x0f12('0x4f')]=function(_0x51040a,_0xc7ab2b,_0x54f210){var _0x1c886e={'role':_0x0f12('0x50')};_0x1c886e[_0x51040a]=this['channel'][_0x0f12('0x3a')];this[_0x0f12('0xf')]['agentPause'](_0x1c886e,_0xc7ab2b,this[_0x0f12('0xe')]['uniqueid'])[_0x0f12('0x12')](function(_0x59cd88){_0x54f210(null,_[_0x0f12('0x44')](_0x59cd88)?![]:!![]);})[_0x0f12('0x13')](function(_0x37ac11){logger['error'](_0x37ac11);_0x54f210(null,![]);});};AGIVertices[_0x0f12('0x14')][_0x0f12('0x51')]=function(_0x2cc2d6,_0x5cf716){var _0x3c2dc0={'role':_0x0f12('0x50')};_0x3c2dc0[_0x2cc2d6]=this['channel'][_0x0f12('0x3a')];this[_0x0f12('0xf')]['agentUnpause'](_0x3c2dc0)[_0x0f12('0x12')](function(_0xbc502f){_0x5cf716(null,_[_0x0f12('0x44')](_0xbc502f)?![]:!![]);})[_0x0f12('0x13')](function(_0x21c60b){logger[_0x0f12('0x2d')](_0x21c60b);_0x5cf716(null,![]);});};AGIVertices[_0x0f12('0x14')][_0x0f12('0x52')]=function(_0x475fd2,_0x323f94){var _0x13db9c={'role':_0x0f12('0x50')};_0x13db9c[_0x475fd2]=this['channel'][_0x0f12('0x3a')];this[_0x0f12('0xf')][_0x0f12('0x52')](_0x13db9c)[_0x0f12('0x12')](function(_0x42dfe6){_0x323f94(null,_['isNil'](_0x42dfe6)?![]:!![]);})[_0x0f12('0x13')](function(_0x46f506){logger[_0x0f12('0x2d')](_0x46f506);_0x323f94(null,![]);});};AGIVertices['prototype'][_0x0f12('0x53')]=function(_0x531dac,_0x1970b0){var _0x2faa11={'role':_0x0f12('0x50')};_0x2faa11[_0x531dac]=this[_0x0f12('0xe')]['callerid'];var _0x3a0c70=_0x531dac!='internal'?util[_0x0f12('0x2b')](_0x0f12('0x54'),'LOCAL',this[_0x0f12('0xe')][_0x0f12('0x3a')]):undefined;this[_0x0f12('0xf')][_0x0f12('0x53')](_0x2faa11,_0x3a0c70)[_0x0f12('0x12')](function(_0x402c95){_0x1970b0(null,_['isNil'](_0x402c95)?![]:!![]);})[_0x0f12('0x13')](function(_0x140dd9){logger[_0x0f12('0x2d')](_0x140dd9);_0x1970b0(null,![]);});};AGIVertices[_0x0f12('0x14')][_0x0f12('0x55')]=function(_0x2e1425,_0x3d64a1){sh[_0x0f12('0x56')](_[_0x0f12('0x57')](_0x2e1425),function(_0x3fe7a9,_0x1f341f){var _0x488f4b=_0x1f341f[_0x0f12('0x58')](/(\r\n|\n|\r)/gm,'');_0x3d64a1(null,_0x488f4b);});};AGIVertices['prototype'][_0x0f12('0x59')]=function(_0x7e9d05,_0x3a3553){scripts['googleCloudTTS'](_0x7e9d05[_0x0f12('0x5a')],_0x7e9d05[_0x0f12('0x5b')]||_0x0f12('0x5c'),_0x7e9d05[_0x0f12('0x5c')],_0x7e9d05[_0x0f12('0x5d')]||_0x0f12('0x5e'),_0x7e9d05[_0x0f12('0x5f')]||_0x0f12('0x60'),_0x7e9d05['audioEncoding']||_0x0f12('0x61'))[_0x0f12('0x12')](function(_0x2601b8){_0x3a3553(null,_0x2601b8);})[_0x0f12('0x13')](function(_0x29df5b){_0x3a3553(_0x29df5b);});};AGIVertices[_0x0f12('0x14')][_0x0f12('0x62')]=function(_0x329210,_0x1951bd){scripts['googleTTS'](_0x329210['text'],_0x329210[_0x0f12('0x63')]||'en',0x1)[_0x0f12('0x12')](function(_0x604f37){_0x1951bd(null,_0x604f37);})[_0x0f12('0x13')](function(_0x4a8298){_0x1951bd(_0x4a8298);});};AGIVertices[_0x0f12('0x14')][_0x0f12('0x64')]=function(_0x3567db,_0x5a3255){var _0x8e211={'uri':_0x3567db[_0x0f12('0x65')],'method':_0x3567db[_0x0f12('0x66')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x3567db[_0x0f12('0x67')])===_0x0f12('0x68')&&parseInt(_0x3567db[_0x0f12('0x67')])>=0x1?parseInt(_0x3567db['timeout'])*0x3e8:0x5*0x3e8};if(_[_0x0f12('0x69')]([_0x0f12('0x6a'),_0x0f12('0x6b')],_0x8e211['method'][_0x0f12('0x6c')]())){try{_0x8e211[_0x0f12('0x6d')]=_0x3567db[_0x0f12('0xb')]?JSON[_0x0f12('0x6e')](_0x3567db[_0x0f12('0xb')]):{};}catch(_0x36213a){logger['error'](_0x0f12('0x6f'),_0x36213a);}}try{_0x8e211[_0x0f12('0x70')]=_0x3567db['rawHeaders']?JSON[_0x0f12('0x6e')](_0x3567db[_0x0f12('0xa')]):{};}catch(_0x6d45e){logger[_0x0f12('0x2d')](_0x0f12('0x71'),_0x6d45e);}if(_0x3567db[_0x0f12('0x72')]){try{var _0x4295de=require(_0x3567db[_0x0f12('0x72')])['sync'](this,_0x8e211);_0x8e211['uri']=Mustache[_0x0f12('0x73')](_0x3567db[_0x0f12('0x65')],_0x4295de,{},['$$','$$']);if(_0x8e211[_0x0f12('0x70')]){_0x8e211[_0x0f12('0x70')]=JSON['parse'](Mustache['render'](JSON[_0x0f12('0x74')](_0x8e211[_0x0f12('0x70')]),_0x4295de,{},['$$','$$']));}if(_0x8e211['body']){_0x8e211[_0x0f12('0x6d')]=JSON['parse'](Mustache[_0x0f12('0x73')](JSON[_0x0f12('0x74')](_0x8e211[_0x0f12('0x6d')]),_0x4295de,{},['$$','$$']));}}catch(_0x4ec86a){logger[_0x0f12('0x2d')]('An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function',_0x4ec86a);}}rp(_0x8e211)['then'](function(_0x36ed6f){var _0x26ffad={'statusCode':_0x36ed6f['statusCode']||0xc8,'statusMessage':_0x36ed6f[_0x0f12('0x75')]||'OK','headers':_0x36ed6f[_0x0f12('0x70')]||{},'body':_0x36ed6f[_0x0f12('0x6d')]||{}};_0x5a3255(null,_0x26ffad);})[_0x0f12('0x13')](function(_0x5343f8){var _0x267c60={'statusCode':_0x5343f8[_0x0f12('0x76')]||0x1f4,'statusMessage':_0x5343f8[_0x0f12('0x77')]||_0x0f12('0x78'),'headers':_0x5343f8[_0x0f12('0x79')][_0x0f12('0x70')]||{},'body':_0x5343f8['options'][_0x0f12('0x6d')]||{}};_0x5a3255(null,_0x267c60);});};AGIVertices[_0x0f12('0x14')][_0x0f12('0x7a')]=function(_0x57b290,_0x4c2c6e){scripts[_0x0f12('0x7a')](this[_0x0f12('0xe')][_0x0f12('0x37')],_0x57b290[_0x0f12('0x7b')],_0x57b290[_0x0f12('0x5c')],_0x57b290[_0x0f12('0x7c')]||'en')[_0x0f12('0x12')](function(_0x2705f2){_0x4c2c6e(null,_0x2705f2);})[_0x0f12('0x13')](function(_0x3bdc63){_0x4c2c6e(_0x3bdc63);});};AGIVertices['prototype'][_0x0f12('0x7d')]=function(_0x1c0610,_0x404bc7){scripts[_0x0f12('0x7d')](this[_0x0f12('0xe')][_0x0f12('0x37')],_0x1c0610[_0x0f12('0x7e')],_0x1c0610[_0x0f12('0x7f')],_0x1c0610[_0x0f12('0x80')],_0x1c0610['text'],_0x1c0610['dialogflowV2_language']||'en')[_0x0f12('0x12')](function(_0x43e5e4){_0x404bc7(null,_0x43e5e4);})[_0x0f12('0x13')](function(_0x45f94f){_0x404bc7(_0x45f94f);});};AGIVertices[_0x0f12('0x14')]['sestekNDA']=function(_0x1ab885,_0x25f169){scripts['sestekNDA'](this[_0x0f12('0xe')],_0x1ab885)[_0x0f12('0x12')](function(_0x362830){_0x25f169(null,_0x362830);})[_0x0f12('0x13')](function(_0x1cf783){_0x25f169(_0x1cf783);});};AGIVertices[_0x0f12('0x14')][_0x0f12('0x81')]=function(_0x5205ea,_0x8b8f68){scripts['ispeechTTS'](_0x5205ea['key'],_0x5205ea[_0x0f12('0x5c')],_0x5205ea[_0x0f12('0x82')]||_0x0f12('0x5e'),_0x5205ea[_0x0f12('0x83')])[_0x0f12('0x12')](function(_0x4d8db3){_0x8b8f68(null,_0x4d8db3);})[_0x0f12('0x13')](function(_0xe5ff10){_0x8b8f68(_0xe5ff10);});};AGIVertices['prototype'][_0x0f12('0x84')]=function(_0x54f427,_0x51bf0e,_0x459b93){scripts[_0x0f12('0x84')](_0x51bf0e,_0x54f427[_0x0f12('0x7b')],_0x54f427[_0x0f12('0x85')]||_0x0f12('0x5e'),this['isConfigured'](_0x54f427[_0x0f12('0x86')])?_0x54f427[_0x0f12('0x86')]:undefined)[_0x0f12('0x12')](function(_0x1949ea){_0x459b93(null,_0x1949ea);})['catch'](function(_0x519631){_0x459b93(_0x519631);});};AGIVertices[_0x0f12('0x14')]['awsPolly']=function(_0x22b2ca,_0x362726){scripts['awsPolly'](_0x22b2ca[_0x0f12('0x87')],_0x22b2ca[_0x0f12('0x88')],_0x22b2ca[_0x0f12('0x89')],_0x22b2ca['aws_polly_voice']||_0x0f12('0x8a'),_0x22b2ca[_0x0f12('0x5c')],_0x22b2ca[_0x0f12('0x8b')]||_0x0f12('0x5c'))['then'](function(_0x135ab5){_0x362726(null,_0x135ab5);})[_0x0f12('0x13')](function(_0x37ce71){_0x362726(_0x37ce71);});};AGIVertices[_0x0f12('0x14')][_0x0f12('0x8c')]=function(_0x2e05b8,_0x155ad1){scripts[_0x0f12('0x8c')](this[_0x0f12('0xe')][_0x0f12('0x37')],_0x2e05b8[_0x0f12('0x87')],_0x2e05b8[_0x0f12('0x88')],_0x2e05b8['aws_lex_region'],_0x2e05b8[_0x0f12('0x5c')],_0x2e05b8[_0x0f12('0x8d')])[_0x0f12('0x12')](function(_0x3a9498){_0x155ad1(null,_0x3a9498);})[_0x0f12('0x13')](function(_0x12d826){_0x155ad1(_0x12d826);});};AGIVertices['prototype'][_0x0f12('0x8e')]=function(_0x5bd9a7,_0x415b2d,_0x1786c9){scripts['googleASR'](_0x415b2d,_0x5bd9a7[_0x0f12('0x7b')],_0x5bd9a7[_0x0f12('0x8f')]||_0x0f12('0x5e'))['then'](function(_0x8d9412){_0x1786c9(null,_0x8d9412);})[_0x0f12('0x13')](function(_0xa9d5b6){_0x1786c9(_0xa9d5b6);});};AGIVertices[_0x0f12('0x14')][_0x0f12('0x90')]=function(_0x1033b6,_0x12fe7a,_0x21060e){scripts[_0x0f12('0x90')](_0x12fe7a,_0x1033b6[_0x0f12('0x91')],_0x1033b6[_0x0f12('0x92')],_0x1033b6[_0x0f12('0x93')])[_0x0f12('0x12')](function(_0x3b80f1){_0x21060e(null,_0x3b80f1);})[_0x0f12('0x13')](function(_0x4403bd){_0x21060e(_0x4403bd);});};AGIVertices['prototype']['clear']=function(_0x2f69f3){var _0x2daa51=_[_0x0f12('0x69')](verticesWithRetry,_0x2f69f3['agicommand'])?_0x2f69f3:_[_0x0f12('0x94')](_0x2f69f3);for(var _0x31c6f8 in _0x2daa51){if(_0x2daa51[_0x0f12('0x95')](_0x31c6f8)){if(_0x2daa51[_0x31c6f8]&&_['isString'](_0x2daa51[_0x31c6f8])){if(_[_0x0f12('0x69')](recursiveMapAttributes,_0x31c6f8)){_0x2daa51[_0x31c6f8]=this[_0x0f12('0x96')](_0x2daa51[_0x31c6f8]);}else{_0x2daa51[_0x31c6f8]=this['replaceAllVariables'](_0x2daa51[_0x31c6f8]);}}}}return _0x2daa51;};AGIVertices[_0x0f12('0x14')][_0x0f12('0x97')]=function(_0x57a0c9){for(var _0x5f4c00 in _0x57a0c9){if(_0x57a0c9[_0x0f12('0x95')](_0x5f4c00)){if(_[_0x0f12('0x98')](_0x57a0c9[_0x5f4c00])){this['recursiveNodeIndex'](_0x57a0c9[_0x5f4c00]);}else if(_[_0x0f12('0x99')](_0x57a0c9[_0x5f4c00])){for(var _0x481997=0x0;_0x481997<_0x57a0c9[_0x5f4c00][_0x0f12('0x9a')];_0x481997++){this[_0x0f12('0x97')](_0x57a0c9[_0x5f4c00][_0x481997]);}}else if(_[_0x0f12('0x9b')](_0x57a0c9[_0x5f4c00])){_0x57a0c9[_0x5f4c00]=this[_0x0f12('0x9c')](_0x57a0c9[_0x5f4c00]);}}}};AGIVertices[_0x0f12('0x14')][_0x0f12('0x9d')]=function(_0x4044b2,_0x554547){for(var _0x410b44 in _0x4044b2){if(_0x4044b2[_0x0f12('0x95')](_0x410b44)){if(_['isPlainObject'](_0x4044b2[_0x410b44])){if(!_[_0x0f12('0x43')](_0x4044b2[_0x410b44])){this[_0x0f12('0x9d')](_0x4044b2[_0x410b44],util[_0x0f12('0x2b')](_0x0f12('0x9e'),_0x554547,_0x410b44));}}else if(_[_0x0f12('0x99')](_0x4044b2[_0x410b44])){for(var _0x4c6f75=0x0;_0x4c6f75<_0x4044b2[_0x410b44]['length'];_0x4c6f75++){this[_0x0f12('0x9d')](_0x4044b2[_0x410b44][_0x4c6f75],util['format'](_0x0f12('0x9e'),_0x554547,_0x410b44+'['+_0x4c6f75+']'));}}else{if(!_[_0x0f12('0x44')](_0x4044b2[_0x410b44])){this['channel'][_0x0f12('0x9f')](util['format'](_0x0f12('0x9e'),_0x554547,_0x410b44),_0x4044b2[_0x410b44]);}}}}};AGIVertices[_0x0f12('0x14')][_0x0f12('0x96')]=function(_0x19f47c){try{var _0xbbc496=JSON[_0x0f12('0x6e')](_0x19f47c);this[_0x0f12('0x97')](_0xbbc496);return JSON[_0x0f12('0x74')](_0xbbc496);}catch(_0x5484fb){return this[_0x0f12('0x9c')](_0x19f47c);}};AGIVertices['prototype']['replaceAllVariables']=function(_0x2a91da){var _0x2e39c2=_0x2a91da[_0x0f12('0xa0')]('{');for(var _0x5e1020=0x1;_0x5e1020<_0x2e39c2[_0x0f12('0x9a')];_0x5e1020+=0x1){var _0x299adf=_0x2e39c2[_0x5e1020][_0x0f12('0xa0')]('}');if(_0x299adf[_0x0f12('0x9a')]>0x1){_0x2a91da=_0x2a91da[_0x0f12('0xa1')]('{'+_0x299adf[0x0]+'}',this[_0x0f12('0xe')]['getVariable'](_0x299adf[0x0])[_0x0f12('0xa2')]||_0x299adf[0x0]);}}if(_0x2e39c2['length']===0x1){return _0x2a91da['toString']();}return this[_0x0f12('0x9c')](_0x2a91da);};AGIVertices[_0x0f12('0x14')]['getAndSetVariable']=function(_0x2a5ba8,_0x4e38b7){var _0x3c6ade=this['channel']['getVariable'](_0x2a5ba8);if(_0x3c6ade[_0x0f12('0xa3')]===-0x1){return _0x3c6ade;}logger['info'](util[_0x0f12('0x2b')](_0x0f12('0xa4'),_0x4e38b7,_0x3c6ade[_0x0f12('0xa2')]));return this[_0x0f12('0xe')][_0x0f12('0x9f')](_0x4e38b7,_0x3c6ade[_0x0f12('0xa2')]);};AGIVertices[_0x0f12('0x14')]['isConfigured']=function(_0x2a8ad1){return _0x2a8ad1&&_0x2a8ad1!=='0'&&_0x2a8ad1!=='-1'&&_0x2a8ad1!=='';};AGIVertices['prototype'][_0x0f12('0xa5')]=function(_0x117294){this[_0x0f12('0x36')][_0x0f12('0xa6')](this,_0x117294,'-');_0x117294[_0x0f12('0xa7')]=_0x117294[_0x0f12('0xa5')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x0f12('0x14')][_0x0f12('0xa8')]=function(_0x527714){logger['info'](util['format'](_0x0f12('0xa9'),_0x527714[_0x0f12('0x38')]));if(!this[_0x0f12('0xaa')](_0x527714['text'])){return this[_0x0f12('0xe')]['noop']('no\x20text\x20configured');}var _0x221fd4='\x22'+_0x527714['text']+'\x22';if(this[_0x0f12('0xaa')](_0x527714[_0x0f12('0x79')])){_0x221fd4+=','+_0x527714['options'];}var _0x14ca3d=this[_0x0f12('0xe')]['exec']('MRCPSynth',_0x221fd4);if(_0x14ca3d['result']===-0x1){return _0x14ca3d;}return this[_0x0f12('0xe')]['noop'](util['format'](_0x0f12('0xab'),_0x221fd4));};AGIVertices[_0x0f12('0x14')]['mrcprecog']=function(_0x18d3c0){logger[_0x0f12('0x2f')](util[_0x0f12('0x2b')](_0x0f12('0xac'),_0x18d3c0[_0x0f12('0x38')]));if(!this[_0x0f12('0xaa')](_0x18d3c0['grammar'])){return this[_0x0f12('0xe')][_0x0f12('0xad')](_0x0f12('0xae'));}var _0x361c04=_0x18d3c0[_0x0f12('0xaf')];if(this[_0x0f12('0xaa')](_0x18d3c0[_0x0f12('0x79')])){_0x361c04+=','+_0x18d3c0['options'];}var _0x2572cd=this['channel'][_0x0f12('0x56')](_0x0f12('0xb0'),_0x361c04);if(_0x2572cd[_0x0f12('0xa3')]===-0x1){return _0x2572cd;}var _0x51952a=this[_0x0f12('0xb1')](_0x0f12('0xb2'),_0x0f12('0xb3'));if(_0x51952a[_0x0f12('0xa3')]===-0x1){return _0x51952a;}var _0x3a9188=this[_0x0f12('0xb1')]('RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT');if(_0x3a9188[_0x0f12('0xa3')]===-0x1){return _0x3a9188;}var _0x5ba504=this[_0x0f12('0xb1')]('RECOG_INSTANCE()','MRCP_RECOG_INSTANCE');if(_0x5ba504[_0x0f12('0xa3')]===-0x1){return _0x5ba504;}return this['channel'][_0x0f12('0xad')](util['format'](_0x0f12('0xb4'),_0x361c04));};AGIVertices[_0x0f12('0x14')][_0x0f12('0x6')]=function(_0x31e0be){logger[_0x0f12('0x2f')](util[_0x0f12('0x2b')](_0x0f12('0xb5'),_0x31e0be[_0x0f12('0x38')]));return this[_0x0f12('0xe')][_0x0f12('0x6')]([_0x31e0be[_0x0f12('0xb6')],_0x31e0be[_0x0f12('0xb7')]]);};AGIVertices[_0x0f12('0x14')][_0x0f12('0xb8')]=function(_0x34196e){logger[_0x0f12('0x2f')](util[_0x0f12('0x2b')](_0x0f12('0xb9'),_0x34196e[_0x0f12('0x38')]));if(this[_0x0f12('0xaa')](_0x34196e[_0x0f12('0x67')])){logger[_0x0f12('0x2f')](util[_0x0f12('0x2b')]('Wait\x20%s\x20seconds\x20before\x20answer',_0x34196e[_0x0f12('0x67')]));var _0x5a842d=this[_0x0f12('0xe')]['wait'](_0x34196e[_0x0f12('0x67')]);if(_0x5a842d[_0x0f12('0xa3')]===-0x1){return _0x5a842d;}}return this[_0x0f12('0xe')][_0x0f12('0xb8')]();};AGIVertices[_0x0f12('0x14')][_0x0f12('0x4a')]=function(_0x3bdfcf){logger['info'](util[_0x0f12('0x2b')]('Enter\x20in\x20CALLBACK\x20(%s)\x20block',_0x3bdfcf[_0x0f12('0x38')]));if(!this[_0x0f12('0xaa')](_0x3bdfcf[_0x0f12('0x49')])){return this[_0x0f12('0xe')][_0x0f12('0x2d')](_0x3bdfcf,'no\x20list\x20selected');}_0x3bdfcf['scheduledAt']=moment();if(this[_0x0f12('0xaa')](_0x3bdfcf[_0x0f12('0xba')])){_0x3bdfcf[_0x0f12('0x4c')]=moment()['add'](_0x3bdfcf['delay'],_0x0f12('0xbb'));}if(!this['isConfigured'](_0x3bdfcf[_0x0f12('0x4e')])){_0x3bdfcf[_0x0f12('0x4e')]=0x2;}this[_0x0f12('0x42')]['sync'](this,_0x3bdfcf);return this['channel'][_0x0f12('0xad')](util[_0x0f12('0x2b')](_0x0f12('0xbc'),_0x3bdfcf[_0x0f12('0x48')],_0x3bdfcf['list_id'],_0x3bdfcf[_0x0f12('0x4c')]));};AGIVertices[_0x0f12('0x14')]['custom_app']=function(_0x5a5ead){logger[_0x0f12('0x2f')](util[_0x0f12('0x2b')](_0x0f12('0xbd'),_0x5a5ead['label']));var _0x332ddf=this[_0x0f12('0xe')][_0x0f12('0x56')](_0x5a5ead[_0x0f12('0xbe')],_0x5a5ead[_0x0f12('0x79')]);if(_0x332ddf[_0x0f12('0xa3')]===-0x1){return _0x332ddf;}return this[_0x0f12('0xe')][_0x0f12('0xad')](util[_0x0f12('0x2b')](_0x0f12('0xbf'),_0x5a5ead[_0x0f12('0xbe')],_0x5a5ead[_0x0f12('0x79')]));};AGIVertices['prototype']['lumenvoxtts']=function(_0x581310){logger['info'](util['format'](_0x0f12('0xc0'),_0x581310['label']));if(!this[_0x0f12('0xaa')](_0x581310['text'])){return this[_0x0f12('0xe')]['noop']('no\x20text\x20configured');}var _0x253f60='\x22'+_0x581310['text']+'\x22';if(this['isConfigured'](_0x581310[_0x0f12('0x79')])){_0x253f60+=','+_0x581310['options'];}var _0xa56830=this[_0x0f12('0xe')][_0x0f12('0x56')](_0x0f12('0xc1'),_0x253f60);if(_0xa56830['result']===-0x1){return _0xa56830;}return this[_0x0f12('0xe')]['noop'](util[_0x0f12('0x2b')](_0x0f12('0xab'),_0x253f60));};AGIVertices['prototype'][_0x0f12('0xc2')]=function(_0xbb3a9f){logger[_0x0f12('0x2f')](util[_0x0f12('0x2b')]('Enter\x20in\x20SESTEKTTS\x20(%s)\x20block',_0xbb3a9f[_0x0f12('0x38')]));if(!this[_0x0f12('0xaa')](_0xbb3a9f[_0x0f12('0x5c')])){return this[_0x0f12('0xe')]['noop'](_0x0f12('0xc3'));}var _0x2683b0='\x22'+_0xbb3a9f[_0x0f12('0x5c')]+'\x22';if(this[_0x0f12('0xaa')](_0xbb3a9f[_0x0f12('0x79')])){_0x2683b0+=','+_0xbb3a9f[_0x0f12('0x79')];}var _0x2a49e4=this[_0x0f12('0xe')][_0x0f12('0x56')](_0x0f12('0xc1'),_0x2683b0);if(_0x2a49e4['result']===-0x1){return _0x2a49e4;}return this[_0x0f12('0xe')][_0x0f12('0xad')](util[_0x0f12('0x2b')](_0x0f12('0xab'),_0x2683b0));};AGIVertices['prototype']['lumenvoxasr']=function(_0x1f052e){logger[_0x0f12('0x2f')](util[_0x0f12('0x2b')](_0x0f12('0xc4'),_0x1f052e[_0x0f12('0x38')]));if(!this[_0x0f12('0xaa')](_0x1f052e[_0x0f12('0xaf')])){return this[_0x0f12('0xe')][_0x0f12('0xad')](_0x0f12('0xae'));}var _0x916852=_0x1f052e[_0x0f12('0xaf')];if(this[_0x0f12('0xaa')](_0x1f052e[_0x0f12('0x79')])){_0x916852+=','+_0x1f052e[_0x0f12('0x79')];}var _0x547b76=this['channel']['exec'](_0x0f12('0xb0'),_0x916852);if(_0x547b76[_0x0f12('0xa3')]===-0x1){return _0x547b76;}var _0x1a8812=this['getAndSetVariable'](_0x0f12('0xb2'),_0x0f12('0xc5'));if(_0x1a8812[_0x0f12('0xa3')]===-0x1){return _0x1a8812;}var _0x3c39c7=this['getAndSetVariable'](_0x0f12('0xc6'),_0x0f12('0xc7'));if(_0x3c39c7[_0x0f12('0xa3')]===-0x1){return _0x3c39c7;}var _0x4739a1=this[_0x0f12('0xb1')]('RECOG_INSTANCE()',_0x0f12('0xc8'));if(_0x4739a1['result']===-0x1){return _0x4739a1;}return this[_0x0f12('0xe')][_0x0f12('0xad')](util['format'](_0x0f12('0xb4'),_0x916852));};AGIVertices[_0x0f12('0x14')][_0x0f12('0xc9')]=function(_0xb1c865){logger[_0x0f12('0x2f')](util[_0x0f12('0x2b')](_0x0f12('0xca'),_0xb1c865['label']));if(!this[_0x0f12('0xaa')](_0xb1c865[_0x0f12('0xaf')])){return this[_0x0f12('0xe')][_0x0f12('0xad')]('no\x20grammar\x20configured');}var _0x5a8ed0=_0xb1c865[_0x0f12('0xaf')];if(this[_0x0f12('0xaa')](_0xb1c865[_0x0f12('0x79')])){_0x5a8ed0+=','+_0xb1c865[_0x0f12('0x79')];}var _0x302a42=this[_0x0f12('0xe')][_0x0f12('0x56')]('MRCPRecog',_0x5a8ed0);if(_0x302a42['result']===-0x1){return _0x302a42;}var _0x3da356=this[_0x0f12('0xb1')](_0x0f12('0xb2'),_0x0f12('0xcb'));if(_0x3da356[_0x0f12('0xa3')]===-0x1){return _0x3da356;}var _0x4d59da=this['getAndSetVariable'](_0x0f12('0xc6'),'SESTEK_ASR_TRANSCRIPT');if(_0x4d59da[_0x0f12('0xa3')]===-0x1){return _0x4d59da;}var _0x31ba6c=this[_0x0f12('0xb1')](_0x0f12('0xcc'),'SESTEK_ASR_INSTANCE');if(_0x31ba6c[_0x0f12('0xa3')]===-0x1){return _0x31ba6c;}return this[_0x0f12('0xe')][_0x0f12('0xad')](util['format'](_0x0f12('0xb4'),_0x5a8ed0));};AGIVertices[_0x0f12('0x14')][_0x0f12('0xcd')]=function(_0x21a50a){logger[_0x0f12('0x2f')](util[_0x0f12('0x2b')](_0x0f12('0xce'),_0x21a50a['label']));if(!this[_0x0f12('0xaa')](_0x21a50a['odbc_id'])){return this[_0x0f12('0xe')]['error'](_0x21a50a,_0x0f12('0xcf'));}var _0x17776a=this[_0x0f12('0x1a')][_0x0f12('0xa6')](this,_0x21a50a[_0x0f12('0xd0')]);if(!_0x17776a){return this[_0x0f12('0xe')][_0x0f12('0x2d')](_0x21a50a,'no\x20odbc\x20database\x20found');}if(!this[_0x0f12('0xaa')](_0x21a50a[_0x0f12('0x31')])){return this['channel'][_0x0f12('0x2d')](_0x21a50a,_0x0f12('0xd1'));}var _0x274d21=_0x21a50a[_0x0f12('0x31')][_0x0f12('0x58')](/(\r\n|\n|\r)/gm,'\x20');this['channel']['noop'](util[_0x0f12('0x2b')](_0x0f12('0xd2'),_0x274d21));var _0xb4971d=this[_0x0f12('0xd3')][_0x0f12('0xa6')](this,_0x17776a,_0x274d21);this[_0x0f12('0x36')][_0x0f12('0xa6')](this,_0x21a50a,_0x274d21);if(!this[_0x0f12('0xaa')](_0x21a50a[_0x0f12('0xd4')])){return this['channel']['noop'](_0x0f12('0xd5'));}var _0x45da95=this[_0x0f12('0x10')][_0x0f12('0xa6')](this,_0x21a50a['variable_id']);if(!_0x45da95){return this[_0x0f12('0xe')][_0x0f12('0x2d')](_0x21a50a,_0x0f12('0xd6'));}var _0x15ad7c=this;_0xb4971d[_0x0f12('0xd7')](function(_0xa9c462,_0x144654){Object[_0x0f12('0xd8')](_0xa9c462)[_0x0f12('0xd7')](function(_0x37bcf9){_0x15ad7c['channel']['setVariable'](util['format'](_0x0f12('0xd9'),_0x45da95,_0x144654,_0x37bcf9),_0xa9c462[_0x37bcf9]);});});this[_0x0f12('0xe')][_0x0f12('0x9f')](util[_0x0f12('0x2b')](_0x0f12('0xda'),_0x45da95),_0xb4971d[_0x0f12('0x9a')]);return this[_0x0f12('0xe')]['noop'](util['format']('variable\x20%s\x20set',_0x45da95));};AGIVertices[_0x0f12('0x14')][_0x0f12('0xdb')]=function(_0x24a993){logger[_0x0f12('0xdc')](util[_0x0f12('0x2b')](_0x0f12('0xdd'),_0x24a993[_0x0f12('0x38')]));if(!this[_0x0f12('0xaa')](_0x24a993[_0x0f12('0xde')])){return this[_0x0f12('0xe')]['error'](_0x24a993,_0x0f12('0xdf'));}var _0x1b063c=this[_0x0f12('0x1c')]['sync'](this,_0x24a993[_0x0f12('0xde')]);if(!_0x1b063c){return this[_0x0f12('0xe')]['error'](_0x24a993,_0x0f12('0xe0'));}var _0x279dc1=this[_0x0f12('0xe')][_0x0f12('0x56')](_0x0f12('0xe1'),[util[_0x0f12('0x2b')]('SIP/%s',_0x1b063c),_0x24a993[_0x0f12('0x67')],_0x24a993['opts'],_0x24a993[_0x0f12('0x65')]]);if(_0x279dc1[_0x0f12('0xa3')]===-0x1){return _0x279dc1;}return this[_0x0f12('0xe')]['noop'](util[_0x0f12('0x2b')](_0x0f12('0xe2'),_0x0f12('0xe1')));};AGIVertices[_0x0f12('0x14')][_0x0f12('0xe3')]=function(_0x31c200){logger[_0x0f12('0x2f')](util[_0x0f12('0x2b')](_0x0f12('0xe4'),_0x31c200[_0x0f12('0x38')]));if(!this[_0x0f12('0xaa')](_0x31c200[_0x0f12('0x7b')])){return this[_0x0f12('0xe')][_0x0f12('0xad')](_0x0f12('0xe5'));}if(!this['isConfigured'](_0x31c200[_0x0f12('0x5c')])){return this[_0x0f12('0xe')][_0x0f12('0xad')](_0x0f12('0xc3'));}this[_0x0f12('0xe')][_0x0f12('0xe6')]=!![];this[_0x0f12('0x36')](_0x31c200);this[_0x0f12('0x41')](_0x31c200[_0x0f12('0x5c')],'in','','');this[_0x0f12('0xe')][_0x0f12('0xad')](util[_0x0f12('0x2b')](_0x0f12('0xe7'),_0x31c200['text']));var _0x289061=this[_0x0f12('0x7a')][_0x0f12('0xa6')](this,_0x31c200);if(_0x289061){for(var _0x207070 in _0x289061){if(_0x289061[_0x0f12('0x95')](_0x207070)){this[_0x0f12('0xe')]['setVariable'](util['format']('DIALOGFLOW_%s',_0x207070[_0x0f12('0x6c')]()),_0x289061[_0x207070]);}}this['createSquareMessage'](_0x289061[_0x0f12('0xe8')],'out',_0x0f12('0xe3'),'');return this[_0x0f12('0xe')][_0x0f12('0xad')](util['format'](_0x0f12('0xe9'),_0x289061[_0x0f12('0xe8')]));}return this[_0x0f12('0xe')][_0x0f12('0x2d')](_0x31c200,'Dialogflow\x20is\x20unreachable');};AGIVertices[_0x0f12('0x14')][_0x0f12('0xea')]=function(_0x43bdc5){logger[_0x0f12('0x2f')](util[_0x0f12('0x2b')](_0x0f12('0xeb'),_0x43bdc5[_0x0f12('0x38')]));if(!this[_0x0f12('0xaa')](_0x43bdc5[_0x0f12('0x7e')])){return this[_0x0f12('0xe')][_0x0f12('0xad')](_0x0f12('0xec'));}if(!this['isConfigured'](_0x43bdc5['client_email'])){return this['channel']['noop'](_0x0f12('0xed'));}if(!this[_0x0f12('0xaa')](_0x43bdc5[_0x0f12('0x80')])){return this['channel'][_0x0f12('0xad')](_0x0f12('0xee'));}if(!this[_0x0f12('0xaa')](_0x43bdc5[_0x0f12('0xef')])){return this[_0x0f12('0xe')][_0x0f12('0xad')]('no\x20anguage\x20configured');}if(!this[_0x0f12('0xaa')](_0x43bdc5[_0x0f12('0x5c')])){return this['channel'][_0x0f12('0xad')](_0x0f12('0xc3'));}this[_0x0f12('0xe')][_0x0f12('0xe6')]=!![];this[_0x0f12('0x36')](_0x43bdc5);this[_0x0f12('0x41')](_0x43bdc5[_0x0f12('0x5c')],'in','','');this[_0x0f12('0xe')][_0x0f12('0xad')](util[_0x0f12('0x2b')](_0x0f12('0xf0'),_0x43bdc5[_0x0f12('0x5c')]));var _0x1d1b7c=this['googleDialogflowV2'][_0x0f12('0xa6')](this,_0x43bdc5);if(_0x1d1b7c){for(var _0x51620a in _0x1d1b7c){if(_0x1d1b7c[_0x0f12('0x95')](_0x51620a)){if(_0x51620a!==_0x0f12('0xf1')){this[_0x0f12('0xe')][_0x0f12('0x9f')](util[_0x0f12('0x2b')](_0x0f12('0xf2'),_0x51620a[_0x0f12('0x6c')]()),_0x1d1b7c[_0x51620a]);}}}this[_0x0f12('0x41')](_0x1d1b7c['speech'],'out',_0x0f12('0xea'),_0x1d1b7c['providerResponse']);return this[_0x0f12('0xe')]['noop'](util[_0x0f12('0x2b')](_0x0f12('0xf3'),_0x1d1b7c[_0x0f12('0xe8')]));}return this[_0x0f12('0xe')][_0x0f12('0x2d')](_0x43bdc5,_0x0f12('0xf4'));};AGIVertices['prototype'][_0x0f12('0xf5')]=function(_0xca6323){logger[_0x0f12('0x2f')](util[_0x0f12('0x2b')](_0x0f12('0xf6'),_0xca6323['label']));if(!this[_0x0f12('0xaa')](_0xca6323[_0x0f12('0xf7')])){return this[_0x0f12('0xe')][_0x0f12('0xad')]('no\x20ndauth\x20url\x20configured');}if(!this[_0x0f12('0xaa')](_0xca6323[_0x0f12('0xf8')])){return this[_0x0f12('0xe')][_0x0f12('0xad')](_0x0f12('0xf9'));}if(!this[_0x0f12('0xaa')](_0xca6323[_0x0f12('0xfa')])){return this[_0x0f12('0xe')][_0x0f12('0xad')](_0x0f12('0xfb'));}if(!this[_0x0f12('0xaa')](_0xca6323['ndassistant_url'])){return this[_0x0f12('0xe')][_0x0f12('0xad')](_0x0f12('0xc3'));}this[_0x0f12('0xe')]['bot']=!![];this[_0x0f12('0x36')](_0xca6323);this[_0x0f12('0x41')](_0xca6323[_0x0f12('0x5c')],'in','','');this[_0x0f12('0xe')][_0x0f12('0xad')](util[_0x0f12('0x2b')](_0x0f12('0xfc'),_0xca6323['text']));var _0x52c179=this[_0x0f12('0xfd')][_0x0f12('0xa6')](this,_0xca6323);if(_0x52c179){for(var _0x5addc4 in _0x52c179){if(_0x52c179[_0x0f12('0x95')](_0x5addc4)){this[_0x0f12('0xe')][_0x0f12('0x9f')](util[_0x0f12('0x2b')](_0x0f12('0xfe'),_0x5addc4[_0x0f12('0x6c')]()),_0x52c179[_0x5addc4]);}}this[_0x0f12('0x41')](_0x52c179[_0x0f12('0xe8')],_0x0f12('0xff'),'sesteknda','');if(_0x52c179[_0x0f12('0x100')]){this[_0x0f12('0xe')][_0x0f12('0xad')](util[_0x0f12('0x2b')](_0x0f12('0x101'),_0x52c179[_0x0f12('0x100')]));var _0x58b2ea=this[_0x0f12('0xe')][_0x0f12('0x102')](_0x52c179[_0x0f12('0x100')]);try{fs[_0x0f12('0x103')](_0x52c179[_0x0f12('0x100')]+_0x0f12('0x104'));}catch(_0x51c86b){logger[_0x0f12('0x2d')](_0x51c86b);}return _0x58b2ea;}else{return this['channel'][_0x0f12('0xad')](util[_0x0f12('0x2b')](_0x0f12('0x105'),_0x52c179[_0x0f12('0xe8')]));}}return this[_0x0f12('0xe')][_0x0f12('0x2d')](_0xca6323,'SestekNDA\x20is\x20unreachable');};AGIVertices[_0x0f12('0x14')]['end']=function(_0xfbdb29){logger[_0x0f12('0x2f')](util[_0x0f12('0x2b')](_0x0f12('0x106'),_0xfbdb29[_0x0f12('0x38')]));return this['channel']['noop']('end');};AGIVertices[_0x0f12('0x14')][_0x0f12('0x107')]=function(_0x251911){logger[_0x0f12('0x2f')](util[_0x0f12('0x2b')]('Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block',_0x251911[_0x0f12('0x38')]));var _0x23d856='';if(_0x251911[_0x0f12('0x108')]){if(!this[_0x0f12('0xaa')](_0x251911[_0x0f12('0x108')])){return this[_0x0f12('0xe')][_0x0f12('0x2d')](_0x251911,_0x0f12('0x109'));}else{var _0x142bee=parseInt(_0x251911[_0x0f12('0x108')],0xa);if(isNaN(_0x142bee)){_0x23d856=_0x251911['trunk_id'];}else{_0x23d856=this[_0x0f12('0x1d')]['sync'](this,_0x251911[_0x0f12('0x108')]);if(!_0x23d856){return this[_0x0f12('0xe')][_0x0f12('0x2d')](_0x251911,'no\x20trunk\x20found');}}}}else if(_0x251911[_0x0f12('0x10a')]){_0x23d856=_0x251911['trunk_name'];}else{return this[_0x0f12('0xe')]['error'](_0x251911,_0x0f12('0x109'));}var _0x3086c0=this[_0x0f12('0xe')][_0x0f12('0x56')](_0x0f12('0xe1'),[util[_0x0f12('0x2b')](_0x0f12('0x10b'),_0x23d856,_0x251911[_0x0f12('0x48')]),_0x251911['timeout'],_0x251911[_0x0f12('0x10c')],_0x251911[_0x0f12('0x65')]]);if(_0x3086c0[_0x0f12('0xa3')]===-0x1){return _0x3086c0;}return this[_0x0f12('0xe')][_0x0f12('0xad')](util['format'](_0x0f12('0xe2'),_0x0f12('0xe1')));};AGIVertices[_0x0f12('0x14')][_0x0f12('0x10d')]=function(_0x1c618e){logger[_0x0f12('0x2f')](util[_0x0f12('0x2b')]('Enter\x20in\x20FINALLY\x20(%s)\x20block',_0x1c618e[_0x0f12('0x38')]));return this['channel']['noop'](_0x0f12('0x10d'));};AGIVertices[_0x0f12('0x14')]['getdigits']=function(_0x3c7612){logger['info'](util[_0x0f12('0x2b')](_0x0f12('0x10e'),_0x3c7612[_0x0f12('0x38')]));if(_0x3c7612[_0x0f12('0xa7')]===0x0){return this[_0x0f12('0xa5')](_0x3c7612);}_0x3c7612[_0x0f12('0xa7')]-=0x1;if(!this['isConfigured'](_0x3c7612[_0x0f12('0x10f')])){return this[_0x0f12('0xe')]['error'](_0x3c7612,_0x0f12('0x110'));}var _0x1af2e8=this['getSound'][_0x0f12('0xa6')](this,_0x3c7612[_0x0f12('0x10f')]);if(!_0x1af2e8){return this[_0x0f12('0xe')]['error'](_0x3c7612,_0x0f12('0x111'));}if(!this[_0x0f12('0xaa')](_0x3c7612[_0x0f12('0xd4')])){return this[_0x0f12('0xe')]['error'](_0x0f12('0xd5'));}var _0x10730b=this[_0x0f12('0xe')]['getData'](_0x1af2e8,_0x3c7612[_0x0f12('0x112')],_0x3c7612['maxdigit']);var _0x32e196=_0x10730b[_0x0f12('0xa3')]?_0x10730b[_0x0f12('0xa3')]['toString']():'';logger['info'](_0x0f12('0x113'),JSON['stringify'](_0x10730b));if(_0x10730b[_0x0f12('0xa3')]===-0x1){this['createSquareDetailsReport'][_0x0f12('0xa6')](this,_0x3c7612,_0x32e196);return _0x10730b;}else if(_0x10730b[_0x0f12('0xa2')]===_0x0f12('0x67')){_0x10730b[_0x0f12('0xa3')]=_0x32e196[_0x0f12('0x9a')]>=parseInt(_0x3c7612['mindigit'])?'x':'i';}else{_0x10730b[_0x0f12('0xa3')]=_0x32e196[_0x0f12('0x9a')]>=parseInt(_0x3c7612['mindigit'])&&_0x32e196[_0x0f12('0x9a')]<=parseInt(_0x3c7612['maxdigit'])?'x':'i';}var _0x3a5d29=this[_0x0f12('0x10')][_0x0f12('0xa6')](this,_0x3c7612[_0x0f12('0xd4')]);if(!_0x3a5d29){return this[_0x0f12('0xe')][_0x0f12('0x2d')](_0x3c7612,'no\x20variable\x20found');}this['channel'][_0x0f12('0x9f')](_0x3a5d29,_0x32e196);if(this['isConfigured'](_0x3c7612['hiddendigitsnum'])){var _0x177abb=parseInt(_0x3c7612[_0x0f12('0x114')],0xa);var _0x2a18f1=rs['generate']({'charset':'*','length':_0x177abb});var _0x7cff33=_0x32e196[_0x0f12('0x9a')];if(_0x7cff33>0x0){if(_0x7cff33>_0x177abb){this[_0x0f12('0x36')][_0x0f12('0xa6')](this,_0x3c7612,_0x3c7612[_0x0f12('0x115')]===_0x0f12('0x116')?_0x2a18f1+_0x32e196['substr'](_0x177abb):_0x32e196[_0x0f12('0x117')](0x0,_0x7cff33-_0x177abb)+_0x2a18f1);}else{this[_0x0f12('0x36')][_0x0f12('0xa6')](this,_0x3c7612,rs['generate']({'charset':'*','length':_0x7cff33}));}}else{this[_0x0f12('0x36')]['sync'](this,_0x3c7612,'');}}else{this[_0x0f12('0x36')][_0x0f12('0xa6')](this,_0x3c7612,_0x32e196);}return _0x10730b;};AGIVertices[_0x0f12('0x14')][_0x0f12('0x118')]=function(_0x4fc936){logger['info'](util[_0x0f12('0x2b')](_0x0f12('0x119'),_0x4fc936['label']));return this[_0x0f12('0xd')](_0x4fc936);};AGIVertices['prototype'][_0x0f12('0x11a')]=function(_0x544f00){logger['info'](util[_0x0f12('0x2b')]('Enter\x20in\x20GOAL\x20(%s)\x20block',_0x544f00[_0x0f12('0x38')]));this[_0x0f12('0x36')][_0x0f12('0xa6')](this,_0x544f00,_0x544f00['goalname']);return this['channel'][_0x0f12('0xad')](util[_0x0f12('0x2b')](_0x0f12('0x11b'),_0x544f00[_0x0f12('0x11c')]));};AGIVertices[_0x0f12('0x14')][_0x0f12('0x11d')]=function(_0x35c115){logger[_0x0f12('0x2f')](util[_0x0f12('0x2b')]('[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block',_0x35c115[_0x0f12('0x38')]));if(!this['isConfigured'](_0x35c115[_0x0f12('0x87')])||!this['isConfigured'](_0x35c115[_0x0f12('0x88')])){return this[_0x0f12('0xe')][_0x0f12('0xad')](_0x0f12('0x11e'));}if(!this[_0x0f12('0xaa')](_0x35c115['text'])){return this[_0x0f12('0xe')][_0x0f12('0xad')](_0x0f12('0xc3'));}this[_0x0f12('0xe')][_0x0f12('0xad')](util[_0x0f12('0x2b')](_0x0f12('0x11f'),_0x35c115[_0x0f12('0x5c')]));var _0x51c17d=this[_0x0f12('0x120')][_0x0f12('0xa6')](this,_0x35c115);if(_0x51c17d){this[_0x0f12('0xe')]['noop'](util[_0x0f12('0x2b')]('aws\x20Polly\x20%s\x20file\x20created',_0x51c17d));var _0xb3d100=this[_0x0f12('0xe')][_0x0f12('0x102')](_0x51c17d);try{fs[_0x0f12('0x103')](_0x51c17d+_0x0f12('0x104'));}catch(_0x4e2658){logger[_0x0f12('0x2d')](_0x4e2658);}return _0xb3d100;}return this[_0x0f12('0xe')][_0x0f12('0x2d')](_0x35c115,_0x0f12('0x121'));};AGIVertices[_0x0f12('0x14')][_0x0f12('0x122')]=function(_0x38b750){logger[_0x0f12('0x2f')](util['format']('Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block',_0x38b750[_0x0f12('0x38')]));if(!this[_0x0f12('0xaa')](_0x38b750[_0x0f12('0x87')])||!this['isConfigured'](_0x38b750['aws_secret_access_key'])){return this['channel'][_0x0f12('0xad')](_0x0f12('0x11e'));}if(!this[_0x0f12('0xaa')](_0x38b750['aws_bot_name'])){return this[_0x0f12('0xe')][_0x0f12('0xad')](_0x0f12('0x123'));}if(!this['isConfigured'](_0x38b750[_0x0f12('0x5c')])){return this[_0x0f12('0xe')][_0x0f12('0xad')]('no\x20text\x20configured');}this[_0x0f12('0xe')][_0x0f12('0xe6')]=!![];this[_0x0f12('0x36')](_0x38b750);this[_0x0f12('0x41')](_0x38b750[_0x0f12('0x5c')],'in','','');this[_0x0f12('0xe')][_0x0f12('0xad')](util[_0x0f12('0x2b')](_0x0f12('0x124'),_0x38b750[_0x0f12('0x5c')]));var _0x4f1de9=this[_0x0f12('0x8c')][_0x0f12('0xa6')](this,_0x38b750);if(_0x4f1de9){for(var _0x7eb4fa in _0x4f1de9){if(_0x4f1de9[_0x0f12('0x95')](_0x7eb4fa)&&_[_0x0f12('0x9b')](_0x4f1de9[_0x7eb4fa])){this['channel']['setVariable'](util[_0x0f12('0x2b')]('AWS_LEX_%s',_0x7eb4fa['toUpperCase']()),_0x4f1de9[_0x7eb4fa]);}}if(_['isNil'](_0x4f1de9[_0x0f12('0x77')])){return this['channel'][_0x0f12('0xad')](_0x0f12('0x125'));}else{this['createSquareMessage'](_0x4f1de9['message'],_0x0f12('0xff'),_0x0f12('0x126'),'');return this[_0x0f12('0xe')][_0x0f12('0xad')](util[_0x0f12('0x2b')](_0x0f12('0x127'),_0x4f1de9['message']));}}return this['channel']['error'](_0x38b750,_0x0f12('0x128'));};AGIVertices['prototype'][_0x0f12('0x129')]=function(_0xb0e2fe){logger[_0x0f12('0x2f')](util[_0x0f12('0x2b')](_0x0f12('0x12a'),_0xb0e2fe[_0x0f12('0x38')],_0xb0e2fe['timeout']));if(!this[_0x0f12('0xaa')](_0xb0e2fe[_0x0f12('0x7b')])){return this['channel'][_0x0f12('0xad')]('no\x20key\x20configured');}var _0x481a42=_0x0f12('0x12b');var _0x536748=util[_0x0f12('0x2b')]('%s/recordings/%s',FILES_PATH,rs[_0x0f12('0x12c')](0x4));var _0x269131=util[_0x0f12('0x2b')]('%s.%s',_0x536748,_0x481a42);var _0xebd1d0=!![];if(_0xb0e2fe[_0x0f12('0x12d')]===_0x0f12('0x12e')){_0xebd1d0=![];}var _0x121792=this[_0x0f12('0xe')][_0x0f12('0x12f')](_0x536748,_0x481a42,_0xb0e2fe[_0x0f12('0x130')],_0xb0e2fe[_0x0f12('0x67')],undefined,_0xebd1d0);if(_0x121792[_0x0f12('0xa3')]!==-0x1){this['channel'][_0x0f12('0xad')](util[_0x0f12('0x2b')](_0x0f12('0x131'),_0x269131));var _0x5c1fe0=this['googleASR'][_0x0f12('0xa6')](this,_0xb0e2fe,_0x269131);if(_0x5c1fe0){for(var _0x19864b in _0x5c1fe0){if(_0x5c1fe0['hasOwnProperty'](_0x19864b)){this[_0x0f12('0xe')][_0x0f12('0x9f')](util[_0x0f12('0x2b')](_0x0f12('0x132'),_0x19864b[_0x0f12('0x6c')]()),_0x5c1fe0[_0x19864b]);}}return this['channel'][_0x0f12('0xad')](util[_0x0f12('0x2b')](_0x0f12('0x133'),JSON[_0x0f12('0x74')](_0x5c1fe0)));}}return _0x121792;};AGIVertices[_0x0f12('0x14')]['tildeasr']=function(_0x44b5f9){logger['info'](util[_0x0f12('0x2b')]('Enter\x20in\x20TILDEASR\x20(%s)\x20block',_0x44b5f9['label']));if(!this[_0x0f12('0xaa')](_0x44b5f9[_0x0f12('0x91')])){return this[_0x0f12('0xe')][_0x0f12('0xad')]('no\x20appid\x20configured');}if(!this[_0x0f12('0xaa')](_0x44b5f9[_0x0f12('0x92')])){return this[_0x0f12('0xe')][_0x0f12('0xad')](_0x0f12('0x134'));}var _0x5e0924=_0x0f12('0x12b');var _0x222686=util[_0x0f12('0x2b')]('%s/recordings/%s',FILES_PATH,rs[_0x0f12('0x12c')](0x4));var _0x135061=util[_0x0f12('0x2b')](_0x0f12('0x9e'),_0x222686,_0x5e0924);var _0x465827=!![];if(_0x44b5f9[_0x0f12('0x12d')]===_0x0f12('0x12e')){_0x465827=![];}var _0x44380f=this['channel'][_0x0f12('0x12f')](_0x222686,_0x5e0924,_0x44b5f9[_0x0f12('0x130')],_0x44b5f9[_0x0f12('0x67')],undefined,_0x465827);if(_0x44380f[_0x0f12('0xa3')]!==-0x1){this[_0x0f12('0xe')][_0x0f12('0xad')](util[_0x0f12('0x2b')](_0x0f12('0x135'),_0x135061));var _0x2c0fd7=this[_0x0f12('0x90')][_0x0f12('0xa6')](this,_0x44b5f9,_0x135061);if(_0x2c0fd7){for(var _0x22361b in _0x2c0fd7){if(_0x2c0fd7[_0x0f12('0x95')](_0x22361b)){this[_0x0f12('0xe')][_0x0f12('0x9f')](util[_0x0f12('0x2b')](_0x0f12('0x136'),_0x22361b[_0x0f12('0x6c')]()),_0x2c0fd7[_0x22361b]);}}return this[_0x0f12('0xe')][_0x0f12('0xad')](util[_0x0f12('0x2b')](_0x0f12('0x137'),JSON[_0x0f12('0x74')](_0x2c0fd7)));}}return _0x44380f;};AGIVertices['prototype']['gotoc']=function(_0x589b87){logger[_0x0f12('0x2f')](util['format'](_0x0f12('0x138'),_0x589b87[_0x0f12('0x38')]));return this[_0x0f12('0xe')]['continueAt'](_0x589b87[_0x0f12('0x3c')],_0x589b87['extension'],_0x589b87['priority']);};AGIVertices[_0x0f12('0x14')][_0x0f12('0x139')]=function(_0x3bc4db){logger['info'](util['format'](_0x0f12('0x13a'),_0x3bc4db['label']));if(!this['isConfigured'](_0x3bc4db['condition'])){return this[_0x0f12('0xe')][_0x0f12('0x2d')](_0x3bc4db,_0x0f12('0x13b'));}try{var _0x247827=eval(_0x3bc4db[_0x0f12('0x13c')])?_0x0f12('0x13d'):_0x0f12('0x13e');this[_0x0f12('0xe')][_0x0f12('0xad')](util[_0x0f12('0x2b')](_0x0f12('0x13f'),_0x3bc4db['condition'],_0x247827));return{'code':0xc8,'result':_0x247827};}catch(_0x3dc88c){return{'code':0xc8,'result':'false'};}};AGIVertices['prototype'][_0x0f12('0x140')]=function(_0x2c4faf){logger['info'](util[_0x0f12('0x2b')]('Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block',_0x2c4faf['label']));if(!this[_0x0f12('0xaa')](_0x2c4faf[_0x0f12('0x141')])){return this[_0x0f12('0xe')][_0x0f12('0x2d')](_0x2c4faf,_0x0f12('0x142'));}var _0x400a2e=this[_0x0f12('0x26')][_0x0f12('0xa6')](this,_0x2c4faf['interval_id']);if(!_0x400a2e){return this['channel'][_0x0f12('0x2d')](_0x2c4faf,'no\x20intervals\x20found');}for(var _0x1a1255=0x0;_0x1a1255<_0x400a2e[_0x0f12('0x9a')];_0x1a1255+=0x1){var _0x2406e8=this[_0x0f12('0xe')][_0x0f12('0x10')](util[_0x0f12('0x2b')](_0x0f12('0x143'),_0x400a2e[_0x1a1255]));if(_0x2406e8[_0x0f12('0xa3')]===-0x1){return _0x2406e8;}logger[_0x0f12('0x2f')](util[_0x0f12('0x2b')]('IFTIME\x20%s\x20%s',_0x400a2e[_0x1a1255],_0x2406e8['extra']));if(_0x2406e8['extra']===_0x0f12('0x13d')){logger['info'](util[_0x0f12('0x2b')](_0x0f12('0x144'),_0x400a2e[_0x1a1255],_0x0f12('0x13d')));this[_0x0f12('0xe')][_0x0f12('0xad')](util[_0x0f12('0x2b')](_0x0f12('0x144'),_0x400a2e[_0x1a1255],_0x0f12('0x13d')));return{'code':0xc8,'result':'true'};}else{logger[_0x0f12('0x2f')](util['format']('IFTIME\x20%s\x20%s',_0x400a2e[_0x1a1255],_0x0f12('0x13e')));this[_0x0f12('0xe')][_0x0f12('0xad')](util['format'](_0x0f12('0x144'),_0x400a2e[_0x1a1255],'false'));}}return{'code':0xc8,'result':_0x0f12('0x13e')};};AGIVertices[_0x0f12('0x14')][_0x0f12('0x145')]=function(_0x3d185d){logger[_0x0f12('0x2f')](util['format'](_0x0f12('0x146'),_0x3d185d[_0x0f12('0x38')]));return this[_0x0f12('0xe')][_0x0f12('0x145')]();};AGIVertices[_0x0f12('0x14')][_0x0f12('0x147')]=function(_0x1f2676){logger[_0x0f12('0x2f')](util[_0x0f12('0x2b')](_0x0f12('0x148'),_0x1f2676[_0x0f12('0x38')]));if(!this[_0x0f12('0xaa')](_0x1f2676[_0x0f12('0x7b')])){return this[_0x0f12('0xe')][_0x0f12('0xad')](_0x0f12('0xe5'));}var _0x418162=_0x0f12('0x12b');var _0x3a057a=util[_0x0f12('0x2b')](_0x0f12('0x149'),FILES_PATH,rs['generate'](0x4));var _0x4c758e=util[_0x0f12('0x2b')](_0x0f12('0x9e'),_0x3a057a,_0x418162);var _0x12b9ab=!![];if(_0x1f2676[_0x0f12('0x12d')]===_0x0f12('0x12e')){_0x12b9ab=![];}var _0x5606d4=this[_0x0f12('0xe')][_0x0f12('0x12f')](_0x3a057a,_0x418162,_0x1f2676[_0x0f12('0x130')],_0x1f2676[_0x0f12('0x67')],undefined,_0x12b9ab);if(_0x5606d4[_0x0f12('0xa3')]!==-0x1){this[_0x0f12('0xe')][_0x0f12('0xad')](util['format'](_0x0f12('0x14a'),_0x4c758e));var _0x220515=this[_0x0f12('0x84')][_0x0f12('0xa6')](this,_0x1f2676,_0x4c758e);if(_0x220515){for(var _0x4c8973 in _0x220515){if(_0x220515[_0x0f12('0x95')](_0x4c8973)){this[_0x0f12('0xe')]['setVariable'](util[_0x0f12('0x2b')]('ISPEECH_ASR_%s',_0x4c8973[_0x0f12('0x6c')]()),_0x220515[_0x4c8973]);}}return this[_0x0f12('0xe')][_0x0f12('0xad')](util['format'](_0x0f12('0x14b'),JSON[_0x0f12('0x74')](_0x220515)));}}return _0x5606d4;};AGIVertices[_0x0f12('0x14')][_0x0f12('0x14c')]=function(_0x101824){logger['info'](util[_0x0f12('0x2b')](_0x0f12('0x14d'),_0x101824['label']));if(!this['isConfigured'](_0x101824[_0x0f12('0x7b')])){return this['channel'][_0x0f12('0xad')]('no\x20key\x20configured');}if(!this[_0x0f12('0xaa')](_0x101824[_0x0f12('0x5c')])){return this['channel'][_0x0f12('0xad')](_0x0f12('0xc3'));}this[_0x0f12('0xe')][_0x0f12('0xad')](util[_0x0f12('0x2b')](_0x0f12('0x14e'),_0x101824['text']));var _0x12135b=this[_0x0f12('0x81')][_0x0f12('0xa6')](this,_0x101824);if(_0x12135b){this['channel'][_0x0f12('0xad')](util['format']('ispeech\x20%s\x20file\x20created',_0x12135b));var _0xb749ed=this[_0x0f12('0xe')]['streamFile'](_0x12135b,_0x101824[_0x0f12('0x130')]);try{fs[_0x0f12('0x103')](_0x12135b+_0x0f12('0x104'));}catch(_0x20cc50){logger[_0x0f12('0x2d')](_0x20cc50);}return _0xb749ed;}return this[_0x0f12('0xe')][_0x0f12('0x2d')](_0x101824,_0x0f12('0x14f'));};AGIVertices['prototype']['login']=function(_0x2d6b0f){logger[_0x0f12('0x2f')](util[_0x0f12('0x2b')](_0x0f12('0x150'),_0x2d6b0f[_0x0f12('0x38')]));if(!this[_0x0f12('0xaa')](_0x2d6b0f[_0x0f12('0x151')])){return this[_0x0f12('0xe')][_0x0f12('0x2d')](_0x2d6b0f,'no\x20find\x20by\x20configured');}logger[_0x0f12('0x2f')](util[_0x0f12('0x2b')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x0f12('0xe')][_0x0f12('0x3a')],_0x2d6b0f[_0x0f12('0x151')]));var _0x5df8f2=this[_0x0f12('0x53')][_0x0f12('0xa6')](this,_0x2d6b0f[_0x0f12('0x151')]);if(_0x5df8f2){logger['info'](util[_0x0f12('0x2b')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x0f12('0xe')]['callerid'],_0x2d6b0f[_0x0f12('0x151')]));this['channel'][_0x0f12('0xad')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0x0f12('0x3a')],_0x2d6b0f[_0x0f12('0x151')]));return{'code':0xc8,'result':_0x0f12('0x152')};}else{logger[_0x0f12('0x2f')](util[_0x0f12('0x2b')](_0x0f12('0x153'),this['channel']['callerid'],_0x2d6b0f[_0x0f12('0x151')]));this[_0x0f12('0xe')][_0x0f12('0xad')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x0f12('0xe')]['callerid'],_0x2d6b0f['findBy']));return{'code':0xc8,'result':_0x0f12('0x154')};}};AGIVertices[_0x0f12('0x14')][_0x0f12('0x155')]=function(_0x1b5a06){logger[_0x0f12('0x2f')](util['format'](_0x0f12('0x156'),_0x1b5a06[_0x0f12('0x38')]));if(!this['isConfigured'](_0x1b5a06[_0x0f12('0x151')])){return this[_0x0f12('0xe')][_0x0f12('0x2d')](_0x1b5a06,'no\x20find\x20by\x20configured');}logger['info'](util[_0x0f12('0x2b')](_0x0f12('0x157'),this[_0x0f12('0xe')]['callerid'],_0x1b5a06[_0x0f12('0x151')]));var _0x4f7917=this[_0x0f12('0x52')][_0x0f12('0xa6')](this,_0x1b5a06['findBy']);if(_0x4f7917){logger[_0x0f12('0x2f')](util['format'](_0x0f12('0x158'),this[_0x0f12('0xe')]['callerid'],_0x1b5a06['findBy']));this[_0x0f12('0xe')][_0x0f12('0xad')](util[_0x0f12('0x2b')](_0x0f12('0x158'),this[_0x0f12('0xe')][_0x0f12('0x3a')],_0x1b5a06[_0x0f12('0x151')]));return{'code':0xc8,'result':'success'};}else{logger[_0x0f12('0x2f')](util[_0x0f12('0x2b')](_0x0f12('0x153'),this[_0x0f12('0xe')]['callerid'],_0x1b5a06[_0x0f12('0x151')]));this[_0x0f12('0xe')][_0x0f12('0xad')](util[_0x0f12('0x2b')](_0x0f12('0x153'),this[_0x0f12('0xe')][_0x0f12('0x3a')],_0x1b5a06[_0x0f12('0x151')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x0f12('0x14')][_0x0f12('0x159')]=function(_0x570481){logger[_0x0f12('0x2f')](util[_0x0f12('0x2b')](_0x0f12('0x15a'),_0x570481[_0x0f12('0x38')]));if(!this[_0x0f12('0xaa')](_0x570481[_0x0f12('0x15b')])){return this[_0x0f12('0xe')][_0x0f12('0x2d')](_0x570481,'no\x20operation\x20configured');}this[_0x0f12('0xe')][_0x0f12('0xad')](util[_0x0f12('0x2b')]('math\x20%s',_0x570481['operation']));var _0x4d397e=eval(_0x570481[_0x0f12('0x15b')]);if(!this[_0x0f12('0xaa')](_0x570481[_0x0f12('0xd4')])){return this[_0x0f12('0xe')][_0x0f12('0xad')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x5d10b2=this[_0x0f12('0x10')][_0x0f12('0xa6')](this,_0x570481[_0x0f12('0xd4')]);if(!_0x5d10b2){return this[_0x0f12('0xe')][_0x0f12('0x2d')](_0x570481,'no\x20variable\x20found');}if(_[_0x0f12('0x99')](_0x4d397e)){var _0x469cf3=this;_0x4d397e[_0x0f12('0xd7')](function(_0x40e687,_0x1baedc){_0x469cf3['channel'][_0x0f12('0x9f')](util['format'](_0x0f12('0x15c'),_0x5d10b2,_0x1baedc),_0x40e687);});return this[_0x0f12('0xe')][_0x0f12('0xad')](util['format'](_0x0f12('0x15d'),_0x5d10b2));}else{return this[_0x0f12('0xe')][_0x0f12('0x9f')](_0x5d10b2,_0x4d397e);}};AGIVertices[_0x0f12('0x14')][_0x0f12('0xc')]=function(_0x2d9017){logger[_0x0f12('0x2f')](util[_0x0f12('0x2b')](_0x0f12('0x15e'),_0x2d9017[_0x0f12('0x38')]));if(_0x2d9017[_0x0f12('0xa7')]===0x0){return this[_0x0f12('0xa5')](_0x2d9017);}_0x2d9017[_0x0f12('0xa7')]-=0x1;if(!this[_0x0f12('0xaa')](_0x2d9017[_0x0f12('0x10f')])){return this[_0x0f12('0xe')][_0x0f12('0x2d')](_0x2d9017,_0x0f12('0x110'));}var _0x1c5488=this[_0x0f12('0x1f')][_0x0f12('0xa6')](this,_0x2d9017[_0x0f12('0x10f')]);if(!_0x1c5488){return this[_0x0f12('0xe')][_0x0f12('0x2d')](_0x2d9017,'no\x20file\x20audio\x20found');}var _0x7cc92c=this[_0x0f12('0xe')][_0x0f12('0x15f')](_0x1c5488,_0x2d9017[_0x0f12('0x112')],_0x2d9017[_0x0f12('0x160')]);var _0x48d02f=_0x7cc92c[_0x0f12('0xa3')];if(_0x7cc92c[_0x0f12('0xa3')]===-0x1){this[_0x0f12('0x36')][_0x0f12('0xa6')](this,_0x2d9017,'-1');return _0x7cc92c;}else if(_0x7cc92c[_0x0f12('0xa2')]===_0x0f12('0x67')){_0x7cc92c[_0x0f12('0xa3')]=_0x7cc92c['result']['length']>0x0?_0x7cc92c[_0x0f12('0xa3')]:'t';}else if(_['isEmpty'](_0x7cc92c[_0x0f12('0xa3')])){_0x7cc92c[_0x0f12('0xa3')]='#';_0x48d02f='#';}if(!this[_0x0f12('0xaa')](_0x2d9017[_0x0f12('0xd4')])){this['channel'][_0x0f12('0xad')]('no\x20variable\x20selected\x20for\x20the\x20result');}else{var _0x187593=this[_0x0f12('0x10')][_0x0f12('0xa6')](this,_0x2d9017[_0x0f12('0xd4')]);if(!_0x187593){return this[_0x0f12('0xe')][_0x0f12('0x2d')](_0x2d9017,_0x0f12('0xd6'));}this[_0x0f12('0xe')]['setVariable'](_0x187593,_0x48d02f);}this[_0x0f12('0x36')][_0x0f12('0xa6')](this,_0x2d9017,_0x48d02f);return _0x7cc92c;};AGIVertices['prototype'][_0x0f12('0xad')]=function(_0x183857){logger[_0x0f12('0x2f')](util[_0x0f12('0x2b')](_0x0f12('0x161'),_0x183857['label']));return this['channel'][_0x0f12('0xad')](_0x183857[_0x0f12('0x162')]||_0x183857['label']);};AGIVertices['prototype'][_0x0f12('0x163')]=function(_0x49c9be){logger['info'](util[_0x0f12('0x2b')](_0x0f12('0x164'),_0x49c9be['label']));if(!this[_0x0f12('0xaa')](_0x49c9be['findBy'])){return this[_0x0f12('0xe')][_0x0f12('0x2d')](_0x49c9be,_0x0f12('0x165'));}logger[_0x0f12('0x2f')](util[_0x0f12('0x2b')](_0x0f12('0x157'),this[_0x0f12('0xe')][_0x0f12('0x3a')],_0x49c9be['findBy']));var _0x23fe6e=this[_0x0f12('0x166')][_0x0f12('0xa6')](this,_0x49c9be['pause_id']);var _0x58b9e0=this['agentPause'][_0x0f12('0xa6')](this,_0x49c9be[_0x0f12('0x151')],_0x23fe6e);if(_0x58b9e0){logger[_0x0f12('0x2f')](util[_0x0f12('0x2b')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x0f12('0xe')]['callerid'],_0x49c9be['findBy']));this['channel'][_0x0f12('0xad')](util[_0x0f12('0x2b')](_0x0f12('0x158'),this[_0x0f12('0xe')][_0x0f12('0x3a')],_0x49c9be[_0x0f12('0x151')]));return{'code':0xc8,'result':_0x0f12('0x152')};}else{logger[_0x0f12('0x2f')](util['format'](_0x0f12('0x153'),this[_0x0f12('0xe')][_0x0f12('0x3a')],_0x49c9be[_0x0f12('0x151')]));this[_0x0f12('0xe')][_0x0f12('0xad')](util['format'](_0x0f12('0x158'),this[_0x0f12('0xe')][_0x0f12('0x3a')],_0x49c9be['findBy']));return{'code':0xc8,'result':_0x0f12('0x154')};}};AGIVertices['prototype']['playback']=function(_0x138fc9){logger['info'](util[_0x0f12('0x2b')]('Enter\x20in\x20PLAYBACK\x20(%s)\x20block',_0x138fc9[_0x0f12('0x38')]));if(!this['isConfigured'](_0x138fc9[_0x0f12('0x10f')])){return this['channel'][_0x0f12('0x2d')](_0x138fc9,_0x0f12('0x110'));}var _0x2e946f=this[_0x0f12('0x1f')][_0x0f12('0xa6')](this,_0x138fc9[_0x0f12('0x10f')]);if(!_0x2e946f){return this[_0x0f12('0xe')][_0x0f12('0x2d')](_0x138fc9,_0x0f12('0x111'));}var _0x4ed625=this[_0x0f12('0xe')]['exec'](_0x0f12('0x167'),[_0x2e946f,_0x138fc9[_0x0f12('0x10c')]]);if(_0x4ed625['result']===-0x1){return _0x4ed625;}return this['channel'][_0x0f12('0xad')](util[_0x0f12('0x2b')]('Executed\x20command\x20%s\x20%s',_0x0f12('0x167'),_0x2e946f));};AGIVertices[_0x0f12('0x14')][_0x0f12('0x168')]=function(_0x9dba58){logger[_0x0f12('0x2f')](util[_0x0f12('0x2b')](_0x0f12('0x169'),_0x9dba58['label']));if(!this[_0x0f12('0xaa')](_0x9dba58['queue_id'])){return this[_0x0f12('0xe')][_0x0f12('0x2d')](_0x9dba58,_0x0f12('0x16a'));}var _0x9f5ba6='';var _0x178872=parseInt(_0x9dba58['queue_id'],0xa);if(isNaN(_0x178872)){_0x9f5ba6=_0x9dba58[_0x0f12('0x16b')];}else{_0x9f5ba6=this[_0x0f12('0x15')][_0x0f12('0xa6')](this,_0x9dba58[_0x0f12('0x16b')]);if(!_0x9f5ba6){return this[_0x0f12('0xe')][_0x0f12('0x2d')](_0x9dba58,_0x0f12('0x16c'));}}var _0x57caa1='';if(this[_0x0f12('0xaa')](_0x9dba58['file_id'])){var _0x1b12db=this[_0x0f12('0x1f')][_0x0f12('0xa6')](this,_0x9dba58[_0x0f12('0x10f')]);if(_0x1b12db){_0x57caa1=_0x1b12db;}}this['createSquareDetailsReport'][_0x0f12('0xa6')](this,_0x9dba58,_0x9f5ba6);if(_0x9dba58['opts'][_0x0f12('0x16d')]('x')<0x0){_0x9dba58['opts']+='x';}if(_0x9dba58['opts'][_0x0f12('0x16d')]('X')<0x0){_0x9dba58['opts']+='X';}this[_0x0f12('0xe')]['setVariable'](_0x0f12('0x16e'),_0x9f5ba6?_0x9f5ba6[_0x0f12('0x16f')]():'');var _0x3547e9=this[_0x0f12('0xe')]['exec']('QUEUE',[_0x9f5ba6,_0x9dba58[_0x0f12('0x10c')],_0x9dba58[_0x0f12('0x65')],_0x57caa1,_0x9dba58['timeout'],_0x9dba58[_0x0f12('0x6')],_0x9dba58[_0x0f12('0x170')],_0x9dba58[_0x0f12('0x171')],'',_0x9dba58['position']]);if(_0x3547e9[_0x0f12('0xa3')]===-0x1){return _0x3547e9;}return this['channel'][_0x0f12('0xad')](util[_0x0f12('0x2b')]('Executed\x20command\x20%s\x20%s',_0x0f12('0x172'),_0x9f5ba6));};AGIVertices['prototype'][_0x0f12('0x173')]=function(_0x30033f){logger['info'](util['format'](_0x0f12('0x174'),_0x30033f['label']));var _0x37721c=_0x30033f[_0x0f12('0x175')]||_0x0f12('0x12b');var _0x583fdf=util[_0x0f12('0x2b')](_0x0f12('0x176'),this['channel'][_0x0f12('0x37')],rs[_0x0f12('0x12c')](0x5));var _0x1e9c88=util[_0x0f12('0x2b')](_0x0f12('0x177'),FILES_PATH,_0x583fdf,_0x37721c);var _0x507b91=util[_0x0f12('0x2b')](_0x0f12('0x149'),FILES_PATH,_0x583fdf);this['createSquareRecording'][_0x0f12('0xa6')](this,_0x30033f,_0x583fdf,_0x1e9c88);this[_0x0f12('0xe')][_0x0f12('0x9f')](_0x0f12('0x178'),_0x583fdf);logger[_0x0f12('0x2f')](_0x0f12('0x179'),_0x507b91,_0x37721c,_0x30033f[_0x0f12('0x17a')],_0x30033f[_0x0f12('0x67')]);return this[_0x0f12('0xe')][_0x0f12('0x12f')](_0x507b91,_0x37721c,_0x30033f[_0x0f12('0x17a')],_0x30033f[_0x0f12('0x67')],undefined,!![]);};AGIVertices[_0x0f12('0x14')][_0x0f12('0x17b')]=function(_0x12c06f){logger[_0x0f12('0x2f')](util[_0x0f12('0x2b')](_0x0f12('0x17c'),_0x12c06f['label']));if(!this['isConfigured'](_0x12c06f[_0x0f12('0x65')])){return this[_0x0f12('0xe')]['noop'](_0x0f12('0x17d'));}var _0x58373d=this[_0x0f12('0x64')][_0x0f12('0xa6')](this,_0x12c06f);logger[_0x0f12('0x2f')](util[_0x0f12('0x2b')]('Response:',util['inspect'](_0x58373d,{'showHidden':![],'depth':null})));if(!this[_0x0f12('0xaa')](_0x12c06f[_0x0f12('0xd4')])){return this[_0x0f12('0xe')][_0x0f12('0xad')](_0x0f12('0x17e'));}var _0x409d98=this[_0x0f12('0x10')][_0x0f12('0xa6')](this,_0x12c06f[_0x0f12('0xd4')]);if(!_0x409d98){return this[_0x0f12('0xe')][_0x0f12('0x2d')](_0x12c06f,_0x0f12('0xd6'));}this['channel'][_0x0f12('0x9f')](util['format']('%s_STATUS_CODE',_0x409d98),_0x58373d['statusCode']?_0x58373d[_0x0f12('0x76')]:_0x0f12('0x17f'));this[_0x0f12('0xe')]['setVariable'](util[_0x0f12('0x2b')]('%s_STATUS_MESSAGE',_0x409d98),_0x58373d[_0x0f12('0x75')]?_0x58373d[_0x0f12('0x75')]:'OK');if(_0x58373d[_0x0f12('0x6d')]){try{this[_0x0f12('0x9d')](_0x58373d[_0x0f12('0x6d')],_0x409d98);}catch(_0x34b0b9){logger[_0x0f12('0x2d')](util[_0x0f12('0x2b')]('Unable\x20to\x20set\x20result\x20in\x20variable\x20%s',_0x409d98));}}return this[_0x0f12('0xe')]['noop'](util[_0x0f12('0x2b')](_0x0f12('0x180'),_0x409d98));};AGIVertices[_0x0f12('0x14')][_0x0f12('0x181')]=function(_0x141a7b){logger[_0x0f12('0x2f')](util[_0x0f12('0x2b')](_0x0f12('0x182'),_0x141a7b['label']));return this[_0x0f12('0xe')][_0x0f12('0x183')](_0x141a7b[_0x0f12('0x184')]['replace'](/\s+/g,''),_0x141a7b[_0x0f12('0x17a')]);};AGIVertices['prototype'][_0x0f12('0x185')]=function(_0x1ac229){logger['info'](util['format']('Enter\x20in\x20SAYNUMBER\x20(%s)\x20block',_0x1ac229[_0x0f12('0x38')]));return this[_0x0f12('0xe')][_0x0f12('0x186')](_0x1ac229['number'][_0x0f12('0x58')](/\s+/g,''),_0x1ac229['escape_digits']);};AGIVertices['prototype'][_0x0f12('0x187')]=function(_0x3f6fe2){logger[_0x0f12('0x2f')](util[_0x0f12('0x2b')]('Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block',_0x3f6fe2[_0x0f12('0x38')]));return this[_0x0f12('0xe')][_0x0f12('0x188')](_0x3f6fe2['text'],_0x3f6fe2[_0x0f12('0x17a')]);};AGIVertices[_0x0f12('0x14')][_0x0f12('0x189')]=function(_0x370449){logger[_0x0f12('0x2f')](util['format'](_0x0f12('0x18a'),_0x370449[_0x0f12('0x38')]));if(!this[_0x0f12('0xaa')](_0x370449[_0x0f12('0x18b')])){return this[_0x0f12('0xe')][_0x0f12('0xad')](_0x0f12('0x18c'));}var _0x147b1e=this[_0x0f12('0x22')][_0x0f12('0xa6')](this,_0x370449[_0x0f12('0x18b')]);if(!_0x147b1e||!_0x147b1e['Smtp']){return this[_0x0f12('0xe')]['error'](_0x370449,_0x0f12('0x18d'));}var _0x43df9d={'from':util['format'](_0x0f12('0x18e'),_0x147b1e[_0x0f12('0x17')],_0x147b1e[_0x0f12('0x18f')]||_0x147b1e[_0x0f12('0x190')][_0x0f12('0x191')]),'to':_0x370449['to']||'','cc':_0x370449['cc']||'','bcc':_0x370449[_0x0f12('0x192')]||'','subject':_0x370449[_0x0f12('0x193')],'html':_0x370449[_0x0f12('0x5c')],'text':_0x370449[_0x0f12('0x5c')]};if(this[_0x0f12('0xaa')](_0x370449[_0x0f12('0x194')])){}logger[_0x0f12('0xdc')](_0x0f12('0x195'),JSON[_0x0f12('0x74')](_0x43df9d));this[_0x0f12('0x36')]['sync'](this,_0x370449,_0x370449[_0x0f12('0x18b')]);this[_0x0f12('0xe')][_0x0f12('0xad')](util[_0x0f12('0x2b')](_0x0f12('0x196'),_0x147b1e[_0x0f12('0x17')]));this[_0x0f12('0x24')][_0x0f12('0xa6')](this,_0x147b1e[_0x0f12('0x197')],_0x43df9d);return this[_0x0f12('0xe')]['noop'](_0x0f12('0x198'));};AGIVertices[_0x0f12('0x14')][_0x0f12('0x199')]=function(_0x4f6dc2){logger[_0x0f12('0x2f')](util[_0x0f12('0x2b')](_0x0f12('0x19a'),_0x4f6dc2[_0x0f12('0x38')]));return this[_0x0f12('0xe')][_0x0f12('0xad')](_0x0f12('0x19b'));};AGIVertices[_0x0f12('0x14')][_0x0f12('0x19c')]=function(_0x46c09b){logger['info'](util['format']('Enter\x20in\x20SENDSMS\x20(%s)\x20block',_0x46c09b[_0x0f12('0x38')]));if(!this[_0x0f12('0xaa')](_0x46c09b[_0x0f12('0x19d')])){return this[_0x0f12('0xe')][_0x0f12('0xad')](_0x0f12('0x19e'));}var _0x49b77f=this[_0x0f12('0x33')]['sync'](this,_0x46c09b[_0x0f12('0x19d')]);if(!_0x49b77f){return this[_0x0f12('0xe')][_0x0f12('0x2d')](_0x46c09b,'no\x20sms\x20account\x20found');}var _0x3625fe={'body':_0x46c09b[_0x0f12('0x19f')],'phone':_0x46c09b['to']||'','SmsAccountId':_0x49b77f['id']};logger[_0x0f12('0xdc')](_0x0f12('0x1a0'),JSON['stringify'](_0x3625fe));this['createSquareDetailsReport'][_0x0f12('0xa6')](this,_0x46c09b,_0x46c09b[_0x0f12('0x19d')]);this[_0x0f12('0xe')][_0x0f12('0xad')](util['format'](_0x0f12('0x1a1'),_0x49b77f['name']));this['createSmsMessage'][_0x0f12('0xa6')](this,_0x3625fe);return this['channel']['noop'](_0x0f12('0x1a2'));};AGIVertices[_0x0f12('0x14')]['set']=function(_0x4454d8){logger[_0x0f12('0x2f')](util[_0x0f12('0x2b')](_0x0f12('0x1a3'),_0x4454d8[_0x0f12('0x38')]));if(!this[_0x0f12('0xaa')](_0x4454d8[_0x0f12('0xd4')])){return this['channel'][_0x0f12('0x2d')](_0x4454d8,'no\x20variable\x20selected');}var _0x167f3d=this[_0x0f12('0x10')][_0x0f12('0xa6')](this,_0x4454d8[_0x0f12('0xd4')]);if(!_0x167f3d){return this[_0x0f12('0xe')]['error'](_0x4454d8,_0x0f12('0xd6'));}return this[_0x0f12('0xe')][_0x0f12('0x9f')](_0x167f3d,_0x4454d8[_0x0f12('0x1a4')]);};AGIVertices[_0x0f12('0x14')][_0x0f12('0x1a5')]=function(_0x30cd8e){logger['info'](util['format']('Enter\x20in\x20START\x20(%s)\x20block',_0x30cd8e['label']));this[_0x0f12('0xe')]['noop']('START\x20CALLY\x20SQUARE');var _0x5a88ab=this[_0x0f12('0xe')][_0x0f12('0x10')]('XMCS-UNIQUEID');if(!_[_0x0f12('0x43')](_0x5a88ab[_0x0f12('0xa2')])){this[_0x0f12('0xe')][_0x0f12('0x37')]=_0x5a88ab[_0x0f12('0xa2')];}if(_0x30cd8e[_0x0f12('0xb8')]===_0x0f12('0x1a6')){this[_0x0f12('0xe')][_0x0f12('0xad')](_0x0f12('0x1a7'));return this['channel'][_0x0f12('0xb8')]();}return this['channel'][_0x0f12('0xad')](_0x0f12('0x1a8'));};AGIVertices[_0x0f12('0x14')]['subproject']=function(_0xefe931){logger[_0x0f12('0x2f')](util[_0x0f12('0x2b')](_0x0f12('0x1a9'),_0xefe931[_0x0f12('0x38')]));if(!this[_0x0f12('0xaa')](_0xefe931[_0x0f12('0x1aa')])){return this[_0x0f12('0xe')][_0x0f12('0x2d')](_0xefe931,_0x0f12('0x1ab'));}var _0x1af5a1=this[_0x0f12('0x18')][_0x0f12('0xa6')](this,_0xefe931[_0x0f12('0x1aa')]);if(!this[_0x0f12('0xaa')](_0x1af5a1)){return this[_0x0f12('0xe')][_0x0f12('0x2d')](_0xefe931,util[_0x0f12('0x2b')](_0x0f12('0x1ac'),_0xefe931[_0x0f12('0x1aa')]));}if(_0x1af5a1===this[_0x0f12('0xe')][_0x0f12('0x39')]){return this[_0x0f12('0xe')][_0x0f12('0x2d')](_0xefe931,_0x0f12('0x1ad'));}this[_0x0f12('0x36')]['sync'](this,_0xefe931,_0x1af5a1);var _0x46e4a2=this[_0x0f12('0xe')][_0x0f12('0x56')](_0x0f12('0x1ae'),util['format'](_0x0f12('0x1af'),config['agi']['host']||_0x0f12('0x1b0'),_0x1af5a1,this[_0x0f12('0xe')][_0x0f12('0x39')]));if(_0x46e4a2[_0x0f12('0xa3')]===-0x1){return _0x46e4a2;}return this[_0x0f12('0xe')]['noop'](util['format'](_0x0f12('0xbf'),'AGI',_0x1af5a1));};AGIVertices['prototype'][_0x0f12('0x1b1')]=function(_0x358583){logger[_0x0f12('0x2f')](util[_0x0f12('0x2b')](_0x0f12('0x1b2'),_0x358583['label']));var _0x33cbde=this[_0x0f12('0x55')][_0x0f12('0xa6')](this,_0x358583[_0x0f12('0xb6')]);this[_0x0f12('0x36')][_0x0f12('0xa6')](this,_0x358583,_0x358583[_0x0f12('0xb6')]);if(this[_0x0f12('0xaa')](_0x358583[_0x0f12('0xd4')])){var _0x45222a=this['getVariable'][_0x0f12('0xa6')](this,_0x358583['variable_id']);if(_0x45222a){this[_0x0f12('0xe')]['setVariable'](_0x45222a,_0x33cbde);return this['channel'][_0x0f12('0xad')](util['format'](_0x0f12('0x1b3'),_0x358583[_0x0f12('0xb6')],_0x45222a));}}return this[_0x0f12('0xe')][_0x0f12('0xad')](util[_0x0f12('0x2b')](_0x0f12('0x1b4'),_0x358583[_0x0f12('0xb6')]));};AGIVertices[_0x0f12('0x14')][_0x0f12('0x1b5')]=function(_0x536013){logger[_0x0f12('0x2f')](util['format'](_0x0f12('0x1b6'),_0x536013[_0x0f12('0x38')]));_0x536013[_0x0f12('0x5c')]=_0x536013['text']['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x0f12('0xaa')](_0x536013[_0x0f12('0x5a')])){return this[_0x0f12('0xe')]['noop']('no\x20apiKey\x20configured');}if(!this['isConfigured'](_0x536013['text'])){return this[_0x0f12('0xe')][_0x0f12('0xad')](_0x0f12('0xc3'));}this['channel']['noop'](util[_0x0f12('0x2b')](_0x0f12('0x1b7'),_0x536013['text']));var _0x5d765d=this[_0x0f12('0x59')][_0x0f12('0xa6')](this,_0x536013);if(_0x5d765d){this[_0x0f12('0xe')][_0x0f12('0xad')](util[_0x0f12('0x2b')](_0x0f12('0x1b8'),_0x5d765d));var _0x3d9648=this[_0x0f12('0xe')][_0x0f12('0x102')](_0x5d765d);try{fs[_0x0f12('0x103')](_0x5d765d+_0x0f12('0x104'));}catch(_0x2c83b4){logger[_0x0f12('0x2d')](_0x2c83b4);}return _0x3d9648;}return this[_0x0f12('0xe')][_0x0f12('0x2d')](_0x536013,_0x0f12('0x1b9'));};AGIVertices['prototype'][_0x0f12('0x1ba')]=function(_0x57f49c){logger[_0x0f12('0x2f')](util['format'](_0x0f12('0x1bb'),_0x57f49c[_0x0f12('0x38')]));_0x57f49c[_0x0f12('0x5c')]=_0x57f49c[_0x0f12('0x5c')][_0x0f12('0x58')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x57f49c[_0x0f12('0x5c')])){return this[_0x0f12('0xe')][_0x0f12('0xad')]('no\x20text\x20configured');}this[_0x0f12('0xe')][_0x0f12('0xad')](util['format'](_0x0f12('0x1bc'),_0x57f49c[_0x0f12('0x5c')]));var _0x231079=this['googleTTS']['sync'](this,_0x57f49c);if(_0x231079){this[_0x0f12('0xe')][_0x0f12('0xad')](util[_0x0f12('0x2b')](_0x0f12('0x1bd'),_0x231079));var _0x12cf9d=this[_0x0f12('0xe')][_0x0f12('0x102')](_0x231079);try{fs['unlink'](_0x231079+_0x0f12('0x104'));}catch(_0x91e487){logger[_0x0f12('0x2d')](_0x91e487);}return _0x12cf9d;}return this['channel']['error'](_0x57f49c,_0x0f12('0x1be'));};AGIVertices[_0x0f12('0x14')][_0x0f12('0x1bf')]=function(_0x340e1d){logger[_0x0f12('0x2f')](util['format'](_0x0f12('0x1c0'),_0x340e1d[_0x0f12('0x38')]));if(!this[_0x0f12('0xaa')](_0x340e1d['findBy'])){return this[_0x0f12('0xe')][_0x0f12('0x2d')](_0x340e1d,_0x0f12('0x165'));}logger['info'](util['format'](_0x0f12('0x157'),this[_0x0f12('0xe')][_0x0f12('0x3a')],_0x340e1d[_0x0f12('0x151')]));var _0x5c65d3=this['agentUnpause']['sync'](this,_0x340e1d[_0x0f12('0x151')]);if(_0x5c65d3){logger[_0x0f12('0x2f')](util[_0x0f12('0x2b')](_0x0f12('0x158'),this['channel'][_0x0f12('0x3a')],_0x340e1d[_0x0f12('0x151')]));this[_0x0f12('0xe')][_0x0f12('0xad')](util[_0x0f12('0x2b')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x0f12('0xe')][_0x0f12('0x3a')],_0x340e1d[_0x0f12('0x151')]));return{'code':0xc8,'result':'success'};}else{logger[_0x0f12('0x2f')](util[_0x0f12('0x2b')](_0x0f12('0x153'),this[_0x0f12('0xe')][_0x0f12('0x3a')],_0x340e1d['findBy']));this['channel'][_0x0f12('0xad')](util[_0x0f12('0x2b')](_0x0f12('0x153'),this['channel'][_0x0f12('0x3a')],_0x340e1d[_0x0f12('0x151')]));return{'code':0xc8,'result':_0x0f12('0x154')};}};AGIVertices[_0x0f12('0x14')][_0x0f12('0x1c1')]=function(_0x207fd3){logger['info'](util['format'](_0x0f12('0x1c2'),_0x207fd3[_0x0f12('0x38')]));var _0xfd1c53=this[_0x0f12('0xe')][_0x0f12('0x56')]('VOICEMAIL',[_0x207fd3[_0x0f12('0x1c3')],_0x207fd3[_0x0f12('0x79')]]);if(_0xfd1c53[_0x0f12('0xa3')]===-0x1){return _0xfd1c53;}return this[_0x0f12('0xe')][_0x0f12('0xad')](util['format']('Executed\x20command\x20%s\x20%s','VOICEMAIL',_0x207fd3[_0x0f12('0x1c3')]));};AGIVertices[_0x0f12('0x14')][_0x0f12('0x1c4')]=function(_0x3a5adc){logger[_0x0f12('0x2f')](util[_0x0f12('0x2b')]('Enter\x20in\x20SWITCH\x20(%s)\x20block',_0x3a5adc[_0x0f12('0x38')]));if(!this[_0x0f12('0xaa')](_0x3a5adc[_0x0f12('0xd4')])){return this['channel']['error'](_0x3a5adc,_0x0f12('0x1c5'));}var _0x42e135=this[_0x0f12('0x10')][_0x0f12('0xa6')](this,_0x3a5adc['variable_id']);if(!_0x42e135){return this[_0x0f12('0xe')]['error'](_0x3a5adc,_0x0f12('0xd6'));}var _0x5b8abf=this[_0x0f12('0xe')]['getVariable'](_0x42e135);return{'code':0xc8,'result':_0x5b8abf[_0x0f12('0xa2')]?_0x5b8abf[_0x0f12('0xa2')]:'-'};};String[_0x0f12('0x14')][_0x0f12('0xa1')]=function(_0x3addd5,_0x5ac118){return this['split'](_0x3addd5)[_0x0f12('0x1c6')](_0x5ac118);};module[_0x0f12('0x1c7')]=AGIVertices; \ No newline at end of file +var _0x50a6=['no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','message','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20Result\x20%s','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','beep','NOBEEP','intKey','GOOGLE_ASR_%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appsecret\x20configured','recordFile','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','context','priority','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','true','false','EVAL\x20CONDITION\x20%s\x20%s','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','no\x20interval\x20configured','getIntervals','interval_id','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','%s/recordings/%s','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','findBy','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','Enter\x20in\x20LOGOUT\x20(%s)\x20block','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','math\x20%s','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','getData','response','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','pause_id','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','XMCS-QUEUE','QUEUE','macro','gosub','position','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s/recordings/%s.%s','RECORDING_SAVENAME','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','Response:','inspect','%s_STATUS_CODE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','variable\x20%s\x20set','saydigits','sayDigits','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sendMail','account_id','no\x20mail\x20account\x20configured','getMailAccount','Smtp','\x22%s\x22\x20<%s>','email','user','bcc','subject','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','smtpOptions','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','XMCS-UNIQUEID','yes','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','host','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','util','lodash','randomstring','mustache','request-promise','../../config/logger','../../config/environment','rawHeaders','rawBody','menu','getdigits','channel','mailRpc','prototype','rpc','then','name','getVoiceQueue','getVoiceQueueById','getSquareProject','catch','getSquareOdbc','getSquareOdbcById','dsn','getUser','getUserById','getTrunk','getTrunkById','getSound','getSoundById','getSoundPath','save_name','getMailAccountById','sendMailMessage','getIntervalById','interval','map','format','getQueryOdbc','error','Error\x20getting\x20ODBC\x20connection\x20%s','ODBC\x20connection\x20successfully','query','Error\x20executing\x20query\x20%s','info','Query\x20executed\x20correctly\x20%s','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','uniqueid','label','agicommand','arg_1','callerid','createSquareRecording','calleridname','extension','dnid','file','createCmContact','isEmpty','isNil','callback_','random','lastName','list_id','scheduledAt','callback','Callback\x20scheduled\x20at\x20','toString','callback_priority','getPause','getPauseById','agentPause','agentUnpause','agent','agentLogout','agentLogin','%s/%s@from-sip/n','shellCommand','trim','replace','googleCloudTTS','text','languageCode','ssmlGender','MALE','audioEncoding','googleTTS','google_tts_language','restAPI','url','timeout','number','POST','body','headers','parse','computedVariables','sync','uri','render','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','client_email','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','ispeech_tts_language','en-US','speed','ispeechASR','isConfigured','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_region','aws_text_type','awsLex','aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','appsecret','clear','clone','isString','includes','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','hasOwnProperty','isPlainObject','isArray','length','saveRestApiResult','%s.%s','setVariable','split','replaceAll','getVariable','extra','getAndSetVariable','result','maxRetry','createSquareDetailsReport','retry','mrcpsynth','noop','no\x20text\x20configured','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','no\x20grammar\x20configured','MRCPRecog','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','agi','command','answer','wait','Enter\x20in\x20CALLBACK\x20(%s)\x20block','delay','add','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','phone','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','exec','application','Executed\x20command\x20%s\x20%s','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','MRCPSynth','sestektts','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','RECOG_CONFIDENCE()','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_INSTANCE','database','odbc_id','no\x20odbc\x20database\x20found','no\x20query\x20configured','query:\x20%s','variable_id','no\x20variable\x20found','forEach','keys','%s_ROWS_COUNT','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20found','DIAL','SIP/%s','Executed\x20command\x20%s','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','createSquareMessage','Trying\x20Dialogflow:\x20%s','toUpperCase','speech','out','Dialogflow\x20is\x20unreachable','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','no\x20private_key\x20configured','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','DIALOGFLOW_%s','dialogflowV2','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','no\x20ndauth\x20url\x20configured','username','password','no\x20password\x20configured','SESTEK_NDA_%s','Sestek\x20NDA\x20%s\x20file\x20created','audiofile','streamFile','unlink','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20found','trunk_name','no\x20trunk\x20selected','SIP/%s/%s','opts','finally','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20found','no\x20variable\x20selected\x20for\x20the\x20result','test','stringify','mindigit','hiddendigitsnum','hiddendigitspos','first','substr','generate','getsecretdigits','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block'];(function(_0x16ab5d,_0x2527ec){var _0x3b24f7=function(_0x52fafd){while(--_0x52fafd){_0x16ab5d['push'](_0x16ab5d['shift']());}};_0x3b24f7(++_0x2527ec);}(_0x50a6,0xa4));var _0x650a=function(_0x2ac992,_0x37c877){_0x2ac992=_0x2ac992-0x0;var _0x223c9d=_0x50a6[_0x2ac992];return _0x223c9d;};'use strict';var fs=require('fs');var util=require(_0x650a('0x0'));var _=require(_0x650a('0x1'));var sh=require('shelljs');var odbc=require('odbc')();var rs=require(_0x650a('0x2'));var moment=require('moment');var Mustache=require(_0x650a('0x3'));var rp=require(_0x650a('0x4'));var logger=require(_0x650a('0x5'))('agi');var config=require(_0x650a('0x6'));var scripts=require('./scripts');var FILES_PATH='/var/opt/motion2/server/files';var recursiveMapAttributes=[_0x650a('0x7'),_0x650a('0x8')];var verticesWithRetry=[_0x650a('0x9'),_0x650a('0xa'),'getsecretdigits'];var AGIVertices=function(_0x25366e,_0x5c1d7c,_0x3b50e7){this[_0x650a('0xb')]=_0x25366e;this['rpc']=_0x5c1d7c;this[_0x650a('0xc')]=_0x3b50e7;};AGIVertices[_0x650a('0xd')]['getVariable']=function(_0x3e2406,_0x526881){this[_0x650a('0xe')]['getVariableById'](_0x3e2406)[_0x650a('0xf')](function(_0x593cba){_0x526881(null,_0x593cba?_0x593cba[_0x650a('0x10')]:![]);})['catch'](function(_0x33e73d){_0x526881(_0x33e73d);});};AGIVertices[_0x650a('0xd')][_0x650a('0x11')]=function(_0x516e71,_0x10fb8f){this[_0x650a('0xe')][_0x650a('0x12')](_0x516e71)[_0x650a('0xf')](function(_0x35c6dc){_0x10fb8f(null,_0x35c6dc?_0x35c6dc[_0x650a('0x10')]:![]);})['catch'](function(_0x2460a3){_0x10fb8f(_0x2460a3);});};AGIVertices['prototype'][_0x650a('0x13')]=function(_0x3c2206,_0x348fda){this['rpc']['getSquareProjectById'](_0x3c2206)['then'](function(_0x52e5bb){_0x348fda(null,_0x52e5bb?_0x52e5bb[_0x650a('0x10')]:![]);})[_0x650a('0x14')](function(_0x41d2fa){_0x348fda(_0x41d2fa);});};AGIVertices[_0x650a('0xd')][_0x650a('0x15')]=function(_0x5c3d99,_0x4eba86){this[_0x650a('0xe')][_0x650a('0x16')](_0x5c3d99)['then'](function(_0x2e2761){_0x4eba86(null,_0x2e2761?_0x2e2761[_0x650a('0x17')]:![]);})['catch'](function(_0x158356){_0x4eba86(_0x158356);});};AGIVertices[_0x650a('0xd')][_0x650a('0x18')]=function(_0x8dde4a,_0x5163fe){this['rpc'][_0x650a('0x19')](_0x8dde4a)['then'](function(_0x2d7a05){_0x5163fe(null,_0x2d7a05?_0x2d7a05[_0x650a('0x10')]:![]);})[_0x650a('0x14')](function(_0x469e53){_0x5163fe(_0x469e53);});};AGIVertices[_0x650a('0xd')][_0x650a('0x1a')]=function(_0x40117a,_0x322eba){this[_0x650a('0xe')][_0x650a('0x1b')](_0x40117a)[_0x650a('0xf')](function(_0x234fce){_0x322eba(null,_0x234fce?_0x234fce[_0x650a('0x10')]:![]);})[_0x650a('0x14')](function(_0x398a99){_0x322eba(_0x398a99);});};AGIVertices[_0x650a('0xd')][_0x650a('0x1c')]=function(_0x12fdb4,_0x4c1df6){var _0x2290a7=this;this[_0x650a('0xe')][_0x650a('0x1d')](_0x12fdb4)['then'](function(_0x1c6845){_0x4c1df6(null,_0x1c6845?_0x2290a7[_0x650a('0x1e')](_0x1c6845[_0x650a('0x1f')]):![]);})[_0x650a('0x14')](function(_0x3c5bd4){_0x4c1df6(_0x3c5bd4);});};AGIVertices[_0x650a('0xd')]['getMailAccount']=function(_0x190a65,_0x1c8621){this[_0x650a('0xe')][_0x650a('0x20')](_0x190a65)[_0x650a('0xf')](function(_0x3e15ba){_0x1c8621(null,_0x3e15ba?_0x3e15ba:![]);})[_0x650a('0x14')](function(_0x12b86a){_0x1c8621(_0x12b86a);});};AGIVertices['prototype'][_0x650a('0x21')]=function(_0x3c2eda,_0x2e0370,_0x5123c9){this[_0x650a('0xc')][_0x650a('0x21')](_0x3c2eda,_0x2e0370)['then'](function(){_0x5123c9(null);})[_0x650a('0x14')](function(_0x21577d){_0x5123c9(_0x21577d);});};AGIVertices[_0x650a('0xd')]['getIntervals']=function(_0x5b4a47,_0x4d5c30){this[_0x650a('0xe')][_0x650a('0x22')](_0x5b4a47)[_0x650a('0xf')](function(_0x475d20){if(_0x475d20){if(_0x475d20['IntervalId']){_0x4d5c30(null,[_0x475d20[_0x650a('0x23')]]);}else{_0x4d5c30(null,_[_0x650a('0x24')](_0x475d20['Intervals'],_0x650a('0x23')));}}else{_0x4d5c30(null,![]);}})[_0x650a('0x14')](function(_0x16f8db){_0x4d5c30(_0x16f8db);});};AGIVertices[_0x650a('0xd')][_0x650a('0x1e')]=function(_0x4ada6a){return util[_0x650a('0x25')]('%s/sounds/converted/%s',FILES_PATH,_0x4ada6a);};AGIVertices[_0x650a('0xd')][_0x650a('0x26')]=function(_0x5dbdf9,_0x43b91a,_0xa0e8ec){odbc['open'](_0x5dbdf9,function(_0x2683ec){if(_0x2683ec){logger[_0x650a('0x27')](_0x650a('0x28'),_0x2683ec);_0xa0e8ec(_0x2683ec);}else{logger['info'](_0x650a('0x29'));odbc[_0x650a('0x2a')](_0x43b91a,function(_0x424073,_0x2d0ac9){if(_0x424073){logger['info'](_0x650a('0x2b'),_0x43b91a);_0xa0e8ec(_0x424073);}else{logger[_0x650a('0x2c')](_0x650a('0x2d'),_0x43b91a);odbc['close'](function(_0x4909e7){if(_0x4909e7){logger[_0x650a('0x27')](_0x650a('0x2e'),_0x4909e7);}_0xa0e8ec(null,_0x2d0ac9);});}});}});};AGIVertices['prototype'][_0x650a('0x2f')]=function(_0x48bdd4,_0x3ebe8b){this[_0x650a('0xe')][_0x650a('0x30')](_0x48bdd4)[_0x650a('0xf')](function(_0x3dbd7b){_0x3ebe8b(null,_0x3dbd7b?_0x3dbd7b:![]);})['catch'](function(_0x20ba76){_0x3ebe8b(_0x20ba76);});};AGIVertices['prototype'][_0x650a('0x31')]=function(_0x1d65b4,_0x3413b4){this[_0x650a('0xe')][_0x650a('0x31')](_0x1d65b4)[_0x650a('0xf')](function(_0xbab4b7){_0x3413b4(null,_0xbab4b7);})['catch'](function(_0x51c41a){_0x3413b4(_0x51c41a);});};AGIVertices[_0x650a('0xd')]['createSquareDetailsReport']=function(_0x5e5179,_0x1e0868,_0x58c718){this[_0x650a('0xe')]['createSquareDetailsReport']({'uniqueid':this[_0x650a('0xb')][_0x650a('0x32')],'node':_0x5e5179[_0x650a('0x33')],'application':_0x5e5179[_0x650a('0x34')],'data':_0x1e0868||null,'project_name':this[_0x650a('0xb')][_0x650a('0x35')],'callerid':this[_0x650a('0xb')][_0x650a('0x36')]})[_0x650a('0xf')](function(_0x25c0a2){if(_0x58c718){_0x58c718(null,_0x25c0a2);}})[_0x650a('0x14')](function(_0x381632){if(_0x58c718){_0x58c718(_0x381632);}});};AGIVertices['prototype'][_0x650a('0x37')]=function(_0x52dac4,_0x2ca163,_0x14c1bf,_0x22c133){this[_0x650a('0xe')]['createSquareRecording']({'uniqueid':this[_0x650a('0xb')][_0x650a('0x32')],'callerid':this[_0x650a('0xb')][_0x650a('0x36')],'calleridname':this[_0x650a('0xb')][_0x650a('0x38')],'context':this['channel']['context'],'extension':this[_0x650a('0xb')][_0x650a('0x39')],'priority':this[_0x650a('0xb')]['priority'],'accountcode':this[_0x650a('0xb')]['accountcode'],'dnid':this[_0x650a('0xb')][_0x650a('0x3a')],'projectName':this['channel'][_0x650a('0x35')],'saveName':_0x2ca163,'filename':_0x52dac4[_0x650a('0x3b')]||_0x2ca163,'savePath':_0x14c1bf})[_0x650a('0xf')](function(_0x47ec0d){_0x22c133(null,_0x47ec0d);})[_0x650a('0x14')](function(_0x3e7cfc){_0x22c133(_0x3e7cfc);});};AGIVertices[_0x650a('0xd')]['createSquareMessage']=function(_0x17a40d,_0x3f2151,_0x34fa7a,_0x11bb6b,_0x134cb5){this['rpc']['createSquareMessage']({'uniqueid':this[_0x650a('0xb')][_0x650a('0x32')],'body':_0x17a40d,'direction':_0x3f2151,'providerName':_0x34fa7a,'providerResponse':_0x11bb6b})['then'](function(_0x11c4f2){if(_0x134cb5){_0x134cb5(null,_0x11c4f2);}})[_0x650a('0x14')](function(_0x3fab74){if(_0x134cb5){_0x134cb5(_0x3fab74);}});};AGIVertices[_0x650a('0xd')][_0x650a('0x3c')]=function(_0x8bef2c,_0x4be57a){this[_0x650a('0xe')][_0x650a('0x3c')]({'firstName':_[_0x650a('0x3d')](_0x8bef2c[_0x650a('0x10')])||_[_0x650a('0x3e')](_0x8bef2c['name'])?_0x650a('0x3f')+Math[_0x650a('0x40')]():_0x8bef2c[_0x650a('0x10')],'lastName':_[_0x650a('0x3d')](_0x8bef2c['lastName'])||_['isNil'](_0x8bef2c[_0x650a('0x41')])?null:_0x8bef2c[_0x650a('0x41')],'phone':_0x8bef2c['phone'],'ListId':_0x8bef2c[_0x650a('0x42')],'scheduledat':_0x8bef2c[_0x650a('0x43')],'callbackUniqueid':this[_0x650a('0xb')][_0x650a('0x32')],'tags':_0x650a('0x44'),'description':_0x650a('0x45')+_0x8bef2c[_0x650a('0x43')][_0x650a('0x46')](),'priority':_0x8bef2c[_0x650a('0x47')]})[_0x650a('0xf')](function(_0x304e50){_0x4be57a(null,_0x304e50);})[_0x650a('0x14')](function(_0x438912){_0x4be57a(_0x438912);});};AGIVertices[_0x650a('0xd')][_0x650a('0x48')]=function(_0x4daef0,_0x5d271b){this[_0x650a('0xe')][_0x650a('0x49')](_0x4daef0)['then'](function(_0x4c74f4){_0x5d271b(null,_0x4c74f4?_0x4c74f4[_0x650a('0x10')]:![]);})['catch'](function(_0x175f5b){_0x5d271b(_0x175f5b);});};AGIVertices['prototype']['agentPause']=function(_0x1b2a4a,_0x508e45,_0x449dbf){var _0x308419={'role':'agent'};_0x308419[_0x1b2a4a]=this[_0x650a('0xb')][_0x650a('0x36')];this[_0x650a('0xe')][_0x650a('0x4a')](_0x308419,_0x508e45,this[_0x650a('0xb')][_0x650a('0x32')])['then'](function(_0x2fd7fe){_0x449dbf(null,_[_0x650a('0x3e')](_0x2fd7fe)?![]:!![]);})[_0x650a('0x14')](function(_0x4fc4ad){logger[_0x650a('0x27')](_0x4fc4ad);_0x449dbf(null,![]);});};AGIVertices[_0x650a('0xd')][_0x650a('0x4b')]=function(_0x5920a6,_0x581ead){var _0x1cf56e={'role':_0x650a('0x4c')};_0x1cf56e[_0x5920a6]=this['channel'][_0x650a('0x36')];this[_0x650a('0xe')][_0x650a('0x4b')](_0x1cf56e)[_0x650a('0xf')](function(_0x381717){_0x581ead(null,_[_0x650a('0x3e')](_0x381717)?![]:!![]);})['catch'](function(_0x2ca57d){logger[_0x650a('0x27')](_0x2ca57d);_0x581ead(null,![]);});};AGIVertices[_0x650a('0xd')]['agentLogout']=function(_0x436531,_0xf8f4de){var _0x576834={'role':_0x650a('0x4c')};_0x576834[_0x436531]=this['channel'][_0x650a('0x36')];this['rpc'][_0x650a('0x4d')](_0x576834)[_0x650a('0xf')](function(_0x5eb188){_0xf8f4de(null,_[_0x650a('0x3e')](_0x5eb188)?![]:!![]);})[_0x650a('0x14')](function(_0x3eb62c){logger[_0x650a('0x27')](_0x3eb62c);_0xf8f4de(null,![]);});};AGIVertices[_0x650a('0xd')][_0x650a('0x4e')]=function(_0x13f181,_0x338841){var _0x5a08d9={'role':_0x650a('0x4c')};_0x5a08d9[_0x13f181]=this[_0x650a('0xb')][_0x650a('0x36')];var _0xba1b88=_0x13f181!='internal'?util['format'](_0x650a('0x4f'),'LOCAL',this[_0x650a('0xb')][_0x650a('0x36')]):undefined;this[_0x650a('0xe')][_0x650a('0x4e')](_0x5a08d9,_0xba1b88)[_0x650a('0xf')](function(_0x27c6a7){_0x338841(null,_['isNil'](_0x27c6a7)?![]:!![]);})[_0x650a('0x14')](function(_0x4e5084){logger[_0x650a('0x27')](_0x4e5084);_0x338841(null,![]);});};AGIVertices[_0x650a('0xd')][_0x650a('0x50')]=function(_0x12541f,_0x29fef6){sh['exec'](_[_0x650a('0x51')](_0x12541f),function(_0x1fa4a9,_0x216d40){var _0x28a6b1=_0x216d40[_0x650a('0x52')](/(\r\n|\n|\r)/gm,'');_0x29fef6(null,_0x28a6b1);});};AGIVertices[_0x650a('0xd')][_0x650a('0x53')]=function(_0x3dd46b,_0x2913f){scripts[_0x650a('0x53')](_0x3dd46b['apiKey'],_0x3dd46b['google_cloud_tts_text_type']||'text',_0x3dd46b[_0x650a('0x54')],_0x3dd46b[_0x650a('0x55')]||'en-US',_0x3dd46b[_0x650a('0x56')]||_0x650a('0x57'),_0x3dd46b[_0x650a('0x58')]||'MP3')[_0x650a('0xf')](function(_0x5c03db){_0x2913f(null,_0x5c03db);})[_0x650a('0x14')](function(_0x3b9603){_0x2913f(_0x3b9603);});};AGIVertices[_0x650a('0xd')][_0x650a('0x59')]=function(_0x434456,_0x5245f5){scripts['googleTTS'](_0x434456[_0x650a('0x54')],_0x434456[_0x650a('0x5a')]||'en',0x1)[_0x650a('0xf')](function(_0x502dc1){_0x5245f5(null,_0x502dc1);})[_0x650a('0x14')](function(_0x5dc433){_0x5245f5(_0x5dc433);});};AGIVertices['prototype'][_0x650a('0x5b')]=function(_0x409f8b,_0x383fb3){var _0x39b2d2={'uri':_0x409f8b[_0x650a('0x5c')],'method':_0x409f8b['method'],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x409f8b[_0x650a('0x5d')])===_0x650a('0x5e')&&parseInt(_0x409f8b[_0x650a('0x5d')])>=0x1?parseInt(_0x409f8b['timeout'])*0x3e8:0x5*0x3e8};if(_['includes']([_0x650a('0x5f'),'PUT'],_0x39b2d2['method']['toUpperCase']())){try{_0x39b2d2[_0x650a('0x60')]=_0x409f8b['rawBody']?JSON['parse'](_0x409f8b[_0x650a('0x8')]):{};}catch(_0x553dd3){logger[_0x650a('0x27')]('An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function',_0x553dd3);}}try{_0x39b2d2[_0x650a('0x61')]=_0x409f8b[_0x650a('0x7')]?JSON[_0x650a('0x62')](_0x409f8b[_0x650a('0x7')]):{};}catch(_0x4d8f21){logger[_0x650a('0x27')]('An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function',_0x4d8f21);}if(_0x409f8b['computedVariables']){try{var _0x3efcc7=require(_0x409f8b[_0x650a('0x63')])[_0x650a('0x64')](this,_0x39b2d2);_0x39b2d2[_0x650a('0x65')]=Mustache[_0x650a('0x66')](_0x409f8b[_0x650a('0x5c')],_0x3efcc7,{},['$$','$$']);if(_0x39b2d2['headers']){_0x39b2d2[_0x650a('0x61')]=JSON[_0x650a('0x62')](Mustache[_0x650a('0x66')](JSON['stringify'](_0x39b2d2[_0x650a('0x61')]),_0x3efcc7,{},['$$','$$']));}if(_0x39b2d2[_0x650a('0x60')]){_0x39b2d2[_0x650a('0x60')]=JSON[_0x650a('0x62')](Mustache[_0x650a('0x66')](JSON['stringify'](_0x39b2d2[_0x650a('0x60')]),_0x3efcc7,{},['$$','$$']));}}catch(_0x2e62f3){logger['error'](_0x650a('0x67'),_0x2e62f3);}}rp(_0x39b2d2)['then'](function(_0x5078e1){var _0x14e65d={'statusCode':_0x5078e1[_0x650a('0x68')]||0xc8,'statusMessage':_0x5078e1['statusMessage']||'OK','headers':_0x5078e1[_0x650a('0x61')]||{},'body':_0x5078e1[_0x650a('0x60')]||{}};_0x383fb3(null,_0x14e65d);})[_0x650a('0x14')](function(_0x1e66a0){var _0x19b401={'statusCode':_0x1e66a0[_0x650a('0x68')]||0x1f4,'statusMessage':_0x1e66a0['message']||_0x650a('0x69'),'headers':_0x1e66a0[_0x650a('0x6a')][_0x650a('0x61')]||{},'body':_0x1e66a0[_0x650a('0x6a')][_0x650a('0x60')]||{}};_0x383fb3(null,_0x19b401);});};AGIVertices[_0x650a('0xd')]['googleDialogflow']=function(_0x16e596,_0xcf6cb3){scripts[_0x650a('0x6b')](this[_0x650a('0xb')][_0x650a('0x32')],_0x16e596[_0x650a('0x6c')],_0x16e596['text'],_0x16e596[_0x650a('0x6d')]||'en')[_0x650a('0xf')](function(_0x50c37f){_0xcf6cb3(null,_0x50c37f);})[_0x650a('0x14')](function(_0x462fc5){_0xcf6cb3(_0x462fc5);});};AGIVertices['prototype']['googleDialogflowV2']=function(_0x5dd509,_0x137bdd){scripts[_0x650a('0x6e')](this[_0x650a('0xb')]['uniqueid'],_0x5dd509[_0x650a('0x6f')],_0x5dd509[_0x650a('0x70')],_0x5dd509[_0x650a('0x71')],_0x5dd509[_0x650a('0x54')],_0x5dd509[_0x650a('0x72')]||'en')[_0x650a('0xf')](function(_0x512215){_0x137bdd(null,_0x512215);})[_0x650a('0x14')](function(_0x4446cc){_0x137bdd(_0x4446cc);});};AGIVertices['prototype'][_0x650a('0x73')]=function(_0x386855,_0x31ae04){scripts[_0x650a('0x73')](this[_0x650a('0xb')],_0x386855)[_0x650a('0xf')](function(_0x11dcf7){_0x31ae04(null,_0x11dcf7);})[_0x650a('0x14')](function(_0x3dc111){_0x31ae04(_0x3dc111);});};AGIVertices[_0x650a('0xd')]['ispeechTTS']=function(_0x4b72ad,_0x37ac7e){scripts[_0x650a('0x74')](_0x4b72ad['key'],_0x4b72ad[_0x650a('0x54')],_0x4b72ad[_0x650a('0x75')]||_0x650a('0x76'),_0x4b72ad[_0x650a('0x77')])[_0x650a('0xf')](function(_0x169cb5){_0x37ac7e(null,_0x169cb5);})[_0x650a('0x14')](function(_0x3afb4e){_0x37ac7e(_0x3afb4e);});};AGIVertices[_0x650a('0xd')][_0x650a('0x78')]=function(_0x503606,_0x1e98de,_0x3c2db8){scripts[_0x650a('0x78')](_0x1e98de,_0x503606[_0x650a('0x6c')],_0x503606['ispeech_asr_language']||_0x650a('0x76'),this[_0x650a('0x79')](_0x503606[_0x650a('0x7a')])?_0x503606[_0x650a('0x7a')]:undefined)[_0x650a('0xf')](function(_0x426b73){_0x3c2db8(null,_0x426b73);})[_0x650a('0x14')](function(_0x3e26a3){_0x3c2db8(_0x3e26a3);});};AGIVertices[_0x650a('0xd')][_0x650a('0x7b')]=function(_0x1a5184,_0x4bd72d){scripts[_0x650a('0x7b')](_0x1a5184[_0x650a('0x7c')],_0x1a5184[_0x650a('0x7d')],_0x1a5184[_0x650a('0x7e')],_0x1a5184['aws_polly_voice']||'Amy',_0x1a5184[_0x650a('0x54')],_0x1a5184[_0x650a('0x7f')]||_0x650a('0x54'))[_0x650a('0xf')](function(_0x25699a){_0x4bd72d(null,_0x25699a);})[_0x650a('0x14')](function(_0x2b2bab){_0x4bd72d(_0x2b2bab);});};AGIVertices[_0x650a('0xd')][_0x650a('0x80')]=function(_0x4727a8,_0x3796b9){scripts[_0x650a('0x80')](this[_0x650a('0xb')][_0x650a('0x32')],_0x4727a8[_0x650a('0x7c')],_0x4727a8[_0x650a('0x7d')],_0x4727a8[_0x650a('0x81')],_0x4727a8[_0x650a('0x54')],_0x4727a8[_0x650a('0x82')])[_0x650a('0xf')](function(_0x124efa){_0x3796b9(null,_0x124efa);})[_0x650a('0x14')](function(_0x5328c7){_0x3796b9(_0x5328c7);});};AGIVertices[_0x650a('0xd')][_0x650a('0x83')]=function(_0x2f47a4,_0x3c7b9b,_0x163546){scripts['googleASR'](_0x3c7b9b,_0x2f47a4[_0x650a('0x6c')],_0x2f47a4[_0x650a('0x84')]||_0x650a('0x76'))[_0x650a('0xf')](function(_0x29efd7){_0x163546(null,_0x29efd7);})[_0x650a('0x14')](function(_0x1ccc55){_0x163546(_0x1ccc55);});};AGIVertices[_0x650a('0xd')][_0x650a('0x85')]=function(_0x53165d,_0x2b1748,_0x515e2d){scripts[_0x650a('0x85')](_0x2b1748,_0x53165d[_0x650a('0x86')],_0x53165d[_0x650a('0x87')],_0x53165d[_0x650a('0x65')])[_0x650a('0xf')](function(_0x31b290){_0x515e2d(null,_0x31b290);})[_0x650a('0x14')](function(_0x5ecc82){_0x515e2d(_0x5ecc82);});};AGIVertices[_0x650a('0xd')][_0x650a('0x88')]=function(_0x3fd26d){var _0x365785=_['includes'](verticesWithRetry,_0x3fd26d[_0x650a('0x34')])?_0x3fd26d:_[_0x650a('0x89')](_0x3fd26d);for(var _0x5f4a82 in _0x365785){if(_0x365785['hasOwnProperty'](_0x5f4a82)){if(_0x365785[_0x5f4a82]&&_[_0x650a('0x8a')](_0x365785[_0x5f4a82])){if(_[_0x650a('0x8b')](recursiveMapAttributes,_0x5f4a82)){_0x365785[_0x5f4a82]=this[_0x650a('0x8c')](_0x365785[_0x5f4a82]);}else{_0x365785[_0x5f4a82]=this[_0x650a('0x8d')](_0x365785[_0x5f4a82]);}}}}return _0x365785;};AGIVertices[_0x650a('0xd')][_0x650a('0x8e')]=function(_0x5156fb){for(var _0x3ae258 in _0x5156fb){if(_0x5156fb[_0x650a('0x8f')](_0x3ae258)){if(_[_0x650a('0x90')](_0x5156fb[_0x3ae258])){this[_0x650a('0x8e')](_0x5156fb[_0x3ae258]);}else if(_[_0x650a('0x91')](_0x5156fb[_0x3ae258])){for(var _0xa2b7ff=0x0;_0xa2b7ff<_0x5156fb[_0x3ae258][_0x650a('0x92')];_0xa2b7ff++){this[_0x650a('0x8e')](_0x5156fb[_0x3ae258][_0xa2b7ff]);}}else if(_[_0x650a('0x8a')](_0x5156fb[_0x3ae258])){_0x5156fb[_0x3ae258]=this[_0x650a('0x8d')](_0x5156fb[_0x3ae258]);}}}};AGIVertices[_0x650a('0xd')][_0x650a('0x93')]=function(_0x427d30,_0x803cbe){for(var _0x51b828 in _0x427d30){if(_0x427d30[_0x650a('0x8f')](_0x51b828)){if(_[_0x650a('0x90')](_0x427d30[_0x51b828])){if(!_[_0x650a('0x3d')](_0x427d30[_0x51b828])){this[_0x650a('0x93')](_0x427d30[_0x51b828],util['format'](_0x650a('0x94'),_0x803cbe,_0x51b828));}}else if(_[_0x650a('0x91')](_0x427d30[_0x51b828])){for(var _0x322ae3=0x0;_0x322ae3<_0x427d30[_0x51b828][_0x650a('0x92')];_0x322ae3++){this[_0x650a('0x93')](_0x427d30[_0x51b828][_0x322ae3],util['format'](_0x650a('0x94'),_0x803cbe,_0x51b828+'['+_0x322ae3+']'));}}else{if(!_[_0x650a('0x3e')](_0x427d30[_0x51b828])){this['channel'][_0x650a('0x95')](util[_0x650a('0x25')](_0x650a('0x94'),_0x803cbe,_0x51b828),_0x427d30[_0x51b828]);}}}}};AGIVertices[_0x650a('0xd')][_0x650a('0x8c')]=function(_0x24e47e){try{var _0xf3cd89=JSON['parse'](_0x24e47e);this['recursiveNodeIndex'](_0xf3cd89);return JSON['stringify'](_0xf3cd89);}catch(_0x4e6b83){return this[_0x650a('0x8d')](_0x24e47e);}};AGIVertices[_0x650a('0xd')][_0x650a('0x8d')]=function(_0x4ae7be){var _0x5cd976=_0x4ae7be[_0x650a('0x96')]('{');for(var _0x3ea7e3=0x1;_0x3ea7e3<_0x5cd976['length'];_0x3ea7e3+=0x1){var _0x10b3eb=_0x5cd976[_0x3ea7e3][_0x650a('0x96')]('}');if(_0x10b3eb[_0x650a('0x92')]>0x1){_0x4ae7be=_0x4ae7be[_0x650a('0x97')]('{'+_0x10b3eb[0x0]+'}',this[_0x650a('0xb')][_0x650a('0x98')](_0x10b3eb[0x0])[_0x650a('0x99')]||_0x10b3eb[0x0]);}}if(_0x5cd976[_0x650a('0x92')]===0x1){return _0x4ae7be[_0x650a('0x46')]();}return this[_0x650a('0x8d')](_0x4ae7be);};AGIVertices[_0x650a('0xd')][_0x650a('0x9a')]=function(_0x2db800,_0x33f98c){var _0x7bf1d7=this[_0x650a('0xb')][_0x650a('0x98')](_0x2db800);if(_0x7bf1d7[_0x650a('0x9b')]===-0x1){return _0x7bf1d7;}logger[_0x650a('0x2c')](util[_0x650a('0x25')]('The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s',_0x33f98c,_0x7bf1d7['extra']));return this['channel'][_0x650a('0x95')](_0x33f98c,_0x7bf1d7[_0x650a('0x99')]);};AGIVertices[_0x650a('0xd')][_0x650a('0x79')]=function(_0x15d6b2){return _0x15d6b2&&_0x15d6b2!=='0'&&_0x15d6b2!=='-1'&&_0x15d6b2!=='';};AGIVertices['prototype'][_0x650a('0x9c')]=function(_0x32ce0c){this[_0x650a('0x9d')][_0x650a('0x64')](this,_0x32ce0c,'-');_0x32ce0c[_0x650a('0x9e')]=_0x32ce0c[_0x650a('0x9c')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x650a('0xd')][_0x650a('0x9f')]=function(_0x27aa3d){logger[_0x650a('0x2c')](util['format']('Enter\x20in\x20MRCPSynth\x20(%s)\x20block',_0x27aa3d[_0x650a('0x33')]));if(!this[_0x650a('0x79')](_0x27aa3d[_0x650a('0x54')])){return this[_0x650a('0xb')][_0x650a('0xa0')](_0x650a('0xa1'));}var _0x23cfd8='\x22'+_0x27aa3d['text']+'\x22';if(this[_0x650a('0x79')](_0x27aa3d[_0x650a('0x6a')])){_0x23cfd8+=','+_0x27aa3d[_0x650a('0x6a')];}var _0x51c7f6=this['channel']['exec']('MRCPSynth',_0x23cfd8);if(_0x51c7f6[_0x650a('0x9b')]===-0x1){return _0x51c7f6;}return this['channel']['noop'](util[_0x650a('0x25')](_0x650a('0xa2'),_0x23cfd8));};AGIVertices['prototype'][_0x650a('0xa3')]=function(_0x3c53d4){logger[_0x650a('0x2c')](util['format'](_0x650a('0xa4'),_0x3c53d4[_0x650a('0x33')]));if(!this[_0x650a('0x79')](_0x3c53d4[_0x650a('0xa5')])){return this['channel']['noop'](_0x650a('0xa6'));}var _0x2f083e=_0x3c53d4[_0x650a('0xa5')];if(this['isConfigured'](_0x3c53d4[_0x650a('0x6a')])){_0x2f083e+=','+_0x3c53d4[_0x650a('0x6a')];}var _0x286c54=this['channel']['exec'](_0x650a('0xa7'),_0x2f083e);if(_0x286c54[_0x650a('0x9b')]===-0x1){return _0x286c54;}var _0x40a316=this['getAndSetVariable']('RECOG_CONFIDENCE()',_0x650a('0xa8'));if(_0x40a316[_0x650a('0x9b')]===-0x1){return _0x40a316;}var _0x503514=this[_0x650a('0x9a')](_0x650a('0xa9'),'MRCP_RECOG_TRANSCRIPT');if(_0x503514[_0x650a('0x9b')]===-0x1){return _0x503514;}var _0x25f726=this[_0x650a('0x9a')](_0x650a('0xaa'),_0x650a('0xab'));if(_0x25f726[_0x650a('0x9b')]===-0x1){return _0x25f726;}return this['channel'][_0x650a('0xa0')](util[_0x650a('0x25')]('Executed\x20command\x20MRCPRecog\x20%s',_0x2f083e));};AGIVertices[_0x650a('0xd')]['agi']=function(_0x5b01da){logger[_0x650a('0x2c')](util['format']('Enter\x20in\x20AGI\x20(%s)\x20block',_0x5b01da['label']));return this[_0x650a('0xb')][_0x650a('0xac')]([_0x5b01da[_0x650a('0xad')],_0x5b01da['args']]);};AGIVertices[_0x650a('0xd')][_0x650a('0xae')]=function(_0x43f880){logger[_0x650a('0x2c')](util[_0x650a('0x25')]('Enter\x20in\x20ANSWER\x20(%s)\x20block',_0x43f880[_0x650a('0x33')]));if(this[_0x650a('0x79')](_0x43f880[_0x650a('0x5d')])){logger[_0x650a('0x2c')](util['format']('Wait\x20%s\x20seconds\x20before\x20answer',_0x43f880[_0x650a('0x5d')]));var _0x22881d=this[_0x650a('0xb')][_0x650a('0xaf')](_0x43f880[_0x650a('0x5d')]);if(_0x22881d[_0x650a('0x9b')]===-0x1){return _0x22881d;}}return this[_0x650a('0xb')][_0x650a('0xae')]();};AGIVertices[_0x650a('0xd')]['callback']=function(_0x4b627c){logger[_0x650a('0x2c')](util['format'](_0x650a('0xb0'),_0x4b627c[_0x650a('0x33')]));if(!this[_0x650a('0x79')](_0x4b627c[_0x650a('0x42')])){return this[_0x650a('0xb')][_0x650a('0x27')](_0x4b627c,'no\x20list\x20selected');}_0x4b627c[_0x650a('0x43')]=moment();if(this[_0x650a('0x79')](_0x4b627c[_0x650a('0xb1')])){_0x4b627c[_0x650a('0x43')]=moment()[_0x650a('0xb2')](_0x4b627c[_0x650a('0xb1')],'minutes');}if(!this['isConfigured'](_0x4b627c[_0x650a('0x47')])){_0x4b627c[_0x650a('0x47')]=0x2;}this['createCmContact']['sync'](this,_0x4b627c);return this[_0x650a('0xb')][_0x650a('0xa0')](util[_0x650a('0x25')](_0x650a('0xb3'),_0x4b627c[_0x650a('0xb4')],_0x4b627c[_0x650a('0x42')],_0x4b627c['scheduledAt']));};AGIVertices[_0x650a('0xd')][_0x650a('0xb5')]=function(_0x289d1a){logger[_0x650a('0x2c')](util[_0x650a('0x25')](_0x650a('0xb6'),_0x289d1a[_0x650a('0x33')]));var _0x229c5a=this['channel'][_0x650a('0xb7')](_0x289d1a[_0x650a('0xb8')],_0x289d1a[_0x650a('0x6a')]);if(_0x229c5a['result']===-0x1){return _0x229c5a;}return this[_0x650a('0xb')]['noop'](util[_0x650a('0x25')](_0x650a('0xb9'),_0x289d1a[_0x650a('0xb8')],_0x289d1a[_0x650a('0x6a')]));};AGIVertices[_0x650a('0xd')]['lumenvoxtts']=function(_0x3f7510){logger[_0x650a('0x2c')](util[_0x650a('0x25')](_0x650a('0xba'),_0x3f7510['label']));if(!this[_0x650a('0x79')](_0x3f7510[_0x650a('0x54')])){return this[_0x650a('0xb')][_0x650a('0xa0')](_0x650a('0xa1'));}var _0x599ac6='\x22'+_0x3f7510['text']+'\x22';if(this[_0x650a('0x79')](_0x3f7510[_0x650a('0x6a')])){_0x599ac6+=','+_0x3f7510[_0x650a('0x6a')];}var _0x55df06=this[_0x650a('0xb')][_0x650a('0xb7')](_0x650a('0xbb'),_0x599ac6);if(_0x55df06[_0x650a('0x9b')]===-0x1){return _0x55df06;}return this['channel'][_0x650a('0xa0')](util['format'](_0x650a('0xa2'),_0x599ac6));};AGIVertices[_0x650a('0xd')][_0x650a('0xbc')]=function(_0x504115){logger[_0x650a('0x2c')](util[_0x650a('0x25')]('Enter\x20in\x20SESTEKTTS\x20(%s)\x20block',_0x504115[_0x650a('0x33')]));if(!this['isConfigured'](_0x504115[_0x650a('0x54')])){return this[_0x650a('0xb')]['noop'](_0x650a('0xa1'));}var _0x519b65='\x22'+_0x504115[_0x650a('0x54')]+'\x22';if(this['isConfigured'](_0x504115[_0x650a('0x6a')])){_0x519b65+=','+_0x504115[_0x650a('0x6a')];}var _0x184c2a=this[_0x650a('0xb')][_0x650a('0xb7')](_0x650a('0xbb'),_0x519b65);if(_0x184c2a['result']===-0x1){return _0x184c2a;}return this[_0x650a('0xb')]['noop'](util['format']('Executed\x20command\x20MRCPSynth\x20%s',_0x519b65));};AGIVertices[_0x650a('0xd')][_0x650a('0xbd')]=function(_0x107e02){logger[_0x650a('0x2c')](util['format'](_0x650a('0xbe'),_0x107e02[_0x650a('0x33')]));if(!this[_0x650a('0x79')](_0x107e02[_0x650a('0xa5')])){return this[_0x650a('0xb')][_0x650a('0xa0')](_0x650a('0xa6'));}var _0x2a0153=_0x107e02['grammar'];if(this[_0x650a('0x79')](_0x107e02[_0x650a('0x6a')])){_0x2a0153+=','+_0x107e02['options'];}var _0xcb96e6=this[_0x650a('0xb')][_0x650a('0xb7')](_0x650a('0xa7'),_0x2a0153);if(_0xcb96e6[_0x650a('0x9b')]===-0x1){return _0xcb96e6;}var _0x36c061=this[_0x650a('0x9a')](_0x650a('0xbf'),_0x650a('0xc0'));if(_0x36c061['result']===-0x1){return _0x36c061;}var _0x10c476=this[_0x650a('0x9a')](_0x650a('0xa9'),_0x650a('0xc1'));if(_0x10c476[_0x650a('0x9b')]===-0x1){return _0x10c476;}var _0x2637f2=this[_0x650a('0x9a')]('RECOG_INSTANCE()',_0x650a('0xc2'));if(_0x2637f2[_0x650a('0x9b')]===-0x1){return _0x2637f2;}return this[_0x650a('0xb')][_0x650a('0xa0')](util[_0x650a('0x25')](_0x650a('0xc3'),_0x2a0153));};AGIVertices['prototype'][_0x650a('0xc4')]=function(_0x50af9c){logger['info'](util[_0x650a('0x25')](_0x650a('0xc5'),_0x50af9c[_0x650a('0x33')]));if(!this['isConfigured'](_0x50af9c[_0x650a('0xa5')])){return this[_0x650a('0xb')][_0x650a('0xa0')](_0x650a('0xa6'));}var _0x4d8500=_0x50af9c[_0x650a('0xa5')];if(this[_0x650a('0x79')](_0x50af9c[_0x650a('0x6a')])){_0x4d8500+=','+_0x50af9c[_0x650a('0x6a')];}var _0x54e633=this[_0x650a('0xb')][_0x650a('0xb7')](_0x650a('0xa7'),_0x4d8500);if(_0x54e633[_0x650a('0x9b')]===-0x1){return _0x54e633;}var _0xdc37c9=this[_0x650a('0x9a')](_0x650a('0xbf'),_0x650a('0xc6'));if(_0xdc37c9['result']===-0x1){return _0xdc37c9;}var _0xa2e01a=this['getAndSetVariable'](_0x650a('0xa9'),'SESTEK_ASR_TRANSCRIPT');if(_0xa2e01a[_0x650a('0x9b')]===-0x1){return _0xa2e01a;}var _0x33ae16=this[_0x650a('0x9a')](_0x650a('0xaa'),_0x650a('0xc7'));if(_0x33ae16[_0x650a('0x9b')]===-0x1){return _0x33ae16;}return this['channel'][_0x650a('0xa0')](util[_0x650a('0x25')](_0x650a('0xc3'),_0x4d8500));};AGIVertices['prototype'][_0x650a('0xc8')]=function(_0x243525){logger[_0x650a('0x2c')](util['format']('Enter\x20in\x20DATABASE\x20(%s)\x20block',_0x243525[_0x650a('0x33')]));if(!this[_0x650a('0x79')](_0x243525[_0x650a('0xc9')])){return this[_0x650a('0xb')][_0x650a('0x27')](_0x243525,'no\x20database\x20selected');}var _0x42af9b=this[_0x650a('0x15')][_0x650a('0x64')](this,_0x243525[_0x650a('0xc9')]);if(!_0x42af9b){return this[_0x650a('0xb')][_0x650a('0x27')](_0x243525,_0x650a('0xca'));}if(!this[_0x650a('0x79')](_0x243525[_0x650a('0x2a')])){return this[_0x650a('0xb')]['error'](_0x243525,_0x650a('0xcb'));}var _0x3aee44=_0x243525[_0x650a('0x2a')][_0x650a('0x52')](/(\r\n|\n|\r)/gm,'\x20');this[_0x650a('0xb')][_0x650a('0xa0')](util[_0x650a('0x25')](_0x650a('0xcc'),_0x3aee44));var _0x2520dc=this[_0x650a('0x26')][_0x650a('0x64')](this,_0x42af9b,_0x3aee44);this[_0x650a('0x9d')][_0x650a('0x64')](this,_0x243525,_0x3aee44);if(!this['isConfigured'](_0x243525['variable_id'])){return this[_0x650a('0xb')]['noop']('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x1010b1=this[_0x650a('0x98')][_0x650a('0x64')](this,_0x243525[_0x650a('0xcd')]);if(!_0x1010b1){return this['channel']['error'](_0x243525,_0x650a('0xce'));}var _0x248ffe=this;_0x2520dc[_0x650a('0xcf')](function(_0x1ead66,_0x4b8d39){Object[_0x650a('0xd0')](_0x1ead66)[_0x650a('0xcf')](function(_0x147a90){_0x248ffe[_0x650a('0xb')]['setVariable'](util[_0x650a('0x25')]('%s[%s][%s]',_0x1010b1,_0x4b8d39,_0x147a90),_0x1ead66[_0x147a90]);});});this[_0x650a('0xb')][_0x650a('0x95')](util[_0x650a('0x25')](_0x650a('0xd1'),_0x1010b1),_0x2520dc[_0x650a('0x92')]);return this[_0x650a('0xb')][_0x650a('0xa0')](util[_0x650a('0x25')]('variable\x20%s\x20set',_0x1010b1));};AGIVertices[_0x650a('0xd')]['dial']=function(_0x35c85f){logger[_0x650a('0xd2')](util[_0x650a('0x25')](_0x650a('0xd3'),_0x35c85f[_0x650a('0x33')]));if(!this['isConfigured'](_0x35c85f[_0x650a('0xd4')])){return this[_0x650a('0xb')]['error'](_0x35c85f,'no\x20user\x20selected');}var _0x5cce04=this[_0x650a('0x18')]['sync'](this,_0x35c85f[_0x650a('0xd4')]);if(!_0x5cce04){return this['channel'][_0x650a('0x27')](_0x35c85f,_0x650a('0xd5'));}var _0x13ee06=this[_0x650a('0xb')]['exec'](_0x650a('0xd6'),[util[_0x650a('0x25')](_0x650a('0xd7'),_0x5cce04),_0x35c85f['timeout'],_0x35c85f['opts'],_0x35c85f['url']]);if(_0x13ee06[_0x650a('0x9b')]===-0x1){return _0x13ee06;}return this[_0x650a('0xb')]['noop'](util[_0x650a('0x25')](_0x650a('0xd8'),'DIAL'));};AGIVertices['prototype'][_0x650a('0xd9')]=function(_0x4c6cb3){logger[_0x650a('0x2c')](util[_0x650a('0x25')](_0x650a('0xda'),_0x4c6cb3[_0x650a('0x33')]));if(!this[_0x650a('0x79')](_0x4c6cb3[_0x650a('0x6c')])){return this[_0x650a('0xb')][_0x650a('0xa0')](_0x650a('0xdb'));}if(!this[_0x650a('0x79')](_0x4c6cb3[_0x650a('0x54')])){return this['channel'][_0x650a('0xa0')](_0x650a('0xa1'));}this[_0x650a('0xb')][_0x650a('0xdc')]=!![];this['createSquareDetailsReport'](_0x4c6cb3);this[_0x650a('0xdd')](_0x4c6cb3[_0x650a('0x54')],'in','','');this['channel'][_0x650a('0xa0')](util[_0x650a('0x25')](_0x650a('0xde'),_0x4c6cb3[_0x650a('0x54')]));var _0x4d7610=this[_0x650a('0x6b')][_0x650a('0x64')](this,_0x4c6cb3);if(_0x4d7610){for(var _0x40ef90 in _0x4d7610){if(_0x4d7610[_0x650a('0x8f')](_0x40ef90)){this[_0x650a('0xb')][_0x650a('0x95')](util[_0x650a('0x25')]('DIALOGFLOW_%s',_0x40ef90[_0x650a('0xdf')]()),_0x4d7610[_0x40ef90]);}}this[_0x650a('0xdd')](_0x4d7610[_0x650a('0xe0')],_0x650a('0xe1'),_0x650a('0xd9'),'');return this[_0x650a('0xb')][_0x650a('0xa0')](util[_0x650a('0x25')]('Dialogflow\x20Result\x20%s',_0x4d7610[_0x650a('0xe0')]));}return this[_0x650a('0xb')][_0x650a('0x27')](_0x4c6cb3,_0x650a('0xe2'));};AGIVertices[_0x650a('0xd')]['dialogflowV2']=function(_0xe3cd6b){logger['info'](util[_0x650a('0x25')](_0x650a('0xe3'),_0xe3cd6b[_0x650a('0x33')]));if(!this[_0x650a('0x79')](_0xe3cd6b['dialogflowV2_project_id'])){return this['channel'][_0x650a('0xa0')](_0x650a('0xe4'));}if(!this['isConfigured'](_0xe3cd6b[_0x650a('0x70')])){return this[_0x650a('0xb')][_0x650a('0xa0')]('no\x20client_email\x20configured');}if(!this[_0x650a('0x79')](_0xe3cd6b[_0x650a('0x71')])){return this[_0x650a('0xb')][_0x650a('0xa0')](_0x650a('0xe5'));}if(!this[_0x650a('0x79')](_0xe3cd6b[_0x650a('0x72')])){return this[_0x650a('0xb')][_0x650a('0xa0')](_0x650a('0xe6'));}if(!this[_0x650a('0x79')](_0xe3cd6b[_0x650a('0x54')])){return this[_0x650a('0xb')][_0x650a('0xa0')](_0x650a('0xa1'));}this[_0x650a('0xb')][_0x650a('0xdc')]=!![];this[_0x650a('0x9d')](_0xe3cd6b);this[_0x650a('0xdd')](_0xe3cd6b[_0x650a('0x54')],'in','','');this['channel'][_0x650a('0xa0')](util['format'](_0x650a('0xe7'),_0xe3cd6b[_0x650a('0x54')]));var _0x4a6eff=this[_0x650a('0x6e')][_0x650a('0x64')](this,_0xe3cd6b);if(_0x4a6eff){for(var _0x9f68e6 in _0x4a6eff){if(_0x4a6eff[_0x650a('0x8f')](_0x9f68e6)){if(_0x9f68e6!==_0x650a('0xe8')){this[_0x650a('0xb')]['setVariable'](util[_0x650a('0x25')](_0x650a('0xe9'),_0x9f68e6['toUpperCase']()),_0x4a6eff[_0x9f68e6]);}}}this[_0x650a('0xdd')](_0x4a6eff[_0x650a('0xe0')],_0x650a('0xe1'),_0x650a('0xea'),_0x4a6eff[_0x650a('0xe8')]);return this[_0x650a('0xb')][_0x650a('0xa0')](util[_0x650a('0x25')](_0x650a('0xeb'),_0x4a6eff[_0x650a('0xe0')]));}return this[_0x650a('0xb')][_0x650a('0x27')](_0xe3cd6b,_0x650a('0xec'));};AGIVertices[_0x650a('0xd')][_0x650a('0xed')]=function(_0x5d52f1){logger[_0x650a('0x2c')](util[_0x650a('0x25')](_0x650a('0xee'),_0x5d52f1[_0x650a('0x33')]));if(!this[_0x650a('0x79')](_0x5d52f1['ndauth_url'])){return this['channel'][_0x650a('0xa0')](_0x650a('0xef'));}if(!this[_0x650a('0x79')](_0x5d52f1[_0x650a('0xf0')])){return this[_0x650a('0xb')][_0x650a('0xa0')]('no\x20username\x20configured');}if(!this[_0x650a('0x79')](_0x5d52f1[_0x650a('0xf1')])){return this['channel'][_0x650a('0xa0')](_0x650a('0xf2'));}if(!this['isConfigured'](_0x5d52f1['ndassistant_url'])){return this[_0x650a('0xb')]['noop']('no\x20text\x20configured');}this[_0x650a('0xb')]['bot']=!![];this[_0x650a('0x9d')](_0x5d52f1);this[_0x650a('0xdd')](_0x5d52f1['text'],'in','','');this[_0x650a('0xb')][_0x650a('0xa0')](util[_0x650a('0x25')]('Trying\x20SestekNDA:\x20%s',_0x5d52f1[_0x650a('0x54')]));var _0x5380ce=this[_0x650a('0x73')]['sync'](this,_0x5d52f1);if(_0x5380ce){for(var _0xea8c37 in _0x5380ce){if(_0x5380ce[_0x650a('0x8f')](_0xea8c37)){this[_0x650a('0xb')][_0x650a('0x95')](util[_0x650a('0x25')](_0x650a('0xf3'),_0xea8c37[_0x650a('0xdf')]()),_0x5380ce[_0xea8c37]);}}this[_0x650a('0xdd')](_0x5380ce[_0x650a('0xe0')],_0x650a('0xe1'),_0x650a('0xed'),'');if(_0x5380ce['audiofile']){this[_0x650a('0xb')][_0x650a('0xa0')](util[_0x650a('0x25')](_0x650a('0xf4'),_0x5380ce[_0x650a('0xf5')]));var _0x1c6538=this['channel'][_0x650a('0xf6')](_0x5380ce[_0x650a('0xf5')]);try{fs[_0x650a('0xf7')](_0x5380ce[_0x650a('0xf5')]+_0x650a('0xf8'));}catch(_0x20704){logger[_0x650a('0x27')](_0x20704);}return _0x1c6538;}else{return this[_0x650a('0xb')]['noop'](util[_0x650a('0x25')](_0x650a('0xf9'),_0x5380ce[_0x650a('0xe0')]));}}return this[_0x650a('0xb')][_0x650a('0x27')](_0x5d52f1,_0x650a('0xfa'));};AGIVertices[_0x650a('0xd')][_0x650a('0xfb')]=function(_0x2516f7){logger[_0x650a('0x2c')](util[_0x650a('0x25')](_0x650a('0xfc'),_0x2516f7[_0x650a('0x33')]));return this[_0x650a('0xb')][_0x650a('0xa0')]('end');};AGIVertices[_0x650a('0xd')][_0x650a('0xfd')]=function(_0xe37ced){logger[_0x650a('0x2c')](util[_0x650a('0x25')](_0x650a('0xfe'),_0xe37ced[_0x650a('0x33')]));var _0x25eb8d='';if(_0xe37ced[_0x650a('0xff')]){if(!this[_0x650a('0x79')](_0xe37ced[_0x650a('0xff')])){return this['channel'][_0x650a('0x27')](_0xe37ced,'no\x20trunk\x20selected');}else{var _0x507823=parseInt(_0xe37ced['trunk_id'],0xa);if(isNaN(_0x507823)){_0x25eb8d=_0xe37ced['trunk_id'];}else{_0x25eb8d=this[_0x650a('0x1a')][_0x650a('0x64')](this,_0xe37ced['trunk_id']);if(!_0x25eb8d){return this['channel']['error'](_0xe37ced,_0x650a('0x100'));}}}}else if(_0xe37ced[_0x650a('0x101')]){_0x25eb8d=_0xe37ced[_0x650a('0x101')];}else{return this[_0x650a('0xb')][_0x650a('0x27')](_0xe37ced,_0x650a('0x102'));}var _0x4bda04=this[_0x650a('0xb')]['exec']('DIAL',[util['format'](_0x650a('0x103'),_0x25eb8d,_0xe37ced[_0x650a('0xb4')]),_0xe37ced[_0x650a('0x5d')],_0xe37ced[_0x650a('0x104')],_0xe37ced[_0x650a('0x5c')]]);if(_0x4bda04['result']===-0x1){return _0x4bda04;}return this[_0x650a('0xb')][_0x650a('0xa0')](util[_0x650a('0x25')](_0x650a('0xd8'),_0x650a('0xd6')));};AGIVertices[_0x650a('0xd')][_0x650a('0x105')]=function(_0x1fca0e){logger[_0x650a('0x2c')](util[_0x650a('0x25')]('Enter\x20in\x20FINALLY\x20(%s)\x20block',_0x1fca0e[_0x650a('0x33')]));return this['channel'][_0x650a('0xa0')](_0x650a('0x105'));};AGIVertices[_0x650a('0xd')][_0x650a('0xa')]=function(_0x4e9207){logger[_0x650a('0x2c')](util[_0x650a('0x25')](_0x650a('0x106'),_0x4e9207['label']));if(_0x4e9207[_0x650a('0x9e')]===0x0){return this[_0x650a('0x9c')](_0x4e9207);}_0x4e9207[_0x650a('0x9e')]-=0x1;if(!this['isConfigured'](_0x4e9207['file_id'])){return this[_0x650a('0xb')]['error'](_0x4e9207,'no\x20file\x20audio\x20selected');}var _0x429f29=this[_0x650a('0x1c')]['sync'](this,_0x4e9207[_0x650a('0x107')]);if(!_0x429f29){return this[_0x650a('0xb')][_0x650a('0x27')](_0x4e9207,_0x650a('0x108'));}if(!this[_0x650a('0x79')](_0x4e9207[_0x650a('0xcd')])){return this[_0x650a('0xb')]['error'](_0x650a('0x109'));}var _0x34f1ef=this[_0x650a('0xb')]['getData'](_0x429f29,_0x4e9207['response'],_0x4e9207['maxdigit']);var _0x42979a=_0x34f1ef[_0x650a('0x9b')]?_0x34f1ef[_0x650a('0x9b')][_0x650a('0x46')]():'';logger[_0x650a('0x2c')](_0x650a('0x10a'),JSON[_0x650a('0x10b')](_0x34f1ef));if(_0x34f1ef['result']===-0x1){this[_0x650a('0x9d')][_0x650a('0x64')](this,_0x4e9207,_0x42979a);return _0x34f1ef;}else if(_0x34f1ef[_0x650a('0x99')]===_0x650a('0x5d')){_0x34f1ef[_0x650a('0x9b')]=_0x42979a[_0x650a('0x92')]>=parseInt(_0x4e9207['mindigit'])?'x':'i';}else{_0x34f1ef[_0x650a('0x9b')]=_0x42979a['length']>=parseInt(_0x4e9207[_0x650a('0x10c')])&&_0x42979a[_0x650a('0x92')]<=parseInt(_0x4e9207['maxdigit'])?'x':'i';}var _0x1ffc57=this[_0x650a('0x98')][_0x650a('0x64')](this,_0x4e9207[_0x650a('0xcd')]);if(!_0x1ffc57){return this['channel'][_0x650a('0x27')](_0x4e9207,_0x650a('0xce'));}this[_0x650a('0xb')][_0x650a('0x95')](_0x1ffc57,_0x42979a);if(this['isConfigured'](_0x4e9207[_0x650a('0x10d')])){var _0x349ddc=parseInt(_0x4e9207[_0x650a('0x10d')],0xa);var _0x42d80c=rs['generate']({'charset':'*','length':_0x349ddc});var _0x5d7090=_0x42979a[_0x650a('0x92')];if(_0x5d7090>0x0){if(_0x5d7090>_0x349ddc){this[_0x650a('0x9d')]['sync'](this,_0x4e9207,_0x4e9207[_0x650a('0x10e')]===_0x650a('0x10f')?_0x42d80c+_0x42979a[_0x650a('0x110')](_0x349ddc):_0x42979a['substr'](0x0,_0x5d7090-_0x349ddc)+_0x42d80c);}else{this[_0x650a('0x9d')][_0x650a('0x64')](this,_0x4e9207,rs[_0x650a('0x111')]({'charset':'*','length':_0x5d7090}));}}else{this['createSquareDetailsReport'][_0x650a('0x64')](this,_0x4e9207,'');}}else{this[_0x650a('0x9d')][_0x650a('0x64')](this,_0x4e9207,_0x42979a);}return _0x34f1ef;};AGIVertices[_0x650a('0xd')][_0x650a('0x112')]=function(_0x39cb29){logger[_0x650a('0x2c')](util[_0x650a('0x25')](_0x650a('0x113'),_0x39cb29['label']));return this[_0x650a('0xa')](_0x39cb29);};AGIVertices[_0x650a('0xd')]['goal']=function(_0x253a58){logger[_0x650a('0x2c')](util[_0x650a('0x25')](_0x650a('0x114'),_0x253a58['label']));this['createSquareDetailsReport'][_0x650a('0x64')](this,_0x253a58,_0x253a58[_0x650a('0x115')]);return this['channel'][_0x650a('0xa0')](util['format'](_0x650a('0x116'),_0x253a58[_0x650a('0x115')]));};AGIVertices[_0x650a('0xd')]['awspolly']=function(_0x358bb4){logger[_0x650a('0x2c')](util[_0x650a('0x25')](_0x650a('0x117'),_0x358bb4[_0x650a('0x33')]));if(!this[_0x650a('0x79')](_0x358bb4[_0x650a('0x7c')])||!this[_0x650a('0x79')](_0x358bb4['aws_secret_access_key'])){return this['channel'][_0x650a('0xa0')](_0x650a('0x118'));}if(!this[_0x650a('0x79')](_0x358bb4[_0x650a('0x54')])){return this[_0x650a('0xb')][_0x650a('0xa0')](_0x650a('0xa1'));}this['channel'][_0x650a('0xa0')](util[_0x650a('0x25')](_0x650a('0x119'),_0x358bb4[_0x650a('0x54')]));var _0x33ab6e=this['awsPolly'][_0x650a('0x64')](this,_0x358bb4);if(_0x33ab6e){this[_0x650a('0xb')][_0x650a('0xa0')](util[_0x650a('0x25')]('aws\x20Polly\x20%s\x20file\x20created',_0x33ab6e));var _0x593eaf=this['channel'][_0x650a('0xf6')](_0x33ab6e);try{fs['unlink'](_0x33ab6e+_0x650a('0xf8'));}catch(_0xcf5266){logger[_0x650a('0x27')](_0xcf5266);}return _0x593eaf;}return this[_0x650a('0xb')]['error'](_0x358bb4,'aws\x20Polly\x20is\x20unreachable');};AGIVertices[_0x650a('0xd')]['awslex']=function(_0x23e9d6){logger[_0x650a('0x2c')](util[_0x650a('0x25')](_0x650a('0x11a'),_0x23e9d6['label']));if(!this['isConfigured'](_0x23e9d6['aws_access_key_id'])||!this[_0x650a('0x79')](_0x23e9d6[_0x650a('0x7d')])){return this[_0x650a('0xb')]['noop']('no\x20valid\x20credentials\x20configured');}if(!this[_0x650a('0x79')](_0x23e9d6[_0x650a('0x82')])){return this[_0x650a('0xb')][_0x650a('0xa0')](_0x650a('0x11b'));}if(!this[_0x650a('0x79')](_0x23e9d6['text'])){return this['channel'][_0x650a('0xa0')](_0x650a('0xa1'));}this['channel'][_0x650a('0xdc')]=!![];this['createSquareDetailsReport'](_0x23e9d6);this['createSquareMessage'](_0x23e9d6[_0x650a('0x54')],'in','','');this[_0x650a('0xb')][_0x650a('0xa0')](util[_0x650a('0x25')](_0x650a('0x11c'),_0x23e9d6[_0x650a('0x54')]));var _0x48c31a=this[_0x650a('0x80')][_0x650a('0x64')](this,_0x23e9d6);if(_0x48c31a){for(var _0x3e23b4 in _0x48c31a){if(_0x48c31a['hasOwnProperty'](_0x3e23b4)&&_[_0x650a('0x8a')](_0x48c31a[_0x3e23b4])){this[_0x650a('0xb')][_0x650a('0x95')](util[_0x650a('0x25')](_0x650a('0x11d'),_0x3e23b4[_0x650a('0xdf')]()),_0x48c31a[_0x3e23b4]);}}if(_[_0x650a('0x3e')](_0x48c31a[_0x650a('0x11e')])){return this['channel'][_0x650a('0xa0')](_0x650a('0x11f'));}else{this['createSquareMessage'](_0x48c31a['message'],_0x650a('0xe1'),_0x650a('0x120'),'');return this[_0x650a('0xb')][_0x650a('0xa0')](util['format'](_0x650a('0x121'),_0x48c31a[_0x650a('0x11e')]));}}return this[_0x650a('0xb')]['error'](_0x23e9d6,'Amazon\x20Lex\x20is\x20unreachable');};AGIVertices[_0x650a('0xd')][_0x650a('0x122')]=function(_0x20f2a2){logger[_0x650a('0x2c')](util[_0x650a('0x25')](_0x650a('0x123'),_0x20f2a2['label'],_0x20f2a2[_0x650a('0x5d')]));if(!this[_0x650a('0x79')](_0x20f2a2[_0x650a('0x6c')])){return this[_0x650a('0xb')][_0x650a('0xa0')](_0x650a('0xdb'));}var _0x1ad6c2=_0x650a('0x124');var _0x36227a=util[_0x650a('0x25')]('%s/recordings/%s',FILES_PATH,rs[_0x650a('0x111')](0x4));var _0x1e0f5d=util[_0x650a('0x25')](_0x650a('0x94'),_0x36227a,_0x1ad6c2);var _0x10fa46=!![];if(_0x20f2a2[_0x650a('0x125')]===_0x650a('0x126')){_0x10fa46=![];}var _0x561a0f=this['channel']['recordFile'](_0x36227a,_0x1ad6c2,_0x20f2a2[_0x650a('0x127')],_0x20f2a2[_0x650a('0x5d')],undefined,_0x10fa46);if(_0x561a0f[_0x650a('0x9b')]!==-0x1){this[_0x650a('0xb')]['noop'](util[_0x650a('0x25')]('google\x20%s\x20file\x20created',_0x1e0f5d));var _0x3bb844=this[_0x650a('0x83')][_0x650a('0x64')](this,_0x20f2a2,_0x1e0f5d);if(_0x3bb844){for(var _0x302be2 in _0x3bb844){if(_0x3bb844[_0x650a('0x8f')](_0x302be2)){this[_0x650a('0xb')]['setVariable'](util['format'](_0x650a('0x128'),_0x302be2['toUpperCase']()),_0x3bb844[_0x302be2]);}}return this['channel'][_0x650a('0xa0')](util[_0x650a('0x25')]('GoogleASR\x20Result\x20%s',JSON[_0x650a('0x10b')](_0x3bb844)));}}return _0x561a0f;};AGIVertices[_0x650a('0xd')][_0x650a('0x129')]=function(_0xc4d5be){logger[_0x650a('0x2c')](util[_0x650a('0x25')](_0x650a('0x12a'),_0xc4d5be[_0x650a('0x33')]));if(!this[_0x650a('0x79')](_0xc4d5be['appid'])){return this[_0x650a('0xb')][_0x650a('0xa0')]('no\x20appid\x20configured');}if(!this[_0x650a('0x79')](_0xc4d5be[_0x650a('0x87')])){return this[_0x650a('0xb')][_0x650a('0xa0')](_0x650a('0x12b'));}var _0x51c6af=_0x650a('0x124');var _0x42cc19=util['format']('%s/recordings/%s',FILES_PATH,rs[_0x650a('0x111')](0x4));var _0x1961a6=util[_0x650a('0x25')](_0x650a('0x94'),_0x42cc19,_0x51c6af);var _0x4fcb32=!![];if(_0xc4d5be[_0x650a('0x125')]===_0x650a('0x126')){_0x4fcb32=![];}var _0x56978e=this['channel'][_0x650a('0x12c')](_0x42cc19,_0x51c6af,_0xc4d5be[_0x650a('0x127')],_0xc4d5be['timeout'],undefined,_0x4fcb32);if(_0x56978e[_0x650a('0x9b')]!==-0x1){this[_0x650a('0xb')][_0x650a('0xa0')](util[_0x650a('0x25')](_0x650a('0x12d'),_0x1961a6));var _0x1b5161=this[_0x650a('0x85')][_0x650a('0x64')](this,_0xc4d5be,_0x1961a6);if(_0x1b5161){for(var _0x42931e in _0x1b5161){if(_0x1b5161[_0x650a('0x8f')](_0x42931e)){this[_0x650a('0xb')][_0x650a('0x95')](util['format'](_0x650a('0x12e'),_0x42931e[_0x650a('0xdf')]()),_0x1b5161[_0x42931e]);}}return this[_0x650a('0xb')]['noop'](util[_0x650a('0x25')]('TildeASR\x20Result\x20%s',JSON[_0x650a('0x10b')](_0x1b5161)));}}return _0x56978e;};AGIVertices[_0x650a('0xd')]['gotoc']=function(_0x249629){logger[_0x650a('0x2c')](util[_0x650a('0x25')](_0x650a('0x12f'),_0x249629[_0x650a('0x33')]));return this[_0x650a('0xb')][_0x650a('0x130')](_0x249629[_0x650a('0x131')],_0x249629[_0x650a('0x39')],_0x249629[_0x650a('0x132')]);};AGIVertices['prototype'][_0x650a('0x133')]=function(_0x126732){logger[_0x650a('0x2c')](util[_0x650a('0x25')](_0x650a('0x134'),_0x126732[_0x650a('0x33')]));if(!this[_0x650a('0x79')](_0x126732['condition'])){return this[_0x650a('0xb')][_0x650a('0x27')](_0x126732,'no\x20condition\x20configured');}try{var _0x4c744a=eval(_0x126732[_0x650a('0x135')])?_0x650a('0x136'):_0x650a('0x137');this[_0x650a('0xb')][_0x650a('0xa0')](util[_0x650a('0x25')](_0x650a('0x138'),_0x126732[_0x650a('0x135')],_0x4c744a));return{'code':0xc8,'result':_0x4c744a};}catch(_0x450418){return{'code':0xc8,'result':'false'};}};AGIVertices[_0x650a('0xd')]['gotoiftime']=function(_0x3ace24){logger[_0x650a('0x2c')](util[_0x650a('0x25')](_0x650a('0x139'),_0x3ace24['label']));if(!this[_0x650a('0x79')](_0x3ace24['interval_id'])){return this[_0x650a('0xb')][_0x650a('0x27')](_0x3ace24,_0x650a('0x13a'));}var _0xe313af=this[_0x650a('0x13b')][_0x650a('0x64')](this,_0x3ace24[_0x650a('0x13c')]);if(!_0xe313af){return this[_0x650a('0xb')][_0x650a('0x27')](_0x3ace24,_0x650a('0x13d'));}for(var _0x22c12d=0x0;_0x22c12d<_0xe313af[_0x650a('0x92')];_0x22c12d+=0x1){var _0x4be87e=this[_0x650a('0xb')][_0x650a('0x98')](util[_0x650a('0x25')](_0x650a('0x13e'),_0xe313af[_0x22c12d]));if(_0x4be87e['result']===-0x1){return _0x4be87e;}logger[_0x650a('0x2c')](util[_0x650a('0x25')]('IFTIME\x20%s\x20%s',_0xe313af[_0x22c12d],_0x4be87e[_0x650a('0x99')]));if(_0x4be87e[_0x650a('0x99')]===_0x650a('0x136')){logger[_0x650a('0x2c')](util['format'](_0x650a('0x13f'),_0xe313af[_0x22c12d],_0x650a('0x136')));this['channel'][_0x650a('0xa0')](util['format']('IFTIME\x20%s\x20%s',_0xe313af[_0x22c12d],_0x650a('0x136')));return{'code':0xc8,'result':'true'};}else{logger[_0x650a('0x2c')](util[_0x650a('0x25')](_0x650a('0x13f'),_0xe313af[_0x22c12d],_0x650a('0x137')));this['channel'][_0x650a('0xa0')](util[_0x650a('0x25')](_0x650a('0x13f'),_0xe313af[_0x22c12d],_0x650a('0x137')));}}return{'code':0xc8,'result':_0x650a('0x137')};};AGIVertices[_0x650a('0xd')][_0x650a('0x140')]=function(_0x271c32){logger['info'](util[_0x650a('0x25')](_0x650a('0x141'),_0x271c32['label']));return this[_0x650a('0xb')]['hangup']();};AGIVertices['prototype'][_0x650a('0x142')]=function(_0x48eea2){logger[_0x650a('0x2c')](util[_0x650a('0x25')](_0x650a('0x143'),_0x48eea2[_0x650a('0x33')]));if(!this['isConfigured'](_0x48eea2['key'])){return this[_0x650a('0xb')][_0x650a('0xa0')](_0x650a('0xdb'));}var _0x445e0c=_0x650a('0x124');var _0x56614c=util[_0x650a('0x25')](_0x650a('0x144'),FILES_PATH,rs[_0x650a('0x111')](0x4));var _0x4a9890=util[_0x650a('0x25')]('%s.%s',_0x56614c,_0x445e0c);var _0x225b1e=!![];if(_0x48eea2[_0x650a('0x125')]===_0x650a('0x126')){_0x225b1e=![];}var _0x3be754=this[_0x650a('0xb')]['recordFile'](_0x56614c,_0x445e0c,_0x48eea2[_0x650a('0x127')],_0x48eea2[_0x650a('0x5d')],undefined,_0x225b1e);if(_0x3be754['result']!==-0x1){this[_0x650a('0xb')]['noop'](util[_0x650a('0x25')](_0x650a('0x145'),_0x4a9890));var _0x5aa80e=this[_0x650a('0x78')]['sync'](this,_0x48eea2,_0x4a9890);if(_0x5aa80e){for(var _0x2d3e4b in _0x5aa80e){if(_0x5aa80e[_0x650a('0x8f')](_0x2d3e4b)){this[_0x650a('0xb')][_0x650a('0x95')](util['format'](_0x650a('0x146'),_0x2d3e4b[_0x650a('0xdf')]()),_0x5aa80e[_0x2d3e4b]);}}return this[_0x650a('0xb')][_0x650a('0xa0')](util[_0x650a('0x25')]('IspeechASR\x20Result\x20%s',JSON['stringify'](_0x5aa80e)));}}return _0x3be754;};AGIVertices[_0x650a('0xd')][_0x650a('0x147')]=function(_0xd7a0c5){logger[_0x650a('0x2c')](util[_0x650a('0x25')](_0x650a('0x148'),_0xd7a0c5[_0x650a('0x33')]));if(!this['isConfigured'](_0xd7a0c5[_0x650a('0x6c')])){return this[_0x650a('0xb')][_0x650a('0xa0')]('no\x20key\x20configured');}if(!this[_0x650a('0x79')](_0xd7a0c5[_0x650a('0x54')])){return this[_0x650a('0xb')][_0x650a('0xa0')](_0x650a('0xa1'));}this[_0x650a('0xb')][_0x650a('0xa0')](util[_0x650a('0x25')](_0x650a('0x149'),_0xd7a0c5[_0x650a('0x54')]));var _0x4e15b2=this[_0x650a('0x74')]['sync'](this,_0xd7a0c5);if(_0x4e15b2){this[_0x650a('0xb')][_0x650a('0xa0')](util[_0x650a('0x25')]('ispeech\x20%s\x20file\x20created',_0x4e15b2));var _0xd5724c=this[_0x650a('0xb')][_0x650a('0xf6')](_0x4e15b2,_0xd7a0c5['intKey']);try{fs[_0x650a('0xf7')](_0x4e15b2+'.wav');}catch(_0x3ba1fa){logger['error'](_0x3ba1fa);}return _0xd5724c;}return this['channel'][_0x650a('0x27')](_0xd7a0c5,'ispeech\x20TTS\x20is\x20unreachable');};AGIVertices[_0x650a('0xd')][_0x650a('0x14a')]=function(_0x24c3e4){logger['info'](util[_0x650a('0x25')](_0x650a('0x14b'),_0x24c3e4[_0x650a('0x33')]));if(!this['isConfigured'](_0x24c3e4['findBy'])){return this['channel'][_0x650a('0x27')](_0x24c3e4,_0x650a('0x14c'));}logger[_0x650a('0x2c')](util['format'](_0x650a('0x14d'),this[_0x650a('0xb')][_0x650a('0x36')],_0x24c3e4[_0x650a('0x14e')]));var _0x3f92c7=this[_0x650a('0x4e')]['sync'](this,_0x24c3e4['findBy']);if(_0x3f92c7){logger['info'](util[_0x650a('0x25')](_0x650a('0x14f'),this[_0x650a('0xb')][_0x650a('0x36')],_0x24c3e4[_0x650a('0x14e')]));this['channel'][_0x650a('0xa0')](util[_0x650a('0x25')](_0x650a('0x14f'),this[_0x650a('0xb')][_0x650a('0x36')],_0x24c3e4[_0x650a('0x14e')]));return{'code':0xc8,'result':_0x650a('0x150')};}else{logger[_0x650a('0x2c')](util[_0x650a('0x25')](_0x650a('0x151'),this['channel'][_0x650a('0x36')],_0x24c3e4[_0x650a('0x14e')]));this[_0x650a('0xb')][_0x650a('0xa0')](util[_0x650a('0x25')](_0x650a('0x151'),this[_0x650a('0xb')][_0x650a('0x36')],_0x24c3e4[_0x650a('0x14e')]));return{'code':0xc8,'result':_0x650a('0x152')};}};AGIVertices['prototype']['logout']=function(_0x171274){logger['info'](util[_0x650a('0x25')](_0x650a('0x153'),_0x171274[_0x650a('0x33')]));if(!this['isConfigured'](_0x171274['findBy'])){return this[_0x650a('0xb')][_0x650a('0x27')](_0x171274,_0x650a('0x14c'));}logger[_0x650a('0x2c')](util['format'](_0x650a('0x14d'),this[_0x650a('0xb')][_0x650a('0x36')],_0x171274[_0x650a('0x14e')]));var _0x19ea0e=this[_0x650a('0x4d')]['sync'](this,_0x171274[_0x650a('0x14e')]);if(_0x19ea0e){logger[_0x650a('0x2c')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0x650a('0xb')][_0x650a('0x36')],_0x171274[_0x650a('0x14e')]));this[_0x650a('0xb')][_0x650a('0xa0')](util[_0x650a('0x25')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x650a('0xb')][_0x650a('0x36')],_0x171274[_0x650a('0x14e')]));return{'code':0xc8,'result':_0x650a('0x150')};}else{logger[_0x650a('0x2c')](util[_0x650a('0x25')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel']['callerid'],_0x171274[_0x650a('0x14e')]));this[_0x650a('0xb')][_0x650a('0xa0')](util[_0x650a('0x25')](_0x650a('0x151'),this[_0x650a('0xb')][_0x650a('0x36')],_0x171274[_0x650a('0x14e')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x650a('0xd')]['math']=function(_0x894b25){logger['info'](util[_0x650a('0x25')](_0x650a('0x154'),_0x894b25[_0x650a('0x33')]));if(!this[_0x650a('0x79')](_0x894b25[_0x650a('0x155')])){return this[_0x650a('0xb')][_0x650a('0x27')](_0x894b25,_0x650a('0x156'));}this[_0x650a('0xb')][_0x650a('0xa0')](util[_0x650a('0x25')](_0x650a('0x157'),_0x894b25['operation']));var _0x2552df=eval(_0x894b25['operation']);if(!this[_0x650a('0x79')](_0x894b25[_0x650a('0xcd')])){return this['channel'][_0x650a('0xa0')](_0x650a('0x109'));}var _0x14f9b5=this[_0x650a('0x98')][_0x650a('0x64')](this,_0x894b25['variable_id']);if(!_0x14f9b5){return this[_0x650a('0xb')][_0x650a('0x27')](_0x894b25,_0x650a('0xce'));}if(_[_0x650a('0x91')](_0x2552df)){var _0x206a16=this;_0x2552df[_0x650a('0xcf')](function(_0xd71fe8,_0x1cac89){_0x206a16[_0x650a('0xb')]['setVariable'](util[_0x650a('0x25')]('%s[%s]',_0x14f9b5,_0x1cac89),_0xd71fe8);});return this[_0x650a('0xb')]['noop'](util[_0x650a('0x25')](_0x650a('0x158'),_0x14f9b5));}else{return this[_0x650a('0xb')][_0x650a('0x95')](_0x14f9b5,_0x2552df);}};AGIVertices[_0x650a('0xd')][_0x650a('0x9')]=function(_0x25dee4){logger['info'](util[_0x650a('0x25')](_0x650a('0x159'),_0x25dee4[_0x650a('0x33')]));if(_0x25dee4[_0x650a('0x9e')]===0x0){return this[_0x650a('0x9c')](_0x25dee4);}_0x25dee4['retry']-=0x1;if(!this[_0x650a('0x79')](_0x25dee4['file_id'])){return this[_0x650a('0xb')][_0x650a('0x27')](_0x25dee4,'no\x20file\x20audio\x20selected');}var _0x1dc0a1=this['getSound']['sync'](this,_0x25dee4['file_id']);if(!_0x1dc0a1){return this[_0x650a('0xb')][_0x650a('0x27')](_0x25dee4,'no\x20file\x20audio\x20found');}var _0x218f83=this['channel'][_0x650a('0x15a')](_0x1dc0a1,_0x25dee4[_0x650a('0x15b')],_0x25dee4[_0x650a('0x15c')]);var _0x167679=_0x218f83[_0x650a('0x9b')];if(_0x218f83[_0x650a('0x9b')]===-0x1){this[_0x650a('0x9d')][_0x650a('0x64')](this,_0x25dee4,'-1');return _0x218f83;}else if(_0x218f83[_0x650a('0x99')]===_0x650a('0x5d')){_0x218f83[_0x650a('0x9b')]=_0x218f83[_0x650a('0x9b')][_0x650a('0x92')]>0x0?_0x218f83[_0x650a('0x9b')]:'t';}else if(_[_0x650a('0x3d')](_0x218f83[_0x650a('0x9b')])){_0x218f83[_0x650a('0x9b')]='#';_0x167679='#';}if(!this[_0x650a('0x79')](_0x25dee4[_0x650a('0xcd')])){this[_0x650a('0xb')][_0x650a('0xa0')](_0x650a('0x109'));}else{var _0xe6e037=this[_0x650a('0x98')][_0x650a('0x64')](this,_0x25dee4['variable_id']);if(!_0xe6e037){return this[_0x650a('0xb')]['error'](_0x25dee4,_0x650a('0xce'));}this[_0x650a('0xb')][_0x650a('0x95')](_0xe6e037,_0x167679);}this[_0x650a('0x9d')][_0x650a('0x64')](this,_0x25dee4,_0x167679);return _0x218f83;};AGIVertices[_0x650a('0xd')]['noop']=function(_0x4bc6a2){logger[_0x650a('0x2c')](util['format'](_0x650a('0x15d'),_0x4bc6a2['label']));return this[_0x650a('0xb')][_0x650a('0xa0')](_0x4bc6a2[_0x650a('0x15e')]||_0x4bc6a2[_0x650a('0x33')]);};AGIVertices[_0x650a('0xd')][_0x650a('0x15f')]=function(_0x194d29){logger['info'](util[_0x650a('0x25')]('Enter\x20in\x20PAUSE\x20(%s)\x20block',_0x194d29[_0x650a('0x33')]));if(!this['isConfigured'](_0x194d29[_0x650a('0x14e')])){return this[_0x650a('0xb')][_0x650a('0x27')](_0x194d29,_0x650a('0x14c'));}logger[_0x650a('0x2c')](util['format']('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x650a('0xb')][_0x650a('0x36')],_0x194d29['findBy']));var _0x358df3=this[_0x650a('0x48')][_0x650a('0x64')](this,_0x194d29[_0x650a('0x160')]);var _0x2fce5e=this[_0x650a('0x4a')]['sync'](this,_0x194d29[_0x650a('0x14e')],_0x358df3);if(_0x2fce5e){logger['info'](util['format'](_0x650a('0x14f'),this[_0x650a('0xb')][_0x650a('0x36')],_0x194d29[_0x650a('0x14e')]));this[_0x650a('0xb')][_0x650a('0xa0')](util[_0x650a('0x25')](_0x650a('0x14f'),this[_0x650a('0xb')]['callerid'],_0x194d29[_0x650a('0x14e')]));return{'code':0xc8,'result':_0x650a('0x150')};}else{logger['info'](util['format'](_0x650a('0x151'),this[_0x650a('0xb')][_0x650a('0x36')],_0x194d29[_0x650a('0x14e')]));this[_0x650a('0xb')]['noop'](util['format'](_0x650a('0x14f'),this['channel'][_0x650a('0x36')],_0x194d29[_0x650a('0x14e')]));return{'code':0xc8,'result':_0x650a('0x152')};}};AGIVertices[_0x650a('0xd')]['playback']=function(_0x4942f1){logger[_0x650a('0x2c')](util[_0x650a('0x25')](_0x650a('0x161'),_0x4942f1[_0x650a('0x33')]));if(!this[_0x650a('0x79')](_0x4942f1['file_id'])){return this[_0x650a('0xb')][_0x650a('0x27')](_0x4942f1,'no\x20file\x20audio\x20selected');}var _0x3b40bc=this[_0x650a('0x1c')]['sync'](this,_0x4942f1[_0x650a('0x107')]);if(!_0x3b40bc){return this[_0x650a('0xb')][_0x650a('0x27')](_0x4942f1,_0x650a('0x108'));}var _0x3d9cfd=this[_0x650a('0xb')][_0x650a('0xb7')](_0x650a('0x162'),[_0x3b40bc,_0x4942f1[_0x650a('0x104')]]);if(_0x3d9cfd['result']===-0x1){return _0x3d9cfd;}return this['channel'][_0x650a('0xa0')](util[_0x650a('0x25')](_0x650a('0xb9'),_0x650a('0x162'),_0x3b40bc));};AGIVertices[_0x650a('0xd')][_0x650a('0x163')]=function(_0x8afe65){logger['info'](util[_0x650a('0x25')](_0x650a('0x164'),_0x8afe65[_0x650a('0x33')]));if(!this['isConfigured'](_0x8afe65[_0x650a('0x165')])){return this[_0x650a('0xb')][_0x650a('0x27')](_0x8afe65,_0x650a('0x166'));}var _0xc7f515='';var _0x1c87a7=parseInt(_0x8afe65[_0x650a('0x165')],0xa);if(isNaN(_0x1c87a7)){_0xc7f515=_0x8afe65[_0x650a('0x165')];}else{_0xc7f515=this[_0x650a('0x11')]['sync'](this,_0x8afe65['queue_id']);if(!_0xc7f515){return this[_0x650a('0xb')]['error'](_0x8afe65,'no\x20queue\x20found');}}var _0x385835='';if(this[_0x650a('0x79')](_0x8afe65[_0x650a('0x107')])){var _0xad9496=this[_0x650a('0x1c')][_0x650a('0x64')](this,_0x8afe65['file_id']);if(_0xad9496){_0x385835=_0xad9496;}}this[_0x650a('0x9d')][_0x650a('0x64')](this,_0x8afe65,_0xc7f515);if(_0x8afe65[_0x650a('0x104')]['indexOf']('x')<0x0){_0x8afe65[_0x650a('0x104')]+='x';}if(_0x8afe65[_0x650a('0x104')]['indexOf']('X')<0x0){_0x8afe65['opts']+='X';}this[_0x650a('0xb')][_0x650a('0x95')](_0x650a('0x167'),_0xc7f515?_0xc7f515['toLowerCase']():'');var _0x7a0d78=this[_0x650a('0xb')]['exec'](_0x650a('0x168'),[_0xc7f515,_0x8afe65[_0x650a('0x104')],_0x8afe65[_0x650a('0x5c')],_0x385835,_0x8afe65[_0x650a('0x5d')],_0x8afe65[_0x650a('0xac')],_0x8afe65[_0x650a('0x169')],_0x8afe65[_0x650a('0x16a')],'',_0x8afe65[_0x650a('0x16b')]]);if(_0x7a0d78[_0x650a('0x9b')]===-0x1){return _0x7a0d78;}return this[_0x650a('0xb')][_0x650a('0xa0')](util[_0x650a('0x25')](_0x650a('0xb9'),'QUEUE',_0xc7f515));};AGIVertices[_0x650a('0xd')][_0x650a('0x16c')]=function(_0x1b489a){logger[_0x650a('0x2c')](util[_0x650a('0x25')](_0x650a('0x16d'),_0x1b489a[_0x650a('0x33')]));var _0x5201b8=_0x1b489a[_0x650a('0x16e')]||_0x650a('0x124');var _0x2b8c18=util['format']('%s_%s',this[_0x650a('0xb')][_0x650a('0x32')],rs['generate'](0x5));var _0x2541dc=util[_0x650a('0x25')](_0x650a('0x16f'),FILES_PATH,_0x2b8c18,_0x5201b8);var _0x59aaaf=util[_0x650a('0x25')]('%s/recordings/%s',FILES_PATH,_0x2b8c18);this[_0x650a('0x37')][_0x650a('0x64')](this,_0x1b489a,_0x2b8c18,_0x2541dc);this['channel'][_0x650a('0x95')](_0x650a('0x170'),_0x2b8c18);logger['info']('Recording\x20%s\x20%s\x20%s\x20%s',_0x59aaaf,_0x5201b8,_0x1b489a['escape_digits'],_0x1b489a[_0x650a('0x5d')]);return this[_0x650a('0xb')][_0x650a('0x12c')](_0x59aaaf,_0x5201b8,_0x1b489a[_0x650a('0x171')],_0x1b489a[_0x650a('0x5d')],undefined,!![]);};AGIVertices['prototype'][_0x650a('0x172')]=function(_0x79708c){logger['info'](util['format'](_0x650a('0x173'),_0x79708c['label']));if(!this[_0x650a('0x79')](_0x79708c[_0x650a('0x5c')])){return this[_0x650a('0xb')][_0x650a('0xa0')]('no\x20url\x20configured');}var _0x4ab699=this[_0x650a('0x5b')]['sync'](this,_0x79708c);logger[_0x650a('0x2c')](util[_0x650a('0x25')](_0x650a('0x174'),util[_0x650a('0x175')](_0x4ab699,{'showHidden':![],'depth':null})));if(!this[_0x650a('0x79')](_0x79708c[_0x650a('0xcd')])){return this[_0x650a('0xb')][_0x650a('0xa0')]('no\x20variable\x20selected\x20for\x20the\x20response');}var _0x1cfb8f=this[_0x650a('0x98')]['sync'](this,_0x79708c[_0x650a('0xcd')]);if(!_0x1cfb8f){return this[_0x650a('0xb')][_0x650a('0x27')](_0x79708c,_0x650a('0xce'));}this[_0x650a('0xb')][_0x650a('0x95')](util[_0x650a('0x25')](_0x650a('0x176'),_0x1cfb8f),_0x4ab699['statusCode']?_0x4ab699['statusCode']:'200');this['channel']['setVariable'](util['format']('%s_STATUS_MESSAGE',_0x1cfb8f),_0x4ab699['statusMessage']?_0x4ab699['statusMessage']:'OK');if(_0x4ab699[_0x650a('0x60')]){try{this['saveRestApiResult'](_0x4ab699[_0x650a('0x60')],_0x1cfb8f);}catch(_0x20e9a8){logger[_0x650a('0x27')](util[_0x650a('0x25')](_0x650a('0x177'),_0x1cfb8f));}}return this[_0x650a('0xb')][_0x650a('0xa0')](util['format'](_0x650a('0x178'),_0x1cfb8f));};AGIVertices[_0x650a('0xd')][_0x650a('0x179')]=function(_0x5ac7a2){logger[_0x650a('0x2c')](util['format']('Enter\x20in\x20SAYDIGITS\x20(%s)\x20block',_0x5ac7a2[_0x650a('0x33')]));return this[_0x650a('0xb')][_0x650a('0x17a')](_0x5ac7a2[_0x650a('0x17b')][_0x650a('0x52')](/\s+/g,''),_0x5ac7a2['escape_digits']);};AGIVertices['prototype'][_0x650a('0x17c')]=function(_0x4123dd){logger[_0x650a('0x2c')](util[_0x650a('0x25')](_0x650a('0x17d'),_0x4123dd[_0x650a('0x33')]));return this[_0x650a('0xb')][_0x650a('0x17e')](_0x4123dd[_0x650a('0x5e')][_0x650a('0x52')](/\s+/g,''),_0x4123dd[_0x650a('0x171')]);};AGIVertices[_0x650a('0xd')][_0x650a('0x17f')]=function(_0x465b1e){logger['info'](util[_0x650a('0x25')](_0x650a('0x180'),_0x465b1e[_0x650a('0x33')]));return this[_0x650a('0xb')]['sayPhonetic'](_0x465b1e[_0x650a('0x54')],_0x465b1e[_0x650a('0x171')]);};AGIVertices[_0x650a('0xd')][_0x650a('0x181')]=function(_0x1d01fd){logger[_0x650a('0x2c')](util[_0x650a('0x25')]('Enter\x20in\x20SENDMAIL\x20(%s)\x20block',_0x1d01fd[_0x650a('0x33')]));if(!this[_0x650a('0x79')](_0x1d01fd[_0x650a('0x182')])){return this[_0x650a('0xb')]['noop'](_0x650a('0x183'));}var _0x2dd0fe=this[_0x650a('0x184')]['sync'](this,_0x1d01fd[_0x650a('0x182')]);if(!_0x2dd0fe||!_0x2dd0fe[_0x650a('0x185')]){return this['channel']['error'](_0x1d01fd,'no\x20mail\x20account\x20found');}var _0x7fb645={'from':util[_0x650a('0x25')](_0x650a('0x186'),_0x2dd0fe['name'],_0x2dd0fe[_0x650a('0x187')]||_0x2dd0fe[_0x650a('0x185')][_0x650a('0x188')]),'to':_0x1d01fd['to']||'','cc':_0x1d01fd['cc']||'','bcc':_0x1d01fd[_0x650a('0x189')]||'','subject':_0x1d01fd[_0x650a('0x18a')],'html':_0x1d01fd[_0x650a('0x54')],'text':_0x1d01fd[_0x650a('0x54')]};if(this[_0x650a('0x79')](_0x1d01fd['template_id'])){}logger['debug'](_0x650a('0x18b'),JSON[_0x650a('0x10b')](_0x7fb645));this[_0x650a('0x9d')][_0x650a('0x64')](this,_0x1d01fd,_0x1d01fd[_0x650a('0x182')]);this['channel']['noop'](util[_0x650a('0x25')](_0x650a('0x18c'),_0x2dd0fe[_0x650a('0x10')]));this[_0x650a('0x21')][_0x650a('0x64')](this,_0x2dd0fe[_0x650a('0x18d')],_0x7fb645);return this[_0x650a('0xb')][_0x650a('0xa0')](_0x650a('0x18e'));};AGIVertices[_0x650a('0xd')][_0x650a('0x18f')]=function(_0x7e1223){logger[_0x650a('0x2c')](util[_0x650a('0x25')](_0x650a('0x190'),_0x7e1223[_0x650a('0x33')]));return this['channel'][_0x650a('0xa0')](_0x650a('0x191'));};AGIVertices[_0x650a('0xd')]['sendSMS']=function(_0x241b15){logger[_0x650a('0x2c')](util[_0x650a('0x25')](_0x650a('0x192'),_0x241b15['label']));if(!this['isConfigured'](_0x241b15[_0x650a('0x193')])){return this[_0x650a('0xb')][_0x650a('0xa0')]('no\x20sms\x20account\x20configured');}var _0xa2c59a=this[_0x650a('0x2f')][_0x650a('0x64')](this,_0x241b15[_0x650a('0x193')]);if(!_0xa2c59a){return this[_0x650a('0xb')]['error'](_0x241b15,_0x650a('0x194'));}var _0x34ad56={'body':_0x241b15[_0x650a('0x195')],'phone':_0x241b15['to']||'','SmsAccountId':_0xa2c59a['id']};logger[_0x650a('0xd2')](_0x650a('0x196'),JSON[_0x650a('0x10b')](_0x34ad56));this[_0x650a('0x9d')][_0x650a('0x64')](this,_0x241b15,_0x241b15[_0x650a('0x193')]);this[_0x650a('0xb')][_0x650a('0xa0')](util['format'](_0x650a('0x197'),_0xa2c59a['name']));this['createSmsMessage'][_0x650a('0x64')](this,_0x34ad56);return this[_0x650a('0xb')]['noop'](_0x650a('0x198'));};AGIVertices['prototype'][_0x650a('0x199')]=function(_0x5b477f){logger[_0x650a('0x2c')](util['format'](_0x650a('0x19a'),_0x5b477f[_0x650a('0x33')]));if(!this[_0x650a('0x79')](_0x5b477f['variable_id'])){return this['channel'][_0x650a('0x27')](_0x5b477f,_0x650a('0x19b'));}var _0x875dca=this[_0x650a('0x98')]['sync'](this,_0x5b477f[_0x650a('0xcd')]);if(!_0x875dca){return this[_0x650a('0xb')][_0x650a('0x27')](_0x5b477f,_0x650a('0xce'));}return this[_0x650a('0xb')][_0x650a('0x95')](_0x875dca,_0x5b477f[_0x650a('0x19c')]);};AGIVertices['prototype'][_0x650a('0x19d')]=function(_0x1aab34){logger[_0x650a('0x2c')](util[_0x650a('0x25')](_0x650a('0x19e'),_0x1aab34[_0x650a('0x33')]));this['channel']['noop'](_0x650a('0x19f'));var _0x4ac290=this[_0x650a('0xb')]['getVariable'](_0x650a('0x1a0'));if(!_[_0x650a('0x3d')](_0x4ac290[_0x650a('0x99')])){this[_0x650a('0xb')]['uniqueid']=_0x4ac290[_0x650a('0x99')];}if(_0x1aab34[_0x650a('0xae')]===_0x650a('0x1a1')){this[_0x650a('0xb')][_0x650a('0xa0')]('Answer');return this['channel'][_0x650a('0xae')]();}return this['channel'][_0x650a('0xa0')](_0x650a('0x1a2'));};AGIVertices[_0x650a('0xd')][_0x650a('0x1a3')]=function(_0x5389c2){logger[_0x650a('0x2c')](util['format'](_0x650a('0x1a4'),_0x5389c2[_0x650a('0x33')]));if(!this[_0x650a('0x79')](_0x5389c2[_0x650a('0x1a5')])){return this[_0x650a('0xb')]['error'](_0x5389c2,_0x650a('0x1a6'));}var _0x5da35f=this[_0x650a('0x13')][_0x650a('0x64')](this,_0x5389c2[_0x650a('0x1a5')]);if(!this[_0x650a('0x79')](_0x5da35f)){return this['channel'][_0x650a('0x27')](_0x5389c2,util[_0x650a('0x25')](_0x650a('0x1a7'),_0x5389c2[_0x650a('0x1a5')]));}if(_0x5da35f===this[_0x650a('0xb')][_0x650a('0x35')]){return this['channel'][_0x650a('0x27')](_0x5389c2,_0x650a('0x1a8'));}this[_0x650a('0x9d')][_0x650a('0x64')](this,_0x5389c2,_0x5da35f);var _0x3bf7aa=this[_0x650a('0xb')][_0x650a('0xb7')](_0x650a('0x1a9'),util[_0x650a('0x25')](_0x650a('0x1aa'),config['agi'][_0x650a('0x1ab')]||'127.0.0.1',_0x5da35f,this[_0x650a('0xb')][_0x650a('0x35')]));if(_0x3bf7aa[_0x650a('0x9b')]===-0x1){return _0x3bf7aa;}return this[_0x650a('0xb')][_0x650a('0xa0')](util[_0x650a('0x25')](_0x650a('0xb9'),_0x650a('0x1a9'),_0x5da35f));};AGIVertices[_0x650a('0xd')][_0x650a('0x1ac')]=function(_0x2036bf){logger[_0x650a('0x2c')](util[_0x650a('0x25')](_0x650a('0x1ad'),_0x2036bf[_0x650a('0x33')]));var _0x8933f0=this[_0x650a('0x50')]['sync'](this,_0x2036bf[_0x650a('0xad')]);this[_0x650a('0x9d')][_0x650a('0x64')](this,_0x2036bf,_0x2036bf[_0x650a('0xad')]);if(this['isConfigured'](_0x2036bf[_0x650a('0xcd')])){var _0x2d6944=this[_0x650a('0x98')]['sync'](this,_0x2036bf['variable_id']);if(_0x2d6944){this[_0x650a('0xb')][_0x650a('0x95')](_0x2d6944,_0x8933f0);return this[_0x650a('0xb')][_0x650a('0xa0')](util[_0x650a('0x25')](_0x650a('0x1ae'),_0x2036bf[_0x650a('0xad')],_0x2d6944));}}return this[_0x650a('0xb')][_0x650a('0xa0')](util[_0x650a('0x25')](_0x650a('0x1af'),_0x2036bf[_0x650a('0xad')]));};AGIVertices[_0x650a('0xd')]['google_cloud_tts']=function(_0x1f22e4){logger['info'](util['format'](_0x650a('0x1b0'),_0x1f22e4[_0x650a('0x33')]));_0x1f22e4[_0x650a('0x54')]=_0x1f22e4[_0x650a('0x54')][_0x650a('0x52')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x1f22e4['apiKey'])){return this[_0x650a('0xb')][_0x650a('0xa0')]('no\x20apiKey\x20configured');}if(!this[_0x650a('0x79')](_0x1f22e4['text'])){return this[_0x650a('0xb')][_0x650a('0xa0')](_0x650a('0xa1'));}this[_0x650a('0xb')][_0x650a('0xa0')](util[_0x650a('0x25')](_0x650a('0x1b1'),_0x1f22e4[_0x650a('0x54')]));var _0x53d0c3=this[_0x650a('0x53')][_0x650a('0x64')](this,_0x1f22e4);if(_0x53d0c3){this[_0x650a('0xb')][_0x650a('0xa0')](util[_0x650a('0x25')](_0x650a('0x1b2'),_0x53d0c3));var _0x5dcffb=this[_0x650a('0xb')][_0x650a('0xf6')](_0x53d0c3);try{fs[_0x650a('0xf7')](_0x53d0c3+'.wav');}catch(_0x43c078){logger[_0x650a('0x27')](_0x43c078);}return _0x5dcffb;}return this[_0x650a('0xb')][_0x650a('0x27')](_0x1f22e4,_0x650a('0x1b3'));};AGIVertices[_0x650a('0xd')][_0x650a('0x1b4')]=function(_0x8e6ae6){logger[_0x650a('0x2c')](util[_0x650a('0x25')](_0x650a('0x1b5'),_0x8e6ae6['label']));_0x8e6ae6[_0x650a('0x54')]=_0x8e6ae6[_0x650a('0x54')][_0x650a('0x52')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x8e6ae6[_0x650a('0x54')])){return this[_0x650a('0xb')][_0x650a('0xa0')]('no\x20text\x20configured');}this[_0x650a('0xb')][_0x650a('0xa0')](util[_0x650a('0x25')](_0x650a('0x1b6'),_0x8e6ae6[_0x650a('0x54')]));var _0x2f0b5b=this[_0x650a('0x59')]['sync'](this,_0x8e6ae6);if(_0x2f0b5b){this[_0x650a('0xb')]['noop'](util[_0x650a('0x25')](_0x650a('0x1b7'),_0x2f0b5b));var _0xcb0a89=this['channel'][_0x650a('0xf6')](_0x2f0b5b);try{fs[_0x650a('0xf7')](_0x2f0b5b+_0x650a('0xf8'));}catch(_0x585564){logger['error'](_0x585564);}return _0xcb0a89;}return this[_0x650a('0xb')]['error'](_0x8e6ae6,_0x650a('0x1b8'));};AGIVertices[_0x650a('0xd')][_0x650a('0x1b9')]=function(_0xa69357){logger[_0x650a('0x2c')](util[_0x650a('0x25')](_0x650a('0x1ba'),_0xa69357[_0x650a('0x33')]));if(!this['isConfigured'](_0xa69357['findBy'])){return this[_0x650a('0xb')][_0x650a('0x27')](_0xa69357,_0x650a('0x14c'));}logger[_0x650a('0x2c')](util[_0x650a('0x25')](_0x650a('0x14d'),this[_0x650a('0xb')]['callerid'],_0xa69357['findBy']));var _0x4c863c=this[_0x650a('0x4b')][_0x650a('0x64')](this,_0xa69357['findBy']);if(_0x4c863c){logger[_0x650a('0x2c')](util['format'](_0x650a('0x14f'),this[_0x650a('0xb')]['callerid'],_0xa69357[_0x650a('0x14e')]));this[_0x650a('0xb')][_0x650a('0xa0')](util[_0x650a('0x25')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x650a('0xb')][_0x650a('0x36')],_0xa69357[_0x650a('0x14e')]));return{'code':0xc8,'result':_0x650a('0x150')};}else{logger[_0x650a('0x2c')](util[_0x650a('0x25')](_0x650a('0x151'),this[_0x650a('0xb')][_0x650a('0x36')],_0xa69357[_0x650a('0x14e')]));this[_0x650a('0xb')][_0x650a('0xa0')](util[_0x650a('0x25')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x650a('0xb')]['callerid'],_0xa69357[_0x650a('0x14e')]));return{'code':0xc8,'result':_0x650a('0x152')};}};AGIVertices[_0x650a('0xd')]['voicemail']=function(_0x43b07b){logger[_0x650a('0x2c')](util['format'](_0x650a('0x1bb'),_0x43b07b[_0x650a('0x33')]));var _0x2eeed6=this[_0x650a('0xb')]['exec'](_0x650a('0x1bc'),[_0x43b07b[_0x650a('0x1bd')],_0x43b07b[_0x650a('0x6a')]]);if(_0x2eeed6[_0x650a('0x9b')]===-0x1){return _0x2eeed6;}return this[_0x650a('0xb')]['noop'](util['format'](_0x650a('0xb9'),'VOICEMAIL',_0x43b07b[_0x650a('0x1bd')]));};AGIVertices[_0x650a('0xd')][_0x650a('0x1be')]=function(_0x12ff09){logger[_0x650a('0x2c')](util[_0x650a('0x25')]('Enter\x20in\x20SWITCH\x20(%s)\x20block',_0x12ff09[_0x650a('0x33')]));if(!this[_0x650a('0x79')](_0x12ff09[_0x650a('0xcd')])){return this[_0x650a('0xb')][_0x650a('0x27')](_0x12ff09,_0x650a('0x19b'));}var _0x29b18b=this['getVariable'][_0x650a('0x64')](this,_0x12ff09[_0x650a('0xcd')]);if(!_0x29b18b){return this[_0x650a('0xb')][_0x650a('0x27')](_0x12ff09,_0x650a('0xce'));}var _0x479eb0=this[_0x650a('0xb')][_0x650a('0x98')](_0x29b18b);return{'code':0xc8,'result':_0x479eb0[_0x650a('0x99')]?_0x479eb0[_0x650a('0x99')]:'-'};};String['prototype'][_0x650a('0x97')]=function(_0x4630d6,_0x119230){return this[_0x650a('0x96')](_0x4630d6)['join'](_0x119230);};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 4e282a9..1e006f5 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 _0x6365=['hangup','syncHangup','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','milliseconds','seconds','prototype','updateAcw','timer','update','uniqueid','then','[%s][UPDATE][ACWTIME:%s]','catch','[%s][UPDATE][ERRORS:%s]','finally','startAcw','interface','queue','ACW','mandatoryDispositionPause','resolve','getAgent','voicePause','info','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','[%s][START][AGENT:%s][QUEUE:%s]','savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','stopAcw','YYYY-MM-DD\x20HH:mm:ss','error','[ACW][START]\x20%s','message','[%s][TIMER][STOP][AGENT:%s]','saveUnpause','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','mandatoryDisposition','[ACW][syncAgentConnect]\x20%s','syncAgentConnectPreview','acw','[ACW][syncAgentConnectPreview]\x20%s','syncHangupRequest','isUndefined','[%s][HANGUP:UNIQUEID]','linkedid','attended','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','[%s][BLINDTRANSFER:LINKEDID]','transfererlinkedid','[ACW][syncBlindTransfer]\x20%s','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','lodash','moment','../ami','../../../config/logger','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','syncAgentConnect','bind'];(function(_0x940b84,_0x2ad61c){var _0x291c7c=function(_0x4f5f84){while(--_0x4f5f84){_0x940b84['push'](_0x940b84['shift']());}};_0x291c7c(++_0x2ad61c);}(_0x6365,0x148));var _0x5636=function(_0x26f90d,_0x4e6e0e){_0x26f90d=_0x26f90d-0x0;var _0x1a238e=_0x6365[_0x26f90d];return _0x1a238e;};'use strict';var _=require(_0x5636('0x0'));var moment=require(_0x5636('0x1'));var ami=require(_0x5636('0x2'));var logger=require(_0x5636('0x3'))('acw');var RpcUser=require(_0x5636('0x4'));var RpcVoiceAgentReport=require(_0x5636('0x5'));function Acw(_0x355be7){this[_0x5636('0x6')]=_0x355be7[_0x5636('0x6')];this['agents']=_0x355be7[_0x5636('0x7')];this[_0x5636('0x8')]=_0x355be7[_0x5636('0x8')];this[_0x5636('0x9')]={};ami['on']('agentconnect',this[_0x5636('0xa')][_0x5636('0xb')](this));ami['on']('hanguprequest',this['syncHangupRequest'][_0x5636('0xb')](this));ami['on'](_0x5636('0xc'),this[_0x5636('0xd')][_0x5636('0xb')](this));ami['on']('agentringnoanswer',this['syncAgentRingNoAnswer'][_0x5636('0xb')](this));ami['on']('attendedtransfer',this[_0x5636('0xe')][_0x5636('0xb')](this));ami['on'](_0x5636('0xf'),this[_0x5636('0x10')][_0x5636('0xb')](this));ami['on'](_0x5636('0x11'),this['syncAgentConnectPreview'][_0x5636('0xb')](this));}function getDiff(_0x1c60dd){var _0x5d4b17=moment()[_0x5636('0x12')](0x0);var _0x196741=moment(_0x1c60dd)['milliseconds'](0x0);return _0x5d4b17['diff'](_0x196741,_0x5636('0x13'));}Acw[_0x5636('0x14')][_0x5636('0x15')]=function(_0x11340b,_0x3fb15a){var _0x4d5630=this;var _0x2fd9c0=getDiff(_0x4d5630['timers'][_0x11340b]['lastPauseAt']);clearTimeout(_0x4d5630[_0x5636('0x8')][_0x11340b][_0x5636('0x16')]);_0x4d5630[_0x5636('0x8')][_0x11340b][_0x5636('0x16')]=![];return RpcVoiceAgentReport[_0x5636('0x17')]({'acwtime':_0x2fd9c0},_0x4d5630[_0x5636('0x8')][_0x11340b][_0x5636('0x18')],_0x11340b)[_0x5636('0x19')](function(_0x522d61){logger['info'](_0x5636('0x1a'),_0x3fb15a,_0x2fd9c0,_0x522d61);})[_0x5636('0x1b')](function(_0x418891){logger['error'](_0x5636('0x1c'),_0x3fb15a,_0x418891);})[_0x5636('0x1d')](function(){delete _0x4d5630[_0x5636('0x8')][_0x11340b];});};Acw[_0x5636('0x14')][_0x5636('0x1e')]=function(_0x4d036d){try{var _0x247043=this;var _0x1a7298=this[_0x5636('0x9')][_0x4d036d][_0x5636('0x1f')];var _0x51520a=this['channels'][_0x4d036d][_0x5636('0x20')];var _0x4d8f1c=this[_0x5636('0x6')][_0x51520a];var _0x448afc=![];var _0x46a927=_0x5636('0x21');if(_0x4d8f1c['mandatoryDisposition']&&_0x4d8f1c[_0x5636('0x22')]['name']){_0x448afc=!![];_0x46a927=_0x4d8f1c[_0x5636('0x22')]['name'];}if(!_0x247043[_0x5636('0x7')][_0x1a7298]){return Promise[_0x5636('0x23')]();}return RpcUser[_0x5636('0x24')](_0x247043[_0x5636('0x7')][_0x1a7298]['id'])['then'](function(_0x362e40){if(!_0x362e40||_0x362e40[_0x5636('0x25')]){logger[_0x5636('0x26')](_0x5636('0x27'),_0x4d036d,_0x1a7298,_0x51520a);return;}logger['info'](_0x5636('0x28'),_0x4d036d,_0x1a7298,_0x51520a);var _0x56ea71=_0x247043[_0x5636('0x9')][_0x4d036d]['attended']&&_0x247043[_0x5636('0x9')][_0x4d036d]['destlinkedid']?_0x247043[_0x5636('0x9')][_0x4d036d]['destlinkedid']:_0x4d036d;return RpcUser[_0x5636('0x29')](_0x247043['agents'][_0x1a7298],_0x46a927,_0x56ea71);})[_0x5636('0x19')](function(_0x29e56a){if(_0x448afc||!_0x29e56a){return;}_0x247043[_0x5636('0x8')][_0x1a7298]={};logger['info'](_0x5636('0x2a'),_0x4d036d,_0x247043[_0x5636('0x6')][_0x51520a][_0x5636('0x2b')],_0x1a7298,_0x51520a);_0x247043['timers'][_0x1a7298][_0x5636('0x16')]=setTimeout(_0x247043[_0x5636('0x2c')][_0x5636('0xb')](_0x247043,_0x1a7298),_0x247043[_0x5636('0x6')][_0x51520a][_0x5636('0x2b')]*0x3e8);_0x247043[_0x5636('0x8')][_0x1a7298]['lastPauseAt']=moment()['format'](_0x5636('0x2d'));_0x247043['timers'][_0x1a7298][_0x5636('0x18')]=_0x4d036d;_0x247043['timers'][_0x1a7298][_0x5636('0x20')]=_0x51520a;_0x247043[_0x5636('0x8')][_0x1a7298][_0x5636('0x15')]=_0x247043[_0x5636('0x15')]['bind'](_0x247043,_0x1a7298,_0x4d036d);})[_0x5636('0x1b')](function(){logger['error'](_0x5636('0x2a'),_0x4d036d,_0x247043[_0x5636('0x6')][_0x51520a][_0x5636('0x2b')],_0x1a7298,_0x51520a);})['finally'](function(){delete _0x247043['channels'][_0x4d036d];});}catch(_0x4214ed){logger[_0x5636('0x2e')](_0x5636('0x2f'),_0x4214ed[_0x5636('0x30')]);}};Acw[_0x5636('0x14')][_0x5636('0x2c')]=function(_0x3ffbf4){try{var _0x4f01c5=this;if(_0x4f01c5[_0x5636('0x8')][_0x3ffbf4]){_0x4f01c5['timers'][_0x3ffbf4]['timer']=![];var _0x27c439=_0x4f01c5[_0x5636('0x8')][_0x3ffbf4][_0x5636('0x18')];var _0x313ac9=_0x4f01c5[_0x5636('0x8')][_0x3ffbf4][_0x5636('0x20')];var _0x1c5731=_0x4f01c5[_0x5636('0x6')][_0x313ac9][_0x5636('0x2b')];logger[_0x5636('0x26')](_0x5636('0x31'),_0x27c439,_0x3ffbf4);RpcUser[_0x5636('0x32')](this['agents'][_0x3ffbf4]);RpcVoiceAgentReport['update']({'acwtime':_0x1c5731,'agentacw':!![]},_0x27c439,_0x3ffbf4)[_0x5636('0x19')](function(_0x21a6bc){logger['info']('[%s][UPDATE][ACWTIME:%s]',_0x27c439,_0x1c5731,_0x21a6bc);})[_0x5636('0x1b')](function(_0x1b6430){logger[_0x5636('0x2e')](_0x5636('0x1c'),_0x27c439,_0x1b6430);});}else{logger[_0x5636('0x2e')]('[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer',_0x3ffbf4);if(_0x4f01c5['timers']){logger[_0x5636('0x26')](_0x5636('0x33'),JSON[_0x5636('0x34')](_0x4f01c5[_0x5636('0x8')]));}}}catch(_0x5c0170){logger['error'](_0x5636('0x35'),_0x5c0170[_0x5636('0x30')]);}};Acw[_0x5636('0x14')]['syncAgentConnect']=function(_0x54faf7){try{if(this[_0x5636('0x6')][_0x54faf7[_0x5636('0x20')]]&&(this[_0x5636('0x6')][_0x54faf7[_0x5636('0x20')]]['acw']||this[_0x5636('0x6')][_0x54faf7[_0x5636('0x20')]][_0x5636('0x36')])){if(this[_0x5636('0x7')][_0x54faf7[_0x5636('0x1f')]]){this[_0x5636('0x9')][_0x54faf7[_0x5636('0x18')]]={'queue':_0x54faf7[_0x5636('0x20')],'interface':_0x54faf7[_0x5636('0x1f')],'destlinkedid':_0x54faf7['destlinkedid']};}}}catch(_0x16ed76){logger['error'](_0x5636('0x37'),_0x16ed76['message']);}};Acw[_0x5636('0x14')][_0x5636('0x38')]=function(_0x27f6c6){try{if(this[_0x5636('0x6')][_0x27f6c6[_0x5636('0x20')]]&&(this[_0x5636('0x6')][_0x27f6c6['queue']][_0x5636('0x39')]||this[_0x5636('0x6')][_0x27f6c6[_0x5636('0x20')]][_0x5636('0x36')])){if(this[_0x5636('0x7')][_0x27f6c6[_0x5636('0x1f')]]){this[_0x5636('0x9')][_0x27f6c6[_0x5636('0x18')]]={'queue':_0x27f6c6[_0x5636('0x20')],'interface':_0x27f6c6[_0x5636('0x1f')]};}}}catch(_0xfa53a5){logger['error'](_0x5636('0x3a'),_0xfa53a5['message']);}};Acw[_0x5636('0x14')][_0x5636('0x3b')]=function(_0x1a3fa3){try{if(this['channels'][_0x1a3fa3[_0x5636('0x18')]]&&_[_0x5636('0x3c')](this[_0x5636('0x9')][_0x1a3fa3['uniqueid']]['attended'])){logger['info'](_0x5636('0x3d'),_0x1a3fa3[_0x5636('0x18')]);this['startAcw'](_0x1a3fa3[_0x5636('0x18')]);}else if(this['channels'][_0x1a3fa3[_0x5636('0x3e')]]&&_[_0x5636('0x3c')](this[_0x5636('0x9')][_0x1a3fa3[_0x5636('0x3e')]][_0x5636('0x3f')])){logger['info'](_0x5636('0x40'),_0x1a3fa3[_0x5636('0x3e')]);this[_0x5636('0x1e')](_0x1a3fa3[_0x5636('0x3e')]);}}catch(_0x56f38a){logger[_0x5636('0x2e')](_0x5636('0x41'),_0x56f38a[_0x5636('0x30')]);}};Acw[_0x5636('0x14')][_0x5636('0xd')]=function(_0x1a3770){try{if(this['channels'][_0x1a3770['uniqueid']]&&this['channels'][_0x1a3770[_0x5636('0x18')]][_0x5636('0x3f')]){logger[_0x5636('0x26')](_0x5636('0x42'),_0x1a3770['uniqueid']);this[_0x5636('0x1e')](_0x1a3770[_0x5636('0x18')]);}else if(this['channels'][_0x1a3770['linkedid']]&&this[_0x5636('0x9')][_0x1a3770['linkedid']]['attended']){logger['info']('[%s][HANGUPATTENDEDTRANSFER:LINKEDID]',_0x1a3770[_0x5636('0x3e')]);this[_0x5636('0x1e')](_0x1a3770[_0x5636('0x3e')]);}}catch(_0x1d3699){logger['error'](_0x5636('0x43'),_0x1d3699['message']);}};Acw[_0x5636('0x14')][_0x5636('0xe')]=function(_0x257bf0){try{if(!_[_0x5636('0x44')](this[_0x5636('0x9')][_0x257bf0[_0x5636('0x45')]])){this[_0x5636('0x1e')](_0x257bf0[_0x5636('0x45')]);if(this[_0x5636('0x9')][_0x257bf0['secondtransfereruniqueid']]){this[_0x5636('0x9')][_0x257bf0[_0x5636('0x46')]][_0x5636('0x3f')]=!![];this['channels'][_0x257bf0[_0x5636('0x47')]]=this[_0x5636('0x9')][_0x257bf0[_0x5636('0x46')]];delete this[_0x5636('0x9')][_0x257bf0[_0x5636('0x46')]];}}else if(!_['isNil'](this['channels'][_0x257bf0[_0x5636('0x47')]])){this[_0x5636('0x1e')](_0x257bf0[_0x5636('0x47')]);if(this[_0x5636('0x9')][_0x257bf0[_0x5636('0x48')]]){this['channels'][_0x257bf0['origtransfereruniqueid']][_0x5636('0x3f')]=!![];this['channels'][_0x257bf0[_0x5636('0x45')]]=this[_0x5636('0x9')][_0x257bf0['origtransfereruniqueid']];delete this[_0x5636('0x9')][_0x257bf0[_0x5636('0x48')]];}}}catch(_0x10f651){logger[_0x5636('0x2e')](_0x5636('0x49'),_0x10f651[_0x5636('0x30')]);}};Acw[_0x5636('0x14')][_0x5636('0x10')]=function(_0x4bbd70){try{if(this[_0x5636('0x9')][_0x4bbd70[_0x5636('0x4a')]]){logger[_0x5636('0x26')](_0x5636('0x4b'),JSON[_0x5636('0x34')](_0x4bbd70['transfereruniqueid']));this[_0x5636('0x1e')](_0x4bbd70[_0x5636('0x4a')]);}else if(this['channels'][_0x4bbd70['transfererlinkedid']]){logger[_0x5636('0x26')](_0x5636('0x4c'),JSON['stringify'](_0x4bbd70[_0x5636('0x4d')]));this[_0x5636('0x1e')](_0x4bbd70[_0x5636('0x4d')]);}}catch(_0x5b8175){logger[_0x5636('0x2e')](_0x5636('0x4e'),_0x5b8175[_0x5636('0x30')]);}};Acw[_0x5636('0x14')]['syncAgentRingNoAnswer']=function(_0x54afdc){try{if(this[_0x5636('0x6')][_0x54afdc['queue']]&&this['voiceQueues'][_0x54afdc['queue']][_0x5636('0x4f')]===_0x5636('0x50')){if(this[_0x5636('0x7')][_0x54afdc[_0x5636('0x1f')]]){logger['info'](_0x5636('0x51'),_0x54afdc[_0x5636('0x18')],_0x54afdc[_0x5636('0x1f')],_0x54afdc[_0x5636('0x20')]);return RpcUser[_0x5636('0x29')](this[_0x5636('0x7')][_0x54afdc[_0x5636('0x1f')]],_0x5636('0x52'),_0x54afdc[_0x5636('0x18')]);}}}catch(_0x3b858a){logger[_0x5636('0x2e')](_0x5636('0x53'),_0x3b858a['message']);}};module[_0x5636('0x54')]=Acw; \ No newline at end of file +var _0xc9c3=['voiceQueues','agents','channels','agentconnect','syncAgentConnect','bind','hanguprequest','syncHangupRequest','hangup','syncHangup','syncAgentRingNoAnswer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','diff','prototype','updateAcw','timer','timers','update','uniqueid','then','info','catch','error','[%s][UPDATE][ERRORS:%s]','startAcw','interface','queue','ACW','mandatoryDisposition','mandatoryDispositionPause','name','resolve','voicePause','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','stopAcw','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','finally','saveUnpause','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','message','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','[%s][HANGUP:UNIQUEID]','linkedid','[%s][HANGUP:LINKEDID]','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','stringify','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','autopause','all','[ACW][syncAgentRingNoAnswer]\x20%s','../ami','acw','../rpc/user','../rpc/voiceAgentReport'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xc9c3,0x96));var _0x3c9c=function(_0x24af39,_0x50cd01){_0x24af39=_0x24af39-0x0;var _0x5bc3d7=_0xc9c3[_0x24af39];return _0x5bc3d7;};'use strict';var _=require('lodash');var moment=require('moment');var ami=require(_0x3c9c('0x0'));var logger=require('../../../config/logger')(_0x3c9c('0x1'));var RpcUser=require(_0x3c9c('0x2'));var RpcVoiceAgentReport=require(_0x3c9c('0x3'));function Acw(_0x2ec103){this[_0x3c9c('0x4')]=_0x2ec103[_0x3c9c('0x4')];this[_0x3c9c('0x5')]=_0x2ec103['agents'];this['timers']=_0x2ec103['timers'];this[_0x3c9c('0x6')]={};ami['on'](_0x3c9c('0x7'),this[_0x3c9c('0x8')][_0x3c9c('0x9')](this));ami['on'](_0x3c9c('0xa'),this[_0x3c9c('0xb')][_0x3c9c('0x9')](this));ami['on'](_0x3c9c('0xc'),this[_0x3c9c('0xd')][_0x3c9c('0x9')](this));ami['on']('agentringnoanswer',this[_0x3c9c('0xe')][_0x3c9c('0x9')](this));ami['on']('attendedtransfer',this[_0x3c9c('0xf')]['bind'](this));ami['on'](_0x3c9c('0x10'),this[_0x3c9c('0x11')][_0x3c9c('0x9')](this));ami['on'](_0x3c9c('0x12'),this['syncAgentConnectPreview']['bind'](this));}function getDiff(_0x4a60d9){var _0x857b1f=moment()['milliseconds'](0x0);var _0x5e8c0e=moment(_0x4a60d9)['milliseconds'](0x0);return _0x857b1f[_0x3c9c('0x13')](_0x5e8c0e,'seconds');}Acw[_0x3c9c('0x14')][_0x3c9c('0x15')]=function(_0x1f725b,_0x824e63){var _0x4a43d2=this;var _0x265cc2=getDiff(_0x4a43d2['timers'][_0x1f725b]['lastPauseAt']);clearTimeout(_0x4a43d2['timers'][_0x1f725b][_0x3c9c('0x16')]);_0x4a43d2[_0x3c9c('0x17')][_0x1f725b][_0x3c9c('0x16')]=![];return RpcVoiceAgentReport[_0x3c9c('0x18')]({'acwtime':_0x265cc2},_0x4a43d2[_0x3c9c('0x17')][_0x1f725b][_0x3c9c('0x19')],_0x1f725b)[_0x3c9c('0x1a')](function(_0x56fa79){logger[_0x3c9c('0x1b')]('[%s][UPDATE][ACWTIME:%s]',_0x824e63,_0x265cc2,_0x56fa79);})[_0x3c9c('0x1c')](function(_0x5a8502){logger[_0x3c9c('0x1d')](_0x3c9c('0x1e'),_0x824e63,_0x5a8502);})['finally'](function(){delete _0x4a43d2[_0x3c9c('0x17')][_0x1f725b];});};Acw[_0x3c9c('0x14')][_0x3c9c('0x1f')]=function(_0x50359a){try{var _0x3faad1=this;var _0x249747=this[_0x3c9c('0x6')][_0x50359a][_0x3c9c('0x20')];var _0x99548e=this[_0x3c9c('0x6')][_0x50359a][_0x3c9c('0x21')];var _0x32e4c2=this['voiceQueues'][_0x99548e];var _0x6ed08a=![];var _0x4d58b9=_0x3c9c('0x22');if(_0x32e4c2[_0x3c9c('0x23')]&&_0x32e4c2['mandatoryDispositionPause']['name']){_0x6ed08a=!![];_0x4d58b9=_0x32e4c2[_0x3c9c('0x24')][_0x3c9c('0x25')];}if(!_0x3faad1[_0x3c9c('0x5')][_0x249747]){return Promise[_0x3c9c('0x26')]();}return RpcUser['getAgent'](_0x3faad1[_0x3c9c('0x5')][_0x249747]['id'])[_0x3c9c('0x1a')](function(_0x4f69ed){if(!_0x4f69ed||_0x4f69ed[_0x3c9c('0x27')]){logger['info']('[%s][INPAUSE][AGENT:%s][QUEUE:%s]',_0x50359a,_0x249747,_0x99548e);return;}logger[_0x3c9c('0x1b')](_0x3c9c('0x28'),_0x50359a,_0x249747,_0x99548e);var _0x333f2b=_0x3faad1[_0x3c9c('0x6')][_0x50359a][_0x3c9c('0x29')]&&_0x3faad1['channels'][_0x50359a][_0x3c9c('0x2a')]?_0x3faad1['channels'][_0x50359a][_0x3c9c('0x2a')]:_0x50359a;return RpcUser[_0x3c9c('0x2b')](_0x3faad1[_0x3c9c('0x5')][_0x249747],_0x4d58b9,_0x333f2b);})[_0x3c9c('0x1a')](function(_0x5793c1){if(_0x6ed08a||!_0x5793c1){return;}_0x3faad1[_0x3c9c('0x17')][_0x249747]={};logger[_0x3c9c('0x1b')](_0x3c9c('0x2c'),_0x50359a,_0x3faad1[_0x3c9c('0x4')][_0x99548e][_0x3c9c('0x2d')],_0x249747,_0x99548e);_0x3faad1[_0x3c9c('0x17')][_0x249747][_0x3c9c('0x16')]=setTimeout(_0x3faad1[_0x3c9c('0x2e')]['bind'](_0x3faad1,_0x249747),_0x3faad1[_0x3c9c('0x4')][_0x99548e][_0x3c9c('0x2d')]*0x3e8);_0x3faad1[_0x3c9c('0x17')][_0x249747][_0x3c9c('0x2f')]=moment()[_0x3c9c('0x30')](_0x3c9c('0x31'));_0x3faad1[_0x3c9c('0x17')][_0x249747][_0x3c9c('0x19')]=_0x50359a;_0x3faad1[_0x3c9c('0x17')][_0x249747][_0x3c9c('0x21')]=_0x99548e;_0x3faad1[_0x3c9c('0x17')][_0x249747][_0x3c9c('0x15')]=_0x3faad1[_0x3c9c('0x15')][_0x3c9c('0x9')](_0x3faad1,_0x249747,_0x50359a);})['catch'](function(){logger[_0x3c9c('0x1d')](_0x3c9c('0x2c'),_0x50359a,_0x3faad1[_0x3c9c('0x4')][_0x99548e]['acwTimeout'],_0x249747,_0x99548e);})[_0x3c9c('0x32')](function(){delete _0x3faad1[_0x3c9c('0x6')][_0x50359a];});}catch(_0x328441){logger[_0x3c9c('0x1d')]('[ACW][START]\x20%s',_0x328441['message']);}};Acw[_0x3c9c('0x14')][_0x3c9c('0x2e')]=function(_0x42d7cf){try{var _0x5a42bc=this;if(_0x5a42bc['timers'][_0x42d7cf]){_0x5a42bc[_0x3c9c('0x17')][_0x42d7cf]['timer']=![];var _0x5ace8e=_0x5a42bc[_0x3c9c('0x17')][_0x42d7cf][_0x3c9c('0x19')];var _0x228c3c=_0x5a42bc['timers'][_0x42d7cf][_0x3c9c('0x21')];var _0xe66d35=_0x5a42bc[_0x3c9c('0x4')][_0x228c3c]['acwTimeout'];logger['info']('[%s][TIMER][STOP][AGENT:%s]',_0x5ace8e,_0x42d7cf);RpcUser[_0x3c9c('0x33')](this[_0x3c9c('0x5')][_0x42d7cf]);RpcVoiceAgentReport[_0x3c9c('0x18')]({'acwtime':_0xe66d35,'agentacw':!![]},_0x5ace8e,_0x42d7cf)[_0x3c9c('0x1a')](function(_0x1a2d31){logger[_0x3c9c('0x1b')]('[%s][UPDATE][ACWTIME:%s]',_0x5ace8e,_0xe66d35,_0x1a2d31);})['catch'](function(_0xf71de8){logger[_0x3c9c('0x1d')](_0x3c9c('0x1e'),_0x5ace8e,_0xf71de8);});}else{logger['error'](_0x3c9c('0x34'),_0x42d7cf);if(_0x5a42bc[_0x3c9c('0x17')]){logger[_0x3c9c('0x1b')]('[ACW][TIMERS]',JSON['stringify'](_0x5a42bc[_0x3c9c('0x17')]));}}}catch(_0xdbac2a){logger[_0x3c9c('0x1d')]('[ACW][STOP]\x20%s',_0xdbac2a[_0x3c9c('0x35')]);}};Acw[_0x3c9c('0x14')][_0x3c9c('0x8')]=function(_0x3dbfc7){try{if(this['voiceQueues'][_0x3dbfc7[_0x3c9c('0x21')]]&&(this[_0x3c9c('0x4')][_0x3dbfc7['queue']]['acw']||this[_0x3c9c('0x4')][_0x3dbfc7[_0x3c9c('0x21')]]['mandatoryDisposition'])){if(this[_0x3c9c('0x5')][_0x3dbfc7[_0x3c9c('0x20')]]){this[_0x3c9c('0x6')][_0x3dbfc7[_0x3c9c('0x19')]]={'queue':_0x3dbfc7[_0x3c9c('0x21')],'interface':_0x3dbfc7[_0x3c9c('0x20')],'destlinkedid':_0x3dbfc7['destlinkedid']};}}}catch(_0x22d892){logger[_0x3c9c('0x1d')](_0x3c9c('0x36'),_0x22d892[_0x3c9c('0x35')]);}};Acw[_0x3c9c('0x14')]['syncAgentConnectPreview']=function(_0x5ef2be){try{if(this[_0x3c9c('0x4')][_0x5ef2be[_0x3c9c('0x21')]]&&(this[_0x3c9c('0x4')][_0x5ef2be[_0x3c9c('0x21')]][_0x3c9c('0x1')]||this['voiceQueues'][_0x5ef2be[_0x3c9c('0x21')]][_0x3c9c('0x23')])){if(this[_0x3c9c('0x5')][_0x5ef2be[_0x3c9c('0x20')]]){this[_0x3c9c('0x6')][_0x5ef2be['uniqueid']]={'queue':_0x5ef2be[_0x3c9c('0x21')],'interface':_0x5ef2be[_0x3c9c('0x20')]};}}}catch(_0x1804e3){logger[_0x3c9c('0x1d')](_0x3c9c('0x37'),_0x1804e3[_0x3c9c('0x35')]);}};Acw[_0x3c9c('0x14')]['syncHangupRequest']=function(_0x260d3b){try{if(this[_0x3c9c('0x6')][_0x260d3b[_0x3c9c('0x19')]]&&_[_0x3c9c('0x38')](this[_0x3c9c('0x6')][_0x260d3b[_0x3c9c('0x19')]]['attended'])){logger[_0x3c9c('0x1b')](_0x3c9c('0x39'),_0x260d3b[_0x3c9c('0x19')]);this[_0x3c9c('0x1f')](_0x260d3b[_0x3c9c('0x19')]);}else if(this[_0x3c9c('0x6')][_0x260d3b[_0x3c9c('0x3a')]]&&_[_0x3c9c('0x38')](this[_0x3c9c('0x6')][_0x260d3b[_0x3c9c('0x3a')]][_0x3c9c('0x29')])){logger[_0x3c9c('0x1b')](_0x3c9c('0x3b'),_0x260d3b[_0x3c9c('0x3a')]);this[_0x3c9c('0x1f')](_0x260d3b[_0x3c9c('0x3a')]);}}catch(_0x4ed837){logger['error']('[ACW][syncHangupRequest]\x20%s',_0x4ed837[_0x3c9c('0x35')]);}};Acw[_0x3c9c('0x14')][_0x3c9c('0xd')]=function(_0x20c090){try{if(this['channels'][_0x20c090[_0x3c9c('0x19')]]&&this['channels'][_0x20c090['uniqueid']][_0x3c9c('0x29')]){logger[_0x3c9c('0x1b')](_0x3c9c('0x3c'),_0x20c090[_0x3c9c('0x19')]);this[_0x3c9c('0x1f')](_0x20c090[_0x3c9c('0x19')]);}else if(this[_0x3c9c('0x6')][_0x20c090[_0x3c9c('0x3a')]]&&this[_0x3c9c('0x6')][_0x20c090['linkedid']][_0x3c9c('0x29')]){logger[_0x3c9c('0x1b')](_0x3c9c('0x3d'),_0x20c090[_0x3c9c('0x3a')]);this[_0x3c9c('0x1f')](_0x20c090[_0x3c9c('0x3a')]);}}catch(_0x356e9d){logger['error']('[ACW][syncHangup]\x20%s',_0x356e9d[_0x3c9c('0x35')]);}};Acw[_0x3c9c('0x14')][_0x3c9c('0xf')]=function(_0x7eccd0){try{if(!_[_0x3c9c('0x3e')](this[_0x3c9c('0x6')][_0x7eccd0[_0x3c9c('0x3f')]])){this[_0x3c9c('0x1f')](_0x7eccd0[_0x3c9c('0x3f')]);if(this[_0x3c9c('0x6')][_0x7eccd0[_0x3c9c('0x40')]]){this[_0x3c9c('0x6')][_0x7eccd0[_0x3c9c('0x40')]][_0x3c9c('0x29')]=!![];this['channels'][_0x7eccd0[_0x3c9c('0x41')]]=this[_0x3c9c('0x6')][_0x7eccd0[_0x3c9c('0x40')]];delete this[_0x3c9c('0x6')][_0x7eccd0[_0x3c9c('0x40')]];}}else if(!_['isNil'](this[_0x3c9c('0x6')][_0x7eccd0[_0x3c9c('0x41')]])){this['startAcw'](_0x7eccd0['transfertargetuniqueid']);if(this[_0x3c9c('0x6')][_0x7eccd0[_0x3c9c('0x42')]]){this['channels'][_0x7eccd0[_0x3c9c('0x42')]][_0x3c9c('0x29')]=!![];this[_0x3c9c('0x6')][_0x7eccd0[_0x3c9c('0x3f')]]=this[_0x3c9c('0x6')][_0x7eccd0[_0x3c9c('0x42')]];delete this[_0x3c9c('0x6')][_0x7eccd0[_0x3c9c('0x42')]];}}}catch(_0x114598){logger[_0x3c9c('0x1d')](_0x3c9c('0x43'),_0x114598['message']);}};Acw[_0x3c9c('0x14')]['syncBlindTransfer']=function(_0x4c63fc){try{if(this[_0x3c9c('0x6')][_0x4c63fc[_0x3c9c('0x44')]]){logger[_0x3c9c('0x1b')](_0x3c9c('0x45'),JSON[_0x3c9c('0x46')](_0x4c63fc[_0x3c9c('0x44')]));this[_0x3c9c('0x1f')](_0x4c63fc['transfereruniqueid']);}else if(this[_0x3c9c('0x6')][_0x4c63fc[_0x3c9c('0x47')]]){logger[_0x3c9c('0x1b')](_0x3c9c('0x48'),JSON[_0x3c9c('0x46')](_0x4c63fc['transfererlinkedid']));this['startAcw'](_0x4c63fc[_0x3c9c('0x47')]);}}catch(_0xe3249f){logger[_0x3c9c('0x1d')](_0x3c9c('0x49'),_0xe3249f[_0x3c9c('0x35')]);}};Acw[_0x3c9c('0x14')][_0x3c9c('0xe')]=function(_0x37946d){try{if(this[_0x3c9c('0x4')][_0x37946d[_0x3c9c('0x21')]]&&this[_0x3c9c('0x4')][_0x37946d[_0x3c9c('0x21')]][_0x3c9c('0x4a')]===_0x3c9c('0x4b')){if(this[_0x3c9c('0x5')][_0x37946d[_0x3c9c('0x20')]]){logger[_0x3c9c('0x1b')]('[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]',_0x37946d[_0x3c9c('0x19')],_0x37946d['interface'],_0x37946d['queue']);return RpcUser[_0x3c9c('0x2b')](this[_0x3c9c('0x5')][_0x37946d[_0x3c9c('0x20')]],'Auto-Pause',_0x37946d[_0x3c9c('0x19')]);}}}catch(_0x237c12){logger['error'](_0x3c9c('0x4c'),_0x237c12[_0x3c9c('0x35')]);}};module['exports']=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index 80cd18b..afbe9b1 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 _0xd793=['../../config/logger','ami','../../config/environment','asterisk','username','password','keepConnected','promisify','action','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','port','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','Action','sipshowregistry','devicestatelist','actionSipPeerStatus','sippeerstatus','actionQueueSummary','queuesummary','actionCoreShowChannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','connect','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','inspect','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','actionDeviceStateList','catch','[ami.js][fullybooted]','close','exports','asterisk-manager','bluebird','util'];(function(_0x27d8bc,_0x19e010){var _0x4b04cb=function(_0x524568){while(--_0x524568){_0x27d8bc['push'](_0x27d8bc['shift']());}};_0x4b04cb(++_0x19e010);}(_0xd793,0x1cb));var _0x3d79=function(_0x15d0c4,_0x266d9a){_0x15d0c4=_0x15d0c4-0x0;var _0x38af81=_0xd793[_0x15d0c4];return _0x38af81;};'use strict';var Manager=require(_0x3d79('0x0'));var BPromise=require(_0x3d79('0x1'));var util=require(_0x3d79('0x2'));var logger=require(_0x3d79('0x3'))(_0x3d79('0x4'));var config=require(_0x3d79('0x5'));var ami=new Manager(config[_0x3d79('0x6')]['port'],config['asterisk']['ip'],config['asterisk'][_0x3d79('0x7')],config[_0x3d79('0x6')][_0x3d79('0x8')],!![]);ami[_0x3d79('0x9')]();ami['Action']=BPromise[_0x3d79('0xa')](ami[_0x3d79('0xb')]);function error(_0x1265df){logger[_0x3d79('0xc')](util[_0x3d79('0xd')](_0x3d79('0xe'),config[_0x3d79('0x6')][_0x3d79('0x7')],config[_0x3d79('0x6')]['ip'],config[_0x3d79('0x6')][_0x3d79('0xf')],util['inspect'](_0x1265df,![],null)));}function close(){logger['error'](util[_0x3d79('0xd')](_0x3d79('0x10'),config[_0x3d79('0x6')][_0x3d79('0x7')],config[_0x3d79('0x6')]['ip'],config[_0x3d79('0x6')][_0x3d79('0xf')]));}ami[_0x3d79('0x11')]=function(){return function(){return ami[_0x3d79('0x12')]({'action':_0x3d79('0x13')});};};ami['actionDeviceStateList']=function(){return function(){return ami[_0x3d79('0x12')]({'action':_0x3d79('0x14')});};};ami[_0x3d79('0x15')]=function(){return function(){return ami[_0x3d79('0x12')]({'action':_0x3d79('0x16')});};};ami[_0x3d79('0x17')]=function(){return function(){return ami[_0x3d79('0x12')]({'action':_0x3d79('0x18')});};};ami[_0x3d79('0x19')]=function(){return function(){return ami[_0x3d79('0x12')]({'action':'coreshowchannels'});};};function connect(){logger[_0x3d79('0x1a')](util[_0x3d79('0xd')](_0x3d79('0x1b'),config[_0x3d79('0x6')][_0x3d79('0x7')],config['asterisk']['ip'],config['asterisk'][_0x3d79('0xf')]));ami['once']('error',error);ami[_0x3d79('0x1c')]('close',close);}ami['on'](_0x3d79('0x1d'),connect);ami['on'](_0x3d79('0x1e'),function(_0x30cdc3){logger[_0x3d79('0x1a')](util[_0x3d79('0xd')](_0x3d79('0x1f'),config[_0x3d79('0x6')][_0x3d79('0x7')],config[_0x3d79('0x6')]['ip'],config[_0x3d79('0x6')]['port'],util[_0x3d79('0x20')](_0x30cdc3,![],null)));});ami['on'](_0x3d79('0x21'),function(){logger['info'](util[_0x3d79('0xd')](_0x3d79('0x22'),config[_0x3d79('0x6')][_0x3d79('0x7')],config['asterisk']['ip'],config[_0x3d79('0x6')][_0x3d79('0xf')]));return Promise[_0x3d79('0x23')]()[_0x3d79('0x24')](ami[_0x3d79('0x11')]())[_0x3d79('0x24')](ami[_0x3d79('0x25')]())['then'](ami[_0x3d79('0x15')]())[_0x3d79('0x24')](ami[_0x3d79('0x17')]())[_0x3d79('0x24')](ami[_0x3d79('0x19')]())[_0x3d79('0x26')](function(_0xb4a866){logger[_0x3d79('0xc')](_0x3d79('0x27'),util['inspect'](_0xb4a866,{'showHidden':![],'depth':null}));});});ami['once']('error',error);ami['once'](_0x3d79('0x28'),close);module[_0x3d79('0x29')]=ami; \ No newline at end of file +var _0x6812=['Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','close','connect','shutdown','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','actionDeviceStateList','actionSipPeerStatus','[ami.js][fullybooted]','once','asterisk-manager','bluebird','ami','../../config/environment','asterisk','port','username','password','promisify','action','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','error','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','Action','devicestatelist','actionQueueSummary','queuesummary','actionCoreShowChannels','coreshowchannels','info'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6812,0x18d));var _0x2681=function(_0x5a30bd,_0x9a5ed4){_0x5a30bd=_0x5a30bd-0x0;var _0x504c23=_0x6812[_0x5a30bd];return _0x504c23;};'use strict';var Manager=require(_0x2681('0x0'));var BPromise=require(_0x2681('0x1'));var util=require('util');var logger=require('../../config/logger')(_0x2681('0x2'));var config=require(_0x2681('0x3'));var ami=new Manager(config[_0x2681('0x4')][_0x2681('0x5')],config[_0x2681('0x4')]['ip'],config[_0x2681('0x4')][_0x2681('0x6')],config[_0x2681('0x4')][_0x2681('0x7')],!![]);ami['keepConnected']();ami['Action']=BPromise[_0x2681('0x8')](ami[_0x2681('0x9')]);function error(_0x27551d){logger['error'](util[_0x2681('0xa')](_0x2681('0xb'),config[_0x2681('0x4')][_0x2681('0x6')],config['asterisk']['ip'],config[_0x2681('0x4')][_0x2681('0x5')],util[_0x2681('0xc')](_0x27551d,![],null)));}function close(){logger[_0x2681('0xd')](util[_0x2681('0xa')](_0x2681('0xe'),config[_0x2681('0x4')][_0x2681('0x6')],config[_0x2681('0x4')]['ip'],config['asterisk']['port']));}ami[_0x2681('0xf')]=function(){return function(){return ami[_0x2681('0x10')]({'action':'sipshowregistry'});};};ami['actionDeviceStateList']=function(){return function(){return ami['Action']({'action':_0x2681('0x11')});};};ami['actionSipPeerStatus']=function(){return function(){return ami[_0x2681('0x10')]({'action':'sippeerstatus'});};};ami[_0x2681('0x12')]=function(){return function(){return ami[_0x2681('0x10')]({'action':_0x2681('0x13')});};};ami[_0x2681('0x14')]=function(){return function(){return ami[_0x2681('0x10')]({'action':_0x2681('0x15')});};};function connect(){logger[_0x2681('0x16')](util['format'](_0x2681('0x17'),config[_0x2681('0x4')][_0x2681('0x6')],config['asterisk']['ip'],config[_0x2681('0x4')][_0x2681('0x5')]));ami['once']('error',error);ami['once'](_0x2681('0x18'),close);}ami['on'](_0x2681('0x19'),connect);ami['on'](_0x2681('0x1a'),function(_0x15212d){logger[_0x2681('0x16')](util[_0x2681('0xa')]('Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s',config[_0x2681('0x4')]['username'],config[_0x2681('0x4')]['ip'],config[_0x2681('0x4')][_0x2681('0x5')],util[_0x2681('0xc')](_0x15212d,![],null)));});ami['on'](_0x2681('0x1b'),function(){logger[_0x2681('0x16')](util[_0x2681('0xa')](_0x2681('0x1c'),config[_0x2681('0x4')][_0x2681('0x6')],config['asterisk']['ip'],config[_0x2681('0x4')][_0x2681('0x5')]));return Promise[_0x2681('0x1d')]()[_0x2681('0x1e')](ami[_0x2681('0xf')]())[_0x2681('0x1e')](ami[_0x2681('0x1f')]())['then'](ami[_0x2681('0x20')]())[_0x2681('0x1e')](ami[_0x2681('0x12')]())[_0x2681('0x1e')](ami['actionCoreShowChannels']())['catch'](function(_0x5cbc84){logger['error'](_0x2681('0x21'),util[_0x2681('0xc')](_0x5cbc84,{'showHidden':![],'depth':null}));});});ami[_0x2681('0x22')](_0x2681('0xd'),error);ami[_0x2681('0x22')](_0x2681('0x18'),close);module['exports']=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index 069c255..4641aaf 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 _0xac4a=['ami','client','http','then','debug','memberReport','error','message','result','catch','rpc','jayson/promise','bluebird','../../config/logger'];(function(_0x3d6db1,_0x4358f8){var _0x5e1cc3=function(_0x3ad5af){while(--_0x3ad5af){_0x3d6db1['push'](_0x3d6db1['shift']());}};_0x5e1cc3(++_0x4358f8);}(_0xac4a,0x13f));var _0xaac4=function(_0x5b4bbe,_0x109552){_0x5b4bbe=_0x5b4bbe-0x0;var _0x2d41eb=_0xac4a[_0x5b4bbe];return _0x2d41eb;};'use strict';var jayson=require(_0xaac4('0x0'));var BPromise=require(_0xaac4('0x1'));var logger=require(_0xaac4('0x2'))(_0xaac4('0x3'));var client=jayson[_0xaac4('0x4')][_0xaac4('0x5')]({'port':0x2329});client['Request']=function(_0x58626e,_0x2af0f6){return new BPromise(function(_0x2a5762,_0x32d34c){return client['request'](_0x58626e,_0x2af0f6)[_0xaac4('0x6')](function(_0x53d03a){logger[_0xaac4('0x7')]('rpc',_0xaac4('0x8'),_0x58626e,_0x2af0f6,_0x53d03a);if(_0x53d03a[_0xaac4('0x9')]){logger['error']('rpc',_0xaac4('0x8'),_0x58626e,_0x53d03a['error'][_0xaac4('0xa')],_0x2af0f6);return _0x32d34c(_0x53d03a['error']['message']);}else{return _0x2a5762(_0x53d03a[_0xaac4('0xb')]);}})[_0xaac4('0xc')](function(_0x38d1d0){logger[_0xaac4('0x9')](_0xaac4('0xd'),'memberReport',_0x58626e,_0x38d1d0,_0x2af0f6);return _0x32d34c(_0x38d1d0);});});};module['exports']=client; \ No newline at end of file +var _0x9ffd=['catch','exports','jayson/promise','bluebird','../../config/logger','client','http','Request','then','debug','rpc','memberReport','error','result'];(function(_0x64c056,_0x12ca6c){var _0x2a1aba=function(_0x774be6){while(--_0x774be6){_0x64c056['push'](_0x64c056['shift']());}};_0x2a1aba(++_0x12ca6c);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x442c1e,_0x51dcd0){_0x442c1e=_0x442c1e-0x0;var _0x439e36=_0x9ffd[_0x442c1e];return _0x439e36;};'use strict';var jayson=require(_0xd9ff('0x0'));var BPromise=require(_0xd9ff('0x1'));var logger=require(_0xd9ff('0x2'))('ami');var client=jayson[_0xd9ff('0x3')][_0xd9ff('0x4')]({'port':0x2329});client[_0xd9ff('0x5')]=function(_0x5493ae,_0x53e962){return new BPromise(function(_0x1c9460,_0x111697){return client['request'](_0x5493ae,_0x53e962)[_0xd9ff('0x6')](function(_0x2982c3){logger[_0xd9ff('0x7')](_0xd9ff('0x8'),_0xd9ff('0x9'),_0x5493ae,_0x53e962,_0x2982c3);if(_0x2982c3[_0xd9ff('0xa')]){logger[_0xd9ff('0xa')](_0xd9ff('0x8'),_0xd9ff('0x9'),_0x5493ae,_0x2982c3['error']['message'],_0x53e962);return _0x111697(_0x2982c3['error']['message']);}else{return _0x1c9460(_0x2982c3[_0xd9ff('0xb')]);}})[_0xd9ff('0xc')](function(_0x193537){logger[_0xd9ff('0xa')](_0xd9ff('0x8'),_0xd9ff('0x9'),_0x5493ae,_0x193537,_0x53e962);return _0x111697(_0x193537);});});};module[_0xd9ff('0xd')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index 5d5ad09..2220181 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 _0xc7fc=['---------------------------','merge','getSeconds','startProgressive','name','startProgressive\x20value\x20cleared','startPredictive\x20value\x20cleared','handlePredictive','handlePredictive\x20interval\x20cleared','error','stack','checkContactLowerLimitOriginate','message','CAMPAIGN_STATUS','CONTACTS_RESCHEDULED','[getContactDialer2][ReScheduled]','contactsRescheduled','contacts','NO_AVAILABLE_CONTACTS','[getContactDialer2][Empty]','statedesc','endtime','starttime','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','stringify','pick','Interval','\x20INTERVAL_IS_NULL','Intervals','NULL_INTERVAL','isIVRCampaignActive','INACTIVE','\x20NOT\x20Active','isIVRCampaign','format','campaign:ivr:%s','campaign:save','sendMessageOneNotActive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','DISACTIVED','is\x20disactive','[ifTime][Action]','isTrunkReachable','active','SIP/%s','status','unmonitored','prototype','Trunk','TRUNK_NOT_REACHABLE','checkIfTime','ifTimeIvr','checkIfTimeIntervals','ifTime','\x20Intervals\x20is\x20null\x20','EMPTY_INTERVAL','Failure','\x20Intervals\x20is\x20empty\x20','UNKNOWN_TIMEZONE','isArray','length','push','Action','then','content','indexOf','true','iftime\x20%s,%s','timezones','catch','all','some','OVERTIME_GLOBAL_INTERVAL','OVERTIME_INTERVAL','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','resetActiveCalls','syncCampaigns','undefined','resolve','checkIsTrunkReachable','dialGlobalInterval','dialTimezone','launchHandleIvr','checkDialMethod','power','handlePower','dialPowerLevel','Queue','silly','Voice\x20Queue\x20%s\x20$s','isGlobal','AMI\x20IfTime','Error','queue','uniqueid','ivr','updateOriginated','YYYY-MM-DD\x20HH:mm:ss','outboundAnswerCallsDay','agent','agiafterat','dialAgiAfterHangupAgent','createHistory','[syncAgentComplete][createHistory]','moveContactManagedDialer','droptime','dialQueueTimeout','outboundDropCallsDayTimeout','predictiveIntervalErlangCallsDroppedCalls','state','Drop','TIMEOUT','countglobal','dialDropRetryFrequency','callAdditionalPhoneAfterMin','voiceQueue','rescheduleContact','minutes','ContactId','ListId','VoiceQueueId','CampaignId','[rescheduleContact][Drop]','calleridname','calleridnum','swapAdditionalPhones','predictiveIntervalDroppedCallsCallersExit','outboundDropCallsDayCallersExit','CALLEREXIT','countabandonedretry','dialAbandonedRetryFrequency','dialAbandonedMaxRetry','queueCallerAbandonCreateState','additional','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','syncNewExten','actions','channel','actionid','rrmemory','isNil','paused','stateinterface','locked','idHopper','strategy','roundrobin','preview','run','[Catch][Preview][syncQueueStatusComplete]','_rr','unlockRR','[booked][RR]','Agent:\x20','[booked][RR][finaly]','contactAgent-idHopper:\x20','[booked][unlock]','[unlock][syncQueueStatusComplete]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','Success','callProgressDetecting','[callProgressDetecting]\x20','variable','amdstatus','exten','xcally-motion-dialer','value','HANGUP','outboundAnswerAgiCallsDay','HangupInAMD','membername','AMD','custom:amd','amd','saveInDb','[syncHangupInAMD][createHistory]','MACHINE','Machine','buildObj','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countmachineretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','reason\x2019\x20machine....','[rescheduleContact][Machine]','dialAMDActive','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','countdropretry','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','cause-txt','syncQueueSummary','running','statusMessage','getQueueCampaignStatusMessage','available','talking','pTalking','ACTIVE','compareToOutboundQueue','queueSummaryCountersUpdated','assign','[syncQueueSummary]','syncQueueSummaryComplete','throttle','filter','online','reachable','map','Agent','user:%s','user:dialPreviewRecallReminder','checkPreviewRecallReminder','[uniqueid]','clearZombieChannels','[actions]','No\x20such\x20channel','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','getVoiceQueueRtPauses','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','notFound','UserId','[emptyContact][createHistory]','[syncQueueCallerAbandon]\x20[Drop]','handlePreviewRecallNotifications','handleIvr','voiceQueue\x20is\x20undefine','phone','originate','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','isOutboundQueue','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-CAMPAIGNID','getCallerId','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','TrunkBackup','XMD-ORIGINATECALLERIDNAME','extractCalleridName','variables','dialPrefix','trim','dialCutDigit','substring','from-sip','outboundOriginateFailureCallsDay','[originateError]:\x20%s','[originate][error]','originate\x20action\x20Error','checkRetriveMax','dialNoAnswerMaxRetry','[rescheduleContact][NoAnswer]','add','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialDropMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','[callProgressDetecting]','entity\x20is\x20undefine','object','verifyAdditionalPhones','reason','outboundNoSuchCallsDay','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','createStateFinal','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','NoAnswer','buildNoAnswerEventPayload','custom:agentnoanswer','dialNoAnswerRetryFrequency','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','Busy','custom:agentbusy','[syncAgentComplete][createHistory][5]','dialBusyMaxRetry','reason\x205\x20busy','outboundCongestionCallsDay','Congestion','dialCongestionRetryFrequency','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','Abandoned','reason\x2011\x20abandoned','outboundRejectCallsDay','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','outboundUnknownCallsDay','Global','[moveContactManagedDialer][0]','dialPredictiveOptimizationPercentage','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','floor','erlangCalls','predictiveIntervalHitRate','[startMethodPredictive][StartProgressive]','dialPredictiveOptimization','Dropped\x20calls\x20day','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','avgHandleTime','dialPredictiveInterval','startMethodPredictive','recalculate\x20predictive\x20at','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(','getDataPredictive','predictiveIntervalAnsweredCalls','abandonmentRate','agentBusyFactor','busyFactor','[getDataPredictive]','check\x20failure','getDataPredictiveOld','loggedIn','outboundQueuePauses','predictiveIntervalPauses','[CatchErlangB]','one\x20call\x20every:','milliseconds','[handlePredictive]','checkContactBlack','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','actionOriginate','scheduledat','dialRecallMeTimeout','voicePause','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','QUEUE_RECALL','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','outboundBlacklistCallsDay','BLACKLIST','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','temp','getContactDialerIvr','[getContactCampaign2][Empty]','ivrTotalCallsDays','emptyContact','[actionOriginate]\x20','checkIsBlackListIvr','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','dialMethod','getContactDialer','checkContactEmpty','countReScheduled','[countReScheduled]\x20','RUNNING','tryOriginatePredictive','[handlePredictive][limitChannel]','not_inuse','dialOrderByScheduledAt','[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','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]','Amax\x20=\x20','erlangb','----\x20Agent\x20Busy\x20Factor\x20----','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','Ts\x20=\x20','p\x20=\x20','interval\x20=\x20','exports','util','lodash','uuid','moment','ioredis','./utils/hopper','../../../config/environment/','../../../config/logger','dialer','booked','predictive','predictiveCalls','../ami','redis','defaults','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/voiceQueueRt','../rpc/setting','../rpc/interval','./models/history','./models/agentComplete','./models/queueCallerAbandon','XCALLY_IP_AGI','127.0.0.1','enqueue','tail','finally','sequence','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','contactsId','uniqueId','startPredictive','ivrOriginated','queueBooked','queueBookedRR','queuesSummary','agentconnect','syncAgentConnect','bind','queuecallerabandon','syncOriginateResponse','syncAgentComplete','custom:queuesummarycomplete','hangup','syncHangup','newexten','varset','syncVarSet','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','getSettings','previewRecallmeReminderInterval','emit','type','outbound','debug','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','inspect','voice:queue:%s','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','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsTimeout','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','predictiveIntervalTotalCalls','isUndefined','Avg\x20Talk\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','erlangCallToSecond','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangAbandonmentRate','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangBusyFactor'];(function(_0x3d09e2,_0x58e784){var _0x5d03cd=function(_0x40f355){while(--_0x40f355){_0x3d09e2['push'](_0x3d09e2['shift']());}};_0x5d03cd(++_0x58e784);}(_0xc7fc,0x1bc));var _0xcc7f=function(_0x1f920b,_0x483654){_0x1f920b=_0x1f920b-0x0;var _0x17d3c5=_0xc7fc[_0x1f920b];return _0x17d3c5;};'use strict';var util=require(_0xcc7f('0x0'));var _=require(_0xcc7f('0x1'));var uuid=require(_0xcc7f('0x2'));var moment=require(_0xcc7f('0x3'));var rr=require('rr');var Redis=require(_0xcc7f('0x4'));var utils=require('./utils');var hopperUtils=require(_0xcc7f('0x5'));var ut=require('../preview/util/util');var config=require(_0xcc7f('0x6'));var logger=require(_0xcc7f('0x7'))(_0xcc7f('0x8'));var loggerBooked=require(_0xcc7f('0x7'))(_0xcc7f('0x9'));var loggerPredictive=require(_0xcc7f('0x7'))(_0xcc7f('0xa'));var loggerPredictiveCalls=require(_0xcc7f('0x7'))(_0xcc7f('0xb'));var loggerSyncQueueSummary=require(_0xcc7f('0x7'))('syncQueueSummary');var ami=require(_0xcc7f('0xc'));config[_0xcc7f('0xd')]=_[_0xcc7f('0xe')](config['redis'],{'host':_0xcc7f('0xf'),'port':0x18eb});var io=require(_0xcc7f('0x10'))(new Redis(config[_0xcc7f('0xd')]));var cmHopper=require(_0xcc7f('0x11'));var voiceQueueRt=require(_0xcc7f('0x12'));var RpcSetting=require(_0xcc7f('0x13'));var Interval=require(_0xcc7f('0x14'));var Action=require('./models/action');var History=require(_0xcc7f('0x15'));var Final=require('./models/final');var AgentComplete=require(_0xcc7f('0x16'));var QueueCallerAbandon=require(_0xcc7f('0x17'));var Hangup=require('./models/hangup');var ipAgi=process['env'][_0xcc7f('0x18')]||_0xcc7f('0x19');var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence['prototype'][_0xcc7f('0x1a')]=function(_0x361212){this['tail']=this[_0xcc7f('0x1b')]?this[_0xcc7f('0x1b')][_0xcc7f('0x1c')](_0x361212):_0x361212();};function Dialer(_0x503cfe,_0x5e6a3c){this[_0xcc7f('0x1d')]=new Sequence();this['preview']=_0x5e6a3c;this[_0xcc7f('0x1e')]=_0x503cfe['voiceQueues'];this[_0xcc7f('0x1f')]=_0x503cfe[_0xcc7f('0x1f')];this[_0xcc7f('0x20')]=_0x503cfe[_0xcc7f('0x20')];this[_0xcc7f('0x21')]=_0x503cfe['trunks'];this[_0xcc7f('0x22')]=config[_0xcc7f('0x22')]||0x2;this[_0xcc7f('0x23')]={};this['actions']={};this[_0xcc7f('0x24')]={};this[_0xcc7f('0x25')]={};this['optionPredictive']={};this[_0xcc7f('0x26')]={};this['startProgressive']={};this[_0xcc7f('0x27')]={};this[_0xcc7f('0x28')]={};this[_0xcc7f('0x29')]={};this[_0xcc7f('0x2a')]={};ami['on'](_0xcc7f('0x2b'),this[_0xcc7f('0x2c')][_0xcc7f('0x2d')](this));ami['on'](_0xcc7f('0x2e'),this['syncQueueCallerAbandon'][_0xcc7f('0x2d')](this));ami['on']('originateresponse',this[_0xcc7f('0x2f')][_0xcc7f('0x2d')](this));ami['on']('agentcomplete',this[_0xcc7f('0x30')][_0xcc7f('0x2d')](this));ami['on']('custom:queuesummary',this['syncQueueSummary'][_0xcc7f('0x2d')](this));ami['on'](_0xcc7f('0x31'),this['syncQueueSummaryComplete'][_0xcc7f('0x2d')](this));ami['on'](_0xcc7f('0x32'),this[_0xcc7f('0x33')][_0xcc7f('0x2d')](this));ami['on'](_0xcc7f('0x34'),this['syncNewExten']['bind'](this));ami['on'](_0xcc7f('0x35'),this[_0xcc7f('0x36')][_0xcc7f('0x2d')](this));ami['on']('queuemember',this[_0xcc7f('0x37')][_0xcc7f('0x2d')](this));ami['on'](_0xcc7f('0x38'),this[_0xcc7f('0x39')][_0xcc7f('0x2d')](this));this[_0xcc7f('0x3a')]();this[_0xcc7f('0x3b')]();RpcSetting[_0xcc7f('0x3c')]()['then'](function(_0x33abcb){previewRecallmeReminderInterval=_0x33abcb[_0xcc7f('0x3d')];});}function isNotNull(_0x383854){return _0x383854!==null&&!_['isUndefined'](_0x383854);}function msgResponse(_0x27a0c6,_0xcb0c09,_0x3a3cb7){return{'action':_0x27a0c6,'response':_0xcb0c09,'message':_0x3a3cb7,'stack':_0x3a3cb7};}function emit(_0x108aed,_0x409186,_0x3a7d5c){io['to'](_0x108aed)[_0xcc7f('0x3e')](_0x409186,_0x3a7d5c);}function emitOutboundVoiceQueueSummary(_0x3f95e9){if(_0x3f95e9[_0xcc7f('0x3f')]===_0xcc7f('0x40')){logger[_0xcc7f('0x41')](_0xcc7f('0x42'),util[_0xcc7f('0x43')](_0x3f95e9,{'showHidden':![],'depth':null}));emit(util['format'](_0xcc7f('0x44'),_0x3f95e9['name']),_0xcc7f('0x45'),_0x3f95e9);}}function checkGetDataPredictive(_0x532bef){if(isNotNull(_0x532bef)&&!_[_0xcc7f('0x46')](_0x532bef)){loggerPredictive[_0xcc7f('0x47')](_0xcc7f('0x48'));loggerPredictive[_0xcc7f('0x47')](_0xcc7f('0x49'),_0x532bef['predictiveIntervalTotalCalls']);loggerPredictive[_0xcc7f('0x47')](_0xcc7f('0x4a'),_0x532bef['predictiveIntervalAnsweredCalls']);loggerPredictive[_0xcc7f('0x47')](_0xcc7f('0x4b'),_0x532bef[_0xcc7f('0x4c')]);loggerPredictive[_0xcc7f('0x47')]('Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x532bef['predictiveIntervalDroppedCallsCallersExit']);loggerPredictive[_0xcc7f('0x47')](_0xcc7f('0x4d'),_0x532bef[_0xcc7f('0x4e')]);loggerPredictive[_0xcc7f('0x47')](_0xcc7f('0x4f'),_0x532bef[_0xcc7f('0x50')]);loggerPredictive['info']('---------------------------');if(_0x532bef[_0xcc7f('0x51')]>0x0){if(!_[_0xcc7f('0x52')](_0x532bef[_0xcc7f('0x50')])&&_0x532bef['predictiveIntervalAvgTalktime']>0x0){return!![];}loggerPredictive['info'](_0xcc7f('0x53'));if(!_['isUndefined'](_0x532bef['predictiveIntervalAvgHoldtime'])&&_0x532bef[_0xcc7f('0x4e')]>0x0){return!![];}loggerPredictive[_0xcc7f('0x47')]('Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive');}else{loggerPredictive[_0xcc7f('0x47')](_0xcc7f('0x54'));}}else{loggerPredictive[_0xcc7f('0x47')](_0xcc7f('0x55'));}return![];}function mergeDataErlangB(_0x57b49f){return function(_0x4d7f8b){loggerPredictive[_0xcc7f('0x47')](_0xcc7f('0x56'));loggerPredictive[_0xcc7f('0x47')](_0xcc7f('0x57'),_0x4d7f8b['erlangCalls']);loggerPredictive[_0xcc7f('0x47')]('One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x4d7f8b[_0xcc7f('0x58')]);loggerPredictive[_0xcc7f('0x47')](_0xcc7f('0x59'),_0x4d7f8b[_0xcc7f('0x5a')]);loggerPredictive[_0xcc7f('0x47')](_0xcc7f('0x5b'),_0x4d7f8b[_0xcc7f('0x5c')]);loggerPredictive['info'](_0xcc7f('0x59'),_0x4d7f8b['erlangAbandonmentRate']);loggerPredictive[_0xcc7f('0x47')](_0xcc7f('0x5d'));_[_0xcc7f('0x5e')](_0x57b49f,_0x4d7f8b);};}function ifInterval(_0x412163,_0x194a23){if(_['isUndefined'](_0x194a23)){return![];}return utils[_0xcc7f('0x5f')](undefined,_0x194a23)<_0x412163*0x3c;}function clearPredictiveAttributes(_0x165b9e){if(_0x165b9e[_0xcc7f('0x60')]){_0x165b9e[_0xcc7f('0x60')]=undefined;loggerPredictive[_0xcc7f('0x41')](_0x165b9e[_0xcc7f('0x61')],_0xcc7f('0x62'));}if(_0x165b9e['startPredictive']){_0x165b9e[_0xcc7f('0x26')]=undefined;loggerPredictive[_0xcc7f('0x41')](_0x165b9e[_0xcc7f('0x61')],_0xcc7f('0x63'));}if(_0x165b9e[_0xcc7f('0x64')]){clearInterval(_0x165b9e[_0xcc7f('0x64')]);_0x165b9e[_0xcc7f('0x64')]=undefined;loggerPredictive['debug'](_0x165b9e[_0xcc7f('0x61')],_0xcc7f('0x65'));}}function loggerCatchPredictive(_0x44fa39,_0x34bb03){return function(_0x30038f){loggerPredictive['error'](_0x34bb03['name'],_0x44fa39);loggerPredictive[_0xcc7f('0x66')](_0x30038f[_0xcc7f('0x67')]);clearPredictiveAttributes(_0x34bb03);};}function loggerCatch(_0x42bd3a){return function(_0x2cd448){logger['error'](_0x42bd3a,util[_0xcc7f('0x43')](_0x2cd448,{'showHidden':![],'depth':null}));};}function loggerGetContactDialer(_0x2f577e,_0x28ea92,_0x4c26bd){return function(_0x1b8474){utils[_0xcc7f('0x68')](_0x28ea92,_0x4c26bd,0x0);logger[_0xcc7f('0x66')](_0x2f577e,util[_0xcc7f('0x43')](_0x1b8474,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x1a9bd2){return function(_0x35581b){if(isNotNull(_0x35581b)&&isNotNull(_0x35581b[0x0])){if(_0x35581b[0x0]['contactsRescheduled']>0x0){_0x1a9bd2[_0xcc7f('0x69')]=utils[_0xcc7f('0x6a')][_0xcc7f('0x6b')];logger['info'](_0xcc7f('0x6c')+_0x1a9bd2[_0xcc7f('0x61')],_0x35581b[0x0][_0xcc7f('0x6d')],_0xcc7f('0x6e'));}else{_0x1a9bd2['message']=utils['CAMPAIGN_STATUS'][_0xcc7f('0x6f')];logger[_0xcc7f('0x47')](_0xcc7f('0x70')+_0x1a9bd2['name']);}}};}function createObjHistory(_0x54c6e4,_0x52ca34,_0x5ca006,_0x3495d2,_0x274c72){_0x54c6e4[_0xcc7f('0x69')]=_0x5ca006;var _0xd23f02=new Action(_0x54c6e4,_0x52ca34);var _0x111dfd=new History(_0xd23f02);_0x111dfd['state']=_0x3495d2;_0x111dfd[_0xcc7f('0x71')]=_0x274c72;_0x111dfd[_0xcc7f('0x72')]=_0xd23f02[_0xcc7f('0x73')];return _0x111dfd;}function unlockQueueStatus(_0x23a2a4,_0x5e8b07){setTimeout(function(){if(_[_0xcc7f('0x52')](_0x23a2a4[_0xcc7f('0x74')])){loggerBooked['error'](_0xcc7f('0x75'),_0x5e8b07);}_0x23a2a4['queueStatusComplete']=!![];loggerBooked['info'](_0xcc7f('0x76'),_0x5e8b07,JSON[_0xcc7f('0x77')](_[_0xcc7f('0x78')](_0x23a2a4,[_0xcc7f('0x61'),_0xcc7f('0x74')])));},0x1f3);}function checkInterval(_0x2f5381){return function(){if(!isNotNull(_0x2f5381[_0xcc7f('0x79')])){_0x2f5381['message']=utils[_0xcc7f('0x6a')]['NULL_INTERVAL'];throw _0x2f5381[_0xcc7f('0x61')]+_0xcc7f('0x7a');}if(!isNotNull(_0x2f5381['Interval'][_0xcc7f('0x7b')])){_0x2f5381['message']=utils['CAMPAIGN_STATUS'][_0xcc7f('0x7c')];throw _0x2f5381[_0xcc7f('0x61')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_[_0xcc7f('0x46')](_0x2f5381[_0xcc7f('0x79')][_0xcc7f('0x7b')]))){_0x2f5381['message']=utils[_0xcc7f('0x6a')][_0xcc7f('0x7c')];throw _0x2f5381[_0xcc7f('0x61')]+'\x20INTERVAL_IS_NULL';}};}function checkIsIVRCampaignActive(_0x17a0fe){return function(){if(!utils[_0xcc7f('0x7d')](_0x17a0fe)){_0x17a0fe['message']=utils[_0xcc7f('0x6a')][_0xcc7f('0x7e')];throw _0x17a0fe[_0xcc7f('0x61')]+_0xcc7f('0x7f');}};}function emitCampaignSummary(_0x5adc92){if(utils[_0xcc7f('0x80')](_0x5adc92)){emit(util[_0xcc7f('0x81')](_0xcc7f('0x82'),_0x5adc92[_0xcc7f('0x61')]),_0xcc7f('0x83'),_0x5adc92);}}function loggerCatchQueueSummary(_0x1930d1,_0x1882f9){return function(_0x71b3ad){clearPredictiveAttributes(_0x1882f9);emitCampaignSummary(_0x1882f9);loggerSyncQueueSummary[_0xcc7f('0x41')](_0x1930d1,util[_0xcc7f('0x43')](_0x71b3ad,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x28efd2){if(_0x28efd2[_0xcc7f('0x84')]){if(_0x28efd2['originated']===0x0){_0x28efd2[_0xcc7f('0x84')]=![];_0x28efd2[_0xcc7f('0x69')]=utils[_0xcc7f('0x6a')][_0xcc7f('0x7e')];loggerSyncQueueSummary[_0xcc7f('0x41')](_0xcc7f('0x85'),_0x28efd2[_0xcc7f('0x61')],'is\x20not\x20active');}else{_0x28efd2[_0xcc7f('0x69')]=utils['CAMPAIGN_STATUS'][_0xcc7f('0x86')];loggerSyncQueueSummary[_0xcc7f('0x41')](_0xcc7f('0x85'),_0x28efd2[_0xcc7f('0x61')],_0xcc7f('0x87'));}emitCampaignSummary(_0x28efd2);}}function myreject(_0x268748){return function(_0x57519e){return _0x268748(msgResponse(_0xcc7f('0x88'),'Error',JSON[_0xcc7f('0x77')](_0x57519e)));};}Dialer['prototype'][_0xcc7f('0x89')]=function(_0x211401){return!_[_0xcc7f('0x52')](_0x211401)&&_0x211401&&!_['isUndefined'](_0x211401[_0xcc7f('0x61')])&&!_[_0xcc7f('0x52')](_0x211401['active'])&&_0x211401[_0xcc7f('0x8a')]&&(this[_0xcc7f('0x21')][util[_0xcc7f('0x81')](_0xcc7f('0x8b'),_0x211401[_0xcc7f('0x61')])][_0xcc7f('0x8c')]==='reachable'||this['trunks'][util[_0xcc7f('0x81')](_0xcc7f('0x8b'),_0x211401[_0xcc7f('0x61')])][_0xcc7f('0x8c')]===_0xcc7f('0x8d'));};Dialer[_0xcc7f('0x8e')]['checkIsTrunkReachable']=function(_0x171251){var _0x130032=this;return function(){if(!_0x130032[_0xcc7f('0x89')](_0x171251[_0xcc7f('0x8f')])){if(!_0x130032[_0xcc7f('0x89')](_0x171251['TrunkBackup'])){_0x171251[_0xcc7f('0x69')]=utils[_0xcc7f('0x6a')][_0xcc7f('0x90')];throw _0x171251[_0xcc7f('0x61')]+'\x20trunk\x20is\x20not\x20reachable';}}};};Dialer['prototype'][_0xcc7f('0x91')]=function(_0x534ce8,_0xbf78a4,_0x189297,_0x2134ed){var _0x1e71a1=this;return function(){var _0x415a41=!![];return _0x1e71a1[_0xcc7f('0x92')](_0x534ce8,_0xbf78a4,_0x189297,_0x2134ed,_0x415a41);};};Dialer[_0xcc7f('0x8e')][_0xcc7f('0x93')]=function(_0x3689b3,_0x5d6833,_0x375d8d,_0x3f6bef){var _0x3aa0f8=this;return function(){var _0x3abec0=![];return _0x3aa0f8[_0xcc7f('0x92')](_0x3689b3['Intervals'],_0x5d6833,_0x375d8d,_0x3f6bef,_0x3abec0);};};Dialer[_0xcc7f('0x8e')][_0xcc7f('0x92')]=function(_0x483150,_0x4c30b3,_0x4c4031,_0x128037,_0x53c080){var _0x4d5764=[];return new Promise(function(_0x59bf76,_0xe45bc2){if(!isNotNull(_0x483150)){_0x128037[_0xcc7f('0x69')]=utils[_0xcc7f('0x6a')][_0xcc7f('0x7c')];return _0xe45bc2(msgResponse(_0xcc7f('0x94'),'Failure',_0x4c4031+_0xcc7f('0x95')));}if(_[_0xcc7f('0x46')](_0x483150)){_0x128037[_0xcc7f('0x69')]=utils[_0xcc7f('0x6a')][_0xcc7f('0x96')];return _0xe45bc2(msgResponse(_0xcc7f('0x94'),_0xcc7f('0x97'),_0x4c4031+_0xcc7f('0x98')));}if(_0x4c30b3&&_[_0xcc7f('0x52')](config['timezones'][_0x4c30b3])){_0x128037[_0xcc7f('0x69')]=utils[_0xcc7f('0x6a')][_0xcc7f('0x99')];return _0xe45bc2(msgResponse(_0xcc7f('0x94'),_0xcc7f('0x97'),_0x4c4031+'\x20Timezone\x20unknow\x20'+_0x4c30b3));}if(_[_0xcc7f('0x9a')](_0x483150)){for(var _0x246312=0x0;_0x246312<_0x483150[_0xcc7f('0x9b')];_0x246312+=0x1){_0x4d5764[_0xcc7f('0x9c')](ami[_0xcc7f('0x9d')]({'action':'command','command':util[_0xcc7f('0x81')]('iftime\x20%s,%s',_0x483150[_0x246312]['interval'],!_[_0xcc7f('0x52')](config['timezones'][_0x4c30b3])?_0x4c30b3:'')})[_0xcc7f('0x9e')](function(_0x5338a){return _0x5338a[_0xcc7f('0x9f')][_0xcc7f('0xa0')](_0xcc7f('0xa1'))>=0x0;})['catch'](myreject(_0xe45bc2)));}}else{_0x4d5764[_0xcc7f('0x9c')](ami[_0xcc7f('0x9d')]({'action':'command','command':util[_0xcc7f('0x81')](_0xcc7f('0xa2'),_0x483150,!_[_0xcc7f('0x52')](config[_0xcc7f('0xa3')][_0x4c30b3])?_0x4c30b3:'')})['then'](function(_0x414a6b){return _0x414a6b[_0xcc7f('0x9f')][_0xcc7f('0xa0')](_0xcc7f('0xa1'))>=0x0;})[_0xcc7f('0xa4')](myreject(_0xe45bc2)));}Promise[_0xcc7f('0xa5')](_0x4d5764)['then'](function(_0x2175cb){var _0x8c0ca1=_[_0xcc7f('0xa6')](_0x2175cb);if(_0x8c0ca1){return _0x59bf76(_0x8c0ca1);}else{_0x128037[_0xcc7f('0x69')]=_0x53c080?utils[_0xcc7f('0x6a')][_0xcc7f('0xa7')]:utils[_0xcc7f('0x6a')][_0xcc7f('0xa8')];return _0xe45bc2(msgResponse('[ifTime][promiseAll]',_0xcc7f('0x97'),_0xcc7f('0xa9')+_0x53c080+'\x20'+_0x4c4031+_0xcc7f('0xaa')+util['inspect'](_0x483150,{'showHidden':![],'depth':null})+_0xcc7f('0xab')+_0x4c30b3));}})[_0xcc7f('0xa4')](function(_0x597b4f){return _0xe45bc2(msgResponse(_0xcc7f('0x94'),_0xcc7f('0x97'),JSON[_0xcc7f('0x77')](_0x597b4f)));});});};Dialer['prototype'][_0xcc7f('0x3a')]=function(){var _0xc4c148=this;return cmHopper[_0xcc7f('0xac')]({'active':![]},{'where':{'active':!![]}})[_0xcc7f('0x9e')](function(){setInterval(function(){_0xc4c148[_0xcc7f('0xad')]();},0x3e8);});};Dialer['prototype'][_0xcc7f('0xad')]=function(){var _0x415e2e=this;var _0x1d6654;for(var _0x312254 in this[_0xcc7f('0x1f')]){if(typeof this['campaigns'][_0x312254]!==_0xcc7f('0xae')){_0x1d6654=this[_0xcc7f('0x1f')][_0x312254];if(utils[_0xcc7f('0x80')](_0x1d6654)&&utils[_0xcc7f('0x7d')](_0x1d6654)){_0x1d6654[_0xcc7f('0x84')]=!![];Promise[_0xcc7f('0xaf')]()['then'](checkIsIVRCampaignActive(_0x1d6654))[_0xcc7f('0x9e')](checkInterval(_0x1d6654))[_0xcc7f('0x9e')](_0x415e2e[_0xcc7f('0xb0')](_0x1d6654))[_0xcc7f('0x9e')](_0x415e2e['checkIfTime'](_0x1d6654[_0xcc7f('0xb1')],_0x1d6654[_0xcc7f('0xb2')],_0x1d6654[_0xcc7f('0x61')],_0x1d6654))[_0xcc7f('0x9e')](_0x415e2e[_0xcc7f('0x93')](_0x1d6654[_0xcc7f('0x79')],_0x1d6654[_0xcc7f('0xb2')],_0x1d6654[_0xcc7f('0x61')],_0x1d6654))[_0xcc7f('0x9e')](_0x415e2e[_0xcc7f('0xb3')](_0x1d6654))[_0xcc7f('0xa4')](loggerCatchQueueSummary('[syncCampaigns]',_0x1d6654));}else{notSendMessagesCampaign(_0x1d6654);}}}};Dialer[_0xcc7f('0x8e')][_0xcc7f('0xb4')]=function(_0x850487){if(_0x850487['dialMethod']!=='predictive'){clearPredictiveAttributes(_0x850487);}switch(_0x850487['dialMethod']){case'progressive':this['handlePower'](_0x850487,0x1);break;case _0xcc7f('0xb5'):this[_0xcc7f('0xb6')](_0x850487,_0x850487[_0xcc7f('0xb7')]);break;case'predictive':this[_0xcc7f('0xa')](_0x850487);break;case'booked':this['handlePower'](_0x850487,0x1);break;default:logger['error'](_0xcc7f('0xb8'),_0x850487[_0xcc7f('0x61')],'method\x20not\x20recognized');}};Dialer['prototype'][_0xcc7f('0x94')]=function(_0x228ce2,_0x3729f2){var _0x5e7fc9=_0x228ce2[_0xcc7f('0xb2')];var _0x327e46=_0x3729f2?_0x228ce2[_0xcc7f('0xb1')]:_0x228ce2['Interval'][_0xcc7f('0x7b')];logger[_0xcc7f('0xb9')]('Dialer::ifTime()',_0x327e46,_0x5e7fc9,_0x228ce2[_0xcc7f('0x61')],util['format'](_0xcc7f('0xba'),_0x228ce2['name'],_0x228ce2['id']));var _0xaa7bef=null;return Interval['intervalIftime'](_0x327e46,_0x5e7fc9)['then'](function(_0x173824){if(_0x173824===!![]){return _0x173824;}else{_0x228ce2[_0xcc7f('0x69')]=_0x3729f2?utils[_0xcc7f('0x6a')][_0xcc7f('0xa7')]:utils[_0xcc7f('0x6a')][_0xcc7f('0xa8')];_0xaa7bef=msgResponse('[ifTime][promiseAll]','Failure',_0xcc7f('0xa9')+_0x3729f2+'\x20'+_0x228ce2['name']+'\x20Interval\x20is\x20overtime:\x20'+util['inspect'](_0x327e46,{'showHidden':![],'depth':null})+_0xcc7f('0xab')+_0x5e7fc9);}if(_0xaa7bef!==null){logger['silly']('Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:',_0xaa7bef);_0xaa7bef[_0xcc7f('0xbb')]=_0x3729f2;throw _0xaa7bef;}})[_0xcc7f('0xa4')](function(_0x1193b5){logger[_0xcc7f('0x66')](_0xcc7f('0xbc'),_0x1193b5);throw msgResponse(_0xcc7f('0x88'),_0xcc7f('0xbd'),util[_0xcc7f('0x43')](_0x1193b5,{'showHidden':![],'depth':null}));});};Dialer[_0xcc7f('0x8e')]['syncAgentConnect']=function(_0x562948){if(this[_0xcc7f('0x1e')][_0x562948[_0xcc7f('0xbe')]]){if(this[_0xcc7f('0x25')][_0x562948[_0xcc7f('0xbf')]]&&this['uniqueId'][_0x562948[_0xcc7f('0xbf')]][_0xcc7f('0x3f')]!==_0xcc7f('0xc0')){this[_0xcc7f('0xc1')](this[_0xcc7f('0x1e')][_0x562948['queue']]);this['uniqueId'][_0x562948[_0xcc7f('0xbf')]]['answertime']=moment()[_0xcc7f('0x81')](_0xcc7f('0xc2'));}}};Dialer[_0xcc7f('0x8e')][_0xcc7f('0x30')]=function(_0x209ead){var _0xeb4907=this[_0xcc7f('0x25')][_0x209ead[_0xcc7f('0xbf')]];if(this[_0xcc7f('0x1e')][_0x209ead[_0xcc7f('0xbe')]]){if(_0xeb4907&&_0xeb4907['type']!==_0xcc7f('0xc0')){delete this[_0xcc7f('0x25')][_0x209ead[_0xcc7f('0xbf')]];this[_0xcc7f('0x1e')][_0x209ead[_0xcc7f('0xbe')]][_0xcc7f('0xc3')]+=0x1;var _0x2fcbf4=new AgentComplete(_0xeb4907,_0x209ead);if(_0x209ead['reason']===_0xcc7f('0xc4')){_0x2fcbf4[_0xcc7f('0xc5')]=this[_0xcc7f('0x1e')][_0x209ead['queue']]['dialQueueProject2']&&this[_0xcc7f('0x1e')][_0x209ead[_0xcc7f('0xbe')]][_0xcc7f('0xc6')]?moment()[_0xcc7f('0x81')](_0xcc7f('0xc2')):undefined;}hopperUtils[_0xcc7f('0xc7')](_0x2fcbf4)[_0xcc7f('0xa4')](loggerCatch(_0xcc7f('0xc8')));hopperUtils[_0xcc7f('0xc9')](_0x2fcbf4)[_0xcc7f('0xa4')](loggerCatch('[syncAgentComplete]'));}}};Dialer[_0xcc7f('0x8e')]['syncQueueCallerAbandon']=function(_0xb0f8d6){var _0x4a0fa8=this['uniqueId'][_0xb0f8d6[_0xcc7f('0xbf')]];var _0x338cd2=this;var _0x444ece=![];var _0x1d1ac6;var _0x4afedc;if(this[_0xcc7f('0x1e')][_0xb0f8d6[_0xcc7f('0xbe')]]){if(_0x4a0fa8&&_0x4a0fa8[_0xcc7f('0x3f')]!=='ivr'){delete this[_0xcc7f('0x25')][_0xb0f8d6['uniqueid']];this[_0xcc7f('0xc1')](this[_0xcc7f('0x1e')][_0xb0f8d6['queue']]);_0x4a0fa8[_0xcc7f('0xca')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');var _0x1cf6fb=new QueueCallerAbandon(_0x4a0fa8,_0xb0f8d6);if(utils[_0xcc7f('0x5f')](_0x4a0fa8[_0xcc7f('0xca')],_0x4a0fa8['responsetime'])>=_0x4a0fa8[_0xcc7f('0xcb')]){this[_0xcc7f('0x1e')][_0xb0f8d6[_0xcc7f('0xbe')]]['predictiveIntervalDroppedCallsTimeout']+=0x1;this[_0xcc7f('0x1e')][_0xb0f8d6[_0xcc7f('0xbe')]][_0xcc7f('0xcc')]+=0x1;this['voiceQueues'][_0xb0f8d6[_0xcc7f('0xbe')]][_0xcc7f('0xcd')]+=0x1;_0x1cf6fb[_0xcc7f('0xce')]=0xa;_0x1cf6fb[_0xcc7f('0x71')]=_0xcc7f('0xcf');_0x1cf6fb['dropreason']=_0xcc7f('0xd0');_0x1cf6fb[_0xcc7f('0xc5')]=this['voiceQueues'][_0xb0f8d6[_0xcc7f('0xbe')]]['dialQueueProject2']?moment()[_0xcc7f('0x81')](_0xcc7f('0xc2')):undefined;_0x1cf6fb['countdropretry']+=0x1;_0x1cf6fb[_0xcc7f('0xd1')]+=0x1;_0x1d1ac6=this[_0xcc7f('0x1e')][_0xb0f8d6['queue']][_0xcc7f('0xd2')];_0x4afedc=this['voiceQueues'][_0xb0f8d6[_0xcc7f('0xbe')]][_0xcc7f('0xd3')];hopperUtils['verifyAdditionalPhones'](_0x1cf6fb,_0x1cf6fb[_0xcc7f('0xce')],_0x4a0fa8[_0xcc7f('0xd4')])[_0xcc7f('0x9e')](function(_0x2228d1){_0x444ece=_0x2228d1['additional']==0x1;if(_0x1cf6fb['countdropretry']>=_0x338cd2['voiceQueues'][_0xb0f8d6['queue']]['dialDropMaxRetry']){_0x338cd2['queueCallerAbandonCreateState'](_0x1cf6fb,_0x2228d1['additional']);}else{hopperUtils[_0xcc7f('0xd5')]({'active':![],'countdropretry':_0x1cf6fb['countdropretry'],'scheduledat':moment()['add'](_0x338cd2[_0xcc7f('0x1e')][_0xb0f8d6['queue']]['dialDropRetryFrequency'],_0xcc7f('0xd6'))[_0xcc7f('0x81')](_0xcc7f('0xc2')),'ContactId':_0x4a0fa8[_0xcc7f('0xd7')],'ListId':_0x4a0fa8[_0xcc7f('0xd8')],'VoiceQueueId':_0x4a0fa8[_0xcc7f('0xd9')]||undefined,'CampaignId':_0x4a0fa8[_0xcc7f('0xda')]||undefined})[_0xcc7f('0xa4')](loggerCatch(_0xcc7f('0xdb')));var _0xe83a46=new History(_0x1cf6fb);_0xe83a46[_0xcc7f('0xce')]=0xa;_0xe83a46[_0xcc7f('0x71')]=_0xcc7f('0xcf');_0xe83a46[_0xcc7f('0x73')]=moment()[_0xcc7f('0x81')](_0xcc7f('0xc2'));_0xe83a46['endtime']=_0xe83a46[_0xcc7f('0x73')];_0xe83a46[_0xcc7f('0xdc')]=_0x1cf6fb['calleridname'];_0xe83a46[_0xcc7f('0xdd')]=_0x1cf6fb[_0xcc7f('0xdd')];hopperUtils[_0xcc7f('0xc7')](_0xe83a46)['catch'](loggerCatch('[syncAgentComplete][createHistory][10]'));}})[_0xcc7f('0x9e')](function(){if(_0x444ece)hopperUtils[_0xcc7f('0xde')](_0x1cf6fb,_0x1d1ac6,_0x4afedc)[_0xcc7f('0x9e')](function(){return 0x1;});});}else{this[_0xcc7f('0x1e')][_0xb0f8d6[_0xcc7f('0xbe')]][_0xcc7f('0xdf')]+=0x1;this['voiceQueues'][_0xb0f8d6[_0xcc7f('0xbe')]][_0xcc7f('0xe0')]+=0x1;_0x1cf6fb[_0xcc7f('0xce')]=0xb;_0x1cf6fb[_0xcc7f('0x71')]='Abandoned';_0x1cf6fb['dropreason']=_0xcc7f('0xe1');_0x1cf6fb[_0xcc7f('0xe2')]+=0x1;_0x1cf6fb['countglobal']+=0x1;_0x1d1ac6=this[_0xcc7f('0x1e')][_0xb0f8d6[_0xcc7f('0xbe')]][_0xcc7f('0xe3')];_0x4afedc=this['voiceQueues'][_0xb0f8d6[_0xcc7f('0xbe')]]['callAdditionalPhoneAfterMin'];hopperUtils['verifyAdditionalPhones'](_0x1cf6fb,_0x1cf6fb[_0xcc7f('0xce')],_0x4a0fa8[_0xcc7f('0xd4')])[_0xcc7f('0x9e')](function(_0x38ed02){if(_0x1cf6fb[_0xcc7f('0xe2')]>=_0x338cd2[_0xcc7f('0x1e')][_0xb0f8d6['queue']][_0xcc7f('0xe4')]){_0x338cd2[_0xcc7f('0xe5')](_0x1cf6fb,_0x38ed02[_0xcc7f('0xe6')]);}else{hopperUtils[_0xcc7f('0xd5')]({'active':![],'countabandonedretry':_0x1cf6fb[_0xcc7f('0xe2')],'scheduledat':moment()['add'](_0x338cd2[_0xcc7f('0x1e')][_0xb0f8d6[_0xcc7f('0xbe')]][_0xcc7f('0xe3')],_0xcc7f('0xd6'))['format'](_0xcc7f('0xc2')),'ContactId':_0x4a0fa8[_0xcc7f('0xd7')],'ListId':_0x4a0fa8[_0xcc7f('0xd8')],'VoiceQueueId':_0x4a0fa8[_0xcc7f('0xd9')]||undefined,'CampaignId':_0x4a0fa8[_0xcc7f('0xda')]||undefined})[_0xcc7f('0xa4')](loggerCatch(_0xcc7f('0xe7')));var _0x59a960=new History(_0x1cf6fb);_0x59a960[_0xcc7f('0xce')]=0xb;_0x59a960[_0xcc7f('0x71')]='Abandoned';_0x59a960['starttime']=moment()[_0xcc7f('0x81')](_0xcc7f('0xc2'));_0x59a960['endtime']=_0x59a960[_0xcc7f('0x73')];_0x59a960[_0xcc7f('0xdc')]=_0x1cf6fb[_0xcc7f('0xdc')];_0x59a960['calleridnum']=_0x1cf6fb[_0xcc7f('0xdd')];hopperUtils[_0xcc7f('0xc7')](_0x59a960)[_0xcc7f('0xa4')](loggerCatch(_0xcc7f('0xe8')));}})[_0xcc7f('0x9e')](function(){if(_0x444ece)hopperUtils[_0xcc7f('0xde')](_0x1cf6fb,_0x1d1ac6,_0x4afedc)[_0xcc7f('0x9e')](function(){return 0x1;});});}}}};Dialer[_0xcc7f('0x8e')][_0xcc7f('0xe9')]=function(_0xfbe96){if(this[_0xcc7f('0xea')][_0xfbe96[_0xcc7f('0xbf')]]){this[_0xcc7f('0xea')][_0xfbe96[_0xcc7f('0xbf')]][_0xcc7f('0xeb')]=_0xfbe96[_0xcc7f('0xeb')];}if(this[_0xcc7f('0x25')][_0xfbe96[_0xcc7f('0xbf')]]){this[_0xcc7f('0x25')][_0xfbe96[_0xcc7f('0xbf')]]['channel']=_0xfbe96[_0xcc7f('0xeb')];}};Dialer['prototype'][_0xcc7f('0x37')]=function(_0x332f74){if(!this[_0xcc7f('0xea')][_0x332f74['actionid']]){return;}var _0x56e60b=this[_0xcc7f('0x1e')][this[_0xcc7f('0xea')][_0x332f74[_0xcc7f('0xec')]]['queue']]['strategy']||_0xcc7f('0xed');if(_0x56e60b==='roundrobin'){if(this['actions'][_0x332f74[_0xcc7f('0xec')]]&&_[_0xcc7f('0xee')](this[_0xcc7f('0xea')][_0x332f74[_0xcc7f('0xec')]]['locked'])&&_0x332f74[_0xcc7f('0x8c')]==='1'&&_0x332f74[_0xcc7f('0xef')]==='0'){if(this['agents'][_0x332f74[_0xcc7f('0xf0')]]){if(!this[_0xcc7f('0x20')][_0x332f74[_0xcc7f('0xf0')]]['locked']){this['agents'][_0x332f74[_0xcc7f('0xf0')]]['locked']=!![];this['actions'][_0x332f74[_0xcc7f('0xec')]][_0xcc7f('0xf1')]=!![];this['actions'][_0x332f74['actionid']][_0xcc7f('0xf0')]=_0x332f74[_0xcc7f('0xf0')];}}}}else if(_0x56e60b===_0xcc7f('0xed')){if(this[_0xcc7f('0xea')][_0x332f74['actionid']]){if(this[_0xcc7f('0x20')][_0x332f74[_0xcc7f('0xf0')]]){this[_0xcc7f('0xea')][_0x332f74[_0xcc7f('0xec')]]['stateinterface']=_0x332f74[_0xcc7f('0xf0')];if(_[_0xcc7f('0xee')](this[_0xcc7f('0x28')][this[_0xcc7f('0xea')][_0x332f74[_0xcc7f('0xec')]][_0xcc7f('0xbe')]])){this['queueBooked'][this[_0xcc7f('0xea')][_0x332f74[_0xcc7f('0xec')]]['queue']]=[];}this[_0xcc7f('0x28')][this['actions'][_0x332f74['actionid']][_0xcc7f('0xbe')]][_0xcc7f('0x9c')](_['merge'](_['pick'](this[_0xcc7f('0xea')][_0x332f74[_0xcc7f('0xec')]],[_0xcc7f('0xf2'),'stateinterface']),{'status':_0x332f74[_0xcc7f('0x8c')],'paused':_0x332f74[_0xcc7f('0xef')]}));}}}};Dialer['prototype']['syncQueueStatusComplete']=function(_0x1a441b){if(!this['actions'][_0x1a441b[_0xcc7f('0xec')]]){return;}var _0x1ed6e3=this;var _0x5c3c7e=this[_0xcc7f('0x1e')][this[_0xcc7f('0xea')][_0x1a441b[_0xcc7f('0xec')]]['queue']];var _0x2a8206=_0x5c3c7e[_0xcc7f('0xf3')]||_0xcc7f('0xed');if(_0x2a8206===_0xcc7f('0xf4')){if(this[_0xcc7f('0xea')][_0x1a441b[_0xcc7f('0xec')]]&&this[_0xcc7f('0xea')][_0x1a441b[_0xcc7f('0xec')]][_0xcc7f('0xf0')]){this[_0xcc7f('0xf5')][_0xcc7f('0xf6')](this['actions'][_0x1a441b['actionid']][_0xcc7f('0xf2')],this[_0xcc7f('0xea')][_0x1a441b[_0xcc7f('0xec')]][_0xcc7f('0xf0')])[_0xcc7f('0xa4')](function(_0x450b71){logger[_0xcc7f('0x66')](_0xcc7f('0xf7'),util['inspect'](_0x450b71,{'showHidden':![],'depth':null}));})[_0xcc7f('0x1c')](function(){_0x1ed6e3[_0xcc7f('0xc1')](_0x1ed6e3[_0xcc7f('0x1e')][_0x1ed6e3['actions'][_0x1a441b['actionid']]['queue']]);_0x1ed6e3[_0xcc7f('0x20')][_0x1ed6e3['actions'][_0x1a441b[_0xcc7f('0xec')]][_0xcc7f('0xf0')]][_0xcc7f('0xf1')]=![];delete _0x1ed6e3[_0xcc7f('0xea')][_0x1a441b[_0xcc7f('0xec')]];unlockQueueStatus(_0x5c3c7e);});}else{this['updateOriginated'](this[_0xcc7f('0x1e')][this['actions'][_0x1a441b[_0xcc7f('0xec')]][_0xcc7f('0xbe')]]);hopperUtils['rescheduleContact']({'active':![],'ContactId':this['actions'][_0x1a441b[_0xcc7f('0xec')]][_0xcc7f('0xd7')],'ListId':this[_0xcc7f('0xea')][_0x1a441b['actionid']][_0xcc7f('0xd8')],'VoiceQueueId':this[_0xcc7f('0xea')][_0x1a441b[_0xcc7f('0xec')]]['VoiceQueueId']||undefined,'CampaignId':this[_0xcc7f('0xea')][_0x1a441b[_0xcc7f('0xec')]][_0xcc7f('0xda')]||undefined})[_0xcc7f('0xa4')](loggerCatch('[unlock][syncQueueStatusComplete]'));delete this['actions'][_0x1a441b['actionid']];unlockQueueStatus(_0x5c3c7e);}}else if(_0x2a8206===_0xcc7f('0xed')){var _0x5b6da7;if(this['actions'][_0x1a441b[_0xcc7f('0xec')]]&&!_[_0xcc7f('0x46')](this['queueBooked'][this[_0xcc7f('0xea')][_0x1a441b[_0xcc7f('0xec')]][_0xcc7f('0xbe')]])){if(this[_0xcc7f('0x29')][_0x1ed6e3[_0xcc7f('0xea')][_0x1a441b[_0xcc7f('0xec')]][_0xcc7f('0xbe')]]){this[_0xcc7f('0x29')][_0x1ed6e3['actions'][_0x1a441b[_0xcc7f('0xec')]][_0xcc7f('0xbe')]]=this[_0xcc7f('0x29')][this['actions'][_0x1a441b['actionid']]['queue']]?this[_0xcc7f('0x29')][this['actions'][_0x1a441b[_0xcc7f('0xec')]][_0xcc7f('0xbe')]]:this[_0xcc7f('0x28')][this[_0xcc7f('0xea')][_0x1a441b['actionid']][_0xcc7f('0xbe')]]?this['queueBooked'][this[_0xcc7f('0xea')][_0x1a441b[_0xcc7f('0xec')]][_0xcc7f('0xbe')]][_0xcc7f('0xf8')]||0x0:0x0;}this[_0xcc7f('0x28')][this[_0xcc7f('0xea')][_0x1a441b[_0xcc7f('0xec')]][_0xcc7f('0xbe')]]['_rr']=this['queueBookedRR'][this[_0xcc7f('0xea')][_0x1a441b['actionid']][_0xcc7f('0xbe')]];for(var _0x23bd47=0x0;_0x23bd47=_0x594d4d[_0xcc7f('0x11d')]){_0x35bb69[_0xcc7f('0x11e')](_0x511675,_0x60c89e,_0xb662dc,_0xcc7f('0x11f'));}else{if(_0x511675[_0xcc7f('0x11b')]>=_0x594d4d[_0xcc7f('0x120')]){_0x35bb69['createStateFinal'](_0x511675,_0x60c89e,_0xb662dc,_0xcc7f('0x121'));}else{hopperUtils[_0xcc7f('0xd5')]({'active':![],'countmachineretry':_0x511675[_0xcc7f('0x11b')],'scheduledat':moment()['add'](_0x594d4d['dialMachineRetryFrequency'],_0xcc7f('0xd6'))[_0xcc7f('0x81')](_0xcc7f('0xc2')),'ContactId':_0x511675[_0xcc7f('0xd7')],'ListId':_0x511675[_0xcc7f('0xd8')],'VoiceQueueId':_0x511675['VoiceQueueId']||undefined,'CampaignId':_0x511675[_0xcc7f('0xda')]||undefined})[_0xcc7f('0xa4')](loggerCatch(_0xcc7f('0x122')));_0x60c89e({'reschedule':0x1});}}});}if(_0x50774[_0xcc7f('0x3f')]===_0xcc7f('0xc0')&&this[_0xcc7f('0x1f')][_0x50774[_0xcc7f('0xbe')]][_0xcc7f('0x123')]&&_0x586247[_0xcc7f('0x109')]===_0xcc7f('0x10a')){delete this[_0xcc7f('0x25')][_0x586247[_0xcc7f('0xbf')]];this['updateOriginated'](this[_0xcc7f('0x1f')][_0x50774[_0xcc7f('0xbe')]]);_0x5945e6=new Hangup(_0x50774,_0x586247);_0x5945e6['state']=0x12;_0x5945e6['statedesc']=_0xcc7f('0x10c');_0x5945e6[_0xcc7f('0x10d')]=_0xcc7f('0x10e');ami[_0xcc7f('0x3e')](_0xcc7f('0x10f'),ut[_0xcc7f('0x115')](_0x5945e6,_0xcc7f('0x110')));this[_0xcc7f('0x111')](_0x5945e6,_0xcc7f('0x124'),_0xcc7f('0x125'));}if(_0x50774[_0xcc7f('0x3f')]==='ivr'&&this[_0xcc7f('0x1f')][_0x50774['queue']][_0xcc7f('0x123')]&&_0x586247[_0xcc7f('0x109')]==='MACHINE'){return new Promise(function(_0x11b474,_0xf221d7){delete _0x35bb69[_0xcc7f('0x25')][_0x586247[_0xcc7f('0xbf')]];_0x35bb69['updateOriginated'](_0x35bb69[_0xcc7f('0x1f')][_0x50774['queue']]);_0x35bb69[_0xcc7f('0x1f')][_0x50774[_0xcc7f('0xbe')]][_0xcc7f('0xc3')]+=0x1;_0x35bb69['campaigns'][_0x50774[_0xcc7f('0xbe')]]['outboundAnswerAgiCallsDay']+=0x1;var _0x32d3f1=_0x35bb69[_0xcc7f('0x1f')][_0x50774[_0xcc7f('0xbe')]];var _0x21605a=new Hangup(_0x50774,_0x586247);_0x21605a[_0xcc7f('0xce')]=0x13;_0x21605a[_0xcc7f('0x71')]=_0xcc7f('0x114');_0x21605a[_0xcc7f('0x10d')]='AMD';_0x21605a[_0xcc7f('0x11b')]+=0x1;_0x21605a[_0xcc7f('0xd1')]+=0x1;_0x21605a['amd']=!![];ami['emit']('custom:amd',ut[_0xcc7f('0x115')](_0x21605a,_0xcc7f('0x110')));hopperUtils[_0xcc7f('0xc7')](_0x21605a)[_0xcc7f('0xa4')](loggerCatch(_0xcc7f('0x116')));if(_0x21605a[_0xcc7f('0x117')]+_0x21605a[_0xcc7f('0x118')]+_0x21605a[_0xcc7f('0x119')]+_0x21605a['countnosuchnumberretry']+_0x21605a[_0xcc7f('0x126')]+_0x21605a['countabandonedretry']+_0x21605a[_0xcc7f('0x11b')]+_0x21605a[_0xcc7f('0x11c')]>=_0x32d3f1[_0xcc7f('0x11d')]){_0x35bb69[_0xcc7f('0x11e')](_0x21605a,_0x11b474,_0xf221d7,_0xcc7f('0x11f'));}else{if(_0x21605a[_0xcc7f('0x11b')]>=_0x32d3f1['dialMachineMaxRetry']){_0x35bb69['createStateFinal'](_0x21605a,_0x11b474,_0xf221d7,_0xcc7f('0x121'));}else{hopperUtils['rescheduleContact']({'active':![],'countmachineretry':_0x21605a['countmachineretry'],'scheduledat':moment()['add'](_0x32d3f1['dialMachineRetryFrequency'],'minutes')['format'](_0xcc7f('0xc2')),'ContactId':_0x21605a[_0xcc7f('0xd7')],'ListId':_0x21605a['ListId'],'VoiceQueueId':_0x21605a[_0xcc7f('0xd9')]||undefined,'CampaignId':_0x21605a['CampaignId']||undefined})['catch'](loggerCatch(_0xcc7f('0x122')));_0x11b474({'reschedule':0x1});}}});}}};Dialer['prototype'][_0xcc7f('0x33')]=function(_0x774bbd){var _0x533f0b=this['uniqueId'][_0x774bbd['uniqueid']];var _0x2b1360;if(_0x533f0b&&_0x533f0b['type']===_0xcc7f('0xc0')){delete this[_0xcc7f('0x25')][_0x774bbd[_0xcc7f('0xbf')]];this[_0xcc7f('0xc1')](this[_0xcc7f('0x1f')][_0x533f0b['queue']]);this['campaigns'][_0x533f0b['queue']][_0xcc7f('0x127')]+=0x1;_0x2b1360=new Hangup(_0x533f0b,_0x774bbd);hopperUtils[_0xcc7f('0xc7')](_0x2b1360)[_0xcc7f('0xa4')](loggerCatch(_0xcc7f('0x128')));hopperUtils[_0xcc7f('0xc9')](_0x2b1360)[_0xcc7f('0xa4')](loggerCatch(_0xcc7f('0x129')));}if(_0x533f0b&&_0x533f0b[_0xcc7f('0x3f')]!==_0xcc7f('0xc0')&&isNotNull(this[_0xcc7f('0x1e')][_0x533f0b[_0xcc7f('0xbe')]][_0xcc7f('0x12a')])){delete this[_0xcc7f('0x25')][_0x774bbd[_0xcc7f('0xbf')]];this[_0xcc7f('0xc1')](this[_0xcc7f('0x1e')][_0x533f0b['queue']]);this[_0xcc7f('0x1e')][_0x533f0b[_0xcc7f('0xbe')]]['outboundAnswerCallsDay']+=0x1;this[_0xcc7f('0x1e')][_0x533f0b[_0xcc7f('0xbe')]][_0xcc7f('0x10b')]+=0x1;_0x2b1360=new Hangup(_0x533f0b,_0x774bbd);_0x2b1360[_0xcc7f('0xce')]=0x10;_0x2b1360[_0xcc7f('0x71')]='AnswerAGI';_0x2b1360['membername']='AGI';hopperUtils[_0xcc7f('0xc7')](_0x2b1360)[_0xcc7f('0xa4')](loggerCatch(_0xcc7f('0x128')));hopperUtils[_0xcc7f('0xc9')](_0x2b1360)[_0xcc7f('0xa4')](loggerCatch('[syncHangupIvr]'));}if(_0x533f0b&&_0x533f0b[_0xcc7f('0x3f')]!==_0xcc7f('0xc0')&&!isNotNull(this[_0xcc7f('0x1e')][_0x533f0b[_0xcc7f('0xbe')]][_0xcc7f('0x12a')])){delete this[_0xcc7f('0x25')][_0x774bbd[_0xcc7f('0xbf')]];this['updateOriginated'](this[_0xcc7f('0x1e')][_0x533f0b['queue']]);this[_0xcc7f('0x1e')][_0x533f0b[_0xcc7f('0xbe')]]['outboundUnknownCallsDay']+=0x1;_0x2b1360=new Hangup(_0x533f0b,_0x774bbd);_0x2b1360[_0xcc7f('0xce')]=0xc;_0x2b1360[_0xcc7f('0x71')]=_0x774bbd[_0xcc7f('0x12b')];_0x2b1360['membername']='Unknow';hopperUtils[_0xcc7f('0xc7')](_0x2b1360)[_0xcc7f('0xa4')](loggerCatch(_0xcc7f('0x128')));hopperUtils[_0xcc7f('0xc9')](_0x2b1360)['catch'](loggerCatch('[syncHangupIvr]'));}};Dialer[_0xcc7f('0x8e')][_0xcc7f('0x12c')]=function(_0x250c45){var _0x60025d=this;if(!_0x60025d[_0xcc7f('0x2a')][_0x250c45[_0xcc7f('0x61')]]){_0x60025d[_0xcc7f('0x2a')][_0x250c45['name']]={'running':![]};}else if(_0x60025d[_0xcc7f('0x2a')][_0x250c45[_0xcc7f('0x61')]]['running']===!![]){return;}else if(_0x60025d[_0xcc7f('0x2a')][_0x250c45[_0xcc7f('0x61')]][_0xcc7f('0x12d')]===![]){_0x60025d[_0xcc7f('0x2a')][_0x250c45[_0xcc7f('0x61')]]['running']=!![];}var _0x4a1b83=_0x60025d['voiceQueues'][_0x250c45[_0xcc7f('0x61')]];var _0x22af8e=_0x4a1b83[_0xcc7f('0x69')]!==utils['CAMPAIGN_STATUS'][_0xcc7f('0x7e')];var _0x5cf33e=utils['isPreviewCampaign'](_0x4a1b83);_0x4a1b83[_0xcc7f('0x12e')]=utils[_0xcc7f('0x12f')](_0x4a1b83,_0x60025d[_0xcc7f('0x21')]);Promise[_0xcc7f('0xaf')]()[_0xcc7f('0x9e')](function(){if(_0x4a1b83[_0xcc7f('0x12e')]===utils['CAMPAIGN_STATUS'][_0xcc7f('0x7e')]){if(_0x22af8e){clearPredictiveAttributes(_0x4a1b83);_0x250c45[_0xcc7f('0x26')]=undefined;_0x250c45[_0xcc7f('0x60')]=undefined;}if(_0x4a1b83[_0xcc7f('0x12e')]===utils['CAMPAIGN_STATUS'][_0xcc7f('0x7e')]){_0x250c45[_0xcc7f('0x130')]=0x0;_0x250c45[_0xcc7f('0xef')]=0x0;_0x250c45['inUse']=0x0;_0x250c45[_0xcc7f('0x131')]=0x0;_0x250c45[_0xcc7f('0x132')]=0x0;}}else if(_0x4a1b83[_0xcc7f('0x12e')]===utils[_0xcc7f('0x6a')][_0xcc7f('0x133')]&&!_0x5cf33e){return _0x60025d['ifTime'](_0x4a1b83,!![])[_0xcc7f('0x9e')](function(){return _0x60025d[_0xcc7f('0x94')](_0x4a1b83,![]);})['then'](function(){return _0x60025d[_0xcc7f('0xb4')](_0x4a1b83);})['catch'](function(_0x59c35a){loggerSyncQueueSummary[_0xcc7f('0x41')]('[syncQueueSummary]',util[_0xcc7f('0x43')](_0x59c35a,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x4a1b83);});}else{clearPredictiveAttributes(_0x4a1b83);}})[_0xcc7f('0x9e')](function(){var _0x110644=_0x250c45[_0xcc7f('0x134')](_0x4a1b83);if(_0x110644||_0x4a1b83['queueSummaryCountersUpdated']){_0x4a1b83[_0xcc7f('0x135')]=![];_0x250c45['updateReportFromOutboundQueue'](_0x4a1b83);Object[_0xcc7f('0x136')](_0x4a1b83,_0x250c45);emitOutboundVoiceQueueSummary(_0x250c45);}_0x60025d[_0xcc7f('0x2a')][_0x4a1b83[_0xcc7f('0x61')]][_0xcc7f('0x12d')]=![];})[_0xcc7f('0xa4')](function(_0x461757){logger[_0xcc7f('0x66')](_0xcc7f('0x137'),util[_0xcc7f('0x43')](_0x461757,{'showHidden':![],'depth':null}));_0x60025d[_0xcc7f('0x2a')][_0x4a1b83[_0xcc7f('0x61')]]['running']=![];});};Dialer[_0xcc7f('0x8e')][_0xcc7f('0x138')]=_[_0xcc7f('0x139')](function(){var _0x264413=_['filter'](this[_0xcc7f('0x1e')],function(_0x50ce89){return _0x50ce89['dialPreviewRecallmeReminder'];});var _0x1644a2=_[_0xcc7f('0x13a')](this[_0xcc7f('0x20')],function(_0x519dac){return _0x519dac[_0xcc7f('0x13b')]&&_0x519dac[_0xcc7f('0x8c')]===_0xcc7f('0x13c');});if(_0x264413[_0xcc7f('0x9b')]>0x0&&_0x1644a2['length']>0x0){return Promise[_0xcc7f('0xaf')]()[_0xcc7f('0x9e')](cmHopper['handlePreviewRecallNotifications'](_[_0xcc7f('0x13d')](_0x264413,'id'),previewRecallmeReminderInterval,_['map'](_0x1644a2,'id')))['then'](function(_0x4a6c2f){for(var _0x6b2e6c=0x0;_0x6b2e6c<_0x4a6c2f['length'];_0x6b2e6c++){var _0xb249=_0x4a6c2f[_0x6b2e6c][_0xcc7f('0x13e')]['name'];if(_0xb249)io['to'](util[_0xcc7f('0x81')](_0xcc7f('0x13f'),_0xb249))[_0xcc7f('0x3e')](_0xcc7f('0x140'),{'hopper':_0x4a6c2f[_0x6b2e6c]});}})[_0xcc7f('0xa4')](function(_0x8f4029){logger[_0xcc7f('0x66')](_0xcc7f('0x141'),_0x8f4029);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0xcc7f('0x8e')][_0xcc7f('0x3b')]=function(){var _0x26ffc6=this;setInterval(function(){_0x26ffc6['clearZombieChannels'](_0x26ffc6['uniqueId'],_0xcc7f('0x142'));_0x26ffc6[_0xcc7f('0x143')](_0x26ffc6[_0xcc7f('0xea')],_0xcc7f('0x144'));},0x32c8);};Dialer[_0xcc7f('0x8e')][_0xcc7f('0x143')]=function(_0x549ab3,_0x43fa97){var _0x73b3fe=this;for(var _0x3ab6ee in _0x549ab3){if(typeof _0x549ab3[_0x3ab6ee]!==_0xcc7f('0xae')){this[_0xcc7f('0x1d')][_0xcc7f('0x1a')](function(){if(!_[_0xcc7f('0xee')](_0x549ab3[_0x3ab6ee])){return ami['Action']({'action':'status','channel':_0x549ab3[_0x3ab6ee][_0xcc7f('0xeb')]})[_0xcc7f('0xa4')](function(_0x3dbd47){if(_0x3dbd47['message']===_0xcc7f('0x145')){setTimeout(function(){if(_0x549ab3[_0x3ab6ee]&&_0x549ab3[_0x3ab6ee][_0xcc7f('0x3f')]!==_0xcc7f('0xc0')){_0x73b3fe[_0xcc7f('0xc1')](_0x73b3fe[_0xcc7f('0x1e')][_0x549ab3[_0x3ab6ee]['queue']]);logger[_0xcc7f('0x66')](_0xcc7f('0x146'),_0x43fa97,_0x3ab6ee,_0x549ab3[_0x3ab6ee]['queue']);delete _0x549ab3[_0x3ab6ee];}if(_0x549ab3[_0x3ab6ee]&&_0x549ab3[_0x3ab6ee]['type']===_0xcc7f('0xc0')){_0x73b3fe[_0xcc7f('0xc1')](_0x73b3fe[_0xcc7f('0x1f')][_0x549ab3[_0x3ab6ee]['queue']]);logger[_0xcc7f('0x66')](_0xcc7f('0x147'),_0x43fa97,_0x3ab6ee,_0x549ab3[_0x3ab6ee][_0xcc7f('0xbe')]);delete _0x549ab3[_0x3ab6ee];}},0x2328);}});}});}}};Dialer[_0xcc7f('0x8e')][_0xcc7f('0x148')]=function(_0xd700e1){return Promise[_0xcc7f('0xaf')]()[_0xcc7f('0x9e')](voiceQueueRt['getVoiceQueueRtPauses'](_0xd700e1))[_0xcc7f('0xa4')](loggerCatch('[getVoiceQueueRtPauses]\x20'));};Dialer[_0xcc7f('0x8e')][_0xcc7f('0xc1')]=function(_0x17a090){if(!_[_0xcc7f('0x52')](_0x17a090)&&_0x17a090!==null){if(typeof _0x17a090[_0xcc7f('0x149')]!=='undefined'){if(_0x17a090[_0xcc7f('0x149')]>0x0){_0x17a090[_0xcc7f('0x149')]-=0x1;}else{logger[_0xcc7f('0x66')](_0xcc7f('0x14a'));}}}else{logger['error'](_0xcc7f('0x14b'));}};Dialer[_0xcc7f('0x8e')][_0xcc7f('0x14c')]=function(_0x5bdc9d,_0x3db3d6){var _0x12e68f=this;return function(_0x27e33f){_0x12e68f[_0xcc7f('0xc1')](_0x3db3d6);logger[_0xcc7f('0x66')](_0x5bdc9d,util['inspect'](_0x27e33f,{'showHidden':![],'depth':null}));};};Dialer[_0xcc7f('0x8e')]['emptyContact']=function(_0x35c69d,_0x28a7f2,_0xb8e297){var _0x575ce5={'state':0x19,'statedesc':_0xcc7f('0x14d')};this[_0xcc7f('0xc1')](_0x28a7f2);this[_0xcc7f('0x111')](_['merge'](_0x575ce5,_[_0xcc7f('0x78')](_0xb8e297,['ContactId',_0xcc7f('0xd8'),_0xcc7f('0x14e'),_0xcc7f('0xd9'),_0xcc7f('0xda')])),_0xcc7f('0x14f'),'[emptyContact]');logger[_0xcc7f('0x66')](_0x35c69d);};Dialer['prototype'][_0xcc7f('0x111')]=function(_0x48c7bc,_0x34686c,_0x37f893){hopperUtils[_0xcc7f('0xc7')](_0x48c7bc)[_0xcc7f('0xa4')](loggerCatch(_0x34686c));hopperUtils[_0xcc7f('0xc9')](_0x48c7bc)[_0xcc7f('0xa4')](loggerCatch(_0x37f893));};Dialer['prototype']['queueCallerAbandonCreateState']=function(_0x1705b6,_0x5720cf){hopperUtils['createHistory'](_0x1705b6)['catch'](loggerCatch(_0xcc7f('0xc8')));if(_0x5720cf==0x0){hopperUtils[_0xcc7f('0xc9')](_0x1705b6)['catch'](loggerCatch(_0xcc7f('0x150')));}};Dialer[_0xcc7f('0x8e')][_0xcc7f('0x141')]=function(_0x363641){return Promise[_0xcc7f('0xaf')]()['then'](cmHopper[_0xcc7f('0x151')](_0x363641['id'],previewRecallmeReminderInterval))[_0xcc7f('0x9e')](function(_0x2d4fee){for(var _0x1c2632=0x0;_0x1c2632<_0x2d4fee['length'];_0x1c2632++){var _0x31cfc9=_0x2d4fee[_0x1c2632][_0xcc7f('0x13e')][_0xcc7f('0x61')];if(_0x31cfc9)io['to'](util[_0xcc7f('0x81')](_0xcc7f('0x13f'),_0x31cfc9))[_0xcc7f('0x3e')](_0xcc7f('0x140'),{'hopper':_0x2d4fee[_0x1c2632]});}})[_0xcc7f('0xa4')](function(){});};Dialer['prototype'][_0xcc7f('0xb3')]=function(_0x39f2ab){var _0x4b0762=this;return function(){_0x4b0762[_0xcc7f('0x152')](_0x39f2ab);};};Dialer['prototype']['actionOriginate']=function(_0x10cbd6,_0x5d3155){var _0x1d4751=this;var _0x511ac3=uuid['v4']();this[_0xcc7f('0xea')][_0x511ac3]=new Action(_0x10cbd6,_0x5d3155,_0x511ac3);return new Promise(function(_0x162639,_0x40578f){if(_[_0xcc7f('0x52')](_0x10cbd6)&&typeof _0x10cbd6!=='object'){return _0x40578f(msgResponse('originate',_0xcc7f('0x97'),_0xcc7f('0x153')));}if(_['isUndefined'](_0x5d3155[_0xcc7f('0x154')])||_0x5d3155[_0xcc7f('0x154')]===null){return _0x40578f(msgResponse(_0xcc7f('0x155'),_0xcc7f('0x97'),_0xcc7f('0x156')));}var _0x30625c={'XMD-CALLERID':_0x1d4751[_0xcc7f('0xea')][_0x511ac3][_0xcc7f('0x157')](),'XMD-AGI':_0x10cbd6[_0xcc7f('0x12a')]?util[_0xcc7f('0x81')](_0xcc7f('0x158'),ipAgi,_0x10cbd6[_0xcc7f('0x12a')]):_0xcc7f('0x159'),'XMD-AGIAFTER':_0x10cbd6['dialQueueProject2']?util[_0xcc7f('0x81')]('\x22agi://%s/square,%s\x22',ipAgi,_0x10cbd6['dialQueueProject2']):_0xcc7f('0x159'),'XMD-QUEUE':utils[_0xcc7f('0x15a')](_0x10cbd6)?util['format']('\x22%s,%s%s,,,%s\x22',_0x10cbd6[_0xcc7f('0x61')],_0x10cbd6['dialQueueOptions']||'',_0x10cbd6['dialAgiAfterHangupAgent']?'c':'',_0x10cbd6[_0xcc7f('0xcb')]||0x3):_0xcc7f('0x159'),'XMD-CONTACTID':_0x5d3155[_0xcc7f('0xd7')],'XMD-CDRTYPE':_0xcc7f('0x8'),'CALLERID(all)':_0x1d4751['actions'][_0x511ac3][_0xcc7f('0x157')](),'XMD-AMD':_0x10cbd6[_0xcc7f('0x123')]?'ACTIVE':'NONE','XMD-DESTINATION':'xcally-motion-dialer'};if(_0x10cbd6[_0xcc7f('0x123')]){_0x30625c[_0xcc7f('0x15b')]=_0x10cbd6[_0xcc7f('0x15c')]||0x9c4;_0x30625c[_0xcc7f('0x15d')]=_0x10cbd6[_0xcc7f('0x15e')]||0x5dc;_0x30625c[_0xcc7f('0x15f')]=_0x10cbd6[_0xcc7f('0x160')]||0x320;_0x30625c[_0xcc7f('0x161')]=_0x10cbd6[_0xcc7f('0x162')]||0x1388;_0x30625c[_0xcc7f('0x163')]=_0x10cbd6[_0xcc7f('0x164')]||0x64;_0x30625c[_0xcc7f('0x165')]=_0x10cbd6[_0xcc7f('0x166')]||0x32;_0x30625c[_0xcc7f('0x167')]=_0x10cbd6[_0xcc7f('0x168')]||0x3;_0x30625c[_0xcc7f('0x169')]=_0x10cbd6[_0xcc7f('0x16a')]||0x100;_0x30625c[_0xcc7f('0x16b')]=_0x10cbd6[_0xcc7f('0x16c')]||0x1388;}if(utils['isOutboundQueue'](_0x10cbd6)){_0x30625c['XMD-VOICEQUEUEID']=_0x5d3155[_0xcc7f('0xd9')];}else{_0x30625c[_0xcc7f('0x16d')]=_0x5d3155[_0xcc7f('0xda')];}var _0x38a28c=utils['setXMDContactVariables'](_0x5d3155['Contact']);Object['assign'](_0x30625c,_0x38a28c);var _0x4e1737=_0x1d4751[_0xcc7f('0x89')](_0x10cbd6[_0xcc7f('0x8f')])?utils[_0xcc7f('0x16e')](_0x10cbd6['Trunk'][_0xcc7f('0x16f')],_0x10cbd6[_0xcc7f('0x170')],_0x10cbd6[_0xcc7f('0x171')]>0x0?utils[_0xcc7f('0x172')](_0x10cbd6[_0xcc7f('0x173')],_0x10cbd6['dialRandomLastDigitCallerIdNumber']):_0x10cbd6[_0xcc7f('0x173')]):utils['getCallerId'](_[_0xcc7f('0xee')](_0x10cbd6[_0xcc7f('0x174')])?_0x10cbd6['Trunk']['callerid']:_0x10cbd6[_0xcc7f('0x174')][_0xcc7f('0x16f')],_0x10cbd6[_0xcc7f('0x170')],_0x10cbd6[_0xcc7f('0x171')]>0x0?utils[_0xcc7f('0x172')](_0x10cbd6[_0xcc7f('0x173')],_0x10cbd6['dialRandomLastDigitCallerIdNumber']):_0x10cbd6[_0xcc7f('0x173')]);if(_0x4e1737){_0x30625c[_0xcc7f('0x175')]=_0x1d4751[_0xcc7f('0xea')][_0x511ac3]['originatecalleridname']=utils[_0xcc7f('0x176')](_0x4e1737);_0x30625c['XMD-ORIGINATECALLERIDNUM']=_0x5d3155[_0xcc7f('0x154')];}_0x10cbd6[_0xcc7f('0x177')]=_0x30625c;return ami[_0xcc7f('0x9d')]({'actionid':_0x511ac3,'action':_0xcc7f('0x155'),'channel':_0x1d4751[_0xcc7f('0x89')](_0x10cbd6[_0xcc7f('0x8f')])?util[_0xcc7f('0x81')]('SIP/%s/%s%s',_0x10cbd6[_0xcc7f('0x8f')]['name'],isNotNull(_0x10cbd6[_0xcc7f('0x178')])?_0x10cbd6[_0xcc7f('0x178')][_0xcc7f('0x179')]()||'':'',_0x10cbd6[_0xcc7f('0x17a')]>0x0?_0x5d3155[_0xcc7f('0x154')][_0xcc7f('0x17b')](_0x10cbd6['dialCutDigit']):_0x5d3155[_0xcc7f('0x154')]):util[_0xcc7f('0x81')]('SIP/%s/%s%s',_[_0xcc7f('0xee')](_0x10cbd6['TrunkBackup'])?_0x10cbd6[_0xcc7f('0x8f')][_0xcc7f('0x61')]:_0x10cbd6[_0xcc7f('0x174')][_0xcc7f('0x61')],isNotNull(_0x10cbd6[_0xcc7f('0x178')])?_0x10cbd6[_0xcc7f('0x178')][_0xcc7f('0x179')]()||'':'',_0x10cbd6[_0xcc7f('0x17a')]>0x0?_0x5d3155['phone'][_0xcc7f('0x17b')](_0x10cbd6[_0xcc7f('0x17a')]):_0x5d3155['phone']),'callerid':_0x4e1737,'Exten':_0xcc7f('0x108'),'Context':_0xcc7f('0x17c'),'Priority':'1','variable':_0x30625c,'timeout':(_0x10cbd6['dialOriginateTimeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x511ac3})['then'](function(_0x5954e7){return _0x162639(_0x5954e7);})['catch'](function(_0x3e91f2){_0x10cbd6[_0xcc7f('0x17d')]+=0x1;var _0x18bf2b=new History(_0x1d4751[_0xcc7f('0xea')][_0x511ac3]);logger[_0xcc7f('0x66')](util[_0xcc7f('0x81')](_0xcc7f('0x17e'),JSON[_0xcc7f('0x77')](_0x3e91f2)));_0x18bf2b[_0xcc7f('0xce')]=0xe;_0x18bf2b['statedesc']='OriginateError';_0x18bf2b['starttime']=moment()['format'](_0xcc7f('0xc2'));_0x18bf2b[_0xcc7f('0x72')]=_0x18bf2b['starttime'];hopperUtils[_0xcc7f('0xc7')](_0x18bf2b)[_0xcc7f('0xa4')](loggerCatch(_0xcc7f('0x17f')));_0x1d4751[_0xcc7f('0xc9')](_0x18bf2b)['catch'](loggerCatch(_0xcc7f('0x17f')))[_0xcc7f('0x1c')](function(){delete _0x1d4751[_0xcc7f('0xea')][_0x511ac3];return _0x40578f(msgResponse(_0xcc7f('0x155'),'Error',_0xcc7f('0x180')));});});});};Dialer['prototype'][_0xcc7f('0x181')]=function(_0x70c2ee,_0x4840e6,_0x3494d8){var _0x4982e8=new History(_0x4840e6);if(_0x4982e8[_0xcc7f('0x117')]+_0x4982e8[_0xcc7f('0x118')]+_0x4982e8['countnoanswerretry']+_0x4982e8[_0xcc7f('0x11a')]+_0x4982e8['countdropretry']+_0x4982e8[_0xcc7f('0xe2')]+_0x4982e8[_0xcc7f('0x11b')]+_0x4982e8[_0xcc7f('0x11c')]>=_0x3494d8['dialGlobalMaxRetry']-0x1){return!![];}switch(_0x70c2ee){case 0x3:if(_0x4982e8[_0xcc7f('0x119')]>=_0x3494d8[_0xcc7f('0x182')]-0x1){return!![];}hopperUtils[_0xcc7f('0xd5')]({'active':![],'countnoanswerretry':_0x4982e8[_0xcc7f('0x119')]+=0x1,'scheduledat':moment()['add'](_0x3494d8['dialNoAnswerRetryFrequency'],'minutes')[_0xcc7f('0x81')](_0xcc7f('0xc2')),'ContactId':_0x4982e8[_0xcc7f('0xd7')],'ListId':_0x4982e8[_0xcc7f('0xd8')],'VoiceQueueId':_0x4982e8['VoiceQueueId']||undefined,'CampaignId':_0x4982e8[_0xcc7f('0xda')]||undefined})[_0xcc7f('0xa4')](loggerCatch(_0xcc7f('0x183')));break;case 0x5:if(_0x4982e8[_0xcc7f('0x117')]>=_0x3494d8['dialBusyMaxRetry']-0x1){return!![];}hopperUtils[_0xcc7f('0xd5')]({'active':![],'countbusyretry':_0x4982e8['countbusyretry']+=0x1,'scheduledat':moment()[_0xcc7f('0x184')](_0x3494d8[_0xcc7f('0x185')],_0xcc7f('0xd6'))[_0xcc7f('0x81')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x4982e8['ContactId'],'ListId':_0x4982e8[_0xcc7f('0xd8')],'VoiceQueueId':_0x4982e8[_0xcc7f('0xd9')]||undefined,'CampaignId':_0x4982e8[_0xcc7f('0xda')]||undefined})[_0xcc7f('0xa4')](loggerCatch(_0xcc7f('0x186')));break;case 0x8:if(_0x4982e8[_0xcc7f('0x118')]>=_0x3494d8[_0xcc7f('0x187')]-0x1){return!![];}hopperUtils[_0xcc7f('0xd5')]({'active':![],'countcongestionretry':_0x4982e8[_0xcc7f('0x118')]+=0x1,'scheduledat':moment()[_0xcc7f('0x184')](_0x3494d8['dialCongestionRetryFrequency'],_0xcc7f('0xd6'))[_0xcc7f('0x81')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x4982e8[_0xcc7f('0xd7')],'ListId':_0x4982e8['ListId'],'VoiceQueueId':_0x4982e8['VoiceQueueId']||undefined,'CampaignId':_0x4982e8[_0xcc7f('0xda')]||undefined})[_0xcc7f('0xa4')](loggerCatch('[rescheduleContact]\x20[Congestion]'));break;case 0x0:if(_0x4982e8[_0xcc7f('0x11a')]>=_0x3494d8[_0xcc7f('0x188')]-0x1){return!![];}else{hopperUtils[_0xcc7f('0xd5')]({'active':![],'countnosuchnumberretry':_0x4982e8[_0xcc7f('0x11a')]+=0x1,'scheduledat':moment()[_0xcc7f('0x184')](_0x3494d8[_0xcc7f('0x189')],_0xcc7f('0xd6'))[_0xcc7f('0x81')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x4982e8[_0xcc7f('0xd7')],'ListId':_0x4982e8['ListId'],'VoiceQueueId':_0x4982e8[_0xcc7f('0xd9')]||undefined,'CampaignId':_0x4982e8[_0xcc7f('0xda')]||undefined})['catch'](loggerCatch(_0xcc7f('0x18a')));}break;case 0xa:if(_0x4982e8[_0xcc7f('0x126')]>=_0x3494d8[_0xcc7f('0x18b')]-0x1){return!![];}hopperUtils[_0xcc7f('0xd5')]({'active':![],'countdropretry':_0x4982e8[_0xcc7f('0x126')]+=0x1,'scheduledat':moment()['add'](_0x3494d8[_0xcc7f('0xd2')],_0xcc7f('0xd6'))[_0xcc7f('0x81')](_0xcc7f('0xc2')),'ContactId':_0x4982e8[_0xcc7f('0xd7')],'ListId':_0x4982e8[_0xcc7f('0xd8')],'VoiceQueueId':_0x4982e8[_0xcc7f('0xd9')]||undefined,'CampaignId':_0x4982e8['CampaignId']||undefined})[_0xcc7f('0xa4')](loggerCatch(_0xcc7f('0xdb')));break;case 0xb:if(_0x4982e8[_0xcc7f('0xe2')]>=_0x3494d8[_0xcc7f('0xe4')]-0x1){return!![];}hopperUtils[_0xcc7f('0xd5')]({'active':![],'countabandonedretry':_0x4982e8['countabandonedretry']+=0x1,'scheduledat':moment()[_0xcc7f('0x184')](_0x3494d8[_0xcc7f('0xe3')],_0xcc7f('0xd6'))[_0xcc7f('0x81')](_0xcc7f('0xc2')),'ContactId':_0x4982e8[_0xcc7f('0xd7')],'ListId':_0x4982e8[_0xcc7f('0xd8')],'VoiceQueueId':_0x4982e8[_0xcc7f('0xd9')]||undefined,'CampaignId':_0x4982e8[_0xcc7f('0xda')]||undefined})[_0xcc7f('0xa4')](loggerCatch(_0xcc7f('0xe7')));break;case 0x13:if(_0x4982e8[_0xcc7f('0x11b')]>=_0x3494d8[_0xcc7f('0x120')]-0x1){return!![];}hopperUtils[_0xcc7f('0xd5')]({'active':![],'countmachineretry':_0x4982e8[_0xcc7f('0x11b')]+=0x1,'scheduledat':moment()[_0xcc7f('0x184')](_0x3494d8[_0xcc7f('0x18c')],_0xcc7f('0xd6'))[_0xcc7f('0x81')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x4982e8[_0xcc7f('0xd7')],'ListId':_0x4982e8[_0xcc7f('0xd8')],'VoiceQueueId':_0x4982e8[_0xcc7f('0xd9')]||undefined,'CampaignId':_0x4982e8[_0xcc7f('0xda')]||undefined})['catch'](loggerCatch('[rescheduleContact][Machine]'));break;case 0x14:if(_0x4982e8[_0xcc7f('0x11c')]>=_0x3494d8[_0xcc7f('0x18d')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countagentrejectretry':_0x4982e8[_0xcc7f('0x11c')]+=0x1,'scheduledat':moment()['add'](_0x3494d8[_0xcc7f('0x18e')],_0xcc7f('0xd6'))['format'](_0xcc7f('0xc2')),'ContactId':_0x4982e8[_0xcc7f('0xd7')],'ListId':_0x4982e8[_0xcc7f('0xd8')],'VoiceQueueId':_0x4982e8[_0xcc7f('0xd9')]||undefined,'CampaignId':_0x4982e8[_0xcc7f('0xda')]||undefined})[_0xcc7f('0xa4')](loggerCatch(_0xcc7f('0x18f')));break;default:return!![];}};Dialer['prototype'][_0xcc7f('0x103')]=function(_0x52a3de,_0x291dfc,_0x1738d8){var _0x73905e=this;var _0xae6cc=new History(_0x52a3de);var _0x1afaa8=![];var _0x4959cb;var _0x2b8a63;return new Promise(function(_0x350833,_0x2bb18d){if(_[_0xcc7f('0x52')](_0x291dfc)&&typeof _0x291dfc!=='object'){return _0x2bb18d(msgResponse(_0xcc7f('0x190'),_0xcc7f('0x97'),_0xcc7f('0x191')));}if(_['isUndefined'](_0x1738d8)&&typeof _0x1738d8!==_0xcc7f('0x192')){return _0x2bb18d(msgResponse(_0xcc7f('0x190'),_0xcc7f('0x97'),'evt\x20is\x20undefine'));}hopperUtils[_0xcc7f('0x193')](_0xae6cc,_0x1738d8[_0xcc7f('0x194')],_0x291dfc)[_0xcc7f('0x9e')](function(_0x10f3c2){if(_0x10f3c2[_0xcc7f('0xe6')]==0x1)_0x1afaa8=!![];switch(_0x1738d8['reason']){case'0':_0x291dfc[_0xcc7f('0x195')]+=0x1;_0xae6cc[_0xcc7f('0xce')]=0x0;_0xae6cc[_0xcc7f('0x71')]=_0xcc7f('0x196');_0xae6cc['countnosuchnumberretry']+=0x1;_0xae6cc[_0xcc7f('0xd1')]+=0x1;ami[_0xcc7f('0x3e')](_0xcc7f('0x197'),ut[_0xcc7f('0x115')](_0x52a3de,_0xcc7f('0x198')));_0x4959cb=_0x291dfc['dialNoSuchNumberRetryFrequency'];_0x2b8a63=_0x291dfc[_0xcc7f('0xd3')];hopperUtils[_0xcc7f('0xc7')](_0xae6cc)[_0xcc7f('0xa4')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x73905e[_0xcc7f('0x181')](0x0,_0x52a3de,_0x291dfc)&&!_0x1afaa8){if(_0xae6cc['countnosuchnumberretry']>=_0x291dfc[_0xcc7f('0x188')]){_0x73905e[_0xcc7f('0x199')](_0xae6cc,_0x350833,_0x2bb18d,_0xcc7f('0x19a'));}else{_0x73905e[_0xcc7f('0x11e')](_0xae6cc,_0x350833,_0x2bb18d,_0xcc7f('0x19a'));}}break;case'3':_0x291dfc[_0xcc7f('0x19b')]+=0x1;_0xae6cc[_0xcc7f('0xce')]=0x3;_0xae6cc['statedesc']=_0xcc7f('0x19c');_0xae6cc['countnoanswerretry']+=0x1;_0xae6cc['countglobal']+=0x1;var _0x159d01=ut[_0xcc7f('0x19d')](_0x52a3de,_0x291dfc);ami[_0xcc7f('0x3e')](_0xcc7f('0x19e'),_0x159d01);_0x4959cb=_0x291dfc[_0xcc7f('0x19f')];_0x2b8a63=_0x291dfc[_0xcc7f('0xd3')];hopperUtils['createHistory'](_0xae6cc)[_0xcc7f('0xa4')](loggerCatch(_0xcc7f('0x1a0')));if(_0x73905e[_0xcc7f('0x181')](0x3,_0x52a3de,_0x291dfc)&&!_0x1afaa8){if(_0xae6cc[_0xcc7f('0x119')]>=_0x291dfc[_0xcc7f('0x182')]){_0x73905e[_0xcc7f('0x199')](_0xae6cc,_0x350833,_0x2bb18d,_0xcc7f('0x1a1'));}else{_0x73905e[_0xcc7f('0x11e')](_0xae6cc,_0x350833,_0x2bb18d,'reason\x203\x20ringing\x20no\x20answer');}}break;case'5':_0x291dfc[_0xcc7f('0x1a2')]+=0x1;_0xae6cc['state']=0x5;_0xae6cc[_0xcc7f('0x71')]=_0xcc7f('0x1a3');_0xae6cc[_0xcc7f('0x117')]+=0x1;_0xae6cc[_0xcc7f('0xd1')]+=0x1;ami[_0xcc7f('0x3e')](_0xcc7f('0x1a4'),ut[_0xcc7f('0x115')](_0x52a3de,'busy'));_0x4959cb=_0x291dfc['dialBusyRetryFrequency'];_0x2b8a63=_0x291dfc['callAdditionalPhoneAfterMin'];hopperUtils['createHistory'](_0xae6cc)[_0xcc7f('0xa4')](loggerCatch(_0xcc7f('0x1a5')));if(_0x73905e[_0xcc7f('0x181')](0x5,_0x52a3de,_0x291dfc)&&!_0x1afaa8){if(_0xae6cc['countbusyretry']>=_0x291dfc[_0xcc7f('0x1a6')]){_0x73905e[_0xcc7f('0x199')](_0xae6cc,_0x350833,_0x2bb18d,_0xcc7f('0x1a7'));}else{_0x73905e[_0xcc7f('0x11e')](_0xae6cc,_0x350833,_0x2bb18d,_0xcc7f('0x1a7'));}}break;case'8':_0x291dfc[_0xcc7f('0x1a8')]+=0x1;_0xae6cc[_0xcc7f('0xce')]=0x8;_0xae6cc['statedesc']=_0xcc7f('0x1a9');_0xae6cc['countcongestionretry']+=0x1;_0xae6cc[_0xcc7f('0xd1')]+=0x1;_0x4959cb=_0x291dfc[_0xcc7f('0x1aa')];_0x2b8a63=_0x291dfc[_0xcc7f('0xd3')];ami['emit'](_0xcc7f('0x1ab'),ut['buildObj'](_0x52a3de,_0xcc7f('0x1ac')));hopperUtils[_0xcc7f('0xc7')](_0xae6cc)[_0xcc7f('0xa4')](loggerCatch(_0xcc7f('0x1ad')));if(_0x73905e['checkRetriveMax'](0x8,_0x52a3de,_0x291dfc)&&!_0x1afaa8){if(_0xae6cc[_0xcc7f('0x118')]>=_0x291dfc[_0xcc7f('0x187')]){_0x73905e[_0xcc7f('0x199')](_0xae6cc,_0x350833,_0x2bb18d,_0xcc7f('0x1ae'));}else{_0x73905e[_0xcc7f('0x11e')](_0xae6cc,_0x350833,_0x2bb18d,_0xcc7f('0x1ae'));}}break;case'11':_0x291dfc['outboundAbandonedCallsDay']+=0x1;_0xae6cc[_0xcc7f('0xce')]=0xb;_0xae6cc['statedesc']=_0xcc7f('0x1af');_0xae6cc[_0xcc7f('0xe2')]+=0x1;_0xae6cc['countglobal']+=0x1;_0x4959cb=_0x291dfc[_0xcc7f('0xe3')];_0x2b8a63=_0x291dfc[_0xcc7f('0xd3')];hopperUtils['createHistory'](_0xae6cc)[_0xcc7f('0xa4')](loggerCatch(_0xcc7f('0xe8')));if(_0x73905e['checkRetriveMax'](0xb,_0x52a3de,_0x291dfc)&&!_0x1afaa8){if(_0xae6cc['countabandonedretry']>=_0x291dfc[_0xcc7f('0xe4')]){_0x73905e[_0xcc7f('0x199')](_0xae6cc,_0x350833,_0x2bb18d,_0xcc7f('0x1b0'));}else{_0x73905e['stateGlobal'](_0xae6cc,_0x350833,_0x2bb18d,'reason\x2011\x20abandoned');}}break;case'20':_0x291dfc[_0xcc7f('0x1b1')]+=0x1;_0xae6cc[_0xcc7f('0xce')]=0x14;_0xae6cc[_0xcc7f('0x71')]='AgentReject';_0xae6cc[_0xcc7f('0x11c')]+=0x1;_0xae6cc[_0xcc7f('0xd1')]+=0x1;_0x4959cb=_0x291dfc[_0xcc7f('0x18e')];_0x2b8a63=_0x291dfc[_0xcc7f('0xd3')];ami['emit'](_0xcc7f('0x1b2'),ut['buildObj'](_0x52a3de,_0xcc7f('0x1b3')));hopperUtils[_0xcc7f('0xc7')](_0xae6cc)[_0xcc7f('0xa4')](loggerCatch(_0xcc7f('0x1b4')));if(_0x73905e['checkRetriveMax'](0x14,_0x52a3de,_0x291dfc)&&!_0x1afaa8){if(_0xae6cc[_0xcc7f('0x11c')]>=_0x291dfc[_0xcc7f('0x18d')]){_0x73905e[_0xcc7f('0x199')](_0xae6cc,_0x350833,_0x2bb18d,_0xcc7f('0x1b5'));}else{_0x73905e[_0xcc7f('0x11e')](_0xae6cc,_0x350833,_0x2bb18d,'reason\x2020\x20agentreject');}}break;default:_0x291dfc[_0xcc7f('0x1b6')]+=0x1;_0xae6cc[_0xcc7f('0xce')]=0xc;_0xae6cc[_0xcc7f('0x71')]=_0x1738d8[_0xcc7f('0x194')];_0x4959cb=_0x291dfc[_0xcc7f('0x18e')];_0x2b8a63=_0x291dfc[_0xcc7f('0xd3')];hopperUtils[_0xcc7f('0xc7')](_0xae6cc)['catch'](loggerCatch('[syncAgentComplete][createHistory][?]'));if(_0x73905e[_0xcc7f('0x181')](_0x1738d8[_0xcc7f('0x194')],_0x52a3de,_0x291dfc)&&!_0x1afaa8){if(_0xae6cc[_0xcc7f('0x117')]+_0xae6cc['countcongestionretry']+_0xae6cc['countnoanswerretry']+_0xae6cc[_0xcc7f('0x11a')]+_0xae6cc[_0xcc7f('0x126')]+_0xae6cc[_0xcc7f('0xe2')]+_0xae6cc['countmachineretry']+_0xae6cc['countagentrejectretry']>=_0x291dfc[_0xcc7f('0x11d')]){_0x73905e[_0xcc7f('0x11e')](_0xae6cc,_0x350833,_0x2bb18d,_0x1738d8[_0xcc7f('0x194')]);}else{_0x73905e[_0xcc7f('0x199')](_0xae6cc,_0x350833,_0x2bb18d,_0x1738d8['reason']);}}}})[_0xcc7f('0x9e')](function(){if(_0x1afaa8){hopperUtils[_0xcc7f('0xde')](_0xae6cc,_0x4959cb,_0x2b8a63)['then'](function(){return _0x350833(0x1);});}});});};Dialer[_0xcc7f('0x8e')][_0xcc7f('0x11e')]=function(_0x44ed7b,_0x49388f,_0x67dad8,_0x202f60){var _0x4d93b9=new Final(_0x44ed7b);_0x4d93b9[_0xcc7f('0xce')]=0xf;_0x4d93b9[_0xcc7f('0x71')]=_0xcc7f('0x1b7');this[_0xcc7f('0x199')](_0x4d93b9,_0x49388f,_0x67dad8,_0x202f60);};Dialer[_0xcc7f('0x8e')][_0xcc7f('0x199')]=function(_0x29ed96,_0x5dd7fa,_0x5f1d60,_0x3679d8){hopperUtils[_0xcc7f('0xc9')](_0x29ed96)[_0xcc7f('0x9e')](function(){return _0x5dd7fa(msgResponse(_0xcc7f('0x190'),'Success',_0x3679d8));})['catch'](function(){return _0x5f1d60(msgResponse(_0xcc7f('0x1b8'),_0xcc7f('0x97'),'contact\x20not\x20moved'));});};Dialer['prototype'][_0xcc7f('0xa')]=function(_0x19673d){var _0x592ca1=_0x19673d[_0xcc7f('0x1b9')]/0x64;var _0x2fe581=_0x19673d['outboundDropCallsDayTimeout']/(_0x19673d[_0xcc7f('0xcc')]+_0x19673d['outboundAnswerCallsDay']);var _0xc7d6e5=Math['round'](_0x19673d[_0xcc7f('0x1ba')]*(_0x19673d[_0xcc7f('0x1bb')]/0x64));var _0x3a99e8=Math['round'](_0x19673d[_0xcc7f('0x1ba')]*(_0x19673d['predictiveIntervalMinThreshold']/0x64));var _0x1a970c=_0x19673d['available']+_0x19673d[_0xcc7f('0x131')];var _0x9a3329=Math[_0xcc7f('0x1bc')](_0x19673d[_0xcc7f('0x1bd')]*_0x19673d['erlangAbandonmentRate']*_0x19673d[_0xcc7f('0x1be')]*_0x19673d['predictiveIntervalMultiplicativeFactor']);if(_['isUndefined'](_0x19673d[_0xcc7f('0x60')])){if(!_[_0xcc7f('0x52')](_0x19673d[_0xcc7f('0x26')])){_0x19673d['startPredictive']=undefined;loggerPredictive['error'](_0xcc7f('0x1bf'),'check\x20predictive\x20is\x20not\x20undefine');}if(!_['isUndefined'](_0x19673d[_0xcc7f('0x64')])){loggerPredictive[_0xcc7f('0x66')](_0xcc7f('0x1bf'),'check\x20handlePredictive\x20is\x20not\x20undefine');clearInterval(_0x19673d[_0xcc7f('0x64')]);_0x19673d[_0xcc7f('0x64')]=undefined;}_0x19673d[_0xcc7f('0x60')]=moment()['format'](_0xcc7f('0xc2'));loggerPredictive[_0xcc7f('0x47')](_0x19673d[_0xcc7f('0x61')],'collection\x20data\x20in\x20progressive\x20at',_0x19673d[_0xcc7f('0x60')]);this[_0xcc7f('0xb6')](_0x19673d,0x1);}else if(ifInterval(_0x19673d['dialPredictiveInterval'],_0x19673d[_0xcc7f('0x60')])){this[_0xcc7f('0xb6')](_0x19673d,0x1);loggerPredictiveCalls['info']('[startMethodPredictive][StartProgressive][Loop]',_0x19673d[_0xcc7f('0x60')],_0x19673d[_0xcc7f('0x61')]);_0x19673d['erlangCalls']=0x0;_0x19673d[_0xcc7f('0xcd')]=0x0;}else if(_0x592ca1<_0x2fe581&&_0x19673d[_0xcc7f('0x1c0')]==='dropRate'){clearPredictiveAttributes(_0x19673d);loggerPredictive[_0xcc7f('0x47')]('[stopMethodPredictive][ReStartProgressive][ExceededDropDay]',_0xcc7f('0x1c1'),_0x2fe581,_0xcc7f('0x60'),_0x19673d[_0xcc7f('0x61')]);}else if(_0x9a3329<_0x19673d[_0xcc7f('0xcd')]&&_0x19673d['dialPredictiveOptimization']===_0xcc7f('0x1c2')){clearPredictiveAttributes(_0x19673d);loggerPredictive['info'](_0xcc7f('0x1c3'),_0xcc7f('0x1c4'),_0x9a3329,_0xcc7f('0x1c5'),_0x19673d[_0xcc7f('0xcd')],_0xcc7f('0x60'),_0x19673d[_0xcc7f('0x61')]);}else if(!ifInterval(_0x19673d['dialPredictiveInterval'],_0x19673d[_0xcc7f('0x60')])&&_[_0xcc7f('0x52')](_0x19673d[_0xcc7f('0x26')])&&!_['isUndefined'](_0x19673d[_0xcc7f('0x60')])){_0x19673d['startPredictive']=moment()[_0xcc7f('0x81')](_0xcc7f('0xc2'));loggerPredictive[_0xcc7f('0x47')](_0x19673d[_0xcc7f('0x61')],_0xcc7f('0x1c6'),_0x19673d[_0xcc7f('0x26')]);hopperUtils[_0xcc7f('0x1c7')](_0x19673d[_0xcc7f('0x1c8')])[_0xcc7f('0x9e')](this['getDataPredictive'](_0x19673d))[_0xcc7f('0x9e')](mergeDataErlangB(_0x19673d))[_0xcc7f('0x9e')](this[_0xcc7f('0x1c9')](_0x19673d))[_0xcc7f('0xa4')](loggerCatchPredictive('Predictive\x20after\x20first\x20interval',_0x19673d));}else if(!ifInterval(_0x19673d[_0xcc7f('0x1c8')],_0x19673d['startPredictive'])){_0x19673d[_0xcc7f('0xcd')]=0x0;_0x19673d[_0xcc7f('0x26')]=moment()[_0xcc7f('0x81')](_0xcc7f('0xc2'));loggerPredictive['info'](_0x19673d[_0xcc7f('0x61')],_0xcc7f('0x1ca'),_0x19673d[_0xcc7f('0x26')]);clearInterval(_0x19673d['handlePredictive']);_0x19673d[_0xcc7f('0x64')]=undefined;hopperUtils[_0xcc7f('0x1c7')](_0x19673d['dialPredictiveInterval'])[_0xcc7f('0x9e')](this['getDataPredictive'](_0x19673d))[_0xcc7f('0x9e')](mergeDataErlangB(_0x19673d))[_0xcc7f('0x9e')](this['startMethodPredictive'](_0x19673d))[_0xcc7f('0xa4')](loggerCatchPredictive('Predictive\x20for\x20every\x20interval',_0x19673d));}else if(_0x19673d[_0xcc7f('0x1ba')]&&_0x1a970c<_0x19673d[_0xcc7f('0x1ba')]-_0x3a99e8){clearPredictiveAttributes(_0x19673d);loggerPredictive[_0xcc7f('0x47')](_0x19673d[_0xcc7f('0x61')],_0xcc7f('0x1cb'),_0x1a970c,_0xcc7f('0x1cc'),_0x19673d[_0xcc7f('0x1ba')],'-',_0x3a99e8,'=',_0x19673d['predictiveIntervalAvailable']-_0x3a99e8,')');}else if(_0x19673d['predictiveIntervalAvailable']&&_0x1a970c>_0x19673d['predictiveIntervalAvailable']+_0xc7d6e5){clearPredictiveAttributes(_0x19673d);loggerPredictive[_0xcc7f('0x47')](_0x19673d[_0xcc7f('0x61')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x1a970c,')\x20are\x20more\x20than\x20threshold\x20(',_0x19673d[_0xcc7f('0x1ba')],'+',_0xc7d6e5,'=',_0x19673d[_0xcc7f('0x1ba')]+_0xc7d6e5,')');}};Dialer[_0xcc7f('0x8e')][_0xcc7f('0x1cd')]=function(_0x2748e1){var _0xe983c0=this;return function(_0x5b1563){return new Promise(function(_0x13a531,_0xcc4a5f){_[_0xcc7f('0x5e')](_0x2748e1,_0x5b1563[0x0]);if(checkGetDataPredictive(_0x5b1563[0x0])){var _0x5ee5a3=_0x2748e1['predictiveIntervalAvailable']=_0x2748e1[_0xcc7f('0x131')]+_0x2748e1[_0xcc7f('0x130')];var _0x188c44=_0x2748e1['dialPredictiveInterval']*0x3c;var _0x23f1f2=_0x5b1563[0x0][_0xcc7f('0x50')]+_0x5b1563[0x0][_0xcc7f('0x4e')];var _0x113803=(_0x5b1563[0x0][_0xcc7f('0x1ce')]+_0x5b1563[0x0][_0xcc7f('0x4c')]+_0x5b1563[0x0][_0xcc7f('0xdf')])/_0x5b1563[0x0][_0xcc7f('0x51')];_0x2748e1[_0xcc7f('0x1be')]=_0x113803>0x0?_0x113803:0x1;switch(_0x2748e1['dialPredictiveOptimization']){case'dropRate':var _0x1d03d2=_0x2748e1[_0xcc7f('0x1b9')]/0x64;return _0xe983c0[_0xcc7f('0x1cf')](_0x5ee5a3,_0x188c44,_0x23f1f2,_0x113803,_0x1d03d2)['then'](function(_0x1d307c){return _0x13a531(_0x1d307c);});case _0xcc7f('0x1d0'):var _0x24dfd7=_0x2748e1['dialPredictiveOptimizationPercentage']/0x64;return _0xe983c0[_0xcc7f('0x1d1')](_0x5ee5a3,_0x188c44,_0x23f1f2,_0x113803,_0x24dfd7)['then'](function(_0x344e22){return _0x13a531(_0x344e22);});default:return _0xcc4a5f(msgResponse(_0xcc7f('0x1d2'),'Failure','Unknown\x20Predictive'));}}else{return _0xcc4a5f(msgResponse('[getDataPredictive]',_0xcc7f('0x97'),_0xcc7f('0x1d3')));}});};};Dialer[_0xcc7f('0x8e')][_0xcc7f('0x1d4')]=function(_0x2a28c1){var _0x4779f2=this;return function(_0x12e70e){return new Promise(function(_0x1aab6e,_0x207e61){_[_0xcc7f('0x5e')](_0x2a28c1,_0x12e70e[0x0]);if(checkGetDataPredictive(_0x12e70e[0x0])){loggerPredictive[_0xcc7f('0x47')](JSON[_0xcc7f('0x77')](_0x12e70e[0x0]));if(_0x2a28c1[_0xcc7f('0x1c0')]==='dropRate'){return _0x4779f2[_0xcc7f('0x148')](_0x2a28c1['id'])[_0xcc7f('0x9e')](function(_0x30967d){var _0x5d60d7=_0x2a28c1[_0xcc7f('0x1d5')]-_0x30967d[0x0][_0xcc7f('0x1d6')];var _0x1b8685=_0x2a28c1[_0xcc7f('0x1c8')]*0x3c;var _0x33fa90=_0x12e70e[0x0][_0xcc7f('0x50')]+_0x12e70e[0x0][_0xcc7f('0x4e')];var _0x499362=(_0x12e70e[0x0][_0xcc7f('0x1ce')]+_0x12e70e[0x0][_0xcc7f('0x4c')]+_0x12e70e[0x0][_0xcc7f('0xdf')])/_0x12e70e[0x0][_0xcc7f('0x51')];var _0x28ad00=_0x2a28c1[_0xcc7f('0x1b9')]/0x64;_0x2a28c1[_0xcc7f('0x1d7')]=_0x30967d[0x0][_0xcc7f('0x1d6')]||0x0;_0x2a28c1[_0xcc7f('0x1be')]=_0x499362>0x0?_0x499362:0x1;return _0x4779f2[_0xcc7f('0x1cf')](_0x5d60d7,_0x1b8685,_0x33fa90,_0x499362,_0x28ad00);})[_0xcc7f('0x9e')](function(_0x465152){return _0x1aab6e(_0x465152);})[_0xcc7f('0xa4')](function(_0x11ae44){return _0x207e61(msgResponse(_0xcc7f('0x1d8'),_0xcc7f('0x97'),JSON[_0xcc7f('0x77')](_0x11ae44)));});}if(_0x2a28c1[_0xcc7f('0x1c0')]==='agentBusyFactor'){return _0x4779f2[_0xcc7f('0x148')](_0x2a28c1['id'])[_0xcc7f('0x9e')](function(_0x60f265){var _0x4e6528=_0x2a28c1[_0xcc7f('0x1d5')]-_0x60f265[0x0][_0xcc7f('0x1d6')];var _0x5207d6=_0x2a28c1[_0xcc7f('0x1c8')]*0x3c;var _0x4fe5c1=_0x12e70e[0x0]['predictiveIntervalAvgTalktime']+_0x12e70e[0x0][_0xcc7f('0x4e')];var _0x1faf2a=(_0x12e70e[0x0][_0xcc7f('0x1ce')]+_0x12e70e[0x0][_0xcc7f('0x4c')]+_0x12e70e[0x0][_0xcc7f('0xdf')])/_0x12e70e[0x0][_0xcc7f('0x51')];var _0x119383=_0x2a28c1[_0xcc7f('0x1b9')]/0x64;_0x2a28c1['predictiveIntervalPauses']=_0x60f265[0x0][_0xcc7f('0x1d6')]||0x0;_0x2a28c1['predictiveIntervalHitRate']=_0x1faf2a>0x0?_0x1faf2a:0x1;return _0x4779f2[_0xcc7f('0x1d1')](_0x4e6528,_0x5207d6,_0x4fe5c1,_0x1faf2a,_0x119383);})[_0xcc7f('0x9e')](function(_0x1fcca3){return _0x1aab6e(_0x1fcca3);})[_0xcc7f('0xa4')](function(_0x45fb57){return _0x207e61(msgResponse(_0xcc7f('0x1d8'),_0xcc7f('0x97'),JSON[_0xcc7f('0x77')](_0x45fb57)));});}}else{return _0x207e61(msgResponse(_0xcc7f('0x1d2'),_0xcc7f('0x97'),_0xcc7f('0x1d3')));}});};};Dialer[_0xcc7f('0x8e')][_0xcc7f('0x1c9')]=function(_0x14d3f7){var _0x5e07f2=this;return function(){var _0x125d0f=0x0;var _0x5397cc=Math[_0xcc7f('0x1bc')](_0x14d3f7[_0xcc7f('0x58')]*0x3e8);if(_0x5397cc>0x0){_0x5397cc=_0x5397cc<0x64?0x64:_0x5397cc;loggerPredictive['info'](_0x14d3f7[_0xcc7f('0x61')],_0xcc7f('0x1d9'),_0x5397cc,_0xcc7f('0x1da'));_0x14d3f7[_0xcc7f('0x64')]=setInterval(function(){_0x5e07f2[_0xcc7f('0x64')](_0x14d3f7);loggerPredictiveCalls[_0xcc7f('0x47')](_0xcc7f('0x1db'),_0x125d0f+=0x1);},_0x5397cc);}else{loggerPredictive[_0xcc7f('0x47')](_0x14d3f7[_0xcc7f('0x61')],'fail\x20to\x20scheduled\x20calls');}};};Dialer[_0xcc7f('0x8e')][_0xcc7f('0x1dc')]=function(_0x558e7a,_0x148415){var _0x2f1a12=this;return function(_0x47afdd){if(_[_0xcc7f('0x46')](_0x47afdd)){if(_['isNil'](_0x148415[_0xcc7f('0x14e')])||!_0x148415[_0xcc7f('0x1dd')]){if(_0x558e7a['dialMethod']===_0xcc7f('0x9')){_0x558e7a[_0xcc7f('0x74')]=_[_0xcc7f('0x52')](_0x558e7a['queueStatusComplete'])?!![]:_0x558e7a['queueStatusComplete'];var _0x36c9ef=uuid['v4']();_0x2f1a12[_0xcc7f('0xea')][_0x36c9ef]=new Action(_0x558e7a,_0x148415,_0x36c9ef);loggerBooked[_0xcc7f('0x47')](_0xcc7f('0x1de'),_0x36c9ef,_0xcc7f('0x1df'),JSON['stringify'](_0x558e7a[_0xcc7f('0x74')]),'Queue:\x20',_0x558e7a[_0xcc7f('0x61')]);if(_0x558e7a[_0xcc7f('0x74')]){_0x558e7a[_0xcc7f('0x74')]=![];_0x2f1a12[_0xcc7f('0x28')][_0x2f1a12[_0xcc7f('0xea')][_0x36c9ef][_0xcc7f('0xbe')]]=[];ami[_0xcc7f('0x9d')]({'actionid':_0x36c9ef,'action':_0xcc7f('0x1e0'),'queue':_0x558e7a[_0xcc7f('0x61')]})['catch'](function(){_0x2f1a12['updateOriginated'](_0x558e7a);hopperUtils[_0xcc7f('0xd5')]({'active':![],'ContactId':_0x2f1a12[_0xcc7f('0xea')][_0x36c9ef][_0xcc7f('0xd7')],'ListId':_0x2f1a12[_0xcc7f('0xea')][_0x36c9ef][_0xcc7f('0xd8')],'VoiceQueueId':_0x2f1a12[_0xcc7f('0xea')][_0x36c9ef][_0xcc7f('0xd9')]||undefined,'CampaignId':_0x2f1a12[_0xcc7f('0xea')][_0x36c9ef][_0xcc7f('0xda')]||undefined})['catch'](loggerCatch(_0xcc7f('0x1e1')));delete _0x2f1a12[_0xcc7f('0xea')][_0x36c9ef];});}else{loggerBooked[_0xcc7f('0x47')]('[booked][checkContactBlack][else]',JSON['stringify'](_0x558e7a['queueStatusComplete']),'Queue:\x20',_0x558e7a['name']);_0x2f1a12['updateOriginated'](_0x558e7a);hopperUtils[_0xcc7f('0xd5')]({'active':![],'ContactId':_0x2f1a12[_0xcc7f('0xea')][_0x36c9ef][_0xcc7f('0xd7')],'ListId':_0x2f1a12[_0xcc7f('0xea')][_0x36c9ef][_0xcc7f('0xd8')],'VoiceQueueId':_0x2f1a12[_0xcc7f('0xea')][_0x36c9ef][_0xcc7f('0xd9')]||undefined,'CampaignId':_0x2f1a12[_0xcc7f('0xea')][_0x36c9ef][_0xcc7f('0xda')]||undefined})[_0xcc7f('0xa4')](loggerCatch(_0xcc7f('0x1e1')));delete _0x2f1a12[_0xcc7f('0xea')][_0x36c9ef];}}else{return _0x2f1a12[_0xcc7f('0x1e2')](_0x558e7a,_0x148415);}}else{if(utils[_0xcc7f('0x5f')](undefined,_0x148415[_0xcc7f('0x1e3')])<_0x558e7a[_0xcc7f('0x1e4')]*0x3c){if(_0x148415[_0xcc7f('0x13e')]&&!_0x148415[_0xcc7f('0x13e')][_0xcc7f('0x1e5')]){_0x2f1a12['preview']['run'](_0x148415['id'])[_0xcc7f('0x1c')](function(){_0x2f1a12['updateOriginated'](_0x558e7a);});}else{hopperUtils['unlockContact']({'active':![]},_0x148415['id'],0x1)[_0xcc7f('0x1c')](function(){_0x2f1a12[_0xcc7f('0xc1')](_0x558e7a);});}}else{_0x558e7a['outboundReCallsDay']+=0x1;_0x2f1a12[_0xcc7f('0xc1')](_0x558e7a);if(_0x558e7a[_0xcc7f('0x1e6')]){hopperUtils['rescheduleContact']({'active':![],'recallme':![],'UserId':null,'ContactId':_0x148415[_0xcc7f('0xd7')],'ListId':_0x148415['ListId'],'VoiceQueueId':_0x148415[_0xcc7f('0xd9')]||undefined,'CampaignId':_0x148415[_0xcc7f('0xda')]||undefined})['catch'](loggerCatch(_0xcc7f('0x1e7')));hopperUtils[_0xcc7f('0xc7')](createObjHistory(_0x558e7a,_0x148415,utils[_0xcc7f('0x6a')][_0xcc7f('0x1e8')],0x17,_0xcc7f('0x1e9')))[_0xcc7f('0xa4')](loggerCatch(_0xcc7f('0x1ea')));}else{_0x2f1a12[_0xcc7f('0x111')](createObjHistory(_0x558e7a,_0x148415,utils[_0xcc7f('0x6a')]['RECALL_TIMEOUT'],0x16,_0xcc7f('0x1eb')),_0xcc7f('0x1ec'),_0xcc7f('0x1ed'));}}}}else{_0x558e7a[_0xcc7f('0x1ee')]+=0x1;_0x2f1a12[_0xcc7f('0x111')](createObjHistory(_0x558e7a,_0x148415,utils['CAMPAIGN_STATUS'][_0xcc7f('0x1ef')],0xd,_0xcc7f('0x1f0')),_0xcc7f('0x1f1'),_0xcc7f('0x1f2'));throw'inBlackList';}};};Dialer['prototype']['handleIvr']=function(_0xa65800){var _0x5653ab=this;var _0x2f8b80=_0xa65800['limitCalls']-_0xa65800[_0xcc7f('0x149')];emitCampaignSummary(_0xa65800);if(_0x2f8b80>0x0&&_0xa65800[_0xcc7f('0x1f3')]==0x0){if(_0x2f8b80>this[_0xcc7f('0x22')]){_0x2f8b80=this[_0xcc7f('0x22')];}_0xa65800[_0xcc7f('0x1f3')]=0x1;hopperUtils[_0xcc7f('0x1f4')](_0xa65800,_0x2f8b80)[_0xcc7f('0x9e')](function(_0x222612){_0xa65800[_0xcc7f('0x1f3')]=0x0;if(_0x222612){if(!utils['checkContactEmpty'](_0x222612)){_0xa65800[_0xcc7f('0x69')]=utils['CAMPAIGN_STATUS'][_0xcc7f('0x6f')];logger[_0xcc7f('0x47')](_0xcc7f('0x1f5')+_0xa65800[_0xcc7f('0x61')]);}else{_0xa65800[_0xcc7f('0x149')]+=_0x222612[_0xcc7f('0x9b')];_0xa65800['message']=utils[_0xcc7f('0x6a')]['RUNNING'];for(var _0x32938a=0x0;_0x32938a<_0x222612[_0xcc7f('0x9b')];_0x32938a+=0x1){_0xa65800[_0xcc7f('0x1f6')]+=0x1;if(_[_0xcc7f('0xee')](_0x222612[_0x32938a])||_[_0xcc7f('0xee')](_0x222612[_0x32938a]['Contact'])||_[_0xcc7f('0xee')](_0x222612[_0x32938a][_0xcc7f('0x154')])){_0x5653ab[_0xcc7f('0x1f7')](_0xcc7f('0x1f8'),_0xa65800,_0x222612[_0x32938a]);}else{hopperUtils[_0xcc7f('0x1f9')](_[_0xcc7f('0x78')](_0x222612[_0x32938a],[_0xcc7f('0xda'),'phone']))[_0xcc7f('0x9e')](_0x5653ab[_0xcc7f('0x1dc')](_0xa65800,_0x222612[_0x32938a]))[_0xcc7f('0xa4')](_0x5653ab[_0xcc7f('0x14c')](_0xcc7f('0x1fa'),_0xa65800));}}}}})[_0xcc7f('0xa4')](loggerGetContactDialer(_0xcc7f('0x1fb'),_0xa65800,_0x2f8b80));}};Dialer[_0xcc7f('0x8e')]['handlePower']=function(_0x55f501,_0x3baa4f){var _0x18549f=this;var _0x4b981a=[];if(_0x3baa4f<0x1||_0x55f501['dialMethod']===_0xcc7f('0x9')){_0x3baa4f=0x1;}var _0x3573f9=Math[_0xcc7f('0x1bc')](_0x55f501[_0xcc7f('0x130')]*_0x3baa4f)-_0x55f501[_0xcc7f('0x149')];if(_0x55f501[_0xcc7f('0x1fc')]>0x0){var _0x5b90b0=_0x55f501['dialLimitQueue']-_0x55f501[_0xcc7f('0x149')]-_0x55f501[_0xcc7f('0x131')]-_0x55f501[_0xcc7f('0x132')];if(_0x3573f9>_0x5b90b0){_0x3573f9=_0x5b90b0;}}if(_0x3573f9>0x0&&_0x55f501[_0xcc7f('0x1f3')]==0x0){if(_0x55f501[_0xcc7f('0x1fd')]===_0xcc7f('0x9')){_0x3573f9=0x1;}if(_0x3573f9>this['maxNumberOriginate']){_0x3573f9=this[_0xcc7f('0x22')];}for(var _0x563576 in this[_0xcc7f('0x20')]){if(typeof this[_0xcc7f('0x20')][_0x563576]!==_0xcc7f('0xae')){if(this[_0xcc7f('0x20')][_0x563576][_0xcc7f('0xce')]==='not_inuse'&&this['agents'][_0x563576][_0xcc7f('0x8c')]==='reachable'){_0x4b981a[_0xcc7f('0x9c')](this[_0xcc7f('0x20')][_0x563576]['id']);}}}_0x55f501['temp']=0x1;hopperUtils[_0xcc7f('0x1fe')](_0x55f501,_0x4b981a,_0x3573f9)[_0xcc7f('0x9e')](function(_0x22d3a5){_0x55f501['temp']=0x0;if(_0x22d3a5){if(!utils[_0xcc7f('0x1ff')](_0x22d3a5)){hopperUtils[_0xcc7f('0x200')](_0x55f501)[_0xcc7f('0x9e')](sendMessageReschedule(_0x55f501))['catch'](loggerCatch(_0xcc7f('0x201')));}else{_0x55f501[_0xcc7f('0x149')]+=_0x22d3a5[_0xcc7f('0x9b')];_0x55f501[_0xcc7f('0x69')]=_0x55f501['dialMethod']==='booked'?utils['CAMPAIGN_STATUS']['ACTIVE']:utils[_0xcc7f('0x6a')][_0xcc7f('0x202')];for(var _0x52488d=0x0;_0x52488d<_0x22d3a5[_0xcc7f('0x9b')];_0x52488d+=0x1){if(_['isNil'](_0x22d3a5[_0x52488d])||_[_0xcc7f('0xee')](_0x22d3a5[_0x52488d]['Contact'])||_['isNil'](_0x22d3a5[_0x52488d][_0xcc7f('0x154')])){_0x18549f[_0xcc7f('0x1f7')](_0xcc7f('0x1f8'),_0x55f501,_0x22d3a5[_0x52488d]);}else{hopperUtils['checkIsBlackList'](_['pick'](_0x22d3a5[_0x52488d],[_0xcc7f('0xd9'),_0xcc7f('0x154')]))[_0xcc7f('0x9e')](_0x18549f[_0xcc7f('0x1dc')](_0x55f501,_0x22d3a5[_0x52488d]))['catch'](_0x18549f['loggerHandler'](_0xcc7f('0x1f8'),_0x55f501));}}}}})['catch'](loggerGetContactDialer('[getContactDialer2]',_0x55f501,_0x3573f9));}};Dialer[_0xcc7f('0x8e')][_0xcc7f('0x64')]=function(_0x108459){if(_0x108459[_0xcc7f('0x1fc')]>0x0){var _0x203e85=_0x108459[_0xcc7f('0x1fc')]-_0x108459[_0xcc7f('0x149')]-_0x108459['talking'];if(_0x203e85>0x0&&_0x108459[_0xcc7f('0x1f3')]==0x0){this[_0xcc7f('0x203')](_0x108459);}else{loggerPredictiveCalls[_0xcc7f('0x47')](_0xcc7f('0x204'));}}else{this[_0xcc7f('0x203')](_0x108459);}};Dialer[_0xcc7f('0x8e')]['tryOriginatePredictive']=function(_0xdcdb47){var _0x163f38=this;var _0x103a34=[];_0xdcdb47[_0xcc7f('0x149')]+=0x1;for(var _0x5a5d84 in this['agents']){if(typeof this[_0xcc7f('0x20')][_0x5a5d84]!=='undefined'){if(this['agents'][_0x5a5d84][_0xcc7f('0xce')]===_0xcc7f('0x205')&&this[_0xcc7f('0x20')][_0x5a5d84][_0xcc7f('0x8c')]===_0xcc7f('0x13c')){_0x103a34[_0xcc7f('0x9c')](this['agents'][_0x5a5d84]['id']);}}}_0xdcdb47['temp']=0x1;return this[_0xcc7f('0x1fe')](_0xdcdb47['id'],_0x103a34,0x1,_0xdcdb47[_0xcc7f('0x206')],_0xdcdb47)['then'](function(_0x2f4d8b){_0xdcdb47[_0xcc7f('0x1f3')]=0x1;if(_0x2f4d8b){if(!utils[_0xcc7f('0x1ff')](_0x2f4d8b)){utils[_0xcc7f('0x68')](_0xdcdb47,0x1,0x0);return hopperUtils['countReScheduled'](_0xdcdb47)['then'](sendMessageReschedule(_0xdcdb47))[_0xcc7f('0xa4')](loggerCatch(_0xcc7f('0x201')));}else{_0xdcdb47[_0xcc7f('0x69')]=utils[_0xcc7f('0x6a')][_0xcc7f('0x202')];if(_['isNil'](_0x2f4d8b[0x0])||_['isNil'](_0x2f4d8b[0x0]['Contact'])||_[_0xcc7f('0xee')](_0x2f4d8b[0x0][_0xcc7f('0x154')])){_0x163f38[_0xcc7f('0x1f7')](_0xcc7f('0x1f8'),_0xdcdb47,_0x2f4d8b[0x0]);}else{return hopperUtils['checkIsBlackList'](_[_0xcc7f('0x78')](_0x2f4d8b[0x0],[_0xcc7f('0xd9'),_0xcc7f('0x154')]))['then'](_0x163f38[_0xcc7f('0x1dc')](_0xdcdb47,_0x2f4d8b[0x0]))[_0xcc7f('0xa4')](_0x163f38[_0xcc7f('0x14c')]('[actionOriginatePredictive]\x20',_0xdcdb47));}}}})['catch'](loggerGetContactDialer(_0xcc7f('0x207'),_0xdcdb47,0x1));};Dialer[_0xcc7f('0x8e')]['abandonmentRate']=function(_0x49d61d,_0x2ff3b4,_0x45f59a,_0x195c1d,_0x18d84,_0x40a1db){loggerPredictive[_0xcc7f('0x47')](_0xcc7f('0x208'));loggerPredictive[_0xcc7f('0x47')](_0xcc7f('0x209'),_0x49d61d);loggerPredictive['info'](_0xcc7f('0x20a'),_0x2ff3b4);loggerPredictive[_0xcc7f('0x47')](_0xcc7f('0x20b'),_0x45f59a);loggerPredictive[_0xcc7f('0x47')](_0xcc7f('0x20c'),_0x195c1d);loggerPredictive[_0xcc7f('0x47')](_0xcc7f('0x20d'),_0x18d84);loggerPredictive['info'](_0xcc7f('0x5d'));return new Promise(function(_0xa22db2,_0x42e703){if(_0x49d61d<=0x0||isNaN(_0x49d61d)){return _0x42e703(msgResponse('[abandonmentRate]','Error',_0xcc7f('0x20e')+_0x49d61d));}if(_0x45f59a<=0x0||isNaN(_0x45f59a)){return _0x42e703(msgResponse(_0xcc7f('0x20f'),'Error','Ts\x20=\x20'+_0x45f59a));}if(_0x195c1d<=0x0||isNaN(_0x195c1d)){return _0x42e703(msgResponse('[abandonmentRate]',_0xcc7f('0xbd'),'p\x20=\x20'+_0x195c1d));}if(_0x2ff3b4<=0x0||isNaN(_0x2ff3b4)){return _0x42e703(msgResponse(_0xcc7f('0x20f'),_0xcc7f('0xbd'),'interval\x20=\x20'+_0x2ff3b4));}if(_0x18d84<=0x0||isNaN(_0x18d84)){return _0x42e703(msgResponse(_0xcc7f('0x20f'),_0xcc7f('0xbd'),_0xcc7f('0x210')+_0x18d84));}_0x40a1db=_0x40a1db||0x0;var _0x3f3e58=0x1/_0x45f59a;var _0x212b3d=0x0;var _0x5121fa=0x0;var _0x4a1c06=0x0;var _0x37895b=0x0;for(var _0x2e9c48=0x0;_0x4a1c06<_0x18d84;_0x2e9c48+=0x1){_0x5121fa=_0x2e9c48/_0x2ff3b4;_0x212b3d=(_0x195c1d*_0x5121fa+_0x40a1db)/_0x3f3e58;_0x4a1c06=utils[_0xcc7f('0x211')](_0x212b3d,_0x49d61d);_0x37895b=_0x212b3d/_0x49d61d*(0x1-utils[_0xcc7f('0x211')](_0x212b3d,_0x49d61d));}return _0xa22db2({'erlangCalls':_0x2e9c48,'erlangCallToSecond':_0x2ff3b4/_0x2e9c48,'erlangAbandonmentRate':_0x4a1c06,'erlangBusyFactor':_0x37895b});});};Dialer['prototype'][_0xcc7f('0x1d1')]=function(_0x43e8da,_0x5177ea,_0x40e1ca,_0x50899d,_0x479c72,_0x425545){loggerPredictive[_0xcc7f('0x47')](_0xcc7f('0x212'));loggerPredictive[_0xcc7f('0x47')](_0xcc7f('0x209'),_0x43e8da);loggerPredictive[_0xcc7f('0x47')](_0xcc7f('0x20a'),_0x5177ea);loggerPredictive[_0xcc7f('0x47')]('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',_0x40e1ca);loggerPredictive[_0xcc7f('0x47')](_0xcc7f('0x20c'),_0x50899d);loggerPredictive['info'](_0xcc7f('0x213'),_0x479c72);loggerPredictive[_0xcc7f('0x47')](_0xcc7f('0x5d'));return new Promise(function(_0x2bd93d,_0x5edd33){if(_0x43e8da<=0x0||isNaN(_0x43e8da)){return _0x5edd33(msgResponse(_0xcc7f('0x214'),_0xcc7f('0xbd'),_0xcc7f('0x20e')+_0x43e8da));}if(_0x40e1ca<=0x0||isNaN(_0x40e1ca)){return _0x5edd33(msgResponse(_0xcc7f('0x214'),_0xcc7f('0xbd'),_0xcc7f('0x215')+_0x40e1ca));}if(_0x50899d<=0x0||isNaN(_0x50899d)){return _0x5edd33(msgResponse('[busyFactor]',_0xcc7f('0xbd'),_0xcc7f('0x216')+_0x50899d));}if(_0x5177ea<=0x0||isNaN(_0x5177ea)){return _0x5edd33(msgResponse(_0xcc7f('0x214'),_0xcc7f('0xbd'),_0xcc7f('0x217')+_0x5177ea));}if(_0x479c72<=0x0||isNaN(_0x479c72)){return _0x5edd33(msgResponse('[busyFactor]',_0xcc7f('0xbd'),'Umin\x20=\x20'+_0x479c72));}_0x425545=_0x425545||0x0;var _0x4f1afd=0x1/_0x40e1ca;var _0x4a9eab=0x0;var _0x326227=0x0;var _0x20b4b0=0x0;var _0x3854d6=0x0;for(var _0x17aab5=0x0;_0x3854d6<_0x479c72;_0x17aab5+=0x1){_0x326227=_0x17aab5/_0x5177ea;_0x4a9eab=(_0x50899d*_0x326227+_0x425545)/_0x4f1afd;_0x20b4b0=utils[_0xcc7f('0x211')](_0x4a9eab,_0x43e8da);_0x3854d6=_0x4a9eab/_0x43e8da*(0x1-utils['erlangb'](_0x4a9eab,_0x43e8da));}return _0x2bd93d({'erlangCalls':_0x17aab5,'erlangCallToSecond':_0x5177ea/_0x17aab5,'erlangAbandonmentRate':_0x20b4b0,'erlangBusyFactor':_0x3854d6});});};module[_0xcc7f('0x218')]=Dialer; \ No newline at end of file +var _0x2287=['countabandonedretry','verifyAdditionalPhones','queueCallerAbandonCreateState','dialAbandonedRetryFrequency','[rescheduleContact][Abandoned]','createHistory','channel','syncQueueMember','actionid','strategy','rrmemory','roundrobin','isNil','paused','stateinterface','locked','idHopper','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','_rr','unlockRR','Agent:\x20','contactAgent-idHopper:\x20','run','[booked][RR][finaly]','[booked][unlock]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','getQueue','response','Success','callProgressDetecting','variable','amdstatus','exten','xcally-motion-dialer','dialAMDActive','value','outboundAnswerAgiCallsDay','HangupInAMD','membername','AMD','buildObj','amd','saveInDb','[syncHangupInAMD]','MACHINE','Machine','countmachineretry','custom:amd','[syncAgentComplete][createHistory][0]','countcongestionretry','countnoanswerretry','countnosuchnumberretry','dialGlobalMaxRetry','reason19\x20machine....','createStateFinal','HANGUP','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','reason\x2019\x20machine....','dialMachineRetryFrequency','[rescheduleContact][Machine]','syncHangup','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AnswerAGI','AGI','outboundUnknownCallsDay','running','isPreviewCampaign','statusMessage','getQueueCampaignStatusMessage','available','pTalking','compareToOutboundQueue','queueSummaryCountersUpdated','updateReportFromOutboundQueue','throttle','filter','online','handlePreviewRecallNotifications','map','Agent','user:%s','user:dialPreviewRecallReminder','checkPreviewRecallReminder','clearZombieChannels','No\x20such\x20channel','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','getVoiceQueueRtPauses','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','[emptyContact][createHistory]','[emptyContact]','handleIvr','actionOriginate','object','originate','voiceQueue\x20is\x20undefine','phone','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','isOutboundQueue','\x22%s,%s%s,,,%s\x22','dialer','ACTIVE','XMD-AMDINITIALSILENCE','XMD-AMDGREETING','XMD-AMDAFTERGREETINGSILENCE','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','setXMDContactVariables','Contact','assign','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','getCallerId','dialOriginateCallerIdNumber','XMD-ORIGINATECALLERIDNAME','originatecalleridname','extractCalleridName','XMD-ORIGINATECALLERIDNUM','variables','dialPrefix','trim','dialCutDigit','substring','SIP/%s/%s%s','from-sip','dialOriginateTimeout','outboundOriginateFailureCallsDay','OriginateError','checkRetriveMax','countbusyretry','countagentrejectretry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberRetryFrequency','dialDropRetryFrequency','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','outboundNoSuchCallsDay','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','dialNoSuchNumberMaxRetry','reason\x200\x20no\x20such\x20number....','stateGlobal','NoAnswer','buildNoAnswerEventPayload','custom:agentnoanswer','[syncAgentComplete][createHistory][3]','dialNoAnswerMaxRetry','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','Busy','busy','reason\x205\x20busy','outboundCongestionCallsDay','Congestion','callAdditionalPhoneAfterMin','congestion','reason\x208\x20congestion','outboundAbandonedCallsDay','[syncAgentComplete][createHistory][11]','dialAbandonedMaxRetry','reason\x2011\x20abandoned','outboundRejectCallsDay','AgentReject','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','dialAgentRejectMaxRetry','reason\x2020\x20agentreject','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','floor','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','started\x20in\x20predictive\x20at','getDataPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','startMethodPredictive','Predictive\x20for\x20every\x20interval',')\x20are\x20less\x20than\x20threshold\x20(','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20more\x20than\x20threshold\x20(','abandonmentRate','busyFactor','Unknown\x20Predictive','[getDataPredictive]','check\x20failure','getDataPredictiveOld','outboundQueuePauses','predictiveIntervalPauses','[CatchErlangB]','agentBusyFactor','loggedIn','one\x20call\x20every:','milliseconds','fail\x20to\x20scheduled\x20calls','checkContactBlack','UserId','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','queuestatus','[booked][checkContactBlack][else]','scheduledat','voicePause','unlockContact','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','QUEUE_RECALL','RECALL_TIMEOUT','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','outboundBlacklistCallsDay','BLACKLIST','Blacklist','[Originate][historyBlacklist]','inBlackList','limitCalls','temp','getContactDialerIvr','checkContactEmpty','NO_AVAILABLE_CONTACTS','[getContactCampaign2][Empty]','RUNNING','[actionOriginate]\x20','checkIsBlackListIvr','[actionOriginateIvr]\x20','[getContactCampaign2]','not_inuse','getContactDialer','countReScheduled','checkIsBlackList','[getContactDialer2]','dialLimitQueue','talking','tryOriginatePredictive','[handlePredictive][limitChannel]','dialOrderByScheduledAt','[countReScheduled]\x20','[actionOriginatePredictive]\x20','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','m\x20=\x20','p\x20=\x20','interval\x20=\x20','Amax\x20=\x20','erlangb','----\x20Agent\x20Busy\x20Factor\x20----','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','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','Ts\x20=\x20','Umin\x20=\x20','exports','util','lodash','uuid','moment','./utils','../preview/util/util','../../../config/environment/','../../../config/logger','booked','predictive','predictiveCalls','syncQueueSummary','../ami','redis','defaults','localhost','../rpc/setting','./models/action','./models/history','./models/final','./models/agentComplete','./models/queueCallerAbandon','./models/hangup','127.0.0.1','prototype','tail','finally','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','contactsId','uniqueId','optionPredictive','startProgressive','ivrOriginated','queueBooked','queueBookedRR','queuesSummary','agentconnect','syncAgentConnect','bind','queuecallerabandon','originateresponse','syncOriginateResponse','agentcomplete','syncAgentComplete','custom:queuesummary','syncQueueSummaryComplete','hangup','newexten','syncNewExten','syncVarSet','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','getSettings','then','previewRecallmeReminderInterval','emit','type','outbound','debug','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','format','name','isEmpty','info','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsTimeout','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgTalktime','---------------------------','isUndefined','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','predictiveIntervalAvgHoldtime','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCalls','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCallToSecond','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangAbandonmentRate','erlangBusyFactor','merge','startProgressive\x20value\x20cleared','startPredictive','startPredictive\x20value\x20cleared','handlePredictive','handlePredictive\x20interval\x20cleared','error','stack','checkContactLowerLimitOriginate','inspect','contactsRescheduled','message','CAMPAIGN_STATUS','CONTACTS_RESCHEDULED','[getContactDialer2][ReScheduled]','[getContactDialer2][Empty]','state','statedesc','queueStatusComplete','[booked][unlockQueueStatus]','stringify','pick','Interval','\x20INTERVAL_IS_NULL','Intervals','NULL_INTERVAL','\x20NOT\x20Active','isIVRCampaign','campaign:ivr:%s','campaign:save','sendMessageOneNotActive','originated','INACTIVE','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20not\x20active','is\x20disactive','Error','isTrunkReachable','active','status','reachable','SIP/%s','unmonitored','Trunk','TrunkBackup','TRUNK_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTimeIvr','checkIfTimeIntervals','ifTime','Failure','\x20Intervals\x20is\x20empty\x20','isArray','length','push','Action','command','iftime\x20%s,%s','interval','timezones','content','true','catch','indexOf','all','some','OVERTIME_GLOBAL_INTERVAL','OVERTIME_INTERVAL','[ifTime][promiseAll]','Global:\x20','Timezone:\x20','resetActiveCalls','syncCampaigns','undefined','resolve','checkIsTrunkReachable','dialTimezone','launchHandleIvr','[syncCampaigns]','checkDialMethod','dialMethod','progressive','power','handlePower','dialPowerLevel','method\x20not\x20recognized','dialGlobalInterval','silly','Dialer::ifTime()','Voice\x20Queue\x20%s\x20$s','\x20Interval\x20is\x20overtime:\x20','Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:','isGlobal','AMI\x20IfTime','[ifTime][Action]','queue','uniqueid','ivr','updateOriginated','answertime','outboundAnswerCallsDay','reason','agent','agiafterat','dialAgiAfterHangupAgent','YYYY-MM-DD\x20HH:mm:ss','[syncAgentComplete][createHistory]','moveContactManagedDialer','[syncAgentComplete]','droptime','getSeconds','outboundDropCallsDayTimeout','predictiveIntervalErlangCallsDroppedCalls','Drop','dropreason','TIMEOUT','dialQueueProject2','countdropretry','countglobal','voiceQueue','additional','dialDropMaxRetry','rescheduleContact','add','minutes','ContactId','ListId','VoiceQueueId','CampaignId','[rescheduleContact][Drop]','endtime','starttime','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','swapAdditionalPhones','predictiveIntervalDroppedCallsCallersExit'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x2287,0x133));var _0x7228=function(_0x3044fc,_0x202183){_0x3044fc=_0x3044fc-0x0;var _0x11e749=_0x2287[_0x3044fc];return _0x11e749;};'use strict';var util=require(_0x7228('0x0'));var _=require(_0x7228('0x1'));var uuid=require(_0x7228('0x2'));var moment=require(_0x7228('0x3'));var rr=require('rr');var Redis=require('ioredis');var utils=require(_0x7228('0x4'));var hopperUtils=require('./utils/hopper');var ut=require(_0x7228('0x5'));var config=require(_0x7228('0x6'));var logger=require(_0x7228('0x7'))('dialer');var loggerBooked=require(_0x7228('0x7'))(_0x7228('0x8'));var loggerPredictive=require(_0x7228('0x7'))(_0x7228('0x9'));var loggerPredictiveCalls=require(_0x7228('0x7'))(_0x7228('0xa'));var loggerSyncQueueSummary=require(_0x7228('0x7'))(_0x7228('0xb'));var ami=require(_0x7228('0xc'));config[_0x7228('0xd')]=_[_0x7228('0xe')](config[_0x7228('0xd')],{'host':_0x7228('0xf'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var cmHopper=require('../rpc/cmHopper');var voiceQueueRt=require('../rpc/voiceQueueRt');var RpcSetting=require(_0x7228('0x10'));var Interval=require('../rpc/interval');var Action=require(_0x7228('0x11'));var History=require(_0x7228('0x12'));var Final=require(_0x7228('0x13'));var AgentComplete=require(_0x7228('0x14'));var QueueCallerAbandon=require(_0x7228('0x15'));var Hangup=require(_0x7228('0x16'));var ipAgi=process['env']['XCALLY_IP_AGI']||_0x7228('0x17');var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0x7228('0x18')]['enqueue']=function(_0x190e24){this[_0x7228('0x19')]=this[_0x7228('0x19')]?this[_0x7228('0x19')][_0x7228('0x1a')](_0x190e24):_0x190e24();};function Dialer(_0xf9f522,_0x566d84){this[_0x7228('0x1b')]=new Sequence();this[_0x7228('0x1c')]=_0x566d84;this[_0x7228('0x1d')]=_0xf9f522[_0x7228('0x1d')];this[_0x7228('0x1e')]=_0xf9f522[_0x7228('0x1e')];this[_0x7228('0x1f')]=_0xf9f522['agents'];this['trunks']=_0xf9f522[_0x7228('0x20')];this[_0x7228('0x21')]=config[_0x7228('0x21')]||0x2;this[_0x7228('0x22')]={};this[_0x7228('0x23')]={};this[_0x7228('0x24')]={};this[_0x7228('0x25')]={};this[_0x7228('0x26')]={};this['startPredictive']={};this[_0x7228('0x27')]={};this[_0x7228('0x28')]={};this[_0x7228('0x29')]={};this[_0x7228('0x2a')]={};this[_0x7228('0x2b')]={};ami['on'](_0x7228('0x2c'),this[_0x7228('0x2d')][_0x7228('0x2e')](this));ami['on'](_0x7228('0x2f'),this['syncQueueCallerAbandon'][_0x7228('0x2e')](this));ami['on'](_0x7228('0x30'),this[_0x7228('0x31')][_0x7228('0x2e')](this));ami['on'](_0x7228('0x32'),this[_0x7228('0x33')][_0x7228('0x2e')](this));ami['on'](_0x7228('0x34'),this[_0x7228('0xb')][_0x7228('0x2e')](this));ami['on']('custom:queuesummarycomplete',this[_0x7228('0x35')][_0x7228('0x2e')](this));ami['on'](_0x7228('0x36'),this['syncHangup'][_0x7228('0x2e')](this));ami['on'](_0x7228('0x37'),this[_0x7228('0x38')][_0x7228('0x2e')](this));ami['on']('varset',this[_0x7228('0x39')][_0x7228('0x2e')](this));ami['on']('queuemember',this['syncQueueMember'][_0x7228('0x2e')](this));ami['on'](_0x7228('0x3a'),this[_0x7228('0x3b')][_0x7228('0x2e')](this));this[_0x7228('0x3c')]();this[_0x7228('0x3d')]();RpcSetting[_0x7228('0x3e')]()[_0x7228('0x3f')](function(_0x57b9d2){previewRecallmeReminderInterval=_0x57b9d2[_0x7228('0x40')];});}function isNotNull(_0xb3c739){return _0xb3c739!==null&&!_['isUndefined'](_0xb3c739);}function msgResponse(_0x2b165b,_0x1fbbab,_0x4522b7){return{'action':_0x2b165b,'response':_0x1fbbab,'message':_0x4522b7,'stack':_0x4522b7};}function emit(_0x2ebd63,_0xa991f1,_0x217ae1){io['to'](_0x2ebd63)[_0x7228('0x41')](_0xa991f1,_0x217ae1);}function emitOutboundVoiceQueueSummary(_0x423a43){if(_0x423a43[_0x7228('0x42')]===_0x7228('0x43')){logger[_0x7228('0x44')](_0x7228('0x45'),util['inspect'](_0x423a43,{'showHidden':![],'depth':null}));emit(util[_0x7228('0x46')]('voice:queue:%s',_0x423a43[_0x7228('0x47')]),'voice_queue:save',_0x423a43);}}function checkGetDataPredictive(_0x251812){if(isNotNull(_0x251812)&&!_[_0x7228('0x48')](_0x251812)){loggerPredictive[_0x7228('0x49')](_0x7228('0x4a'));loggerPredictive[_0x7228('0x49')](_0x7228('0x4b'),_0x251812[_0x7228('0x4c')]);loggerPredictive[_0x7228('0x49')]('Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x251812[_0x7228('0x4d')]);loggerPredictive['info'](_0x7228('0x4e'),_0x251812[_0x7228('0x4f')]);loggerPredictive['info'](_0x7228('0x50'),_0x251812['predictiveIntervalDroppedCallsCallersExit']);loggerPredictive[_0x7228('0x49')](_0x7228('0x51'),_0x251812['predictiveIntervalAvgHoldtime']);loggerPredictive[_0x7228('0x49')](_0x7228('0x52'),_0x251812[_0x7228('0x53')]);loggerPredictive['info'](_0x7228('0x54'));if(_0x251812[_0x7228('0x4c')]>0x0){if(!_[_0x7228('0x55')](_0x251812[_0x7228('0x53')])&&_0x251812['predictiveIntervalAvgTalktime']>0x0){return!![];}loggerPredictive['info'](_0x7228('0x56'));if(!_[_0x7228('0x55')](_0x251812[_0x7228('0x57')])&&_0x251812[_0x7228('0x57')]>0x0){return!![];}loggerPredictive['info']('Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive');}else{loggerPredictive[_0x7228('0x49')]('Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive');}}else{loggerPredictive[_0x7228('0x49')](_0x7228('0x58'));}return![];}function mergeDataErlangB(_0x2e06ca){return function(_0x2e1da6){loggerPredictive[_0x7228('0x49')](_0x7228('0x59'));loggerPredictive[_0x7228('0x49')](_0x7228('0x5a'),_0x2e1da6[_0x7228('0x5b')]);loggerPredictive[_0x7228('0x49')](_0x7228('0x5c'),_0x2e1da6[_0x7228('0x5d')]);loggerPredictive['info'](_0x7228('0x5e'),_0x2e1da6[_0x7228('0x5f')]);loggerPredictive['info']('Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x2e1da6[_0x7228('0x60')]);loggerPredictive['info'](_0x7228('0x5e'),_0x2e1da6[_0x7228('0x5f')]);loggerPredictive['info'](_0x7228('0x54'));_[_0x7228('0x61')](_0x2e06ca,_0x2e1da6);};}function ifInterval(_0x341cf0,_0x3fb868){if(_[_0x7228('0x55')](_0x3fb868)){return![];}return utils['getSeconds'](undefined,_0x3fb868)<_0x341cf0*0x3c;}function clearPredictiveAttributes(_0x243b19){if(_0x243b19[_0x7228('0x27')]){_0x243b19[_0x7228('0x27')]=undefined;loggerPredictive[_0x7228('0x44')](_0x243b19['name'],_0x7228('0x62'));}if(_0x243b19[_0x7228('0x63')]){_0x243b19['startPredictive']=undefined;loggerPredictive[_0x7228('0x44')](_0x243b19[_0x7228('0x47')],_0x7228('0x64'));}if(_0x243b19[_0x7228('0x65')]){clearInterval(_0x243b19[_0x7228('0x65')]);_0x243b19[_0x7228('0x65')]=undefined;loggerPredictive['debug'](_0x243b19[_0x7228('0x47')],_0x7228('0x66'));}}function loggerCatchPredictive(_0x364490,_0xe43136){return function(_0x2d5f4a){loggerPredictive['error'](_0xe43136[_0x7228('0x47')],_0x364490);loggerPredictive[_0x7228('0x67')](_0x2d5f4a[_0x7228('0x68')]);clearPredictiveAttributes(_0xe43136);};}function loggerCatch(_0x4fa634){return function(_0x41dd16){logger[_0x7228('0x67')](_0x4fa634,util['inspect'](_0x41dd16,{'showHidden':![],'depth':null}));};}function loggerGetContactDialer(_0xb80d37,_0x17dd76,_0x1c2849){return function(_0x460cfc){utils[_0x7228('0x69')](_0x17dd76,_0x1c2849,0x0);logger[_0x7228('0x67')](_0xb80d37,util[_0x7228('0x6a')](_0x460cfc,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x302b7c){return function(_0x41b06a){if(isNotNull(_0x41b06a)&&isNotNull(_0x41b06a[0x0])){if(_0x41b06a[0x0][_0x7228('0x6b')]>0x0){_0x302b7c[_0x7228('0x6c')]=utils[_0x7228('0x6d')][_0x7228('0x6e')];logger['info'](_0x7228('0x6f')+_0x302b7c[_0x7228('0x47')],_0x41b06a[0x0][_0x7228('0x6b')],'contacts');}else{_0x302b7c[_0x7228('0x6c')]=utils[_0x7228('0x6d')]['NO_AVAILABLE_CONTACTS'];logger[_0x7228('0x49')](_0x7228('0x70')+_0x302b7c[_0x7228('0x47')]);}}};}function createObjHistory(_0xb0ba37,_0x245b18,_0x65206a,_0x55ef11,_0x245740){_0xb0ba37['message']=_0x65206a;var _0x4a0055=new Action(_0xb0ba37,_0x245b18);var _0x37ad86=new History(_0x4a0055);_0x37ad86[_0x7228('0x71')]=_0x55ef11;_0x37ad86[_0x7228('0x72')]=_0x245740;_0x37ad86['endtime']=_0x4a0055['starttime'];return _0x37ad86;}function unlockQueueStatus(_0x38226c,_0x5ce67d){setTimeout(function(){if(_['isUndefined'](_0x38226c['queueStatusComplete'])){loggerBooked[_0x7228('0x67')]('[unlockQueueStatus][undefined]',_0x5ce67d);}_0x38226c[_0x7228('0x73')]=!![];loggerBooked['info'](_0x7228('0x74'),_0x5ce67d,JSON[_0x7228('0x75')](_[_0x7228('0x76')](_0x38226c,[_0x7228('0x47'),_0x7228('0x73')])));},0x1f3);}function checkInterval(_0x52eeb1){return function(){if(!isNotNull(_0x52eeb1[_0x7228('0x77')])){_0x52eeb1[_0x7228('0x6c')]=utils['CAMPAIGN_STATUS']['NULL_INTERVAL'];throw _0x52eeb1[_0x7228('0x47')]+_0x7228('0x78');}if(!isNotNull(_0x52eeb1[_0x7228('0x77')][_0x7228('0x79')])){_0x52eeb1[_0x7228('0x6c')]=utils['CAMPAIGN_STATUS']['NULL_INTERVAL'];throw _0x52eeb1[_0x7228('0x47')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_['isEmpty'](_0x52eeb1[_0x7228('0x77')][_0x7228('0x79')]))){_0x52eeb1[_0x7228('0x6c')]=utils[_0x7228('0x6d')][_0x7228('0x7a')];throw _0x52eeb1[_0x7228('0x47')]+_0x7228('0x78');}};}function checkIsIVRCampaignActive(_0x10ffce){return function(){if(!utils['isIVRCampaignActive'](_0x10ffce)){_0x10ffce[_0x7228('0x6c')]=utils[_0x7228('0x6d')]['INACTIVE'];throw _0x10ffce[_0x7228('0x47')]+_0x7228('0x7b');}};}function emitCampaignSummary(_0x51a9dc){if(utils[_0x7228('0x7c')](_0x51a9dc)){emit(util['format'](_0x7228('0x7d'),_0x51a9dc[_0x7228('0x47')]),_0x7228('0x7e'),_0x51a9dc);}}function loggerCatchQueueSummary(_0xc6311e,_0x450c62){return function(_0x15cfde){clearPredictiveAttributes(_0x450c62);emitCampaignSummary(_0x450c62);loggerSyncQueueSummary['debug'](_0xc6311e,util[_0x7228('0x6a')](_0x15cfde,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x1d3b06){if(_0x1d3b06[_0x7228('0x7f')]){if(_0x1d3b06[_0x7228('0x80')]===0x0){_0x1d3b06[_0x7228('0x7f')]=![];_0x1d3b06[_0x7228('0x6c')]=utils[_0x7228('0x6d')][_0x7228('0x81')];loggerSyncQueueSummary[_0x7228('0x44')](_0x7228('0x82'),_0x1d3b06['name'],_0x7228('0x83'));}else{_0x1d3b06[_0x7228('0x6c')]=utils[_0x7228('0x6d')]['DISACTIVED'];loggerSyncQueueSummary[_0x7228('0x44')](_0x7228('0x82'),_0x1d3b06[_0x7228('0x47')],_0x7228('0x84'));}emitCampaignSummary(_0x1d3b06);}}function myreject(_0x3b70eb){return function(_0x340bed){return _0x3b70eb(msgResponse('[ifTime][Action]',_0x7228('0x85'),JSON[_0x7228('0x75')](_0x340bed)));};}Dialer[_0x7228('0x18')][_0x7228('0x86')]=function(_0x464268){return!_[_0x7228('0x55')](_0x464268)&&_0x464268&&!_['isUndefined'](_0x464268[_0x7228('0x47')])&&!_[_0x7228('0x55')](_0x464268[_0x7228('0x87')])&&_0x464268['active']&&(this[_0x7228('0x20')][util[_0x7228('0x46')]('SIP/%s',_0x464268[_0x7228('0x47')])][_0x7228('0x88')]===_0x7228('0x89')||this[_0x7228('0x20')][util[_0x7228('0x46')](_0x7228('0x8a'),_0x464268[_0x7228('0x47')])]['status']===_0x7228('0x8b'));};Dialer[_0x7228('0x18')]['checkIsTrunkReachable']=function(_0x47d498){var _0x3a5e41=this;return function(){if(!_0x3a5e41[_0x7228('0x86')](_0x47d498[_0x7228('0x8c')])){if(!_0x3a5e41[_0x7228('0x86')](_0x47d498[_0x7228('0x8d')])){_0x47d498[_0x7228('0x6c')]=utils['CAMPAIGN_STATUS'][_0x7228('0x8e')];throw _0x47d498[_0x7228('0x47')]+_0x7228('0x8f');}}};};Dialer[_0x7228('0x18')][_0x7228('0x90')]=function(_0x5efc88,_0x351d83,_0x16f3d7,_0x187219){var _0x1e2f06=this;return function(){var _0x4be5e7=!![];return _0x1e2f06[_0x7228('0x91')](_0x5efc88,_0x351d83,_0x16f3d7,_0x187219,_0x4be5e7);};};Dialer['prototype'][_0x7228('0x92')]=function(_0x3c163b,_0x299e66,_0x575b69,_0xbd154c){var _0x5ca82a=this;return function(){var _0x3e604b=![];return _0x5ca82a['ifTimeIvr'](_0x3c163b['Intervals'],_0x299e66,_0x575b69,_0xbd154c,_0x3e604b);};};Dialer[_0x7228('0x18')]['ifTimeIvr']=function(_0x34ac3e,_0xe02bff,_0x58114a,_0x5461d7,_0x4c45b0){var _0x476c77=[];return new Promise(function(_0x436a3e,_0xcad9c3){if(!isNotNull(_0x34ac3e)){_0x5461d7[_0x7228('0x6c')]=utils['CAMPAIGN_STATUS'][_0x7228('0x7a')];return _0xcad9c3(msgResponse(_0x7228('0x93'),_0x7228('0x94'),_0x58114a+'\x20Intervals\x20is\x20null\x20'));}if(_[_0x7228('0x48')](_0x34ac3e)){_0x5461d7['message']=utils[_0x7228('0x6d')]['EMPTY_INTERVAL'];return _0xcad9c3(msgResponse(_0x7228('0x93'),'Failure',_0x58114a+_0x7228('0x95')));}if(_0xe02bff&&_[_0x7228('0x55')](config['timezones'][_0xe02bff])){_0x5461d7[_0x7228('0x6c')]=utils[_0x7228('0x6d')]['UNKNOWN_TIMEZONE'];return _0xcad9c3(msgResponse(_0x7228('0x93'),_0x7228('0x94'),_0x58114a+'\x20Timezone\x20unknow\x20'+_0xe02bff));}if(_[_0x7228('0x96')](_0x34ac3e)){for(var _0x301067=0x0;_0x301067<_0x34ac3e[_0x7228('0x97')];_0x301067+=0x1){_0x476c77[_0x7228('0x98')](ami[_0x7228('0x99')]({'action':_0x7228('0x9a'),'command':util[_0x7228('0x46')](_0x7228('0x9b'),_0x34ac3e[_0x301067][_0x7228('0x9c')],!_[_0x7228('0x55')](config[_0x7228('0x9d')][_0xe02bff])?_0xe02bff:'')})[_0x7228('0x3f')](function(_0x42f3c7){return _0x42f3c7[_0x7228('0x9e')]['indexOf'](_0x7228('0x9f'))>=0x0;})[_0x7228('0xa0')](myreject(_0xcad9c3)));}}else{_0x476c77[_0x7228('0x98')](ami[_0x7228('0x99')]({'action':_0x7228('0x9a'),'command':util[_0x7228('0x46')]('iftime\x20%s,%s',_0x34ac3e,!_['isUndefined'](config['timezones'][_0xe02bff])?_0xe02bff:'')})[_0x7228('0x3f')](function(_0x23b7e2){return _0x23b7e2[_0x7228('0x9e')][_0x7228('0xa1')](_0x7228('0x9f'))>=0x0;})[_0x7228('0xa0')](myreject(_0xcad9c3)));}Promise[_0x7228('0xa2')](_0x476c77)[_0x7228('0x3f')](function(_0x3409c5){var _0x5e49d8=_[_0x7228('0xa3')](_0x3409c5);if(_0x5e49d8){return _0x436a3e(_0x5e49d8);}else{_0x5461d7['message']=_0x4c45b0?utils['CAMPAIGN_STATUS'][_0x7228('0xa4')]:utils['CAMPAIGN_STATUS'][_0x7228('0xa5')];return _0xcad9c3(msgResponse(_0x7228('0xa6'),_0x7228('0x94'),_0x7228('0xa7')+_0x4c45b0+'\x20'+_0x58114a+'\x20Interval\x20is\x20overtime:\x20'+util[_0x7228('0x6a')](_0x34ac3e,{'showHidden':![],'depth':null})+_0x7228('0xa8')+_0xe02bff));}})[_0x7228('0xa0')](function(_0x3e542b){return _0xcad9c3(msgResponse('ifTime','Failure',JSON[_0x7228('0x75')](_0x3e542b)));});});};Dialer[_0x7228('0x18')]['loopCampaigns']=function(){var _0x3733ee=this;return cmHopper[_0x7228('0xa9')]({'active':![]},{'where':{'active':!![]}})[_0x7228('0x3f')](function(){setInterval(function(){_0x3733ee[_0x7228('0xaa')]();},0x3e8);});};Dialer[_0x7228('0x18')][_0x7228('0xaa')]=function(){var _0x48aa70=this;var _0x4556ee;for(var _0x1941ce in this[_0x7228('0x1e')]){if(typeof this[_0x7228('0x1e')][_0x1941ce]!==_0x7228('0xab')){_0x4556ee=this[_0x7228('0x1e')][_0x1941ce];if(utils[_0x7228('0x7c')](_0x4556ee)&&utils['isIVRCampaignActive'](_0x4556ee)){_0x4556ee[_0x7228('0x7f')]=!![];Promise[_0x7228('0xac')]()['then'](checkIsIVRCampaignActive(_0x4556ee))['then'](checkInterval(_0x4556ee))[_0x7228('0x3f')](_0x48aa70[_0x7228('0xad')](_0x4556ee))[_0x7228('0x3f')](_0x48aa70[_0x7228('0x90')](_0x4556ee['dialGlobalInterval'],_0x4556ee['dialTimezone'],_0x4556ee[_0x7228('0x47')],_0x4556ee))[_0x7228('0x3f')](_0x48aa70[_0x7228('0x92')](_0x4556ee[_0x7228('0x77')],_0x4556ee[_0x7228('0xae')],_0x4556ee[_0x7228('0x47')],_0x4556ee))[_0x7228('0x3f')](_0x48aa70[_0x7228('0xaf')](_0x4556ee))[_0x7228('0xa0')](loggerCatchQueueSummary(_0x7228('0xb0'),_0x4556ee));}else{notSendMessagesCampaign(_0x4556ee);}}}};Dialer[_0x7228('0x18')][_0x7228('0xb1')]=function(_0x288fd4){if(_0x288fd4[_0x7228('0xb2')]!=='predictive'){clearPredictiveAttributes(_0x288fd4);}switch(_0x288fd4[_0x7228('0xb2')]){case _0x7228('0xb3'):this['handlePower'](_0x288fd4,0x1);break;case _0x7228('0xb4'):this[_0x7228('0xb5')](_0x288fd4,_0x288fd4[_0x7228('0xb6')]);break;case _0x7228('0x9'):this['predictive'](_0x288fd4);break;case _0x7228('0x8'):this['handlePower'](_0x288fd4,0x1);break;default:logger['error']('Queue',_0x288fd4[_0x7228('0x47')],_0x7228('0xb7'));}};Dialer[_0x7228('0x18')][_0x7228('0x93')]=function(_0x4fb5cb,_0x52d99a){var _0x1d1fb4=_0x4fb5cb[_0x7228('0xae')];var _0x549173=_0x52d99a?_0x4fb5cb[_0x7228('0xb8')]:_0x4fb5cb[_0x7228('0x77')][_0x7228('0x79')];logger[_0x7228('0xb9')](_0x7228('0xba'),_0x549173,_0x1d1fb4,_0x4fb5cb[_0x7228('0x47')],util['format'](_0x7228('0xbb'),_0x4fb5cb[_0x7228('0x47')],_0x4fb5cb['id']));var _0x106db4=null;return Interval['intervalIftime'](_0x549173,_0x1d1fb4)[_0x7228('0x3f')](function(_0x385421){if(_0x385421===!![]){return _0x385421;}else{_0x4fb5cb['message']=_0x52d99a?utils['CAMPAIGN_STATUS'][_0x7228('0xa4')]:utils[_0x7228('0x6d')][_0x7228('0xa5')];_0x106db4=msgResponse('[ifTime][promiseAll]',_0x7228('0x94'),'Global:\x20'+_0x52d99a+'\x20'+_0x4fb5cb['name']+_0x7228('0xbc')+util['inspect'](_0x549173,{'showHidden':![],'depth':null})+'Timezone:\x20'+_0x1d1fb4);}if(_0x106db4!==null){logger[_0x7228('0xb9')](_0x7228('0xbd'),_0x106db4);_0x106db4[_0x7228('0xbe')]=_0x52d99a;throw _0x106db4;}})[_0x7228('0xa0')](function(_0x34a51f){logger[_0x7228('0x67')](_0x7228('0xbf'),_0x34a51f);throw msgResponse(_0x7228('0xc0'),_0x7228('0x85'),util[_0x7228('0x6a')](_0x34a51f,{'showHidden':![],'depth':null}));});};Dialer['prototype'][_0x7228('0x2d')]=function(_0x2a794a){if(this['voiceQueues'][_0x2a794a[_0x7228('0xc1')]]){if(this[_0x7228('0x25')][_0x2a794a['uniqueid']]&&this[_0x7228('0x25')][_0x2a794a[_0x7228('0xc2')]]['type']!==_0x7228('0xc3')){this[_0x7228('0xc4')](this[_0x7228('0x1d')][_0x2a794a[_0x7228('0xc1')]]);this[_0x7228('0x25')][_0x2a794a[_0x7228('0xc2')]][_0x7228('0xc5')]=moment()[_0x7228('0x46')]('YYYY-MM-DD\x20HH:mm:ss');}}};Dialer[_0x7228('0x18')][_0x7228('0x33')]=function(_0x3880d1){var _0x4999c6=this[_0x7228('0x25')][_0x3880d1[_0x7228('0xc2')]];if(this[_0x7228('0x1d')][_0x3880d1[_0x7228('0xc1')]]){if(_0x4999c6&&_0x4999c6[_0x7228('0x42')]!==_0x7228('0xc3')){delete this[_0x7228('0x25')][_0x3880d1[_0x7228('0xc2')]];this[_0x7228('0x1d')][_0x3880d1[_0x7228('0xc1')]][_0x7228('0xc6')]+=0x1;var _0xa6cd08=new AgentComplete(_0x4999c6,_0x3880d1);if(_0x3880d1[_0x7228('0xc7')]===_0x7228('0xc8')){_0xa6cd08[_0x7228('0xc9')]=this['voiceQueues'][_0x3880d1['queue']]['dialQueueProject2']&&this[_0x7228('0x1d')][_0x3880d1['queue']][_0x7228('0xca')]?moment()[_0x7228('0x46')](_0x7228('0xcb')):undefined;}hopperUtils['createHistory'](_0xa6cd08)['catch'](loggerCatch(_0x7228('0xcc')));hopperUtils[_0x7228('0xcd')](_0xa6cd08)[_0x7228('0xa0')](loggerCatch(_0x7228('0xce')));}}};Dialer[_0x7228('0x18')]['syncQueueCallerAbandon']=function(_0x3a007e){var _0xdf5a3f=this[_0x7228('0x25')][_0x3a007e[_0x7228('0xc2')]];var _0x295e0a=this;var _0x36a005=![];var _0x4537bd;var _0x2ecffe;if(this[_0x7228('0x1d')][_0x3a007e[_0x7228('0xc1')]]){if(_0xdf5a3f&&_0xdf5a3f[_0x7228('0x42')]!==_0x7228('0xc3')){delete this[_0x7228('0x25')][_0x3a007e[_0x7228('0xc2')]];this[_0x7228('0xc4')](this['voiceQueues'][_0x3a007e[_0x7228('0xc1')]]);_0xdf5a3f[_0x7228('0xcf')]=moment()['format'](_0x7228('0xcb'));var _0x5a2438=new QueueCallerAbandon(_0xdf5a3f,_0x3a007e);if(utils[_0x7228('0xd0')](_0xdf5a3f[_0x7228('0xcf')],_0xdf5a3f['responsetime'])>=_0xdf5a3f['dialQueueTimeout']){this[_0x7228('0x1d')][_0x3a007e[_0x7228('0xc1')]]['predictiveIntervalDroppedCallsTimeout']+=0x1;this[_0x7228('0x1d')][_0x3a007e[_0x7228('0xc1')]][_0x7228('0xd1')]+=0x1;this[_0x7228('0x1d')][_0x3a007e[_0x7228('0xc1')]][_0x7228('0xd2')]+=0x1;_0x5a2438[_0x7228('0x71')]=0xa;_0x5a2438[_0x7228('0x72')]=_0x7228('0xd3');_0x5a2438[_0x7228('0xd4')]=_0x7228('0xd5');_0x5a2438[_0x7228('0xc9')]=this[_0x7228('0x1d')][_0x3a007e[_0x7228('0xc1')]][_0x7228('0xd6')]?moment()['format'](_0x7228('0xcb')):undefined;_0x5a2438[_0x7228('0xd7')]+=0x1;_0x5a2438[_0x7228('0xd8')]+=0x1;_0x4537bd=this[_0x7228('0x1d')][_0x3a007e[_0x7228('0xc1')]]['dialDropRetryFrequency'];_0x2ecffe=this[_0x7228('0x1d')][_0x3a007e[_0x7228('0xc1')]]['callAdditionalPhoneAfterMin'];hopperUtils['verifyAdditionalPhones'](_0x5a2438,_0x5a2438[_0x7228('0x71')],_0xdf5a3f[_0x7228('0xd9')])[_0x7228('0x3f')](function(_0x4795b2){_0x36a005=_0x4795b2[_0x7228('0xda')]==0x1;if(_0x5a2438[_0x7228('0xd7')]>=_0x295e0a[_0x7228('0x1d')][_0x3a007e['queue']][_0x7228('0xdb')]){_0x295e0a['queueCallerAbandonCreateState'](_0x5a2438,_0x4795b2[_0x7228('0xda')]);}else{hopperUtils[_0x7228('0xdc')]({'active':![],'countdropretry':_0x5a2438['countdropretry'],'scheduledat':moment()[_0x7228('0xdd')](_0x295e0a[_0x7228('0x1d')][_0x3a007e[_0x7228('0xc1')]]['dialDropRetryFrequency'],_0x7228('0xde'))[_0x7228('0x46')](_0x7228('0xcb')),'ContactId':_0xdf5a3f[_0x7228('0xdf')],'ListId':_0xdf5a3f[_0x7228('0xe0')],'VoiceQueueId':_0xdf5a3f[_0x7228('0xe1')]||undefined,'CampaignId':_0xdf5a3f[_0x7228('0xe2')]||undefined})[_0x7228('0xa0')](loggerCatch(_0x7228('0xe3')));var _0x1891b6=new History(_0x5a2438);_0x1891b6[_0x7228('0x71')]=0xa;_0x1891b6['statedesc']='Drop';_0x1891b6['starttime']=moment()[_0x7228('0x46')](_0x7228('0xcb'));_0x1891b6[_0x7228('0xe4')]=_0x1891b6[_0x7228('0xe5')];_0x1891b6[_0x7228('0xe6')]=_0x5a2438[_0x7228('0xe6')];_0x1891b6[_0x7228('0xe7')]=_0x5a2438[_0x7228('0xe7')];hopperUtils['createHistory'](_0x1891b6)[_0x7228('0xa0')](loggerCatch(_0x7228('0xe8')));}})[_0x7228('0x3f')](function(){if(_0x36a005)hopperUtils[_0x7228('0xe9')](_0x5a2438,_0x4537bd,_0x2ecffe)['then'](function(){return 0x1;});});}else{this[_0x7228('0x1d')][_0x3a007e['queue']][_0x7228('0xea')]+=0x1;this['voiceQueues'][_0x3a007e[_0x7228('0xc1')]]['outboundDropCallsDayCallersExit']+=0x1;_0x5a2438[_0x7228('0x71')]=0xb;_0x5a2438[_0x7228('0x72')]='Abandoned';_0x5a2438[_0x7228('0xd4')]='CALLEREXIT';_0x5a2438[_0x7228('0xeb')]+=0x1;_0x5a2438['countglobal']+=0x1;_0x4537bd=this[_0x7228('0x1d')][_0x3a007e[_0x7228('0xc1')]]['dialAbandonedRetryFrequency'];_0x2ecffe=this['voiceQueues'][_0x3a007e[_0x7228('0xc1')]]['callAdditionalPhoneAfterMin'];hopperUtils[_0x7228('0xec')](_0x5a2438,_0x5a2438['state'],_0xdf5a3f[_0x7228('0xd9')])['then'](function(_0x27397d){if(_0x5a2438[_0x7228('0xeb')]>=_0x295e0a['voiceQueues'][_0x3a007e['queue']]['dialAbandonedMaxRetry']){_0x295e0a[_0x7228('0xed')](_0x5a2438,_0x27397d[_0x7228('0xda')]);}else{hopperUtils['rescheduleContact']({'active':![],'countabandonedretry':_0x5a2438[_0x7228('0xeb')],'scheduledat':moment()['add'](_0x295e0a[_0x7228('0x1d')][_0x3a007e['queue']][_0x7228('0xee')],_0x7228('0xde'))[_0x7228('0x46')](_0x7228('0xcb')),'ContactId':_0xdf5a3f[_0x7228('0xdf')],'ListId':_0xdf5a3f[_0x7228('0xe0')],'VoiceQueueId':_0xdf5a3f[_0x7228('0xe1')]||undefined,'CampaignId':_0xdf5a3f[_0x7228('0xe2')]||undefined})[_0x7228('0xa0')](loggerCatch(_0x7228('0xef')));var _0x4e7912=new History(_0x5a2438);_0x4e7912[_0x7228('0x71')]=0xb;_0x4e7912[_0x7228('0x72')]='Abandoned';_0x4e7912[_0x7228('0xe5')]=moment()['format'](_0x7228('0xcb'));_0x4e7912[_0x7228('0xe4')]=_0x4e7912['starttime'];_0x4e7912[_0x7228('0xe6')]=_0x5a2438[_0x7228('0xe6')];_0x4e7912['calleridnum']=_0x5a2438['calleridnum'];hopperUtils[_0x7228('0xf0')](_0x4e7912)['catch'](loggerCatch('[syncAgentComplete][createHistory][11]'));}})[_0x7228('0x3f')](function(){if(_0x36a005)hopperUtils[_0x7228('0xe9')](_0x5a2438,_0x4537bd,_0x2ecffe)['then'](function(){return 0x1;});});}}}};Dialer[_0x7228('0x18')][_0x7228('0x38')]=function(_0x3bb726){if(this[_0x7228('0x23')][_0x3bb726[_0x7228('0xc2')]]){this['actions'][_0x3bb726[_0x7228('0xc2')]][_0x7228('0xf1')]=_0x3bb726[_0x7228('0xf1')];}if(this[_0x7228('0x25')][_0x3bb726[_0x7228('0xc2')]]){this['uniqueId'][_0x3bb726[_0x7228('0xc2')]][_0x7228('0xf1')]=_0x3bb726[_0x7228('0xf1')];}};Dialer['prototype'][_0x7228('0xf2')]=function(_0x597115){if(!this[_0x7228('0x23')][_0x597115[_0x7228('0xf3')]]){return;}var _0x9bd72c=this['voiceQueues'][this[_0x7228('0x23')][_0x597115[_0x7228('0xf3')]][_0x7228('0xc1')]][_0x7228('0xf4')]||_0x7228('0xf5');if(_0x9bd72c===_0x7228('0xf6')){if(this[_0x7228('0x23')][_0x597115['actionid']]&&_[_0x7228('0xf7')](this[_0x7228('0x23')][_0x597115[_0x7228('0xf3')]]['locked'])&&_0x597115[_0x7228('0x88')]==='1'&&_0x597115[_0x7228('0xf8')]==='0'){if(this[_0x7228('0x1f')][_0x597115[_0x7228('0xf9')]]){if(!this['agents'][_0x597115[_0x7228('0xf9')]][_0x7228('0xfa')]){this['agents'][_0x597115['stateinterface']]['locked']=!![];this['actions'][_0x597115[_0x7228('0xf3')]][_0x7228('0xfa')]=!![];this[_0x7228('0x23')][_0x597115['actionid']][_0x7228('0xf9')]=_0x597115['stateinterface'];}}}}else if(_0x9bd72c==='rrmemory'){if(this[_0x7228('0x23')][_0x597115[_0x7228('0xf3')]]){if(this[_0x7228('0x1f')][_0x597115['stateinterface']]){this[_0x7228('0x23')][_0x597115[_0x7228('0xf3')]][_0x7228('0xf9')]=_0x597115[_0x7228('0xf9')];if(_[_0x7228('0xf7')](this['queueBooked'][this['actions'][_0x597115[_0x7228('0xf3')]][_0x7228('0xc1')]])){this[_0x7228('0x29')][this[_0x7228('0x23')][_0x597115[_0x7228('0xf3')]][_0x7228('0xc1')]]=[];}this[_0x7228('0x29')][this[_0x7228('0x23')][_0x597115[_0x7228('0xf3')]][_0x7228('0xc1')]][_0x7228('0x98')](_['merge'](_['pick'](this['actions'][_0x597115[_0x7228('0xf3')]],['idHopper',_0x7228('0xf9')]),{'status':_0x597115[_0x7228('0x88')],'paused':_0x597115[_0x7228('0xf8')]}));}}}};Dialer[_0x7228('0x18')][_0x7228('0x3b')]=function(_0x7b97d1){if(!this[_0x7228('0x23')][_0x7b97d1[_0x7228('0xf3')]]){return;}var _0x525de4=this;var _0x5125f1=this[_0x7228('0x1d')][this[_0x7228('0x23')][_0x7b97d1[_0x7228('0xf3')]]['queue']];var _0x148d42=_0x5125f1[_0x7228('0xf4')]||'rrmemory';if(_0x148d42===_0x7228('0xf6')){if(this[_0x7228('0x23')][_0x7b97d1['actionid']]&&this[_0x7228('0x23')][_0x7b97d1['actionid']][_0x7228('0xf9')]){this[_0x7228('0x1c')]['run'](this[_0x7228('0x23')][_0x7b97d1[_0x7228('0xf3')]][_0x7228('0xfb')],this['actions'][_0x7b97d1['actionid']][_0x7228('0xf9')])[_0x7228('0xa0')](function(_0x100549){logger[_0x7228('0x67')](_0x7228('0xfc'),util[_0x7228('0x6a')](_0x100549,{'showHidden':![],'depth':null}));})[_0x7228('0x1a')](function(){_0x525de4['updateOriginated'](_0x525de4[_0x7228('0x1d')][_0x525de4[_0x7228('0x23')][_0x7b97d1[_0x7228('0xf3')]][_0x7228('0xc1')]]);_0x525de4[_0x7228('0x1f')][_0x525de4[_0x7228('0x23')][_0x7b97d1['actionid']]['stateinterface']][_0x7228('0xfa')]=![];delete _0x525de4['actions'][_0x7b97d1[_0x7228('0xf3')]];unlockQueueStatus(_0x5125f1);});}else{this[_0x7228('0xc4')](this[_0x7228('0x1d')][this[_0x7228('0x23')][_0x7b97d1[_0x7228('0xf3')]][_0x7228('0xc1')]]);hopperUtils[_0x7228('0xdc')]({'active':![],'ContactId':this['actions'][_0x7b97d1[_0x7228('0xf3')]]['ContactId'],'ListId':this[_0x7228('0x23')][_0x7b97d1[_0x7228('0xf3')]][_0x7228('0xe0')],'VoiceQueueId':this['actions'][_0x7b97d1[_0x7228('0xf3')]][_0x7228('0xe1')]||undefined,'CampaignId':this[_0x7228('0x23')][_0x7b97d1[_0x7228('0xf3')]][_0x7228('0xe2')]||undefined})[_0x7228('0xa0')](loggerCatch(_0x7228('0xfd')));delete this[_0x7228('0x23')][_0x7b97d1[_0x7228('0xf3')]];unlockQueueStatus(_0x5125f1);}}else if(_0x148d42===_0x7228('0xf5')){var _0x208da3;if(this[_0x7228('0x23')][_0x7b97d1[_0x7228('0xf3')]]&&!_[_0x7228('0x48')](this[_0x7228('0x29')][this['actions'][_0x7b97d1[_0x7228('0xf3')]][_0x7228('0xc1')]])){if(this[_0x7228('0x2a')][_0x525de4['actions'][_0x7b97d1[_0x7228('0xf3')]][_0x7228('0xc1')]]){this[_0x7228('0x2a')][_0x525de4[_0x7228('0x23')][_0x7b97d1[_0x7228('0xf3')]]['queue']]=this[_0x7228('0x2a')][this[_0x7228('0x23')][_0x7b97d1[_0x7228('0xf3')]]['queue']]?this[_0x7228('0x2a')][this[_0x7228('0x23')][_0x7b97d1[_0x7228('0xf3')]][_0x7228('0xc1')]]:this[_0x7228('0x29')][this[_0x7228('0x23')][_0x7b97d1[_0x7228('0xf3')]][_0x7228('0xc1')]]?this[_0x7228('0x29')][this[_0x7228('0x23')][_0x7b97d1[_0x7228('0xf3')]]['queue']][_0x7228('0xfe')]||0x0:0x0;}this['queueBooked'][this[_0x7228('0x23')][_0x7b97d1['actionid']]['queue']][_0x7228('0xfe')]=this['queueBookedRR'][this['actions'][_0x7b97d1[_0x7228('0xf3')]][_0x7228('0xc1')]];for(var _0xee9cd7=0x0;_0xee9cd7=_0x306118[_0x7228('0x122')]){_0xbf4597['stateGlobal'](_0x50563f,_0x3eb088,_0xc24eae,_0x7228('0x123'));}else{if(_0x50563f['countmachineretry']>=_0x306118['dialMachineMaxRetry']){_0xbf4597[_0x7228('0x124')](_0x50563f,_0x3eb088,_0xc24eae,'reason\x2019\x20machine....');}else{hopperUtils[_0x7228('0xdc')]({'active':![],'countmachineretry':_0x50563f[_0x7228('0x11c')],'scheduledat':moment()[_0x7228('0xdd')](_0x306118['dialMachineRetryFrequency'],_0x7228('0xde'))[_0x7228('0x46')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x50563f[_0x7228('0xdf')],'ListId':_0x50563f[_0x7228('0xe0')],'VoiceQueueId':_0x50563f[_0x7228('0xe1')]||undefined,'CampaignId':_0x50563f['CampaignId']||undefined})[_0x7228('0xa0')](loggerCatch('[rescheduleContact][Machine]'));_0x3eb088({'reschedule':0x1});}}});}if(_0x5095cd[_0x7228('0x42')]==='ivr'&&this[_0x7228('0x1e')][_0x5095cd[_0x7228('0xc1')]]['dialAMDActive']&&_0x3edc5b[_0x7228('0x111')]===_0x7228('0x125')){delete this['uniqueId'][_0x3edc5b[_0x7228('0xc2')]];this[_0x7228('0xc4')](this[_0x7228('0x1e')][_0x5095cd[_0x7228('0xc1')]]);_0x4410e0=new Hangup(_0x5095cd,_0x3edc5b);_0x4410e0[_0x7228('0x71')]=0x12;_0x4410e0[_0x7228('0x72')]='HangupInAMD';_0x4410e0[_0x7228('0x114')]='AMD';ami[_0x7228('0x41')](_0x7228('0x11d'),ut[_0x7228('0x116')](_0x4410e0,_0x7228('0x117')));this[_0x7228('0x118')](_0x4410e0,_0x7228('0x126'),_0x7228('0x127'));}if(_0x5095cd[_0x7228('0x42')]===_0x7228('0xc3')&&this['campaigns'][_0x5095cd['queue']][_0x7228('0x110')]&&_0x3edc5b[_0x7228('0x111')]===_0x7228('0x11a')){return new Promise(function(_0x3a0d38,_0x2bd675){delete _0xbf4597[_0x7228('0x25')][_0x3edc5b['uniqueid']];_0xbf4597['updateOriginated'](_0xbf4597[_0x7228('0x1e')][_0x5095cd[_0x7228('0xc1')]]);_0xbf4597[_0x7228('0x1e')][_0x5095cd['queue']][_0x7228('0xc6')]+=0x1;_0xbf4597[_0x7228('0x1e')][_0x5095cd[_0x7228('0xc1')]][_0x7228('0x112')]+=0x1;var _0x233611=_0xbf4597['campaigns'][_0x5095cd[_0x7228('0xc1')]];var _0x47b72d=new Hangup(_0x5095cd,_0x3edc5b);_0x47b72d[_0x7228('0x71')]=0x13;_0x47b72d[_0x7228('0x72')]=_0x7228('0x11b');_0x47b72d[_0x7228('0x114')]='AMD';_0x47b72d['countmachineretry']+=0x1;_0x47b72d[_0x7228('0xd8')]+=0x1;_0x47b72d[_0x7228('0x117')]=!![];ami['emit'](_0x7228('0x11d'),ut[_0x7228('0x116')](_0x47b72d,_0x7228('0x117')));hopperUtils[_0x7228('0xf0')](_0x47b72d)[_0x7228('0xa0')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x47b72d['countbusyretry']+_0x47b72d[_0x7228('0x11f')]+_0x47b72d[_0x7228('0x120')]+_0x47b72d[_0x7228('0x121')]+_0x47b72d[_0x7228('0xd7')]+_0x47b72d[_0x7228('0xeb')]+_0x47b72d[_0x7228('0x11c')]+_0x47b72d['countagentrejectretry']>=_0x233611['dialGlobalMaxRetry']){_0xbf4597['stateGlobal'](_0x47b72d,_0x3a0d38,_0x2bd675,_0x7228('0x123'));}else{if(_0x47b72d['countmachineretry']>=_0x233611['dialMachineMaxRetry']){_0xbf4597[_0x7228('0x124')](_0x47b72d,_0x3a0d38,_0x2bd675,_0x7228('0x128'));}else{hopperUtils[_0x7228('0xdc')]({'active':![],'countmachineretry':_0x47b72d[_0x7228('0x11c')],'scheduledat':moment()[_0x7228('0xdd')](_0x233611[_0x7228('0x129')],_0x7228('0xde'))[_0x7228('0x46')](_0x7228('0xcb')),'ContactId':_0x47b72d['ContactId'],'ListId':_0x47b72d[_0x7228('0xe0')],'VoiceQueueId':_0x47b72d[_0x7228('0xe1')]||undefined,'CampaignId':_0x47b72d[_0x7228('0xe2')]||undefined})['catch'](loggerCatch(_0x7228('0x12a')));_0x3a0d38({'reschedule':0x1});}}});}}};Dialer[_0x7228('0x18')][_0x7228('0x12b')]=function(_0x2470f4){var _0x5eb522=this['uniqueId'][_0x2470f4[_0x7228('0xc2')]];var _0x334ba4;if(_0x5eb522&&_0x5eb522[_0x7228('0x42')]===_0x7228('0xc3')){delete this['uniqueId'][_0x2470f4[_0x7228('0xc2')]];this[_0x7228('0xc4')](this[_0x7228('0x1e')][_0x5eb522[_0x7228('0xc1')]]);this['campaigns'][_0x5eb522[_0x7228('0xc1')]][_0x7228('0x12c')]+=0x1;_0x334ba4=new Hangup(_0x5eb522,_0x2470f4);hopperUtils[_0x7228('0xf0')](_0x334ba4)[_0x7228('0xa0')](loggerCatch(_0x7228('0x12d')));hopperUtils[_0x7228('0xcd')](_0x334ba4)[_0x7228('0xa0')](loggerCatch(_0x7228('0x12e')));}if(_0x5eb522&&_0x5eb522[_0x7228('0x42')]!==_0x7228('0xc3')&&isNotNull(this[_0x7228('0x1d')][_0x5eb522[_0x7228('0xc1')]][_0x7228('0x12f')])){delete this[_0x7228('0x25')][_0x2470f4[_0x7228('0xc2')]];this[_0x7228('0xc4')](this[_0x7228('0x1d')][_0x5eb522[_0x7228('0xc1')]]);this['voiceQueues'][_0x5eb522[_0x7228('0xc1')]][_0x7228('0xc6')]+=0x1;this[_0x7228('0x1d')][_0x5eb522[_0x7228('0xc1')]][_0x7228('0x112')]+=0x1;_0x334ba4=new Hangup(_0x5eb522,_0x2470f4);_0x334ba4['state']=0x10;_0x334ba4[_0x7228('0x72')]=_0x7228('0x130');_0x334ba4[_0x7228('0x114')]=_0x7228('0x131');hopperUtils[_0x7228('0xf0')](_0x334ba4)[_0x7228('0xa0')](loggerCatch(_0x7228('0x12d')));hopperUtils[_0x7228('0xcd')](_0x334ba4)[_0x7228('0xa0')](loggerCatch(_0x7228('0x12e')));}if(_0x5eb522&&_0x5eb522[_0x7228('0x42')]!==_0x7228('0xc3')&&!isNotNull(this[_0x7228('0x1d')][_0x5eb522['queue']][_0x7228('0x12f')])){delete this[_0x7228('0x25')][_0x2470f4['uniqueid']];this[_0x7228('0xc4')](this['voiceQueues'][_0x5eb522[_0x7228('0xc1')]]);this['voiceQueues'][_0x5eb522[_0x7228('0xc1')]][_0x7228('0x132')]+=0x1;_0x334ba4=new Hangup(_0x5eb522,_0x2470f4);_0x334ba4[_0x7228('0x71')]=0xc;_0x334ba4[_0x7228('0x72')]=_0x2470f4['cause-txt'];_0x334ba4[_0x7228('0x114')]='Unknow';hopperUtils['createHistory'](_0x334ba4)[_0x7228('0xa0')](loggerCatch(_0x7228('0x12d')));hopperUtils[_0x7228('0xcd')](_0x334ba4)[_0x7228('0xa0')](loggerCatch(_0x7228('0x12e')));}};Dialer[_0x7228('0x18')][_0x7228('0xb')]=function(_0x5044e3){var _0x3fad70=this;if(!_0x3fad70['queuesSummary'][_0x5044e3[_0x7228('0x47')]]){_0x3fad70[_0x7228('0x2b')][_0x5044e3[_0x7228('0x47')]]={'running':![]};}else if(_0x3fad70[_0x7228('0x2b')][_0x5044e3[_0x7228('0x47')]][_0x7228('0x133')]===!![]){return;}else if(_0x3fad70[_0x7228('0x2b')][_0x5044e3[_0x7228('0x47')]][_0x7228('0x133')]===![]){_0x3fad70[_0x7228('0x2b')][_0x5044e3[_0x7228('0x47')]][_0x7228('0x133')]=!![];}var _0x26548=_0x3fad70[_0x7228('0x1d')][_0x5044e3['name']];var _0x32c7e5=_0x26548['message']!==utils[_0x7228('0x6d')]['INACTIVE'];var _0x3a9e8e=utils[_0x7228('0x134')](_0x26548);_0x26548[_0x7228('0x135')]=utils[_0x7228('0x136')](_0x26548,_0x3fad70[_0x7228('0x20')]);Promise[_0x7228('0xac')]()[_0x7228('0x3f')](function(){if(_0x26548[_0x7228('0x135')]===utils[_0x7228('0x6d')][_0x7228('0x81')]){if(_0x32c7e5){clearPredictiveAttributes(_0x26548);_0x5044e3[_0x7228('0x63')]=undefined;_0x5044e3[_0x7228('0x27')]=undefined;}if(_0x26548[_0x7228('0x135')]===utils['CAMPAIGN_STATUS']['INACTIVE']){_0x5044e3[_0x7228('0x137')]=0x0;_0x5044e3[_0x7228('0xf8')]=0x0;_0x5044e3['inUse']=0x0;_0x5044e3['talking']=0x0;_0x5044e3[_0x7228('0x138')]=0x0;}}else if(_0x26548['statusMessage']===utils[_0x7228('0x6d')]['ACTIVE']&&!_0x3a9e8e){return _0x3fad70['ifTime'](_0x26548,!![])['then'](function(){return _0x3fad70['ifTime'](_0x26548,![]);})[_0x7228('0x3f')](function(){return _0x3fad70[_0x7228('0xb1')](_0x26548);})['catch'](function(_0x2249e1){loggerSyncQueueSummary['debug']('[syncQueueSummary]',util[_0x7228('0x6a')](_0x2249e1,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x26548);});}else{clearPredictiveAttributes(_0x26548);}})['then'](function(){var _0x4f61a6=_0x5044e3[_0x7228('0x139')](_0x26548);if(_0x4f61a6||_0x26548[_0x7228('0x13a')]){_0x26548[_0x7228('0x13a')]=![];_0x5044e3[_0x7228('0x13b')](_0x26548);Object['assign'](_0x26548,_0x5044e3);emitOutboundVoiceQueueSummary(_0x5044e3);}_0x3fad70[_0x7228('0x2b')][_0x26548[_0x7228('0x47')]]['running']=![];})[_0x7228('0xa0')](function(_0x5b6ccb){logger['error']('[syncQueueSummary]',util[_0x7228('0x6a')](_0x5b6ccb,{'showHidden':![],'depth':null}));_0x3fad70['queuesSummary'][_0x26548[_0x7228('0x47')]][_0x7228('0x133')]=![];});};Dialer[_0x7228('0x18')]['syncQueueSummaryComplete']=_[_0x7228('0x13c')](function(){var _0x22e9b1=_['filter'](this[_0x7228('0x1d')],function(_0x3c1758){return _0x3c1758['dialPreviewRecallmeReminder'];});var _0x115450=_[_0x7228('0x13d')](this['agents'],function(_0x31c0c5){return _0x31c0c5[_0x7228('0x13e')]&&_0x31c0c5['status']===_0x7228('0x89');});if(_0x22e9b1[_0x7228('0x97')]>0x0&&_0x115450[_0x7228('0x97')]>0x0){return Promise['resolve']()['then'](cmHopper[_0x7228('0x13f')](_[_0x7228('0x140')](_0x22e9b1,'id'),previewRecallmeReminderInterval,_['map'](_0x115450,'id')))[_0x7228('0x3f')](function(_0x2b8704){for(var _0x4aed1b=0x0;_0x4aed1b<_0x2b8704[_0x7228('0x97')];_0x4aed1b++){var _0xe20a84=_0x2b8704[_0x4aed1b][_0x7228('0x141')][_0x7228('0x47')];if(_0xe20a84)io['to'](util[_0x7228('0x46')](_0x7228('0x142'),_0xe20a84))[_0x7228('0x41')](_0x7228('0x143'),{'hopper':_0x2b8704[_0x4aed1b]});}})[_0x7228('0xa0')](function(_0x990bc1){logger['error'](_0x7228('0x144'),_0x990bc1);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0x7228('0x18')][_0x7228('0x3d')]=function(){var _0xf4c716=this;setInterval(function(){_0xf4c716['clearZombieChannels'](_0xf4c716[_0x7228('0x25')],'[uniqueid]');_0xf4c716[_0x7228('0x145')](_0xf4c716['actions'],'[actions]');},0x32c8);};Dialer['prototype'][_0x7228('0x145')]=function(_0x1e0145,_0x581329){var _0x494b24=this;for(var _0x121b46 in _0x1e0145){if(typeof _0x1e0145[_0x121b46]!==_0x7228('0xab')){this[_0x7228('0x1b')]['enqueue'](function(){if(!_[_0x7228('0xf7')](_0x1e0145[_0x121b46])){return ami[_0x7228('0x99')]({'action':'status','channel':_0x1e0145[_0x121b46][_0x7228('0xf1')]})[_0x7228('0xa0')](function(_0xbd3dd4){if(_0xbd3dd4['message']===_0x7228('0x146')){setTimeout(function(){if(_0x1e0145[_0x121b46]&&_0x1e0145[_0x121b46][_0x7228('0x42')]!==_0x7228('0xc3')){_0x494b24[_0x7228('0xc4')](_0x494b24['voiceQueues'][_0x1e0145[_0x121b46][_0x7228('0xc1')]]);logger[_0x7228('0x67')](_0x7228('0x147'),_0x581329,_0x121b46,_0x1e0145[_0x121b46][_0x7228('0xc1')]);delete _0x1e0145[_0x121b46];}if(_0x1e0145[_0x121b46]&&_0x1e0145[_0x121b46][_0x7228('0x42')]===_0x7228('0xc3')){_0x494b24[_0x7228('0xc4')](_0x494b24['campaigns'][_0x1e0145[_0x121b46][_0x7228('0xc1')]]);logger[_0x7228('0x67')](_0x7228('0x148'),_0x581329,_0x121b46,_0x1e0145[_0x121b46][_0x7228('0xc1')]);delete _0x1e0145[_0x121b46];}},0x2328);}});}});}}};Dialer['prototype'][_0x7228('0x149')]=function(_0x3a797e){return Promise[_0x7228('0xac')]()['then'](voiceQueueRt['getVoiceQueueRtPauses'](_0x3a797e))[_0x7228('0xa0')](loggerCatch('[getVoiceQueueRtPauses]\x20'));};Dialer[_0x7228('0x18')][_0x7228('0xc4')]=function(_0x36e9c8){if(!_['isUndefined'](_0x36e9c8)&&_0x36e9c8!==null){if(typeof _0x36e9c8[_0x7228('0x80')]!==_0x7228('0xab')){if(_0x36e9c8[_0x7228('0x80')]>0x0){_0x36e9c8[_0x7228('0x80')]-=0x1;}else{logger[_0x7228('0x67')]('[updateOriginated]\x20object\x20originated\x20is\x20negative');}}}else{logger[_0x7228('0x67')](_0x7228('0x14a'));}};Dialer[_0x7228('0x18')][_0x7228('0x14b')]=function(_0x4d3f49,_0x43c1b4){var _0x288c0a=this;return function(_0x7fcd91){_0x288c0a[_0x7228('0xc4')](_0x43c1b4);logger[_0x7228('0x67')](_0x4d3f49,util[_0x7228('0x6a')](_0x7fcd91,{'showHidden':![],'depth':null}));};};Dialer[_0x7228('0x18')][_0x7228('0x14c')]=function(_0x2bafde,_0x3dbbf0,_0x1480d1){var _0x313dfa={'state':0x19,'statedesc':'notFound'};this[_0x7228('0xc4')](_0x3dbbf0);this[_0x7228('0x118')](_[_0x7228('0x61')](_0x313dfa,_['pick'](_0x1480d1,[_0x7228('0xdf'),'ListId','UserId',_0x7228('0xe1'),_0x7228('0xe2')])),_0x7228('0x14d'),_0x7228('0x14e'));logger[_0x7228('0x67')](_0x2bafde);};Dialer['prototype'][_0x7228('0x118')]=function(_0x350500,_0x43be35,_0x346cce){hopperUtils[_0x7228('0xf0')](_0x350500)[_0x7228('0xa0')](loggerCatch(_0x43be35));hopperUtils[_0x7228('0xcd')](_0x350500)['catch'](loggerCatch(_0x346cce));};Dialer[_0x7228('0x18')][_0x7228('0xed')]=function(_0x44c1b1,_0x4b57e2){hopperUtils[_0x7228('0xf0')](_0x44c1b1)[_0x7228('0xa0')](loggerCatch(_0x7228('0xcc')));if(_0x4b57e2==0x0){hopperUtils[_0x7228('0xcd')](_0x44c1b1)[_0x7228('0xa0')](loggerCatch('[syncQueueCallerAbandon]\x20[Drop]'));}};Dialer['prototype'][_0x7228('0x144')]=function(_0x3808b7){return Promise['resolve']()[_0x7228('0x3f')](cmHopper['handlePreviewRecallNotifications'](_0x3808b7['id'],previewRecallmeReminderInterval))[_0x7228('0x3f')](function(_0x53b140){for(var _0x2dfa50=0x0;_0x2dfa50<_0x53b140[_0x7228('0x97')];_0x2dfa50++){var _0x12b7e5=_0x53b140[_0x2dfa50]['Agent'][_0x7228('0x47')];if(_0x12b7e5)io['to'](util[_0x7228('0x46')](_0x7228('0x142'),_0x12b7e5))['emit']('user:dialPreviewRecallReminder',{'hopper':_0x53b140[_0x2dfa50]});}})[_0x7228('0xa0')](function(){});};Dialer['prototype']['launchHandleIvr']=function(_0x3089e8){var _0x1aa0df=this;return function(){_0x1aa0df[_0x7228('0x14f')](_0x3089e8);};};Dialer[_0x7228('0x18')][_0x7228('0x150')]=function(_0x151df9,_0x281eb4){var _0x48cd2c=this;var _0x2926e3=uuid['v4']();this[_0x7228('0x23')][_0x2926e3]=new Action(_0x151df9,_0x281eb4,_0x2926e3);return new Promise(function(_0xbebfcd,_0x285899){if(_['isUndefined'](_0x151df9)&&typeof _0x151df9!==_0x7228('0x151')){return _0x285899(msgResponse(_0x7228('0x152'),_0x7228('0x94'),_0x7228('0x153')));}if(_['isUndefined'](_0x281eb4[_0x7228('0x154')])||_0x281eb4[_0x7228('0x154')]===null){return _0x285899(msgResponse(_0x7228('0x152'),_0x7228('0x94'),_0x7228('0x155')));}var _0x562a7f={'XMD-CALLERID':_0x48cd2c['actions'][_0x2926e3][_0x7228('0x156')](),'XMD-AGI':_0x151df9['dialQueueProject']?util[_0x7228('0x46')](_0x7228('0x157'),ipAgi,_0x151df9[_0x7228('0x12f')]):_0x7228('0x158'),'XMD-AGIAFTER':_0x151df9[_0x7228('0xd6')]?util[_0x7228('0x46')](_0x7228('0x157'),ipAgi,_0x151df9['dialQueueProject2']):_0x7228('0x158'),'XMD-QUEUE':utils[_0x7228('0x159')](_0x151df9)?util[_0x7228('0x46')](_0x7228('0x15a'),_0x151df9[_0x7228('0x47')],_0x151df9['dialQueueOptions']||'',_0x151df9[_0x7228('0xca')]?'c':'',_0x151df9['dialQueueTimeout']||0x3):'NONE','XMD-CONTACTID':_0x281eb4[_0x7228('0xdf')],'XMD-CDRTYPE':_0x7228('0x15b'),'CALLERID(all)':_0x48cd2c[_0x7228('0x23')][_0x2926e3][_0x7228('0x156')](),'XMD-AMD':_0x151df9[_0x7228('0x110')]?_0x7228('0x15c'):_0x7228('0x158'),'XMD-DESTINATION':_0x7228('0x10f')};if(_0x151df9[_0x7228('0x110')]){_0x562a7f[_0x7228('0x15d')]=_0x151df9['dialAMDInitialSilence']||0x9c4;_0x562a7f[_0x7228('0x15e')]=_0x151df9['dialAMDGreeting']||0x5dc;_0x562a7f[_0x7228('0x15f')]=_0x151df9['dialAMDAfterGreetingSilence']||0x320;_0x562a7f['XMD-AMDTOTALANALYSISTIME']=_0x151df9[_0x7228('0x160')]||0x1388;_0x562a7f[_0x7228('0x161')]=_0x151df9[_0x7228('0x162')]||0x64;_0x562a7f[_0x7228('0x163')]=_0x151df9[_0x7228('0x164')]||0x32;_0x562a7f[_0x7228('0x165')]=_0x151df9[_0x7228('0x166')]||0x3;_0x562a7f['XMD-AMDSILENCETHRESHOLD']=_0x151df9[_0x7228('0x167')]||0x100;_0x562a7f['XMD-AMDMAXIMUMWORDLENGTH']=_0x151df9['dialAMDMaximumWordLength']||0x1388;}if(utils[_0x7228('0x159')](_0x151df9)){_0x562a7f[_0x7228('0x168')]=_0x281eb4['VoiceQueueId'];}else{_0x562a7f[_0x7228('0x169')]=_0x281eb4['CampaignId'];}var _0x220c2f=utils[_0x7228('0x16a')](_0x281eb4[_0x7228('0x16b')]);Object[_0x7228('0x16c')](_0x562a7f,_0x220c2f);var _0x2403c6=_0x48cd2c['isTrunkReachable'](_0x151df9[_0x7228('0x8c')])?utils['getCallerId'](_0x151df9[_0x7228('0x8c')][_0x7228('0x16d')],_0x151df9[_0x7228('0x16e')],_0x151df9[_0x7228('0x16f')]>0x0?utils[_0x7228('0x170')](_0x151df9['dialOriginateCallerIdNumber'],_0x151df9[_0x7228('0x16f')]):_0x151df9['dialOriginateCallerIdNumber']):utils[_0x7228('0x171')](_[_0x7228('0xf7')](_0x151df9['TrunkBackup'])?_0x151df9[_0x7228('0x8c')][_0x7228('0x16d')]:_0x151df9['TrunkBackup'][_0x7228('0x16d')],_0x151df9[_0x7228('0x16e')],_0x151df9[_0x7228('0x16f')]>0x0?utils[_0x7228('0x170')](_0x151df9[_0x7228('0x172')],_0x151df9['dialRandomLastDigitCallerIdNumber']):_0x151df9['dialOriginateCallerIdNumber']);if(_0x2403c6){_0x562a7f[_0x7228('0x173')]=_0x48cd2c[_0x7228('0x23')][_0x2926e3][_0x7228('0x174')]=utils[_0x7228('0x175')](_0x2403c6);_0x562a7f[_0x7228('0x176')]=_0x281eb4[_0x7228('0x154')];}_0x151df9[_0x7228('0x177')]=_0x562a7f;return ami['Action']({'actionid':_0x2926e3,'action':_0x7228('0x152'),'channel':_0x48cd2c[_0x7228('0x86')](_0x151df9['Trunk'])?util[_0x7228('0x46')]('SIP/%s/%s%s',_0x151df9['Trunk'][_0x7228('0x47')],isNotNull(_0x151df9['dialPrefix'])?_0x151df9[_0x7228('0x178')][_0x7228('0x179')]()||'':'',_0x151df9[_0x7228('0x17a')]>0x0?_0x281eb4[_0x7228('0x154')][_0x7228('0x17b')](_0x151df9[_0x7228('0x17a')]):_0x281eb4['phone']):util[_0x7228('0x46')](_0x7228('0x17c'),_[_0x7228('0xf7')](_0x151df9[_0x7228('0x8d')])?_0x151df9[_0x7228('0x8c')]['name']:_0x151df9[_0x7228('0x8d')][_0x7228('0x47')],isNotNull(_0x151df9['dialPrefix'])?_0x151df9[_0x7228('0x178')][_0x7228('0x179')]()||'':'',_0x151df9['dialCutDigit']>0x0?_0x281eb4[_0x7228('0x154')][_0x7228('0x17b')](_0x151df9[_0x7228('0x17a')]):_0x281eb4[_0x7228('0x154')]),'callerid':_0x2403c6,'Exten':_0x7228('0x10f'),'Context':_0x7228('0x17d'),'Priority':'1','variable':_0x562a7f,'timeout':(_0x151df9[_0x7228('0x17e')]||0x1e)*0x3e8,'async':!![],'channelid':_0x2926e3})[_0x7228('0x3f')](function(_0x2f9012){return _0xbebfcd(_0x2f9012);})[_0x7228('0xa0')](function(_0x3ba4a3){_0x151df9[_0x7228('0x17f')]+=0x1;var _0x45c264=new History(_0x48cd2c['actions'][_0x2926e3]);logger['error'](util['format']('[originateError]:\x20%s',JSON['stringify'](_0x3ba4a3)));_0x45c264['state']=0xe;_0x45c264[_0x7228('0x72')]=_0x7228('0x180');_0x45c264[_0x7228('0xe5')]=moment()[_0x7228('0x46')](_0x7228('0xcb'));_0x45c264[_0x7228('0xe4')]=_0x45c264[_0x7228('0xe5')];hopperUtils['createHistory'](_0x45c264)[_0x7228('0xa0')](loggerCatch('[originate][error]'));_0x48cd2c[_0x7228('0xcd')](_0x45c264)[_0x7228('0xa0')](loggerCatch('[originate][error]'))['finally'](function(){delete _0x48cd2c[_0x7228('0x23')][_0x2926e3];return _0x285899(msgResponse(_0x7228('0x152'),_0x7228('0x85'),'originate\x20action\x20Error'));});});});};Dialer[_0x7228('0x18')][_0x7228('0x181')]=function(_0x8cdd52,_0x1572f8,_0x32627b){var _0x4de613=new History(_0x1572f8);if(_0x4de613[_0x7228('0x182')]+_0x4de613[_0x7228('0x11f')]+_0x4de613[_0x7228('0x120')]+_0x4de613['countnosuchnumberretry']+_0x4de613[_0x7228('0xd7')]+_0x4de613[_0x7228('0xeb')]+_0x4de613[_0x7228('0x11c')]+_0x4de613[_0x7228('0x183')]>=_0x32627b[_0x7228('0x122')]-0x1){return!![];}switch(_0x8cdd52){case 0x3:if(_0x4de613[_0x7228('0x120')]>=_0x32627b['dialNoAnswerMaxRetry']-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countnoanswerretry':_0x4de613[_0x7228('0x120')]+=0x1,'scheduledat':moment()[_0x7228('0xdd')](_0x32627b[_0x7228('0x184')],_0x7228('0xde'))[_0x7228('0x46')](_0x7228('0xcb')),'ContactId':_0x4de613[_0x7228('0xdf')],'ListId':_0x4de613[_0x7228('0xe0')],'VoiceQueueId':_0x4de613[_0x7228('0xe1')]||undefined,'CampaignId':_0x4de613[_0x7228('0xe2')]||undefined})[_0x7228('0xa0')](loggerCatch(_0x7228('0x185')));break;case 0x5:if(_0x4de613['countbusyretry']>=_0x32627b[_0x7228('0x186')]-0x1){return!![];}hopperUtils[_0x7228('0xdc')]({'active':![],'countbusyretry':_0x4de613['countbusyretry']+=0x1,'scheduledat':moment()['add'](_0x32627b[_0x7228('0x187')],_0x7228('0xde'))['format'](_0x7228('0xcb')),'ContactId':_0x4de613[_0x7228('0xdf')],'ListId':_0x4de613[_0x7228('0xe0')],'VoiceQueueId':_0x4de613[_0x7228('0xe1')]||undefined,'CampaignId':_0x4de613[_0x7228('0xe2')]||undefined})['catch'](loggerCatch(_0x7228('0x188')));break;case 0x8:if(_0x4de613['countcongestionretry']>=_0x32627b[_0x7228('0x189')]-0x1){return!![];}hopperUtils[_0x7228('0xdc')]({'active':![],'countcongestionretry':_0x4de613[_0x7228('0x11f')]+=0x1,'scheduledat':moment()[_0x7228('0xdd')](_0x32627b[_0x7228('0x18a')],_0x7228('0xde'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x4de613[_0x7228('0xdf')],'ListId':_0x4de613[_0x7228('0xe0')],'VoiceQueueId':_0x4de613[_0x7228('0xe1')]||undefined,'CampaignId':_0x4de613['CampaignId']||undefined})[_0x7228('0xa0')](loggerCatch(_0x7228('0x18b')));break;case 0x0:if(_0x4de613[_0x7228('0x121')]>=_0x32627b['dialNoSuchNumberMaxRetry']-0x1){return!![];}else{hopperUtils['rescheduleContact']({'active':![],'countnosuchnumberretry':_0x4de613[_0x7228('0x121')]+=0x1,'scheduledat':moment()[_0x7228('0xdd')](_0x32627b[_0x7228('0x18c')],'minutes')['format'](_0x7228('0xcb')),'ContactId':_0x4de613[_0x7228('0xdf')],'ListId':_0x4de613[_0x7228('0xe0')],'VoiceQueueId':_0x4de613[_0x7228('0xe1')]||undefined,'CampaignId':_0x4de613[_0x7228('0xe2')]||undefined})[_0x7228('0xa0')](loggerCatch('[rescheduleContact][NoSuchNumber]'));}break;case 0xa:if(_0x4de613[_0x7228('0xd7')]>=_0x32627b[_0x7228('0xdb')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countdropretry':_0x4de613[_0x7228('0xd7')]+=0x1,'scheduledat':moment()['add'](_0x32627b[_0x7228('0x18d')],_0x7228('0xde'))[_0x7228('0x46')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x4de613[_0x7228('0xdf')],'ListId':_0x4de613[_0x7228('0xe0')],'VoiceQueueId':_0x4de613[_0x7228('0xe1')]||undefined,'CampaignId':_0x4de613['CampaignId']||undefined})[_0x7228('0xa0')](loggerCatch(_0x7228('0xe3')));break;case 0xb:if(_0x4de613[_0x7228('0xeb')]>=_0x32627b['dialAbandonedMaxRetry']-0x1){return!![];}hopperUtils[_0x7228('0xdc')]({'active':![],'countabandonedretry':_0x4de613[_0x7228('0xeb')]+=0x1,'scheduledat':moment()[_0x7228('0xdd')](_0x32627b[_0x7228('0xee')],'minutes')[_0x7228('0x46')](_0x7228('0xcb')),'ContactId':_0x4de613[_0x7228('0xdf')],'ListId':_0x4de613[_0x7228('0xe0')],'VoiceQueueId':_0x4de613['VoiceQueueId']||undefined,'CampaignId':_0x4de613[_0x7228('0xe2')]||undefined})[_0x7228('0xa0')](loggerCatch(_0x7228('0xef')));break;case 0x13:if(_0x4de613[_0x7228('0x11c')]>=_0x32627b['dialMachineMaxRetry']-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countmachineretry':_0x4de613[_0x7228('0x11c')]+=0x1,'scheduledat':moment()['add'](_0x32627b['dialMachineRetryFrequency'],'minutes')[_0x7228('0x46')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x4de613[_0x7228('0xdf')],'ListId':_0x4de613[_0x7228('0xe0')],'VoiceQueueId':_0x4de613[_0x7228('0xe1')]||undefined,'CampaignId':_0x4de613[_0x7228('0xe2')]||undefined})[_0x7228('0xa0')](loggerCatch(_0x7228('0x12a')));break;case 0x14:if(_0x4de613[_0x7228('0x183')]>=_0x32627b['dialAgentRejectMaxRetry']-0x1){return!![];}hopperUtils[_0x7228('0xdc')]({'active':![],'countagentrejectretry':_0x4de613['countagentrejectretry']+=0x1,'scheduledat':moment()[_0x7228('0xdd')](_0x32627b[_0x7228('0x18e')],_0x7228('0xde'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x4de613['ContactId'],'ListId':_0x4de613[_0x7228('0xe0')],'VoiceQueueId':_0x4de613[_0x7228('0xe1')]||undefined,'CampaignId':_0x4de613['CampaignId']||undefined})[_0x7228('0xa0')](loggerCatch(_0x7228('0x18f')));break;default:return!![];}};Dialer[_0x7228('0x18')][_0x7228('0x10b')]=function(_0x3efe33,_0x10673c,_0x42184c){var _0x4d2ce2=this;var _0x111a27=new History(_0x3efe33);var _0xedb80f=![];var _0x53fc51;var _0x27ac95;return new Promise(function(_0x3ead5d,_0x44f67c){if(_[_0x7228('0x55')](_0x10673c)&&typeof _0x10673c!==_0x7228('0x151')){return _0x44f67c(msgResponse(_0x7228('0x190'),_0x7228('0x94'),_0x7228('0x191')));}if(_['isUndefined'](_0x42184c)&&typeof _0x42184c!=='object'){return _0x44f67c(msgResponse(_0x7228('0x190'),_0x7228('0x94'),_0x7228('0x192')));}hopperUtils['verifyAdditionalPhones'](_0x111a27,_0x42184c[_0x7228('0xc7')],_0x10673c)[_0x7228('0x3f')](function(_0x3d724f){if(_0x3d724f[_0x7228('0xda')]==0x1)_0xedb80f=!![];switch(_0x42184c[_0x7228('0xc7')]){case'0':_0x10673c[_0x7228('0x193')]+=0x1;_0x111a27[_0x7228('0x71')]=0x0;_0x111a27[_0x7228('0x72')]=_0x7228('0x194');_0x111a27['countnosuchnumberretry']+=0x1;_0x111a27['countglobal']+=0x1;ami[_0x7228('0x41')](_0x7228('0x195'),ut['buildObj'](_0x3efe33,_0x7228('0x196')));_0x53fc51=_0x10673c[_0x7228('0x18c')];_0x27ac95=_0x10673c['callAdditionalPhoneAfterMin'];hopperUtils['createHistory'](_0x111a27)[_0x7228('0xa0')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x4d2ce2[_0x7228('0x181')](0x0,_0x3efe33,_0x10673c)&&!_0xedb80f){if(_0x111a27['countnosuchnumberretry']>=_0x10673c[_0x7228('0x197')]){_0x4d2ce2[_0x7228('0x124')](_0x111a27,_0x3ead5d,_0x44f67c,_0x7228('0x198'));}else{_0x4d2ce2[_0x7228('0x199')](_0x111a27,_0x3ead5d,_0x44f67c,_0x7228('0x198'));}}break;case'3':_0x10673c['outboundNoAnswerCallsDay']+=0x1;_0x111a27[_0x7228('0x71')]=0x3;_0x111a27[_0x7228('0x72')]=_0x7228('0x19a');_0x111a27[_0x7228('0x120')]+=0x1;_0x111a27[_0x7228('0xd8')]+=0x1;var _0x3d30db=ut[_0x7228('0x19b')](_0x3efe33,_0x10673c);ami['emit'](_0x7228('0x19c'),_0x3d30db);_0x53fc51=_0x10673c[_0x7228('0x184')];_0x27ac95=_0x10673c['callAdditionalPhoneAfterMin'];hopperUtils['createHistory'](_0x111a27)[_0x7228('0xa0')](loggerCatch(_0x7228('0x19d')));if(_0x4d2ce2[_0x7228('0x181')](0x3,_0x3efe33,_0x10673c)&&!_0xedb80f){if(_0x111a27[_0x7228('0x120')]>=_0x10673c[_0x7228('0x19e')]){_0x4d2ce2['createStateFinal'](_0x111a27,_0x3ead5d,_0x44f67c,'reason\x203\x20ringing\x20no\x20answer');}else{_0x4d2ce2['stateGlobal'](_0x111a27,_0x3ead5d,_0x44f67c,_0x7228('0x19f'));}}break;case'5':_0x10673c[_0x7228('0x1a0')]+=0x1;_0x111a27[_0x7228('0x71')]=0x5;_0x111a27[_0x7228('0x72')]=_0x7228('0x1a1');_0x111a27[_0x7228('0x182')]+=0x1;_0x111a27['countglobal']+=0x1;ami[_0x7228('0x41')]('custom:agentbusy',ut[_0x7228('0x116')](_0x3efe33,_0x7228('0x1a2')));_0x53fc51=_0x10673c[_0x7228('0x187')];_0x27ac95=_0x10673c['callAdditionalPhoneAfterMin'];hopperUtils[_0x7228('0xf0')](_0x111a27)[_0x7228('0xa0')](loggerCatch('[syncAgentComplete][createHistory][5]'));if(_0x4d2ce2['checkRetriveMax'](0x5,_0x3efe33,_0x10673c)&&!_0xedb80f){if(_0x111a27[_0x7228('0x182')]>=_0x10673c[_0x7228('0x186')]){_0x4d2ce2[_0x7228('0x124')](_0x111a27,_0x3ead5d,_0x44f67c,_0x7228('0x1a3'));}else{_0x4d2ce2[_0x7228('0x199')](_0x111a27,_0x3ead5d,_0x44f67c,_0x7228('0x1a3'));}}break;case'8':_0x10673c[_0x7228('0x1a4')]+=0x1;_0x111a27[_0x7228('0x71')]=0x8;_0x111a27['statedesc']=_0x7228('0x1a5');_0x111a27['countcongestionretry']+=0x1;_0x111a27[_0x7228('0xd8')]+=0x1;_0x53fc51=_0x10673c[_0x7228('0x18a')];_0x27ac95=_0x10673c[_0x7228('0x1a6')];ami[_0x7228('0x41')]('custom:agentcongestion',ut[_0x7228('0x116')](_0x3efe33,_0x7228('0x1a7')));hopperUtils[_0x7228('0xf0')](_0x111a27)[_0x7228('0xa0')](loggerCatch('[syncAgentComplete][createHistory][8]'));if(_0x4d2ce2[_0x7228('0x181')](0x8,_0x3efe33,_0x10673c)&&!_0xedb80f){if(_0x111a27[_0x7228('0x11f')]>=_0x10673c['dialCongestionMaxRetry']){_0x4d2ce2[_0x7228('0x124')](_0x111a27,_0x3ead5d,_0x44f67c,_0x7228('0x1a8'));}else{_0x4d2ce2[_0x7228('0x199')](_0x111a27,_0x3ead5d,_0x44f67c,'reason\x208\x20congestion');}}break;case'11':_0x10673c[_0x7228('0x1a9')]+=0x1;_0x111a27['state']=0xb;_0x111a27[_0x7228('0x72')]='Abandoned';_0x111a27[_0x7228('0xeb')]+=0x1;_0x111a27[_0x7228('0xd8')]+=0x1;_0x53fc51=_0x10673c[_0x7228('0xee')];_0x27ac95=_0x10673c['callAdditionalPhoneAfterMin'];hopperUtils['createHistory'](_0x111a27)[_0x7228('0xa0')](loggerCatch(_0x7228('0x1aa')));if(_0x4d2ce2[_0x7228('0x181')](0xb,_0x3efe33,_0x10673c)&&!_0xedb80f){if(_0x111a27[_0x7228('0xeb')]>=_0x10673c[_0x7228('0x1ab')]){_0x4d2ce2['createStateFinal'](_0x111a27,_0x3ead5d,_0x44f67c,_0x7228('0x1ac'));}else{_0x4d2ce2[_0x7228('0x199')](_0x111a27,_0x3ead5d,_0x44f67c,'reason\x2011\x20abandoned');}}break;case'20':_0x10673c[_0x7228('0x1ad')]+=0x1;_0x111a27[_0x7228('0x71')]=0x14;_0x111a27['statedesc']=_0x7228('0x1ae');_0x111a27['countagentrejectretry']+=0x1;_0x111a27['countglobal']+=0x1;_0x53fc51=_0x10673c[_0x7228('0x18e')];_0x27ac95=_0x10673c['callAdditionalPhoneAfterMin'];ami[_0x7228('0x41')](_0x7228('0x1af'),ut[_0x7228('0x116')](_0x3efe33,_0x7228('0x1b0')));hopperUtils[_0x7228('0xf0')](_0x111a27)[_0x7228('0xa0')](loggerCatch(_0x7228('0x1b1')));if(_0x4d2ce2[_0x7228('0x181')](0x14,_0x3efe33,_0x10673c)&&!_0xedb80f){if(_0x111a27[_0x7228('0x183')]>=_0x10673c[_0x7228('0x1b2')]){_0x4d2ce2[_0x7228('0x124')](_0x111a27,_0x3ead5d,_0x44f67c,_0x7228('0x1b3'));}else{_0x4d2ce2[_0x7228('0x199')](_0x111a27,_0x3ead5d,_0x44f67c,'reason\x2020\x20agentreject');}}break;default:_0x10673c[_0x7228('0x132')]+=0x1;_0x111a27[_0x7228('0x71')]=0xc;_0x111a27[_0x7228('0x72')]=_0x42184c['reason'];_0x53fc51=_0x10673c['dialAgentRejectRetryFrequency'];_0x27ac95=_0x10673c['callAdditionalPhoneAfterMin'];hopperUtils[_0x7228('0xf0')](_0x111a27)['catch'](loggerCatch('[syncAgentComplete][createHistory][?]'));if(_0x4d2ce2['checkRetriveMax'](_0x42184c[_0x7228('0xc7')],_0x3efe33,_0x10673c)&&!_0xedb80f){if(_0x111a27['countbusyretry']+_0x111a27[_0x7228('0x11f')]+_0x111a27[_0x7228('0x120')]+_0x111a27['countnosuchnumberretry']+_0x111a27['countdropretry']+_0x111a27['countabandonedretry']+_0x111a27[_0x7228('0x11c')]+_0x111a27[_0x7228('0x183')]>=_0x10673c[_0x7228('0x122')]){_0x4d2ce2[_0x7228('0x199')](_0x111a27,_0x3ead5d,_0x44f67c,_0x42184c[_0x7228('0xc7')]);}else{_0x4d2ce2[_0x7228('0x124')](_0x111a27,_0x3ead5d,_0x44f67c,_0x42184c[_0x7228('0xc7')]);}}}})[_0x7228('0x3f')](function(){if(_0xedb80f){hopperUtils[_0x7228('0xe9')](_0x111a27,_0x53fc51,_0x27ac95)[_0x7228('0x3f')](function(){return _0x3ead5d(0x1);});}});});};Dialer[_0x7228('0x18')][_0x7228('0x199')]=function(_0x274e99,_0x1362a6,_0x3c038e,_0x564f3f){var _0x2175d0=new Final(_0x274e99);_0x2175d0['state']=0xf;_0x2175d0[_0x7228('0x72')]='Global';this[_0x7228('0x124')](_0x2175d0,_0x1362a6,_0x3c038e,_0x564f3f);};Dialer[_0x7228('0x18')][_0x7228('0x124')]=function(_0x516cb1,_0x10784e,_0x943726,_0x5ea462){hopperUtils[_0x7228('0xcd')](_0x516cb1)[_0x7228('0x3f')](function(){return _0x10784e(msgResponse(_0x7228('0x190'),_0x7228('0x10a'),_0x5ea462));})['catch'](function(){return _0x943726(msgResponse('[moveContactManagedDialer][0]',_0x7228('0x94'),_0x7228('0x1b4')));});};Dialer['prototype'][_0x7228('0x9')]=function(_0xb602ab){var _0x2cb337=_0xb602ab[_0x7228('0x1b5')]/0x64;var _0x52ddba=_0xb602ab[_0x7228('0xd1')]/(_0xb602ab['outboundDropCallsDayTimeout']+_0xb602ab[_0x7228('0xc6')]);var _0xed6b67=Math[_0x7228('0x1b6')](_0xb602ab[_0x7228('0x1b7')]*(_0xb602ab[_0x7228('0x1b8')]/0x64));var _0xee3422=Math[_0x7228('0x1b6')](_0xb602ab[_0x7228('0x1b7')]*(_0xb602ab[_0x7228('0x1b9')]/0x64));var _0x31aaa0=_0xb602ab[_0x7228('0x137')]+_0xb602ab['talking'];var _0x338643=Math[_0x7228('0x1ba')](_0xb602ab[_0x7228('0x5b')]*_0xb602ab[_0x7228('0x5f')]*_0xb602ab[_0x7228('0x1bb')]*_0xb602ab[_0x7228('0x1bc')]);if(_[_0x7228('0x55')](_0xb602ab[_0x7228('0x27')])){if(!_['isUndefined'](_0xb602ab['startPredictive'])){_0xb602ab[_0x7228('0x63')]=undefined;loggerPredictive[_0x7228('0x67')](_0x7228('0x1bd'),_0x7228('0x1be'));}if(!_['isUndefined'](_0xb602ab[_0x7228('0x65')])){loggerPredictive[_0x7228('0x67')](_0x7228('0x1bd'),_0x7228('0x1bf'));clearInterval(_0xb602ab['handlePredictive']);_0xb602ab['handlePredictive']=undefined;}_0xb602ab[_0x7228('0x27')]=moment()['format'](_0x7228('0xcb'));loggerPredictive['info'](_0xb602ab[_0x7228('0x47')],_0x7228('0x1c0'),_0xb602ab[_0x7228('0x27')]);this[_0x7228('0xb5')](_0xb602ab,0x1);}else if(ifInterval(_0xb602ab[_0x7228('0x1c1')],_0xb602ab['startProgressive'])){this['handlePower'](_0xb602ab,0x1);loggerPredictiveCalls[_0x7228('0x49')]('[startMethodPredictive][StartProgressive][Loop]',_0xb602ab[_0x7228('0x27')],_0xb602ab[_0x7228('0x47')]);_0xb602ab['erlangCalls']=0x0;_0xb602ab[_0x7228('0xd2')]=0x0;}else if(_0x2cb337<_0x52ddba&&_0xb602ab[_0x7228('0x1c2')]===_0x7228('0x1c3')){clearPredictiveAttributes(_0xb602ab);loggerPredictive[_0x7228('0x49')](_0x7228('0x1c4'),_0x7228('0x1c5'),_0x52ddba,_0x7228('0x27'),_0xb602ab['name']);}else if(_0x338643<_0xb602ab[_0x7228('0xd2')]&&_0xb602ab[_0x7228('0x1c2')]===_0x7228('0x1c3')){clearPredictiveAttributes(_0xb602ab);loggerPredictive['info'](_0x7228('0x1c6'),_0x7228('0x1c7'),_0x338643,'Drop\x20in\x20this\x20interval',_0xb602ab[_0x7228('0xd2')],_0x7228('0x27'),_0xb602ab[_0x7228('0x47')]);}else if(!ifInterval(_0xb602ab[_0x7228('0x1c1')],_0xb602ab[_0x7228('0x27')])&&_[_0x7228('0x55')](_0xb602ab[_0x7228('0x63')])&&!_[_0x7228('0x55')](_0xb602ab[_0x7228('0x27')])){_0xb602ab[_0x7228('0x63')]=moment()['format'](_0x7228('0xcb'));loggerPredictive['info'](_0xb602ab[_0x7228('0x47')],_0x7228('0x1c8'),_0xb602ab[_0x7228('0x63')]);hopperUtils['avgHandleTime'](_0xb602ab[_0x7228('0x1c1')])[_0x7228('0x3f')](this[_0x7228('0x1c9')](_0xb602ab))['then'](mergeDataErlangB(_0xb602ab))['then'](this['startMethodPredictive'](_0xb602ab))[_0x7228('0xa0')](loggerCatchPredictive(_0x7228('0x1ca'),_0xb602ab));}else if(!ifInterval(_0xb602ab[_0x7228('0x1c1')],_0xb602ab[_0x7228('0x63')])){_0xb602ab[_0x7228('0xd2')]=0x0;_0xb602ab[_0x7228('0x63')]=moment()[_0x7228('0x46')](_0x7228('0xcb'));loggerPredictive[_0x7228('0x49')](_0xb602ab[_0x7228('0x47')],_0x7228('0x1cb'),_0xb602ab[_0x7228('0x63')]);clearInterval(_0xb602ab['handlePredictive']);_0xb602ab['handlePredictive']=undefined;hopperUtils['avgHandleTime'](_0xb602ab[_0x7228('0x1c1')])['then'](this['getDataPredictive'](_0xb602ab))[_0x7228('0x3f')](mergeDataErlangB(_0xb602ab))[_0x7228('0x3f')](this[_0x7228('0x1cc')](_0xb602ab))[_0x7228('0xa0')](loggerCatchPredictive(_0x7228('0x1cd'),_0xb602ab));}else if(_0xb602ab[_0x7228('0x1b7')]&&_0x31aaa0<_0xb602ab[_0x7228('0x1b7')]-_0xee3422){clearPredictiveAttributes(_0xb602ab);loggerPredictive[_0x7228('0x49')](_0xb602ab['name'],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x31aaa0,_0x7228('0x1ce'),_0xb602ab['predictiveIntervalAvailable'],'-',_0xee3422,'=',_0xb602ab[_0x7228('0x1b7')]-_0xee3422,')');}else if(_0xb602ab['predictiveIntervalAvailable']&&_0x31aaa0>_0xb602ab['predictiveIntervalAvailable']+_0xed6b67){clearPredictiveAttributes(_0xb602ab);loggerPredictive['info'](_0xb602ab[_0x7228('0x47')],_0x7228('0x1cf'),_0x31aaa0,_0x7228('0x1d0'),_0xb602ab[_0x7228('0x1b7')],'+',_0xed6b67,'=',_0xb602ab[_0x7228('0x1b7')]+_0xed6b67,')');}};Dialer[_0x7228('0x18')][_0x7228('0x1c9')]=function(_0x9b826d){var _0x5602ec=this;return function(_0x5ecedb){return new Promise(function(_0x5f36f9,_0x151eb6){_[_0x7228('0x61')](_0x9b826d,_0x5ecedb[0x0]);if(checkGetDataPredictive(_0x5ecedb[0x0])){var _0x83226c=_0x9b826d[_0x7228('0x1b7')]=_0x9b826d['talking']+_0x9b826d[_0x7228('0x137')];var _0x13136e=_0x9b826d['dialPredictiveInterval']*0x3c;var _0xd062ed=_0x5ecedb[0x0][_0x7228('0x53')]+_0x5ecedb[0x0]['predictiveIntervalAvgHoldtime'];var _0x353adf=(_0x5ecedb[0x0]['predictiveIntervalAnsweredCalls']+_0x5ecedb[0x0][_0x7228('0x4f')]+_0x5ecedb[0x0][_0x7228('0xea')])/_0x5ecedb[0x0][_0x7228('0x4c')];_0x9b826d[_0x7228('0x1bb')]=_0x353adf>0x0?_0x353adf:0x1;switch(_0x9b826d['dialPredictiveOptimization']){case'dropRate':var _0x59c2d6=_0x9b826d[_0x7228('0x1b5')]/0x64;return _0x5602ec[_0x7228('0x1d1')](_0x83226c,_0x13136e,_0xd062ed,_0x353adf,_0x59c2d6)[_0x7228('0x3f')](function(_0x1bbedb){return _0x5f36f9(_0x1bbedb);});case'agentBusyFactor':var _0x2a29fd=_0x9b826d['dialPredictiveOptimizationPercentage']/0x64;return _0x5602ec[_0x7228('0x1d2')](_0x83226c,_0x13136e,_0xd062ed,_0x353adf,_0x2a29fd)[_0x7228('0x3f')](function(_0x4ca40c){return _0x5f36f9(_0x4ca40c);});default:return _0x151eb6(msgResponse('[getDataPredictive]','Failure',_0x7228('0x1d3')));}}else{return _0x151eb6(msgResponse(_0x7228('0x1d4'),_0x7228('0x94'),_0x7228('0x1d5')));}});};};Dialer[_0x7228('0x18')][_0x7228('0x1d6')]=function(_0x1b260e){var _0xbc54e1=this;return function(_0xff3026){return new Promise(function(_0x1a4cb0,_0x569926){_[_0x7228('0x61')](_0x1b260e,_0xff3026[0x0]);if(checkGetDataPredictive(_0xff3026[0x0])){loggerPredictive[_0x7228('0x49')](JSON[_0x7228('0x75')](_0xff3026[0x0]));if(_0x1b260e[_0x7228('0x1c2')]===_0x7228('0x1c3')){return _0xbc54e1[_0x7228('0x149')](_0x1b260e['id'])[_0x7228('0x3f')](function(_0x37ff65){var _0x5d3f73=_0x1b260e['loggedIn']-_0x37ff65[0x0][_0x7228('0x1d7')];var _0x260d5a=_0x1b260e[_0x7228('0x1c1')]*0x3c;var _0x240b44=_0xff3026[0x0][_0x7228('0x53')]+_0xff3026[0x0]['predictiveIntervalAvgHoldtime'];var _0x3ea639=(_0xff3026[0x0][_0x7228('0x4d')]+_0xff3026[0x0][_0x7228('0x4f')]+_0xff3026[0x0][_0x7228('0xea')])/_0xff3026[0x0][_0x7228('0x4c')];var _0x521022=_0x1b260e[_0x7228('0x1b5')]/0x64;_0x1b260e[_0x7228('0x1d8')]=_0x37ff65[0x0][_0x7228('0x1d7')]||0x0;_0x1b260e['predictiveIntervalHitRate']=_0x3ea639>0x0?_0x3ea639:0x1;return _0xbc54e1[_0x7228('0x1d1')](_0x5d3f73,_0x260d5a,_0x240b44,_0x3ea639,_0x521022);})[_0x7228('0x3f')](function(_0x3a5bfe){return _0x1a4cb0(_0x3a5bfe);})[_0x7228('0xa0')](function(_0x1a631c){return _0x569926(msgResponse(_0x7228('0x1d9'),_0x7228('0x94'),JSON['stringify'](_0x1a631c)));});}if(_0x1b260e[_0x7228('0x1c2')]===_0x7228('0x1da')){return _0xbc54e1[_0x7228('0x149')](_0x1b260e['id'])[_0x7228('0x3f')](function(_0x4cdbf8){var _0x2cc417=_0x1b260e[_0x7228('0x1db')]-_0x4cdbf8[0x0][_0x7228('0x1d7')];var _0x163375=_0x1b260e['dialPredictiveInterval']*0x3c;var _0x141861=_0xff3026[0x0][_0x7228('0x53')]+_0xff3026[0x0][_0x7228('0x57')];var _0x46fb6e=(_0xff3026[0x0][_0x7228('0x4d')]+_0xff3026[0x0][_0x7228('0x4f')]+_0xff3026[0x0][_0x7228('0xea')])/_0xff3026[0x0][_0x7228('0x4c')];var _0x3e3939=_0x1b260e['dialPredictiveOptimizationPercentage']/0x64;_0x1b260e[_0x7228('0x1d8')]=_0x4cdbf8[0x0]['outboundQueuePauses']||0x0;_0x1b260e[_0x7228('0x1bb')]=_0x46fb6e>0x0?_0x46fb6e:0x1;return _0xbc54e1[_0x7228('0x1d2')](_0x2cc417,_0x163375,_0x141861,_0x46fb6e,_0x3e3939);})[_0x7228('0x3f')](function(_0x277385){return _0x1a4cb0(_0x277385);})[_0x7228('0xa0')](function(_0x361129){return _0x569926(msgResponse(_0x7228('0x1d9'),_0x7228('0x94'),JSON[_0x7228('0x75')](_0x361129)));});}}else{return _0x569926(msgResponse(_0x7228('0x1d4'),_0x7228('0x94'),'check\x20failure'));}});};};Dialer['prototype']['startMethodPredictive']=function(_0x3ca791){var _0x3b527b=this;return function(){var _0x29f7db=0x0;var _0x20de0b=Math[_0x7228('0x1ba')](_0x3ca791['erlangCallToSecond']*0x3e8);if(_0x20de0b>0x0){_0x20de0b=_0x20de0b<0x64?0x64:_0x20de0b;loggerPredictive['info'](_0x3ca791['name'],_0x7228('0x1dc'),_0x20de0b,_0x7228('0x1dd'));_0x3ca791['handlePredictive']=setInterval(function(){_0x3b527b[_0x7228('0x65')](_0x3ca791);loggerPredictiveCalls['info']('[handlePredictive]',_0x29f7db+=0x1);},_0x20de0b);}else{loggerPredictive[_0x7228('0x49')](_0x3ca791[_0x7228('0x47')],_0x7228('0x1de'));}};};Dialer[_0x7228('0x18')][_0x7228('0x1df')]=function(_0x3ff40e,_0xe1f46c){var _0x2cfc8c=this;return function(_0x4136f5){if(_[_0x7228('0x48')](_0x4136f5)){if(_[_0x7228('0xf7')](_0xe1f46c[_0x7228('0x1e0')])||!_0xe1f46c[_0x7228('0x1e1')]){if(_0x3ff40e[_0x7228('0xb2')]==='booked'){_0x3ff40e[_0x7228('0x73')]=_[_0x7228('0x55')](_0x3ff40e[_0x7228('0x73')])?!![]:_0x3ff40e[_0x7228('0x73')];var _0x24d0f6=uuid['v4']();_0x2cfc8c['actions'][_0x24d0f6]=new Action(_0x3ff40e,_0xe1f46c,_0x24d0f6);loggerBooked['info'](_0x7228('0x1e2'),_0x24d0f6,_0x7228('0x1e3'),JSON[_0x7228('0x75')](_0x3ff40e['queueStatusComplete']),_0x7228('0x1e4'),_0x3ff40e[_0x7228('0x47')]);if(_0x3ff40e[_0x7228('0x73')]){_0x3ff40e[_0x7228('0x73')]=![];_0x2cfc8c['queueBooked'][_0x2cfc8c[_0x7228('0x23')][_0x24d0f6][_0x7228('0xc1')]]=[];ami[_0x7228('0x99')]({'actionid':_0x24d0f6,'action':_0x7228('0x1e5'),'queue':_0x3ff40e['name']})[_0x7228('0xa0')](function(){_0x2cfc8c[_0x7228('0xc4')](_0x3ff40e);hopperUtils[_0x7228('0xdc')]({'active':![],'ContactId':_0x2cfc8c[_0x7228('0x23')][_0x24d0f6][_0x7228('0xdf')],'ListId':_0x2cfc8c[_0x7228('0x23')][_0x24d0f6]['ListId'],'VoiceQueueId':_0x2cfc8c[_0x7228('0x23')][_0x24d0f6]['VoiceQueueId']||undefined,'CampaignId':_0x2cfc8c['actions'][_0x24d0f6][_0x7228('0xe2')]||undefined})[_0x7228('0xa0')](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x2cfc8c[_0x7228('0x23')][_0x24d0f6];});}else{loggerBooked[_0x7228('0x49')](_0x7228('0x1e6'),JSON[_0x7228('0x75')](_0x3ff40e[_0x7228('0x73')]),_0x7228('0x1e4'),_0x3ff40e[_0x7228('0x47')]);_0x2cfc8c[_0x7228('0xc4')](_0x3ff40e);hopperUtils['rescheduleContact']({'active':![],'ContactId':_0x2cfc8c[_0x7228('0x23')][_0x24d0f6][_0x7228('0xdf')],'ListId':_0x2cfc8c['actions'][_0x24d0f6][_0x7228('0xe0')],'VoiceQueueId':_0x2cfc8c['actions'][_0x24d0f6]['VoiceQueueId']||undefined,'CampaignId':_0x2cfc8c[_0x7228('0x23')][_0x24d0f6]['CampaignId']||undefined})[_0x7228('0xa0')](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x2cfc8c['actions'][_0x24d0f6];}}else{return _0x2cfc8c[_0x7228('0x150')](_0x3ff40e,_0xe1f46c);}}else{if(utils[_0x7228('0xd0')](undefined,_0xe1f46c[_0x7228('0x1e7')])<_0x3ff40e['dialRecallMeTimeout']*0x3c){if(_0xe1f46c['Agent']&&!_0xe1f46c[_0x7228('0x141')][_0x7228('0x1e8')]){_0x2cfc8c[_0x7228('0x1c')][_0x7228('0x102')](_0xe1f46c['id'])[_0x7228('0x1a')](function(){_0x2cfc8c[_0x7228('0xc4')](_0x3ff40e);});}else{hopperUtils[_0x7228('0x1e9')]({'active':![]},_0xe1f46c['id'],0x1)[_0x7228('0x1a')](function(){_0x2cfc8c[_0x7228('0xc4')](_0x3ff40e);});}}else{_0x3ff40e['outboundReCallsDay']+=0x1;_0x2cfc8c[_0x7228('0xc4')](_0x3ff40e);if(_0x3ff40e[_0x7228('0x1ea')]){hopperUtils['rescheduleContact']({'active':![],'recallme':![],'UserId':null,'ContactId':_0xe1f46c[_0x7228('0xdf')],'ListId':_0xe1f46c[_0x7228('0xe0')],'VoiceQueueId':_0xe1f46c['VoiceQueueId']||undefined,'CampaignId':_0xe1f46c[_0x7228('0xe2')]||undefined})['catch'](loggerCatch(_0x7228('0x1eb')));hopperUtils[_0x7228('0xf0')](createObjHistory(_0x3ff40e,_0xe1f46c,utils[_0x7228('0x6d')][_0x7228('0x1ec')],0x17,'RecallInQueue'))[_0x7228('0xa0')](loggerCatch('[Originate][HistoryDialRecallInQueue][historyCatch]'));}else{_0x2cfc8c['saveInDb'](createObjHistory(_0x3ff40e,_0xe1f46c,utils[_0x7228('0x6d')][_0x7228('0x1ed')],0x16,'RecallFailedTimeout'),_0x7228('0x1ee'),_0x7228('0x1ef'));}}}}else{_0x3ff40e[_0x7228('0x1f0')]+=0x1;_0x2cfc8c[_0x7228('0x118')](createObjHistory(_0x3ff40e,_0xe1f46c,utils['CAMPAIGN_STATUS'][_0x7228('0x1f1')],0xd,_0x7228('0x1f2')),_0x7228('0x1f3'),'[Originate][MoveBlacklist]');throw _0x7228('0x1f4');}};};Dialer[_0x7228('0x18')][_0x7228('0x14f')]=function(_0x288c7a){var _0x3c20e6=this;var _0x45624c=_0x288c7a[_0x7228('0x1f5')]-_0x288c7a['originated'];emitCampaignSummary(_0x288c7a);if(_0x45624c>0x0&&_0x288c7a[_0x7228('0x1f6')]==0x0){if(_0x45624c>this['maxNumberOriginate']){_0x45624c=this['maxNumberOriginate'];}_0x288c7a['temp']=0x1;hopperUtils[_0x7228('0x1f7')](_0x288c7a,_0x45624c)[_0x7228('0x3f')](function(_0x5f4266){_0x288c7a[_0x7228('0x1f6')]=0x0;if(_0x5f4266){if(!utils[_0x7228('0x1f8')](_0x5f4266)){_0x288c7a[_0x7228('0x6c')]=utils[_0x7228('0x6d')][_0x7228('0x1f9')];logger['info'](_0x7228('0x1fa')+_0x288c7a[_0x7228('0x47')]);}else{_0x288c7a['originated']+=_0x5f4266[_0x7228('0x97')];_0x288c7a['message']=utils[_0x7228('0x6d')][_0x7228('0x1fb')];for(var _0x596db=0x0;_0x596db<_0x5f4266[_0x7228('0x97')];_0x596db+=0x1){_0x288c7a['ivrTotalCallsDays']+=0x1;if(_['isNil'](_0x5f4266[_0x596db])||_[_0x7228('0xf7')](_0x5f4266[_0x596db][_0x7228('0x16b')])||_['isNil'](_0x5f4266[_0x596db][_0x7228('0x154')])){_0x3c20e6[_0x7228('0x14c')](_0x7228('0x1fc'),_0x288c7a,_0x5f4266[_0x596db]);}else{hopperUtils[_0x7228('0x1fd')](_['pick'](_0x5f4266[_0x596db],[_0x7228('0xe2'),'phone']))[_0x7228('0x3f')](_0x3c20e6[_0x7228('0x1df')](_0x288c7a,_0x5f4266[_0x596db]))[_0x7228('0xa0')](_0x3c20e6[_0x7228('0x14b')](_0x7228('0x1fe'),_0x288c7a));}}}}})['catch'](loggerGetContactDialer(_0x7228('0x1ff'),_0x288c7a,_0x45624c));}};Dialer[_0x7228('0x18')][_0x7228('0xb5')]=function(_0x44b408,_0x3ec289){var _0x26ad99=this;var _0x4191e5=[];if(_0x3ec289<0x1||_0x44b408[_0x7228('0xb2')]==='booked'){_0x3ec289=0x1;}var _0x494d6c=Math[_0x7228('0x1ba')](_0x44b408[_0x7228('0x137')]*_0x3ec289)-_0x44b408[_0x7228('0x80')];if(_0x44b408['dialLimitQueue']>0x0){var _0x5bfabe=_0x44b408['dialLimitQueue']-_0x44b408[_0x7228('0x80')]-_0x44b408['talking']-_0x44b408[_0x7228('0x138')];if(_0x494d6c>_0x5bfabe){_0x494d6c=_0x5bfabe;}}if(_0x494d6c>0x0&&_0x44b408[_0x7228('0x1f6')]==0x0){if(_0x44b408[_0x7228('0xb2')]===_0x7228('0x8')){_0x494d6c=0x1;}if(_0x494d6c>this[_0x7228('0x21')]){_0x494d6c=this[_0x7228('0x21')];}for(var _0x33c25a in this['agents']){if(typeof this[_0x7228('0x1f')][_0x33c25a]!==_0x7228('0xab')){if(this[_0x7228('0x1f')][_0x33c25a]['state']===_0x7228('0x200')&&this[_0x7228('0x1f')][_0x33c25a]['status']===_0x7228('0x89')){_0x4191e5[_0x7228('0x98')](this['agents'][_0x33c25a]['id']);}}}_0x44b408[_0x7228('0x1f6')]=0x1;hopperUtils[_0x7228('0x201')](_0x44b408,_0x4191e5,_0x494d6c)['then'](function(_0x16ac04){_0x44b408[_0x7228('0x1f6')]=0x0;if(_0x16ac04){if(!utils[_0x7228('0x1f8')](_0x16ac04)){hopperUtils[_0x7228('0x202')](_0x44b408)[_0x7228('0x3f')](sendMessageReschedule(_0x44b408))[_0x7228('0xa0')](loggerCatch('[countReScheduled]\x20'));}else{_0x44b408[_0x7228('0x80')]+=_0x16ac04[_0x7228('0x97')];_0x44b408['message']=_0x44b408[_0x7228('0xb2')]==='booked'?utils[_0x7228('0x6d')][_0x7228('0x15c')]:utils['CAMPAIGN_STATUS'][_0x7228('0x1fb')];for(var _0x25936a=0x0;_0x25936a<_0x16ac04[_0x7228('0x97')];_0x25936a+=0x1){if(_[_0x7228('0xf7')](_0x16ac04[_0x25936a])||_[_0x7228('0xf7')](_0x16ac04[_0x25936a][_0x7228('0x16b')])||_[_0x7228('0xf7')](_0x16ac04[_0x25936a]['phone'])){_0x26ad99['emptyContact']('[actionOriginate]\x20',_0x44b408,_0x16ac04[_0x25936a]);}else{hopperUtils[_0x7228('0x203')](_[_0x7228('0x76')](_0x16ac04[_0x25936a],[_0x7228('0xe1'),'phone']))['then'](_0x26ad99['checkContactBlack'](_0x44b408,_0x16ac04[_0x25936a]))[_0x7228('0xa0')](_0x26ad99[_0x7228('0x14b')](_0x7228('0x1fc'),_0x44b408));}}}}})['catch'](loggerGetContactDialer(_0x7228('0x204'),_0x44b408,_0x494d6c));}};Dialer[_0x7228('0x18')]['handlePredictive']=function(_0x3d5c34){if(_0x3d5c34[_0x7228('0x205')]>0x0){var _0x15c225=_0x3d5c34[_0x7228('0x205')]-_0x3d5c34[_0x7228('0x80')]-_0x3d5c34[_0x7228('0x206')];if(_0x15c225>0x0&&_0x3d5c34['temp']==0x0){this[_0x7228('0x207')](_0x3d5c34);}else{loggerPredictiveCalls[_0x7228('0x49')](_0x7228('0x208'));}}else{this[_0x7228('0x207')](_0x3d5c34);}};Dialer[_0x7228('0x18')][_0x7228('0x207')]=function(_0x33e09b){var _0x100389=this;var _0x4c339b=[];_0x33e09b['originated']+=0x1;for(var _0x23cffb in this[_0x7228('0x1f')]){if(typeof this[_0x7228('0x1f')][_0x23cffb]!==_0x7228('0xab')){if(this[_0x7228('0x1f')][_0x23cffb]['state']===_0x7228('0x200')&&this[_0x7228('0x1f')][_0x23cffb][_0x7228('0x88')]==='reachable'){_0x4c339b[_0x7228('0x98')](this['agents'][_0x23cffb]['id']);}}}_0x33e09b['temp']=0x1;return this[_0x7228('0x201')](_0x33e09b['id'],_0x4c339b,0x1,_0x33e09b[_0x7228('0x209')],_0x33e09b)[_0x7228('0x3f')](function(_0x1eb5f0){_0x33e09b[_0x7228('0x1f6')]=0x1;if(_0x1eb5f0){if(!utils['checkContactEmpty'](_0x1eb5f0)){utils['checkContactLowerLimitOriginate'](_0x33e09b,0x1,0x0);return hopperUtils[_0x7228('0x202')](_0x33e09b)[_0x7228('0x3f')](sendMessageReschedule(_0x33e09b))['catch'](loggerCatch(_0x7228('0x20a')));}else{_0x33e09b[_0x7228('0x6c')]=utils[_0x7228('0x6d')][_0x7228('0x1fb')];if(_[_0x7228('0xf7')](_0x1eb5f0[0x0])||_[_0x7228('0xf7')](_0x1eb5f0[0x0][_0x7228('0x16b')])||_[_0x7228('0xf7')](_0x1eb5f0[0x0]['phone'])){_0x100389[_0x7228('0x14c')]('[actionOriginate]\x20',_0x33e09b,_0x1eb5f0[0x0]);}else{return hopperUtils[_0x7228('0x203')](_['pick'](_0x1eb5f0[0x0],['VoiceQueueId','phone']))[_0x7228('0x3f')](_0x100389[_0x7228('0x1df')](_0x33e09b,_0x1eb5f0[0x0]))[_0x7228('0xa0')](_0x100389[_0x7228('0x14b')](_0x7228('0x20b'),_0x33e09b));}}}})['catch'](loggerGetContactDialer('[getContactDialerPredictive]',_0x33e09b,0x1));};Dialer['prototype'][_0x7228('0x1d1')]=function(_0xc6b2e3,_0x19a477,_0x3567b2,_0x2f0ced,_0x5d1203,_0x19f1da){loggerPredictive[_0x7228('0x49')](_0x7228('0x20c'));loggerPredictive[_0x7228('0x49')](_0x7228('0x20d'),_0xc6b2e3);loggerPredictive['info']('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x19a477);loggerPredictive[_0x7228('0x49')]('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',_0x3567b2);loggerPredictive[_0x7228('0x49')]('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',_0x2f0ced);loggerPredictive['info'](_0x7228('0x20e'),_0x5d1203);loggerPredictive[_0x7228('0x49')](_0x7228('0x54'));return new Promise(function(_0x3fb0a2,_0x412b2c){if(_0xc6b2e3<=0x0||isNaN(_0xc6b2e3)){return _0x412b2c(msgResponse(_0x7228('0x20f'),'Error',_0x7228('0x210')+_0xc6b2e3));}if(_0x3567b2<=0x0||isNaN(_0x3567b2)){return _0x412b2c(msgResponse(_0x7228('0x20f'),_0x7228('0x85'),'Ts\x20=\x20'+_0x3567b2));}if(_0x2f0ced<=0x0||isNaN(_0x2f0ced)){return _0x412b2c(msgResponse(_0x7228('0x20f'),_0x7228('0x85'),_0x7228('0x211')+_0x2f0ced));}if(_0x19a477<=0x0||isNaN(_0x19a477)){return _0x412b2c(msgResponse('[abandonmentRate]',_0x7228('0x85'),_0x7228('0x212')+_0x19a477));}if(_0x5d1203<=0x0||isNaN(_0x5d1203)){return _0x412b2c(msgResponse(_0x7228('0x20f'),_0x7228('0x85'),_0x7228('0x213')+_0x5d1203));}_0x19f1da=_0x19f1da||0x0;var _0x4b59b6=0x1/_0x3567b2;var _0x43dce8=0x0;var _0x6074c5=0x0;var _0x3f23b4=0x0;var _0x3a78c8=0x0;for(var _0x405d56=0x0;_0x3f23b4<_0x5d1203;_0x405d56+=0x1){_0x6074c5=_0x405d56/_0x19a477;_0x43dce8=(_0x2f0ced*_0x6074c5+_0x19f1da)/_0x4b59b6;_0x3f23b4=utils['erlangb'](_0x43dce8,_0xc6b2e3);_0x3a78c8=_0x43dce8/_0xc6b2e3*(0x1-utils[_0x7228('0x214')](_0x43dce8,_0xc6b2e3));}return _0x3fb0a2({'erlangCalls':_0x405d56,'erlangCallToSecond':_0x19a477/_0x405d56,'erlangAbandonmentRate':_0x3f23b4,'erlangBusyFactor':_0x3a78c8});});};Dialer['prototype'][_0x7228('0x1d2')]=function(_0x4ac581,_0x1dbf2f,_0x4f71c0,_0x4a7ad0,_0x2ba57c,_0x2d1dd8){loggerPredictive[_0x7228('0x49')](_0x7228('0x215'));loggerPredictive[_0x7228('0x49')](_0x7228('0x20d'),_0x4ac581);loggerPredictive['info'](_0x7228('0x216'),_0x1dbf2f);loggerPredictive['info'](_0x7228('0x217'),_0x4f71c0);loggerPredictive['info'](_0x7228('0x218'),_0x4a7ad0);loggerPredictive[_0x7228('0x49')](_0x7228('0x219'),_0x2ba57c);loggerPredictive[_0x7228('0x49')](_0x7228('0x54'));return new Promise(function(_0x346717,_0x365d83){if(_0x4ac581<=0x0||isNaN(_0x4ac581)){return _0x365d83(msgResponse(_0x7228('0x21a'),_0x7228('0x85'),_0x7228('0x210')+_0x4ac581));}if(_0x4f71c0<=0x0||isNaN(_0x4f71c0)){return _0x365d83(msgResponse(_0x7228('0x21a'),_0x7228('0x85'),_0x7228('0x21b')+_0x4f71c0));}if(_0x4a7ad0<=0x0||isNaN(_0x4a7ad0)){return _0x365d83(msgResponse(_0x7228('0x21a'),_0x7228('0x85'),_0x7228('0x211')+_0x4a7ad0));}if(_0x1dbf2f<=0x0||isNaN(_0x1dbf2f)){return _0x365d83(msgResponse('[busyFactor]',_0x7228('0x85'),_0x7228('0x212')+_0x1dbf2f));}if(_0x2ba57c<=0x0||isNaN(_0x2ba57c)){return _0x365d83(msgResponse(_0x7228('0x21a'),_0x7228('0x85'),_0x7228('0x21c')+_0x2ba57c));}_0x2d1dd8=_0x2d1dd8||0x0;var _0x1f0527=0x1/_0x4f71c0;var _0x447dbe=0x0;var _0x2cd02b=0x0;var _0x3c140c=0x0;var _0xbd61ad=0x0;for(var _0x4f4e0a=0x0;_0xbd61ad<_0x2ba57c;_0x4f4e0a+=0x1){_0x2cd02b=_0x4f4e0a/_0x1dbf2f;_0x447dbe=(_0x4a7ad0*_0x2cd02b+_0x2d1dd8)/_0x1f0527;_0x3c140c=utils[_0x7228('0x214')](_0x447dbe,_0x4ac581);_0xbd61ad=_0x447dbe/_0x4ac581*(0x1-utils[_0x7228('0x214')](_0x447dbe,_0x4ac581));}return _0x346717({'erlangCalls':_0x4f4e0a,'erlangCallToSecond':_0x1dbf2f/_0x4f4e0a,'erlangAbandonmentRate':_0x3c140c,'erlangBusyFactor':_0xbd61ad});});};module[_0x7228('0x21d')]=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 72e6c4f..8e21767 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 _0x7f1a=['phone','lastName','number','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countnoanswerretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','idHopper','ContactFirstName','firstName','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridname','getCaller','\x22%s\x22\x20<%s>','voiceQueue','dialCutDigit','substring','prototype','util','lodash','moment','isNil','string','uniqueid','name','Contact'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x7f1a,0xa0));var _0xa7f1=function(_0x3ac5cd,_0x29e153){_0x3ac5cd=_0x3ac5cd-0x0;var _0x9facf3=_0x7f1a[_0x3ac5cd];return _0x9facf3;};'use strict';var util=require(_0xa7f1('0x0'));var _=require(_0xa7f1('0x1'));var moment=require(_0xa7f1('0x2'));function checkNameSurname(_0x37bc3c,_0xac4a48,_0x16de2b){var _0x2785eb='';if(!_[_0xa7f1('0x3')](_0xac4a48)&&_0xa7f1('0x4')===typeof _0xac4a48){_0x2785eb+=_0xac4a48;}if(!_[_0xa7f1('0x3')](_0x16de2b)&&'string'===typeof _0x16de2b){_0x2785eb+='\x20'+_0x16de2b;}if(_0x2785eb!==''){return _0x2785eb;}return _0x37bc3c;}function Action(_0xb154c7,_0x599844,_0x391940){this['voiceQueue']=_0xb154c7;this[_0xa7f1('0x5')]=_0x391940||undefined;this[_0xa7f1('0x6')]=checkNameSurname(_0x599844[_0xa7f1('0x7')][_0xa7f1('0x8')],_0x599844[_0xa7f1('0x7')]['firstName'],_0x599844[_0xa7f1('0x7')][_0xa7f1('0x9')]);this[_0xa7f1('0xa')]=_0x599844[_0xa7f1('0x8')];this[_0xa7f1('0xb')]=_0xb154c7[_0xa7f1('0x6')];this[_0xa7f1('0xc')]=_0x599844[_0xa7f1('0xc')]||![];this[_0xa7f1('0xd')]=_0xb154c7[_0xa7f1('0xd')];this[_0xa7f1('0xe')]=_0xb154c7[_0xa7f1('0xe')]||0x3;this[_0xa7f1('0xf')]=_0x599844['scheduledat'];this[_0xa7f1('0x10')]=_0x599844[_0xa7f1('0x10')];this['countcongestionretry']=_0x599844['countcongestionretry'];this[_0xa7f1('0x11')]=_0x599844[_0xa7f1('0x11')];this['countnosuchnumberretry']=_0x599844['countnosuchnumberretry'];this[_0xa7f1('0x12')]=_0x599844[_0xa7f1('0x12')];this[_0xa7f1('0x13')]=_0x599844[_0xa7f1('0x13')];this[_0xa7f1('0x14')]=_0x599844['countmachineretry'];this['countagentrejectretry']=_0x599844[_0xa7f1('0x15')];this[_0xa7f1('0x16')]=_0x599844['ContactId'];this[_0xa7f1('0x17')]=_0x599844[_0xa7f1('0x17')];this[_0xa7f1('0x18')]=_0x599844[_0xa7f1('0x18')];this[_0xa7f1('0x19')]=_0x599844[_0xa7f1('0x19')];this['CampaignId']=_0x599844['CampaignId'];this[_0xa7f1('0x1a')]=_0x599844['id'];this[_0xa7f1('0x1b')]=_0x599844[_0xa7f1('0x7')][_0xa7f1('0x1c')]||'';this['starttime']=moment()[_0xa7f1('0x1d')](_0xa7f1('0x1e'));this[_0xa7f1('0x1f')]=_0x599844['callback'];this[_0xa7f1('0x20')]=_0x599844[_0xa7f1('0x20')];this[_0xa7f1('0x21')]=_0x599844[_0xa7f1('0x21')];this[_0xa7f1('0x22')]=_0x599844[_0xa7f1('0x22')];this['originatecalleridnum']='';this[_0xa7f1('0x23')]='';}Action['prototype'][_0xa7f1('0x24')]=function(){return util[_0xa7f1('0x1d')](_0xa7f1('0x25'),this[_0xa7f1('0x6')],this[_0xa7f1('0x26')][_0xa7f1('0x27')]>0x0?this[_0xa7f1('0xa')][_0xa7f1('0x28')](this[_0xa7f1('0x26')]['dialCutDigit']):this[_0xa7f1('0xa')]);};Action[_0xa7f1('0x29')]['getQueue']=function(){return this[_0xa7f1('0xb')];};module['exports']=Action; \ No newline at end of file +var _0xcc9a=['lastName','number','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','prototype','getCaller','\x22%s\x22\x20<%s>','dialCutDigit','getQueue','queue','exports','util','isNil','string','voiceQueue','name','Contact','phone','firstName'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xcc9a,0x125));var _0xacc9=function(_0x247735,_0x56a341){_0x247735=_0x247735-0x0;var _0x2bf674=_0xcc9a[_0x247735];return _0x2bf674;};'use strict';var util=require(_0xacc9('0x0'));var _=require('lodash');var moment=require('moment');function checkNameSurname(_0x527e30,_0x3cc203,_0x466316){var _0x2bb9d1='';if(!_[_0xacc9('0x1')](_0x3cc203)&&'string'===typeof _0x3cc203){_0x2bb9d1+=_0x3cc203;}if(!_[_0xacc9('0x1')](_0x466316)&&_0xacc9('0x2')===typeof _0x466316){_0x2bb9d1+='\x20'+_0x466316;}if(_0x2bb9d1!==''){return _0x2bb9d1;}return _0x527e30;}function Action(_0x4db20c,_0x3c475f,_0x1d10bb){this[_0xacc9('0x3')]=_0x4db20c;this['uniqueid']=_0x1d10bb||undefined;this[_0xacc9('0x4')]=checkNameSurname(_0x3c475f[_0xacc9('0x5')][_0xacc9('0x6')],_0x3c475f['Contact'][_0xacc9('0x7')],_0x3c475f['Contact'][_0xacc9('0x8')]);this[_0xacc9('0x9')]=_0x3c475f[_0xacc9('0x6')];this['queue']=_0x4db20c[_0xacc9('0x4')];this[_0xacc9('0xa')]=_0x3c475f[_0xacc9('0xa')]||![];this[_0xacc9('0xb')]=_0x4db20c['type'];this[_0xacc9('0xc')]=_0x4db20c[_0xacc9('0xc')]||0x3;this[_0xacc9('0xd')]=_0x3c475f['scheduledat'];this[_0xacc9('0xe')]=_0x3c475f[_0xacc9('0xe')];this[_0xacc9('0xf')]=_0x3c475f[_0xacc9('0xf')];this[_0xacc9('0x10')]=_0x3c475f[_0xacc9('0x10')];this[_0xacc9('0x11')]=_0x3c475f['countnosuchnumberretry'];this[_0xacc9('0x12')]=_0x3c475f[_0xacc9('0x12')];this[_0xacc9('0x13')]=_0x3c475f[_0xacc9('0x13')];this[_0xacc9('0x14')]=_0x3c475f[_0xacc9('0x14')];this[_0xacc9('0x15')]=_0x3c475f['countagentrejectretry'];this[_0xacc9('0x16')]=_0x3c475f[_0xacc9('0x16')];this[_0xacc9('0x17')]=_0x3c475f[_0xacc9('0x17')];this[_0xacc9('0x18')]=_0x3c475f[_0xacc9('0x18')];this['VoiceQueueId']=_0x3c475f[_0xacc9('0x19')];this['CampaignId']=_0x3c475f[_0xacc9('0x1a')];this[_0xacc9('0x1b')]=_0x3c475f['id'];this['ContactFirstName']=_0x3c475f[_0xacc9('0x5')][_0xacc9('0x7')]||'';this[_0xacc9('0x1c')]=moment()[_0xacc9('0x1d')](_0xacc9('0x1e'));this['callback']=_0x3c475f[_0xacc9('0x1f')];this['callbackuniqueid']=_0x3c475f[_0xacc9('0x20')];this[_0xacc9('0x21')]=_0x3c475f[_0xacc9('0x21')];this[_0xacc9('0x22')]=_0x3c475f[_0xacc9('0x22')];this[_0xacc9('0x23')]='';this['originatecalleridname']='';}Action[_0xacc9('0x24')][_0xacc9('0x25')]=function(){return util[_0xacc9('0x1d')](_0xacc9('0x26'),this[_0xacc9('0x4')],this[_0xacc9('0x3')][_0xacc9('0x27')]>0x0?this[_0xacc9('0x9')]['substring'](this[_0xacc9('0x3')][_0xacc9('0x27')]):this[_0xacc9('0x9')]);};Action[_0xacc9('0x24')][_0xacc9('0x28')]=function(){return this[_0xacc9('0x29')];};module[_0xacc9('0x2a')]=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 398953d..b37b7ae 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 _0x8521=['YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','holdtime','endtime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','exports','moment','state','statedesc','Answer','scheduledat','type','campaigntype','queue','countbusyretry','countnoanswerretry','countglobal','countcongestionretry','countnosuchnumberretry','countmachineretry','countagentrejectretry','countdropretry','countabandonedretry','uniqueid','name','calleridnum','starttime','responsetime','answertime'];(function(_0x12d8bf,_0x4dcb11){var _0x2d12dd=function(_0x3a4ad0){while(--_0x3a4ad0){_0x12d8bf['push'](_0x12d8bf['shift']());}};_0x2d12dd(++_0x4dcb11);}(_0x8521,0x197));var _0x1852=function(_0x22f115,_0x4edea2){_0x22f115=_0x22f115-0x0;var _0x241954=_0x8521[_0x22f115];return _0x241954;};'use strict';var moment=require(_0x1852('0x0'));var utils=require('../utils');function AgentComplete(_0x59a508,_0x1ce861){this[_0x1852('0x1')]=0x4;this[_0x1852('0x2')]=_0x1852('0x3');this[_0x1852('0x4')]=_0x59a508['scheduledat'];this[_0x1852('0x5')]=_0x59a508[_0x1852('0x5')];this[_0x1852('0x6')]=_0x59a508[_0x1852('0x5')]==='outbound'?_0x1852('0x7'):_0x59a508[_0x1852('0x5')];this[_0x1852('0x8')]=_0x59a508[_0x1852('0x8')];this['countcongestionretry']=_0x59a508['countcongestionretry'];this[_0x1852('0x9')]=_0x59a508[_0x1852('0x9')];this[_0x1852('0xa')]=_0x59a508[_0x1852('0x8')]+_0x59a508[_0x1852('0xb')]+_0x59a508[_0x1852('0x9')]+_0x59a508[_0x1852('0xc')]+_0x59a508['countdropretry']+_0x59a508['countabandonedretry']+_0x59a508[_0x1852('0xd')]+_0x59a508[_0x1852('0xe')];this['countnosuchnumberretry']=_0x59a508[_0x1852('0xc')];this[_0x1852('0xf')]=_0x59a508[_0x1852('0xf')];this[_0x1852('0x10')]=_0x59a508[_0x1852('0x10')];this['countmachineretry']=_0x59a508['countmachineretry'];this[_0x1852('0xe')]=_0x59a508[_0x1852('0xe')];this['uniqueid']=_0x1ce861[_0x1852('0x11')];this['calleridname']=_0x59a508[_0x1852('0x12')];this[_0x1852('0x13')]=_0x59a508['number'];this[_0x1852('0x14')]=_0x59a508[_0x1852('0x14')];this[_0x1852('0x15')]=_0x59a508[_0x1852('0x15')];this['answertime']=_0x59a508[_0x1852('0x16')];this['endtime']=moment()['format'](_0x1852('0x17'));this[_0x1852('0x18')]=utils[_0x1852('0x19')](_0x59a508[_0x1852('0x15')],_0x59a508[_0x1852('0x14')]);this[_0x1852('0x1a')]=utils['getSeconds'](_0x59a508[_0x1852('0x16')],_0x59a508['responsetime']);this['talktime']=utils[_0x1852('0x19')](this[_0x1852('0x1b')],_0x59a508[_0x1852('0x16')]);this[_0x1852('0x7')]=_0x1ce861[_0x1852('0x7')];this[_0x1852('0x1c')]=_0x1ce861['membername'];this['reason']=_0x1ce861[_0x1852('0x1d')];this['callback']=_0x59a508[_0x1852('0x1e')];this[_0x1852('0x1f')]=_0x59a508[_0x1852('0x1f')];this[_0x1852('0x20')]=_0x59a508[_0x1852('0x20')];this['recallme']=_0x59a508[_0x1852('0x21')];this[_0x1852('0x22')]=_0x59a508[_0x1852('0x22')];this[_0x1852('0x23')]=_0x59a508[_0x1852('0x23')];this[_0x1852('0x24')]=_0x59a508[_0x1852('0x24')];this['VoiceQueueId']=_0x59a508[_0x1852('0x25')];this['CampaignId']=_0x59a508[_0x1852('0x26')];this[_0x1852('0x27')]=_0x59a508['originatecalleridnum']||'';this[_0x1852('0x28')]=_0x59a508['originatecalleridname']||'';this['agiafterat']=_0x59a508[_0x1852('0x29')];}module[_0x1852('0x2a')]=AgentComplete; \ No newline at end of file +var _0x2071=['countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridnum','number','starttime','responsetime','answertime','endtime','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','getSeconds','talktime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','exports','moment','state','Answer','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry'];(function(_0x3c12af,_0x37ca6b){var _0x5a7121=function(_0xcaea57){while(--_0xcaea57){_0x3c12af['push'](_0x3c12af['shift']());}};_0x5a7121(++_0x37ca6b);}(_0x2071,0xa2));var _0x1207=function(_0x34a6e9,_0x25cabe){_0x34a6e9=_0x34a6e9-0x0;var _0x11015c=_0x2071[_0x34a6e9];return _0x11015c;};'use strict';var moment=require(_0x1207('0x0'));var utils=require('../utils');function AgentComplete(_0xcbfcd,_0x351248){this[_0x1207('0x1')]=0x4;this['statedesc']=_0x1207('0x2');this[_0x1207('0x3')]=_0xcbfcd[_0x1207('0x3')];this[_0x1207('0x4')]=_0xcbfcd['type'];this['campaigntype']=_0xcbfcd[_0x1207('0x4')]===_0x1207('0x5')?_0x1207('0x6'):_0xcbfcd[_0x1207('0x4')];this[_0x1207('0x7')]=_0xcbfcd[_0x1207('0x7')];this[_0x1207('0x8')]=_0xcbfcd[_0x1207('0x8')];this[_0x1207('0x9')]=_0xcbfcd[_0x1207('0x9')];this[_0x1207('0xa')]=_0xcbfcd[_0x1207('0x7')]+_0xcbfcd['countcongestionretry']+_0xcbfcd[_0x1207('0x9')]+_0xcbfcd[_0x1207('0xb')]+_0xcbfcd[_0x1207('0xc')]+_0xcbfcd['countabandonedretry']+_0xcbfcd['countmachineretry']+_0xcbfcd['countagentrejectretry'];this[_0x1207('0xb')]=_0xcbfcd['countnosuchnumberretry'];this[_0x1207('0xc')]=_0xcbfcd[_0x1207('0xc')];this[_0x1207('0xd')]=_0xcbfcd[_0x1207('0xd')];this[_0x1207('0xe')]=_0xcbfcd[_0x1207('0xe')];this[_0x1207('0xf')]=_0xcbfcd[_0x1207('0xf')];this[_0x1207('0x10')]=_0x351248[_0x1207('0x10')];this['calleridname']=_0xcbfcd['name'];this[_0x1207('0x11')]=_0xcbfcd[_0x1207('0x12')];this['starttime']=_0xcbfcd[_0x1207('0x13')];this[_0x1207('0x14')]=_0xcbfcd['responsetime'];this[_0x1207('0x15')]=_0xcbfcd[_0x1207('0x15')];this[_0x1207('0x16')]=moment()['format'](_0x1207('0x17'));this[_0x1207('0x18')]=utils['getSeconds'](_0xcbfcd['responsetime'],_0xcbfcd[_0x1207('0x13')]);this[_0x1207('0x19')]=utils[_0x1207('0x1a')](_0xcbfcd[_0x1207('0x15')],_0xcbfcd[_0x1207('0x14')]);this[_0x1207('0x1b')]=utils[_0x1207('0x1a')](this[_0x1207('0x16')],_0xcbfcd['answertime']);this[_0x1207('0x6')]=_0x351248[_0x1207('0x6')];this[_0x1207('0x1c')]=_0x351248[_0x1207('0x1c')];this[_0x1207('0x1d')]=_0x351248[_0x1207('0x1d')];this[_0x1207('0x1e')]=_0xcbfcd[_0x1207('0x1e')];this[_0x1207('0x1f')]=_0xcbfcd[_0x1207('0x1f')];this[_0x1207('0x20')]=_0xcbfcd[_0x1207('0x20')];this[_0x1207('0x21')]=_0xcbfcd['recallme'];this[_0x1207('0x22')]=_0xcbfcd[_0x1207('0x22')];this['ListId']=_0xcbfcd[_0x1207('0x23')];this['UserId']=_0xcbfcd[_0x1207('0x24')];this[_0x1207('0x25')]=_0xcbfcd['VoiceQueueId'];this[_0x1207('0x26')]=_0xcbfcd[_0x1207('0x26')];this[_0x1207('0x27')]=_0xcbfcd[_0x1207('0x27')]||'';this['originatecalleridname']=_0xcbfcd[_0x1207('0x28')]||'';this['agiafterat']=_0xcbfcd[_0x1207('0x29')];}module[_0x1207('0x2a')]=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 193e231..d69f1d4 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 _0x5a45=['exports','uniqueid','scheduledat','type','campaigntype','queue','countbusyretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','calleridnum','starttime','responsetime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc'];(function(_0x49c3b1,_0x15b955){var _0x5e2760=function(_0x3c0266){while(--_0x3c0266){_0x49c3b1['push'](_0x49c3b1['shift']());}};_0x5e2760(++_0x15b955);}(_0x5a45,0x111));var _0x55a4=function(_0x5ded81,_0x5d770d){_0x5ded81=_0x5ded81-0x0;var _0x3e99ab=_0x5a45[_0x5ded81];return _0x3e99ab;};'use strict';function Final(_0x499049){this['uniqueid']=_0x499049[_0x55a4('0x0')];this[_0x55a4('0x1')]=_0x499049[_0x55a4('0x1')];this[_0x55a4('0x2')]=_0x499049[_0x55a4('0x2')];this[_0x55a4('0x3')]=_0x499049[_0x55a4('0x2')]==='outbound'?_0x55a4('0x4'):_0x499049[_0x55a4('0x2')];this[_0x55a4('0x5')]=_0x499049[_0x55a4('0x5')];this['countcongestionretry']=_0x499049['countcongestionretry'];this[_0x55a4('0x6')]=_0x499049[_0x55a4('0x6')];this[_0x55a4('0x7')]=_0x499049['countbusyretry']+_0x499049['countcongestionretry']+_0x499049[_0x55a4('0x6')]+_0x499049[_0x55a4('0x8')]+_0x499049[_0x55a4('0x9')]+_0x499049[_0x55a4('0xa')]+_0x499049['countmachineretry']+_0x499049['countagentrejectretry'];this['countnosuchnumberretry']=_0x499049[_0x55a4('0x8')];this[_0x55a4('0x9')]=_0x499049[_0x55a4('0x9')];this[_0x55a4('0xa')]=_0x499049[_0x55a4('0xa')];this[_0x55a4('0xb')]=_0x499049[_0x55a4('0xb')];this[_0x55a4('0xc')]=_0x499049[_0x55a4('0xc')];this[_0x55a4('0x4')]=_0x499049[_0x55a4('0x4')];this[_0x55a4('0xd')]=_0x499049[_0x55a4('0xd')];this[_0x55a4('0xe')]=_0x499049['calleridnum'];this[_0x55a4('0xf')]=_0x499049[_0x55a4('0xf')];this[_0x55a4('0x10')]=_0x499049[_0x55a4('0x10')];this['endtime']=_0x499049['responsetime'];this[_0x55a4('0x11')]=_0x499049[_0x55a4('0x11')]||0x0;this['holdtime']=_0x499049[_0x55a4('0x12')]||0x0;this['talktime']=_0x499049[_0x55a4('0x13')]||0x0;this[_0x55a4('0x14')]=_0x499049[_0x55a4('0x14')];this[_0x55a4('0x15')]=_0x499049[_0x55a4('0x15')];this[_0x55a4('0x16')]=_0x499049[_0x55a4('0x16')];this[_0x55a4('0x17')]=_0x499049[_0x55a4('0x17')];this['ContactId']=_0x499049[_0x55a4('0x18')];this[_0x55a4('0x19')]=_0x499049[_0x55a4('0x19')];this[_0x55a4('0x1a')]=_0x499049['UserId'];this['VoiceQueueId']=_0x499049[_0x55a4('0x1b')];this[_0x55a4('0x1c')]=_0x499049['CampaignId'];this[_0x55a4('0x1d')]=_0x499049[_0x55a4('0x1d')]||'';this[_0x55a4('0x1e')]=_0x499049[_0x55a4('0x1e')]||'';this[_0x55a4('0x1f')]=_0x499049[_0x55a4('0x1f')];this['statedesc']=_0x499049[_0x55a4('0x20')];}module[_0x55a4('0x21')]=Final; \ No newline at end of file +var _0x8a93=['holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countabandonedretry','countagentrejectretry','countnosuchnumberretry','countdropretry','countmachineretry','calleridname','calleridnum','starttime','responsetime','ringtime'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x8a93,0x1d6));var _0x38a9=function(_0x4de958,_0x5b760e){_0x4de958=_0x4de958-0x0;var _0x6c13ff=_0x8a93[_0x4de958];return _0x6c13ff;};'use strict';function Final(_0x2b8945){this['uniqueid']=_0x2b8945[_0x38a9('0x0')];this[_0x38a9('0x1')]=_0x2b8945[_0x38a9('0x1')];this['type']=_0x2b8945[_0x38a9('0x2')];this[_0x38a9('0x3')]=_0x2b8945['type']===_0x38a9('0x4')?_0x38a9('0x5'):_0x2b8945[_0x38a9('0x2')];this[_0x38a9('0x6')]=_0x2b8945[_0x38a9('0x6')];this[_0x38a9('0x7')]=_0x2b8945['countcongestionretry'];this[_0x38a9('0x8')]=_0x2b8945['countnoanswerretry'];this[_0x38a9('0x9')]=_0x2b8945[_0x38a9('0x6')]+_0x2b8945[_0x38a9('0x7')]+_0x2b8945[_0x38a9('0x8')]+_0x2b8945['countnosuchnumberretry']+_0x2b8945['countdropretry']+_0x2b8945[_0x38a9('0xa')]+_0x2b8945['countmachineretry']+_0x2b8945[_0x38a9('0xb')];this[_0x38a9('0xc')]=_0x2b8945['countnosuchnumberretry'];this['countdropretry']=_0x2b8945[_0x38a9('0xd')];this[_0x38a9('0xa')]=_0x2b8945[_0x38a9('0xa')];this[_0x38a9('0xe')]=_0x2b8945[_0x38a9('0xe')];this[_0x38a9('0xb')]=_0x2b8945[_0x38a9('0xb')];this[_0x38a9('0x5')]=_0x2b8945[_0x38a9('0x5')];this[_0x38a9('0xf')]=_0x2b8945[_0x38a9('0xf')];this[_0x38a9('0x10')]=_0x2b8945[_0x38a9('0x10')];this[_0x38a9('0x11')]=_0x2b8945['starttime'];this['responsetime']=_0x2b8945[_0x38a9('0x12')];this['endtime']=_0x2b8945[_0x38a9('0x12')];this['ringtime']=_0x2b8945[_0x38a9('0x13')]||0x0;this[_0x38a9('0x14')]=_0x2b8945[_0x38a9('0x14')]||0x0;this[_0x38a9('0x15')]=_0x2b8945['talktime']||0x0;this[_0x38a9('0x16')]=_0x2b8945[_0x38a9('0x16')];this[_0x38a9('0x17')]=_0x2b8945[_0x38a9('0x17')];this['callbackat']=_0x2b8945[_0x38a9('0x18')];this[_0x38a9('0x19')]=_0x2b8945[_0x38a9('0x19')];this[_0x38a9('0x1a')]=_0x2b8945[_0x38a9('0x1a')];this['ListId']=_0x2b8945[_0x38a9('0x1b')];this[_0x38a9('0x1c')]=_0x2b8945[_0x38a9('0x1c')];this[_0x38a9('0x1d')]=_0x2b8945['VoiceQueueId'];this[_0x38a9('0x1e')]=_0x2b8945[_0x38a9('0x1e')];this[_0x38a9('0x1f')]=_0x2b8945[_0x38a9('0x1f')]||'';this['originatecalleridname']=_0x2b8945[_0x38a9('0x20')]||'';this[_0x38a9('0x21')]=_0x2b8945[_0x38a9('0x21')];this[_0x38a9('0x22')]=_0x2b8945[_0x38a9('0x22')];}module['exports']=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/models/hangup.js b/server/services/ami/dialer/models/hangup.js index f79e6e0..97e6fe3 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 _0xc5e6=['outbound','queue','amd','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countagentrejectretry','countabandonedretry','countmachineretry','uniqueid','name','starttime','responsetime','endtime','format','ringtime','holdtime','talktime','getSeconds','membername','IVR','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ListId','UserId','VoiceQueueId','CampaignId','exports','../utils','state','statedesc','Answer','scheduledat','type','campaigntype'];(function(_0x5b6ffe,_0x280e9a){var _0x5f2d56=function(_0x534a6e){while(--_0x534a6e){_0x5b6ffe['push'](_0x5b6ffe['shift']());}};_0x5f2d56(++_0x280e9a);}(_0xc5e6,0xcb));var _0x6c5e=function(_0x22ee1e,_0x3eff80){_0x22ee1e=_0x22ee1e-0x0;var _0x49a5c9=_0xc5e6[_0x22ee1e];return _0x49a5c9;};'use strict';var moment=require('moment');var utils=require(_0x6c5e('0x0'));function Hangup(_0x3dc0bd,_0x2085cb){this[_0x6c5e('0x1')]=0x4;this[_0x6c5e('0x2')]=_0x6c5e('0x3');this[_0x6c5e('0x4')]=_0x3dc0bd[_0x6c5e('0x4')];this[_0x6c5e('0x5')]=_0x3dc0bd[_0x6c5e('0x5')];this[_0x6c5e('0x6')]=_0x3dc0bd[_0x6c5e('0x5')]===_0x6c5e('0x7')?_0x6c5e('0x8'):_0x3dc0bd[_0x6c5e('0x5')];this[_0x6c5e('0x9')]=_0x3dc0bd[_0x6c5e('0x9')]||![];this[_0x6c5e('0xa')]=_0x3dc0bd[_0x6c5e('0xa')];this[_0x6c5e('0xb')]=_0x3dc0bd[_0x6c5e('0xb')];this['countnoanswerretry']=_0x3dc0bd[_0x6c5e('0xc')];this[_0x6c5e('0xd')]=_0x3dc0bd['countbusyretry']+_0x3dc0bd[_0x6c5e('0xb')]+_0x3dc0bd['countnoanswerretry']+_0x3dc0bd[_0x6c5e('0xe')]+_0x3dc0bd[_0x6c5e('0xf')]+_0x3dc0bd['countabandonedretry']+_0x3dc0bd['countmachineretry']+_0x3dc0bd[_0x6c5e('0x10')];this[_0x6c5e('0xe')]=_0x3dc0bd[_0x6c5e('0xe')];this['countdropretry']=_0x3dc0bd[_0x6c5e('0xf')];this[_0x6c5e('0x11')]=_0x3dc0bd[_0x6c5e('0x11')];this[_0x6c5e('0x12')]=_0x3dc0bd['countmachineretry'];this[_0x6c5e('0x10')]=_0x3dc0bd['countagentrejectretry'];this[_0x6c5e('0x13')]=_0x2085cb[_0x6c5e('0x13')];this['calleridname']=_0x3dc0bd[_0x6c5e('0x14')];this['calleridnum']=_0x3dc0bd['number'];this[_0x6c5e('0x15')]=_0x3dc0bd[_0x6c5e('0x15')];this[_0x6c5e('0x16')]=_0x3dc0bd['responsetime'];this[_0x6c5e('0x17')]=moment()[_0x6c5e('0x18')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x6c5e('0x19')]=utils['getSeconds'](_0x3dc0bd[_0x6c5e('0x16')],_0x3dc0bd[_0x6c5e('0x15')]);this[_0x6c5e('0x1a')]=0x0;this[_0x6c5e('0x1b')]=utils[_0x6c5e('0x1c')](this['endtime'],_0x3dc0bd[_0x6c5e('0x16')]);this[_0x6c5e('0x8')]=_0x3dc0bd[_0x6c5e('0x8')];this[_0x6c5e('0x1d')]=_0x6c5e('0x1e');this[_0x6c5e('0x1f')]=_0x2085cb[_0x6c5e('0x20')];this[_0x6c5e('0x21')]=_0x3dc0bd[_0x6c5e('0x21')];this[_0x6c5e('0x22')]=_0x3dc0bd[_0x6c5e('0x22')];this['callbackat']=_0x3dc0bd[_0x6c5e('0x23')];this[_0x6c5e('0x24')]=_0x3dc0bd[_0x6c5e('0x24')];this['ContactId']=_0x3dc0bd['ContactId'];this['ListId']=_0x3dc0bd[_0x6c5e('0x25')];this[_0x6c5e('0x26')]=_0x3dc0bd['UserId'];this[_0x6c5e('0x27')]=_0x3dc0bd[_0x6c5e('0x27')];this[_0x6c5e('0x28')]=_0x3dc0bd[_0x6c5e('0x28')];}module[_0x6c5e('0x29')]=Hangup; \ No newline at end of file +var _0x88ce=['responsetime','endtime','ringtime','holdtime','talktime','getSeconds','membername','reason','cause-txt','callback','callbackuniqueid','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','moment','../utils','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','amd','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','uniqueid','calleridname','name','calleridnum','starttime'];(function(_0x3ff233,_0x341483){var _0x1341f9=function(_0x5cffb6){while(--_0x5cffb6){_0x3ff233['push'](_0x3ff233['shift']());}};_0x1341f9(++_0x341483);}(_0x88ce,0x93));var _0xe88c=function(_0x3d5ede,_0x1374c7){_0x3d5ede=_0x3d5ede-0x0;var _0x12a33b=_0x88ce[_0x3d5ede];return _0x12a33b;};'use strict';var moment=require(_0xe88c('0x0'));var utils=require(_0xe88c('0x1'));function Hangup(_0x1cd0b9,_0x44dfec){this[_0xe88c('0x2')]=0x4;this[_0xe88c('0x3')]=_0xe88c('0x4');this[_0xe88c('0x5')]=_0x1cd0b9[_0xe88c('0x5')];this[_0xe88c('0x6')]=_0x1cd0b9['type'];this[_0xe88c('0x7')]=_0x1cd0b9[_0xe88c('0x6')]===_0xe88c('0x8')?_0xe88c('0x9'):_0x1cd0b9[_0xe88c('0x6')];this['amd']=_0x1cd0b9[_0xe88c('0xa')]||![];this[_0xe88c('0xb')]=_0x1cd0b9[_0xe88c('0xb')];this[_0xe88c('0xc')]=_0x1cd0b9['countcongestionretry'];this[_0xe88c('0xd')]=_0x1cd0b9[_0xe88c('0xd')];this[_0xe88c('0xe')]=_0x1cd0b9[_0xe88c('0xb')]+_0x1cd0b9['countcongestionretry']+_0x1cd0b9[_0xe88c('0xd')]+_0x1cd0b9['countnosuchnumberretry']+_0x1cd0b9[_0xe88c('0xf')]+_0x1cd0b9[_0xe88c('0x10')]+_0x1cd0b9[_0xe88c('0x11')]+_0x1cd0b9[_0xe88c('0x12')];this['countnosuchnumberretry']=_0x1cd0b9[_0xe88c('0x13')];this[_0xe88c('0xf')]=_0x1cd0b9[_0xe88c('0xf')];this[_0xe88c('0x10')]=_0x1cd0b9[_0xe88c('0x10')];this[_0xe88c('0x11')]=_0x1cd0b9[_0xe88c('0x11')];this['countagentrejectretry']=_0x1cd0b9[_0xe88c('0x12')];this[_0xe88c('0x14')]=_0x44dfec['uniqueid'];this[_0xe88c('0x15')]=_0x1cd0b9[_0xe88c('0x16')];this[_0xe88c('0x17')]=_0x1cd0b9['number'];this[_0xe88c('0x18')]=_0x1cd0b9['starttime'];this[_0xe88c('0x19')]=_0x1cd0b9[_0xe88c('0x19')];this[_0xe88c('0x1a')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0xe88c('0x1b')]=utils['getSeconds'](_0x1cd0b9[_0xe88c('0x19')],_0x1cd0b9['starttime']);this[_0xe88c('0x1c')]=0x0;this[_0xe88c('0x1d')]=utils[_0xe88c('0x1e')](this['endtime'],_0x1cd0b9['responsetime']);this[_0xe88c('0x9')]=_0x1cd0b9[_0xe88c('0x9')];this[_0xe88c('0x1f')]='IVR';this[_0xe88c('0x20')]=_0x44dfec[_0xe88c('0x21')];this[_0xe88c('0x22')]=_0x1cd0b9[_0xe88c('0x22')];this[_0xe88c('0x23')]=_0x1cd0b9[_0xe88c('0x23')];this['callbackat']=_0x1cd0b9['callbackat'];this[_0xe88c('0x24')]=_0x1cd0b9[_0xe88c('0x24')];this[_0xe88c('0x25')]=_0x1cd0b9['ContactId'];this[_0xe88c('0x26')]=_0x1cd0b9[_0xe88c('0x26')];this['UserId']=_0x1cd0b9[_0xe88c('0x27')];this[_0xe88c('0x28')]=_0x1cd0b9[_0xe88c('0x28')];this['CampaignId']=_0x1cd0b9[_0xe88c('0x29')];}module[_0xe88c('0x2a')]=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/models/history.js b/server/services/ami/dialer/models/history.js index ece906d..74cf0b0 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 _0xa23e=['ringtime','getSeconds','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','uniqueid','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countnosuchnumberretry','countmachineretry','countagentrejectretry','calleridname','name','calleridnum','starttime','responsetime'];(function(_0x1591f6,_0x436155){var _0x16f896=function(_0x114129){while(--_0x114129){_0x1591f6['push'](_0x1591f6['shift']());}};_0x16f896(++_0x436155);}(_0xa23e,0x179));var _0xea23=function(_0x321e8e,_0x502198){_0x321e8e=_0x321e8e-0x0;var _0xee4330=_0xa23e[_0x321e8e];return _0xee4330;};'use strict';var utils=require('../utils');function History(_0x12df0f){this[_0xea23('0x0')]=_0x12df0f[_0xea23('0x0')];this['scheduledat']=_0x12df0f[_0xea23('0x1')]||undefined;this[_0xea23('0x2')]=_0x12df0f[_0xea23('0x2')];this['campaigntype']=_0x12df0f[_0xea23('0x2')]===_0xea23('0x3')?_0xea23('0x4'):_0x12df0f[_0xea23('0x2')];this['countbusyretry']=_0x12df0f[_0xea23('0x5')];this['countcongestionretry']=_0x12df0f[_0xea23('0x6')];this[_0xea23('0x7')]=_0x12df0f[_0xea23('0x7')];this[_0xea23('0x8')]=_0x12df0f[_0xea23('0x5')]+_0x12df0f[_0xea23('0x6')]+_0x12df0f[_0xea23('0x7')]+_0x12df0f['countnosuchnumberretry']+_0x12df0f[_0xea23('0x9')]+_0x12df0f[_0xea23('0xa')]+_0x12df0f['countmachineretry']+_0x12df0f['countagentrejectretry'];this[_0xea23('0xb')]=_0x12df0f[_0xea23('0xb')];this[_0xea23('0x9')]=_0x12df0f['countdropretry'];this[_0xea23('0xa')]=_0x12df0f[_0xea23('0xa')];this[_0xea23('0xc')]=_0x12df0f[_0xea23('0xc')];this[_0xea23('0xd')]=_0x12df0f['countagentrejectretry'];this[_0xea23('0x4')]=_0x12df0f[_0xea23('0x4')];this[_0xea23('0xe')]=_0x12df0f[_0xea23('0xf')];this[_0xea23('0x10')]=_0x12df0f['number'];this[_0xea23('0x11')]=_0x12df0f[_0xea23('0x11')];this[_0xea23('0x12')]=_0x12df0f[_0xea23('0x12')];this['endtime']=_0x12df0f['responsetime'];this[_0xea23('0x13')]=utils[_0xea23('0x14')](_0x12df0f[_0xea23('0x12')],_0x12df0f[_0xea23('0x11')]);this['holdtime']=0x0;this[_0xea23('0x15')]=0x0;this[_0xea23('0x16')]=_0x12df0f['callback'];this[_0xea23('0x17')]=_0x12df0f['callbackuniqueid'];this[_0xea23('0x18')]=_0x12df0f[_0xea23('0x18')];this[_0xea23('0x19')]=_0x12df0f['recallme'];this[_0xea23('0x1a')]=_0x12df0f['ContactId'];this[_0xea23('0x1b')]=_0x12df0f[_0xea23('0x1b')];this[_0xea23('0x1c')]=_0x12df0f[_0xea23('0x1c')];this['VoiceQueueId']=_0x12df0f[_0xea23('0x1d')];this[_0xea23('0x1e')]=_0x12df0f['CampaignId'];this[_0xea23('0x1f')]=_0x12df0f[_0xea23('0x1f')]||'';this[_0xea23('0x20')]=_0x12df0f['originatecalleridname']||'';this[_0xea23('0x21')]=_0x12df0f[_0xea23('0x21')];this[_0xea23('0x22')]=_0x12df0f['statedesc'];}module[_0xea23('0x23')]=History; \ No newline at end of file +var _0xfc31=['campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','calleridname','name','calleridnum','number','starttime','responsetime','endtime','ringtime','getSeconds','talktime','callback','callbackuniqueid','callbackat','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','statedesc','exports','uniqueid','scheduledat','type'];(function(_0x284254,_0x40369d){var _0x578537=function(_0x477414){while(--_0x477414){_0x284254['push'](_0x284254['shift']());}};_0x578537(++_0x40369d);}(_0xfc31,0x16f));var _0x1fc3=function(_0x1d5f42,_0x5f2f9d){_0x1d5f42=_0x1d5f42-0x0;var _0x5f0a5d=_0xfc31[_0x1d5f42];return _0x5f0a5d;};'use strict';var utils=require('../utils');function History(_0x408b59){this[_0x1fc3('0x0')]=_0x408b59[_0x1fc3('0x0')];this[_0x1fc3('0x1')]=_0x408b59['scheduledat']||undefined;this['type']=_0x408b59[_0x1fc3('0x2')];this[_0x1fc3('0x3')]=_0x408b59[_0x1fc3('0x2')]===_0x1fc3('0x4')?_0x1fc3('0x5'):_0x408b59['type'];this[_0x1fc3('0x6')]=_0x408b59['countbusyretry'];this[_0x1fc3('0x7')]=_0x408b59[_0x1fc3('0x7')];this[_0x1fc3('0x8')]=_0x408b59[_0x1fc3('0x8')];this[_0x1fc3('0x9')]=_0x408b59[_0x1fc3('0x6')]+_0x408b59['countcongestionretry']+_0x408b59[_0x1fc3('0x8')]+_0x408b59[_0x1fc3('0xa')]+_0x408b59[_0x1fc3('0xb')]+_0x408b59['countabandonedretry']+_0x408b59[_0x1fc3('0xc')]+_0x408b59[_0x1fc3('0xd')];this['countnosuchnumberretry']=_0x408b59[_0x1fc3('0xa')];this[_0x1fc3('0xb')]=_0x408b59[_0x1fc3('0xb')];this[_0x1fc3('0xe')]=_0x408b59[_0x1fc3('0xe')];this[_0x1fc3('0xc')]=_0x408b59[_0x1fc3('0xc')];this[_0x1fc3('0xd')]=_0x408b59[_0x1fc3('0xd')];this[_0x1fc3('0x5')]=_0x408b59['queue'];this[_0x1fc3('0xf')]=_0x408b59[_0x1fc3('0x10')];this[_0x1fc3('0x11')]=_0x408b59[_0x1fc3('0x12')];this[_0x1fc3('0x13')]=_0x408b59[_0x1fc3('0x13')];this[_0x1fc3('0x14')]=_0x408b59[_0x1fc3('0x14')];this[_0x1fc3('0x15')]=_0x408b59['responsetime'];this[_0x1fc3('0x16')]=utils[_0x1fc3('0x17')](_0x408b59[_0x1fc3('0x14')],_0x408b59['starttime']);this['holdtime']=0x0;this[_0x1fc3('0x18')]=0x0;this[_0x1fc3('0x19')]=_0x408b59[_0x1fc3('0x19')];this[_0x1fc3('0x1a')]=_0x408b59[_0x1fc3('0x1a')];this[_0x1fc3('0x1b')]=_0x408b59[_0x1fc3('0x1b')];this['recallme']=_0x408b59['recallme'];this[_0x1fc3('0x1c')]=_0x408b59[_0x1fc3('0x1c')];this[_0x1fc3('0x1d')]=_0x408b59['ListId'];this[_0x1fc3('0x1e')]=_0x408b59[_0x1fc3('0x1e')];this[_0x1fc3('0x1f')]=_0x408b59[_0x1fc3('0x1f')];this[_0x1fc3('0x20')]=_0x408b59[_0x1fc3('0x20')];this[_0x1fc3('0x21')]=_0x408b59['originatecalleridnum']||'';this[_0x1fc3('0x22')]=_0x408b59[_0x1fc3('0x22')]||'';this['state']=_0x408b59['state'];this[_0x1fc3('0x23')]=_0x408b59[_0x1fc3('0x23')];}module[_0x1fc3('0x24')]=History; \ No newline at end of file diff --git a/server/services/ami/dialer/models/queueCallerAbandon.js b/server/services/ami/dialer/models/queueCallerAbandon.js index af9974c..9c1f82b 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 _0xe293=['countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','name','calleridnum','number','starttime','droptime','dropreason','endtime','ringtime','getSeconds','responsetime','holdtime','talktime','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','agiafterat','state','statedesc','exports','../utils','scheduledat','type','queue','countbusyretry','countnoanswerretry','countglobal','countcongestionretry'];(function(_0x297dcf,_0x448cf5){var _0xe1699b=function(_0x8b1e0f){while(--_0x8b1e0f){_0x297dcf['push'](_0x297dcf['shift']());}};_0xe1699b(++_0x448cf5);}(_0xe293,0x172));var _0x3e29=function(_0x456032,_0x1a799d){_0x456032=_0x456032-0x0;var _0x1a53cd=_0xe293[_0x456032];return _0x1a53cd;};'use strict';var utils=require(_0x3e29('0x0'));function QueueCallerAbandon(_0x28d504,_0x487172){this[_0x3e29('0x1')]=_0x28d504['scheduledat'];this[_0x3e29('0x2')]=_0x28d504['type'];this['campaigntype']=_0x28d504[_0x3e29('0x2')]==='outbound'?_0x3e29('0x3'):_0x28d504[_0x3e29('0x2')];this[_0x3e29('0x4')]=_0x28d504[_0x3e29('0x4')];this['countcongestionretry']=_0x28d504['countcongestionretry'];this[_0x3e29('0x5')]=_0x28d504[_0x3e29('0x5')];this[_0x3e29('0x6')]=_0x28d504['countbusyretry']+_0x28d504[_0x3e29('0x7')]+_0x28d504[_0x3e29('0x5')]+_0x28d504[_0x3e29('0x8')]+_0x28d504['countdropretry']+_0x28d504['countabandonedretry']+_0x28d504['countmachineretry']+_0x28d504['countagentrejectretry'];this[_0x3e29('0x8')]=_0x28d504[_0x3e29('0x8')];this['countdropretry']=_0x28d504['countdropretry'];this[_0x3e29('0x9')]=_0x28d504[_0x3e29('0x9')];this[_0x3e29('0xa')]=_0x28d504['countmachineretry'];this[_0x3e29('0xb')]=_0x28d504[_0x3e29('0xb')];this[_0x3e29('0xc')]=_0x487172['uniqueid'];this['calleridname']=_0x28d504[_0x3e29('0xd')];this[_0x3e29('0xe')]=_0x28d504[_0x3e29('0xf')];this[_0x3e29('0x10')]=_0x28d504['starttime'];this['responsetime']=_0x28d504['responsetime'];this['droptime']=_0x28d504[_0x3e29('0x11')];this[_0x3e29('0x12')]=_0x28d504[_0x3e29('0x12')];this[_0x3e29('0x13')]=this['droptime'];this[_0x3e29('0x14')]=utils[_0x3e29('0x15')](_0x28d504[_0x3e29('0x16')],_0x28d504[_0x3e29('0x10')]);this[_0x3e29('0x17')]=utils['getSeconds'](this[_0x3e29('0x11')],_0x28d504[_0x3e29('0x16')]);this[_0x3e29('0x18')]=0x0;this[_0x3e29('0x3')]=_0x487172['queue'];this[_0x3e29('0x19')]=_0x487172[_0x3e29('0x1a')];this[_0x3e29('0x1b')]=_0x487172['reason'];this[_0x3e29('0x1c')]=_0x28d504[_0x3e29('0x1c')];this[_0x3e29('0x1d')]=_0x28d504[_0x3e29('0x1d')];this[_0x3e29('0x1e')]=_0x28d504[_0x3e29('0x1e')];this[_0x3e29('0x1f')]=_0x28d504[_0x3e29('0x1f')];this[_0x3e29('0x20')]=_0x28d504[_0x3e29('0x20')];this[_0x3e29('0x21')]=_0x28d504[_0x3e29('0x21')];this[_0x3e29('0x22')]=_0x28d504['UserId'];this[_0x3e29('0x23')]=_0x28d504[_0x3e29('0x23')];this['CampaignId']=_0x28d504['CampaignId'];this['originatecalleridnum']=_0x28d504[_0x3e29('0x24')]||'';this[_0x3e29('0x25')]=_0x28d504['originatecalleridname']||'';this[_0x3e29('0x26')]=_0x28d504[_0x3e29('0x26')];this[_0x3e29('0x27')]=_0x28d504[_0x3e29('0x27')];this[_0x3e29('0x28')]=_0x28d504['statedesc'];}module[_0x3e29('0x29')]=QueueCallerAbandon; \ No newline at end of file +var _0x148c=['callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','state','statedesc','exports','../utils','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','droptime','dropreason','ringtime','getSeconds','holdtime','talktime','membername','connectedlinename','reason','callback'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x148c,0x149));var _0xc148=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x148c[_0xa464c9];return _0x3d73c4;};'use strict';var utils=require(_0xc148('0x0'));function QueueCallerAbandon(_0x5ca27d,_0x3264f1){this[_0xc148('0x1')]=_0x5ca27d[_0xc148('0x1')];this[_0xc148('0x2')]=_0x5ca27d['type'];this[_0xc148('0x3')]=_0x5ca27d[_0xc148('0x2')]===_0xc148('0x4')?_0xc148('0x5'):_0x5ca27d[_0xc148('0x2')];this[_0xc148('0x6')]=_0x5ca27d[_0xc148('0x6')];this[_0xc148('0x7')]=_0x5ca27d[_0xc148('0x7')];this['countnoanswerretry']=_0x5ca27d[_0xc148('0x8')];this['countglobal']=_0x5ca27d[_0xc148('0x6')]+_0x5ca27d[_0xc148('0x7')]+_0x5ca27d['countnoanswerretry']+_0x5ca27d[_0xc148('0x9')]+_0x5ca27d[_0xc148('0xa')]+_0x5ca27d['countabandonedretry']+_0x5ca27d[_0xc148('0xb')]+_0x5ca27d[_0xc148('0xc')];this[_0xc148('0x9')]=_0x5ca27d['countnosuchnumberretry'];this[_0xc148('0xa')]=_0x5ca27d[_0xc148('0xa')];this[_0xc148('0xd')]=_0x5ca27d[_0xc148('0xd')];this[_0xc148('0xb')]=_0x5ca27d['countmachineretry'];this[_0xc148('0xc')]=_0x5ca27d['countagentrejectretry'];this[_0xc148('0xe')]=_0x3264f1[_0xc148('0xe')];this[_0xc148('0xf')]=_0x5ca27d[_0xc148('0x10')];this[_0xc148('0x11')]=_0x5ca27d[_0xc148('0x12')];this[_0xc148('0x13')]=_0x5ca27d[_0xc148('0x13')];this['responsetime']=_0x5ca27d[_0xc148('0x14')];this[_0xc148('0x15')]=_0x5ca27d[_0xc148('0x15')];this['dropreason']=_0x5ca27d[_0xc148('0x16')];this['endtime']=this[_0xc148('0x15')];this[_0xc148('0x17')]=utils[_0xc148('0x18')](_0x5ca27d['responsetime'],_0x5ca27d['starttime']);this[_0xc148('0x19')]=utils[_0xc148('0x18')](this[_0xc148('0x15')],_0x5ca27d[_0xc148('0x14')]);this[_0xc148('0x1a')]=0x0;this[_0xc148('0x5')]=_0x3264f1[_0xc148('0x5')];this[_0xc148('0x1b')]=_0x3264f1[_0xc148('0x1c')];this[_0xc148('0x1d')]=_0x3264f1[_0xc148('0x1d')];this['callback']=_0x5ca27d[_0xc148('0x1e')];this[_0xc148('0x1f')]=_0x5ca27d[_0xc148('0x1f')];this['callbackat']=_0x5ca27d[_0xc148('0x20')];this[_0xc148('0x21')]=_0x5ca27d[_0xc148('0x21')];this['ContactId']=_0x5ca27d[_0xc148('0x22')];this[_0xc148('0x23')]=_0x5ca27d[_0xc148('0x23')];this[_0xc148('0x24')]=_0x5ca27d[_0xc148('0x24')];this['VoiceQueueId']=_0x5ca27d[_0xc148('0x25')];this[_0xc148('0x26')]=_0x5ca27d[_0xc148('0x26')];this['originatecalleridnum']=_0x5ca27d[_0xc148('0x27')]||'';this[_0xc148('0x28')]=_0x5ca27d[_0xc148('0x28')]||'';this[_0xc148('0x29')]=_0x5ca27d[_0xc148('0x29')];this[_0xc148('0x2a')]=_0x5ca27d['state'];this[_0xc148('0x2b')]=_0x5ca27d[_0xc148('0x2b')];}module[_0xc148('0x2c')]=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 e8feb62..baaf9ea 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 _0x0adf=['countReScheduled','rescheduleContact','unlockContact','[unlockContact]','[moveContactManagedDialer]','moveContactManagedDialer','checkIsBlackList','[checkIsBlackList]','checkIsBlackListIvr','[checkIsBlackListIvr]','verifyAdditionalPhones','[verifyAdditionalPhone]','[swapAdditionalPhone]','swapAdditionalPhones','[avgHandleTime]','avgHandleTime','createHistory','[createHistory]','util','../../../../config/logger','dialer','../../rpc/cmHopperAdditionalPhone','../../rpc/cmHopperBlack','../../rpc/cmHopperHistory','inspect','getContactDialer','catch','temp','error','[getContactDialer]','getContactDialerIvr','[getContactDialerIvr]'];(function(_0x381a37,_0x204b1a){var _0x314e8a=function(_0x278293){while(--_0x278293){_0x381a37['push'](_0x381a37['shift']());}};_0x314e8a(++_0x204b1a);}(_0x0adf,0x1d2));var _0xf0ad=function(_0xf5f5fa,_0x158d7e){_0xf5f5fa=_0xf5f5fa-0x0;var _0x25f3df=_0x0adf[_0xf5f5fa];return _0x25f3df;};'use strict';var util=require(_0xf0ad('0x0'));var logger=require(_0xf0ad('0x1'))(_0xf0ad('0x2'));var cmHopper=require('../../rpc/cmHopper');var cmHopperAdditionalPhone=require(_0xf0ad('0x3'));var cmHopperBlack=require(_0xf0ad('0x4'));var cmHopperHistory=require(_0xf0ad('0x5'));function inspectError(_0x187aa4){return util[_0xf0ad('0x6')](_0x187aa4,{'showHidden':![],'depth':null});}function getContactDialer(_0x459e70,_0x719547,_0x59a588){return cmHopper[_0xf0ad('0x7')](_0x459e70['id'],_0x719547,_0x59a588,_0x459e70['dialOrderByScheduledAt'])[_0xf0ad('0x8')](function(_0x44cf37){_0x459e70[_0xf0ad('0x9')]=0x0;logger[_0xf0ad('0xa')](_0xf0ad('0xb'),inspectError(_0x44cf37));});}exports[_0xf0ad('0x7')]=getContactDialer;function getContactDialerIvr(_0xe65b20,_0x5bdf69){return cmHopper[_0xf0ad('0xc')](_0xe65b20['id'],_0x5bdf69,_0xe65b20['dialOrderByScheduledAt'])[_0xf0ad('0x8')](function(_0x1f2952){_0xe65b20[_0xf0ad('0x9')]=0x0;logger[_0xf0ad('0xa')](_0xf0ad('0xd'),inspectError(_0x1f2952));});}exports['getContactDialerIvr']=getContactDialerIvr;function countReScheduled(_0x59b1a5){return cmHopper[_0xf0ad('0xe')](_0x59b1a5)[_0xf0ad('0x8')](function(_0x3646a2){logger[_0xf0ad('0xa')]('[countReScheduled]',inspectError(_0x3646a2));});}exports[_0xf0ad('0xe')]=countReScheduled;function rescheduleContact(_0x198cd8){return cmHopper['rescheduleContact'](_0x198cd8)['catch'](function(_0x5332e9){logger[_0xf0ad('0xa')]('[rescheduleContact]',inspectError(_0x5332e9));});}exports[_0xf0ad('0xf')]=rescheduleContact;function unlockContact(_0x313ad6,_0xfa544c,_0xfa829e){return cmHopper[_0xf0ad('0x10')](_0x313ad6,_0xfa544c,_0xfa829e)['catch'](function(_0x1ad9e0){logger[_0xf0ad('0xa')](_0xf0ad('0x11'),inspectError(_0x1ad9e0));});}exports[_0xf0ad('0x10')]=unlockContact;function moveContactManagedDialer(_0x47fa2b){return cmHopper['moveContactManagedDialer'](_0x47fa2b)[_0xf0ad('0x8')](function(_0x46fb20){logger['error'](_0xf0ad('0x12'),inspectError(_0x46fb20));});}exports[_0xf0ad('0x13')]=moveContactManagedDialer;function checkIsBlackList(_0x9a95bf){return cmHopperBlack[_0xf0ad('0x14')](_0x9a95bf)['catch'](function(_0x57c570){logger[_0xf0ad('0xa')](_0xf0ad('0x15'),inspectError(_0x57c570));});}exports[_0xf0ad('0x14')]=checkIsBlackList;function checkIsBlackListIvr(_0x20c5f3){return cmHopperBlack[_0xf0ad('0x16')](_0x20c5f3)[_0xf0ad('0x8')](function(_0x4e874a){logger[_0xf0ad('0xa')](_0xf0ad('0x17'),inspectError(_0x4e874a));});}exports[_0xf0ad('0x16')]=checkIsBlackListIvr;function verifyAdditionalPhones(_0x3ece1e,_0x29d647,_0x88b47b){return cmHopperAdditionalPhone[_0xf0ad('0x18')](_0x3ece1e,_0x29d647,_0x88b47b)[_0xf0ad('0x8')](function(_0x3fc97e){logger[_0xf0ad('0xa')](_0xf0ad('0x19'),inspectError(_0x3fc97e));});}exports[_0xf0ad('0x18')]=verifyAdditionalPhones;function swapAdditionalPhones(_0xeae85c,_0x456f81,_0x879f89){return cmHopperAdditionalPhone['swapAdditionalPhones'](_0xeae85c,_0x456f81,_0x879f89)[_0xf0ad('0x8')](function(_0x1507a3){logger[_0xf0ad('0xa')](_0xf0ad('0x1a'),inspectError(_0x1507a3));});}exports[_0xf0ad('0x1b')]=swapAdditionalPhones;function avgHandleTime(_0x30f8ee){return cmHopperHistory['avgHandleTime'](_0x30f8ee)[_0xf0ad('0x8')](function(_0x19a32a){logger[_0xf0ad('0xa')](_0xf0ad('0x1c'),inspectError(_0x19a32a));});}exports[_0xf0ad('0x1d')]=avgHandleTime;function createHistory(_0x1ac25c){return cmHopperHistory[_0xf0ad('0x1e')](_0x1ac25c)[_0xf0ad('0x8')](function(_0x2386e8){logger[_0xf0ad('0xa')](_0xf0ad('0x1f'),inspectError(_0x2386e8));});}exports['createHistory']=createHistory; \ No newline at end of file +var _0x32f4=['catch','[getContactDialerIvr]','countReScheduled','error','[rescheduleContact]','rescheduleContact','unlockContact','[unlockContact]','moveContactManagedDialer','[moveContactManagedDialer]','checkIsBlackList','[checkIsBlackList]','checkIsBlackListIvr','[verifyAdditionalPhone]','verifyAdditionalPhones','swapAdditionalPhones','[swapAdditionalPhone]','avgHandleTime','createHistory','[createHistory]','util','../../../../config/logger','dialer','../../rpc/cmHopper','../../rpc/cmHopperBlack','../../rpc/cmHopperHistory','inspect','getContactDialer','temp','[getContactDialer]','getContactDialerIvr','dialOrderByScheduledAt'];(function(_0x456795,_0x776713){var _0x3c7f23=function(_0x503542){while(--_0x503542){_0x456795['push'](_0x456795['shift']());}};_0x3c7f23(++_0x776713);}(_0x32f4,0x154));var _0x432f=function(_0x58f6c4,_0x292810){_0x58f6c4=_0x58f6c4-0x0;var _0x133da5=_0x32f4[_0x58f6c4];return _0x133da5;};'use strict';var util=require(_0x432f('0x0'));var logger=require(_0x432f('0x1'))(_0x432f('0x2'));var cmHopper=require(_0x432f('0x3'));var cmHopperAdditionalPhone=require('../../rpc/cmHopperAdditionalPhone');var cmHopperBlack=require(_0x432f('0x4'));var cmHopperHistory=require(_0x432f('0x5'));function inspectError(_0x51a71a){return util[_0x432f('0x6')](_0x51a71a,{'showHidden':![],'depth':null});}function getContactDialer(_0x1eabac,_0x344a29,_0x355b02){return cmHopper[_0x432f('0x7')](_0x1eabac['id'],_0x344a29,_0x355b02,_0x1eabac['dialOrderByScheduledAt'])['catch'](function(_0x2f66fd){_0x1eabac[_0x432f('0x8')]=0x0;logger['error'](_0x432f('0x9'),inspectError(_0x2f66fd));});}exports['getContactDialer']=getContactDialer;function getContactDialerIvr(_0x1cdcfd,_0x340fe9){return cmHopper[_0x432f('0xa')](_0x1cdcfd['id'],_0x340fe9,_0x1cdcfd[_0x432f('0xb')])[_0x432f('0xc')](function(_0x5d0155){_0x1cdcfd[_0x432f('0x8')]=0x0;logger['error'](_0x432f('0xd'),inspectError(_0x5d0155));});}exports['getContactDialerIvr']=getContactDialerIvr;function countReScheduled(_0x138967){return cmHopper[_0x432f('0xe')](_0x138967)['catch'](function(_0x457389){logger[_0x432f('0xf')]('[countReScheduled]',inspectError(_0x457389));});}exports[_0x432f('0xe')]=countReScheduled;function rescheduleContact(_0x26aa9a){return cmHopper['rescheduleContact'](_0x26aa9a)['catch'](function(_0x28d9e9){logger[_0x432f('0xf')](_0x432f('0x10'),inspectError(_0x28d9e9));});}exports[_0x432f('0x11')]=rescheduleContact;function unlockContact(_0x419bfe,_0x4f91c5,_0x175ba7){return cmHopper[_0x432f('0x12')](_0x419bfe,_0x4f91c5,_0x175ba7)[_0x432f('0xc')](function(_0x1504db){logger['error'](_0x432f('0x13'),inspectError(_0x1504db));});}exports[_0x432f('0x12')]=unlockContact;function moveContactManagedDialer(_0x42c2d2){return cmHopper[_0x432f('0x14')](_0x42c2d2)[_0x432f('0xc')](function(_0x129582){logger['error'](_0x432f('0x15'),inspectError(_0x129582));});}exports['moveContactManagedDialer']=moveContactManagedDialer;function checkIsBlackList(_0x3d545d){return cmHopperBlack[_0x432f('0x16')](_0x3d545d)[_0x432f('0xc')](function(_0x391fd8){logger[_0x432f('0xf')](_0x432f('0x17'),inspectError(_0x391fd8));});}exports[_0x432f('0x16')]=checkIsBlackList;function checkIsBlackListIvr(_0x1899e6){return cmHopperBlack[_0x432f('0x18')](_0x1899e6)[_0x432f('0xc')](function(_0x40176d){logger[_0x432f('0xf')]('[checkIsBlackListIvr]',inspectError(_0x40176d));});}exports['checkIsBlackListIvr']=checkIsBlackListIvr;function verifyAdditionalPhones(_0x343d13,_0x5c4deb,_0x28968e){return cmHopperAdditionalPhone['verifyAdditionalPhones'](_0x343d13,_0x5c4deb,_0x28968e)[_0x432f('0xc')](function(_0x175d1b){logger[_0x432f('0xf')](_0x432f('0x19'),inspectError(_0x175d1b));});}exports[_0x432f('0x1a')]=verifyAdditionalPhones;function swapAdditionalPhones(_0x1e347a,_0x59f352,_0x252b3b){return cmHopperAdditionalPhone[_0x432f('0x1b')](_0x1e347a,_0x59f352,_0x252b3b)['catch'](function(_0x2cbde9){logger[_0x432f('0xf')](_0x432f('0x1c'),inspectError(_0x2cbde9));});}exports[_0x432f('0x1b')]=swapAdditionalPhones;function avgHandleTime(_0x44839){return cmHopperHistory[_0x432f('0x1d')](_0x44839)[_0x432f('0xc')](function(_0x5a3d18){logger[_0x432f('0xf')]('[avgHandleTime]',inspectError(_0x5a3d18));});}exports[_0x432f('0x1d')]=avgHandleTime;function createHistory(_0x573cc5){return cmHopperHistory[_0x432f('0x1e')](_0x573cc5)['catch'](function(_0x3f768b){logger['error'](_0x432f('0x1f'),inspectError(_0x3f768b));});}exports[_0x432f('0x1e')]=createHistory; \ No newline at end of file diff --git a/server/services/ami/dialer/utils/index.js b/server/services/ami/dialer/utils/index.js index b27f5ef..e0b0715 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 _0x9df8=['random','toString','error','[decrementOriginate]\x20queue\x20originate\x20value\x20is\x20negative','length','checkContactEmpty','erlangb','checkContactLowerLimitOriginate','createdAt','undefined','XMD-','setXMDContactVariables','lodash','util','../../../../config/logger','dialer','timezones','ACTIVE','BLACKLIST','RESCHEDULED_CONTACTS','DEACTIVATED','IS_DISACTIVED','AGENTS_NOT_LOGGED','AVAILABLE_CONTACTS_FINISHED','INTERVAL_IS_NULL','INTERVAL_IS_OVERTIME','GLOBAL_INTERVAL_IS_OVERTIME','RECALLINQUEUE','RECALLFAILEDTIMEOUT','RUNNING','TIMEZONE_UNKNOW','CAMPAIGN_STATUS','preview','isPreviewCampaign','type','ivr','isIVRCampaign','outbound','dialActive','active','isIVRCampaignActive','milliseconds','diff','seconds','getSeconds','message','available','loggedIn','loggedInDb','paused','talking','pTalking','waiting','inUse','originated','Trunk','name','hasQueueCampaignDataChanged','dialTimezone','isNil','dialGlobalInterval','Interval','isEmpty','Intervals','EMPTY_INTERVAL','UNKNOWN_TIMEZONE','reachable','unmonitored','includes','status','TrunkBackup','INACTIVE','DISACTIVED','NO_AGENTS_LOGGED','UNREACHABLE_TRUNK','getQueueCampaignStatusMessage','getQueueCampaignActiveStatusMessage','match','extractCalleridName','isUndefined','string','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','getCallerId','\x5cw{0,','pow','replace'];(function(_0x280d51,_0x22bf33){var _0x2d964a=function(_0x44ce52){while(--_0x44ce52){_0x280d51['push'](_0x280d51['shift']());}};_0x2d964a(++_0x22bf33);}(_0x9df8,0x16c));var _0x89df=function(_0x2597e5,_0x50d324){_0x2597e5=_0x2597e5-0x0;var _0x9c542b=_0x9df8[_0x2597e5];return _0x9c542b;};'use strict';var _=require(_0x89df('0x0'));var moment=require('moment');var util=require(_0x89df('0x1'));var logger=require(_0x89df('0x2'))(_0x89df('0x3'));var timezones=require('../../../../config/environment/shared')[_0x89df('0x4')];var CAMPAIGN_STATUS={'ACTIVE':_0x89df('0x5'),'BLACKLIST':_0x89df('0x6'),'CONTACTS_RESCHEDULED':_0x89df('0x7'),'DEACTIVATED':_0x89df('0x8'),'DISACTIVED':_0x89df('0x9'),'EMPTY_INTERVAL':'INTERVAL_IS_EMPTY','INACTIVE':'NOT_ACTIVE','NO_AGENTS_LOGGED':_0x89df('0xa'),'NO_AVAILABLE_CONTACTS':_0x89df('0xb'),'NULL_INTERVAL':_0x89df('0xc'),'OVERTIME_INTERVAL':_0x89df('0xd'),'OVERTIME_GLOBAL_INTERVAL':_0x89df('0xe'),'QUEUE_RECALL':_0x89df('0xf'),'RECALL_TIMEOUT':_0x89df('0x10'),'RUNNING':_0x89df('0x11'),'UNKNOWN_TIMEZONE':_0x89df('0x12'),'UNREACHABLE_TRUNK':'TRUNK_IS_NOT_REACHABLE'};exports[_0x89df('0x13')]=CAMPAIGN_STATUS;function isPreviewCampaign(_0x3971e5){return _0x3971e5['dialMethod']===_0x89df('0x14');}exports[_0x89df('0x15')]=isPreviewCampaign;function isIVRCampaign(_0xc9ac22){return _0xc9ac22[_0x89df('0x16')]===_0x89df('0x17');}exports[_0x89df('0x18')]=isIVRCampaign;function isOutboundQueue(_0x5cbcf8){return _0x5cbcf8[_0x89df('0x16')]===_0x89df('0x19');}exports['isOutboundQueue']=isOutboundQueue;function isQueueCampaignActive(_0x3d0bbf){return _0x3d0bbf[_0x89df('0x1a')];}exports['isQueueCampaignActive']=isQueueCampaignActive;function isIVRCampaignActive(_0x38b9e6){return _0x38b9e6[_0x89df('0x1b')];}exports[_0x89df('0x1c')]=isIVRCampaignActive;function getSeconds(_0x47447a,_0x4e25a0){var _0x176cf8=moment(_0x47447a)[_0x89df('0x1d')](0x0);var _0xc586a4=moment(_0x4e25a0)['milliseconds'](0x0);return _0x176cf8[_0x89df('0x1e')](_0xc586a4,_0x89df('0x1f'));}exports[_0x89df('0x20')]=getSeconds;function hasQueueCampaignDataChanged(_0x4038aa,_0x4f559c){var _0x1a0685=![];var _0x203565=_0x4038aa['dialMethod']!==_0x4f559c['dialMethod']||_0x4038aa[_0x89df('0x1a')]!==_0x4f559c['dialActive']||_0x4038aa[_0x89df('0x21')]!==_0x4f559c[_0x89df('0x21')];var _0x474340=_0x4038aa[_0x89df('0x22')]!==_0x4f559c['available']||_0x4038aa['loggedIn']!==_0x4f559c[_0x89df('0x23')]||_0x4038aa[_0x89df('0x24')]!==_0x4f559c[_0x89df('0x24')]||_0x4038aa[_0x89df('0x25')]!==_0x4f559c[_0x89df('0x25')]||_0x4038aa[_0x89df('0x26')]!==_0x4f559c['talking']||_0x4038aa[_0x89df('0x27')]!==_0x4f559c[_0x89df('0x27')]||_0x4038aa[_0x89df('0x28')]!==_0x4f559c[_0x89df('0x28')]||_0x4038aa[_0x89df('0x29')]!==_0x4f559c[_0x89df('0x29')]||_0x4038aa['originated']!==_0x4f559c[_0x89df('0x2a')];if(_0x4038aa[_0x89df('0x2b')]&&_0x4f559c['Trunk']){_0x1a0685=_0x4038aa[_0x89df('0x2b')][_0x89df('0x2c')]!==_0x4f559c[_0x89df('0x2b')]['name']||_0x4038aa[_0x89df('0x2b')][_0x89df('0x1b')]!==_0x4f559c[_0x89df('0x2b')][_0x89df('0x1b')];}return _0x203565||_0x474340||_0x1a0685;}exports[_0x89df('0x2d')]=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x535ae1){var _0x597a55=null;var _0x4791ae=_0x535ae1[_0x89df('0x2e')];if(_[_0x89df('0x2f')](_0x535ae1[_0x89df('0x30')])||_['isNil'](_0x535ae1[_0x89df('0x31')])||_[_0x89df('0x2f')](_0x535ae1['Interval']['Intervals'])){_0x597a55=CAMPAIGN_STATUS['NULL_INTERVAL'];}else if(_[_0x89df('0x32')](_0x535ae1['dialGlobalInterval'])||_[_0x89df('0x32')](_0x535ae1[_0x89df('0x31')][_0x89df('0x33')])){_0x597a55=CAMPAIGN_STATUS[_0x89df('0x34')];}else if(_0x4791ae&&!timezones[_0x4791ae]){_0x597a55=CAMPAIGN_STATUS[_0x89df('0x35')];}return _0x597a55;}function checkAnyValidTrunk(_0x45516c,_0x57a9af){var _0x5dadb3=null;var _0x300bef='SIP/';var _0x1748ab=[_0x89df('0x36'),_0x89df('0x37')];var _0x3b5ee0=!![];if(_0x45516c[_0x89df('0x2b')]&&_0x45516c[_0x89df('0x2b')][_0x89df('0x1b')]){_0x300bef+=_0x45516c[_0x89df('0x2b')][_0x89df('0x2c')];_0x5dadb3=_0x57a9af[_0x300bef];_0x3b5ee0=_0x1748ab[_0x89df('0x38')](_0x5dadb3[_0x89df('0x39')]);}else if(_0x45516c['TrunkBackup']&&_0x45516c[_0x89df('0x3a')][_0x89df('0x1b')]){_0x300bef+=_0x45516c['TrunkBackup'][_0x89df('0x2c')];_0x5dadb3=_0x57a9af[_0x300bef];_0x3b5ee0=_0x1748ab[_0x89df('0x38')](_0x5dadb3['status']);}return _0x3b5ee0;}function getQueueCampaignStatusMessage(_0x1a631d,_0x5d4739){var _0x4eb8c4=CAMPAIGN_STATUS[_0x89df('0x5')];var _0x56baf0=isPreviewCampaign(_0x1a631d);if(!isQueueCampaignActive(_0x1a631d)){if(_0x56baf0){_0x4eb8c4=CAMPAIGN_STATUS[_0x89df('0x3b')];}else{if(_0x1a631d[_0x89df('0x2a')]===0x0&&_0x1a631d[_0x89df('0x26')]===0x0&&_0x1a631d['waiting']===0x0&&(_0x1a631d['pTalking']||0x0)===0x0){_0x4eb8c4=CAMPAIGN_STATUS[_0x89df('0x3b')];}else{_0x4eb8c4=CAMPAIGN_STATUS[_0x89df('0x3c')];}}}else if(_0x1a631d['loggedIn']===0x0){_0x4eb8c4=CAMPAIGN_STATUS[_0x89df('0x3d')];}else if(!checkAnyValidTrunk(_0x1a631d,_0x5d4739)){_0x4eb8c4=CAMPAIGN_STATUS[_0x89df('0x3e')];}else if(!isPreviewCampaign(_0x1a631d)){var _0x293d9a=checkAnyValidQueueCampaignInterval(_0x1a631d);if(_0x293d9a){_0x4eb8c4=_0x293d9a;}}return _0x4eb8c4;}exports[_0x89df('0x3f')]=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0xa3bd36){var _0xfa7865=CAMPAIGN_STATUS[_0x89df('0x3c')];if(_0xa3bd36[_0x89df('0x2a')]===0x0&&_0xa3bd36[_0x89df('0x26')]===0x0&&_0xa3bd36[_0x89df('0x28')]===0x0&&(_0xa3bd36[_0x89df('0x27')]||0x0)===0x0){_0xfa7865=CAMPAIGN_STATUS[_0x89df('0x3b')];}return _0xfa7865;}exports[_0x89df('0x40')]=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x1cbc04){var _0x25b532=_0x1cbc04[_0x89df('0x41')](/"(.*?)"/);return _0x25b532?_0x25b532[0x1]:_0x1cbc04;}exports[_0x89df('0x42')]=extractCalleridName;function getCallerId(_0x34d09e,_0x1f3ec5,_0x137c4c){if(!_[_0x89df('0x43')](_0x137c4c)&&typeof _0x137c4c===_0x89df('0x44')&&!_[_0x89df('0x32')](_0x137c4c)){if(!_[_0x89df('0x43')](_0x1f3ec5)&&typeof _0x1f3ec5==='string'&&!_[_0x89df('0x32')](_0x1f3ec5)){return util[_0x89df('0x45')](_0x89df('0x46'),_0x1f3ec5,_0x137c4c);}return util[_0x89df('0x45')](_0x89df('0x46'),_0x137c4c,_0x137c4c);}if(!_[_0x89df('0x43')](_0x34d09e)&&typeof _0x34d09e===_0x89df('0x44')&&!_[_0x89df('0x32')](_0x34d09e)){return _0x34d09e;}return _0x89df('0x47');}exports[_0x89df('0x48')]=getCallerId;function getCallerIdRandom(_0x5bcf0f,_0x37e914){var _0x36210e;var _0x31e375;var _0x3be74b;if(_0x37e914<=0x0){_0x37e914=0x1;}_0x36210e=new RegExp(_0x89df('0x49')+_0x37e914+'}$');_0x31e375=Math['pow'](0xa,_0x37e914-0x1);_0x3be74b=Math[_0x89df('0x4a')](0xa,_0x37e914)-0x1;return util[_0x89df('0x45')]('%s',_[_0x89df('0x4b')](_0x5bcf0f,_0x36210e,_[_0x89df('0x4c')](_0x31e375,_0x3be74b)[_0x89df('0x4d')]()));}exports['getCallerIdRandom']=getCallerIdRandom;function decrementOriginate(_0x2a7a60){if(_0x2a7a60[_0x89df('0x2a')]&&_0x2a7a60[_0x89df('0x2a')]>0x0){_0x2a7a60['originated']-=0x1;}else{logger[_0x89df('0x4e')](_0x89df('0x4f'));}}exports['decrementOriginate']=decrementOriginate;function checkContactEmpty(_0x361747){return _0x361747&&_0x361747[_0x89df('0x50')]>0x0;}exports[_0x89df('0x51')]=checkContactEmpty;function erlangb(_0x311a1d,_0x45fef4){if(_0x45fef4===0x0){return 0x0;}var _0x3316d9=0x1;for(var _0x3cf4d8=0x1;_0x3cf4d8<=_0x45fef4;_0x3cf4d8+=0x1){_0x3316d9=0x1+_0x3316d9*_0x3cf4d8/_0x311a1d;}return 0x1/_0x3316d9;}exports[_0x89df('0x52')]=erlangb;function checkContactLowerLimitOriginate(_0xf0aad7,_0x466478,_0x551619){if(_0x466478>_0x551619){for(var _0x12af2e=0x0;_0x12af2e<_0x466478-_0x551619;_0x12af2e+=0x1){decrementOriginate(_0xf0aad7);}}}exports[_0x89df('0x53')]=checkContactLowerLimitOriginate;function setXMDContactVariables(_0x58fbcf){var _0x359397={};var _0x607d99=['id',_0x89df('0x54'),'description','tags','updatedAt'];if(_0x58fbcf){for(var _0x1e2293 in _0x58fbcf){if(typeof _0x58fbcf[_0x1e2293]!==_0x89df('0x55')){if(!_[_0x89df('0x2f')](_0x58fbcf[_0x1e2293])&&!_0x607d99[_0x89df('0x38')](_0x1e2293)){_0x359397[util[_0x89df('0x45')]('%s%s',_0x89df('0x56'),_0x1e2293['toUpperCase']())]=_0x58fbcf[_0x1e2293];}}}}return _0x359397;}exports[_0x89df('0x57')]=setXMDContactVariables; \ No newline at end of file +var _0x8330=['toString','getCallerIdRandom','[decrementOriginate]\x20queue\x20originate\x20value\x20is\x20negative','decrementOriginate','checkContactEmpty','checkContactLowerLimitOriginate','createdAt','description','tags','updatedAt','undefined','%s%s','XMD-','toUpperCase','setXMDContactVariables','lodash','moment','util','dialer','../../../../config/environment/shared','timezones','ACTIVE','RESCHEDULED_CONTACTS','DEACTIVATED','IS_DISACTIVED','INTERVAL_IS_EMPTY','NOT_ACTIVE','AGENTS_NOT_LOGGED','RECALLINQUEUE','RECALLFAILEDTIMEOUT','TIMEZONE_UNKNOW','TRUNK_IS_NOT_REACHABLE','dialMethod','isPreviewCampaign','ivr','isIVRCampaign','type','outbound','isOutboundQueue','dialActive','isQueueCampaignActive','active','isIVRCampaignActive','milliseconds','seconds','getSeconds','message','available','loggedIn','loggedInDb','paused','talking','pTalking','waiting','inUse','originated','Trunk','hasQueueCampaignDataChanged','isNil','dialGlobalInterval','Interval','Intervals','NULL_INTERVAL','isEmpty','EMPTY_INTERVAL','UNKNOWN_TIMEZONE','reachable','unmonitored','name','includes','TrunkBackup','status','INACTIVE','DISACTIVED','NO_AGENTS_LOGGED','UNREACHABLE_TRUNK','getQueueCampaignStatusMessage','getQueueCampaignActiveStatusMessage','match','extractCalleridName','string','format','\x22%s\x22\x20<%s>','isUndefined','getCallerId','pow','replace','random'];(function(_0xcf5c52,_0x2e4153){var _0x4d39a3=function(_0xaa8bd6){while(--_0xaa8bd6){_0xcf5c52['push'](_0xcf5c52['shift']());}};_0x4d39a3(++_0x2e4153);}(_0x8330,0x16f));var _0x0833=function(_0x15d633,_0x56f3ed){_0x15d633=_0x15d633-0x0;var _0x3e0ab8=_0x8330[_0x15d633];return _0x3e0ab8;};'use strict';var _=require(_0x0833('0x0'));var moment=require(_0x0833('0x1'));var util=require(_0x0833('0x2'));var logger=require('../../../../config/logger')(_0x0833('0x3'));var timezones=require(_0x0833('0x4'))[_0x0833('0x5')];var CAMPAIGN_STATUS={'ACTIVE':_0x0833('0x6'),'BLACKLIST':'BLACKLIST','CONTACTS_RESCHEDULED':_0x0833('0x7'),'DEACTIVATED':_0x0833('0x8'),'DISACTIVED':_0x0833('0x9'),'EMPTY_INTERVAL':_0x0833('0xa'),'INACTIVE':_0x0833('0xb'),'NO_AGENTS_LOGGED':_0x0833('0xc'),'NO_AVAILABLE_CONTACTS':'AVAILABLE_CONTACTS_FINISHED','NULL_INTERVAL':'INTERVAL_IS_NULL','OVERTIME_INTERVAL':'INTERVAL_IS_OVERTIME','OVERTIME_GLOBAL_INTERVAL':'GLOBAL_INTERVAL_IS_OVERTIME','QUEUE_RECALL':_0x0833('0xd'),'RECALL_TIMEOUT':_0x0833('0xe'),'RUNNING':'RUNNING','UNKNOWN_TIMEZONE':_0x0833('0xf'),'UNREACHABLE_TRUNK':_0x0833('0x10')};exports['CAMPAIGN_STATUS']=CAMPAIGN_STATUS;function isPreviewCampaign(_0x52622f){return _0x52622f[_0x0833('0x11')]==='preview';}exports[_0x0833('0x12')]=isPreviewCampaign;function isIVRCampaign(_0xe5e390){return _0xe5e390['type']===_0x0833('0x13');}exports[_0x0833('0x14')]=isIVRCampaign;function isOutboundQueue(_0x427a2c){return _0x427a2c[_0x0833('0x15')]===_0x0833('0x16');}exports[_0x0833('0x17')]=isOutboundQueue;function isQueueCampaignActive(_0x43c049){return _0x43c049[_0x0833('0x18')];}exports[_0x0833('0x19')]=isQueueCampaignActive;function isIVRCampaignActive(_0x366436){return _0x366436[_0x0833('0x1a')];}exports[_0x0833('0x1b')]=isIVRCampaignActive;function getSeconds(_0x126f0f,_0x15d4ef){var _0x386995=moment(_0x126f0f)['milliseconds'](0x0);var _0x1da3eb=moment(_0x15d4ef)[_0x0833('0x1c')](0x0);return _0x386995['diff'](_0x1da3eb,_0x0833('0x1d'));}exports[_0x0833('0x1e')]=getSeconds;function hasQueueCampaignDataChanged(_0x2fb3cc,_0x2db69f){var _0x3902c3=![];var _0x1c100c=_0x2fb3cc[_0x0833('0x11')]!==_0x2db69f[_0x0833('0x11')]||_0x2fb3cc[_0x0833('0x18')]!==_0x2db69f[_0x0833('0x18')]||_0x2fb3cc['message']!==_0x2db69f[_0x0833('0x1f')];var _0x45a2ed=_0x2fb3cc['available']!==_0x2db69f[_0x0833('0x20')]||_0x2fb3cc[_0x0833('0x21')]!==_0x2db69f['loggedIn']||_0x2fb3cc[_0x0833('0x22')]!==_0x2db69f[_0x0833('0x22')]||_0x2fb3cc[_0x0833('0x23')]!==_0x2db69f[_0x0833('0x23')]||_0x2fb3cc[_0x0833('0x24')]!==_0x2db69f[_0x0833('0x24')]||_0x2fb3cc[_0x0833('0x25')]!==_0x2db69f[_0x0833('0x25')]||_0x2fb3cc[_0x0833('0x26')]!==_0x2db69f[_0x0833('0x26')]||_0x2fb3cc[_0x0833('0x27')]!==_0x2db69f['inUse']||_0x2fb3cc[_0x0833('0x28')]!==_0x2db69f[_0x0833('0x28')];if(_0x2fb3cc[_0x0833('0x29')]&&_0x2db69f[_0x0833('0x29')]){_0x3902c3=_0x2fb3cc[_0x0833('0x29')]['name']!==_0x2db69f[_0x0833('0x29')]['name']||_0x2fb3cc[_0x0833('0x29')][_0x0833('0x1a')]!==_0x2db69f[_0x0833('0x29')]['active'];}return _0x1c100c||_0x45a2ed||_0x3902c3;}exports[_0x0833('0x2a')]=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x6792b9){var _0x1fe125=null;var _0x16c7b0=_0x6792b9['dialTimezone'];if(_[_0x0833('0x2b')](_0x6792b9[_0x0833('0x2c')])||_[_0x0833('0x2b')](_0x6792b9[_0x0833('0x2d')])||_[_0x0833('0x2b')](_0x6792b9[_0x0833('0x2d')][_0x0833('0x2e')])){_0x1fe125=CAMPAIGN_STATUS[_0x0833('0x2f')];}else if(_['isEmpty'](_0x6792b9[_0x0833('0x2c')])||_[_0x0833('0x30')](_0x6792b9[_0x0833('0x2d')][_0x0833('0x2e')])){_0x1fe125=CAMPAIGN_STATUS[_0x0833('0x31')];}else if(_0x16c7b0&&!timezones[_0x16c7b0]){_0x1fe125=CAMPAIGN_STATUS[_0x0833('0x32')];}return _0x1fe125;}function checkAnyValidTrunk(_0x47d57b,_0x1c7f40){var _0x49ef73=null;var _0xdeda5a='SIP/';var _0x14a7ab=[_0x0833('0x33'),_0x0833('0x34')];var _0x57a299=!![];if(_0x47d57b[_0x0833('0x29')]&&_0x47d57b[_0x0833('0x29')][_0x0833('0x1a')]){_0xdeda5a+=_0x47d57b[_0x0833('0x29')][_0x0833('0x35')];_0x49ef73=_0x1c7f40[_0xdeda5a];_0x57a299=_0x14a7ab[_0x0833('0x36')](_0x49ef73['status']);}else if(_0x47d57b[_0x0833('0x37')]&&_0x47d57b[_0x0833('0x37')][_0x0833('0x1a')]){_0xdeda5a+=_0x47d57b['TrunkBackup']['name'];_0x49ef73=_0x1c7f40[_0xdeda5a];_0x57a299=_0x14a7ab[_0x0833('0x36')](_0x49ef73[_0x0833('0x38')]);}return _0x57a299;}function getQueueCampaignStatusMessage(_0x4d0d9a,_0x41ef5f){var _0x1d7eba=CAMPAIGN_STATUS[_0x0833('0x6')];var _0x4d945a=isPreviewCampaign(_0x4d0d9a);if(!isQueueCampaignActive(_0x4d0d9a)){if(_0x4d945a){_0x1d7eba=CAMPAIGN_STATUS[_0x0833('0x39')];}else{if(_0x4d0d9a[_0x0833('0x28')]===0x0&&_0x4d0d9a[_0x0833('0x24')]===0x0&&_0x4d0d9a[_0x0833('0x26')]===0x0&&(_0x4d0d9a[_0x0833('0x25')]||0x0)===0x0){_0x1d7eba=CAMPAIGN_STATUS[_0x0833('0x39')];}else{_0x1d7eba=CAMPAIGN_STATUS[_0x0833('0x3a')];}}}else if(_0x4d0d9a[_0x0833('0x21')]===0x0){_0x1d7eba=CAMPAIGN_STATUS[_0x0833('0x3b')];}else if(!checkAnyValidTrunk(_0x4d0d9a,_0x41ef5f)){_0x1d7eba=CAMPAIGN_STATUS[_0x0833('0x3c')];}else if(!isPreviewCampaign(_0x4d0d9a)){var _0x2e7301=checkAnyValidQueueCampaignInterval(_0x4d0d9a);if(_0x2e7301){_0x1d7eba=_0x2e7301;}}return _0x1d7eba;}exports[_0x0833('0x3d')]=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x5ec6d0){var _0x5c705d=CAMPAIGN_STATUS['DISACTIVED'];if(_0x5ec6d0[_0x0833('0x28')]===0x0&&_0x5ec6d0['talking']===0x0&&_0x5ec6d0[_0x0833('0x26')]===0x0&&(_0x5ec6d0['pTalking']||0x0)===0x0){_0x5c705d=CAMPAIGN_STATUS['INACTIVE'];}return _0x5c705d;}exports[_0x0833('0x3e')]=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x2a84c1){var _0x4a2b34=_0x2a84c1[_0x0833('0x3f')](/"(.*?)"/);return _0x4a2b34?_0x4a2b34[0x1]:_0x2a84c1;}exports[_0x0833('0x40')]=extractCalleridName;function getCallerId(_0xce554b,_0x4d5077,_0x35b6fa){if(!_['isUndefined'](_0x35b6fa)&&typeof _0x35b6fa===_0x0833('0x41')&&!_[_0x0833('0x30')](_0x35b6fa)){if(!_['isUndefined'](_0x4d5077)&&typeof _0x4d5077==='string'&&!_[_0x0833('0x30')](_0x4d5077)){return util[_0x0833('0x42')](_0x0833('0x43'),_0x4d5077,_0x35b6fa);}return util[_0x0833('0x42')]('\x22%s\x22\x20<%s>',_0x35b6fa,_0x35b6fa);}if(!_[_0x0833('0x44')](_0xce554b)&&typeof _0xce554b===_0x0833('0x41')&&!_[_0x0833('0x30')](_0xce554b)){return _0xce554b;}return'\x22\x22\x20<>';}exports[_0x0833('0x45')]=getCallerId;function getCallerIdRandom(_0x4d1f4e,_0x2d8ce3){var _0x261eaa;var _0x649a22;var _0x7a022a;if(_0x2d8ce3<=0x0){_0x2d8ce3=0x1;}_0x261eaa=new RegExp('\x5cw{0,'+_0x2d8ce3+'}$');_0x649a22=Math[_0x0833('0x46')](0xa,_0x2d8ce3-0x1);_0x7a022a=Math[_0x0833('0x46')](0xa,_0x2d8ce3)-0x1;return util['format']('%s',_[_0x0833('0x47')](_0x4d1f4e,_0x261eaa,_[_0x0833('0x48')](_0x649a22,_0x7a022a)[_0x0833('0x49')]()));}exports[_0x0833('0x4a')]=getCallerIdRandom;function decrementOriginate(_0x53d1b3){if(_0x53d1b3[_0x0833('0x28')]&&_0x53d1b3['originated']>0x0){_0x53d1b3['originated']-=0x1;}else{logger['error'](_0x0833('0x4b'));}}exports[_0x0833('0x4c')]=decrementOriginate;function checkContactEmpty(_0x46992b){return _0x46992b&&_0x46992b['length']>0x0;}exports[_0x0833('0x4d')]=checkContactEmpty;function erlangb(_0x2d381b,_0x1e8a09){if(_0x1e8a09===0x0){return 0x0;}var _0x4932ce=0x1;for(var _0x3f6548=0x1;_0x3f6548<=_0x1e8a09;_0x3f6548+=0x1){_0x4932ce=0x1+_0x4932ce*_0x3f6548/_0x2d381b;}return 0x1/_0x4932ce;}exports['erlangb']=erlangb;function checkContactLowerLimitOriginate(_0x131a49,_0x5c2a88,_0x178937){if(_0x5c2a88>_0x178937){for(var _0x565c9e=0x0;_0x565c9e<_0x5c2a88-_0x178937;_0x565c9e+=0x1){decrementOriginate(_0x131a49);}}}exports[_0x0833('0x4e')]=checkContactLowerLimitOriginate;function setXMDContactVariables(_0x39be38){var _0x4f70d2={};var _0x3dc06d=['id',_0x0833('0x4f'),_0x0833('0x50'),_0x0833('0x51'),_0x0833('0x52')];if(_0x39be38){for(var _0x52f551 in _0x39be38){if(typeof _0x39be38[_0x52f551]!==_0x0833('0x53')){if(!_[_0x0833('0x2b')](_0x39be38[_0x52f551])&&!_0x3dc06d[_0x0833('0x36')](_0x52f551)){_0x4f70d2[util[_0x0833('0x42')](_0x0833('0x54'),_0x0833('0x55'),_0x52f551[_0x0833('0x56')]())]=_0x39be38[_0x52f551];}}}}return _0x4f70d2;}exports[_0x0833('0x57')]=setXMDContactVariables; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index 3ee631c..64ee3b0 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(_0x567b8e,_0x4e981b){var _0x4581f9=function(_0x47b187){while(--_0x47b187){_0x567b8e['push'](_0x567b8e['shift']());}};_0x4581f9(++_0x4e981b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0xa9e0[_0x47a7d0];return _0xb9bd08;};'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(_0x13865d,_0x40f28b){var _0x7858d5=function(_0x3ba627){while(--_0x3ba627){_0x13865d['push'](_0x13865d['shift']());}};_0x7858d5(++_0x40f28b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa9e0[_0x14add3];return _0x4a174f;};'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 d5b3471..b3e75db 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 _0xe6db=['\x20result\x20conversion\x20file\x20','message','create','parse','.pdf','then','notify','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','merge','pick','response','AttachmentId','logger','[Fax][Message][Error][NoUpdate1]','updateStatus','update','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','faxpages','SUCCESS','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','execOriginate','FaxAccountId','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','checkTrunk','Trunk','isValid','Trunk\x20Reachable','execute','format','%s/%s.tif','path','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','isTrunkReachable','isNil','active','SIP/%s','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','util','lodash','uuid','moment','./util/gs','../../../config/logger','fax','../ami','./rpcDb','./channel','./util/util','./action','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','trunks','actions','newchannel','syncNewchannel','varset','bind','newstate','syncNewState','newexten','syncNewExten','faxstatus','syncFaxStatus','syncReceiveFax','hangup','syncHangup','originateresponse','syncOriginateResponse','context','from-voip-provider','hasOwnProperty','exten','localstationid','uniqueid','channel','name','info','\x20syncNewchannel\x20','prototype','variable','value','channelstate','channelstatedesc','operation','status','filename','\x20syncFaxStatus\x20','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/'];(function(_0x3e93c7,_0x9d5904){var _0xdba5b6=function(_0x3aadaa){while(--_0x3aadaa){_0x3e93c7['push'](_0x3e93c7['shift']());}};_0xdba5b6(++_0x9d5904);}(_0xe6db,0xb2));var _0xbe6d=function(_0x202f7e,_0x25dd2c){_0x202f7e=_0x202f7e-0x0;var _0x100134=_0xe6db[_0x202f7e];return _0x100134;};'use strict';var util=require(_0xbe6d('0x0'));var _=require(_0xbe6d('0x1'));var BPromise=require('bluebird');var uuid=require(_0xbe6d('0x2'));var moment=require(_0xbe6d('0x3'));var path=require('path');var tiff2pdf=require('tiff2pdf');var gs=require(_0xbe6d('0x4'));var logger=require(_0xbe6d('0x5'))(_0xbe6d('0x6'));var ami=require(_0xbe6d('0x7'));var rpcDb=require(_0xbe6d('0x8'));var Channel=require(_0xbe6d('0x9'));var ut=require(_0xbe6d('0xa'));var Action=require(_0xbe6d('0xb'));var faxAccount=require(_0xbe6d('0xc'));var attachment=require(_0xbe6d('0xd'));var faxMessage=require(_0xbe6d('0xe'));function Fax(_0x1211f5){this[_0xbe6d('0xf')]={};this[_0xbe6d('0x10')]=_0x1211f5[_0xbe6d('0x10')];this[_0xbe6d('0x11')]=_0x1211f5[_0xbe6d('0x11')];this[_0xbe6d('0x12')]={};ami['on'](_0xbe6d('0x13'),this[_0xbe6d('0x14')]['bind'](this));ami['on'](_0xbe6d('0x15'),this['syncVarSet'][_0xbe6d('0x16')](this));ami['on'](_0xbe6d('0x17'),this[_0xbe6d('0x18')][_0xbe6d('0x16')](this));ami['on'](_0xbe6d('0x19'),this[_0xbe6d('0x1a')][_0xbe6d('0x16')](this));ami['on'](_0xbe6d('0x1b'),this[_0xbe6d('0x1c')][_0xbe6d('0x16')](this));ami['on']('receivefax',this[_0xbe6d('0x1d')][_0xbe6d('0x16')](this));ami['on'](_0xbe6d('0x1e'),this[_0xbe6d('0x1f')]['bind'](this));ami['on'](_0xbe6d('0x20'),this[_0xbe6d('0x21')][_0xbe6d('0x16')](this));}Fax['prototype'][_0xbe6d('0x14')]=function(_0x3cd629){if(_0x3cd629[_0xbe6d('0x22')]===_0xbe6d('0x23')){for(var _0x5328f2 in this['faxAccounts']){if(this['faxAccounts'][_0xbe6d('0x24')](_0x5328f2)){if(_0x3cd629[_0xbe6d('0x25')]===this[_0xbe6d('0x10')][_0x5328f2][_0xbe6d('0x26')]){this['channels'][_0x3cd629[_0xbe6d('0x27')]]={};this[_0xbe6d('0xf')][_0x3cd629[_0xbe6d('0x27')]][_0xbe6d('0x28')]=_0x3cd629[_0xbe6d('0x28')];this[_0xbe6d('0xf')][_0x3cd629[_0xbe6d('0x27')]]['id']=this[_0xbe6d('0x10')][_0x5328f2]['id'];this[_0xbe6d('0xf')][_0x3cd629[_0xbe6d('0x27')]][_0xbe6d('0x29')]=this['faxAccounts'][_0x5328f2][_0xbe6d('0x29')];logger[_0xbe6d('0x2a')](_0x3cd629[_0xbe6d('0x27')],_0xbe6d('0x2b'));}}}}if(this[_0xbe6d('0x12')][_0x3cd629[_0xbe6d('0x27')]]){this['channels'][_0x3cd629['uniqueid']]={};this[_0xbe6d('0xf')][_0x3cd629[_0xbe6d('0x27')]][_0xbe6d('0x28')]=_0x3cd629[_0xbe6d('0x28')];logger['info'](_0x3cd629[_0xbe6d('0x27')],_0xbe6d('0x2b'));}};Fax[_0xbe6d('0x2c')]['syncVarSet']=function(_0x56ab53){if(this[_0xbe6d('0xf')][_0x56ab53[_0xbe6d('0x27')]]){for(var _0x5e40df in _0x56ab53['variable']){if(_0x56ab53[_0xbe6d('0x2d')]['hasOwnProperty'](_0x5e40df)){this[_0xbe6d('0xf')][_0x56ab53[_0xbe6d('0x27')]][_0x5e40df]=_0x56ab53[_0xbe6d('0x2e')];}}}};Fax[_0xbe6d('0x2c')][_0xbe6d('0x18')]=function(_0x15849b){if(this['channels'][_0x15849b[_0xbe6d('0x27')]]){this['channels'][_0x15849b[_0xbe6d('0x27')]][_0xbe6d('0x2f')]=_0x15849b[_0xbe6d('0x2f')];this[_0xbe6d('0xf')][_0x15849b[_0xbe6d('0x27')]][_0xbe6d('0x30')]=_0x15849b[_0xbe6d('0x30')];}};Fax[_0xbe6d('0x2c')]['syncNewExten']=function(_0x9814b8){if(this['channels'][_0x9814b8[_0xbe6d('0x27')]]){for(var _0x486340 in _0x9814b8[_0xbe6d('0x2d')]){if(_0x9814b8[_0xbe6d('0x2d')][_0xbe6d('0x24')](_0x486340)){this[_0xbe6d('0xf')][_0x9814b8[_0xbe6d('0x27')]][_0x486340]=_0x9814b8[_0xbe6d('0x2e')];}}}};Fax[_0xbe6d('0x2c')][_0xbe6d('0x1c')]=function(_0x3c971a){if(this['channels'][_0x3c971a[_0xbe6d('0x27')]]){this[_0xbe6d('0xf')][_0x3c971a[_0xbe6d('0x27')]]['operation']=_0x3c971a[_0xbe6d('0x31')];this['channels'][_0x3c971a[_0xbe6d('0x27')]][_0xbe6d('0x32')]=_0x3c971a['status'];this[_0xbe6d('0xf')][_0x3c971a[_0xbe6d('0x27')]]['localstationid']=_0x3c971a[_0xbe6d('0x26')];this[_0xbe6d('0xf')][_0x3c971a[_0xbe6d('0x27')]]['filename']=_0x3c971a[_0xbe6d('0x33')];logger['info'](_0x3c971a[_0xbe6d('0x27')],_0xbe6d('0x34'));}};Fax[_0xbe6d('0x2c')][_0xbe6d('0x1d')]=function(_0x221e21){var _0x5a2216=this;if(this[_0xbe6d('0xf')][_0x221e21[_0xbe6d('0x27')]]){var _0x31ac48=this[_0xbe6d('0xf')][_0x221e21[_0xbe6d('0x27')]]['id'];this[_0xbe6d('0xf')][_0x221e21[_0xbe6d('0x27')]]['remotestationid']=_0x221e21['remotestationid'];this['channels'][_0x221e21[_0xbe6d('0x27')]]['pagestransferred']=_0x221e21[_0xbe6d('0x35')];this[_0xbe6d('0xf')][_0x221e21[_0xbe6d('0x27')]]['localstationid']=_0x221e21[_0xbe6d('0x26')];this[_0xbe6d('0xf')][_0x221e21[_0xbe6d('0x27')]][_0xbe6d('0x36')]=_0x221e21[_0xbe6d('0x36')];this['channels'][_0x221e21[_0xbe6d('0x27')]][_0xbe6d('0x37')]=_0x221e21[_0xbe6d('0x37')];this[_0xbe6d('0xf')][_0x221e21[_0xbe6d('0x27')]][_0xbe6d('0x33')]=_0x221e21[_0xbe6d('0x33')];this[_0xbe6d('0xf')][_0x221e21[_0xbe6d('0x27')]][_0xbe6d('0x38')]=_0x221e21[_0xbe6d('0x38')];if(this['channels'][_0x221e21[_0xbe6d('0x27')]][_0xbe6d('0x35')]>0x0){tiff2pdf(_0x221e21[_0xbe6d('0x33')],_0xbe6d('0x39'),function(_0x782c90){logger['info'](_0x221e21[_0xbe6d('0x27')],_0xbe6d('0x3a'),_0x782c90[_0xbe6d('0x3b')]);attachment[_0xbe6d('0x3c')]({'name':path[_0xbe6d('0x3d')](_0x221e21['filename'])[_0xbe6d('0x29')],'basename':path[_0xbe6d('0x3d')](_0x221e21[_0xbe6d('0x33')])[_0xbe6d('0x29')]+_0xbe6d('0x3e'),'type':'application/pdf'})[_0xbe6d('0x3f')](function(_0x591dde){faxAccount[_0xbe6d('0x40')](_0x31ac48,{'from':_0x221e21[_0xbe6d('0x38')],'mapKey':_0xbe6d('0x6'),'body':path[_0xbe6d('0x3d')](_0x221e21[_0xbe6d('0x33')])[_0xbe6d('0x29')]+_0xbe6d('0x3e'),'AttachmentId':_0x591dde['id']})[_0xbe6d('0x41')](function(_0x295ceb){logger[_0xbe6d('0x42')](_0x221e21[_0xbe6d('0x27')],_0xbe6d('0x43'),JSON[_0xbe6d('0x44')](_0x295ceb));});})[_0xbe6d('0x41')](function(_0xd8ce86){logger['error'](_0x221e21[_0xbe6d('0x27')],'\x20receiveFax\x20',JSON[_0xbe6d('0x44')](_0xd8ce86));});});}logger['info'](_0x221e21[_0xbe6d('0x27')],_0xbe6d('0x45'));}};Fax[_0xbe6d('0x2c')][_0xbe6d('0x21')]=function(_0x2e84a1){if(this[_0xbe6d('0x12')][_0x2e84a1[_0xbe6d('0x27')]]){_[_0xbe6d('0x46')](this[_0xbe6d('0xf')][_0x2e84a1['uniqueid']],_[_0xbe6d('0x47')](_0x2e84a1,[_0xbe6d('0x48'),'reason']));}};function updateStatus(_0x538dea){if(_0x538dea[_0xbe6d('0x49')]){faxMessage['update'](_0x538dea[_0xbe6d('0x49')],{'failMessage':'SENDING\x20FAILED\x20'})[_0xbe6d('0x3f')](function(_0x5d3262){ut[_0xbe6d('0x4a')]('[Fax][Message][Error][Updated]',_0x5d3262);})[_0xbe6d('0x41')](function(_0x570cf3){ut[_0xbe6d('0x4a')](_0xbe6d('0x4b'),_0x570cf3);});}else{ut[_0xbe6d('0x4a')]('[Fax][Message][Error][NoUpdate2]');}}Fax[_0xbe6d('0x2c')][_0xbe6d('0x4c')]=function(_0x24c231,_0x29650e,_0x4e45e8){var _0xefdfcc=this;var _0x153e45={};if(_0x29650e){_0x153e45={'read':_0x29650e};}else{_0x153e45={'failMessage':_0x4e45e8};}if(this[_0xbe6d('0x12')][_0x24c231][_0xbe6d('0x49')]){faxMessage[_0xbe6d('0x4d')](this[_0xbe6d('0x12')][_0x24c231][_0xbe6d('0x49')],_0x153e45)[_0xbe6d('0x3f')](function(_0x11347d){ut[_0xbe6d('0x4a')]('[Fax][Message][Updated]',_0x11347d);})[_0xbe6d('0x41')](function(_0x599c89){ut[_0xbe6d('0x4a')](_0xbe6d('0x4e'),_0x599c89);})[_0xbe6d('0x4f')](function(){delete _0xefdfcc['channels'][_0x24c231];delete _0xefdfcc[_0xbe6d('0x12')][_0x24c231];});}else{ut[_0xbe6d('0x4a')](_0xbe6d('0x50'));delete this[_0xbe6d('0xf')][_0x24c231];delete this[_0xbe6d('0x12')][_0x24c231];}};Fax[_0xbe6d('0x2c')]['syncHangup']=function(_0x27d9e9){var _0x361960=this;if(this[_0xbe6d('0xf')][_0x27d9e9['uniqueid']]){if(this[_0xbe6d('0x12')][_0x27d9e9['uniqueid']]){this['channels'][_0x27d9e9[_0xbe6d('0x27')]]['id']=this[_0xbe6d('0x12')][_0x27d9e9[_0xbe6d('0x27')]]['id'];this[_0xbe6d('0xf')][_0x27d9e9[_0xbe6d('0x27')]][_0xbe6d('0x29')]=this[_0xbe6d('0x12')][_0x27d9e9['uniqueid']]['name'];}logger[_0xbe6d('0x2a')](_0x27d9e9[_0xbe6d('0x27')],this[_0xbe6d('0x12')][_0x27d9e9['uniqueid']]?_0xbe6d('0x51'):'\x20hangup\x20faxRiceive\x20',JSON[_0xbe6d('0x44')](this[_0xbe6d('0xf')][_0x27d9e9[_0xbe6d('0x27')]]));if(this[_0xbe6d('0x12')][_0x27d9e9[_0xbe6d('0x27')]]){if(this[_0xbe6d('0xf')][_0x27d9e9[_0xbe6d('0x27')]][_0xbe6d('0x52')]>0x0&&this[_0xbe6d('0xf')][_0x27d9e9[_0xbe6d('0x27')]][_0xbe6d('0x1b')]===_0xbe6d('0x53')){this[_0xbe6d('0x4c')](_0x27d9e9[_0xbe6d('0x27')],!![]);}else{this['updateStatus'](_0x27d9e9[_0xbe6d('0x27')],![],this[_0xbe6d('0xf')][_0x27d9e9['uniqueid']][_0xbe6d('0x54')]?_0xbe6d('0x55')+this[_0xbe6d('0xf')][_0x27d9e9[_0xbe6d('0x27')]][_0xbe6d('0x54')]:_0xbe6d('0x56'));}}}};Fax[_0xbe6d('0x2c')]['send']=function(_0x434e77){var _0x1cbc38=this;return new BPromise(function(_0x296ede,_0x2d1140){_0x1cbc38[_0xbe6d('0x57')](_0x434e77,_0x1cbc38[_0xbe6d('0x10')][_0x434e77[_0xbe6d('0x58')]])[_0xbe6d('0x3f')](function(_0x17cc66){ut[_0xbe6d('0x4a')](_0xbe6d('0x59'),_0x17cc66);_0x296ede(ut[_0xbe6d('0x3b')](_0xbe6d('0x5a')));})['catch'](function(_0x2735db){ut[_0xbe6d('0x4a')](_0xbe6d('0x5b'),_0x2735db);updateStatus(_0x434e77);_0x2d1140(ut[_0xbe6d('0x3b')](_0xbe6d('0x5c')));});});};Fax[_0xbe6d('0x2c')][_0xbe6d('0x5d')]=function(_0x3d9d55){var _0x305610=this;return new BPromise(function(_0x16a169,_0xbbbcd5){var _0x35e27c=_0x305610[_0xbe6d('0x5e')](_0x305610[_0xbe6d('0x10')][_0x3d9d55[_0xbe6d('0x58')]][_0xbe6d('0x5f')],_0x3d9d55);if(_0x35e27c[_0xbe6d('0x60')]){_0x16a169(ut[_0xbe6d('0x3b')](_0xbe6d('0x61')));}else{_0xbbbcd5(ut[_0xbe6d('0x3b')](_0x35e27c['message']));}});};function originate(_0xb17efb,_0x2dc540,_0x1995e2){return new BPromise(function(_0x23eba5,_0x244f54){if(_0x1995e2){var _0x499d47=util['format']('gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit',path['parse'](_0xb17efb['path'])[_0xbe6d('0x29')],_0xb17efb['path']);gs[_0xbe6d('0x62')](_0x499d47)[_0xbe6d('0x3f')](function(){_0xb17efb['path']=util[_0xbe6d('0x63')](_0xbe6d('0x64'),path[_0xbe6d('0x3d')](_0xb17efb[_0xbe6d('0x65')])['dir'],path['parse'](_0xb17efb['path'])[_0xbe6d('0x29')]);_0x2dc540['XMF-PATH']=_0xb17efb[_0xbe6d('0x65')];ut[_0xbe6d('0x4a')](_0xbe6d('0x66'),'');ami[_0xbe6d('0x67')](ut[_0xbe6d('0x68')](_0xb17efb,_0x2dc540))[_0xbe6d('0x3f')](function(_0x5156dc){_0x23eba5(_0x5156dc);})[_0xbe6d('0x41')](function(_0x8725d9){_0x244f54(_0x8725d9);});})[_0xbe6d('0x41')](function(_0x5f3c0f){_0x244f54(_0x5f3c0f);});}else{ami[_0xbe6d('0x67')](ut[_0xbe6d('0x68')](_0xb17efb,_0x2dc540))[_0xbe6d('0x3f')](function(_0x36ef04){_0x23eba5(_0x36ef04);})['catch'](function(_0x3ec7ed){_0x244f54(_0x3ec7ed);});}});}Fax[_0xbe6d('0x2c')][_0xbe6d('0x57')]=function(_0x167e23,_0x2ab71a){var _0x54d3cb=this;return new BPromise(function(_0x4bdc9b,_0x4a85a2){var _0x1076b7=uuid['v4']();var _0x385aeb=ut[_0xbe6d('0x69')](_0x167e23,_0x2ab71a);_0x54d3cb[_0xbe6d('0x12')][_0x1076b7]=new Action(_0x1076b7,_0x2ab71a,_0x167e23);var _0x43adeb=_0x54d3cb['actions'][_0x1076b7];if(path['parse'](_0x167e23[_0xbe6d('0x65')])['ext']===_0xbe6d('0x3e')){originate(_0x43adeb,_0x385aeb,!![])[_0xbe6d('0x3f')](function(_0x2eef6c){_0x4bdc9b(_0x2eef6c);})[_0xbe6d('0x41')](function(_0x3cfde4){_0x4a85a2(_0x3cfde4);});}else{originate(_0x43adeb,_0x385aeb,![])[_0xbe6d('0x3f')](function(_0x93e7d7){_0x4bdc9b(_0x93e7d7);})['catch'](function(_0x153b11){_0x4a85a2(_0x153b11);});}});};Fax['prototype'][_0xbe6d('0x6a')]=function(_0xc979ff){return!_[_0xbe6d('0x6b')](_0xc979ff)&&!_[_0xbe6d('0x6b')](_0xc979ff[_0xbe6d('0x29')])&&!_[_0xbe6d('0x6b')](_0xc979ff[_0xbe6d('0x6c')])&&_0xc979ff[_0xbe6d('0x6c')]&&!_[_0xbe6d('0x6b')](this[_0xbe6d('0x11')][util['format'](_0xbe6d('0x6d'),_0xc979ff[_0xbe6d('0x29')])])&&!_[_0xbe6d('0x6b')](this[_0xbe6d('0x11')][util[_0xbe6d('0x63')](_0xbe6d('0x6d'),_0xc979ff['name'])][_0xbe6d('0x32')])&&(this[_0xbe6d('0x11')][util[_0xbe6d('0x63')](_0xbe6d('0x6d'),_0xc979ff[_0xbe6d('0x29')])][_0xbe6d('0x32')]==='reachable'||this['trunks'][util[_0xbe6d('0x63')](_0xbe6d('0x6d'),_0xc979ff[_0xbe6d('0x29')])][_0xbe6d('0x32')]===_0xbe6d('0x6e'));};Fax[_0xbe6d('0x2c')][_0xbe6d('0x5e')]=function(_0x389e67,_0x4245aa){if(!this[_0xbe6d('0x6a')](_0x389e67)){ut[_0xbe6d('0x4a')](_0xbe6d('0x6f'),_[_0xbe6d('0x6b')](_0x389e67)?'':_0x389e67[_0xbe6d('0x29')]+_0xbe6d('0x70'));return{'isValid':![],'message':_0xbe6d('0x71')};}if(_[_0xbe6d('0x6b')](_0x4245aa[_0xbe6d('0x6')])){ut[_0xbe6d('0x4a')]('[Fax][checkTrunk][Empty\x20Fax]',JSON['stringify'](_0x4245aa));return{'isValid':![],'message':_0xbe6d('0x72')};}if(_[_0xbe6d('0x6b')](_0x4245aa[_0xbe6d('0x65')])){ut[_0xbe6d('0x4a')](_0xbe6d('0x73'),JSON['stringify'](_0x4245aa));return{'isValid':![],'message':_0xbe6d('0x74')};}return{'isValid':!![],'message':_0xbe6d('0x75')};};module['exports']=Fax; \ No newline at end of file +var _0x96ac=['\x20hangup\x20faxRiceive\x20','faxpages','SUCCESS','updateStatus','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','send','message','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','FaxAccountId','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','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','ext','isNil','active','SIP/%s','reachable','checkTrunk','isTrunkReachable','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','Trunk\x20not\x20working\x20correctly','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','exports','util','lodash','bluebird','moment','path','tiff2pdf','./util/gs','../ami','./rpcDb','./channel','./util/util','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','trunks','actions','newchannel','syncNewchannel','bind','varset','syncVarSet','newstate','syncNewState','syncNewExten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','hangup','syncHangup','context','from-voip-provider','hasOwnProperty','exten','localstationid','uniqueid','channel','name','\x20syncNewchannel\x20','info','prototype','value','channelstate','channelstatedesc','variable','operation','status','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','create','parse','.pdf','application/pdf','then','notify','fax','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','syncOriginateResponse','merge','pick','response','reason','AttachmentId','update','SENDING\x20FAILED\x20','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','logger','[Fax][Message][Error][NoUpdate2]','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20'];(function(_0x5a8269,_0xfb2f54){var _0x539ed7=function(_0x31ce98){while(--_0x31ce98){_0x5a8269['push'](_0x5a8269['shift']());}};_0x539ed7(++_0xfb2f54);}(_0x96ac,0xa6));var _0xc96a=function(_0x5cd419,_0x2b9298){_0x5cd419=_0x5cd419-0x0;var _0xfaf740=_0x96ac[_0x5cd419];return _0xfaf740;};'use strict';var util=require(_0xc96a('0x0'));var _=require(_0xc96a('0x1'));var BPromise=require(_0xc96a('0x2'));var uuid=require('uuid');var moment=require(_0xc96a('0x3'));var path=require(_0xc96a('0x4'));var tiff2pdf=require(_0xc96a('0x5'));var gs=require(_0xc96a('0x6'));var logger=require('../../../config/logger')('fax');var ami=require(_0xc96a('0x7'));var rpcDb=require(_0xc96a('0x8'));var Channel=require(_0xc96a('0x9'));var ut=require(_0xc96a('0xa'));var Action=require('./action');var faxAccount=require('../rpc/faxAccount');var attachment=require(_0xc96a('0xb'));var faxMessage=require(_0xc96a('0xc'));function Fax(_0xf13607){this[_0xc96a('0xd')]={};this[_0xc96a('0xe')]=_0xf13607['faxAccounts'];this['trunks']=_0xf13607[_0xc96a('0xf')];this[_0xc96a('0x10')]={};ami['on'](_0xc96a('0x11'),this[_0xc96a('0x12')][_0xc96a('0x13')](this));ami['on'](_0xc96a('0x14'),this[_0xc96a('0x15')]['bind'](this));ami['on'](_0xc96a('0x16'),this[_0xc96a('0x17')]['bind'](this));ami['on']('newexten',this[_0xc96a('0x18')][_0xc96a('0x13')](this));ami['on'](_0xc96a('0x19'),this[_0xc96a('0x1a')][_0xc96a('0x13')](this));ami['on'](_0xc96a('0x1b'),this[_0xc96a('0x1c')][_0xc96a('0x13')](this));ami['on'](_0xc96a('0x1d'),this[_0xc96a('0x1e')][_0xc96a('0x13')](this));ami['on']('originateresponse',this['syncOriginateResponse']['bind'](this));}Fax['prototype'][_0xc96a('0x12')]=function(_0xcb9067){if(_0xcb9067[_0xc96a('0x1f')]===_0xc96a('0x20')){for(var _0x34fe38 in this[_0xc96a('0xe')]){if(this[_0xc96a('0xe')][_0xc96a('0x21')](_0x34fe38)){if(_0xcb9067[_0xc96a('0x22')]===this[_0xc96a('0xe')][_0x34fe38][_0xc96a('0x23')]){this[_0xc96a('0xd')][_0xcb9067[_0xc96a('0x24')]]={};this[_0xc96a('0xd')][_0xcb9067[_0xc96a('0x24')]][_0xc96a('0x25')]=_0xcb9067[_0xc96a('0x25')];this[_0xc96a('0xd')][_0xcb9067[_0xc96a('0x24')]]['id']=this[_0xc96a('0xe')][_0x34fe38]['id'];this[_0xc96a('0xd')][_0xcb9067[_0xc96a('0x24')]][_0xc96a('0x26')]=this[_0xc96a('0xe')][_0x34fe38]['name'];logger['info'](_0xcb9067[_0xc96a('0x24')],_0xc96a('0x27'));}}}}if(this[_0xc96a('0x10')][_0xcb9067[_0xc96a('0x24')]]){this['channels'][_0xcb9067['uniqueid']]={};this[_0xc96a('0xd')][_0xcb9067['uniqueid']][_0xc96a('0x25')]=_0xcb9067['channel'];logger[_0xc96a('0x28')](_0xcb9067['uniqueid'],'\x20syncNewchannel\x20');}};Fax[_0xc96a('0x29')][_0xc96a('0x15')]=function(_0x46963e){if(this[_0xc96a('0xd')][_0x46963e[_0xc96a('0x24')]]){for(var _0x41691f in _0x46963e['variable']){if(_0x46963e['variable']['hasOwnProperty'](_0x41691f)){this[_0xc96a('0xd')][_0x46963e['uniqueid']][_0x41691f]=_0x46963e[_0xc96a('0x2a')];}}}};Fax[_0xc96a('0x29')]['syncNewState']=function(_0x16b958){if(this[_0xc96a('0xd')][_0x16b958[_0xc96a('0x24')]]){this[_0xc96a('0xd')][_0x16b958[_0xc96a('0x24')]][_0xc96a('0x2b')]=_0x16b958['channelstate'];this['channels'][_0x16b958[_0xc96a('0x24')]][_0xc96a('0x2c')]=_0x16b958['channelstatedesc'];}};Fax['prototype'][_0xc96a('0x18')]=function(_0x5e290f){if(this[_0xc96a('0xd')][_0x5e290f[_0xc96a('0x24')]]){for(var _0x2efe4f in _0x5e290f[_0xc96a('0x2d')]){if(_0x5e290f[_0xc96a('0x2d')][_0xc96a('0x21')](_0x2efe4f)){this[_0xc96a('0xd')][_0x5e290f[_0xc96a('0x24')]][_0x2efe4f]=_0x5e290f['value'];}}}};Fax[_0xc96a('0x29')][_0xc96a('0x1a')]=function(_0x50f9cc){if(this[_0xc96a('0xd')][_0x50f9cc[_0xc96a('0x24')]]){this[_0xc96a('0xd')][_0x50f9cc[_0xc96a('0x24')]][_0xc96a('0x2e')]=_0x50f9cc['operation'];this[_0xc96a('0xd')][_0x50f9cc[_0xc96a('0x24')]][_0xc96a('0x2f')]=_0x50f9cc[_0xc96a('0x2f')];this[_0xc96a('0xd')][_0x50f9cc['uniqueid']][_0xc96a('0x23')]=_0x50f9cc[_0xc96a('0x23')];this[_0xc96a('0xd')][_0x50f9cc[_0xc96a('0x24')]][_0xc96a('0x30')]=_0x50f9cc[_0xc96a('0x30')];logger['info'](_0x50f9cc['uniqueid'],_0xc96a('0x31'));}};Fax[_0xc96a('0x29')][_0xc96a('0x1c')]=function(_0x115a7b){var _0x29d694=this;if(this[_0xc96a('0xd')][_0x115a7b[_0xc96a('0x24')]]){var _0xc6ec8b=this['channels'][_0x115a7b[_0xc96a('0x24')]]['id'];this[_0xc96a('0xd')][_0x115a7b[_0xc96a('0x24')]][_0xc96a('0x32')]=_0x115a7b[_0xc96a('0x32')];this[_0xc96a('0xd')][_0x115a7b[_0xc96a('0x24')]][_0xc96a('0x33')]=_0x115a7b['pagestransferred'];this['channels'][_0x115a7b[_0xc96a('0x24')]][_0xc96a('0x23')]=_0x115a7b[_0xc96a('0x23')];this['channels'][_0x115a7b[_0xc96a('0x24')]]['resolution']=_0x115a7b[_0xc96a('0x34')];this[_0xc96a('0xd')][_0x115a7b['uniqueid']][_0xc96a('0x35')]=_0x115a7b[_0xc96a('0x35')];this['channels'][_0x115a7b[_0xc96a('0x24')]][_0xc96a('0x30')]=_0x115a7b['filename'];this[_0xc96a('0xd')][_0x115a7b[_0xc96a('0x24')]][_0xc96a('0x36')]=_0x115a7b['calleridnum'];if(this[_0xc96a('0xd')][_0x115a7b['uniqueid']][_0xc96a('0x33')]>0x0){tiff2pdf(_0x115a7b[_0xc96a('0x30')],_0xc96a('0x37'),function(_0x2c9131){logger[_0xc96a('0x28')](_0x115a7b[_0xc96a('0x24')],_0xc96a('0x38'),_0x2c9131['message']);attachment[_0xc96a('0x39')]({'name':path[_0xc96a('0x3a')](_0x115a7b[_0xc96a('0x30')])[_0xc96a('0x26')],'basename':path[_0xc96a('0x3a')](_0x115a7b[_0xc96a('0x30')])['name']+_0xc96a('0x3b'),'type':_0xc96a('0x3c')})[_0xc96a('0x3d')](function(_0xc45701){faxAccount[_0xc96a('0x3e')](_0xc6ec8b,{'from':_0x115a7b['calleridnum'],'mapKey':_0xc96a('0x3f'),'body':path[_0xc96a('0x3a')](_0x115a7b['filename'])[_0xc96a('0x26')]+_0xc96a('0x3b'),'AttachmentId':_0xc45701['id']})[_0xc96a('0x40')](function(_0x4246e9){logger[_0xc96a('0x41')](_0x115a7b[_0xc96a('0x24')],_0xc96a('0x42'),JSON[_0xc96a('0x43')](_0x4246e9));});})[_0xc96a('0x40')](function(_0x14ae86){logger[_0xc96a('0x41')](_0x115a7b[_0xc96a('0x24')],_0xc96a('0x44'),JSON[_0xc96a('0x43')](_0x14ae86));});});}logger['info'](_0x115a7b['uniqueid'],'\x20receiveFax\x20');}};Fax[_0xc96a('0x29')][_0xc96a('0x45')]=function(_0x3c2800){if(this[_0xc96a('0x10')][_0x3c2800[_0xc96a('0x24')]]){_[_0xc96a('0x46')](this[_0xc96a('0xd')][_0x3c2800[_0xc96a('0x24')]],_[_0xc96a('0x47')](_0x3c2800,[_0xc96a('0x48'),_0xc96a('0x49')]));}};function updateStatus(_0x45da21){if(_0x45da21[_0xc96a('0x4a')]){faxMessage[_0xc96a('0x4b')](_0x45da21[_0xc96a('0x4a')],{'failMessage':_0xc96a('0x4c')})[_0xc96a('0x3d')](function(_0x137833){ut['logger'](_0xc96a('0x4d'),_0x137833);})[_0xc96a('0x40')](function(_0x37eaa5){ut['logger'](_0xc96a('0x4e'),_0x37eaa5);});}else{ut[_0xc96a('0x4f')](_0xc96a('0x50'));}}Fax['prototype']['updateStatus']=function(_0x4a77ca,_0x1abafb,_0x421ccf){var _0x3ed2d0=this;var _0x64c993={};if(_0x1abafb){_0x64c993={'read':_0x1abafb};}else{_0x64c993={'failMessage':_0x421ccf};}if(this['actions'][_0x4a77ca][_0xc96a('0x4a')]){faxMessage['update'](this['actions'][_0x4a77ca][_0xc96a('0x4a')],_0x64c993)[_0xc96a('0x3d')](function(_0x193cf1){ut[_0xc96a('0x4f')](_0xc96a('0x51'),_0x193cf1);})[_0xc96a('0x40')](function(_0x3f3cba){ut[_0xc96a('0x4f')](_0xc96a('0x52'),_0x3f3cba);})[_0xc96a('0x53')](function(){delete _0x3ed2d0['channels'][_0x4a77ca];delete _0x3ed2d0[_0xc96a('0x10')][_0x4a77ca];});}else{ut[_0xc96a('0x4f')](_0xc96a('0x54'));delete this[_0xc96a('0xd')][_0x4a77ca];delete this['actions'][_0x4a77ca];}};Fax[_0xc96a('0x29')][_0xc96a('0x1e')]=function(_0x19d244){var _0x353c00=this;if(this[_0xc96a('0xd')][_0x19d244[_0xc96a('0x24')]]){if(this[_0xc96a('0x10')][_0x19d244[_0xc96a('0x24')]]){this['channels'][_0x19d244['uniqueid']]['id']=this[_0xc96a('0x10')][_0x19d244[_0xc96a('0x24')]]['id'];this['channels'][_0x19d244[_0xc96a('0x24')]][_0xc96a('0x26')]=this['actions'][_0x19d244['uniqueid']][_0xc96a('0x26')];}logger[_0xc96a('0x28')](_0x19d244[_0xc96a('0x24')],this['actions'][_0x19d244[_0xc96a('0x24')]]?_0xc96a('0x55'):_0xc96a('0x56'),JSON[_0xc96a('0x43')](this[_0xc96a('0xd')][_0x19d244[_0xc96a('0x24')]]));if(this[_0xc96a('0x10')][_0x19d244['uniqueid']]){if(this['channels'][_0x19d244[_0xc96a('0x24')]][_0xc96a('0x57')]>0x0&&this[_0xc96a('0xd')][_0x19d244[_0xc96a('0x24')]][_0xc96a('0x19')]===_0xc96a('0x58')){this['updateStatus'](_0x19d244[_0xc96a('0x24')],!![]);}else{this[_0xc96a('0x59')](_0x19d244[_0xc96a('0x24')],![],this[_0xc96a('0xd')][_0x19d244[_0xc96a('0x24')]][_0xc96a('0x5a')]?_0xc96a('0x5b')+this[_0xc96a('0xd')][_0x19d244[_0xc96a('0x24')]]['faxstatusstring']:_0xc96a('0x5c'));}}}};Fax[_0xc96a('0x29')][_0xc96a('0x5d')]=function(_0x3422ec){var _0x48cc1c=this;return new BPromise(function(_0x398ba1,_0x7d54b){_0x48cc1c['execOriginate'](_0x3422ec,_0x48cc1c[_0xc96a('0xe')][_0x3422ec['FaxAccountId']])[_0xc96a('0x3d')](function(_0x3d149e){ut[_0xc96a('0x4f')]('[Fax][execOriginate][success]',_0x3d149e);_0x398ba1(ut[_0xc96a('0x5e')](_0xc96a('0x5f')));})['catch'](function(_0x5bc620){ut[_0xc96a('0x4f')](_0xc96a('0x60'),_0x5bc620);updateStatus(_0x3422ec);_0x7d54b(ut['message'](_0xc96a('0x61')));});});};Fax[_0xc96a('0x29')][_0xc96a('0x62')]=function(_0x143969){var _0x1cec06=this;return new BPromise(function(_0x455e9f,_0x36c381){var _0x45b0eb=_0x1cec06['checkTrunk'](_0x1cec06[_0xc96a('0xe')][_0x143969[_0xc96a('0x63')]][_0xc96a('0x64')],_0x143969);if(_0x45b0eb[_0xc96a('0x65')]){_0x455e9f(ut[_0xc96a('0x5e')](_0xc96a('0x66')));}else{_0x36c381(ut[_0xc96a('0x5e')](_0x45b0eb['message']));}});};function originate(_0x43fb96,_0x65ac6e,_0x4786ac){return new BPromise(function(_0x55b354,_0x4afbbb){if(_0x4786ac){var _0x7895ea=util[_0xc96a('0x67')](_0xc96a('0x68'),path['parse'](_0x43fb96[_0xc96a('0x4')])[_0xc96a('0x26')],_0x43fb96[_0xc96a('0x4')]);gs[_0xc96a('0x69')](_0x7895ea)[_0xc96a('0x3d')](function(){_0x43fb96[_0xc96a('0x4')]=util[_0xc96a('0x67')](_0xc96a('0x6a'),path[_0xc96a('0x3a')](_0x43fb96[_0xc96a('0x4')])[_0xc96a('0x6b')],path[_0xc96a('0x3a')](_0x43fb96[_0xc96a('0x4')])['name']);_0x65ac6e['XMF-PATH']=_0x43fb96['path'];ut['logger'](_0xc96a('0x6c'),'');ami[_0xc96a('0x6d')](ut[_0xc96a('0x6e')](_0x43fb96,_0x65ac6e))[_0xc96a('0x3d')](function(_0xaad936){_0x55b354(_0xaad936);})[_0xc96a('0x40')](function(_0x5bcb2d){_0x4afbbb(_0x5bcb2d);});})['catch'](function(_0x4707ea){_0x4afbbb(_0x4707ea);});}else{ami['Action'](ut[_0xc96a('0x6e')](_0x43fb96,_0x65ac6e))[_0xc96a('0x3d')](function(_0x3f9758){_0x55b354(_0x3f9758);})['catch'](function(_0x178667){_0x4afbbb(_0x178667);});}});}Fax[_0xc96a('0x29')]['execOriginate']=function(_0x3ea03b,_0x2dbed6){var _0x1cf4b1=this;return new BPromise(function(_0x416346,_0x1c6995){var _0x23ccef=uuid['v4']();var _0x5891aa=ut[_0xc96a('0x6f')](_0x3ea03b,_0x2dbed6);_0x1cf4b1[_0xc96a('0x10')][_0x23ccef]=new Action(_0x23ccef,_0x2dbed6,_0x3ea03b);var _0x25788f=_0x1cf4b1[_0xc96a('0x10')][_0x23ccef];if(path[_0xc96a('0x3a')](_0x3ea03b[_0xc96a('0x4')])[_0xc96a('0x70')]===_0xc96a('0x3b')){originate(_0x25788f,_0x5891aa,!![])[_0xc96a('0x3d')](function(_0x850a51){_0x416346(_0x850a51);})[_0xc96a('0x40')](function(_0x5f324e){_0x1c6995(_0x5f324e);});}else{originate(_0x25788f,_0x5891aa,![])[_0xc96a('0x3d')](function(_0x3648af){_0x416346(_0x3648af);})[_0xc96a('0x40')](function(_0x594e67){_0x1c6995(_0x594e67);});}});};Fax[_0xc96a('0x29')]['isTrunkReachable']=function(_0x1b766d){return!_[_0xc96a('0x71')](_0x1b766d)&&!_[_0xc96a('0x71')](_0x1b766d[_0xc96a('0x26')])&&!_['isNil'](_0x1b766d[_0xc96a('0x72')])&&_0x1b766d[_0xc96a('0x72')]&&!_['isNil'](this[_0xc96a('0xf')][util[_0xc96a('0x67')](_0xc96a('0x73'),_0x1b766d['name'])])&&!_[_0xc96a('0x71')](this['trunks'][util['format'](_0xc96a('0x73'),_0x1b766d[_0xc96a('0x26')])][_0xc96a('0x2f')])&&(this[_0xc96a('0xf')][util['format'](_0xc96a('0x73'),_0x1b766d[_0xc96a('0x26')])][_0xc96a('0x2f')]===_0xc96a('0x74')||this['trunks'][util[_0xc96a('0x67')](_0xc96a('0x73'),_0x1b766d[_0xc96a('0x26')])][_0xc96a('0x2f')]==='unmonitored');};Fax[_0xc96a('0x29')][_0xc96a('0x75')]=function(_0x12a817,_0x541b8c){if(!this[_0xc96a('0x76')](_0x12a817)){ut[_0xc96a('0x4f')](_0xc96a('0x77'),_[_0xc96a('0x71')](_0x12a817)?'':_0x12a817[_0xc96a('0x26')]+'\x20Trunk\x20is\x20not\x20active');return{'isValid':![],'message':_0xc96a('0x78')};}if(_[_0xc96a('0x71')](_0x541b8c[_0xc96a('0x3f')])){ut[_0xc96a('0x4f')]('[Fax][checkTrunk][Empty\x20Fax]',JSON['stringify'](_0x541b8c));return{'isValid':![],'message':_0xc96a('0x79')};}if(_[_0xc96a('0x71')](_0x541b8c[_0xc96a('0x4')])){ut[_0xc96a('0x4f')](_0xc96a('0x7a'),JSON[_0xc96a('0x43')](_0x541b8c));return{'isValid':![],'message':_0xc96a('0x7b')};}return{'isValid':!![],'message':_0xc96a('0x7c')};};module[_0xc96a('0x7d')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index ba8b008..079ecec 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 _0xdab7=['../../../config/logger','preview','lodash','../rpc/faxAccount','error','notify','resolve','catch','util','bluebird'];(function(_0x403fc7,_0x32931a){var _0x5d0827=function(_0x5ea698){while(--_0x5ea698){_0x403fc7['push'](_0x403fc7['shift']());}};_0x5d0827(++_0x32931a);}(_0xdab7,0xa8));var _0x7dab=function(_0x5c0f70,_0x3c7902){_0x5c0f70=_0x5c0f70-0x0;var _0x1c5f19=_0xdab7[_0x5c0f70];return _0x1c5f19;};'use strict';var util=require(_0x7dab('0x0'));var BPromise=require(_0x7dab('0x1'));var logger=require(_0x7dab('0x2'))(_0x7dab('0x3'));var _=require(_0x7dab('0x4'));var faxAccount=require(_0x7dab('0x5'));function loggerCatch(_0x5a1f2d){return function(_0x5ee6d9){logger[_0x7dab('0x6')](_0x5a1f2d,util['inspect'](_0x5ee6d9,{'showHidden':![],'depth':null}));};}exports[_0x7dab('0x7')]=function(_0x3dc0bc,_0x561c68){return BPromise[_0x7dab('0x8')]()['then'](faxAccount[_0x7dab('0x7')](_0x3dc0bc,_0x561c68))[_0x7dab('0x9')](loggerCatch('[Notify]\x20'));}; \ No newline at end of file +var _0xf7ff=['preview','../rpc/faxAccount','error','notify','resolve','catch','[Notify]\x20','util','bluebird','../../../config/logger'];(function(_0x428e4f,_0x2d12fc){var _0x4f7549=function(_0x3a5d69){while(--_0x3a5d69){_0x428e4f['push'](_0x428e4f['shift']());}};_0x4f7549(++_0x2d12fc);}(_0xf7ff,0x115));var _0xff7f=function(_0x7679c6,_0x5a12d3){_0x7679c6=_0x7679c6-0x0;var _0x5e1600=_0xf7ff[_0x7679c6];return _0x5e1600;};'use strict';var util=require(_0xff7f('0x0'));var BPromise=require(_0xff7f('0x1'));var logger=require(_0xff7f('0x2'))(_0xff7f('0x3'));var _=require('lodash');var faxAccount=require(_0xff7f('0x4'));function loggerCatch(_0x1f9bc4){return function(_0x4ae1b2){logger[_0xff7f('0x5')](_0x1f9bc4,util['inspect'](_0x4ae1b2,{'showHidden':![],'depth':null}));};}exports[_0xff7f('0x6')]=function(_0x41d550,_0x3491f5){return BPromise[_0xff7f('0x7')]()['then'](faxAccount[_0xff7f('0x6')](_0x41d550,_0x3491f5))[_0xff7f('0x8')](loggerCatch(_0xff7f('0x9')));}; \ 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 502dec0..62f38ed 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 _0xfd11=['child_process','exec','execute','info','Exec\x20gs','\x20Error\x20:','inspect','util','../../../../config/logger','bluebird'];(function(_0x440f20,_0x31a83e){var _0x5d592a=function(_0x389d69){while(--_0x389d69){_0x440f20['push'](_0x440f20['shift']());}};_0x5d592a(++_0x31a83e);}(_0xfd11,0x183));var _0x1fd1=function(_0x37a7c6,_0x3a84b6){_0x37a7c6=_0x37a7c6-0x0;var _0x539905=_0xfd11[_0x37a7c6];return _0x539905;};'use strict';var util=require(_0x1fd1('0x0'));var logger=require(_0x1fd1('0x1'))('fax');var BPromise=require(_0x1fd1('0x2'));var exec=require(_0x1fd1('0x3'))[_0x1fd1('0x4')];exports[_0x1fd1('0x5')]=function(_0x530217){return new BPromise(function(_0x3bfa51,_0x327bda){exec(_0x530217,function(_0x341037,_0x103d20,_0x2aa68e){logger[_0x1fd1('0x6')](_0x1fd1('0x7'),_0x103d20);if(_0x341037){logger[_0x1fd1('0x6')](_0x1fd1('0x7'),_0x1fd1('0x8'),util[_0x1fd1('0x9')](_0x341037,{'showHidden':![],'depth':null}),_0x103d20,_0x2aa68e);_0x327bda(_0x341037);}_0x3bfa51(_0x103d20);});});}; \ No newline at end of file +var _0x6145=['../../../../config/logger','fax','exec','execute','info','Exec\x20gs','\x20Error\x20:','inspect'];(function(_0xef9fa6,_0x29e530){var _0x4925cf=function(_0x51e2b3){while(--_0x51e2b3){_0xef9fa6['push'](_0xef9fa6['shift']());}};_0x4925cf(++_0x29e530);}(_0x6145,0x110));var _0x5614=function(_0x248dc8,_0x10c027){_0x248dc8=_0x248dc8-0x0;var _0x15aaee=_0x6145[_0x248dc8];return _0x15aaee;};'use strict';var util=require('util');var logger=require(_0x5614('0x0'))(_0x5614('0x1'));var BPromise=require('bluebird');var exec=require('child_process')[_0x5614('0x2')];exports[_0x5614('0x3')]=function(_0x414b45){return new BPromise(function(_0x1c426e,_0x4b4f64){exec(_0x414b45,function(_0x4c5483,_0x2f2870,_0x46a874){logger[_0x5614('0x4')](_0x5614('0x5'),_0x2f2870);if(_0x4c5483){logger['info'](_0x5614('0x5'),_0x5614('0x6'),util[_0x5614('0x7')](_0x4c5483,{'showHidden':![],'depth':null}),_0x2f2870,_0x46a874);_0x4b4f64(_0x4c5483);}_0x1c426e(_0x2f2870);});});}; \ 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 d380568..6b99a63 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 _0x2aca=['localstationid','util','lodash','moment','fax','message','inspect','ecm','headerinfo','minrate','maxrate','\x22%s\x22','modem','gateway','faxdetect','t38timeout','path','variablesAction','uniqueid','originate','channel','xcally-motion-fax','from-sip','format'];(function(_0x1fb2ca,_0x709113){var _0x14143a=function(_0x78543d){while(--_0x78543d){_0x1fb2ca['push'](_0x1fb2ca['shift']());}};_0x14143a(++_0x709113);}(_0x2aca,0x91));var _0xa2ac=function(_0x309413,_0x456d61){_0x309413=_0x309413-0x0;var _0x3dee09=_0x2aca[_0x309413];return _0x3dee09;};'use strict';var util=require(_0xa2ac('0x0'));var _=require(_0xa2ac('0x1'));var moment=require(_0xa2ac('0x2'));var logger=require('../../../../config/logger')(_0xa2ac('0x3'));exports[_0xa2ac('0x4')]=function(_0x531ac7){return{'message':_0x531ac7};};exports['logger']=function(_0x310d85,_0x5bcdcd){logger['info'](_0x310d85,util[_0xa2ac('0x5')](_0x5bcdcd,{'showHidden':![],'depth':null}));};exports['addVariables']=function(_0x2eeaaa,_0x2c8726){var _0x2ee2f3={'XMF-ECM':_0x2c8726[_0xa2ac('0x6')],'XMF-HEADERINFO':_0x2c8726[_0xa2ac('0x7')],'XMF-MINRATE':_0x2c8726[_0xa2ac('0x8')],'XMF-MAXRATE':_0x2c8726[_0xa2ac('0x9')],'XMF-MODEM':util['format'](_0xa2ac('0xa'),_0x2c8726[_0xa2ac('0xb')]),'XMF-GATEWAY':_0x2c8726[_0xa2ac('0xc')],'XMF-FAXDETECT':_0x2c8726[_0xa2ac('0xd')],'XMF-T38TIMEOUT':_0x2c8726[_0xa2ac('0xe')],'XMF-LOCALSTATIONID':_0x2c8726['localstationid'],'XMF-PATH':_0x2eeaaa[_0xa2ac('0xf')]};return _0x2ee2f3;};exports[_0xa2ac('0x10')]=function(_0x48e4ab,_0x38040c){return{'actionid':_0x48e4ab[_0xa2ac('0x11')],'action':_0xa2ac('0x12'),'channel':_0x48e4ab[_0xa2ac('0x13')],'Exten':_0xa2ac('0x14'),'Context':_0xa2ac('0x15'),'Priority':'1','callerid':util[_0xa2ac('0x16')]('\x22%s\x22\x20<%s>',_0x48e4ab[_0xa2ac('0x7')]?_0x48e4ab['headerinfo']:'',_0x48e4ab[_0xa2ac('0x17')]),'variable':_0x38040c,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x48e4ab[_0xa2ac('0x11')]};}; \ No newline at end of file +var _0xd69b=['\x22%s\x22','modem','faxdetect','t38timeout','localstationid','path','uniqueid','channel','from-sip','\x22%s\x22\x20<%s>','headerinfo','util','lodash','../../../../config/logger','fax','logger','info','inspect','addVariables','minrate','format'];(function(_0x4dbf3c,_0xc751a8){var _0xac5f9d=function(_0x50b9f6){while(--_0x50b9f6){_0x4dbf3c['push'](_0x4dbf3c['shift']());}};_0xac5f9d(++_0xc751a8);}(_0xd69b,0x1d9));var _0xbd69=function(_0x599f41,_0x4db732){_0x599f41=_0x599f41-0x0;var _0x2e4d58=_0xd69b[_0x599f41];return _0x2e4d58;};'use strict';var util=require(_0xbd69('0x0'));var _=require(_0xbd69('0x1'));var moment=require('moment');var logger=require(_0xbd69('0x2'))(_0xbd69('0x3'));exports['message']=function(_0x37ab9b){return{'message':_0x37ab9b};};exports[_0xbd69('0x4')]=function(_0xeedc43,_0x4b9d28){logger[_0xbd69('0x5')](_0xeedc43,util[_0xbd69('0x6')](_0x4b9d28,{'showHidden':![],'depth':null}));};exports[_0xbd69('0x7')]=function(_0x440f89,_0x30c685){var _0x1a4021={'XMF-ECM':_0x30c685['ecm'],'XMF-HEADERINFO':_0x30c685['headerinfo'],'XMF-MINRATE':_0x30c685[_0xbd69('0x8')],'XMF-MAXRATE':_0x30c685['maxrate'],'XMF-MODEM':util[_0xbd69('0x9')](_0xbd69('0xa'),_0x30c685[_0xbd69('0xb')]),'XMF-GATEWAY':_0x30c685['gateway'],'XMF-FAXDETECT':_0x30c685[_0xbd69('0xc')],'XMF-T38TIMEOUT':_0x30c685[_0xbd69('0xd')],'XMF-LOCALSTATIONID':_0x30c685[_0xbd69('0xe')],'XMF-PATH':_0x440f89[_0xbd69('0xf')]};return _0x1a4021;};exports['variablesAction']=function(_0x51dc11,_0x5430d3){return{'actionid':_0x51dc11[_0xbd69('0x10')],'action':'originate','channel':_0x51dc11[_0xbd69('0x11')],'Exten':'xcally-motion-fax','Context':_0xbd69('0x12'),'Priority':'1','callerid':util[_0xbd69('0x9')](_0xbd69('0x13'),_0x51dc11[_0xbd69('0x14')]?_0x51dc11[_0xbd69('0x14')]:'',_0x51dc11[_0xbd69('0xe')]),'variable':_0x5430d3,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x51dc11['uniqueid']};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index 97b103a..e5ad584 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 _0x6575=['./trigger','./dialer','./preview','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/desk','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','../../config/logger','ami','hour','get','then','initAgents','getTelephones','initTelephones','getTrunks','initTrunks','initVoiceQueues','initTriggers','getTemplates','initTemplates','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns','getFaxAccounts','initFaxAccounts','resolve','getVoiceQueueReports','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','[index.js][initParams]','listen','sync','[index.js][main]','inspect','util','moment','./realtime','./report'];(function(_0x497da6,_0x22f7fe){var _0x1e5c34=function(_0x3c209f){while(--_0x3c209f){_0x497da6['push'](_0x497da6['shift']());}};_0x1e5c34(++_0x22f7fe);}(_0x6575,0x1d8));var _0x5657=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0x6575[_0x16b9ed];return _0x66b1f8;};'use strict';var util=require(_0x5657('0x0'));var moment=require(_0x5657('0x1'));var server=require('./server');var Realtime=require(_0x5657('0x2'));var Report=require(_0x5657('0x3'));var Acw=require('./acw');var Trigger=require(_0x5657('0x4'));var Dialer=require(_0x5657('0x5'));var Preview=require(_0x5657('0x6'));var Fax=require(_0x5657('0x7'));var user=require(_0x5657('0x8'));var voiceQueue=require(_0x5657('0x9'));var voiceQueueReport=require(_0x5657('0xa'));var voiceCallReport=require(_0x5657('0xb'));var trunk=require(_0x5657('0xc'));var trigger=require(_0x5657('0xd'));var template=require(_0x5657('0xe'));var cmHopperHistory=require('./rpc/cmHopperHistory');var campaign=require('./rpc/campaign');var voiceExtension=require(_0x5657('0xf'));var faxAccount=require(_0x5657('0x10'));var zendesk=require('./rpc/integrations/zendesk');var salesforce=require('./rpc/integrations/salesforce');var sugarcrm=require('./rpc/integrations/sugarcrm');var freshdesk=require('./rpc/integrations/freshdesk');var desk=require(_0x5657('0x11'));var zoho=require('./rpc/integrations/zoho');var vtiger=require('./rpc/integrations/vtiger');var freshsales=require(_0x5657('0x12'));var servicenow=require(_0x5657('0x13'));var dynamics365=require(_0x5657('0x14'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require(_0x5657('0x15'))(_0x5657('0x16'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()['get'](_0x5657('0x17'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x5657('0x18')](_0x5657('0x17'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise['resolve']()[_0x5657('0x19')](user['getAgents']())['then'](realtime[_0x5657('0x1a')]())[_0x5657('0x19')](user[_0x5657('0x1b')]())[_0x5657('0x19')](realtime[_0x5657('0x1c')]())[_0x5657('0x19')](trunk[_0x5657('0x1d')]())[_0x5657('0x19')](realtime[_0x5657('0x1e')]())['then'](voiceQueue['getVoiceQueues']())[_0x5657('0x19')](realtime[_0x5657('0x1f')]())[_0x5657('0x19')](trigger['getTriggers']())[_0x5657('0x19')](realtime[_0x5657('0x20')]())['then'](template[_0x5657('0x21')]())['then'](realtime[_0x5657('0x22')]())[_0x5657('0x19')](zendesk['getZendeskAccounts']())[_0x5657('0x19')](realtime[_0x5657('0x23')]())['then'](salesforce[_0x5657('0x24')]())[_0x5657('0x19')](realtime[_0x5657('0x25')]())[_0x5657('0x19')](sugarcrm[_0x5657('0x26')]())['then'](realtime[_0x5657('0x27')]())[_0x5657('0x19')](freshdesk[_0x5657('0x28')]())[_0x5657('0x19')](realtime[_0x5657('0x29')]())[_0x5657('0x19')](desk[_0x5657('0x2a')]())[_0x5657('0x19')](realtime['initDeskAccounts']())[_0x5657('0x19')](zoho[_0x5657('0x2b')]())[_0x5657('0x19')](realtime[_0x5657('0x2c')]())[_0x5657('0x19')](vtiger[_0x5657('0x2d')]())[_0x5657('0x19')](realtime[_0x5657('0x2e')]())[_0x5657('0x19')](freshsales['getFreshsalesAccounts']())['then'](realtime[_0x5657('0x2f')]())[_0x5657('0x19')](servicenow[_0x5657('0x30')]())[_0x5657('0x19')](realtime[_0x5657('0x31')]())[_0x5657('0x19')](dynamics365[_0x5657('0x32')]())[_0x5657('0x19')](realtime[_0x5657('0x33')]())[_0x5657('0x19')](campaign[_0x5657('0x34')]())[_0x5657('0x19')](realtime[_0x5657('0x35')]())['then'](voiceExtension['getVoiceExtensions']())[_0x5657('0x19')](realtime['initVoiceExtensions']())['then'](faxAccount[_0x5657('0x36')]())[_0x5657('0x19')](realtime[_0x5657('0x37')]())[_0x5657('0x19')](function(){return realtime;});}function initParams(){return Promise[_0x5657('0x38')]()[_0x5657('0x19')](voiceQueueReport[_0x5657('0x39')]())[_0x5657('0x19')](realtime['initVoiceQueueReports']())[_0x5657('0x19')](cmHopperHistory['getVoiceQueueHopperHistory']())[_0x5657('0x19')](realtime[_0x5657('0x3a')]())[_0x5657('0x19')](cmHopperHistory[_0x5657('0x3b')]())[_0x5657('0x19')](realtime[_0x5657('0x3c')]())[_0x5657('0x19')](voiceCallReport[_0x5657('0x3d')]())[_0x5657('0x19')](realtime[_0x5657('0x3e')]())['catch'](function(_0x1fc21f){logger['error'](_0x5657('0x3f'),util['inspect'](_0x1fc21f,{'showHidden':![],'depth':null}));});}function main(){return server[_0x5657('0x40')](realtime,preview,fax)['then'](function(){return initRealtime();})[_0x5657('0x19')](function(){return initParams();})['then'](function(){report[_0x5657('0x41')]();setInterval(initRealtime,0x1388);})['catch'](function(_0x1cb720){logger['error'](_0x5657('0x42'),util[_0x5657('0x43')](_0x1cb720,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file +var _0x0dcd=['inspect','util','moment','./server','./realtime','./report','./acw','./trigger','./dialer','./preview','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/cmHopperHistory','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','ami','get','hour','resolve','then','getAgents','initAgents','initTelephones','getTrunks','initTrunks','getVoiceQueues','getTriggers','initTriggers','getTemplates','initTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','initFreshsalesAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','initCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','initVoiceCallReports','catch','sync','error'];(function(_0x2979c3,_0x28e547){var _0x37903f=function(_0x3692fe){while(--_0x3692fe){_0x2979c3['push'](_0x2979c3['shift']());}};_0x37903f(++_0x28e547);}(_0x0dcd,0x91));var _0xd0dc=function(_0x1d84c0,_0x474f00){_0x1d84c0=_0x1d84c0-0x0;var _0x996dd5=_0x0dcd[_0x1d84c0];return _0x996dd5;};'use strict';var util=require(_0xd0dc('0x0'));var moment=require(_0xd0dc('0x1'));var server=require(_0xd0dc('0x2'));var Realtime=require(_0xd0dc('0x3'));var Report=require(_0xd0dc('0x4'));var Acw=require(_0xd0dc('0x5'));var Trigger=require(_0xd0dc('0x6'));var Dialer=require(_0xd0dc('0x7'));var Preview=require(_0xd0dc('0x8'));var Fax=require(_0xd0dc('0x9'));var user=require(_0xd0dc('0xa'));var voiceQueue=require(_0xd0dc('0xb'));var voiceQueueReport=require(_0xd0dc('0xc'));var voiceCallReport=require(_0xd0dc('0xd'));var trunk=require('./rpc/trunk');var trigger=require('./rpc/trigger');var template=require('./rpc/template');var cmHopperHistory=require(_0xd0dc('0xe'));var campaign=require('./rpc/campaign');var voiceExtension=require(_0xd0dc('0xf'));var faxAccount=require(_0xd0dc('0x10'));var zendesk=require(_0xd0dc('0x11'));var salesforce=require(_0xd0dc('0x12'));var sugarcrm=require(_0xd0dc('0x13'));var freshdesk=require(_0xd0dc('0x14'));var desk=require(_0xd0dc('0x15'));var zoho=require(_0xd0dc('0x16'));var vtiger=require(_0xd0dc('0x17'));var freshsales=require(_0xd0dc('0x18'));var servicenow=require(_0xd0dc('0x19'));var dynamics365=require(_0xd0dc('0x1a'));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')(_0xd0dc('0x1b'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0xd0dc('0x1c')](_0xd0dc('0x1d'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0xd0dc('0x1c')](_0xd0dc('0x1d'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise[_0xd0dc('0x1e')]()[_0xd0dc('0x1f')](user[_0xd0dc('0x20')]())[_0xd0dc('0x1f')](realtime[_0xd0dc('0x21')]())[_0xd0dc('0x1f')](user['getTelephones']())[_0xd0dc('0x1f')](realtime[_0xd0dc('0x22')]())[_0xd0dc('0x1f')](trunk[_0xd0dc('0x23')]())[_0xd0dc('0x1f')](realtime[_0xd0dc('0x24')]())[_0xd0dc('0x1f')](voiceQueue[_0xd0dc('0x25')]())[_0xd0dc('0x1f')](realtime['initVoiceQueues']())[_0xd0dc('0x1f')](trigger[_0xd0dc('0x26')]())[_0xd0dc('0x1f')](realtime[_0xd0dc('0x27')]())[_0xd0dc('0x1f')](template[_0xd0dc('0x28')]())['then'](realtime[_0xd0dc('0x29')]())['then'](zendesk[_0xd0dc('0x2a')]())[_0xd0dc('0x1f')](realtime[_0xd0dc('0x2b')]())[_0xd0dc('0x1f')](salesforce[_0xd0dc('0x2c')]())['then'](realtime['initSalesforceAccounts']())[_0xd0dc('0x1f')](sugarcrm[_0xd0dc('0x2d')]())['then'](realtime[_0xd0dc('0x2e')]())[_0xd0dc('0x1f')](freshdesk['getFreshdeskAccounts']())[_0xd0dc('0x1f')](realtime[_0xd0dc('0x2f')]())[_0xd0dc('0x1f')](desk[_0xd0dc('0x30')]())['then'](realtime[_0xd0dc('0x31')]())[_0xd0dc('0x1f')](zoho[_0xd0dc('0x32')]())[_0xd0dc('0x1f')](realtime[_0xd0dc('0x33')]())[_0xd0dc('0x1f')](vtiger[_0xd0dc('0x34')]())[_0xd0dc('0x1f')](realtime[_0xd0dc('0x35')]())[_0xd0dc('0x1f')](freshsales['getFreshsalesAccounts']())[_0xd0dc('0x1f')](realtime[_0xd0dc('0x36')]())[_0xd0dc('0x1f')](servicenow['getServicenowAccounts']())[_0xd0dc('0x1f')](realtime[_0xd0dc('0x37')]())[_0xd0dc('0x1f')](dynamics365[_0xd0dc('0x38')]())[_0xd0dc('0x1f')](realtime[_0xd0dc('0x39')]())[_0xd0dc('0x1f')](campaign['getCampaigns']())[_0xd0dc('0x1f')](realtime[_0xd0dc('0x3a')]())[_0xd0dc('0x1f')](voiceExtension[_0xd0dc('0x3b')]())[_0xd0dc('0x1f')](realtime[_0xd0dc('0x3c')]())[_0xd0dc('0x1f')](faxAccount[_0xd0dc('0x3d')]())[_0xd0dc('0x1f')](realtime[_0xd0dc('0x3e')]())[_0xd0dc('0x1f')](function(){return realtime;});}function initParams(){return Promise['resolve']()[_0xd0dc('0x1f')](voiceQueueReport[_0xd0dc('0x3f')]())[_0xd0dc('0x1f')](realtime[_0xd0dc('0x40')]())[_0xd0dc('0x1f')](cmHopperHistory[_0xd0dc('0x41')]())[_0xd0dc('0x1f')](realtime[_0xd0dc('0x42')]())[_0xd0dc('0x1f')](cmHopperHistory['getCampaignHopperHistory']())[_0xd0dc('0x1f')](realtime['initCampaignHopperHistory']())['then'](voiceCallReport['getVoiceCallReports']())[_0xd0dc('0x1f')](realtime[_0xd0dc('0x43')]())[_0xd0dc('0x44')](function(_0x1648e9){logger['error']('[index.js][initParams]',util['inspect'](_0x1648e9,{'showHidden':![],'depth':null}));});}function main(){return server['listen'](realtime,preview,fax)[_0xd0dc('0x1f')](function(){return initRealtime();})[_0xd0dc('0x1f')](function(){return initParams();})[_0xd0dc('0x1f')](function(){report[_0xd0dc('0x45')]();setInterval(initRealtime,0x1388);})[_0xd0dc('0x44')](function(_0x6bc0c){logger[_0xd0dc('0x46')]('[index.js][main]',util[_0xd0dc('0x47')](_0x6bc0c,{'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 b66a499..ee88cbf 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 _0xa168=['email','accountcode','fullname','unknown','address','phone','mobile','interface','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','prototype','updateStatusRealtime','state','toLowerCase','not_inuse','inuse','talking','statePause','toNumber','format','stateTime','status','onhold','stringify','user:%s','emit','user:save','user:presence','exports','lodash','md5','ioredis','defaults','redis','localhost','name'];(function(_0x3f3c44,_0x3cd94d){var _0x918985=function(_0x1ed411){while(--_0x1ed411){_0x3f3c44['push'](_0x3f3c44['shift']());}};_0x918985(++_0x3cd94d);}(_0xa168,0x95));var _0x8a16=function(_0x5b11e0,_0x48afdf){_0x5b11e0=_0x5b11e0-0x0;var _0x40256b=_0xa168[_0x5b11e0];return _0x40256b;};'use strict';var _=require(_0x8a16('0x0'));var util=require('util');var moment=require('moment');var md5=require(_0x8a16('0x1'));var Redis=require(_0x8a16('0x2'));var config=require('../../../config/environment');config['redis']=_[_0x8a16('0x3')](config[_0x8a16('0x4')],{'host':_0x8a16('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function Agent(_0x203007){this['id']=_0x203007['id']||0x0;this[_0x8a16('0x6')]=_0x203007['name']||'';this[_0x8a16('0x7')]=_0x203007[_0x8a16('0x7')]||'';this[_0x8a16('0x8')]=_0x203007[_0x8a16('0x8')]||'';this[_0x8a16('0x9')]=_0x203007[_0x8a16('0x9')]||'';this['state']=_0x8a16('0xa');this['stateTime']=0x0;this['status']='unknown';this[_0x8a16('0xb')]='';this[_0x8a16('0xc')]='';this[_0x8a16('0xd')]='';this[_0x8a16('0xe')]='';this[_0x8a16('0xf')]=_0x203007['online']||![];this[_0x8a16('0x10')]=_0x8a16('0xa');this[_0x8a16('0x11')]=0x0;this[_0x8a16('0x12')]='';this[_0x8a16('0x13')]='';this['onhold']=![];this['local']=![];this[_0x8a16('0x1')]='';}Agent[_0x8a16('0x14')][_0x8a16('0x15')]=function(_0x91794b){var _0x17c8ca;if(_0x91794b&&_0x91794b[_0x8a16('0x16')]){_0x17c8ca=_0x91794b['state'][_0x8a16('0x17')]();switch(_0x17c8ca){case _0x8a16('0x18'):_0x17c8ca='idle';break;case _0x8a16('0x19'):_0x17c8ca=_0x8a16('0x1a');break;}}if(_0x17c8ca&&this[_0x8a16('0x10')]!==_0x17c8ca||_0x91794b[_0x8a16('0x1b')]){this['voiceStatusTime']=_[_0x8a16('0x1c')](moment()[_0x8a16('0x1d')]('x'));}if(_0x17c8ca){this['voiceStatus']=_0x17c8ca;}var _0x51b7dc={'id':this['id'],'name':this['name'],'email':this[_0x8a16('0x7')],'accountcode':this['accountcode'],'fullname':this['fullname'],'state':this[_0x8a16('0x16')],'stateTime':this[_0x8a16('0x1e')],'status':this[_0x8a16('0x1f')],'address':this['address'],'online':this[_0x8a16('0xf')],'voiceStatus':this[_0x8a16('0x10')],'voiceStatusTime':this[_0x8a16('0x11')],'voiceStatusCallerIdNumber':this[_0x8a16('0x12')],'voiceStatusQueue':this['voiceStatusQueue'],'interface':this[_0x8a16('0xe')],'onhold':this[_0x8a16('0x20')]};var _0x13c218=md5(JSON[_0x8a16('0x21')](_0x51b7dc));if(this['md5']!==_0x13c218){this[_0x8a16('0x1')]=_0x13c218;io['to'](util[_0x8a16('0x1d')](_0x8a16('0x22'),_0x51b7dc[_0x8a16('0x6')]))[_0x8a16('0x23')](_0x8a16('0x24'),_0x51b7dc);io[_0x8a16('0x23')](_0x8a16('0x25'),_0x51b7dc);}};module[_0x8a16('0x26')]=Agent; \ No newline at end of file +var _0x1d21=['updateStatusRealtime','toLowerCase','not_inuse','idle','inuse','talking','statePause','toNumber','format','online','voiceStatusCallerIdNumber','stringify','user:%s','emit','user:save','user:presence','lodash','util','moment','md5','../../../config/environment','redis','defaults','socket.io-emitter','name','email','accountcode','fullname','state','stateTime','status','address','phone','mobile','interface','voiceStatus','unknown','voiceStatusTime','voiceStatusQueue','onhold','local'];(function(_0x1fb7b2,_0xb5a75e){var _0x4d038d=function(_0x1b2abd){while(--_0x1b2abd){_0x1fb7b2['push'](_0x1fb7b2['shift']());}};_0x4d038d(++_0xb5a75e);}(_0x1d21,0x158));var _0x11d2=function(_0x552fce,_0x3f24bc){_0x552fce=_0x552fce-0x0;var _0x3e27a2=_0x1d21[_0x552fce];return _0x3e27a2;};'use strict';var _=require(_0x11d2('0x0'));var util=require(_0x11d2('0x1'));var moment=require(_0x11d2('0x2'));var md5=require(_0x11d2('0x3'));var Redis=require('ioredis');var config=require(_0x11d2('0x4'));config[_0x11d2('0x5')]=_[_0x11d2('0x6')](config[_0x11d2('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x11d2('0x7'))(new Redis(config[_0x11d2('0x5')]));function Agent(_0x16e99c){this['id']=_0x16e99c['id']||0x0;this[_0x11d2('0x8')]=_0x16e99c[_0x11d2('0x8')]||'';this[_0x11d2('0x9')]=_0x16e99c[_0x11d2('0x9')]||'';this['accountcode']=_0x16e99c[_0x11d2('0xa')]||'';this[_0x11d2('0xb')]=_0x16e99c['fullname']||'';this[_0x11d2('0xc')]='unknown';this[_0x11d2('0xd')]=0x0;this[_0x11d2('0xe')]='unknown';this[_0x11d2('0xf')]='';this[_0x11d2('0x10')]='';this[_0x11d2('0x11')]='';this[_0x11d2('0x12')]='';this['online']=_0x16e99c['online']||![];this[_0x11d2('0x13')]=_0x11d2('0x14');this[_0x11d2('0x15')]=0x0;this['voiceStatusCallerIdNumber']='';this[_0x11d2('0x16')]='';this[_0x11d2('0x17')]=![];this[_0x11d2('0x18')]=![];this[_0x11d2('0x3')]='';}Agent['prototype'][_0x11d2('0x19')]=function(_0x44cf2c){var _0x5ea3ec;if(_0x44cf2c&&_0x44cf2c[_0x11d2('0xc')]){_0x5ea3ec=_0x44cf2c[_0x11d2('0xc')][_0x11d2('0x1a')]();switch(_0x5ea3ec){case _0x11d2('0x1b'):_0x5ea3ec=_0x11d2('0x1c');break;case _0x11d2('0x1d'):_0x5ea3ec=_0x11d2('0x1e');break;}}if(_0x5ea3ec&&this[_0x11d2('0x13')]!==_0x5ea3ec||_0x44cf2c[_0x11d2('0x1f')]){this[_0x11d2('0x15')]=_[_0x11d2('0x20')](moment()[_0x11d2('0x21')]('x'));}if(_0x5ea3ec){this[_0x11d2('0x13')]=_0x5ea3ec;}var _0x58730a={'id':this['id'],'name':this['name'],'email':this[_0x11d2('0x9')],'accountcode':this[_0x11d2('0xa')],'fullname':this['fullname'],'state':this[_0x11d2('0xc')],'stateTime':this[_0x11d2('0xd')],'status':this[_0x11d2('0xe')],'address':this[_0x11d2('0xf')],'online':this[_0x11d2('0x22')],'voiceStatus':this['voiceStatus'],'voiceStatusTime':this[_0x11d2('0x15')],'voiceStatusCallerIdNumber':this[_0x11d2('0x23')],'voiceStatusQueue':this['voiceStatusQueue'],'interface':this[_0x11d2('0x12')],'onhold':this[_0x11d2('0x17')]};var _0x2e6ecc=md5(JSON[_0x11d2('0x24')](_0x58730a));if(this['md5']!==_0x2e6ecc){this[_0x11d2('0x3')]=_0x2e6ecc;io['to'](util[_0x11d2('0x21')](_0x11d2('0x25'),_0x58730a[_0x11d2('0x8')]))[_0x11d2('0x26')](_0x11d2('0x27'),_0x58730a);io[_0x11d2('0x26')](_0x11d2('0x28'),_0x58730a);}};module['exports']=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index 6b68ea3..722841f 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 _0xacff=['dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDMaximumWordLength','exports','name','type','originated','ivrAnswerCallsDay','ivrTotalCallsDays','message','sendMessageOneNotActive','active','limitCalls','dialTimezone'];(function(_0x21b5bf,_0x487b00){var _0x589318=function(_0x386b24){while(--_0x386b24){_0x21b5bf['push'](_0x21b5bf['shift']());}};_0x589318(++_0x487b00);}(_0xacff,0x116));var _0xfacf=function(_0x264a6f,_0x3baf5e){_0x264a6f=_0x264a6f-0x0;var _0x4c28a9=_0xacff[_0x264a6f];return _0x4c28a9;};'use strict';function Campaign(_0x5f4d04){this['id']=_0x5f4d04['id']||0x0;this[_0xfacf('0x0')]=_0x5f4d04[_0xfacf('0x0')]||'';this[_0xfacf('0x1')]=_0x5f4d04['type']||'campaign';this[_0xfacf('0x2')]=0x0;this['temp']=0x0;this[_0xfacf('0x3')]=0x0;this[_0xfacf('0x4')]=0x0;this[_0xfacf('0x5')]='';this[_0xfacf('0x6')]=!![];this[_0xfacf('0x7')]=_0x5f4d04[_0xfacf('0x7')];this['limitCalls']=_0x5f4d04[_0xfacf('0x8')];this['dialTimezone']=_0x5f4d04[_0xfacf('0x9')]||null;this['dialGlobalInterval']=_0x5f4d04[_0xfacf('0xa')]?_0x5f4d04[_0xfacf('0xa')]:null;this[_0xfacf('0xb')]=_0x5f4d04[_0xfacf('0xb')];this[_0xfacf('0xc')]=_0x5f4d04[_0xfacf('0xc')];this[_0xfacf('0xd')]=_0x5f4d04[_0xfacf('0xd')]||0x1e;this['dialCongestionMaxRetry']=_0x5f4d04['dialCongestionMaxRetry'];this['dialCongestionRetryFrequency']=_0x5f4d04[_0xfacf('0xe')];this[_0xfacf('0xf')]=_0x5f4d04[_0xfacf('0xf')];this[_0xfacf('0x10')]=_0x5f4d04['dialBusyRetryFrequency'];this[_0xfacf('0x11')]=_0x5f4d04[_0xfacf('0x11')];this[_0xfacf('0x12')]=_0x5f4d04[_0xfacf('0x12')];this[_0xfacf('0x13')]=_0x5f4d04[_0xfacf('0x13')];this['dialNoSuchNumberMaxRetry']=_0x5f4d04['dialNoSuchNumberMaxRetry']||0x3;this[_0xfacf('0x14')]=_0x5f4d04[_0xfacf('0x14')]||0x96;this['dialDropMaxRetry']=_0x5f4d04[_0xfacf('0x15')]||0x3;this[_0xfacf('0x16')]=_0x5f4d04[_0xfacf('0x16')]||0x96;this[_0xfacf('0x17')]=_0x5f4d04[_0xfacf('0x17')]||0x3;this[_0xfacf('0x18')]=_0x5f4d04[_0xfacf('0x18')]||0x96;this[_0xfacf('0x19')]=_0x5f4d04[_0xfacf('0x19')]||0x3;this[_0xfacf('0x1a')]=_0x5f4d04[_0xfacf('0x1a')]||0x96;this[_0xfacf('0x1b')]=_0x5f4d04[_0xfacf('0x1b')]||0x3;this[_0xfacf('0x1c')]=_0x5f4d04[_0xfacf('0x1c')]||0x96;this['dialOrderByScheduledAt']=_0x5f4d04[_0xfacf('0x1d')]||_0xfacf('0x1e');this[_0xfacf('0x1f')]=_0x5f4d04[_0xfacf('0x1f')]||undefined;this[_0xfacf('0x20')]=_0x5f4d04['dialRandomLastDigitCallerIdNumber']||undefined;this[_0xfacf('0x21')]=_0x5f4d04[_0xfacf('0x21')]||undefined;this[_0xfacf('0x22')]=_0x5f4d04[_0xfacf('0x22')]?_0x5f4d04['TrunkBackup']:undefined;this[_0xfacf('0x23')]=_0x5f4d04[_0xfacf('0x23')]?_0x5f4d04[_0xfacf('0x23')]:undefined;this[_0xfacf('0x24')]=_0x5f4d04['Interval']?_0x5f4d04['Interval']:undefined;this[_0xfacf('0x25')]=_0x5f4d04[_0xfacf('0x25')]?_0x5f4d04[_0xfacf('0x25')]:undefined;this[_0xfacf('0x26')]=_0x5f4d04['SquareProject']?_0x5f4d04['SquareProject'][_0xfacf('0x0')]:undefined;this[_0xfacf('0x27')]=_0x5f4d04[_0xfacf('0x27')]||![];this[_0xfacf('0x28')]=_0x5f4d04[_0xfacf('0x28')];this[_0xfacf('0x29')]=_0x5f4d04[_0xfacf('0x29')];this[_0xfacf('0x2a')]=_0x5f4d04[_0xfacf('0x2a')];this['dialAMDTotalAnalysisTime']=_0x5f4d04['dialAMDTotalAnalysisTime'];this[_0xfacf('0x2b')]=_0x5f4d04[_0xfacf('0x2b')];this['dialAMDBetweenWordsSilence']=_0x5f4d04[_0xfacf('0x2c')];this[_0xfacf('0x2d')]=_0x5f4d04[_0xfacf('0x2d')];this['dialAMDSilenceThreshold']=_0x5f4d04['dialAMDSilenceThreshold'];this[_0xfacf('0x2e')]=_0x5f4d04[_0xfacf('0x2e')];}module[_0xfacf('0x2f')]=Campaign; \ No newline at end of file +var _0x5c87=['campaign','originated','temp','ivrAnswerCallsDay','ivrTotalCallsDays','message','active','limitCalls','dialTimezone','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','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','name','type'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5c87,0x1b7));var _0x75c8=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x5c87[_0x618414];return _0x21c19a;};'use strict';function Campaign(_0x2794af){this['id']=_0x2794af['id']||0x0;this['name']=_0x2794af[_0x75c8('0x0')]||'';this[_0x75c8('0x1')]=_0x2794af[_0x75c8('0x1')]||_0x75c8('0x2');this[_0x75c8('0x3')]=0x0;this[_0x75c8('0x4')]=0x0;this[_0x75c8('0x5')]=0x0;this[_0x75c8('0x6')]=0x0;this[_0x75c8('0x7')]='';this['sendMessageOneNotActive']=!![];this[_0x75c8('0x8')]=_0x2794af[_0x75c8('0x8')];this[_0x75c8('0x9')]=_0x2794af[_0x75c8('0x9')];this[_0x75c8('0xa')]=_0x2794af[_0x75c8('0xa')]||null;this['dialGlobalInterval']=_0x2794af['dialGlobalInterval']?_0x2794af['dialGlobalInterval']:null;this['dialOriginateCallerIdName']=_0x2794af['dialOriginateCallerIdName'];this[_0x75c8('0xb')]=_0x2794af[_0x75c8('0xb')];this[_0x75c8('0xc')]=_0x2794af['dialOriginateTimeout']||0x1e;this['dialCongestionMaxRetry']=_0x2794af[_0x75c8('0xd')];this[_0x75c8('0xe')]=_0x2794af['dialCongestionRetryFrequency'];this[_0x75c8('0xf')]=_0x2794af[_0x75c8('0xf')];this[_0x75c8('0x10')]=_0x2794af['dialBusyRetryFrequency'];this[_0x75c8('0x11')]=_0x2794af[_0x75c8('0x11')];this[_0x75c8('0x12')]=_0x2794af[_0x75c8('0x12')];this['dialGlobalMaxRetry']=_0x2794af[_0x75c8('0x13')];this[_0x75c8('0x14')]=_0x2794af[_0x75c8('0x14')]||0x3;this[_0x75c8('0x15')]=_0x2794af[_0x75c8('0x15')]||0x96;this['dialDropMaxRetry']=_0x2794af[_0x75c8('0x16')]||0x3;this[_0x75c8('0x17')]=_0x2794af[_0x75c8('0x17')]||0x96;this[_0x75c8('0x18')]=_0x2794af[_0x75c8('0x18')]||0x3;this[_0x75c8('0x19')]=_0x2794af[_0x75c8('0x19')]||0x96;this[_0x75c8('0x1a')]=_0x2794af['dialMachineMaxRetry']||0x3;this[_0x75c8('0x1b')]=_0x2794af[_0x75c8('0x1b')]||0x96;this[_0x75c8('0x1c')]=_0x2794af['dialAgentRejectMaxRetry']||0x3;this[_0x75c8('0x1d')]=_0x2794af[_0x75c8('0x1d')]||0x96;this[_0x75c8('0x1e')]=_0x2794af[_0x75c8('0x1e')]||_0x75c8('0x1f');this[_0x75c8('0x20')]=_0x2794af[_0x75c8('0x20')]||undefined;this[_0x75c8('0x21')]=_0x2794af[_0x75c8('0x21')]||undefined;this[_0x75c8('0x22')]=_0x2794af[_0x75c8('0x22')]||undefined;this[_0x75c8('0x23')]=_0x2794af[_0x75c8('0x23')]?_0x2794af[_0x75c8('0x23')]:undefined;this[_0x75c8('0x24')]=_0x2794af[_0x75c8('0x24')]?_0x2794af['Trunk']:undefined;this[_0x75c8('0x25')]=_0x2794af[_0x75c8('0x25')]?_0x2794af['Interval']:undefined;this['SquareProject']=_0x2794af[_0x75c8('0x26')]?_0x2794af['SquareProject']:undefined;this[_0x75c8('0x27')]=_0x2794af[_0x75c8('0x26')]?_0x2794af['SquareProject'][_0x75c8('0x0')]:undefined;this[_0x75c8('0x28')]=_0x2794af[_0x75c8('0x28')]||![];this['dialAMDInitialSilence']=_0x2794af[_0x75c8('0x29')];this[_0x75c8('0x2a')]=_0x2794af[_0x75c8('0x2a')];this[_0x75c8('0x2b')]=_0x2794af[_0x75c8('0x2b')];this[_0x75c8('0x2c')]=_0x2794af[_0x75c8('0x2c')];this['dialAMDMinWordLength']=_0x2794af[_0x75c8('0x2d')];this[_0x75c8('0x2e')]=_0x2794af[_0x75c8('0x2e')];this[_0x75c8('0x2f')]=_0x2794af[_0x75c8('0x2f')];this[_0x75c8('0x30')]=_0x2794af[_0x75c8('0x30')];this['dialAMDMaximumWordLength']=_0x2794af['dialAMDMaximumWordLength'];}module['exports']=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index 7ca6b9c..2595645 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 _0x94d4=['answertime','lastapplication','lastdata','holdtime','type','disposition','monitor','monitorFilename','queue','transfercalleridnum','transferconnectedlinenum','starttime','channel','calleridnum','calleridname','connectedlinenum','accountcode','context','uniqueid','linkedid','exten','answered'];(function(_0x582f72,_0x886d8){var _0x4cd5fe=function(_0x4ac1c7){while(--_0x4ac1c7){_0x582f72['push'](_0x582f72['shift']());}};_0x4cd5fe(++_0x886d8);}(_0x94d4,0xa5));var _0x494d=function(_0x365dbe,_0x4d3979){_0x365dbe=_0x365dbe-0x0;var _0xaa71bb=_0x94d4[_0x365dbe];return _0xaa71bb;};'use strict';function Channel(){this[_0x494d('0x0')]=null;this[_0x494d('0x1')]='';this['destinationchannel']='';this[_0x494d('0x2')]=0x0;this[_0x494d('0x3')]='';this[_0x494d('0x4')]=undefined;this['connectedlinename']=undefined;this[_0x494d('0x5')]=0x0;this[_0x494d('0x6')]='';this[_0x494d('0x7')]=0x0;this[_0x494d('0x8')]=0x0;this[_0x494d('0x9')]=0x0;this[_0x494d('0xa')]=![];this[_0x494d('0xb')]=null;this['endtime']=null;this['unmanaged']=![];this['abandoned']=![];this[_0x494d('0xc')]='';this[_0x494d('0xd')]='';this['duration']=0x0;this['billableseconds']=0x0;this[_0x494d('0xe')]=0x0;this[_0x494d('0xf')]=null;this['tag']=null;this[_0x494d('0x10')]=null;this[_0x494d('0x11')]=![];this[_0x494d('0x12')]=null;this[_0x494d('0x13')]=null;this['monitors']=[];this[_0x494d('0x14')]=undefined;this[_0x494d('0x15')]=undefined;this['transferType']=undefined;this['mohtime']=0x0;}module['exports']=Channel; \ No newline at end of file +var _0xbc2c=['type','tag','disposition','monitor','monitorFilename','queue','monitors','transferconnectedlinenum','transferType','mohtime','exports','starttime','channel','destinationchannel','calleridnum','connectedlinename','accountcode','context','uniqueid','linkedid','exten','endtime','unmanaged','abandoned','lastapplication','duration','billableseconds','holdtime'];(function(_0x4a5f4e,_0x59e3cc){var _0xe3db26=function(_0x2fbb50){while(--_0x2fbb50){_0x4a5f4e['push'](_0x4a5f4e['shift']());}};_0xe3db26(++_0x59e3cc);}(_0xbc2c,0x123));var _0xcbc2=function(_0x56727c,_0x3a4af4){_0x56727c=_0x56727c-0x0;var _0x1de7ba=_0xbc2c[_0x56727c];return _0x1de7ba;};'use strict';function Channel(){this[_0xcbc2('0x0')]=null;this[_0xcbc2('0x1')]='';this[_0xcbc2('0x2')]='';this[_0xcbc2('0x3')]=0x0;this['calleridname']='';this['connectedlinenum']=undefined;this[_0xcbc2('0x4')]=undefined;this[_0xcbc2('0x5')]=0x0;this[_0xcbc2('0x6')]='';this[_0xcbc2('0x7')]=0x0;this[_0xcbc2('0x8')]=0x0;this[_0xcbc2('0x9')]=0x0;this['answered']=![];this['answertime']=null;this[_0xcbc2('0xa')]=null;this[_0xcbc2('0xb')]=![];this[_0xcbc2('0xc')]=![];this[_0xcbc2('0xd')]='';this['lastdata']='';this[_0xcbc2('0xe')]=0x0;this[_0xcbc2('0xf')]=0x0;this[_0xcbc2('0x10')]=0x0;this[_0xcbc2('0x11')]=null;this[_0xcbc2('0x12')]=null;this[_0xcbc2('0x13')]=null;this[_0xcbc2('0x14')]=![];this[_0xcbc2('0x15')]=null;this[_0xcbc2('0x16')]=null;this[_0xcbc2('0x17')]=[];this['transfercalleridnum']=undefined;this[_0xcbc2('0x18')]=undefined;this[_0xcbc2('0x19')]=undefined;this[_0xcbc2('0x1a')]=0x0;}module[_0xcbc2('0x1b')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index c817c31..231a3a5 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 _0x8915=['Configurations','exports','name','username','remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl'];(function(_0x2b1b0a,_0x26cbc0){var _0x4699b1=function(_0x32dcc4){while(--_0x32dcc4){_0x2b1b0a['push'](_0x2b1b0a['shift']());}};_0x4699b1(++_0x26cbc0);}(_0x8915,0x9e));var _0x5891=function(_0x26b8b5,_0xf5c2c1){_0x26b8b5=_0x26b8b5-0x0;var _0x2150a9=_0x8915[_0x26b8b5];return _0x2150a9;};'use strict';function DeskAccount(_0x4fc617){this['id']=_0x4fc617['id']||0x0;this[_0x5891('0x0')]=_0x4fc617[_0x5891('0x0')]||'';this[_0x5891('0x1')]=_0x4fc617[_0x5891('0x1')]||'';this[_0x5891('0x2')]=_0x4fc617[_0x5891('0x2')]||'';this[_0x5891('0x3')]=_0x4fc617[_0x5891('0x3')]||'';this[_0x5891('0x4')]=_0x4fc617[_0x5891('0x4')]||'';this[_0x5891('0x5')]=_0x4fc617['consumerKey']||'';this['consumerSecret']=_0x4fc617[_0x5891('0x6')]||'';this[_0x5891('0x7')]=_0x4fc617[_0x5891('0x7')]||'';this['tokenSecret']=_0x4fc617[_0x5891('0x8')]||'';this[_0x5891('0x9')]=_0x4fc617[_0x5891('0x9')]||'';this['serverUrl']=_0x4fc617[_0x5891('0xa')]||'';this[_0x5891('0xb')]=_0x4fc617[_0x5891('0xb')]||{};}module[_0x5891('0xc')]=DeskAccount; \ No newline at end of file +var _0x6e6b=['Configurations','exports','name','username','remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl'];(function(_0x5532fb,_0x57c0c7){var _0x20058e=function(_0x3fa73c){while(--_0x3fa73c){_0x5532fb['push'](_0x5532fb['shift']());}};_0x20058e(++_0x57c0c7);}(_0x6e6b,0x106));var _0xb6e6=function(_0x14094d,_0x27ad4a){_0x14094d=_0x14094d-0x0;var _0xd94c27=_0x6e6b[_0x14094d];return _0xd94c27;};'use strict';function DeskAccount(_0x1286d5){this['id']=_0x1286d5['id']||0x0;this[_0xb6e6('0x0')]=_0x1286d5[_0xb6e6('0x0')]||'';this[_0xb6e6('0x1')]=_0x1286d5['username']||'';this[_0xb6e6('0x2')]=_0x1286d5[_0xb6e6('0x2')]||'';this['authType']=_0x1286d5[_0xb6e6('0x3')]||'';this[_0xb6e6('0x4')]=_0x1286d5['password']||'';this[_0xb6e6('0x5')]=_0x1286d5[_0xb6e6('0x5')]||'';this[_0xb6e6('0x6')]=_0x1286d5[_0xb6e6('0x6')]||'';this[_0xb6e6('0x7')]=_0x1286d5[_0xb6e6('0x7')]||'';this[_0xb6e6('0x8')]=_0x1286d5[_0xb6e6('0x8')]||'';this[_0xb6e6('0x9')]=_0x1286d5['type']||'';this[_0xb6e6('0xa')]=_0x1286d5[_0xb6e6('0xa')]||'';this[_0xb6e6('0xb')]=_0x1286d5['Configurations']||{};}module[_0xb6e6('0xc')]=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index 6a65918..3a1edfd 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 _0x1805=['exports','name','username','password','remoteUri','tenantId','clientId','clientSecret','serverUrl','modernAuthentication','Configurations','CloudProvider'];(function(_0x5f410b,_0x23dc30){var _0x250e25=function(_0x31f122){while(--_0x31f122){_0x5f410b['push'](_0x5f410b['shift']());}};_0x250e25(++_0x23dc30);}(_0x1805,0xd9));var _0x5180=function(_0x3ac2c3,_0xcf2a4b){_0x3ac2c3=_0x3ac2c3-0x0;var _0xeb8eef=_0x1805[_0x3ac2c3];return _0xeb8eef;};'use strict';function Dynamics365Account(_0x44ae0e){this['id']=_0x44ae0e['id']||0x0;this[_0x5180('0x0')]=_0x44ae0e[_0x5180('0x0')]||'';this[_0x5180('0x1')]=_0x44ae0e[_0x5180('0x1')]||'';this[_0x5180('0x2')]=_0x44ae0e[_0x5180('0x2')]||'';this[_0x5180('0x3')]=_0x44ae0e[_0x5180('0x3')]||'';this[_0x5180('0x4')]=_0x44ae0e[_0x5180('0x4')]||'';this[_0x5180('0x5')]=_0x44ae0e[_0x5180('0x5')]||'';this[_0x5180('0x6')]=_0x44ae0e['clientSecret']||{};this[_0x5180('0x7')]=_0x44ae0e[_0x5180('0x7')]||'';this[_0x5180('0x8')]=_0x44ae0e['modernAuthentication']||![];this[_0x5180('0x9')]=_0x44ae0e[_0x5180('0x9')]||{};this['CloudProvider']=_0x44ae0e[_0x5180('0xa')]||{};}module[_0x5180('0xb')]=Dynamics365Account; \ No newline at end of file +var _0x1309=['clientId','clientSecret','serverUrl','modernAuthentication','CloudProvider','name','username','password','remoteUri','tenantId'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x1309,0xa5));var _0x9130=function(_0x11ebee,_0x798ea6){_0x11ebee=_0x11ebee-0x0;var _0x435585=_0x1309[_0x11ebee];return _0x435585;};'use strict';function Dynamics365Account(_0x3764e3){this['id']=_0x3764e3['id']||0x0;this[_0x9130('0x0')]=_0x3764e3[_0x9130('0x0')]||'';this[_0x9130('0x1')]=_0x3764e3[_0x9130('0x1')]||'';this[_0x9130('0x2')]=_0x3764e3['password']||'';this['remoteUri']=_0x3764e3[_0x9130('0x3')]||'';this['tenantId']=_0x3764e3[_0x9130('0x4')]||'';this[_0x9130('0x5')]=_0x3764e3[_0x9130('0x5')]||'';this[_0x9130('0x6')]=_0x3764e3[_0x9130('0x6')]||{};this[_0x9130('0x7')]=_0x3764e3[_0x9130('0x7')]||'';this[_0x9130('0x8')]=_0x3764e3[_0x9130('0x8')]||![];this['Configurations']=_0x3764e3['Configurations']||{};this[_0x9130('0x9')]=_0x3764e3[_0x9130('0x9')]||{};}module['exports']=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index f6ea298..705da16 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 _0x8a4a=['localstationid','minrate','maxrate','modem','gateway','faxdetect','t38timeout','tech','SIP','Trunk','ListId','key','exports','name','description','ecm','headerinfo'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8a4a,0x10c));var _0xa8a4=function(_0x1619c1,_0x21b9fd){_0x1619c1=_0x1619c1-0x0;var _0x424d3f=_0x8a4a[_0x1619c1];return _0x424d3f;};'use strict';function FaxAccount(_0x53165e){this['id']=_0x53165e['id']||0x0;this[_0xa8a4('0x0')]=_0x53165e[_0xa8a4('0x0')]||'';this[_0xa8a4('0x1')]=_0x53165e[_0xa8a4('0x1')];this[_0xa8a4('0x2')]=_0x53165e['ecm'];this[_0xa8a4('0x3')]=_0x53165e[_0xa8a4('0x3')];this[_0xa8a4('0x4')]=_0x53165e[_0xa8a4('0x4')];this['minrate']=_0x53165e[_0xa8a4('0x5')]||0x960;this[_0xa8a4('0x6')]=_0x53165e['maxrate']||0x3840;this[_0xa8a4('0x7')]=_0x53165e[_0xa8a4('0x7')]||'v17,v27,v29';this[_0xa8a4('0x8')]=_0x53165e['gateway']||'no';this[_0xa8a4('0x9')]=_0x53165e['faxdetect']||'no';this[_0xa8a4('0xa')]=_0x53165e['t38timeout']||0x1388;this[_0xa8a4('0xb')]=_0x53165e[_0xa8a4('0xb')]||_0xa8a4('0xc');this[_0xa8a4('0xd')]=_0x53165e[_0xa8a4('0xd')]?_0x53165e['Trunk']:undefined;this[_0xa8a4('0xe')]=_0x53165e[_0xa8a4('0xe')];this[_0xa8a4('0xf')]=_0x53165e[_0xa8a4('0xf')];}module[_0xa8a4('0x10')]=FaxAccount; \ No newline at end of file +var _0x651e=['localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect','tech','SIP','Trunk','ListId','key','exports','name','ecm','headerinfo'];(function(_0x184323,_0x232760){var _0x24c888=function(_0x55f78b){while(--_0x55f78b){_0x184323['push'](_0x184323['shift']());}};_0x24c888(++_0x232760);}(_0x651e,0x15d));var _0xe651=function(_0x56581b,_0x237617){_0x56581b=_0x56581b-0x0;var _0x55266e=_0x651e[_0x56581b];return _0x55266e;};'use strict';function FaxAccount(_0x48f45a){this['id']=_0x48f45a['id']||0x0;this[_0xe651('0x0')]=_0x48f45a[_0xe651('0x0')]||'';this['description']=_0x48f45a['description'];this[_0xe651('0x1')]=_0x48f45a[_0xe651('0x1')];this[_0xe651('0x2')]=_0x48f45a['headerinfo'];this[_0xe651('0x3')]=_0x48f45a[_0xe651('0x3')];this[_0xe651('0x4')]=_0x48f45a[_0xe651('0x4')]||0x960;this[_0xe651('0x5')]=_0x48f45a[_0xe651('0x5')]||0x3840;this['modem']=_0x48f45a[_0xe651('0x6')]||_0xe651('0x7');this['gateway']=_0x48f45a[_0xe651('0x8')]||'no';this[_0xe651('0x9')]=_0x48f45a[_0xe651('0x9')]||'no';this['t38timeout']=_0x48f45a['t38timeout']||0x1388;this[_0xe651('0xa')]=_0x48f45a['tech']||_0xe651('0xb');this[_0xe651('0xc')]=_0x48f45a[_0xe651('0xc')]?_0x48f45a[_0xe651('0xc')]:undefined;this['ListId']=_0x48f45a[_0xe651('0xd')];this['key']=_0x48f45a[_0xe651('0xe')];}module[_0xe651('0xf')]=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index ef704ba..1dbab20 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 _0xea27=['name','remoteUri','serverUrl','Configurations','exports'];(function(_0x53c64b,_0x55d4f4){var _0x276b19=function(_0x39c527){while(--_0x39c527){_0x53c64b['push'](_0x53c64b['shift']());}};_0x276b19(++_0x55d4f4);}(_0xea27,0x19f));var _0x7ea2=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0xea27[_0x433a86];return _0x23000c;};'use strict';function FreshdeskAccount(_0x560ffb){this['id']=_0x560ffb['id']||0x0;this['name']=_0x560ffb[_0x7ea2('0x0')]||'';this['username']=_0x560ffb['username']||'';this['apiKey']=_0x560ffb['token']||'';this[_0x7ea2('0x1')]=_0x560ffb['remoteUri']||'';this[_0x7ea2('0x2')]=_0x560ffb['serverUrl']||'';this[_0x7ea2('0x3')]=_0x560ffb['Configurations']||{};}module[_0x7ea2('0x4')]=FreshdeskAccount; \ No newline at end of file +var _0x7bc5=['username','apiKey','token','remoteUri','serverUrl','Configurations','name'];(function(_0x40aa91,_0x391c5d){var _0x12c9ad=function(_0x3e1262){while(--_0x3e1262){_0x40aa91['push'](_0x40aa91['shift']());}};_0x12c9ad(++_0x391c5d);}(_0x7bc5,0x148));var _0x57bc=function(_0x4099ee,_0x38495a){_0x4099ee=_0x4099ee-0x0;var _0x1b7bfc=_0x7bc5[_0x4099ee];return _0x1b7bfc;};'use strict';function FreshdeskAccount(_0x1fe6a7){this['id']=_0x1fe6a7['id']||0x0;this[_0x57bc('0x0')]=_0x1fe6a7[_0x57bc('0x0')]||'';this[_0x57bc('0x1')]=_0x1fe6a7[_0x57bc('0x1')]||'';this[_0x57bc('0x2')]=_0x1fe6a7[_0x57bc('0x3')]||'';this[_0x57bc('0x4')]=_0x1fe6a7[_0x57bc('0x4')]||'';this[_0x57bc('0x5')]=_0x1fe6a7[_0x57bc('0x5')]||'';this[_0x57bc('0x6')]=_0x1fe6a7[_0x57bc('0x6')]||{};}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 30b7107..bb969d4 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 _0xbf25=['name','username','apiKey','token','remoteUri','serverUrl','Configurations'];(function(_0x2351df,_0x3fd2dd){var _0x1ec6b3=function(_0x36d14c){while(--_0x36d14c){_0x2351df['push'](_0x2351df['shift']());}};_0x1ec6b3(++_0x3fd2dd);}(_0xbf25,0x15e));var _0x5bf2=function(_0x22af64,_0x559bf0){_0x22af64=_0x22af64-0x0;var _0x488863=_0xbf25[_0x22af64];return _0x488863;};'use strict';function FreshsalesAccount(_0x4e3e16){this['id']=_0x4e3e16['id']||0x0;this['name']=_0x4e3e16[_0x5bf2('0x0')]||'';this[_0x5bf2('0x1')]=_0x4e3e16[_0x5bf2('0x1')]||'';this[_0x5bf2('0x2')]=_0x4e3e16[_0x5bf2('0x3')]||'';this[_0x5bf2('0x4')]=_0x4e3e16['remoteUri']||'';this[_0x5bf2('0x5')]=_0x4e3e16['serverUrl']||'';this[_0x5bf2('0x6')]=_0x4e3e16[_0x5bf2('0x6')]||{};}module['exports']=FreshsalesAccount; \ No newline at end of file +var _0x8a28=['token','remoteUri','serverUrl','Configurations','exports','name','username','apiKey'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x8a28,0xfd));var _0x88a2=function(_0xf0bcac,_0x531755){_0xf0bcac=_0xf0bcac-0x0;var _0x4e4c65=_0x8a28[_0xf0bcac];return _0x4e4c65;};'use strict';function FreshsalesAccount(_0x1baa5e){this['id']=_0x1baa5e['id']||0x0;this[_0x88a2('0x0')]=_0x1baa5e[_0x88a2('0x0')]||'';this[_0x88a2('0x1')]=_0x1baa5e[_0x88a2('0x1')]||'';this[_0x88a2('0x2')]=_0x1baa5e[_0x88a2('0x3')]||'';this[_0x88a2('0x4')]=_0x1baa5e['remoteUri']||'';this[_0x88a2('0x5')]=_0x1baa5e[_0x88a2('0x5')]||'';this[_0x88a2('0x6')]=_0x1baa5e[_0x88a2('0x6')]||{};}module[_0x88a2('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 f25b1ac..e4aea7b 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 _0xc426=['context','priority','holdtime','motionChannel','voice','mohtime','variables','type','inbound','uniqueid','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','position','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','connectedlinenum','connectedlinename'];(function(_0x10a06a,_0x46e6e2){var _0x2d9103=function(_0x45c406){while(--_0x45c406){_0x10a06a['push'](_0x10a06a['shift']());}};_0x2d9103(++_0x46e6e2);}(_0xc426,0xed));var _0x6c42=function(_0x41c97a,_0x5c5bf3){_0x41c97a=_0x41c97a-0x0;var _0x181e29=_0xc426[_0x41c97a];return _0x181e29;};'use strict';function QueueReport(){this[_0x6c42('0x0')]=_0x6c42('0x1');this[_0x6c42('0x2')]='';this['calleridnum']='';this[_0x6c42('0x3')]='';this[_0x6c42('0x4')]='';this[_0x6c42('0x5')]=null;this[_0x6c42('0x6')]=null;this[_0x6c42('0x7')]=0x1;this['count']=0x1;this[_0x6c42('0x8')]=![];this[_0x6c42('0x9')]=null;this[_0x6c42('0xa')]=![];this[_0x6c42('0xb')]=null;this[_0x6c42('0xc')]=![];this[_0x6c42('0xd')]=null;this['originalposition']=0x1;this['channel']='';this[_0x6c42('0xe')]='';this[_0x6c42('0xf')]='';this['accountcode']='';this[_0x6c42('0x10')]='';this['exten']='';this[_0x6c42('0x11')]='';this[_0x6c42('0x12')]=0x0;this['assigned']=![];this['lastAssignedTo']='';this[_0x6c42('0x13')]=_0x6c42('0x14');this['routealias']=null;this[_0x6c42('0x15')]=0x0;this[_0x6c42('0x16')]={};}module['exports']=QueueReport; \ No newline at end of file +var _0x466c=['uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','position','count','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','originalposition','channel','connectedlinenum','connectedlinename','accountcode','context','exten','priority','assigned','lastAssignedTo','motionChannel','variables','exports','type'];(function(_0x5a40cc,_0x53dcbe){var _0x3996ab=function(_0x486d5f){while(--_0x486d5f){_0x5a40cc['push'](_0x5a40cc['shift']());}};_0x3996ab(++_0x53dcbe);}(_0x466c,0x16b));var _0xc466=function(_0x3c400a,_0x557c21){_0x3c400a=_0x3c400a-0x0;var _0x3fb931=_0x466c[_0x3c400a];return _0x3fb931;};'use strict';function QueueReport(){this[_0xc466('0x0')]='inbound';this[_0xc466('0x1')]='';this[_0xc466('0x2')]='';this[_0xc466('0x3')]='';this[_0xc466('0x4')]='';this[_0xc466('0x5')]=null;this[_0xc466('0x6')]=null;this[_0xc466('0x7')]=0x1;this[_0xc466('0x8')]=0x1;this['queuecallerabandon']=![];this['queuecallerabandonAt']=null;this[_0xc466('0x9')]=![];this[_0xc466('0xa')]=null;this[_0xc466('0xb')]=![];this[_0xc466('0xc')]=null;this[_0xc466('0xd')]=0x1;this[_0xc466('0xe')]='';this[_0xc466('0xf')]='';this[_0xc466('0x10')]='';this[_0xc466('0x11')]='';this[_0xc466('0x12')]='';this[_0xc466('0x13')]='';this[_0xc466('0x14')]='';this['holdtime']=0x0;this[_0xc466('0x15')]=![];this[_0xc466('0x16')]='';this[_0xc466('0x17')]='voice';this['routealias']=null;this['mohtime']=0x0;this[_0xc466('0x18')]={};}module[_0xc466('0x19')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index b398a4c..18ad88e 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 _0x9c10=['integrationTab','serverUrl','Configurations','name','remoteUri','password','clientId','clientSecret','securityToken','type'];(function(_0x436a9b,_0x3a6675){var _0x25be79=function(_0x3c6804){while(--_0x3c6804){_0x436a9b['push'](_0x436a9b['shift']());}};_0x25be79(++_0x3a6675);}(_0x9c10,0x85));var _0x09c1=function(_0x5bfed0,_0x255c0d){_0x5bfed0=_0x5bfed0-0x0;var _0x439d92=_0x9c10[_0x5bfed0];return _0x439d92;};'use strict';function SalesforceAccount(_0x165fb5){this['id']=_0x165fb5['id']||0x0;this['name']=_0x165fb5[_0x09c1('0x0')]||'';this['username']=_0x165fb5['username']||'';this[_0x09c1('0x1')]=_0x165fb5[_0x09c1('0x1')]||'';this[_0x09c1('0x2')]=_0x165fb5[_0x09c1('0x2')]||'';this['clientId']=_0x165fb5[_0x09c1('0x3')]||'';this['clientSecret']=_0x165fb5[_0x09c1('0x4')]||'';this[_0x09c1('0x5')]=_0x165fb5['securityToken']||'';this[_0x09c1('0x6')]=_0x165fb5['type']||_0x09c1('0x7');this[_0x09c1('0x8')]=_0x165fb5[_0x09c1('0x8')]||'';this[_0x09c1('0x9')]=_0x165fb5[_0x09c1('0x9')]||{};}module['exports']=SalesforceAccount; \ No newline at end of file +var _0x930b=['remoteUri','password','clientId','clientSecret','securityToken','type','integrationTab','serverUrl','Configurations','name','username'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x930b,0x106));var _0xb930=function(_0x2acf39,_0x4db88b){_0x2acf39=_0x2acf39-0x0;var _0x530982=_0x930b[_0x2acf39];return _0x530982;};'use strict';function SalesforceAccount(_0xe6ec57){this['id']=_0xe6ec57['id']||0x0;this[_0xb930('0x0')]=_0xe6ec57['name']||'';this[_0xb930('0x1')]=_0xe6ec57[_0xb930('0x1')]||'';this[_0xb930('0x2')]=_0xe6ec57['remoteUri']||'';this['password']=_0xe6ec57[_0xb930('0x3')]||'';this[_0xb930('0x4')]=_0xe6ec57[_0xb930('0x4')]||'';this['clientSecret']=_0xe6ec57[_0xb930('0x5')]||'';this[_0xb930('0x6')]=_0xe6ec57[_0xb930('0x6')]||'';this['type']=_0xe6ec57[_0xb930('0x7')]||_0xb930('0x8');this[_0xb930('0x9')]=_0xe6ec57[_0xb930('0x9')]||'';this[_0xb930('0xa')]=_0xe6ec57['Configurations']||{};}module['exports']=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index ccce303..c2aff90 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 _0x5228=['remoteUri','Configurations','name','username','password'];(function(_0x4d04cb,_0x222a17){var _0x1c9f88=function(_0x3aa0bb){while(--_0x3aa0bb){_0x4d04cb['push'](_0x4d04cb['shift']());}};_0x1c9f88(++_0x222a17);}(_0x5228,0xe8));var _0x8522=function(_0x31091a,_0x11abb1){_0x31091a=_0x31091a-0x0;var _0x48475e=_0x5228[_0x31091a];return _0x48475e;};'use strict';function ServicenowAccount(_0x5482f7){this['id']=_0x5482f7['id']||0x0;this[_0x8522('0x0')]=_0x5482f7['name']||'';this[_0x8522('0x1')]=_0x5482f7[_0x8522('0x1')]||'';this['password']=_0x5482f7[_0x8522('0x2')]||'';this[_0x8522('0x3')]=_0x5482f7[_0x8522('0x3')]||'';this['serverUrl']=_0x5482f7['serverUrl']||'';this[_0x8522('0x4')]=_0x5482f7['Configurations']||{};}module['exports']=ServicenowAccount; \ No newline at end of file +var _0x5114=['password','Configurations','exports','username'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x5114,0x67));var _0x4511=function(_0x40e174,_0x56f057){_0x40e174=_0x40e174-0x0;var _0x3e3098=_0x5114[_0x40e174];return _0x3e3098;};'use strict';function ServicenowAccount(_0x4b42ed){this['id']=_0x4b42ed['id']||0x0;this['name']=_0x4b42ed['name']||'';this[_0x4511('0x0')]=_0x4b42ed['username']||'';this[_0x4511('0x1')]=_0x4b42ed[_0x4511('0x1')]||'';this['remoteUri']=_0x4b42ed['remoteUri']||'';this['serverUrl']=_0x4b42ed['serverUrl']||'';this['Configurations']=_0x4b42ed[_0x4511('0x2')]||{};}module[_0x4511('0x3')]=ServicenowAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index c31f9ab..46e59f4 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 _0xe88a=['remoteUri','serverUrl','Configurations','name','username','password'];(function(_0x9c8df9,_0x1d5c69){var _0x449fdc=function(_0x20d9e6){while(--_0x20d9e6){_0x9c8df9['push'](_0x9c8df9['shift']());}};_0x449fdc(++_0x1d5c69);}(_0xe88a,0xb1));var _0xae88=function(_0x4a626f,_0x3a1d67){_0x4a626f=_0x4a626f-0x0;var _0x325fe9=_0xe88a[_0x4a626f];return _0x325fe9;};'use strict';function SugarcrmAccount(_0x1216d2){this['id']=_0x1216d2['id']||0x0;this[_0xae88('0x0')]=_0x1216d2[_0xae88('0x0')]||'';this[_0xae88('0x1')]=_0x1216d2[_0xae88('0x1')]||'';this['password']=_0x1216d2[_0xae88('0x2')]||'';this[_0xae88('0x3')]=_0x1216d2['remoteUri']||'';this[_0xae88('0x4')]=_0x1216d2[_0xae88('0x4')]||'';this[_0xae88('0x5')]=_0x1216d2[_0xae88('0x5')]||{};}module['exports']=SugarcrmAccount; \ No newline at end of file +var _0x7094=['password','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x55e954,_0x1580d4){var _0x3203e0=function(_0x24b72a){while(--_0x24b72a){_0x55e954['push'](_0x55e954['shift']());}};_0x3203e0(++_0x1580d4);}(_0x7094,0x19b));var _0x4709=function(_0x5a7c49,_0x3d8dda){_0x5a7c49=_0x5a7c49-0x0;var _0xf8afc=_0x7094[_0x5a7c49];return _0xf8afc;};'use strict';function SugarcrmAccount(_0x4412a1){this['id']=_0x4412a1['id']||0x0;this['name']=_0x4412a1[_0x4709('0x0')]||'';this[_0x4709('0x1')]=_0x4412a1[_0x4709('0x1')]||'';this[_0x4709('0x2')]=_0x4412a1[_0x4709('0x2')]||'';this[_0x4709('0x3')]=_0x4412a1['remoteUri']||'';this[_0x4709('0x4')]=_0x4412a1[_0x4709('0x4')]||'';this[_0x4709('0x5')]=_0x4412a1['Configurations']||{};}module[_0x4709('0x6')]=SugarcrmAccount; \ No newline at end of file diff --git a/server/services/ami/model/telephone.js b/server/services/ami/model/telephone.js index 4ab5523..75ed810 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 _0x5f25=['stateTime','unknown','address','exports','name','accountcode','state'];(function(_0x18fce4,_0x5889b1){var _0x23188e=function(_0x255146){while(--_0x255146){_0x18fce4['push'](_0x18fce4['shift']());}};_0x23188e(++_0x5889b1);}(_0x5f25,0x1cb));var _0x55f2=function(_0x32f193,_0x612afc){_0x32f193=_0x32f193-0x0;var _0x5bb92e=_0x5f25[_0x32f193];return _0x5bb92e;};'use strict';function Telephone(_0x5970f1){this['id']=_0x5970f1['id']||0x0;this[_0x55f2('0x0')]=_0x5970f1[_0x55f2('0x0')]||'';this[_0x55f2('0x1')]=_0x5970f1[_0x55f2('0x1')]||'';this[_0x55f2('0x2')]='unknown';this[_0x55f2('0x3')]=0x0;this['status']=_0x55f2('0x4');this[_0x55f2('0x5')]='';}module[_0x55f2('0x6')]=Telephone; \ No newline at end of file +var _0x6f18=['address','exports','name','accountcode','state','stateTime','status'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x6f18,0x1b4));var _0x86f1=function(_0x2d4e4b,_0x5ccd04){_0x2d4e4b=_0x2d4e4b-0x0;var _0x310262=_0x6f18[_0x2d4e4b];return _0x310262;};'use strict';function Telephone(_0x2f2251){this['id']=_0x2f2251['id']||0x0;this['name']=_0x2f2251[_0x86f1('0x0')]||'';this['accountcode']=_0x2f2251[_0x86f1('0x1')]||'';this[_0x86f1('0x2')]='unknown';this[_0x86f1('0x3')]=0x0;this[_0x86f1('0x4')]='unknown';this[_0x86f1('0x5')]='';}module[_0x86f1('0x6')]=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index 63cc41c..83396bc 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(_0x16f2b8,_0x81d786){var _0x21cc2e=function(_0x9c5136){while(--_0x9c5136){_0x16f2b8['push'](_0x16f2b8['shift']());}};_0x21cc2e(++_0x81d786);}(_0xb10b,0x12a));var _0xbb10=function(_0x22ffbf,_0x16f31e){_0x22ffbf=_0x22ffbf-0x0;var _0x360c17=_0xb10b[_0x22ffbf];return _0x360c17;};'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(_0x37c922,_0x18c78c){var _0x4565f7=function(_0x14638b){while(--_0x14638b){_0x37c922['push'](_0x37c922['shift']());}};_0x4565f7(++_0x18c78c);}(_0xb10b,0x12a));var _0xbb10=function(_0x5a6961,_0xd41ca6){_0x5a6961=_0x5a6961-0x0;var _0x4af0a6=_0xb10b[_0x5a6961];return _0x4af0a6;};'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 43dd8d1..791f5d5 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 _0x2032=['exports','name','channel','voice','status','AllConditions','AnyConditions','Actions'];(function(_0x2e66b1,_0x714524){var _0x1682b0=function(_0x5a69e1){while(--_0x5a69e1){_0x2e66b1['push'](_0x2e66b1['shift']());}};_0x1682b0(++_0x714524);}(_0x2032,0xd9));var _0x2203=function(_0x3439d9,_0x3ca8fc){_0x3439d9=_0x3439d9-0x0;var _0x2fb4d6=_0x2032[_0x3439d9];return _0x2fb4d6;};'use strict';function Trigger(_0x4d6c97){this['id']=_0x4d6c97['id']||0x0;this[_0x2203('0x0')]=_0x4d6c97[_0x2203('0x0')]||'';this[_0x2203('0x1')]=_0x4d6c97['channel']||_0x2203('0x2');this[_0x2203('0x3')]=_0x4d6c97['status']||![];this[_0x2203('0x4')]=_0x4d6c97[_0x2203('0x4')]||[];this[_0x2203('0x5')]=_0x4d6c97[_0x2203('0x5')]||[];this[_0x2203('0x6')]=_0x4d6c97[_0x2203('0x6')]||[];}module[_0x2203('0x7')]=Trigger; \ No newline at end of file +var _0x1a85=['status','AllConditions','AnyConditions','Actions','name','channel'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x1a85,0x178));var _0x51a8=function(_0x3498f5,_0x35cbaf){_0x3498f5=_0x3498f5-0x0;var _0x2273da=_0x1a85[_0x3498f5];return _0x2273da;};'use strict';function Trigger(_0x4570ac){this['id']=_0x4570ac['id']||0x0;this['name']=_0x4570ac[_0x51a8('0x0')]||'';this[_0x51a8('0x1')]=_0x4570ac[_0x51a8('0x1')]||'voice';this['status']=_0x4570ac[_0x51a8('0x2')]||![];this[_0x51a8('0x3')]=_0x4570ac[_0x51a8('0x3')]||[];this['AnyConditions']=_0x4570ac[_0x51a8('0x4')]||[];this['Actions']=_0x4570ac[_0x51a8('0x5')]||[];}module['exports']=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index 5b3a5ef..ac1bf4e 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 _0xef89=['name','state','unknown','status','registry','indexOf','host','port','domain','stateRegistry','registrationtime','address','defaultuser','exports','active'];(function(_0x3f6594,_0x355aa8){var _0x206afa=function(_0x3eb00e){while(--_0x3eb00e){_0x3f6594['push'](_0x3f6594['shift']());}};_0x206afa(++_0x355aa8);}(_0xef89,0xfe));var _0x9ef8=function(_0x5f53ab,_0x324327){_0x5f53ab=_0x5f53ab-0x0;var _0x116166=_0xef89[_0x5f53ab];return _0x116166;};'use strict';function Trunk(_0x11c893){this['id']=_0x11c893['id']||0x0;this[_0x9ef8('0x0')]=_0x11c893[_0x9ef8('0x0')]||![];this[_0x9ef8('0x1')]=_0x11c893[_0x9ef8('0x1')]||'';this[_0x9ef8('0x2')]=_0x9ef8('0x3');this['stateTime']=0x0;this[_0x9ef8('0x4')]=_0x9ef8('0x3');this[_0x9ef8('0x5')]=_0x11c893[_0x9ef8('0x5')]&&_0x11c893[_0x9ef8('0x5')][_0x9ef8('0x6')](':')?_0x11c893[_0x9ef8('0x5')]['split'](':')[0x0]:'';this[_0x9ef8('0x7')]='';this[_0x9ef8('0x8')]='';this[_0x9ef8('0x9')]='';this['domainport']='';this['refresh']='';this[_0x9ef8('0xa')]='unknown';this[_0x9ef8('0xb')]='';this[_0x9ef8('0xc')]='';this[_0x9ef8('0xd')]=_0x11c893[_0x9ef8('0xd')]||'';}module[_0x9ef8('0xe')]=Trunk; \ No newline at end of file +var _0x8cc3=['stateTime','registry','indexOf','split','host','port','domain','domainport','refresh','stateRegistry','registrationtime','defaultuser','exports','name','unknown'];(function(_0x341da8,_0x2eb063){var _0x319832=function(_0x3d9e8e){while(--_0x3d9e8e){_0x341da8['push'](_0x341da8['shift']());}};_0x319832(++_0x2eb063);}(_0x8cc3,0x157));var _0x38cc=function(_0x196b0d,_0x4a3ff7){_0x196b0d=_0x196b0d-0x0;var _0x52452e=_0x8cc3[_0x196b0d];return _0x52452e;};'use strict';function Trunk(_0x217120){this['id']=_0x217120['id']||0x0;this['active']=_0x217120['active']||![];this[_0x38cc('0x0')]=_0x217120[_0x38cc('0x0')]||'';this['state']=_0x38cc('0x1');this[_0x38cc('0x2')]=0x0;this['status']=_0x38cc('0x1');this[_0x38cc('0x3')]=_0x217120['registry']&&_0x217120['registry'][_0x38cc('0x4')](':')?_0x217120['registry'][_0x38cc('0x5')](':')[0x0]:'';this[_0x38cc('0x6')]='';this[_0x38cc('0x7')]='';this[_0x38cc('0x8')]='';this[_0x38cc('0x9')]='';this[_0x38cc('0xa')]='';this[_0x38cc('0xb')]=_0x38cc('0x1');this[_0x38cc('0xc')]='';this['address']='';this[_0x38cc('0xd')]=_0x217120['defaultuser']||'';}module[_0x38cc('0xe')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index a08f2aa..e309ccf 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 _0x1447=['exports','exten','recordingFormat','mandatoryDisposition'];(function(_0x3445cb,_0x592767){var _0x1fb70b=function(_0x58d14e){while(--_0x58d14e){_0x3445cb['push'](_0x3445cb['shift']());}};_0x1fb70b(++_0x592767);}(_0x1447,0x18d));var _0x7144=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x1447[_0x199572];return _0x13cfa3;};'use strict';function voiceExtension(_0x4aa15d){this['id']=_0x4aa15d['id']||0x0;this[_0x7144('0x0')]=_0x4aa15d[_0x7144('0x0')]||'';this[_0x7144('0x1')]=_0x4aa15d[_0x7144('0x1')]||'none';this['mandatoryDisposition']=_0x4aa15d[_0x7144('0x2')]||![];}module[_0x7144('0x3')]=voiceExtension; \ No newline at end of file +var _0x48ea=['mandatoryDisposition','exten','recordingFormat'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x48ea,0x1b4));var _0xa48e=function(_0x1b834c,_0x12d53c){_0x1b834c=_0x1b834c-0x0;var _0x49ea2d=_0x48ea[_0x1b834c];return _0x49ea2d;};'use strict';function voiceExtension(_0x5b6406){this['id']=_0x5b6406['id']||0x0;this[_0xa48e('0x0')]=_0x5b6406[_0xa48e('0x0')]||'';this[_0xa48e('0x1')]=_0x5b6406[_0xa48e('0x1')]||'none';this[_0xa48e('0x2')]=_0x5b6406[_0xa48e('0x2')]||![];}module['exports']=voiceExtension; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index b15fede..caacb79 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 _0x444f=['dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCallsDroppedCalls','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','queueSummaryCountersUpdated','exports','wav49','gsm','fewestcalls','random','ringall','roundrobin','rrmemory','rrordered','wrandom','name','monitor_format','type','inbound','waiting','total','answered','sumDuration','sumHoldTime','sumBillable','unmanaged','abandoned','available','invalid','loggedIn','notInUse','onHold','paused','ringing','ringInUse','unknown','acw','acwTimeout','autopause','sendMessageOneNotActive','message','statusMessage','originated','temp','dialTimezone','dialGlobalInterval','dialActive','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','anonymous','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','queueStatusComplete'];(function(_0x1bf8ee,_0x513669){var _0x4752ce=function(_0x2a229c){while(--_0x2a229c){_0x1bf8ee['push'](_0x1bf8ee['shift']());}};_0x4752ce(++_0x513669);}(_0x444f,0xb5));var _0xf444=function(_0xd6fcb5,_0x526523){_0xd6fcb5=_0xd6fcb5-0x0;var _0x278ac7=_0x444f[_0xd6fcb5];return _0x278ac7;};'use strict';var monitorFormat={'wav':'wav','wav49':_0xf444('0x0'),'gsm':_0xf444('0x1')};var strategy={'fewestcalls':_0xf444('0x2'),'leastrecent':'leastrecent','linear':'linear','random':_0xf444('0x3'),'ringall':_0xf444('0x4'),'rr':_0xf444('0x5'),'rrmemory':_0xf444('0x6'),'rrordered':_0xf444('0x7'),'wrandom':_0xf444('0x8')};function VoiceQueue(_0x4c9730){this['id']=_0x4c9730['id']||0x0;this[_0xf444('0x9')]=_0x4c9730[_0xf444('0x9')]||'';this[_0xf444('0xa')]=_0x4c9730[_0xf444('0xa')]||'';this[_0xf444('0xb')]=_0x4c9730['type']||_0xf444('0xc');this[_0xf444('0xd')]=0x0;this[_0xf444('0xe')]=0x0;this[_0xf444('0xf')]=0x0;this[_0xf444('0x10')]=0x0;this[_0xf444('0x11')]=0x0;this[_0xf444('0x12')]=0x0;this[_0xf444('0x13')]=0x0;this[_0xf444('0x14')]=0x0;this[_0xf444('0x15')]=0x0;this['busy']=0x0;this['inUse']=0x0;this[_0xf444('0x16')]=0x0;this[_0xf444('0x17')]=0x0;this[_0xf444('0x18')]=0x0;this[_0xf444('0x19')]=0x0;this[_0xf444('0x1a')]=0x0;this[_0xf444('0x1b')]=0x0;this[_0xf444('0x1c')]=0x0;this['talking']=0x0;this['unavailable']=0x0;this[_0xf444('0x1d')]=0x0;this[_0xf444('0x1e')]=_0x4c9730[_0xf444('0x1e')]||![];this[_0xf444('0x1f')]=_0x4c9730[_0xf444('0x1f')]||0xa;this[_0xf444('0x20')]=_0x4c9730[_0xf444('0x20')]||'no';this[_0xf444('0x21')]=!![];this[_0xf444('0x22')]='';this[_0xf444('0x23')]='';this[_0xf444('0x24')]=0x0;this[_0xf444('0x25')]=0x0;this[_0xf444('0x26')]=_0x4c9730[_0xf444('0x26')]||null;this[_0xf444('0x27')]=_0x4c9730[_0xf444('0x27')]?_0x4c9730[_0xf444('0x27')]:null;this[_0xf444('0x28')]=_0x4c9730['dialActive'];this['dialMethod']=_0x4c9730['dialMethod']||_0xf444('0x29');this[_0xf444('0x2a')]=_0x4c9730['dialLimitChannel']||0x0;this[_0xf444('0x2b')]=_0x4c9730[_0xf444('0x2b')]||0x0;this[_0xf444('0x2c')]=_0x4c9730['dialPowerLevel']||0x1;this[_0xf444('0x2d')]=_0x4c9730['dialPredictiveOptimization']||_0xf444('0x2e');this['dialPredictiveOptimizationPercentage']=_0x4c9730['dialPredictiveOptimizationPercentage']||0.03;this[_0xf444('0x2f')]=_0x4c9730[_0xf444('0x2f')]||0x258;this['dialOriginateCallerIdName']=_0x4c9730[_0xf444('0x30')]||'anonymous';this[_0xf444('0x31')]=_0x4c9730[_0xf444('0x31')]||_0xf444('0x32');this[_0xf444('0x33')]=_0x4c9730['dialOriginateTimeout']||0x1e;this['dialQueueOptions']=_0x4c9730[_0xf444('0x34')]||_0xf444('0x35');this[_0xf444('0x36')]=_0x4c9730[_0xf444('0x36')]||0x3;this['dialQueueProject']=_0x4c9730[_0xf444('0x37')]||undefined;this[_0xf444('0x38')]=_0x4c9730[_0xf444('0x38')]||0x3;this[_0xf444('0x39')]=_0x4c9730[_0xf444('0x39')]||0x96;this[_0xf444('0x3a')]=_0x4c9730[_0xf444('0x3a')]||0x3;this[_0xf444('0x3b')]=_0x4c9730[_0xf444('0x3b')]||0x96;this['dialNoAnswerMaxRetry']=_0x4c9730[_0xf444('0x3c')]||0x3;this[_0xf444('0x3d')]=_0x4c9730[_0xf444('0x3d')]||0x96;this[_0xf444('0x3e')]=_0x4c9730[_0xf444('0x3e')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0x4c9730[_0xf444('0x3f')]||0x96;this[_0xf444('0x40')]=_0x4c9730[_0xf444('0x40')]||0x3;this[_0xf444('0x41')]=_0x4c9730['dialDropRetryFrequency']||0x96;this[_0xf444('0x42')]=_0x4c9730[_0xf444('0x42')]||0x3;this[_0xf444('0x43')]=_0x4c9730['dialAbandonedRetryFrequency']||0x96;this[_0xf444('0x44')]=_0x4c9730[_0xf444('0x44')]||0x3;this[_0xf444('0x45')]=_0x4c9730[_0xf444('0x45')]||0x96;this[_0xf444('0x46')]=_0x4c9730[_0xf444('0x46')]||0x3;this[_0xf444('0x47')]=_0x4c9730['dialAgentRejectRetryFrequency']||0x96;this[_0xf444('0x48')]=_0x4c9730['callAdditionalPhoneAfterMin']||0x3;this[_0xf444('0x49')]=_0x4c9730['dialGlobalMaxRetry']||0x4;this['Trunk']=_0x4c9730[_0xf444('0x4a')]?_0x4c9730[_0xf444('0x4a')]:undefined;this[_0xf444('0x4b')]=_0x4c9730['TrunkBackup']?_0x4c9730[_0xf444('0x4b')]:undefined;this[_0xf444('0x4c')]=_0x4c9730[_0xf444('0x4c')]||undefined;this[_0xf444('0x4d')]=_0x4c9730['Interval']?_0x4c9730[_0xf444('0x4d')]:undefined;this[_0xf444('0x4e')]=_0x4c9730[_0xf444('0x4e')]||_0xf444('0x4f');this[_0xf444('0x50')]=_0x4c9730[_0xf444('0x50')]||undefined;this[_0xf444('0x51')]=_0x4c9730['dialCutDigit']||undefined;this['strategy']=strategy[_0x4c9730['strategy']];this[_0xf444('0x52')]=!![];this[_0xf444('0x53')]=_0x4c9730[_0xf444('0x53')]||![];this[_0xf444('0x54')]=_0x4c9730['dialAMDInitialSilence'];this[_0xf444('0x55')]=_0x4c9730[_0xf444('0x55')];this[_0xf444('0x56')]=_0x4c9730[_0xf444('0x56')];this[_0xf444('0x57')]=_0x4c9730[_0xf444('0x57')];this[_0xf444('0x58')]=_0x4c9730[_0xf444('0x58')];this['dialAMDBetweenWordsSilence']=_0x4c9730[_0xf444('0x59')];this[_0xf444('0x5a')]=_0x4c9730[_0xf444('0x5a')];this['dialAMDSilenceThreshold']=_0x4c9730['dialAMDSilenceThreshold'];this[_0xf444('0x5b')]=_0x4c9730['dialAMDMaximumWordLength'];this[_0xf444('0x5c')]=0x0;this[_0xf444('0x5d')]=0x0;this[_0xf444('0x5e')]=_0x4c9730[_0xf444('0x5e')];this[_0xf444('0x5f')]=0x0;this[_0xf444('0x60')]=0x0;this[_0xf444('0x61')]=0x0;this[_0xf444('0x62')]=0x0;this[_0xf444('0x63')]=0x0;this['outboundNoSuchCallsDay']=0x0;this['outboundUnknownCallsDay']=0x0;this[_0xf444('0x64')]=0x0;this[_0xf444('0x65')]=0x0;this[_0xf444('0x66')]=0x0;this[_0xf444('0x67')]=0x0;this[_0xf444('0x68')]=0x0;this[_0xf444('0x69')]=0x0;this[_0xf444('0x6a')]=0x0;this['startProgressive']=undefined;this['startPredictive']=undefined;this[_0xf444('0x6b')]=undefined;this[_0xf444('0x6c')]=1.05;this[_0xf444('0x6d')]=0x0;this[_0xf444('0x6e')]=0x0;this[_0xf444('0x6f')]=0x0;this[_0xf444('0x70')]=0x0;this['predictiveIntervalAvgHoldtime']=0x0;this[_0xf444('0x71')]=0x0;this[_0xf444('0x72')]=0x0;this[_0xf444('0x73')]=0x0;this['predictiveIntervalMaxThreshold']=_0x4c9730[_0xf444('0x74')]||0x14;this[_0xf444('0x75')]=_0x4c9730[_0xf444('0x74')]||0xa;this['predictiveIntervalErlangCalls']=0x0;this[_0xf444('0x76')]=0x0;this['predictiveIntervalHitRate']=0x1;this[_0xf444('0x77')]=0x0;this['erlangCallToSecond']=0x0;this[_0xf444('0x78')]=0x0;this[_0xf444('0x79')]=0x0;this['dialRecallMeTimeout']=_0x4c9730[_0xf444('0x7a')]||0x1e;this[_0xf444('0x7b')]=_0x4c9730[_0xf444('0x7b')]||![];this[_0xf444('0x7c')]=!!_0x4c9730[_0xf444('0x7c')]||![];this[_0xf444('0x7d')]=!!_0x4c9730[_0xf444('0x7d')]||![];this['dialQueueProject2']=_0x4c9730['dialQueueProject2']||undefined;this['dialAgiAfterHangupClient']=_0x4c9730[_0xf444('0x7e')]||![];this[_0xf444('0x7f')]=_0x4c9730[_0xf444('0x7f')]||![];this[_0xf444('0xa')]=monitorFormat[_0x4c9730[_0xf444('0xa')]]?monitorFormat[_0x4c9730[_0xf444('0xa')]]:undefined;this[_0xf444('0x80')]=_0x4c9730['mandatoryDisposition']||![];this[_0xf444('0x81')]=_0x4c9730[_0xf444('0x81')]?_0x4c9730[_0xf444('0x81')]:undefined;this[_0xf444('0x82')]=![];}module[_0xf444('0x83')]=VoiceQueue; \ No newline at end of file +var _0x042a=['dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','strategy','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startProgressive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','queueSummaryCountersUpdated','exports','wav','gsm','fewestcalls','leastrecent','random','ringall','roundrobin','rrmemory','rrordered','wrandom','name','monitor_format','type','waiting','total','answered','sumDuration','sumHoldTime','sumBillable','abandoned','busy','invalid','loggedIn','notInUse','paused','ringing','ringInUse','unavailable','unknown','acw','acwTimeout','autopause','sendMessageOneNotActive','message','statusMessage','dialTimezone','dialGlobalInterval','dialActive','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout'];(function(_0x38c6f4,_0x49db76){var _0x234f40=function(_0x9a7863){while(--_0x9a7863){_0x38c6f4['push'](_0x38c6f4['shift']());}};_0x234f40(++_0x49db76);}(_0x042a,0x1d9));var _0xa042=function(_0xfc311b,_0x5a44b6){_0xfc311b=_0xfc311b-0x0;var _0x3b599f=_0x042a[_0xfc311b];return _0x3b599f;};'use strict';var monitorFormat={'wav':_0xa042('0x0'),'wav49':'wav49','gsm':_0xa042('0x1')};var strategy={'fewestcalls':_0xa042('0x2'),'leastrecent':_0xa042('0x3'),'linear':'linear','random':_0xa042('0x4'),'ringall':_0xa042('0x5'),'rr':_0xa042('0x6'),'rrmemory':_0xa042('0x7'),'rrordered':_0xa042('0x8'),'wrandom':_0xa042('0x9')};function VoiceQueue(_0x622ece){this['id']=_0x622ece['id']||0x0;this[_0xa042('0xa')]=_0x622ece['name']||'';this[_0xa042('0xb')]=_0x622ece[_0xa042('0xb')]||'';this['type']=_0x622ece[_0xa042('0xc')]||'inbound';this[_0xa042('0xd')]=0x0;this[_0xa042('0xe')]=0x0;this[_0xa042('0xf')]=0x0;this[_0xa042('0x10')]=0x0;this[_0xa042('0x11')]=0x0;this[_0xa042('0x12')]=0x0;this['unmanaged']=0x0;this[_0xa042('0x13')]=0x0;this['available']=0x0;this[_0xa042('0x14')]=0x0;this['inUse']=0x0;this[_0xa042('0x15')]=0x0;this[_0xa042('0x16')]=0x0;this[_0xa042('0x17')]=0x0;this['onHold']=0x0;this[_0xa042('0x18')]=0x0;this[_0xa042('0x19')]=0x0;this[_0xa042('0x1a')]=0x0;this['talking']=0x0;this[_0xa042('0x1b')]=0x0;this[_0xa042('0x1c')]=0x0;this[_0xa042('0x1d')]=_0x622ece[_0xa042('0x1d')]||![];this['acwTimeout']=_0x622ece[_0xa042('0x1e')]||0xa;this[_0xa042('0x1f')]=_0x622ece[_0xa042('0x1f')]||'no';this[_0xa042('0x20')]=!![];this[_0xa042('0x21')]='';this[_0xa042('0x22')]='';this['originated']=0x0;this['temp']=0x0;this[_0xa042('0x23')]=_0x622ece[_0xa042('0x23')]||null;this[_0xa042('0x24')]=_0x622ece[_0xa042('0x24')]?_0x622ece[_0xa042('0x24')]:null;this[_0xa042('0x25')]=_0x622ece[_0xa042('0x25')];this['dialMethod']=_0x622ece['dialMethod']||'progressive';this['dialLimitChannel']=_0x622ece['dialLimitChannel']||0x0;this[_0xa042('0x26')]=_0x622ece[_0xa042('0x26')]||0x0;this[_0xa042('0x27')]=_0x622ece[_0xa042('0x27')]||0x1;this[_0xa042('0x28')]=_0x622ece[_0xa042('0x28')]||'dropRate';this[_0xa042('0x29')]=_0x622ece[_0xa042('0x29')]||0.03;this[_0xa042('0x2a')]=_0x622ece[_0xa042('0x2a')]||0x258;this['dialOriginateCallerIdName']=_0x622ece[_0xa042('0x2b')]||_0xa042('0x2c');this[_0xa042('0x2d')]=_0x622ece[_0xa042('0x2d')]||_0xa042('0x2c');this[_0xa042('0x2e')]=_0x622ece[_0xa042('0x2e')]||0x1e;this[_0xa042('0x2f')]=_0x622ece[_0xa042('0x2f')]||_0xa042('0x30');this[_0xa042('0x31')]=_0x622ece[_0xa042('0x31')]||0x3;this[_0xa042('0x32')]=_0x622ece[_0xa042('0x32')]||undefined;this['dialCongestionMaxRetry']=_0x622ece[_0xa042('0x33')]||0x3;this[_0xa042('0x34')]=_0x622ece['dialCongestionRetryFrequency']||0x96;this[_0xa042('0x35')]=_0x622ece[_0xa042('0x35')]||0x3;this['dialBusyRetryFrequency']=_0x622ece[_0xa042('0x36')]||0x96;this[_0xa042('0x37')]=_0x622ece[_0xa042('0x37')]||0x3;this[_0xa042('0x38')]=_0x622ece[_0xa042('0x38')]||0x96;this[_0xa042('0x39')]=_0x622ece[_0xa042('0x39')]||0x3;this[_0xa042('0x3a')]=_0x622ece[_0xa042('0x3a')]||0x96;this[_0xa042('0x3b')]=_0x622ece[_0xa042('0x3b')]||0x3;this['dialDropRetryFrequency']=_0x622ece['dialDropRetryFrequency']||0x96;this[_0xa042('0x3c')]=_0x622ece[_0xa042('0x3c')]||0x3;this[_0xa042('0x3d')]=_0x622ece[_0xa042('0x3d')]||0x96;this['dialMachineMaxRetry']=_0x622ece[_0xa042('0x3e')]||0x3;this['dialMachineRetryFrequency']=_0x622ece[_0xa042('0x3f')]||0x96;this[_0xa042('0x40')]=_0x622ece['dialAgentRejectMaxRetry']||0x3;this['dialAgentRejectRetryFrequency']=_0x622ece['dialAgentRejectRetryFrequency']||0x96;this['callAdditionalPhoneAfterMin']=_0x622ece[_0xa042('0x41')]||0x3;this['dialGlobalMaxRetry']=_0x622ece[_0xa042('0x42')]||0x4;this[_0xa042('0x43')]=_0x622ece['Trunk']?_0x622ece[_0xa042('0x43')]:undefined;this['TrunkBackup']=_0x622ece['TrunkBackup']?_0x622ece[_0xa042('0x44')]:undefined;this[_0xa042('0x45')]=_0x622ece[_0xa042('0x45')]||undefined;this[_0xa042('0x46')]=_0x622ece[_0xa042('0x46')]?_0x622ece[_0xa042('0x46')]:undefined;this[_0xa042('0x47')]=_0x622ece[_0xa042('0x47')]||_0xa042('0x48');this[_0xa042('0x49')]=_0x622ece[_0xa042('0x49')]||undefined;this['dialCutDigit']=_0x622ece['dialCutDigit']||undefined;this['strategy']=strategy[_0x622ece[_0xa042('0x4a')]];this['queueStatusComplete']=!![];this[_0xa042('0x4b')]=_0x622ece[_0xa042('0x4b')]||![];this[_0xa042('0x4c')]=_0x622ece[_0xa042('0x4c')];this['dialAMDGreeting']=_0x622ece[_0xa042('0x4d')];this['dialAMDAfterGreetingSilence']=_0x622ece['dialAMDAfterGreetingSilence'];this[_0xa042('0x4e')]=_0x622ece['dialAMDTotalAnalysisTime'];this[_0xa042('0x4f')]=_0x622ece[_0xa042('0x4f')];this[_0xa042('0x50')]=_0x622ece[_0xa042('0x50')];this[_0xa042('0x51')]=_0x622ece['dialAMDMaximumNumberOfWords'];this[_0xa042('0x52')]=_0x622ece[_0xa042('0x52')];this[_0xa042('0x53')]=_0x622ece[_0xa042('0x53')];this[_0xa042('0x54')]=0x0;this[_0xa042('0x55')]=0x0;this[_0xa042('0x56')]=_0x622ece[_0xa042('0x56')];this[_0xa042('0x57')]=0x0;this[_0xa042('0x58')]=0x0;this[_0xa042('0x59')]=0x0;this[_0xa042('0x5a')]=0x0;this[_0xa042('0x5b')]=0x0;this[_0xa042('0x5c')]=0x0;this['outboundUnknownCallsDay']=0x0;this[_0xa042('0x5d')]=0x0;this[_0xa042('0x5e')]=0x0;this['outboundDropCallsDayCallersExit']=0x0;this[_0xa042('0x5f')]=0x0;this[_0xa042('0x60')]=0x0;this[_0xa042('0x61')]=0x0;this[_0xa042('0x62')]=0x0;this[_0xa042('0x63')]=undefined;this['startPredictive']=undefined;this[_0xa042('0x64')]=undefined;this[_0xa042('0x65')]=1.05;this[_0xa042('0x66')]=0x0;this[_0xa042('0x67')]=0x0;this[_0xa042('0x68')]=0x0;this[_0xa042('0x69')]=0x0;this[_0xa042('0x6a')]=0x0;this[_0xa042('0x6b')]=0x0;this[_0xa042('0x6c')]=0x0;this[_0xa042('0x6d')]=0x0;this[_0xa042('0x6e')]=_0x622ece['dialPredictiveIntervalMaxThreshold']||0x14;this[_0xa042('0x6f')]=_0x622ece[_0xa042('0x70')]||0xa;this[_0xa042('0x71')]=0x0;this[_0xa042('0x72')]=0x0;this[_0xa042('0x73')]=0x1;this['erlangCalls']=0x0;this[_0xa042('0x74')]=0x0;this[_0xa042('0x75')]=0x0;this[_0xa042('0x76')]=0x0;this[_0xa042('0x77')]=_0x622ece['dialRecallMeTimeout']||0x1e;this['dialRecallInQueue']=_0x622ece[_0xa042('0x78')]||![];this[_0xa042('0x79')]=!!_0x622ece['dialPreviewAutoRecallMe']||![];this[_0xa042('0x7a')]=!!_0x622ece[_0xa042('0x7a')]||![];this[_0xa042('0x7b')]=_0x622ece[_0xa042('0x7b')]||undefined;this['dialAgiAfterHangupClient']=_0x622ece[_0xa042('0x7c')]||![];this['dialAgiAfterHangupAgent']=_0x622ece[_0xa042('0x7d')]||![];this[_0xa042('0xb')]=monitorFormat[_0x622ece[_0xa042('0xb')]]?monitorFormat[_0x622ece['monitor_format']]:undefined;this[_0xa042('0x7e')]=_0x622ece['mandatoryDisposition']||![];this[_0xa042('0x7f')]=_0x622ece[_0xa042('0x7f')]?_0x622ece['mandatoryDispositionPause']:undefined;this[_0xa042('0x80')]=![];}module[_0xa042('0x81')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueueSummary.js b/server/services/ami/model/voiceQueueSummary.js index 4b38e17..00cda9a 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 _0x8098=['abandoned','available','busy','invalid','onHold','notInUse','sumHoldTime','type','unavailable','unknown','unmanaged','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundBlacklistCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundOriginateFailureCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','message','statusMessage','Trunk','active','callerid','prototype','createReport','ringInUse','loggedin','callers','length','online','incall','status','booked','keys','queue','dialer','exten','xcally-motion-preview','compareToInboundQueue','some','compareToOutboundQueue','updateReportFromOutboundQueue','preview','exports','loggedInDb','paused','ringing','talking','waiting','answered','inUse','loggedIn','outboundAbandonedCallsDay','outboundAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','pTalking','sumBillable','sumDuration','total','name','strategy'];(function(_0x3257db,_0x21b938){var _0x134324=function(_0x21b568){while(--_0x21b568){_0x3257db['push'](_0x3257db['shift']());}};_0x134324(++_0x21b938);}(_0x8098,0x1ba));var _0x8809=function(_0x45173d,_0x1960ec){_0x45173d=_0x45173d-0x0;var _0x42746a=_0x8098[_0x45173d];return _0x42746a;};'use strict';var INBOUND_COUNTERS=['available','loggedIn',_0x8809('0x0'),_0x8809('0x1'),_0x8809('0x2'),_0x8809('0x3'),_0x8809('0x4')];var OUTBOUND_COUNTERS=['available',_0x8809('0x5'),_0x8809('0x6'),_0x8809('0x7'),_0x8809('0x0'),'originated',_0x8809('0x8'),_0x8809('0x9'),'outboundBlacklistCallsDay',_0x8809('0xa'),_0x8809('0xb'),_0x8809('0xc'),_0x8809('0xd'),_0x8809('0xe'),_0x8809('0xf'),_0x8809('0x10'),_0x8809('0x1'),_0x8809('0x11'),_0x8809('0x3'),_0x8809('0x12'),_0x8809('0x13'),_0x8809('0x14'),_0x8809('0x4')];function VoiceQueueSummary(_0x324381){this['id']=_0x324381['id'];this[_0x8809('0x15')]=_0x324381['name'];this[_0x8809('0x16')]=_0x324381[_0x8809('0x16')];this['abandoned']=_0x324381[_0x8809('0x17')]||0x0;this[_0x8809('0x5')]=_0x324381['answered']||0x0;this['available']=_0x324381[_0x8809('0x18')]||0x0;this[_0x8809('0x19')]=_0x324381[_0x8809('0x19')]||0x0;this[_0x8809('0x6')]=_0x324381[_0x8809('0x6')]||0x0;this[_0x8809('0x1a')]=_0x324381[_0x8809('0x1a')]||0x0;this['loggedIn']=_0x324381[_0x8809('0x7')]||0x0;this[_0x8809('0x0')]=_0x324381['loggedInDb']||0x0;this[_0x8809('0x1b')]=_0x324381[_0x8809('0x1b')]||0x0;this['notInUse']=_0x324381[_0x8809('0x1c')]||0x0;this[_0x8809('0x1')]=_0x324381[_0x8809('0x1')]||0x0;this[_0x8809('0x2')]=_0x324381[_0x8809('0x2')]||0x0;this['ringInUse']=_0x324381['ringInUse'];this[_0x8809('0x12')]=_0x324381[_0x8809('0x12')];this[_0x8809('0x13')]=_0x324381[_0x8809('0x13')];this[_0x8809('0x1d')]=_0x324381[_0x8809('0x1d')]||0x0;this[_0x8809('0x3')]=_0x324381[_0x8809('0x3')]||0x0;this[_0x8809('0x14')]=_0x324381[_0x8809('0x14')]||0x0;this[_0x8809('0x1e')]=_0x324381[_0x8809('0x1e')];this[_0x8809('0x1f')]=_0x324381['unavailable']||0x0;this['unknown']=_0x324381[_0x8809('0x20')]||0x0;this[_0x8809('0x21')]=_0x324381['unmanaged']||0x0;this['waiting']=_0x324381['waiting']||0x0;if(_0x324381[_0x8809('0x1e')]===_0x8809('0x22')){this[_0x8809('0x11')]=_0x324381[_0x8809('0x11')]||0x0;this[_0x8809('0x23')]=_0x324381[_0x8809('0x23')];this[_0x8809('0x24')]=_0x324381[_0x8809('0x24')];this[_0x8809('0x25')]=_0x324381[_0x8809('0x25')];this[_0x8809('0x26')]=_0x324381[_0x8809('0x26')];this['dialOriginateTimeout']=_0x324381[_0x8809('0x27')];this[_0x8809('0x28')]=_0x324381[_0x8809('0x28')];this['temp']=_0x324381[_0x8809('0x29')];this[_0x8809('0x2a')]=_0x324381[_0x8809('0x2a')];this[_0x8809('0x9')]=_0x324381[_0x8809('0x9')];this['outboundBlacklistCallsDay']=_0x324381[_0x8809('0x2b')];this['outboundBusyCallsDay']=_0x324381[_0x8809('0xa')];this[_0x8809('0xb')]=_0x324381['outboundCongestionCallsDay'];this[_0x8809('0x2c')]=_0x324381['outboundDropCallsDayACS'];this[_0x8809('0x2d')]=_0x324381[_0x8809('0x2d')];this[_0x8809('0x2e')]=_0x324381[_0x8809('0x2e')];this[_0x8809('0xc')]=_0x324381[_0x8809('0xc')];this['outboundNoSuchCallsDay']=_0x324381['outboundNoSuchCallsDay'];this[_0x8809('0x2f')]=_0x324381[_0x8809('0x2f')];this[_0x8809('0xe')]=_0x324381[_0x8809('0xe')];this[_0x8809('0xf')]=_0x324381['outboundRejectCallsDay'];this[_0x8809('0x10')]=_0x324381['outboundUnknownCallsDay'];this['predictiveIntervalAnsweredCalls']=_0x324381[_0x8809('0x30')];this['predictiveIntervalAvgHoldtime']=_0x324381[_0x8809('0x31')];this['predictiveIntervalAvgTalktime']=_0x324381[_0x8809('0x32')];this[_0x8809('0x33')]=_0x324381[_0x8809('0x33')];this[_0x8809('0x34')]=_0x324381[_0x8809('0x34')];this[_0x8809('0x35')]=_0x324381['predictiveIntervalErlangCalls'];this[_0x8809('0x36')]=_0x324381[_0x8809('0x36')];this['predictiveIntervalHitRate']=_0x324381[_0x8809('0x37')];this[_0x8809('0x38')]=_0x324381[_0x8809('0x38')];this[_0x8809('0x39')]=_0x324381[_0x8809('0x39')];this[_0x8809('0x3a')]=_0x324381['predictiveIntervalAvailable'];this[_0x8809('0x3b')]=_0x324381[_0x8809('0x3b')];this[_0x8809('0x3c')]=_0x324381[_0x8809('0x3c')];this[_0x8809('0x3d')]=_0x324381[_0x8809('0x3d')];this[_0x8809('0x3e')]=_0x324381[_0x8809('0x3e')];this['erlangAbandonmentRate']=_0x324381[_0x8809('0x3f')];this[_0x8809('0x40')]=_0x324381[_0x8809('0x40')];this[_0x8809('0x41')]=_0x324381['startPredictive'];this[_0x8809('0x42')]=_0x324381[_0x8809('0x42')];this[_0x8809('0x43')]=_0x324381[_0x8809('0x43')];this[_0x8809('0x44')]=_0x324381[_0x8809('0x44')];}if(_0x324381[_0x8809('0x45')]){this[_0x8809('0x45')]={'id':_0x324381[_0x8809('0x45')]['id'],'name':_0x324381[_0x8809('0x45')][_0x8809('0x15')],'active':_0x324381[_0x8809('0x45')][_0x8809('0x46')],'callerid':_0x324381[_0x8809('0x45')][_0x8809('0x47')]};}}VoiceQueueSummary[_0x8809('0x48')][_0x8809('0x49')]=function(_0x16a0d1,_0x419a78,_0x3f04e7,_0x20b953){this[_0x8809('0x0')]=0x0;this[_0x8809('0x3')]=0x0;this['paused']=0x0;this[_0x8809('0x20')]=0x0;this[_0x8809('0x1c')]=0x0;this['inUse']=0x0;this[_0x8809('0x19')]=0x0;this[_0x8809('0x1a')]=0x0;this[_0x8809('0x1f')]=0x0;this[_0x8809('0x2')]=0x0;this[_0x8809('0x4a')]=0x0;this['onHold']=0x0;if(_0x3f04e7){if(_0x3f04e7['available']){this[_0x8809('0x18')]=Number(_0x3f04e7[_0x8809('0x18')]);}if(_0x3f04e7[_0x8809('0x4b')]){this[_0x8809('0x7')]=Number(_0x3f04e7['loggedin']);}if(_0x3f04e7['callers']){this[_0x8809('0x4')]=Number(_0x3f04e7[_0x8809('0x4c')]);}}for(var _0x4c59f6=0x0;_0x4c59f6<_0x16a0d1[_0x8809('0x4d')];_0x4c59f6++){var _0x11b522=_0x419a78['SIP/'+_0x16a0d1[_0x4c59f6][_0x8809('0x15')]];if(_0x11b522&&_0x11b522[_0x8809('0x4e')]){this[_0x8809('0x0')]+=0x1;}if(_0x16a0d1[_0x4c59f6][_0x8809('0x4f')]==='1'){this['talking']+=0x1;}if(_0x16a0d1[_0x4c59f6][_0x8809('0x1')]==='1'&&!['2','7','8']['includes'](_0x16a0d1[_0x4c59f6]['status'])){this[_0x8809('0x1')]+=0x1;}switch(_0x16a0d1[_0x4c59f6][_0x8809('0x50')]){case'0':this[_0x8809('0x20')]+=0x1;break;case'1':this[_0x8809('0x1c')]+=0x1;break;case'2':this[_0x8809('0x6')]+=0x1;break;case'3':this[_0x8809('0x19')]+=0x1;break;case'4':this['invalid']+=0x1;break;case'5':this[_0x8809('0x1f')]+=0x1;break;case'6':this[_0x8809('0x2')]+=0x1;break;case'7':this[_0x8809('0x4a')]+=0x1;break;case'8':this[_0x8809('0x1b')]+=0x1;break;}}if(this[_0x8809('0x24')]===_0x8809('0x51')){var _0x2ca1e3=Object[_0x8809('0x52')](_0x20b953);for(var _0x23f6f6=0x0;_0x23f6f6<_0x2ca1e3[_0x8809('0x4d')];_0x23f6f6++){var _0x548b0d=_0x2ca1e3[_0x23f6f6];var _0x1d2a8e=_0x20b953[_0x548b0d];if(_0x1d2a8e[_0x8809('0x53')]===this[_0x8809('0x15')]&&_0x1d2a8e[_0x8809('0x1e')]===_0x8809('0x54')&&_0x1d2a8e[_0x8809('0x55')]===_0x8809('0x56')){this['talking']+=0x1;}}if(this[_0x8809('0x3')]>this['inUse']){this[_0x8809('0x3')]=this[_0x8809('0x6')];}this[_0x8809('0x11')]=0x0;}return this;};VoiceQueueSummary[_0x8809('0x48')][_0x8809('0x57')]=function(_0x3da97d){var _0x36db71=![];if(_0x3da97d){_0x36db71=INBOUND_COUNTERS[_0x8809('0x58')](function(_0x4dfa63){return this[_0x4dfa63]!==_0x3da97d[_0x4dfa63];},this);}return _0x36db71;};VoiceQueueSummary[_0x8809('0x48')][_0x8809('0x59')]=function(_0x5f1282){var _0x47b165=![];var _0x37133=![];var _0x36d549=![];if(_0x5f1282){_0x47b165=this['dialMethod']!==_0x5f1282[_0x8809('0x24')]||this['dialActive']!==_0x5f1282['dialActive']||this[_0x8809('0x43')]!==_0x5f1282[_0x8809('0x43')]||this[_0x8809('0x44')]!==_0x5f1282[_0x8809('0x44')];_0x37133=OUTBOUND_COUNTERS[_0x8809('0x58')](function(_0x1a7eec){return this[_0x1a7eec]!==_0x5f1282[_0x1a7eec];},this);if(this[_0x8809('0x45')]&&_0x5f1282['Trunk']){_0x36d549=this[_0x8809('0x45')][_0x8809('0x15')]!==_0x5f1282[_0x8809('0x45')][_0x8809('0x15')]||this[_0x8809('0x45')][_0x8809('0x46')]!==_0x5f1282[_0x8809('0x45')][_0x8809('0x46')];}}return _0x47b165||_0x37133||_0x36d549;};VoiceQueueSummary[_0x8809('0x48')][_0x8809('0x5a')]=function(_0x53b453){this[_0x8809('0x5')]=_0x53b453[_0x8809('0x5')];this[_0x8809('0x43')]=_0x53b453[_0x8809('0x43')];this[_0x8809('0x44')]=_0x53b453[_0x8809('0x44')];this['originated']=_0x53b453[_0x8809('0x3c')];this[_0x8809('0x8')]=_0x53b453[_0x8809('0x8')];this[_0x8809('0x9')]=_0x53b453[_0x8809('0x9')];this['outboundBlacklistCallsDay']=_0x53b453[_0x8809('0x2b')];this[_0x8809('0xa')]=_0x53b453['outboundBusyCallsDay'];this['outboundCongestionCallsDay']=_0x53b453[_0x8809('0xb')];this[_0x8809('0xc')]=_0x53b453[_0x8809('0xc')];this['outboundNoSuchCallsDay']=_0x53b453[_0x8809('0xd')];this[_0x8809('0xe')]=_0x53b453[_0x8809('0xe')];this[_0x8809('0xf')]=_0x53b453[_0x8809('0xf')];this[_0x8809('0x10')]=_0x53b453['outboundUnknownCallsDay'];this['sumBillable']=_0x53b453['sumBillable'];this[_0x8809('0x13')]=_0x53b453[_0x8809('0x13')];this[_0x8809('0x14')]=_0x53b453['total'];if(this['dialMethod']===_0x8809('0x5b')){this[_0x8809('0x11')]=_0x53b453['pTalking'];}};module[_0x8809('0x5c')]=VoiceQueueSummary; \ No newline at end of file +var _0x018c=['predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startProgressive','message','statusMessage','Trunk','active','callerid','prototype','createReport','notInUse','loggedin','callers','length','SIP/','online','includes','status','booked','keys','dialer','exten','xcally-motion-preview','compareToInboundQueue','compareToOutboundQueue','updateReportFromOutboundQueue','preview','exports','available','loggedIn','loggedInDb','talking','answered','inUse','originated','outboundAbandonedCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','paused','pTalking','sumBillable','sumDuration','total','waiting','name','strategy','abandoned','busy','invalid','onHold','ringing','ringInUse','sumHoldTime','type','unavailable','unknown','unmanaged','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundOriginateFailureCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls'];(function(_0x17406a,_0x1e2320){var _0x1501ff=function(_0x4b075a){while(--_0x4b075a){_0x17406a['push'](_0x17406a['shift']());}};_0x1501ff(++_0x1e2320);}(_0x018c,0xda));var _0xc018=function(_0x2bb240,_0x40cd8f){_0x2bb240=_0x2bb240-0x0;var _0x3fe769=_0x018c[_0x2bb240];return _0x3fe769;};'use strict';var INBOUND_COUNTERS=[_0xc018('0x0'),_0xc018('0x1'),_0xc018('0x2'),'paused','ringing',_0xc018('0x3'),'waiting'];var OUTBOUND_COUNTERS=[_0xc018('0x0'),_0xc018('0x4'),_0xc018('0x5'),_0xc018('0x1'),'loggedInDb',_0xc018('0x6'),_0xc018('0x7'),_0xc018('0x8'),_0xc018('0x9'),_0xc018('0xa'),_0xc018('0xb'),_0xc018('0xc'),_0xc018('0xd'),_0xc018('0xe'),_0xc018('0xf'),_0xc018('0x10'),_0xc018('0x11'),_0xc018('0x12'),_0xc018('0x3'),_0xc018('0x13'),_0xc018('0x14'),_0xc018('0x15'),_0xc018('0x16')];function VoiceQueueSummary(_0x4cbe53){this['id']=_0x4cbe53['id'];this[_0xc018('0x17')]=_0x4cbe53['name'];this[_0xc018('0x18')]=_0x4cbe53[_0xc018('0x18')];this[_0xc018('0x19')]=_0x4cbe53[_0xc018('0x19')]||0x0;this[_0xc018('0x4')]=_0x4cbe53[_0xc018('0x4')]||0x0;this[_0xc018('0x0')]=_0x4cbe53[_0xc018('0x0')]||0x0;this[_0xc018('0x1a')]=_0x4cbe53[_0xc018('0x1a')]||0x0;this[_0xc018('0x5')]=_0x4cbe53['inUse']||0x0;this[_0xc018('0x1b')]=_0x4cbe53[_0xc018('0x1b')]||0x0;this[_0xc018('0x1')]=_0x4cbe53[_0xc018('0x1')]||0x0;this[_0xc018('0x2')]=_0x4cbe53[_0xc018('0x2')]||0x0;this[_0xc018('0x1c')]=_0x4cbe53[_0xc018('0x1c')]||0x0;this['notInUse']=_0x4cbe53['notInUse']||0x0;this[_0xc018('0x11')]=_0x4cbe53['paused']||0x0;this[_0xc018('0x1d')]=_0x4cbe53[_0xc018('0x1d')]||0x0;this[_0xc018('0x1e')]=_0x4cbe53['ringInUse'];this[_0xc018('0x13')]=_0x4cbe53[_0xc018('0x13')];this[_0xc018('0x14')]=_0x4cbe53['sumDuration'];this[_0xc018('0x1f')]=_0x4cbe53[_0xc018('0x1f')]||0x0;this[_0xc018('0x3')]=_0x4cbe53[_0xc018('0x3')]||0x0;this[_0xc018('0x15')]=_0x4cbe53[_0xc018('0x15')]||0x0;this[_0xc018('0x20')]=_0x4cbe53[_0xc018('0x20')];this[_0xc018('0x21')]=_0x4cbe53[_0xc018('0x21')]||0x0;this[_0xc018('0x22')]=_0x4cbe53[_0xc018('0x22')]||0x0;this[_0xc018('0x23')]=_0x4cbe53[_0xc018('0x23')]||0x0;this[_0xc018('0x16')]=_0x4cbe53[_0xc018('0x16')]||0x0;if(_0x4cbe53[_0xc018('0x20')]===_0xc018('0x24')){this[_0xc018('0x12')]=_0x4cbe53[_0xc018('0x12')]||0x0;this['dialActive']=_0x4cbe53[_0xc018('0x25')];this[_0xc018('0x26')]=_0x4cbe53[_0xc018('0x26')];this[_0xc018('0x27')]=_0x4cbe53['dialOriginateCallerIdName'];this[_0xc018('0x28')]=_0x4cbe53[_0xc018('0x28')];this[_0xc018('0x29')]=_0x4cbe53['dialOriginateTimeout'];this['dialPrefix']=_0x4cbe53[_0xc018('0x2a')];this[_0xc018('0x2b')]=_0x4cbe53['temp'];this['outboundAnswerAgiCallsDay']=_0x4cbe53[_0xc018('0x2c')];this[_0xc018('0x8')]=_0x4cbe53[_0xc018('0x8')];this['outboundBlacklistCallsDay']=_0x4cbe53[_0xc018('0x9')];this[_0xc018('0xa')]=_0x4cbe53[_0xc018('0xa')];this[_0xc018('0xb')]=_0x4cbe53[_0xc018('0xb')];this[_0xc018('0x2d')]=_0x4cbe53[_0xc018('0x2d')];this[_0xc018('0x2e')]=_0x4cbe53[_0xc018('0x2e')];this[_0xc018('0x2f')]=_0x4cbe53[_0xc018('0x2f')];this[_0xc018('0xc')]=_0x4cbe53[_0xc018('0xc')];this[_0xc018('0xd')]=_0x4cbe53['outboundNoSuchCallsDay'];this[_0xc018('0x30')]=_0x4cbe53[_0xc018('0x30')];this[_0xc018('0xe')]=_0x4cbe53[_0xc018('0xe')];this[_0xc018('0xf')]=_0x4cbe53[_0xc018('0xf')];this[_0xc018('0x10')]=_0x4cbe53[_0xc018('0x10')];this[_0xc018('0x31')]=_0x4cbe53[_0xc018('0x31')];this[_0xc018('0x32')]=_0x4cbe53[_0xc018('0x32')];this[_0xc018('0x33')]=_0x4cbe53[_0xc018('0x33')];this['predictiveIntervalDroppedCallsCallersExit']=_0x4cbe53[_0xc018('0x34')];this[_0xc018('0x35')]=_0x4cbe53[_0xc018('0x35')];this[_0xc018('0x36')]=_0x4cbe53[_0xc018('0x36')];this[_0xc018('0x37')]=_0x4cbe53[_0xc018('0x37')];this[_0xc018('0x38')]=_0x4cbe53[_0xc018('0x38')];this[_0xc018('0x39')]=_0x4cbe53[_0xc018('0x39')];this[_0xc018('0x3a')]=_0x4cbe53['predictiveIntervalPauses'];this[_0xc018('0x3b')]=_0x4cbe53[_0xc018('0x3b')];this[_0xc018('0x3c')]=_0x4cbe53[_0xc018('0x3c')];this[_0xc018('0x6')]=_0x4cbe53[_0xc018('0x6')];this[_0xc018('0x3d')]=_0x4cbe53[_0xc018('0x3d')];this[_0xc018('0x3e')]=_0x4cbe53[_0xc018('0x3e')];this[_0xc018('0x3f')]=_0x4cbe53[_0xc018('0x3f')];this[_0xc018('0x40')]=_0x4cbe53[_0xc018('0x40')];this['startPredictive']=_0x4cbe53['startPredictive'];this['startProgressive']=_0x4cbe53[_0xc018('0x41')];this[_0xc018('0x42')]=_0x4cbe53[_0xc018('0x42')];this['statusMessage']=_0x4cbe53[_0xc018('0x43')];}if(_0x4cbe53[_0xc018('0x44')]){this[_0xc018('0x44')]={'id':_0x4cbe53['Trunk']['id'],'name':_0x4cbe53[_0xc018('0x44')][_0xc018('0x17')],'active':_0x4cbe53['Trunk'][_0xc018('0x45')],'callerid':_0x4cbe53['Trunk'][_0xc018('0x46')]};}}VoiceQueueSummary[_0xc018('0x47')][_0xc018('0x48')]=function(_0x2a18fb,_0x212f80,_0x2b7531,_0x3ee003){this[_0xc018('0x2')]=0x0;this['talking']=0x0;this['paused']=0x0;this[_0xc018('0x22')]=0x0;this[_0xc018('0x49')]=0x0;this[_0xc018('0x5')]=0x0;this['busy']=0x0;this[_0xc018('0x1b')]=0x0;this[_0xc018('0x21')]=0x0;this['ringing']=0x0;this[_0xc018('0x1e')]=0x0;this[_0xc018('0x1c')]=0x0;if(_0x2b7531){if(_0x2b7531[_0xc018('0x0')]){this[_0xc018('0x0')]=Number(_0x2b7531[_0xc018('0x0')]);}if(_0x2b7531[_0xc018('0x4a')]){this[_0xc018('0x1')]=Number(_0x2b7531['loggedin']);}if(_0x2b7531['callers']){this[_0xc018('0x16')]=Number(_0x2b7531[_0xc018('0x4b')]);}}for(var _0x499b74=0x0;_0x499b74<_0x2a18fb[_0xc018('0x4c')];_0x499b74++){var _0x30a9c2=_0x212f80[_0xc018('0x4d')+_0x2a18fb[_0x499b74]['name']];if(_0x30a9c2&&_0x30a9c2[_0xc018('0x4e')]){this[_0xc018('0x2')]+=0x1;}if(_0x2a18fb[_0x499b74]['incall']==='1'){this[_0xc018('0x3')]+=0x1;}if(_0x2a18fb[_0x499b74][_0xc018('0x11')]==='1'&&!['2','7','8'][_0xc018('0x4f')](_0x2a18fb[_0x499b74][_0xc018('0x50')])){this[_0xc018('0x11')]+=0x1;}switch(_0x2a18fb[_0x499b74][_0xc018('0x50')]){case'0':this['unknown']+=0x1;break;case'1':this[_0xc018('0x49')]+=0x1;break;case'2':this[_0xc018('0x5')]+=0x1;break;case'3':this[_0xc018('0x1a')]+=0x1;break;case'4':this[_0xc018('0x1b')]+=0x1;break;case'5':this['unavailable']+=0x1;break;case'6':this['ringing']+=0x1;break;case'7':this['ringInUse']+=0x1;break;case'8':this['onHold']+=0x1;break;}}if(this['dialMethod']===_0xc018('0x51')){var _0x37c8ec=Object[_0xc018('0x52')](_0x3ee003);for(var _0x2428af=0x0;_0x2428af<_0x37c8ec[_0xc018('0x4c')];_0x2428af++){var _0x4eefc7=_0x37c8ec[_0x2428af];var _0x55e24a=_0x3ee003[_0x4eefc7];if(_0x55e24a['queue']===this[_0xc018('0x17')]&&_0x55e24a[_0xc018('0x20')]===_0xc018('0x53')&&_0x55e24a[_0xc018('0x54')]===_0xc018('0x55')){this['talking']+=0x1;}}if(this[_0xc018('0x3')]>this[_0xc018('0x5')]){this[_0xc018('0x3')]=this[_0xc018('0x5')];}this[_0xc018('0x12')]=0x0;}return this;};VoiceQueueSummary[_0xc018('0x47')][_0xc018('0x56')]=function(_0x45aedb){var _0x5c7d79=![];if(_0x45aedb){_0x5c7d79=INBOUND_COUNTERS['some'](function(_0x8063f5){return this[_0x8063f5]!==_0x45aedb[_0x8063f5];},this);}return _0x5c7d79;};VoiceQueueSummary[_0xc018('0x47')][_0xc018('0x57')]=function(_0x3be60c){var _0x5eea48=![];var _0x4ec091=![];var _0xd225ca=![];if(_0x3be60c){_0x5eea48=this[_0xc018('0x26')]!==_0x3be60c[_0xc018('0x26')]||this[_0xc018('0x25')]!==_0x3be60c['dialActive']||this[_0xc018('0x42')]!==_0x3be60c[_0xc018('0x42')]||this[_0xc018('0x43')]!==_0x3be60c[_0xc018('0x43')];_0x4ec091=OUTBOUND_COUNTERS['some'](function(_0xf75d4b){return this[_0xf75d4b]!==_0x3be60c[_0xf75d4b];},this);if(this[_0xc018('0x44')]&&_0x3be60c[_0xc018('0x44')]){_0xd225ca=this[_0xc018('0x44')][_0xc018('0x17')]!==_0x3be60c[_0xc018('0x44')][_0xc018('0x17')]||this[_0xc018('0x44')]['active']!==_0x3be60c[_0xc018('0x44')]['active'];}}return _0x5eea48||_0x4ec091||_0xd225ca;};VoiceQueueSummary[_0xc018('0x47')][_0xc018('0x58')]=function(_0x10f9c3){this[_0xc018('0x4')]=_0x10f9c3[_0xc018('0x4')];this[_0xc018('0x42')]=_0x10f9c3[_0xc018('0x42')];this[_0xc018('0x43')]=_0x10f9c3['statusMessage'];this[_0xc018('0x6')]=_0x10f9c3[_0xc018('0x6')];this[_0xc018('0x7')]=_0x10f9c3['outboundAbandonedCallsDay'];this['outboundAnswerCallsDay']=_0x10f9c3[_0xc018('0x8')];this[_0xc018('0x9')]=_0x10f9c3[_0xc018('0x9')];this[_0xc018('0xa')]=_0x10f9c3[_0xc018('0xa')];this[_0xc018('0xb')]=_0x10f9c3[_0xc018('0xb')];this['outboundNoAnswerCallsDay']=_0x10f9c3[_0xc018('0xc')];this['outboundNoSuchCallsDay']=_0x10f9c3[_0xc018('0xd')];this[_0xc018('0xe')]=_0x10f9c3[_0xc018('0xe')];this[_0xc018('0xf')]=_0x10f9c3[_0xc018('0xf')];this[_0xc018('0x10')]=_0x10f9c3[_0xc018('0x10')];this[_0xc018('0x13')]=_0x10f9c3[_0xc018('0x13')];this[_0xc018('0x14')]=_0x10f9c3['sumDuration'];this['total']=_0x10f9c3['total'];if(this[_0xc018('0x26')]===_0xc018('0x59')){this[_0xc018('0x12')]=_0x10f9c3[_0xc018('0x12')];}};module[_0xc018('0x5a')]=VoiceQueueSummary; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index 0fbbc82..eedfdce 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 _0x0269=['serverUrl','Configurations','exports','name','username','accessKey','remoteUri'];(function(_0x1aa08f,_0x1447f0){var _0x3b469d=function(_0x286627){while(--_0x286627){_0x1aa08f['push'](_0x1aa08f['shift']());}};_0x3b469d(++_0x1447f0);}(_0x0269,0x8f));var _0x9026=function(_0x4f520d,_0x5dd032){_0x4f520d=_0x4f520d-0x0;var _0x2e32cf=_0x0269[_0x4f520d];return _0x2e32cf;};'use strict';function VtigerAccount(_0x61616c){this['id']=_0x61616c['id']||0x0;this['name']=_0x61616c[_0x9026('0x0')]||'';this[_0x9026('0x1')]=_0x61616c[_0x9026('0x1')]||'';this[_0x9026('0x2')]=_0x61616c[_0x9026('0x2')]||'';this['remoteUri']=_0x61616c[_0x9026('0x3')]||'';this[_0x9026('0x4')]=_0x61616c[_0x9026('0x4')]||'';this[_0x9026('0x5')]=_0x61616c['Configurations']||{};}module[_0x9026('0x6')]=VtigerAccount; \ No newline at end of file +var _0x2fb3=['serverUrl','Configurations','exports','name','username','accessKey','remoteUri'];(function(_0x54e335,_0x6b782d){var _0x5be44a=function(_0x599a0e){while(--_0x599a0e){_0x54e335['push'](_0x54e335['shift']());}};_0x5be44a(++_0x6b782d);}(_0x2fb3,0x1ed));var _0x32fb=function(_0x2aca93,_0x267b09){_0x2aca93=_0x2aca93-0x0;var _0x2b15dd=_0x2fb3[_0x2aca93];return _0x2b15dd;};'use strict';function VtigerAccount(_0x9084e1){this['id']=_0x9084e1['id']||0x0;this['name']=_0x9084e1[_0x32fb('0x0')]||'';this[_0x32fb('0x1')]=_0x9084e1[_0x32fb('0x1')]||'';this['accessKey']=_0x9084e1[_0x32fb('0x2')]||'';this[_0x32fb('0x3')]=_0x9084e1[_0x32fb('0x3')]||'';this[_0x32fb('0x4')]=_0x9084e1[_0x32fb('0x4')]||'';this[_0x32fb('0x5')]=_0x9084e1[_0x32fb('0x5')]||{};}module[_0x32fb('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 ca6be8b..23d0085 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 _0x114e=['username','password','token','remoteUri','type','integrationTab','serverUrl','Configurations','exports','name'];(function(_0x4ac658,_0x5047eb){var _0x519624=function(_0x57a853){while(--_0x57a853){_0x4ac658['push'](_0x4ac658['shift']());}};_0x519624(++_0x5047eb);}(_0x114e,0x171));var _0xe114=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x114e[_0x122ef9];return _0x42fba0;};'use strict';function ZendeskAccount(_0x528d8c){this['id']=_0x528d8c['id']||0x0;this[_0xe114('0x0')]=_0x528d8c[_0xe114('0x0')]||'';this[_0xe114('0x1')]=_0x528d8c['username']||'';this['password']=_0x528d8c[_0xe114('0x2')]||'';this[_0xe114('0x3')]=_0x528d8c[_0xe114('0x3')]||'';this[_0xe114('0x4')]=_0x528d8c[_0xe114('0x4')]||'';this['authType']=_0x528d8c['authType']||'';this[_0xe114('0x5')]=_0x528d8c[_0xe114('0x5')]||_0xe114('0x6');this[_0xe114('0x7')]=_0x528d8c[_0xe114('0x7')]||'';this[_0xe114('0x8')]=_0x528d8c['Configurations']||{};}module[_0xe114('0x9')]=ZendeskAccount; \ No newline at end of file +var _0x17fe=['type','serverUrl','Configurations','exports','name','username','password','token','remoteUri'];(function(_0x203d64,_0x1ec79c){var _0x462ab3=function(_0x55ee6e){while(--_0x55ee6e){_0x203d64['push'](_0x203d64['shift']());}};_0x462ab3(++_0x1ec79c);}(_0x17fe,0x1bd));var _0xe17f=function(_0x119f2,_0x1bc9ec){_0x119f2=_0x119f2-0x0;var _0x380d97=_0x17fe[_0x119f2];return _0x380d97;};'use strict';function ZendeskAccount(_0x2aa8df){this['id']=_0x2aa8df['id']||0x0;this[_0xe17f('0x0')]=_0x2aa8df[_0xe17f('0x0')]||'';this[_0xe17f('0x1')]=_0x2aa8df[_0xe17f('0x1')]||'';this[_0xe17f('0x2')]=_0x2aa8df[_0xe17f('0x2')]||'';this[_0xe17f('0x3')]=_0x2aa8df[_0xe17f('0x3')]||'';this[_0xe17f('0x4')]=_0x2aa8df['remoteUri']||'';this['authType']=_0x2aa8df['authType']||'';this[_0xe17f('0x5')]=_0x2aa8df['type']||'integrationTab';this['serverUrl']=_0x2aa8df[_0xe17f('0x6')]||'';this[_0xe17f('0x7')]=_0x2aa8df[_0xe17f('0x7')]||{};}module[_0xe17f('0x8')]=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index bc60c7c..0505729 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 _0x2d5d=['Configurations','exports','name','description','host','zone','clientId','clientSecret','serverUrl','code','refreshToken'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x2d5d,0x14c));var _0xd2d5=function(_0x2d7071,_0x156deb){_0x2d7071=_0x2d7071-0x0;var _0x56c3e7=_0x2d5d[_0x2d7071];return _0x56c3e7;};'use strict';function ZohoAccount(_0x42fdec){this['id']=_0x42fdec['id']||0x0;this['name']=_0x42fdec[_0xd2d5('0x0')]||'';this['description']=_0x42fdec[_0xd2d5('0x1')]||'';this[_0xd2d5('0x2')]=_0x42fdec[_0xd2d5('0x2')]||'';this[_0xd2d5('0x3')]=_0x42fdec[_0xd2d5('0x3')]||'';this['clientId']=_0x42fdec[_0xd2d5('0x4')]||'';this[_0xd2d5('0x5')]=_0x42fdec[_0xd2d5('0x5')]||'';this['serverUrl']=_0x42fdec[_0xd2d5('0x6')]||'';this[_0xd2d5('0x7')]=_0x42fdec[_0xd2d5('0x7')]||'';this[_0xd2d5('0x8')]=_0x42fdec[_0xd2d5('0x8')]||'';this[_0xd2d5('0x9')]=_0x42fdec['Configurations']||{};}module[_0xd2d5('0xa')]=ZohoAccount; \ No newline at end of file +var _0x8b61=['clientSecret','serverUrl','code','refreshToken','Configurations','exports','name','description','host','zone','clientId'];(function(_0x2961fc,_0x2c088a){var _0x163f85=function(_0x31e3d4){while(--_0x31e3d4){_0x2961fc['push'](_0x2961fc['shift']());}};_0x163f85(++_0x2c088a);}(_0x8b61,0x150));var _0x18b6=function(_0x1841b8,_0x5802fb){_0x1841b8=_0x1841b8-0x0;var _0x378d0a=_0x8b61[_0x1841b8];return _0x378d0a;};'use strict';function ZohoAccount(_0x572d41){this['id']=_0x572d41['id']||0x0;this[_0x18b6('0x0')]=_0x572d41['name']||'';this[_0x18b6('0x1')]=_0x572d41[_0x18b6('0x1')]||'';this[_0x18b6('0x2')]=_0x572d41[_0x18b6('0x2')]||'';this[_0x18b6('0x3')]=_0x572d41[_0x18b6('0x3')]||'';this[_0x18b6('0x4')]=_0x572d41[_0x18b6('0x4')]||'';this['clientSecret']=_0x572d41[_0x18b6('0x5')]||'';this[_0x18b6('0x6')]=_0x572d41['serverUrl']||'';this[_0x18b6('0x7')]=_0x572d41[_0x18b6('0x7')]||'';this[_0x18b6('0x8')]=_0x572d41[_0x18b6('0x8')]||'';this['Configurations']=_0x572d41[_0x18b6('0x9')]||{};}module[_0x18b6('0xa')]=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index d85e603..251ee8e 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 _0x5fdc=['number','util','lodash','moment','isNil','string','queue','name','type','dialAnswer','membername','Agent','calleridname','Contact','phone','firstName','lastName','active','calleridnum','scheduledat','countnoanswerretry','countglobal','countbusyretry','countcongestionretry','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','prototype','getCaller','format','\x22%s\x22\x20<%s>'];(function(_0x3856b7,_0x10e9c5){var _0x14d637=function(_0x45e6c9){while(--_0x45e6c9){_0x3856b7['push'](_0x3856b7['shift']());}};_0x14d637(++_0x10e9c5);}(_0x5fdc,0x127));var _0xc5fd=function(_0xb8ea0a,_0x55650c){_0xb8ea0a=_0xb8ea0a-0x0;var _0x1915a7=_0x5fdc[_0xb8ea0a];return _0x1915a7;};'use strict';var util=require(_0xc5fd('0x0'));var _=require(_0xc5fd('0x1'));var moment=require(_0xc5fd('0x2'));function checkNameSurname(_0x1d01cf,_0x36e895,_0x341db9){var _0x3be451='';if(!_[_0xc5fd('0x3')](_0x36e895)&&_0xc5fd('0x4')===typeof _0x36e895){_0x3be451+=_0x36e895;}if(!_[_0xc5fd('0x3')](_0x341db9)&&_0xc5fd('0x4')===typeof _0x341db9){_0x3be451+='\x20'+_0x341db9;}if(_0x3be451!==''){return _0x3be451;}return _0x1d01cf;}function Action(_0xea5748,_0x44722b,_0x216902,_0x15ffe7,_0x5a2eb4){this['uniqueid']=_0x216902||undefined;this['idContact']=_0xea5748['id'];this[_0xc5fd('0x5')]=_0x44722b[_0xc5fd('0x6')];this[_0xc5fd('0x7')]=_0x44722b[_0xc5fd('0x7')];this['campaigntype']='queue';this[_0xc5fd('0x8')]=![];this[_0xc5fd('0x9')]=_[_0xc5fd('0x3')](_0xea5748[_0xc5fd('0xa')])?undefined:_0xea5748[_0xc5fd('0xa')][_0xc5fd('0x6')];this['channelAgent']=this[_0xc5fd('0x9')]?util['format']('SIP/%s',this[_0xc5fd('0x9')]):_0x15ffe7||undefined;this[_0xc5fd('0xb')]=checkNameSurname(_0xea5748[_0xc5fd('0xc')][_0xc5fd('0xd')],_0xea5748[_0xc5fd('0xc')][_0xc5fd('0xe')],_0xea5748[_0xc5fd('0xc')][_0xc5fd('0xf')]);this['active']=_0xea5748[_0xc5fd('0x10')]||![];this[_0xc5fd('0x11')]=_0xea5748[_0xc5fd('0xd')];this[_0xc5fd('0x12')]=_0xea5748['scheduledat'];this['countbusyretry']=_0xea5748['countbusyretry']||0x0;this['countcongestionretry']=_0xea5748['countcongestionretry']||0x0;this[_0xc5fd('0x13')]=_0xea5748[_0xc5fd('0x13')]||0x0;this[_0xc5fd('0x14')]=(_0xea5748[_0xc5fd('0x15')]||0x0)+(_0xea5748[_0xc5fd('0x16')]||0x0)+(_0xea5748[_0xc5fd('0x13')]||0x0)+(_0xea5748[_0xc5fd('0x17')]||0x0)+(_0xea5748['countdropretry']||0x0)+(_0xea5748[_0xc5fd('0x18')]||0x0)+(_0xea5748[_0xc5fd('0x19')]||0x0)+(_0xea5748[_0xc5fd('0x1a')]||0x0);this[_0xc5fd('0x17')]=_0xea5748[_0xc5fd('0x17')]||0x0;this['countdropretry']=_0xea5748[_0xc5fd('0x1b')]||0x0;this[_0xc5fd('0x18')]=_0xea5748[_0xc5fd('0x18')]||0x0;this[_0xc5fd('0x19')]=_0xea5748['countmachineretry']||0x0;this['countagentrejectretry']=_0xea5748[_0xc5fd('0x1a')]||0x0;this[_0xc5fd('0x1c')]=_0xea5748[_0xc5fd('0x1c')];this[_0xc5fd('0x1d')]=_0xea5748[_0xc5fd('0x1d')];this[_0xc5fd('0x1e')]=_0xea5748['callbackat'];this[_0xc5fd('0x1f')]=_0xea5748[_0xc5fd('0x1f')];this[_0xc5fd('0x20')]=_0xea5748[_0xc5fd('0x20')];this[_0xc5fd('0x21')]=_0xea5748[_0xc5fd('0x21')];this[_0xc5fd('0x22')]=_['isNil'](_0xea5748[_0xc5fd('0xa')])?_0xea5748['UserId']:_0xea5748[_0xc5fd('0xa')]['id'];this[_0xc5fd('0x23')]=_0xea5748[_0xc5fd('0x23')];this[_0xc5fd('0x24')]='';this['originatecalleridname']='';}Action[_0xc5fd('0x25')][_0xc5fd('0x26')]=function(){return util[_0xc5fd('0x27')](_0xc5fd('0x28'),this[_0xc5fd('0xb')],this[_0xc5fd('0x29')]);};module['exports']=Action; \ No newline at end of file +var _0x25e7=['ListId','UserId','Agent','VoiceQueueId','originatecalleridnum','prototype','\x22%s\x22\x20<%s>','number','util','lodash','moment','isNil','string','uniqueid','idContact','queue','name','type','campaigntype','dialAnswer','membername','channelAgent','SIP/%s','Contact','phone','lastName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','callback','callbackuniqueid','callbackat','recallme'];(function(_0x278adc,_0x2ad1ac){var _0x240ddb=function(_0xb2d39){while(--_0xb2d39){_0x278adc['push'](_0x278adc['shift']());}};_0x240ddb(++_0x2ad1ac);}(_0x25e7,0x1d6));var _0x725e=function(_0x57aa9d,_0x40382c){_0x57aa9d=_0x57aa9d-0x0;var _0x43fd79=_0x25e7[_0x57aa9d];return _0x43fd79;};'use strict';var util=require(_0x725e('0x0'));var _=require(_0x725e('0x1'));var moment=require(_0x725e('0x2'));function checkNameSurname(_0x3fdca4,_0x3644c1,_0x1c3b9){var _0x223d77='';if(!_[_0x725e('0x3')](_0x3644c1)&&_0x725e('0x4')===typeof _0x3644c1){_0x223d77+=_0x3644c1;}if(!_[_0x725e('0x3')](_0x1c3b9)&&'string'===typeof _0x1c3b9){_0x223d77+='\x20'+_0x1c3b9;}if(_0x223d77!==''){return _0x223d77;}return _0x3fdca4;}function Action(_0x5e17a9,_0x2497a5,_0x480945,_0x481316,_0x111a50){this[_0x725e('0x5')]=_0x480945||undefined;this[_0x725e('0x6')]=_0x5e17a9['id'];this[_0x725e('0x7')]=_0x2497a5[_0x725e('0x8')];this[_0x725e('0x9')]=_0x2497a5[_0x725e('0x9')];this[_0x725e('0xa')]=_0x725e('0x7');this[_0x725e('0xb')]=![];this[_0x725e('0xc')]=_[_0x725e('0x3')](_0x5e17a9['Agent'])?undefined:_0x5e17a9['Agent'][_0x725e('0x8')];this[_0x725e('0xd')]=this['membername']?util['format'](_0x725e('0xe'),this[_0x725e('0xc')]):_0x481316||undefined;this['calleridname']=checkNameSurname(_0x5e17a9[_0x725e('0xf')][_0x725e('0x10')],_0x5e17a9[_0x725e('0xf')]['firstName'],_0x5e17a9[_0x725e('0xf')][_0x725e('0x11')]);this[_0x725e('0x12')]=_0x5e17a9[_0x725e('0x12')]||![];this[_0x725e('0x13')]=_0x5e17a9[_0x725e('0x10')];this['scheduledat']=_0x5e17a9[_0x725e('0x14')];this[_0x725e('0x15')]=_0x5e17a9[_0x725e('0x15')]||0x0;this['countcongestionretry']=_0x5e17a9[_0x725e('0x16')]||0x0;this[_0x725e('0x17')]=_0x5e17a9[_0x725e('0x17')]||0x0;this[_0x725e('0x18')]=(_0x5e17a9[_0x725e('0x15')]||0x0)+(_0x5e17a9[_0x725e('0x16')]||0x0)+(_0x5e17a9['countnoanswerretry']||0x0)+(_0x5e17a9[_0x725e('0x19')]||0x0)+(_0x5e17a9[_0x725e('0x1a')]||0x0)+(_0x5e17a9[_0x725e('0x1b')]||0x0)+(_0x5e17a9[_0x725e('0x1c')]||0x0)+(_0x5e17a9[_0x725e('0x1d')]||0x0);this[_0x725e('0x19')]=_0x5e17a9['countnosuchnumberretry']||0x0;this[_0x725e('0x1a')]=_0x5e17a9[_0x725e('0x1a')]||0x0;this[_0x725e('0x1b')]=_0x5e17a9[_0x725e('0x1b')]||0x0;this[_0x725e('0x1c')]=_0x5e17a9[_0x725e('0x1c')]||0x0;this[_0x725e('0x1d')]=_0x5e17a9[_0x725e('0x1d')]||0x0;this[_0x725e('0x1e')]=_0x5e17a9['callback'];this[_0x725e('0x1f')]=_0x5e17a9[_0x725e('0x1f')];this[_0x725e('0x20')]=_0x5e17a9[_0x725e('0x20')];this['recallme']=_0x5e17a9[_0x725e('0x21')];this['ContactId']=_0x5e17a9['ContactId'];this['ListId']=_0x5e17a9[_0x725e('0x22')];this[_0x725e('0x23')]=_[_0x725e('0x3')](_0x5e17a9['Agent'])?_0x5e17a9[_0x725e('0x23')]:_0x5e17a9[_0x725e('0x24')]['id'];this['VoiceQueueId']=_0x5e17a9[_0x725e('0x25')];this[_0x725e('0x26')]='';this['originatecalleridname']='';}Action[_0x725e('0x27')]['getCaller']=function(){return util['format'](_0x725e('0x28'),this['calleridname'],this[_0x725e('0x29')]);};module['exports']=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index 9a90a44..a138b91 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 _0x1418=['Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestionGlobal]','countcongestionretry','dialCongestionMaxRetry','[callProgressDetectingCustomer][logCongestion]','CANCEL','outboundRejectCallsDay','countagentrejectretry','AgentReject','dialAgentRejectRetryFrequency','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','outboundAbandonedCallsDay','Abandoned','[callProgressDetectingCustomer][logAbandoned]','dialAbandonedMaxRety','dialAbandonedRetryFrequency','outboundUnknownCallsDay','countmachineretry','cause-txt','custom:amd','amd','[callProgressDetectingCustomer][hangupInAMD]','dialstatus','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','updateOriginated','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','callProgressDetectingAgent','isUndefined','object','createAgentHistory','logAgent','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[verifyAdditionalPhone]\x20','[swapAdditionalPhone]\x20','resolve','[incrementPreviewCounters]\x20','checkInBlack','phone','Contact\x20is\x20undefined','lookAgent','execCall','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','custom:agentcalled','called','Calling','[Preview][execCall][failure]','outboundBlacklistCallsDay','logBlacklist','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','active','SIP/%s','unmonitored','run','pick','execRun','recallme','isValid','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','SIP/%s/%s%s','dialPrefix','dialCutDigit','substring','getCallerId','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','originatecalleridname','extractCalleridName','originatecalleridnum','setXMDContactVariables','Contact','assign','merge','toLowerVariables','starttime','variables','variablesAction','[originated][increment]','[originateFailure][logOriginateFailure]','actionid','clone','isFailure','response','custom:agentringnoanswer','cause','[syncHangup][talking][cause]','statedesc','dialQueueProject','reason','transfer','unlockContact','destuniqueid','filterKey','variable','addVariable','value','inspect','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','uuid','moment','ioredis','../../../config/environment','../../../config/logger','preview','../ami','./rpcDb','../rpc/cmHopperAdditionalPhone','./action','./util/util','../dialer/utils','redis','defaults','localhost','socket.io-emitter','enqueue','tail','sequence','campaignsPreview','voiceQueues','trunks','agents','originateresponse','syncOriginateResponse','hangup','syncHangup','bind','hanguprequest','syncHangupRequest','dialend','syncDialEnd','newexten','syncNewExten','varset','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','loopCampaigns','emit','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','stringify','format','voice:queue:%s','name','voice_queue_channel:remove','sendMessageOneNotActive','originated','pTalking','available','paused','message','CAMPAIGN_STATUS','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','DEACTIVATED','prototype','clockClearZombieChannels','dialMethod','booked','clearZombieChannels','outbound','dialActive','recallMe','clearZombieChannel','isNil','actions','info','[clearZombieChannels][talking]','Queue','queue','originated:\x20','dialAnswer','UserId','VoiceQueueId','ListId','status','channel','catch','No\x20such\x20channel','[clearZombieChannel]','decrementTalkink','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','[action]','size','hasOwnProperty','getContactRecallMe','agentReadyId','then','length','scheduledat','dialRecallMeTimeout','Agent','voicePause','logger2','[RecallMe]','disableContact','YYYY-MM-DD\x20HH:mm:ss','outboundReCallsDay','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','logCustomer','RecallFailedTimeout','[HistoryRecallClose]','[getContactRecallMe]','setMessage','IsNotLoggedIn','NO_AGENTS_LOGGED','INACTIVE','isTrunkReachable','Trunk','TrunkBackup','UNREACHABLE_TRUNK','ACTIVE','callProgressDetectingCustomer','outboundNoSuchCallsDay','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','custom:agentnosuchnumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','verifyAdditionalPhones','dialNoSuchNumberRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','cloneAction','Global','createCustomerFinal','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','rescheduleContact','scheduledAt','unlockAgent','activeContact','linkedid','incrementPreviewCounters','swapAdditionalPhones','ANSWER','responsetime','answertime','[syncHangup][talking][increment]','uniqueid','\x20Queue','custom:agentconnect','connect','custom:agentConnectPreview','buildAcw','custom:agentcomplete','complete','outboundAnswerCallsDay','total','answered','Answer','sumDuration','talktime','sumBillable','[syncHangup][talking][decrement]','pTalking:\x20','BUSY','outboundBusyCallsDay','countbusyretry','Busy','dialBusyRetryFrequency','custom:agentbusy','[callProgressDetectingCustomer][logBusy]','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','idContact','outboundNoAnswerCallsDay','NoAnswer','dialNoAnswerRetryFrequency','buildNoAnswerEventPayload','custom:agentnoanswer','[callProgressDetectingCustomer][logNoAnswer]','additional','[callProgressDetectingCustomer][logNoAnswerGlobal]','countnoanswerretry','CONGESTION','outboundCongestionCallsDay'];(function(_0x1dcaa0,_0x26197b){var _0x2f67b7=function(_0x4245e6){while(--_0x4245e6){_0x1dcaa0['push'](_0x1dcaa0['shift']());}};_0x2f67b7(++_0x26197b);}(_0x1418,0x86));var _0x8141=function(_0x1adb03,_0x32a14e){_0x1adb03=_0x1adb03-0x0;var _0xf83e02=_0x1418[_0x1adb03];return _0xf83e02;};'use strict';var util=require(_0x8141('0x0'));var _=require(_0x8141('0x1'));var uuid=require(_0x8141('0x2'));var moment=require(_0x8141('0x3'));var Redis=require(_0x8141('0x4'));var config=require(_0x8141('0x5'));var logger=require(_0x8141('0x6'))(_0x8141('0x7'));var loggerAction=require(_0x8141('0x6'))('actionPreview');var ami=require(_0x8141('0x8'));var rpcDb=require(_0x8141('0x9'));var cmHopperAdditionalPhone=require(_0x8141('0xa'));var Action=require(_0x8141('0xb'));var ut=require(_0x8141('0xc'));var utils=require(_0x8141('0xd'));config[_0x8141('0xe')]=_[_0x8141('0xf')](config[_0x8141('0xe')],{'host':_0x8141('0x10'),'port':0x18eb});var io=require(_0x8141('0x11'))(new Redis(config['redis']));var Sequence=function(){};Sequence['prototype'][_0x8141('0x12')]=function(_0x3d2f5d){this['tail']=this[_0x8141('0x13')]?this[_0x8141('0x13')]['finally'](_0x3d2f5d):_0x3d2f5d();};function Preview(_0x5b57a4){this[_0x8141('0x14')]=new Sequence();this[_0x8141('0x15')]=_0x5b57a4[_0x8141('0x16')];this['trunks']=_0x5b57a4[_0x8141('0x17')];this['actions']={};this[_0x8141('0x18')]=_0x5b57a4[_0x8141('0x18')];this['clockClearZombieChannels']=0x0;ami['on'](_0x8141('0x19'),this[_0x8141('0x1a')]['bind'](this));ami['on'](_0x8141('0x1b'),this[_0x8141('0x1c')][_0x8141('0x1d')](this));ami['on'](_0x8141('0x1e'),this[_0x8141('0x1f')][_0x8141('0x1d')](this));ami['on'](_0x8141('0x20'),this[_0x8141('0x21')][_0x8141('0x1d')](this));ami['on'](_0x8141('0x22'),this[_0x8141('0x23')][_0x8141('0x1d')](this));ami['on'](_0x8141('0x24'),this['syncVarSet']['bind'](this));ami['on'](_0x8141('0x25'),this[_0x8141('0x26')][_0x8141('0x1d')](this));ami['on']('blindtransfer',this[_0x8141('0x27')][_0x8141('0x1d')](this));this[_0x8141('0x28')](this['campaignsPreview']);}function emit(_0x491a1f,_0xe1fff,_0x465d35){io['to'](_0x491a1f)[_0x8141('0x29')](_0xe1fff,_0x465d35);}function emitVoiceQueueChannelRemove(_0x9fff88){logger['info'](_0x8141('0x2a'),JSON[_0x8141('0x2b')](_0x9fff88));emit(util[_0x8141('0x2c')](_0x8141('0x2d'),_0x9fff88[_0x8141('0x2e')]),_0x8141('0x2f'),_0x9fff88);io[_0x8141('0x29')]('voice_queue_presence:remove',_0x9fff88);}function notSendMessagesQueue(_0x386998){if(_0x386998[_0x8141('0x30')]){if(_0x386998[_0x8141('0x31')]===0x0&&_0x386998[_0x8141('0x32')]===0x0){_0x386998[_0x8141('0x30')]=![];_0x386998[_0x8141('0x33')]=0x0;_0x386998[_0x8141('0x34')]=0x0;_0x386998[_0x8141('0x35')]=utils[_0x8141('0x36')]['INACTIVE'];ut[_0x8141('0x37')](_0x8141('0x38'),_0x386998['name']+_0x8141('0x39'));}else{_0x386998['message']=utils[_0x8141('0x36')][_0x8141('0x3a')];ut[_0x8141('0x37')](_0x8141('0x38'),_0x386998[_0x8141('0x2e')]+'\x20is\x20deactivated');}}}Preview[_0x8141('0x3b')][_0x8141('0x28')]=function(){var _0x1320ca=this;setInterval(function(){_0x1320ca['syncCampaigns']();},0x7cf);};Preview[_0x8141('0x3b')]['syncCampaigns']=function(){var _0xd4614b=this['campaignsPreview'];this[_0x8141('0x3c')]+=0x1;for(var _0x5563e4 in _0xd4614b){if(_0xd4614b['hasOwnProperty'](_0x5563e4)&&(_0xd4614b[_0x5563e4]['dialMethod']===_0x8141('0x7')||_0xd4614b[_0x5563e4][_0x8141('0x3d')]===_0x8141('0x3e'))&&_0xd4614b[_0x5563e4]['type']==='outbound'){if(this['clockClearZombieChannels']>0x7){this[_0x8141('0x3c')]=0x0;this[_0x8141('0x3f')]();}}if(_0xd4614b['hasOwnProperty'](_0x5563e4)&&_0xd4614b[_0x5563e4][_0x8141('0x3d')]===_0x8141('0x7')&&_0xd4614b[_0x5563e4]['type']===_0x8141('0x40')){if(_0xd4614b[_0x5563e4][_0x8141('0x41')]){this['setMessage'](_0xd4614b[_0x5563e4]);if(_0xd4614b[_0x5563e4]['dialPreviewAutoRecallMe'])this[_0x8141('0x42')](_0xd4614b[_0x5563e4]);}else{notSendMessagesQueue(_0xd4614b[_0x5563e4]);}}}};Preview[_0x8141('0x3b')][_0x8141('0x43')]=function(_0x5da2fe){var _0x326b65=this;this[_0x8141('0x14')][_0x8141('0x12')](function(){if(!_[_0x8141('0x44')](_0x326b65[_0x8141('0x45')][_0x5da2fe])){loggerAction[_0x8141('0x46')](_0x8141('0x47'),_0x5da2fe,_0x8141('0x48'),_0x326b65[_0x8141('0x45')][_0x5da2fe][_0x8141('0x49')],_0x8141('0x4a'),JSON[_0x8141('0x2b')](_0x326b65[_0x8141('0x15')][_0x326b65[_0x8141('0x45')][_0x5da2fe]['queue']][_0x8141('0x31')]),'pTalking:\x20',JSON[_0x8141('0x2b')](_0x326b65[_0x8141('0x15')][_0x326b65[_0x8141('0x45')][_0x5da2fe][_0x8141('0x49')]][_0x8141('0x32')]),JSON['stringify'](_0x326b65[_0x8141('0x45')][_0x5da2fe][_0x8141('0x4b')]),JSON[_0x8141('0x2b')](_['pick'](_0x326b65['actions'][_0x5da2fe],['contactId',_0x8141('0x4c'),_0x8141('0x4d'),_0x8141('0x4e')])));return ami['Action']({'action':_0x8141('0x4f'),'channel':_0x326b65[_0x8141('0x45')][_0x5da2fe][_0x8141('0x50')]})[_0x8141('0x51')](function(_0x27182c){if(_0x27182c[_0x8141('0x35')]===_0x8141('0x52')){setTimeout(function(){if(_0x326b65[_0x8141('0x45')][_0x5da2fe]){ut['updateOriginated'](_0x326b65['campaignsPreview'][_0x326b65['actions'][_0x5da2fe][_0x8141('0x49')]],_0x8141('0x53'));if(_0x326b65[_0x8141('0x45')][_0x5da2fe]['dialAnswer']===!![]){ut[_0x8141('0x54')](_0x326b65['campaignsPreview'][_0x326b65[_0x8141('0x45')][_0x5da2fe]['queue']],_0x8141('0x53'));ut[_0x8141('0x55')](_0x8141('0x56')+_0x5da2fe,_0x326b65[_0x8141('0x45')][_0x5da2fe]['queue']);}ut['loggerError'](_0x8141('0x57')+_0x5da2fe,_0x326b65['actions'][_0x5da2fe][_0x8141('0x49')]);delete _0x326b65[_0x8141('0x45')][_0x5da2fe];}},0x2328);}});}});};Preview[_0x8141('0x3b')][_0x8141('0x3f')]=function(){var _0x38296d=this;loggerAction['info'](_0x8141('0x58'),_[_0x8141('0x59')](this[_0x8141('0x45')]));for(var _0x12c909 in this[_0x8141('0x45')]){if(_0x38296d[_0x8141('0x45')][_0x8141('0x5a')](_0x12c909)){_0x38296d[_0x8141('0x43')](_0x12c909);}}};Preview['prototype'][_0x8141('0x42')]=function(_0x12eec3){var _0x256f1d=this;rpcDb[_0x8141('0x5b')](_0x12eec3['id'],ut[_0x8141('0x5c')](this[_0x8141('0x18')]))[_0x8141('0x5d')](function(_0x292bbb){if(!_[_0x8141('0x44')](_0x292bbb)){for(var _0x4e3a57=0x0;_0x4e3a57<_0x292bbb[_0x8141('0x5e')];_0x4e3a57+=0x1){if(ut['getDiff'](_0x292bbb[_0x4e3a57][_0x8141('0x5f')])<_0x12eec3[_0x8141('0x60')]*0x3c){if(_0x292bbb[_0x4e3a57][_0x8141('0x61')]&&!_0x292bbb[_0x4e3a57][_0x8141('0x61')][_0x8141('0x62')]){_0x256f1d['run'](_0x292bbb[_0x4e3a57]['id'])[_0x8141('0x5d')](ut[_0x8141('0x63')](_0x8141('0x64')))[_0x8141('0x51')](ut[_0x8141('0x63')](_0x8141('0x64')));}else{rpcDb[_0x8141('0x65')](_0x292bbb[_0x4e3a57]['id']);}}else{var _0x180c11=new Action(_0x292bbb[_0x4e3a57],_0x12eec3);_0x180c11['starttime']=moment()[_0x8141('0x2c')](_0x8141('0x66'));_0x12eec3[_0x8141('0x67')]+=0x1;ut['logCustomer'](_0x180c11,0x17,_0x8141('0x68'));if(_0x12eec3[_0x8141('0x69')]){rpcDb[_0x8141('0x6a')](ut[_0x8141('0x6b')](_0x292bbb[_0x4e3a57]));rpcDb[_0x8141('0x6c')](_0x180c11,_0x8141('0x6d'));}else{ut[_0x8141('0x6e')](_0x180c11,0x16,_0x8141('0x6f'));rpcDb[_0x8141('0x6c')](_0x180c11,'[HistoryRecallClose]');rpcDb['createCustomerFinal'](_0x180c11,_0x8141('0x70'));}}}}})[_0x8141('0x51')](ut['logger2'](_0x8141('0x71')));};Preview['prototype'][_0x8141('0x72')]=function(_0x3dc3f7){_0x3dc3f7[_0x8141('0x30')]=!![];if(ut[_0x8141('0x73')](_0x3dc3f7['loggedIn'])){_0x3dc3f7[_0x8141('0x35')]=utils[_0x8141('0x36')][_0x8141('0x74')];}else if(!ut['isActive'](_0x3dc3f7['dialActive'])){_0x3dc3f7[_0x8141('0x35')]=utils[_0x8141('0x36')][_0x8141('0x75')];}else if(!this[_0x8141('0x76')](_0x3dc3f7[_0x8141('0x77')])){if(!this[_0x8141('0x76')](_0x3dc3f7[_0x8141('0x78')])){_0x3dc3f7[_0x8141('0x35')]=utils[_0x8141('0x36')][_0x8141('0x79')];}else{_0x3dc3f7['message']=utils['CAMPAIGN_STATUS'][_0x8141('0x7a')];}}else{_0x3dc3f7[_0x8141('0x35')]=utils[_0x8141('0x36')]['ACTIVE'];}};Preview[_0x8141('0x3b')][_0x8141('0x7b')]=function(_0x31d174,_0x3c6de5,_0x1d7019){var _0x344ed7=this;var _0x35bf1c=this[_0x8141('0x45')][_0x3c6de5];var _0x4baaea=this[_0x8141('0x15')][_0x35bf1c[_0x8141('0x49')]];var _0x3b68fa;var _0xd68164=![];var _0x19fcc2=0x2;var _0x7f476f=0x3;if(_0x4baaea){switch(_0x1d7019){case'1':_0x4baaea[_0x8141('0x7c')]+=0x1;_0x35bf1c[_0x8141('0x7d')]+=0x1;_0x35bf1c[_0x8141('0x7e')]=ut[_0x8141('0x7f')](_0x35bf1c);ut[_0x8141('0x6e')](_0x35bf1c,0x0,_0x8141('0x80'));ami[_0x8141('0x29')](_0x8141('0x81'),ut[_0x8141('0x82')](_0x35bf1c,_0x8141('0x83')));rpcDb[_0x8141('0x6c')](_0x35bf1c,_0x8141('0x84'));_0x344ed7[_0x8141('0x85')](_0x35bf1c,'0',_0x4baaea)['then'](function(_0x411b65){_0xd68164=_0x411b65['additional']==0x1;_0x19fcc2=_0x4baaea[_0x8141('0x86')];_0x7f476f=_0x4baaea[_0x8141('0x87')];if(!_0xd68164){if(ut['totalGlobal'](_0x35bf1c)>=_0x4baaea[_0x8141('0x88')]){_0x3b68fa=ut[_0x8141('0x89')](_0x35bf1c,0xf,_0x8141('0x8a'));rpcDb[_0x8141('0x8b')](_0x3b68fa,_0x8141('0x8c'));}else{if(_0x35bf1c['countnosuchnumberretry']>=_0x4baaea[_0x8141('0x8d')]){rpcDb[_0x8141('0x8b')](_0x35bf1c,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{rpcDb[_0x8141('0x8e')](ut[_0x8141('0x8f')](_0x35bf1c,_0x8141('0x7d'),_0x4baaea[_0x8141('0x86')]),_0x35bf1c[_0x8141('0x90')],_0x35bf1c[_0x8141('0x91')]);}}delete this[_0x8141('0x45')][_0x31d174[_0x8141('0x92')]];}else{_0x35bf1c[_0x8141('0x7d')]++;logger[_0x8141('0x46')]('actioncountonusuch',_0x35bf1c[_0x8141('0x7d')]);logger[_0x8141('0x46')]('id',_0x35bf1c['idContact']);_0x344ed7[_0x8141('0x93')]({'id':_0x35bf1c['idContact'],'field':{'countnosuchnumberretry':_0x35bf1c[_0x8141('0x7d')]}})[_0x8141('0x5d')](function(){_0x344ed7[_0x8141('0x94')](_0x35bf1c,_0x19fcc2,_0x7f476f)[_0x8141('0x5d')](function(){});});}});break;case _0x8141('0x95'):var _0x2d7095=moment()[_0x8141('0x2c')](_0x8141('0x66'));_0x35bf1c[_0x8141('0x96')]=_0x2d7095;_0x35bf1c[_0x8141('0x97')]=_0x2d7095;_0x35bf1c[_0x8141('0x4b')]=!![];_0x4baaea['pTalking']+=0x1;logger[_0x8141('0x46')](_0x8141('0x98'),_0x35bf1c[_0x8141('0x99')],_0x8141('0x9a'),_0x4baaea[_0x8141('0x2e')],'pTalking:\x20',_0x4baaea['pTalking']);ami['emit'](_0x8141('0x9b'),ut[_0x8141('0x82')](_0x35bf1c,_0x8141('0x9c'),this[_0x8141('0x15')][_0x35bf1c['queue']]));if(_0x4baaea['acw']){ami[_0x8141('0x29')](_0x8141('0x9d'),ut[_0x8141('0x9e')](_0x35bf1c));}break;case'16':ami['emit'](_0x8141('0x9f'),ut['buildObj'](_0x35bf1c,_0x8141('0xa0'),this['campaignsPreview'][_0x35bf1c[_0x8141('0x49')]]));emitVoiceQueueChannelRemove(ut[_0x8141('0x82')](_0x35bf1c,_0x8141('0xa0')));_0x4baaea[_0x8141('0xa1')]+=0x1;_0x4baaea[_0x8141('0xa2')]+=0x1;_0x4baaea[_0x8141('0xa3')]+=0x1;ut[_0x8141('0x54')](_0x4baaea,'[16]');_0x35bf1c[_0x8141('0x7e')]=ut['totalGlobal'](_0x35bf1c);ut[_0x8141('0x6e')](_0x35bf1c,0x4,_0x8141('0xa4'));rpcDb[_0x8141('0x6c')](_0x35bf1c,'[callProgressDetectingCustomer][logAnswer]');rpcDb[_0x8141('0x8b')](_0x35bf1c,'[callProgressDetectingCustomer][logAnswerGlobal]');rpcDb['crateCustomerReportQueue'](_0x35bf1c);_0x4baaea[_0x8141('0xa5')]+=_0x35bf1c[_0x8141('0xa6')];_0x4baaea[_0x8141('0xa7')]+=_0x35bf1c[_0x8141('0xa6')];logger[_0x8141('0x46')](_0x8141('0xa8'),_0x35bf1c[_0x8141('0x99')],_0x8141('0x9a'),_0x4baaea['name'],_0x8141('0xa9'),_0x4baaea[_0x8141('0x32')]);delete this['actions'][_0x31d174[_0x8141('0x92')]];break;case _0x8141('0xaa'):_0x4baaea[_0x8141('0xab')]+=0x1;_0x35bf1c[_0x8141('0xac')]+=0x1;_0x35bf1c['countglobal']=ut[_0x8141('0x7f')](_0x35bf1c);ut[_0x8141('0x6e')](_0x35bf1c,0x5,_0x8141('0xad'));_0x19fcc2=_0x4baaea[_0x8141('0xae')];_0x7f476f=_0x4baaea['callAdditionalPhoneAfterMin'];ami[_0x8141('0x29')](_0x8141('0xaf'),ut[_0x8141('0x82')](_0x35bf1c,'busy'));rpcDb[_0x8141('0x6c')](_0x35bf1c,_0x8141('0xb0'));_0x344ed7[_0x8141('0x85')](_0x35bf1c,'5',_0x4baaea)[_0x8141('0x5d')](function(_0x578b18){_0xd68164=_0x578b18['additional']==0x1;if(!_0xd68164){if(ut[_0x8141('0x7f')](_0x35bf1c)>=_0x4baaea[_0x8141('0x88')]){_0x3b68fa=ut[_0x8141('0x89')](_0x35bf1c,0xf,_0x8141('0x8a'));rpcDb[_0x8141('0x8b')](_0x3b68fa,_0x8141('0xb1'));}else{if(_0x35bf1c[_0x8141('0xac')]>=_0x4baaea[_0x8141('0xb2')]){rpcDb[_0x8141('0x8b')](_0x35bf1c,'[callProgressDetectingCustomer][logBusy]');}else{rpcDb['rescheduleContact'](ut[_0x8141('0x8f')](_0x35bf1c,'countbusyretry',_0x4baaea[_0x8141('0xae')]),_0x35bf1c[_0x8141('0x90')],_0x35bf1c[_0x8141('0x91')]);}}}else{_0x35bf1c[_0x8141('0xac')]++;_0x344ed7[_0x8141('0x93')]({'id':_0x35bf1c[_0x8141('0xb3')],'field':{'countbusyretry':_0x35bf1c[_0x8141('0xac')]}})[_0x8141('0x5d')](function(){_0x344ed7[_0x8141('0x94')](_0x35bf1c,_0x19fcc2,_0x7f476f)[_0x8141('0x5d')](function(){});});}});break;case'NOANSWER':_0x4baaea[_0x8141('0xb4')]+=0x1;_0x35bf1c['countnoanswerretry']+=0x1;_0x35bf1c[_0x8141('0x7e')]=ut[_0x8141('0x7f')](_0x35bf1c);ut[_0x8141('0x6e')](_0x35bf1c,0x3,_0x8141('0xb5'));_0x19fcc2=_0x4baaea[_0x8141('0xb6')];_0x7f476f=_0x4baaea['callAdditionalPhoneAfterMin'];var _0x4bbcc4=ut[_0x8141('0xb7')](_0x35bf1c,_0x4baaea);ami['emit'](_0x8141('0xb8'),_0x4bbcc4);rpcDb[_0x8141('0x6c')](_0x35bf1c,_0x8141('0xb9'));_0x344ed7['verifyAdditionalPhones'](_0x35bf1c,'3',_0x4baaea)[_0x8141('0x5d')](function(_0x1f8800){_0xd68164=_0x1f8800[_0x8141('0xba')]==0x1;if(!_0xd68164){if(ut['totalGlobal'](_0x35bf1c)>=_0x4baaea['dialGlobalMaxRetry']){_0x3b68fa=ut[_0x8141('0x89')](_0x35bf1c,0xf,_0x8141('0x8a'));rpcDb['createCustomerFinal'](_0x3b68fa,_0x8141('0xbb'));}else{if(_0x35bf1c['countnoanswerretry']>=_0x4baaea['dialNoAnswerMaxRetry']){rpcDb[_0x8141('0x8b')](_0x35bf1c,'[callProgressDetectingCustomer][logNoAnswer]');}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x35bf1c,_0x8141('0xbc'),_0x4baaea[_0x8141('0xb6')]),_0x35bf1c['unlockAgent'],_0x35bf1c['activeContact']);}}}else{_0x35bf1c['countnoanswerretry']++;_0x344ed7[_0x8141('0x93')]({'id':_0x35bf1c[_0x8141('0xb3')],'field':{'countnoanswerretry':_0x35bf1c['countnoanswerretry']}})[_0x8141('0x5d')](function(){_0x344ed7[_0x8141('0x94')](_0x35bf1c,_0x19fcc2,_0x7f476f)[_0x8141('0x5d')](function(){});});}});break;case _0x8141('0xbd'):_0x4baaea[_0x8141('0xbe')]+=0x1;_0x35bf1c['countcongestionretry']+=0x1;_0x35bf1c['countglobal']=ut[_0x8141('0x7f')](_0x35bf1c);ut[_0x8141('0x6e')](_0x35bf1c,0x8,_0x8141('0xbf'));_0x19fcc2=_0x4baaea['dialCongestionRetryFrequency'];_0x7f476f=_0x4baaea['callAdditionalPhoneAfterMin'];ami[_0x8141('0x29')](_0x8141('0xc0'),ut['buildObj'](_0x35bf1c,_0x8141('0xc1')));rpcDb[_0x8141('0x6c')](_0x35bf1c,'[callProgressDetectingCustomer][logCongestion]');_0x344ed7[_0x8141('0x85')](_0x35bf1c,'8',_0x4baaea)[_0x8141('0x5d')](function(_0x51b244){_0xd68164=_0x51b244[_0x8141('0xba')]==0x1;if(!_0xd68164){if(ut[_0x8141('0x7f')](_0x35bf1c)>=_0x4baaea[_0x8141('0x88')]){_0x3b68fa=ut[_0x8141('0x89')](_0x35bf1c,0xf,_0x8141('0x8a'));rpcDb[_0x8141('0x8b')](_0x3b68fa,_0x8141('0xc2'));}else{if(_0x35bf1c[_0x8141('0xc3')]>=_0x4baaea[_0x8141('0xc4')]){rpcDb[_0x8141('0x8b')](_0x35bf1c,_0x8141('0xc5'));}else{rpcDb[_0x8141('0x8e')](ut['scheduledAt'](_0x35bf1c,_0x8141('0xc3'),_0x4baaea[_0x8141('0xae')]),_0x35bf1c[_0x8141('0x90')],_0x35bf1c[_0x8141('0x91')]);}}}else{_0x35bf1c[_0x8141('0xc3')]++;_0x344ed7['incrementPreviewCounters']({'id':_0x35bf1c['idContact'],'field':{'countcongestionretry':_0x35bf1c[_0x8141('0xc3')]}})[_0x8141('0x5d')](function(){_0x344ed7['swapAdditionalPhones'](_0x35bf1c,_0x19fcc2,_0x7f476f)[_0x8141('0x5d')](function(){});});}});break;case _0x8141('0xc6'):_0x4baaea[_0x8141('0xc7')]+=0x1;_0x35bf1c[_0x8141('0xc8')]+=0x1;_0x35bf1c[_0x8141('0x7e')]=ut['totalGlobal'](_0x35bf1c);ut[_0x8141('0x6e')](_0x35bf1c,0x14,_0x8141('0xc9'));_0x19fcc2=_0x4baaea[_0x8141('0xca')];_0x7f476f=_0x4baaea['callAdditionalPhoneAfterMin'];ami[_0x8141('0x29')](_0x8141('0xcb'),ut[_0x8141('0x82')](_0x35bf1c,_0x8141('0xcc')));rpcDb['createCustomerHistory'](_0x35bf1c,_0x8141('0xcd'));_0x344ed7[_0x8141('0x85')](_0x35bf1c,'20',_0x4baaea)[_0x8141('0x5d')](function(_0x852651){_0xd68164=_0x852651['additional']==0x1;if(!_0xd68164){if(ut[_0x8141('0x7f')](_0x35bf1c)>=_0x4baaea[_0x8141('0x88')]){_0x3b68fa=ut[_0x8141('0x89')](_0x35bf1c,0x14,_0x8141('0xc9'));rpcDb['createCustomerFinal'](_0x3b68fa,_0x8141('0xce'));}else{if(_0x35bf1c[_0x8141('0xc8')]>=_0x4baaea[_0x8141('0xcf')]){rpcDb['createCustomerFinal'](_0x35bf1c,'[callProgressDetectingCustomer][logAgentReject]');}else{rpcDb['rescheduleContact'](ut[_0x8141('0x8f')](_0x35bf1c,_0x8141('0xc8'),_0x4baaea[_0x8141('0xca')]),_0x35bf1c[_0x8141('0x90')],_0x35bf1c[_0x8141('0x91')]);}}}else{_0x35bf1c[_0x8141('0xbc')]++;_0x344ed7['incrementPreviewCounters']({'id':_0x35bf1c[_0x8141('0xb3')],'field':{'countnoanswerretry':_0x35bf1c['countnoanswerretry']}})[_0x8141('0x5d')](function(){_0x344ed7['swapAdditionalPhones'](_0x35bf1c,_0x19fcc2,_0x7f476f)['then'](function(){});});}});break;case'ABANDONED':_0x4baaea[_0x8141('0xd0')]+=0x1;_0x35bf1c['countabandonedretry']+=0x1;_0x35bf1c[_0x8141('0x7e')]=ut[_0x8141('0x7f')](_0x35bf1c);ut[_0x8141('0x6e')](_0x35bf1c,0xb,_0x8141('0xd1'));rpcDb[_0x8141('0x6c')](_0x35bf1c,_0x8141('0xd2'));_0x344ed7[_0x8141('0x85')](_0x35bf1c,'11',_0x4baaea)[_0x8141('0x5d')](function(_0x16a611){_0xd68164=_0x16a611[_0x8141('0xba')]==0x1;if(!_0xd68164){if(ut[_0x8141('0x7f')](_0x35bf1c)>=_0x4baaea[_0x8141('0x88')]){_0x3b68fa=ut[_0x8141('0x89')](_0x35bf1c,0xf,_0x8141('0x8a'));rpcDb['createCustomerFinal'](_0x3b68fa,_0x8141('0xd2'));}else{if(_0x35bf1c['countabandonedetry']>=_0x4baaea[_0x8141('0xd3')]){rpcDb[_0x8141('0x8b')](_0x35bf1c,_0x8141('0xd2'));}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x35bf1c,'countabandonedretry',_0x4baaea[_0x8141('0xd4')]),_0x35bf1c[_0x8141('0x90')],_0x35bf1c[_0x8141('0x91')]);}}}else{_0x35bf1c['countnoanswerretry']++;_0x344ed7['incrementPreviewCounters']({'id':_0x35bf1c[_0x8141('0xb3')],'field':{'countnoanswerretry':_0x35bf1c[_0x8141('0xbc')]}})[_0x8141('0x5d')](function(){_0x344ed7[_0x8141('0x94')](_0x35bf1c,_0x19fcc2,_0x7f476f)[_0x8141('0x5d')](function(){});});}});break;case'18':_0x4baaea[_0x8141('0xd5')]+=0x1;_0x35bf1c[_0x8141('0xd6')]+=0x1;_0x35bf1c[_0x8141('0x7e')]=ut['totalGlobal'](_0x35bf1c);ut['logCustomer'](_0x35bf1c,0x12,_0x31d174[_0x8141('0xd7')]||_0x31d174['dialstatus']);ami[_0x8141('0x29')](_0x8141('0xd8'),ut[_0x8141('0x82')](_0x35bf1c,_0x8141('0xd9')));rpcDb['createCustomerHistory'](_0x35bf1c,'[callProgressDetectingCustomer][hangupInAMD]');_0x344ed7[_0x8141('0x85')](_0x35bf1c,'18',_0x4baaea)[_0x8141('0x5d')](function(_0x5daf9f){_0xd68164=_0x5daf9f[_0x8141('0xba')]==0x1;if(!_0xd68164){if(ut['totalGlobal'](_0x35bf1c)>=_0x4baaea[_0x8141('0x88')]){_0x3b68fa=ut[_0x8141('0x89')](_0x35bf1c,0x12,'Global');rpcDb[_0x8141('0x8b')](_0x3b68fa,_0x8141('0xda'));}else{rpcDb[_0x8141('0x8b')](_0x35bf1c,_0x8141('0xda'));}}else{_0x35bf1c[_0x8141('0xbc')]++;_0x344ed7[_0x8141('0x93')]({'id':_0x35bf1c[_0x8141('0xb3')],'field':{'countnoanswerretry':_0x35bf1c[_0x8141('0xbc')]}})[_0x8141('0x5d')](function(){_0x344ed7['swapAdditionalPhones'](_0x35bf1c,_0x19fcc2,_0x7f476f)[_0x8141('0x5d')](function(){});});}});delete this[_0x8141('0x45')][_0x31d174['linkedid']];break;case'19':_0x4baaea['outboundUnknownCallsDay']+=0x1;_0x35bf1c[_0x8141('0x7e')]=ut['totalGlobal'](_0x35bf1c);ut[_0x8141('0x6e')](_0x35bf1c,0x13,_0x31d174[_0x8141('0xd7')]||_0x31d174[_0x8141('0xdb')]);ami[_0x8141('0x29')](_0x8141('0xd8'),ut[_0x8141('0x82')](_0x35bf1c,_0x8141('0xd9')));rpcDb[_0x8141('0x6c')](_0x35bf1c,_0x8141('0xdc'));_0x344ed7['verifyAdditionalPhones'](_0x35bf1c,'18',_0x4baaea)[_0x8141('0x5d')](function(_0xc23856){_0xd68164=_0xc23856[_0x8141('0xba')]==0x1;if(!_0xd68164){if(ut[_0x8141('0x7f')](_0x35bf1c)>=_0x4baaea[_0x8141('0x88')]){_0x3b68fa=ut[_0x8141('0x89')](_0x35bf1c,0xf,_0x8141('0x8a'));rpcDb[_0x8141('0x8b')](_0x3b68fa,'[callProgressDetectingCustomer][machine]');}else{rpcDb['createCustomerFinal'](_0x35bf1c,'[callProgressDetectingCustomer][machine]');}}else{_0x35bf1c[_0x8141('0xbc')]++;_0x344ed7['incrementPreviewCounters']({'id':_0x35bf1c[_0x8141('0xb3')],'field':{'countnoanswerretry':_0x35bf1c[_0x8141('0xbc')]}})['then'](function(){_0x344ed7[_0x8141('0x94')](_0x35bf1c,_0x19fcc2,_0x7f476f)[_0x8141('0x5d')](function(){});});}});delete this['actions'][_0x31d174[_0x8141('0x92')]];break;default:if(_0x35bf1c[_0x8141('0x4b')]){ut[_0x8141('0x54')](_0x4baaea,_0x8141('0xdd'));ut['loggerError'](_0x8141('0xde')+_0x4baaea[_0x8141('0x2e')],_0x31d174);}_0x4baaea['outboundUnknownCallsDay']+=0x1;_0x35bf1c['countglobal']=ut[_0x8141('0x7f')](_0x35bf1c);ut[_0x8141('0x6e')](_0x35bf1c,0xc,_0x31d174[_0x8141('0xd7')]||_0x31d174[_0x8141('0xdb')]);_0x19fcc2=_0x4baaea['dialAgentRejectRetryFrequency'];_0x7f476f=_0x4baaea[_0x8141('0x87')];rpcDb['createCustomerHistory'](_0x35bf1c,_0x8141('0xdf'));_0x344ed7['verifyAdditionalPhones'](_0x35bf1c,'20',_0x4baaea)[_0x8141('0x5d')](function(_0x473c24){_0xd68164=_0x473c24['additional']==0x1;if(!_0xd68164){if(ut[_0x8141('0x7f')](_0x35bf1c)>=_0x4baaea[_0x8141('0x88')]){_0x3b68fa=ut['cloneAction'](_0x35bf1c,0xf,_0x8141('0x8a'));rpcDb[_0x8141('0x8b')](_0x3b68fa,_0x8141('0xe0'));}else{rpcDb[_0x8141('0x8b')](_0x35bf1c,'[callProgressDetectingCustomer][logUnknownGlobal]');}delete this[_0x8141('0x45')][_0x31d174[_0x8141('0x92')]];}else{_0x344ed7[_0x8141('0x94')](_0x35bf1c,_0x19fcc2,_0x7f476f)['then'](function(){});}});}if(!(_0x35bf1c[_0x8141('0x4b')]&&_0x1d7019==='16')){ut[_0x8141('0xe1')](_0x4baaea,_0x8141('0xe2'));logger['info'](_0x8141('0xe3'),_0x35bf1c[_0x8141('0x99')],_0x8141('0x9a'),_0x4baaea[_0x8141('0x2e')],_0x8141('0x4a'),_0x4baaea['originated']);}if(_0x1d7019!=='ANSWER'){delete this[_0x8141('0x45')][_0x31d174[_0x8141('0x92')]];delete this[_0x8141('0x45')][_0x31d174[_0x8141('0xe4')]];}_0x4baaea['queueSummaryCountersUpdated']=!![];}};Preview[_0x8141('0x3b')][_0x8141('0xe5')]=function(_0x453493,_0x2bc6b6,_0x5378e0){if(_[_0x8141('0xe6')](_0x2bc6b6)&&_0x8141('0xe7')!==typeof _0x2bc6b6){return;}if(_[_0x8141('0xe6')](_0x5378e0)&&_0x8141('0xe7')!==typeof _0x5378e0){return;}switch(_0x5378e0['reason']){case'0':ut['logAgent'](_0x453493,0x0,_0x8141('0x80'));rpcDb[_0x8141('0xe8')](_0x453493,'[callProgressDetectingAgent][logNoSuch]');break;case'3':ut['logAgent'](_0x453493,0x3,_0x8141('0xb5'));rpcDb[_0x8141('0xe8')](_0x453493,'[callProgressDetectingAgent][logNoAnswer]');break;case'5':ut[_0x8141('0xe9')](_0x453493,0x5,_0x8141('0xad'));rpcDb[_0x8141('0xe8')](_0x453493,_0x8141('0xea'));break;case'8':ut[_0x8141('0xe9')](_0x453493,0x8,_0x8141('0xbf'));rpcDb[_0x8141('0xe8')](_0x453493,_0x8141('0xeb'));break;case'22':ut['logAgent'](_0x453493,0x16,_0x8141('0xec'));rpcDb['createAgentHistory'](_0x453493,_0x8141('0xed'));break;default:ut[_0x8141('0xe9')](_0x453493,0xc,_0x5378e0['reason']);rpcDb[_0x8141('0xe8')](_0x453493,_0x8141('0xeb'));}ut[_0x8141('0xe1')](_0x2bc6b6,_0x8141('0xee'));logger[_0x8141('0x46')]('[originated][decrement][callProgressDetectingAgent]',_0x453493[_0x8141('0x99')],_0x8141('0x9a'),_0x2bc6b6[_0x8141('0x2e')],_0x8141('0x4a'),_0x2bc6b6[_0x8141('0x31')]);delete this[_0x8141('0x45')][_0x453493[_0x8141('0x99')]];};Preview['prototype']['verifyAdditionalPhones']=function(_0x347563,_0x50a482,_0x5ab09b){return cmHopperAdditionalPhone[_0x8141('0x85')](_0x347563,_0x50a482,_0x5ab09b)[_0x8141('0x51')](logger[_0x8141('0x46')](_0x8141('0xef')));};Preview[_0x8141('0x3b')][_0x8141('0x94')]=function(_0x144eb5,_0x1c62e9,_0x5ae7fa){return cmHopperAdditionalPhone[_0x8141('0x94')](_0x144eb5,_0x1c62e9,_0x5ae7fa)[_0x8141('0x51')](logger[_0x8141('0x46')](_0x8141('0xf0')));};Preview['prototype'][_0x8141('0x93')]=function(_0x35f195){return Promise[_0x8141('0xf1')]()[_0x8141('0x5d')](cmHopperAdditionalPhone[_0x8141('0x93')](_0x35f195))[_0x8141('0x51')](logger[_0x8141('0x46')](_0x8141('0xf2')));};Preview['prototype'][_0x8141('0xf3')]=function(_0x193349,_0x184a4b,_0x3246b4,_0x1b5565,_0x3fb6ac){var _0x33c086=this;return new Promise(function(_0x50d8c0,_0x4b9dae){if(_[_0x8141('0x44')](_0x184a4b)||_[_0x8141('0x44')](_0x184a4b['Contact'])||_[_0x8141('0x44')](_0x184a4b[_0x8141('0xf4')])||_[_0x8141('0x44')](_0x184a4b[_0x8141('0x4d')])){_0x4b9dae(ut[_0x8141('0x35')](_0x8141('0xf5'),_0x1b5565,_0x3fb6ac));return;}var _0x310df2=uuid['v4']();var _0x1da6dc=_0x33c086[_0x8141('0x15')][_0x184a4b[_0x8141('0x48')]['name']];var _0x385cf6=_0x3246b4?_0x33c086['agents'][_0x3246b4]['id']:undefined;_0x33c086[_0x8141('0x45')][_0x310df2]=new Action(_0x184a4b,_0x1da6dc,_0x310df2,_0x3246b4,_0x385cf6);var _0x415299=_0x33c086[_0x8141('0x45')][_0x310df2];_0x415299[_0x8141('0x90')]=_0x1b5565;_0x415299[_0x8141('0x91')]=_0x3fb6ac;_0x415299[_0x8141('0xf6')]=_0x3246b4;if(_['isEmpty'](_0x193349)){_0x33c086[_0x8141('0xf7')](_0x415299,_0x1da6dc,_0x184a4b,_0x3246b4)['then'](function(_0x5685dd){logger['info'](_0x8141('0xf8'),_0x8141('0xf9')+_0x415299[_0x8141('0x49')]+_0x8141('0xfa')+_0x415299[_0x8141('0xb3')],JSON[_0x8141('0x2b')](_0x5685dd));ami[_0x8141('0x29')](_0x8141('0xfb'),ut[_0x8141('0x82')](_0x415299,_0x8141('0xfc'),_0x33c086[_0x8141('0x15')][_0x415299[_0x8141('0x49')]]));_0x50d8c0(ut[_0x8141('0x35')](_0x8141('0xfd')));})[_0x8141('0x51')](function(_0x37bc3c){ut[_0x8141('0x37')](_0x8141('0xfe'),_0x37bc3c);_0x4b9dae(ut[_0x8141('0x35')]('Call\x20failed',_0x1b5565,_0x3fb6ac));});}else{_0x1da6dc[_0x8141('0xff')]+=0x1;ut[_0x8141('0x100')](_0x415299);rpcDb[_0x8141('0x101')](_0x415299,_0x8141('0x102'));delete _0x33c086[_0x8141('0x45')][_0x310df2];_0x4b9dae(ut['message'](_0x8141('0x103'),_0x1b5565,_0x3fb6ac));}});};Preview['prototype'][_0x8141('0x76')]=function(_0x2838cb){return!_[_0x8141('0x44')](_0x2838cb)&&!_[_0x8141('0x44')](_0x2838cb[_0x8141('0x2e')])&&!_[_0x8141('0x44')](_0x2838cb[_0x8141('0x104')])&&_0x2838cb[_0x8141('0x104')]&&!_['isNil'](this[_0x8141('0x17')][util[_0x8141('0x2c')](_0x8141('0x105'),_0x2838cb[_0x8141('0x2e')])])&&!_['isNil'](this[_0x8141('0x17')][util['format'](_0x8141('0x105'),_0x2838cb[_0x8141('0x2e')])][_0x8141('0x4f')])&&(this[_0x8141('0x17')][util[_0x8141('0x2c')]('SIP/%s',_0x2838cb[_0x8141('0x2e')])]['status']==='reachable'||this['trunks'][util['format'](_0x8141('0x105'),_0x2838cb[_0x8141('0x2e')])]['status']===_0x8141('0x106'));};Preview[_0x8141('0x3b')][_0x8141('0x107')]=function(_0x427027,_0x3f394e){return this['execRun'](_0x427027,_0x3f394e)[_0x8141('0x5d')](function(_0x20a42e){return _[_0x8141('0x108')](_0x20a42e,[_0x8141('0x35')]);})['catch'](function(_0x199a7e){if(_0x199a7e['unlock']){rpcDb['unlockContact'](_0x427027);}if(_0x199a7e[_0x8141('0x104')]){rpcDb[_0x8141('0x65')](_0x427027);}throw _[_0x8141('0x108')](_0x199a7e,[_0x8141('0x35')]);});};Preview[_0x8141('0x3b')][_0x8141('0x109')]=function(_0x3c2d5a,_0x5757e6){var _0x1ec360=this;var _0x124848,_0x382c71;return rpcDb['getContactPreview'](_0x3c2d5a)[_0x8141('0x5d')](function(_0x2e2503){if(!_['isNil'](_0x2e2503[0x0])){_0x382c71=_0x2e2503[0x0][_0x8141('0x10a')]?![]:!![];_0x124848=_0x2e2503[0x0][_0x8141('0x10a')]?!![]:![];_0x124848=_0x5757e6?!![]:_0x124848;}var _0x4b959f=_0x1ec360['validateContact'](_0x2e2503);if(_0x4b959f[_0x8141('0x10b')]){rpcDb['checkIsBlackList'](_[_0x8141('0x108')](_0x2e2503[0x0],[_0x8141('0x4d'),'phone']))[_0x8141('0x5d')](function(_0xefb4a1){_0x1ec360[_0x8141('0xf3')](_0xefb4a1,_0x2e2503[0x0],_0x5757e6,_0x382c71,_0x124848)['then'](function(_0x2a2c7b){return _0x2a2c7b;})[_0x8141('0x51')](function(_0x438c26){throw _0x438c26;});})[_0x8141('0x51')](function(_0x3502b5){ut[_0x8141('0x37')](_0x8141('0x10c'),_0x3502b5);throw ut[_0x8141('0x35')](_0x8141('0x10d'),_0x382c71,_0x124848);});}else{throw ut[_0x8141('0x35')](_0x4b959f[_0x8141('0x35')],_0x382c71,_0x124848);}})['catch'](function(_0x17ae75){ut['logger'](_0x8141('0x10e'),_0x17ae75);throw ut['message'](_0x8141('0x10d'),![],!![]);});};Preview[_0x8141('0x3b')]['validateContact']=function(_0x21ed08){if(_['isNil'](_0x21ed08)||_['isEmpty'](_0x21ed08)||!_['isNil'](_0x21ed08[0x0][_0x8141('0x61')])&&_[_0x8141('0x44')](_0x21ed08[0x0][_0x8141('0x61')][_0x8141('0x2e')])){ut[_0x8141('0x37')](_0x8141('0x10f'),_0x21ed08);return{'isValid':![],'message':_0x8141('0x110')};}var _0x49366e=this[_0x8141('0x15')][_0x21ed08[0x0][_0x8141('0x48')][_0x8141('0x2e')]];_0x49366e[_0x8141('0x35')]=utils[_0x8141('0x36')]['ACTIVE'];if(_[_0x8141('0x44')](_0x49366e)){ut[_0x8141('0x37')](_0x8141('0x111'),_0x49366e);return{'isValid':![],'message':_0x8141('0x112')};}if(!this[_0x8141('0x76')](_0x49366e[_0x8141('0x77')])){ut[_0x8141('0x37')](_0x8141('0x113'),_0x8141('0x114')+_0x49366e['name']+_0x8141('0x115'));if(!this['isTrunkReachable'](_0x49366e[_0x8141('0x78')])){ut[_0x8141('0x37')](_0x8141('0x113'),_0x49366e['name']+'\x20Trunk\x20Backup\x20is\x20not\x20active');return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}}if(!ut['isActive'](_0x49366e[_0x8141('0x41')])){ut[_0x8141('0x37')](_0x8141('0x116'),_0x49366e[_0x8141('0x2e')]+'\x20Not\x20Active');return{'isValid':![],'message':_0x8141('0x114')+_0x49366e['name']+_0x8141('0x117')};}return{'isValid':!![],'message':_0x8141('0x118')};};Preview['prototype'][_0x8141('0xf7')]=function(_0x282967,_0x4e3bb4,_0x498f45,_0x40a94f){var _0x149ff0=this;return new Promise(function(_0x1fc115,_0x814d2b){var _0x464893=_0x282967[_0x8141('0x99')];var _0x2b250f=_0x149ff0[_0x8141('0x76')](_0x4e3bb4[_0x8141('0x77')])?util[_0x8141('0x2c')](_0x8141('0x119'),_0x4e3bb4[_0x8141('0x77')][_0x8141('0x2e')],_[_0x8141('0x44')](_0x4e3bb4[_0x8141('0x11a')])?'':_0x4e3bb4['dialPrefix']['trim']()||'',_0x4e3bb4[_0x8141('0x11b')]>0x0?_0x498f45[_0x8141('0xf4')][_0x8141('0x11c')](_0x4e3bb4[_0x8141('0x11b')]):_0x498f45[_0x8141('0xf4')]):util['format'](_0x8141('0x119'),_[_0x8141('0x44')](_0x4e3bb4[_0x8141('0x78')])?_0x4e3bb4[_0x8141('0x77')][_0x8141('0x2e')]:_0x4e3bb4[_0x8141('0x78')][_0x8141('0x2e')],_[_0x8141('0x44')](_0x4e3bb4[_0x8141('0x11a')])?'':_0x4e3bb4[_0x8141('0x11a')]['trim']()||'',_0x4e3bb4[_0x8141('0x11b')]>0x0?_0x498f45[_0x8141('0xf4')]['substring'](_0x4e3bb4[_0x8141('0x11b')]):_0x498f45[_0x8141('0xf4')]);var _0x48aecd=_0x149ff0[_0x8141('0x76')](_0x4e3bb4[_0x8141('0x77')])?ut[_0x8141('0x11d')](_0x4e3bb4['Trunk'][_0x8141('0x11e')],_0x4e3bb4[_0x8141('0x11f')],_0x4e3bb4[_0x8141('0x120')]>0x0?ut[_0x8141('0x121')](_0x4e3bb4[_0x8141('0x122')],_0x4e3bb4[_0x8141('0x120')]):_0x4e3bb4[_0x8141('0x122')]):ut['getCallerId'](_[_0x8141('0x44')](_0x4e3bb4[_0x8141('0x78')])?_0x4e3bb4[_0x8141('0x77')][_0x8141('0x11e')]:_0x4e3bb4['TrunkBackup'][_0x8141('0x11e')],_0x4e3bb4[_0x8141('0x11f')],_0x4e3bb4[_0x8141('0x120')]>0x0?ut[_0x8141('0x121')](_0x4e3bb4[_0x8141('0x122')],_0x4e3bb4[_0x8141('0x120')]):_0x4e3bb4[_0x8141('0x122')]);if(_0x48aecd){_0x282967[_0x8141('0x123')]=ut[_0x8141('0x124')](_0x48aecd);_0x282967[_0x8141('0x125')]=ut['extractCalleridNumber'](_0x48aecd);}var _0x5081de=ut['addVariables'](_0x4e3bb4,_0x498f45,_0x2b250f,_0x48aecd,_0x464893,_0x282967);var _0x4117dd=utils[_0x8141('0x126')](_0x498f45[_0x8141('0x127')]);Object[_0x8141('0x128')](_0x5081de,_0x4117dd);_[_0x8141('0x129')](_0x282967,ut[_0x8141('0x12a')](_0x5081de));_0x282967[_0x8141('0x12b')]=moment()[_0x8141('0x2c')]('YYYY-MM-DD\x20HH:mm:ss');_0x4e3bb4[_0x8141('0x12c')]=_0x5081de;var _0x7d52b0=ut[_0x8141('0x12d')](_0x282967,_0x4e3bb4,_0x5081de,_0x282967[_0x8141('0x91')],_0x40a94f);return ami['Action'](_0x7d52b0)['then'](function(_0x2acc48){_0x4e3bb4[_0x8141('0x31')]+=0x1;logger[_0x8141('0x46')](_0x8141('0x12e'),_0x464893,'\x20Queue',_0x4e3bb4[_0x8141('0x2e')],_0x8141('0x4a'),_0x4e3bb4[_0x8141('0x31')]);_0x1fc115(_0x2acc48);})[_0x8141('0x51')](function(_0x26a115){ut['logAgent'](_0x282967,0xe,'OriginateError');rpcDb['createAgentHistory'](_0x282967,_0x8141('0x12f'));_0x814d2b(_0x26a115);});});};Preview[_0x8141('0x3b')][_0x8141('0x23')]=function(_0x2e092c){if(this[_0x8141('0x45')][_0x2e092c[_0x8141('0x92')]]){this[_0x8141('0x45')][_0x2e092c[_0x8141('0x92')]]['channel']=_0x2e092c['channel'];}};Preview[_0x8141('0x3b')][_0x8141('0x1a')]=function(_0x25c2b9){var _0x498149=this;var _0x3fee17=this[_0x8141('0x45')][_0x25c2b9[_0x8141('0x130')]];if(_0x3fee17){if(_0x3fee17['lookAgent']&&this['agents'][_0x3fee17['lookAgent']]){ut['logLookAgent'](_0x3fee17,this[_0x8141('0x18')][_0x3fee17['lookAgent']][_0x8141('0x2e')],this[_0x8141('0x18')][_0x3fee17[_0x8141('0xf6')]]['id']);}var _0x59ab21=_[_0x8141('0x131')](_0x3fee17);_0x59ab21['responsetime']=moment()[_0x8141('0x2c')](_0x8141('0x66'));var _0x300b33=_0x498149[_0x8141('0x15')][_0x3fee17[_0x8141('0x49')]];if(ut[_0x8141('0x132')](_0x25c2b9[_0x8141('0x133')])){if(_0x3fee17[_0x8141('0x90')]){rpcDb['unlockContact'](_0x3fee17['idContact']);}if(_0x3fee17['activeContact']){rpcDb['disableContact'](_0x3fee17[_0x8141('0xb3')]);}ami[_0x8141('0x29')](_0x8141('0x134'),ut[_0x8141('0x82')](_0x3fee17,'rejected',this['campaignsPreview'][_0x3fee17[_0x8141('0x49')]]));this[_0x8141('0xe5')](_0x59ab21,_0x300b33,_0x25c2b9);}else{_0x3fee17['starttime']=moment()[_0x8141('0x2c')](_0x8141('0x66'));ut[_0x8141('0xe9')](_0x59ab21,0x4,_0x8141('0xa4'));rpcDb[_0x8141('0xe8')](_0x59ab21,'[callProgressDetectingAgent][logAnswer]');}}};Preview['prototype']['syncHangup']=function(_0x56bb47){var _0x2c11aa=this[_0x8141('0x45')][_0x56bb47['linkedid']];var _0x4376ec;if(_0x2c11aa){_0x4376ec=this[_0x8141('0x15')][_0x2c11aa['queue']];logger[_0x8141('0x46')]('[syncHangup][talking]',_0x56bb47[_0x8141('0x92')],_0x8141('0x9a'),_0x4376ec['name'],_0x8141('0xa9'),_0x4376ec['pTalking']);}if(this[_0x8141('0x45')][_0x56bb47['linkedid']]&&_0x56bb47[_0x8141('0x92')]!==_0x56bb47[_0x8141('0x99')]){if(_0x56bb47[_0x8141('0x135')]==='16'&&this[_0x8141('0x45')][_0x56bb47[_0x8141('0x92')]][_0x8141('0x4b')]){this['callProgressDetectingCustomer'](_0x56bb47,_0x56bb47[_0x8141('0x92')],_0x56bb47[_0x8141('0x135')]);}else if(this[_0x8141('0x45')][_0x56bb47[_0x8141('0x92')]]['dialAnswer']){logger[_0x8141('0x46')](_0x8141('0x136'),_0x56bb47[_0x8141('0x92')],_0x56bb47[_0x8141('0x135')],'\x20Queue',_0x4376ec['name'],_0x8141('0xa9'),_0x4376ec[_0x8141('0x32')]);this['callProgressDetectingCustomer'](_0x56bb47,_0x56bb47[_0x8141('0x92')],_0x56bb47[_0x8141('0x135')]);}}else if(_0x2c11aa&&_[_0x8141('0x44')](_0x2c11aa[_0x8141('0x137')])&&_0x4376ec[_0x8141('0x138')]&&_0x56bb47['linkedid']===_0x56bb47[_0x8141('0x99')]&&_[_0x8141('0x44')](_0x56bb47[_0x8141('0x139')])&&_0x56bb47[_0x8141('0x135')]==='16'&&_0x56bb47['channelstate']==='6'&&_[_0x8141('0xe6')](_0x2c11aa[_0x8141('0x13a')])){if(_0x2c11aa[_0x8141('0x90')]){rpcDb[_0x8141('0x13b')](_0x2c11aa['idContact']);}if(_0x2c11aa[_0x8141('0x91')]){rpcDb[_0x8141('0x65')](_0x2c11aa[_0x8141('0xb3')]);}_0x56bb47[_0x8141('0x139')]='22';this[_0x8141('0xe5')](_0x2c11aa,_0x4376ec,_0x56bb47);}else if(_0x2c11aa&&_0x2c11aa[_0x8141('0x13a')]){if(_0x56bb47[_0x8141('0x135')]==='16'&&this['actions'][_0x56bb47[_0x8141('0x92')]][_0x8141('0x4b')]){logger[_0x8141('0x46')]('[syncHangup][talking][transfer]',_0x56bb47[_0x8141('0x92')],_0x56bb47[_0x8141('0x135')],_0x8141('0x9a'),_0x4376ec[_0x8141('0x2e')],_0x8141('0xa9'),_0x4376ec[_0x8141('0x32')]);this['callProgressDetectingCustomer'](_0x56bb47,_0x56bb47[_0x8141('0x92')],_0x56bb47[_0x8141('0x135')]);}else if(this[_0x8141('0x45')][_0x56bb47[_0x8141('0x92')]][_0x8141('0x4b')]){logger[_0x8141('0x46')](_0x8141('0x136'),_0x56bb47[_0x8141('0x92')],_0x56bb47[_0x8141('0x135')],'\x20Queue',_0x4376ec['name'],'pTalking:\x20',_0x4376ec[_0x8141('0x32')]);this[_0x8141('0x7b')](_0x56bb47,_0x56bb47[_0x8141('0x92')],_0x56bb47['cause']);}}};Preview['prototype'][_0x8141('0x21')]=function(_0x1e0da6){if(this[_0x8141('0x45')][_0x1e0da6[_0x8141('0xe4')]]&&_0x1e0da6[_0x8141('0xe4')]!==_0x1e0da6[_0x8141('0x13c')]){this['callProgressDetectingCustomer'](_0x1e0da6,_0x1e0da6[_0x8141('0xe4')],_0x1e0da6[_0x8141('0xdb')]);}};Preview['prototype'][_0x8141('0x1f')]=function(_0xaf25bb){if(this[_0x8141('0x45')][_0xaf25bb['linkedid']]&&_0xaf25bb[_0x8141('0x92')]!==_0xaf25bb[_0x8141('0x99')]&&!this['actions'][_0xaf25bb[_0x8141('0x92')]][_0x8141('0x4b')]){if(_0xaf25bb[_0x8141('0x135')]==='1'){this[_0x8141('0x7b')](_0xaf25bb,_0xaf25bb['linkedid'],_0xaf25bb['cause']);}}};Preview['prototype']['addVariable']=function(_0x27b219,_0x4797f4,_0x7151ed){if(this['actions'][_0x27b219]){if(_[_0x8141('0x44')](this[_0x8141('0x45')][_0x27b219][_0x8141('0x12c')])){this['actions'][_0x27b219][_0x8141('0x12c')]={};}this[_0x8141('0x45')][_0x27b219][_0x8141('0x12c')][_0x4797f4]=_0x7151ed;}};Preview[_0x8141('0x3b')]['syncVarSet']=function(_0x341f5c){try{if(!_[_0x8141('0x44')](_0x341f5c)){if(ut[_0x8141('0x13d')](_['keys'](_0x341f5c[_0x8141('0x13e')])[0x0])){this[_0x8141('0x13f')](_0x341f5c[_0x8141('0x99')],_['keys'](_0x341f5c[_0x8141('0x13e')])[0x0],_0x341f5c[_0x8141('0x140')]);}}}catch(_0x1d5445){logger['error']('[syncVarSet][Preview]',util[_0x8141('0x141')](_0x1d5445,{'showHidden':![],'depth':null}));}};Preview[_0x8141('0x3b')]['syncAttendedTransfer']=function(_0x3b14f6){if(_0x3b14f6){if(this[_0x8141('0x45')][_0x3b14f6[_0x8141('0x142')]]){this[_0x8141('0x45')][_0x3b14f6[_0x8141('0x142')]][_0x8141('0x13a')]=!![];}}};Preview[_0x8141('0x3b')][_0x8141('0x27')]=function(_0x23075a){if(_0x23075a){if(this[_0x8141('0x45')][_0x23075a[_0x8141('0x143')]]){this[_0x8141('0x45')][_0x23075a[_0x8141('0x143')]]['transfer']=!![];}}};module[_0x8141('0x144')]=Preview; \ No newline at end of file +var _0xcf1c=['scheduledAt','unlockAgent','activeContact','linkedid','actioncountonusuch','idContact','swapAdditionalPhones','answertime','[syncHangup][talking][increment]','uniqueid','\x20Queue','connect','acw','custom:agentConnectPreview','buildAcw','custom:agentcomplete','complete','outboundAnswerCallsDay','total','answered','[16]','Answer','[callProgressDetectingCustomer][logAnswer]','crateCustomerReportQueue','sumDuration','sumBillable','talktime','[syncHangup][talking][decrement]','outboundBusyCallsDay','countbusyretry','Busy','dialBusyRetryFrequency','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','incrementPreviewCounters','NOANSWER','dialNoAnswerRetryFrequency','buildNoAnswerEventPayload','custom:agentnoanswer','[callProgressDetectingCustomer][logNoAnswer]','Global','[callProgressDetectingCustomer][logNoAnswerGlobal]','countnoanswerretry','dialNoAnswerMaxRetry','CONGESTION','countcongestionretry','Congestion','dialCongestionRetryFrequency','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','[callProgressDetectingCustomer][logCongestion]','CANCEL','countagentrejectretry','AgentReject','dialAgentRejectRetryFrequency','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','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][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','callProgressDetectingAgent','isUndefined','object','reason','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','NoAnswer','[callProgressDetectingAgent][logBusy]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent][logCongestion]','[originated][decrement][callProgressDetectingAgent]','[swapAdditionalPhone]\x20','[incrementPreviewCounters]\x20','checkInBlack','phone','Contact\x20is\x20undefined','Queue','isEmpty','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','custom:agentcalled','called','Calling','[Preview][execCall][failure]','Call\x20failed','outboundBlacklistCallsDay','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','active','SIP/%s','reachable','execRun','unlock','unlockContact','disableContact','getContactPreview','recallme','validateContact','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','[Preview][validateContact][Empty\x20Contact]','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','campaign\x20Name:\x20','\x20Trunk\x20Backup\x20is\x20not\x20active','[Preview][validateContact][Campaign\x20Active]','Is\x20Valid','execCall','SIP/%s/%s%s','dialPrefix','substring','trim','dialCutDigit','getCallerId','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','originatecalleridname','originatecalleridnum','setXMDContactVariables','Contact','merge','toLowerVariables','variables','variablesAction','OriginateError','actionid','lookAgent','logLookAgent','clone','responsetime','rejected','[callProgressDetectingAgent][logAnswer]','pTalking:\x20','cause','statedesc','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','[syncHangup][talking][cause]','destlinkedid','addVariable','keys','variable','value','error','inspect','transfertargetlinkedid','transfererlinkedid','util','uuid','moment','../../../config/logger','actionPreview','../ami','./rpcDb','../rpc/cmHopperAdditionalPhone','./action','./util/util','../dialer/utils','redis','defaults','localhost','socket.io-emitter','prototype','enqueue','tail','finally','sequence','campaignsPreview','trunks','agents','originateresponse','syncOriginateResponse','hangup','syncHangup','bind','hanguprequest','syncHangupRequest','syncDialEnd','syncNewExten','syncVarSet','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopCampaigns','emit','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','stringify','format','voice_queue_channel:remove','sendMessageOneNotActive','originated','pTalking','available','paused','message','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','name','\x20is\x20not\x20active','CAMPAIGN_STATUS','\x20is\x20deactivated','syncCampaigns','clockClearZombieChannels','hasOwnProperty','dialMethod','preview','clearZombieChannels','dialPreviewAutoRecallMe','recallMe','clearZombieChannel','isNil','actions','[clearZombieChannels][talking]','originated:\x20','queue','dialAnswer','pick','contactId','UserId','VoiceQueueId','ListId','Action','status','channel','updateOriginated','[clearZombieChannel]','decrementTalkink','[Dialer][checkChannel][pTalking][Preview]','loggerError','[Dialer][checkChannel][Preview]','[action]','getContactRecallMe','agentReadyId','then','length','scheduledat','Agent','voicePause','run','catch','[RecallMe]','YYYY-MM-DD\x20HH:mm:ss','outboundReCallsDay','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','RecallFailedTimeout','createCustomerHistory','[HistoryRecallClose]','createCustomerFinal','logger2','[getContactRecallMe]','setMessage','IsNotLoggedIn','NO_AGENTS_LOGGED','isActive','dialActive','INACTIVE','isTrunkReachable','Trunk','TrunkBackup','UNREACHABLE_TRUNK','ACTIVE','callProgressDetectingCustomer','outboundNoSuchCallsDay','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','custom:agentnosuchnumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','verifyAdditionalPhones','additional','dialNoSuchNumberRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','cloneAction','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','rescheduleContact'];(function(_0x181d2d,_0x480cc8){var _0x4a0cfc=function(_0x5e96b1){while(--_0x5e96b1){_0x181d2d['push'](_0x181d2d['shift']());}};_0x4a0cfc(++_0x480cc8);}(_0xcf1c,0x1f0));var _0xccf1=function(_0x57494e,_0x2c4d3d){_0x57494e=_0x57494e-0x0;var _0x4099da=_0xcf1c[_0x57494e];return _0x4099da;};'use strict';var util=require(_0xccf1('0x0'));var _=require('lodash');var uuid=require(_0xccf1('0x1'));var moment=require(_0xccf1('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');var logger=require(_0xccf1('0x3'))('preview');var loggerAction=require(_0xccf1('0x3'))(_0xccf1('0x4'));var ami=require(_0xccf1('0x5'));var rpcDb=require(_0xccf1('0x6'));var cmHopperAdditionalPhone=require(_0xccf1('0x7'));var Action=require(_0xccf1('0x8'));var ut=require(_0xccf1('0x9'));var utils=require(_0xccf1('0xa'));config[_0xccf1('0xb')]=_[_0xccf1('0xc')](config[_0xccf1('0xb')],{'host':_0xccf1('0xd'),'port':0x18eb});var io=require(_0xccf1('0xe'))(new Redis(config[_0xccf1('0xb')]));var Sequence=function(){};Sequence[_0xccf1('0xf')][_0xccf1('0x10')]=function(_0x106aee){this[_0xccf1('0x11')]=this[_0xccf1('0x11')]?this['tail'][_0xccf1('0x12')](_0x106aee):_0x106aee();};function Preview(_0x32bf48){this[_0xccf1('0x13')]=new Sequence();this[_0xccf1('0x14')]=_0x32bf48['voiceQueues'];this['trunks']=_0x32bf48[_0xccf1('0x15')];this['actions']={};this[_0xccf1('0x16')]=_0x32bf48[_0xccf1('0x16')];this['clockClearZombieChannels']=0x0;ami['on'](_0xccf1('0x17'),this[_0xccf1('0x18')]['bind'](this));ami['on'](_0xccf1('0x19'),this[_0xccf1('0x1a')][_0xccf1('0x1b')](this));ami['on'](_0xccf1('0x1c'),this[_0xccf1('0x1d')][_0xccf1('0x1b')](this));ami['on']('dialend',this[_0xccf1('0x1e')][_0xccf1('0x1b')](this));ami['on']('newexten',this[_0xccf1('0x1f')][_0xccf1('0x1b')](this));ami['on']('varset',this[_0xccf1('0x20')][_0xccf1('0x1b')](this));ami['on']('attendedtransfer',this[_0xccf1('0x21')]['bind'](this));ami['on'](_0xccf1('0x22'),this[_0xccf1('0x23')][_0xccf1('0x1b')](this));this[_0xccf1('0x24')](this[_0xccf1('0x14')]);}function emit(_0x1a2dc0,_0x7ff0b1,_0x3925bc){io['to'](_0x1a2dc0)[_0xccf1('0x25')](_0x7ff0b1,_0x3925bc);}function emitVoiceQueueChannelRemove(_0x158d7a){logger[_0xccf1('0x26')](_0xccf1('0x27'),JSON[_0xccf1('0x28')](_0x158d7a));emit(util[_0xccf1('0x29')]('voice:queue:%s',_0x158d7a['name']),_0xccf1('0x2a'),_0x158d7a);io[_0xccf1('0x25')]('voice_queue_presence:remove',_0x158d7a);}function notSendMessagesQueue(_0x2d20a6){if(_0x2d20a6[_0xccf1('0x2b')]){if(_0x2d20a6[_0xccf1('0x2c')]===0x0&&_0x2d20a6[_0xccf1('0x2d')]===0x0){_0x2d20a6[_0xccf1('0x2b')]=![];_0x2d20a6[_0xccf1('0x2e')]=0x0;_0x2d20a6[_0xccf1('0x2f')]=0x0;_0x2d20a6[_0xccf1('0x30')]=utils['CAMPAIGN_STATUS']['INACTIVE'];ut[_0xccf1('0x31')](_0xccf1('0x32'),_0x2d20a6[_0xccf1('0x33')]+_0xccf1('0x34'));}else{_0x2d20a6[_0xccf1('0x30')]=utils[_0xccf1('0x35')]['DEACTIVATED'];ut[_0xccf1('0x31')]('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x2d20a6[_0xccf1('0x33')]+_0xccf1('0x36'));}}}Preview[_0xccf1('0xf')][_0xccf1('0x24')]=function(){var _0x1777e5=this;setInterval(function(){_0x1777e5[_0xccf1('0x37')]();},0x7cf);};Preview['prototype']['syncCampaigns']=function(){var _0xa0de3a=this[_0xccf1('0x14')];this[_0xccf1('0x38')]+=0x1;for(var _0x3ac060 in _0xa0de3a){if(_0xa0de3a[_0xccf1('0x39')](_0x3ac060)&&(_0xa0de3a[_0x3ac060][_0xccf1('0x3a')]===_0xccf1('0x3b')||_0xa0de3a[_0x3ac060][_0xccf1('0x3a')]==='booked')&&_0xa0de3a[_0x3ac060]['type']==='outbound'){if(this[_0xccf1('0x38')]>0x7){this[_0xccf1('0x38')]=0x0;this[_0xccf1('0x3c')]();}}if(_0xa0de3a[_0xccf1('0x39')](_0x3ac060)&&_0xa0de3a[_0x3ac060][_0xccf1('0x3a')]===_0xccf1('0x3b')&&_0xa0de3a[_0x3ac060]['type']==='outbound'){if(_0xa0de3a[_0x3ac060]['dialActive']){this['setMessage'](_0xa0de3a[_0x3ac060]);if(_0xa0de3a[_0x3ac060][_0xccf1('0x3d')])this[_0xccf1('0x3e')](_0xa0de3a[_0x3ac060]);}else{notSendMessagesQueue(_0xa0de3a[_0x3ac060]);}}}};Preview[_0xccf1('0xf')][_0xccf1('0x3f')]=function(_0x557c4e){var _0x2d0ea0=this;this['sequence'][_0xccf1('0x10')](function(){if(!_[_0xccf1('0x40')](_0x2d0ea0[_0xccf1('0x41')][_0x557c4e])){loggerAction[_0xccf1('0x26')](_0xccf1('0x42'),_0x557c4e,'Queue',_0x2d0ea0[_0xccf1('0x41')][_0x557c4e]['queue'],_0xccf1('0x43'),JSON[_0xccf1('0x28')](_0x2d0ea0[_0xccf1('0x14')][_0x2d0ea0[_0xccf1('0x41')][_0x557c4e][_0xccf1('0x44')]][_0xccf1('0x2c')]),'pTalking:\x20',JSON[_0xccf1('0x28')](_0x2d0ea0['campaignsPreview'][_0x2d0ea0[_0xccf1('0x41')][_0x557c4e][_0xccf1('0x44')]]['pTalking']),JSON[_0xccf1('0x28')](_0x2d0ea0[_0xccf1('0x41')][_0x557c4e][_0xccf1('0x45')]),JSON['stringify'](_[_0xccf1('0x46')](_0x2d0ea0[_0xccf1('0x41')][_0x557c4e],[_0xccf1('0x47'),_0xccf1('0x48'),_0xccf1('0x49'),_0xccf1('0x4a')])));return ami[_0xccf1('0x4b')]({'action':_0xccf1('0x4c'),'channel':_0x2d0ea0[_0xccf1('0x41')][_0x557c4e][_0xccf1('0x4d')]})['catch'](function(_0x14e650){if(_0x14e650[_0xccf1('0x30')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x2d0ea0[_0xccf1('0x41')][_0x557c4e]){ut[_0xccf1('0x4e')](_0x2d0ea0[_0xccf1('0x14')][_0x2d0ea0[_0xccf1('0x41')][_0x557c4e]['queue']],_0xccf1('0x4f'));if(_0x2d0ea0[_0xccf1('0x41')][_0x557c4e][_0xccf1('0x45')]===!![]){ut[_0xccf1('0x50')](_0x2d0ea0['campaignsPreview'][_0x2d0ea0[_0xccf1('0x41')][_0x557c4e]['queue']],_0xccf1('0x4f'));ut['loggerError'](_0xccf1('0x51')+_0x557c4e,_0x2d0ea0['actions'][_0x557c4e]['queue']);}ut[_0xccf1('0x52')](_0xccf1('0x53')+_0x557c4e,_0x2d0ea0[_0xccf1('0x41')][_0x557c4e][_0xccf1('0x44')]);delete _0x2d0ea0[_0xccf1('0x41')][_0x557c4e];}},0x2328);}});}});};Preview[_0xccf1('0xf')]['clearZombieChannels']=function(){var _0xebabd9=this;loggerAction[_0xccf1('0x26')](_0xccf1('0x54'),_['size'](this[_0xccf1('0x41')]));for(var _0x8a45b5 in this['actions']){if(_0xebabd9[_0xccf1('0x41')][_0xccf1('0x39')](_0x8a45b5)){_0xebabd9[_0xccf1('0x3f')](_0x8a45b5);}}};Preview[_0xccf1('0xf')][_0xccf1('0x3e')]=function(_0x26566f){var _0x4eec26=this;rpcDb[_0xccf1('0x55')](_0x26566f['id'],ut[_0xccf1('0x56')](this[_0xccf1('0x16')]))[_0xccf1('0x57')](function(_0x44fca7){if(!_[_0xccf1('0x40')](_0x44fca7)){for(var _0xc4c7f4=0x0;_0xc4c7f4<_0x44fca7[_0xccf1('0x58')];_0xc4c7f4+=0x1){if(ut['getDiff'](_0x44fca7[_0xc4c7f4][_0xccf1('0x59')])<_0x26566f['dialRecallMeTimeout']*0x3c){if(_0x44fca7[_0xc4c7f4]['Agent']&&!_0x44fca7[_0xc4c7f4][_0xccf1('0x5a')][_0xccf1('0x5b')]){_0x4eec26[_0xccf1('0x5c')](_0x44fca7[_0xc4c7f4]['id'])[_0xccf1('0x57')](ut['logger2']('[RecallMe]'))[_0xccf1('0x5d')](ut['logger2'](_0xccf1('0x5e')));}else{rpcDb['disableContact'](_0x44fca7[_0xc4c7f4]['id']);}}else{var _0x473807=new Action(_0x44fca7[_0xc4c7f4],_0x26566f);_0x473807['starttime']=moment()[_0xccf1('0x29')](_0xccf1('0x5f'));_0x26566f[_0xccf1('0x60')]+=0x1;ut[_0xccf1('0x61')](_0x473807,0x17,_0xccf1('0x62'));if(_0x26566f[_0xccf1('0x63')]){rpcDb[_0xccf1('0x64')](ut[_0xccf1('0x65')](_0x44fca7[_0xc4c7f4]));rpcDb['createCustomerHistory'](_0x473807,'[HistoryDialRecallInQueue][historyCatch]');}else{ut[_0xccf1('0x61')](_0x473807,0x16,_0xccf1('0x66'));rpcDb[_0xccf1('0x67')](_0x473807,_0xccf1('0x68'));rpcDb[_0xccf1('0x69')](_0x473807,_0xccf1('0x68'));}}}}})[_0xccf1('0x5d')](ut[_0xccf1('0x6a')](_0xccf1('0x6b')));};Preview[_0xccf1('0xf')][_0xccf1('0x6c')]=function(_0x118d0a){_0x118d0a[_0xccf1('0x2b')]=!![];if(ut[_0xccf1('0x6d')](_0x118d0a['loggedIn'])){_0x118d0a[_0xccf1('0x30')]=utils[_0xccf1('0x35')][_0xccf1('0x6e')];}else if(!ut[_0xccf1('0x6f')](_0x118d0a[_0xccf1('0x70')])){_0x118d0a[_0xccf1('0x30')]=utils[_0xccf1('0x35')][_0xccf1('0x71')];}else if(!this[_0xccf1('0x72')](_0x118d0a[_0xccf1('0x73')])){if(!this[_0xccf1('0x72')](_0x118d0a[_0xccf1('0x74')])){_0x118d0a['message']=utils[_0xccf1('0x35')][_0xccf1('0x75')];}else{_0x118d0a[_0xccf1('0x30')]=utils[_0xccf1('0x35')]['ACTIVE'];}}else{_0x118d0a[_0xccf1('0x30')]=utils[_0xccf1('0x35')][_0xccf1('0x76')];}};Preview[_0xccf1('0xf')][_0xccf1('0x77')]=function(_0x853e78,_0x52ad06,_0x239960){var _0x383d4e=this;var _0x54625e=this['actions'][_0x52ad06];var _0x474644=this['campaignsPreview'][_0x54625e[_0xccf1('0x44')]];var _0x519016;var _0x21cd51=![];var _0x4ee6f6=0x2;var _0x35e528=0x3;if(_0x474644){switch(_0x239960){case'1':_0x474644[_0xccf1('0x78')]+=0x1;_0x54625e[_0xccf1('0x79')]+=0x1;_0x54625e[_0xccf1('0x7a')]=ut[_0xccf1('0x7b')](_0x54625e);ut[_0xccf1('0x61')](_0x54625e,0x0,_0xccf1('0x7c'));ami[_0xccf1('0x25')](_0xccf1('0x7d'),ut[_0xccf1('0x7e')](_0x54625e,_0xccf1('0x7f')));rpcDb['createCustomerHistory'](_0x54625e,_0xccf1('0x80'));_0x383d4e[_0xccf1('0x81')](_0x54625e,'0',_0x474644)[_0xccf1('0x57')](function(_0x43621a){_0x21cd51=_0x43621a[_0xccf1('0x82')]==0x1;_0x4ee6f6=_0x474644[_0xccf1('0x83')];_0x35e528=_0x474644[_0xccf1('0x84')];if(!_0x21cd51){if(ut['totalGlobal'](_0x54625e)>=_0x474644[_0xccf1('0x85')]){_0x519016=ut[_0xccf1('0x86')](_0x54625e,0xf,'Global');rpcDb['createCustomerFinal'](_0x519016,_0xccf1('0x87'));}else{if(_0x54625e[_0xccf1('0x79')]>=_0x474644[_0xccf1('0x88')]){rpcDb['createCustomerFinal'](_0x54625e,_0xccf1('0x87'));}else{rpcDb[_0xccf1('0x89')](ut[_0xccf1('0x8a')](_0x54625e,'countnosuchnumberretry',_0x474644[_0xccf1('0x83')]),_0x54625e[_0xccf1('0x8b')],_0x54625e[_0xccf1('0x8c')]);}}delete this[_0xccf1('0x41')][_0x853e78[_0xccf1('0x8d')]];}else{_0x54625e['countnosuchnumberretry']++;logger[_0xccf1('0x26')](_0xccf1('0x8e'),_0x54625e[_0xccf1('0x79')]);logger['info']('id',_0x54625e['idContact']);_0x383d4e['incrementPreviewCounters']({'id':_0x54625e[_0xccf1('0x8f')],'field':{'countnosuchnumberretry':_0x54625e[_0xccf1('0x79')]}})['then'](function(){_0x383d4e[_0xccf1('0x90')](_0x54625e,_0x4ee6f6,_0x35e528)[_0xccf1('0x57')](function(){});});}});break;case'ANSWER':var _0x21fe5b=moment()[_0xccf1('0x29')](_0xccf1('0x5f'));_0x54625e['responsetime']=_0x21fe5b;_0x54625e[_0xccf1('0x91')]=_0x21fe5b;_0x54625e[_0xccf1('0x45')]=!![];_0x474644[_0xccf1('0x2d')]+=0x1;logger[_0xccf1('0x26')](_0xccf1('0x92'),_0x54625e[_0xccf1('0x93')],_0xccf1('0x94'),_0x474644[_0xccf1('0x33')],'pTalking:\x20',_0x474644[_0xccf1('0x2d')]);ami[_0xccf1('0x25')]('custom:agentconnect',ut[_0xccf1('0x7e')](_0x54625e,_0xccf1('0x95'),this[_0xccf1('0x14')][_0x54625e['queue']]));if(_0x474644[_0xccf1('0x96')]){ami[_0xccf1('0x25')](_0xccf1('0x97'),ut[_0xccf1('0x98')](_0x54625e));}break;case'16':ami[_0xccf1('0x25')](_0xccf1('0x99'),ut['buildObj'](_0x54625e,'complete',this['campaignsPreview'][_0x54625e[_0xccf1('0x44')]]));emitVoiceQueueChannelRemove(ut['buildObj'](_0x54625e,_0xccf1('0x9a')));_0x474644[_0xccf1('0x9b')]+=0x1;_0x474644[_0xccf1('0x9c')]+=0x1;_0x474644[_0xccf1('0x9d')]+=0x1;ut[_0xccf1('0x50')](_0x474644,_0xccf1('0x9e'));_0x54625e[_0xccf1('0x7a')]=ut['totalGlobal'](_0x54625e);ut[_0xccf1('0x61')](_0x54625e,0x4,_0xccf1('0x9f'));rpcDb['createCustomerHistory'](_0x54625e,_0xccf1('0xa0'));rpcDb[_0xccf1('0x69')](_0x54625e,'[callProgressDetectingCustomer][logAnswerGlobal]');rpcDb[_0xccf1('0xa1')](_0x54625e);_0x474644[_0xccf1('0xa2')]+=_0x54625e['talktime'];_0x474644[_0xccf1('0xa3')]+=_0x54625e[_0xccf1('0xa4')];logger['info'](_0xccf1('0xa5'),_0x54625e[_0xccf1('0x93')],_0xccf1('0x94'),_0x474644[_0xccf1('0x33')],'pTalking:\x20',_0x474644['pTalking']);delete this[_0xccf1('0x41')][_0x853e78[_0xccf1('0x8d')]];break;case'BUSY':_0x474644[_0xccf1('0xa6')]+=0x1;_0x54625e[_0xccf1('0xa7')]+=0x1;_0x54625e[_0xccf1('0x7a')]=ut[_0xccf1('0x7b')](_0x54625e);ut[_0xccf1('0x61')](_0x54625e,0x5,_0xccf1('0xa8'));_0x4ee6f6=_0x474644[_0xccf1('0xa9')];_0x35e528=_0x474644[_0xccf1('0x84')];ami[_0xccf1('0x25')](_0xccf1('0xaa'),ut[_0xccf1('0x7e')](_0x54625e,_0xccf1('0xab')));rpcDb['createCustomerHistory'](_0x54625e,_0xccf1('0xac'));_0x383d4e[_0xccf1('0x81')](_0x54625e,'5',_0x474644)[_0xccf1('0x57')](function(_0x3dcb3b){_0x21cd51=_0x3dcb3b[_0xccf1('0x82')]==0x1;if(!_0x21cd51){if(ut[_0xccf1('0x7b')](_0x54625e)>=_0x474644[_0xccf1('0x85')]){_0x519016=ut[_0xccf1('0x86')](_0x54625e,0xf,'Global');rpcDb['createCustomerFinal'](_0x519016,_0xccf1('0xad'));}else{if(_0x54625e[_0xccf1('0xa7')]>=_0x474644[_0xccf1('0xae')]){rpcDb[_0xccf1('0x69')](_0x54625e,_0xccf1('0xac'));}else{rpcDb[_0xccf1('0x89')](ut[_0xccf1('0x8a')](_0x54625e,_0xccf1('0xa7'),_0x474644[_0xccf1('0xa9')]),_0x54625e[_0xccf1('0x8b')],_0x54625e['activeContact']);}}}else{_0x54625e[_0xccf1('0xa7')]++;_0x383d4e[_0xccf1('0xaf')]({'id':_0x54625e[_0xccf1('0x8f')],'field':{'countbusyretry':_0x54625e['countbusyretry']}})[_0xccf1('0x57')](function(){_0x383d4e[_0xccf1('0x90')](_0x54625e,_0x4ee6f6,_0x35e528)[_0xccf1('0x57')](function(){});});}});break;case _0xccf1('0xb0'):_0x474644['outboundNoAnswerCallsDay']+=0x1;_0x54625e['countnoanswerretry']+=0x1;_0x54625e[_0xccf1('0x7a')]=ut[_0xccf1('0x7b')](_0x54625e);ut[_0xccf1('0x61')](_0x54625e,0x3,'NoAnswer');_0x4ee6f6=_0x474644[_0xccf1('0xb1')];_0x35e528=_0x474644[_0xccf1('0x84')];var _0x231299=ut[_0xccf1('0xb2')](_0x54625e,_0x474644);ami[_0xccf1('0x25')](_0xccf1('0xb3'),_0x231299);rpcDb[_0xccf1('0x67')](_0x54625e,_0xccf1('0xb4'));_0x383d4e['verifyAdditionalPhones'](_0x54625e,'3',_0x474644)[_0xccf1('0x57')](function(_0x17ad7f){_0x21cd51=_0x17ad7f['additional']==0x1;if(!_0x21cd51){if(ut[_0xccf1('0x7b')](_0x54625e)>=_0x474644[_0xccf1('0x85')]){_0x519016=ut['cloneAction'](_0x54625e,0xf,_0xccf1('0xb5'));rpcDb[_0xccf1('0x69')](_0x519016,_0xccf1('0xb6'));}else{if(_0x54625e[_0xccf1('0xb7')]>=_0x474644[_0xccf1('0xb8')]){rpcDb[_0xccf1('0x69')](_0x54625e,_0xccf1('0xb4'));}else{rpcDb[_0xccf1('0x89')](ut[_0xccf1('0x8a')](_0x54625e,_0xccf1('0xb7'),_0x474644[_0xccf1('0xb1')]),_0x54625e[_0xccf1('0x8b')],_0x54625e[_0xccf1('0x8c')]);}}}else{_0x54625e[_0xccf1('0xb7')]++;_0x383d4e[_0xccf1('0xaf')]({'id':_0x54625e['idContact'],'field':{'countnoanswerretry':_0x54625e[_0xccf1('0xb7')]}})[_0xccf1('0x57')](function(){_0x383d4e[_0xccf1('0x90')](_0x54625e,_0x4ee6f6,_0x35e528)[_0xccf1('0x57')](function(){});});}});break;case _0xccf1('0xb9'):_0x474644['outboundCongestionCallsDay']+=0x1;_0x54625e[_0xccf1('0xba')]+=0x1;_0x54625e[_0xccf1('0x7a')]=ut['totalGlobal'](_0x54625e);ut['logCustomer'](_0x54625e,0x8,_0xccf1('0xbb'));_0x4ee6f6=_0x474644[_0xccf1('0xbc')];_0x35e528=_0x474644['callAdditionalPhoneAfterMin'];ami[_0xccf1('0x25')](_0xccf1('0xbd'),ut[_0xccf1('0x7e')](_0x54625e,_0xccf1('0xbe')));rpcDb[_0xccf1('0x67')](_0x54625e,'[callProgressDetectingCustomer][logCongestion]');_0x383d4e[_0xccf1('0x81')](_0x54625e,'8',_0x474644)[_0xccf1('0x57')](function(_0x2dfd79){_0x21cd51=_0x2dfd79[_0xccf1('0x82')]==0x1;if(!_0x21cd51){if(ut[_0xccf1('0x7b')](_0x54625e)>=_0x474644[_0xccf1('0x85')]){_0x519016=ut['cloneAction'](_0x54625e,0xf,_0xccf1('0xb5'));rpcDb[_0xccf1('0x69')](_0x519016,_0xccf1('0xbf'));}else{if(_0x54625e['countcongestionretry']>=_0x474644[_0xccf1('0xc0')]){rpcDb['createCustomerFinal'](_0x54625e,_0xccf1('0xc1'));}else{rpcDb[_0xccf1('0x89')](ut[_0xccf1('0x8a')](_0x54625e,_0xccf1('0xba'),_0x474644[_0xccf1('0xa9')]),_0x54625e[_0xccf1('0x8b')],_0x54625e[_0xccf1('0x8c')]);}}}else{_0x54625e['countcongestionretry']++;_0x383d4e['incrementPreviewCounters']({'id':_0x54625e[_0xccf1('0x8f')],'field':{'countcongestionretry':_0x54625e[_0xccf1('0xba')]}})[_0xccf1('0x57')](function(){_0x383d4e[_0xccf1('0x90')](_0x54625e,_0x4ee6f6,_0x35e528)[_0xccf1('0x57')](function(){});});}});break;case _0xccf1('0xc2'):_0x474644['outboundRejectCallsDay']+=0x1;_0x54625e[_0xccf1('0xc3')]+=0x1;_0x54625e['countglobal']=ut[_0xccf1('0x7b')](_0x54625e);ut[_0xccf1('0x61')](_0x54625e,0x14,_0xccf1('0xc4'));_0x4ee6f6=_0x474644[_0xccf1('0xc5')];_0x35e528=_0x474644[_0xccf1('0x84')];ami[_0xccf1('0x25')](_0xccf1('0xc6'),ut[_0xccf1('0x7e')](_0x54625e,_0xccf1('0xc7')));rpcDb['createCustomerHistory'](_0x54625e,_0xccf1('0xc8'));_0x383d4e[_0xccf1('0x81')](_0x54625e,'20',_0x474644)['then'](function(_0x1bc00b){_0x21cd51=_0x1bc00b['additional']==0x1;if(!_0x21cd51){if(ut[_0xccf1('0x7b')](_0x54625e)>=_0x474644[_0xccf1('0x85')]){_0x519016=ut[_0xccf1('0x86')](_0x54625e,0x14,_0xccf1('0xc4'));rpcDb['createCustomerFinal'](_0x519016,_0xccf1('0xc9'));}else{if(_0x54625e[_0xccf1('0xc3')]>=_0x474644[_0xccf1('0xca')]){rpcDb[_0xccf1('0x69')](_0x54625e,_0xccf1('0xc9'));}else{rpcDb[_0xccf1('0x89')](ut[_0xccf1('0x8a')](_0x54625e,_0xccf1('0xc3'),_0x474644[_0xccf1('0xc5')]),_0x54625e[_0xccf1('0x8b')],_0x54625e['activeContact']);}}}else{_0x54625e[_0xccf1('0xb7')]++;_0x383d4e[_0xccf1('0xaf')]({'id':_0x54625e[_0xccf1('0x8f')],'field':{'countnoanswerretry':_0x54625e['countnoanswerretry']}})['then'](function(){_0x383d4e[_0xccf1('0x90')](_0x54625e,_0x4ee6f6,_0x35e528)[_0xccf1('0x57')](function(){});});}});break;case'ABANDONED':_0x474644['outboundAbandonedCallsDay']+=0x1;_0x54625e[_0xccf1('0xcb')]+=0x1;_0x54625e[_0xccf1('0x7a')]=ut[_0xccf1('0x7b')](_0x54625e);ut[_0xccf1('0x61')](_0x54625e,0xb,'Abandoned');rpcDb[_0xccf1('0x67')](_0x54625e,_0xccf1('0xcc'));_0x383d4e['verifyAdditionalPhones'](_0x54625e,'11',_0x474644)[_0xccf1('0x57')](function(_0x188564){_0x21cd51=_0x188564['additional']==0x1;if(!_0x21cd51){if(ut[_0xccf1('0x7b')](_0x54625e)>=_0x474644[_0xccf1('0x85')]){_0x519016=ut[_0xccf1('0x86')](_0x54625e,0xf,_0xccf1('0xb5'));rpcDb[_0xccf1('0x69')](_0x519016,_0xccf1('0xcc'));}else{if(_0x54625e[_0xccf1('0xcd')]>=_0x474644[_0xccf1('0xce')]){rpcDb[_0xccf1('0x69')](_0x54625e,_0xccf1('0xcc'));}else{rpcDb[_0xccf1('0x89')](ut['scheduledAt'](_0x54625e,_0xccf1('0xcb'),_0x474644[_0xccf1('0xcf')]),_0x54625e['unlockAgent'],_0x54625e[_0xccf1('0x8c')]);}}}else{_0x54625e[_0xccf1('0xb7')]++;_0x383d4e[_0xccf1('0xaf')]({'id':_0x54625e[_0xccf1('0x8f')],'field':{'countnoanswerretry':_0x54625e['countnoanswerretry']}})[_0xccf1('0x57')](function(){_0x383d4e['swapAdditionalPhones'](_0x54625e,_0x4ee6f6,_0x35e528)[_0xccf1('0x57')](function(){});});}});break;case'18':_0x474644[_0xccf1('0xd0')]+=0x1;_0x54625e[_0xccf1('0xd1')]+=0x1;_0x54625e[_0xccf1('0x7a')]=ut[_0xccf1('0x7b')](_0x54625e);ut[_0xccf1('0x61')](_0x54625e,0x12,_0x853e78[_0xccf1('0xd2')]||_0x853e78[_0xccf1('0xd3')]);ami[_0xccf1('0x25')](_0xccf1('0xd4'),ut[_0xccf1('0x7e')](_0x54625e,_0xccf1('0xd5')));rpcDb['createCustomerHistory'](_0x54625e,'[callProgressDetectingCustomer][hangupInAMD]');_0x383d4e[_0xccf1('0x81')](_0x54625e,'18',_0x474644)[_0xccf1('0x57')](function(_0x155077){_0x21cd51=_0x155077[_0xccf1('0x82')]==0x1;if(!_0x21cd51){if(ut[_0xccf1('0x7b')](_0x54625e)>=_0x474644['dialGlobalMaxRetry']){_0x519016=ut[_0xccf1('0x86')](_0x54625e,0x12,'Global');rpcDb['createCustomerFinal'](_0x519016,_0xccf1('0xd6'));}else{rpcDb[_0xccf1('0x69')](_0x54625e,_0xccf1('0xd6'));}}else{_0x54625e[_0xccf1('0xb7')]++;_0x383d4e[_0xccf1('0xaf')]({'id':_0x54625e[_0xccf1('0x8f')],'field':{'countnoanswerretry':_0x54625e['countnoanswerretry']}})[_0xccf1('0x57')](function(){_0x383d4e['swapAdditionalPhones'](_0x54625e,_0x4ee6f6,_0x35e528)['then'](function(){});});}});delete this['actions'][_0x853e78[_0xccf1('0x8d')]];break;case'19':_0x474644['outboundUnknownCallsDay']+=0x1;_0x54625e[_0xccf1('0x7a')]=ut[_0xccf1('0x7b')](_0x54625e);ut[_0xccf1('0x61')](_0x54625e,0x13,_0x853e78[_0xccf1('0xd2')]||_0x853e78[_0xccf1('0xd3')]);ami['emit'](_0xccf1('0xd4'),ut[_0xccf1('0x7e')](_0x54625e,_0xccf1('0xd5')));rpcDb['createCustomerHistory'](_0x54625e,'[callProgressDetectingCustomer][machine]');_0x383d4e['verifyAdditionalPhones'](_0x54625e,'18',_0x474644)[_0xccf1('0x57')](function(_0x191913){_0x21cd51=_0x191913[_0xccf1('0x82')]==0x1;if(!_0x21cd51){if(ut['totalGlobal'](_0x54625e)>=_0x474644['dialGlobalMaxRetry']){_0x519016=ut[_0xccf1('0x86')](_0x54625e,0xf,'Global');rpcDb['createCustomerFinal'](_0x519016,_0xccf1('0xd7'));}else{rpcDb[_0xccf1('0x69')](_0x54625e,_0xccf1('0xd7'));}}else{_0x54625e[_0xccf1('0xb7')]++;_0x383d4e[_0xccf1('0xaf')]({'id':_0x54625e[_0xccf1('0x8f')],'field':{'countnoanswerretry':_0x54625e[_0xccf1('0xb7')]}})[_0xccf1('0x57')](function(){_0x383d4e[_0xccf1('0x90')](_0x54625e,_0x4ee6f6,_0x35e528)[_0xccf1('0x57')](function(){});});}});delete this[_0xccf1('0x41')][_0x853e78[_0xccf1('0x8d')]];break;default:if(_0x54625e['dialAnswer']){ut[_0xccf1('0x50')](_0x474644,_0xccf1('0xd8'));ut[_0xccf1('0x52')](_0xccf1('0xd9')+_0x474644[_0xccf1('0x33')],_0x853e78);}_0x474644[_0xccf1('0xd0')]+=0x1;_0x54625e['countglobal']=ut[_0xccf1('0x7b')](_0x54625e);ut[_0xccf1('0x61')](_0x54625e,0xc,_0x853e78['cause-txt']||_0x853e78[_0xccf1('0xd3')]);_0x4ee6f6=_0x474644[_0xccf1('0xc5')];_0x35e528=_0x474644[_0xccf1('0x84')];rpcDb[_0xccf1('0x67')](_0x54625e,_0xccf1('0xda'));_0x383d4e[_0xccf1('0x81')](_0x54625e,'20',_0x474644)[_0xccf1('0x57')](function(_0x3e35ed){_0x21cd51=_0x3e35ed[_0xccf1('0x82')]==0x1;if(!_0x21cd51){if(ut['totalGlobal'](_0x54625e)>=_0x474644['dialGlobalMaxRetry']){_0x519016=ut[_0xccf1('0x86')](_0x54625e,0xf,'Global');rpcDb[_0xccf1('0x69')](_0x519016,_0xccf1('0xdb'));}else{rpcDb[_0xccf1('0x69')](_0x54625e,_0xccf1('0xdb'));}delete this[_0xccf1('0x41')][_0x853e78[_0xccf1('0x8d')]];}else{_0x383d4e['swapAdditionalPhones'](_0x54625e,_0x4ee6f6,_0x35e528)[_0xccf1('0x57')](function(){});}});}if(!(_0x54625e['dialAnswer']&&_0x239960==='16')){ut[_0xccf1('0x4e')](_0x474644,_0xccf1('0xdc'));logger['info']('[originated][decrement][callProgressDetectingCustomer]',_0x54625e[_0xccf1('0x93')],'\x20Queue',_0x474644['name'],'originated:\x20',_0x474644[_0xccf1('0x2c')]);}if(_0x239960!=='ANSWER'){delete this[_0xccf1('0x41')][_0x853e78[_0xccf1('0x8d')]];delete this['actions'][_0x853e78['destlinkedid']];}_0x474644['queueSummaryCountersUpdated']=!![];}};Preview[_0xccf1('0xf')][_0xccf1('0xdd')]=function(_0x23f7cd,_0x13b78c,_0x103f82){if(_[_0xccf1('0xde')](_0x13b78c)&&_0xccf1('0xdf')!==typeof _0x13b78c){return;}if(_['isUndefined'](_0x103f82)&&_0xccf1('0xdf')!==typeof _0x103f82){return;}switch(_0x103f82[_0xccf1('0xe0')]){case'0':ut[_0xccf1('0xe1')](_0x23f7cd,0x0,'NoSuchNumber');rpcDb[_0xccf1('0xe2')](_0x23f7cd,_0xccf1('0xe3'));break;case'3':ut['logAgent'](_0x23f7cd,0x3,_0xccf1('0xe4'));rpcDb[_0xccf1('0xe2')](_0x23f7cd,'[callProgressDetectingAgent][logNoAnswer]');break;case'5':ut[_0xccf1('0xe1')](_0x23f7cd,0x5,_0xccf1('0xa8'));rpcDb[_0xccf1('0xe2')](_0x23f7cd,_0xccf1('0xe5'));break;case'8':ut[_0xccf1('0xe1')](_0x23f7cd,0x8,_0xccf1('0xbb'));rpcDb[_0xccf1('0xe2')](_0x23f7cd,'[callProgressDetectingAgent][logCongestion]');break;case'22':ut[_0xccf1('0xe1')](_0x23f7cd,0x16,_0xccf1('0xe6'));rpcDb[_0xccf1('0xe2')](_0x23f7cd,_0xccf1('0xe7'));break;default:ut[_0xccf1('0xe1')](_0x23f7cd,0xc,_0x103f82[_0xccf1('0xe0')]);rpcDb[_0xccf1('0xe2')](_0x23f7cd,_0xccf1('0xe8'));}ut[_0xccf1('0x4e')](_0x13b78c,'[callProgressDetectingAgent]');logger[_0xccf1('0x26')](_0xccf1('0xe9'),_0x23f7cd[_0xccf1('0x93')],_0xccf1('0x94'),_0x13b78c[_0xccf1('0x33')],_0xccf1('0x43'),_0x13b78c[_0xccf1('0x2c')]);delete this[_0xccf1('0x41')][_0x23f7cd['uniqueid']];};Preview[_0xccf1('0xf')][_0xccf1('0x81')]=function(_0x230e98,_0x5e3654,_0x41587a){return cmHopperAdditionalPhone[_0xccf1('0x81')](_0x230e98,_0x5e3654,_0x41587a)['catch'](logger[_0xccf1('0x26')]('[verifyAdditionalPhone]\x20'));};Preview[_0xccf1('0xf')][_0xccf1('0x90')]=function(_0x39e723,_0x4a8ddf,_0x487364){return cmHopperAdditionalPhone[_0xccf1('0x90')](_0x39e723,_0x4a8ddf,_0x487364)[_0xccf1('0x5d')](logger[_0xccf1('0x26')](_0xccf1('0xea')));};Preview['prototype']['incrementPreviewCounters']=function(_0x3fefa8){return Promise['resolve']()[_0xccf1('0x57')](cmHopperAdditionalPhone['incrementPreviewCounters'](_0x3fefa8))[_0xccf1('0x5d')](logger['info'](_0xccf1('0xeb')));};Preview[_0xccf1('0xf')][_0xccf1('0xec')]=function(_0x492db7,_0x3b3706,_0x855a9f,_0x51e9cf,_0x58f660){var _0x13f4b3=this;return new Promise(function(_0x2dad5c,_0x28fb5a){if(_['isNil'](_0x3b3706)||_['isNil'](_0x3b3706['Contact'])||_[_0xccf1('0x40')](_0x3b3706[_0xccf1('0xed')])||_[_0xccf1('0x40')](_0x3b3706['VoiceQueueId'])){_0x28fb5a(ut[_0xccf1('0x30')](_0xccf1('0xee'),_0x51e9cf,_0x58f660));return;}var _0x364463=uuid['v4']();var _0x3b4081=_0x13f4b3[_0xccf1('0x14')][_0x3b3706[_0xccf1('0xef')]['name']];var _0x2e36de=_0x855a9f?_0x13f4b3[_0xccf1('0x16')][_0x855a9f]['id']:undefined;_0x13f4b3[_0xccf1('0x41')][_0x364463]=new Action(_0x3b3706,_0x3b4081,_0x364463,_0x855a9f,_0x2e36de);var _0x891af2=_0x13f4b3[_0xccf1('0x41')][_0x364463];_0x891af2[_0xccf1('0x8b')]=_0x51e9cf;_0x891af2[_0xccf1('0x8c')]=_0x58f660;_0x891af2['lookAgent']=_0x855a9f;if(_[_0xccf1('0xf0')](_0x492db7)){_0x13f4b3['execCall'](_0x891af2,_0x3b4081,_0x3b3706,_0x855a9f)['then'](function(_0xfa22da){logger[_0xccf1('0x26')](_0xccf1('0xf1'),_0xccf1('0xf2')+_0x891af2[_0xccf1('0x44')]+_0xccf1('0xf3')+_0x891af2[_0xccf1('0x8f')],JSON[_0xccf1('0x28')](_0xfa22da));ami['emit'](_0xccf1('0xf4'),ut[_0xccf1('0x7e')](_0x891af2,_0xccf1('0xf5'),_0x13f4b3[_0xccf1('0x14')][_0x891af2[_0xccf1('0x44')]]));_0x2dad5c(ut[_0xccf1('0x30')](_0xccf1('0xf6')));})[_0xccf1('0x5d')](function(_0x4318c7){ut[_0xccf1('0x31')](_0xccf1('0xf7'),_0x4318c7);_0x28fb5a(ut['message'](_0xccf1('0xf8'),_0x51e9cf,_0x58f660));});}else{_0x3b4081[_0xccf1('0xf9')]+=0x1;ut['logBlacklist'](_0x891af2);rpcDb[_0xccf1('0xfa')](_0x891af2,_0xccf1('0xfb'));delete _0x13f4b3[_0xccf1('0x41')][_0x364463];_0x28fb5a(ut[_0xccf1('0x30')](_0xccf1('0xfc'),_0x51e9cf,_0x58f660));}});};Preview[_0xccf1('0xf')][_0xccf1('0x72')]=function(_0x1e19f1){return!_['isNil'](_0x1e19f1)&&!_[_0xccf1('0x40')](_0x1e19f1[_0xccf1('0x33')])&&!_['isNil'](_0x1e19f1[_0xccf1('0xfd')])&&_0x1e19f1[_0xccf1('0xfd')]&&!_[_0xccf1('0x40')](this[_0xccf1('0x15')][util[_0xccf1('0x29')]('SIP/%s',_0x1e19f1[_0xccf1('0x33')])])&&!_[_0xccf1('0x40')](this[_0xccf1('0x15')][util[_0xccf1('0x29')](_0xccf1('0xfe'),_0x1e19f1['name'])][_0xccf1('0x4c')])&&(this['trunks'][util['format'](_0xccf1('0xfe'),_0x1e19f1[_0xccf1('0x33')])][_0xccf1('0x4c')]===_0xccf1('0xff')||this['trunks'][util['format'](_0xccf1('0xfe'),_0x1e19f1[_0xccf1('0x33')])]['status']==='unmonitored');};Preview[_0xccf1('0xf')][_0xccf1('0x5c')]=function(_0x42c0a4,_0xb0313d){return this[_0xccf1('0x100')](_0x42c0a4,_0xb0313d)[_0xccf1('0x57')](function(_0x1cfbda){return _['pick'](_0x1cfbda,[_0xccf1('0x30')]);})[_0xccf1('0x5d')](function(_0x120f47){if(_0x120f47[_0xccf1('0x101')]){rpcDb[_0xccf1('0x102')](_0x42c0a4);}if(_0x120f47[_0xccf1('0xfd')]){rpcDb[_0xccf1('0x103')](_0x42c0a4);}throw _['pick'](_0x120f47,[_0xccf1('0x30')]);});};Preview[_0xccf1('0xf')][_0xccf1('0x100')]=function(_0x5259d7,_0x472657){var _0x2aea03=this;var _0x5d7ac3,_0x170937;return rpcDb[_0xccf1('0x104')](_0x5259d7)[_0xccf1('0x57')](function(_0x269f69){if(!_['isNil'](_0x269f69[0x0])){_0x170937=_0x269f69[0x0][_0xccf1('0x105')]?![]:!![];_0x5d7ac3=_0x269f69[0x0][_0xccf1('0x105')]?!![]:![];_0x5d7ac3=_0x472657?!![]:_0x5d7ac3;}var _0x55ac72=_0x2aea03[_0xccf1('0x106')](_0x269f69);if(_0x55ac72['isValid']){rpcDb['checkIsBlackList'](_['pick'](_0x269f69[0x0],[_0xccf1('0x49'),_0xccf1('0xed')]))[_0xccf1('0x57')](function(_0x40dd9c){_0x2aea03['checkInBlack'](_0x40dd9c,_0x269f69[0x0],_0x472657,_0x170937,_0x5d7ac3)[_0xccf1('0x57')](function(_0x3d591d){return _0x3d591d;})['catch'](function(_0x582a92){throw _0x582a92;});})[_0xccf1('0x5d')](function(_0x497859){ut['logger'](_0xccf1('0x107'),_0x497859);throw ut['message'](_0xccf1('0x108'),_0x170937,_0x5d7ac3);});}else{throw ut[_0xccf1('0x30')](_0x55ac72[_0xccf1('0x30')],_0x170937,_0x5d7ac3);}})[_0xccf1('0x5d')](function(_0x1edaff){ut[_0xccf1('0x31')](_0xccf1('0x109'),_0x1edaff);throw ut[_0xccf1('0x30')](_0xccf1('0x108'),![],!![]);});};Preview[_0xccf1('0xf')][_0xccf1('0x106')]=function(_0x3a3928){if(_[_0xccf1('0x40')](_0x3a3928)||_[_0xccf1('0xf0')](_0x3a3928)||!_[_0xccf1('0x40')](_0x3a3928[0x0][_0xccf1('0x5a')])&&_['isNil'](_0x3a3928[0x0]['Agent'][_0xccf1('0x33')])){ut[_0xccf1('0x31')](_0xccf1('0x10a'),_0x3a3928);return{'isValid':![],'message':'Empty\x20Contact'};}var _0x5d7cf4=this[_0xccf1('0x14')][_0x3a3928[0x0][_0xccf1('0xef')]['name']];_0x5d7cf4[_0xccf1('0x30')]=utils[_0xccf1('0x35')][_0xccf1('0x76')];if(_[_0xccf1('0x40')](_0x5d7cf4)){ut[_0xccf1('0x31')]('[Preview][validateContact][Empty\x20Campaign]',_0x5d7cf4);return{'isValid':![],'message':'Empty\x20Campaign'};}if(!this[_0xccf1('0x72')](_0x5d7cf4[_0xccf1('0x73')])){ut['logger'](_0xccf1('0x10b'),_0xccf1('0x10c')+_0x5d7cf4[_0xccf1('0x33')]+'\x20Trunk\x20is\x20not\x20active');if(!this[_0xccf1('0x72')](_0x5d7cf4[_0xccf1('0x74')])){ut['logger']('[Preview][validateContact][Trunk\x20not\x20working\x20correctly]',_0x5d7cf4[_0xccf1('0x33')]+_0xccf1('0x10d'));return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}}if(!ut[_0xccf1('0x6f')](_0x5d7cf4[_0xccf1('0x70')])){ut[_0xccf1('0x31')](_0xccf1('0x10e'),_0x5d7cf4[_0xccf1('0x33')]+'\x20Not\x20Active');return{'isValid':![],'message':_0xccf1('0x10c')+_0x5d7cf4[_0xccf1('0x33')]+'\x20Not\x20Active'};}return{'isValid':!![],'message':_0xccf1('0x10f')};};Preview[_0xccf1('0xf')][_0xccf1('0x110')]=function(_0x59b141,_0xf7b8a7,_0x221560,_0x25a55e){var _0x5920bd=this;return new Promise(function(_0xcd3f70,_0xe108c4){var _0x254ad5=_0x59b141['uniqueid'];var _0x550824=_0x5920bd['isTrunkReachable'](_0xf7b8a7[_0xccf1('0x73')])?util[_0xccf1('0x29')](_0xccf1('0x111'),_0xf7b8a7[_0xccf1('0x73')][_0xccf1('0x33')],_['isNil'](_0xf7b8a7[_0xccf1('0x112')])?'':_0xf7b8a7[_0xccf1('0x112')]['trim']()||'',_0xf7b8a7['dialCutDigit']>0x0?_0x221560[_0xccf1('0xed')][_0xccf1('0x113')](_0xf7b8a7['dialCutDigit']):_0x221560['phone']):util[_0xccf1('0x29')](_0xccf1('0x111'),_[_0xccf1('0x40')](_0xf7b8a7[_0xccf1('0x74')])?_0xf7b8a7['Trunk'][_0xccf1('0x33')]:_0xf7b8a7[_0xccf1('0x74')][_0xccf1('0x33')],_[_0xccf1('0x40')](_0xf7b8a7[_0xccf1('0x112')])?'':_0xf7b8a7[_0xccf1('0x112')][_0xccf1('0x114')]()||'',_0xf7b8a7[_0xccf1('0x115')]>0x0?_0x221560[_0xccf1('0xed')][_0xccf1('0x113')](_0xf7b8a7[_0xccf1('0x115')]):_0x221560['phone']);var _0x530824=_0x5920bd['isTrunkReachable'](_0xf7b8a7[_0xccf1('0x73')])?ut[_0xccf1('0x116')](_0xf7b8a7['Trunk'][_0xccf1('0x117')],_0xf7b8a7[_0xccf1('0x118')],_0xf7b8a7[_0xccf1('0x119')]>0x0?ut[_0xccf1('0x11a')](_0xf7b8a7['dialOriginateCallerIdNumber'],_0xf7b8a7[_0xccf1('0x119')]):_0xf7b8a7[_0xccf1('0x11b')]):ut[_0xccf1('0x116')](_[_0xccf1('0x40')](_0xf7b8a7['TrunkBackup'])?_0xf7b8a7[_0xccf1('0x73')][_0xccf1('0x117')]:_0xf7b8a7[_0xccf1('0x74')]['callerid'],_0xf7b8a7[_0xccf1('0x118')],_0xf7b8a7[_0xccf1('0x119')]>0x0?ut[_0xccf1('0x11a')](_0xf7b8a7[_0xccf1('0x11b')],_0xf7b8a7[_0xccf1('0x119')]):_0xf7b8a7[_0xccf1('0x11b')]);if(_0x530824){_0x59b141[_0xccf1('0x11c')]=ut['extractCalleridName'](_0x530824);_0x59b141[_0xccf1('0x11d')]=ut['extractCalleridNumber'](_0x530824);}var _0x1670e6=ut['addVariables'](_0xf7b8a7,_0x221560,_0x550824,_0x530824,_0x254ad5,_0x59b141);var _0x3a44b2=utils[_0xccf1('0x11e')](_0x221560[_0xccf1('0x11f')]);Object['assign'](_0x1670e6,_0x3a44b2);_[_0xccf1('0x120')](_0x59b141,ut[_0xccf1('0x121')](_0x1670e6));_0x59b141['starttime']=moment()[_0xccf1('0x29')]('YYYY-MM-DD\x20HH:mm:ss');_0xf7b8a7[_0xccf1('0x122')]=_0x1670e6;var _0xea9e8=ut[_0xccf1('0x123')](_0x59b141,_0xf7b8a7,_0x1670e6,_0x59b141[_0xccf1('0x8c')],_0x25a55e);return ami[_0xccf1('0x4b')](_0xea9e8)['then'](function(_0x33cccc){_0xf7b8a7[_0xccf1('0x2c')]+=0x1;logger[_0xccf1('0x26')]('[originated][increment]',_0x254ad5,'\x20Queue',_0xf7b8a7['name'],_0xccf1('0x43'),_0xf7b8a7[_0xccf1('0x2c')]);_0xcd3f70(_0x33cccc);})['catch'](function(_0xb5c68e){ut[_0xccf1('0xe1')](_0x59b141,0xe,_0xccf1('0x124'));rpcDb['createAgentHistory'](_0x59b141,'[originateFailure][logOriginateFailure]');_0xe108c4(_0xb5c68e);});});};Preview[_0xccf1('0xf')][_0xccf1('0x1f')]=function(_0x4b29ff){if(this[_0xccf1('0x41')][_0x4b29ff[_0xccf1('0x8d')]]){this[_0xccf1('0x41')][_0x4b29ff['linkedid']][_0xccf1('0x4d')]=_0x4b29ff[_0xccf1('0x4d')];}};Preview[_0xccf1('0xf')]['syncOriginateResponse']=function(_0xa264a9){var _0x7c16d7=this;var _0x3fd914=this[_0xccf1('0x41')][_0xa264a9[_0xccf1('0x125')]];if(_0x3fd914){if(_0x3fd914['lookAgent']&&this[_0xccf1('0x16')][_0x3fd914[_0xccf1('0x126')]]){ut[_0xccf1('0x127')](_0x3fd914,this[_0xccf1('0x16')][_0x3fd914[_0xccf1('0x126')]][_0xccf1('0x33')],this[_0xccf1('0x16')][_0x3fd914['lookAgent']]['id']);}var _0x159702=_[_0xccf1('0x128')](_0x3fd914);_0x159702[_0xccf1('0x129')]=moment()[_0xccf1('0x29')](_0xccf1('0x5f'));var _0x2e462a=_0x7c16d7[_0xccf1('0x14')][_0x3fd914['queue']];if(ut['isFailure'](_0xa264a9['response'])){if(_0x3fd914[_0xccf1('0x8b')]){rpcDb[_0xccf1('0x102')](_0x3fd914[_0xccf1('0x8f')]);}if(_0x3fd914['activeContact']){rpcDb[_0xccf1('0x103')](_0x3fd914[_0xccf1('0x8f')]);}ami[_0xccf1('0x25')]('custom:agentringnoanswer',ut[_0xccf1('0x7e')](_0x3fd914,_0xccf1('0x12a'),this[_0xccf1('0x14')][_0x3fd914[_0xccf1('0x44')]]));this['callProgressDetectingAgent'](_0x159702,_0x2e462a,_0xa264a9);}else{_0x3fd914['starttime']=moment()[_0xccf1('0x29')](_0xccf1('0x5f'));ut[_0xccf1('0xe1')](_0x159702,0x4,_0xccf1('0x9f'));rpcDb[_0xccf1('0xe2')](_0x159702,_0xccf1('0x12b'));}}};Preview[_0xccf1('0xf')][_0xccf1('0x1a')]=function(_0x3d74e2){var _0xa74426=this[_0xccf1('0x41')][_0x3d74e2[_0xccf1('0x8d')]];var _0x1bc9ea;if(_0xa74426){_0x1bc9ea=this[_0xccf1('0x14')][_0xa74426[_0xccf1('0x44')]];logger[_0xccf1('0x26')]('[syncHangup][talking]',_0x3d74e2['linkedid'],_0xccf1('0x94'),_0x1bc9ea[_0xccf1('0x33')],_0xccf1('0x12c'),_0x1bc9ea['pTalking']);}if(this[_0xccf1('0x41')][_0x3d74e2[_0xccf1('0x8d')]]&&_0x3d74e2[_0xccf1('0x8d')]!==_0x3d74e2[_0xccf1('0x93')]){if(_0x3d74e2[_0xccf1('0x12d')]==='16'&&this[_0xccf1('0x41')][_0x3d74e2[_0xccf1('0x8d')]][_0xccf1('0x45')]){this[_0xccf1('0x77')](_0x3d74e2,_0x3d74e2[_0xccf1('0x8d')],_0x3d74e2[_0xccf1('0x12d')]);}else if(this[_0xccf1('0x41')][_0x3d74e2['linkedid']][_0xccf1('0x45')]){logger[_0xccf1('0x26')]('[syncHangup][talking][cause]',_0x3d74e2[_0xccf1('0x8d')],_0x3d74e2[_0xccf1('0x12d')],_0xccf1('0x94'),_0x1bc9ea['name'],'pTalking:\x20',_0x1bc9ea[_0xccf1('0x2d')]);this[_0xccf1('0x77')](_0x3d74e2,_0x3d74e2[_0xccf1('0x8d')],_0x3d74e2[_0xccf1('0x12d')]);}}else if(_0xa74426&&_[_0xccf1('0x40')](_0xa74426[_0xccf1('0x12e')])&&_0x1bc9ea[_0xccf1('0x12f')]&&_0x3d74e2[_0xccf1('0x8d')]===_0x3d74e2[_0xccf1('0x93')]&&_[_0xccf1('0x40')](_0x3d74e2[_0xccf1('0xe0')])&&_0x3d74e2['cause']==='16'&&_0x3d74e2[_0xccf1('0x130')]==='6'&&_['isUndefined'](_0xa74426[_0xccf1('0x131')])){if(_0xa74426[_0xccf1('0x8b')]){rpcDb[_0xccf1('0x102')](_0xa74426[_0xccf1('0x8f')]);}if(_0xa74426[_0xccf1('0x8c')]){rpcDb[_0xccf1('0x103')](_0xa74426['idContact']);}_0x3d74e2[_0xccf1('0xe0')]='22';this[_0xccf1('0xdd')](_0xa74426,_0x1bc9ea,_0x3d74e2);}else if(_0xa74426&&_0xa74426['transfer']){if(_0x3d74e2[_0xccf1('0x12d')]==='16'&&this[_0xccf1('0x41')][_0x3d74e2[_0xccf1('0x8d')]][_0xccf1('0x45')]){logger['info'](_0xccf1('0x132'),_0x3d74e2[_0xccf1('0x8d')],_0x3d74e2[_0xccf1('0x12d')],_0xccf1('0x94'),_0x1bc9ea[_0xccf1('0x33')],_0xccf1('0x12c'),_0x1bc9ea['pTalking']);this[_0xccf1('0x77')](_0x3d74e2,_0x3d74e2[_0xccf1('0x8d')],_0x3d74e2['cause']);}else if(this['actions'][_0x3d74e2[_0xccf1('0x8d')]]['dialAnswer']){logger[_0xccf1('0x26')](_0xccf1('0x133'),_0x3d74e2['linkedid'],_0x3d74e2[_0xccf1('0x12d')],_0xccf1('0x94'),_0x1bc9ea[_0xccf1('0x33')],_0xccf1('0x12c'),_0x1bc9ea[_0xccf1('0x2d')]);this[_0xccf1('0x77')](_0x3d74e2,_0x3d74e2[_0xccf1('0x8d')],_0x3d74e2['cause']);}}};Preview['prototype'][_0xccf1('0x1e')]=function(_0x339c83){if(this[_0xccf1('0x41')][_0x339c83[_0xccf1('0x134')]]&&_0x339c83[_0xccf1('0x134')]!==_0x339c83['destuniqueid']){this[_0xccf1('0x77')](_0x339c83,_0x339c83['destlinkedid'],_0x339c83[_0xccf1('0xd3')]);}};Preview[_0xccf1('0xf')][_0xccf1('0x1d')]=function(_0x256de6){if(this[_0xccf1('0x41')][_0x256de6[_0xccf1('0x8d')]]&&_0x256de6[_0xccf1('0x8d')]!==_0x256de6[_0xccf1('0x93')]&&!this[_0xccf1('0x41')][_0x256de6[_0xccf1('0x8d')]][_0xccf1('0x45')]){if(_0x256de6['cause']==='1'){this[_0xccf1('0x77')](_0x256de6,_0x256de6['linkedid'],_0x256de6[_0xccf1('0x12d')]);}}};Preview[_0xccf1('0xf')][_0xccf1('0x135')]=function(_0x2f7a46,_0x228de1,_0x4a1684){if(this['actions'][_0x2f7a46]){if(_[_0xccf1('0x40')](this[_0xccf1('0x41')][_0x2f7a46]['variables'])){this[_0xccf1('0x41')][_0x2f7a46][_0xccf1('0x122')]={};}this[_0xccf1('0x41')][_0x2f7a46][_0xccf1('0x122')][_0x228de1]=_0x4a1684;}};Preview[_0xccf1('0xf')]['syncVarSet']=function(_0x3cde0f){try{if(!_[_0xccf1('0x40')](_0x3cde0f)){if(ut['filterKey'](_[_0xccf1('0x136')](_0x3cde0f[_0xccf1('0x137')])[0x0])){this[_0xccf1('0x135')](_0x3cde0f[_0xccf1('0x93')],_[_0xccf1('0x136')](_0x3cde0f[_0xccf1('0x137')])[0x0],_0x3cde0f[_0xccf1('0x138')]);}}}catch(_0x349d6a){logger[_0xccf1('0x139')]('[syncVarSet][Preview]',util[_0xccf1('0x13a')](_0x349d6a,{'showHidden':![],'depth':null}));}};Preview[_0xccf1('0xf')][_0xccf1('0x21')]=function(_0x49eae4){if(_0x49eae4){if(this['actions'][_0x49eae4[_0xccf1('0x13b')]]){this['actions'][_0x49eae4[_0xccf1('0x13b')]][_0xccf1('0x131')]=!![];}}};Preview['prototype']['syncBlindTransfer']=function(_0x56e173){if(_0x56e173){if(this[_0xccf1('0x41')][_0x56e173[_0xccf1('0x13c')]]){this['actions'][_0x56e173[_0xccf1('0x13c')]][_0xccf1('0x131')]=!![];}}};module['exports']=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index b0c05bc..d58b48e 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 _0x6bf8=['UserId','active','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerleaveAt','answertime','queuecallercomplete','queuecallercompleteAt','endtime','membername','context','from-sip','exten','xcally-motion-preview','holdtime','assigned','COMPLETED','then','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','../../../config/logger','preview','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','createHistory','catch','[createHistory]\x20','resolve','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','createCustomerFinal','rescheduleContact'];(function(_0x1477ef,_0x54a5d6){var _0x164acd=function(_0x139149){while(--_0x139149){_0x1477ef['push'](_0x1477ef['shift']());}};_0x164acd(++_0x54a5d6);}(_0x6bf8,0x1aa));var _0x86bf=function(_0x5506fc,_0x23ef81){_0x5506fc=_0x5506fc-0x0;var _0x57804f=_0x6bf8[_0x5506fc];return _0x57804f;};'use strict';var util=require(_0x86bf('0x0'));var BPromise=require('bluebird');var logger=require(_0x86bf('0x1'))(_0x86bf('0x2'));var cmHopper=require(_0x86bf('0x3'));var cmHopperHistory=require(_0x86bf('0x4'));var cmHopperBlack=require('../rpc/cmHopperBlack');var agentReportPreview=require(_0x86bf('0x5'));var voiceQueueReport=require(_0x86bf('0x6'));function loggerCatch(_0x5be1a3){return function(_0x5845c0){logger[_0x86bf('0x7')](_0x5be1a3,util['inspect'](_0x5845c0,{'showHidden':![],'depth':null}));};}function create(_0x5a5484){return cmHopperHistory[_0x86bf('0x8')](_0x5a5484)[_0x86bf('0x9')](loggerCatch(_0x86bf('0xa')));}function createAgent(_0x557c0d){return BPromise[_0x86bf('0xb')]()['then'](agentReportPreview[_0x86bf('0x8')](_0x557c0d))[_0x86bf('0x9')](loggerCatch(_0x86bf('0xa')));}function moveContact(_0x30ee57){return cmHopper[_0x86bf('0xc')](_0x30ee57,!![])['catch'](loggerCatch(_0x86bf('0xd')));}exports[_0x86bf('0xe')]=function(_0x5e66da){return cmHopperBlack[_0x86bf('0xe')](_0x5e66da)['catch'](loggerCatch(_0x86bf('0xf')));};exports[_0x86bf('0x10')]=function(_0xe3f8){return BPromise[_0x86bf('0xb')]()['then'](cmHopper[_0x86bf('0x10')](_0xe3f8))[_0x86bf('0x9')](loggerCatch(_0x86bf('0x11')));};exports[_0x86bf('0x8')]=function(_0x5bbf82,_0x514466){create(_0x5bbf82)[_0x86bf('0x9')](loggerCatch(_0x514466));moveContact(_0x5bbf82)[_0x86bf('0x9')](loggerCatch(_0x514466));};exports[_0x86bf('0x12')]=function(_0x34e05a,_0x1faa43){createAgent(_0x34e05a)[_0x86bf('0x9')](loggerCatch(_0x1faa43));};exports[_0x86bf('0x13')]=function(_0x5a9de0,_0x55d65e){create(_0x5a9de0)[_0x86bf('0x9')](loggerCatch(_0x55d65e));};exports[_0x86bf('0x14')]=function(_0x3c617e,_0x474fe9){moveContact(_0x3c617e)[_0x86bf('0x9')](loggerCatch(_0x474fe9));};exports[_0x86bf('0x15')]=function(_0x328ca1,_0x2608ef,_0x5033f3){if(_0x2608ef){_0x328ca1[_0x86bf('0x16')]=null;}if(_0x5033f3){_0x328ca1[_0x86bf('0x17')]=![];}return cmHopper[_0x86bf('0x15')](_0x328ca1)[_0x86bf('0x9')](loggerCatch(_0x86bf('0x18')));};exports['countReScheduled']=function(_0xc54e41){return cmHopper[_0x86bf('0x19')](_0xc54e41)[_0x86bf('0x9')](loggerCatch(_0x86bf('0x1a')));};exports['unlockContact']=function(_0x4d2d71){return cmHopper[_0x86bf('0x1b')]({'UserId':null},_0x4d2d71,0x1)[_0x86bf('0x9')](loggerCatch(_0x86bf('0x1c')));};exports['disableContact']=function(_0x30258f){return cmHopper[_0x86bf('0x1b')]({'active':![]},_0x30258f,0x1)[_0x86bf('0x9')](loggerCatch(_0x86bf('0x1d')));};exports[_0x86bf('0x1e')]=function(_0x2f427d){var _0x54e0cd={};_0x54e0cd[_0x86bf('0x1f')]=_0x2f427d[_0x86bf('0x1f')];_0x54e0cd[_0x86bf('0x20')]=_0x2f427d[_0x86bf('0x20')];_0x54e0cd[_0x86bf('0x21')]=_0x2f427d['calleridnum'];_0x54e0cd[_0x86bf('0x22')]=_0x2f427d['calleridname'];_0x54e0cd[_0x86bf('0x23')]=_0x2f427d['queue'];_0x54e0cd['queuecallerjoinAt']=_0x2f427d['answertime'];_0x54e0cd[_0x86bf('0x24')]=_0x2f427d[_0x86bf('0x25')];_0x54e0cd[_0x86bf('0x26')]=0x1;_0x54e0cd[_0x86bf('0x27')]=_0x2f427d[_0x86bf('0x28')];_0x54e0cd['connectedlinename']=_0x2f427d[_0x86bf('0x29')];_0x54e0cd[_0x86bf('0x2a')]=_0x86bf('0x2b');_0x54e0cd[_0x86bf('0x2c')]=_0x86bf('0x2d');_0x54e0cd[_0x86bf('0x2e')]=0x0;_0x54e0cd[_0x86bf('0x2f')]=0x1;_0x54e0cd['lastAssignedTo']=_0x2f427d[_0x86bf('0x29')];_0x54e0cd['queuecallerexitreason']=_0x86bf('0x30');return BPromise[_0x86bf('0xb')]()[_0x86bf('0x31')](voiceQueueReport[_0x86bf('0x32')](_0x54e0cd))['catch'](loggerCatch(_0x86bf('0x33')));};exports[_0x86bf('0x34')]=function(_0x51e829,_0xde822c){return BPromise[_0x86bf('0xb')]()[_0x86bf('0x31')](cmHopper[_0x86bf('0x34')](_0x51e829,_0xde822c))[_0x86bf('0x9')](loggerCatch(_0x86bf('0x35')));};exports[_0x86bf('0x36')]=function(_0x290fe4){return cmHopper['rescheduleContact'](_0x290fe4,!![],!![])[_0x86bf('0x9')](loggerCatch(_0x86bf('0x37')));}; \ No newline at end of file +var _0x69f4=['connectedlinename','membername','context','from-sip','xcally-motion-preview','holdtime','assigned','queuecallerexitreason','COMPLETED','create','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','bluebird','preview','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','error','createHistory','catch','resolve','then','[createHistory]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerFinal','rescheduleContact','[rescheduleContact]\x20','countReScheduled','unlockContact','disableContact','[activeContact]\x20','crateCustomerReportQueue','uniqueid','calleridnum','calleridname','queue','answertime','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt'];(function(_0x200eb4,_0x4e4e3b){var _0x1f1f83=function(_0x2d4c64){while(--_0x2d4c64){_0x200eb4['push'](_0x200eb4['shift']());}};_0x1f1f83(++_0x4e4e3b);}(_0x69f4,0x1b4));var _0x469f=function(_0x527397,_0x53d5c0){_0x527397=_0x527397-0x0;var _0x3cc6b2=_0x69f4[_0x527397];return _0x3cc6b2;};'use strict';var util=require(_0x469f('0x0'));var BPromise=require(_0x469f('0x1'));var logger=require('../../../config/logger')(_0x469f('0x2'));var cmHopper=require(_0x469f('0x3'));var cmHopperHistory=require(_0x469f('0x4'));var cmHopperBlack=require(_0x469f('0x5'));var agentReportPreview=require('../rpc/agentReportPreview');var voiceQueueReport=require('../rpc/voiceQueueReport');function loggerCatch(_0x534f52){return function(_0x34d304){logger[_0x469f('0x6')](_0x534f52,util['inspect'](_0x34d304,{'showHidden':![],'depth':null}));};}function create(_0x39a2c3){return cmHopperHistory[_0x469f('0x7')](_0x39a2c3)[_0x469f('0x8')](loggerCatch('[createHistory]\x20'));}function createAgent(_0x32a738){return BPromise[_0x469f('0x9')]()[_0x469f('0xa')](agentReportPreview['createHistory'](_0x32a738))[_0x469f('0x8')](loggerCatch(_0x469f('0xb')));}function moveContact(_0x24ec6f){return cmHopper[_0x469f('0xc')](_0x24ec6f,!![])[_0x469f('0x8')](loggerCatch(_0x469f('0xd')));}exports[_0x469f('0xe')]=function(_0x2e38e5){return cmHopperBlack['checkIsBlackList'](_0x2e38e5)['catch'](loggerCatch('[checkIsBlackList]\x20'));};exports[_0x469f('0xf')]=function(_0x2e4ab4){return BPromise[_0x469f('0x9')]()['then'](cmHopper[_0x469f('0xf')](_0x2e4ab4))[_0x469f('0x8')](loggerCatch(_0x469f('0x10')));};exports[_0x469f('0x7')]=function(_0x31e80c,_0xba91c9){create(_0x31e80c)[_0x469f('0x8')](loggerCatch(_0xba91c9));moveContact(_0x31e80c)['catch'](loggerCatch(_0xba91c9));};exports[_0x469f('0x11')]=function(_0x48f916,_0x4d8d71){createAgent(_0x48f916)[_0x469f('0x8')](loggerCatch(_0x4d8d71));};exports['createCustomerHistory']=function(_0x11d5ac,_0x1437fc){create(_0x11d5ac)[_0x469f('0x8')](loggerCatch(_0x1437fc));};exports[_0x469f('0x12')]=function(_0x290065,_0x5353e4){moveContact(_0x290065)[_0x469f('0x8')](loggerCatch(_0x5353e4));};exports[_0x469f('0x13')]=function(_0x45d77f,_0x27e67f,_0x486ad5){if(_0x27e67f){_0x45d77f['UserId']=null;}if(_0x486ad5){_0x45d77f['active']=![];}return cmHopper['rescheduleContact'](_0x45d77f)[_0x469f('0x8')](loggerCatch(_0x469f('0x14')));};exports[_0x469f('0x15')]=function(_0x1e7605){return cmHopper[_0x469f('0x15')](_0x1e7605)[_0x469f('0x8')](loggerCatch('[countReScheduled]\x20'));};exports[_0x469f('0x16')]=function(_0x4cb0ca){return cmHopper[_0x469f('0x16')]({'UserId':null},_0x4cb0ca,0x1)['catch'](loggerCatch('[unlockContact]\x20'));};exports[_0x469f('0x17')]=function(_0x5e55ad){return cmHopper['unlockContact']({'active':![]},_0x5e55ad,0x1)[_0x469f('0x8')](loggerCatch(_0x469f('0x18')));};exports[_0x469f('0x19')]=function(_0x4caf6e){var _0x5055d6={};_0x5055d6['type']=_0x4caf6e['type'];_0x5055d6[_0x469f('0x1a')]=_0x4caf6e[_0x469f('0x1a')];_0x5055d6[_0x469f('0x1b')]=_0x4caf6e[_0x469f('0x1b')];_0x5055d6['calleridname']=_0x4caf6e[_0x469f('0x1c')];_0x5055d6[_0x469f('0x1d')]=_0x4caf6e[_0x469f('0x1d')];_0x5055d6['queuecallerjoinAt']=_0x4caf6e[_0x469f('0x1e')];_0x5055d6[_0x469f('0x1f')]=_0x4caf6e[_0x469f('0x1e')];_0x5055d6[_0x469f('0x20')]=0x1;_0x5055d6[_0x469f('0x21')]=_0x4caf6e['endtime'];_0x5055d6[_0x469f('0x22')]=_0x4caf6e[_0x469f('0x23')];_0x5055d6[_0x469f('0x24')]=_0x469f('0x25');_0x5055d6['exten']=_0x469f('0x26');_0x5055d6[_0x469f('0x27')]=0x0;_0x5055d6[_0x469f('0x28')]=0x1;_0x5055d6['lastAssignedTo']=_0x4caf6e[_0x469f('0x23')];_0x5055d6[_0x469f('0x29')]=_0x469f('0x2a');return BPromise['resolve']()[_0x469f('0xa')](voiceQueueReport[_0x469f('0x2b')](_0x5055d6))[_0x469f('0x8')](loggerCatch('[voiceQueueReport]\x20'));};exports['getContactRecallMe']=function(_0x36c7eb,_0x4443d5){return BPromise[_0x469f('0x9')]()[_0x469f('0xa')](cmHopper['getContactRecallMe'](_0x36c7eb,_0x4443d5))[_0x469f('0x8')](loggerCatch(_0x469f('0x2c')));};exports[_0x469f('0x2d')]=function(_0x25c245){return cmHopper[_0x469f('0x13')](_0x25c245,!![],!![])['catch'](loggerCatch(_0x469f('0x2e')));}; \ 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 65a2ea8..63896db 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 _0x4982=['countcongestionretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','Global','scheduledAt','scheduledat','add','minutes','ContactId','ListId','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','lastevent','queue','interface','motionChannel','voice','mandatoryDisposition','buildAcw','not_inuse','status','reachable','push','getDiff','milliseconds','diff','seconds','createBody','CampaignId','filterKey','idContact','type','campaigntype','dialAnswer','active','countbusyretry','countglobal','callbackat','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-listid','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-callerid','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqoslossbridged','getCallerIdRandom','\x5cw{0,','pow','replace','random','extractCalleridName','match','extractCalleridNumber','noanswer','keys','variables','forEach','toLowerCase','lodash','../../../../config/logger','preview','env','XCALLY_IP_AGI','127.0.0.1','../../dialer/utils','inspect','logger2','info','message','getCallerId','string','isEmpty','format','\x22%s\x22\x20<%s>','isUndefined','\x22\x22\x20<>','isActive','addVariables','Queue','name','calleridname','calleridnum','dialer','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','dialPreviewUrl','\x22agi://%s/square,%s\x22','dialQueueProject','NONE','originatecalleridname','xcally-motion-preview','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','hasOwnProperty','toLower','isNil','originated','error','[updateOriginated]\x20object\x20originated\x20is\x20negative','YYYY-MM-DD\x20HH:mm:ss','statedesc','starttime','responsetime','endtime','logAgent','state','ringtime','getSeconds','logLookAgent','membername','UserId','logCustomer','talktime','answertime','isFailure','Failure','RECALL','BOOKED','uniqueid','channelAgent','from-sip','timeout','totalGlobal'];(function(_0x45d55e,_0x2fede3){var _0x29812a=function(_0x3c6830){while(--_0x3c6830){_0x45d55e['push'](_0x45d55e['shift']());}};_0x29812a(++_0x2fede3);}(_0x4982,0x1eb));var _0x2498=function(_0x5b0409,_0x524350){_0x5b0409=_0x5b0409-0x0;var _0x175198=_0x4982[_0x5b0409];return _0x175198;};'use strict';var util=require('util');var _=require(_0x2498('0x0'));var moment=require('moment');var logger=require(_0x2498('0x1'))(_0x2498('0x2'));var ipAgi=process[_0x2498('0x3')][_0x2498('0x4')]||_0x2498('0x5');var utils=require(_0x2498('0x6'));exports['loggerCatch']=function(_0x27d7f6){return function(_0x5b0dbb){logger['error'](_0x27d7f6,util[_0x2498('0x7')](_0x5b0dbb,{'showHidden':![],'depth':null}));};};exports['logger']=function(_0x3cb28d,_0x3b0cfe){logger['info'](_0x3cb28d,util[_0x2498('0x7')](_0x3b0cfe,{'showHidden':![],'depth':null}));};exports['loggerError']=function(_0x2b0991,_0x3b3314){logger['error'](_0x2b0991,util[_0x2498('0x7')](_0x3b3314,{'showHidden':![],'depth':null}));};exports[_0x2498('0x8')]=function(_0x538721){return function(_0x186ad0){logger[_0x2498('0x9')](_0x538721,util[_0x2498('0x7')](_0x186ad0,{'showHidden':![],'depth':null}));};};exports[_0x2498('0xa')]=function(_0x4d7aaf,_0x18afa0,_0x5568f7){return{'message':_0x4d7aaf,'unlock':_0x18afa0,'active':_0x5568f7};};exports[_0x2498('0xb')]=function(_0x13fe5b,_0x569a68,_0x5825c6){if(!_['isUndefined'](_0x5825c6)&&_0x2498('0xc')===typeof _0x5825c6&&!_[_0x2498('0xd')](_0x5825c6)){if(!_['isUndefined'](_0x569a68)&&'string'===typeof _0x569a68&&!_[_0x2498('0xd')](_0x569a68)){return util[_0x2498('0xe')]('\x22%s\x22\x20<%s>',_0x569a68,_0x5825c6);}return util['format'](_0x2498('0xf'),_0x5825c6,_0x5825c6);}if(!_[_0x2498('0x10')](_0x13fe5b)&&_0x2498('0xc')===typeof _0x13fe5b&&!_[_0x2498('0xd')](_0x13fe5b)){return _0x13fe5b;}return _0x2498('0x11');};exports[_0x2498('0x12')]=function(_0x4131d9){if(_['isNil'](_0x4131d9)){return![];}return _0x4131d9;};exports[_0x2498('0x13')]=function(_0x5976fd,_0x5b0fb4,_0x3ce582,_0xdd7cac,_0x2ace3f,_0x14b6b1){var _0x53540f={'XMD-QUEUE':_0x5b0fb4[_0x2498('0x14')]?_0x5b0fb4['Queue'][_0x2498('0x15')]:'','XMD-CALLERID':_0xdd7cac,'XMD-CALLERID-PREVIEW':_0x14b6b1?util[_0x2498('0xe')](_0x2498('0xf'),_0x14b6b1[_0x2498('0x16')],_0x14b6b1[_0x2498('0x17')]):_0xdd7cac,'XMD-DIALID':_0x2ace3f,'XMD-CONTACTID':_0x5b0fb4['ContactId'],'XMD-CDRTYPE':_0x2498('0x18'),'CALLERID(all)':_0xdd7cac,'XMD-VOICEQUEUEID':_0x5b0fb4[_0x2498('0x19')],'XMD-DIALCHANNEL':_0x3ce582,'XMD-DIALTIMEOUT':_0x5976fd[_0x2498('0x1a')]||0x1e,'XMD-DIALOPTIONS':util['format'](_0x2498('0x1b'),_0x5976fd[_0x2498('0x1c')]?'g':'',_[_0x2498('0xd')](_0x5976fd[_0x2498('0x1d')])?'':'U(xcally-mixmonitor-context)'),'XMD-DIALURL':_0x5976fd[_0x2498('0x1e')]||'','XMD-AGI':_0x5976fd['dialQueueProject']?util[_0x2498('0xe')](_0x2498('0x1f'),ipAgi,_0x5976fd[_0x2498('0x20')]):_0x2498('0x21'),'XMD-AGIAFTER':_0x5976fd[_0x2498('0x1c')]?util['format']('\x22agi://%s/square,%s\x22',ipAgi,_0x5976fd[_0x2498('0x1c')]):_0x2498('0x21'),'XMD-ORIGINATECALLERIDNUM':_0x14b6b1?_0x14b6b1['originatecalleridnum']:'','XMD-ORIGINATECALLERIDNAME':_0x14b6b1?_0x14b6b1[_0x2498('0x22')]:'','XMD-DESTINATION':_0x2498('0x23'),'SIPADDHEADER':_0x2498('0x24')};if(!_[_0x2498('0xd')](_0x5976fd[_0x2498('0x1d')])){_0x53540f[util[_0x2498('0xe')]('%s',_0x2498('0x25'))]=_0x5976fd[_0x2498('0x1d')];_0x53540f[util['format']('%s',_0x2498('0x26'))]=_0x2ace3f;}return _0x53540f;};exports['toLowerVariables']=function(_0x5e7f5d){var _0x14d534={};for(var _0x4bf95f in _0x5e7f5d){if(_0x5e7f5d[_0x2498('0x27')](_0x4bf95f)){_0x14d534[util['format']('%s',_[_0x2498('0x28')](_0x4bf95f))]=_0x5e7f5d[_0x4bf95f];}}return{'variables':_0x14d534};};exports['updateOriginated']=function(_0x549386,_0x4050e8){if(!_[_0x2498('0x29')](_0x549386)){if(_0x549386['hasOwnProperty'](_0x2498('0x2a'))){if(_0x549386[_0x2498('0x2a')]>0x0){_0x549386[_0x2498('0x2a')]-=0x1;}else{logger[_0x2498('0x2b')](_0x2498('0x2c'),_0x4050e8);}}}else{logger[_0x2498('0x2b')]('[updateOriginated]\x20is\x20null\x20or\x20undefined',_0x4050e8);}};exports['logBlacklist']=function(_0x32df21){var _0x4347b4=moment()['format'](_0x2498('0x2d'));_0x32df21['state']=0xd;_0x32df21[_0x2498('0x2e')]='Blacklist';_0x32df21[_0x2498('0x2f')]=_0x4347b4;_0x32df21[_0x2498('0x30')]=_0x4347b4;_0x32df21[_0x2498('0x31')]=_0x4347b4;};exports[_0x2498('0x32')]=function(_0x3f60bb,_0x1ee614,_0x2c494f){var _0x2a1678=moment()[_0x2498('0xe')](_0x2498('0x2d'));_0x3f60bb[_0x2498('0x33')]=_0x1ee614;_0x3f60bb[_0x2498('0x2e')]=_0x2c494f;_0x3f60bb[_0x2498('0x30')]=_0x2a1678;_0x3f60bb[_0x2498('0x34')]=utils[_0x2498('0x35')](_0x3f60bb[_0x2498('0x30')],_0x3f60bb[_0x2498('0x2f')]);};exports[_0x2498('0x36')]=function(_0x10abbd,_0x3a81b2,_0x527aac){_0x10abbd[_0x2498('0x37')]=_0x3a81b2;_0x10abbd[_0x2498('0x38')]=_0x527aac;};exports[_0x2498('0x39')]=function(_0x211775,_0x34191c,_0x495401){var _0x46809f=moment()['format'](_0x2498('0x2d'));_0x211775['state']=_0x34191c;_0x211775[_0x2498('0x2e')]=_0x495401;_0x211775[_0x2498('0x30')]=_0x211775[_0x2498('0x30')]?_0x211775[_0x2498('0x30')]:_0x46809f;_0x211775[_0x2498('0x31')]=_0x211775['endtime']?_0x211775['endtime']:_0x46809f;_0x211775['ringtime']=utils[_0x2498('0x35')](_0x211775['responsetime']||0x0,_0x211775['starttime']||0x0);_0x211775[_0x2498('0x3a')]=_0x211775[_0x2498('0x3b')]?utils[_0x2498('0x35')](_0x211775[_0x2498('0x31')],_0x211775['answertime']):0x0;};exports[_0x2498('0x3c')]=function(_0xb88fdb){return _0xb88fdb===_0x2498('0x3d');};exports['variablesAction']=function(_0x56edef,_0x483bd8,_0x5ab777,_0x2af836,_0x593be8){var _0x680a76=_0x2af836?_0x2498('0x3e'):_0x56edef[_0x2498('0x16')];_0x680a76=_0x593be8?_0x2498('0x3f'):_0x680a76;return{'actionid':_0x56edef[_0x2498('0x40')],'action':'originate','channel':_0x56edef[_0x2498('0x41')],'callerid':util['format'](_0x2498('0xf'),_0x680a76,_0x56edef['calleridnum']),'Exten':_0x2498('0x23'),'Context':_0x2498('0x42'),'Priority':'1','variable':_0x5ab777,'timeout':(_0x483bd8[_0x2498('0x43')]||0x1e)*0x3e8,'async':!![],'channelid':_0x56edef[_0x2498('0x40')]};};exports[_0x2498('0x44')]=function(_0x5be1a3){return _0x5be1a3['countbusyretry']+_0x5be1a3[_0x2498('0x45')]+_0x5be1a3[_0x2498('0x46')]+_0x5be1a3[_0x2498('0x47')]+_0x5be1a3[_0x2498('0x48')];};exports['cloneAction']=function(_0x831f8e){var _0x45f5bd=_['clone'](_0x831f8e);_0x45f5bd['state']=0xf;_0x45f5bd[_0x2498('0x2e')]=_0x2498('0x49');return _0x45f5bd;};exports[_0x2498('0x4a')]=function(_0x18da39,_0x1ba2c7,_0x8e0072){var _0x514634={};_0x514634[_0x1ba2c7]=_0x18da39[_0x1ba2c7];_0x514634['active']=![];_0x514634[_0x2498('0x4b')]=moment()[_0x2498('0x4c')](_0x8e0072,_0x2498('0x4d'))['format'](_0x2498('0x2d'));_0x514634['ContactId']=_0x18da39[_0x2498('0x4e')];_0x514634[_0x2498('0x4f')]=_0x18da39['ListId'];_0x514634['VoiceQueueId']=_0x18da39['VoiceQueueId']||undefined;return _0x514634;};exports['decrementTalkink']=function(_0x34266e,_0x664eda){if(!_[_0x2498('0x29')](_0x34266e)){if(_0x34266e[_0x2498('0x50')]>0x0){_0x34266e['pTalking']-=0x1;}else{logger[_0x2498('0x2b')](_0x664eda,_0x2498('0x51'));}}else{logger[_0x2498('0x2b')](_0x664eda,_0x2498('0x52'));}};exports[_0x2498('0x53')]=function(_0x54d582){if(_0x54d582<=0x0){return!![];}return![];};function buildObj(_0x1cf6b9,_0x9c4939,_0x284e82){_0x1cf6b9[_0x2498('0x54')]=_0x9c4939;_0x1cf6b9['name']=_0x1cf6b9[_0x2498('0x55')];_0x1cf6b9[_0x2498('0x56')]=_0x1cf6b9[_0x2498('0x41')];_0x1cf6b9[_0x2498('0x57')]=_0x2498('0x58');if(_0x284e82){_0x1cf6b9[_0x2498('0x59')]=_0x284e82[_0x2498('0x59')];}return _0x1cf6b9;}exports['buildObj']=buildObj;exports[_0x2498('0x5a')]=function(_0x7224ad){var _0x1d08aa={};_0x1d08aa[_0x2498('0x55')]=_0x7224ad[_0x2498('0x55')];_0x1d08aa[_0x2498('0x56')]=_0x7224ad[_0x2498('0x41')];_0x1d08aa[_0x2498('0x40')]=_0x7224ad['uniqueid'];return _0x1d08aa;};exports['agentReadyId']=function(_0x1749d8){var _0x5801e2=[];for(var _0x22f7ec in _0x1749d8){if(_0x1749d8[_0x2498('0x27')](_0x22f7ec)){if(!_[_0x2498('0x29')](_0x1749d8[_0x22f7ec])&&_0x1749d8[_0x22f7ec][_0x2498('0x33')]===_0x2498('0x5b')&&_0x1749d8[_0x22f7ec][_0x2498('0x5c')]===_0x2498('0x5d')){_0x5801e2[_0x2498('0x5e')](_0x1749d8[_0x22f7ec]['id']);}}}return _0x5801e2;};exports[_0x2498('0x5f')]=function(_0x1996cb){var _0x3af675=moment()['milliseconds'](0x0);var _0x7b322a=moment(_0x1996cb)[_0x2498('0x60')](0x0);return _0x3af675[_0x2498('0x61')](_0x7b322a,_0x2498('0x62'));};exports[_0x2498('0x63')]=function(_0x53b970){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x53b970[_0x2498('0x4e')],'ListId':_0x53b970[_0x2498('0x4f')],'VoiceQueueId':_0x53b970['VoiceQueueId']||undefined,'CampaignId':_0x53b970[_0x2498('0x64')]||undefined};};exports[_0x2498('0x65')]=function(_0x53b7a8){if(_0x53b7a8===_0x2498('0x40')||_0x53b7a8===_0x2498('0x66')||_0x53b7a8===_0x2498('0x55')||_0x53b7a8===_0x2498('0x67')||_0x53b7a8===_0x2498('0x68')||_0x53b7a8===_0x2498('0x69')||_0x53b7a8===_0x2498('0x37')||_0x53b7a8==='channelAgent'||_0x53b7a8===_0x2498('0x16')||_0x53b7a8===_0x2498('0x6a')||_0x53b7a8===_0x2498('0x17')||_0x53b7a8===_0x2498('0x4b')||_0x53b7a8===_0x2498('0x6b')||_0x53b7a8===_0x2498('0x45')||_0x53b7a8==='countnoanswerretry'||_0x53b7a8===_0x2498('0x6c')||_0x53b7a8==='callback'||_0x53b7a8==='callbackuniqueid'||_0x53b7a8===_0x2498('0x6d')||_0x53b7a8==='recallme'||_0x53b7a8==='ContactId'||_0x53b7a8==='ListId'||_0x53b7a8===_0x2498('0x38')||_0x53b7a8==='VoiceQueueId'||_0x53b7a8==='sipcallid'||_0x53b7a8===_0x2498('0x6e')||_0x53b7a8===_0x2498('0x6f')||_0x53b7a8===_0x2498('0x70')||_0x53b7a8===_0x2498('0x71')||_0x53b7a8==='xmd-dialurl'||_0x53b7a8==='xmd-dialtimeout'||_0x53b7a8===_0x2498('0x72')||_0x53b7a8===_0x2498('0x73')||_0x53b7a8===_0x2498('0x74')||_0x53b7a8===_0x2498('0x75')||_0x53b7a8==='xmd-cdrtype'||_0x53b7a8===_0x2498('0x76')||_0x53b7a8==='xmd-agiafter'||_0x53b7a8==='xmd-agi'||_0x53b7a8===_0x2498('0x77')||_0x53b7a8===_0x2498('0x78')||_0x53b7a8===_0x2498('0x79')||_0x53b7a8===_0x2498('0x7a')||_0x53b7a8===_0x2498('0x7b')||_0x53b7a8==='rtpaudioqoslossbridged'||_0x53b7a8===_0x2498('0x7c')||_0x53b7a8===_0x2498('0x7d')||_0x53b7a8===_0x2498('0x77')||_0x53b7a8===_0x2498('0x78')||_0x53b7a8===_0x2498('0x79')||_0x53b7a8==='rtpaudioqosjitterbridged'||_0x53b7a8===_0x2498('0x7b')||_0x53b7a8===_0x2498('0x7e')||_0x53b7a8===_0x2498('0x7c')||_0x53b7a8===_0x2498('0x7d')||_0x53b7a8==='bridgepeer'||_0x53b7a8==='bridgepvtcallid'||_0x53b7a8===_0x2498('0x33')||_0x53b7a8===_0x2498('0x2e')){return![];}return!![];};exports[_0x2498('0x7f')]=function(_0x2dfad1,_0x217ff9){var _0x48a4d9,_0x178f65,_0x135b94;if(_0x217ff9<=0x0){_0x217ff9=0x1;}_0x48a4d9=new RegExp(_0x2498('0x80')+_0x217ff9+'}$');_0x178f65=Math[_0x2498('0x81')](0xa,_0x217ff9-0x1);_0x135b94=Math[_0x2498('0x81')](0xa,_0x217ff9)-0x1;return util['format']('%s',_[_0x2498('0x82')](_0x2dfad1,_0x48a4d9,_[_0x2498('0x83')](_0x178f65,_0x135b94)));};exports[_0x2498('0x84')]=function(_0x997649){var _0x394aa9=_0x997649[_0x2498('0x85')](/"(.*?)"/);return _0x394aa9?_0x394aa9[0x1]:_0x997649;};exports[_0x2498('0x86')]=function(_0x166ba4){var _0x196287=_0x166ba4[_0x2498('0x85')](/<(.*?)>/);return _0x196287?_0x196287[0x1]:_0x166ba4;};function buildNoAnswerEventPayload(_0x19ae7f,_0x3a6c41){var _0x2916a2=buildObj(_0x19ae7f,_0x2498('0x87'));if(!_[_0x2498('0xd')](_0x3a6c41['variables'])){Object[_0x2498('0x88')](_0x3a6c41[_0x2498('0x89')])[_0x2498('0x8a')](function(_0x4a383b){_0x2916a2[_0x4a383b[_0x2498('0x8b')]()]=_0x3a6c41[_0x2498('0x89')][_0x4a383b];});}return _0x2916a2;}exports['buildNoAnswerEventPayload']=buildNoAnswerEventPayload; \ No newline at end of file +var _0x8fd1=['dialer','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','\x22agi://%s/square,%s\x22','dialQueueProject','NONE','originatecalleridnum','originatecalleridname','xcally-motion-preview','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','toLower','hasOwnProperty','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','Blacklist','responsetime','endtime','logAgent','ringtime','logLookAgent','membername','UserId','getSeconds','starttime','answertime','Failure','RECALL','calleridname','originate','from-sip','timeout','uniqueid','countbusyretry','countnoanswerretry','countagentrejectretry','cloneAction','clone','Global','scheduledAt','active','scheduledat','ListId','VoiceQueueId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','IsNotLoggedIn','queue','motionChannel','mandatoryDisposition','buildObj','buildAcw','interface','channelAgent','agentReadyId','status','reachable','push','getDiff','milliseconds','diff','seconds','createBody','filterKey','idContact','type','campaigntype','dialAnswer','countglobal','callback','recallme','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialoptions','xmd-dialid','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosloss','rtpaudioqosrtt','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrttbridged','bridgepeer','bridgepvtcallid','getCallerIdRandom','random','extractCalleridName','match','keys','variables','toLowerCase','buildNoAnswerEventPayload','util','moment','preview','env','XCALLY_IP_AGI','127.0.0.1','../../dialer/utils','error','inspect','logger','logger2','message','getCallerId','isUndefined','string','\x22%s\x22\x20<%s>','format','isEmpty','\x22\x22\x20<>','isActive','isNil','addVariables','Queue','name','calleridnum','ContactId'];(function(_0x54881c,_0x4c58bb){var _0x39b6da=function(_0x1b8061){while(--_0x1b8061){_0x54881c['push'](_0x54881c['shift']());}};_0x39b6da(++_0x4c58bb);}(_0x8fd1,0xf4));var _0x18fd=function(_0x2a75cd,_0x247962){_0x2a75cd=_0x2a75cd-0x0;var _0x2319bc=_0x8fd1[_0x2a75cd];return _0x2319bc;};'use strict';var util=require(_0x18fd('0x0'));var _=require('lodash');var moment=require(_0x18fd('0x1'));var logger=require('../../../../config/logger')(_0x18fd('0x2'));var ipAgi=process[_0x18fd('0x3')][_0x18fd('0x4')]||_0x18fd('0x5');var utils=require(_0x18fd('0x6'));exports['loggerCatch']=function(_0x495cd6){return function(_0x45f72a){logger[_0x18fd('0x7')](_0x495cd6,util[_0x18fd('0x8')](_0x45f72a,{'showHidden':![],'depth':null}));};};exports[_0x18fd('0x9')]=function(_0x482c67,_0x1224b3){logger['info'](_0x482c67,util[_0x18fd('0x8')](_0x1224b3,{'showHidden':![],'depth':null}));};exports['loggerError']=function(_0x3442ef,_0x2afeb6){logger[_0x18fd('0x7')](_0x3442ef,util[_0x18fd('0x8')](_0x2afeb6,{'showHidden':![],'depth':null}));};exports[_0x18fd('0xa')]=function(_0xce30f0){return function(_0x51548a){logger['info'](_0xce30f0,util[_0x18fd('0x8')](_0x51548a,{'showHidden':![],'depth':null}));};};exports[_0x18fd('0xb')]=function(_0x5f45dc,_0x1308aa,_0x19ad31){return{'message':_0x5f45dc,'unlock':_0x1308aa,'active':_0x19ad31};};exports[_0x18fd('0xc')]=function(_0x1576bf,_0x982d60,_0x1fa775){if(!_[_0x18fd('0xd')](_0x1fa775)&&'string'===typeof _0x1fa775&&!_['isEmpty'](_0x1fa775)){if(!_[_0x18fd('0xd')](_0x982d60)&&_0x18fd('0xe')===typeof _0x982d60&&!_['isEmpty'](_0x982d60)){return util['format'](_0x18fd('0xf'),_0x982d60,_0x1fa775);}return util[_0x18fd('0x10')]('\x22%s\x22\x20<%s>',_0x1fa775,_0x1fa775);}if(!_[_0x18fd('0xd')](_0x1576bf)&&_0x18fd('0xe')===typeof _0x1576bf&&!_[_0x18fd('0x11')](_0x1576bf)){return _0x1576bf;}return _0x18fd('0x12');};exports[_0x18fd('0x13')]=function(_0x3a71d1){if(_[_0x18fd('0x14')](_0x3a71d1)){return![];}return _0x3a71d1;};exports[_0x18fd('0x15')]=function(_0x5eb2c3,_0x55779a,_0x49d0af,_0x3b16e1,_0x4e3736,_0x1a4378){var _0x3bc1ed={'XMD-QUEUE':_0x55779a[_0x18fd('0x16')]?_0x55779a[_0x18fd('0x16')][_0x18fd('0x17')]:'','XMD-CALLERID':_0x3b16e1,'XMD-CALLERID-PREVIEW':_0x1a4378?util[_0x18fd('0x10')](_0x18fd('0xf'),_0x1a4378['calleridname'],_0x1a4378[_0x18fd('0x18')]):_0x3b16e1,'XMD-DIALID':_0x4e3736,'XMD-CONTACTID':_0x55779a[_0x18fd('0x19')],'XMD-CDRTYPE':_0x18fd('0x1a'),'CALLERID(all)':_0x3b16e1,'XMD-VOICEQUEUEID':_0x55779a['VoiceQueueId'],'XMD-DIALCHANNEL':_0x49d0af,'XMD-DIALTIMEOUT':_0x5eb2c3['dialOriginateTimeout']||0x1e,'XMD-DIALOPTIONS':util['format'](_0x18fd('0x1b'),_0x5eb2c3[_0x18fd('0x1c')]?'g':'',_['isEmpty'](_0x5eb2c3[_0x18fd('0x1d')])?'':_0x18fd('0x1e')),'XMD-DIALURL':_0x5eb2c3[_0x18fd('0x1f')]||'','XMD-AGI':_0x5eb2c3['dialQueueProject']?util[_0x18fd('0x10')](_0x18fd('0x20'),ipAgi,_0x5eb2c3[_0x18fd('0x21')]):_0x18fd('0x22'),'XMD-AGIAFTER':_0x5eb2c3[_0x18fd('0x1c')]?util['format'](_0x18fd('0x20'),ipAgi,_0x5eb2c3[_0x18fd('0x1c')]):_0x18fd('0x22'),'XMD-ORIGINATECALLERIDNUM':_0x1a4378?_0x1a4378[_0x18fd('0x23')]:'','XMD-ORIGINATECALLERIDNAME':_0x1a4378?_0x1a4378[_0x18fd('0x24')]:'','XMD-DESTINATION':_0x18fd('0x25'),'SIPADDHEADER':'Call-Type:\x20PREVIEW'};if(!_['isEmpty'](_0x5eb2c3[_0x18fd('0x1d')])){_0x3bc1ed[util[_0x18fd('0x10')]('%s',_0x18fd('0x26'))]=_0x5eb2c3[_0x18fd('0x1d')];_0x3bc1ed[util['format']('%s',_0x18fd('0x27'))]=_0x4e3736;}return _0x3bc1ed;};exports['toLowerVariables']=function(_0x3c2709){var _0x3b2ccc={};for(var _0x785bfd in _0x3c2709){if(_0x3c2709['hasOwnProperty'](_0x785bfd)){_0x3b2ccc[util['format']('%s',_[_0x18fd('0x28')](_0x785bfd))]=_0x3c2709[_0x785bfd];}}return{'variables':_0x3b2ccc};};exports['updateOriginated']=function(_0x52ea24,_0x3306f3){if(!_[_0x18fd('0x14')](_0x52ea24)){if(_0x52ea24[_0x18fd('0x29')](_0x18fd('0x2a'))){if(_0x52ea24[_0x18fd('0x2a')]>0x0){_0x52ea24[_0x18fd('0x2a')]-=0x1;}else{logger[_0x18fd('0x7')](_0x18fd('0x2b'),_0x3306f3);}}}else{logger[_0x18fd('0x7')](_0x18fd('0x2c'),_0x3306f3);}};exports['logBlacklist']=function(_0x355eae){var _0x3bdee7=moment()[_0x18fd('0x10')](_0x18fd('0x2d'));_0x355eae[_0x18fd('0x2e')]=0xd;_0x355eae[_0x18fd('0x2f')]=_0x18fd('0x30');_0x355eae['starttime']=_0x3bdee7;_0x355eae[_0x18fd('0x31')]=_0x3bdee7;_0x355eae[_0x18fd('0x32')]=_0x3bdee7;};exports[_0x18fd('0x33')]=function(_0x3ffee0,_0x461984,_0x2157e7){var _0x33ac70=moment()['format'](_0x18fd('0x2d'));_0x3ffee0[_0x18fd('0x2e')]=_0x461984;_0x3ffee0[_0x18fd('0x2f')]=_0x2157e7;_0x3ffee0[_0x18fd('0x31')]=_0x33ac70;_0x3ffee0[_0x18fd('0x34')]=utils['getSeconds'](_0x3ffee0['responsetime'],_0x3ffee0['starttime']);};exports[_0x18fd('0x35')]=function(_0x137484,_0x56b4aa,_0x3a150b){_0x137484[_0x18fd('0x36')]=_0x56b4aa;_0x137484[_0x18fd('0x37')]=_0x3a150b;};exports['logCustomer']=function(_0x1370b5,_0x12d20d,_0x21da6a){var _0x12d6b7=moment()[_0x18fd('0x10')](_0x18fd('0x2d'));_0x1370b5[_0x18fd('0x2e')]=_0x12d20d;_0x1370b5[_0x18fd('0x2f')]=_0x21da6a;_0x1370b5[_0x18fd('0x31')]=_0x1370b5[_0x18fd('0x31')]?_0x1370b5[_0x18fd('0x31')]:_0x12d6b7;_0x1370b5[_0x18fd('0x32')]=_0x1370b5[_0x18fd('0x32')]?_0x1370b5['endtime']:_0x12d6b7;_0x1370b5['ringtime']=utils[_0x18fd('0x38')](_0x1370b5[_0x18fd('0x31')]||0x0,_0x1370b5[_0x18fd('0x39')]||0x0);_0x1370b5['talktime']=_0x1370b5['answertime']?utils['getSeconds'](_0x1370b5[_0x18fd('0x32')],_0x1370b5[_0x18fd('0x3a')]):0x0;};exports['isFailure']=function(_0x46eda2){return _0x46eda2===_0x18fd('0x3b');};exports['variablesAction']=function(_0x1509d9,_0x34cfd4,_0x579053,_0x350a98,_0x44cf86){var _0x4ac619=_0x350a98?_0x18fd('0x3c'):_0x1509d9[_0x18fd('0x3d')];_0x4ac619=_0x44cf86?'BOOKED':_0x4ac619;return{'actionid':_0x1509d9['uniqueid'],'action':_0x18fd('0x3e'),'channel':_0x1509d9['channelAgent'],'callerid':util['format'](_0x18fd('0xf'),_0x4ac619,_0x1509d9[_0x18fd('0x18')]),'Exten':'xcally-motion-preview','Context':_0x18fd('0x3f'),'Priority':'1','variable':_0x579053,'timeout':(_0x34cfd4[_0x18fd('0x40')]||0x1e)*0x3e8,'async':!![],'channelid':_0x1509d9[_0x18fd('0x41')]};};exports['totalGlobal']=function(_0xbdadb2){return _0xbdadb2[_0x18fd('0x42')]+_0xbdadb2['countcongestionretry']+_0xbdadb2[_0x18fd('0x43')]+_0xbdadb2[_0x18fd('0x44')]+_0xbdadb2['countnosuchnumberretry'];};exports[_0x18fd('0x45')]=function(_0x7ba65c){var _0x5437e7=_[_0x18fd('0x46')](_0x7ba65c);_0x5437e7[_0x18fd('0x2e')]=0xf;_0x5437e7[_0x18fd('0x2f')]=_0x18fd('0x47');return _0x5437e7;};exports[_0x18fd('0x48')]=function(_0xcb5536,_0xc9cf72,_0xf909e6){var _0x32b038={};_0x32b038[_0xc9cf72]=_0xcb5536[_0xc9cf72];_0x32b038[_0x18fd('0x49')]=![];_0x32b038[_0x18fd('0x4a')]=moment()['add'](_0xf909e6,'minutes')[_0x18fd('0x10')](_0x18fd('0x2d'));_0x32b038['ContactId']=_0xcb5536[_0x18fd('0x19')];_0x32b038['ListId']=_0xcb5536[_0x18fd('0x4b')];_0x32b038[_0x18fd('0x4c')]=_0xcb5536['VoiceQueueId']||undefined;return _0x32b038;};exports[_0x18fd('0x4d')]=function(_0x5df8d3,_0x329bd3){if(!_[_0x18fd('0x14')](_0x5df8d3)){if(_0x5df8d3[_0x18fd('0x4e')]>0x0){_0x5df8d3[_0x18fd('0x4e')]-=0x1;}else{logger['error'](_0x329bd3,_0x18fd('0x4f'));}}else{logger['error'](_0x329bd3,'[decrementTalkink]\x20is\x20null\x20or\x20undefined');}};exports[_0x18fd('0x50')]=function(_0x3e0991){if(_0x3e0991<=0x0){return!![];}return![];};function buildObj(_0x4734e2,_0x1b492c,_0x5c00c){_0x4734e2['lastevent']=_0x1b492c;_0x4734e2['name']=_0x4734e2[_0x18fd('0x51')];_0x4734e2['interface']=_0x4734e2['channelAgent'];_0x4734e2[_0x18fd('0x52')]='voice';if(_0x5c00c){_0x4734e2['mandatoryDisposition']=_0x5c00c[_0x18fd('0x53')];}return _0x4734e2;}exports[_0x18fd('0x54')]=buildObj;exports[_0x18fd('0x55')]=function(_0x4f6874){var _0x3e9e2c={};_0x3e9e2c[_0x18fd('0x51')]=_0x4f6874[_0x18fd('0x51')];_0x3e9e2c[_0x18fd('0x56')]=_0x4f6874[_0x18fd('0x57')];_0x3e9e2c[_0x18fd('0x41')]=_0x4f6874[_0x18fd('0x41')];return _0x3e9e2c;};exports[_0x18fd('0x58')]=function(_0x354f75){var _0x580250=[];for(var _0x12c913 in _0x354f75){if(_0x354f75['hasOwnProperty'](_0x12c913)){if(!_[_0x18fd('0x14')](_0x354f75[_0x12c913])&&_0x354f75[_0x12c913][_0x18fd('0x2e')]==='not_inuse'&&_0x354f75[_0x12c913][_0x18fd('0x59')]===_0x18fd('0x5a')){_0x580250[_0x18fd('0x5b')](_0x354f75[_0x12c913]['id']);}}}return _0x580250;};exports[_0x18fd('0x5c')]=function(_0x44220b){var _0x265eb4=moment()[_0x18fd('0x5d')](0x0);var _0x444684=moment(_0x44220b)['milliseconds'](0x0);return _0x265eb4[_0x18fd('0x5e')](_0x444684,_0x18fd('0x5f'));};exports[_0x18fd('0x60')]=function(_0x207023){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x207023[_0x18fd('0x19')],'ListId':_0x207023[_0x18fd('0x4b')],'VoiceQueueId':_0x207023[_0x18fd('0x4c')]||undefined,'CampaignId':_0x207023['CampaignId']||undefined};};exports[_0x18fd('0x61')]=function(_0x2dd247){if(_0x2dd247===_0x18fd('0x41')||_0x2dd247===_0x18fd('0x62')||_0x2dd247===_0x18fd('0x51')||_0x2dd247===_0x18fd('0x63')||_0x2dd247===_0x18fd('0x64')||_0x2dd247===_0x18fd('0x65')||_0x2dd247===_0x18fd('0x36')||_0x2dd247===_0x18fd('0x57')||_0x2dd247==='calleridname'||_0x2dd247===_0x18fd('0x49')||_0x2dd247==='calleridnum'||_0x2dd247===_0x18fd('0x4a')||_0x2dd247===_0x18fd('0x42')||_0x2dd247==='countcongestionretry'||_0x2dd247==='countnoanswerretry'||_0x2dd247===_0x18fd('0x66')||_0x2dd247===_0x18fd('0x67')||_0x2dd247==='callbackuniqueid'||_0x2dd247==='callbackat'||_0x2dd247===_0x18fd('0x68')||_0x2dd247===_0x18fd('0x19')||_0x2dd247===_0x18fd('0x4b')||_0x2dd247===_0x18fd('0x37')||_0x2dd247===_0x18fd('0x4c')||_0x2dd247===_0x18fd('0x69')||_0x2dd247===_0x18fd('0x6a')||_0x2dd247===_0x18fd('0x6b')||_0x2dd247===_0x18fd('0x6c')||_0x2dd247===_0x18fd('0x6d')||_0x2dd247===_0x18fd('0x6e')||_0x2dd247==='xmd-dialtimeout'||_0x2dd247===_0x18fd('0x6f')||_0x2dd247===_0x18fd('0x70')||_0x2dd247==='xmd-dialchannel'||_0x2dd247===_0x18fd('0x71')||_0x2dd247===_0x18fd('0x72')||_0x2dd247===_0x18fd('0x73')||_0x2dd247===_0x18fd('0x74')||_0x2dd247===_0x18fd('0x75')||_0x2dd247===_0x18fd('0x76')||_0x2dd247==='rtpaudioqosbridged'||_0x2dd247==='rtpaudioqosjitter'||_0x2dd247==='rtpaudioqosjitterbridged'||_0x2dd247===_0x18fd('0x77')||_0x2dd247==='rtpaudioqoslossbridged'||_0x2dd247===_0x18fd('0x78')||_0x2dd247==='rtpaudioqosrttbridged'||_0x2dd247===_0x18fd('0x76')||_0x2dd247==='rtpaudioqosbridged'||_0x2dd247===_0x18fd('0x79')||_0x2dd247===_0x18fd('0x7a')||_0x2dd247===_0x18fd('0x77')||_0x2dd247===_0x18fd('0x7b')||_0x2dd247===_0x18fd('0x78')||_0x2dd247===_0x18fd('0x7c')||_0x2dd247===_0x18fd('0x7d')||_0x2dd247===_0x18fd('0x7e')||_0x2dd247===_0x18fd('0x2e')||_0x2dd247===_0x18fd('0x2f')){return![];}return!![];};exports[_0x18fd('0x7f')]=function(_0x1877c5,_0x7d64ba){var _0x16cdc8,_0x378002,_0x479d53;if(_0x7d64ba<=0x0){_0x7d64ba=0x1;}_0x16cdc8=new RegExp('\x5cw{0,'+_0x7d64ba+'}$');_0x378002=Math['pow'](0xa,_0x7d64ba-0x1);_0x479d53=Math['pow'](0xa,_0x7d64ba)-0x1;return util[_0x18fd('0x10')]('%s',_['replace'](_0x1877c5,_0x16cdc8,_[_0x18fd('0x80')](_0x378002,_0x479d53)));};exports[_0x18fd('0x81')]=function(_0x24200f){var _0x4bef6e=_0x24200f[_0x18fd('0x82')](/"(.*?)"/);return _0x4bef6e?_0x4bef6e[0x1]:_0x24200f;};exports['extractCalleridNumber']=function(_0xdb81ba){var _0x1b5819=_0xdb81ba[_0x18fd('0x82')](/<(.*?)>/);return _0x1b5819?_0x1b5819[0x1]:_0xdb81ba;};function buildNoAnswerEventPayload(_0x3bf6ab,_0x57942d){var _0x1a3947=buildObj(_0x3bf6ab,'noanswer');if(!_[_0x18fd('0x11')](_0x57942d['variables'])){Object[_0x18fd('0x83')](_0x57942d[_0x18fd('0x84')])['forEach'](function(_0x12dd93){_0x1a3947[_0x12dd93[_0x18fd('0x85')]()]=_0x57942d[_0x18fd('0x84')][_0x12dd93];});}return _0x1a3947;}exports[_0x18fd('0x86')]=buildNoAnswerEventPayload; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index 07becb3..11bdf32 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 _0xaea6=['queuepause','voicequeuechannel','voicechannel','string','number','boolean','queueremove'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0xaea6,0x1ed));var _0x6aea=function(_0x1b5c2f,_0x4f1c37){_0x1b5c2f=_0x1b5c2f-0x0;var _0x375394=_0xaea6[_0x1b5c2f];return _0x375394;};'use strict';exports['queueadd']={'queue':{'type':'string','required':!![]},'interface':{'type':_0x6aea('0x0'),'required':!![]},'membername':{'type':'string','required':!![]},'penalty':{'type':_0x6aea('0x1'),'required':![]},'paused':{'type':_0x6aea('0x2'),'required':![]}};exports[_0x6aea('0x3')]={'queue':{'type':_0x6aea('0x0'),'required':!![]},'interface':{'type':_0x6aea('0x0'),'required':!![]}};exports[_0x6aea('0x4')]={'interface':{'type':_0x6aea('0x0'),'required':!![]},'paused':{'type':_0x6aea('0x2')},'reason':{'type':_0x6aea('0x0'),'required':![]}};exports['reload']={'module':{'type':'string','required':![]}};exports[_0x6aea('0x5')]={'uniqueid':{'type':'string','required':!![]}};exports[_0x6aea('0x6')]={'uniqueid':{'type':'string','required':!![]},'filename':{'type':_0x6aea('0x0')},'format':{'type':_0x6aea('0x0')},'mixmonitorid':{'type':_0x6aea('0x0')}};exports['voicequeuechannelhangup']={'uniqueid':{'type':'string','required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':_0x6aea('0x0'),'required':!![]},'exten':{'type':'string','required':!![]},'context':{'type':_0x6aea('0x0')}}; \ No newline at end of file +var _0xa723=['queueremove','queuepause','reload','voicechannel','voicequeuechannelhangup','queueadd','string','number','boolean'];(function(_0x35b96b,_0x14606c){var _0x4fe86d=function(_0xb7eb3c){while(--_0xb7eb3c){_0x35b96b['push'](_0x35b96b['shift']());}};_0x4fe86d(++_0x14606c);}(_0xa723,0xc2));var _0x3a72=function(_0x28fbe3,_0x4ac6f8){_0x28fbe3=_0x28fbe3-0x0;var _0x45db6a=_0xa723[_0x28fbe3];return _0x45db6a;};'use strict';exports[_0x3a72('0x0')]={'queue':{'type':_0x3a72('0x1'),'required':!![]},'interface':{'type':_0x3a72('0x1'),'required':!![]},'membername':{'type':_0x3a72('0x1'),'required':!![]},'penalty':{'type':_0x3a72('0x2'),'required':![]},'paused':{'type':_0x3a72('0x3'),'required':![]}};exports[_0x3a72('0x4')]={'queue':{'type':'string','required':!![]},'interface':{'type':_0x3a72('0x1'),'required':!![]}};exports[_0x3a72('0x5')]={'interface':{'type':_0x3a72('0x1'),'required':!![]},'paused':{'type':_0x3a72('0x3')},'reason':{'type':'string','required':![]}};exports[_0x3a72('0x6')]={'module':{'type':_0x3a72('0x1'),'required':![]}};exports['voicequeuechannel']={'uniqueid':{'type':_0x3a72('0x1'),'required':!![]}};exports[_0x3a72('0x7')]={'uniqueid':{'type':_0x3a72('0x1'),'required':!![]},'filename':{'type':'string'},'format':{'type':_0x3a72('0x1')},'mixmonitorid':{'type':_0x3a72('0x1')}};exports[_0x3a72('0x8')]={'uniqueid':{'type':_0x3a72('0x1'),'required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':'string','required':!![]},'exten':{'type':_0x3a72('0x1'),'required':!![]},'context':{'type':_0x3a72('0x1')}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index 43acbac..880087c 100644 --- a/server/services/ami/realtime/index.js +++ b/server/services/ami/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f66=['diff','seconds','disposition','ANSWERED','outbound','duration','billableseconds','initCampaigns','campaigns','dialQueueProject','SquareProject','voiceExtensions','initCampaignHopperHistory','initFaxAccounts','initVoiceQueues','exports','moment','../model/agent','../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../model/campaign','../model/zendeskAccount','../model/salesforceAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','telephones','trunks','voiceQueues','triggers','templates','channels','outboundChannels','settings','zendeskAccounts','salesforceAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','faxAccounts','mapKeys','hasOwnProperty','isNil','format','interface','total','answered','sumHoldTime','sumBillable','isEmpty','ivrAnswerCallsDay','unmanaged','abandoned','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','mergeFromDatabase','initAgents','agents','length','name','isUndefined','initTelephones','SIP/%s','initTriggers','initSalesforceAccounts','initFreshdeskAccounts','initDeskAccounts','initSugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','freshsalesAccounts','initVoiceQueueHopperHistory','initVoiceQueueReports','groupBy','queuecallerexit','queuecallerabandon','queuecallerleaveAt','queuecallerjoinAt','sumDuration','queuecallercompleteAt','queuecallerexitAt'];(function(_0x14b203,_0x25cbaf){var _0x389c71=function(_0x23b998){while(--_0x23b998){_0x14b203['push'](_0x14b203['shift']());}};_0x389c71(++_0x25cbaf);}(_0x5f66,0x1a0));var _0x65f6=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x5f66[_0x502c7d];return _0x30b7ed;};'use strict';var _=require('lodash');var moment=require(_0x65f6('0x0'));var util=require('util');var Agent=require(_0x65f6('0x1'));var Telephone=require(_0x65f6('0x2'));var Trunk=require(_0x65f6('0x3'));var VoiceQueue=require(_0x65f6('0x4'));var Trigger=require(_0x65f6('0x5'));var Template=require('../model/template');var Campaign=require(_0x65f6('0x6'));var VoiceExtension=require('../model/voiceExtension');var ZendeskAccount=require(_0x65f6('0x7'));var SalesforceAccount=require(_0x65f6('0x8'));var FreshdeskAccount=require('../model/freshdeskAccount');var SugarcrmAccount=require('../model/sugarcrmAccount');var ZohoAccount=require(_0x65f6('0x9'));var DeskAccount=require(_0x65f6('0xa'));var VtigerAccount=require(_0x65f6('0xb'));var ServicenowAccount=require(_0x65f6('0xc'));var Dynamics365Account=require(_0x65f6('0xd'));var FreshsalesAccount=require(_0x65f6('0xe'));var FaxAccount=require('../model/faxAccount');function Realtime(){this['agents']={};this[_0x65f6('0xf')]={};this[_0x65f6('0x10')]={};this[_0x65f6('0x11')]={};this[_0x65f6('0x12')]={};this['campaigns']={};this[_0x65f6('0x13')]={};this['outbound']={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this[_0x65f6('0x14')]={};this['queueChannels']={};this[_0x65f6('0x15')]={};this['timers']={};this[_0x65f6('0x16')]={};this[_0x65f6('0x17')]={};this[_0x65f6('0x18')]={};this[_0x65f6('0x19')]={};this[_0x65f6('0x1a')]={};this[_0x65f6('0x1b')]={};this[_0x65f6('0x1c')]={};this[_0x65f6('0x1d')]={};this[_0x65f6('0x1e')]={};this[_0x65f6('0x1f')]={};this['freshsalesAccounts']={};this[_0x65f6('0x20')]={};}function freeIsNotKey(_0x49a913,_0x5dd324,_0x1693e6){var _0x5c69f8=_[_0x65f6('0x21')](_0x49a913,function(_0x1c955c){return _0x1c955c[_0x1693e6];});for(var _0x1b1cbb in _0x5dd324){if(_0x5dd324[_0x65f6('0x22')](_0x1b1cbb)){if(!_0x5c69f8[_0x1b1cbb]){delete _0x5dd324[_0x1b1cbb];}}}}function freeIsNotKeySip(_0xc8660c,_0x18380e){var _0x495dd6=_['mapKeys'](_0xc8660c,function(_0x2d538c){return util['format']('SIP/%s',_0x2d538c['name']);});for(var _0x365159 in _0x18380e){if(_0x18380e[_0x65f6('0x22')](_0x365159)){if(!_0x495dd6[_0x365159]){delete _0x18380e[_0x365159];}}}}function freeIsNotKeyAgent(_0x5114a4,_0x39e19f){var _0x270893=_[_0x65f6('0x21')](_0x5114a4,function(_0x3876ed){var _0x219ab2=_[_0x65f6('0x23')](_0x3876ed['interface'])?util[_0x65f6('0x24')]('SIP/%s',_0x3876ed['name']):_0x3876ed[_0x65f6('0x25')];return _0x219ab2;});for(var _0xd173f4 in _0x39e19f){if(_0x39e19f['hasOwnProperty'](_0xd173f4)){if(!_0x270893[_0xd173f4]){delete _0x39e19f[_0xd173f4];}}}}function clearVoiceCallReports(_0x1eeaaa){_0x1eeaaa[_0x65f6('0x26')]=0x0;_0x1eeaaa[_0x65f6('0x27')]=0x0;_0x1eeaaa[_0x65f6('0x28')]=0x0;_0x1eeaaa['sumDuration']=0x0;_0x1eeaaa[_0x65f6('0x29')]=0x0;}function clearCampaigns(_0x59ea32){if(!_[_0x65f6('0x2a')](_0x59ea32)){for(var _0x5963e0 in _0x59ea32){if(_0x59ea32['hasOwnProperty'](_0x5963e0)){_0x59ea32[_0x5963e0]['ivrTotalCallsDays']=0x0;_0x59ea32[_0x5963e0][_0x65f6('0x2b')]=0x0;}}}}function clearVoiceQueues(_0x16cde8){if(!_['isEmpty'](_0x16cde8)){for(var _0x296cd9 in _0x16cde8){if(_0x16cde8[_0x65f6('0x22')](_0x296cd9)){_0x16cde8[_0x296cd9]['total']=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x27')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x2c')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x2d')]=0x0;_0x16cde8[_0x296cd9]['sumHoldTime']=0x0;_0x16cde8[_0x296cd9]['sumDuration']=0x0;_0x16cde8[_0x296cd9]['sumBillable']=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x2e')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x2f')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x30')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x31')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x32')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x33')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x34')]=0x0;_0x16cde8[_0x296cd9]['outboundDropCallsDayCallersExit']=0x0;_0x16cde8[_0x296cd9]['outboundBlacklistCallsDay']=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x35')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x36')]=0x0;_0x16cde8[_0x296cd9]['outboundReCallsDay']=0x0;_0x16cde8[_0x296cd9]['outboundAnswerAgiCallsDay']=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x37')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x38')]=!![];}}}}Realtime[_0x65f6('0x39')][_0x65f6('0x3a')]=function(_0x1217fd,_0x2d32be){for(var _0x5792a0 in _0x2d32be){if(_0x1217fd[_0x65f6('0x22')](_0x5792a0)){_0x1217fd[_0x5792a0]=_0x2d32be[_0x5792a0];}}};Realtime[_0x65f6('0x39')][_0x65f6('0x3b')]=function(){var _0x4bc037=this;return function(_0x217f35){if(_0x217f35){freeIsNotKeyAgent(_0x217f35,_0x4bc037[_0x65f6('0x3c')]);for(var _0xbaed3c=0x0,_0x45510a={};_0xbaed3c<_0x217f35[_0x65f6('0x3d')];_0xbaed3c+=0x1){_0x45510a=_0x217f35[_0xbaed3c];var _0x2f054c=_['isNil'](_0x45510a[_0x65f6('0x25')])?util[_0x65f6('0x24')]('SIP/%s',_0x45510a[_0x65f6('0x3e')]):_0x45510a['interface'];if(_[_0x65f6('0x3f')](_0x4bc037['agents'][_0x2f054c])){_0x4bc037[_0x65f6('0x3c')][_0x2f054c]=new Agent(_0x45510a);}else{_0x4bc037[_0x65f6('0x3a')](_0x4bc037['agents'][_0x2f054c],_0x45510a);}}}return _0x4bc037[_0x65f6('0x3c')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x40')]=function(){var _0x515648=this;return function(_0x582c7e){if(_0x582c7e){freeIsNotKeySip(_0x582c7e,_0x515648[_0x65f6('0xf')]);for(var _0x4c0df4=0x0,_0x26de30={};_0x4c0df4<_0x582c7e['length'];_0x4c0df4+=0x1){_0x26de30=_0x582c7e[_0x4c0df4];if(_[_0x65f6('0x3f')](_0x515648[_0x65f6('0xf')][util['format'](_0x65f6('0x41'),_0x26de30['name'])])){_0x515648['telephones'][util[_0x65f6('0x24')](_0x65f6('0x41'),_0x26de30[_0x65f6('0x3e')])]=new Telephone(_0x26de30);}else{_0x515648[_0x65f6('0x3a')](_0x515648[_0x65f6('0xf')][util[_0x65f6('0x24')](_0x65f6('0x41'),_0x26de30[_0x65f6('0x3e')])],_0x26de30);}}}return _0x515648['telephones'];};};Realtime[_0x65f6('0x39')]['initTrunks']=function(){var _0x12a589=this;return function(_0xa4394a){if(_0xa4394a){freeIsNotKeySip(_0xa4394a,_0x12a589[_0x65f6('0x10')]);for(var _0x2ea7f7=0x0,_0x5ef5c2={};_0x2ea7f7<_0xa4394a[_0x65f6('0x3d')];_0x2ea7f7+=0x1){_0x5ef5c2=_0xa4394a[_0x2ea7f7];if(_[_0x65f6('0x3f')](_0x12a589[_0x65f6('0x10')][util[_0x65f6('0x24')](_0x65f6('0x41'),_0x5ef5c2[_0x65f6('0x3e')])])){_0x12a589[_0x65f6('0x10')][util[_0x65f6('0x24')](_0x65f6('0x41'),_0x5ef5c2['name'])]=new Trunk(_0x5ef5c2);}else{_0x12a589[_0x65f6('0x3a')](_0x12a589[_0x65f6('0x10')][util[_0x65f6('0x24')](_0x65f6('0x41'),_0x5ef5c2[_0x65f6('0x3e')])],_0x5ef5c2);}}}return _0x12a589[_0x65f6('0x10')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x42')]=function(){var _0x461393=this;return function(_0x2abbed){if(_0x2abbed){freeIsNotKey(_0x2abbed,_0x461393[_0x65f6('0x12')],'id');for(var _0x2c008a=0x0,_0x6c4d94={};_0x2c008a<_0x2abbed[_0x65f6('0x3d')];_0x2c008a+=0x1){_0x6c4d94=_0x2abbed[_0x2c008a];if(_[_0x65f6('0x3f')](_0x461393[_0x65f6('0x12')][_0x6c4d94['id']])){_0x461393['triggers'][_0x6c4d94['id']]=new Trigger(_0x6c4d94);}else{_0x461393[_0x65f6('0x3a')](_0x461393[_0x65f6('0x12')][_0x6c4d94['id']],_0x6c4d94);}}}return _0x461393[_0x65f6('0x12')];};};Realtime[_0x65f6('0x39')]['initTemplates']=function(){var _0x1bf5bf=this;return function(_0x2d0dac){if(_0x2d0dac){freeIsNotKey(_0x2d0dac,_0x1bf5bf[_0x65f6('0x13')],'id');for(var _0x5e69b4=0x0,_0x2dbab3={};_0x5e69b4<_0x2d0dac[_0x65f6('0x3d')];_0x5e69b4+=0x1){_0x2dbab3=_0x2d0dac[_0x5e69b4];if(_[_0x65f6('0x3f')](_0x1bf5bf[_0x65f6('0x13')][_0x2dbab3['id']])){_0x1bf5bf['templates'][_0x2dbab3['id']]=new Template(_0x2dbab3);}else{_0x1bf5bf[_0x65f6('0x3a')](_0x1bf5bf['templates'][_0x2dbab3['id']],_0x2dbab3);}}}return _0x1bf5bf[_0x65f6('0x13')];};};Realtime[_0x65f6('0x39')]['initZendeskAccounts']=function(){var _0xf754ee=this;return function(_0x5085db){if(_0x5085db){freeIsNotKey(_0x5085db,_0xf754ee[_0x65f6('0x17')],'id');for(var _0x4d9b76=0x0,_0x2d1706={};_0x4d9b76<_0x5085db[_0x65f6('0x3d')];_0x4d9b76+=0x1){_0x2d1706=_0x5085db[_0x4d9b76];if(_[_0x65f6('0x3f')](_0xf754ee[_0x65f6('0x17')][_0x2d1706['id']])){_0xf754ee['zendeskAccounts'][_0x2d1706['id']]=new ZendeskAccount(_0x2d1706);}else{_0xf754ee['mergeFromDatabase'](_0xf754ee[_0x65f6('0x17')][_0x2d1706['id']],_0x2d1706);}}}return _0xf754ee[_0x65f6('0x17')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x43')]=function(){var _0x3b907c=this;return function(_0x2d6ab9){if(_0x2d6ab9){freeIsNotKey(_0x2d6ab9,_0x3b907c[_0x65f6('0x18')],'id');for(var _0x41690c=0x0,_0x414f49={};_0x41690c<_0x2d6ab9['length'];_0x41690c+=0x1){_0x414f49=_0x2d6ab9[_0x41690c];if(_[_0x65f6('0x3f')](_0x3b907c[_0x65f6('0x18')][_0x414f49['id']])){_0x3b907c[_0x65f6('0x18')][_0x414f49['id']]=new SalesforceAccount(_0x414f49);}else{_0x3b907c['mergeFromDatabase'](_0x3b907c[_0x65f6('0x18')][_0x414f49['id']],_0x414f49);}}}return _0x3b907c[_0x65f6('0x18')];};};Realtime['prototype'][_0x65f6('0x44')]=function(){var _0x253d52=this;return function(_0x57eb04){if(_0x57eb04){freeIsNotKey(_0x57eb04,_0x253d52[_0x65f6('0x1a')],'id');for(var _0x4f96c4=0x0,_0x247be3={};_0x4f96c4<_0x57eb04[_0x65f6('0x3d')];_0x4f96c4+=0x1){_0x247be3=_0x57eb04[_0x4f96c4];if(_[_0x65f6('0x3f')](_0x253d52['freshdeskAccounts'][_0x247be3['id']])){_0x253d52[_0x65f6('0x1a')][_0x247be3['id']]=new FreshdeskAccount(_0x247be3);}else{_0x253d52[_0x65f6('0x3a')](_0x253d52['freshdeskAccounts'][_0x247be3['id']],_0x247be3);}}}return _0x253d52[_0x65f6('0x1a')];};};Realtime[_0x65f6('0x39')]['initZohoAccounts']=function(){var _0x34d6a9=this;return function(_0x344c0e){if(_0x344c0e){freeIsNotKey(_0x344c0e,_0x34d6a9[_0x65f6('0x1b')],'id');for(var _0x25d504=0x0,_0x234fa7={};_0x25d504<_0x344c0e[_0x65f6('0x3d')];_0x25d504+=0x1){_0x234fa7=_0x344c0e[_0x25d504];if(_[_0x65f6('0x3f')](_0x34d6a9[_0x65f6('0x1b')][_0x234fa7['id']])){_0x34d6a9['zohoAccounts'][_0x234fa7['id']]=new ZohoAccount(_0x234fa7);}else{_0x34d6a9['mergeFromDatabase'](_0x34d6a9['zohoAccounts'][_0x234fa7['id']],_0x234fa7);}}}return _0x34d6a9[_0x65f6('0x1b')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x45')]=function(){var _0x20c322=this;return function(_0x545445){if(_0x545445){freeIsNotKey(_0x545445,_0x20c322[_0x65f6('0x1c')],'id');for(var _0x2032b9=0x0,_0x9ff849={};_0x2032b9<_0x545445['length'];_0x2032b9+=0x1){_0x9ff849=_0x545445[_0x2032b9];if(_[_0x65f6('0x3f')](_0x20c322[_0x65f6('0x1c')][_0x9ff849['id']])){_0x20c322[_0x65f6('0x1c')][_0x9ff849['id']]=new DeskAccount(_0x9ff849);}else{_0x20c322['mergeFromDatabase'](_0x20c322['deskAccounts'][_0x9ff849['id']],_0x9ff849);}}}return _0x20c322[_0x65f6('0x1c')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x46')]=function(){var _0x39364f=this;return function(_0x2a76b3){if(_0x2a76b3){freeIsNotKey(_0x2a76b3,_0x39364f[_0x65f6('0x19')],'id');for(var _0x35d77f=0x0,_0x138334={};_0x35d77f<_0x2a76b3[_0x65f6('0x3d')];_0x35d77f+=0x1){_0x138334=_0x2a76b3[_0x35d77f];if(_[_0x65f6('0x3f')](_0x39364f[_0x65f6('0x19')][_0x138334['id']])){_0x39364f[_0x65f6('0x19')][_0x138334['id']]=new SugarcrmAccount(_0x138334);}else{_0x39364f[_0x65f6('0x3a')](_0x39364f[_0x65f6('0x19')][_0x138334['id']],_0x138334);}}}return _0x39364f['sugarcrmAccounts'];};};Realtime[_0x65f6('0x39')][_0x65f6('0x47')]=function(){var _0x42a805=this;return function(_0x4b4efe){if(_0x4b4efe){freeIsNotKey(_0x4b4efe,_0x42a805[_0x65f6('0x1d')],'id');for(var _0x16dec0=0x0,_0x4638c9={};_0x16dec0<_0x4b4efe[_0x65f6('0x3d')];_0x16dec0+=0x1){_0x4638c9=_0x4b4efe[_0x16dec0];if(_['isUndefined'](_0x42a805[_0x65f6('0x1d')][_0x4638c9['id']])){_0x42a805[_0x65f6('0x1d')][_0x4638c9['id']]=new VtigerAccount(_0x4638c9);}else{_0x42a805[_0x65f6('0x3a')](_0x42a805[_0x65f6('0x1d')][_0x4638c9['id']],_0x4638c9);}}}return _0x42a805['vtigerAccounts'];};};Realtime[_0x65f6('0x39')][_0x65f6('0x48')]=function(){var _0x5c55e4=this;return function(_0x28682b){if(_0x28682b){freeIsNotKey(_0x28682b,_0x5c55e4[_0x65f6('0x1e')],'id');for(var _0x36c316=0x0,_0x51549d={};_0x36c316<_0x28682b[_0x65f6('0x3d')];_0x36c316+=0x1){_0x51549d=_0x28682b[_0x36c316];if(_[_0x65f6('0x3f')](_0x5c55e4[_0x65f6('0x1e')][_0x51549d['id']])){_0x5c55e4[_0x65f6('0x1e')][_0x51549d['id']]=new ServicenowAccount(_0x51549d);}else{_0x5c55e4[_0x65f6('0x3a')](_0x5c55e4[_0x65f6('0x1e')][_0x51549d['id']],_0x51549d);}}}return _0x5c55e4['servicenowAccounts'];};};Realtime['prototype']['initDynamics365Accounts']=function(){var _0x336a7d=this;return function(_0x367d95){if(_0x367d95){freeIsNotKey(_0x367d95,_0x336a7d[_0x65f6('0x1f')],'id');for(var _0x471bec=0x0,_0xab6f0={};_0x471bec<_0x367d95[_0x65f6('0x3d')];_0x471bec+=0x1){_0xab6f0=_0x367d95[_0x471bec];if(_['isUndefined'](_0x336a7d[_0x65f6('0x1f')][_0xab6f0['id']])){_0x336a7d[_0x65f6('0x1f')][_0xab6f0['id']]=new Dynamics365Account(_0xab6f0);}else{_0x336a7d['mergeFromDatabase'](_0x336a7d[_0x65f6('0x1f')][_0xab6f0['id']],_0xab6f0);}}}return _0x336a7d[_0x65f6('0x1f')];};};Realtime[_0x65f6('0x39')]['initFreshsalesAccounts']=function(){var _0x23c441=this;return function(_0x448c9a){if(_0x448c9a){freeIsNotKey(_0x448c9a,_0x23c441['freshsalesAccounts'],'id');for(var _0x271d76=0x0,_0x3edc6b={};_0x271d76<_0x448c9a[_0x65f6('0x3d')];_0x271d76+=0x1){_0x3edc6b=_0x448c9a[_0x271d76];if(_[_0x65f6('0x3f')](_0x23c441[_0x65f6('0x49')][_0x3edc6b['id']])){_0x23c441[_0x65f6('0x49')][_0x3edc6b['id']]=new FreshsalesAccount(_0x3edc6b);}else{_0x23c441[_0x65f6('0x3a')](_0x23c441['freshsalesAccounts'][_0x3edc6b['id']],_0x3edc6b);}}}return _0x23c441['freshsalesAccounts'];};};Realtime[_0x65f6('0x39')][_0x65f6('0x4a')]=function(){var _0x4a9524=this;return function(_0x417ba5){for(var _0x5f3df9=0x0;_0x5f3df9<_0x417ba5[_0x65f6('0x3d')];_0x5f3df9+=0x1){_['merge'](_0x4a9524[_0x65f6('0x11')][_0x417ba5[_0x5f3df9][_0x65f6('0x3e')]],_0x417ba5[_0x5f3df9]);}return _0x4a9524[_0x65f6('0x11')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x4b')]=function(){var _0x264e6c=this;return function(_0x1aaf75){clearVoiceQueues(_0x264e6c[_0x65f6('0x11')]);if(_0x1aaf75){_0x1aaf75=_[_0x65f6('0x4c')](_0x1aaf75,'uniqueid');for(var _0x480190 in _0x1aaf75){if(_0x1aaf75[_0x65f6('0x22')](_0x480190)){for(var _0x13ee4b=0x0;_0x13ee4b<_0x1aaf75[_0x480190][_0x65f6('0x3d')];_0x13ee4b+=0x1){var _0x51497f=_0x1aaf75[_0x480190][_0x13ee4b]['queue'];if(_0x264e6c[_0x65f6('0x11')][_0x51497f]){if(_0x1aaf75[_0x480190][_0x13ee4b][_0x65f6('0x4d')]){_0x264e6c[_0x65f6('0x11')][_0x51497f][_0x65f6('0x2c')]+=0x1;}if(_0x1aaf75[_0x480190][_0x13ee4b][_0x65f6('0x4e')]){_0x264e6c[_0x65f6('0x11')][_0x51497f]['abandoned']+=0x1;}_0x264e6c['voiceQueues'][_0x51497f][_0x65f6('0x28')]+=moment(_0x1aaf75[_0x480190][_0x13ee4b][_0x65f6('0x4f')])['diff'](moment(_0x1aaf75[_0x480190][_0x13ee4b][_0x65f6('0x50')]),'seconds')||0x0;if(_0x13ee4b===_0x1aaf75[_0x480190][_0x65f6('0x3d')]-0x1){_0x264e6c[_0x65f6('0x11')][_0x51497f][_0x65f6('0x51')]+=moment(_0x1aaf75[_0x480190][_0x13ee4b][_0x65f6('0x52')]||_0x1aaf75[_0x480190][_0x13ee4b]['queuecallerabandonAt']||_0x1aaf75[_0x480190][_0x13ee4b][_0x65f6('0x53')])[_0x65f6('0x54')](moment(_0x1aaf75[_0x480190][_0x13ee4b][_0x65f6('0x50')]),'seconds')||0x0;_0x264e6c['voiceQueues'][_0x51497f][_0x65f6('0x26')]+=0x1;if(_0x1aaf75[_0x480190][_0x13ee4b]['queuecallercomplete']){_0x264e6c[_0x65f6('0x11')][_0x51497f][_0x65f6('0x27')]+=0x1;_0x264e6c[_0x65f6('0x11')][_0x51497f][_0x65f6('0x29')]+=moment(_0x1aaf75[_0x480190][_0x13ee4b]['queuecallercompleteAt'])['diff'](moment(_0x1aaf75[_0x480190][_0x13ee4b]['queuecallerleaveAt']),_0x65f6('0x55'))||0x0;}}else{_0x264e6c[_0x65f6('0x11')][_0x51497f][_0x65f6('0x51')]+=_0x264e6c['voiceQueues'][_0x51497f][_0x65f6('0x28')]||0x0;}}}}}}return _0x264e6c[_0x65f6('0x11')];};};Realtime[_0x65f6('0x39')]['initVoiceCallReports']=function(){var _0x40d0f7=this;return function(_0x15809e){clearVoiceCallReports(_0x40d0f7['outbound']);if(_0x15809e){for(var _0x758e80=0x0;_0x758e80<_0x15809e[_0x65f6('0x3d')];_0x758e80+=0x1){_0x40d0f7['outbound'][_0x65f6('0x26')]+=0x1;_0x40d0f7['outbound'][_0x65f6('0x51')]+=_0x15809e[_0x758e80]['duration'];if(_0x15809e[_0x758e80][_0x65f6('0x56')]===_0x65f6('0x57')){_0x40d0f7['outbound'][_0x65f6('0x27')]+=0x1;_0x40d0f7[_0x65f6('0x58')][_0x65f6('0x28')]+=_0x15809e[_0x758e80][_0x65f6('0x59')]-_0x15809e[_0x758e80][_0x65f6('0x5a')]||0x0;_0x40d0f7[_0x65f6('0x58')][_0x65f6('0x29')]+=_0x15809e[_0x758e80][_0x65f6('0x5a')];}}}return _0x40d0f7[_0x65f6('0x58')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x5b')]=function(){var _0x574d84=this;return function(_0x10a661){if(_0x10a661){freeIsNotKey(_0x10a661,_0x574d84[_0x65f6('0x5c')],_0x65f6('0x3e'));for(var _0x219e42=0x0,_0x5694f9={};_0x219e42<_0x10a661[_0x65f6('0x3d')];_0x219e42+=0x1){_0x5694f9=_0x10a661[_0x219e42];if(_[_0x65f6('0x3f')](_0x574d84['campaigns'][_0x5694f9[_0x65f6('0x3e')]])){_0x574d84['campaigns'][_0x5694f9[_0x65f6('0x3e')]]=new Campaign(_0x5694f9);}else{_0x574d84['mergeFromDatabase'](_0x574d84[_0x65f6('0x5c')][_0x5694f9[_0x65f6('0x3e')]],_0x5694f9);_0x574d84['campaigns'][_0x5694f9['name']][_0x65f6('0x5d')]=_0x5694f9[_0x65f6('0x5e')]?_0x5694f9['SquareProject'][_0x65f6('0x3e')]:undefined;}}}return _0x574d84[_0x65f6('0x5c')];};};Realtime[_0x65f6('0x39')]['initVoiceExtensions']=function(){var _0x1348ec=this;return function(_0x246510){if(_0x246510){freeIsNotKey(_0x246510,_0x1348ec['voiceExtensions'],'id');for(var _0x36b8de=0x0,_0x504b39={};_0x36b8de<_0x246510[_0x65f6('0x3d')];_0x36b8de+=0x1){_0x504b39=_0x246510[_0x36b8de];if(_['isUndefined'](_0x1348ec['voiceExtensions'][_0x504b39['id']])){_0x1348ec[_0x65f6('0x5f')][_0x504b39['id']]=new VoiceExtension(_0x504b39);}else{_0x1348ec[_0x65f6('0x3a')](_0x1348ec[_0x65f6('0x5f')][_0x504b39['id']],_0x504b39);}}}return _0x1348ec[_0x65f6('0x5f')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x60')]=function(){var _0x1ac46f=this;return function(_0x1f4e2c){clearCampaigns(_0x1ac46f['campaigns']);for(var _0x494904=0x0;_0x494904<_0x1f4e2c[_0x65f6('0x3d')];_0x494904+=0x1){_['merge'](_0x1ac46f[_0x65f6('0x5c')][_0x1f4e2c[_0x494904][_0x65f6('0x3e')]],_0x1f4e2c[_0x494904]);}return _0x1ac46f[_0x65f6('0x5c')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x61')]=function(){var _0x56bd9d=this;return function(_0x398cac){if(_0x398cac){freeIsNotKey(_0x398cac,_0x56bd9d[_0x65f6('0x20')],'id');for(var _0x14c908=0x0,_0x576ecd={};_0x14c908<_0x398cac[_0x65f6('0x3d')];_0x14c908+=0x1){_0x576ecd=_0x398cac[_0x14c908];if(_[_0x65f6('0x3f')](_0x56bd9d[_0x65f6('0x20')][_0x576ecd['id']])){_0x56bd9d[_0x65f6('0x20')][_0x576ecd['id']]=new FaxAccount(_0x576ecd);}else{_0x56bd9d[_0x65f6('0x3a')](_0x56bd9d[_0x65f6('0x20')][_0x576ecd['id']],_0x576ecd);}}}return _0x56bd9d['faxAccounts'];};};Realtime['prototype'][_0x65f6('0x62')]=function(){var _0x10d744=this;return function(_0x10c916){if(_0x10c916){freeIsNotKey(_0x10c916,_0x10d744[_0x65f6('0x11')],'name');for(var _0x4bda86=0x0,_0x336076={};_0x4bda86<_0x10c916[_0x65f6('0x3d')];_0x4bda86+=0x1){_0x336076=_0x10c916[_0x4bda86];if(_[_0x65f6('0x3f')](_0x10d744[_0x65f6('0x11')][_0x336076[_0x65f6('0x3e')]])){_0x10d744[_0x65f6('0x11')][_0x336076['name']]=new VoiceQueue(_0x336076);}else{_0x10d744['mergeFromDatabase'](_0x10d744['voiceQueues'][_0x336076[_0x65f6('0x3e')]],_0x336076);}}}return _0x10d744[_0x65f6('0x11')];};};module[_0x65f6('0x63')]=Realtime; \ No newline at end of file +var _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(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x0b0e,0x187));var _0xe0b0=function(_0x42946c,_0x577d97){_0x42946c=_0x42946c-0x0;var _0x5d7687=_0x0b0e[_0x42946c];return _0x5d7687;};'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 91d0d51..8da9ace 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 _0x5751=['assign'];(function(_0x290d5a,_0x5590fc){var _0x1e8226=function(_0x32b368){while(--_0x32b368){_0x290d5a['push'](_0x290d5a['shift']());}};_0x1e8226(++_0x5590fc);}(_0x5751,0x120));var _0x1575=function(_0x2db12b,_0x30ab1d){_0x2db12b=_0x2db12b-0x0;var _0x20990b=_0x5751[_0x2db12b];return _0x20990b;};'use strict';function mergeDBDataToRealtime(_0x513d72,_0x146139){var _0x54ee2d=Object[_0x1575('0x0')]({},_0x513d72);for(var _0x3791ab in _0x146139){if(_0x54ee2d['hasOwnProperty'](_0x3791ab)){_0x54ee2d[_0x3791ab]=_0x146139[_0x3791ab];}}return _0x54ee2d;}exports['mergeDBDataToRealtime']=mergeDBDataToRealtime; \ No newline at end of file +var _0xf1f3=['mergeDBDataToRealtime','assign','hasOwnProperty'];(function(_0x1f61b1,_0x354916){var _0x10e5a8=function(_0x4cef18){while(--_0x4cef18){_0x1f61b1['push'](_0x1f61b1['shift']());}};_0x10e5a8(++_0x354916);}(_0xf1f3,0x196));var _0x3f1f=function(_0xc9cb61,_0x5e1ea1){_0xc9cb61=_0xc9cb61-0x0;var _0x469951=_0xf1f3[_0xc9cb61];return _0x469951;};'use strict';function mergeDBDataToRealtime(_0x32c94b,_0x2e5477){var _0x26d603=Object[_0x3f1f('0x0')]({},_0x32c94b);for(var _0x31284e in _0x2e5477){if(_0x26d603[_0x3f1f('0x1')](_0x31284e)){_0x26d603[_0x31284e]=_0x2e5477[_0x31284e];}}return _0x26d603;}exports[_0x3f1f('0x2')]=mergeDBDataToRealtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index 2d77508..e00e387 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 _0x6d31=['transfers','linkedid','transfereelinkedid','uniqueid','blindTransfer','UserId','create','monitor','monitors','filename','createdAt','connectedlinename','membername','xcally-motion-dialer','voiceAgentReport','isArray','forEach','startsWith','Local','substring','indexOf','mobile','phone','lastIndexOf','transfererlinkedid','exports','lodash','moment','util','../../../config/environment','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/voiceRecording','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','./userReport','agents','telephones','realtime','xdr','disabled','voiceQueueReport','custom:voiceCallReport','bind','custom:voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindtransfer','attendedtransfer','attendedTransfer','prototype','find','accountcode','name','SIP/%s','length','findAgent','connectedlinenum','lastAssignedTo','interface','isNil','format','queuecallercomplete','queuecallercompleteAt','match','getAgentByInternal','keys','getCallType','split','calleridnum','outbound','internal','voiceCallReport','destination','exten','type','lastdata','context','from-voip-provider','callerid','from-sip','xcally-motion-preview','calleridpreview','originatecalleridnum','destinationchannel','channel','disposition','ANSWERED','\x22%s\x22\x20<%s>','calleridname'];(function(_0x4d2e04,_0x321d1b){var _0xfb6436=function(_0x206b8e){while(--_0x206b8e){_0x4d2e04['push'](_0x4d2e04['shift']());}};_0xfb6436(++_0x321d1b);}(_0x6d31,0xd4));var _0x16d3=function(_0x4b2863,_0x494899){_0x4b2863=_0x4b2863-0x0;var _0x567d67=_0x6d31[_0x4b2863];return _0x567d67;};'use strict';var _=require(_0x16d3('0x0'));var moment=require(_0x16d3('0x1'));var util=require(_0x16d3('0x2'));var config=require(_0x16d3('0x3'));var ami=require('../ami');var RpcVoiceAgentReport=require(_0x16d3('0x4'));var RpcVoiceCallReport=require(_0x16d3('0x5'));var RpcVoiceDialReport=require(_0x16d3('0x6'));var RpcMemberReport=require('../rpc/memberReport');var RpcVoiceQueueReport=require('../rpc/voiceQueueReport');var RpcVoiceRecording=require(_0x16d3('0x7'));var RpcVoiceTransferReport=require('../rpc/voiceTransferReport');var VoiceQueueReport=require(_0x16d3('0x8'));var VoiceCallReport=require(_0x16d3('0x9'));var VoiceAgentReport=require(_0x16d3('0xa'));var VoiceDialReport=require(_0x16d3('0xb'));var UserReport=require(_0x16d3('0xc'));function Report(_0x851fa5){this['realtime']=_0x851fa5;this[_0x16d3('0xd')]=_0x851fa5[_0x16d3('0xd')];this[_0x16d3('0xe')]=_0x851fa5[_0x16d3('0xe')];}Report['prototype']['sync']=function(_0x4c9da6){var _0x43082a=new VoiceQueueReport(this[_0x16d3('0xf')]);var _0x2e3655=new VoiceAgentReport(this[_0x16d3('0xf')]);var _0x5be30a=new VoiceDialReport(this[_0x16d3('0xf')]);var _0x1943d9=new VoiceCallReport(this[_0x16d3('0xf')]);var _0x5c097c=new UserReport(this[_0x16d3('0xf')]);if(config[_0x16d3('0x10')]&&config[_0x16d3('0x10')][_0x16d3('0x11')]){ami['on']('custom:voiceQueueReport',this[_0x16d3('0x12')]['bind'](this));ami['on'](_0x16d3('0x13'),this['voiceCallReport'][_0x16d3('0x14')](this));ami['on'](_0x16d3('0x15'),this['voiceAgentReport'][_0x16d3('0x14')](this));ami['on'](_0x16d3('0x16'),this[_0x16d3('0x17')][_0x16d3('0x14')](this));ami['on'](_0x16d3('0x18'),this['blindTransfer'][_0x16d3('0x14')](this));ami['on'](_0x16d3('0x19'),this[_0x16d3('0x1a')][_0x16d3('0x14')](this));}};Report[_0x16d3('0x1b')]['findAgent']=function(_0x31c93f){var _0x3f40bb;_0x3f40bb=_[_0x16d3('0x1c')](this[_0x16d3('0xd')],function(_0x8047c){return _0x8047c[_0x16d3('0x1d')]==_0x31c93f||_0x8047c[_0x16d3('0x1e')]==_0x31c93f;});if(_['isNil'](_0x3f40bb)){var _0x3fec20=_[_0x16d3('0x1c')](this[_0x16d3('0xe')],function(_0x5e2fca){return _0x5e2fca['accountcode']==_0x31c93f||_0x5e2fca[_0x16d3('0x1e')]==_0x31c93f;});if(_0x3fec20){_0x3f40bb=_[_0x16d3('0x1c')](this[_0x16d3('0xd')],function(_0x51aa1e){return _0x51aa1e['interface']==util['format'](_0x16d3('0x1f'),_0x3fec20[_0x16d3('0x1e')]);});}}return _0x3f40bb;};Report[_0x16d3('0x1b')][_0x16d3('0x12')]=function(_0x261380){for(var _0x2587b1=0x0;_0x2587b1<_0x261380[_0x16d3('0x20')];_0x2587b1+=0x1){var _0xcba469=this[_0x16d3('0x21')](_0x261380[_0x2587b1][_0x16d3('0x22')]);if(_0xcba469){_0x261380[_0x2587b1][_0x16d3('0x1d')]=_0xcba469[_0x16d3('0x1d')];_0x261380[_0x2587b1]['assigned']=!![];_0x261380[_0x2587b1][_0x16d3('0x23')]=_0xcba469[_0x16d3('0x1e')];_0x261380[_0x2587b1][_0x16d3('0x24')]=_[_0x16d3('0x25')](_0xcba469[_0x16d3('0x24')])?util[_0x16d3('0x26')](_0x16d3('0x1f'),_0xcba469['name']):_0xcba469[_0x16d3('0x24')];if(_0x261380[_0x2587b1][_0x16d3('0x27')]){_0x261380[_0x2587b1][_0x16d3('0x28')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}if(_0x261380[_0x2587b1]['queuecallerexit']){_0x261380[_0x2587b1]['queuecallerexitAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}RpcMemberReport[_0x16d3('0x12')](_0x261380[_0x2587b1]);}RpcVoiceQueueReport['create'](_0x261380[_0x2587b1]);}};function extractCalleridNumber(_0x179ad7){var _0x31357c=_0x179ad7[_0x16d3('0x29')](/<(.*?)>/);return _0x31357c?_0x31357c[0x1]:_0x179ad7;}Report[_0x16d3('0x1b')][_0x16d3('0x2a')]=function(_0x42228f){for(var _0x489fcc=0x0;_0x489fcc','calleridname','transfers','linkedid','transfereelinkedid','uniqueid','type','UserId','getAgentByInternal','create','monitor','monitors','filename','createdAt','xcally-motion-preview','connectedlinename','xcally-motion-dialer','isArray','forEach','substring','indexOf','mobile','phone','lastIndexOf','membername','attendedTransfer','lodash','moment','util','../../../config/environment','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','./userReport','realtime','agents','telephones','prototype','sync','xdr','disabled','bind','custom:voiceCallReport','voiceCallReport','voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindtransfer','blindTransfer'];(function(_0x593a98,_0x50ee6a){var _0x5d6f77=function(_0x2803e8){while(--_0x2803e8){_0x593a98['push'](_0x593a98['shift']());}};_0x5d6f77(++_0x50ee6a);}(_0x7c71,0x100));var _0x17c7=function(_0x3e3bee,_0x4f91fe){_0x3e3bee=_0x3e3bee-0x0;var _0x3ae14c=_0x7c71[_0x3e3bee];return _0x3ae14c;};'use strict';var _=require(_0x17c7('0x0'));var moment=require(_0x17c7('0x1'));var util=require(_0x17c7('0x2'));var config=require(_0x17c7('0x3'));var ami=require(_0x17c7('0x4'));var RpcVoiceAgentReport=require(_0x17c7('0x5'));var RpcVoiceCallReport=require(_0x17c7('0x6'));var RpcVoiceDialReport=require(_0x17c7('0x7'));var RpcMemberReport=require(_0x17c7('0x8'));var RpcVoiceQueueReport=require(_0x17c7('0x9'));var RpcVoiceRecording=require(_0x17c7('0xa'));var RpcVoiceTransferReport=require(_0x17c7('0xb'));var VoiceQueueReport=require(_0x17c7('0xc'));var VoiceCallReport=require(_0x17c7('0xd'));var VoiceAgentReport=require(_0x17c7('0xe'));var VoiceDialReport=require(_0x17c7('0xf'));var UserReport=require(_0x17c7('0x10'));function Report(_0x43591d){this[_0x17c7('0x11')]=_0x43591d;this[_0x17c7('0x12')]=_0x43591d[_0x17c7('0x12')];this['telephones']=_0x43591d[_0x17c7('0x13')];}Report[_0x17c7('0x14')][_0x17c7('0x15')]=function(_0x15ca47){var _0x5432b1=new VoiceQueueReport(this['realtime']);var _0x824058=new VoiceAgentReport(this[_0x17c7('0x11')]);var _0x5d83cb=new VoiceDialReport(this[_0x17c7('0x11')]);var _0x2f6764=new VoiceCallReport(this[_0x17c7('0x11')]);var _0x908b0b=new UserReport(this[_0x17c7('0x11')]);if(config['xdr']&&config[_0x17c7('0x16')][_0x17c7('0x17')]){ami['on']('custom:voiceQueueReport',this['voiceQueueReport'][_0x17c7('0x18')](this));ami['on'](_0x17c7('0x19'),this[_0x17c7('0x1a')][_0x17c7('0x18')](this));ami['on']('custom:voiceAgentReport',this[_0x17c7('0x1b')][_0x17c7('0x18')](this));ami['on'](_0x17c7('0x1c'),this[_0x17c7('0x1d')]['bind'](this));ami['on'](_0x17c7('0x1e'),this[_0x17c7('0x1f')]['bind'](this));ami['on']('attendedtransfer',this['attendedTransfer']['bind'](this));}};Report[_0x17c7('0x14')][_0x17c7('0x20')]=function(_0x4286fa){var _0x4c325d;_0x4c325d=_[_0x17c7('0x21')](this['agents'],function(_0x254760){return _0x254760[_0x17c7('0x22')]==_0x4286fa||_0x254760[_0x17c7('0x23')]==_0x4286fa;});if(_['isNil'](_0x4c325d)){var _0x1c379e=_['find'](this[_0x17c7('0x13')],function(_0x323279){return _0x323279[_0x17c7('0x22')]==_0x4286fa||_0x323279[_0x17c7('0x23')]==_0x4286fa;});if(_0x1c379e){_0x4c325d=_[_0x17c7('0x21')](this[_0x17c7('0x12')],function(_0x2c519c){return _0x2c519c[_0x17c7('0x24')]==util[_0x17c7('0x25')](_0x17c7('0x26'),_0x1c379e[_0x17c7('0x23')]);});}}return _0x4c325d;};Report['prototype'][_0x17c7('0x27')]=function(_0x258755){for(var _0x259214=0x0;_0x259214<_0x258755[_0x17c7('0x28')];_0x259214+=0x1){var _0x5e74f9=this[_0x17c7('0x20')](_0x258755[_0x259214]['connectedlinenum']);if(_0x5e74f9){_0x258755[_0x259214][_0x17c7('0x22')]=_0x5e74f9['accountcode'];_0x258755[_0x259214][_0x17c7('0x29')]=!![];_0x258755[_0x259214]['lastAssignedTo']=_0x5e74f9['name'];_0x258755[_0x259214]['interface']=_[_0x17c7('0x2a')](_0x5e74f9[_0x17c7('0x24')])?util['format']('SIP/%s',_0x5e74f9[_0x17c7('0x23')]):_0x5e74f9[_0x17c7('0x24')];if(_0x258755[_0x259214][_0x17c7('0x2b')]){_0x258755[_0x259214][_0x17c7('0x2c')]=moment()[_0x17c7('0x25')](_0x17c7('0x2d'));}if(_0x258755[_0x259214][_0x17c7('0x2e')]){_0x258755[_0x259214][_0x17c7('0x2f')]=moment()[_0x17c7('0x25')](_0x17c7('0x2d'));}RpcMemberReport[_0x17c7('0x27')](_0x258755[_0x259214]);}RpcVoiceQueueReport['create'](_0x258755[_0x259214]);}};function extractCalleridNumber(_0x274e41){var _0x19d059=_0x274e41['match'](/<(.*?)>/);return _0x19d059?_0x19d059[0x1]:_0x274e41;}Report[_0x17c7('0x14')]['getAgentByInternal']=function(_0x131643){for(var _0x50b8a4=0x0;_0x50b8a40x0?!![]:![];if(!_0x5ec394){return this[_0xaefd('0x1a')](this['summary'][_0xaefd('0x6f')]);}};VoiceQueueReport[_0xaefd('0x9')]['syncQueueMember']=function(_0x9a29ff){var _0x431cc0=this[_0xaefd('0x14')]['id'];if(this[_0xaefd('0x14')][_0xaefd('0x62')][_0x431cc0]&&this[_0xaefd('0x14')][_0xaefd('0x62')][_0x431cc0][_0x9a29ff[_0xaefd('0x63')]]){this[_0xaefd('0x14')][_0xaefd('0x62')][_0x431cc0][_0x9a29ff[_0xaefd('0x63')]][_0xaefd('0xf')]['push'](_0x9a29ff);}};VoiceQueueReport['prototype'][_0xaefd('0x17')]=function(_0x59db2e){var _0x19a45c=this;try{if(this[_0xaefd('0x5b')](_0x59db2e)&&this['isNotNull'](_0x59db2e[_0xaefd('0x50')])){logger['debug'](_0xaefd('0x70'),util[_0xaefd('0x43')](_0x59db2e,{'showHidden':![],'depth':null}));var _0x39550c=this['voiceQueues'][_0x59db2e[_0xaefd('0x50')]];if(_0x39550c){logger[_0xaefd('0x4b')](_0xaefd('0x71'),_0x39550c[_0xaefd('0x6b')]);this[_0xaefd('0x14')]['queues'][_0x39550c[_0xaefd('0x6b')]]={'summaryEvent':_0x59db2e};this['summary'][_0xaefd('0x6e')]+=0x1;return ami[_0xaefd('0x5d')]({'action':'queuestatus','queue':_0x39550c[_0xaefd('0x6b')]})[_0xaefd('0x72')](function(_0x5a6060){if(!_0x19a45c[_0xaefd('0x14')][_0xaefd('0x62')][_0x59db2e[_0xaefd('0x63')]]){_0x19a45c[_0xaefd('0x14')]['queuestatus'][_0x59db2e[_0xaefd('0x63')]]={};}_0x19a45c[_0xaefd('0x14')][_0xaefd('0x62')][_0x59db2e[_0xaefd('0x63')]][_0x5a6060[_0xaefd('0x63')]]={'queue':_0x39550c['name'],'agents':[]};})[_0xaefd('0x5f')](function(_0x4225cb){throw _0x4225cb;});}}}catch(_0x340f31){logger[_0xaefd('0x41')](_0xaefd('0x64'),util[_0xaefd('0x43')](_0x340f31,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xaefd('0x9')][_0xaefd('0x1a')]=function(_0x16c6eb){if(this[_0xaefd('0x14')][_0xaefd('0x6e')]>0x0){this[_0xaefd('0x14')][_0xaefd('0x6f')]=_0x16c6eb;return;}logger[_0xaefd('0x4b')](_0xaefd('0x73'),util[_0xaefd('0x43')](_0x16c6eb,{'showHidden':![],'depth':null}));this['summary']=initializeSummary();ami['emit'](_0xaefd('0x74'),{});};VoiceQueueReport['prototype'][_0xaefd('0x20')]=function(_0x39b0ad){try{if(this[_0xaefd('0x5b')](_0x39b0ad)){logger[_0xaefd('0x4b')](_0xaefd('0x75'),_0x39b0ad[_0xaefd('0x54')],util['inspect'](_0x39b0ad,{'showHidden':![],'depth':null}));if(_[_0xaefd('0x5c')](this[_0xaefd('0xe')][_0x39b0ad[_0xaefd('0x54')]])){this[_0xaefd('0xe')][_0x39b0ad[_0xaefd('0x54')]]=[];}if(_[_0xaefd('0x5c')](this[_0xaefd('0x10')][_0x39b0ad['uniqueid']])){this[_0xaefd('0x10')][_0x39b0ad[_0xaefd('0x54')]]={};}var _0x218fd4=new QueueReport();_0x218fd4[_0xaefd('0x50')]=_0x39b0ad[_0xaefd('0x50')];_0x218fd4[_0xaefd('0x57')]=this[_0xaefd('0x12')][_0x218fd4['queue']]&&this[_0xaefd('0x12')][_0x218fd4[_0xaefd('0x50')]][_0xaefd('0x57')]?this[_0xaefd('0x12')][_0x218fd4[_0xaefd('0x50')]][_0xaefd('0x57')]||_0xaefd('0x58'):_0xaefd('0x58');_0x218fd4['queuecallerjoinAt']=moment()[_0xaefd('0x4e')]('YYYY-MM-DD\x20HH:mm:ss');_0x218fd4[_0xaefd('0x76')]=_0x39b0ad['position'];_0x218fd4['count']=_0x39b0ad[_0xaefd('0x77')];_0x218fd4[_0xaefd('0x54')]=_0x39b0ad[_0xaefd('0x54')];_0x218fd4[_0xaefd('0x78')]=this[_0xaefd('0x10')][_0x39b0ad[_0xaefd('0x54')]]['routealias'];logger['info'](_0xaefd('0x79'),_0x218fd4[_0xaefd('0x50')],_0x218fd4['type']);Object[_0xaefd('0x6a')](_0x218fd4,_[_0xaefd('0x7a')](_0x39b0ad,_[_0xaefd('0x7b')](_0x218fd4)));this[_0xaefd('0xe')][_0x39b0ad[_0xaefd('0x54')]][_0xaefd('0x7c')](_0x218fd4);this[_0xaefd('0x10')][_0x39b0ad[_0xaefd('0x54')]]=_0x218fd4;this[_0xaefd('0x7d')](_0x218fd4,'queuecallerjoin');}}catch(_0x37ab0c){logger[_0xaefd('0x41')]('[%s][voiceQueueReport][queuecallerjoin]',_0x39b0ad[_0xaefd('0x54')],util[_0xaefd('0x43')](_0x37ab0c,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xaefd('0x9')][_0xaefd('0x22')]=function(_0x4c2e6a){try{if(this[_0xaefd('0x5b')](_0x4c2e6a)){logger[_0xaefd('0x4b')]('[%s][voiceQueueReport][queuecallerabandon]',_0x4c2e6a['uniqueid'],util[_0xaefd('0x43')](_0x4c2e6a,{'showHidden':![],'depth':null}));if(this[_0xaefd('0xe')][_0x4c2e6a[_0xaefd('0x54')]]){var _0x5da8db=_[_0xaefd('0x7e')](this[_0xaefd('0xe')][_0x4c2e6a[_0xaefd('0x54')]]);_0x5da8db[_0xaefd('0x3b')]=![];_0x5da8db[_0xaefd('0x7f')]=null;_0x5da8db[_0xaefd('0x80')]=_0x4c2e6a['holdtime'];_0x5da8db[_0xaefd('0x81')]=_0x4c2e6a['originalposition'];_0x5da8db[_0xaefd('0x21')]=!![];_0x5da8db[_0xaefd('0x82')]=moment()[_0xaefd('0x4e')](_0xaefd('0x83'));_0x5da8db[_0xaefd('0x84')]=_0xaefd('0x85');_0x5da8db['lastAssignedTo']=null;logger[_0xaefd('0x86')](_0xaefd('0x87'),_0x5da8db[_0xaefd('0x50')],_0x5da8db[_0xaefd('0x57')]);this[_0xaefd('0x10')][_0x4c2e6a[_0xaefd('0x54')]]=_0x5da8db;this[_0xaefd('0x48')](_0x5da8db,_0xaefd('0x21'));}}}catch(_0x1e335e){logger[_0xaefd('0x41')]('[%s][voiceQueueReport][queuecallerabandon]',_0x4c2e6a[_0xaefd('0x54')],util['inspect'](_0x1e335e,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xaefd('0x9')][_0xaefd('0x88')]=function(_0x1aa626){try{if(this[_0xaefd('0x5b')](_0x1aa626)){logger['debug'](_0xaefd('0x89'),_0x1aa626[_0xaefd('0x54')],util[_0xaefd('0x43')](_0x1aa626,{'showHidden':![],'depth':null}));if(this[_0xaefd('0xe')][_0x1aa626[_0xaefd('0x54')]]){var _0x32360e=_[_0xaefd('0x7e')](this[_0xaefd('0xe')][_0x1aa626[_0xaefd('0x54')]]);_0x32360e['queuecallerleaveAt']=moment()[_0xaefd('0x4e')](_0xaefd('0x83'));_0x32360e[_0xaefd('0x8a')]=_0x1aa626[_0xaefd('0x8a')];_0x32360e[_0xaefd('0x8b')]=_0x1aa626['connectedlinename'];logger[_0xaefd('0x86')](_0xaefd('0x8c'),_0x32360e[_0xaefd('0x50')],_0x32360e['type'],_0x1aa626[_0xaefd('0x8a')],_0x1aa626[_0xaefd('0x8b')]);this[_0xaefd('0x10')][_0x1aa626[_0xaefd('0x54')]]=_0x32360e;this[_0xaefd('0x7d')](_0x32360e,_0xaefd('0x23'));}}}catch(_0x34e2b2){logger['error'](_0xaefd('0x89'),_0x1aa626[_0xaefd('0x54')],util[_0xaefd('0x43')](_0x34e2b2,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xaefd('0x9')][_0xaefd('0x27')]=function(_0x5a0d00){try{if(this[_0xaefd('0x5b')](_0x5a0d00)){logger[_0xaefd('0x4b')](_0xaefd('0x8d'),_0x5a0d00[_0xaefd('0x54')],util['inspect'](_0x5a0d00,{'showHidden':![],'depth':null}));if(this[_0xaefd('0xe')][_0x5a0d00[_0xaefd('0x54')]]){var _0x3c84ec=_[_0xaefd('0x7e')](this[_0xaefd('0xe')][_0x5a0d00['uniqueid']]);_0x3c84ec[_0xaefd('0x3b')]=!![];_0x3c84ec[_0xaefd('0x84')]=_0xaefd('0x8e');logger['info'](_0xaefd('0x8f'),_0x3c84ec[_0xaefd('0x50')],_0x3c84ec[_0xaefd('0x57')]);}}}catch(_0x571ce3){logger[_0xaefd('0x41')](_0xaefd('0x8d'),_0x5a0d00['uniqueid'],util['inspect'](_0x571ce3,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xaefd('0x9')][_0xaefd('0x25')]=function(_0x18c41a){try{if(this[_0xaefd('0x5b')](_0x18c41a)){logger[_0xaefd('0x4b')](_0xaefd('0x90'),_0x18c41a[_0xaefd('0x54')],util[_0xaefd('0x43')](_0x18c41a,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x18c41a['uniqueid']]){var _0x7c1423=_['last'](this['queueReports'][_0x18c41a['uniqueid']]);_0x7c1423[_0xaefd('0x21')]=![];_0x7c1423[_0xaefd('0x82')]=null;_0x7c1423[_0xaefd('0x91')]=!![];_0x7c1423['lastAssignedTo']=_0x18c41a[_0xaefd('0x92')];_0x7c1423['holdtime']=_0x18c41a[_0xaefd('0x80')];_0x7c1423[_0xaefd('0x3b')]=!![];_0x7c1423[_0xaefd('0x3a')]=![];_0x7c1423['queuecallerexitAt']=null;if(!_0x7c1423[_0xaefd('0x93')]){if(_0x18c41a['reason']==_0xaefd('0x93')){_0x7c1423[_0xaefd('0x84')]=_0xaefd('0x94');logger[_0xaefd('0x86')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED',_0x7c1423[_0xaefd('0x50')],_0x7c1423[_0xaefd('0x57')]);}else{if(_['startsWith'](_0x18c41a[_0xaefd('0x95')][_0xaefd('0x96')](),'local/')){if(this[_0xaefd('0xe')][_0x18c41a[_0xaefd('0x97')]]){var _0x35c4ae=_[_0xaefd('0x7e')](this[_0xaefd('0xe')][_0x18c41a[_0xaefd('0x97')]]);_0x35c4ae['queuecallercomplete']=![];_0x35c4ae['queuecallerexit']=!![];_0x35c4ae[_0xaefd('0x98')]=moment(_0x7c1423[_0xaefd('0x99')])[_0xaefd('0x9a')](_0x18c41a[_0xaefd('0x80')],_0xaefd('0x9b'))[_0xaefd('0x4e')]('YYYY-MM-DD\x20HH:mm:ss');_0x35c4ae[_0xaefd('0x84')]=_0xaefd('0x9c');_0x35c4ae[_0xaefd('0x93')]=!![];_0x35c4ae['transfertype']='FORWARD';_0x35c4ae[_0xaefd('0x9d')]=_0x18c41a[_0xaefd('0x9e')];_0x35c4ae['transferuniqueid']=_0x18c41a[_0xaefd('0x54')];logger[_0xaefd('0x86')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER',_0x35c4ae[_0xaefd('0x50')],_0x35c4ae['type']);var _0x448c97=this['queueReports'][_0x18c41a[_0xaefd('0x97')]];this[_0xaefd('0xe')][_0x18c41a[_0xaefd('0x97')]]=this['queueReports'][_0x18c41a[_0xaefd('0x54')]];this['queueReports'][_0x18c41a[_0xaefd('0x54')]]=_0x448c97;}}else{_0x7c1423[_0xaefd('0x84')]=_0xaefd('0x9f')+_0x18c41a[_0xaefd('0xa0')][_0xaefd('0xa1')]();logger[_0xaefd('0x86')](_0xaefd('0xa2'),_0x7c1423[_0xaefd('0x50')],_0x7c1423['type'],_0x7c1423[_0xaefd('0x84')]);}}}this[_0xaefd('0x10')][_0x18c41a[_0xaefd('0x54')]]=_0x7c1423;}}}catch(_0x48f86a){logger[_0xaefd('0x41')]('[%s][voiceQueueReport][agentcomplete]',_0x18c41a[_0xaefd('0x54')],util['inspect'](_0x48f86a,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xaefd('0x9')]['syncVarSet']=function(_0x3d5967){try{if(this[_0xaefd('0x5b')](_0x3d5967)){logger[_0xaefd('0x4b')](_0xaefd('0xa3'),_0x3d5967[_0xaefd('0x54')],util[_0xaefd('0x43')](_0x3d5967,{'showHidden':![],'depth':null}));this['addVariable'](_0x3d5967[_0xaefd('0x54')],_[_0xaefd('0x7b')](_0x3d5967[_0xaefd('0xa4')])[0x0],_0x3d5967['value']);if(this[_0xaefd('0xe')][_0x3d5967['uniqueid']]){var _0x494fa7=_['last'](this[_0xaefd('0xe')][_0x3d5967['uniqueid']]);if(_0x494fa7){if(this['isNotNull'](_0x3d5967[_0xaefd('0xa4')])&&this[_0xaefd('0x5b')](_0x3d5967[_0xaefd('0xa4')]['queuestatus'])){switch(_0x3d5967[_0xaefd('0xa5')]){case _0xaefd('0xa6'):_0x494fa7[_0xaefd('0x3a')]=![];_0x494fa7[_0xaefd('0x98')]=null;break;case'TIMEOUT':_0x494fa7['lastevent']=_0xaefd('0xa7');_0x494fa7[_0xaefd('0x3a')]=!![];_0x494fa7[_0xaefd('0x98')]=moment()[_0xaefd('0x4e')](_0xaefd('0x83'));_0x494fa7['queuecallerleaveAt']=moment()[_0xaefd('0x4e')](_0xaefd('0x83'));logger['debug'](_0xaefd('0xa8'),_0x3d5967[_0xaefd('0x54')],util[_0xaefd('0x43')](_0x494fa7,{'showHidden':![],'depth':null}));ami[_0xaefd('0x4a')](_0xaefd('0xa9'),_0x494fa7);break;default:_0x494fa7[_0xaefd('0x3a')]=!![];_0x494fa7['queuecallerexitAt']=moment()[_0xaefd('0x4e')](_0xaefd('0x83'));_0x494fa7[_0xaefd('0xaa')]=moment()[_0xaefd('0x4e')](_0xaefd('0x83'));}_0x494fa7[_0xaefd('0x21')]=![];_0x494fa7[_0xaefd('0x82')]=null;_0x494fa7[_0xaefd('0x84')]=_0x3d5967[_0xaefd('0xa5')];this['channels'][_0x3d5967[_0xaefd('0x54')]]=_0x494fa7;this[_0xaefd('0x48')](_0x494fa7,_0xaefd('0x28'));}else if(this['isNotNull'](_0x3d5967[_0xaefd('0xa4')])&&this['isNotNull'](_0x3d5967[_0xaefd('0xa4')][_0xaefd('0xab')])){if(!_0x494fa7[_0xaefd('0x21')]){_0x494fa7[_0xaefd('0x3a')]=!![];_0x494fa7[_0xaefd('0x98')]=moment()[_0xaefd('0x4e')](_0xaefd('0x83'));_0x494fa7[_0xaefd('0x84')]=_0xaefd('0xac');_0x494fa7['queuecallerleaveAt']=moment()[_0xaefd('0x4e')](_0xaefd('0x83'));this[_0xaefd('0x10')][_0x3d5967['uniqueid']]=_0x494fa7;}}logger[_0xaefd('0x86')](_0xaefd('0xad'),_0x3d5967[_0xaefd('0x54')],_0x494fa7[_0xaefd('0x50')],_0x494fa7[_0xaefd('0x57')],_['keys'](_0x3d5967[_0xaefd('0xa4')])[0x0],_0x3d5967[_0xaefd('0xa5')]);_0x494fa7[_0xaefd('0x15')]=this[_0xaefd('0x15')][_0x3d5967[_0xaefd('0x54')]];}}}}catch(_0x4cfe68){logger[_0xaefd('0x41')](_0xaefd('0xa3'),_0x3d5967[_0xaefd('0x54')],util['inspect'](_0x4cfe68,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xaefd('0x9')][_0xaefd('0xae')]=function(_0xed75dc,_0x47c320,_0x2f9066){var _0x571c2a=[_0xaefd('0xaf'),_0xaefd('0xb0'),'rtpaudioqosjitter',_0xaefd('0xb1'),'rtpaudioqosloss',_0xaefd('0xb2'),'rtpaudioqosrtt',_0xaefd('0xb3'),'sipcallid',_0xaefd('0xb4'),_0xaefd('0xb5'),_0xaefd('0xb6'),'membercalls','memberdynamic',_0xaefd('0xb7'),'memberlastcall',_0xaefd('0x92'),_0xaefd('0xb8'),_0xaefd('0xb9')];if(!_[_0xaefd('0x3e')](_0x47c320)&&!_[_0xaefd('0xba')](_0x571c2a,_0x47c320)){if(_[_0xaefd('0x5c')](this[_0xaefd('0x15')][_0xed75dc])){this[_0xaefd('0x15')][_0xed75dc]={};}this[_0xaefd('0x15')][_0xed75dc][_0x47c320]=_0x2f9066;}};VoiceQueueReport[_0xaefd('0x9')]['handleHangup']=function(_0x111a18,_0x4460f5,_0x566635){try{var _0x20ae05={};if(this['queueReports'][_0x111a18]){for(var _0x46a27f=0x0;_0x46a27f0x0?!![]:![];if(!_0x1a50f1){return this[_0xcdc5('0x1a')](this[_0xcdc5('0x46')][_0xcdc5('0x6b')]);}};VoiceQueueReport[_0xcdc5('0xb')][_0xcdc5('0x6c')]=function(_0x19caeb){var _0x1a7650=this[_0xcdc5('0x46')]['id'];if(this['summary'][_0xcdc5('0x66')][_0x1a7650]&&this[_0xcdc5('0x46')][_0xcdc5('0x66')][_0x1a7650][_0x19caeb[_0xcdc5('0x5f')]]){this[_0xcdc5('0x46')][_0xcdc5('0x66')][_0x1a7650][_0x19caeb[_0xcdc5('0x5f')]]['agents']['push'](_0x19caeb);}};VoiceQueueReport[_0xcdc5('0xb')][_0xcdc5('0x6d')]=function(_0xd3a7af){var _0x1c60ee=this;try{if(this[_0xcdc5('0x6e')](_0xd3a7af)&&this[_0xcdc5('0x6e')](_0xd3a7af['queue'])){logger['debug'](_0xcdc5('0x6f'),util[_0xcdc5('0x4d')](_0xd3a7af,{'showHidden':![],'depth':null}));var _0x7e198d=this[_0xcdc5('0x14')][_0xd3a7af['queue']];if(_0x7e198d){logger[_0xcdc5('0x51')]('[voiceQueueReport][queuesummary]\x20name:%s',_0x7e198d['name']);this[_0xcdc5('0x46')]['queues'][_0x7e198d[_0xcdc5('0x59')]]={'summaryEvent':_0xd3a7af};this[_0xcdc5('0x46')][_0xcdc5('0x6a')]+=0x1;return ami[_0xcdc5('0x3a')]({'action':'queuestatus','queue':_0x7e198d['name']})['then'](function(_0x2ebac6){if(!_0x1c60ee[_0xcdc5('0x46')]['queuestatus'][_0xd3a7af[_0xcdc5('0x5f')]]){_0x1c60ee[_0xcdc5('0x46')]['queuestatus'][_0xd3a7af['actionid']]={};}_0x1c60ee['summary']['queuestatus'][_0xd3a7af[_0xcdc5('0x5f')]][_0x2ebac6[_0xcdc5('0x5f')]]={'queue':_0x7e198d[_0xcdc5('0x59')],'agents':[]};})['catch'](function(_0xc60904){throw _0xc60904;});}}}catch(_0x5b6ac7){logger[_0xcdc5('0x40')](_0xcdc5('0x60'),util['inspect'](_0x5b6ac7,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xcdc5('0xb')][_0xcdc5('0x1a')]=function(_0x88c519){if(this[_0xcdc5('0x46')][_0xcdc5('0x6a')]>0x0){this[_0xcdc5('0x46')][_0xcdc5('0x6b')]=_0x88c519;return;}logger[_0xcdc5('0x51')](_0xcdc5('0x70'),util[_0xcdc5('0x4d')](_0x88c519,{'showHidden':![],'depth':null}));this[_0xcdc5('0x46')]=initializeSummary();ami[_0xcdc5('0x49')](_0xcdc5('0x71'),{});};VoiceQueueReport[_0xcdc5('0xb')][_0xcdc5('0x1f')]=function(_0x4f7b83){try{if(this[_0xcdc5('0x6e')](_0x4f7b83)){logger['debug'](_0xcdc5('0x72'),_0x4f7b83[_0xcdc5('0x4c')],util[_0xcdc5('0x4d')](_0x4f7b83,{'showHidden':![],'depth':null}));if(_['isUndefined'](this[_0xcdc5('0x10')][_0x4f7b83[_0xcdc5('0x4c')]])){this['queueReports'][_0x4f7b83[_0xcdc5('0x4c')]]=[];}if(_['isUndefined'](this[_0xcdc5('0x13')][_0x4f7b83[_0xcdc5('0x4c')]])){this[_0xcdc5('0x13')][_0x4f7b83[_0xcdc5('0x4c')]]={};}var _0x28ea9b=new QueueReport();_0x28ea9b[_0xcdc5('0x50')]=_0x4f7b83[_0xcdc5('0x50')];_0x28ea9b[_0xcdc5('0x56')]=this[_0xcdc5('0x14')][_0x28ea9b['queue']]&&this[_0xcdc5('0x14')][_0x28ea9b[_0xcdc5('0x50')]][_0xcdc5('0x56')]?this[_0xcdc5('0x14')][_0x28ea9b[_0xcdc5('0x50')]][_0xcdc5('0x56')]||_0xcdc5('0x57'):_0xcdc5('0x57');_0x28ea9b['queuecallerjoinAt']=moment()[_0xcdc5('0x4e')](_0xcdc5('0x73'));_0x28ea9b['position']=_0x4f7b83[_0xcdc5('0x74')];_0x28ea9b[_0xcdc5('0x75')]=_0x4f7b83[_0xcdc5('0x75')];_0x28ea9b[_0xcdc5('0x4c')]=_0x4f7b83[_0xcdc5('0x4c')];_0x28ea9b[_0xcdc5('0x76')]=this['channels'][_0x4f7b83[_0xcdc5('0x4c')]][_0xcdc5('0x76')];logger[_0xcdc5('0x77')](_0xcdc5('0x78'),_0x28ea9b['queue'],_0x28ea9b[_0xcdc5('0x56')]);Object[_0xcdc5('0x65')](_0x28ea9b,_[_0xcdc5('0x79')](_0x4f7b83,_[_0xcdc5('0x7a')](_0x28ea9b)));this[_0xcdc5('0x10')][_0x4f7b83['uniqueid']][_0xcdc5('0x7b')](_0x28ea9b);this['channels'][_0x4f7b83[_0xcdc5('0x4c')]]=_0x28ea9b;this[_0xcdc5('0x7c')](_0x28ea9b,_0xcdc5('0x1e'));}}catch(_0xbe79c6){logger['error'](_0xcdc5('0x72'),_0x4f7b83[_0xcdc5('0x4c')],util[_0xcdc5('0x4d')](_0xbe79c6,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xcdc5('0xb')][_0xcdc5('0x7d')]=function(_0xd24d99){try{if(this['isNotNull'](_0xd24d99)){logger[_0xcdc5('0x51')](_0xcdc5('0x7e'),_0xd24d99[_0xcdc5('0x4c')],util[_0xcdc5('0x4d')](_0xd24d99,{'showHidden':![],'depth':null}));if(this[_0xcdc5('0x10')][_0xd24d99['uniqueid']]){var _0x2ad664=_[_0xcdc5('0x7f')](this[_0xcdc5('0x10')][_0xd24d99['uniqueid']]);_0x2ad664[_0xcdc5('0x37')]=![];_0x2ad664[_0xcdc5('0x80')]=null;_0x2ad664[_0xcdc5('0x81')]=_0xd24d99[_0xcdc5('0x81')];_0x2ad664[_0xcdc5('0x82')]=_0xd24d99['originalposition'];_0x2ad664['queuecallerabandon']=!![];_0x2ad664[_0xcdc5('0x83')]=moment()[_0xcdc5('0x4e')](_0xcdc5('0x73'));_0x2ad664[_0xcdc5('0x84')]='ABANDONED';_0x2ad664[_0xcdc5('0x85')]=null;logger[_0xcdc5('0x77')](_0xcdc5('0x86'),_0x2ad664[_0xcdc5('0x50')],_0x2ad664['type']);this[_0xcdc5('0x13')][_0xd24d99[_0xcdc5('0x4c')]]=_0x2ad664;this[_0xcdc5('0x47')](_0x2ad664,_0xcdc5('0x20'));}}}catch(_0x2d67d7){logger['error'](_0xcdc5('0x7e'),_0xd24d99[_0xcdc5('0x4c')],util['inspect'](_0x2d67d7,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xcdc5('0xb')][_0xcdc5('0x22')]=function(_0x4c8383){try{if(this[_0xcdc5('0x6e')](_0x4c8383)){logger[_0xcdc5('0x51')](_0xcdc5('0x87'),_0x4c8383[_0xcdc5('0x4c')],util[_0xcdc5('0x4d')](_0x4c8383,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x4c8383[_0xcdc5('0x4c')]]){var _0x418fa9=_[_0xcdc5('0x7f')](this[_0xcdc5('0x10')][_0x4c8383[_0xcdc5('0x4c')]]);_0x418fa9[_0xcdc5('0x88')]=moment()[_0xcdc5('0x4e')](_0xcdc5('0x73'));_0x418fa9[_0xcdc5('0x89')]=_0x4c8383[_0xcdc5('0x89')];_0x418fa9[_0xcdc5('0x8a')]=_0x4c8383[_0xcdc5('0x8a')];logger['info'](_0xcdc5('0x8b'),_0x418fa9['queue'],_0x418fa9[_0xcdc5('0x56')],_0x4c8383[_0xcdc5('0x89')],_0x4c8383['connectedlinename']);this[_0xcdc5('0x13')][_0x4c8383[_0xcdc5('0x4c')]]=_0x418fa9;this[_0xcdc5('0x7c')](_0x418fa9,'queuecallerleave');}}}catch(_0x6738e){logger['error'](_0xcdc5('0x87'),_0x4c8383[_0xcdc5('0x4c')],util[_0xcdc5('0x4d')](_0x6738e,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xcdc5('0xb')][_0xcdc5('0x8c')]=function(_0x4d2855){try{if(this[_0xcdc5('0x6e')](_0x4d2855)){logger[_0xcdc5('0x51')](_0xcdc5('0x8d'),_0x4d2855[_0xcdc5('0x4c')],util['inspect'](_0x4d2855,{'showHidden':![],'depth':null}));if(this[_0xcdc5('0x10')][_0x4d2855[_0xcdc5('0x4c')]]){var _0x2ad880=_['last'](this[_0xcdc5('0x10')][_0x4d2855[_0xcdc5('0x4c')]]);_0x2ad880[_0xcdc5('0x37')]=!![];_0x2ad880[_0xcdc5('0x84')]=_0xcdc5('0x8e');logger[_0xcdc5('0x77')](_0xcdc5('0x8f'),_0x2ad880[_0xcdc5('0x50')],_0x2ad880['type']);}}}catch(_0x2356d3){logger[_0xcdc5('0x40')](_0xcdc5('0x8d'),_0x4d2855[_0xcdc5('0x4c')],util[_0xcdc5('0x4d')](_0x2356d3,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xcdc5('0xb')][_0xcdc5('0x90')]=function(_0x509577){try{if(this[_0xcdc5('0x6e')](_0x509577)){logger[_0xcdc5('0x51')](_0xcdc5('0x91'),_0x509577[_0xcdc5('0x4c')],util[_0xcdc5('0x4d')](_0x509577,{'showHidden':![],'depth':null}));if(this[_0xcdc5('0x10')][_0x509577[_0xcdc5('0x4c')]]){var _0x244f81=_[_0xcdc5('0x7f')](this['queueReports'][_0x509577[_0xcdc5('0x4c')]]);_0x244f81[_0xcdc5('0x20')]=![];_0x244f81[_0xcdc5('0x83')]=null;_0x244f81[_0xcdc5('0x92')]=!![];_0x244f81[_0xcdc5('0x85')]=_0x509577[_0xcdc5('0x93')];_0x244f81['holdtime']=_0x509577[_0xcdc5('0x81')];_0x244f81['queuecallercomplete']=!![];_0x244f81[_0xcdc5('0x94')]=![];_0x244f81[_0xcdc5('0x95')]=null;if(!_0x244f81[_0xcdc5('0x96')]){if(_0x509577[_0xcdc5('0x97')]=='transfer'){_0x244f81[_0xcdc5('0x84')]=_0xcdc5('0x98');logger[_0xcdc5('0x77')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED',_0x244f81[_0xcdc5('0x50')],_0x244f81[_0xcdc5('0x56')]);}else{if(_[_0xcdc5('0x99')](_0x509577[_0xcdc5('0x3c')][_0xcdc5('0x9a')](),_0xcdc5('0x9b'))){if(this['queueReports'][_0x509577['linkedid']]){var _0x494710=_[_0xcdc5('0x7f')](this[_0xcdc5('0x10')][_0x509577[_0xcdc5('0x9c')]]);_0x494710[_0xcdc5('0x37')]=![];_0x494710[_0xcdc5('0x94')]=!![];_0x494710['queuecallerexitAt']=moment(_0x244f81[_0xcdc5('0x9d')])['add'](_0x509577['holdtime'],_0xcdc5('0x9e'))['format']('YYYY-MM-DD\x20HH:mm:ss');_0x494710['queuecallerexitreason']=_0xcdc5('0x9f');_0x494710['transfer']=!![];_0x494710[_0xcdc5('0xa0')]=_0xcdc5('0xa1');_0x494710[_0xcdc5('0xa2')]=_0x509577[_0xcdc5('0xa3')];_0x494710[_0xcdc5('0xa4')]=_0x509577[_0xcdc5('0x4c')];logger[_0xcdc5('0x77')](_0xcdc5('0xa5'),_0x494710[_0xcdc5('0x50')],_0x494710[_0xcdc5('0x56')]);var _0x1c5e52=this[_0xcdc5('0x10')][_0x509577[_0xcdc5('0x9c')]];this[_0xcdc5('0x10')][_0x509577[_0xcdc5('0x9c')]]=this[_0xcdc5('0x10')][_0x509577[_0xcdc5('0x4c')]];this['queueReports'][_0x509577[_0xcdc5('0x4c')]]=_0x1c5e52;}}else{_0x244f81['queuecallerexitreason']=_0xcdc5('0xa6')+_0x509577[_0xcdc5('0x97')][_0xcdc5('0xa7')]();logger[_0xcdc5('0x77')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s',_0x244f81[_0xcdc5('0x50')],_0x244f81[_0xcdc5('0x56')],_0x244f81[_0xcdc5('0x84')]);}}}this[_0xcdc5('0x13')][_0x509577[_0xcdc5('0x4c')]]=_0x244f81;}}}catch(_0x440a51){logger['error'](_0xcdc5('0x91'),_0x509577['uniqueid'],util[_0xcdc5('0x4d')](_0x440a51,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncVarSet']=function(_0x5e26d7){try{if(this[_0xcdc5('0x6e')](_0x5e26d7)){logger[_0xcdc5('0x51')](_0xcdc5('0xa8'),_0x5e26d7[_0xcdc5('0x4c')],util['inspect'](_0x5e26d7,{'showHidden':![],'depth':null}));this[_0xcdc5('0xa9')](_0x5e26d7[_0xcdc5('0x4c')],_[_0xcdc5('0x7a')](_0x5e26d7[_0xcdc5('0xaa')])[0x0],_0x5e26d7[_0xcdc5('0xab')]);if(this['queueReports'][_0x5e26d7[_0xcdc5('0x4c')]]){var _0x5658be=_[_0xcdc5('0x7f')](this[_0xcdc5('0x10')][_0x5e26d7[_0xcdc5('0x4c')]]);if(_0x5658be){if(this[_0xcdc5('0x6e')](_0x5e26d7[_0xcdc5('0xaa')])&&this[_0xcdc5('0x6e')](_0x5e26d7['variable'][_0xcdc5('0x66')])){switch(_0x5e26d7[_0xcdc5('0xab')]){case _0xcdc5('0xac'):_0x5658be['queuecallerexit']=![];_0x5658be[_0xcdc5('0x95')]=null;break;case _0xcdc5('0xad'):_0x5658be[_0xcdc5('0xae')]=_0xcdc5('0xaf');_0x5658be[_0xcdc5('0x94')]=!![];_0x5658be[_0xcdc5('0x95')]=moment()['format'](_0xcdc5('0x73'));_0x5658be[_0xcdc5('0x88')]=moment()[_0xcdc5('0x4e')](_0xcdc5('0x73'));logger['debug'](_0xcdc5('0xb0'),_0x5e26d7['uniqueid'],util[_0xcdc5('0x4d')](_0x5658be,{'showHidden':![],'depth':null}));ami[_0xcdc5('0x49')](_0xcdc5('0xb1'),_0x5658be);break;default:_0x5658be['queuecallerexit']=!![];_0x5658be[_0xcdc5('0x95')]=moment()['format'](_0xcdc5('0x73'));_0x5658be[_0xcdc5('0x88')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x5658be['queuecallerabandon']=![];_0x5658be['queuecallerabandonAt']=null;_0x5658be['queuecallerexitreason']=_0x5e26d7[_0xcdc5('0xab')];this[_0xcdc5('0x13')][_0x5e26d7['uniqueid']]=_0x5658be;this[_0xcdc5('0x47')](_0x5658be,_0xcdc5('0x24'));}else if(this['isNotNull'](_0x5e26d7[_0xcdc5('0xaa')])&&this[_0xcdc5('0x6e')](_0x5e26d7[_0xcdc5('0xaa')][_0xcdc5('0xb2')])){if(!_0x5658be[_0xcdc5('0x20')]){_0x5658be[_0xcdc5('0x94')]=!![];_0x5658be[_0xcdc5('0x95')]=moment()[_0xcdc5('0x4e')](_0xcdc5('0x73'));_0x5658be[_0xcdc5('0x84')]=_0xcdc5('0xb3');_0x5658be[_0xcdc5('0x88')]=moment()[_0xcdc5('0x4e')](_0xcdc5('0x73'));this[_0xcdc5('0x13')][_0x5e26d7['uniqueid']]=_0x5658be;}}logger[_0xcdc5('0x77')](_0xcdc5('0xb4'),_0x5e26d7[_0xcdc5('0x4c')],_0x5658be[_0xcdc5('0x50')],_0x5658be[_0xcdc5('0x56')],_[_0xcdc5('0x7a')](_0x5e26d7['variable'])[0x0],_0x5e26d7[_0xcdc5('0xab')]);_0x5658be[_0xcdc5('0x16')]=this[_0xcdc5('0x16')][_0x5e26d7[_0xcdc5('0x4c')]];}}}}catch(_0x570a2c){logger[_0xcdc5('0x40')](_0xcdc5('0xa8'),_0x5e26d7[_0xcdc5('0x4c')],util['inspect'](_0x570a2c,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xcdc5('0xb')][_0xcdc5('0xa9')]=function(_0x27e1e0,_0x1b6408,_0x2bad67){var _0x23f223=['rtpaudioqos',_0xcdc5('0xb5'),_0xcdc5('0xb6'),_0xcdc5('0xb7'),_0xcdc5('0xb8'),_0xcdc5('0xb9'),'rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid',_0xcdc5('0xba'),_0xcdc5('0xbb'),_0xcdc5('0xbc'),'membercalls',_0xcdc5('0xbd'),_0xcdc5('0xbe'),_0xcdc5('0xbf'),_0xcdc5('0x93'),'memberpenalty',_0xcdc5('0xc0')];if(!_[_0xcdc5('0xc1')](_0x1b6408)&&!_[_0xcdc5('0xc2')](_0x23f223,_0x1b6408)){if(_[_0xcdc5('0xc3')](this[_0xcdc5('0x16')][_0x27e1e0])){this['variables'][_0x27e1e0]={};}this['variables'][_0x27e1e0][_0x1b6408]=_0x2bad67;}};VoiceQueueReport[_0xcdc5('0xb')][_0xcdc5('0xc4')]=function(_0x51a02c,_0x3cfd15,_0x1febd5){try{var _0x129aaa={};if(this[_0xcdc5('0x10')][_0x51a02c]){for(var _0x302266=0x0;_0x302266=0x0?moment(_0xfcc0f0['endtime'])['diff'](_0xfcc0f0[_0xa434('0x18')],_0xa434('0xf')):null,'data1':_0xa434('0x1b'),'data2':_0xfcc0f0['accountcode'],'data3':_0xfcc0f0[_0xa434('0x11')],'data4':_0xfcc0f0[_0xa434('0x1c')]||null,'role':_0xa434('0x12'),'internal':_0xfcc0f0[_0xa434('0x13')]?_[_0xa434('0x14')](_0xfcc0f0['accountcode']):undefined,'uniqueid':_0xfcc0f0[_0xa434('0x1d')]},'log':_0xa434('0x15')});}; \ No newline at end of file +var _0x53d0=['voiceDialReport','membername','starttime','endtime','dialstring','uniqueid','lodash','util','voiceQueueReport','queuecallercompleteAt','queuecallerexitAt','Request','CreateMemberReport','voice','lastAssignedTo','format','interface','TALKING','queuecallerleaveAt','diff','seconds','inbound','calleridnum','exten','agent','accountcode','toNumber'];(function(_0xce372d,_0x5571c6){var _0x2dab19=function(_0x753c26){while(--_0x753c26){_0xce372d['push'](_0xce372d['shift']());}};_0x2dab19(++_0x5571c6);}(_0x53d0,0x1ec));var _0x053d=function(_0x469553,_0x3a857f){_0x469553=_0x469553-0x0;var _0x8cc0e5=_0x53d0[_0x469553];return _0x8cc0e5;};'use strict';var moment=require('moment');var _=require(_0x053d('0x0'));var util=require(_0x053d('0x1'));var client=require('../client');exports[_0x053d('0x2')]=function(_0x1789e6){var _0x380815=_0x1789e6[_0x053d('0x3')]||_0x1789e6[_0x053d('0x4')];return client[_0x053d('0x5')](_0x053d('0x6'),{'body':{'channel':_0x053d('0x7'),'membername':_0x1789e6[_0x053d('0x8')],'interface':_['isNil'](_0x1789e6['interface'])?util[_0x053d('0x9')]('SIP/%s',_0x1789e6['lastAssignedTo']):_0x1789e6[_0x053d('0xa')],'type':_0x053d('0xb'),'enterAt':_0x1789e6[_0x053d('0xc')],'exitAt':_0x380815,'duration':moment(_0x380815)[_0x053d('0xd')](_0x1789e6[_0x053d('0xc')],_0x053d('0xe')),'data1':_0x053d('0xf'),'data2':_0x1789e6[_0x053d('0x10')],'data3':_0x1789e6[_0x053d('0x11')],'data4':null,'data5':_0x1789e6['queue'],'role':_0x053d('0x12'),'internal':_0x1789e6[_0x053d('0x13')]?_[_0x053d('0x14')](_0x1789e6[_0x053d('0x13')]):undefined,'uniqueid':_0x1789e6['uniqueid']},'log':_0x053d('0x6')});};exports[_0x053d('0x15')]=function(_0x1c6e20){return client[_0x053d('0x5')]('CreateMemberReport',{'body':{'channel':'voice','membername':_0x1c6e20[_0x053d('0x16')],'interface':_0x1c6e20[_0x053d('0xa')],'type':_0x053d('0xb'),'enterAt':_0x1c6e20[_0x053d('0x17')],'exitAt':_0x1c6e20[_0x053d('0x18')],'duration':moment(_0x1c6e20[_0x053d('0x18')])[_0x053d('0xd')](_0x1c6e20[_0x053d('0x17')],_0x053d('0xe'))>=0x0?moment(_0x1c6e20[_0x053d('0x18')])[_0x053d('0xd')](_0x1c6e20[_0x053d('0x17')],_0x053d('0xe')):null,'data1':'outbound','data2':_0x1c6e20['accountcode'],'data3':_0x1c6e20[_0x053d('0x11')],'data4':_0x1c6e20[_0x053d('0x19')]||null,'role':_0x053d('0x12'),'internal':_0x1c6e20['accountcode']?_[_0x053d('0x14')](_0x1c6e20['accountcode']):undefined,'uniqueid':_0x1c6e20[_0x053d('0x1a')]},'log':_0x053d('0x6')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index b9300d0..b10d818 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 _0xae8e=['getSettings','Request','ShowSetting','stopRecordingOnTransfer','previewRecallmeReminderInterval','GetSettings','../client'];(function(_0x4044d3,_0x5b25d5){var _0x466918=function(_0x6acc01){while(--_0x6acc01){_0x4044d3['push'](_0x4044d3['shift']());}};_0x466918(++_0x5b25d5);}(_0xae8e,0xc3));var _0xeae8=function(_0x53b0a3,_0x9b10c1){_0x53b0a3=_0x53b0a3-0x0;var _0x460fa7=_0xae8e[_0x53b0a3];return _0x460fa7;};'use strict';var client=require(_0xeae8('0x0'));exports[_0xeae8('0x1')]=function(){return client[_0xeae8('0x2')](_0xeae8('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xeae8('0x4'),_0xeae8('0x5')]},'log':_0xeae8('0x6')});}; \ No newline at end of file +var _0x88b5=['GetSettings','../client','getSettings','Request','stopRecordingOnTransfer','previewRecallmeReminderInterval'];(function(_0x3e31ca,_0x275bc3){var _0x185362=function(_0x22bd16){while(--_0x22bd16){_0x3e31ca['push'](_0x3e31ca['shift']());}};_0x185362(++_0x275bc3);}(_0x88b5,0x10f));var _0x588b=function(_0x3f3e84,_0x242e97){_0x3f3e84=_0x3f3e84-0x0;var _0x106b35=_0x88b5[_0x3f3e84];return _0x106b35;};'use strict';var client=require(_0x588b('0x0'));exports[_0x588b('0x1')]=function(){return client[_0x588b('0x2')]('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x588b('0x3'),_0x588b('0x4')]},'log':_0x588b('0x5')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index df23838..7c2f242 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 _0x0e30=['html','Request','GetTemplate','name'];(function(_0x3800d3,_0x428dfd){var _0x491c71=function(_0x55a174){while(--_0x55a174){_0x3800d3['push'](_0x3800d3['shift']());}};_0x491c71(++_0x428dfd);}(_0x0e30,0x1d5));var _0x00e3=function(_0x1eeedd,_0x21408b){_0x1eeedd=_0x1eeedd-0x0;var _0x12d287=_0x0e30[_0x1eeedd];return _0x12d287;};'use strict';var client=require('../client');exports['getTemplates']=function(_0x2c185d){return function(_0x4796bd){return client[_0x00e3('0x0')](_0x00e3('0x1'),{'options':{'raw':!![],'attributes':['id',_0x00e3('0x2'),_0x00e3('0x3')]},'log':_0x00e3('0x1')});};}; \ No newline at end of file +var _0x0055=['Request','GetTemplate','name','../client','getTemplates'];(function(_0x4b95e9,_0x2daed9){var _0x59f861=function(_0x5c004a){while(--_0x5c004a){_0x4b95e9['push'](_0x4b95e9['shift']());}};_0x59f861(++_0x2daed9);}(_0x0055,0x1ed));var _0x5005=function(_0x866bc7,_0x1aedbc){_0x866bc7=_0x866bc7-0x0;var _0x1c99b3=_0x0055[_0x866bc7];return _0x1c99b3;};'use strict';var client=require(_0x5005('0x0'));exports[_0x5005('0x1')]=function(_0x528160){return function(_0x356160){return client[_0x5005('0x2')](_0x5005('0x3'),{'options':{'raw':!![],'attributes':['id',_0x5005('0x4'),'html']},'log':_0x5005('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index dd5693c..99b7e2b 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 _0x43c6=['name','channel','status','Condition','AllConditions','field','value','AnyConditions','Actions','action','data1','data2','data3','data4','data5','data6','data7','../client','getTriggers','Request','GetTrigger'];(function(_0x3ecc8d,_0x3e3034){var _0x46e02a=function(_0x44d583){while(--_0x44d583){_0x3ecc8d['push'](_0x3ecc8d['shift']());}};_0x46e02a(++_0x3e3034);}(_0x43c6,0xce));var _0x643c=function(_0x1cebd6,_0x2425f5){_0x1cebd6=_0x1cebd6-0x0;var _0x11bebe=_0x43c6[_0x1cebd6];return _0x11bebe;};'use strict';var client=require(_0x643c('0x0'));exports[_0x643c('0x1')]=function(_0x14ef74){return function(_0x405ae7){return client[_0x643c('0x2')](_0x643c('0x3'),{'options':{'raw':![],'attributes':['id',_0x643c('0x4'),_0x643c('0x5'),_0x643c('0x6')],'include':[{'model':_0x643c('0x7'),'as':_0x643c('0x8'),'attributes':['id',_0x643c('0x9'),'operator',_0x643c('0xa')]},{'model':_0x643c('0x7'),'as':_0x643c('0xb'),'attributes':['id',_0x643c('0x9'),'operator',_0x643c('0xa')]},{'model':'Action','as':_0x643c('0xc'),'attributes':['id',_0x643c('0xd'),_0x643c('0xe'),_0x643c('0xf'),_0x643c('0x10'),_0x643c('0x11'),_0x643c('0x12'),_0x643c('0x13'),_0x643c('0x14')]}]},'log':_0x643c('0x3')});};}; \ No newline at end of file +var _0xb4a7=['operator','value','AnyConditions','Action','Actions','data1','data2','data3','data4','data5','../client','getTriggers','Request','GetTrigger','name','status','Condition','AllConditions','field'];(function(_0x28cc13,_0x2298f7){var _0x8e95f9=function(_0x3c309b){while(--_0x3c309b){_0x28cc13['push'](_0x28cc13['shift']());}};_0x8e95f9(++_0x2298f7);}(_0xb4a7,0x1e5));var _0x7b4a=function(_0x52ce4b,_0x416285){_0x52ce4b=_0x52ce4b-0x0;var _0x12d388=_0xb4a7[_0x52ce4b];return _0x12d388;};'use strict';var client=require(_0x7b4a('0x0'));exports[_0x7b4a('0x1')]=function(_0x4308dd){return function(_0x2ee8a4){return client[_0x7b4a('0x2')](_0x7b4a('0x3'),{'options':{'raw':![],'attributes':['id',_0x7b4a('0x4'),'channel',_0x7b4a('0x5')],'include':[{'model':_0x7b4a('0x6'),'as':_0x7b4a('0x7'),'attributes':['id',_0x7b4a('0x8'),_0x7b4a('0x9'),_0x7b4a('0xa')]},{'model':_0x7b4a('0x6'),'as':_0x7b4a('0xb'),'attributes':['id','field',_0x7b4a('0x9'),_0x7b4a('0xa')]},{'model':_0x7b4a('0xc'),'as':_0x7b4a('0xd'),'attributes':['id','action',_0x7b4a('0xe'),_0x7b4a('0xf'),_0x7b4a('0x10'),_0x7b4a('0x11'),_0x7b4a('0x12'),'data6','data7']}]},'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 b9a0dfa..84834ce 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 _0x8ebc=['defaultuser','../client','GetTrunk','name','registry'];(function(_0x4b86da,_0x3f9173){var _0x115386=function(_0x3a63b9){while(--_0x3a63b9){_0x4b86da['push'](_0x4b86da['shift']());}};_0x115386(++_0x3f9173);}(_0x8ebc,0x18c));var _0xc8eb=function(_0x1786b7,_0x25bfc1){_0x1786b7=_0x1786b7-0x0;var _0x415e7c=_0x8ebc[_0x1786b7];return _0x415e7c;};'use strict';var client=require(_0xc8eb('0x0'));exports['getTrunks']=function(_0x38ee5e){return function(_0x13ca7b){return client['Request'](_0xc8eb('0x1'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0xc8eb('0x2'),_0xc8eb('0x3'),_0xc8eb('0x4')]},'log':'GetTrunk'});};}; \ No newline at end of file +var _0x6510=['../client','getTrunks','Request','name','registry','defaultuser','GetTrunk'];(function(_0x13b006,_0x57e7ec){var _0x552733=function(_0x1f8fcf){while(--_0x1f8fcf){_0x13b006['push'](_0x13b006['shift']());}};_0x552733(++_0x57e7ec);}(_0x6510,0x77));var _0x0651=function(_0x281f74,_0x4edfe1){_0x281f74=_0x281f74-0x0;var _0x57669b=_0x6510[_0x281f74];return _0x57669b;};'use strict';var client=require(_0x0651('0x0'));exports[_0x0651('0x1')]=function(_0x1ce53b){return function(_0x1668b0){return client[_0x0651('0x2')]('GetTrunk',{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x0651('0x3'),_0x0651('0x4'),_0x0651('0x5')]},'log':_0x0651('0x6')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index 8919ffb..3eebc09 100644 --- a/server/services/ami/rpc/user.js +++ b/server/services/ami/rpc/user.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['online','pauseType','Request','GetUser','agent','name','email','accountcode','lastLoginAt','lastPauseAt','voicePause','phone','mobile','interface','getTelephones','telephone','internal','PauseUser','savePause','getAgent','ShowUser','fullname'];(function(_0x1bd38a,_0x3a4e11){var _0x14d62b=function(_0xa6921f){while(--_0xa6921f){_0x1bd38a['push'](_0x1bd38a['shift']());}};_0x14d62b(++_0x3a4e11);}(_0x9c44,0x178));var _0x49c4=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x9c44[_0x3ab51d];return _0x29a04e;};'use strict';var client=require('../client');exports['getAgents']=function(){return function(){return client[_0x49c4('0x0')](_0x49c4('0x1'),{'options':{'raw':![],'where':{'role':_0x49c4('0x2')},'attributes':['id',_0x49c4('0x3'),_0x49c4('0x4'),_0x49c4('0x5'),'fullname','online',_0x49c4('0x6'),'pauseType',_0x49c4('0x7'),_0x49c4('0x8'),_0x49c4('0x9'),_0x49c4('0xa'),_0x49c4('0xb')]},'log':'getAgents'});};};exports[_0x49c4('0xc')]=function(){return function(){return client[_0x49c4('0x0')](_0x49c4('0x1'),{'options':{'raw':!![],'where':{'role':_0x49c4('0xd')},'attributes':['id','name','accountcode',_0x49c4('0xe')]},'log':_0x49c4('0xc')});};};exports['savePause']=function(_0xb611a1,_0x459d09,_0x4adb3c){return client['Request'](_0x49c4('0xf'),{'body':{'type':_0x459d09,'uniqueid':_0x4adb3c},'options':{'where':{'id':_0xb611a1['id']}},'log':_0x49c4('0x10')});};exports['saveUnpause']=function(_0x7df3a9){return client[_0x49c4('0x0')]('UnpauseUser',{'body':{},'options':{'where':{'id':_0x7df3a9['id']}},'log':_0x49c4('0x10')});};exports[_0x49c4('0x11')]=function(_0x21f15a){return client[_0x49c4('0x0')](_0x49c4('0x12'),{'options':{'raw':![],'where':{'role':_0x49c4('0x2'),'id':_0x21f15a},'attributes':['id',_0x49c4('0x3'),_0x49c4('0x4'),'accountcode',_0x49c4('0x13'),_0x49c4('0x14'),_0x49c4('0x6'),_0x49c4('0x15'),_0x49c4('0x7'),'voicePause',_0x49c4('0xb')]},'log':_0x49c4('0x11')});}; \ No newline at end of file +var _0x9c44=['online','pauseType','Request','GetUser','agent','name','email','accountcode','lastLoginAt','lastPauseAt','voicePause','phone','mobile','interface','getTelephones','telephone','internal','PauseUser','savePause','getAgent','ShowUser','fullname'];(function(_0x3bf241,_0x5b5cfd){var _0x5d8954=function(_0x47a139){while(--_0x47a139){_0x3bf241['push'](_0x3bf241['shift']());}};_0x5d8954(++_0x5b5cfd);}(_0x9c44,0x178));var _0x49c4=function(_0x2d2c16,_0x4e88b6){_0x2d2c16=_0x2d2c16-0x0;var _0x53f2fb=_0x9c44[_0x2d2c16];return _0x53f2fb;};'use strict';var client=require('../client');exports['getAgents']=function(){return function(){return client[_0x49c4('0x0')](_0x49c4('0x1'),{'options':{'raw':![],'where':{'role':_0x49c4('0x2')},'attributes':['id',_0x49c4('0x3'),_0x49c4('0x4'),_0x49c4('0x5'),'fullname','online',_0x49c4('0x6'),'pauseType',_0x49c4('0x7'),_0x49c4('0x8'),_0x49c4('0x9'),_0x49c4('0xa'),_0x49c4('0xb')]},'log':'getAgents'});};};exports[_0x49c4('0xc')]=function(){return function(){return client[_0x49c4('0x0')](_0x49c4('0x1'),{'options':{'raw':!![],'where':{'role':_0x49c4('0xd')},'attributes':['id','name','accountcode',_0x49c4('0xe')]},'log':_0x49c4('0xc')});};};exports['savePause']=function(_0xb611a1,_0x459d09,_0x4adb3c){return client['Request'](_0x49c4('0xf'),{'body':{'type':_0x459d09,'uniqueid':_0x4adb3c},'options':{'where':{'id':_0xb611a1['id']}},'log':_0x49c4('0x10')});};exports['saveUnpause']=function(_0x7df3a9){return client[_0x49c4('0x0')]('UnpauseUser',{'body':{},'options':{'where':{'id':_0x7df3a9['id']}},'log':_0x49c4('0x10')});};exports[_0x49c4('0x11')]=function(_0x21f15a){return client[_0x49c4('0x0')](_0x49c4('0x12'),{'options':{'raw':![],'where':{'role':_0x49c4('0x2'),'id':_0x21f15a},'attributes':['id',_0x49c4('0x3'),_0x49c4('0x4'),'accountcode',_0x49c4('0x13'),_0x49c4('0x14'),_0x49c4('0x6'),_0x49c4('0x15'),_0x49c4('0x7'),'voicePause',_0x49c4('0xb')]},'log':_0x49c4('0x11')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index 68b0746..8857e5f 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 _0x2fc0=['create','CreateVoiceAgentReport','update','Request','UpdateVoiceAgentReport','../client'];(function(_0x4b39df,_0x122e1e){var _0x159413=function(_0x4ff9e1){while(--_0x4ff9e1){_0x4b39df['push'](_0x4b39df['shift']());}};_0x159413(++_0x122e1e);}(_0x2fc0,0xe3));var _0x02fc=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x2fc0[_0x20a584];return _0x4b41a8;};'use strict';var client=require(_0x02fc('0x0'));exports[_0x02fc('0x1')]=function(_0x40192e){return client['Request'](_0x02fc('0x2'),{'body':_0x40192e,'log':_0x02fc('0x2')});};exports[_0x02fc('0x3')]=function(_0x17a93a,_0x39d6b4,_0x2ee48e){return client[_0x02fc('0x4')](_0x02fc('0x5'),{'body':_0x17a93a,'options':{'where':{'uniqueid':_0x39d6b4,'interface':_0x2ee48e,'agentcomplete':!![]}},'log':_0x02fc('0x5')});}; \ No newline at end of file +var _0x1702=['Request','CreateVoiceAgentReport','update','UpdateVoiceAgentReport','../client','create'];(function(_0x3db6e0,_0x5dac8f){var _0x59d4ee=function(_0x263760){while(--_0x263760){_0x3db6e0['push'](_0x3db6e0['shift']());}};_0x59d4ee(++_0x5dac8f);}(_0x1702,0x82));var _0x2170=function(_0x47ab24,_0x85c476){_0x47ab24=_0x47ab24-0x0;var _0x56e173=_0x1702[_0x47ab24];return _0x56e173;};'use strict';var client=require(_0x2170('0x0'));exports[_0x2170('0x1')]=function(_0x55f757){return client[_0x2170('0x2')](_0x2170('0x3'),{'body':_0x55f757,'log':_0x2170('0x3')});};exports[_0x2170('0x4')]=function(_0x2ccb76,_0xcc71b6,_0x3e07fc){return client[_0x2170('0x2')](_0x2170('0x5'),{'body':_0x2ccb76,'options':{'where':{'uniqueid':_0xcc71b6,'interface':_0x3e07fc,'agentcomplete':!![]}},'log':'UpdateVoiceAgentReport'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index b2dc4b8..e8a0a88 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 _0x2950=['context','callerid','DOCUMENTATION','GetVoiceCallReport','outbound','startOf','YYYY-MM-DD\x20HH:mm:ss','endOf','day','disposition','duration','billableseconds','GetVoiceCallReports','moment','util','lodash','../client','create','Request','CreateVoiceCallReport','calleridnum'];(function(_0x4b6830,_0x2bf6fb){var _0x239e4a=function(_0x364735){while(--_0x364735){_0x4b6830['push'](_0x4b6830['shift']());}};_0x239e4a(++_0x2bf6fb);}(_0x2950,0x19c));var _0x0295=function(_0x35a99b,_0x34ede0){_0x35a99b=_0x35a99b-0x0;var _0x521f1a=_0x2950[_0x35a99b];return _0x521f1a;};'use strict';var moment=require(_0x0295('0x0'));var util=require(_0x0295('0x1'));var _=require(_0x0295('0x2'));var client=require(_0x0295('0x3'));exports[_0x0295('0x4')]=function(_0x9601e3){return client[_0x0295('0x5')](_0x0295('0x6'),{'body':_['merge'](_0x9601e3,{'source':_0x9601e3[_0x0295('0x7')],'destinationcontext':_0x9601e3[_0x0295('0x8')],'callerid':_0x9601e3[_0x0295('0x9')],'amaflags':_0x0295('0xa')}),'log':_0x0295('0x6')});};exports['getVoiceCallReports']=function(){return function(){return client['Request'](_0x0295('0xb'),{'options':{'where':{'type':[_0x0295('0xc')],'createdAt':{'$between':[moment()[_0x0295('0xd')]('day')['format'](_0x0295('0xe')),moment()[_0x0295('0xf')](_0x0295('0x10'))['format'](_0x0295('0xe'))]}},'attributes':['type',_0x0295('0x11'),_0x0295('0x12'),_0x0295('0x13')]},'log':_0x0295('0x14')});};}; \ No newline at end of file +var _0x55e0=['create','CreateVoiceCallReport','merge','Request','GetVoiceCallReport','outbound','startOf','endOf','disposition','billableseconds','GetVoiceCallReports','util','lodash','../client'];(function(_0x4d0ebd,_0x17ab0b){var _0x594e9c=function(_0x4d22ab){while(--_0x4d22ab){_0x4d0ebd['push'](_0x4d0ebd['shift']());}};_0x594e9c(++_0x17ab0b);}(_0x55e0,0xa5));var _0x055e=function(_0x2358a6,_0x44cfb7){_0x2358a6=_0x2358a6-0x0;var _0x4e6bb6=_0x55e0[_0x2358a6];return _0x4e6bb6;};'use strict';var moment=require('moment');var util=require(_0x055e('0x0'));var _=require(_0x055e('0x1'));var client=require(_0x055e('0x2'));exports[_0x055e('0x3')]=function(_0x4bdc66){return client['Request'](_0x055e('0x4'),{'body':_[_0x055e('0x5')](_0x4bdc66,{'source':_0x4bdc66['calleridnum'],'destinationcontext':_0x4bdc66['context'],'callerid':_0x4bdc66['callerid'],'amaflags':'DOCUMENTATION'}),'log':_0x055e('0x4')});};exports['getVoiceCallReports']=function(){return function(){return client[_0x055e('0x6')](_0x055e('0x7'),{'options':{'where':{'type':[_0x055e('0x8')],'createdAt':{'$between':[moment()[_0x055e('0x9')]('day')['format']('YYYY-MM-DD\x20HH:mm:ss'),moment()[_0x055e('0xa')]('day')['format']('YYYY-MM-DD\x20HH:mm:ss')]}},'attributes':['type',_0x055e('0xb'),'duration',_0x055e('0xc')]},'log':_0x055e('0xd')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index cbfdd4d..16991b9 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 _0xbbe4=['Request','create'];(function(_0x22d5ef,_0x33fd8e){var _0x2b02bb=function(_0x1eff85){while(--_0x1eff85){_0x22d5ef['push'](_0x22d5ef['shift']());}};_0x2b02bb(++_0x33fd8e);}(_0xbbe4,0x137));var _0x4bbe=function(_0x1d0764,_0x2beb7c){_0x1d0764=_0x1d0764-0x0;var _0x423f49=_0xbbe4[_0x1d0764];return _0x423f49;};'use strict';var client=require('../client');exports[_0x4bbe('0x0')]=function(_0x13c2db){return client[_0x4bbe('0x1')]('CreateVoiceDialReport',{'body':_0x13c2db,'log':'CreateVoiceDialReport'});}; \ No newline at end of file +var _0xb3f2=['Request','../client','create'];(function(_0xd9caad,_0x5856b7){var _0x3127e6=function(_0x15aacc){while(--_0x15aacc){_0xd9caad['push'](_0xd9caad['shift']());}};_0x3127e6(++_0x5856b7);}(_0xb3f2,0x121));var _0x2b3f=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0xb3f2[_0x173441];return _0x2423a8;};'use strict';var client=require(_0x2b3f('0x0'));exports[_0x2b3f('0x1')]=function(_0x1aa4b6){return client[_0x2b3f('0x2')]('CreateVoiceDialReport',{'body':_0x1aa4b6,'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 0ed95cd..6f6a214 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 _0x6e16=['exten','getVoiceExtensions','Request'];(function(_0x31a938,_0x4daec6){var _0x1bf341=function(_0x514261){while(--_0x514261){_0x31a938['push'](_0x31a938['shift']());}};_0x1bf341(++_0x4daec6);}(_0x6e16,0x1d3));var _0x66e1=function(_0x25e7af,_0x3068d6){_0x25e7af=_0x25e7af-0x0;var _0x27bf61=_0x6e16[_0x25e7af];return _0x27bf61;};'use strict';var client=require('../client');exports['getVoiceExtensions']=function(){return function(){return client[_0x66e1('0x0')]('GetVoiceExtension',{'options':{'raw':!![],'attributes':['id',_0x66e1('0x1'),'recordingFormat'],'where':{'VoiceExtensionId':null}},'log':_0x66e1('0x2')});};}; \ No newline at end of file +var _0x3306=['Request','GetVoiceExtension','recordingFormat','../client','getVoiceExtensions'];(function(_0x14b12c,_0x5ccd51){var _0x290ddb=function(_0x9072a9){while(--_0x9072a9){_0x14b12c['push'](_0x14b12c['shift']());}};_0x290ddb(++_0x5ccd51);}(_0x3306,0x107));var _0x6330=function(_0x31aa09,_0x3c8d50){_0x31aa09=_0x31aa09-0x0;var _0x573071=_0x3306[_0x31aa09];return _0x573071;};'use strict';var client=require(_0x6330('0x0'));exports[_0x6330('0x1')]=function(){return function(){return client[_0x6330('0x2')](_0x6330('0x3'),{'options':{'raw':!![],'attributes':['id','exten',_0x6330('0x4')],'where':{'VoiceExtensionId':null}},'log':_0x6330('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index f1b323f..7a5c933 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 _0xb8f7=['Interval','Intervals','interval','getVoiceQueues','../client','Request','GetVoiceQueue','name','acwTimeout','autopause','monitor_format','type','dialActive','dialMethod','dialLimitChannel','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyRetryFrequency','dialNoAnswerRetryFrequency','dialTimezone','dialPrefix','dialAMDActive','dialAMDGreeting','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupClient','dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMinThreshold','dialPreviewRecallmeReminder','Trunk','callerid','active','Pause','TrunkBackup'];(function(_0x41a5a0,_0x3bee12){var _0x2190f8=function(_0x3019e1){while(--_0x3019e1){_0x41a5a0['push'](_0x41a5a0['shift']());}};_0x2190f8(++_0x3bee12);}(_0xb8f7,0x1af));var _0x7b8f=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0xb8f7[_0x3e5086];return _0xfeb102;};'use strict';var client=require(_0x7b8f('0x0'));exports['getVoiceQueues']=function(){return function(){return client[_0x7b8f('0x1')](_0x7b8f('0x2'),{'options':{'raw':![],'attributes':['id',_0x7b8f('0x3'),'acw',_0x7b8f('0x4'),_0x7b8f('0x5'),_0x7b8f('0x6'),_0x7b8f('0x7'),_0x7b8f('0x8'),_0x7b8f('0x9'),_0x7b8f('0xa'),'dialLimitQueue','dialPowerLevel','dialPredictiveOptimization',_0x7b8f('0xb'),_0x7b8f('0xc'),_0x7b8f('0xd'),_0x7b8f('0xe'),_0x7b8f('0xf'),_0x7b8f('0x10'),_0x7b8f('0x11'),'dialQueueProject',_0x7b8f('0x12'),_0x7b8f('0x13'),'dialBusyMaxRetry',_0x7b8f('0x14'),'dialNoAnswerMaxRetry',_0x7b8f('0x15'),'dialGlobalMaxRetry',_0x7b8f('0x16'),'dialGlobalInterval',_0x7b8f('0x17'),'dialCheckDuplicateType',_0x7b8f('0x18'),'dialAMDInitialSilence',_0x7b8f('0x19'),'dialAMDAfterGreetingSilence',_0x7b8f('0x1a'),_0x7b8f('0x1b'),_0x7b8f('0x1c'),_0x7b8f('0x1d'),_0x7b8f('0x1e'),_0x7b8f('0x1f'),_0x7b8f('0x20'),_0x7b8f('0x21'),_0x7b8f('0x22'),_0x7b8f('0x23'),'dialAgiAfterHangupAgent',_0x7b8f('0x24'),_0x7b8f('0x25'),_0x7b8f('0x6'),_0x7b8f('0x26'),_0x7b8f('0x27'),_0x7b8f('0x28'),_0x7b8f('0x29'),_0x7b8f('0x2a'),_0x7b8f('0x2b'),'dialDropRetryFrequency','dialAbandonedMaxRetry',_0x7b8f('0x2c'),_0x7b8f('0x2d'),_0x7b8f('0x2e'),_0x7b8f('0x2f'),_0x7b8f('0x30'),_0x7b8f('0x31'),'dialPredictiveIntervalMaxThreshold',_0x7b8f('0x32'),'dialPreviewAutoRecallMe',_0x7b8f('0x33')],'include':[{'model':_0x7b8f('0x34'),'as':_0x7b8f('0x34'),'attributes':['id',_0x7b8f('0x3'),_0x7b8f('0x35'),_0x7b8f('0x36')]},{'model':_0x7b8f('0x37'),'as':'mandatoryDispositionPause','attributes':['id',_0x7b8f('0x3')]},{'model':_0x7b8f('0x34'),'as':_0x7b8f('0x38'),'attributes':['id',_0x7b8f('0x3'),'callerid',_0x7b8f('0x36')]},{'model':_0x7b8f('0x39'),'as':'Interval','attributes':['id','name'],'include':[{'model':_0x7b8f('0x39'),'as':_0x7b8f('0x3a'),'attributes':['id',_0x7b8f('0x3'),_0x7b8f('0x3b')]}]}]},'log':_0x7b8f('0x3c')});};}; \ No newline at end of file +var _0x43e4=['dialAbandonedMaxRetry','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','Trunk','callerid','Pause','TrunkBackup','active','Interval','Intervals','interval','../client','getVoiceQueues','Request','GetVoiceQueue','name','acw','acwTimeout','autopause','monitor_format','type','dialActive','dialMethod','dialLimitChannel','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialOriginateCallerIdName','dialOriginateTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialPrefix','dialAMDActive','dialAMDAfterGreetingSilence','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialRecallMeTimeout','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','strategy','dialCutDigit','dialNoSuchNumberRetryFrequency','dialDropRetryFrequency'];(function(_0x19e962,_0xeadd0){var _0x57f907=function(_0x497b70){while(--_0x497b70){_0x19e962['push'](_0x19e962['shift']());}};_0x57f907(++_0xeadd0);}(_0x43e4,0x15a));var _0x443e=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x43e4[_0x2b4411];return _0x8e41ef;};'use strict';var client=require(_0x443e('0x0'));exports[_0x443e('0x1')]=function(){return function(){return client[_0x443e('0x2')](_0x443e('0x3'),{'options':{'raw':![],'attributes':['id',_0x443e('0x4'),_0x443e('0x5'),_0x443e('0x6'),_0x443e('0x7'),_0x443e('0x8'),_0x443e('0x9'),_0x443e('0xa'),_0x443e('0xb'),_0x443e('0xc'),'dialLimitQueue',_0x443e('0xd'),_0x443e('0xe'),_0x443e('0xf'),'dialPredictiveInterval',_0x443e('0x10'),'dialOriginateCallerIdNumber',_0x443e('0x11'),'dialQueueOptions','dialQueueTimeout',_0x443e('0x12'),_0x443e('0x13'),_0x443e('0x14'),'dialBusyMaxRetry','dialBusyRetryFrequency',_0x443e('0x15'),_0x443e('0x16'),_0x443e('0x17'),'dialTimezone','dialGlobalInterval',_0x443e('0x18'),'dialCheckDuplicateType',_0x443e('0x19'),'dialAMDInitialSilence','dialAMDGreeting',_0x443e('0x1a'),'dialAMDTotalAnalysisTime',_0x443e('0x1b'),_0x443e('0x1c'),_0x443e('0x1d'),'dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout',_0x443e('0x1e'),'dialRecallInQueue',_0x443e('0x1f'),_0x443e('0x20'),_0x443e('0x21'),_0x443e('0x22'),_0x443e('0x8'),_0x443e('0x23'),'dialRandomLastDigitCallerIdNumber',_0x443e('0x24'),'dialNoSuchNumberMaxRetry',_0x443e('0x25'),'dialDropMaxRetry',_0x443e('0x26'),_0x443e('0x27'),'dialAbandonedRetryFrequency',_0x443e('0x28'),_0x443e('0x29'),'dialAgentRejectMaxRetry',_0x443e('0x2a'),_0x443e('0x2b'),_0x443e('0x2c'),'dialPredictiveIntervalMinThreshold',_0x443e('0x2d'),_0x443e('0x2e')],'include':[{'model':_0x443e('0x2f'),'as':_0x443e('0x2f'),'attributes':['id','name',_0x443e('0x30'),'active']},{'model':_0x443e('0x31'),'as':'mandatoryDispositionPause','attributes':['id','name']},{'model':_0x443e('0x2f'),'as':_0x443e('0x32'),'attributes':['id','name',_0x443e('0x30'),_0x443e('0x33')]},{'model':_0x443e('0x34'),'as':_0x443e('0x34'),'attributes':['id',_0x443e('0x4')],'include':[{'model':_0x443e('0x34'),'as':_0x443e('0x35'),'attributes':['id',_0x443e('0x4'),_0x443e('0x36')]}]}]},'log':_0x443e('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index a48cc3a..18ef903 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(_0x1bb032,_0x131c6d){var _0xbc6938=function(_0x17f568){while(--_0x17f568){_0x1bb032['push'](_0x1bb032['shift']());}};_0xbc6938(++_0x131c6d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0xa9e0[_0x28947d];return _0x12d2ee;};'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(_0x58e249,_0x3c42f4){var _0x4cf504=function(_0x399042){while(--_0x399042){_0x58e249['push'](_0x58e249['shift']());}};_0x4cf504(++_0x3c42f4);}(_0xa9e0,0x123));var _0x0a9e=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0xa9e0[_0xc6be3a];return _0x56a310;};'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 8b01379..5df6931 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 _0x13d5=['GetVoiceQueueRtPauses','getVoiceQueueRtPauses','Request'];(function(_0x3cbe1c,_0x4bcabd){var _0x5ee08b=function(_0x5c53e6){while(--_0x5c53e6){_0x3cbe1c['push'](_0x3cbe1c['shift']());}};_0x5ee08b(++_0x4bcabd);}(_0x13d5,0xb8));var _0x513d=function(_0x230741,_0x534107){_0x230741=_0x230741-0x0;var _0x48d7a6=_0x13d5[_0x230741];return _0x48d7a6;};'use strict';var client=require('../client');exports[_0x513d('0x0')]=function(_0x4097bb){return function(){return client[_0x513d('0x1')](_0x513d('0x2'),{'options':{'where':{'VoiceQueueId':_0x4097bb,'paused':!![]},'raw':!![]},'log':_0x513d('0x0')});};}; \ No newline at end of file +var _0xf7cd=['../client','getVoiceQueueRtPauses'];(function(_0x5960b8,_0x212dc0){var _0x27e6ff=function(_0x391b1a){while(--_0x391b1a){_0x5960b8['push'](_0x5960b8['shift']());}};_0x27e6ff(++_0x212dc0);}(_0xf7cd,0x19a));var _0xdf7c=function(_0x5429af,_0x9f7dba){_0x5429af=_0x5429af-0x0;var _0x113910=_0xf7cd[_0x5429af];return _0x113910;};'use strict';var client=require(_0xdf7c('0x0'));exports[_0xdf7c('0x1')]=function(_0x396f97){return function(){return client['Request']('GetVoiceQueueRtPauses',{'options':{'where':{'VoiceQueueId':_0x396f97,'paused':!![]},'raw':!![]},'log':_0xdf7c('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index 4b8a582..1f091d6 100644 --- a/server/services/ami/rpc/voiceRecording.js +++ b/server/services/ami/rpc/voiceRecording.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['CreateVoiceRecording','merge','monitorFilename','lodash','../client','create'];(function(_0x164cec,_0x228f0a){var _0x3e94ae=function(_0x334f46){while(--_0x334f46){_0x164cec['push'](_0x164cec['shift']());}};_0x3e94ae(++_0x228f0a);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x7995('0x0'));var client=require(_0x7995('0x1'));exports[_0x7995('0x2')]=function(_0x10a05d){return client['Request'](_0x7995('0x3'),{'body':_[_0x7995('0x4')](_0x10a05d,{'value':_0x10a05d[_0x7995('0x5')]}),'log':_0x7995('0x3')});}; \ No newline at end of file +var _0x7a54=['create','Request','CreateVoiceRecording','monitorFilename','lodash','../client'];(function(_0x1d351a,_0x463237){var _0x318304=function(_0x2da9ee){while(--_0x2da9ee){_0x1d351a['push'](_0x1d351a['shift']());}};_0x318304(++_0x463237);}(_0x7a54,0x106));var _0x47a5=function(_0x49c42c,_0x25a0ed){_0x49c42c=_0x49c42c-0x0;var _0x51fe90=_0x7a54[_0x49c42c];return _0x51fe90;};'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 3fdbb70..af47906 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 _0x9cbe=['transfereeconnectedlinename','transfereecontext','transfereeexten','transfereelinkedid','isexternal','context','extension','blind','CreateVoiceTransferReport','origtransferercalleridname','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','origtransferercontext','origtransfererexten','../client','transfers','blindTransfer','Request','result','transfererchannel','transferercalleridname','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridname','transfereeconnectedlinenum'];(function(_0x4fd64f,_0x593e5b){var _0xd89651=function(_0x242fed){while(--_0x242fed){_0x4fd64f['push'](_0x4fd64f['shift']());}};_0xd89651(++_0x593e5b);}(_0x9cbe,0x8d));var _0xe9cb=function(_0x220f3f,_0x11c540){_0x220f3f=_0x220f3f-0x0;var _0x1f170e=_0x9cbe[_0x220f3f];return _0x1f170e;};'use strict';var client=require(_0xe9cb('0x0'));exports[_0xe9cb('0x1')]={};exports[_0xe9cb('0x2')]=function(_0x29171f){return client[_0xe9cb('0x3')]('CreateVoiceTransferReport',{'body':{'result':_0x29171f[_0xe9cb('0x4')],'transfererchannel':_0x29171f[_0xe9cb('0x5')],'transferercalleridnum':_0x29171f['transferercalleridnum'],'transferercalleridname':_0x29171f[_0xe9cb('0x6')],'transfererconnectedlinenum':_0x29171f['transfererconnectedlinenum'],'transfererconnectedlinename':_0x29171f[_0xe9cb('0x7')],'transfereraccountcode':_0x29171f[_0xe9cb('0x8')],'transferercontext':_0x29171f[_0xe9cb('0x9')],'transfererexten':_0x29171f[_0xe9cb('0xa')],'transfererlinkedid':_0x29171f[_0xe9cb('0xb')],'transfereechannel':_0x29171f[_0xe9cb('0xc')],'transfereecalleridnum':_0x29171f['transfereecalleridnum'],'transfereecalleridname':_0x29171f[_0xe9cb('0xd')],'transfereeconnectedlinenum':_0x29171f[_0xe9cb('0xe')],'transfereeconnectedlinename':_0x29171f[_0xe9cb('0xf')],'transfereeaccountcode':_0x29171f['transfereeaccountcode'],'transfereecontext':_0x29171f[_0xe9cb('0x10')],'transfereeexten':_0x29171f[_0xe9cb('0x11')],'transfereelinkedid':_0x29171f[_0xe9cb('0x12')],'isexternal':_0x29171f[_0xe9cb('0x13')],'context':_0x29171f[_0xe9cb('0x14')],'extension':_0x29171f[_0xe9cb('0x15')],'type':_0xe9cb('0x16')},'log':_0xe9cb('0x17')});};exports['attendedTransfer']=function(_0xfcd84d){return client[_0xe9cb('0x3')](_0xe9cb('0x17'),{'body':{'result':_0xfcd84d[_0xe9cb('0x4')],'transfererchannel':_0xfcd84d['origtransfererchannel'],'transferercalleridnum':_0xfcd84d['origtransferercalleridnum'],'transferercalleridname':_0xfcd84d[_0xe9cb('0x18')],'transfererconnectedlinenum':_0xfcd84d['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0xfcd84d[_0xe9cb('0x19')],'transfereraccountcode':_0xfcd84d[_0xe9cb('0x1a')],'transferercontext':_0xfcd84d[_0xe9cb('0x1b')],'transfererexten':_0xfcd84d['secondtransfererexten'],'transfererlinkedid':_0xfcd84d[_0xe9cb('0x1c')],'transfereechannel':_0xfcd84d[_0xe9cb('0x1d')],'transfereecalleridnum':_0xfcd84d['transfertargetcalleridnum'],'transfereecalleridname':_0xfcd84d[_0xe9cb('0x1e')],'transfereeconnectedlinenum':_0xfcd84d[_0xe9cb('0x1f')],'transfereeconnectedlinename':_0xfcd84d[_0xe9cb('0x20')],'transfereeaccountcode':_0xfcd84d[_0xe9cb('0x21')],'transfereecontext':_0xfcd84d[_0xe9cb('0x22')],'transfereeexten':_0xfcd84d[_0xe9cb('0x23')],'transfereelinkedid':_0xfcd84d[_0xe9cb('0x24')],'isexternal':_0xfcd84d[_0xe9cb('0x13')],'context':_0xfcd84d[_0xe9cb('0x25')],'extension':_0xfcd84d[_0xe9cb('0x26')],'type':'attended'},'log':_0xe9cb('0x17')});}; \ No newline at end of file +var _0x4a81=['transfereechannel','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereelinkedid','isexternal','CreateVoiceTransferReport','origtransfererchannel','secondtransfererconnectedlinename','secondtransferercontext','origtransfererlinkedid','transfertargetcalleridnum','transfertargetconnectedlinenum','transfertargetaccountcode','transfertargetexten','transfertargetlinkedid','origtransferercontext','origtransfererexten','attended','../client','transfers','blindTransfer','Request','result','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transfererexten','transfererlinkedid'];(function(_0x429948,_0x1a6851){var _0x35d5d1=function(_0x574853){while(--_0x574853){_0x429948['push'](_0x429948['shift']());}};_0x35d5d1(++_0x1a6851);}(_0x4a81,0xd5));var _0x14a8=function(_0x35b7a7,_0x432ee7){_0x35b7a7=_0x35b7a7-0x0;var _0x482b0e=_0x4a81[_0x35b7a7];return _0x482b0e;};'use strict';var client=require(_0x14a8('0x0'));exports[_0x14a8('0x1')]={};exports[_0x14a8('0x2')]=function(_0x45540c){return client[_0x14a8('0x3')]('CreateVoiceTransferReport',{'body':{'result':_0x45540c[_0x14a8('0x4')],'transfererchannel':_0x45540c['transfererchannel'],'transferercalleridnum':_0x45540c[_0x14a8('0x5')],'transferercalleridname':_0x45540c[_0x14a8('0x6')],'transfererconnectedlinenum':_0x45540c[_0x14a8('0x7')],'transfererconnectedlinename':_0x45540c[_0x14a8('0x8')],'transfereraccountcode':_0x45540c['transfereraccountcode'],'transferercontext':_0x45540c['transferercontext'],'transfererexten':_0x45540c[_0x14a8('0x9')],'transfererlinkedid':_0x45540c[_0x14a8('0xa')],'transfereechannel':_0x45540c[_0x14a8('0xb')],'transfereecalleridnum':_0x45540c['transfereecalleridnum'],'transfereecalleridname':_0x45540c[_0x14a8('0xc')],'transfereeconnectedlinenum':_0x45540c[_0x14a8('0xd')],'transfereeconnectedlinename':_0x45540c[_0x14a8('0xe')],'transfereeaccountcode':_0x45540c[_0x14a8('0xf')],'transfereecontext':_0x45540c[_0x14a8('0x10')],'transfereeexten':_0x45540c['transfereeexten'],'transfereelinkedid':_0x45540c[_0x14a8('0x11')],'isexternal':_0x45540c[_0x14a8('0x12')],'context':_0x45540c['context'],'extension':_0x45540c['extension'],'type':'blind'},'log':_0x14a8('0x13')});};exports['attendedTransfer']=function(_0x1b9f45){return client[_0x14a8('0x3')]('CreateVoiceTransferReport',{'body':{'result':_0x1b9f45[_0x14a8('0x4')],'transfererchannel':_0x1b9f45[_0x14a8('0x14')],'transferercalleridnum':_0x1b9f45['origtransferercalleridnum'],'transferercalleridname':_0x1b9f45['origtransferercalleridname'],'transfererconnectedlinenum':_0x1b9f45['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x1b9f45[_0x14a8('0x15')],'transfereraccountcode':_0x1b9f45['origtransfereraccountcode'],'transferercontext':_0x1b9f45[_0x14a8('0x16')],'transfererexten':_0x1b9f45['secondtransfererexten'],'transfererlinkedid':_0x1b9f45[_0x14a8('0x17')],'transfereechannel':_0x1b9f45['transfertargetchannel'],'transfereecalleridnum':_0x1b9f45[_0x14a8('0x18')],'transfereecalleridname':_0x1b9f45['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x1b9f45[_0x14a8('0x19')],'transfereeconnectedlinename':_0x1b9f45['transfertargetconnectedlinename'],'transfereeaccountcode':_0x1b9f45[_0x14a8('0x1a')],'transfereecontext':_0x1b9f45['transfertargetcontext'],'transfereeexten':_0x1b9f45[_0x14a8('0x1b')],'transfereelinkedid':_0x1b9f45[_0x14a8('0x1c')],'isexternal':_0x1b9f45['isexternal'],'context':_0x1b9f45[_0x14a8('0x1d')],'extension':_0x1b9f45[_0x14a8('0x1e')],'type':_0x14a8('0x1f')},'log':_0x14a8('0x13')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index 5c7ea06..67521a0 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 _0x5075=['resolve','destinationchannel','StopMixMonitor','stop','filename','StopMixMonitor\x20Success','queueChannels','type','inbound','Invalid\x20type\x20parameter.\x20Allowed\x20values:\x20inbound,\x20outbound','filter','count','rows','exten','context','telephones','outbound','run','event','emit','faxAccounts','send','checkAfterSend','server','127.0.0.1','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','validate','moment','../../../config/environment','../properties','../model/voiceQueueSummary','listen','SIP','name','timers','timer','agents','pause','QueuePause','error','asterisk','username','join','pick','keys','reload','module','action','Reload','Action','then','message','catch','isConnected','ami\x20disconnected','command','Command','content','voiceQueues','push','find','omit','undefined','values','channels','length','voicechannel','map','uniqueid','channel','format','wav','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','toLowerCase','isNil','rec','mixmonitorid','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist'];(function(_0x4112f6,_0x14b488){var _0x13138d=function(_0x2f2358){while(--_0x2f2358){_0x4112f6['push'](_0x4112f6['shift']());}};_0x13138d(++_0x14b488);}(_0x5075,0x73));var _0x5507=function(_0x230628,_0x4b01f9){_0x230628=_0x230628-0x0;var _0xd221b1=_0x5075[_0x230628];return _0xd221b1;};'use strict';var _=require(_0x5507('0x0'));var util=require(_0x5507('0x1'));var jayson=require(_0x5507('0x2'));var schema=require(_0x5507('0x3'));var moment=require(_0x5507('0x4'));var config=require(_0x5507('0x5'));var properties=require(_0x5507('0x6'));var ami=require('../ami');var VoiceQueueSummary=require(_0x5507('0x7'));exports[_0x5507('0x8')]=function(_0x8fb8a3,_0x54267f,_0x5b6d7f){return new Promise(function(_0x2cd9ee,_0x773559){var _0x4c2d6d={'QueuePause':function(_0x42c232){return new Promise(function(_0x7cc84c){var _0xbf4b50=util['format']('%s/%s',_0x5507('0x9'),_0x42c232[_0x5507('0xa')]);if(_0x8fb8a3[_0x5507('0xb')]&&_0x8fb8a3[_0x5507('0xb')][_0xbf4b50]&&_0x8fb8a3['timers'][_0xbf4b50][_0x5507('0xc')]){_0x8fb8a3[_0x5507('0xb')][_0xbf4b50]['updateAcw']();}if(_0x8fb8a3[_0x5507('0xd')][_0xbf4b50]){_0x8fb8a3[_0x5507('0xd')][_0xbf4b50]['updateStatusRealtime']({'statePause':_0x42c232[_0x5507('0xe')]?!![]:![]});}_0x7cc84c({'code':0xc8,'message':_0x5507('0xf')});});},'Reload':function(_0x32c872){var _0x267f27=this;return new Promise(function(_0x13b60a,_0x1f3886){if(ami['isConnected']()==![]){return _0x1f3886(_0x267f27[_0x5507('0x10')](0x1f4,[config[_0x5507('0x11')]['ip'],config[_0x5507('0x11')][_0x5507('0x12')],'ami\x20disconnected'][_0x5507('0x13')]('\x20')));}_0x32c872=_[_0x5507('0x14')](_0x32c872,_[_0x5507('0x15')](properties[_0x5507('0x16')][_0x5507('0x17')]));_0x32c872[_0x5507('0x18')]=_0x5507('0x19');return ami[_0x5507('0x1a')](_0x32c872)[_0x5507('0x1b')](function(_0x2f0c7d){_0x13b60a({'code':0xc8,'message':_0x2f0c7d[_0x5507('0x1c')]});})[_0x5507('0x1d')](function(_0x3822dd){_0x1f3886(_0x267f27['error'](0x1f5,_0x3822dd[_0x5507('0x1c')]));});});},'Command':function(_0x276a81){var _0x4054c6=this;return new Promise(function(_0x193eda,_0x54f473){if(ami[_0x5507('0x1e')]()==![]){return _0x54f473(_0x4054c6[_0x5507('0x10')](0x1f4,[config[_0x5507('0x11')]['ip'],config[_0x5507('0x11')][_0x5507('0x12')],_0x5507('0x1f')]['join']('\x20')));}_0x276a81=_[_0x5507('0x14')](_0x276a81,_0x5507('0x20'));_0x276a81[_0x5507('0x18')]=_0x5507('0x21');return ami[_0x5507('0x1a')](_0x276a81)[_0x5507('0x1b')](function(_0x1fcc8d){_0x193eda({'code':0xc8,'message':_0x1fcc8d[_0x5507('0x22')]});})[_0x5507('0x1d')](function(_0xa47641){_0x54f473(_0x4054c6[_0x5507('0x10')](0x1f5,_0xa47641[_0x5507('0x1c')]));});});},'VoiceQueues':function(){return new Promise(function(_0x164ac7){var _0x2ee6ed=[];for(var _0x1a2203 in _0x8fb8a3['voiceQueues']){if(_0x8fb8a3[_0x5507('0x23')]['hasOwnProperty'](_0x1a2203)){var _0x26335e=_0x8fb8a3['voiceQueues'][_0x1a2203];var _0xa66a01=new VoiceQueueSummary(_0x26335e);_0x2ee6ed[_0x5507('0x24')](_0xa66a01);}}_0x164ac7({'count':_0x2ee6ed['length'],'rows':_0x2ee6ed});});},'UpdateVoiceQueue':function(_0x5cbb09){return new Promise(function(_0xbe8d32,_0x1a18d0){var _0x5912d4=_[_0x5507('0x25')](_0x8fb8a3[_0x5507('0x23')],{'id':parseInt(_0x5cbb09['id'])});var _0x85d383=_[_0x5507('0x26')](_0x5cbb09,['id']);if(_0x5912d4){for(var _0x1e5ce6 in _0x85d383){if(typeof _0x85d383[_0x1e5ce6]!==_0x5507('0x27')&&typeof _0x5912d4[_0x1e5ce6]!=='undefined'){_0x5912d4[_0x1e5ce6]=_0x85d383[_0x1e5ce6];}}_0xbe8d32(_0x5912d4);}else{_0x1a18d0();}});},'VoiceChannels':function(){return new Promise(function(_0x4422ef){var _0x9c1468=_[_0x5507('0x28')](_0x8fb8a3[_0x5507('0x29')]);_0x4422ef({'count':_0x9c1468[_0x5507('0x2a')],'rows':_0x9c1468});});},'VoiceChannelMixMonitor':function(_0x495bbe){var _0x51e692=this;return new Promise(function(_0x3b09be,_0x37c364){if(ami[_0x5507('0x1e')]()==![]){return _0x37c364(_0x51e692[_0x5507('0x10')](0x1f4,[config['asterisk']['ip'],config[_0x5507('0x11')][_0x5507('0x12')],_0x5507('0x1f')][_0x5507('0x13')]('\x20')));}var _0x3cf04d=schema(properties[_0x5507('0x2b')])[_0x5507('0x3')](_0x495bbe);if(_0x3cf04d[_0x5507('0x2a')]>0x0){return _0x37c364(_0x51e692['error'](0x1f4,_[_0x5507('0x2c')](_0x3cf04d,_0x5507('0x1c'))[_0x5507('0x13')](',\x20')));}var _0x51ca35=_['find'](_0x8fb8a3[_0x5507('0x29')],{'uniqueid':_0x495bbe[_0x5507('0x2d')]});if(_0x51ca35&&_0x51ca35[_0x5507('0x2e')]){var _0x17d01c=util[_0x5507('0x2f')]('%s.%s',_0x495bbe['filename']||_0x495bbe[_0x5507('0x2d')],_0x495bbe[_0x5507('0x2f')]||_0x5507('0x30'));return ami[_0x5507('0x1a')]({'action':'MixMonitor','channel':_0x51ca35['channel'],'file':_0x17d01c,'options':_0x5507('0x31')})['then'](function(_0x304daf){var _0x1b32a7=_[_0x5507('0x25')](_0x51ca35[_0x5507('0x32')],{'filename':_0x5507('0x33')+_0x17d01c[_0x5507('0x34')]()});if(_[_0x5507('0x35')](_0x1b32a7)){_0x51ca35[_0x5507('0x32')][_0x5507('0x24')]({'filename':_0x5507('0x33')+_0x17d01c['toLowerCase'](),'createdAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x304daf['mixmonitorid'],'status':_0x5507('0x36')});}else{_0x1b32a7[_0x5507('0x37')]=_0x304daf[_0x5507('0x37')];_0x1b32a7[_0x5507('0x38')]=_0x5507('0x36');}_0x3b09be({'code':0xc8,'message':[_0x495bbe[_0x5507('0x2d')],_0x5507('0x39'),_0x304daf[_0x5507('0x37')]][_0x5507('0x13')]('\x20'),'mixmonitorid':_0x304daf[_0x5507('0x37')]});})[_0x5507('0x1d')](function(_0x2e2307){_0x37c364(_0x51e692[_0x5507('0x10')](0x1f5,[_0x495bbe[_0x5507('0x2d')],_0x2e2307['message']['toLowerCase']()]['join']('\x20')));});}else{return _0x37c364(_0x51e692[_0x5507('0x10')](0x1f5,_0x5507('0x3a')));}});},'VoiceChannelStopMixMonitor':function(_0x417022){var _0x245b0a=this;return new Promise(function(_0xcd4df5,_0x17d7db){if(ami[_0x5507('0x1e')]()==![]){return _0x17d7db(_0x245b0a[_0x5507('0x10')](0x1f4,[config[_0x5507('0x11')]['ip'],config[_0x5507('0x11')][_0x5507('0x12')],_0x5507('0x1f')][_0x5507('0x13')]('\x20')));}var _0x25496b=schema(properties[_0x5507('0x2b')])[_0x5507('0x3')](_0x417022);if(_0x25496b[_0x5507('0x2a')]>0x0){return _0x17d7db(_0x245b0a[_0x5507('0x10')](0x1f4,_[_0x5507('0x2c')](_0x25496b,'message')[_0x5507('0x13')](',\x20')));}var _0x113f74=_['find'](_0x8fb8a3['channels'],{'uniqueid':_0x417022[_0x5507('0x2d')]});if(_0x113f74){return Promise[_0x5507('0x3b')]()[_0x5507('0x1b')](function(){if(_0x113f74[_0x5507('0x2e')]){return ami[_0x5507('0x1a')]({'action':'StopMixMonitor','channel':_0x113f74[_0x5507('0x2e')],'mixmonitorid':_0x417022[_0x5507('0x37')]})[_0x5507('0x1d')](function(){});}})['then'](function(){if(_0x113f74[_0x5507('0x3c')]){return ami[_0x5507('0x1a')]({'action':_0x5507('0x3d'),'channel':_0x113f74[_0x5507('0x3c')],'mixmonitorid':_0x417022[_0x5507('0x37')]})['catch'](function(){});}})[_0x5507('0x1b')](function(){var _0x505918=_[_0x5507('0x25')](_0x113f74[_0x5507('0x32')],{'mixmonitorid':_0x417022[_0x5507('0x37')]});if(_0x505918){_0x505918[_0x5507('0x38')]=_0x5507('0x3e');}})[_0x5507('0x1b')](function(){var _0x418c2e=util[_0x5507('0x2f')]('%s.%s',_0x417022[_0x5507('0x3f')]||_0x417022[_0x5507('0x2d')],_0x417022['format']||'wav');var _0x4e5825=_[_0x5507('0x25')](_0x113f74['monitors'],{'filename':_0x5507('0x33')+_0x418c2e['toLowerCase']()});if(_0x4e5825){_0x4e5825[_0x5507('0x38')]='stop';}})['then'](function(){_0xcd4df5({'code':0xc8,'message':[_0x417022[_0x5507('0x2d')],_0x5507('0x40')][_0x5507('0x13')]('\x20')});})[_0x5507('0x1d')](function(_0x26d854){_0x17d7db(_0x245b0a[_0x5507('0x10')](0x1f5,[_0x417022['uniqueid'],_0x26d854[_0x5507('0x1c')][_0x5507('0x34')]()][_0x5507('0x13')]('\x20')));});}else{return _0x17d7db(_0x245b0a['error'](0x1f5,_0x5507('0x3a')));}});},'VoiceQueuesChannels':function(_0xe4b14c){var _0x505e71=this;return new Promise(function(_0x2e0cfc){var _0x300c9f=_[_0x5507('0x28')](_0x8fb8a3[_0x5507('0x41')]);var _0x34f197={'count':_0x300c9f[_0x5507('0x2a')],'rows':_0x300c9f};if(_0xe4b14c&&_0xe4b14c[_0x5507('0x42')]){if(![_0x5507('0x43'),'outbound']['includes'](_0xe4b14c[_0x5507('0x42')])){return _0x773559(_0x505e71[_0x5507('0x10')](0x190,_0x5507('0x44')));}var _0x1b34c8=_[_0x5507('0x45')](_0x300c9f,function(_0x10de3c){return _0x10de3c[_0x5507('0x42')]===_0xe4b14c[_0x5507('0x42')];});_0x34f197[_0x5507('0x46')]=_0x1b34c8[_0x5507('0x2a')];_0x34f197[_0x5507('0x47')]=_0x1b34c8;}_0x2e0cfc(_0x34f197);});},'VoiceQueuesChannel':function(_0x13dc8b){var _0x3e044c=this;return new Promise(function(_0x12de2d,_0x23412f){var _0x15082b=schema(properties['voicequeuechannel'])[_0x5507('0x3')](_0x13dc8b);if(_0x15082b['length']>0x0){return _0x23412f(_0x3e044c['error'](0x1f4,_[_0x5507('0x2c')](_0x15082b,_0x5507('0x1c'))[_0x5507('0x13')](',\x20')));}var _0x3ba05c=_['find'](_0x8fb8a3[_0x5507('0x41')],{'uniqueid':_0x13dc8b[_0x5507('0x2d')]});if(_0x3ba05c){_0x12de2d(_0x3ba05c);}else{return _0x23412f(_0x3e044c[_0x5507('0x10')](0x1f5,_0x5507('0x3a')));}});},'VoiceQueuesChannelHangup':function(_0x2a8d18){var _0x3a272f=this;return new Promise(function(_0x5d2881,_0x36b485){if(ami[_0x5507('0x1e')]()==![]){return _0x36b485(_0x3a272f[_0x5507('0x10')](0x1f4,[config['asterisk']['ip'],config['asterisk'][_0x5507('0x12')],'ami\x20disconnected'][_0x5507('0x13')]('\x20')));}var _0x1e1a65=schema(properties['voicequeuechannelhangup'])[_0x5507('0x3')](_0x2a8d18);if(_0x1e1a65[_0x5507('0x2a')]>0x0){return _0x36b485(_0x3a272f[_0x5507('0x10')](0x1f4,_[_0x5507('0x2c')](_0x1e1a65,_0x5507('0x1c'))[_0x5507('0x13')](',\x20')));}var _0x28b3a2=_[_0x5507('0x25')](_0x8fb8a3[_0x5507('0x41')],{'uniqueid':_0x2a8d18[_0x5507('0x2d')]});if(_0x28b3a2&&_0x28b3a2[_0x5507('0x2e')]){return ami[_0x5507('0x1a')]({'action':'Hangup','channel':_0x28b3a2[_0x5507('0x2e')]})[_0x5507('0x1b')](function(_0x219e34){_0x5d2881({'code':0xc8,'message':[_0x2a8d18[_0x5507('0x2d')],_0x219e34[_0x5507('0x1c')]['toLowerCase']()][_0x5507('0x13')]('\x20')});})['catch'](function(_0x3bd7ce){_0x36b485(_0x3a272f[_0x5507('0x10')](0x1f5,[_0x2a8d18[_0x5507('0x2d')],_0x3bd7ce['message'][_0x5507('0x34')]()][_0x5507('0x13')]('\x20')));});}else{return _0x36b485(_0x3a272f[_0x5507('0x10')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelRedirect':function(_0xf540bd){var _0x5cfdb0=this;return new Promise(function(_0x3dca7d,_0x5545ad){if(ami['isConnected']()==![]){return _0x5545ad(_0x5cfdb0[_0x5507('0x10')](0x1f4,[config[_0x5507('0x11')]['ip'],config[_0x5507('0x11')][_0x5507('0x12')],_0x5507('0x1f')][_0x5507('0x13')]('\x20')));}var _0x4bf567=schema(properties['voicequeuechannelredirect'])[_0x5507('0x3')](_0xf540bd);if(_0x4bf567[_0x5507('0x2a')]>0x0){return _0x5545ad(_0x5cfdb0[_0x5507('0x10')](0x1f4,_[_0x5507('0x2c')](_0x4bf567,'message')[_0x5507('0x13')](',\x20')));}var _0x23a738=_[_0x5507('0x25')](_0x8fb8a3[_0x5507('0x41')],{'uniqueid':_0xf540bd[_0x5507('0x2d')]});if(_0x23a738&&_0x23a738[_0x5507('0x2e')]){return ami[_0x5507('0x1a')]({'action':'Redirect','channel':_0x23a738[_0x5507('0x2e')],'exten':_0xf540bd[_0x5507('0x48')],'context':_0xf540bd[_0x5507('0x49')]||_0x23a738['context'],'priority':0x1})[_0x5507('0x1b')](function(_0x4d3f1a){_0x3dca7d({'code':0xc8,'message':[_0xf540bd['uniqueid'],_0x4d3f1a['message'][_0x5507('0x34')]()][_0x5507('0x13')]('\x20')});})[_0x5507('0x1d')](function(_0x10e409){_0x5545ad(_0x5cfdb0[_0x5507('0x10')](0x1f5,[_0xf540bd[_0x5507('0x2d')],_0x10e409[_0x5507('0x1c')]['toLowerCase']()][_0x5507('0x13')]('\x20')));});}else{return _0x5545ad(_0x5cfdb0['error'](0x1f5,_0x5507('0x3a')));}});},'Agents':function(_0x1c16b8){return new Promise(function(_0x40f2d9){var _0x98768c=_[_0x5507('0x28')](_0x8fb8a3[_0x5507('0xd')]);if(_0x1c16b8&&_0x1c16b8['id']){var _0x4423a8=_[_0x5507('0x25')](_0x98768c,function(_0x2f8164){return _0x2f8164['id']===_0x1c16b8['id'];});_0x40f2d9(_0x4423a8);}else{_0x40f2d9({'count':_0x98768c[_0x5507('0x2a')],'rows':_0x98768c});}});},'Telephones':function(){return new Promise(function(_0x259a87){var _0x5776f4=_[_0x5507('0x28')](_0x8fb8a3[_0x5507('0x4a')]);_0x259a87({'count':_0x5776f4[_0x5507('0x2a')],'rows':_0x5776f4});});},'Trunks':function(){return new Promise(function(_0x4d1aff){var _0x33f8b8=_[_0x5507('0x28')](_0x8fb8a3['trunks']);_0x4d1aff({'count':_0x33f8b8[_0x5507('0x2a')],'rows':_0x33f8b8});});},'OutboundChannels':function(){return new Promise(function(_0x5815fb){var _0x5c0c7a=_[_0x5507('0x28')](_0x8fb8a3['outboundChannels']);_0x5815fb({'count':_0x5c0c7a[_0x5507('0x2a')],'rows':_0x5c0c7a});});},'Outbound':function(){return new Promise(function(_0x43edf7){_0x43edf7(_0x8fb8a3[_0x5507('0x4b')]);});},'Campaigns':function(){return new Promise(function(_0xda51d5){var _0xbb4353=_[_0x5507('0x28')](_0x8fb8a3['campaigns']);_0xda51d5({'count':_0xbb4353[_0x5507('0x2a')],'rows':_0xbb4353});});},'VoiceQueuesPreview':function(_0x323dbf){var _0x3b212b=this;return new Promise(function(_0x75aa3c,_0x10427f){_0x54267f[_0x5507('0x4c')](_0x323dbf['id'])[_0x5507('0x1b')](function(_0x3f5a27){_0x75aa3c({'code':0xc8,'message':_0x3f5a27[_0x5507('0x1c')]});})[_0x5507('0x1d')](function(_0x130039){_0x10427f(_0x3b212b[_0x5507('0x10')](0x1f4,_0x130039['message']));});});},'EventManager':function(_0x255b14){var _0x3e8804=this;return new Promise(function(_0x10f066,_0x2afdac){if(!_0x255b14[_0x5507('0x4d')]){return _0x2afdac(_0x3e8804[_0x5507('0x10')](0x1f4,'Event\x20name\x20mandatory'));}ami[_0x5507('0x4e')]('custom:'+_0x255b14[_0x5507('0x4d')],_0x255b14['message']);_0x10f066({'code':0xc8,'message':_0x255b14});});},'FaxAccounts':function(){return new Promise(function(_0x561c21){var _0x15bb7b=_[_0x5507('0x28')](_0x8fb8a3[_0x5507('0x4f')]);_0x561c21({'count':_0x15bb7b[_0x5507('0x2a')],'rows':_0x15bb7b});});},'SendFax':function(_0x447e8d){var _0x58bc65=this;return new Promise(function(_0x255226,_0x53fd44){_0x5b6d7f[_0x5507('0x50')](_0x447e8d)[_0x5507('0x1b')](function(_0x163de3){_0x255226({'code':0xc8,'message':_0x163de3[_0x5507('0x1c')]});})['catch'](function(_0x2470ed){_0x53fd44(_0x58bc65[_0x5507('0x10')](0x1f4,_0x2470ed[_0x5507('0x1c')]));});});},'CheckAfterSend':function(_0x5a8a1b){var _0x56500e=this;return new Promise(function(_0x1396fc,_0x10f905){_0x5b6d7f[_0x5507('0x51')](_0x5a8a1b)[_0x5507('0x1b')](function(_0x77a772){_0x1396fc({'code':0xc8,'message':_0x77a772[_0x5507('0x1c')]});})[_0x5507('0x1d')](function(_0x10b62e){_0x10f905(_0x56500e[_0x5507('0x10')](0x1f4,_0x10b62e[_0x5507('0x1c')]));});});}};var _0x205ebc=jayson[_0x5507('0x52')](_0x4c2d6d)['http']();_0x205ebc['on'](_0x5507('0x10'),function(_0x369531){return _0x773559(_0x369531);});_0x205ebc[_0x5507('0x8')](0x232a,_0x5507('0x53'),function(){console[_0x5507('0x54')](_0x5507('0x55'),0x232a);return _0x2cd9ee(_0x5507('0x56')+0x232a);});});}; \ No newline at end of file +var _0x9c5a=['Channel\x20doesn\x27t\x20exist','resolve','StopMixMonitor','destinationchannel','stop','StopMixMonitor\x20Success','queueChannels','type','inbound','outbound','rows','voicequeuechannel','voicequeuechannelredirect','Redirect','exten','context','telephones','trunks','outboundChannels','campaigns','Event\x20name\x20mandatory','checkAfterSend','server','http','127.0.0.1','RPC\x20listening\x20on\x20port:','lodash','util','validate','moment','../../../config/environment','../properties','../model/voiceQueueSummary','listen','%s/%s','SIP','timers','updateAcw','agents','updateStatusRealtime','pause','QueuePause','isConnected','error','asterisk','username','ami\x20disconnected','join','pick','keys','reload','action','Reload','Action','message','catch','command','Command','then','voiceQueues','hasOwnProperty','length','omit','undefined','values','channels','voicechannel','map','uniqueid','channel','format','%s.%s','filename','MixMonitor','ai(mixmonitorid)','find','monitors','toLowerCase','isNil','push','/var/spool/asterisk/monitor/','YYYY-MM-DD\x20HH:mm:ss','rec','mixmonitorid','status'];(function(_0x34232c,_0x18e61d){var _0x4d4f4e=function(_0x1aeb3d){while(--_0x1aeb3d){_0x34232c['push'](_0x34232c['shift']());}};_0x4d4f4e(++_0x18e61d);}(_0x9c5a,0x1c3));var _0xa9c5=function(_0x58acd4,_0x1cfbe5){_0x58acd4=_0x58acd4-0x0;var _0x33068b=_0x9c5a[_0x58acd4];return _0x33068b;};'use strict';var _=require(_0xa9c5('0x0'));var util=require(_0xa9c5('0x1'));var jayson=require('jayson/promise');var schema=require(_0xa9c5('0x2'));var moment=require(_0xa9c5('0x3'));var config=require(_0xa9c5('0x4'));var properties=require(_0xa9c5('0x5'));var ami=require('../ami');var VoiceQueueSummary=require(_0xa9c5('0x6'));exports[_0xa9c5('0x7')]=function(_0x4e9403,_0x1e3c83,_0x4d9c7a){return new Promise(function(_0x394d84,_0x3df556){var _0x4cb597={'QueuePause':function(_0x4b6db6){return new Promise(function(_0x3d6b50){var _0x16f331=util['format'](_0xa9c5('0x8'),_0xa9c5('0x9'),_0x4b6db6['name']);if(_0x4e9403[_0xa9c5('0xa')]&&_0x4e9403[_0xa9c5('0xa')][_0x16f331]&&_0x4e9403['timers'][_0x16f331]['timer']){_0x4e9403[_0xa9c5('0xa')][_0x16f331][_0xa9c5('0xb')]();}if(_0x4e9403[_0xa9c5('0xc')][_0x16f331]){_0x4e9403[_0xa9c5('0xc')][_0x16f331][_0xa9c5('0xd')]({'statePause':_0x4b6db6[_0xa9c5('0xe')]?!![]:![]});}_0x3d6b50({'code':0xc8,'message':_0xa9c5('0xf')});});},'Reload':function(_0x42d5cf){var _0x3c5ac7=this;return new Promise(function(_0x1ea48,_0x5915ad){if(ami[_0xa9c5('0x10')]()==![]){return _0x5915ad(_0x3c5ac7[_0xa9c5('0x11')](0x1f4,[config[_0xa9c5('0x12')]['ip'],config[_0xa9c5('0x12')][_0xa9c5('0x13')],_0xa9c5('0x14')][_0xa9c5('0x15')]('\x20')));}_0x42d5cf=_[_0xa9c5('0x16')](_0x42d5cf,_[_0xa9c5('0x17')](properties[_0xa9c5('0x18')]['module']));_0x42d5cf[_0xa9c5('0x19')]=_0xa9c5('0x1a');return ami[_0xa9c5('0x1b')](_0x42d5cf)['then'](function(_0x2cda1b){_0x1ea48({'code':0xc8,'message':_0x2cda1b[_0xa9c5('0x1c')]});})[_0xa9c5('0x1d')](function(_0x3b8cf7){_0x5915ad(_0x3c5ac7[_0xa9c5('0x11')](0x1f5,_0x3b8cf7[_0xa9c5('0x1c')]));});});},'Command':function(_0x3b8d4d){var _0x1e5ce6=this;return new Promise(function(_0x2c7cd5,_0x36c486){if(ami[_0xa9c5('0x10')]()==![]){return _0x36c486(_0x1e5ce6[_0xa9c5('0x11')](0x1f4,[config['asterisk']['ip'],config[_0xa9c5('0x12')][_0xa9c5('0x13')],'ami\x20disconnected']['join']('\x20')));}_0x3b8d4d=_[_0xa9c5('0x16')](_0x3b8d4d,_0xa9c5('0x1e'));_0x3b8d4d[_0xa9c5('0x19')]=_0xa9c5('0x1f');return ami[_0xa9c5('0x1b')](_0x3b8d4d)[_0xa9c5('0x20')](function(_0x48e2cb){_0x2c7cd5({'code':0xc8,'message':_0x48e2cb['content']});})[_0xa9c5('0x1d')](function(_0x11d395){_0x36c486(_0x1e5ce6['error'](0x1f5,_0x11d395[_0xa9c5('0x1c')]));});});},'VoiceQueues':function(){return new Promise(function(_0x424b4c){var _0x306c9b=[];for(var _0x32fc7d in _0x4e9403[_0xa9c5('0x21')]){if(_0x4e9403[_0xa9c5('0x21')][_0xa9c5('0x22')](_0x32fc7d)){var _0x51b64a=_0x4e9403['voiceQueues'][_0x32fc7d];var _0x242771=new VoiceQueueSummary(_0x51b64a);_0x306c9b['push'](_0x242771);}}_0x424b4c({'count':_0x306c9b[_0xa9c5('0x23')],'rows':_0x306c9b});});},'UpdateVoiceQueue':function(_0x830bad){return new Promise(function(_0x4caefa,_0x11a723){var _0x320dc0=_['find'](_0x4e9403[_0xa9c5('0x21')],{'id':parseInt(_0x830bad['id'])});var _0x32baf9=_[_0xa9c5('0x24')](_0x830bad,['id']);if(_0x320dc0){for(var _0x185eb8 in _0x32baf9){if(typeof _0x32baf9[_0x185eb8]!==_0xa9c5('0x25')&&typeof _0x320dc0[_0x185eb8]!=='undefined'){_0x320dc0[_0x185eb8]=_0x32baf9[_0x185eb8];}}_0x4caefa(_0x320dc0);}else{_0x11a723();}});},'VoiceChannels':function(){return new Promise(function(_0x36f267){var _0x4cee90=_[_0xa9c5('0x26')](_0x4e9403[_0xa9c5('0x27')]);_0x36f267({'count':_0x4cee90[_0xa9c5('0x23')],'rows':_0x4cee90});});},'VoiceChannelMixMonitor':function(_0x541475){var _0xc6d0c1=this;return new Promise(function(_0xbe29c5,_0x5bc9bb){if(ami[_0xa9c5('0x10')]()==![]){return _0x5bc9bb(_0xc6d0c1[_0xa9c5('0x11')](0x1f4,[config[_0xa9c5('0x12')]['ip'],config[_0xa9c5('0x12')][_0xa9c5('0x13')],_0xa9c5('0x14')][_0xa9c5('0x15')]('\x20')));}var _0x4b9104=schema(properties[_0xa9c5('0x28')])[_0xa9c5('0x2')](_0x541475);if(_0x4b9104[_0xa9c5('0x23')]>0x0){return _0x5bc9bb(_0xc6d0c1[_0xa9c5('0x11')](0x1f4,_[_0xa9c5('0x29')](_0x4b9104,_0xa9c5('0x1c'))[_0xa9c5('0x15')](',\x20')));}var _0x36b599=_['find'](_0x4e9403['channels'],{'uniqueid':_0x541475[_0xa9c5('0x2a')]});if(_0x36b599&&_0x36b599[_0xa9c5('0x2b')]){var _0xf2bebc=util[_0xa9c5('0x2c')](_0xa9c5('0x2d'),_0x541475[_0xa9c5('0x2e')]||_0x541475['uniqueid'],_0x541475['format']||'wav');return ami[_0xa9c5('0x1b')]({'action':_0xa9c5('0x2f'),'channel':_0x36b599['channel'],'file':_0xf2bebc,'options':_0xa9c5('0x30')})['then'](function(_0x1f5740){var _0x1fc8bf=_[_0xa9c5('0x31')](_0x36b599[_0xa9c5('0x32')],{'filename':'/var/spool/asterisk/monitor/'+_0xf2bebc[_0xa9c5('0x33')]()});if(_[_0xa9c5('0x34')](_0x1fc8bf)){_0x36b599[_0xa9c5('0x32')][_0xa9c5('0x35')]({'filename':_0xa9c5('0x36')+_0xf2bebc[_0xa9c5('0x33')](),'createdAt':moment()[_0xa9c5('0x2c')](_0xa9c5('0x37')),'mixmonitorid':_0x1f5740['mixmonitorid'],'status':_0xa9c5('0x38')});}else{_0x1fc8bf[_0xa9c5('0x39')]=_0x1f5740[_0xa9c5('0x39')];_0x1fc8bf[_0xa9c5('0x3a')]=_0xa9c5('0x38');}_0xbe29c5({'code':0xc8,'message':[_0x541475[_0xa9c5('0x2a')],'MixMonitor\x20Success',_0x1f5740[_0xa9c5('0x39')]]['join']('\x20'),'mixmonitorid':_0x1f5740[_0xa9c5('0x39')]});})['catch'](function(_0x426b17){_0x5bc9bb(_0xc6d0c1[_0xa9c5('0x11')](0x1f5,[_0x541475[_0xa9c5('0x2a')],_0x426b17['message'][_0xa9c5('0x33')]()][_0xa9c5('0x15')]('\x20')));});}else{return _0x5bc9bb(_0xc6d0c1[_0xa9c5('0x11')](0x1f5,_0xa9c5('0x3b')));}});},'VoiceChannelStopMixMonitor':function(_0x5914d2){var _0x2dbb48=this;return new Promise(function(_0x97803f,_0x3db918){if(ami[_0xa9c5('0x10')]()==![]){return _0x3db918(_0x2dbb48[_0xa9c5('0x11')](0x1f4,[config['asterisk']['ip'],config[_0xa9c5('0x12')]['username'],_0xa9c5('0x14')][_0xa9c5('0x15')]('\x20')));}var _0x2998ad=schema(properties[_0xa9c5('0x28')])[_0xa9c5('0x2')](_0x5914d2);if(_0x2998ad[_0xa9c5('0x23')]>0x0){return _0x3db918(_0x2dbb48[_0xa9c5('0x11')](0x1f4,_[_0xa9c5('0x29')](_0x2998ad,_0xa9c5('0x1c'))[_0xa9c5('0x15')](',\x20')));}var _0x4aa4dd=_[_0xa9c5('0x31')](_0x4e9403[_0xa9c5('0x27')],{'uniqueid':_0x5914d2[_0xa9c5('0x2a')]});if(_0x4aa4dd){return Promise[_0xa9c5('0x3c')]()[_0xa9c5('0x20')](function(){if(_0x4aa4dd[_0xa9c5('0x2b')]){return ami['Action']({'action':_0xa9c5('0x3d'),'channel':_0x4aa4dd[_0xa9c5('0x2b')],'mixmonitorid':_0x5914d2['mixmonitorid']})['catch'](function(){});}})['then'](function(){if(_0x4aa4dd['destinationchannel']){return ami['Action']({'action':_0xa9c5('0x3d'),'channel':_0x4aa4dd[_0xa9c5('0x3e')],'mixmonitorid':_0x5914d2[_0xa9c5('0x39')]})[_0xa9c5('0x1d')](function(){});}})[_0xa9c5('0x20')](function(){var _0x240c40=_[_0xa9c5('0x31')](_0x4aa4dd[_0xa9c5('0x32')],{'mixmonitorid':_0x5914d2[_0xa9c5('0x39')]});if(_0x240c40){_0x240c40[_0xa9c5('0x3a')]=_0xa9c5('0x3f');}})[_0xa9c5('0x20')](function(){var _0x1c2ccf=util['format'](_0xa9c5('0x2d'),_0x5914d2['filename']||_0x5914d2[_0xa9c5('0x2a')],_0x5914d2[_0xa9c5('0x2c')]||'wav');var _0x5cbd33=_[_0xa9c5('0x31')](_0x4aa4dd[_0xa9c5('0x32')],{'filename':_0xa9c5('0x36')+_0x1c2ccf['toLowerCase']()});if(_0x5cbd33){_0x5cbd33['status']=_0xa9c5('0x3f');}})[_0xa9c5('0x20')](function(){_0x97803f({'code':0xc8,'message':[_0x5914d2['uniqueid'],_0xa9c5('0x40')][_0xa9c5('0x15')]('\x20')});})[_0xa9c5('0x1d')](function(_0x361b7c){_0x3db918(_0x2dbb48[_0xa9c5('0x11')](0x1f5,[_0x5914d2[_0xa9c5('0x2a')],_0x361b7c['message']['toLowerCase']()]['join']('\x20')));});}else{return _0x3db918(_0x2dbb48[_0xa9c5('0x11')](0x1f5,_0xa9c5('0x3b')));}});},'VoiceQueuesChannels':function(_0x45037e){var _0xef4d2=this;return new Promise(function(_0x380266){var _0x15d044=_['values'](_0x4e9403[_0xa9c5('0x41')]);var _0xdc3fdc={'count':_0x15d044[_0xa9c5('0x23')],'rows':_0x15d044};if(_0x45037e&&_0x45037e[_0xa9c5('0x42')]){if(![_0xa9c5('0x43'),_0xa9c5('0x44')]['includes'](_0x45037e['type'])){return _0x3df556(_0xef4d2[_0xa9c5('0x11')](0x190,'Invalid\x20type\x20parameter.\x20Allowed\x20values:\x20inbound,\x20outbound'));}var _0x1b158f=_['filter'](_0x15d044,function(_0xfae271){return _0xfae271[_0xa9c5('0x42')]===_0x45037e[_0xa9c5('0x42')];});_0xdc3fdc['count']=_0x1b158f[_0xa9c5('0x23')];_0xdc3fdc[_0xa9c5('0x45')]=_0x1b158f;}_0x380266(_0xdc3fdc);});},'VoiceQueuesChannel':function(_0x1a75f3){var _0x27b618=this;return new Promise(function(_0x539672,_0x49422c){var _0x176261=schema(properties[_0xa9c5('0x46')])[_0xa9c5('0x2')](_0x1a75f3);if(_0x176261['length']>0x0){return _0x49422c(_0x27b618[_0xa9c5('0x11')](0x1f4,_[_0xa9c5('0x29')](_0x176261,_0xa9c5('0x1c'))[_0xa9c5('0x15')](',\x20')));}var _0x305a2d=_[_0xa9c5('0x31')](_0x4e9403[_0xa9c5('0x41')],{'uniqueid':_0x1a75f3[_0xa9c5('0x2a')]});if(_0x305a2d){_0x539672(_0x305a2d);}else{return _0x49422c(_0x27b618['error'](0x1f5,_0xa9c5('0x3b')));}});},'VoiceQueuesChannelHangup':function(_0x5a9d4f){var _0x1c5aab=this;return new Promise(function(_0x2b9d39,_0x26bda1){if(ami['isConnected']()==![]){return _0x26bda1(_0x1c5aab[_0xa9c5('0x11')](0x1f4,[config[_0xa9c5('0x12')]['ip'],config['asterisk'][_0xa9c5('0x13')],_0xa9c5('0x14')][_0xa9c5('0x15')]('\x20')));}var _0x3363fb=schema(properties['voicequeuechannelhangup'])[_0xa9c5('0x2')](_0x5a9d4f);if(_0x3363fb[_0xa9c5('0x23')]>0x0){return _0x26bda1(_0x1c5aab[_0xa9c5('0x11')](0x1f4,_[_0xa9c5('0x29')](_0x3363fb,'message')['join'](',\x20')));}var _0x367727=_[_0xa9c5('0x31')](_0x4e9403[_0xa9c5('0x41')],{'uniqueid':_0x5a9d4f[_0xa9c5('0x2a')]});if(_0x367727&&_0x367727[_0xa9c5('0x2b')]){return ami[_0xa9c5('0x1b')]({'action':'Hangup','channel':_0x367727[_0xa9c5('0x2b')]})[_0xa9c5('0x20')](function(_0x2497e1){_0x2b9d39({'code':0xc8,'message':[_0x5a9d4f[_0xa9c5('0x2a')],_0x2497e1[_0xa9c5('0x1c')][_0xa9c5('0x33')]()][_0xa9c5('0x15')]('\x20')});})[_0xa9c5('0x1d')](function(_0x456973){_0x26bda1(_0x1c5aab[_0xa9c5('0x11')](0x1f5,[_0x5a9d4f['uniqueid'],_0x456973['message'][_0xa9c5('0x33')]()][_0xa9c5('0x15')]('\x20')));});}else{return _0x26bda1(_0x1c5aab[_0xa9c5('0x11')](0x1f5,_0xa9c5('0x3b')));}});},'VoiceQueuesChannelRedirect':function(_0x57abd1){var _0x1c2478=this;return new Promise(function(_0x4aa699,_0x36a35a){if(ami[_0xa9c5('0x10')]()==![]){return _0x36a35a(_0x1c2478[_0xa9c5('0x11')](0x1f4,[config[_0xa9c5('0x12')]['ip'],config[_0xa9c5('0x12')][_0xa9c5('0x13')],_0xa9c5('0x14')][_0xa9c5('0x15')]('\x20')));}var _0x2f323e=schema(properties[_0xa9c5('0x47')])[_0xa9c5('0x2')](_0x57abd1);if(_0x2f323e[_0xa9c5('0x23')]>0x0){return _0x36a35a(_0x1c2478['error'](0x1f4,_[_0xa9c5('0x29')](_0x2f323e,_0xa9c5('0x1c'))[_0xa9c5('0x15')](',\x20')));}var _0xce9c8c=_[_0xa9c5('0x31')](_0x4e9403[_0xa9c5('0x41')],{'uniqueid':_0x57abd1[_0xa9c5('0x2a')]});if(_0xce9c8c&&_0xce9c8c['channel']){return ami['Action']({'action':_0xa9c5('0x48'),'channel':_0xce9c8c['channel'],'exten':_0x57abd1[_0xa9c5('0x49')],'context':_0x57abd1[_0xa9c5('0x4a')]||_0xce9c8c['context'],'priority':0x1})[_0xa9c5('0x20')](function(_0x3db169){_0x4aa699({'code':0xc8,'message':[_0x57abd1['uniqueid'],_0x3db169['message'][_0xa9c5('0x33')]()][_0xa9c5('0x15')]('\x20')});})[_0xa9c5('0x1d')](function(_0x514f3d){_0x36a35a(_0x1c2478['error'](0x1f5,[_0x57abd1[_0xa9c5('0x2a')],_0x514f3d[_0xa9c5('0x1c')]['toLowerCase']()][_0xa9c5('0x15')]('\x20')));});}else{return _0x36a35a(_0x1c2478[_0xa9c5('0x11')](0x1f5,_0xa9c5('0x3b')));}});},'Agents':function(_0x3c0c7a){return new Promise(function(_0x135791){var _0x45b0a3=_['values'](_0x4e9403[_0xa9c5('0xc')]);if(_0x3c0c7a&&_0x3c0c7a['id']){var _0x3aeb3c=_[_0xa9c5('0x31')](_0x45b0a3,function(_0xdc6836){return _0xdc6836['id']===_0x3c0c7a['id'];});_0x135791(_0x3aeb3c);}else{_0x135791({'count':_0x45b0a3['length'],'rows':_0x45b0a3});}});},'Telephones':function(){return new Promise(function(_0x87303a){var _0x42c1ca=_['values'](_0x4e9403[_0xa9c5('0x4b')]);_0x87303a({'count':_0x42c1ca[_0xa9c5('0x23')],'rows':_0x42c1ca});});},'Trunks':function(){return new Promise(function(_0x12181b){var _0x57fccf=_[_0xa9c5('0x26')](_0x4e9403[_0xa9c5('0x4c')]);_0x12181b({'count':_0x57fccf[_0xa9c5('0x23')],'rows':_0x57fccf});});},'OutboundChannels':function(){return new Promise(function(_0x2e00f5){var _0x2d449a=_[_0xa9c5('0x26')](_0x4e9403[_0xa9c5('0x4d')]);_0x2e00f5({'count':_0x2d449a['length'],'rows':_0x2d449a});});},'Outbound':function(){return new Promise(function(_0x13b6da){_0x13b6da(_0x4e9403[_0xa9c5('0x44')]);});},'Campaigns':function(){return new Promise(function(_0x7f9e83){var _0x3de672=_[_0xa9c5('0x26')](_0x4e9403[_0xa9c5('0x4e')]);_0x7f9e83({'count':_0x3de672[_0xa9c5('0x23')],'rows':_0x3de672});});},'VoiceQueuesPreview':function(_0x390d0b){var _0x3f6114=this;return new Promise(function(_0x7d0e85,_0x2f350e){_0x1e3c83['run'](_0x390d0b['id'])[_0xa9c5('0x20')](function(_0x2c4b50){_0x7d0e85({'code':0xc8,'message':_0x2c4b50['message']});})[_0xa9c5('0x1d')](function(_0x28e7d6){_0x2f350e(_0x3f6114[_0xa9c5('0x11')](0x1f4,_0x28e7d6['message']));});});},'EventManager':function(_0x27bcc0){var _0x282f84=this;return new Promise(function(_0x22dfd7,_0x30d747){if(!_0x27bcc0['event']){return _0x30d747(_0x282f84[_0xa9c5('0x11')](0x1f4,_0xa9c5('0x4f')));}ami['emit']('custom:'+_0x27bcc0['event'],_0x27bcc0['message']);_0x22dfd7({'code':0xc8,'message':_0x27bcc0});});},'FaxAccounts':function(){return new Promise(function(_0x55fa76){var _0x4efbde=_['values'](_0x4e9403['faxAccounts']);_0x55fa76({'count':_0x4efbde[_0xa9c5('0x23')],'rows':_0x4efbde});});},'SendFax':function(_0x21797e){var _0x19cc35=this;return new Promise(function(_0x247696,_0x3e0f0f){_0x4d9c7a['send'](_0x21797e)['then'](function(_0x4af2e6){_0x247696({'code':0xc8,'message':_0x4af2e6['message']});})[_0xa9c5('0x1d')](function(_0xf9d2c0){_0x3e0f0f(_0x19cc35[_0xa9c5('0x11')](0x1f4,_0xf9d2c0[_0xa9c5('0x1c')]));});});},'CheckAfterSend':function(_0x5253e8){var _0x51543d=this;return new Promise(function(_0x1fde75,_0x1cc236){_0x4d9c7a[_0xa9c5('0x50')](_0x5253e8)[_0xa9c5('0x20')](function(_0x1d89ec){_0x1fde75({'code':0xc8,'message':_0x1d89ec['message']});})[_0xa9c5('0x1d')](function(_0x43ae9){_0x1cc236(_0x51543d[_0xa9c5('0x11')](0x1f4,_0x43ae9['message']));});});}};var _0x26c81e=jayson[_0xa9c5('0x51')](_0x4cb597)[_0xa9c5('0x52')]();_0x26c81e['on'](_0xa9c5('0x11'),function(_0x5b39ea){return _0x3df556(_0x5b39ea);});_0x26c81e[_0xa9c5('0x7')](0x232a,_0xa9c5('0x53'),function(){console['log']('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x394d84(_0xa9c5('0x54')+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 c4bae0e..67403a5 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 _0x748e=['destcalleridnum','calleridnum','routeId','firstName','lastName','fax','scheduledAt','updatedAt','union','resolve','then','getContacts','length','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','[CM][%s][%s]\x20Autocreate\x20enabled','isNil','calleridname','','Unknown','destcalleridname','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','format','user:%s','name','trigger:%s','action','toLowerCase','merge','bluebird','ioredis','util','../../../../config/environment','../../../../config/logger','../../rpc/cmContact','redis','localhost','socket.io-emitter','info','stringify','exec','data2','data5','xmd-contactid','ListId','data3','split','phone','$or','map'];(function(_0x4ffe24,_0x3c1702){var _0x24ca10=function(_0xdd1da4){while(--_0xdd1da4){_0x4ffe24['push'](_0x4ffe24['shift']());}};_0x24ca10(++_0x3c1702);}(_0x748e,0x103));var _0xe748=function(_0x13ed69,_0x229161){_0x13ed69=_0x13ed69-0x0;var _0x50c72e=_0x748e[_0x13ed69];return _0x50c72e;};'use strict';var _=require('lodash');var BPromise=require(_0xe748('0x0'));var Redis=require(_0xe748('0x1'));var util=require(_0xe748('0x2'));var config=require(_0xe748('0x3'));var logger=require(_0xe748('0x4'))('trigger');var cmContactRpc=require(_0xe748('0x5'));config[_0xe748('0x6')]=_['defaults'](config[_0xe748('0x6')],{'host':_0xe748('0x7'),'port':0x18eb});var io=require(_0xe748('0x8'))(new Redis(config[_0xe748('0x6')]));function emit(_0x162867,_0x5a42a5,_0x43e2b5,_0x17c802,_0x40d794){logger[_0xe748('0x9')]('[CM][%s][%s]',_0x162867,_0x5a42a5['id'],_0x43e2b5,_0x17c802,JSON[_0xe748('0xa')](_0x40d794));io['to'](_0x43e2b5)['emit'](_0x17c802,_0x40d794);}exports[_0xe748('0xb')]=function(_0x4234c5,_0x80ca21,_0x391e24,_0x34febb){var _0x1515fe,_0x1036e4;var _0x2e042d={};var _0x17e7d6;var _0x1ca04f=Number(_0x391e24['data1']);var _0x3ab3bd=_0x391e24[_0xe748('0xc')]?Boolean(Number(_0x391e24['data2'])):![];var _0x3a2753;var _0x48d864=![];if(!_['isNil'](_0x391e24[_0xe748('0xd')])){if(_0x391e24[_0xe748('0xd')]=='1')_0x48d864=!![];}if(!_0x48d864){if(_0x34febb[_0xe748('0xe')]){_0x2e042d['id']=_0x34febb['xmd-contactid'];}}if(!_0x2e042d['id']){_0x2e042d[_0xe748('0xf')]=_0x1ca04f;_0x3a2753=_0x391e24[_0xe748('0x10')]&&_0x391e24[_0xe748('0x10')]!=='0'?_0x391e24[_0xe748('0x10')][_0xe748('0x11')](','):[_0xe748('0x12')];_0x2e042d[_0xe748('0x13')]=_[_0xe748('0x14')](_0x3a2753,function(_0x4d07f2){var _0x4afb7f={};_0x4afb7f[_0x4d07f2]=_0x34febb['routeId']?_0x34febb[_0xe748('0x15')]:_0x34febb[_0xe748('0x16')];return _0x4afb7f;});_0x17e7d6=_0x34febb[_0xe748('0x17')]?_0x34febb['destcalleridnum']:_0x34febb[_0xe748('0x16')];}var _0x4bb353=['id',_0xe748('0x18'),_0xe748('0x19'),_0xe748('0x12'),'mobile',_0xe748('0x1a'),_0xe748('0xf'),'createdAt',_0xe748('0x1b'),_0xe748('0x1c')];var _0x45f019=_[_0xe748('0x1d')](_0x4bb353,_0x3a2753);BPromise[_0xe748('0x1e')]()[_0xe748('0x1f')](cmContactRpc[_0xe748('0x20')]({'attributes':_0x45f019,'where':_0x2e042d,'phone':_0x17e7d6}))[_0xe748('0x1f')](function(_0x2095b9){_0x1036e4=_0x2095b9;if(!_['isEmpty'](_0x1036e4)){if(_0x1036e4[_0xe748('0x21')]===0x1){_0x1515fe=_0x1036e4[0x0];logger[_0xe748('0x9')]('[CM][%s][%s]\x20Contact\x20found:%s',_0x34febb[_0xe748('0x22')],_0x80ca21['id'],_0x1515fe['id']);}else{logger[_0xe748('0x9')](_0xe748('0x23'),_0x34febb[_0xe748('0x22')],_0x80ca21['id'],_[_0xe748('0x14')](_0x1036e4,'id')[_0xe748('0x24')](','));}return;}else{logger[_0xe748('0x9')](_0xe748('0x25'),_0x34febb[_0xe748('0x22')],_0x80ca21['id']);var _0x4cc95a={'ListId':_0x1ca04f};var _0x1e9147=_0x391e24['data4']&&_0x391e24[_0xe748('0x26')]!=='0'?_0x391e24[_0xe748('0x26')]:_0xe748('0x12');if(_0x3ab3bd){logger[_0xe748('0x9')](_0xe748('0x27'),_0x34febb[_0xe748('0x22')],_0x80ca21['id']);_0x4cc95a[_0x1e9147]=_[_0xe748('0x28')](_0x34febb[_0xe748('0x17')])?_0x34febb['calleridnum']:_0x34febb[_0xe748('0x15')];if(_['isNil'](_0x34febb[_0xe748('0x17')])){_0x4cc95a[_0xe748('0x18')]=_0x34febb[_0xe748('0x29')]&&_0x34febb['calleridname']!==_0xe748('0x2a')?_0x34febb['calleridname']:_0xe748('0x2b');}else{_0x4cc95a[_0xe748('0x18')]=_0x34febb['destcalleridname']&&_0x34febb[_0xe748('0x2c')]!==_0xe748('0x2a')?_0x34febb[_0xe748('0x2c')]:_0xe748('0x2b');}return BPromise[_0xe748('0x1e')]()[_0xe748('0x1f')](cmContactRpc[_0xe748('0x2d')](_0x4cc95a))[_0xe748('0x1f')](function(_0x1399b4){_0x1515fe=_0x1399b4;_0x1036e4[_0xe748('0x2e')](_0x1399b4);if(_0x1515fe){logger[_0xe748('0x9')](_0xe748('0x2f'),_0x34febb[_0xe748('0x22')],_0x80ca21['id'],_0x1515fe['id']);}return;});}else{logger[_0xe748('0x9')](_0xe748('0x30'),_0x34febb['uniqueid'],_0x80ca21['id']);_0x4cc95a[_0x1e9147]=_[_0xe748('0x28')](_0x34febb[_0xe748('0x17')])?_0x34febb[_0xe748('0x16')]:_0x34febb[_0xe748('0x15')];if(_['isNil'](_0x34febb['routeId'])){_0x4cc95a[_0xe748('0x18')]=_0x34febb[_0xe748('0x29')]&&_0x34febb['calleridname']!==_0xe748('0x2a')?_0x34febb[_0xe748('0x29')]:_0xe748('0x2b');}else{_0x4cc95a[_0xe748('0x18')]=_0x34febb[_0xe748('0x2c')]&&_0x34febb[_0xe748('0x2c')]!==_0xe748('0x2a')?_0x34febb[_0xe748('0x2c')]:_0xe748('0x2b');}_0x1515fe=_0x4cc95a;_0x1036e4[_0xe748('0x2e')](_0x4cc95a);return;}}})['then'](function(){if(_0x4234c5){emit(_0x34febb[_0xe748('0x22')],_0x80ca21,util[_0xe748('0x31')](_0xe748('0x32'),_0x4234c5[_0xe748('0x33')]),util['format'](_0xe748('0x34'),_0x391e24[_0xe748('0x35')][_0xe748('0x36')]()),{'evt':_[_0xe748('0x37')](_0x34febb,{'autoCreate':_0x3ab3bd}),'contact':_0x1515fe===undefined?{}:_0x1515fe,'contacts':_0x1036e4['length']===0x0?undefined:_0x1036e4});}});}; \ No newline at end of file +var _0x8747=['[CM][%s][%s]\x20Autocreate\x20disabled','destcalleridname','user:%s','format','trigger:%s','action','toLowerCase','merge','length','lodash','ioredis','../../../../config/environment','../../../../config/logger','trigger','../../rpc/cmContact','redis','defaults','socket.io-emitter','info','[CM][%s][%s]','exec','data2','isNil','data5','xmd-contactid','data3','phone','$or','map','routeId','destcalleridnum','calleridnum','firstName','mobile','fax','createdAt','scheduledAt','updatedAt','union','resolve','then','getContacts','isEmpty','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','join','data4','[CM][%s][%s]\x20Autocreate\x20enabled','calleridname','','Unknown','createContact','push'];(function(_0x15d572,_0x5785ba){var _0x35d485=function(_0x3d9258){while(--_0x3d9258){_0x15d572['push'](_0x15d572['shift']());}};_0x35d485(++_0x5785ba);}(_0x8747,0xab));var _0x7874=function(_0x38037a,_0x196abc){_0x38037a=_0x38037a-0x0;var _0x1a1246=_0x8747[_0x38037a];return _0x1a1246;};'use strict';var _=require(_0x7874('0x0'));var BPromise=require('bluebird');var Redis=require(_0x7874('0x1'));var util=require('util');var config=require(_0x7874('0x2'));var logger=require(_0x7874('0x3'))(_0x7874('0x4'));var cmContactRpc=require(_0x7874('0x5'));config[_0x7874('0x6')]=_[_0x7874('0x7')](config[_0x7874('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0x7874('0x8'))(new Redis(config[_0x7874('0x6')]));function emit(_0x13c1b8,_0x31bc7a,_0xe4d823,_0x51cfe6,_0x3b0755){logger[_0x7874('0x9')](_0x7874('0xa'),_0x13c1b8,_0x31bc7a['id'],_0xe4d823,_0x51cfe6,JSON['stringify'](_0x3b0755));io['to'](_0xe4d823)['emit'](_0x51cfe6,_0x3b0755);}exports[_0x7874('0xb')]=function(_0x488e87,_0x4019c0,_0x13fc8c,_0x1293e5){var _0x349cc9,_0x177787;var _0x3aa5a8={};var _0x13d15c;var _0x5cd7bb=Number(_0x13fc8c['data1']);var _0x3993ca=_0x13fc8c[_0x7874('0xc')]?Boolean(Number(_0x13fc8c[_0x7874('0xc')])):![];var _0x295e96;var _0x2783c5=![];if(!_[_0x7874('0xd')](_0x13fc8c[_0x7874('0xe')])){if(_0x13fc8c[_0x7874('0xe')]=='1')_0x2783c5=!![];}if(!_0x2783c5){if(_0x1293e5['xmd-contactid']){_0x3aa5a8['id']=_0x1293e5[_0x7874('0xf')];}}if(!_0x3aa5a8['id']){_0x3aa5a8['ListId']=_0x5cd7bb;_0x295e96=_0x13fc8c['data3']&&_0x13fc8c[_0x7874('0x10')]!=='0'?_0x13fc8c[_0x7874('0x10')]['split'](','):[_0x7874('0x11')];_0x3aa5a8[_0x7874('0x12')]=_[_0x7874('0x13')](_0x295e96,function(_0x137842){var _0x5881d9={};_0x5881d9[_0x137842]=_0x1293e5[_0x7874('0x14')]?_0x1293e5[_0x7874('0x15')]:_0x1293e5[_0x7874('0x16')];return _0x5881d9;});_0x13d15c=_0x1293e5[_0x7874('0x14')]?_0x1293e5[_0x7874('0x15')]:_0x1293e5[_0x7874('0x16')];}var _0x1397b3=['id',_0x7874('0x17'),'lastName',_0x7874('0x11'),_0x7874('0x18'),_0x7874('0x19'),'ListId',_0x7874('0x1a'),_0x7874('0x1b'),_0x7874('0x1c')];var _0x584491=_[_0x7874('0x1d')](_0x1397b3,_0x295e96);BPromise[_0x7874('0x1e')]()[_0x7874('0x1f')](cmContactRpc[_0x7874('0x20')]({'attributes':_0x584491,'where':_0x3aa5a8,'phone':_0x13d15c}))['then'](function(_0xbcceb){_0x177787=_0xbcceb;if(!_[_0x7874('0x21')](_0x177787)){if(_0x177787['length']===0x1){_0x349cc9=_0x177787[0x0];logger['info'](_0x7874('0x22'),_0x1293e5[_0x7874('0x23')],_0x4019c0['id'],_0x349cc9['id']);}else{logger[_0x7874('0x9')](_0x7874('0x24'),_0x1293e5[_0x7874('0x23')],_0x4019c0['id'],_[_0x7874('0x13')](_0x177787,'id')[_0x7874('0x25')](','));}return;}else{logger['info']('[CM][%s][%s]\x20Contact\x20not\x20found',_0x1293e5[_0x7874('0x23')],_0x4019c0['id']);var _0x1eb494={'ListId':_0x5cd7bb};var _0x42ecc1=_0x13fc8c[_0x7874('0x26')]&&_0x13fc8c[_0x7874('0x26')]!=='0'?_0x13fc8c['data4']:_0x7874('0x11');if(_0x3993ca){logger[_0x7874('0x9')](_0x7874('0x27'),_0x1293e5['uniqueid'],_0x4019c0['id']);_0x1eb494[_0x42ecc1]=_[_0x7874('0xd')](_0x1293e5[_0x7874('0x14')])?_0x1293e5[_0x7874('0x16')]:_0x1293e5[_0x7874('0x15')];if(_[_0x7874('0xd')](_0x1293e5['routeId'])){_0x1eb494['firstName']=_0x1293e5[_0x7874('0x28')]&&_0x1293e5[_0x7874('0x28')]!==_0x7874('0x29')?_0x1293e5[_0x7874('0x28')]:_0x7874('0x2a');}else{_0x1eb494['firstName']=_0x1293e5['destcalleridname']&&_0x1293e5['destcalleridname']!==_0x7874('0x29')?_0x1293e5['destcalleridname']:'Unknown';}return BPromise[_0x7874('0x1e')]()['then'](cmContactRpc[_0x7874('0x2b')](_0x1eb494))['then'](function(_0x48ece8){_0x349cc9=_0x48ece8;_0x177787[_0x7874('0x2c')](_0x48ece8);if(_0x349cc9){logger[_0x7874('0x9')]('[CM][%s][%s]\x20Contact\x20created:%s',_0x1293e5['uniqueid'],_0x4019c0['id'],_0x349cc9['id']);}return;});}else{logger[_0x7874('0x9')](_0x7874('0x2d'),_0x1293e5[_0x7874('0x23')],_0x4019c0['id']);_0x1eb494[_0x42ecc1]=_['isNil'](_0x1293e5[_0x7874('0x14')])?_0x1293e5[_0x7874('0x16')]:_0x1293e5[_0x7874('0x15')];if(_[_0x7874('0xd')](_0x1293e5[_0x7874('0x14')])){_0x1eb494[_0x7874('0x17')]=_0x1293e5[_0x7874('0x28')]&&_0x1293e5[_0x7874('0x28')]!==_0x7874('0x29')?_0x1293e5['calleridname']:'Unknown';}else{_0x1eb494[_0x7874('0x17')]=_0x1293e5[_0x7874('0x2e')]&&_0x1293e5[_0x7874('0x2e')]!==_0x7874('0x29')?_0x1293e5[_0x7874('0x2e')]:_0x7874('0x2a');}_0x349cc9=_0x1eb494;_0x177787['push'](_0x1eb494);return;}}})[_0x7874('0x1f')](function(){if(_0x488e87){emit(_0x1293e5['uniqueid'],_0x4019c0,util['format'](_0x7874('0x2f'),_0x488e87['name']),util[_0x7874('0x30')](_0x7874('0x31'),_0x13fc8c[_0x7874('0x32')][_0x7874('0x33')]()),{'evt':_[_0x7874('0x34')](_0x1293e5,{'autoCreate':_0x3993ca}),'contact':_0x349cc9===undefined?{}:_0x349cc9,'contacts':_0x177787[_0x7874('0x35')]===0x0?undefined:_0x177787});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index 45322ec..280c8b0 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 _0xdb6a=['./urlforward','./cmContact','./script','../../../config/environment','trigger','../ami','localhost','socket.io-emitter','redis','popup','url','winapp','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','accounts','custom:agentcalled','syncCustomEvent','custom:agentconnect','bind','custom:agentcomplete','custom:agentnosuchnumber','custom:agentbusy','custom:agentcongestion','custom:agentreject','custom:amd','custom:queuecallerabandon','custom:timeout','custom:dialbegin','syncAgentDial','custom:dialconnect','custom:newinteraction','custom:closedinteraction','custom:substatus','custom:incomingmessage','custom:outgoingmessage','custom:acceptmessage','custom:offlineMessage','emit','info','stringify','clone','motionChannel','undefined','voice','debug','inspect','checkTriggers','prototype','interface','hasOwnProperty','status','checkTrigger','variables','Actions','action','toLowerCase','motionbar','browser','data1','data2','render','html','uri','buildUri','isNil','data3','data4','uriLocation','windowWidth','data5','800','600','winArguments','format','user:%s','name','trigger:%s:%s','merge','jscripty','trigger:%s','integration','exec','routeId','urlforward','script','parse','search','channel','AllConditions','length','every','checkConditions','AnyConditions','some','checkTrigger:\x20trigger','evt','field','account','operator','value','upperFirst','AccountId','interaction','message','event','queue','agent','membername','lastevent','mailSubstatus','null','substatus','created','equals','exports','util','lodash'];(function(_0x5491ae,_0x34891d){var _0x40d220=function(_0x27f184){while(--_0x27f184){_0x5491ae['push'](_0x5491ae['shift']());}};_0x40d220(++_0x34891d);}(_0xdb6a,0x102));var _0xadb6=function(_0x320fe2,_0x2c76de){_0x320fe2=_0x320fe2-0x0;var _0x48668b=_0xdb6a[_0x320fe2];return _0x48668b;};'use strict';var util=require(_0xadb6('0x0'));var _=require(_0xadb6('0x1'));var url=require('url');var Mustache=require('mustache');var Redis=require('ioredis');var urlforward=require(_0xadb6('0x2'));var integration=require('./integration');var cmContact=require(_0xadb6('0x3'));var script=require(_0xadb6('0x4'));var config=require(_0xadb6('0x5'));var logger=require('../../../config/logger')(_0xadb6('0x6'));var ami=require(_0xadb6('0x7'));config['redis']=_['defaults'](config['redis'],{'host':_0xadb6('0x8'),'port':0x18eb});var io=require(_0xadb6('0x9'))(new Redis(config[_0xadb6('0xa')]));var operators={'equals':function(_0xb37c84,_0x4251da){return _0xb37c84==_0x4251da;},'not_equals':function(_0x1decab,_0x1c8f54){return _0x1decab!=_0x1c8f54;}};var barAndWebActions=[_0xadb6('0xb'),_0xadb6('0xc'),_0xadb6('0xd')];function Trigger(_0x47bbd8){this['triggers']=_0x47bbd8[_0xadb6('0xe')];this[_0xadb6('0xf')]=_0x47bbd8[_0xadb6('0xf')];this[_0xadb6('0x10')]=_0x47bbd8['voiceQueues'];this['templates']=_0x47bbd8[_0xadb6('0x11')];this[_0xadb6('0x12')]=_0x47bbd8['voiceExtensions'];this[_0xadb6('0x13')]=_0x47bbd8[_0xadb6('0x13')];this[_0xadb6('0x14')]=_0x47bbd8[_0xadb6('0x14')];this[_0xadb6('0x15')]=_0x47bbd8[_0xadb6('0x15')];this[_0xadb6('0x16')]=_0x47bbd8['sugarcrmAccounts'];this[_0xadb6('0x17')]=_0x47bbd8[_0xadb6('0x17')];this['deskAccounts']=_0x47bbd8[_0xadb6('0x18')];this[_0xadb6('0x19')]=_0x47bbd8[_0xadb6('0x19')];this['servicenowAccounts']=_0x47bbd8[_0xadb6('0x1a')];this['dynamics365Accounts']=_0x47bbd8[_0xadb6('0x1b')];this[_0xadb6('0x1c')]=_0x47bbd8[_0xadb6('0x1c')];this[_0xadb6('0x1d')]={'zendesk':this[_0xadb6('0x13')],'salesforce':this['salesforceAccounts'],'freshdesk':this[_0xadb6('0x14')],'sugarcrm':this[_0xadb6('0x16')],'zoho':this['zohoAccounts'],'desk':this['deskAccounts'],'vtiger':this['vtigerAccounts'],'dynamics365':this[_0xadb6('0x1b')],'freshsales':this[_0xadb6('0x1c')],'servicenow':this['servicenowAccounts']};ami['on'](_0xadb6('0x1e'),this[_0xadb6('0x1f')]['bind'](this));ami['on'](_0xadb6('0x20'),this[_0xadb6('0x1f')][_0xadb6('0x21')](this));ami['on']('custom:agentringnoanswer',this[_0xadb6('0x1f')][_0xadb6('0x21')](this));ami['on'](_0xadb6('0x22'),this[_0xadb6('0x1f')][_0xadb6('0x21')](this));ami['on'](_0xadb6('0x23'),this[_0xadb6('0x1f')][_0xadb6('0x21')](this));ami['on']('custom:agentnoanswer',this[_0xadb6('0x1f')]['bind'](this));ami['on'](_0xadb6('0x24'),this[_0xadb6('0x1f')][_0xadb6('0x21')](this));ami['on'](_0xadb6('0x25'),this['syncCustomEvent'][_0xadb6('0x21')](this));ami['on'](_0xadb6('0x26'),this[_0xadb6('0x1f')]['bind'](this));ami['on'](_0xadb6('0x27'),this[_0xadb6('0x1f')][_0xadb6('0x21')](this));ami['on'](_0xadb6('0x28'),this[_0xadb6('0x1f')][_0xadb6('0x21')](this));ami['on'](_0xadb6('0x29'),this['syncCustomEvent'][_0xadb6('0x21')](this));ami['on'](_0xadb6('0x2a'),this[_0xadb6('0x2b')][_0xadb6('0x21')](this));ami['on'](_0xadb6('0x2c'),this[_0xadb6('0x2b')][_0xadb6('0x21')](this));ami['on']('custom:dialend',this[_0xadb6('0x2b')][_0xadb6('0x21')](this));ami['on'](_0xadb6('0x2d'),this['syncCustomEvent']['bind'](this));ami['on'](_0xadb6('0x2e'),this['syncCustomEvent'][_0xadb6('0x21')](this));ami['on'](_0xadb6('0x2f'),this['syncCustomEvent'][_0xadb6('0x21')](this));ami['on'](_0xadb6('0x30'),this[_0xadb6('0x1f')][_0xadb6('0x21')](this));ami['on'](_0xadb6('0x31'),this['syncCustomEvent'][_0xadb6('0x21')](this));ami['on'](_0xadb6('0x32'),this[_0xadb6('0x1f')][_0xadb6('0x21')](this));ami['on']('custom:rejectmessage',this['syncCustomEvent'][_0xadb6('0x21')](this));ami['on'](_0xadb6('0x33'),this[_0xadb6('0x1f')][_0xadb6('0x21')](this));}Trigger['prototype'][_0xadb6('0x34')]=function(_0x11e865,_0x4287c,_0x4942dc){logger[_0xadb6('0x35')](_0x11e865,_0x4287c,JSON[_0xadb6('0x36')](_0x4942dc));io['to'](_0x11e865)['emit'](_0x4287c,_0x4942dc);};Trigger['prototype'][_0xadb6('0x1f')]=function(_0x1ea6f2){var _0x3da85f=_[_0xadb6('0x37')](_0x1ea6f2);if(typeof _0x3da85f[_0xadb6('0x38')]===_0xadb6('0x39')){_0x3da85f[_0xadb6('0x38')]=_0xadb6('0x3a');}logger[_0xadb6('0x3b')](_0xadb6('0x1f'),util[_0xadb6('0x3c')](_0x3da85f,{'showHidden':!![],'depth':null}));this[_0xadb6('0x3d')](_0x3da85f);};Trigger[_0xadb6('0x3e')][_0xadb6('0x2b')]=function(_0x2dcddf){if(this[_0xadb6('0xf')][_0x2dcddf[_0xadb6('0x3f')]]){this['syncCustomEvent'](_0x2dcddf);}};Trigger['prototype']['checkTriggers']=function(_0x131d0f){var _0x23ae9e;for(var _0x12cf8d in this[_0xadb6('0xe')]){if(this[_0xadb6('0xe')][_0xadb6('0x40')](_0x12cf8d)){if(this[_0xadb6('0xe')][_0x12cf8d][_0xadb6('0x41')]){_0x23ae9e=this[_0xadb6('0x42')](this['triggers'][_0x12cf8d],_0x131d0f);if(_0x23ae9e){_['merge'](_0x131d0f,_0x131d0f[_0xadb6('0x43')]);for(var _0x155c3b=0x0,_0x541091,_0x53a47d,_0xf5dcea;_0x155c3b0x0){_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 +var _0x814b=['calleridname','toUpperCase','lodash','request-promise','md5','util','ioredis','./util','../../../../config/logger','desk','redis','defaults','localhost','emit','application/json','validateEmail','info','Getting\x20agent\x20with\x20email','format','%s/users','then','total_entries','find','_embedded','entries','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me','remoteUri','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','debug','[HTTP]','%s:%s','authType','token','username','Basic\x20%s','toString','base64','Searching\x20enduser\x20with\x20phone','%s/customers/search','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/customers','POST','work','map','length','string','nameField','toLowerCase','content','picklist','idField','customField','custom_fields','type','variableName','customVariable','Variable','name','priority','merge','getString','Subjects','xCALLY','CTI','concat','Tags','Descriptions','/api/v2/users/%d','user','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','Authorization','email','The\x20User\x20ID\x20is:','calleridnum','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','integrationTab','user:%s','trigger:desk:display','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','https://xcally.desk.com/web/agent/case/%d','catch','error','stringify','recordingFormat','none','[OUTBOUND]','destcalleridnum','Displaying\x20ticket\x20to\x20agent...','unmanaged','lastevent'];(function(_0x1eb9ec,_0x4055cd){var _0x517c85=function(_0x10c9d9){while(--_0x10c9d9){_0x1eb9ec['push'](_0x1eb9ec['shift']());}};_0x517c85(++_0x4055cd);}(_0x814b,0x1a2));var _0xb814=function(_0x3b1b23,_0x21bccd){_0x3b1b23=_0x3b1b23-0x0;var _0x1efc85=_0x814b[_0x3b1b23];return _0x1efc85;};'use strict';var _=require(_0xb814('0x0'));var rp=require(_0xb814('0x1'));var md5=require(_0xb814('0x2'));var util=require(_0xb814('0x3'));var Redis=require(_0xb814('0x4'));var intUtil=require(_0xb814('0x5'));var config=require('../../../../config/environment');var logger=require(_0xb814('0x6'))(_0xb814('0x7'));config[_0xb814('0x8')]=_[_0xb814('0x9')](config[_0xb814('0x8')],{'host':_0xb814('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xb814('0x8')]));function emit(_0x2e6272,_0x5c8539,_0x271af9){io['to'](_0x2e6272)[_0xb814('0xb')](_0x5c8539,_0x271af9);}var headers={'Content-Type':_0xb814('0xc'),'Accept':_0xb814('0xc')};function getUser(_0x1fea33,_0x21d4a5){if(intUtil[_0xb814('0xd')](_0x21d4a5)===!![]){logger[_0xb814('0xe')](_0xb814('0xf'),_0x21d4a5);return request({'uri':util[_0xb814('0x10')](_0xb814('0x11'),_0x1fea33['remoteUri'])})[_0xb814('0x12')](function(_0x56278f){if(_0x56278f[_0xb814('0x13')]){return _[_0xb814('0x14')](_0x56278f[_0xb814('0x15')][_0xb814('0x16')],{'email':_0x21d4a5});}})[_0xb814('0x12')](function(_0x3bde14){if(_0x3bde14){logger[_0xb814('0xe')](_0xb814('0x17'));return _0x3bde14;}else{logger[_0xb814('0xe')](_0xb814('0x18'));return request({'uri':util[_0xb814('0x10')](_0xb814('0x19'),_0x1fea33[_0xb814('0x1a')])});}});}else{logger[_0xb814('0xe')](_0xb814('0x1b'));return request({'uri':util[_0xb814('0x10')](_0xb814('0x19'),_0x1fea33[_0xb814('0x1a')])});}}function request(_0x125ce2){logger[_0xb814('0x1c')](_0xb814('0x1d'),JSON['stringify'](_0x125ce2));return rp(_[_0xb814('0x9')](_0x125ce2,{'method':'GET','headers':headers,'json':!![]}));}function getAuth(_0x270598){var _0xfac75b;if(_0x270598['authType']==='basic'){_0xfac75b=util['format'](_0xb814('0x1e'),_0x270598['username'],_0x270598['password']);}else if(_0x270598[_0xb814('0x1f')]===_0xb814('0x20')){_0xfac75b=util[_0xb814('0x10')]('%s/token:%s',_0x270598[_0xb814('0x21')],_0x270598['token']);}return util[_0xb814('0x10')](_0xb814('0x22'),new Buffer(_0xfac75b)[_0xb814('0x23')](_0xb814('0x24')));}function getEndUser(_0x27352e,_0x2bd039,_0x1f5d40){logger['info'](_0xb814('0x25'),_0x1f5d40);return request({'uri':util['format'](_0xb814('0x26'),_0x27352e[_0xb814('0x1a')]),'qs':{'phone':_0x1f5d40}})[_0xb814('0x12')](function(_0x208927){if(_0x208927[_0xb814('0x13')]){logger[_0xb814('0xe')](_0xb814('0x27'));return _0x208927['_embedded'][_0xb814('0x16')][0x0];}else{logger[_0xb814('0xe')](_0xb814('0x28'));return request({'uri':util[_0xb814('0x10')](_0xb814('0x29'),_0x27352e[_0xb814('0x1a')]),'method':_0xb814('0x2a'),'body':{'first_name':_0x2bd039,'title':_0x2bd039,'phone_numbers':[{'type':_0xb814('0x2b'),'value':_0x1f5d40}]}});}});}function getTags(_0x5a6291,_0x271aa8){var _0x328a08=[];if(_0x5a6291&&_0x5a6291['length']>0x0){_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 diff --git a/server/services/ami/trigger/integration/dynamics365.js b/server/services/ami/trigger/integration/dynamics365.js index 5770ac6..761aa4d 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 _0xe3b4=['catch','toUpperCase',']\x20Wrong\x20credentials!','message','systemusers?$select=internalemailaddress,isdisabled,systemuserid','value','isNil','validateEmail','email','userEmail','internalemailaddress',']\x20Agent\x20found\x20','userId','systemuserid','info',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','username','length','toLowerCase','outbound','destcalleridnum','contacts','/systemusers(','Bearer\x20','4.0','body','headers','odata-entityid','substring','lastIndexOf','calleridnum','telephone1','GET','contacts?$select=','&$filter=','\x20eq\x20\x27','replace','%2b','enduserId','contactid','nothing',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing',']\x20Enduser\x20created!','forEach','includes','string','type','nameField','customField','idField','indexOf','ticketType','incidents','assign','getString','Descriptions','/contacts(','phonecall','callDirection','queue','phonecalls','Subjects','Fields','ticketId','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','emit','trigger:browser:url','modernAuthentication','stripTrailingSlash','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','recordingFormat','none','[OUTBOUND]',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:','additionalSearchContact',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','openNewTab',']\x20Error\x20running\x20Dynamics365\x20integration','error','Error\x20running\x20Dynamics365\x20integration','lodash','./util','md5','../../../../config/logger','dynamics365','defaults','redis','localhost','remoteUri','CloudProvider','data7','tenantId','data2','POST','clientId','password','then','access_token'];(function(_0x3b5fa4,_0x453c68){var _0x8282a=function(_0x41603f){while(--_0x41603f){_0x3b5fa4['push'](_0x3b5fa4['shift']());}};_0x8282a(++_0x453c68);}(_0xe3b4,0x1aa));var _0x4e3b=function(_0x4c0d2a,_0x3dac6f){_0x4c0d2a=_0x4c0d2a-0x0;var _0x48e5cb=_0xe3b4[_0x4c0d2a];return _0x48e5cb;};'use strict';var _=require(_0x4e3b('0x0'));var rp=require('request-promise');var util=require('util');var intUtil=require(_0x4e3b('0x1'));var md5=require(_0x4e3b('0x2'));var Redis=require('ioredis');var logger=require(_0x4e3b('0x3'))(_0x4e3b('0x4'));var config=require('../../../../config/environment');config['redis']=_[_0x4e3b('0x5')](config[_0x4e3b('0x6')],{'host':_0x4e3b('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x4e3b('0x6')]));function getAuthToken(_0x1133d7,_0x397235,_0x6be487){if(_0x1133d7['modernAuthentication']){_0x1133d7[_0x4e3b('0x8')]=_0x1133d7[_0x4e3b('0x9')][_0x4e3b('0xa')];_0x1133d7[_0x4e3b('0xb')]=_0x1133d7[_0x4e3b('0x9')][_0x4e3b('0xc')];return Promise['resolve'](_0x1133d7[_0x4e3b('0x9')]['data5']);}var _0x3ff25c={'method':_0x4e3b('0xd'),'uri':_0x397235,'form':{'client_id':_0x1133d7[_0x4e3b('0xe')],'resource':_0x1133d7[_0x4e3b('0x8')],'username':_0x1133d7['username'],'password':_0x1133d7[_0x4e3b('0xf')],'grant_type':_0x4e3b('0xf'),'client_secret':_0x1133d7['clientSecret']},'json':!![]};return rp(_0x3ff25c)[_0x4e3b('0x10')](function(_0x13865a){return _0x13865a[_0x4e3b('0x11')];})[_0x4e3b('0x12')](function(_0x3e4bd9){logger['error']('['+[_0x6be487[_0x4e3b('0x13')]()]+_0x4e3b('0x14'));return _0x3e4bd9[_0x4e3b('0x15')];});}function getUser(_0x1bb563,_0xc6f377,_0x19dd76,_0x25f60d,_0x1750b8,_0x1be674){return new Promise(function(_0x26fe63,_0x50e203){return getAuthToken(_0xc6f377,_0x25f60d,_0x1be674)[_0x4e3b('0x10')](function(_0xd8e828){var _0x4d74fb={'method':'GET','uri':_0x1750b8+_0x4e3b('0x16'),'headers':{'Authorization':'Bearer\x20'+_0xd8e828,'OData-Version':'4.0'},'json':!![]};return rp(_0x4d74fb);})[_0x4e3b('0x10')](function(_0x172465){var _0x2257db=_0x172465[_0x4e3b('0x17')];var _0x2c7280=![];var _0x46cf52=null;if(!_[_0x4e3b('0x18')](_0x19dd76)){if(intUtil[_0x4e3b('0x19')](_0x19dd76[_0x4e3b('0x1a')])){_0x1bb563[_0x4e3b('0x1b')]=_0x19dd76['email'];for(_0x46cf52=0x0;_0x46cf52<_0x2257db['length'];_0x46cf52++){if(_0x2257db[_0x46cf52][_0x4e3b('0x1c')]===_0x19dd76[_0x4e3b('0x1a')]&&!_0x2257db[_0x46cf52]['isdisabled']){_0x2c7280=!![];logger['info']('['+[_0x1be674['toUpperCase']()]+_0x4e3b('0x1d')+_0x2257db[_0x46cf52]['systemuserid']+'!');_0x1bb563[_0x4e3b('0x1e')]=_0x2257db[_0x46cf52][_0x4e3b('0x1f')];}}}}if(!_0x2c7280){logger[_0x4e3b('0x20')]('['+[_0x1be674['toUpperCase']()]+_0x4e3b('0x21'));_0x1bb563[_0x4e3b('0x1b')]=_0xc6f377[_0x4e3b('0x22')];for(_0x46cf52=0x0;_0x46cf52<_0x2257db[_0x4e3b('0x23')];_0x46cf52++){if(_0x2257db[_0x46cf52]['internalemailaddress']===_0xc6f377[_0x4e3b('0x22')]){_0x1bb563[_0x4e3b('0x1e')]=_0x2257db[_0x46cf52][_0x4e3b('0x1f')];}}}_0x26fe63(_0x1bb563);})['catch'](function(_0x13030d){_0x50e203(_0x13030d[_0x4e3b('0x15')]);});});}function createEndUser(_0x4d3f03,_0x119c98,_0x42ee79,_0x57b9cf,_0x28efc3,_0x2d3b2e,_0x516ff9){return new Promise(function(_0x492b56,_0x167ebb){return getAuthToken(_0x119c98,_0x42ee79,_0x2d3b2e)[_0x4e3b('0x10')](function(_0x16ac53){var _0x4ec5f3=_0x2d3b2e[_0x4e3b('0x24')]()===_0x4e3b('0x25')?_0x28efc3[_0x4e3b('0x26')]:_0x28efc3['calleridnum'];var _0x56b6f7={'method':'POST','uri':_0x57b9cf+_0x4e3b('0x27'),'body':{'fullname':_0x4ec5f3,'firstname':_0x4ec5f3,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x4e3b('0x28')+_0x4d3f03['userId']+')'},'headers':{'Authorization':_0x4e3b('0x29')+_0x16ac53,'OData-Version':_0x4e3b('0x2a')},'json':!![],'resolveWithFullResponse':!![]};_0x56b6f7[_0x4e3b('0x2b')][_0x516ff9]=_0x4ec5f3;return rp(_0x56b6f7);})[_0x4e3b('0x10')](function(_0x44fd90){var _0x16c682=_0x44fd90[_0x4e3b('0x2c')][_0x4e3b('0x2d')];var _0x1f0793=_0x16c682[_0x4e3b('0x2e')](_0x16c682[_0x4e3b('0x2f')]('(')+0x1,_0x16c682[_0x4e3b('0x2f')](')'));_0x4d3f03['enduserId']=_0x1f0793;_0x492b56(_0x4d3f03);})[_0x4e3b('0x12')](function(_0x2dc7ae){_0x167ebb(_0x2dc7ae[_0x4e3b('0x15')]);});});}function getEndUser(_0xeb7b99,_0x29ebe8,_0x13c263,_0xa8da0,_0x376b6d,_0x5aed11,_0x547daf,_0x45f5c5){var _0xaaf75e=_0x5aed11[_0x4e3b('0x24')]()===_0x4e3b('0x25')?_0x376b6d[_0x4e3b('0x26')]:_0x376b6d[_0x4e3b('0x30')];return getAuthToken(_0x29ebe8,_0x13c263,_0x5aed11)[_0x4e3b('0x10')](function(_0x573125){_0x45f5c5=_0x45f5c5?_0x45f5c5:_0x4e3b('0x31');var _0x341324={'method':_0x4e3b('0x32'),'uri':_0xa8da0+_0x4e3b('0x33')+_0x45f5c5+_0x4e3b('0x34')+_0x45f5c5+_0x4e3b('0x35')+_0xaaf75e[_0x4e3b('0x36')]('+',_0x4e3b('0x37'))+'\x27','headers':{'Authorization':'Bearer\x20'+_0x573125,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x341324);})[_0x4e3b('0x10')](function(_0x147baf){var _0x1ee57c=![];if(!_0x147baf)return _0x1ee57c;var _0x1fc947=_0x147baf[_0x4e3b('0x17')];for(var _0x335ad5=0x0;_0x335ad5<_0x1fc947[_0x4e3b('0x23')];_0x335ad5++){if(_0x1fc947[_0x335ad5][_0x45f5c5]===_0xaaf75e){_0x1ee57c=!![];_0xeb7b99[_0x4e3b('0x38')]=_0x1fc947[_0x335ad5][_0x4e3b('0x39')];}}return _0x1ee57c;})['then'](function(_0x481aeb){if(_0x481aeb)return _0xeb7b99;if(_0x547daf===_0x4e3b('0x3a')){logger['info']('['+[_0x5aed11[_0x4e3b('0x13')]()]+_0x4e3b('0x3b'));return _0xeb7b99;}return createEndUser(_0xeb7b99,_0x29ebe8,_0x13c263,_0xa8da0,_0x376b6d,_0x5aed11,_0x45f5c5)[_0x4e3b('0x10')](function(_0x27ded0){logger['info']('['+[_0x5aed11[_0x4e3b('0x13')]()]+_0x4e3b('0x3c'),_0x27ded0[_0x4e3b('0x38')]);return _0x27ded0;});});}function getCustomFields(_0x302944,_0x8cf8bf,_0x707697){var _0x5dd982={};if(_0x302944[_0x4e3b('0x23')]>0x0){_[_0x4e3b('0x3d')](_0x302944,function(_0x485d7c){if(_[_0x4e3b('0x3e')]([_0x4e3b('0x3f'),'picklist'],_0x485d7c[_0x4e3b('0x40')])&&_0x485d7c[_0x4e3b('0x41')]&&!_0x485d7c[_0x4e3b('0x42')]){var _0x5a0f81=_0x485d7c[_0x4e3b('0x43')][_0x4e3b('0x24')]();var _0x3feace=_0x5a0f81[_0x4e3b('0x2e')](0x0,_0x5a0f81[_0x4e3b('0x44')]('_'));var _0x513178=_0x5a0f81[_0x4e3b('0x2e')](_0x5a0f81[_0x4e3b('0x44')]('_')+0x1);if(_0x3feace===_0x707697){_0x5dd982[_0x513178]=_0x485d7c['content'];}}});}return _0x5dd982;}function getTicket(_0x3bc93a,_0x5ee1f5,_0x3402f2,_0x580239,_0x348ee6,_0x1e7641,_0x469668){return new Promise(function(_0x444365,_0x50896f){var _0x1b14fc;return getAuthToken(_0x5ee1f5,_0x3402f2,_0x469668)[_0x4e3b('0x10')](function(_0x31f37a){if(_0x1e7641[_0x4e3b('0x45')]==='incident'){_0x1b14fc={'method':_0x4e3b('0xd'),'uri':_0x580239+_0x4e3b('0x46'),'body':Object[_0x4e3b('0x47')]({},{'title':intUtil['getString'](_0x1e7641['Subjects'],_0x348ee6,'\x20'),'description':intUtil[_0x4e3b('0x48')](_0x1e7641[_0x4e3b('0x49')],_0x348ee6,'\x0a'),'customerid_contact@odata.bind':_0x3bc93a[_0x4e3b('0x38')]?_0x4e3b('0x4a')+_0x3bc93a[_0x4e3b('0x38')]+')':undefined,'ownerid@odata.bind':_0x4e3b('0x28')+_0x3bc93a['userId']+')','caseorigincode':'1'},getCustomFields(_0x1e7641['Fields'],_0x348ee6,_0x1e7641[_0x4e3b('0x45')])),'headers':{'Authorization':_0x4e3b('0x29')+_0x31f37a,'OData-Version':_0x4e3b('0x2a')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x1e7641['ticketType']===_0x4e3b('0x4b')){var _0x1236ed=_0x3bc93a[_0x4e3b('0x38')]?[{'partyid_systemuser@odata.bind':_0x4e3b('0x28')+_0x3bc93a['userId']+')','participationtypemask':_0x3bc93a[_0x4e3b('0x4c')]==='queue'?0x2:0x1},{'partyid_contact@odata.bind':'/contacts('+_0x3bc93a['enduserId']+')','participationtypemask':_0x3bc93a['callDirection']===_0x4e3b('0x4d')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0x4e3b('0x28')+_0x3bc93a[_0x4e3b('0x1e')]+')','participationtypemask':_0x3bc93a[_0x4e3b('0x4c')]===_0x4e3b('0x4d')?0x2:0x1}];_0x1b14fc={'method':_0x4e3b('0xd'),'uri':_0x580239+_0x4e3b('0x4e'),'body':Object['assign']({},{'subject':intUtil[_0x4e3b('0x48')](_0x1e7641[_0x4e3b('0x4f')],_0x348ee6,'\x20'),'phonenumber':String(_0x348ee6['calleridnum']),'description':intUtil[_0x4e3b('0x48')](_0x1e7641['Descriptions'],_0x348ee6,'\x0a'),'regardingobjectid_contact@odata.bind':_0x3bc93a[_0x4e3b('0x38')]?_0x4e3b('0x4a')+_0x3bc93a[_0x4e3b('0x38')]+')':undefined,'ownerid@odata.bind':'/systemusers('+_0x3bc93a[_0x4e3b('0x1e')]+')','directioncode':_0x3bc93a[_0x4e3b('0x4c')]===_0x4e3b('0x4d')?![]:!![],'phonecall_activity_parties':_0x1236ed},getCustomFields(_0x1e7641[_0x4e3b('0x50')],_0x348ee6,_0x1e7641[_0x4e3b('0x45')])),'headers':{'Authorization':_0x4e3b('0x29')+_0x31f37a,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x1b14fc);})['then'](function(_0x338bd7){var _0x21c3fc=_0x338bd7['headers'][_0x4e3b('0x2d')];var _0x43ec19=_0x21c3fc[_0x4e3b('0x2e')](_0x21c3fc[_0x4e3b('0x2f')]('(')+0x1,_0x21c3fc[_0x4e3b('0x2f')](')'));_0x3bc93a[_0x4e3b('0x51')]=_0x43ec19;_0x444365(_0x3bc93a);})[_0x4e3b('0x12')](function(_0x55b571){_0x50896f(_0x55b571[_0x4e3b('0x15')]);});});}function emit(_0x1ada28,_0x26ef73,_0x34c03b,_0x212121){var _0x51c00c={'uri':util['format'](_0x4e3b('0x52'),_0x1ada28,_0x34c03b,_0x212121)};io['to'](util['format'](_0x4e3b('0x53'),_0x26ef73))[_0x4e3b('0x54')](_0x4e3b('0x55'),_0x51c00c);}exports['cs']=function(_0x19a461,_0x461d30,_0x12cc34,_0x1451e6,_0x1f0cac,_0x4845b0,_0x5e6ff2,_0x933b81){var _0x560055={};_0x4845b0[_0x4e3b('0x8')]=_0x4845b0[_0x4e3b('0x56')]?intUtil[_0x4e3b('0x57')](_0x4845b0[_0x4e3b('0x9')][_0x4e3b('0xa')]):intUtil[_0x4e3b('0x57')](_0x4845b0[_0x4e3b('0x8')]);_0x4845b0['serverUrl']=intUtil[_0x4e3b('0x57')](_0x4845b0[_0x4e3b('0x58')]);_0x560055[_0x4e3b('0x4c')]=_0x933b81==='queue'||_0x933b81===_0x4e3b('0x59')?_0x4e3b('0x4d'):_0x4e3b('0x25');var _0x1ce6ab=_0x4845b0['modernAuthentication']?util[_0x4e3b('0x5a')]('%s/api/data/v9.0/',_0x4845b0[_0x4e3b('0x9')][_0x4e3b('0xa')]):util[_0x4e3b('0x5a')](_0x4e3b('0x5b'),_0x4845b0[_0x4e3b('0x8')]);var _0x1f1c4c=util[_0x4e3b('0x5a')](_0x4e3b('0x5c'),_0x4845b0[_0x4e3b('0xb')]);var _0xf6beff=util[_0x4e3b('0x5a')](_0x4e3b('0x5d'),_0x4845b0['serverUrl'],_0x461d30[_0x4e3b('0x5e')],md5(_0x461d30[_0x4e3b('0x5e')]));if(_0x1f0cac&&_0x1f0cac[_0x4e3b('0x5f')]){logger[_0x4e3b('0x20')](_0x4e3b('0x60'),_0x4e3b('0x61'));_0x461d30[_0x4e3b('0x62')]=_0xf6beff;}else if(_0x5e6ff2&&_0x5e6ff2['recordingFormat']&&_0x5e6ff2[_0x4e3b('0x63')]!==_0x4e3b('0x64')){logger['info'](_0x4e3b('0x65'),_0x4e3b('0x61'));_0x461d30['recordingURL']=_0xf6beff;}else{_0x461d30[_0x4e3b('0x62')]='';}return getUser(_0x560055,_0x4845b0,_0x1451e6,_0x1f1c4c,_0x1ce6ab,_0x933b81)[_0x4e3b('0x10')](function(_0xad7024){logger[_0x4e3b('0x20')]('['+_0x933b81[_0x4e3b('0x13')]()+_0x4e3b('0x66'),_0xad7024[_0x4e3b('0x1e')]);logger[_0x4e3b('0x20')]('['+_0x933b81[_0x4e3b('0x13')]()+_0x4e3b('0x67'),_0xad7024[_0x4e3b('0x1b')]);return getEndUser(_0xad7024,_0x4845b0,_0x1f1c4c,_0x1ce6ab,_0x461d30,_0x933b81,_0x12cc34['moduleCreate'],_0x12cc34[_0x4e3b('0x68')]);})[_0x4e3b('0x10')](function(_0x3734b4){logger[_0x4e3b('0x20')]('['+_0x933b81[_0x4e3b('0x13')]()+']\x20The\x20Enduser\x20ID\x20is:',_0x3734b4[_0x4e3b('0x38')]);logger[_0x4e3b('0x20')]('['+_0x933b81[_0x4e3b('0x13')]()+']\x20The\x20Enduser\x20phone\x20is:',_0x461d30[_0x4e3b('0x30')]);return getTicket(_0x3734b4,_0x4845b0,_0x1f1c4c,_0x1ce6ab,_0x461d30,_0x12cc34,_0x933b81);})['then'](function(_0xd3855c){logger[_0x4e3b('0x20')](util[_0x4e3b('0x5a')]('['+_0x933b81[_0x4e3b('0x13')]()+_0x4e3b('0x69'),_0x12cc34[_0x4e3b('0x45')],_0xd3855c[_0x4e3b('0x51')]));logger['info'](util['format']('['+_0x933b81[_0x4e3b('0x13')]()+_0x4e3b('0x6a'),_0x933b81));if(_0x933b81!==_0x4e3b('0x59')&&_0x12cc34[_0x4e3b('0x6b')]){logger['info']('['+_0x933b81[_0x4e3b('0x13')]()+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x4845b0[_0x4e3b('0x8')],_0x1451e6['name'],_0x12cc34['ticketType'],_0xd3855c[_0x4e3b('0x51')]);}})[_0x4e3b('0x12')](function(_0x18de34){logger['error']('['+_0x933b81[_0x4e3b('0x13')]()+_0x4e3b('0x6c'),_0x18de34[_0x4e3b('0x15')]);console[_0x4e3b('0x6d')](_0x4e3b('0x6e'),_0x18de34);});}; \ No newline at end of file +var _0x360c=['toLowerCase','outbound','telephone1','contacts?$select=','&$filter=','\x20eq\x20\x27','%2b','nothing','toUpperCase',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing',']\x20Enduser\x20created!','forEach','includes','string','customField','idField','indexOf','content','ticketType','incident','POST','incidents','assign','getString','Descriptions','Fields','callDirection','queue','/contacts(','calleridnum','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','trigger:browser:url','modernAuthentication','stripTrailingSlash','data7','serverUrl','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingURL','none','[OUTBOUND]',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:','moduleCreate','additionalSearchContact',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:','ticketId',']\x20Call\x20direction:\x20%s','unmanaged','openNewTab','Displaying\x20call\x20in\x20a\x20new\x20tab...','name','error',']\x20Error\x20running\x20Dynamics365\x20integration','Error\x20running\x20Dynamics365\x20integration','lodash','request-promise','./util','md5','../../../../config/logger','defaults','redis','localhost','remoteUri','tenantId','CloudProvider','data2','resolve','username','password','clientSecret','access_token','catch','message','then','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','value','isNil','validateEmail','userEmail','email','length','internalemailaddress','info',']\x20Agent\x20found\x20','systemuserid',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','destcalleridnum','/systemusers(','userId','headers','substring','lastIndexOf','enduserId'];(function(_0x38a1dc,_0x52208b){var _0x575ced=function(_0x26db24){while(--_0x26db24){_0x38a1dc['push'](_0x38a1dc['shift']());}};_0x575ced(++_0x52208b);}(_0x360c,0x1de));var _0xc360=function(_0x4b06b3,_0x271554){_0x4b06b3=_0x4b06b3-0x0;var _0x4d8da9=_0x360c[_0x4b06b3];return _0x4d8da9;};'use strict';var _=require(_0xc360('0x0'));var rp=require(_0xc360('0x1'));var util=require('util');var intUtil=require(_0xc360('0x2'));var md5=require(_0xc360('0x3'));var Redis=require('ioredis');var logger=require(_0xc360('0x4'))('dynamics365');var config=require('../../../../config/environment');config['redis']=_[_0xc360('0x5')](config[_0xc360('0x6')],{'host':_0xc360('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xc360('0x6')]));function getAuthToken(_0xb7e278,_0x4f07ab,_0x47e1ed){if(_0xb7e278['modernAuthentication']){_0xb7e278[_0xc360('0x8')]=_0xb7e278['CloudProvider']['data7'];_0xb7e278[_0xc360('0x9')]=_0xb7e278[_0xc360('0xa')][_0xc360('0xb')];return Promise[_0xc360('0xc')](_0xb7e278[_0xc360('0xa')]['data5']);}var _0x281955={'method':'POST','uri':_0x4f07ab,'form':{'client_id':_0xb7e278['clientId'],'resource':_0xb7e278[_0xc360('0x8')],'username':_0xb7e278[_0xc360('0xd')],'password':_0xb7e278[_0xc360('0xe')],'grant_type':_0xc360('0xe'),'client_secret':_0xb7e278[_0xc360('0xf')]},'json':!![]};return rp(_0x281955)['then'](function(_0x5936dc){return _0x5936dc[_0xc360('0x10')];})[_0xc360('0x11')](function(_0x761c71){logger['error']('['+[_0x47e1ed['toUpperCase']()]+']\x20Wrong\x20credentials!');return _0x761c71[_0xc360('0x12')];});}function getUser(_0x8c6e97,_0x14f16d,_0x5cd5c2,_0x2f6e52,_0x187fa9,_0x4e0258){return new Promise(function(_0x456427,_0x19776d){return getAuthToken(_0x14f16d,_0x2f6e52,_0x4e0258)[_0xc360('0x13')](function(_0x2c9238){var _0x51e969={'method':_0xc360('0x14'),'uri':_0x187fa9+_0xc360('0x15'),'headers':{'Authorization':_0xc360('0x16')+_0x2c9238,'OData-Version':_0xc360('0x17')},'json':!![]};return rp(_0x51e969);})[_0xc360('0x13')](function(_0x5b3567){var _0x11e0f6=_0x5b3567[_0xc360('0x18')];var _0xdeb69d=![];var _0x24403c=null;if(!_[_0xc360('0x19')](_0x5cd5c2)){if(intUtil[_0xc360('0x1a')](_0x5cd5c2['email'])){_0x8c6e97[_0xc360('0x1b')]=_0x5cd5c2[_0xc360('0x1c')];for(_0x24403c=0x0;_0x24403c<_0x11e0f6[_0xc360('0x1d')];_0x24403c++){if(_0x11e0f6[_0x24403c][_0xc360('0x1e')]===_0x5cd5c2[_0xc360('0x1c')]&&!_0x11e0f6[_0x24403c]['isdisabled']){_0xdeb69d=!![];logger[_0xc360('0x1f')]('['+[_0x4e0258['toUpperCase']()]+_0xc360('0x20')+_0x11e0f6[_0x24403c][_0xc360('0x21')]+'!');_0x8c6e97['userId']=_0x11e0f6[_0x24403c][_0xc360('0x21')];}}}}if(!_0xdeb69d){logger[_0xc360('0x1f')]('['+[_0x4e0258['toUpperCase']()]+_0xc360('0x22'));_0x8c6e97['userEmail']=_0x14f16d['username'];for(_0x24403c=0x0;_0x24403c<_0x11e0f6[_0xc360('0x1d')];_0x24403c++){if(_0x11e0f6[_0x24403c]['internalemailaddress']===_0x14f16d[_0xc360('0xd')]){_0x8c6e97['userId']=_0x11e0f6[_0x24403c][_0xc360('0x21')];}}}_0x456427(_0x8c6e97);})[_0xc360('0x11')](function(_0x5a6da5){_0x19776d(_0x5a6da5[_0xc360('0x12')]);});});}function createEndUser(_0x2391ce,_0x4cde76,_0x378094,_0x234855,_0x33808a,_0x8a7bdb,_0x6ecb56){return new Promise(function(_0x59c530,_0x2898fd){return getAuthToken(_0x4cde76,_0x378094,_0x8a7bdb)['then'](function(_0x100365){var _0x393c14=_0x8a7bdb['toLowerCase']()==='outbound'?_0x33808a[_0xc360('0x23')]:_0x33808a['calleridnum'];var _0x554e3b={'method':'POST','uri':_0x234855+'contacts','body':{'fullname':_0x393c14,'firstname':_0x393c14,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0xc360('0x24')+_0x2391ce[_0xc360('0x25')]+')'},'headers':{'Authorization':_0xc360('0x16')+_0x100365,'OData-Version':_0xc360('0x17')},'json':!![],'resolveWithFullResponse':!![]};_0x554e3b['body'][_0x6ecb56]=_0x393c14;return rp(_0x554e3b);})[_0xc360('0x13')](function(_0xcbe730){var _0x174bae=_0xcbe730[_0xc360('0x26')]['odata-entityid'];var _0x467465=_0x174bae[_0xc360('0x27')](_0x174bae['lastIndexOf']('(')+0x1,_0x174bae[_0xc360('0x28')](')'));_0x2391ce[_0xc360('0x29')]=_0x467465;_0x59c530(_0x2391ce);})[_0xc360('0x11')](function(_0xa5ac2a){_0x2898fd(_0xa5ac2a[_0xc360('0x12')]);});});}function getEndUser(_0x4d73eb,_0x36cfc0,_0x2f5c2a,_0x35fe6f,_0x39d51a,_0x591fe5,_0x478338,_0x4afb34){var _0x1a1a0f=_0x591fe5[_0xc360('0x2a')]()===_0xc360('0x2b')?_0x39d51a[_0xc360('0x23')]:_0x39d51a['calleridnum'];return getAuthToken(_0x36cfc0,_0x2f5c2a,_0x591fe5)['then'](function(_0x25d9f9){_0x4afb34=_0x4afb34?_0x4afb34:_0xc360('0x2c');var _0x52e53f={'method':_0xc360('0x14'),'uri':_0x35fe6f+_0xc360('0x2d')+_0x4afb34+_0xc360('0x2e')+_0x4afb34+_0xc360('0x2f')+_0x1a1a0f['replace']('+',_0xc360('0x30'))+'\x27','headers':{'Authorization':_0xc360('0x16')+_0x25d9f9,'If-None-Match':null,'OData-Version':_0xc360('0x17')},'json':!![]};return rp(_0x52e53f);})[_0xc360('0x13')](function(_0x140e79){var _0x3cfedb=![];if(!_0x140e79)return _0x3cfedb;var _0xf28231=_0x140e79[_0xc360('0x18')];for(var _0x6eadf1=0x0;_0x6eadf1<_0xf28231[_0xc360('0x1d')];_0x6eadf1++){if(_0xf28231[_0x6eadf1][_0x4afb34]===_0x1a1a0f){_0x3cfedb=!![];_0x4d73eb[_0xc360('0x29')]=_0xf28231[_0x6eadf1]['contactid'];}}return _0x3cfedb;})[_0xc360('0x13')](function(_0x536380){if(_0x536380)return _0x4d73eb;if(_0x478338===_0xc360('0x31')){logger[_0xc360('0x1f')]('['+[_0x591fe5[_0xc360('0x32')]()]+_0xc360('0x33'));return _0x4d73eb;}return createEndUser(_0x4d73eb,_0x36cfc0,_0x2f5c2a,_0x35fe6f,_0x39d51a,_0x591fe5,_0x4afb34)[_0xc360('0x13')](function(_0x1164d1){logger[_0xc360('0x1f')]('['+[_0x591fe5[_0xc360('0x32')]()]+_0xc360('0x34'),_0x1164d1[_0xc360('0x29')]);return _0x1164d1;});});}function getCustomFields(_0x2575f0,_0x27c89c,_0x2c998f){var _0xc3d9cb={};if(_0x2575f0[_0xc360('0x1d')]>0x0){_[_0xc360('0x35')](_0x2575f0,function(_0x1939df){if(_[_0xc360('0x36')]([_0xc360('0x37'),'picklist'],_0x1939df['type'])&&_0x1939df['nameField']&&!_0x1939df[_0xc360('0x38')]){var _0x27d310=_0x1939df[_0xc360('0x39')][_0xc360('0x2a')]();var _0x1f5551=_0x27d310[_0xc360('0x27')](0x0,_0x27d310[_0xc360('0x3a')]('_'));var _0xd8e907=_0x27d310[_0xc360('0x27')](_0x27d310['indexOf']('_')+0x1);if(_0x1f5551===_0x2c998f){_0xc3d9cb[_0xd8e907]=_0x1939df[_0xc360('0x3b')];}}});}return _0xc3d9cb;}function getTicket(_0x5899a5,_0x1ffcca,_0x25dd7b,_0xfa7eef,_0x159248,_0x2937ac,_0x8542a2){return new Promise(function(_0x2dc389,_0x41d031){var _0x48e66b;return getAuthToken(_0x1ffcca,_0x25dd7b,_0x8542a2)[_0xc360('0x13')](function(_0x3b1b21){if(_0x2937ac[_0xc360('0x3c')]===_0xc360('0x3d')){_0x48e66b={'method':_0xc360('0x3e'),'uri':_0xfa7eef+_0xc360('0x3f'),'body':Object[_0xc360('0x40')]({},{'title':intUtil[_0xc360('0x41')](_0x2937ac['Subjects'],_0x159248,'\x20'),'description':intUtil[_0xc360('0x41')](_0x2937ac[_0xc360('0x42')],_0x159248,'\x0a'),'customerid_contact@odata.bind':_0x5899a5[_0xc360('0x29')]?'/contacts('+_0x5899a5['enduserId']+')':undefined,'ownerid@odata.bind':_0xc360('0x24')+_0x5899a5[_0xc360('0x25')]+')','caseorigincode':'1'},getCustomFields(_0x2937ac[_0xc360('0x43')],_0x159248,_0x2937ac[_0xc360('0x3c')])),'headers':{'Authorization':'Bearer\x20'+_0x3b1b21,'OData-Version':_0xc360('0x17')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x2937ac[_0xc360('0x3c')]==='phonecall'){var _0x339ec5=_0x5899a5['enduserId']?[{'partyid_systemuser@odata.bind':_0xc360('0x24')+_0x5899a5[_0xc360('0x25')]+')','participationtypemask':_0x5899a5[_0xc360('0x44')]===_0xc360('0x45')?0x2:0x1},{'partyid_contact@odata.bind':_0xc360('0x46')+_0x5899a5[_0xc360('0x29')]+')','participationtypemask':_0x5899a5['callDirection']===_0xc360('0x45')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':'/systemusers('+_0x5899a5[_0xc360('0x25')]+')','participationtypemask':_0x5899a5[_0xc360('0x44')]==='queue'?0x2:0x1}];_0x48e66b={'method':_0xc360('0x3e'),'uri':_0xfa7eef+'phonecalls','body':Object['assign']({},{'subject':intUtil[_0xc360('0x41')](_0x2937ac['Subjects'],_0x159248,'\x20'),'phonenumber':String(_0x159248[_0xc360('0x47')]),'description':intUtil[_0xc360('0x41')](_0x2937ac['Descriptions'],_0x159248,'\x0a'),'regardingobjectid_contact@odata.bind':_0x5899a5[_0xc360('0x29')]?_0xc360('0x46')+_0x5899a5[_0xc360('0x29')]+')':undefined,'ownerid@odata.bind':_0xc360('0x24')+_0x5899a5['userId']+')','directioncode':_0x5899a5[_0xc360('0x44')]===_0xc360('0x45')?![]:!![],'phonecall_activity_parties':_0x339ec5},getCustomFields(_0x2937ac[_0xc360('0x43')],_0x159248,_0x2937ac[_0xc360('0x3c')])),'headers':{'Authorization':_0xc360('0x16')+_0x3b1b21,'OData-Version':_0xc360('0x17')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x48e66b);})[_0xc360('0x13')](function(_0x21497c){var _0x157ff7=_0x21497c[_0xc360('0x26')]['odata-entityid'];var _0x537c00=_0x157ff7[_0xc360('0x27')](_0x157ff7[_0xc360('0x28')]('(')+0x1,_0x157ff7[_0xc360('0x28')](')'));_0x5899a5['ticketId']=_0x537c00;_0x2dc389(_0x5899a5);})[_0xc360('0x11')](function(_0x58858a){_0x41d031(_0x58858a[_0xc360('0x12')]);});});}function emit(_0x2d04d6,_0x4089b5,_0x5bceed,_0xc51ff7){var _0x21e52c={'uri':util[_0xc360('0x48')](_0xc360('0x49'),_0x2d04d6,_0x5bceed,_0xc51ff7)};io['to'](util[_0xc360('0x48')](_0xc360('0x4a'),_0x4089b5))['emit'](_0xc360('0x4b'),_0x21e52c);}exports['cs']=function(_0xa47900,_0x32635e,_0xfdfc34,_0x233534,_0x3c65a5,_0x14346e,_0x37bdbe,_0x58b8a8){var _0x2ec8ef={};_0x14346e['remoteUri']=_0x14346e[_0xc360('0x4c')]?intUtil[_0xc360('0x4d')](_0x14346e['CloudProvider'][_0xc360('0x4e')]):intUtil['stripTrailingSlash'](_0x14346e['remoteUri']);_0x14346e[_0xc360('0x4f')]=intUtil[_0xc360('0x4d')](_0x14346e[_0xc360('0x4f')]);_0x2ec8ef[_0xc360('0x44')]=_0x58b8a8===_0xc360('0x45')||_0x58b8a8==='unmanaged'?_0xc360('0x45'):'outbound';var _0x17bfca=_0x14346e[_0xc360('0x4c')]?util[_0xc360('0x48')](_0xc360('0x50'),_0x14346e[_0xc360('0xa')][_0xc360('0x4e')]):util[_0xc360('0x48')](_0xc360('0x50'),_0x14346e['remoteUri']);var _0x5c9df7=util['format'](_0xc360('0x51'),_0x14346e[_0xc360('0x9')]);var _0x3b1c09=util['format'](_0xc360('0x52'),_0x14346e[_0xc360('0x4f')],_0x32635e[_0xc360('0x53')],md5(_0x32635e[_0xc360('0x53')]));if(_0x3c65a5&&_0x3c65a5[_0xc360('0x54')]){logger[_0xc360('0x1f')]('[QUEUE]',_0xc360('0x55'));_0x32635e[_0xc360('0x56')]=_0x3b1c09;}else if(_0x37bdbe&&_0x37bdbe['recordingFormat']&&_0x37bdbe['recordingFormat']!==_0xc360('0x57')){logger['info'](_0xc360('0x58'),'Recording\x20is\x20enabled!');_0x32635e[_0xc360('0x56')]=_0x3b1c09;}else{_0x32635e['recordingURL']='';}return getUser(_0x2ec8ef,_0x14346e,_0x233534,_0x5c9df7,_0x17bfca,_0x58b8a8)[_0xc360('0x13')](function(_0x4e1705){logger[_0xc360('0x1f')]('['+_0x58b8a8[_0xc360('0x32')]()+_0xc360('0x59'),_0x4e1705[_0xc360('0x25')]);logger[_0xc360('0x1f')]('['+_0x58b8a8['toUpperCase']()+_0xc360('0x5a'),_0x4e1705[_0xc360('0x1b')]);return getEndUser(_0x4e1705,_0x14346e,_0x5c9df7,_0x17bfca,_0x32635e,_0x58b8a8,_0xfdfc34[_0xc360('0x5b')],_0xfdfc34[_0xc360('0x5c')]);})['then'](function(_0x2d3e48){logger[_0xc360('0x1f')]('['+_0x58b8a8['toUpperCase']()+_0xc360('0x5d'),_0x2d3e48[_0xc360('0x29')]);logger['info']('['+_0x58b8a8['toUpperCase']()+_0xc360('0x5e'),_0x32635e[_0xc360('0x47')]);return getTicket(_0x2d3e48,_0x14346e,_0x5c9df7,_0x17bfca,_0x32635e,_0xfdfc34,_0x58b8a8);})[_0xc360('0x13')](function(_0x596ecc){logger['info'](util[_0xc360('0x48')]('['+_0x58b8a8[_0xc360('0x32')]()+']\x20The\x20%s\x20ID\x20is:\x20%s',_0xfdfc34['ticketType'],_0x596ecc[_0xc360('0x5f')]));logger[_0xc360('0x1f')](util[_0xc360('0x48')]('['+_0x58b8a8[_0xc360('0x32')]()+_0xc360('0x60'),_0x58b8a8));if(_0x58b8a8!==_0xc360('0x61')&&_0xfdfc34[_0xc360('0x62')]){logger[_0xc360('0x1f')]('['+_0x58b8a8[_0xc360('0x32')]()+']',_0xc360('0x63'));emit(_0x14346e[_0xc360('0x8')],_0x233534[_0xc360('0x64')],_0xfdfc34['ticketType'],_0x596ecc[_0xc360('0x5f')]);}})[_0xc360('0x11')](function(_0x46b2a4){logger[_0xc360('0x65')]('['+_0x58b8a8[_0xc360('0x32')]()+_0xc360('0x66'),_0x46b2a4[_0xc360('0x12')]);console[_0xc360('0x65')](_0xc360('0x67'),_0x46b2a4);});}; \ 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 6030119..01ca1ef 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 _0xba62=['uniqueid','recordingURL','Authorization','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','catch','error','outbound','stripTrailingSlash','recordingFormat','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','[OUTBOUND]','unmanaged','lastevent','toUpperCase','lodash','request-promise','util','ioredis','../../../../config/environment','../../../../config/logger','freshdesk','redis','localhost','socket.io-emitter','application/json','emit','Creating\x20new\x20ticket...','merge','format','calleridname','calleridnum','getString','Subjects','Tags','name','Fields','mapValues','keyBy','custom_fields','%s/api/v2/tickets','remoteUri','then','info','Ticket\x20created!','validateEmail','%s/api/v2/agents','length','Agent\x20found!','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20found!','find','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','Basic\x20%s','apiKey','debug','stringify','defaults','GET','map','forEach','includes','string','picklist','customField','nameField','toLowerCase','content','idField','toString','variable','variableName','push','type','customVariable','Variable','queue','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s'];(function(_0x4dc425,_0x4688ec){var _0x199287=function(_0x5ee5b9){while(--_0x5ee5b9){_0x4dc425['push'](_0x4dc425['shift']());}};_0x199287(++_0x4688ec);}(_0xba62,0x74));var _0x2ba6=function(_0x3a3d20,_0x244316){_0x3a3d20=_0x3a3d20-0x0;var _0x33bc94=_0xba62[_0x3a3d20];return _0x33bc94;};'use strict';var _=require(_0x2ba6('0x0'));var rp=require(_0x2ba6('0x1'));var md5=require('md5');var util=require(_0x2ba6('0x2'));var Redis=require(_0x2ba6('0x3'));var intUtil=require('./util');var config=require(_0x2ba6('0x4'));var logger=require(_0x2ba6('0x5'))(_0x2ba6('0x6'));config[_0x2ba6('0x7')]=_['defaults'](config[_0x2ba6('0x7')],{'host':_0x2ba6('0x8'),'port':0x18eb});var io=require(_0x2ba6('0x9'))(new Redis(config[_0x2ba6('0x7')]));var headers={'Content-Type':_0x2ba6('0xa'),'Accept':_0x2ba6('0xa')};function emit(_0x726a14,_0x1a5441,_0x4b6822){io['to'](_0x726a14)[_0x2ba6('0xb')](_0x1a5441,_0x4b6822);}function getTicket(_0x4388b2,_0xedb39d,_0x2161a8,_0x1328e6,_0x3cb3af){logger['info'](_0x2ba6('0xc'));var _0x554a69=_[_0x2ba6('0xd')]({'responder_id':_0xedb39d['id'],'requester_id':_0x2161a8['id'],'name':util[_0x2ba6('0xe')]('Caller\x20-\x20%s',_0x3cb3af[_0x2ba6('0xf')]),'phone':_0x3cb3af[_0x2ba6('0x10')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x2ba6('0x11')](_0x1328e6[_0x2ba6('0x12')],_0x3cb3af,'\x20'),'description':intUtil[_0x2ba6('0x11')](_0x1328e6['Descriptions'],_0x3cb3af,'
'),'tags':getTags(_0x1328e6[_0x2ba6('0x13')],_0x2ba6('0x14'))},getCustomFields(_0x1328e6[_0x2ba6('0x15')],_0x3cb3af));_0x554a69['custom_fields']=_[_0x2ba6('0x16')](_[_0x2ba6('0x17')](_0x554a69[_0x2ba6('0x18')],'id'),'value');return request({'uri':util[_0x2ba6('0xe')](_0x2ba6('0x19'),_0x4388b2[_0x2ba6('0x1a')]),'method':'POST','body':_0x554a69})[_0x2ba6('0x1b')](function(_0x2c9786){logger[_0x2ba6('0x1c')](_0x2ba6('0x1d'));return _0x2c9786;});}function getUser(_0x16027a,_0x33b3bc){if(intUtil[_0x2ba6('0x1e')](_0x33b3bc)){return request({'uri':util[_0x2ba6('0xe')](_0x2ba6('0x1f'),_0x16027a[_0x2ba6('0x1a')]),'qs':{'email':_0x33b3bc}})[_0x2ba6('0x1b')](function(_0x57f1e4){if(_0x57f1e4[_0x2ba6('0x20')]){logger[_0x2ba6('0x1c')](_0x2ba6('0x21'));return _['find'](_0x57f1e4,function(_0xbe44a){return _0xbe44a[_0x2ba6('0x22')][_0x2ba6('0x23')]===_0x33b3bc;});}else{logger['info'](_0x2ba6('0x24'));return request({'uri':util['format'](_0x2ba6('0x25'),_0x16027a[_0x2ba6('0x1a')])})[_0x2ba6('0x1b')](function(_0x2f5152){logger[_0x2ba6('0x1c')](_0x2ba6('0x26'));return _0x2f5152;});}});}else{logger['info']('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x2ba6('0xe')](_0x2ba6('0x25'),_0x16027a['remoteUri'])})['then'](function(_0x205589){logger[_0x2ba6('0x1c')](_0x2ba6('0x26'));return _0x205589;});}}function getEndUser(_0x236d1c,_0x2820a5,_0x53c56d){logger[_0x2ba6('0x1c')](_0x2ba6('0x27'),_0x53c56d);return request({'uri':util[_0x2ba6('0xe')](_0x2ba6('0x28'),_0x236d1c[_0x2ba6('0x1a')]),'qs':{'phone':_0x53c56d}})[_0x2ba6('0x1b')](function(_0x45abe9){if(_0x45abe9[_0x2ba6('0x20')]){logger[_0x2ba6('0x1c')](_0x2ba6('0x29'));return _[_0x2ba6('0x2a')](_0x45abe9,{'phone':_0x53c56d});}else{logger[_0x2ba6('0x1c')](_0x2ba6('0x2b'));return request({'uri':util['format'](_0x2ba6('0x28'),_0x236d1c[_0x2ba6('0x1a')]),'method':'POST','body':{'name':_0x2820a5,'phone':_0x53c56d}})[_0x2ba6('0x1b')](function(_0x3ec1d3){logger[_0x2ba6('0x1c')](_0x2ba6('0x2c'));return _0x3ec1d3;});}});}function getAuth(_0x3b974a){return util['format'](_0x2ba6('0x2d'),new Buffer(_0x3b974a[_0x2ba6('0x2e')]+':X')['toString']('base64'));}function request(_0x70ba3a){logger[_0x2ba6('0x2f')]('[HTTP]',JSON[_0x2ba6('0x30')](_0x70ba3a));return rp(_[_0x2ba6('0x31')](_0x70ba3a,{'method':_0x2ba6('0x32'),'headers':headers,'json':!![]}));}function getTags(_0x4f4797,_0x2763db){var _0x1d71a0=[];if(_0x4f4797&&_0x4f4797[_0x2ba6('0x20')]>0x0){_0x1d71a0=_[_0x2ba6('0x33')](_0x4f4797,_0x2763db);}return _0x1d71a0;}function getCustomFields(_0x4be40f,_0x21c139){var _0x2e683d=[];var _0x55171e={'custom_fields':[]};if(_0x4be40f[_0x2ba6('0x20')]>0x0){_[_0x2ba6('0x34')](_0x4be40f,function(_0x2744dd){if(_[_0x2ba6('0x35')]([_0x2ba6('0x36'),_0x2ba6('0x37')],_0x2744dd['type'])&&_0x2744dd['nameField']&&!_0x2744dd[_0x2ba6('0x38')]){_0x55171e[_0x2744dd[_0x2ba6('0x39')][_0x2ba6('0x3a')]()]=_0x2744dd[_0x2ba6('0x3b')]['toString']();}else if(_['includes']([_0x2ba6('0x36'),_0x2ba6('0x37')],_0x2744dd['type'])&&_0x2744dd[_0x2ba6('0x3c')]&&_0x2744dd[_0x2ba6('0x38')]){_0x55171e['custom_fields']['push']({'id':_0x2744dd[_0x2ba6('0x3c')],'value':_0x2744dd[_0x2ba6('0x3b')][_0x2ba6('0x3d')]()});}else if(_0x2744dd['type']===_0x2ba6('0x3e')&&_0x2744dd[_0x2ba6('0x3f')]&&_0x2744dd[_0x2ba6('0x3c')]&&_0x2744dd[_0x2ba6('0x38')]){_0x21c139[_0x2744dd[_0x2ba6('0x3f')]]&&_0x55171e['custom_fields'][_0x2ba6('0x40')]({'id':_0x2744dd[_0x2ba6('0x3c')],'value':_0x21c139[_0x2744dd[_0x2ba6('0x3f')]]['toString']()});}else if(_0x2744dd[_0x2ba6('0x41')]===_0x2ba6('0x42')&&_0x2744dd[_0x2ba6('0x43')]&&_0x2744dd[_0x2ba6('0x43')]['name']&&_0x2744dd['idField']&&_0x2744dd['customField']){_0x21c139[_0x2744dd[_0x2ba6('0x43')][_0x2ba6('0x14')][_0x2ba6('0x3a')]()]&&_0x55171e[_0x2ba6('0x18')][_0x2ba6('0x40')]({'id':_0x2744dd['idField'],'value':_0x21c139[_0x2744dd[_0x2ba6('0x43')][_0x2ba6('0x14')][_0x2ba6('0x3a')]()][_0x2ba6('0x3d')]()});}});}return _0x55171e;}exports[_0x2ba6('0x44')]=function(_0xd0e7fa,_0x158ab6,_0x19ed26,_0x91f3e1,_0x58c997,_0x11b469){var _0x2470c7,_0xe7425c;_0x11b469['remoteUri']=intUtil['stripTrailingSlash'](_0x11b469['remoteUri']);_0x11b469[_0x2ba6('0x45')]=intUtil['stripTrailingSlash'](_0x11b469[_0x2ba6('0x45')]);if(_0x58c997&&_0x58c997[_0x2ba6('0x46')]){logger[_0x2ba6('0x1c')](_0x2ba6('0x47'),_0x2ba6('0x48'));_0x158ab6['recordingURL']=util[_0x2ba6('0xe')](_0x2ba6('0x49'),_0x11b469[_0x2ba6('0x45')],_0x158ab6['uniqueid'],md5(_0x158ab6[_0x2ba6('0x4a')]));}else{_0x158ab6[_0x2ba6('0x4b')]='';}headers[_0x2ba6('0x4c')]=getAuth(_0x11b469);return getUser(_0x11b469,_0x91f3e1[_0x2ba6('0x23')])['then'](function(_0x262926){_0x2470c7=_0x262926;logger['info'](_0x2ba6('0x4d'),_0x2470c7['id']);return getEndUser(_0x11b469,_0x158ab6['calleridname'],_0x158ab6[_0x2ba6('0x10')]);})['then'](function(_0x2b9a31){_0xe7425c=_0x2b9a31;logger[_0x2ba6('0x1c')](_0x2ba6('0x4e'),_0xe7425c['id']);return getTicket(_0x11b469,_0x2470c7,_0xe7425c,_0x19ed26,_0x158ab6);})[_0x2ba6('0x1b')](function(_0x54667f){if(_0x54667f&&_0x54667f['id']){logger[_0x2ba6('0x1c')](_0x2ba6('0x1d'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x54667f['id']);logger[_0x2ba6('0x1c')](_0x2ba6('0x47'),_0x2ba6('0x4f'));emit(util[_0x2ba6('0xe')](_0x2ba6('0x50'),_0x91f3e1[_0x2ba6('0x14')]),_0x2ba6('0x51'),{'uri':util[_0x2ba6('0xe')](_0x2ba6('0x52'),_0x11b469[_0x2ba6('0x1a')],_0x54667f['id'])});}})[_0x2ba6('0x53')](function(_0x3972e6){logger[_0x2ba6('0x54')](_0x2ba6('0x47'),JSON['stringify'](_0x3972e6));});};exports[_0x2ba6('0x55')]=function(_0xa1478a,_0x2169af,_0x2a918c,_0xa17624,_0x4b6482,_0x40c4f5,_0x3f4549){var _0x254682,_0x14d452;_0x40c4f5[_0x2ba6('0x1a')]=intUtil[_0x2ba6('0x56')](_0x40c4f5[_0x2ba6('0x1a')]);_0x40c4f5[_0x2ba6('0x45')]=intUtil[_0x2ba6('0x56')](_0x40c4f5[_0x2ba6('0x45')]);if(_0x3f4549&&_0x3f4549[_0x2ba6('0x57')]&&_0x3f4549[_0x2ba6('0x57')]!=='none'){logger[_0x2ba6('0x1c')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x2169af[_0x2ba6('0x4b')]=util[_0x2ba6('0xe')](_0x2ba6('0x49'),_0x40c4f5[_0x2ba6('0x45')],_0x2169af['uniqueid'],md5(_0x2169af[_0x2ba6('0x4a')]));}headers[_0x2ba6('0x4c')]=getAuth(_0x40c4f5);return getUser(_0x40c4f5,_0xa17624[_0x2ba6('0x23')])[_0x2ba6('0x1b')](function(_0x183b91){_0x254682=_0x183b91;logger[_0x2ba6('0x1c')](_0x2ba6('0x4d'),_0x254682['id']);return getEndUser(_0x40c4f5,_0x2169af[_0x2ba6('0x58')],_0x2169af[_0x2ba6('0x59')]);})[_0x2ba6('0x1b')](function(_0x742b79){_0x14d452=_0x742b79;logger[_0x2ba6('0x1c')](_0x2ba6('0x4e'),_0x14d452['id']);return getTicket(_0x40c4f5,_0x254682,_0x14d452,_0x2a918c,_0x2169af);})['then'](function(_0x4cb59c){if(_0x4cb59c&&_0x4cb59c['id']){logger[_0x2ba6('0x1c')]('Ticket\x20created!');logger[_0x2ba6('0x1c')](_0x2ba6('0x5a'),_0x4cb59c['id']);logger[_0x2ba6('0x1c')](_0x2ba6('0x5b'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0x2ba6('0x50'),_0xa17624[_0x2ba6('0x14')]),_0x2ba6('0x51'),{'uri':util[_0x2ba6('0xe')](_0x2ba6('0x52'),_0x40c4f5['remoteUri'],_0x4cb59c['id'])});}})['catch'](function(_0x3fa1ed){logger['error'](_0x2ba6('0x5b'),JSON['stringify'](_0x3fa1ed));});};exports[_0x2ba6('0x5c')]=function(_0x486fb7,_0x1f2ea6,_0x44dcba,_0x3caa7c,_0x47433b,_0x3f134d){var _0x2e234a,_0x3764e0;_0x3f134d[_0x2ba6('0x1a')]=intUtil[_0x2ba6('0x56')](_0x3f134d[_0x2ba6('0x1a')]);_0x3f134d[_0x2ba6('0x45')]=intUtil['stripTrailingSlash'](_0x3f134d[_0x2ba6('0x45')]);if(_0x47433b&&_0x47433b['monitor_format']){logger['info']('['+_0x1f2ea6[_0x2ba6('0x5d')][_0x2ba6('0x5e')]()+']',_0x2ba6('0x48'));_0x1f2ea6['recordingURL']=util[_0x2ba6('0xe')](_0x2ba6('0x49'),_0x3f134d[_0x2ba6('0x45')],_0x1f2ea6[_0x2ba6('0x4a')],md5(_0x1f2ea6[_0x2ba6('0x4a')]));}else{_0x1f2ea6['recordingURL']='';}headers[_0x2ba6('0x4c')]=getAuth(_0x3f134d);return getUser(_0x3f134d,'')[_0x2ba6('0x1b')](function(_0x397534){_0x2e234a=_0x397534;logger[_0x2ba6('0x1c')]('The\x20User\x20ID\x20is:',_0x2e234a['id']);return getEndUser(_0x3f134d,_0x1f2ea6[_0x2ba6('0xf')],_0x1f2ea6[_0x2ba6('0x10')]);})[_0x2ba6('0x1b')](function(_0x283275){_0x3764e0=_0x283275;logger[_0x2ba6('0x1c')](_0x2ba6('0x4e'),_0x3764e0['id']);return getTicket(_0x3f134d,_0x2e234a,_0x3764e0,_0x44dcba,_0x1f2ea6);})[_0x2ba6('0x1b')](function(_0x5441cb){if(_0x5441cb){logger[_0x2ba6('0x1c')](_0x2ba6('0x1d'));logger[_0x2ba6('0x1c')]('The\x20Ticket\x20ID\x20is:',_0x5441cb['id']);}})[_0x2ba6('0x53')](function(_0x1b2028){logger[_0x2ba6('0x54')]('['+_0x1f2ea6[_0x2ba6('0x5d')][_0x2ba6('0x5e')]()+']',JSON[_0x2ba6('0x30')](_0x1b2028));});}; \ No newline at end of file +var _0x3e77=['serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','Authorization','The\x20User\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','catch','error','stripTrailingSlash','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridnum','The\x20Enduser\x20ID\x20is:','%s/helpdesk/tickets/%d','unmanaged','lastevent','toUpperCase','lodash','md5','./util','../../../../config/environment','../../../../config/logger','freshdesk','redis','defaults','localhost','socket.io-emitter','application/json','emit','Creating\x20new\x20ticket...','format','Caller\x20-\x20%s','calleridname','calleridnum','getString','Subjects','Descriptions','
','name','Fields','custom_fields','mapValues','keyBy','%s/api/v2/tickets','remoteUri','POST','info','Ticket\x20created!','validateEmail','Agent\x20found!','find','contact','email','%s/api/v2/agents/me','then','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','length','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/api/v2/contacts','Enduser\x20created.','Basic\x20%s','toString','base64','[HTTP]','stringify','GET','map','forEach','string','picklist','type','customField','nameField','content','includes','push','idField','variable','variableName','customVariable','Variable','toLowerCase','queue'];(function(_0x4ad8e8,_0x174578){var _0x17b05b=function(_0x1d206e){while(--_0x1d206e){_0x4ad8e8['push'](_0x4ad8e8['shift']());}};_0x17b05b(++_0x174578);}(_0x3e77,0x1ea));var _0x73e7=function(_0x3160be,_0x4d4a92){_0x3160be=_0x3160be-0x0;var _0x4b9ca8=_0x3e77[_0x3160be];return _0x4b9ca8;};'use strict';var _=require(_0x73e7('0x0'));var rp=require('request-promise');var md5=require(_0x73e7('0x1'));var util=require('util');var Redis=require('ioredis');var intUtil=require(_0x73e7('0x2'));var config=require(_0x73e7('0x3'));var logger=require(_0x73e7('0x4'))(_0x73e7('0x5'));config[_0x73e7('0x6')]=_[_0x73e7('0x7')](config[_0x73e7('0x6')],{'host':_0x73e7('0x8'),'port':0x18eb});var io=require(_0x73e7('0x9'))(new Redis(config[_0x73e7('0x6')]));var headers={'Content-Type':_0x73e7('0xa'),'Accept':_0x73e7('0xa')};function emit(_0xcdd14,_0x18c214,_0x5de521){io['to'](_0xcdd14)[_0x73e7('0xb')](_0x18c214,_0x5de521);}function getTicket(_0x45a444,_0x549c2d,_0x351b69,_0xdf2591,_0x29b35f){logger['info'](_0x73e7('0xc'));var _0x2fa878=_['merge']({'responder_id':_0x549c2d['id'],'requester_id':_0x351b69['id'],'name':util[_0x73e7('0xd')](_0x73e7('0xe'),_0x29b35f[_0x73e7('0xf')]),'phone':_0x29b35f[_0x73e7('0x10')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x73e7('0x11')](_0xdf2591[_0x73e7('0x12')],_0x29b35f,'\x20'),'description':intUtil[_0x73e7('0x11')](_0xdf2591[_0x73e7('0x13')],_0x29b35f,_0x73e7('0x14')),'tags':getTags(_0xdf2591['Tags'],_0x73e7('0x15'))},getCustomFields(_0xdf2591[_0x73e7('0x16')],_0x29b35f));_0x2fa878[_0x73e7('0x17')]=_[_0x73e7('0x18')](_[_0x73e7('0x19')](_0x2fa878['custom_fields'],'id'),'value');return request({'uri':util[_0x73e7('0xd')](_0x73e7('0x1a'),_0x45a444[_0x73e7('0x1b')]),'method':_0x73e7('0x1c'),'body':_0x2fa878})['then'](function(_0x15998d){logger[_0x73e7('0x1d')](_0x73e7('0x1e'));return _0x15998d;});}function getUser(_0x1d46cc,_0x1f195f){if(intUtil[_0x73e7('0x1f')](_0x1f195f)){return request({'uri':util['format']('%s/api/v2/agents',_0x1d46cc[_0x73e7('0x1b')]),'qs':{'email':_0x1f195f}})['then'](function(_0x24674f){if(_0x24674f['length']){logger['info'](_0x73e7('0x20'));return _[_0x73e7('0x21')](_0x24674f,function(_0x314e01){return _0x314e01[_0x73e7('0x22')][_0x73e7('0x23')]===_0x1f195f;});}else{logger['info']('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x73e7('0xd')](_0x73e7('0x24'),_0x1d46cc[_0x73e7('0x1b')])})['then'](function(_0x2fada1){logger[_0x73e7('0x1d')]('Admin\x20account\x20selected.');return _0x2fada1;});}});}else{logger['info']('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x73e7('0xd')](_0x73e7('0x24'),_0x1d46cc[_0x73e7('0x1b')])})[_0x73e7('0x25')](function(_0x3057b4){logger[_0x73e7('0x1d')](_0x73e7('0x26'));return _0x3057b4;});}}function getEndUser(_0x570e85,_0x5e299b,_0x3feee1){logger['info'](_0x73e7('0x27'),_0x3feee1);return request({'uri':util[_0x73e7('0xd')]('%s/api/v2/contacts',_0x570e85[_0x73e7('0x1b')]),'qs':{'phone':_0x3feee1}})['then'](function(_0x25f3b4){if(_0x25f3b4[_0x73e7('0x28')]){logger[_0x73e7('0x1d')](_0x73e7('0x29'));return _[_0x73e7('0x21')](_0x25f3b4,{'phone':_0x3feee1});}else{logger[_0x73e7('0x1d')](_0x73e7('0x2a'));return request({'uri':util['format'](_0x73e7('0x2b'),_0x570e85[_0x73e7('0x1b')]),'method':_0x73e7('0x1c'),'body':{'name':_0x5e299b,'phone':_0x3feee1}})[_0x73e7('0x25')](function(_0x37e632){logger[_0x73e7('0x1d')](_0x73e7('0x2c'));return _0x37e632;});}});}function getAuth(_0x386137){return util['format'](_0x73e7('0x2d'),new Buffer(_0x386137['apiKey']+':X')[_0x73e7('0x2e')](_0x73e7('0x2f')));}function request(_0x606d5){logger['debug'](_0x73e7('0x30'),JSON[_0x73e7('0x31')](_0x606d5));return rp(_['defaults'](_0x606d5,{'method':_0x73e7('0x32'),'headers':headers,'json':!![]}));}function getTags(_0x1a71de,_0x238799){var _0x31d831=[];if(_0x1a71de&&_0x1a71de['length']>0x0){_0x31d831=_[_0x73e7('0x33')](_0x1a71de,_0x238799);}return _0x31d831;}function getCustomFields(_0x45443d,_0x3bbc82){var _0x3e48c1=[];var _0x580442={'custom_fields':[]};if(_0x45443d[_0x73e7('0x28')]>0x0){_[_0x73e7('0x34')](_0x45443d,function(_0x4a6acd){if(_['includes']([_0x73e7('0x35'),_0x73e7('0x36')],_0x4a6acd[_0x73e7('0x37')])&&_0x4a6acd['nameField']&&!_0x4a6acd[_0x73e7('0x38')]){_0x580442[_0x4a6acd[_0x73e7('0x39')]['toLowerCase']()]=_0x4a6acd[_0x73e7('0x3a')]['toString']();}else if(_[_0x73e7('0x3b')](['string',_0x73e7('0x36')],_0x4a6acd['type'])&&_0x4a6acd['idField']&&_0x4a6acd['customField']){_0x580442[_0x73e7('0x17')][_0x73e7('0x3c')]({'id':_0x4a6acd[_0x73e7('0x3d')],'value':_0x4a6acd['content']['toString']()});}else if(_0x4a6acd[_0x73e7('0x37')]===_0x73e7('0x3e')&&_0x4a6acd[_0x73e7('0x3f')]&&_0x4a6acd[_0x73e7('0x3d')]&&_0x4a6acd['customField']){_0x3bbc82[_0x4a6acd['variableName']]&&_0x580442[_0x73e7('0x17')][_0x73e7('0x3c')]({'id':_0x4a6acd[_0x73e7('0x3d')],'value':_0x3bbc82[_0x4a6acd['variableName']][_0x73e7('0x2e')]()});}else if(_0x4a6acd[_0x73e7('0x37')]===_0x73e7('0x40')&&_0x4a6acd[_0x73e7('0x41')]&&_0x4a6acd[_0x73e7('0x41')][_0x73e7('0x15')]&&_0x4a6acd[_0x73e7('0x3d')]&&_0x4a6acd['customField']){_0x3bbc82[_0x4a6acd[_0x73e7('0x41')]['name'][_0x73e7('0x42')]()]&&_0x580442[_0x73e7('0x17')][_0x73e7('0x3c')]({'id':_0x4a6acd[_0x73e7('0x3d')],'value':_0x3bbc82[_0x4a6acd[_0x73e7('0x41')][_0x73e7('0x15')][_0x73e7('0x42')]()][_0x73e7('0x2e')]()});}});}return _0x580442;}exports[_0x73e7('0x43')]=function(_0x5819e7,_0xed4e2a,_0x2a8dfa,_0xc02c6e,_0x5d1eaa,_0x4879f9){var _0x456624,_0x103bcb;_0x4879f9[_0x73e7('0x1b')]=intUtil['stripTrailingSlash'](_0x4879f9['remoteUri']);_0x4879f9['serverUrl']=intUtil['stripTrailingSlash'](_0x4879f9[_0x73e7('0x44')]);if(_0x5d1eaa&&_0x5d1eaa[_0x73e7('0x45')]){logger[_0x73e7('0x1d')](_0x73e7('0x46'),_0x73e7('0x47'));_0xed4e2a[_0x73e7('0x48')]=util[_0x73e7('0xd')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4879f9['serverUrl'],_0xed4e2a['uniqueid'],md5(_0xed4e2a[_0x73e7('0x49')]));}else{_0xed4e2a[_0x73e7('0x48')]='';}headers[_0x73e7('0x4a')]=getAuth(_0x4879f9);return getUser(_0x4879f9,_0xc02c6e[_0x73e7('0x23')])[_0x73e7('0x25')](function(_0x101e02){_0x456624=_0x101e02;logger[_0x73e7('0x1d')](_0x73e7('0x4b'),_0x456624['id']);return getEndUser(_0x4879f9,_0xed4e2a[_0x73e7('0xf')],_0xed4e2a[_0x73e7('0x10')]);})[_0x73e7('0x25')](function(_0x25ff4c){_0x103bcb=_0x25ff4c;logger[_0x73e7('0x1d')]('The\x20Enduser\x20ID\x20is:',_0x103bcb['id']);return getTicket(_0x4879f9,_0x456624,_0x103bcb,_0x2a8dfa,_0xed4e2a);})[_0x73e7('0x25')](function(_0x3f1a96){if(_0x3f1a96&&_0x3f1a96['id']){logger[_0x73e7('0x1d')]('Ticket\x20created!');logger[_0x73e7('0x1d')](_0x73e7('0x4c'),_0x3f1a96['id']);logger[_0x73e7('0x1d')]('[QUEUE]',_0x73e7('0x4d'));emit(util['format'](_0x73e7('0x4e'),_0xc02c6e[_0x73e7('0x15')]),_0x73e7('0x4f'),{'uri':util[_0x73e7('0xd')]('%s/helpdesk/tickets/%d',_0x4879f9[_0x73e7('0x1b')],_0x3f1a96['id'])});}})[_0x73e7('0x50')](function(_0x22917e){logger[_0x73e7('0x51')](_0x73e7('0x46'),JSON[_0x73e7('0x31')](_0x22917e));});};exports['outbound']=function(_0x5c2f7d,_0x3beb47,_0x169d70,_0x1ae51f,_0x450a00,_0x5a5f5d,_0x26785d){var _0x83b023,_0x42b565;_0x5a5f5d[_0x73e7('0x1b')]=intUtil[_0x73e7('0x52')](_0x5a5f5d[_0x73e7('0x1b')]);_0x5a5f5d[_0x73e7('0x44')]=intUtil[_0x73e7('0x52')](_0x5a5f5d['serverUrl']);if(_0x26785d&&_0x26785d['recordingFormat']&&_0x26785d[_0x73e7('0x53')]!==_0x73e7('0x54')){logger[_0x73e7('0x1d')](_0x73e7('0x55'),'Recording\x20is\x20enabled!');_0x3beb47['recordingURL']=util[_0x73e7('0xd')](_0x73e7('0x56'),_0x5a5f5d[_0x73e7('0x44')],_0x3beb47[_0x73e7('0x49')],md5(_0x3beb47[_0x73e7('0x49')]));}headers['Authorization']=getAuth(_0x5a5f5d);return getUser(_0x5a5f5d,_0x1ae51f['email'])['then'](function(_0x467100){_0x83b023=_0x467100;logger[_0x73e7('0x1d')](_0x73e7('0x4b'),_0x83b023['id']);return getEndUser(_0x5a5f5d,_0x3beb47['destcalleridname'],_0x3beb47[_0x73e7('0x57')]);})[_0x73e7('0x25')](function(_0x41fa37){_0x42b565=_0x41fa37;logger['info'](_0x73e7('0x58'),_0x42b565['id']);return getTicket(_0x5a5f5d,_0x83b023,_0x42b565,_0x169d70,_0x3beb47);})[_0x73e7('0x25')](function(_0xea034b){if(_0xea034b&&_0xea034b['id']){logger['info'](_0x73e7('0x1e'));logger[_0x73e7('0x1d')](_0x73e7('0x4c'),_0xea034b['id']);logger[_0x73e7('0x1d')](_0x73e7('0x55'),_0x73e7('0x4d'));emit(util['format'](_0x73e7('0x4e'),_0x1ae51f['name']),_0x73e7('0x4f'),{'uri':util[_0x73e7('0xd')](_0x73e7('0x59'),_0x5a5f5d[_0x73e7('0x1b')],_0xea034b['id'])});}})[_0x73e7('0x50')](function(_0x31a50a){logger[_0x73e7('0x51')]('[OUTBOUND]',JSON[_0x73e7('0x31')](_0x31a50a));});};exports[_0x73e7('0x5a')]=function(_0x4ad6bf,_0x29d59c,_0x22dfec,_0xc48e4e,_0x38dc7e,_0x104af6){var _0x45a824,_0x1ac1db;_0x104af6[_0x73e7('0x1b')]=intUtil[_0x73e7('0x52')](_0x104af6[_0x73e7('0x1b')]);_0x104af6[_0x73e7('0x44')]=intUtil[_0x73e7('0x52')](_0x104af6[_0x73e7('0x44')]);if(_0x38dc7e&&_0x38dc7e[_0x73e7('0x45')]){logger[_0x73e7('0x1d')]('['+_0x29d59c[_0x73e7('0x5b')][_0x73e7('0x5c')]()+']',_0x73e7('0x47'));_0x29d59c[_0x73e7('0x48')]=util[_0x73e7('0xd')](_0x73e7('0x56'),_0x104af6['serverUrl'],_0x29d59c[_0x73e7('0x49')],md5(_0x29d59c[_0x73e7('0x49')]));}else{_0x29d59c[_0x73e7('0x48')]='';}headers[_0x73e7('0x4a')]=getAuth(_0x104af6);return getUser(_0x104af6,'')[_0x73e7('0x25')](function(_0x51a11a){_0x45a824=_0x51a11a;logger[_0x73e7('0x1d')]('The\x20User\x20ID\x20is:',_0x45a824['id']);return getEndUser(_0x104af6,_0x29d59c[_0x73e7('0xf')],_0x29d59c[_0x73e7('0x10')]);})[_0x73e7('0x25')](function(_0x969567){_0x1ac1db=_0x969567;logger[_0x73e7('0x1d')](_0x73e7('0x58'),_0x1ac1db['id']);return getTicket(_0x104af6,_0x45a824,_0x1ac1db,_0x22dfec,_0x29d59c);})[_0x73e7('0x25')](function(_0x103b2d){if(_0x103b2d){logger[_0x73e7('0x1d')]('Ticket\x20created!');logger[_0x73e7('0x1d')](_0x73e7('0x4c'),_0x103b2d['id']);}})[_0x73e7('0x50')](function(_0x20bc8b){logger[_0x73e7('0x51')]('['+_0x29d59c['lastevent'][_0x73e7('0x5c')]()+']',JSON['stringify'](_0x20bc8b));});}; \ 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 8ea2a95..e37d127 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 _0x2c01=[']\x20Error\x20running\x20Freshsales\x20integration','inspect','request-promise','util','moment','bluebird','ioredis','./util','../../../../config/environment','../../../../config/logger','freshsales','redis','localhost','headers','Getting\x20admin\x20information','then','users','length','email','adminEmail','info','Admin\x20found:','adminId','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','message','GET','Getting\x20user\x20list','Getting\x20user\x20with\x20email','agentEmail','userEmail','User\x20found:','userId','Admin\x20selected','/api/lookup?q=','&f=','&entities=contact','find','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','endUserId','Contact\x20found\x20mobile_number:','Contact\x20found\x20work_number:','/api/contacts','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','POST','Subjects','getString','Descriptions','add','YYYY-MM-DDTHH:mm:ss','ticketId','task','user:%s','trigger:browser:url','stripTrailingSlash','remoteUri','serverUrl','toLowerCase','outbound','destcalleridnum','unmanaged','queue','uniqueid','monitor_format','[QUEUE]','recordingURL','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...','name'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0x2c01,0x1e2));var _0x12c0=function(_0x46e15a,_0xa1010f){_0x46e15a=_0x46e15a-0x0;var _0x331873=_0x2c01[_0x46e15a];return _0x331873;};'use strict';var _=require('lodash');var rp=require(_0x12c0('0x0'));var md5=require('md5');var util=require(_0x12c0('0x1'));var moment=require(_0x12c0('0x2'));var Promise=require(_0x12c0('0x3'));var Redis=require(_0x12c0('0x4'));var intUtil=require(_0x12c0('0x5'));var config=require(_0x12c0('0x6'));var logger=require(_0x12c0('0x7'))(_0x12c0('0x8'));config[_0x12c0('0x9')]=_['defaults'](config[_0x12c0('0x9')],{'host':_0x12c0('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function getAdminId(_0x26c740,_0x2a13cb,_0x393f06,_0x34196f){return new Promise(function(_0x1cf617,_0x2e2069){var _0x4f142b=![];var _0x33877b={'method':'GET','uri':_0x34196f+'/api/selector/owners','json':!![]};_0x33877b[_0x12c0('0xb')]=_0x393f06;logger['info'](_0x12c0('0xc'));return rp(_0x33877b)[_0x12c0('0xd')](function(_0x32fb24){if(_0x32fb24){var _0x2fcea2=_0x32fb24[_0x12c0('0xe')];var _0x47f8bf=null;for(_0x47f8bf=0x0;_0x47f8bf<_0x2fcea2[_0x12c0('0xf')];_0x47f8bf++){if(_0x2fcea2[_0x47f8bf][_0x12c0('0x10')]===_0x26c740[_0x12c0('0x11')]){_0x26c740['adminId']=_0x2fcea2[_0x47f8bf]['id'];_0x4f142b=!![];}}if(_0x4f142b){logger[_0x12c0('0x12')](_0x12c0('0x13'),_0x26c740[_0x12c0('0x14')]);_0x1cf617(_0x26c740);}else{_0x2e2069({'statusCode':0x194,'message':_0x12c0('0x15')});}}else{_0x2e2069({'statusCode':0x194,'message':_0x12c0('0x15')});}})[_0x12c0('0x16')](function(_0xb98e07){logger[_0x12c0('0x17')]('['+[_0x2a13cb[_0x12c0('0x18')]()]+']',_0xb98e07[_0x12c0('0x19')]);_0x2e2069(_0xb98e07);});});}function getUser(_0x3d3d8b,_0x4ee8bd,_0x60495e){return function(_0x281149){return new Promise(function(_0xbbb319,_0x4a6b15){var _0x21358e={'method':_0x12c0('0x1a'),'uri':_0x60495e+'/api/selector/owners','json':!![]};_0x21358e[_0x12c0('0xb')]=_0x4ee8bd;logger[_0x12c0('0x12')](_0x12c0('0x1b'));return rp(_0x21358e)[_0x12c0('0xd')](function(_0x465f2b){if(_0x465f2b){var _0x33537e=_0x465f2b[_0x12c0('0xe')];var _0x3646e5=![];var _0x2e8a6f=null;if(_0x281149['agentEmail']!==null){logger[_0x12c0('0x12')](_0x12c0('0x1c'),_0x281149[_0x12c0('0x1d')]);_0x281149[_0x12c0('0x1e')]=_0x281149[_0x12c0('0x1d')];for(_0x2e8a6f=0x0;_0x2e8a6f<_0x33537e[_0x12c0('0xf')];_0x2e8a6f++){if(_0x33537e[_0x2e8a6f][_0x12c0('0x10')]===_0x281149['agentEmail']){_0x3646e5=!![];_0x281149['userId']=_0x33537e[_0x2e8a6f]['id'];logger[_0x12c0('0x12')](_0x12c0('0x1f'),_0x281149[_0x12c0('0x20')]);}}}if(!_0x3646e5){logger[_0x12c0('0x12')](_0x12c0('0x21'));_0x281149['userEmail']=_0x281149[_0x12c0('0x11')];_0x281149['userId']=_0x281149[_0x12c0('0x14')];_0x3646e5=!![];}if(_0x3646e5){_0xbbb319(_0x281149);}else{_0x4a6b15({'statusCode':0x194,'message':_0x12c0('0x15')});}}else{_0x4a6b15({'statusCode':0x194,'message':_0x12c0('0x15')});}})[_0x12c0('0x16')](function(_0x3bfaf7){logger[_0x12c0('0x17')]('['+[_0x3d3d8b['toUpperCase']()]+']',_0x3bfaf7[_0x12c0('0x19')]);_0x4a6b15(_0x3bfaf7);});});};}function searchContact(_0x25460d,_0x492b09,_0x52c98a,_0x5e5b0a){return new Promise(function(_0xf1b09e,_0x596ec2){var _0x2e1b00={'method':_0x12c0('0x1a'),'headers':_0x492b09,'uri':_0x25460d+_0x12c0('0x22')+_0x5e5b0a+_0x12c0('0x23')+_0x52c98a+_0x12c0('0x24'),'json':!![]};rp(_0x2e1b00)[_0x12c0('0xd')](function(_0x25ab68){var _0x43b381=_[_0x12c0('0x25')](_0x25ab68[_0x12c0('0x26')][_0x12c0('0x26')],[_0x52c98a,_0x5e5b0a]);_0xf1b09e(_0x43b381);})[_0x12c0('0x16')](function(_0x105a3){_0x596ec2(_0x105a3);});});}function getEndUser(_0x250b07,_0x325516,_0x137e66){return function(_0x402041){return new Promise(function(_0x4a5669,_0x14d6f6){logger[_0x12c0('0x12')](util[_0x12c0('0x27')](_0x12c0('0x28'),_0x402041[_0x12c0('0x29')]));searchContact(_0x137e66,_0x325516,'mobile_number',_0x402041['contactNumber'])[_0x12c0('0xd')](function(_0x37fc7c){if(_0x37fc7c){_0x402041[_0x12c0('0x2a')]=_0x37fc7c['id'];logger[_0x12c0('0x12')](_0x12c0('0x2b'),_0x402041['endUserId']);return _0x4a5669(_0x402041);}searchContact(_0x137e66,_0x325516,'work_number',_0x402041[_0x12c0('0x29')])[_0x12c0('0xd')](function(_0x32c886){if(_0x32c886){_0x402041[_0x12c0('0x2a')]=_0x32c886['id'];logger[_0x12c0('0x12')](_0x12c0('0x2c'),_0x402041['endUserId']);return _0x4a5669(_0x402041);}createEndUser(_0x402041,_0x250b07,_0x325516,_0x137e66)['then'](function(_0x1097e5){logger[_0x12c0('0x12')]('Contact\x20created:',_0x1097e5[_0x12c0('0x2a')]);return _0x4a5669(_0x1097e5);});});})[_0x12c0('0x16')](function(_0x19103c){_0x14d6f6(_0x19103c);});});};}function createEndUser(_0x45d3d8,_0x2194bc,_0x2ab49d,_0x26b967){return new Promise(function(_0x1e0e39,_0x3557c6){var _0x57feea=moment();var _0x11f9c5={'method':'POST','uri':_0x26b967+_0x12c0('0x2d'),'body':{'contact':{'last_name':_0x45d3d8['contactNumber'],'work_number':_0x45d3d8[_0x12c0('0x29')],'mobile_number':_0x45d3d8[_0x12c0('0x29')],'owner_id':_0x45d3d8['userId'],'created_at':_0x57feea['format']('YYYY-MM-DDTHH:mm:ss')}},'json':!![]};_0x11f9c5[_0x12c0('0xb')]=_0x2ab49d;logger['info'](_0x12c0('0x2e'));return rp(_0x11f9c5)['then'](function(_0x1bc563){_0x45d3d8[_0x12c0('0x2a')]=_0x1bc563[_0x12c0('0x2f')]['id'];_0x1e0e39(_0x45d3d8);})[_0x12c0('0x16')](function(_0x426428){logger[_0x12c0('0x17')]('['+[_0x2194bc[_0x12c0('0x18')]()]+']',_0x426428[_0x12c0('0x19')]);_0x3557c6(_0x426428['message']);});});}function getTicket(_0x3074e7,_0x28183c,_0x25d996,_0xeae3e3,_0x1add43){return function(_0x675363){logger[_0x12c0('0x12')](_0x12c0('0x30'));return new Promise(function(_0x16d0f3,_0x1c4550){var _0x529a6b=moment();var _0x217f98={'method':_0x12c0('0x31'),'uri':_0x25d996+'/api/tasks','body':{'title':intUtil['getString'](_0xeae3e3[_0x12c0('0x32')],_0x1add43,'\x20'),'description':intUtil[_0x12c0('0x33')](_0xeae3e3[_0x12c0('0x34')],_0x1add43,'\x0a'),'owner_id':_0x675363['userId'],'creater_id':_0x675363[_0x12c0('0x14')],'targetable_id':_0x675363['endUserId'],'targetable_type':'Contact','created_at':_0x529a6b[_0x12c0('0x27')]('YYYY-MM-DDTHH:mm:ss'),'due_date':_0x529a6b[_0x12c0('0x35')](0x1e,'m')[_0x12c0('0x27')](_0x12c0('0x36'))},'json':!![]};_0x217f98[_0x12c0('0xb')]=_0x28183c;return rp(_0x217f98)['then'](function(_0x6cf489){_0x675363[_0x12c0('0x37')]=_0x6cf489[_0x12c0('0x38')]['id'];logger[_0x12c0('0x12')]('Task\x20created:',_0x675363[_0x12c0('0x37')]);_0x16d0f3(_0x675363);})[_0x12c0('0x16')](function(_0x164918){logger['error']('['+[_0x3074e7[_0x12c0('0x18')]()]+']',_0x164918[_0x12c0('0x19')]);_0x1c4550(_0x164918[_0x12c0('0x19')]);});});};}function emit(_0x49d5c9,_0x9aff19,_0x41569b){var _0x19fa85={'uri':_0x49d5c9+'/contacts/'+_0x41569b};io['to'](util['format'](_0x12c0('0x39'),_0x9aff19))['emit'](_0x12c0('0x3a'),_0x19fa85);}exports['cs']=function(_0x4ad920,_0x2ce95b,_0x327d6b,_0x4f5459,_0x1fddff,_0x38db67,_0x34d317,_0x517780){var _0x329a5c={};var _0x3e7b39={'Authorization':'Token\x20token='+_0x38db67['apiKey']};_0x38db67['remoteUri']=intUtil[_0x12c0('0x3b')](_0x38db67[_0x12c0('0x3c')]);_0x38db67[_0x12c0('0x3d')]=intUtil[_0x12c0('0x3b')](_0x38db67[_0x12c0('0x3d')]);var _0x5b930b=_0x38db67[_0x12c0('0x3c')];_0x329a5c[_0x12c0('0x11')]=_0x38db67['username'];_0x329a5c[_0x12c0('0x29')]=_0x517780[_0x12c0('0x3e')]()===_0x12c0('0x3f')?_0x2ce95b[_0x12c0('0x40')]:_0x2ce95b['calleridnum'];_0x329a5c['callDirection']=_0x517780==='queue'||_0x517780===_0x12c0('0x41')?_0x12c0('0x42'):'outbound';if(_0x4f5459){_0x329a5c[_0x12c0('0x1d')]=_0x4f5459['email'];}var _0x27924a=util[_0x12c0('0x27')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x38db67['serverUrl'],_0x2ce95b[_0x12c0('0x43')],md5(_0x2ce95b[_0x12c0('0x43')]));if(_0x1fddff&&_0x1fddff[_0x12c0('0x44')]){logger['info'](_0x12c0('0x45'),'Recording\x20is\x20enabled!');_0x2ce95b[_0x12c0('0x46')]=_0x27924a;}else if(_0x34d317&&_0x34d317[_0x12c0('0x47')]&&_0x34d317['recordingFormat']!==_0x12c0('0x48')){logger[_0x12c0('0x12')](_0x12c0('0x49'),_0x12c0('0x4a'));_0x2ce95b[_0x12c0('0x46')]=_0x27924a;}else{_0x2ce95b[_0x12c0('0x46')]='';}return getAdminId(_0x329a5c,_0x517780,_0x3e7b39,_0x5b930b)[_0x12c0('0xd')](getUser(_0x517780,_0x3e7b39,_0x5b930b))[_0x12c0('0xd')](getEndUser(_0x517780,_0x3e7b39,_0x5b930b))[_0x12c0('0xd')](getTicket(_0x517780,_0x3e7b39,_0x5b930b,_0x327d6b,_0x2ce95b))[_0x12c0('0xd')](function(_0x5c6e0c){logger[_0x12c0('0x12')](util['format'](_0x12c0('0x4b'),_0x5c6e0c['ticketId']));if(_0x517780!=='unmanaged'){logger[_0x12c0('0x12')]('['+[_0x517780[_0x12c0('0x18')]()]+']',_0x12c0('0x4c'));emit(_0x5b930b,_0x4f5459[_0x12c0('0x4d')],_0x5c6e0c[_0x12c0('0x2a')]);}})[_0x12c0('0x16')](function(_0x4c892f){logger[_0x12c0('0x17')]('['+[_0x517780[_0x12c0('0x18')]()]+_0x12c0('0x4e'),util[_0x12c0('0x4f')](_0x4c892f,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x1bc6=['Creating\x20new\x20task','/api/tasks','getString','Subjects','Descriptions','Contact','add','format','task','Task\x20created:','/contacts/','user:%s','emit','trigger:browser:url','Token\x20token=','apiKey','remoteUri','stripTrailingSlash','serverUrl','username','toLowerCase','destcalleridnum','callDirection','queue','unmanaged','outbound','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','The\x20ticket\x20ID\x20is:\x20%s','ticketId','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','md5','util','moment','bluebird','./util','../../../../config/environment','../../../../config/logger','freshsales','redis','defaults','socket.io-emitter','GET','/api/selector/owners','info','Getting\x20admin\x20information','then','length','email','adminEmail','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','message','headers','Getting\x20user\x20list','users','agentEmail','Getting\x20user\x20with\x20email','userEmail','userId','Admin\x20selected','adminId','/api/lookup?q=','&f=','&entities=contact','find','contacts','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number','endUserId','Contact\x20found\x20mobile_number:','work_number','Contact\x20created:','POST','/api/contacts','YYYY-MM-DDTHH:mm:ss','contact'];(function(_0x5e29b1,_0x1be8f9){var _0x4f37fd=function(_0xd6b18a){while(--_0xd6b18a){_0x5e29b1['push'](_0x5e29b1['shift']());}};_0x4f37fd(++_0x1be8f9);}(_0x1bc6,0x1df));var _0x61bc=function(_0x1ad2ca,_0x42501d){_0x1ad2ca=_0x1ad2ca-0x0;var _0x3051fa=_0x1bc6[_0x1ad2ca];return _0x3051fa;};'use strict';var _=require('lodash');var rp=require('request-promise');var md5=require(_0x61bc('0x0'));var util=require(_0x61bc('0x1'));var moment=require(_0x61bc('0x2'));var Promise=require(_0x61bc('0x3'));var Redis=require('ioredis');var intUtil=require(_0x61bc('0x4'));var config=require(_0x61bc('0x5'));var logger=require(_0x61bc('0x6'))(_0x61bc('0x7'));config[_0x61bc('0x8')]=_[_0x61bc('0x9')](config[_0x61bc('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0x61bc('0xa'))(new Redis(config[_0x61bc('0x8')]));function getAdminId(_0x47262e,_0x38a5d8,_0x5d9354,_0x4d2195){return new Promise(function(_0x138280,_0x4f3f35){var _0x1f0dac=![];var _0x49aa18={'method':_0x61bc('0xb'),'uri':_0x4d2195+_0x61bc('0xc'),'json':!![]};_0x49aa18['headers']=_0x5d9354;logger[_0x61bc('0xd')](_0x61bc('0xe'));return rp(_0x49aa18)[_0x61bc('0xf')](function(_0x278cb2){if(_0x278cb2){var _0x16ec87=_0x278cb2['users'];var _0xc0bf69=null;for(_0xc0bf69=0x0;_0xc0bf69<_0x16ec87[_0x61bc('0x10')];_0xc0bf69++){if(_0x16ec87[_0xc0bf69][_0x61bc('0x11')]===_0x47262e[_0x61bc('0x12')]){_0x47262e['adminId']=_0x16ec87[_0xc0bf69]['id'];_0x1f0dac=!![];}}if(_0x1f0dac){logger[_0x61bc('0xd')]('Admin\x20found:',_0x47262e['adminId']);_0x138280(_0x47262e);}else{_0x4f3f35({'statusCode':0x194,'message':_0x61bc('0x13')});}}else{_0x4f3f35({'statusCode':0x194,'message':_0x61bc('0x13')});}})[_0x61bc('0x14')](function(_0x966cdc){logger[_0x61bc('0x15')]('['+[_0x38a5d8[_0x61bc('0x16')]()]+']',_0x966cdc[_0x61bc('0x17')]);_0x4f3f35(_0x966cdc);});});}function getUser(_0x1ba878,_0x52721c,_0x588a42){return function(_0x2b2d2a){return new Promise(function(_0x34d58a,_0x2611e3){var _0x68948c={'method':_0x61bc('0xb'),'uri':_0x588a42+_0x61bc('0xc'),'json':!![]};_0x68948c[_0x61bc('0x18')]=_0x52721c;logger[_0x61bc('0xd')](_0x61bc('0x19'));return rp(_0x68948c)[_0x61bc('0xf')](function(_0x3628ce){if(_0x3628ce){var _0x4accf3=_0x3628ce[_0x61bc('0x1a')];var _0x24a303=![];var _0x5484c2=null;if(_0x2b2d2a[_0x61bc('0x1b')]!==null){logger[_0x61bc('0xd')](_0x61bc('0x1c'),_0x2b2d2a['agentEmail']);_0x2b2d2a[_0x61bc('0x1d')]=_0x2b2d2a[_0x61bc('0x1b')];for(_0x5484c2=0x0;_0x5484c2<_0x4accf3[_0x61bc('0x10')];_0x5484c2++){if(_0x4accf3[_0x5484c2][_0x61bc('0x11')]===_0x2b2d2a[_0x61bc('0x1b')]){_0x24a303=!![];_0x2b2d2a['userId']=_0x4accf3[_0x5484c2]['id'];logger['info']('User\x20found:',_0x2b2d2a[_0x61bc('0x1e')]);}}}if(!_0x24a303){logger[_0x61bc('0xd')](_0x61bc('0x1f'));_0x2b2d2a[_0x61bc('0x1d')]=_0x2b2d2a[_0x61bc('0x12')];_0x2b2d2a[_0x61bc('0x1e')]=_0x2b2d2a[_0x61bc('0x20')];_0x24a303=!![];}if(_0x24a303){_0x34d58a(_0x2b2d2a);}else{_0x2611e3({'statusCode':0x194,'message':_0x61bc('0x13')});}}else{_0x2611e3({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})['catch'](function(_0x26cc39){logger[_0x61bc('0x15')]('['+[_0x1ba878['toUpperCase']()]+']',_0x26cc39[_0x61bc('0x17')]);_0x2611e3(_0x26cc39);});});};}function searchContact(_0x13f37d,_0x13da5d,_0x2ac59d,_0x44a5dd){return new Promise(function(_0x327325,_0x2d4160){var _0x42573c={'method':_0x61bc('0xb'),'headers':_0x13da5d,'uri':_0x13f37d+_0x61bc('0x21')+_0x44a5dd+_0x61bc('0x22')+_0x2ac59d+_0x61bc('0x23'),'json':!![]};rp(_0x42573c)[_0x61bc('0xf')](function(_0x2a0393){var _0x121c39=_[_0x61bc('0x24')](_0x2a0393['contacts'][_0x61bc('0x25')],[_0x2ac59d,_0x44a5dd]);_0x327325(_0x121c39);})[_0x61bc('0x14')](function(_0x15d4ef){_0x2d4160(_0x15d4ef);});});}function getEndUser(_0x48ed9a,_0x56edf4,_0x5a4d4c){return function(_0x25e541){return new Promise(function(_0x4e9a75,_0x293e6b){logger[_0x61bc('0xd')](util['format'](_0x61bc('0x26'),_0x25e541[_0x61bc('0x27')]));searchContact(_0x5a4d4c,_0x56edf4,_0x61bc('0x28'),_0x25e541[_0x61bc('0x27')])[_0x61bc('0xf')](function(_0x4d3b2b){if(_0x4d3b2b){_0x25e541[_0x61bc('0x29')]=_0x4d3b2b['id'];logger[_0x61bc('0xd')](_0x61bc('0x2a'),_0x25e541[_0x61bc('0x29')]);return _0x4e9a75(_0x25e541);}searchContact(_0x5a4d4c,_0x56edf4,_0x61bc('0x2b'),_0x25e541['contactNumber'])[_0x61bc('0xf')](function(_0x1dfef7){if(_0x1dfef7){_0x25e541[_0x61bc('0x29')]=_0x1dfef7['id'];logger[_0x61bc('0xd')]('Contact\x20found\x20work_number:',_0x25e541['endUserId']);return _0x4e9a75(_0x25e541);}createEndUser(_0x25e541,_0x48ed9a,_0x56edf4,_0x5a4d4c)[_0x61bc('0xf')](function(_0xcc6755){logger[_0x61bc('0xd')](_0x61bc('0x2c'),_0xcc6755[_0x61bc('0x29')]);return _0x4e9a75(_0xcc6755);});});})[_0x61bc('0x14')](function(_0x9e9570){_0x293e6b(_0x9e9570);});});};}function createEndUser(_0x1703bf,_0x3ff2dd,_0x3ad978,_0x1f0010){return new Promise(function(_0x1ce856,_0x3d6a05){var _0x20a1d8=moment();var _0x5b51e0={'method':_0x61bc('0x2d'),'uri':_0x1f0010+_0x61bc('0x2e'),'body':{'contact':{'last_name':_0x1703bf['contactNumber'],'work_number':_0x1703bf[_0x61bc('0x27')],'mobile_number':_0x1703bf['contactNumber'],'owner_id':_0x1703bf[_0x61bc('0x1e')],'created_at':_0x20a1d8['format'](_0x61bc('0x2f'))}},'json':!![]};_0x5b51e0[_0x61bc('0x18')]=_0x3ad978;logger[_0x61bc('0xd')]('Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact');return rp(_0x5b51e0)[_0x61bc('0xf')](function(_0x2ac446){_0x1703bf[_0x61bc('0x29')]=_0x2ac446[_0x61bc('0x30')]['id'];_0x1ce856(_0x1703bf);})[_0x61bc('0x14')](function(_0x3dec55){logger['error']('['+[_0x3ff2dd['toUpperCase']()]+']',_0x3dec55[_0x61bc('0x17')]);_0x3d6a05(_0x3dec55[_0x61bc('0x17')]);});});}function getTicket(_0x220571,_0x2163c2,_0x964980,_0x1daad3,_0x4c5770){return function(_0x43fe57){logger[_0x61bc('0xd')](_0x61bc('0x31'));return new Promise(function(_0x22b77d,_0x12f4d7){var _0x5d15e8=moment();var _0x1f81de={'method':_0x61bc('0x2d'),'uri':_0x964980+_0x61bc('0x32'),'body':{'title':intUtil[_0x61bc('0x33')](_0x1daad3[_0x61bc('0x34')],_0x4c5770,'\x20'),'description':intUtil['getString'](_0x1daad3[_0x61bc('0x35')],_0x4c5770,'\x0a'),'owner_id':_0x43fe57['userId'],'creater_id':_0x43fe57[_0x61bc('0x20')],'targetable_id':_0x43fe57[_0x61bc('0x29')],'targetable_type':_0x61bc('0x36'),'created_at':_0x5d15e8['format']('YYYY-MM-DDTHH:mm:ss'),'due_date':_0x5d15e8[_0x61bc('0x37')](0x1e,'m')[_0x61bc('0x38')](_0x61bc('0x2f'))},'json':!![]};_0x1f81de[_0x61bc('0x18')]=_0x2163c2;return rp(_0x1f81de)[_0x61bc('0xf')](function(_0x13dce1){_0x43fe57['ticketId']=_0x13dce1[_0x61bc('0x39')]['id'];logger[_0x61bc('0xd')](_0x61bc('0x3a'),_0x43fe57['ticketId']);_0x22b77d(_0x43fe57);})[_0x61bc('0x14')](function(_0x19b449){logger[_0x61bc('0x15')]('['+[_0x220571[_0x61bc('0x16')]()]+']',_0x19b449['message']);_0x12f4d7(_0x19b449[_0x61bc('0x17')]);});});};}function emit(_0x4dfa26,_0x33519c,_0x44fd95){var _0xd9435={'uri':_0x4dfa26+_0x61bc('0x3b')+_0x44fd95};io['to'](util['format'](_0x61bc('0x3c'),_0x33519c))[_0x61bc('0x3d')](_0x61bc('0x3e'),_0xd9435);}exports['cs']=function(_0x117db1,_0x3577f8,_0x1c8f3b,_0x30c735,_0x4f239e,_0xd7b317,_0x11210b,_0x4dddd9){var _0xd400ff={};var _0x5e8e05={'Authorization':_0x61bc('0x3f')+_0xd7b317[_0x61bc('0x40')]};_0xd7b317[_0x61bc('0x41')]=intUtil[_0x61bc('0x42')](_0xd7b317['remoteUri']);_0xd7b317[_0x61bc('0x43')]=intUtil[_0x61bc('0x42')](_0xd7b317[_0x61bc('0x43')]);var _0x3904ce=_0xd7b317[_0x61bc('0x41')];_0xd400ff[_0x61bc('0x12')]=_0xd7b317[_0x61bc('0x44')];_0xd400ff[_0x61bc('0x27')]=_0x4dddd9[_0x61bc('0x45')]()==='outbound'?_0x3577f8[_0x61bc('0x46')]:_0x3577f8['calleridnum'];_0xd400ff[_0x61bc('0x47')]=_0x4dddd9===_0x61bc('0x48')||_0x4dddd9===_0x61bc('0x49')?_0x61bc('0x48'):_0x61bc('0x4a');if(_0x30c735){_0xd400ff[_0x61bc('0x1b')]=_0x30c735[_0x61bc('0x11')];}var _0x16393d=util[_0x61bc('0x38')](_0x61bc('0x4b'),_0xd7b317['serverUrl'],_0x3577f8[_0x61bc('0x4c')],md5(_0x3577f8['uniqueid']));if(_0x4f239e&&_0x4f239e[_0x61bc('0x4d')]){logger['info']('[QUEUE]',_0x61bc('0x4e'));_0x3577f8[_0x61bc('0x4f')]=_0x16393d;}else if(_0x11210b&&_0x11210b[_0x61bc('0x50')]&&_0x11210b[_0x61bc('0x50')]!==_0x61bc('0x51')){logger['info']('[OUTBOUND]',_0x61bc('0x4e'));_0x3577f8[_0x61bc('0x4f')]=_0x16393d;}else{_0x3577f8[_0x61bc('0x4f')]='';}return getAdminId(_0xd400ff,_0x4dddd9,_0x5e8e05,_0x3904ce)[_0x61bc('0xf')](getUser(_0x4dddd9,_0x5e8e05,_0x3904ce))[_0x61bc('0xf')](getEndUser(_0x4dddd9,_0x5e8e05,_0x3904ce))[_0x61bc('0xf')](getTicket(_0x4dddd9,_0x5e8e05,_0x3904ce,_0x1c8f3b,_0x3577f8))['then'](function(_0x532d1a){logger['info'](util[_0x61bc('0x38')](_0x61bc('0x52'),_0x532d1a[_0x61bc('0x53')]));if(_0x4dddd9!==_0x61bc('0x49')){logger['info']('['+[_0x4dddd9[_0x61bc('0x16')]()]+']',_0x61bc('0x54'));emit(_0x3904ce,_0x30c735[_0x61bc('0x55')],_0x532d1a['endUserId']);}})[_0x61bc('0x14')](function(_0x5a22c8){logger[_0x61bc('0x15')]('['+[_0x4dddd9['toUpperCase']()]+_0x61bc('0x56'),util[_0x61bc('0x57')](_0x5a22c8,{'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 a460ad5..f5b52c9 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 _0x7163=['Configurations','data3','queue','routeId','outbound','log','EVENT\x20UNKNOWN','unmanaged','sugarcrm','zoho','freshsales','servicenow','unknown\x20integration','../../../../config/logger','error','[EXEC]','%s\x20configuration\x20#%s\x20not\x20found','format','lodash','util','./zendesk','./salesforce','./sugarcrm','./freshdesk','./zoho','./desk','./vtiger','./servicenow','zendesk','salesforce','freshdesk','desk','vtiger','dynamics365','includes','toLowerCase','data1','data2','find'];(function(_0x473931,_0x487f37){var _0x5b11f4=function(_0x595d33){while(--_0x595d33){_0x473931['push'](_0x473931['shift']());}};_0x5b11f4(++_0x487f37);}(_0x7163,0x87));var _0x3716=function(_0x2adbeb,_0x5581be){_0x2adbeb=_0x2adbeb-0x0;var _0x5e18a6=_0x7163[_0x2adbeb];return _0x5e18a6;};'use strict';var _=require(_0x3716('0x0'));var util=require(_0x3716('0x1'));var zendesk=require(_0x3716('0x2'));var salesforce=require(_0x3716('0x3'));var sugarcrm=require(_0x3716('0x4'));var freshdesk=require(_0x3716('0x5'));var zoho=require(_0x3716('0x6'));var desk=require(_0x3716('0x7'));var vtiger=require(_0x3716('0x8'));var servicenow=require(_0x3716('0x9'));var dynamics365=require('./dynamics365');var freshsales=require('./freshsales');var integrations=[_0x3716('0xa'),_0x3716('0xb'),'sugarcrm',_0x3716('0xc'),'zoho',_0x3716('0xd'),_0x3716('0xe'),_0x3716('0xf'),'freshsales','servicenow'];exports['exec']=function(_0x2e7ff3,_0x232f0c,_0x3e3ca7,_0x393372,_0x162066,_0x54e789){if(_0x3e3ca7){if(_[_0x3716('0x10')](integrations,_0x2e7ff3['data1'][_0x3716('0x11')]())){try{var _0x2506bd=null;var _0x3c4dfb='';var _0x5423a4=_0x3e3ca7[_0x2e7ff3[_0x3716('0x12')][_0x3716('0x11')]()];if(_0x5423a4){var _0x59e2c9=_0x5423a4[_0x2e7ff3[_0x3716('0x13')]];if(_0x59e2c9){var _0x5dc0c7=_[_0x3716('0x14')](_0x59e2c9[_0x3716('0x15')],{'id':parseInt(_0x2e7ff3[_0x3716('0x16')],0xa)});if(_0x5dc0c7){if(_0x393372){if(_0x162066&&_0x232f0c[_0x3716('0x17')]){_0x3c4dfb=_0x3716('0x17');}else if(_0x232f0c[_0x3716('0x18')]){_0x3c4dfb=_0x3716('0x19');}else{console[_0x3716('0x1a')](_0x3716('0x1b'),_0x232f0c);}}else{_0x3c4dfb=_0x3716('0x1c');}switch(_0x2e7ff3[_0x3716('0x12')]['toLowerCase']()){case'zendesk':zendesk[_0x3c4dfb](_0x2e7ff3,_0x232f0c,_0x5dc0c7,_0x393372,_0x162066,_0x59e2c9,_0x54e789);break;case'salesforce':salesforce[_0x3c4dfb](_0x2e7ff3,_0x232f0c,_0x5dc0c7,_0x393372,_0x162066,_0x59e2c9,_0x54e789);break;case _0x3716('0x1d'):sugarcrm[_0x3c4dfb](_0x2e7ff3,_0x232f0c,_0x5dc0c7,_0x393372,_0x162066,_0x59e2c9,_0x54e789);break;case _0x3716('0xc'):freshdesk[_0x3c4dfb](_0x2e7ff3,_0x232f0c,_0x5dc0c7,_0x393372,_0x162066,_0x59e2c9,_0x54e789);break;case _0x3716('0x1e'):zoho[_0x3c4dfb](_0x2e7ff3,_0x232f0c,_0x5dc0c7,_0x393372,_0x162066,_0x59e2c9,_0x54e789);break;case _0x3716('0xd'):desk[_0x3c4dfb](_0x2e7ff3,_0x232f0c,_0x5dc0c7,_0x393372,_0x162066,_0x59e2c9,_0x54e789);break;case _0x3716('0xe'):vtiger[_0x3c4dfb](_0x2e7ff3,_0x232f0c,_0x5dc0c7,_0x393372,_0x162066,_0x59e2c9,_0x54e789);break;case _0x3716('0x1f'):freshsales['cs'](_0x2e7ff3,_0x232f0c,_0x5dc0c7,_0x393372,_0x162066,_0x59e2c9,_0x54e789,_0x3c4dfb);break;case _0x3716('0x20'):servicenow['cs'](_0x2e7ff3,_0x232f0c,_0x5dc0c7,_0x393372,_0x162066,_0x59e2c9,_0x54e789,_0x3c4dfb);break;case _0x3716('0xf'):dynamics365['cs'](_0x2e7ff3,_0x232f0c,_0x5dc0c7,_0x393372,_0x162066,_0x59e2c9,_0x54e789,_0x3c4dfb);break;default:console['log'](_0x3716('0x21'));}}else{_0x2506bd=require(_0x3716('0x22'))(_0x2e7ff3['data1'][_0x3716('0x11')]());_0x2506bd[_0x3716('0x23')](_0x3716('0x24'),util['format'](_0x3716('0x25'),_0x2e7ff3['data1'][_0x3716('0x11')](),_0x2e7ff3[_0x3716('0x16')]));}}else{_0x2506bd=require('../../../../config/logger')(_0x2e7ff3[_0x3716('0x12')][_0x3716('0x11')]());_0x2506bd[_0x3716('0x23')]('[EXEC]',util[_0x3716('0x26')]('%s\x20account\x20#%s\x20not\x20found',_0x2e7ff3[_0x3716('0x12')]['toLowerCase'](),_0x2e7ff3[_0x3716('0x13')]));}}else{}}catch(_0x3421c6){console[_0x3716('0x23')](_0x3421c6);}}}}; \ No newline at end of file +var _0xdc09=['zendesk','vtiger','servicenow','unknown\x20integration','error','format','../../../../config/logger','[EXEC]','%s\x20account\x20#%s\x20not\x20found','lodash','util','./zendesk','./sugarcrm','./freshdesk','./desk','./vtiger','./dynamics365','salesforce','sugarcrm','freshdesk','zoho','desk','dynamics365','freshsales','exec','data1','toLowerCase','find','Configurations','data3','queue','routeId','outbound','log','EVENT\x20UNKNOWN'];(function(_0x23b3b6,_0x3e3c9c){var _0x2cfb34=function(_0xefb2bd){while(--_0xefb2bd){_0x23b3b6['push'](_0x23b3b6['shift']());}};_0x2cfb34(++_0x3e3c9c);}(_0xdc09,0xb8));var _0x9dc0=function(_0x1406c8,_0x40a801){_0x1406c8=_0x1406c8-0x0;var _0x3ec6f8=_0xdc09[_0x1406c8];return _0x3ec6f8;};'use strict';var _=require(_0x9dc0('0x0'));var util=require(_0x9dc0('0x1'));var zendesk=require(_0x9dc0('0x2'));var salesforce=require('./salesforce');var sugarcrm=require(_0x9dc0('0x3'));var freshdesk=require(_0x9dc0('0x4'));var zoho=require('./zoho');var desk=require(_0x9dc0('0x5'));var vtiger=require(_0x9dc0('0x6'));var servicenow=require('./servicenow');var dynamics365=require(_0x9dc0('0x7'));var freshsales=require('./freshsales');var integrations=['zendesk',_0x9dc0('0x8'),_0x9dc0('0x9'),_0x9dc0('0xa'),_0x9dc0('0xb'),_0x9dc0('0xc'),'vtiger',_0x9dc0('0xd'),_0x9dc0('0xe'),'servicenow'];exports[_0x9dc0('0xf')]=function(_0x4b44c0,_0x5f48bc,_0x8a5cf9,_0x421c81,_0x4258cc,_0x2b7d8e){if(_0x8a5cf9){if(_['includes'](integrations,_0x4b44c0[_0x9dc0('0x10')][_0x9dc0('0x11')]())){try{var _0x3eaecf=null;var _0x207020='';var _0x1f9275=_0x8a5cf9[_0x4b44c0[_0x9dc0('0x10')]['toLowerCase']()];if(_0x1f9275){var _0x3ec131=_0x1f9275[_0x4b44c0['data2']];if(_0x3ec131){var _0x4409e9=_[_0x9dc0('0x12')](_0x3ec131[_0x9dc0('0x13')],{'id':parseInt(_0x4b44c0[_0x9dc0('0x14')],0xa)});if(_0x4409e9){if(_0x421c81){if(_0x4258cc&&_0x5f48bc['queue']){_0x207020=_0x9dc0('0x15');}else if(_0x5f48bc[_0x9dc0('0x16')]){_0x207020=_0x9dc0('0x17');}else{console[_0x9dc0('0x18')](_0x9dc0('0x19'),_0x5f48bc);}}else{_0x207020='unmanaged';}switch(_0x4b44c0['data1'][_0x9dc0('0x11')]()){case _0x9dc0('0x1a'):zendesk[_0x207020](_0x4b44c0,_0x5f48bc,_0x4409e9,_0x421c81,_0x4258cc,_0x3ec131,_0x2b7d8e);break;case _0x9dc0('0x8'):salesforce[_0x207020](_0x4b44c0,_0x5f48bc,_0x4409e9,_0x421c81,_0x4258cc,_0x3ec131,_0x2b7d8e);break;case _0x9dc0('0x9'):sugarcrm[_0x207020](_0x4b44c0,_0x5f48bc,_0x4409e9,_0x421c81,_0x4258cc,_0x3ec131,_0x2b7d8e);break;case _0x9dc0('0xa'):freshdesk[_0x207020](_0x4b44c0,_0x5f48bc,_0x4409e9,_0x421c81,_0x4258cc,_0x3ec131,_0x2b7d8e);break;case _0x9dc0('0xb'):zoho[_0x207020](_0x4b44c0,_0x5f48bc,_0x4409e9,_0x421c81,_0x4258cc,_0x3ec131,_0x2b7d8e);break;case'desk':desk[_0x207020](_0x4b44c0,_0x5f48bc,_0x4409e9,_0x421c81,_0x4258cc,_0x3ec131,_0x2b7d8e);break;case _0x9dc0('0x1b'):vtiger[_0x207020](_0x4b44c0,_0x5f48bc,_0x4409e9,_0x421c81,_0x4258cc,_0x3ec131,_0x2b7d8e);break;case _0x9dc0('0xe'):freshsales['cs'](_0x4b44c0,_0x5f48bc,_0x4409e9,_0x421c81,_0x4258cc,_0x3ec131,_0x2b7d8e,_0x207020);break;case _0x9dc0('0x1c'):servicenow['cs'](_0x4b44c0,_0x5f48bc,_0x4409e9,_0x421c81,_0x4258cc,_0x3ec131,_0x2b7d8e,_0x207020);break;case _0x9dc0('0xd'):dynamics365['cs'](_0x4b44c0,_0x5f48bc,_0x4409e9,_0x421c81,_0x4258cc,_0x3ec131,_0x2b7d8e,_0x207020);break;default:console[_0x9dc0('0x18')](_0x9dc0('0x1d'));}}else{_0x3eaecf=require('../../../../config/logger')(_0x4b44c0[_0x9dc0('0x10')][_0x9dc0('0x11')]());_0x3eaecf[_0x9dc0('0x1e')]('[EXEC]',util[_0x9dc0('0x1f')]('%s\x20configuration\x20#%s\x20not\x20found',_0x4b44c0['data1'][_0x9dc0('0x11')](),_0x4b44c0[_0x9dc0('0x14')]));}}else{_0x3eaecf=require(_0x9dc0('0x20'))(_0x4b44c0[_0x9dc0('0x10')][_0x9dc0('0x11')]());_0x3eaecf[_0x9dc0('0x1e')](_0x9dc0('0x21'),util['format'](_0x9dc0('0x22'),_0x4b44c0[_0x9dc0('0x10')][_0x9dc0('0x11')](),_0x4b44c0['data2']));}}else{}}catch(_0xcdd7af){console[_0x9dc0('0x1e')](_0xcdd7af);}}}}; \ 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 e6d095f..c6ff409 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 _0xe838=['[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','lastevent',']\x20Ticket\x20%s\x20created.','toUpperCase',']\x20Integration\x20account\x20type\x20%s.','moment','bluebird','md5','jsforce','ioredis','./util','../../../../config/logger','salesforce','redis','defaults','localhost','socket.io-emitter','emit','assign','Subjects','getString','Descriptions','ticketType','Task','ActivityDate','utc','IsReminderSet','endUserType','lead','WhoId','account','WhatId','Case','ContactId','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','create','isNil','User','find','execute','then','length','Agent\x20%s\x20found.','resolve','Name','user_id','display_name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','cloneDeep','additionalSearchContact','merge','$or','Contact','additionalSearchLead','account_contact_lead','additionalSearchAccount','Account','contact','Phone','attributes','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','format','','Caller\x20-\x20%s','No\x20Company','forEach','includes','string','picklist','type','idField','content','toString','variable','variableName','customVariable','Variable','name','securityToken','Connection','remoteUri','https://login.salesforce.com','clientId','clientSecret','login','Connection\x20established.','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridname','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','%s/%s/e','instanceUrl','error','catch','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum'];(function(_0x3bb46a,_0x4d3a51){var _0xf30f8f=function(_0xb55d1e){while(--_0xb55d1e){_0x3bb46a['push'](_0x3bb46a['shift']());}};_0xf30f8f(++_0x4d3a51);}(_0xe838,0x188));var _0x8e83=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xe838[_0x122ef9];return _0x42fba0;};'use strict';var _=require('lodash');var rp=require('request-promise');var moment=require(_0x8e83('0x0'));var BPromise=require(_0x8e83('0x1'));var md5=require(_0x8e83('0x2'));var jsforce=require(_0x8e83('0x3'));var util=require('util');var Redis=require(_0x8e83('0x4'));var intUtil=require(_0x8e83('0x5'));var config=require('../../../../config/environment');var logger=require(_0x8e83('0x6'))(_0x8e83('0x7'));config[_0x8e83('0x8')]=_[_0x8e83('0x9')](config[_0x8e83('0x8')],{'host':_0x8e83('0xa'),'port':0x18eb});var io=require(_0x8e83('0xb'))(new Redis(config[_0x8e83('0x8')]));function emit(_0x4d6213,_0x453592,_0x832bd7){io['to'](_0x4d6213)[_0x8e83('0xc')](_0x453592,_0x832bd7);}function getTicket(_0x4dde9a,_0x1661c8,_0x594f9f,_0x38ade2,_0x22ada7,_0xc4ebe9,_0x4ad03f,_0x42c8a2){var _0x2a61b8=Object[_0x8e83('0xd')]({},{'OwnerId':_0x1661c8['id'],'Subject':intUtil['getString'](_0x38ade2[_0x8e83('0xe')],_0x22ada7,'\x20'),'Description':intUtil[_0x8e83('0xf')](_0x38ade2[_0x8e83('0x10')],_0x22ada7,'\x0a')},getCustomFields(_0xc4ebe9,_0x22ada7));if(_0x594f9f){if(_0x38ade2[_0x8e83('0x11')]===_0x8e83('0x12')){_0x2a61b8[_0x8e83('0x13')]=moment[_0x8e83('0x14')]();_0x2a61b8[_0x8e83('0x15')]=![];_0x2a61b8['IsRecurrence']=![];if(_0x594f9f[_0x8e83('0x16')]==='contact'||_0x594f9f[_0x8e83('0x16')]===_0x8e83('0x17')){_0x2a61b8[_0x8e83('0x18')]=_0x594f9f['id'];}else if(_0x594f9f[_0x8e83('0x16')]===_0x8e83('0x19')){_0x2a61b8[_0x8e83('0x1a')]=_0x594f9f['id'];}}else if(_0x38ade2['ticketType']===_0x8e83('0x1b')){if(_0x594f9f[_0x8e83('0x16')]==='contact'){_0x2a61b8[_0x8e83('0x1c')]=_0x594f9f['id'];}else if(_0x594f9f['endUserType']===_0x8e83('0x19')){_0x2a61b8['AccountId']=_0x594f9f['id'];}else if(_0x594f9f[_0x8e83('0x16')]===_0x8e83('0x17')&&_0x38ade2[_0x8e83('0x1d')]){_0x2a61b8[_0x38ade2[_0x8e83('0x1d')]]=_0x594f9f['id'];}else{logger[_0x8e83('0x1e')](_0x8e83('0x1f'));}}}return _0x4ad03f[_0x8e83('0x20')](_0x38ade2[_0x8e83('0x11')])[_0x8e83('0x21')](_0x2a61b8);}function getUser(_0x304b16,_0x37a25e,_0xff2442){if(!_[_0x8e83('0x22')](_0x37a25e)&&intUtil['validateEmail'](_0x37a25e)){var _0x5538e6={'Email':_0x37a25e};var _0x1011c7={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0xff2442[_0x8e83('0x20')](_0x8e83('0x23'))[_0x8e83('0x24')](_0x5538e6,_0x1011c7)[_0x8e83('0x25')]()[_0x8e83('0x26')](function(_0x52eb75){if(_0x52eb75[_0x8e83('0x27')]){var _0x43f639=_['find'](_0x52eb75,function(_0x9d31d){return _0x9d31d['Email']===_0x37a25e;});if(_0x43f639){logger[_0x8e83('0x1e')](_0x8e83('0x28'),_0x37a25e);return BPromise[_0x8e83('0x29')]({'id':_0x43f639['Id'],'name':_0x43f639[_0x8e83('0x2a')]});}}else{logger[_0x8e83('0x1e')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x37a25e);return _0xff2442['identity']()['then'](function(_0x34cea6){return BPromise[_0x8e83('0x29')]({'id':_0x34cea6[_0x8e83('0x2b')],'name':_0x34cea6[_0x8e83('0x2c')]});});}});}else{logger[_0x8e83('0x1e')](_0x8e83('0x2d'),_0x37a25e);return _0xff2442[_0x8e83('0x2e')]()[_0x8e83('0x26')](function(_0x21340f){return BPromise['resolve']({'id':_0x21340f[_0x8e83('0x2b')],'name':_0x21340f[_0x8e83('0x2c')]});});}}function getEndUser(_0x23dcb4,_0x1b84ef,_0x5f211a,_0x18a7ff,_0x25612f){var _0x455685={'$or':{'Phone':_0x18a7ff}};var _0x5d4167={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x8e83('0x29')]()[_0x8e83('0x26')](function(){logger[_0x8e83('0x1e')](_0x8e83('0x2f'),_0x18a7ff,_0x1b84ef['moduleSearch']);switch(_0x1b84ef['moduleSearch']){case'contact_lead':var _0xccb9be=_[_0x8e83('0x30')](_0x455685);if(_0x1b84ef[_0x8e83('0x31')]){var _0x203daa={};_0x203daa[_0x1b84ef[_0x8e83('0x31')]]=_0x18a7ff;_[_0x8e83('0x32')](_0xccb9be[_0x8e83('0x33')],_0x203daa);}return _0x25612f[_0x8e83('0x20')](_0x8e83('0x34'))[_0x8e83('0x24')](_0xccb9be,_0x5d4167)[_0x8e83('0x25')]()[_0x8e83('0x26')](function(_0x2437db){if(_0x2437db&&_0x2437db[_0x8e83('0x27')]){return _0x2437db;}else{var _0x2313b3=_['cloneDeep'](_0x455685);if(_0x1b84ef[_0x8e83('0x35')]){var _0x33340b={};_0x33340b[_0x1b84ef[_0x8e83('0x35')]]=_0x18a7ff;_[_0x8e83('0x32')](_0x2313b3[_0x8e83('0x33')],_0x33340b);}return _0x25612f[_0x8e83('0x20')]('Lead')[_0x8e83('0x24')](_0x2313b3,_0x5d4167);}});case _0x8e83('0x36'):var _0x7bda1c=_['cloneDeep'](_0x455685);if(_0x1b84ef[_0x8e83('0x37')]){var _0x203daa={};_0x203daa[_0x1b84ef[_0x8e83('0x37')]]=_0x18a7ff;_[_0x8e83('0x32')](_0x7bda1c[_0x8e83('0x33')],_0x203daa);}return _0x25612f[_0x8e83('0x20')](_0x8e83('0x38'))[_0x8e83('0x24')](_0x7bda1c,_0x5d4167)[_0x8e83('0x25')]()['then'](function(_0x593f02){if(_0x593f02&&_0x593f02[_0x8e83('0x27')]){return _0x593f02;}else{var _0x419391=_[_0x8e83('0x30')](_0x455685);if(_0x1b84ef[_0x8e83('0x31')]){var _0x57da8b={};_0x57da8b[_0x1b84ef['additionalSearchContact']]=_0x18a7ff;_['merge'](_0x419391[_0x8e83('0x33')],_0x57da8b);}return _0x25612f[_0x8e83('0x20')](_0x8e83('0x34'))[_0x8e83('0x24')](_0x419391,_0x5d4167)[_0x8e83('0x26')](function(_0x702a8d){if(_0x702a8d&&_0x702a8d['length']){return _0x702a8d;}else{var _0x1651b9=_['cloneDeep'](_0x455685);if(_0x1b84ef[_0x8e83('0x35')]){var _0x437694={};_0x437694[_0x1b84ef['additionalSearchLead']]=_0x18a7ff;_[_0x8e83('0x32')](_0x1651b9[_0x8e83('0x33')],_0x437694);}return _0x25612f[_0x8e83('0x20')]('Lead')[_0x8e83('0x24')](_0x1651b9,_0x5d4167);}});}});case _0x8e83('0x39'):var _0xccb9be=_[_0x8e83('0x30')](_0x455685);if(_0x1b84ef[_0x8e83('0x31')]){var _0x203daa={};_0x203daa[_0x1b84ef[_0x8e83('0x31')]]=_0x18a7ff;_[_0x8e83('0x32')](_0xccb9be['$or'],_0x203daa);}return _0x25612f[_0x8e83('0x20')](_0x8e83('0x34'))[_0x8e83('0x24')](_0xccb9be,_0x5d4167)[_0x8e83('0x25')]();case _0x8e83('0x17'):var _0x3d89e3=_[_0x8e83('0x30')](_0x455685);if(_0x1b84ef[_0x8e83('0x35')]){var _0x203daa={};_0x203daa[_0x1b84ef['additionalSearchLead']]=_0x18a7ff;_['merge'](_0x3d89e3['$or'],_0x203daa);}return _0x25612f[_0x8e83('0x20')]('Lead')['find'](_0x3d89e3,_0x5d4167);case _0x8e83('0x19'):var _0x7bda1c=_[_0x8e83('0x30')](_0x455685);if(_0x1b84ef[_0x8e83('0x37')]){var _0x203daa={};_0x203daa[_0x1b84ef['additionalSearchAccount']]=_0x18a7ff;_[_0x8e83('0x32')](_0x7bda1c[_0x8e83('0x33')],_0x203daa);}return _0x25612f[_0x8e83('0x20')]('Account')[_0x8e83('0x24')](_0x7bda1c,_0x5d4167);default:return null;}})[_0x8e83('0x26')](function(_0x493407){if(_0x493407&&_0x493407[_0x8e83('0x27')]){var _0x1535d5=_['first'](_0x493407);if(_0x1535d5){return BPromise['resolve']({'id':_0x1535d5['Id'],'name':_0x1535d5[_0x8e83('0x2a')],'phone':_0x1535d5[_0x8e83('0x3a')],'endUserType':_0x1535d5[_0x8e83('0x3b')]['type'][_0x8e83('0x3c')]()});}}})[_0x8e83('0x26')](function(_0x4e75c9){if(_0x4e75c9){logger[_0x8e83('0x1e')](_0x8e83('0x3d'),_0x4e75c9['endUserType'],_0x18a7ff);return BPromise['resolve'](_0x4e75c9);}else{logger[_0x8e83('0x1e')](_0x8e83('0x3e'),_0x18a7ff);var _0x51e9e8={'Phone':_0x18a7ff};if(_0x1b84ef[_0x8e83('0x3f')]){if(_0x1b84ef[_0x8e83('0x3f')]===_0x8e83('0x39')){logger['info'](_0x8e83('0x40'),_0x18a7ff,_0x1b84ef[_0x8e83('0x3f')]);_0x51e9e8['LastName']=_0x5f211a!==''?_0x5f211a:util[_0x8e83('0x41')]('Caller\x20-\x20%s',_0x18a7ff);}else if(_0x1b84ef[_0x8e83('0x3f')]===_0x8e83('0x17')){logger['info'](_0x8e83('0x40'),_0x18a7ff,_0x1b84ef[_0x8e83('0x3f')]);_0x51e9e8['LastName']=_0x5f211a!==_0x8e83('0x42')?_0x5f211a:util[_0x8e83('0x41')](_0x8e83('0x43'),_0x18a7ff);_0x51e9e8['Company']=_0x8e83('0x44');}else if(_0x1b84ef['moduleCreate']===_0x8e83('0x19')){logger[_0x8e83('0x1e')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x18a7ff,_0x1b84ef['moduleCreate']);_0x51e9e8['Name']=_0x5f211a!==_0x8e83('0x42')?_0x5f211a:util[_0x8e83('0x41')](_0x8e83('0x43'),_0x18a7ff);}else{return null;}}return _0x25612f[_0x8e83('0x20')](_['upperFirst'](_0x1b84ef[_0x8e83('0x3f')]))[_0x8e83('0x21')](_0x51e9e8)[_0x8e83('0x26')](function(_0x51a7b8){return BPromise[_0x8e83('0x29')]({'id':_0x51a7b8['id'],'endUserType':_0x1b84ef[_0x8e83('0x3f')]});});}});}function getCustomFields(_0x3aa0ce,_0xb6ef04){var _0x559476={};if(_0x3aa0ce['length']>0x0){_[_0x8e83('0x45')](_0x3aa0ce,function(_0x4a1cda){if(_[_0x8e83('0x46')]([_0x8e83('0x47'),_0x8e83('0x48')],_0x4a1cda[_0x8e83('0x49')])&&_0x4a1cda[_0x8e83('0x4a')]){_0x559476[_0x4a1cda[_0x8e83('0x4a')]]=_0x4a1cda[_0x8e83('0x4b')][_0x8e83('0x4c')]();}else if(_0x4a1cda[_0x8e83('0x49')]===_0x8e83('0x4d')&&_0x4a1cda[_0x8e83('0x4e')]&&_0x4a1cda[_0x8e83('0x4a')]){_0xb6ef04[_0x4a1cda[_0x8e83('0x4e')]]&&(_0x559476[_0x4a1cda['idField']]=_0xb6ef04[_0x4a1cda['variableName']][_0x8e83('0x4c')]());}else if(_0x4a1cda['type']===_0x8e83('0x4f')&&_0x4a1cda[_0x8e83('0x50')]&&_0x4a1cda[_0x8e83('0x50')][_0x8e83('0x51')]&&_0x4a1cda[_0x8e83('0x4a')]){_0xb6ef04[_0x4a1cda['Variable'][_0x8e83('0x51')][_0x8e83('0x3c')]()]&&(_0x559476[_0x4a1cda[_0x8e83('0x4a')]]=_0xb6ef04[_0x4a1cda['Variable'][_0x8e83('0x51')][_0x8e83('0x3c')]()]['toString']());}});}return _0x559476;}function getConnection(_0x3ee0d6){var _0x543795=_0x3ee0d6['password']['concat'](_0x3ee0d6[_0x8e83('0x52')]);var _0x340a02=new jsforce[(_0x8e83('0x53'))]({'oauth2':{'loginUrl':_0x3ee0d6[_0x8e83('0x54')]||_0x8e83('0x55'),'clientId':_0x3ee0d6[_0x8e83('0x56')],'clientSecret':_0x3ee0d6[_0x8e83('0x57')]}});return _0x340a02[_0x8e83('0x58')](_0x3ee0d6['username'],_0x543795)['then'](function(){logger[_0x8e83('0x1e')](_0x8e83('0x59'));return _0x340a02;});}exports[_0x8e83('0x5a')]=function(_0x30654a,_0x112a05,_0x56e1f8,_0x495814,_0xea91e9,_0x365677){var _0x5ab8ac,_0x25237c,_0x51f9db,_0x15ad93;_0x365677['serverUrl']=intUtil[_0x8e83('0x5b')](_0x365677[_0x8e83('0x5c')]);_0x365677[_0x8e83('0x54')]=intUtil[_0x8e83('0x5b')](_0x365677['remoteUri']);if(_0xea91e9&&_0xea91e9[_0x8e83('0x5d')]){logger[_0x8e83('0x1e')](_0x8e83('0x5e'),_0x8e83('0x5f'));_0x112a05[_0x8e83('0x60')]=util['format'](_0x8e83('0x61'),_0x365677['serverUrl'],_0x112a05['uniqueid'],md5(_0x112a05[_0x8e83('0x62')]));}else{_0x112a05[_0x8e83('0x60')]='';}return getConnection(_0x365677)[_0x8e83('0x26')](function(_0x2853ac){_0x15ad93=_0x2853ac;return getUser(_0x365677,_0x495814[_0x8e83('0x63')],_0x15ad93);})[_0x8e83('0x26')](function(_0x5882d3){_0x5ab8ac=_0x5882d3;return getEndUser(_0x365677,_0x56e1f8,_0x112a05[_0x8e83('0x64')],_0x112a05[_0x8e83('0x65')],_0x15ad93);})[_0x8e83('0x26')](function(_0x377547){_0x25237c=_0x377547;return getTicket(_0x365677,_0x5ab8ac,_0x25237c,_0x56e1f8,_0x112a05,_0x56e1f8[_0x8e83('0x66')],_0x15ad93,'queue');})[_0x8e83('0x26')](function(_0x4dd060){_0x51f9db=_0x4dd060;logger[_0x8e83('0x1e')](_0x8e83('0x67'),_0x51f9db['id']);logger[_0x8e83('0x1e')](_0x8e83('0x68'),_0x51f9db['id'],_0x495814[_0x8e83('0x51')],_0x365677[_0x8e83('0x49')]);switch(_0x365677[_0x8e83('0x49')]){case _0x8e83('0x69'):emit(util['format'](_0x8e83('0x6a'),_0x495814[_0x8e83('0x51')]),_0x8e83('0x6b'),{'recordId':_0x51f9db['id']});break;case _0x8e83('0x6c'):emit(util[_0x8e83('0x41')](_0x8e83('0x6a'),_0x495814['name']),_0x8e83('0x6d'),{'uri':util[_0x8e83('0x41')](_0x8e83('0x6e'),_0x15ad93[_0x8e83('0x6f')],_0x51f9db['id'])});break;default:logger[_0x8e83('0x70')]('[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.');}})[_0x8e83('0x71')](function(_0x5af3de){logger[_0x8e83('0x70')](_0x8e83('0x5e'),_0x5af3de);});};exports[_0x8e83('0x72')]=function(_0x99454f,_0xb88c32,_0x2851d5,_0x17f6bd,_0x40969f,_0x9097a0,_0x182ad1){var _0xce2f8e,_0x515047,_0x56cab4,_0x428baa;_0x9097a0[_0x8e83('0x5c')]=intUtil[_0x8e83('0x5b')](_0x9097a0[_0x8e83('0x5c')]);_0x9097a0[_0x8e83('0x54')]=intUtil['stripTrailingSlash'](_0x9097a0[_0x8e83('0x54')]);if(_0x182ad1&&_0x182ad1[_0x8e83('0x73')]&&_0x182ad1[_0x8e83('0x73')]!==_0x8e83('0x74')){logger[_0x8e83('0x1e')](_0x8e83('0x75'),'Recording\x20is\x20enabled!');_0xb88c32[_0x8e83('0x60')]=util[_0x8e83('0x41')](_0x8e83('0x61'),_0x9097a0[_0x8e83('0x5c')],_0xb88c32[_0x8e83('0x62')],md5(_0xb88c32[_0x8e83('0x62')]));}return getConnection(_0x9097a0)[_0x8e83('0x26')](function(_0x2718b7){_0x428baa=_0x2718b7;return getUser(_0x9097a0,_0x17f6bd[_0x8e83('0x63')],_0x428baa);})[_0x8e83('0x26')](function(_0x1f3020){_0xce2f8e=_0x1f3020;return getEndUser(_0x9097a0,_0x2851d5,_0xb88c32[_0x8e83('0x76')],_0xb88c32[_0x8e83('0x77')],_0x428baa);})[_0x8e83('0x26')](function(_0x4f1b1a){_0x515047=_0x4f1b1a;return getTicket(_0x9097a0,_0xce2f8e,_0x515047,_0x2851d5,_0xb88c32,_0x2851d5[_0x8e83('0x66')],_0x428baa,'outbound');})[_0x8e83('0x26')](function(_0x17418a){_0x56cab4=_0x17418a;logger[_0x8e83('0x1e')](_0x8e83('0x78'),_0x56cab4['id']);logger[_0x8e83('0x1e')](_0x8e83('0x79'),_0x56cab4['id'],_0x17f6bd[_0x8e83('0x51')],_0x9097a0[_0x8e83('0x49')]);switch(_0x9097a0['type']){case _0x8e83('0x69'):emit(util[_0x8e83('0x41')](_0x8e83('0x6a'),_0x17f6bd[_0x8e83('0x51')]),_0x8e83('0x6b'),{'recordId':_0x56cab4['id']});break;case _0x8e83('0x6c'):emit(util['format']('user:%s',_0x17f6bd['name']),_0x8e83('0x6d'),{'uri':util[_0x8e83('0x41')]('%s/%s/e',_0x428baa['instanceUrl'],_0x56cab4['id'])});break;default:logger[_0x8e83('0x70')](_0x8e83('0x75'),_0x8e83('0x7a'));}})[_0x8e83('0x71')](function(_0x128fb2){logger[_0x8e83('0x70')](_0x8e83('0x75'),_0x128fb2);});};exports[_0x8e83('0x7b')]=function(_0x44f532,_0x50bd0a,_0x461d17,_0x197982,_0x5ecfb1,_0x1c7ae4){var _0x1aabf5,_0x443484,_0x13ff4e,_0x2fe0c2;_0x1c7ae4[_0x8e83('0x5c')]=intUtil[_0x8e83('0x5b')](_0x1c7ae4[_0x8e83('0x5c')]);_0x1c7ae4['remoteUri']=intUtil[_0x8e83('0x5b')](_0x1c7ae4['remoteUri']);if(_0x5ecfb1&&_0x5ecfb1[_0x8e83('0x5d')]){logger[_0x8e83('0x1e')]('['+_0x50bd0a[_0x8e83('0x7c')]['toUpperCase']()+']',_0x8e83('0x5f'));_0x50bd0a['recordingURL']=util[_0x8e83('0x41')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1c7ae4[_0x8e83('0x5c')],_0x50bd0a[_0x8e83('0x62')],md5(_0x50bd0a[_0x8e83('0x62')]));}else{_0x50bd0a['recordingURL']='';}return getConnection(_0x1c7ae4)[_0x8e83('0x26')](function(_0x590e82){_0x2fe0c2=_0x590e82;if(!_[_0x8e83('0x22')](_0x197982)){return getUser(_0x1c7ae4,_0x197982['name'],_0x2fe0c2);}else{return getUser(_0x1c7ae4,null,_0x2fe0c2);}})['then'](function(_0x565252){_0x1aabf5=_0x565252;return getEndUser(_0x1c7ae4,_0x461d17,_0x50bd0a['calleridname'],_0x50bd0a[_0x8e83('0x65')],_0x2fe0c2);})['then'](function(_0x5a6cae){_0x443484=_0x5a6cae;return getTicket(_0x1c7ae4,_0x1aabf5,_0x443484,_0x461d17,_0x50bd0a,_0x461d17[_0x8e83('0x66')],_0x2fe0c2);})[_0x8e83('0x26')](function(_0x305bdb){_0x13ff4e=_0x305bdb;logger[_0x8e83('0x1e')]('['+_0x50bd0a['lastevent']['toUpperCase']()+_0x8e83('0x7d'),_0x13ff4e['id']);logger[_0x8e83('0x1e')]('['+_0x50bd0a[_0x8e83('0x7c')][_0x8e83('0x7e')]()+_0x8e83('0x7f'),_0x1c7ae4['type']);})[_0x8e83('0x71')](function(_0x1d7616){logger[_0x8e83('0x70')]('['+_0x50bd0a[_0x8e83('0x7c')][_0x8e83('0x7e')]()+']',_0x1d7616);});}; \ No newline at end of file +var _0xa9b1=['bluebird','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','salesforce','redis','socket.io-emitter','emit','assign','getString','Subjects','Task','ActivityDate','utc','IsReminderSet','IsRecurrence','endUserType','contact','lead','account','WhatId','ticketType','ContactId','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','create','validateEmail','User','find','execute','Email','Agent\x20%s\x20found.','Name','user_id','display_name','identity','resolve','then','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','sobject','Contact','additionalSearchLead','merge','$or','additionalSearchAccount','Account','length','Lead','first','Phone','attributes','type','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','Company','No\x20Company','upperFirst','forEach','includes','string','picklist','idField','variable','variableName','toString','name','Variable','concat','securityToken','Connection','remoteUri','clientId','clientSecret','login','username','Connection\x20established.','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridname','calleridnum','[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','trigger:browser:url','%s/%s/e','instanceUrl','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','recordingFormat','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','outbound','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','newTab','[OUTBOUND]','Salesforce\x20account\x20type\x20not\x20recognized','catch','error','unmanaged','lastevent','toUpperCase','isNil','Fields','request-promise','moment'];(function(_0x126c66,_0x223e73){var _0x2aff3e=function(_0x2969dc){while(--_0x2969dc){_0x126c66['push'](_0x126c66['shift']());}};_0x2aff3e(++_0x223e73);}(_0xa9b1,0x17e));var _0x1a9b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa9b1[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var rp=require(_0x1a9b('0x0'));var moment=require(_0x1a9b('0x1'));var BPromise=require(_0x1a9b('0x2'));var md5=require(_0x1a9b('0x3'));var jsforce=require('jsforce');var util=require(_0x1a9b('0x4'));var Redis=require(_0x1a9b('0x5'));var intUtil=require(_0x1a9b('0x6'));var config=require(_0x1a9b('0x7'));var logger=require(_0x1a9b('0x8'))(_0x1a9b('0x9'));config[_0x1a9b('0xa')]=_['defaults'](config[_0x1a9b('0xa')],{'host':'localhost','port':0x18eb});var io=require(_0x1a9b('0xb'))(new Redis(config['redis']));function emit(_0x4e05f4,_0x5b27fa,_0xbac527){io['to'](_0x4e05f4)[_0x1a9b('0xc')](_0x5b27fa,_0xbac527);}function getTicket(_0x45cd19,_0x4f7cc3,_0x3de8e3,_0x10c685,_0x5b2f57,_0x26b8a1,_0x205cbd,_0x154831){var _0x34493c=Object[_0x1a9b('0xd')]({},{'OwnerId':_0x4f7cc3['id'],'Subject':intUtil[_0x1a9b('0xe')](_0x10c685[_0x1a9b('0xf')],_0x5b2f57,'\x20'),'Description':intUtil[_0x1a9b('0xe')](_0x10c685['Descriptions'],_0x5b2f57,'\x0a')},getCustomFields(_0x26b8a1,_0x5b2f57));if(_0x3de8e3){if(_0x10c685['ticketType']===_0x1a9b('0x10')){_0x34493c[_0x1a9b('0x11')]=moment[_0x1a9b('0x12')]();_0x34493c[_0x1a9b('0x13')]=![];_0x34493c[_0x1a9b('0x14')]=![];if(_0x3de8e3[_0x1a9b('0x15')]===_0x1a9b('0x16')||_0x3de8e3['endUserType']===_0x1a9b('0x17')){_0x34493c['WhoId']=_0x3de8e3['id'];}else if(_0x3de8e3['endUserType']===_0x1a9b('0x18')){_0x34493c[_0x1a9b('0x19')]=_0x3de8e3['id'];}}else if(_0x10c685[_0x1a9b('0x1a')]==='Case'){if(_0x3de8e3[_0x1a9b('0x15')]===_0x1a9b('0x16')){_0x34493c[_0x1a9b('0x1b')]=_0x3de8e3['id'];}else if(_0x3de8e3[_0x1a9b('0x15')]===_0x1a9b('0x18')){_0x34493c['AccountId']=_0x3de8e3['id'];}else if(_0x3de8e3[_0x1a9b('0x15')]===_0x1a9b('0x17')&&_0x10c685[_0x1a9b('0x1c')]){_0x34493c[_0x10c685[_0x1a9b('0x1c')]]=_0x3de8e3['id'];}else{logger[_0x1a9b('0x1d')](_0x1a9b('0x1e'));}}}return _0x205cbd['sobject'](_0x10c685['ticketType'])[_0x1a9b('0x1f')](_0x34493c);}function getUser(_0x1aef0c,_0x41b6d3,_0x107511){if(!_['isNil'](_0x41b6d3)&&intUtil[_0x1a9b('0x20')](_0x41b6d3)){var _0x1b704b={'Email':_0x41b6d3};var _0x58ebfb={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x107511['sobject'](_0x1a9b('0x21'))[_0x1a9b('0x22')](_0x1b704b,_0x58ebfb)[_0x1a9b('0x23')]()['then'](function(_0x5e2572){if(_0x5e2572['length']){var _0x2578be=_[_0x1a9b('0x22')](_0x5e2572,function(_0x8b5672){return _0x8b5672[_0x1a9b('0x24')]===_0x41b6d3;});if(_0x2578be){logger[_0x1a9b('0x1d')](_0x1a9b('0x25'),_0x41b6d3);return BPromise['resolve']({'id':_0x2578be['Id'],'name':_0x2578be[_0x1a9b('0x26')]});}}else{logger[_0x1a9b('0x1d')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x41b6d3);return _0x107511['identity']()['then'](function(_0x4573f4){return BPromise['resolve']({'id':_0x4573f4[_0x1a9b('0x27')],'name':_0x4573f4[_0x1a9b('0x28')]});});}});}else{logger[_0x1a9b('0x1d')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x41b6d3);return _0x107511[_0x1a9b('0x29')]()['then'](function(_0x22b1b1){return BPromise[_0x1a9b('0x2a')]({'id':_0x22b1b1[_0x1a9b('0x27')],'name':_0x22b1b1[_0x1a9b('0x28')]});});}}function getEndUser(_0x35f23c,_0x51c1d4,_0x33f336,_0x199cd8,_0x1a1f51){var _0x10050d={'$or':{'Phone':_0x199cd8}};var _0x4e2253={'Id':!![],'Name':!![],'Phone':!![]};return BPromise['resolve']()[_0x1a9b('0x2b')](function(){logger['info'](_0x1a9b('0x2c'),_0x199cd8,_0x51c1d4[_0x1a9b('0x2d')]);switch(_0x51c1d4[_0x1a9b('0x2d')]){case _0x1a9b('0x2e'):var _0x2069b9=_[_0x1a9b('0x2f')](_0x10050d);if(_0x51c1d4[_0x1a9b('0x30')]){var _0x3d486f={};_0x3d486f[_0x51c1d4[_0x1a9b('0x30')]]=_0x199cd8;_['merge'](_0x2069b9['$or'],_0x3d486f);}return _0x1a1f51[_0x1a9b('0x31')](_0x1a9b('0x32'))[_0x1a9b('0x22')](_0x2069b9,_0x4e2253)[_0x1a9b('0x23')]()[_0x1a9b('0x2b')](function(_0x1597ff){if(_0x1597ff&&_0x1597ff['length']){return _0x1597ff;}else{var _0x591197=_[_0x1a9b('0x2f')](_0x10050d);if(_0x51c1d4[_0x1a9b('0x33')]){var _0x4ff81c={};_0x4ff81c[_0x51c1d4[_0x1a9b('0x33')]]=_0x199cd8;_[_0x1a9b('0x34')](_0x591197[_0x1a9b('0x35')],_0x4ff81c);}return _0x1a1f51['sobject']('Lead')[_0x1a9b('0x22')](_0x591197,_0x4e2253);}});case'account_contact_lead':var _0x209add=_['cloneDeep'](_0x10050d);if(_0x51c1d4['additionalSearchAccount']){var _0x3d486f={};_0x3d486f[_0x51c1d4[_0x1a9b('0x36')]]=_0x199cd8;_[_0x1a9b('0x34')](_0x209add['$or'],_0x3d486f);}return _0x1a1f51[_0x1a9b('0x31')](_0x1a9b('0x37'))[_0x1a9b('0x22')](_0x209add,_0x4e2253)[_0x1a9b('0x23')]()[_0x1a9b('0x2b')](function(_0x5b17fa){if(_0x5b17fa&&_0x5b17fa[_0x1a9b('0x38')]){return _0x5b17fa;}else{var _0x42c57c=_[_0x1a9b('0x2f')](_0x10050d);if(_0x51c1d4[_0x1a9b('0x30')]){var _0x15b374={};_0x15b374[_0x51c1d4[_0x1a9b('0x30')]]=_0x199cd8;_[_0x1a9b('0x34')](_0x42c57c['$or'],_0x15b374);}return _0x1a1f51[_0x1a9b('0x31')](_0x1a9b('0x32'))[_0x1a9b('0x22')](_0x42c57c,_0x4e2253)[_0x1a9b('0x2b')](function(_0x4873e5){if(_0x4873e5&&_0x4873e5[_0x1a9b('0x38')]){return _0x4873e5;}else{var _0x5142f6=_[_0x1a9b('0x2f')](_0x10050d);if(_0x51c1d4[_0x1a9b('0x33')]){var _0xdfd122={};_0xdfd122[_0x51c1d4[_0x1a9b('0x33')]]=_0x199cd8;_[_0x1a9b('0x34')](_0x5142f6[_0x1a9b('0x35')],_0xdfd122);}return _0x1a1f51[_0x1a9b('0x31')](_0x1a9b('0x39'))[_0x1a9b('0x22')](_0x5142f6,_0x4e2253);}});}});case _0x1a9b('0x16'):var _0x2069b9=_[_0x1a9b('0x2f')](_0x10050d);if(_0x51c1d4[_0x1a9b('0x30')]){var _0x3d486f={};_0x3d486f[_0x51c1d4[_0x1a9b('0x30')]]=_0x199cd8;_[_0x1a9b('0x34')](_0x2069b9[_0x1a9b('0x35')],_0x3d486f);}return _0x1a1f51[_0x1a9b('0x31')](_0x1a9b('0x32'))['find'](_0x2069b9,_0x4e2253)[_0x1a9b('0x23')]();case _0x1a9b('0x17'):var _0x4651ad=_[_0x1a9b('0x2f')](_0x10050d);if(_0x51c1d4[_0x1a9b('0x33')]){var _0x3d486f={};_0x3d486f[_0x51c1d4['additionalSearchLead']]=_0x199cd8;_[_0x1a9b('0x34')](_0x4651ad['$or'],_0x3d486f);}return _0x1a1f51[_0x1a9b('0x31')](_0x1a9b('0x39'))['find'](_0x4651ad,_0x4e2253);case _0x1a9b('0x18'):var _0x209add=_[_0x1a9b('0x2f')](_0x10050d);if(_0x51c1d4[_0x1a9b('0x36')]){var _0x3d486f={};_0x3d486f[_0x51c1d4[_0x1a9b('0x36')]]=_0x199cd8;_[_0x1a9b('0x34')](_0x209add['$or'],_0x3d486f);}return _0x1a1f51['sobject']('Account')[_0x1a9b('0x22')](_0x209add,_0x4e2253);default:return null;}})[_0x1a9b('0x2b')](function(_0xb21a8b){if(_0xb21a8b&&_0xb21a8b[_0x1a9b('0x38')]){var _0x529858=_[_0x1a9b('0x3a')](_0xb21a8b);if(_0x529858){return BPromise[_0x1a9b('0x2a')]({'id':_0x529858['Id'],'name':_0x529858[_0x1a9b('0x26')],'phone':_0x529858[_0x1a9b('0x3b')],'endUserType':_0x529858[_0x1a9b('0x3c')][_0x1a9b('0x3d')]['toLowerCase']()});}}})[_0x1a9b('0x2b')](function(_0x3823e4){if(_0x3823e4){logger[_0x1a9b('0x1d')](_0x1a9b('0x3e'),_0x3823e4[_0x1a9b('0x15')],_0x199cd8);return BPromise[_0x1a9b('0x2a')](_0x3823e4);}else{logger['info'](_0x1a9b('0x3f'),_0x199cd8);var _0x1b2b29={'Phone':_0x199cd8};if(_0x51c1d4[_0x1a9b('0x40')]){if(_0x51c1d4[_0x1a9b('0x40')]===_0x1a9b('0x16')){logger[_0x1a9b('0x1d')](_0x1a9b('0x41'),_0x199cd8,_0x51c1d4[_0x1a9b('0x40')]);_0x1b2b29['LastName']=_0x33f336!==_0x1a9b('0x42')?_0x33f336:util[_0x1a9b('0x43')](_0x1a9b('0x44'),_0x199cd8);}else if(_0x51c1d4['moduleCreate']===_0x1a9b('0x17')){logger[_0x1a9b('0x1d')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x199cd8,_0x51c1d4[_0x1a9b('0x40')]);_0x1b2b29['LastName']=_0x33f336!==_0x1a9b('0x42')?_0x33f336:util[_0x1a9b('0x43')](_0x1a9b('0x44'),_0x199cd8);_0x1b2b29[_0x1a9b('0x45')]=_0x1a9b('0x46');}else if(_0x51c1d4[_0x1a9b('0x40')]==='account'){logger[_0x1a9b('0x1d')](_0x1a9b('0x41'),_0x199cd8,_0x51c1d4[_0x1a9b('0x40')]);_0x1b2b29[_0x1a9b('0x26')]=_0x33f336!==_0x1a9b('0x42')?_0x33f336:util[_0x1a9b('0x43')]('Caller\x20-\x20%s',_0x199cd8);}else{return null;}}return _0x1a1f51[_0x1a9b('0x31')](_[_0x1a9b('0x47')](_0x51c1d4['moduleCreate']))[_0x1a9b('0x1f')](_0x1b2b29)[_0x1a9b('0x2b')](function(_0x74d5f9){return BPromise[_0x1a9b('0x2a')]({'id':_0x74d5f9['id'],'endUserType':_0x51c1d4[_0x1a9b('0x40')]});});}});}function getCustomFields(_0x532f36,_0x36e500){var _0x50bc5a={};if(_0x532f36[_0x1a9b('0x38')]>0x0){_[_0x1a9b('0x48')](_0x532f36,function(_0x37a549){if(_[_0x1a9b('0x49')]([_0x1a9b('0x4a'),_0x1a9b('0x4b')],_0x37a549[_0x1a9b('0x3d')])&&_0x37a549[_0x1a9b('0x4c')]){_0x50bc5a[_0x37a549[_0x1a9b('0x4c')]]=_0x37a549['content']['toString']();}else if(_0x37a549[_0x1a9b('0x3d')]===_0x1a9b('0x4d')&&_0x37a549[_0x1a9b('0x4e')]&&_0x37a549[_0x1a9b('0x4c')]){_0x36e500[_0x37a549[_0x1a9b('0x4e')]]&&(_0x50bc5a[_0x37a549[_0x1a9b('0x4c')]]=_0x36e500[_0x37a549[_0x1a9b('0x4e')]][_0x1a9b('0x4f')]());}else if(_0x37a549[_0x1a9b('0x3d')]==='customVariable'&&_0x37a549['Variable']&&_0x37a549['Variable']['name']&&_0x37a549[_0x1a9b('0x4c')]){_0x36e500[_0x37a549['Variable'][_0x1a9b('0x50')]['toLowerCase']()]&&(_0x50bc5a[_0x37a549['idField']]=_0x36e500[_0x37a549[_0x1a9b('0x51')][_0x1a9b('0x50')]['toLowerCase']()][_0x1a9b('0x4f')]());}});}return _0x50bc5a;}function getConnection(_0x276ae7){var _0x35ee51=_0x276ae7['password'][_0x1a9b('0x52')](_0x276ae7[_0x1a9b('0x53')]);var _0x2e4867=new jsforce[(_0x1a9b('0x54'))]({'oauth2':{'loginUrl':_0x276ae7[_0x1a9b('0x55')]||'https://login.salesforce.com','clientId':_0x276ae7[_0x1a9b('0x56')],'clientSecret':_0x276ae7[_0x1a9b('0x57')]}});return _0x2e4867[_0x1a9b('0x58')](_0x276ae7[_0x1a9b('0x59')],_0x35ee51)['then'](function(){logger['info'](_0x1a9b('0x5a'));return _0x2e4867;});}exports[_0x1a9b('0x5b')]=function(_0x5c2d29,_0x1a72da,_0x49ecb4,_0x153c2a,_0x408677,_0x47b3c7){var _0x54debf,_0x1423ac,_0x25f1d5,_0x56ef87;_0x47b3c7['serverUrl']=intUtil[_0x1a9b('0x5c')](_0x47b3c7[_0x1a9b('0x5d')]);_0x47b3c7[_0x1a9b('0x55')]=intUtil[_0x1a9b('0x5c')](_0x47b3c7[_0x1a9b('0x55')]);if(_0x408677&&_0x408677[_0x1a9b('0x5e')]){logger[_0x1a9b('0x1d')](_0x1a9b('0x5f'),'Recording\x20is\x20enabled!');_0x1a72da[_0x1a9b('0x60')]=util[_0x1a9b('0x43')](_0x1a9b('0x61'),_0x47b3c7[_0x1a9b('0x5d')],_0x1a72da['uniqueid'],md5(_0x1a72da[_0x1a9b('0x62')]));}else{_0x1a72da[_0x1a9b('0x60')]='';}return getConnection(_0x47b3c7)[_0x1a9b('0x2b')](function(_0x5c3ab0){_0x56ef87=_0x5c3ab0;return getUser(_0x47b3c7,_0x153c2a[_0x1a9b('0x63')],_0x56ef87);})[_0x1a9b('0x2b')](function(_0x5c3cc2){_0x54debf=_0x5c3cc2;return getEndUser(_0x47b3c7,_0x49ecb4,_0x1a72da[_0x1a9b('0x64')],_0x1a72da[_0x1a9b('0x65')],_0x56ef87);})[_0x1a9b('0x2b')](function(_0xa2df7b){_0x1423ac=_0xa2df7b;return getTicket(_0x47b3c7,_0x54debf,_0x1423ac,_0x49ecb4,_0x1a72da,_0x49ecb4['Fields'],_0x56ef87,_0x1a9b('0x5b'));})[_0x1a9b('0x2b')](function(_0x18f1a8){_0x25f1d5=_0x18f1a8;logger[_0x1a9b('0x1d')](_0x1a9b('0x66'),_0x25f1d5['id']);logger[_0x1a9b('0x1d')](_0x1a9b('0x67'),_0x25f1d5['id'],_0x153c2a[_0x1a9b('0x50')],_0x47b3c7[_0x1a9b('0x3d')]);switch(_0x47b3c7[_0x1a9b('0x3d')]){case _0x1a9b('0x68'):emit(util[_0x1a9b('0x43')](_0x1a9b('0x69'),_0x153c2a['name']),_0x1a9b('0x6a'),{'recordId':_0x25f1d5['id']});break;case'newTab':emit(util[_0x1a9b('0x43')](_0x1a9b('0x69'),_0x153c2a[_0x1a9b('0x50')]),_0x1a9b('0x6b'),{'uri':util[_0x1a9b('0x43')](_0x1a9b('0x6c'),_0x56ef87[_0x1a9b('0x6d')],_0x25f1d5['id'])});break;default:logger['error'](_0x1a9b('0x6e'));}})['catch'](function(_0x51cea6){logger['error'](_0x1a9b('0x5f'),_0x51cea6);});};exports['outbound']=function(_0x41eb3b,_0x4db303,_0x33f6d4,_0x4f16f9,_0x116d15,_0x561e71,_0x298334){var _0x2009e4,_0x3ad822,_0x2e015e,_0x473286;_0x561e71['serverUrl']=intUtil[_0x1a9b('0x5c')](_0x561e71['serverUrl']);_0x561e71['remoteUri']=intUtil[_0x1a9b('0x5c')](_0x561e71['remoteUri']);if(_0x298334&&_0x298334[_0x1a9b('0x6f')]&&_0x298334[_0x1a9b('0x6f')]!=='none'){logger[_0x1a9b('0x1d')]('[OUTBOUND]',_0x1a9b('0x70'));_0x4db303['recordingURL']=util[_0x1a9b('0x43')](_0x1a9b('0x61'),_0x561e71[_0x1a9b('0x5d')],_0x4db303['uniqueid'],md5(_0x4db303[_0x1a9b('0x62')]));}return getConnection(_0x561e71)['then'](function(_0x3e8393){_0x473286=_0x3e8393;return getUser(_0x561e71,_0x4f16f9[_0x1a9b('0x63')],_0x473286);})[_0x1a9b('0x2b')](function(_0x11719c){_0x2009e4=_0x11719c;return getEndUser(_0x561e71,_0x33f6d4,_0x4db303[_0x1a9b('0x71')],_0x4db303[_0x1a9b('0x72')],_0x473286);})[_0x1a9b('0x2b')](function(_0x34bc3a){_0x3ad822=_0x34bc3a;return getTicket(_0x561e71,_0x2009e4,_0x3ad822,_0x33f6d4,_0x4db303,_0x33f6d4['Fields'],_0x473286,_0x1a9b('0x73'));})[_0x1a9b('0x2b')](function(_0x53136d){_0x2e015e=_0x53136d;logger[_0x1a9b('0x1d')](_0x1a9b('0x74'),_0x2e015e['id']);logger[_0x1a9b('0x1d')](_0x1a9b('0x75'),_0x2e015e['id'],_0x4f16f9[_0x1a9b('0x50')],_0x561e71['type']);switch(_0x561e71[_0x1a9b('0x3d')]){case _0x1a9b('0x68'):emit(util[_0x1a9b('0x43')](_0x1a9b('0x69'),_0x4f16f9[_0x1a9b('0x50')]),'trigger:salesforce:display',{'recordId':_0x2e015e['id']});break;case _0x1a9b('0x76'):emit(util['format'](_0x1a9b('0x69'),_0x4f16f9[_0x1a9b('0x50')]),_0x1a9b('0x6b'),{'uri':util[_0x1a9b('0x43')](_0x1a9b('0x6c'),_0x473286[_0x1a9b('0x6d')],_0x2e015e['id'])});break;default:logger['error'](_0x1a9b('0x77'),_0x1a9b('0x78'));}})[_0x1a9b('0x79')](function(_0x3c4274){logger[_0x1a9b('0x7a')]('[OUTBOUND]',_0x3c4274);});};exports[_0x1a9b('0x7b')]=function(_0x189ee1,_0x427e42,_0x1662e1,_0x3002ea,_0x49172e,_0xfbdb75){var _0x4eefd5,_0x225494,_0x50be73,_0x4b4e46;_0xfbdb75['serverUrl']=intUtil[_0x1a9b('0x5c')](_0xfbdb75[_0x1a9b('0x5d')]);_0xfbdb75[_0x1a9b('0x55')]=intUtil[_0x1a9b('0x5c')](_0xfbdb75[_0x1a9b('0x55')]);if(_0x49172e&&_0x49172e[_0x1a9b('0x5e')]){logger[_0x1a9b('0x1d')]('['+_0x427e42[_0x1a9b('0x7c')][_0x1a9b('0x7d')]()+']','Recording\x20is\x20enabled!');_0x427e42[_0x1a9b('0x60')]=util[_0x1a9b('0x43')](_0x1a9b('0x61'),_0xfbdb75['serverUrl'],_0x427e42[_0x1a9b('0x62')],md5(_0x427e42[_0x1a9b('0x62')]));}else{_0x427e42[_0x1a9b('0x60')]='';}return getConnection(_0xfbdb75)['then'](function(_0x32b9d2){_0x4b4e46=_0x32b9d2;if(!_[_0x1a9b('0x7e')](_0x3002ea)){return getUser(_0xfbdb75,_0x3002ea[_0x1a9b('0x50')],_0x4b4e46);}else{return getUser(_0xfbdb75,null,_0x4b4e46);}})['then'](function(_0x4ee931){_0x4eefd5=_0x4ee931;return getEndUser(_0xfbdb75,_0x1662e1,_0x427e42[_0x1a9b('0x64')],_0x427e42[_0x1a9b('0x65')],_0x4b4e46);})[_0x1a9b('0x2b')](function(_0x3e4351){_0x225494=_0x3e4351;return getTicket(_0xfbdb75,_0x4eefd5,_0x225494,_0x1662e1,_0x427e42,_0x1662e1[_0x1a9b('0x7f')],_0x4b4e46);})[_0x1a9b('0x2b')](function(_0x427ea5){_0x50be73=_0x427ea5;logger[_0x1a9b('0x1d')]('['+_0x427e42[_0x1a9b('0x7c')][_0x1a9b('0x7d')]()+']\x20Ticket\x20%s\x20created.',_0x50be73['id']);logger[_0x1a9b('0x1d')]('['+_0x427e42['lastevent']['toUpperCase']()+']\x20Integration\x20account\x20type\x20%s.',_0xfbdb75[_0x1a9b('0x3d')]);})[_0x1a9b('0x79')](function(_0x4d15e7){logger[_0x1a9b('0x7a')]('['+_0x427e42['lastevent'][_0x1a9b('0x7d')]()+']',_0x4d15e7);});}; \ 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 661e6ca..9355e0b 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 _0xd32e=['catch','error','message','],\x20getUser\x20input\x20crm','validateEmail','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','true','userId','adminEmail','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','POST','sys_user?','endUserNumber','System','],\x20EndUser\x20schema','endUserId','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','includes','string','picklist','type','customField','toLowerCase','idField','content','toString','variable','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','incident','assign','getString','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','number',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','label_entry','Incident\x20-\x20','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','map','%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','sysparm_limit=1','sysparm_display_value=true','stripTrailingSlash','serverUrl','remoteUri','isNil','email','destcalleridnum','calleridnum','callDirection','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','[OUTBOUND]','call\x20direction:\x20%s','unmanaged','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','lodash','bluebird','util','md5','ioredis','../../../../config/environment','../../../../config/logger','servicenow','redis','localhost','GET','sys_user?sysparm_query=user_name%3Dadmin','then','result','length','adminId','sys_id','info','toUpperCase'];(function(_0x2f1ff5,_0x4602a2){var _0x3f2d07=function(_0x1ac968){while(--_0x1ac968){_0x2f1ff5['push'](_0x2f1ff5['shift']());}};_0x3f2d07(++_0x4602a2);}(_0xd32e,0xc3));var _0xed32=function(_0x53c88c,_0x39a4ce){_0x53c88c=_0x53c88c-0x0;var _0x423939=_0xd32e[_0x53c88c];return _0x423939;};'use strict';var _=require(_0xed32('0x0'));var Promise=require(_0xed32('0x1'));var rp=require('request-promise');var util=require(_0xed32('0x2'));var md5=require(_0xed32('0x3'));var Redis=require(_0xed32('0x4'));var intUtil=require('./util');var config=require(_0xed32('0x5'));var logger=require(_0xed32('0x6'))(_0xed32('0x7'));config[_0xed32('0x8')]=_['defaults'](config[_0xed32('0x8')],{'host':_0xed32('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xed32('0x8')]));function getAdminUser(_0x39b105,_0x3afe95,_0xff72f6,_0x4f7806,_0x473feb,_0x18780e){return new Promise(function(_0x20bfff,_0xcc0cb0){var _0x4a1840={'method':_0xed32('0xa'),'uri':_0x4f7806+_0xed32('0xb')+'&'+_0x473feb+'&'+_0x18780e,'auth':_0x3afe95,'json':!![]};return rp(_0x4a1840)[_0xed32('0xc')](function(_0x23a5e6){if(_0x23a5e6[_0xed32('0xd')][_0xed32('0xe')]>0x0){_0xff72f6[_0xed32('0xf')]=_0x23a5e6[_0xed32('0xd')][0x0][_0xed32('0x10')];}logger[_0xed32('0x11')]('['+[_0x39b105[_0xed32('0x12')]()]+'],\x20getAdminUser\x20crm',_0xff72f6);_0x20bfff(_0xff72f6);})[_0xed32('0x13')](function(_0xc2ed5d){logger[_0xed32('0x14')]('['+[_0x39b105[_0xed32('0x12')]()]+']',_0xc2ed5d[_0xed32('0x15')]);_0xcc0cb0(_0xc2ed5d[_0xed32('0x15')]);});});}function getUser(_0x303be2,_0x5c3a06,_0x1bf9fc,_0xfed9c2,_0x25f439){return function(_0x7d3457){logger['info']('['+[_0x303be2[_0xed32('0x12')]()]+_0xed32('0x16'),_0x7d3457);return new Promise(function(_0x25cc64,_0x351222){if(intUtil[_0xed32('0x17')](_0x7d3457[_0xed32('0x18')])){var _0x21a503={'method':'GET','uri':_0x1bf9fc+_0xed32('0x19')+_0x7d3457[_0xed32('0x18')]+'&'+_0xfed9c2+'&'+_0x25f439,'auth':_0x5c3a06,'json':!![]};logger[_0xed32('0x11')]('['+[_0x303be2[_0xed32('0x12')]()]+_0xed32('0x1a'),_0x21a503);return rp(_0x21a503)['then'](function(_0x3f35fa){logger[_0xed32('0x11')]('['+[_0x303be2[_0xed32('0x12')]()]+'],\x20getUser\x20entity',_0x3f35fa);if(_0x3f35fa[_0xed32('0xd')]['length']>0x0&&String(_0x3f35fa[_0xed32('0xd')][0x0]['active'])===_0xed32('0x1b')){_0x7d3457[_0xed32('0x1c')]=_0x3f35fa[_0xed32('0xd')][0x0]['sys_id'];}else{_0x7d3457[_0xed32('0x1c')]=_0x7d3457['adminId'];_0x7d3457[_0xed32('0x18')]=_0x7d3457[_0xed32('0x1d')];}logger['info']('['+[_0x303be2['toUpperCase']()]+_0xed32('0x1e'),_0x7d3457);_0x25cc64(_0x7d3457);})[_0xed32('0x13')](function(_0x420dee){logger[_0xed32('0x14')]('['+[_0x303be2[_0xed32('0x12')]()]+']',_0x420dee[_0xed32('0x15')]);_0x351222(_0x420dee[_0xed32('0x15')]);});}else{logger[_0xed32('0x11')]('['+[_0x303be2[_0xed32('0x12')]()]+_0xed32('0x1f'));_0x7d3457[_0xed32('0x1c')]=_0x7d3457['adminId'];_0x7d3457[_0xed32('0x18')]=_0x7d3457[_0xed32('0x1d')];_0x25cc64(_0x7d3457);}});};}function createEndUser(_0x10d75a,_0x13eaf3,_0x2444c8,_0x4ec282,_0x4db9eb){logger['info']('['+[_0x10d75a[_0xed32('0x12')]()]+_0xed32('0x20'),_0x2444c8);return new Promise(function(_0x5a2bbd,_0x1062e8){var _0x22f433={'method':_0xed32('0x21'),'uri':_0x4ec282+_0xed32('0x22')+_0x4db9eb,'body':{'user_name':_0x2444c8[_0xed32('0x23')],'roles':'user','first_name':_0x2444c8[_0xed32('0x23')],'active':'true','date_format':_0xed32('0x24'),'phone':_0x2444c8['endUserNumber']},'auth':_0x13eaf3,'json':!![]};return rp(_0x22f433)[_0xed32('0xc')](function(_0x5161d6){logger['info']('['+[_0x10d75a[_0xed32('0x12')]()]+_0xed32('0x25'),_0x5161d6[_0xed32('0xd')]);_0x2444c8[_0xed32('0x26')]=_0x5161d6[_0xed32('0xd')][_0xed32('0x10')];_0x5a2bbd(_0x2444c8);})['catch'](function(_0x14cbf6){logger[_0xed32('0x14')]('['+[_0x10d75a['toUpperCase']()]+']',_0x14cbf6[_0xed32('0x15')]);_0x1062e8(_0x14cbf6[_0xed32('0x15')]);});});}function getEndUser(_0xf3c604,_0x1d9e7d,_0xe0ddaf,_0x999b59,_0x31ae6f){return function(_0x15330f){logger[_0xed32('0x11')]('['+[_0xf3c604[_0xed32('0x12')]()]+'],\x20getEndUser\x20input\x20crm',_0x15330f);return new Promise(function(_0x419d27,_0x174a6a){var _0x57e661={'method':'GET','uri':_0xe0ddaf+_0xed32('0x27')+_0x15330f[_0xed32('0x23')]+'&'+_0x999b59+'&'+_0x31ae6f,'auth':_0x1d9e7d,'json':!![]};return rp(_0x57e661)[_0xed32('0xc')](function(_0x3627a5){if(_0x3627a5[_0xed32('0xd')][_0xed32('0xe')]>0x0){_0x15330f[_0xed32('0x26')]=_0x3627a5[_0xed32('0xd')][0x0][_0xed32('0x10')];logger[_0xed32('0x11')]('['+[_0xf3c604[_0xed32('0x12')]()]+_0xed32('0x28'),_0x15330f);_0x419d27(_0x15330f);}else{return createEndUser(_0xf3c604,_0x1d9e7d,_0x15330f,_0xe0ddaf,_0x999b59)['then'](function(_0x5cc97c){logger[_0xed32('0x11')]('['+[_0xf3c604['toUpperCase']()]+_0xed32('0x29'),_0x5cc97c);_0x419d27(_0x5cc97c);});}})[_0xed32('0x13')](function(_0x2e20e0){logger[_0xed32('0x14')]('['+[_0xf3c604[_0xed32('0x12')]()]+']',_0x2e20e0[_0xed32('0x15')]);_0x174a6a(_0x2e20e0['message']);});});};}function getCustomFields(_0x11f7c3,_0x29b3a9){var _0x420c57={};if(_0x11f7c3[_0xed32('0xe')]>0x0){_[_0xed32('0x2a')](_0x11f7c3,function(_0x1c5c87){if(_[_0xed32('0x2b')]([_0xed32('0x2c'),_0xed32('0x2d')],_0x1c5c87[_0xed32('0x2e')])&&_0x1c5c87['nameField']&&!_0x1c5c87[_0xed32('0x2f')]){_0x420c57[_0x1c5c87['nameField'][_0xed32('0x30')]()]=_0x1c5c87['content']['toString']();}else if(_[_0xed32('0x2b')]([_0xed32('0x2c'),_0xed32('0x2d')],_0x1c5c87[_0xed32('0x2e')])&&_0x1c5c87[_0xed32('0x31')]&&_0x1c5c87[_0xed32('0x2f')]){_0x420c57[_0x1c5c87[_0xed32('0x31')][_0xed32('0x30')]()]=_0x1c5c87[_0xed32('0x32')][_0xed32('0x33')]();}else if(_0x1c5c87[_0xed32('0x2e')]===_0xed32('0x34')&&_0x1c5c87['variableName']&&_0x1c5c87[_0xed32('0x31')]&&_0x1c5c87['customField']){_0x420c57[_0x1c5c87[_0xed32('0x31')][_0xed32('0x30')]()]=_0x29b3a9[_0x1c5c87['variableName']][_0xed32('0x33')]();}else if(_0x1c5c87[_0xed32('0x2e')]===_0xed32('0x35')&&_0x1c5c87['Variable']&&_0x1c5c87[_0xed32('0x36')][_0xed32('0x37')]&&_0x1c5c87['idField']&&_0x1c5c87[_0xed32('0x2f')]){_0x420c57[_0x1c5c87[_0xed32('0x31')]['toLowerCase']()]=_0x29b3a9[_0x1c5c87[_0xed32('0x36')][_0xed32('0x37')][_0xed32('0x30')]()][_0xed32('0x33')]();}});}return _0x420c57;}function getTicket(_0x462da3,_0x48b4db,_0x32f5a9,_0x287086,_0x570e03,_0x4007bb){return function(_0x29f511){logger[_0xed32('0x11')]('['+[_0x462da3[_0xed32('0x12')]()]+_0xed32('0x38'),_0x29f511);return new Promise(function(_0x58e4fa,_0xc25002){var _0x164592=_0x462da3[_0xed32('0x30')]()===_0xed32('0x39')?_0x29f511[_0xed32('0x1c')]:_0x29f511['endUserId'];var _0x33a878={'method':'POST','uri':_0x32f5a9+_0xed32('0x3a')+'?'+_0x4007bb,'body':Object[_0xed32('0x3b')]({},{'active':_0xed32('0x1b'),'caller_id':_0x164592,'assigned_to':_0x29f511['userId'],'short_description':intUtil[_0xed32('0x3c')](_0x287086['Subjects'],_0x570e03,'\x20'),'description':intUtil[_0xed32('0x3c')](_0x287086[_0xed32('0x3d')],_0x570e03,'\x0a')},getCustomFields(_0x287086[_0xed32('0x3e')],_0x570e03)),'auth':_0x48b4db,'json':!![]};return rp(_0x33a878)[_0xed32('0xc')](function(_0x21cba4){logger[_0xed32('0x11')]('['+[_0x462da3[_0xed32('0x12')]()]+_0xed32('0x3f'),_0x21cba4[_0xed32('0xd')]);_0x29f511[_0xed32('0x40')]=_0x21cba4['result'][_0xed32('0x10')];_0x29f511['ticketNumber']=_0x21cba4[_0xed32('0xd')][_0xed32('0x41')];logger['info']('['+[_0x462da3[_0xed32('0x12')]()]+_0xed32('0x42'),_0x29f511);_0x58e4fa(_0x29f511);})[_0xed32('0x13')](function(_0x1c0094){logger[_0xed32('0x14')]('['+[_0x462da3['toUpperCase']()]+']',_0x1c0094['message']);_0xc25002(_0x1c0094[_0xed32('0x15')]);});});};}function createRemoteTag(_0x3ec3ca,_0x24cbf4,_0x3463f4,_0x25f54c){return new Promise(function(_0x553709,_0x4bbc79){var _0x73f496={'method':_0xed32('0x21'),'uri':_0x3463f4+_0xed32('0x43')+'?'+_0x25f54c,'body':{'short_description':_0x3ec3ca,'global':!![],'active':!![],'name':_0x3ec3ca},'auth':_0x24cbf4,'json':!![]};return rp(_0x73f496)[_0xed32('0xc')](function(_0x1e7bd8){var _0xfbab34=_0x1e7bd8[_0xed32('0xd')][_0xed32('0x10')];_0x553709(_0xfbab34);});});}function getRemoteTag(_0x5d0558,_0x497406,_0x320929,_0x52e9d0,_0x25bfa6){return new Promise(function(_0x28da3a,_0x1e41a5){var _0x4cfab7={'method':_0xed32('0xa'),'uri':_0x320929+'label'+_0xed32('0x44')+_0x5d0558+'&'+_0x52e9d0,'auth':_0x497406,'json':!![]};return rp(_0x4cfab7)[_0xed32('0xc')](function(_0x27dc90){if(_0x27dc90['result'][_0xed32('0xe')]>0x0){var _0x586f97=_0x27dc90[_0xed32('0xd')][0x0][_0xed32('0x10')];_0x28da3a(_0x586f97);}else{return createRemoteTag(_0x5d0558,_0x497406,_0x320929,_0x52e9d0)[_0xed32('0xc')](function(_0x4a1b4c){_0x28da3a(_0x4a1b4c);});}});});}function assignTagToIncident(_0x2d438d,_0xabe5bb,_0x11d76a,_0x4f6662,_0x313172){return new Promise(function(_0x39cbc0,_0x4b1a29){var _0x31a8e4={'method':_0xed32('0x21'),'uri':_0x11d76a+_0xed32('0x45')+'?'+_0x313172,'body':{'label':_0x2d438d,'table':_0xed32('0x3a'),'id_type':'Incident','table_key':_0x4f6662[_0xed32('0x40')],'title':_0xed32('0x46')+_0x4f6662['ticketNumber'],'id_display':_0x4f6662['ticketNumber']},'auth':_0xabe5bb,'json':!![]};return rp(_0x31a8e4)[_0xed32('0xc')](function(_0x1a0f65){_0x39cbc0();})['catch'](function(){_0x39cbc0();});});}function manageTags(_0x3962b5,_0x3b55d3,_0x2eb985,_0x5f5af5,_0x197f4d,_0x100ecc,_0x372891){return new Promise(function(_0x5e4455,_0x5c9f51){var _0x304d16=[];_0x3b55d3[_0xed32('0x2a')](function(_0x37640a){_0x304d16[_0xed32('0x47')](getRemoteTag(_0x37640a,_0x2eb985,_0x5f5af5,_0x100ecc,_0x372891));});return Promise[_0xed32('0x48')](_0x304d16)['then'](function(_0x10a287){if(_0x10a287['length']){logger['info']('['+[_0x3962b5[_0xed32('0x12')]()]+_0xed32('0x49'),_0x10a287);var _0x2cef3b=[];_0x10a287[_0xed32('0x2a')](function(_0x2a81b8){_0x2cef3b['push'](assignTagToIncident(_0x2a81b8,_0x2eb985,_0x5f5af5,_0x197f4d,_0x100ecc));});return Promise[_0xed32('0x48')](_0x2cef3b)[_0xed32('0xc')](function(){_0x5e4455();})[_0xed32('0x13')](function(){_0x5e4455();});}else{_0x5e4455();}});});}function getTags(_0xc179a2,_0x1c0478,_0x32ff8e,_0x4b3753,_0xaa3283,_0x172529){return function(_0x4d618e){return new Promise(function(_0x582d82,_0x599133){var _0x2fcc86=[];var _0x11a867=_0x4b3753[_0xed32('0x4a')];if(_0x11a867&&_0x11a867['length']>0x0){_0x2fcc86=_[_0xed32('0x4b')](_0x11a867,_0xed32('0x37'));}if(_0x2fcc86['length']>0x0){return manageTags(_0xc179a2,_0x2fcc86,_0x1c0478,_0x32ff8e,_0x4d618e,_0xaa3283,_0x172529)['then'](function(){_0x582d82(_0x4d618e);});}else{_0x582d82(_0x4d618e);}});};}function emit(_0x3d6b7b,_0x333740,_0x865822){var _0xccd4ad=_0xed32('0x4c')+_0xed32('0x4d')+_0xed32('0x4e')+_0xed32('0x4f');var _0x5d38c9={'uri':_0x3d6b7b+_0xed32('0x50')+_0x865822+_0xccd4ad};io['to'](util[_0xed32('0x51')]('user:%s',_0x333740))[_0xed32('0x52')]('trigger:browser:url',_0x5d38c9);}exports['cs']=function(_0x85278b,_0xd39169,_0x2d0e18,_0x1cfb4b,_0x4d8a18,_0x1a387d,_0x14bb8c,_0x158f3d){var _0x44cae3={};var _0x19a948={'user':_0x1a387d['username'],'pass':_0x1a387d['password']};var _0x418fb1=_0xed32('0x53');var _0x275dbd=_0xed32('0x54');_0x1a387d['remoteUri']=intUtil[_0xed32('0x55')](_0x1a387d['remoteUri']);_0x1a387d['serverUrl']=intUtil[_0xed32('0x55')](_0x1a387d[_0xed32('0x56')]);var _0x8f5b7f=util[_0xed32('0x51')]('%s/api/now/table/',_0x1a387d[_0xed32('0x57')]);_0x44cae3[_0xed32('0x18')]=!_[_0xed32('0x58')](_0x1cfb4b)?_0x1cfb4b[_0xed32('0x59')]:null;_0x44cae3['adminEmail']=_0x1a387d['email'];_0x44cae3[_0xed32('0x23')]=_0x158f3d['toLowerCase']()===_0xed32('0x39')?_0xd39169[_0xed32('0x5a')]:_0xd39169[_0xed32('0x5b')];_0x44cae3[_0xed32('0x5c')]=_0x158f3d==='queue'||_0x158f3d==='unmanaged'?_0xed32('0x5d'):_0xed32('0x39');var _0x4fbdee=util[_0xed32('0x51')](_0xed32('0x5e'),_0x1a387d[_0xed32('0x56')],_0xd39169[_0xed32('0x5f')],md5(_0xd39169[_0xed32('0x5f')]));if(_0x4d8a18&&_0x4d8a18[_0xed32('0x60')]){logger['info'](_0xed32('0x61'),_0xed32('0x62'));_0xd39169[_0xed32('0x63')]=_0x4fbdee;}else if(_0x14bb8c&&_0x14bb8c[_0xed32('0x64')]&&_0x14bb8c[_0xed32('0x64')]!=='none'){logger[_0xed32('0x11')](_0xed32('0x65'),_0xed32('0x62'));_0xd39169[_0xed32('0x63')]=_0x4fbdee;}else{_0xd39169[_0xed32('0x63')]='';}return getAdminUser(_0x158f3d,_0x19a948,_0x44cae3,_0x8f5b7f,_0x275dbd,_0x418fb1)[_0xed32('0xc')](getUser(_0x158f3d,_0x19a948,_0x8f5b7f,_0x275dbd,_0x418fb1))[_0xed32('0xc')](getEndUser(_0x158f3d,_0x19a948,_0x8f5b7f,_0x275dbd,_0x418fb1))[_0xed32('0xc')](getTicket(_0x158f3d,_0x19a948,_0x8f5b7f,_0x2d0e18,_0xd39169,_0x275dbd))[_0xed32('0xc')](function(_0x1f593d){logger[_0xed32('0x11')](util[_0xed32('0x51')]('The\x20ticket\x20ID\x20is:\x20%s',_0x1f593d['ticketId']));logger[_0xed32('0x11')](util[_0xed32('0x51')](_0xed32('0x66'),_0x158f3d));if(_0x158f3d!==_0xed32('0x67')){logger[_0xed32('0x11')]('['+[_0x158f3d[_0xed32('0x12')]()]+']',_0xed32('0x68'));emit(_0x1a387d[_0xed32('0x57')],_0x1cfb4b[_0xed32('0x37')],_0x1f593d[_0xed32('0x40')]);}})[_0xed32('0x13')](function(_0x1c315c){logger[_0xed32('0x14')]('['+[_0x158f3d[_0xed32('0x12')]()]+_0xed32('0x69'),util[_0xed32('0x6a')](_0x1c315c,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x041b=['Fields',']\x20POST\x20incident\x20entity\x20schema','ticketNumber','number',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','label_entry','Incident','Incident\x20-\x20','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','push','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','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','%s/api/now/table/','isNil','email','outbound','destcalleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','ticketId','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','lodash','bluebird','request-promise','util','md5','ioredis','../../../../config/environment','../../../../config/logger','servicenow','redis','defaults','localhost','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin','then','length','adminId','result','sys_id','toUpperCase','],\x20getAdminUser\x20crm','catch','error','message','info','validateEmail','sys_user?sysparm_query=email%3D','userEmail','],\x20getUser\x20entity','active','true','userId','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','adminEmail','POST','sys_user?','endUserNumber','user','System','],\x20EndUser\x20schema','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','endUserId','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','string','picklist','type','nameField','customField','toLowerCase','content','includes','idField','variable','variableName','customVariable','Variable',']\x20getTicket\x20input\x20crm','incident','assign','getString','Subjects','Descriptions'];(function(_0x337724,_0x27924e){var _0x1a9e88=function(_0x2f46c9){while(--_0x2f46c9){_0x337724['push'](_0x337724['shift']());}};_0x1a9e88(++_0x27924e);}(_0x041b,0x1f2));var _0xb041=function(_0x4f36ea,_0xbe4308){_0x4f36ea=_0x4f36ea-0x0;var _0x3658b2=_0x041b[_0x4f36ea];return _0x3658b2;};'use strict';var _=require(_0xb041('0x0'));var Promise=require(_0xb041('0x1'));var rp=require(_0xb041('0x2'));var util=require(_0xb041('0x3'));var md5=require(_0xb041('0x4'));var Redis=require(_0xb041('0x5'));var intUtil=require('./util');var config=require(_0xb041('0x6'));var logger=require(_0xb041('0x7'))(_0xb041('0x8'));config[_0xb041('0x9')]=_[_0xb041('0xa')](config[_0xb041('0x9')],{'host':_0xb041('0xb'),'port':0x18eb});var io=require(_0xb041('0xc'))(new Redis(config[_0xb041('0x9')]));function getAdminUser(_0x5bebb6,_0xff290a,_0x5a511b,_0x1dbbf4,_0xa24d98,_0x45a4b4){return new Promise(function(_0x3199f7,_0x1d9d1c){var _0x441312={'method':_0xb041('0xd'),'uri':_0x1dbbf4+_0xb041('0xe')+'&'+_0xa24d98+'&'+_0x45a4b4,'auth':_0xff290a,'json':!![]};return rp(_0x441312)[_0xb041('0xf')](function(_0x590b42){if(_0x590b42['result'][_0xb041('0x10')]>0x0){_0x5a511b[_0xb041('0x11')]=_0x590b42[_0xb041('0x12')][0x0][_0xb041('0x13')];}logger['info']('['+[_0x5bebb6[_0xb041('0x14')]()]+_0xb041('0x15'),_0x5a511b);_0x3199f7(_0x5a511b);})[_0xb041('0x16')](function(_0x3c3421){logger[_0xb041('0x17')]('['+[_0x5bebb6['toUpperCase']()]+']',_0x3c3421[_0xb041('0x18')]);_0x1d9d1c(_0x3c3421[_0xb041('0x18')]);});});}function getUser(_0x44722b,_0x31f9da,_0x59037b,_0x3e4eab,_0x2c2694){return function(_0x54c97b){logger[_0xb041('0x19')]('['+[_0x44722b[_0xb041('0x14')]()]+'],\x20getUser\x20input\x20crm',_0x54c97b);return new Promise(function(_0x99ce99,_0x1db15c){if(intUtil[_0xb041('0x1a')](_0x54c97b['userEmail'])){var _0x39e476={'method':_0xb041('0xd'),'uri':_0x59037b+_0xb041('0x1b')+_0x54c97b[_0xb041('0x1c')]+'&'+_0x3e4eab+'&'+_0x2c2694,'auth':_0x31f9da,'json':!![]};logger[_0xb041('0x19')]('['+[_0x44722b[_0xb041('0x14')]()]+'],\x20getUser\x20rp\x20obj',_0x39e476);return rp(_0x39e476)[_0xb041('0xf')](function(_0x5e58ed){logger['info']('['+[_0x44722b[_0xb041('0x14')]()]+_0xb041('0x1d'),_0x5e58ed);if(_0x5e58ed[_0xb041('0x12')][_0xb041('0x10')]>0x0&&String(_0x5e58ed[_0xb041('0x12')][0x0][_0xb041('0x1e')])===_0xb041('0x1f')){_0x54c97b[_0xb041('0x20')]=_0x5e58ed['result'][0x0][_0xb041('0x13')];}else{_0x54c97b[_0xb041('0x20')]=_0x54c97b['adminId'];_0x54c97b[_0xb041('0x1c')]=_0x54c97b['adminEmail'];}logger[_0xb041('0x19')]('['+[_0x44722b[_0xb041('0x14')]()]+_0xb041('0x21'),_0x54c97b);_0x99ce99(_0x54c97b);})[_0xb041('0x16')](function(_0x1e31bf){logger[_0xb041('0x17')]('['+[_0x44722b['toUpperCase']()]+']',_0x1e31bf['message']);_0x1db15c(_0x1e31bf['message']);});}else{logger['info']('['+[_0x44722b['toUpperCase']()]+_0xb041('0x22'));_0x54c97b['userId']=_0x54c97b[_0xb041('0x11')];_0x54c97b[_0xb041('0x1c')]=_0x54c97b[_0xb041('0x23')];_0x99ce99(_0x54c97b);}});};}function createEndUser(_0x153125,_0x2de8ff,_0x52169f,_0x94ed07,_0x309649){logger[_0xb041('0x19')]('['+[_0x153125[_0xb041('0x14')]()]+'],\x20createEndUser\x20input\x20crm',_0x52169f);return new Promise(function(_0x5e292e,_0x52f202){var _0x49f8ba={'method':_0xb041('0x24'),'uri':_0x94ed07+_0xb041('0x25')+_0x309649,'body':{'user_name':_0x52169f[_0xb041('0x26')],'roles':_0xb041('0x27'),'first_name':_0x52169f[_0xb041('0x26')],'active':_0xb041('0x1f'),'date_format':_0xb041('0x28'),'phone':_0x52169f['endUserNumber']},'auth':_0x2de8ff,'json':!![]};return rp(_0x49f8ba)[_0xb041('0xf')](function(_0x89babc){logger[_0xb041('0x19')]('['+[_0x153125['toUpperCase']()]+_0xb041('0x29'),_0x89babc[_0xb041('0x12')]);_0x52169f['endUserId']=_0x89babc['result'][_0xb041('0x13')];_0x5e292e(_0x52169f);})[_0xb041('0x16')](function(_0x1dc048){logger[_0xb041('0x17')]('['+[_0x153125[_0xb041('0x14')]()]+']',_0x1dc048[_0xb041('0x18')]);_0x52f202(_0x1dc048[_0xb041('0x18')]);});});}function getEndUser(_0x20a6da,_0x14d184,_0x4f5ea9,_0x2d08dc,_0x4e168f){return function(_0x219bd8){logger[_0xb041('0x19')]('['+[_0x20a6da[_0xb041('0x14')]()]+_0xb041('0x2a'),_0x219bd8);return new Promise(function(_0x1b7e43,_0x5c65ad){var _0x36bdbc={'method':_0xb041('0xd'),'uri':_0x4f5ea9+_0xb041('0x2b')+_0x219bd8[_0xb041('0x26')]+'&'+_0x2d08dc+'&'+_0x4e168f,'auth':_0x14d184,'json':!![]};return rp(_0x36bdbc)[_0xb041('0xf')](function(_0x93adf6){if(_0x93adf6[_0xb041('0x12')]['length']>0x0){_0x219bd8[_0xb041('0x2c')]=_0x93adf6[_0xb041('0x12')][0x0]['sys_id'];logger[_0xb041('0x19')]('['+[_0x20a6da[_0xb041('0x14')]()]+_0xb041('0x2d'),_0x219bd8);_0x1b7e43(_0x219bd8);}else{return createEndUser(_0x20a6da,_0x14d184,_0x219bd8,_0x4f5ea9,_0x2d08dc)[_0xb041('0xf')](function(_0x19065d){logger['info']('['+[_0x20a6da[_0xb041('0x14')]()]+_0xb041('0x2e'),_0x19065d);_0x1b7e43(_0x19065d);});}})[_0xb041('0x16')](function(_0x272c0a){logger[_0xb041('0x17')]('['+[_0x20a6da[_0xb041('0x14')]()]+']',_0x272c0a['message']);_0x5c65ad(_0x272c0a['message']);});});};}function getCustomFields(_0x1ae11a,_0x42539e){var _0x42fcd4={};if(_0x1ae11a[_0xb041('0x10')]>0x0){_[_0xb041('0x2f')](_0x1ae11a,function(_0x4382da){if(_['includes']([_0xb041('0x30'),_0xb041('0x31')],_0x4382da[_0xb041('0x32')])&&_0x4382da[_0xb041('0x33')]&&!_0x4382da[_0xb041('0x34')]){_0x42fcd4[_0x4382da['nameField'][_0xb041('0x35')]()]=_0x4382da[_0xb041('0x36')]['toString']();}else if(_[_0xb041('0x37')]([_0xb041('0x30'),_0xb041('0x31')],_0x4382da[_0xb041('0x32')])&&_0x4382da['idField']&&_0x4382da[_0xb041('0x34')]){_0x42fcd4[_0x4382da[_0xb041('0x38')][_0xb041('0x35')]()]=_0x4382da['content']['toString']();}else if(_0x4382da['type']===_0xb041('0x39')&&_0x4382da[_0xb041('0x3a')]&&_0x4382da[_0xb041('0x38')]&&_0x4382da[_0xb041('0x34')]){_0x42fcd4[_0x4382da[_0xb041('0x38')][_0xb041('0x35')]()]=_0x42539e[_0x4382da['variableName']]['toString']();}else if(_0x4382da['type']===_0xb041('0x3b')&&_0x4382da[_0xb041('0x3c')]&&_0x4382da['Variable']['name']&&_0x4382da[_0xb041('0x38')]&&_0x4382da[_0xb041('0x34')]){_0x42fcd4[_0x4382da[_0xb041('0x38')][_0xb041('0x35')]()]=_0x42539e[_0x4382da[_0xb041('0x3c')]['name'][_0xb041('0x35')]()]['toString']();}});}return _0x42fcd4;}function getTicket(_0x11444f,_0x44e9b4,_0x48f8e7,_0x500535,_0x37dc55,_0x12af11){return function(_0x1ca9f2){logger[_0xb041('0x19')]('['+[_0x11444f['toUpperCase']()]+_0xb041('0x3d'),_0x1ca9f2);return new Promise(function(_0x270055,_0x26b222){var _0x3bf281=_0x11444f[_0xb041('0x35')]()==='outbound'?_0x1ca9f2['userId']:_0x1ca9f2[_0xb041('0x2c')];var _0x1f2544={'method':_0xb041('0x24'),'uri':_0x48f8e7+_0xb041('0x3e')+'?'+_0x12af11,'body':Object[_0xb041('0x3f')]({},{'active':_0xb041('0x1f'),'caller_id':_0x3bf281,'assigned_to':_0x1ca9f2[_0xb041('0x20')],'short_description':intUtil[_0xb041('0x40')](_0x500535[_0xb041('0x41')],_0x37dc55,'\x20'),'description':intUtil[_0xb041('0x40')](_0x500535[_0xb041('0x42')],_0x37dc55,'\x0a')},getCustomFields(_0x500535[_0xb041('0x43')],_0x37dc55)),'auth':_0x44e9b4,'json':!![]};return rp(_0x1f2544)['then'](function(_0x43e20c){logger[_0xb041('0x19')]('['+[_0x11444f[_0xb041('0x14')]()]+_0xb041('0x44'),_0x43e20c[_0xb041('0x12')]);_0x1ca9f2['ticketId']=_0x43e20c[_0xb041('0x12')][_0xb041('0x13')];_0x1ca9f2[_0xb041('0x45')]=_0x43e20c[_0xb041('0x12')][_0xb041('0x46')];logger[_0xb041('0x19')]('['+[_0x11444f[_0xb041('0x14')]()]+_0xb041('0x47'),_0x1ca9f2);_0x270055(_0x1ca9f2);})[_0xb041('0x16')](function(_0x1a9ed3){logger['error']('['+[_0x11444f[_0xb041('0x14')]()]+']',_0x1a9ed3[_0xb041('0x18')]);_0x26b222(_0x1a9ed3[_0xb041('0x18')]);});});};}function createRemoteTag(_0x3a849,_0x17070e,_0x2b4328,_0x120c14){return new Promise(function(_0x2d4c77,_0xa88dfc){var _0x695b65={'method':_0xb041('0x24'),'uri':_0x2b4328+_0xb041('0x48')+'?'+_0x120c14,'body':{'short_description':_0x3a849,'global':!![],'active':!![],'name':_0x3a849},'auth':_0x17070e,'json':!![]};return rp(_0x695b65)[_0xb041('0xf')](function(_0xedbe59){var _0x1a327c=_0xedbe59[_0xb041('0x12')]['sys_id'];_0x2d4c77(_0x1a327c);});});}function getRemoteTag(_0x19ad1d,_0x3b0b81,_0x3f5639,_0x1aafb0,_0x59c108){return new Promise(function(_0x4b316c,_0x16b02a){var _0x5f07f7={'method':_0xb041('0xd'),'uri':_0x3f5639+_0xb041('0x48')+_0xb041('0x49')+_0x19ad1d+'&'+_0x1aafb0,'auth':_0x3b0b81,'json':!![]};return rp(_0x5f07f7)['then'](function(_0x372d2a){if(_0x372d2a[_0xb041('0x12')]['length']>0x0){var _0x5cc9cd=_0x372d2a[_0xb041('0x12')][0x0][_0xb041('0x13')];_0x4b316c(_0x5cc9cd);}else{return createRemoteTag(_0x19ad1d,_0x3b0b81,_0x3f5639,_0x1aafb0)[_0xb041('0xf')](function(_0x2dbaf5){_0x4b316c(_0x2dbaf5);});}});});}function assignTagToIncident(_0x5cd934,_0x25bf96,_0x10ad44,_0x485ab3,_0x277294){return new Promise(function(_0x11eb2f,_0x46eed6){var _0x3232b3={'method':_0xb041('0x24'),'uri':_0x10ad44+_0xb041('0x4a')+'?'+_0x277294,'body':{'label':_0x5cd934,'table':_0xb041('0x3e'),'id_type':_0xb041('0x4b'),'table_key':_0x485ab3['ticketId'],'title':_0xb041('0x4c')+_0x485ab3['ticketNumber'],'id_display':_0x485ab3['ticketNumber']},'auth':_0x25bf96,'json':!![]};return rp(_0x3232b3)[_0xb041('0xf')](function(_0x151924){_0x11eb2f();})[_0xb041('0x16')](function(){_0x11eb2f();});});}function manageTags(_0x221f9f,_0x26fc0a,_0x21a9c4,_0x199e5c,_0x3d07ae,_0x42f494,_0x5c0d69){return new Promise(function(_0x49452f,_0x5521fe){var _0x505de3=[];_0x26fc0a[_0xb041('0x2f')](function(_0x407b23){_0x505de3['push'](getRemoteTag(_0x407b23,_0x21a9c4,_0x199e5c,_0x42f494,_0x5c0d69));});return Promise[_0xb041('0x4d')](_0x505de3)[_0xb041('0xf')](function(_0x1caa52){if(_0x1caa52[_0xb041('0x10')]){logger[_0xb041('0x19')]('['+[_0x221f9f[_0xb041('0x14')]()]+_0xb041('0x4e'),_0x1caa52);var _0x2000d8=[];_0x1caa52[_0xb041('0x2f')](function(_0x34dfaa){_0x2000d8[_0xb041('0x4f')](assignTagToIncident(_0x34dfaa,_0x21a9c4,_0x199e5c,_0x3d07ae,_0x42f494));});return Promise[_0xb041('0x4d')](_0x2000d8)[_0xb041('0xf')](function(){_0x49452f();})['catch'](function(){_0x49452f();});}else{_0x49452f();}});});}function getTags(_0x301d87,_0x250e47,_0x1f1a84,_0x4ed4fd,_0x1168e9,_0x3c5218){return function(_0x1f506f){return new Promise(function(_0x11cc1a,_0x47d735){var _0x1dea69=[];var _0x495383=_0x4ed4fd[_0xb041('0x50')];if(_0x495383&&_0x495383[_0xb041('0x10')]>0x0){_0x1dea69=_['map'](_0x495383,'name');}if(_0x1dea69['length']>0x0){return manageTags(_0x301d87,_0x1dea69,_0x250e47,_0x1f1a84,_0x1f506f,_0x1168e9,_0x3c5218)[_0xb041('0xf')](function(){_0x11cc1a(_0x1f506f);});}else{_0x11cc1a(_0x1f506f);}});};}function emit(_0x477e3e,_0x253a74,_0x530cf6){var _0x47106a=_0xb041('0x51')+_0xb041('0x52')+_0xb041('0x53')+_0xb041('0x54');var _0x3bf08a={'uri':_0x477e3e+_0xb041('0x55')+_0x530cf6+_0x47106a};io['to'](util[_0xb041('0x56')]('user:%s',_0x253a74))[_0xb041('0x57')](_0xb041('0x58'),_0x3bf08a);}exports['cs']=function(_0x3d8adf,_0x278027,_0x3f329f,_0xf63f55,_0x154ce3,_0x2da308,_0x1c6411,_0x505148){var _0x1e9b96={};var _0x2d7b51={'user':_0x2da308['username'],'pass':_0x2da308['password']};var _0x575d36='sysparm_limit=1';var _0x23367a=_0xb041('0x59');_0x2da308[_0xb041('0x5a')]=intUtil[_0xb041('0x5b')](_0x2da308[_0xb041('0x5a')]);_0x2da308[_0xb041('0x5c')]=intUtil[_0xb041('0x5b')](_0x2da308['serverUrl']);var _0x52965f=util[_0xb041('0x56')](_0xb041('0x5d'),_0x2da308['remoteUri']);_0x1e9b96[_0xb041('0x1c')]=!_[_0xb041('0x5e')](_0xf63f55)?_0xf63f55[_0xb041('0x5f')]:null;_0x1e9b96[_0xb041('0x23')]=_0x2da308[_0xb041('0x5f')];_0x1e9b96[_0xb041('0x26')]=_0x505148[_0xb041('0x35')]()===_0xb041('0x60')?_0x278027[_0xb041('0x61')]:_0x278027['calleridnum'];_0x1e9b96[_0xb041('0x62')]=_0x505148===_0xb041('0x63')||_0x505148===_0xb041('0x64')?_0xb041('0x63'):_0xb041('0x60');var _0x3b6cbc=util[_0xb041('0x56')](_0xb041('0x65'),_0x2da308[_0xb041('0x5c')],_0x278027[_0xb041('0x66')],md5(_0x278027[_0xb041('0x66')]));if(_0x154ce3&&_0x154ce3[_0xb041('0x67')]){logger[_0xb041('0x19')]('[QUEUE]',_0xb041('0x68'));_0x278027[_0xb041('0x69')]=_0x3b6cbc;}else if(_0x1c6411&&_0x1c6411['recordingFormat']&&_0x1c6411[_0xb041('0x6a')]!==_0xb041('0x6b')){logger['info']('[OUTBOUND]',_0xb041('0x68'));_0x278027['recordingURL']=_0x3b6cbc;}else{_0x278027[_0xb041('0x69')]='';}return getAdminUser(_0x505148,_0x2d7b51,_0x1e9b96,_0x52965f,_0x23367a,_0x575d36)['then'](getUser(_0x505148,_0x2d7b51,_0x52965f,_0x23367a,_0x575d36))[_0xb041('0xf')](getEndUser(_0x505148,_0x2d7b51,_0x52965f,_0x23367a,_0x575d36))['then'](getTicket(_0x505148,_0x2d7b51,_0x52965f,_0x3f329f,_0x278027,_0x23367a))[_0xb041('0xf')](function(_0x23de37){logger[_0xb041('0x19')](util[_0xb041('0x56')]('The\x20ticket\x20ID\x20is:\x20%s',_0x23de37[_0xb041('0x6c')]));logger[_0xb041('0x19')](util[_0xb041('0x56')](_0xb041('0x6d'),_0x505148));if(_0x505148!=='unmanaged'){logger[_0xb041('0x19')]('['+[_0x505148[_0xb041('0x14')]()]+']',_0xb041('0x6e'));emit(_0x2da308[_0xb041('0x5a')],_0xf63f55['name'],_0x23de37[_0xb041('0x6c')]);}})['catch'](function(_0x151231){logger['error']('['+[_0x505148['toUpperCase']()]+_0xb041('0x6f'),util[_0xb041('0x70')](_0x151231,{'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 4b9b0d8..c1ab5aa 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 _0xa579=['unmanaged','lastevent','toUpperCase','Inbound','request-promise','bluebird','ioredis','../../../../config/logger','sugarcrm','redis','defaults','localhost','socket.io-emitter','POST','emit','info','Creating\x20new\x20ticket...','name','getString','Subjects','assigned_user_id','created_by','description','date_start','toISOString','slice','replace','duration_hours','duration_minutes','parent_type','Contacts','parent_name','direction','length','forEach','idField','variableName','set_entry','JSON','stringify','Calls','apiKey','toString','base64','get_server_info','isNil','Getting\x20agent\x20with\x20name','get_entry_list','Employees','then','entry_list','find','name_value_list','user_name','value','Agent\x20found!','resolve','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Searching\x20enduser\x20with\x20phone','format','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','Caller\x20-\x20%s','Enduser\x20created.','[HTTP]','type','nameField','customField','toLowerCase','content','string','custom_fields','variable','customVariable','Variable','push','login','password','PLAIN','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','queue','remoteUri','stripTrailingSlash','serverUrl','uri','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','The\x20Ticket\x20ID\x20is:','contacts','version','charAt','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','user:%s','trigger:browser:url','catch','error','recordingFormat','[OUTBOUND]','destcalleridname','destcalleridnum','Outbound','Ticket\x20created!','users','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...'];(function(_0x1928c9,_0x13a6d1){var _0x51b5fb=function(_0x24cf70){while(--_0x24cf70){_0x1928c9['push'](_0x1928c9['shift']());}};_0x51b5fb(++_0x13a6d1);}(_0xa579,0xf6));var _0x9a57=function(_0x597dce,_0x4e560d){_0x597dce=_0x597dce-0x0;var _0x5b4139=_0xa579[_0x597dce];return _0x5b4139;};'use strict';var _=require('lodash');var rp=require(_0x9a57('0x0'));var BPromise=require(_0x9a57('0x1'));var md5=require('md5');var util=require('util');var Redis=require(_0x9a57('0x2'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0x9a57('0x3'))(_0x9a57('0x4'));config[_0x9a57('0x5')]=_[_0x9a57('0x6')](config[_0x9a57('0x5')],{'host':_0x9a57('0x7'),'port':0x18eb});var io=require(_0x9a57('0x8'))(new Redis(config[_0x9a57('0x5')]));var def={'method':_0x9a57('0x9'),'json':!![]};function emit(_0x38c76b,_0x2bf530,_0x4c62b8){io['to'](_0x38c76b)[_0x9a57('0xa')](_0x2bf530,_0x4c62b8);}function getTicket(_0x5ec67e,_0x50a00f,_0x2c855b,_0x408be6,_0x191279,_0x1ef10f,_0x5eb865,_0x457dcb){logger[_0x9a57('0xb')](_0x9a57('0xc'));var _0x1f6857=new Date();var _0x4b5251=[{'name':_0x9a57('0xd'),'value':intUtil[_0x9a57('0xe')](_0x408be6[_0x9a57('0xf')],_0x191279,'\x20')},{'name':_0x9a57('0x10'),'value':_0x50a00f['id']},{'name':_0x9a57('0x11'),'value':_0x50a00f['id']},{'name':_0x9a57('0x12'),'value':intUtil['getString'](_0x408be6['Descriptions'],_0x191279,'\x0a')},{'name':_0x9a57('0x13'),'value':_0x1f6857[_0x9a57('0x14')]()[_0x9a57('0x15')](0x0,0x13)[_0x9a57('0x16')]('T','\x20')},{'name':_0x9a57('0x17'),'value':'0'},{'name':_0x9a57('0x18'),'value':'15'},{'name':'parent_id','value':_0x2c855b['id']},{'name':_0x9a57('0x19'),'value':_0x9a57('0x1a')},{'name':_0x9a57('0x1b'),'value':_0x2c855b[_0x9a57('0xd')]},{'name':_0x9a57('0x1c'),'value':_0x457dcb}];if(_0x1ef10f[_0x9a57('0x1d')]){_[_0x9a57('0x1e')](_0x1ef10f,function(_0x4ae86a){if(_0x191279[_0x4ae86a['variableName']]){_0x4b5251['push']({'name':_0x4ae86a[_0x9a57('0x1f')],'value':_0x191279[_0x4ae86a[_0x9a57('0x20')]]});}});}return request({'form':{'method':_0x9a57('0x21'),'input_type':_0x9a57('0x22'),'response_type':_0x9a57('0x22'),'rest_data':JSON[_0x9a57('0x23')]({'session':_0x5eb865['id'],'module_name':_0x9a57('0x24'),'name_value_list':_0x4b5251})}});}function getAuth(_0x17a327){return util['format']('Basic\x20%s',new Buffer(_0x17a327[_0x9a57('0x25')]+':X')[_0x9a57('0x26')](_0x9a57('0x27')));}function getServerInfo(_0xc75a75){return request({'form':{'method':_0x9a57('0x28'),'input_type':_0x9a57('0x22'),'response_type':_0x9a57('0x22'),'rest_data':JSON[_0x9a57('0x23')]({'session':_0xc75a75['id']})}});}function getUser(_0x57f967,_0x510c2d,_0x2d5985){if(!_[_0x9a57('0x29')](_0x510c2d)){logger[_0x9a57('0xb')](_0x9a57('0x2a'),_0x510c2d);return request({'form':{'method':_0x9a57('0x2b'),'input_type':'JSON','response_type':_0x9a57('0x22'),'rest_data':JSON['stringify']({'session':_0x2d5985['id'],'module_name':_0x9a57('0x2c'),'query':util['format']('INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200',_0x510c2d),'order_by':'','offset':'0','select_fields':['id',_0x9a57('0xd'),'user_name'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x9a57('0x2d')](function(_0xf70f0a){if(_0xf70f0a[_0x9a57('0x2e')][_0x9a57('0x1d')]){var _0xf7352a=_[_0x9a57('0x2f')](_0xf70f0a[_0x9a57('0x2e')],function(_0x25754c){return _0x25754c[_0x9a57('0x30')][_0x9a57('0x31')][_0x9a57('0x32')]===_0x510c2d;});if(_0xf7352a){logger['info'](_0x9a57('0x33'));return BPromise[_0x9a57('0x34')]({'id':_0xf7352a[_0x9a57('0x30')]['id'][_0x9a57('0x32')],'name':_0xf7352a['name_value_list'][_0x9a57('0xd')][_0x9a57('0x32')]});}}logger[_0x9a57('0xb')](_0x9a57('0x35'));return BPromise['resolve']({'id':_0x2d5985[_0x9a57('0x30')]['user_id'][_0x9a57('0x32')],'name':_0x2d5985[_0x9a57('0x30')][_0x9a57('0x31')][_0x9a57('0x32')]});});}else{logger[_0x9a57('0xb')]('Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!');return BPromise['resolve']({'id':_0x2d5985[_0x9a57('0x30')][_0x9a57('0x36')][_0x9a57('0x32')],'name':_0x2d5985[_0x9a57('0x30')]['user_name']['value']});}}function getEndUser(_0x4ebb40,_0x479151,_0x5c0e89,_0xfd2a22){logger[_0x9a57('0xb')](_0x9a57('0x37'),_0x5c0e89);return request({'form':{'method':'get_entry_list','input_type':_0x9a57('0x22'),'response_type':'JSON','rest_data':JSON[_0x9a57('0x23')]({'session':_0xfd2a22['id'],'module_name':_0x9a57('0x1a'),'query':util[_0x9a57('0x38')](_0x9a57('0x39'),_0x5c0e89),'order_by':'','offset':'0','select_fields':['id','name',_0x9a57('0x3a')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x9a57('0x2d')](function(_0x33ba9a){if(_0x33ba9a[_0x9a57('0x2e')]['length']){var _0x4be730=_[_0x9a57('0x2f')](_0x33ba9a[_0x9a57('0x2e')],function(_0x82ea06){return _0x82ea06[_0x9a57('0x30')][_0x9a57('0x3a')][_0x9a57('0x32')]===_0x5c0e89;});if(_0x4be730){logger[_0x9a57('0xb')](_0x9a57('0x3b'));return BPromise[_0x9a57('0x34')]({'id':_0x4be730[_0x9a57('0x30')]['id'][_0x9a57('0x32')],'name':_0x4be730[_0x9a57('0x30')]['name'][_0x9a57('0x32')],'phone':_0x4be730[_0x9a57('0x30')][_0x9a57('0x3a')][_0x9a57('0x32')]});}}else{logger[_0x9a57('0xb')](_0x9a57('0x3c'));return request({'form':{'method':'set_entry','input_type':_0x9a57('0x22'),'response_type':_0x9a57('0x22'),'rest_data':JSON[_0x9a57('0x23')]({'session':_0xfd2a22['id'],'module_name':'Contacts','name_value_list':[{'name':_0x9a57('0x3d'),'value':_0x479151!==''?_0x479151:util[_0x9a57('0x38')](_0x9a57('0x3e'),_0x5c0e89)},{'name':_0x9a57('0x3a'),'value':_0x5c0e89}]})}})[_0x9a57('0x2d')](function(_0x250c96){logger['info'](_0x9a57('0x3f'));return BPromise[_0x9a57('0x34')]({'id':_0x250c96['id'],'name':_0x250c96[_0x9a57('0x2e')]['first_name'][_0x9a57('0x32')],'phone':_0x250c96[_0x9a57('0x2e')][_0x9a57('0x3a')][_0x9a57('0x32')]});});}});}function request(_0x1a8c01){logger['debug'](_0x9a57('0x40'),JSON['stringify'](_0x1a8c01));return rp(_['merge'](def,_0x1a8c01));}function getTags(_0x5d042c,_0x5a889c){var _0x40cbb4=[];if(_0x5d042c&&_0x5d042c['length']>0x0){_0x40cbb4=_['map'](_0x5d042c,_0x5a889c);}return _0x40cbb4;}function getCustomFields(_0x4eabf3,_0x4f18c6){var _0x51156d=[];var _0x23f6c0={'custom_fields':[]};if(_0x4eabf3['length']>0x0){_[_0x9a57('0x1e')](_0x4eabf3,function(_0x9784ff){if(_0x9784ff[_0x9a57('0x41')]==='string'&&_0x9784ff[_0x9a57('0x42')]&&!_0x9784ff[_0x9a57('0x43')]){_0x23f6c0[_0x9784ff[_0x9a57('0x42')][_0x9a57('0x44')]()]=_0x9784ff[_0x9a57('0x45')]['toString']();}else if(_0x9784ff[_0x9a57('0x41')]===_0x9a57('0x46')&&_0x9784ff[_0x9a57('0x1f')]&&_0x9784ff[_0x9a57('0x43')]){_0x23f6c0[_0x9a57('0x47')]['push']({'id':_0x9784ff[_0x9a57('0x1f')],'value':_0x9784ff[_0x9a57('0x45')][_0x9a57('0x26')]()});}else if(_0x9784ff[_0x9a57('0x41')]===_0x9a57('0x48')&&_0x9784ff[_0x9a57('0x20')]&&_0x9784ff['idField']&&_0x9784ff[_0x9a57('0x43')]){_0x4f18c6[_0x9784ff[_0x9a57('0x20')]]&&_0x23f6c0['custom_fields']['push']({'id':_0x9784ff[_0x9a57('0x1f')],'value':_0x4f18c6[_0x9784ff['variableName']][_0x9a57('0x26')]()});}else if(_0x9784ff[_0x9a57('0x41')]===_0x9a57('0x49')&&_0x9784ff[_0x9a57('0x4a')]&&_0x9784ff[_0x9a57('0x4a')]['name']&&_0x9784ff[_0x9a57('0x1f')]&&_0x9784ff[_0x9a57('0x43')]){_0x4f18c6[_0x9784ff['Variable'][_0x9a57('0xd')]['toLowerCase']()]&&_0x23f6c0[_0x9a57('0x47')][_0x9a57('0x4b')]({'id':_0x9784ff[_0x9a57('0x1f')],'value':_0x4f18c6[_0x9784ff[_0x9a57('0x4a')][_0x9a57('0xd')][_0x9a57('0x44')]()][_0x9a57('0x26')]()});}});}return _0x23f6c0;}function getConnection(_0x1a7110){return request({'method':_0x9a57('0x9'),'form':{'method':_0x9a57('0x4c'),'input_type':_0x9a57('0x22'),'response_type':_0x9a57('0x22'),'rest_data':JSON[_0x9a57('0x23')]({'user_auth':{'user_name':_0x1a7110['username'],'password':_0x1a7110[_0x9a57('0x4d')],'encryption':_0x9a57('0x4e')},'application':_0x9a57('0x4f')})}})['then'](function(_0x144db1){var _0x4d485e=_0x144db1;if(_0x4d485e['id']){def[_0x9a57('0x50')]=_0x4d485e['id'];return BPromise[_0x9a57('0x34')](_0x4d485e);}else{throw new Error(util['format'](_0x9a57('0x51'),_0x1a7110['id']));}});}function setRelationship(_0x5b1264,_0x297ff9,_0x35165c,_0x1b7a58){return request({'form':{'method':_0x9a57('0x52'),'input_type':'JSON','response_type':_0x9a57('0x22'),'rest_data':JSON[_0x9a57('0x23')]({'session':_0x5b1264['id'],'module_name':_0x9a57('0x24'),'module_id':_0x35165c['id'],'link_field_name':_0x1b7a58,'related_ids':[_0x297ff9['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x9a57('0x53')]=function(_0x36a4aa,_0x4f665b,_0xf1f64f,_0x53886e,_0x17e09c,_0x35af87){var _0x178d4d,_0x50f25a,_0x3a6e65,_0x1f7c93;_0x35af87[_0x9a57('0x54')]=intUtil[_0x9a57('0x55')](_0x35af87['remoteUri']);_0x35af87[_0x9a57('0x56')]=intUtil['stripTrailingSlash'](_0x35af87[_0x9a57('0x56')]);def[_0x9a57('0x57')]=util[_0x9a57('0x38')](_0x9a57('0x58'),_0x35af87[_0x9a57('0x54')]);if(_0x17e09c&&_0x17e09c[_0x9a57('0x59')]){logger[_0x9a57('0xb')](_0x9a57('0x5a'),_0x9a57('0x5b'));_0x4f665b[_0x9a57('0x5c')]=util[_0x9a57('0x38')](_0x9a57('0x5d'),_0x35af87[_0x9a57('0x56')],_0x4f665b[_0x9a57('0x5e')],md5(_0x4f665b[_0x9a57('0x5e')]));}else{_0x4f665b[_0x9a57('0x5c')]='';}return getConnection(_0x35af87)[_0x9a57('0x2d')](function(_0xb76b17){_0x1f7c93=_0xb76b17;return getUser(_0x35af87,_0x53886e[_0x9a57('0xd')],_0x1f7c93);})[_0x9a57('0x2d')](function(_0x23761d){_0x178d4d=_0x23761d;logger[_0x9a57('0xb')](_0x9a57('0x5f'),_0x178d4d['id']);return getEndUser(_0x35af87,_0x4f665b['calleridname'],_0x4f665b[_0x9a57('0x60')],_0x1f7c93);})[_0x9a57('0x2d')](function(_0x4bc3c2){_0x50f25a=_0x4bc3c2;logger[_0x9a57('0xb')](_0x9a57('0x61'),_0x50f25a['id']);return getTicket(_0x35af87,_0x178d4d,_0x50f25a,_0xf1f64f,_0x4f665b,_0xf1f64f[_0x9a57('0x62')],_0x1f7c93,'Inbound');})[_0x9a57('0x2d')](function(_0x356ca8){_0x3a6e65=_0x356ca8;logger[_0x9a57('0xb')]('Ticket\x20created!');logger[_0x9a57('0xb')](_0x9a57('0x63'),_0x3a6e65['id']);return setRelationship(_0x1f7c93,_0x178d4d,_0x3a6e65,'users');})[_0x9a57('0x2d')](function(){return setRelationship(_0x1f7c93,_0x50f25a,_0x3a6e65,_0x9a57('0x64'));})[_0x9a57('0x2d')](function(){return getServerInfo(_0x1f7c93);})['then'](function(_0x153a3b){var _0x390d34=parseInt(_0x153a3b[_0x9a57('0x65')][_0x9a57('0x66')](0x0));var _0x17e967=util['format']('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x35af87[_0x9a57('0x54')],_0x3a6e65['id']);if(_0x390d34>0x6){_0x17e967=util['format'](_0x9a57('0x67'),_0x35af87[_0x9a57('0x54')],_0x3a6e65['id']);}logger[_0x9a57('0xb')](_0x9a57('0x5a'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x9a57('0x38')](_0x9a57('0x68'),_0x53886e['name']),_0x9a57('0x69'),{'uri':_0x17e967});})[_0x9a57('0x6a')](function(_0x15504b){logger[_0x9a57('0x6b')](_0x9a57('0x5a'),JSON[_0x9a57('0x23')](_0x15504b));});};exports['outbound']=function(_0x3ad521,_0xc65dc9,_0x49703c,_0x4496e7,_0x5f14b9,_0x4d419c,_0x255647){var _0x4127e5,_0x2bfa2f,_0x52177e,_0x4b7b95;_0x4d419c[_0x9a57('0x54')]=intUtil[_0x9a57('0x55')](_0x4d419c['remoteUri']);_0x4d419c[_0x9a57('0x56')]=intUtil[_0x9a57('0x55')](_0x4d419c['serverUrl']);def[_0x9a57('0x57')]=util[_0x9a57('0x38')](_0x9a57('0x58'),_0x4d419c[_0x9a57('0x54')]);if(_0x255647&&_0x255647['recordingFormat']&&_0x255647[_0x9a57('0x6c')]!=='none'){logger['info'](_0x9a57('0x6d'),'Recording\x20is\x20enabled!');_0xc65dc9[_0x9a57('0x5c')]=util[_0x9a57('0x38')](_0x9a57('0x5d'),_0x4d419c[_0x9a57('0x56')],_0xc65dc9['uniqueid'],md5(_0xc65dc9[_0x9a57('0x5e')]));}return getConnection(_0x4d419c)['then'](function(_0x4cbeeb){_0x4b7b95=_0x4cbeeb;return getUser(_0x4d419c,_0x4496e7[_0x9a57('0xd')],_0x4b7b95);})[_0x9a57('0x2d')](function(_0x1ce199){_0x4127e5=_0x1ce199;logger[_0x9a57('0xb')](_0x9a57('0x5f'),_0x4127e5['id']);return getEndUser(_0x4d419c,_0xc65dc9[_0x9a57('0x6e')],_0xc65dc9[_0x9a57('0x6f')],_0x4b7b95);})['then'](function(_0x42c6d9){_0x2bfa2f=_0x42c6d9;logger[_0x9a57('0xb')](_0x9a57('0x61'),_0x2bfa2f['id']);return getTicket(_0x4d419c,_0x4127e5,_0x2bfa2f,_0x49703c,_0xc65dc9,_0x49703c[_0x9a57('0x62')],_0x4b7b95,_0x9a57('0x70'));})['then'](function(_0x332164){_0x52177e=_0x332164;logger[_0x9a57('0xb')](_0x9a57('0x71'));logger[_0x9a57('0xb')](_0x9a57('0x63'),_0x52177e['id']);return setRelationship(_0x4b7b95,_0x4127e5,_0x52177e,_0x9a57('0x72'));})[_0x9a57('0x2d')](function(){return setRelationship(_0x4b7b95,_0x2bfa2f,_0x52177e,'contacts');})[_0x9a57('0x2d')](function(){return getServerInfo(_0x4b7b95);})[_0x9a57('0x2d')](function(_0x36c714){var _0x144a31=parseInt(_0x36c714[_0x9a57('0x65')][_0x9a57('0x66')](0x0));var _0x41f0cd=util[_0x9a57('0x38')](_0x9a57('0x73'),_0x4d419c[_0x9a57('0x54')],_0x52177e['id']);if(_0x144a31>0x6){_0x41f0cd=util[_0x9a57('0x38')](_0x9a57('0x67'),_0x4d419c[_0x9a57('0x54')],_0x52177e['id']);}logger[_0x9a57('0xb')]('[OUTBOUND]',_0x9a57('0x74'));emit(util[_0x9a57('0x38')](_0x9a57('0x68'),_0x4496e7[_0x9a57('0xd')]),_0x9a57('0x69'),{'uri':_0x41f0cd});})['catch'](function(_0x126066){logger[_0x9a57('0x6b')](_0x9a57('0x6d'),JSON[_0x9a57('0x23')](_0x126066));});};exports[_0x9a57('0x75')]=function(_0x197f66,_0x2edcd2,_0x110fe4,_0x207710,_0x3a51db,_0x205eb9){var _0x135d8e,_0x259204,_0x4e115d,_0x1bd048;_0x205eb9[_0x9a57('0x54')]=intUtil[_0x9a57('0x55')](_0x205eb9[_0x9a57('0x54')]);_0x205eb9[_0x9a57('0x56')]=intUtil[_0x9a57('0x55')](_0x205eb9[_0x9a57('0x56')]);def[_0x9a57('0x57')]=util[_0x9a57('0x38')](_0x9a57('0x58'),_0x205eb9['remoteUri']);if(_0x3a51db&&_0x3a51db[_0x9a57('0x59')]){logger[_0x9a57('0xb')]('['+_0x2edcd2[_0x9a57('0x76')][_0x9a57('0x77')]()+']',_0x9a57('0x5b'));_0x2edcd2[_0x9a57('0x5c')]=util[_0x9a57('0x38')](_0x9a57('0x5d'),_0x205eb9[_0x9a57('0x56')],_0x2edcd2[_0x9a57('0x5e')],md5(_0x2edcd2['uniqueid']));}else{_0x2edcd2[_0x9a57('0x5c')]='';}return getConnection(_0x205eb9)['then'](function(_0xe7aaad){_0x1bd048=_0xe7aaad;if(!_['isNil'](_0x207710)){return getUser(_0x205eb9,_0x207710[_0x9a57('0xd')],_0x1bd048);}else{return getUser(_0x205eb9,null,_0x1bd048);}})[_0x9a57('0x2d')](function(_0x247cc6){_0x135d8e=_0x247cc6;logger[_0x9a57('0xb')](_0x9a57('0x5f'),_0x135d8e['id']);return getEndUser(_0x205eb9,_0x2edcd2['calleridname'],_0x2edcd2[_0x9a57('0x60')],_0x1bd048);})[_0x9a57('0x2d')](function(_0x251fb2){_0x259204=_0x251fb2;logger[_0x9a57('0xb')](_0x9a57('0x61'),_0x259204['id']);return getTicket(_0x205eb9,_0x135d8e,_0x259204,_0x110fe4,_0x2edcd2,_0x110fe4['Fields'],_0x1bd048,_0x9a57('0x78'));})[_0x9a57('0x2d')](function(_0x1ac0cb){_0x4e115d=_0x1ac0cb;logger[_0x9a57('0xb')](_0x9a57('0x71'));logger[_0x9a57('0xb')](_0x9a57('0x63'),_0x4e115d['id']);return setRelationship(_0x1bd048,_0x135d8e,_0x4e115d,_0x9a57('0x72'));})[_0x9a57('0x2d')](function(){return setRelationship(_0x1bd048,_0x259204,_0x4e115d,_0x9a57('0x64'));})['then'](function(){return getServerInfo(_0x1bd048);})[_0x9a57('0x6a')](function(_0xf64ccf){logger[_0x9a57('0x6b')]('['+_0x2edcd2[_0x9a57('0x76')]['toUpperCase']()+']',JSON[_0x9a57('0x23')](_0xf64ccf));});}; \ No newline at end of file +var _0xb159=['bluebird','md5','util','ioredis','./util','../../../../config/environment','sugarcrm','redis','defaults','localhost','emit','info','name','getString','Subjects','created_by','Descriptions','date_start','toISOString','replace','duration_hours','duration_minutes','parent_id','parent_type','Contacts','parent_name','direction','length','forEach','push','set_entry','JSON','stringify','Calls','format','toString','base64','get_server_info','isNil','Getting\x20agent\x20with\x20name','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','entry_list','name_value_list','value','resolve','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Searching\x20enduser\x20with\x20phone','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','find','first_name','','Caller\x20-\x20%s','Enduser\x20created.','debug','[HTTP]','merge','type','nameField','content','string','customField','custom_fields','idField','variableName','customVariable','Variable','toLowerCase','POST','login','username','password','PLAIN','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','queue','remoteUri','stripTrailingSlash','serverUrl','uri','[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:','Fields','Inbound','users','contacts','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','catch','error','outbound','%s/service/v4_1/rest.php','recordingFormat','none','[OUTBOUND]','destcalleridnum','The\x20Ticket\x20ID\x20is:','version','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','monitor_format','lastevent','calleridname','Ticket\x20created!','toUpperCase','lodash','request-promise'];(function(_0x1a3689,_0x3d233f){var _0xc59e17=function(_0x1b2293){while(--_0x1b2293){_0x1a3689['push'](_0x1a3689['shift']());}};_0xc59e17(++_0x3d233f);}(_0xb159,0x1e2));var _0x9b15=function(_0x1b8587,_0x5e569d){_0x1b8587=_0x1b8587-0x0;var _0x4c6c23=_0xb159[_0x1b8587];return _0x4c6c23;};'use strict';var _=require(_0x9b15('0x0'));var rp=require(_0x9b15('0x1'));var BPromise=require(_0x9b15('0x2'));var md5=require(_0x9b15('0x3'));var util=require(_0x9b15('0x4'));var Redis=require(_0x9b15('0x5'));var intUtil=require(_0x9b15('0x6'));var config=require(_0x9b15('0x7'));var logger=require('../../../../config/logger')(_0x9b15('0x8'));config[_0x9b15('0x9')]=_[_0x9b15('0xa')](config[_0x9b15('0x9')],{'host':_0x9b15('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x9b15('0x9')]));var def={'method':'POST','json':!![]};function emit(_0x3eb468,_0x19e9c8,_0x3d729a){io['to'](_0x3eb468)[_0x9b15('0xc')](_0x19e9c8,_0x3d729a);}function getTicket(_0x5afbfa,_0x25e5eb,_0x5958c9,_0x560940,_0x172c7e,_0x362241,_0x1207d0,_0x3345c7){logger[_0x9b15('0xd')]('Creating\x20new\x20ticket...');var _0x1fa7de=new Date();var _0x314bc3=[{'name':_0x9b15('0xe'),'value':intUtil[_0x9b15('0xf')](_0x560940[_0x9b15('0x10')],_0x172c7e,'\x20')},{'name':'assigned_user_id','value':_0x25e5eb['id']},{'name':_0x9b15('0x11'),'value':_0x25e5eb['id']},{'name':'description','value':intUtil[_0x9b15('0xf')](_0x560940[_0x9b15('0x12')],_0x172c7e,'\x0a')},{'name':_0x9b15('0x13'),'value':_0x1fa7de[_0x9b15('0x14')]()['slice'](0x0,0x13)[_0x9b15('0x15')]('T','\x20')},{'name':_0x9b15('0x16'),'value':'0'},{'name':_0x9b15('0x17'),'value':'15'},{'name':_0x9b15('0x18'),'value':_0x5958c9['id']},{'name':_0x9b15('0x19'),'value':_0x9b15('0x1a')},{'name':_0x9b15('0x1b'),'value':_0x5958c9['name']},{'name':_0x9b15('0x1c'),'value':_0x3345c7}];if(_0x362241[_0x9b15('0x1d')]){_[_0x9b15('0x1e')](_0x362241,function(_0x506e56){if(_0x172c7e[_0x506e56['variableName']]){_0x314bc3[_0x9b15('0x1f')]({'name':_0x506e56['idField'],'value':_0x172c7e[_0x506e56['variableName']]});}});}return request({'form':{'method':_0x9b15('0x20'),'input_type':_0x9b15('0x21'),'response_type':'JSON','rest_data':JSON[_0x9b15('0x22')]({'session':_0x1207d0['id'],'module_name':_0x9b15('0x23'),'name_value_list':_0x314bc3})}});}function getAuth(_0x2d631c){return util[_0x9b15('0x24')]('Basic\x20%s',new Buffer(_0x2d631c['apiKey']+':X')[_0x9b15('0x25')](_0x9b15('0x26')));}function getServerInfo(_0x3cd09e){return request({'form':{'method':_0x9b15('0x27'),'input_type':_0x9b15('0x21'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0x3cd09e['id']})}});}function getUser(_0xf5c253,_0x59f7fc,_0x1f3803){if(!_[_0x9b15('0x28')](_0x59f7fc)){logger[_0x9b15('0xd')](_0x9b15('0x29'),_0x59f7fc);return request({'form':{'method':'get_entry_list','input_type':_0x9b15('0x21'),'response_type':_0x9b15('0x21'),'rest_data':JSON['stringify']({'session':_0x1f3803['id'],'module_name':_0x9b15('0x2a'),'query':util[_0x9b15('0x24')](_0x9b15('0x2b'),_0x59f7fc),'order_by':'','offset':'0','select_fields':['id',_0x9b15('0xe'),_0x9b15('0x2c')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x9b15('0x2d')](function(_0xe547ed){if(_0xe547ed[_0x9b15('0x2e')][_0x9b15('0x1d')]){var _0x3ec412=_['find'](_0xe547ed['entry_list'],function(_0x74d1e0){return _0x74d1e0[_0x9b15('0x2f')]['user_name'][_0x9b15('0x30')]===_0x59f7fc;});if(_0x3ec412){logger[_0x9b15('0xd')]('Agent\x20found!');return BPromise[_0x9b15('0x31')]({'id':_0x3ec412['name_value_list']['id']['value'],'name':_0x3ec412[_0x9b15('0x2f')]['name']['value']});}}logger[_0x9b15('0xd')](_0x9b15('0x32'));return BPromise['resolve']({'id':_0x1f3803[_0x9b15('0x2f')][_0x9b15('0x33')]['value'],'name':_0x1f3803[_0x9b15('0x2f')]['user_name'][_0x9b15('0x30')]});});}else{logger[_0x9b15('0xd')]('Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!');return BPromise[_0x9b15('0x31')]({'id':_0x1f3803[_0x9b15('0x2f')]['user_id'][_0x9b15('0x30')],'name':_0x1f3803[_0x9b15('0x2f')][_0x9b15('0x2c')][_0x9b15('0x30')]});}}function getEndUser(_0x1130bb,_0x4a2b55,_0x2b3f25,_0x19b8cc){logger[_0x9b15('0xd')](_0x9b15('0x34'),_0x2b3f25);return request({'form':{'method':'get_entry_list','input_type':_0x9b15('0x21'),'response_type':_0x9b15('0x21'),'rest_data':JSON[_0x9b15('0x22')]({'session':_0x19b8cc['id'],'module_name':_0x9b15('0x1a'),'query':util[_0x9b15('0x24')](_0x9b15('0x35'),_0x2b3f25),'order_by':'','offset':'0','select_fields':['id',_0x9b15('0xe'),_0x9b15('0x36')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x9b15('0x2d')](function(_0xe492af){if(_0xe492af[_0x9b15('0x2e')][_0x9b15('0x1d')]){var _0x3a4f66=_[_0x9b15('0x37')](_0xe492af[_0x9b15('0x2e')],function(_0x3d4395){return _0x3d4395[_0x9b15('0x2f')][_0x9b15('0x36')]['value']===_0x2b3f25;});if(_0x3a4f66){logger[_0x9b15('0xd')]('Enduser\x20found!');return BPromise[_0x9b15('0x31')]({'id':_0x3a4f66[_0x9b15('0x2f')]['id'][_0x9b15('0x30')],'name':_0x3a4f66[_0x9b15('0x2f')]['name'][_0x9b15('0x30')],'phone':_0x3a4f66[_0x9b15('0x2f')][_0x9b15('0x36')][_0x9b15('0x30')]});}}else{logger[_0x9b15('0xd')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'form':{'method':_0x9b15('0x20'),'input_type':_0x9b15('0x21'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0x19b8cc['id'],'module_name':_0x9b15('0x1a'),'name_value_list':[{'name':_0x9b15('0x38'),'value':_0x4a2b55!==_0x9b15('0x39')?_0x4a2b55:util['format'](_0x9b15('0x3a'),_0x2b3f25)},{'name':_0x9b15('0x36'),'value':_0x2b3f25}]})}})['then'](function(_0xbec479){logger[_0x9b15('0xd')](_0x9b15('0x3b'));return BPromise[_0x9b15('0x31')]({'id':_0xbec479['id'],'name':_0xbec479['entry_list'][_0x9b15('0x38')]['value'],'phone':_0xbec479['entry_list'][_0x9b15('0x36')]['value']});});}});}function request(_0x4e42f7){logger[_0x9b15('0x3c')](_0x9b15('0x3d'),JSON[_0x9b15('0x22')](_0x4e42f7));return rp(_[_0x9b15('0x3e')](def,_0x4e42f7));}function getTags(_0x2fbadb,_0x26cfc0){var _0x534e7b=[];if(_0x2fbadb&&_0x2fbadb[_0x9b15('0x1d')]>0x0){_0x534e7b=_['map'](_0x2fbadb,_0x26cfc0);}return _0x534e7b;}function getCustomFields(_0xc0e550,_0x350827){var _0x4dbbe9=[];var _0x5b617b={'custom_fields':[]};if(_0xc0e550[_0x9b15('0x1d')]>0x0){_[_0x9b15('0x1e')](_0xc0e550,function(_0xd7eea3){if(_0xd7eea3[_0x9b15('0x3f')]==='string'&&_0xd7eea3[_0x9b15('0x40')]&&!_0xd7eea3['customField']){_0x5b617b[_0xd7eea3['nameField']['toLowerCase']()]=_0xd7eea3[_0x9b15('0x41')][_0x9b15('0x25')]();}else if(_0xd7eea3[_0x9b15('0x3f')]===_0x9b15('0x42')&&_0xd7eea3['idField']&&_0xd7eea3[_0x9b15('0x43')]){_0x5b617b[_0x9b15('0x44')]['push']({'id':_0xd7eea3[_0x9b15('0x45')],'value':_0xd7eea3[_0x9b15('0x41')][_0x9b15('0x25')]()});}else if(_0xd7eea3[_0x9b15('0x3f')]==='variable'&&_0xd7eea3[_0x9b15('0x46')]&&_0xd7eea3['idField']&&_0xd7eea3[_0x9b15('0x43')]){_0x350827[_0xd7eea3[_0x9b15('0x46')]]&&_0x5b617b[_0x9b15('0x44')][_0x9b15('0x1f')]({'id':_0xd7eea3[_0x9b15('0x45')],'value':_0x350827[_0xd7eea3['variableName']][_0x9b15('0x25')]()});}else if(_0xd7eea3[_0x9b15('0x3f')]===_0x9b15('0x47')&&_0xd7eea3[_0x9b15('0x48')]&&_0xd7eea3[_0x9b15('0x48')]['name']&&_0xd7eea3[_0x9b15('0x45')]&&_0xd7eea3[_0x9b15('0x43')]){_0x350827[_0xd7eea3['Variable']['name']['toLowerCase']()]&&_0x5b617b[_0x9b15('0x44')][_0x9b15('0x1f')]({'id':_0xd7eea3[_0x9b15('0x45')],'value':_0x350827[_0xd7eea3[_0x9b15('0x48')]['name'][_0x9b15('0x49')]()]['toString']()});}});}return _0x5b617b;}function getConnection(_0x97dcaa){return request({'method':_0x9b15('0x4a'),'form':{'method':_0x9b15('0x4b'),'input_type':'JSON','response_type':_0x9b15('0x21'),'rest_data':JSON[_0x9b15('0x22')]({'user_auth':{'user_name':_0x97dcaa[_0x9b15('0x4c')],'password':_0x97dcaa[_0x9b15('0x4d')],'encryption':_0x9b15('0x4e')},'application':_0x9b15('0x4f')})}})[_0x9b15('0x2d')](function(_0x4e3f3c){var _0x1122dd=_0x4e3f3c;if(_0x1122dd['id']){def[_0x9b15('0x50')]=_0x1122dd['id'];return BPromise[_0x9b15('0x31')](_0x1122dd);}else{throw new Error(util[_0x9b15('0x24')](_0x9b15('0x51'),_0x97dcaa['id']));}});}function setRelationship(_0x16e28e,_0x3772c5,_0x180478,_0x1fbd50){return request({'form':{'method':_0x9b15('0x52'),'input_type':_0x9b15('0x21'),'response_type':_0x9b15('0x21'),'rest_data':JSON[_0x9b15('0x22')]({'session':_0x16e28e['id'],'module_name':_0x9b15('0x23'),'module_id':_0x180478['id'],'link_field_name':_0x1fbd50,'related_ids':[_0x3772c5['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x9b15('0x53')]=function(_0x1c7166,_0x508f70,_0x5638da,_0x345b43,_0x3bf644,_0x5ea94d){var _0x50edc8,_0x496f18,_0x598314,_0x42bc56;_0x5ea94d[_0x9b15('0x54')]=intUtil[_0x9b15('0x55')](_0x5ea94d[_0x9b15('0x54')]);_0x5ea94d[_0x9b15('0x56')]=intUtil[_0x9b15('0x55')](_0x5ea94d[_0x9b15('0x56')]);def[_0x9b15('0x57')]=util[_0x9b15('0x24')]('%s/service/v4_1/rest.php',_0x5ea94d['remoteUri']);if(_0x3bf644&&_0x3bf644['monitor_format']){logger[_0x9b15('0xd')](_0x9b15('0x58'),_0x9b15('0x59'));_0x508f70['recordingURL']=util[_0x9b15('0x24')](_0x9b15('0x5a'),_0x5ea94d[_0x9b15('0x56')],_0x508f70[_0x9b15('0x5b')],md5(_0x508f70[_0x9b15('0x5b')]));}else{_0x508f70[_0x9b15('0x5c')]='';}return getConnection(_0x5ea94d)[_0x9b15('0x2d')](function(_0x1241a3){_0x42bc56=_0x1241a3;return getUser(_0x5ea94d,_0x345b43['name'],_0x42bc56);})[_0x9b15('0x2d')](function(_0x32ce62){_0x50edc8=_0x32ce62;logger[_0x9b15('0xd')](_0x9b15('0x5d'),_0x50edc8['id']);return getEndUser(_0x5ea94d,_0x508f70['calleridname'],_0x508f70[_0x9b15('0x5e')],_0x42bc56);})[_0x9b15('0x2d')](function(_0x5ddfd7){_0x496f18=_0x5ddfd7;logger[_0x9b15('0xd')](_0x9b15('0x5f'),_0x496f18['id']);return getTicket(_0x5ea94d,_0x50edc8,_0x496f18,_0x5638da,_0x508f70,_0x5638da[_0x9b15('0x60')],_0x42bc56,_0x9b15('0x61'));})[_0x9b15('0x2d')](function(_0x5edf56){_0x598314=_0x5edf56;logger[_0x9b15('0xd')]('Ticket\x20created!');logger[_0x9b15('0xd')]('The\x20Ticket\x20ID\x20is:',_0x598314['id']);return setRelationship(_0x42bc56,_0x50edc8,_0x598314,_0x9b15('0x62'));})[_0x9b15('0x2d')](function(){return setRelationship(_0x42bc56,_0x496f18,_0x598314,_0x9b15('0x63'));})[_0x9b15('0x2d')](function(){return getServerInfo(_0x42bc56);})['then'](function(_0x183b70){var _0x3e9b26=parseInt(_0x183b70['version'][_0x9b15('0x64')](0x0));var _0x24be9c=util[_0x9b15('0x24')](_0x9b15('0x65'),_0x5ea94d[_0x9b15('0x54')],_0x598314['id']);if(_0x3e9b26>0x6){_0x24be9c=util[_0x9b15('0x24')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x5ea94d[_0x9b15('0x54')],_0x598314['id']);}logger[_0x9b15('0xd')](_0x9b15('0x58'),_0x9b15('0x66'));emit(util[_0x9b15('0x24')](_0x9b15('0x67'),_0x345b43['name']),_0x9b15('0x68'),{'uri':_0x24be9c});})[_0x9b15('0x69')](function(_0x536e44){logger[_0x9b15('0x6a')](_0x9b15('0x58'),JSON[_0x9b15('0x22')](_0x536e44));});};exports[_0x9b15('0x6b')]=function(_0x3063ed,_0x3fc38f,_0x13f5e7,_0x5a6559,_0x4430b2,_0x10240f,_0x568f39){var _0x3f8ccb,_0x1c0ec3,_0x383a5b,_0x568da8;_0x10240f[_0x9b15('0x54')]=intUtil[_0x9b15('0x55')](_0x10240f[_0x9b15('0x54')]);_0x10240f[_0x9b15('0x56')]=intUtil[_0x9b15('0x55')](_0x10240f['serverUrl']);def[_0x9b15('0x57')]=util[_0x9b15('0x24')](_0x9b15('0x6c'),_0x10240f[_0x9b15('0x54')]);if(_0x568f39&&_0x568f39[_0x9b15('0x6d')]&&_0x568f39[_0x9b15('0x6d')]!==_0x9b15('0x6e')){logger[_0x9b15('0xd')](_0x9b15('0x6f'),_0x9b15('0x59'));_0x3fc38f['recordingURL']=util[_0x9b15('0x24')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x10240f['serverUrl'],_0x3fc38f[_0x9b15('0x5b')],md5(_0x3fc38f['uniqueid']));}return getConnection(_0x10240f)[_0x9b15('0x2d')](function(_0x4134dc){_0x568da8=_0x4134dc;return getUser(_0x10240f,_0x5a6559[_0x9b15('0xe')],_0x568da8);})['then'](function(_0x100a1e){_0x3f8ccb=_0x100a1e;logger['info']('The\x20User\x20ID\x20is:',_0x3f8ccb['id']);return getEndUser(_0x10240f,_0x3fc38f['destcalleridname'],_0x3fc38f[_0x9b15('0x70')],_0x568da8);})[_0x9b15('0x2d')](function(_0x2ca7b2){_0x1c0ec3=_0x2ca7b2;logger['info'](_0x9b15('0x5f'),_0x1c0ec3['id']);return getTicket(_0x10240f,_0x3f8ccb,_0x1c0ec3,_0x13f5e7,_0x3fc38f,_0x13f5e7[_0x9b15('0x60')],_0x568da8,'Outbound');})[_0x9b15('0x2d')](function(_0x5be0e5){_0x383a5b=_0x5be0e5;logger[_0x9b15('0xd')]('Ticket\x20created!');logger[_0x9b15('0xd')](_0x9b15('0x71'),_0x383a5b['id']);return setRelationship(_0x568da8,_0x3f8ccb,_0x383a5b,_0x9b15('0x62'));})[_0x9b15('0x2d')](function(){return setRelationship(_0x568da8,_0x1c0ec3,_0x383a5b,_0x9b15('0x63'));})[_0x9b15('0x2d')](function(){return getServerInfo(_0x568da8);})[_0x9b15('0x2d')](function(_0x5e1d53){var _0x44d7c3=parseInt(_0x5e1d53[_0x9b15('0x72')][_0x9b15('0x64')](0x0));var _0x4fa8bc=util[_0x9b15('0x24')](_0x9b15('0x65'),_0x10240f['remoteUri'],_0x383a5b['id']);if(_0x44d7c3>0x6){_0x4fa8bc=util['format'](_0x9b15('0x73'),_0x10240f['remoteUri'],_0x383a5b['id']);}logger[_0x9b15('0xd')]('[OUTBOUND]',_0x9b15('0x66'));emit(util[_0x9b15('0x24')](_0x9b15('0x67'),_0x5a6559['name']),_0x9b15('0x68'),{'uri':_0x4fa8bc});})[_0x9b15('0x69')](function(_0x4661f9){logger[_0x9b15('0x6a')](_0x9b15('0x6f'),JSON[_0x9b15('0x22')](_0x4661f9));});};exports['unmanaged']=function(_0x3ecb2e,_0x599662,_0x3da09a,_0xa9ca6,_0x24e530,_0xae6b95){var _0x3ccfe2,_0xe3901c,_0xb2ac2c,_0x220116;_0xae6b95[_0x9b15('0x54')]=intUtil[_0x9b15('0x55')](_0xae6b95[_0x9b15('0x54')]);_0xae6b95[_0x9b15('0x56')]=intUtil['stripTrailingSlash'](_0xae6b95[_0x9b15('0x56')]);def[_0x9b15('0x57')]=util[_0x9b15('0x24')](_0x9b15('0x6c'),_0xae6b95[_0x9b15('0x54')]);if(_0x24e530&&_0x24e530[_0x9b15('0x74')]){logger[_0x9b15('0xd')]('['+_0x599662[_0x9b15('0x75')]['toUpperCase']()+']',_0x9b15('0x59'));_0x599662[_0x9b15('0x5c')]=util[_0x9b15('0x24')](_0x9b15('0x5a'),_0xae6b95[_0x9b15('0x56')],_0x599662['uniqueid'],md5(_0x599662[_0x9b15('0x5b')]));}else{_0x599662['recordingURL']='';}return getConnection(_0xae6b95)[_0x9b15('0x2d')](function(_0x9fecd2){_0x220116=_0x9fecd2;if(!_[_0x9b15('0x28')](_0xa9ca6)){return getUser(_0xae6b95,_0xa9ca6[_0x9b15('0xe')],_0x220116);}else{return getUser(_0xae6b95,null,_0x220116);}})[_0x9b15('0x2d')](function(_0x16362b){_0x3ccfe2=_0x16362b;logger[_0x9b15('0xd')](_0x9b15('0x5d'),_0x3ccfe2['id']);return getEndUser(_0xae6b95,_0x599662[_0x9b15('0x76')],_0x599662[_0x9b15('0x5e')],_0x220116);})[_0x9b15('0x2d')](function(_0x28a477){_0xe3901c=_0x28a477;logger[_0x9b15('0xd')]('The\x20Enduser\x20ID\x20is:',_0xe3901c['id']);return getTicket(_0xae6b95,_0x3ccfe2,_0xe3901c,_0x3da09a,_0x599662,_0x3da09a[_0x9b15('0x60')],_0x220116,_0x9b15('0x61'));})[_0x9b15('0x2d')](function(_0x3569d7){_0xb2ac2c=_0x3569d7;logger['info'](_0x9b15('0x77'));logger[_0x9b15('0xd')]('The\x20Ticket\x20ID\x20is:',_0xb2ac2c['id']);return setRelationship(_0x220116,_0x3ccfe2,_0xb2ac2c,_0x9b15('0x62'));})['then'](function(){return setRelationship(_0x220116,_0xe3901c,_0xb2ac2c,_0x9b15('0x63'));})[_0x9b15('0x2d')](function(){return getServerInfo(_0x220116);})[_0x9b15('0x69')](function(_0xb9c8b8){logger[_0x9b15('0x6a')]('['+_0x599662[_0x9b15('0x75')][_0x9b15('0x78')]()+']',JSON[_0x9b15('0x22')](_0xb9c8b8));});}; \ 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 be90138..4d2fb20 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 _0x58b8=['length','type','push','content','variableName','toString','Variable','name','toLowerCase','keyValue','keyType','%s:\x20%s','key','keyContent','customVariable','join','stripTrailingSlash','slice','substring','lastIndexOf','validateEmail','isNil','test','lodash','getString','sortBy'];(function(_0x20d55d,_0x57bfba){var _0x390647=function(_0x15207b){while(--_0x15207b){_0x20d55d['push'](_0x20d55d['shift']());}};_0x390647(++_0x57bfba);}(_0x58b8,0x183));var _0x858b=function(_0x98197,_0xea7356){_0x98197=_0x98197-0x0;var _0x5d9199=_0x58b8[_0x98197];return _0x5d9199;};'use strict';var _=require(_0x858b('0x0'));var util=require('util');exports[_0x858b('0x1')]=function(_0xb11027,_0x59de72,_0x2a1089){var _0x2e45e0=[];if(_0xb11027['length']>0x0){var _0x175d04=_[_0x858b('0x2')](_0xb11027,['id']);for(var _0x291bdb=0x0;_0x291bdb<_0x175d04[_0x858b('0x3')];_0x291bdb++){var _0x4e01f8=_0x175d04[_0x291bdb];if(_0x4e01f8[_0x858b('0x4')]==='string'){_0x2e45e0[_0x858b('0x5')](_0x4e01f8[_0x858b('0x6')]);}else if(_0x4e01f8[_0x858b('0x4')]==='variable'&&_0x4e01f8[_0x858b('0x7')]){_0x59de72[_0x4e01f8['variableName']]&&_0x2e45e0['push'](_0x59de72[_0x4e01f8[_0x858b('0x7')]][_0x858b('0x8')]());}else if(_0x4e01f8['type']==='customVariable'&&_0x4e01f8[_0x858b('0x9')]&&_0x4e01f8[_0x858b('0x9')][_0x858b('0xa')]){_0x59de72[_0x4e01f8[_0x858b('0x9')][_0x858b('0xa')]['toLowerCase']()]&&_0x2e45e0[_0x858b('0x5')](_0x59de72[_0x4e01f8['Variable'][_0x858b('0xa')][_0x858b('0xb')]()][_0x858b('0x8')]());}else if(_0x4e01f8[_0x858b('0x4')]===_0x858b('0xc')){if(_0x4e01f8[_0x858b('0xd')]==='string'&&_0x4e01f8['key']){_0x2e45e0[_0x858b('0x5')](util['format'](_0x858b('0xe'),_0x4e01f8[_0x858b('0xf')],_0x4e01f8[_0x858b('0x10')]));}else if(_0x4e01f8[_0x858b('0xd')]==='variable'&&_0x4e01f8['variableName']&&_0x4e01f8['key']){_0x59de72[_0x4e01f8[_0x858b('0x7')]]&&_0x2e45e0['push'](util['format'](_0x858b('0xe'),_0x4e01f8[_0x858b('0xf')],_0x59de72[_0x4e01f8[_0x858b('0x7')]]));}else if(_0x4e01f8['keyType']===_0x858b('0x11')&&_0x4e01f8[_0x858b('0x9')]&&_0x4e01f8['Variable'][_0x858b('0xa')]&&_0x4e01f8['key']){_0x59de72[_0x4e01f8[_0x858b('0x9')][_0x858b('0xa')][_0x858b('0xb')]()]&&_0x2e45e0[_0x858b('0x5')](util['format'](_0x858b('0xe'),_0x4e01f8['key'],_0x59de72[_0x4e01f8[_0x858b('0x9')]['name'][_0x858b('0xb')]()]));}}}}return _0x2e45e0[_0x858b('0x12')](_0x2a1089);};exports[_0x858b('0x13')]=function(_0x4c2da2){var _0x4fe7d4=_0x4c2da2[_0x858b('0x14')](-0x1);if(_0x4fe7d4==='/'){_0x4c2da2=_0x4c2da2[_0x858b('0x15')](0x0,_0x4c2da2[_0x858b('0x16')](_0x4fe7d4));}return _0x4c2da2;};exports[_0x858b('0x17')]=function(_0x54d29e){if(!_[_0x858b('0x18')](_0x54d29e)&&_0x54d29e!==''){var _0x115bc3=/^(([^<>()\[\]\\.,;:\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 _0x115bc3[_0x858b('0x19')](String(_0x54d29e)[_0x858b('0xb')]());}else{return![];}}; \ No newline at end of file +var _0x76ff=['lodash','util','getString','length','sortBy','string','push','type','variable','variableName','toString','customVariable','Variable','name','toLowerCase','keyValue','keyType','key','format','%s:\x20%s','keyContent','join','stripTrailingSlash','slice','substring','lastIndexOf','validateEmail','isNil','test'];(function(_0x86cbe,_0x2a7bf4){var _0x14c98d=function(_0x3186ef){while(--_0x3186ef){_0x86cbe['push'](_0x86cbe['shift']());}};_0x14c98d(++_0x2a7bf4);}(_0x76ff,0xae));var _0xf76f=function(_0x204668,_0x46227d){_0x204668=_0x204668-0x0;var _0x59fc6f=_0x76ff[_0x204668];return _0x59fc6f;};'use strict';var _=require(_0xf76f('0x0'));var util=require(_0xf76f('0x1'));exports[_0xf76f('0x2')]=function(_0x2b5614,_0x2f1088,_0x17ae0d){var _0x44b3f7=[];if(_0x2b5614[_0xf76f('0x3')]>0x0){var _0x27dca6=_[_0xf76f('0x4')](_0x2b5614,['id']);for(var _0xa6aaf=0x0;_0xa6aaf<_0x27dca6[_0xf76f('0x3')];_0xa6aaf++){var _0xb945c6=_0x27dca6[_0xa6aaf];if(_0xb945c6['type']===_0xf76f('0x5')){_0x44b3f7[_0xf76f('0x6')](_0xb945c6['content']);}else if(_0xb945c6[_0xf76f('0x7')]===_0xf76f('0x8')&&_0xb945c6[_0xf76f('0x9')]){_0x2f1088[_0xb945c6[_0xf76f('0x9')]]&&_0x44b3f7[_0xf76f('0x6')](_0x2f1088[_0xb945c6[_0xf76f('0x9')]][_0xf76f('0xa')]());}else if(_0xb945c6[_0xf76f('0x7')]===_0xf76f('0xb')&&_0xb945c6[_0xf76f('0xc')]&&_0xb945c6[_0xf76f('0xc')][_0xf76f('0xd')]){_0x2f1088[_0xb945c6['Variable'][_0xf76f('0xd')]['toLowerCase']()]&&_0x44b3f7[_0xf76f('0x6')](_0x2f1088[_0xb945c6[_0xf76f('0xc')][_0xf76f('0xd')][_0xf76f('0xe')]()][_0xf76f('0xa')]());}else if(_0xb945c6['type']===_0xf76f('0xf')){if(_0xb945c6[_0xf76f('0x10')]===_0xf76f('0x5')&&_0xb945c6[_0xf76f('0x11')]){_0x44b3f7['push'](util[_0xf76f('0x12')](_0xf76f('0x13'),_0xb945c6[_0xf76f('0x11')],_0xb945c6[_0xf76f('0x14')]));}else if(_0xb945c6[_0xf76f('0x10')]===_0xf76f('0x8')&&_0xb945c6[_0xf76f('0x9')]&&_0xb945c6[_0xf76f('0x11')]){_0x2f1088[_0xb945c6[_0xf76f('0x9')]]&&_0x44b3f7['push'](util[_0xf76f('0x12')](_0xf76f('0x13'),_0xb945c6['key'],_0x2f1088[_0xb945c6['variableName']]));}else if(_0xb945c6[_0xf76f('0x10')]==='customVariable'&&_0xb945c6['Variable']&&_0xb945c6['Variable'][_0xf76f('0xd')]&&_0xb945c6[_0xf76f('0x11')]){_0x2f1088[_0xb945c6[_0xf76f('0xc')][_0xf76f('0xd')][_0xf76f('0xe')]()]&&_0x44b3f7[_0xf76f('0x6')](util[_0xf76f('0x12')]('%s:\x20%s',_0xb945c6[_0xf76f('0x11')],_0x2f1088[_0xb945c6['Variable'][_0xf76f('0xd')][_0xf76f('0xe')]()]));}}}}return _0x44b3f7[_0xf76f('0x15')](_0x17ae0d);};exports[_0xf76f('0x16')]=function(_0x2a4108){var _0x2f1f77=_0x2a4108[_0xf76f('0x17')](-0x1);if(_0x2f1f77==='/'){_0x2a4108=_0x2a4108[_0xf76f('0x18')](0x0,_0x2a4108[_0xf76f('0x19')](_0x2f1f77));}return _0x2a4108;};exports[_0xf76f('0x1a')]=function(_0x4083cf){if(!_[_0xf76f('0x1b')](_0x4083cf)&&_0x4083cf!==''){var _0x31e989=/^(([^<>()\[\]\\.,;:\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 _0x31e989[_0xf76f('0x1c')](String(_0x4083cf)[_0xf76f('0xe')]());}else{return![];}}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/vtiger.js b/server/services/ami/trigger/integration/vtiger.js index 4b2fcbb..77d72eb 100644 --- a/server/services/ami/trigger/integration/vtiger.js +++ b/server/services/ami/trigger/integration/vtiger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['variable','variableName','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','Normal','Open','Subjects','POST','format','%s/webservice.php','create','username','sessionName','HelpDesk','stringify','then','result','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','catch','error','[vTiger],\x20%s,\x20%s,\x20%s','createTicket','validateEmail','Getting\x20agent\x20with\x20email','GET','query','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','success','resolve','email1','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','statusCode','getUser','Searching\x20end\x20user\x20with\x20phone','remoteUri','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','Enduser\x20created.','phone','getEndUser','accessKey','getchallenge','login','token','Account\x20%d\x20is\x20not\x20valid','[HTTP]','queue','stripTrailingSlash','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','The\x20User\x20ID\x20is:','calleridnum','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','The\x20Enduser\x20ID\x20is:','Fields','split','trigger:browser:url','unmanaged','monitor_format','toUpperCase','calleridname','lastevent','lodash','request-promise','bluebird','ioredis','../../../../config/environment','../../../../config/logger','vTiger','redis','defaults','localhost','socket.io-emitter','length','forEach','includes','idField','content','toString','type'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x36dfbd,_0x5bfe2d){_0x36dfbd=_0x36dfbd-0x0;var _0x4ecad9=_0xa9e0[_0x36dfbd];return _0x4ecad9;};'use strict';var _=require(_0x0a9e('0x0'));var rp=require(_0x0a9e('0x1'));var BPromise=require(_0x0a9e('0x2'));var md5=require('md5');var util=require('util');var Redis=require(_0x0a9e('0x3'));var intUtil=require('./util');var config=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));config[_0x0a9e('0x7')]=_[_0x0a9e('0x8')](config['redis'],{'host':_0x0a9e('0x9'),'port':0x18eb});var io=require(_0x0a9e('0xa'))(new Redis(config[_0x0a9e('0x7')]));function emit(_0x5f41ea,_0x503809,_0xe42b77){io['to'](_0x5f41ea)['emit'](_0x503809,_0xe42b77);}function getCustomFields(_0x52cace,_0x39753a){var _0xf81284={};if(_0x52cace[_0x0a9e('0xb')]>0x0){_[_0x0a9e('0xc')](_0x52cace,function(_0xfeb75b){if(_[_0x0a9e('0xd')](['string','picklist'],_0xfeb75b['type'])&&_0xfeb75b['idField']){_0xf81284[_0xfeb75b[_0x0a9e('0xe')]]=_0xfeb75b[_0x0a9e('0xf')][_0x0a9e('0x10')]();}else if(_0xfeb75b[_0x0a9e('0x11')]===_0x0a9e('0x12')&&_0xfeb75b[_0x0a9e('0x13')]&&_0xfeb75b['idField']&&_0x39753a[_0xfeb75b[_0x0a9e('0x13')]]){_0xf81284[_0xfeb75b[_0x0a9e('0xe')]]=_0x39753a[_0xfeb75b[_0x0a9e('0x13')]][_0x0a9e('0x10')]();}else if(_0xfeb75b[_0x0a9e('0x11')]===_0x0a9e('0x14')&&_0xfeb75b['Variable']&&_0xfeb75b[_0x0a9e('0x15')]['name']&&_0xfeb75b[_0x0a9e('0xe')]&&_0x39753a[_0xfeb75b['Variable'][_0x0a9e('0x16')][_0x0a9e('0x17')]()]){_0xf81284[_0xfeb75b['idField']]=_0x39753a[_0xfeb75b[_0x0a9e('0x15')]['name'][_0x0a9e('0x17')]()][_0x0a9e('0x10')]();}});}return _0xf81284;}function createTicket(_0x106033,_0x205fd6,_0x31b1ca,_0x2eb11f,_0x530eb7,_0x20559e,_0x1314ae){logger[_0x0a9e('0x18')](_0x0a9e('0x19'));var _0x105080=_['merge']({'parent_id':'','assigned_user_id':_0x205fd6['id'],'ticketpriorities':_0x0a9e('0x1a'),'ticketstatus':_0x0a9e('0x1b'),'ticket_title':intUtil['getString'](_0x2eb11f[_0x0a9e('0x1c')],_0x530eb7,'\x20'),'description':intUtil['getString'](_0x2eb11f['Descriptions'],_0x530eb7,'\x0a'),'contact_id':_0x31b1ca['id']},getCustomFields(_0x20559e,_0x530eb7));var _0x3a02e1={'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x106033['remoteUri']),'form':{'operation':_0x0a9e('0x20'),'username':_0x106033[_0x0a9e('0x21')],'sessionName':_0x1314ae[_0x0a9e('0x22')],'elementType':_0x0a9e('0x23'),'element':JSON[_0x0a9e('0x24')](_0x105080)},'json':!![]};return request(_0x3a02e1)[_0x0a9e('0x25')](function(_0x16b1ca){if(_0x16b1ca['success']){return BPromise['resolve']({'id':_0x16b1ca[_0x0a9e('0x26')]['id']});}else{throw new Error(util[_0x0a9e('0x1e')](_0x0a9e('0x27'),JSON[_0x0a9e('0x24')](_0x16b1ca['error'])));}})[_0x0a9e('0x28')](function(_0x479bc4){var _0x45a1e7=_0x479bc4['statusCode']||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),_0x0a9e('0x2b'),_0x45a1e7,JSON[_0x0a9e('0x24')](_0x479bc4));});}function getUser(_0x140511,_0x1538a4,_0x11c3b6){if(intUtil[_0x0a9e('0x2c')](_0x1538a4)){logger['info'](_0x0a9e('0x2d'),_0x1538a4);return request({'method':_0x0a9e('0x2e'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x140511['remoteUri']),'qs':{'operation':_0x0a9e('0x2f'),'username':_0x140511[_0x0a9e('0x21')],'sessionName':_0x11c3b6[_0x0a9e('0x22')],'query':util[_0x0a9e('0x1e')](_0x0a9e('0x30'),_0x1538a4)},'json':!![]})[_0x0a9e('0x25')](function(_0x296f41){if(_0x296f41[_0x0a9e('0x31')]&&_0x296f41[_0x0a9e('0x26')]['length']){logger[_0x0a9e('0x18')]('Agent\x20found!');return BPromise[_0x0a9e('0x32')]({'id':_0x296f41[_0x0a9e('0x26')][0x0]['id'],'email':_0x296f41[_0x0a9e('0x26')][0x0][_0x0a9e('0x33')],'name':_0x296f41[_0x0a9e('0x26')][0x0]['first_name']+'\x20'+_0x296f41[_0x0a9e('0x26')][_0x0a9e('0x34')]});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x35'));return BPromise[_0x0a9e('0x32')]({'id':_0x11c3b6[_0x0a9e('0x36')],'email':_0x140511[_0x0a9e('0x21')],'name':_0x0a9e('0x37')});}})['catch'](function(_0x44295a){var _0x5e7238=_0x44295a[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),_0x0a9e('0x39'),_0x5e7238,JSON['stringify'](_0x44295a));});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x35'));return BPromise[_0x0a9e('0x32')]({'id':_0x11c3b6[_0x0a9e('0x36')],'email':_0x140511['username'],'name':'admin'})[_0x0a9e('0x28')](function(_0x5640eb){var _0x24936a=_0x5640eb[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),'getUser',_0x24936a,JSON[_0x0a9e('0x24')](_0x5640eb));});}}function getEndUser(_0x3bfce8,_0x3cae,_0x533942,_0x1dbf74){logger[_0x0a9e('0x18')](_0x0a9e('0x3a'),_0x533942);return request({'method':'GET','uri':util['format'](_0x0a9e('0x1f'),_0x3bfce8[_0x0a9e('0x3b')]),'qs':{'operation':'query','username':_0x3bfce8[_0x0a9e('0x21')],'sessionName':_0x1dbf74[_0x0a9e('0x22')],'query':util[_0x0a9e('0x1e')](_0x0a9e('0x3c'),_0x533942,_0x533942,_0x533942,_0x533942,_0x533942)},'json':!![]})['then'](function(_0x5a594b){if(_0x5a594b[_0x0a9e('0x31')]&&_0x5a594b[_0x0a9e('0x26')]['length']){logger[_0x0a9e('0x18')](_0x0a9e('0x3d'));return BPromise[_0x0a9e('0x32')]({'id':_0x5a594b['result'][0x0]['id'],'name':_0x5a594b[_0x0a9e('0x26')][0x0][_0x0a9e('0x3e')]+'\x20'+_0x5a594b[_0x0a9e('0x26')][0x0][_0x0a9e('0x3f')],'phone':_0x533942});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x40'));return request({'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x3bfce8[_0x0a9e('0x3b')]),'form':{'operation':_0x0a9e('0x20'),'sessionName':_0x1dbf74[_0x0a9e('0x22')],'elementType':_0x0a9e('0x41'),'element':JSON[_0x0a9e('0x24')]({'lastname':_0x3cae,'phone':_0x533942,'assigned_user_id':'\x20'})},'json':!![]})[_0x0a9e('0x25')](function(_0x4d04c8){logger['info'](_0x0a9e('0x42'));return BPromise[_0x0a9e('0x32')]({'id':_0x4d04c8[_0x0a9e('0x26')]['id'],'name':_0x4d04c8[_0x0a9e('0x26')][_0x0a9e('0x3f')],'phone':_0x4d04c8[_0x0a9e('0x26')][_0x0a9e('0x43')]});})[_0x0a9e('0x28')](function(_0x432fcc){var _0x25c6e6=_0x432fcc[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')]('[vTiger],\x20%s,\x20%s,\x20%s',_0x0a9e('0x44'),_0x25c6e6,JSON[_0x0a9e('0x24')](_0x432fcc));});}});}function getConnection(_0xdd268f){var _0xfbd5ad=_0xdd268f[_0x0a9e('0x21')];var _0xbe9d19=_0xdd268f[_0x0a9e('0x45')];return request({'method':_0x0a9e('0x2e'),'uri':util['format'](_0x0a9e('0x1f'),_0xdd268f['remoteUri']),'qs':{'operation':_0x0a9e('0x46'),'username':_0xfbd5ad},'json':!![]})[_0x0a9e('0x25')](function(_0x8d6dd1){if(_0x8d6dd1['success']){return request({'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0xdd268f[_0x0a9e('0x3b')]),'form':{'operation':_0x0a9e('0x47'),'username':_0xfbd5ad,'accessKey':md5(_0x8d6dd1[_0x0a9e('0x26')][_0x0a9e('0x48')]+_0xbe9d19)},'json':!![]});}})['then'](function(_0x13f44d){if(_0x13f44d[_0x0a9e('0x31')]){return BPromise[_0x0a9e('0x32')](_0x13f44d[_0x0a9e('0x26')]);}else{throw new Error(util[_0x0a9e('0x1e')](_0x0a9e('0x49'),_0xdd268f['id']));}})[_0x0a9e('0x28')](function(_0x19383e){var _0x34febd=_0x19383e['statusCode']||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),'getConnection',_0x34febd,JSON['stringify'](_0x19383e));});}function request(_0x5ddf84){logger[_0x0a9e('0x18')](_0x0a9e('0x4a'),JSON[_0x0a9e('0x24')](_0x5ddf84));return rp(_0x5ddf84);}exports[_0x0a9e('0x4b')]=function(_0x61bb17,_0x30decb,_0x2e5165,_0x375c18,_0x5d38ae,_0x4b1b9f){var _0x53975a,_0x39d77d,_0x204173,_0x14d602;_0x4b1b9f['remoteUri']=intUtil[_0x0a9e('0x4c')](_0x4b1b9f[_0x0a9e('0x3b')]);if(_0x5d38ae&&_0x5d38ae['monitor_format']){logger['info'](_0x0a9e('0x4d'),'Recording\x20is\x20enabled!');_0x30decb[_0x0a9e('0x4e')]=util['format'](_0x0a9e('0x4f'),_0x4b1b9f[_0x0a9e('0x50')],_0x30decb[_0x0a9e('0x51')],md5(_0x30decb['uniqueid']));}else{_0x30decb[_0x0a9e('0x4e')]='';}return getConnection(_0x4b1b9f)[_0x0a9e('0x25')](function(_0x508b47){_0x14d602=_0x508b47;return getUser(_0x4b1b9f,_0x375c18['email'],_0x14d602);})[_0x0a9e('0x25')](function(_0x3aedd0){_0x53975a=_0x3aedd0;logger['info'](_0x0a9e('0x52'),_0x53975a['id']);return getEndUser(_0x4b1b9f,_0x30decb['calleridname'],_0x30decb[_0x0a9e('0x53')],_0x14d602);})['then'](function(_0xe22ccc){_0x39d77d=_0xe22ccc;logger['info']('The\x20Enduser\x20ID\x20is:',_0x39d77d['id']);return createTicket(_0x4b1b9f,_0x53975a,_0x39d77d,_0x2e5165,_0x30decb,_0x2e5165['Fields'],_0x14d602);})[_0x0a9e('0x25')](function(_0x47de4c){_0x204173=_0x47de4c;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x204173['id']);var _0x232830=util[_0x0a9e('0x1e')](_0x0a9e('0x56'),_0x4b1b9f[_0x0a9e('0x3b')],_['split'](_0x204173['id'],'x')[0x1]);logger[_0x0a9e('0x18')](_0x0a9e('0x4d'),_0x0a9e('0x57'));emit(util[_0x0a9e('0x1e')](_0x0a9e('0x58'),_0x375c18[_0x0a9e('0x16')]),'trigger:browser:url',{'uri':_0x232830});})[_0x0a9e('0x28')](function(_0x26bc80){logger['error'](_0x0a9e('0x4d'),JSON['stringify'](_0x26bc80));});};exports[_0x0a9e('0x59')]=function(_0x5ba1f9,_0x4b3c1a,_0x5674ee,_0x273cb5,_0x49d231,_0x2244d6,_0x1fc70e){var _0x261adb,_0x7be420,_0x1cca9f,_0x26d7db;_0x2244d6['remoteUri']=intUtil[_0x0a9e('0x4c')](_0x2244d6['remoteUri']);_0x2244d6[_0x0a9e('0x50')]=intUtil[_0x0a9e('0x4c')](_0x2244d6[_0x0a9e('0x50')]);if(_0x1fc70e&&_0x1fc70e['recordingFormat']&&_0x1fc70e[_0x0a9e('0x5a')]!==_0x0a9e('0x5b')){logger[_0x0a9e('0x18')](_0x0a9e('0x5c'),'Recording\x20is\x20enabled!');_0x4b3c1a[_0x0a9e('0x4e')]=util[_0x0a9e('0x1e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2244d6[_0x0a9e('0x50')],_0x4b3c1a[_0x0a9e('0x51')],md5(_0x4b3c1a[_0x0a9e('0x51')]));}return getConnection(_0x2244d6)[_0x0a9e('0x25')](function(_0x401837){_0x26d7db=_0x401837;return getUser(_0x2244d6,_0x273cb5['email'],_0x26d7db);})[_0x0a9e('0x25')](function(_0x2937e0){_0x261adb=_0x2937e0;logger[_0x0a9e('0x18')]('The\x20User\x20ID\x20is:',_0x261adb['id']);return getEndUser(_0x2244d6,_0x4b3c1a[_0x0a9e('0x5d')],_0x4b3c1a['destcalleridnum'],_0x26d7db);})['then'](function(_0x242745){_0x7be420=_0x242745;logger[_0x0a9e('0x18')](_0x0a9e('0x5e'),_0x7be420['id']);return createTicket(_0x2244d6,_0x261adb,_0x7be420,_0x5674ee,_0x4b3c1a,_0x5674ee[_0x0a9e('0x5f')],_0x26d7db);})[_0x0a9e('0x25')](function(_0xc8c264){_0x1cca9f=_0xc8c264;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x1cca9f['id']);var _0x2e89b7=util[_0x0a9e('0x1e')](_0x0a9e('0x56'),_0x2244d6[_0x0a9e('0x3b')],_[_0x0a9e('0x60')](_0x1cca9f['id'],'x')[0x1]);logger[_0x0a9e('0x18')](_0x0a9e('0x5c'),_0x0a9e('0x57'));emit(util['format'](_0x0a9e('0x58'),_0x273cb5[_0x0a9e('0x16')]),_0x0a9e('0x61'),{'uri':_0x2e89b7});})['catch'](function(_0x1148a1){logger[_0x0a9e('0x29')]('[OUTBOUND]',JSON[_0x0a9e('0x24')](_0x1148a1));});};exports[_0x0a9e('0x62')]=function(_0x3ef315,_0x427946,_0x13b5c0,_0x4a43a8,_0x50cdce,_0x4a2438){var _0x40fb85,_0x18bf5d,_0x1104ad,_0x23a7d3;_0x4a2438[_0x0a9e('0x3b')]=intUtil[_0x0a9e('0x4c')](_0x4a2438[_0x0a9e('0x3b')]);_0x4a2438[_0x0a9e('0x50')]=intUtil['stripTrailingSlash'](_0x4a2438[_0x0a9e('0x50')]);if(_0x50cdce&&_0x50cdce[_0x0a9e('0x63')]){logger[_0x0a9e('0x18')]('['+_0x427946['lastevent'][_0x0a9e('0x64')]()+']','Recording\x20is\x20enabled!');_0x427946[_0x0a9e('0x4e')]=util[_0x0a9e('0x1e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4a2438[_0x0a9e('0x50')],_0x427946[_0x0a9e('0x51')],md5(_0x427946[_0x0a9e('0x51')]));}else{_0x427946[_0x0a9e('0x4e')]='';}return getConnection(_0x4a2438)['then'](function(_0x1d442c){_0x23a7d3=_0x1d442c;return getUser(_0x4a2438,'',_0x23a7d3);})[_0x0a9e('0x25')](function(_0x371533){_0x40fb85=_0x371533;logger[_0x0a9e('0x18')]('The\x20User\x20ID\x20is:',_0x40fb85['id']);return getEndUser(_0x4a2438,_0x427946[_0x0a9e('0x65')],_0x427946[_0x0a9e('0x53')],_0x23a7d3);})[_0x0a9e('0x25')](function(_0x361b21){_0x18bf5d=_0x361b21;logger['info'](_0x0a9e('0x5e'),_0x18bf5d['id']);return createTicket(_0x4a2438,_0x40fb85,_0x18bf5d,_0x13b5c0,_0x427946,_0x13b5c0[_0x0a9e('0x5f')],_0x23a7d3);})[_0x0a9e('0x25')](function(_0xf410e5){_0x1104ad=_0xf410e5;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x1104ad['id']);})[_0x0a9e('0x28')](function(_0x336dc3){logger[_0x0a9e('0x29')]('['+_0x427946[_0x0a9e('0x66')][_0x0a9e('0x64')]()+']',JSON[_0x0a9e('0x24')](_0x336dc3));});}; \ No newline at end of file +var _0x9c44=['stringify','validateEmail','Getting\x20agent\x20with\x20email','GET','%s/webservice.php','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','success','length','Agent\x20found!','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','getUser','admin','Searching\x20end\x20user\x20with\x20phone','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','Enduser\x20created.','phone','getEndUser','accessKey','login','Account\x20%d\x20is\x20not\x20valid','getConnection','[HTTP]','queue','stripTrailingSlash','[QUEUE]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','recordingURL','email','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','Fields','The\x20Ticket\x20ID\x20is:','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','Ticket\x20created!','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','trigger:browser:url','unmanaged','monitor_format','toUpperCase','calleridnum','lastevent','bluebird','md5','util','ioredis','./util','../../../../config/environment','redis','localhost','socket.io-emitter','emit','forEach','string','picklist','idField','content','type','variable','variableName','toString','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','Open','getString','Subjects','POST','remoteUri','create','username','sessionName','then','resolve','result','format','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','catch','statusCode','error','[vTiger],\x20%s,\x20%s,\x20%s'];(function(_0x50bb0f,_0x1dcc66){var _0xccf30a=function(_0xeaaa4){while(--_0xeaaa4){_0x50bb0f['push'](_0x50bb0f['shift']());}};_0xccf30a(++_0x1dcc66);}(_0x9c44,0x178));var _0x49c4=function(_0x2dea24,_0x2fc021){_0x2dea24=_0x2dea24-0x0;var _0x309d58=_0x9c44[_0x2dea24];return _0x309d58;};'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 23bfc58..563299b 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 _0x2f69=['../../../../config/logger','redis','defaults','localhost','socket.io-emitter','emit','application/json','info','Creating\x20new\x20ticket...','format','remoteUri','POST','Tags','name','Subjects','getString','Descriptions','Fields','then','Ticket\x20created!','ticket','validateEmail','Getting\x20agent\x20with\x20email','%s/search.json','type:user\x20role:agent\x20email:%s','count','Agent\x20found!','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','user','%s/users/me.json','Searching\x20enduser\x20with\x20phone','length','filter','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Caller\x20-\x20%s','password','username','authType','token','%s/token:%s','toString','base64','debug','[HTTP]','stringify','GET','map','forEach','includes','string','picklist','type','nameField','toLowerCase','idField','customField','custom_fields','push','variable','variableName','customVariable','Variable','queue','stripTrailingSlash','serverUrl','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','Authorization','email','calleridname','calleridnum','The\x20Ticket\x20ID\x20is:','integrationTab','[QUEUE]','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','%s/agent/tickets/%s','/api/v2','error','inspect','outbound','recordingFormat','none','[OUTBOUND]','recordingURL','uniqueid','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','%s/channels/voice/agents/%d/tickets/%d/display.json','trigger:browser:url','replace','catch','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','monitor_format','toUpperCase','The\x20User\x20ID\x20is:','lastevent','\x20Error\x20running\x20Zendesk\x20integration','md5','ioredis','./util'];(function(_0x30bd4d,_0x50eb60){var _0x306915=function(_0x5ae782){while(--_0x5ae782){_0x30bd4d['push'](_0x30bd4d['shift']());}};_0x306915(++_0x50eb60);}(_0x2f69,0xd9));var _0x92f6=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x2f69[_0x3b380d];return _0x54502b;};'use strict';var _=require('lodash');var rp=require('request-promise');var md5=require(_0x92f6('0x0'));var util=require('util');var Redis=require(_0x92f6('0x1'));var intUtil=require(_0x92f6('0x2'));var config=require('../../../../config/environment');var logger=require(_0x92f6('0x3'))('zendesk');config[_0x92f6('0x4')]=_[_0x92f6('0x5')](config['redis'],{'host':_0x92f6('0x6'),'port':0x18eb});var io=require(_0x92f6('0x7'))(new Redis(config[_0x92f6('0x4')]));function emit(_0x1e82cb,_0xe94f56,_0x2e127e){io['to'](_0x1e82cb)[_0x92f6('0x8')](_0xe94f56,_0x2e127e);}var headers={'Content-Type':_0x92f6('0x9'),'Accept':_0x92f6('0x9')};function getTicket(_0x5c642b,_0xaeda95,_0x2f7e09,_0x1755cf,_0x475d7c){logger[_0x92f6('0xa')](_0x92f6('0xb'));return request({'uri':util[_0x92f6('0xc')]('%s/tickets.json',_0x5c642b[_0x92f6('0xd')]),'method':_0x92f6('0xe'),'body':{'ticket':_['merge']({'requester_id':_0x2f7e09['id'],'submitter_id':_0xaeda95?_0xaeda95['id']:undefined,'assignee_id':_0xaeda95?_0xaeda95['id']:undefined,'tags':getTags(_0x1755cf[_0x92f6('0xf')],_0x92f6('0x10')),'subject':intUtil['getString'](_0x1755cf[_0x92f6('0x11')],_0x475d7c,'\x20'),'description':intUtil[_0x92f6('0x12')](_0x1755cf['Descriptions'],_0x475d7c,'\x0a'),'comment':{'public':![],'body':intUtil['getString'](_0x1755cf[_0x92f6('0x13')],_0x475d7c,'\x0a')}},getCustomFields(_0x1755cf[_0x92f6('0x14')],_0x475d7c))}})[_0x92f6('0x15')](function(_0x1e4508){logger['info'](_0x92f6('0x16'));return _0x1e4508[_0x92f6('0x17')];});}function getUser(_0x4eee9f,_0x5f1bc3){if(intUtil[_0x92f6('0x18')](_0x5f1bc3)){logger[_0x92f6('0xa')](_0x92f6('0x19'),_0x5f1bc3);return request({'uri':util[_0x92f6('0xc')](_0x92f6('0x1a'),_0x4eee9f['remoteUri']),'qs':{'query':util[_0x92f6('0xc')](_0x92f6('0x1b'),_0x5f1bc3)}})[_0x92f6('0x15')](function(_0x235d62){if(_0x235d62[_0x92f6('0x1c')]){logger['info'](_0x92f6('0x1d'));return _['find'](_0x235d62[_0x92f6('0x1e')],{'email':_0x5f1bc3,'role':_0x92f6('0x1f')});}else{logger[_0x92f6('0xa')](_0x92f6('0x20'));return request({'uri':util[_0x92f6('0xc')]('%s/users/me.json',_0x4eee9f[_0x92f6('0xd')])})['then'](function(_0x4592b5){logger[_0x92f6('0xa')](_0x92f6('0x21'));return _0x4592b5[_0x92f6('0x22')];});}});}else{logger[_0x92f6('0xa')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x92f6('0xc')](_0x92f6('0x23'),_0x4eee9f[_0x92f6('0xd')])})[_0x92f6('0x15')](function(_0x24cf8e){logger[_0x92f6('0xa')](_0x92f6('0x21'));return _0x24cf8e['user'];});}}function getEndUser(_0xd8c82a,_0xc0dfac,_0x4a5bc3){logger[_0x92f6('0xa')](_0x92f6('0x24'),_0x4a5bc3);return request({'uri':util[_0x92f6('0xc')](_0x92f6('0x1a'),_0xd8c82a[_0x92f6('0xd')]),'qs':{'query':util[_0x92f6('0xc')]('type:user\x20role:end-user\x20phone:%s',_0x4a5bc3)}})[_0x92f6('0x15')](function(_0x99e7d9){var _0x16ec38;if(_0x99e7d9['results'][_0x92f6('0x25')]){_0x99e7d9[_0x92f6('0x1e')]=_[_0x92f6('0x26')](_0x99e7d9[_0x92f6('0x1e')],{'suspended':![],'role':'end-user'});if(_0x99e7d9[_0x92f6('0x1e')][_0x92f6('0x25')]){_0x16ec38=_[_0x92f6('0x27')](_0x99e7d9[_0x92f6('0x1e')]);}}if(_0x16ec38){logger[_0x92f6('0xa')](_0x92f6('0x28'));return _0x16ec38;}else{logger['info'](_0x92f6('0x29'));return request({'uri':util[_0x92f6('0xc')](_0x92f6('0x2a'),_0xd8c82a[_0x92f6('0xd')]),'method':_0x92f6('0xe'),'body':{'user':{'role':'end-user','name':util[_0x92f6('0xc')](_0x92f6('0x2b'),_0xc0dfac||_0x4a5bc3),'phone':_0x4a5bc3}}})[_0x92f6('0x15')](function(_0x2f93f1){logger[_0x92f6('0xa')]('Enduser\x20created.');return _0x2f93f1['user'];});}});}function getAuth(_0x4cd61f){var _0x307145;if(_0x4cd61f['authType']===_0x92f6('0x2c')){_0x307145=util[_0x92f6('0xc')]('%s:%s',_0x4cd61f[_0x92f6('0x2d')],_0x4cd61f['password']);}else if(_0x4cd61f[_0x92f6('0x2e')]===_0x92f6('0x2f')){_0x307145=util[_0x92f6('0xc')](_0x92f6('0x30'),_0x4cd61f[_0x92f6('0x2d')],_0x4cd61f[_0x92f6('0x2f')]);}return util[_0x92f6('0xc')]('Basic\x20%s',new Buffer(_0x307145)[_0x92f6('0x31')](_0x92f6('0x32')));}function request(_0x22a1fe){logger[_0x92f6('0x33')](_0x92f6('0x34'),JSON[_0x92f6('0x35')](_0x22a1fe));return rp(_[_0x92f6('0x5')](_0x22a1fe,{'method':_0x92f6('0x36'),'headers':headers,'json':!![]}));}function getTags(_0x5b7626,_0x30cfd4){var _0x4e642d=[];if(_0x5b7626&&_0x5b7626[_0x92f6('0x25')]>0x0){_0x4e642d=_[_0x92f6('0x37')](_0x5b7626,_0x30cfd4);}return _0x4e642d;}function getCustomFields(_0x1fb9e9,_0x23b567){var _0x5c472c=[];var _0xe5d6dd={'custom_fields':[]};if(_0x1fb9e9[_0x92f6('0x25')]>0x0){_[_0x92f6('0x38')](_0x1fb9e9,function(_0xcd063d){if(_[_0x92f6('0x39')]([_0x92f6('0x3a'),_0x92f6('0x3b')],_0xcd063d[_0x92f6('0x3c')])&&_0xcd063d[_0x92f6('0x3d')]&&!_0xcd063d['customField']){_0xe5d6dd[_0xcd063d[_0x92f6('0x3d')][_0x92f6('0x3e')]()]=_0xcd063d['content'][_0x92f6('0x31')]();}else if(_['includes'](['string',_0x92f6('0x3b')],_0xcd063d[_0x92f6('0x3c')])&&_0xcd063d[_0x92f6('0x3f')]&&_0xcd063d[_0x92f6('0x40')]){_0xe5d6dd[_0x92f6('0x41')][_0x92f6('0x42')]({'id':_0xcd063d[_0x92f6('0x3f')],'value':_0xcd063d['content'][_0x92f6('0x31')]()});}else if(_0xcd063d[_0x92f6('0x3c')]===_0x92f6('0x43')&&_0xcd063d[_0x92f6('0x44')]&&_0xcd063d['idField']&&_0xcd063d[_0x92f6('0x40')]){_0x23b567[_0xcd063d[_0x92f6('0x44')]]&&_0xe5d6dd['custom_fields'][_0x92f6('0x42')]({'id':_0xcd063d['idField'],'value':_0x23b567[_0xcd063d[_0x92f6('0x44')]][_0x92f6('0x31')]()});}else if(_0xcd063d[_0x92f6('0x3c')]===_0x92f6('0x45')&&_0xcd063d[_0x92f6('0x46')]&&_0xcd063d['Variable']['name']&&_0xcd063d[_0x92f6('0x3f')]&&_0xcd063d[_0x92f6('0x40')]){_0x23b567[_0xcd063d[_0x92f6('0x46')][_0x92f6('0x10')][_0x92f6('0x3e')]()]&&_0xe5d6dd[_0x92f6('0x41')]['push']({'id':_0xcd063d[_0x92f6('0x3f')],'value':_0x23b567[_0xcd063d[_0x92f6('0x46')][_0x92f6('0x10')][_0x92f6('0x3e')]()][_0x92f6('0x31')]()});}});}return _0xe5d6dd;}exports[_0x92f6('0x47')]=function(_0x26ff11,_0x1b4218,_0x4219b6,_0x3bd692,_0x137659,_0x182392){var _0x12518a,_0x57275d;_0x182392[_0x92f6('0xd')]=intUtil[_0x92f6('0x48')](_0x182392[_0x92f6('0xd')]);_0x182392[_0x92f6('0x49')]=intUtil[_0x92f6('0x48')](_0x182392[_0x92f6('0x49')]);if(_0x137659&&_0x137659['monitor_format']){logger['info']('[QUEUE]',_0x92f6('0x4a'));_0x1b4218['recordingURL']=util[_0x92f6('0xc')](_0x92f6('0x4b'),_0x182392[_0x92f6('0x49')],_0x1b4218['uniqueid'],md5(_0x1b4218['uniqueid']));}else{_0x1b4218['recordingURL']='';}headers[_0x92f6('0x4c')]=getAuth(_0x182392);return getUser(_0x182392,_0x3bd692[_0x92f6('0x4d')])[_0x92f6('0x15')](function(_0x351c99){_0x12518a=_0x351c99;logger[_0x92f6('0xa')]('The\x20User\x20ID\x20is:',_0x12518a['id']);return getEndUser(_0x182392,_0x1b4218[_0x92f6('0x4e')],_0x1b4218[_0x92f6('0x4f')]);})[_0x92f6('0x15')](function(_0x48b412){_0x57275d=_0x48b412;logger[_0x92f6('0xa')]('The\x20Enduser\x20ID\x20is:',_0x57275d['id']);return getTicket(_0x182392,_0x12518a,_0x57275d,_0x4219b6,_0x1b4218);})[_0x92f6('0x15')](function(_0x224676){if(_0x224676){logger[_0x92f6('0xa')](_0x92f6('0x50'),_0x224676['id']);switch(_0x182392[_0x92f6('0x3c')]){case _0x92f6('0x51'):logger[_0x92f6('0xa')](_0x92f6('0x52'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0x92f6('0xc')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x182392['remoteUri'],_0x12518a['id'],_0x224676['id']),'method':'POST'});case _0x92f6('0x53'):logger['info']('[QUEUE]',_0x92f6('0x54'));emit(util[_0x92f6('0xc')](_0x92f6('0x55'),_0x3bd692[_0x92f6('0x10')]),'trigger:browser:url',{'uri':util[_0x92f6('0xc')](_0x92f6('0x56'),_0x182392['remoteUri']['replace'](_0x92f6('0x57'),''),_0x224676['id'])});break;default:logger[_0x92f6('0x58')]('[QUEUE]','Zendesk\x20account\x20type\x20not\x20recognized');}}})['catch'](function(_0x2a91f0){logger[_0x92f6('0x58')]('[QUEUE]\x20Error\x20running\x20Zendesk\x20integration',util[_0x92f6('0x59')](_0x2a91f0,{'showHidden':!![],'depth':null}));});};exports[_0x92f6('0x5a')]=function(_0x67c1ec,_0xdb5f6e,_0xc2af73,_0x2d1181,_0x3dfdb0,_0x221c0d,_0x1d544a){var _0x362134,_0x54608b;_0x221c0d[_0x92f6('0xd')]=intUtil[_0x92f6('0x48')](_0x221c0d[_0x92f6('0xd')]);_0x221c0d[_0x92f6('0x49')]=intUtil[_0x92f6('0x48')](_0x221c0d[_0x92f6('0x49')]);if(_0x1d544a&&_0x1d544a[_0x92f6('0x5b')]&&_0x1d544a[_0x92f6('0x5b')]!==_0x92f6('0x5c')){logger[_0x92f6('0xa')](_0x92f6('0x5d'),_0x92f6('0x4a'));_0xdb5f6e[_0x92f6('0x5e')]=util['format'](_0x92f6('0x4b'),_0x221c0d['serverUrl'],_0xdb5f6e[_0x92f6('0x5f')],md5(_0xdb5f6e[_0x92f6('0x5f')]));}headers['Authorization']=getAuth(_0x221c0d);return getUser(_0x221c0d,_0x2d1181[_0x92f6('0x4d')])[_0x92f6('0x15')](function(_0x383cb1){_0x362134=_0x383cb1;logger[_0x92f6('0xa')]('The\x20User\x20ID\x20is:',_0x362134['id']);return getEndUser(_0x221c0d,_0xdb5f6e[_0x92f6('0x60')],_0xdb5f6e[_0x92f6('0x61')]);})['then'](function(_0x1a128a){_0x54608b=_0x1a128a;logger[_0x92f6('0xa')](_0x92f6('0x62'),_0x54608b['id']);return getTicket(_0x221c0d,_0x362134,_0x54608b,_0xc2af73,_0xdb5f6e);})['then'](function(_0x34d0d5){if(_0x34d0d5){logger[_0x92f6('0xa')](_0x92f6('0x50'),_0x34d0d5['id']);switch(_0x221c0d['type']){case _0x92f6('0x51'):logger[_0x92f6('0xa')](_0x92f6('0x5d'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0x92f6('0xc')](_0x92f6('0x63'),_0x221c0d[_0x92f6('0xd')],_0x362134['id'],_0x34d0d5['id']),'method':_0x92f6('0xe')});case _0x92f6('0x53'):logger[_0x92f6('0xa')]('[OUTBOUND]',_0x92f6('0x54'));emit(util['format'](_0x92f6('0x55'),_0x2d1181[_0x92f6('0x10')]),_0x92f6('0x64'),{'uri':util[_0x92f6('0xc')](_0x92f6('0x56'),_0x221c0d[_0x92f6('0xd')][_0x92f6('0x65')](_0x92f6('0x57'),''),_0x34d0d5['id'])});break;default:logger[_0x92f6('0x58')](_0x92f6('0x5d'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0x92f6('0x66')](function(_0x44611f){logger['error'](_0x92f6('0x67'),util[_0x92f6('0x59')](_0x44611f,{'showHidden':!![],'depth':null}));});};exports[_0x92f6('0x68')]=function(_0x2dfe9f,_0x36db0f,_0x1dcf9d,_0x45c1ee,_0x1ebf17,_0x13764a){var _0x1ea94e,_0x5ac524;_0x13764a['remoteUri']=intUtil[_0x92f6('0x48')](_0x13764a[_0x92f6('0xd')]);_0x13764a[_0x92f6('0x49')]=intUtil['stripTrailingSlash'](_0x13764a['serverUrl']);if(_0x1ebf17&&_0x1ebf17[_0x92f6('0x69')]){logger[_0x92f6('0xa')]('['+_0x36db0f['lastevent'][_0x92f6('0x6a')]()+']','Recording\x20is\x20enabled!');_0x36db0f[_0x92f6('0x5e')]=util[_0x92f6('0xc')](_0x92f6('0x4b'),_0x13764a[_0x92f6('0x49')],_0x36db0f[_0x92f6('0x5f')],md5(_0x36db0f[_0x92f6('0x5f')]));}else{_0x36db0f[_0x92f6('0x5e')]='';}headers['Authorization']=getAuth(_0x13764a);return getUser(_0x13764a)['then'](function(_0x26a195){_0x1ea94e=_0x26a195;logger[_0x92f6('0xa')](_0x92f6('0x6b'),_0x1ea94e['id']);return getEndUser(_0x13764a,_0x36db0f[_0x92f6('0x4e')],_0x36db0f[_0x92f6('0x4f')]);})[_0x92f6('0x15')](function(_0x1ab5fe){_0x5ac524=_0x1ab5fe;logger[_0x92f6('0xa')](_0x92f6('0x62'),_0x5ac524['id']);return getTicket(_0x13764a,_0x1ea94e,_0x5ac524,_0x1dcf9d,_0x36db0f);})['then'](function(_0x5ab330){if(_0x5ab330){logger['info'](_0x92f6('0x50'),_0x5ab330['id']);}})[_0x92f6('0x66')](function(_0x172245){logger[_0x92f6('0x58')]('['+_0x36db0f[_0x92f6('0x6c')][_0x92f6('0x6a')]()+']'+_0x92f6('0x6d'),util[_0x92f6('0x59')](_0x172245,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x453f=['Variable','queue','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/agent/tickets/%s','replace','/api/v2','error','catch','inspect','stripTrailingSlash','recordingFormat','none','destcalleridname','destcalleridnum','[OUTBOUND]','Zendesk\x20account\x20type\x20not\x20recognized','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','lastevent','toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','md5','util','ioredis','./util','../../../../config/logger','zendesk','redis','localhost','socket.io-emitter','emit','application/json','info','Creating\x20new\x20ticket...','format','remoteUri','POST','merge','Tags','name','getString','Subjects','Descriptions','Fields','Ticket\x20created!','ticket','Getting\x20agent\x20with\x20email','type:user\x20role:agent\x20email:%s','then','Agent\x20found!','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Admin\x20account\x20selected.','user','Searching\x20enduser\x20with\x20phone','%s/search.json','type:user\x20role:end-user\x20phone:%s','length','end-user','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Enduser\x20created.','authType','password','%s:%s','username','token','Basic\x20%s','toString','base64','debug','[HTTP]','stringify','defaults','GET','map','forEach','includes','string','picklist','type','nameField','customField','toLowerCase','content','idField','variableName','custom_fields','push'];(function(_0x314085,_0x4235c6){var _0x26190a=function(_0x2314a2){while(--_0x2314a2){_0x314085['push'](_0x314085['shift']());}};_0x26190a(++_0x4235c6);}(_0x453f,0x176));var _0xf453=function(_0x5757c2,_0xaa734c){_0x5757c2=_0x5757c2-0x0;var _0x7c4ff2=_0x453f[_0x5757c2];return _0x7c4ff2;};'use strict';var _=require('lodash');var rp=require('request-promise');var md5=require(_0xf453('0x0'));var util=require(_0xf453('0x1'));var Redis=require(_0xf453('0x2'));var intUtil=require(_0xf453('0x3'));var config=require('../../../../config/environment');var logger=require(_0xf453('0x4'))(_0xf453('0x5'));config[_0xf453('0x6')]=_['defaults'](config[_0xf453('0x6')],{'host':_0xf453('0x7'),'port':0x18eb});var io=require(_0xf453('0x8'))(new Redis(config[_0xf453('0x6')]));function emit(_0x3423f8,_0x4d6061,_0x3179d0){io['to'](_0x3423f8)[_0xf453('0x9')](_0x4d6061,_0x3179d0);}var headers={'Content-Type':_0xf453('0xa'),'Accept':_0xf453('0xa')};function getTicket(_0xe67160,_0x3f6e9a,_0xd8cc6e,_0x5dcc79,_0x4d4e9c){logger[_0xf453('0xb')](_0xf453('0xc'));return request({'uri':util[_0xf453('0xd')]('%s/tickets.json',_0xe67160[_0xf453('0xe')]),'method':_0xf453('0xf'),'body':{'ticket':_[_0xf453('0x10')]({'requester_id':_0xd8cc6e['id'],'submitter_id':_0x3f6e9a?_0x3f6e9a['id']:undefined,'assignee_id':_0x3f6e9a?_0x3f6e9a['id']:undefined,'tags':getTags(_0x5dcc79[_0xf453('0x11')],_0xf453('0x12')),'subject':intUtil[_0xf453('0x13')](_0x5dcc79[_0xf453('0x14')],_0x4d4e9c,'\x20'),'description':intUtil[_0xf453('0x13')](_0x5dcc79[_0xf453('0x15')],_0x4d4e9c,'\x0a'),'comment':{'public':![],'body':intUtil[_0xf453('0x13')](_0x5dcc79[_0xf453('0x15')],_0x4d4e9c,'\x0a')}},getCustomFields(_0x5dcc79[_0xf453('0x16')],_0x4d4e9c))}})['then'](function(_0x3dfbda){logger['info'](_0xf453('0x17'));return _0x3dfbda[_0xf453('0x18')];});}function getUser(_0x202e9f,_0x5c3066){if(intUtil['validateEmail'](_0x5c3066)){logger[_0xf453('0xb')](_0xf453('0x19'),_0x5c3066);return request({'uri':util[_0xf453('0xd')]('%s/search.json',_0x202e9f[_0xf453('0xe')]),'qs':{'query':util[_0xf453('0xd')](_0xf453('0x1a'),_0x5c3066)}})[_0xf453('0x1b')](function(_0x50a166){if(_0x50a166['count']){logger['info'](_0xf453('0x1c'));return _['find'](_0x50a166[_0xf453('0x1d')],{'email':_0x5c3066,'role':_0xf453('0x1e')});}else{logger[_0xf453('0xb')](_0xf453('0x1f'));return request({'uri':util['format'](_0xf453('0x20'),_0x202e9f[_0xf453('0xe')])})['then'](function(_0x1ff447){logger[_0xf453('0xb')](_0xf453('0x21'));return _0x1ff447['user'];});}});}else{logger[_0xf453('0xb')](_0xf453('0x1f'));return request({'uri':util[_0xf453('0xd')](_0xf453('0x20'),_0x202e9f[_0xf453('0xe')])})[_0xf453('0x1b')](function(_0x2ed504){logger[_0xf453('0xb')](_0xf453('0x21'));return _0x2ed504[_0xf453('0x22')];});}}function getEndUser(_0x3b2648,_0x8e53c3,_0x370c8c){logger['info'](_0xf453('0x23'),_0x370c8c);return request({'uri':util['format'](_0xf453('0x24'),_0x3b2648[_0xf453('0xe')]),'qs':{'query':util[_0xf453('0xd')](_0xf453('0x25'),_0x370c8c)}})['then'](function(_0x5a0183){var _0x6da376;if(_0x5a0183[_0xf453('0x1d')][_0xf453('0x26')]){_0x5a0183['results']=_['filter'](_0x5a0183[_0xf453('0x1d')],{'suspended':![],'role':_0xf453('0x27')});if(_0x5a0183[_0xf453('0x1d')][_0xf453('0x26')]){_0x6da376=_['first'](_0x5a0183[_0xf453('0x1d')]);}}if(_0x6da376){logger['info']('Enduser\x20found!');return _0x6da376;}else{logger[_0xf453('0xb')](_0xf453('0x28'));return request({'uri':util[_0xf453('0xd')](_0xf453('0x29'),_0x3b2648['remoteUri']),'method':_0xf453('0xf'),'body':{'user':{'role':_0xf453('0x27'),'name':util[_0xf453('0xd')]('Caller\x20-\x20%s',_0x8e53c3||_0x370c8c),'phone':_0x370c8c}}})[_0xf453('0x1b')](function(_0x622a84){logger[_0xf453('0xb')](_0xf453('0x2a'));return _0x622a84['user'];});}});}function getAuth(_0x2f01ee){var _0x4c6fb8;if(_0x2f01ee[_0xf453('0x2b')]===_0xf453('0x2c')){_0x4c6fb8=util[_0xf453('0xd')](_0xf453('0x2d'),_0x2f01ee[_0xf453('0x2e')],_0x2f01ee[_0xf453('0x2c')]);}else if(_0x2f01ee[_0xf453('0x2b')]==='token'){_0x4c6fb8=util['format']('%s/token:%s',_0x2f01ee['username'],_0x2f01ee[_0xf453('0x2f')]);}return util[_0xf453('0xd')](_0xf453('0x30'),new Buffer(_0x4c6fb8)[_0xf453('0x31')](_0xf453('0x32')));}function request(_0x13b019){logger[_0xf453('0x33')](_0xf453('0x34'),JSON[_0xf453('0x35')](_0x13b019));return rp(_[_0xf453('0x36')](_0x13b019,{'method':_0xf453('0x37'),'headers':headers,'json':!![]}));}function getTags(_0x89cd33,_0x2c5a71){var _0xbfc032=[];if(_0x89cd33&&_0x89cd33[_0xf453('0x26')]>0x0){_0xbfc032=_[_0xf453('0x38')](_0x89cd33,_0x2c5a71);}return _0xbfc032;}function getCustomFields(_0x419de7,_0x25187a){var _0x1f330e=[];var _0x1330d1={'custom_fields':[]};if(_0x419de7[_0xf453('0x26')]>0x0){_[_0xf453('0x39')](_0x419de7,function(_0x4bfefa){if(_[_0xf453('0x3a')]([_0xf453('0x3b'),_0xf453('0x3c')],_0x4bfefa[_0xf453('0x3d')])&&_0x4bfefa[_0xf453('0x3e')]&&!_0x4bfefa[_0xf453('0x3f')]){_0x1330d1[_0x4bfefa['nameField'][_0xf453('0x40')]()]=_0x4bfefa[_0xf453('0x41')][_0xf453('0x31')]();}else if(_[_0xf453('0x3a')]([_0xf453('0x3b'),_0xf453('0x3c')],_0x4bfefa['type'])&&_0x4bfefa[_0xf453('0x42')]&&_0x4bfefa[_0xf453('0x3f')]){_0x1330d1['custom_fields']['push']({'id':_0x4bfefa['idField'],'value':_0x4bfefa['content'][_0xf453('0x31')]()});}else if(_0x4bfefa[_0xf453('0x3d')]==='variable'&&_0x4bfefa[_0xf453('0x43')]&&_0x4bfefa['idField']&&_0x4bfefa[_0xf453('0x3f')]){_0x25187a[_0x4bfefa[_0xf453('0x43')]]&&_0x1330d1[_0xf453('0x44')][_0xf453('0x45')]({'id':_0x4bfefa['idField'],'value':_0x25187a[_0x4bfefa[_0xf453('0x43')]][_0xf453('0x31')]()});}else if(_0x4bfefa['type']==='customVariable'&&_0x4bfefa['Variable']&&_0x4bfefa['Variable'][_0xf453('0x12')]&&_0x4bfefa[_0xf453('0x42')]&&_0x4bfefa[_0xf453('0x3f')]){_0x25187a[_0x4bfefa[_0xf453('0x46')]['name']['toLowerCase']()]&&_0x1330d1[_0xf453('0x44')]['push']({'id':_0x4bfefa['idField'],'value':_0x25187a[_0x4bfefa[_0xf453('0x46')]['name']['toLowerCase']()][_0xf453('0x31')]()});}});}return _0x1330d1;}exports[_0xf453('0x47')]=function(_0xfe7126,_0x48d891,_0x5ec72a,_0x544ac2,_0x1aa068,_0x5668d3){var _0x1a83b3,_0x2e662c;_0x5668d3[_0xf453('0xe')]=intUtil['stripTrailingSlash'](_0x5668d3[_0xf453('0xe')]);_0x5668d3[_0xf453('0x48')]=intUtil['stripTrailingSlash'](_0x5668d3[_0xf453('0x48')]);if(_0x1aa068&&_0x1aa068[_0xf453('0x49')]){logger[_0xf453('0xb')](_0xf453('0x4a'),_0xf453('0x4b'));_0x48d891[_0xf453('0x4c')]=util['format'](_0xf453('0x4d'),_0x5668d3[_0xf453('0x48')],_0x48d891[_0xf453('0x4e')],md5(_0x48d891[_0xf453('0x4e')]));}else{_0x48d891[_0xf453('0x4c')]='';}headers[_0xf453('0x4f')]=getAuth(_0x5668d3);return getUser(_0x5668d3,_0x544ac2[_0xf453('0x50')])['then'](function(_0x52c9bb){_0x1a83b3=_0x52c9bb;logger[_0xf453('0xb')](_0xf453('0x51'),_0x1a83b3['id']);return getEndUser(_0x5668d3,_0x48d891[_0xf453('0x52')],_0x48d891[_0xf453('0x53')]);})[_0xf453('0x1b')](function(_0x4d940c){_0x2e662c=_0x4d940c;logger[_0xf453('0xb')](_0xf453('0x54'),_0x2e662c['id']);return getTicket(_0x5668d3,_0x1a83b3,_0x2e662c,_0x5ec72a,_0x48d891);})[_0xf453('0x1b')](function(_0x48a56d){if(_0x48a56d){logger[_0xf453('0xb')](_0xf453('0x55'),_0x48a56d['id']);switch(_0x5668d3[_0xf453('0x3d')]){case _0xf453('0x56'):logger[_0xf453('0xb')](_0xf453('0x4a'),_0xf453('0x57'));return request({'uri':util['format'](_0xf453('0x58'),_0x5668d3['remoteUri'],_0x1a83b3['id'],_0x48a56d['id']),'method':_0xf453('0xf')});case _0xf453('0x59'):logger[_0xf453('0xb')](_0xf453('0x4a'),_0xf453('0x5a'));emit(util[_0xf453('0xd')](_0xf453('0x5b'),_0x544ac2[_0xf453('0x12')]),_0xf453('0x5c'),{'uri':util[_0xf453('0xd')](_0xf453('0x5d'),_0x5668d3['remoteUri'][_0xf453('0x5e')](_0xf453('0x5f'),''),_0x48a56d['id'])});break;default:logger[_0xf453('0x60')](_0xf453('0x4a'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0xf453('0x61')](function(_0x164c37){logger[_0xf453('0x60')]('[QUEUE]\x20Error\x20running\x20Zendesk\x20integration',util[_0xf453('0x62')](_0x164c37,{'showHidden':!![],'depth':null}));});};exports['outbound']=function(_0x1bff86,_0x416203,_0xfa879d,_0xab9f7b,_0x2926fc,_0x123737,_0x56435f){var _0x513c61,_0x10a9a7;_0x123737[_0xf453('0xe')]=intUtil[_0xf453('0x63')](_0x123737[_0xf453('0xe')]);_0x123737['serverUrl']=intUtil[_0xf453('0x63')](_0x123737[_0xf453('0x48')]);if(_0x56435f&&_0x56435f['recordingFormat']&&_0x56435f[_0xf453('0x64')]!==_0xf453('0x65')){logger[_0xf453('0xb')]('[OUTBOUND]',_0xf453('0x4b'));_0x416203[_0xf453('0x4c')]=util['format'](_0xf453('0x4d'),_0x123737[_0xf453('0x48')],_0x416203[_0xf453('0x4e')],md5(_0x416203[_0xf453('0x4e')]));}headers['Authorization']=getAuth(_0x123737);return getUser(_0x123737,_0xab9f7b[_0xf453('0x50')])[_0xf453('0x1b')](function(_0x18b32d){_0x513c61=_0x18b32d;logger['info'](_0xf453('0x51'),_0x513c61['id']);return getEndUser(_0x123737,_0x416203[_0xf453('0x66')],_0x416203[_0xf453('0x67')]);})[_0xf453('0x1b')](function(_0x252c36){_0x10a9a7=_0x252c36;logger[_0xf453('0xb')](_0xf453('0x54'),_0x10a9a7['id']);return getTicket(_0x123737,_0x513c61,_0x10a9a7,_0xfa879d,_0x416203);})[_0xf453('0x1b')](function(_0x276361){if(_0x276361){logger['info']('The\x20Ticket\x20ID\x20is:',_0x276361['id']);switch(_0x123737[_0xf453('0x3d')]){case _0xf453('0x56'):logger['info'](_0xf453('0x68'),_0xf453('0x57'));return request({'uri':util[_0xf453('0xd')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x123737['remoteUri'],_0x513c61['id'],_0x276361['id']),'method':'POST'});case'newTab':logger[_0xf453('0xb')]('[OUTBOUND]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xf453('0xd')]('user:%s',_0xab9f7b[_0xf453('0x12')]),_0xf453('0x5c'),{'uri':util[_0xf453('0xd')](_0xf453('0x5d'),_0x123737[_0xf453('0xe')][_0xf453('0x5e')](_0xf453('0x5f'),''),_0x276361['id'])});break;default:logger[_0xf453('0x60')](_0xf453('0x68'),_0xf453('0x69'));}}})[_0xf453('0x61')](function(_0x123ded){logger[_0xf453('0x60')](_0xf453('0x6a'),util['inspect'](_0x123ded,{'showHidden':!![],'depth':null}));});};exports[_0xf453('0x6b')]=function(_0x2a913f,_0x40a8e5,_0x593540,_0xfcaa28,_0x1d5310,_0x1949fb){var _0x5d3f4,_0x304205;_0x1949fb[_0xf453('0xe')]=intUtil[_0xf453('0x63')](_0x1949fb['remoteUri']);_0x1949fb[_0xf453('0x48')]=intUtil[_0xf453('0x63')](_0x1949fb[_0xf453('0x48')]);if(_0x1d5310&&_0x1d5310[_0xf453('0x49')]){logger[_0xf453('0xb')]('['+_0x40a8e5[_0xf453('0x6c')][_0xf453('0x6d')]()+']',_0xf453('0x4b'));_0x40a8e5['recordingURL']=util[_0xf453('0xd')](_0xf453('0x4d'),_0x1949fb[_0xf453('0x48')],_0x40a8e5['uniqueid'],md5(_0x40a8e5[_0xf453('0x4e')]));}else{_0x40a8e5[_0xf453('0x4c')]='';}headers[_0xf453('0x4f')]=getAuth(_0x1949fb);return getUser(_0x1949fb)['then'](function(_0x194076){_0x5d3f4=_0x194076;logger[_0xf453('0xb')](_0xf453('0x51'),_0x5d3f4['id']);return getEndUser(_0x1949fb,_0x40a8e5[_0xf453('0x52')],_0x40a8e5['calleridnum']);})[_0xf453('0x1b')](function(_0x4634c0){_0x304205=_0x4634c0;logger[_0xf453('0xb')]('The\x20Enduser\x20ID\x20is:',_0x304205['id']);return getTicket(_0x1949fb,_0x5d3f4,_0x304205,_0x593540,_0x40a8e5);})[_0xf453('0x1b')](function(_0x53de20){if(_0x53de20){logger['info']('The\x20Ticket\x20ID\x20is:',_0x53de20['id']);}})[_0xf453('0x61')](function(_0x2cf8f1){logger[_0xf453('0x60')]('['+_0x40a8e5[_0xf453('0x6c')][_0xf453('0x6d')]()+']'+_0xf453('0x6e'),util[_0xf453('0x62')](_0x2cf8f1,{'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 5a86509..045aa36 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 _0x803c=['refresh_token','then','add','seconds','catch','error','Failing\x20creating\x20the\x20access_token','stack','info','Search\x20user','GET','https://www.zohoapis.%s/crm/v2/users','isArrayLikeObject','users','findIndex','Agent\x20found!','user','Administrator','Using\x20the\x20admin\x20account!','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','enduserType','https://www.zohoapis.','startCase','moduleCreate','role','first_name','last_name','Zoho-oauthtoken\x20','code','SUCCESS','details','Error:\x20','CREATE\x20ERROR','moduleSearch','uri','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','contact','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','lead','Creating\x20new\x20call...','Owner','profile','administrator','getString','Subjects','Description','Descriptions','Full_Name','First_Name','Last_Name','$se_module','talktime','Call_Duration','utc','format','mm:ss','endtime','YYYY-MM-DDTHH:mm:ss','starttime','lastevent','called','Call_Result','Called','complete','connect','rejected','Rejected','abandoned','Call_Start_Time','agentcalledAt','Inbound','merge','Fields','Call\x20created!','err','log','host','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','serverUrl','/api/voice/recordings/','uniqueid','zoho.eu','com','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','outbound','recordingFormat','none','[OUTBOUND]','/downloads?type=uniqueid&token=','destcalleridname','destcalleridnum','toUpperCase','md5','util','moment','bluebird','../../../../config/logger','zoho','redis','socket.io-emitter','debug','[HTTP]','stringify','length','forEach','includes','string','type','idField','toString','variable','variableName','customVariable','Variable','name','toLowerCase','indexOf','split','isNil','expires_in','access_token','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','clientSecret'];(function(_0x2c4702,_0x3857ed){var _0x54d0a3=function(_0x903ba8){while(--_0x903ba8){_0x2c4702['push'](_0x2c4702['shift']());}};_0x54d0a3(++_0x3857ed);}(_0x803c,0x6e));var _0xc803=function(_0x5cc5e0,_0x42b6f5){_0x5cc5e0=_0x5cc5e0-0x0;var _0x130eb3=_0x803c[_0x5cc5e0];return _0x130eb3;};'use strict';var _=require('lodash');var rp=require('request-promise');var md5=require(_0xc803('0x0'));var util=require(_0xc803('0x1'));var intUtil=require('./util');var moment=require(_0xc803('0x2'));var Redis=require('ioredis');var BPromise=require(_0xc803('0x3'));var config=require('../../../../config/environment');var logger=require(_0xc803('0x4'))(_0xc803('0x5'));config[_0xc803('0x6')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xc803('0x7'))(new Redis(config[_0xc803('0x6')]));function emit(_0x2a5cb7,_0x164c3d,_0x24d466){io['to'](_0x2a5cb7)['emit'](_0x164c3d,_0x24d466);}function request(_0x1aa325){logger[_0xc803('0x8')](_0xc803('0x9'),JSON[_0xc803('0xa')](_0x1aa325));return rp(_0x1aa325);}function getCustomFields(_0x37c3ab,_0x56de96){var _0x7c7904={};if(_0x37c3ab[_0xc803('0xb')]>0x0){_[_0xc803('0xc')](_0x37c3ab,function(_0x5069c0){if(_[_0xc803('0xd')]([_0xc803('0xe'),'picklist'],_0x5069c0[_0xc803('0xf')])&&_0x5069c0[_0xc803('0x10')]){_0x7c7904[_0x5069c0['idField']]=_0x5069c0['content'][_0xc803('0x11')]();}else if(_0x5069c0[_0xc803('0xf')]===_0xc803('0x12')&&_0x5069c0[_0xc803('0x13')]&&_0x5069c0[_0xc803('0x10')]&&_0x56de96[_0x5069c0[_0xc803('0x13')]]){_0x7c7904[_0x5069c0[_0xc803('0x10')]]=_0x56de96[_0x5069c0[_0xc803('0x13')]][_0xc803('0x11')]();}else if(_0x5069c0[_0xc803('0xf')]===_0xc803('0x14')&&_0x5069c0[_0xc803('0x15')]&&_0x5069c0['Variable'][_0xc803('0x16')]&&_0x5069c0[_0xc803('0x10')]&&_0x56de96[_0x5069c0[_0xc803('0x15')]['name'][_0xc803('0x17')]()]){_0x7c7904[_0x5069c0['idField']]=_0x56de96[_0x5069c0[_0xc803('0x15')][_0xc803('0x16')][_0xc803('0x17')]()][_0xc803('0x11')]();}});}return _0x7c7904;}function getName(_0x1fad03){if(_0x1fad03[_0xc803('0x18')]('\x20')>0x0){var _0x523135=_0x1fad03[_0xc803('0x19')](/ (.+)/);if(_0x523135[0x1]){return _0x523135;}}return[_0x1fad03,_0x1fad03];}var accountsTokens={};function getAccessToken(_0x6f079c){return new Promise(function(_0x2c6b62,_0x49abdf){if(!_[_0xc803('0x1a')](accountsTokens[_0x6f079c['id']])&&!_['isNil'](accountsTokens[_0x6f079c['id']]['access_token'])){if(moment()['isBefore'](accountsTokens[_0x6f079c['id']][_0xc803('0x1b')])){_0x2c6b62(accountsTokens[_0x6f079c['id']][_0xc803('0x1c')]);}}var _0x40c543;switch(_0x6f079c[_0xc803('0x1d')]){case'US':_0x40c543=_0xc803('0x1e');break;case'AU':_0x40c543=_0xc803('0x1f');break;case'EU':_0x40c543=_0xc803('0x20');break;case'IN':_0x40c543=_0xc803('0x21');break;case'CN':_0x40c543=_0xc803('0x22');break;default:_0x40c543=_0xc803('0x20');break;}var _0x43c0b4={'method':_0xc803('0x23'),'uri':_0x40c543+_0xc803('0x24'),'qs':{'refresh_token':_0x6f079c[_0xc803('0x25')],'client_id':_0x6f079c[_0xc803('0x26')],'client_secret':_0x6f079c[_0xc803('0x27')],'grant_type':_0xc803('0x28')},'json':!![]};return rp(_0x43c0b4)[_0xc803('0x29')](function(_0x14ad03){accountsTokens[_0x6f079c['id']]={'access_token':_0x14ad03[_0xc803('0x1c')],'expires_in':moment()[_0xc803('0x2a')](_0x14ad03['expires_in'],_0xc803('0x2b'))};_0x2c6b62(_0x14ad03[_0xc803('0x1c')]);})[_0xc803('0x2c')](function(_0x359e67){logger[_0xc803('0x2d')](_0xc803('0x2e'),_0x359e67[_0xc803('0x2f')]);_0x49abdf(_0x359e67);});});}function getUser(_0x52dbea,_0x1f58e9,_0x39baae,_0x4af8ab){logger[_0xc803('0x30')](_0xc803('0x31'));return request({'method':_0xc803('0x32'),'uri':util['format'](_0xc803('0x33'),_0x1f58e9),'qs':{'type':'ActiveUsers'},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x52dbea},'json':!![]})[_0xc803('0x29')](function(_0x50f844){if(_0x50f844['users']){var _0x43a74d=-0x1;if(_[_0xc803('0x34')](_0x50f844[_0xc803('0x35')])){if(!_[_0xc803('0x1a')](_0x4af8ab)){_0x43a74d=_[_0xc803('0x36')](_0x50f844[_0xc803('0x35')],function(_0x2fa82d){return _0x2fa82d['email']===_0x4af8ab;});}if(_0x43a74d>=0x0){logger[_0xc803('0x30')](_0xc803('0x37'));}else{logger['info']('Using\x20the\x20admin\x20account!');_0x43a74d=_['findIndex'](_0x50f844[_0xc803('0x35')],function(_0x5727c5){return _0x5727c5['profile']['name']==='Administrator';});}return _0x50f844[_0xc803('0x35')][_0x43a74d];}else{if(_0x50f844[_0xc803('0x38')]['profile']['name']===_0xc803('0x39')){logger['info'](_0xc803('0x3a'));user=_0x50f844[_0xc803('0x38')];return user;}else{logger[_0xc803('0x2d')](_0xc803('0x3b'),JSON[_0xc803('0xa')](_0x50f844));throw new Error(_0xc803('0x3c')+JSON[_0xc803('0xa')](_0x50f844));}}}else{logger['error'](_0xc803('0x3b'),JSON['stringify'](_0x50f844));throw new Error(_0xc803('0x3c')+JSON[_0xc803('0xa')](_0x50f844));}})['catch'](function(_0x9153){console[_0xc803('0x2d')](_0x9153);});}function getZohoUser(_0x54d60f,_0x39881f){return new BPromise(function(_0xd2ffac,_0x5acb27){request(_0x54d60f)['then'](function(_0x44a5a2){var _0x192ab3=null;if(_0x44a5a2){_0x192ab3=_0x44a5a2[_0xc803('0x3d')][0x0];_0x192ab3[_0xc803('0x3e')]=_0x39881f;}_0xd2ffac(_0x192ab3);})[_0xc803('0x2c')](function(_0x3aa457){_0x5acb27(_0x3aa457);});});}function createEndUser(_0x4fa9e3,_0x4ca58f,_0x273815,_0x284364,_0x3712a7,_0x2a71e3){var _0x273815=getName(_0x273815);return request({'method':_0xc803('0x23'),'uri':_0xc803('0x3f')+_0x4ca58f+'/crm/v2/'+_[_0xc803('0x40')](_0x2a71e3[_0xc803('0x41')])+'s','body':{'data':[{'Last_Name':_0x273815[0x1],'First_Name':_0x273815[0x0],'Phone':_0x284364,'Owner':{'name':!_[_0xc803('0x1a')](_0x3712a7[_0xc803('0x42')]['name'])?_0x3712a7[_0xc803('0x42')][_0xc803('0x16')]:!_[_0xc803('0x1a')](_0x3712a7[_0xc803('0x43')])?_0x3712a7[_0xc803('0x43')]+'\x20'+_0x3712a7[_0xc803('0x44')]:_0x3712a7[_0xc803('0x44')],'id':_0x3712a7['id']}}]},'headers':{'Authorization':_0xc803('0x45')+_0x4fa9e3},'json':!![]})[_0xc803('0x29')](function(_0xc75504){if(_0xc75504&&_0xc75504['data'][0x0][_0xc803('0x46')]===_0xc803('0x47')){var _0x3caa4b=_0xc75504[_0xc803('0x3d')][0x0][_0xc803('0x48')];_0x3caa4b[_0xc803('0x3e')]=_[_0xc803('0x40')](_0x2a71e3[_0xc803('0x41')])+'s';return _0x3caa4b;}logger[_0xc803('0x2d')](_0xc803('0x3b'),JSON[_0xc803('0xa')](data));throw new Error(_0xc803('0x49')+JSON[_0xc803('0xa')](data));})['catch'](function(_0x1d5a15){console['log'](_0xc803('0x4a'),_0x1d5a15);});}function getEndUser(_0x3bea2c,_0x225453,_0x1cf8b3,_0x3f5f33,_0x109508,_0x14fe71,_0xe7cd68){var _0x1abf3a={'method':_0xc803('0x32'),'uri':'','headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x3bea2c},'json':!![]};switch(_0xe7cd68[_0xc803('0x4b')]){case'contact_lead':_0x1abf3a[_0xc803('0x4c')]=_0xc803('0x3f')+_0x225453+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x109508+'))';return getZohoUser(_0x1abf3a,'Contacts')['then'](function(_0x57ddf8){if(_0x57ddf8)return _0x57ddf8;_0x1abf3a[_0xc803('0x4c')]=_0xc803('0x3f')+_0x225453+_0xc803('0x4d')+_0x109508+'))';return getZohoUser(_0x1abf3a,_0xc803('0x4e'))['then'](function(_0x5e1097){if(_0x5e1097)return _0x5e1097;if(_0xe7cd68[_0xc803('0x41')]!=_0xc803('0x4f')){return createEndUser(_0x3bea2c,_0x225453,_0x3f5f33,_0x109508,_0x14fe71,_0xe7cd68);}else{return{};}});});break;case _0xc803('0x50'):_0x1abf3a[_0xc803('0x4c')]=_0xc803('0x3f')+_0x225453+_0xc803('0x51')+_0x109508+'))';return getZohoUser(_0x1abf3a,_0xc803('0x52'))[_0xc803('0x29')](function(_0x116a77){if(_0x116a77)return _0x116a77;if(_0xe7cd68[_0xc803('0x41')]!=_0xc803('0x4f')){return createEndUser(_0x3bea2c,_0x225453,_0x3f5f33,_0x109508,_0x14fe71,_0xe7cd68);}else{return{};}});break;case _0xc803('0x53'):_0x1abf3a[_0xc803('0x4c')]=_0xc803('0x3f')+_0x225453+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x109508+'))';return getZohoUser(_0x1abf3a,_0xc803('0x4e'))[_0xc803('0x29')](function(_0x5d1d3e){if(_0x5d1d3e)return _0x5d1d3e;if(_0xe7cd68[_0xc803('0x41')]!=_0xc803('0x4f')){return createEndUser(_0x3bea2c,_0x225453,_0x3f5f33,_0x109508,_0x14fe71,_0xe7cd68);}else{return{};}});break;}}function getCall(_0x2b368b,_0x5d4bb3,_0x19da1e,_0x403cc7,_0xee4003,_0x47078d,_0x24e155,_0x430c86){logger[_0xc803('0x30')](_0xc803('0x54'));var _0x5d56ba={};_0x5d56ba[_0xc803('0x55')]={'name':!_['isNil'](_0x403cc7[_0xc803('0x42')][_0xc803('0x16')])&&!_[_0xc803('0x1a')](_0x403cc7[_0xc803('0x56')][_0xc803('0x16')])&&_0x403cc7[_0xc803('0x56')][_0xc803('0x16')]===_0xc803('0x57')?_0x403cc7[_0xc803('0x42')][_0xc803('0x16')]:!_[_0xc803('0x1a')](_0x403cc7[_0xc803('0x43')])?_0x403cc7[_0xc803('0x43')]+'\x20'+_0x403cc7[_0xc803('0x44')]:_0x403cc7[_0xc803('0x44')],'id':_0x403cc7['id']};_0x5d56ba['Subject']=intUtil[_0xc803('0x58')](_0x47078d[_0xc803('0x59')],_0x24e155,'\x20');_0x5d56ba[_0xc803('0x5a')]=intUtil[_0xc803('0x58')](_0x47078d[_0xc803('0x5b')],_0x24e155,'\x0a');if(_0xee4003[_0xc803('0x3e')]==='Contacts'){_0x5d56ba['Who_Id']={'name':!_[_0xc803('0x1a')](_0xee4003[_0xc803('0x5c')])?_0xee4003['Full_Name']:!_['isNil'](_0xee4003[_0xc803('0x5d')])?_0xee4003[_0xc803('0x5d')]+'\x20'+_0xee4003[_0xc803('0x5e')]:_0xee4003['Last_Name'],'id':_0xee4003['id']};}if(_0xee4003['enduserType']===_0xc803('0x4e')){_0x5d56ba['What_Id']={'name':!_[_0xc803('0x1a')](_0xee4003[_0xc803('0x5c')])?_0xee4003['Full_Name']:!_['isNil'](_0xee4003[_0xc803('0x5d')])?_0xee4003[_0xc803('0x5d')]+'\x20'+_0xee4003[_0xc803('0x5e')]:_0xee4003[_0xc803('0x5e')],'id':_0xee4003['id']};_0x5d56ba[_0xc803('0x5f')]=_[_0xc803('0x40')](_0xee4003[_0xc803('0x3e')]);}if(_0x24e155[_0xc803('0x60')]){_0x5d56ba[_0xc803('0x61')]=moment[_0xc803('0x62')](parseInt(_0x24e155[_0xc803('0x60')])*0x3e8)[_0xc803('0x63')](_0xc803('0x64'));}else if(_0x24e155['answertime']&&_0x24e155[_0xc803('0x65')]){_0x5d56ba['Call_Duration']=moment['utc'](moment(_0x24e155[_0xc803('0x65')],_0xc803('0x66'))['diff'](moment(_0x24e155[_0xc803('0x67')],'YYYY-MM-DDTHH:mm:ss')))[_0xc803('0x63')](_0xc803('0x64'));}switch(_0x24e155[_0xc803('0x68')]){case _0xc803('0x69'):_0x5d56ba[_0xc803('0x6a')]=_0xc803('0x6b');break;case _0xc803('0x6c'):case _0xc803('0x6d'):_0x5d56ba[_0xc803('0x6a')]='Answered';break;case _0xc803('0x6e'):_0x5d56ba['Call_Result']=_0xc803('0x6f');break;case _0xc803('0x70'):_0x5d56ba[_0xc803('0x6a')]='Abandoned';break;case'timeout':_0x5d56ba[_0xc803('0x6a')]='Timeout';default:}_0x5d56ba[_0xc803('0x71')]=(_0x430c86==='outbound'?moment(_0x24e155[_0xc803('0x67')])[_0xc803('0x63')](_0xc803('0x66')):moment(_0x24e155[_0xc803('0x72')])['format']('YYYY-MM-DDTHH:mm:ss'))||moment()[_0xc803('0x63')]('YYYY-MM-DDTHH:mm:ss');_0x5d56ba['Call_Type']=_0x430c86||_0xc803('0x73');_0x5d56ba=_[_0xc803('0x74')](_0x5d56ba,getCustomFields(_0x47078d[_0xc803('0x75')],_0x24e155));return request({'method':_0xc803('0x23'),'uri':_0xc803('0x3f')+_0x5d4bb3+'/crm/v2/Calls','headers':{'Authorization':_0xc803('0x45')+_0x2b368b},'body':{'data':[_0x5d56ba]},'json':!![]})[_0xc803('0x29')](function(_0x5e1194){if(_0x5e1194&&_0x5e1194[_0xc803('0x3d')][0x0]['code']===_0xc803('0x47')){logger['info'](_0xc803('0x76'));return{'id':_0x5e1194[_0xc803('0x3d')][0x0][_0xc803('0x48')]['id']};}})[_0xc803('0x2c')](function(_0x2cffd4){logger[_0xc803('0x30')](_0xc803('0x77'),_0x2cffd4['stack']);console[_0xc803('0x78')]('err',_0x2cffd4);});}exports['queue']=function(_0x1f46e1,_0x75d7ff,_0x17f3ba,_0x473b94,_0x2d5ab1,_0x11dd84){var _0x5b0855,_0x72c0e6,_0x3e08e1;_0x11dd84[_0xc803('0x79')]=intUtil['stripTrailingSlash'](_0x11dd84[_0xc803('0x79')]);_0x11dd84['serverUrl']=intUtil[_0xc803('0x7a')](_0x11dd84['serverUrl']);if(_0x2d5ab1&&_0x2d5ab1[_0xc803('0x7b')]){logger[_0xc803('0x30')](_0xc803('0x7c'),_0xc803('0x7d'));_0x75d7ff[_0xc803('0x7e')]=_0x11dd84[_0xc803('0x7f')]+_0xc803('0x80')+_0x75d7ff[_0xc803('0x81')]+'/downloads?type=uniqueid&token='+md5(_0x75d7ff[_0xc803('0x81')]);}else{_0x75d7ff[_0xc803('0x7e')]='';}var _0x20e15=_0x11dd84[_0xc803('0x79')]===_0xc803('0x82')?'eu':_0xc803('0x83');return getAccessToken(_0x11dd84)['then'](function(_0x2957bf){_0x3e08e1=_0x2957bf;return getUser(_0x3e08e1,_0x20e15,_0x11dd84,_0x473b94[_0xc803('0x84')]);})[_0xc803('0x29')](function(_0x2790a3){_0x5b0855=_0x2790a3;logger['info'](_0xc803('0x85'),_0x5b0855['id']);return getEndUser(_0x3e08e1,_0x20e15,_0x11dd84,_0x75d7ff[_0xc803('0x86')],_0x75d7ff[_0xc803('0x87')],_0x5b0855,_0x17f3ba);})[_0xc803('0x29')](function(_0x1c9129){_0x72c0e6=_0x1c9129;return getCall(_0x3e08e1,_0x20e15,_0x11dd84,_0x5b0855,_0x72c0e6,_0x17f3ba,_0x75d7ff,'Inbound');})[_0xc803('0x29')](function(_0x18e003){if(_0x18e003){logger['info'](_0xc803('0x88'),_0x18e003['id']);logger[_0xc803('0x30')]('[QUEUE]',_0xc803('0x89'));emit(util['format'](_0xc803('0x8a'),_0x473b94[_0xc803('0x16')]),_0xc803('0x8b'),{'uri':_0xc803('0x8c')+_0x11dd84[_0xc803('0x79')]+_0xc803('0x8d')+_0x18e003['id']});}})[_0xc803('0x2c')](function(_0x303707){logger[_0xc803('0x2d')](_0xc803('0x7c'),JSON['stringify'](_0x303707));});};exports[_0xc803('0x8e')]=function(_0x3cba87,_0x17a4a5,_0x327cc7,_0x33b8ae,_0x438751,_0x55216b,_0x7d787){var _0x1c419,_0x3724d9,_0x3a6036;_0x55216b[_0xc803('0x79')]=intUtil[_0xc803('0x7a')](_0x55216b[_0xc803('0x79')]);_0x55216b[_0xc803('0x7f')]=intUtil[_0xc803('0x7a')](_0x55216b[_0xc803('0x7f')]);if(_0x7d787&&_0x7d787['recordingFormat']&&_0x7d787[_0xc803('0x8f')]!==_0xc803('0x90')){logger[_0xc803('0x30')](_0xc803('0x91'),_0xc803('0x7d'));_0x17a4a5['recordingURL']=_0x55216b[_0xc803('0x7f')]+_0xc803('0x80')+_0x17a4a5['uniqueid']+_0xc803('0x92')+md5(_0x17a4a5[_0xc803('0x81')]);}var _0x20a3d0=_0x55216b[_0xc803('0x79')]===_0xc803('0x82')?'eu':'com';return getAccessToken(_0x55216b)[_0xc803('0x29')](function(_0x1cf4db){_0x3a6036=_0x1cf4db;return getUser(_0x3a6036,_0x20a3d0,_0x55216b,_0x33b8ae['email']);})[_0xc803('0x29')](function(_0x5a315c){_0x1c419=_0x5a315c;logger[_0xc803('0x30')]('The\x20User\x20ID\x20is:',_0x1c419['id']);return getEndUser(_0x3a6036,_0x20a3d0,_0x55216b,_0x17a4a5[_0xc803('0x93')],_0x17a4a5[_0xc803('0x94')],_0x1c419,_0x327cc7);})[_0xc803('0x29')](function(_0x23f277){_0x3724d9=_0x23f277;return getCall(_0x3a6036,_0x20a3d0,_0x55216b,_0x1c419,_0x3724d9,_0x327cc7,_0x17a4a5,'Outbound');})[_0xc803('0x29')](function(_0x2bb1d7){if(_0x2bb1d7){logger[_0xc803('0x30')](_0xc803('0x88'),_0x2bb1d7['id']);logger['info']('[OUTBOUND]',_0xc803('0x89'));emit(util[_0xc803('0x63')]('user:%s',_0x33b8ae[_0xc803('0x16')]),_0xc803('0x8b'),{'uri':_0xc803('0x8c')+_0x55216b['host']+_0xc803('0x8d')+_0x2bb1d7['id']});}})[_0xc803('0x2c')](function(_0xe116e0){logger[_0xc803('0x2d')](_0xc803('0x91'),JSON[_0xc803('0xa')](_0xe116e0));});};exports['unmanaged']=function(_0x4c9822,_0x20b6c6,_0x366505,_0x1dfc29,_0x5d3134,_0x920ab3){var _0xd8aa98,_0xf8be1,_0x22c1b2;_0x920ab3[_0xc803('0x79')]=intUtil[_0xc803('0x7a')](_0x920ab3[_0xc803('0x79')]);_0x920ab3['serverUrl']=intUtil[_0xc803('0x7a')](_0x920ab3['serverUrl']);if(_0x5d3134&&_0x5d3134['monitor_format']){logger[_0xc803('0x30')]('['+_0x20b6c6['lastevent'][_0xc803('0x95')]()+']','Recording\x20is\x20enabled!');_0x20b6c6[_0xc803('0x7e')]=_0x920ab3[_0xc803('0x7f')]+_0xc803('0x80')+_0x20b6c6['uniqueid']+_0xc803('0x92')+md5(_0x20b6c6[_0xc803('0x81')]);}else{_0x20b6c6[_0xc803('0x7e')]='';}var _0x59c4f1=_0x920ab3['host']===_0xc803('0x82')?'eu':_0xc803('0x83');return getAccessToken(_0x920ab3)[_0xc803('0x29')](function(_0x216ff8){_0x22c1b2=_0x216ff8;return getUser(_0x22c1b2,_0x59c4f1,_0x920ab3);})['then'](function(_0x3c4950){_0xd8aa98=_0x3c4950;logger['info'](_0xc803('0x85'),_0xd8aa98['id']);return getEndUser(_0x22c1b2,_0x59c4f1,_0x920ab3,_0x20b6c6[_0xc803('0x86')],_0x20b6c6[_0xc803('0x87')],_0xd8aa98,_0x366505);})['then'](function(_0x2e8cef){_0xf8be1=_0x2e8cef;return getCall(_0x22c1b2,_0x59c4f1,_0x920ab3,_0xd8aa98,_0xf8be1,_0x366505,_0x20b6c6,_0xc803('0x73'));})[_0xc803('0x29')](function(_0x105d60){if(_0x105d60){logger[_0xc803('0x30')]('The\x20Call\x20ID\x20is:',_0x105d60['id']);}})['catch'](function(_0x24187a){logger['error']('['+_0x20b6c6[_0xc803('0x68')][_0xc803('0x95')]()+']',JSON['stringify'](_0x24187a));});}; \ No newline at end of file +var _0xa98d=['https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','[OUTBOUND]','Outbound','user:%s','unmanaged','monitor_format','toUpperCase','lodash','md5','./util','moment','bluebird','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','emit','[HTTP]','stringify','length','includes','picklist','type','idField','content','toString','variableName','customVariable','Variable','name','toLowerCase','indexOf','split','isNil','access_token','isBefore','expires_in','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','/oauth/v2/token','clientId','refresh_token','then','add','catch','Failing\x20creating\x20the\x20access_token','stack','info','Search\x20user','GET','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','users','isArrayLikeObject','findIndex','email','Agent\x20found!','Using\x20the\x20admin\x20account!','Administrator','user','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','error','data','POST','/crm/v2/','startCase','role','first_name','last_name','code','SUCCESS','details','enduserType','moduleCreate','Error:\x20','log','moduleSearch','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','https://www.zohoapis.','nothing','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','Creating\x20new\x20call...','Owner','profile','administrator','Subject','getString','Subjects','Description','Descriptions','Full_Name','First_Name','Last_Name','What_Id','$se_module','utc','talktime','mm:ss','answertime','endtime','Call_Duration','YYYY-MM-DDTHH:mm:ss','diff','starttime','lastevent','Call_Result','complete','connect','Answered','rejected','abandoned','Abandoned','timeout','Timeout','Call_Start_Time','outbound','agentcalledAt','Call_Type','merge','Fields','/crm/v2/Calls','err','host','serverUrl','stripTrailingSlash','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','zoho.eu','com','The\x20User\x20ID\x20is:','calleridname','calleridnum','Inbound','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xa98d,0xa3));var _0xda98=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xa98d[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xda98('0x0'));var rp=require('request-promise');var md5=require(_0xda98('0x1'));var util=require('util');var intUtil=require(_0xda98('0x2'));var moment=require(_0xda98('0x3'));var Redis=require('ioredis');var BPromise=require(_0xda98('0x4'));var config=require(_0xda98('0x5'));var logger=require(_0xda98('0x6'))('zoho');config[_0xda98('0x7')]=_[_0xda98('0x8')](config[_0xda98('0x7')],{'host':_0xda98('0x9'),'port':0x18eb});var io=require(_0xda98('0xa'))(new Redis(config[_0xda98('0x7')]));function emit(_0x59b7fc,_0x3f7a45,_0x4ad603){io['to'](_0x59b7fc)[_0xda98('0xb')](_0x3f7a45,_0x4ad603);}function request(_0x2aa3a3){logger['debug'](_0xda98('0xc'),JSON[_0xda98('0xd')](_0x2aa3a3));return rp(_0x2aa3a3);}function getCustomFields(_0x571b88,_0x2fcd3a){var _0x5bf8f1={};if(_0x571b88[_0xda98('0xe')]>0x0){_['forEach'](_0x571b88,function(_0x3d6a90){if(_[_0xda98('0xf')](['string',_0xda98('0x10')],_0x3d6a90[_0xda98('0x11')])&&_0x3d6a90[_0xda98('0x12')]){_0x5bf8f1[_0x3d6a90[_0xda98('0x12')]]=_0x3d6a90[_0xda98('0x13')][_0xda98('0x14')]();}else if(_0x3d6a90[_0xda98('0x11')]==='variable'&&_0x3d6a90['variableName']&&_0x3d6a90[_0xda98('0x12')]&&_0x2fcd3a[_0x3d6a90[_0xda98('0x15')]]){_0x5bf8f1[_0x3d6a90[_0xda98('0x12')]]=_0x2fcd3a[_0x3d6a90['variableName']][_0xda98('0x14')]();}else if(_0x3d6a90[_0xda98('0x11')]===_0xda98('0x16')&&_0x3d6a90[_0xda98('0x17')]&&_0x3d6a90['Variable'][_0xda98('0x18')]&&_0x3d6a90[_0xda98('0x12')]&&_0x2fcd3a[_0x3d6a90[_0xda98('0x17')][_0xda98('0x18')][_0xda98('0x19')]()]){_0x5bf8f1[_0x3d6a90['idField']]=_0x2fcd3a[_0x3d6a90[_0xda98('0x17')][_0xda98('0x18')][_0xda98('0x19')]()]['toString']();}});}return _0x5bf8f1;}function getName(_0x4f7b17){if(_0x4f7b17[_0xda98('0x1a')]('\x20')>0x0){var _0x26f4f0=_0x4f7b17[_0xda98('0x1b')](/ (.+)/);if(_0x26f4f0[0x1]){return _0x26f4f0;}}return[_0x4f7b17,_0x4f7b17];}var accountsTokens={};function getAccessToken(_0x528c3e){return new Promise(function(_0x12d759,_0x2d264e){if(!_[_0xda98('0x1c')](accountsTokens[_0x528c3e['id']])&&!_[_0xda98('0x1c')](accountsTokens[_0x528c3e['id']][_0xda98('0x1d')])){if(moment()[_0xda98('0x1e')](accountsTokens[_0x528c3e['id']][_0xda98('0x1f')])){_0x12d759(accountsTokens[_0x528c3e['id']]['access_token']);}}var _0x4a533b;switch(_0x528c3e['zone']){case'US':_0x4a533b='https://accounts.zoho.com';break;case'AU':_0x4a533b=_0xda98('0x20');break;case'EU':_0x4a533b=_0xda98('0x21');break;case'IN':_0x4a533b=_0xda98('0x22');break;case'CN':_0x4a533b=_0xda98('0x23');break;default:_0x4a533b=_0xda98('0x21');break;}var _0x52166c={'method':'POST','uri':_0x4a533b+_0xda98('0x24'),'qs':{'refresh_token':_0x528c3e['refreshToken'],'client_id':_0x528c3e[_0xda98('0x25')],'client_secret':_0x528c3e['clientSecret'],'grant_type':_0xda98('0x26')},'json':!![]};return rp(_0x52166c)[_0xda98('0x27')](function(_0x2fad69){accountsTokens[_0x528c3e['id']]={'access_token':_0x2fad69['access_token'],'expires_in':moment()[_0xda98('0x28')](_0x2fad69[_0xda98('0x1f')],'seconds')};_0x12d759(_0x2fad69[_0xda98('0x1d')]);})[_0xda98('0x29')](function(_0x53d5ae){logger['error'](_0xda98('0x2a'),_0x53d5ae[_0xda98('0x2b')]);_0x2d264e(_0x53d5ae);});});}function getUser(_0x3c0be3,_0x21eb8c,_0x49334c,_0x44aa85){logger[_0xda98('0x2c')](_0xda98('0x2d'));return request({'method':_0xda98('0x2e'),'uri':util[_0xda98('0x2f')](_0xda98('0x30'),_0x21eb8c),'qs':{'type':_0xda98('0x31')},'headers':{'Authorization':_0xda98('0x32')+_0x3c0be3},'json':!![]})['then'](function(_0x41e5fd){if(_0x41e5fd[_0xda98('0x33')]){var _0x475b8b=-0x1;if(_[_0xda98('0x34')](_0x41e5fd[_0xda98('0x33')])){if(!_[_0xda98('0x1c')](_0x44aa85)){_0x475b8b=_[_0xda98('0x35')](_0x41e5fd[_0xda98('0x33')],function(_0x1f9685){return _0x1f9685[_0xda98('0x36')]===_0x44aa85;});}if(_0x475b8b>=0x0){logger[_0xda98('0x2c')](_0xda98('0x37'));}else{logger['info'](_0xda98('0x38'));_0x475b8b=_[_0xda98('0x35')](_0x41e5fd[_0xda98('0x33')],function(_0x1f09f7){return _0x1f09f7['profile'][_0xda98('0x18')]===_0xda98('0x39');});}return _0x41e5fd[_0xda98('0x33')][_0x475b8b];}else{if(_0x41e5fd[_0xda98('0x3a')]['profile'][_0xda98('0x18')]===_0xda98('0x39')){logger[_0xda98('0x2c')]('Using\x20the\x20admin\x20account!');user=_0x41e5fd[_0xda98('0x3a')];return user;}else{logger['error']('The\x20failing\x20result\x20is',JSON[_0xda98('0xd')](_0x41e5fd));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON['stringify'](_0x41e5fd));}}}else{logger['error'](_0xda98('0x3b'),JSON['stringify'](_0x41e5fd));throw new Error(_0xda98('0x3c')+JSON['stringify'](_0x41e5fd));}})[_0xda98('0x29')](function(_0xc93605){console[_0xda98('0x3d')](_0xc93605);});}function getZohoUser(_0xe72dec,_0x53c8b6){return new BPromise(function(_0x4a0b1d,_0x4fd27c){request(_0xe72dec)[_0xda98('0x27')](function(_0x55fec0){var _0x232090=null;if(_0x55fec0){_0x232090=_0x55fec0[_0xda98('0x3e')][0x0];_0x232090['enduserType']=_0x53c8b6;}_0x4a0b1d(_0x232090);})[_0xda98('0x29')](function(_0x4b237c){_0x4fd27c(_0x4b237c);});});}function createEndUser(_0x302cc5,_0x524112,_0x56da1b,_0x34111f,_0x100711,_0x3c36c4){var _0x56da1b=getName(_0x56da1b);return request({'method':_0xda98('0x3f'),'uri':'https://www.zohoapis.'+_0x524112+_0xda98('0x40')+_[_0xda98('0x41')](_0x3c36c4['moduleCreate'])+'s','body':{'data':[{'Last_Name':_0x56da1b[0x1],'First_Name':_0x56da1b[0x0],'Phone':_0x34111f,'Owner':{'name':!_[_0xda98('0x1c')](_0x100711[_0xda98('0x42')][_0xda98('0x18')])?_0x100711[_0xda98('0x42')][_0xda98('0x18')]:!_[_0xda98('0x1c')](_0x100711['first_name'])?_0x100711[_0xda98('0x43')]+'\x20'+_0x100711[_0xda98('0x44')]:_0x100711[_0xda98('0x44')],'id':_0x100711['id']}}]},'headers':{'Authorization':_0xda98('0x32')+_0x302cc5},'json':!![]})[_0xda98('0x27')](function(_0x255724){if(_0x255724&&_0x255724[_0xda98('0x3e')][0x0][_0xda98('0x45')]===_0xda98('0x46')){var _0x33db1a=_0x255724[_0xda98('0x3e')][0x0][_0xda98('0x47')];_0x33db1a[_0xda98('0x48')]=_[_0xda98('0x41')](_0x3c36c4[_0xda98('0x49')])+'s';return _0x33db1a;}logger['error']('The\x20failing\x20result\x20is',JSON[_0xda98('0xd')](data));throw new Error(_0xda98('0x4a')+JSON['stringify'](data));})[_0xda98('0x29')](function(_0x5a86df){console[_0xda98('0x4b')]('CREATE\x20ERROR',_0x5a86df);});}function getEndUser(_0x3ea1d1,_0x305a29,_0x49476e,_0x53a7be,_0x412f73,_0x378685,_0x47f9c2){var _0x54e0ac={'method':_0xda98('0x2e'),'uri':'','headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x3ea1d1},'json':!![]};switch(_0x47f9c2[_0xda98('0x4c')]){case'contact_lead':_0x54e0ac[_0xda98('0x4d')]='https://www.zohoapis.'+_0x305a29+_0xda98('0x4e')+_0x412f73+'))';return getZohoUser(_0x54e0ac,'Contacts')['then'](function(_0x59d621){if(_0x59d621)return _0x59d621;_0x54e0ac[_0xda98('0x4d')]=_0xda98('0x4f')+_0x305a29+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x412f73+'))';return getZohoUser(_0x54e0ac,'Leads')[_0xda98('0x27')](function(_0x49c48c){if(_0x49c48c)return _0x49c48c;if(_0x47f9c2[_0xda98('0x49')]!=_0xda98('0x50')){return createEndUser(_0x3ea1d1,_0x305a29,_0x53a7be,_0x412f73,_0x378685,_0x47f9c2);}else{return{};}});});break;case'contact':_0x54e0ac[_0xda98('0x4d')]=_0xda98('0x4f')+_0x305a29+_0xda98('0x4e')+_0x412f73+'))';return getZohoUser(_0x54e0ac,_0xda98('0x51'))[_0xda98('0x27')](function(_0x147e05){if(_0x147e05)return _0x147e05;if(_0x47f9c2[_0xda98('0x49')]!='nothing'){return createEndUser(_0x3ea1d1,_0x305a29,_0x53a7be,_0x412f73,_0x378685,_0x47f9c2);}else{return{};}});break;case'lead':_0x54e0ac['uri']=_0xda98('0x4f')+_0x305a29+_0xda98('0x52')+_0x412f73+'))';return getZohoUser(_0x54e0ac,_0xda98('0x53'))[_0xda98('0x27')](function(_0x55ea93){if(_0x55ea93)return _0x55ea93;if(_0x47f9c2['moduleCreate']!=_0xda98('0x50')){return createEndUser(_0x3ea1d1,_0x305a29,_0x53a7be,_0x412f73,_0x378685,_0x47f9c2);}else{return{};}});break;}}function getCall(_0x49d0ff,_0xa43d9e,_0x81ab24,_0x164a92,_0x14060f,_0x2820ba,_0x405eff,_0x23ab80){logger['info'](_0xda98('0x54'));var _0x3e0d5e={};_0x3e0d5e[_0xda98('0x55')]={'name':!_['isNil'](_0x164a92[_0xda98('0x42')][_0xda98('0x18')])&&!_[_0xda98('0x1c')](_0x164a92[_0xda98('0x56')][_0xda98('0x18')])&&_0x164a92[_0xda98('0x56')][_0xda98('0x18')]===_0xda98('0x57')?_0x164a92[_0xda98('0x42')][_0xda98('0x18')]:!_[_0xda98('0x1c')](_0x164a92[_0xda98('0x43')])?_0x164a92[_0xda98('0x43')]+'\x20'+_0x164a92[_0xda98('0x44')]:_0x164a92[_0xda98('0x44')],'id':_0x164a92['id']};_0x3e0d5e[_0xda98('0x58')]=intUtil[_0xda98('0x59')](_0x2820ba[_0xda98('0x5a')],_0x405eff,'\x20');_0x3e0d5e[_0xda98('0x5b')]=intUtil['getString'](_0x2820ba[_0xda98('0x5c')],_0x405eff,'\x0a');if(_0x14060f[_0xda98('0x48')]===_0xda98('0x51')){_0x3e0d5e['Who_Id']={'name':!_[_0xda98('0x1c')](_0x14060f['Full_Name'])?_0x14060f[_0xda98('0x5d')]:!_[_0xda98('0x1c')](_0x14060f[_0xda98('0x5e')])?_0x14060f['First_Name']+'\x20'+_0x14060f[_0xda98('0x5f')]:_0x14060f['Last_Name'],'id':_0x14060f['id']};}if(_0x14060f[_0xda98('0x48')]===_0xda98('0x53')){_0x3e0d5e[_0xda98('0x60')]={'name':!_['isNil'](_0x14060f[_0xda98('0x5d')])?_0x14060f[_0xda98('0x5d')]:!_[_0xda98('0x1c')](_0x14060f[_0xda98('0x5e')])?_0x14060f[_0xda98('0x5e')]+'\x20'+_0x14060f['Last_Name']:_0x14060f[_0xda98('0x5f')],'id':_0x14060f['id']};_0x3e0d5e[_0xda98('0x61')]=_[_0xda98('0x41')](_0x14060f[_0xda98('0x48')]);}if(_0x405eff['talktime']){_0x3e0d5e['Call_Duration']=moment[_0xda98('0x62')](parseInt(_0x405eff[_0xda98('0x63')])*0x3e8)[_0xda98('0x2f')](_0xda98('0x64'));}else if(_0x405eff[_0xda98('0x65')]&&_0x405eff[_0xda98('0x66')]){_0x3e0d5e[_0xda98('0x67')]=moment[_0xda98('0x62')](moment(_0x405eff[_0xda98('0x66')],_0xda98('0x68'))[_0xda98('0x69')](moment(_0x405eff[_0xda98('0x6a')],'YYYY-MM-DDTHH:mm:ss')))[_0xda98('0x2f')](_0xda98('0x64'));}switch(_0x405eff[_0xda98('0x6b')]){case'called':_0x3e0d5e[_0xda98('0x6c')]='Called';break;case _0xda98('0x6d'):case _0xda98('0x6e'):_0x3e0d5e[_0xda98('0x6c')]=_0xda98('0x6f');break;case _0xda98('0x70'):_0x3e0d5e['Call_Result']='Rejected';break;case _0xda98('0x71'):_0x3e0d5e['Call_Result']=_0xda98('0x72');break;case _0xda98('0x73'):_0x3e0d5e[_0xda98('0x6c')]=_0xda98('0x74');default:}_0x3e0d5e[_0xda98('0x75')]=(_0x23ab80===_0xda98('0x76')?moment(_0x405eff['starttime'])[_0xda98('0x2f')](_0xda98('0x68')):moment(_0x405eff[_0xda98('0x77')])[_0xda98('0x2f')]('YYYY-MM-DDTHH:mm:ss'))||moment()['format'](_0xda98('0x68'));_0x3e0d5e[_0xda98('0x78')]=_0x23ab80||'Inbound';_0x3e0d5e=_[_0xda98('0x79')](_0x3e0d5e,getCustomFields(_0x2820ba[_0xda98('0x7a')],_0x405eff));return request({'method':'POST','uri':'https://www.zohoapis.'+_0xa43d9e+_0xda98('0x7b'),'headers':{'Authorization':_0xda98('0x32')+_0x49d0ff},'body':{'data':[_0x3e0d5e]},'json':!![]})[_0xda98('0x27')](function(_0x491835){if(_0x491835&&_0x491835[_0xda98('0x3e')][0x0][_0xda98('0x45')]===_0xda98('0x46')){logger[_0xda98('0x2c')]('Call\x20created!');return{'id':_0x491835['data'][0x0][_0xda98('0x47')]['id']};}})['catch'](function(_0x2f20a7){logger[_0xda98('0x2c')](_0xda98('0x7c'),_0x2f20a7[_0xda98('0x2b')]);console[_0xda98('0x4b')]('err',_0x2f20a7);});}exports['queue']=function(_0x174544,_0x2cfde8,_0x5d110f,_0x4e64a5,_0x17c736,_0x554ffb){var _0x369577,_0x4760dd,_0x4b1d8e;_0x554ffb[_0xda98('0x7d')]=intUtil['stripTrailingSlash'](_0x554ffb[_0xda98('0x7d')]);_0x554ffb[_0xda98('0x7e')]=intUtil[_0xda98('0x7f')](_0x554ffb['serverUrl']);if(_0x17c736&&_0x17c736['monitor_format']){logger[_0xda98('0x2c')](_0xda98('0x80'),_0xda98('0x81'));_0x2cfde8[_0xda98('0x82')]=_0x554ffb[_0xda98('0x7e')]+_0xda98('0x83')+_0x2cfde8[_0xda98('0x84')]+_0xda98('0x85')+md5(_0x2cfde8[_0xda98('0x84')]);}else{_0x2cfde8[_0xda98('0x82')]='';}var _0x5d2bbd=_0x554ffb['host']===_0xda98('0x86')?'eu':_0xda98('0x87');return getAccessToken(_0x554ffb)[_0xda98('0x27')](function(_0x2cebca){_0x4b1d8e=_0x2cebca;return getUser(_0x4b1d8e,_0x5d2bbd,_0x554ffb,_0x4e64a5[_0xda98('0x36')]);})[_0xda98('0x27')](function(_0x50ceaf){_0x369577=_0x50ceaf;logger[_0xda98('0x2c')](_0xda98('0x88'),_0x369577['id']);return getEndUser(_0x4b1d8e,_0x5d2bbd,_0x554ffb,_0x2cfde8[_0xda98('0x89')],_0x2cfde8[_0xda98('0x8a')],_0x369577,_0x5d110f);})[_0xda98('0x27')](function(_0x3c9a42){_0x4760dd=_0x3c9a42;return getCall(_0x4b1d8e,_0x5d2bbd,_0x554ffb,_0x369577,_0x4760dd,_0x5d110f,_0x2cfde8,_0xda98('0x8b'));})[_0xda98('0x27')](function(_0xae557b){if(_0xae557b){logger[_0xda98('0x2c')](_0xda98('0x8c'),_0xae557b['id']);logger[_0xda98('0x2c')](_0xda98('0x80'),_0xda98('0x8d'));emit(util[_0xda98('0x2f')]('user:%s',_0x4e64a5['name']),_0xda98('0x8e'),{'uri':_0xda98('0x8f')+_0x554ffb[_0xda98('0x7d')]+_0xda98('0x90')+_0xae557b['id']});}})[_0xda98('0x29')](function(_0x15deb7){logger['error']('[QUEUE]',JSON[_0xda98('0xd')](_0x15deb7));});};exports[_0xda98('0x76')]=function(_0x8fd047,_0x2429df,_0x170d84,_0x838f7c,_0x22794e,_0x336b5d,_0x103353){var _0x552f9c,_0x5c3230,_0x14dc58;_0x336b5d[_0xda98('0x7d')]=intUtil[_0xda98('0x7f')](_0x336b5d[_0xda98('0x7d')]);_0x336b5d[_0xda98('0x7e')]=intUtil[_0xda98('0x7f')](_0x336b5d[_0xda98('0x7e')]);if(_0x103353&&_0x103353[_0xda98('0x91')]&&_0x103353[_0xda98('0x91')]!==_0xda98('0x92')){logger[_0xda98('0x2c')](_0xda98('0x93'),'Recording\x20is\x20enabled!');_0x2429df[_0xda98('0x82')]=_0x336b5d['serverUrl']+_0xda98('0x83')+_0x2429df[_0xda98('0x84')]+_0xda98('0x85')+md5(_0x2429df[_0xda98('0x84')]);}var _0x4fc4aa=_0x336b5d[_0xda98('0x7d')]===_0xda98('0x86')?'eu':_0xda98('0x87');return getAccessToken(_0x336b5d)[_0xda98('0x27')](function(_0x138479){_0x14dc58=_0x138479;return getUser(_0x14dc58,_0x4fc4aa,_0x336b5d,_0x838f7c[_0xda98('0x36')]);})[_0xda98('0x27')](function(_0x203ed3){_0x552f9c=_0x203ed3;logger[_0xda98('0x2c')]('The\x20User\x20ID\x20is:',_0x552f9c['id']);return getEndUser(_0x14dc58,_0x4fc4aa,_0x336b5d,_0x2429df['destcalleridname'],_0x2429df['destcalleridnum'],_0x552f9c,_0x170d84);})['then'](function(_0x5e2b04){_0x5c3230=_0x5e2b04;return getCall(_0x14dc58,_0x4fc4aa,_0x336b5d,_0x552f9c,_0x5c3230,_0x170d84,_0x2429df,_0xda98('0x94'));})[_0xda98('0x27')](function(_0x380fe3){if(_0x380fe3){logger['info'](_0xda98('0x8c'),_0x380fe3['id']);logger[_0xda98('0x2c')](_0xda98('0x93'),_0xda98('0x8d'));emit(util['format'](_0xda98('0x95'),_0x838f7c[_0xda98('0x18')]),_0xda98('0x8e'),{'uri':_0xda98('0x8f')+_0x336b5d[_0xda98('0x7d')]+_0xda98('0x90')+_0x380fe3['id']});}})[_0xda98('0x29')](function(_0x57c746){logger[_0xda98('0x3d')](_0xda98('0x93'),JSON[_0xda98('0xd')](_0x57c746));});};exports[_0xda98('0x96')]=function(_0x4aad86,_0x17b687,_0x7609c0,_0x52b2ed,_0x5cbadb,_0x1b483f){var _0x1de8a2,_0x4808fd,_0x24c432;_0x1b483f[_0xda98('0x7d')]=intUtil[_0xda98('0x7f')](_0x1b483f['host']);_0x1b483f[_0xda98('0x7e')]=intUtil[_0xda98('0x7f')](_0x1b483f[_0xda98('0x7e')]);if(_0x5cbadb&&_0x5cbadb[_0xda98('0x97')]){logger[_0xda98('0x2c')]('['+_0x17b687[_0xda98('0x6b')][_0xda98('0x98')]()+']',_0xda98('0x81'));_0x17b687[_0xda98('0x82')]=_0x1b483f['serverUrl']+_0xda98('0x83')+_0x17b687['uniqueid']+_0xda98('0x85')+md5(_0x17b687[_0xda98('0x84')]);}else{_0x17b687[_0xda98('0x82')]='';}var _0x1a6c3=_0x1b483f['host']===_0xda98('0x86')?'eu':_0xda98('0x87');return getAccessToken(_0x1b483f)['then'](function(_0x121c7b){_0x24c432=_0x121c7b;return getUser(_0x24c432,_0x1a6c3,_0x1b483f);})[_0xda98('0x27')](function(_0x574584){_0x1de8a2=_0x574584;logger[_0xda98('0x2c')]('The\x20User\x20ID\x20is:',_0x1de8a2['id']);return getEndUser(_0x24c432,_0x1a6c3,_0x1b483f,_0x17b687[_0xda98('0x89')],_0x17b687['calleridnum'],_0x1de8a2,_0x7609c0);})[_0xda98('0x27')](function(_0xe1e087){_0x4808fd=_0xe1e087;return getCall(_0x24c432,_0x1a6c3,_0x1b483f,_0x1de8a2,_0x4808fd,_0x7609c0,_0x17b687,_0xda98('0x8b'));})[_0xda98('0x27')](function(_0x190be9){if(_0x190be9){logger[_0xda98('0x2c')]('The\x20Call\x20ID\x20is:',_0x190be9['id']);}})[_0xda98('0x29')](function(_0x20861c){logger[_0xda98('0x3d')]('['+_0x17b687[_0xda98('0x6b')][_0xda98('0x98')]()+']',JSON[_0xda98('0xd')](_0x20861c));});}; \ 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 7a01de7..bc71ce6 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 _0x1f08=['exec','data2','Script','data3','render','error','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','shelljs','../../../../config/logger'];(function(_0x55fd8e,_0xa9abe7){var _0x45fd7c=function(_0x5e101){while(--_0x5e101){_0x55fd8e['push'](_0x55fd8e['shift']());}};_0x45fd7c(++_0xa9abe7);}(_0x1f08,0x126));var _0x81f0=function(_0x1cbe63,_0x16220f){_0x1cbe63=_0x1cbe63-0x0;var _0x116d86=_0x1f08[_0x1cbe63];return _0x116d86;};'use strict';var util=require(_0x81f0('0x0'));var sh=require(_0x81f0('0x1'));var Mustache=require('mustache');var logger=require(_0x81f0('0x2'))('trigger');exports[_0x81f0('0x3')]=function(_0x166d59,_0x489c2f){var _0x4309ea=_0x166d59[_0x81f0('0x4')]?_0x166d59[_0x81f0('0x4')]:_0x81f0('0x5');var _0xbb6869=_0x166d59[_0x81f0('0x6')]?Mustache[_0x81f0('0x7')](_0x166d59[_0x81f0('0x6')],_0x489c2f):_0x489c2f;sh[_0x81f0('0x3')](_0xbb6869,function(_0x5d1d17,_0x5d7ecf,_0x3048a4){if(_0x5d1d17!==0x0){logger[_0x81f0('0x8')](util['format'](_0x81f0('0x9'),_0x4309ea,_0xbb6869,_0x5d1d17,_0x3048a4));}else{logger['info'](util['format'](_0x81f0('0xa'),_0x4309ea,_0xbb6869,_0x5d7ecf));}});}; \ No newline at end of file +var _0xc160=['error','info','format','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','shelljs','trigger','data2','Script','render'];(function(_0x3c9839,_0x27bd51){var _0x30273f=function(_0x52fc44){while(--_0x52fc44){_0x3c9839['push'](_0x3c9839['shift']());}};_0x30273f(++_0x27bd51);}(_0xc160,0xf4));var _0x0c16=function(_0xcfd89f,_0x106e8f){_0xcfd89f=_0xcfd89f-0x0;var _0x59acd4=_0xc160[_0xcfd89f];return _0x59acd4;};'use strict';var util=require(_0x0c16('0x0'));var sh=require(_0x0c16('0x1'));var Mustache=require('mustache');var logger=require('../../../../config/logger')(_0x0c16('0x2'));exports['exec']=function(_0x36c64f,_0x3ec020){var _0x3fe06a=_0x36c64f[_0x0c16('0x3')]?_0x36c64f[_0x0c16('0x3')]:_0x0c16('0x4');var _0x9f6403=_0x36c64f['data3']?Mustache[_0x0c16('0x5')](_0x36c64f['data3'],_0x3ec020):_0x3ec020;sh['exec'](_0x9f6403,function(_0x279072,_0x15889a,_0x4c5d76){if(_0x279072!==0x0){logger[_0x0c16('0x6')](util['format']('%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s',_0x3fe06a,_0x9f6403,_0x279072,_0x4c5d76));}else{logger[_0x0c16('0x7')](util[_0x0c16('0x8')](_0x0c16('0x9'),_0x3fe06a,_0x9f6403,_0x15889a));}});}; \ 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 57da656..bf92f16 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 _0x23b9=['statusCode','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','name','message','util','lodash','../../../../config/logger','trigger','exec','data1','toUpperCase','render','data2','data5','number','headers','parse','data6','stack','GET','DELETE','data7','body','error','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','format','stringify','then','info'];(function(_0x12a554,_0x3d7ef8){var _0x244ba0=function(_0x5eb5ff){while(--_0x5eb5ff){_0x12a554['push'](_0x12a554['shift']());}};_0x244ba0(++_0x3d7ef8);}(_0x23b9,0x1e5));var _0x923b=function(_0x1b6349,_0x2116eb){_0x1b6349=_0x1b6349-0x0;var _0x4d0338=_0x23b9[_0x1b6349];return _0x4d0338;};'use strict';var rp=require('request-promise');var util=require(_0x923b('0x0'));var _=require(_0x923b('0x1'));var Mustache=require('mustache');var logger=require(_0x923b('0x2'))(_0x923b('0x3'));exports[_0x923b('0x4')]=function(_0x2b3cda,_0x42ef14){var _0x2e6084,_0x1a96c8;var _0x24f703={'method':_0x2b3cda[_0x923b('0x5')][_0x923b('0x6')](),'uri':Mustache[_0x923b('0x7')](_0x2b3cda[_0x923b('0x8')],_0x42ef14),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x2b3cda[_0x923b('0x9')])===_0x923b('0xa')&&parseInt(_0x2b3cda[_0x923b('0x9')])>=0x1&&parseInt(_0x2b3cda[_0x923b('0x9')])<=0xa?parseInt(_0x2b3cda['data5'])*0x3e8:0x5*0x3e8};try{_0x24f703[_0x923b('0xb')]=_0x2b3cda['data6']?JSON[_0x923b('0xc')](Mustache[_0x923b('0x7')](_0x2b3cda[_0x923b('0xd')],_0x42ef14)):{};}catch(_0x4ad4fa){logger['error'](_0x4ad4fa[_0x923b('0xe')]);}switch(_0x2b3cda[_0x923b('0x5')][_0x923b('0x6')]()){case _0x923b('0xf'):case _0x923b('0x10'):_0x2e6084=null;_0x24f703['qs']=_0x42ef14;break;case'POST':case'PUT':if(_0x2b3cda['data7']){try{_0x2e6084=JSON[_0x923b('0xc')](Mustache['render'](_0x2b3cda[_0x923b('0x11')],_0x42ef14));_0x24f703[_0x923b('0x12')]=_0x2e6084;}catch(_0x1e0c09){logger[_0x923b('0x13')](_0x1e0c09[_0x923b('0xe')]);logger[_0x923b('0x13')](_0x923b('0x14'));}}else{_0x2e6084=_0x42ef14;_0x24f703[_0x923b('0x12')]=_0x2e6084;}break;}logger['info'](util[_0x923b('0x15')]('%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s',_0x2b3cda[_0x923b('0x5')],_0x2b3cda['data2'],JSON[_0x923b('0x16')](_0x24f703)));rp(_0x24f703)[_0x923b('0x17')](function(_0x404101){_0x2e6084=!_['isNil'](_0x2e6084)?',\x20request\x20body:\x20'+_0x2e6084:'';_0x1a96c8=typeof _0x404101[_0x923b('0x12')]==='object'?JSON[_0x923b('0x16')](_0x404101[_0x923b('0x12')]):_0x404101[_0x923b('0x12')];logger[_0x923b('0x18')](util['format']('%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s',_0x2b3cda[_0x923b('0x5')],_0x2b3cda[_0x923b('0x8')],_0x404101[_0x923b('0x19')],_0x1a96c8));})[_0x923b('0x1a')](function(_0x4485a9){logger[_0x923b('0x13')](util[_0x923b('0x15')](_0x923b('0x1b'),_0x2b3cda['data1'],_0x2b3cda['data2'],_0x4485a9[_0x923b('0x19')],_0x4485a9[_0x923b('0x1c')],_0x4485a9[_0x923b('0x1d')]));});}; \ No newline at end of file +var _0x4d24=['render','data2','data5','number','headers','data6','parse','error','stack','GET','POST','data7','body','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify','then','isNil',',\x20request\x20body:\x20','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','name','message','request-promise','util','lodash','mustache','../../../../config/logger','trigger','exec','data1','toUpperCase'];(function(_0x400d28,_0x368388){var _0x44808a=function(_0x52b747){while(--_0x52b747){_0x400d28['push'](_0x400d28['shift']());}};_0x44808a(++_0x368388);}(_0x4d24,0x141));var _0x44d2=function(_0x2f1fae,_0x1470c3){_0x2f1fae=_0x2f1fae-0x0;var _0x5f5104=_0x4d24[_0x2f1fae];return _0x5f5104;};'use strict';var rp=require(_0x44d2('0x0'));var util=require(_0x44d2('0x1'));var _=require(_0x44d2('0x2'));var Mustache=require(_0x44d2('0x3'));var logger=require(_0x44d2('0x4'))(_0x44d2('0x5'));exports[_0x44d2('0x6')]=function(_0x26dfbe,_0x317988){var _0x11f354,_0x3c8b7a;var _0x5d0cb4={'method':_0x26dfbe[_0x44d2('0x7')][_0x44d2('0x8')](),'uri':Mustache[_0x44d2('0x9')](_0x26dfbe[_0x44d2('0xa')],_0x317988),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x26dfbe[_0x44d2('0xb')])===_0x44d2('0xc')&&parseInt(_0x26dfbe['data5'])>=0x1&&parseInt(_0x26dfbe[_0x44d2('0xb')])<=0xa?parseInt(_0x26dfbe[_0x44d2('0xb')])*0x3e8:0x5*0x3e8};try{_0x5d0cb4[_0x44d2('0xd')]=_0x26dfbe[_0x44d2('0xe')]?JSON[_0x44d2('0xf')](Mustache[_0x44d2('0x9')](_0x26dfbe[_0x44d2('0xe')],_0x317988)):{};}catch(_0x45657e){logger[_0x44d2('0x10')](_0x45657e[_0x44d2('0x11')]);}switch(_0x26dfbe[_0x44d2('0x7')][_0x44d2('0x8')]()){case _0x44d2('0x12'):case'DELETE':_0x11f354=null;_0x5d0cb4['qs']=_0x317988;break;case _0x44d2('0x13'):case'PUT':if(_0x26dfbe['data7']){try{_0x11f354=JSON[_0x44d2('0xf')](Mustache[_0x44d2('0x9')](_0x26dfbe[_0x44d2('0x14')],_0x317988));_0x5d0cb4[_0x44d2('0x15')]=_0x11f354;}catch(_0x32a984){logger[_0x44d2('0x10')](_0x32a984[_0x44d2('0x11')]);logger[_0x44d2('0x10')]('body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format');}}else{_0x11f354=_0x317988;_0x5d0cb4[_0x44d2('0x15')]=_0x11f354;}break;}logger[_0x44d2('0x16')](util[_0x44d2('0x17')](_0x44d2('0x18'),_0x26dfbe[_0x44d2('0x7')],_0x26dfbe[_0x44d2('0xa')],JSON[_0x44d2('0x19')](_0x5d0cb4)));rp(_0x5d0cb4)[_0x44d2('0x1a')](function(_0x2088a8){_0x11f354=!_[_0x44d2('0x1b')](_0x11f354)?_0x44d2('0x1c')+_0x11f354:'';_0x3c8b7a=typeof _0x2088a8[_0x44d2('0x15')]==='object'?JSON['stringify'](_0x2088a8[_0x44d2('0x15')]):_0x2088a8[_0x44d2('0x15')];logger[_0x44d2('0x16')](util[_0x44d2('0x17')](_0x44d2('0x1d'),_0x26dfbe['data1'],_0x26dfbe['data2'],_0x2088a8[_0x44d2('0x1e')],_0x3c8b7a));})['catch'](function(_0x2ab001){logger[_0x44d2('0x10')](util[_0x44d2('0x17')]('%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s',_0x26dfbe[_0x44d2('0x7')],_0x26dfbe['data2'],_0x2ab001[_0x44d2('0x1e')],_0x2ab001[_0x44d2('0x1f')],_0x2ab001[_0x44d2('0x20')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index 8d17b3f..e39b97b 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 _0xb855=['request','then','debug','rpc','error','message','result','exports','bluebird','../../config/logger','routing','client','http','Request'];(function(_0x294665,_0x52347c){var _0x34abea=function(_0x5dbc85){while(--_0x5dbc85){_0x294665['push'](_0x294665['shift']());}};_0x34abea(++_0x52347c);}(_0xb855,0x19e));var _0x5b85=function(_0x420c44,_0x11af5b){_0x420c44=_0x420c44-0x0;var _0x138afb=_0xb855[_0x420c44];return _0x138afb;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0x5b85('0x0'));var logger=require(_0x5b85('0x1'))(_0x5b85('0x2'));var client=jayson[_0x5b85('0x3')][_0x5b85('0x4')]({'port':0x2329});client[_0x5b85('0x5')]=function(_0x12737d,_0x3e7953){return new BPromise(function(_0x5e2c1a,_0x59cd3f){return client[_0x5b85('0x6')](_0x12737d,_0x3e7953)[_0x5b85('0x7')](function(_0xed2db1){logger[_0x5b85('0x8')](_0x5b85('0x9'),_0x5b85('0x2'),_0x12737d,_0x3e7953,_0xed2db1);if(_0xed2db1[_0x5b85('0xa')]){logger[_0x5b85('0xa')]('rpc',_0x5b85('0x2'),_0x12737d,_0xed2db1[_0x5b85('0xa')][_0x5b85('0xb')],_0x3e7953);return _0x59cd3f(_0xed2db1[_0x5b85('0xa')][_0x5b85('0xb')]);}else{return _0x5e2c1a(_0xed2db1[_0x5b85('0xc')]);}})['catch'](function(_0x215233){logger[_0x5b85('0xa')](_0x5b85('0x9'),_0x5b85('0x2'),_0x12737d,_0x215233,_0x3e7953);return _0x59cd3f(_0x215233);});});};module[_0x5b85('0xd')]=client; \ No newline at end of file +var _0x2dc0=['../../config/logger','routing','client','http','request','then','debug','rpc','error','result','jayson/promise'];(function(_0x319735,_0x4cc181){var _0x19604d=function(_0x5f3f34){while(--_0x5f3f34){_0x319735['push'](_0x319735['shift']());}};_0x19604d(++_0x4cc181);}(_0x2dc0,0xc5));var _0x02dc=function(_0x2446cb,_0x41bc54){_0x2446cb=_0x2446cb-0x0;var _0x4e66da=_0x2dc0[_0x2446cb];return _0x4e66da;};'use strict';var jayson=require(_0x02dc('0x0'));var BPromise=require('bluebird');var logger=require(_0x02dc('0x1'))(_0x02dc('0x2'));var client=jayson[_0x02dc('0x3')][_0x02dc('0x4')]({'port':0x2329});client['Request']=function(_0x820d2a,_0x3152f9){return new BPromise(function(_0x5e8623,_0x1c6425){return client[_0x02dc('0x5')](_0x820d2a,_0x3152f9)[_0x02dc('0x6')](function(_0x3e1646){logger[_0x02dc('0x7')](_0x02dc('0x8'),'routing',_0x820d2a,_0x3152f9,_0x3e1646);if(_0x3e1646[_0x02dc('0x9')]){logger[_0x02dc('0x9')](_0x02dc('0x8'),_0x02dc('0x2'),_0x820d2a,_0x3e1646[_0x02dc('0x9')]['message'],_0x3152f9);return _0x1c6425(_0x3e1646[_0x02dc('0x9')]['message']);}else{return _0x5e8623(_0x3e1646[_0x02dc('0xa')]);}})['catch'](function(_0x3c0b12){logger[_0x02dc('0x9')]('rpc',_0x02dc('0x2'),_0x820d2a,_0x3c0b12,_0x3152f9);return _0x1c6425(_0x3c0b12);});});};module['exports']=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index a6e98e7..9815065 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 _0xc03e=['./lib/email','./rpc/mailAccount','../../config/logger','resolve','getMailAccounts','then','initMailAccounts','mailAccounts','loginMailFrequency','catch','error','./server','./realtime'];(function(_0x42b072,_0xbb8f2e){var _0x2d0954=function(_0x9bf006){while(--_0x9bf006){_0x42b072['push'](_0x42b072['shift']());}};_0x2d0954(++_0xbb8f2e);}(_0xc03e,0xa7));var _0xec03=function(_0x5d3903,_0x3d6c3e){_0x5d3903=_0x5d3903-0x0;var _0x4b8bc9=_0xc03e[_0x5d3903];return _0x4b8bc9;};'use strict';var server=require(_0xec03('0x0'));var Realtime=require(_0xec03('0x1'));var EmailChannel=require(_0xec03('0x2'));var mailAccount=require(_0xec03('0x3'));var setting=require('./rpc/setting');var logger=require(_0xec03('0x4'))('email');var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0xec03('0x5')]()['then'](mailAccount[_0xec03('0x6')]())[_0xec03('0x7')](realtime[_0xec03('0x8')]())[_0xec03('0x7')](function(){email['refresh'](realtime[_0xec03('0x9')]);return realtime;});}function main(){return server['listen'](realtime,email)['then'](function(){return initRealtime();})['then'](function(){return setting['getSettings']();})['then'](function(_0x3c8546){return setInterval(initRealtime,_0x3c8546[_0xec03('0xa')]*0x3e8);})[_0xec03('0xb')](function(_0x11f7ea){logger[_0xec03('0xc')]('Email\x20service\x20initialization',_0x11f7ea);});}main(); \ No newline at end of file +var _0x45df=['mailAccounts','listen','getSettings','loginMailFrequency','catch','error','Email\x20service\x20initialization','./server','./realtime','./lib/email','./rpc/mailAccount','../../config/logger','email','resolve','getMailAccounts','then','initMailAccounts'];(function(_0x2b739e,_0x287ca7){var _0x45cfba=function(_0x5ab3db){while(--_0x5ab3db){_0x2b739e['push'](_0x2b739e['shift']());}};_0x45cfba(++_0x287ca7);}(_0x45df,0x1e3));var _0xf45d=function(_0x33f6ae,_0x499448){_0x33f6ae=_0x33f6ae-0x0;var _0x16ec5c=_0x45df[_0x33f6ae];return _0x16ec5c;};'use strict';var server=require(_0xf45d('0x0'));var Realtime=require(_0xf45d('0x1'));var EmailChannel=require(_0xf45d('0x2'));var mailAccount=require(_0xf45d('0x3'));var setting=require('./rpc/setting');var logger=require(_0xf45d('0x4'))(_0xf45d('0x5'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0xf45d('0x6')]()['then'](mailAccount[_0xf45d('0x7')]())[_0xf45d('0x8')](realtime[_0xf45d('0x9')]())[_0xf45d('0x8')](function(){email['refresh'](realtime[_0xf45d('0xa')]);return realtime;});}function main(){return server[_0xf45d('0xb')](realtime,email)[_0xf45d('0x8')](function(){return initRealtime();})['then'](function(){return setting[_0xf45d('0xc')]();})[_0xf45d('0x8')](function(_0x541857){return setInterval(initRealtime,_0x541857[_0xf45d('0xd')]*0x3e8);})[_0xf45d('0xe')](function(_0x126784){logger[_0xf45d('0xf')](_0xf45d('0x10'),_0x126784);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index b5f0c86..97b0ddd 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 _0x1ba0=['info','start\x20email\x20channel','mailAccounts','imapAccounts','prototype','emit','active','Imap','total','isNil','hasOwnProperty','service','provider','custom','box','handleImapBox','bind','handleImapEmail','error','handleImapError','disabled','connected','messageStatus','name','messages','firstName','lastName','from','notify','then','catch','stringify','handleImapEnd','lastSync','status','sendMail','smtp','verifySmtp','Smtp','verify','verified','exports','lodash','moment','bluebird','md5','email','redis','defaults','localhost','socket.io-emitter','./imap','./smtp'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x1ba0,0x133));var _0x01ba=function(_0x38ac0f,_0x57e18a){_0x38ac0f=_0x38ac0f-0x0;var _0x140f20=_0x1ba0[_0x38ac0f];return _0x140f20;};'use strict';var _=require(_0x01ba('0x0'));var moment=require(_0x01ba('0x1'));var BPromise=require(_0x01ba('0x2'));var md5=require(_0x01ba('0x3'));var Redis=require('ioredis');var config=require('../../../config/environment');var logger=require('../../../config/logger')(_0x01ba('0x4'));config[_0x01ba('0x5')]=_[_0x01ba('0x6')](config[_0x01ba('0x5')],{'host':_0x01ba('0x7'),'port':0x18eb});var io=require(_0x01ba('0x8'))(new Redis(config[_0x01ba('0x5')]));var EmailImap=require(_0x01ba('0x9'));var EmailSmtp=require(_0x01ba('0xa'));var mailAccount=require('../rpc/mailAccount');var md5Accounts={};function EmailChannel(_0x30cf70){logger[_0x01ba('0xb')](_0x01ba('0xc'));this[_0x01ba('0xd')]=_0x30cf70[_0x01ba('0xd')];this[_0x01ba('0xe')]={};this['smtp']=new EmailSmtp();}EmailChannel[_0x01ba('0xf')][_0x01ba('0x10')]=function(_0xf121a9){var _0x1f9d93=this[_0x01ba('0xd')][_0xf121a9];var _0x44b4c5={'id':_0x1f9d93['id'],'name':_0x1f9d93['name'],'key':_0x1f9d93['key'],'active':_0x1f9d93[_0x01ba('0x11')],'Imap':{'status':_0x1f9d93[_0x01ba('0x12')]['status'],'messageStatus':_0x1f9d93[_0x01ba('0x12')]['messageStatus'],'total':_0x1f9d93[_0x01ba('0x12')][_0x01ba('0x13')]}};if(_[_0x01ba('0x14')](md5Accounts[_0xf121a9])){md5Accounts[_0xf121a9]={};}var _0x5aaa9d=md5(JSON['stringify'](_0x44b4c5));if(md5Accounts[_0xf121a9]['md5']!==_0x5aaa9d){md5Accounts[_0xf121a9][_0x01ba('0x3')]=_0x5aaa9d;io[_0x01ba('0x10')]('mailAccount:update',_0x44b4c5);}};EmailChannel[_0x01ba('0xf')]['refresh']=function(_0x143b99){for(var _0x14c63d in _0x143b99){if(_0x143b99[_0x01ba('0x15')](_0x14c63d)){if(_0x143b99[_0x14c63d][_0x01ba('0x12')]&&_0x143b99[_0x14c63d][_0x01ba('0x11')]){var _0x7c6391=_0x143b99[_0x14c63d]['Imap'];if(!_0x7c6391[_0x01ba('0x16')]&&_0x143b99[_0x14c63d][_0x01ba('0x17')]!==_0x01ba('0x18'))_0x7c6391[_0x01ba('0x16')]=_0x143b99[_0x14c63d][_0x01ba('0x17')];if(!this['imapAccounts'][_0x01ba('0x15')](_0x7c6391['id'])){this['imapAccounts'][_0x7c6391['id']]=new EmailImap(_0x7c6391,_0x143b99[_0x14c63d]['email']);this[_0x01ba('0xe')][_0x7c6391['id']]['on'](_0x01ba('0x19'),this[_0x01ba('0x1a')][_0x01ba('0x1b')](this,_0x14c63d));this[_0x01ba('0xe')][_0x7c6391['id']]['on'](_0x01ba('0x4'),this[_0x01ba('0x1c')][_0x01ba('0x1b')](this,_0x14c63d));this[_0x01ba('0xe')][_0x7c6391['id']]['on']('end',this['handleImapEnd'][_0x01ba('0x1b')](this,_0x14c63d));this['imapAccounts'][_0x7c6391['id']]['on'](_0x01ba('0x1d'),this[_0x01ba('0x1e')][_0x01ba('0x1b')](this,_0x14c63d));}}else{if(_['isNil'](this[_0x01ba('0xd')][_0x14c63d][_0x01ba('0x12')])){this[_0x01ba('0xd')][_0x14c63d][_0x01ba('0x12')]={};}this[_0x01ba('0xd')][_0x14c63d]['Imap']['status']=_0x01ba('0x1f');this['mailAccounts'][_0x14c63d][_0x01ba('0x12')]['messageStatus']='';this[_0x01ba('0x10')](_0x14c63d);}}}};EmailChannel[_0x01ba('0xf')]['handleImapBox']=function(_0x19c561,_0x4cd3de){if(this[_0x01ba('0xd')][_0x19c561]){this['mailAccounts'][_0x19c561][_0x01ba('0x12')]['status']=_0x01ba('0x20');this['mailAccounts'][_0x19c561][_0x01ba('0x12')][_0x01ba('0x21')]=_0x4cd3de[_0x01ba('0x22')];if(_0x4cd3de[_0x01ba('0x23')]){this['mailAccounts'][_0x19c561]['Imap'][_0x01ba('0x13')]=_0x4cd3de['messages'][_0x01ba('0x13')];}return this[_0x01ba('0x10')](_0x19c561);}};EmailChannel[_0x01ba('0xf')][_0x01ba('0x1c')]=function(_0x192a11,_0x52303c){logger[_0x01ba('0xb')]('New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s',_0x52303c[_0x01ba('0x24')],_0x52303c[_0x01ba('0x25')],_0x52303c[_0x01ba('0x26')],_0x192a11);if(this[_0x01ba('0xd')][_0x192a11]){return mailAccount[_0x01ba('0x27')](_0x192a11,_0x52303c)[_0x01ba('0x28')](function(_0x4b7281){if(_0x4b7281){logger[_0x01ba('0xb')]('Mail\x20accepted\x20from\x20routing');}})[_0x01ba('0x29')](function(_0x1bfb01){logger[_0x01ba('0x1d')]('Mail\x20not\x20accepted\x20from\x20routing\x20%s',JSON[_0x01ba('0x2a')](_0x1bfb01));});}};EmailChannel[_0x01ba('0xf')][_0x01ba('0x2b')]=function(_0x589e73){if(this[_0x01ba('0xd')][_0x589e73]&&this[_0x01ba('0xd')][_0x589e73][_0x01ba('0x12')]){if(this[_0x01ba('0xe')][this[_0x01ba('0xd')][_0x589e73]['Imap']['id']]){delete this['imapAccounts'][this[_0x01ba('0xd')][_0x589e73][_0x01ba('0x12')]['id']];}this[_0x01ba('0xd')][_0x589e73][_0x01ba('0x12')][_0x01ba('0x2c')]=moment();this[_0x01ba('0x10')](_0x589e73);}};EmailChannel['prototype']['handleImapError']=function(_0x137bb7,_0x17dd34){if(this[_0x01ba('0xd')][_0x137bb7]){this[_0x01ba('0xd')][_0x137bb7][_0x01ba('0x12')][_0x01ba('0x2d')]=_0x01ba('0x1d');this[_0x01ba('0xd')][_0x137bb7][_0x01ba('0x12')]['messageStatus']=_0x17dd34;return this[_0x01ba('0x10')](_0x137bb7);}};EmailChannel[_0x01ba('0xf')][_0x01ba('0x2e')]=function(_0x235e00,_0x46d586){return this[_0x01ba('0x2f')]['send'](_0x235e00,_0x46d586);};EmailChannel[_0x01ba('0xf')][_0x01ba('0x30')]=function(_0x62a6ae){var _0x2824c4=this;if(this[_0x01ba('0xd')][_0x62a6ae['id']]){if(_[_0x01ba('0x14')](this['mailAccounts'][_0x62a6ae['id']]['Smtp'])){this[_0x01ba('0xd')][_0x62a6ae['id']][_0x01ba('0x31')]={};}this[_0x01ba('0xd')][_0x62a6ae['id']][_0x01ba('0x31')][_0x01ba('0x2c')]=moment();return new BPromise(function(_0x3dcea8,_0x2a7584){return _0x2824c4['smtp'][_0x01ba('0x32')](_0x62a6ae)[_0x01ba('0x28')](function(_0x1ed2da){_0x2824c4[_0x01ba('0xd')][_0x62a6ae['id']][_0x01ba('0x31')]['status']=_0x01ba('0x33');_0x2824c4[_0x01ba('0xd')][_0x62a6ae['id']][_0x01ba('0x31')][_0x01ba('0x21')]='';_0x2824c4[_0x01ba('0x10')](_0x62a6ae['id']);_0x3dcea8(_0x1ed2da);})[_0x01ba('0x29')](function(_0x144d66){_0x2824c4[_0x01ba('0xd')][_0x62a6ae['id']][_0x01ba('0x31')]['status']=_0x01ba('0x1d');_0x2824c4[_0x01ba('0xd')][_0x62a6ae['id']][_0x01ba('0x31')]['messageStatus']=_0x144d66;_0x2824c4[_0x01ba('0x10')](_0x62a6ae['id']);_0x2a7584(_0x144d66);});});}return this[_0x01ba('0x2f')]['verify'](_0x62a6ae);};module[_0x01ba('0x34')]=EmailChannel; \ No newline at end of file +var _0x347f=['../../../config/environment','../../../config/logger','email','redis','defaults','localhost','./imap','info','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','prototype','emit','name','key','Imap','status','messageStatus','total','isNil','stringify','md5','active','service','provider','custom','hasOwnProperty','box','bind','handleImapEmail','end','handleImapEnd','error','handleImapError','disabled','handleImapBox','connected','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','from','notify','then','Mail\x20accepted\x20from\x20routing','lastSync','sendMail','send','verifySmtp','Smtp','verify','verified','lodash','moment','bluebird','ioredis'];(function(_0x3116e2,_0x2c813b){var _0x37cb5b=function(_0x135a37){while(--_0x135a37){_0x3116e2['push'](_0x3116e2['shift']());}};_0x37cb5b(++_0x2c813b);}(_0x347f,0x119));var _0xf347=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x347f[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xf347('0x0'));var moment=require(_0xf347('0x1'));var BPromise=require(_0xf347('0x2'));var md5=require('md5');var Redis=require(_0xf347('0x3'));var config=require(_0xf347('0x4'));var logger=require(_0xf347('0x5'))(_0xf347('0x6'));config[_0xf347('0x7')]=_[_0xf347('0x8')](config['redis'],{'host':_0xf347('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xf347('0x7')]));var EmailImap=require(_0xf347('0xa'));var EmailSmtp=require('./smtp');var mailAccount=require('../rpc/mailAccount');var md5Accounts={};function EmailChannel(_0x539f73){logger[_0xf347('0xb')](_0xf347('0xc'));this[_0xf347('0xd')]=_0x539f73[_0xf347('0xd')];this[_0xf347('0xe')]={};this[_0xf347('0xf')]=new EmailSmtp();}EmailChannel[_0xf347('0x10')][_0xf347('0x11')]=function(_0x1c05f1){var _0x1cbd00=this[_0xf347('0xd')][_0x1c05f1];var _0x5f4265={'id':_0x1cbd00['id'],'name':_0x1cbd00[_0xf347('0x12')],'key':_0x1cbd00[_0xf347('0x13')],'active':_0x1cbd00['active'],'Imap':{'status':_0x1cbd00[_0xf347('0x14')][_0xf347('0x15')],'messageStatus':_0x1cbd00[_0xf347('0x14')][_0xf347('0x16')],'total':_0x1cbd00[_0xf347('0x14')][_0xf347('0x17')]}};if(_[_0xf347('0x18')](md5Accounts[_0x1c05f1])){md5Accounts[_0x1c05f1]={};}var _0x48dcf0=md5(JSON[_0xf347('0x19')](_0x5f4265));if(md5Accounts[_0x1c05f1][_0xf347('0x1a')]!==_0x48dcf0){md5Accounts[_0x1c05f1]['md5']=_0x48dcf0;io[_0xf347('0x11')]('mailAccount:update',_0x5f4265);}};EmailChannel['prototype']['refresh']=function(_0x41c97b){for(var _0x5a0170 in _0x41c97b){if(_0x41c97b['hasOwnProperty'](_0x5a0170)){if(_0x41c97b[_0x5a0170][_0xf347('0x14')]&&_0x41c97b[_0x5a0170][_0xf347('0x1b')]){var _0x4ec421=_0x41c97b[_0x5a0170][_0xf347('0x14')];if(!_0x4ec421[_0xf347('0x1c')]&&_0x41c97b[_0x5a0170][_0xf347('0x1d')]!==_0xf347('0x1e'))_0x4ec421['service']=_0x41c97b[_0x5a0170][_0xf347('0x1d')];if(!this[_0xf347('0xe')][_0xf347('0x1f')](_0x4ec421['id'])){this[_0xf347('0xe')][_0x4ec421['id']]=new EmailImap(_0x4ec421,_0x41c97b[_0x5a0170]['email']);this[_0xf347('0xe')][_0x4ec421['id']]['on'](_0xf347('0x20'),this['handleImapBox'][_0xf347('0x21')](this,_0x5a0170));this[_0xf347('0xe')][_0x4ec421['id']]['on'](_0xf347('0x6'),this[_0xf347('0x22')][_0xf347('0x21')](this,_0x5a0170));this['imapAccounts'][_0x4ec421['id']]['on'](_0xf347('0x23'),this[_0xf347('0x24')][_0xf347('0x21')](this,_0x5a0170));this[_0xf347('0xe')][_0x4ec421['id']]['on'](_0xf347('0x25'),this[_0xf347('0x26')]['bind'](this,_0x5a0170));}}else{if(_[_0xf347('0x18')](this['mailAccounts'][_0x5a0170]['Imap'])){this[_0xf347('0xd')][_0x5a0170][_0xf347('0x14')]={};}this['mailAccounts'][_0x5a0170]['Imap'][_0xf347('0x15')]=_0xf347('0x27');this[_0xf347('0xd')][_0x5a0170]['Imap'][_0xf347('0x16')]='';this[_0xf347('0x11')](_0x5a0170);}}}};EmailChannel[_0xf347('0x10')][_0xf347('0x28')]=function(_0x5c2a92,_0x1e5c31){if(this[_0xf347('0xd')][_0x5c2a92]){this[_0xf347('0xd')][_0x5c2a92][_0xf347('0x14')][_0xf347('0x15')]=_0xf347('0x29');this[_0xf347('0xd')][_0x5c2a92][_0xf347('0x14')][_0xf347('0x16')]=_0x1e5c31[_0xf347('0x12')];if(_0x1e5c31[_0xf347('0x2a')]){this[_0xf347('0xd')][_0x5c2a92]['Imap'][_0xf347('0x17')]=_0x1e5c31[_0xf347('0x2a')][_0xf347('0x17')];}return this[_0xf347('0x11')](_0x5c2a92);}};EmailChannel[_0xf347('0x10')][_0xf347('0x22')]=function(_0xd7012d,_0x12f397){logger[_0xf347('0xb')](_0xf347('0x2b'),_0x12f397[_0xf347('0x2c')],_0x12f397[_0xf347('0x2d')],_0x12f397[_0xf347('0x2e')],_0xd7012d);if(this[_0xf347('0xd')][_0xd7012d]){return mailAccount[_0xf347('0x2f')](_0xd7012d,_0x12f397)[_0xf347('0x30')](function(_0x4325a0){if(_0x4325a0){logger[_0xf347('0xb')](_0xf347('0x31'));}})['catch'](function(_0x150b2f){logger[_0xf347('0x25')]('Mail\x20not\x20accepted\x20from\x20routing\x20%s',JSON[_0xf347('0x19')](_0x150b2f));});}};EmailChannel[_0xf347('0x10')][_0xf347('0x24')]=function(_0x30a90a){if(this[_0xf347('0xd')][_0x30a90a]&&this[_0xf347('0xd')][_0x30a90a][_0xf347('0x14')]){if(this[_0xf347('0xe')][this[_0xf347('0xd')][_0x30a90a][_0xf347('0x14')]['id']]){delete this[_0xf347('0xe')][this[_0xf347('0xd')][_0x30a90a]['Imap']['id']];}this[_0xf347('0xd')][_0x30a90a][_0xf347('0x14')][_0xf347('0x32')]=moment();this[_0xf347('0x11')](_0x30a90a);}};EmailChannel['prototype']['handleImapError']=function(_0x3fbe17,_0x17cf5b){if(this['mailAccounts'][_0x3fbe17]){this[_0xf347('0xd')][_0x3fbe17][_0xf347('0x14')]['status']='error';this['mailAccounts'][_0x3fbe17]['Imap'][_0xf347('0x16')]=_0x17cf5b;return this[_0xf347('0x11')](_0x3fbe17);}};EmailChannel[_0xf347('0x10')][_0xf347('0x33')]=function(_0x4cb9d2,_0x431009){return this[_0xf347('0xf')][_0xf347('0x34')](_0x4cb9d2,_0x431009);};EmailChannel[_0xf347('0x10')][_0xf347('0x35')]=function(_0x4f5175){var _0x1b1ac7=this;if(this[_0xf347('0xd')][_0x4f5175['id']]){if(_[_0xf347('0x18')](this[_0xf347('0xd')][_0x4f5175['id']][_0xf347('0x36')])){this['mailAccounts'][_0x4f5175['id']][_0xf347('0x36')]={};}this[_0xf347('0xd')][_0x4f5175['id']][_0xf347('0x36')][_0xf347('0x32')]=moment();return new BPromise(function(_0x8f7393,_0x17ffac){return _0x1b1ac7[_0xf347('0xf')][_0xf347('0x37')](_0x4f5175)[_0xf347('0x30')](function(_0x437058){_0x1b1ac7[_0xf347('0xd')][_0x4f5175['id']][_0xf347('0x36')][_0xf347('0x15')]=_0xf347('0x38');_0x1b1ac7[_0xf347('0xd')][_0x4f5175['id']]['Smtp'][_0xf347('0x16')]='';_0x1b1ac7['emit'](_0x4f5175['id']);_0x8f7393(_0x437058);})['catch'](function(_0x437865){_0x1b1ac7[_0xf347('0xd')][_0x4f5175['id']][_0xf347('0x36')]['status']=_0xf347('0x25');_0x1b1ac7[_0xf347('0xd')][_0x4f5175['id']][_0xf347('0x36')]['messageStatus']=_0x437865;_0x1b1ac7[_0xf347('0x11')](_0x4f5175['id']);_0x17ffac(_0x437865);});});}return this[_0xf347('0xf')][_0xf347('0x37')](_0x4f5175);};module['exports']=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index 3c33c42..ae7ced0 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 _0x2af1=['connTimeout','authTimeout','user','modernAuthentication','xoauth2','data5','password','authentication','anonymous@xcally.com','host','port','tls','required','openBox','handleOpenBox','handleCloseBox','readUnseen','search','UNSEEN','handleReadUnseen','fetch','message','handleFetchMessage','handleFetchEnd','closeBox','body','handleMessageBody','handleMessageEnd','handleSimpleParser','handleMessageAttributes','parser','emit','handleFetchError','textCode','hasOwnProperty','upperFirst','exports','util','imap','mailparser','simpleParser','Iconv','EventEmitter','./utils','email','mailbox','account','getAccount','ready','handleReady','bind','once','end','handleEnd','error','handleError','connect','inherits','prototype'];(function(_0x567942,_0x142d69){var _0x3cb453=function(_0x55b196){while(--_0x55b196){_0x567942['push'](_0x567942['shift']());}};_0x3cb453(++_0x142d69);}(_0x2af1,0x14c));var _0x12af=function(_0x36403f,_0x2ba222){_0x36403f=_0x36403f-0x0;var _0x16b69b=_0x2af1[_0x36403f];return _0x16b69b;};'use strict';var _=require('lodash');var util=require(_0x12af('0x0'));var Imap=require(_0x12af('0x1'));var simpleParser=require(_0x12af('0x2'))[_0x12af('0x3')];var Iconv=require('iconv')[_0x12af('0x4')];var EventEmitter=require('events')[_0x12af('0x5')];var utils=require(_0x12af('0x6'));var logger=require('../../../config/logger')(_0x12af('0x7'));function EmailImap(_0x3951eb,_0x462d91){this[_0x12af('0x8')]=_0x3951eb['mailbox'];this[_0x12af('0x9')]=this[_0x12af('0xa')](_0x3951eb,_0x462d91);this[_0x12af('0x1')]=new Imap(this[_0x12af('0x9')]);this[_0x12af('0x1')]['once'](_0x12af('0xb'),this[_0x12af('0xc')][_0x12af('0xd')](this));this['imap'][_0x12af('0xe')](_0x12af('0xf'),this[_0x12af('0x10')][_0x12af('0xd')](this));this['imap']['on'](_0x12af('0x11'),this[_0x12af('0x12')][_0x12af('0xd')](this));this['imap'][_0x12af('0x13')]();}util[_0x12af('0x14')](EmailImap,EventEmitter);EmailImap[_0x12af('0x15')][_0x12af('0xa')]=function(_0x790af5,_0xf405e4){var _0x59a2e3={'connTimeout':_0x790af5[_0x12af('0x16')]?_0x790af5['connTimeout']*0x3e8:0x2710,'authTimeout':_0x790af5[_0x12af('0x17')]?_0x790af5[_0x12af('0x17')]*0x3e8:0x1388};if(_0x790af5['service']){_0x59a2e3['user']=_0x790af5[_0x12af('0x18')];if(_0x790af5[_0x12af('0x19')]){_0x59a2e3[_0x12af('0x1a')]=utils['generateXOAuth2Token'](_0x790af5['CloudProvider'][_0x12af('0x1b')],_0x790af5['user']);}else{_0x59a2e3[_0x12af('0x1c')]=_0x790af5[_0x12af('0x1c')];}}else{if(_0x790af5[_0x12af('0x1d')]){_0x59a2e3[_0x12af('0x18')]=_0x790af5[_0x12af('0x18')];_0x59a2e3['password']=_0x790af5[_0x12af('0x1c')];}}_0x59a2e3[_0x12af('0x7')]=_0xf405e4||_0x790af5[_0x12af('0x18')]||_0x12af('0x1e');_0x59a2e3[_0x12af('0x1f')]=_0x790af5[_0x12af('0x1f')];_0x59a2e3[_0x12af('0x20')]=_0x790af5[_0x12af('0x20')]||0x3e1;if(_0x790af5[_0x12af('0x21')]){_0x59a2e3[_0x12af('0x21')]=!![];}else{_0x59a2e3[_0x12af('0x21')]=![];_0x59a2e3['autotls']=_0x12af('0x22');}return _0x59a2e3;};EmailImap[_0x12af('0x15')][_0x12af('0xc')]=function(){this[_0x12af('0x1')][_0x12af('0x23')](this[_0x12af('0x8')],![],this[_0x12af('0x24')][_0x12af('0xd')](this));};EmailImap[_0x12af('0x15')][_0x12af('0x24')]=function(_0x380db2,_0x3fe7a0){if(_0x380db2){this[_0x12af('0x12')](_0x380db2,!![]);}else{this['emit']('box',_0x3fe7a0);this['readUnseen']();}};EmailImap[_0x12af('0x15')][_0x12af('0x25')]=function(_0x107fc1){if(_0x107fc1){this['handleError'](_0x107fc1,!![]);}else{this[_0x12af('0x1')][_0x12af('0xf')]();}};EmailImap['prototype'][_0x12af('0x26')]=function(){this['imap'][_0x12af('0x27')]([_0x12af('0x28')],this['handleReadUnseen'][_0x12af('0xd')](this));};EmailImap[_0x12af('0x15')][_0x12af('0x29')]=function(_0x2d786e,_0xc87619){if(_0x2d786e){this[_0x12af('0x12')](_0x2d786e,!![]);}else{if(_0xc87619['length']){try{var _0x40692e=this[_0x12af('0x1')][_0x12af('0x2a')](_0xc87619,{'bodies':'','markSeen':!![]});_0x40692e['on'](_0x12af('0x2b'),this[_0x12af('0x2c')]['bind'](this));_0x40692e[_0x12af('0xe')](_0x12af('0x11'),this['handleFetchError'][_0x12af('0xd')](this));_0x40692e[_0x12af('0xe')]('end',this[_0x12af('0x2d')]['bind'](this));}catch(_0x220f6e){logger[_0x12af('0x11')](_0x220f6e);}}else{this[_0x12af('0x1')][_0x12af('0x2e')](!![],this[_0x12af('0x25')][_0x12af('0xd')](this));}}};EmailImap[_0x12af('0x15')][_0x12af('0x2c')]=function(_0x3144cd){_0x3144cd['on'](_0x12af('0x2f'),this[_0x12af('0x30')]['bind'](this));_0x3144cd[_0x12af('0xe')]('attributes',this['handleMessageAttributes'][_0x12af('0xd')](this));_0x3144cd[_0x12af('0xe')]('end',this[_0x12af('0x31')][_0x12af('0xd')](this));};EmailImap[_0x12af('0x15')]['handleMessageBody']=function(_0x620c0d){simpleParser(_0x620c0d,{'Iconv':Iconv},this[_0x12af('0x32')][_0x12af('0xd')](this));};EmailImap[_0x12af('0x15')][_0x12af('0x33')]=function(){};EmailImap[_0x12af('0x15')][_0x12af('0x31')]=function(){};EmailImap[_0x12af('0x15')][_0x12af('0x32')]=function(_0x135499,_0x3afc10){if(_0x135499){logger[_0x12af('0x11')](_0x135499);}else{var _0x437cad=this;utils[_0x12af('0x34')](this['account'],_0x3afc10,function(_0x535a44){_0x437cad[_0x12af('0x35')](_0x12af('0x7'),_0x535a44);});}};EmailImap[_0x12af('0x15')][_0x12af('0x2d')]=function(){this[_0x12af('0x1')][_0x12af('0x2e')](!![],this[_0x12af('0x25')][_0x12af('0xd')](this));};EmailImap[_0x12af('0x15')][_0x12af('0x36')]=function(_0x131e76){this[_0x12af('0x12')](_0x131e76);this[_0x12af('0x1')][_0x12af('0x2e')](!![],this[_0x12af('0x25')]['bind'](this));};EmailImap['prototype'][_0x12af('0x10')]=function(){this['emit'](_0x12af('0xf'));};EmailImap[_0x12af('0x15')][_0x12af('0x12')]=function(_0x2cfd88,_0x390263){logger['error'](_0x12af('0x12'),this['account'][_0x12af('0x7')],JSON['stringify'](_0x2cfd88));var _0x268160='';if(_0x2cfd88){if(_0x2cfd88[_0x12af('0x37')]){_0x268160=_0x2cfd88[_0x12af('0x37')];}else{for(var _0x5afe16 in _0x2cfd88){if(_0x2cfd88[_0x12af('0x38')](_0x5afe16)){_0x268160+=_[_0x12af('0x39')](_0x5afe16)+':\x20'+_0x2cfd88[_0x5afe16]+'\x0a';}}}}if(_0x390263){this[_0x12af('0x1')][_0x12af('0xf')]();}else{this[_0x12af('0x35')](_0x12af('0x11'),_0x268160);this['emit'](_0x12af('0xf'));}};module[_0x12af('0x3a')]=EmailImap; \ No newline at end of file +var _0x93cd=['bind','error','handleError','connect','inherits','prototype','authTimeout','service','user','modernAuthentication','xoauth2','generateXOAuth2Token','CloudProvider','data5','password','authentication','anonymous@xcally.com','host','port','tls','autotls','required','openBox','handleOpenBox','emit','box','handleCloseBox','end','UNSEEN','handleReadUnseen','length','fetch','message','handleFetchMessage','handleFetchError','handleFetchEnd','closeBox','body','attributes','handleMessageAttributes','handleMessageEnd','handleMessageBody','handleEnd','textCode','hasOwnProperty','upperFirst','exports','util','imap','mailparser','simpleParser','iconv','Iconv','events','EventEmitter','../../../config/logger','email','mailbox','account','getAccount','once','ready','handleReady'];(function(_0x3e0600,_0x9bb3c9){var _0x5e1117=function(_0x508ca2){while(--_0x508ca2){_0x3e0600['push'](_0x3e0600['shift']());}};_0x5e1117(++_0x9bb3c9);}(_0x93cd,0x1a9));var _0xd93c=function(_0x4b1665,_0xb0c095){_0x4b1665=_0x4b1665-0x0;var _0x5850c0=_0x93cd[_0x4b1665];return _0x5850c0;};'use strict';var _=require('lodash');var util=require(_0xd93c('0x0'));var Imap=require(_0xd93c('0x1'));var simpleParser=require(_0xd93c('0x2'))[_0xd93c('0x3')];var Iconv=require(_0xd93c('0x4'))[_0xd93c('0x5')];var EventEmitter=require(_0xd93c('0x6'))[_0xd93c('0x7')];var utils=require('./utils');var logger=require(_0xd93c('0x8'))(_0xd93c('0x9'));function EmailImap(_0x324c23,_0x491062){this[_0xd93c('0xa')]=_0x324c23[_0xd93c('0xa')];this[_0xd93c('0xb')]=this[_0xd93c('0xc')](_0x324c23,_0x491062);this[_0xd93c('0x1')]=new Imap(this[_0xd93c('0xb')]);this[_0xd93c('0x1')][_0xd93c('0xd')](_0xd93c('0xe'),this[_0xd93c('0xf')][_0xd93c('0x10')](this));this['imap'][_0xd93c('0xd')]('end',this['handleEnd'][_0xd93c('0x10')](this));this[_0xd93c('0x1')]['on'](_0xd93c('0x11'),this[_0xd93c('0x12')][_0xd93c('0x10')](this));this['imap'][_0xd93c('0x13')]();}util[_0xd93c('0x14')](EmailImap,EventEmitter);EmailImap[_0xd93c('0x15')][_0xd93c('0xc')]=function(_0x385e5c,_0x52da45){var _0x1c620e={'connTimeout':_0x385e5c['connTimeout']?_0x385e5c['connTimeout']*0x3e8:0x2710,'authTimeout':_0x385e5c[_0xd93c('0x16')]?_0x385e5c[_0xd93c('0x16')]*0x3e8:0x1388};if(_0x385e5c[_0xd93c('0x17')]){_0x1c620e[_0xd93c('0x18')]=_0x385e5c['user'];if(_0x385e5c[_0xd93c('0x19')]){_0x1c620e[_0xd93c('0x1a')]=utils[_0xd93c('0x1b')](_0x385e5c[_0xd93c('0x1c')][_0xd93c('0x1d')],_0x385e5c[_0xd93c('0x18')]);}else{_0x1c620e[_0xd93c('0x1e')]=_0x385e5c[_0xd93c('0x1e')];}}else{if(_0x385e5c[_0xd93c('0x1f')]){_0x1c620e[_0xd93c('0x18')]=_0x385e5c[_0xd93c('0x18')];_0x1c620e[_0xd93c('0x1e')]=_0x385e5c[_0xd93c('0x1e')];}}_0x1c620e[_0xd93c('0x9')]=_0x52da45||_0x385e5c[_0xd93c('0x18')]||_0xd93c('0x20');_0x1c620e[_0xd93c('0x21')]=_0x385e5c[_0xd93c('0x21')];_0x1c620e[_0xd93c('0x22')]=_0x385e5c[_0xd93c('0x22')]||0x3e1;if(_0x385e5c['tls']){_0x1c620e[_0xd93c('0x23')]=!![];}else{_0x1c620e[_0xd93c('0x23')]=![];_0x1c620e[_0xd93c('0x24')]=_0xd93c('0x25');}return _0x1c620e;};EmailImap[_0xd93c('0x15')][_0xd93c('0xf')]=function(){this['imap'][_0xd93c('0x26')](this['mailbox'],![],this[_0xd93c('0x27')]['bind'](this));};EmailImap[_0xd93c('0x15')]['handleOpenBox']=function(_0x528a60,_0xe6407e){if(_0x528a60){this['handleError'](_0x528a60,!![]);}else{this[_0xd93c('0x28')](_0xd93c('0x29'),_0xe6407e);this['readUnseen']();}};EmailImap['prototype'][_0xd93c('0x2a')]=function(_0x4f08fb){if(_0x4f08fb){this[_0xd93c('0x12')](_0x4f08fb,!![]);}else{this[_0xd93c('0x1')][_0xd93c('0x2b')]();}};EmailImap[_0xd93c('0x15')]['readUnseen']=function(){this[_0xd93c('0x1')]['search']([_0xd93c('0x2c')],this['handleReadUnseen']['bind'](this));};EmailImap['prototype'][_0xd93c('0x2d')]=function(_0x1be532,_0x4ec088){if(_0x1be532){this[_0xd93c('0x12')](_0x1be532,!![]);}else{if(_0x4ec088[_0xd93c('0x2e')]){try{var _0xbf1636=this[_0xd93c('0x1')][_0xd93c('0x2f')](_0x4ec088,{'bodies':'','markSeen':!![]});_0xbf1636['on'](_0xd93c('0x30'),this[_0xd93c('0x31')][_0xd93c('0x10')](this));_0xbf1636[_0xd93c('0xd')](_0xd93c('0x11'),this[_0xd93c('0x32')][_0xd93c('0x10')](this));_0xbf1636[_0xd93c('0xd')]('end',this[_0xd93c('0x33')][_0xd93c('0x10')](this));}catch(_0x112a54){logger[_0xd93c('0x11')](_0x112a54);}}else{this[_0xd93c('0x1')][_0xd93c('0x34')](!![],this[_0xd93c('0x2a')][_0xd93c('0x10')](this));}}};EmailImap[_0xd93c('0x15')]['handleFetchMessage']=function(_0x21f3a5){_0x21f3a5['on'](_0xd93c('0x35'),this['handleMessageBody'][_0xd93c('0x10')](this));_0x21f3a5[_0xd93c('0xd')](_0xd93c('0x36'),this[_0xd93c('0x37')][_0xd93c('0x10')](this));_0x21f3a5[_0xd93c('0xd')](_0xd93c('0x2b'),this[_0xd93c('0x38')]['bind'](this));};EmailImap[_0xd93c('0x15')][_0xd93c('0x39')]=function(_0x324839){simpleParser(_0x324839,{'Iconv':Iconv},this['handleSimpleParser'][_0xd93c('0x10')](this));};EmailImap[_0xd93c('0x15')][_0xd93c('0x37')]=function(){};EmailImap[_0xd93c('0x15')][_0xd93c('0x38')]=function(){};EmailImap[_0xd93c('0x15')]['handleSimpleParser']=function(_0x523272,_0x74a02d){if(_0x523272){logger[_0xd93c('0x11')](_0x523272);}else{var _0x5deb93=this;utils['parser'](this[_0xd93c('0xb')],_0x74a02d,function(_0x2fa1a9){_0x5deb93[_0xd93c('0x28')](_0xd93c('0x9'),_0x2fa1a9);});}};EmailImap['prototype'][_0xd93c('0x33')]=function(){this['imap'][_0xd93c('0x34')](!![],this[_0xd93c('0x2a')][_0xd93c('0x10')](this));};EmailImap[_0xd93c('0x15')][_0xd93c('0x32')]=function(_0x58e543){this[_0xd93c('0x12')](_0x58e543);this[_0xd93c('0x1')][_0xd93c('0x34')](!![],this[_0xd93c('0x2a')][_0xd93c('0x10')](this));};EmailImap['prototype'][_0xd93c('0x3a')]=function(){this['emit'](_0xd93c('0x2b'));};EmailImap[_0xd93c('0x15')][_0xd93c('0x12')]=function(_0x4052de,_0x570954){logger['error'](_0xd93c('0x12'),this[_0xd93c('0xb')][_0xd93c('0x9')],JSON['stringify'](_0x4052de));var _0x4d5b91='';if(_0x4052de){if(_0x4052de[_0xd93c('0x3b')]){_0x4d5b91=_0x4052de[_0xd93c('0x3b')];}else{for(var _0x15c8a8 in _0x4052de){if(_0x4052de[_0xd93c('0x3c')](_0x15c8a8)){_0x4d5b91+=_[_0xd93c('0x3d')](_0x15c8a8)+':\x20'+_0x4052de[_0x15c8a8]+'\x0a';}}}}if(_0x570954){this[_0xd93c('0x1')][_0xd93c('0x2b')]();}else{this[_0xd93c('0x28')](_0xd93c('0x11'),_0x4d5b91);this['emit'](_0xd93c('0x2b'));}};module[_0xd93c('0x3e')]=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index 971b80f..afd9268 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 _0xb80a=['nodemailer','nodemailer-plugin-inline-base64','prototype','createTransport','verify','toString','Not\x20verifired'];(function(_0x215cc3,_0x207af0){var _0x36003a=function(_0x3ce29e){while(--_0x3ce29e){_0x215cc3['push'](_0x215cc3['shift']());}};_0x36003a(++_0x207af0);}(_0xb80a,0xd9));var _0xab80=function(_0xef8f2f,_0x971766){_0xef8f2f=_0xef8f2f-0x0;var _0x1e5743=_0xb80a[_0xef8f2f];return _0x1e5743;};'use strict';var nodemailer=require(_0xab80('0x0'));var inlineBase64=require(_0xab80('0x1'));function EmailSmtp(){}EmailSmtp[_0xab80('0x2')]['send']=function(_0x257f8b,_0x15a635){return new Promise(function(_0x119d91,_0x25bf1e){var _0x2c8ce5=nodemailer[_0xab80('0x3')](_0x257f8b);_0x2c8ce5['use']('compile',inlineBase64());_0x2c8ce5['sendMail'](_0x15a635,function(_0x2d583f,_0x377b01){if(_0x2d583f){_0x25bf1e(_0x2d583f['toString']());}else{_0x119d91(_0x377b01);}});});};EmailSmtp['prototype'][_0xab80('0x4')]=function(_0x176d63){return new Promise(function(_0x4bede7,_0x5a2257){var _0xe0b1c0=nodemailer['createTransport'](_0x176d63);_0xe0b1c0[_0xab80('0x4')](function(_0x1a8994,_0x3da61b){if(_0x1a8994){_0x5a2257(_0x1a8994[_0xab80('0x5')]());}else{if(_0x3da61b){_0x4bede7(_0x3da61b);}else{_0x5a2257(_0xab80('0x6'));}}});});};module['exports']=EmailSmtp; \ No newline at end of file +var _0xfff3=['nodemailer','prototype','send','createTransport','use','verify','toString','Not\x20verifired','exports'];(function(_0xffb889,_0x711ac2){var _0x4e8ac0=function(_0x148204){while(--_0x148204){_0xffb889['push'](_0xffb889['shift']());}};_0x4e8ac0(++_0x711ac2);}(_0xfff3,0x87));var _0x3fff=function(_0x39a7af,_0x1a28c9){_0x39a7af=_0x39a7af-0x0;var _0x2d764b=_0xfff3[_0x39a7af];return _0x2d764b;};'use strict';var nodemailer=require(_0x3fff('0x0'));var inlineBase64=require('nodemailer-plugin-inline-base64');function EmailSmtp(){}EmailSmtp[_0x3fff('0x1')][_0x3fff('0x2')]=function(_0x47b023,_0x4924de){return new Promise(function(_0xbc3113,_0x416532){var _0x413c10=nodemailer[_0x3fff('0x3')](_0x47b023);_0x413c10[_0x3fff('0x4')]('compile',inlineBase64());_0x413c10['sendMail'](_0x4924de,function(_0x181495,_0x4a2e4d){if(_0x181495){_0x416532(_0x181495['toString']());}else{_0xbc3113(_0x4a2e4d);}});});};EmailSmtp[_0x3fff('0x1')][_0x3fff('0x5')]=function(_0xac0ab4){return new Promise(function(_0x4b4cc1,_0x41eda2){var _0xd94ca3=nodemailer[_0x3fff('0x3')](_0xac0ab4);_0xd94ca3[_0x3fff('0x5')](function(_0x165102,_0x3c4d15){if(_0x165102){_0x41eda2(_0x165102[_0x3fff('0x6')]());}else{if(_0x3c4d15){_0x4b4cc1(_0x3c4d15);}else{_0x41eda2(_0x3fff('0x7'));}}});});};module[_0x3fff('0x8')]=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index 3346623..e43e6f2 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 _0xeedd=['email','includes','originTo','originCc','bcc','type','attachment','format','now','content','contentType','headerLines','X-Auto-Response-Suppress:\x20All','Precedence:\x20auto_reply','line','isAutoreply','parser','from','subject','inReplyTo','date','YYYY-MM-DD\x20HH:mm:ss','filter','application/ms-tnef','info','Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system','messageId','parseBuffer','first','BodyHTML','

Empty\x20message

','Attachments','user=','utf-8','toString','base64','lodash','moment','randomstring','util','node-tnef','../../../config/logger','../../../config/environment','head','value','address','anonymous','@xcally.com','name','split','length','slice','join','Anonymous','pop','isEmpty','html','test','replace','attachments','forEach','push','filename','_SRC','_IMG','\x20[Attachment:\x20','\x20]','body','textAsHtml','message'];(function(_0x3428a8,_0x4859c7){var _0x538873=function(_0x4ef089){while(--_0x4ef089){_0x3428a8['push'](_0x3428a8['shift']());}};_0x538873(++_0x4859c7);}(_0xeedd,0xf6));var _0xdeed=function(_0x5bdd68,_0x5b7c16){_0x5bdd68=_0x5bdd68-0x0;var _0x3fb14b=_0xeedd[_0x5bdd68];return _0x3fb14b;};'use strict';var _=require(_0xdeed('0x0'));var moment=require(_0xdeed('0x1'));var random=require(_0xdeed('0x2'));var fs=require('fs');var path=require('path');var util=require(_0xdeed('0x3'));var tnef=require(_0xdeed('0x4'));var logger=require(_0xdeed('0x5'))('email');var config=require(_0xdeed('0x6'));function getAddress(_0x5ece91){var _0x278399=_[_0xdeed('0x7')](_0x5ece91[_0xdeed('0x8')]);return _0x278399&&_0x278399[_0xdeed('0x9')]?_0x278399[_0xdeed('0x9')]:_0xdeed('0xa')+random['generate'](0x6)+_0xdeed('0xb');}function getFirstName(_0x12c5b1){var _0x2188b0=_[_0xdeed('0x7')](_0x12c5b1[_0xdeed('0x8')]);if(_0x2188b0&&_0x2188b0['name']){if(_0x2188b0[_0xdeed('0xc')]==_0x2188b0[_0xdeed('0x9')]){return _0x2188b0[_0xdeed('0xc')]['substring'](0x0,_0x2188b0['name']['indexOf']('@'));}var _0x32e008=_0x2188b0[_0xdeed('0xc')][_0xdeed('0xd')](/\s+/);return _0x32e008[_0xdeed('0xe')]>0x1?_0x32e008[_0xdeed('0xf')](0x0,-0x1)[_0xdeed('0x10')]('\x20'):_0x2188b0[_0xdeed('0xc')];}return _0xdeed('0x11');}function getLastName(_0x35d7eb){var _0x31f230=_[_0xdeed('0x7')](_0x35d7eb[_0xdeed('0x8')]);if(_0x31f230&&_0x31f230['name']){var _0x1c54e8=_0x31f230['name'][_0xdeed('0xd')](/\s+/);return _0x1c54e8[_0xdeed('0xe')]>0x1?_0x1c54e8[_0xdeed('0x12')]():'';}return'';}function getMails(_0x361ce7,_0x4796cf){var _0x4c761b='';for(var _0x3d869c=0x0;_0x3d869c<_0x4796cf['value'][_0xdeed('0xe')];_0x3d869c+=0x1){if(_0x4796cf[_0xdeed('0x8')][_0x3d869c][_0xdeed('0x9')]!==_0x361ce7){if(!_[_0xdeed('0x13')](_0x4c761b)){_0x4c761b+=',';}_0x4c761b+=_0x4796cf[_0xdeed('0x8')][_0x3d869c][_0xdeed('0xc')]||_0x4796cf[_0xdeed('0x8')][_0x3d869c]['address']||'';_0x4c761b+='\x20<';_0x4c761b+=_0x4796cf[_0xdeed('0x8')][_0x3d869c][_0xdeed('0x9')]?_0x4796cf[_0xdeed('0x8')][_0x3d869c][_0xdeed('0x9')]:_0xdeed('0xa')+random['generate'](0x6)+_0xdeed('0xb');_0x4c761b+='>';}}return _0x4c761b;}function parseEmail(_0x47fc94,_0x2ba251,_0x51557d){if(_0x2ba251[_0xdeed('0x14')]){var _0x1368d2=/)<[^<]*)*<\/script>/gi;while(_0x1368d2[_0xdeed('0x15')](_0x2ba251['html'])){_0x2ba251[_0xdeed('0x14')]=_0x2ba251[_0xdeed('0x14')][_0xdeed('0x16')](_0x1368d2,'');}if(_0x2ba251[_0xdeed('0x14')]['includes']('{_0x160757[_0xdeed('0x19')](_0x3e2edf[_0xdeed('0x1a')]);});var _0x417b8c=/]+>/g;var _0x241094=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x1af502=_0x2ba251['html']['replace'](_0x241094,_0xdeed('0x1b'));var _0x46c71a=_0x1af502[_0xdeed('0x16')](_0x417b8c,_0xdeed('0x1c'));for(let _0x5bd7fe=0x0;_0x5bd7fe<_0x160757[_0xdeed('0xe')];_0x5bd7fe++){var _0xbdd6e7=_0x46c71a[_0xdeed('0x16')](_0xdeed('0x1c'),_0xdeed('0x1d')+_0x160757[_0x5bd7fe]+_0xdeed('0x1e'));_0x46c71a=_0xbdd6e7;}_0x2ba251[_0xdeed('0x14')]=_0x46c71a;}_0x51557d['body']=_0x2ba251['html'];}else{_0x51557d[_0xdeed('0x1f')]=_0x2ba251[_0xdeed('0x20')];}if(_0x51557d[_0xdeed('0x1f')]){_0x51557d['body']=_0x51557d[_0xdeed('0x1f')]['replace'](/0x0){var _0x2f5c1e=['Auto-Submitted:\x20auto-replied',_0xdeed('0x2e'),_0xdeed('0x2f')];for(var _0x1699db=0x0;_0x1699db<_0x2ba251[_0xdeed('0x2d')][_0xdeed('0xe')];_0x1699db++){var _0x309065=_['indexOf'](_0x2f5c1e,_0x2ba251['headerLines'][_0x1699db][_0xdeed('0x30')]);if(_0x309065>=0x0){_0x51557d[_0xdeed('0x31')]=!![];}}}return _0x51557d;}exports[_0xdeed('0x32')]=function(_0x5465c1,_0x37809b,_0x296303){var _0x2957f4={'from':getAddress(_0x37809b[_0xdeed('0x33')]),'firstName':getFirstName(_0x37809b['from']),'lastName':getLastName(_0x37809b[_0xdeed('0x33')]),'mapKey':_0xdeed('0x22'),'message':{'from':getMails(_0x5465c1[_0xdeed('0x22')],_0x37809b[_0xdeed('0x33')]),'to':_0x5465c1[_0xdeed('0x22')],'cc':'','subject':_0x37809b[_0xdeed('0x34')]||'','messageId':_0x37809b['messageId'],'inReplyTo':_0x37809b[_0xdeed('0x35')],'sentAt':moment(_0x37809b[_0xdeed('0x36')])[_0xdeed('0x29')](_0xdeed('0x37')),'attach':![],'attachments':[]}};if(!_0x37809b[_0xdeed('0x14')]&&!_0x37809b[_0xdeed('0x20')]){var _0x526e05=_[_0xdeed('0x38')](_0x37809b[_0xdeed('0x17')],{'contentType':_0xdeed('0x39')});if(_0x526e05['length']){logger[_0xdeed('0x3a')](util[_0xdeed('0x29')](_0xdeed('0x3b'),_0x37809b[_0xdeed('0x3c')]));tnef[_0xdeed('0x3d')](_[_0xdeed('0x3e')](_0x526e05)[_0xdeed('0x2b')],function(_0x4ded2d,_0x58dabd){if(_0x58dabd){_0x37809b[_0xdeed('0x14')]=_0x58dabd[_0xdeed('0x3f')]||_0xdeed('0x40');if(_0x58dabd[_0xdeed('0x41')]){for(var _0x22ae56=0x0;_0x22ae56<_0x58dabd[_0xdeed('0x41')][_0xdeed('0xe')];_0x22ae56++){var _0x1b6a15=_0x58dabd[_0xdeed('0x41')][_0x22ae56];_0x2957f4[_0xdeed('0x21')][_0xdeed('0x17')][_0xdeed('0x19')]({'filename':_0x1b6a15['Title'],'content':Buffer[_0xdeed('0x33')](_0x1b6a15['Data'])});}}}_0x296303(parseEmail(_0x5465c1,_0x37809b,_0x2957f4));});}else{_0x37809b['html']=_0xdeed('0x40');_0x296303(parseEmail(_0x5465c1,_0x37809b,_0x2957f4));}}else{_0x296303(parseEmail(_0x5465c1,_0x37809b,_0x2957f4));}};exports['generateXOAuth2Token']=function(_0x2b61be,_0x23cf8e){var _0x31a81a=[_0xdeed('0x42')+(_0x23cf8e||''),'auth=Bearer\x20'+_0x2b61be,'',''];return Buffer['from'](_0x31a81a[_0xdeed('0x10')](''),_0xdeed('0x43'))[_0xdeed('0x44')](_0xdeed('0x45'));}; \ No newline at end of file +var _0x07e9=['slice','join','isEmpty','html','test','replace','includes','\x20[Attachment:\x20','\x20]','body','Empty\x20message

','Attachments','Title','Data','user=','auth=Bearer\x20','utf-8','toString','base64','lodash','moment','randomstring','path','util','node-tnef','../../../config/logger','head','address','anonymous','generate','value','name','substring','indexOf','split','length'];(function(_0x337aae,_0x1f3c07){var _0x4da674=function(_0x279b94){while(--_0x279b94){_0x337aae['push'](_0x337aae['shift']());}};_0x4da674(++_0x1f3c07);}(_0x07e9,0xcd));var _0x907e=function(_0x389213,_0x14a50d){_0x389213=_0x389213-0x0;var _0x4ad6ca=_0x07e9[_0x389213];return _0x4ad6ca;};'use strict';var _=require(_0x907e('0x0'));var moment=require(_0x907e('0x1'));var random=require(_0x907e('0x2'));var fs=require('fs');var path=require(_0x907e('0x3'));var util=require(_0x907e('0x4'));var tnef=require(_0x907e('0x5'));var logger=require(_0x907e('0x6'))('email');var config=require('../../../config/environment');function getAddress(_0x55923b){var _0x119256=_[_0x907e('0x7')](_0x55923b['value']);return _0x119256&&_0x119256[_0x907e('0x8')]?_0x119256[_0x907e('0x8')]:_0x907e('0x9')+random[_0x907e('0xa')](0x6)+'@xcally.com';}function getFirstName(_0x395bda){var _0xd428af=_[_0x907e('0x7')](_0x395bda[_0x907e('0xb')]);if(_0xd428af&&_0xd428af[_0x907e('0xc')]){if(_0xd428af[_0x907e('0xc')]==_0xd428af[_0x907e('0x8')]){return _0xd428af['name'][_0x907e('0xd')](0x0,_0xd428af['name'][_0x907e('0xe')]('@'));}var _0x5c66c9=_0xd428af[_0x907e('0xc')][_0x907e('0xf')](/\s+/);return _0x5c66c9[_0x907e('0x10')]>0x1?_0x5c66c9[_0x907e('0x11')](0x0,-0x1)[_0x907e('0x12')]('\x20'):_0xd428af[_0x907e('0xc')];}return'Anonymous';}function getLastName(_0x51a7b7){var _0xaa93ec=_[_0x907e('0x7')](_0x51a7b7['value']);if(_0xaa93ec&&_0xaa93ec[_0x907e('0xc')]){var _0x38a1a6=_0xaa93ec[_0x907e('0xc')][_0x907e('0xf')](/\s+/);return _0x38a1a6[_0x907e('0x10')]>0x1?_0x38a1a6['pop']():'';}return'';}function getMails(_0x504d74,_0x13d628){var _0x187313='';for(var _0x1e7bc5=0x0;_0x1e7bc5<_0x13d628[_0x907e('0xb')][_0x907e('0x10')];_0x1e7bc5+=0x1){if(_0x13d628[_0x907e('0xb')][_0x1e7bc5][_0x907e('0x8')]!==_0x504d74){if(!_[_0x907e('0x13')](_0x187313)){_0x187313+=',';}_0x187313+=_0x13d628[_0x907e('0xb')][_0x1e7bc5][_0x907e('0xc')]||_0x13d628[_0x907e('0xb')][_0x1e7bc5][_0x907e('0x8')]||'';_0x187313+='\x20<';_0x187313+=_0x13d628['value'][_0x1e7bc5][_0x907e('0x8')]?_0x13d628[_0x907e('0xb')][_0x1e7bc5][_0x907e('0x8')]:'anonymous'+random[_0x907e('0xa')](0x6)+'@xcally.com';_0x187313+='>';}}return _0x187313;}function parseEmail(_0x51cc79,_0x40a3b7,_0x4ff043){if(_0x40a3b7[_0x907e('0x14')]){var _0x22e6cf=/)<[^<]*)*<\/script>/gi;while(_0x22e6cf[_0x907e('0x15')](_0x40a3b7[_0x907e('0x14')])){_0x40a3b7['html']=_0x40a3b7[_0x907e('0x14')][_0x907e('0x16')](_0x22e6cf,'');}if(_0x40a3b7[_0x907e('0x14')][_0x907e('0x17')](_0x907e('0x18'))){var _0x3035df=[];_0x40a3b7['attachments']['forEach'](_0x3ff632=>{_0x3035df[_0x907e('0x19')](_0x3ff632['filename']);});var _0x542a27=/]+>/g;var _0x2e06de=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x348d4b=_0x40a3b7[_0x907e('0x14')][_0x907e('0x16')](_0x2e06de,_0x907e('0x1a'));var _0x5a5d44=_0x348d4b['replace'](_0x542a27,_0x907e('0x1b'));for(let _0x3321f6=0x0;_0x3321f6<_0x3035df['length'];_0x3321f6++){var _0x404ad8=_0x5a5d44['replace'](_0x907e('0x1b'),_0x907e('0x1c')+_0x3035df[_0x3321f6]+_0x907e('0x1d'));_0x5a5d44=_0x404ad8;}_0x40a3b7['html']=_0x5a5d44;}_0x4ff043[_0x907e('0x1e')]=_0x40a3b7[_0x907e('0x14')];}else{_0x4ff043[_0x907e('0x1e')]=_0x40a3b7['textAsHtml'];}if(_0x4ff043['body']){_0x4ff043[_0x907e('0x1e')]=_0x4ff043[_0x907e('0x1e')][_0x907e('0x16')](/0x0){var _0x3bb180=[_0x907e('0x30'),'X-Auto-Response-Suppress:\x20All',_0x907e('0x31')];for(var _0x48bdb7=0x0;_0x48bdb7<_0x40a3b7[_0x907e('0x2f')][_0x907e('0x10')];_0x48bdb7++){var _0x240ab9=_[_0x907e('0xe')](_0x3bb180,_0x40a3b7[_0x907e('0x2f')][_0x48bdb7][_0x907e('0x32')]);if(_0x240ab9>=0x0){_0x4ff043[_0x907e('0x33')]=!![];}}}return _0x4ff043;}exports[_0x907e('0x34')]=function(_0x405250,_0x3e6bea,_0x749541){var _0x45cd7a={'from':getAddress(_0x3e6bea[_0x907e('0x35')]),'firstName':getFirstName(_0x3e6bea[_0x907e('0x35')]),'lastName':getLastName(_0x3e6bea[_0x907e('0x35')]),'mapKey':_0x907e('0x22'),'message':{'from':getMails(_0x405250[_0x907e('0x22')],_0x3e6bea[_0x907e('0x35')]),'to':_0x405250[_0x907e('0x22')],'cc':'','subject':_0x3e6bea['subject']||'','messageId':_0x3e6bea[_0x907e('0x36')],'inReplyTo':_0x3e6bea[_0x907e('0x37')],'sentAt':moment(_0x3e6bea['date'])['format'](_0x907e('0x38')),'attach':![],'attachments':[]}};if(!_0x3e6bea['html']&&!_0x3e6bea[_0x907e('0x39')]){var _0x32c4af=_[_0x907e('0x3a')](_0x3e6bea[_0x907e('0x24')],{'contentType':_0x907e('0x3b')});if(_0x32c4af[_0x907e('0x10')]){logger[_0x907e('0x3c')](util[_0x907e('0x2a')](_0x907e('0x3d'),_0x3e6bea[_0x907e('0x36')]));tnef['parseBuffer'](_[_0x907e('0x3e')](_0x32c4af)[_0x907e('0x3f')],function(_0x2db654,_0x453194){if(_0x453194){_0x3e6bea[_0x907e('0x14')]=_0x453194[_0x907e('0x40')]||_0x907e('0x41');if(_0x453194[_0x907e('0x42')]){for(var _0x3a2c5e=0x0;_0x3a2c5e<_0x453194['Attachments']['length'];_0x3a2c5e++){var _0x5f5485=_0x453194[_0x907e('0x42')][_0x3a2c5e];_0x45cd7a[_0x907e('0x20')]['attachments'][_0x907e('0x19')]({'filename':_0x5f5485[_0x907e('0x43')],'content':Buffer[_0x907e('0x35')](_0x5f5485[_0x907e('0x44')])});}}}_0x749541(parseEmail(_0x405250,_0x3e6bea,_0x45cd7a));});}else{_0x3e6bea[_0x907e('0x14')]=_0x907e('0x41');_0x749541(parseEmail(_0x405250,_0x3e6bea,_0x45cd7a));}}else{_0x749541(parseEmail(_0x405250,_0x3e6bea,_0x45cd7a));}};exports['generateXOAuth2Token']=function(_0x53cea5,_0x57a15c){var _0x286a9c=[_0x907e('0x45')+(_0x57a15c||''),_0x907e('0x46')+_0x53cea5,'',''];return Buffer['from'](_0x286a9c[_0x907e('0x12')](''),_0x907e('0x47'))[_0x907e('0x48')](_0x907e('0x49'));}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index ef70bee..14cab03 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 _0xdebd=['SERV','active','Imap','Smtp','Service','key'];(function(_0x368bba,_0x1f625b){var _0x409f8f=function(_0x463373){while(--_0x463373){_0x368bba['push'](_0x368bba['shift']());}};_0x409f8f(++_0x1f625b);}(_0xdebd,0xac));var _0xddeb=function(_0x114984,_0x1d0126){_0x114984=_0x114984-0x0;var _0x5b6edf=_0xdebd[_0x114984];return _0x5b6edf;};'use strict';var _=require('lodash');function MailAccount(_0x5941fd){this['id']=_0x5941fd['id']||0x0;this['name']=_0x5941fd['name']||_0xddeb('0x0');this[_0xddeb('0x1')]=_0x5941fd['key']||_0xddeb('0x2');this[_0xddeb('0x3')]=_0x5941fd[_0xddeb('0x3')]||![];this[_0xddeb('0x4')]=_0x5941fd[_0xddeb('0x4')]||[];this['Smtp']=_0x5941fd[_0xddeb('0x5')]||[];}module['exports']=MailAccount; \ No newline at end of file +var _0xa30a=['exports','lodash','name','Service','key','SERV','active','Imap','Smtp'];(function(_0x2e2c1b,_0x94deaf){var _0x43a4f2=function(_0x421a57){while(--_0x421a57){_0x2e2c1b['push'](_0x2e2c1b['shift']());}};_0x43a4f2(++_0x94deaf);}(_0xa30a,0x157));var _0xaa30=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xa30a[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xaa30('0x0'));function MailAccount(_0x4bc04d){this['id']=_0x4bc04d['id']||0x0;this[_0xaa30('0x1')]=_0x4bc04d['name']||_0xaa30('0x2');this[_0xaa30('0x3')]=_0x4bc04d[_0xaa30('0x3')]||_0xaa30('0x4');this[_0xaa30('0x5')]=_0x4bc04d['active']||![];this[_0xaa30('0x6')]=_0x4bc04d[_0xaa30('0x6')]||[];this[_0xaa30('0x7')]=_0x4bc04d[_0xaa30('0x7')]||[];}module[_0xaa30('0x8')]=MailAccount; \ No newline at end of file diff --git a/server/services/email/realtime/index.js b/server/services/email/realtime/index.js index 8c334a9..ecbdbf1 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 _0x5ff8=['hasOwnProperty','prototype','mergeFromDatabase','exports','lodash','mailAccounts','mapKeys'];(function(_0x4ec90d,_0x5f80cb){var _0x371da6=function(_0x186a68){while(--_0x186a68){_0x4ec90d['push'](_0x4ec90d['shift']());}};_0x371da6(++_0x5f80cb);}(_0x5ff8,0x17e));var _0x85ff=function(_0x459774,_0x537389){_0x459774=_0x459774-0x0;var _0x1adcc3=_0x5ff8[_0x459774];return _0x1adcc3;};'use strict';var _=require(_0x85ff('0x0'));var MailAccount=require('../model/mailAccount');var Realtime=function(){this[_0x85ff('0x1')]={};};function freeIsNotKey(_0x678ae7,_0x1ebb2d,_0x2238da){var _0x19c0c0=_[_0x85ff('0x2')](_0x678ae7,function(_0x4e8296,_0x20c040){return _0x4e8296[_0x2238da];});for(var _0x15ce3e in _0x1ebb2d){if(_0x1ebb2d[_0x85ff('0x3')](_0x15ce3e)){if(!_0x19c0c0[_0x15ce3e]){delete _0x1ebb2d[_0x15ce3e];}}}}Realtime[_0x85ff('0x4')][_0x85ff('0x5')]=function(_0x42e2e3,_0x3584f9){for(var _0x2cf778 in _0x3584f9){if(_0x42e2e3[_0x85ff('0x3')](_0x2cf778)){_0x42e2e3[_0x2cf778]=_0x3584f9[_0x2cf778];}}};Realtime[_0x85ff('0x4')]['initMailAccounts']=function(){var _0x209247=this;return function(_0x41d934){if(_0x41d934){freeIsNotKey(_0x41d934,_0x209247[_0x85ff('0x1')],'id');for(var _0x2d6d84=0x0,_0x3f0a2a={},_0x349621={};_0x2d6d84<_0x41d934['length'];_0x2d6d84+=0x1){_0x3f0a2a=_0x41d934[_0x2d6d84];if(_['isUndefined'](_0x209247[_0x85ff('0x1')][_0x3f0a2a['id']])){_0x209247[_0x85ff('0x1')][_0x3f0a2a['id']]=new MailAccount(_0x3f0a2a);}else{_['merge'](_0x209247[_0x85ff('0x1')][_0x3f0a2a['id']],_0x3f0a2a);}}}return _0x209247[_0x85ff('0x1')];};};module[_0x85ff('0x6')]=Realtime; \ No newline at end of file +var _0xfce1=['length','exports','lodash','../model/mailAccount','mailAccounts','hasOwnProperty','prototype','mergeFromDatabase','initMailAccounts'];(function(_0x4309c3,_0x174bf6){var _0x5ce0a6=function(_0x37094b){while(--_0x37094b){_0x4309c3['push'](_0x4309c3['shift']());}};_0x5ce0a6(++_0x174bf6);}(_0xfce1,0xda));var _0x1fce=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xfce1[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0x1fce('0x0'));var MailAccount=require(_0x1fce('0x1'));var Realtime=function(){this[_0x1fce('0x2')]={};};function freeIsNotKey(_0x399d74,_0x5cde48,_0x350a1c){var _0x251381=_['mapKeys'](_0x399d74,function(_0x29e57f,_0x29a0ab){return _0x29e57f[_0x350a1c];});for(var _0x16b45c in _0x5cde48){if(_0x5cde48[_0x1fce('0x3')](_0x16b45c)){if(!_0x251381[_0x16b45c]){delete _0x5cde48[_0x16b45c];}}}}Realtime[_0x1fce('0x4')][_0x1fce('0x5')]=function(_0x446d95,_0x441bfb){for(var _0x51f994 in _0x441bfb){if(_0x446d95[_0x1fce('0x3')](_0x51f994)){_0x446d95[_0x51f994]=_0x441bfb[_0x51f994];}}};Realtime[_0x1fce('0x4')][_0x1fce('0x6')]=function(){var _0x42e533=this;return function(_0x31bacc){if(_0x31bacc){freeIsNotKey(_0x31bacc,_0x42e533[_0x1fce('0x2')],'id');for(var _0x20d571=0x0,_0x3a704a={},_0x19a102={};_0x20d571<_0x31bacc[_0x1fce('0x7')];_0x20d571+=0x1){_0x3a704a=_0x31bacc[_0x20d571];if(_['isUndefined'](_0x42e533[_0x1fce('0x2')][_0x3a704a['id']])){_0x42e533[_0x1fce('0x2')][_0x3a704a['id']]=new MailAccount(_0x3a704a);}else{_['merge'](_0x42e533[_0x1fce('0x2')][_0x3a704a['id']],_0x3a704a);}}}return _0x42e533[_0x1fce('0x2')];};};module[_0x1fce('0x8')]=Realtime; \ No newline at end of file diff --git a/server/services/email/rpc/mailAccount.js b/server/services/email/rpc/mailAccount.js index faaf5bd..5ecb079 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 _0xa456=['Request','GetMailAccount','provider','service','email','key','ListId','TemplateId','MailServerIn','CloudProvider','name','type','data5','MailServerOut','notify','NotifyMailAccount','../client','getMailAccounts'];(function(_0x49be9d,_0x53fcd4){var _0x313bca=function(_0x119f7a){while(--_0x119f7a){_0x49be9d['push'](_0x49be9d['shift']());}};_0x313bca(++_0x53fcd4);}(_0xa456,0x142));var _0x6a45=function(_0x307d86,_0x9264f2){_0x307d86=_0x307d86-0x0;var _0x361745=_0xa456[_0x307d86];return _0x361745;};'use strict';var client=require(_0x6a45('0x0'));exports[_0x6a45('0x1')]=function(){return function(){return client[_0x6a45('0x2')](_0x6a45('0x3'),{'options':{'attributes':['id','name',_0x6a45('0x4'),_0x6a45('0x5'),_0x6a45('0x6'),'active',_0x6a45('0x7'),_0x6a45('0x8'),_0x6a45('0x9')],'raw':![],'include':[{'model':_0x6a45('0xa'),'as':'Imap','include':[{'model':_0x6a45('0xb'),'attributes':['id',_0x6a45('0xc'),_0x6a45('0x5'),_0x6a45('0xd'),_0x6a45('0xe')],'as':'CloudProvider'}]},{'model':_0x6a45('0xf'),'as':'Smtp','include':[{'model':_0x6a45('0xb'),'attributes':['id',_0x6a45('0xc'),_0x6a45('0x5'),_0x6a45('0xd'),_0x6a45('0xe')],'as':'CloudProvider'}]}]},'log':'getMailAccount'});};};exports[_0x6a45('0x10')]=function(_0x465b59,_0x4b7f6d){return client['Request']('NotifyMailAccount',{'account':{'id':_0x465b59},'body':_0x4b7f6d,'log':_0x6a45('0x11')});}; \ No newline at end of file +var _0xf954=['data5','getMailAccount','notify','NotifyMailAccount','../client','getMailAccounts','Request','GetMailAccount','name','provider','service','key','ListId','TemplateId','MailServerIn','CloudProvider','type','MailServerOut','Smtp'];(function(_0x410de0,_0x1075f8){var _0x23d4df=function(_0x3426ea){while(--_0x3426ea){_0x410de0['push'](_0x410de0['shift']());}};_0x23d4df(++_0x1075f8);}(_0xf954,0x10e));var _0x4f95=function(_0x2489f6,_0x299706){_0x2489f6=_0x2489f6-0x0;var _0x1cf056=_0xf954[_0x2489f6];return _0x1cf056;};'use strict';var client=require(_0x4f95('0x0'));exports[_0x4f95('0x1')]=function(){return function(){return client[_0x4f95('0x2')](_0x4f95('0x3'),{'options':{'attributes':['id',_0x4f95('0x4'),_0x4f95('0x5'),_0x4f95('0x6'),'email','active',_0x4f95('0x7'),_0x4f95('0x8'),_0x4f95('0x9')],'raw':![],'include':[{'model':_0x4f95('0xa'),'as':'Imap','include':[{'model':_0x4f95('0xb'),'attributes':['id',_0x4f95('0x4'),_0x4f95('0x6'),_0x4f95('0xc'),'data5'],'as':'CloudProvider'}]},{'model':_0x4f95('0xd'),'as':_0x4f95('0xe'),'include':[{'model':_0x4f95('0xb'),'attributes':['id','name','service','type',_0x4f95('0xf')],'as':_0x4f95('0xb')}]}]},'log':_0x4f95('0x10')});};};exports[_0x4f95('0x11')]=function(_0x5e73ae,_0x16f9c0){return client[_0x4f95('0x2')](_0x4f95('0x12'),{'account':{'id':_0x5e73ae},'body':_0x16f9c0,'log':_0x4f95('0x12')});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index 7e4338a..770ac03 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 _0x029b=['GetSettings','getSettings','ShowSetting','loginMailFrequency'];(function(_0x4963c6,_0x13a5a1){var _0x15bf25=function(_0x58282f){while(--_0x58282f){_0x4963c6['push'](_0x4963c6['shift']());}};_0x15bf25(++_0x13a5a1);}(_0x029b,0x69));var _0xb029=function(_0x560d5a,_0x51b133){_0x560d5a=_0x560d5a-0x0;var _0x265ec0=_0x029b[_0x560d5a];return _0x265ec0;};'use strict';var client=require('../client');exports[_0xb029('0x0')]=function(){return client['Request'](_0xb029('0x1'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xb029('0x2')]},'log':_0xb029('0x3')});}; \ No newline at end of file +var _0xe14d=['getSettings','ShowSetting','loginMailFrequency','GetSettings','../client'];(function(_0x3ea25b,_0xe9f5df){var _0x1922cc=function(_0x5c89e3){while(--_0x5c89e3){_0x3ea25b['push'](_0x3ea25b['shift']());}};_0x1922cc(++_0xe9f5df);}(_0xe14d,0x18a));var _0xde14=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0xe14d[_0x45e98e];return _0x374dba;};'use strict';var client=require(_0xde14('0x0'));exports[_0xde14('0x1')]=function(){return client['Request'](_0xde14('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xde14('0x3')]},'log':_0xde14('0x4')});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index ec09c86..2d1d2b5 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(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0xa9e0[_0x311c35];return _0x5cc50c;};'use strict';var jayson=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var logger=require('../../../config/logger')('email');exports[_0x0a9e('0x3')]=function(_0x4ce2f1,_0x333808){return new BPromise(function(_0x432180,_0x2ab90b){var _0x991246={'SendMail':function(_0x981158){var _0x57b080=this;return new Promise(function(_0x219af0,_0x441e3a){_0x333808[_0x0a9e('0x4')](_0x981158['account'],_0x981158['message'])[_0x0a9e('0x5')](function(_0x56465b){_0x219af0({'code':0xc8,'message':_0x56465b});})['catch'](function(_0x39753a){_0x441e3a(_0x57b080[_0x0a9e('0x6')](0x1f4,_0x39753a));});});},'VerifySmtp':function(_0x307b3e){var _0x3ab53f=this;return new Promise(function(_0xfeb75b,_0xbd1168){_0x333808['verifySmtp'](_0x307b3e['account'])['then'](function(_0x4cfe67){_0xfeb75b({'code':0xc8,'message':_0x0a9e('0x7')});})[_0x0a9e('0x8')](function(_0xd5b662){_0xbd1168(_0x3ab53f[_0x0a9e('0x6')](0x1f4,_0xd5b662));});});},'MailAccounts':function(_0x32d742){return new Promise(function(_0x69aeb7,_0x5db4b0){var _0x4283ce=_[_0x0a9e('0x9')](_0x4ce2f1[_0x0a9e('0xa')]);for(var _0x281129=0x0;_0x281129<_0x4283ce[_0x0a9e('0xb')];_0x281129+=0x1){if(_0x4283ce[_0x281129][_0x0a9e('0xc')]&&_0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')]){delete _0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')];}if(_0x4283ce[_0x281129]['Smtp']&&_0x4283ce[_0x281129][_0x0a9e('0xe')][_0x0a9e('0xf')]){delete _0x4283ce[_0x281129]['Smtp'][_0x0a9e('0xf')];}}_0x69aeb7({'count':_0x4283ce['length'],'rows':_0x4283ce});});}};var _0x459eb1=jayson[_0x0a9e('0x10')](_0x991246)[_0x0a9e('0x11')]();_0x459eb1['on'](_0x0a9e('0x6'),function(_0x31b1ca){logger[_0x0a9e('0x6')](JSON[_0x0a9e('0x12')](_0x31b1ca));return _0x2ab90b(_0x31b1ca);});_0x459eb1[_0x0a9e('0x3')](0x232b,_0x0a9e('0x13'),function(){console[_0x0a9e('0x14')](_0x0a9e('0x15'),0x232b);return _0x432180(_0x0a9e('0x16')+0x232b);});});}; \ No newline at end of file +var _0xa9e0=['catch','values','mailAccounts','length','Imap','password','Smtp','pass','server','http','stringify','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','lodash','listen','sendMail','then','error','Verified'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4e1d03,_0x786f3a){_0x4e1d03=_0x4e1d03-0x0;var _0x362d4b=_0xa9e0[_0x4e1d03];return _0x362d4b;};'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 2e08aed..d496948 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 _0x9b53=['Express\x20server\x20listening\x20on\x20port\x20%d!','exports','lodash','http','express','sticky-session','createServer','timeout','listen','port','socket.io','polling','redis','defaults','localhost','adapter','socket.io-redis','../../config/triggers','default','../../config/socketio','../../config/express','../../routes','once','listening'];(function(_0x4a4bb9,_0x27be63){var _0x4339d2=function(_0x1bf09e){while(--_0x1bf09e){_0x4a4bb9['push'](_0x4a4bb9['shift']());}};_0x4339d2(++_0x27be63);}(_0x9b53,0x10a));var _0x39b5=function(_0x4e2be4,_0x7d04a9){_0x4e2be4=_0x4e2be4-0x0;var _0x4b485e=_0x9b53[_0x4e2be4];return _0x4b485e;};'use strict';var _=require(_0x39b5('0x0'));var http=require(_0x39b5('0x1'));var express=require(_0x39b5('0x2'));var sticky=require(_0x39b5('0x3'));var Redis=require('ioredis');var config=require('../../config/environment');var app=express();var server=http[_0x39b5('0x4')](app);server[_0x39b5('0x5')]=0xdbba0;if(sticky[_0x39b5('0x6')](server,config[_0x39b5('0x7')])){var socketio=require(_0x39b5('0x8'))(server,{'transports':['websocket',_0x39b5('0x9')]});config[_0x39b5('0xa')]=_[_0x39b5('0xb')](config[_0x39b5('0xa')],{'host':_0x39b5('0xc'),'port':0x18eb});socketio[_0x39b5('0xd')](require(_0x39b5('0xe'))({'pubClient':new Redis(config['redis']),'subClient':new Redis(config[_0x39b5('0xa')])}));require(_0x39b5('0xf'))[_0x39b5('0x10')]();require(_0x39b5('0x11'))[_0x39b5('0x10')](socketio);require(_0x39b5('0x12'))['default'](app);require(_0x39b5('0x13'))[_0x39b5('0x10')](app);}else{server[_0x39b5('0x14')](_0x39b5('0x15'),function(){console['log'](_0x39b5('0x16'),config[_0x39b5('0x7')]);});}exports=module[_0x39b5('0x17')]=app; \ No newline at end of file +var _0x825f=['localhost','adapter','socket.io-redis','../../config/triggers','default','../../config/express','../../routes','once','listening','log','Express\x20server\x20listening\x20on\x20port\x20%d!','exports','lodash','http','express','ioredis','../../config/environment','createServer','timeout','listen','port','websocket','polling','redis','defaults'];(function(_0x370eb4,_0x4fcacd){var _0x359f4c=function(_0x3ac5b5){while(--_0x3ac5b5){_0x370eb4['push'](_0x370eb4['shift']());}};_0x359f4c(++_0x4fcacd);}(_0x825f,0x16a));var _0xf825=function(_0x41ef95,_0x44b8cf){_0x41ef95=_0x41ef95-0x0;var _0x2f966d=_0x825f[_0x41ef95];return _0x2f966d;};'use strict';var _=require(_0xf825('0x0'));var http=require(_0xf825('0x1'));var express=require(_0xf825('0x2'));var sticky=require('sticky-session');var Redis=require(_0xf825('0x3'));var config=require(_0xf825('0x4'));var app=express();var server=http[_0xf825('0x5')](app);server[_0xf825('0x6')]=0xdbba0;if(sticky[_0xf825('0x7')](server,config[_0xf825('0x8')])){var socketio=require('socket.io')(server,{'transports':[_0xf825('0x9'),_0xf825('0xa')]});config[_0xf825('0xb')]=_[_0xf825('0xc')](config[_0xf825('0xb')],{'host':_0xf825('0xd'),'port':0x18eb});socketio[_0xf825('0xe')](require(_0xf825('0xf'))({'pubClient':new Redis(config[_0xf825('0xb')]),'subClient':new Redis(config[_0xf825('0xb')])}));require(_0xf825('0x10'))[_0xf825('0x11')]();require('../../config/socketio')[_0xf825('0x11')](socketio);require(_0xf825('0x12'))[_0xf825('0x11')](app);require(_0xf825('0x13'))[_0xf825('0x11')](app);}else{server[_0xf825('0x14')](_0xf825('0x15'),function(){console[_0xf825('0x16')](_0xf825('0x17'),config[_0xf825('0x8')]);});}exports=module[_0xf825('0x18')]=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index 07369af..94c2f91 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 _0x6b2d=['rpc','error','routing','message','result','exports','../../config/logger','http','request','then','debug'];(function(_0x2afb08,_0x324211){var _0x38cc5a=function(_0x5ac471){while(--_0x5ac471){_0x2afb08['push'](_0x2afb08['shift']());}};_0x38cc5a(++_0x324211);}(_0x6b2d,0xb6));var _0xd6b2=function(_0xe5df0a,_0x19fc71){_0xe5df0a=_0xe5df0a-0x0;var _0xeeacdc=_0x6b2d[_0xe5df0a];return _0xeeacdc;};'use strict';var jayson=require('jayson/promise');var BPromise=require('bluebird');var logger=require(_0xd6b2('0x0'))('routing');var client=jayson['client'][_0xd6b2('0x1')]({'port':0x2329});client['Request']=function(_0x349fd1,_0x383423){return new BPromise(function(_0xd7420e,_0x2d6d71){return client[_0xd6b2('0x2')](_0x349fd1,_0x383423)[_0xd6b2('0x3')](function(_0xba9f73){logger[_0xd6b2('0x4')](_0xd6b2('0x5'),'routing',_0x349fd1,_0x383423,_0xba9f73);if(_0xba9f73[_0xd6b2('0x6')]){logger[_0xd6b2('0x6')](_0xd6b2('0x5'),_0xd6b2('0x7'),_0x349fd1,_0xba9f73[_0xd6b2('0x6')][_0xd6b2('0x8')],_0x383423);return _0x2d6d71(_0xba9f73[_0xd6b2('0x6')][_0xd6b2('0x8')]);}else{return _0xd7420e(_0xba9f73[_0xd6b2('0x9')]);}})['catch'](function(_0x26915f){logger[_0xd6b2('0x6')](_0xd6b2('0x5'),_0xd6b2('0x7'),_0x349fd1,_0x26915f,_0x383423);return _0x2d6d71(_0x26915f);});});};module[_0xd6b2('0xa')]=client; \ No newline at end of file +var _0x5e97=['http','Request','debug','rpc','error','message','result','catch','routing'];(function(_0x9bb7bc,_0x1bcf4f){var _0x2c27cd=function(_0x457c66){while(--_0x457c66){_0x9bb7bc['push'](_0x9bb7bc['shift']());}};_0x2c27cd(++_0x1bcf4f);}(_0x5e97,0x1a6));var _0x75e9=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x5e97[_0x397e5f];return _0x5302b8;};'use strict';var jayson=require('jayson/promise');var BPromise=require('bluebird');var logger=require('../../config/logger')(_0x75e9('0x0'));var client=jayson['client'][_0x75e9('0x1')]({'port':0x2329});client[_0x75e9('0x2')]=function(_0x1807e4,_0x35aa18){return new BPromise(function(_0x2dd897,_0x598674){return client['request'](_0x1807e4,_0x35aa18)['then'](function(_0x2bc4ef){logger[_0x75e9('0x3')](_0x75e9('0x4'),_0x75e9('0x0'),_0x1807e4,_0x35aa18,_0x2bc4ef);if(_0x2bc4ef[_0x75e9('0x5')]){logger[_0x75e9('0x5')](_0x75e9('0x4'),_0x75e9('0x0'),_0x1807e4,_0x2bc4ef[_0x75e9('0x5')][_0x75e9('0x6')],_0x35aa18);return _0x598674(_0x2bc4ef[_0x75e9('0x5')][_0x75e9('0x6')]);}else{return _0x2dd897(_0x2bc4ef[_0x75e9('0x7')]);}})[_0x75e9('0x8')](function(_0x5d9953){logger[_0x75e9('0x5')](_0x75e9('0x4'),_0x75e9('0x0'),_0x1807e4,_0x5d9953,_0x35aa18);return _0x598674(_0x5d9953);});});};module['exports']=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index 0c1c0f7..4a25c52 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 _0x5043=['./rpc/whatsappQueue','resolve','getAgents','then','getIntervals','getOpenchannelQueues','getChatQueues','initChatQueues','getSmsQueues','initSmsQueues','getMailQueues','initMailQueues','getFaxQueues','initFaxQueues','getWhatsappQueues','initWhatsappQueues','listen','catch','log','bluebird','./server','./realtime','./rpc/user','./rpc/interval','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/faxQueue'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x5043,0x118));var _0x3504=function(_0x3774da,_0x15eba7){_0x3774da=_0x3774da-0x0;var _0x5af791=_0x5043[_0x3774da];return _0x5af791;};'use strict';var BPromise=require(_0x3504('0x0'));var server=require(_0x3504('0x1'));var Realtime=require(_0x3504('0x2'));var user=require(_0x3504('0x3'));var interval=require(_0x3504('0x4'));var openchannelQueue=require(_0x3504('0x5'));var chatQueue=require(_0x3504('0x6'));var smsQueue=require(_0x3504('0x7'));var mailQueue=require(_0x3504('0x8'));var faxQueue=require(_0x3504('0x9'));var whatsappQueue=require(_0x3504('0xa'));var realtime=new Realtime();function initRealtime(){return BPromise[_0x3504('0xb')]()['then'](user[_0x3504('0xc')]())['then'](realtime['initAgents']())[_0x3504('0xd')](interval[_0x3504('0xe')]())[_0x3504('0xd')](realtime['initIntervals']())['then'](openchannelQueue[_0x3504('0xf')]())[_0x3504('0xd')](realtime['initOpenchannelQueues']())[_0x3504('0xd')](chatQueue[_0x3504('0x10')]())[_0x3504('0xd')](realtime[_0x3504('0x11')]())[_0x3504('0xd')](smsQueue[_0x3504('0x12')]())[_0x3504('0xd')](realtime[_0x3504('0x13')]())['then'](mailQueue[_0x3504('0x14')]())[_0x3504('0xd')](realtime[_0x3504('0x15')]())[_0x3504('0xd')](faxQueue[_0x3504('0x16')]())[_0x3504('0xd')](realtime[_0x3504('0x17')]())[_0x3504('0xd')](whatsappQueue[_0x3504('0x18')]())['then'](realtime[_0x3504('0x19')]())[_0x3504('0xd')](function(){return realtime;});}function main(){return server[_0x3504('0x1a')](realtime)['then'](function(_0x231c68){return initRealtime();})[_0x3504('0xd')](function(_0xf8a10e){return setInterval(initRealtime,0x1388);})[_0x3504('0x1b')](function(_0x580182){console[_0x3504('0x1c')](_0x580182);});}main(); \ No newline at end of file +var _0x7bd7=['bluebird','./server','./realtime','./rpc/user','./rpc/interval','./rpc/openchannelQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/faxQueue','resolve','then','getAgents','initAgents','initIntervals','getOpenchannelQueues','getChatQueues','initChatQueues','getSmsQueues','initSmsQueues','getMailQueues','getFaxQueues','initFaxQueues','getWhatsappQueues','initWhatsappQueues','listen','catch','log'];(function(_0x5f3f88,_0x562baf){var _0xd08119=function(_0x42dbf7){while(--_0x42dbf7){_0x5f3f88['push'](_0x5f3f88['shift']());}};_0xd08119(++_0x562baf);}(_0x7bd7,0xd8));var _0x77bd=function(_0xdaae2c,_0x463a91){_0xdaae2c=_0xdaae2c-0x0;var _0x1eb080=_0x7bd7[_0xdaae2c];return _0x1eb080;};'use strict';var BPromise=require(_0x77bd('0x0'));var server=require(_0x77bd('0x1'));var Realtime=require(_0x77bd('0x2'));var user=require(_0x77bd('0x3'));var interval=require(_0x77bd('0x4'));var openchannelQueue=require(_0x77bd('0x5'));var chatQueue=require('./rpc/chatQueue');var smsQueue=require(_0x77bd('0x6'));var mailQueue=require(_0x77bd('0x7'));var faxQueue=require(_0x77bd('0x8'));var whatsappQueue=require('./rpc/whatsappQueue');var realtime=new Realtime();function initRealtime(){return BPromise[_0x77bd('0x9')]()[_0x77bd('0xa')](user[_0x77bd('0xb')]())[_0x77bd('0xa')](realtime[_0x77bd('0xc')]())[_0x77bd('0xa')](interval['getIntervals']())[_0x77bd('0xa')](realtime[_0x77bd('0xd')]())[_0x77bd('0xa')](openchannelQueue[_0x77bd('0xe')]())['then'](realtime['initOpenchannelQueues']())['then'](chatQueue[_0x77bd('0xf')]())['then'](realtime[_0x77bd('0x10')]())[_0x77bd('0xa')](smsQueue[_0x77bd('0x11')]())[_0x77bd('0xa')](realtime[_0x77bd('0x12')]())['then'](mailQueue[_0x77bd('0x13')]())['then'](realtime['initMailQueues']())['then'](faxQueue[_0x77bd('0x14')]())[_0x77bd('0xa')](realtime[_0x77bd('0x15')]())[_0x77bd('0xa')](whatsappQueue[_0x77bd('0x16')]())['then'](realtime[_0x77bd('0x17')]())[_0x77bd('0xa')](function(){return realtime;});}function main(){return server[_0x77bd('0x18')](realtime)['then'](function(_0x3e2f94){return initRealtime();})[_0x77bd('0xa')](function(_0x36ac32){return setInterval(initRealtime,0x1388);})[_0x77bd('0x19')](function(_0x5743a1){console[_0x77bd('0x1a')](_0x5743a1);});}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 022cf27..7d75917 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 _0xe14b=['next','restart','condition','noop','findRules','matches','turn','length','prioritize','priority','toJSON','map','toString','fromJSON','isString','object','register','exports','lodash','util','isNil','ignoreFactChanges','inherits','prototype','init','rules','activeRules','isArray','concat','push','sync','filter','orderBy','asc','execute','result','clone','consequence','ruleRef','name','index_','nextTick','call'];(function(_0x73ca87,_0x14e1d4){var _0x381288=function(_0x22f2ff){while(--_0x22f2ff){_0x73ca87['push'](_0x73ca87['shift']());}};_0x381288(++_0x14e1d4);}(_0xe14b,0x93));var _0xbe14=function(_0x2340cf,_0x2db0f7){_0x2340cf=_0x2340cf-0x0;var _0x3ccf40=_0xe14b[_0x2340cf];return _0x3ccf40;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var EventEmitter=require('events')['EventEmitter'];function RuleEngine(_0x11c3a0,_0x36393a){this['init']();if(!_[_0xbe14('0x2')](_0x11c3a0)){this['register'](_0x11c3a0);}if(_0x36393a){this['ignoreFactChanges']=_0x36393a[_0xbe14('0x3')];}return this;}util[_0xbe14('0x4')](RuleEngine,EventEmitter);RuleEngine[_0xbe14('0x5')][_0xbe14('0x6')]=function(_0x1d9ade){this[_0xbe14('0x7')]=[];this[_0xbe14('0x8')]=[];};RuleEngine['prototype']['register']=function(_0x496063){if(Array[_0xbe14('0x9')](_0x496063)){this[_0xbe14('0x7')]=this[_0xbe14('0x7')][_0xbe14('0xa')](_0x496063);}else if(_0x496063!==null&&_['isObject'](_0x496063)){this['rules'][_0xbe14('0xb')](_0x496063);}this[_0xbe14('0xc')]();};RuleEngine['prototype'][_0xbe14('0xc')]=function(){this[_0xbe14('0x8')]=this[_0xbe14('0x7')][_0xbe14('0xd')](function(_0x27792f){if(_[_0xbe14('0x2')](_0x27792f['on'])){_0x27792f['on']=!![];}if(_0x27792f['on']===!![]){return _0x27792f;}});this[_0xbe14('0x8')]=_[_0xbe14('0xe')](this[_0xbe14('0x8')],['p'],[_0xbe14('0xf')]);};RuleEngine[_0xbe14('0x5')][_0xbe14('0x10')]=function(_0x813399,_0x530538){var _0x55b3a7=![];_0x813399[_0xbe14('0x11')]=!![];var _0x3dc4a9=_[_0xbe14('0x12')](_0x813399);var _0x37ce4e=_['clone'](_0x813399);var _0x21c789=this[_0xbe14('0x8')];var _0xfd7b8f=[];var _0x123ede=this[_0xbe14('0x3')];(function FnRuleLoop(_0x29ab73){var _0x17ae86={'rules':function(){return _0x21c789;},'rule':function(){return _0x21c789[_0x29ab73];},'when':function(_0x5ea1f8){if(_0x5ea1f8){var _0x137ee5=_0x21c789[_0x29ab73][_0xbe14('0x13')];_0x137ee5[_0xbe14('0x14')]=_0x21c789[_0x29ab73]['id']||_0x21c789[_0x29ab73][_0xbe14('0x15')]||_0xbe14('0x16')+_0x29ab73;process[_0xbe14('0x17')](function(){_0xfd7b8f['push'](_0x137ee5[_0xbe14('0x14')]);_0x137ee5[_0xbe14('0x18')](_0x3dc4a9,_0x17ae86);});}else{process[_0xbe14('0x17')](function(){_0x17ae86[_0xbe14('0x19')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x55b3a7=!![];return FnRuleLoop(0x0);},'next':function(_0x188ec4){if(!_0x123ede&&!_['isEqual'](_0x37ce4e,_0x3dc4a9)){_0x37ce4e=_[_0xbe14('0x12')](_0x3dc4a9);process['nextTick'](function(){_0x17ae86[_0xbe14('0x1a')]();});}else{process['nextTick'](function(){if(_[_0xbe14('0x2')](_0x188ec4)){return FnRuleLoop(_0x29ab73+0x1);}else{return FnRuleLoop(_0x188ec4);}});}}};if(_0x29ab73<_0x21c789['length']&&_0x55b3a7===![]){var _0x274018=_0x21c789[_0x29ab73][_0xbe14('0x1b')];_0x274018['call'](_0x3dc4a9,_0x17ae86);}else{process[_0xbe14('0x17')](function(){_0x3dc4a9['matchPath']=_0xfd7b8f;return _0x530538?_0x530538(_0x3dc4a9):_[_0xbe14('0x1c')]();});}}(0x0));};RuleEngine['prototype'][_0xbe14('0x1d')]=function(_0x5fa043){if(_[_0xbe14('0x2')](_0x5fa043)){return this[_0xbe14('0x7')];}else{var _0x15ef02=_[_0xbe14('0x1e')](_0x5fa043);return _['filter'](this[_0xbe14('0x7')],_0x15ef02);}};RuleEngine[_0xbe14('0x5')][_0xbe14('0x1f')]=function(_0x169369,_0x5dd475){var _0x16f884=_0x169369==='on'||_0x169369==='ON'?!![]:![];var _0x29fc64=this['findRules'](_0x5dd475);for(var _0x3c3613=0x0,_0x3b3e84=_0x29fc64[_0xbe14('0x20')];_0x3c3613<_0x3b3e84;_0x3c3613+=0x1){_0x29fc64[_0x3c3613]['on']=_0x16f884;}this[_0xbe14('0xc')]();};RuleEngine[_0xbe14('0x5')][_0xbe14('0x21')]=function(_0x31a664,_0x2b05cb){_0x31a664=parseInt(_0x31a664,0xa);var _0x4168c8=this[_0xbe14('0x1d')](_0x2b05cb);for(var _0x40538f=0x0,_0x3bf43c=_0x4168c8[_0xbe14('0x20')];_0x40538f<_0x3bf43c;_0x40538f+=0x1){_0x4168c8[_0x40538f][_0xbe14('0x22')]=_0x31a664;}this[_0xbe14('0xc')]();};RuleEngine[_0xbe14('0x5')][_0xbe14('0x23')]=function(){var _0x2ff48e=this[_0xbe14('0x7')];if(_0x2ff48e instanceof Array){_0x2ff48e=_0x2ff48e[_0xbe14('0x24')](function(_0x581e86){_0x581e86[_0xbe14('0x1b')]=_0x581e86['condition']['toString']();_0x581e86[_0xbe14('0x13')]=_0x581e86['consequence'][_0xbe14('0x25')]();return _0x581e86;});}else if(!_[_0xbe14('0x2')](_0x2ff48e)){_0x2ff48e['condition']=_0x2ff48e['condition']['toString']();_0x2ff48e[_0xbe14('0x13')]=_0x2ff48e[_0xbe14('0x13')]['toString']();}return _0x2ff48e;};RuleEngine[_0xbe14('0x5')][_0xbe14('0x26')]=function(_0x452635){this[_0xbe14('0x6')]();if(_[_0xbe14('0x27')](_0x452635)){_0x452635=JSON['parse'](_0x452635);}if(_0x452635 instanceof Array){_0x452635=_0x452635['map'](function(_0x15a997){_0x15a997['condition']=eval('('+_0x15a997['condition']+')');_0x15a997['consequence']=eval('('+_0x15a997[_0xbe14('0x13')]+')');return _0x15a997;});}else if(_0x452635!==null&&typeof _0x452635==_0xbe14('0x28')){_0x452635[_0xbe14('0x1b')]=eval('('+_0x452635[_0xbe14('0x1b')]+')');_0x452635[_0xbe14('0x13')]=eval('('+_0x452635[_0xbe14('0x13')]+')');}this[_0xbe14('0x29')](_0x452635);};module[_0xbe14('0x2a')]=RuleEngine; \ No newline at end of file +var _0x5fc3=['lodash','util','EventEmitter','init','isNil','ignoreFactChanges','inherits','activeRules','prototype','register','isArray','rules','isObject','sync','orderBy','asc','execute','clone','ruleRef','name','index_','push','call','nextTick','next','isEqual','restart','length','condition','matchPath','noop','findRules','filter','prioritize','priority','toJSON','map','consequence','toString','fromJSON','isString','parse'];(function(_0x4166b0,_0x3b5e5a){var _0x50b286=function(_0x494d11){while(--_0x494d11){_0x4166b0['push'](_0x4166b0['shift']());}};_0x50b286(++_0x3b5e5a);}(_0x5fc3,0xa8));var _0x35fc=function(_0x188703,_0x596b26){_0x188703=_0x188703-0x0;var _0x1a0c81=_0x5fc3[_0x188703];return _0x1a0c81;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var EventEmitter=require('events')[_0x35fc('0x2')];function RuleEngine(_0x2ac6da,_0x196bc2){this[_0x35fc('0x3')]();if(!_[_0x35fc('0x4')](_0x2ac6da)){this['register'](_0x2ac6da);}if(_0x196bc2){this[_0x35fc('0x5')]=_0x196bc2[_0x35fc('0x5')];}return this;}util[_0x35fc('0x6')](RuleEngine,EventEmitter);RuleEngine['prototype']['init']=function(_0x19a0d1){this['rules']=[];this[_0x35fc('0x7')]=[];};RuleEngine[_0x35fc('0x8')][_0x35fc('0x9')]=function(_0x1e5f90){if(Array[_0x35fc('0xa')](_0x1e5f90)){this[_0x35fc('0xb')]=this[_0x35fc('0xb')]['concat'](_0x1e5f90);}else if(_0x1e5f90!==null&&_[_0x35fc('0xc')](_0x1e5f90)){this[_0x35fc('0xb')]['push'](_0x1e5f90);}this[_0x35fc('0xd')]();};RuleEngine[_0x35fc('0x8')]['sync']=function(){this[_0x35fc('0x7')]=this[_0x35fc('0xb')]['filter'](function(_0x4cbe74){if(_[_0x35fc('0x4')](_0x4cbe74['on'])){_0x4cbe74['on']=!![];}if(_0x4cbe74['on']===!![]){return _0x4cbe74;}});this['activeRules']=_[_0x35fc('0xe')](this[_0x35fc('0x7')],['p'],[_0x35fc('0xf')]);};RuleEngine[_0x35fc('0x8')][_0x35fc('0x10')]=function(_0x5cfe94,_0x59507a){var _0x5eac0f=![];_0x5cfe94['result']=!![];var _0x398b67=_[_0x35fc('0x11')](_0x5cfe94);var _0x53b898=_[_0x35fc('0x11')](_0x5cfe94);var _0x227a49=this[_0x35fc('0x7')];var _0x480851=[];var _0x26ba54=this[_0x35fc('0x5')];(function FnRuleLoop(_0x553677){var _0x41e165={'rules':function(){return _0x227a49;},'rule':function(){return _0x227a49[_0x553677];},'when':function(_0x363e47){if(_0x363e47){var _0x2e513b=_0x227a49[_0x553677]['consequence'];_0x2e513b[_0x35fc('0x12')]=_0x227a49[_0x553677]['id']||_0x227a49[_0x553677][_0x35fc('0x13')]||_0x35fc('0x14')+_0x553677;process['nextTick'](function(){_0x480851[_0x35fc('0x15')](_0x2e513b[_0x35fc('0x12')]);_0x2e513b[_0x35fc('0x16')](_0x398b67,_0x41e165);});}else{process[_0x35fc('0x17')](function(){_0x41e165[_0x35fc('0x18')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x5eac0f=!![];return FnRuleLoop(0x0);},'next':function(_0x21f1a9){if(!_0x26ba54&&!_[_0x35fc('0x19')](_0x53b898,_0x398b67)){_0x53b898=_[_0x35fc('0x11')](_0x398b67);process[_0x35fc('0x17')](function(){_0x41e165[_0x35fc('0x1a')]();});}else{process['nextTick'](function(){if(_[_0x35fc('0x4')](_0x21f1a9)){return FnRuleLoop(_0x553677+0x1);}else{return FnRuleLoop(_0x21f1a9);}});}}};if(_0x553677<_0x227a49[_0x35fc('0x1b')]&&_0x5eac0f===![]){var _0x257719=_0x227a49[_0x553677][_0x35fc('0x1c')];_0x257719[_0x35fc('0x16')](_0x398b67,_0x41e165);}else{process['nextTick'](function(){_0x398b67[_0x35fc('0x1d')]=_0x480851;return _0x59507a?_0x59507a(_0x398b67):_[_0x35fc('0x1e')]();});}}(0x0));};RuleEngine['prototype'][_0x35fc('0x1f')]=function(_0x5a93df){if(_[_0x35fc('0x4')](_0x5a93df)){return this['rules'];}else{var _0x4086e9=_['matches'](_0x5a93df);return _[_0x35fc('0x20')](this[_0x35fc('0xb')],_0x4086e9);}};RuleEngine['prototype']['turn']=function(_0x47774c,_0x58edb6){var _0x274208=_0x47774c==='on'||_0x47774c==='ON'?!![]:![];var _0x1a5d92=this['findRules'](_0x58edb6);for(var _0x26b7cb=0x0,_0x645eac=_0x1a5d92[_0x35fc('0x1b')];_0x26b7cb<_0x645eac;_0x26b7cb+=0x1){_0x1a5d92[_0x26b7cb]['on']=_0x274208;}this[_0x35fc('0xd')]();};RuleEngine[_0x35fc('0x8')][_0x35fc('0x21')]=function(_0x11ccdb,_0x451f0c){_0x11ccdb=parseInt(_0x11ccdb,0xa);var _0x54aedc=this[_0x35fc('0x1f')](_0x451f0c);for(var _0x220931=0x0,_0x22af18=_0x54aedc['length'];_0x220931<_0x22af18;_0x220931+=0x1){_0x54aedc[_0x220931][_0x35fc('0x22')]=_0x11ccdb;}this[_0x35fc('0xd')]();};RuleEngine[_0x35fc('0x8')][_0x35fc('0x23')]=function(){var _0xd8a4ca=this[_0x35fc('0xb')];if(_0xd8a4ca instanceof Array){_0xd8a4ca=_0xd8a4ca[_0x35fc('0x24')](function(_0x37b435){_0x37b435[_0x35fc('0x1c')]=_0x37b435[_0x35fc('0x1c')]['toString']();_0x37b435['consequence']=_0x37b435[_0x35fc('0x25')]['toString']();return _0x37b435;});}else if(!_[_0x35fc('0x4')](_0xd8a4ca)){_0xd8a4ca[_0x35fc('0x1c')]=_0xd8a4ca[_0x35fc('0x1c')][_0x35fc('0x26')]();_0xd8a4ca[_0x35fc('0x25')]=_0xd8a4ca[_0x35fc('0x25')]['toString']();}return _0xd8a4ca;};RuleEngine[_0x35fc('0x8')][_0x35fc('0x27')]=function(_0x46b9ef){this[_0x35fc('0x3')]();if(_[_0x35fc('0x28')](_0x46b9ef)){_0x46b9ef=JSON[_0x35fc('0x29')](_0x46b9ef);}if(_0x46b9ef instanceof Array){_0x46b9ef=_0x46b9ef['map'](function(_0x2483be){_0x2483be[_0x35fc('0x1c')]=eval('('+_0x2483be[_0x35fc('0x1c')]+')');_0x2483be['consequence']=eval('('+_0x2483be[_0x35fc('0x25')]+')');return _0x2483be;});}else if(_0x46b9ef!==null&&typeof _0x46b9ef=='object'){_0x46b9ef[_0x35fc('0x1c')]=eval('('+_0x46b9ef[_0x35fc('0x1c')]+')');_0x46b9ef[_0x35fc('0x25')]=eval('('+_0x46b9ef[_0x35fc('0x25')]+')');}this['register'](_0x46b9ef);};module['exports']=RuleEngine; \ No newline at end of file diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index 25e6372..634b3f0 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 _0x6001=['error','message','result','sendMailMessage','bluebird','jayson/promise','client','http','request'];(function(_0xb42da0,_0x5e98b4){var _0x4036c7=function(_0x1ca1dc){while(--_0x1ca1dc){_0xb42da0['push'](_0xb42da0['shift']());}};_0x4036c7(++_0x5e98b4);}(_0x6001,0x15a));var _0x1600=function(_0x1320fe,_0x5dae3a){_0x1320fe=_0x1320fe-0x0;var _0xe9340a=_0x6001[_0x1320fe];return _0xe9340a;};'use strict';var BPromise=require(_0x1600('0x0'));var jayson=require(_0x1600('0x1'));var client=jayson[_0x1600('0x2')][_0x1600('0x3')]({'port':0x232b});function request(_0x3d54a1,_0x1184d5){return new BPromise(function(_0x471d62,_0xfaef2f){return client[_0x1600('0x4')](_0x3d54a1,_0x1184d5)['then'](function(_0x5a41c1){if(_0x5a41c1[_0x1600('0x5')]){return _0xfaef2f(_0x5a41c1[_0x1600('0x5')][_0x1600('0x6')]);}else{return _0x471d62(_0x5a41c1[_0x1600('0x7')]);}})['catch'](function(_0x33edf9){return _0xfaef2f(_0x33edf9);});});}exports[_0x1600('0x8')]=function(_0x1e9736,_0x4df910){return request('SendMail',{'account':_0x1e9736,'message':_0x4df910});}; \ No newline at end of file +var _0xe01a=['error','result','sendMailMessage','jayson/promise','client','http','request','then'];(function(_0x5427dc,_0x4b3c5c){var _0x5bb7c1=function(_0x46fdde){while(--_0x46fdde){_0x5427dc['push'](_0x5427dc['shift']());}};_0x5bb7c1(++_0x4b3c5c);}(_0xe01a,0x9b));var _0xae01=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xe01a[_0x2dafbe];return _0x58a45a;};'use strict';var BPromise=require('bluebird');var jayson=require(_0xae01('0x0'));var client=jayson[_0xae01('0x1')][_0xae01('0x2')]({'port':0x232b});function request(_0x4962d0,_0x98748){return new BPromise(function(_0x44fa4b,_0x4265b9){return client[_0xae01('0x3')](_0x4962d0,_0x98748)[_0xae01('0x4')](function(_0xf93986){if(_0xf93986['error']){return _0x4265b9(_0xf93986[_0xae01('0x5')]['message']);}else{return _0x44fa4b(_0xf93986[_0xae01('0x6')]);}})['catch'](function(_0x4b6b24){return _0x4265b9(_0x4b6b24);});});}exports[_0xae01('0x7')]=function(_0x2c7ead,_0x4686a4){return request('SendMail',{'account':_0x2c7ead,'message':_0x4686a4});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index cd8ba65..9139a36 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 _0xdc90=['openchannelStatusTime','openchannelCapacity','busy','busyQueue','chatWaitingInteractions','faxWaitingInteractions','mailWaitingInteractions','openchannelWaitingInteractions','smsWaitingInteractions','prototype','getChannelStatus','CurrentCapacity','maxcapacity','working','idle','updateRealtime','chat','openchannel','fax','sms','whatsapp','length','Status','StatusTime','toNumber','format','faxStatusTime','whatsappStatus','openchannelCurrentCapacity','whatsappWaitingInteractions','stringify','emit','user:save','exports','lodash','moment','md5','ioredis','redis','defaults','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','chatStatus','unknown','chatStatusTime','chatCapacity','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatus','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xdc90,0x16c));var _0x0dc9=function(_0x134933,_0x17607a){_0x134933=_0x134933-0x0;var _0x368925=_0xdc90[_0x134933];return _0x368925;};'use strict';var _=require(_0x0dc9('0x0'));var moment=require(_0x0dc9('0x1'));var md5=require(_0x0dc9('0x2'));var Redis=require(_0x0dc9('0x3'));var config=require('../../../config/environment');config[_0x0dc9('0x4')]=_[_0x0dc9('0x5')](config[_0x0dc9('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x0dc9('0x6'))(new Redis(config[_0x0dc9('0x4')]));function Agent(_0x37b079){this['id']=_0x37b079['id']||0x0;this['name']=_0x37b079[_0x0dc9('0x7')]||'';this[_0x0dc9('0x8')]=_0x37b079[_0x0dc9('0x8')]||!![];this[_0x0dc9('0x9')]=_0x37b079['voicePause']||![];this['chatPause']=_0x37b079[_0x0dc9('0xa')]||![];this[_0x0dc9('0xb')]=_0x37b079[_0x0dc9('0xb')]||![];this['faxPause']=_0x37b079[_0x0dc9('0xc')]||![];this[_0x0dc9('0xd')]=_0x37b079['smsPause']||![];this['openchannelPause']=_0x37b079['openchannelPause']||![];this[_0x0dc9('0xe')]=_0x0dc9('0xf');this[_0x0dc9('0x10')]=0x0;this[_0x0dc9('0x11')]=_0x37b079[_0x0dc9('0x11')]||0x0;this['chatCurrentCapacity']=0x0;this['mailStatus']=_0x0dc9('0xf');this[_0x0dc9('0x12')]=0x0;this[_0x0dc9('0x13')]=_0x37b079[_0x0dc9('0x13')]||0x0;this[_0x0dc9('0x14')]=0x0;this[_0x0dc9('0x15')]=_0x0dc9('0xf');this['faxStatusTime']=0x0;this[_0x0dc9('0x16')]=_0x37b079[_0x0dc9('0x16')]||0x0;this[_0x0dc9('0x17')]=0x0;this[_0x0dc9('0x18')]=_0x0dc9('0xf');this[_0x0dc9('0x19')]=0x0;this['smsCapacity']=_0x37b079[_0x0dc9('0x1a')]||0x0;this[_0x0dc9('0x1b')]=0x0;this['whatsappStatus']='unknown';this[_0x0dc9('0x1c')]=0x0;this['whatsappCapacity']=_0x37b079[_0x0dc9('0x1d')]||0x0;this[_0x0dc9('0x1e')]=0x0;this[_0x0dc9('0x1f')]=_0x0dc9('0xf');this[_0x0dc9('0x20')]=0x0;this[_0x0dc9('0x21')]=_0x37b079[_0x0dc9('0x21')]||0x0;this['openchannelCurrentCapacity']=0x0;this[_0x0dc9('0x22')]=![];this[_0x0dc9('0x23')]=undefined;this[_0x0dc9('0x2')]='';this[_0x0dc9('0x24')]={};this[_0x0dc9('0x25')]={};this[_0x0dc9('0x26')]={};this[_0x0dc9('0x27')]={};this[_0x0dc9('0x28')]={};this['whatsappWaitingInteractions']={};this['updateRealtime']();}Agent[_0x0dc9('0x29')][_0x0dc9('0x2a')]=function(_0x1152a4){if(this[_0x1152a4+_0x0dc9('0x2b')]>0x0){if(this[_0x1152a4+'Capacity']>0x0&&this[_0x1152a4+_0x0dc9('0x2b')]>=this[_0x1152a4+'Capacity']){return _0x0dc9('0x2c');}else{return _0x0dc9('0x2d');}}else{return _0x0dc9('0x2e');}};Agent[_0x0dc9('0x29')][_0x0dc9('0x2f')]=function(){var _0x1c0d10=['mail',_0x0dc9('0x30'),_0x0dc9('0x31'),_0x0dc9('0x32'),_0x0dc9('0x33'),_0x0dc9('0x34')];for(var _0x3c6df4=0x0;_0x3c6df4<_0x1c0d10[_0x0dc9('0x35')];_0x3c6df4+=0x1){var _0x43ca30=this[_0x0dc9('0x2a')](_0x1c0d10[_0x3c6df4]);if(this[_0x1c0d10[_0x3c6df4]+_0x0dc9('0x36')]!==_0x43ca30){this[_0x1c0d10[_0x3c6df4]+_0x0dc9('0x37')]=_[_0x0dc9('0x38')](moment()[_0x0dc9('0x39')]('x'));}this[_0x1c0d10[_0x3c6df4]+_0x0dc9('0x36')]=_0x43ca30;}var _0x1c2afd={'id':this['id'],'name':this[_0x0dc9('0x7')],'online':this['online'],'voicePause':this['voicePause'],'chatPause':this[_0x0dc9('0xa')],'mailPause':this[_0x0dc9('0xb')],'smsPause':this[_0x0dc9('0xd')],'faxPause':this[_0x0dc9('0xc')],'openchannelPause':this['openchannelPause'],'chatStatus':this[_0x0dc9('0xe')],'chatStatusTime':this[_0x0dc9('0x10')],'chatCapacity':this[_0x0dc9('0x11')],'chatCurrentCapacity':this['chatCurrentCapacity'],'mailStatus':this['mailStatus'],'mailStatusTime':this[_0x0dc9('0x12')],'mailCapacity':this[_0x0dc9('0x13')],'mailCurrentCapacity':this[_0x0dc9('0x14')],'faxStatus':this[_0x0dc9('0x15')],'faxStatusTime':this[_0x0dc9('0x3a')],'faxCapacity':this[_0x0dc9('0x16')],'faxCurrentCapacity':this['faxCurrentCapacity'],'smsStatus':this[_0x0dc9('0x18')],'smsStatusTime':this['smsStatusTime'],'smsCapacity':this['smsCapacity'],'smsCurrentCapacity':this[_0x0dc9('0x1b')],'whatsappStatus':this[_0x0dc9('0x3b')],'whatsappStatusTime':this['whatsappStatusTime'],'whatsappCapacity':this['whatsappCapacity'],'whatsappCurrentCapacity':this[_0x0dc9('0x1e')],'openchannelStatus':this['openchannelStatus'],'openchannelStatusTime':this['openchannelStatusTime'],'openchannelCapacity':this[_0x0dc9('0x21')],'openchannelCurrentCapacity':this[_0x0dc9('0x3c')],'busy':this['busy'],'busyQueue':this['busyQueue'],'chatWaitingInteractions':this[_0x0dc9('0x24')],'faxWaitingInteractions':this[_0x0dc9('0x25')],'mailWaitingInteractions':this[_0x0dc9('0x26')],'openchannelWaitingInteractions':this[_0x0dc9('0x27')],'smsWaitingInteractions':this[_0x0dc9('0x28')],'whatsappWaitingInteractions':this[_0x0dc9('0x3d')]};var _0x4de8ed=md5(JSON[_0x0dc9('0x3e')](_0x1c2afd));if(this[_0x0dc9('0x2')]!==_0x4de8ed){this[_0x0dc9('0x2')]=_0x4de8ed;io[_0x0dc9('0x3f')](_0x0dc9('0x40'),_0x1c2afd);}};module[_0x0dc9('0x41')]=Agent; \ No newline at end of file +var _0xb9f9=['whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busy','busyQueue','chatWaitingInteractions','faxWaitingInteractions','mailWaitingInteractions','openchannelWaitingInteractions','smsWaitingInteractions','prototype','getChannelStatus','CurrentCapacity','Capacity','maxcapacity','working','updateRealtime','mail','chat','openchannel','fax','sms','whatsapp','length','Status','StatusTime','chatStatusTime','smsStatus','smsCapacity','smsCurrentCapacity','stringify','emit','user:save','md5','ioredis','redis','localhost','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','chatCapacity','chatCurrentCapacity','mailStatus','unknown','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatus','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatusTime','whatsappStatus','whatsappStatusTime','whatsappCapacity'];(function(_0x1a9b94,_0x4d763e){var _0x379102=function(_0x1d9e7c){while(--_0x1d9e7c){_0x1a9b94['push'](_0x1a9b94['shift']());}};_0x379102(++_0x4d763e);}(_0xb9f9,0x1e3));var _0x9b9f=function(_0x2265eb,_0x407960){_0x2265eb=_0x2265eb-0x0;var _0xb0a949=_0xb9f9[_0x2265eb];return _0xb0a949;};'use strict';var _=require('lodash');var moment=require('moment');var md5=require(_0x9b9f('0x0'));var Redis=require(_0x9b9f('0x1'));var config=require('../../../config/environment');config['redis']=_['defaults'](config[_0x9b9f('0x2')],{'host':_0x9b9f('0x3'),'port':0x18eb});var io=require(_0x9b9f('0x4'))(new Redis(config[_0x9b9f('0x2')]));function Agent(_0x5081fa){this['id']=_0x5081fa['id']||0x0;this['name']=_0x5081fa[_0x9b9f('0x5')]||'';this[_0x9b9f('0x6')]=_0x5081fa[_0x9b9f('0x6')]||!![];this['voicePause']=_0x5081fa[_0x9b9f('0x7')]||![];this[_0x9b9f('0x8')]=_0x5081fa[_0x9b9f('0x8')]||![];this[_0x9b9f('0x9')]=_0x5081fa[_0x9b9f('0x9')]||![];this['faxPause']=_0x5081fa[_0x9b9f('0xa')]||![];this[_0x9b9f('0xb')]=_0x5081fa[_0x9b9f('0xb')]||![];this['openchannelPause']=_0x5081fa[_0x9b9f('0xc')]||![];this[_0x9b9f('0xd')]='unknown';this['chatStatusTime']=0x0;this[_0x9b9f('0xe')]=_0x5081fa['chatCapacity']||0x0;this[_0x9b9f('0xf')]=0x0;this[_0x9b9f('0x10')]=_0x9b9f('0x11');this[_0x9b9f('0x12')]=0x0;this[_0x9b9f('0x13')]=_0x5081fa[_0x9b9f('0x13')]||0x0;this[_0x9b9f('0x14')]=0x0;this[_0x9b9f('0x15')]=_0x9b9f('0x11');this[_0x9b9f('0x16')]=0x0;this[_0x9b9f('0x17')]=_0x5081fa[_0x9b9f('0x17')]||0x0;this[_0x9b9f('0x18')]=0x0;this['smsStatus']='unknown';this[_0x9b9f('0x19')]=0x0;this['smsCapacity']=_0x5081fa['smsCapacity']||0x0;this['smsCurrentCapacity']=0x0;this[_0x9b9f('0x1a')]=_0x9b9f('0x11');this[_0x9b9f('0x1b')]=0x0;this[_0x9b9f('0x1c')]=_0x5081fa[_0x9b9f('0x1c')]||0x0;this[_0x9b9f('0x1d')]=0x0;this[_0x9b9f('0x1e')]=_0x9b9f('0x11');this[_0x9b9f('0x1f')]=0x0;this[_0x9b9f('0x20')]=_0x5081fa[_0x9b9f('0x20')]||0x0;this[_0x9b9f('0x21')]=0x0;this[_0x9b9f('0x22')]=![];this[_0x9b9f('0x23')]=undefined;this[_0x9b9f('0x0')]='';this[_0x9b9f('0x24')]={};this[_0x9b9f('0x25')]={};this[_0x9b9f('0x26')]={};this[_0x9b9f('0x27')]={};this[_0x9b9f('0x28')]={};this['whatsappWaitingInteractions']={};this['updateRealtime']();}Agent[_0x9b9f('0x29')][_0x9b9f('0x2a')]=function(_0x34e518){if(this[_0x34e518+_0x9b9f('0x2b')]>0x0){if(this[_0x34e518+_0x9b9f('0x2c')]>0x0&&this[_0x34e518+_0x9b9f('0x2b')]>=this[_0x34e518+_0x9b9f('0x2c')]){return _0x9b9f('0x2d');}else{return _0x9b9f('0x2e');}}else{return'idle';}};Agent[_0x9b9f('0x29')][_0x9b9f('0x2f')]=function(){var _0x5d3c4b=[_0x9b9f('0x30'),_0x9b9f('0x31'),_0x9b9f('0x32'),_0x9b9f('0x33'),_0x9b9f('0x34'),_0x9b9f('0x35')];for(var _0x3ddd67=0x0;_0x3ddd67<_0x5d3c4b[_0x9b9f('0x36')];_0x3ddd67+=0x1){var _0x3e6839=this['getChannelStatus'](_0x5d3c4b[_0x3ddd67]);if(this[_0x5d3c4b[_0x3ddd67]+_0x9b9f('0x37')]!==_0x3e6839){this[_0x5d3c4b[_0x3ddd67]+_0x9b9f('0x38')]=_['toNumber'](moment()['format']('x'));}this[_0x5d3c4b[_0x3ddd67]+_0x9b9f('0x37')]=_0x3e6839;}var _0x19da4b={'id':this['id'],'name':this['name'],'online':this['online'],'voicePause':this['voicePause'],'chatPause':this[_0x9b9f('0x8')],'mailPause':this[_0x9b9f('0x9')],'smsPause':this[_0x9b9f('0xb')],'faxPause':this[_0x9b9f('0xa')],'openchannelPause':this[_0x9b9f('0xc')],'chatStatus':this[_0x9b9f('0xd')],'chatStatusTime':this[_0x9b9f('0x39')],'chatCapacity':this[_0x9b9f('0xe')],'chatCurrentCapacity':this[_0x9b9f('0xf')],'mailStatus':this['mailStatus'],'mailStatusTime':this[_0x9b9f('0x12')],'mailCapacity':this[_0x9b9f('0x13')],'mailCurrentCapacity':this['mailCurrentCapacity'],'faxStatus':this[_0x9b9f('0x15')],'faxStatusTime':this['faxStatusTime'],'faxCapacity':this[_0x9b9f('0x17')],'faxCurrentCapacity':this[_0x9b9f('0x18')],'smsStatus':this[_0x9b9f('0x3a')],'smsStatusTime':this[_0x9b9f('0x19')],'smsCapacity':this[_0x9b9f('0x3b')],'smsCurrentCapacity':this[_0x9b9f('0x3c')],'whatsappStatus':this['whatsappStatus'],'whatsappStatusTime':this[_0x9b9f('0x1b')],'whatsappCapacity':this[_0x9b9f('0x1c')],'whatsappCurrentCapacity':this[_0x9b9f('0x1d')],'openchannelStatus':this[_0x9b9f('0x1e')],'openchannelStatusTime':this[_0x9b9f('0x1f')],'openchannelCapacity':this[_0x9b9f('0x20')],'openchannelCurrentCapacity':this[_0x9b9f('0x21')],'busy':this[_0x9b9f('0x22')],'busyQueue':this[_0x9b9f('0x23')],'chatWaitingInteractions':this['chatWaitingInteractions'],'faxWaitingInteractions':this[_0x9b9f('0x25')],'mailWaitingInteractions':this[_0x9b9f('0x26')],'openchannelWaitingInteractions':this[_0x9b9f('0x27')],'smsWaitingInteractions':this['smsWaitingInteractions'],'whatsappWaitingInteractions':this['whatsappWaitingInteractions']};var _0x48bc01=md5(JSON[_0x9b9f('0x3d')](_0x19da4b));if(this[_0x9b9f('0x0')]!==_0x48bc01){this[_0x9b9f('0x0')]=_0x48bc01;io[_0x9b9f('0x3e')](_0x9b9f('0x3f'),_0x19da4b);}};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 d595235..f3869ff 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 _0xc893=['timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','prototype','_rr','updateRealtime','loggedIn','paused','length','chatPause','available','stringify','format','chat:queue:%s','emit','chat_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name'];(function(_0x2df2b2,_0x285f95){var _0x314372=function(_0x44c2e9){while(--_0x44c2e9){_0x2df2b2['push'](_0x2df2b2['shift']());}};_0x314372(++_0x285f95);}(_0xc893,0x16a));var _0x3c89=function(_0x182aed,_0x224402){_0x182aed=_0x182aed-0x0;var _0x20ea16=_0xc893[_0x182aed];return _0x20ea16;};'use strict';var _=require(_0x3c89('0x0'));var md5=require(_0x3c89('0x1'));var util=require(_0x3c89('0x2'));var Redis=require(_0x3c89('0x3'));var config=require(_0x3c89('0x4'));config[_0x3c89('0x5')]=_[_0x3c89('0x6')](config[_0x3c89('0x5')],{'host':_0x3c89('0x7'),'port':0x18eb});var io=require(_0x3c89('0x8'))(new Redis(config[_0x3c89('0x5')]));function ChatQueue(_0x2ca32f){this['id']=_0x2ca32f['id']||0x0;this[_0x3c89('0x9')]=_0x2ca32f['name']||'';this[_0x3c89('0xa')]=_0x2ca32f[_0x3c89('0xa')]||0xa;this['strategy']=_0x2ca32f[_0x3c89('0xb')]||_0x3c89('0xc');this[_0x3c89('0xd')]=_0x2ca32f[_0x3c89('0xd')];this[_0x3c89('0xe')]={};this[_0x3c89('0xf')]=0x0;this[_0x3c89('0x1')]='';this[_0x3c89('0x10')]();this['updateRealtime']();}ChatQueue[_0x3c89('0x11')]['updateRouting']=function(){var _0x2c11eb=this[_0x3c89('0xe')][_0x3c89('0x12')];this[_0x3c89('0xe')]=_['map'](this['Agents'],'id');this[_0x3c89('0xe')][_0x3c89('0x12')]=_0x2c11eb;};ChatQueue[_0x3c89('0x11')][_0x3c89('0x13')]=function(){this[_0x3c89('0x14')]=0x0;this[_0x3c89('0x15')]=0x0;for(var _0x1dff05=0x0;_0x1dff05=0x0?this[_0x3c89('0x18')]:0x0;var _0x41dcd2={'id':this['id'],'available':this[_0x3c89('0x18')],'loggedIn':this[_0x3c89('0x14')],'name':this[_0x3c89('0x9')],'paused':this['paused'],'waiting':this['waiting']};var _0x3ad495=md5(JSON[_0x3c89('0x19')](_0x41dcd2));if(this['md5']!==_0x3ad495){this[_0x3c89('0x1')]=_0x3ad495;io['to'](util[_0x3c89('0x1a')](_0x3c89('0x1b'),_0x41dcd2[_0x3c89('0x9')]))[_0x3c89('0x1c')](_0x3c89('0x1d'),_0x41dcd2);}};module[_0x3c89('0x1e')]=ChatQueue; \ No newline at end of file +var _0x5098=['emit','chat_queue:save','exports','lodash','md5','util','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','Agents','waiting','updateRouting','updateRealtime','prototype','_rr','map','mapAgentsId','loggedIn','paused','length','online','available','format'];(function(_0xa59d86,_0x523b4e){var _0xd79750=function(_0x237d85){while(--_0x237d85){_0xa59d86['push'](_0xa59d86['shift']());}};_0xd79750(++_0x523b4e);}(_0x5098,0x18b));var _0x8509=function(_0x3a8101,_0xea0641){_0x3a8101=_0x3a8101-0x0;var _0x1fc660=_0x5098[_0x3a8101];return _0x1fc660;};'use strict';var _=require(_0x8509('0x0'));var md5=require(_0x8509('0x1'));var util=require(_0x8509('0x2'));var Redis=require('ioredis');var config=require(_0x8509('0x3'));config[_0x8509('0x4')]=_[_0x8509('0x5')](config[_0x8509('0x4')],{'host':_0x8509('0x6'),'port':0x18eb});var io=require(_0x8509('0x7'))(new Redis(config[_0x8509('0x4')]));function ChatQueue(_0x4f3d98){this['id']=_0x4f3d98['id']||0x0;this[_0x8509('0x8')]=_0x4f3d98['name']||'';this[_0x8509('0x9')]=_0x4f3d98['timeout']||0xa;this[_0x8509('0xa')]=_0x4f3d98[_0x8509('0xa')]||'beepall';this[_0x8509('0xb')]=_0x4f3d98['Agents'];this['mapAgentsId']={};this[_0x8509('0xc')]=0x0;this[_0x8509('0x1')]='';this[_0x8509('0xd')]();this[_0x8509('0xe')]();}ChatQueue[_0x8509('0xf')]['updateRouting']=function(){var _0x4fa4c2=this['mapAgentsId'][_0x8509('0x10')];this['mapAgentsId']=_[_0x8509('0x11')](this['Agents'],'id');this[_0x8509('0x12')][_0x8509('0x10')]=_0x4fa4c2;};ChatQueue[_0x8509('0xf')]['updateRealtime']=function(){this[_0x8509('0x13')]=0x0;this[_0x8509('0x14')]=0x0;for(var _0x49ccd0=0x0;_0x49ccd0=0x0?this[_0x8509('0x17')]:0x0;var _0x394755={'id':this['id'],'available':this['available'],'loggedIn':this[_0x8509('0x13')],'name':this[_0x8509('0x8')],'paused':this[_0x8509('0x14')],'waiting':this[_0x8509('0xc')]};var _0x3f8f77=md5(JSON['stringify'](_0x394755));if(this['md5']!==_0x3f8f77){this['md5']=_0x3f8f77;io['to'](util[_0x8509('0x18')]('chat:queue:%s',_0x394755[_0x8509('0x8')]))[_0x8509('0x19')](_0x8509('0x1a'),_0x394755);}};module[_0x8509('0x1b')]=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index 1f1cf73..bb6ec18 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 _0x402f=['socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','md5','updateRouting','updateRealtime','prototype','mapAgentsId','_rr','map','loggedIn','length','online','faxPause','paused','available','stringify','format','fax:queue:%s','emit','fax_queue:save','exports','lodash','ioredis','../../../config/environment','redis','defaults','localhost'];(function(_0x1896e6,_0x5eed40){var _0x583ffc=function(_0x5688ff){while(--_0x5688ff){_0x1896e6['push'](_0x1896e6['shift']());}};_0x583ffc(++_0x5eed40);}(_0x402f,0x13a));var _0xf402=function(_0x4071e5,_0x22dc44){_0x4071e5=_0x4071e5-0x0;var _0x1bf99e=_0x402f[_0x4071e5];return _0x1bf99e;};'use strict';var _=require(_0xf402('0x0'));var md5=require('md5');var util=require('util');var Redis=require(_0xf402('0x1'));var config=require(_0xf402('0x2'));config[_0xf402('0x3')]=_[_0xf402('0x4')](config['redis'],{'host':_0xf402('0x5'),'port':0x18eb});var io=require(_0xf402('0x6'))(new Redis(config[_0xf402('0x3')]));function FaxQueue(_0x311cd6){this['id']=_0x311cd6['id']||0x0;this[_0xf402('0x7')]=_0x311cd6['name']||'';this[_0xf402('0x8')]=_0x311cd6[_0xf402('0x8')]||0xa;this[_0xf402('0x9')]=_0x311cd6[_0xf402('0x9')]||_0xf402('0xa');this[_0xf402('0xb')]=_0x311cd6[_0xf402('0xb')];this['mapAgentsId']={};this[_0xf402('0xc')]=0x0;this[_0xf402('0xd')]='';this[_0xf402('0xe')]();this[_0xf402('0xf')]();}FaxQueue[_0xf402('0x10')]['updateRouting']=function(){var _0x57983b=this[_0xf402('0x11')][_0xf402('0x12')];this['mapAgentsId']=_[_0xf402('0x13')](this[_0xf402('0xb')],'id');this[_0xf402('0x11')]['_rr']=_0x57983b;};FaxQueue[_0xf402('0x10')][_0xf402('0xf')]=function(){this[_0xf402('0x14')]=0x0;this['paused']=0x0;for(var _0x11beca=0x0;_0x11beca=0x0?this[_0xf402('0x19')]:0x0;var _0x319c1a={'id':this['id'],'available':this[_0xf402('0x19')],'loggedIn':this['loggedIn'],'name':this[_0xf402('0x7')],'paused':this[_0xf402('0x18')],'waiting':this['waiting']};var _0x23f1ad=md5(JSON[_0xf402('0x1a')](_0x319c1a));if(this[_0xf402('0xd')]!==_0x23f1ad){this['md5']=_0x23f1ad;io['to'](util[_0xf402('0x1b')](_0xf402('0x1c'),_0x319c1a['name']))[_0xf402('0x1d')](_0xf402('0x1e'),_0x319c1a);}};module[_0xf402('0x1f')]=FaxQueue; \ No newline at end of file +var _0xd576=['fax:queue:%s','name','fax_queue:save','lodash','md5','util','../../../config/environment','redis','defaults','localhost','socket.io-emitter','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','length','online','faxPause','available','stringify','format'];(function(_0x5f1819,_0x4473f7){var _0x5da8df=function(_0x7c911a){while(--_0x7c911a){_0x5f1819['push'](_0x5f1819['shift']());}};_0x5da8df(++_0x4473f7);}(_0xd576,0xb7));var _0x6d57=function(_0xc37b98,_0x13a1c7){_0xc37b98=_0xc37b98-0x0;var _0x4164be=_0xd576[_0xc37b98];return _0x4164be;};'use strict';var _=require(_0x6d57('0x0'));var md5=require(_0x6d57('0x1'));var util=require(_0x6d57('0x2'));var Redis=require('ioredis');var config=require(_0x6d57('0x3'));config[_0x6d57('0x4')]=_[_0x6d57('0x5')](config[_0x6d57('0x4')],{'host':_0x6d57('0x6'),'port':0x18eb});var io=require(_0x6d57('0x7'))(new Redis(config[_0x6d57('0x4')]));function FaxQueue(_0x2b749f){this['id']=_0x2b749f['id']||0x0;this['name']=_0x2b749f['name']||'';this['timeout']=_0x2b749f[_0x6d57('0x8')]||0xa;this[_0x6d57('0x9')]=_0x2b749f['strategy']||_0x6d57('0xa');this[_0x6d57('0xb')]=_0x2b749f[_0x6d57('0xb')];this[_0x6d57('0xc')]={};this[_0x6d57('0xd')]=0x0;this[_0x6d57('0x1')]='';this[_0x6d57('0xe')]();this[_0x6d57('0xf')]();}FaxQueue[_0x6d57('0x10')][_0x6d57('0xe')]=function(){var _0x4796e7=this[_0x6d57('0xc')][_0x6d57('0x11')];this[_0x6d57('0xc')]=_[_0x6d57('0x12')](this[_0x6d57('0xb')],'id');this[_0x6d57('0xc')][_0x6d57('0x11')]=_0x4796e7;};FaxQueue[_0x6d57('0x10')][_0x6d57('0xf')]=function(){this[_0x6d57('0x13')]=0x0;this[_0x6d57('0x14')]=0x0;for(var _0x25136a=0x0;_0x25136a=0x0?this[_0x6d57('0x18')]:0x0;var _0x556d48={'id':this['id'],'available':this[_0x6d57('0x18')],'loggedIn':this[_0x6d57('0x13')],'name':this['name'],'paused':this[_0x6d57('0x14')],'waiting':this[_0x6d57('0xd')]};var _0x19a755=md5(JSON[_0x6d57('0x19')](_0x556d48));if(this[_0x6d57('0x1')]!==_0x19a755){this['md5']=_0x19a755;io['to'](util[_0x6d57('0x1a')](_0x6d57('0x1b'),_0x556d48[_0x6d57('0x1c')]))['emit'](_0x6d57('0x1d'),_0x556d48);}};module['exports']=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index 3179ae4..2af5ff8 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 _0x0d37=['exports','name','Intervals'];(function(_0x53d0db,_0x4cfe56){var _0x2cb2d5=function(_0x74a64e){while(--_0x74a64e){_0x53d0db['push'](_0x53d0db['shift']());}};_0x2cb2d5(++_0x4cfe56);}(_0x0d37,0x17b));var _0x70d3=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x0d37[_0x321bb2];return _0x9c12ed;};'use strict';function Interval(_0x4a09fd){this['id']=_0x4a09fd['id']||0x0;this[_0x70d3('0x0')]=_0x4a09fd[_0x70d3('0x0')]||'';this[_0x70d3('0x1')]=_0x4a09fd[_0x70d3('0x1')]||{};}module[_0x70d3('0x2')]=Interval; \ No newline at end of file +var _0xc1fb=['exports','name','Intervals'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0xc1fb,0x82));var _0xbc1f=function(_0x2de0a7,_0x38d3e7){_0x2de0a7=_0x2de0a7-0x0;var _0x429437=_0xc1fb[_0x2de0a7];return _0x429437;};'use strict';function Interval(_0x2397c3){this['id']=_0x2397c3['id']||0x0;this[_0xbc1f('0x0')]=_0x2397c3[_0xbc1f('0x0')]||'';this[_0xbc1f('0x1')]=_0x2397c3['Intervals']||{};}module[_0xbc1f('0x2')]=Interval; \ No newline at end of file diff --git a/server/services/routing/model/mailQueue.js b/server/services/routing/model/mailQueue.js index fcb656a..d991c5b 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 _0x8930=['prototype','_rr','loggedIn','paused','available','waiting','stringify','format','mail:queue:%s','emit','mail_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','updateRouting'];(function(_0x8c3ab6,_0x88d43f){var _0x5de3ca=function(_0x2dd1cd){while(--_0x2dd1cd){_0x8c3ab6['push'](_0x8c3ab6['shift']());}};_0x5de3ca(++_0x88d43f);}(_0x8930,0x140));var _0x0893=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x8930[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0x0893('0x0'));var md5=require(_0x0893('0x1'));var util=require(_0x0893('0x2'));var Redis=require(_0x0893('0x3'));var config=require(_0x0893('0x4'));config[_0x0893('0x5')]=_[_0x0893('0x6')](config[_0x0893('0x5')],{'host':_0x0893('0x7'),'port':0x18eb});var io=require(_0x0893('0x8'))(new Redis(config[_0x0893('0x5')]));function MailQueue(_0x1c458d){this['id']=_0x1c458d['id']||0x0;this[_0x0893('0x9')]=_0x1c458d[_0x0893('0x9')]||'';this[_0x0893('0xa')]=_0x1c458d[_0x0893('0xa')]||0xa;this[_0x0893('0xb')]=_0x1c458d['strategy']||_0x0893('0xc');this[_0x0893('0xd')]=_0x1c458d['Agents'];this[_0x0893('0xe')]={};this['waiting']=0x0;this[_0x0893('0x1')]='';this[_0x0893('0xf')]();this['updateRealtime']();}MailQueue[_0x0893('0x10')][_0x0893('0xf')]=function(){var _0x44ee3a=this[_0x0893('0xe')][_0x0893('0x11')];this[_0x0893('0xe')]=_['map'](this['Agents'],'id');this[_0x0893('0xe')][_0x0893('0x11')]=_0x44ee3a;};MailQueue[_0x0893('0x10')]['updateRealtime']=function(){this[_0x0893('0x12')]=0x0;this[_0x0893('0x13')]=0x0;for(var _0xeb0144=0x0;_0xeb0144=0x0?this[_0x0893('0x14')]:0x0;var _0x47e4c7={'id':this['id'],'available':this[_0x0893('0x14')],'loggedIn':this[_0x0893('0x12')],'name':this['name'],'paused':this[_0x0893('0x13')],'waiting':this[_0x0893('0x15')]};var _0x3a862a=md5(JSON[_0x0893('0x16')](_0x47e4c7));if(this[_0x0893('0x1')]!==_0x3a862a){this[_0x0893('0x1')]=_0x3a862a;io['to'](util[_0x0893('0x17')](_0x0893('0x18'),_0x47e4c7[_0x0893('0x9')]))[_0x0893('0x19')](_0x0893('0x1a'),_0x47e4c7);}};module[_0x0893('0x1b')]=MailQueue; \ No newline at end of file +var _0xbe81=['md5','updateRealtime','prototype','updateRouting','map','_rr','loggedIn','paused','length','online','mailPause','available','waiting','stringify','format','mail:queue:%s','emit','mail_queue:save','exports','lodash','ioredis','../../../config/environment','defaults','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId'];(function(_0x30aa72,_0x17a48a){var _0x54ccc6=function(_0x2603f7){while(--_0x2603f7){_0x30aa72['push'](_0x30aa72['shift']());}};_0x54ccc6(++_0x17a48a);}(_0xbe81,0x1b7));var _0x1be8=function(_0x1ee351,_0x54261b){_0x1ee351=_0x1ee351-0x0;var _0x245aaf=_0xbe81[_0x1ee351];return _0x245aaf;};'use strict';var _=require(_0x1be8('0x0'));var md5=require('md5');var util=require('util');var Redis=require(_0x1be8('0x1'));var config=require(_0x1be8('0x2'));config['redis']=_[_0x1be8('0x3')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x1be8('0x4'))(new Redis(config['redis']));function MailQueue(_0x5a549a){this['id']=_0x5a549a['id']||0x0;this[_0x1be8('0x5')]=_0x5a549a['name']||'';this[_0x1be8('0x6')]=_0x5a549a[_0x1be8('0x6')]||0xa;this[_0x1be8('0x7')]=_0x5a549a[_0x1be8('0x7')]||_0x1be8('0x8');this[_0x1be8('0x9')]=_0x5a549a[_0x1be8('0x9')];this[_0x1be8('0xa')]={};this['waiting']=0x0;this[_0x1be8('0xb')]='';this['updateRouting']();this[_0x1be8('0xc')]();}MailQueue[_0x1be8('0xd')][_0x1be8('0xe')]=function(){var _0x5b2ac6=this['mapAgentsId']['_rr'];this['mapAgentsId']=_[_0x1be8('0xf')](this[_0x1be8('0x9')],'id');this['mapAgentsId'][_0x1be8('0x10')]=_0x5b2ac6;};MailQueue[_0x1be8('0xd')][_0x1be8('0xc')]=function(){this[_0x1be8('0x11')]=0x0;this[_0x1be8('0x12')]=0x0;for(var _0x1a4975=0x0;_0x1a4975=0x0?this[_0x1be8('0x16')]:0x0;var _0x562539={'id':this['id'],'available':this['available'],'loggedIn':this[_0x1be8('0x11')],'name':this['name'],'paused':this[_0x1be8('0x12')],'waiting':this[_0x1be8('0x17')]};var _0x34487d=md5(JSON[_0x1be8('0x18')](_0x562539));if(this[_0x1be8('0xb')]!==_0x34487d){this[_0x1be8('0xb')]=_0x34487d;io['to'](util[_0x1be8('0x19')](_0x1be8('0x1a'),_0x562539['name']))[_0x1be8('0x1b')](_0x1be8('0x1c'),_0x562539);}};module[_0x1be8('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 8fd6849..80d68d1 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 _0x326f=['exports','lodash','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','mapAgentsId','waiting','md5','updateRouting','updateRealtime','Agents','prototype','loggedIn','paused','online','openchannelPause','available','stringify','openchannel:queue:%s','openchannel_queue:save'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x326f,0xd1));var _0xf326=function(_0x49e5d5,_0x1e902e){_0x49e5d5=_0x49e5d5-0x0;var _0x1b75df=_0x326f[_0x49e5d5];return _0x1b75df;};'use strict';var _=require(_0xf326('0x0'));var md5=require('md5');var util=require('util');var Redis=require(_0xf326('0x1'));var config=require(_0xf326('0x2'));config[_0xf326('0x3')]=_[_0xf326('0x4')](config[_0xf326('0x3')],{'host':_0xf326('0x5'),'port':0x18eb});var io=require(_0xf326('0x6'))(new Redis(config[_0xf326('0x3')]));function OpenchannelQueue(_0x1b5a56){this['id']=_0x1b5a56['id']||0x0;this[_0xf326('0x7')]=_0x1b5a56['name']||'';this[_0xf326('0x8')]=_0x1b5a56[_0xf326('0x8')]||0xa;this[_0xf326('0x9')]=_0x1b5a56[_0xf326('0x9')]||'beepall';this['Agents']=_0x1b5a56['Agents'];this[_0xf326('0xa')]={};this[_0xf326('0xb')]=0x0;this[_0xf326('0xc')]='';this[_0xf326('0xd')]();this[_0xf326('0xe')]();}OpenchannelQueue['prototype'][_0xf326('0xd')]=function(){var _0x53cbcd=this[_0xf326('0xa')]['_rr'];this[_0xf326('0xa')]=_['map'](this[_0xf326('0xf')],'id');this[_0xf326('0xa')]['_rr']=_0x53cbcd;};OpenchannelQueue[_0xf326('0x10')][_0xf326('0xe')]=function(){this[_0xf326('0x11')]=0x0;this[_0xf326('0x12')]=0x0;for(var _0x5c8483=0x0;_0x5c8483=0x0?this[_0xf326('0x15')]:0x0;var _0x18bee3={'id':this['id'],'available':this[_0xf326('0x15')],'loggedIn':this[_0xf326('0x11')],'name':this[_0xf326('0x7')],'paused':this['paused'],'waiting':this['waiting']};var _0x56ad41=md5(JSON[_0xf326('0x16')](_0x18bee3));if(this[_0xf326('0xc')]!==_0x56ad41){this['md5']=_0x56ad41;io['to'](util['format'](_0xf326('0x17'),_0x18bee3['name']))['emit'](_0xf326('0x18'),_0x18bee3);}};module[_0xf326('0x19')]=OpenchannelQueue; \ No newline at end of file +var _0xc4aa=['strategy','Agents','mapAgentsId','updateRouting','updateRealtime','map','_rr','prototype','loggedIn','paused','length','online','available','waiting','stringify','format','openchannel:queue:%s','emit','openchannel_queue:save','lodash','md5','util','ioredis','../../../config/environment','redis','socket.io-emitter','name','timeout'];(function(_0x172747,_0x1732bd){var _0x509692=function(_0x448c56){while(--_0x448c56){_0x172747['push'](_0x172747['shift']());}};_0x509692(++_0x1732bd);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0xc4aa[_0x4b055c];return _0x4b62bb;};'use strict';var _=require(_0xac4a('0x0'));var md5=require(_0xac4a('0x1'));var util=require(_0xac4a('0x2'));var Redis=require(_0xac4a('0x3'));var config=require(_0xac4a('0x4'));config[_0xac4a('0x5')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xac4a('0x6'))(new Redis(config[_0xac4a('0x5')]));function OpenchannelQueue(_0x730a38){this['id']=_0x730a38['id']||0x0;this[_0xac4a('0x7')]=_0x730a38[_0xac4a('0x7')]||'';this[_0xac4a('0x8')]=_0x730a38[_0xac4a('0x8')]||0xa;this[_0xac4a('0x9')]=_0x730a38['strategy']||'beepall';this[_0xac4a('0xa')]=_0x730a38[_0xac4a('0xa')];this[_0xac4a('0xb')]={};this['waiting']=0x0;this[_0xac4a('0x1')]='';this[_0xac4a('0xc')]();this[_0xac4a('0xd')]();}OpenchannelQueue['prototype'][_0xac4a('0xc')]=function(){var _0x488e3c=this[_0xac4a('0xb')]['_rr'];this[_0xac4a('0xb')]=_[_0xac4a('0xe')](this[_0xac4a('0xa')],'id');this['mapAgentsId'][_0xac4a('0xf')]=_0x488e3c;};OpenchannelQueue[_0xac4a('0x10')][_0xac4a('0xd')]=function(){this[_0xac4a('0x11')]=0x0;this[_0xac4a('0x12')]=0x0;for(var _0x3b71c0=0x0;_0x3b71c0=0x0?this[_0xac4a('0x15')]:0x0;var _0x44ec59={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this[_0xac4a('0x7')],'paused':this[_0xac4a('0x12')],'waiting':this[_0xac4a('0x16')]};var _0x4d837c=md5(JSON[_0xac4a('0x17')](_0x44ec59));if(this[_0xac4a('0x1')]!==_0x4d837c){this[_0xac4a('0x1')]=_0x4d837c;io['to'](util[_0xac4a('0x18')](_0xac4a('0x19'),_0x44ec59[_0xac4a('0x7')]))[_0xac4a('0x1a')](_0xac4a('0x1b'),_0x44ec59);}};module['exports']=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index d3c6caf..ac46c69 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 _0xc6ab=['lodash','md5','util','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','updateRouting','updateRealtime','map','loggedIn','paused','smsPause','available','waiting','stringify','format','sms:queue:%s','emit'];(function(_0x18180e,_0x4be068){var _0x300bde=function(_0x51e7fc){while(--_0x51e7fc){_0x18180e['push'](_0x18180e['shift']());}};_0x300bde(++_0x4be068);}(_0xc6ab,0x96));var _0xbc6a=function(_0x51e898,_0x5921bd){_0x51e898=_0x51e898-0x0;var _0x5d93a6=_0xc6ab[_0x51e898];return _0x5d93a6;};'use strict';var _=require(_0xbc6a('0x0'));var md5=require(_0xbc6a('0x1'));var util=require(_0xbc6a('0x2'));var Redis=require(_0xbc6a('0x3'));var config=require(_0xbc6a('0x4'));config['redis']=_['defaults'](config[_0xbc6a('0x5')],{'host':_0xbc6a('0x6'),'port':0x18eb});var io=require(_0xbc6a('0x7'))(new Redis(config[_0xbc6a('0x5')]));function SmsQueue(_0x2767db){this['id']=_0x2767db['id']||0x0;this['name']=_0x2767db[_0xbc6a('0x8')]||'';this[_0xbc6a('0x9')]=_0x2767db[_0xbc6a('0x9')]||0xa;this[_0xbc6a('0xa')]=_0x2767db[_0xbc6a('0xa')]||'beepall';this['Agents']=_0x2767db[_0xbc6a('0xb')];this[_0xbc6a('0xc')]={};this['waiting']=0x0;this['md5']='';this[_0xbc6a('0xd')]();this[_0xbc6a('0xe')]();}SmsQueue['prototype'][_0xbc6a('0xd')]=function(){var _0xe1c7bd=this[_0xbc6a('0xc')]['_rr'];this[_0xbc6a('0xc')]=_[_0xbc6a('0xf')](this[_0xbc6a('0xb')],'id');this[_0xbc6a('0xc')]['_rr']=_0xe1c7bd;};SmsQueue['prototype']['updateRealtime']=function(){this[_0xbc6a('0x10')]=0x0;this[_0xbc6a('0x11')]=0x0;for(var _0x48d94a=0x0;_0x48d94a=0x0?this[_0xbc6a('0x13')]:0x0;var _0x2e8b88={'id':this['id'],'available':this[_0xbc6a('0x13')],'loggedIn':this[_0xbc6a('0x10')],'name':this[_0xbc6a('0x8')],'paused':this[_0xbc6a('0x11')],'waiting':this[_0xbc6a('0x14')]};var _0x31dc65=md5(JSON[_0xbc6a('0x15')](_0x2e8b88));if(this[_0xbc6a('0x1')]!==_0x31dc65){this[_0xbc6a('0x1')]=_0x31dc65;io['to'](util[_0xbc6a('0x16')](_0xbc6a('0x17'),_0x2e8b88['name']))[_0xbc6a('0x18')]('sms_queue:save',_0x2e8b88);}};module['exports']=SmsQueue; \ No newline at end of file +var _0x089f=['available','stringify','format','sms:queue:%s','emit','sms_queue:save','exports','md5','util','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRouting','prototype','_rr','updateRealtime','loggedIn','paused','length','online'];(function(_0x41b0f4,_0x48ca5f){var _0x58e944=function(_0x5c8487){while(--_0x5c8487){_0x41b0f4['push'](_0x41b0f4['shift']());}};_0x58e944(++_0x48ca5f);}(_0x089f,0x1c7));var _0xf089=function(_0x260255,_0x4668a4){_0x260255=_0x260255-0x0;var _0x566a56=_0x089f[_0x260255];return _0x566a56;};'use strict';var _=require('lodash');var md5=require(_0xf089('0x0'));var util=require(_0xf089('0x1'));var Redis=require(_0xf089('0x2'));var config=require(_0xf089('0x3'));config[_0xf089('0x4')]=_['defaults'](config[_0xf089('0x4')],{'host':_0xf089('0x5'),'port':0x18eb});var io=require(_0xf089('0x6'))(new Redis(config['redis']));function SmsQueue(_0x92f133){this['id']=_0x92f133['id']||0x0;this[_0xf089('0x7')]=_0x92f133[_0xf089('0x7')]||'';this['timeout']=_0x92f133[_0xf089('0x8')]||0xa;this[_0xf089('0x9')]=_0x92f133[_0xf089('0x9')]||'beepall';this[_0xf089('0xa')]=_0x92f133[_0xf089('0xa')];this[_0xf089('0xb')]={};this[_0xf089('0xc')]=0x0;this[_0xf089('0x0')]='';this[_0xf089('0xd')]();this['updateRealtime']();}SmsQueue[_0xf089('0xe')][_0xf089('0xd')]=function(){var _0x292556=this['mapAgentsId'][_0xf089('0xf')];this[_0xf089('0xb')]=_['map'](this['Agents'],'id');this[_0xf089('0xb')][_0xf089('0xf')]=_0x292556;};SmsQueue['prototype'][_0xf089('0x10')]=function(){this[_0xf089('0x11')]=0x0;this[_0xf089('0x12')]=0x0;for(var _0x337673=0x0;_0x337673=0x0?this[_0xf089('0x15')]:0x0;var _0x4e714a={'id':this['id'],'available':this[_0xf089('0x15')],'loggedIn':this[_0xf089('0x11')],'name':this['name'],'paused':this[_0xf089('0x12')],'waiting':this[_0xf089('0xc')]};var _0x5eadfe=md5(JSON[_0xf089('0x16')](_0x4e714a));if(this[_0xf089('0x0')]!==_0x5eadfe){this[_0xf089('0x0')]=_0x5eadfe;io['to'](util[_0xf089('0x17')](_0xf089('0x18'),_0x4e714a[_0xf089('0x7')]))[_0xf089('0x19')](_0xf089('0x1a'),_0x4e714a);}};module[_0xf089('0x1b')]=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index 211592b..41f575a 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 _0x6e33=['loggedIn','length','available','paused','waiting','format','emit','exports','lodash','md5','util','ioredis','../../../config/environment','defaults','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','updateRouting','updateRealtime','prototype','_rr','map'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x6e33,0x78));var _0x36e3=function(_0x3cb19f,_0x53cc71){_0x3cb19f=_0x3cb19f-0x0;var _0x312e16=_0x6e33[_0x3cb19f];return _0x312e16;};'use strict';var _=require(_0x36e3('0x0'));var md5=require(_0x36e3('0x1'));var util=require(_0x36e3('0x2'));var Redis=require(_0x36e3('0x3'));var config=require(_0x36e3('0x4'));config['redis']=_[_0x36e3('0x5')](config[_0x36e3('0x6')],{'host':_0x36e3('0x7'),'port':0x18eb});var io=require(_0x36e3('0x8'))(new Redis(config[_0x36e3('0x6')]));function WhatsappQueue(_0x1e0da7){this['id']=_0x1e0da7['id']||0x0;this[_0x36e3('0x9')]=_0x1e0da7[_0x36e3('0x9')]||'';this[_0x36e3('0xa')]=_0x1e0da7[_0x36e3('0xa')]||0xa;this[_0x36e3('0xb')]=_0x1e0da7[_0x36e3('0xb')]||_0x36e3('0xc');this[_0x36e3('0xd')]=_0x1e0da7[_0x36e3('0xd')];this[_0x36e3('0xe')]={};this['waiting']=0x0;this['md5']='';this[_0x36e3('0xf')]();this[_0x36e3('0x10')]();}WhatsappQueue[_0x36e3('0x11')][_0x36e3('0xf')]=function(){var _0x2a5f60=this[_0x36e3('0xe')][_0x36e3('0x12')];this['mapAgentsId']=_[_0x36e3('0x13')](this[_0x36e3('0xd')],'id');this['mapAgentsId'][_0x36e3('0x12')]=_0x2a5f60;};WhatsappQueue[_0x36e3('0x11')][_0x36e3('0x10')]=function(){this[_0x36e3('0x14')]=0x0;this['paused']=0x0;for(var _0x2d25b5=0x0;_0x2d25b5=0x0?this['available']:0x0;var _0x426d3a={'id':this['id'],'available':this[_0x36e3('0x16')],'loggedIn':this[_0x36e3('0x14')],'name':this[_0x36e3('0x9')],'paused':this[_0x36e3('0x17')],'waiting':this[_0x36e3('0x18')]};var _0x5b6d1a=md5(JSON['stringify'](_0x426d3a));if(this['md5']!==_0x5b6d1a){this[_0x36e3('0x1')]=_0x5b6d1a;io['to'](util[_0x36e3('0x19')]('whatsapp:queue:%s',_0x426d3a[_0x36e3('0x9')]))[_0x36e3('0x1a')]('whatsapp_queue:save',_0x426d3a);}};module[_0x36e3('0x1b')]=WhatsappQueue; \ No newline at end of file +var _0x5b86=['strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','prototype','_rr','map','loggedIn','paused','length','online','available','format','whatsapp:queue:%s','emit','md5','util','ioredis','redis','defaults','socket.io-emitter','name','timeout'];(function(_0x10da31,_0x269d39){var _0x1d3c36=function(_0x39ba02){while(--_0x39ba02){_0x10da31['push'](_0x10da31['shift']());}};_0x1d3c36(++_0x269d39);}(_0x5b86,0xd9));var _0x65b8=function(_0x54f639,_0x46a0de){_0x54f639=_0x54f639-0x0;var _0x58d5ce=_0x5b86[_0x54f639];return _0x58d5ce;};'use strict';var _=require('lodash');var md5=require(_0x65b8('0x0'));var util=require(_0x65b8('0x1'));var Redis=require(_0x65b8('0x2'));var config=require('../../../config/environment');config[_0x65b8('0x3')]=_[_0x65b8('0x4')](config[_0x65b8('0x3')],{'host':'localhost','port':0x18eb});var io=require(_0x65b8('0x5'))(new Redis(config[_0x65b8('0x3')]));function WhatsappQueue(_0x273919){this['id']=_0x273919['id']||0x0;this['name']=_0x273919[_0x65b8('0x6')]||'';this[_0x65b8('0x7')]=_0x273919['timeout']||0xa;this[_0x65b8('0x8')]=_0x273919['strategy']||_0x65b8('0x9');this[_0x65b8('0xa')]=_0x273919[_0x65b8('0xa')];this[_0x65b8('0xb')]={};this[_0x65b8('0xc')]=0x0;this[_0x65b8('0x0')]='';this[_0x65b8('0xd')]();this['updateRealtime']();}WhatsappQueue[_0x65b8('0xe')]['updateRouting']=function(){var _0x5068be=this['mapAgentsId'][_0x65b8('0xf')];this[_0x65b8('0xb')]=_[_0x65b8('0x10')](this[_0x65b8('0xa')],'id');this[_0x65b8('0xb')][_0x65b8('0xf')]=_0x5068be;};WhatsappQueue['prototype']['updateRealtime']=function(){this[_0x65b8('0x11')]=0x0;this[_0x65b8('0x12')]=0x0;for(var _0x5c29d1=0x0;_0x5c29d1=0x0?this['available']:0x0;var _0x6e006d={'id':this['id'],'available':this[_0x65b8('0x15')],'loggedIn':this[_0x65b8('0x11')],'name':this[_0x65b8('0x6')],'paused':this[_0x65b8('0x12')],'waiting':this[_0x65b8('0xc')]};var _0x151de3=md5(JSON['stringify'](_0x6e006d));if(this['md5']!==_0x151de3){this[_0x65b8('0x0')]=_0x151de3;io['to'](util[_0x65b8('0x16')](_0x65b8('0x17'),_0x6e006d[_0x65b8('0x6')]))[_0x65b8('0x18')]('whatsapp_queue:save',_0x6e006d);}};module['exports']=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index ff15050..84b7520 100644 --- a/server/services/routing/realtime/index.js +++ b/server/services/routing/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['isUndefined','initIntervals','updateRealtime','updateRouting','initSmsQueues','smsQueues','initMailQueues','mailQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','../model/interval','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','chatQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','length'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xa9e0[_0x3947c9];return _0x2e7871;};'use strict';var BPromise=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var moment=require('moment');var Agent=require('../model/agent');var Interval=require(_0x0a9e('0x3'));var OpenchannelQueue=require('../model/openchannelQueue');var ChatQueue=require(_0x0a9e('0x4'));var SmsQueue=require(_0x0a9e('0x5'));var MailQueue=require(_0x0a9e('0x6'));var FaxQueue=require(_0x0a9e('0x7'));var WhatsappQueue=require(_0x0a9e('0x8'));var Realtime=function(){this['agents']={};this[_0x0a9e('0x9')]={};this[_0x0a9e('0xa')]={};this[_0x0a9e('0xb')]={};this['smsQueues']={};this['mailQueues']={};this[_0x0a9e('0xc')]={};this['whatsappQueues']={};this['chatQueuesWaitingInteractions']={};this[_0x0a9e('0xd')]={};this[_0x0a9e('0xe')]={};this[_0x0a9e('0xf')]={};this[_0x0a9e('0x10')]={};this[_0x0a9e('0x11')]={};};function freeIsNotKey(_0xbd1168,_0x4a4c56,_0x50dfb2){var _0x527cdd=_['mapKeys'](_0xbd1168,function(_0x273d4d,_0x36471c){return _0x273d4d[_0x50dfb2];});for(var _0xd5b662 in _0x4a4c56){if(_0x4a4c56[_0x0a9e('0x12')](_0xd5b662)){if(!_0x527cdd[_0xd5b662]){delete _0x4a4c56[_0xd5b662];}}}}Realtime[_0x0a9e('0x13')][_0x0a9e('0x14')]=function(_0x5db4b0,_0x4283ce){for(var _0x239b12 in _0x4283ce){if(_0x5db4b0[_0x0a9e('0x12')](_0x239b12)){_0x5db4b0[_0x239b12]=_0x4283ce[_0x239b12];}}};Realtime[_0x0a9e('0x13')][_0x0a9e('0x15')]=function(){var _0x4d5611=this;return function(_0x52a03d){if(_0x52a03d){freeIsNotKey(_0x52a03d,_0x4d5611[_0x0a9e('0x16')],'id');for(var _0x5d0880=0x0,_0x1985b6={},_0x519dfd={};_0x5d0880<_0x52a03d[_0x0a9e('0x17')];_0x5d0880+=0x1){_0x1985b6=_0x52a03d[_0x5d0880];if(_[_0x0a9e('0x18')](_0x4d5611['agents'][_0x1985b6['id']])){_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']]=new Agent(_0x1985b6);}else{_0x4d5611['mergeFromDatabase'](_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']],_0x1985b6);}}}return _0x4d5611[_0x0a9e('0x16')];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x19')]=function(){var _0x31b1ca=this;return function(_0x2eb11f){if(_0x2eb11f){freeIsNotKey(_0x2eb11f,_0x31b1ca[_0x0a9e('0x9')],'id');for(var _0x20559e=0x0,_0x1314ae={},_0x112016={};_0x20559e<_0x2eb11f[_0x0a9e('0x17')];_0x20559e+=0x1){_0x1314ae=_0x2eb11f[_0x20559e];if(_[_0x0a9e('0x18')](_0x31b1ca['intervals'][_0x1314ae['id']])){_0x31b1ca[_0x0a9e('0x9')][_0x1314ae['id']]=new Interval(_0x1314ae);}else{_0x31b1ca[_0x0a9e('0x14')](_0x31b1ca['intervals'][_0x1314ae['id']],_0x1314ae);}}}return _0x31b1ca[_0x0a9e('0x9')];};};Realtime['prototype']['initOpenchannelQueues']=function(){var _0x3a02e1=this;return function(_0x432e56){if(_0x432e56){freeIsNotKey(_0x432e56,_0x3a02e1[_0x0a9e('0xa')],'id');for(var _0x30bae6=0x0,_0x4abc77={},_0xfb6e48={};_0x30bae6<_0x432e56[_0x0a9e('0x17')];_0x30bae6+=0x1){_0x4abc77=_0x432e56[_0x30bae6];if(_[_0x0a9e('0x18')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']])){_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']]=new OpenchannelQueue(_0x4abc77);}else{_0x3a02e1[_0x0a9e('0x14')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']],_0x4abc77);}_0x3a02e1['openchannelQueues'][_0x4abc77['id']]['updateRouting']();_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']][_0x0a9e('0x1a')]();}}return _0x3a02e1[_0x0a9e('0xa')];};};Realtime[_0x0a9e('0x13')]['initChatQueues']=function(){var _0x384319=this;return function(_0x479bc4){if(_0x479bc4){freeIsNotKey(_0x479bc4,_0x384319[_0x0a9e('0xb')],'id');for(var _0x5bfb33=0x0,_0x1dc186={},_0x34dc65={};_0x5bfb33<_0x479bc4[_0x0a9e('0x17')];_0x5bfb33+=0x1){_0x1dc186=_0x479bc4[_0x5bfb33];if(_[_0x0a9e('0x18')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']])){_0x384319[_0x0a9e('0xb')][_0x1dc186['id']]=new ChatQueue(_0x1dc186);}else{_0x384319[_0x0a9e('0x14')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']],_0x1dc186);}_0x384319['chatQueues'][_0x1dc186['id']][_0x0a9e('0x1b')]();_0x384319[_0x0a9e('0xb')][_0x1dc186['id']][_0x0a9e('0x1a')]();}}return _0x384319[_0x0a9e('0xb')];};};Realtime['prototype'][_0x0a9e('0x1c')]=function(){var _0x40e7a3=this;return function(_0x1843b2){if(_0x1843b2){freeIsNotKey(_0x1843b2,_0x40e7a3[_0x0a9e('0x1d')],'id');for(var _0x58b06f=0x0,_0x563b45={},_0x296f41={};_0x58b06f<_0x1843b2[_0x0a9e('0x17')];_0x58b06f+=0x1){_0x563b45=_0x1843b2[_0x58b06f];if(_[_0x0a9e('0x18')](_0x40e7a3['smsQueues'][_0x563b45['id']])){_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']]=new SmsQueue(_0x563b45);}else{_0x40e7a3['mergeFromDatabase'](_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']],_0x563b45);}_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1b')]();_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1a')]();}}return _0x40e7a3['smsQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x1e')]=function(){var _0x40cb85=this;return function(_0x2da5c0){if(_0x2da5c0){freeIsNotKey(_0x2da5c0,_0x40cb85[_0x0a9e('0x1f')],'id');for(var _0x409319=0x0,_0x332d35={},_0x39e565={};_0x409319<_0x2da5c0['length'];_0x409319+=0x1){_0x332d35=_0x2da5c0[_0x409319];if(_[_0x0a9e('0x18')](_0x40cb85['mailQueues'][_0x332d35['id']])){_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]=new MailQueue(_0x332d35);}else{_0x40cb85[_0x0a9e('0x14')](_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']],_0x332d35);}_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]['updateRouting']();_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']][_0x0a9e('0x1a')]();}}return _0x40cb85[_0x0a9e('0x1f')];};};Realtime[_0x0a9e('0x13')]['initFaxQueues']=function(){var _0x54135e=this;return function(_0x1e8694){if(_0x1e8694){freeIsNotKey(_0x1e8694,_0x54135e['faxQueues'],'id');for(var _0x24936a=0x0,_0x3d9717={},_0x381c37={};_0x24936a<_0x1e8694[_0x0a9e('0x17')];_0x24936a+=0x1){_0x3d9717=_0x1e8694[_0x24936a];if(_['isUndefined'](_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']])){_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]=new FaxQueue(_0x3d9717);}else{_0x54135e[_0x0a9e('0x14')](_0x54135e['faxQueues'][_0x3d9717['id']],_0x3d9717);}_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']][_0x0a9e('0x1b')]();_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]['updateRealtime']();}}return _0x54135e['faxQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x20')]=function(){var _0x5adda1=this;return function(_0x2b814e){if(_0x2b814e){freeIsNotKey(_0x2b814e,_0x5adda1[_0x0a9e('0x21')],'id');for(var _0x2e1b3a=0x0,_0x148f55={},_0x4b38d9={};_0x2e1b3a<_0x2b814e['length'];_0x2e1b3a+=0x1){_0x148f55=_0x2b814e[_0x2e1b3a];if(_[_0x0a9e('0x18')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']])){_0x5adda1['whatsappQueues'][_0x148f55['id']]=new WhatsappQueue(_0x148f55);}else{_0x5adda1[_0x0a9e('0x14')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']],_0x148f55);}_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']]['updateRouting']();_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']][_0x0a9e('0x1a')]();}}return _0x5adda1[_0x0a9e('0x21')];};};module[_0x0a9e('0x22')]=Realtime; \ No newline at end of file +var _0xa9e0=['isUndefined','initIntervals','updateRealtime','updateRouting','initSmsQueues','smsQueues','initMailQueues','mailQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','../model/interval','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','chatQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','length'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0xa9e0[_0x139a3c];return _0x2b375b;};'use strict';var BPromise=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var moment=require('moment');var Agent=require('../model/agent');var Interval=require(_0x0a9e('0x3'));var OpenchannelQueue=require('../model/openchannelQueue');var ChatQueue=require(_0x0a9e('0x4'));var SmsQueue=require(_0x0a9e('0x5'));var MailQueue=require(_0x0a9e('0x6'));var FaxQueue=require(_0x0a9e('0x7'));var WhatsappQueue=require(_0x0a9e('0x8'));var Realtime=function(){this['agents']={};this[_0x0a9e('0x9')]={};this[_0x0a9e('0xa')]={};this[_0x0a9e('0xb')]={};this['smsQueues']={};this['mailQueues']={};this[_0x0a9e('0xc')]={};this['whatsappQueues']={};this['chatQueuesWaitingInteractions']={};this[_0x0a9e('0xd')]={};this[_0x0a9e('0xe')]={};this[_0x0a9e('0xf')]={};this[_0x0a9e('0x10')]={};this[_0x0a9e('0x11')]={};};function freeIsNotKey(_0xbd1168,_0x4a4c56,_0x50dfb2){var _0x527cdd=_['mapKeys'](_0xbd1168,function(_0x273d4d,_0x36471c){return _0x273d4d[_0x50dfb2];});for(var _0xd5b662 in _0x4a4c56){if(_0x4a4c56[_0x0a9e('0x12')](_0xd5b662)){if(!_0x527cdd[_0xd5b662]){delete _0x4a4c56[_0xd5b662];}}}}Realtime[_0x0a9e('0x13')][_0x0a9e('0x14')]=function(_0x5db4b0,_0x4283ce){for(var _0x239b12 in _0x4283ce){if(_0x5db4b0[_0x0a9e('0x12')](_0x239b12)){_0x5db4b0[_0x239b12]=_0x4283ce[_0x239b12];}}};Realtime[_0x0a9e('0x13')][_0x0a9e('0x15')]=function(){var _0x4d5611=this;return function(_0x52a03d){if(_0x52a03d){freeIsNotKey(_0x52a03d,_0x4d5611[_0x0a9e('0x16')],'id');for(var _0x5d0880=0x0,_0x1985b6={},_0x519dfd={};_0x5d0880<_0x52a03d[_0x0a9e('0x17')];_0x5d0880+=0x1){_0x1985b6=_0x52a03d[_0x5d0880];if(_[_0x0a9e('0x18')](_0x4d5611['agents'][_0x1985b6['id']])){_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']]=new Agent(_0x1985b6);}else{_0x4d5611['mergeFromDatabase'](_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']],_0x1985b6);}}}return _0x4d5611[_0x0a9e('0x16')];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x19')]=function(){var _0x31b1ca=this;return function(_0x2eb11f){if(_0x2eb11f){freeIsNotKey(_0x2eb11f,_0x31b1ca[_0x0a9e('0x9')],'id');for(var _0x20559e=0x0,_0x1314ae={},_0x112016={};_0x20559e<_0x2eb11f[_0x0a9e('0x17')];_0x20559e+=0x1){_0x1314ae=_0x2eb11f[_0x20559e];if(_[_0x0a9e('0x18')](_0x31b1ca['intervals'][_0x1314ae['id']])){_0x31b1ca[_0x0a9e('0x9')][_0x1314ae['id']]=new Interval(_0x1314ae);}else{_0x31b1ca[_0x0a9e('0x14')](_0x31b1ca['intervals'][_0x1314ae['id']],_0x1314ae);}}}return _0x31b1ca[_0x0a9e('0x9')];};};Realtime['prototype']['initOpenchannelQueues']=function(){var _0x3a02e1=this;return function(_0x432e56){if(_0x432e56){freeIsNotKey(_0x432e56,_0x3a02e1[_0x0a9e('0xa')],'id');for(var _0x30bae6=0x0,_0x4abc77={},_0xfb6e48={};_0x30bae6<_0x432e56[_0x0a9e('0x17')];_0x30bae6+=0x1){_0x4abc77=_0x432e56[_0x30bae6];if(_[_0x0a9e('0x18')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']])){_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']]=new OpenchannelQueue(_0x4abc77);}else{_0x3a02e1[_0x0a9e('0x14')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']],_0x4abc77);}_0x3a02e1['openchannelQueues'][_0x4abc77['id']]['updateRouting']();_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']][_0x0a9e('0x1a')]();}}return _0x3a02e1[_0x0a9e('0xa')];};};Realtime[_0x0a9e('0x13')]['initChatQueues']=function(){var _0x384319=this;return function(_0x479bc4){if(_0x479bc4){freeIsNotKey(_0x479bc4,_0x384319[_0x0a9e('0xb')],'id');for(var _0x5bfb33=0x0,_0x1dc186={},_0x34dc65={};_0x5bfb33<_0x479bc4[_0x0a9e('0x17')];_0x5bfb33+=0x1){_0x1dc186=_0x479bc4[_0x5bfb33];if(_[_0x0a9e('0x18')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']])){_0x384319[_0x0a9e('0xb')][_0x1dc186['id']]=new ChatQueue(_0x1dc186);}else{_0x384319[_0x0a9e('0x14')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']],_0x1dc186);}_0x384319['chatQueues'][_0x1dc186['id']][_0x0a9e('0x1b')]();_0x384319[_0x0a9e('0xb')][_0x1dc186['id']][_0x0a9e('0x1a')]();}}return _0x384319[_0x0a9e('0xb')];};};Realtime['prototype'][_0x0a9e('0x1c')]=function(){var _0x40e7a3=this;return function(_0x1843b2){if(_0x1843b2){freeIsNotKey(_0x1843b2,_0x40e7a3[_0x0a9e('0x1d')],'id');for(var _0x58b06f=0x0,_0x563b45={},_0x296f41={};_0x58b06f<_0x1843b2[_0x0a9e('0x17')];_0x58b06f+=0x1){_0x563b45=_0x1843b2[_0x58b06f];if(_[_0x0a9e('0x18')](_0x40e7a3['smsQueues'][_0x563b45['id']])){_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']]=new SmsQueue(_0x563b45);}else{_0x40e7a3['mergeFromDatabase'](_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']],_0x563b45);}_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1b')]();_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1a')]();}}return _0x40e7a3['smsQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x1e')]=function(){var _0x40cb85=this;return function(_0x2da5c0){if(_0x2da5c0){freeIsNotKey(_0x2da5c0,_0x40cb85[_0x0a9e('0x1f')],'id');for(var _0x409319=0x0,_0x332d35={},_0x39e565={};_0x409319<_0x2da5c0['length'];_0x409319+=0x1){_0x332d35=_0x2da5c0[_0x409319];if(_[_0x0a9e('0x18')](_0x40cb85['mailQueues'][_0x332d35['id']])){_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]=new MailQueue(_0x332d35);}else{_0x40cb85[_0x0a9e('0x14')](_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']],_0x332d35);}_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]['updateRouting']();_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']][_0x0a9e('0x1a')]();}}return _0x40cb85[_0x0a9e('0x1f')];};};Realtime[_0x0a9e('0x13')]['initFaxQueues']=function(){var _0x54135e=this;return function(_0x1e8694){if(_0x1e8694){freeIsNotKey(_0x1e8694,_0x54135e['faxQueues'],'id');for(var _0x24936a=0x0,_0x3d9717={},_0x381c37={};_0x24936a<_0x1e8694[_0x0a9e('0x17')];_0x24936a+=0x1){_0x3d9717=_0x1e8694[_0x24936a];if(_['isUndefined'](_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']])){_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]=new FaxQueue(_0x3d9717);}else{_0x54135e[_0x0a9e('0x14')](_0x54135e['faxQueues'][_0x3d9717['id']],_0x3d9717);}_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']][_0x0a9e('0x1b')]();_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]['updateRealtime']();}}return _0x54135e['faxQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x20')]=function(){var _0x5adda1=this;return function(_0x2b814e){if(_0x2b814e){freeIsNotKey(_0x2b814e,_0x5adda1[_0x0a9e('0x21')],'id');for(var _0x2e1b3a=0x0,_0x148f55={},_0x4b38d9={};_0x2e1b3a<_0x2b814e['length'];_0x2e1b3a+=0x1){_0x148f55=_0x2b814e[_0x2e1b3a];if(_[_0x0a9e('0x18')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']])){_0x5adda1['whatsappQueues'][_0x148f55['id']]=new WhatsappQueue(_0x148f55);}else{_0x5adda1[_0x0a9e('0x14')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']],_0x148f55);}_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']]['updateRouting']();_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']][_0x0a9e('0x1a')]();}}return _0x5adda1[_0x0a9e('0x21')];};};module[_0x0a9e('0x22')]=Realtime; \ No newline at end of file diff --git a/server/services/routing/rpc/chatInteraction.js b/server/services/routing/rpc/chatInteraction.js index 021fd27..1138d0d 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 _0x1d9a=['UpdateChatInteraction','updateChatInteraction','addTags','addTagsToChatInteraction','../client','Request'];(function(_0x1828d9,_0x194edb){var _0x59fab2=function(_0x424b6d){while(--_0x424b6d){_0x1828d9['push'](_0x1828d9['shift']());}};_0x59fab2(++_0x194edb);}(_0x1d9a,0x14e));var _0xa1d9=function(_0x3c9c40,_0x3cdba1){_0x3c9c40=_0x3c9c40-0x0;var _0x34015f=_0x1d9a[_0x3c9c40];return _0x34015f;};'use strict';var client=require(_0xa1d9('0x0'));exports['update']=function(_0x488e78,_0x2d374a){return client[_0xa1d9('0x1')](_0xa1d9('0x2'),{'body':_0x2d374a,'options':{'where':{'id':_0x488e78}},'log':_0xa1d9('0x3')});};exports[_0xa1d9('0x4')]=function(_0x1ddb4e,_0x50715c){return client['Request']('AddTagsToChatInteraction',{'body':_0x50715c,'options':{'where':{'id':_0x1ddb4e}},'log':_0xa1d9('0x5')});}; \ No newline at end of file +var _0x2e65=['AddTagsToChatInteraction','../client','update'];(function(_0x210d77,_0x2331eb){var _0x581190=function(_0x5a7308){while(--_0x5a7308){_0x210d77['push'](_0x210d77['shift']());}};_0x581190(++_0x2331eb);}(_0x2e65,0x127));var _0x52e6=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x2e65[_0x13d07a];return _0x5ee0ee;};'use strict';var client=require(_0x52e6('0x0'));exports[_0x52e6('0x1')]=function(_0x153609,_0x29a812){return client['Request']('UpdateChatInteraction',{'body':_0x29a812,'options':{'where':{'id':_0x153609}},'log':'updateChatInteraction'});};exports['addTags']=function(_0x2f5437,_0x25b64a){return client['Request'](_0x52e6('0x2'),{'body':_0x25b64a,'options':{'where':{'id':_0x2f5437}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index bf3c34f..a2be10f 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 _0x75ee=['Request','CreateChatMessage','createChatMessage','../client','create'];(function(_0x895ad0,_0xf67203){var _0x3d32f9=function(_0x5a6e55){while(--_0x5a6e55){_0x895ad0['push'](_0x895ad0['shift']());}};_0x3d32f9(++_0xf67203);}(_0x75ee,0xe4));var _0xe75e=function(_0x15106b,_0x4d96f6){_0x15106b=_0x15106b-0x0;var _0x521203=_0x75ee[_0x15106b];return _0x521203;};'use strict';var client=require(_0xe75e('0x0'));exports[_0xe75e('0x1')]=function(_0xc4b5cd){return client[_0xe75e('0x2')](_0xe75e('0x3'),{'body':_0xc4b5cd,'log':_0xe75e('0x4')});}; \ No newline at end of file +var _0x679c=['../client','create','Request','CreateChatMessage','createChatMessage'];(function(_0x5028f3,_0x494b79){var _0x2f3bdf=function(_0xb44bfe){while(--_0xb44bfe){_0x5028f3['push'](_0x5028f3['shift']());}};_0x2f3bdf(++_0x494b79);}(_0x679c,0x1d1));var _0xc679=function(_0x403d90,_0x2a312a){_0x403d90=_0x403d90-0x0;var _0x198696=_0x679c[_0x403d90];return _0x198696;};'use strict';var client=require(_0xc679('0x0'));exports[_0xc679('0x1')]=function(_0x28f1a3){return client[_0xc679('0x2')](_0xc679('0x3'),{'body':_0x28f1a3,'log':_0xc679('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index aa1f8e0..01f7741 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 _0x24ca=['Agents','online','chatPause','getChatQueues','../client','Request','GetChatQueue','name','strategy','User'];(function(_0x127c7b,_0x1f65e7){var _0x1708eb=function(_0x2033e5){while(--_0x2033e5){_0x127c7b['push'](_0x127c7b['shift']());}};_0x1708eb(++_0x1f65e7);}(_0x24ca,0x1bc));var _0xa24c=function(_0x19691f,_0x159737){_0x19691f=_0x19691f-0x0;var _0x5677b6=_0x24ca[_0x19691f];return _0x5677b6;};'use strict';var client=require(_0xa24c('0x0'));exports['getChatQueues']=function(){return function(){return client[_0xa24c('0x1')](_0xa24c('0x2'),{'options':{'raw':![],'attributes':['id',_0xa24c('0x3'),'timeout',_0xa24c('0x4')],'include':[{'model':_0xa24c('0x5'),'as':_0xa24c('0x6'),'attributes':['id',_0xa24c('0x3'),_0xa24c('0x7'),_0xa24c('0x8')]}]},'log':_0xa24c('0x9')});};}; \ No newline at end of file +var _0x13fe=['online','chatPause','../client','getChatQueues','Request','GetChatQueue','name','timeout','User','Agents'];(function(_0x388de6,_0x588921){var _0x8f12ac=function(_0xd5123f){while(--_0xd5123f){_0x388de6['push'](_0x388de6['shift']());}};_0x8f12ac(++_0x588921);}(_0x13fe,0x138));var _0xe13f=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0x13fe[_0x31e29a];return _0x32d892;};'use strict';var client=require(_0xe13f('0x0'));exports[_0xe13f('0x1')]=function(){return function(){return client[_0xe13f('0x2')](_0xe13f('0x3'),{'options':{'raw':![],'attributes':['id',_0xe13f('0x4'),_0xe13f('0x5'),'strategy'],'include':[{'model':_0xe13f('0x6'),'as':_0xe13f('0x7'),'attributes':['id',_0xe13f('0x4'),_0xe13f('0x8'),_0xe13f('0x9')]}]},'log':_0xe13f('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index 2d9242b..e3bd864 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 _0xc9f5=['DESC','create','CreateChatQueueReport','update','Request'];(function(_0x3592cc,_0x1aa735){var _0xce780c=function(_0x2abfe7){while(--_0x2abfe7){_0x3592cc['push'](_0x3592cc['shift']());}};_0xce780c(++_0x1aa735);}(_0xc9f5,0xc4));var _0x5c9f=function(_0x37e886,_0x17d0ad){_0x37e886=_0x37e886-0x0;var _0x57c5cd=_0xc9f5[_0x37e886];return _0x57c5cd;};'use strict';var client=require('../client');exports[_0x5c9f('0x0')]=function(_0x3bae7f){return client['Request'](_0x5c9f('0x1'),{'body':_0x3bae7f,'log':_0x5c9f('0x1')});};exports[_0x5c9f('0x2')]=function(_0x5a1ee5,_0x4a046a){return client[_0x5c9f('0x3')]('UpdateChatQueueReport',{'body':_0x4a046a,'options':{'where':{'uniqueid':_0x5a1ee5},'order':[['id',_0x5c9f('0x4')]],'limit':0x1},'log':'UpdateChatQueueReport'});}; \ No newline at end of file +var _0x0b78=['CreateChatQueueReport','update','UpdateChatQueueReport','../client','create','Request'];(function(_0x2f3848,_0x48564d){var _0x102668=function(_0x5e32ab){while(--_0x5e32ab){_0x2f3848['push'](_0x2f3848['shift']());}};_0x102668(++_0x48564d);}(_0x0b78,0x1ad));var _0x80b7=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x0b78[_0xfae23b];return _0x200640;};'use strict';var client=require(_0x80b7('0x0'));exports[_0x80b7('0x1')]=function(_0x5d450f){return client[_0x80b7('0x2')](_0x80b7('0x3'),{'body':_0x5d450f,'log':'CreateChatQueueReport'});};exports[_0x80b7('0x4')]=function(_0x4ee9b4,_0x6a187e){return client[_0x80b7('0x2')](_0x80b7('0x5'),{'body':_0x6a187e,'options':{'where':{'uniqueid':_0x4ee9b4},'order':[['id','DESC']],'limit':0x1},'log':'UpdateChatQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index ed5a3ae..3abb1e4 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(_0x26cbd5,_0x544907){var _0xa098aa=function(_0x54ee89){while(--_0x54ee89){_0x26cbd5['push'](_0x26cbd5['shift']());}};_0xa098aa(++_0x544907);}(_0x9957,0x93));var _0x7995=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x9957[_0x19e35c];return _0x3e1fe8;};'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 _0x9957=['Request','AddTagsToFaxInteraction','addTagsToFaxInteraction','../client','update','UpdateFaxInteraction','updateFaxInteraction','addTags'];(function(_0x23eeac,_0x3b38e2){var _0x34c005=function(_0x87d52d){while(--_0x87d52d){_0x23eeac['push'](_0x23eeac['shift']());}};_0x34c005(++_0x3b38e2);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'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 diff --git a/server/services/routing/rpc/faxMessage.js b/server/services/routing/rpc/faxMessage.js index c011ea3..7b78827 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 _0xe2e5=['Request','CreateFaxMessage','createFaxMessage','../client','create'];(function(_0x22e84e,_0x3d170e){var _0x28db0a=function(_0x1ff0a7){while(--_0x1ff0a7){_0x22e84e['push'](_0x22e84e['shift']());}};_0x28db0a(++_0x3d170e);}(_0xe2e5,0x12f));var _0x5e2e=function(_0x51d706,_0x35d49a){_0x51d706=_0x51d706-0x0;var _0x4c742c=_0xe2e5[_0x51d706];return _0x4c742c;};'use strict';var client=require(_0x5e2e('0x0'));exports[_0x5e2e('0x1')]=function(_0x4264ff){return client[_0x5e2e('0x2')](_0x5e2e('0x3'),{'body':_0x4264ff,'log':_0x5e2e('0x4')});}; \ No newline at end of file +var _0x9e63=['../client','create','Request','createFaxMessage'];(function(_0x478414,_0xcf142d){var _0x5eb6b9=function(_0x10e6fe){while(--_0x10e6fe){_0x478414['push'](_0x478414['shift']());}};_0x5eb6b9(++_0xcf142d);}(_0x9e63,0xb0));var _0x39e6=function(_0x3635ce,_0x33a6f9){_0x3635ce=_0x3635ce-0x0;var _0x97ecd0=_0x9e63[_0x3635ce];return _0x97ecd0;};'use strict';var client=require(_0x39e6('0x0'));exports[_0x39e6('0x1')]=function(_0x25545c){return client[_0x39e6('0x2')]('CreateFaxMessage',{'body':_0x25545c,'log':_0x39e6('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index 6661e9f..216318d 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 _0x47a4=['User','Agents','online','getFaxQueues','Request','GetFaxQueue','name','timeout','strategy'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x47a4,0x9d));var _0x447a=function(_0x3e273d,_0x409bb9){_0x3e273d=_0x3e273d-0x0;var _0x2c0711=_0x47a4[_0x3e273d];return _0x2c0711;};'use strict';var client=require('../client');exports['getFaxQueues']=function(){return function(){return client[_0x447a('0x0')](_0x447a('0x1'),{'options':{'raw':![],'attributes':['id',_0x447a('0x2'),_0x447a('0x3'),_0x447a('0x4')],'include':[{'model':_0x447a('0x5'),'as':_0x447a('0x6'),'attributes':['id',_0x447a('0x2'),_0x447a('0x7'),'faxPause']}]},'log':_0x447a('0x8')});};}; \ No newline at end of file +var _0x85b5=['Request','GetFaxQueue','name','timeout','Agents','online','faxPause','getFaxQueues','../client'];(function(_0x2160a9,_0x3cbd9e){var _0xa88cf7=function(_0x51ab6f){while(--_0x51ab6f){_0x2160a9['push'](_0x2160a9['shift']());}};_0xa88cf7(++_0x3cbd9e);}(_0x85b5,0x131));var _0x585b=function(_0x5c27cf,_0x4041d){_0x5c27cf=_0x5c27cf-0x0;var _0x4ed1c5=_0x85b5[_0x5c27cf];return _0x4ed1c5;};'use strict';var client=require(_0x585b('0x0'));exports['getFaxQueues']=function(){return function(){return client[_0x585b('0x1')](_0x585b('0x2'),{'options':{'raw':![],'attributes':['id',_0x585b('0x3'),_0x585b('0x4'),'strategy'],'include':[{'model':'User','as':_0x585b('0x5'),'attributes':['id','name',_0x585b('0x6'),_0x585b('0x7')]}]},'log':_0x585b('0x8')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index 0b2b450..3e59a03 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 _0x3ea2=['CreateFaxQueueReport','update','UpdateFaxQueueReport','DESC','create','Request'];(function(_0x37d278,_0x2cca15){var _0x188c9b=function(_0x2c18eb){while(--_0x2c18eb){_0x37d278['push'](_0x37d278['shift']());}};_0x188c9b(++_0x2cca15);}(_0x3ea2,0xd6));var _0x23ea=function(_0x20db6c,_0x4ff24a){_0x20db6c=_0x20db6c-0x0;var _0x30b5d3=_0x3ea2[_0x20db6c];return _0x30b5d3;};'use strict';var client=require('../client');exports[_0x23ea('0x0')]=function(_0x4cbcfb){return client[_0x23ea('0x1')](_0x23ea('0x2'),{'body':_0x4cbcfb,'log':_0x23ea('0x2')});};exports[_0x23ea('0x3')]=function(_0x2b0459,_0x54c984){return client[_0x23ea('0x1')](_0x23ea('0x4'),{'body':_0x54c984,'options':{'where':{'uniqueid':_0x2b0459},'order':[['id',_0x23ea('0x5')]],'limit':0x1},'log':_0x23ea('0x4')});}; \ No newline at end of file +var _0x3a44=['update','Request','UpdateFaxQueueReport','DESC','../client','create','CreateFaxQueueReport'];(function(_0x3b0731,_0xcf9925){var _0x4204d7=function(_0x635ac5){while(--_0x635ac5){_0x3b0731['push'](_0x3b0731['shift']());}};_0x4204d7(++_0xcf9925);}(_0x3a44,0x1d9));var _0x43a4=function(_0x50508f,_0x12a142){_0x50508f=_0x50508f-0x0;var _0xe34922=_0x3a44[_0x50508f];return _0xe34922;};'use strict';var client=require(_0x43a4('0x0'));exports[_0x43a4('0x1')]=function(_0x3863e6){return client['Request'](_0x43a4('0x2'),{'body':_0x3863e6,'log':_0x43a4('0x2')});};exports[_0x43a4('0x3')]=function(_0x3a5c7b,_0xec6b04){return client[_0x43a4('0x4')](_0x43a4('0x5'),{'body':_0xec6b04,'options':{'where':{'uniqueid':_0x3a5c7b},'order':[['id',_0x43a4('0x6')]],'limit':0x1},'log':_0x43a4('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index c81fd4f..5fed5d4 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 _0x6c7a=['getIntervals','Request','name','Intervals','interval','../client'];(function(_0x5a592a,_0x5c1e39){var _0x272a7d=function(_0x697752){while(--_0x697752){_0x5a592a['push'](_0x5a592a['shift']());}};_0x272a7d(++_0x5c1e39);}(_0x6c7a,0x1d3));var _0xa6c7=function(_0x26e3d3,_0x228666){_0x26e3d3=_0x26e3d3-0x0;var _0x1f8aab=_0x6c7a[_0x26e3d3];return _0x1f8aab;};'use strict';var client=require(_0xa6c7('0x0'));exports[_0xa6c7('0x1')]=function(){return function(){return client[_0xa6c7('0x2')]('GetInterval',{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0xa6c7('0x3')],'include':[{'model':'Interval','as':_0xa6c7('0x4'),'attributes':['id',_0xa6c7('0x3'),_0xa6c7('0x5')]}]},'log':'getIntervals'});};}; \ No newline at end of file +var _0x921d=['Request','GetInterval','Interval','Intervals','name','interval','../client','getIntervals'];(function(_0x3d6b32,_0x1ed727){var _0x3b48b1=function(_0x211c3f){while(--_0x211c3f){_0x3d6b32['push'](_0x3d6b32['shift']());}};_0x3b48b1(++_0x1ed727);}(_0x921d,0x126));var _0xd921=function(_0x4173cb,_0x15ca4a){_0x4173cb=_0x4173cb-0x0;var _0x4e5805=_0x921d[_0x4173cb];return _0x4e5805;};'use strict';var client=require(_0xd921('0x0'));exports[_0xd921('0x1')]=function(){return function(){return client[_0xd921('0x2')](_0xd921('0x3'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id','name'],'include':[{'model':_0xd921('0x4'),'as':_0xd921('0x5'),'attributes':['id',_0xd921('0x6'),_0xd921('0x7')]}]},'log':_0xd921('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index 541843a..7f4cba3 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 _0x781d=['AddTagsToMailInteraction','addTagsToChatInteraction','../client','update','Request','UpdateMailInteraction','updateMailInteraction','addTags'];(function(_0x360ec,_0x585d47){var _0xf03953=function(_0xf081db){while(--_0xf081db){_0x360ec['push'](_0x360ec['shift']());}};_0xf03953(++_0x585d47);}(_0x781d,0x14a));var _0xd781=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x781d[_0x3b380d];return _0x54502b;};'use strict';var client=require(_0xd781('0x0'));exports[_0xd781('0x1')]=function(_0x596ba2,_0x5c1007){return client[_0xd781('0x2')](_0xd781('0x3'),{'body':_0x5c1007,'options':{'where':{'id':_0x596ba2}},'log':_0xd781('0x4')});};exports[_0xd781('0x5')]=function(_0xfd915d,_0x42258e){return client[_0xd781('0x2')](_0xd781('0x6'),{'body':_0x42258e,'options':{'where':{'id':_0xfd915d}},'log':_0xd781('0x7')});}; \ No newline at end of file +var _0x1c7c=['update','UpdateMailInteraction','addTags','Request','AddTagsToMailInteraction','addTagsToChatInteraction','../client'];(function(_0x350182,_0x2a9feb){var _0x4a0892=function(_0x2c994d){while(--_0x2c994d){_0x350182['push'](_0x350182['shift']());}};_0x4a0892(++_0x2a9feb);}(_0x1c7c,0x164));var _0xc1c7=function(_0x44da94,_0x59d8a5){_0x44da94=_0x44da94-0x0;var _0x21149e=_0x1c7c[_0x44da94];return _0x21149e;};'use strict';var client=require(_0xc1c7('0x0'));exports[_0xc1c7('0x1')]=function(_0x38fc99,_0x3a93f0){return client['Request'](_0xc1c7('0x2'),{'body':_0x3a93f0,'options':{'where':{'id':_0x38fc99}},'log':'updateMailInteraction'});};exports[_0xc1c7('0x3')]=function(_0x20dad3,_0xbb9da0){return client[_0xc1c7('0x4')](_0xc1c7('0x5'),{'body':_0xbb9da0,'options':{'where':{'id':_0x20dad3}},'log':_0xc1c7('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index 05698ce..368e3b3 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 _0xeedc=['Request','CreateMailMessage','createMailMessage','create'];(function(_0xaa6098,_0x3e013f){var _0x39e13c=function(_0x6b894b){while(--_0x6b894b){_0xaa6098['push'](_0xaa6098['shift']());}};_0x39e13c(++_0x3e013f);}(_0xeedc,0x77));var _0xceed=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xeedc[_0x2dafbe];return _0x58a45a;};'use strict';var client=require('../client');exports[_0xceed('0x0')]=function(_0x9c35d2){return client[_0xceed('0x1')](_0xceed('0x2'),{'body':_0x9c35d2,'log':_0xceed('0x3')});}; \ No newline at end of file +var _0x5342=['create','CreateMailMessage','createMailMessage','../client'];(function(_0x1739a9,_0x22451c){var _0x1cd526=function(_0x3b2ded){while(--_0x3b2ded){_0x1739a9['push'](_0x1739a9['shift']());}};_0x1cd526(++_0x22451c);}(_0x5342,0x77));var _0x2534=function(_0x23a299,_0x30e49c){_0x23a299=_0x23a299-0x0;var _0x560bb3=_0x5342[_0x23a299];return _0x560bb3;};'use strict';var client=require(_0x2534('0x0'));exports[_0x2534('0x1')]=function(_0x769ba3){return client['Request'](_0x2534('0x2'),{'body':_0x769ba3,'log':_0x2534('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index 8bc758b..4088ae1 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 _0xc96d=['Request','GetMailQueue','name','timeout','strategy','Agents','online','mailPause','getMailQueues'];(function(_0x1d94b7,_0x5988e5){var _0x40a258=function(_0x3da766){while(--_0x3da766){_0x1d94b7['push'](_0x1d94b7['shift']());}};_0x40a258(++_0x5988e5);}(_0xc96d,0x11f));var _0xdc96=function(_0x30cb1c,_0x31f221){_0x30cb1c=_0x30cb1c-0x0;var _0x170ce3=_0xc96d[_0x30cb1c];return _0x170ce3;};'use strict';var client=require('../client');exports[_0xdc96('0x0')]=function(){return function(){return client[_0xdc96('0x1')](_0xdc96('0x2'),{'options':{'raw':![],'attributes':['id',_0xdc96('0x3'),_0xdc96('0x4'),_0xdc96('0x5')],'include':[{'model':'User','as':_0xdc96('0x6'),'attributes':['id',_0xdc96('0x3'),_0xdc96('0x7'),_0xdc96('0x8')]}]},'log':_0xdc96('0x0')});};}; \ No newline at end of file +var _0x02fa=['strategy','mailPause','../client','getMailQueues','Request','name'];(function(_0x2bbe4a,_0x384615){var _0x41cc37=function(_0x15579c){while(--_0x15579c){_0x2bbe4a['push'](_0x2bbe4a['shift']());}};_0x41cc37(++_0x384615);}(_0x02fa,0x1dc));var _0xa02f=function(_0x5638d9,_0x32a6d7){_0x5638d9=_0x5638d9-0x0;var _0x370cad=_0x02fa[_0x5638d9];return _0x370cad;};'use strict';var client=require(_0xa02f('0x0'));exports[_0xa02f('0x1')]=function(){return function(){return client[_0xa02f('0x2')]('GetMailQueue',{'options':{'raw':![],'attributes':['id',_0xa02f('0x3'),'timeout',_0xa02f('0x4')],'include':[{'model':'User','as':'Agents','attributes':['id',_0xa02f('0x3'),'online',_0xa02f('0x5')]}]},'log':_0xa02f('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index dadbdf5..717bd01 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 _0x59f2=['../client','create','CreateMailQueueReport','UpdateMailQueueReport'];(function(_0x2bf141,_0x31eac7){var _0x48277b=function(_0x9fe560){while(--_0x9fe560){_0x2bf141['push'](_0x2bf141['shift']());}};_0x48277b(++_0x31eac7);}(_0x59f2,0xe4));var _0x259f=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0x59f2[_0x37bd26];return _0xe83dc4;};'use strict';var client=require(_0x259f('0x0'));exports[_0x259f('0x1')]=function(_0x412900){return client['Request'](_0x259f('0x2'),{'body':_0x412900,'log':_0x259f('0x2')});};exports['update']=function(_0x3d91b8,_0x1dbf27){return client['Request'](_0x259f('0x3'),{'body':_0x1dbf27,'options':{'where':{'uniqueid':_0x3d91b8},'order':[['id','DESC']],'limit':0x1},'log':_0x259f('0x3')});}; \ No newline at end of file +var _0xf334=['UpdateMailQueueReport','../client','CreateMailQueueReport','Request'];(function(_0x2511e0,_0x41553e){var _0x51d4e7=function(_0x1b2e41){while(--_0x1b2e41){_0x2511e0['push'](_0x2511e0['shift']());}};_0x51d4e7(++_0x41553e);}(_0xf334,0x19d));var _0x4f33=function(_0x5aeb74,_0x2589d4){_0x5aeb74=_0x5aeb74-0x0;var _0x3d3bf3=_0xf334[_0x5aeb74];return _0x3d3bf3;};'use strict';var client=require(_0x4f33('0x0'));exports['create']=function(_0x2f2797){return client['Request'](_0x4f33('0x1'),{'body':_0x2f2797,'log':_0x4f33('0x1')});};exports['update']=function(_0x6cb8f,_0x394d17){return client[_0x4f33('0x2')]('UpdateMailQueueReport',{'body':_0x394d17,'options':{'where':{'uniqueid':_0x6cb8f},'order':[['id','DESC']],'limit':0x1},'log':_0x4f33('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index 17edc2b..2f7c33e 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 _0x0a97=['UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTags','AddTagsToOpenchannelInteraction','addTagsToChatInteraction','../client','update','Request'];(function(_0x339f35,_0x151ec5){var _0x1cecb8=function(_0x59195e){while(--_0x59195e){_0x339f35['push'](_0x339f35['shift']());}};_0x1cecb8(++_0x151ec5);}(_0x0a97,0x7d));var _0x70a9=function(_0x3070dc,_0x40cf11){_0x3070dc=_0x3070dc-0x0;var _0x431489=_0x0a97[_0x3070dc];return _0x431489;};'use strict';var client=require(_0x70a9('0x0'));exports[_0x70a9('0x1')]=function(_0x2f4e9e,_0x9f1970){return client[_0x70a9('0x2')](_0x70a9('0x3'),{'body':_0x9f1970,'options':{'where':{'id':_0x2f4e9e}},'log':_0x70a9('0x4')});};exports[_0x70a9('0x5')]=function(_0x547175,_0x325258){return client[_0x70a9('0x2')](_0x70a9('0x6'),{'body':_0x325258,'options':{'where':{'id':_0x547175}},'log':_0x70a9('0x7')});}; \ No newline at end of file +var _0xfaed=['Request','UpdateOpenchannelInteraction','AddTagsToOpenchannelInteraction','addTagsToChatInteraction','../client','update'];(function(_0x44ae0b,_0x3e9865){var _0x69232a=function(_0x5ae588){while(--_0x5ae588){_0x44ae0b['push'](_0x44ae0b['shift']());}};_0x69232a(++_0x3e9865);}(_0xfaed,0x8e));var _0xdfae=function(_0x478c8a,_0x9afc92){_0x478c8a=_0x478c8a-0x0;var _0x3b6b3e=_0xfaed[_0x478c8a];return _0x3b6b3e;};'use strict';var client=require(_0xdfae('0x0'));exports[_0xdfae('0x1')]=function(_0x19df8e,_0x5b21cb){return client[_0xdfae('0x2')](_0xdfae('0x3'),{'body':_0x5b21cb,'options':{'where':{'id':_0x19df8e}},'log':'updateOpenchannelInteraction'});};exports['addTags']=function(_0x1fa5d5,_0x142db2){return client[_0xdfae('0x2')](_0xdfae('0x4'),{'body':_0x142db2,'options':{'where':{'id':_0x1fa5d5}},'log':_0xdfae('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index 6b0bea2..3c35a7d 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 _0x430e=['CreateOpenchannelMessage','create'];(function(_0x26fc81,_0x57fc19){var _0x9feece=function(_0x4344c3){while(--_0x4344c3){_0x26fc81['push'](_0x26fc81['shift']());}};_0x9feece(++_0x57fc19);}(_0x430e,0x143));var _0xe430=function(_0x20ae3b,_0x23a21c){_0x20ae3b=_0x20ae3b-0x0;var _0x391475=_0x430e[_0x20ae3b];return _0x391475;};'use strict';var client=require('../client');exports[_0xe430('0x0')]=function(_0x52b049){return client['Request'](_0xe430('0x1'),{'body':_0x52b049,'log':'createOpenchannelMessage'});}; \ No newline at end of file +var _0x7248=['create','Request','CreateOpenchannelMessage','createOpenchannelMessage','../client'];(function(_0x128bef,_0xc7a0af){var _0x1ba862=function(_0x4858e8){while(--_0x4858e8){_0x128bef['push'](_0x128bef['shift']());}};_0x1ba862(++_0xc7a0af);}(_0x7248,0xf9));var _0x8724=function(_0x25cd6d,_0x30a718){_0x25cd6d=_0x25cd6d-0x0;var _0x7811e1=_0x7248[_0x25cd6d];return _0x7811e1;};'use strict';var client=require(_0x8724('0x0'));exports[_0x8724('0x1')]=function(_0x3a4091){return client[_0x8724('0x2')](_0x8724('0x3'),{'body':_0x3a4091,'log':_0x8724('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index dfe3f9b..1ceb050 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 _0x2b6c=['getOpenchannelQueues','GetOpenchannelQueue','timeout','strategy','User','Agents','name','openchannelPause'];(function(_0x38bb4a,_0x54bb77){var _0x349e88=function(_0x3dd60f){while(--_0x3dd60f){_0x38bb4a['push'](_0x38bb4a['shift']());}};_0x349e88(++_0x54bb77);}(_0x2b6c,0xa1));var _0xc2b6=function(_0x2cea58,_0x153c15){_0x2cea58=_0x2cea58-0x0;var _0x192933=_0x2b6c[_0x2cea58];return _0x192933;};'use strict';var client=require('../client');exports['getOpenchannelQueues']=function(){return function(){return client['Request'](_0xc2b6('0x0'),{'options':{'raw':![],'attributes':['id','name',_0xc2b6('0x1'),_0xc2b6('0x2')],'include':[{'model':_0xc2b6('0x3'),'as':_0xc2b6('0x4'),'attributes':['id',_0xc2b6('0x5'),'online',_0xc2b6('0x6')]}]},'log':_0xc2b6('0x7')});};}; \ No newline at end of file +var _0xbda2=['online','openchannelPause','getOpenchannelQueues','../client','Request','name','timeout','strategy','Agents'];(function(_0x57afa6,_0x32dd34){var _0xcbc78b=function(_0x599653){while(--_0x599653){_0x57afa6['push'](_0x57afa6['shift']());}};_0xcbc78b(++_0x32dd34);}(_0xbda2,0x123));var _0x2bda=function(_0x29b7b9,_0x39138d){_0x29b7b9=_0x29b7b9-0x0;var _0x514a48=_0xbda2[_0x29b7b9];return _0x514a48;};'use strict';var client=require(_0x2bda('0x0'));exports['getOpenchannelQueues']=function(){return function(){return client[_0x2bda('0x1')]('GetOpenchannelQueue',{'options':{'raw':![],'attributes':['id',_0x2bda('0x2'),_0x2bda('0x3'),_0x2bda('0x4')],'include':[{'model':'User','as':_0x2bda('0x5'),'attributes':['id',_0x2bda('0x2'),_0x2bda('0x6'),_0x2bda('0x7')]}]},'log':_0x2bda('0x8')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index efd7fa3..6d54089 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 _0xe82b=['UpdateOpenchannelQueueReport','DESC','../client','create','Request','CreateOpenchannelQueueReport','update'];(function(_0x5a5c9a,_0x554789){var _0x4d0967=function(_0x368cd1){while(--_0x368cd1){_0x5a5c9a['push'](_0x5a5c9a['shift']());}};_0x4d0967(++_0x554789);}(_0xe82b,0x11a));var _0xbe82=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe82b[_0x14add3];return _0x4a174f;};'use strict';var client=require(_0xbe82('0x0'));exports[_0xbe82('0x1')]=function(_0x4fdeda){return client[_0xbe82('0x2')](_0xbe82('0x3'),{'body':_0x4fdeda,'log':_0xbe82('0x3')});};exports[_0xbe82('0x4')]=function(_0xcf0042,_0x3230dc){return client['Request'](_0xbe82('0x5'),{'body':_0x3230dc,'options':{'where':{'uniqueid':_0xcf0042},'order':[['id',_0xbe82('0x6')]],'limit':0x1},'log':'UpdateOpenchannelQueueReport'});}; \ No newline at end of file +var _0xbb1e=['DESC','create','Request','CreateOpenchannelQueueReport','update','UpdateOpenchannelQueueReport'];(function(_0x517b74,_0x1186c3){var _0x301f0e=function(_0x5546ab){while(--_0x5546ab){_0x517b74['push'](_0x517b74['shift']());}};_0x301f0e(++_0x1186c3);}(_0xbb1e,0x1bd));var _0xebb1=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xbb1e[_0x501510];return _0x1e6ee5;};'use strict';var client=require('../client');exports[_0xebb1('0x0')]=function(_0x36ee21){return client[_0xebb1('0x1')]('CreateOpenchannelQueueReport',{'body':_0x36ee21,'log':_0xebb1('0x2')});};exports[_0xebb1('0x3')]=function(_0x13490a,_0x414a02){return client[_0xebb1('0x1')](_0xebb1('0x4'),{'body':_0x414a02,'options':{'where':{'uniqueid':_0x13490a},'order':[['id',_0xebb1('0x5')]],'limit':0x1},'log':_0xebb1('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index bdd88d8..50dad22 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 _0x871e=['../client','Request','UpdateSmsInteraction','addTags','AddTagsToSmsInteraction','addTagsToSmsInteraction'];(function(_0x24a643,_0x357c93){var _0x4eb205=function(_0x5a5bb0){while(--_0x5a5bb0){_0x24a643['push'](_0x24a643['shift']());}};_0x4eb205(++_0x357c93);}(_0x871e,0x1b0));var _0xe871=function(_0x2f9871,_0x13f7a0){_0x2f9871=_0x2f9871-0x0;var _0x150e53=_0x871e[_0x2f9871];return _0x150e53;};'use strict';var client=require(_0xe871('0x0'));exports['update']=function(_0x308f04,_0x374a69){return client[_0xe871('0x1')](_0xe871('0x2'),{'body':_0x374a69,'options':{'where':{'id':_0x308f04}},'log':'updateSmsInteraction'});};exports[_0xe871('0x3')]=function(_0x27f82b,_0x4550c1){return client[_0xe871('0x1')](_0xe871('0x4'),{'body':_0x4550c1,'options':{'where':{'id':_0x27f82b}},'log':_0xe871('0x5')});}; \ No newline at end of file +var _0xf53f=['AddTagsToSmsInteraction','../client','update','Request','UpdateSmsInteraction','updateSmsInteraction','addTags'];(function(_0x3a2a3c,_0x37bd31){var _0x50ac9a=function(_0x494a7f){while(--_0x494a7f){_0x3a2a3c['push'](_0x3a2a3c['shift']());}};_0x50ac9a(++_0x37bd31);}(_0xf53f,0x8d));var _0xff53=function(_0x5b024e,_0x542368){_0x5b024e=_0x5b024e-0x0;var _0x543986=_0xf53f[_0x5b024e];return _0x543986;};'use strict';var client=require(_0xff53('0x0'));exports[_0xff53('0x1')]=function(_0x25c590,_0x28461e){return client[_0xff53('0x2')](_0xff53('0x3'),{'body':_0x28461e,'options':{'where':{'id':_0x25c590}},'log':_0xff53('0x4')});};exports[_0xff53('0x5')]=function(_0x18b504,_0x2077b9){return client[_0xff53('0x2')](_0xff53('0x6'),{'body':_0x2077b9,'options':{'where':{'id':_0x18b504}},'log':'addTagsToSmsInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index 69b15d2..d1af7b3 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 _0xd3bd=['CreateSmsMessage','createSmsMessage','../client','create','Request'];(function(_0x5ef161,_0x27d16c){var _0x1c6e9e=function(_0x8fc2a6){while(--_0x8fc2a6){_0x5ef161['push'](_0x5ef161['shift']());}};_0x1c6e9e(++_0x27d16c);}(_0xd3bd,0x1dd));var _0xdd3b=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0xd3bd[_0x5b561d];return _0x431060;};'use strict';var client=require(_0xdd3b('0x0'));exports[_0xdd3b('0x1')]=function(_0x2ff771){return client[_0xdd3b('0x2')](_0xdd3b('0x3'),{'body':_0x2ff771,'log':_0xdd3b('0x4')});}; \ No newline at end of file +var _0xdfaa=['../client','Request','CreateSmsMessage'];(function(_0xbc834d,_0x47783a){var _0x366dcd=function(_0x11a954){while(--_0x11a954){_0xbc834d['push'](_0xbc834d['shift']());}};_0x366dcd(++_0x47783a);}(_0xdfaa,0x14d));var _0xadfa=function(_0x4df9e9,_0x5ce919){_0x4df9e9=_0x4df9e9-0x0;var _0x579576=_0xdfaa[_0x4df9e9];return _0x579576;};'use strict';var client=require(_0xadfa('0x0'));exports['create']=function(_0x58311f){return client[_0xadfa('0x1')](_0xadfa('0x2'),{'body':_0x58311f,'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 d46c709..6c24594 100644 --- a/server/services/routing/rpc/smsQueue.js +++ b/server/services/routing/rpc/smsQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['Request','GetSmsQueue','name','timeout','strategy','User','online','getSmsQueues'];(function(_0x3bcd29,_0x1180e7){var _0x1529a6=function(_0x26418f){while(--_0x26418f){_0x3bcd29['push'](_0x3bcd29['shift']());}};_0x1529a6(++_0x1180e7);}(_0x9c44,0x178));var _0x49c4=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0x9c44[_0x422905];return _0x33dc6c;};'use strict';var client=require('../client');exports['getSmsQueues']=function(){return function(){return client[_0x49c4('0x0')](_0x49c4('0x1'),{'options':{'raw':![],'attributes':['id',_0x49c4('0x2'),_0x49c4('0x3'),_0x49c4('0x4')],'include':[{'model':_0x49c4('0x5'),'as':'Agents','attributes':['id','name',_0x49c4('0x6'),'smsPause']}]},'log':_0x49c4('0x7')});};}; \ No newline at end of file +var _0x0713=['getSmsQueues','Request','GetSmsQueue','name','timeout','strategy','Agents','online','smsPause'];(function(_0x1314d4,_0xb0b16d){var _0x584ba5=function(_0x394269){while(--_0x394269){_0x1314d4['push'](_0x1314d4['shift']());}};_0x584ba5(++_0xb0b16d);}(_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 66ac626..efb7ca3 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(_0x58d981,_0x54f040){var _0x4ffcc3=function(_0xd6a417){while(--_0xd6a417){_0x58d981['push'](_0x58d981['shift']());}};_0x4ffcc3(++_0x54f040);}(_0x55ca,0x126));var _0xa55c=function(_0x4ebb5d,_0x1e92b6){_0x4ebb5d=_0x4ebb5d-0x0;var _0x5abafd=_0x55ca[_0x4ebb5d];return _0x5abafd;};'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 _0x008c=['../client','create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC'];(function(_0x972692,_0x2a1c56){var _0x542e84=function(_0xe63f21){while(--_0xe63f21){_0x972692['push'](_0x972692['shift']());}};_0x542e84(++_0x2a1c56);}(_0x008c,0x188));var _0xc008=function(_0x4fc702,_0x590060){_0x4fc702=_0x4fc702-0x0;var _0x1357d3=_0x008c[_0x4fc702];return _0x1357d3;};'use strict';var client=require(_0xc008('0x0'));exports[_0xc008('0x1')]=function(_0x15aadc){return client[_0xc008('0x2')](_0xc008('0x3'),{'body':_0x15aadc,'log':'CreateSmsQueueReport'});};exports[_0xc008('0x4')]=function(_0x47063f,_0x10b33c){return client[_0xc008('0x2')](_0xc008('0x5'),{'body':_0x10b33c,'options':{'where':{'uniqueid':_0x47063f},'order':[['id',_0xc008('0x6')]],'limit':0x1},'log':_0xc008('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index 96a7426..85457f9 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(_0x33cb0a,_0x8201cc){var _0x23c94d=function(_0x8f293b){while(--_0x8f293b){_0x33cb0a['push'](_0x33cb0a['shift']());}};_0x23c94d(++_0x8201cc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37c22c,_0x28a70d){_0x37c22c=_0x37c22c-0x0;var _0x119d79=_0xa9e0[_0x37c22c];return _0x119d79;};'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(_0x167fba,_0x555a9e){var _0x60e9e5=function(_0x4d1610){while(--_0x4d1610){_0x167fba['push'](_0x167fba['shift']());}};_0x60e9e5(++_0x555a9e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0xa9e0[_0x5b561d];return _0x431060;};'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 e2cc42a..e6b5b47 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 _0x6455=['updateWhatsappInteraction','addTags','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client','Request','UpdateWhatsappInteraction'];(function(_0x5bd4db,_0x15bf79){var _0x45dcd0=function(_0xda38b2){while(--_0xda38b2){_0x5bd4db['push'](_0x5bd4db['shift']());}};_0x45dcd0(++_0x15bf79);}(_0x6455,0x97));var _0x5645=function(_0x2e9501,_0x2e3681){_0x2e9501=_0x2e9501-0x0;var _0x556bd1=_0x6455[_0x2e9501];return _0x556bd1;};'use strict';var client=require(_0x5645('0x0'));exports['update']=function(_0x6b9a7e,_0x2294f5){return client[_0x5645('0x1')](_0x5645('0x2'),{'body':_0x2294f5,'options':{'where':{'id':_0x6b9a7e}},'log':_0x5645('0x3')});};exports[_0x5645('0x4')]=function(_0x5388ff,_0x233875){return client[_0x5645('0x1')](_0x5645('0x5'),{'body':_0x233875,'options':{'where':{'id':_0x5388ff}},'log':_0x5645('0x6')});}; \ No newline at end of file +var _0x1883=['addTags','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client','update','Request','UpdateWhatsappInteraction','updateWhatsappInteraction'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1883,0xab));var _0x3188=function(_0x34a3b9,_0x32970e){_0x34a3b9=_0x34a3b9-0x0;var _0x116ae8=_0x1883[_0x34a3b9];return _0x116ae8;};'use strict';var client=require(_0x3188('0x0'));exports[_0x3188('0x1')]=function(_0x1ffcc1,_0x45f858){return client[_0x3188('0x2')](_0x3188('0x3'),{'body':_0x45f858,'options':{'where':{'id':_0x1ffcc1}},'log':_0x3188('0x4')});};exports[_0x3188('0x5')]=function(_0x1c7c86,_0x44afb8){return client[_0x3188('0x2')](_0x3188('0x6'),{'body':_0x44afb8,'options':{'where':{'id':_0x1c7c86}},'log':_0x3188('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index f523b67..5fedc0e 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 _0x8d87=['CreateWhatsappMessage','../client','Request'];(function(_0x37f3ef,_0x1243cf){var _0x4f8951=function(_0x464834){while(--_0x464834){_0x37f3ef['push'](_0x37f3ef['shift']());}};_0x4f8951(++_0x1243cf);}(_0x8d87,0x8b));var _0x78d8=function(_0x5b5ffe,_0x1c5874){_0x5b5ffe=_0x5b5ffe-0x0;var _0x2d12bc=_0x8d87[_0x5b5ffe];return _0x2d12bc;};'use strict';var client=require(_0x78d8('0x0'));exports['create']=function(_0x4d6002){return client[_0x78d8('0x1')](_0x78d8('0x2'),{'body':_0x4d6002,'log':'createWhatsappMessage'});}; \ No newline at end of file +var _0xc420=['create','Request','createWhatsappMessage'];(function(_0x5400b,_0x55943a){var _0x36a39b=function(_0x56963c){while(--_0x56963c){_0x5400b['push'](_0x5400b['shift']());}};_0x36a39b(++_0x55943a);}(_0xc420,0x1b3));var _0x0c42=function(_0x5c1dbb,_0x21d210){_0x5c1dbb=_0x5c1dbb-0x0;var _0x357578=_0xc420[_0x5c1dbb];return _0x357578;};'use strict';var client=require('../client');exports[_0x0c42('0x0')]=function(_0x3ca4dc){return client[_0x0c42('0x1')]('CreateWhatsappMessage',{'body':_0x3ca4dc,'log':_0x0c42('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index d091fa8..a5567c1 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 _0x9a82=['online','whatsappPause','getWhatsappQueues','GetWhatsappQueue','strategy','Agents','name'];(function(_0x24c287,_0x5349ea){var _0x325254=function(_0x24e61c){while(--_0x24e61c){_0x24c287['push'](_0x24c287['shift']());}};_0x325254(++_0x5349ea);}(_0x9a82,0x95));var _0x29a8=function(_0x396db2,_0x17156e){_0x396db2=_0x396db2-0x0;var _0x191538=_0x9a82[_0x396db2];return _0x191538;};'use strict';var client=require('../client');exports[_0x29a8('0x0')]=function(){return function(){return client['Request'](_0x29a8('0x1'),{'options':{'raw':![],'attributes':['id','name','timeout',_0x29a8('0x2')],'include':[{'model':'User','as':_0x29a8('0x3'),'attributes':['id',_0x29a8('0x4'),_0x29a8('0x5'),_0x29a8('0x6')]}]},'log':_0x29a8('0x0')});};}; \ No newline at end of file +var _0xe293=['Request','timeout','strategy','Agents','name','online','whatsappPause','getWhatsappQueues'];(function(_0x46f3f8,_0x12c74b){var _0xbc57cd=function(_0x34df37){while(--_0x34df37){_0x46f3f8['push'](_0x46f3f8['shift']());}};_0xbc57cd(++_0x12c74b);}(_0xe293,0x1e0));var _0x3e29=function(_0x57fa7e,_0xd0b5ce){_0x57fa7e=_0x57fa7e-0x0;var _0x320671=_0xe293[_0x57fa7e];return _0x320671;};'use strict';var client=require('../client');exports['getWhatsappQueues']=function(){return function(){return client[_0x3e29('0x0')]('GetWhatsappQueue',{'options':{'raw':![],'attributes':['id','name',_0x3e29('0x1'),_0x3e29('0x2')],'include':[{'model':'User','as':_0x3e29('0x3'),'attributes':['id',_0x3e29('0x4'),_0x3e29('0x5'),_0x3e29('0x6')]}]},'log':_0x3e29('0x7')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index 4e5c3b3..9da4b7f 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 _0x6405=['UpdateWhatsappQueueReport','../client','create','Request','CreateWhatsappQueueReport','update'];(function(_0x372cbf,_0x52da9d){var _0x4c3714=function(_0x4f64d2){while(--_0x4f64d2){_0x372cbf['push'](_0x372cbf['shift']());}};_0x4c3714(++_0x52da9d);}(_0x6405,0x193));var _0x5640=function(_0x1d40ad,_0xa1fe9a){_0x1d40ad=_0x1d40ad-0x0;var _0x566951=_0x6405[_0x1d40ad];return _0x566951;};'use strict';var client=require(_0x5640('0x0'));exports[_0x5640('0x1')]=function(_0x328fc3){return client[_0x5640('0x2')](_0x5640('0x3'),{'body':_0x328fc3,'log':_0x5640('0x3')});};exports[_0x5640('0x4')]=function(_0x5a3e45,_0x229f26){return client[_0x5640('0x2')](_0x5640('0x5'),{'body':_0x229f26,'options':{'where':{'uniqueid':_0x5a3e45},'order':[['id','DESC']],'limit':0x1},'log':_0x5640('0x5')});}; \ No newline at end of file +var _0x6bc2=['create','Request','CreateWhatsappQueueReport','update','UpdateWhatsappQueueReport'];(function(_0x24a75d,_0x4b8c57){var _0x1888ba=function(_0x182c10){while(--_0x182c10){_0x24a75d['push'](_0x24a75d['shift']());}};_0x1888ba(++_0x4b8c57);}(_0x6bc2,0xfa));var _0x26bc=function(_0x193f7d,_0xc84d34){_0x193f7d=_0x193f7d-0x0;var _0x402420=_0x6bc2[_0x193f7d];return _0x402420;};'use strict';var client=require('../client');exports[_0x26bc('0x0')]=function(_0xf9628){return client[_0x26bc('0x1')](_0x26bc('0x2'),{'body':_0xf9628,'log':'CreateWhatsappQueueReport'});};exports[_0x26bc('0x3')]=function(_0x421087,_0x56427d){return client[_0x26bc('0x1')](_0x26bc('0x4'),{'body':_0x56427d,'options':{'where':{'uniqueid':_0x421087},'order':[['id','DESC']],'limit':0x1},'log':_0x26bc('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/server/applications/agent.js b/server/services/routing/server/applications/agent.js index cfbf8ff..20773b2 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 _0x7258=['atimeout','channel','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','close','next','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','error','[%s][QUEUE]\x20%s','stack','validate','lodash','util','../../../../config/logger','routing','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','info','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','length','map','message','join','stop','find','agents','timeout','createQueue'];(function(_0x4bd64d,_0x3c2b8a){var _0x37db2d=function(_0x5ca98f){while(--_0x5ca98f){_0x4bd64d['push'](_0x4bd64d['shift']());}};_0x37db2d(++_0x3c2b8a);}(_0x7258,0x1ed));var _0x8725=function(_0x5441d8,_0x1b8da8){_0x5441d8=_0x5441d8-0x0;var _0x18ea79=_0x7258[_0x5441d8];return _0x18ea79;};'use strict';var schema=require(_0x8725('0x0'));var _=require(_0x8725('0x1'));var util=require(_0x8725('0x2'));var seqqueue=require('seq-queue');var logger=require(_0x8725('0x3'))(_0x8725('0x4'));var strategy=require(_0x8725('0x5'));var queue=schema({'name':{'type':_0x8725('0x6'),'required':!![],'message':_0x8725('0x7')},'timeout':{'type':_0x8725('0x8'),'message':_0x8725('0x9')}});function writeLog(_0x3d0e76,_0xb9b1bf,_0x2f9e41){return logger[_0x8725('0xa')](util[_0x8725('0xb')](_0x8725('0xc'),_0x3d0e76,_0xb9b1bf[_0x8725('0xd')],_0x2f9e41));}function handleFindAgent(_0x3df3cd){return function(_0x1e0c95){return _0x1e0c95[_0x8725('0xd')][_0x8725('0xe')]()===_0x3df3cd[_0x8725('0xe')]();};}exports[_0x8725('0xf')]=function(_0x401e95,_0x3ac6eb,_0x3c22be,_0x5aef41){return function(_0x3ac01e){try{var _0x2bb5fa={'name':_0x3ac6eb[0x0],'timeout':_0x3ac6eb[0x1]};var _0x116f86=queue['validate'](_0x2bb5fa,{'typecast':!![]});if(_0x116f86[_0x8725('0x10')]){logger['error']('[%s][AGENT]\x20%s',_0x401e95,_[_0x8725('0x11')](_0x116f86,_0x8725('0x12'))[_0x8725('0x13')](',\x20'));_0x3ac01e[_0x8725('0x14')]();}else{var _0x5d8b66=_[_0x8725('0x15')](_0x3c22be[_0x8725('0x16')],handleFindAgent(_0x2bb5fa[_0x8725('0xd')]));if(_0x5d8b66){var _0x20f4be=(_0x2bb5fa[_0x8725('0x17')]||0xa)*0x3e8;var _0xebef92,_0x4ab8df;var _0x493934=seqqueue[_0x8725('0x18')](_0x20f4be);_0x493934['id']=_0x401e95;_0x493934[_0x8725('0x19')]=_0x20f4be;_0x493934[_0x8725('0x1a')]=_0x5aef41[_0x8725('0x1a')];writeLog(_0x401e95,_0x5d8b66,util[_0x8725('0xb')]('START:%s',_0x20f4be));_0x3c22be[_0x8725('0x1b')][_0x401e95]['on'](_0x8725('0x1c'),function(){logger[_0x8725('0xa')](_0x8725('0x1d'),_0x401e95);clearTimeout(_0x4ab8df);_0x4ab8df=undefined;_0x493934[_0x8725('0x1e')]();if(_0x3c22be['rules'][_0x401e95]){delete _0x3c22be[_0x8725('0x1b')][_0x401e95];}_0x3ac01e[_0x8725('0x14')]();});_0x3c22be[_0x8725('0x1b')][_0x401e95]['on']('complete',function(){if(_0x3c22be[_0x8725('0x1b')][_0x401e95]){delete _0x3c22be[_0x8725('0x1b')][_0x401e95];}});_0x4ab8df=setTimeout(function(){logger[_0x8725('0xa')]('[%s][AGENT]\x20ROUTING\x20END',_0x401e95);clearTimeout(_0x4ab8df);_0x493934[_0x8725('0x1e')]();_0x3ac01e[_0x8725('0x1f')]();},_0x20f4be);strategy['agent'](_0x493934,_0x5d8b66,_0x3c22be,_0x5aef41);}else{logger['error'](_0x8725('0x20'),_0x401e95,_0x2bb5fa[_0x8725('0xd')]);_0x3ac01e[_0x8725('0x14')]();}}}catch(_0x3b5831){console[_0x8725('0x21')](_0x3b5831);logger[_0x8725('0x22')](_0x8725('0x23'),_0x401e95,_0x3b5831[_0x8725('0x24')]);_0x3ac01e[_0x8725('0x14')]();}};}; \ No newline at end of file +var _0x25ef=['log','[%s][QUEUE]\x20%s','stack','validate','util','seq-queue','../../../../config/logger','routing','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','info','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','length','map','join','stop','agents','timeout','atimeout','channel','START:%s','rules','close','complete','[%s][AGENT]\x20ROUTING\x20END','next','agent','error','[%s][AGENT]\x20agent\x20not\x20found\x20%s'];(function(_0x1d11e1,_0x568d7f){var _0xbd9dff=function(_0x3d648a){while(--_0x3d648a){_0x1d11e1['push'](_0x1d11e1['shift']());}};_0xbd9dff(++_0x568d7f);}(_0x25ef,0xc9));var _0xf25e=function(_0x56fefa,_0x2aac3e){_0x56fefa=_0x56fefa-0x0;var _0x5c277c=_0x25ef[_0x56fefa];return _0x5c277c;};'use strict';var schema=require(_0xf25e('0x0'));var _=require('lodash');var util=require(_0xf25e('0x1'));var seqqueue=require(_0xf25e('0x2'));var logger=require(_0xf25e('0x3'))(_0xf25e('0x4'));var strategy=require(_0xf25e('0x5'));var queue=schema({'name':{'type':_0xf25e('0x6'),'required':!![],'message':_0xf25e('0x7')},'timeout':{'type':'number','message':'timeout\x20is\x20a\x20number'}});function writeLog(_0x9d54bc,_0x4339b2,_0x2719f9){return logger[_0xf25e('0x8')](util[_0xf25e('0x9')](_0xf25e('0xa'),_0x9d54bc,_0x4339b2['name'],_0x2719f9));}function handleFindAgent(_0x8870b1){return function(_0x4a9dee){return _0x4a9dee[_0xf25e('0xb')][_0xf25e('0xc')]()===_0x8870b1[_0xf25e('0xc')]();};}exports['consequence']=function(_0x34a4e7,_0x41c592,_0x45dd41,_0x240f81){return function(_0x271e3e){try{var _0x119a06={'name':_0x41c592[0x0],'timeout':_0x41c592[0x1]};var _0x503bb3=queue['validate'](_0x119a06,{'typecast':!![]});if(_0x503bb3[_0xf25e('0xd')]){logger['error']('[%s][AGENT]\x20%s',_0x34a4e7,_[_0xf25e('0xe')](_0x503bb3,'message')[_0xf25e('0xf')](',\x20'));_0x271e3e[_0xf25e('0x10')]();}else{var _0xee19c7=_['find'](_0x45dd41[_0xf25e('0x11')],handleFindAgent(_0x119a06[_0xf25e('0xb')]));if(_0xee19c7){var _0x3ad365=(_0x119a06[_0xf25e('0x12')]||0xa)*0x3e8;var _0x3e5fe9,_0x14cd30;var _0xcb840e=seqqueue['createQueue'](_0x3ad365);_0xcb840e['id']=_0x34a4e7;_0xcb840e[_0xf25e('0x13')]=_0x3ad365;_0xcb840e[_0xf25e('0x14')]=_0x240f81[_0xf25e('0x14')];writeLog(_0x34a4e7,_0xee19c7,util[_0xf25e('0x9')](_0xf25e('0x15'),_0x3ad365));_0x45dd41[_0xf25e('0x16')][_0x34a4e7]['on']('end',function(){logger[_0xf25e('0x8')]('[%s][AGENT]\x20ROUTING\x20STOPPED',_0x34a4e7);clearTimeout(_0x14cd30);_0x14cd30=undefined;_0xcb840e[_0xf25e('0x17')]();if(_0x45dd41[_0xf25e('0x16')][_0x34a4e7]){delete _0x45dd41[_0xf25e('0x16')][_0x34a4e7];}_0x271e3e[_0xf25e('0x10')]();});_0x45dd41['rules'][_0x34a4e7]['on'](_0xf25e('0x18'),function(){if(_0x45dd41[_0xf25e('0x16')][_0x34a4e7]){delete _0x45dd41[_0xf25e('0x16')][_0x34a4e7];}});_0x14cd30=setTimeout(function(){logger[_0xf25e('0x8')](_0xf25e('0x19'),_0x34a4e7);clearTimeout(_0x14cd30);_0xcb840e[_0xf25e('0x17')]();_0x271e3e[_0xf25e('0x1a')]();},_0x3ad365);strategy[_0xf25e('0x1b')](_0xcb840e,_0xee19c7,_0x45dd41,_0x240f81);}else{logger[_0xf25e('0x1c')](_0xf25e('0x1d'),_0x34a4e7,_0x119a06[_0xf25e('0xb')]);_0x271e3e[_0xf25e('0x10')]();}}}catch(_0x51c998){console[_0xf25e('0x1e')](_0x51c998);logger[_0xf25e('0x1c')](_0xf25e('0x1f'),_0x34a4e7,_0x51c998[_0xf25e('0x20')]);_0x271e3e['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/amazonlex.js b/server/services/routing/server/applications/amazonlex.js index 8ed85fa..6253b99 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 _0xd548=['$LATEST','message','postText','next','amazonlex','providerName','dialogState','Failed','lodash','moment','aws-sdk','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','info','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','phone','chat','ChatWebsiteId','upperFirst','AccountId','account','InteractionId','created','isEmpty','Message','create','then','body','catch','error','[%s][AMAZONLEX]\x20%s','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'];(function(_0x5544e7,_0x2a0ed6){var _0x132dd4=function(_0x2b9be7){while(--_0x2b9be7){_0x5544e7['push'](_0x5544e7['shift']());}};_0x132dd4(++_0x2a0ed6);}(_0xd548,0x1dc));var _0x8d54=function(_0x3dd88d,_0x279903){_0x3dd88d=_0x3dd88d-0x0;var _0x286285=_0xd548[_0x3dd88d];return _0x286285;};'use strict';var _=require(_0x8d54('0x0'));var moment=require(_0x8d54('0x1'));var AWS=require(_0x8d54('0x2'));var utils=require(_0x8d54('0x3'));var logger=require(_0x8d54('0x4'))(_0x8d54('0x5'));var rpc={'chatMessage':require(_0x8d54('0x6')),'openchannelMessage':require(_0x8d54('0x7')),'mailMessage':require(_0x8d54('0x8')),'smsMessage':require(_0x8d54('0x9')),'faxMessage':require(_0x8d54('0xa')),'whatsappMessage':require(_0x8d54('0xb'))};exports[_0x8d54('0xc')]=function(_0x5cedc7,_0xeb87ff){return function(_0x4201f5){try{if(!_[_0x8d54('0xd')](this[_0x8d54('0xe')]['UserId'])){logger[_0x8d54('0xf')]('[%s][AMAZONLEX]\x20%s',_0x5cedc7,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x4201f5['next']();}var _0x395353={'ContactId':this[_0x8d54('0x10')]['id'],'sentAt':moment()[_0x8d54('0x11')](_0x8d54('0x12')),'direction':_0x8d54('0x13')};if(this[_0x8d54('0x14')]===_0x8d54('0x15')||this[_0x8d54('0x14')]==='whatsapp'){_0x395353[_0x8d54('0x16')]=this[_0x8d54('0xe')]['phone'];}var _0x4bfd39=this[_0x8d54('0x14')];if(_0x4bfd39===_0x8d54('0x17')){_0x395353[_0x8d54('0x18')]=this['account']['id'];}else{_0x395353[_[_0x8d54('0x19')](_0x4bfd39)+_0x8d54('0x1a')]=this[_0x8d54('0x1b')]['id'];}_0x395353[_[_0x8d54('0x19')](_0x4bfd39)+_0x8d54('0x1c')]=this[_0x8d54('0xe')]['id'];if(this[_0x8d54('0xe')][_0x8d54('0x1d')]){var _0x5e648c=_0xeb87ff[0x4];if(!_[_0x8d54('0x1e')](_0x5e648c)){_0x395353['body']=utils['getMustacheRender'](_0x5e648c,this);return rpc[_0x4bfd39+_0x8d54('0x1f')][_0x8d54('0x20')](_0x395353)[_0x8d54('0x21')](function(_0x39c90b){logger[_0x8d54('0xf')]('[%s][AMAZONLEX]\x20%s',_0x5cedc7,_0x395353[_0x8d54('0x22')]);})[_0x8d54('0x23')](function(_0x4ef229){logger[_0x8d54('0x24')](_0x8d54('0x25'),_0x5cedc7,JSON[_0x8d54('0x26')](_0x4ef229));})[_0x8d54('0x27')](function(){logger[_0x8d54('0xf')](_0x8d54('0x28'),_0x5cedc7);_0x4201f5[_0x8d54('0x29')]();});}else{logger[_0x8d54('0xf')](_0x8d54('0x2a'),_0x5cedc7);_0x4201f5[_0x8d54('0x29')]();}}else{var _0x23bf0e=this;var _0x3b52e4=new AWS[(_0x8d54('0x2b'))]({'accessKeyId':_0xeb87ff[0x0],'secretAccessKey':_0xeb87ff[0x1],'region':_0xeb87ff[0x2]});var _0x2a6b16={'botAlias':_0x8d54('0x2c'),'botName':_0xeb87ff[0x3],'inputText':this[_0x8d54('0x2d')]['body'],'userId':this[_0x8d54('0x14')]+':'+this[_0x8d54('0xe')]['id']['toString']()};_0x3b52e4[_0x8d54('0x2e')](_0x2a6b16,function(_0x5b597e,_0x2c2048){if(_0x5b597e){logger[_0x8d54('0x24')](_0x8d54('0x25'),_0x5cedc7,_0x5b597e[_0x8d54('0x2d')]);_0x4201f5[_0x8d54('0x2f')]();}else if(_0x2c2048&&_0x2c2048[_0x8d54('0x2d')]){_0x23bf0e[_0x8d54('0x22')][_0x8d54('0x30')]=_0x2c2048;_0x395353['body']=_0x2c2048['message'];_0x395353[_0x8d54('0x31')]=_0x8d54('0x30');_0x395353['providerResponse']=JSON[_0x8d54('0x26')](_0x2c2048);return rpc[_0x4bfd39+'Message'][_0x8d54('0x20')](_0x395353)['then'](function(_0x4d3dce){logger[_0x8d54('0xf')](_0x8d54('0x25'),_0x5cedc7,_0x395353[_0x8d54('0x22')]);if(_0x2c2048[_0x8d54('0x32')]==_0x8d54('0x33')){_0x4201f5[_0x8d54('0x2f')]();}else{_0x4201f5['stop']();}})[_0x8d54('0x23')](function(_0x2fe2d6){logger[_0x8d54('0x24')](_0x8d54('0x25'),_0x5cedc7,JSON['stringify'](_0x2fe2d6));_0x4201f5[_0x8d54('0x2f')]();});}else{_0x4201f5['next']();}});}}catch(_0x390e41){logger[_0x8d54('0x24')](_0x8d54('0x25'),_0x5cedc7,JSON[_0x8d54('0x26')](_0x390e41));_0x4201f5[_0x8d54('0x29')]();}};}; \ No newline at end of file +var _0xfc88=['created','isEmpty','body','getMustacheRender','Message','then','catch','error','stringify','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','$LATEST','message','toString','postText','[%s][AMAZONLEX]\x20%s','amazonlex','providerResponse','dialogState','Failed','lodash','moment','aws-sdk','./utils','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','consequence','isNil','UserId','info','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','out','sms','channel','whatsapp','phone','interaction','ChatWebsiteId','upperFirst','AccountId','account','InteractionId'];(function(_0x33db9a,_0x434ae8){var _0x3f4c67=function(_0x1fe95f){while(--_0x1fe95f){_0x33db9a['push'](_0x33db9a['shift']());}};_0x3f4c67(++_0x434ae8);}(_0xfc88,0xe2));var _0x8fc8=function(_0x140fec,_0x887180){_0x140fec=_0x140fec-0x0;var _0x4912b2=_0xfc88[_0x140fec];return _0x4912b2;};'use strict';var _=require(_0x8fc8('0x0'));var moment=require(_0x8fc8('0x1'));var AWS=require(_0x8fc8('0x2'));var utils=require(_0x8fc8('0x3'));var logger=require(_0x8fc8('0x4'))(_0x8fc8('0x5'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x8fc8('0x6')),'mailMessage':require(_0x8fc8('0x7')),'smsMessage':require(_0x8fc8('0x8')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x8fc8('0x9'))};exports[_0x8fc8('0xa')]=function(_0x409df2,_0x226422){return function(_0xc134c7){try{if(!_[_0x8fc8('0xb')](this['interaction'][_0x8fc8('0xc')])){logger[_0x8fc8('0xd')]('[%s][AMAZONLEX]\x20%s',_0x409df2,_0x8fc8('0xe'));return _0xc134c7[_0x8fc8('0xf')]();}var _0x3b17f4={'ContactId':this[_0x8fc8('0x10')]['id'],'sentAt':moment()[_0x8fc8('0x11')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x8fc8('0x12')};if(this['channel']===_0x8fc8('0x13')||this[_0x8fc8('0x14')]===_0x8fc8('0x15')){_0x3b17f4[_0x8fc8('0x16')]=this[_0x8fc8('0x17')]['phone'];}var _0x54435a=this[_0x8fc8('0x14')];if(_0x54435a==='chat'){_0x3b17f4[_0x8fc8('0x18')]=this['account']['id'];}else{_0x3b17f4[_[_0x8fc8('0x19')](_0x54435a)+_0x8fc8('0x1a')]=this[_0x8fc8('0x1b')]['id'];}_0x3b17f4[_[_0x8fc8('0x19')](_0x54435a)+_0x8fc8('0x1c')]=this[_0x8fc8('0x17')]['id'];if(this[_0x8fc8('0x17')][_0x8fc8('0x1d')]){var _0x10a27c=_0x226422[0x4];if(!_[_0x8fc8('0x1e')](_0x10a27c)){_0x3b17f4[_0x8fc8('0x1f')]=utils[_0x8fc8('0x20')](_0x10a27c,this);return rpc[_0x54435a+_0x8fc8('0x21')]['create'](_0x3b17f4)[_0x8fc8('0x22')](function(_0x49d4a9){logger[_0x8fc8('0xd')]('[%s][AMAZONLEX]\x20%s',_0x409df2,_0x3b17f4[_0x8fc8('0x1f')]);})[_0x8fc8('0x23')](function(_0x2b8b33){logger[_0x8fc8('0x24')]('[%s][AMAZONLEX]\x20%s',_0x409df2,JSON[_0x8fc8('0x25')](_0x2b8b33));})['finally'](function(){logger['info'](_0x8fc8('0x26'),_0x409df2);_0xc134c7[_0x8fc8('0x27')]();});}else{logger[_0x8fc8('0xd')](_0x8fc8('0x28'),_0x409df2);_0xc134c7[_0x8fc8('0x27')]();}}else{var _0x368f95=this;var _0x201378=new AWS[(_0x8fc8('0x29'))]({'accessKeyId':_0x226422[0x0],'secretAccessKey':_0x226422[0x1],'region':_0x226422[0x2]});var _0xdb0da2={'botAlias':_0x8fc8('0x2a'),'botName':_0x226422[0x3],'inputText':this[_0x8fc8('0x2b')][_0x8fc8('0x1f')],'userId':this['channel']+':'+this[_0x8fc8('0x17')]['id'][_0x8fc8('0x2c')]()};_0x201378[_0x8fc8('0x2d')](_0xdb0da2,function(_0x5cfe4c,_0x4de61f){if(_0x5cfe4c){logger[_0x8fc8('0x24')](_0x8fc8('0x2e'),_0x409df2,_0x5cfe4c[_0x8fc8('0x2b')]);_0xc134c7[_0x8fc8('0xf')]();}else if(_0x4de61f&&_0x4de61f[_0x8fc8('0x2b')]){_0x368f95['body'][_0x8fc8('0x2f')]=_0x4de61f;_0x3b17f4[_0x8fc8('0x1f')]=_0x4de61f[_0x8fc8('0x2b')];_0x3b17f4['providerName']=_0x8fc8('0x2f');_0x3b17f4[_0x8fc8('0x30')]=JSON[_0x8fc8('0x25')](_0x4de61f);return rpc[_0x54435a+_0x8fc8('0x21')]['create'](_0x3b17f4)[_0x8fc8('0x22')](function(_0xb5dee6){logger[_0x8fc8('0xd')](_0x8fc8('0x2e'),_0x409df2,_0x3b17f4[_0x8fc8('0x1f')]);if(_0x4de61f[_0x8fc8('0x31')]==_0x8fc8('0x32')){_0xc134c7[_0x8fc8('0xf')]();}else{_0xc134c7['stop']();}})[_0x8fc8('0x23')](function(_0x367664){logger[_0x8fc8('0x24')]('[%s][AMAZONLEX]\x20%s',_0x409df2,JSON[_0x8fc8('0x25')](_0x367664));_0xc134c7[_0x8fc8('0xf')]();});}else{_0xc134c7[_0x8fc8('0xf')]();}});}}catch(_0x5a33f0){logger['error'](_0x8fc8('0x2e'),_0x409df2,JSON[_0x8fc8('0x25')](_0x5a33f0));_0xc134c7['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 ce1708d..a452a6c 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 _0x8704=['stringify','catch','error','[RPC][%s][AUTOREPLY]\x20%s','finally','resolve','update','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','autoreplyExecuted','Interaction','stop','lodash','moment','routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/chatInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../mailRpc','consequence','mail','body','isAutoreply','info','[%s][AUTOREPLY]\x20%s','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','isNil','interaction','created','Autoreply\x20already\x20sent','next','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','One\x20Time\x20already\x20sent','contact','format','out','channel','message','from','read','subject','startsWith','Re:','Re:\x20','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','Message','messageId','html','replace','auto-replied','All','auto_reply','sendMailMessage','create','then'];(function(_0x6a9bce,_0x5df304){var _0x5e8e72=function(_0x35ec4c){while(--_0x35ec4c){_0x6a9bce['push'](_0x6a9bce['shift']());}};_0x5e8e72(++_0x5df304);}(_0x8704,0x18b));var _0x4870=function(_0x31ced5,_0x5d5415){_0x31ced5=_0x31ced5-0x0;var _0x10d9e5=_0x8704[_0x31ced5];return _0x10d9e5;};'use strict';var _=require(_0x4870('0x0'));var moment=require(_0x4870('0x1'));var utils=require('./utils');var logger=require('../../../../config/logger')(_0x4870('0x2'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x4870('0x3')),'mailMessage':require(_0x4870('0x4')),'smsMessage':require(_0x4870('0x5')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require('../../rpc/whatsappMessage'),'chatInteraction':require(_0x4870('0x6')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'mailInteraction':require(_0x4870('0x7')),'smsInteraction':require(_0x4870('0x8')),'faxInteraction':require(_0x4870('0x9')),'whatsappInteraction':require(_0x4870('0xa'))};var mailRpc=require(_0x4870('0xb'));exports[_0x4870('0xc')]=function(_0x3f0783,_0xec4042,_0xabdd46,_0x1bc479){return function(_0x171ccb){try{var _0x149dba=this['channel'];if(_0x149dba===_0x4870('0xd')&&_0x1bc479[_0x4870('0xe')][_0x4870('0xf')]){logger[_0x4870('0x10')](_0x4870('0x11'),_0x3f0783,_0x4870('0x12'));return _0x171ccb['next']();}if(_0xec4042[0x0]==='1'&&(_[_0x4870('0x13')](this[_0x4870('0x14')][_0x4870('0x15')])||!this[_0x4870('0x14')][_0x4870('0x15')])){logger[_0x4870('0x10')](_0x4870('0x11'),_0x3f0783,_0x4870('0x16'));return _0x171ccb[_0x4870('0x17')]();}if(_0xec4042[0x0]==='2'&&this['interaction']['autoreplyExecuted']){logger[_0x4870('0x10')](_0x4870('0x18'),_0x3f0783,_0x4870('0x19'));return _0x171ccb['next']();}var _0x3239a8={'ContactId':this[_0x4870('0x1a')]['id'],'sentAt':moment()[_0x4870('0x1b')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x4870('0x1c')};if(this[_0x4870('0x1d')]===_0x4870('0xd')){_0x3239a8[_0x4870('0xe')]=utils['getMustacheRender'](_0xec4042[0x2],this);}else{_0x3239a8[_0x4870('0xe')]=utils['getMustacheRender'](_0xec4042[0x1],this);}if(this['message']){_0x3239a8['to']=this[_0x4870('0x1e')]['from']||'';if(this[_0x4870('0x1d')]===_0x4870('0xd')&&_0xec4042[0x1]==='1'){_0x3239a8['cc']=this[_0x4870('0x1e')]['cc']||'';}_0x3239a8[_0x4870('0x1f')]=this['message']['to']||'';_0x3239a8['phone']=this[_0x4870('0x1e')]['phone']||'';_0x3239a8[_0x4870('0x20')]=!![];if(this[_0x4870('0x1e')][_0x4870('0x21')]){_0x3239a8[_0x4870('0x21')]='';_0x3239a8[_0x4870('0x21')]+=_[_0x4870('0x22')](this[_0x4870('0x1e')][_0x4870('0x21')],_0x4870('0x23'))?'':_0x4870('0x24');_0x3239a8[_0x4870('0x21')]+=this[_0x4870('0x1e')][_0x4870('0x21')];}}if(this[_0x4870('0x1d')]===_0x4870('0x25')){_0x3239a8[_0x4870('0x26')]=this[_0x4870('0x27')]['id'];}else{_0x3239a8[_[_0x4870('0x28')](this['channel'])+_0x4870('0x29')]=this[_0x4870('0x27')]['id'];}_0x3239a8[_[_0x4870('0x28')](this[_0x4870('0x1d')])+_0x4870('0x2a')]=this['interaction']['id'];var _0x50536f=this[_0x4870('0x14')];if(rpc[this[_0x4870('0x1d')]+_0x4870('0x2b')]){if(this[_0x4870('0x1d')]===_0x4870('0xd')){_0x3239a8['inReplyTo']=this[_0x4870('0x1e')][_0x4870('0x2c')];_0x3239a8[_0x4870('0x2d')]=''+_[_0x4870('0x2e')](_0x3239a8[_0x4870('0xe')],'';_0x3239a8['headers']={'Auto-Submitted':_0x4870('0x2f'),'X-Auto-Response-Suppress':_0x4870('0x30'),'Precedence':_0x4870('0x31')};return mailRpc[_0x4870('0x32')](this['account']['smtpOptions'],_0x3239a8)['then'](function(_0x92e4fc){logger[_0x4870('0x10')]('[%s][AUTOREPLY]\x20SMTP\x20SENT',_0x3f0783);_0x3239a8[_0x4870('0x2c')]=_0x92e4fc[_0x4870('0x1e')][_0x4870('0x2c')];return rpc[_0x149dba+_0x4870('0x2b')][_0x4870('0x33')](_0x3239a8);})[_0x4870('0x34')](function(_0x63f7b2){logger[_0x4870('0x10')]('[%s][AUTOREPLY]\x20%s',_0x3f0783,JSON[_0x4870('0x35')](_0x63f7b2));})[_0x4870('0x36')](function(_0x2099dc){logger[_0x4870('0x37')](_0x4870('0x38'),_0x3f0783,JSON['stringify'](_0x2099dc));})[_0x4870('0x39')](function(){Promise[_0x4870('0x3a')]()[_0x4870('0x34')](function(){if(_0xec4042[0x0]!=='2'||_0x50536f['autoreplyExecuted'])return;return rpc[_0x149dba+'Interaction'][_0x4870('0x3b')](_0x50536f['id'],{'autoreplyExecuted':!![]})['then'](function(_0x1dd395){logger[_0x4870('0x10')]('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x3f0783,JSON['stringify'](_0x1dd395));})[_0x4870('0x36')](function(_0x428eb0){logger['error'](_0x4870('0x3c'),_0x3f0783,JSON[_0x4870('0x35')](_0x428eb0));});})[_0x4870('0x34')](function(){_0x171ccb['next']();});});}else{return rpc[this[_0x4870('0x1d')]+_0x4870('0x2b')][_0x4870('0x33')](_0x3239a8)[_0x4870('0x34')](function(){logger['info'](_0x4870('0x11'),_0x3f0783,_0x3239a8['body']);})[_0x4870('0x36')](function(_0x3c69f7){logger[_0x4870('0x37')](_0x4870('0x11'),_0x3f0783,JSON[_0x4870('0x35')](_0x3c69f7));})['finally'](function(){Promise['resolve']()[_0x4870('0x34')](function(){if(_0xec4042[0x0]!=='2'||_0x50536f[_0x4870('0x3d')])return;return rpc[_0x149dba+_0x4870('0x3e')][_0x4870('0x3b')](_0x50536f['id'],{'autoreplyExecuted':!![]})[_0x4870('0x34')](function(_0xeffc91){logger[_0x4870('0x10')](_0x4870('0x18'),_0x3f0783,JSON[_0x4870('0x35')](_0xeffc91));})['catch'](function(_0x21384d){logger[_0x4870('0x37')](_0x4870('0x3c'),_0x3f0783,JSON[_0x4870('0x35')](_0x21384d));});})[_0x4870('0x34')](function(){_0x171ccb[_0x4870('0x17')]();});});}}}catch(_0x2ec759){logger[_0x4870('0x37')](_0x4870('0x11'),_0x3f0783,JSON[_0x4870('0x35')](_0x2ec759));_0x171ccb[_0x4870('0x3f')]();}};}; \ No newline at end of file +var _0x3dc4=['../../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)','isNil','interaction','created','next','autoreplyExecuted','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','One\x20Time\x20already\x20sent','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','getMustacheRender','message','from','phone','read','subject','startsWith','Re:\x20','account','upperFirst','AccountId','InteractionId','inReplyTo','messageId','html','','replace','';_0x155d45[_0x43dc('0x32')]={'Auto-Submitted':_0x43dc('0x33'),'X-Auto-Response-Suppress':_0x43dc('0x34'),'Precedence':'auto_reply'};return mailRpc['sendMailMessage'](this[_0x43dc('0x27')]['smtpOptions'],_0x155d45)[_0x43dc('0x35')](function(_0x20f104){logger['info'](_0x43dc('0x36'),_0x187a70);_0x155d45['messageId']=_0x20f104['message'][_0x43dc('0x2c')];return rpc[_0x11d2b8+_0x43dc('0x37')][_0x43dc('0x38')](_0x155d45);})[_0x43dc('0x35')](function(_0x1c8586){logger[_0x43dc('0x11')]('[%s][AUTOREPLY]\x20%s',_0x187a70,JSON[_0x43dc('0x39')](_0x1c8586));})['catch'](function(_0x108d05){logger['error']('[RPC][%s][AUTOREPLY]\x20%s',_0x187a70,JSON[_0x43dc('0x39')](_0x108d05));})[_0x43dc('0x3a')](function(){Promise['resolve']()[_0x43dc('0x35')](function(){if(_0xccb1cc[0x0]!=='2'||_0x3e3a1b['autoreplyExecuted'])return;return rpc[_0x11d2b8+_0x43dc('0x3b')][_0x43dc('0x3c')](_0x3e3a1b['id'],{'autoreplyExecuted':!![]})[_0x43dc('0x35')](function(_0x9a3901){logger[_0x43dc('0x11')](_0x43dc('0x19'),_0x187a70,JSON['stringify'](_0x9a3901));})[_0x43dc('0x3d')](function(_0x2fe8b4){logger[_0x43dc('0x3e')](_0x43dc('0x3f'),_0x187a70,JSON[_0x43dc('0x39')](_0x2fe8b4));});})['then'](function(){_0x2398eb[_0x43dc('0x17')]();});});}else{return rpc[this[_0x43dc('0xd')]+_0x43dc('0x37')][_0x43dc('0x38')](_0x155d45)['then'](function(){logger[_0x43dc('0x11')](_0x43dc('0x12'),_0x187a70,_0x155d45[_0x43dc('0xf')]);})[_0x43dc('0x3d')](function(_0x403976){logger['error'](_0x43dc('0x12'),_0x187a70,JSON['stringify'](_0x403976));})[_0x43dc('0x3a')](function(){Promise[_0x43dc('0x40')]()[_0x43dc('0x35')](function(){if(_0xccb1cc[0x0]!=='2'||_0x3e3a1b[_0x43dc('0x18')])return;return rpc[_0x11d2b8+_0x43dc('0x3b')]['update'](_0x3e3a1b['id'],{'autoreplyExecuted':!![]})[_0x43dc('0x35')](function(_0x26d5a8){logger[_0x43dc('0x11')](_0x43dc('0x19'),_0x187a70,JSON[_0x43dc('0x39')](_0x26d5a8));})[_0x43dc('0x3d')](function(_0x37a313){logger[_0x43dc('0x3e')](_0x43dc('0x3f'),_0x187a70,JSON['stringify'](_0x37a313));});})[_0x43dc('0x35')](function(){_0x2398eb[_0x43dc('0x17')]();});});}}}catch(_0x32e2b9){logger[_0x43dc('0x3e')]('[%s][AUTOREPLY]\x20%s',_0x187a70,JSON['stringify'](_0x32e2b9));_0x2398eb[_0x43dc('0x41')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/close.js b/server/services/routing/server/applications/close.js index 286889d..61d3037 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 _0x18c8=['then','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','catch','error','stringify','finally','[%s][CLOSE]\x20%s','stop','moment','routing','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','[%s][CLOSE]\x20reason\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','system','channel','Interaction','update'];(function(_0x572dd8,_0x227286){var _0x4e3e5a=function(_0x4ee034){while(--_0x4ee034){_0x572dd8['push'](_0x572dd8['shift']());}};_0x4e3e5a(++_0x227286);}(_0x18c8,0xe4));var _0x818c=function(_0x17c3e7,_0x4f1cd1){_0x17c3e7=_0x17c3e7-0x0;var _0x4cacf5=_0x18c8[_0x17c3e7];return _0x4cacf5;};'use strict';var moment=require(_0x818c('0x0'));var logger=require('../../../../config/logger')(_0x818c('0x1'));var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0x818c('0x2')),'smsInteraction':require(_0x818c('0x3')),'mailInteraction':require(_0x818c('0x4')),'faxInteraction':require(_0x818c('0x5')),'whatsappInteraction':require(_0x818c('0x6'))};exports['consequence']=function(_0x328788,_0xe650a7,_0x31532b,_0x54a360){return function(_0x4563f4){try{logger['info'](_0x818c('0x7'),_0x328788,_0xe650a7[0x0]);var _0x454cc2={'closed':0x1,'closedAt':moment()[_0x818c('0x8')](_0x818c('0x9')),'closeReason':_0x818c('0xa'),'disposition':_0xe650a7[0x0]};if(rpc[_0x54a360[_0x818c('0xb')]+_0x818c('0xc')]){rpc[_0x54a360[_0x818c('0xb')]+'Interaction'][_0x818c('0xd')](_0x54a360['interaction']['id'],_0x454cc2)[_0x818c('0xe')](function(_0x36a5a3){logger['info'](_0x818c('0xf'),_0x328788,_0x54a360['interaction']['id']);})[_0x818c('0x10')](function(_0xccebc1){logger[_0x818c('0x11')]('[%s][CLOSE]\x20%s',_0x328788,JSON[_0x818c('0x12')](_0xccebc1));})[_0x818c('0x13')](function(){_0x4563f4['stop']();});}}catch(_0x3ec630){logger[_0x818c('0x11')](_0x818c('0x14'),_0x328788,JSON[_0x818c('0x12')](_0x3ec630));_0x4563f4[_0x818c('0x15')]();}};}; \ No newline at end of file +var _0x0eb4=['../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','consequence','[%s][CLOSE]\x20reason\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','system','Interaction','channel','update','interaction','then','info','[%s][CLOSE]\x20%s','stringify','finally','error','stop','moment','../../../../config/logger','routing'];(function(_0x41c31a,_0x2c269b){var _0x1bc120=function(_0xb4ee60){while(--_0xb4ee60){_0x41c31a['push'](_0x41c31a['shift']());}};_0x1bc120(++_0x2c269b);}(_0x0eb4,0x1f1));var _0x40eb=function(_0x2b7f19,_0x1ec615){_0x2b7f19=_0x2b7f19-0x0;var _0x34a0a0=_0x0eb4[_0x2b7f19];return _0x34a0a0;};'use strict';var moment=require(_0x40eb('0x0'));var logger=require(_0x40eb('0x1'))(_0x40eb('0x2'));var rpc={'chatInteraction':require(_0x40eb('0x3')),'openchannelInteraction':require(_0x40eb('0x4')),'smsInteraction':require(_0x40eb('0x5')),'mailInteraction':require(_0x40eb('0x6')),'faxInteraction':require(_0x40eb('0x7')),'whatsappInteraction':require(_0x40eb('0x8'))};exports[_0x40eb('0x9')]=function(_0x21321a,_0x1e72fa,_0x315cc4,_0x29a09e){return function(_0x4a5561){try{logger['info'](_0x40eb('0xa'),_0x21321a,_0x1e72fa[0x0]);var _0x389094={'closed':0x1,'closedAt':moment()[_0x40eb('0xb')](_0x40eb('0xc')),'closeReason':_0x40eb('0xd'),'disposition':_0x1e72fa[0x0]};if(rpc[_0x29a09e['channel']+_0x40eb('0xe')]){rpc[_0x29a09e[_0x40eb('0xf')]+'Interaction'][_0x40eb('0x10')](_0x29a09e[_0x40eb('0x11')]['id'],_0x389094)[_0x40eb('0x12')](function(_0x5ec3e0){logger[_0x40eb('0x13')]('[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!',_0x21321a,_0x29a09e[_0x40eb('0x11')]['id']);})['catch'](function(_0x41c52a){logger['error'](_0x40eb('0x14'),_0x21321a,JSON[_0x40eb('0x15')](_0x41c52a));})[_0x40eb('0x16')](function(){_0x4a5561['stop']();});}}catch(_0x4e0a31){logger[_0x40eb('0x17')]('[%s][CLOSE]\x20%s',_0x21321a,JSON[_0x40eb('0x15')](_0x4e0a31));_0x4a5561[_0x40eb('0x18')]();}};}; \ 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 4e76daf..3475df6 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 _0x0e76=['catch','error','[%s][DIALOGFLOW]\x20%s','stringify','finally','stop','textRequest','message','dialogflow','speech','providerName','providerResponse','result','metadata','endConversation','next','lodash','md5','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','interaction','UserId','info','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','contact','YYYY-MM-DD\x20HH:mm:ss','channel','sms','phone','chat','account','upperFirst','InteractionId','isEmpty','getMustacheRender','Message','create','then','body'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x0e76,0xc4));var _0x60e7=function(_0x50dd2d,_0x2ed7d5){_0x50dd2d=_0x50dd2d-0x0;var _0x7b56fc=_0x0e76[_0x50dd2d];return _0x7b56fc;};'use strict';var _=require(_0x60e7('0x0'));var moment=require('moment');var apiai=require('apiai-promise');var md5=require(_0x60e7('0x1'));var utils=require('./utils');var logger=require(_0x60e7('0x2'))(_0x60e7('0x3'));var rpc={'chatMessage':require(_0x60e7('0x4')),'openchannelMessage':require(_0x60e7('0x5')),'mailMessage':require(_0x60e7('0x6')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x60e7('0x7')),'whatsappMessage':require(_0x60e7('0x8'))};exports[_0x60e7('0x9')]=function(_0xba29ef,_0xa2d5cb){return function(_0x194535){try{if(!_['isNil'](this[_0x60e7('0xa')][_0x60e7('0xb')])){logger[_0x60e7('0xc')]('[%s][DIALOGFLOW]\x20%s',_0xba29ef,_0x60e7('0xd'));return _0x194535['next']();}var _0x14d531={'ContactId':this[_0x60e7('0xe')]['id'],'sentAt':moment()['format'](_0x60e7('0xf')),'direction':'out'};if(this[_0x60e7('0x10')]===_0x60e7('0x11')||this['channel']==='whatsapp'){_0x14d531[_0x60e7('0x12')]=this[_0x60e7('0xa')][_0x60e7('0x12')];}var _0x301c5d=this['channel'];if(_0x301c5d===_0x60e7('0x13')){_0x14d531['ChatWebsiteId']=this[_0x60e7('0x14')]['id'];}else{_0x14d531[_[_0x60e7('0x15')](_0x301c5d)+'AccountId']=this[_0x60e7('0x14')]['id'];}_0x14d531[_['upperFirst'](_0x301c5d)+_0x60e7('0x16')]=this[_0x60e7('0xa')]['id'];if(this[_0x60e7('0xa')]['created']){var _0x518c22=_0xa2d5cb[0x2];if(!_[_0x60e7('0x17')](_0x518c22)){_0x14d531['body']=utils[_0x60e7('0x18')](_0x518c22,this);return rpc[_0x301c5d+_0x60e7('0x19')][_0x60e7('0x1a')](_0x14d531)[_0x60e7('0x1b')](function(_0x54a701){logger[_0x60e7('0xc')]('[%s][DIALOGFLOW]\x20%s',_0xba29ef,_0x14d531[_0x60e7('0x1c')]);})[_0x60e7('0x1d')](function(_0x323074){logger[_0x60e7('0x1e')](_0x60e7('0x1f'),_0xba29ef,JSON[_0x60e7('0x20')](_0x323074));})[_0x60e7('0x21')](function(){logger[_0x60e7('0xc')]('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0xba29ef);_0x194535[_0x60e7('0x22')]();});}else{logger[_0x60e7('0xc')]('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0xba29ef);_0x194535[_0x60e7('0x22')]();}}else{var _0x507a9b=this;var _0x3d8a3b=apiai(_0xa2d5cb[0x0],{'language':_0xa2d5cb[0x1]||'en'});return _0x3d8a3b[_0x60e7('0x23')](this[_0x60e7('0x24')][_0x60e7('0x1c')],{'sessionId':md5(this[_0x60e7('0xa')]['id'])})[_0x60e7('0x1b')](function(_0x54e17b){_0x507a9b[_0x60e7('0x1c')][_0x60e7('0x25')]=_0x54e17b;_0x14d531[_0x60e7('0x1c')]=_0x54e17b['result']['fulfillment'][_0x60e7('0x26')];_0x14d531[_0x60e7('0x27')]=_0x60e7('0x25');_0x14d531[_0x60e7('0x28')]=JSON['stringify'](_0x54e17b);return rpc[_0x301c5d+_0x60e7('0x19')][_0x60e7('0x1a')](_0x14d531)[_0x60e7('0x1b')](function(_0x25bcb7){logger[_0x60e7('0xc')]('[%s][DIALOGFLOW]\x20%s',_0xba29ef,_0x14d531[_0x60e7('0x1c')]);if(_0x54e17b[_0x60e7('0x29')][_0x60e7('0x2a')][_0x60e7('0x2b')]){_0x194535[_0x60e7('0x2c')]();}else{_0x194535[_0x60e7('0x22')]();}})['catch'](function(_0xdc50fe){logger['error'](_0x60e7('0x1f'),_0xba29ef,JSON['stringify'](_0xdc50fe));_0x194535[_0x60e7('0x2c')]();});})[_0x60e7('0x1d')](function(_0x3f3d5d){logger[_0x60e7('0x1e')](_0x60e7('0x1f'),_0xba29ef,_0x3f3d5d[_0x60e7('0x24')]);_0x194535[_0x60e7('0x2c')]();});}}catch(_0x509b02){logger[_0x60e7('0x1e')]('[%s][DIALOGFLOW]\x20%s',_0xba29ef,JSON[_0x60e7('0x20')](_0x509b02));_0x194535[_0x60e7('0x22')]();}};}; \ No newline at end of file +var _0x677a=['create','info','catch','error','stringify','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','message','then','dialogflow','result','fulfillment','speech','providerName','providerResponse','metadata','endConversation','lodash','apiai-promise','md5','./utils','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','isNil','[%s][DIALOGFLOW]\x20%s','next','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','whatsapp','phone','interaction','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','created','isEmpty','body','Message'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x677a,0xd6));var _0xa677=function(_0x4e0848,_0x420555){_0x4e0848=_0x4e0848-0x0;var _0x26a3c2=_0x677a[_0x4e0848];return _0x26a3c2;};'use strict';var _=require(_0xa677('0x0'));var moment=require('moment');var apiai=require(_0xa677('0x1'));var md5=require(_0xa677('0x2'));var utils=require(_0xa677('0x3'));var logger=require(_0xa677('0x4'))(_0xa677('0x5'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0xa677('0x6')),'mailMessage':require(_0xa677('0x7')),'smsMessage':require(_0xa677('0x8')),'faxMessage':require(_0xa677('0x9')),'whatsappMessage':require(_0xa677('0xa'))};exports['consequence']=function(_0x303092,_0x1c997f){return function(_0x130b66){try{if(!_[_0xa677('0xb')](this['interaction']['UserId'])){logger['info'](_0xa677('0xc'),_0x303092,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x130b66[_0xa677('0xd')]();}var _0x1d6586={'ContactId':this['contact']['id'],'sentAt':moment()[_0xa677('0xe')](_0xa677('0xf')),'direction':_0xa677('0x10')};if(this[_0xa677('0x11')]==='sms'||this[_0xa677('0x11')]===_0xa677('0x12')){_0x1d6586[_0xa677('0x13')]=this[_0xa677('0x14')]['phone'];}var _0x31ca07=this['channel'];if(_0x31ca07===_0xa677('0x15')){_0x1d6586[_0xa677('0x16')]=this[_0xa677('0x17')]['id'];}else{_0x1d6586[_[_0xa677('0x18')](_0x31ca07)+_0xa677('0x19')]=this[_0xa677('0x17')]['id'];}_0x1d6586[_[_0xa677('0x18')](_0x31ca07)+_0xa677('0x1a')]=this[_0xa677('0x14')]['id'];if(this[_0xa677('0x14')][_0xa677('0x1b')]){var _0x1dfee0=_0x1c997f[0x2];if(!_[_0xa677('0x1c')](_0x1dfee0)){_0x1d6586[_0xa677('0x1d')]=utils['getMustacheRender'](_0x1dfee0,this);return rpc[_0x31ca07+_0xa677('0x1e')][_0xa677('0x1f')](_0x1d6586)['then'](function(_0x4e6b3d){logger[_0xa677('0x20')](_0xa677('0xc'),_0x303092,_0x1d6586[_0xa677('0x1d')]);})[_0xa677('0x21')](function(_0x51bf68){logger[_0xa677('0x22')](_0xa677('0xc'),_0x303092,JSON[_0xa677('0x23')](_0x51bf68));})[_0xa677('0x24')](function(){logger[_0xa677('0x20')](_0xa677('0x25'),_0x303092);_0x130b66['stop']();});}else{logger[_0xa677('0x20')]('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x303092);_0x130b66[_0xa677('0x26')]();}}else{var _0x1c63e8=this;var _0x45eb0f=apiai(_0x1c997f[0x0],{'language':_0x1c997f[0x1]||'en'});return _0x45eb0f['textRequest'](this[_0xa677('0x27')][_0xa677('0x1d')],{'sessionId':md5(this[_0xa677('0x14')]['id'])})[_0xa677('0x28')](function(_0x4e8e9e){_0x1c63e8[_0xa677('0x1d')][_0xa677('0x29')]=_0x4e8e9e;_0x1d6586['body']=_0x4e8e9e[_0xa677('0x2a')][_0xa677('0x2b')][_0xa677('0x2c')];_0x1d6586[_0xa677('0x2d')]=_0xa677('0x29');_0x1d6586[_0xa677('0x2e')]=JSON['stringify'](_0x4e8e9e);return rpc[_0x31ca07+_0xa677('0x1e')][_0xa677('0x1f')](_0x1d6586)[_0xa677('0x28')](function(_0x6189c){logger[_0xa677('0x20')](_0xa677('0xc'),_0x303092,_0x1d6586['body']);if(_0x4e8e9e[_0xa677('0x2a')][_0xa677('0x2f')][_0xa677('0x30')]){_0x130b66['next']();}else{_0x130b66[_0xa677('0x26')]();}})[_0xa677('0x21')](function(_0x141767){logger[_0xa677('0x22')]('[%s][DIALOGFLOW]\x20%s',_0x303092,JSON[_0xa677('0x23')](_0x141767));_0x130b66[_0xa677('0xd')]();});})[_0xa677('0x21')](function(_0x5ed0a1){logger[_0xa677('0x22')](_0xa677('0xc'),_0x303092,_0x5ed0a1[_0xa677('0x27')]);_0x130b66[_0xa677('0xd')]();});}}catch(_0x40dbc3){logger[_0xa677('0x22')](_0xa677('0xc'),_0x303092,JSON[_0xa677('0x23')](_0x40dbc3));_0x130b66['stop']();}};}; \ 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 fee29b9..a66cc56 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 _0x3dab=['fulfillmentText','push','stack','dialogflow','md5','moment','bluebird','routing','./utils','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','clone','body','then','info','[%s][DIALOGFLOWV2]\x20%s','catch','error','stringify','consequence','interaction','UserId','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','chat','ChatWebsiteId','account','upperFirst','AccountId','isEmpty','getMustacheRender','Message','create','finally','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','replace','SessionsClient','sessionPath','message','detectIntent','length','dialogflowV2','queryResult','diagnosticInfo','fields','end_conversation','boolValue','action','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','allRequiredParamsPresent','DIALOGFLOWV2_ENDCONVERSATION','DIALOGFLOWV2_INTENTNAME','intent','name','displayName','isFallback','DIALOGFLOWV2_LANGUAGECODE','DIALOGFLOWV2_QUERYTEXT','queryText','DIALOGFLOWV2_SCORE','intentDetectionConfidence','providerName'];(function(_0x2666c8,_0x4f2181){var _0x5b9fbb=function(_0x57c441){while(--_0x57c441){_0x2666c8['push'](_0x2666c8['shift']());}};_0x5b9fbb(++_0x4f2181);}(_0x3dab,0x1b9));var _0xb3da=function(_0x5d8ec0,_0x142143){_0x5d8ec0=_0x5d8ec0-0x0;var _0x27f230=_0x3dab[_0x5d8ec0];return _0x27f230;};'use strict';var _=require('lodash');var dialogflow=require(_0xb3da('0x0'));var md5=require(_0xb3da('0x1'));var moment=require(_0xb3da('0x2'));var Promise=require(_0xb3da('0x3'));var logger=require('../../../../config/logger')(_0xb3da('0x4'));var utils=require(_0xb3da('0x5'));var rpc={'chatMessage':require(_0xb3da('0x6')),'openchannelMessage':require(_0xb3da('0x7')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0xb3da('0x8')),'faxMessage':require(_0xb3da('0x9')),'whatsappMessage':require(_0xb3da('0xa'))};function createMessage(_0x3c6491,_0x212107,_0x222ee7,_0x39f966){return new Promise(function(_0x5952ab,_0x162c4c){var _0xe08069=_[_0xb3da('0xb')](_0x222ee7);_0xe08069[_0xb3da('0xc')]=_0x39f966;return rpc[_0x212107+'Message']['create'](_0xe08069)[_0xb3da('0xd')](function(){logger[_0xb3da('0xe')](_0xb3da('0xf'),_0x3c6491,_0xe08069[_0xb3da('0xc')]);_0x5952ab();})[_0xb3da('0x10')](function(_0x15bd24){logger[_0xb3da('0x11')](_0xb3da('0xf'),_0x3c6491,JSON[_0xb3da('0x12')](_0x15bd24));_0x162c4c(_0x15bd24);});});}exports[_0xb3da('0x13')]=function(_0x7b8ac5,_0x5eac3a){return function(_0x2ce81a){try{if(!_['isNil'](this[_0xb3da('0x14')][_0xb3da('0x15')])){logger['info'](_0xb3da('0xf'),_0x7b8ac5,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x2ce81a[_0xb3da('0x16')]();}var _0xd479d2={'ContactId':this[_0xb3da('0x17')]['id'],'sentAt':moment()[_0xb3da('0x18')](_0xb3da('0x19')),'direction':_0xb3da('0x1a')};if(this[_0xb3da('0x1b')]===_0xb3da('0x1c')||this[_0xb3da('0x1b')]===_0xb3da('0x1d')){_0xd479d2[_0xb3da('0x1e')]=this['interaction']['phone'];}var _0x582b96=this['channel'];if(_0x582b96===_0xb3da('0x1f')){_0xd479d2[_0xb3da('0x20')]=this[_0xb3da('0x21')]['id'];}else{_0xd479d2[_[_0xb3da('0x22')](_0x582b96)+_0xb3da('0x23')]=this[_0xb3da('0x21')]['id'];}_0xd479d2[_[_0xb3da('0x22')](_0x582b96)+'InteractionId']=this[_0xb3da('0x14')]['id'];if(this[_0xb3da('0x14')]['created']){var _0x138abf=_0x5eac3a[0x4];if(!_[_0xb3da('0x24')](_0x138abf)){_0xd479d2[_0xb3da('0xc')]=utils[_0xb3da('0x25')](_0x138abf,this);return rpc[_0x582b96+_0xb3da('0x26')][_0xb3da('0x27')](_0xd479d2)['then'](function(_0x2897e8){logger[_0xb3da('0xe')](_0xb3da('0xf'),_0x7b8ac5,_0xd479d2['body']);})[_0xb3da('0x10')](function(_0x4a4a58){logger[_0xb3da('0x11')](_0xb3da('0xf'),_0x7b8ac5,JSON[_0xb3da('0x12')](_0x4a4a58));})[_0xb3da('0x28')](function(){logger['info'](_0xb3da('0x29'),_0x7b8ac5);_0x2ce81a[_0xb3da('0x2a')]();});}else{logger['info']('[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x7b8ac5);_0x2ce81a['stop']();}}else{var _0x522ea7=this;var _0x1b04fa=_0x5eac3a[0x2][_0xb3da('0x2b')](/\\n/g,'\x0a');var _0x18876d={'credentials':{'private_key':_0x1b04fa,'client_email':_0x5eac3a[0x1]}};var _0xf4d896=new dialogflow[(_0xb3da('0x2c'))](_0x18876d);var _0x41a73e=_0xf4d896[_0xb3da('0x2d')](_0x5eac3a[0x0],md5(_0x522ea7[_0xb3da('0x14')]['id']));var _0x5e2b50={'session':_0x41a73e,'queryInput':{'text':{'text':_0x522ea7[_0xb3da('0x2e')][_0xb3da('0xc')],'languageCode':_0x5eac3a[0x3]||'en'}}};return _0xf4d896[_0xb3da('0x2f')](_0x5e2b50)[_0xb3da('0xd')](function(_0xa5c5ff){if(_0xa5c5ff&&_0xa5c5ff[_0xb3da('0x30')]){_0x522ea7[_0xb3da('0xc')][_0xb3da('0x31')]=_0xa5c5ff;var _0x20911b=_0xa5c5ff[0x0];var _0x2587b0=_0x20911b[_0xb3da('0x32')][_0xb3da('0x33')]&&_0x20911b['queryResult'][_0xb3da('0x33')]['fields']?_0x20911b[_0xb3da('0x32')]['diagnosticInfo'][_0xb3da('0x34')][_0xb3da('0x35')][_0xb3da('0x36')]:![];_0x522ea7[_0xb3da('0xc')]['DIALOGFLOWV2_ACTION']=_0x20911b[_0xb3da('0x32')][_0xb3da('0x37')];_0x522ea7[_0xb3da('0xc')][_0xb3da('0x38')]=_0x20911b['queryResult'][_0xb3da('0x39')];_0x522ea7[_0xb3da('0xc')][_0xb3da('0x3a')]=_0x20911b[_0xb3da('0x32')][_0xb3da('0x33')]&&_0x20911b[_0xb3da('0x32')]['diagnosticInfo']['fields']?_0x20911b[_0xb3da('0x32')][_0xb3da('0x33')][_0xb3da('0x34')][_0xb3da('0x35')]['boolValue']:![];_0x522ea7['body'][_0xb3da('0x3b')]=_0x20911b[_0xb3da('0x32')][_0xb3da('0x3c')][_0xb3da('0x3d')];_0x522ea7[_0xb3da('0xc')]['DIALOGFLOWV2_INTENTDISPLAYNAME']=_0x20911b['queryResult']['intent'][_0xb3da('0x3e')];_0x522ea7[_0xb3da('0xc')]['DIALOGFLOWV2_ISFALLBACKINTENT']=_0x20911b[_0xb3da('0x32')][_0xb3da('0x3c')][_0xb3da('0x3f')];_0x522ea7[_0xb3da('0xc')][_0xb3da('0x40')]=_0x20911b[_0xb3da('0x32')]['languageCode'];_0x522ea7[_0xb3da('0xc')][_0xb3da('0x41')]=_0x20911b[_0xb3da('0x32')][_0xb3da('0x42')];_0x522ea7['body'][_0xb3da('0x43')]=_0x20911b[_0xb3da('0x32')][_0xb3da('0x44')];_0xd479d2[_0xb3da('0x45')]=_0xb3da('0x31');_0xd479d2['providerResponse']=JSON[_0xb3da('0x12')](_0xa5c5ff);var _0x448faa=[];for(var _0x4c5461=0x0;_0x4c5461<_0xa5c5ff[_0xb3da('0x30')];_0x4c5461++){var _0x3b09a9=_0xa5c5ff[_0x4c5461];if(_0x3b09a9&&_0x3b09a9[_0xb3da('0x32')]&&_0x3b09a9[_0xb3da('0x32')][_0xb3da('0x46')]){_0x448faa[_0xb3da('0x47')](createMessage(_0x7b8ac5,_0x582b96,_0xd479d2,_0x3b09a9[_0xb3da('0x32')][_0xb3da('0x46')]));}}return Promise['all'](_0x448faa)[_0xb3da('0xd')](function(){if(_0x2587b0){_0x2ce81a[_0xb3da('0x16')]();}else{_0x2ce81a[_0xb3da('0x2a')]();}})[_0xb3da('0x10')](function(_0x47b73a){logger['error']('[%s][DIALOGFLOWV2]\x20%s',_0x7b8ac5,JSON[_0xb3da('0x12')](_0x47b73a));_0x2ce81a[_0xb3da('0x16')]();});}})[_0xb3da('0x10')](function(_0x9307c1){logger[_0xb3da('0x11')](_0xb3da('0xf'),_0x7b8ac5,_0x9307c1[_0xb3da('0x2e')],_0x9307c1[_0xb3da('0x48')]);_0x2ce81a[_0xb3da('0x16')]();});}}catch(_0x2b3f80){logger[_0xb3da('0x11')](_0xb3da('0xf'),_0x7b8ac5,JSON[_0xb3da('0x12')](_0x2b3f80));_0x2ce81a[_0xb3da('0x2a')]();}};}; \ No newline at end of file +var _0xfb11=['replace','SessionsClient','sessionPath','message','detectIntent','length','dialogflowV2','queryResult','diagnosticInfo','fields','end_conversation','boolValue','action','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','DIALOGFLOWV2_INTENTNAME','intent','name','displayName','isFallback','languageCode','DIALOGFLOWV2_QUERYTEXT','queryText','DIALOGFLOWV2_SCORE','intentDetectionConfidence','providerResponse','fulfillmentText','push','stack','lodash','dialogflow','md5','bluebird','../../../../config/logger','routing','./utils','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','clone','body','Message','create','then','info','[%s][DIALOGFLOWV2]\x20%s','catch','error','stringify','consequence','isNil','UserId','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','YYYY-MM-DD\x20HH:mm:ss','whatsapp','phone','channel','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','interaction','isEmpty','getMustacheRender','finally','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop'];(function(_0x40b3a1,_0x2dbe24){var _0x56a5f7=function(_0x130256){while(--_0x130256){_0x40b3a1['push'](_0x40b3a1['shift']());}};_0x56a5f7(++_0x2dbe24);}(_0xfb11,0xf1));var _0x1fb1=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0xfb11[_0x110c3d];return _0x226d67;};'use strict';var _=require(_0x1fb1('0x0'));var dialogflow=require(_0x1fb1('0x1'));var md5=require(_0x1fb1('0x2'));var moment=require('moment');var Promise=require(_0x1fb1('0x3'));var logger=require(_0x1fb1('0x4'))(_0x1fb1('0x5'));var utils=require(_0x1fb1('0x6'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x1fb1('0x7')),'mailMessage':require(_0x1fb1('0x8')),'smsMessage':require(_0x1fb1('0x9')),'faxMessage':require(_0x1fb1('0xa')),'whatsappMessage':require(_0x1fb1('0xb'))};function createMessage(_0xbc4a55,_0x146cb5,_0x47c19e,_0x4d3902){return new Promise(function(_0x267a81,_0x1fa097){var _0x4613bc=_[_0x1fb1('0xc')](_0x47c19e);_0x4613bc[_0x1fb1('0xd')]=_0x4d3902;return rpc[_0x146cb5+_0x1fb1('0xe')][_0x1fb1('0xf')](_0x4613bc)[_0x1fb1('0x10')](function(){logger[_0x1fb1('0x11')](_0x1fb1('0x12'),_0xbc4a55,_0x4613bc[_0x1fb1('0xd')]);_0x267a81();})[_0x1fb1('0x13')](function(_0x2f54ff){logger[_0x1fb1('0x14')](_0x1fb1('0x12'),_0xbc4a55,JSON[_0x1fb1('0x15')](_0x2f54ff));_0x1fa097(_0x2f54ff);});});}exports[_0x1fb1('0x16')]=function(_0x1dedf3,_0x107d69){return function(_0x2c407c){try{if(!_[_0x1fb1('0x17')](this['interaction'][_0x1fb1('0x18')])){logger[_0x1fb1('0x11')](_0x1fb1('0x12'),_0x1dedf3,_0x1fb1('0x19'));return _0x2c407c[_0x1fb1('0x1a')]();}var _0x19cc92={'ContactId':this[_0x1fb1('0x1b')]['id'],'sentAt':moment()['format'](_0x1fb1('0x1c')),'direction':'out'};if(this['channel']==='sms'||this['channel']===_0x1fb1('0x1d')){_0x19cc92['phone']=this['interaction'][_0x1fb1('0x1e')];}var _0x3d553a=this[_0x1fb1('0x1f')];if(_0x3d553a==='chat'){_0x19cc92[_0x1fb1('0x20')]=this[_0x1fb1('0x21')]['id'];}else{_0x19cc92[_[_0x1fb1('0x22')](_0x3d553a)+_0x1fb1('0x23')]=this['account']['id'];}_0x19cc92[_[_0x1fb1('0x22')](_0x3d553a)+_0x1fb1('0x24')]=this[_0x1fb1('0x25')]['id'];if(this[_0x1fb1('0x25')]['created']){var _0x560a31=_0x107d69[0x4];if(!_[_0x1fb1('0x26')](_0x560a31)){_0x19cc92[_0x1fb1('0xd')]=utils[_0x1fb1('0x27')](_0x560a31,this);return rpc[_0x3d553a+_0x1fb1('0xe')]['create'](_0x19cc92)['then'](function(_0x4a871b){logger['info'](_0x1fb1('0x12'),_0x1dedf3,_0x19cc92[_0x1fb1('0xd')]);})[_0x1fb1('0x13')](function(_0x38accf){logger[_0x1fb1('0x14')](_0x1fb1('0x12'),_0x1dedf3,JSON[_0x1fb1('0x15')](_0x38accf));})[_0x1fb1('0x28')](function(){logger[_0x1fb1('0x11')](_0x1fb1('0x29'),_0x1dedf3);_0x2c407c[_0x1fb1('0x2a')]();});}else{logger['info']('[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x1dedf3);_0x2c407c[_0x1fb1('0x2a')]();}}else{var _0x5cbfed=this;var _0x35fc25=_0x107d69[0x2][_0x1fb1('0x2b')](/\\n/g,'\x0a');var _0x9b5a8f={'credentials':{'private_key':_0x35fc25,'client_email':_0x107d69[0x1]}};var _0x21e914=new dialogflow[(_0x1fb1('0x2c'))](_0x9b5a8f);var _0x6e8f3d=_0x21e914[_0x1fb1('0x2d')](_0x107d69[0x0],md5(_0x5cbfed[_0x1fb1('0x25')]['id']));var _0x21e44a={'session':_0x6e8f3d,'queryInput':{'text':{'text':_0x5cbfed[_0x1fb1('0x2e')][_0x1fb1('0xd')],'languageCode':_0x107d69[0x3]||'en'}}};return _0x21e914[_0x1fb1('0x2f')](_0x21e44a)['then'](function(_0x52101a){if(_0x52101a&&_0x52101a[_0x1fb1('0x30')]){_0x5cbfed[_0x1fb1('0xd')][_0x1fb1('0x31')]=_0x52101a;var _0x3a4d58=_0x52101a[0x0];var _0x4b52e9=_0x3a4d58[_0x1fb1('0x32')][_0x1fb1('0x33')]&&_0x3a4d58['queryResult'][_0x1fb1('0x33')]['fields']?_0x3a4d58['queryResult'][_0x1fb1('0x33')][_0x1fb1('0x34')][_0x1fb1('0x35')][_0x1fb1('0x36')]:![];_0x5cbfed[_0x1fb1('0xd')]['DIALOGFLOWV2_ACTION']=_0x3a4d58[_0x1fb1('0x32')][_0x1fb1('0x37')];_0x5cbfed['body'][_0x1fb1('0x38')]=_0x3a4d58[_0x1fb1('0x32')]['allRequiredParamsPresent'];_0x5cbfed[_0x1fb1('0xd')]['DIALOGFLOWV2_ENDCONVERSATION']=_0x3a4d58['queryResult'][_0x1fb1('0x33')]&&_0x3a4d58[_0x1fb1('0x32')]['diagnosticInfo'][_0x1fb1('0x34')]?_0x3a4d58[_0x1fb1('0x32')][_0x1fb1('0x33')]['fields'][_0x1fb1('0x35')][_0x1fb1('0x36')]:![];_0x5cbfed[_0x1fb1('0xd')][_0x1fb1('0x39')]=_0x3a4d58[_0x1fb1('0x32')][_0x1fb1('0x3a')][_0x1fb1('0x3b')];_0x5cbfed['body']['DIALOGFLOWV2_INTENTDISPLAYNAME']=_0x3a4d58[_0x1fb1('0x32')][_0x1fb1('0x3a')][_0x1fb1('0x3c')];_0x5cbfed[_0x1fb1('0xd')]['DIALOGFLOWV2_ISFALLBACKINTENT']=_0x3a4d58[_0x1fb1('0x32')][_0x1fb1('0x3a')][_0x1fb1('0x3d')];_0x5cbfed[_0x1fb1('0xd')]['DIALOGFLOWV2_LANGUAGECODE']=_0x3a4d58[_0x1fb1('0x32')][_0x1fb1('0x3e')];_0x5cbfed[_0x1fb1('0xd')][_0x1fb1('0x3f')]=_0x3a4d58[_0x1fb1('0x32')][_0x1fb1('0x40')];_0x5cbfed[_0x1fb1('0xd')][_0x1fb1('0x41')]=_0x3a4d58['queryResult'][_0x1fb1('0x42')];_0x19cc92['providerName']=_0x1fb1('0x31');_0x19cc92[_0x1fb1('0x43')]=JSON[_0x1fb1('0x15')](_0x52101a);var _0x1f4f23=[];for(var _0x575186=0x0;_0x575186<_0x52101a[_0x1fb1('0x30')];_0x575186++){var _0x1ecb88=_0x52101a[_0x575186];if(_0x1ecb88&&_0x1ecb88[_0x1fb1('0x32')]&&_0x1ecb88[_0x1fb1('0x32')][_0x1fb1('0x44')]){_0x1f4f23[_0x1fb1('0x45')](createMessage(_0x1dedf3,_0x3d553a,_0x19cc92,_0x1ecb88[_0x1fb1('0x32')][_0x1fb1('0x44')]));}}return Promise['all'](_0x1f4f23)['then'](function(){if(_0x4b52e9){_0x2c407c[_0x1fb1('0x1a')]();}else{_0x2c407c[_0x1fb1('0x2a')]();}})[_0x1fb1('0x13')](function(_0x2ff8bb){logger[_0x1fb1('0x14')](_0x1fb1('0x12'),_0x1dedf3,JSON[_0x1fb1('0x15')](_0x2ff8bb));_0x2c407c['next']();});}})[_0x1fb1('0x13')](function(_0x515c01){logger['error'](_0x1fb1('0x12'),_0x1dedf3,_0x515c01[_0x1fb1('0x2e')],_0x515c01[_0x1fb1('0x46')]);_0x2c407c[_0x1fb1('0x1a')]();});}}catch(_0xc57c59){logger['error'](_0x1fb1('0x12'),_0x1dedf3,JSON[_0x1fb1('0x15')](_0xc57c59));_0x2c407c[_0x1fb1('0x2a')]();}};}; \ 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 0191b69..db335ad 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 _0x6989=['stop','condition','priorityFalse','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','rules','info','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','stringify','validate','lodash','./utils','routing','string','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','consequence','getMustacheRender','replace','length','error','[%s][GOTOIF]\x20%s','map','message','join'];(function(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0x6989,0xa5));var _0x9698=function(_0x5679f4,_0x5ace54){_0x5679f4=_0x5679f4-0x0;var _0x2f9e94=_0x6989[_0x5679f4];return _0x2f9e94;};'use strict';var schema=require(_0x9698('0x0'));var _=require(_0x9698('0x1'));var htmlToText=require('html-to-text');var utils=require(_0x9698('0x2'));var logger=require('../../../../config/logger')(_0x9698('0x3'));var gotoif=schema({'condition':{'type':_0x9698('0x4'),'required':!![],'message':'condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'priorityTrue':{'type':_0x9698('0x5'),'message':_0x9698('0x6')},'priorityFalse':{'type':'number','message':_0x9698('0x7')}});exports[_0x9698('0x8')]=function(_0x1539cb,_0x12d1dd){return function(_0x2435d9){try{var _0x21b229={'condition':htmlToText['fromString'](utils[_0x9698('0x9')](_0x12d1dd[0x0],this),{'wordwrap':![]})[_0x9698('0xa')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x12d1dd[0x1],'priorityFalse':_0x12d1dd[0x2]};var _0x5c996d=gotoif['validate'](_0x21b229,{'typecast':!![]});if(_0x5c996d[_0x9698('0xb')]){logger[_0x9698('0xc')](_0x9698('0xd'),_0x1539cb,_[_0x9698('0xe')](_0x5c996d,_0x9698('0xf'))[_0x9698('0x10')](',\x20'));_0x2435d9[_0x9698('0x11')]();}else{try{var _0x1d4c48=eval('('+_0x21b229[_0x9698('0x12')]+')');var _0x5c9979=_0x1d4c48?_0x21b229['priorityTrue']:_0x21b229[_0x9698('0x13')];logger['info'](_0x9698('0x14'),_0x1539cb,_0x21b229[_0x9698('0x12')],_0x1d4c48,_0x5c9979||'next');if(_0x5c9979){var _0x431651=_['findIndex'](_0x2435d9[_0x9698('0x15')](),{'p':_0x5c9979});if(_0x431651>=0x0){logger[_0x9698('0x16')](_0x9698('0x17'),_0x1539cb,_0x5c9979||_0x9698('0x18'),_0x431651);_0x2435d9['next'](_0x431651);}else{logger['info']('[%s][GOTOIF]\x20priority\x20%s\x20not\x20found',_0x1539cb,_0x5c9979||_0x9698('0x18'));_0x2435d9[_0x9698('0x11')]();}}else{_0x2435d9['next']();}}catch(_0x3136b1){logger[_0x9698('0xc')]('[%s][GOTOIF]\x20eval\x20error:\x20%s',_0x1539cb,_0x3136b1[_0x9698('0xf')]);_0x2435d9[_0x9698('0x11')]();}}}catch(_0x176c78){logger[_0x9698('0xc')](_0x9698('0xd'),_0x1539cb,JSON[_0x9698('0x19')](_0x176c78));_0x2435d9[_0x9698('0x11')]();}};}; \ No newline at end of file +var _0x27d8=['lodash','html-to-text','../../../../config/logger','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','consequence','fromString','getMustacheRender','replace','length','map','message','join','stop','condition','priorityTrue','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','findIndex','rules','info','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','error','[%s][GOTOIF]\x20eval\x20error:\x20%s','[%s][GOTOIF]\x20%s','stringify','validate'];(function(_0x507071,_0x52637d){var _0x53c0d0=function(_0x19cc16){while(--_0x19cc16){_0x507071['push'](_0x507071['shift']());}};_0x53c0d0(++_0x52637d);}(_0x27d8,0x13f));var _0x827d=function(_0x1265ed,_0x4b85e8){_0x1265ed=_0x1265ed-0x0;var _0x5ac459=_0x27d8[_0x1265ed];return _0x5ac459;};'use strict';var schema=require(_0x827d('0x0'));var _=require(_0x827d('0x1'));var htmlToText=require(_0x827d('0x2'));var utils=require('./utils');var logger=require(_0x827d('0x3'))(_0x827d('0x4'));var gotoif=schema({'condition':{'type':_0x827d('0x5'),'required':!![],'message':_0x827d('0x6')},'priorityTrue':{'type':_0x827d('0x7'),'message':_0x827d('0x8')},'priorityFalse':{'type':_0x827d('0x7'),'message':_0x827d('0x9')}});exports[_0x827d('0xa')]=function(_0x5d385d,_0x5e8fcf){return function(_0x34d690){try{var _0x1247c9={'condition':htmlToText[_0x827d('0xb')](utils[_0x827d('0xc')](_0x5e8fcf[0x0],this),{'wordwrap':![]})[_0x827d('0xd')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x5e8fcf[0x1],'priorityFalse':_0x5e8fcf[0x2]};var _0x49da45=gotoif['validate'](_0x1247c9,{'typecast':!![]});if(_0x49da45[_0x827d('0xe')]){logger['error']('[%s][GOTOIF]\x20%s',_0x5d385d,_[_0x827d('0xf')](_0x49da45,_0x827d('0x10'))[_0x827d('0x11')](',\x20'));_0x34d690[_0x827d('0x12')]();}else{try{var _0x3882c5=eval('('+_0x1247c9[_0x827d('0x13')]+')');var _0x10fafa=_0x3882c5?_0x1247c9[_0x827d('0x14')]:_0x1247c9['priorityFalse'];logger['info'](_0x827d('0x15'),_0x5d385d,_0x1247c9['condition'],_0x3882c5,_0x10fafa||_0x827d('0x16'));if(_0x10fafa){var _0x1b3db5=_[_0x827d('0x17')](_0x34d690[_0x827d('0x18')](),{'p':_0x10fafa});if(_0x1b3db5>=0x0){logger[_0x827d('0x19')](_0x827d('0x1a'),_0x5d385d,_0x10fafa||'next',_0x1b3db5);_0x34d690['next'](_0x1b3db5);}else{logger['info'](_0x827d('0x1b'),_0x5d385d,_0x10fafa||_0x827d('0x16'));_0x34d690[_0x827d('0x12')]();}}else{_0x34d690['next']();}}catch(_0x116400){logger[_0x827d('0x1c')](_0x827d('0x1d'),_0x5d385d,_0x116400[_0x827d('0x10')]);_0x34d690[_0x827d('0x12')]();}}}catch(_0x265ce3){logger[_0x827d('0x1c')](_0x827d('0x1e'),_0x5d385d,JSON[_0x827d('0x1f')](_0x265ce3));_0x34d690[_0x827d('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 0212ee9..6e5fb67 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 _0x48cd=['validate','lodash','../../../../config/logger','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','length','error','map','message','join','stop','info','priority','findIndex','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','[%s][GOTOP]\x20%s'];(function(_0x34ba14,_0x3db2af){var _0x288a36=function(_0xd588b7){while(--_0xd588b7){_0x34ba14['push'](_0x34ba14['shift']());}};_0x288a36(++_0x3db2af);}(_0x48cd,0x1ed));var _0xd48c=function(_0x3a3aed,_0x435787){_0x3a3aed=_0x3a3aed-0x0;var _0x54b82b=_0x48cd[_0x3a3aed];return _0x54b82b;};'use strict';var schema=require(_0xd48c('0x0'));var _=require(_0xd48c('0x1'));var logger=require(_0xd48c('0x2'))('routing');var gotop=schema({'priority':{'type':'number','required':!![],'message':_0xd48c('0x3')}});exports[_0xd48c('0x4')]=function(_0x5c605c,_0x1af7f2){return function(_0x8c0179){try{var _0x35804e={'priority':_0x1af7f2[0x0]};var _0x4b61aa=gotop[_0xd48c('0x0')](_0x35804e,{'typecast':!![]});if(_0x4b61aa[_0xd48c('0x5')]){logger[_0xd48c('0x6')]('[%s][GOTOP]\x20%s',_0x5c605c,_[_0xd48c('0x7')](_0x4b61aa,_0xd48c('0x8'))[_0xd48c('0x9')](',\x20'));_0x8c0179[_0xd48c('0xa')]();}else{logger[_0xd48c('0xb')]('[%s][GOTOP]\x20priority\x20%s',_0x5c605c,_0x35804e[_0xd48c('0xc')]);if(_0x35804e['priority']){var _0x3ee0bc=_[_0xd48c('0xd')](_0x8c0179['rules'](),{'p':_0x35804e[_0xd48c('0xc')]});if(_0x3ee0bc>=0x0){logger[_0xd48c('0xb')]('[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x5c605c,_0x35804e[_0xd48c('0xc')]||_0xd48c('0xe'),_0x3ee0bc);_0x8c0179['next'](_0x3ee0bc);}else{logger[_0xd48c('0xb')](_0xd48c('0xf'),_0x5c605c,_0x35804e[_0xd48c('0xc')]||_0xd48c('0xe'));_0x8c0179['stop']();}}else{_0x8c0179[_0xd48c('0xe')]();}}}catch(_0xdb36f5){logger[_0xd48c('0x6')](_0xd48c('0x10'),_0x5c605c,JSON['stringify'](_0xdb36f5));_0x8c0179[_0xd48c('0xa')]();}};}; \ No newline at end of file +var _0x9876=['error','[%s][GOTOP]\x20%s','message','stop','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','info','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','validate','lodash','../../../../config/logger','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','length'];(function(_0x416212,_0x576f2e){var _0x5550bd=function(_0x9a8c72){while(--_0x9a8c72){_0x416212['push'](_0x416212['shift']());}};_0x5550bd(++_0x576f2e);}(_0x9876,0x89));var _0x6987=function(_0x40c634,_0x350136){_0x40c634=_0x40c634-0x0;var _0xfb6c02=_0x9876[_0x40c634];return _0xfb6c02;};'use strict';var schema=require(_0x6987('0x0'));var _=require(_0x6987('0x1'));var logger=require(_0x6987('0x2'))('routing');var gotop=schema({'priority':{'type':_0x6987('0x3'),'required':!![],'message':_0x6987('0x4')}});exports[_0x6987('0x5')]=function(_0x5ac8bc,_0x5a0cb7){return function(_0x3b8464){try{var _0x534324={'priority':_0x5a0cb7[0x0]};var _0x143ec6=gotop[_0x6987('0x0')](_0x534324,{'typecast':!![]});if(_0x143ec6[_0x6987('0x6')]){logger[_0x6987('0x7')](_0x6987('0x8'),_0x5ac8bc,_['map'](_0x143ec6,_0x6987('0x9'))['join'](',\x20'));_0x3b8464[_0x6987('0xa')]();}else{logger['info'](_0x6987('0xb'),_0x5ac8bc,_0x534324[_0x6987('0xc')]);if(_0x534324[_0x6987('0xc')]){var _0x302b06=_[_0x6987('0xd')](_0x3b8464['rules'](),{'p':_0x534324[_0x6987('0xc')]});if(_0x302b06>=0x0){logger[_0x6987('0xe')](_0x6987('0xf'),_0x5ac8bc,_0x534324[_0x6987('0xc')]||'next',_0x302b06);_0x3b8464[_0x6987('0x10')](_0x302b06);}else{logger[_0x6987('0xe')](_0x6987('0x11'),_0x5ac8bc,_0x534324[_0x6987('0xc')]||_0x6987('0x10'));_0x3b8464[_0x6987('0xa')]();}}else{_0x3b8464[_0x6987('0x10')]();}}}catch(_0x746680){logger[_0x6987('0x7')](_0x6987('0x8'),_0x5ac8bc,JSON['stringify'](_0x746680));_0x3b8464['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 4a86525..6ab2296 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 _0x36e1=['AccountId','upperFirst','interaction','Message','create','then','info','[%s][MESSAGE]\x20%s','body','catch','error','stringify','stop','lodash','./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','getMustacheRender','contact','channel','chat','ChatWebsiteId','account'];(function(_0x4c9269,_0x12d461){var _0x165fd8=function(_0x3da980){while(--_0x3da980){_0x4c9269['push'](_0x4c9269['shift']());}};_0x165fd8(++_0x12d461);}(_0x36e1,0x187));var _0x136e=function(_0x511bd1,_0x223e5b){_0x511bd1=_0x511bd1-0x0;var _0x4c48ec=_0x36e1[_0x511bd1];return _0x4c48ec;};'use strict';var _=require(_0x136e('0x0'));var utils=require(_0x136e('0x1'));var logger=require(_0x136e('0x2'))('routing');var rpc={'chatMessage':require(_0x136e('0x3')),'openchannelMessage':require(_0x136e('0x4')),'mailMessage':require(_0x136e('0x5')),'smsMessage':require(_0x136e('0x6')),'faxMessage':require(_0x136e('0x7')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports['consequence']=function(_0x30f96b,_0x1cbce5){return function(_0x5163da){try{var _0x46110e={'body':utils[_0x136e('0x8')](_0x1cbce5[0x0],this),'ContactId':this[_0x136e('0x9')]['id']};if(this[_0x136e('0xa')]===_0x136e('0xb')){_0x46110e[_0x136e('0xc')]=this[_0x136e('0xd')]['id'];}else{_0x46110e[_['upperFirst'](this[_0x136e('0xa')])+_0x136e('0xe')]=this['account']['id'];}_0x46110e[_[_0x136e('0xf')](this[_0x136e('0xa')])+'InteractionId']=this[_0x136e('0x10')]['id'];if(rpc[this[_0x136e('0xa')]+_0x136e('0x11')]){return rpc[this['channel']+_0x136e('0x11')][_0x136e('0x12')](_0x46110e)[_0x136e('0x13')](function(_0x87db56){logger[_0x136e('0x14')](_0x136e('0x15'),_0x30f96b,_0x46110e[_0x136e('0x16')]);_0x5163da['next']();})[_0x136e('0x17')](function(_0x14151d){logger[_0x136e('0x18')]('[%s][MESSAGE]\x20%s',_0x30f96b,JSON[_0x136e('0x19')](_0x14151d));_0x5163da[_0x136e('0x1a')]();});}}catch(_0x39249c){logger[_0x136e('0x18')](_0x136e('0x15'),_0x30f96b,JSON[_0x136e('0x19')](_0x39249c));_0x5163da[_0x136e('0x1a')]();}};}; \ No newline at end of file +var _0x31df=['[%s][MESSAGE]\x20%s','body','next','catch','stringify','stop','error','./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','getMustacheRender','contact','channel','chat','ChatWebsiteId','account','upperFirst','InteractionId','interaction','Message'];(function(_0x47242d,_0x13f993){var _0x30273a=function(_0x322cd2){while(--_0x322cd2){_0x47242d['push'](_0x47242d['shift']());}};_0x30273a(++_0x13f993);}(_0x31df,0x11a));var _0xf31d=function(_0x241dea,_0x2fad95){_0x241dea=_0x241dea-0x0;var _0x1cabbe=_0x31df[_0x241dea];return _0x1cabbe;};'use strict';var _=require('lodash');var utils=require(_0xf31d('0x0'));var logger=require(_0xf31d('0x1'))('routing');var rpc={'chatMessage':require(_0xf31d('0x2')),'openchannelMessage':require(_0xf31d('0x3')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0xf31d('0x4')),'faxMessage':require(_0xf31d('0x5')),'whatsappMessage':require(_0xf31d('0x6'))};exports[_0xf31d('0x7')]=function(_0x476735,_0x41245a){return function(_0x359f2a){try{var _0x481479={'body':utils[_0xf31d('0x8')](_0x41245a[0x0],this),'ContactId':this[_0xf31d('0x9')]['id']};if(this[_0xf31d('0xa')]===_0xf31d('0xb')){_0x481479[_0xf31d('0xc')]=this[_0xf31d('0xd')]['id'];}else{_0x481479[_[_0xf31d('0xe')](this['channel'])+'AccountId']=this[_0xf31d('0xd')]['id'];}_0x481479[_['upperFirst'](this[_0xf31d('0xa')])+_0xf31d('0xf')]=this[_0xf31d('0x10')]['id'];if(rpc[this['channel']+_0xf31d('0x11')]){return rpc[this[_0xf31d('0xa')]+'Message']['create'](_0x481479)['then'](function(_0x4ec59e){logger['info'](_0xf31d('0x12'),_0x476735,_0x481479[_0xf31d('0x13')]);_0x359f2a[_0xf31d('0x14')]();})[_0xf31d('0x15')](function(_0x3aaaaf){logger['error'](_0xf31d('0x12'),_0x476735,JSON[_0xf31d('0x16')](_0x3aaaaf));_0x359f2a[_0xf31d('0x17')]();});}}catch(_0x48d737){logger[_0xf31d('0x18')]('[%s][MESSAGE]\x20%s',_0x476735,JSON['stringify'](_0x48d737));_0x359f2a[_0xf31d('0x17')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/noop.js b/server/services/routing/server/applications/noop.js index e876d73..6369688 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 _0x41b6=['getMustacheRender','next','error','stringify','stop','./utils','../../../../config/logger','consequence','info','[%s][NOOP]\x20%s'];(function(_0x5386a4,_0x4d38df){var _0x5c61c1=function(_0x8daa2f){while(--_0x8daa2f){_0x5386a4['push'](_0x5386a4['shift']());}};_0x5c61c1(++_0x4d38df);}(_0x41b6,0x73));var _0x641b=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x41b6[_0x2dafbe];return _0x58a45a;};'use strict';var utils=require(_0x641b('0x0'));var logger=require(_0x641b('0x1'))('routing');exports[_0x641b('0x2')]=function(_0x296d68,_0x225f6b){return function(_0x40e92f){try{logger[_0x641b('0x3')](_0x641b('0x4'),_0x296d68,utils[_0x641b('0x5')](_0x225f6b[0x0],this));_0x40e92f[_0x641b('0x6')]();}catch(_0x548813){logger[_0x641b('0x7')](_0x641b('0x4'),_0x296d68,JSON[_0x641b('0x8')](_0x548813));_0x40e92f[_0x641b('0x9')]();}};}; \ No newline at end of file +var _0xcf12=['getMustacheRender','next','error','stringify','stop','../../../../config/logger','consequence','info','[%s][NOOP]\x20%s'];(function(_0x27f35c,_0x10e4f9){var _0x4f1a1f=function(_0x743d7d){while(--_0x743d7d){_0x27f35c['push'](_0x27f35c['shift']());}};_0x4f1a1f(++_0x10e4f9);}(_0xcf12,0x140));var _0x2cf1=function(_0x2a5217,_0x4d2636){_0x2a5217=_0x2a5217-0x0;var _0x55c5a3=_0xcf12[_0x2a5217];return _0x55c5a3;};'use strict';var utils=require('./utils');var logger=require(_0x2cf1('0x0'))('routing');exports[_0x2cf1('0x1')]=function(_0x361548,_0xd3a5ce){return function(_0x5ccf2c){try{logger[_0x2cf1('0x2')](_0x2cf1('0x3'),_0x361548,utils[_0x2cf1('0x4')](_0xd3a5ce[0x0],this));_0x5ccf2c[_0x2cf1('0x5')]();}catch(_0xec83cf){logger[_0x2cf1('0x6')](_0x2cf1('0x3'),_0x361548,JSON[_0x2cf1('0x7')](_0xec83cf));_0x5ccf2c[_0x2cf1('0x8')]();}};}; \ 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 4e31fdc..ccc221f 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 _0x805a=['[%s][QUEUE]\x20ROUTING\x20STOPPED','close','complete','strategy','rrmemory','beepall','log','stack','lodash','util','seq-queue','moment','ioredis','../../../../config/environment','../../../../config/logger','routing','./strategy','defaults','localhost','socket.io-emitter','redis','queue_id','account','queue','from','emit','push','capitalize','InteractionId','format','%sQueuesWaitingInteractions','pick','remove','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','../../rpc/faxInteraction','../../rpc/mailInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','channel','QueueId','interaction','MessageId','message','WebsiteId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','catch','error','accepted','[%s][STOP:QUEUE][NAME:%s]','update','then','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','toLowerCase','consequence','validate','length','[%s][QUEUE]\x20%s','map','join','stop','Queues','createQueue','atimeout','qtimeout','rules','end'];(function(_0x1c48b6,_0x3815b3){var _0x416018=function(_0x485404){while(--_0x485404){_0x1c48b6['push'](_0x1c48b6['shift']());}};_0x416018(++_0x3815b3);}(_0x805a,0x107));var _0xa805=function(_0x3c5924,_0x4d295f){_0x3c5924=_0x3c5924-0x0;var _0x576958=_0x805a[_0x3c5924];return _0x576958;};'use strict';var schema=require('validate');var _=require(_0xa805('0x0'));var util=require(_0xa805('0x1'));var seqqueue=require(_0xa805('0x2'));var moment=require(_0xa805('0x3'));var Redis=require(_0xa805('0x4'));var config=require(_0xa805('0x5'));var logger=require(_0xa805('0x6'))(_0xa805('0x7'));var strategy=require(_0xa805('0x8'));config['redis']=_[_0xa805('0x9')](config['redis'],{'host':_0xa805('0xa'),'port':0x18eb});var io=require(_0xa805('0xb'))(new Redis(config[_0xa805('0xc')]));var attributes=['id',_0xa805('0xd'),_0xa805('0xe'),_0xa805('0xf'),_0xa805('0x10'),'joinAt'];function emit(_0x218ee5,_0x4b96fc,_0x32fe3b){io['to'](_0x218ee5)[_0xa805('0x11')](_0x4b96fc,_0x32fe3b);}function emitChannelQueueInteraction(_0x2e53cf,_0x52c2de,_0x591176,_0x522e51,_0x408c1a,_0x4f1ff8,_0x4b63e0,_0x93883a){var _0x456ec5=_['clone'](_0x591176);_0x456ec5[_0xa805('0xd')]=_0x93883a;_0x456ec5['queue']=_0x52c2de;_0x456ec5[_0xa805('0xe')]=_0x522e51;_0x456ec5['id']=_0x408c1a;if(_0x4f1ff8){attributes[_0xa805('0x12')](_[_0xa805('0x13')](_0x2e53cf)+_0xa805('0x14'));_0x4b63e0[util[_0xa805('0x15')](_0xa805('0x16'),_0x2e53cf)][_0x408c1a]=_[_0xa805('0x17')](_0x456ec5,attributes);}else{delete _0x4b63e0[util[_0xa805('0x15')](_0xa805('0x16'),_0x2e53cf)][_0x408c1a];}emit(util[_0xa805('0x15')]('%s:queue:%s',_0x2e53cf,_0x52c2de),util[_0xa805('0x15')]('%s_queue_waiting_interaction:%s',_0x2e53cf,_0x4f1ff8?'save':_0xa805('0x18')),_[_0xa805('0x17')](_0x456ec5,attributes));}var rpc={'openchannelQueueReport':require('../../rpc/openchannelQueueReport'),'mailQueueReport':require(_0xa805('0x19')),'chatQueueReport':require(_0xa805('0x1a')),'smsQueueReport':require(_0xa805('0x1b')),'faxQueueReport':require(_0xa805('0x1c')),'whatsappQueueReport':require(_0xa805('0x1d')),'chatInteraction':require('../../rpc/chatInteraction'),'faxInteraction':require(_0xa805('0x1e')),'mailInteraction':require(_0xa805('0x1f')),'openchannelInteraction':require(_0xa805('0x20')),'smsInteraction':require(_0xa805('0x21')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var queue=schema({'name':{'type':'string','required':!![],'message':_0xa805('0x22')},'timeout':{'type':_0xa805('0x23'),'message':_0xa805('0x24')}});function startRouting(_0x3f9e4a,_0x179090,_0x3ff145,_0x1a1e02){if(_0x3f9e4a&&_0x179090&&_0x3ff145){_0x179090[_0xa805('0x25')]+=0x1;var _0x17f372={'uniqueid':_0x3f9e4a,'from':_0x3ff145['body']?_0x3ff145[_0xa805('0x26')][_0xa805('0x10')]:'','joinAt':moment()[_0xa805('0x15')](_0xa805('0x27')),'ContactId':_0x3ff145[_0xa805('0x28')]?_0x3ff145['contact']['id']:null,'ListId':_0x3ff145[_0xa805('0x29')]?_0x3ff145[_0xa805('0x29')]['id']:null};_0x17f372[_[_0xa805('0x2a')](_0x3ff145[_0xa805('0x2b')])+_0xa805('0x2c')]=_0x179090['id']||null;_0x17f372[_[_0xa805('0x2a')](_0x3ff145['channel'])+_0xa805('0x14')]=_0x3ff145[_0xa805('0x2d')]?_0x3ff145['interaction']['id']:null;_0x17f372[_[_0xa805('0x2a')](_0x3ff145[_0xa805('0x2b')])+_0xa805('0x2e')]=_0x3ff145[_0xa805('0x2f')]?_0x3ff145[_0xa805('0x2f')]['id']:null;_0x17f372[_[_0xa805('0x2a')](_0x3ff145[_0xa805('0x2b')])+(_0x3ff145[_0xa805('0x2b')]!=='chat'?'AccountId':_0xa805('0x30'))]=_0x3ff145[_0xa805('0xe')]?_0x3ff145[_0xa805('0xe')]['id']:null;logger[_0xa805('0x31')](util[_0xa805('0x15')](_0xa805('0x32'),_0x3f9e4a,_0x179090['name']));emitChannelQueueInteraction(_0x3ff145[_0xa805('0x2b')],_0x179090[_0xa805('0x33')],_0x17f372,_0x3ff145[_0xa805('0xe')][_0xa805('0x33')],_0x3ff145[_0xa805('0x2f')]['id'],!![],_0x1a1e02,_0x179090['id']);if(rpc[_0x3ff145[_0xa805('0x2b')]+'QueueReport']){return rpc[_0x3ff145[_0xa805('0x2b')]+_0xa805('0x34')][_0xa805('0x35')](_0x17f372)[_0xa805('0x36')](function(_0x288920){logger[_0xa805('0x37')]('create\x20queue\x20report');});}}}function stopRouting(_0x134160,_0x581bf6,_0x2e96fe,_0x5a6a29){if(_0x134160&&_0x581bf6){_0x581bf6[_0xa805('0x25')]-=0x1;var _0x333e5d={'leaveAt':moment()[_0xa805('0x15')](_0xa805('0x27')),'acceptAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0xa805('0x38')};logger['info'](util[_0xa805('0x15')](_0xa805('0x39'),_0x134160,_0x581bf6[_0xa805('0x33')]));emitChannelQueueInteraction(_0x2e96fe[_0xa805('0x2b')],_0x581bf6[_0xa805('0x33')],_0x2e96fe[_0xa805('0x26')],_0x2e96fe[_0xa805('0xe')][_0xa805('0x33')],_0x2e96fe['message']['id'],![],_0x5a6a29,_0x581bf6['id']);return rpc[_0x2e96fe[_0xa805('0x2b')]+'Interaction'][_0xa805('0x3a')](_0x2e96fe[_0xa805('0x2d')]['id'],{'queueId':_0x581bf6['id']})[_0xa805('0x3b')](function(){if(rpc[_0x2e96fe[_0xa805('0x2b')]+_0xa805('0x34')]){return rpc[_0x2e96fe[_0xa805('0x2b')]+'QueueReport'][_0xa805('0x3a')](_0x134160,_0x333e5d)['catch'](function(_0xe4c8fa){logger[_0xa805('0x37')](_0xa805('0x3c'));});}});}}function endRouting(_0x7c3d1f,_0x1b4dc6,_0x3f5c7a,_0x55e471){if(_0x7c3d1f&&_0x1b4dc6){_0x1b4dc6['waiting']-=0x1;var _0x1aa2a4={'leaveAt':moment()[_0xa805('0x15')](_0xa805('0x27')),'exitAt':moment()[_0xa805('0x15')](_0xa805('0x27')),'reason':_0xa805('0x3d')};logger[_0xa805('0x31')](util[_0xa805('0x15')](_0xa805('0x3e'),_0x7c3d1f,_0x1b4dc6[_0xa805('0x33')]));emitChannelQueueInteraction(_0x3f5c7a[_0xa805('0x2b')],_0x1b4dc6[_0xa805('0x33')],_0x3f5c7a[_0xa805('0x26')],_0x3f5c7a['account'][_0xa805('0x33')],_0x3f5c7a[_0xa805('0x2f')]['id'],![],_0x55e471);if(rpc[_0x3f5c7a[_0xa805('0x2b')]+_0xa805('0x34')]){return rpc[_0x3f5c7a[_0xa805('0x2b')]+_0xa805('0x34')][_0xa805('0x3a')](_0x7c3d1f,_0x1aa2a4)['catch'](function(_0x3b8009){logger['error'](_0xa805('0x3c'));});}}}function handleFindQueue(_0x2ebcd3){return function(_0x56e9b7){return _0x56e9b7[_0xa805('0x33')][_0xa805('0x3f')]()===_0x2ebcd3[_0xa805('0x3f')]();};}exports[_0xa805('0x40')]=function(_0x519310,_0x406b43,_0x1014de,_0x18008e){return function(_0x54d84c){try{var _0x1b5c78={'name':_0x406b43[0x0],'timeout':_0x406b43[0x1]};var _0x1d3dbc=queue[_0xa805('0x41')](_0x1b5c78,{'typecast':!![]});if(_0x1d3dbc[_0xa805('0x42')]){logger[_0xa805('0x37')](_0xa805('0x43'),_0x519310,_[_0xa805('0x44')](_0x1d3dbc,_0xa805('0x2f'))[_0xa805('0x45')](',\x20'));_0x54d84c[_0xa805('0x46')]();}else{var _0x2d04a0=_['find'](_0x1014de[_0x18008e['channel']+_0xa805('0x47')],handleFindQueue(_0x1b5c78['name']));if(_0x2d04a0){startRouting(_0x519310,_0x2d04a0,_0x18008e,_0x1014de);var _0x5711ce=(_0x2d04a0[_0xa805('0x3d')]||0xa)*0x3e8;var _0x3fc8de=(_0x1b5c78[_0xa805('0x3d')]||0x14)*0x3e8;var _0x544f0f;if(_0x5711ce>_0x3fc8de){_0x3fc8de=_0x5711ce;}var _0x200020=seqqueue[_0xa805('0x48')](_0x5711ce);_0x200020['id']=_0x519310;_0x200020[_0xa805('0x49')]=_0x5711ce;_0x200020[_0xa805('0x4a')]=_0x3fc8de;_0x200020[_0xa805('0x2b')]=_0x18008e['channel'];_0x1014de[_0xa805('0x4b')][_0x519310]['on'](_0xa805('0x4c'),function(){logger[_0xa805('0x31')](_0xa805('0x4d'),_0x519310);stopRouting(_0x519310,_0x2d04a0,_0x18008e,_0x1014de);clearTimeout(_0x544f0f);_0x544f0f=undefined;_0x200020[_0xa805('0x4e')](!![]);if(_0x1014de['rules'][_0x519310]){delete _0x1014de[_0xa805('0x4b')][_0x519310];}_0x54d84c[_0xa805('0x46')]();});_0x1014de[_0xa805('0x4b')][_0x519310]['on'](_0xa805('0x4f'),function(){if(_0x1014de[_0xa805('0x4b')][_0x519310]){delete _0x1014de['rules'][_0x519310];}});_0x544f0f=setTimeout(function(){logger['info']('[%s][QUEUE]\x20APPLICATION\x20END',_0x519310);endRouting(_0x519310,_0x2d04a0,_0x18008e,_0x1014de);clearTimeout(_0x544f0f);_0x200020[_0xa805('0x4e')](!![]);_0x54d84c['next']();},_0x3fc8de);switch(_0x2d04a0[_0xa805('0x50')]){case _0xa805('0x51'):strategy[_0xa805('0x51')](_0x200020,_0x2d04a0,_0x1014de,_0x18008e);break;default:strategy[_0xa805('0x52')](_0x200020,_0x2d04a0,_0x1014de,_0x18008e);}}else{logger[_0xa805('0x37')]('[%s][QUEUE]\x20queue\x20not\x20found\x20%s',_0x519310,_0x1b5c78['name']);_0x54d84c[_0xa805('0x46')]();}}}catch(_0x2a2ed3){console[_0xa805('0x53')](_0x2a2ed3);logger[_0xa805('0x37')](_0xa805('0x43'),_0x519310,_0x2a2ed3[_0xa805('0x54')]);_0x54d84c[_0xa805('0x46')]();}};}; \ No newline at end of file +var _0xe400=['waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','channel','interaction','message','chat','AccountId','WebsiteId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','catch','error','accepted','[%s][STOP:QUEUE][NAME:%s]','update','then','update\x20queue\x20report','timeout','toLowerCase','consequence','validate','[%s][QUEUE]\x20%s','map','join','stop','Queues','createQueue','qtimeout','rules','end','complete','[%s][QUEUE]\x20APPLICATION\x20END','close','strategy','rrmemory','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','stack','lodash','util','seq-queue','ioredis','../../../../config/environment','../../../../config/logger','routing','defaults','redis','localhost','socket.io-emitter','queue_id','account','from','joinAt','emit','queue','push','capitalize','InteractionId','format','%sQueuesWaitingInteractions','%s:queue:%s','%s_queue_waiting_interaction:%s','remove','pick','../../rpc/openchannelQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','../../rpc/chatInteraction','../../rpc/faxInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/whatsappInteraction','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number'];(function(_0x380b8f,_0x32271d){var _0x646c69=function(_0x57c77f){while(--_0x57c77f){_0x380b8f['push'](_0x380b8f['shift']());}};_0x646c69(++_0x32271d);}(_0xe400,0x181));var _0x0e40=function(_0x3e606b,_0x5868ad){_0x3e606b=_0x3e606b-0x0;var _0x117c50=_0xe400[_0x3e606b];return _0x117c50;};'use strict';var schema=require('validate');var _=require(_0x0e40('0x0'));var util=require(_0x0e40('0x1'));var seqqueue=require(_0x0e40('0x2'));var moment=require('moment');var Redis=require(_0x0e40('0x3'));var config=require(_0x0e40('0x4'));var logger=require(_0x0e40('0x5'))(_0x0e40('0x6'));var strategy=require('./strategy');config['redis']=_[_0x0e40('0x7')](config[_0x0e40('0x8')],{'host':_0x0e40('0x9'),'port':0x18eb});var io=require(_0x0e40('0xa'))(new Redis(config[_0x0e40('0x8')]));var attributes=['id',_0x0e40('0xb'),_0x0e40('0xc'),'queue',_0x0e40('0xd'),_0x0e40('0xe')];function emit(_0x2a6fc0,_0x52f2f5,_0x15ceae){io['to'](_0x2a6fc0)[_0x0e40('0xf')](_0x52f2f5,_0x15ceae);}function emitChannelQueueInteraction(_0x589bf3,_0x5825c9,_0x4a4e61,_0x5a0951,_0x537b77,_0x11be02,_0x3f9bd2,_0x2997f4){var _0x27cdc3=_['clone'](_0x4a4e61);_0x27cdc3[_0x0e40('0xb')]=_0x2997f4;_0x27cdc3[_0x0e40('0x10')]=_0x5825c9;_0x27cdc3['account']=_0x5a0951;_0x27cdc3['id']=_0x537b77;if(_0x11be02){attributes[_0x0e40('0x11')](_[_0x0e40('0x12')](_0x589bf3)+_0x0e40('0x13'));_0x3f9bd2[util[_0x0e40('0x14')](_0x0e40('0x15'),_0x589bf3)][_0x537b77]=_['pick'](_0x27cdc3,attributes);}else{delete _0x3f9bd2[util[_0x0e40('0x14')]('%sQueuesWaitingInteractions',_0x589bf3)][_0x537b77];}emit(util[_0x0e40('0x14')](_0x0e40('0x16'),_0x589bf3,_0x5825c9),util['format'](_0x0e40('0x17'),_0x589bf3,_0x11be02?'save':_0x0e40('0x18')),_[_0x0e40('0x19')](_0x27cdc3,attributes));}var rpc={'openchannelQueueReport':require(_0x0e40('0x1a')),'mailQueueReport':require('../../rpc/mailQueueReport'),'chatQueueReport':require(_0x0e40('0x1b')),'smsQueueReport':require(_0x0e40('0x1c')),'faxQueueReport':require(_0x0e40('0x1d')),'whatsappQueueReport':require(_0x0e40('0x1e')),'chatInteraction':require(_0x0e40('0x1f')),'faxInteraction':require(_0x0e40('0x20')),'mailInteraction':require('../../rpc/mailInteraction'),'openchannelInteraction':require(_0x0e40('0x21')),'smsInteraction':require(_0x0e40('0x22')),'whatsappInteraction':require(_0x0e40('0x23'))};var queue=schema({'name':{'type':_0x0e40('0x24'),'required':!![],'message':_0x0e40('0x25')},'timeout':{'type':_0x0e40('0x26'),'message':_0x0e40('0x27')}});function startRouting(_0x5cbea2,_0x51323b,_0x499b50,_0x439f51){if(_0x5cbea2&&_0x51323b&&_0x499b50){_0x51323b[_0x0e40('0x28')]+=0x1;var _0x494ab6={'uniqueid':_0x5cbea2,'from':_0x499b50['body']?_0x499b50[_0x0e40('0x29')]['from']:'','joinAt':moment()[_0x0e40('0x14')](_0x0e40('0x2a')),'ContactId':_0x499b50[_0x0e40('0x2b')]?_0x499b50[_0x0e40('0x2b')]['id']:null,'ListId':_0x499b50[_0x0e40('0x2c')]?_0x499b50[_0x0e40('0x2c')]['id']:null};_0x494ab6[_[_0x0e40('0x2d')](_0x499b50[_0x0e40('0x2e')])+'QueueId']=_0x51323b['id']||null;_0x494ab6[_['upperFirst'](_0x499b50[_0x0e40('0x2e')])+_0x0e40('0x13')]=_0x499b50[_0x0e40('0x2f')]?_0x499b50[_0x0e40('0x2f')]['id']:null;_0x494ab6[_[_0x0e40('0x2d')](_0x499b50[_0x0e40('0x2e')])+'MessageId']=_0x499b50[_0x0e40('0x30')]?_0x499b50[_0x0e40('0x30')]['id']:null;_0x494ab6[_[_0x0e40('0x2d')](_0x499b50[_0x0e40('0x2e')])+(_0x499b50[_0x0e40('0x2e')]!==_0x0e40('0x31')?_0x0e40('0x32'):_0x0e40('0x33'))]=_0x499b50['account']?_0x499b50[_0x0e40('0xc')]['id']:null;logger[_0x0e40('0x34')](util[_0x0e40('0x14')](_0x0e40('0x35'),_0x5cbea2,_0x51323b[_0x0e40('0x36')]));emitChannelQueueInteraction(_0x499b50[_0x0e40('0x2e')],_0x51323b[_0x0e40('0x36')],_0x494ab6,_0x499b50[_0x0e40('0xc')][_0x0e40('0x36')],_0x499b50['message']['id'],!![],_0x439f51,_0x51323b['id']);if(rpc[_0x499b50['channel']+_0x0e40('0x37')]){return rpc[_0x499b50[_0x0e40('0x2e')]+_0x0e40('0x37')][_0x0e40('0x38')](_0x494ab6)[_0x0e40('0x39')](function(_0x83347e){logger[_0x0e40('0x3a')]('create\x20queue\x20report');});}}}function stopRouting(_0x3cbcc5,_0x3be2f7,_0xdb10c5,_0x550d8f){if(_0x3cbcc5&&_0x3be2f7){_0x3be2f7['waiting']-=0x1;var _0x29692d={'leaveAt':moment()[_0x0e40('0x14')]('YYYY-MM-DD\x20HH:mm:ss'),'acceptAt':moment()[_0x0e40('0x14')](_0x0e40('0x2a')),'reason':_0x0e40('0x3b')};logger['info'](util['format'](_0x0e40('0x3c'),_0x3cbcc5,_0x3be2f7[_0x0e40('0x36')]));emitChannelQueueInteraction(_0xdb10c5[_0x0e40('0x2e')],_0x3be2f7[_0x0e40('0x36')],_0xdb10c5[_0x0e40('0x29')],_0xdb10c5[_0x0e40('0xc')][_0x0e40('0x36')],_0xdb10c5[_0x0e40('0x30')]['id'],![],_0x550d8f,_0x3be2f7['id']);return rpc[_0xdb10c5[_0x0e40('0x2e')]+'Interaction'][_0x0e40('0x3d')](_0xdb10c5['interaction']['id'],{'queueId':_0x3be2f7['id']})[_0x0e40('0x3e')](function(){if(rpc[_0xdb10c5[_0x0e40('0x2e')]+_0x0e40('0x37')]){return rpc[_0xdb10c5[_0x0e40('0x2e')]+'QueueReport'][_0x0e40('0x3d')](_0x3cbcc5,_0x29692d)[_0x0e40('0x39')](function(_0x427545){logger[_0x0e40('0x3a')](_0x0e40('0x3f'));});}});}}function endRouting(_0x1df91c,_0x310099,_0x4c8536,_0x517dd1){if(_0x1df91c&&_0x310099){_0x310099[_0x0e40('0x28')]-=0x1;var _0xb40cfe={'leaveAt':moment()[_0x0e40('0x14')](_0x0e40('0x2a')),'exitAt':moment()[_0x0e40('0x14')](_0x0e40('0x2a')),'reason':_0x0e40('0x40')};logger[_0x0e40('0x34')](util[_0x0e40('0x14')]('[%s][END:QUEUE][NAME:%s]',_0x1df91c,_0x310099[_0x0e40('0x36')]));emitChannelQueueInteraction(_0x4c8536[_0x0e40('0x2e')],_0x310099[_0x0e40('0x36')],_0x4c8536[_0x0e40('0x29')],_0x4c8536['account'][_0x0e40('0x36')],_0x4c8536['message']['id'],![],_0x517dd1);if(rpc[_0x4c8536[_0x0e40('0x2e')]+_0x0e40('0x37')]){return rpc[_0x4c8536[_0x0e40('0x2e')]+'QueueReport'][_0x0e40('0x3d')](_0x1df91c,_0xb40cfe)[_0x0e40('0x39')](function(_0x747fda){logger[_0x0e40('0x3a')]('update\x20queue\x20report');});}}}function handleFindQueue(_0x4d0c55){return function(_0x5d7dd5){return _0x5d7dd5['name'][_0x0e40('0x41')]()===_0x4d0c55['toLowerCase']();};}exports[_0x0e40('0x42')]=function(_0x45e8d6,_0x1de568,_0x19f378,_0x1f2433){return function(_0x2cf6d5){try{var _0x266a8b={'name':_0x1de568[0x0],'timeout':_0x1de568[0x1]};var _0xd6465f=queue[_0x0e40('0x43')](_0x266a8b,{'typecast':!![]});if(_0xd6465f['length']){logger[_0x0e40('0x3a')](_0x0e40('0x44'),_0x45e8d6,_[_0x0e40('0x45')](_0xd6465f,_0x0e40('0x30'))[_0x0e40('0x46')](',\x20'));_0x2cf6d5[_0x0e40('0x47')]();}else{var _0x413238=_['find'](_0x19f378[_0x1f2433[_0x0e40('0x2e')]+_0x0e40('0x48')],handleFindQueue(_0x266a8b[_0x0e40('0x36')]));if(_0x413238){startRouting(_0x45e8d6,_0x413238,_0x1f2433,_0x19f378);var _0x4b6c27=(_0x413238['timeout']||0xa)*0x3e8;var _0x3b8d13=(_0x266a8b['timeout']||0x14)*0x3e8;var _0x22af48;if(_0x4b6c27>_0x3b8d13){_0x3b8d13=_0x4b6c27;}var _0x1257b8=seqqueue[_0x0e40('0x49')](_0x4b6c27);_0x1257b8['id']=_0x45e8d6;_0x1257b8['atimeout']=_0x4b6c27;_0x1257b8[_0x0e40('0x4a')]=_0x3b8d13;_0x1257b8[_0x0e40('0x2e')]=_0x1f2433[_0x0e40('0x2e')];_0x19f378[_0x0e40('0x4b')][_0x45e8d6]['on'](_0x0e40('0x4c'),function(){logger[_0x0e40('0x34')]('[%s][QUEUE]\x20ROUTING\x20STOPPED',_0x45e8d6);stopRouting(_0x45e8d6,_0x413238,_0x1f2433,_0x19f378);clearTimeout(_0x22af48);_0x22af48=undefined;_0x1257b8['close'](!![]);if(_0x19f378[_0x0e40('0x4b')][_0x45e8d6]){delete _0x19f378[_0x0e40('0x4b')][_0x45e8d6];}_0x2cf6d5[_0x0e40('0x47')]();});_0x19f378[_0x0e40('0x4b')][_0x45e8d6]['on'](_0x0e40('0x4d'),function(){if(_0x19f378[_0x0e40('0x4b')][_0x45e8d6]){delete _0x19f378[_0x0e40('0x4b')][_0x45e8d6];}});_0x22af48=setTimeout(function(){logger[_0x0e40('0x34')](_0x0e40('0x4e'),_0x45e8d6);endRouting(_0x45e8d6,_0x413238,_0x1f2433,_0x19f378);clearTimeout(_0x22af48);_0x1257b8[_0x0e40('0x4f')](!![]);_0x2cf6d5['next']();},_0x3b8d13);switch(_0x413238[_0x0e40('0x50')]){case'rrmemory':strategy[_0x0e40('0x51')](_0x1257b8,_0x413238,_0x19f378,_0x1f2433);break;default:strategy['beepall'](_0x1257b8,_0x413238,_0x19f378,_0x1f2433);}}else{logger[_0x0e40('0x3a')](_0x0e40('0x52'),_0x45e8d6,_0x266a8b[_0x0e40('0x36')]);_0x2cf6d5[_0x0e40('0x47')]();}}}catch(_0x376333){console[_0x0e40('0x53')](_0x376333);logger[_0x0e40('0x3a')](_0x0e40('0x44'),_0x45e8d6,_0x376333[_0x0e40('0x54')]);_0x2cf6d5[_0x0e40('0x47')]();}};}; \ 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 b29ad01..1a25151 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 _0x5089=['uuid','../../../../../config/logger','routing','notificationId','agent','realtime','push','handleRun','handleTimeout','bind','timeout','squeue','drained','handleDrained','prototype','debug','isNil','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable','busy','busyQueue','saveWaitingNotification','channel','showNotification','RINGING',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','removeWaitingNotification','writeLog','STOP','TIMEOUT','exports','lodash'];(function(_0x1f110e,_0x3c4081){var _0x2dd4fa=function(_0x5e9b8d){while(--_0x5e9b8d){_0x1f110e['push'](_0x1f110e['shift']());}};_0x2dd4fa(++_0x3c4081);}(_0x5089,0x1bb));var _0x9508=function(_0x54d4a8,_0x585a59){_0x54d4a8=_0x54d4a8-0x0;var _0x3b321b=_0x5089[_0x54d4a8];return _0x3b321b;};'use strict';var _=require(_0x9508('0x0'));var uuid=require(_0x9508('0x1'));var util=require('./util');var logger=require(_0x9508('0x2'))(_0x9508('0x3'));var Agent=function(_0x7dd13d,_0x100d7e,_0x172549,_0x59d3ee){this[_0x9508('0x4')]=uuid['v4']();this['squeue']=_0x7dd13d;this[_0x9508('0x5')]=_0x100d7e;this[_0x9508('0x6')]=_0x172549;this[_0x9508('0x3')]=_0x59d3ee;this['squeue'][_0x9508('0x7')](this[_0x9508('0x8')]['bind'](this),this[_0x9508('0x9')][_0x9508('0xa')](this));this['squeue']['on'](_0x9508('0xb'),this['handleTimeout'][_0x9508('0xa')](this));this[_0x9508('0xc')]['on'](_0x9508('0xd'),this[_0x9508('0xe')][_0x9508('0xa')](this));};Agent[_0x9508('0xf')]['push']=function(){this[_0x9508('0xc')]['push'](this[_0x9508('0x8')][_0x9508('0xa')](this),this['handleTimeout'][_0x9508('0xa')](this));};Agent[_0x9508('0xf')][_0x9508('0xe')]=function(){this[_0x9508('0x9')](!![]);};Agent['prototype'][_0x9508('0x8')]=function(){logger[_0x9508('0x10')]('[%s][AGENT]\x20try\x20with\x20%s',this[_0x9508('0xc')]['id'],this['agent']['id']);if(_[_0x9508('0x11')](this[_0x9508('0x6')][_0x9508('0x12')][this[_0x9508('0x5')]['id']])){logger[_0x9508('0x10')](_0x9508('0x13'),this[_0x9508('0xc')]['id'],this[_0x9508('0x5')]['id']);setTimeout(this['push'][_0x9508('0xa')](this),0x3e8);}else{if(this[_0x9508('0x3')][_0x9508('0x14')]||util[_0x9508('0x15')](this[_0x9508('0xc')]['id'],this[_0x9508('0x6')]['agents'][this['agent']['id']],this[_0x9508('0xc')]['channel'],![])){this[_0x9508('0x6')]['agents'][this[_0x9508('0x5')]['id']][_0x9508('0x16')]=!![];this[_0x9508('0x6')][_0x9508('0x12')][this[_0x9508('0x5')]['id']][_0x9508('0x17')]=undefined;util[_0x9508('0x18')](this['realtime'],this['routing'],this[_0x9508('0x5')],this[_0x9508('0xc')][_0x9508('0x19')]);util[_0x9508('0x1a')](this[_0x9508('0x4')],this[_0x9508('0xc')]['id'],this['realtime']['agents'][this[_0x9508('0x5')]['id']],null,this['routing']);util['writeLog'](this[_0x9508('0xc')]['id'],this['realtime']['agents'][this[_0x9508('0x5')]['id']],_0x9508('0x1b')+(this['routing'][_0x9508('0x14')]?_0x9508('0x1c'):''));}else{logger[_0x9508('0x10')](_0x9508('0x1d'),this[_0x9508('0xc')]['id'],this[_0x9508('0x5')]['id']);setTimeout(this[_0x9508('0x7')][_0x9508('0xa')](this),0x3e8);}}};Agent[_0x9508('0xf')][_0x9508('0x9')]=function(_0x19a984){if(_['isNil'](this[_0x9508('0x6')][_0x9508('0x12')][this[_0x9508('0x5')]['id']])){return logger['debug'](_0x9508('0x13'),this[_0x9508('0xc')]['id'],this['agent']['id']);}else{logger[_0x9508('0x10')](_0x9508('0x1e'),this['squeue']['id'],this[_0x9508('0x5')]['id']);util[_0x9508('0x1f')](this[_0x9508('0x4')],this[_0x9508('0xc')]['id'],this['realtime']['agents'][this[_0x9508('0x5')]['id']],null,this[_0x9508('0x3')]);this[_0x9508('0x6')]['agents'][this['agent']['id']][_0x9508('0x16')]=![];this[_0x9508('0x6')][_0x9508('0x12')][this[_0x9508('0x5')]['id']][_0x9508('0x17')]=undefined;util[_0x9508('0x20')](this[_0x9508('0x6')],this[_0x9508('0x3')],this[_0x9508('0x5')],this[_0x9508('0xc')]['channel']);util[_0x9508('0x21')](this[_0x9508('0xc')]['id'],this['realtime'][_0x9508('0x12')][this[_0x9508('0x5')]['id']],_0x19a984?_0x9508('0x22'):_0x9508('0x23'));}if(!_0x19a984){setTimeout(this[_0x9508('0x7')][_0x9508('0xa')](this),0x3e8);}};function agent(_0x33e17c,_0x3700f1,_0xfb6676,_0x98ff75){return new Agent(_0x33e17c,_0x3700f1,_0xfb6676,_0x98ff75);}module[_0x9508('0x24')]=agent; \ No newline at end of file +var _0x4c6d=['routing','squeue','agent','push','bind','handleTimeout','timeout','drained','handleDrained','prototype','handleRun','debug','isNil','realtime','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','channel','busy','busyQueue','saveWaitingNotification','showNotification','notificationId','RINGING',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','writeLog','STOP','TIMEOUT','exports','lodash','uuid','./util','../../../../../config/logger'];(function(_0x185656,_0x36b620){var _0x24a077=function(_0x270c03){while(--_0x270c03){_0x185656['push'](_0x185656['shift']());}};_0x24a077(++_0x36b620);}(_0x4c6d,0x1d0));var _0xd4c6=function(_0x2685b7,_0x4c8a5d){_0x2685b7=_0x2685b7-0x0;var _0x292ca9=_0x4c6d[_0x2685b7];return _0x292ca9;};'use strict';var _=require(_0xd4c6('0x0'));var uuid=require(_0xd4c6('0x1'));var util=require(_0xd4c6('0x2'));var logger=require(_0xd4c6('0x3'))(_0xd4c6('0x4'));var Agent=function(_0x5448bc,_0x209f99,_0x60355c,_0x306766){this['notificationId']=uuid['v4']();this[_0xd4c6('0x5')]=_0x5448bc;this[_0xd4c6('0x6')]=_0x209f99;this['realtime']=_0x60355c;this[_0xd4c6('0x4')]=_0x306766;this[_0xd4c6('0x5')][_0xd4c6('0x7')](this['handleRun'][_0xd4c6('0x8')](this),this[_0xd4c6('0x9')][_0xd4c6('0x8')](this));this['squeue']['on'](_0xd4c6('0xa'),this[_0xd4c6('0x9')][_0xd4c6('0x8')](this));this['squeue']['on'](_0xd4c6('0xb'),this[_0xd4c6('0xc')][_0xd4c6('0x8')](this));};Agent[_0xd4c6('0xd')][_0xd4c6('0x7')]=function(){this[_0xd4c6('0x5')]['push'](this['handleRun'][_0xd4c6('0x8')](this),this['handleTimeout'][_0xd4c6('0x8')](this));};Agent[_0xd4c6('0xd')][_0xd4c6('0xc')]=function(){this[_0xd4c6('0x9')](!![]);};Agent[_0xd4c6('0xd')][_0xd4c6('0xe')]=function(){logger[_0xd4c6('0xf')]('[%s][AGENT]\x20try\x20with\x20%s',this['squeue']['id'],this[_0xd4c6('0x6')]['id']);if(_[_0xd4c6('0x10')](this[_0xd4c6('0x11')][_0xd4c6('0x12')][this[_0xd4c6('0x6')]['id']])){logger[_0xd4c6('0xf')](_0xd4c6('0x13'),this['squeue']['id'],this[_0xd4c6('0x6')]['id']);setTimeout(this[_0xd4c6('0x7')][_0xd4c6('0x8')](this),0x3e8);}else{if(this[_0xd4c6('0x4')][_0xd4c6('0x14')]||util['isAgentAvailable'](this[_0xd4c6('0x5')]['id'],this[_0xd4c6('0x11')][_0xd4c6('0x12')][this['agent']['id']],this[_0xd4c6('0x5')][_0xd4c6('0x15')],![])){this[_0xd4c6('0x11')][_0xd4c6('0x12')][this['agent']['id']][_0xd4c6('0x16')]=!![];this['realtime'][_0xd4c6('0x12')][this[_0xd4c6('0x6')]['id']][_0xd4c6('0x17')]=undefined;util[_0xd4c6('0x18')](this[_0xd4c6('0x11')],this[_0xd4c6('0x4')],this[_0xd4c6('0x6')],this[_0xd4c6('0x5')][_0xd4c6('0x15')]);util[_0xd4c6('0x19')](this[_0xd4c6('0x1a')],this[_0xd4c6('0x5')]['id'],this['realtime']['agents'][this[_0xd4c6('0x6')]['id']],null,this[_0xd4c6('0x4')]);util['writeLog'](this[_0xd4c6('0x5')]['id'],this[_0xd4c6('0x11')][_0xd4c6('0x12')][this['agent']['id']],_0xd4c6('0x1b')+(this[_0xd4c6('0x4')]['forcedOwnership']?_0xd4c6('0x1c'):''));}else{logger[_0xd4c6('0xf')](_0xd4c6('0x1d'),this['squeue']['id'],this[_0xd4c6('0x6')]['id']);setTimeout(this[_0xd4c6('0x7')][_0xd4c6('0x8')](this),0x3e8);}}};Agent[_0xd4c6('0xd')][_0xd4c6('0x9')]=function(_0x160330){if(_[_0xd4c6('0x10')](this[_0xd4c6('0x11')][_0xd4c6('0x12')][this[_0xd4c6('0x6')]['id']])){return logger[_0xd4c6('0xf')](_0xd4c6('0x13'),this[_0xd4c6('0x5')]['id'],this[_0xd4c6('0x6')]['id']);}else{logger['debug'](_0xd4c6('0x1e'),this[_0xd4c6('0x5')]['id'],this[_0xd4c6('0x6')]['id']);util[_0xd4c6('0x1f')](this['notificationId'],this['squeue']['id'],this['realtime'][_0xd4c6('0x12')][this[_0xd4c6('0x6')]['id']],null,this[_0xd4c6('0x4')]);this[_0xd4c6('0x11')][_0xd4c6('0x12')][this[_0xd4c6('0x6')]['id']][_0xd4c6('0x16')]=![];this['realtime'][_0xd4c6('0x12')][this[_0xd4c6('0x6')]['id']][_0xd4c6('0x17')]=undefined;util['removeWaitingNotification'](this[_0xd4c6('0x11')],this[_0xd4c6('0x4')],this[_0xd4c6('0x6')],this['squeue'][_0xd4c6('0x15')]);util[_0xd4c6('0x20')](this[_0xd4c6('0x5')]['id'],this[_0xd4c6('0x11')]['agents'][this[_0xd4c6('0x6')]['id']],_0x160330?_0xd4c6('0x21'):_0xd4c6('0x22'));}if(!_0x160330){setTimeout(this[_0xd4c6('0x7')][_0xd4c6('0x8')](this),0x3e8);}};function agent(_0x57594f,_0x211753,_0x1b60e5,_0xdcd5fc){return new Agent(_0x57594f,_0x211753,_0x1b60e5,_0xdcd5fc);}module[_0xd4c6('0x23')]=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 3ea468f..cf0f181 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 _0x6df8=['handleRun','handleTimeout','bind','timeout','drained','handleDrained','prototype','isNil','queue','Agents','length','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','agents','RINGING','busy','busyQueue','saveWaitingNotification','channel','showNotification','debug','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','writeLog','STOP','TIMEOUT','exports','lodash','./util','../../../../../config/logger','routing','notificationId','squeue','realtime','push'];(function(_0x126006,_0x29d087){var _0x4df414=function(_0xf90add){while(--_0xf90add){_0x126006['push'](_0x126006['shift']());}};_0x4df414(++_0x29d087);}(_0x6df8,0x14c));var _0x86df=function(_0x1ad5e1,_0x60873c){_0x1ad5e1=_0x1ad5e1-0x0;var _0x4f8b21=_0x6df8[_0x1ad5e1];return _0x4f8b21;};'use strict';var _=require(_0x86df('0x0'));var uuid=require('uuid');var util=require(_0x86df('0x1'));var logger=require(_0x86df('0x2'))(_0x86df('0x3'));var Beepall=function(_0x34e485,_0x430d51,_0x176cc7,_0x50224c){this[_0x86df('0x4')]=uuid['v4']();this[_0x86df('0x5')]=_0x34e485;this['queue']=_0x430d51;this[_0x86df('0x6')]=_0x176cc7;this[_0x86df('0x3')]=_0x50224c;this[_0x86df('0x5')][_0x86df('0x7')](this[_0x86df('0x8')]['bind'](this),this[_0x86df('0x9')][_0x86df('0xa')](this));this['squeue']['on'](_0x86df('0xb'),this['handleTimeout'][_0x86df('0xa')](this));this['squeue']['on'](_0x86df('0xc'),this[_0x86df('0xd')]['bind'](this));};Beepall[_0x86df('0xe')][_0x86df('0x7')]=function(){this[_0x86df('0x5')][_0x86df('0x7')](this[_0x86df('0x8')][_0x86df('0xa')](this),this[_0x86df('0x9')][_0x86df('0xa')](this));};Beepall[_0x86df('0xe')][_0x86df('0xd')]=function(){this[_0x86df('0x9')](!![]);};Beepall['prototype'][_0x86df('0x8')]=function(){var _0x50caf2=!![];if(!_[_0x86df('0xf')](this[_0x86df('0x10')])&&!_[_0x86df('0xf')](this[_0x86df('0x10')][_0x86df('0x11')])&&this[_0x86df('0x10')]['Agents'][_0x86df('0x12')]>0x0){for(var _0x450319=0x0,_0x5e7038;_0x4503190x0){for(var _0x1577a7=0x0,_0x4a656d;_0x1577a70x0&&_0x5ead56[_0x1db5a4+_0x28b8('0x20')]>=_0x5ead56[_0x1db5a4+_0x28b8('0x1f')]){writeLog(_0x42c916,_0x5ead56,_0x1db5a4['toUpperCase']()+'\x20MAXCAPACITY');return![];}}return!![];};exports['showNotification']=function(_0x4a78b1,_0x59bf14,_0x5255f6,_0x40347a,_0x450d44){return sendNotification(!![],_0x4a78b1,_0x59bf14,_0x5255f6,_0x40347a,_0x450d44);};exports[_0x28b8('0x21')]=function(_0x25f720,_0x4fb317,_0x4eccfb,_0x2944e7,_0x21eb3c){return sendNotification(![],_0x25f720,_0x4fb317,_0x4eccfb,_0x2944e7,_0x21eb3c);};exports[_0x28b8('0x22')]=function(_0x3a1305,_0x3dad0c,_0x3fca0b){var _0x4d46c4=_0x3dad0c[_0x28b8('0x23')][_0x28b8('0x24')];if(!_0x4d46c4&&_0x3fca0b){_0x4d46c4=_0x3fca0b['id'];}var _0x4060ab=_['some'](_0x3a1305[_0x3dad0c[_0x28b8('0x25')]+_0x28b8('0x26')],function(_0x2ce9d3){var _0x5d60a3=_[_0x28b8('0x27')](_0x3dad0c[_0x28b8('0x25')])+_0x28b8('0x28');return _0x2ce9d3[_0x5d60a3]===_0x3dad0c['interaction']['id'];});if(!_0x4060ab&&_0x4d46c4){_0x4060ab=_[_0x28b8('0x29')](_0x3a1305[_0x28b8('0x2a')][_0x4d46c4][_0x3dad0c[_0x28b8('0x25')]+_0x28b8('0x2b')],function(_0x304290){return _0x304290['id']===_0x3dad0c[_0x28b8('0x23')]['id'];});}return _0x4060ab;};exports[_0x28b8('0x2c')]=function(_0xf65311,_0xc1dd64,_0x9f2e20,_0x5a0748){_0xf65311[_0x28b8('0x2a')][_0x9f2e20['id']][_0x5a0748+'WaitingInteractions'][_0xc1dd64[_0x28b8('0x12')]['id']]={'id':_0xc1dd64[_0x28b8('0x23')]['id']};};exports[_0x28b8('0x2d')]=function(_0x4225ba,_0x1cd291,_0x1a2bd2,_0x116818){delete _0x4225ba['agents'][_0x1a2bd2['id']][_0x116818+'WaitingInteractions'][_0x1cd291['message']['id']];};exports[_0x28b8('0x2e')]=writeLog; \ No newline at end of file +var _0xd834=['interaction','agents','WaitingInteractions','removeWaitingNotification','lodash','util','../utils','ioredis','../../../../../config/logger','routing','redis','defaults','localhost','socket.io-emitter','user:%s','name','split','\x20interaction','notificationSound','account','notificationShake','body','msg','getMustacheRender','notificationTemplate','I\x20can\x27t\x20render\x20your\x20template','error','[%s][QUEUE]\x20%s','message','format','emit','notification:%s','save','debug','[%s][QUEUE][AGENT:%s][STATUS:%s]','isAgentAvailable','busy','BUSY','online','OFFLINE','Pause','PAUSE','hasOwnProperty','Capacity','CurrentCapacity','toUpperCase','\x20MAXCAPACITY','showNotification','UserId','channel','QueuesWaitingInteractions','capitalize','InteractionId'];(function(_0x58ab9e,_0x295c3b){var _0x20427d=function(_0x543cd6){while(--_0x543cd6){_0x58ab9e['push'](_0x58ab9e['shift']());}};_0x20427d(++_0x295c3b);}(_0xd834,0x1e1));var _0x4d83=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xd834[_0x167cc1];return _0x10bc4b;};'use strict';var _=require(_0x4d83('0x0'));var util=require(_0x4d83('0x1'));var utils=require(_0x4d83('0x2'));var Redis=require(_0x4d83('0x3'));var config=require('../../../../../config/environment');var logger=require(_0x4d83('0x4'))(_0x4d83('0x5'));config[_0x4d83('0x6')]=_[_0x4d83('0x7')](config[_0x4d83('0x6')],{'host':_0x4d83('0x8'),'port':0x18eb});var io=require(_0x4d83('0x9'))(new Redis(config['redis']));function sendNotification(_0x4278c6,_0x12a0c5,_0x467b30,_0x4375b8,_0x47494c,_0x29e237){io['to'](util['format'](_0x4d83('0xa'),_0x4375b8[_0x4d83('0xb')]))['emit']('user:save',_0x4375b8);var _0xac4166=_0x29e237||{};var _0x3adde7=_0x467b30[_0x4d83('0xc')]('.');var _0x54b9aa={'uniqueid':_0x12a0c5,'channel':_0x3adde7[0x0],'id':_0x3adde7[0x1],'title':_0x3adde7[0x0]+_0x4d83('0xd'),'interactionId':_0x3adde7[0x2],'queue':_0x47494c?_0x47494c[_0x4d83('0xb')]:null,'sound':_0xac4166['account'][_0x4d83('0xe')],'shake':_0xac4166[_0x4d83('0xf')][_0x4d83('0x10')]};try{if(!_0xac4166[_0x4d83('0x11')]){_0xac4166[_0x4d83('0x11')]={};}if(_0x47494c){_0xac4166['body']['queue']=_0x47494c;}else if(_0xac4166['body']['queue']){delete _0xac4166[_0x4d83('0x11')]['queue'];}_0x54b9aa[_0x4d83('0x12')]=utils[_0x4d83('0x13')](_0xac4166['account'][_0x4d83('0x14')],_0xac4166);}catch(_0x47bd1c){_0x54b9aa['msg']=_0x4d83('0x15');logger[_0x4d83('0x16')](util['format'](_0x4d83('0x17'),_0x12a0c5,_0x47bd1c[_0x4d83('0x18')]));}io['to'](util[_0x4d83('0x19')](_0x4d83('0xa'),_0x4375b8[_0x4d83('0xb')]))[_0x4d83('0x1a')](util[_0x4d83('0x19')](_0x4d83('0x1b'),_0x4278c6?_0x4d83('0x1c'):'remove'),_0x54b9aa);}function writeLog(_0x381227,_0x1b0b80,_0x2c424d){return logger[_0x4d83('0x1d')](util[_0x4d83('0x19')](_0x4d83('0x1e'),_0x381227,_0x1b0b80[_0x4d83('0xb')],_0x2c424d));}exports[_0x4d83('0x1f')]=function(_0x4ce2f8,_0x58dc65,_0x244529,_0x235fc1){if(_0x58dc65[_0x4d83('0x20')]){writeLog(_0x4ce2f8,_0x58dc65,_0x4d83('0x21'));return![];}if(!_0x58dc65[_0x4d83('0x22')]){writeLog(_0x4ce2f8,_0x58dc65,_0x4d83('0x23'));return![];}if(_0x58dc65[_0x244529+_0x4d83('0x24')]){writeLog(_0x4ce2f8,_0x58dc65,_0x4d83('0x25'));return![];}if(_0x235fc1&&_0x58dc65[_0x4d83('0x26')](_0x244529+_0x4d83('0x27'))&&_0x58dc65[_0x4d83('0x26')](_0x244529+_0x4d83('0x28'))){if(_0x58dc65[_0x244529+_0x4d83('0x27')]>0x0&&_0x58dc65[_0x244529+_0x4d83('0x28')]>=_0x58dc65[_0x244529+'Capacity']){writeLog(_0x4ce2f8,_0x58dc65,_0x244529[_0x4d83('0x29')]()+_0x4d83('0x2a'));return![];}}return!![];};exports[_0x4d83('0x2b')]=function(_0x1d1ed8,_0x330e5c,_0x55ea96,_0x142de5,_0x4915d0){return sendNotification(!![],_0x1d1ed8,_0x330e5c,_0x55ea96,_0x142de5,_0x4915d0);};exports['hideNotification']=function(_0x37f370,_0x44e498,_0x5a3f03,_0x4b051a,_0xf6037){return sendNotification(![],_0x37f370,_0x44e498,_0x5a3f03,_0x4b051a,_0xf6037);};exports['checkWaitingNotifications']=function(_0x4045f7,_0x37ecb7,_0x46b220){var _0x585d1b=_0x37ecb7['interaction'][_0x4d83('0x2c')];if(!_0x585d1b&&_0x46b220){_0x585d1b=_0x46b220['id'];}var _0x7efbea=_['some'](_0x4045f7[_0x37ecb7[_0x4d83('0x2d')]+_0x4d83('0x2e')],function(_0x5b6a11){var _0x3bd43f=_[_0x4d83('0x2f')](_0x37ecb7[_0x4d83('0x2d')])+_0x4d83('0x30');return _0x5b6a11[_0x3bd43f]===_0x37ecb7[_0x4d83('0x31')]['id'];});if(!_0x7efbea&&_0x585d1b){_0x7efbea=_['some'](_0x4045f7[_0x4d83('0x32')][_0x585d1b][_0x37ecb7[_0x4d83('0x2d')]+'WaitingInteractions'],function(_0x2760f9){return _0x2760f9['id']===_0x37ecb7[_0x4d83('0x31')]['id'];});}return _0x7efbea;};exports['saveWaitingNotification']=function(_0x2f4bf0,_0x5c1be9,_0x39e1d8,_0x4c6101){_0x2f4bf0[_0x4d83('0x32')][_0x39e1d8['id']][_0x4c6101+_0x4d83('0x33')][_0x5c1be9[_0x4d83('0x18')]['id']]={'id':_0x5c1be9[_0x4d83('0x31')]['id']};};exports[_0x4d83('0x34')]=function(_0x545c89,_0x215e25,_0x2bef66,_0x5b5467){delete _0x545c89['agents'][_0x2bef66['id']][_0x5b5467+'WaitingInteractions'][_0x215e25[_0x4d83('0x18')]['id']];};exports['writeLog']=writeLog; \ No newline at end of file diff --git a/server/services/routing/server/applications/system.js b/server/services/routing/server/applications/system.js index 9f41ee4..e58e0c8 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 _0x0e9f=['info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim','replace','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','next','isObject','stringify','validate','shelljs','../../../../config/logger','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','length','error','[%s][SYSTEM]\x20%s','join'];(function(_0x5e34ad,_0x1cd61a){var _0x10b398=function(_0x500fab){while(--_0x500fab){_0x5e34ad['push'](_0x5e34ad['shift']());}};_0x10b398(++_0x1cd61a);}(_0x0e9f,0x116));var _0xf0e9=function(_0x1a75f6,_0x4cf8aa){_0x1a75f6=_0x1a75f6-0x0;var _0x48f6e1=_0x0e9f[_0x1a75f6];return _0x48f6e1;};'use strict';var schema=require(_0xf0e9('0x0'));var sh=require(_0xf0e9('0x1'));var _=require('lodash');var utils=require('./utils');var logger=require(_0xf0e9('0x2'))('routing');var system=schema({'command':{'type':'string','required':!![],'message':_0xf0e9('0x3')}});exports['consequence']=function(_0x52a19d,_0x159a42){return function(_0x192b21){try{var _0x59ac7e={'command':_0x159a42[0x0]};var _0x2322dc=system['validate'](_0x59ac7e,{'typecast':!![]});if(_0x2322dc[_0xf0e9('0x4')]){logger[_0xf0e9('0x5')](_0xf0e9('0x6'),_0x52a19d,_['map'](_0x2322dc,'message')[_0xf0e9('0x7')](',\x20'));logger[_0xf0e9('0x8')](_0xf0e9('0x9'),_0x52a19d);_0x192b21['next']();}else{var _0x3cbdd8=this;var _0x3c498e=utils[_0xf0e9('0xa')](_0x159a42[0x0],this);logger['info'](_0xf0e9('0xb'),_0x52a19d,_0x3c498e);sh[_0xf0e9('0xc')](_[_0xf0e9('0xd')](_0x3c498e),function(_0xf7f02e,_0x5546af){logger[_0xf0e9('0x8')]('[%s][SYSTEM]\x20result\x20code:\x20%s',_0x52a19d,_0xf7f02e);if(_0xf7f02e==0x0){var _0x1461af=_0x5546af[_0xf0e9('0xe')](/(\r\n|\n|\r)/gm,'');if(_['isNil'](_0x159a42[0x1])||_[_0xf0e9('0xf')](_0x159a42[0x1])){logger[_0xf0e9('0x8')](_0xf0e9('0x10'),_0x52a19d);_0x3cbdd8[_0xf0e9('0x11')][_0x159a42[0x1]]=_0x1461af;}else{logger[_0xf0e9('0x8')](_0xf0e9('0x12'),_0x52a19d,_0x159a42[0x1],_0x1461af);_0x3cbdd8['body'][_0x159a42[0x1]]=_0x1461af;}}_0x192b21[_0xf0e9('0x13')]();});}}catch(_0x1eb36f){logger['error'](_0xf0e9('0x6'),_0x52a19d,_[_0xf0e9('0x14')](_0x1eb36f)?JSON[_0xf0e9('0x15')](_0x1eb36f):_0x1eb36f);logger[_0xf0e9('0x8')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x52a19d);_0x192b21[_0xf0e9('0x13')]();}};}; \ No newline at end of file +var _0x301d=['[%s][SYSTEM]\x20no\x20variable','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','body','next','isObject','validate','shelljs','lodash','./utils','../../../../config/logger','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][SYSTEM]\x20%s','map','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil'];(function(_0x440030,_0xaeec43){var _0x40d6b4=function(_0x5eb186){while(--_0x5eb186){_0x440030['push'](_0x440030['shift']());}};_0x40d6b4(++_0xaeec43);}(_0x301d,0xe6));var _0xd301=function(_0x438a1e,_0x1921b3){_0x438a1e=_0x438a1e-0x0;var _0x56e4ae=_0x301d[_0x438a1e];return _0x56e4ae;};'use strict';var schema=require(_0xd301('0x0'));var sh=require(_0xd301('0x1'));var _=require(_0xd301('0x2'));var utils=require(_0xd301('0x3'));var logger=require(_0xd301('0x4'))('routing');var system=schema({'command':{'type':'string','required':!![],'message':_0xd301('0x5')}});exports[_0xd301('0x6')]=function(_0x1387da,_0xaf31dd){return function(_0x40a5f1){try{var _0x43ec72={'command':_0xaf31dd[0x0]};var _0x58e879=system[_0xd301('0x0')](_0x43ec72,{'typecast':!![]});if(_0x58e879[_0xd301('0x7')]){logger[_0xd301('0x8')](_0xd301('0x9'),_0x1387da,_[_0xd301('0xa')](_0x58e879,'message')[_0xd301('0xb')](',\x20'));logger[_0xd301('0xc')](_0xd301('0xd'),_0x1387da);_0x40a5f1['next']();}else{var _0x266056=this;var _0x471308=utils['getMustacheRender'](_0xaf31dd[0x0],this);logger[_0xd301('0xc')](_0xd301('0xe'),_0x1387da,_0x471308);sh[_0xd301('0xf')](_[_0xd301('0x10')](_0x471308),function(_0x11f0bf,_0x2a78ca){logger[_0xd301('0xc')](_0xd301('0x11'),_0x1387da,_0x11f0bf);if(_0x11f0bf==0x0){var _0x16e211=_0x2a78ca[_0xd301('0x12')](/(\r\n|\n|\r)/gm,'');if(_[_0xd301('0x13')](_0xaf31dd[0x1])||_['isEmpty'](_0xaf31dd[0x1])){logger[_0xd301('0xc')](_0xd301('0x14'),_0x1387da);_0x266056['body'][_0xaf31dd[0x1]]=_0x16e211;}else{logger[_0xd301('0xc')](_0xd301('0x15'),_0x1387da,_0xaf31dd[0x1],_0x16e211);_0x266056[_0xd301('0x16')][_0xaf31dd[0x1]]=_0x16e211;}}_0x40a5f1[_0xd301('0x17')]();});}}catch(_0x4d6ef0){logger[_0xd301('0x8')]('[%s][SYSTEM]\x20%s',_0x1387da,_[_0xd301('0x18')](_0x4d6ef0)?JSON['stringify'](_0x4d6ef0):_0x4d6ef0);logger['info']('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x1387da);_0x40a5f1[_0xd301('0x17')]();}};}; \ 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 343abbe..6d87844 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 _0xcd67=['[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','finally','isObject','lodash','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/whatsappInteraction','../../../../config/logger','routing','consequence','length','[%s][TAG]\x20%s','map','message','info','next','channel','Interaction','addTags','interaction','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','error','stringify'];(function(_0xdbcc51,_0x548c62){var _0x12c5aa=function(_0x9195b1){while(--_0x9195b1){_0xdbcc51['push'](_0xdbcc51['shift']());}};_0x12c5aa(++_0x548c62);}(_0xcd67,0xb2));var _0x7cd6=function(_0xc2a963,_0xe3799){_0xc2a963=_0xc2a963-0x0;var _0x494a75=_0xcd67[_0xc2a963];return _0x494a75;};'use strict';var schema=require('validate');var _=require(_0x7cd6('0x0'));var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0x7cd6('0x1')),'smsInteraction':require(_0x7cd6('0x2')),'mailInteraction':require(_0x7cd6('0x3')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0x7cd6('0x4'))};var logger=require(_0x7cd6('0x5'))(_0x7cd6('0x6'));var tag=schema({'tag':{'type':'number','required':!![],'message':'TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0x7cd6('0x7')]=function(_0x157e18,_0x3ddc83,_0x39bf09,_0x36d59b){return function(_0x230140){try{var _0x3d6a45={'tag':_0x3ddc83[0x0]};var _0x45c51e=tag['validate'](_0x3d6a45,{'typecast':!![]});if(_0x45c51e[_0x7cd6('0x8')]){logger['error'](_0x7cd6('0x9'),_0x157e18,_[_0x7cd6('0xa')](_0x45c51e,_0x7cd6('0xb'))['join'](',\x20'));logger[_0x7cd6('0xc')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x157e18);_0x230140[_0x7cd6('0xd')]();}else{var _0x3cffad={'ids':[_0x3ddc83[0x0]]};if(rpc[_0x36d59b[_0x7cd6('0xe')]+_0x7cd6('0xf')]){rpc[_0x36d59b[_0x7cd6('0xe')]+_0x7cd6('0xf')][_0x7cd6('0x10')](_0x36d59b[_0x7cd6('0x11')]['id'],_0x3cffad)['then'](function(_0x44c015){logger[_0x7cd6('0xc')](_0x7cd6('0x12'),_0x157e18,_0x3ddc83[0x1],_0x36d59b[_0x7cd6('0xe')],_0x36d59b[_0x7cd6('0x11')]['id']);})[_0x7cd6('0x13')](function(_0xb824c){logger[_0x7cd6('0x14')](_0x7cd6('0x9'),_0x157e18,JSON[_0x7cd6('0x15')](_0xb824c));logger[_0x7cd6('0xc')](_0x7cd6('0x16'),_0x157e18);})[_0x7cd6('0x17')](function(){_0x230140[_0x7cd6('0xd')]();});}}}catch(_0x35c553){logger[_0x7cd6('0x14')]('[%s][TAG]\x20%s',_0x157e18,_[_0x7cd6('0x18')](_0x35c553)?JSON[_0x7cd6('0x15')](_0x35c553):_0x35c553);logger[_0x7cd6('0xc')](_0x7cd6('0x16'),_0x157e18);_0x230140['next']();}};}; \ No newline at end of file +var _0xf115=['[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel','Interaction','addTags','interaction','then','catch','error','finally','stringify','validate','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/whatsappInteraction','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','[%s][TAG]\x20%s','message','join','info'];(function(_0x397581,_0x566b8b){var _0x350f0f=function(_0x168ca2){while(--_0x168ca2){_0x397581['push'](_0x397581['shift']());}};_0x350f0f(++_0x566b8b);}(_0xf115,0x88));var _0x5f11=function(_0x5ab9e7,_0x5f2f6b){_0x5ab9e7=_0x5ab9e7-0x0;var _0x171720=_0xf115[_0x5ab9e7];return _0x171720;};'use strict';var schema=require(_0x5f11('0x0'));var _=require(_0x5f11('0x1'));var rpc={'chatInteraction':require(_0x5f11('0x2')),'openchannelInteraction':require(_0x5f11('0x3')),'smsInteraction':require(_0x5f11('0x4')),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0x5f11('0x5'))};var logger=require('../../../../config/logger')('routing');var tag=schema({'tag':{'type':_0x5f11('0x6'),'required':!![],'message':_0x5f11('0x7')}});exports[_0x5f11('0x8')]=function(_0x11dc38,_0x57fb35,_0x3c76b9,_0x3fa382){return function(_0x738fce){try{var _0xe33002={'tag':_0x57fb35[0x0]};var _0x33a354=tag[_0x5f11('0x0')](_0xe33002,{'typecast':!![]});if(_0x33a354[_0x5f11('0x9')]){logger['error'](_0x5f11('0xa'),_0x11dc38,_['map'](_0x33a354,_0x5f11('0xb'))[_0x5f11('0xc')](',\x20'));logger[_0x5f11('0xd')](_0x5f11('0xe'),_0x11dc38);_0x738fce[_0x5f11('0xf')]();}else{var _0x592260={'ids':[_0x57fb35[0x0]]};if(rpc[_0x3fa382[_0x5f11('0x10')]+_0x5f11('0x11')]){rpc[_0x3fa382[_0x5f11('0x10')]+_0x5f11('0x11')][_0x5f11('0x12')](_0x3fa382[_0x5f11('0x13')]['id'],_0x592260)[_0x5f11('0x14')](function(_0x5e5d34){logger[_0x5f11('0xd')]('[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s',_0x11dc38,_0x57fb35[0x1],_0x3fa382[_0x5f11('0x10')],_0x3fa382['interaction']['id']);})[_0x5f11('0x15')](function(_0x54e1fd){logger[_0x5f11('0x16')](_0x5f11('0xa'),_0x11dc38,JSON['stringify'](_0x54e1fd));logger[_0x5f11('0xd')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x11dc38);})[_0x5f11('0x17')](function(){_0x738fce[_0x5f11('0xf')]();});}}}catch(_0x2c694e){logger[_0x5f11('0x16')]('[%s][TAG]\x20%s',_0x11dc38,_['isObject'](_0x2c694e)?JSON[_0x5f11('0x18')](_0x2c694e):_0x2c694e);logger[_0x5f11('0xd')](_0x5f11('0xe'),_0x11dc38);_0x738fce[_0x5f11('0xf')]();}};}; \ 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 0a3f9b8..ab5af7f 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 _0x821c=['[%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','request-promise','routing','lodash','consequence','\x20-\x20','replace','urlOnAnswer','?params=','urlOnRing','title','jsonrpc','method','push','stringify','utf8','POST','parse','result','&sessionId=','&data=','then','info'];(function(_0x413291,_0x25b7e8){var _0x4d5737=function(_0x54fd9c){while(--_0x54fd9c){_0x413291['push'](_0x413291['shift']());}};_0x4d5737(++_0x25b7e8);}(_0x821c,0x1f4));var _0xc821=function(_0x38f879,_0xea1f1c){_0x38f879=_0x38f879-0x0;var _0x2faa08=_0x821c[_0x38f879];return _0x2faa08;};'use strict';var rp=require(_0xc821('0x0'));var logger=require('../../../../config/logger')(_0xc821('0x1'));var _=require(_0xc821('0x2'));var arr=[];exports[_0xc821('0x3')]=function(_0x17ca55,_0x470628){return function(_0x50969c){var _0x5a71ed=_0x470628[0xa];var _0x1bc373=_0x470628[0xb];var _0x423938=_0x470628[0xc];var _0x25c687=_0x470628[0xd];var _0x331ff5=_0x470628[0xe];var _0x254a10=_0x470628[0xf]['replace'](/\n/g,_0xc821('0x4'));var _0x2c77e8=_0x470628[0x10][_0xc821('0x5')](/\n/g,'\x20');if(!arr['includes'](_0x1bc373)){arr['push'](_0x1bc373);var _0x4c7763=_0x470628[0x3];var _0x19cca1=_0x470628[0x4];var _0x5dd5a9=_0x470628[0x1];var _0x25cf51=_0x470628[0x0];var _0x564a9c={};_0x564a9c[_0xc821('0x6')]=_0x470628[0x8]+_0xc821('0x7')+_0x423938+'|'+_0x5a71ed+'|'+_0x25c687+'|'+_0x1bc373+'|'+_0x331ff5;_0x564a9c[_0xc821('0x8')]=_0x470628[0x7]+_0xc821('0x7')+_0x423938+'|'+_0x5a71ed+'|'+_0x25c687+'|'+_0x1bc373+'|'+_0x331ff5+'|'+_0x254a10+'|'+_0x2c77e8;_0x564a9c[_0xc821('0x9')]=_0x470628[0x9];var _0x17ada2={};_0x17ada2[_0xc821('0xa')]='2.0';_0x17ada2[_0xc821('0xb')]='login';var _0x57408d=[];_0x57408d[_0xc821('0xc')](_0x470628[0x2]);_0x57408d[_0xc821('0xc')](_0x470628[0x5]);_0x57408d[_0xc821('0xc')](_0x470628[0x6]);_0x17ada2['params']=_0x57408d;_0x17ada2['id']=0x1;var _0x4c5feb=JSON[_0xc821('0xd')](_0x17ada2);var _0x43f9a9={'encoding':_0xc821('0xe'),'method':_0xc821('0xf'),'timeout':0x2710,'url':_0x4c7763,'headers':{'Content-Type':'application/json-rpc'},'body':_0x4c5feb};return rp(_0x43f9a9)['then'](function(_0x1e0322){const _0x376036=JSON[_0xc821('0x10')](_0x1e0322);if(!_0x376036[_0xc821('0x11')]['logged']){throw new Error('Unable\x20to\x20login\x20with\x20TVox\x20application');}var _0x23946c=_0x1bc373;var _0x27fa74='channelId='+_0x5dd5a9+'&serviceId='+_0x25cf51+_0xc821('0x12')+_0x23946c+_0xc821('0x13')+JSON[_0xc821('0xd')](_0x564a9c);var _0x1690cf=_0x19cca1+'?'+_0x27fa74;return rp(_0x1690cf);})[_0xc821('0x14')](function(_0x41e4f3){logger[_0xc821('0x15')](_0xc821('0x16'),_0x17ca55,_0x41e4f3);_0x50969c[_0xc821('0x17')]();})[_0xc821('0x18')](function(_0x1bdd93){logger[_0xc821('0x19')](_0xc821('0x1a'),_0x17ca55,_[_0xc821('0x1b')](_0x1bdd93)?JSON[_0xc821('0xd')](_0x1bdd93):_0x1bdd93);_0x50969c[_0xc821('0x17')]();});}else{logger[_0xc821('0x15')](_0xc821('0x1c'),_0x17ca55);_0x50969c['next']();}};}; \ No newline at end of file +var _0x49b0=['next','request-promise','../../../../config/logger','lodash','consequence','replace','\x20-\x20','push','?params=','urlOnRing','title','jsonrpc','2.0','method','params','stringify','POST','application/json-rpc','then','parse','result','logged','channelId=','&serviceId=','&sessionId=','&data=','info','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','stop','error','isObject','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next'];(function(_0x2a3c0a,_0x163f5c){var _0x1703a2=function(_0x471dfe){while(--_0x471dfe){_0x2a3c0a['push'](_0x2a3c0a['shift']());}};_0x1703a2(++_0x163f5c);}(_0x49b0,0x1a1));var _0x049b=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x49b0[_0x4565bf];return _0x5610ba;};'use strict';var rp=require(_0x049b('0x0'));var logger=require(_0x049b('0x1'))('routing');var _=require(_0x049b('0x2'));var arr=[];exports[_0x049b('0x3')]=function(_0x44207c,_0x3e3933){return function(_0xe2950f){var _0xdeb102=_0x3e3933[0xa];var _0x279e41=_0x3e3933[0xb];var _0x3b5e17=_0x3e3933[0xc];var _0x3b7e95=_0x3e3933[0xd];var _0x6c01d1=_0x3e3933[0xe];var _0x3cc137=_0x3e3933[0xf][_0x049b('0x4')](/\n/g,_0x049b('0x5'));var _0x3c6384=_0x3e3933[0x10][_0x049b('0x4')](/\n/g,'\x20');if(!arr['includes'](_0x279e41)){arr[_0x049b('0x6')](_0x279e41);var _0x51269e=_0x3e3933[0x3];var _0x24ce91=_0x3e3933[0x4];var _0x5e4127=_0x3e3933[0x1];var _0x290613=_0x3e3933[0x0];var _0x4efa49={};_0x4efa49['urlOnAnswer']=_0x3e3933[0x8]+_0x049b('0x7')+_0x3b5e17+'|'+_0xdeb102+'|'+_0x3b7e95+'|'+_0x279e41+'|'+_0x6c01d1;_0x4efa49[_0x049b('0x8')]=_0x3e3933[0x7]+'?params='+_0x3b5e17+'|'+_0xdeb102+'|'+_0x3b7e95+'|'+_0x279e41+'|'+_0x6c01d1+'|'+_0x3cc137+'|'+_0x3c6384;_0x4efa49[_0x049b('0x9')]=_0x3e3933[0x9];var _0x3af2a1={};_0x3af2a1[_0x049b('0xa')]=_0x049b('0xb');_0x3af2a1[_0x049b('0xc')]='login';var _0x286833=[];_0x286833[_0x049b('0x6')](_0x3e3933[0x2]);_0x286833[_0x049b('0x6')](_0x3e3933[0x5]);_0x286833[_0x049b('0x6')](_0x3e3933[0x6]);_0x3af2a1[_0x049b('0xd')]=_0x286833;_0x3af2a1['id']=0x1;var _0x252066=JSON[_0x049b('0xe')](_0x3af2a1);var _0x34b6c4={'encoding':'utf8','method':_0x049b('0xf'),'timeout':0x2710,'url':_0x51269e,'headers':{'Content-Type':_0x049b('0x10')},'body':_0x252066};return rp(_0x34b6c4)[_0x049b('0x11')](function(_0x4fa3df){const _0x18ebf4=JSON[_0x049b('0x12')](_0x4fa3df);if(!_0x18ebf4[_0x049b('0x13')][_0x049b('0x14')]){throw new Error('Unable\x20to\x20login\x20with\x20TVox\x20application');}var _0x9accea=_0x279e41;var _0x4fdba2=_0x049b('0x15')+_0x5e4127+_0x049b('0x16')+_0x290613+_0x049b('0x17')+_0x9accea+_0x049b('0x18')+JSON[_0x049b('0xe')](_0x4efa49);var _0xdda537=_0x24ce91+'?'+_0x4fdba2;return rp(_0xdda537);})[_0x049b('0x11')](function(_0x3e3c09){logger[_0x049b('0x19')](_0x049b('0x1a'),_0x44207c,_0x3e3c09);_0xe2950f[_0x049b('0x1b')]();})['catch'](function(_0x1c67ce){logger[_0x049b('0x1c')]('[%s][TVOX]\x20%s',_0x44207c,_[_0x049b('0x1d')](_0x1c67ce)?JSON['stringify'](_0x1c67ce):_0x1c67ce);_0xe2950f[_0x049b('0x1b')]();});}else{logger[_0x049b('0x19')](_0x049b('0x1e'),_0x44207c);_0xe2950f[_0x049b('0x1f')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/utils.js b/server/services/routing/server/applications/utils.js index 976898c..dc8f435 100644 --- a/server/services/routing/server/applications/utils.js +++ b/server/services/routing/server/applications/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['message','account','interaction','mustache','lodash','exports','render','body','contact'];(function(_0x5d9d55,_0x4897e0){var _0x250840=function(_0xb80b86){while(--_0xb80b86){_0x5d9d55['push'](_0x5d9d55['shift']());}};_0x250840(++_0x4897e0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0xa9e0[_0x56482c];return _0x5aae7a;};'use strict';var Mustache=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'getMustacheRender':function(_0x5dd881,_0x550fbc){return Mustache[_0x0a9e('0x3')](_0x5dd881,_['merge'](_0x550fbc[_0x0a9e('0x4')],{'contact':_0x550fbc[_0x0a9e('0x5')],'message':_0x550fbc[_0x0a9e('0x6')],'account':_0x550fbc[_0x0a9e('0x7')],'interaction':_0x550fbc[_0x0a9e('0x8')],'list':_0x550fbc['list']}))||'';}}; \ No newline at end of file +var _0xa9e0=['message','account','interaction','mustache','lodash','exports','render','body','contact'];(function(_0xb1773a,_0x293eda){var _0x2c4edf=function(_0x3c73eb){while(--_0x3c73eb){_0xb1773a['push'](_0xb1773a['shift']());}};_0x2c4edf(++_0x293eda);}(_0xa9e0,0x123));var _0x0a9e=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0xa9e0[_0xa1e3e3];return _0xc980e9;};'use strict';var Mustache=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'getMustacheRender':function(_0x5dd881,_0x550fbc){return Mustache[_0x0a9e('0x3')](_0x5dd881,_['merge'](_0x550fbc[_0x0a9e('0x4')],{'contact':_0x550fbc[_0x0a9e('0x5')],'message':_0x550fbc[_0x0a9e('0x6')],'account':_0x550fbc[_0x0a9e('0x7')],'interaction':_0x550fbc[_0x0a9e('0x8')],'list':_0x550fbc['list']}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index 7f2d9f7..9daa845 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 _0x026d=['length','existsSync','join','app','toLowerCase','autoreply','appdata','split','push','slice','dialogflowv2','TagId','tvox','notificationTemplate','ChatWebsiteId','body','%s:%s:%s','./interval','condition','intervals','./applications/','consequence','info','Push\x20new\x20rule','on\x20interval','\x20|\x20','Please\x20create\x20a\x20new\x20file\x20under','execute','Applications\x20executed','stringify','emit','complete','No\x20applications\x20to\x20execute','error','agent','agents','busy','busyQueue','end','QueueReport','update','error\x20update\x20queue\x20report','stack','message\x20is\x20empty','capacity','hasOwnProperty','CurrentCapacity','agent\x20not\x20found','values','chatQueues','available','loggedIn','name','paused','waiting','mailQueues','openchannelQueues','smsQueues','faxQueues','whatsappQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','server','http','127.0.0.1','log','RPC\x20listening\x20on\x20port:','util','path','jayson/promise','bluebird','./applications/utils','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','%s.%s.%s','isNil','IntervalId','Intervals','interval','listen','rules','channel','message','interaction','checkWaitingNotifications','applications','isArray'];(function(_0x442edb,_0x4d0c49){var _0x274bbb=function(_0x4b4d5a){while(--_0x4b4d5a){_0x442edb['push'](_0x442edb['shift']());}};_0x274bbb(++_0x4d0c49);}(_0x026d,0x107));var _0xd026=function(_0x4d6dd3,_0x248af1){_0x4d6dd3=_0x4d6dd3-0x0;var _0x3bda74=_0x026d[_0x4d6dd3];return _0x3bda74;};'use strict';var _=require('lodash');var util=require(_0xd026('0x0'));var path=require(_0xd026('0x1'));var fs=require('fs');var jayson=require(_0xd026('0x2'));var BPromise=require(_0xd026('0x3'));var utils=require(_0xd026('0x4'));var sUtils=require('./applications/strategy/util');var logger=require(_0xd026('0x5'))(_0xd026('0x6'));var rpc={'openchannelQueueReport':require(_0xd026('0x7')),'mailQueueReport':require(_0xd026('0x8')),'chatQueueReport':require(_0xd026('0x9')),'smsQueueReport':require(_0xd026('0xa')),'faxQueueReport':require(_0xd026('0xb')),'whatsappQueueReport':require(_0xd026('0xc'))};var RuleEngine=require(_0xd026('0xd'));function getId(_0x34f32d,_0xe79b4b,_0x19cf07){return util[_0xd026('0xe')](_0xd026('0xf'),_0x34f32d,_0xe79b4b||0x0,_0x19cf07||0x0);}function getIntervals(_0x36c95c,_0x28cba5){var _0x204a59=[];if(!_[_0xd026('0x10')](_0x28cba5['IntervalId'])&&!_[_0xd026('0x10')](_0x36c95c[_0x28cba5['IntervalId']])&&!_[_0xd026('0x10')](_0x36c95c[_0x28cba5[_0xd026('0x11')]][_0xd026('0x12')])){_0x204a59=_['map'](_0x36c95c[_0x28cba5[_0xd026('0x11')]][_0xd026('0x12')],'interval');}else if(!_[_0xd026('0x10')](_0x28cba5[_0xd026('0x13')])){_0x204a59=[_0x28cba5['interval']];}return _0x204a59;}exports[_0xd026('0x14')]=function(_0x144724){_0x144724[_0xd026('0x15')]={};return new BPromise(function(_0x3c83b2,_0x3029c7){var _0xf36821={'Start':function(_0x2fb1b9){var _0x16a64a=this;return new Promise(function(_0x14b50b,_0x221baf){if(_0x2fb1b9){try{var _0x55e1d2=[];var _0x3685e7=getId(_0x2fb1b9[_0xd026('0x16')],_0x2fb1b9[_0xd026('0x17')]?_0x2fb1b9['message']['id']:0x0,_0x2fb1b9[_0xd026('0x18')]?_0x2fb1b9['interaction']['id']:0x0);var _0x51c64d=sUtils[_0xd026('0x19')](_0x144724,_0x2fb1b9);if(!_0x51c64d&&_0x2fb1b9[_0xd026('0x1a')]&&_[_0xd026('0x1b')](_0x2fb1b9[_0xd026('0x1a')])&&_0x2fb1b9['applications'][_0xd026('0x1c')]){for(var _0x314ac9=0x0;_0x314ac9<_0x2fb1b9[_0xd026('0x1a')]['length'];_0x314ac9+=0x1){var _0x18cd2e=_0x2fb1b9[_0xd026('0x1a')][_0x314ac9];if(fs[_0xd026('0x1d')](path[_0xd026('0x1e')](__dirname,_0xd026('0x1a'),_0x18cd2e[_0xd026('0x1f')]+'.js'))){var _0x17d8fa=[];switch(_0x18cd2e[_0xd026('0x1f')][_0xd026('0x20')]()){case _0xd026('0x21'):var _0x4cf8ac=_0x18cd2e[_0xd026('0x22')][_0xd026('0x23')](',');if(_0x2fb1b9[_0xd026('0x16')]==='mail'){_0x17d8fa['push'](_0x4cf8ac[0x0]);_0x17d8fa[_0xd026('0x24')](_0x4cf8ac[0x1]);_0x17d8fa[_0xd026('0x24')](_0x4cf8ac[_0xd026('0x25')](0x2,_0x4cf8ac[_0xd026('0x1c')])[_0xd026('0x1e')](','));}else{_0x17d8fa[_0xd026('0x24')](_0x4cf8ac[0x0]);_0x17d8fa[_0xd026('0x24')](_0x4cf8ac[_0xd026('0x25')](0x1,_0x4cf8ac[_0xd026('0x1c')])[_0xd026('0x1e')](','));}break;case'dialogflow':var _0x2b5eb4=_0x18cd2e[_0xd026('0x22')]['split'](',');_0x17d8fa[_0xd026('0x24')](_0x2b5eb4[0x0]);_0x17d8fa[_0xd026('0x24')](_0x2b5eb4[0x1]);_0x17d8fa[_0xd026('0x24')](_0x2b5eb4[_0xd026('0x25')](0x2,_0x2b5eb4[_0xd026('0x1c')])[_0xd026('0x1e')](','));break;case _0xd026('0x26'):var _0x5e9754=_0x18cd2e[_0xd026('0x22')][_0xd026('0x23')](',');_0x17d8fa[_0xd026('0x24')](_0x5e9754[0x0]);_0x17d8fa['push'](_0x5e9754[0x1]);_0x17d8fa['push'](_0x5e9754[0x2]);_0x17d8fa[_0xd026('0x24')](_0x5e9754[0x3]);_0x17d8fa[_0xd026('0x24')](_0x5e9754[_0xd026('0x25')](0x4,_0x5e9754['length'])[_0xd026('0x1e')](','));break;case'amazonlex':var _0x158044=_0x18cd2e[_0xd026('0x22')]['split'](',');_0x17d8fa[_0xd026('0x24')](_0x158044[0x0]);_0x17d8fa[_0xd026('0x24')](_0x158044[0x1]);_0x17d8fa['push'](_0x158044[0x2]);_0x17d8fa[_0xd026('0x24')](_0x158044[0x3]);_0x17d8fa[_0xd026('0x24')](_0x158044[_0xd026('0x25')](0x4,_0x158044[_0xd026('0x1c')])[_0xd026('0x1e')](','));break;case'message':_0x17d8fa['push'](_0x18cd2e[_0xd026('0x22')]);break;case'tag':_0x17d8fa['push'](_0x18cd2e[_0xd026('0x27')]);_0x17d8fa[_0xd026('0x24')](_0x18cd2e['appdata']);break;case _0xd026('0x28'):var _0x359fc9=utils['getMustacheRender'](_0x2fb1b9['account'][_0xd026('0x29')],_0x2fb1b9);var _0x5ac687=_0x18cd2e[_0xd026('0x22')][_0xd026('0x23')](',');_0x17d8fa[_0xd026('0x24')](_0x5ac687[0x0]);_0x17d8fa['push'](_0x5ac687[0x1]);_0x17d8fa[_0xd026('0x24')](_0x5ac687[0x2]);_0x17d8fa[_0xd026('0x24')](_0x5ac687[0x3]);_0x17d8fa[_0xd026('0x24')](_0x5ac687[0x4]);_0x17d8fa[_0xd026('0x24')](_0x5ac687[0x5]);_0x17d8fa[_0xd026('0x24')](_0x5ac687[0x6]);_0x17d8fa['push'](_0x5ac687[0x7]);_0x17d8fa[_0xd026('0x24')](_0x5ac687[0x8]);_0x17d8fa[_0xd026('0x24')](_0x5ac687[0x9]);_0x17d8fa[_0xd026('0x24')](_0x5ac687[0xa]);_0x17d8fa['push'](_0x2fb1b9['interaction']['id']);_0x17d8fa['push'](_0x2fb1b9[_0xd026('0x17')]['id']);_0x17d8fa['push'](_0x18cd2e[_0xd026('0x2a')]);_0x17d8fa[_0xd026('0x24')](_0x2fb1b9[_0xd026('0x18')]['ContactId']);_0x17d8fa['push'](_0x2fb1b9['body'][_0xd026('0x2b')]);_0x17d8fa[_0xd026('0x24')](_0x359fc9);break;default:_0x17d8fa=_[_0xd026('0x10')](_0x18cd2e[_0xd026('0x22')])?[]:_0x18cd2e[_0xd026('0x22')][_0xd026('0x23')](',');}var _0x36ef01={'id':util[_0xd026('0xe')](_0xd026('0x2c'),_0x3685e7,_0x18cd2e['id'],_0x18cd2e['app']),'condition':require(_0xd026('0x2d'))[_0xd026('0x2e')](_0x3685e7,getIntervals(_0x144724[_0xd026('0x2f')],_0x18cd2e),_0x144724),'consequence':require(_0xd026('0x30')+_0x18cd2e['app'])[_0xd026('0x31')](_0x3685e7,_0x17d8fa,_0x144724,_0x2fb1b9),'p':_0x18cd2e['priority']||0x0};logger[_0xd026('0x32')](_0xd026('0x33'),_0x36ef01['id'],_0xd026('0x34'),getIntervals(_0x144724['intervals'],_0x18cd2e)[_0xd026('0x1e')](_0xd026('0x35')));_0x55e1d2['push'](_0x36ef01);}else{logger['error'](_0xd026('0x36'),path[_0xd026('0x1e')](__dirname,_0xd026('0x1a'),_0x18cd2e[_0xd026('0x1f')]+'.js'));}}_0x144724[_0xd026('0x15')][_0x3685e7]=new RuleEngine(_0x55e1d2);_0x144724['rules'][_0x3685e7][_0xd026('0x37')](_0x2fb1b9,function(_0x39adb3){logger[_0xd026('0x32')](_0xd026('0x38'),JSON[_0xd026('0x39')](_0x39adb3['matchPath']));if(_0x144724[_0xd026('0x15')][_0x3685e7]){_0x144724['rules'][_0x3685e7][_0xd026('0x3a')](_0xd026('0x3b'));}});return _0x14b50b({'code':0xc8,'message':_0x2fb1b9});}else{if(_0x51c64d){logger[_0xd026('0x32')](util[_0xd026('0xe')]('Skipped\x20routing\x20for\x20%s',_0x3685e7));}else{logger[_0xd026('0x32')](_0xd026('0x3c'));}return _0x14b50b({'code':0xc8,'message':_0x2fb1b9});}}catch(_0x3d44f8){logger[_0xd026('0x3d')](_0x3d44f8['stack']);return _0x221baf(_0x16a64a['error'](0x1f4,_0x3d44f8));}}return _0x221baf('routing\x20is\x20empty');});},'AcceptMessage':function(_0x3b27e8){var _0x2fc5c8=this;return new Promise(function(_0x2ab010,_0x27dc27){if(_0x3b27e8[_0xd026('0x3e')]&&_0x3b27e8[_0xd026('0x3e')]['id']){if(_0x144724[_0xd026('0x3f')][_0x3b27e8[_0xd026('0x3e')]['id']]){_0x144724[_0xd026('0x3f')][_0x3b27e8['agent']['id']][_0xd026('0x40')]=![];_0x144724['agents'][_0x3b27e8[_0xd026('0x3e')]['id']][_0xd026('0x41')]=undefined;}}if(_0x3b27e8['message']&&_0x3b27e8[_0xd026('0x17')]['id']){try{var _0x59a076=getId(_0x3b27e8[_0xd026('0x16')],_0x3b27e8[_0xd026('0x17')]?_0x3b27e8[_0xd026('0x17')]['id']:0x0,_0x3b27e8[_0xd026('0x18')]?_0x3b27e8[_0xd026('0x18')]['id']:0x0);if(_0x144724[_0xd026('0x15')][_0x59a076]){_0x144724['rules'][_0x59a076][_0xd026('0x3a')](_0xd026('0x42'));if(rpc[_0x3b27e8[_0xd026('0x16')]+_0xd026('0x43')]){rpc[_0x3b27e8['channel']+_0xd026('0x43')][_0xd026('0x44')](_0x59a076,{'UserId':_0x3b27e8[_0xd026('0x17')]['UserId']})['catch'](function(){logger['error'](_0xd026('0x45'));});}}return _0x2ab010({'code':0xc8,'message':_0x3b27e8});}catch(_0xf443e5){logger[_0xd026('0x3d')](_0xf443e5[_0xd026('0x46')]);return _0x27dc27(_0x2fc5c8[_0xd026('0x3d')](0x1f4,_0xf443e5));}}logger[_0xd026('0x3d')](_0xd026('0x47'));return _0x27dc27(_0x2fc5c8['error'](0x1f4,'message\x20is\x20empty'));});},'RejectMessage':function(_0x57bd76){var _0x55c2df=this;return new Promise(function(_0x5ad771,_0x3d7717){if(_0x57bd76[_0xd026('0x3e')]&&_0x57bd76[_0xd026('0x3e')]['id']){try{if(_0x144724['agents'][_0x57bd76[_0xd026('0x3e')]['id']]){_0x144724['agents'][_0x57bd76['agent']['id']][_0xd026('0x40')]=![];_0x144724[_0xd026('0x3f')][_0x57bd76[_0xd026('0x3e')]['id']][_0xd026('0x41')]=undefined;}return _0x5ad771({'code':0xc8,'message':_0x57bd76});}catch(_0x5363ee){logger['error'](_0x5363ee[_0xd026('0x46')]);return _0x3d7717(_0x55c2df[_0xd026('0x3d')](0x1f4,_0x5363ee));}}logger[_0xd026('0x3d')](_0xd026('0x47'));return _0x3d7717(_0x55c2df[_0xd026('0x3d')](0x1f4,'message\x20is\x20empty'));});},'AbandonInteraction':function(_0x317c5b){var _0x1cb501=this;return new Promise(function(_0x95e58,_0xe9e9da){if(_0x317c5b[_0xd026('0x16')]&&_0x317c5b[_0xd026('0x18')]&&_0x317c5b['interaction']['id']){try{var _0x4c035b=getId(_0x317c5b[_0xd026('0x16')],_0x317c5b['message']?_0x317c5b[_0xd026('0x17')]['id']:0x0,_0x317c5b[_0xd026('0x18')]?_0x317c5b[_0xd026('0x18')]['id']:0x0);if(_0x144724['rules'][_0x4c035b]){_0x144724[_0xd026('0x15')][_0x4c035b][_0xd026('0x3a')]('end');}return _0x95e58({'code':0xc8,'message':_0x317c5b});}catch(_0x373379){logger[_0xd026('0x3d')](_0x373379[_0xd026('0x46')]);return _0xe9e9da(_0x1cb501[_0xd026('0x3d')](0x1f4,_0x373379));}}logger[_0xd026('0x3d')](_0xd026('0x47'));return _0xe9e9da(_0x1cb501[_0xd026('0x3d')](0x1f4,_0xd026('0x47')));});},'AgentCapacity':function(_0x2b6b34){var _0x447645=this;return new Promise(function(_0x4e5551,_0x565d2d){if(_0x144724['agents']['hasOwnProperty'](_0x2b6b34['id'])){for(var _0x584c32 in _0x2b6b34[_0xd026('0x48')]){if(_0x2b6b34[_0xd026('0x48')][_0xd026('0x49')](_0x584c32)){if(_0x144724['agents'][_0x2b6b34['id']][_0xd026('0x49')](_0x584c32+'CurrentCapacity')){_0x144724[_0xd026('0x3f')][_0x2b6b34['id']][_0x584c32+_0xd026('0x4a')]=parseInt(_0x2b6b34[_0xd026('0x48')][_0x584c32],0xa);}}}_0x144724[_0xd026('0x3f')][_0x2b6b34['id']]['updateRealtime']();return _0x4e5551({'code':0xc8,'message':_0x144724[_0xd026('0x3f')][_0x2b6b34['id']]});}else{return _0x565d2d(_0x447645[_0xd026('0x3d')](0x1f4,_0xd026('0x4b')));}});},'Agents':function(_0x261d32){return new Promise(function(_0x25317f){var _0x222ccd=_[_0xd026('0x4c')](_0x144724[_0xd026('0x3f')]);if(_0x261d32&&_0x261d32['id']){var _0x25ead5=_['find'](_0x222ccd,function(_0x3a1b03){return _0x3a1b03['id']===_0x261d32['id'];});_0x25317f(_0x25ead5);}else{_0x25317f({'count':_0x222ccd['length'],'rows':_0x222ccd});}});},'ChatQueues':function(){return new Promise(function(_0x25713b){var _0x26f6bb=[];for(var _0x291dcd in _0x144724['chatQueues']){if(_0x144724[_0xd026('0x4d')][_0xd026('0x49')](_0x291dcd)){var _0x12d5b8=_0x144724[_0xd026('0x4d')][_0x291dcd];var _0x45f3db={'id':_0x12d5b8['id'],'available':_0x12d5b8[_0xd026('0x4e')],'loggedIn':_0x12d5b8[_0xd026('0x4f')],'name':_0x12d5b8[_0xd026('0x50')],'paused':_0x12d5b8[_0xd026('0x51')],'waiting':_0x12d5b8[_0xd026('0x52')]};_0x26f6bb[_0xd026('0x24')](_0x45f3db);}}_0x25713b({'count':_0x26f6bb[_0xd026('0x1c')],'rows':_0x26f6bb});});},'MailQueues':function(){return new Promise(function(_0x224775){var _0x505a48=[];for(var _0x564232 in _0x144724[_0xd026('0x53')]){if(_0x144724[_0xd026('0x53')][_0xd026('0x49')](_0x564232)){var _0x423e26=_0x144724['mailQueues'][_0x564232];var _0x1a40f1={'id':_0x423e26['id'],'available':_0x423e26[_0xd026('0x4e')],'loggedIn':_0x423e26['loggedIn'],'name':_0x423e26[_0xd026('0x50')],'paused':_0x423e26[_0xd026('0x51')],'waiting':_0x423e26['waiting']};_0x505a48[_0xd026('0x24')](_0x1a40f1);}}_0x224775({'count':_0x505a48['length'],'rows':_0x505a48});});},'OpenchannelQueues':function(){return new Promise(function(_0x4a44e5){var _0x33fcd9=[];for(var _0x560d33 in _0x144724['openchannelQueues']){if(_0x144724[_0xd026('0x54')]['hasOwnProperty'](_0x560d33)){var _0x2967d0=_0x144724[_0xd026('0x54')][_0x560d33];var _0x29b8cf={'id':_0x2967d0['id'],'available':_0x2967d0['available'],'loggedIn':_0x2967d0[_0xd026('0x4f')],'name':_0x2967d0[_0xd026('0x50')],'paused':_0x2967d0[_0xd026('0x51')],'waiting':_0x2967d0[_0xd026('0x52')]};_0x33fcd9[_0xd026('0x24')](_0x29b8cf);}}_0x4a44e5({'count':_0x33fcd9[_0xd026('0x1c')],'rows':_0x33fcd9});});},'SmsQueues':function(){return new Promise(function(_0x5c1d94){var _0x56a3ba=[];for(var _0x53845b in _0x144724[_0xd026('0x55')]){if(_0x144724[_0xd026('0x55')][_0xd026('0x49')](_0x53845b)){var _0xce838b=_0x144724[_0xd026('0x55')][_0x53845b];var _0x21e76b={'id':_0xce838b['id'],'available':_0xce838b[_0xd026('0x4e')],'loggedIn':_0xce838b['loggedIn'],'name':_0xce838b[_0xd026('0x50')],'paused':_0xce838b['paused'],'waiting':_0xce838b[_0xd026('0x52')]};_0x56a3ba[_0xd026('0x24')](_0x21e76b);}}_0x5c1d94({'count':_0x56a3ba[_0xd026('0x1c')],'rows':_0x56a3ba});});},'FaxQueues':function(){return new Promise(function(_0x3515db){var _0x1db048=[];for(var _0x3c898c in _0x144724[_0xd026('0x56')]){if(_0x144724[_0xd026('0x56')][_0xd026('0x49')](_0x3c898c)){var _0x4f41e1=_0x144724[_0xd026('0x56')][_0x3c898c];var _0x358ba3={'id':_0x4f41e1['id'],'available':_0x4f41e1[_0xd026('0x4e')],'loggedIn':_0x4f41e1[_0xd026('0x4f')],'name':_0x4f41e1['name'],'paused':_0x4f41e1['paused'],'waiting':_0x4f41e1[_0xd026('0x52')]};_0x1db048[_0xd026('0x24')](_0x358ba3);}}_0x3515db({'count':_0x1db048[_0xd026('0x1c')],'rows':_0x1db048});});},'WhatsappQueues':function(){return new Promise(function(_0x2c512c){var _0x5bb7e1=[];for(var _0x224952 in _0x144724['whatsappQueues']){if(_0x144724[_0xd026('0x57')][_0xd026('0x49')](_0x224952)){var _0x5d10f8=_0x144724[_0xd026('0x57')][_0x224952];var _0x29dab5={'id':_0x5d10f8['id'],'available':_0x5d10f8[_0xd026('0x4e')],'loggedIn':_0x5d10f8[_0xd026('0x4f')],'name':_0x5d10f8[_0xd026('0x50')],'paused':_0x5d10f8[_0xd026('0x51')],'waiting':_0x5d10f8[_0xd026('0x52')]};_0x5bb7e1[_0xd026('0x24')](_0x29dab5);}}_0x2c512c({'count':_0x5bb7e1[_0xd026('0x1c')],'rows':_0x5bb7e1});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x108b98){var _0x20e725=_[_0xd026('0x4c')](_0x144724['chatQueuesWaitingInteractions']);_0x108b98({'count':_0x20e725[_0xd026('0x1c')],'rows':_0x20e725});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x4fa389){var _0x49279a=_[_0xd026('0x4c')](_0x144724[_0xd026('0x58')]);_0x4fa389({'count':_0x49279a[_0xd026('0x1c')],'rows':_0x49279a});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x5f1364){var _0x625afa=_['values'](_0x144724[_0xd026('0x59')]);_0x5f1364({'count':_0x625afa[_0xd026('0x1c')],'rows':_0x625afa});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x1b941a){var _0x37eccf=_[_0xd026('0x4c')](_0x144724[_0xd026('0x5a')]);_0x1b941a({'count':_0x37eccf[_0xd026('0x1c')],'rows':_0x37eccf});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x375061){var _0x314581=_['values'](_0x144724[_0xd026('0x5b')]);_0x375061({'count':_0x314581['length'],'rows':_0x314581});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x97d5b){var _0x460ed5=_[_0xd026('0x4c')](_0x144724['whatsappQueuesWaitingInteractions']);_0x97d5b({'count':_0x460ed5[_0xd026('0x1c')],'rows':_0x460ed5});});}};var _0x207542=jayson[_0xd026('0x5c')](_0xf36821)[_0xd026('0x5d')]();_0x207542['on'](_0xd026('0x3d'),function(_0x9e55c0){logger[_0xd026('0x3d')](JSON[_0xd026('0x39')](_0x9e55c0));return _0x3029c7(_0x9e55c0);});_0x207542[_0xd026('0x14')](0x232c,_0xd026('0x5e'),function(){console[_0xd026('0x5f')]('Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232c);return _0x3c83b2(_0xd026('0x60')+0x232c);});});}; \ No newline at end of file +var _0x15ae=['format','%s.%s.%s','isNil','IntervalId','Intervals','map','interval','listen','rules','channel','message','interaction','isArray','applications','length','existsSync','app','.js','appdata','mail','push','slice','join','dialogflow','split','amazonlex','tag','TagId','getMustacheRender','account','notificationTemplate','ChatWebsiteId','ContactId','body','%s:%s:%s','./interval','condition','./applications/','consequence','priority','info','Push\x20new\x20rule','on\x20interval','\x20|\x20','error','execute','stringify','matchPath','Skipped\x20routing\x20for\x20%s','stack','routing\x20is\x20empty','agent','agents','busyQueue','emit','end','QueueReport','update','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','busy','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','find','chatQueues','available','loggedIn','name','paused','mailQueues','waiting','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','127.0.0.1','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'];(function(_0xe357e3,_0x70a5f9){var _0x2afaea=function(_0x246822){while(--_0x246822){_0xe357e3['push'](_0xe357e3['shift']());}};_0x2afaea(++_0x70a5f9);}(_0x15ae,0xc3));var _0xe15a=function(_0x3af0fc,_0x56a1c3){_0x3af0fc=_0x3af0fc-0x0;var _0x369eb9=_0x15ae[_0x3af0fc];return _0x369eb9;};'use strict';var _=require(_0xe15a('0x0'));var util=require(_0xe15a('0x1'));var path=require(_0xe15a('0x2'));var fs=require('fs');var jayson=require(_0xe15a('0x3'));var BPromise=require(_0xe15a('0x4'));var utils=require(_0xe15a('0x5'));var sUtils=require(_0xe15a('0x6'));var logger=require(_0xe15a('0x7'))(_0xe15a('0x8'));var rpc={'openchannelQueueReport':require('../rpc/openchannelQueueReport'),'mailQueueReport':require(_0xe15a('0x9')),'chatQueueReport':require(_0xe15a('0xa')),'smsQueueReport':require(_0xe15a('0xb')),'faxQueueReport':require(_0xe15a('0xc')),'whatsappQueueReport':require(_0xe15a('0xd'))};var RuleEngine=require(_0xe15a('0xe'));function getId(_0x29dc27,_0x8a9c0a,_0x37d6a8){return util[_0xe15a('0xf')](_0xe15a('0x10'),_0x29dc27,_0x8a9c0a||0x0,_0x37d6a8||0x0);}function getIntervals(_0x1c6a8f,_0x1b48f0){var _0xfb1331=[];if(!_[_0xe15a('0x11')](_0x1b48f0['IntervalId'])&&!_[_0xe15a('0x11')](_0x1c6a8f[_0x1b48f0[_0xe15a('0x12')]])&&!_[_0xe15a('0x11')](_0x1c6a8f[_0x1b48f0['IntervalId']][_0xe15a('0x13')])){_0xfb1331=_[_0xe15a('0x14')](_0x1c6a8f[_0x1b48f0['IntervalId']]['Intervals'],_0xe15a('0x15'));}else if(!_[_0xe15a('0x11')](_0x1b48f0[_0xe15a('0x15')])){_0xfb1331=[_0x1b48f0['interval']];}return _0xfb1331;}exports[_0xe15a('0x16')]=function(_0x2fc70d){_0x2fc70d[_0xe15a('0x17')]={};return new BPromise(function(_0x4aa525,_0x1079a5){var _0x20ebfc={'Start':function(_0x139fd3){var _0x54fd05=this;return new Promise(function(_0x416af6,_0x27f069){if(_0x139fd3){try{var _0x352434=[];var _0x24838d=getId(_0x139fd3[_0xe15a('0x18')],_0x139fd3[_0xe15a('0x19')]?_0x139fd3[_0xe15a('0x19')]['id']:0x0,_0x139fd3[_0xe15a('0x1a')]?_0x139fd3[_0xe15a('0x1a')]['id']:0x0);var _0x9948c0=sUtils['checkWaitingNotifications'](_0x2fc70d,_0x139fd3);if(!_0x9948c0&&_0x139fd3['applications']&&_[_0xe15a('0x1b')](_0x139fd3[_0xe15a('0x1c')])&&_0x139fd3[_0xe15a('0x1c')][_0xe15a('0x1d')]){for(var _0x55288d=0x0;_0x55288d<_0x139fd3[_0xe15a('0x1c')]['length'];_0x55288d+=0x1){var _0x5d4a4c=_0x139fd3['applications'][_0x55288d];if(fs[_0xe15a('0x1e')](path['join'](__dirname,'applications',_0x5d4a4c[_0xe15a('0x1f')]+_0xe15a('0x20')))){var _0x26c722=[];switch(_0x5d4a4c['app']['toLowerCase']()){case'autoreply':var _0x56fc72=_0x5d4a4c[_0xe15a('0x21')]['split'](',');if(_0x139fd3['channel']===_0xe15a('0x22')){_0x26c722[_0xe15a('0x23')](_0x56fc72[0x0]);_0x26c722[_0xe15a('0x23')](_0x56fc72[0x1]);_0x26c722[_0xe15a('0x23')](_0x56fc72[_0xe15a('0x24')](0x2,_0x56fc72[_0xe15a('0x1d')])[_0xe15a('0x25')](','));}else{_0x26c722['push'](_0x56fc72[0x0]);_0x26c722[_0xe15a('0x23')](_0x56fc72[_0xe15a('0x24')](0x1,_0x56fc72[_0xe15a('0x1d')])['join'](','));}break;case _0xe15a('0x26'):var _0x32340c=_0x5d4a4c[_0xe15a('0x21')][_0xe15a('0x27')](',');_0x26c722[_0xe15a('0x23')](_0x32340c[0x0]);_0x26c722[_0xe15a('0x23')](_0x32340c[0x1]);_0x26c722[_0xe15a('0x23')](_0x32340c[_0xe15a('0x24')](0x2,_0x32340c[_0xe15a('0x1d')])[_0xe15a('0x25')](','));break;case'dialogflowv2':var _0x5d6ad5=_0x5d4a4c[_0xe15a('0x21')]['split'](',');_0x26c722[_0xe15a('0x23')](_0x5d6ad5[0x0]);_0x26c722[_0xe15a('0x23')](_0x5d6ad5[0x1]);_0x26c722[_0xe15a('0x23')](_0x5d6ad5[0x2]);_0x26c722[_0xe15a('0x23')](_0x5d6ad5[0x3]);_0x26c722['push'](_0x5d6ad5[_0xe15a('0x24')](0x4,_0x5d6ad5['length'])[_0xe15a('0x25')](','));break;case _0xe15a('0x28'):var _0x15da2e=_0x5d4a4c[_0xe15a('0x21')][_0xe15a('0x27')](',');_0x26c722['push'](_0x15da2e[0x0]);_0x26c722[_0xe15a('0x23')](_0x15da2e[0x1]);_0x26c722[_0xe15a('0x23')](_0x15da2e[0x2]);_0x26c722[_0xe15a('0x23')](_0x15da2e[0x3]);_0x26c722[_0xe15a('0x23')](_0x15da2e[_0xe15a('0x24')](0x4,_0x15da2e[_0xe15a('0x1d')])['join'](','));break;case _0xe15a('0x19'):_0x26c722[_0xe15a('0x23')](_0x5d4a4c['appdata']);break;case _0xe15a('0x29'):_0x26c722[_0xe15a('0x23')](_0x5d4a4c[_0xe15a('0x2a')]);_0x26c722[_0xe15a('0x23')](_0x5d4a4c[_0xe15a('0x21')]);break;case'tvox':var _0x549677=utils[_0xe15a('0x2b')](_0x139fd3[_0xe15a('0x2c')][_0xe15a('0x2d')],_0x139fd3);var _0x660f6e=_0x5d4a4c[_0xe15a('0x21')][_0xe15a('0x27')](',');_0x26c722[_0xe15a('0x23')](_0x660f6e[0x0]);_0x26c722[_0xe15a('0x23')](_0x660f6e[0x1]);_0x26c722[_0xe15a('0x23')](_0x660f6e[0x2]);_0x26c722[_0xe15a('0x23')](_0x660f6e[0x3]);_0x26c722[_0xe15a('0x23')](_0x660f6e[0x4]);_0x26c722['push'](_0x660f6e[0x5]);_0x26c722[_0xe15a('0x23')](_0x660f6e[0x6]);_0x26c722[_0xe15a('0x23')](_0x660f6e[0x7]);_0x26c722['push'](_0x660f6e[0x8]);_0x26c722[_0xe15a('0x23')](_0x660f6e[0x9]);_0x26c722[_0xe15a('0x23')](_0x660f6e[0xa]);_0x26c722[_0xe15a('0x23')](_0x139fd3[_0xe15a('0x1a')]['id']);_0x26c722[_0xe15a('0x23')](_0x139fd3[_0xe15a('0x19')]['id']);_0x26c722[_0xe15a('0x23')](_0x5d4a4c[_0xe15a('0x2e')]);_0x26c722['push'](_0x139fd3[_0xe15a('0x1a')][_0xe15a('0x2f')]);_0x26c722[_0xe15a('0x23')](_0x139fd3[_0xe15a('0x30')][_0xe15a('0x30')]);_0x26c722[_0xe15a('0x23')](_0x549677);break;default:_0x26c722=_[_0xe15a('0x11')](_0x5d4a4c[_0xe15a('0x21')])?[]:_0x5d4a4c[_0xe15a('0x21')]['split'](',');}var _0x2b35c4={'id':util['format'](_0xe15a('0x31'),_0x24838d,_0x5d4a4c['id'],_0x5d4a4c[_0xe15a('0x1f')]),'condition':require(_0xe15a('0x32'))[_0xe15a('0x33')](_0x24838d,getIntervals(_0x2fc70d['intervals'],_0x5d4a4c),_0x2fc70d),'consequence':require(_0xe15a('0x34')+_0x5d4a4c[_0xe15a('0x1f')])[_0xe15a('0x35')](_0x24838d,_0x26c722,_0x2fc70d,_0x139fd3),'p':_0x5d4a4c[_0xe15a('0x36')]||0x0};logger[_0xe15a('0x37')](_0xe15a('0x38'),_0x2b35c4['id'],_0xe15a('0x39'),getIntervals(_0x2fc70d['intervals'],_0x5d4a4c)[_0xe15a('0x25')](_0xe15a('0x3a')));_0x352434[_0xe15a('0x23')](_0x2b35c4);}else{logger[_0xe15a('0x3b')]('Please\x20create\x20a\x20new\x20file\x20under',path[_0xe15a('0x25')](__dirname,'applications',_0x5d4a4c['app']+_0xe15a('0x20')));}}_0x2fc70d['rules'][_0x24838d]=new RuleEngine(_0x352434);_0x2fc70d['rules'][_0x24838d][_0xe15a('0x3c')](_0x139fd3,function(_0x401e7d){logger['info']('Applications\x20executed',JSON[_0xe15a('0x3d')](_0x401e7d[_0xe15a('0x3e')]));if(_0x2fc70d[_0xe15a('0x17')][_0x24838d]){_0x2fc70d[_0xe15a('0x17')][_0x24838d]['emit']('complete');}});return _0x416af6({'code':0xc8,'message':_0x139fd3});}else{if(_0x9948c0){logger[_0xe15a('0x37')](util[_0xe15a('0xf')](_0xe15a('0x3f'),_0x24838d));}else{logger[_0xe15a('0x37')]('No\x20applications\x20to\x20execute');}return _0x416af6({'code':0xc8,'message':_0x139fd3});}}catch(_0x5f01f3){logger[_0xe15a('0x3b')](_0x5f01f3[_0xe15a('0x40')]);return _0x27f069(_0x54fd05['error'](0x1f4,_0x5f01f3));}}return _0x27f069(_0xe15a('0x41'));});},'AcceptMessage':function(_0x524a25){var _0x4e31ac=this;return new Promise(function(_0x4e76eb,_0x4436b5){if(_0x524a25[_0xe15a('0x42')]&&_0x524a25[_0xe15a('0x42')]['id']){if(_0x2fc70d[_0xe15a('0x43')][_0x524a25[_0xe15a('0x42')]['id']]){_0x2fc70d['agents'][_0x524a25['agent']['id']]['busy']=![];_0x2fc70d['agents'][_0x524a25['agent']['id']][_0xe15a('0x44')]=undefined;}}if(_0x524a25[_0xe15a('0x19')]&&_0x524a25[_0xe15a('0x19')]['id']){try{var _0x37b84e=getId(_0x524a25[_0xe15a('0x18')],_0x524a25[_0xe15a('0x19')]?_0x524a25[_0xe15a('0x19')]['id']:0x0,_0x524a25[_0xe15a('0x1a')]?_0x524a25[_0xe15a('0x1a')]['id']:0x0);if(_0x2fc70d['rules'][_0x37b84e]){_0x2fc70d[_0xe15a('0x17')][_0x37b84e][_0xe15a('0x45')](_0xe15a('0x46'));if(rpc[_0x524a25[_0xe15a('0x18')]+_0xe15a('0x47')]){rpc[_0x524a25[_0xe15a('0x18')]+_0xe15a('0x47')][_0xe15a('0x48')](_0x37b84e,{'UserId':_0x524a25[_0xe15a('0x19')]['UserId']})[_0xe15a('0x49')](function(){logger['error'](_0xe15a('0x4a'));});}}return _0x4e76eb({'code':0xc8,'message':_0x524a25});}catch(_0x45179a){logger['error'](_0x45179a[_0xe15a('0x40')]);return _0x4436b5(_0x4e31ac[_0xe15a('0x3b')](0x1f4,_0x45179a));}}logger[_0xe15a('0x3b')](_0xe15a('0x4b'));return _0x4436b5(_0x4e31ac[_0xe15a('0x3b')](0x1f4,_0xe15a('0x4b')));});},'RejectMessage':function(_0x53f180){var _0x443b30=this;return new Promise(function(_0x563f44,_0x380392){if(_0x53f180['agent']&&_0x53f180[_0xe15a('0x42')]['id']){try{if(_0x2fc70d['agents'][_0x53f180['agent']['id']]){_0x2fc70d[_0xe15a('0x43')][_0x53f180['agent']['id']][_0xe15a('0x4c')]=![];_0x2fc70d[_0xe15a('0x43')][_0x53f180[_0xe15a('0x42')]['id']][_0xe15a('0x44')]=undefined;}return _0x563f44({'code':0xc8,'message':_0x53f180});}catch(_0x9a1b61){logger[_0xe15a('0x3b')](_0x9a1b61[_0xe15a('0x40')]);return _0x380392(_0x443b30[_0xe15a('0x3b')](0x1f4,_0x9a1b61));}}logger[_0xe15a('0x3b')](_0xe15a('0x4b'));return _0x380392(_0x443b30[_0xe15a('0x3b')](0x1f4,_0xe15a('0x4b')));});},'AbandonInteraction':function(_0x4d18be){var _0x7c78d2=this;return new Promise(function(_0x194487,_0x48f7bd){if(_0x4d18be[_0xe15a('0x18')]&&_0x4d18be[_0xe15a('0x1a')]&&_0x4d18be[_0xe15a('0x1a')]['id']){try{var _0xdf3649=getId(_0x4d18be['channel'],_0x4d18be[_0xe15a('0x19')]?_0x4d18be[_0xe15a('0x19')]['id']:0x0,_0x4d18be['interaction']?_0x4d18be[_0xe15a('0x1a')]['id']:0x0);if(_0x2fc70d[_0xe15a('0x17')][_0xdf3649]){_0x2fc70d[_0xe15a('0x17')][_0xdf3649]['emit'](_0xe15a('0x46'));}return _0x194487({'code':0xc8,'message':_0x4d18be});}catch(_0x2e221d){logger[_0xe15a('0x3b')](_0x2e221d['stack']);return _0x48f7bd(_0x7c78d2[_0xe15a('0x3b')](0x1f4,_0x2e221d));}}logger[_0xe15a('0x3b')](_0xe15a('0x4b'));return _0x48f7bd(_0x7c78d2[_0xe15a('0x3b')](0x1f4,_0xe15a('0x4b')));});},'AgentCapacity':function(_0x374269){var _0x4e64f2=this;return new Promise(function(_0x500968,_0x4c584e){if(_0x2fc70d[_0xe15a('0x43')][_0xe15a('0x4d')](_0x374269['id'])){for(var _0x54afe1 in _0x374269['capacity']){if(_0x374269[_0xe15a('0x4e')][_0xe15a('0x4d')](_0x54afe1)){if(_0x2fc70d[_0xe15a('0x43')][_0x374269['id']][_0xe15a('0x4d')](_0x54afe1+'CurrentCapacity')){_0x2fc70d['agents'][_0x374269['id']][_0x54afe1+_0xe15a('0x4f')]=parseInt(_0x374269[_0xe15a('0x4e')][_0x54afe1],0xa);}}}_0x2fc70d[_0xe15a('0x43')][_0x374269['id']][_0xe15a('0x50')]();return _0x500968({'code':0xc8,'message':_0x2fc70d[_0xe15a('0x43')][_0x374269['id']]});}else{return _0x4c584e(_0x4e64f2['error'](0x1f4,_0xe15a('0x51')));}});},'Agents':function(_0x22f4dc){return new Promise(function(_0x5568f4){var _0xb4ee0a=_[_0xe15a('0x52')](_0x2fc70d['agents']);if(_0x22f4dc&&_0x22f4dc['id']){var _0x2f8964=_[_0xe15a('0x53')](_0xb4ee0a,function(_0x1a003f){return _0x1a003f['id']===_0x22f4dc['id'];});_0x5568f4(_0x2f8964);}else{_0x5568f4({'count':_0xb4ee0a['length'],'rows':_0xb4ee0a});}});},'ChatQueues':function(){return new Promise(function(_0x3e7873){var _0x1e5f31=[];for(var _0xd17d1e in _0x2fc70d[_0xe15a('0x54')]){if(_0x2fc70d[_0xe15a('0x54')][_0xe15a('0x4d')](_0xd17d1e)){var _0x266e61=_0x2fc70d[_0xe15a('0x54')][_0xd17d1e];var _0x373e31={'id':_0x266e61['id'],'available':_0x266e61[_0xe15a('0x55')],'loggedIn':_0x266e61[_0xe15a('0x56')],'name':_0x266e61[_0xe15a('0x57')],'paused':_0x266e61[_0xe15a('0x58')],'waiting':_0x266e61['waiting']};_0x1e5f31[_0xe15a('0x23')](_0x373e31);}}_0x3e7873({'count':_0x1e5f31[_0xe15a('0x1d')],'rows':_0x1e5f31});});},'MailQueues':function(){return new Promise(function(_0x50b3a9){var _0x4647af=[];for(var _0x2536ce in _0x2fc70d[_0xe15a('0x59')]){if(_0x2fc70d['mailQueues']['hasOwnProperty'](_0x2536ce)){var _0x100f68=_0x2fc70d['mailQueues'][_0x2536ce];var _0x53913a={'id':_0x100f68['id'],'available':_0x100f68[_0xe15a('0x55')],'loggedIn':_0x100f68[_0xe15a('0x56')],'name':_0x100f68[_0xe15a('0x57')],'paused':_0x100f68[_0xe15a('0x58')],'waiting':_0x100f68[_0xe15a('0x5a')]};_0x4647af[_0xe15a('0x23')](_0x53913a);}}_0x50b3a9({'count':_0x4647af[_0xe15a('0x1d')],'rows':_0x4647af});});},'OpenchannelQueues':function(){return new Promise(function(_0x275243){var _0x542de1=[];for(var _0x33ccbf in _0x2fc70d[_0xe15a('0x5b')]){if(_0x2fc70d[_0xe15a('0x5b')][_0xe15a('0x4d')](_0x33ccbf)){var _0x492e21=_0x2fc70d[_0xe15a('0x5b')][_0x33ccbf];var _0x4c4856={'id':_0x492e21['id'],'available':_0x492e21[_0xe15a('0x55')],'loggedIn':_0x492e21[_0xe15a('0x56')],'name':_0x492e21[_0xe15a('0x57')],'paused':_0x492e21['paused'],'waiting':_0x492e21[_0xe15a('0x5a')]};_0x542de1['push'](_0x4c4856);}}_0x275243({'count':_0x542de1[_0xe15a('0x1d')],'rows':_0x542de1});});},'SmsQueues':function(){return new Promise(function(_0x352394){var _0x505e79=[];for(var _0x348cba in _0x2fc70d['smsQueues']){if(_0x2fc70d[_0xe15a('0x5c')]['hasOwnProperty'](_0x348cba)){var _0x2e7777=_0x2fc70d[_0xe15a('0x5c')][_0x348cba];var _0x11a171={'id':_0x2e7777['id'],'available':_0x2e7777[_0xe15a('0x55')],'loggedIn':_0x2e7777[_0xe15a('0x56')],'name':_0x2e7777[_0xe15a('0x57')],'paused':_0x2e7777[_0xe15a('0x58')],'waiting':_0x2e7777[_0xe15a('0x5a')]};_0x505e79[_0xe15a('0x23')](_0x11a171);}}_0x352394({'count':_0x505e79['length'],'rows':_0x505e79});});},'FaxQueues':function(){return new Promise(function(_0x4ce0e9){var _0x18521b=[];for(var _0x11585b in _0x2fc70d[_0xe15a('0x5d')]){if(_0x2fc70d[_0xe15a('0x5d')][_0xe15a('0x4d')](_0x11585b)){var _0x53ebb1=_0x2fc70d[_0xe15a('0x5d')][_0x11585b];var _0x4da5af={'id':_0x53ebb1['id'],'available':_0x53ebb1['available'],'loggedIn':_0x53ebb1[_0xe15a('0x56')],'name':_0x53ebb1[_0xe15a('0x57')],'paused':_0x53ebb1[_0xe15a('0x58')],'waiting':_0x53ebb1[_0xe15a('0x5a')]};_0x18521b[_0xe15a('0x23')](_0x4da5af);}}_0x4ce0e9({'count':_0x18521b[_0xe15a('0x1d')],'rows':_0x18521b});});},'WhatsappQueues':function(){return new Promise(function(_0x238589){var _0x1a8563=[];for(var _0x35378a in _0x2fc70d[_0xe15a('0x5e')]){if(_0x2fc70d[_0xe15a('0x5e')][_0xe15a('0x4d')](_0x35378a)){var _0x334c51=_0x2fc70d[_0xe15a('0x5e')][_0x35378a];var _0x3bfa30={'id':_0x334c51['id'],'available':_0x334c51[_0xe15a('0x55')],'loggedIn':_0x334c51[_0xe15a('0x56')],'name':_0x334c51[_0xe15a('0x57')],'paused':_0x334c51['paused'],'waiting':_0x334c51['waiting']};_0x1a8563['push'](_0x3bfa30);}}_0x238589({'count':_0x1a8563[_0xe15a('0x1d')],'rows':_0x1a8563});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x40cff6){var _0x230d8d=_[_0xe15a('0x52')](_0x2fc70d[_0xe15a('0x5f')]);_0x40cff6({'count':_0x230d8d[_0xe15a('0x1d')],'rows':_0x230d8d});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x11cc64){var _0x2d767c=_[_0xe15a('0x52')](_0x2fc70d[_0xe15a('0x60')]);_0x11cc64({'count':_0x2d767c[_0xe15a('0x1d')],'rows':_0x2d767c});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x4a3b8a){var _0x3d66c6=_[_0xe15a('0x52')](_0x2fc70d['openchannelQueuesWaitingInteractions']);_0x4a3b8a({'count':_0x3d66c6[_0xe15a('0x1d')],'rows':_0x3d66c6});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x37398b){var _0x5098fb=_[_0xe15a('0x52')](_0x2fc70d[_0xe15a('0x61')]);_0x37398b({'count':_0x5098fb[_0xe15a('0x1d')],'rows':_0x5098fb});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x56d7ab){var _0x3ce5ed=_[_0xe15a('0x52')](_0x2fc70d[_0xe15a('0x62')]);_0x56d7ab({'count':_0x3ce5ed['length'],'rows':_0x3ce5ed});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x214be5){var _0x283591=_['values'](_0x2fc70d[_0xe15a('0x63')]);_0x214be5({'count':_0x283591[_0xe15a('0x1d')],'rows':_0x283591});});}};var _0x536ce9=jayson[_0xe15a('0x64')](_0x20ebfc)[_0xe15a('0x65')]();_0x536ce9['on']('error',function(_0x57855d){logger[_0xe15a('0x3b')](JSON[_0xe15a('0x3d')](_0x57855d));return _0x1079a5(_0x57855d);});_0x536ce9[_0xe15a('0x16')](0x232c,_0xe15a('0x66'),function(){console[_0xe15a('0x67')](_0xe15a('0x68'),0x232c);return _0x4aa525('RPC\x20listening\x20on\x20port:'+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index 65c605c..e3e7008 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 _0x4df8=['stack','util','routing','client','http','then','error','message','result','catch','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','push','Command','iftime\x20%s','true','[%s][INTERVAL]\x20%s','all','some','\x20|\x20','when','log','[%s][INTERVAL]\x20%s\x20%s','join'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4df8,0x1a5));var _0x84df=function(_0x4ee086,_0x49f32b){_0x4ee086=_0x4ee086-0x0;var _0x4be7bb=_0x4df8[_0x4ee086];return _0x4be7bb;};'use strict';var util=require(_0x84df('0x0'));var BPromise=require('bluebird');var jayson=require('jayson/promise');var _=require('lodash');var logger=require('../../../config/logger')(_0x84df('0x1'));var client=jayson[_0x84df('0x2')][_0x84df('0x3')]({'port':0x232a});function request(_0x3d2a48,_0x4703f4){return new BPromise(function(_0xd6e5fb,_0x1c5c15){return client['request'](_0x3d2a48,_0x4703f4)[_0x84df('0x4')](function(_0x58dae8){if(_0x58dae8[_0x84df('0x5')]){return _0x1c5c15(_0x58dae8[_0x84df('0x5')][_0x84df('0x6')]);}else{return _0xd6e5fb(_0x58dae8[_0x84df('0x7')]);}})[_0x84df('0x8')](function(_0x400b56){return _0x1c5c15(_0x400b56);});});}exports[_0x84df('0x9')]=function(_0x5c3330,_0x56f335,_0x6749a7){return function(_0x3e4cca){if(_0x6749a7[_0x84df('0xa')]&&!_0x6749a7['rules'][_0x5c3330]){logger[_0x84df('0xb')](_0x84df('0xc'),_0x5c3330);return _0x3e4cca[_0x84df('0xd')]();}var _0x3d73aa=[];for(var _0x30f806=0x0;_0x30f806<_0x56f335[_0x84df('0xe')];_0x30f806+=0x1){_0x3d73aa[_0x84df('0xf')](request(_0x84df('0x10'),{'command':util['format'](_0x84df('0x11'),_0x56f335[_0x30f806])})[_0x84df('0x4')](function(_0x6779d7){return _0x6779d7&&_0x6779d7['message']&&_0x6779d7[_0x84df('0x6')]['indexOf'](_0x84df('0x12'))>=0x0?!![]:![];})[_0x84df('0x8')](function(_0x42c806){logger[_0x84df('0x5')](_0x84df('0x13'),_0x5c3330,_0x56f335[_0x30f806]);}));}BPromise[_0x84df('0x14')](_0x3d73aa)['then'](function(_0x38058f){var _0x3735e1=_[_0x84df('0x15')](_0x38058f);logger[_0x84df('0xb')]('[%s][INTERVAL]\x20%s\x20%s',_0x5c3330,_0x56f335['join'](_0x84df('0x16')),_0x3735e1);_0x3e4cca[_0x84df('0x17')](_0x3735e1);})['catch'](function(_0x37ec42){console[_0x84df('0x18')](_0x37ec42);logger['error'](_0x84df('0x19'),_0x5c3330,_0x56f335[_0x84df('0x1a')](_0x84df('0x16')),_0x37ec42[_0x84df('0x1b')]);_0x3e4cca[_0x84df('0xd')]();});};}; \ No newline at end of file +var _0xfea7=['http','error','result','catch','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','push','Command','format','iftime\x20%s','message','indexOf','[%s][INTERVAL]\x20%s','all','then','some','[%s][INTERVAL]\x20%s\x20%s','join','when','log','\x20|\x20','stack','util','bluebird','jayson/promise','lodash','../../../config/logger','routing','client'];(function(_0x44586e,_0x1c55b8){var _0x3eb43f=function(_0x6434c0){while(--_0x6434c0){_0x44586e['push'](_0x44586e['shift']());}};_0x3eb43f(++_0x1c55b8);}(_0xfea7,0x139));var _0x7fea=function(_0x2f3815,_0x20b9bd){_0x2f3815=_0x2f3815-0x0;var _0x26ef40=_0xfea7[_0x2f3815];return _0x26ef40;};'use strict';var util=require(_0x7fea('0x0'));var BPromise=require(_0x7fea('0x1'));var jayson=require(_0x7fea('0x2'));var _=require(_0x7fea('0x3'));var logger=require(_0x7fea('0x4'))(_0x7fea('0x5'));var client=jayson[_0x7fea('0x6')][_0x7fea('0x7')]({'port':0x232a});function request(_0x4b317e,_0x15ce4c){return new BPromise(function(_0x1d1bac,_0x55e8df){return client['request'](_0x4b317e,_0x15ce4c)['then'](function(_0x4ebd67){if(_0x4ebd67[_0x7fea('0x8')]){return _0x55e8df(_0x4ebd67[_0x7fea('0x8')]['message']);}else{return _0x1d1bac(_0x4ebd67[_0x7fea('0x9')]);}})[_0x7fea('0xa')](function(_0x4fe804){return _0x55e8df(_0x4fe804);});});}exports['condition']=function(_0x1bd6ef,_0x5a456a,_0xd5a128){return function(_0x1a9897){if(_0xd5a128[_0x7fea('0xb')]&&!_0xd5a128[_0x7fea('0xb')][_0x1bd6ef]){logger[_0x7fea('0xc')](_0x7fea('0xd'),_0x1bd6ef);return _0x1a9897[_0x7fea('0xe')]();}var _0x260934=[];for(var _0x26d2e7=0x0;_0x26d2e7<_0x5a456a[_0x7fea('0xf')];_0x26d2e7+=0x1){_0x260934[_0x7fea('0x10')](request(_0x7fea('0x11'),{'command':util[_0x7fea('0x12')](_0x7fea('0x13'),_0x5a456a[_0x26d2e7])})['then'](function(_0x429bf3){return _0x429bf3&&_0x429bf3[_0x7fea('0x14')]&&_0x429bf3['message'][_0x7fea('0x15')]('true')>=0x0?!![]:![];})[_0x7fea('0xa')](function(_0x1eb08d){logger[_0x7fea('0x8')](_0x7fea('0x16'),_0x1bd6ef,_0x5a456a[_0x26d2e7]);}));}BPromise[_0x7fea('0x17')](_0x260934)[_0x7fea('0x18')](function(_0x340f8f){var _0xd9f242=_[_0x7fea('0x19')](_0x340f8f);logger[_0x7fea('0xc')](_0x7fea('0x1a'),_0x1bd6ef,_0x5a456a[_0x7fea('0x1b')]('\x20|\x20'),_0xd9f242);_0x1a9897[_0x7fea('0x1c')](_0xd9f242);})['catch'](function(_0x2e6e8f){console[_0x7fea('0x1d')](_0x2e6e8f);logger[_0x7fea('0x8')](_0x7fea('0x1a'),_0x1bd6ef,_0x5a456a[_0x7fea('0x1b')](_0x7fea('0x1e')),_0x2e6e8f[_0x7fea('0x1f')]);_0x1a9897[_0x7fea('0xe')]();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index 474921c..155c32d 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 _0x1339=['talktime','push','[%s][agents][agentringnoanswer]','queuecallerabandon','forIn','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','error','agentconnect','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','ringtime','connect','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','complete','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','transfertype','extension','transferuniqueid','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','ATTENDED','transferexten','origtransfererexten','transfereeuniqueid','agententerreason','calleridname','secondtransfererlinkedid','[%s][agents][attendedtransfer]\x20agent:%s','transfertargetuniqueid','clone','[%s][agents][hangup]','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','diffTime','agent','./utils','info','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','membername','interface','calleridnum','lastevent','queue','getVoiceQueueByName','then','type','agentacw','agentcomplete','acwtime','acwTimeout','request','CreateVoiceAgentReport','destuniqueid','debug','[%s][agents][agentcalled]','agentcalledAt','now','called','connectedlinenum','connectedlinename','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','isNil','agentringnoanswer','agentringnoanswerAt','timeout','reason','holdtime'];(function(_0x5dd351,_0x19ebc5){var _0x1fbdba=function(_0x58297e){while(--_0x58297e){_0x5dd351['push'](_0x5dd351['shift']());}};_0x1fbdba(++_0x19ebc5);}(_0x1339,0x1ed));var _0x9133=function(_0x2a2cc7,_0x33ec63){_0x2a2cc7=_0x2a2cc7-0x0;var _0x491401=_0x1339[_0x2a2cc7];return _0x491401;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0x9133('0x0'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x2a91b2,_0x4611be){utils[_0x9133('0x1')](util[_0x9133('0x2')](_0x9133('0x3'),_0x2a91b2[_0x9133('0x4')],_0x2a91b2[_0x9133('0x5')],_0x2a91b2['queue'],_0x2a91b2[_0x9133('0x6')],_0x2a91b2[_0x9133('0x7')],_0x2a91b2[_0x9133('0x8')],_0x2a91b2['connectedlinenum'],_0x2a91b2[_0x9133('0x9')]));if(_0x2a91b2[_0x9133('0xa')]){utils[_0x9133('0xb')](_0x2a91b2[_0x9133('0xa')])[_0x9133('0xc')](function(_0x3a7a80){if(_0x3a7a80){_0x2a91b2[_0x9133('0xd')]=_0x3a7a80[_0x9133('0xd')];_0x2a91b2[_0x9133('0xe')]=_0x2a91b2[_0x9133('0xf')]?_0x3a7a80['acw']:![];_0x2a91b2[_0x9133('0x10')]=_0x2a91b2[_0x9133('0xe')]?_0x3a7a80[_0x9133('0x11')]:0x0;}utils[_0x9133('0x12')](_0x9133('0x13'),_0x2a91b2);});}else{utils[_0x9133('0x12')]('CreateVoiceAgentReport',_0x2a91b2);}if(_0x4611be){delete transfers[_0x2a91b2[_0x9133('0x4')]];}else{delete agents[_0x2a91b2[_0x9133('0x14')]];}}exports['agentcalled']=function(_0x5283a3){try{utils[_0x9133('0x15')](util['format'](_0x9133('0x16'),_0x5283a3[_0x9133('0x4')]),_0x5283a3);agents[_0x5283a3[_0x9133('0x14')]]=_0x5283a3;agents[_0x5283a3[_0x9133('0x14')]][_0x9133('0x17')]=utils[_0x9133('0x18')]();agents[_0x5283a3['destuniqueid']][_0x9133('0x9')]=_0x9133('0x19');agents[_0x5283a3['destuniqueid']][_0x9133('0x1a')]=null;agents[_0x5283a3[_0x9133('0x14')]][_0x9133('0x1b')]=null;utils[_0x9133('0x1')](util['format'](_0x9133('0x1c'),_0x5283a3['uniqueid'],agents[_0x5283a3[_0x9133('0x14')]]['membername'],_0x5283a3[_0x9133('0x14')]));}catch(_0x1d6d0b){utils['error'](util[_0x9133('0x2')]('[%s][agents][agentcalled]',_0x5283a3[_0x9133('0x4')]),_0x1d6d0b);}};exports['agentringnoanswer']=function(_0x5e4f0c){try{if(!_[_0x9133('0x1d')](agents[_0x5e4f0c['destuniqueid']])){utils[_0x9133('0x15')](util['format']('[%s][agents][agentringnoanswer]',_0x5e4f0c['uniqueid']),_0x5e4f0c);utils[_0x9133('0x1')](util[_0x9133('0x2')]('[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout',_0x5e4f0c[_0x9133('0x4')],agents[_0x5e4f0c[_0x9133('0x14')]][_0x9133('0x6')],_0x5e4f0c[_0x9133('0x14')]));agents[_0x5e4f0c['destuniqueid']][_0x9133('0x1e')]=!![];agents[_0x5e4f0c['destuniqueid']][_0x9133('0x1f')]=utils[_0x9133('0x18')]();agents[_0x5e4f0c[_0x9133('0x14')]][_0x9133('0x9')]=_0x9133('0x20');agents[_0x5e4f0c[_0x9133('0x14')]][_0x9133('0x21')]=_0x9133('0x20');agents[_0x5e4f0c[_0x9133('0x14')]][_0x9133('0x22')]=_0x5e4f0c['ringtime']?parseInt(_0x5e4f0c['ringtime'])/0x3e8:0x0;agents[_0x5e4f0c[_0x9133('0x14')]][_0x9133('0x23')]=0x0;unanswered[_0x9133('0x24')](_0x5e4f0c[_0x9133('0x14')]);}}catch(_0x4de894){utils['error'](util[_0x9133('0x2')](_0x9133('0x25'),_0x5e4f0c[_0x9133('0x4')]),_0x4de894);}};exports[_0x9133('0x26')]=function(_0x390f50){try{_[_0x9133('0x27')](agents,function(_0x48c713,_0x58afe0){if(_0x48c713['uniqueid']==_0x390f50[_0x9133('0x4')]&&!_['includes'](unanswered,_0x48c713[_0x9133('0x14')])){utils[_0x9133('0x15')](util['format'](_0x9133('0x28'),_0x390f50['uniqueid']),_0x390f50);utils[_0x9133('0x1')](util[_0x9133('0x2')](_0x9133('0x29'),_0x390f50['uniqueid'],_0x48c713[_0x9133('0x6')],_0x48c713[_0x9133('0x14')]));_0x48c713[_0x9133('0x1e')]=!![];_0x48c713['agentringnoanswerAt']=utils[_0x9133('0x18')]();_0x48c713[_0x9133('0x9')]=_0x9133('0x2a');_0x48c713['reason']=_0x9133('0x2a');_0x48c713[_0x9133('0x22')]=_0x390f50[_0x9133('0x22')];_0x48c713[_0x9133('0x23')]=0x0;writeDB(_0x48c713);}});}catch(_0x5e4d5e){utils[_0x9133('0x2b')](util[_0x9133('0x2')]('[%s][agents][queuecallerabandon]',_0x390f50[_0x9133('0x4')]),_0x5e4d5e);}};exports[_0x9133('0x2c')]=function(_0x593fbe){try{if(agents[_0x593fbe[_0x9133('0x14')]]){utils[_0x9133('0x15')](util[_0x9133('0x2')](_0x9133('0x2d'),_0x593fbe[_0x9133('0x4')]),_0x593fbe);utils[_0x9133('0x1')](util[_0x9133('0x2')](_0x9133('0x2e'),_0x593fbe['uniqueid'],agents[_0x593fbe[_0x9133('0x14')]][_0x9133('0x6')],_0x593fbe['destuniqueid']));agents[_0x593fbe[_0x9133('0x14')]][_0x9133('0x2f')]=utils[_0x9133('0x18')]();agents[_0x593fbe[_0x9133('0x14')]][_0x9133('0x1a')]=_0x593fbe[_0x9133('0x1a')];agents[_0x593fbe['destuniqueid']]['connectedlinename']=_0x593fbe[_0x9133('0x1b')];agents[_0x593fbe[_0x9133('0x14')]][_0x9133('0x22')]=_0x593fbe[_0x9133('0x30')];agents[_0x593fbe[_0x9133('0x14')]][_0x9133('0x9')]=_0x9133('0x31');_[_0x9133('0x27')](agents,function(_0x720048,_0x5a3f73){if(_0x720048[_0x9133('0x14')]!=_0x593fbe[_0x9133('0x14')]&&_0x720048[_0x9133('0x4')]==_0x593fbe[_0x9133('0x4')]){_0x720048[_0x9133('0x23')]=0x0;_0x720048['holdtime']=_0x593fbe[_0x9133('0x30')];_0x720048[_0x9133('0x1e')]=!![];_0x720048[_0x9133('0x1f')]=utils[_0x9133('0x18')]();_0x720048['lastevent']=_0x9133('0x32');_0x720048[_0x9133('0x21')]=_0x9133('0x32');_0x720048[_0x9133('0x33')]=_0x593fbe[_0x9133('0x14')];_0x720048[_0x9133('0x34')]=_0x593fbe[_0x9133('0x6')];writeDB(_0x720048);}});}}catch(_0x4ca1a3){utils[_0x9133('0x2b')](util['format']('[%s][agents][agentconnect]',_0x593fbe[_0x9133('0x4')]),_0x4ca1a3);}};exports[_0x9133('0xf')]=function(_0x46156d){try{if(!_[_0x9133('0x1d')](agents[_0x46156d[_0x9133('0x14')]])){utils[_0x9133('0x15')](util[_0x9133('0x2')](_0x9133('0x35'),_0x46156d[_0x9133('0x4')]),_0x46156d);utils['info'](util[_0x9133('0x2')](_0x9133('0x36'),_0x46156d[_0x9133('0x4')],agents[_0x46156d['destuniqueid']]['membername'],_0x46156d[_0x9133('0x14')]));agents[_0x46156d[_0x9133('0x14')]]['agentcomplete']=!![];agents[_0x46156d[_0x9133('0x14')]][_0x9133('0x37')]=utils[_0x9133('0x18')]();agents[_0x46156d[_0x9133('0x14')]][_0x9133('0x23')]=utils['diffTime'](agents[_0x46156d[_0x9133('0x14')]][_0x9133('0x37')],agents[_0x46156d[_0x9133('0x14')]]['agentconnectAt']);agents[_0x46156d[_0x9133('0x14')]][_0x9133('0x21')]=_0x46156d['reason'];agents[_0x46156d['destuniqueid']][_0x9133('0x9')]=_0x9133('0x38');writeDB(agents[_0x46156d[_0x9133('0x14')]]);}}catch(_0x41fea9){utils[_0x9133('0x2b')](util[_0x9133('0x2')](_0x9133('0x35'),_0x46156d[_0x9133('0x4')]),_0x41fea9);}};exports[_0x9133('0x39')]=function(_0xf07fbb){try{if(!_[_0x9133('0x1d')](agents[_0xf07fbb[_0x9133('0x3a')]])){utils['debug'](util['format'](_0x9133('0x3b'),_0xf07fbb['uniqueid']),_0xf07fbb);utils[_0x9133('0x1')](util[_0x9133('0x2')](_0x9133('0x3c'),_0xf07fbb[_0x9133('0x4')],agents[_0xf07fbb['transfereruniqueid']][_0x9133('0x6')],agents[_0xf07fbb[_0x9133('0x3a')]][_0x9133('0x4')]));agents[_0xf07fbb['transfereruniqueid']][_0x9133('0x3d')]=!![];agents[_0xf07fbb[_0x9133('0x3a')]][_0x9133('0x3e')]='blind';agents[_0xf07fbb[_0x9133('0x3a')]]['transferexten']=_0xf07fbb[_0x9133('0x3f')];agents[_0xf07fbb[_0x9133('0x3a')]][_0x9133('0x40')]=agents[_0xf07fbb[_0x9133('0x3a')]]['uniqueid'];}}catch(_0x4a346c){utils[_0x9133('0x2b')](util[_0x9133('0x2')](_0x9133('0x3b'),_0xf07fbb[_0x9133('0x4')]),_0x4a346c);}};exports[_0x9133('0x41')]=function(_0x565920){try{utils['debug'](util[_0x9133('0x2')](_0x9133('0x42'),_0x565920['origtransfereruniqueid']),_0x565920);if(_0x565920[_0x9133('0x43')]==_0x565920[_0x9133('0x44')]){if(!_['isNil'](agents[_0x565920['secondtransfereruniqueid']])){utils['info'](util[_0x9133('0x2')]('[%s][agents][attendedtransfer]\x20agent:%s',_0x565920[_0x9133('0x43')],agents[_0x565920[_0x9133('0x45')]][_0x9133('0x6')]));agents[_0x565920[_0x9133('0x45')]]['transfer']=!![];agents[_0x565920[_0x9133('0x45')]]['transfertype']=_0x9133('0x46');agents[_0x565920[_0x9133('0x45')]][_0x9133('0x47')]=_0x565920[_0x9133('0x48')];agents[_0x565920[_0x9133('0x45')]][_0x9133('0x40')]=_0x565920['origtransfereruniqueid'];}if(_0x565920['transfereeuniqueid']&&agents[_0x565920['transfereeuniqueid']]){agents[_0x565920[_0x9133('0x49')]][_0x9133('0x4a')]=0x1;transfers[_0x565920[_0x9133('0x49')]]=_['clone'](agents[_0x565920[_0x9133('0x49')]]);transfers[_0x565920[_0x9133('0x49')]][_0x9133('0x8')]=agents[_0x565920[_0x9133('0x45')]][_0x9133('0x8')];transfers[_0x565920[_0x9133('0x49')]][_0x9133('0x4b')]=agents[_0x565920[_0x9133('0x45')]]['calleridname'];transfers[_0x565920[_0x9133('0x49')]]['agentcalledAt']=utils[_0x9133('0x18')]();transfers[_0x565920['transfereeuniqueid']][_0x9133('0x2f')]=utils[_0x9133('0x18')]();transfers[_0x565920['transfereeuniqueid']]['holdtime']=0x0;transfers[_0x565920[_0x9133('0x49')]][_0x9133('0x4a')]=0x2;}}else if(_0x565920[_0x9133('0x45')]==_0x565920[_0x9133('0x4c')]){if(!_[_0x9133('0x1d')](agents[_0x565920[_0x9133('0x43')]])){utils[_0x9133('0x1')](util[_0x9133('0x2')](_0x9133('0x4d'),_0x565920[_0x9133('0x43')],agents[_0x565920[_0x9133('0x43')]]['membername']));agents[_0x565920[_0x9133('0x43')]]['transfer']=!![];agents[_0x565920[_0x9133('0x43')]][_0x9133('0x3e')]=_0x9133('0x46');agents[_0x565920[_0x9133('0x43')]][_0x9133('0x47')]=_0x565920['secondtransfererexten'];agents[_0x565920[_0x9133('0x43')]][_0x9133('0x40')]=_0x565920[_0x9133('0x45')];}if(_0x565920[_0x9133('0x4e')]&&agents[_0x565920['transfertargetuniqueid']]){agents[_0x565920[_0x9133('0x4e')]][_0x9133('0x4a')]=0x1;transfers[_0x565920[_0x9133('0x4e')]]=_[_0x9133('0x4f')](agents[_0x565920['transfertargetuniqueid']]);transfers[_0x565920['transfertargetuniqueid']][_0x9133('0x8')]=agents[_0x565920[_0x9133('0x43')]][_0x9133('0x8')];transfers[_0x565920[_0x9133('0x4e')]][_0x9133('0x4b')]=agents[_0x565920[_0x9133('0x43')]]['calleridname'];transfers[_0x565920[_0x9133('0x4e')]][_0x9133('0x17')]=utils[_0x9133('0x18')]();transfers[_0x565920[_0x9133('0x4e')]]['agentconnectAt']=utils[_0x9133('0x18')]();transfers[_0x565920['transfertargetuniqueid']][_0x9133('0x22')]=0x0;transfers[_0x565920[_0x9133('0x4e')]][_0x9133('0x4a')]=0x2;}}}catch(_0x39b46d){utils[_0x9133('0x2b')](util[_0x9133('0x2')](_0x9133('0x42'),_0x565920[_0x9133('0x43')]),_0x39b46d);}};exports['hangup']=function(_0x23bd83){try{utils[_0x9133('0x15')](util[_0x9133('0x2')](_0x9133('0x50'),_0x23bd83[_0x9133('0x4')]),_0x23bd83);if(agents[_0x23bd83['uniqueid']]&&agents[_0x23bd83['uniqueid']]['reason']===_0x9133('0x20')){if(_0x23bd83[_0x9133('0x51')]==='21'){agents[_0x23bd83[_0x9133('0x4')]]['reason']=_0x9133('0x52');agents[_0x23bd83[_0x9133('0x4')]][_0x9133('0x9')]=_0x9133('0x52');}utils[_0x9133('0x1')](util[_0x9133('0x2')](_0x9133('0x53'),_0x23bd83[_0x9133('0x4')],agents[_0x23bd83['uniqueid']][_0x9133('0x6')],agents[_0x23bd83[_0x9133('0x4')]]['reason'],agents[_0x23bd83[_0x9133('0x4')]]['lastevent']));writeDB(agents[_0x23bd83[_0x9133('0x4')]]);var _0x439352=unanswered[_0x9133('0x54')](_0x23bd83[_0x9133('0x4')]);if(_0x439352>-0x1){unanswered[_0x9133('0x55')](_0x439352,0x1);}}if(transfers[_0x23bd83['uniqueid']]){transfers[_0x23bd83[_0x9133('0x4')]][_0x9133('0xf')]=!![];transfers[_0x23bd83[_0x9133('0x4')]][_0x9133('0x37')]=utils['now']();transfers[_0x23bd83[_0x9133('0x4')]][_0x9133('0x23')]=utils[_0x9133('0x56')](transfers[_0x23bd83[_0x9133('0x4')]][_0x9133('0x37')],transfers[_0x23bd83[_0x9133('0x4')]][_0x9133('0x2f')]);transfers[_0x23bd83[_0x9133('0x4')]][_0x9133('0x21')]=_0x9133('0x57');transfers[_0x23bd83[_0x9133('0x4')]]['lastevent']=_0x9133('0x38');utils[_0x9133('0x1')](util[_0x9133('0x2')](_0x9133('0x53'),_0x23bd83['uniqueid'],transfers[_0x23bd83[_0x9133('0x4')]]['membername'],transfers[_0x23bd83[_0x9133('0x4')]][_0x9133('0x21')],transfers[_0x23bd83[_0x9133('0x4')]]['lastevent']));writeDB(transfers[_0x23bd83[_0x9133('0x4')]],!![]);}if(agents[_0x23bd83[_0x9133('0x4')]]&&agents[_0x23bd83[_0x9133('0x4')]]['agentconnectAt']){agents[_0x23bd83[_0x9133('0x4')]][_0x9133('0xf')]=!![];agents[_0x23bd83['uniqueid']][_0x9133('0x37')]=utils[_0x9133('0x18')]();agents[_0x23bd83[_0x9133('0x4')]]['talktime']=utils[_0x9133('0x56')](agents[_0x23bd83['uniqueid']][_0x9133('0x37')],agents[_0x23bd83[_0x9133('0x4')]][_0x9133('0x2f')]);agents[_0x23bd83['uniqueid']][_0x9133('0x21')]=agents[_0x23bd83['uniqueid']][_0x9133('0x3d')]?_0x9133('0x3d'):_0x9133('0x57');agents[_0x23bd83[_0x9133('0x4')]][_0x9133('0x9')]=_0x9133('0x38');utils[_0x9133('0x1')](util[_0x9133('0x2')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x23bd83[_0x9133('0x4')],agents[_0x23bd83[_0x9133('0x4')]][_0x9133('0x6')],agents[_0x23bd83[_0x9133('0x4')]][_0x9133('0x21')],agents[_0x23bd83['uniqueid']][_0x9133('0x9')]));writeDB(agents[_0x23bd83[_0x9133('0x4')]]);}}catch(_0x1b66d0){utils[_0x9133('0x2b')](util['format'](_0x9133('0x50'),_0x23bd83['uniqueid']),_0x1b66d0);}}; \ No newline at end of file +var _0xb9be=['origtransfererlinkedid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','transfertype','origtransfererexten','transferuniqueid','transfereeuniqueid','agententerreason','calleridname','agentcalledAt','secondtransfererlinkedid','ATTENDED','secondtransfererexten','transfertargetuniqueid','clone','hangup','[%s][agents][hangup]','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','agent','lodash','util','./utils','info','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','membername','interface','calleridnum','lastevent','queue','getVoiceQueueByName','then','type','agentacw','acw','acwTimeout','request','CreateVoiceAgentReport','destuniqueid','[%s][agents][agentcalled]','now','called','connectedlinenum','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','isNil','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswer','agentringnoanswerAt','timeout','reason','holdtime','ringtime','talktime','push','queuecallerabandon','forIn','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','[%s][agents][queuecallerabandon]','debug','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connectedlinename','answered_elsewhere','answeredelsewheremembername','agentcomplete','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','diffTime','complete','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','transfer','transferexten','extension','[%s][agents][attendedtransfer]','origtransfereruniqueid'];(function(_0x2bf141,_0x31eac7){var _0x48277b=function(_0x9fe560){while(--_0x9fe560){_0x2bf141['push'](_0x2bf141['shift']());}};_0x48277b(++_0x31eac7);}(_0xb9be,0xc5));var _0xeb9b=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0xb9be[_0x465a0c];return _0x1e202e;};'use strict';var _=require(_0xeb9b('0x0'));var util=require(_0xeb9b('0x1'));var utils=require(_0xeb9b('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x21f8a2,_0x292bab){utils[_0xeb9b('0x3')](util[_0xeb9b('0x4')](_0xeb9b('0x5'),_0x21f8a2[_0xeb9b('0x6')],_0x21f8a2['channel'],_0x21f8a2['queue'],_0x21f8a2[_0xeb9b('0x7')],_0x21f8a2[_0xeb9b('0x8')],_0x21f8a2[_0xeb9b('0x9')],_0x21f8a2['connectedlinenum'],_0x21f8a2[_0xeb9b('0xa')]));if(_0x21f8a2[_0xeb9b('0xb')]){utils[_0xeb9b('0xc')](_0x21f8a2[_0xeb9b('0xb')])[_0xeb9b('0xd')](function(_0x3da395){if(_0x3da395){_0x21f8a2[_0xeb9b('0xe')]=_0x3da395[_0xeb9b('0xe')];_0x21f8a2[_0xeb9b('0xf')]=_0x21f8a2['agentcomplete']?_0x3da395[_0xeb9b('0x10')]:![];_0x21f8a2['acwtime']=_0x21f8a2['agentacw']?_0x3da395[_0xeb9b('0x11')]:0x0;}utils[_0xeb9b('0x12')]('CreateVoiceAgentReport',_0x21f8a2);});}else{utils[_0xeb9b('0x12')](_0xeb9b('0x13'),_0x21f8a2);}if(_0x292bab){delete transfers[_0x21f8a2[_0xeb9b('0x6')]];}else{delete agents[_0x21f8a2[_0xeb9b('0x14')]];}}exports['agentcalled']=function(_0x5e94e3){try{utils['debug'](util[_0xeb9b('0x4')](_0xeb9b('0x15'),_0x5e94e3[_0xeb9b('0x6')]),_0x5e94e3);agents[_0x5e94e3['destuniqueid']]=_0x5e94e3;agents[_0x5e94e3['destuniqueid']]['agentcalledAt']=utils[_0xeb9b('0x16')]();agents[_0x5e94e3[_0xeb9b('0x14')]][_0xeb9b('0xa')]=_0xeb9b('0x17');agents[_0x5e94e3[_0xeb9b('0x14')]][_0xeb9b('0x18')]=null;agents[_0x5e94e3[_0xeb9b('0x14')]]['connectedlinename']=null;utils[_0xeb9b('0x3')](util[_0xeb9b('0x4')](_0xeb9b('0x19'),_0x5e94e3[_0xeb9b('0x6')],agents[_0x5e94e3[_0xeb9b('0x14')]][_0xeb9b('0x7')],_0x5e94e3[_0xeb9b('0x14')]));}catch(_0x3342c1){utils[_0xeb9b('0x1a')](util[_0xeb9b('0x4')]('[%s][agents][agentcalled]',_0x5e94e3[_0xeb9b('0x6')]),_0x3342c1);}};exports['agentringnoanswer']=function(_0x5d5f54){try{if(!_[_0xeb9b('0x1b')](agents[_0x5d5f54[_0xeb9b('0x14')]])){utils['debug'](util[_0xeb9b('0x4')](_0xeb9b('0x1c'),_0x5d5f54[_0xeb9b('0x6')]),_0x5d5f54);utils[_0xeb9b('0x3')](util[_0xeb9b('0x4')](_0xeb9b('0x1d'),_0x5d5f54[_0xeb9b('0x6')],agents[_0x5d5f54[_0xeb9b('0x14')]][_0xeb9b('0x7')],_0x5d5f54[_0xeb9b('0x14')]));agents[_0x5d5f54[_0xeb9b('0x14')]][_0xeb9b('0x1e')]=!![];agents[_0x5d5f54[_0xeb9b('0x14')]][_0xeb9b('0x1f')]=utils[_0xeb9b('0x16')]();agents[_0x5d5f54[_0xeb9b('0x14')]]['lastevent']=_0xeb9b('0x20');agents[_0x5d5f54['destuniqueid']][_0xeb9b('0x21')]='timeout';agents[_0x5d5f54[_0xeb9b('0x14')]][_0xeb9b('0x22')]=_0x5d5f54[_0xeb9b('0x23')]?parseInt(_0x5d5f54[_0xeb9b('0x23')])/0x3e8:0x0;agents[_0x5d5f54['destuniqueid']][_0xeb9b('0x24')]=0x0;unanswered[_0xeb9b('0x25')](_0x5d5f54['destuniqueid']);}}catch(_0x35ff07){utils[_0xeb9b('0x1a')](util['format'](_0xeb9b('0x1c'),_0x5d5f54[_0xeb9b('0x6')]),_0x35ff07);}};exports[_0xeb9b('0x26')]=function(_0x48c5f4){try{_[_0xeb9b('0x27')](agents,function(_0x5336f2,_0x6bb66){if(_0x5336f2['uniqueid']==_0x48c5f4[_0xeb9b('0x6')]&&!_['includes'](unanswered,_0x5336f2[_0xeb9b('0x14')])){utils['debug'](util[_0xeb9b('0x4')]('[%s][agents][queuecallerabandon]',_0x48c5f4[_0xeb9b('0x6')]),_0x48c5f4);utils[_0xeb9b('0x3')](util[_0xeb9b('0x4')](_0xeb9b('0x28'),_0x48c5f4[_0xeb9b('0x6')],_0x5336f2[_0xeb9b('0x7')],_0x5336f2[_0xeb9b('0x14')]));_0x5336f2[_0xeb9b('0x1e')]=!![];_0x5336f2[_0xeb9b('0x1f')]=utils[_0xeb9b('0x16')]();_0x5336f2['lastevent']=_0xeb9b('0x29');_0x5336f2[_0xeb9b('0x21')]=_0xeb9b('0x29');_0x5336f2[_0xeb9b('0x22')]=_0x48c5f4[_0xeb9b('0x22')];_0x5336f2[_0xeb9b('0x24')]=0x0;writeDB(_0x5336f2);}});}catch(_0x179cd9){utils['error'](util[_0xeb9b('0x4')](_0xeb9b('0x2a'),_0x48c5f4[_0xeb9b('0x6')]),_0x179cd9);}};exports['agentconnect']=function(_0x236e69){try{if(agents[_0x236e69[_0xeb9b('0x14')]]){utils[_0xeb9b('0x2b')](util[_0xeb9b('0x4')](_0xeb9b('0x2c'),_0x236e69[_0xeb9b('0x6')]),_0x236e69);utils['info'](util[_0xeb9b('0x4')](_0xeb9b('0x2d'),_0x236e69['uniqueid'],agents[_0x236e69[_0xeb9b('0x14')]][_0xeb9b('0x7')],_0x236e69[_0xeb9b('0x14')]));agents[_0x236e69[_0xeb9b('0x14')]][_0xeb9b('0x2e')]=utils[_0xeb9b('0x16')]();agents[_0x236e69[_0xeb9b('0x14')]]['connectedlinenum']=_0x236e69[_0xeb9b('0x18')];agents[_0x236e69[_0xeb9b('0x14')]][_0xeb9b('0x2f')]=_0x236e69['connectedlinename'];agents[_0x236e69['destuniqueid']]['holdtime']=_0x236e69[_0xeb9b('0x23')];agents[_0x236e69[_0xeb9b('0x14')]][_0xeb9b('0xa')]='connect';_[_0xeb9b('0x27')](agents,function(_0x9b36ae,_0x240d8d){if(_0x9b36ae[_0xeb9b('0x14')]!=_0x236e69[_0xeb9b('0x14')]&&_0x9b36ae[_0xeb9b('0x6')]==_0x236e69[_0xeb9b('0x6')]){_0x9b36ae['talktime']=0x0;_0x9b36ae[_0xeb9b('0x22')]=_0x236e69[_0xeb9b('0x23')];_0x9b36ae[_0xeb9b('0x1e')]=!![];_0x9b36ae['agentringnoanswerAt']=utils['now']();_0x9b36ae[_0xeb9b('0xa')]=_0xeb9b('0x30');_0x9b36ae['reason']=_0xeb9b('0x30');_0x9b36ae['answeredelsewheredestinationuniqueid']=_0x236e69[_0xeb9b('0x14')];_0x9b36ae[_0xeb9b('0x31')]=_0x236e69[_0xeb9b('0x7')];writeDB(_0x9b36ae);}});}}catch(_0x300565){utils[_0xeb9b('0x1a')](util[_0xeb9b('0x4')](_0xeb9b('0x2c'),_0x236e69[_0xeb9b('0x6')]),_0x300565);}};exports[_0xeb9b('0x32')]=function(_0x311e7d){try{if(!_[_0xeb9b('0x1b')](agents[_0x311e7d[_0xeb9b('0x14')]])){utils['debug'](util['format'](_0xeb9b('0x33'),_0x311e7d['uniqueid']),_0x311e7d);utils[_0xeb9b('0x3')](util[_0xeb9b('0x4')](_0xeb9b('0x34'),_0x311e7d['uniqueid'],agents[_0x311e7d[_0xeb9b('0x14')]][_0xeb9b('0x7')],_0x311e7d['destuniqueid']));agents[_0x311e7d[_0xeb9b('0x14')]][_0xeb9b('0x32')]=!![];agents[_0x311e7d[_0xeb9b('0x14')]][_0xeb9b('0x35')]=utils[_0xeb9b('0x16')]();agents[_0x311e7d[_0xeb9b('0x14')]][_0xeb9b('0x24')]=utils[_0xeb9b('0x36')](agents[_0x311e7d['destuniqueid']]['agentcompleteAt'],agents[_0x311e7d[_0xeb9b('0x14')]]['agentconnectAt']);agents[_0x311e7d['destuniqueid']][_0xeb9b('0x21')]=_0x311e7d[_0xeb9b('0x21')];agents[_0x311e7d[_0xeb9b('0x14')]][_0xeb9b('0xa')]=_0xeb9b('0x37');writeDB(agents[_0x311e7d[_0xeb9b('0x14')]]);}}catch(_0x5a7b4a){utils['error'](util['format'](_0xeb9b('0x33'),_0x311e7d['uniqueid']),_0x5a7b4a);}};exports[_0xeb9b('0x38')]=function(_0x2ee59c){try{if(!_[_0xeb9b('0x1b')](agents[_0x2ee59c[_0xeb9b('0x39')]])){utils[_0xeb9b('0x2b')](util[_0xeb9b('0x4')](_0xeb9b('0x3a'),_0x2ee59c[_0xeb9b('0x6')]),_0x2ee59c);utils[_0xeb9b('0x3')](util[_0xeb9b('0x4')]('[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s',_0x2ee59c['uniqueid'],agents[_0x2ee59c[_0xeb9b('0x39')]][_0xeb9b('0x7')],agents[_0x2ee59c['transfereruniqueid']][_0xeb9b('0x6')]));agents[_0x2ee59c['transfereruniqueid']][_0xeb9b('0x3b')]=!![];agents[_0x2ee59c[_0xeb9b('0x39')]]['transfertype']='blind';agents[_0x2ee59c['transfereruniqueid']][_0xeb9b('0x3c')]=_0x2ee59c[_0xeb9b('0x3d')];agents[_0x2ee59c[_0xeb9b('0x39')]]['transferuniqueid']=agents[_0x2ee59c['transfereruniqueid']][_0xeb9b('0x6')];}}catch(_0x1833c2){utils[_0xeb9b('0x1a')](util[_0xeb9b('0x4')](_0xeb9b('0x3a'),_0x2ee59c[_0xeb9b('0x6')]),_0x1833c2);}};exports['attendedtransfer']=function(_0x20dbea){try{utils[_0xeb9b('0x2b')](util['format'](_0xeb9b('0x3e'),_0x20dbea['origtransfereruniqueid']),_0x20dbea);if(_0x20dbea[_0xeb9b('0x3f')]==_0x20dbea[_0xeb9b('0x40')]){if(!_['isNil'](agents[_0x20dbea[_0xeb9b('0x41')]])){utils['info'](util[_0xeb9b('0x4')](_0xeb9b('0x42'),_0x20dbea[_0xeb9b('0x3f')],agents[_0x20dbea[_0xeb9b('0x41')]][_0xeb9b('0x7')]));agents[_0x20dbea['secondtransfereruniqueid']][_0xeb9b('0x3b')]=!![];agents[_0x20dbea[_0xeb9b('0x41')]][_0xeb9b('0x43')]='ATTENDED';agents[_0x20dbea[_0xeb9b('0x41')]][_0xeb9b('0x3c')]=_0x20dbea[_0xeb9b('0x44')];agents[_0x20dbea[_0xeb9b('0x41')]][_0xeb9b('0x45')]=_0x20dbea[_0xeb9b('0x3f')];}if(_0x20dbea[_0xeb9b('0x46')]&&agents[_0x20dbea[_0xeb9b('0x46')]]){agents[_0x20dbea[_0xeb9b('0x46')]][_0xeb9b('0x47')]=0x1;transfers[_0x20dbea[_0xeb9b('0x46')]]=_['clone'](agents[_0x20dbea['transfereeuniqueid']]);transfers[_0x20dbea['transfereeuniqueid']][_0xeb9b('0x9')]=agents[_0x20dbea['secondtransfereruniqueid']][_0xeb9b('0x9')];transfers[_0x20dbea[_0xeb9b('0x46')]][_0xeb9b('0x48')]=agents[_0x20dbea['secondtransfereruniqueid']][_0xeb9b('0x48')];transfers[_0x20dbea[_0xeb9b('0x46')]][_0xeb9b('0x49')]=utils[_0xeb9b('0x16')]();transfers[_0x20dbea[_0xeb9b('0x46')]][_0xeb9b('0x2e')]=utils[_0xeb9b('0x16')]();transfers[_0x20dbea[_0xeb9b('0x46')]]['holdtime']=0x0;transfers[_0x20dbea['transfereeuniqueid']][_0xeb9b('0x47')]=0x2;}}else if(_0x20dbea[_0xeb9b('0x41')]==_0x20dbea[_0xeb9b('0x4a')]){if(!_['isNil'](agents[_0x20dbea[_0xeb9b('0x3f')]])){utils['info'](util[_0xeb9b('0x4')]('[%s][agents][attendedtransfer]\x20agent:%s',_0x20dbea[_0xeb9b('0x3f')],agents[_0x20dbea[_0xeb9b('0x3f')]][_0xeb9b('0x7')]));agents[_0x20dbea[_0xeb9b('0x3f')]][_0xeb9b('0x3b')]=!![];agents[_0x20dbea['origtransfereruniqueid']][_0xeb9b('0x43')]=_0xeb9b('0x4b');agents[_0x20dbea['origtransfereruniqueid']]['transferexten']=_0x20dbea[_0xeb9b('0x4c')];agents[_0x20dbea[_0xeb9b('0x3f')]]['transferuniqueid']=_0x20dbea[_0xeb9b('0x41')];}if(_0x20dbea['transfertargetuniqueid']&&agents[_0x20dbea[_0xeb9b('0x4d')]]){agents[_0x20dbea['transfertargetuniqueid']][_0xeb9b('0x47')]=0x1;transfers[_0x20dbea[_0xeb9b('0x4d')]]=_[_0xeb9b('0x4e')](agents[_0x20dbea[_0xeb9b('0x4d')]]);transfers[_0x20dbea[_0xeb9b('0x4d')]][_0xeb9b('0x9')]=agents[_0x20dbea['origtransfereruniqueid']][_0xeb9b('0x9')];transfers[_0x20dbea[_0xeb9b('0x4d')]]['calleridname']=agents[_0x20dbea[_0xeb9b('0x3f')]][_0xeb9b('0x48')];transfers[_0x20dbea[_0xeb9b('0x4d')]][_0xeb9b('0x49')]=utils['now']();transfers[_0x20dbea[_0xeb9b('0x4d')]][_0xeb9b('0x2e')]=utils['now']();transfers[_0x20dbea[_0xeb9b('0x4d')]][_0xeb9b('0x22')]=0x0;transfers[_0x20dbea[_0xeb9b('0x4d')]][_0xeb9b('0x47')]=0x2;}}}catch(_0x1d1081){utils[_0xeb9b('0x1a')](util[_0xeb9b('0x4')]('[%s][agents][attendedtransfer]',_0x20dbea[_0xeb9b('0x3f')]),_0x1d1081);}};exports[_0xeb9b('0x4f')]=function(_0x5614ba){try{utils[_0xeb9b('0x2b')](util[_0xeb9b('0x4')](_0xeb9b('0x50'),_0x5614ba[_0xeb9b('0x6')]),_0x5614ba);if(agents[_0x5614ba['uniqueid']]&&agents[_0x5614ba[_0xeb9b('0x6')]][_0xeb9b('0x21')]===_0xeb9b('0x20')){if(_0x5614ba[_0xeb9b('0x51')]==='21'){agents[_0x5614ba[_0xeb9b('0x6')]][_0xeb9b('0x21')]=_0xeb9b('0x52');agents[_0x5614ba[_0xeb9b('0x6')]][_0xeb9b('0xa')]=_0xeb9b('0x52');}utils[_0xeb9b('0x3')](util[_0xeb9b('0x4')](_0xeb9b('0x53'),_0x5614ba[_0xeb9b('0x6')],agents[_0x5614ba[_0xeb9b('0x6')]][_0xeb9b('0x7')],agents[_0x5614ba['uniqueid']][_0xeb9b('0x21')],agents[_0x5614ba[_0xeb9b('0x6')]][_0xeb9b('0xa')]));writeDB(agents[_0x5614ba['uniqueid']]);var _0x541729=unanswered[_0xeb9b('0x54')](_0x5614ba['uniqueid']);if(_0x541729>-0x1){unanswered[_0xeb9b('0x55')](_0x541729,0x1);}}if(transfers[_0x5614ba[_0xeb9b('0x6')]]){transfers[_0x5614ba[_0xeb9b('0x6')]][_0xeb9b('0x32')]=!![];transfers[_0x5614ba[_0xeb9b('0x6')]][_0xeb9b('0x35')]=utils[_0xeb9b('0x16')]();transfers[_0x5614ba[_0xeb9b('0x6')]][_0xeb9b('0x24')]=utils[_0xeb9b('0x36')](transfers[_0x5614ba[_0xeb9b('0x6')]][_0xeb9b('0x35')],transfers[_0x5614ba['uniqueid']]['agentconnectAt']);transfers[_0x5614ba[_0xeb9b('0x6')]]['reason']='agent';transfers[_0x5614ba[_0xeb9b('0x6')]]['lastevent']='complete';utils['info'](util[_0xeb9b('0x4')](_0xeb9b('0x53'),_0x5614ba[_0xeb9b('0x6')],transfers[_0x5614ba[_0xeb9b('0x6')]]['membername'],transfers[_0x5614ba[_0xeb9b('0x6')]][_0xeb9b('0x21')],transfers[_0x5614ba[_0xeb9b('0x6')]]['lastevent']));writeDB(transfers[_0x5614ba['uniqueid']],!![]);}if(agents[_0x5614ba[_0xeb9b('0x6')]]&&agents[_0x5614ba['uniqueid']][_0xeb9b('0x2e')]){agents[_0x5614ba['uniqueid']]['agentcomplete']=!![];agents[_0x5614ba[_0xeb9b('0x6')]]['agentcompleteAt']=utils[_0xeb9b('0x16')]();agents[_0x5614ba['uniqueid']]['talktime']=utils[_0xeb9b('0x36')](agents[_0x5614ba[_0xeb9b('0x6')]][_0xeb9b('0x35')],agents[_0x5614ba[_0xeb9b('0x6')]]['agentconnectAt']);agents[_0x5614ba[_0xeb9b('0x6')]][_0xeb9b('0x21')]=agents[_0x5614ba[_0xeb9b('0x6')]][_0xeb9b('0x3b')]?_0xeb9b('0x3b'):_0xeb9b('0x56');agents[_0x5614ba['uniqueid']][_0xeb9b('0xa')]='complete';utils[_0xeb9b('0x3')](util[_0xeb9b('0x4')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x5614ba[_0xeb9b('0x6')],agents[_0x5614ba['uniqueid']][_0xeb9b('0x7')],agents[_0x5614ba['uniqueid']][_0xeb9b('0x21')],agents[_0x5614ba[_0xeb9b('0x6')]][_0xeb9b('0xa')]));writeDB(agents[_0x5614ba[_0xeb9b('0x6')]]);}}catch(_0x31b0c5){utils[_0xeb9b('0x1a')](util[_0xeb9b('0x4')]('[%s][agents][hangup]',_0x5614ba[_0xeb9b('0x6')]),_0x31b0c5);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index 3393043..2fe2668 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 _0xb0ab=['set','startsWith','cdr','appdata','lastIndexOf','includes','noop','gotoif','lodash','./utils','NO\x20ANSWER','ANSWERED','BUSY','FAILED','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','queue','membername','interface','calleridnum','connectedlinenum','accountcode','getUserByInternal','then','UserId','request','CreateVoiceCallReport','uniqueid','newchannel','debug','channel','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','DOCUMENTATION','[%s][calls][newchannel]','newstate','[%s][calls][newstate]','isNil','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','now','linkedid','transfer','answertime','toNumber','[%s][calls][hangup]','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','diffTime','endtime','starttime','billableseconds','error','localtwolinkedid','[%s][calls][attendedtransfer]','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','origtransfereruniqueid','secondtransfererchannel','userfield','_attended','transfertargetchannel','origtransfererchannel','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','varset','variable','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','source','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','\x22\x20<','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-callerid-preview','xmd-callerid','xmcs-queue','xmd-queue','lastapplication','Queue','lastdata','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','sipcallid','[%s][calls][varset]','newexten','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','toLowerCase'];(function(_0x45f39e,_0x9ff29c){var _0x5841b5=function(_0x5a0549){while(--_0x5a0549){_0x45f39e['push'](_0x45f39e['shift']());}};_0x5841b5(++_0x9ff29c);}(_0xb0ab,0x14f));var _0xbb0a=function(_0x415704,_0x267c67){_0x415704=_0x415704-0x0;var _0x482f2e=_0xb0ab[_0x415704];return _0x482f2e;};'use strict';var _=require(_0xbb0a('0x0'));var util=require('util');var utils=require(_0xbb0a('0x1'));var dispositions=[_0xbb0a('0x2'),'FAILED','FAILED',_0xbb0a('0x2'),_0xbb0a('0x2'),_0xbb0a('0x2'),_0xbb0a('0x3'),_0xbb0a('0x4'),_0xbb0a('0x5'),'FAILED',_0xbb0a('0x5')];var channels={};function writeDB(_0x23a053){utils[_0xbb0a('0x6')](util[_0xbb0a('0x7')](_0xbb0a('0x8'),_0x23a053['uniqueid'],_0x23a053['channel'],_0x23a053[_0xbb0a('0x9')],_0x23a053[_0xbb0a('0xa')],_0x23a053[_0xbb0a('0xb')],_0x23a053[_0xbb0a('0xc')],_0x23a053[_0xbb0a('0xd')],_0x23a053['lastevent']));if(_0x23a053[_0xbb0a('0xe')]){utils[_0xbb0a('0xf')](_0x23a053[_0xbb0a('0xe')])[_0xbb0a('0x10')](function(_0x13af94){if(_0x13af94){_0x23a053[_0xbb0a('0x11')]=_0x13af94['id'];}utils[_0xbb0a('0x12')](_0xbb0a('0x13'),_0x23a053);});}else{utils[_0xbb0a('0x12')](_0xbb0a('0x13'),_0x23a053);}if(channels[_0x23a053[_0xbb0a('0x14')]]){delete channels[_0x23a053[_0xbb0a('0x14')]];}}exports[_0xbb0a('0x15')]=function(_0x2e3e70){try{utils[_0xbb0a('0x16')](util['format']('[%s][calls][newchannel]',_0x2e3e70[_0xbb0a('0x14')]),_0x2e3e70);if(_0x2e3e70[_0xbb0a('0x14')]==_0x2e3e70['linkedid']&&_0x2e3e70[_0xbb0a('0x17')]!=_0xbb0a('0x18')){utils[_0xbb0a('0x6')](util['format'](_0xbb0a('0x19'),_0x2e3e70[_0xbb0a('0x14')],_0x2e3e70[_0xbb0a('0x1a')],_0x2e3e70[_0xbb0a('0x1b')]));channels[_0x2e3e70[_0xbb0a('0x14')]]={'uniqueid':_0x2e3e70[_0xbb0a('0x14')],'accountcode':_0x2e3e70[_0xbb0a('0xe')],'source':_0x2e3e70[_0xbb0a('0xc')],'destination':_0x2e3e70['exten'],'destinationcontext':_0x2e3e70['context'],'channel':_0x2e3e70[_0xbb0a('0x17')],'starttime':utils['now'](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0xbb0a('0x2'),'amaflags':_0xbb0a('0x1c')};}}catch(_0x3ebac7){utils['error'](util[_0xbb0a('0x7')](_0xbb0a('0x1d'),_0x2e3e70[_0xbb0a('0x14')]),_0x3ebac7);}};exports[_0xbb0a('0x1e')]=function(_0x47bd94){try{utils['debug'](util['format'](_0xbb0a('0x1f'),_0x47bd94[_0xbb0a('0x14')]),_0x47bd94);if(!_[_0xbb0a('0x20')](channels[_0x47bd94[_0xbb0a('0x14')]])&&_0x47bd94[_0xbb0a('0x21')]==0x6){utils[_0xbb0a('0x6')](util['format'](_0xbb0a('0x22'),_0x47bd94[_0xbb0a('0x14')],_0x47bd94['context'],_0x47bd94[_0xbb0a('0x17')]));if(_[_0xbb0a('0x20')](channels[_0x47bd94['uniqueid']][_0xbb0a('0x23')])){channels[_0x47bd94[_0xbb0a('0x14')]]['systemanswertime']=utils[_0xbb0a('0x24')]();}}else if(!_[_0xbb0a('0x20')](channels[_0x47bd94[_0xbb0a('0x25')]])&&_0x47bd94['channelstate']==0x6&&_0x47bd94['context']!=_0xbb0a('0x26')){utils[_0xbb0a('0x6')](util[_0xbb0a('0x7')]('[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x47bd94[_0xbb0a('0x14')],_0x47bd94[_0xbb0a('0x25')],_0x47bd94[_0xbb0a('0x1a')],_0x47bd94[_0xbb0a('0x17')]));channels[_0x47bd94['linkedid']][_0xbb0a('0xe')]=_0x47bd94['accountcode'];channels[_0x47bd94[_0xbb0a('0x25')]]['destinationchannel']=_0x47bd94[_0xbb0a('0x17')];if(_['isNil'](channels[_0x47bd94[_0xbb0a('0x25')]][_0xbb0a('0x27')])){channels[_0x47bd94['linkedid']]['answertime']=utils[_0xbb0a('0x24')]();}channels[_0x47bd94[_0xbb0a('0x25')]]['disposition']=dispositions[_[_0xbb0a('0x28')](_0x47bd94[_0xbb0a('0x21')])]||_0xbb0a('0x3');}}catch(_0x1b9638){utils['error'](util[_0xbb0a('0x7')]('[%s][calls][newstate]',_0x47bd94[_0xbb0a('0x14')]),_0x1b9638);}};exports['hangup']=function(_0x518a8f){try{if(!_['isNil'](channels[_0x518a8f['uniqueid']])){utils[_0xbb0a('0x16')](util[_0xbb0a('0x7')](_0xbb0a('0x29'),_0x518a8f[_0xbb0a('0x14')]),_0x518a8f);if(_[_0xbb0a('0x20')](channels[_0x518a8f[_0xbb0a('0x14')]]['callerid'])){channels[_0x518a8f['uniqueid']][_0xbb0a('0x2a')]=_0x518a8f[_0xbb0a('0x2b')]+'\x20<'+_0x518a8f[_0xbb0a('0xc')]+'>';}utils[_0xbb0a('0x6')](util['format'](_0xbb0a('0x2c'),_0x518a8f[_0xbb0a('0x14')],channels[_0x518a8f[_0xbb0a('0x14')]][_0xbb0a('0x2a')],_0x518a8f[_0xbb0a('0x2d')]));channels[_0x518a8f[_0xbb0a('0x14')]]['endtime']=utils[_0xbb0a('0x24')]();channels[_0x518a8f[_0xbb0a('0x14')]]['duration']=utils[_0xbb0a('0x2e')](channels[_0x518a8f[_0xbb0a('0x14')]][_0xbb0a('0x2f')],channels[_0x518a8f[_0xbb0a('0x14')]][_0xbb0a('0x30')]);channels[_0x518a8f[_0xbb0a('0x14')]][_0xbb0a('0x31')]=channels[_0x518a8f['uniqueid']][_0xbb0a('0x27')]?utils[_0xbb0a('0x2e')](channels[_0x518a8f[_0xbb0a('0x14')]][_0xbb0a('0x2f')],channels[_0x518a8f['uniqueid']][_0xbb0a('0x27')]):0x0;writeDB(channels[_0x518a8f['uniqueid']]);}}catch(_0x11bdf9){utils[_0xbb0a('0x32')](util['format']('[%s][calls][hangup]',_0x518a8f[_0xbb0a('0x14')]),_0x11bdf9);}};exports['attendedtransfer']=function(_0x567ffa){try{if(!_['isNil'](channels[_0x567ffa[_0xbb0a('0x33')]])){utils[_0xbb0a('0x16')](util['format'](_0xbb0a('0x34'),_0x567ffa['origtransfereruniqueid']),_0x567ffa);if(channels[_0x567ffa[_0xbb0a('0x33')]][_0xbb0a('0x17')]==_0x567ffa[_0xbb0a('0x35')]){utils[_0xbb0a('0x6')](util[_0xbb0a('0x7')](_0xbb0a('0x36'),_0x567ffa[_0xbb0a('0x37')],_0x567ffa[_0xbb0a('0x33')],_0x567ffa[_0xbb0a('0x38')]));channels[_0x567ffa[_0xbb0a('0x33')]]['destinationchannel']=_0x567ffa['secondtransfererchannel'];channels[_0x567ffa[_0xbb0a('0x33')]][_0xbb0a('0x39')]=_0xbb0a('0x3a');}else if(channels[_0x567ffa[_0xbb0a('0x33')]][_0xbb0a('0x17')]=_0x567ffa[_0xbb0a('0x3b')]){utils[_0xbb0a('0x6')](util[_0xbb0a('0x7')]('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x567ffa['origtransfereruniqueid'],_0x567ffa[_0xbb0a('0x33')],_0x567ffa[_0xbb0a('0x3c')]));channels[_0x567ffa[_0xbb0a('0x33')]]['destinationchannel']=_0x567ffa[_0xbb0a('0x3c')];channels[_0x567ffa[_0xbb0a('0x33')]]['userfield']='_attended';}}}catch(_0x4b2f82){utils[_0xbb0a('0x32')](util[_0xbb0a('0x7')](_0xbb0a('0x34'),_0x567ffa['origtransfereruniqueid']),_0x4b2f82);}};exports['musiconholdstart']=function(_0x4441d5){try{if(!_['isNil'](channels[_0x4441d5[_0xbb0a('0x14')]])){utils['debug'](util['format'](_0xbb0a('0x3d'),_0x4441d5[_0xbb0a('0x14')]),_0x4441d5);channels[_0x4441d5[_0xbb0a('0x14')]][_0xbb0a('0x3e')]=utils[_0xbb0a('0x24')]();utils[_0xbb0a('0x6')](util[_0xbb0a('0x7')](_0xbb0a('0x3f'),_0x4441d5[_0xbb0a('0x14')],channels[_0x4441d5['uniqueid']][_0xbb0a('0x3e')]));}}catch(_0x348aa9){utils['error'](util['format'](_0xbb0a('0x3d'),_0x4441d5[_0xbb0a('0x14')]),_0x348aa9);}};exports[_0xbb0a('0x40')]=function(_0x27b9a0){try{if(!_['isNil'](channels[_0x27b9a0['uniqueid']])){utils[_0xbb0a('0x16')](util[_0xbb0a('0x7')](_0xbb0a('0x41'),_0x27b9a0[_0xbb0a('0x14')]),_0x27b9a0);if(!_[_0xbb0a('0x20')](channels[_0x27b9a0[_0xbb0a('0x14')]]['musiconholdstartAt'])){channels[_0x27b9a0[_0xbb0a('0x14')]][_0xbb0a('0x42')]+=utils[_0xbb0a('0x2e')](utils[_0xbb0a('0x24')](),channels[_0x27b9a0[_0xbb0a('0x14')]][_0xbb0a('0x3e')]);utils[_0xbb0a('0x6')](util['format'](_0xbb0a('0x43'),_0x27b9a0[_0xbb0a('0x14')],channels[_0x27b9a0[_0xbb0a('0x14')]][_0xbb0a('0x42')]));delete channels[_0x27b9a0[_0xbb0a('0x14')]][_0xbb0a('0x3e')];}}}catch(_0xaca42){utils[_0xbb0a('0x32')](util[_0xbb0a('0x7')](_0xbb0a('0x41'),_0x27b9a0[_0xbb0a('0x14')]),_0xaca42);}};exports[_0xbb0a('0x44')]=function(_0x5c750a){try{if(!_['isNil'](channels[_0x5c750a[_0xbb0a('0x14')]])){utils[_0xbb0a('0x16')](util[_0xbb0a('0x7')]('[%s][calls][varset]',_0x5c750a[_0xbb0a('0x14')]),_0x5c750a);if(!_['isNil'](_0x5c750a[_0xbb0a('0x45')]['xmd-originatecalleridnum'])){utils[_0xbb0a('0x6')](util['format'](_0xbb0a('0x46'),_0x5c750a[_0xbb0a('0x14')],_0x5c750a[_0xbb0a('0x47')]));channels[_0x5c750a[_0xbb0a('0x14')]][_0xbb0a('0x48')]=_0x5c750a[_0xbb0a('0x47')];}if(!_[_0xbb0a('0x20')](_0x5c750a['variable'][_0xbb0a('0x49')])){utils['info'](util[_0xbb0a('0x7')](_0xbb0a('0x4a'),_0x5c750a[_0xbb0a('0x14')],_0x5c750a[_0xbb0a('0x47')]));channels[_0x5c750a[_0xbb0a('0x14')]][_0xbb0a('0x4b')]=_0x5c750a[_0xbb0a('0x47')];channels[_0x5c750a[_0xbb0a('0x14')]][_0xbb0a('0x2a')]='\x22'+_0x5c750a['value']+_0xbb0a('0x4c')+_0x5c750a[_0xbb0a('0x47')]+'>';}if(!_[_0xbb0a('0x20')](_0x5c750a['variable']['xmd-callerid-preview'])||!_[_0xbb0a('0x20')](_0x5c750a[_0xbb0a('0x45')]['xmd-callerid'])){utils['info'](util[_0xbb0a('0x7')](_0xbb0a('0x4d'),_0x5c750a['uniqueid'],!_[_0xbb0a('0x20')](_0x5c750a[_0xbb0a('0x45')][_0xbb0a('0x4e')])?_0xbb0a('0x4e'):_0xbb0a('0x4f'),_0x5c750a[_0xbb0a('0x47')]));channels[_0x5c750a[_0xbb0a('0x14')]][_0xbb0a('0x2a')]=_0x5c750a['value'];}if(!_[_0xbb0a('0x20')](_0x5c750a[_0xbb0a('0x45')]['xmd-queue'])||!_['isNil'](_0x5c750a[_0xbb0a('0x45')][_0xbb0a('0x50')])){utils['info'](util[_0xbb0a('0x7')](_0xbb0a('0x4d'),_0x5c750a[_0xbb0a('0x14')],!_[_0xbb0a('0x20')](_0x5c750a[_0xbb0a('0x45')][_0xbb0a('0x51')])?_0xbb0a('0x51'):_0xbb0a('0x50'),_0x5c750a[_0xbb0a('0x47')]));channels[_0x5c750a[_0xbb0a('0x14')]][_0xbb0a('0x52')]=_0xbb0a('0x53');channels[_0x5c750a['uniqueid']][_0xbb0a('0x54')]=_0x5c750a[_0xbb0a('0x47')];channels[_0x5c750a['uniqueid']]['queue']=!![];}if(!_[_0xbb0a('0x20')](_0x5c750a[_0xbb0a('0x45')][_0xbb0a('0x55')])){utils[_0xbb0a('0x6')](util[_0xbb0a('0x7')](_0xbb0a('0x56'),_0x5c750a[_0xbb0a('0x14')],_0x5c750a['value']));channels[_0x5c750a[_0xbb0a('0x14')]][_0xbb0a('0x57')]=_0x5c750a[_0xbb0a('0x47')];}if(!_[_0xbb0a('0x20')](_0x5c750a[_0xbb0a('0x45')][_0xbb0a('0x58')])){utils[_0xbb0a('0x6')](util['format'](_0xbb0a('0x59'),_0x5c750a[_0xbb0a('0x14')],_0x5c750a[_0xbb0a('0x47')]));channels[_0x5c750a[_0xbb0a('0x14')]][_0xbb0a('0x5a')]=_0x5c750a[_0xbb0a('0x47')];}if(!_[_0xbb0a('0x20')](_0x5c750a[_0xbb0a('0x45')][_0xbb0a('0x5b')])){utils['info'](util[_0xbb0a('0x7')](_0xbb0a('0x5c'),_0x5c750a[_0xbb0a('0x14')],_0x5c750a[_0xbb0a('0x47')]));channels[_0x5c750a['uniqueid']]['routeid']=_0x5c750a[_0xbb0a('0x47')];}if(!_[_0xbb0a('0x20')](_0x5c750a['variable']['sipcallid'])){utils['info'](util[_0xbb0a('0x7')](_0xbb0a('0x5d'),_0x5c750a[_0xbb0a('0x14')],_0x5c750a['value']));channels[_0x5c750a[_0xbb0a('0x14')]][_0xbb0a('0x5e')]=_0x5c750a[_0xbb0a('0x47')];}}}catch(_0x2735a1){utils[_0xbb0a('0x32')](util[_0xbb0a('0x7')](_0xbb0a('0x5f'),_0x5c750a['uniqueid']),_0x2735a1);}};exports[_0xbb0a('0x60')]=function(_0x214fb4){try{if(!_[_0xbb0a('0x20')](channels[_0x214fb4[_0xbb0a('0x14')]])){utils[_0xbb0a('0x16')](util[_0xbb0a('0x7')](_0xbb0a('0x61'),_0x214fb4[_0xbb0a('0x14')]),_0x214fb4);utils[_0xbb0a('0x6')](util[_0xbb0a('0x7')](_0xbb0a('0x62'),_0x214fb4[_0xbb0a('0x14')],_0x214fb4['application'],_0x214fb4['appdata']));if(_0x214fb4[_0xbb0a('0x63')][_0xbb0a('0x64')]()==_0xbb0a('0x65')&&_[_0xbb0a('0x66')](_0x214fb4['appdata'][_0xbb0a('0x64')](),_0xbb0a('0x67'))){var _0x2035b8=_0x214fb4[_0xbb0a('0x68')]['split']('=');var _0x432fce=_0x2035b8[0x0]['substring'](_0x2035b8[0x0]['lastIndexOf']('(')+0x1,_0x2035b8[0x0][_0xbb0a('0x69')](')'));var _0x4bb882=_0x2035b8[0x1];channels[_0x214fb4['uniqueid']][_0x432fce]=_0x4bb882;}if(!_[_0xbb0a('0x6a')](['hangup',_0xbb0a('0x6b'),'execif',_0xbb0a('0x65'),_0xbb0a('0x6c')],_0x214fb4['application'][_0xbb0a('0x64')]())){channels[_0x214fb4[_0xbb0a('0x14')]][_0xbb0a('0x52')]=_0x214fb4[_0xbb0a('0x63')];channels[_0x214fb4[_0xbb0a('0x14')]]['lastdata']=_0x214fb4[_0xbb0a('0x68')];}}}catch(_0x21ed1c){utils['error'](util[_0xbb0a('0x7')]('[%s][calls][newexten]',_0x214fb4[_0xbb0a('0x14')]),_0x21ed1c);}}; \ No newline at end of file +var _0x39e3=['Queue','lastdata','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','newexten','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','toLowerCase','startsWith','appdata','cdr','split','substring','lastIndexOf','includes','noop','execif','gotoif','lodash','util','./utils','NO\x20ANSWER','FAILED','ANSWERED','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','interface','calleridnum','connectedlinenum','lastevent','accountcode','getUserByInternal','UserId','request','CreateVoiceCallReport','newchannel','format','[%s][calls][newchannel]','linkedid','OutgoingSpoolFailed','info','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','now','DOCUMENTATION','newstate','debug','isNil','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','channelstate','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','answertime','toNumber','error','[%s][calls][hangup]','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','duration','diffTime','billableseconds','localtwolinkedid','[%s][calls][attendedtransfer]','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','origtransfereruniqueid','secondtransfererchannel','destinationchannel','userfield','_attended','origtransfererchannel','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','varset','[%s][calls][varset]','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','source','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','\x22\x20<','variable','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-callerid-preview','xmd-callerid','xmd-queue','xmcs-queue','lastapplication'];(function(_0x4d6554,_0x24a2bf){var _0xd9f05b=function(_0x679c5e){while(--_0x679c5e){_0x4d6554['push'](_0x4d6554['shift']());}};_0xd9f05b(++_0x24a2bf);}(_0x39e3,0x1ce));var _0x339e=function(_0x2e7c85,_0x3fed1c){_0x2e7c85=_0x2e7c85-0x0;var _0x425b1a=_0x39e3[_0x2e7c85];return _0x425b1a;};'use strict';var _=require(_0x339e('0x0'));var util=require(_0x339e('0x1'));var utils=require(_0x339e('0x2'));var dispositions=[_0x339e('0x3'),_0x339e('0x4'),_0x339e('0x4'),_0x339e('0x3'),'NO\x20ANSWER','NO\x20ANSWER',_0x339e('0x5'),'BUSY',_0x339e('0x4'),_0x339e('0x4'),_0x339e('0x4')];var channels={};function writeDB(_0x1f4985){utils['info'](util['format'](_0x339e('0x6'),_0x1f4985[_0x339e('0x7')],_0x1f4985[_0x339e('0x8')],_0x1f4985[_0x339e('0x9')],_0x1f4985['membername'],_0x1f4985[_0x339e('0xa')],_0x1f4985[_0x339e('0xb')],_0x1f4985[_0x339e('0xc')],_0x1f4985[_0x339e('0xd')]));if(_0x1f4985[_0x339e('0xe')]){utils[_0x339e('0xf')](_0x1f4985[_0x339e('0xe')])['then'](function(_0x3e7c63){if(_0x3e7c63){_0x1f4985[_0x339e('0x10')]=_0x3e7c63['id'];}utils[_0x339e('0x11')](_0x339e('0x12'),_0x1f4985);});}else{utils[_0x339e('0x11')](_0x339e('0x12'),_0x1f4985);}if(channels[_0x1f4985[_0x339e('0x7')]]){delete channels[_0x1f4985[_0x339e('0x7')]];}}exports[_0x339e('0x13')]=function(_0x4751ea){try{utils['debug'](util[_0x339e('0x14')](_0x339e('0x15'),_0x4751ea[_0x339e('0x7')]),_0x4751ea);if(_0x4751ea[_0x339e('0x7')]==_0x4751ea[_0x339e('0x16')]&&_0x4751ea[_0x339e('0x8')]!=_0x339e('0x17')){utils[_0x339e('0x18')](util['format'](_0x339e('0x19'),_0x4751ea[_0x339e('0x7')],_0x4751ea[_0x339e('0x1a')],_0x4751ea['exten']));channels[_0x4751ea[_0x339e('0x7')]]={'uniqueid':_0x4751ea[_0x339e('0x7')],'accountcode':_0x4751ea[_0x339e('0xe')],'source':_0x4751ea[_0x339e('0xb')],'destination':_0x4751ea['exten'],'destinationcontext':_0x4751ea[_0x339e('0x1a')],'channel':_0x4751ea[_0x339e('0x8')],'starttime':utils[_0x339e('0x1b')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x339e('0x3'),'amaflags':_0x339e('0x1c')};}}catch(_0x58484e){utils['error'](util[_0x339e('0x14')](_0x339e('0x15'),_0x4751ea[_0x339e('0x7')]),_0x58484e);}};exports[_0x339e('0x1d')]=function(_0x21a2e1){try{utils[_0x339e('0x1e')](util[_0x339e('0x14')]('[%s][calls][newstate]',_0x21a2e1[_0x339e('0x7')]),_0x21a2e1);if(!_[_0x339e('0x1f')](channels[_0x21a2e1[_0x339e('0x7')]])&&_0x21a2e1['channelstate']==0x6){utils['info'](util['format'](_0x339e('0x20'),_0x21a2e1[_0x339e('0x7')],_0x21a2e1[_0x339e('0x1a')],_0x21a2e1[_0x339e('0x8')]));if(_[_0x339e('0x1f')](channels[_0x21a2e1[_0x339e('0x7')]][_0x339e('0x21')])){channels[_0x21a2e1[_0x339e('0x7')]][_0x339e('0x21')]=utils[_0x339e('0x1b')]();}}else if(!_[_0x339e('0x1f')](channels[_0x21a2e1[_0x339e('0x16')]])&&_0x21a2e1[_0x339e('0x22')]==0x6&&_0x21a2e1['context']!=_0x339e('0x23')){utils['info'](util['format'](_0x339e('0x24'),_0x21a2e1[_0x339e('0x7')],_0x21a2e1['linkedid'],_0x21a2e1[_0x339e('0x1a')],_0x21a2e1['channel']));channels[_0x21a2e1[_0x339e('0x16')]][_0x339e('0xe')]=_0x21a2e1[_0x339e('0xe')];channels[_0x21a2e1['linkedid']]['destinationchannel']=_0x21a2e1[_0x339e('0x8')];if(_[_0x339e('0x1f')](channels[_0x21a2e1['linkedid']][_0x339e('0x25')])){channels[_0x21a2e1['linkedid']][_0x339e('0x25')]=utils[_0x339e('0x1b')]();}channels[_0x21a2e1[_0x339e('0x16')]]['disposition']=dispositions[_[_0x339e('0x26')](_0x21a2e1[_0x339e('0x22')])]||_0x339e('0x5');}}catch(_0x23d459){utils[_0x339e('0x27')](util[_0x339e('0x14')]('[%s][calls][newstate]',_0x21a2e1[_0x339e('0x7')]),_0x23d459);}};exports['hangup']=function(_0x5124c6){try{if(!_[_0x339e('0x1f')](channels[_0x5124c6[_0x339e('0x7')]])){utils['debug'](util[_0x339e('0x14')](_0x339e('0x28'),_0x5124c6[_0x339e('0x7')]),_0x5124c6);if(_['isNil'](channels[_0x5124c6['uniqueid']][_0x339e('0x29')])){channels[_0x5124c6['uniqueid']][_0x339e('0x29')]=_0x5124c6[_0x339e('0x2a')]+'\x20<'+_0x5124c6[_0x339e('0xb')]+'>';}utils['info'](util[_0x339e('0x14')](_0x339e('0x2b'),_0x5124c6[_0x339e('0x7')],channels[_0x5124c6[_0x339e('0x7')]][_0x339e('0x29')],_0x5124c6[_0x339e('0x2c')]));channels[_0x5124c6['uniqueid']][_0x339e('0x2d')]=utils[_0x339e('0x1b')]();channels[_0x5124c6[_0x339e('0x7')]][_0x339e('0x2e')]=utils[_0x339e('0x2f')](channels[_0x5124c6[_0x339e('0x7')]]['endtime'],channels[_0x5124c6[_0x339e('0x7')]]['starttime']);channels[_0x5124c6['uniqueid']][_0x339e('0x30')]=channels[_0x5124c6[_0x339e('0x7')]]['answertime']?utils[_0x339e('0x2f')](channels[_0x5124c6[_0x339e('0x7')]][_0x339e('0x2d')],channels[_0x5124c6['uniqueid']][_0x339e('0x25')]):0x0;writeDB(channels[_0x5124c6['uniqueid']]);}}catch(_0x9fe626){utils[_0x339e('0x27')](util[_0x339e('0x14')](_0x339e('0x28'),_0x5124c6[_0x339e('0x7')]),_0x9fe626);}};exports['attendedtransfer']=function(_0x2eb1ac){try{if(!_['isNil'](channels[_0x2eb1ac[_0x339e('0x31')]])){utils[_0x339e('0x1e')](util[_0x339e('0x14')](_0x339e('0x32'),_0x2eb1ac['origtransfereruniqueid']),_0x2eb1ac);if(channels[_0x2eb1ac[_0x339e('0x31')]][_0x339e('0x8')]==_0x2eb1ac[_0x339e('0x33')]){utils[_0x339e('0x18')](util[_0x339e('0x14')](_0x339e('0x34'),_0x2eb1ac[_0x339e('0x35')],_0x2eb1ac['localtwolinkedid'],_0x2eb1ac[_0x339e('0x36')]));channels[_0x2eb1ac['localtwolinkedid']][_0x339e('0x37')]=_0x2eb1ac[_0x339e('0x36')];channels[_0x2eb1ac[_0x339e('0x31')]][_0x339e('0x38')]=_0x339e('0x39');}else if(channels[_0x2eb1ac[_0x339e('0x31')]][_0x339e('0x8')]=_0x2eb1ac['transfertargetchannel']){utils[_0x339e('0x18')](util[_0x339e('0x14')](_0x339e('0x34'),_0x2eb1ac[_0x339e('0x35')],_0x2eb1ac['localtwolinkedid'],_0x2eb1ac['origtransfererchannel']));channels[_0x2eb1ac['localtwolinkedid']][_0x339e('0x37')]=_0x2eb1ac[_0x339e('0x3a')];channels[_0x2eb1ac[_0x339e('0x31')]][_0x339e('0x38')]=_0x339e('0x39');}}}catch(_0x3cef7){utils[_0x339e('0x27')](util[_0x339e('0x14')]('[%s][calls][attendedtransfer]',_0x2eb1ac['origtransfereruniqueid']),_0x3cef7);}};exports[_0x339e('0x3b')]=function(_0x1b7725){try{if(!_[_0x339e('0x1f')](channels[_0x1b7725[_0x339e('0x7')]])){utils['debug'](util[_0x339e('0x14')](_0x339e('0x3c'),_0x1b7725[_0x339e('0x7')]),_0x1b7725);channels[_0x1b7725['uniqueid']][_0x339e('0x3d')]=utils[_0x339e('0x1b')]();utils[_0x339e('0x18')](util[_0x339e('0x14')](_0x339e('0x3e'),_0x1b7725['uniqueid'],channels[_0x1b7725['uniqueid']][_0x339e('0x3d')]));}}catch(_0x1e4f25){utils[_0x339e('0x27')](util[_0x339e('0x14')](_0x339e('0x3c'),_0x1b7725[_0x339e('0x7')]),_0x1e4f25);}};exports[_0x339e('0x3f')]=function(_0x10bffa){try{if(!_[_0x339e('0x1f')](channels[_0x10bffa[_0x339e('0x7')]])){utils['debug'](util['format'](_0x339e('0x40'),_0x10bffa[_0x339e('0x7')]),_0x10bffa);if(!_[_0x339e('0x1f')](channels[_0x10bffa[_0x339e('0x7')]]['musiconholdstartAt'])){channels[_0x10bffa['uniqueid']][_0x339e('0x41')]+=utils[_0x339e('0x2f')](utils[_0x339e('0x1b')](),channels[_0x10bffa[_0x339e('0x7')]][_0x339e('0x3d')]);utils[_0x339e('0x18')](util[_0x339e('0x14')](_0x339e('0x42'),_0x10bffa[_0x339e('0x7')],channels[_0x10bffa['uniqueid']]['mohtime']));delete channels[_0x10bffa['uniqueid']][_0x339e('0x3d')];}}}catch(_0x644669){utils['error'](util[_0x339e('0x14')](_0x339e('0x40'),_0x10bffa[_0x339e('0x7')]),_0x644669);}};exports[_0x339e('0x43')]=function(_0x1ed628){try{if(!_['isNil'](channels[_0x1ed628[_0x339e('0x7')]])){utils[_0x339e('0x1e')](util[_0x339e('0x14')](_0x339e('0x44'),_0x1ed628[_0x339e('0x7')]),_0x1ed628);if(!_['isNil'](_0x1ed628['variable'][_0x339e('0x45')])){utils[_0x339e('0x18')](util['format'](_0x339e('0x46'),_0x1ed628['uniqueid'],_0x1ed628[_0x339e('0x47')]));channels[_0x1ed628['uniqueid']][_0x339e('0x48')]=_0x1ed628['value'];}if(!_['isNil'](_0x1ed628['variable'][_0x339e('0x49')])){utils[_0x339e('0x18')](util[_0x339e('0x14')](_0x339e('0x4a'),_0x1ed628[_0x339e('0x7')],_0x1ed628[_0x339e('0x47')]));channels[_0x1ed628['uniqueid']]['destination']=_0x1ed628['value'];channels[_0x1ed628[_0x339e('0x7')]][_0x339e('0x29')]='\x22'+_0x1ed628[_0x339e('0x47')]+_0x339e('0x4b')+_0x1ed628['value']+'>';}if(!_['isNil'](_0x1ed628[_0x339e('0x4c')]['xmd-callerid-preview'])||!_[_0x339e('0x1f')](_0x1ed628[_0x339e('0x4c')]['xmd-callerid'])){utils['info'](util[_0x339e('0x14')](_0x339e('0x4d'),_0x1ed628[_0x339e('0x7')],!_[_0x339e('0x1f')](_0x1ed628[_0x339e('0x4c')][_0x339e('0x4e')])?'xmd-callerid-preview':_0x339e('0x4f'),_0x1ed628[_0x339e('0x47')]));channels[_0x1ed628['uniqueid']]['callerid']=_0x1ed628[_0x339e('0x47')];}if(!_['isNil'](_0x1ed628['variable'][_0x339e('0x50')])||!_[_0x339e('0x1f')](_0x1ed628[_0x339e('0x4c')]['xmcs-queue'])){utils['info'](util[_0x339e('0x14')]('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x1ed628['uniqueid'],!_['isNil'](_0x1ed628['variable'][_0x339e('0x50')])?'xmd-queue':_0x339e('0x51'),_0x1ed628[_0x339e('0x47')]));channels[_0x1ed628[_0x339e('0x7')]][_0x339e('0x52')]=_0x339e('0x53');channels[_0x1ed628[_0x339e('0x7')]][_0x339e('0x54')]=_0x1ed628[_0x339e('0x47')];channels[_0x1ed628[_0x339e('0x7')]][_0x339e('0x9')]=!![];}if(!_[_0x339e('0x1f')](_0x1ed628[_0x339e('0x4c')][_0x339e('0x55')])){utils[_0x339e('0x18')](util[_0x339e('0x14')](_0x339e('0x56'),_0x1ed628[_0x339e('0x7')],_0x1ed628[_0x339e('0x47')]));channels[_0x1ed628[_0x339e('0x7')]][_0x339e('0x57')]=_0x1ed628['value'];}if(!_[_0x339e('0x1f')](_0x1ed628[_0x339e('0x4c')][_0x339e('0x58')])){utils['info'](util[_0x339e('0x14')](_0x339e('0x59'),_0x1ed628['uniqueid'],_0x1ed628[_0x339e('0x47')]));channels[_0x1ed628[_0x339e('0x7')]]['type']=_0x1ed628[_0x339e('0x47')];}if(!_[_0x339e('0x1f')](_0x1ed628[_0x339e('0x4c')][_0x339e('0x5a')])){utils[_0x339e('0x18')](util[_0x339e('0x14')](_0x339e('0x5b'),_0x1ed628[_0x339e('0x7')],_0x1ed628[_0x339e('0x47')]));channels[_0x1ed628[_0x339e('0x7')]]['routeid']=_0x1ed628[_0x339e('0x47')];}if(!_[_0x339e('0x1f')](_0x1ed628[_0x339e('0x4c')][_0x339e('0x5c')])){utils[_0x339e('0x18')](util[_0x339e('0x14')](_0x339e('0x5d'),_0x1ed628['uniqueid'],_0x1ed628[_0x339e('0x47')]));channels[_0x1ed628[_0x339e('0x7')]][_0x339e('0x5c')]=_0x1ed628[_0x339e('0x47')];}}}catch(_0x27e677){utils['error'](util[_0x339e('0x14')]('[%s][calls][varset]',_0x1ed628[_0x339e('0x7')]),_0x27e677);}};exports[_0x339e('0x5e')]=function(_0xfea42){try{if(!_[_0x339e('0x1f')](channels[_0xfea42[_0x339e('0x7')]])){utils[_0x339e('0x1e')](util['format'](_0x339e('0x5f'),_0xfea42[_0x339e('0x7')]),_0xfea42);utils[_0x339e('0x18')](util[_0x339e('0x14')](_0x339e('0x60'),_0xfea42[_0x339e('0x7')],_0xfea42[_0x339e('0x61')],_0xfea42['appdata']));if(_0xfea42[_0x339e('0x61')][_0x339e('0x62')]()=='set'&&_[_0x339e('0x63')](_0xfea42[_0x339e('0x64')]['toLowerCase'](),_0x339e('0x65'))){var _0x46001b=_0xfea42['appdata'][_0x339e('0x66')]('=');var _0x1e00f9=_0x46001b[0x0][_0x339e('0x67')](_0x46001b[0x0][_0x339e('0x68')]('(')+0x1,_0x46001b[0x0]['lastIndexOf'](')'));var _0x42afb7=_0x46001b[0x1];channels[_0xfea42[_0x339e('0x7')]][_0x1e00f9]=_0x42afb7;}if(!_[_0x339e('0x69')](['hangup',_0x339e('0x6a'),_0x339e('0x6b'),'set',_0x339e('0x6c')],_0xfea42[_0x339e('0x61')][_0x339e('0x62')]())){channels[_0xfea42[_0x339e('0x7')]]['lastapplication']=_0xfea42['application'];channels[_0xfea42[_0x339e('0x7')]][_0x339e('0x54')]=_0xfea42[_0x339e('0x64')];}}}catch(_0x40fdd0){utils['error'](util[_0x339e('0x14')](_0x339e('0x5f'),_0xfea42[_0x339e('0x7')]),_0x40fdd0);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index 773d610..a931c98 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 _0xb4b2=['info','[core]\x20connected','shutdown','[core]\x20shutdown','fullybooted','[core]\x20fullybooted','error','close','./utils','connect'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb4b2,0xe4));var _0x2b4b=function(_0x446225,_0x5453e2){_0x446225=_0x446225-0x0;var _0xa34786=_0xb4b2[_0x446225];return _0xa34786;};'use strict';var utils=require(_0x2b4b('0x0'));exports[_0x2b4b('0x1')]=function(){utils[_0x2b4b('0x2')](_0x2b4b('0x3'));};exports[_0x2b4b('0x4')]=function(){utils['info'](_0x2b4b('0x5'));};exports[_0x2b4b('0x6')]=function(){utils[_0x2b4b('0x2')](_0x2b4b('0x7'));};exports[_0x2b4b('0x8')]=function(_0x43474c){utils[_0x2b4b('0x8')]('[core]\x20error',_0x43474c);};exports[_0x2b4b('0x9')]=function(){utils[_0x2b4b('0x2')]('[core]\x20close');};exports['managerevent']=function(_0x4e71bf){}; \ No newline at end of file +var _0xceee=['./utils','connect','shutdown','info','[core]\x20shutdown','fullybooted','[core]\x20fullybooted','error','[core]\x20error','close','managerevent'];(function(_0x4fe0ce,_0x4868a1){var _0x3be5d4=function(_0xd0a47c){while(--_0xd0a47c){_0x4fe0ce['push'](_0x4fe0ce['shift']());}};_0x3be5d4(++_0x4868a1);}(_0xceee,0xbb));var _0xecee=function(_0x558751,_0x188101){_0x558751=_0x558751-0x0;var _0x170ebd=_0xceee[_0x558751];return _0x170ebd;};'use strict';var utils=require(_0xecee('0x0'));exports[_0xecee('0x1')]=function(){utils['info']('[core]\x20connected');};exports[_0xecee('0x2')]=function(){utils[_0xecee('0x3')](_0xecee('0x4'));};exports[_0xecee('0x5')]=function(){utils[_0xecee('0x3')](_0xecee('0x6'));};exports['error']=function(_0x7f6107){utils[_0xecee('0x7')](_0xecee('0x8'),_0x7f6107);};exports[_0xecee('0x9')]=function(){utils['info']('[core]\x20close');};exports[_0xecee('0xa')]=function(_0x1b9e82){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index 32920de..21c37d5 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 _0x9db4=['cause-txt','now','complete','holdtime','billableseconds','diffTime','endtime','lodash','util','info','format','uniqueid','channel','dialstring','connectedlinenum','dialstatus','request','CreateVoiceDialReport','newexten','debug','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','toLowerCase','appdata','error','[%s][dials][varset]','variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','dialbegin','[%s][dials][dialbegin]','assign','starttime','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','isNil','[%s][dials][dialend]','ANSWER','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','answertime','[%s][dials][dialend]\x20dialstatus:%s','[%s][dials][hangup]','calleridnum','calleridname'];(function(_0xef4cf0,_0x16c9c3){var _0x497ad2=function(_0xce63d4){while(--_0xce63d4){_0xef4cf0['push'](_0xef4cf0['shift']());}};_0x497ad2(++_0x16c9c3);}(_0x9db4,0x97));var _0x49db=function(_0x1915b0,_0x192cea){_0x1915b0=_0x1915b0-0x0;var _0x4ba9e2=_0x9db4[_0x1915b0];return _0x4ba9e2;};'use strict';var _=require(_0x49db('0x0'));var util=require(_0x49db('0x1'));var utils=require('./utils');var dials={};function writeDB(_0x2f9393){utils[_0x49db('0x2')](util[_0x49db('0x3')]('[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s',_0x2f9393[_0x49db('0x4')],_0x2f9393[_0x49db('0x5')],_0x2f9393[_0x49db('0x6')],_0x2f9393['calleridnum'],_0x2f9393[_0x49db('0x7')],_0x2f9393[_0x49db('0x8')]));utils[_0x49db('0x9')](_0x49db('0xa'),_0x2f9393);delete dials[_0x2f9393[_0x49db('0x4')]];}exports[_0x49db('0xb')]=function(_0x132d87){try{utils[_0x49db('0xc')](util['format'](_0x49db('0xd'),_0x132d87[_0x49db('0x4')]),_0x132d87);utils[_0x49db('0x2')](util[_0x49db('0x3')](_0x49db('0xe'),_0x132d87[_0x49db('0x4')],_0x132d87[_0x49db('0xf')],_0x132d87['appdata']));if(_0x132d87[_0x49db('0xf')][_0x49db('0x10')]()=='set'&&_['startsWith'](_0x132d87[_0x49db('0x11')][_0x49db('0x10')](),'cdr(routeid)')){var _0x5379c1=_0x132d87[_0x49db('0x11')]['split']('=');dials[_0x132d87['uniqueid']]={'routeId':_0x5379c1[0x1]};}}catch(_0x1f0c5e){utils[_0x49db('0x12')](util[_0x49db('0x3')](_0x49db('0xd'),_0x132d87['uniqueid']),_0x1f0c5e);}};exports['varset']=function(_0xac956a){try{utils['debug'](util[_0x49db('0x3')](_0x49db('0x13'),_0xac956a['uniqueid']),_0xac956a);if(!_['isNil'](_0xac956a[_0x49db('0x14')][_0x49db('0x15')])){utils[_0x49db('0x2')](util[_0x49db('0x3')](_0x49db('0x16'),_0xac956a[_0x49db('0x4')],_0xac956a[_0x49db('0x17')]));dials[_0xac956a[_0x49db('0x4')]]={'routeId':_0xac956a[_0x49db('0x17')]};}}catch(_0x115273){utils['error'](util[_0x49db('0x3')](_0x49db('0x13'),_0xac956a['uniqueid']),_0x115273);}};exports[_0x49db('0x18')]=function(_0x356f75){try{if(!_['isNil'](dials[_0x356f75[_0x49db('0x4')]])){utils['debug'](util[_0x49db('0x3')](_0x49db('0x19'),_0x356f75[_0x49db('0x4')]),_0x356f75);dials[_0x356f75[_0x49db('0x4')]]=_[_0x49db('0x1a')](dials[_0x356f75[_0x49db('0x4')]],_0x356f75);dials[_0x356f75[_0x49db('0x4')]][_0x49db('0x1b')]=utils['now']();dials[_0x356f75[_0x49db('0x4')]][_0x49db('0x1c')]=_0x49db('0x1d');utils[_0x49db('0x2')](util[_0x49db('0x3')](_0x49db('0x1e'),_0x356f75['uniqueid'],dials[_0x356f75[_0x49db('0x4')]][_0x49db('0x1b')]));}}catch(_0x5ec8bd){utils['error'](util[_0x49db('0x3')](_0x49db('0x19'),_0x356f75[_0x49db('0x4')]),_0x5ec8bd);}};exports['dialend']=function(_0x1dcb86){try{if(!_[_0x49db('0x1f')](dials[_0x1dcb86['uniqueid']])){utils[_0x49db('0xc')](util['format'](_0x49db('0x20'),_0x1dcb86[_0x49db('0x4')]),_0x1dcb86);dials[_0x1dcb86[_0x49db('0x4')]][_0x49db('0x8')]=_0x1dcb86[_0x49db('0x8')];if(_0x1dcb86[_0x49db('0x8')]==_0x49db('0x21')){dials[_0x1dcb86[_0x49db('0x4')]]=_[_0x49db('0x1a')](dials[_0x1dcb86[_0x49db('0x4')]],_0x1dcb86);dials[_0x1dcb86['uniqueid']]['answertime']=utils['now']();dials[_0x1dcb86[_0x49db('0x4')]]['lastevent']=_0x49db('0x22');utils[_0x49db('0x2')](util['format'](_0x49db('0x23'),_0x1dcb86['uniqueid'],_0x1dcb86['dialstatus'],dials[_0x1dcb86[_0x49db('0x4')]][_0x49db('0x24')]));}else{utils[_0x49db('0x2')](util[_0x49db('0x3')](_0x49db('0x25'),_0x1dcb86[_0x49db('0x4')],_0x1dcb86[_0x49db('0x8')]));}}}catch(_0x2c50f9){utils[_0x49db('0x12')](util['format'](_0x49db('0x20'),_0x1dcb86[_0x49db('0x4')]),_0x2c50f9);}};exports['hangup']=function(_0x301a98){try{if(!_[_0x49db('0x1f')](dials[_0x301a98['uniqueid']])){utils[_0x49db('0xc')](util[_0x49db('0x3')](_0x49db('0x26'),_0x301a98[_0x49db('0x4')]),_0x301a98);utils[_0x49db('0x2')](util[_0x49db('0x3')]('[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s',_0x301a98[_0x49db('0x4')],_0x301a98[_0x49db('0x27')],_0x301a98[_0x49db('0x28')],_0x301a98[_0x49db('0x29')]));dials[_0x301a98[_0x49db('0x4')]]=_[_0x49db('0x1a')](dials[_0x301a98['uniqueid']],{'endtime':utils[_0x49db('0x2a')](),'lastevent':_0x49db('0x2b')});dials[_0x301a98[_0x49db('0x4')]]['duration']=utils['diffTime'](dials[_0x301a98[_0x49db('0x4')]]['endtime'],dials[_0x301a98[_0x49db('0x4')]][_0x49db('0x1b')]);dials[_0x301a98[_0x49db('0x4')]][_0x49db('0x2c')]=utils['diffTime'](dials[_0x301a98[_0x49db('0x4')]][_0x49db('0x24')]||dials[_0x301a98[_0x49db('0x4')]]['endtime'],dials[_0x301a98['uniqueid']]['starttime']);dials[_0x301a98[_0x49db('0x4')]][_0x49db('0x2d')]=dials[_0x301a98[_0x49db('0x4')]]['answertime']?utils[_0x49db('0x2e')](dials[_0x301a98['uniqueid']][_0x49db('0x2f')],dials[_0x301a98['uniqueid']][_0x49db('0x24')]):0x0;writeDB(dials[_0x301a98['uniqueid']]);}}catch(_0x29b9d7){utils[_0x49db('0x12')](util['format'](_0x49db('0x26'),_0x301a98[_0x49db('0x4')]),_0x29b9d7);}}; \ No newline at end of file +var _0x5f44=['duration','endtime','holdtime','diffTime','billableseconds','lodash','util','./utils','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','dialstring','calleridnum','dialstatus','request','CreateVoiceDialReport','debug','[%s][dials][newexten]','application','appdata','set','startsWith','toLowerCase','cdr(routeid)','split','error','isNil','variable','outboundrouteid','value','dialbegin','[%s][dials][dialbegin]','starttime','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','dialend','[%s][dials][dialend]','ANSWER','answertime','now','connect','hangup','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname','cause-txt','assign','complete'];(function(_0x507b73,_0x446a33){var _0x5a00ce=function(_0x3d9fcb){while(--_0x3d9fcb){_0x507b73['push'](_0x507b73['shift']());}};_0x5a00ce(++_0x446a33);}(_0x5f44,0x1be));var _0x45f4=function(_0x41e0bb,_0x585f52){_0x41e0bb=_0x41e0bb-0x0;var _0x12838a=_0x5f44[_0x41e0bb];return _0x12838a;};'use strict';var _=require(_0x45f4('0x0'));var util=require(_0x45f4('0x1'));var utils=require(_0x45f4('0x2'));var dials={};function writeDB(_0x5cf315){utils[_0x45f4('0x3')](util[_0x45f4('0x4')](_0x45f4('0x5'),_0x5cf315[_0x45f4('0x6')],_0x5cf315['channel'],_0x5cf315[_0x45f4('0x7')],_0x5cf315[_0x45f4('0x8')],_0x5cf315['connectedlinenum'],_0x5cf315[_0x45f4('0x9')]));utils[_0x45f4('0xa')](_0x45f4('0xb'),_0x5cf315);delete dials[_0x5cf315[_0x45f4('0x6')]];}exports['newexten']=function(_0x4d8d59){try{utils[_0x45f4('0xc')](util[_0x45f4('0x4')](_0x45f4('0xd'),_0x4d8d59[_0x45f4('0x6')]),_0x4d8d59);utils[_0x45f4('0x3')](util[_0x45f4('0x4')]('[%s][dials][newexten]\x20application:%s\x20appdata:%s',_0x4d8d59[_0x45f4('0x6')],_0x4d8d59[_0x45f4('0xe')],_0x4d8d59[_0x45f4('0xf')]));if(_0x4d8d59['application']['toLowerCase']()==_0x45f4('0x10')&&_[_0x45f4('0x11')](_0x4d8d59[_0x45f4('0xf')][_0x45f4('0x12')](),_0x45f4('0x13'))){var _0x2ec4fa=_0x4d8d59[_0x45f4('0xf')][_0x45f4('0x14')]('=');dials[_0x4d8d59['uniqueid']]={'routeId':_0x2ec4fa[0x1]};}}catch(_0x512e2f){utils[_0x45f4('0x15')](util[_0x45f4('0x4')](_0x45f4('0xd'),_0x4d8d59['uniqueid']),_0x512e2f);}};exports['varset']=function(_0x53b2bf){try{utils['debug'](util[_0x45f4('0x4')]('[%s][dials][varset]',_0x53b2bf[_0x45f4('0x6')]),_0x53b2bf);if(!_[_0x45f4('0x16')](_0x53b2bf[_0x45f4('0x17')][_0x45f4('0x18')])){utils[_0x45f4('0x3')](util['format']('[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s',_0x53b2bf[_0x45f4('0x6')],_0x53b2bf[_0x45f4('0x19')]));dials[_0x53b2bf[_0x45f4('0x6')]]={'routeId':_0x53b2bf[_0x45f4('0x19')]};}}catch(_0x2c1ef1){utils[_0x45f4('0x15')](util[_0x45f4('0x4')]('[%s][dials][varset]',_0x53b2bf[_0x45f4('0x6')]),_0x2c1ef1);}};exports[_0x45f4('0x1a')]=function(_0x394070){try{if(!_[_0x45f4('0x16')](dials[_0x394070[_0x45f4('0x6')]])){utils['debug'](util[_0x45f4('0x4')](_0x45f4('0x1b'),_0x394070[_0x45f4('0x6')]),_0x394070);dials[_0x394070[_0x45f4('0x6')]]=_['assign'](dials[_0x394070[_0x45f4('0x6')]],_0x394070);dials[_0x394070['uniqueid']][_0x45f4('0x1c')]=utils['now']();dials[_0x394070[_0x45f4('0x6')]]['lastevent']=_0x45f4('0x1d');utils['info'](util[_0x45f4('0x4')](_0x45f4('0x1e'),_0x394070['uniqueid'],dials[_0x394070[_0x45f4('0x6')]][_0x45f4('0x1c')]));}}catch(_0x3b1748){utils[_0x45f4('0x15')](util[_0x45f4('0x4')](_0x45f4('0x1b'),_0x394070[_0x45f4('0x6')]),_0x3b1748);}};exports[_0x45f4('0x1f')]=function(_0x183241){try{if(!_[_0x45f4('0x16')](dials[_0x183241[_0x45f4('0x6')]])){utils[_0x45f4('0xc')](util[_0x45f4('0x4')](_0x45f4('0x20'),_0x183241[_0x45f4('0x6')]),_0x183241);dials[_0x183241[_0x45f4('0x6')]][_0x45f4('0x9')]=_0x183241['dialstatus'];if(_0x183241[_0x45f4('0x9')]==_0x45f4('0x21')){dials[_0x183241[_0x45f4('0x6')]]=_['assign'](dials[_0x183241[_0x45f4('0x6')]],_0x183241);dials[_0x183241['uniqueid']][_0x45f4('0x22')]=utils[_0x45f4('0x23')]();dials[_0x183241[_0x45f4('0x6')]]['lastevent']=_0x45f4('0x24');utils[_0x45f4('0x3')](util[_0x45f4('0x4')]('[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect',_0x183241[_0x45f4('0x6')],_0x183241[_0x45f4('0x9')],dials[_0x183241[_0x45f4('0x6')]][_0x45f4('0x22')]));}else{utils[_0x45f4('0x3')](util['format']('[%s][dials][dialend]\x20dialstatus:%s',_0x183241[_0x45f4('0x6')],_0x183241[_0x45f4('0x9')]));}}}catch(_0x2b54ad){utils[_0x45f4('0x15')](util[_0x45f4('0x4')](_0x45f4('0x20'),_0x183241[_0x45f4('0x6')]),_0x2b54ad);}};exports[_0x45f4('0x25')]=function(_0x2231eb){try{if(!_['isNil'](dials[_0x2231eb[_0x45f4('0x6')]])){utils[_0x45f4('0xc')](util[_0x45f4('0x4')](_0x45f4('0x26'),_0x2231eb[_0x45f4('0x6')]),_0x2231eb);utils['info'](util[_0x45f4('0x4')](_0x45f4('0x27'),_0x2231eb['uniqueid'],_0x2231eb[_0x45f4('0x8')],_0x2231eb[_0x45f4('0x28')],_0x2231eb[_0x45f4('0x29')]));dials[_0x2231eb[_0x45f4('0x6')]]=_[_0x45f4('0x2a')](dials[_0x2231eb[_0x45f4('0x6')]],{'endtime':utils['now'](),'lastevent':_0x45f4('0x2b')});dials[_0x2231eb[_0x45f4('0x6')]][_0x45f4('0x2c')]=utils['diffTime'](dials[_0x2231eb['uniqueid']][_0x45f4('0x2d')],dials[_0x2231eb[_0x45f4('0x6')]][_0x45f4('0x1c')]);dials[_0x2231eb[_0x45f4('0x6')]][_0x45f4('0x2e')]=utils[_0x45f4('0x2f')](dials[_0x2231eb[_0x45f4('0x6')]]['answertime']||dials[_0x2231eb[_0x45f4('0x6')]]['endtime'],dials[_0x2231eb[_0x45f4('0x6')]]['starttime']);dials[_0x2231eb[_0x45f4('0x6')]][_0x45f4('0x30')]=dials[_0x2231eb[_0x45f4('0x6')]][_0x45f4('0x22')]?utils[_0x45f4('0x2f')](dials[_0x2231eb['uniqueid']][_0x45f4('0x2d')],dials[_0x2231eb['uniqueid']][_0x45f4('0x22')]):0x0;writeDB(dials[_0x2231eb[_0x45f4('0x6')]]);}}catch(_0x4ffd48){utils[_0x45f4('0x15')](util[_0x45f4('0x4')](_0x45f4('0x26'),_0x2231eb[_0x45f4('0x6')]),_0x4ffd48);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index d5fd102..81eca11 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 _0x0261=['[%s][index][hangup]','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','[%s][index][attendedtransfer]','origtransfereruniqueid','attendedtransfer','varset','[%s][index][varset]','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','[%s][index][dialbegin]','dialbegin','[%s]dialbegin','[%s][index][dialend]','dialend','../../config/environment','util','disabled','xdr','env','production','local','asterisk','username','password','keepConnected','info','XDR\x20DISABLED','Asterisk\x20disabled\x20on\x20localhost','./agents.controller','./calls.controller','./queues.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','close','managerevent','devicestatechange','debug','format','device','[%s][index][devicestatechange]','[%s][index][agentcalled]','uniqueid','agentcalled','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','error','agentcomplete','[%s][index][agentcomplete]','[%s][index][queuecallerabandon]','queuecallerabandon','queuecallerjoin','[%s][index][queuecallerjoin]','[%s][index][queuecallerleave]','queuecallerleave','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','hangup'];(function(_0x232cd7,_0x5b5985){var _0x51f9f9=function(_0x2c16ee){while(--_0x2c16ee){_0x232cd7['push'](_0x232cd7['shift']());}};_0x51f9f9(++_0x5b5985);}(_0x0261,0x17a));var _0x1026=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0x0261[_0x21549c];return _0x426cbd;};var AsteriskManager=require('asterisk-manager');var config=require(_0x1026('0x0'));var utils=require('./utils');var util=require(_0x1026('0x1'));var isXDREnabled=config['xdr']&&config['xdr'][_0x1026('0x2')]?!config[_0x1026('0x3')][_0x1026('0x2')]:!![];var isProduction=config[_0x1026('0x4')]===_0x1026('0x5')||![];var isLocalAsterisk=config[_0x1026('0x3')]&&config[_0x1026('0x3')][_0x1026('0x6')]===!![]||![];var ami=new AsteriskManager(config[_0x1026('0x7')]['port'],config['asterisk']['ip'],config[_0x1026('0x7')][_0x1026('0x8')],config[_0x1026('0x7')][_0x1026('0x9')],!![]);ami[_0x1026('0xa')]();if(!isXDREnabled){utils[_0x1026('0xb')](_0x1026('0xc'));}else if(!isProduction&&!isLocalAsterisk){utils[_0x1026('0xb')](_0x1026('0xd'));}else{var agents=require(_0x1026('0xe'));var calls=require(_0x1026('0xf'));var queues=require(_0x1026('0x10'));var recordings=require('./recordings.controller');var members=require(_0x1026('0x11'));var dials=require(_0x1026('0x12'));var transfers=require(_0x1026('0x13'));var core=require(_0x1026('0x14'));ami['on'](_0x1026('0x15'),core[_0x1026('0x15')]);ami['on'](_0x1026('0x16'),core['shutdown']);ami['on'](_0x1026('0x17'),core['fullybooted']);ami['on']('error',core['error']);ami['on'](_0x1026('0x18'),core['close']);ami['on'](_0x1026('0x19'),core[_0x1026('0x19')]);ami['on'](_0x1026('0x1a'),function(_0x5e0d36){try{utils[_0x1026('0x1b')](util[_0x1026('0x1c')]('[%s][index][devicestatechange]',_0x5e0d36[_0x1026('0x1d')]),_0x5e0d36);members[_0x1026('0x1a')](_0x5e0d36);}catch(_0x4a2aa1){utils['error'](util[_0x1026('0x1c')](_0x1026('0x1e'),_0x5e0d36[_0x1026('0x1d')]),_0x4a2aa1);}});ami['on']('agentcalled',function(_0x427f6c){try{utils[_0x1026('0x1b')](util[_0x1026('0x1c')](_0x1026('0x1f'),_0x427f6c[_0x1026('0x20')]),_0x427f6c);agents[_0x1026('0x21')](_0x427f6c);}catch(_0x538c33){utils['error'](util['format'](_0x1026('0x1f'),_0x427f6c[_0x1026('0x20')]),_0x538c33);}});ami['on'](_0x1026('0x22'),function(_0xdadfcf){try{utils['debug'](util[_0x1026('0x1c')](_0x1026('0x23'),_0xdadfcf[_0x1026('0x20')]),_0xdadfcf);agents['agentringnoanswer'](_0xdadfcf);}catch(_0x217b55){utils['error'](util[_0x1026('0x1c')]('[%s][index][agentringnoanswer]',_0xdadfcf[_0x1026('0x20')]),_0x217b55);}});ami['on'](_0x1026('0x24'),function(_0x525cb7){try{utils['debug'](util['format'](_0x1026('0x25'),_0x525cb7[_0x1026('0x20')]),_0x525cb7);agents[_0x1026('0x24')](_0x525cb7);queues[_0x1026('0x24')](_0x525cb7);}catch(_0x379ace){utils[_0x1026('0x26')](util['format']('[%s][index][agentconnect]',_0x525cb7[_0x1026('0x20')]),_0x379ace);}});ami['on'](_0x1026('0x27'),function(_0x1fa8d3){try{utils['debug'](util[_0x1026('0x1c')]('[%s][index][agentcomplete]',_0x1fa8d3[_0x1026('0x20')]),_0x1fa8d3);agents[_0x1026('0x27')](_0x1fa8d3);queues['agentcomplete'](_0x1fa8d3);members[_0x1026('0x27')](_0x1fa8d3);}catch(_0x46d285){utils[_0x1026('0x26')](util['format'](_0x1026('0x28'),_0x1fa8d3[_0x1026('0x20')]),_0x46d285);}});ami['on']('queuecallerabandon',function(_0x276355){try{utils[_0x1026('0x1b')](util[_0x1026('0x1c')](_0x1026('0x29'),_0x276355[_0x1026('0x20')]),_0x276355);agents[_0x1026('0x2a')](_0x276355);queues['queuecallerabandon'](_0x276355);}catch(_0x461a73){utils[_0x1026('0x26')](util[_0x1026('0x1c')]('[%s][index][queuecallerabandon]',_0x276355[_0x1026('0x20')]),_0x461a73);}});ami['on'](_0x1026('0x2b'),function(_0x37931d){try{utils[_0x1026('0x1b')](util['format'](_0x1026('0x2c'),_0x37931d[_0x1026('0x20')]),_0x37931d);queues[_0x1026('0x2b')](_0x37931d);recordings[_0x1026('0x2b')](_0x37931d);}catch(_0x1ff30e){utils['error'](util[_0x1026('0x1c')](_0x1026('0x2c'),_0x37931d[_0x1026('0x20')]),_0x1ff30e);}});ami['on']('queuecallerleave',function(_0x21b9ea){try{utils['debug'](util['format'](_0x1026('0x2d'),_0x21b9ea[_0x1026('0x20')]),_0x21b9ea);queues[_0x1026('0x2e')](_0x21b9ea);}catch(_0x400711){utils[_0x1026('0x26')](util['format'](_0x1026('0x2d'),_0x21b9ea[_0x1026('0x20')]),_0x400711);}});ami['on'](_0x1026('0x2f'),function(_0x5675d9){try{utils[_0x1026('0x1b')](util[_0x1026('0x1c')](_0x1026('0x30'),_0x5675d9[_0x1026('0x20')]),_0x5675d9);queues['musiconholdstart'](_0x5675d9);calls[_0x1026('0x2f')](_0x5675d9);}catch(_0x4243c9){utils['error'](util[_0x1026('0x1c')](_0x1026('0x30'),_0x5675d9['uniqueid']),_0x4243c9);}});ami['on'](_0x1026('0x31'),function(_0x4f572f){try{utils['debug'](util['format'](_0x1026('0x32'),_0x4f572f[_0x1026('0x20')]),_0x4f572f);queues[_0x1026('0x31')](_0x4f572f);calls[_0x1026('0x31')](_0x4f572f);}catch(_0x13fa02){utils[_0x1026('0x26')](util[_0x1026('0x1c')](_0x1026('0x32'),_0x4f572f[_0x1026('0x20')]),_0x13fa02);}});ami['on'](_0x1026('0x33'),function(_0x106e17){try{utils[_0x1026('0x1b')](util[_0x1026('0x1c')](_0x1026('0x34'),_0x106e17['uniqueid']),_0x106e17);calls[_0x1026('0x33')](_0x106e17);recordings['newstate'](_0x106e17);}catch(_0x305205){utils[_0x1026('0x26')](util[_0x1026('0x1c')](_0x1026('0x34'),_0x106e17[_0x1026('0x20')]),_0x305205);}});ami['on'](_0x1026('0x35'),function(_0x8dafd){try{utils[_0x1026('0x1b')](util[_0x1026('0x1c')](_0x1026('0x36'),_0x8dafd[_0x1026('0x20')]),_0x8dafd);calls[_0x1026('0x35')](_0x8dafd);recordings[_0x1026('0x35')](_0x8dafd);dials[_0x1026('0x35')](_0x8dafd);agents[_0x1026('0x35')](_0x8dafd);queues[_0x1026('0x35')](_0x8dafd);}catch(_0x346a44){utils[_0x1026('0x26')](util[_0x1026('0x1c')]('[%s][index][hangup]',_0x8dafd[_0x1026('0x20')]),_0x346a44);}});ami['on']('cdr',function(_0x201985){try{utils[_0x1026('0x1b')](util[_0x1026('0x1c')](_0x1026('0x37'),_0x201985[_0x1026('0x20')]),_0x201985);members['cdr'](_0x201985);}catch(_0x52eeef){utils['error'](util[_0x1026('0x1c')]('[%s][index][cdr]',_0x201985[_0x1026('0x20')]),_0x52eeef);}});ami['on'](_0x1026('0x38'),function(_0x375bd3){try{utils['debug'](util[_0x1026('0x1c')]('[%s][index][blindtransfer]',_0x375bd3[_0x1026('0x20')]),_0x375bd3);queues[_0x1026('0x38')](_0x375bd3);agents[_0x1026('0x38')](_0x375bd3);transfers[_0x1026('0x38')](_0x375bd3);}catch(_0x4493b9){utils['error'](util[_0x1026('0x1c')](_0x1026('0x39'),_0x375bd3[_0x1026('0x20')]),_0x4493b9);}});ami['on']('attendedtransfer',function(_0x460ccf){try{utils['debug'](util[_0x1026('0x1c')](_0x1026('0x3a'),_0x460ccf[_0x1026('0x3b')]),_0x460ccf);queues[_0x1026('0x3c')](_0x460ccf);transfers['attendedtransfer'](_0x460ccf);agents[_0x1026('0x3c')](_0x460ccf);calls[_0x1026('0x3c')](_0x460ccf);}catch(_0x32b1c2){utils[_0x1026('0x26')](util[_0x1026('0x1c')](_0x1026('0x3a'),_0x460ccf[_0x1026('0x3b')]),_0x32b1c2);}});ami['on'](_0x1026('0x3d'),function(_0x28d5dc){try{utils['debug'](util['format'](_0x1026('0x3e'),_0x28d5dc[_0x1026('0x20')]),_0x28d5dc);queues[_0x1026('0x3d')](_0x28d5dc);recordings[_0x1026('0x3d')](_0x28d5dc);calls[_0x1026('0x3d')](_0x28d5dc);dials[_0x1026('0x3d')](_0x28d5dc);}catch(_0x1b3f39){utils[_0x1026('0x26')](util[_0x1026('0x1c')](_0x1026('0x3e'),_0x28d5dc[_0x1026('0x20')]),_0x1b3f39);}});ami['on'](_0x1026('0x3f'),function(_0x1f94be){try{utils['debug'](util[_0x1026('0x1c')](_0x1026('0x40'),_0x1f94be[_0x1026('0x20')]),_0x1f94be);calls['newexten'](_0x1f94be);recordings[_0x1026('0x3f')](_0x1f94be);dials[_0x1026('0x3f')](_0x1f94be);}catch(_0x2e5463){utils[_0x1026('0x26')](util[_0x1026('0x1c')]('[%s][index][newexten]',_0x1f94be[_0x1026('0x20')]),_0x2e5463);}});ami['on'](_0x1026('0x41'),function(_0x513f2d){try{utils[_0x1026('0x1b')](util[_0x1026('0x1c')](_0x1026('0x42'),_0x513f2d[_0x1026('0x20')]),_0x513f2d);calls[_0x1026('0x41')](_0x513f2d);recordings[_0x1026('0x41')](_0x513f2d);}catch(_0x126b04){utils[_0x1026('0x26')](util[_0x1026('0x1c')](_0x1026('0x42'),_0x513f2d[_0x1026('0x20')]),_0x126b04);}});ami['on']('dialbegin',function(_0x33cd5a){try{utils[_0x1026('0x1b')](util[_0x1026('0x1c')](_0x1026('0x43'),_0x33cd5a[_0x1026('0x20')]),_0x33cd5a);dials[_0x1026('0x44')](_0x33cd5a);}catch(_0x55982d){utils[_0x1026('0x26')](util[_0x1026('0x1c')](_0x1026('0x45'),_0x33cd5a[_0x1026('0x20')]),_0x55982d);}});ami['on']('dialend',function(_0x19cf7c){try{utils[_0x1026('0x1b')](util['format'](_0x1026('0x46'),_0x19cf7c[_0x1026('0x20')]),_0x19cf7c);dials[_0x1026('0x47')](_0x19cf7c);}catch(_0x1b369e){utils['error'](util['format'](_0x1026('0x46'),_0x19cf7c[_0x1026('0x20')]),_0x1b369e);}});} \ No newline at end of file +var _0x4dd6=['[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%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]','[%s][index][attendedtransfer]','attendedtransfer','varset','[%s][index][varset]','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','dialbegin','[%s][index][dialbegin]','[%s]dialbegin','dialend','[%s][index][dialend]','asterisk-manager','../../config/environment','./utils','util','xdr','disabled','env','production','asterisk','port','username','password','info','XDR\x20DISABLED','Asterisk\x20disabled\x20on\x20localhost','./agents.controller','./calls.controller','./queues.controller','./recordings.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','debug','format','[%s][index][devicestatechange]','device','devicestatechange','agentcalled','uniqueid','[%s][index][agentcalled]','[%s][index][agentringnoanswer]','agentringnoanswer','agentconnect'];(function(_0x45310c,_0x106a46){var _0x5e941f=function(_0x17f122){while(--_0x17f122){_0x45310c['push'](_0x45310c['shift']());}};_0x5e941f(++_0x106a46);}(_0x4dd6,0x1d8));var _0x64dd=function(_0xe04f8f,_0x35ba54){_0xe04f8f=_0xe04f8f-0x0;var _0x4725ce=_0x4dd6[_0xe04f8f];return _0x4725ce;};var AsteriskManager=require(_0x64dd('0x0'));var config=require(_0x64dd('0x1'));var utils=require(_0x64dd('0x2'));var util=require(_0x64dd('0x3'));var isXDREnabled=config[_0x64dd('0x4')]&&config[_0x64dd('0x4')][_0x64dd('0x5')]?!config[_0x64dd('0x4')][_0x64dd('0x5')]:!![];var isProduction=config[_0x64dd('0x6')]===_0x64dd('0x7')||![];var isLocalAsterisk=config[_0x64dd('0x4')]&&config[_0x64dd('0x4')]['local']===!![]||![];var ami=new AsteriskManager(config[_0x64dd('0x8')][_0x64dd('0x9')],config[_0x64dd('0x8')]['ip'],config[_0x64dd('0x8')][_0x64dd('0xa')],config[_0x64dd('0x8')][_0x64dd('0xb')],!![]);ami['keepConnected']();if(!isXDREnabled){utils[_0x64dd('0xc')](_0x64dd('0xd'));}else if(!isProduction&&!isLocalAsterisk){utils[_0x64dd('0xc')](_0x64dd('0xe'));}else{var agents=require(_0x64dd('0xf'));var calls=require(_0x64dd('0x10'));var queues=require(_0x64dd('0x11'));var recordings=require(_0x64dd('0x12'));var members=require('./members.controller');var dials=require(_0x64dd('0x13'));var transfers=require(_0x64dd('0x14'));var core=require(_0x64dd('0x15'));ami['on'](_0x64dd('0x16'),core[_0x64dd('0x16')]);ami['on'](_0x64dd('0x17'),core[_0x64dd('0x17')]);ami['on'](_0x64dd('0x18'),core[_0x64dd('0x18')]);ami['on'](_0x64dd('0x19'),core[_0x64dd('0x19')]);ami['on'](_0x64dd('0x1a'),core[_0x64dd('0x1a')]);ami['on'](_0x64dd('0x1b'),core['managerevent']);ami['on']('devicestatechange',function(_0x278e97){try{utils[_0x64dd('0x1c')](util[_0x64dd('0x1d')](_0x64dd('0x1e'),_0x278e97[_0x64dd('0x1f')]),_0x278e97);members[_0x64dd('0x20')](_0x278e97);}catch(_0x580197){utils[_0x64dd('0x19')](util[_0x64dd('0x1d')](_0x64dd('0x1e'),_0x278e97['device']),_0x580197);}});ami['on'](_0x64dd('0x21'),function(_0xb7547c){try{utils[_0x64dd('0x1c')](util[_0x64dd('0x1d')]('[%s][index][agentcalled]',_0xb7547c[_0x64dd('0x22')]),_0xb7547c);agents[_0x64dd('0x21')](_0xb7547c);}catch(_0x2544a4){utils[_0x64dd('0x19')](util[_0x64dd('0x1d')](_0x64dd('0x23'),_0xb7547c['uniqueid']),_0x2544a4);}});ami['on']('agentringnoanswer',function(_0xd7a1c9){try{utils[_0x64dd('0x1c')](util[_0x64dd('0x1d')](_0x64dd('0x24'),_0xd7a1c9[_0x64dd('0x22')]),_0xd7a1c9);agents[_0x64dd('0x25')](_0xd7a1c9);}catch(_0x147bdb){utils[_0x64dd('0x19')](util[_0x64dd('0x1d')](_0x64dd('0x24'),_0xd7a1c9[_0x64dd('0x22')]),_0x147bdb);}});ami['on'](_0x64dd('0x26'),function(_0x38a633){try{utils[_0x64dd('0x1c')](util[_0x64dd('0x1d')](_0x64dd('0x27'),_0x38a633['uniqueid']),_0x38a633);agents[_0x64dd('0x26')](_0x38a633);queues['agentconnect'](_0x38a633);}catch(_0xdb6369){utils['error'](util['format'](_0x64dd('0x27'),_0x38a633[_0x64dd('0x22')]),_0xdb6369);}});ami['on']('agentcomplete',function(_0x2d062b){try{utils[_0x64dd('0x1c')](util[_0x64dd('0x1d')]('[%s][index][agentcomplete]',_0x2d062b[_0x64dd('0x22')]),_0x2d062b);agents[_0x64dd('0x28')](_0x2d062b);queues[_0x64dd('0x28')](_0x2d062b);members[_0x64dd('0x28')](_0x2d062b);}catch(_0x271ca2){utils[_0x64dd('0x19')](util[_0x64dd('0x1d')](_0x64dd('0x29'),_0x2d062b[_0x64dd('0x22')]),_0x271ca2);}});ami['on'](_0x64dd('0x2a'),function(_0x16e92b){try{utils['debug'](util[_0x64dd('0x1d')](_0x64dd('0x2b'),_0x16e92b[_0x64dd('0x22')]),_0x16e92b);agents[_0x64dd('0x2a')](_0x16e92b);queues[_0x64dd('0x2a')](_0x16e92b);}catch(_0xefbd2f){utils[_0x64dd('0x19')](util[_0x64dd('0x1d')](_0x64dd('0x2b'),_0x16e92b[_0x64dd('0x22')]),_0xefbd2f);}});ami['on'](_0x64dd('0x2c'),function(_0x46a527){try{utils[_0x64dd('0x1c')](util[_0x64dd('0x1d')](_0x64dd('0x2d'),_0x46a527[_0x64dd('0x22')]),_0x46a527);queues[_0x64dd('0x2c')](_0x46a527);recordings[_0x64dd('0x2c')](_0x46a527);}catch(_0xe68c95){utils[_0x64dd('0x19')](util[_0x64dd('0x1d')](_0x64dd('0x2d'),_0x46a527['uniqueid']),_0xe68c95);}});ami['on']('queuecallerleave',function(_0x3802b0){try{utils[_0x64dd('0x1c')](util[_0x64dd('0x1d')](_0x64dd('0x2e'),_0x3802b0[_0x64dd('0x22')]),_0x3802b0);queues[_0x64dd('0x2f')](_0x3802b0);}catch(_0x10d33c){utils[_0x64dd('0x19')](util[_0x64dd('0x1d')]('[%s][index][queuecallerleave]',_0x3802b0[_0x64dd('0x22')]),_0x10d33c);}});ami['on'](_0x64dd('0x30'),function(_0xbf71e4){try{utils['debug'](util[_0x64dd('0x1d')](_0x64dd('0x31'),_0xbf71e4[_0x64dd('0x22')]),_0xbf71e4);queues[_0x64dd('0x30')](_0xbf71e4);calls[_0x64dd('0x30')](_0xbf71e4);}catch(_0x4fbee7){utils[_0x64dd('0x19')](util[_0x64dd('0x1d')]('[%s][index][musiconholdstart]',_0xbf71e4[_0x64dd('0x22')]),_0x4fbee7);}});ami['on'](_0x64dd('0x32'),function(_0x558400){try{utils[_0x64dd('0x1c')](util[_0x64dd('0x1d')]('[%s][index][musiconholdstop]',_0x558400[_0x64dd('0x22')]),_0x558400);queues[_0x64dd('0x32')](_0x558400);calls[_0x64dd('0x32')](_0x558400);}catch(_0x23f251){utils['error'](util[_0x64dd('0x1d')](_0x64dd('0x33'),_0x558400[_0x64dd('0x22')]),_0x23f251);}});ami['on'](_0x64dd('0x34'),function(_0x5b5699){try{utils[_0x64dd('0x1c')](util[_0x64dd('0x1d')](_0x64dd('0x35'),_0x5b5699[_0x64dd('0x22')]),_0x5b5699);calls[_0x64dd('0x34')](_0x5b5699);recordings[_0x64dd('0x34')](_0x5b5699);}catch(_0x9e7c1e){utils[_0x64dd('0x19')](util[_0x64dd('0x1d')]('[%s][index][newstate]',_0x5b5699[_0x64dd('0x22')]),_0x9e7c1e);}});ami['on'](_0x64dd('0x36'),function(_0x442c39){try{utils[_0x64dd('0x1c')](util[_0x64dd('0x1d')](_0x64dd('0x37'),_0x442c39['uniqueid']),_0x442c39);calls[_0x64dd('0x36')](_0x442c39);recordings[_0x64dd('0x36')](_0x442c39);dials['hangup'](_0x442c39);agents['hangup'](_0x442c39);queues[_0x64dd('0x36')](_0x442c39);}catch(_0x69a6d1){utils[_0x64dd('0x19')](util[_0x64dd('0x1d')]('[%s][index][hangup]',_0x442c39[_0x64dd('0x22')]),_0x69a6d1);}});ami['on'](_0x64dd('0x38'),function(_0x3b814c){try{utils[_0x64dd('0x1c')](util[_0x64dd('0x1d')](_0x64dd('0x39'),_0x3b814c['uniqueid']),_0x3b814c);members[_0x64dd('0x38')](_0x3b814c);}catch(_0x542bb5){utils['error'](util[_0x64dd('0x1d')]('[%s][index][cdr]',_0x3b814c[_0x64dd('0x22')]),_0x542bb5);}});ami['on'](_0x64dd('0x3a'),function(_0x14bdac){try{utils[_0x64dd('0x1c')](util[_0x64dd('0x1d')](_0x64dd('0x3b'),_0x14bdac[_0x64dd('0x22')]),_0x14bdac);queues[_0x64dd('0x3a')](_0x14bdac);agents[_0x64dd('0x3a')](_0x14bdac);transfers[_0x64dd('0x3a')](_0x14bdac);}catch(_0x27cbac){utils[_0x64dd('0x19')](util[_0x64dd('0x1d')](_0x64dd('0x3b'),_0x14bdac[_0x64dd('0x22')]),_0x27cbac);}});ami['on']('attendedtransfer',function(_0x441986){try{utils['debug'](util[_0x64dd('0x1d')](_0x64dd('0x3c'),_0x441986['origtransfereruniqueid']),_0x441986);queues['attendedtransfer'](_0x441986);transfers[_0x64dd('0x3d')](_0x441986);agents[_0x64dd('0x3d')](_0x441986);calls['attendedtransfer'](_0x441986);}catch(_0x28dce0){utils['error'](util['format'](_0x64dd('0x3c'),_0x441986['origtransfereruniqueid']),_0x28dce0);}});ami['on'](_0x64dd('0x3e'),function(_0x523306){try{utils[_0x64dd('0x1c')](util[_0x64dd('0x1d')]('[%s][index][varset]',_0x523306[_0x64dd('0x22')]),_0x523306);queues['varset'](_0x523306);recordings['varset'](_0x523306);calls[_0x64dd('0x3e')](_0x523306);dials['varset'](_0x523306);}catch(_0x26ab8f){utils[_0x64dd('0x19')](util['format'](_0x64dd('0x3f'),_0x523306[_0x64dd('0x22')]),_0x26ab8f);}});ami['on'](_0x64dd('0x40'),function(_0x6cad7e){try{utils[_0x64dd('0x1c')](util[_0x64dd('0x1d')](_0x64dd('0x41'),_0x6cad7e['uniqueid']),_0x6cad7e);calls[_0x64dd('0x40')](_0x6cad7e);recordings[_0x64dd('0x40')](_0x6cad7e);dials[_0x64dd('0x40')](_0x6cad7e);}catch(_0x339b66){utils['error'](util[_0x64dd('0x1d')](_0x64dd('0x41'),_0x6cad7e[_0x64dd('0x22')]),_0x339b66);}});ami['on'](_0x64dd('0x42'),function(_0x58093f){try{utils[_0x64dd('0x1c')](util['format']('[%s][index][newchannel]',_0x58093f['uniqueid']),_0x58093f);calls[_0x64dd('0x42')](_0x58093f);recordings[_0x64dd('0x42')](_0x58093f);}catch(_0x330c89){utils[_0x64dd('0x19')](util[_0x64dd('0x1d')](_0x64dd('0x43'),_0x58093f['uniqueid']),_0x330c89);}});ami['on'](_0x64dd('0x44'),function(_0x4a34b1){try{utils['debug'](util[_0x64dd('0x1d')](_0x64dd('0x45'),_0x4a34b1[_0x64dd('0x22')]),_0x4a34b1);dials[_0x64dd('0x44')](_0x4a34b1);}catch(_0x21fc71){utils[_0x64dd('0x19')](util[_0x64dd('0x1d')](_0x64dd('0x46'),_0x4a34b1['uniqueid']),_0x21fc71);}});ami['on'](_0x64dd('0x47'),function(_0x7fc115){try{utils[_0x64dd('0x1c')](util[_0x64dd('0x1d')](_0x64dd('0x48'),_0x7fc115[_0x64dd('0x22')]),_0x7fc115);dials[_0x64dd('0x47')](_0x7fc115);}catch(_0xae9ec5){utils[_0x64dd('0x19')](util[_0x64dd('0x1d')](_0x64dd('0x48'),_0x7fc115[_0x64dd('0x22')]),_0xae9ec5);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index e1396f7..dc6e77e 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 _0xf9cb=['assign','cdr','[%s][members][cdr]','channel','data2','source','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','data1','destinationchannel','lodash','util','./utils','Local/_attended@transfer','Queue:','info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','interface','type','getUserByInterface','then','membername','name','internal','request','CreateMemberReport','getUserByName','split','catch','[%s][members][writeDB]','some','debug','[%s][members][devicestatechange]','device','uniqueid','state','INUSE','voice','TALKING','now','NOT_INUSE','isNil','exitAt','diffTime','enterAt','error','agentcomplete','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue'];(function(_0xdfca8d,_0x377316){var _0x1cbe00=function(_0x37d086){while(--_0x37d086){_0xdfca8d['push'](_0xdfca8d['shift']());}};_0x1cbe00(++_0x377316);}(_0xf9cb,0xdb));var _0xbf9c=function(_0x174a72,_0x46034c){_0x174a72=_0x174a72-0x0;var _0x32cecd=_0xf9cb[_0x174a72];return _0x32cecd;};'use strict';var _=require(_0xbf9c('0x0'));var util=require(_0xbf9c('0x1'));var utils=require(_0xbf9c('0x2'));var members={};var exclude=[_0xbf9c('0x3'),_0xbf9c('0x4')];function writeDB(_0x47f930){utils[_0xbf9c('0x5')](util[_0xbf9c('0x6')](_0xbf9c('0x7'),_0x47f930['uniqueid'],_0x47f930[_0xbf9c('0x8')],_0x47f930['channel'],_0x47f930['data2'],_0x47f930['membername'],_0x47f930[_0xbf9c('0x9')]));if(_0x47f930[_0xbf9c('0x8')]){utils[_0xbf9c('0xa')](_0x47f930['interface'])[_0xbf9c('0xb')](function(_0x31f2c8){if(_0x31f2c8){_0x47f930[_0xbf9c('0xc')]=_0x31f2c8[_0xbf9c('0xd')];_0x47f930[_0xbf9c('0xe')]=_0x31f2c8['internal'];utils[_0xbf9c('0xf')](_0xbf9c('0x10'),_0x47f930);}else{utils[_0xbf9c('0x11')](_0x47f930['interface'][_0xbf9c('0x12')]('/')[0x1])[_0xbf9c('0xb')](function(_0x5a2d3d){if(_0x5a2d3d){_0x47f930[_0xbf9c('0xc')]=_0x5a2d3d['name'];_0x47f930[_0xbf9c('0xe')]=_0x5a2d3d[_0xbf9c('0xe')];utils['request'](_0xbf9c('0x10'),_0x47f930);}});}})[_0xbf9c('0x13')](function(_0x515d29){utils['error'](util['format'](_0xbf9c('0x14'),_0x47f930['uniqueid']),_0x515d29);});}delete members[_0x47f930[_0xbf9c('0x8')]];}function startsWith(_0x49c78a,_0x104780){return _[_0xbf9c('0x15')](_0x49c78a,function(_0x321ef9){return _['startsWith'](_0x104780,_0x321ef9);});}exports['devicestatechange']=function(_0x54db91){try{utils[_0xbf9c('0x16')](util[_0xbf9c('0x6')](_0xbf9c('0x17'),members[_0x54db91[_0xbf9c('0x18')]]?members[_0x54db91[_0xbf9c('0x18')]][_0xbf9c('0x19')]:_0x54db91[_0xbf9c('0x18')]),_0x54db91);utils[_0xbf9c('0x5')](util[_0xbf9c('0x6')]('[%s][members][devicestatechange]\x20state:%s\x20interface:%s',members[_0x54db91[_0xbf9c('0x18')]]?members[_0x54db91[_0xbf9c('0x18')]]['uniqueid']:_0x54db91[_0xbf9c('0x18')],_0x54db91[_0xbf9c('0x1a')],_0x54db91[_0xbf9c('0x18')]));switch(_0x54db91[_0xbf9c('0x1a')]){case _0xbf9c('0x1b'):case'BUSY':if(!startsWith(exclude,_0x54db91[_0xbf9c('0x18')])){members[_0x54db91[_0xbf9c('0x18')]]={'channel':_0xbf9c('0x1c'),'interface':_0x54db91[_0xbf9c('0x18')],'type':_0xbf9c('0x1d'),'enterAt':utils[_0xbf9c('0x1e')](),'role':'agent'};}break;case _0xbf9c('0x1f'):if(!_[_0xbf9c('0x20')](members[_0x54db91[_0xbf9c('0x18')]])){members[_0x54db91['device']][_0xbf9c('0x21')]=utils['now']();members[_0x54db91['device']]['duration']=utils[_0xbf9c('0x22')](members[_0x54db91[_0xbf9c('0x18')]]['exitAt'],members[_0x54db91[_0xbf9c('0x18')]][_0xbf9c('0x23')]);if(members[_0x54db91['device']][_0xbf9c('0x19')]){writeDB(members[_0x54db91[_0xbf9c('0x18')]]);}}break;default:break;}}catch(_0x17ca00){utils[_0xbf9c('0x24')](util[_0xbf9c('0x6')](_0xbf9c('0x17'),members[_0x54db91[_0xbf9c('0x18')]]?members[_0x54db91['device']][_0xbf9c('0x19')]:_0x54db91['device']),_0x17ca00);}};exports[_0xbf9c('0x25')]=function(_0x1cc8b1){try{if(!_['isNil'](members[_0x1cc8b1[_0xbf9c('0x8')]])){utils[_0xbf9c('0x16')](util[_0xbf9c('0x6')](_0xbf9c('0x26'),_0x1cc8b1['uniqueid']),_0x1cc8b1);utils[_0xbf9c('0x5')](util['format'](_0xbf9c('0x27'),_0x1cc8b1[_0xbf9c('0x19')],_0x1cc8b1[_0xbf9c('0x8')],_0x1cc8b1[_0xbf9c('0x28')]));members[_0x1cc8b1[_0xbf9c('0x8')]]=_[_0xbf9c('0x29')](members[_0x1cc8b1[_0xbf9c('0x8')]],{'data4':_0x1cc8b1[_0xbf9c('0x28')],'uniqueid':_0x1cc8b1['uniqueid']});}}catch(_0x3f3541){utils['error'](util[_0xbf9c('0x6')](_0xbf9c('0x26'),_0x1cc8b1['uniqueid']),_0x3f3541);}};exports[_0xbf9c('0x2a')]=function(_0x5936cd){try{utils[_0xbf9c('0x16')](util['format'](_0xbf9c('0x2b'),_0x5936cd[_0xbf9c('0x19')]),_0x5936cd);if(_0x5936cd[_0xbf9c('0x2c')]){var _0x31cf2e=_0x5936cd[_0xbf9c('0x2c')][_0xbf9c('0x12')]('-')[0x0];if(!_[_0xbf9c('0x20')](members[_0x31cf2e])){members[_0x31cf2e]=_[_0xbf9c('0x29')](members[_0x31cf2e],{'data1':members[_0x31cf2e]['data1']||_0x5936cd['type'],'data2':members[_0x31cf2e][_0xbf9c('0x2d')]||_0x5936cd[_0xbf9c('0x2e')],'data3':members[_0x31cf2e][_0xbf9c('0x2f')]||_0x5936cd[_0xbf9c('0x30')],'uniqueid':members[_0x31cf2e][_0xbf9c('0x19')]||_0x5936cd[_0xbf9c('0x19')]});utils[_0xbf9c('0x5')](util[_0xbf9c('0x6')](_0xbf9c('0x31'),_0x5936cd['uniqueid'],members[_0x31cf2e][_0xbf9c('0x32')],members[_0x31cf2e]['data2'],members[_0x31cf2e]['data3']));if(members[_0x31cf2e]['exitAt']){writeDB(members[_0x31cf2e]);}}}if(_0x5936cd[_0xbf9c('0x33')]){var _0x3e73e2=_0x5936cd['destinationchannel'][_0xbf9c('0x12')]('-')[0x0];if(!_[_0xbf9c('0x20')](members[_0x3e73e2])){members[_0x3e73e2]=_[_0xbf9c('0x29')](members[_0x3e73e2],{'data1':members[_0x3e73e2][_0xbf9c('0x32')]||_0x5936cd[_0xbf9c('0x9')],'data2':members[_0x3e73e2][_0xbf9c('0x2d')]||_0x5936cd[_0xbf9c('0x2e')],'data3':members[_0x3e73e2]['data3']||_0x5936cd[_0xbf9c('0x30')],'uniqueid':members[_0x3e73e2][_0xbf9c('0x19')]||_0x5936cd[_0xbf9c('0x19')]});utils['info'](util['format'](_0xbf9c('0x31'),_0x5936cd['uniqueid'],members[_0x3e73e2][_0xbf9c('0x32')],members[_0x3e73e2][_0xbf9c('0x2d')],members[_0x3e73e2][_0xbf9c('0x2f')]));if(members[_0x3e73e2]['exitAt']){writeDB(members[_0x3e73e2]);}}}}catch(_0x836dcf){utils[_0xbf9c('0x24')](util[_0xbf9c('0x6')](_0xbf9c('0x2b'),_0x5936cd['uniqueid']),_0x836dcf);}}; \ No newline at end of file +var _0xac7f=['info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','channel','membername','getUserByInterface','then','internal','getUserByName','split','name','request','CreateMemberReport','catch','some','startsWith','devicestatechange','debug','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','BUSY','voice','TALKING','now','agent','isNil','exitAt','duration','diffTime','enterAt','error','agentcomplete','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign','cdr','data1','type','data2','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','destinationchannel','source','lodash','./utils','Local/_attended@transfer','Queue:'];(function(_0xbf8ebe,_0x3b69a5){var _0x1e25e8=function(_0x40c390){while(--_0x40c390){_0xbf8ebe['push'](_0xbf8ebe['shift']());}};_0x1e25e8(++_0x3b69a5);}(_0xac7f,0x1e2));var _0xfac7=function(_0x4b2863,_0x494899){_0x4b2863=_0x4b2863-0x0;var _0x567d67=_0xac7f[_0x4b2863];return _0x567d67;};'use strict';var _=require(_0xfac7('0x0'));var util=require('util');var utils=require(_0xfac7('0x1'));var members={};var exclude=[_0xfac7('0x2'),_0xfac7('0x3')];function writeDB(_0x50e61a){utils[_0xfac7('0x4')](util[_0xfac7('0x5')](_0xfac7('0x6'),_0x50e61a[_0xfac7('0x7')],_0x50e61a[_0xfac7('0x8')],_0x50e61a[_0xfac7('0x9')],_0x50e61a['data2'],_0x50e61a[_0xfac7('0xa')],_0x50e61a['type']));if(_0x50e61a[_0xfac7('0x8')]){utils[_0xfac7('0xb')](_0x50e61a['interface'])[_0xfac7('0xc')](function(_0x1a5768){if(_0x1a5768){_0x50e61a[_0xfac7('0xa')]=_0x1a5768['name'];_0x50e61a[_0xfac7('0xd')]=_0x1a5768[_0xfac7('0xd')];utils['request']('CreateMemberReport',_0x50e61a);}else{utils[_0xfac7('0xe')](_0x50e61a[_0xfac7('0x8')][_0xfac7('0xf')]('/')[0x1])[_0xfac7('0xc')](function(_0x25990e){if(_0x25990e){_0x50e61a['membername']=_0x25990e[_0xfac7('0x10')];_0x50e61a[_0xfac7('0xd')]=_0x25990e[_0xfac7('0xd')];utils[_0xfac7('0x11')](_0xfac7('0x12'),_0x50e61a);}});}})[_0xfac7('0x13')](function(_0x4a97d3){utils['error'](util[_0xfac7('0x5')]('[%s][members][writeDB]',_0x50e61a[_0xfac7('0x7')]),_0x4a97d3);});}delete members[_0x50e61a[_0xfac7('0x8')]];}function startsWith(_0x54d738,_0x1ff0f4){return _[_0xfac7('0x14')](_0x54d738,function(_0x4b7479){return _[_0xfac7('0x15')](_0x1ff0f4,_0x4b7479);});}exports[_0xfac7('0x16')]=function(_0x132eac){try{utils[_0xfac7('0x17')](util['format'](_0xfac7('0x18'),members[_0x132eac[_0xfac7('0x19')]]?members[_0x132eac[_0xfac7('0x19')]][_0xfac7('0x7')]:_0x132eac[_0xfac7('0x19')]),_0x132eac);utils[_0xfac7('0x4')](util[_0xfac7('0x5')](_0xfac7('0x1a'),members[_0x132eac[_0xfac7('0x19')]]?members[_0x132eac['device']]['uniqueid']:_0x132eac[_0xfac7('0x19')],_0x132eac[_0xfac7('0x1b')],_0x132eac['device']));switch(_0x132eac[_0xfac7('0x1b')]){case _0xfac7('0x1c'):case _0xfac7('0x1d'):if(!startsWith(exclude,_0x132eac[_0xfac7('0x19')])){members[_0x132eac[_0xfac7('0x19')]]={'channel':_0xfac7('0x1e'),'interface':_0x132eac[_0xfac7('0x19')],'type':_0xfac7('0x1f'),'enterAt':utils[_0xfac7('0x20')](),'role':_0xfac7('0x21')};}break;case'NOT_INUSE':if(!_[_0xfac7('0x22')](members[_0x132eac[_0xfac7('0x19')]])){members[_0x132eac[_0xfac7('0x19')]][_0xfac7('0x23')]=utils[_0xfac7('0x20')]();members[_0x132eac['device']][_0xfac7('0x24')]=utils[_0xfac7('0x25')](members[_0x132eac[_0xfac7('0x19')]][_0xfac7('0x23')],members[_0x132eac[_0xfac7('0x19')]][_0xfac7('0x26')]);if(members[_0x132eac['device']][_0xfac7('0x7')]){writeDB(members[_0x132eac[_0xfac7('0x19')]]);}}break;default:break;}}catch(_0x5b2cc0){utils[_0xfac7('0x27')](util[_0xfac7('0x5')](_0xfac7('0x18'),members[_0x132eac[_0xfac7('0x19')]]?members[_0x132eac[_0xfac7('0x19')]][_0xfac7('0x7')]:_0x132eac['device']),_0x5b2cc0);}};exports[_0xfac7('0x28')]=function(_0x49b341){try{if(!_[_0xfac7('0x22')](members[_0x49b341['interface']])){utils[_0xfac7('0x17')](util[_0xfac7('0x5')](_0xfac7('0x29'),_0x49b341['uniqueid']),_0x49b341);utils[_0xfac7('0x4')](util[_0xfac7('0x5')](_0xfac7('0x2a'),_0x49b341[_0xfac7('0x7')],_0x49b341[_0xfac7('0x8')],_0x49b341[_0xfac7('0x2b')]));members[_0x49b341[_0xfac7('0x8')]]=_[_0xfac7('0x2c')](members[_0x49b341[_0xfac7('0x8')]],{'data4':_0x49b341['queue'],'uniqueid':_0x49b341[_0xfac7('0x7')]});}}catch(_0x101f8c){utils['error'](util[_0xfac7('0x5')](_0xfac7('0x29'),_0x49b341[_0xfac7('0x7')]),_0x101f8c);}};exports[_0xfac7('0x2d')]=function(_0x188ae1){try{utils[_0xfac7('0x17')](util[_0xfac7('0x5')]('[%s][members][cdr]',_0x188ae1['uniqueid']),_0x188ae1);if(_0x188ae1[_0xfac7('0x9')]){var _0x51ec48=_0x188ae1['channel']['split']('-')[0x0];if(!_[_0xfac7('0x22')](members[_0x51ec48])){members[_0x51ec48]=_[_0xfac7('0x2c')](members[_0x51ec48],{'data1':members[_0x51ec48][_0xfac7('0x2e')]||_0x188ae1[_0xfac7('0x2f')],'data2':members[_0x51ec48][_0xfac7('0x30')]||_0x188ae1['source'],'data3':members[_0x51ec48][_0xfac7('0x31')]||_0x188ae1[_0xfac7('0x32')],'uniqueid':members[_0x51ec48][_0xfac7('0x7')]||_0x188ae1['uniqueid']});utils[_0xfac7('0x4')](util['format'](_0xfac7('0x33'),_0x188ae1[_0xfac7('0x7')],members[_0x51ec48][_0xfac7('0x2e')],members[_0x51ec48][_0xfac7('0x30')],members[_0x51ec48][_0xfac7('0x31')]));if(members[_0x51ec48][_0xfac7('0x23')]){writeDB(members[_0x51ec48]);}}}if(_0x188ae1[_0xfac7('0x34')]){var _0x42c1a5=_0x188ae1[_0xfac7('0x34')][_0xfac7('0xf')]('-')[0x0];if(!_[_0xfac7('0x22')](members[_0x42c1a5])){members[_0x42c1a5]=_[_0xfac7('0x2c')](members[_0x42c1a5],{'data1':members[_0x42c1a5][_0xfac7('0x2e')]||_0x188ae1[_0xfac7('0x2f')],'data2':members[_0x42c1a5][_0xfac7('0x30')]||_0x188ae1[_0xfac7('0x35')],'data3':members[_0x42c1a5]['data3']||_0x188ae1['destination'],'uniqueid':members[_0x42c1a5][_0xfac7('0x7')]||_0x188ae1['uniqueid']});utils[_0xfac7('0x4')](util[_0xfac7('0x5')]('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x188ae1[_0xfac7('0x7')],members[_0x42c1a5][_0xfac7('0x2e')],members[_0x42c1a5][_0xfac7('0x30')],members[_0x42c1a5][_0xfac7('0x31')]));if(members[_0x42c1a5][_0xfac7('0x23')]){writeDB(members[_0x42c1a5]);}}}}catch(_0x58792b){utils['error'](util[_0xfac7('0x5')]('[%s][members][cdr]',_0x188ae1['uniqueid']),_0x58792b);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index dc6da1d..0c5179e 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 _0xa6f1=['musiconholdstop','[%s][queues][musiconholdstop]','info','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','channel','queue','lastAssignedTo','calleridnum','accountcode','queuecallerexitreason','getVoiceQueueByName','type','request','CreateVoiceQueueReport','transfereduniqueid','uniqueid','queuecallerjoin','debug','[%s][queues][queuecallerjoin]','position','assign','now','isNil','[%s][queues][hangup]','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercomplete','queuecallercompleteAt','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','error','varset','variable','queuestatus','value','toUpperCase','CONTINUE','queuecallerexitAt','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][varset]','[%s][queues][queuecallerabandon]','ABANDONED','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinename','queuecallerleave','holdtime','diffTime','count','connectedlinenum','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','queuecallerabandonAt','assigned','agentcomplete','[%s][queues][agentcomplete]','transfer','TRANSFER','reason','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','transfereeuniqueid','[%s][queues][blindtransfer]','transfertype','BLIND','transferuniqueid','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','origtransfererexten','ATTENDED','transferexten','ATTENDEDTRANSFER','transfereelinkedid','transfertargetuniqueid','calleridname','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','clone','queuecallerjoinAt','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','musiconholdstart','[%s][queues][musiconholdstart]','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s'];(function(_0x456202,_0x7a9c5c){var _0x3c3996=function(_0x166b97){while(--_0x166b97){_0x456202['push'](_0x456202['shift']());}};_0x3c3996(++_0x7a9c5c);}(_0xa6f1,0x19a));var _0x1a6f=function(_0x236470,_0x752a84){_0x236470=_0x236470-0x0;var _0x2b858d=_0xa6f1[_0x236470];return _0x2b858d;};'use strict';var _=require('lodash');var util=require('util');var utils=require('./utils');var queues={};function writeDB(_0xcfb0c6){utils[_0x1a6f('0x0')](util[_0x1a6f('0x1')](_0x1a6f('0x2'),_0xcfb0c6['uniqueid'],_0xcfb0c6[_0x1a6f('0x3')],_0xcfb0c6[_0x1a6f('0x4')],_0xcfb0c6[_0x1a6f('0x5')],_0xcfb0c6[_0x1a6f('0x6')],_0xcfb0c6[_0x1a6f('0x7')],_0xcfb0c6[_0x1a6f('0x8')]));if(_0xcfb0c6['queue']){utils[_0x1a6f('0x9')](_0xcfb0c6[_0x1a6f('0x4')])['then'](function(_0x3b6f3c){if(_0x3b6f3c){_0xcfb0c6[_0x1a6f('0xa')]=_0x3b6f3c[_0x1a6f('0xa')];}utils[_0x1a6f('0xb')](_0x1a6f('0xc'),_0xcfb0c6);});}else{utils[_0x1a6f('0xb')]('CreateVoiceQueueReport',_0xcfb0c6);}if(_0xcfb0c6[_0x1a6f('0xd')]){delete queues[_0xcfb0c6[_0x1a6f('0xd')]];}else{delete queues[_0xcfb0c6[_0x1a6f('0xe')]];}}exports[_0x1a6f('0xf')]=function(_0x15d902){try{utils[_0x1a6f('0x10')](util[_0x1a6f('0x1')](_0x1a6f('0x11'),_0x15d902['uniqueid']),_0x15d902);utils[_0x1a6f('0x0')](util['format']('[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s',_0x15d902[_0x1a6f('0xe')],_0x15d902['queue'],_0x15d902[_0x1a6f('0x12')]));queues[_0x15d902[_0x1a6f('0xe')]]=_[_0x1a6f('0x13')](_0x15d902,{'originalposition':_0x15d902['position'],'queuecallerjoinAt':utils[_0x1a6f('0x14')](),'mohtime':0x0});}catch(_0x38cb54){utils['error'](util['format'](_0x1a6f('0x11'),_0x15d902[_0x1a6f('0xe')]),_0x38cb54);}};exports['hangup']=function(_0x32a245){try{if(!_[_0x1a6f('0x15')](queues[_0x32a245[_0x1a6f('0xe')]])){utils['debug'](util[_0x1a6f('0x1')](_0x1a6f('0x16'),_0x32a245[_0x1a6f('0xe')]),_0x32a245);if(queues[_0x32a245['uniqueid']][_0x1a6f('0x17')]){if(!queues[_0x32a245['uniqueid']][_0x1a6f('0x18')]&&!queues[_0x32a245[_0x1a6f('0xe')]][_0x1a6f('0x19')]){queues[_0x32a245[_0x1a6f('0xe')]][_0x1a6f('0x1a')]=!![];queues[_0x32a245['uniqueid']][_0x1a6f('0x1b')]=utils[_0x1a6f('0x14')]();queues[_0x32a245[_0x1a6f('0xe')]]['queuecallerexitreason']=_0x1a6f('0x1c');}utils[_0x1a6f('0x0')](util[_0x1a6f('0x1')](_0x1a6f('0x1d'),_0x32a245[_0x1a6f('0xe')],queues[_0x32a245[_0x1a6f('0xe')]][_0x1a6f('0x1e')],queues[_0x32a245[_0x1a6f('0xe')]]['queuecallerexitreason']));writeDB(queues[_0x32a245[_0x1a6f('0xe')]]);}else if(queues[_0x32a245[_0x1a6f('0xe')]][_0x1a6f('0xd')]){utils[_0x1a6f('0x0')](util[_0x1a6f('0x1')](_0x1a6f('0x1f'),_0x32a245[_0x1a6f('0xe')],queues[_0x32a245[_0x1a6f('0xe')]][_0x1a6f('0x1e')],queues[_0x32a245[_0x1a6f('0xe')]][_0x1a6f('0xd')]));queues[queues[_0x32a245[_0x1a6f('0xe')]][_0x1a6f('0xd')]]=queues[_0x32a245[_0x1a6f('0xe')]];queues[queues[_0x32a245[_0x1a6f('0xe')]][_0x1a6f('0xd')]][_0x1a6f('0x20')]=0x2;delete queues[_0x32a245[_0x1a6f('0xe')]];}}}catch(_0x243091){utils[_0x1a6f('0x21')](util[_0x1a6f('0x1')](_0x1a6f('0x16'),_0x32a245['uniqueid']),_0x243091);}};exports[_0x1a6f('0x22')]=function(_0x465652){try{utils[_0x1a6f('0x10')](util[_0x1a6f('0x1')]('[%s][queues][varset]',_0x465652['uniqueid']),_0x465652);if(!_[_0x1a6f('0x15')](_0x465652[_0x1a6f('0x23')][_0x1a6f('0x24')])&&_0x465652[_0x1a6f('0x25')][_0x1a6f('0x26')]()!==_0x1a6f('0x27')){if(!_[_0x1a6f('0x15')](queues[_0x465652[_0x1a6f('0xe')]])){queues[_0x465652[_0x1a6f('0xe')]][_0x1a6f('0x18')]=![];queues[_0x465652[_0x1a6f('0xe')]]['queuecallerabandonAt']=null;queues[_0x465652['uniqueid']][_0x1a6f('0x19')]=!![];queues[_0x465652[_0x1a6f('0xe')]][_0x1a6f('0x28')]=utils['now']();queues[_0x465652['uniqueid']][_0x1a6f('0x8')]=_0x465652[_0x1a6f('0x25')]['toUpperCase']();utils['info'](util['format'](_0x1a6f('0x29'),_0x465652[_0x1a6f('0xe')],queues[_0x465652['uniqueid']][_0x1a6f('0x1e')],_0x465652[_0x1a6f('0x25')],queues[_0x465652[_0x1a6f('0xe')]][_0x1a6f('0x8')]));writeDB(queues[_0x465652[_0x1a6f('0xe')]]);}}else if(!_[_0x1a6f('0x15')](_0x465652[_0x1a6f('0x23')]['queueposition'])){if(!_[_0x1a6f('0x15')](queues[_0x465652[_0x1a6f('0xe')]])&&!queues[_0x465652['uniqueid']][_0x1a6f('0x18')]){queues[_0x465652[_0x1a6f('0xe')]][_0x1a6f('0x18')]=![];queues[_0x465652[_0x1a6f('0xe')]]['queuecallerabandonAt']=null;queues[_0x465652[_0x1a6f('0xe')]][_0x1a6f('0x19')]=!![];queues[_0x465652[_0x1a6f('0xe')]][_0x1a6f('0x28')]=utils[_0x1a6f('0x14')]();queues[_0x465652[_0x1a6f('0xe')]][_0x1a6f('0x8')]=_0x1a6f('0x2a');utils[_0x1a6f('0x0')](util[_0x1a6f('0x1')](_0x1a6f('0x2b'),_0x465652[_0x1a6f('0xe')],queues[_0x465652[_0x1a6f('0xe')]][_0x1a6f('0x1e')],_0x465652['value'],queues[_0x465652['uniqueid']][_0x1a6f('0x8')]));}}}catch(_0x9ac4a8){utils[_0x1a6f('0x21')](util[_0x1a6f('0x1')](_0x1a6f('0x2c'),_0x465652['uniqueid']),_0x9ac4a8);}};exports[_0x1a6f('0x18')]=function(_0x1e0353){try{if(!_[_0x1a6f('0x15')](queues[_0x1e0353[_0x1a6f('0xe')]])){utils[_0x1a6f('0x10')](util[_0x1a6f('0x1')](_0x1a6f('0x2d'),_0x1e0353[_0x1a6f('0xe')]),_0x1e0353);queues[_0x1e0353[_0x1a6f('0xe')]][_0x1a6f('0x19')]=![];queues[_0x1e0353[_0x1a6f('0xe')]][_0x1a6f('0x28')]=null;queues[_0x1e0353['uniqueid']]['queuecallerabandon']=!![];queues[_0x1e0353[_0x1a6f('0xe')]]['queuecallerabandonAt']=utils[_0x1a6f('0x14')]();queues[_0x1e0353['uniqueid']]['queuecallerexitreason']=_0x1a6f('0x2e');utils['info'](util[_0x1a6f('0x1')]('[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s',_0x1e0353[_0x1a6f('0xe')],queues[_0x1e0353[_0x1a6f('0xe')]]['name'],queues[_0x1e0353[_0x1a6f('0xe')]][_0x1a6f('0x8')]));}}catch(_0xedd529){utils[_0x1a6f('0x21')](util[_0x1a6f('0x1')](_0x1a6f('0x2d'),_0x1e0353[_0x1a6f('0xe')]),_0xedd529);}};exports['queuecallerleave']=function(_0x36e573){try{if(!_['isNil'](queues[_0x36e573[_0x1a6f('0xe')]])){utils[_0x1a6f('0x10')](util[_0x1a6f('0x1')](_0x1a6f('0x2f'),_0x36e573[_0x1a6f('0xe')]),_0x36e573);utils[_0x1a6f('0x0')](util['format'](_0x1a6f('0x30'),_0x36e573[_0x1a6f('0xe')],queues[_0x36e573['uniqueid']][_0x1a6f('0x1e')],_0x36e573['connectedlinenum'],_0x36e573[_0x1a6f('0x31')]));queues[_0x36e573[_0x1a6f('0xe')]][_0x1a6f('0x32')]=!![];queues[_0x36e573[_0x1a6f('0xe')]][_0x1a6f('0x17')]=utils[_0x1a6f('0x14')]();queues[_0x36e573[_0x1a6f('0xe')]][_0x1a6f('0x33')]=utils[_0x1a6f('0x34')](queues[_0x36e573['uniqueid']]['queuecallerleaveAt'],queues[_0x36e573[_0x1a6f('0xe')]]['queuecallerjoinAt']);queues[_0x36e573['uniqueid']]['position']=_0x36e573['position'];queues[_0x36e573[_0x1a6f('0xe')]][_0x1a6f('0x35')]=_0x36e573[_0x1a6f('0x35')];queues[_0x36e573[_0x1a6f('0xe')]][_0x1a6f('0x36')]=_0x36e573[_0x1a6f('0x36')];queues[_0x36e573[_0x1a6f('0xe')]][_0x1a6f('0x31')]=_0x36e573[_0x1a6f('0x31')];}}catch(_0x204c80){utils['error'](util['format']('[%s][queues][queuecallerleave]',_0x36e573[_0x1a6f('0xe')]),_0x204c80);}};exports['agentconnect']=function(_0x2c3d5f){try{if(!_[_0x1a6f('0x15')](queues[_0x2c3d5f['uniqueid']])){utils[_0x1a6f('0x10')](util[_0x1a6f('0x1')](_0x1a6f('0x37'),_0x2c3d5f[_0x1a6f('0xe')]),_0x2c3d5f);utils['info'](util[_0x1a6f('0x1')](_0x1a6f('0x38'),_0x2c3d5f['uniqueid'],queues[_0x2c3d5f[_0x1a6f('0xe')]][_0x1a6f('0x1e')],_0x2c3d5f[_0x1a6f('0x39')],_0x2c3d5f[_0x1a6f('0x3a')]));queues[_0x2c3d5f['uniqueid']][_0x1a6f('0x18')]=![];queues[_0x2c3d5f[_0x1a6f('0xe')]][_0x1a6f('0x18')]=![];queues[_0x2c3d5f[_0x1a6f('0xe')]][_0x1a6f('0x3b')]=null;queues[_0x2c3d5f[_0x1a6f('0xe')]][_0x1a6f('0x19')]=![];queues[_0x2c3d5f[_0x1a6f('0xe')]]['queuecallerexitreason']=null;queues[_0x2c3d5f[_0x1a6f('0xe')]][_0x1a6f('0x28')]=null;queues[_0x2c3d5f[_0x1a6f('0xe')]][_0x1a6f('0x3c')]=!![];queues[_0x2c3d5f['uniqueid']][_0x1a6f('0x7')]=_0x2c3d5f['destaccountcode'];queues[_0x2c3d5f[_0x1a6f('0xe')]][_0x1a6f('0x5')]=_0x2c3d5f[_0x1a6f('0x39')];}}catch(_0x55de34){utils['error'](util[_0x1a6f('0x1')](_0x1a6f('0x37'),_0x2c3d5f['uniqueid']),_0x55de34);}};exports[_0x1a6f('0x3d')]=function(_0x313aec){try{if(!_[_0x1a6f('0x15')](queues[_0x313aec[_0x1a6f('0xe')]])){if(queues[_0x313aec[_0x1a6f('0xe')]][_0x1a6f('0x17')]){utils[_0x1a6f('0x10')](util[_0x1a6f('0x1')](_0x1a6f('0x3e'),_0x313aec[_0x1a6f('0xe')]),_0x313aec);queues[_0x313aec[_0x1a6f('0xe')]][_0x1a6f('0x18')]=![];queues[_0x313aec[_0x1a6f('0xe')]][_0x1a6f('0x18')]=![];queues[_0x313aec[_0x1a6f('0xe')]][_0x1a6f('0x3b')]=null;queues[_0x313aec['uniqueid']]['queuecallerexit']=![];queues[_0x313aec['uniqueid']][_0x1a6f('0x28')]=null;queues[_0x313aec[_0x1a6f('0xe')]][_0x1a6f('0x3c')]=!![];queues[_0x313aec[_0x1a6f('0xe')]]['lastAssignedTo']=_0x313aec['membername'];queues[_0x313aec[_0x1a6f('0xe')]][_0x1a6f('0x1a')]=!![];queues[_0x313aec[_0x1a6f('0xe')]][_0x1a6f('0x1b')]=utils[_0x1a6f('0x14')]();if(_0x313aec['reason']==_0x1a6f('0x3f')){if(!queues[_0x313aec[_0x1a6f('0xe')]]['transfer']){queues[_0x313aec[_0x1a6f('0xe')]]['queuecallerexitreason']=_0x1a6f('0x40');}}else{queues[_0x313aec[_0x1a6f('0xe')]][_0x1a6f('0x8')]='COMPLETEDBY'+_0x313aec[_0x1a6f('0x41')][_0x1a6f('0x26')]();}utils[_0x1a6f('0x0')](util['format'](_0x1a6f('0x42'),_0x313aec['uniqueid'],queues[_0x313aec['uniqueid']][_0x1a6f('0x1e')],_0x313aec[_0x1a6f('0x39')],queues[_0x313aec[_0x1a6f('0xe')]][_0x1a6f('0x8')]));writeDB(queues[_0x313aec[_0x1a6f('0xe')]]);}}}catch(_0x46057e){utils[_0x1a6f('0x21')](util[_0x1a6f('0x1')](_0x1a6f('0x3e'),_0x313aec[_0x1a6f('0xe')]),_0x46057e);}};exports[_0x1a6f('0x43')]=function(_0xde20c5){try{if(!_[_0x1a6f('0x15')](queues[_0xde20c5[_0x1a6f('0x44')]])){utils['debug'](util[_0x1a6f('0x1')](_0x1a6f('0x45'),_0xde20c5[_0x1a6f('0xe')]),_0xde20c5);queues[_0xde20c5['transfereeuniqueid']][_0x1a6f('0x3f')]=!![];queues[_0xde20c5[_0x1a6f('0x44')]][_0x1a6f('0x46')]=_0x1a6f('0x47');queues[_0xde20c5[_0x1a6f('0x44')]]['transferexten']=_0xde20c5['extension'];queues[_0xde20c5[_0x1a6f('0x44')]][_0x1a6f('0x48')]=_0xde20c5[_0x1a6f('0x44')];queues[_0xde20c5['transfereeuniqueid']][_0x1a6f('0x8')]=_0x1a6f('0x49');utils['info'](util[_0x1a6f('0x1')](_0x1a6f('0x4a'),_0xde20c5[_0x1a6f('0xe')],queues[_0xde20c5[_0x1a6f('0x44')]]['name'],_0xde20c5['transfereeuniqueid'],_0xde20c5['extension']));}}catch(_0x11c62e){utils[_0x1a6f('0x21')](util[_0x1a6f('0x1')](_0x1a6f('0x45'),_0xde20c5[_0x1a6f('0xe')]),_0x11c62e);}};exports['attendedtransfer']=function(_0x3c5828){try{utils[_0x1a6f('0x10')](util[_0x1a6f('0x1')](_0x1a6f('0x4b'),_0x3c5828[_0x1a6f('0x4c')]),_0x3c5828);if(_0x3c5828['origtransfereruniqueid']==_0x3c5828[_0x1a6f('0x4d')]){if(!_[_0x1a6f('0x15')](queues[_0x3c5828[_0x1a6f('0x4e')]])){utils[_0x1a6f('0x0')](util[_0x1a6f('0x1')]('[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x3c5828[_0x1a6f('0x4c')],queues[_0x3c5828['secondtransfererlinkedid']][_0x1a6f('0x1e')],_0x3c5828[_0x1a6f('0x4f')]));queues[_0x3c5828[_0x1a6f('0x4e')]][_0x1a6f('0x3f')]=!![];queues[_0x3c5828[_0x1a6f('0x4e')]][_0x1a6f('0x46')]=_0x1a6f('0x50');queues[_0x3c5828[_0x1a6f('0x4e')]][_0x1a6f('0x51')]=_0x3c5828[_0x1a6f('0x4f')];queues[_0x3c5828['secondtransfererlinkedid']][_0x1a6f('0x48')]=_0x3c5828[_0x1a6f('0x4c')];queues[_0x3c5828['secondtransfererlinkedid']][_0x1a6f('0x8')]=_0x1a6f('0x52');}if(!_[_0x1a6f('0x15')](queues[_0x3c5828[_0x1a6f('0x4d')]])){if(_0x3c5828['transfereelinkedid']&&queues[_0x3c5828['transfereelinkedid']]){queues[_0x3c5828[_0x1a6f('0x53')]][_0x1a6f('0x20')]=0x1;queues[_0x3c5828[_0x1a6f('0x44')]]=_['clone'](queues[_0x3c5828[_0x1a6f('0x53')]]);queues[_0x3c5828[_0x1a6f('0x44')]][_0x1a6f('0xd')]=_0x3c5828[_0x1a6f('0x54')];queues[_0x3c5828[_0x1a6f('0x44')]][_0x1a6f('0x20')]=0x2;queues[_0x3c5828['transfereeuniqueid']][_0x1a6f('0x6')]=queues[_0x3c5828[_0x1a6f('0x4e')]][_0x1a6f('0x6')];queues[_0x3c5828[_0x1a6f('0x44')]][_0x1a6f('0x55')]=queues[_0x3c5828[_0x1a6f('0x4e')]][_0x1a6f('0x55')];queues[_0x3c5828[_0x1a6f('0x44')]]['queuecallerjoinAt']=utils['now']();queues[_0x3c5828[_0x1a6f('0x44')]][_0x1a6f('0x17')]=utils['now']();queues[_0x3c5828[_0x1a6f('0x44')]][_0x1a6f('0x33')]=0x0;queues[_0x3c5828['transfereeuniqueid']][_0x1a6f('0x56')]=0x0;utils['info'](util['format'](_0x1a6f('0x57'),_0x3c5828['origtransfereruniqueid'],queues[_0x3c5828[_0x1a6f('0x44')]][_0x1a6f('0x1e')],queues[_0x3c5828['transfereeuniqueid']]['calleridnum'],queues[_0x3c5828['transfereeuniqueid']]['calleridname']));}else{utils[_0x1a6f('0x0')](util[_0x1a6f('0x1')](_0x1a6f('0x58'),_0x3c5828[_0x1a6f('0x4c')],queues[_0x3c5828['origtransfererlinkedid']][_0x1a6f('0x1e')],_0x3c5828['secondtransfererlinkedid']));queues[_0x3c5828[_0x1a6f('0x4d')]]['transfereduniqueid']=_0x3c5828[_0x1a6f('0x4e')];}}}else if(_0x3c5828[_0x1a6f('0x59')]==_0x3c5828[_0x1a6f('0x4e')]){if(!_[_0x1a6f('0x15')](queues[_0x3c5828[_0x1a6f('0x4d')]])){utils[_0x1a6f('0x0')](util[_0x1a6f('0x1')](_0x1a6f('0x5a'),_0x3c5828[_0x1a6f('0x4c')],queues[_0x3c5828['origtransfererlinkedid']][_0x1a6f('0x1e')],_0x3c5828['secondtransfereruniqueid'],_0x3c5828[_0x1a6f('0x5b')]));queues[_0x3c5828[_0x1a6f('0x4d')]][_0x1a6f('0x3f')]=!![];queues[_0x3c5828[_0x1a6f('0x4d')]][_0x1a6f('0x46')]=_0x1a6f('0x50');queues[_0x3c5828[_0x1a6f('0x4d')]][_0x1a6f('0x51')]=_0x3c5828[_0x1a6f('0x5b')];queues[_0x3c5828[_0x1a6f('0x4d')]][_0x1a6f('0x48')]=_0x3c5828[_0x1a6f('0x59')];queues[_0x3c5828[_0x1a6f('0x4d')]][_0x1a6f('0x8')]=_0x1a6f('0x52');}if(!_[_0x1a6f('0x15')](queues[_0x3c5828[_0x1a6f('0x4e')]])){if(_0x3c5828['transfertargetlinkedid']&&queues[_0x3c5828['transfertargetlinkedid']]){queues[_0x3c5828[_0x1a6f('0x5c')]][_0x1a6f('0x20')]=0x1;queues[_0x3c5828['transfertargetuniqueid']]=_[_0x1a6f('0x5d')](queues[_0x3c5828['transfertargetlinkedid']]);queues[_0x3c5828[_0x1a6f('0x54')]][_0x1a6f('0xd')]=_0x3c5828[_0x1a6f('0x54')];queues[_0x3c5828[_0x1a6f('0x54')]][_0x1a6f('0x20')]=0x2;queues[_0x3c5828[_0x1a6f('0x54')]][_0x1a6f('0x6')]=queues[_0x3c5828[_0x1a6f('0x4d')]][_0x1a6f('0x6')];queues[_0x3c5828['transfertargetuniqueid']][_0x1a6f('0x55')]=queues[_0x3c5828[_0x1a6f('0x4d')]][_0x1a6f('0x55')];queues[_0x3c5828[_0x1a6f('0x54')]][_0x1a6f('0x5e')]=utils[_0x1a6f('0x14')]();queues[_0x3c5828['transfertargetuniqueid']][_0x1a6f('0x17')]=utils[_0x1a6f('0x14')]();queues[_0x3c5828['transfertargetuniqueid']]['holdtime']=0x0;queues[_0x3c5828[_0x1a6f('0x54')]]['mohtime']=0x0;utils['info'](util[_0x1a6f('0x1')](_0x1a6f('0x5f'),_0x3c5828[_0x1a6f('0x4c')],queues[_0x3c5828[_0x1a6f('0x54')]][_0x1a6f('0x1e')],queues[_0x3c5828[_0x1a6f('0x54')]][_0x1a6f('0xd')],queues[_0x3c5828['transfertargetuniqueid']][_0x1a6f('0x6')],queues[_0x3c5828[_0x1a6f('0x54')]][_0x1a6f('0x55')]));}else{utils['info'](util[_0x1a6f('0x1')](_0x1a6f('0x58'),_0x3c5828[_0x1a6f('0x4c')],queues[_0x3c5828[_0x1a6f('0x4e')]]['name'],_0x3c5828[_0x1a6f('0x4d')]));queues[_0x3c5828[_0x1a6f('0x4e')]][_0x1a6f('0xd')]=_0x3c5828[_0x1a6f('0x4d')];}}}}catch(_0x659963){utils[_0x1a6f('0x21')](util[_0x1a6f('0x1')](_0x1a6f('0x4b'),_0x3c5828[_0x1a6f('0x4c')]),_0x659963);}};exports[_0x1a6f('0x60')]=function(_0x3d17b1){try{if(!_[_0x1a6f('0x15')](queues[_0x3d17b1['uniqueid']])){utils['debug'](util[_0x1a6f('0x1')](_0x1a6f('0x61'),_0x3d17b1['uniqueid']),_0x3d17b1);queues[_0x3d17b1[_0x1a6f('0xe')]][_0x1a6f('0x62')]=utils[_0x1a6f('0x14')]();utils['info'](util[_0x1a6f('0x1')](_0x1a6f('0x63'),_0x3d17b1[_0x1a6f('0xe')],queues[_0x3d17b1[_0x1a6f('0xe')]]['name'],queues[_0x3d17b1[_0x1a6f('0xe')]][_0x1a6f('0x62')]));}}catch(_0x24eb7a){utils['error'](util[_0x1a6f('0x1')](_0x1a6f('0x61'),_0x3d17b1[_0x1a6f('0xe')]),_0x24eb7a);}};exports[_0x1a6f('0x64')]=function(_0x4108c8){try{if(!_['isNil'](queues[_0x4108c8[_0x1a6f('0xe')]])){if(!_[_0x1a6f('0x15')](queues[_0x4108c8[_0x1a6f('0xe')]]['musiconholdstartAt'])){utils[_0x1a6f('0x10')](util[_0x1a6f('0x1')](_0x1a6f('0x65'),_0x4108c8[_0x1a6f('0xe')]),_0x4108c8);queues[_0x4108c8['uniqueid']][_0x1a6f('0x56')]+=utils[_0x1a6f('0x34')](utils[_0x1a6f('0x14')](),queues[_0x4108c8[_0x1a6f('0xe')]][_0x1a6f('0x62')]);utils['info'](util[_0x1a6f('0x1')]('[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s',_0x4108c8[_0x1a6f('0xe')],queues[_0x4108c8[_0x1a6f('0xe')]][_0x1a6f('0x1e')],queues[_0x4108c8[_0x1a6f('0xe')]][_0x1a6f('0x56')]));delete queues[_0x4108c8['uniqueid']][_0x1a6f('0x62')];}}}catch(_0x46eb64){utils['error'](util[_0x1a6f('0x1')](_0x1a6f('0x65'),_0x4108c8[_0x1a6f('0xe')]),_0x46eb64);}}; \ No newline at end of file +var _0xfb7b=['isNil','queuecallerabandon','queuecallerabandonAt','now','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queueposition','queuecallerexitAt','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','ABANDONED','queuecallerleave','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinename','diffTime','queuecallerjoinAt','connectedlinenum','agentconnect','[%s][queues][agentconnect]','membername','destaccountcode','agentcomplete','[%s][queues][agentcomplete]','reason','transfer','TRANSFER','COMPLETEDBY','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','transfereeuniqueid','BLIND','transferexten','extension','transferuniqueid','BLINDTRANSFER','[%s][queues][blindtransfer]','attendedtransfer','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfereruniqueid','origtransfererexten','ATTENDED','ATTENDEDTRANSFER','transfereelinkedid','clone','calleridname','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','transfertype','transfertargetlinkedid','transfertargetuniqueid','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','musiconholdstart','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','[%s][queues][musiconholdstart]','[%s][queues][musiconholdstop]','util','./utils','info','format','uniqueid','lastAssignedTo','calleridnum','queuecallerexitreason','queue','then','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','[%s][queues][queuecallerjoin]','hangup','[%s][queues][hangup]','queuecallerleaveAt','queuecallerexit','queuecallercomplete','queuecallercompleteAt','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','error','varset','debug','[%s][queues][varset]','variable','queuestatus','value','toUpperCase','CONTINUE'];(function(_0x5eb6c4,_0x17c229){var _0x16fe97=function(_0x124a38){while(--_0x124a38){_0x5eb6c4['push'](_0x5eb6c4['shift']());}};_0x16fe97(++_0x17c229);}(_0xfb7b,0x1ca));var _0xbfb7=function(_0x4da67e,_0x5882f7){_0x4da67e=_0x4da67e-0x0;var _0x46eb37=_0xfb7b[_0x4da67e];return _0x46eb37;};'use strict';var _=require('lodash');var util=require(_0xbfb7('0x0'));var utils=require(_0xbfb7('0x1'));var queues={};function writeDB(_0x1a375b){utils[_0xbfb7('0x2')](util[_0xbfb7('0x3')]('[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s',_0x1a375b[_0xbfb7('0x4')],_0x1a375b['channel'],_0x1a375b['queue'],_0x1a375b[_0xbfb7('0x5')],_0x1a375b[_0xbfb7('0x6')],_0x1a375b['accountcode'],_0x1a375b[_0xbfb7('0x7')]));if(_0x1a375b[_0xbfb7('0x8')]){utils['getVoiceQueueByName'](_0x1a375b['queue'])[_0xbfb7('0x9')](function(_0x86b34){if(_0x86b34){_0x1a375b[_0xbfb7('0xa')]=_0x86b34[_0xbfb7('0xa')];}utils[_0xbfb7('0xb')](_0xbfb7('0xc'),_0x1a375b);});}else{utils[_0xbfb7('0xb')](_0xbfb7('0xc'),_0x1a375b);}if(_0x1a375b[_0xbfb7('0xd')]){delete queues[_0x1a375b[_0xbfb7('0xd')]];}else{delete queues[_0x1a375b[_0xbfb7('0x4')]];}}exports[_0xbfb7('0xe')]=function(_0x136aae){try{utils['debug'](util[_0xbfb7('0x3')]('[%s][queues][queuecallerjoin]',_0x136aae[_0xbfb7('0x4')]),_0x136aae);utils['info'](util['format'](_0xbfb7('0xf'),_0x136aae['uniqueid'],_0x136aae[_0xbfb7('0x8')],_0x136aae[_0xbfb7('0x10')]));queues[_0x136aae[_0xbfb7('0x4')]]=_['assign'](_0x136aae,{'originalposition':_0x136aae[_0xbfb7('0x10')],'queuecallerjoinAt':utils['now'](),'mohtime':0x0});}catch(_0xb4f29f){utils['error'](util[_0xbfb7('0x3')](_0xbfb7('0x11'),_0x136aae[_0xbfb7('0x4')]),_0xb4f29f);}};exports[_0xbfb7('0x12')]=function(_0x13da6c){try{if(!_['isNil'](queues[_0x13da6c[_0xbfb7('0x4')]])){utils['debug'](util[_0xbfb7('0x3')](_0xbfb7('0x13'),_0x13da6c[_0xbfb7('0x4')]),_0x13da6c);if(queues[_0x13da6c['uniqueid']][_0xbfb7('0x14')]){if(!queues[_0x13da6c['uniqueid']]['queuecallerabandon']&&!queues[_0x13da6c[_0xbfb7('0x4')]][_0xbfb7('0x15')]){queues[_0x13da6c['uniqueid']][_0xbfb7('0x16')]=!![];queues[_0x13da6c[_0xbfb7('0x4')]][_0xbfb7('0x17')]=utils['now']();queues[_0x13da6c['uniqueid']]['queuecallerexitreason']='COMPLETEDBYAGENT';}utils[_0xbfb7('0x2')](util[_0xbfb7('0x3')](_0xbfb7('0x18'),_0x13da6c['uniqueid'],queues[_0x13da6c[_0xbfb7('0x4')]][_0xbfb7('0x19')],queues[_0x13da6c['uniqueid']][_0xbfb7('0x7')]));writeDB(queues[_0x13da6c[_0xbfb7('0x4')]]);}else if(queues[_0x13da6c['uniqueid']][_0xbfb7('0xd')]){utils['info'](util[_0xbfb7('0x3')](_0xbfb7('0x1a'),_0x13da6c[_0xbfb7('0x4')],queues[_0x13da6c[_0xbfb7('0x4')]][_0xbfb7('0x19')],queues[_0x13da6c[_0xbfb7('0x4')]][_0xbfb7('0xd')]));queues[queues[_0x13da6c[_0xbfb7('0x4')]][_0xbfb7('0xd')]]=queues[_0x13da6c[_0xbfb7('0x4')]];queues[queues[_0x13da6c[_0xbfb7('0x4')]][_0xbfb7('0xd')]][_0xbfb7('0x1b')]=0x2;delete queues[_0x13da6c[_0xbfb7('0x4')]];}}}catch(_0x188307){utils[_0xbfb7('0x1c')](util[_0xbfb7('0x3')](_0xbfb7('0x13'),_0x13da6c[_0xbfb7('0x4')]),_0x188307);}};exports[_0xbfb7('0x1d')]=function(_0x5bdc13){try{utils[_0xbfb7('0x1e')](util['format'](_0xbfb7('0x1f'),_0x5bdc13[_0xbfb7('0x4')]),_0x5bdc13);if(!_['isNil'](_0x5bdc13[_0xbfb7('0x20')][_0xbfb7('0x21')])&&_0x5bdc13[_0xbfb7('0x22')][_0xbfb7('0x23')]()!==_0xbfb7('0x24')){if(!_[_0xbfb7('0x25')](queues[_0x5bdc13[_0xbfb7('0x4')]])){queues[_0x5bdc13[_0xbfb7('0x4')]][_0xbfb7('0x26')]=![];queues[_0x5bdc13['uniqueid']][_0xbfb7('0x27')]=null;queues[_0x5bdc13[_0xbfb7('0x4')]][_0xbfb7('0x15')]=!![];queues[_0x5bdc13[_0xbfb7('0x4')]]['queuecallerexitAt']=utils[_0xbfb7('0x28')]();queues[_0x5bdc13['uniqueid']][_0xbfb7('0x7')]=_0x5bdc13[_0xbfb7('0x22')]['toUpperCase']();utils['info'](util[_0xbfb7('0x3')](_0xbfb7('0x29'),_0x5bdc13[_0xbfb7('0x4')],queues[_0x5bdc13[_0xbfb7('0x4')]][_0xbfb7('0x19')],_0x5bdc13[_0xbfb7('0x22')],queues[_0x5bdc13[_0xbfb7('0x4')]][_0xbfb7('0x7')]));writeDB(queues[_0x5bdc13[_0xbfb7('0x4')]]);}}else if(!_[_0xbfb7('0x25')](_0x5bdc13[_0xbfb7('0x20')][_0xbfb7('0x2a')])){if(!_['isNil'](queues[_0x5bdc13['uniqueid']])&&!queues[_0x5bdc13['uniqueid']][_0xbfb7('0x26')]){queues[_0x5bdc13[_0xbfb7('0x4')]][_0xbfb7('0x26')]=![];queues[_0x5bdc13['uniqueid']][_0xbfb7('0x27')]=null;queues[_0x5bdc13['uniqueid']]['queuecallerexit']=!![];queues[_0x5bdc13[_0xbfb7('0x4')]][_0xbfb7('0x2b')]=utils['now']();queues[_0x5bdc13['uniqueid']]['queuecallerexitreason']='EXITWITHKEY';utils['info'](util[_0xbfb7('0x3')](_0xbfb7('0x2c'),_0x5bdc13[_0xbfb7('0x4')],queues[_0x5bdc13[_0xbfb7('0x4')]][_0xbfb7('0x19')],_0x5bdc13['value'],queues[_0x5bdc13[_0xbfb7('0x4')]][_0xbfb7('0x7')]));}}}catch(_0x11f845){utils[_0xbfb7('0x1c')](util[_0xbfb7('0x3')](_0xbfb7('0x1f'),_0x5bdc13[_0xbfb7('0x4')]),_0x11f845);}};exports[_0xbfb7('0x26')]=function(_0x55ba8a){try{if(!_['isNil'](queues[_0x55ba8a[_0xbfb7('0x4')]])){utils[_0xbfb7('0x1e')](util[_0xbfb7('0x3')](_0xbfb7('0x2d'),_0x55ba8a['uniqueid']),_0x55ba8a);queues[_0x55ba8a['uniqueid']][_0xbfb7('0x15')]=![];queues[_0x55ba8a[_0xbfb7('0x4')]][_0xbfb7('0x2b')]=null;queues[_0x55ba8a[_0xbfb7('0x4')]][_0xbfb7('0x26')]=!![];queues[_0x55ba8a[_0xbfb7('0x4')]][_0xbfb7('0x27')]=utils[_0xbfb7('0x28')]();queues[_0x55ba8a[_0xbfb7('0x4')]][_0xbfb7('0x7')]=_0xbfb7('0x2e');utils[_0xbfb7('0x2')](util['format']('[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s',_0x55ba8a[_0xbfb7('0x4')],queues[_0x55ba8a[_0xbfb7('0x4')]][_0xbfb7('0x19')],queues[_0x55ba8a[_0xbfb7('0x4')]]['queuecallerexitreason']));}}catch(_0x17327b){utils['error'](util[_0xbfb7('0x3')](_0xbfb7('0x2d'),_0x55ba8a[_0xbfb7('0x4')]),_0x17327b);}};exports[_0xbfb7('0x2f')]=function(_0x9d05a0){try{if(!_[_0xbfb7('0x25')](queues[_0x9d05a0['uniqueid']])){utils['debug'](util[_0xbfb7('0x3')](_0xbfb7('0x30'),_0x9d05a0[_0xbfb7('0x4')]),_0x9d05a0);utils[_0xbfb7('0x2')](util[_0xbfb7('0x3')](_0xbfb7('0x31'),_0x9d05a0[_0xbfb7('0x4')],queues[_0x9d05a0[_0xbfb7('0x4')]][_0xbfb7('0x19')],_0x9d05a0['connectedlinenum'],_0x9d05a0[_0xbfb7('0x32')]));queues[_0x9d05a0['uniqueid']][_0xbfb7('0x2f')]=!![];queues[_0x9d05a0[_0xbfb7('0x4')]]['queuecallerleaveAt']=utils['now']();queues[_0x9d05a0[_0xbfb7('0x4')]]['holdtime']=utils[_0xbfb7('0x33')](queues[_0x9d05a0[_0xbfb7('0x4')]][_0xbfb7('0x14')],queues[_0x9d05a0['uniqueid']][_0xbfb7('0x34')]);queues[_0x9d05a0[_0xbfb7('0x4')]][_0xbfb7('0x10')]=_0x9d05a0[_0xbfb7('0x10')];queues[_0x9d05a0[_0xbfb7('0x4')]]['count']=_0x9d05a0['count'];queues[_0x9d05a0[_0xbfb7('0x4')]][_0xbfb7('0x35')]=_0x9d05a0['connectedlinenum'];queues[_0x9d05a0[_0xbfb7('0x4')]][_0xbfb7('0x32')]=_0x9d05a0[_0xbfb7('0x32')];}}catch(_0x54ab86){utils[_0xbfb7('0x1c')](util['format'](_0xbfb7('0x30'),_0x9d05a0[_0xbfb7('0x4')]),_0x54ab86);}};exports[_0xbfb7('0x36')]=function(_0x252ef7){try{if(!_[_0xbfb7('0x25')](queues[_0x252ef7[_0xbfb7('0x4')]])){utils[_0xbfb7('0x1e')](util['format'](_0xbfb7('0x37'),_0x252ef7['uniqueid']),_0x252ef7);utils[_0xbfb7('0x2')](util['format']('[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s',_0x252ef7[_0xbfb7('0x4')],queues[_0x252ef7['uniqueid']]['name'],_0x252ef7[_0xbfb7('0x38')],_0x252ef7[_0xbfb7('0x39')]));queues[_0x252ef7[_0xbfb7('0x4')]][_0xbfb7('0x26')]=![];queues[_0x252ef7['uniqueid']]['queuecallerabandon']=![];queues[_0x252ef7[_0xbfb7('0x4')]][_0xbfb7('0x27')]=null;queues[_0x252ef7[_0xbfb7('0x4')]][_0xbfb7('0x15')]=![];queues[_0x252ef7[_0xbfb7('0x4')]][_0xbfb7('0x7')]=null;queues[_0x252ef7[_0xbfb7('0x4')]][_0xbfb7('0x2b')]=null;queues[_0x252ef7[_0xbfb7('0x4')]]['assigned']=!![];queues[_0x252ef7['uniqueid']]['accountcode']=_0x252ef7[_0xbfb7('0x39')];queues[_0x252ef7[_0xbfb7('0x4')]][_0xbfb7('0x5')]=_0x252ef7[_0xbfb7('0x38')];}}catch(_0x1cf48f){utils[_0xbfb7('0x1c')](util[_0xbfb7('0x3')]('[%s][queues][agentconnect]',_0x252ef7['uniqueid']),_0x1cf48f);}};exports[_0xbfb7('0x3a')]=function(_0x28ace2){try{if(!_['isNil'](queues[_0x28ace2['uniqueid']])){if(queues[_0x28ace2[_0xbfb7('0x4')]][_0xbfb7('0x14')]){utils[_0xbfb7('0x1e')](util[_0xbfb7('0x3')](_0xbfb7('0x3b'),_0x28ace2[_0xbfb7('0x4')]),_0x28ace2);queues[_0x28ace2[_0xbfb7('0x4')]]['queuecallerabandon']=![];queues[_0x28ace2['uniqueid']]['queuecallerabandon']=![];queues[_0x28ace2[_0xbfb7('0x4')]][_0xbfb7('0x27')]=null;queues[_0x28ace2[_0xbfb7('0x4')]][_0xbfb7('0x15')]=![];queues[_0x28ace2['uniqueid']][_0xbfb7('0x2b')]=null;queues[_0x28ace2['uniqueid']]['assigned']=!![];queues[_0x28ace2[_0xbfb7('0x4')]][_0xbfb7('0x5')]=_0x28ace2[_0xbfb7('0x38')];queues[_0x28ace2[_0xbfb7('0x4')]][_0xbfb7('0x16')]=!![];queues[_0x28ace2[_0xbfb7('0x4')]][_0xbfb7('0x17')]=utils['now']();if(_0x28ace2[_0xbfb7('0x3c')]==_0xbfb7('0x3d')){if(!queues[_0x28ace2[_0xbfb7('0x4')]]['transfer']){queues[_0x28ace2['uniqueid']][_0xbfb7('0x7')]=_0xbfb7('0x3e');}}else{queues[_0x28ace2[_0xbfb7('0x4')]][_0xbfb7('0x7')]=_0xbfb7('0x3f')+_0x28ace2[_0xbfb7('0x3c')][_0xbfb7('0x23')]();}utils[_0xbfb7('0x2')](util[_0xbfb7('0x3')](_0xbfb7('0x40'),_0x28ace2['uniqueid'],queues[_0x28ace2[_0xbfb7('0x4')]][_0xbfb7('0x19')],_0x28ace2[_0xbfb7('0x38')],queues[_0x28ace2[_0xbfb7('0x4')]]['queuecallerexitreason']));writeDB(queues[_0x28ace2[_0xbfb7('0x4')]]);}}}catch(_0x28d376){utils[_0xbfb7('0x1c')](util[_0xbfb7('0x3')](_0xbfb7('0x3b'),_0x28ace2[_0xbfb7('0x4')]),_0x28d376);}};exports[_0xbfb7('0x41')]=function(_0x440406){try{if(!_[_0xbfb7('0x25')](queues[_0x440406[_0xbfb7('0x42')]])){utils[_0xbfb7('0x1e')](util['format']('[%s][queues][blindtransfer]',_0x440406[_0xbfb7('0x4')]),_0x440406);queues[_0x440406[_0xbfb7('0x42')]]['transfer']=!![];queues[_0x440406[_0xbfb7('0x42')]]['transfertype']=_0xbfb7('0x43');queues[_0x440406[_0xbfb7('0x42')]][_0xbfb7('0x44')]=_0x440406[_0xbfb7('0x45')];queues[_0x440406[_0xbfb7('0x42')]][_0xbfb7('0x46')]=_0x440406[_0xbfb7('0x42')];queues[_0x440406[_0xbfb7('0x42')]][_0xbfb7('0x7')]=_0xbfb7('0x47');utils[_0xbfb7('0x2')](util[_0xbfb7('0x3')]('[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER',_0x440406[_0xbfb7('0x4')],queues[_0x440406['transfereeuniqueid']][_0xbfb7('0x19')],_0x440406[_0xbfb7('0x42')],_0x440406[_0xbfb7('0x45')]));}}catch(_0x23112b){utils[_0xbfb7('0x1c')](util['format'](_0xbfb7('0x48'),_0x440406[_0xbfb7('0x4')]),_0x23112b);}};exports[_0xbfb7('0x49')]=function(_0x4f6740){try{utils[_0xbfb7('0x1e')](util[_0xbfb7('0x3')]('[%s][queues][attendedtransfer]',_0x4f6740['origtransfereruniqueid']),_0x4f6740);if(_0x4f6740['origtransfereruniqueid']==_0x4f6740[_0xbfb7('0x4a')]){if(!_[_0xbfb7('0x25')](queues[_0x4f6740[_0xbfb7('0x4b')]])){utils['info'](util['format'](_0xbfb7('0x4c'),_0x4f6740[_0xbfb7('0x4d')],queues[_0x4f6740[_0xbfb7('0x4b')]][_0xbfb7('0x19')],_0x4f6740[_0xbfb7('0x4e')]));queues[_0x4f6740[_0xbfb7('0x4b')]][_0xbfb7('0x3d')]=!![];queues[_0x4f6740[_0xbfb7('0x4b')]]['transfertype']=_0xbfb7('0x4f');queues[_0x4f6740[_0xbfb7('0x4b')]][_0xbfb7('0x44')]=_0x4f6740[_0xbfb7('0x4e')];queues[_0x4f6740[_0xbfb7('0x4b')]][_0xbfb7('0x46')]=_0x4f6740[_0xbfb7('0x4d')];queues[_0x4f6740[_0xbfb7('0x4b')]][_0xbfb7('0x7')]=_0xbfb7('0x50');}if(!_['isNil'](queues[_0x4f6740[_0xbfb7('0x4a')]])){if(_0x4f6740['transfereelinkedid']&&queues[_0x4f6740[_0xbfb7('0x51')]]){queues[_0x4f6740[_0xbfb7('0x51')]]['queuecallerenterreason']=0x1;queues[_0x4f6740[_0xbfb7('0x42')]]=_[_0xbfb7('0x52')](queues[_0x4f6740[_0xbfb7('0x51')]]);queues[_0x4f6740[_0xbfb7('0x42')]][_0xbfb7('0xd')]=_0x4f6740['transfertargetuniqueid'];queues[_0x4f6740[_0xbfb7('0x42')]]['queuecallerenterreason']=0x2;queues[_0x4f6740['transfereeuniqueid']]['calleridnum']=queues[_0x4f6740['secondtransfererlinkedid']][_0xbfb7('0x6')];queues[_0x4f6740[_0xbfb7('0x42')]][_0xbfb7('0x53')]=queues[_0x4f6740[_0xbfb7('0x4b')]][_0xbfb7('0x53')];queues[_0x4f6740['transfereeuniqueid']]['queuecallerjoinAt']=utils['now']();queues[_0x4f6740['transfereeuniqueid']]['queuecallerleaveAt']=utils[_0xbfb7('0x28')]();queues[_0x4f6740[_0xbfb7('0x42')]]['holdtime']=0x0;queues[_0x4f6740[_0xbfb7('0x42')]]['mohtime']=0x0;utils['info'](util[_0xbfb7('0x3')](_0xbfb7('0x54'),_0x4f6740[_0xbfb7('0x4d')],queues[_0x4f6740[_0xbfb7('0x42')]][_0xbfb7('0x19')],queues[_0x4f6740[_0xbfb7('0x42')]]['calleridnum'],queues[_0x4f6740[_0xbfb7('0x42')]][_0xbfb7('0x53')]));}else{utils[_0xbfb7('0x2')](util[_0xbfb7('0x3')](_0xbfb7('0x55'),_0x4f6740['origtransfereruniqueid'],queues[_0x4f6740[_0xbfb7('0x4a')]][_0xbfb7('0x19')],_0x4f6740['secondtransfererlinkedid']));queues[_0x4f6740[_0xbfb7('0x4a')]][_0xbfb7('0xd')]=_0x4f6740[_0xbfb7('0x4b')];}}}else if(_0x4f6740[_0xbfb7('0x56')]==_0x4f6740[_0xbfb7('0x4b')]){if(!_[_0xbfb7('0x25')](queues[_0x4f6740[_0xbfb7('0x4a')]])){utils[_0xbfb7('0x2')](util[_0xbfb7('0x3')](_0xbfb7('0x57'),_0x4f6740[_0xbfb7('0x4d')],queues[_0x4f6740[_0xbfb7('0x4a')]]['name'],_0x4f6740[_0xbfb7('0x56')],_0x4f6740[_0xbfb7('0x58')]));queues[_0x4f6740[_0xbfb7('0x4a')]]['transfer']=!![];queues[_0x4f6740[_0xbfb7('0x4a')]][_0xbfb7('0x59')]=_0xbfb7('0x4f');queues[_0x4f6740[_0xbfb7('0x4a')]]['transferexten']=_0x4f6740[_0xbfb7('0x58')];queues[_0x4f6740[_0xbfb7('0x4a')]][_0xbfb7('0x46')]=_0x4f6740[_0xbfb7('0x56')];queues[_0x4f6740[_0xbfb7('0x4a')]][_0xbfb7('0x7')]=_0xbfb7('0x50');}if(!_['isNil'](queues[_0x4f6740[_0xbfb7('0x4b')]])){if(_0x4f6740[_0xbfb7('0x5a')]&&queues[_0x4f6740['transfertargetlinkedid']]){queues[_0x4f6740[_0xbfb7('0x5a')]][_0xbfb7('0x1b')]=0x1;queues[_0x4f6740[_0xbfb7('0x5b')]]=_[_0xbfb7('0x52')](queues[_0x4f6740[_0xbfb7('0x5a')]]);queues[_0x4f6740[_0xbfb7('0x5b')]][_0xbfb7('0xd')]=_0x4f6740[_0xbfb7('0x5b')];queues[_0x4f6740[_0xbfb7('0x5b')]]['queuecallerenterreason']=0x2;queues[_0x4f6740[_0xbfb7('0x5b')]][_0xbfb7('0x6')]=queues[_0x4f6740[_0xbfb7('0x4a')]]['calleridnum'];queues[_0x4f6740['transfertargetuniqueid']][_0xbfb7('0x53')]=queues[_0x4f6740[_0xbfb7('0x4a')]][_0xbfb7('0x53')];queues[_0x4f6740[_0xbfb7('0x5b')]][_0xbfb7('0x34')]=utils[_0xbfb7('0x28')]();queues[_0x4f6740[_0xbfb7('0x5b')]][_0xbfb7('0x14')]=utils['now']();queues[_0x4f6740[_0xbfb7('0x5b')]]['holdtime']=0x0;queues[_0x4f6740[_0xbfb7('0x5b')]][_0xbfb7('0x5c')]=0x0;utils[_0xbfb7('0x2')](util[_0xbfb7('0x3')](_0xbfb7('0x5d'),_0x4f6740[_0xbfb7('0x4d')],queues[_0x4f6740[_0xbfb7('0x5b')]][_0xbfb7('0x19')],queues[_0x4f6740[_0xbfb7('0x5b')]][_0xbfb7('0xd')],queues[_0x4f6740[_0xbfb7('0x5b')]][_0xbfb7('0x6')],queues[_0x4f6740['transfertargetuniqueid']][_0xbfb7('0x53')]));}else{utils[_0xbfb7('0x2')](util[_0xbfb7('0x3')](_0xbfb7('0x55'),_0x4f6740['origtransfereruniqueid'],queues[_0x4f6740[_0xbfb7('0x4b')]]['name'],_0x4f6740[_0xbfb7('0x4a')]));queues[_0x4f6740[_0xbfb7('0x4b')]][_0xbfb7('0xd')]=_0x4f6740['origtransfererlinkedid'];}}}}catch(_0x1759b0){utils[_0xbfb7('0x1c')](util[_0xbfb7('0x3')]('[%s][queues][attendedtransfer]',_0x4f6740[_0xbfb7('0x4d')]),_0x1759b0);}};exports[_0xbfb7('0x5e')]=function(_0x4fd792){try{if(!_[_0xbfb7('0x25')](queues[_0x4fd792[_0xbfb7('0x4')]])){utils[_0xbfb7('0x1e')](util[_0xbfb7('0x3')]('[%s][queues][musiconholdstart]',_0x4fd792[_0xbfb7('0x4')]),_0x4fd792);queues[_0x4fd792['uniqueid']][_0xbfb7('0x5f')]=utils[_0xbfb7('0x28')]();utils[_0xbfb7('0x2')](util[_0xbfb7('0x3')](_0xbfb7('0x60'),_0x4fd792[_0xbfb7('0x4')],queues[_0x4fd792[_0xbfb7('0x4')]][_0xbfb7('0x19')],queues[_0x4fd792[_0xbfb7('0x4')]][_0xbfb7('0x5f')]));}}catch(_0x7a113){utils[_0xbfb7('0x1c')](util['format'](_0xbfb7('0x61'),_0x4fd792['uniqueid']),_0x7a113);}};exports['musiconholdstop']=function(_0x6d3143){try{if(!_[_0xbfb7('0x25')](queues[_0x6d3143['uniqueid']])){if(!_[_0xbfb7('0x25')](queues[_0x6d3143[_0xbfb7('0x4')]][_0xbfb7('0x5f')])){utils[_0xbfb7('0x1e')](util[_0xbfb7('0x3')](_0xbfb7('0x62'),_0x6d3143[_0xbfb7('0x4')]),_0x6d3143);queues[_0x6d3143[_0xbfb7('0x4')]][_0xbfb7('0x5c')]+=utils['diffTime'](utils['now'](),queues[_0x6d3143[_0xbfb7('0x4')]][_0xbfb7('0x5f')]);utils[_0xbfb7('0x2')](util['format']('[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s',_0x6d3143['uniqueid'],queues[_0x6d3143[_0xbfb7('0x4')]][_0xbfb7('0x19')],queues[_0x6d3143['uniqueid']][_0xbfb7('0x5c')]));delete queues[_0x6d3143['uniqueid']]['musiconholdstartAt'];}}}catch(_0x34b068){utils['error'](util[_0xbfb7('0x3')]('[%s][queues][musiconholdstop]',_0x6d3143['uniqueid']),_0x34b068);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index 46d369e..aa4982e 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 _0x2f1a=['connectedlinenum','connectedlinename','type','outbound','forEach','clone','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','split','substring','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','lodash','util','./utils','info','format','[%s][recordings][writeDB]','uniqueid','accountcode','getUserByInternal','then','UserId','request','CreateVoiceRecording','newchannel','debug','context','exten','channel','[%s][recordings][newchannel]','[%s][recordings][newstate]','isNil','linkedid','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','variable','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith','.wav49','.WAV','monitors','error','[%s][recordings][varset]','hangup','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','cause-txt'];(function(_0x50ab39,_0x40e15e){var _0x41ae56=function(_0x5b5868){while(--_0x5b5868){_0x50ab39['push'](_0x50ab39['shift']());}};_0x41ae56(++_0x40e15e);}(_0x2f1a,0xc1));var _0xa2f1=function(_0x363598,_0x45a78b){_0x363598=_0x363598-0x0;var _0x529781=_0x2f1a[_0x363598];return _0x529781;};'use strict';var _=require(_0xa2f1('0x0'));var util=require(_0xa2f1('0x1'));var utils=require(_0xa2f1('0x2'));var recordings={};function writeDB(_0x429940){utils[_0xa2f1('0x3')](util[_0xa2f1('0x4')](_0xa2f1('0x5'),_0x429940[_0xa2f1('0x6')]));if(_0x429940[_0xa2f1('0x7')]){utils[_0xa2f1('0x8')](_0x429940[_0xa2f1('0x7')])[_0xa2f1('0x9')](function(_0x224f81){if(_0x224f81){_0x429940['membername']=_0x224f81['name'];_0x429940[_0xa2f1('0xa')]=_0x224f81['id'];}utils[_0xa2f1('0xb')](_0xa2f1('0xc'),_0x429940);});}else{utils[_0xa2f1('0xb')](_0xa2f1('0xc'),_0x429940);}}exports[_0xa2f1('0xd')]=function(_0x579f2a){try{utils[_0xa2f1('0xe')](util['format']('[%s][recordings][newchannel]',_0x579f2a['uniqueid']),_0x579f2a);if(_0x579f2a[_0xa2f1('0x6')]==_0x579f2a['linkedid']){utils[_0xa2f1('0x3')](util[_0xa2f1('0x4')]('[%s][recordings][newchannel]\x20context:%s\x20exten:%s',_0x579f2a['uniqueid'],_0x579f2a[_0xa2f1('0xf')],_0x579f2a[_0xa2f1('0x10')]));recordings[_0x579f2a[_0xa2f1('0x6')]]={'uniqueid':_0x579f2a[_0xa2f1('0x6')],'accountcode':_0x579f2a[_0xa2f1('0x7')],'exten':_0x579f2a[_0xa2f1('0x10')],'context':_0x579f2a['context'],'channel':_0x579f2a[_0xa2f1('0x11')],'monitors':[]};}}catch(_0x3fe9ab){utils['error'](util[_0xa2f1('0x4')](_0xa2f1('0x12'),_0x579f2a[_0xa2f1('0x6')]),_0x3fe9ab);}};exports['newstate']=function(_0x3ba9ba){try{utils['debug'](util[_0xa2f1('0x4')](_0xa2f1('0x13'),_0x3ba9ba[_0xa2f1('0x6')]),_0x3ba9ba);if(!_[_0xa2f1('0x14')](recordings[_0x3ba9ba[_0xa2f1('0x6')]])&&_0x3ba9ba['channelstate']==0x6){utils[_0xa2f1('0x3')](util[_0xa2f1('0x4')]('[%s][recordings][newstate]\x20context:%s\x20channel:%s',_0x3ba9ba[_0xa2f1('0x6')],_0x3ba9ba[_0xa2f1('0xf')],_0x3ba9ba[_0xa2f1('0x11')]));}else if(!_[_0xa2f1('0x14')](recordings[_0x3ba9ba[_0xa2f1('0x15')]])&&_0x3ba9ba['channelstate']==0x6&&_0x3ba9ba[_0xa2f1('0xf')]!=_0xa2f1('0x16')){utils['info'](util[_0xa2f1('0x4')](_0xa2f1('0x17'),_0x3ba9ba[_0xa2f1('0x6')],_0x3ba9ba['linkedid'],_0x3ba9ba[_0xa2f1('0xf')],_0x3ba9ba['channel']));recordings[_0x3ba9ba[_0xa2f1('0x15')]][_0xa2f1('0x7')]=_0x3ba9ba[_0xa2f1('0x7')];}}catch(_0x22c5bc){utils['error'](util['format'](_0xa2f1('0x13'),_0x3ba9ba[_0xa2f1('0x6')]),_0x22c5bc);}};exports['varset']=function(_0x97a05b){try{if(!_[_0xa2f1('0x14')](_0x97a05b[_0xa2f1('0x18')])&&!_[_0xa2f1('0x14')](_0x97a05b[_0xa2f1('0x18')]['mixmonitor_filename'])){utils[_0xa2f1('0xe')](util[_0xa2f1('0x4')]('[%s][recordings][varset]',_0x97a05b[_0xa2f1('0x6')]),_0x97a05b);utils[_0xa2f1('0x3')](util[_0xa2f1('0x4')](_0xa2f1('0x19'),_0x97a05b[_0xa2f1('0x6')],_0x97a05b[_0xa2f1('0x18')],_0x97a05b[_0xa2f1('0x1a')]));if(_[_0xa2f1('0x1b')](_0x97a05b[_0xa2f1('0x1a')],_0xa2f1('0x1c'))){_0x97a05b[_0xa2f1('0x1a')]=_0x97a05b['value']['replace'](_0xa2f1('0x1c'),_0xa2f1('0x1d'));}if(recordings[_0x97a05b[_0xa2f1('0x15')]]){var _0xabbd61=_['find'](recordings[_0x97a05b['linkedid']][_0xa2f1('0x1e')],{'value':_0x97a05b['value']});if(_[_0xa2f1('0x14')](_0xabbd61)){recordings[_0x97a05b[_0xa2f1('0x15')]][_0xa2f1('0x1e')]['push']({'value':_0x97a05b['value']});}}}}catch(_0x20481b){utils[_0xa2f1('0x1f')](util[_0xa2f1('0x4')](_0xa2f1('0x20'),_0x97a05b['uniqueid']),_0x20481b);}};exports[_0xa2f1('0x21')]=function(_0x8680bf){try{if(!_[_0xa2f1('0x14')](recordings[_0x8680bf[_0xa2f1('0x6')]])){utils[_0xa2f1('0xe')](util['format'](_0xa2f1('0x22'),_0x8680bf[_0xa2f1('0x6')]),_0x8680bf);utils[_0xa2f1('0x3')](util['format'](_0xa2f1('0x23'),_0x8680bf['uniqueid'],_0x8680bf[_0xa2f1('0x24')],_0x8680bf[_0xa2f1('0x25')],_0x8680bf[_0xa2f1('0x26')]));recordings[_0x8680bf[_0xa2f1('0x6')]][_0xa2f1('0x24')]=_0x8680bf[_0xa2f1('0x24')];recordings[_0x8680bf['uniqueid']][_0xa2f1('0x25')]=_0x8680bf[_0xa2f1('0x25')];recordings[_0x8680bf['uniqueid']][_0xa2f1('0x27')]=_0x8680bf[_0xa2f1('0x27')];recordings[_0x8680bf[_0xa2f1('0x6')]][_0xa2f1('0x28')]=_0x8680bf[_0xa2f1('0x28')];if(recordings[_0x8680bf[_0xa2f1('0x6')]][_0xa2f1('0x29')]==_0xa2f1('0x2a')&&recordings[_0x8680bf[_0xa2f1('0x6')]][_0xa2f1('0x7')]){recordings[_0x8680bf[_0xa2f1('0x6')]][_0xa2f1('0x27')]=recordings[_0x8680bf[_0xa2f1('0x6')]]['accountcode'];recordings[_0x8680bf[_0xa2f1('0x6')]][_0xa2f1('0x28')]='';}recordings[_0x8680bf[_0xa2f1('0x6')]][_0xa2f1('0x1e')][_0xa2f1('0x2b')](function(_0x4d6e2f){var _0x1297fd=_[_0xa2f1('0x2c')](recordings[_0x8680bf['uniqueid']]);_0x1297fd[_0xa2f1('0x1a')]=_0x4d6e2f[_0xa2f1('0x1a')];writeDB(_0x1297fd);});delete recordings[_0x8680bf[_0xa2f1('0x6')]];}}catch(_0x444b7a){utils[_0xa2f1('0x1f')](util[_0xa2f1('0x4')]('[%s][recordings][hangup]',_0x8680bf[_0xa2f1('0x6')]),_0x444b7a);}};exports['newexten']=function(_0x106899){try{if(!_[_0xa2f1('0x14')](recordings[_0x106899[_0xa2f1('0x6')]])){utils[_0xa2f1('0xe')](util[_0xa2f1('0x4')](_0xa2f1('0x2d'),_0x106899[_0xa2f1('0x6')]),_0x106899);utils[_0xa2f1('0x3')](util[_0xa2f1('0x4')](_0xa2f1('0x2e'),_0x106899[_0xa2f1('0x6')],_0x106899[_0xa2f1('0x2f')],_0x106899[_0xa2f1('0x30')]));if(_0x106899[_0xa2f1('0x2f')][_0xa2f1('0x31')]()==_0xa2f1('0x32')&&_['startsWith'](_0x106899[_0xa2f1('0x30')][_0xa2f1('0x31')](),'cdr')){var _0xf7a44d=_0x106899[_0xa2f1('0x30')][_0xa2f1('0x33')]('=');var _0x3791d7=_0xf7a44d[0x0][_0xa2f1('0x34')](_0xf7a44d[0x0][_0xa2f1('0x35')]('(')+0x1,_0xf7a44d[0x0]['lastIndexOf'](')'));var _0x5976d5=_0xf7a44d[0x1];recordings[_0x106899['uniqueid']][_0x3791d7]=_0x5976d5;}}}catch(_0x5185e8){utils[_0xa2f1('0x1f')](util['format'](_0xa2f1('0x2d'),_0x106899[_0xa2f1('0x6')]),_0x5185e8);}};exports[_0xa2f1('0x36')]=function(_0x7784b3){try{if(!_[_0xa2f1('0x14')](recordings[_0x7784b3[_0xa2f1('0x6')]])){utils['debug'](util[_0xa2f1('0x4')](_0xa2f1('0x37'),_0x7784b3['uniqueid']),_0x7784b3);utils[_0xa2f1('0x3')](util['format'](_0xa2f1('0x38'),_0x7784b3[_0xa2f1('0x6')],_0x7784b3['queue']));recordings[_0x7784b3[_0xa2f1('0x6')]]['queue']=_0x7784b3[_0xa2f1('0x39')];}}catch(_0x277c12){utils['error'](util[_0xa2f1('0x4')](_0xa2f1('0x37'),_0x7784b3['uniqueid']),_0x277c12);}}; \ No newline at end of file +var _0xa39a=['connectedlinename','type','forEach','newexten','application','appdata','toLowerCase','set','startsWith','split','substring','lastIndexOf','[%s][recordings][newexten]','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','lodash','util','./utils','info','format','[%s][recordings][writeDB]','uniqueid','getUserByInternal','accountcode','then','CreateVoiceRecording','request','debug','[%s][recordings][newchannel]','linkedid','context','exten','channel','error','newstate','[%s][recordings][newstate]','isNil','[%s][recordings][newstate]\x20context:%s\x20channel:%s','channelstate','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','variable','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith','.wav49','replace','.WAV','find','monitors','push','hangup','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','cause-txt','connectedlinenum'];(function(_0x3a6dfb,_0x5d78a6){var _0x10ae92=function(_0x50cf0b){while(--_0x50cf0b){_0x3a6dfb['push'](_0x3a6dfb['shift']());}};_0x10ae92(++_0x5d78a6);}(_0xa39a,0xc8));var _0xaa39=function(_0x246a7c,_0x4f9d49){_0x246a7c=_0x246a7c-0x0;var _0x5b82db=_0xa39a[_0x246a7c];return _0x5b82db;};'use strict';var _=require(_0xaa39('0x0'));var util=require(_0xaa39('0x1'));var utils=require(_0xaa39('0x2'));var recordings={};function writeDB(_0x37b9ce){utils[_0xaa39('0x3')](util[_0xaa39('0x4')](_0xaa39('0x5'),_0x37b9ce[_0xaa39('0x6')]));if(_0x37b9ce['accountcode']){utils[_0xaa39('0x7')](_0x37b9ce[_0xaa39('0x8')])[_0xaa39('0x9')](function(_0x20527b){if(_0x20527b){_0x37b9ce['membername']=_0x20527b['name'];_0x37b9ce['UserId']=_0x20527b['id'];}utils['request'](_0xaa39('0xa'),_0x37b9ce);});}else{utils[_0xaa39('0xb')](_0xaa39('0xa'),_0x37b9ce);}}exports['newchannel']=function(_0x4262a0){try{utils[_0xaa39('0xc')](util[_0xaa39('0x4')](_0xaa39('0xd'),_0x4262a0[_0xaa39('0x6')]),_0x4262a0);if(_0x4262a0[_0xaa39('0x6')]==_0x4262a0[_0xaa39('0xe')]){utils[_0xaa39('0x3')](util[_0xaa39('0x4')]('[%s][recordings][newchannel]\x20context:%s\x20exten:%s',_0x4262a0[_0xaa39('0x6')],_0x4262a0[_0xaa39('0xf')],_0x4262a0[_0xaa39('0x10')]));recordings[_0x4262a0[_0xaa39('0x6')]]={'uniqueid':_0x4262a0['uniqueid'],'accountcode':_0x4262a0[_0xaa39('0x8')],'exten':_0x4262a0[_0xaa39('0x10')],'context':_0x4262a0['context'],'channel':_0x4262a0[_0xaa39('0x11')],'monitors':[]};}}catch(_0x39c75f){utils[_0xaa39('0x12')](util[_0xaa39('0x4')]('[%s][recordings][newchannel]',_0x4262a0['uniqueid']),_0x39c75f);}};exports[_0xaa39('0x13')]=function(_0x2b24a9){try{utils['debug'](util[_0xaa39('0x4')](_0xaa39('0x14'),_0x2b24a9['uniqueid']),_0x2b24a9);if(!_[_0xaa39('0x15')](recordings[_0x2b24a9[_0xaa39('0x6')]])&&_0x2b24a9['channelstate']==0x6){utils[_0xaa39('0x3')](util[_0xaa39('0x4')](_0xaa39('0x16'),_0x2b24a9[_0xaa39('0x6')],_0x2b24a9[_0xaa39('0xf')],_0x2b24a9['channel']));}else if(!_['isNil'](recordings[_0x2b24a9[_0xaa39('0xe')]])&&_0x2b24a9[_0xaa39('0x17')]==0x6&&_0x2b24a9[_0xaa39('0xf')]!=_0xaa39('0x18')){utils[_0xaa39('0x3')](util[_0xaa39('0x4')](_0xaa39('0x19'),_0x2b24a9[_0xaa39('0x6')],_0x2b24a9['linkedid'],_0x2b24a9[_0xaa39('0xf')],_0x2b24a9[_0xaa39('0x11')]));recordings[_0x2b24a9[_0xaa39('0xe')]][_0xaa39('0x8')]=_0x2b24a9[_0xaa39('0x8')];}}catch(_0x310561){utils[_0xaa39('0x12')](util[_0xaa39('0x4')](_0xaa39('0x14'),_0x2b24a9[_0xaa39('0x6')]),_0x310561);}};exports['varset']=function(_0x4d1d5d){try{if(!_[_0xaa39('0x15')](_0x4d1d5d[_0xaa39('0x1a')])&&!_[_0xaa39('0x15')](_0x4d1d5d['variable']['mixmonitor_filename'])){utils[_0xaa39('0xc')](util['format'](_0xaa39('0x1b'),_0x4d1d5d['uniqueid']),_0x4d1d5d);utils['info'](util[_0xaa39('0x4')](_0xaa39('0x1c'),_0x4d1d5d[_0xaa39('0x6')],_0x4d1d5d[_0xaa39('0x1a')],_0x4d1d5d[_0xaa39('0x1d')]));if(_[_0xaa39('0x1e')](_0x4d1d5d[_0xaa39('0x1d')],_0xaa39('0x1f'))){_0x4d1d5d['value']=_0x4d1d5d[_0xaa39('0x1d')][_0xaa39('0x20')](_0xaa39('0x1f'),_0xaa39('0x21'));}if(recordings[_0x4d1d5d[_0xaa39('0xe')]]){var _0x755e41=_[_0xaa39('0x22')](recordings[_0x4d1d5d['linkedid']][_0xaa39('0x23')],{'value':_0x4d1d5d[_0xaa39('0x1d')]});if(_['isNil'](_0x755e41)){recordings[_0x4d1d5d['linkedid']][_0xaa39('0x23')][_0xaa39('0x24')]({'value':_0x4d1d5d[_0xaa39('0x1d')]});}}}}catch(_0x31385f){utils['error'](util[_0xaa39('0x4')](_0xaa39('0x1b'),_0x4d1d5d[_0xaa39('0x6')]),_0x31385f);}};exports[_0xaa39('0x25')]=function(_0x481da9){try{if(!_[_0xaa39('0x15')](recordings[_0x481da9[_0xaa39('0x6')]])){utils[_0xaa39('0xc')](util[_0xaa39('0x4')](_0xaa39('0x26'),_0x481da9[_0xaa39('0x6')]),_0x481da9);utils[_0xaa39('0x3')](util[_0xaa39('0x4')](_0xaa39('0x27'),_0x481da9[_0xaa39('0x6')],_0x481da9[_0xaa39('0x28')],_0x481da9[_0xaa39('0x29')],_0x481da9[_0xaa39('0x2a')]));recordings[_0x481da9['uniqueid']][_0xaa39('0x28')]=_0x481da9[_0xaa39('0x28')];recordings[_0x481da9[_0xaa39('0x6')]][_0xaa39('0x29')]=_0x481da9['calleridname'];recordings[_0x481da9[_0xaa39('0x6')]]['connectedlinenum']=_0x481da9[_0xaa39('0x2b')];recordings[_0x481da9['uniqueid']][_0xaa39('0x2c')]=_0x481da9[_0xaa39('0x2c')];if(recordings[_0x481da9[_0xaa39('0x6')]][_0xaa39('0x2d')]=='outbound'&&recordings[_0x481da9[_0xaa39('0x6')]][_0xaa39('0x8')]){recordings[_0x481da9[_0xaa39('0x6')]][_0xaa39('0x2b')]=recordings[_0x481da9[_0xaa39('0x6')]][_0xaa39('0x8')];recordings[_0x481da9[_0xaa39('0x6')]][_0xaa39('0x2c')]='';}recordings[_0x481da9['uniqueid']]['monitors'][_0xaa39('0x2e')](function(_0x39e794){var _0x1c89b4=_['clone'](recordings[_0x481da9[_0xaa39('0x6')]]);_0x1c89b4[_0xaa39('0x1d')]=_0x39e794[_0xaa39('0x1d')];writeDB(_0x1c89b4);});delete recordings[_0x481da9['uniqueid']];}}catch(_0x944b4b){utils[_0xaa39('0x12')](util[_0xaa39('0x4')](_0xaa39('0x26'),_0x481da9['uniqueid']),_0x944b4b);}};exports[_0xaa39('0x2f')]=function(_0x2304e5){try{if(!_['isNil'](recordings[_0x2304e5[_0xaa39('0x6')]])){utils[_0xaa39('0xc')](util[_0xaa39('0x4')]('[%s][recordings][newexten]',_0x2304e5[_0xaa39('0x6')]),_0x2304e5);utils[_0xaa39('0x3')](util[_0xaa39('0x4')]('[%s][recordings][newexten]\x20application:%s\x20appdata:%s',_0x2304e5[_0xaa39('0x6')],_0x2304e5[_0xaa39('0x30')],_0x2304e5[_0xaa39('0x31')]));if(_0x2304e5[_0xaa39('0x30')][_0xaa39('0x32')]()==_0xaa39('0x33')&&_[_0xaa39('0x34')](_0x2304e5[_0xaa39('0x31')][_0xaa39('0x32')](),'cdr')){var _0x4d9042=_0x2304e5[_0xaa39('0x31')][_0xaa39('0x35')]('=');var _0x5491e8=_0x4d9042[0x0][_0xaa39('0x36')](_0x4d9042[0x0][_0xaa39('0x37')]('(')+0x1,_0x4d9042[0x0][_0xaa39('0x37')](')'));var _0x323f26=_0x4d9042[0x1];recordings[_0x2304e5[_0xaa39('0x6')]][_0x5491e8]=_0x323f26;}}}catch(_0xe77db4){utils['error'](util[_0xaa39('0x4')](_0xaa39('0x38'),_0x2304e5[_0xaa39('0x6')]),_0xe77db4);}};exports[_0xaa39('0x39')]=function(_0x52e324){try{if(!_[_0xaa39('0x15')](recordings[_0x52e324[_0xaa39('0x6')]])){utils[_0xaa39('0xc')](util[_0xaa39('0x4')](_0xaa39('0x3a'),_0x52e324[_0xaa39('0x6')]),_0x52e324);utils[_0xaa39('0x3')](util[_0xaa39('0x4')](_0xaa39('0x3b'),_0x52e324['uniqueid'],_0x52e324[_0xaa39('0x3c')]));recordings[_0x52e324['uniqueid']][_0xaa39('0x3c')]=_0x52e324[_0xaa39('0x3c')];}}catch(_0x585fde){utils[_0xaa39('0x12')](util[_0xaa39('0x4')](_0xaa39('0x3a'),_0x52e324['uniqueid']),_0x585fde);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index df2f1de..c14c4e6 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 _0xbd7b=['util','info','format','[%s][transfers][writeDB]\x20type:%s','type','attended','origtransfereruniqueid','request','CreateVoiceTransferReport','blindtransfer','debug','[%s][transfers][blindtransfer]','uniqueid','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereecalleridname','error','attendedtransfer','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','origtransfererchannel','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransferercontext','isNil','transfereechannel','assign','transfertargetchannel','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetlinkedid','[%s][transfers][attendedtransfer]'];(function(_0x5a9ffd,_0x47c31b){var _0x1e6f92=function(_0x446bc7){while(--_0x446bc7){_0x5a9ffd['push'](_0x5a9ffd['shift']());}};_0x1e6f92(++_0x47c31b);}(_0xbd7b,0x1ec));var _0xbbd7=function(_0x2eaacb,_0x5c68c9){_0x2eaacb=_0x2eaacb-0x0;var _0x3a84dd=_0xbd7b[_0x2eaacb];return _0x3a84dd;};'use strict';var _=require('lodash');var util=require(_0xbbd7('0x0'));var utils=require('./utils');function writeDB(_0x520960){utils[_0xbbd7('0x1')](util[_0xbbd7('0x2')](_0xbbd7('0x3'),_0x520960[_0xbbd7('0x4')]===_0xbbd7('0x5')?_0x520960[_0xbbd7('0x6')]:_0x520960['uniqueid'],_0x520960[_0xbbd7('0x4')]));utils[_0xbbd7('0x7')](_0xbbd7('0x8'),_0x520960);}exports[_0xbbd7('0x9')]=function(_0xd52a6d){try{utils[_0xbbd7('0xa')](util[_0xbbd7('0x2')](_0xbbd7('0xb'),_0xd52a6d[_0xbbd7('0xc')]),_0xd52a6d);utils['info'](util[_0xbbd7('0x2')](_0xbbd7('0xd'),_0xd52a6d[_0xbbd7('0xc')],_0xd52a6d[_0xbbd7('0xe')],_0xd52a6d[_0xbbd7('0xf')],_0xd52a6d[_0xbbd7('0x10')],_0xd52a6d[_0xbbd7('0x11')]));_0xd52a6d[_0xbbd7('0x4')]='blind';writeDB(_0xd52a6d);}catch(_0x2025d6){utils[_0xbbd7('0x12')](util[_0xbbd7('0x2')](_0xbbd7('0xb'),_0xd52a6d[_0xbbd7('0xc')]),_0x2025d6);}};exports[_0xbbd7('0x13')]=function(_0x2c27c0){try{utils[_0xbbd7('0xa')](util[_0xbbd7('0x2')]('[%s][transfers][attendedtransfer]',_0x2c27c0[_0xbbd7('0x6')]),_0x2c27c0);utils[_0xbbd7('0x1')](util[_0xbbd7('0x2')]('[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x2c27c0['origtransfereruniqueid'],_0x2c27c0[_0xbbd7('0x14')],_0x2c27c0[_0xbbd7('0x15')],_0x2c27c0[_0xbbd7('0x16')],_0x2c27c0[_0xbbd7('0x17')]));_0x2c27c0=_['assign'](_0x2c27c0,{'transfererchannel':_0x2c27c0[_0xbbd7('0x18')],'transferercalleridnum':_0x2c27c0['origtransferercalleridnum'],'transferercalleridname':_0x2c27c0[_0xbbd7('0x15')],'transfererconnectedlinenum':_0x2c27c0['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x2c27c0[_0xbbd7('0x19')],'transfereraccountcode':_0x2c27c0[_0xbbd7('0x1a')],'transferercontext':_0x2c27c0[_0xbbd7('0x1b')],'transfererexten':_0x2c27c0[_0xbbd7('0x1c')],'transfererlinkedid':_0x2c27c0[_0xbbd7('0x1d')],'context':_0x2c27c0[_0xbbd7('0x1e')],'extension':_0x2c27c0['origtransfererexten'],'type':'attended'});if(_[_0xbbd7('0x1f')](_0x2c27c0[_0xbbd7('0x20')])){_0x2c27c0=_[_0xbbd7('0x21')](_0x2c27c0,{'transfereechannel':_0x2c27c0[_0xbbd7('0x22')],'transfereecalleridnum':_0x2c27c0['transfertargetcalleridnum'],'transfereecalleridname':_0x2c27c0[_0xbbd7('0x17')],'transfereeconnectedlinenum':_0x2c27c0[_0xbbd7('0x23')],'transfereeconnectedlinename':_0x2c27c0[_0xbbd7('0x24')],'transfereeaccountcode':_0x2c27c0[_0xbbd7('0x25')],'transfereecontext':_0x2c27c0[_0xbbd7('0x26')],'transfereeexten':_0x2c27c0['transfertargetexten'],'transfereelinkedid':_0x2c27c0[_0xbbd7('0x27')]});}writeDB(_0x2c27c0);}catch(_0x1f954d){utils[_0xbbd7('0x12')](util[_0xbbd7('0x2')](_0xbbd7('0x28'),_0x2c27c0['origtransfereruniqueid']),_0x1f954d);}}; \ No newline at end of file +var _0x77fe=['secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransferercontext','attended','isNil','transfertargetaccountcode','transfertargetcontext','error','lodash','util','./utils','info','format','type','origtransfereruniqueid','uniqueid','request','blindtransfer','debug','[%s][transfers][blindtransfer]','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereecalleridname','blind','attendedtransfer','[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','transfertargetcalleridnum','assign','origtransfererchannel','origtransferercalleridname','secondtransfererconnectedlinenum'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x77fe,0x115));var _0xe77f=function(_0xdcd2f4,_0x38e5c3){_0xdcd2f4=_0xdcd2f4-0x0;var _0x55a05d=_0x77fe[_0xdcd2f4];return _0x55a05d;};'use strict';var _=require(_0xe77f('0x0'));var util=require(_0xe77f('0x1'));var utils=require(_0xe77f('0x2'));function writeDB(_0x50c380){utils[_0xe77f('0x3')](util[_0xe77f('0x4')]('[%s][transfers][writeDB]\x20type:%s',_0x50c380[_0xe77f('0x5')]==='attended'?_0x50c380[_0xe77f('0x6')]:_0x50c380[_0xe77f('0x7')],_0x50c380[_0xe77f('0x5')]));utils[_0xe77f('0x8')]('CreateVoiceTransferReport',_0x50c380);}exports[_0xe77f('0x9')]=function(_0x17d154){try{utils[_0xe77f('0xa')](util[_0xe77f('0x4')](_0xe77f('0xb'),_0x17d154[_0xe77f('0x7')]),_0x17d154);utils[_0xe77f('0x3')](util[_0xe77f('0x4')](_0xe77f('0xc'),_0x17d154[_0xe77f('0x7')],_0x17d154[_0xe77f('0xd')],_0x17d154[_0xe77f('0xe')],_0x17d154[_0xe77f('0xf')],_0x17d154[_0xe77f('0x10')]));_0x17d154[_0xe77f('0x5')]=_0xe77f('0x11');writeDB(_0x17d154);}catch(_0x4de8c2){utils['error'](util[_0xe77f('0x4')](_0xe77f('0xb'),_0x17d154['uniqueid']),_0x4de8c2);}};exports[_0xe77f('0x12')]=function(_0x53a996){try{utils[_0xe77f('0xa')](util['format'](_0xe77f('0x13'),_0x53a996[_0xe77f('0x6')]),_0x53a996);utils[_0xe77f('0x3')](util[_0xe77f('0x4')](_0xe77f('0x14'),_0x53a996[_0xe77f('0x6')],_0x53a996[_0xe77f('0x15')],_0x53a996['origtransferercalleridname'],_0x53a996[_0xe77f('0x16')],_0x53a996['transfertargetcalleridname']));_0x53a996=_[_0xe77f('0x17')](_0x53a996,{'transfererchannel':_0x53a996[_0xe77f('0x18')],'transferercalleridnum':_0x53a996[_0xe77f('0x15')],'transferercalleridname':_0x53a996[_0xe77f('0x19')],'transfererconnectedlinenum':_0x53a996[_0xe77f('0x1a')],'transfererconnectedlinename':_0x53a996[_0xe77f('0x1b')],'transfereraccountcode':_0x53a996[_0xe77f('0x1c')],'transferercontext':_0x53a996[_0xe77f('0x1d')],'transfererexten':_0x53a996[_0xe77f('0x1e')],'transfererlinkedid':_0x53a996[_0xe77f('0x1f')],'context':_0x53a996[_0xe77f('0x20')],'extension':_0x53a996['origtransfererexten'],'type':_0xe77f('0x21')});if(_[_0xe77f('0x22')](_0x53a996['transfereechannel'])){_0x53a996=_[_0xe77f('0x17')](_0x53a996,{'transfereechannel':_0x53a996['transfertargetchannel'],'transfereecalleridnum':_0x53a996[_0xe77f('0x16')],'transfereecalleridname':_0x53a996['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x53a996['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x53a996['transfertargetconnectedlinename'],'transfereeaccountcode':_0x53a996[_0xe77f('0x23')],'transfereecontext':_0x53a996[_0xe77f('0x24')],'transfereeexten':_0x53a996['transfertargetexten'],'transfereelinkedid':_0x53a996['transfertargetlinkedid']});}writeDB(_0x53a996);}catch(_0x358fc5){utils[_0xe77f('0x25')](util[_0xe77f('0x4')](_0xe77f('0x13'),_0x53a996[_0xe77f('0x6')]),_0x358fc5);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index 2d5ce80..176a379 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 _0xac41=['addTime','add','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','diffTime','diff','sumTime','now','isAfter','isBefore','bluebird','jayson/promise','moment','util','client','http','../../config/logger','xdr','info','inspect','debug','error','request','catch','GetUser','internal','name','interface','then','[utils][getUser]\x20where:%s','stringify','length','result','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','found','notfound','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','[utils][getVoiceQueueByName]'];(function(_0x2da7d5,_0x172c9d){var _0x4dc23c=function(_0x40adae){while(--_0x40adae){_0x2da7d5['push'](_0x2da7d5['shift']());}};_0x4dc23c(++_0x172c9d);}(_0xac41,0xdd));var _0x1ac4=function(_0x228474,_0x5f295a){_0x228474=_0x228474-0x0;var _0x307cfe=_0xac41[_0x228474];return _0x307cfe;};'use strict';var BPromise=require(_0x1ac4('0x0'));var jayson=require(_0x1ac4('0x1'));var moment=require(_0x1ac4('0x2'));var util=require(_0x1ac4('0x3'));var client=jayson[_0x1ac4('0x4')][_0x1ac4('0x5')]({'port':0x2329});var logger=require(_0x1ac4('0x6'))(_0x1ac4('0x7'));exports['info']=function(_0x2c33d6,_0x216c0d){logger[_0x1ac4('0x8')](_0x2c33d6,_0x216c0d?util[_0x1ac4('0x9')](_0x216c0d,{'showHidden':![],'depth':null}):'');};exports[_0x1ac4('0xa')]=function(_0x2ad173,_0x18703d){logger[_0x1ac4('0xa')](_0x2ad173,_0x18703d?util[_0x1ac4('0x9')](_0x18703d,{'showHidden':![],'depth':null}):'');};exports[_0x1ac4('0xb')]=function(_0x109c09,_0x151e4f){logger[_0x1ac4('0xb')](_0x109c09,_0x151e4f?util[_0x1ac4('0x9')](_0x151e4f,{'showHidden':![],'depth':null}):'');};exports[_0x1ac4('0xc')]=function(_0x36ed97,_0x56dcfd){return client[_0x1ac4('0xc')](_0x36ed97,{'body':_0x56dcfd})['then'](function(_0x357cea){logger[_0x1ac4('0xa')]('[utils][request]\x20name:%s',_0x36ed97,_0x357cea?util[_0x1ac4('0x9')](_0x357cea,{'showHidden':![],'depth':null}):'');})[_0x1ac4('0xd')](function(_0x4bc8d8){logger[_0x1ac4('0xb')]('[utils][request]\x20name:%s',_0x36ed97,_0x4bc8d8?util['inspect'](_0x4bc8d8,{'showHidden':![],'depth':null}):'');});};function getUser(_0x527a60){return client[_0x1ac4('0xc')](_0x1ac4('0xe'),{'options':{'raw':!![],'attributes':['id',_0x1ac4('0xf'),_0x1ac4('0x10'),_0x1ac4('0x11')],'where':_0x527a60,'limit':0x1}})[_0x1ac4('0x12')](function(_0x5038e3){logger['debug'](_0x1ac4('0x13'),JSON[_0x1ac4('0x14')](_0x527a60),_0x5038e3?util[_0x1ac4('0x9')](_0x5038e3,{'showHidden':![],'depth':null}):'');return _0x5038e3['result'][_0x1ac4('0x15')]?_0x5038e3[_0x1ac4('0x16')][0x0]:null;});}exports[_0x1ac4('0x17')]=function(_0x3e8c5a){return new BPromise(function(_0x1e7669,_0x26cacd){if(_0x3e8c5a){return getUser({'internal':_0x3e8c5a})[_0x1ac4('0x12')](function(_0x5930ea){logger['info'](_0x1ac4('0x18'),_0x3e8c5a,_0x5930ea?_0x1ac4('0x19'):_0x1ac4('0x1a'));return _0x1e7669(_0x5930ea);})[_0x1ac4('0xd')](function(_0x3bd3f7){logger['error']('[utils][getUserByInternal]',_0x3bd3f7?util[_0x1ac4('0x9')](_0x3bd3f7,{'showHidden':![],'depth':null}):'');return _0x1e7669(null);});}return _0x1e7669(null);});};exports[_0x1ac4('0x1b')]=function(_0x479110){return new BPromise(function(_0x7113bf,_0x18d2b9){if(_0x479110){return getUser({'interface':_0x479110})[_0x1ac4('0x12')](function(_0x2643bc){logger['info'](_0x1ac4('0x1c'),_0x479110,_0x2643bc?_0x1ac4('0x19'):'notfound');return _0x7113bf(_0x2643bc);})[_0x1ac4('0xd')](function(_0x5e58b4){logger[_0x1ac4('0xb')](_0x1ac4('0x1d'),_0x5e58b4?util[_0x1ac4('0x9')](_0x5e58b4,{'showHidden':![],'depth':null}):'');return _0x7113bf(null);});}return _0x7113bf(null);});};exports[_0x1ac4('0x1e')]=function(_0x534677){return new BPromise(function(_0x1ddf22,_0x54284c){if(_0x534677){return getUser({'name':_0x534677})[_0x1ac4('0x12')](function(_0x2163f9){logger[_0x1ac4('0x8')](_0x1ac4('0x1f'),_0x534677,_0x2163f9?_0x1ac4('0x19'):_0x1ac4('0x1a'));return _0x1ddf22(_0x2163f9);})[_0x1ac4('0xd')](function(_0x2ef654){logger[_0x1ac4('0xb')](_0x1ac4('0x20'),_0x2ef654?util[_0x1ac4('0x9')](_0x2ef654,{'showHidden':![],'depth':null}):'');return _0x1ddf22(null);});}return _0x1ddf22(null);});};exports[_0x1ac4('0x21')]=function(_0x4541bb){return new BPromise(function(_0x14de4e,_0x22e219){if(_0x4541bb){return client[_0x1ac4('0xc')](_0x1ac4('0x22'),{'options':{'raw':!![],'attributes':['id','name','type','acw',_0x1ac4('0x23')],'where':{'name':_0x4541bb},'limit':0x1}})[_0x1ac4('0x12')](function(_0x5cf87d){logger[_0x1ac4('0xa')](_0x1ac4('0x24'),_0x4541bb,_0x5cf87d?util[_0x1ac4('0x9')](_0x5cf87d,{'showHidden':![],'depth':null}):'');logger['info'](_0x1ac4('0x25'),_0x4541bb,_0x5cf87d?'found':'notfound');return _0x14de4e(_0x5cf87d[_0x1ac4('0x16')][_0x1ac4('0x15')]?_0x5cf87d[_0x1ac4('0x16')][0x0]:null);})['catch'](function(_0xd8ed1b){logger[_0x1ac4('0xb')](_0x1ac4('0x26'),_0xd8ed1b?util[_0x1ac4('0x9')](_0xd8ed1b,{'showHidden':![],'depth':null}):'');return _0x14de4e(null);});}return _0x14de4e(null);});};exports[_0x1ac4('0x27')]=function(_0x52ba7f,_0x2ff627){return moment(_0x52ba7f)[_0x1ac4('0x28')](_0x2ff627,_0x1ac4('0x29'))[_0x1ac4('0x2a')](_0x1ac4('0x2b'));};exports[_0x1ac4('0x2c')]=function(_0x1c7259,_0x593705){return moment(_0x1c7259)[_0x1ac4('0x2d')](_0x593705,_0x1ac4('0x29'))['format'](_0x1ac4('0x2b'));};exports[_0x1ac4('0x2e')]=function(_0x584e04,_0x10815c){return moment(_0x584e04)[_0x1ac4('0x2f')](moment(_0x10815c),_0x1ac4('0x29'));};exports[_0x1ac4('0x30')]=function(_0x1625f5,_0x3d8694){return parseInt(_0x1625f5,0xa)+parseInt(_0x3d8694,0xa);};exports[_0x1ac4('0x31')]=function(){return moment()['format'](_0x1ac4('0x2b'));};exports[_0x1ac4('0x32')]=function(_0x289b2a,_0x3d329c){if(_0x3d329c){return moment(_0x289b2a)[_0x1ac4('0x32')](_0x3d329c);}return!![];};exports[_0x1ac4('0x33')]=function(_0x41a9c3,_0x4f4c4c){if(_0x4f4c4c){return moment(_0x41a9c3)['isBefore'](_0x4f4c4c);}else if(_0x41a9c3){return!![];}return![];}; \ No newline at end of file +var _0x4990=['subtract','diffTime','diff','seconds','sumTime','now','format','isAfter','isBefore','bluebird','moment','util','client','http','../../config/logger','xdr','info','inspect','debug','error','request','then','[utils][request]\x20name:%s','catch','name','interface','[utils][getUser]\x20where:%s','stringify','result','length','getUserByInternal','found','notfound','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','type','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]','add','YYYY-MM-DD\x20HH:mm:ss','subtractTime'];(function(_0x522e2b,_0x10eb9d){var _0x5e3be5=function(_0x739a8f){while(--_0x739a8f){_0x522e2b['push'](_0x522e2b['shift']());}};_0x5e3be5(++_0x10eb9d);}(_0x4990,0xfe));var _0x0499=function(_0x2a5099,_0x329e92){_0x2a5099=_0x2a5099-0x0;var _0x2802f1=_0x4990[_0x2a5099];return _0x2802f1;};'use strict';var BPromise=require(_0x0499('0x0'));var jayson=require('jayson/promise');var moment=require(_0x0499('0x1'));var util=require(_0x0499('0x2'));var client=jayson[_0x0499('0x3')][_0x0499('0x4')]({'port':0x2329});var logger=require(_0x0499('0x5'))(_0x0499('0x6'));exports[_0x0499('0x7')]=function(_0x1fab87,_0x3ee368){logger[_0x0499('0x7')](_0x1fab87,_0x3ee368?util[_0x0499('0x8')](_0x3ee368,{'showHidden':![],'depth':null}):'');};exports[_0x0499('0x9')]=function(_0x4b0811,_0x39969a){logger[_0x0499('0x9')](_0x4b0811,_0x39969a?util[_0x0499('0x8')](_0x39969a,{'showHidden':![],'depth':null}):'');};exports[_0x0499('0xa')]=function(_0x267f5a,_0x2feb38){logger[_0x0499('0xa')](_0x267f5a,_0x2feb38?util[_0x0499('0x8')](_0x2feb38,{'showHidden':![],'depth':null}):'');};exports[_0x0499('0xb')]=function(_0x10f6b5,_0x1917d6){return client[_0x0499('0xb')](_0x10f6b5,{'body':_0x1917d6})[_0x0499('0xc')](function(_0x528ac9){logger[_0x0499('0x9')](_0x0499('0xd'),_0x10f6b5,_0x528ac9?util[_0x0499('0x8')](_0x528ac9,{'showHidden':![],'depth':null}):'');})[_0x0499('0xe')](function(_0x5e4c40){logger[_0x0499('0xa')]('[utils][request]\x20name:%s',_0x10f6b5,_0x5e4c40?util[_0x0499('0x8')](_0x5e4c40,{'showHidden':![],'depth':null}):'');});};function getUser(_0x11d05e){return client[_0x0499('0xb')]('GetUser',{'options':{'raw':!![],'attributes':['id','internal',_0x0499('0xf'),_0x0499('0x10')],'where':_0x11d05e,'limit':0x1}})[_0x0499('0xc')](function(_0x11e212){logger[_0x0499('0x9')](_0x0499('0x11'),JSON[_0x0499('0x12')](_0x11d05e),_0x11e212?util[_0x0499('0x8')](_0x11e212,{'showHidden':![],'depth':null}):'');return _0x11e212[_0x0499('0x13')][_0x0499('0x14')]?_0x11e212[_0x0499('0x13')][0x0]:null;});}exports[_0x0499('0x15')]=function(_0x68a3a7){return new BPromise(function(_0x3abe85,_0x129ae3){if(_0x68a3a7){return getUser({'internal':_0x68a3a7})[_0x0499('0xc')](function(_0x514863){logger['info']('[utils][getUserByInternal]\x20internal:%s\x20%s',_0x68a3a7,_0x514863?_0x0499('0x16'):_0x0499('0x17'));return _0x3abe85(_0x514863);})['catch'](function(_0x4a717a){logger[_0x0499('0xa')](_0x0499('0x18'),_0x4a717a?util[_0x0499('0x8')](_0x4a717a,{'showHidden':![],'depth':null}):'');return _0x3abe85(null);});}return _0x3abe85(null);});};exports[_0x0499('0x19')]=function(_0x25fd25){return new BPromise(function(_0x256130,_0x2eafd6){if(_0x25fd25){return getUser({'interface':_0x25fd25})[_0x0499('0xc')](function(_0x22ff53){logger[_0x0499('0x7')]('[utils][getUserByInterface]\x20interface:%s\x20%s',_0x25fd25,_0x22ff53?_0x0499('0x16'):_0x0499('0x17'));return _0x256130(_0x22ff53);})[_0x0499('0xe')](function(_0x44e0a3){logger[_0x0499('0xa')](_0x0499('0x1a'),_0x44e0a3?util[_0x0499('0x8')](_0x44e0a3,{'showHidden':![],'depth':null}):'');return _0x256130(null);});}return _0x256130(null);});};exports[_0x0499('0x1b')]=function(_0x6efeb9){return new BPromise(function(_0x505776,_0x8f9a25){if(_0x6efeb9){return getUser({'name':_0x6efeb9})[_0x0499('0xc')](function(_0x5249bd){logger['info'](_0x0499('0x1c'),_0x6efeb9,_0x5249bd?_0x0499('0x16'):_0x0499('0x17'));return _0x505776(_0x5249bd);})[_0x0499('0xe')](function(_0x25b783){logger[_0x0499('0xa')](_0x0499('0x1d'),_0x25b783?util[_0x0499('0x8')](_0x25b783,{'showHidden':![],'depth':null}):'');return _0x505776(null);});}return _0x505776(null);});};exports[_0x0499('0x1e')]=function(_0x41273b){return new BPromise(function(_0x4e8673,_0x2724cb){if(_0x41273b){return client['request'](_0x0499('0x1f'),{'options':{'raw':!![],'attributes':['id',_0x0499('0xf'),_0x0499('0x20'),_0x0499('0x21'),_0x0499('0x22')],'where':{'name':_0x41273b},'limit':0x1}})['then'](function(_0x238562){logger['debug'](_0x0499('0x23'),_0x41273b,_0x238562?util[_0x0499('0x8')](_0x238562,{'showHidden':![],'depth':null}):'');logger[_0x0499('0x7')]('[utils][getVoiceQueueByName]\x20name:%s\x20%s',_0x41273b,_0x238562?'found':'notfound');return _0x4e8673(_0x238562[_0x0499('0x13')][_0x0499('0x14')]?_0x238562['result'][0x0]:null);})[_0x0499('0xe')](function(_0x3f668a){logger[_0x0499('0xa')](_0x0499('0x24'),_0x3f668a?util['inspect'](_0x3f668a,{'showHidden':![],'depth':null}):'');return _0x4e8673(null);});}return _0x4e8673(null);});};exports['addTime']=function(_0x2f4326,_0x30877c){return moment(_0x2f4326)[_0x0499('0x25')](_0x30877c,'seconds')['format'](_0x0499('0x26'));};exports[_0x0499('0x27')]=function(_0x53871a,_0x4722cf){return moment(_0x53871a)[_0x0499('0x28')](_0x4722cf,'seconds')['format'](_0x0499('0x26'));};exports[_0x0499('0x29')]=function(_0x468cb3,_0x5af344){return moment(_0x468cb3)[_0x0499('0x2a')](moment(_0x5af344),_0x0499('0x2b'));};exports[_0x0499('0x2c')]=function(_0x3b9781,_0x590794){return parseInt(_0x3b9781,0xa)+parseInt(_0x590794,0xa);};exports[_0x0499('0x2d')]=function(){return moment()[_0x0499('0x2e')](_0x0499('0x26'));};exports[_0x0499('0x2f')]=function(_0x3116ea,_0x3fab5b){if(_0x3fab5b){return moment(_0x3116ea)[_0x0499('0x2f')](_0x3fab5b);}return!![];};exports[_0x0499('0x30')]=function(_0x4840d3,_0x2ff80f){if(_0x2ff80f){return moment(_0x4840d3)['isBefore'](_0x2ff80f);}else if(_0x4840d3){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 d1fd05b..2103115 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 _0xa8d4=['device','test','setupLoggers','fs-extra','lodash','express-winston','path','util','./loggers','fileLogger','./safe-template','safeTemplate','./mask-sensitive-data','maskSensitiveData','join','log','client','role','name','ensureDir','then','catch','user','no-user','data','timestamp','error','auth','set','client-side-logger','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','\x20body=%s','method','x-forwarded-for','connection','remoteAddress','url','statusCode','use','%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)','format','headers','responseTime'];(function(_0x146360,_0x522b08){var _0x234f31=function(_0x5bc5b8){while(--_0x5bc5b8){_0x146360['push'](_0x146360['shift']());}};_0x234f31(++_0x522b08);}(_0xa8d4,0xf3));var _0x4a8d=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xa8d4[_0x4243a3];return _0x1b2a33;};var fs=require(_0x4a8d('0x0'));var _=require(_0x4a8d('0x1'));var ewinston=require(_0x4a8d('0x2'));var path=require(_0x4a8d('0x3'));var util=require(_0x4a8d('0x4'));var fileLogger=require(_0x4a8d('0x5'))[_0x4a8d('0x6')];var safeTemplate=require(_0x4a8d('0x7'))[_0x4a8d('0x8')];var maskSensitiveData=require(_0x4a8d('0x9'))[_0x4a8d('0xa')];function ClientSideLogger(){function _0x43e696(_0xc18472){var _0x24eb4e=path[_0x4a8d('0xb')]('/var',_0x4a8d('0xc'),'xcally');var _0x2812e9=path[_0x4a8d('0xb')](_0x4a8d('0xd'),_0xc18472[_0x4a8d('0xe')]+'-'+_0xc18472[_0x4a8d('0xf')]);return fs[_0x4a8d('0x10')](path[_0x4a8d('0xb')](_0x24eb4e,_0x2812e9))[_0x4a8d('0x11')](function(){var _0x397892=fileLogger(_0x4a8d('0xd'),path[_0x4a8d('0xb')](_0x24eb4e,_0x2812e9));return _0x397892;})[_0x4a8d('0x12')](function(_0x1ce410){throw _0x1ce410;});}this['log']=function(_0x1f4dad,_0x4cc6a1,_0x2f51da,_0x2838d9){return _0x43e696(_0x1f4dad[_0x4a8d('0x13')])[_0x4a8d('0x11')](function(_0x97f3c6){var _0x56caa7=_0x97f3c6[_0x4cc6a1];return _0x56caa7;})[_0x4a8d('0x11')](function(_0x2be29f){var _0x3ac7be=_0x1f4dad[_0x4a8d('0x13')]?_0x1f4dad['user']['id']:_0x4a8d('0x14');var _0x5accec=_0x2838d9[_0x4a8d('0x15')];var _0x417303=_0x2838d9[_0x4a8d('0x16')];var _0x5c784c=new Date(Number(_0x417303));return _0x2be29f(_0x3ac7be,_0x5c784c,_0x2f51da,_0x5accec);})[_0x4a8d('0x12')](function(_0x39a834){fileLogger('client')[_0x4a8d('0x17')](_0x39a834);});};}function setupLoggers(_0x5e38e3){return new Promise(function(_0xaea1b3){var _0x56e019=new ClientSideLogger();var _0x463acd=fileLogger('api');var _0x1a9623=fileLogger(_0x4a8d('0x18'));_0x5e38e3[_0x4a8d('0x19')](_0x4a8d('0x1a'),_0x56e019);_0x5e38e3['use'](ewinston[_0x4a8d('0x1b')]({'winstonInstance':_0x463acd,'meta':![],'statusLevels':!![],'msg':function(_0xc9e1ff,_0x39dd32){var _0x4c9d4b=_0x4a8d('0x1c');if(!_[_0x4a8d('0x1d')](_0xc9e1ff[_0x4a8d('0x1e')])){_0x4c9d4b+=_0x4a8d('0x1f');var _0x1da265=_0xc9e1ff[_0x4a8d('0x1e')];maskSensitiveData(_0x1da265);}return safeTemplate(util['format'](_0x4c9d4b,_0xc9e1ff[_0x4a8d('0x20')],_0xc9e1ff['headers'][_0x4a8d('0x21')]?_0xc9e1ff['headers']['x-forwarded-for']:_0xc9e1ff[_0x4a8d('0x22')][_0x4a8d('0x23')]||_0xc9e1ff['ip'],_0xc9e1ff[_0x4a8d('0x24')],_0x39dd32[_0x4a8d('0x25')],_0x39dd32['responseTime'],_0xc9e1ff[_0x4a8d('0x13')]?_0xc9e1ff[_0x4a8d('0x13')]['id']:null,_0xc9e1ff[_0x4a8d('0x13')]?_0xc9e1ff[_0x4a8d('0x13')][_0x4a8d('0xf')]:null,_0xc9e1ff['user']?_0xc9e1ff['user'][_0x4a8d('0xe')]:null,_0x1da265?util['inspect'](_0x1da265,![],null):''));}}));_0x5e38e3[_0x4a8d('0x26')](ewinston[_0x4a8d('0x1b')]({'winstonInstance':_0x1a9623,'meta':![],'statusLevels':!![],'msg':function(_0x3cc4e1,_0x4665be){var _0x242dac=_0x4a8d('0x27');if(_0x3cc4e1[_0x4a8d('0x1e')]&&_0x3cc4e1[_0x4a8d('0x1e')]['device']&&_0x3cc4e1[_0x4a8d('0x1e')][_0x4a8d('0x28')]){_0x242dac=_0x4a8d('0x29');}return util[_0x4a8d('0x2a')](_0x242dac,_0x3cc4e1[_0x4a8d('0x20')],_0x3cc4e1[_0x4a8d('0x2b')]['x-forwarded-for']?_0x3cc4e1['headers'][_0x4a8d('0x21')]:_0x3cc4e1[_0x4a8d('0x22')][_0x4a8d('0x23')]||_0x3cc4e1['ip'],_0x3cc4e1[_0x4a8d('0x24')],_0x4665be[_0x4a8d('0x25')],_0x4665be[_0x4a8d('0x2c')],_0x3cc4e1['user']?_0x3cc4e1[_0x4a8d('0x13')]['id']:null,_0x3cc4e1['user']?_0x3cc4e1[_0x4a8d('0x13')]['name']:null,_0x3cc4e1[_0x4a8d('0x13')]?_0x3cc4e1[_0x4a8d('0x13')]['role']:null,_0x3cc4e1['body']&&_0x3cc4e1['body']['device']?_0x3cc4e1[_0x4a8d('0x1e')][_0x4a8d('0x2d')]:'other',_0x3cc4e1[_0x4a8d('0x1e')]&&_0x3cc4e1[_0x4a8d('0x1e')][_0x4a8d('0x28')]?_0x3cc4e1['body'][_0x4a8d('0x28')]:'',_0x3cc4e1[_0x4a8d('0x1e')]&&_0x3cc4e1[_0x4a8d('0x1e')]['agent_name']?_0x3cc4e1['body']['agent_name']:'');},'ignoreRoute':function(_0x18256f){var _0x545982=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x545982[_0x4a8d('0x2e')](_0x18256f[_0x4a8d('0x24')]);}}));return _0xaea1b3();});}exports[_0x4a8d('0x2f')]=setupLoggers; \ No newline at end of file +var _0x3781=['logger','\x20body=%s','body','format','headers','x-forwarded-for','remoteAddress','url','statusCode','responseTime','user','name','use','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','method','agent_name','setupLoggers','fs-extra','express-winston','path','util','./loggers','./safe-template','safeTemplate','./mask-sensitive-data','join','/var','xcally','client','role','ensureDir','log','then','no-user','catch','api','set','client-side-logger'];(function(_0x128843,_0x467deb){var _0xd479a9=function(_0x191dc5){while(--_0x191dc5){_0x128843['push'](_0x128843['shift']());}};_0xd479a9(++_0x467deb);}(_0x3781,0x185));var _0x1378=function(_0x4b23b0,_0xf3d9b4){_0x4b23b0=_0x4b23b0-0x0;var _0x1440d7=_0x3781[_0x4b23b0];return _0x1440d7;};var fs=require(_0x1378('0x0'));var _=require('lodash');var ewinston=require(_0x1378('0x1'));var path=require(_0x1378('0x2'));var util=require(_0x1378('0x3'));var fileLogger=require(_0x1378('0x4'))['fileLogger'];var safeTemplate=require(_0x1378('0x5'))[_0x1378('0x6')];var maskSensitiveData=require(_0x1378('0x7'))['maskSensitiveData'];function ClientSideLogger(){function _0x238bc8(_0x52c0e4){var _0x37a68c=path[_0x1378('0x8')](_0x1378('0x9'),'log',_0x1378('0xa'));var _0x43497e=path[_0x1378('0x8')](_0x1378('0xb'),_0x52c0e4[_0x1378('0xc')]+'-'+_0x52c0e4['name']);return fs[_0x1378('0xd')](path['join'](_0x37a68c,_0x43497e))['then'](function(){var _0x2a31b4=fileLogger(_0x1378('0xb'),path[_0x1378('0x8')](_0x37a68c,_0x43497e));return _0x2a31b4;})['catch'](function(_0x142555){throw _0x142555;});}this[_0x1378('0xe')]=function(_0x56e302,_0x5883d5,_0xb35763,_0x5d2083){return _0x238bc8(_0x56e302['user'])[_0x1378('0xf')](function(_0x4f1b8b){var _0x3e50ab=_0x4f1b8b[_0x5883d5];return _0x3e50ab;})['then'](function(_0x22de0f){var _0x2402a9=_0x56e302['user']?_0x56e302['user']['id']:_0x1378('0x10');var _0x194dfb=_0x5d2083['data'];var _0x5f5648=_0x5d2083['timestamp'];var _0x2394b9=new Date(Number(_0x5f5648));return _0x22de0f(_0x2402a9,_0x2394b9,_0xb35763,_0x194dfb);})[_0x1378('0x11')](function(_0x45bbc7){fileLogger(_0x1378('0xb'))['error'](_0x45bbc7);});};}function setupLoggers(_0x426ad2){return new Promise(function(_0x40d547){var _0x4a7cd9=new ClientSideLogger();var _0x38eb67=fileLogger(_0x1378('0x12'));var _0xc6a1ec=fileLogger('auth');_0x426ad2[_0x1378('0x13')](_0x1378('0x14'),_0x4a7cd9);_0x426ad2['use'](ewinston[_0x1378('0x15')]({'winstonInstance':_0x38eb67,'meta':![],'statusLevels':!![],'msg':function(_0x456308,_0x585187){var _0x525951='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s';if(!_['isEmpty'](_0x456308['body'])){_0x525951+=_0x1378('0x16');var _0x5a5307=_0x456308[_0x1378('0x17')];maskSensitiveData(_0x5a5307);}return safeTemplate(util[_0x1378('0x18')](_0x525951,_0x456308['method'],_0x456308[_0x1378('0x19')][_0x1378('0x1a')]?_0x456308['headers'][_0x1378('0x1a')]:_0x456308['connection'][_0x1378('0x1b')]||_0x456308['ip'],_0x456308[_0x1378('0x1c')],_0x585187[_0x1378('0x1d')],_0x585187[_0x1378('0x1e')],_0x456308['user']?_0x456308[_0x1378('0x1f')]['id']:null,_0x456308[_0x1378('0x1f')]?_0x456308[_0x1378('0x1f')][_0x1378('0x20')]:null,_0x456308[_0x1378('0x1f')]?_0x456308[_0x1378('0x1f')]['role']:null,_0x5a5307?util['inspect'](_0x5a5307,![],null):''));}}));_0x426ad2[_0x1378('0x21')](ewinston['logger']({'winstonInstance':_0xc6a1ec,'meta':![],'statusLevels':!![],'msg':function(_0x4d16b5,_0x474825){var _0x484113=_0x1378('0x22');if(_0x4d16b5['body']&&_0x4d16b5[_0x1378('0x17')][_0x1378('0x23')]&&_0x4d16b5['body'][_0x1378('0x24')]){_0x484113=_0x1378('0x25');}return util[_0x1378('0x18')](_0x484113,_0x4d16b5[_0x1378('0x26')],_0x4d16b5[_0x1378('0x19')][_0x1378('0x1a')]?_0x4d16b5[_0x1378('0x19')][_0x1378('0x1a')]:_0x4d16b5['connection']['remoteAddress']||_0x4d16b5['ip'],_0x4d16b5[_0x1378('0x1c')],_0x474825[_0x1378('0x1d')],_0x474825[_0x1378('0x1e')],_0x4d16b5[_0x1378('0x1f')]?_0x4d16b5[_0x1378('0x1f')]['id']:null,_0x4d16b5[_0x1378('0x1f')]?_0x4d16b5[_0x1378('0x1f')][_0x1378('0x20')]:null,_0x4d16b5[_0x1378('0x1f')]?_0x4d16b5[_0x1378('0x1f')][_0x1378('0xc')]:null,_0x4d16b5[_0x1378('0x17')]&&_0x4d16b5[_0x1378('0x17')]['device']?_0x4d16b5['body'][_0x1378('0x23')]:'other',_0x4d16b5['body']&&_0x4d16b5[_0x1378('0x17')][_0x1378('0x24')]?_0x4d16b5[_0x1378('0x17')][_0x1378('0x24')]:'',_0x4d16b5[_0x1378('0x17')]&&_0x4d16b5['body'][_0x1378('0x27')]?_0x4d16b5[_0x1378('0x17')][_0x1378('0x27')]:'');},'ignoreRoute':function(_0x1e5c9a){var _0x42664f=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x42664f['test'](_0x1e5c9a[_0x1378('0x1c')]);}}));return _0x40d547();});}exports[_0x1378('0x28')]=setupLoggers; \ No newline at end of file diff --git a/server/utils/iftime.js b/server/utils/iftime.js index 1ceb502..8237852 100644 --- a/server/utils/iftime.js +++ b/server/utils/iftime.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9059=['circularDoWInterval','monthsShort','exports','clone','hours','minutes','startOf','day','isBetween','timeCompare','dowCompare','date','daysInMonth','max','min','domCompare','format','MMM','includes','guess','test','isMoment','split','padStart','length','iftime','moment-timezone','map','source','Interval\x20string\x20not\x20valid','Date\x20not\x20valid','isValid','locale','weekdaysShort','toLowerCase','indexOf','slice','concat'];(function(_0xda193f,_0x276258){var _0x3772bc=function(_0x2278ae){while(--_0x2278ae){_0xda193f['push'](_0xda193f['shift']());}};_0x3772bc(++_0x276258);}(_0x9059,0x124));var _0x9905=function(_0x29cc2e,_0x345e4d){_0x29cc2e=_0x29cc2e-0x0;var _0x33e31c=_0x9059[_0x29cc2e];return _0x33e31c;};var _=require('lodash');var moment=require(_0x9905('0x0'));var timeRx=/(\*|(\d{1,2}:\d{1,2})(-(\d{1,2}:\d{1,2}))?)/;var dowRx=/(\*|((sun|mon|tue|wed|thu|fri|sat)(-(sun|mon|tue|wed|thu|fri|sat))?))/;var domRx=/(\*|(\d{1,2})(-(\d{1,2}))?)/;var moyRx=/(\*|(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)(-(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec))?)/;var globalRx=[timeRx,dowRx,domRx,moyRx][_0x9905('0x1')](function(_0x3e78d3){return _0x3e78d3[_0x9905('0x2')];})['join'](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING=_0x9905('0x3');var EINVALID_DATE=_0x9905('0x4');function throwIfDateNotValid(_0x5742b5){if(!_0x5742b5[_0x9905('0x5')]()){throw new Error(EINVALID_DATE);}}function extractTime(_0x2bc51e){var _0x4d948c=_0x2bc51e['split'](':')[_0x9905('0x1')](function(_0x41071d){return parseInt(_0x41071d,0xa);});var _0x65119f=_0x4d948c[0x0];var _0x30614f=_0x4d948c[0x1];if(_0x65119f<0x0||_0x65119f>0x17||_0x30614f<0x0||_0x30614f>0x3b){throw new Error(EINVALID_DATE);}return[_0x65119f,_0x30614f];}function circularDoWInterval(_0x2f78dd,_0x4c1a23){if(_0x2f78dd===_0x4c1a23){return[_0x2f78dd];}else{var _0x586db6=moment[_0x9905('0x6')]();moment[_0x9905('0x6')]('en');var _0x680c67=moment[_0x9905('0x7')]()[_0x9905('0x1')](function(_0x3cae77){return _0x3cae77[_0x9905('0x8')]();});moment[_0x9905('0x6')](_0x586db6);var _0xe513e3=_0x680c67['indexOf'](_0x2f78dd);var _0x7095f1=_0x680c67[_0x9905('0x9')](_0x4c1a23);if(_0x7095f1>_0xe513e3){return _0x680c67[_0x9905('0xa')](_0xe513e3,_0x7095f1+0x1);}else{var _0x524b2f=_0x680c67[_0x9905('0xa')](0x0,_0x7095f1+0x1);var _0x38935b=_0x680c67[_0x9905('0xa')](_0xe513e3);return _0x38935b[_0x9905('0xb')](_0x524b2f);}}}module['exports'][_0x9905('0xc')]=circularDoWInterval;function circularMonthInterval(_0xaca3f5,_0x38c138){if(_0xaca3f5===_0x38c138){return[_0xaca3f5];}else{var _0x273e38=moment[_0x9905('0x6')]();moment[_0x9905('0x6')]('en');var _0x49e853=moment[_0x9905('0xd')]()['map'](function(_0x4a382c){return _0x4a382c[_0x9905('0x8')]();});moment[_0x9905('0x6')](_0x273e38);var _0x8e2ab5=_0x49e853['indexOf'](_0xaca3f5);var _0x503f95=_0x49e853[_0x9905('0x9')](_0x38c138);if(_0x503f95>_0x8e2ab5){return _0x49e853['slice'](_0x8e2ab5,_0x503f95+0x1);}else{var _0x1cd3b3=_0x49e853['slice'](0x0,_0x503f95+0x1);var _0x283acd=_0x49e853['slice'](_0x8e2ab5);return _0x283acd[_0x9905('0xb')](_0x1cd3b3);}}}module[_0x9905('0xe')]['circularMonthInterval']=circularMonthInterval;function parseDom(_0x726f90){var _0x39b735=parseInt(_0x726f90,0xa);if(_0x39b735<0x1||_0x39b735>0x1f){throw new Error(EINVALID_DATE);}return _0x39b735;}function timeCompare(_0x51be31,_0x2902e1,_0x28a8d6){var _0x36a15b=_0x51be31[_0x9905('0xf')]();var _0xb463a5=extractTime(_0x2902e1);var _0x48ffe2=_0xb463a5[0x0];var _0x30bef0=_0xb463a5[0x1];var _0x40d71a=_0x51be31['clone']()[_0x9905('0x10')](_0x48ffe2)['minutes'](_0x30bef0);throwIfDateNotValid(_0x40d71a);var _0x2b203f=extractTime(_0x28a8d6);var _0x1abf04=_0x2b203f[0x0];var _0x454fbc=_0x2b203f[0x1];var _0x1e2b3b=_0x51be31[_0x9905('0xf')]()['hours'](_0x1abf04)[_0x9905('0x11')](_0x454fbc);throwIfDateNotValid(_0x1e2b3b);if(_0x1e2b3b['isBefore'](_0x40d71a)){var _0x54059a=_0x36a15b['clone']()[_0x9905('0x12')](_0x9905('0x13'));var _0x435e0c=_0x36a15b[_0x9905('0xf')]()['endOf'](_0x9905('0x13'));return _0x36a15b['isBetween'](_0x40d71a,_0x435e0c,undefined,'[]')||_0x36a15b['isBetween'](_0x54059a,_0x1e2b3b,undefined,'[]');}else{return _0x36a15b[_0x9905('0x14')](_0x40d71a,_0x1e2b3b,undefined,'[]');}}module['exports'][_0x9905('0x15')]=timeCompare;function dowCompare(_0x465cac,_0x5b51e7,_0x22d77b){var _0x3700f4=_0x465cac[_0x9905('0x6')]('en')['format']('ddd')[_0x9905('0x8')]();return circularDoWInterval(_0x5b51e7,_0x22d77b)['includes'](_0x3700f4);}module['exports'][_0x9905('0x16')]=dowCompare;function domCompare(_0x2f555e,_0x16ff41,_0x480819){var _0x4411a9=_0x2f555e[_0x9905('0x17')]();if(_0x16ff41===_0x480819){return _0x4411a9===_0x16ff41;}else{var _0x31e8e7=_0x2f555e[_0x9905('0x18')]();var _0x224b31=_0x16ff41<_0x480819;let _0xf1dd1f=![];var _0x4aa7f9=0x0;var _0x5a1d70=0x0;if(_0x224b31){_0x4aa7f9=Math[_0x9905('0x19')](0x1,_0x16ff41);_0x5a1d70=Math[_0x9905('0x1a')](_0x480819,_0x31e8e7);_0xf1dd1f=_0x4411a9>=_0x4aa7f9&&_0x4411a9<=_0x5a1d70;}else{_0x4aa7f9=Math[_0x9905('0x1a')](_0x16ff41,_0x31e8e7);_0x5a1d70=Math[_0x9905('0x19')](0x1,_0x480819);_0xf1dd1f=_0x4411a9>=_0x4aa7f9||_0x4411a9<=_0x5a1d70;}return _0xf1dd1f;}}module['exports'][_0x9905('0x1b')]=domCompare;function monthCompare(_0x2339a8,_0x27a42c,_0x22bd8f){var _0x30bbfd=_0x2339a8['locale']('en')[_0x9905('0x1c')](_0x9905('0x1d'))[_0x9905('0x8')]();return circularMonthInterval(_0x27a42c,_0x22bd8f)[_0x9905('0x1e')](_0x30bbfd);}module[_0x9905('0xe')]['monthCompare']=monthCompare;function iftime(_0x270dd7,_0x512337=moment['tz'][_0x9905('0x1f')](),_0x5be52c=moment()){if(!validateRx[_0x9905('0x20')](_0x270dd7)){throw new Error(EINVALID_STRING);}else{var _0x8b2d63=(moment[_0x9905('0x21')](_0x5be52c)?_0x5be52c[_0x9905('0xf')]():moment(_0x5be52c))['tz'](_0x512337)[_0x9905('0x6')]('en');throwIfDateNotValid(_0x8b2d63);var _0x4bdd21=_0x270dd7[_0x9905('0x22')](',');var _0x54bcb9=_0x4bdd21[0x0];var _0x25406a=_0x4bdd21[0x1];var _0x3f6175=_0x4bdd21[0x2];var _0x30ec71=_0x4bdd21[0x3];let _0x501f5a=!![];if(_0x54bcb9!=='*'){var _0x2e5358=_0x54bcb9[_0x9905('0x22')]('-');var _0x15c1b3=_[_0x9905('0x23')](_0x2e5358[0x0],0x5,'0');var _0x439542=_0x2e5358[_0x9905('0x24')]===0x2?_['padStart'](_0x2e5358[0x1],0x5,'0'):_0x15c1b3;_0x501f5a=timeCompare(_0x8b2d63,_0x15c1b3,_0x439542);}let _0x1483aa=!![];if(_0x25406a!=='*'){var _0x22cbca=_0x25406a[_0x9905('0x22')]('-');var _0x18dbce=_0x22cbca[0x0];var _0x513985=_0x22cbca[_0x9905('0x24')]===0x2?_0x22cbca[0x1]:_0x18dbce;_0x1483aa=dowCompare(_0x8b2d63,_0x18dbce,_0x513985);}let _0x45c0a3=!![];if(_0x3f6175!=='*'){var _0x1fccf0=_0x3f6175[_0x9905('0x22')]('-');var _0x34f1ec=parseDom(_0x1fccf0[0x0]);var _0x4b0506=_0x1fccf0['length']===0x2?parseDom(_0x1fccf0[0x1]):_0x34f1ec;_0x45c0a3=domCompare(_0x8b2d63,_0x34f1ec,_0x4b0506);}let _0x3ba529=!![];if(_0x30ec71!=='*'){var _0x474726=_0x30ec71[_0x9905('0x22')]('-');var _0x585873=_0x474726[0x0];var _0x45491a=_0x474726[_0x9905('0x24')]===0x2?_0x474726[0x1]:_0x474726[0x0];_0x3ba529=monthCompare(_0x8b2d63,_0x585873,_0x45491a);}return _0x501f5a&&_0x1483aa&&_0x45c0a3&&_0x3ba529;}}module[_0x9905('0xe')][_0x9905('0x25')]=iftime; \ No newline at end of file +var _0x8d1b=['split','locale','weekdaysShort','toLowerCase','indexOf','slice','concat','exports','circularDoWInterval','monthsShort','circularMonthInterval','clone','hours','minutes','isBefore','startOf','endOf','day','isBetween','format','includes','dowCompare','date','daysInMonth','max','min','MMM','monthCompare','guess','test','isMoment','padStart','length','iftime','moment-timezone','map','source','join','Interval\x20string\x20not\x20valid','isValid'];(function(_0x4b3e49,_0x9e566c){var _0x57e339=function(_0x1430e9){while(--_0x1430e9){_0x4b3e49['push'](_0x4b3e49['shift']());}};_0x57e339(++_0x9e566c);}(_0x8d1b,0x13a));var _0xb8d1=function(_0x1bdbf5,_0x42449b){_0x1bdbf5=_0x1bdbf5-0x0;var _0x329bfb=_0x8d1b[_0x1bdbf5];return _0x329bfb;};var _=require('lodash');var moment=require(_0xb8d1('0x0'));var timeRx=/(\*|(\d{1,2}:\d{1,2})(-(\d{1,2}:\d{1,2}))?)/;var dowRx=/(\*|((sun|mon|tue|wed|thu|fri|sat)(-(sun|mon|tue|wed|thu|fri|sat))?))/;var domRx=/(\*|(\d{1,2})(-(\d{1,2}))?)/;var moyRx=/(\*|(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)(-(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec))?)/;var globalRx=[timeRx,dowRx,domRx,moyRx][_0xb8d1('0x1')](function(_0x208f7a){return _0x208f7a[_0xb8d1('0x2')];})[_0xb8d1('0x3')](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING=_0xb8d1('0x4');var EINVALID_DATE='Date\x20not\x20valid';function throwIfDateNotValid(_0x1ae50b){if(!_0x1ae50b[_0xb8d1('0x5')]()){throw new Error(EINVALID_DATE);}}function extractTime(_0x121b37){var _0xa1511c=_0x121b37[_0xb8d1('0x6')](':')[_0xb8d1('0x1')](function(_0x335589){return parseInt(_0x335589,0xa);});var _0x463d9d=_0xa1511c[0x0];var _0x4c703c=_0xa1511c[0x1];if(_0x463d9d<0x0||_0x463d9d>0x17||_0x4c703c<0x0||_0x4c703c>0x3b){throw new Error(EINVALID_DATE);}return[_0x463d9d,_0x4c703c];}function circularDoWInterval(_0x1ad873,_0x55e130){if(_0x1ad873===_0x55e130){return[_0x1ad873];}else{var _0x39755b=moment['locale']();moment[_0xb8d1('0x7')]('en');var _0x236d0f=moment[_0xb8d1('0x8')]()[_0xb8d1('0x1')](function(_0x502d53){return _0x502d53[_0xb8d1('0x9')]();});moment['locale'](_0x39755b);var _0x2b7888=_0x236d0f['indexOf'](_0x1ad873);var _0x125ad7=_0x236d0f[_0xb8d1('0xa')](_0x55e130);if(_0x125ad7>_0x2b7888){return _0x236d0f[_0xb8d1('0xb')](_0x2b7888,_0x125ad7+0x1);}else{var _0x175f48=_0x236d0f[_0xb8d1('0xb')](0x0,_0x125ad7+0x1);var _0x38d103=_0x236d0f[_0xb8d1('0xb')](_0x2b7888);return _0x38d103[_0xb8d1('0xc')](_0x175f48);}}}module[_0xb8d1('0xd')][_0xb8d1('0xe')]=circularDoWInterval;function circularMonthInterval(_0x1614bb,_0x3e0852){if(_0x1614bb===_0x3e0852){return[_0x1614bb];}else{var _0x19b3fd=moment[_0xb8d1('0x7')]();moment[_0xb8d1('0x7')]('en');var _0x2110a0=moment[_0xb8d1('0xf')]()['map'](function(_0x345c96){return _0x345c96[_0xb8d1('0x9')]();});moment[_0xb8d1('0x7')](_0x19b3fd);var _0xa866f4=_0x2110a0[_0xb8d1('0xa')](_0x1614bb);var _0x41b3a2=_0x2110a0[_0xb8d1('0xa')](_0x3e0852);if(_0x41b3a2>_0xa866f4){return _0x2110a0[_0xb8d1('0xb')](_0xa866f4,_0x41b3a2+0x1);}else{var _0x406a10=_0x2110a0[_0xb8d1('0xb')](0x0,_0x41b3a2+0x1);var _0x52e8ff=_0x2110a0['slice'](_0xa866f4);return _0x52e8ff[_0xb8d1('0xc')](_0x406a10);}}}module[_0xb8d1('0xd')][_0xb8d1('0x10')]=circularMonthInterval;function parseDom(_0x5cdd67){var _0x133010=parseInt(_0x5cdd67,0xa);if(_0x133010<0x1||_0x133010>0x1f){throw new Error(EINVALID_DATE);}return _0x133010;}function timeCompare(_0x3ece96,_0x4aae6b,_0x1e4e15){var _0x14d48d=_0x3ece96['clone']();var _0x1f60ba=extractTime(_0x4aae6b);var _0x39b62c=_0x1f60ba[0x0];var _0x60c4e6=_0x1f60ba[0x1];var _0x587c2a=_0x3ece96[_0xb8d1('0x11')]()[_0xb8d1('0x12')](_0x39b62c)[_0xb8d1('0x13')](_0x60c4e6);throwIfDateNotValid(_0x587c2a);var _0x16f7be=extractTime(_0x1e4e15);var _0xfc0b0c=_0x16f7be[0x0];var _0x42c273=_0x16f7be[0x1];var _0x5ca511=_0x3ece96[_0xb8d1('0x11')]()[_0xb8d1('0x12')](_0xfc0b0c)[_0xb8d1('0x13')](_0x42c273);throwIfDateNotValid(_0x5ca511);if(_0x5ca511[_0xb8d1('0x14')](_0x587c2a)){var _0x2eb82b=_0x14d48d['clone']()[_0xb8d1('0x15')]('day');var _0x57de3f=_0x14d48d['clone']()[_0xb8d1('0x16')](_0xb8d1('0x17'));return _0x14d48d[_0xb8d1('0x18')](_0x587c2a,_0x57de3f,undefined,'[]')||_0x14d48d[_0xb8d1('0x18')](_0x2eb82b,_0x5ca511,undefined,'[]');}else{return _0x14d48d[_0xb8d1('0x18')](_0x587c2a,_0x5ca511,undefined,'[]');}}module['exports']['timeCompare']=timeCompare;function dowCompare(_0x437041,_0x21dff4,_0x28331e){var _0xa19aee=_0x437041[_0xb8d1('0x7')]('en')[_0xb8d1('0x19')]('ddd')[_0xb8d1('0x9')]();return circularDoWInterval(_0x21dff4,_0x28331e)[_0xb8d1('0x1a')](_0xa19aee);}module[_0xb8d1('0xd')][_0xb8d1('0x1b')]=dowCompare;function domCompare(_0x58f923,_0x3ed940,_0xefbcd4){var _0x9a544c=_0x58f923[_0xb8d1('0x1c')]();if(_0x3ed940===_0xefbcd4){return _0x9a544c===_0x3ed940;}else{var _0x4eadba=_0x58f923[_0xb8d1('0x1d')]();var _0x53b278=_0x3ed940<_0xefbcd4;let _0x153ce8=![];var _0x344147=0x0;var _0x4bfa4f=0x0;if(_0x53b278){_0x344147=Math[_0xb8d1('0x1e')](0x1,_0x3ed940);_0x4bfa4f=Math[_0xb8d1('0x1f')](_0xefbcd4,_0x4eadba);_0x153ce8=_0x9a544c>=_0x344147&&_0x9a544c<=_0x4bfa4f;}else{_0x344147=Math[_0xb8d1('0x1f')](_0x3ed940,_0x4eadba);_0x4bfa4f=Math[_0xb8d1('0x1e')](0x1,_0xefbcd4);_0x153ce8=_0x9a544c>=_0x344147||_0x9a544c<=_0x4bfa4f;}return _0x153ce8;}}module[_0xb8d1('0xd')]['domCompare']=domCompare;function monthCompare(_0x537c40,_0x2b1832,_0x15f041){var _0x9c6492=_0x537c40[_0xb8d1('0x7')]('en')[_0xb8d1('0x19')](_0xb8d1('0x20'))[_0xb8d1('0x9')]();return circularMonthInterval(_0x2b1832,_0x15f041)[_0xb8d1('0x1a')](_0x9c6492);}module[_0xb8d1('0xd')][_0xb8d1('0x21')]=monthCompare;function iftime(_0x4dcb31,_0x3c8090=moment['tz'][_0xb8d1('0x22')](),_0x23b93d=moment()){if(!validateRx[_0xb8d1('0x23')](_0x4dcb31)){throw new Error(EINVALID_STRING);}else{var _0x446004=(moment[_0xb8d1('0x24')](_0x23b93d)?_0x23b93d[_0xb8d1('0x11')]():moment(_0x23b93d))['tz'](_0x3c8090)[_0xb8d1('0x7')]('en');throwIfDateNotValid(_0x446004);var _0x2e9beb=_0x4dcb31[_0xb8d1('0x6')](',');var _0xf4d8c0=_0x2e9beb[0x0];var _0x49258c=_0x2e9beb[0x1];var _0x4bd8c3=_0x2e9beb[0x2];var _0x492c2c=_0x2e9beb[0x3];let _0x2f4fca=!![];if(_0xf4d8c0!=='*'){var _0x5d5373=_0xf4d8c0[_0xb8d1('0x6')]('-');var _0x3e1fa8=_[_0xb8d1('0x25')](_0x5d5373[0x0],0x5,'0');var _0x5123f5=_0x5d5373[_0xb8d1('0x26')]===0x2?_[_0xb8d1('0x25')](_0x5d5373[0x1],0x5,'0'):_0x3e1fa8;_0x2f4fca=timeCompare(_0x446004,_0x3e1fa8,_0x5123f5);}let _0x431b4d=!![];if(_0x49258c!=='*'){var _0x3874aa=_0x49258c[_0xb8d1('0x6')]('-');var _0xda319d=_0x3874aa[0x0];var _0x1ea3aa=_0x3874aa[_0xb8d1('0x26')]===0x2?_0x3874aa[0x1]:_0xda319d;_0x431b4d=dowCompare(_0x446004,_0xda319d,_0x1ea3aa);}let _0x103caf=!![];if(_0x4bd8c3!=='*'){var _0x51ad33=_0x4bd8c3['split']('-');var _0x2c19d2=parseDom(_0x51ad33[0x0]);var _0x58a0bc=_0x51ad33[_0xb8d1('0x26')]===0x2?parseDom(_0x51ad33[0x1]):_0x2c19d2;_0x103caf=domCompare(_0x446004,_0x2c19d2,_0x58a0bc);}let _0x588ceb=!![];if(_0x492c2c!=='*'){var _0x92b0c9=_0x492c2c['split']('-');var _0x402fa9=_0x92b0c9[0x0];var _0x226c16=_0x92b0c9[_0xb8d1('0x26')]===0x2?_0x92b0c9[0x1]:_0x92b0c9[0x0];_0x588ceb=monthCompare(_0x446004,_0x402fa9,_0x226c16);}return _0x2f4fca&&_0x431b4d&&_0x103caf&&_0x588ceb;}}module[_0xb8d1('0xd')][_0xb8d1('0x27')]=iftime; \ No newline at end of file diff --git a/server/utils/loggers.js b/server/utils/loggers.js index 4f1bab4..51baf7b 100644 --- a/server/utils/loggers.js +++ b/server/utils/loggers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4551=['red','bold\x20yellow','bold\x20white','bold\x20green','gray','bold\x20magenta','/var/log/xcally','join','format','message','replace','{{{','}}}','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','toUpperCase','keys','meta','length','stringify','level','Logger','transports','File','%s-%s','error','Console','warn','consoleLogger','fileLogger','path','util','moment','winston','debugLevel','toLowerCase','redBG\x20white'];(function(_0x3d4d82,_0x16df31){var _0x198245=function(_0x5278fe){while(--_0x5278fe){_0x3d4d82['push'](_0x3d4d82['shift']());}};_0x198245(++_0x16df31);}(_0x4551,0x146));var _0x1455=function(_0x2ea33d,_0x1076c9){_0x2ea33d=_0x2ea33d-0x0;var _0x2065a8=_0x4551[_0x2ea33d];return _0x2065a8;};'use strict';var path=require(_0x1455('0x0'));var util=require(_0x1455('0x1'));var moment=require(_0x1455('0x2'));var winston=require(_0x1455('0x3'));var config=require('../config/environment');var debugLevel=config[_0x1455('0x4')]?config[_0x1455('0x4')][_0x1455('0x5')]():'info';var XC_LOG_LEVELS={'fatal':0x0,'error':0x0,'warn':0x1,'info':0x2,'print':0x2,'success':0x2,'http':0x3,'verbose':0x4,'debug':0x5,'silly':0x6};var XC_LOG_COLORS={'fatal':_0x1455('0x6'),'error':_0x1455('0x7'),'warn':_0x1455('0x8'),'info':'white','print':_0x1455('0x9'),'success':_0x1455('0xa'),'http':_0x1455('0xb'),'verbose':_0x1455('0xc'),'debug':'bold\x20blue','silly':'bold\x20cyan'};winston['addColors'](XC_LOG_COLORS);function getLogFileName(_0x3f6f26,_0x514478,_0x2b5ceb){var _0xfbac6=_0x3f6f26||_0x1455('0xd');return path[_0x1455('0xe')](_0xfbac6,util[_0x1455('0xf')]('%s-%s.log',_0x514478,_0x2b5ceb));}function formatter(_0x30ba25,_0x5ba029){_0x5ba029[_0x1455('0x10')]=_0x5ba029[_0x1455('0x10')][_0x1455('0x11')](/@@{/g,_0x1455('0x12'))[_0x1455('0x11')](/}@@/g,_0x1455('0x13'))[_0x1455('0x11')](/@{/g,'{{')[_0x1455('0x11')](/}@/g,'}}');return util[_0x1455('0xf')](_0x1455('0x14'),moment()[_0x1455('0xf')](_0x1455('0x15')),_0x5ba029['level'][_0x1455('0x16')](),_0x30ba25,_0x5ba029[_0x1455('0x10')]);}function fileFormat(_0x3f1a64,_0x5e4e93){_0x5e4e93['message']=_0x5e4e93['message'][_0x1455('0x11')](/@@{/g,_0x1455('0x12'))[_0x1455('0x11')](/}@@/g,_0x1455('0x13'))[_0x1455('0x11')](/@{/g,'{{')[_0x1455('0x11')](/}@/g,'}}');var _0x4dfb56=_0x5e4e93['meta']&&Object[_0x1455('0x17')](_0x5e4e93[_0x1455('0x18')])[_0x1455('0x19')]?'\x0a\x09'+JSON[_0x1455('0x1a')](_0x5e4e93[_0x1455('0x18')]):'';return util[_0x1455('0xf')]('[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s',moment()[_0x1455('0xf')](_0x1455('0x15')),_0x5e4e93[_0x1455('0x1b')][_0x1455('0x16')](),_0x3f1a64,_0x5e4e93[_0x1455('0x10')],_0x4dfb56);}function consoleLogger(){var _0x294e56=new winston[(_0x1455('0x1c'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x1455('0x1d'))]['Console']({'level':'warn','json':![],'formatter':function(_0x5b5b03){return formatter('',_0x5b5b03);}})]});return _0x294e56;}function fileLogger(_0xfa047a,_0x379d96){var _0x2291af=new winston[(_0x1455('0x1c'))]({'levels':XC_LOG_LEVELS,'transports':[new winston['transports'][(_0x1455('0x1e'))]({'name':util[_0x1455('0xf')](_0x1455('0x1f'),_0xfa047a,_0x1455('0x20')),'filename':getLogFileName(_0x379d96,_0xfa047a,_0x1455('0x20')),'level':_0x1455('0x20'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x358aed){return fileFormat(_0xfa047a,_0x358aed);}}),new winston[(_0x1455('0x1d'))][(_0x1455('0x1e'))]({'name':util[_0x1455('0xf')]('%s-%s',_0xfa047a,debugLevel),'filename':getLogFileName(_0x379d96,_0xfa047a,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0xcd720b){return fileFormat(_0xfa047a,_0xcd720b);}}),new winston['transports'][(_0x1455('0x21'))]({'level':_0x1455('0x22'),'json':![],'formatter':function(_0x1e0d33){return fileFormat(_0xfa047a,_0x1e0d33);}})]});return _0x2291af;}exports[_0x1455('0x23')]=consoleLogger;exports[_0x1455('0x24')]=fileLogger; \ No newline at end of file +var _0xa181=['consoleLogger','fileLogger','util','moment','winston','../config/environment','debugLevel','toLowerCase','info','redBG\x20white','bold\x20yellow','white','gray','bold\x20magenta','bold\x20blue','bold\x20cyan','addColors','join','message','replace','{{{','}}}','format','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','keys','meta','length','stringify','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','Logger','transports','Console','warn','File','error','%s-%s'];(function(_0x1c4b78,_0x25a161){var _0x3d56d5=function(_0x2387d0){while(--_0x2387d0){_0x1c4b78['push'](_0x1c4b78['shift']());}};_0x3d56d5(++_0x25a161);}(_0xa181,0x161));var _0x1a18=function(_0x2e2f1c,_0x5cd092){_0x2e2f1c=_0x2e2f1c-0x0;var _0x277818=_0xa181[_0x2e2f1c];return _0x277818;};'use strict';var path=require('path');var util=require(_0x1a18('0x0'));var moment=require(_0x1a18('0x1'));var winston=require(_0x1a18('0x2'));var config=require(_0x1a18('0x3'));var debugLevel=config[_0x1a18('0x4')]?config[_0x1a18('0x4')][_0x1a18('0x5')]():_0x1a18('0x6');var XC_LOG_LEVELS={'fatal':0x0,'error':0x0,'warn':0x1,'info':0x2,'print':0x2,'success':0x2,'http':0x3,'verbose':0x4,'debug':0x5,'silly':0x6};var XC_LOG_COLORS={'fatal':_0x1a18('0x7'),'error':'red','warn':_0x1a18('0x8'),'info':_0x1a18('0x9'),'print':'bold\x20white','success':'bold\x20green','http':_0x1a18('0xa'),'verbose':_0x1a18('0xb'),'debug':_0x1a18('0xc'),'silly':_0x1a18('0xd')};winston[_0x1a18('0xe')](XC_LOG_COLORS);function getLogFileName(_0x2db600,_0x6cfaea,_0x1cd247){var _0xd44359=_0x2db600||'/var/log/xcally';return path[_0x1a18('0xf')](_0xd44359,util['format']('%s-%s.log',_0x6cfaea,_0x1cd247));}function formatter(_0x2b68c6,_0x3584ca){_0x3584ca[_0x1a18('0x10')]=_0x3584ca['message'][_0x1a18('0x11')](/@@{/g,_0x1a18('0x12'))['replace'](/}@@/g,_0x1a18('0x13'))[_0x1a18('0x11')](/@{/g,'{{')['replace'](/}@/g,'}}');return util[_0x1a18('0x14')](_0x1a18('0x15'),moment()['format'](_0x1a18('0x16')),_0x3584ca[_0x1a18('0x17')][_0x1a18('0x18')](),_0x2b68c6,_0x3584ca[_0x1a18('0x10')]);}function fileFormat(_0x14e3a5,_0xf1e0aa){_0xf1e0aa[_0x1a18('0x10')]=_0xf1e0aa['message'][_0x1a18('0x11')](/@@{/g,_0x1a18('0x12'))[_0x1a18('0x11')](/}@@/g,_0x1a18('0x13'))['replace'](/@{/g,'{{')['replace'](/}@/g,'}}');var _0x112468=_0xf1e0aa['meta']&&Object[_0x1a18('0x19')](_0xf1e0aa[_0x1a18('0x1a')])[_0x1a18('0x1b')]?'\x0a\x09'+JSON[_0x1a18('0x1c')](_0xf1e0aa['meta']):'';return util[_0x1a18('0x14')](_0x1a18('0x1d'),moment()['format'](_0x1a18('0x16')),_0xf1e0aa[_0x1a18('0x17')][_0x1a18('0x18')](),_0x14e3a5,_0xf1e0aa[_0x1a18('0x10')],_0x112468);}function consoleLogger(){var _0x5b4953=new winston[(_0x1a18('0x1e'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x1a18('0x1f'))][(_0x1a18('0x20'))]({'level':_0x1a18('0x21'),'json':![],'formatter':function(_0x1a121e){return formatter('',_0x1a121e);}})]});return _0x5b4953;}function fileLogger(_0x5b0be6,_0x2a1163){var _0x46651b=new winston['Logger']({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x1a18('0x1f'))][(_0x1a18('0x22'))]({'name':util[_0x1a18('0x14')]('%s-%s',_0x5b0be6,_0x1a18('0x23')),'filename':getLogFileName(_0x2a1163,_0x5b0be6,'error'),'level':_0x1a18('0x23'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x3cb859){return fileFormat(_0x5b0be6,_0x3cb859);}}),new winston[(_0x1a18('0x1f'))][(_0x1a18('0x22'))]({'name':util[_0x1a18('0x14')](_0x1a18('0x24'),_0x5b0be6,debugLevel),'filename':getLogFileName(_0x2a1163,_0x5b0be6,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x333522){return fileFormat(_0x5b0be6,_0x333522);}}),new winston[(_0x1a18('0x1f'))][(_0x1a18('0x20'))]({'level':'warn','json':![],'formatter':function(_0x5146c6){return fileFormat(_0x5b0be6,_0x5146c6);}})]});return _0x46651b;}exports[_0x1a18('0x25')]=consoleLogger;exports[_0x1a18('0x26')]=fileLogger; \ No newline at end of file diff --git a/server/utils/mask-sensitive-data.js b/server/utils/mask-sensitive-data.js index e887a56..a854c8e 100644 --- a/server/utils/mask-sensitive-data.js +++ b/server/utils/mask-sensitive-data.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1a85=['isString','@@{','replace','}@@','includes','exports','maskSensitiveData','password','newPassword','apiKey','street','phone','mobile','email','clientSecret','code','accessKey','token','accessTokenSecret','authToken','consumerKey','consumerSecret','membername','calleridname','calleridnum','exten','vidaooApiKey','clientEmail','privateKey','accesskeyid','secretaccesskey','key','user','pass','accountSid','dsn','secret','registry','isPlainObject','isArray','length'];(function(_0x44268d,_0xad8443){var _0x4be92d=function(_0x8a57ff){while(--_0x8a57ff){_0x44268d['push'](_0x44268d['shift']());}};_0x4be92d(++_0xad8443);}(_0x1a85,0x178));var _0x51a8=function(_0x2d579f,_0x370e5d){_0x2d579f=_0x2d579f-0x0;var _0x1145da=_0x1a85[_0x2d579f];return _0x1145da;};var _=require('lodash');var sensitiveFields=['username',_0x51a8('0x0'),_0x51a8('0x1'),_0x51a8('0x2'),'firstName','lastName',_0x51a8('0x3'),_0x51a8('0x4'),_0x51a8('0x5'),'fax',_0x51a8('0x6'),'clientId',_0x51a8('0x7'),'securityToken',_0x51a8('0x8'),_0x51a8('0x9'),'tenantId',_0x51a8('0xa'),'channelSecret','accessToken',_0x51a8('0xb'),_0x51a8('0xc'),_0x51a8('0xd'),_0x51a8('0xe'),_0x51a8('0xf'),_0x51a8('0x10'),_0x51a8('0x11'),_0x51a8('0x12'),_0x51a8('0x13'),_0x51a8('0x14'),_0x51a8('0x15'),_0x51a8('0x16'),_0x51a8('0x17'),_0x51a8('0x18'),_0x51a8('0x19'),_0x51a8('0x1a'),_0x51a8('0x1b'),'localstationid',_0x51a8('0x1c'),_0x51a8('0x1d'),_0x51a8('0x1e'),'oldPassword'];function maskSensitiveData(_0xf4eb6e){const _0x547d40=/(?!^)[\s\S](?!$)/g;if(_[_0x51a8('0x1f')](_0xf4eb6e)){for(const _0x2b8d37 in _0xf4eb6e){if(_[_0x51a8('0x20')](_0xf4eb6e[_0x2b8d37])){for(let _0x2b0521=0x0;_0x2b0521<_0xf4eb6e[_0x2b8d37][_0x51a8('0x21')];_0x2b0521++){maskSensitiveData(_0xf4eb6e[_0x2b8d37][_0x2b0521]);}}else if(_[_0x51a8('0x1f')](_0xf4eb6e[_0x2b8d37])){maskSensitiveData(_0xf4eb6e[_0x2b8d37]);}else if(_[_0x51a8('0x22')](_0xf4eb6e[_0x2b8d37])){_0xf4eb6e[_0x2b8d37]=_0xf4eb6e[_0x2b8d37]['replace'](/{{{/g,_0x51a8('0x23'))[_0x51a8('0x24')](/}}}/g,_0x51a8('0x25'))[_0x51a8('0x24')](/{{/g,'@{')[_0x51a8('0x24')](/}}/g,'}@');if(_[_0x51a8('0x26')](sensitiveFields,_0x2b8d37)){_0xf4eb6e[_0x2b8d37]=_0xf4eb6e[_0x2b8d37]['replace'](_0x547d40,'*');}}}}}module[_0x51a8('0x27')][_0x51a8('0x28')]=maskSensitiveData; \ No newline at end of file +var _0xdb28=['registry','oldPassword','isPlainObject','length','isString','replace','@@{','}@@','exports','maskSensitiveData','lodash','username','password','newPassword','firstName','lastName','street','phone','mobile','email','clientId','code','accessKey','tenantId','token','channelSecret','accessToken','accessTokenSecret','consumerKey','consumerSecret','membername','calleridnum','exten','clientEmail','privateKey','accesskeyid','secretaccesskey','key','accountSid','localstationid','dsn','secret'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xdb28,0x106));var _0x8db2=function(_0x479e1b,_0x4326ed){_0x479e1b=_0x479e1b-0x0;var _0x50c569=_0xdb28[_0x479e1b];return _0x50c569;};var _=require(_0x8db2('0x0'));var sensitiveFields=[_0x8db2('0x1'),_0x8db2('0x2'),_0x8db2('0x3'),'apiKey',_0x8db2('0x4'),_0x8db2('0x5'),_0x8db2('0x6'),_0x8db2('0x7'),_0x8db2('0x8'),'fax',_0x8db2('0x9'),_0x8db2('0xa'),'clientSecret','securityToken',_0x8db2('0xb'),_0x8db2('0xc'),_0x8db2('0xd'),_0x8db2('0xe'),_0x8db2('0xf'),_0x8db2('0x10'),_0x8db2('0x11'),'authToken',_0x8db2('0x12'),_0x8db2('0x13'),_0x8db2('0x14'),'calleridname',_0x8db2('0x15'),_0x8db2('0x16'),'vidaooApiKey',_0x8db2('0x17'),_0x8db2('0x18'),_0x8db2('0x19'),_0x8db2('0x1a'),_0x8db2('0x1b'),'user','pass',_0x8db2('0x1c'),_0x8db2('0x1d'),_0x8db2('0x1e'),_0x8db2('0x1f'),_0x8db2('0x20'),_0x8db2('0x21')];function maskSensitiveData(_0x2f177a){const _0x3c96a7=/(?!^)[\s\S](?!$)/g;if(_[_0x8db2('0x22')](_0x2f177a)){for(const _0x16c8c2 in _0x2f177a){if(_['isArray'](_0x2f177a[_0x16c8c2])){for(let _0x13b0f5=0x0;_0x13b0f5<_0x2f177a[_0x16c8c2][_0x8db2('0x23')];_0x13b0f5++){maskSensitiveData(_0x2f177a[_0x16c8c2][_0x13b0f5]);}}else if(_['isPlainObject'](_0x2f177a[_0x16c8c2])){maskSensitiveData(_0x2f177a[_0x16c8c2]);}else if(_[_0x8db2('0x24')](_0x2f177a[_0x16c8c2])){_0x2f177a[_0x16c8c2]=_0x2f177a[_0x16c8c2][_0x8db2('0x25')](/{{{/g,_0x8db2('0x26'))[_0x8db2('0x25')](/}}}/g,_0x8db2('0x27'))[_0x8db2('0x25')](/{{/g,'@{')['replace'](/}}/g,'}@');if(_['includes'](sensitiveFields,_0x16c8c2)){_0x2f177a[_0x16c8c2]=_0x2f177a[_0x16c8c2][_0x8db2('0x25')](_0x3c96a7,'*');}}}}}module[_0x8db2('0x28')][_0x8db2('0x29')]=maskSensitiveData; \ No newline at end of file diff --git a/server/utils/safe-template.js b/server/utils/safe-template.js index d52ac61..b462540 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 _0x1eba=['\x20}\x20}','replace','isArray','map','isPlainObject','keys','reduce','exports','safeTemplate','lodash','{\x20{\x20'];(function(_0x5657bb,_0x2f1219){var _0x2a5ecb=function(_0x193add){while(--_0x193add){_0x5657bb['push'](_0x5657bb['shift']());}};_0x2a5ecb(++_0x2f1219);}(_0x1eba,0x1d7));var _0xa1eb=function(_0x1d211b,_0x475f3b){_0x1d211b=_0x1d211b-0x0;var _0x47c88b=_0x1eba[_0x1d211b];return _0x47c88b;};var _=require(_0xa1eb('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x2b1355){return _0x2b1355==='{{'?_0xa1eb('0x1'):_0xa1eb('0x2');}function safeTemplate(_0x3ef7ee){var _0x5865fc=_0x3ef7ee;if(typeof _0x3ef7ee==='string'){_0x5865fc=_0x3ef7ee[_0xa1eb('0x3')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0xa1eb('0x4')](_0x3ef7ee)){_0x5865fc=_0x3ef7ee[_0xa1eb('0x5')](function(_0xf9d704){return safeTemplate(_0xf9d704);});}else if(_[_0xa1eb('0x6')](_0x3ef7ee)){_0x5865fc=Object[_0xa1eb('0x7')](_0x3ef7ee)[_0xa1eb('0x8')](function(_0x2bfbb0,_0x39a5a3){_0x2bfbb0[_0x39a5a3]=safeTemplate(_0x3ef7ee[_0x39a5a3]);return _0x2bfbb0;},{});}return _0x5865fc;}module[_0xa1eb('0x9')][_0xa1eb('0xa')]=safeTemplate; \ No newline at end of file +var _0xb03e=['safeTemplate','{\x20{\x20','\x20}\x20}','string','replace','isArray','map','isPlainObject','keys','exports'];(function(_0x223a8c,_0x4e764a){var _0x373d1c=function(_0x256f45){while(--_0x256f45){_0x223a8c['push'](_0x223a8c['shift']());}};_0x373d1c(++_0x4e764a);}(_0xb03e,0x1eb));var _0xeb03=function(_0x117902,_0x183657){_0x117902=_0x117902-0x0;var _0x18934c=_0xb03e[_0x117902];return _0x18934c;};var _=require('lodash');var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x36351b){return _0x36351b==='{{'?_0xeb03('0x0'):_0xeb03('0x1');}function safeTemplate(_0x3c5e68){var _0x1c58b5=_0x3c5e68;if(typeof _0x3c5e68===_0xeb03('0x2')){_0x1c58b5=_0x3c5e68[_0xeb03('0x3')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0xeb03('0x4')](_0x3c5e68)){_0x1c58b5=_0x3c5e68[_0xeb03('0x5')](function(_0x3ba4b0){return safeTemplate(_0x3ba4b0);});}else if(_[_0xeb03('0x6')](_0x3c5e68)){_0x1c58b5=Object[_0xeb03('0x7')](_0x3c5e68)['reduce'](function(_0x3b58a2,_0x3d3322){_0x3b58a2[_0x3d3322]=safeTemplate(_0x3c5e68[_0x3d3322]);return _0x3b58a2;},{});}return _0x1c58b5;}module[_0xeb03('0x8')][_0xeb03('0x9')]=safeTemplate; \ No newline at end of file diff --git a/server/utils/update-app-config.js b/server/utils/update-app-config.js index 60c41bc..5e44a88 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 _0xfa9a=['legacy-libs','apps','motion2','NODE_PATH','string','env','pathExists','then','updated','info','Updating\x20app.json','exports','fs-extra','root','resolve','server/app.json'];(function(_0x5ae19d,_0x4946f3){var _0x4336b1=function(_0x323668){while(--_0x323668){_0x5ae19d['push'](_0x5ae19d['shift']());}};_0x4336b1(++_0x4946f3);}(_0xfa9a,0x14c));var _0xafa9=function(_0x3c2fe4,_0x2ff0d0){_0x3c2fe4=_0x3c2fe4-0x0;var _0x1f7583=_0xfa9a[_0x3c2fe4];return _0x1f7583;};var fs=require(_0xafa9('0x0'));var path=require('path');var config=require('../config/environment');var root=config[_0xafa9('0x1')];var APP_JSON_PATH=path[_0xafa9('0x2')](root,_0xafa9('0x3'));var NODEPATH=path['resolve'](root,_0xafa9('0x4'));function setLegacyLibsNodeEnvPath(_0x462ae7){let _0x2a2e30=![];if(Array['isArray'](_0x462ae7[_0xafa9('0x5')])){var _0x3c5b4f=_0x462ae7[_0xafa9('0x5')]['findIndex'](function(_0x35bfea){return _0x35bfea['name']===_0xafa9('0x6');});if(_0x3c5b4f>-0x1){var _0x419385=_0x462ae7[_0xafa9('0x5')][_0x3c5b4f];if(typeof _0x419385['env'][_0xafa9('0x7')]!==_0xafa9('0x8')){_0x419385[_0xafa9('0x9')]['NODE_PATH']=NODEPATH;_0x2a2e30=!![];}}return{'appConfig':_0x462ae7,'updated':_0x2a2e30};}}function updateAppConfig(_0x52dd64){return fs[_0xafa9('0xa')](APP_JSON_PATH)[_0xafa9('0xb')](function(_0x7c3d52){if(_0x7c3d52){return fs['readJSON'](APP_JSON_PATH)[_0xafa9('0xb')](function(_0x3ba93c){var _0xa84ec6=setLegacyLibsNodeEnvPath(_0x3ba93c);if(_0xa84ec6[_0xafa9('0xc')]){_0x52dd64[_0xafa9('0xd')](_0xafa9('0xe'));return fs['writeJSON'](APP_JSON_PATH,_0x3ba93c,{'spaces':0x2});}else{return Promise[_0xafa9('0x2')]();}});}else{return Promise[_0xafa9('0x2')]();}});}module[_0xafa9('0xf')]=updateAppConfig; \ No newline at end of file +var _0x31a7=['../config/environment','resolve','apps','name','NODE_PATH','string','env','pathExists','readJSON','then','updated','info','Updating\x20app.json','exports','fs-extra','path'];(function(_0x1ed116,_0x23bc80){var _0x574066=function(_0x424f9e){while(--_0x424f9e){_0x1ed116['push'](_0x1ed116['shift']());}};_0x574066(++_0x23bc80);}(_0x31a7,0xce));var _0x731a=function(_0x3075f2,_0x5906c9){_0x3075f2=_0x3075f2-0x0;var _0x4907f7=_0x31a7[_0x3075f2];return _0x4907f7;};var fs=require(_0x731a('0x0'));var path=require(_0x731a('0x1'));var config=require(_0x731a('0x2'));var root=config['root'];var APP_JSON_PATH=path[_0x731a('0x3')](root,'server/app.json');var NODEPATH=path['resolve'](root,'legacy-libs');function setLegacyLibsNodeEnvPath(_0x2a5e3c){let _0x62c2f8=![];if(Array['isArray'](_0x2a5e3c[_0x731a('0x4')])){var _0x4b5c7e=_0x2a5e3c[_0x731a('0x4')]['findIndex'](function(_0x101c25){return _0x101c25[_0x731a('0x5')]==='motion2';});if(_0x4b5c7e>-0x1){var _0x379e9e=_0x2a5e3c[_0x731a('0x4')][_0x4b5c7e];if(typeof _0x379e9e['env'][_0x731a('0x6')]!==_0x731a('0x7')){_0x379e9e[_0x731a('0x8')][_0x731a('0x6')]=NODEPATH;_0x62c2f8=!![];}}return{'appConfig':_0x2a5e3c,'updated':_0x62c2f8};}}function updateAppConfig(_0x113d43){return fs[_0x731a('0x9')](APP_JSON_PATH)['then'](function(_0x44d00c){if(_0x44d00c){return fs[_0x731a('0xa')](APP_JSON_PATH)[_0x731a('0xb')](function(_0x529c1a){var _0x2a82c4=setLegacyLibsNodeEnvPath(_0x529c1a);if(_0x2a82c4[_0x731a('0xc')]){_0x113d43[_0x731a('0xd')](_0x731a('0xe'));return fs['writeJSON'](APP_JSON_PATH,_0x529c1a,{'spaces':0x2});}else{return Promise[_0x731a('0x3')]();}});}else{return Promise[_0x731a('0x3')]();}});}module[_0x731a('0xf')]=updateAppConfig; \ No newline at end of file